diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 29a078c00..000000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -sudo: required -language: go -go: -- '1.10' -services: -- docker -env: - global: - - secure: VPl3TGj9cNWdsOIpvUHva1cp8gjlzL2T2ZASlf2RLpFnHn8ggCRhFc9QkSLxz6wLv155nCeLCkW3Pp7OZOXH9Q4EZDX3kBzuQisDaUNuzpaXz0w9XWE5U/SW4uGGpN2p1EZH61FW0Mi2o+vHp79gS+cdfa2fnNy1uz+4u57Ij3HbQeN28vETe9QNHu9VhS7vHMqOEBUTEaXTZGUgZ56bA9uQfudYZymN+EFPrWjGrMGNSnzEPoNq8yEoEqsGbZbdaKXWP9RCdcM4huWytme3EN775jWzt8TTPtPbNQJKiD1tiDToz0dCCvn0i4G/cuJa3NgBSi08f3JfC2ekKKTzpWdtoh8nsLvnPw1lpMZzNoTXY4yHffraat7i9kxaXa45PzM5w8t0HWzaMgY0IU3hVA6ot2eu9r8h7d77KvedluWHqjq7ATCr6QzWWMZAd7GVOmM/j10usOeKHZlvQtUsBCoghKN78qAqJdfPwtPQqsJ4RY42XPoQjRVAwzhTzTWsfdryDim+120wrDKBp5k8/6ugJMebz1PM1U1BjTvNN4RLCkimkjWRkKzZRId3mcsa9e5vke6wkXg/swRge0X4Wtdlxp2N7cIkuKy2F3LA5U8b+qvDwn/SzGPo5DAILQchC4bm1VIdxF7h305F/dtqdSpCoj9rkNKI+kGVLF27a0k= - - secure: DEg+zxj3dVyK/iT42tUO1IjctDUJ67ts3XKSGDRE7xOd5K6anIVjb4kf3OIuhB3UOGYJnRmpo3y74Tml1S5dTFcu2hYCf7+KMv9Tzwzp7SDZ2P7Y9S8iA0fdz+gCI8dsNEoRBKVYtWktq+D3SZxPit+Tw3QxA+XubrV1CSlf++SCOYrjSahA75BCdMer+g2BL382zB0y4rvdQ+qTYAk37BdyyA55P2XjcwhrzyclDcSf+ZtVYYIl8mIqvDNBCMeFz7dy6UJrF6NYcwTUybl7IrL2CzAgQDrFwgmb72kqqYbrnWUG9TVY9UPY0D6/fM9kZMc4tk7y9q8E67cLE3lHp3aOluI22OjWyAX+oekkUVv3mC0MbuXlDn75bhDIHSXzlsycwfOX8f9b0o3K1HtU9SrfkCx9HfLBOeF6GJcGDPLBhq3l1kf/pO+O+ruAU21jzIQkx8QFfwQMIhVMMFObb86CF5JiapfMCh2Cbo5ztwNj/IVduCRO6AILJc9NwV7vojcs+xB8exB0W2Fk8r+HIAfE8Q76qgu5IHGDrQsWb8Kb62AU2pkOh8ToaTd9elK7QFgxLO66ctduAuGfbfUk2JhsLhaBYUZNPAYBKTCMVdA3NTS6pn/Dh+++0osxdTc18ulreo4Uzks+fgWwdw0j21dt8XS3p8r137a1avSyMqw= - - KUBERNETES_CONFIG=${HOME}/.kube/config - matrix: - - CHANGE_MINIKUBE_NONE_USER=true -jobs: - include: - - stage: build and test - script: - - ./.travis/prepare-environment.sh - - go get -t -d ./... - - go test ./... - - go vet ./... - - operator-sdk build quay.io/t0ffel/elasticsearch-operator - - 'sed -i -e ''s/imagePullPolicy: Always/imagePullPolicy: Never/g'' deploy/deployment.yaml' - - kubectl create -f deploy/rbac.yaml - - kubectl create -f deploy/crd.yaml - - ./tests/wait-for-operator.sh - - CLUSTER_NAME=elastic1 ./tests/test-insecure-cdm.sh - - CLUSTER_NAME=elastic1 ./tests/test-secure-cdm.sh - - kubectl delete -f deploy/deployment.yaml - - stage: push to quay.io - script: - - go get -u github.com/operator-framework/operator-sdk/commands/operator-sdk - - operator-sdk build quay.io/t0ffel/elasticsearch-operator - - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin quay.io - - docker push quay.io/t0ffel/elasticsearch-operator -stages: - - build and test - - name: push to quay.io - if: branch = master AND type != pull_request -after_success: -- echo 'Build succeeded, Elasticsearch operator is running on minikube, and unit/integration - tests pass' -after_failure: -- echo 'Build failed, Elasticsearch operator is not running on minikube, or unit/integration - tests failed' diff --git a/.travis/prepare-environment.sh b/.travis/prepare-environment.sh deleted file mode 100755 index 7d8751912..000000000 --- a/.travis/prepare-environment.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -x -set -o errexit -set -o nounset - -sudo sysctl -w vm.max_map_count=262144 - -go get -u github.com/golang/dep/cmd/dep -dep ensure -curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.9.0/bin/linux/amd64/kubectl -chmod +x kubectl && sudo mv kubectl /usr/local/bin/ -curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.25.2/minikube-linux-amd64 -chmod +x minikube && sudo mv minikube /usr/local/bin/ - -sudo minikube start --vm-driver=none --kubernetes-version=v1.9.0 -go get -u github.com/operator-framework/operator-sdk/commands/operator-sdk -minikube update-context -JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do - sleep 1; done diff --git a/Gopkg.lock b/Gopkg.lock index 2225f0eea..37621cdcd 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1,6 +1,12 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. +[[projects]] + name = "cloud.google.com/go" + packages = ["compute/metadata"] + revision = "0ebda48a7f143b1cce9eb37a8c1106ac762a3430" + version = "v0.34.0" + [[projects]] name = "github.com/PuerkitoBio/purell" packages = ["."] @@ -13,17 +19,16 @@ packages = ["."] revision = "de5bf2ad457846296e2031421a34e2568e304e35" -[[projects]] - branch = "master" - name = "github.com/beorn7/perks" - packages = ["quantile"] - revision = "3a771d992973f24aa725d07868b467d1ddfceafb" - [[projects]] name = "github.com/coreos/prometheus-operator" - packages = ["pkg/client/monitoring/v1"] - revision = "82a6ad2071ff653e38b3b4719ecb789d73f3ab05" - version = "v0.25.0" + packages = [ + "pkg/apis/monitoring", + "pkg/apis/monitoring/v1", + "pkg/client/versioned/scheme", + "pkg/client/versioned/typed/monitoring/v1" + ] + revision = "72ec4b9b16ef11700724dc71fec77112536eed40" + version = "v0.26.0" [[projects]] name = "github.com/davecgh/go-spew" @@ -55,6 +60,18 @@ revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7" version = "v1.0.0" +[[projects]] + name = "github.com/go-logr/logr" + packages = ["."] + revision = "9fb12b3b21c5415d16ac18dc5cd42c1cfdd40c4e" + version = "v0.1.0" + +[[projects]] + name = "github.com/go-logr/zapr" + packages = ["."] + revision = "7536572e8d55209135cd5e7ccf7fce43dca217ab" + version = "v0.1.0" + [[projects]] name = "github.com/go-openapi/jsonpointer" packages = ["."] @@ -70,8 +87,8 @@ [[projects]] name = "github.com/go-openapi/spec" packages = ["."] - revision = "5bae59e25b21498baea7f9d46e9c147ec106a42e" - version = "v0.17.2" + revision = "5b6cdde3200976e3ecceb2868706ee39b6aff3e4" + version = "v0.18.0" [[projects]] name = "github.com/go-openapi/swag" @@ -94,6 +111,12 @@ packages = ["."] revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" +[[projects]] + branch = "master" + name = "github.com/golang/groupcache" + packages = ["lru"] + revision = "c65c006176ff7ff98bb916961c7abbc6b0afc0aa" + [[projects]] name = "github.com/golang/protobuf" packages = [ @@ -118,6 +141,12 @@ packages = ["."] revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1" +[[projects]] + name = "github.com/google/uuid" + packages = ["."] + revision = "9b3b1e0f5f99ae461456d768e7d301a7acdaa2d8" + version = "v1.1.0" + [[projects]] name = "github.com/googleapis/gnostic" packages = [ @@ -175,10 +204,10 @@ revision = "60711f1a8329503b04e1c88535f419d0bb440bff" [[projects]] - name = "github.com/matttproud/golang_protobuf_extensions" - packages = ["pbutil"] - revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" - version = "v1.0.1" + branch = "master" + name = "github.com/mattbaird/jsonpatch" + packages = ["."] + revision = "81af80346b1a01caae0cbc27fd3c1ba5b11e189f" [[projects]] name = "github.com/modern-go/concurrent" @@ -195,16 +224,19 @@ [[projects]] name = "github.com/operator-framework/operator-sdk" packages = [ - "pkg/k8sclient", - "pkg/sdk", - "pkg/sdk/internal/metrics", + "pkg/k8sutil", "pkg/test", "pkg/test/e2eutil", - "pkg/util/k8sutil", "version" ] - revision = "e5a0ab096e1a7c0e6b937d2b41707eccb82c3c77" - version = "v0.0.7" + revision = "273df3f64337d9e6cb56cb12833fa036c962402d" + version = "v0.1.1" + +[[projects]] + name = "github.com/pborman/uuid" + packages = ["."] + revision = "adf5a7427709b9deb95d29d3fa8a2bf9cfd388f1" + version = "v1.2" [[projects]] branch = "master" @@ -219,59 +251,41 @@ version = "v2.0.1" [[projects]] - name = "github.com/pkg/errors" + name = "github.com/sirupsen/logrus" packages = ["."] - revision = "645ef00459ed84a119197bfb8d8205042c6df63d" - version = "v0.8.0" + revision = "ad15b42461921f1fb3529b058c6786c6a45d5162" + version = "v1.1.1" [[projects]] - name = "github.com/prometheus/client_golang" - packages = [ - "prometheus", - "prometheus/internal", - "prometheus/promhttp" - ] - revision = "1cafe34db7fdec6022e17e00e1c1ea501022f3e4" - version = "v0.9.0" + name = "github.com/spf13/pflag" + packages = ["."] + revision = "298182f68c66c05229eb03ac171abe6e309ee79a" + version = "v1.0.3" [[projects]] - branch = "master" - name = "github.com/prometheus/client_model" - packages = ["go"] - revision = "5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f" + name = "go.uber.org/atomic" + packages = ["."] + revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289" + version = "v1.3.2" [[projects]] - branch = "master" - name = "github.com/prometheus/common" - packages = [ - "expfmt", - "internal/bitbucket.org/ww/goautoneg", - "model" - ] - revision = "7e9e6cabbd393fc208072eedef99188d0ce788b6" + name = "go.uber.org/multierr" + packages = ["."] + revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a" + version = "v1.1.0" [[projects]] - branch = "master" - name = "github.com/prometheus/procfs" + name = "go.uber.org/zap" packages = [ ".", - "internal/util", - "nfs", - "xfs" + "buffer", + "internal/bufferpool", + "internal/color", + "internal/exit", + "zapcore" ] - revision = "185b4288413d2a0dd0806f78c90dde719829e5ae" - -[[projects]] - name = "github.com/sirupsen/logrus" - packages = ["."] - revision = "ad15b42461921f1fb3529b058c6786c6a45d5162" - version = "v1.1.1" - -[[projects]] - name = "github.com/spf13/pflag" - packages = ["."] - revision = "298182f68c66c05229eb03ac171abe6e309ee79a" - version = "v1.0.3" + revision = "ff33455a0e382e8a81d14dd7c922020b6b5e7982" + version = "v1.9.1" [[projects]] branch = "master" @@ -284,6 +298,7 @@ name = "golang.org/x/net" packages = [ "context", + "context/ctxhttp", "http/httpguts", "http2", "http2/hpack", @@ -291,6 +306,18 @@ ] revision = "9b4f9f5ad5197c79fd623a3638e70d8b26cef344" +[[projects]] + branch = "master" + name = "golang.org/x/oauth2" + packages = [ + ".", + "google", + "internal", + "jws", + "jwt" + ] + revision = "d668ce993890a79bda886613ee587a69dd5da7a6" + [[projects]] branch = "master" name = "golang.org/x/sys" @@ -339,6 +366,23 @@ ] revision = "a2dc47679d30b6c496245bafc6a166b46c5fe318" +[[projects]] + name = "google.golang.org/appengine" + packages = [ + ".", + "internal", + "internal/app_identity", + "internal/base", + "internal/datastore", + "internal/log", + "internal/modules", + "internal/remote_api", + "internal/urlfetch", + "urlfetch" + ] + revision = "e9657d882bb81064595ca3b56cbe2546bbabf7b1" + version = "v1.4.0" + [[projects]] name = "gopkg.in/inf.v0" packages = ["."] @@ -354,6 +398,7 @@ [[projects]] name = "k8s.io/api" packages = [ + "admission/v1beta1", "admissionregistration/v1alpha1", "admissionregistration/v1beta1", "apps/v1", @@ -430,16 +475,20 @@ "pkg/util/httpstream/spdy", "pkg/util/intstr", "pkg/util/json", + "pkg/util/mergepatch", "pkg/util/net", "pkg/util/remotecommand", "pkg/util/runtime", "pkg/util/sets", + "pkg/util/strategicpatch", + "pkg/util/uuid", "pkg/util/validation", "pkg/util/validation/field", "pkg/util/wait", "pkg/util/yaml", "pkg/version", "pkg/watch", + "third_party/forked/golang/json", "third_party/forked/golang/netutil", "third_party/forked/golang/reflect" ] @@ -449,7 +498,6 @@ [[projects]] name = "k8s.io/client-go" packages = [ - "deprecated-dynamic", "discovery", "discovery/cached", "dynamic", @@ -489,17 +537,22 @@ "pkg/apis/clientauthentication/v1beta1", "pkg/version", "plugin/pkg/client/auth/exec", + "plugin/pkg/client/auth/gcp", "rest", "rest/watch", "restmapper", + "third_party/forked/golang/template", "tools/auth", "tools/cache", "tools/clientcmd", "tools/clientcmd/api", "tools/clientcmd/api/latest", "tools/clientcmd/api/v1", + "tools/leaderelection", + "tools/leaderelection/resourcelock", "tools/metrics", "tools/pager", + "tools/record", "tools/reference", "tools/remotecommand", "transport", @@ -511,6 +564,7 @@ "util/flowcontrol", "util/homedir", "util/integer", + "util/jsonpath", "util/retry", "util/workqueue" ] @@ -570,6 +624,7 @@ "pkg/common", "pkg/generators", "pkg/generators/rules", + "pkg/util/proto", "pkg/util/sets" ] revision = "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803" @@ -577,8 +632,31 @@ [[projects]] name = "sigs.k8s.io/controller-runtime" packages = [ + "pkg/cache", + "pkg/cache/internal", "pkg/client", - "pkg/client/apiutil" + "pkg/client/apiutil", + "pkg/client/config", + "pkg/controller", + "pkg/event", + "pkg/handler", + "pkg/internal/controller", + "pkg/internal/recorder", + "pkg/leaderelection", + "pkg/manager", + "pkg/patch", + "pkg/predicate", + "pkg/reconcile", + "pkg/recorder", + "pkg/runtime/inject", + "pkg/runtime/log", + "pkg/runtime/scheme", + "pkg/runtime/signals", + "pkg/source", + "pkg/source/internal", + "pkg/webhook/admission", + "pkg/webhook/admission/types", + "pkg/webhook/types" ] revision = "5fd1e9e9fac5261e9ad9d47c375afc014fc31d21" version = "v0.1.7" @@ -586,6 +664,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "12aca03f171c40d52a40edfd9728a445cc8c181c366a54e1fe704886ee4c0a35" + inputs-digest = "c7b30a2a5498579134ae0dbffb14cbf2d9858475a78919e87cafb705dd197ff0" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 4e95475ad..73fb7f7e2 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -34,7 +34,4 @@ required = [ [[constraint]] name = "github.com/operator-framework/operator-sdk" - # The version rule is used for a specific release and the master branch for in between releases. - #revision = "1a3f18b6b1006076ad29386083c576ca4ac59686" - branch = "v0.0.7" - # version = "=v0.0.5" + version = "v0.1.0" diff --git a/Makefile b/Makefile index 26884ab45..3d6ff076c 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ export APP_NAME=elasticsearch-operator APP_REPO=github.com/openshift/$(APP_NAME) TARGET=$(TARGET_DIR)/bin/$(APP_NAME) export IMAGE_TAG=openshift/$(APP_NAME):latest -MAIN_PKG=cmd/$(APP_NAME)/main.go +MAIN_PKG=cmd/manager/main.go RUN_LOG?=elasticsearch-operator.log RUN_PID?=elasticsearch-operator.pid @@ -92,7 +92,7 @@ go-run: deploy deploy-example RULES_FILE_PATH=files/prometheus_rules.yml \ OPERATOR_NAME=elasticsearch-operator WATCH_NAMESPACE=openshift-logging \ KUBERNETES_CONFIG=/etc/origin/master/admin.kubeconfig \ - go run cmd/elasticsearch-operator/main.go > $(RUN_LOG) 2>&1 & echo $$! > $(RUN_PID) + go run cmd/manager/main.go > $(RUN_LOG) 2>&1 & echo $$! > $(RUN_PID) undeploy: hack/undeploy.sh diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 000000000..b125f1c7b --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.6 + +USER nobody + +ADD build/_output/bin/elasticsearch-operator /usr/local/bin/elasticsearch-operator diff --git a/cmd/elasticsearch-operator/main.go b/cmd/elasticsearch-operator/main.go deleted file mode 100644 index 233f15818..000000000 --- a/cmd/elasticsearch-operator/main.go +++ /dev/null @@ -1,128 +0,0 @@ -package main - -import ( - "bytes" - "context" - "flag" - "fmt" - "os" - "runtime" - "strings" - "time" - - stub "github.com/openshift/elasticsearch-operator/pkg/stub" - "github.com/openshift/elasticsearch-operator/pkg/utils" - sdk "github.com/operator-framework/operator-sdk/pkg/sdk" - k8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - sdkVersion "github.com/operator-framework/operator-sdk/version" - - "github.com/sirupsen/logrus" -) - -const ( - // supported log formats - logFormatLogfmt = "logfmt" - logFormatJSON = "json" - - // env vars - logLevelEnv = "LOG_LEVEL" - logFormatEnv = "LOG_FORMAT" -) - -var ( - logLevel string - logFormat string - availableLogLevels string - availableLogFormats = []string{ - logFormatLogfmt, - logFormatJSON, - } - // this is a constant, but can't be in the `const` section because - // the value is a runtime function return value - defaultLogLevel = logrus.InfoLevel.String() -) - -func printVersion() { - logrus.Infof("Go Version: %s", runtime.Version()) - logrus.Infof("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH) - logrus.Infof("operator-sdk Version: %v", sdkVersion.Version) -} - -func init() { - // create availableLogLevels - buf := &bytes.Buffer{} - comma := "" - for _, logrusLevel := range logrus.AllLevels { - buf.WriteString(comma) - buf.WriteString(logrusLevel.String()) - comma = ", " - } - availableLogLevels = buf.String() - // default values are "" - // that means that if no arguments are provided env variables take precedence - // otherwise command-line arguments take precendence - flagset := flag.CommandLine - flagset.StringVar(&logLevel, "log-level", "", fmt.Sprintf("Log level to use. Possible values: %s", availableLogLevels)) - flagset.StringVar(&logFormat, "log-format", "", fmt.Sprintf("Log format to use. Possible values: %s", strings.Join(availableLogFormats, ", "))) - flagset.Parse(os.Args[1:]) -} - -func initLogger() error { - // first check cmd arguments, then environment variables - if logLevel == "" { - logLevel = utils.LookupEnvWithDefault(logLevelEnv, defaultLogLevel) - } - if logFormat == "" { - logFormat = utils.LookupEnvWithDefault(logFormatEnv, logFormatLogfmt) - } - - // set log level, default to info level - level, err := logrus.ParseLevel(logLevel) - if err != nil { - return fmt.Errorf("log level '%s' unknown. Possible values: %v", logLevel, availableLogLevels) - } - logrus.SetLevel(level) - - // set log format, default to text formatter - switch logFormat { - case logFormatLogfmt: - logrus.SetFormatter(&logrus.TextFormatter{}) - break - case logFormatJSON: - logrus.SetFormatter(&logrus.JSONFormatter{}) - break - default: - return fmt.Errorf("log format '%s' unknown, %v are possible values", logFormat, availableLogFormats) - } - // log to stdout; logrus defaults to stderr - logrus.SetOutput(os.Stdout) - - return nil -} - -func Main() int { - if err := initLogger(); err != nil { - fmt.Fprintf(os.Stderr, "instantiating elasticsearch controller failed: %v\n", err) - return 1 - } - printVersion() - - sdk.ExposeMetricsPort() - - resource := "logging.openshift.io/v1alpha1" - kind := "Elasticsearch" - namespace, err := k8sutil.GetWatchNamespace() - if err != nil { - logrus.Fatalf("Failed to get watch namespace: %v", err) - } - resyncPeriod := time.Duration(5) * time.Second - logrus.Infof("Watching %s, %s, %s, %d", resource, kind, namespace, resyncPeriod) - sdk.Watch(resource, kind, namespace, resyncPeriod) - sdk.Handle(stub.NewHandler()) - sdk.Run(context.TODO()) - return 0 -} - -func main() { - os.Exit(Main()) -} diff --git a/cmd/manager/main.go b/cmd/manager/main.go new file mode 100644 index 000000000..7273767c3 --- /dev/null +++ b/cmd/manager/main.go @@ -0,0 +1,148 @@ +package main + +import ( + "bytes" + "flag" + "fmt" + "os" + "runtime" + "strings" + + "github.com/openshift/elasticsearch-operator/pkg/apis" + "github.com/openshift/elasticsearch-operator/pkg/controller" + "github.com/openshift/elasticsearch-operator/pkg/utils" + "github.com/operator-framework/operator-sdk/pkg/k8sutil" + sdkVersion "github.com/operator-framework/operator-sdk/version" + "github.com/sirupsen/logrus" + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + "sigs.k8s.io/controller-runtime/pkg/client/config" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/runtime/signals" +) + +const ( + // supported log formats + logFormatLogfmt = "logfmt" + logFormatJSON = "json" + + // env vars + logLevelEnv = "LOG_LEVEL" + logFormatEnv = "LOG_FORMAT" +) + +var ( + logLevel string + logFormat string + availableLogLevels string + availableLogFormats = []string{ + logFormatLogfmt, + logFormatJSON, + } + // this is a constant, but can't be in the `const` section because + // the value is a runtime function return value + defaultLogLevel = logrus.InfoLevel.String() +) + +func printVersion() { + logrus.Printf("Go Version: %s", runtime.Version()) + logrus.Printf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH) + logrus.Printf("operator-sdk Version: %v", sdkVersion.Version) +} + +func init() { + // create availableLogLevels + buf := &bytes.Buffer{} + comma := "" + for _, logrusLevel := range logrus.AllLevels { + buf.WriteString(comma) + buf.WriteString(logrusLevel.String()) + comma = ", " + } + availableLogLevels = buf.String() + // default values are "" + // that means that if no arguments are provided env variables take precedence + // otherwise command-line arguments take precendence + flagset := flag.CommandLine + flagset.StringVar(&logLevel, "log-level", "", fmt.Sprintf("Log level to use. Possible values: %s", availableLogLevels)) + flagset.StringVar(&logFormat, "log-format", "", fmt.Sprintf("Log format to use. Possible values: %s", strings.Join(availableLogFormats, ", "))) + flagset.Parse(os.Args[1:]) +} + +func initLogger() error { + // first check cmd arguments, then environment variables + if logLevel == "" { + logLevel = utils.LookupEnvWithDefault(logLevelEnv, defaultLogLevel) + } + if logFormat == "" { + logFormat = utils.LookupEnvWithDefault(logFormatEnv, logFormatLogfmt) + } + + // set log level, default to info level + level, err := logrus.ParseLevel(logLevel) + if err != nil { + return fmt.Errorf("log level '%s' unknown. Possible values: %v", logLevel, availableLogLevels) + } + logrus.SetLevel(level) + + // set log format, default to text formatter + switch logFormat { + case logFormatLogfmt: + logrus.SetFormatter(&logrus.TextFormatter{}) + break + case logFormatJSON: + logrus.SetFormatter(&logrus.JSONFormatter{}) + break + default: + return fmt.Errorf("log format '%s' unknown, %v are possible values", logFormat, availableLogFormats) + } + // log to stdout; logrus defaults to stderr + logrus.SetOutput(os.Stdout) + + return nil +} + +func main() { + if err := initLogger(); err != nil { + fmt.Fprintf(os.Stderr, "instantiating elasticsearch controller failed: %v\n", err) + return + } + printVersion() + flag.Parse() + + namespace, err := k8sutil.GetWatchNamespace() + if err != nil { + logrus.Fatalf("failed to get watch namespace: %v", err) + } + + // TODO: Expose metrics port after SDK uses controller-runtime's dynamic client + // sdk.ExposeMetricsPort() + + // Get a config to talk to the apiserver + cfg, err := config.GetConfig() + if err != nil { + logrus.Fatal(err) + } + + // Create a new Cmd to provide shared dependencies and start components + mgr, err := manager.New(cfg, manager.Options{Namespace: namespace}) + if err != nil { + logrus.Fatal(err) + } + + logrus.Print("Registering Components.") + + // Setup Scheme for all resources + if err := apis.AddToScheme(mgr.GetScheme()); err != nil { + logrus.Fatal(err) + } + + // Setup all Controllers + if err := controller.AddToManager(mgr); err != nil { + logrus.Fatal(err) + } + + logrus.Print("Starting the Cmd.") + + // Start the Cmd + logrus.Fatal(mgr.Start(signals.SetupSignalHandler())) +} diff --git a/config/config.yaml b/config/config.yaml deleted file mode 100644 index 45845375f..000000000 --- a/config/config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -apiVersion: logging.openshift.io/v1alpha1 -kind: Elasticsearch -projectName: openshift-logging diff --git a/main b/main new file mode 100755 index 000000000..e9c05f75c Binary files /dev/null and b/main differ diff --git a/pkg/apis/addtoscheme_logging_v1alpha1.go b/pkg/apis/addtoscheme_logging_v1alpha1.go new file mode 100644 index 000000000..61e6ddfaa --- /dev/null +++ b/pkg/apis/addtoscheme_logging_v1alpha1.go @@ -0,0 +1,10 @@ +package apis + +import ( + "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) +} diff --git a/pkg/apis/apis.go b/pkg/apis/apis.go new file mode 100644 index 000000000..07dc96164 --- /dev/null +++ b/pkg/apis/apis.go @@ -0,0 +1,13 @@ +package apis + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// AddToSchemes may be used to add all resources defined in the project to a Scheme +var AddToSchemes runtime.SchemeBuilder + +// AddToScheme adds all Resources to the Scheme +func AddToScheme(s *runtime.Scheme) error { + return AddToSchemes.AddToScheme(s) +} diff --git a/pkg/apis/elasticsearch/v1alpha1/doc.go b/pkg/apis/elasticsearch/v1alpha1/doc.go deleted file mode 100644 index 2162c65f7..000000000 --- a/pkg/apis/elasticsearch/v1alpha1/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// +k8s:deepcopy-gen=package -// +groupName=logging.openshift.io -package v1alpha1 diff --git a/pkg/apis/elasticsearch/v1alpha1/register.go b/pkg/apis/elasticsearch/v1alpha1/register.go deleted file mode 100644 index d0e12894c..000000000 --- a/pkg/apis/elasticsearch/v1alpha1/register.go +++ /dev/null @@ -1,35 +0,0 @@ -package v1alpha1 - -import ( - sdkK8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - version = "v1alpha1" - groupName = "logging.openshift.io" -) - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme - // SchemeGroupVersion is the group version used to register these objects. - SchemeGroupVersion = schema.GroupVersion{Group: groupName, Version: version} -) - -func init() { - sdkK8sutil.AddToSDKScheme(AddToScheme) -} - -// addKnownTypes adds the set of types defined in this package to the supplied scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &Elasticsearch{}, - &ElasticsearchList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/pkg/apis/elasticsearch/v1alpha1/types.go b/pkg/apis/elasticsearch/v1alpha1/types.go deleted file mode 100644 index 113e52ba2..000000000 --- a/pkg/apis/elasticsearch/v1alpha1/types.go +++ /dev/null @@ -1,221 +0,0 @@ -package v1alpha1 - -import ( - "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -const ( - ServiceAccountName string = "elasticsearch" - ConfigMapName string = "elasticsearch" - SecretName string = "elasticsearch" -) - -// ElasticsearchList struct represents list of Elasticsearch objects -type ElasticsearchList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - Items []Elasticsearch `json:"items"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Elasticsearch struct represents Elasticsearch cluster CRD -type Elasticsearch struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata"` - Spec ElasticsearchSpec `json:"spec"` - Status ElasticsearchStatus `json:"status,omitempty"` -} - -type ReplicationPolicyType string - -const ( - FullReplication ReplicationPolicyType = "FullReplication" - PartialReplication ReplicationPolicyType = "PartialReplication" - NoReplication ReplicationPolicyType = "NoReplication" -) - -// ElasticsearchSpec struct represents the Spec of Elasticsearch cluster CRD -type ElasticsearchSpec struct { - // managementState indicates whether and how the operator should manage the component - ManagementState ManagementState `json:"managementState"` - ReplicationPolicy ReplicationPolicyType `json:"dataReplication"` - Nodes []ElasticsearchNode `json:"nodes"` - Spec ElasticsearchNodeSpec `json:"nodeSpec"` -} - -// ElasticsearchNode struct represents individual node in Elasticsearch cluster -type ElasticsearchNode struct { - Roles []ElasticsearchNodeRole `json:"roles"` - Replicas int32 `json:"replicas"` - Spec ElasticsearchNodeSpec `json:"nodeSpec"` - NodeSelector map[string]string `json:"nodeSelector,omitempty"` - Storage ElasticsearchNodeStorageSource `json:"storage"` -} - -type ElasticsearchNodeStorageSource struct { - // HostPath option will mount directory from the host. - // Cluster administrator must grant `hostaccess` scc to the service account. - // Cluster admin also must set appropriate SELINUX labels and perissions - // for the directory on the host. - HostPath *v1.HostPathVolumeSource `json:"hostPath,omitempty"` - - // EmptyDir should be only used for testing purposes and not in production. - // This option will use temporary directory for data storage. Data will be lost - // when Pod is regenerated. - EmptyDir *v1.EmptyDirVolumeSource `json:"emptyDir,omitempty"` - - // VolumeClaimTemplate is supposed to act similarly to VolumeClaimTemplates field - // of StatefulSetSpec. Meaning that it'll generate a number of PersistentVolumeClaims - // per individual Elasticsearch cluster node. The actual PVC name used will - // be constructed from VolumeClaimTemplate name, node type and replica number - // for the specific node. - VolumeClaimTemplate *v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"` - - // PersistentVolumeClaim will NOT try to regenerate PVC, it will be used - // as-is. You may want to use it instead of VolumeClaimTemplate in case - // you already have bounded PersistentVolumeClaims you want to use, and the names - // of these PersistentVolumeClaims doesn't follow the naming convention. - PersistentVolumeClaim *v1.PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"` -} - -// ElasticsearchNodeStatus represents the status of individual Elasticsearch node -type ElasticsearchNodeStatus struct { - DeploymentName string `json:"deploymentName,omitempty"` - ReplicaSetName string `json:"replicaSetName,omitempty"` - StatefulSetName string `json:"statefulSetName,omitempty"` - PodName string `json:"podName,omitempty"` - Status string `json:"status,omitempty"` - // UnderUpgrade UpgradeStatus `json:"underUpgrade,omitempty"` - UpgradeStatus ElasticsearchNodeUpgradeStatus `json:"upgradeStatus,omitempty"` - Roles []ElasticsearchNodeRole `json:"roles,omitempty"` -} - -type ElasticsearchNodeUpgradeStatus struct { - UnderUpgrade UpgradeStatus `json:"underUpgrade,omitempty"` - UpgradePhase ElasticsearchUpgradePhase `json:"upgradePhase,omitempty"` -} - -type ElasticsearchUpgradePhase string - -const ( - NodeRestarting ElasticsearchUpgradePhase = "nodeRestarting" - RecoveringData ElasticsearchUpgradePhase = "recoveringData" - ControllerUpdated ElasticsearchUpgradePhase = "controllerUpdated" - // UpgradeInitializing ElasticsearchUpgradePhase = "upgradeInitializing" - // NodeRejoined ElasticsearchUpgradePhase = "nodeRejoined" - // ShardAllocationEnabled ElasticsearchUpgradePhase = "shardAllocationEnabled" -) - -// ElasticsearchNodeSpec represents configuration of an individual Elasticsearch node -type ElasticsearchNodeSpec struct { - Image string `json:"image,omitempty"` - Resources v1.ResourceRequirements `json:"resources"` -} - -type UpgradeStatus string - -const ( - UnderUpgradeTrue UpgradeStatus = "True" - UnderUpgradeFalse UpgradeStatus = "False" -) - -type ElasticsearchRequiredAction string - -const ( - ElasticsearchActionRollingRestartNeeded ElasticsearchRequiredAction = "RollingRestartNeeded" - ElasticsearchActionFullRestartNeeded ElasticsearchRequiredAction = "FullRestartNeeded" - ElasticsearchActionInterventionNeeded ElasticsearchRequiredAction = "InterventionNeeded" - ElasticsearchActionNewClusterNeeded ElasticsearchRequiredAction = "NewClusterNeeded" - ElasticsearchActionNone ElasticsearchRequiredAction = "ClusterOK" - ElasticsearchActionScaleDownNeeded ElasticsearchRequiredAction = "ScaleDownNeeded" -) - -type ElasticsearchNodeRole string - -const ( - ElasticsearchRoleClient ElasticsearchNodeRole = "client" - ElasticsearchRoleData ElasticsearchNodeRole = "data" - ElasticsearchRoleMaster ElasticsearchNodeRole = "master" -) - -type ShardAllocationState string - -const ( - ShardAllocationTrue ShardAllocationState = "True" - ShardAllocationFalse ShardAllocationState = "False" -) - -// ElasticsearchStatus represents the status of Elasticsearch cluster -type ElasticsearchStatus struct { - Nodes []ElasticsearchNodeStatus `json:"nodes"` - ClusterHealth string `json:"clusterHealth"` - ShardAllocationEnabled ShardAllocationState `json:"shardAllocationEnabled"` - Pods map[ElasticsearchNodeRole]PodStateMap `json:"pods"` - Conditions []ClusterCondition `json:"conditions"` -} - -type PodStateMap map[PodStateType][]string - -type PodStateType string - -const ( - PodStateTypeReady PodStateType = "ready" - PodStateTypeNotReady PodStateType = "notReady" - PodStateTypeFailed PodStateType = "failed" -) - -type ManagementState string - -const ( - // Managed means that the operator is actively managing its resources and trying to keep the component active. - // It will only upgrade the component if it is safe to do so - ManagementStateManaged ManagementState = "Managed" - // Unmanaged means that the operator will not take any action related to the component - ManagementStateUnmanaged ManagementState = "Unmanaged" -) - -// ClusterCondition contains details for the current condition of this elasticsearch cluster. -type ClusterCondition struct { - // Type is the type of the condition. - Type ClusterConditionType `json:"type"` - // Status is the status of the condition. - Status ConditionStatus `json:"status"` - // Last time the condition transitioned from one status to another. - LastTransitionTime metav1.Time `json:"lastTransitionTime"` - // Unique, one-word, CamelCase reason for the condition's last transition. - Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` - // Human-readable message indicating details about last transition. - Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` -} - -// ClusterConditionType is a valid value for ClusterCondition.Type -type ClusterConditionType string - -// These are valid conditions for elasticsearch node -const ( - UpdatingSettings ClusterConditionType = "UpdatingSettings" - ScalingUp ClusterConditionType = "ScalingUp" - ScalingDown ClusterConditionType = "ScalingDown" - Restarting ClusterConditionType = "Restarting" -) - -type ConditionStatus string - -const ( - ConditionTrue ConditionStatus = "True" - ConditionFalse ConditionStatus = "False" - ConditionUnknown ConditionStatus = "Unknown" -) - -type ClusterEvent string - -const ( - ScaledDown ClusterEvent = "ScaledDown" - ScaledUp ClusterEvent = "ScaledUp" - UpdateClusterSettings ClusterEvent = "UpdateClusterSettings" - NoEvent ClusterEvent = "NoEvent" -) diff --git a/pkg/apis/elasticsearch/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/elasticsearch/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index b6e9413e8..000000000 --- a/pkg/apis/elasticsearch/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,301 +0,0 @@ -// +build !ignore_autogenerated - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCondition. -func (in *ClusterCondition) DeepCopy() *ClusterCondition { - if in == nil { - return nil - } - out := new(ClusterCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Elasticsearch) DeepCopyInto(out *Elasticsearch) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Elasticsearch. -func (in *Elasticsearch) DeepCopy() *Elasticsearch { - if in == nil { - return nil - } - out := new(Elasticsearch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Elasticsearch) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ElasticsearchList) DeepCopyInto(out *ElasticsearchList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Elasticsearch, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchList. -func (in *ElasticsearchList) DeepCopy() *ElasticsearchList { - if in == nil { - return nil - } - out := new(ElasticsearchList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ElasticsearchList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ElasticsearchNode) DeepCopyInto(out *ElasticsearchNode) { - *out = *in - if in.Roles != nil { - in, out := &in.Roles, &out.Roles - *out = make([]ElasticsearchNodeRole, len(*in)) - copy(*out, *in) - } - in.Spec.DeepCopyInto(&out.Spec) - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.Storage.DeepCopyInto(&out.Storage) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchNode. -func (in *ElasticsearchNode) DeepCopy() *ElasticsearchNode { - if in == nil { - return nil - } - out := new(ElasticsearchNode) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ElasticsearchNodeSpec) DeepCopyInto(out *ElasticsearchNodeSpec) { - *out = *in - in.Resources.DeepCopyInto(&out.Resources) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchNodeSpec. -func (in *ElasticsearchNodeSpec) DeepCopy() *ElasticsearchNodeSpec { - if in == nil { - return nil - } - out := new(ElasticsearchNodeSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ElasticsearchNodeStatus) DeepCopyInto(out *ElasticsearchNodeStatus) { - *out = *in - if in.Roles != nil { - in, out := &in.Roles, &out.Roles - *out = make([]ElasticsearchNodeRole, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchNodeStatus. -func (in *ElasticsearchNodeStatus) DeepCopy() *ElasticsearchNodeStatus { - if in == nil { - return nil - } - out := new(ElasticsearchNodeStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ElasticsearchNodeStorageSource) DeepCopyInto(out *ElasticsearchNodeStorageSource) { - *out = *in - if in.HostPath != nil { - in, out := &in.HostPath, &out.HostPath - *out = new(v1.HostPathVolumeSource) - (*in).DeepCopyInto(*out) - } - if in.EmptyDir != nil { - in, out := &in.EmptyDir, &out.EmptyDir - *out = new(v1.EmptyDirVolumeSource) - (*in).DeepCopyInto(*out) - } - if in.VolumeClaimTemplate != nil { - in, out := &in.VolumeClaimTemplate, &out.VolumeClaimTemplate - *out = new(v1.PersistentVolumeClaim) - (*in).DeepCopyInto(*out) - } - if in.PersistentVolumeClaim != nil { - in, out := &in.PersistentVolumeClaim, &out.PersistentVolumeClaim - *out = new(v1.PersistentVolumeClaimVolumeSource) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchNodeStorageSource. -func (in *ElasticsearchNodeStorageSource) DeepCopy() *ElasticsearchNodeStorageSource { - if in == nil { - return nil - } - out := new(ElasticsearchNodeStorageSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ElasticsearchSpec) DeepCopyInto(out *ElasticsearchSpec) { - *out = *in - if in.Nodes != nil { - in, out := &in.Nodes, &out.Nodes - *out = make([]ElasticsearchNode, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchSpec. -func (in *ElasticsearchSpec) DeepCopy() *ElasticsearchSpec { - if in == nil { - return nil - } - out := new(ElasticsearchSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ElasticsearchStatus) DeepCopyInto(out *ElasticsearchStatus) { - *out = *in - if in.Nodes != nil { - in, out := &in.Nodes, &out.Nodes - *out = make([]ElasticsearchNodeStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Pods != nil { - in, out := &in.Pods, &out.Pods - *out = make(map[ElasticsearchNodeRole]PodStateMap, len(*in)) - for key, val := range *in { - var outVal map[PodStateType][]string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = make(PodStateMap, len(*in)) - for key, val := range *in { - var outVal []string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = make([]string, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } - (*out)[key] = outVal - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]ClusterCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchStatus. -func (in *ElasticsearchStatus) DeepCopy() *ElasticsearchStatus { - if in == nil { - return nil - } - out := new(ElasticsearchStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in PodStateMap) DeepCopyInto(out *PodStateMap) { - { - in := &in - *out = make(PodStateMap, len(*in)) - for key, val := range *in { - var outVal []string - if val == nil { - (*out)[key] = nil - } else { - in, out := &val, &outVal - *out = make([]string, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - return - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodStateMap. -func (in PodStateMap) DeepCopy() PodStateMap { - if in == nil { - return nil - } - out := new(PodStateMap) - in.DeepCopyInto(out) - return *out -} diff --git a/pkg/apis/logging/v1alpha1/doc.go b/pkg/apis/logging/v1alpha1/doc.go new file mode 100644 index 000000000..86ed15458 --- /dev/null +++ b/pkg/apis/logging/v1alpha1/doc.go @@ -0,0 +1,4 @@ +// Package v1alpha1 contains API Schema definitions for the logging v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +groupName=logging.openshift.io +package v1alpha1 diff --git a/pkg/apis/logging/v1alpha1/elasticsearch_types.go b/pkg/apis/logging/v1alpha1/elasticsearch_types.go new file mode 100644 index 000000000..525c361e2 --- /dev/null +++ b/pkg/apis/logging/v1alpha1/elasticsearch_types.go @@ -0,0 +1,223 @@ +package v1alpha1 + +import ( + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + ServiceAccountName string = "elasticsearch" + ConfigMapName string = "elasticsearch" + SecretName string = "elasticsearch" +) + +type ReplicationPolicyType string + +const ( + FullReplication ReplicationPolicyType = "FullReplication" + PartialReplication ReplicationPolicyType = "PartialReplication" + NoReplication ReplicationPolicyType = "NoReplication" +) + +// ElasticsearchSpec defines the desired state of Elasticsearch +type ElasticsearchSpec struct { + // managementState indicates whether and how the operator should manage the component + ManagementState ManagementState `json:"managementState"` + ReplicationPolicy ReplicationPolicyType `json:"dataReplication"` + Nodes []ElasticsearchNode `json:"nodes"` + Spec ElasticsearchNodeSpec `json:"nodeSpec"` +} + +// ElasticsearchNode struct represents individual node in Elasticsearch cluster +type ElasticsearchNode struct { + Roles []ElasticsearchNodeRole `json:"roles"` + Replicas int32 `json:"replicas"` + Spec ElasticsearchNodeSpec `json:"nodeSpec"` + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + Storage ElasticsearchNodeStorageSource `json:"storage"` +} + +type ElasticsearchNodeStorageSource struct { + // HostPath option will mount directory from the host. + // Cluster administrator must grant `hostaccess` scc to the service account. + // Cluster admin also must set appropriate SELINUX labels and perissions + // for the directory on the host. + HostPath *v1.HostPathVolumeSource `json:"hostPath,omitempty"` + + // EmptyDir should be only used for testing purposes and not in production. + // This option will use temporary directory for data storage. Data will be lost + // when Pod is regenerated. + EmptyDir *v1.EmptyDirVolumeSource `json:"emptyDir,omitempty"` + + // VolumeClaimTemplate is supposed to act similarly to VolumeClaimTemplates field + // of StatefulSetSpec. Meaning that it'll generate a number of PersistentVolumeClaims + // per individual Elasticsearch cluster node. The actual PVC name used will + // be constructed from VolumeClaimTemplate name, node type and replica number + // for the specific node. + VolumeClaimTemplate *v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"` + + // PersistentVolumeClaim will NOT try to regenerate PVC, it will be used + // as-is. You may want to use it instead of VolumeClaimTemplate in case + // you already have bounded PersistentVolumeClaims you want to use, and the names + // of these PersistentVolumeClaims doesn't follow the naming convention. + PersistentVolumeClaim *v1.PersistentVolumeClaimVolumeSource `json:"persistentVolumeClaim,omitempty"` +} + +// ElasticsearchStatus defines the observed state of Elasticsearch +type ElasticsearchNodeStatus struct { + DeploymentName string `json:"deploymentName,omitempty"` + ReplicaSetName string `json:"replicaSetName,omitempty"` + StatefulSetName string `json:"statefulSetName,omitempty"` + PodName string `json:"podName,omitempty"` + Status string `json:"status,omitempty"` + // UnderUpgrade UpgradeStatus `json:"underUpgrade,omitempty"` + UpgradeStatus ElasticsearchNodeUpgradeStatus `json:"upgradeStatus,omitempty"` + Roles []ElasticsearchNodeRole `json:"roles,omitempty"` +} + +type ElasticsearchNodeUpgradeStatus struct { + UnderUpgrade UpgradeStatus `json:"underUpgrade,omitempty"` + UpgradePhase ElasticsearchUpgradePhase `json:"upgradePhase,omitempty"` +} + +type ElasticsearchUpgradePhase string + +const ( + NodeRestarting ElasticsearchUpgradePhase = "nodeRestarting" + RecoveringData ElasticsearchUpgradePhase = "recoveringData" + ControllerUpdated ElasticsearchUpgradePhase = "controllerUpdated" + // UpgradeInitializing ElasticsearchUpgradePhase = "upgradeInitializing" + // NodeRejoined ElasticsearchUpgradePhase = "nodeRejoined" + // ShardAllocationEnabled ElasticsearchUpgradePhase = "shardAllocationEnabled" +) + +// ElasticsearchNodeSpec represents configuration of an individual Elasticsearch node +type ElasticsearchNodeSpec struct { + Image string `json:"image,omitempty"` + Resources v1.ResourceRequirements `json:"resources"` +} + +type UpgradeStatus string + +const ( + UnderUpgradeTrue UpgradeStatus = "True" + UnderUpgradeFalse UpgradeStatus = "False" +) + +type ElasticsearchRequiredAction string + +const ( + ElasticsearchActionRollingRestartNeeded ElasticsearchRequiredAction = "RollingRestartNeeded" + ElasticsearchActionFullRestartNeeded ElasticsearchRequiredAction = "FullRestartNeeded" + ElasticsearchActionInterventionNeeded ElasticsearchRequiredAction = "InterventionNeeded" + ElasticsearchActionNewClusterNeeded ElasticsearchRequiredAction = "NewClusterNeeded" + ElasticsearchActionNone ElasticsearchRequiredAction = "ClusterOK" + ElasticsearchActionScaleDownNeeded ElasticsearchRequiredAction = "ScaleDownNeeded" +) + +type ElasticsearchNodeRole string + +const ( + ElasticsearchRoleClient ElasticsearchNodeRole = "client" + ElasticsearchRoleData ElasticsearchNodeRole = "data" + ElasticsearchRoleMaster ElasticsearchNodeRole = "master" +) + +type ShardAllocationState string + +const ( + ShardAllocationTrue ShardAllocationState = "True" + ShardAllocationFalse ShardAllocationState = "False" +) + +// ElasticsearchStatus represents the status of Elasticsearch cluster +type ElasticsearchStatus struct { + Nodes []ElasticsearchNodeStatus `json:"nodes"` + ClusterHealth string `json:"clusterHealth"` + ShardAllocationEnabled ShardAllocationState `json:"shardAllocationEnabled"` + Pods map[ElasticsearchNodeRole]PodStateMap `json:"pods"` + Conditions []ClusterCondition `json:"conditions"` +} + +type PodStateMap map[PodStateType][]string + +type PodStateType string + +const ( + PodStateTypeReady PodStateType = "ready" + PodStateTypeNotReady PodStateType = "notReady" + PodStateTypeFailed PodStateType = "failed" +) + +type ManagementState string + +const ( + // ManagementStateManaged means that the operator is actively managing its resources and trying to keep the component active. + // It will only upgrade the component if it is safe to do so + ManagementStateManaged ManagementState = "Managed" + // ManagementStateUnmanaged means that the operator will not take any action related to the component + ManagementStateUnmanaged ManagementState = "Unmanaged" +) + +// ClusterCondition contains details for the current condition of this elasticsearch cluster. +type ClusterCondition struct { + // Type is the type of the condition. + Type ClusterConditionType `json:"type"` + // Status is the status of the condition. + Status ConditionStatus `json:"status"` + // Last time the condition transitioned from one status to another. + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + // Unique, one-word, CamelCase reason for the condition's last transition. + Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"` + // Human-readable message indicating details about last transition. + Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` +} + +// ClusterConditionType is a valid value for ClusterCondition.Type +type ClusterConditionType string + +// These are valid conditions for elasticsearch node +const ( + UpdatingSettings ClusterConditionType = "UpdatingSettings" + ScalingUp ClusterConditionType = "ScalingUp" + ScalingDown ClusterConditionType = "ScalingDown" + Restarting ClusterConditionType = "Restarting" +) + +type ConditionStatus string + +const ( + ConditionTrue ConditionStatus = "True" + ConditionFalse ConditionStatus = "False" + ConditionUnknown ConditionStatus = "Unknown" +) + +type ClusterEvent string + +const ( + ScaledDown ClusterEvent = "ScaledDown" + ScaledUp ClusterEvent = "ScaledUp" + UpdateClusterSettings ClusterEvent = "UpdateClusterSettings" + NoEvent ClusterEvent = "NoEvent" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Elasticsearch is the Schema for the elasticsearches API +// +k8s:openapi-gen=true +type Elasticsearch struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec ElasticsearchSpec `json:"spec"` + Status ElasticsearchStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ElasticsearchList contains a list of Elasticsearch +type ElasticsearchList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []Elasticsearch `json:"items"` +} diff --git a/pkg/apis/logging/v1alpha1/register.go b/pkg/apis/logging/v1alpha1/register.go new file mode 100644 index 000000000..4c10bc03d --- /dev/null +++ b/pkg/apis/logging/v1alpha1/register.go @@ -0,0 +1,49 @@ +// NOTE: Boilerplate only. Ignore this file. + +// Package v1alpha1 contains API Schema definitions for the logging v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +groupName=logging.openshift.io +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "logging.openshift.io", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + // SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Elasticsearch{}, + &ElasticsearchList{}, + ) + scheme.AddKnownTypes(monitoring.SchemeGroupVersion, + &monitoring.PrometheusRule{}, + &monitoring.PrometheusRuleList{}, + &monitoring.ServiceMonitor{}, + &monitoring.ServiceMonitorList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/logging/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/logging/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..c45ec82a5 --- /dev/null +++ b/pkg/apis/logging/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,334 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCondition. +func (in *ClusterCondition) DeepCopy() *ClusterCondition { + if in == nil { + return nil + } + out := new(ClusterCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Elasticsearch) DeepCopyInto(out *Elasticsearch) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Elasticsearch. +func (in *Elasticsearch) DeepCopy() *Elasticsearch { + if in == nil { + return nil + } + out := new(Elasticsearch) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Elasticsearch) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ElasticsearchList) DeepCopyInto(out *ElasticsearchList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Elasticsearch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchList. +func (in *ElasticsearchList) DeepCopy() *ElasticsearchList { + if in == nil { + return nil + } + out := new(ElasticsearchList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ElasticsearchList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ElasticsearchNode) DeepCopyInto(out *ElasticsearchNode) { + *out = *in + if in.Roles != nil { + in, out := &in.Roles, &out.Roles + *out = make([]ElasticsearchNodeRole, len(*in)) + copy(*out, *in) + } + in.Spec.DeepCopyInto(&out.Spec) + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + in.Storage.DeepCopyInto(&out.Storage) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchNode. +func (in *ElasticsearchNode) DeepCopy() *ElasticsearchNode { + if in == nil { + return nil + } + out := new(ElasticsearchNode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ElasticsearchNodeSpec) DeepCopyInto(out *ElasticsearchNodeSpec) { + *out = *in + in.Resources.DeepCopyInto(&out.Resources) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchNodeSpec. +func (in *ElasticsearchNodeSpec) DeepCopy() *ElasticsearchNodeSpec { + if in == nil { + return nil + } + out := new(ElasticsearchNodeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ElasticsearchNodeStatus) DeepCopyInto(out *ElasticsearchNodeStatus) { + *out = *in + out.UpgradeStatus = in.UpgradeStatus + if in.Roles != nil { + in, out := &in.Roles, &out.Roles + *out = make([]ElasticsearchNodeRole, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchNodeStatus. +func (in *ElasticsearchNodeStatus) DeepCopy() *ElasticsearchNodeStatus { + if in == nil { + return nil + } + out := new(ElasticsearchNodeStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ElasticsearchNodeStorageSource) DeepCopyInto(out *ElasticsearchNodeStorageSource) { + *out = *in + if in.HostPath != nil { + in, out := &in.HostPath, &out.HostPath + *out = new(v1.HostPathVolumeSource) + (*in).DeepCopyInto(*out) + } + if in.EmptyDir != nil { + in, out := &in.EmptyDir, &out.EmptyDir + *out = new(v1.EmptyDirVolumeSource) + (*in).DeepCopyInto(*out) + } + if in.VolumeClaimTemplate != nil { + in, out := &in.VolumeClaimTemplate, &out.VolumeClaimTemplate + *out = new(v1.PersistentVolumeClaim) + (*in).DeepCopyInto(*out) + } + if in.PersistentVolumeClaim != nil { + in, out := &in.PersistentVolumeClaim, &out.PersistentVolumeClaim + *out = new(v1.PersistentVolumeClaimVolumeSource) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchNodeStorageSource. +func (in *ElasticsearchNodeStorageSource) DeepCopy() *ElasticsearchNodeStorageSource { + if in == nil { + return nil + } + out := new(ElasticsearchNodeStorageSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ElasticsearchNodeUpgradeStatus) DeepCopyInto(out *ElasticsearchNodeUpgradeStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchNodeUpgradeStatus. +func (in *ElasticsearchNodeUpgradeStatus) DeepCopy() *ElasticsearchNodeUpgradeStatus { + if in == nil { + return nil + } + out := new(ElasticsearchNodeUpgradeStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ElasticsearchSpec) DeepCopyInto(out *ElasticsearchSpec) { + *out = *in + if in.Nodes != nil { + in, out := &in.Nodes, &out.Nodes + *out = make([]ElasticsearchNode, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchSpec. +func (in *ElasticsearchSpec) DeepCopy() *ElasticsearchSpec { + if in == nil { + return nil + } + out := new(ElasticsearchSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ElasticsearchStatus) DeepCopyInto(out *ElasticsearchStatus) { + *out = *in + if in.Nodes != nil { + in, out := &in.Nodes, &out.Nodes + *out = make([]ElasticsearchNodeStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Pods != nil { + in, out := &in.Pods, &out.Pods + *out = make(map[ElasticsearchNodeRole]PodStateMap, len(*in)) + for key, val := range *in { + var outVal map[PodStateType][]string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make(PodStateMap, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } + (*out)[key] = outVal + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]ClusterCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ElasticsearchStatus. +func (in *ElasticsearchStatus) DeepCopy() *ElasticsearchStatus { + if in == nil { + return nil + } + out := new(ElasticsearchStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in PodStateMap) DeepCopyInto(out *PodStateMap) { + { + in := &in + *out = make(PodStateMap, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodStateMap. +func (in PodStateMap) DeepCopy() PodStateMap { + if in == nil { + return nil + } + out := new(PodStateMap) + in.DeepCopyInto(out) + return *out +} diff --git a/pkg/controller/add_elasticsearch.go b/pkg/controller/add_elasticsearch.go new file mode 100644 index 000000000..4842ea7e2 --- /dev/null +++ b/pkg/controller/add_elasticsearch.go @@ -0,0 +1,10 @@ +package controller + +import ( + "github.com/openshift/elasticsearch-operator/pkg/controller/elasticsearch" +) + +func init() { + // AddToManagerFuncs is a list of functions to create controllers and add them to a manager. + AddToManagerFuncs = append(AddToManagerFuncs, elasticsearch.Add) +} diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go new file mode 100644 index 000000000..7c069f3ee --- /dev/null +++ b/pkg/controller/controller.go @@ -0,0 +1,18 @@ +package controller + +import ( + "sigs.k8s.io/controller-runtime/pkg/manager" +) + +// AddToManagerFuncs is a list of functions to add all Controllers to the Manager +var AddToManagerFuncs []func(manager.Manager) error + +// AddToManager adds all Controllers to the Manager +func AddToManager(m manager.Manager) error { + for _, f := range AddToManagerFuncs { + if err := f(m); err != nil { + return err + } + } + return nil +} diff --git a/pkg/controller/elasticsearch/elasticsearch_controller.go b/pkg/controller/elasticsearch/elasticsearch_controller.go new file mode 100644 index 000000000..a20d22372 --- /dev/null +++ b/pkg/controller/elasticsearch/elasticsearch_controller.go @@ -0,0 +1,128 @@ +package elasticsearch + +import ( + "context" + "fmt" + "log" + "time" + + loggingv1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" + "github.com/openshift/elasticsearch-operator/pkg/k8shandler" + "github.com/sirupsen/logrus" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" +) + +/** +* USER ACTION REQUIRED: This is a scaffold file intended for the user to modify with their own Controller +* business logic. Delete these comments after modifying this file.* + */ + +// Add creates a new Elasticsearch Controller and adds it to the Manager. The Manager will set fields on the Controller +// and Start it when the Manager is Started. +func Add(mgr manager.Manager) error { + return add(mgr, newReconciler(mgr)) +} + +// newReconciler returns a new reconcile.Reconciler +func newReconciler(mgr manager.Manager) reconcile.Reconciler { + return &ReconcileElasticsearch{client: mgr.GetClient(), scheme: mgr.GetScheme()} +} + +// add adds a new Controller to mgr with r as the reconcile.Reconciler +func add(mgr manager.Manager, r reconcile.Reconciler) error { + // Create a new controller + c, err := controller.New("elasticsearch-controller", mgr, controller.Options{Reconciler: r}) + if err != nil { + return err + } + + // Watch for changes to primary resource Elasticsearch + err = c.Watch(&source.Kind{Type: &loggingv1alpha1.Elasticsearch{}}, &handler.EnqueueRequestForObject{}) + if err != nil { + return err + } + + return nil +} + +var _ reconcile.Reconciler = &ReconcileElasticsearch{} + +// ReconcileElasticsearch reconciles a Elasticsearch object +type ReconcileElasticsearch struct { + // This client, initialized using mgr.Client() above, is a split client + // that reads objects from the cache and writes to the apiserver + client client.Client + scheme *runtime.Scheme +} + +// Reconcile reads that state of the cluster for a Elasticsearch object and makes changes based on the state read +// and what is in the Elasticsearch.Spec +func (r *ReconcileElasticsearch) Reconcile(request reconcile.Request) (reconcile.Result, error) { + log.Printf("Reconciling Elasticsearch %s/%s\n", request.Namespace, request.Name) + + // Fetch the Elasticsearch instance + instance := &loggingv1alpha1.Elasticsearch{} + err := r.client.Get(context.TODO(), request.NamespacedName, instance) + if err != nil { + if errors.IsNotFound(err) { + // Request object not found, could have been deleted after reconcile request. + // Owned objects are automatically garbage collected. For additional cleanup logic use finalizers. + // Return and don't requeue + return reconcile.Result{}, nil + } + // Error reading the object - requeue the request. + return reconcile.Result{}, err + } + err = r.reconsileElasticsearch(instance) + return reconcile.Result{RequeueAfter: 5 * time.Second}, err +} + +// reconsileElasticsearch reconciles the cluster's state to the spec specified +func (r *ReconcileElasticsearch) reconsileElasticsearch(es *loggingv1alpha1.Elasticsearch) (err error) { + // Ensure existence of services + logrus.Debugf("Begin Reconcile of Elasticsearch cluster %v", es.ClusterName) + err = k8shandler.CreateOrUpdateServices(r.client, es) + if err != nil { + return fmt.Errorf("Failed to reconcile Services for Elasticsearch cluster: %v", err) + } + + // Ensure existence of servicesaccount + serviceAccountName, err := k8shandler.CreateOrUpdateServiceAccount(r.client, es) + if err != nil { + return fmt.Errorf("Failed to reconcile ServiceAccount for Elasticsearch cluster: %v", err) + } + + // Ensure existence of config maps + configMapName, err := k8shandler.CreateOrUpdateConfigMaps(r.client, es) + if err != nil { + return fmt.Errorf("Failed to reconcile ConfigMaps for Elasticsearch cluster: %v", err) + } + + // Ensure existence of prometheus rules + if err = k8shandler.CreateOrUpdatePrometheusRules(r.client, es); err != nil { + return fmt.Errorf("Failed to reconcile PrometheusRules for Elasticsearch cluster: %v", err) + } + + // Ensure existence of service monitors + if err = k8shandler.CreateOrUpdateServiceMonitors(r.client, es); err != nil { + return fmt.Errorf("Failed to reconcile Service Monitors for Elasticsearch cluster: %v", err) + } + + // TODO: Ensure existence of storage? + + // Ensure Elasticsearch cluster itself is up to spec + err = k8shandler.CreateOrUpdateElasticsearchCluster(r.client, es, configMapName, serviceAccountName) + if err != nil { + return fmt.Errorf("Failed to reconcile Elasticsearch deployment spec: %v", err) + } + + logrus.Debugf("End Reconcile of Elasticsearch cluster %v", es.ClusterName) + return nil +} diff --git a/pkg/k8shandler/cluster.go b/pkg/k8shandler/cluster.go index 55b993b63..7e16e28ff 100644 --- a/pkg/k8shandler/cluster.go +++ b/pkg/k8shandler/cluster.go @@ -1,17 +1,19 @@ package k8shandler import ( + "context" "fmt" apps "k8s.io/api/apps/v1" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" "k8s.io/client-go/util/retry" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" + "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "github.com/openshift/elasticsearch-operator/pkg/utils" - "github.com/operator-framework/operator-sdk/pkg/sdk" "github.com/sirupsen/logrus" ) @@ -27,9 +29,9 @@ type ClusterState struct { var wrongConfig bool // CreateOrUpdateElasticsearchCluster creates an Elasticsearch deployment -func CreateOrUpdateElasticsearchCluster(dpl *v1alpha1.Elasticsearch, configMapName, serviceAccountName string) error { +func CreateOrUpdateElasticsearchCluster(client client.Client, dpl *v1alpha1.Elasticsearch, configMapName, serviceAccountName string) error { - cState, err := NewClusterState(dpl, configMapName, serviceAccountName) + cState, err := NewClusterState(client, dpl, configMapName, serviceAccountName) if err != nil { return err } @@ -47,14 +49,14 @@ func CreateOrUpdateElasticsearchCluster(dpl *v1alpha1.Elasticsearch, configMapNa } wrongConfig = false - action, err := cState.getRequiredAction(dpl) + action, err := cState.getRequiredAction(client, dpl) if err != nil { return err } switch { case action == v1alpha1.ElasticsearchActionNewClusterNeeded: - err = cState.buildNewCluster(dpl, asOwner(dpl)) + err = cState.buildNewCluster(client, dpl, asOwner(dpl)) if err != nil { return err } @@ -66,7 +68,7 @@ func CreateOrUpdateElasticsearchCluster(dpl *v1alpha1.Elasticsearch, configMapNa // return err // } case action == v1alpha1.ElasticsearchActionRollingRestartNeeded: - if err = cState.restartCluster(dpl, asOwner(dpl)); err != nil { + if err = cState.restartCluster(client, dpl, asOwner(dpl)); err != nil { return err } case action == v1alpha1.ElasticsearchActionNone: @@ -78,11 +80,11 @@ func CreateOrUpdateElasticsearchCluster(dpl *v1alpha1.Elasticsearch, configMapNa // Determine if a change to cluster size was made, // if yes, update variables in config map and also // reload live configuration - if err = updateClusterSettings(dpl); err != nil { + if err = updateClusterSettings(client, dpl); err != nil { return err } // Scrape cluster health from elasticsearch every time - err = cState.UpdateStatus(dpl) + err = cState.UpdateStatus(client, dpl) if err != nil { return err } @@ -90,7 +92,7 @@ func CreateOrUpdateElasticsearchCluster(dpl *v1alpha1.Elasticsearch, configMapNa } // NewClusterState func generates ClusterState for the current cluster -func NewClusterState(dpl *v1alpha1.Elasticsearch, configMapName, serviceAccountName string) (ClusterState, error) { +func NewClusterState(client client.Client, dpl *v1alpha1.Elasticsearch, configMapName, serviceAccountName string) (ClusterState, error) { nodes := []*nodeState{} cState := ClusterState{ Nodes: nodes, @@ -115,22 +117,22 @@ func NewClusterState(dpl *v1alpha1.Elasticsearch, configMapName, serviceAccountN } } - err := cState.amendDeployments(dpl) + err := cState.amendDeployments(client, dpl) if err != nil { return cState, fmt.Errorf("Unable to amend Deployments to status: %v", err) } - err = cState.amendStatefulSets(dpl) + err = cState.amendStatefulSets(client, dpl) if err != nil { return cState, fmt.Errorf("Unable to amend StatefulSets to status: %v", err) } - err = cState.amendReplicaSets(dpl) + err = cState.amendReplicaSets(client, dpl) if err != nil { return cState, fmt.Errorf("Unable to amend ReplicaSets to status: %v", err) } - err = cState.amendPods(dpl) + err = cState.amendPods(client, dpl) if err != nil { return cState, fmt.Errorf("Unable to amend Pods to status: %v", err) } @@ -140,7 +142,7 @@ func NewClusterState(dpl *v1alpha1.Elasticsearch, configMapName, serviceAccountN // getRequiredAction checks the desired state against what's present in current // deployments/statefulsets/pods -func (cState *ClusterState) getRequiredAction(dpl *v1alpha1.Elasticsearch) (v1alpha1.ElasticsearchRequiredAction, error) { +func (cState *ClusterState) getRequiredAction(client client.Client, dpl *v1alpha1.Elasticsearch) (v1alpha1.ElasticsearchRequiredAction, error) { // TODO: Add condition that if an operation is currently in progress // not to try to queue another action. Instead return ElasticsearchActionInProgress which // is noop. @@ -166,7 +168,7 @@ func (cState *ClusterState) getRequiredAction(dpl *v1alpha1.Elasticsearch) (v1al return v1alpha1.ElasticsearchActionRollingRestartNeeded, nil } for _, node := range cState.Nodes { - if node.Desired.IsUpdateNeeded() { + if node.Desired.IsUpdateNeeded(client) { return v1alpha1.ElasticsearchActionRollingRestartNeeded, nil } } @@ -181,17 +183,17 @@ func (cState *ClusterState) getRequiredAction(dpl *v1alpha1.Elasticsearch) (v1al return v1alpha1.ElasticsearchActionNone, nil } -func (cState *ClusterState) buildNewCluster(dpl *v1alpha1.Elasticsearch, owner metav1.OwnerReference) error { +func (cState *ClusterState) buildNewCluster(client client.Client, dpl *v1alpha1.Elasticsearch, owner metav1.OwnerReference) error { // Mark the operation in case of operator failure - if err := utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionTrue, utils.UpdateScalingUpCondition); err != nil { + if err := utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionTrue, utils.UpdateScalingUpCondition); err != nil { return fmt.Errorf("Unable to update Elasticsearch cluster status: %v", err) } - if err := utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionTrue, utils.UpdateUpdatingSettingsCondition); err != nil { + if err := utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionTrue, utils.UpdateUpdatingSettingsCondition); err != nil { return fmt.Errorf("Unable to update Elasticsearch cluster status: %v", err) } // Create the new nodes for _, node := range cState.Nodes { - err := node.Desired.CreateOrUpdateNode(owner) + err := node.Desired.CreateOrUpdateNode(client, owner) if err != nil { return fmt.Errorf("Unable to create Elasticsearch node: %v", err) } @@ -200,16 +202,16 @@ func (cState *ClusterState) buildNewCluster(dpl *v1alpha1.Elasticsearch, owner m } // list existing StatefulSets and delete those unmanaged by the operator -func (cState *ClusterState) removeStaleNodes(dpl *v1alpha1.Elasticsearch) error { +func (cState *ClusterState) removeStaleNodes(client client.Client, dpl *v1alpha1.Elasticsearch) error { // Set 'ScalingDown' condition to True before beggining the actual scale event - if err := utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionTrue, utils.UpdateScalingDownCondition); err != nil { + if err := utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionTrue, utils.UpdateScalingDownCondition); err != nil { return fmt.Errorf("Unable to update Elasticsearch cluster status: %v", err) } - if err := utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionTrue, utils.UpdateUpdatingSettingsCondition); err != nil { + if err := utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionTrue, utils.UpdateUpdatingSettingsCondition); err != nil { return fmt.Errorf("Unable to update Elasticsearch cluster status: %v", err) } // Prepare the cluster for the scale down event - if err := updateClusterSettings(dpl); err != nil { + if err := updateClusterSettings(client, dpl); err != nil { return err } // Remove extra Deployments @@ -219,7 +221,7 @@ func (cState *ClusterState) removeStaleNodes(dpl *v1alpha1.Elasticsearch) error Kind: "Deployment", APIVersion: "apps/v1", } - err := sdk.Delete(&node) + err := client.Delete(context.TODO(), &node) if err != nil { return fmt.Errorf("Unable to delete resource %v: ", err) } @@ -227,24 +229,24 @@ func (cState *ClusterState) removeStaleNodes(dpl *v1alpha1.Elasticsearch) error return nil } -func (cState *ClusterState) restartCluster(dpl *v1alpha1.Elasticsearch, owner metav1.OwnerReference) error { +func (cState *ClusterState) restartCluster(client client.Client, dpl *v1alpha1.Elasticsearch, owner metav1.OwnerReference) error { nodeUnderUpgrade := upgradeInProgress(dpl) // find a pod that can handle requests // in a single-master deployment the operator will complain about not having any master pods - masterPod, err := getRunningMasterPod(dpl.Name, dpl.Namespace) + masterPod, err := getRunningMasterPod(client, dpl.Name, dpl.Namespace) if err != nil { return nil } if nodeUnderUpgrade == nil { // don't attempt to restart the cluster unless cluster health is green - if ok := canRestartCluster(dpl); !ok { + if ok := canRestartCluster(client, dpl); !ok { logrus.Warnf("Cluster Rolling Restart requested but cluster isn't ready.") return nil } - nodeUnderUpgrade, err = cState.beginUpgrade(dpl, owner) + nodeUnderUpgrade, err = cState.beginUpgrade(client, dpl, owner) if err != nil { // try to revert shard allocation settings, best-effort operation - _ = enableShardAllocation(dpl, masterPod) + _ = enableShardAllocation(client, dpl, masterPod) return err } logrus.Infof("Rolling upgrade: began upgrading node: %v", nodeUnderUpgrade.DeploymentName) @@ -254,21 +256,21 @@ func (cState *ClusterState) restartCluster(dpl *v1alpha1.Elasticsearch, owner me if rejoined := nodeRejoinedCluster(dpl, masterPod); !rejoined { if nodeUnderUpgrade.UpgradeStatus.UpgradePhase != v1alpha1.NodeRestarting { logrus.Infof("Rolling upgrade: waiting for node '%s' to rejoin the cluster...", nodeUnderUpgrade.PodName) - if retryErr := utils.UpdateNodeUpgradeStatusWithRetry(dpl, nodeUnderUpgrade.DeploymentName, utils.NodeRestarting()); retryErr != nil { + if retryErr := utils.UpdateNodeUpgradeStatusWithRetry(client, dpl, nodeUnderUpgrade.DeploymentName, utils.NodeRestarting()); retryErr != nil { return err } } return nil } // enable shard allocation - if err = enableShardAllocation(dpl, masterPod); err != nil { + if err = enableShardAllocation(client, dpl, masterPod); err != nil { return err } // wait for rebalancing to finish - if health := clusterHealth(dpl); health != "green" { + if health := clusterHealth(client, dpl); health != "green" { if nodeUnderUpgrade.UpgradeStatus.UpgradePhase != v1alpha1.RecoveringData { logrus.Infof("Rolling upgrade: node '%s' rejoined cluster, recovering its data...", nodeUnderUpgrade.PodName) - if retryErr := utils.UpdateNodeUpgradeStatusWithRetry(dpl, nodeUnderUpgrade.DeploymentName, utils.NodeRecoveringData()); retryErr != nil { + if retryErr := utils.UpdateNodeUpgradeStatusWithRetry(client, dpl, nodeUnderUpgrade.DeploymentName, utils.NodeRecoveringData()); retryErr != nil { return err } } @@ -276,11 +278,11 @@ func (cState *ClusterState) restartCluster(dpl *v1alpha1.Elasticsearch, owner me } // node upgraded logrus.Debugf("Rolling restart: marked node %s as upgraded", nodeUnderUpgrade.DeploymentName) - return utils.UpdateNodeUpgradeStatusWithRetry(dpl, nodeUnderUpgrade.DeploymentName, utils.NodeNormalOperation()) + return utils.UpdateNodeUpgradeStatusWithRetry(client, dpl, nodeUnderUpgrade.DeploymentName, utils.NodeNormalOperation()) } -func canRestartCluster(dpl *v1alpha1.Elasticsearch) bool { - health := clusterHealth(dpl) +func canRestartCluster(client client.Client, dpl *v1alpha1.Elasticsearch) bool { + health := clusterHealth(client, dpl) if health == "green" { return true } @@ -294,8 +296,8 @@ func nodeRejoinedCluster(dpl *v1alpha1.Elasticsearch, masterPod *v1.Pod) bool { return desiredNumberOfNodes == actualNumberOfNodes } -func (cState *ClusterState) amendStatefulSets(dpl *v1alpha1.Elasticsearch) error { - statefulSets, err := listStatefulSets(dpl.Name, dpl.Namespace) +func (cState *ClusterState) amendStatefulSets(client client.Client, dpl *v1alpha1.Elasticsearch) error { + statefulSets, err := listStatefulSets(client, dpl.Name, dpl.Namespace) if err != nil { return fmt.Errorf("Unable to list Elasticsearch's StatefulSets: %v", err) } @@ -315,8 +317,8 @@ func (cState *ClusterState) amendStatefulSets(dpl *v1alpha1.Elasticsearch) error return nil } -func (cState *ClusterState) amendDeployments(dpl *v1alpha1.Elasticsearch) error { - deployments, err := listDeployments(dpl.Name, dpl.Namespace) +func (cState *ClusterState) amendDeployments(client client.Client, dpl *v1alpha1.Elasticsearch) error { + deployments, err := listDeployments(client, dpl.Name, dpl.Namespace) if err != nil { return fmt.Errorf("Unable to list Elasticsearch's Deployments: %v", err) } @@ -336,8 +338,8 @@ func (cState *ClusterState) amendDeployments(dpl *v1alpha1.Elasticsearch) error return nil } -func (cState *ClusterState) amendReplicaSets(dpl *v1alpha1.Elasticsearch) error { - replicaSets, err := listReplicaSets(dpl.Name, dpl.Namespace) +func (cState *ClusterState) amendReplicaSets(client client.Client, dpl *v1alpha1.Elasticsearch) error { + replicaSets, err := listReplicaSets(client, dpl.Name, dpl.Namespace) if err != nil { return fmt.Errorf("Unable to list Elasticsearch's ReplicaSets: %v", err) } @@ -357,8 +359,8 @@ func (cState *ClusterState) amendReplicaSets(dpl *v1alpha1.Elasticsearch) error return nil } -func (cState *ClusterState) amendPods(dpl *v1alpha1.Elasticsearch) error { - pods, err := listPods(dpl.Name, dpl.Namespace) +func (cState *ClusterState) amendPods(client client.Client, dpl *v1alpha1.Elasticsearch) error { + pods, err := listPods(client, dpl.Name, dpl.Namespace) if err != nil { return fmt.Errorf("Unable to list Elasticsearch's Pods: %v", err) } @@ -387,14 +389,14 @@ func upgradeInProgress(dpl *v1alpha1.Elasticsearch) *v1alpha1.ElasticsearchNodeS return nil } -func (cState *ClusterState) selectNodeForUpgrade(dpl *v1alpha1.Elasticsearch) (*desiredNodeState, *v1alpha1.ElasticsearchNodeStatus) { +func (cState *ClusterState) selectNodeForUpgrade(client client.Client, dpl *v1alpha1.Elasticsearch) (*desiredNodeState, *v1alpha1.ElasticsearchNodeStatus) { for _, nodeStatus := range dpl.Status.Nodes { // find a node which isn't under upgrade right now if nodeStatus.UpgradeStatus.UnderUpgrade == v1alpha1.UnderUpgradeFalse { // check if the node has old image for _, currentNode := range cState.Nodes { if currentNode.Desired.DeployName == nodeStatus.DeploymentName { - if currentNode.Desired.IsUpdateNeeded() { + if currentNode.Desired.IsUpdateNeeded(client) { return ¤tNode.Desired, &nodeStatus } } @@ -404,32 +406,32 @@ func (cState *ClusterState) selectNodeForUpgrade(dpl *v1alpha1.Elasticsearch) (* return nil, nil } -func (cState *ClusterState) beginUpgrade(dpl *v1alpha1.Elasticsearch, owner metav1.OwnerReference) (*v1alpha1.ElasticsearchNodeStatus, error) { - masterPod, err := getRunningMasterPod(dpl.Name, dpl.Namespace) +func (cState *ClusterState) beginUpgrade(client client.Client, dpl *v1alpha1.Elasticsearch, owner metav1.OwnerReference) (*v1alpha1.ElasticsearchNodeStatus, error) { + masterPod, err := getRunningMasterPod(client, dpl.Name, dpl.Namespace) if err != nil { return nil, err } - if err = disableShardAllocation(dpl, masterPod); err != nil { + if err = disableShardAllocation(client, dpl, masterPod); err != nil { return nil, err } if err = utils.PerformSyncedFlush(masterPod); err != nil { return nil, err } - return cState.upgradeNode(dpl, owner) + return cState.upgradeNode(client, dpl, owner) } -func (cState *ClusterState) upgradeNode(dpl *v1alpha1.Elasticsearch, owner metav1.OwnerReference) (*v1alpha1.ElasticsearchNodeStatus, error) { - nodeForUpgrade, nodeStatus := cState.selectNodeForUpgrade(dpl) +func (cState *ClusterState) upgradeNode(client client.Client, dpl *v1alpha1.Elasticsearch, owner metav1.OwnerReference) (*v1alpha1.ElasticsearchNodeStatus, error) { + nodeForUpgrade, nodeStatus := cState.selectNodeForUpgrade(client, dpl) if nodeForUpgrade == nil { // upgrade requested, but there are no nodes for upgrade? return nil, fmt.Errorf("Upgrade requested but no nodes for upgrade found") } // TODO: maybe first mark the node 'underUpgrade' and revert that // if the upgrade fails? - if err := nodeForUpgrade.CreateOrUpdateNode(owner); err != nil { + if err := nodeForUpgrade.CreateOrUpdateNode(client, owner); err != nil { return nil, fmt.Errorf("Unable to create Elasticsearch node: %v", err) } - if err := utils.UpdateNodeUpgradeStatusWithRetry(dpl, nodeForUpgrade.DeployName, utils.NodeControllerUpdated()); err != nil { + if err := utils.UpdateNodeUpgradeStatusWithRetry(client, dpl, nodeForUpgrade.DeployName, utils.NodeControllerUpdated()); err != nil { return nil, err } nodeStatus = nil @@ -447,15 +449,15 @@ func (cState *ClusterState) upgradeNode(dpl *v1alpha1.Elasticsearch, owner metav return nodeStatus, nil } -func disableShardAllocation(dpl *v1alpha1.Elasticsearch, masterPod *v1.Pod) error { - return setShardAllocation(dpl, masterPod, v1alpha1.ShardAllocationFalse) +func disableShardAllocation(client client.Client, dpl *v1alpha1.Elasticsearch, masterPod *v1.Pod) error { + return setShardAllocation(client, dpl, masterPod, v1alpha1.ShardAllocationFalse) } -func enableShardAllocation(dpl *v1alpha1.Elasticsearch, masterPod *v1.Pod) error { - return setShardAllocation(dpl, masterPod, v1alpha1.ShardAllocationTrue) +func enableShardAllocation(client client.Client, dpl *v1alpha1.Elasticsearch, masterPod *v1.Pod) error { + return setShardAllocation(client, dpl, masterPod, v1alpha1.ShardAllocationTrue) } -func setShardAllocation(dpl *v1alpha1.Elasticsearch, masterPod *v1.Pod, enabled v1alpha1.ShardAllocationState) error { +func setShardAllocation(client client.Client, dpl *v1alpha1.Elasticsearch, masterPod *v1.Pod, enabled v1alpha1.ShardAllocationState) error { if enabled == dpl.Status.ShardAllocationEnabled { return nil } @@ -463,14 +465,15 @@ func setShardAllocation(dpl *v1alpha1.Elasticsearch, masterPod *v1.Pod, enabled return err } retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error { - if getErr := sdk.Get(dpl); getErr != nil { + dplRetry := &v1alpha1.Elasticsearch{} + if getErr := client.Get(context.TODO(), types.NamespacedName{Name: dpl.Name, Namespace: dpl.Namespace}, dplRetry); getErr != nil { return getErr } - if dpl.Status.ShardAllocationEnabled == enabled { + if dplRetry.Status.ShardAllocationEnabled == enabled { return nil } - dpl.Status.ShardAllocationEnabled = enabled - return sdk.Update(dpl) + dplRetry.Status.ShardAllocationEnabled = enabled + return client.Update(context.TODO(), dplRetry) }) // TODO: should we revert shard allocation? // if retryErr != nil { @@ -482,8 +485,8 @@ func setShardAllocation(dpl *v1alpha1.Elasticsearch, masterPod *v1.Pod, enabled return retryErr } -func updateClusterSettings(dpl *v1alpha1.Elasticsearch) error { - masterPods, err := listRunningMasterPods(dpl.Name, dpl.Namespace) +func updateClusterSettings(client client.Client, dpl *v1alpha1.Elasticsearch) error { + masterPods, err := listRunningMasterPods(client, dpl.Name, dpl.Namespace) if err != nil { return err } @@ -493,7 +496,7 @@ func updateClusterSettings(dpl *v1alpha1.Elasticsearch) error { // all nodes spawned later will read the config map if len(masterPods.Items) == 0 { // in case ClusterSettingsUpdate had been requested and all master pods disapeared cancel the request - if err = utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionFalse, utils.UpdateUpdatingSettingsCondition); err != nil { + if err = utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionFalse, utils.UpdateUpdatingSettingsCondition); err != nil { return fmt.Errorf("Unable to update Elasticsearch cluster status: %v", err) } return nil @@ -505,15 +508,15 @@ func updateClusterSettings(dpl *v1alpha1.Elasticsearch) error { if err := execClusterSettingsUpdate(dpl, masterPod); err != nil { return err } - err = utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionFalse, utils.UpdateUpdatingSettingsCondition) + err = utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionFalse, utils.UpdateUpdatingSettingsCondition) case v1alpha1.ScaledDown: - err = utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionFalse, utils.UpdateScalingDownCondition) + err = utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionFalse, utils.UpdateScalingDownCondition) case v1alpha1.ScaledUp: if err := execClusterSettingsUpdate(dpl, masterPod); err != nil { return err } - err = utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionFalse, utils.UpdateUpdatingSettingsCondition) - err = utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionFalse, utils.UpdateScalingUpCondition) + err = utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionFalse, utils.UpdateUpdatingSettingsCondition) + err = utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionFalse, utils.UpdateScalingUpCondition) case v1alpha1.NoEvent: return nil } diff --git a/pkg/k8shandler/configmaps.go b/pkg/k8shandler/configmaps.go index b37a4958a..63fec7bb4 100644 --- a/pkg/k8shandler/configmaps.go +++ b/pkg/k8shandler/configmaps.go @@ -2,6 +2,7 @@ package k8shandler import ( "bytes" + "context" "crypto/sha256" "fmt" "strconv" @@ -9,11 +10,12 @@ import ( "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/retry" + "sigs.k8s.io/controller-runtime/pkg/client" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" + "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "github.com/openshift/elasticsearch-operator/pkg/utils" - "github.com/operator-framework/operator-sdk/pkg/sdk" "github.com/sirupsen/logrus" ) @@ -24,7 +26,7 @@ const ( ) // CreateOrUpdateConfigMaps ensures the existence of ConfigMaps with Elasticsearch configuration -func CreateOrUpdateConfigMaps(dpl *v1alpha1.Elasticsearch) (string, error) { +func CreateOrUpdateConfigMaps(client client.Client, dpl *v1alpha1.Elasticsearch) (string, error) { owner := asOwner(dpl) configMapName := v1alpha1.ConfigMapName @@ -43,39 +45,39 @@ func CreateOrUpdateConfigMaps(dpl *v1alpha1.Elasticsearch) (string, error) { esUnicastHost := esUnicastHost(dpl.Name) rootLogger := rootLogger() - err = createOrUpdateConfigMap(dpl, configMapName, dpl.Namespace, dpl.Name, kibanaIndexMode, esUnicastHost, rootLogger, nodeQuorum, recoverExpectedShards, primaryShardsCount, replicaShardsCount, owner, dpl.Labels) + err = createOrUpdateConfigMap(client, dpl, configMapName, dpl.Namespace, dpl.Name, kibanaIndexMode, esUnicastHost, rootLogger, nodeQuorum, recoverExpectedShards, primaryShardsCount, replicaShardsCount, owner, dpl.Labels) if err != nil { return configMapName, fmt.Errorf("Failure creating ConfigMap %v", err) } return configMapName, nil } -func createOrUpdateConfigMap(dpl *v1alpha1.Elasticsearch, configMapName, namespace, clusterName, kibanaIndexMode, esUnicastHost, rootLogger, nodeQuorum, recoverExpectedShards, primaryShardsCount, replicaShardsCount string, +func createOrUpdateConfigMap(client client.Client, dpl *v1alpha1.Elasticsearch, configMapName, namespace, clusterName, kibanaIndexMode, esUnicastHost, rootLogger, nodeQuorum, recoverExpectedShards, primaryShardsCount, replicaShardsCount string, owner metav1.OwnerReference, labels map[string]string) error { elasticsearchCM, err := createConfigMap(configMapName, namespace, clusterName, kibanaIndexMode, esUnicastHost, rootLogger, nodeQuorum, recoverExpectedShards, primaryShardsCount, replicaShardsCount, labels) if err != nil { return err } addOwnerRefToObject(elasticsearchCM, owner) - err = sdk.Create(elasticsearchCM) + err = client.Create(context.TODO(), elasticsearchCM) if err != nil && !errors.IsAlreadyExists(err) { return fmt.Errorf("Failure constructing Elasticsearch ConfigMap: %v", err) } else if errors.IsAlreadyExists(err) { // Get existing configMap to check if it is same as what we want - existingCM := configMap(configMapName, namespace, labels) - err = sdk.Get(existingCM) + existingCM := &v1.ConfigMap{} + err = client.Get(context.TODO(), types.NamespacedName{Name: configMapName, Namespace: namespace}, existingCM) if err != nil { return fmt.Errorf("Unable to get Elasticsearch cluster configMap: %v", err) } if configMapContentChanged(existingCM, elasticsearchCM) { // Cluster settings has changed, make sure it doesnt go unnoticed - if err := utils.UpdateConditionWithRetry(dpl, v1alpha1.ConditionTrue, utils.UpdateUpdatingSettingsCondition); err != nil { + if err := utils.UpdateConditionWithRetry(client, dpl, v1alpha1.ConditionTrue, utils.UpdateUpdatingSettingsCondition); err != nil { return fmt.Errorf("Unable to update Elasticsearch cluster status: %v", err) } return retry.RetryOnConflict(retry.DefaultRetry, func() error { - if getErr := sdk.Get(existingCM); getErr != nil { + if getErr := client.Get(context.TODO(), types.NamespacedName{Name: configMapName, Namespace: namespace}, existingCM); getErr != nil { logrus.Debugf("Could not get Elasticsearch %v: %v", dpl.Name, getErr) return getErr } @@ -84,7 +86,7 @@ func createOrUpdateConfigMap(dpl *v1alpha1.Elasticsearch, configMapName, namespa existingCM.Data[log4jConfig] = elasticsearchCM.Data[log4jConfig] existingCM.Data[indexSettingsConfig] = elasticsearchCM.Data[indexSettingsConfig] - if updateErr := sdk.Update(existingCM); updateErr != nil { + if updateErr := client.Update(context.TODO(), existingCM); updateErr != nil { logrus.Debugf("Failed to update Elasticsearch %v status: %v", dpl.Name, updateErr) return updateErr } diff --git a/pkg/k8shandler/defaults.go b/pkg/k8shandler/defaults.go index ce09ba028..8b86471a9 100644 --- a/pkg/k8shandler/defaults.go +++ b/pkg/k8shandler/defaults.go @@ -3,7 +3,7 @@ package k8shandler import ( "fmt" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" + "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" ) const ( diff --git a/pkg/k8shandler/deployment.go b/pkg/k8shandler/deployment.go index 4468e0aaf..7ac0d953e 100644 --- a/pkg/k8shandler/deployment.go +++ b/pkg/k8shandler/deployment.go @@ -1,15 +1,17 @@ package k8shandler import ( + "context" "fmt" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" + "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "github.com/sirupsen/logrus" - "github.com/operator-framework/operator-sdk/pkg/sdk" apps "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" ) type deploymentNode struct { @@ -99,13 +101,13 @@ func (node *deploymentNode) isDifferent(cfg *desiredNodeState) (bool, error) { return false, nil } -func (node *deploymentNode) query() error { - err := sdk.Get(&node.resource) +func (node *deploymentNode) query(client client.Client) error { + err := client.Get(context.TODO(), types.NamespacedName{Name: node.resource.Name, Namespace: node.resource.Namespace}, &apps.Deployment{}) return err } // constructNodeDeployment creates the deployment for the node -func (node *deploymentNode) constructNodeResource(cfg *desiredNodeState, owner metav1.OwnerReference) (runtime.Object, error) { +func (node *deploymentNode) constructNodeResource(client client.Client, cfg *desiredNodeState, owner metav1.OwnerReference) (runtime.Object, error) { // Check if deployment exists @@ -136,8 +138,8 @@ func (node *deploymentNode) constructNodeResource(cfg *desiredNodeState, owner m Type: "Recreate", }, ProgressDeadlineSeconds: &progressDeadlineSeconds, - Template: cfg.constructPodTemplateSpec(), - Paused: cfg.Paused, + Template: cfg.constructPodTemplateSpec(client), + Paused: cfg.Paused, } // if storageClass != "default" { @@ -153,8 +155,8 @@ func (node *deploymentNode) constructNodeResource(cfg *desiredNodeState, owner m return &deployment, nil } -func (node *deploymentNode) delete() error { - err := sdk.Delete(&node.resource) +func (node *deploymentNode) delete(client client.Client) error { + err := client.Delete(context.TODO(), &node.resource) if err != nil { return fmt.Errorf("Unable to delete Deployment %v: ", err) } diff --git a/pkg/k8shandler/desirednodestate.go b/pkg/k8shandler/desirednodestate.go index 9bf204af8..3dc0ab4f2 100644 --- a/pkg/k8shandler/desirednodestate.go +++ b/pkg/k8shandler/desirednodestate.go @@ -1,13 +1,13 @@ package k8shandler import ( + "context" "fmt" "sort" "strconv" "strings" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" - "github.com/operator-framework/operator-sdk/pkg/sdk" + "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "github.com/sirupsen/logrus" apps "k8s.io/api/apps/v1" "k8s.io/api/core/v1" @@ -15,6 +15,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/util/retry" + "sigs.k8s.io/controller-runtime/pkg/client" ) const ( @@ -195,18 +196,18 @@ func (cfg *desiredNodeState) getNode() NodeTypeInterface { return NewStatefulSetNode(cfg.DeployName, cfg.Namespace) } -func (cfg *desiredNodeState) CreateOrUpdateNode(owner metav1.OwnerReference) error { +func (cfg *desiredNodeState) CreateOrUpdateNode(client client.Client, owner metav1.OwnerReference) error { node := cfg.getNode() - err := node.query() + err := node.query(client) if err != nil { // Node's resource doesn't exist, we can construct one cfg.Paused = false logrus.Infof("Constructing new resource %v", cfg.DeployName) - dep, err := node.constructNodeResource(cfg, owner) + dep, err := node.constructNodeResource(client, cfg, owner) if err != nil { return fmt.Errorf("Could not construct node resource: %v", err) } - err = sdk.Create(dep) + err = client.Create(context.TODO(), dep) if err != nil && !errors.IsAlreadyExists(err) { return fmt.Errorf("Could not create node resource: %v", err) } @@ -216,18 +217,18 @@ func (cfg *desiredNodeState) CreateOrUpdateNode(owner metav1.OwnerReference) err nretries := -1 retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error { nretries++ - if getErr := node.query(); getErr != nil { + if getErr := node.query(client); getErr != nil { logrus.Debugf("Could not get Elasticsearch node resource %v: %v", cfg.DeployName, getErr) return getErr } - dep, updateErr := node.constructNodeResource(cfg, metav1.OwnerReference{}) + dep, updateErr := node.constructNodeResource(client, cfg, metav1.OwnerReference{}) if updateErr != nil { return fmt.Errorf("Could not construct node resource %v for update: %v", cfg.DeployName, updateErr) } if nretries == 0 { logrus.Infof("Updating node resource %v", cfg.DeployName) } - if updateErr = sdk.Update(dep); updateErr != nil { + if updateErr = client.Update(context.TODO(), dep); updateErr != nil { logrus.Debugf("Failed to update node resource %v: %v", cfg.DeployName, updateErr) } return updateErr @@ -252,16 +253,16 @@ func (cfg *desiredNodeState) CreateOrUpdateNode(owner metav1.OwnerReference) err nretries := -1 retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error { nretries++ - if getErr := node.query(); getErr != nil { + if getErr := node.query(client); getErr != nil { logrus.Debugf("Could not get Elasticsearch node resource %v: %v", cfg.DeployName, getErr) return getErr } - dep, updateErr := node.constructNodeResource(cfg, metav1.OwnerReference{}) + dep, updateErr := node.constructNodeResource(client, cfg, metav1.OwnerReference{}) if updateErr != nil { return fmt.Errorf("Could not construct node resource %v for update: %v", cfg.DeployName, updateErr) } logrus.Infof("Updating node resource %v", cfg.DeployName) - if updateErr = sdk.Update(dep); updateErr != nil { + if updateErr = client.Update(context.TODO(), dep); updateErr != nil { logrus.Debugf("Failed to update node resource %v: %v", cfg.DeployName, updateErr) } return updateErr @@ -275,18 +276,18 @@ func (cfg *desiredNodeState) CreateOrUpdateNode(owner metav1.OwnerReference) err cfg.Paused = true retryErr = retry.RetryOnConflict(retry.DefaultRetry, func() error { nretries++ - if getErr := node.query(); getErr != nil { + if getErr := node.query(client); getErr != nil { logrus.Debugf("Could not get Elasticsearch node resource %v: %v", cfg.DeployName, getErr) return getErr } - dep, updateErr := node.constructNodeResource(cfg, metav1.OwnerReference{}) + dep, updateErr := node.constructNodeResource(client, cfg, metav1.OwnerReference{}) if updateErr != nil { return fmt.Errorf("Could not construct node resource %v for update: %v", cfg.DeployName, updateErr) } if nretries == 0 { logrus.Infof("Updating node resource %v", cfg.DeployName) } - if updateErr = sdk.Update(dep); updateErr != nil { + if updateErr = client.Update(context.TODO(), dep); updateErr != nil { logrus.Debugf("Failed to update node resource %v: %v", cfg.DeployName, updateErr) } return updateErr @@ -299,11 +300,11 @@ func (cfg *desiredNodeState) CreateOrUpdateNode(owner metav1.OwnerReference) err return nil } -func (cfg *desiredNodeState) IsUpdateNeeded() bool { - // FIXME: to be refactored. query() must not exist here, since +func (cfg *desiredNodeState) IsUpdateNeeded(client client.Client) bool { + // FIXME: to be refactored. query(client) must not exist here, since // we already have information in clusterState node := cfg.getNode() - err := node.query() + err := node.query(client) if err != nil { // resource doesn't exist, so the update is needed return true @@ -525,7 +526,7 @@ func (cfg *desiredNodeState) generateMasterPVC() (v1.PersistentVolumeClaim, bool return v1.PersistentVolumeClaim{}, false, fmt.Errorf("Unsupported volume configuration for master in cluster %s", cfg.ClusterName) } -func (cfg *desiredNodeState) generatePersistentStorage() v1.VolumeSource { +func (cfg *desiredNodeState) generatePersistentStorage(client client.Client) v1.VolumeSource { volSource := v1.VolumeSource{} specVol := cfg.ESNodeSpec.Storage switch { @@ -539,7 +540,7 @@ func (cfg *desiredNodeState) generatePersistentStorage() v1.VolumeSource { ClaimName: claimName, } volSource.PersistentVolumeClaim = &volClaim - err := createOrUpdatePersistentVolumeClaim(specVol.VolumeClaimTemplate.Spec, claimName, cfg.Namespace) + err := createOrUpdatePersistentVolumeClaim(client, specVol.VolumeClaimTemplate.Spec, claimName, cfg.Namespace) if err != nil { logrus.Errorf("Unable to create PersistentVolumeClaim: %v", err) } @@ -552,7 +553,7 @@ func (cfg *desiredNodeState) generatePersistentStorage() v1.VolumeSource { return volSource } -func (cfg *desiredNodeState) getVolumes() []v1.Volume { +func (cfg *desiredNodeState) getVolumes(client client.Client) []v1.Volume { vols := []v1.Volume{ v1.Volume{ Name: "elasticsearch-config", @@ -569,7 +570,7 @@ func (cfg *desiredNodeState) getVolumes() []v1.Volume { if !cfg.isNodePureMaster() { vols = append(vols, v1.Volume{ Name: "elasticsearch-storage", - VolumeSource: cfg.generatePersistentStorage(), + VolumeSource: cfg.generatePersistentStorage(client), }) } @@ -625,7 +626,7 @@ func (actualState *actualNodeState) isStatusUpdateNeeded(nodesInStatus v1alpha1. return true } -func (cfg *desiredNodeState) constructPodTemplateSpec() v1.PodTemplateSpec { +func (cfg *desiredNodeState) constructPodTemplateSpec(client client.Client) v1.PodTemplateSpec { affinity := cfg.getAffinity() template := v1.PodTemplateSpec{ @@ -637,7 +638,7 @@ func (cfg *desiredNodeState) constructPodTemplateSpec() v1.PodTemplateSpec { Containers: []v1.Container{ cfg.getESContainer(), }, - Volumes: cfg.getVolumes(), + Volumes: cfg.getVolumes(client), // ImagePullSecrets: TemplateImagePullSecrets(imagePullSecrets), ServiceAccountName: cfg.ServiceAccountName, }, diff --git a/pkg/k8shandler/nodetypefactory.go b/pkg/k8shandler/nodetypefactory.go index 9bb240245..b4f245c0d 100644 --- a/pkg/k8shandler/nodetypefactory.go +++ b/pkg/k8shandler/nodetypefactory.go @@ -4,15 +4,16 @@ import ( apps "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/controller-runtime/pkg/client" ) // NodeTypeInterface interace represents individual Elasticsearch node type NodeTypeInterface interface { getResource() runtime.Object isDifferent(cfg *desiredNodeState) (bool, error) - constructNodeResource(cfg *desiredNodeState, owner metav1.OwnerReference) (runtime.Object, error) - delete() error - query() error + constructNodeResource(client client.Client, cfg *desiredNodeState, owner metav1.OwnerReference) (runtime.Object, error) + delete(client client.Client) error + query(client client.Client) error } // NodeTypeFactory is a factory to construct either statefulset or deployment diff --git a/pkg/k8shandler/persistentvolumeclaims.go b/pkg/k8shandler/persistentvolumeclaims.go index 3e64b2b89..7bafab1be 100644 --- a/pkg/k8shandler/persistentvolumeclaims.go +++ b/pkg/k8shandler/persistentvolumeclaims.go @@ -1,23 +1,25 @@ package k8shandler import ( + "context" "fmt" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/operator-framework/operator-sdk/pkg/sdk" "github.com/sirupsen/logrus" ) -func createOrUpdatePersistentVolumeClaim(pvc v1.PersistentVolumeClaimSpec, newName string, namespace string) error { - claim := persistentVolumeClaim(newName, namespace) - err := sdk.Get(claim) +func createOrUpdatePersistentVolumeClaim(client client.Client, pvc v1.PersistentVolumeClaimSpec, newName string, namespace string) error { + claim := &v1.PersistentVolumeClaim{} + err := client.Get(context.TODO(), types.NamespacedName{Name: newName, Namespace: namespace}, claim) if err != nil { // PVC doesn't exists, needs to be created. claim = createPersistentVolumeClaim(newName, namespace, pvc) logrus.Infof("Creating new PVC: %v", newName) - err = sdk.Create(claim) + err = client.Create(context.TODO(), claim) if err != nil { return fmt.Errorf("Unable to create PVC: %v", err) } diff --git a/pkg/k8shandler/prometheus_rule.go b/pkg/k8shandler/prometheus_rule.go index f10cddc95..0eeaf800e 100644 --- a/pkg/k8shandler/prometheus_rule.go +++ b/pkg/k8shandler/prometheus_rule.go @@ -2,17 +2,18 @@ package k8shandler import ( "bytes" + "context" "fmt" "io/ioutil" "os" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "github.com/openshift/elasticsearch-operator/pkg/utils" - "github.com/operator-framework/operator-sdk/pkg/sdk" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8sYAML "k8s.io/apimachinery/pkg/util/yaml" + "sigs.k8s.io/controller-runtime/pkg/client" ) const ( @@ -20,7 +21,7 @@ const ( rulesFilePath = "/etc/elasticsearch-operator/files/prometheus_rules.yml" ) -func CreateOrUpdatePrometheusRules(dpl *v1alpha1.Elasticsearch) error { +func CreateOrUpdatePrometheusRules(client client.Client, dpl *v1alpha1.Elasticsearch) error { ruleName := fmt.Sprintf("%s-%s", dpl.Name, "prometheus-rules") owner := asOwner(dpl) @@ -31,7 +32,7 @@ func CreateOrUpdatePrometheusRules(dpl *v1alpha1.Elasticsearch) error { addOwnerRefToObject(promRule, owner) - err = sdk.Create(promRule) + err = client.Create(context.TODO(), promRule) if err != nil && !errors.IsAlreadyExists(err) { return err } @@ -63,7 +64,7 @@ func prometheusRule(ruleName, namespace string, labels map[string]string) *monit return &monitoringv1.PrometheusRule{ TypeMeta: metav1.TypeMeta{ Kind: monitoringv1.PrometheusRuleKind, - APIVersion: monitoringv1.Group + "/" + monitoringv1.Version, + APIVersion: monitoringv1.SchemeGroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/k8shandler/service_monitor.go b/pkg/k8shandler/service_monitor.go index 4fb65b2cc..686f1b781 100644 --- a/pkg/k8shandler/service_monitor.go +++ b/pkg/k8shandler/service_monitor.go @@ -1,17 +1,18 @@ package k8shandler import ( + "context" "fmt" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" - "github.com/operator-framework/operator-sdk/pkg/sdk" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" ) // CreateOrUpdateServiceMonitors ensures the existence of ServiceMonitors for Elasticsearch cluster -func CreateOrUpdateServiceMonitors(dpl *v1alpha1.Elasticsearch) error { +func CreateOrUpdateServiceMonitors(client client.Client, dpl *v1alpha1.Elasticsearch) error { serviceMonitorName := fmt.Sprintf("monitor-%s-%s", dpl.Name, "cluster") owner := asOwner(dpl) @@ -19,7 +20,7 @@ func CreateOrUpdateServiceMonitors(dpl *v1alpha1.Elasticsearch) error { elasticsearchScMonitor := createServiceMonitor(serviceMonitorName, dpl.Namespace, labelsWithDefault) addOwnerRefToObject(elasticsearchScMonitor, owner) - err := sdk.Create(elasticsearchScMonitor) + err := client.Create(context.TODO(), elasticsearchScMonitor) if err != nil && !errors.IsAlreadyExists(err) { return fmt.Errorf("Failure constructing Elasticsearch ServiceMonitor: %v", err) } @@ -56,7 +57,7 @@ func serviceMonitor(serviceMonitorName string, namespace string, labels map[stri return &monitoringv1.ServiceMonitor{ TypeMeta: metav1.TypeMeta{ Kind: monitoringv1.ServiceMonitorsKind, - APIVersion: monitoringv1.Group + "/" + monitoringv1.Version, + APIVersion: monitoringv1.SchemeGroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: serviceMonitorName, diff --git a/pkg/k8shandler/serviceaccount.go b/pkg/k8shandler/serviceaccount.go index c18c51839..c9ec76391 100644 --- a/pkg/k8shandler/serviceaccount.go +++ b/pkg/k8shandler/serviceaccount.go @@ -1,22 +1,24 @@ package k8shandler import ( + "context" "fmt" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" - "github.com/operator-framework/operator-sdk/pkg/sdk" + v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" ) // CreateOrUpdateServiceAccount ensures the existence of the serviceaccount for Elasticsearch cluster -func CreateOrUpdateServiceAccount(dpl *v1alpha1.Elasticsearch) (string, error) { +func CreateOrUpdateServiceAccount(client client.Client, dpl *v1alpha1.Elasticsearch) (string, error) { serviceAccountName := v1alpha1.ServiceAccountName owner := asOwner(dpl) - err := createOrUpdateServiceAccount(serviceAccountName, dpl.Namespace, owner) + err := createOrUpdateServiceAccount(client, serviceAccountName, dpl.Namespace, owner) if err != nil { return serviceAccountName, fmt.Errorf("Failure creating ServiceAccount %v", err) } @@ -24,12 +26,12 @@ func CreateOrUpdateServiceAccount(dpl *v1alpha1.Elasticsearch) (string, error) { return serviceAccountName, nil } -func createOrUpdateServiceAccount(serviceAccountName, namespace string, owner metav1.OwnerReference) error { - elasticsearchSA := serviceAccount(serviceAccountName, namespace) - addOwnerRefToObject(elasticsearchSA, owner) - err := sdk.Get(elasticsearchSA) +func createOrUpdateServiceAccount(client client.Client, serviceAccountName, namespace string, owner metav1.OwnerReference) error { + err := client.Get(context.TODO(), types.NamespacedName{Name: serviceAccountName, Namespace: namespace}, &v1.ServiceAccount{}) if err != nil { - err = sdk.Create(elasticsearchSA) + elasticsearchSA := serviceAccount(serviceAccountName, namespace) + addOwnerRefToObject(elasticsearchSA, owner) + err = client.Create(context.TODO(), elasticsearchSA) if err != nil { return fmt.Errorf("Failure constructing serviceaccount for the Elasticsearch cluster: %v", err) } diff --git a/pkg/k8shandler/services.go b/pkg/k8shandler/services.go index 4d804bb50..43c903922 100644 --- a/pkg/k8shandler/services.go +++ b/pkg/k8shandler/services.go @@ -1,47 +1,49 @@ package k8shandler import ( + "context" "fmt" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" - "github.com/operator-framework/operator-sdk/pkg/sdk" + v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "k8s.io/apimachinery/pkg/util/intstr" ) // CreateOrUpdateServices ensures the existence of the services for Elasticsearch cluster -func CreateOrUpdateServices(dpl *v1alpha1.Elasticsearch) error { +func CreateOrUpdateServices(client client.Client, dpl *v1alpha1.Elasticsearch) error { elasticsearchClusterSvcName := fmt.Sprintf("%s-%s", dpl.Name, "cluster") elasticsearchRestSvcName := dpl.Name owner := asOwner(dpl) labelsWithDefault := appendDefaultLabel(dpl.Name, dpl.Labels) - err := createOrUpdateService(elasticsearchClusterSvcName, dpl.Namespace, dpl.Name, "cluster", 9300, selectorForES("es-node-master", dpl.Name), labelsWithDefault, true, owner) + err := createOrUpdateService(client, elasticsearchClusterSvcName, dpl.Namespace, dpl.Name, "cluster", 9300, selectorForES("es-node-master", dpl.Name), labelsWithDefault, true, owner) if err != nil { return fmt.Errorf("Failure creating service %v", err) } - err = createOrUpdateService(elasticsearchRestSvcName, dpl.Namespace, dpl.Name, "restapi", 9200, selectorForES("es-node-client", dpl.Name), labelsWithDefault, false, owner) + err = createOrUpdateService(client, elasticsearchRestSvcName, dpl.Namespace, dpl.Name, "restapi", 9200, selectorForES("es-node-client", dpl.Name), labelsWithDefault, false, owner) if err != nil { return fmt.Errorf("Failure creating service %v", err) } return nil } -func createOrUpdateService(serviceName, namespace, clusterName, targetPortName string, port int32, selector, labels map[string]string, publishNotReady bool, owner metav1.OwnerReference) error { +func createOrUpdateService(client client.Client, serviceName, namespace, clusterName, targetPortName string, port int32, selector, labels map[string]string, publishNotReady bool, owner metav1.OwnerReference) error { elasticsearchSvc := createService(serviceName, namespace, clusterName, targetPortName, port, selector, labels, publishNotReady) addOwnerRefToObject(elasticsearchSvc, owner) - err := sdk.Create(elasticsearchSvc) + err := client.Create(context.TODO(), elasticsearchSvc) if err != nil && !errors.IsAlreadyExists(err) { return fmt.Errorf("Failure constructing Elasticsearch service: %v", err) } else if errors.IsAlreadyExists(err) { // Get existing service to check if it is same as what we want - existingSvc := service(serviceName, namespace) - err = sdk.Get(existingSvc) + existingSvc := &v1.Service{} // service(serviceName, namespace) + err = client.Get(context.TODO(), types.NamespacedName{Name: serviceName, Namespace: namespace}, existingSvc) if err != nil { return fmt.Errorf("Unable to get Elasticsearch cluster service: %v", err) } diff --git a/pkg/k8shandler/statefulset.go b/pkg/k8shandler/statefulset.go index 3507d44cf..c3b6ae69c 100644 --- a/pkg/k8shandler/statefulset.go +++ b/pkg/k8shandler/statefulset.go @@ -1,13 +1,15 @@ package k8shandler import ( + "context" "fmt" - "github.com/operator-framework/operator-sdk/pkg/sdk" apps "k8s.io/api/apps/v1" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" ) type statefulSetNode struct { @@ -29,13 +31,13 @@ func (node *statefulSetNode) isDifferent(cfg *desiredNodeState) (bool, error) { return false, nil } -func (node *statefulSetNode) query() error { - err := sdk.Get(&node.resource) +func (node *statefulSetNode) query(client client.Client) error { + err := client.Get(context.TODO(), types.NamespacedName{Name: node.resource.Name, Namespace: node.resource.Namespace}, &apps.StatefulSet{}) return err } // constructNodeStatefulSet creates the StatefulSet for the node -func (node *statefulSetNode) constructNodeResource(cfg *desiredNodeState, owner metav1.OwnerReference) (runtime.Object, error) { +func (node *statefulSetNode) constructNodeResource(client client.Client, cfg *desiredNodeState, owner metav1.OwnerReference) (runtime.Object, error) { replicas := cfg.getReplicas() @@ -49,7 +51,7 @@ func (node *statefulSetNode) constructNodeResource(cfg *desiredNodeState, owner Selector: &metav1.LabelSelector{ MatchLabels: cfg.getLabels(), }, - Template: cfg.constructPodTemplateSpec(), + Template: cfg.constructPodTemplateSpec(client), } pvc, ok, err := cfg.generateMasterPVC() @@ -67,8 +69,8 @@ func (node *statefulSetNode) constructNodeResource(cfg *desiredNodeState, owner return &statefulSet, nil } -func (node *statefulSetNode) delete() error { - err := sdk.Delete(&node.resource) +func (node *statefulSetNode) delete(client client.Client) error { + err := client.Delete(context.TODO(), &node.resource) if err != nil { return fmt.Errorf("Unable to delete StatefulSet %v: ", err) } diff --git a/pkg/k8shandler/status.go b/pkg/k8shandler/status.go index e6d1b4f11..e74ddbf55 100644 --- a/pkg/k8shandler/status.go +++ b/pkg/k8shandler/status.go @@ -1,29 +1,31 @@ package k8shandler import ( + "context" "fmt" - "k8s.io/client-go/util/retry" - - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" + v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "github.com/openshift/elasticsearch-operator/pkg/utils" - "github.com/operator-framework/operator-sdk/pkg/sdk" "github.com/sirupsen/logrus" "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/util/retry" + "sigs.k8s.io/controller-runtime/pkg/client" ) const healthUnknown = "cluster health unknown" // UpdateStatus updates the status of Elasticsearch CRD -func (cState *ClusterState) UpdateStatus(dpl *v1alpha1.Elasticsearch) error { +func (cState *ClusterState) UpdateStatus(client client.Client, dpl *v1alpha1.Elasticsearch) error { nretries := -1 retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error { nretries++ - if getErr := sdk.Get(dpl); getErr != nil { + if getErr := client.Get(context.TODO(), types.NamespacedName{Name: dpl.Name, Namespace: dpl.Namespace}, dpl); getErr != nil { logrus.Debugf("Could not get Elasticsearch %v: %v", dpl.Name, getErr) return getErr } - dpl.Status.ClusterHealth = clusterHealth(dpl) + dpl.Status.ClusterHealth = clusterHealth(client, dpl) if dpl.Status.ShardAllocationEnabled == "" { dpl.Status.ShardAllocationEnabled = v1alpha1.ShardAllocationTrue } @@ -34,8 +36,8 @@ func (cState *ClusterState) UpdateStatus(dpl *v1alpha1.Elasticsearch) error { } dpl.Status.Nodes = nodes updateStatusConditions(&dpl.Status) - dpl.Status.Pods = rolePodStateMap(dpl.Namespace, dpl.Name) - if updateErr := sdk.Update(dpl); updateErr != nil { + dpl.Status.Pods = rolePodStateMap(client, dpl.Namespace, dpl.Name) + if updateErr := client.Update(context.TODO(), dpl); updateErr != nil { logrus.Debugf("Failed to update Elasticsearch %s status. Reason: %v. Trying again...", dpl.Name, updateErr) return updateErr } @@ -121,8 +123,8 @@ func updateStatusConditions(status *v1alpha1.ElasticsearchStatus) { } } -func clusterHealth(dpl *v1alpha1.Elasticsearch) string { - pods, err := listRunningPods(dpl.Name, dpl.Namespace) +func clusterHealth(client client.Client, dpl *v1alpha1.Elasticsearch) string { + pods, err := listRunningPods(client, dpl.Name, dpl.Namespace) if err != nil { return healthUnknown } @@ -155,13 +157,24 @@ func clusterHealth(dpl *v1alpha1.Elasticsearch) string { return health } -func rolePodStateMap(namespace string, clusterName string) map[v1alpha1.ElasticsearchNodeRole]v1alpha1.PodStateMap { - - baseSelector := fmt.Sprintf("component=%s", clusterName) - clientList, _ := GetPodList(namespace, fmt.Sprintf("%s,%s", baseSelector, "es-node-client=true")) - dataList, _ := GetPodList(namespace, fmt.Sprintf("%s,%s", baseSelector, "es-node-data=true")) - masterList, _ := GetPodList(namespace, fmt.Sprintf("%s,%s", baseSelector, "es-node-master=true")) - +func rolePodStateMap(client client.Client, namespace string, clusterName string) map[v1alpha1.ElasticsearchNodeRole]v1alpha1.PodStateMap { + + baseSelector := map[string]string{"component": clusterName} + baseSelector["es-node-client"] = "true" + // SelectorFromSet + // baseSelector := fmt.Sprintf("component=%s", clusterName) + clientList, _ := GetPodList(client, namespace, labels.SelectorFromSet(map[string]string{ + "component": clusterName, + "es-node-client": "true", + })) + dataList, _ := GetPodList(client, namespace, labels.SelectorFromSet(map[string]string{ + "component": clusterName, + "es-node-data": "true", + })) + masterList, _ := GetPodList(client, namespace, labels.SelectorFromSet(map[string]string{ + "component": clusterName, + "es-node-master": "true", + })) return map[v1alpha1.ElasticsearchNodeRole]v1alpha1.PodStateMap{ v1alpha1.ElasticsearchRoleClient: podStateMap(clientList.Items), v1alpha1.ElasticsearchRoleData: podStateMap(dataList.Items), diff --git a/pkg/k8shandler/util.go b/pkg/k8shandler/util.go index 401440cf8..b60cdc605 100644 --- a/pkg/k8shandler/util.go +++ b/pkg/k8shandler/util.go @@ -1,12 +1,12 @@ package k8shandler import ( + "context" "fmt" - api "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" - "github.com/operator-framework/operator-sdk/pkg/sdk" + "sigs.k8s.io/controller-runtime/pkg/client" - v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" + v1alpha1 "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" apps "k8s.io/api/apps/v1" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -67,10 +67,10 @@ func appendDefaultLabel(clusterName string, labels map[string]string) map[string } // asOwner returns an owner reference set as the vault cluster CR -func asOwner(v *api.Elasticsearch) metav1.OwnerReference { +func asOwner(v *v1alpha1.Elasticsearch) metav1.OwnerReference { trueVar := true return metav1.OwnerReference{ - APIVersion: api.SchemeGroupVersion.String(), + APIVersion: v1alpha1.SchemeGroupVersion.String(), Kind: v.Kind, Name: v.Name, UID: v.UID, @@ -145,11 +145,11 @@ func getResourceRequirements(commonResRequirements, nodeResRequirements v1.Resou } -func listDeployments(clusterName, namespace string) (*apps.DeploymentList, error) { +func listDeployments(cl client.Client, clusterName, namespace string) (*apps.DeploymentList, error) { list := deploymentList() - labelSelector := labels.SelectorFromSet(labelsForESCluster(clusterName)).String() - listOps := &metav1.ListOptions{LabelSelector: labelSelector} - err := sdk.List(namespace, list, sdk.WithListOptions(listOps)) + labelSelector := labels.SelectorFromSet(labelsForESCluster(clusterName)) + listOps := &client.ListOptions{Namespace: namespace, LabelSelector: labelSelector} + err := cl.List(context.TODO(), listOps, list) if err != nil { return list, fmt.Errorf("Unable to list deployments: %v", err) } @@ -157,11 +157,11 @@ func listDeployments(clusterName, namespace string) (*apps.DeploymentList, error return list, nil } -func listReplicaSets(clusterName, namespace string) (*apps.ReplicaSetList, error) { +func listReplicaSets(cl client.Client, clusterName, namespace string) (*apps.ReplicaSetList, error) { list := replicaSetList() - labelSelector := labels.SelectorFromSet(labelsForESCluster(clusterName)).String() - listOps := &metav1.ListOptions{LabelSelector: labelSelector} - err := sdk.List(namespace, list, sdk.WithListOptions(listOps)) + labelSelector := labels.SelectorFromSet(labelsForESCluster(clusterName)) + listOps := &client.ListOptions{Namespace: namespace, LabelSelector: labelSelector} + err := cl.List(context.TODO(), listOps, list) if err != nil { return list, fmt.Errorf("Unable to list ReplicaSets: %v", err) } @@ -169,11 +169,11 @@ func listReplicaSets(clusterName, namespace string) (*apps.ReplicaSetList, error return list, nil } -func listStatefulSets(clusterName, namespace string) (*apps.StatefulSetList, error) { +func listStatefulSets(cl client.Client, clusterName, namespace string) (*apps.StatefulSetList, error) { list := statefulSetList() - labelSelector := labels.SelectorFromSet(labelsForESCluster(clusterName)).String() - listOps := &metav1.ListOptions{LabelSelector: labelSelector} - err := sdk.List(namespace, list, sdk.WithListOptions(listOps)) + labelSelector := labels.SelectorFromSet(labelsForESCluster(clusterName)) + listOps := &client.ListOptions{Namespace: namespace, LabelSelector: labelSelector} + err := cl.List(context.TODO(), listOps, list) if err != nil { return list, fmt.Errorf("Unable to list StatefulSets: %v", err) } @@ -295,19 +295,19 @@ func podList() *v1.PodList { } } -func listPods(clusterName, namespace string) (*v1.PodList, error) { - podList := podList() - labelSelector := labels.SelectorFromSet(labelsForESCluster(clusterName)).String() - listOps := &metav1.ListOptions{LabelSelector: labelSelector} - err := sdk.List(namespace, podList, sdk.WithListOptions(listOps)) +func listPods(cl client.Client, clusterName, namespace string) (*v1.PodList, error) { + list := podList() + labelSelector := labels.SelectorFromSet(labelsForESCluster(clusterName)) + listOps := &client.ListOptions{Namespace: namespace, LabelSelector: labelSelector} + err := cl.List(context.TODO(), listOps, list) if err != nil { - return podList, fmt.Errorf("failed to list pods: %v", err) + return list, fmt.Errorf("failed to list pods: %v", err) } - return podList, nil + return list, nil } -func listRunningPods(clusterName, namespace string) (*v1.PodList, error) { - pods, err := listPods(clusterName, namespace) +func listRunningPods(client client.Client, clusterName, namespace string) (*v1.PodList, error) { + pods, err := listPods(client, clusterName, namespace) if err != nil { return nil, err } @@ -332,8 +332,8 @@ func listRunningPods(clusterName, namespace string) (*v1.PodList, error) { return result, nil } -func listRunningMasterPods(clusterName, namespace string) (*v1.PodList, error) { - pods, err := listRunningPods(clusterName, namespace) +func listRunningMasterPods(client client.Client, clusterName, namespace string) (*v1.PodList, error) { + pods, err := listRunningPods(client, clusterName, namespace) if err != nil { return nil, err } @@ -350,8 +350,8 @@ func listRunningMasterPods(clusterName, namespace string) (*v1.PodList, error) { return result, nil } -func getRunningMasterPod(clusterName, namespace string) (*v1.Pod, error) { - pods, err := listRunningMasterPods(clusterName, namespace) +func getRunningMasterPod(client client.Client, clusterName, namespace string) (*v1.Pod, error) { + pods, err := listRunningMasterPods(client, clusterName, namespace) if err != nil { return nil, err } @@ -481,7 +481,7 @@ func isValidConf(dpl *v1alpha1.Elasticsearch) error { return nil } -func GetPodList(namespace string, selector string) (*v1.PodList, error) { +func GetPodList(cl client.Client, namespace string, labelSelector labels.Selector) (*v1.PodList, error) { list := &v1.PodList{ TypeMeta: metav1.TypeMeta{ Kind: "Pod", @@ -489,13 +489,8 @@ func GetPodList(namespace string, selector string) (*v1.PodList, error) { }, } - err := sdk.List( - namespace, - list, - sdk.WithListOptions(&metav1.ListOptions{ - LabelSelector: selector, - }), - ) + listOps := &client.ListOptions{Namespace: namespace, LabelSelector: labelSelector} + err := cl.List(context.TODO(), listOps, list) return list, err } diff --git a/pkg/stub/handler.go b/pkg/stub/handler.go deleted file mode 100644 index d72424b70..000000000 --- a/pkg/stub/handler.go +++ /dev/null @@ -1,75 +0,0 @@ -package stub - -import ( - "context" - "fmt" - - "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" - "github.com/openshift/elasticsearch-operator/pkg/k8shandler" - "github.com/sirupsen/logrus" - - "github.com/operator-framework/operator-sdk/pkg/sdk" -) - -func NewHandler() sdk.Handler { - return &Handler{} -} - -type Handler struct { - // Fill me -} - -func (h *Handler) Handle(ctx context.Context, event sdk.Event) error { - if event.Deleted { - return nil - } - - switch o := event.Object.(type) { - case *v1alpha1.Elasticsearch: - return Reconcile(o) - } - return nil -} - -// Reconcile reconciles the cluster's state to the spec specified -func Reconcile(es *v1alpha1.Elasticsearch) (err error) { - // Ensure existence of services - logrus.Debugf("Begin Reconcile of Elasticsearch cluster %v", es.ClusterName) - err = k8shandler.CreateOrUpdateServices(es) - if err != nil { - return fmt.Errorf("Failed to reconcile Services for Elasticsearch cluster: %v", err) - } - - // Ensure existence of servicesaccount - serviceAccountName, err := k8shandler.CreateOrUpdateServiceAccount(es) - if err != nil { - return fmt.Errorf("Failed to reconcile ServiceAccount for Elasticsearch cluster: %v", err) - } - - // Ensure existence of config maps - configMapName, err := k8shandler.CreateOrUpdateConfigMaps(es) - if err != nil { - return fmt.Errorf("Failed to reconcile ConfigMaps for Elasticsearch cluster: %v", err) - } - - // Ensure existence of prometheus rules - if err = k8shandler.CreateOrUpdatePrometheusRules(es); err != nil { - return fmt.Errorf("Failed to reconcile PrometheusRules for Elasticsearch cluster: %v", err) - } - - // Ensure existence of service monitors - if err = k8shandler.CreateOrUpdateServiceMonitors(es); err != nil { - return fmt.Errorf("Failed to reconcile Service Monitors for Elasticsearch cluster: %v", err) - } - - // TODO: Ensure existence of storage? - - // Ensure Elasticsearch cluster itself is up to spec - err = k8shandler.CreateOrUpdateElasticsearchCluster(es, configMapName, serviceAccountName) - if err != nil { - return fmt.Errorf("Failed to reconcile Elasticsearch deployment spec: %v", err) - } - - logrus.Debugf("End Reconcile of Elasticsearch cluster %v", es.ClusterName) - return nil -} diff --git a/pkg/utils/exec.go b/pkg/utils/exec.go index 403bc855a..ace047bc5 100644 --- a/pkg/utils/exec.go +++ b/pkg/utils/exec.go @@ -4,9 +4,11 @@ import ( "bytes" "fmt" - "github.com/operator-framework/operator-sdk/pkg/k8sclient" + // "github.com/operator-framework/operator-sdk/pkg/k8sclient" "k8s.io/api/core/v1" + "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/remotecommand" ) @@ -22,18 +24,27 @@ type ExecConfig struct { Tty bool } -func PodExec(config *ExecConfig) (*bytes.Buffer, *bytes.Buffer, error) { +func PodExec(execConfig *ExecConfig) (*bytes.Buffer, *bytes.Buffer, error) { var ( execOut bytes.Buffer execErr bytes.Buffer ) - esPod := config.Pod + esPod := execConfig.Pod if esPod.Status.Phase != v1.PodRunning { return nil, nil, fmt.Errorf("elasticsearch pod [%s] found but isn't running", esPod.Name) } - client := k8sclient.GetKubeClient() + config, err := rest.InClusterConfig() + if err != nil { + return nil, nil, fmt.Errorf("error when creating rest client: %v", err) + } + client, err := kubernetes.NewForConfig(config) + if err != nil { + return nil, nil, fmt.Errorf("error when creating rest client: %v", err) + } + // client := k8sclient.GetKubeClient() + execRequest := client.CoreV1().RESTClient().Post(). Resource("pods"). Name(esPod.Name). @@ -41,13 +52,13 @@ func PodExec(config *ExecConfig) (*bytes.Buffer, *bytes.Buffer, error) { SubResource("exec") execRequest.VersionedParams(&v1.PodExecOptions{ - Container: config.ContainerName, - Command: config.Command, - Stdout: config.StdOut, - Stderr: config.StdErr, + Container: execConfig.ContainerName, + Command: execConfig.Command, + Stdout: execConfig.StdOut, + Stderr: execConfig.StdErr, }, scheme.ParameterCodec) - restClientConfig, err := clientcmd.BuildConfigFromFlags(config.MasterURL, config.KubeConfigPath) + restClientConfig, err := clientcmd.BuildConfigFromFlags(execConfig.MasterURL, execConfig.KubeConfigPath) if err != nil { return nil, nil, fmt.Errorf("error when creating rest client command: %v", err) } @@ -58,7 +69,7 @@ func PodExec(config *ExecConfig) (*bytes.Buffer, *bytes.Buffer, error) { err = exec.Stream(remotecommand.StreamOptions{ Stdout: &execOut, Stderr: &execErr, - Tty: config.Tty, + Tty: execConfig.Tty, }) if err != nil { return nil, nil, fmt.Errorf("remote execution failed: %v", err) diff --git a/pkg/utils/exec_util.go b/pkg/utils/exec_util.go index a4a47386a..4345d7cb5 100644 --- a/pkg/utils/exec_util.go +++ b/pkg/utils/exec_util.go @@ -6,7 +6,7 @@ import ( "fmt" "strconv" - "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" + "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "github.com/sirupsen/logrus" "k8s.io/api/core/v1" ) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 9628a6044..be7098d83 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -1,15 +1,17 @@ package utils import ( + "context" "io/ioutil" "os" - api "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" - "github.com/operator-framework/operator-sdk/pkg/sdk" + api "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" "github.com/sirupsen/logrus" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/retry" + "sigs.k8s.io/controller-runtime/pkg/client" ) func GetFileContents(filePath string) []byte { @@ -81,17 +83,17 @@ func UpdateESNodeCondition(status *api.ElasticsearchStatus, condition *api.Clust return !isEqual } -func UpdateConditionWithRetry(dpl *api.Elasticsearch, value api.ConditionStatus, +func UpdateConditionWithRetry(client client.Client, dpl *api.Elasticsearch, value api.ConditionStatus, executeUpdateCondition func(*api.ElasticsearchStatus, api.ConditionStatus) bool) error { retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error { - if getErr := sdk.Get(dpl); getErr != nil { + if getErr := client.Get(context.TODO(), types.NamespacedName{Name: dpl.Name, Namespace: dpl.Namespace}, dpl); getErr != nil { logrus.Debugf("Could not get Elasticsearch %v: %v", dpl.Name, getErr) return getErr } executeUpdateCondition(&dpl.Status, value) - if updateErr := sdk.Update(dpl); updateErr != nil { + if updateErr := client.Update(context.TODO(), dpl); updateErr != nil { logrus.Debugf("Failed to update Elasticsearch %v status: %v", dpl.Name, updateErr) return updateErr } @@ -168,9 +170,9 @@ func IsRestarting(status *api.ElasticsearchStatus) bool { return false } -func UpdateNodeUpgradeStatusWithRetry(dpl *api.Elasticsearch, deployName string, value *api.ElasticsearchNodeUpgradeStatus) error { +func UpdateNodeUpgradeStatusWithRetry(client client.Client, dpl *api.Elasticsearch, deployName string, value *api.ElasticsearchNodeUpgradeStatus) error { retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error { - if getErr := sdk.Get(dpl); getErr != nil { + if getErr := client.Get(context.TODO(), types.NamespacedName{Name: dpl.Name, Namespace: dpl.Namespace}, dpl); getErr != nil { logrus.Debugf("Could not get Elasticsearch %v: %v", dpl.Name, getErr) return getErr } @@ -181,7 +183,7 @@ func UpdateNodeUpgradeStatusWithRetry(dpl *api.Elasticsearch, deployName string, } } - if updateErr := sdk.Update(dpl); updateErr != nil { + if updateErr := client.Update(context.TODO(), dpl); updateErr != nil { logrus.Debugf("Failed to update Elasticsearch %v status: %v", dpl.Name, updateErr) return updateErr } diff --git a/test/e2e/elasticsearch_test.go b/test/e2e/elasticsearch_test.go index 3cfaff81b..c64fc8186 100644 --- a/test/e2e/elasticsearch_test.go +++ b/test/e2e/elasticsearch_test.go @@ -12,7 +12,8 @@ import ( "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/types" - elasticsearch "github.com/openshift/elasticsearch-operator/pkg/apis/elasticsearch/v1alpha1" + "github.com/openshift/elasticsearch-operator/pkg/apis" + elasticsearch "github.com/openshift/elasticsearch-operator/pkg/apis/logging/v1alpha1" framework "github.com/operator-framework/operator-sdk/pkg/test" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -25,16 +26,26 @@ var ( ) func TestElasticsearch(t *testing.T) { + // get global framework variables + ctx := framework.NewTestCtx(t) + defer ctx.Cleanup() + elasticsearchList := &elasticsearch.ElasticsearchList{ TypeMeta: metav1.TypeMeta{ Kind: "Elasticsearch", APIVersion: elasticsearch.SchemeGroupVersion.String(), }, } - err := framework.AddToFrameworkScheme(elasticsearch.AddToScheme, elasticsearchList) + err := framework.AddToFrameworkScheme(apis.AddToScheme, elasticsearchList) if err != nil { t.Fatalf("failed to add custom resource scheme to framework: %v", err) } + + err = ctx.InitializeClusterResources(&framework.CleanupOptions{TestContext: ctx, Timeout: cleanupTimeout, RetryInterval: cleanupRetryInterval}) + if err != nil { + t.Fatal(err) + } + // run subtests t.Run("elasticsearch-group", func(t *testing.T) { t.Run("Cluster", ElasticsearchCluster) @@ -202,13 +213,13 @@ func elasticsearchFullClusterTest(t *testing.T, f *framework.Framework, ctx *fra } func ElasticsearchCluster(t *testing.T) { - t.Parallel() + // t.Parallel() ctx := framework.NewTestCtx(t) defer ctx.Cleanup() - err := ctx.InitializeClusterResources(&framework.CleanupOptions{TestContext: ctx, Timeout: cleanupTimeout, RetryInterval: cleanupRetryInterval}) - if err != nil { - t.Fatalf("failed to initialize cluster resources: %v", err) - } + // err := ctx.InitializeClusterResources(&framework.CleanupOptions{TestContext: ctx, Timeout: cleanupTimeout, RetryInterval: cleanupRetryInterval}) + // if err != nil { + // t.Fatalf("failed to initialize cluster resources: %v", err) + // } t.Log("Initialized cluster resources") namespace, err := ctx.GetNamespace() if err != nil { diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index e8df1719d..35d5c41e9 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -1,8 +1,9 @@ package e2e import ( - framework "github.com/operator-framework/operator-sdk/pkg/test" "testing" + + framework "github.com/operator-framework/operator-sdk/pkg/test" ) func TestMain(m *testing.M) { diff --git a/vendor/cloud.google.com/go/AUTHORS b/vendor/cloud.google.com/go/AUTHORS new file mode 100644 index 000000000..c364af1da --- /dev/null +++ b/vendor/cloud.google.com/go/AUTHORS @@ -0,0 +1,15 @@ +# This is the official list of cloud authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS files. +# See the latter for an explanation. + +# Names should be added to this file as: +# Name or Organization +# The email address is not required for organizations. + +Filippo Valsorda +Google Inc. +Ingo Oeser +Palm Stone Games, Inc. +Paweł Knap +Péter Szilágyi +Tyler Treat diff --git a/vendor/cloud.google.com/go/CHANGES.md b/vendor/cloud.google.com/go/CHANGES.md new file mode 100644 index 000000000..bec57e0a7 --- /dev/null +++ b/vendor/cloud.google.com/go/CHANGES.md @@ -0,0 +1,1024 @@ +# Changes + +## 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/GoogleCloudPlatform/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 000000000..8fd1bc9c2 --- /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 000000000..eef41ed0f --- /dev/null +++ b/vendor/cloud.google.com/go/CONTRIBUTING.md @@ -0,0 +1,234 @@ +# Contributing + +1. Sign one of the contributor license agreements below. +1. `go get golang.org/x/review/git-codereview` to install the code reviewing +tool. + 1. You will need to ensure that your `GOBIN` directory (by default + `$GOPATH/bin`) is in your `PATH` so that git can find the command. + 1. If you would like, you may want to set up aliases for git-codereview, + such that `git codereview change` becomes `git change`. See the + [godoc](https://godoc.org/golang.org/x/review/git-codereview) for details. + 1. Should you run into issues with the git-codereview tool, please note + that all error messages will assume that you have set up these aliases. +1. Get the cloud package by running `go get -d cloud.google.com/go`. + 1. If you have already checked out the source, make sure that the remote + git origin is https://code.googlesource.com/gocloud: + + ``` + git remote set-url origin https://code.googlesource.com/gocloud + ``` + +1. Make sure your auth is configured correctly by visiting +https://code.googlesource.com, clicking "Generate Password", and following the +directions. +1. Make changes and create a change by running `git codereview change `, +provide a commit message, and use `git codereview mail` to create a Gerrit CL. +1. Keep amending to the change with `git codereview change` and mail as your +receive feedback. Each new mailed amendment will create a new patch set for +your change in Gerrit. + +## Integration Tests + +In addition to the unit tests, you may run the integration test suite. 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 create-indexes 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/CONTRIBUTORS b/vendor/cloud.google.com/go/CONTRIBUTORS new file mode 100644 index 000000000..3b3cbed98 --- /dev/null +++ b/vendor/cloud.google.com/go/CONTRIBUTORS @@ -0,0 +1,40 @@ +# People who have agreed to one of the CLAs and can contribute patches. +# The AUTHORS file lists the copyright holders; this file +# lists people. For example, Google employees are listed here +# but not in AUTHORS, because Google holds the copyright. +# +# https://developers.google.com/open-source/cla/individual +# https://developers.google.com/open-source/cla/corporate +# +# Names should be added to this file as: +# Name + +# Keep the list alphabetically sorted. + +Alexis Hunt +Andreas Litt +Andrew Gerrand +Brad Fitzpatrick +Burcu Dogan +Dave Day +David Sansome +David Symonds +Filippo Valsorda +Glenn Lewis +Ingo Oeser +James Hall +Johan Euphrosine +Jonathan Amsterdam +Kunpei Sakai +Luna Duclos +Magnus Hiie +Mario Castro +Michael McGreevy +Omar Jarjur +Paweł Knap +Péter Szilágyi +Sarah Adams +Thanatat Tamtan +Toby Burress +Tuo Shan +Tyler Treat diff --git a/vendor/cloud.google.com/go/LICENSE b/vendor/cloud.google.com/go/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/vendor/cloud.google.com/go/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/cloud.google.com/go/README.md b/vendor/cloud.google.com/go/README.md new file mode 100644 index 000000000..1c8c16046 --- /dev/null +++ b/vendor/cloud.google.com/go/README.md @@ -0,0 +1,505 @@ +# 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). + + * [News](#news) + * [Supported APIs](#supported-apis) + * [Go Versions Supported](#go-versions-supported) + * [Authorization](#authorization) + * [Cloud Datastore](#cloud-datastore-) + * [Cloud Storage](#cloud-storage-) + * [Cloud Pub/Sub](#cloud-pub-sub-) + * [BigQuery](#cloud-bigquery-) + * [Stackdriver Logging](#stackdriver-logging-) + * [Cloud Spanner](#cloud-spanner-) + + +## News + +_7 August 2018_ + +As of November 1, the code in the repo will no longer support Go versions 1.8 +and earlier. No one other than AppEngine users should be on those old versions, +and AppEngine +[Standard](https://groups.google.com/forum/#!topic/google-appengine-go/e7oPNomd7ak) +and +[Flex](https://groups.google.com/forum/#!topic/google-appengine-go/wHsYtxvEbXI) +will stop supporting new deployments with those versions on that date. + + +Changes have been moved to [CHANGES](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CHANGES.md). + + +## Supported APIs + +Google API | Status | Package +---------------------------------------------|--------------|----------------------------------------------------------- +[Asset][cloud-asset] | alpha | [`godoc.org/cloud.google.com/go/asset/v1beta`][cloud-asset-ref] +[BigQuery][cloud-bigquery] | stable | [`godoc.org/cloud.google.com/go/bigquery`][cloud-bigquery-ref] +[Bigtable][cloud-bigtable] | stable | [`godoc.org/cloud.google.com/go/bigtable`][cloud-bigtable-ref] +[Cloudtasks][cloud-tasks] | beta | [`godoc.org/cloud.google.com/go/cloudtasks/apiv2beta3`][cloud-tasks-ref] +[Container][cloud-container] | stable | [`godoc.org/cloud.google.com/go/container/apiv1`][cloud-container-ref] +[ContainerAnalysis][cloud-containeranalysis] | beta | [`godoc.org/cloud.google.com/go/containeranalysis/apiv1beta1`][cloud-containeranalysis-ref] +[Dataproc][cloud-dataproc] | stable | [`godoc.org/cloud.google.com/go/dataproc/apiv1`][cloud-dataproc-ref] +[Datastore][cloud-datastore] | stable | [`godoc.org/cloud.google.com/go/datastore`][cloud-datastore-ref] +[Debugger][cloud-debugger] | alpha | [`godoc.org/cloud.google.com/go/debugger/apiv2`][cloud-debugger-ref] +[Dialogflow][cloud-dialogflow] | alpha | [`godoc.org/cloud.google.com/go/dialogflow/apiv2`][cloud-dialogflow-ref] +[Data Loss Prevention][cloud-dlp] | alpha | [`godoc.org/cloud.google.com/go/dlp/apiv2`][cloud-dlp-ref] +[ErrorReporting][cloud-errors] | alpha | [`godoc.org/cloud.google.com/go/errorreporting`][cloud-errors-ref] +[Firestore][cloud-firestore] | beta | [`godoc.org/cloud.google.com/go/firestore`][cloud-firestore-ref] +[IAM][cloud-iam] | stable | [`godoc.org/cloud.google.com/go/iam`][cloud-iam-ref] +[KMS][cloud-kms] | stable | [`godoc.org/cloud.google.com/go/kms`][cloud-kms-ref] +[Natural Language][cloud-natural-language] | stable | [`godoc.org/cloud.google.com/go/language/apiv1`][cloud-natural-language-ref] +[Logging][cloud-logging] | stable | [`godoc.org/cloud.google.com/go/logging`][cloud-logging-ref] +[Monitoring][cloud-monitoring] | alpha | [`godoc.org/cloud.google.com/go/monitoring/apiv3`][cloud-monitoring-ref] +[OS Login][cloud-oslogin] | alpha | [`cloud.google.com/compute/docs/oslogin/rest`][cloud-oslogin-ref] +[Pub/Sub][cloud-pubsub] | stable | [`godoc.org/cloud.google.com/go/pubsub`][cloud-pubsub-ref] +[Memorystore][cloud-memorystore] | stable | [`godoc.org/cloud.google.com/go/redis/apiv1beta1`][cloud-memorystore-ref] +[Spanner][cloud-spanner] | stable | [`godoc.org/cloud.google.com/go/spanner`][cloud-spanner-ref] +[Speech][cloud-speech] | stable | [`godoc.org/cloud.google.com/go/speech/apiv1`][cloud-speech-ref] +[Storage][cloud-storage] | stable | [`godoc.org/cloud.google.com/go/storage`][cloud-storage-ref] +[Text To Speech][cloud-texttospeech] | alpha | [`godoc.org/cloud.google.com/go/texttospeech/apiv1`][cloud-storage-ref] +[Trace][cloud-trace] | alpha | [`godoc.org/cloud.google.com/go/trace/apiv2`][cloud-translation-ref] +[Translation][cloud-translation] | stable | [`godoc.org/cloud.google.com/go/translate`][cloud-translation-ref] +[Video Intelligence][cloud-video] | alpha | [`godoc.org/cloud.google.com/go/videointelligence/apiv1beta1`][cloud-video-ref] +[Vision][cloud-vision] | stable | [`godoc.org/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 +https://godoc.org/cloud.google.com/go + +Visit or join the +[google-api-go-announce group](https://groups.google.com/forum/#!forum/google-api-go-announce) +for updates on these packages. + +## Go Versions Supported + +We support the two most recent major versions of Go. If Google App Engine uses +an older version, we support that as well. + +## Authorization + +By default, each API will use [Google Application Default Credentials][default-creds] +for authorization credentials used in calling the API endpoints. This will allow your +application to run in many environments without requiring explicit configuration. + +[snip]:# (auth) +```go +client, err := storage.NewClient(ctx) +``` + +To authorize using a +[JSON key file](https://cloud.google.com/iam/docs/managing-service-account-keys), +pass +[`option.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)) +``` + +## Cloud Datastore [![GoDoc](https://godoc.org/cloud.google.com/go/datastore?status.svg)](https://godoc.org/cloud.google.com/go/datastore) + +- [About Cloud Datastore][cloud-datastore] +- [Activating the API for your project][cloud-datastore-activation] +- [API documentation][cloud-datastore-docs] +- [Go client documentation](https://godoc.org/cloud.google.com/go/datastore) +- [Complete sample program](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/datastore/tasks) + +### Example Usage + +First create a `datastore.Client` to use throughout your application: + +[snip]:# (datastore-1) +```go +client, err := datastore.NewClient(ctx, "my-project-id") +if err != nil { + log.Fatal(err) +} +``` + +Then use that client to interact with the API: + +[snip]:# (datastore-2) +```go +type Post struct { + Title string + Body string `datastore:",noindex"` + PublishedAt time.Time +} +keys := []*datastore.Key{ + datastore.NameKey("Post", "post1", nil), + datastore.NameKey("Post", "post2", nil), +} +posts := []*Post{ + {Title: "Post 1", Body: "...", PublishedAt: time.Now()}, + {Title: "Post 2", Body: "...", PublishedAt: time.Now()}, +} +if _, err := client.PutMulti(ctx, keys, posts); err != nil { + log.Fatal(err) +} +``` + +## Cloud Storage [![GoDoc](https://godoc.org/cloud.google.com/go/storage?status.svg)](https://godoc.org/cloud.google.com/go/storage) + +- [About Cloud Storage][cloud-storage] +- [API documentation][cloud-storage-docs] +- [Go client documentation](https://godoc.org/cloud.google.com/go/storage) +- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/storage) + +### Example Usage + +First create a `storage.Client` to use throughout your application: + +[snip]:# (storage-1) +```go +client, err := storage.NewClient(ctx) +if err != nil { + log.Fatal(err) +} +``` + +[snip]:# (storage-2) +```go +// Read the object1 from bucket. +rc, err := client.Bucket("bucket").Object("object1").NewReader(ctx) +if err != nil { + log.Fatal(err) +} +defer rc.Close() +body, err := ioutil.ReadAll(rc) +if err != nil { + log.Fatal(err) +} +``` + +## Cloud Pub/Sub [![GoDoc](https://godoc.org/cloud.google.com/go/pubsub?status.svg)](https://godoc.org/cloud.google.com/go/pubsub) + +- [About Cloud Pubsub][cloud-pubsub] +- [API documentation][cloud-pubsub-docs] +- [Go client documentation](https://godoc.org/cloud.google.com/go/pubsub) +- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/pubsub) + +### Example Usage + +First create a `pubsub.Client` to use throughout your application: + +[snip]:# (pubsub-1) +```go +client, err := pubsub.NewClient(ctx, "project-id") +if err != nil { + log.Fatal(err) +} +``` + +Then use the client to publish and subscribe: + +[snip]:# (pubsub-2) +```go +// Publish "hello world" on topic1. +topic := client.Topic("topic1") +res := topic.Publish(ctx, &pubsub.Message{ + Data: []byte("hello world"), +}) +// The publish happens asynchronously. +// Later, you can get the result from res: +... +msgID, err := res.Get(ctx) +if err != nil { + log.Fatal(err) +} + +// Use a callback to receive messages via subscription1. +sub := client.Subscription("subscription1") +err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) { + fmt.Println(m.Data) + m.Ack() // Acknowledge that we've consumed the message. +}) +if err != nil { + log.Println(err) +} +``` + +## BigQuery [![GoDoc](https://godoc.org/cloud.google.com/go/bigquery?status.svg)](https://godoc.org/cloud.google.com/go/bigquery) + +- [About BigQuery][cloud-bigquery] +- [API documentation][cloud-bigquery-docs] +- [Go client documentation][cloud-bigquery-ref] +- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/bigquery) + +### Example Usage + +First create a `bigquery.Client` to use throughout your application: +[snip]:# (bq-1) +```go +c, err := bigquery.NewClient(ctx, "my-project-ID") +if err != nil { + // TODO: Handle error. +} +``` + +Then use that client to interact with the API: +[snip]:# (bq-2) +```go +// Construct a query. +q := c.Query(` + SELECT year, SUM(number) + FROM [bigquery-public-data:usa_names.usa_1910_2013] + WHERE name = "William" + GROUP BY year + ORDER BY year +`) +// Execute the query. +it, err := q.Read(ctx) +if err != nil { + // TODO: Handle error. +} +// Iterate through the results. +for { + var values []bigquery.Value + err := it.Next(&values) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(values) +} +``` + + +## Stackdriver Logging [![GoDoc](https://godoc.org/cloud.google.com/go/logging?status.svg)](https://godoc.org/cloud.google.com/go/logging) + +- [About Stackdriver Logging][cloud-logging] +- [API documentation][cloud-logging-docs] +- [Go client documentation][cloud-logging-ref] +- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/logging) + +### Example Usage + +First create a `logging.Client` to use throughout your application: +[snip]:# (logging-1) +```go +ctx := context.Background() +client, err := logging.NewClient(ctx, "my-project") +if err != nil { + // TODO: Handle error. +} +``` + +Usually, you'll want to add log entries to a buffer to be periodically flushed +(automatically and asynchronously) to the Stackdriver Logging service. +[snip]:# (logging-2) +```go +logger := client.Logger("my-log") +logger.Log(logging.Entry{Payload: "something happened!"}) +``` + +Close your client before your program exits, to flush any buffered log entries. +[snip]:# (logging-3) +```go +err = client.Close() +if err != nil { + // TODO: Handle error. +} +``` + +## Cloud Spanner [![GoDoc](https://godoc.org/cloud.google.com/go/spanner?status.svg)](https://godoc.org/cloud.google.com/go/spanner) + +- [About Cloud Spanner][cloud-spanner] +- [API documentation][cloud-spanner-docs] +- [Go client documentation](https://godoc.org/cloud.google.com/go/spanner) + +### Example Usage + +First create a `spanner.Client` to use throughout your application: + +[snip]:# (spanner-1) +```go +client, err := spanner.NewClient(ctx, "projects/P/instances/I/databases/D") +if err != nil { + log.Fatal(err) +} +``` + +[snip]:# (spanner-2) +```go +// Simple Reads And Writes +_, err = client.Apply(ctx, []*spanner.Mutation{ + spanner.Insert("Users", + []string{"name", "email"}, + []interface{}{"alice", "a@example.com"})}) +if err != nil { + log.Fatal(err) +} +row, err := client.Single().ReadRow(ctx, "Users", + spanner.Key{"alice"}, []string{"email"}) +if err != nil { + log.Fatal(err) +} +``` + + +## Contributing + +Contributions are welcome. Please, see the +[CONTRIBUTING](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CONTRIBUTING.md) +document for details. We're using Gerrit for our code reviews. Please don't open pull +requests against this repo, new pull requests will be automatically closed. + +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +See [Contributor Code of Conduct](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CONTRIBUTING.md#contributor-code-of-conduct) +for more information. + +[cloud-datastore]: https://cloud.google.com/datastore/ +[cloud-datastore-ref]: https://godoc.org/cloud.google.com/go/datastore +[cloud-datastore-docs]: https://cloud.google.com/datastore/docs +[cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate + +[cloud-firestore]: https://cloud.google.com/firestore/ +[cloud-firestore-ref]: https://godoc.org/cloud.google.com/go/firestore +[cloud-firestore-docs]: https://cloud.google.com/firestore/docs +[cloud-firestore-activation]: https://cloud.google.com/firestore/docs/activate + +[cloud-pubsub]: https://cloud.google.com/pubsub/ +[cloud-pubsub-ref]: https://godoc.org/cloud.google.com/go/pubsub +[cloud-pubsub-docs]: https://cloud.google.com/pubsub/docs + +[cloud-storage]: https://cloud.google.com/storage/ +[cloud-storage-ref]: https://godoc.org/cloud.google.com/go/storage +[cloud-storage-docs]: https://cloud.google.com/storage/docs +[cloud-storage-create-bucket]: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets + +[cloud-bigtable]: https://cloud.google.com/bigtable/ +[cloud-bigtable-ref]: https://godoc.org/cloud.google.com/go/bigtable + +[cloud-bigquery]: https://cloud.google.com/bigquery/ +[cloud-bigquery-docs]: https://cloud.google.com/bigquery/docs +[cloud-bigquery-ref]: https://godoc.org/cloud.google.com/go/bigquery + +[cloud-logging]: https://cloud.google.com/logging/ +[cloud-logging-docs]: https://cloud.google.com/logging/docs +[cloud-logging-ref]: https://godoc.org/cloud.google.com/go/logging + +[cloud-monitoring]: https://cloud.google.com/monitoring/ +[cloud-monitoring-ref]: https://godoc.org/cloud.google.com/go/monitoring/apiv3 + +[cloud-vision]: https://cloud.google.com/vision +[cloud-vision-ref]: https://godoc.org/cloud.google.com/go/vision/apiv1 + +[cloud-language]: https://cloud.google.com/natural-language +[cloud-language-ref]: https://godoc.org/cloud.google.com/go/language/apiv1 + +[cloud-oslogin]: https://cloud.google.com/compute/docs/oslogin/rest +[cloud-oslogin-ref]: https://cloud.google.com/compute/docs/oslogin/rest + +[cloud-speech]: https://cloud.google.com/speech +[cloud-speech-ref]: https://godoc.org/cloud.google.com/go/speech/apiv1 + +[cloud-spanner]: https://cloud.google.com/spanner/ +[cloud-spanner-ref]: https://godoc.org/cloud.google.com/go/spanner +[cloud-spanner-docs]: https://cloud.google.com/spanner/docs + +[cloud-translation]: https://cloud.google.com/translation +[cloud-translation-ref]: https://godoc.org/cloud.google.com/go/translation + +[cloud-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 + +[default-creds]: https://developers.google.com/identity/protocols/application-default-credentials + +[cloud-dataproc]: https://cloud.google.com/dataproc/ +[cloud-dataproc-docs]: https://cloud.google.com/dataproc/docs +[cloud-dataproc-ref]: https://godoc.org/cloud.google.com/go/dataproc/apiv1 + +[cloud-iam]: https://cloud.google.com/iam/ +[cloud-iam-docs]: https://cloud.google.com/iam/docs +[cloud-iam-ref]: https://godoc.org/cloud.google.com/go/iam + +[cloud-kms]: https://cloud.google.com/kms/ +[cloud-kms-docs]: https://cloud.google.com/kms/docs +[cloud-kms-ref]: https://godoc.org/cloud.google.com/go/kms/apiv1 + +[cloud-natural-language]: https://cloud.google.com/natural-language/ +[cloud-natural-language-docs]: https://cloud.google.com/natural-language/docs +[cloud-natural-language-ref]: https://godoc.org/cloud.google.com/go/language/apiv1 + +[cloud-memorystore]: https://cloud.google.com/memorystore/ +[cloud-memorystore-docs]: https://cloud.google.com/memorystore/docs +[cloud-memorystore-ref]: https://godoc.org/cloud.google.com/go/redis/apiv1beta1 + +[cloud-texttospeech]: https://cloud.google.com/texttospeech/ +[cloud-texttospeech-docs]: https://cloud.google.com/texttospeech/docs +[cloud-texttospeech-ref]: https://godoc.org/cloud.google.com/go/texttospeech/apiv1 + +[cloud-trace]: https://cloud.google.com/trace/ +[cloud-trace-docs]: https://cloud.google.com/trace/docs +[cloud-trace-ref]: https://godoc.org/cloud.google.com/go/trace/apiv1 + +[cloud-dialogflow]: https://cloud.google.com/dialogflow-enterprise/ +[cloud-dialogflow-docs]: https://cloud.google.com/dialogflow-enterprise/docs/ +[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-docs]: https://cloud.google.com/container-analysis/api/reference/rest/ +[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-docs]: 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/apiv2beta3 diff --git a/vendor/cloud.google.com/go/RELEASING.md b/vendor/cloud.google.com/go/RELEASING.md new file mode 100644 index 000000000..1028a261a --- /dev/null +++ b/vendor/cloud.google.com/go/RELEASING.md @@ -0,0 +1,47 @@ +# How to Create a New Release + +## Prerequisites + +Install [releasetool](https://github.com/googleapis/releasetool). + +## Create a release + +1. `cd` into the root directory, e.g., `~/go/src/cloud.google.com/go` +1. Checkout the master branch and ensure a clean and up-to-date state. + ``` + git checkout master + git pull --tags origin master + ``` +1. Run releasetool to generate a changelog from the last version. Note, + releasetool will prompt if the new version is a major, minor, or patch + version. + ``` + releasetool start --language go + ``` +1. Format the output to match CHANGES.md. +1. Submit a CL with the changes in CHANGES.md. The commit message should look + like this (where `v0.31.0` is instead the correct version number): + ``` + all: Release v0.31.0 + ``` +1. Wait for approval from all reviewers and then submit the CL. +1. Return to the master branch and pull the release commit. + ``` + git checkout master + git pull origin master + ``` +1. Tag the current commit with the new version (e.g., `v0.31.0`) + ``` + releasetool tag --language go + ``` +1. Publish the tag to GoogleSource (i.e., origin): + ``` + git push origin $NEW_VERSION + ``` +1. Visit the [releases page][releases] on GitHub and click the "Draft a new + release" button. For tag version, enter the tag published in the previous + step. For the release title, use the version (e.g., `v0.31.0`). For the + description, copy the changes added to CHANGES.md. + + +[releases]: https://github.com/GoogleCloudPlatform/google-cloud-go/releases diff --git a/vendor/cloud.google.com/go/asset/apiv1beta1/asset_client.go b/vendor/cloud.google.com/go/asset/apiv1beta1/asset_client.go new file mode 100644 index 000000000..4ff3bdb34 --- /dev/null +++ b/vendor/cloud.google.com/go/asset/apiv1beta1/asset_client.go @@ -0,0 +1,248 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package asset + +import ( + "context" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + ExportAssets []gax.CallOption + BatchGetAssetsHistory []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cloudasset.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + ExportAssets: retry[[2]string{"default", "non_idempotent"}], + BatchGetAssetsHistory: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Cloud Asset API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client assetpb.AssetServiceClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new asset service client. +// +// Asset service definition. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: assetpb.NewAssetServiceClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ExportAssets exports assets with time and resource types to a given Cloud Storage +// location. The output format is newline-delimited JSON. +// This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you +// to keep track of the export. +func (c *Client) ExportAssets(ctx context.Context, req *assetpb.ExportAssetsRequest, opts ...gax.CallOption) (*ExportAssetsOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ExportAssets[0:len(c.CallOptions.ExportAssets):len(c.CallOptions.ExportAssets)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ExportAssets(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ExportAssetsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// BatchGetAssetsHistory batch gets the update history of assets that overlap a time window. +// For RESOURCE content, this API outputs history with asset in both +// non-delete or deleted status. +// For IAM_POLICY content, this API outputs history when the asset and its +// attached IAM POLICY both exist. This can create gaps in the output history. +func (c *Client) BatchGetAssetsHistory(ctx context.Context, req *assetpb.BatchGetAssetsHistoryRequest, opts ...gax.CallOption) (*assetpb.BatchGetAssetsHistoryResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchGetAssetsHistory[0:len(c.CallOptions.BatchGetAssetsHistory):len(c.CallOptions.BatchGetAssetsHistory)], opts...) + var resp *assetpb.BatchGetAssetsHistoryResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.BatchGetAssetsHistory(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ExportAssetsOperation manages a long-running operation from ExportAssets. +type ExportAssetsOperation struct { + lro *longrunning.Operation +} + +// ExportAssetsOperation returns a new ExportAssetsOperation from a given name. +// The name must be that of a previously created ExportAssetsOperation, possibly from a different process. +func (c *Client) ExportAssetsOperation(name string) *ExportAssetsOperation { + return &ExportAssetsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *ExportAssetsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*assetpb.ExportAssetsResponse, error) { + var resp assetpb.ExportAssetsResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 5000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *ExportAssetsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*assetpb.ExportAssetsResponse, error) { + var resp assetpb.ExportAssetsResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *ExportAssetsOperation) Metadata() (*assetpb.ExportAssetsRequest, error) { + var meta assetpb.ExportAssetsRequest + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *ExportAssetsOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *ExportAssetsOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/asset/apiv1beta1/asset_client_example_test.go b/vendor/cloud.google.com/go/asset/apiv1beta1/asset_client_example_test.go new file mode 100644 index 000000000..bc2bd0d11 --- /dev/null +++ b/vendor/cloud.google.com/go/asset/apiv1beta1/asset_client_example_test.go @@ -0,0 +1,75 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package asset_test + +import ( + "context" + + asset "cloud.google.com/go/asset/apiv1beta1" + assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := asset.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_ExportAssets() { + ctx := context.Background() + c, err := asset.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &assetpb.ExportAssetsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ExportAssets(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_BatchGetAssetsHistory() { + ctx := context.Background() + c, err := asset.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &assetpb.BatchGetAssetsHistoryRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BatchGetAssetsHistory(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/asset/apiv1beta1/doc.go b/vendor/cloud.google.com/go/asset/apiv1beta1/doc.go new file mode 100644 index 000000000..7ba09affb --- /dev/null +++ b/vendor/cloud.google.com/go/asset/apiv1beta1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package asset is an auto-generated package for the +// Cloud Asset API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// The cloud asset API manages the history and inventory of cloud resources. +package asset // import "cloud.google.com/go/asset/apiv1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/asset/apiv1beta1/mock_test.go b/vendor/cloud.google.com/go/asset/apiv1beta1/mock_test.go new file mode 100644 index 000000000..7e11118cf --- /dev/null +++ b/vendor/cloud.google.com/go/asset/apiv1beta1/mock_test.go @@ -0,0 +1,266 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package asset + +import ( + assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockAssetServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + assetpb.AssetServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockAssetServer) ExportAssets(ctx context.Context, req *assetpb.ExportAssetsRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockAssetServer) BatchGetAssetsHistory(ctx context.Context, req *assetpb.BatchGetAssetsHistoryRequest) (*assetpb.BatchGetAssetsHistoryResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*assetpb.BatchGetAssetsHistoryResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockAsset mockAssetServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + assetpb.RegisterAssetServiceServer(serv, &mockAsset) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestAssetServiceExportAssets(t *testing.T) { + var expectedResponse *assetpb.ExportAssetsResponse = &assetpb.ExportAssetsResponse{} + + mockAsset.err = nil + mockAsset.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockAsset.resps = append(mockAsset.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var outputConfig *assetpb.OutputConfig = &assetpb.OutputConfig{} + var request = &assetpb.ExportAssetsRequest{ + Parent: formattedParent, + OutputConfig: outputConfig, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ExportAssets(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAsset.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAssetServiceExportAssetsError(t *testing.T) { + errCode := codes.PermissionDenied + mockAsset.err = nil + mockAsset.resps = append(mockAsset.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var outputConfig *assetpb.OutputConfig = &assetpb.OutputConfig{} + var request = &assetpb.ExportAssetsRequest{ + Parent: formattedParent, + OutputConfig: outputConfig, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ExportAssets(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestAssetServiceBatchGetAssetsHistory(t *testing.T) { + var expectedResponse *assetpb.BatchGetAssetsHistoryResponse = &assetpb.BatchGetAssetsHistoryResponse{} + + mockAsset.err = nil + mockAsset.reqs = nil + + mockAsset.resps = append(mockAsset.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var contentType assetpb.ContentType = assetpb.ContentType_CONTENT_TYPE_UNSPECIFIED + var readTimeWindow *assetpb.TimeWindow = &assetpb.TimeWindow{} + var request = &assetpb.BatchGetAssetsHistoryRequest{ + Parent: formattedParent, + ContentType: contentType, + ReadTimeWindow: readTimeWindow, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchGetAssetsHistory(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAsset.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAssetServiceBatchGetAssetsHistoryError(t *testing.T) { + errCode := codes.PermissionDenied + mockAsset.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var contentType assetpb.ContentType = assetpb.ContentType_CONTENT_TYPE_UNSPECIFIED + var readTimeWindow *assetpb.TimeWindow = &assetpb.TimeWindow{} + var request = &assetpb.BatchGetAssetsHistoryRequest{ + Parent: formattedParent, + ContentType: contentType, + ReadTimeWindow: readTimeWindow, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchGetAssetsHistory(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/asset/v1beta1/asset_client.go b/vendor/cloud.google.com/go/asset/v1beta1/asset_client.go new file mode 100644 index 000000000..4ff3bdb34 --- /dev/null +++ b/vendor/cloud.google.com/go/asset/v1beta1/asset_client.go @@ -0,0 +1,248 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package asset + +import ( + "context" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + ExportAssets []gax.CallOption + BatchGetAssetsHistory []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cloudasset.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + ExportAssets: retry[[2]string{"default", "non_idempotent"}], + BatchGetAssetsHistory: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Cloud Asset API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client assetpb.AssetServiceClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new asset service client. +// +// Asset service definition. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: assetpb.NewAssetServiceClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ExportAssets exports assets with time and resource types to a given Cloud Storage +// location. The output format is newline-delimited JSON. +// This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you +// to keep track of the export. +func (c *Client) ExportAssets(ctx context.Context, req *assetpb.ExportAssetsRequest, opts ...gax.CallOption) (*ExportAssetsOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ExportAssets[0:len(c.CallOptions.ExportAssets):len(c.CallOptions.ExportAssets)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ExportAssets(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ExportAssetsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// BatchGetAssetsHistory batch gets the update history of assets that overlap a time window. +// For RESOURCE content, this API outputs history with asset in both +// non-delete or deleted status. +// For IAM_POLICY content, this API outputs history when the asset and its +// attached IAM POLICY both exist. This can create gaps in the output history. +func (c *Client) BatchGetAssetsHistory(ctx context.Context, req *assetpb.BatchGetAssetsHistoryRequest, opts ...gax.CallOption) (*assetpb.BatchGetAssetsHistoryResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchGetAssetsHistory[0:len(c.CallOptions.BatchGetAssetsHistory):len(c.CallOptions.BatchGetAssetsHistory)], opts...) + var resp *assetpb.BatchGetAssetsHistoryResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.BatchGetAssetsHistory(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ExportAssetsOperation manages a long-running operation from ExportAssets. +type ExportAssetsOperation struct { + lro *longrunning.Operation +} + +// ExportAssetsOperation returns a new ExportAssetsOperation from a given name. +// The name must be that of a previously created ExportAssetsOperation, possibly from a different process. +func (c *Client) ExportAssetsOperation(name string) *ExportAssetsOperation { + return &ExportAssetsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *ExportAssetsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*assetpb.ExportAssetsResponse, error) { + var resp assetpb.ExportAssetsResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 5000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *ExportAssetsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*assetpb.ExportAssetsResponse, error) { + var resp assetpb.ExportAssetsResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *ExportAssetsOperation) Metadata() (*assetpb.ExportAssetsRequest, error) { + var meta assetpb.ExportAssetsRequest + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *ExportAssetsOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *ExportAssetsOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/asset/v1beta1/asset_client_example_test.go b/vendor/cloud.google.com/go/asset/v1beta1/asset_client_example_test.go new file mode 100644 index 000000000..160f17150 --- /dev/null +++ b/vendor/cloud.google.com/go/asset/v1beta1/asset_client_example_test.go @@ -0,0 +1,75 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package asset_test + +import ( + "context" + + asset "cloud.google.com/go/asset/v1beta1" + assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := asset.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_ExportAssets() { + ctx := context.Background() + c, err := asset.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &assetpb.ExportAssetsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ExportAssets(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_BatchGetAssetsHistory() { + ctx := context.Background() + c, err := asset.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &assetpb.BatchGetAssetsHistoryRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BatchGetAssetsHistory(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/asset/v1beta1/doc.go b/vendor/cloud.google.com/go/asset/v1beta1/doc.go new file mode 100644 index 000000000..a2a639b4c --- /dev/null +++ b/vendor/cloud.google.com/go/asset/v1beta1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package asset is an auto-generated package for the +// Cloud Asset API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// The cloud asset API manages the history and inventory of cloud resources. +package asset // import "cloud.google.com/go/asset/v1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/asset/v1beta1/mock_test.go b/vendor/cloud.google.com/go/asset/v1beta1/mock_test.go new file mode 100644 index 000000000..7e11118cf --- /dev/null +++ b/vendor/cloud.google.com/go/asset/v1beta1/mock_test.go @@ -0,0 +1,266 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package asset + +import ( + assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockAssetServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + assetpb.AssetServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockAssetServer) ExportAssets(ctx context.Context, req *assetpb.ExportAssetsRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockAssetServer) BatchGetAssetsHistory(ctx context.Context, req *assetpb.BatchGetAssetsHistoryRequest) (*assetpb.BatchGetAssetsHistoryResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*assetpb.BatchGetAssetsHistoryResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockAsset mockAssetServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + assetpb.RegisterAssetServiceServer(serv, &mockAsset) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestAssetServiceExportAssets(t *testing.T) { + var expectedResponse *assetpb.ExportAssetsResponse = &assetpb.ExportAssetsResponse{} + + mockAsset.err = nil + mockAsset.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockAsset.resps = append(mockAsset.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var outputConfig *assetpb.OutputConfig = &assetpb.OutputConfig{} + var request = &assetpb.ExportAssetsRequest{ + Parent: formattedParent, + OutputConfig: outputConfig, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ExportAssets(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAsset.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAssetServiceExportAssetsError(t *testing.T) { + errCode := codes.PermissionDenied + mockAsset.err = nil + mockAsset.resps = append(mockAsset.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var outputConfig *assetpb.OutputConfig = &assetpb.OutputConfig{} + var request = &assetpb.ExportAssetsRequest{ + Parent: formattedParent, + OutputConfig: outputConfig, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ExportAssets(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestAssetServiceBatchGetAssetsHistory(t *testing.T) { + var expectedResponse *assetpb.BatchGetAssetsHistoryResponse = &assetpb.BatchGetAssetsHistoryResponse{} + + mockAsset.err = nil + mockAsset.reqs = nil + + mockAsset.resps = append(mockAsset.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var contentType assetpb.ContentType = assetpb.ContentType_CONTENT_TYPE_UNSPECIFIED + var readTimeWindow *assetpb.TimeWindow = &assetpb.TimeWindow{} + var request = &assetpb.BatchGetAssetsHistoryRequest{ + Parent: formattedParent, + ContentType: contentType, + ReadTimeWindow: readTimeWindow, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchGetAssetsHistory(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAsset.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAssetServiceBatchGetAssetsHistoryError(t *testing.T) { + errCode := codes.PermissionDenied + mockAsset.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var contentType assetpb.ContentType = assetpb.ContentType_CONTENT_TYPE_UNSPECIFIED + var readTimeWindow *assetpb.TimeWindow = &assetpb.TimeWindow{} + var request = &assetpb.BatchGetAssetsHistoryRequest{ + Parent: formattedParent, + ContentType: contentType, + ReadTimeWindow: readTimeWindow, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchGetAssetsHistory(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/authexample_test.go b/vendor/cloud.google.com/go/authexample_test.go new file mode 100644 index 000000000..aafbe2262 --- /dev/null +++ b/vendor/cloud.google.com/go/authexample_test.go @@ -0,0 +1,73 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloud_test + +import ( + "context" + + "cloud.google.com/go/datastore" + "cloud.google.com/go/pubsub" + "golang.org/x/oauth2/google" + "google.golang.org/api/option" +) + +// Google Application Default Credentials is the recommended way to authorize +// and authenticate clients. +// +// For information on how to create and obtain Application Default Credentials, see +// https://developers.google.com/identity/protocols/application-default-credentials. +func Example_applicationDefaultCredentials() { + client, err := datastore.NewClient(context.Background(), "project-id") + if err != nil { + // TODO: handle error. + } + _ = client // Use the client. +} + +// You can use a file with credentials to authenticate and authorize, such as a JSON +// key file associated with a Google service account. Service Account keys can be +// created and downloaded from +// https://console.developers.google.com/permissions/serviceaccounts. +// +// This example uses the Datastore client, but the same steps apply to +// the other client libraries underneath this package. +func Example_credentialsFile() { + client, err := datastore.NewClient(context.Background(), + "project-id", option.WithCredentialsFile("/path/to/service-account-key.json")) + if err != nil { + // TODO: handle error. + } + _ = client // Use the client. +} + +// In some cases (for instance, you don't want to store secrets on disk), you can +// create credentials from in-memory JSON and use the WithCredentials option. +// +// The google package in this example is at golang.org/x/oauth2/google. +// +// This example uses the PubSub client, but the same steps apply to +// the other client libraries underneath this package. +func Example_credentialsFromJSON() { + ctx := context.Background() + creds, err := google.CredentialsFromJSON(ctx, []byte("JSON creds"), pubsub.ScopePubSub) + if err != nil { + // TODO: handle error. + } + client, err := pubsub.NewClient(ctx, "project-id", option.WithCredentials(creds)) + if err != nil { + // TODO: handle error. + } + _ = client // Use the client. +} diff --git a/vendor/cloud.google.com/go/bigquery/benchmarks/README.md b/vendor/cloud.google.com/go/bigquery/benchmarks/README.md new file mode 100644 index 000000000..c97f9d860 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/benchmarks/README.md @@ -0,0 +1,8 @@ +# BigQuery Benchmark +This directory contains benchmarks for BigQuery client. + +## Usage +`go run bench.go -- queries.json` + +BigQuery service caches requests so the benchmark should be run +at least twice, disregarding the first result. diff --git a/vendor/cloud.google.com/go/bigquery/benchmarks/bench.go b/vendor/cloud.google.com/go/bigquery/benchmarks/bench.go new file mode 100644 index 000000000..7d608c881 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/benchmarks/bench.go @@ -0,0 +1,85 @@ +// Copyright 2017 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. + +//+build ignore + +package main + +import ( + "context" + "encoding/json" + "flag" + "io/ioutil" + "log" + "time" + + "cloud.google.com/go/bigquery" + "google.golang.org/api/iterator" +) + +func main() { + flag.Parse() + + ctx := context.Background() + c, err := bigquery.NewClient(ctx, flag.Arg(0)) + if err != nil { + log.Fatal(err) + } + + queriesJSON, err := ioutil.ReadFile(flag.Arg(1)) + if err != nil { + log.Fatal(err) + } + + var queries []string + if err := json.Unmarshal(queriesJSON, &queries); err != nil { + log.Fatal(err) + } + + for _, q := range queries { + doQuery(ctx, c, q) + } +} + +func doQuery(ctx context.Context, c *bigquery.Client, qt string) { + startTime := time.Now() + q := c.Query(qt) + it, err := q.Read(ctx) + if err != nil { + log.Fatal(err) + } + + numRows, numCols := 0, 0 + var firstByte time.Duration + + for { + var values []bigquery.Value + err := it.Next(&values) + if err == iterator.Done { + break + } + if err != nil { + log.Fatal(err) + } + if numRows == 0 { + numCols = len(values) + firstByte = time.Since(startTime) + } else if numCols != len(values) { + log.Fatalf("got %d columns, want %d", len(values), numCols) + } + numRows++ + } + log.Printf("query %q: %d rows, %d cols, first byte %f sec, total %f sec", + qt, numRows, numCols, firstByte.Seconds(), time.Since(startTime).Seconds()) +} diff --git a/vendor/cloud.google.com/go/bigquery/benchmarks/queries.json b/vendor/cloud.google.com/go/bigquery/benchmarks/queries.json new file mode 100644 index 000000000..13fed38b5 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/benchmarks/queries.json @@ -0,0 +1,10 @@ +[ + "SELECT * FROM `nyc-tlc.yellow.trips` LIMIT 10000", + "SELECT * FROM `nyc-tlc.yellow.trips` LIMIT 100000", + "SELECT * FROM `nyc-tlc.yellow.trips` LIMIT 1000000", + "SELECT title FROM `bigquery-public-data.samples.wikipedia` ORDER BY title LIMIT 1000", + "SELECT title, id, timestamp, contributor_ip FROM `bigquery-public-data.samples.wikipedia` WHERE title like 'Blo%' ORDER BY id", + "SELECT * FROM `bigquery-public-data.baseball.games_post_wide` ORDER BY gameId", + "SELECT * FROM `bigquery-public-data.samples.github_nested` WHERE repository.has_downloads ORDER BY repository.created_at LIMIT 10000", + "SELECT repo_name, path FROM `bigquery-public-data.github_repos.files` WHERE path LIKE '%.java' ORDER BY id LIMIT 1000000" +] diff --git a/vendor/cloud.google.com/go/bigquery/bigquery.go b/vendor/cloud.google.com/go/bigquery/bigquery.go new file mode 100644 index 000000000..83e160e39 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/bigquery.go @@ -0,0 +1,162 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "fmt" + "io" + "net/http" + "time" + + "cloud.google.com/go/internal" + "cloud.google.com/go/internal/version" + gax "github.com/googleapis/gax-go" + bq "google.golang.org/api/bigquery/v2" + "google.golang.org/api/googleapi" + "google.golang.org/api/option" + htransport "google.golang.org/api/transport/http" +) + +const ( + prodAddr = "https://www.googleapis.com/bigquery/v2/" + // Scope is the Oauth2 scope for the service. + Scope = "https://www.googleapis.com/auth/bigquery" + userAgent = "gcloud-golang-bigquery/20160429" +) + +var xGoogHeader = fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), version.Repo) + +func setClientHeader(headers http.Header) { + headers.Set("x-goog-api-client", xGoogHeader) +} + +// Client may be used to perform BigQuery operations. +type Client struct { + // Location, if set, will be used as the default location for all subsequent + // dataset creation and job operations. A location specified directly in one of + // those operations will override this value. + Location string + + projectID string + bqs *bq.Service +} + +// NewClient constructs a new Client which can perform BigQuery operations. +// Operations performed via the client are billed to the specified GCP project. +func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) { + o := []option.ClientOption{ + option.WithEndpoint(prodAddr), + option.WithScopes(Scope), + option.WithUserAgent(userAgent), + } + o = append(o, opts...) + httpClient, endpoint, err := htransport.NewClient(ctx, o...) + if err != nil { + return nil, fmt.Errorf("bigquery: dialing: %v", err) + } + bqs, err := bq.New(httpClient) + if err != nil { + return nil, fmt.Errorf("bigquery: constructing client: %v", err) + } + bqs.BasePath = endpoint + c := &Client{ + projectID: projectID, + bqs: bqs, + } + return c, nil +} + +// Close closes any resources held by the client. +// Close should be called when the client is no longer needed. +// It need not be called at program exit. +func (c *Client) Close() error { + return nil +} + +// Calls the Jobs.Insert RPC and returns a Job. +func (c *Client) insertJob(ctx context.Context, job *bq.Job, media io.Reader) (*Job, error) { + call := c.bqs.Jobs.Insert(c.projectID, job).Context(ctx) + setClientHeader(call.Header()) + if media != nil { + call.Media(media) + } + var res *bq.Job + var err error + invoke := func() error { + res, err = call.Do() + return err + } + // A job with a client-generated ID can be retried; the presence of the + // ID makes the insert operation idempotent. + // We don't retry if there is media, because it is an io.Reader. We'd + // have to read the contents and keep it in memory, and that could be expensive. + // TODO(jba): Look into retrying if media != nil. + if job.JobReference != nil && media == nil { + err = runWithRetry(ctx, invoke) + } else { + err = invoke() + } + if err != nil { + return nil, err + } + return bqToJob(res, c) +} + +// Convert a number of milliseconds since the Unix epoch to a time.Time. +// Treat an input of zero specially: convert it to the zero time, +// rather than the start of the epoch. +func unixMillisToTime(m int64) time.Time { + if m == 0 { + return time.Time{} + } + return time.Unix(0, m*1e6) +} + +// runWithRetry calls the function until it returns nil or a non-retryable error, or +// the context is done. +// See the similar function in ../storage/invoke.go. The main difference is the +// reason for retrying. +func runWithRetry(ctx context.Context, call func() error) error { + // These parameters match the suggestions in https://cloud.google.com/bigquery/sla. + backoff := gax.Backoff{ + Initial: 1 * time.Second, + Max: 32 * time.Second, + Multiplier: 2, + } + return internal.Retry(ctx, backoff, func() (stop bool, err error) { + err = call() + if err == nil { + return true, nil + } + return !retryableError(err), err + }) +} + +// This is the correct definition of retryable according to the BigQuery team. It +// also considers 502 ("Bad Gateway") and 503 ("Service Unavailable") errors +// retryable; these are returned by systems between the client and the BigQuery +// service. +func retryableError(err error) bool { + e, ok := err.(*googleapi.Error) + if !ok { + return false + } + var reason string + if len(e.Errors) > 0 { + reason = e.Errors[0].Reason + } + return e.Code == http.StatusServiceUnavailable || e.Code == http.StatusBadGateway || reason == "backendError" || reason == "rateLimitExceeded" +} diff --git a/vendor/cloud.google.com/go/bigquery/bigquery.replay b/vendor/cloud.google.com/go/bigquery/bigquery.replay new file mode 100644 index 000000000..411f56213 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/bigquery.replay @@ -0,0 +1,38404 @@ +{ + "Initial": "IjIwMTgtMDktMTJUMDA6Mjc6NTkuNzk3NjI3WiI=", + "Version": "0.1", + "Entries": [ + { + "ID": "980cb64c0797dcf6", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "73" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "685f8583bc6a6414de00752f989fd5e7/11857414564190582814;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkYXRhc2V0UmVmZXJlbmNlIjp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:01 GMT" + ], + "Etag": [ + "Ebkpq/E66/i28Qe6O1h+eQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RW0vDMBT+L/HRbWnamV5goGKRgTpWlT2IjDQ962KzpkvSDRn+d7PRiYgTCXk557smO1SJukAJykW5bkG/nxXMMgMW9RBYVrpNmlfNGqeUYuFHU6ATsjyH6WjkEGLPLFrJwfYbpW0/pH7SCcx9j0ReTPw5oWHsDvVDz/Pm7hJHNSAXd6KunMDS2sYkGG+320GpVCmBNcIMuFrhYyq88XGj1Rtwa/APQ9wZGvw/5w6VwQI01BxQsjvOxoc+/1Lp0ox/eQH00UOMczAGJS87pJV0HmiWjZ/SbN+8AS6YvNWqbdy8E5ppYUEbx/1iTGYPfxAm2/oEvjWgr9/TFRPSTQNKgzgOAjK86Ocksh5RKxszP4wrHpS8FOvlupJRrvJle1nABqRqQA9KJ7IRHFwR1dZ2/xvfvbL06uaPcBmw4pDutYe4BmaFqp/Eas8kFwENie9FZDj0nIBkxt6rQiwEFKcgih8U3Or5EX18AkY4zkG0AgAA" + } + }, + { + "ID": "9af0cd65340c90dd", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "205" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f399cfa3f1d7136a551f3f2097493c04/13421307512411877550;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI5ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoicmVjIiwidHlwZSI6IlJFQ09SRCJ9XX0sInRhYmxlUmVmZXJlbmNlIjp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwidGFibGVJZCI6InRfYmFkIn19Cg==" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:01 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:01 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAJ3MuwrDMAyF4VcRmjNk6OS1l7WQtXRQbJEIbKtIaaGYvHtd+gbdDh+cvyGbqWFov+EYbg2TFpKKAZesM2Uc0JhcvyL1RVlSp8LutHC3i3BOYBxBHLb3g2E6H6/TCebnBis5VAWPKxfC/T5g1NRfh3H8t7F/AHK97ia2AAAA" + } + }, + { + "ID": "6cbb24b766ef1832", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "360" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "542e8b993627b765d73906dd88bb91ca/15057539521024387390;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDEifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:02 GMT" + ], + "Etag": [ + "vdO4qZ7X0ltNmhLXdZVKoA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Q3U7CQBCF32W9Bbat2kITLkAbQ6xgSjUEY8jSHcpq2y3dRSSEd3daIRjEn2yaZmbOmfNlNuRVZJy4ZCrixRKK9Zlm0wRIjYBmMfbf+OBiMXZGRqL76dwf8fHjrey026gQpY8vkwh0PZeFrju25XKmmQI9sQyzabRMa2LaTgufbTmGYUzwMxtVxG8KXK4gmfkie8WIuda5cildrVaNWMo4AZYL1YhkSvfU9M2ieSFfINKKHiHRHZKi/2CjFZui/0GsNAHMoIAsAuJuyA6hd+IwqN/Ff07/RtknVPq/ebZ4s2gOKStBZgISroj7tCEZS5Ht84cb13lZDcOg179Bz2G+TNVh3uuH3o0XYCOVvGwE3r3XCb3rr5YCooMj8K4GwTXW36OnUiYHYXcw8L1On2yf8dXK3O5aAxqIQarSl1kcQnHcDuRqX0UFMC1kFopqv3l5bjumZTQtyymvBu+5KE4I7CYeqvQnTOk7yQWi8h927GDDTtf3SoeMqoXYehiS7QedIrM2NgMAAA==" + } + }, + { + "ID": "a510ea08c481a3ae", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "300" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "758d34cad742a2260a40540b8825ed4c/16621715035127374286;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X3ZpZXdfc3RhbmRhcmRzcWwifSwidmlldyI6eyJxdWVyeSI6IlNFTEVDVCBBUFBST1hfQ09VTlRfRElTVElOQ1QobmFtZSkgRlJPTSBgZHVsY2V0LXBvcnQtNzYyLmRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxLnRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMWAiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:02 GMT" + ], + "Etag": [ + "IU9J9oJPDjeqhBoIf+CQRA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SXW+bMBSG/0rk3WzaGgNbQ4PUiyRlExVNMkK6SdNEXXwgbgET7BRFUf77jllyE2VrZXFxPnze5z14R55FxYlHHkW+3kCzfafZYwHkEwHNcswHy+HtUN7Ob55gvRrLIPs4+R6Nrq+xQ5h7fFOkoC9q2egLd+B4nGmmQCeOZV9ZQ9tJ7IE7xDNwXMuyEvzsvk5eBLSJ0qzirOFqXeA0BUUWiuoZZ660rpVHadu2/VzKvABWC9VPZUmPmPTFoXUjnyDVip4w0AODom+AoZ1fRc8ydbUIMmigSoF4O3LQDM5Yx/6D3t/q69pHha7/DMAet5KuoGRGORNQcEW8XztSsRJhSGYlZsK2NkEwjf1vfoSJUnKTmC7DcDQOfbL/jXOqTTneasD7xCJdGMoqj6E5TUeyPUZpA0wLWcWik7MvPw9c27GuHPfLJZYLpvSd5ALB+D9aDmz3gf8DI+PPOOl+IKYXfuhP4t5oPo9mP5PJbDmNk5tgEQfTSfzeePzQ+xrN7noPJ4vuv+mNmcX+r+MBiTYKQshZul3gtr2MFQpwV4VMO9+IuFyQ/R8LImghIwMAAA==" + } + }, + { + "ID": "db65a2b08c2602c0", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_standardsql?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "486ac6a31063a62a69550ff5148800cf/18185889454013635166;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_standardsql?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:03 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "784d3fc61a5bf80a", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "57785188fd79b8b1afd323f03d6b789a/1303602369383781102;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:03 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "f426edc670d5577a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "360" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b497d801bf2d78375adcf41922e2aaa1/2939834378013067902;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:04 GMT" + ], + "Etag": [ + "aVGd/08ZfgAd0OMMsUuRCA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Q3U7CQBCF32W9FXZbtWATLgo2hIQfU6oXGkOW7lBX227tLiIhvLvTUoJRVLJpmpk5Z86X2ZBXmQnikrmM35ZQrM8MnydAzgkYHmOf3/cFZe2HRewJNhmN9N0y6HmdDipk6RPLJALTyFVhGi3HdgU3XIOZ2cxqs2vLnllO6xqfY7cYYzP8rGYV8YfCxuUaksVQZq8Y8WxMrl1KV6tVM1YqToDnUjcjldI9NX23aV6oF4iMpt+QaI2k6QlstGLT9BTEShPAAgrIIiDuhtQIgyOHQX0dv5v+j7JPqPT/82zxZtEzpLwEWUhIhCbu44ZkPEW23Q83rvOymobBYNxHz2G+TPVhPhiHft8PsJEqUTYC/9b3Qv/mq6WA6OAI/N4kuMH6Z/RcqeQg7E4mQ98bk+0TvvMyt7s2gAbCSFUOVRaHUHxvB2q1r6ICuJEqC2W137q6cFqWzdqXllNeDT5yWRwROG08VOlPuDYjJSSiil921LCh1x36pUNF1UJs3U3J9hNdZMhoNgMAAA==" + } + }, + { + "ID": "90ada73fa5e59007", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0002?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d516c2ac032e3a48bf0a1e0b5d8144e0/4504008792604427022;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0002?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:04 GMT" + ], + "Etag": [ + "aVGd/08ZfgAd0OMMsUuRCA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:04 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Q3U7CQBCF32W9FXZbtWATLgo2hIQfU6oXGkOW7lBX227tLiIhvLvTUoJRVLJpmpk5Z86X2ZBXmQnikrmM35ZQrM8MnydAzgkYHmOf3/cFZe2HRewJNhmN9N0y6HmdDipk6RPLJALTyFVhGi3HdgU3XIOZ2cxqs2vLnllO6xqfY7cYYzP8rGYV8YfCxuUaksVQZq8Y8WxMrl1KV6tVM1YqToDnUjcjldI9NX23aV6oF4iMpt+QaI2k6QlstGLT9BTEShPAAgrIIiDuhtQIgyOHQX0dv5v+j7JPqPT/82zxZtEzpLwEWUhIhCbu44ZkPEW23Q83rvOymobBYNxHz2G+TPVhPhiHft8PsJEqUTYC/9b3Qv/mq6WA6OAI/N4kuMH6Z/RcqeQg7E4mQ98bk+0TvvMyt7s2gAbCSFUOVRaHUHxvB2q1r6ICuJEqC2W137q6cFqWzdqXllNeDT5yWRwROG08VOlPuDYjJSSiil921LCh1x36pUNF1UJs3U3J9hNdZMhoNgMAAA==" + } + }, + { + "ID": "f43430b0feed2058", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "297" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ee7f6b6faed2317dcee67bbd26752eea/6068184311002315678;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJkYXRlIiwidHlwZSI6IkRBVEUifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X21ldGFkYXRhX3BhcnRpdGlvbl9ub2NsdXN0ZXJfMCJ9LCJ0aW1lUGFydGl0aW9uaW5nIjp7InR5cGUiOiJEQVkifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:05 GMT" + ], + "Etag": [ + "zx6p6pMjEHOdEb1CBpzDZQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Qa0/CMBSG/0v9KnSbYeASP4AQNcEbzg9qzFK2wyhsbW2L3MJ/93RcYgxGszTLOX3P+z49azLlIiMRGfL8YwZ6eWLZsABySsCyHPurRahCdTvpXd9nvaF/2VGr7uvjxQUquJvLZkUKtqaktrVmGEQZs8yATQLPb3nnfpD4YfMcvzBoep6X4PHrNinR3SkTxbTllkuRCJkWM2NBJx56GyhGfS6mmDC2VpmI0vl8Xs+lzAtgipt6Kku6h6afAVVaTiC1hv4gojsiQ/+BRqvXG/oPwko5gBFoECmQaE12BDdH1oL6Xfr29m+SfUKl/xNngxtLx1AyxzHiUGSGRG9rIliJaNsfGi6Vq57iwc3dFc4c7tH52323HffI5h09LS/hYR/IRe7cD6IXlypmZWdpAdOIWwqWfSnyGPTP9kDO91WqgTnDmFfhfuMsbPqB12r41aJgobg+IghbuBc3XzBjb2XG8Z3ZLx47yLjd6ffchEwrQ2w9P5HNFwKS7in1AgAA" + } + }, + { + "ID": "0765510b83893cc7", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_0?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7d9bfffe3d4510eb6dffd01cedb9d8e9/7704416319614825518;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_0?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:05 GMT" + ], + "Etag": [ + "zx6p6pMjEHOdEb1CBpzDZQ==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:05 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Qa0/CMBSG/0v9KnSbYeASP4AQNcEbzg9qzFK2wyhsbW2L3MJ/93RcYgxGszTLOX3P+z49azLlIiMRGfL8YwZ6eWLZsABySsCyHPurRahCdTvpXd9nvaF/2VGr7uvjxQUquJvLZkUKtqaktrVmGEQZs8yATQLPb3nnfpD4YfMcvzBoep6X4PHrNinR3SkTxbTllkuRCJkWM2NBJx56GyhGfS6mmDC2VpmI0vl8Xs+lzAtgipt6Kku6h6afAVVaTiC1hv4gojsiQ/+BRqvXG/oPwko5gBFoECmQaE12BDdH1oL6Xfr29m+SfUKl/xNngxtLx1AyxzHiUGSGRG9rIliJaNsfGi6Vq57iwc3dFc4c7tH52323HffI5h09LS/hYR/IRe7cD6IXlypmZWdpAdOIWwqWfSnyGPTP9kDO91WqgTnDmFfhfuMsbPqB12r41aJgobg+IghbuBc3XzBjb2XG8Z3ZLx47yLjd6ffchEwrQ2w9P5HNFwKS7in1AgAA" + } + }, + { + "ID": "a823337efd219e17", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "328" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ec07ce6d1719a5ac7d2076cc0ae53428/9268590734222961854;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjbHVzdGVyaW5nIjp7ImZpZWxkcyI6WyJuYW1lIl19LCJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJkYXRlIiwidHlwZSI6IkRBVEUifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X21ldGFkYXRhX3BhcnRpdGlvbl9jbHVzdGVyXzAifSwidGltZVBhcnRpdGlvbmluZyI6eyJ0eXBlIjoiREFZIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:05 GMT" + ], + "Etag": [ + "C+V5h/n8MzoudUQqXh2Awg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Qb0vDMBDGv0t8qVvayrqu4Iv5BxGm6NaJIlKy9tZF26QmqXWOfXcvXTdElEkJJXfPPc8vtyKvXKQkJDOevVWglgeGzXIgRwQMy7B+dnjfW1ARXH/KKp3evT0svGGdnZyggtu5tMoTMJ1SKtPp+16YMsM0mNhz3MAZuF7s+v0Bfr7XdxwnxuN2TVygu1XGJVOGGy5FnOSVNqBiB5015PMRF6/ovzCm1CGldV13MymzHFjJdTeRBd0i03ePlkq+QGI0/cFDWx5N/wFGm7drupev0Y1hDgpEAiRckTb/6peVoL7N3nT3c2wTGv0emDVuK1lAwSzFnEOeahI+rYhgBYJtfmi3LO1tEo2vbi5xZtdH32/982F0QdbP6Gl4AbfbOC4y674TPdrUFqHt7ZI3xtZCVMXp0gAWid0ZXkdSZBGon+WxrLe3RAGziRFv6Nzesd93PSfoBT3bho+Sq18EfoBrs4KcaXMtU4446R8e7Sui4enowk7IpDHE0nRC1l8upTBxEAMAAA==" + } + }, + { + "ID": "80ba34868206e0a9", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_cluster_0?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "880e7aec0010ccba8cdd158b5db0d554/10832766248309171534;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_cluster_0?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:06 GMT" + ], + "Etag": [ + "C+V5h/n8MzoudUQqXh2Awg==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:06 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Qb0vDMBDGv0t8qVvayrqu4Iv5BxGm6NaJIlKy9tZF26QmqXWOfXcvXTdElEkJJXfPPc8vtyKvXKQkJDOevVWglgeGzXIgRwQMy7B+dnjfW1ARXH/KKp3evT0svGGdnZyggtu5tMoTMJ1SKtPp+16YMsM0mNhz3MAZuF7s+v0Bfr7XdxwnxuN2TVygu1XGJVOGGy5FnOSVNqBiB5015PMRF6/ovzCm1CGldV13MymzHFjJdTeRBd0i03ePlkq+QGI0/cFDWx5N/wFGm7drupev0Y1hDgpEAiRckTb/6peVoL7N3nT3c2wTGv0emDVuK1lAwSzFnEOeahI+rYhgBYJtfmi3LO1tEo2vbi5xZtdH32/982F0QdbP6Gl4AbfbOC4y674TPdrUFqHt7ZI3xtZCVMXp0gAWid0ZXkdSZBGon+WxrLe3RAGziRFv6Nzesd93PSfoBT3bho+Sq18EfoBrs4KcaXMtU4446R8e7Sui4enowk7IpDHE0nRC1l8upTBxEAMAAA==" + } + }, + { + "ID": "b704234edca9b8fb", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_0?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "66" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6cedf97d19885ea1952bea217912b062/12396941766707060190;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_0?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0aW1lUGFydGl0aW9uaW5nIjp7InJlcXVpcmVQYXJ0aXRpb25GaWx0ZXIiOnRydWUsInR5cGUiOiJEQVkifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:06 GMT" + ], + "Etag": [ + "Qq6PwWCacuA9Qx4rpKdzHQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Q3U7jMBCF38XcLnUSIG0jcVH+EWVFS9BqtUKRcabBkNipPdnQrfrujEMLqwoJFFnRjM8583mW7FnpnCXsQRXzBuxiB8VDCewHAxQF9Sfz+Kb9dSxkMxpOXvZtfZX/u5gcHpJCeV/elBJwtzYWd/txlOQChQPMoiAcBMMwysK4P6QvjvpBEGR0wh5mFaV7ZVYLiwqV0Zk2smwcgs0CynZQzsZKP9OER8TaJZy3bdsrjClKELVyPWkqvoHmfyNeW/MEEh3fIuJrIse/gca71zv+DcJOOYUZWNASWLJka4LLT9ZC+vX0t9uvSTYTOv2XOCvamHyESniOmYIydyz5s2RaVIT29qPARe2r23R6+fOcPO/3lPzf/ckoPWWre8pEVcHNZqDShU9/F/0mh4V5o+yH5kyVBMQStA2QXzfV0QKBWJhfGZVjo4sU7HZ7atpNJS0IH5WqDi082Iv7YRQMDsJujfBSK/uJIB7Q1ry/FA6vTa5oC/l2RjzY3/t4Zzo6Gp96h5FdILXubtnqFQd+F+MTAwAA" + } + }, + { + "ID": "9eb8ea4b663846cf", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_0?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "66" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a1c665a5f745fb91b0eb62eb81bd4d39/14033172675824719470;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_0?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0aW1lUGFydGl0aW9uaW5nIjp7InJlcXVpcmVQYXJ0aXRpb25GaWx0ZXIiOnRydWUsInR5cGUiOiJEQVkifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:07 GMT" + ], + "Etag": [ + "Qq6PwWCacuA9Qx4rpKdzHQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Q3U7jMBCF38XcLnUSIG0jcVH+EWVFS9BqtUKRcabBkNipPdnQrfrujEMLqwoJFFnRjM8583mW7FnpnCXsQRXzBuxiB8VDCewHAxQF9Sfz+Kb9dSxkMxpOXvZtfZX/u5gcHpJCeV/elBJwtzYWd/txlOQChQPMoiAcBMMwysK4P6QvjvpBEGR0wh5mFaV7ZVYLiwqV0Zk2smwcgs0CynZQzsZKP9OER8TaJZy3bdsrjClKELVyPWkqvoHmfyNeW/MEEh3fIuJrIse/gca71zv+DcJOOYUZWNASWLJka4LLT9ZC+vX0t9uvSTYTOv2XOCvamHyESniOmYIydyz5s2RaVIT29qPARe2r23R6+fOcPO/3lPzf/ckoPWWre8pEVcHNZqDShU9/F/0mh4V5o+yH5kyVBMQStA2QXzfV0QKBWJhfGZVjo4sU7HZ7atpNJS0IH5WqDi082Iv7YRQMDsJujfBSK/uJIB7Q1ry/FA6vTa5oC/l2RjzY3/t4Zzo6Gp96h5FdILXubtnqFQd+F+MTAwAA" + } + }, + { + "ID": "c95add736ab9d1e6", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "319" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "29c183417bd9a41705d5f1206ad2e624/15597348189927706366;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJkYXRlIiwidHlwZSI6IkRBVEUifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X21ldGFkYXRhX3BhcnRpdGlvbl9ub2NsdXN0ZXJfMSJ9LCJ0aW1lUGFydGl0aW9uaW5nIjp7ImV4cGlyYXRpb25NcyI6IjEwMDAiLCJ0eXBlIjoiREFZIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:08 GMT" + ], + "Etag": [ + "CmbmrifRYm5tbCPhInwXww==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Sb0vDMBDGv0t8q0tbWTcLvvDPkMEmMisoIiVrb11ck9TkZh1j391Lt4mKopRS7u655/kldM0WUhcsYVNZvizBrg5QTCtghwxQlNS/UFNl5WzyoLo4vbiZD3Vz3zSnp6SQfq9YVjngUW0sHvXiKCkECgeYRUHYD07CKAvj3gk9cdQLgiCjN+xgpsjdK7NaWJQojc60yaulQ7BZSN4OqtlI6gUlzBFrl3DeNE2nNKasQNTSdXKj+B6av0a8tuYZcnT8GxHfETn+DzTent7xfxC2ygnMwILOgSVrtiMY/nAtpN+lb6d/k+wTWv2fOBu6sXwOSniOmYSqcCx5XDMtFKFtP2S4qn11m06G11e08zEn50/zy7N0wDZP5IlSwc0+UOrSu3+IHvxP8lZLK/x0TIEsJHLPopfqfIXgWwFry5HRZQr2e3timn2VW2iNUtkihd3juBdGQd9fy5ekr4K4H/jQQ1YJh2NTSDp98YvHDj09Ox8N/IbJW0Nq3d2yzTs1dectCwMAAA==" + } + }, + { + "ID": "3f965a8f068217ae", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "4f1d86d1dec076b963ebac17778929eb/17161523704013916046;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:08 GMT" + ], + "Etag": [ + "CmbmrifRYm5tbCPhInwXww==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:08 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Sb0vDMBDGv0t8q0tbWTcLvvDPkMEmMisoIiVrb11ck9TkZh1j391Lt4mKopRS7u655/kldM0WUhcsYVNZvizBrg5QTCtghwxQlNS/UFNl5WzyoLo4vbiZD3Vz3zSnp6SQfq9YVjngUW0sHvXiKCkECgeYRUHYD07CKAvj3gk9cdQLgiCjN+xgpsjdK7NaWJQojc60yaulQ7BZSN4OqtlI6gUlzBFrl3DeNE2nNKasQNTSdXKj+B6av0a8tuYZcnT8GxHfETn+DzTent7xfxC2ygnMwILOgSVrtiMY/nAtpN+lb6d/k+wTWv2fOBu6sXwOSniOmYSqcCx5XDMtFKFtP2S4qn11m06G11e08zEn50/zy7N0wDZP5IlSwc0+UOrSu3+IHvxP8lZLK/x0TIEsJHLPopfqfIXgWwFry5HRZQr2e3timn2VW2iNUtkihd3juBdGQd9fy5ekr4K4H/jQQ1YJh2NTSDp98YvHDj09Ox8N/IbJW0Nq3d2yzTs1dectCwMAAA==" + } + }, + { + "ID": "8cca108b080f09a7", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "350" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9737a28ffd9a94c790e4d21b756d79c3/351010548028735261;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjbHVzdGVyaW5nIjp7ImZpZWxkcyI6WyJuYW1lIl19LCJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJkYXRlIiwidHlwZSI6IkRBVEUifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X21ldGFkYXRhX3BhcnRpdGlvbl9jbHVzdGVyXzEifSwidGltZVBhcnRpdGlvbmluZyI6eyJleHBpcmF0aW9uTXMiOiIxMDAwIiwidHlwZSI6IkRBWSJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:08 GMT" + ], + "Etag": [ + "Um0vgXNFPnsgRetR1JVLqA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2TYU/bMBCG/4v3FWo7iKRE4kMRbGIqCIVs2oRQZJJr8EjsYF/pqqr/nXOaVoCYOkVWdL733vexlazYkzYVS9mDrp/n4JZfUD00wA4YoKpp/0crXupf119vjK8zwEx+/zl9npyekkKHuWrelICHnXV4mMRRWilUHrCIhByLExkVMk5O6ImjRAhR0JIjLFpyD8qiUw41amuKspl7BFdIcvbQzKbaPJH/I2LnU84Xi8WotrZuQHXaj0rb8i0yf4l45+wfKNHzDzx84PH8P8B4f3bP9/L1ugxm4MCUwNIVG/IvP7kS0g/Zm+5+jm1Cr98Ds6bbKh+hVYFipqGpPEvvVsyolsA2L7JbdqG6zbPL6280s+uT75v++SS/YOt78kTdws02Tps6uO9Ev8Pn8bfTToXuFQUySdyBZQAbJnY8m7hgbObt2RIhzAjWl1Nr6hzcx+3MLrZV6aBPynXPLI+P4kRGYjw+TuQ7lPeCeCwC1QFrlMcrW2nCqf7hMZwtn5xNL8KELXvD8APcsvUrDTs36SYDAAA=" + } + }, + { + "ID": "445bade5d50137e0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_cluster_1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0d432aded96e38da8905c95fb25e4564/1915186062114945197;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_cluster_1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:08 GMT" + ], + "Etag": [ + "Um0vgXNFPnsgRetR1JVLqA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:08 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2TYU/bMBCG/4v3FWo7iKRE4kMRbGIqCIVs2oRQZJJr8EjsYF/pqqr/nXOaVoCYOkVWdL733vexlazYkzYVS9mDrp/n4JZfUD00wA4YoKpp/0crXupf119vjK8zwEx+/zl9npyekkKHuWrelICHnXV4mMRRWilUHrCIhByLExkVMk5O6ImjRAhR0JIjLFpyD8qiUw41amuKspl7BFdIcvbQzKbaPJH/I2LnU84Xi8WotrZuQHXaj0rb8i0yf4l45+wfKNHzDzx84PH8P8B4f3bP9/L1ugxm4MCUwNIVG/IvP7kS0g/Zm+5+jm1Cr98Ds6bbKh+hVYFipqGpPEvvVsyolsA2L7JbdqG6zbPL6280s+uT75v++SS/YOt78kTdws02Tps6uO9Ev8Pn8bfTToXuFQUySdyBZQAbJnY8m7hgbObt2RIhzAjWl1Nr6hzcx+3MLrZV6aBPynXPLI+P4kRGYjw+TuQ7lPeCeCwC1QFrlMcrW2nCqf7hMZwtn5xNL8KELXvD8APcsvUrDTs36SYDAAA=" + } + }, + { + "ID": "2688d753acc14889", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "88" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "57e034e6879e2eb19e6b6f4e2740d838/3479361576217931837;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0aW1lUGFydGl0aW9uaW5nIjp7ImV4cGlyYXRpb25NcyI6IjEwMDAiLCJyZXF1aXJlUGFydGl0aW9uRmlsdGVyIjp0cnVlLCJ0eXBlIjoiREFZIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:09 GMT" + ], + "Etag": [ + "8TO8Wf0fa/hjrxMTaPa2aA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2S7UvDMBDG/5f4VZe2atcV/DDxBWFTmRURkRLbaxdtk5pcnWPsf/fSbb4MQSml5O655/nl6IK9SJWzmD3J8rUFM99B8VQB22WAoqR6lFxFd4VXCD59Nu/jRFyLQAyPjkgh3VzeVhngXqMN7vXDIM4FCguYBp4feQM/SP2wP6AnDPqe56X0+j1Ma3J3yrQRBiVKrVKls6q1CCb1ydtCVYykeqGEKWJjY85ns1mv1LqsQDTS9jJd8w00fwt4Y/QzZGj5FhFfE1n+DzTe3d7yfxB2ygkUYEBlwOIFWxNc/LIW0q/TV92/STYJnf5PnCVtLJtCLRxHIaHKLYsfFkyJmtBWHzKcN+50k0wuLs9p5rNPzt/6J8PklC0fyRNlDdebQKlK5/4punc/yXsjjXDdMQUyn8ipauC1leZr8kxWhMliNC2Qq2rr4zmCG3BqOo60KhMw2+WJnm1OmYEuJpEdsH+4H/b9wIvc0n5w/BSEkbdCqoTFsc4l7Sbf9hgcHgy+bp8Mj0enbkJnnSGVbm/Y8gOqVItnKQMAAA==" + } + }, + { + "ID": "c46193b416ebd944", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "88" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "40668588deeee1e8f9c08456459f52a6/5115592485335591373;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0aW1lUGFydGl0aW9uaW5nIjp7ImV4cGlyYXRpb25NcyI6IjEwMDAiLCJyZXF1aXJlUGFydGl0aW9uRmlsdGVyIjp0cnVlLCJ0eXBlIjoiREFZIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:10 GMT" + ], + "Etag": [ + "8TO8Wf0fa/hjrxMTaPa2aA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2S7UvDMBDG/5f4VZe2atcV/DDxBWFTmRURkRLbaxdtk5pcnWPsf/fSbb4MQSml5O655/nl6IK9SJWzmD3J8rUFM99B8VQB22WAoqR6lFxFd4VXCD59Nu/jRFyLQAyPjkgh3VzeVhngXqMN7vXDIM4FCguYBp4feQM/SP2wP6AnDPqe56X0+j1Ma3J3yrQRBiVKrVKls6q1CCb1ydtCVYykeqGEKWJjY85ns1mv1LqsQDTS9jJd8w00fwt4Y/QzZGj5FhFfE1n+DzTe3d7yfxB2ygkUYEBlwOIFWxNc/LIW0q/TV92/STYJnf5PnCVtLJtCLRxHIaHKLYsfFkyJmtBWHzKcN+50k0wuLs9p5rNPzt/6J8PklC0fyRNlDdebQKlK5/4punc/yXsjjXDdMQUyn8ipauC1leZr8kxWhMliNC2Qq2rr4zmCG3BqOo60KhMw2+WJnm1OmYEuJpEdsH+4H/b9wIvc0n5w/BSEkbdCqoTFsc4l7Sbf9hgcHgy+bp8Mj0enbkJnnSGVbm/Y8gOqVItnKQMAAA==" + } + }, + { + "ID": "3947399a50025c74", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "327" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "856cf4fa87aa306c877cc6e2b8c62f8d/6679768003733479773;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJkYXRlIiwidHlwZSI6IkRBVEUifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X21ldGFkYXRhX3BhcnRpdGlvbl9ub2NsdXN0ZXJfMiJ9LCJ0aW1lUGFydGl0aW9uaW5nIjp7InJlcXVpcmVQYXJ0aXRpb25GaWx0ZXIiOnRydWUsInR5cGUiOiJEQVkifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:10 GMT" + ], + "Etag": [ + "YXG38xz/xv8hcHEC59JSHw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2QYU/jMAyG/0vuKyxt0bqtEh/gbgecBkJbTwIhVIXU63K0SUlcujHtv59TNkAIBIqiyPbr10+8ZvdK5yxhd6p4aMCufqC4K4HtMUBRUP766uRguHziy8fhQp6Of/ZHf2an7eEhKZTvy5tSAu7XxuL+II6SXKBwgFkUhMNgFEZZGA9GdOJoEARBRjfsYVaRu1dmtbCoUBmdaSPLxiHYLCJvB+V8ovQ9TVgg1i7hvG3bXmFMUYKoletJU/EdNH+MeG3NP5Do+DsiviVy/BtovPu9498g7JRTmIMFLYEla7YlOPtgLaTfTn+ufk2ym9Dpv8TZ0MbkAirhOeYKytyx5GbNtKgI7fkhw1Xto1k6Pbs4oZ6XOjm/qf86Ssdsc0ueqCq43A1UuvDuL6Jr6rDw0Cj7qvmtSgJiCdoGqF831fEKgVhYwLpwYnSRgn2fnpp2F0kLwlulqkML+wfxIIyCUdCPfRmWtbIfCOIhbc0LSuHw3OSKtpB/4rH9Qnp0PBn7DiM7Q0r9nbHNf9+6afUTAwAA" + } + }, + { + "ID": "c97d4b42a70d6c53", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5c53745b2528536c58418bf4e5628bed/8243943517819689709;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:11 GMT" + ], + "Etag": [ + "YXG38xz/xv8hcHEC59JSHw==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:11 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2QYU/jMAyG/0vuKyxt0bqtEh/gbgecBkJbTwIhVIXU63K0SUlcujHtv59TNkAIBIqiyPbr10+8ZvdK5yxhd6p4aMCufqC4K4HtMUBRUP766uRguHziy8fhQp6Of/ZHf2an7eEhKZTvy5tSAu7XxuL+II6SXKBwgFkUhMNgFEZZGA9GdOJoEARBRjfsYVaRu1dmtbCoUBmdaSPLxiHYLCJvB+V8ovQ9TVgg1i7hvG3bXmFMUYKoletJU/EdNH+MeG3NP5Do+DsiviVy/BtovPu9498g7JRTmIMFLYEla7YlOPtgLaTfTn+ufk2ym9Dpv8TZ0MbkAirhOeYKytyx5GbNtKgI7fkhw1Xto1k6Pbs4oZ6XOjm/qf86Ssdsc0ueqCq43A1UuvDuL6Jr6rDw0Cj7qvmtSgJiCdoGqF831fEKgVhYwLpwYnSRgn2fnpp2F0kLwlulqkML+wfxIIyCUdCPfRmWtbIfCOIhbc0LSuHw3OSKtpB/4rH9Qnp0PBn7DiM7Q0r9nbHNf9+6afUTAwAA" + } + }, + { + "ID": "1766891fef54164e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "358" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e50a8ef95ee2938cbab44d76b00606d4/9808117932427825789;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjbHVzdGVyaW5nIjp7ImZpZWxkcyI6WyJuYW1lIl19LCJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJkYXRlIiwidHlwZSI6IkRBVEUifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X21ldGFkYXRhX3BhcnRpdGlvbl9jbHVzdGVyXzIifSwidGltZVBhcnRpdGlvbmluZyI6eyJyZXF1aXJlUGFydGl0aW9uRmlsdGVyIjp0cnVlLCJ0eXBlIjoiREFZIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:11 GMT" + ], + "Etag": [ + "bw2VtXOtuq34WfDgiozLsA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Qa0+DMBSG/0v9qiswZUrihy1TYzIvmXiLMaTCGVaBsvYgzmX/3VPGpjGaGUJIT9/Lw5mzV1kkLGBPMp1WoGdbKJ4yYNsMUKR2Xns3eHeB1bS7ezsZplJ9jEz/8JAU0vqSKosBd0qlcafne0EiUBjAyHPcfefA9SLX7x3Q43s9x3Eiet0ORjmlW2VUCo0SpSqiOKsMgo48SjaQTUayeKX8Z8TSBJzXdd1JlUozEKU0nVjlfIXM3zxeavUCMRr+g4e3PIb/A4w3/274Rr5GN4YJaChiYMGctf2nv6yE9G338nYzx6qh0W+AWdC24mfIhaWYSMgSw4KHOStETmDLD8XNSnu6Csen5yfkWd9T7rf7YT88YotHykSZw+WqThapTV+L7smhYVpJ/aU5lhkBsQB1BeRvAVvnmmtZawuKKh/MEGjIHNYcR6pIQ9A/x2NVr06xBmG7Qtmwu3tdv+d6tMSub3cG76XUvwj8fVqq9WfC4JlKJOEkf2S0/xj2B6Mj61BxE0ij6yu2+AQVMakrLgMAAA==" + } + }, + { + "ID": "1eaffcd03f4c7eb7", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_cluster_2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f0f354c796d67b9a013ec190bbae60ea/11444349945352014349;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_cluster_2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:11 GMT" + ], + "Etag": [ + "bw2VtXOtuq34WfDgiozLsA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:11 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Qa0+DMBSG/0v9qiswZUrihy1TYzIvmXiLMaTCGVaBsvYgzmX/3VPGpjGaGUJIT9/Lw5mzV1kkLGBPMp1WoGdbKJ4yYNsMUKR2Xns3eHeB1bS7ezsZplJ9jEz/8JAU0vqSKosBd0qlcafne0EiUBjAyHPcfefA9SLX7x3Q43s9x3Eiet0ORjmlW2VUCo0SpSqiOKsMgo48SjaQTUayeKX8Z8TSBJzXdd1JlUozEKU0nVjlfIXM3zxeavUCMRr+g4e3PIb/A4w3/274Rr5GN4YJaChiYMGctf2nv6yE9G338nYzx6qh0W+AWdC24mfIhaWYSMgSw4KHOStETmDLD8XNSnu6Csen5yfkWd9T7rf7YT88YotHykSZw+WqThapTV+L7smhYVpJ/aU5lhkBsQB1BeRvAVvnmmtZawuKKh/MEGjIHNYcR6pIQ9A/x2NVr06xBmG7Qtmwu3tdv+d6tMSub3cG76XUvwj8fVqq9WfC4JlKJOEkf2S0/xj2B6Mj61BxE0ij6yu2+AQVMakrLgMAAA==" + } + }, + { + "ID": "0cb5ca046f491d65", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "67" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "25ee6d049695a91c06977f4bc2fc7251/13008525459438224285;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0aW1lUGFydGl0aW9uaW5nIjp7InJlcXVpcmVQYXJ0aXRpb25GaWx0ZXIiOmZhbHNlLCJ0eXBlIjoiREFZIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:12 GMT" + ], + "Etag": [ + "9JLvKRFOqSCdy3kebAb3IQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2QbU/CMBDHv0t9q3QbOtwSXuBjUHyC+cIYs5TtmJWuHW0nEsJ39zoBDTHRNE1zd//736+3JFMucxKTMS9mNejFnmVjAWSfgGUF5qOrwfv18OJuNjrNF+0pjHvjdv+h20UFd315LTKwB5XS9qATBnHOLDNg08Dzj73ID1I/7ER4wqDjeV6K12/ZtER3p0wrpi23XMlUqkzUxoJOA/Q2ICYDLqc44dXaysSUzufzVqFUIYBV3LQyVdINNH0PaKXVG2TW0B0iuiYy9B9otPm9of8gbJRDmIAGmQGJl2RN0P9lLahfT/+q/k2ymdDo/8RZ4cayVyiZ45hwELkh8fOSSFYi2teDhovKRaNk2L+9xJ5tHZ1/1M96yTlZvaCn5SXcbwZyWTj3regJOzTMaq6/NRdcIBCJJ0wYQANZlycLCwhDPNKEAyWLBPRueqjmmyjTwJxXwhs2/6gddvzAi7yj0JXho+L6F0F4jGtzAsGMvVE5xzXkux7B4WH0/dGkdzI4dx0qawwx9Tgiq095mnF8FAMAAA==" + } + }, + { + "ID": "b605b11c4bcb4c8c", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "67" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f35479138fbb77850d59826c9444d485/14572699874046360365;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0aW1lUGFydGl0aW9uaW5nIjp7InJlcXVpcmVQYXJ0aXRpb25GaWx0ZXIiOmZhbHNlLCJ0eXBlIjoiREFZIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:13 GMT" + ], + "Etag": [ + "9JLvKRFOqSCdy3kebAb3IQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2QbU/CMBDHv0t9q3QbOtwSXuBjUHyC+cIYs5TtmJWuHW0nEsJ39zoBDTHRNE1zd//736+3JFMucxKTMS9mNejFnmVjAWSfgGUF5qOrwfv18OJuNjrNF+0pjHvjdv+h20UFd315LTKwB5XS9qATBnHOLDNg08Dzj73ID1I/7ER4wqDjeV6K12/ZtER3p0wrpi23XMlUqkzUxoJOA/Q2ICYDLqc44dXaysSUzufzVqFUIYBV3LQyVdINNH0PaKXVG2TW0B0iuiYy9B9otPm9of8gbJRDmIAGmQGJl2RN0P9lLahfT/+q/k2ymdDo/8RZ4cayVyiZ45hwELkh8fOSSFYi2teDhovKRaNk2L+9xJ5tHZ1/1M96yTlZvaCn5SXcbwZyWTj3regJOzTMaq6/NRdcIBCJJ0wYQANZlycLCwhDPNKEAyWLBPRueqjmmyjTwJxXwhs2/6gddvzAi7yj0JXho+L6F0F4jGtzAsGMvVE5xzXkux7B4WH0/dGkdzI4dx0qawwx9Tgiq095mnF8FAMAAA==" + } + }, + { + "ID": "5c5c1bc9c25095f3", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "364" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7ad0141c20b01608a2e5904357eb25a7/16208931882658870461;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJkYXRlIiwidHlwZSI6IkRBVEUifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X21ldGFkYXRhX3BhcnRpdGlvbl9ub2NsdXN0ZXJfMyJ9LCJ0aW1lUGFydGl0aW9uaW5nIjp7ImV4cGlyYXRpb25NcyI6IjEwMDAiLCJmaWVsZCI6ImRhdGUiLCJyZXF1aXJlUGFydGl0aW9uRmlsdGVyIjp0cnVlLCJ0eXBlIjoiREFZIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:13 GMT" + ], + "Etag": [ + "1odn1p5QVJl0rHPxgDKafg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2S0U7jMBBF/8X7CnWSqgmNxAMV7C5QEJTsSmiFIpNMg8Gxgz2hVFX/nXHaAkWLQJEVeebOvceWF+xB6pKl7FZWjy3Y+Q8UtwrYDgMUFdVDU+qwGVz+PVGB/X3xXB2eimm1v08K6efKVhWAu42xuJvEUVoKFA4wj4JwLxiGUR7GyZC+OEqCIMhphT3Ma3L3yrwRFiVKo3NtCtU6BJv3yduBmo6lfqCEO8TGpZzPZrNeZUylQDTS9QpT8w00f4p4Y809FOj4ByK+JnL8G2i8O73j3yDslBOYggVdAEsXbE1w/J9rIf06fdX9mmST0Om/xFnSjRV3UAvPMZWgSsfSfwumRU1oqx8Zzhu/u8omx+e/aOa1T87v+ocH2RFb3pAnyhouNoFSV979VXTtH8lzI63w3TPnHwuRU7UDeLO18NhK+2b0UyqiZinaFihEt/VojuDn/TBtx0ZXGdiP5YmZbXaFhS41kx1/OOjHSRgFw34yGG5hbQvivWBFqITDM1NKIi0/8VifMzsYjY/8hCk6Qyr9uWLLFwSoiPA4AwAA" + } + }, + { + "ID": "97223d6119ee3090", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_3?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "45f20642542d4cba8be8697cff96bff5/17773106301561908301;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_3?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:14 GMT" + ], + "Etag": [ + "1odn1p5QVJl0rHPxgDKafg==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:14 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2S0U7jMBBF/8X7CnWSqgmNxAMV7C5QEJTsSmiFIpNMg8Gxgz2hVFX/nXHaAkWLQJEVeebOvceWF+xB6pKl7FZWjy3Y+Q8UtwrYDgMUFdVDU+qwGVz+PVGB/X3xXB2eimm1v08K6efKVhWAu42xuJvEUVoKFA4wj4JwLxiGUR7GyZC+OEqCIMhphT3Ma3L3yrwRFiVKo3NtCtU6BJv3yduBmo6lfqCEO8TGpZzPZrNeZUylQDTS9QpT8w00f4p4Y809FOj4ByK+JnL8G2i8O73j3yDslBOYggVdAEsXbE1w/J9rIf06fdX9mmST0Om/xFnSjRV3UAvPMZWgSsfSfwumRU1oqx8Zzhu/u8omx+e/aOa1T87v+ocH2RFb3pAnyhouNoFSV979VXTtH8lzI63w3TPnHwuRU7UDeLO18NhK+2b0UyqiZinaFihEt/VojuDn/TBtx0ZXGdiP5YmZbXaFhS41kx1/OOjHSRgFw34yGG5hbQvivWBFqITDM1NKIi0/8VifMzsYjY/8hCk6Qyr9uWLLFwSoiPA4AwAA" + } + }, + { + "ID": "b7ed82181777415e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "395" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "03ba4cd812992df7148ab17eec43108b/890819216915277277;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjbHVzdGVyaW5nIjp7ImZpZWxkcyI6WyJuYW1lIl19LCJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJkYXRlIiwidHlwZSI6IkRBVEUifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X21ldGFkYXRhX3BhcnRpdGlvbl9jbHVzdGVyXzMifSwidGltZVBhcnRpdGlvbmluZyI6eyJleHBpcmF0aW9uTXMiOiIxMDAwIiwiZmllbGQiOiJkYXRlIiwicmVxdWlyZVBhcnRpdGlvbkZpbHRlciI6dHJ1ZSwidHlwZSI6IkRBWSJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:14 GMT" + ], + "Etag": [ + "/YKhdoDcqbsXlvoetiy/yQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Sb2+bMBDGv4v3do2BbNAg9UWrdlO1dNpSJrWaJuSYC/FqMLGPpijKd9+ZkPSPNmVCCPnuuef5ncWGPai6YCmbq3LVgu3eoZhrYO8ZoCipzu+/LAtzKVdzd6cfDaDqePf97IwUys8VrZaAJ42xeJLEUVoIFA4wj4LwNJiEUR7GyYSeOEqCIMjpDUeYV+TulXkjLCpUps6lbh2Czcfk7EAvpqp+IP8lYuNSztfr9ag0ptQgGuVG0lR8j8wfI95Y8xskOv6Ghw88jv8HGO93d/woX6+bwQIs1BJYumFD/vVfroT0Q/aue5xjn9Drj8Bs6bbkEirhKRYKdOFY+nPDalER2O5Ddl3jT7fZ7PrrZ5o59Mn3Rf/yPLti21/kiaqCb/s4VZfe/SC697/HU6Os8N0bCmQhcVO1B3i2tbBqlX02+qQ0UbMUbQsUMmwx2B/gd2yeom6riw7BB3h3Ok5NXWZg35ZnZr0/SQs9Vqb6BcOP4zgJo2DyYZyEr7hfC+LTYLeCFg5vTKEIp/iHx3AR2fnF9MpPGNkbUunHLdv+AaY46OhTAwAA" + } + }, + { + "ID": "8b90d2c1355ea175", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_cluster_3?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c8df72d52cef6a6602b6d833ce1b0ead/2454994731018263917;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_cluster_3?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:14 GMT" + ], + "Etag": [ + "/YKhdoDcqbsXlvoetiy/yQ==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:14 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Sb2+bMBDGv4v3do2BbNAg9UWrdlO1dNpSJrWaJuSYC/FqMLGPpijKd9+ZkPSPNmVCCPnuuef5ncWGPai6YCmbq3LVgu3eoZhrYO8ZoCipzu+/LAtzKVdzd6cfDaDqePf97IwUys8VrZaAJ42xeJLEUVoIFA4wj4LwNJiEUR7GyYSeOEqCIMjpDUeYV+TulXkjLCpUps6lbh2Czcfk7EAvpqp+IP8lYuNSztfr9ag0ptQgGuVG0lR8j8wfI95Y8xskOv6Ghw88jv8HGO93d/woX6+bwQIs1BJYumFD/vVfroT0Q/aue5xjn9Drj8Bs6bbkEirhKRYKdOFY+nPDalER2O5Ddl3jT7fZ7PrrZ5o59Mn3Rf/yPLti21/kiaqCb/s4VZfe/SC697/HU6Os8N0bCmQhcVO1B3i2tbBqlX02+qQ0UbMUbQsUMmwx2B/gd2yeom6riw7BB3h3Ok5NXWZg35ZnZr0/SQs9Vqb6BcOP4zgJo2DyYZyEr7hfC+LTYLeCFg5vTKEIp/iHx3AR2fnF9MpPGNkbUunHLdv+AaY46OhTAwAA" + } + }, + { + "ID": "a47fe645e39c0eb7", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_3?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "89" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e584c0fe2d77631ba8c00ba616d0aaa7/4091225640135923453;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_3?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0aW1lUGFydGl0aW9uaW5nIjp7ImV4cGlyYXRpb25NcyI6IjEwMDAiLCJyZXF1aXJlUGFydGl0aW9uRmlsdGVyIjpmYWxzZSwidHlwZSI6IkRBWSJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:15 GMT" + ], + "Etag": [ + "SqqtLTUHThoU/2nKFngQVw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SYWvbMBCG/4v2dY1sp7EbQz+0rN3K0rElzmCMYVT74miVJUc6zw0h/30nJ2nWMGgxxtzde+/7SHjDHqUuWcoeZLVqwa7foXhQwN4zQFFRf7Za4SSbf8qWZs4j/flWV9++d5eXpJB+r2xVAXjWGItnSRylpUDhAPMoCC+CcRjlYZyM6YmjJAiCnN5wgHlN7l6ZN8KiRGl0rk2hWodg8yF5O1CLidSPlLBEbFzKedd1g8qYSoFopBsUpuYHaP4n4o01v6FAx0+I+J7I8Teg8f70jr+BsFdOYQEWdAEs3bA9wd1/roX0+/Td9HWSQ0KvfxVnSzdWLKEWnmMhQZWOpT83TIua0HYfMlw3vppl07svH2nneU7O/8w/XGU3bPuLPFHW8PUQKHXl3Z9FP/xP8tRIK/z0ngJZSOTU7QGOthZWrbRHo1upiJqlC6EcUIpu6+s1gjfw21ROjK4ysKftqekOVWGhj81kf4BwNIyTMArGw2Q0fsH1UhBfBDtEJRzem1ISannqMTo/T463kV1dT278hil6Q2rNZ2z7F22kQj85AwAA" + } + }, + { + "ID": "7fbe6c238d603b82", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_3?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "89" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7b280fe49a46d59a4f83399c58b0dd08/5655119687852068493;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_3?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0aW1lUGFydGl0aW9uaW5nIjp7ImV4cGlyYXRpb25NcyI6IjEwMDAiLCJyZXF1aXJlUGFydGl0aW9uRmlsdGVyIjpmYWxzZSwidHlwZSI6IkRBWSJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:16 GMT" + ], + "Etag": [ + "SqqtLTUHThoU/2nKFngQVw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SYWvbMBCG/4v2dY1sp7EbQz+0rN3K0rElzmCMYVT74miVJUc6zw0h/30nJ2nWMGgxxtzde+/7SHjDHqUuWcoeZLVqwa7foXhQwN4zQFFRf7Za4SSbf8qWZs4j/flWV9++d5eXpJB+r2xVAXjWGItnSRylpUDhAPMoCC+CcRjlYZyM6YmjJAiCnN5wgHlN7l6ZN8KiRGl0rk2hWodg8yF5O1CLidSPlLBEbFzKedd1g8qYSoFopBsUpuYHaP4n4o01v6FAx0+I+J7I8Teg8f70jr+BsFdOYQEWdAEs3bA9wd1/roX0+/Td9HWSQ0KvfxVnSzdWLKEWnmMhQZWOpT83TIua0HYfMlw3vppl07svH2nneU7O/8w/XGU3bPuLPFHW8PUQKHXl3Z9FP/xP8tRIK/z0ngJZSOTU7QGOthZWrbRHo1upiJqlC6EcUIpu6+s1gjfw21ROjK4ysKftqekOVWGhj81kf4BwNIyTMArGw2Q0fsH1UhBfBDtEJRzem1ISannqMTo/T463kV1dT278hil6Q2rNZ2z7F22kQj85AwAA" + } + }, + { + "ID": "a8fda36b16f09836", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_3?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ba62debb1070c40309664abab88452eb/7219295201938278173;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_3?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:16 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "9db4399650c6bd20", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "619229e136721969c480bb0ae086354a/8855526111072714669;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:16 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "fa95dcfbb52c0340", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "43ce7cfb6f6e964ff2b2b1f4fbf9f67a/10419701625158924349;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:16 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "a2cfb47d28ae73ae", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_0?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b255a962c924c4e8650bea2ec6b01e2e/11983877143556813005;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_metadata_partition_nocluster_0?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:17 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "f40911a7bc1b8cbf", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0002?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5dcd0028df3d197da03e0adeba7b66dc/13548051558148172125;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0002?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:17 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "dbf48f706b6276d4", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "111" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b66e7ee7f430f4bdf8a209ce4837f505/15184283566777459181;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkYXRhc2V0UmVmZXJlbmNlIjp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAyIn0sImZyaWVuZGx5TmFtZSI6Im5hbWUiLCJsb2NhdGlvbiI6IkVVIn0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:17 GMT" + ], + "Etag": [ + "mRHxZUkAQvNUd/ftY8bgYw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ra0vzMBT+L/HrtvSivYGg4tCBTiyOoSIjTU672LTpknR9x/C/v+moIqIiIQTOeW7nZI9KXjOUoIwXmxbU7ogRQzQYNEJgSGE7VXr972lRnt9v5wuGc/MYZcVjd3pqEbxnslZQMONGKjMOAy8ZBFae40ZO7HorNwhjewIvdBxnZa9nqRpEfsPr0gqsjWl0gnHXdZNCykIAabieUFnh91R46+FGyVegRuMvhngw1PhvzgMqhRwU1BRQsn+vzQ7z/EllSDP7ZgPobYRyxaFmYjcnlTVAdf+MEKEUtEbJ8x4pKfrGMp09TNN+Hw1QTsSVkm1j64P8UnEDSlvFD8bdcv4L4a6rf8C3GtTFbloRLmzVDwI/jn3fPT4ZZ25kHFdWJiZeGJfUL2jBN+tNKaJMZuv2jMEWhGxATQorsuUU7CCyrU3/R5+90un55S/hUiDskO5lhKgCYrisH/hhQe6JH4Su58Rh5EdWQBBtbiXjOQf2E0TSg4JtTRfo7T8DWVYTygIAAA==" + } + }, + { + "ID": "2424a0b67d83d843", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0002?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b7a557f7983b925909dc839d4e19a669/16748459080863668861;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0002?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:18 GMT" + ], + "Etag": [ + "mRHxZUkAQvNUd/ftY8bgYw==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:18 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ra0vzMBT+L/HrtvSivYGg4tCBTiyOoSIjTU672LTpknR9x/C/v+moIqIiIQTOeW7nZI9KXjOUoIwXmxbU7ogRQzQYNEJgSGE7VXr972lRnt9v5wuGc/MYZcVjd3pqEbxnslZQMONGKjMOAy8ZBFae40ZO7HorNwhjewIvdBxnZa9nqRpEfsPr0gqsjWl0gnHXdZNCykIAabieUFnh91R46+FGyVegRuMvhngw1PhvzgMqhRwU1BRQsn+vzQ7z/EllSDP7ZgPobYRyxaFmYjcnlTVAdf+MEKEUtEbJ8x4pKfrGMp09TNN+Hw1QTsSVkm1j64P8UnEDSlvFD8bdcv4L4a6rf8C3GtTFbloRLmzVDwI/jn3fPT4ZZ25kHFdWJiZeGJfUL2jBN+tNKaJMZuv2jMEWhGxATQorsuUU7CCyrU3/R5+90un55S/hUiDskO5lhKgCYrisH/hhQe6JH4Su58Rh5EdWQBBtbiXjOQf2E0TSg4JtTRfo7T8DWVYTygIAAA==" + } + }, + { + "ID": "20bebc801be43ae3", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0002?alt=json\u0026deleteContents=false\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "38e4a3ba45701d68375d0ecaee89cbcb/18312633499766706701;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0002?alt=json\u0026deleteContents=false\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:18 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "c08ad1aa5eb4217e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ab639812455c7a2a01d3535badfc75ae/1502402909663152797;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:18 GMT" + ], + "Etag": [ + "Ebkpq/E66/i28Qe6O1h+eQ==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:18 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RW0vDMBT+L/HRbWnamV5goGKRgTpWlT2IjDQ962KzpkvSDRn+d7PRiYgTCXk557smO1SJukAJykW5bkG/nxXMMgMW9RBYVrpNmlfNGqeUYuFHU6ATsjyH6WjkEGLPLFrJwfYbpW0/pH7SCcx9j0ReTPw5oWHsDvVDz/Pm7hJHNSAXd6KunMDS2sYkGG+320GpVCmBNcIMuFrhYyq88XGj1Rtwa/APQ9wZGvw/5w6VwQI01BxQsjvOxoc+/1Lp0ox/eQH00UOMczAGJS87pJV0HmiWjZ/SbN+8AS6YvNWqbdy8E5ppYUEbx/1iTGYPfxAm2/oEvjWgr9/TFRPSTQNKgzgOAjK86Ocksh5RKxszP4wrHpS8FOvlupJRrvJle1nABqRqQA9KJ7IRHFwR1dZ2/xvfvbL06uaPcBmw4pDutYe4BmaFqp/Eas8kFwENie9FZDj0nIBkxt6rQiwEFKcgih8U3Or5EX18AkY4zkG0AgAA" + } + }, + { + "ID": "cc4ae0abca1487bc", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/does_not_exist?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "806a29b5af1dd2c8b2ea275f82fafac2/3066578423749362477;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/does_not_exist?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:19 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:19 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKXMQQrCQAyF4asMWbcgUizMWlx6AZESm1gK04kkKQhD7+6UHsHd44P/FWBVUYjlGAbxUYBkwTlDhCnJCxM0oIwmu2Txm6yZqi1shhNXvIuH964xXNHR2AOtaWRvP6Le9pdzJGEbajzwdzaH7dnAKFTj7tT9ebX9AJt2NLjFAAAA" + } + }, + { + "ID": "b380088eafdf8f85", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "73" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "63d304e338e399b63c0789c698a94cb1/4630752842652400573;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkYXRhc2V0UmVmZXJlbmNlIjp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAzIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:19 GMT" + ], + "Etag": [ + "zXV1c75pOC8OREie13Eokw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RbUvDMBD+L/HrtjaNa9fCwLciA3VQXyaIjDS9dbFZ0yXpyhz776ajiogOCffl7nm7yw4VvMxQhFKer2tQ25OMGqrBoB4CQ3M7eX9+wiwYVtPL0TSJOWASy6IZjy2Ct8ysFgxMv5LK9APfizqBuefikRtib479ILTP9wLXdee2iKVqEIsbXhZWYGlMpSPHaZpmkEuZC6AV1wMmV85nKmfjOZWSb8CMdn4YOp2hdv7n3KESWICCkgGKdp+9yWGff6l0aSa/XADte4gyBlqj6GWHlBTWA82SyUOctJtXwDgV10rWle13QjPFDShtuV+M6ezuCGHalH/gaw3qYhuvKBe2S3yfhCEh+HTYT/HIuFiuTEi9ICwYyVnO18t1IUapTJf1WQYbELICNcityIYzsIvIujTtb3z3SuLzqyPhEqDZId1rDzEF1HBZPvBVy8RD4gfYc8MwIO0hBdXmVmZ8wSH7CyLZQcGOHu/R/gMvB25VtAIAAA==" + } + }, + { + "ID": "aeaf1704956e83d5", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0003?alt=json\u0026deleteContents=false\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0e37c747cc75383561016de1e65a0c91/6266984851264910413;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0003?alt=json\u0026deleteContents=false\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:20 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "37e5d383a788cee6", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "73" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c925e4b7645ac0e4322df4dd571b387a/7831160365367897309;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkYXRhc2V0UmVmZXJlbmNlIjp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDA0In19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:20 GMT" + ], + "Etag": [ + "Msi46s/7XhhwHfHheG1RBw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RW0vDMBT+L/F1W5p26w0EFYcbeIGqTBAZaXraxmZNl6QrMvbfzUYVER0j5OWc75psUcXrDMUo5cW6BfVxllFDNRg0QGBoYTd3mo99jYOXsuxm+ayEG5JcdefnFsH3zKwVDMywkcoMA9+Ne4Gl65DQiYi7JH4Q2eO7geM4S3vHlqpB5Le8rqxAaUyjY4y7rhsVUhYCaMP1iMkV/kqFNy5ulHwHZjT+ZYh7Q41Pc+5RCeSgoGaA4u3XbH7oc5JKn2b+xwug3QBRxkBrFL9ukZLCeqBFMn+aJvvmDTBOxY2SbWPnvdBCcQNKW+4342Fxf4Tw0NX/4FsN6upjuqJc2Knn+14UeR4ZT4YpCY1D5MpE1A2iinkFK/i6XFciTGVathcZbEDIBtSosCIbzsAWkW1t9r/x0yuZXl4fCZcAzQ7p3gaIKaCGy/qJr/ZMMvH8gLjEcUIvtAKCanMnM55zyP6DSHZQsKvnR7T7BP+eWu20AgAA" + } + }, + { + "ID": "977ae126e481d50c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0004/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "147" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b539fc10b8bf44d92d303900d7cbfb20/9395334779959256429;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0004/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwNCIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDMifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:21 GMT" + ], + "Etag": [ + "cKscLB3lcQR7Js3AEud5og==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2QQXOCMBCF/0t6VZJAgcqMB53x0JYeau2ZiWGhqUAoWco4jv+9geLFsdXJ5LAvb/d9mwPZqSolEdmq/KuFZn+HYlsAmRBAkVtdPhsZL71Cvq7DJ+MtVm3q63w+tw7V96VtIQGntW5wGgZulAoUBjBxGX9gM+4mPAhn9gRuyBhL7L13hoh/HJ4dbqDIYlXtbMQHYm0iSruuc3Kt8wJErYwjdUlP1PTbpXWjP0GioWdIdEQy9AY2OrAZegvi4FlDBg1UEkh0ICPC44WPsf4x/vf1OsopYfBf5zlOSNWWyz2CsX5GhjLWVb6B5lxe6+5UyQYEKl1tVGlXINz3gpC7nHHf73cshMEXnapMQfqHBfd1L28Wy3jVd2g5DLTS+xs5/gAU/saNYQIAAA==" + } + }, + { + "ID": "18cab6fb8a2fcdc0", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0004?alt=json\u0026deleteContents=false\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0ce549d67d86ba7798bb2bea7c9c88f1/10959228827675401725;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0004?alt=json\u0026deleteContents=false\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:21 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:21 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAALWNwQqDMBBEfyXsWWENojXnXvoBnkqR1CwSiG7ZjSfx35viN5RhYHgDMweQCAu44woK7nlA4NXHDRwsid8+QQVCXvlHhJR3memxjUqlWEnVL1Sau89eKZuwp5ly/WHJdd9ZFy4+WWxuODR2arp+KOpsj4hTcWuiGs0xJRM3s5fd81XBzKHMtoh/Ozm//Mdtmv4AAAA=" + } + }, + { + "ID": "27a31c20e523e013", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0004?alt=json\u0026deleteContents=true\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d8bc42814fba86761e1b2dc1c99b5b23/12595460836287911565;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0004?alt=json\u0026deleteContents=true\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:22 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "236c6ce2f165853f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "bdf3580b9581de657da9c01ae40489df/14159635250896047645;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:22 GMT" + ], + "Etag": [ + "Ebkpq/E66/i28Qe6O1h+eQ==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:22 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RW0vDMBT+L/HRbWnamV5goGKRgTpWlT2IjDQ962KzpkvSDRn+d7PRiYgTCXk557smO1SJukAJykW5bkG/nxXMMgMW9RBYVrpNmlfNGqeUYuFHU6ATsjyH6WjkEGLPLFrJwfYbpW0/pH7SCcx9j0ReTPw5oWHsDvVDz/Pm7hJHNSAXd6KunMDS2sYkGG+320GpVCmBNcIMuFrhYyq88XGj1Rtwa/APQ9wZGvw/5w6VwQI01BxQsjvOxoc+/1Lp0ox/eQH00UOMczAGJS87pJV0HmiWjZ/SbN+8AS6YvNWqbdy8E5ppYUEbx/1iTGYPfxAm2/oEvjWgr9/TFRPSTQNKgzgOAjK86Ocksh5RKxszP4wrHpS8FOvlupJRrvJle1nABqRqQA9KJ7IRHFwR1dZ2/xvfvbL06uaPcBmw4pDutYe4BmaFqp/Eas8kFwENie9FZDj0nIBkxt6rQiwEFKcgih8U3Or5EX18AkY4zkG0AgAA" + } + }, + { + "ID": "818a30fdd422de02", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "41" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "275f19a316b52bbbc9fc36a89993c544/15723810764982257581;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkZXNjcmlwdGlvbiI6ImQyIiwiZnJpZW5kbHlOYW1lIjoibjIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:23 GMT" + ], + "Etag": [ + "2o9dlL5BSc2UFWtNlhwMWw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1R72viMBj+X3Jf1SaptrYw2Ma8Q9gcdBv9MIbE5LXmjE1NUovI/vdLpDvuxjZGyJc3z6/3yQltZS1Qjlay2rdgjj8Ec8yCQwMEjlX+hepMqNvJ9QOnTz9Lt1Cb7q7sLi48QgamaBUHN2y0ccM0oXkvsKSYTHFG6JIkaeZPQlOM8dJf4qkW1PpW1lsvsHGusXkUdV03qrSuFLBG2hHXu+gtVXSgUWP0b+DORu8Mo97QRt9z7lEFrMFAzQHlp7fZ/LzPt1T6NPMPGkCvA7Q2Emqhjgu28waopsEYLDeycVLXgRRGjHOwFuXPJ2S0CsiymD/OilBQA1wy9cvotvHz3q800oGx3uIv475cfEG47+pP8K0Fc32c7ZhUfhonSZxlcUzGk+GKTB0meucyRtNsy+OKV3K/2W/VdKVXm/ZSwAGUbsCMKi9ykBz8IrqtXfi0f72K2dXNF+EKYOKc7mWAuAEWqnmU58bIJE5SQvGUjMfYCyhm3Z0Wci1B/A8h2IcOZSrNWV/u0wN6/QPEIxP72wIAAA==" + } + }, + { + "ID": "f3ee09257d037770", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "39" + ], + "Content-Type": [ + "application/json" + ], + "If-Match": [ + "Ebkpq/E66/i28Qe6O1h+eQ==" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f4621107701c87f117ca35b5270848d9/17360042777906511676;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkZXNjcmlwdGlvbiI6ImQiLCJmcmllbmRseU5hbWUiOiJuIn0K" + }, + "Response": { + "StatusCode": 412, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:23 GMT" + ], + "Etag": [ + "2o9dlL5BSc2UFWtNlhwMWw==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:23 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIWNsQoCMRBEf0W2PgvFKh8gWJxY2MkVa3a9C+SyskkjIf/uBkHs7Ib3hpkKrCoKrn5CBnerQLJiSOBgjnLHCAMoY5ZOvCQKJUg6Sxm5mFo5Z5zZ3EX5qzdHDJHJfBSPnVxfz15aGIn1hxs7PbYjFr9AmwZ7IOsddvt/0629Ad0ZvLW+AAAA" + } + }, + { + "ID": "f2f4ad5c366206e7", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "37" + ], + "Content-Type": [ + "application/json" + ], + "If-Match": [ + "2o9dlL5BSc2UFWtNlhwMWw==" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d8e4ca71cad34edc0a5a36d5aa489ab0/477754593765030092;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkZXNjcmlwdGlvbiI6IiIsImZyaWVuZGx5TmFtZSI6IiJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:24 GMT" + ], + "Etag": [ + "ADCaKyMCuZyZDO9p590rOg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RbWvCMBj8L9lXtUmrrS0M9qIM2YvQbQiOITF9rJmxiUmqFNl/X+q6sY1NRsiXyz1391z2aMWLDCVozvNNCbo6yailBixqIbA0dy/ng0t6Xd1eltNqOhjHqhdjPc5PTx2D15NZKRjYtpLatqPQTxqBmY9JH8fEn5Ewit0J/QhjPHOXuFEDYnHDi5UTWFqrTOJ5u92uk0uZC6CKmw6Ta+8jlbf1PaXlCzBrvB+GXmNovP85N6wUFqChYICS/Qc2OuzzL5UmzeiXBtBrCy00hyIT1R1dOwNU24JhmivLZfEOUMbAGJQ87ZGWomZN0tHDMK3LUcA4FVdalsrhjddEcwvaOPnPifHk7sjAeFf8wS8N6ItquKZcODQIwyCOg4B0e+056VtM5NrG1I/iFQtylvPNcrMS/bmcL8uzDLYgpALdyZ3IljNwi8iysPWHffVKh+eDI+FSoNkh3XMLMQ20LuaBH9oivSCMiI/7pNvFTkBQY29lxhccsu8UgrskiGqKZLSp9vEevb4Bj5++6dcCAAA=" + } + }, + { + "ID": "78605ccecbd90f75", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "fca77d90a75f6f41614c065a867e6afc/2041930107868016732;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:24 GMT" + ], + "Etag": [ + "ADCaKyMCuZyZDO9p590rOg==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:24 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RbWvCMBj8L9lXtUmrrS0M9qIM2YvQbQiOITF9rJmxiUmqFNl/X+q6sY1NRsiXyz1391z2aMWLDCVozvNNCbo6yailBixqIbA0dy/ng0t6Xd1eltNqOhjHqhdjPc5PTx2D15NZKRjYtpLatqPQTxqBmY9JH8fEn5Ewit0J/QhjPHOXuFEDYnHDi5UTWFqrTOJ5u92uk0uZC6CKmw6Ta+8jlbf1PaXlCzBrvB+GXmNovP85N6wUFqChYICS/Qc2OuzzL5UmzeiXBtBrCy00hyIT1R1dOwNU24JhmivLZfEOUMbAGJQ87ZGWomZN0tHDMK3LUcA4FVdalsrhjddEcwvaOPnPifHk7sjAeFf8wS8N6ItquKZcODQIwyCOg4B0e+056VtM5NrG1I/iFQtylvPNcrMS/bmcL8uzDLYgpALdyZ3IljNwi8iysPWHffVKh+eDI+FSoNkh3XMLMQ20LuaBH9oivSCMiI/7pNvFTkBQY29lxhccsu8UgrskiGqKZLSp9vEevb4Bj5++6dcCAAA=" + } + }, + { + "ID": "c0cd01f81fcdf181", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "39" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "eabf1c3cb93a4f70cec2048ab04bf854/3606105621954226668;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkZWZhdWx0VGFibGVFeHBpcmF0aW9uTXMiOiIzNjAwMDAwIn0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:25 GMT" + ], + "Etag": [ + "RebHjWBmP+zGgP6sreLvyQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RXW/aMBT9L97jgNgJJASp0lYNdUj9zJh4mCbkODfBxYmN7cAY6n+vHYVprbaqtvxy77nnnHt8QlveFGiGcl7tWtDHDwW11IBFAwSWVq6TQf71cXVZ33/8fVXdx0bD9f74cHHhENxPFq1gYIdKajtM4nDWE6xDTKY4JeGaxEnqbhwmGOO1e8SNGhDlNW+2jmBjrTKzIDgcDqNKykoAVdyMmKyDs6tgHwZKy0dg1gSvBINe0ATvU+5RGZSgoWGAZqdzbdHt8y6W3s3iHwmgpwEqNYemEMdbWjsB5GXBMM2V5bI5F0raCrukuYD5L8U19b0b47pRjP1xIMoYGFf6cUJaCk+1yhbLeeYTVMA4FVdatsrVe0MrzS1o4zz8mbhb3b4xcHdo/oNvDejL47ymXHSe4ihNo4iMJ8OcTC0msrYpDZN0y6KKVXy32W3FNJf5pv1UwB6EVKBHlSPZcwZuEdk21v/q31rZ/POXN8xlQIvO3c8BYhq6hJa8i5RMojghIZ6S8dgnJaixN7LgJYfiJYTgSRjFHiIZ7fP//g09PQORjRil/AIAAA==" + } + }, + { + "ID": "dc93f82e80b5bf1e", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "23" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d9c81652ab62f986fc20f06f6175ea34/5242336535383564668;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJmcmllbmRseU5hbWUiOiJ4eXoifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:26 GMT" + ], + "Etag": [ + "oJOEKxnSNMfm+BhfgAmcQQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RXW+bMBT9L97jkoBNCiFSpbUamrItiUpT5WGaImMuxIvBjm3ysaj/fQbRapvaqli8nHvuOcfHF7TjdY6mKOPlvgF9/pBTSw1YNEBgaekm8usy+Xaq7xfzovp4uy3Km4rd3V1fOwZvN/NGMLBDJbUdRiGZ9gIb4uOJH2OywWEUuxOSyPf9jfuxWzUgiu+83jmBrbXKTD3veDyOSilLAVRxM2Ky8p5SeQfiKS1/AbPG+8/Q6w2N9z7nnpVCARpqBmh6ecJm3X3epdKnmb3QAHocoEJzqHNxXtDKGaDT+XfrDIZpriyXtcM6oKCNsCuaCUhOimvazubGTYPQbz9HooyBcdCPC9JStGrrdLZK0rZEBYxT8UXLRjm8z7TW3II2LsbzxnK9eGNheaxf4TcG9O05qSgXXaYwiOMgwOOrYYYn1seysjElUbxjQclKvt/ud2KSyWzbfMrhAEIq0KPSiRw4A3cR2dS2fdi/vdLk5vMb4VKgeZfu5wAxDV1DK961iq+CMMLEn+DxuG1KUGPnMucFh/xfCvZDEpCWIhnt+3+4R49/AEIv9Db/AgAA" + } + }, + { + "ID": "3c888c5e21ada5d1", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "34" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "213637aa7a297834809319baf39a43d0/6806512049469774348;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkZWZhdWx0VGFibGVFeHBpcmF0aW9uTXMiOm51bGx9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:27 GMT" + ], + "Etag": [ + "xs1tTJ8thS0pb7RmYVtLzw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1R72vbMBT8X7SvSSzZqX9BYRsLI6Nrwc0WxhhBll8cLbKlSM/x0tD/fXJwxza2UoS+nO7d3TudyV62FclJKetDB/b0quLIHSCZEEBe+5cfjuHqQ4q7e2rKpGi+fMabh/762jPkMFl1SgBOjbY4TeIwHwU2IWUpzVi4YXGS+ROHCaV04y/zow7U9ka2ey+wQzQuD4K+72e11rUCbqSbCd0ET6mCYxgYq7+DQBf8ZRiMhi54mfPIKmALFloBJD8/YcvLPi9SGdMs/9EAeZyQrZXQVup0yxsYOjw9DM7ghJUGpW495gEuBDhH8q9nYrUaiOtiuVoUQz8GhOTqvdWd8fhot7YSwTrv8Gvibn37zMBd3/6H3zmwb0+Lhkvl0SiOoyyLIja/mpYsRcp0gxkPk2wvolrU8rA77FVa6nLXva7gCEobsLPaixylAL+I7loc/ux3r2Lx5t0z4Qrg1SXdtwkRFvhQzEpeCmNXUZywkKZsPqdeQHGHH3UltxKqPymMJjTKBooWfKz20z15/AnJnrMX2gIAAA==" + } + }, + { + "ID": "af38555673789555", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "24f3689144d0ef71cea38e5beed6d713/8370687563572761244;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:27 GMT" + ], + "Etag": [ + "xs1tTJ8thS0pb7RmYVtLzw==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:27 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1R72vbMBT8X7SvSSzZqX9BYRsLI6Nrwc0WxhhBll8cLbKlSM/x0tD/fXJwxza2UoS+nO7d3TudyV62FclJKetDB/b0quLIHSCZEEBe+5cfjuHqQ4q7e2rKpGi+fMabh/762jPkMFl1SgBOjbY4TeIwHwU2IWUpzVi4YXGS+ROHCaV04y/zow7U9ka2ey+wQzQuD4K+72e11rUCbqSbCd0ET6mCYxgYq7+DQBf8ZRiMhi54mfPIKmALFloBJD8/YcvLPi9SGdMs/9EAeZyQrZXQVup0yxsYOjw9DM7ghJUGpW495gEuBDhH8q9nYrUaiOtiuVoUQz8GhOTqvdWd8fhot7YSwTrv8Gvibn37zMBd3/6H3zmwb0+Lhkvl0SiOoyyLIja/mpYsRcp0gxkPk2wvolrU8rA77FVa6nLXva7gCEobsLPaixylAL+I7loc/ux3r2Lx5t0z4Qrg1SXdtwkRFvhQzEpeCmNXUZywkKZsPqdeQHGHH3UltxKqPymMJjTKBooWfKz20z15/AnJnrMX2gIAAA==" + } + }, + { + "ID": "8d3ca3ff2edb3590", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "319" + ], + "Content-Type": [ + "application/json" + ], + "If-Match": [ + "xs1tTJ8thS0pb7RmYVtLzw==" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "2555cceb71fc47ab6c9a73460ba391f7/10006918476985322284;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJhY2Nlc3MiOlt7InJvbGUiOiJXUklURVIiLCJzcGVjaWFsR3JvdXAiOiJwcm9qZWN0V3JpdGVycyJ9LHsicm9sZSI6Ik9XTkVSIiwic3BlY2lhbEdyb3VwIjoicHJvamVjdE93bmVycyJ9LHsicm9sZSI6Ik9XTkVSIiwidXNlckJ5RW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LHsicm9sZSI6IlJFQURFUiIsInNwZWNpYWxHcm91cCI6InByb2plY3RSZWFkZXJzIn0seyJyb2xlIjoiUkVBREVSIiwidXNlckJ5RW1haWwiOiJKb2VAZXhhbXBsZS5jb20ifV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:28 GMT" + ], + "Etag": [ + "fGsMjudbocLmf/3NuFru4w==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RW0/bMBT+L+a1beIk5CYhsYmCiqBIGVMfpqly7JPU1IlTXxq6iv8+hwU00IaQ5ZfP383nHNGWtwzlqOT1zoI6nDBiiAaDJggMqd1LdaVvHywrJb1pKi9c2ktlo/7szDH4oGRWUDDTTiozTeIgHw3WgY9TP8PBGsdJ5k4cJL7vr93FTqpBVDe83TqDjTGdzj2v7/tZLWUtgHRcz6hsvJdW3j7wOiUfgBrtvQv0xkDtfS55ZBVQgYKWAsqPL9ji+T+fchnbLP4xAfQ0QZXi0DJxWJLGBaDHw68hGTRVvDNctg5zAKEUtEb5jyNSUgzEVbG4nxfDfDqgnIgrJW3n8DFupbgBpV3Cq+JutfxAcNe3/+FbDerrYd4QLhwaxnGYZWGIo9NpiVPjY9mYjARJtqVhTWu+2+y2Ii1lubHnDPYgZAdqVjuTPafgPiJta4ad/Z1VzL9cfFCuAMLetXtVvK13LeEcHknTCfiT8XOCqAIyjPKeP48Yn4ZxggM/xVHkOwNBtLmVjFcc2FsK9tMoGnYoJCXjMr5/Q0+/AZNE5FcMAwAA" + } + }, + { + "ID": "967a9ec27b3d9423", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "269" + ], + "Content-Type": [ + "application/json" + ], + "If-Match": [ + "fGsMjudbocLmf/3NuFru4w==" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7d071f4e3e03f3200baa6a283b04ec4a/11571093991088309180;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJhY2Nlc3MiOlt7InJvbGUiOiJXUklURVIiLCJzcGVjaWFsR3JvdXAiOiJwcm9qZWN0V3JpdGVycyJ9LHsicm9sZSI6Ik9XTkVSIiwic3BlY2lhbEdyb3VwIjoicHJvamVjdE93bmVycyJ9LHsicm9sZSI6Ik9XTkVSIiwidXNlckJ5RW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LHsicm9sZSI6IlJFQURFUiIsInNwZWNpYWxHcm91cCI6InByb2plY3RSZWFkZXJzIn1dfQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:29 GMT" + ], + "Etag": [ + "8blwedP+5tcT7pXkSLffEA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RbWvbMBj8L9rHJbFkJ36DwjoWRqBrh5uRwhhBlh47mhVLkeR4Weh/nxzcso2tFKEvp3vu7jmdUSNajnJUivrQgTm94dRRCw5NEDha+5e0lD3wz28Xjq0T/dDc31TV8vrqyjPEMMk7ycBNtTJumsRhPgpsQ0xSnJFwS+Ik8ycOE4zx1l/iRy3I6ka0jRfYOadtHgR9389qpWoJVAs7Y2ofPKUKjmGgjfoOzNngL8NgNLTB65xHVgEVGGgZoPz8hK0u+7xKZUyz+kcD6HGCKiOg5fJ0S/feAP04/RycwTIjtBOq9ZgHKGNgLcq/npFRciBuitV6WQz9aGCCyo9Gddrjo93GCAfGeofnibvN7QsDd337H35nwbw/LfdUSI9GcRxlWRSR+WJaktRhovYuo2GSNSyqWS0Ou0Mj01KVu+4dhyNIpcHMai9yFAz8Iqpr3fBnv3sVy+sPL4QrgPJLum8TxAzQoZi1uBRGFlGckBCnZD7HXkBS6z4pLioB/E8KwdlIUYyO1X65R4+/APs4+JLaAgAA" + } + }, + { + "ID": "96fa534c85b030c3", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "edb7b9f7dac14ae93630b5ecea97cb5d/13135268405696445260;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:29 GMT" + ], + "Etag": [ + "8blwedP+5tcT7pXkSLffEA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:29 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RbWvbMBj8L9rHJbFkJ36DwjoWRqBrh5uRwhhBlh47mhVLkeR4Weh/nxzcso2tFKEvp3vu7jmdUSNajnJUivrQgTm94dRRCw5NEDha+5e0lD3wz28Xjq0T/dDc31TV8vrqyjPEMMk7ycBNtTJumsRhPgpsQ0xSnJFwS+Ik8ycOE4zx1l/iRy3I6ka0jRfYOadtHgR9389qpWoJVAs7Y2ofPKUKjmGgjfoOzNngL8NgNLTB65xHVgEVGGgZoPz8hK0u+7xKZUyz+kcD6HGCKiOg5fJ0S/feAP04/RycwTIjtBOq9ZgHKGNgLcq/npFRciBuitV6WQz9aGCCyo9Gddrjo93GCAfGeofnibvN7QsDd337H35nwbw/LfdUSI9GcRxlWRSR+WJaktRhovYuo2GSNSyqWS0Ou0Mj01KVu+4dhyNIpcHMai9yFAz8Iqpr3fBnv3sVy+sPL4QrgPJLum8TxAzQoZi1uBRGFlGckBCnZD7HXkBS6z4pLioB/E8KwdlIUYyO1X65R4+/APs4+JLaAgAA" + } + }, + { + "ID": "1db6cbfc6da8e8a4", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "29" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "51b192d34e8ab31c8b4261954290e021/14771500414308955356;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJsYWJlbHMiOnsibGFiZWwiOiJ2YWx1ZSJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:30 GMT" + ], + "Etag": [ + "nnyL9Y8a6+BeQaDmGw1Mag==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1R62rbMBh9F+3nkliyXV8Cha00lEAvzOsIY4wgy18cLbLkSHI8L/TdJxl3bGMrxRjM0bnp+IwOXFZoiUpeHzvQw5uKWmrAohkCS2t3IuVwm3/OaPL2Cj7Q6+amJ3e0vrx0DO6VVScY2HmrtJ2nSbicDLYhJhnOSbglSZq7JwlTjPHWvcRJDYjdLZcHZ7C3tjXLIOj7flErVQugLTcLpprguVVwCoNWq2/ArAn+CgymQBO8LnliFbADDZIBWp6fsfV4n1e5TG3W/1gAPc3QTnOQlRjuaeMC0Pfhh08GwzRvLVfSYQ4QtARhfIHxy4EnKjrwBpQxMO7oyxlpJbzHplg/rgo/XQuMU3GjVdc6fGqy0dyCNk77S/GwuX9B8NDL//A7A/pqWDWU+0pRkkR5HkUkvpiXJLOYqMbmNEzzA4tqVvPj/ngQWanKffeughMI1YJe1M7kxBm4i6hOWv87f88qVu+vXyhXAK3Gdl9niGmgfrNHPm5JLqIkJSHOSBzjcURj71TFdxyqPymE4CSOPUUxOq3+6SN6+glm4sAt9QIAAA==" + } + }, + { + "ID": "83c376d5e6bc59e0", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "26" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8b3f4434f50d0d0286403d158c0d248a/16335675932706843756;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJsYWJlbHMiOnsibGFiZWwiOm51bGx9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:31 GMT" + ], + "Etag": [ + "a4fXpFjhYTJmfw+nnLP/fg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RYW/TMBT8L+YjbR0nadJEmgQTBRWNDWVFBSFUuc5L6tWxXdtp6Kr9d5wqQwzBNFn+cr53d+98QjsuS5SjDa/3LZjjq5I6asGhEQJHa/9C4+qrfn+3/bb82FTdaymvPuOqvrjwDN5Plq1g4MZaGTdOkzAfBNZhQGZBRsI1SdLMnyRMgyBY+0v8qAVRXXG58wJb57TNMe66blIrVQugmtsJUw1+TIUPIdZG3QFzFv9liAdDi1/mPLAKqMCAZIDy0yO2OO/zIpUhzeIfDaCHEaoMB1mK4zVtvAH6ebzvncEyw7XjSnrMA5QxsBbl30/IKNETV8ViOS/6fjQwTsUHo1rt8cFuZbgDY73D74mb1fUzAzed/A+/tWAuj/OGcuHRKEmiLIsiEk/HGzJzAVGNy2iYZjsW1azm++1+J2Ybtdm2b0o4gFAazKT2IgfOwC+iWun6P/vTq5i/ffdMuAJoeU73Y4SYAdoXs+Tnwsg0SlISBjMSx4EXENS6T6rkFYfyKYUQEkfTnqIYHar9cosefgH2Vw202gIAAA==" + } + }, + { + "ID": "a61f616e579eed4f", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "360" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5fb81788f96b5155d6bf366633e5edd6/17899568876616459772;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDQifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:31 GMT" + ], + "Etag": [ + "uNxDH+IE05X65l5hLFMQTg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Sb0+DMBDGv0t96VwpCiiJLzZXdQluipiYGLN0cGNVoEg757Lsu3uwLTP+T9OQu3uee35pWJJnWSTEJ2OZvsygWuwZMc6AtAgYkWJ/NnjrXe73ueXcu07mTIPzq5soPT1Fhax9ySyLwRyUqjIHnmv7iTBCgxnZFju2Tpg9Yq53gse1PcuyRnhZu4n4RXGEyzVkk0AWzxgxNabUPqXz+bydKpVmIEqp27HK6Zaavtq0rNQTxEbTT0h0g6TpP9how6bpfxAbTQgTqKCIgfhLskHof/MwqN/Er6d/o2wTGv3fPCt8s3gKuahBJhKyRBP/YUkKkSPb+oMbF2Vd3UZhf3CBnt18luvdvD+I+AUPsZGrpG6E/Jp3It77aKkg3jlCfjYMe1h/jR4rle2E3eEw4J0BWT3iadW53YUBNBCLNGWgijSC6nM7VPNtFVcgjFRFJJv9zDl0PWYzxjzHqf/ct1JW3wjcY3yo2p8Jba5UIhE1+WHHBjbqdANeO1TcLMTW3S1ZvQMe8VhgNgMAAA==" + } + }, + { + "ID": "a4e54172f742b8de", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0004?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "29" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "13242aa12f06a2ee272d5c442bd7a767/1017281791986605452;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0004?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJsYWJlbHMiOnsibGFiZWwiOiJ2YWx1ZSJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:32 GMT" + ], + "Etag": [ + "MGN1NkcBsLxwM+ejeJciDg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SUW+iQBSF/8vs41qHoRWqSR90JcYNYkPZp2ZjRrjSqQPDMmOpMf73vUM1NG6zbSYE7r3n3PNlwoFsRZmREVmL/M8O6v03w9cSSI+A4Tn2F7OIRdt0osPXZvEdnuFnKqb53R0qhPVlO5mCuapUba58zx1l3HANZuU67NYZMnfFPH+Ix3N9x3FW+LB+G/EfxQ0u1yA3oSi3GPFkTKVHlDZN08+VyiXwSuh+qgp6pqYvLq1q9Qyp0fQCiZ6QNP0CG23ZNP0KYquJYQM1lCmQ0YGcEOYfXAzqT/Fv089Rzgmt/nOeY49IvgapLUj7hbYXLndgRzp9goLb0UaAzFD0eCAlLxD77YVh+8pWD0k8j2bo6ea7QnfzeZQEsyDGRqEy24iD+2CcBNP3lhrSzhEHP5bxFOt/o9dKyU44WS7DYByR4288PZs72RtAA3FIW4aqzBOoL9uxas5VWgM3QpWJaPezwbXnM5cx5g8G9qd+rUT9gcC7xTu0fsm1WahMIGp2ucO9vhl2sMl4EgbWodJ2IbZ+PZDjX2CLyAdRAwAA" + } + }, + { + "ID": "5c7f596033eed434", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0004?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "26" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7462f22a968f59df040c9359ac4b1bba/2653513800599115292;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0004?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJsYWJlbHMiOnsibGFiZWwiOm51bGx9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:33 GMT" + ], + "Etag": [ + "ropu8wvxW8nVzWgKKTi69g==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SUU/CMBSF/0t9VbpO2WAJD6CLISKYOeXBGFK2y6xu62yLAwn/3bsJmUGjpmmWe+8593xptiEvIo+JR+YieV2CWh8ZPk+BHBMwPMG+ksWyU76tpp38/n2aXF2FwukmvR4qROWLl2kE5qSQypy4ju3F3HANZmZbrGN1mT1jjtvF49iuZVkzvKxVR/yiOMPlGtLFSOQvGPFkTKE9SsuybCVSJinwQuhWJDO6p6ZvNi2UfIbIaHqARHdImv6DjdZsmv4HsdYEsAAFeQTE25AdwvCHh0H9Lv5z+jfKPqHW/82zxTeLniDjFchCQBpr4j1sSM4zZPv84MZ1UVW3YTAcX6KnmS8z3cyH49C/9ANsZDKuGoF/4/dD/+KrRUHUOAL/fBJcYP09ei5l2ggHk8nI74/J9hHPcZU7WBtAA7FIXY5knoSgDtuBLPdVpIAbIfNQ1PtZ+9Rxmc0Yc9vt6s9dFUL9IHA6+FCVP+XaXMtYIGp8uOPUOms3sGF/MPIrh4zqhdi6uyXbDzu9ORc2AwAA" + } + }, + { + "ID": "9037b4a511a9ba93", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0004?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b375edd8e36da2de6c8b0ce324b96578/4217688219502153388;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0004?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:33 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "3ea17b5ff83bc22c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "360" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "08baa60693f7161db2e9b80b2b93552e/5781863733588363068;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDUifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:33 GMT" + ], + "Etag": [ + "rAtFXobmrjkZoWr2Wf9XcQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SYU/CMBCG/0v9inQbcYMlfgCZhgRB5wxEY0jpjlnZ1tkWkRD+u7cJwSgqaZrl7t733ifN1mQu8pj4ZCqS1wWo1Ylh0xRIjYBhCfZV21yO5TRTL/MHOVLOaNYa89vzc1SI0hcvUg7mtJDKnHqu48fMMA1m4lh202rZzsR2vRYe1/Esy5rgtetVxB+KM1yuIZ31RT7HiGdjCu1Tulwu64mUSQqsELrOZUZ31PTNoYWSL8CNpt+Q6BZJ0yPYaMWm6TGIlSaEGSjIORB/TbYIvQMPg/pt/Of0f5RdQqX/n2eDb8afIWMlyExAGmviP65JzjJk+/zgxlVRVndR2BtcoWc/X2R6P+8NouAqCLGRybhshMFN0I6C7leLAr53hMHFMOxi/TN6KmW6F3aGw37QHpDNE55amdtZGUADsUhV9mWeRKC+t0O53FVcATNC5pGo9ttnDdezHdtueK5X/rnvhVAHBG4TH6r0p0ybaxkLRI1/2bGFjdqdflA6JK8WYuv+jmw+ABuL8qk2AwAA" + } + }, + { + "ID": "a00f88e25beaa3c8", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026pageToken=\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c60c0e6818769122f98d108cd7cf720a/15823211039416877956;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026pageToken=\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:34 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/AwQhu5HNv9TofY9Hp7n969iUfH4\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:34 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAM2TW0/CQBSE/8v6Ctpt6fUNg0IjEjQQg0KapT3gam9styoh/Hd3uUQTG1FUbJq+dOfMmc6XXaBHGgfIQWM6neXA5kecjENo04yjCgJOpuJsiNrk1oqVWsO6iJou9INu6HbaEZCbZnZSf766z/VW58nuJZOB3UrN2DZs2p+0akMkTFaGGXLuFsW7hITKr0Ee+sCracJ41TRUJyCcZMA9VcGWYmPVw4Zpi8dQTUVRPPHiY+5FIqNUeilhnHKaxJ4f5hkH5inb5dcwAQaxD8hZoJQlD+Bzt2Cl0G+Wrk93B9huWOl3hFkK7TwVGVCvfto+k6M0gu5WSeOpjLeRNOoDObCZ3pxNKISBbBLFJAI0kgIGRE73hJUYw7pmmFhVLN3S5e/DS0pZgcCwRHoZ6dBMcJmY4O8zeV/pZSYLXfe4PylLN3EZSallIqXuQ4rBLKfsTXNOQ+GFHM5y+AExG2tGKYlpZSKm/dbdqqzRrPPBH2Ktaf93EaXBJwr90GR35vkIt7hWjDXTML9Q60gYJpyELodI8NKXryff0CWaCAAA" + } + }, + { + "ID": "8696f464b97eaa2f", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0005?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "382c8b3bb01a5e280a8968ba0f4bc6a2/17387386553519864596;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0005?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:34 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "f6f62ba2ef427e09", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "360" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "155d8941b52172da0766dc4ec52014e6/505098369378383012;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDYifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:34 GMT" + ], + "Etag": [ + "X1Lt8cWOHQEz0ItOBjJFEA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Qb0+DMBDGv0t9qytFZZPEF5tWncGhiNHEmKUrN6wCRdo557Lv7oFbZvyfhpC7e557frk5eVRFQnwyUunTBKrZhhWjDMgmAStS7N+wwHbkdXhywV+dvg17D6dHvLu/jwpV+5JJJsFulbqyW23P9RNhhQE7dB3WcfaYO2Reew+f57Ydxxnix1pNxC8KD5cbyMaBKh4x4t7a0viUTqfTVqp1moEolWlJndMVNX12aVnpB5DW0E9IdIlk6D/YaMNm6H8QG00EY6igkED8OVki9L85DOqX8e/Tv1FWCY3+b54F3kzeQy5qkLGCLDHEv52TQuTI9v7DjbOyri7jqD84Rs96PsnNet4fxPyYR9jIdVI3In7OuzE//GipQK4dET8Io0Osv0aPtM7Wwl4YBrw7IIs7fJt1bm9mAQ3EIU0Z6CKNofrcjvR0VckKhFW6iFWzn+1ue23mMraz69VjeClV9Y3A6+ChakEmjD3TiULU5IcdS9i42wt47dCyWYitq0uyeAOTlbrpNgMAAA==" + } + }, + { + "ID": "f1d148a7d8ff64e2", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/insertAll?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "215" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6717744ea99593720eaa9e3143ff936a/2141330378007669812;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/insertAll?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJyb3dzIjpbeyJpbnNlcnRJZCI6ImEiLCJqc29uIjp7Im5hbWUiOiJhIiwibnVtcyI6WzBdLCJyZWMiOnsiYm9vbCI6dHJ1ZX19fSx7Imluc2VydElkIjoiYiIsImpzb24iOnsibmFtZSI6ImIiLCJudW1zIjpbMV0sInJlYyI6eyJib29sIjp0cnVlfX19LHsiaW5zZXJ0SWQiOiJjIiwianNvbiI6eyJuYW1lIjoiYyIsIm51bXMiOlsyXSwicmVjIjp7ImJvb2wiOnRydWV9fX1dfQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:34 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTMK04tKnHMyQlKLS7IB3KUagGmFzWCLgAAAA==" + } + }, + { + "ID": "0ea40d76c9cc1e5f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9b9388d51a843f455542ad16dee5a9f5/12110621189293107580;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:35 GMT" + ], + "Etag": [ + "a9WUQO9SRFFMJtQWcAmZKA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8onWoaHBvpbBge5ufl6lQSGJzvmRnk72toCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsA+lWqtUBs6B8A6XaWKgIsrKSotJUkAxEEiGehKbdkDTtyWjajQhqj60FALwx8C0ZAQAA" + } + }, + { + "ID": "fa96becd36141979", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c3e5997d8f2f8f3a2908821bef9880d0/3705505896388781508;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:35 GMT" + ], + "Etag": [ + "X1Lt8cWOHQEz0ItOBjJFEA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:35 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyglA6SiWVBSBecEiQp5+7Uq0OQr40txgh7+kX4uruGgQUyM1PAQkEuQa4Ooa4uiBrKUpNRugIcnX2D3IB8jGtTsrPz0EodPL393F19FOqjQXCWgCN1fK3tQAAAA==" + } + }, + { + "ID": "de65ee1314ed0b04", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a3286f58093ee0208819daea82ebdde3/13746852098427543820;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:36 GMT" + ], + "Etag": [ + "a9WUQO9SRFFMJtQWcAmZKA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8onWoaHBvpbBge5ufl6lQSGJzvmRnk72toCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsA+lWqtUBs6B8A6XaWKgIsrKSotJUkAxEEiGehKbdkDTtyWjajQhqj60FALwx8C0ZAQAA" + } + }, + { + "ID": "7ac2d1a81f27efa7", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3f530e83058ff902bc1777b89b4c29b0/5269680310996917588;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:35 GMT" + ], + "Etag": [ + "X1Lt8cWOHQEz0ItOBjJFEA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:35 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyglA6SiWVBSBecEiQp5+7Uq0OQr40txgh7+kX4uruGgQUyM1PAQkEuQa4Ooa4uiBrKUpNRugIcnX2D3IB8jGtTsrPz0EodPL393F19FOqjQXCWgCN1fK3tQAAAA==" + } + }, + { + "ID": "5cf0294d8bf66a18", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "307" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "78bca815831916007993eac955766853/6905912319609427684;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7ImRlZmF1bHREYXRhc2V0Ijp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn0sInF1ZXJ5Ijoic2VsZWN0IG5hbWUsIG51bXMsIHJlYyBmcm9tIHRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwNiIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoibHJYMWRLZm1WbUxVN21zZkNudGhsZXVpTjJmIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:36 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/AILe_0KyxhnYiDnowGESJAXrLjA\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVT62rbMBR+laD9TWPZTnwJjC0kXvBqwpZLL6NgZPnIUWNLqS03CyXvPslNoXQjwxiEzne+yzn2C9pxkaMxynjx1EJ9/PQoM9RHoEihbx9QQn4FAg9nwXU1j2GT/yjjRVIBuZ031iROIMXXx99bcc9nQh7m0er75K5OHicPSJNwQ5y3JQV1tZe1uvI9Z7xZDcr6zs6vWXVTJRu/athUqG0JLV84THc1ULKEi53u3Sq1b8aWdTgcBoWURQlkz5sBlZX15td6dqx9LR+Bqsb6oGXpLI11Qe1LKSlRXIrPm5VW1vAlMKhBUEDjF3Tmjf8R4xXdVS6neVPQQK1x6iMqBeNFW59vXwzP+rjXgujnJlre654umCmdD2Yk2kdPkAr6PdFWTb9XA+2xWlY9RbISUgfbAQ5tJ7U9P9SP5/gY41S/nibMoVFcdIprA/9/uJwo0sBrNaUBC3CGw8wOMoYdBmzkDyngEQ5ghIfAvDzwPY/ovs5N10WEFIT4NobMTh3fc9Mho24aUAopsGzoUQweI7SbSQ1EwYw3e9nw87Smy2iyjtL4W7qIolk00+SHmn9E3S5jDVovN4upRndRGWlLNXv1b4K+j3I+XxiXrTkujeZkylxqJ2Yx8WIdLSfTdXxjtNsGEigIPa6eSjRmpGzgpPGNIqptjBVzMovWdhfxYo7ORa63QztANwizJV4ZnD1yPd92bNsbugHqwLX6q+aF9vuPphOpQKjzV7WKkmi6RsaJNlinUBGu7SHX89wwdF17OLrSm1XYlpUKieOHO+oWtOBP26ddGWQy27Zfc3iGUu6hHhSa45lTIJTKVijzM6LTH5KGy1NHBAAA" + } + }, + { + "ID": "bccd4ce4334021de", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/lrX1dKfmVmLU7msfCnthleuiN2f?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "40b04c397074ac60a282a3738112e62d/8470086734217563764;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/lrX1dKfmVmLU7msfCnthleuiN2f?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:37 GMT" + ], + "Etag": [ + "NkQn8l6h4jh9ZZ1bHA05HA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/22RzW7CMBCE32V7DRL0B9pIHAJYgBoFMFBVVD0kzoYE7Di1N6oQ4t3r0ErpAfmwHnk+76x9hmNRpuBDUuy/ajSnuz3SqtlwtLUk60qlS4vgAVK8d87ouCqfZT9/POQvu10vmQXdp1kwHDqHFTmqGPwzZAXK1IL/cYYyVuiwa/GATlWj1hs+j6ZOK502OtqGYTAKGVy8lqiVbYl5tGFTxluEsyULNmzyHzEoWoKz8YJPbvTwbsRLtJYtOlosQhZEt/J9uuXBQSccMzRYCmzmrYw+oKB585RpLQVSp9KGOoP+PVzd1xNp3nvpa6beVLgdKJuNS8ol1kV0nzmX1CKmQpfOuF27qYA0xZLrbxcUHuBPj06Edmm0QGuxubT722CsVSWRXBoyNXogYvcZs4LAz2Jp8fIDOHBi6eoBAAA=" + } + }, + { + "ID": "54c2b7975b9ded5f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonaa710eb1_2763_4fc3_8cce_efb46c0e6fac/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "40b04c397074ac60a282a3738112e62d/64971441296460732;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonaa710eb1_2763_4fc3_8cce_efb46c0e6fac/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:38 GMT" + ], + "Etag": [ + "lYp7Lg9TUX59KZ2nK3hNVw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8rnRBaY+6RbhoRGmFp6RxnleRtn+IWV29oCVZTklyTmBOWXFwOVGQP5RWBmdLVSGpgsAwonKtXqgFlQvoFSbSxUBFlZSVFpKkgGIokQT0LTbkia9mQ07UYEtcfWAgCkADU1GQEAAA==" + } + }, + { + "ID": "8ac1829693772108", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "307" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "181a7970a91dc7f5519682e078ac793d/1629146955399447372;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7ImRlZmF1bHREYXRhc2V0Ijp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn0sInF1ZXJ5Ijoic2VsZWN0IG5hbWUsIG51bXMsIHJlYyBmcm9tIHRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwNiIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiUFBpMTV1Y3Q1M0wyaWFQdGtZQlNjM1lEVnU4IiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:38 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/UNaM7aGyWdF3982EOLP3HcjZa20\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVT62rbMBR+laD9TWP5bgfG1iVuZpZlWS4tLQUjy8euGttKLDkhlLz7JDeF0o0MYxA63/ku59gvaMPqDA1RyopdC83x0zNPUR+BJIW6fURT8hDU2BkHP6pJDOtsXsazaQXkbiKM9Yz89MnkeJfd2GFgRb+mc/s7fX4gFn5EioRp4qwtKcirLW/kle9Zw/VyMJ8z022pdO2pxchcbu6/Lal9P75tA9UloMynrN6o3icpt2JoGIfDYVBwXpRAtkwMKK+MN7/G3jK2DX8GKoXxQctQWYRxQe1LySmRjNef10ulrOALyKGBmgIavqAzb/yPGK/ornI5zZuCAiqNUx9RXuesaJvz7YvmWR23ShD9XkeLe9XTBdOl80GPRPno1aSCfq9uK9HvNUB7ecOrniRpCYmFzQCHppWYnh+qx7N8jHGiXk8RZiAkqzvFlYb/P1xGJBHwWk1okAc4xWFqBmmOrRxy13coYBcH4GIHci8LfM8jqq9z03WRmte+8kRyD5Icp2niZA5OiA1uYmYmUOq4Qei43UwaIBLGTGy5YOdpjRbR9SpK4ptkFkXjaKzIDw37iLpbxAq0WqxnI4XuouakLeX41b8O+j7K+XxhXKbiuDSaky4zrpzoxcSzVbS4Hq3iW63dCphCQehxuSvRMCelgJPCC0lkK7QVfdKLVnZn8WyCzkWmtkM7QDcIvSVWaZzp2p5vWqYZOGpQHbiRf9W8wH7/0XQiFdTy/FUto2k0WiHtRBlsEqgIU/aQ7Xl2GNq26bhXarMSm7ySIbH8cEPtghZs97TblEHK06f2awZ7KPkWmkGhOPaMAqGUt7XUPyM6/QFIeZyRRwQAAA==" + } + }, + { + "ID": "69109145ce06044d", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/PPi15uct53L2iaPtkYBSc3YDVu8?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "dcf9e2d73bcbce0263fcf501c4c4ed11/3193322473797336028;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/PPi15uct53L2iaPtkYBSc3YDVu8?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:39 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/UNaM7aGyWdF3982EOLP3HcjZa20\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:39 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVSXWvjMBD8K0bPKUj+Tt56sXsYgsk5To88GVleFbW2lcoyRwj+7yepfig96CEEi2Z2d3ZWd/Qq2wo4KBgZoN0dXZV8BaaLDu1QN/cM9MNVKv2QxD7aWLZDjkdBopnpKDj4gh712+XHiQWX7HlODauXjGohR0M8n9CyQUyOXLzMan292zr17Woaol/nvLqYnPcZ1M1Ca4Am6I0Ob6QDbLxxHqaNp4B5XMnB07TtofExSfGW+A2Jk605sZ9gjBtzY1Owg0mL0XWsLf3/w3VU0wk+0IalPMUt3rYkbTn2OfAoCRngCKcQ4RB43KVJHFOT59S4LDrKMTGaKI+h4bhtm7ALcUMDiBrSEWAsjNJtGDlPFFANmZiuchKrW/sqf6zzpnhqyjzP8swU/6PEV9bvqjCkujqXe8N2o3I69zr70G8H/TzKGn9jFzE1vrNmsbCQRoldTFHWefW4r4tn23ue4AAvlN1O7z3acdpPsBj+pKmeJyvFRnbRRm5ZlD/RCgqzHeYIzgi7JTFYHomCOCE+IWlojHJkpf/B4jT4/GlckwFGvf6qU37I9zValuUvXSMdiuICAAA=" + } + }, + { + "ID": "18d40e9abc5de9b8", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/PPi15uct53L2iaPtkYBSc3YDVu8?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "fa88643cb22e64a7edb1b7805620dc6a/4757215417706951788;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/PPi15uct53L2iaPtkYBSc3YDVu8?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:39 GMT" + ], + "Etag": [ + "PBIdyrlaRCuLCPeTsBBmOg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/22RUWuDMBSF/8vdq4WtpdsQ+lBt6ARRl9pBGXtI462zjcYlV4aU/vfFbuAeSh5uDjlf7rnJGU5VU4AP+6r86tD0dyXS67DhaDtF1pVWNxbBAyRROmcWREVvlOBhF4cZ5jYI6rRcLJzDyk+sBfhnOFSoCgv++xkaUaPDrsUD6ttBbXIeJWuna10MOtnG8TKIGVy8kehqOxJRkrM14yPCWcaWOVv9RwzKkeAsTPnqRg/vRry91mpEgzSN2TK5le/DLQ+Oes/xgAYbicO8rdFHlBQNT1l0SiJNWm1o8vQ4hav7epJl1cO8kzSfxdNKZHTaBRs5263eumfnUloKqnTjjNuNmwpIk1Bcf7ugMIM/HfSENjNaorU4XHr/2yDUdauQXBoyHXoghfuMl4rAPwhl8fIDbyfvBeoBAAA=" + } + }, + { + "ID": "fd0b63146166beea", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon7809af6e_f0bb_4d40_a3e5_1d1ecc458945/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "fa88643cb22e64a7edb1b7805620dc6a/14798562719240564916;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon7809af6e_f0bb_4d40_a3e5_1d1ecc458945/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:40 GMT" + ], + "Etag": [ + "WtMREdw0pxUcf3j5mO+M+w==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qHl/gGuaaUGxRUhCanGWeZ5vpr+2qX29oCVZTklyTmBOWXFwOVGQP5RWBmdLVSGpgsAwonKtXqgFlQvoFSbSxUBFlZSVFpKkgGIokQT0LTbkia9mQ07UYEtcfWAgBkLvnjGQEAAA==" + } + }, + { + "ID": "9285fe28868bdb2b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/PPi15uct53L2iaPtkYBSc3YDVu8?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a221793620b1b8be6fcb6c83ea4c552e/16362738237621676356;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/PPi15uct53L2iaPtkYBSc3YDVu8?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:40 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/wL_KfRMWxpj-uu3t8SmpPCaLZZw\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:40 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAM1WXWvbMBT9K0HkYYO2SHZiJ4Y99CNjhWYJSUofRgmOfdNqU2TPlteFkv++q+s4H467PYzBKAXrnqNzpat7pLyy3ISmyFnwSl/AAnYz+jxgmzMay9zIiNAoAxwmeiZXliS6rucLR4hep9NlRM7MCeb1XMRAx3Wk73sWMYkJ1dXaQD7OkgjyHGJkcUS+F5CtbV76GKtQs+DLK9Mh6Uw5D1q3Oi0MUmU1h9YwzI/ycE+UK6jH+z7GX0JpJnZblz+eWMAveBka5jQm0R1lGP48otCYKFiZuKZiQ4cqO8pepaTsVaJkhfuBIyEX1+90d1il2K3RK9ETeqlu6S+ZrGl3vJ7f3QKVsHfErGSPmaWmZebPxXKpYFQYzEaniECv04hMU6nU7nQziJIszidYAoy4+8gD5jCgt8E0zEKcpeik6fy2G1dgIB43oVU7s+vRcHw3mA0oBmlO7fNNaptwMri8sfFiUUGsLQLbW2etthPoYpXjhxvgoi7aMp/rxMx1oRQGOxRcJIlCgY+T0bBlwoWCucNFj/eFMxee38c/z/E553P899jj5myX+mFyW67pKLdNazPaBAjORq35HHfyBCiRUBFRhGR2BhBBqyxv5QDxhgOEzxsd4ArHTrXFm9pUtBTOHk9d0ek7ouyAA2+Qf+vmqDG3reL+S48ILrpNHhFus0lO+aU88WsuEeT2Q4MIp3dqkUPaVoxojf5wm53z//uj1qPU+w1dum91m+H+tNkd3go+tN61O1bs/V+ZQxyaAxsX8LVa4SMWNz4piIGSGminoMIUodITjutUj9FUJVsD+TZZir6R+uleS6ogP6xvFXSYzU2zseRG2lfyNPmbL90euTpsgQUOMPNMQoYdVl+dI/p2KWH0DJ+kYcEyVDnYLllCBjqCeGZvpfJQ0yz5CpG5tcpxoSIw52mSmXO8o1AjDk2YwxYtv39zmdkWoguP+H+++mxl6HfFCrSZrVO6uwZ3g+sZ22w2vwAzkX1kfggAAA==" + } + }, + { + "ID": "018f46de96ac24e1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b4f204cdfe9fd5e349aa741c44ff8a3f/17998969146756112852;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:40 GMT" + ], + "Etag": [ + "X1Lt8cWOHQEz0ItOBjJFEA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:40 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyglA6SiWVBSBecEiQp5+7Uq0OQr40txgh7+kX4uruGgQUyM1PAQkEuQa4Ooa4uiBrKUpNRugIcnX2D3IB8jGtTsrPz0EodPL393F19FOqjQXCWgCN1fK3tQAAAA==" + } + }, + { + "ID": "98f4a6a3b7764536", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "4b31f9527a8d79b5c8ba765b06f72b50/7957622940422448524;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:40 GMT" + ], + "Etag": [ + "a9WUQO9SRFFMJtQWcAmZKA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8onWoaHBvpbBge5ufl6lQSGJzvmRnk72toCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsA+lWqtUBs6B8A6XaWKgIsrKSotJUkAxEEiGehKbdkDTtyWjajQhqj60FALwx8C0ZAQAA" + } + }, + { + "ID": "51e6721f52f59ae0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "fa50e22715b8956e3bb01dc9e9f585d9/9521797359325486364;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:41 GMT" + ], + "Etag": [ + "a9WUQO9SRFFMJtQWcAmZKA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8onWoaHBvpbBge5ufl6lQSGJzvmRnk72toCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsA+lWqtUBs6B8A6XaWKgIsrKSotJUkAxEEiGehKbdkDTtyWjajQhqj60FALwx8C0ZAQAA" + } + }, + { + "ID": "e5c050133f2501a3", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a0093d0b34b2a9ab559d20987db20813/1116682062109481572;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:41 GMT" + ], + "Etag": [ + "X1Lt8cWOHQEz0ItOBjJFEA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:41 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyglA6SiWVBSBecEiQp5+7Uq0OQr40txgh7+kX4uruGgQUyM1PAQkEuQa4Ooa4uiBrKUpNRugIcnX2D3IB8jGtTsrPz0EodPL393F19FOqjQXCWgCN1fK3tQAAAA==" + } + }, + { + "ID": "61013beff392a86c", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1db2b5040241ab73049dc035c9660560/11158029367937996460;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:41 GMT" + ], + "Etag": [ + "a9WUQO9SRFFMJtQWcAmZKA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8onWoaHBvpbBge5ufl6lQSGJzvmRnk72toCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsA+lWqtUBs6B8A6XaWKgIsrKSotJUkAxEEiGehKbdkDTtyWjajQhqj60FALwx8C0ZAQAA" + } + }, + { + "ID": "b3637af98d4e40d2", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "937caeb65a2be8db2d5361926a324767/2680857576212468468;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:41 GMT" + ], + "Etag": [ + "X1Lt8cWOHQEz0ItOBjJFEA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:41 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyglA6SiWVBSBecEiQp5+7Uq0OQr40txgh7+kX4uruGgQUyM1PAQkEuQa4Ooa4uiBrKUpNRugIcnX2D3IB8jGtTsrPz0EodPL393F19FOqjQXCWgCN1fK3tQAAAA==" + } + }, + { + "ID": "b7533d90dc7a4ba3", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7aee1c64fcd8b29a5b1201f6442aa5b8/4317088489625029508;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0006?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:42 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "ddb9667a4acb1a5a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "1956" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3dabf7deb467f828528833360df89951/5881264003728016148;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJtb2RlIjoiUkVRVUlSRUQiLCJuYW1lIjoiTmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVFVSVJFRCIsIm5hbWUiOiJCeXRlcyIsInR5cGUiOiJCWVRFUyJ9LHsibW9kZSI6IlJFUVVJUkVEIiwibmFtZSI6Iklud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FRCIsIm5hbWUiOiJSZWNvcmRBcnJheSIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDcifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:42 GMT" + ], + "Etag": [ + "M6Ef4Hr6xTS2oBNwYYm8+A==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAO2VXW+bMBSG/4t3uTZ8rCMpUi9I43ZICemAXETTFLngUK+AmXGWRlH/+wwhpQUXWnWXE4qQzXnO++acg9mDe5KGwAS3JPq9wWz3iaPbGIMTgDmKxP7MgOuzb8x48D2djp3tcpmMPlsXFyKCFFy4iQPMTzPK+OnQ0M0QcZRjvtJVbaSea/pKM4bn4jL0oaqqK/HTBqVER8RQJM9xvJ6S9F5I3HGe5aaibLfbQURpFGOUkXwQ0EQ5ulb+6ErG6C8c8FxpWFIqS7nyBm9K6S1X3mKxjHHxGjOcBhiYe1BZsCWFEfGV/OFpv5WjQhnf7+dR1Cy4wwkqjKwJjsMcmD/2IEWJ8Aac4iYy7rJi5fmu7VyLdULDYu3C7wvbhROR5YkY7zjOa2S89KHXTdgpxxFmNWM7PryGbjd1FVPEa+ZqOrf8HmeUihlIn3mbz6fQcropnyQ45yjJas63Z9DzrdlNNzlB/FntJpYP+5VeivTnf8kUGv2cs0kwI0GNOYsZdO3LbsrjjKSRxRjadQ3EDRQeZO1tkJIet9Gyxw2w1eg2VjW6AUq63Uafut2ApS1v40VLGmSz73JNiVy/kgSUTUAbriagwUrGoI26OKAsrCEXXs7diWR0TiSnyWGG3neefEjwPUfLz5Zooz5t5ao8H1f+t9r/y/xqmYU6SDfJ4SNlAhWUyylNIx+z5rZLt8dVwDDihKbleWsC7esXY6jpmq6fGcVj/JARJgkwRuIjWwTEKOczGhLxD8JXchxffWs8LV7fmAZlQrG18MDjX4lI9YZyCQAA" + } + }, + { + "ID": "690c3513487270cf", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007/insertAll?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "1210" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0911c5c52270c358c3fad9a912800775/7445439517831068579;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007/insertAll?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1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OjA0Il0sIlRpbWVzdGFtcCI6IjIwMTYtMDMtMjBUMTU6MDQ6MDUuMDAwMDA2WiIsIlRpbWVzdGFtcEFycmF5IjpbIjIwMTYtMDMtMjBUMTU6MDQ6MDUuMDAwMDA2WiIsIjE5OTQtMDUtMTVUMDE6MDI6MDRaIl19fSx7Imluc2VydElkIjoiVkRWMmVnWnJmck1VeXJ1NFRkeEZkanJjTkttIiwianNvbiI6eyJCb29sZWFuIjpmYWxzZSwiQnl0ZXMiOiJZbmwwWlRJPSIsIkRhdGUiOiIyMDE2LTAzLTIwIiwiRGF0ZVRpbWUiOiIyMDE2LTAzLTIwIDE1OjA0OjA1LjAwMDAwNiIsIkZsb2F0Ijo0LjEzLCJJbnRlZ2VyIjoyNCwiTmFtZSI6ImIiLCJOdW1lcmljIjoiMC40NDk5MDAwMDAiLCJSZWNvcmQiOnsiUmVjb3JkIjp7IkludGVnZXIiOjB9LCJTdHJpbmciOiIifSwiVGltZSI6IjE1OjA0OjA1LjAwMDAwNiIsIlRpbWVzdGFtcCI6IjIwMTYtMDMtMjBUMTU6MDQ6MDUuMDAwMDA2WiJ9fV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:42 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTMK04tKnHMyQlKLS7IB3KUagGmFzWCLgAAAA==" + } + }, + { + "ID": "dae863d74de77b9a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a1149ad7470188f7d07bcd1ed02df5cf/17486786823642806507;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:43 GMT" + ], + "Etag": [ + "SvX/Hw5Y35RpG8H4c0GIew==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/71TwW7CMAz9l+y6dk7qlLYSt0mAtMsYh7Gph3QLqFoHrA0ghPj3hSKalLZI06b1ENl+9rPzGu/JR7p4JxFJ0vnXWua7GyWSTN4LJR7SQpFbIpWYa/xp83w33PKpx8erQTDENxiM5Lbf1xlqqUQ2Xm4LnQbaz0vzdU9m5bnRYUEOtydrusjg5VHXnQPIKtNzKVaOyteycijyAAOfIXfh+PkVwoD6DngOA5PMI8AIrqROulLA5b2z0xg9IYe4jlHD3cRcayIXaSOhdsGZyArZ5Oi8ds8PQt/rMTx2uahqkyQM0QHuUN7s0SUFjYBp6Ap9p4ym3aSTRkttye4b3H43hcrTxZy0IKxkrFHaMLXQWlkZj6+Vys+V2rW1BLtj3M4/W2dZWy397bTxSR+DJfWVmozMSjGzRehS7/KR/ftOIYYhMcL9rWFr8pO/Vtrx4RslhnpFAQUAAA==" + } + }, + { + "ID": "7d4a1ff7f95295b5", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "44ca438d873ac62af5aa72f19c067a5a/9009613936717329459;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:43 GMT" + ], + "Etag": [ + "M6Ef4Hr6xTS2oBNwYYm8+A==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:43 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAO3UQW+DIBgG4P/C2V/gzVbakFTskB6WpQeirDMRbZAdjPG/r26mtMAgTXfcyXB4fMn3fmEEffnBBQPxCN5r3lQ9iN9G0DLBQQzw/ImAGs7zqaAE4e3lLLpqPhP4ckAEpmCKrmI1KN5rsnqlsPAL1Cp+4lIbhCncQuJXm6ZjSpvNLk9o4GZd13DW3twtz3cwwX5Fa8F7xcRZO4oyWNAk2/tlytTN7NKEwnDSfUj4//dmzgg7/Cm4rEvN8CGDBK39qlCybk+JlGzwLcQeXu7gqteQjo5t+t2xAa2ibbYUbUBH2za9tm1gZ+U2nysxpNm7O9MRF05yQNcG2HjZAMM61sCmhJedrDQicJ2T1LE6keM1+dmhx96TpwIfeVqOVqgxHzt5Gc/zyX+b/T/mX8d8nKYvwYtPn/EGAAA=" + } + }, + { + "ID": "4f40e1707444b20e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "53207782f83b96439d80fe792b0b0461/10645845945346616515;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:43 GMT" + ], + "Etag": [ + "M6Ef4Hr6xTS2oBNwYYm8+A==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:43 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAO3UQW+DIBgG4P/C2V/gzVbakFTskB6WpQeirDMRbZAdjPG/r26mtMAgTXfcyXB4fMn3fmEEffnBBQPxCN5r3lQ9iN9G0DLBQQzw/ImAGs7zqaAE4e3lLLpqPhP4ckAEpmCKrmI1KN5rsnqlsPAL1Cp+4lIbhCncQuJXm6ZjSpvNLk9o4GZd13DW3twtz3cwwX5Fa8F7xcRZO4oyWNAk2/tlytTN7NKEwnDSfUj4//dmzgg7/Cm4rEvN8CGDBK39qlCybk+JlGzwLcQeXu7gqteQjo5t+t2xAa2ibbYUbUBH2za9tm1gZ+U2nysxpNm7O9MRF05yQNcG2HjZAMM61sCmhJedrDQicJ2T1LE6keM1+dmhx96TpwIfeVqOVqgxHzt5Gc/zyX+b/T/mX8d8nKYvwYtPn/EGAAA=" + } + }, + { + "ID": "0e1c74c13bd781dc", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "055dc6ecbb169da27e90a48dbb47af49/604498639518101627;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:43 GMT" + ], + "Etag": [ + "SvX/Hw5Y35RpG8H4c0GIew==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/71TwW7CMAz9l+y6dk7qlLYSt0mAtMsYh7Gph3QLqFoHrA0ghPj3hSKalLZI06b1ENl+9rPzGu/JR7p4JxFJ0vnXWua7GyWSTN4LJR7SQpFbIpWYa/xp83w33PKpx8erQTDENxiM5Lbf1xlqqUQ2Xm4LnQbaz0vzdU9m5bnRYUEOtydrusjg5VHXnQPIKtNzKVaOyteycijyAAOfIXfh+PkVwoD6DngOA5PMI8AIrqROulLA5b2z0xg9IYe4jlHD3cRcayIXaSOhdsGZyArZ5Oi8ds8PQt/rMTx2uahqkyQM0QHuUN7s0SUFjYBp6Ap9p4ym3aSTRkttye4b3H43hcrTxZy0IKxkrFHaMLXQWlkZj6+Vys+V2rW1BLtj3M4/W2dZWy397bTxSR+DJfWVmozMSjGzRehS7/KR/ftOIYYhMcL9rWFr8pO/Vtrx4RslhnpFAQUAAA==" + } + }, + { + "ID": "5c31e4be2edc72ad", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3cb21170e364a816a443fa2f5daeb31e/12210021459432826195;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0007?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:44 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "2063f51f58a39c14", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "621" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8b62833eb4722856ddff6615acc1ce20/13774195874040962531;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoiU3RyaW5nIiwidHlwZSI6IlNUUklORyJ9LHsibmFtZSI6IkJ5dGVzIiwidHlwZSI6IkJZVEVTIn0seyJuYW1lIjoiSW50ZWdlciIsInR5cGUiOiJJTlRFR0VSIn0seyJuYW1lIjoiRmxvYXQiLCJ0eXBlIjoiRkxPQVQifSx7Im5hbWUiOiJCb29sZWFuIiwidHlwZSI6IkJPT0xFQU4ifSx7Im5hbWUiOiJUaW1lc3RhbXAiLCJ0eXBlIjoiVElNRVNUQU1QIn0seyJuYW1lIjoiRGF0ZSIsInR5cGUiOiJEQVRFIn0seyJuYW1lIjoiVGltZSIsInR5cGUiOiJUSU1FIn0seyJuYW1lIjoiRGF0ZVRpbWUiLCJ0eXBlIjoiREFURVRJTUUifSx7Im5hbWUiOiJOdW1lcmljIiwidHlwZSI6Ik5VTUVSSUMifSx7ImZpZWxkcyI6W3sibmFtZSI6IlgiLCJ0eXBlIjoiSU5URUdFUiJ9XSwibmFtZSI6IlJlY29yZCIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDgifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:44 GMT" + ], + "Etag": [ + "W2yx6EApMBk70HlgkWFf+Q==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Tb2+bMBDGv4v3cm34swVSpL4gjdMhQbIRqm6apsiFC/UCNrOdpVG07z5Dk0FYtlYWL+78u+cen80erSnLkIceaP5jA2L3RpGHAtAFAkVynb+3d08O9qtovHbND0W+vp+u3n66vtYEreuyTZGCuqy4UJeuY3sZUUSCWtqmNTKvLHtpOe6VXo7tmqa51J81aFr8hxhpcQnFKqRsrVs8KlVJzzC22+0g5zwvgFRUDlJeGkfXxk/bqAT/DqmSRs+ScbAkjVd4Mxpv0niNxYaJYQUCWArI26ODheDMYDR/aP+8+7KVY4eGf9nPLz2z9BFKUhtZUSgyibyve8RIqb2hhRKU5bXmrmriJA5mt7rqDzHeKZAtMP6S4EV3P2AKchAtEcwSfIvjLjMtOFEtMQ3nfnLSg3N9e6zTZT4PsT/rMgktQSpSVi2VBBFeJH70sctNiIIWmfgJ7qucCvRrT4m6vk/NNiUImrbQ7C7CcXDTZWJIuchaJMY383ii47+v4POZ0X3T6wKxTfk8fQ+ZqAlDzvIERD8d8+0xSgUQRTlrjuEha/jOcS3bst8Ph8P6932qqDgDOCP9Wur6gkgV8Yxqn9k/NI7D88chrit42gjq1J1+Gb8BKXZp8TsEAAA=" + } + }, + { + "ID": "158d342f0cfd5930", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008/insertAll?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "190" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "aa53f7793ac8b1441cc628869314575b/15410427886948374131;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008/insertAll?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJyb3dzIjpbeyJpbnNlcnRJZCI6Im5Ra2MzS0pJYXJqeERaenp4bEY5bXk3Uld0UyIsImpzb24iOnsiQm9vbGVhbiI6bnVsbCwiQnl0ZXMiOm51bGwsIkRhdGUiOm51bGwsIkRhdGVUaW1lIjpudWxsLCJGbG9hdCI6bnVsbCwiSW50ZWdlciI6bnVsbCwiU3RyaW5nIjpudWxsLCJUaW1lIjpudWxsLCJUaW1lc3RhbXAiOm51bGx9fV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:45 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTMK04tKnHMyQlKLS7IB3KUagGmFzWCLgAAAA==" + } + }, + { + "ID": "d7c2ac609f016900", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "4c396fdda82fe30740458c16a9c22b59/6933256095222846139;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:45 GMT" + ], + "Etag": [ + "LH1kvAzN546bzPM5X8V7hg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8r7eBhmlzlW+ZmamCVVBfiaRliEmWek29oCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsU7LKK83JqdWhKzMWCAF0/p3i3QAAAA==" + } + }, + { + "ID": "364aa1bfa3830b87", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a77e2432557a2baa01d7f0d742fdf0e1/16974603401051360771;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:45 GMT" + ], + "Etag": [ + "W2yx6EApMBk70HlgkWFf+Q==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:45 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAG3RzQqDMAwA4HfJ2Sfw5k+VgtZRO9gYOxTNtoJV0e4g4rvP7bBWN3IK+ZJAMsNYPVBL8Ge4KWzqEfzLDK3UCD6UZlDtHTwwU//JBacshcX7inAyOFoQngUp3TptDd5xsIIyQVLCXZM0nTRWJFkRiM2OrmtQts6WoshIwFwjlMbRSN1bJWhOShHkB9fF0qAlcSDIfsp2wL53K979e8WeGgdVWcSOOeE0cg3HqhtqSziJCh6v+e8LTn9Od11jeQEGk6RuugEAAA==" + } + }, + { + "ID": "4e295db815d44a8a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3c759c965f41f893b99a4f2222941283/8569487004340505419;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:46 GMT" + ], + "Etag": [ + "LH1kvAzN546bzPM5X8V7hg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8r7eBhmlzlW+ZmamCVVBfiaRliEmWek29oCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsU7LKK83JqdWhKzMWCAF0/p3i3QAAAA==" + } + }, + { + "ID": "6794db492ddebb09", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "bc327f6d0ca48a02e9260ad644403d36/92315216909879187;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:46 GMT" + ], + "Etag": [ + "W2yx6EApMBk70HlgkWFf+Q==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:46 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAG3RzQqDMAwA4HfJ2Sfw5k+VgtZRO9gYOxTNtoJV0e4g4rvP7bBWN3IK+ZJAMsNYPVBL8Ge4KWzqEfzLDK3UCD6UZlDtHTwwU//JBacshcX7inAyOFoQngUp3TptDd5xsIIyQVLCXZM0nTRWJFkRiM2OrmtQts6WoshIwFwjlMbRSN1bJWhOShHkB9fF0qAlcSDIfsp2wL53K979e8WeGgdVWcSOOeE0cg3HqhtqSziJCh6v+e8LTn9Od11jeQEGk6RuugEAAA==" + } + }, + { + "ID": "c2d3bedabe3cf88b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "941612b749be5bbb7b68aa21fc286522/10133381052056650715;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:46 GMT" + ], + "Etag": [ + "LH1kvAzN546bzPM5X8V7hg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8r7eBhmlzlW+ZmamCVVBfiaRliEmWek29oCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsU7LKK83JqdWhKzMWCAF0/p3i3QAAAA==" + } + }, + { + "ID": "25eb29aad5951ac0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ed5c2f3b3fb604996afabe87b2d522de/1728265754857422627;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:46 GMT" + ], + "Etag": [ + "W2yx6EApMBk70HlgkWFf+Q==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:46 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAG3RzQqDMAwA4HfJ2Sfw5k+VgtZRO9gYOxTNtoJV0e4g4rvP7bBWN3IK+ZJAMsNYPVBL8Ge4KWzqEfzLDK3UCD6UZlDtHTwwU//JBacshcX7inAyOFoQngUp3TptDd5xsIIyQVLCXZM0nTRWJFkRiM2OrmtQts6WoshIwFwjlMbRSN1bJWhOShHkB9fF0qAlcSDIfsp2wL53K979e8WeGgdVWcSOOeE0cg3HqhtqSziJCh6v+e8LTn9Od11jeQEGk6RuugEAAA==" + } + }, + { + "ID": "9ade9d0d09ff3707", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9b06b4df072dc182e51c724fc05c0a47/3292441273238534323;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0008?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:46 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "a288f43778726172", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "621" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ab837ed06e9a71f05498354cf1de2319/4856615687846670403;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoiU3RyaW5nIiwidHlwZSI6IlNUUklORyJ9LHsibmFtZSI6IkJ5dGVzIiwidHlwZSI6IkJZVEVTIn0seyJuYW1lIjoiSW50ZWdlciIsInR5cGUiOiJJTlRFR0VSIn0seyJuYW1lIjoiRmxvYXQiLCJ0eXBlIjoiRkxPQVQifSx7Im5hbWUiOiJCb29sZWFuIiwidHlwZSI6IkJPT0xFQU4ifSx7Im5hbWUiOiJUaW1lc3RhbXAiLCJ0eXBlIjoiVElNRVNUQU1QIn0seyJuYW1lIjoiRGF0ZSIsInR5cGUiOiJEQVRFIn0seyJuYW1lIjoiVGltZSIsInR5cGUiOiJUSU1FIn0seyJuYW1lIjoiRGF0ZVRpbWUiLCJ0eXBlIjoiREFURVRJTUUifSx7Im5hbWUiOiJOdW1lcmljIiwidHlwZSI6Ik5VTUVSSUMifSx7ImZpZWxkcyI6W3sibmFtZSI6IlgiLCJ0eXBlIjoiSU5URUdFUiJ9XSwibmFtZSI6IlJlY29yZCIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDkifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:47 GMT" + ], + "Etag": [ + "c3o/50vUjHLK10TGcNSi5Q==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2TYW+bMBCG/4v3tY2BKKFB6gfS0AyNkI4QqdM0Ra65ULeAme00i6L99xmaFMKytbL4cOfn3nt9Nnv0zIoEOeiBpT83IHafFHnIAF0gUCTVedrneGC8LJ8+B19MI57ScMEGX6+vNcGqumSTUVCXJRfq0h5aTkIUkaBWlmFeGSPTWplDe6TX0LINw1jpz+zVLf5DjLS4hGwdsOJZt3hUqpQOxtvttpdynmZASiZ7lOf46Bq/WLgU/AmokrhjCR8sSfwBb7j2JvFHLNZMBGsQUFBAzh4dLPhnBqP5Q/vX3fetHDvU/Pt+fuuZ0UfISWVkzSBLJHK+71FBcu0NLZRgRVpp7so6jiM/nOqqN2K8UyAbYPwt9hbtfb9QkIJoCD+MvakXtZnbjBPVELfB3I1PenCub69odZnPA88N20zMcpCK5GVDxf7MW8Tu7K7NTYiCBpm4sddVORXo1p4SVX2XCjc5CEYbKFzOvMi/aTMRUC6SBom8m3k00fHfV3B/ZnQ/9LpAxSZ/nb6DDFSHAS/SGEQ3HfHtMaICiGK8qI/hIHPQH9qmZVq2Zfer3/dXycQZYHilX0tVnxGpZjxh2mfyD43j8Nxx4FUVnNaCOrXUL+MPWzhjrDsEAAA=" + } + }, + { + "ID": "a4058cd3c30dc54e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009/insertAll?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "301" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1a3c6c927aa32f514a255c1783299bdb/6420791201932880339;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009/insertAll?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJyb3dzIjpbeyJpbnNlcnRJZCI6ImNwNDkxWmdkN1BMM0M4QkFOUzhOeWdpTDZNRyIsImpzb24iOnsiQm9vbGVhbiI6dHJ1ZSwiQnl0ZXMiOiJBUUlEIiwiRGF0ZSI6IjIwMTYtMTEtMDUiLCJEYXRlVGltZSI6IjIwMTYtMTEtMDUgMTU6MDQ6MDUuMDAwMDA2IiwiRmxvYXQiOjIuMywiSW50ZWdlciI6MSwiTnVtZXJpYyI6IjAuMzMwMDAwMDAwIiwiUmVjb3JkIjp7IlgiOjR9LCJTdHJpbmciOiJ4IiwiVGltZSI6IjE1OjA0OjA1LjAwMDAwNiIsIlRpbWVzdGFtcCI6IjIwMTYtMTEtMDVUMDc6NTA6MjIuMDAwMDAwMDA4WiJ9fV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:47 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTMK04tKnHMyQlKLS7IB3KUagGmFzWCLgAAAA==" + } + }, + { + "ID": "a18e9a527be887c2", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8aac8d4efda25cce4972434b0daf10b5/16462138507761394971;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:48 GMT" + ], + "Etag": [ + "uuGQBLFM/reaKzVFRENMlQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qXlroHOvm4+eoXpSZ6V4W5Bbn6+eYE2toCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsAwpXKNXqQFiOgZ4ucI4hnGWkZwxnlxSVpiKUmJhbGBsbAYGeAUK1gaGZrqGhroEpQp2plYGJlYGpngEImGFRGoJLiYGeMdxyZEebKNXG1gJRbC0A+g8DgCYBAAA=" + } + }, + { + "ID": "18457e0fe97dc01c", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "010bb6f522615297dc267e36c0535873/8057023210562167139;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:48 GMT" + ], + "Etag": [ + "c3o/50vUjHLK10TGcNSi5Q==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:48 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAG3RzQqDMAwA4HfJ2Sfw5k+VgtZRO9gYOxTNtoJV0e4g4rvP7bBWN3IK+ZJAMsNYPVBL8Ge4KWzqEfzLDK3UCD6UZlDtHTwwU//JBacshcX7inAyOFoQngUp3TptDd5xsIIyQVLCXZM0nTRWJFkRiM2OrmtQts6WoshIwFwjlMbRSN1bJWhOShHkB9fF0qAlcSDIfsp2wL53K979e8WeGgdVWcSOOeE0cg3HqhtqSziJCh6v+e8LTn9Od11jeQEGk6RuugEAAA==" + } + }, + { + "ID": "c228ceadfd685dc9", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "61839963d78598cfce7695c959f7617f/18026312922369531307;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:48 GMT" + ], + "Etag": [ + "uuGQBLFM/reaKzVFRENMlQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qXlroHOvm4+eoXpSZ6V4W5Bbn6+eYE2toCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsAwpXKNXqQFiOgZ4ucI4hnGWkZwxnlxSVpiKUmJhbGBsbAYGeAUK1gaGZrqGhroEpQp2plYGJlYGpngEImGFRGoJLiYGeMdxyZEebKNXG1gJRbC0A+g8DgCYBAAA=" + } + }, + { + "ID": "9c61247cae7302f9", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d04804f12887eb4cf597d4490e3034b6/9621197629448428275;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:48 GMT" + ], + "Etag": [ + "c3o/50vUjHLK10TGcNSi5Q==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:48 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAG3RzQqDMAwA4HfJ2Sfw5k+VgtZRO9gYOxTNtoJV0e4g4rvP7bBWN3IK+ZJAMsNYPVBL8Ge4KWzqEfzLDK3UCD6UZlDtHTwwU//JBacshcX7inAyOFoQngUp3TptDd5xsIIyQVLCXZM0nTRWJFkRiM2OrmtQts6WoshIwFwjlMbRSN1bJWhOShHkB9fF0qAlcSDIfsp2wL53K979e8WeGgdVWcSOOeE0cg3HqhtqSziJCh6v+e8LTn9Od11jeQEGk6RuugEAAA==" + } + }, + { + "ID": "beadbb8f9c37e820", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0822927c4645a99a7ef47c250561d97f/11185373143551414915;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:48 GMT" + ], + "Etag": [ + "c3o/50vUjHLK10TGcNSi5Q==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:48 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAG3RzQqDMAwA4HfJ2Sfw5k+VgtZRO9gYOxTNtoJV0e4g4rvP7bBWN3IK+ZJAMsNYPVBL8Ge4KWzqEfzLDK3UCD6UZlDtHTwwU//JBacshcX7inAyOFoQngUp3TptDd5xsIIyQVLCXZM0nTRWJFkRiM2OrmtQts6WoshIwFwjlMbRSN1bJWhOShHkB9fF0qAlcSDIfsp2wL53K979e8WeGgdVWcSOOeE0cg3HqhtqSziJCh6v+e8LTn9Od11jeQEGk6RuugEAAA==" + } + }, + { + "ID": "f04f1ae59719afa5", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3109c8b0bfcd4eefd76281815464ac1f/1216082332249200187;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:48 GMT" + ], + "Etag": [ + "uuGQBLFM/reaKzVFRENMlQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qXlroHOvm4+eoXpSZ6V4W5Bbn6+eYE2toCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsAwpXKNXqQFiOgZ4ucI4hnGWkZwxnlxSVpiKUmJhbGBsbAYGeAUK1gaGZrqGhroEpQp2plYGJlYGpngEImGFRGoJLiYGeMdxyZEebKNXG1gJRbC0A+g8DgCYBAAA=" + } + }, + { + "ID": "7ba388f1e057ef57", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "60eb97d2965a873ec961ecdc6a20ad0a/12821605152163924755;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0009?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:49 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "e002b8d5a3ceeac8", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "360" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "070f90934cf3ded9bc82eef283352643/14385779571066962851;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTAifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:49 GMT" + ], + "Etag": [ + "gki5seyVmgunOkAf5867aA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SUW+CMBSF/0v3qhbYBCXxAScxJk4XZHtZFlPhip1AGa1zxvjfd4sYF+eypWnIvT3nni837Mma5zFxyYIn7xsodzeKLVIgDQKKJdhP1rwtYfecJZt8uvaW7Y7tMK/XQwXXvniTRqCahShV07EtN2aKSVBzyzA7Rte05qbtdPHYlmMYxhyv2aoifleYBg6XkC7HPF9jxEqpQrqUbrfbViJEkgIruGxFIqMnavph0aIUbxApSS+QaI0k6T/YaMUm6X8QK00ASyghj4C4e1IjjK4sBvV1/PH1b5RTQqX/m+eAO4tWkDENsuSQxpK4L3uSswzZjh+cuCt0NQuD0WSInvP7JpPn99Ek9Id+gI1MxLoR+I++F/qD75YSorMj8O+nwQDrn9ELIdKzsD+djn1vQg6veBo6t79TgAaid4rlWORJCOVlOxDbUxWVwBQXecir+Wb71nZMy7S6t3cd/ed+Fry8IrA7uCztT5lUDyLmiBr/MqOGDb3+2NcOEVUDsfU0I4cviqXwuDYDAAA=" + } + }, + { + "ID": "493710d2bb26cdd5", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e2676841773a366f7bd42f6f3e716f63/15949955085169949491;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:49 GMT" + ], + "Etag": [ + "gki5seyVmgunOkAf5867aA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:49 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SUW+CMBSF/0v3qhbYBCXxAScxJk4XZHtZFlPhip1AGa1zxvjfd4sYF+eypWnIvT3nni837Mma5zFxyYIn7xsodzeKLVIgDQKKJdhP1rwtYfecJZt8uvaW7Y7tMK/XQwXXvniTRqCahShV07EtN2aKSVBzyzA7Rte05qbtdPHYlmMYxhyv2aoifleYBg6XkC7HPF9jxEqpQrqUbrfbViJEkgIruGxFIqMnavph0aIUbxApSS+QaI0k6T/YaMUm6X8QK00ASyghj4C4e1IjjK4sBvV1/PH1b5RTQqX/m+eAO4tWkDENsuSQxpK4L3uSswzZjh+cuCt0NQuD0WSInvP7JpPn99Ek9Id+gI1MxLoR+I++F/qD75YSorMj8O+nwQDrn9ELIdKzsD+djn1vQg6veBo6t79TgAaid4rlWORJCOVlOxDbUxWVwBQXecir+Wb71nZMy7S6t3cd/ed+Fry8IrA7uCztT5lUDyLmiBr/MqOGDb3+2NcOEVUDsfU0I4cviqXwuDYDAAA=" + } + }, + { + "ID": "e8e3484ec63a570d", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "78" + ], + "Content-Type": [ + "application/json" + ], + "If-Match": [ + "gki5seyVmgunOkAf5867aA==" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1c58841ce41e47a90a0a51002af34509/17514130599256159427;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkZXNjcmlwdGlvbiI6Im1vcmUiLCJleHBpcmF0aW9uVGltZSI6IjE1MzY3OTkwODAwMDAiLCJmcmllbmRseU5hbWUiOiJtb3JlIn0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:50 GMT" + ], + "Etag": [ + "HL6x8nYV77/pV6D5PubtdQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SUW+iQBSF/8vsq3UAFYSkD1pJa0K1pWyTzaYx48yVzhYYOjPWGuN/7wzVsLG7qSGE3Dvn3PNxYYdeeMVQhJY8f12D3P7QZFkA6iDQJDf9m8R/H1a/HoMA14/+ZHC3Xmp2f3lpFNz62LqgoC9qIfVF4HsRI5oo0AvPcYdO6HoL1w9Cc/le4DjOwtxut4n4v8J1zHAFxSrh1YuJeNa6VhHGm82mmwuRF0BqrrpUlPhIjd88XEvxB6hW+AQJH5AUPoMNN2wKn4PYaFJYgYSKAop26IAw/cdijP4Q/3n6PcoxodF/z7PvoJXkULFiOyOlwUGlkPZDMlBU8lpzUbVNRZ+hJJZ5xaFgCkW/d6j69DUPE76tbfWQpdPZtRnfnq9L1Z5PZ1l8HaemUQpmG2l8F4+yePK3RQJtHWl8NU8npv4avRSiaIXj+TyJRzO0fzJXx+aOtxqMAdn1mzIRVZ6BPG2nYnOsqARi3zzjzXx30PMD13O9sNcf2p/8vebyiyAMnaHZq/UXROlbwbhBZSczeo436Lew2WicxNYhKDns+ucD2n8A1NJf72EDAAA=" + } + }, + { + "ID": "960ecbe0fdbf75fd", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "21" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "4c3d0d5078045f4009ab48bd68cd8cbc/703898909657754707;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJmcmllbmRseU5hbWUiOiJ4In0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:50 GMT" + ], + "Etag": [ + "6KX69ApLJuO1eEj32rJusA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SUW+bMBSF/4v7msaYtCQg9YG0VpWOJRWl0qRpihxzQ90CZrZZGkX577UpUaZ0UyuE0L0+556PCzv0IuocRWglit8tqO2ZYasS0ACBYYXtB99+BGHcJHftggB9HvnqrtXx1ZVVCOfL25KDOW+kMufjwI9yZpgGs/Q9MvFC4i9JMA7tFfhjz/OW9ibDLuL/CuLZ4RrKdSLqFxvxZEyjI4w3m82wkLIogTVCD7ms8IEa//Fxo+QzcKPxCRLukTT+Ahvu2DT+CmKnSWENCmoOKNqhHmH2j8VYfR//fvo5yiGh03/Osx+gtRJQ5+V2ziqLg15dJmiuRGOErG2nksp9Ws2foGIOeC2gzDWKfu5Q/W7qHjZ527jqIUtn81s7+3jeVvp4Pptn9JamtlHJ3DVSek/jjN78bVHAj46UXi/SG1t/jF5JWR6F08UiofEc7X/Za+Byp1sD1oDc7m2ZyLrIQJ22U7k5VFwBc2+eiW4+uRwFY+ITPxxdTNwf/toI9UEQht7ELtX5S6bNd5kLi5qfzBh5k25GD5vF04Q6h+Ss3/XjA9q/AdiftvBeAwAA" + } + }, + { + "ID": "2ea01c7d2803f895", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "21" + ], + "Content-Type": [ + "application/json" + ], + "If-Match": [ + "HL6x8nYV77/pV6D5PubtdQ==" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "79eaf13b377250eee8254f67d0669f41/2268074428038866403;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJmcmllbmRseU5hbWUiOiJ5In0K" + }, + "Response": { + "StatusCode": 412, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:51 GMT" + ], + "Etag": [ + "6KX69ApLJuO1eEj32rJusA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:51 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIWNsQoCMRBEf0W2PgvFKh8gWJxY2MkVa3a9C+SyskkjIf/uBkHs7Ib3hpkKrCoKrn5CBnerQLJiSOBgjnLHCAMoY5ZOvCQKJUg6Sxm5mFo5Z5zZ3EX5qzdHDJHJfBSPnVxfz15aGIn1hxs7PbYjFr9AmwZ7IOsddvt/0629Ad0ZvLW+AAAA" + } + }, + { + "ID": "17d52b21ca8d7cda", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "293" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "aa7379a6ebd979e1edbeab1a9bc564d6/3832248842647002483;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7ImZpZWxkcyI6W3sibmFtZSI6Im5lc3RlZCIsInR5cGUiOiJCT09MRUFOIn0seyJuYW1lIjoib3RoZXIiLCJ0eXBlIjoiU1RSSU5HIn1dLCJuYW1lIjoicmVjMiIsInR5cGUiOiJSRUNPUkQifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:51 GMT" + ], + "Etag": [ + "5sWqMHDx43/yr7P8pBW3Gg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TX2/aMBD/Lt5ri+OEEhKpDzAihkShSjP1YaqQcY7gNYlT2wwixHevnYKyQaeiKIru/Pt3PmWPXnmZohAtefa2AVl/03SZA7pBoGlm+nfq+e3hx2jX9XAt/cd+NXz2xtn9vUFwy0s3OQN9Wwmpb/2eG6ZUUwV64Tqk7wTEXZCeH5in5/qO4yzMSzqNxf8RxDHiCvLVlJevxmKtdaVCjLfbbScTIsuBVlx1mCjwKTX+4+JKit/AtMJnkfAxksJXZMNNNoWvidhgYliBhJIBCvfoGGHyycUY/NH+4/TrKCeHBv91nsMNWkkOZZrXM1qYOGhnPUExySvNRWk6hZB2tYqtoaA28IpDnioU/tqj8oPUfIxzXdnqKYkns7HRbs83hWrPJ7MkGkexaRQitY04eowGSTT6myKBtYw4+j6PR6a+tF4KkbfA4Xw+jQYzdHj5V8q9SqsEpSH9RK3VEnoN8nLUF2toxxzWGowmsqs25VSUWQLyvB2L7aliEqi96IQ3+uTO6/nEJW7gdfv2h9pVXF4AgsDpmx1afk6VfhApN9OkZxoe8btemzUZDKeRZQhGj6v9+YQO75ApRajNAwAA" + } + }, + { + "ID": "37e8baf6250fcd88", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "14" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "4b116386c026bc421428cd3244072335/5468480851259512323;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJzY2hlbWEiOnt9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:52 GMT" + ], + "Etag": [ + "5sWqMHDx43/yr7P8pBW3Gg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TX2/aMBD/Lt5ri+OEEhKpDzAihkShSjP1YaqQcY7gNYlT2wwixHevnYKyQaeiKIru/Pt3PmWPXnmZohAtefa2AVl/03SZA7pBoGlm+nfq+e3hx2jX9XAt/cd+NXz2xtn9vUFwy0s3OQN9Wwmpb/2eG6ZUUwV64Tqk7wTEXZCeH5in5/qO4yzMSzqNxf8RxDHiCvLVlJevxmKtdaVCjLfbbScTIsuBVlx1mCjwKTX+4+JKit/AtMJnkfAxksJXZMNNNoWvidhgYliBhJIBCvfoGGHyycUY/NH+4/TrKCeHBv91nsMNWkkOZZrXM1qYOGhnPUExySvNRWk6hZB2tYqtoaA28IpDnioU/tqj8oPUfIxzXdnqKYkns7HRbs83hWrPJ7MkGkexaRQitY04eowGSTT6myKBtYw4+j6PR6a+tF4KkbfA4Xw+jQYzdHj5V8q9SqsEpSH9RK3VEnoN8nLUF2toxxzWGowmsqs25VSUWQLyvB2L7aliEqi96IQ3+uTO6/nEJW7gdfv2h9pVXF4AgsDpmx1afk6VfhApN9OkZxoe8btemzUZDKeRZQhGj6v9+YQO75ApRajNAwAA" + } + }, + { + "ID": "2ec4ad755fd9216d", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "311" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6762f743dc17ddf9a1a059cf86faccba/7032374894680755859;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJzY2hlbWEiOnsiZmllbGRzIjpbeyJtb2RlIjoiUkVRVUlSRUQiLCJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifSx7ImZpZWxkcyI6W3sibmFtZSI6Im5lc3RlZCIsInR5cGUiOiJCT09MRUFOIn0seyJuYW1lIjoib3RoZXIiLCJ0eXBlIjoiU1RSSU5HIn1dLCJuYW1lIjoicmVjMiIsInR5cGUiOiJSRUNPUkQifV19fQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:53 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:53 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAANWPwWrDMAyGX0Xo3BY7lGT1bWUpDMLYuvU0RlBtLQnY0bC9XkLffS477wHGj+Dn4xNIC3KMEtEsvyWheV/QSaBpRoODlzN5XGFkSnIj03whP7mCAqdEAxf2HOUyOXbwakcOBE44wSwZAmU7whudPYP79pbz+ktiXjd1ZRxlSpz7Suk7tdNVr+tmV1JXjVKqL6M3+bb5t6HVBg4TewczBYaREtiR5qFcEsQxfEYJ8HTquvt910IWOLYvp8dj+4DXjxXaoqDZKvXPX7n+AJ2bPBfEAQAA" + } + }, + { + "ID": "21d185280f0121d6", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "342" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e07e5aea7e2f57be43c5a4a31e175368/8596549313567016739;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifSx7ImZpZWxkcyI6W3sibmFtZSI6Im5lc3RlZCIsInR5cGUiOiJCT09MRUFOIn0seyJuYW1lIjoib3RoZXIiLCJ0eXBlIjoiU1RSSU5HIn1dLCJuYW1lIjoicmVjMiIsInR5cGUiOiJSRUNPUkQifSx7Im1vZGUiOiJSRVFVSVJFRCIsIm5hbWUiOiJyZXEiLCJ0eXBlIjoiU1RSSU5HIn1dfX0K" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:54 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:54 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAN2P0WrDMAxFf0XoaYM22GEkq1/3A4PtbZSgRlpqcKzNdksh9N/ntM/9gSEE4ugK3bugpKQJ3XIfMrqvBVln8hEdTkEPFHCDSSjrSnw8U/Bc0Sw50ySVvSc9exaGj/EoMwGrZIhaYKYyHuGTDkGAT2GUsv3RVLZ91zqmQlnK0Br7ana2HWzX72p1bW+MGWrbpqyXjxXWNPBGcf1EzJDk9+RTtfHtJXCGokAR5OJz8XGCfDPXwNNt7Vb5M173GxyVa4oXY/5Lpusf4NFcDNYBAAA=" + } + }, + { + "ID": "5d10aaa4fbfb4fd1", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "182" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "94be27a86a8d0ea9609bfd7402418632/10160724827670003635;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19fQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:54 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:54 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAANWOTWoDMQyFryK0ToJtykwzB+i60O5CGRRbTAT+KZaTLobcvU6yzgGCeCA+3oNvRa61VJzWx6M4HVYMJZFknHCJ5UgRN1iZtNyI5AtFCR0lVqWFO/us5SKBA3z5EyeCUFghlwaJmj/BNx0jQzhHz237W2rbjoObAjVSbrMz9t3srZvtMO77DW40xsw9dtduy+cNa3bwIRwDVPYORCGJquQFJEPmP9C7D15/NuhL6KpvxryU+PUfcCRJlKABAAA=" + } + }, + { + "ID": "707a32b273cd2d9b", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "260" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a0d7c2feb66843c50a055803c3fbfe89/11796956836282513475;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifSx7ImZpZWxkcyI6W3sibmFtZSI6Im5lc3RlZCIsInR5cGUiOiJCT09MRUFOIn1dLCJuYW1lIjoicmVjMiIsInR5cGUiOiJSRUNPUkQifV19fQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:55 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:55 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAANWOQWoDMQxFryK0TgbblJlmDtB1od2FMii2mDHYVrGcdDHk7nXadQ9QxAfx+B/ejlyrVJz330dxPu8YJFMsOOOa5EIJD1iZVB4klhulGDrKrEord/Za5RYDB3jzG2eCIKxQpEGm5jd4p0tiCNfkuR0/pbbjNLo5UCPltjhjn83JusWO06nf6CZjzNJjh/ZY/t2wZoCXyClAZe8GaRtXiAo5qsayQixQ+Av0xwrvHwf0ErrwkzH/UP/+DXlpwPasAQAA" + } + }, + { + "ID": "db6492db20b86d6a", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "214" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "2e2969818db2644e041324eb17dab8a2/13361131250890649811;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifSx7Im5hbWUiOiJyZWMyIiwidHlwZSI6IlJFQ09SRCJ9XX19Cg==" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:55 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:55 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAJ3MMQrDMAyF4asIzRlC6eS1addC1tJBsUUisK1iJYVicvc69AbdHh+8vyKXogVd/Q1D96gYNJFkdDhHnShih4XJ9BDJb4oSGiU2o5mb3YRjgML+BGKwfl4M4/VyHweYthUWMsgK5hdOhPuzQ6+h3c59/3dk/wIWhYgwuAAAAA==" + } + }, + { + "ID": "e0a3e437a71e90c9", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ecb784db05490ead3dfc226efb6e2d9f/14925306769271761251;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:56 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "79db9630065768f3", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "267" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "2771091a97f39fbdea0e88c20d9ef55f/16561538777901048307;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTEifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:56 GMT" + ], + "Etag": [ + "Fkiw4Rw8iNcL3bC4SwfgVg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2QUW+CMBDHv0v3Oi1FB0jiw1ycMWE+INvLspgKB3YCZbSOGeN334EYE6PRNE1zd//736+3I2uRR8QlS5H8bKDcPmi+TIE8EtA8wfzrWlR9v3LELPR6y5f+vIqTj2Q4RIWo+6JNGoLuFLLUHdsy3YhrrkAvTIM5xoCZC2bZAzyWaRuGscDLus2I6wrG0FxBGnsiX+OIldaFcimtqqqbSJmkwAuhuqHM6JGa/pq0KOU3hFrRMyTaIil6Bxtt2BS9B7HR+BBDCXkIxN2RFmF6YTGob8cfqrdRjhMa/W2ePe4sXEHGa5BYQBop4n7uSM4zZDs86Lgt6mge+NPZBHtO9U2mTvXpLBhPxj7Zf6EtlkZbDWhHDNKEnsyTAMrztC+rYxSWwLWQeSAad/bUs2xmsp7lsHoV8FeI8oLAcvA/dX/KlX6TkcCPRFc8WtTgeeSN6w4ZNoaYep+T/T/Q8fCf2QIAAA==" + } + }, + { + "ID": "e20a0f5740a7c573", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=3302bbd9266716e62f2ca1f1caf8e7b9c42bf1b3e39ef5880c2caa88e94b" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "658d8164c5fe89d539d4fb36100824df/18125713192492407427;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "LS0zMzAyYmJkOTI2NjcxNmU2MmYyY2ExZjFjYWY4ZTdiOWM0MmJmMWIzZTM5ZWY1ODgwYzJjYWE4OGU5NGINCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImNvbmZpZ3VyYXRpb24iOnsibGFiZWxzIjp7InRlc3QiOiJnbyJ9LCJsb2FkIjp7ImRlc3RpbmF0aW9uVGFibGUiOnsiZGF0YXNldElkIjoiZGF0YXNldF8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDEiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIiLCJ0YWJsZUlkIjoidGFibGVfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDExIn0sIndyaXRlRGlzcG9zaXRpb24iOiJXUklURV9UUlVOQ0FURSJ9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoidVFFNHZSOWpHVkZYeVNEbVZvQzU5NEpPN0s0IiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg0KLS0zMzAyYmJkOTI2NjcxNmU2MmYyY2ExZjFjYWY4ZTdiOWM0MmJmMWIzZTM5ZWY1ODgwYzJjYWE4OGU5NGINCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA0KDQphLDAKYiwxCmMsMgoNCi0tMzMwMmJiZDkyNjY3MTZlNjJmMmNhMWYxY2FmOGU3YjljNDJiZjFiM2UzOWVmNTg4MGMyY2FhODhlOTRiLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "899" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:58 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/fSUm5o2pn5uQcFzhaNQsSt0Ck1s\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoZp5QxKqstYQg0RLrQ3vE-qc-L5pVqXBzLuxyEYPENtz9QUcxL9eBVjtkjeYs904dC2ECSsTcoRf19QFjf3n7HxJ7V4UFnGDooH5JmHwlmbwUF1_o" + ] + }, + "Body": "eyJraW5kIjoiYmlncXVlcnkjam9iIiwiZXRhZyI6IlwiTGFaOG4wNEQ4S21HSWVVZFBsSU5MbWVhV0dzL2ZTVW01bzJwbjV1UWNGemhhTlFzU3QwQ2sxc1wiIiwiaWQiOiJkdWxjZXQtcG9ydC03NjI6VVMudVFFNHZSOWpHVkZYeVNEbVZvQzU5NEpPN0s0Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9iaWdxdWVyeS92Mi9wcm9qZWN0cy9kdWxjZXQtcG9ydC03NjIvam9icy91UUU0dlI5akdWRlh5U0RtVm9DNTk0Sk83SzQ/bG9jYXRpb249VVMiLCJqb2JSZWZlcmVuY2UiOnsicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwiam9iSWQiOiJ1UUU0dlI5akdWRlh5U0RtVm9DNTk0Sk83SzQiLCJsb2NhdGlvbiI6IlVTIn0sImNvbmZpZ3VyYXRpb24iOnsiam9iVHlwZSI6IkxPQUQiLCJsb2FkIjp7InNjaGVtYSI6eyJmaWVsZHMiOlt7Im5hbWUiOiJuYW1lIiwidHlwZSI6IlNUUklORyJ9LHsibmFtZSI6Im51bXMiLCJ0eXBlIjoiSU5URUdFUiJ9XX0sImRlc3RpbmF0aW9uVGFibGUiOnsicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwiZGF0YXNldElkIjoiZGF0YXNldF8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDEiLCJ0YWJsZUlkIjoidGFibGVfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDExIn0sIndyaXRlRGlzcG9zaXRpb24iOiJXUklURV9UUlVOQ0FURSJ9LCJsYWJlbHMiOnsidGVzdCI6ImdvIn19LCJzdGF0dXMiOnsic3RhdGUiOiJSVU5OSU5HIn0sInN0YXRpc3RpY3MiOnsiY3JlYXRpb25UaW1lIjoiMTUzNjcxMjEzODA1MiIsInN0YXJ0VGltZSI6IjE1MzY3MTIxMzg3NTcifSwidXNlcl9lbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0=" + } + }, + { + "ID": "8b4b4b0cf99ae1a3", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/uQE4vR9jGVFXySDmVoC594JO7K4?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b3838a6ab41969070dc92bd2807c9b67/11284773413691067995;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/uQE4vR9jGVFXySDmVoC594JO7K4?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:28:59 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/fSUm5o2pn5uQcFzhaNQsSt0Ck1s\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:28:59 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKi5JLCktVrKqBrNSlayUgkL9/Dz93JVqdcBCmcUlmclgBclFqUBufl5IZi5InaGpsZm5oZGhsYWBqZESWHFRCYacuam5Um0tAKmOByxoAAAA" + } + }, + { + "ID": "95cabb0fab1b3ea4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/uQE4vR9jGVFXySDmVoC594JO7K4?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b3838a6ab41969070dc92bd2807c9b67/12848948927777277931;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/uQE4vR9jGVFXySDmVoC594JO7K4?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:00 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/mL-MAr1ICYPeDbD61Glss3-7880\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:29:00 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAGWNQQ7CIBBF7zLrxpSS2srSqEtNGi9QgQUJhaYMMabh7jIYu9DdzHt/5q8QcMQYQKxl0iDgdLueIVVlNwGNLFYuOq/e3c1EIdbyfccaxvu6baCEF/xzXdtlp536NYeek5F+mq2mtwM9B8F2dQXWj4oqjZsjXozVgU5zfAPHF34gVfuIGQ/+SYRv4JvhhB6jGrT0iyJSQ0rpDdMEly76AAAA" + } + }, + { + "ID": "4d43a0678c53facd", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0011/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6f2375118cc6dc898cdb383a2f7425ec/4443832535378101043;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0011/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:00 GMT" + ], + "Etag": [ + "1h0iyrNMc2vhOyPHSj6xWA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8obZhhkVhb5+SYblWX4VwZ4BGeZVYQ72toCVZTklyTmBOWXFwOVGQP5RWBmdLVSGpgsAwonKtXqQFgGSrWxIDZCLgkuZ4ghlwyXMwLJxdYCAFZ+s/qwAAAA" + } + }, + { + "ID": "33a3770565301ef6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0011?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e2e6cae78ddfc355cbc9370c2a73d469/14413123346680381306;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0011?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:00 GMT" + ], + "Etag": [ + "GdveL1jT26mycs0wyRgsMA==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:29:00 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyglA6SiWVBSBecEiQp5+7Uq0OQr40txgh7+kX4uruGqRUG1tbCwCcp8mLWAAAAA==" + } + }, + { + "ID": "d5329b9d3c177851", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0011?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "511777d8eb404f7585145c895bb66a93/16049355355292891146;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0011?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:00 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "ae0341210ab01f17", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "360" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "daab6dfa363738f7f0e658417fcb0721/17613529769901027482;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:01 GMT" + ], + "Etag": [ + "QavqD1QP6AFJCNgavG5Imw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SW0/CQBCF/8v6Kmy3YpEmPHCpBINcan0yhiztUFbbbu0uVEL4705rCQYlks2mmZlz5nzZdEfeRRIQmyxE+LGGbHul+SICck1A8xD7M7756LPZ1OrcP/TGId8Mbodx3m6jQhS+YB35oGupzHStaZl2wDVXoOemwe6MFjPnzGq28Fhm0zCMOV5WLyPOK5iJyxVEy5FI3jFipXWqbErzPK+HUoYR8FSoui9jeqCmG5OmmXwDXyt6gkQrJEUvYKMlm6KXIJYaF5aQQeIDsXekQhj+8TCor+K/p/+jHBJK/f88e3wzfwUxL0CWAqJAEftlRxIeI9v3Bzdu06J68tzheICe43wdq+N8OPacgeNiI5ZB0XCdqdPxnP5PSwb+0eE6vYnbx/p39ELK6CjsTiYjpzMm+1c810Vud6sBDcQgZTmSSehBdtp2ZX6o/Ay4FjLxRLmf3d5YTWayBjMareLP/UxF9ofAusPHKvwRV/pRBgJRgzM7Kliv0x05hUP65UJsPT+R/ReahpC8NgMAAA==" + } + }, + { + "ID": "b8366d2c85a626fb", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "423" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0303782a59230136408aa38a2d0f994a/731242685254396202;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiSU5TRVJUIGRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxLnRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAxMiAobmFtZSwgbnVtcywgcmVjKVxuXHRcdFx0XHRcdFx0VkFMVUVTICgnYScsIFswXSwgU1RSVUNUXHUwMDNjQk9PTFx1MDAzZShUUlVFKSksXG5cdFx0XHRcdFx0XHRcdCAgICgnYicsIFsxXSwgU1RSVUNUXHUwMDNjQk9PTFx1MDAzZShGQUxTRSkpLFxuXHRcdFx0XHRcdFx0XHQgICAoJ2MnLCBbMl0sIFNUUlVDVFx1MDAzY0JPT0xcdTAwM2UoVFJVRSkpIiwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJ1U09CTWFpWmFpV0lUamFOOTJQYnhCVnJrTXUiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:01 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/SgAXiPn28CdKuhIYBvPhgQrX2Ig\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVT/W+iQBD9V8jeD20TKl9VxORypz2vIaVqBfp1XsyyjLgVWFwWe6bp/34L2txnazYkm5n35s2bHZ7RiuYx6qGIJusK+PbDI4uQikDgREZnyMMP3Vw/+9K9zC5cCONJ6o68DPDtRan5Sf+OTnKzex5fVkv3frCZLJNrfme6yQzJIrQuHFcpAXFaMC5O7Y7ZC/1W5Y8HV5g+YHrrBo945JiT6Mfghq+uKskqIV14NF9J7lKIouxp2tPTUythLEkBF7RsEZZpr/1qG1MrOHsEIkrtLy1Neim1d9Q+pYxgQVn+MfSlsoRPYQEccgKo94z2dd3/2Nihm8z7bl4VJFBqvKiIsHxBk4rvo891nWBbSEF0HQ6n95LTGKtT+wtyR/5wGigxFrgEMTd1o6s7hjk3OrYjT8e0dV2fy89oCRyl8DbCMJXjHGegKnmVlarCgZzM8pn4dW76Xjj0leMjfKQq3/TvquIH0/A8mFW6bpHBeOw1NziW0eHJifoneyYURXKjmmu8zf3a9/w3yaQmm4eE5ZxiKAXNm0EGte3Db7af4C57eJqS0cyzwR+cbP26BaeMU7F7tGA47Z8H7s1Q1qlK8CDBZOuvU9Rb4LSEF4kvBRZVWTde3+olmIajkTu6QPsklRZJAyAcdlZpVuOMttWxDdM4M0zbRg2Yi39ybcf6faEakQxysd+43WKhuhPZIJ9DhqlsD1mdjuU4lmWctU8joyt0g2XCwabtrIiVkISul+tV2o1YtKw+x7CBlBXAW4mssaEEMCGsykX9o6KXn5gsPJFjBAAA" + } + }, + { + "ID": "26793355b58efd6f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/uSOBMaiZaiWITjaN92PbxBVrkMu?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ddebcc645497394186803b9d7130981a/2367474698178585018;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/uSOBMaiZaiWITjaN92PbxBVrkMu?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:03 GMT" + ], + "Etag": [ + "HLIWAcZeBa3NBKuTqkLjAQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/2VQTWvCQBD9L9NrhKLQ0oCHRIOGaqJrWqGlh81mYhM32bgftCL+907sIYWyh9mZ9958vAscq7YAH/LqcHKoz3cHtNv+w9A4aQ2FTrUGwQO0/EDM5SreB+INQz5JwmeXnY6rOthOp8Qw4hMbDv4FygplYcB/v0DLGyTZLXhgz12f7TIWJwu4egPuGjPgcZJFi4hRoVFFX2DRJgqyaP5XolEMChbNUjan/P/oXCk5EMM0XUVBAtcPeh7UKmdYosZWYL95p1WNwsa9KYWTAu2oU9qOHh/GcGPfELdLwzWv3ni1j7OaJ0/jTf4dvurj2hFLKsFtpVoivuxoY7DKchmeLZqNVgKNwb7J/W/DmWo6iZamW+3QA8HJxmVlwS+5NFQga+aNDMqS9sKCqS+6DiZw/QEGW6dmvQEAAA==" + } + }, + { + "ID": "222f07459416ac9b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0012/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "27c9da546a3bddb573b235c21fbb629d/12336765505185897730;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0012/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:03 GMT" + ], + "Etag": [ + "etNHDCn8n87xAlTeRnoDUw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qnlvh5uDjnWeRZmFc45oSkBuXlu4SW29oCVZTklyTmBOWXFwOVGQP5RWBmdLVSGpgsAwonK9XqgFlQvpFSbSxUBFlZSVFpKkgGIokQT0TTbkCa9iQ07YbYtacl5hTD9MfWAgCwea51GgEAAA==" + } + }, + { + "ID": "7808d679d06da0dd", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0012?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "668cae3a234e273505e07d3eaa87d31e/3931367642088200778;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0012?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:03 GMT" + ], + "Etag": [ + "QavqD1QP6AFJCNgavG5Imw==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:29:03 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyglA6SiWVBSBecEiQp5+7Uq0OQr40txgh7+kX4uruGgQUyM1PAQkEuQa4Ooa4uiBrKUpNRugIcnX2D3IB8jGtTsrPz0EodPL393F19FOqjQXCWgCN1fK3tQAAAA==" + } + }, + { + "ID": "13b84e1f66d1b3f8", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0012?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "fec563fc37dd1cd0dab9b759819f3d11/5495543156191187674;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0012?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:03 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "b5cf520fb3efc6b1", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "321" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8f66c460b8ee22e8adacf9b8e4555649/7131775164803697514;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoiZCIsInR5cGUiOiJEQVRFIn0seyJuYW1lIjoidCIsInR5cGUiOiJUSU1FIn0seyJuYW1lIjoiZHQiLCJ0eXBlIjoiREFURVRJTUUifSx7Im5hbWUiOiJ0cyIsInR5cGUiOiJUSU1FU1RBTVAifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTMifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:03 GMT" + ], + "Etag": [ + "TUYiICgV8LQB6F4jSrKs6Q==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SUWvCMBSF/0v2Ok1TXVoLPujmQFZhah2MMSS21xptm66JcyL+9yWd3VCUSQk0955z7tdLd2jFswh5aMbjjzUU2xvFZgmgWwSKxboeTF55/z5+cf1hlz42l+PiSdJhu60V3PiidRKCquWiUDWH2l7EFJOgprZFXKtF7CmhTks/1HYsy5rqQ+rliMsK0tDhEpK5z7OVHrFQKpcexpvNph4LESfAci7roUhxRY0/bZwXYgmhkvgECR+QJL6CDZdsEl+DWGpGMIcCshCQt0MHhP6ZxWj9YfxP93+UakKp/59nr3cWLiBlBmTOIYkk8t52KGMpmIEmbpub14dO0NPy35b6awX9wVErUse2076Sx95x0Bk8o/27hsnWaXerQEMgC5VXX2RxAMVpeSQ21S0sgCkusoCX6eSuQR1ik2bDdan5Jb9yXpwRUFdvwfgTJtVARFx/fnQho4LtdP2ecYiwDNSlyRjtvwHWpjyKDwMAAA==" + } + }, + { + "ID": "f0f7d465b636be38", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013/insertAll?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "164" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f0f9cfa8c759ac69e4a3aeb4cf86244f/8695949583706735610;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013/insertAll?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJyb3dzIjpbeyJpbnNlcnRJZCI6Ilg2U2FTUmpGaVkwbzdoRzJKNE91Z2ptTUNVNSIsImpzb24iOnsiZCI6IjIwMTYtMDMtMjAiLCJkdCI6IjIwMTYtMDMtMjAgMTI6MzA6MDAuMDAwMDA2IiwidCI6IjEyOjMwOjAwLjAwMDAwNiIsInRzIjoiMjAxNi0wMy0yMFQxNTowNDowNVoifX1dfQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:04 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTMK04tKnHMyQlKLS7IB3KUagGmFzWCLgAAAA==" + } + }, + { + "ID": "9ff42eb7b0b8b0db", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ca7518c32c255a5dae84ca8d26cbf252/218777791981207362;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:04 GMT" + ], + "Etag": [ + "j7IGsmfhoDZoIgtfnyYL6g==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pnmXu6F+emZeS7ROV7ppek5VVG+pil29oCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsAwobGRia6RoY6xoZKNXqQIQMjayMDawMDPQMQMAMLo5QGoJLiaGJqYWJhZmRiake0LxYIAQAOlLUUMcAAAA=" + } + }, + { + "ID": "d5efdf899711033d", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "00fa5212def8bffe447976d539323c9d/10260125097792945290;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:04 GMT" + ], + "Etag": [ + "TUYiICgV8LQB6F4jSrKs6Q==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:29:04 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyUkpR0lEqqSwAMV0cQ1yVanXgUiUIqRBPXxSplBJUbejyJcWoeoNDHH0DlGpja2sB5wvkN44AAAA=" + } + }, + { + "ID": "fca29bd6e243da90", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "332" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7a92ddbf02470c88e69b78f8254fa3ae/11824300611895931930;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiSU5TRVJUIGRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxLnRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAxMyAoZCwgdCwgZHQsIHRzKSBWQUxVRVMgKCcyMDE2LTAzLTIwJywgJzEyOjMwOjAwLjAwMDAwNicsICcyMDE2LTAzLTIwIDEyOjMwOjAwLjAwMDAwNicsICcyMDE2LTAzLTIwIDE1OjA0OjA1JykiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6InhhdkE1SzI4WGlnRmk0Z0RQaVREUmZ5YXFhbiIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:05 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/Xc8Q8Uf8Z6gSQ4WmQ18dvKrs3Tc\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVTfW+iMBj/KqT3h1uiUkAQSC535uYtRmOmwrZblphaHlknUKTFzSx+92vR5S73MiFNmj6/5/fSB97QhhUJCtGKpdsaqv2nZ75CbQSSpOr0EU3Ig1/g3pU/zq9HECc32Wg6yYHcXQvznvozP177D166mPXu8pnlJ7txJZyIPiJFwjRxUmcUZKfklez0PTuMF91Xshu4Y9u/Z+l31kuvblh0NV/vyZYUqktAtp6wYqN6n6QsRWiaLy8v3ZTzNANSMtGlPDff/Zo72ywr/gxUCvMPLVNlEeYHal8yTolkvPgcL5Sygs9hDRUUFFD4hk68o3/EOKKbysdp3hUUUGkc2ojyYs3SujqdvmmeaF8qQTSLh/MfqqcJpkunDRpNF8N5ZCREEgFyaWPLx4FlLy2vH6jXs/sY46VaVleSVQb/R1iOcZG0Ddk2ErWkuDRuB5N4uDAuWqrH62CnY+NW22hZdujgEOMu1o+nj34BjDNVN8S9ELutSxUmASFZ0aSNtLfzF3uKeayej6w6mtAN/mx8PYKyYrxi8niz0XA++BaNboeKpxYwgZTQ/WKboXBNMgEHhReSyFpo43qnJzWPp9PR9BqdikxFpA2AVnCMynKNs1zH61u21XOxG6AGXMm/ao7b/33qjUgOhTx9FsfpI+1EGayWkBOm7CHH85wgcBzF0FlZvsQWz2VA7H6woU5KU7Z92m4yf8VXT/XXBHaQ8RKqbqo4dowCoZTXhdR/Ezr8BGPeC9oIBAAA" + } + }, + { + "ID": "e9de9ed7b670bf72", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/xavA5K28XigFi4gDPiTDRfyaqan?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "eda4c223d001a3944f1697deab98bb66/13460531525325270186;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/xavA5K28XigFi4gDPiTDRfyaqan?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:06 GMT" + ], + "Etag": [ + "cW6cQKmLzYwj2aPiux/K8w==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/12QQU+DQBCF/8t4pVGJ1oakBxSNDTahFKPGeNguA25ddik72GLDf3eoiaaeZjLfe7NvZw8fyuQQwEqVmxab7qREWgxNiq7V5LjU1jgED5BEyUr5NJaLuHr4etmufZGodncaT7bTKSucfMdKQLCHQqHOHQSvezCiQrblzKmrhzYKs1vovV9EfyibzY9QTse2/5zcsXeZhfME+rfeg7VdpVhgg0biEKlu7BolzYbf5q2WSKPaNjS6GvtwUB/ITnyGl7E/eVblnbooo0RlUVp0YiMMq7SVgpQ1LHxccg4gS0Jfd4QuaaxE53BYcvaz8MZWtUbi16lp0QMp+D73iiAohHY8MG0VVTosCs6FeWq3fDE4h/4bymQX1pYBAAA=" + } + }, + { + "ID": "4f275723f70c5264", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3b0e3457437136700a5aeead16f2525c/4983359733582965234;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:06 GMT" + ], + "Etag": [ + "OiM28SzJ3EFOe/Ubxd7oXw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8r7Z/oaWQRXeRm7uvmn6ocmVaSY50eU29oCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsAwobGRia6RoY6xoZKNXqQIQMjayMDawMDPQMQMAMLo5QGoJLiaGJqYWJhZmRiake0LxYkDC9rIqtBQAqbzelMgEAAA==" + } + }, + { + "ID": "036e0e2575f59a27", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d51f80916d3eb78a8be3202c20aba162/15024707039411479866;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:06 GMT" + ], + "Etag": [ + "TUYiICgV8LQB6F4jSrKs6Q==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:29:06 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyUkpR0lEqqSwAMV0cQ1yVanXgUiUIqRBPXxSplBJUbejyJcWoeoNDHH0DlGpja2sB5wvkN44AAAA=" + } + }, + { + "ID": "abb8f12ee9fccf8d", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3eb3312f1698dfd8cd7f6591c93d3b64/16588882553514466762;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0013?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:07 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "b16e117c79273354", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "155" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6eef88edda2a594f405a60d4dc6ba33a/18225113462632126042;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIDEiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkpwYThqUWxqOG12WENFY3k4WHFtSm85SjZxUSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:07 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/0x1KR_38HZJ4KfYMSUWHkYYYcO8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1S7W7aMBR9lcn725LvxEGatgqyNpSxNcBaqkrIca5TQxKH2IGhqu8+J6XS1E3V/lk+X/ce+wlteZWhIUp5vmuhOX7ciBSdIVAk17cPaErucWW6Y3xdXsawzH4U8WxaArm9lIb5y7pO1g6+up+412z1bb68vdquViv6HT8gbcI746wtKKjzWjTqPPDt4XI+mNQEb26KDS73d6OIHvHdrpyIcOLvbrRKQsGmvNpq7aNStRwaxuFwGORC5AWQmssBFaXxOq+xt426ERugShpvsgy9izTeSftcCEoUF9Wn5Vwna3oCDBqoKKDhEzr5xv9Y44XdI+9v85qgiTrj+QxRUTGet83p9qnzWRxrHYhullGy0pp+sQ46HdA8mkajxQdLYxlIxatevCBp8R9zZkQRCS/ommKGzdQMUwunzLQZMC9wKZieicEzXWB+hgPfJ1qnOvteRSpR+aFHaWBhyySZSz0vTc3AzpgPPrECPzQZs1MnsFm/YgNEwZjLWkh+Wn6URBeLaB1/Xc+iaByNdcCh4W9Zt0msSYtkORtptubUDRea1pUQzxZRcjFaxD87oJUwhZzQ43xXoCEjhYRnHS0VUa3sSulOXanaaxbPLtEJ5Lo+2hP6KbsaednxLM/xA8u23MAJXNSTG/UX5mLzzwfqQ0qo1OkFXx4KdZPoAZs1lITr8ZDj+04YOo7leue6emVaolQhsYNwS52c5nz3uNsWOBXpY/slgz0UooZmkGuPPadAKBVtpbqPj55/A9PErX+zAwAA" + } + }, + { + "ID": "dae7f636498431eb", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/Jpa8jQlj8mvXCEcy8XqmJo9J6qQ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5501620abe4337498bf87f7e26853459/1342826382297173738;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/Jpa8jQlj8mvXCEcy8XqmJo9J6qQ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:08 GMT" + ], + "Etag": [ + "7H3OEmML/JuN5Kr4J8QyRg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P206DQBCG32W8pbGeWiTphW2ILSIK2qSJMWa7DAjussvuoCGEd3epXs3pm3/+GeCranII4FiVbYemPyuR0inJ0HaCrAtaNRbBAyRWOnK5vXoK5WN8HnXJzYO5jvy0z8rVyhGWf6JkEAxQVChyC8HbAA2T6NaK+YcjqNdTsUtew/swcw2p8qmR7OP4bh2HML6PHtTqmGGBBhuOk5o2qkZOu8lo3gmONNPK0Gy5uIQTfZpEmvl1Kmpffh82Ie/9QysjdRst2tRRQnFGlWocuH8Bd4QUMZGpH+cSLuC/XveE9tkojtbiJDr/O7BRUgsk54ZMhx5w5l7dVgRBwYTF8Re6FWoeSAEAAA==" + } + }, + { + "ID": "c6688d7e8e5c4cc0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon695cc71810ad4c55bb072df6e6a17690ff2b372f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5501620abe4337498bf87f7e26853459/11384173683814009650;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon695cc71810ad4c55bb072df6e6a17690ff2b372f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:08 GMT" + ], + "Etag": [ + "vL1Yeyg2XmdGPwLaQVKTGw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qX+RhGplamG0XkprgHlPskBoZ5h7iX29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwvXxgIhAHr9uHVuAAAA" + } + }, + { + "ID": "aad2db5c1b34c5ae", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "157" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a4576a80c97a278576adcba3a3f32d7e/12948349197916996546;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIDEuMyIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiWUZ4OXNlRHFONDNpVWlLZmFnNWZadnRkeEVRIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:09 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/BdXqqQPYb2qjDNjkgjZqjHqUf80\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1S7W6bMBR9lcn724ZvApGmrUtohxqhNoF1rSpFtrmmTgADNkmrqu8+Q1Np6qZq/5DP173n8ox2vM7RDBFetD10T5+3gqATBAoX+vUeLfFdUJvuIrisLmLI8qsyTpYV4JsLaXzPf7Xt9dUtsdvtItnuiu1du/3RZiww75E24YNx3pcU1GkjOnU69e1Ztp7cnj+GEhZt4jo845cMFx6726v8MbrWKgklW/J6p7UPSjVyZhiHw2FSCFGUgBsuJ1RUxtu8xt42mk5sgSppvMsy9C7S+CDtaykoVlzUX7K1Ttb0FTDooKaAZs/o6Bv/Y41X9oh8vM1bgibqjJcTREXNeNF3x9fnwSd9anQgus6i1a3WjIsN0PEDraNlNE8/WRNHozlIxetRnmJS/sekOVZYwiu6oYE+DzFDYgWEmTYD5k1dCqZnBuCZLjA/D6a+j7VODfajCteitqhHTcoCgi2WE0pcKwDH90xvSkLbwSbJdZrvsnHJDrCCBZeNkPy4/nwVnaXRJj7fJFG0iBY64NDx96ybVaxJ6SpL5pqtOU3HhaYNNcRJGq3O5mn8cwB6CUsoMH1atyWaMVxKeNHRUmHVy6GU4WuoVXslcXKBjiDX9dGRME451MirgWd5jj+1bMsNLd9EI7lTf2G26/55ojGkglodb/h6KjRMogfsNlBhrsdDju87Yeg4luud6uqVaYlKhdiehjvqFLTg7UO7KwMiyEP/LYc9lKKBblJojz2ngCkVfa2GXx+9/AbRxKFStQMAAA==" + } + }, + { + "ID": "d1cf6d499b15ce40", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/YFx9seDqN43iUiKfag5fZvtdxEQ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "902aecaf55128cdbf885ebed3236cebb/14512523616803257426;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/YFx9seDqN43iUiKfag5fZvtdxEQ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:10 GMT" + ], + "Etag": [ + "4QZN8Y7o6QLvlex4VrkGPw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P0U7CQBBF/2V8hQS1gjbhARTU2FRarQkYY5bttC5su2V3Cm2a/ru76NPMzZyZe6eDvShT8GEr8kONur3IkSLXxGhqScaWSpUGYQBILLekF23C2/VEjaPgKLHxPvT+cXWaTi1h+A8WDPwOMoEyNeB/dlCyAu1aNvq2BLWVE8vgdfZuZaFSJ8MkCGbzYAH9Vz+AndrGmKHGkqO7VWm1Q07PLmZaS440rJSm4WR8BWf6PFkvmzuDD4fQuxaJeMlYfpNtjpQ2i8hSUnFGQpUWTN7AmpAiJmN1shnhEv71vCU0K604GoPu6OjP4F4VlUSyaUjXOADO7KNPgsDPmDTY/wK+SWNXRgEAAA==" + } + }, + { + "ID": "76ec9bd623d5a554", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon1c5c0cf8ba1fdbcb418e365057b923a0bd76264f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "902aecaf55128cdbf885ebed3236cebb/6107408319604029594;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon1c5c0cf8ba1fdbcb418e365057b923a0bd76264f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:10 GMT" + ], + "Etag": [ + "O+IrsIPi+GBkoDyNJkYpeA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8r7a3sWFXsGZGq7O2Xnu1T6eWVHFqQ62toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwnrGSvVxgIhAL9uO7FwAAAA" + } + }, + { + "ID": "73761a49886ca9bd", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "175" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "666c2aa0a4c997db637e93c556291ce9/7671583838001917994;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIENBU1QoMS4zICBBUyBOVU1FUklDKSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiblhjOElXVkh6aE9RandxTkFEcENOVlA1N044IiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:10 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/Ov4lG79qMalniwLpTpatgOKwQsc\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TbW+bMBj8K5H3ZZPW8A4m0rRFhGWoKW0T0m5TpciYB+IGMMFOUFf1v8/QVJq6qdo3y3fP3T1neEQ7VmdoglJW7A/QPry75yn6iECSQt3eoQX5iWvdnuHzah7BOrsqo3hRAbmdC+3yaJdzz99fkLJm3aJJGiKLy/PuWtA7pERYL5wdSgryrOGtPPNcc7JejevvFEe3N99+bS+v77t9PJ01QXxz5XgxVlMCynzB6p2a3UrZiImmdV03LjgvSiANE2PKK+0lr3Y0tabl90Cl0F55aWoXob3h9rnklEjG60/rlXJW9CXk0EJNAU0e0Uk3+scaz+wBeXubFwdFVB5PHxHldc6KQ3u6fex1kodGGaLrdbj8oWaGxXrodECrcBEGySiYrpL3xtgajaarUby+CJdR8EHxMxCS1YNgQtLyP7JnRBIBz+iG4hzrqe6nBk5z3cwhdzybgu7oGBzdhtzNsOe6RM3JXn6YIjWvSeoTkxiW5RgeTlMHu7mT67bn2j7NwTYh83VsYG9YuwUiYcZEwwU7FRIsw2kSbqKvmzgMZ+FMGXQte826XUaKlCzXcaDYitO0jCtaX0wUJ+FyGiTRTQ8cBCygIPRhtS/RJCelgCdlLSSRB9GX0p/6opVWHMVzdAKZqo8OhCFlXyOrep7hWK5nmIaju+7waUrSyr8wbHp/PtpgUkEtT6/6/HioT6ICthuoCFPxkOW6lu9blmE7Z6p6qRu8kqpQz99Rq6AF22/3uxKnPN0evmRwhJI30I4LpXFkFAil/FDL/mdAT78Bb3GZlscDAAA=" + } + }, + { + "ID": "860601969f9a7738", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/nXc8IWVHzhOQjwqNADpCNVP57N8?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ead7ed8c4e4c6a0872074969aafac64a/9235476781911534010;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/nXc8IWVHzhOQjwqNADpCNVP57N8?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:11 GMT" + ], + "Etag": [ + "nU8KFNc17AGWV+o+TJq/3g==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8bBtbjZaQ9IJitShii0JNjDHbZaDgsgvskKYlfXeX1qv5++bMmQ5+c5mADds8q1tsDlcZ0rpPQtStIG1CpaRGGAISywwpI+vlMeCTqfO0iQdq8PFcX99ms5khNN9hycDuIM1RJBrsrw4kK9GspeMfQ9Ch6osgel2EnmsapUouDd935v4CTt+nIRRqG2KKDUqOvVrVqAI5eb3RpBUcaVSphkbT+xs40+eJ/OSWt4mXx93butjXgfNQuUG8upsGlqGE4oxyJQ0YvYM5QoqYCNXeuIQJ/NfzA6FeNYqj1tiLji8HXFVWAsm4oabFIXBmXl3mBHbKhMbTH7cGOw9IAQAA" + } + }, + { + "ID": "7becf32dc467a0ad", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonab9a2a1335178bb586f5f047649cfe42ed908187/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ead7ed8c4e4c6a0872074969aafac64a/830361489007207682;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonab9a2a1335178bb586f5f047649cfe42ed908187/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:12 GMT" + ], + "Etag": [ + "MrZLiYvFhgqwHda83wj1bA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8r7FkX5ZEaWuWWkF5Z7pCRaGJdnGSY52toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwnrGSvVxgIhAG8tq7dwAAAA" + } + }, + { + "ID": "a818175f590134ce", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "168" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a3b7ca8149cd249726f520500b47480e/2394537003110194578;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIE5VTUVSSUMgJzAuMjUnIiwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJUSUFveWJteERJMk1hZHQzQUVpZ3B4dlVDd2ciLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:12 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/2SGmzA-fGi1ZnGVehqFHNG2K1JI\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TW2+bMBT+K5X30JcmgLlHmrYooRlrijYCrVZViow5EDeACZikadX/PkNTaeqmam+Wz3e+m+VntGVViiYoYfmug+b46YEn6AKBILm8vUdLcudUqjF3rsqFD3H6o/CDZQnkdtEqeLUon6ajbMG0u2pxA5vd5bdgga+07/49kiSsJ067goIY1bwRI9vCk3g1jvwpPybl49zH1yQV+tRjef24j2eHXG61UGRLVm3l7kaIup0oyuFwGOec5wWQmrVjykvlza+yx0rd8AegolXeaSkyS6t8oPal4JQIxqvP8UoqS3gIGTRQUUCTZ3Ti9f8R4xU9TD5O86YggVLj5QJRXmUs75rT7XPPEx1rKYh+xl74S+4MwfrR6YBW3tKbRWdBfO2F/uzsXB1j81wCU2gFqwamiCTFf5hOiSAtvE7X1MkcNVHdRHOSTMUZZKZtUFBN1QFTNSCzUse2LCL3RE8/bJFKBrBSmlJwTEdLtEyjtosTzU5pQrBuYNXAmusmkMKQtwEiYM7amrfs1MQs9KaRt/Yv14Hnzb25FDg07D3qNvQlKArjYCbRElM3jEtY34gfRF44nUX+TT/oWlhCTuhxtSvQJCNFCy9SuhVEdG1fSn/qG5ZcgR8s0GnIZH10AAwu+xpZ2eM0U7dsDWsmxrqLBnAj/prphv3naw0iJVTi9Jyvr4Z6J9Jgs4aSMGkP6Zalu66ua4Y5ktULVeOlcAm23S3Vc5qz3Wa3LZyEJ5vuawp7KHgNzTiXHHtGgVDKu0r0vwC9/AaPEhSIwAMAAA==" + } + }, + { + "ID": "08b1d29fb81ee7d5", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/TIAoybmxDI2Madt3AEigpxvUCwg?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7ab4f8a198ff5161ffe6d9fe711461e0/4030767912227853858;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/TIAoybmxDI2Madt3AEigpxvUCwg?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:13 GMT" + ], + "Etag": [ + "fukTfomfV92b4qy+sMKdyQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8lCYVjUaSXlAkkQjGYvHGGLMsA9IuDGUH2w3h3V1ar+bvmzNnRtjXbQEe5HV1GLA3VxXyZk5S1INibUNHrUZwAFlUliyH/bakpvx4dPO7g7nWyUthNquVJbT8wUaAN0JZoyo0eJ8jtKLBeW35bQk23Vy8ZkmYRoFtNFRcGnHsr+MQpq/JgR3lKZbYYytxVut62qHkaDZaDEoiLzrqefFw78KZPk+2kU8mb05PkZuIgm/9sK66028WHCtLKZKCa2otmL2DPcLEQqV0tC7hBv7rtWHUbz1J1Bpn0eXlQEBNp5CtG+4HdEAK++pzzeCVQmmc/gC5+wanSAEAAA==" + } + }, + { + "ID": "2b9f3bf5b05ebc4d", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonf6dcdce8581b1f1c792b17dcba2342042199bede/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7ab4f8a198ff5161ffe6d9fe711461e0/14000058723530068586;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonf6dcdce8581b1f1c792b17dcba2342042199bede/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:13 GMT" + ], + "Etag": [ + "t4Ml6hL3KkzeegmQY67JQA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qXmPjmmGX4GHtnV6WmpucGRpqZewU62toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwob6BmZKtXGAiEA09ScHHEAAAA=" + } + }, + { + "ID": "3ba06728201449bd", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "158" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "65a4ddbc099b316b6e440b4496898863/15636290732142578682;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFRSVUUiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IlhEQndUYjBmWTF3eVJEMHlLYjZEY0R4VmZ3SyIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:14 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/VRxLkx_fu0-aL9GrobDRtHSBoxw\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1SbW+bMBj8K5P3tQnvBCJNWxtYhoqijZB2nSpFxjymbgATbEKiqv99hqbS1E3VPmH57rl77swT2rE6R3OUsWLfQXv6+MgzdIFA4kLd3qMY//Jq3Q6862oZwSb/XkaruAJ8uxTaTXKMd8ct7fQJjv1ly7Mgkd/WV/zY3yMlwgbhvCsJyEnDWzmZueZ8s57+DK76NNPpndGfkkA/XWduQILjDe2v1ZSAksas3qnZBykbMde0vu+nBedFCbhhYkp4pb3uqx1MrWn5IxAptDdemsoitHfcPpecYMl4/WmzVs6KngCFFmoCaP6EzrrRP2K8sEfk/TSvDoqoPJ4vEOE1ZUXXnm+fBp301ChD9GMTJndqZgw2QOcDWodxuEg/pMkmVHAOQrJ6nE9xVv7HqjmWWMALuiUe9fRM9zPDy6huUqDOzCagO7oHjm4DdXNv5rpYzclBfpzCNa8tw3Qt37HAyv0ccgv7YGSubYAzI7ZPPdtxaU7NbEzZApYQMNFwwc75F0l4mYbb6Ot2FYZBGCiDvmVvWbdJpEgq6mqh2IrTtIwr2tBDtErD5HKRRjcD0AmIocDktN6XaE5xKeBZWQuJZSeGUobT0KvSWkWrJTqDTNVHRsK45VAjqwae4VjuzDDVx/NtNJJb+Rfme86fbzSaVFDL8yO+vBUaNlELtluoMFPrIctV5fmWZdjORFUvdYNX0sfmzN8RqyAF2z/sd6WX8eyh+5LDAUreQDstlMaBEcCE8K6Ww7+Pnn8Doh8Um7YDAAA=" + } + }, + { + "ID": "104694419a26e211", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/XDBwTb0fY1wyRD0yKb6DcDxVfwK?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c3fcb13520052b98bffb311ee38517de/17200466246245565322;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/XDBwTb0fY1wyRD0yKb6DcDxVfwK?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:14 GMT" + ], + "Etag": [ + "Qe3wM1qq1g6R7HFGHXzPww==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P206DQBCG32W8bRPQhCYkvShSxRR7QGtqjDHLMiB1YYEdsiLh3d2tXs3pm3/+GeGrrDPwIS2LtsduuCqQDjZJUPWClAmNrBXCDJBYYcgD3uhHt23dwksW0d19dPrZa71cGkLxT6wY+CPkJYpMgf82Qs0qNGu582EIGhpbBLtdvF5tTaOSmW1sj3G8CuI1TO/TDM4yTTDHDmuOVq3p5Bk5PVijWS840ryRHc0X3jVc6MvkFAb6OXXyV1cPSegMm9QLefj9kuuNoYTkjEpZG/D4BOYISWIikdq4BBf+62AgVPtOclQKrajzd+BWVo1AMm6o63EGnJlXo5LAz5lQOP0CPkBC5EgBAAA=" + } + }, + { + "ID": "32ea6f9108907068", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon31263953e3d9ded3a9e1b641e57c49f8456fdf2b/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c3fcb13520052b98bffb311ee38517de/8723293359320088530;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon31263953e3d9ded3a9e1b641e57c49f8456fdf2b/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:15 GMT" + ], + "Etag": [ + "552b6oqAxoLcF+5TiUtrkw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qbmholmeUXOlbk+yS7aZuGZIaWFGWX29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwqXFJWmKtXGAiEAwd0BLnEAAAA=" + } + }, + { + "ID": "1765cf29035fd631", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "159" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c2f1ade76aff4441736112d51e515b17/10359525367932598370;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUICdBQkMnIiwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJPU3dnVHg2NlNiQ1g1bk95RXZrcE9zMlg0V2wiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:15 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vgwn9dV1XfcP2ImCgXxbO8qWUvA\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1SXW+bMBT9K5P30Jc2fAUDkaYtI6xCi5IuIU02VYqMuaZuABNskkZV//sMTaWpm6pJPFg+555z7jFPaMerDI1QyvN9C83p44NI0SUCRXJ9e4em5JdfmcOJ/728jmGV3RTxbFoCWV9L45AfqyC7tTaM3thxGeabx3Tu79erw/gOaRHeCWdtQUFd1aJRVx62R6vlYL485skjxss03LjV/BQddvVc2pvhutBTEgo25dVOz94rVcuRYRyPx0EuRF4AqbkcUFEar3mNg23UjXgAqqTxxsvQu0jjHbfPhaBEcVF9Wi21s6YvgEEDFQU0ekJn3fgfa7ywe+T9bV4dNFF7PF8iKirG87Y53z51Osmp1oboxypa/NQz/WIddD6gZTSNwuTDxfhreKHxDKTiVS+QkLT4j6wZUUTCC7qlPvPN1AxSy0+ZaTNgrjekYLqmD645BIYz38OY6DnVyfdTpBKVmXrYyQijgf7AS60UDz2HAGO2RcHNbBb4zE2dfs0GiIIJl7WQ/FxAuIjGSbSNv21nUTSJJtrg2PC3rPUi1qRksZqFmq05dcOFpnVFxLMkWozDJL7tgFbCFHJCT8t9gUaMFBKetbVURLWyK6U7dcVqrVk8u0ZnkOv6aE/oU3Y18rLjWa6DPcu2XHeIMerJjfoLw5b15yP1JiVU6vyKL4+FuiQ6YLOFknAdDzkYO0HgONbQvdLVK9MSpQqI7QU76uQ05/v7/a7wU5Het18yOEAhamgGudY4cAqEUtFWqvv50fNvE5xygrcDAAA=" + } + }, + { + "ID": "a21e5c671b1106d1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/OSwgTx66SbCX5nOyEvkpOs2X4Wl?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a046d9f5349e693223021995db5cff1c/11923700882035585266;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/OSwgTx66SbCX5nOyEvkpOs2X4Wl?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:16 GMT" + ], + "Etag": [ + "qA4bZjRWC1EQrAXHOpZoUg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PYWvCQAyG/0v2VUHFdVDwg4pModjZKopjjOs17VqvvfMunSvS/77U7VPykid539zhUtQp+JAU+bVB2z7lSLu+idA1ihwXo2uHMAAkkTN5nU+Tcxkdl+PVzs5P69Cc9SGfzZhw8gsrAf4dsgJV6sB/v0MtKuS1bPTJBLWmF/E+2mxfWVc67fX2EATzRbCC7qMbQKmTCDO0WEvsjxmrS5S06XOmjZJIQ6MtDV+8CTzoxySMb/n+x/PiZHl6rsN29X0xoZucpkfFlNJSUKFrBg8xsAlpEirSNw4JY/jXi5bQvVkt0Tnsj47+DJa6MgqJ05BtcABS8KfrgsDPhHLY/QK43loBRwEAAA==" + } + }, + { + "ID": "27098cd4d052675e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon0b763dafc9fc9e7b1b6473aeff21ce5d2f98f5b3/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a046d9f5349e693223021995db5cff1c/3518585589131258938;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon0b763dafc9fc9e7b1b6473aeff21ce5d2f98f5b3/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:16 GMT" + ], + "Etag": [ + "fqEWaGU8v48YdTHoiH8TLQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qnFbqGJ7qHWpSZWESmhHjkZ3pYhPgE2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwo7Ojkr1cYCIQB6PW5IcAAAAA==" + } + }, + { + "ID": "b923115e0c61605f", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "174" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "18c4bcb11ba58140e774da4e9e40eeb0/5082760003722618314;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIENBU1QoJ2ZvbycgQVMgQllURVMpIiwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJNTHd2SGNOZFFiNWFZTEJqN0dhRTRsMzFFaEgiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:17 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/4CZlvR6hVnVdVv-7eiMuu_BOk4I\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TW2vbMBT+K0V76AZNfL8FxpYmXmrmeqvjpLQUgiwfO2psy7HkhFL63ye7KYwyyt6Ezne+m9Az2tE6QxOU0mLfQfv06ZGl6AKBwIW8fUAhvndr1Zy7P6tFAKvsdxlEYQX4dsEVc3ZfHmJ7u67X2fowcoBed93m8tfODB6QJKE9cdaVBMSoYa0YObY+WS3H1+HxcEWi7Ca18F14+egssG+WhuZvr+QWhzIPab2Tu1shGj5RlOPxOC4YK0rADeVjwirlza9y0JWmZY9ABFfeaSkyC1c+UPtWMoIFZfXX1VIqS3gMObRQE0CTZ3TiDf4R4xU9TD5O86YggVLj5QIRVue06NrT7XPPkzw1UhDdrPz4Tu4MwfrR6YCWfujPkrPZdJl8Ps8ZOz+bLs8u7xJ/+UXCM+CC1gNfgtPyP6xnWGAOr9MNcXNXTVUv1dw0V/UccssxCaiW6oKlmpDbmevYNpZ7oqcftnAtYxA30+Wu5aW2pYPqmKar5bqLnTxLsa6nDtFzD7QhdQtYwJzyhnF66mMW+9PE3wQ/NpHvz/25FDi29D3qNg4kKIlX0UyiJaZpKZOwvpcgSvx4OkuCdT/oOIRQYPK03JdokuOSw4uU5gKLjvel9Ke+Z8kVBdECnYZU1kcGwOCyr5FWPU6zDNvRdM2yPc9EA7gV72eOpmp/v9kgUkEtTo/6+naodyINthuoMJX2kGHbhucZhmZaI1m9UDVWCQ/rjrcjRkEKut/ud6WbsnTbfc/gACVroB0XkuNACWBCWFeL/i+glz+1cwPSxgMAAA==" + } + }, + { + "ID": "1648df3a4d571c3f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/MLwvHcNdQb5aYLBj7GaE4l31EhH?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c9f65ef2f3d271a626487406b00918f7/6646935522120506714;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/MLwvHcNdQb5aYLBj7GaE4l31EhH?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:18 GMT" + ], + "Etag": [ + "sW0uHXdcEwHWk6ctnIEKMA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3W6CQBCF32V6iwn2RxMSL6QhxRRNxRprmqZZlgHBZZfuDjWE8O7u2l7NnMw3c84McK5kDgFkVfnToe7vSqSta1I0nSBjS6ukQfAAiZWWNAe/iz9yHl3iw3nGSa6i1/VysbCE4SdsGAQDFBWK3EDwOYBkDdq1wv+2BPWtE+HxPdpZ2ajcyc0+SZZhEsH4NXpQqyzFAjVKju5Wq1WNnFYuZt4JjjRplabJfHYPN/o2WSeX35hv8m32xI5JWM9fWPQoHqbRKbaUUJxRpaQF9zuwJqSIiVRdbEaYwr8Oe0LzphVHY9Ad9f8MnlXTCiSbhnSHHnBmH40rgqBgwuB4BWP66BNGAQAA" + } + }, + { + "ID": "23f7d8cddf0b4561", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonfc8d2f8059b652e074481f28a7fdba22b7c2f9e1/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c9f65ef2f3d271a626487406b00918f7/16688282823637342882;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonfc8d2f8059b652e074481f28a7fdba22b7c2f9e1/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:18 GMT" + ], + "Etag": [ + "nYE7y6mF77ps4xVNa1V22w==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8rnRbqaV5rlupmbFxSbVIT5JRqGGRmV29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwpH5VqWKdXGAiEAdmq4zXEAAAA=" + } + }, + { + "ID": "8833abb1f7e46cbd", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "185" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d0df1a11346e345dcfe2af952e7df911/18252457238245478962;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFRJTUVTVEFNUCAnMjAxNi0wMy0yMCAxNTowNDowNSciLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkJNeGdjMGg0Q1BPNDBiSTZreEpTZFR3SzAxUiIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:18 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/KbO03O0lHWtKrXK10oYk63lYgy4\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TW2+bMBT+K5X30JcmmJshSNPWJaxjSdOOkHWdKkXGHIgXggk2TaOq/32GptLUTdXeLH+3cz7Lj2jDqwwFKOXFroXm8O6XSNEZAkULfXuHZvSnX2Fn4k+3FxEss+syms+2QG8upDFNr7B9hcsvN2ra/JiaWNxuiF3eFgfnDmkT3hlnbclADWrRqIFHrGC5GH66fCgYXjvj6ysHpxHZPHxdZMl+is1YqySU+YxXG61dK1XLwDD2+/2wEKIogdZcDpnYGi/zGveWUTfiFzAljVdZht5FGm+kfSgFo4qL6v1yoZM1PYYcGqgYoOARHX2jf6zxzO6Rt7d5SdBEnfF0hpiocl60zfH2sfNJDrUORN+WYXyrNf1iHXQ8oEU4C8fJSRJdhovk/PL65NTCJhlge2DhE9MNsBNg91QrM5CKV711QtPyP7bIqKISntEV83Mfp3iUmn6aYyuH3PUcBtjFPrjYgZxkvkcI1TrV2fcqWokqy5hNRgCWa9McfMZcx8TYIcTLaebZOGXMTk2H9AU0QBVMuKyF5MdqxnF4noSr6PNqHoaTcKID9g1/zbqJI01K4uV8rNmaUzdcaFpXUTRPwvh8nETfO6CVMIOCssNiV6Igp6WEJx0tFVWt7ErpTl3l2msezS/QEeS6PtYT+im7Gvm245muTTzTMl3f8THqyY36CyOm8+fz9SFbqNTxfZ+fEXWT6AGbFWwp1+MhmxB7NLJt03EHunqFTbFVI2p5ow2zC1bw3Xq3Kf1UpOv2Ywb3UIoammGhPe45A8qYaCvVfQv09BuXdtLJ0QMAAA==" + } + }, + { + "ID": "2535491d9196c732", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/BMxgc0h4CPO40bI6kxJSdTwK01R?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8008292016163ecd363367f9c1df7807/1370170157893749698;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/BMxgc0h4CPO40bI6kxJSdTwK01R?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:19 GMT" + ], + "Etag": [ + "Q+zJSA8zCQc4LNFt+Jbqbw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P226CQBCG32V6qSbYGNuQeAHGplKwAnrVNM2yDIguLO4O8UB49+7aXs3pm3/+6eFUNTm4kFXluUN1eyqRYpskqDtB2oRWNhphDEisNGQ8ugep93pfxnwWbt5oFGTn7LJYGELzA9YM3B6KCkWuwf3qoWE1mrXC+TEE3Vpb7NbRKt150da0apnb1mYfhp4frmD4HsZwlFmCBSpsOFq9Vskjclpbq3knONKklYomL/NneNCPiR9dS+4cZsvt58zJ1vPTNUjz3eXDmSaGEpIzqmRjwH0K5ghJYiKRF+MTpvBf+zdCvVWSo9ZoRZ2/A0tZtwLJuCHV4Rg4M8++VwRuwYTG4Re8YAH+SgEAAA==" + } + }, + { + "ID": "c8edb0856f1ef8fc", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonddc369ee253afe8cc541004667fad730bcc3b146/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8008292016163ecd363367f9c1df7807/11411517459427362570;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonddc369ee253afe8cc541004667fad730bcc3b146/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:19 GMT" + ], + "Etag": [ + "u1BQpXI6/OxVGg5vsVa50g==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qXGjoFFkR4mun7V4S5p5uWFYclmhqk29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwmbmFqYWJgZmZjqGSjVxgIhAHnG1sF5AAAA" + } + }, + { + "ID": "b6abec527a0b972a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "220" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "17f34934f552fdf1c438fe0a0ad32e0a/12975691878330466201;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFtUSU1FU1RBTVAgJzIwMTYtMDMtMjAgMTU6MDQ6MDUnLCBUSU1FU1RBTVAgJzIwMTYtMDMtMjAgMTU6MDQ6MDUnXSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoickp1QlhZdmhtalkyN29oQjFmZFhkRHgwNFBsIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:20 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/TrRoZUWtc9y1g58MJoUDjr8zA1A\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TXW+bMBT9K5H30JcmGAif0rSlCavY0qgjsH6sU2TMhTgBTMAky6r+9xmaSlM1dXuzfM49595z7Ue0ZWWCXBSzbNdCfXy34TE6RyBIJm8f0Jzc2yUez+wvxaUPUXKd+4t5AeTmslHCOuD30Y2gzlHNDPvqM49mm9r+NVEnD0iKsE44aXMKYljxWgwtU3Oj5aj+3F7c3u3XxeZOs/j6Qk2T22T2E4+vc1nVQJ7OWbmVtWshqsZVlMPhMMo4z3IgFWtGlBfKS7/KXlOqmm+AikZ55aXIWRrlDbcPOadEMF6+j5bSWdIDSKGGkgJyH9FJ1//LGM/sHnl7mhcHSZQeT+eI8jJlWVufbh87nfBYSUP0NfKCO1nTD9ZBpwNaenNvGg6+h/6VtwwnV9eDMw2r5hDrQw0PVMPFYxcbZ+eDfxB+SPEEGsHK3j0kcf4fgyZEkAae0RW1UxvH2IlVO06xlkJqWGMK2MA2GHgMqZnYlmkSWSc6+b6KlLykjuEQh5iObpCxaekJTXRHjW0SY9PR0kSNgeopjfuMaiACZqypeMNO6U0DbxJ6K//TauF5M28mDQ41e826CXxJCoNoMZVsyalqxiWtS9FfhF4wmYb+tw5oG5hDRuhxucuRm5K8gSdp3Qgi2qYLpTt1W5FaC39xiU4gk/HRntB32cXIio6nGrppqZpqOI5qo55ci1eYieVW/txwb1JAKU5P4HnTqOtENlivoCBMtod009QdR9fVsTGU0Qus8kI4RLOcLdUzmrHderfN7ZjH6/ZjAnvIeQX1KJMae0aBUMrbUnQ/Bz39BoLflln0AwAA" + } + }, + { + "ID": "c911642dd7a3b876", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/rJuBXYvhmjY27ohB1fdXdDx04Pl?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6084066224ceb4391c8303cc6e01dce1/14611923886942976041;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/rJuBXYvhmjY27ohB1fdXdDx04Pl?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:21 GMT" + ], + "Etag": [ + "Fdrkzrj8y9x4R3+waFIW8Q==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U7CQBCF32W8FJKCRLAJFyAl1oSklBohxphld0pbtt26OxVKw7u7i17N3zdnznRwzCsBPuzzw3eDur07IK1dEqNpJBkbalUZhB4gsYMll0IfL7qYtE/nUfxwf2LL8H2ynk4tYXiGJQO/gzRHKQz4Hx1UrES7lnpflqC2dkUSroJNMltFtlUq4VpxEAWzJFjA9fPag0LtY0xRY8XR6dVaFcgpdFZFIzlSv1aa+uPHIdzo20S/NvPt7icri91wrLL5IBVbsTh7o0haSirOKFeVBd82YI+QIiZjdbI+YQD/9bwlNJFWHI1BJ+r9HXhWZS2RrBvSDfaAM/vsS07gp0wavP4CcTOjWEoBAAA=" + } + }, + { + "ID": "e831c73aa91ebc8f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonc959a9a6935a4673dcd391b8ab0692fd1bec3fcb/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6084066224ceb4391c8303cc6e01dce1/6134470628830606449;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonc959a9a6935a4673dcd391b8ab0692fd1bec3fcb/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:21 GMT" + ], + "Etag": [ + "HD6g9rBjDHPikenVQxdQRA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8p7uJilWxY5Zbl4BGRmp+aFBVakBAY52toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsg5FKhiamFiYWZkYmpnoGSrU62ARjwRAA/Xuo9ZYAAAA=" + } + }, + { + "ID": "71e5e27c8479ab36", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "196" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1d159f150ac1d17b4b5082db132102b9/7770702637459893249;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUICgnaGVsbG8nLCBUSU1FU1RBTVAgJzIwMTYtMDMtMjAgMTU6MDQ6MDUnKSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiOGlNdktoMEY0Q211UHRvOE5aR3NGSWNnMTFTIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:22 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/R5ku3gJcB_7ZnGrzQAMgVGVQMDs\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1T72vbMBD9V4L2IRs0sfwzdmBsWeIGr0loHadlpRBk+eyosS3HkhO60v99spvCKKPsm7j37r27d+gZ7VmZoDGKWXZooH769MhjdIFAkkxVH9CC3LsltmbuVTEPYJNc58FqUQC5mwsttPeNmf2kP7aj+3Je/76ZLLPb+e3NciYekBJhrXDS5BTkoOK1HIwcY7xZD122PF7t8KU1LZpryd3V/VxcBjTT9bXqEpCnC1buVe9OykqMNe10Og0zzrMcSMXEkPJCe5tXOxpaVfNHoFJo77w0tYvQPnD7lnNKJOPl103rrOghpFBDSQGNn9FZN/jHGq/sDvl4mzcHRVQeLxeI8jJlWVOfq8+tTvRUKUN0s/HDX6qnW6yFzg+09hf+NOp97u8gz3n/ohcFS38dTZbXvb6BdWeAzYGBe7o9xtYY2/0vSiQBIVnZuUQkzv9joYRIIuAV3VI3dXGMvVh34xQbKaT2yKKAbeyCjS1IncQdOQ5RfbKV77pIycs49uIkpZ5jxxZx0jRNLGo6KbHdGDse1l2KbXuEcZdFDUTCjImKC3ZOaRr6k8jfBpfble/P/JkyONXsPesuDBQpCjerqWIrTlUzrmhtWsEq8sPJNApuW6ARsICM0Kf1IUfjlOQCXpS1kEQ2og2lfbXpK61VsJqjM8hUfLQjdFO2MbKi5em26Yx0Q3d0T/dQR67le8zA2Pn7kp1JAaU8n/r1oqidRA1Yb6EgTI2HTMcxPc80dcseqOgl1nkhPWKMvD01M5qxw+6wz92Yx7vmewJHyHkF9TBTGkdGgVDKm1K2PwS9/AFhOZ/U3AMAAA==" + } + }, + { + "ID": "f4dc7ddb6379c5c3", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/8iMvKh0F4CmuPto8NZGsFIcg11S?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f6466a455eba826def642b64fcd237ca/9334877052051252625;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/8iMvKh0F4CmuPto8NZGsFIcg11S?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:22 GMT" + ], + "Etag": [ + "Do+6uGiJjnHeaPbk7RdUWQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/22QXWvCMBSG/0t2uQo6hkrBC7/tpq6mymBjSExPazRtuuZ0Q4r/fSfuQtgkF8l78j7nq2ZHlcfMZzuVflZQnu5SwJV7cLCVRktXYXILzGOAIiXnyNy3q6l6OuQzEOHu2OHx5nXV65HDyj1kgvk1SxTo2DL/vWa5yICwpLklB54KJ/h4+MJHpDMTO73czOf9wXxMkf/k9hLatq54tObBcnoDP3t/qYcrtQ4W42jdX4S3wA86HjuYHYcESsgluDGK0hxAYuA2FFdaAjYKU2Kj03Z5yX356arF1/O+OXkcZlWIprt8m9pJINNWKyKXNlKgMjkZNxF1yNCg0Nx805DsMpTTgxOCDUsjwVpwSZu/BYYmKzQgdYNlBR6TgnY8U8j8RGgL5x/yQ3VwwQEAAA==" + } + }, + { + "ID": "fce1a01b7a7f1001", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonbb9bdfc965b4a6fffd4c36fa58b069018c055700/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f6466a455eba826def642b64fcd237ca/929761759146926553;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonbb9bdfc965b4a6fffd4c36fa58b069018c055700/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:23 GMT" + ], + "Etag": [ + "FumO7MDkim7vI1Dh//66UQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8q7leb6m/u6ZGfmmpd5Grpk6OubmYUG2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsU7JCYiplpObk5CvV6kB4hiamFiYWZkYmpnoGSrWxtUAUWwsAq13hvZUAAAA=" + } + }, + { + "ID": "1774013bb8f8b29c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "195" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "dacf7514a516f4e17f889f1d64474be1/2493937273233136233;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIERBVEVUSU1FKFRJTUVTVEFNUCAnMjAxNi0wMy0yMCAxNTowNDowNScpIiwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJwQVpqcXZZdkg2WjVDS1VMQ29pNFhrUVlJREoiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:23 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/52sYHp8nOgfxH7DVS-mrPEhnTU4\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TbWvbMBj8K0X70A2aWH5/gbGFxGu9plmbOO1SCkGWHztqbMuxlGQl9L9PdlMY3Sj7YoTunrvnTviA1qxKUYASlm+20Dx9eOQJOkMgSa5uH9CY3HsVtkbeZXkewTy9LqLJuARydy402xCLi9qrfuTZrwt3dDvrlc11uKriufWAlAhrhdNtQUH2at7InusYwXzWrwf3j5vdYnfh3NvDy/l4yJn1c32ziEbf1ZSAIhuzaq1mV1LWItC0/X7fzznPCyA1E33KS+11X21naHXDH4FKob3x0lQWob3j9qXglEjGq8/zmXJW9Clk0EBFAQUHdNSN/hHjhd0h76d5dVBE5fF8hiivMpZvm+PtodWJn2pliG7m4XShZrpgLXQ8oFk4DofxyWgQh3F0FX5sP7N4cHV9cmpg3elhs2fgE90OsBVg+/ST0khBSFZ1JjFJiv/IkxJJBLygS+plHk6wn+hekmEjg8x2LQrYxh7Y2ILMST3XcYiak618N0UqXmHXV3JelrquR13dpYZjYMN3Ml3HTkqszMa+T32vq6IBImHERM0FO5Y0nIYq5TL6tpyE4SgcKYN9w96y7qaRIsXT+WSo2IpTN4wrWltWNInD6WAYR7ctsBUwhpzQp9mmQEFGCgHPylpIIreiLaU9teUrrUk0OUdHkKn6aEfotmxrZGXL023TcXVDd0zD91FHbuRfmIXNPx+yMymhkseXfnlQ1G6iFmyWUBKm1kOm45i+b5q6ZfdU9RLrvJQ+MVx/Tc2c5myz2qwLL+HJavs1hR0UvIamnyuNHaNAKOXbSrY/CHr+DYwYjRLbAwAA" + } + }, + { + "ID": "a4a3fca302b6e852", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/pAZjqvYvH6Z5CKULCoi4XkQYIDJ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e3dbe80a51447df17fb0065654860a0c/4058111687841272569;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/pAZjqvYvH6Z5CKULCoi4XkQYIDJ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:24 GMT" + ], + "Etag": [ + "oQnzkKhHYyIyFvBaIWT/bg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8pbEarQlJLwqtKRaNVIhSY8x2GShlYSg7YGjTd3epXs3fN2fOnKDIqwRs2ObZocWmv8qQgyFZo24VaxNqqjSCBcgiMyQF1bFY7ZZx7/WPnSO89/B6m02nhtByh6UA+wRpjirRYH+eoBIlmrV0/G0I7uuhmM/CReg9L0ynpGTovES+P3P8BZy/zhbsabvGFBusJA5ydUN7lOwNTpNWSeRRTQ2PHia3cKEvk3q22R+6uFtONvfuKvJdyu8+iiD25k+GUiQF51QZMHoDc4SJhVrTj7EJN/BfOz2jfm1IotY4iI7/DrhU1grZuOGmRQukML8ucwY7FUrj+RfwO8LjSQEAAA==" + } + }, + { + "ID": "672620ec98944305", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon0797628fd778c717c2620296f1106da4f5099c98/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e3dbe80a51447df17fb0065654860a0c/14099458993669787201;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon0797628fd778c717c2620296f1106da4f5099c98/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:24 GMT" + ], + "Etag": [ + "yDZCcCzsUejLJltuXDJ7jg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pXukQ5JztXFYemZvl45ZSURrh4mWel29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwobGRia6RoY6xoZhBiaWhmYWBmYKtXGAiEACCGHYIAAAAA=" + } + }, + { + "ID": "3dd7358bfe7a089f", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "191" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ac3e0a647398b3c7e04bd657238b9a2a/15663634507755997137;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIERBVEUoVElNRVNUQU1QICcyMDE2LTAzLTIwIDE1OjA0OjA1JykiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkRPZE50aXlkZ1RCWFRiYXdUWFBLaWdZOG9YMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:24 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/4KelZggzatkydGmtVodmPrhwtOY\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2vbMBT9K0X70A2WWH47hrF1iRdMUzdLnL4oBFm+dtTYlmPJDVnpf5/spjC6UfZN6J7HPUfoCW1ZlSIfJSzftdAcPjzwBH1GIEmubu/RjNx5FbYm3nk5DWGVzoswmpVArqdCs86huMvzX0RuD+m0lFc8LefNZi8vb++REmGdcNoWFOSg5o0cuI7hr5bDyWUaSXZI8/j7TZyQfXwzP2f5rcdvdMUSUGQzVm0VdyNlLXxN2+/3w5zzvABSMzGkvNRe99UeDa1u+ANQKbQ3XprKIrR33L4WnBLJePVltVTOCr6ADBqoKCD/CR11w3/EeEH3k/fTvDoooPJ4/oworzKWt83x9qnTiQ+1MkQ/V8HiVnH6YN3oeEDLYBaM45PJWRx8jMOLYBmfXcxPTg2sOwNsDgx8ots+tnxsn35S/BSEZFVvEJOk+I8sKZFEwMt0Tb3MwwkeJbqXZNjIILNdiwK2sQc2tiBzUs91HKJ4spPvWaTilWsmaephcMAwLVvPMtcmNMM60DQzM4vqnktte2T3NTRAJEyYqLlgx4LGi0AlXIc/1lEQTIKJMtg37C3qehEqULxYRWOFVpi6YVzBuqLCKA4WZ+M4vOoGrYAZ5IQelrsC+RkpBDwrayGJbEVXSnfqildaURhN0XHIVH20B/RbdjWyssPptum4uqE7lmti1IMb+dfM0+0/H7E3KaGSx1d+eUzUbaIWbNZQEqbWQ6bjmKORaeqWPVDVS6zzUo6I4Y621Mxpznab3bbwEp5s2m8pPELBa2iGudJ4ZBQIpbytZPc50PNvS0hAGNcDAAA=" + } + }, + { + "ID": "92030f4922f2776a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/DOdNtiydgTBXTbawTXPKigY8oX1?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "74245fe59941313d537360cc60233020/17227810021858983777;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/DOdNtiydgTBXTbawTXPKigY8oX1?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:25 GMT" + ], + "Etag": [ + "Tmb1iMawpP/2WTSMoCY8/g==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/yWP3W7CMAyF38W7LeLnYkOVuKCAtGnAGBQBmqYpTd0sLK27xBWqqr77EnZlH/mzz3EHP7rKIYZMq98GbfugkN9Ds0fXGHa+1FQ5hAiQhfJkWmZjvRG3ejecnNLDhhaX6VDNZp5w8htLAXEHhUaTO4g/OqhEiX6tGH15gts6iOU8XXlVUh7U9rhez5P1CvrPPoIrZXss0GIlMZyqLV1R8ktImTdGIg9qsjx4epzAnb5Plm/5lnWbqzQ5p5m4pefdq1aXKZ3HnjIkBWuqPHg8gDdhYmH2dPMRIQB3nbSMbmdJonMYjo7+DRZU1gbZp2HbYARS+D+fNUNcCOOw/wP3HlazRQEAAA==" + } + }, + { + "ID": "a0245a0ceabbe769", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon73bdd80e6e23451ff75acf01ecdf3f4c187c5595/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "74245fe59941313d537360cc60233020/8822693629443030185;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon73bdd80e6e23451ff75acf01ecdf3f4c187c5595/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:25 GMT" + ], + "Etag": [ + "cEsYb3zCh8KmrIB7RByDrA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8onuxZHJhlXOWdYeOcWeTqZBzlVuhQ52toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwobGRia6RoY6xoZKNXGAiEAHsOJ53cAAAA=" + } + }, + { + "ID": "63d5ff5b0efb19d5", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "191" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6bd3d8525216545aafec0a3f630343bc/10386869143546016825;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFRJTUUoVElNRVNUQU1QICcyMDE2LTAzLTIwIDE1OjA0OjA1JykiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkZLZFRnaEFNQ0xOUjIwNTZvS1ZkcEJwWm5NaSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:26 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/RcjhOHEPMe-PoX9ZR0NKJbeDMXc\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2+bMBT9K5X3oZvUBPN+SNOWJbRlSVhGSNtVlSJjLsQNYAJOo6rqf5+hqTR1U7UvyPI9j3uOxRPasipFHkpYvttD8/jhnifoDIEguby9QzNy61TYmDjT8iKAVboognBWArm+aJWI3m9+XPqLOQwW/Ma9jXA4/Z7AZH5D75AUYZ1wui8oiEHNGzGwLc1bLYfn0zTON6P5eBZGGjYtPr1K62/1bTVnktVCkc1YtZXcjRB16ynK4XAY5pznBZCatUPKS+V1X+VBU+qG3wMVrfLGS5FZWuUdty8Fp0QwXn1eLaWzhEeQQQMVBeQ9oaNu8I8YL+h+8n6aVwcJlB7PZ4jyKmP5vjnePnU68WMtDdHPlR/9kpw+WDc6HtDSn/nj+CQO5v7H7rOMR/PFyamGVWuA9YGGT1TTw4aHzdNPkp9CK1jVG8QkKf4jS0oEaeFluqZO5uAEu4nqJBnWMshM26CATeyAiQ3IrNSxLYtInujkexapeJW4qosz17FU1UhSRwXbgNRKU4x16maqbjta6hrE6WtogAiYsLbmLTsWNI78Ueyvg/N16PsTfyINDg17i7qOAgmKo1U4lmiJqRvGJawrKghjPxqN4+CqG+xbmEFO6ONyVyAvI0ULz9K6FUTs266U7tQVL7XCILxAxyGT9dEe0G/Z1cjKDqeaumWrmmrJhCbqwY34a6Zp+p+P2JuUUInjK788Juo2kQs2aygJk+sh3bJ019V11TAHsnqBVV4Kl2i2u6V6TnO22+y2hZPwZLP/msIDFLyGZphLjQdGgVDK95Xofg70/BtSs5N+1wMAAA==" + } + }, + { + "ID": "356bed4140448400", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/FKdTghAMCLNR2056oKVdpBpZnMi?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9df1f595ba9942afe4a94c64692cdd6b/12023101156470205641;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/FKdTghAMCLNR2056oKVdpBpZnMi?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:27 GMT" + ], + "Etag": [ + "sqHG+eAsEsHnDupotBWHeA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PYU+DQAyG/0v9KEtwiTMh2QeYKMtgUdw00RhzOwpjHtcbV2II4b97TD+1b/q079sBvmtdQACHujp32PZXFfLz1ORoO8XWFUPaIniALCpH2nPyeI2hjW2i7ztDHL0lGC6XjrDyiI2AYICyRlVYCD4G0KJBt1b6X47g3kxit85ipxoqJrXdp2kYpTGMn6MHJzrkWGKLWuJ0yrR0QsnrKWXRKYk8M9Ty7G4xhwt9mTxsil11DLNVus3n/u2CNq+Ficy7zmpHKZKCa9IO3L+AM2FioXL6cRHhBv511DPap5YkWovTUf/PYEWNUcguDbcdeiCF+zOpGYJSKIvjL3JR1yFFAQAA" + } + }, + { + "ID": "ccab138e8dc7adaf", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonb9190f986114bd81e74ed6dd003c9f13782d94a8/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9df1f595ba9942afe4a94c64692cdd6b/3545929364727900433;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonb9190f986114bd81e74ed6dd003c9f13782d94a8/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:27 GMT" + ], + "Etag": [ + "IG+yD3eyq89gtd2Zj1CvpQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8p7umtXuhinVhZaWKaXpBhFZRk6lxUE2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwmbWhmYWBmYKtXGAiEAqlDm8HUAAAA=" + } + }, + { + "ID": "69a1101b793969e5", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "160" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d6bea9615b04652db521356d388c62f4/5182160273862336929;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUICgxLCAyKSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoicHFCNDFnTlJKSTg0bEdaOFVtbmJ3Y1oxblN0IiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:27 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/6W7V5jtL3hm5fIXVMajkJQ2Glnk\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1SW2vbMBT+K0V72aCN77fA2LrEC+4yszpOu5VCkOVjR4ktOZacEEL/+2Q3hdGNsjeh853vJp3QlrIcjVFGy10H7fHdhmfoEoHEpbp9RHP84DPdnvrf6lkEy/xHFcXzGvD9TGjuvXfnbOTcWtdOEf28+44325tbc1ax7SNSJLQnzruKgLxqeCuvPNccLxejZvfFNso4uYl8u5o9+MuaZQfyYLCFVFsCqmJO2VbtrqVsxFjTDofDqOS8rAA3VIwIr7UXv9re1JqWb4BIob3S0lQWob2h9qniBEvK2cflQikreAIFtMAIoPEJnXmjf8R4Rg+Tt9O8KCig0ni6RISzgpZde7499TzpsVGC6HYZJr/UzhCsH50PaBHOw0l68d64vDA/KEAOQlI2MKQ4q/7DbI4lFvA8XRG/8PVMDzLDzwrdLKBwPJuA7ug+OLoNhZv7nutitSd7+mELM84Ml1imHTie7nqG5bi6aVu6XQS262DTB2I6XqZnBRlytoAlTKlouKDnBiZJeJ2Gq+jrKg7DaThVAoeWvkbdJ5ECpckynii0wjQt5QrWNxHFaZhcT9Lorh90AuZQYnJc7Co0LnAl4ElJC4llJ/pS+lPfrOKKo3iGzkOq6iMDYHDZ10jrHmc4lkpmGq5n2wYawK38a+YY7p+vNIjUwOT5GZ9fC/VOlMF2BTWmyh6yXNcKAssybOdKVS91g9cywKYXbIlVkpLu1rtt5Wc8W3efc9hDxRtoR6Xi2FMCmBDeMdn/fvT0GwJIXSy4AwAA" + } + }, + { + "ID": "e879fa6883e61968", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/pqB41gNRJI84lGZ8UmnbwcZ1nSt?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7486c1f7583975f8908e77196817e23e/6746335792243448369;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/pqB41gNRJI84lGZ8UmnbwcZ1nSt?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:28 GMT" + ], + "Etag": [ + "aMD8jZW+BM/GIPo52M3RiQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/42QTU/CQBCG/8t4tERAVNKEg4UGawBhkZjUGLJsp7W47ZbuNIQQ/ruzeDBRD2YPu+/s+8zXET7yMgEfNnm2a7A+XGRIC/cQaBtNlq/KlBbBAySZsVNOR/1t/HIZTK/G0dzcdKfXIl8MBuyw6h0LCf4R0hx1YsF/PUIpC2Qsba/ZQYfKCREOn8SIdWESp2eryeQ+mIQc+U2uz6F15xuPZs/hOBR/8CfvJ9b9F/bGx4Ot2QhMscZSoZuiqs0WFUVuQUmjFVKrMjW17m5dVnaff6pd0OtkM/EY9Xt6HPdXRbnZq7hTLold2ihJuSnZuFpyf0CGpBZmzzPCeSangwOhnddGobXokra/CgxNUWkk7obqBj1Qklf8kBP4qdQWT5+v+frywAEAAA==" + } + }, + { + "ID": "3f115d78b302ef32", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon16c3249570671356024304f9465a28ec257b0bfc/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7486c1f7583975f8908e77196817e23e/16787683093777061497;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon16c3249570671356024304f9465a28ec257b0bfc/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:28 GMT" + ], + "Etag": [ + "9dZuS5v/PqexuQBv6rq26Q==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pbpkSVBpuW6QcUplaUBjqVmRUVGpkF2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsU7JCYgJV1OpAWEZKtbG1QBRbCwC2n9FhhgAAAA==" + } + }, + { + "ID": "6721bf9c453e077e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "163" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6d78e007a5948d554fd165bedc563cf8/18351857512680099337;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFsxLCAyLCAzXSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiU2VIdENST0x5MzFHeGIxME83bVJxVVR4UXRyIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:28 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/DGjCdJ5utBcgn-7leaZM-ZsADKI\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TbW+bMBj8K5X3NQmYdyJNW5ewjDVNV0JWresUGfNA3QAm2DSNqvz3GZJKUzdV+4Tlu+funrN4RhtWpWiMEpZvW2j27x54ggYIJMnV7R2ak1uv0q2pd1HOQlil34pwMS+B3MyENp09TNKvdis/0bwaugWQ28vhrTifXoR3SImwTjhtCwpyWPNGDl3HGK+WoyV8kZPoar438ewpwfqVW0bbVfx0LRs1JaDI5qzaqNl7KWsx1rTdbjfKOc+VQ83EiPJSe8mrPRpa3fAHoFJor7w0tYvQ3nD7UHBKJOPV+9VSOSt6BBk0UFFA42d00g3/scaR3SNvb/PioIjK4zBAlFcZy9vmdPvc6cT7Whmi61UQ/VAz/WIddDqgZTAPJvHZTzw4MwZn5i/FSUFIVvUiMUmK/8ibEkkEHNE19TJPT3Q/wV6S6UYGme1aFHRb98DWLcic1HMdh6g52cn3U6TilW85iYPtxDNwglMTfCcz1de1iOWAbjk6tr3EpG6/agNEwpSJmgt2KmESBedxsA4/rxdBMA2mymDXsNesmyhUpDhaLSaKrTh1w7iidWWEiziIzidx+L0DWgFzyAndL7cFGmekEHBQ1kIS2YqulO7Ulau0FuFihk4gU/XRntCn7GpkZcfDtum42MCO52EL9eRG/oX52PjzoXqTEip5esnjg6EuiQrYrKEkTMVDpuOYvm+a2LKHqnqpY15Knxiuv6FmTnO2vd9uCi/hyX37MYVHKHgNzShXGo+MAqGUt5XsfgB0+A3xnKgfuwMAAA==" + } + }, + { + "ID": "6f4a000522438808", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/SeHtCROLy31Gxb10O7mRqUTxQtr?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "abaebc5fd899de3d615984370e85735e/1469570428033468313;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/SeHtCROLy31Gxb10O7mRqUTxQtr?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:29 GMT" + ], + "Etag": [ + "OBtjqvaFShg5VQESCGRYFg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8bRPQaBOSXti6pU2MtAs1McaYZRkouLB0d9ASwru7VK/m75szZwb4KpsMAkjL4tyh6W8KpMOUcLSdIutCqxuLMAMkUTgyWlF1/hab+FTcvx5YvA7526ZYLh1h5QlrAcEAeYkqsxC8D9CIGt1a7n06gvp2KnYvCQsZd41aZ1ODsz17TNgTjB/jDCqdcszRYCNxUmuNrlDSbjKadUoizVttaL54uIUrfZ3EuKU1j577Oz+8pL4XLWp+PiaXAxlHKS0Flbpx4DEGd4Q0CcX1j3MJPvzXq57Q7o2WaC1Oot7fgbWuW4Xk3JDpcAZSuFe3JUGQC2Vx/AVLZr+6SAEAAA==" + } + }, + { + "ID": "476221b955abea69", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon946b615b821b1d3e96f31d374a46e0460158b3c7/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "abaebc5fd899de3d615984370e85735e/11510917729567081441;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon946b615b821b1d3e96f31d374a46e0460158b3c7/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:29 GMT" + ], + "Etag": [ + "2HIFRXdFp9Mtt5I1sNwWcg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8obeXi6BUWkuBVY+paUmHoaFvuVhyen29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsg5FAyVodCMsIzjJWqo0FQwA5zmMpigAAAA==" + } + }, + { + "ID": "f07a48a0d4c0951e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "173" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c710b9ca687a1cc197ce4615ab37c6c6/13074810677771598961;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIChbMSwgMl0sIDMsIFs0LCA1XSkiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6Im1rWmNmZFM0VFZveWFZYlFkcVRlYURYWkNwRCIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:30 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/r-CC3wbcxM5SxuUZMOLXBfjDdS0\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TW2+bMBT+K5H3sklJMNdApGnrElahpdkaSC9pq8iYA3UDmGCTNKr632doKk3dVO3N8vnOd7P8hDasTNAYxSzbNlAfPjzwGPURSJKp21s0Iyu3xNbU/VGcBrBMfuXBfFYAuTwVWj2YTMx9TB/P7PCxWa7Ofs6uvqUP0yTEt0iRsJY4aXIKclDxWg5GjjFehsNis6JpElrRBT+Q6/g82UZAplerSTVVWwLydMbKjdq9l7ISY03b7/fDjPMsB1IxMaS80F79ajtDq2r+AFQK7Y2WprII7R21LzmnRDJefl6GSlnBF5BCDSUFNH5CR97gHzFe0N3k/TSvCgqoNJ77iPIyZVlTH2+fWp7oUClBdL70F9dqpwvWjo4HFPozfxL1Pt7o/Z5x1++Z/d6N1e/Zd58UOgEhWdnRRSTO/8N5QiQR8DJdUzd1cYy9WHfjFBsppPbIooBt7IKNLUidxB05DlF7sqXvtkjJy8TFdmxYnmeTGCDxPIxNwwOqGzr1PN3TFRU2E6sLXQORMGWi4oId65gs/JPIXwff13Pfn/ptWfuavUVdLgIFihbL+UShFaaqGVewtpZgHvmLk0kUXLSDRsAMMkIP4TZH45TkAp6VtJBENqItpT21NSuueTA/RcchU/XRDtC5bGtkRYvTbdMZqTQjrLsu6sC1/GtmONafT9aJFFDK45u+PB1qnSiD9RoKwpQ9ZDqO6XmmqVv2QFUvsc4L6RFj5G2omdGMbe+3m9yNeXzffE1gBzmvoB5mimPHKBBKeVPK9iug5983sBD5xQMAAA==" + } + }, + { + "ID": "d06ef086f3d8e961", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/mkZcfdS4TVoyaYbQdqTeaDXZCpD?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a27ca277c314b65159e3a09a399b9628/14638986191874585601;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/mkZcfdS4TVoyaYbQdqTeaDXZCpD?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:31 GMT" + ], + "Etag": [ + "Z4bgSZKsDBpLAnWAtVioeQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/42RUWvCMBSF/8vdawW3yQYFH6oNm6w4rdVtHUPS9Larpk1tbhlF/O8mDiZMGCMPyUnOl3tzsodtUaXgQlLkuxab7ipHmttFiLqVpM1Uq0ojOIDEc+OMB0m+iJ+0P6oDr3rxaFUonA+HxqHFJ5Yc3D1kBcpUg/u+h4qXaLCsvzYO6morQjZ+Dn2jS5VaPV0GgTcKmNm5JNenrfX1GZ9MI/bAwjMfshnzIubDwfmN3fyB/ZS9xG7/Ve3DDAc2KgkxwwYrgfbxdaM2KGhic01bKZB6tWqod39nmzHu00m5jUWWLgbRSnX8LZmnuwi5/xqPaxuMVIJToSpjXC5Mf0CKuAzVl4kGTlFYPeoI9axRArVGe2n/u8BYlbVEMt1Q06IDgpufeSwI3IxLjYcjG/nLuPcBAAA=" + } + }, + { + "ID": "4bc1ff51a37bb6b3", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anond805b24995abeed9900329ec121c99191fef03d4/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a27ca277c314b65159e3a09a399b9628/6233870898970259529;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anond805b24995abeed9900329ec121c99191fef03d4/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:31 GMT" + ], + "Etag": [ + "Z+F8F+Ov66/70nEEtxgH0A==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pHabtZuGn7l5mZ6Zsb5Lm6llSkexg42toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsU7JCYkJIoLpaHQjLSKk2FsY2holCVZnAVZmCVMXWggkAVeRR7LQAAAA=" + } + }, + { + "ID": "6fa0a5fa086acf4e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "176" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "84f2eabf3f075c11bc7ec9a3329bd490/7798046413056469465;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFsoMSwgMiwgMyksICg0LCA1LCA2KV0iLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6InBSNXE4Mk1vSXFvWkNqcTZtM3NITzF2Ylg0USIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:31 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/pP-EakwtJ4YCXPfL6VKRmgX_ids\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TW2+bMBT+K5H30kok3G+Rpq1KWMeaZS0hva1TZMyBugEM2CSqqv73GZpKU3fR3iyf73Y+y09oS6sUTVFC86aD9vHdA0uQgkDgXN7eoQW+9SrNmntn5WkI6/S8CJeLEvDVKVfr83GAt3vxxbqZXZ9nC+fyLCrz6w1N+R2SIrQXTruCgBjXrBVj1zGm69WkjuzGM76ysGG3s4fGKU3++Zu+S66tC8niUGQLWm0l916Imk9Vdb/fT3LG8gJwTfmEsFJ9zavuDLVu2QMQwdU3XqrcRab8u9uHghEsKKver1fSWcIjyKCFigCaPqGDbviHNV7Qw+Tf27w6SKD0eFYQYVVG86493D71OvFjLQ3RxTqIbiRnWKwfHQ5oFSyCWTz6fqQrI0MZmcfK6MhSRrYyco5/SEIKXNBqUIxxUvxH+BQLzOFluiFe5mmJ5ie6l2SakUFmuxYBzdY8sDULMif1XMfBkid6+YGFK1Y5uuUbxDN13dWyRMJ903JBN1zTAw17FgYpB1427N0CFjCnvGacHhqZRcFJHGzCT5tlEMyDuTTYt/Qt6ioKJSiO1suZREtM3VImYX0z4TIOopNZHF72g47DAnJMHldNgaYZLjg8S2susOh4X0p/6puWWstweYoOQyrrIwNgSNnXSMsep9um4+qG7uq2ZqIB3IrfZ77366sNJiVU4vCsL6+H+iQyYLuBElMZD5mOY/q+aeqWPZbVC01npfCx4fpbYuYkp819sy28hCX33ccUdlCwGtpJLjV2lAAmhHWV6H8Dev4JGomLK8gDAAA=" + } + }, + { + "ID": "d89021b61869000a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/pR5q82MoIqoZCjq6m3sHO1vbX4Q?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "014446c116cafc7aade52fbb211f5bcd/9434277322190905705;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/pR5q82MoIqoZCjq6m3sHO1vbX4Q?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:32 GMT" + ], + "Etag": [ + "EZG6eVh6RlmyCsXOGaVHNA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/52RXWvCMBSG/8vZbQU/tm4UvNAuqOD8yFTEMSSmp1qXNm1zulHE/75EL4TtZoxcJO/J+yRvTk7wkWQRBLBL9kWFZX23R5q7BUdTKTJ2ynVmEDxAEnvrZJuBj6uDz1Vah2Y9HYjVcNLrdq3DyAOmAoITxAmqyEDwdoJMpGixuLm1DqpzJzgLp/zZ6lRHVz1jvQVzld/k9lLatm74aLJgA8Zv/GQ5Hvf6YwZn7yfW/h/W+RP2bocHR73jGGOJmUT3+LzUR5Q0cn2NKiWRGrkuqfHouzDWfdnJ+UPx1H7Ro0JvwmPhpx0znLY+d+v7uXUpLQUlOrPG5avNB6RJKK6/bGvg0gqn+zWhmZVaojHoDm1eLwh1miskm4bKCj2Qwv7MMCEIYqEMnr8Bftztg/cBAAA=" + } + }, + { + "ID": "39db88eaf5c94dbb", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon61492c831170fb5089347e12738e0a84aef02e8f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "014446c116cafc7aade52fbb211f5bcd/957105534760279473;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon61492c831170fb5089347e12738e0a84aef02e8f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:32 GMT" + ], + "Etag": [ + "ouAPoPFAaWa7Xo5VFjRJuw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8rnlzoG5Ae4OSaGJ5pH5JuGuWUFeZWW29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsg5FIAkB1tToQlhGcZaxUG1sL5SCrNYGrMIWzzMBqY8EQADe2u67EAAAA" + } + }, + { + "ID": "7b02b7ffa7803362", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "183" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ae1f7fc7dd79645d606cd2c8bc65bd8d/2593337543372789313;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFsoWzEsIDIsIDNdLCA0KSwgKFs1LCA2XSwgNyldIiwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiIxVTVrU3dHT3Z3UnVmcWp2WTlVRlJHaW9NekgiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:33 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/KqfoVMPdEiq-QeNDB6HbLHCv_aU\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TbU/bMBj8K5X3BaS0eX9ppWljbVYiSgdpAmKAKsd5HEyTOE2cVgzx3+eEIk1sQvvm+O65e+6sPKMNK1M0QQnLti3UT58eeYIUBAJn8vYOLfBPr9SsmXdWzAOI04s8WC4KwNfzRj3bUn51fpH6bDu8hOXsm3OaLE6nuzWO75AUYZ1w2uYExLDitRi6jjGJVyM9tjer/fzHbh+2dPu4uxnH38M54+e/TuVUAzldsHIjZx+EqJqJqu73+1HGeZYDrlgzIrxQ3/ZVd4Za1fwRiGjUd16qzNKoH7h9yTnBgvHyc7ySzpIeAoUaSgJo8owOusE/Yryye+TjNG8Okig9XhREeElZ1taH2+dOJ3qqpCG6jP3wRs70wTrocEArf+FPo8Ht0a2uDAxlYN4rA+tYGRzd2srAkR/u8b2cS6ERrOyFI5zk/5EhxQI38IquiUc9LdHGie4lVDMoUNu1CGi25oGtWUCd1HMdB8s50cn3U7jkpU1Sg2qW49qGaekeYIcSSizdMT1NN3SKNQeDrmt9/BqwgBlrKt6wQzHT0D+J/HXwfb30/Zk/kwb7mr1nXYeBJEVhvJxKtuRUNeOS1hUULCM/PJlGwVUHtA0sIMPkabXN0YTivIEXad0ILNqmK6U7dYVLrWWwnKMDyGR9pCf0W3Y1sqLj6bbpuDKJa2qGjnpyLf7CdG385+P1JgWU4vC6r4+Iuk3kgvUaCszkesh0HHM8Nk3dsoeyeqHpvBBjbLjjDTEzkrHtw3aTewlPHtqvKewg5xXUo0xq7BgBTAhvS9H9FOjlN1071RfPAwAA" + } + }, + { + "ID": "0b3c9c4131b63195", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/1U5kSwGOvwRufqjvY9UFRGioMzH?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ed055f2561e8df71058deee45c66fdc0/4157511957980925649;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/1U5kSwGOvwRufqjvY9UFRGioMzH?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:33 GMT" + ], + "Etag": [ + "Ta/9Cgknud+/sOWZftcxLQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/32Qb0/CMBDGv8v50hHARA1LeAFzDpLJn8Ji1BhSutscdOtYbyASvrstmJioMX3RPnfP73p3B1hnRQwuLLN0U2O1v0iRpvbBUNeStLlKVWgEB5B4apxz3ux46bqo48umHj8+JyTew2m3axxavGHOwT1AkqGMNbgvByh4jgZLWgvjoH1pBfO9MbszOlfxWU/83ty3kd/k4hRatL/x4WjuBz77gz86P7Grf7BRFIa9fujD8dUcB1ZqyTDBCguBdoqyUisUNLQLimspkBqlqqhxe2OrGvcp046u17NdMN7uWJ1sVtunTnTPgkw9fAyMSyrBKVOFMUYz0x+QIi6Z2mmLwpfu7wn1pFICtUZbtHX+wFN5KZFMN1TV6IDgZsWDjMBNuNR4/ARcy4pTwAEAAA==" + } + }, + { + "ID": "ee576731072f17b7", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon5cd2f0467523418ea6fcfc416380121fa06ae110/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ed055f2561e8df71058deee45c66fdc0/14126802769266363161;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon5cd2f0467523418ea6fcfc416380121fa06ae110/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:34 GMT" + ], + "Etag": [ + "xeuNZPYf8CvMSRWnVvhPSA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pXpJb6RQVEplk4l/kGB4XnhZVlBAQ72toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsg5EYAkDVtToQlhGcZaxUGwtjm4DYUA6mblO4HjMkPeZgPbFgCAC6Mbn53gAAAA==" + } + }, + { + "ID": "75a9336b0aa8eb30", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "182" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "82fc828ecf5f23f48c5348bed8a020cb/15763034777895650217;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEFSUkFZKFNFTEVDVCBTVFJVQ1QoWzEsIDJdKSkiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IjEyZDhGNXoyNjRjeW9ISUJpUlR6Rml0Z2JsSiIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:34 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/LVOCzKX4EPdtcoSIT3Qic-D0x6s\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TXU/bMBT9K8h7AYk2ifNdadq6NrCMqoM0hbExVY5zE0yTOI1duoL473NCkCY2oeXJ8T33nHvOlR/RmlUpGqGE5ZstNPt3dzxBxwgkydXtDZqR716lW1PvrDwNYZmeF+F8VgK5OhXa7PLr5OHsmxWcp5LyRRibF4wOpvovR9wgRcJa4nRbUJCDmjdy4Dp4tFwMDZx6J/YDdiy655/DTyyKH06YzJPii+oSUGQzVq1V762UtRhp2m63G+ac5wWQmokh5aX2Mq92j7W64XdApdBeaWnKi9DeUPtQcEok49X75UIpK3gEGTRQUUCjR9Tzhv+w8YzuKm+7eVFQQKXxdIworzKWb5v+9rHlife1EkQXyyC6Vj2dsbbUH9AimAWT+GAcRePrw/5nEUfLSXz4wzg+wD+PjlRbCkKyquONSVL8h4WUSCLgubqiXubpie4nhpdkOs4gs12Lgm7rHti6BZmTeq7jENUnW/qui1S8MizbyRLbAc9wsQ0+JoafYWyZFrb9FBIXU98lTta5b4BImDJRc8H6XCZRMI6DVXiymgfBNJgqgV3DXqOuolCBlOn5RKEVpm4YV7A2n3AeB9F4EoeXbWErYAY5ofvFpkCjjBQCnpS0kERuRRtKe2rzVlzzcH6K+iJT8dEO0E3ZxsjKFmfYpuMa2HAtE+uoAzfyr5r6/txdJ1JCJfvlPq8NtZOoAZsVlISp8ZDpOKbvm6ZKcaCil7rBS+kT7PprauY0Z5vbzbrwEp7cbj+mcA8Fr6EZ5orjnlEglPJtJds3gZ5+A6H3h2rOAwAA" + } + }, + { + "ID": "3afdbb6f6399b911", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/12d8F5z264cyoHIBiRTzFitgblJ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6cb8f673a6c35aa300f218d3bbf4072f/17327210291981859897;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/12d8F5z264cyoHIBiRTzFitgblJ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:35 GMT" + ], + "Etag": [ + "iXb48RAjLSR2mlxQHxPscw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/22QXWvCMBSG/8vZbQUtzknBC3V1dYytRgeDMUqannZxadM1p2gV/7uJDnaxkYuT9+R5z0eO8CWrDAJIZfHdYtPdFEgrd2FoWkXGhlpXBsEDJF5YUr6lwzGbbp/WzC/VfhXtYyN2k4kljPjEkkNwhFyiygwE70eoeInWlvcTS1BXO8HC+Qu7t7rU2VXH4XQTusxfZ3JJJYNf+/J5Ez6E7B//6cMeD7Y6ZZhjg5VAN07d6C0KWrpNs1YJpF6tG+rdjXy40JeXgZ+NF7cHfzQUnY6WM8k2h4WkIlWPllJacJK6suDrGmwT0sQV0zvjrPCjZx2hiRst0Bh0RfvXBnNd1grJTkNNix4Ibv8qkgRBzpXB0xkx+sPHiQEAAA==" + } + }, + { + "ID": "a5c060a64487b710", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon1456fb56e81725e92a19f22434259deb72c97a6f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6cb8f673a6c35aa300f218d3bbf4072f/8922093899582683265;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon1456fb56e81725e92a19f22434259deb72c97a6f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:35 GMT" + ], + "Etag": [ + "WhhgA0r9rC1Pp3gNQo+oyQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qHZ2SkOxoUWRY5GwYUGKf7BeZr51cG2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsg5EYAkDVtToQlpFSbSwQgonYWgB4jqbQlgAAAA==" + } + }, + { + "ID": "d300afb8b459152b", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "154" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "20101f03790f31bb901efb06714b11e2/10486269413685669905;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIDEiLCJ1c2VMZWdhY3lTcWwiOnRydWV9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiNjE3bWxHdUVwRUNDNFdBYnYxWnZ6ZlJhUnZGIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:35 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/1lRfKthoOCJ4wkJ43OATlrdhvLA\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1S7W6bMBR9lcn72wYw35GmLSI0oo3SjpBVqypFxlwTN4AJGKKs6rvP0FSauqnaP8vn695jP6M9rzI0RSnPDx00p89PIkUXCCTJ1e0jWpIHr9KtuXdTLiLYZHdFtFqWQO4XrWYUMbuRO3EbXFvH/bVl3s6Sosl2/XL2iJQJH4yzrqAgL2vRyEvXwdPNeuIYblksurAOg8C6n6W98dD/YjGJ+yulaqFgS17tlXYnZd1ONe14PE5yIfICSM3bCRWl9jav1mOtbsQTUNlq77I0tUurfZD2tRCUSC6qL5u1Slb0GBg0UFFA02d09o3+scYre0Q+3uYtQRFVxssFoqJiPO+a8+3z4JOcahWIvm/C+KfSjIsN0PmA1uEyDJJPhsIyaCWvRnFC0uI/5syIJC28olvqMU9PdT81vJTpmAGzXYuCbuse2LoFzMk813GI0snBflSRSlSUpq6VEQsThqnpM4MypjOMsYt9wwDspi4GDOa4YgNEwpy3tWj5efkgDmdJuI2utqswnIdzFXBs+HvWfRwpUhJvVoFiK07dcKFoQwnRKgnjWZBEPwaga2EJOaGn9aFAU9l08KKSW0lk1w6dDKehU2W1ilYLdAa5ao+OhHHIoUVeDjzDNh3XwIZrO66HRnIj/8Jc2/zzfcaQEip5fsDXd0LDJGq+Zgsl4Wo6ZDqO6fumaVj2pWpe6oYopU+w6++pmdOcH3aHfeGlIt113zLooRA1NJNcefScAqFUdJUc/j16+Q2olVpssgMAAA==" + } + }, + { + "ID": "07e8b6862ccd38e5", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/617mlGuEpECC4WAbv1ZvzfRaRvF?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6f84e9deeffae105acc0deee9c0566b1/12050444932066781601;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/617mlGuEpECC4WAbv1ZvzfRaRvF?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:36 GMT" + ], + "Etag": [ + "iPyLLsZbUOwUPQkAkxedAQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3WqDQBCF32V6ayCWkoCQCyM2DUiq20ohoZR1Ha1xdbfuaGqD79417dX8fXPmzBXqqs3Bg6wqv3rsxrsSKZkThqaXZGzQqjUIDiDx0pJVPEaROWbp8yWNk9qvvzH3k83GEkZ8YsPBu0JRocwNeKcrtLxBu1YsPyxBo56L/eE13IXMNhqVz41DGkX+Ngphep8cOKuMYYEdtgJnNd2pMwraz0bzXgqkhVYdLdare7jRt8nKXTdy14c6DIKHNz8b3OPwUzDOhkdLSSU4Vaq1YPoC9ggp4pKpi3UJLvzX25HQxJ0SaAzOosu/A4FqtESybqjr0QHB7atPFYFXcGlw+gX0egykSAEAAA==" + } + }, + { + "ID": "7c15427624bd57f2", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonccb74da42af2c39f1cff0f22272911e27b72e2e3/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6f84e9deeffae105acc0deee9c0566b1/3645329634867553769;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonccb74da42af2c39f1cff0f22272911e27b72e2e3/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:36 GMT" + ], + "Etag": [ + "rwXFnR/ciLuALgfHGHVONA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8oXlUe45QXpJ2f6lDr6pKd5uHuE+fs52toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwvXxgIhAPcy+KVuAAAA" + } + }, + { + "ID": "8089ef80401b514e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "156" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "97bc58f88fc9485b277cb6e5743d7d23/5209504053770591609;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIDEuMyIsInVzZUxlZ2FjeVNxbCI6dHJ1ZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJQRVBpUTBXc0dEVlRveDBUam5ja3VFVE5OTzUiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:36 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/meFbC_hSqbUNgl8P_TjQ8lDS8Ck\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1SbWvbMBj8K0P72sayHb8FxlYSN5gFN02clo1CkOVHjhLbciy5WSn975PcFEY3yr4J3T1395z0jA68KdAE5bw89tA9fd6LHF0gUKTUtw9oQX6GDR7Pwu/1PIFNsaySdFEDuZ9Lq4brfLrdrY/5Ji2rcLnN9rdhNVuH08MD0iLcCBd9RUFdtqJTl4HvTDbr0TJe8lt8L+ezu0z8wtm+oYc+ztL0xtNTEiq24M1Bz+6UauXEsk6n06gUoqyAtFyOqKitt7zWo2O1ndgDVdJ652XpXaT1gdvXSlCiuGi+bNbaWdNXwKCDhgKaPKOzbvKPNV7ZA/LxNm8Omqg9Xi4QFQ3jZd+db5+NTvbUakN0u4lXP/TMsJiBzge0jhfxNPtkj1yNFiAVb4bxjOTVfyQtiCISXtEtDVmIcxzldpgz7DBgXjCmgD0cgofHwPwiDHyf6Dll5Icp0ogmB8gxA1yE1LODcYGDKLIDxhhhmAZ4nFPfwVFBhyU7IApmXLZC8vP601V8lcXb5HqbxvEsnmmDU8ffs+5XiSZlq0061WzNaTsuNM3UkKRZvLqaZsmdAXoJCygJfVofKzRRXQ8v2lkqonppOjEn06qWSpN0js4g1+3RgTCENC3y2vBsz/UD27ED3/NMa5rcqb8w3wn+fKHBpIZGnZ/w9aWQSaLzdVuoCdfpkOv7bhS5rj32LnXzCtuiVhFxguhA3ZKW/Lg7HqowF/mu/1bAI1SihW5Uao1HToFQKvpGmZ+PXn4DAklD7rQDAAA=" + } + }, + { + "ID": "de2f7eb2cdc7a250", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/PEPiQ0WsGDVTox0TjnckuETNNO5?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3f7e390541c1fa22a0995cf2375c8428/6773679567856801289;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/PEPiQ0WsGDVTox0TjnckuETNNO5?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:36 GMT" + ], + "Etag": [ + "IaNASeHNPmGZDm9pe5tVKw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P0U6DQBBF/2V8pQmaVCNJH6jFtpFQSmlNNMZslwGhy+66O6SShn93qT7N3MyZuXcucKplAQEc6+q7Q9PfVEjbscnQdoKsK1pJi+ABEqscuWZJuMNVkrbLt0X7qHFKh5fzbOYIy7+wZRBcoKxRFBaC9wtI1qJbK/1PR1CvR/Ecb8LcyVYVo0z2cRzO4wiGj8GDRh0zLNGg5Dje0kY1yGk9xiw6wZEmWhmaPNzfwZW+TtIorbf+q10uDrn68fNG8lMX5UmymTpKKM6oVtKB+x04E1LERKbOLiPcwr+e94Q2NYqjtTge9f8MnlSrBZJLQ6ZDDzhzj65qgqBkwuLwC2kSNN9GAQAA" + } + }, + { + "ID": "c9b2b50e414655bb", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonbeeb0fe0d8c5174d079917fffaf0c704bc6209dc/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3f7e390541c1fa22a0995cf2375c8428/16815026869390414417;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonbeeb0fe0d8c5174d079917fffaf0c704bc6209dc/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:37 GMT" + ], + "Etag": [ + "5N2RMTGt0j72MpD3qI4UCA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qb+hkF+Ya4lxhkmRv5FrgYF3qahDo72toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwnrGSvVxgIhADsSdBhwAAAA" + } + }, + { + "ID": "f008672f8345609a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "157" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0049b15461ca67e71a8e18cbf1d7dd6e/18378919817594932193;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFRSVUUiLCJ1c2VMZWdhY3lTcWwiOnRydWV9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiTzVSOGNPclRJOWZ5TXh2RmNUNEtXbHNGajUzIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:37 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/uiVkDMbaflmtdCRxf-yN6vBbxvs\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1SbW+bMBj8K5P3tQlvwUCkaesSWqGmtCOk1aZKkTEP1A1ggk1eVPW/z6apNHVTtW+W7567585+RhvW5GiKMlZue+iOn594hs4QSFKq2we0IL/8xpzM/av6MoJVfltF8aIGcn8pjJ7dbebXGSmqWuaz5FCMjjHefc8OO/GAlAjTwnlfUZCjlndy5GF7ulqOb9zEpzddGgXF8fqwu6Dp5Oq+EhdPrqOmBFTFgjUbNfsoZSumhrHf78cl52UFpGViTHltvO1r7Gyj7fgTUCmMd16GyiKMD9y+VpwSyXjzZbVUzoqeQAEdNBTQ9BmddKN/xHhlD8jHad4cFFF5vJwhypuClX13un3WOumxVYboxypMfqqZIZiGTge0DBfhLP2UJqtQwTkIyZphPiVZ9R+r5kQSAa/omvqFb2ZmkFl+Vph2AYXrTSiYrumDa06gwLnvYUzUnNTywxRpeGPb4OPMzbGNTcuipptTsDF1rYntUDujdkBxnplkSNkBkTBnouWCnfLPkvA8DdfRxToOw3k4Vwb7jr1n3SeRIqmo8UyxFaftGFc03UMUp2FyPkujOw30AhZQEnpcbis0lV0PL8pZSCJ7oTvRJ12rkoqj+BKdQKbaowNhWFK3yGrNs1wHe5ZteZ5r6dYUuZN/Ydj0/3yiwaSGRp7e8PWpkN5E7detoSZMbYccjJ0gcBxr4o5U89K0eC0DYnvBhjolLdn2cbup/Ixnj/23HHZQ8Ra6cak0dowCoZT3jdRfH738Bk7/72y1AwAA" + } + }, + { + "ID": "9fabb08c1b2dc808", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/O5R8cOrTI9fyMxvFcT4KWlsFj53?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0a353e1606dfe7507dc8a5fc2e4b57aa/1568689227491378033;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/O5R8cOrTI9fyMxvFcT4KWlsFj53?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:37 GMT" + ], + "Etag": [ + "j5IEBdakruUfxizcO6iWiQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P206DQBCG32W8pUk9UJWkF8XQ2IjF0pJeGGO2y4BLFxZ3By0S3t3d6tWcvvnnnwGOoskhgIMoPzvU/UWJtHFJiqaTZGxoVWMQPEBipSUrfxWFOTvqLitO4ocnM7EXm/ncEoZ/YM0gGKAQKHMDwesADavRrhXTd0tQ37oiTJI4Wqxto1a5a6yzOF6EcQTj2+hBpQ4pFqix4ejUWq0q5LRyRvNOcqRJqzRNbmdXcKbPk8RP73iid6v7on8+fS357uZpL82y8q8tJRVnJFRjwWwL9ggpYjJV39YlXMJ/HfaE5kUrjsagE53+HXhQdSuRrBvSHXrAmX31URAEBZMGx1+guyXkSAEAAA==" + } + }, + { + "ID": "5e44d89c441753b1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon22e86b5d626011c05dce26c51423c2bc29c6db0a/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0a353e1606dfe7507dc8a5fc2e4b57aa/11537980038793658296;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon22e86b5d626011c05dce26c51423c2bc29c6db0a/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:38 GMT" + ], + "Etag": [ + "pI3jfm8G4H99q+tK2CNSQQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8oXeBpnpeVauJt4WFoWapd4Gzn7BQcG2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwqXFJWmKtXGAiEARF2K8XEAAAA=" + } + }, + { + "ID": "e39283896b31c80c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "158" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0f13a3675f434ab31546874f58989c7d/13174210947911317576;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUICdBQkMnIiwidXNlTGVnYWN5U3FsIjp0cnVlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkpiR29iZWlDVFoxYXlYNVR4ZU1OclVHWllwZCIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:38 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/MKW7pcJflOoi8bCVhIdGepuJ2ZU\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1SXW+bMBT9K5P30Jc2fIOJNG0dYRFtyrYE2jWqFNnmQtwQTMA0jar+9xmaSlM3VXuzfM4959xjP6ENrzI0RpQXuw6aw8d7QdEpAkkKdXuHZmSJK92e4MvtNII0+1FG8WwL5GbaaleXN17NLvLyu+CYBtfrKJtC3V2Yy/QOKRHeC2ddyUCe1aKRZ55rjtPF6IJOBQUeJEuDHH45ySNcxU06Xd7WmZpqocxnvNqo2bWUdTvWtP1+PyqEKEogNW9HTGy117zag6nVjbgHJlvtjZemdmm1d9w+l4IRyUX1KV0oZ0WfQw4NVAzQ+AkddaN/rPHCHpD3t3l1UETl8XyKmKhyXnTN8fap10kOtTJEP9NwfqtmhsV66HhAi3AWBsmHk/OvwYnCM2glrwaBhNDyP7JmRJIWXtAVwznWqe5TA9NcN3PIHc9moDs6Bke3IXcz7LkuUXOylx+mSCUqSnUPG5mPmWk6NKMZdpmPdRtjYlsKynRMqO3BsGYDRMKEt7Vo+bGAYB6eJ+Eq+raKw3ASTpTBvuFvWTfzSJGSeRoHiq04dcOFovVFRHESzs+DJLruga6FGRSEHRa7Eo1l08Gzcm4lkV3bd9Kf+l6VVBzFU3QEuWqPDYQhZN8i3/Y8w7FczzAND9umjwZyI//CHFv/840Gky1U8viIL2+F+iQqX7OCLeEqHbJc1/J9yzJs50w1L3VDbKVPTM/fMKtgBd+td5sSU0HX3ZcMHqAUNTSjQmk8cAaEMdFVsv/76Pk3O++Z3LYDAAA=" + } + }, + { + "ID": "b3c379bf1157e677", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/JbGobeiCTZ1ayX5TxeMNrUGZYpd?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5611cf05c7ce4f95d88edab4b1711414/14738386462014304472;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/JbGobeiCTZ1ayX5TxeMNrUGZYpd?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:38 GMT" + ], + "Etag": [ + "8+udrBDEk3mXyzWwd37q1g==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P0U6DQBBF/2V8lCbFRmtI+iC1wRokSiHWGmOW3QFpF5buDqlI+HeX6tPMzZyZe6eHQ1kL8CAri2OLursokF7GJkbTSjK2NKo2CA4gscKSt5et0P796jCrtt3P60nM5ke3WCwsYfgXVgy8HvISpTDgvfdQswrtWj79tAR1zSg2SbyOAqsrJUYdpWF454crGD4GB/YqizFHjTXH8Vij1R45rcecopUcadIoTZP5zRWc6fPkMQtUhuUy2bms214n3/gU6TTYvTXCUlJxRqWqLZhuwJqQIiZjdbIhwYV/7XeE5lkrjsbgeHT6Z7BUVSORbBrSLTrAmf30oSTwciYNDr9FIbfoRwEAAA==" + } + }, + { + "ID": "2598e1b1225fa892", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonbb0781d98c225bdbd86c980488a43078d08ab47e/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5611cf05c7ce4f95d88edab4b1711414/6333271169093201184;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonbb0781d98c225bdbd86c980488a43078d08ab47e/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:39 GMT" + ], + "Etag": [ + "uMcvGOeLRKzt5TKlirirUA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qX+iaXufun+gR5V5WYhnjnZBZlFoU62toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwo7Ojkr1cYCIQCyn3UGcAAAAA==" + } + }, + { + "ID": "ced14d69b3677bcf", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "173" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1a3a860aca3d9e8c609d15ee98e298b4/7897446683196188080;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIENBU1QoJ2ZvbycgQVMgQllURVMpIiwidXNlTGVnYWN5U3FsIjp0cnVlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkU5ZURYbUJnZ1VPelpXOFlESWJWVHpXcEFyWSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:39 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/ZOKHDTtBcnigQISUQ4xy8RMnS6Q\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TbU/bMBj8K8j7wCZB89YmcaVpK23GIrqy5oUOhFQ5zpNgmsRp4tAVxH+fHYo0sWnaN8t3z909Z/kJbViVojFKWL7toNm/u+cJOkEgSC5vb9Gc3LiVPpy5F+W5D3H6vfAX8xLI6rzVbi4vvs4icUYrli/9MF4Of+7d4FsV2stbJEWYEk67goI4rXkjTh3bHMfhwMMw+1Ge5Xl8+Xizcq9nfnIVPa7qSXMtp1oosjmrNnL2Toi6HWvabrcb5JznBZCatQPKS+01r/ZganXD74GKVnvjpcldWu0fbp8KTolgvPoYh9JZ0gPIoIGKAho/oYOu/5c1Xtg98u9tXh0kUXo8nyDKq4zlXXO4fVI60b6WhmgZe4Ga6RdT0OGAQm/uTaOj6SSM3h9nnB8fTcKjs+vICz9IegqtYFWvF5Gk+I/oKRGkhRd0Td3M1RMdJ4abZLqZQTZyhhT0ke7CSB9CZqeuY9tEzgkl30+Rildg4YRQ2wUTUwqG41hOYhOcYFsfmjrVia1jw8Bmv3UDRMCMtTVv2aGPaeBNIm/tf1kvPG/mzaTBrmFvWavAl6QoiBdTyZacumFc0lQv/iLygsk08q8U0LUwh5zQfbgt0Fg0HTxL51YQ0bWqE3VSNUuphb84RweQyfZoT+hDqhZZqXjGyLIdwzQcbBoY9eRG/IFZuvX7k/UmJVTi8KYvT4dUEpmvWUNJmEyHLNu2MLYsYzg6lc0L3eClwMR08IZaOc3Z9m67KdyEJ3fd5xQeoOA1NINcajwwCoRS3lVCfQX0/Atyr2OZxQMAAA==" + } + }, + { + "ID": "d38f224f5e1166ee", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/E9eDXmBggUOzZW8YDIbVTzWpArY?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ed9a92c95f55eb0cd1ba97865584235e/9461621097804324160;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/E9eDXmBggUOzZW8YDIbVTzWpArY?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:39 GMT" + ], + "Etag": [ + "Te2OaIrrjGJvTSjOBPY1FA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PW0+DQBCF/8v42iZtH7yQ9AEsKoZI5WJFY8yyDAguLO4OGkr47y7Vp5mT+WbOmRE+qzYHC7Kq/OpRDWcl0uPchKh7QdqUTrYaYQFIrDRkjJuAeUrVt/ffcVQHzj5d39jbrSE0/8CGgTVCUaHINVivI7SsQbNWrN4NQUM3CyeN3cjIRuazfEh833Z8F6a3aQG1zEIsUGHLcb7VKVkjJ2+OmfeCIy07qWh5cb6BE32auFe4e26cskyC48vhMt152VN8PHS2Sg0lJGdUydaASQTGhCQxEcofkxHW8K+dgVDvleSoNc5HV38G17LpBJJJQ6rHBXBmHr2rCKyCCY3TLyVnFsFGAQAA" + } + }, + { + "ID": "44b89a3c74495190", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anone39bac68e29cce17737b6a9b960420c0a6091192/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ed9a92c95f55eb0cd1ba97865584235e/1056505804883221128;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anone39bac68e29cce17737b6a9b960420c0a6091192/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:39 GMT" + ], + "Etag": [ + "aDhYfSWqoJfe3/Qf3LpEJg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8onumREpgWHF+Z7paUa6wemGfsUuHql29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwpH5VqWKdXGAiEAz3tQ9HEAAAA=" + } + }, + { + "ID": "4950439bacbb6982", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "185" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "27032d80d1f634ad8cca6042aeafd14f/2620681318986207768;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFRJTUVTVEFNUCgnMjAxNi0wMy0yMCAxNTowNDowNScpIiwidXNlTGVnYWN5U3FsIjp0cnVlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6Inl2SXhYbEh3QnE4MEtkZVBYQU5rRGN5NGkyaSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:40 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/sAk6rS8UlsuVYHktI-IZL_EiFnU\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2vbMBT9K0X70A2aWH4/YGxZ4ramqekSpy8KQZavXTWO5Vhy0lD63ye7KYwyyr4J3fO45wi9oBWrMhSglBWbFpr9lyeeohMEkhTq9gFNyb1XYWviXazPIlhkV2UUT9dAbs6EJkYrp5l7i1K013fnKxkNovvpMmSn1eIBKRHWCWdtSUEOat7IgesYwWI+3G+j59vyfPdr4+GLDK5uR/FqQvcWM5hiCSjzKatWivsoZS0CTdvtdsOC86IEUjMxpHytve+rbQ2tbvgTUCm0D16ayiK0T9x+lJwSyXj1fTFXzgo+gxwaqCig4AUddKN/xHhD95PP07w7KKDyeD1BlFc5K9rmcPvS6ST7Whmi34twdqc4fbBudDigeTgNx8lREl2G82R0efX12MC6M8DmwMBHuh1gK8D28TdFzUBIVvXaCUnL/4iREUkEvE2X1Ms9nGI/1b00x0YOue1aFLCNPbCxBbmTea7jEMWTnXzPIhWvCHY8KyVemuqubxFiYMOlqevZpm9kbgomNlNqQtY30ACRMGGi5oIduhnPwlESLqPTZRyGk3CiDHYN+4i6mUUKlMwW8VihFaZuGFewrqMoTsLZaJxE192gFTCFgtD9fFOiQDYtvCpnIYlsRddJd+oqV1JxFJ+hw5Cp9mgP6JfsWmTrDqfbpuPqhgrnuz7qwY38MPMwNs2/n683WUMlD+/79oyo20Tt1yxhTZjaDpmOY/q+aeqWPVDNS6zztfSJ4foraha0YJvHzar0Up4+tj8z2ELJa2iGhdLYMgqEUt5WsvsW6PUPaU9mjdEDAAA=" + } + }, + { + "ID": "79d0f7212bea1ee9", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/yvIxXlHwBq80KdePXANkDcy4i2i?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "dbac4048850a44f1aded041e80661087/4184855733577567144;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/yvIxXlHwBq80KdePXANkDcy4i2i?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:40 GMT" + ], + "Etag": [ + "3WQ58xBOfIWhgYGb+apUMg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P227CMAyG38W7HEiMnVAlLtoNjWrAOFUwTdOUpm4JpE1I3EGFeHcStiufPv/+fYKdqDIIIBXFvkbT3BRIM5/M0daSrAtaVRahBUiscOT9avbYO0YfebzaFJ9v6S3Tybjo9x1h+QZLBsEJcoEysxB8naBiJbq1vPPjCGq0L5bxeLBYhuOpa5Uq861JMhqF0WgA5+9zC7YqnWOOBiuOXk8btUVOsbea1ZIjtbUy1H5+6sKVvk6a3/i4lsNDtO913jOcrsPJ7pU3D6IrHCUVZyRU5cBkAe4IKWJyrg7OJ9zBfx01hHZqFEdr0Yt2/g68qFJLJOeGTI0t4Mw9OxQEQc6kxfMFmYhVMEoBAAA=" + } + }, + { + "ID": "094fed5e65c11ee4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anona0684ba8bb1794aa2027cb785392d7be303bc3ed/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "dbac4048850a44f1aded041e80661087/14226203039406082032;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anona0684ba8bb1794aa2027cb785392d7be303bc3ed/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:40 GMT" + ], + "Etag": [ + "W0xTYAqjW6brY0lltz61AA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qHG1SERDoWZoWbJRVFGuTklFSZGTo62toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwmbmFqYWJgZmZjqGSjVxgIhAKUIkNd5AAAA" + } + }, + { + "ID": "a316fd52d851f022", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "191" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "fb26eadcb4056e8c030c97a62f28614d/15790378553509068672;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIERBVEUoVElNRVNUQU1QKCcyMDE2LTAzLTIwIDE1OjA0OjA1JykpIiwidXNlTGVnYWN5U3FsIjp0cnVlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IjY2cXFOWnF6c096Z1I1N2JCT3NFZFVtUU94MiIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:41 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/0qg8IlhO3J2kWVZuV2fmAX1xYHM\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2+bMBT9K5P3oa3UBPMMRJq2LGEdW5q0CWnXqlJkzIW4AQzYNH2o/32GptLUTdX4Yuuec8+591g8oS0rYjREEUurBuqHj7c8QscIJElV9QZNybVbYGvi/sxPAljFZ1kwm+ZALk+EhqvUDbLN3PxhbC8vrpsLI8lHv/T7q++nN0iJsFY4bjIKslfyWvYGjjFcLfuOU1Wz6+pRzB/ThT2Ivs6FH6/y8/m9oboEZMmUFVvVu5GyFENN2+12/ZTzNANSMtGnPNde59XuDK2s+S1QKbQ3XpraRWjvuH3OOCWS8eLTaqmcFX0BCdRQUEDDJ7TXDf6xxgu7Q97f5tVBEZXH8zGivEhY2tT76lOrEz6UyhCdr/zFlerpFmuh/QUt/ak/Dj9MRqF/GAan/jIcnZ4dHhhYd3rY7Bn4g24PsTXE9sHRkRKIQUhWdA4hibL/WCYmkgh4QdfUTVwcYS/S3SjBRgKJPbAoYBu7YGMLEid2B45DVJ9s5bsuUvDCiigM3ATHruHZsWV5ifqoR3TTMx1VUkecWCTpcqiBSJgwUXLB9gmNF75acR18W898f+JPlMGuZm9Zl4tAkcLFajZWbMUpa8YVrU0qmIX+YjQOg4sWaARMISX0YVllaCjrBp6Vs5BENqLNpL21wSupWTA7QXuQqfRoR+iGbFNkecvTbdMZ6Ibu6tgwUUeu5d+Yq//5iJ1JDoXcv/LLY6J2EjVfvYacMDUdMh3H9DzT1C27p5KXWOe59Igx8LbUTGnKqk21zdyIR5vmSwx3kPES6n6qNO4YBUIpbwrZ/hzo+TfGYudA1wMAAA==" + } + }, + { + "ID": "646e1d2fbe2cb1a0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/66qqNZqzsOzgR57bBOsEdUmQOx2?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b0a6ce9f3ef7a35140f60fad1ca77509/17426610566416480272;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/66qqNZqzsOzgR57bBOsEdUmQOx2?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:41 GMT" + ], + "Etag": [ + "oOG4SJftDzSB/rcCI5Gh8A==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PQU+DQBCF/8t4bWM1lhqSHkptEEOKBblojFmWgVIXFnaHKDT89+5WTzMv8828N2f4rpocXMiqsutRDTcl0sE2MepekDallY1GmAESKw0pI/8heSnoaUy8W8W3wdI/Pm7Wa0NofsSagXuGokKRa3A/ztCwGs1asfgyBA2tFclbHOx9o2uZW71Pw3DjhTuYPqcZnGQWY4EKG472WKvkCTkFNmfeC440b6Wi+cq5hyt9nThO1+3fu1FHYxkvV5kX6V2e1ofo11JCckaVbAyYJmBMSBITsfwxIeEO/rU3EOpXJTlqjfbo4s9gK+tWIJk0pHqcAWfm0+eKwC2Y0DhdAGnwQolHAQAA" + } + }, + { + "ID": "03fbb954750d85fd", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon4bce78f0d8295d449ffffc9a13936295393df4af/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b0a6ce9f3ef7a35140f60fad1ca77509/8949437675196101720;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon4bce78f0d8295d449ffffc9a13936295393df4af/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:41 GMT" + ], + "Etag": [ + "xXGiYCfHPWequO53xyJvPg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pXRLhnRjqneQSEpxaW+psaV1R6lQWk29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwobGRia6RoY6xoZKNXGAiEAECCg6XcAAAA=" + } + }, + { + "ID": "a784f4acfa3b799f", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "191" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0ab4b8db8f9827a5e9a040c3c1fa6aa3/10585669688103513576;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIFRJTUUoVElNRVNUQU1QKCcyMDE2LTAzLTIwIDE1OjA0OjA1JykpIiwidXNlTGVnYWN5U3FsIjp0cnVlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6InZpQ3J5YlV1bGZyMk1CYURUOFdkWkU2OXBEZCIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:41 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/tRzREemD_T8CbJNyQ8K6Rfh3F3Y\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TYU/bMBT8K8j7AEi0cZLGdStNG2sDCpQI0nQIhFQ5zktqmsRp4rTqEP99TijSxCa0L5blu3f33j35Ba1FEaMxikS6aaDaf3mWETpDoFiqX5/QjD3SAg+m9Dq/9GAR32aeP8uB3V/Whgp+BS7k02VIJ9GVv7+j1yRIVvaF/fCEtIhoheMm46B6paxUb0is8WLe34pJtY8WTZZU1s0PNg3pffzoklE5jXVVDVkyE8Va166UKuuxYex2u34qZZoBK0Xd5zI33vs1tpZRVvIZuKqND16GnqU2PnH7lknOlJDF18VcO2t6AAlUUHBA4xd00PX+McYbu0M+n+bdQRO1x+sZ4rJIRNpUh9eXVifcl9oQ3S3c4EHXdIO10OGC5u7MnYRHoXfjnrTHPDy/uT05trBJetjuWfjIdMZ4MMbO8empFoihVqLoHEIWZf8xTMwUq+ENXXKaUBzhUWTSKMFWAokzHHDADqbg4AEkJKZDQpiuU618V8UKWfAIMB1SQuIkITgGYnI6IE6sQ6WEa6dIKzF71OVQAVMwFXUpa3FIaBK456G79C6WvutO3ak22FXiI+s+8DQpDBb+RLM1p6yE1LQ2Kc8P3eB8Eno/W6CpYQYp4/v5JkNjVTXwqp1rxVRTt5m0tzZ4LeV7/iU6gEKnxztC12SboshbnunYZGhaJjWHtoM6cqX+wqhF/1xiZ5JDoQ5bflsmajvR/VVLyJnQ3SGbEHs0sm1z4PR08gqbMlcjZg1Ha26nPBWb1Wad0UhGq+Z7DFvIZAlVP9UaW8GBcS6bQrWfA73+BjRQdNfXAwAA" + } + }, + { + "ID": "b579da2600fae697", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/viCrybUulfr2MBaDT8WdZE69pDd?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8670c69d6d2609c728182128b4a57493/12149845202206500216;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/viCrybUulfr2MBaDT8WdZE69pDd?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:42 GMT" + ], + "Etag": [ + "sk4CY9omTBZCXqSwIf5/CA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8pbE2Wi1JLwptlAQb5SdqjTHLMuC2C0t3BxtCePcu1auZk/lmzpkeDqLOwYVMlMcWdXdVIr2OTYSmlWRsaVRtEBxAYqUlzeHW/1ioKvF2/vsxPgXF3bW/Wi4tYfgPVgzcHgqBMjfgfvZQswrtWjH9tgR1zSjiJAq2j1ZXKh/1Ng3DlRduYPgaHNirLMICNdYcx2ONVnvkFIw581ZypEmjNE3u5zO40JfJr/B1l6WtLPTs2WPr5OEt323mi2adW0oqzkio2oJpDNaEFDEZqZMNCTfwr72O0LxoxdEYHI9O/wx8VTUSyaYh3aIDnNlPnwSBWzBpcDgD76yXeUcBAAA=" + } + }, + { + "ID": "4399ac2e121f7843", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anoncbe087866dff60de61c8465defe86c762bf57a39/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8670c69d6d2609c728182128b4a57493/3744728805512421824;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anoncbe087866dff60de61c8465defe86c762bf57a39/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:42 GMT" + ], + "Etag": [ + "2JcltEdI8YDP4OgWd2zhlQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8obeSXnlLimeFpEugSY+KeHpxhVZeQE2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwmbWhmYWBmYKtXGAiEAIPmBeXUAAAA=" + } + }, + { + "ID": "7586cea28373ac67", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "257" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "dd7266cdec7cd2aadae4d0a697515c0d/5308622853211789904;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJJTlQ2NCJ9LCJwYXJhbWV0ZXJWYWx1ZSI6eyJ2YWx1ZSI6IjEifX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6Ik90WlRQNkJWaWJzaTdkRFNLMWlWNm5oUmRkUCIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:42 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/ylr92LkYb9mS5oZd-u-f8fS7FwA\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TXW/aMBT9K5P3Wsi3kyBNawdpFRVRBoGqXSfkODfBJYlD7IAQ4r/PCXSauqnam+Nz7jn3nusc0YaVCRqgmGXbBurD51ceoysEkmTq9gWNybNX6vbIuy/uQlgk0zycjAsgj3dCO+S1b443T7FfzB3+nPSaXuqlc/d2f/OClAhrhZMmpyB7Fa9lz8XmYDHvP8jnaIq/LVksmJuM5vcGW+JyPUuSqaoSkKdjVm5U7VrKSgw0bb/f9zPOsxxIxUSf8kJ761fbmVpV81egUmjvvDQ1i9A+cPuac0ok4+WXxVw5K/oMUqihpIAGR3TRDf8xxpndIR9P8+agiMrjdIUoL1OWNfXl9tjqRIdKGaLvi2D2pGq6wVrockDzYBwMo0/XO5IrOAEhWdnVRyTO/6PVhEgi4IyuqJd6eqz7seHFqW6mkDquTUF3dA8c3YYUJ56LMVF1spXvqkjJS0x8aoBJXJwmlpkaum+lFuhJ7GFs29h0/Ji4Ova7KWsgEkZMVFywy/zDWXATBavwdjUJglEwUgb7mr1nPc5CRYpmi8lQsRWnqhlXtDaHcBIFs5thFC5boBEwhozQw3ybo0FKcgGX7KakJgVIqAUa/DiiUn2o6nN61Rt2Dv2I5Dl8pY3ttvXfhCXJm46xOx+QgU6nnydFEZLIRrRQe2oh1e4knNyhC8jUhmhH6IJoN8W6HgzHwq5hGp7pYAN15Fr+hWHL/vMZdCYFlPLyTs7PAbWdqAzqFRSEqQSQhbHl+5Zl2E5PbVfqBi+kT0zX31Aroxnbrreb3It5vG6uE9hBziuo+5nS2DEKhFLelLL9vdDpF2tz9z0ZBAAA" + } + }, + { + "ID": "ab42b1ce3e8b2c72", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/OtZTP6BVibsi7dDSK1iV6nhRddP?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8c63c15bf2741692d4a921b383c690d0/6872798367314776800;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/OtZTP6BVibsi7dDSK1iV6nhRddP?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:43 GMT" + ], + "Etag": [ + "B252J5XarU8m/UJ4npGvBA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2Pb0/CMBDGv8v5dkQgAmYJL5guCBKcgxGjMaZrb1Ds2tneNMuy726Hvrp/v3vuuRY+pRYQQi6PXzXa5uqI9NwnKbpakfOhMtohBIDEjp6MxpPxevLCbHZbXmfrG10tv6PFfO4Jx09YMghbKCQq4SB8a0GzEv1aMfzwBDVVX6y2+3gZp75RGtE3ttlms4g2MXTvXQBnk6dYoEXNsVerrDkjp1VvVNSKIw0qY2kwm47hQl8mT/S6T6bRQeZOzsT97nEkD1N9SoVIPKUMZySN9mC2A3+EDDGVmh/vEkbwX0cNoUus4egc9qLDvwN3pqwUkndDtsYAOPOvPkiCsGDKYfcLc04II0gBAAA=" + } + }, + { + "ID": "2622d412e3f630ff", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon6a9c1e2a76fd32f1093f3e0db866446259ba7069/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8c63c15bf2741692d4a921b383c690d0/16914145673143291432;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon6a9c1e2a76fd32f1093f3e0db866446259ba7069/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:43 GMT" + ], + "Etag": [ + "bq8ShEXKFYvN3M9OQMIAzA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8kXWgRnuEZ4u0WW+Rn7WvoH+no6Vjna2gJVlOSXJOYE5ZcXA5UZAvlFYGZ0tVIamCwDC9fGAiEAoIIldm4AAAA=" + } + }, + { + "ID": "5b1e90bd2406b7d4", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "261" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d6dadf499cb0de070d3e8fc5d218b2cb/31857489001809848;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJGTE9BVDY0In0sInBhcmFtZXRlclZhbHVlIjp7InZhbHVlIjoiMS4zIn19XSwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJZbUxsYUlLeHdOd1RncDlhMk9id3VoUTk4RnAiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:44 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/lH2hrG0-l7oJW3hV_ASs1qZuFaw\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TXW/aMBT9K5P3WkhCQj6QphVBYFkRbSG0atcJOc51cEniEDtkCPHf5wQ6TdVU7c3xOeeee49vjmjL8hgNUMSSXQXl4fMrj9AVAokTdfuCZvjZzXVr7N5k0wBW8V0azGcZ4Mep0NJvvU051Tupw78/mpuH9XApjN1zNcH1C1JFWFM4rlICslPwUnYcuzdYLbtP2SzFwc2vel6HSeHh3m1UV5t7z50USiUgpTOWb5V2I2UhBppW13U34TxJARdMdAnPtLd+tX1PK0r+CkQK7Z2XpmYR2gduX1NOsGQ8/7JaKmdFXwCFEnICaHBEl7rBP8Y4s1vk42neHBRReZyuEOE5ZUlVXm6PTZ3wUChDdL/yF09K0w7WQJcDWvozfxR+ut7jVMExCMnyVh/iKP2PVmMssYAzuiYudfVI9yLDjajeo0D7jkVA7+su9HULqB27jm1jpZNN+VaFc9V2bGNHaalOLWxEFCzLoU7PtAwLx4RS6nquFVv9dsoSsIQxEwUX7DL/aOEPQ38dTNZz3x/7Y2VQl+w963ERKFK4WM1Hiq04Rcm4ojU5BPPQXwxHYfDQAJWAGSSYHJa7FA0oTgVcsrvDJc5AQinQ4McR5epDqc/pFW/YOfQjkufwJ7PbYWhbTfN/KA84rVrO/nxARtdEp9PPkyIJiWUlGrA5NaBqeR7Mp+gCMvVKpCW0YTSvxdo+jL5pO0bPcE3PMlBLLuV7zNIN/e9VaE0yyOVlV84rgZpOVA7lGjLMVArItG3T80zTsPod9cJSN3gm1VI63paYCUnYbrPbpm7Eo011HcMeUl5A2U1UjT0jgAnhVS6bXwydfgOv6uBjHQQAAA==" + } + }, + { + "ID": "b6960d6be6fb1614", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/YmLlaIKxwNwTgp9a2ObwuhQ98Fp?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d9b8d44ba80cac0e2707c25615875476/1596033003104796488;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/YmLlaIKxwNwTgp9a2ObwuhQ98Fp?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:45 GMT" + ], + "Etag": [ + "eclDgWfmCb/410l6Ff+bVA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P0U7DMAxF/8U80oluQoNV2sM2qJioNlY2EEIIpanbdSRNSFyVquq/kwye7Csf+1738FXVOUSQVeV3g6a7KJF2vknRNoKsK1rVFiEAJFY6Erm4K18LucqursehmMbFZfaymM8dYfkRJYOoh6JCkVuI3nuomUS3VoSfjqBOexEn28XeSalyLzeHJFksk3sYPoYATipLsUCDNUd/Sxt1Qk5rHzNvBEcaaWVodDOdwJk+T95kItj68afdtPtSz9hkm7XNcTe7jbWjhOKMKlU78PAMzoQUMZGq1mWEMfzrZUdon4ziaC36o+GfwUpJLZBcGjINBsCZe/ShIogKJiwOv6jWr7VGAQAA" + } + }, + { + "ID": "2ada249d420a0a0a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonfd6a7f80f0f4a1bfe447f723414adcfff8984d45/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d9b8d44ba80cac0e2707c25615875476/11637380308916534416;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonfd6a7f80f0f4a1bfe447f723414adcfff8984d45/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:45 GMT" + ], + "Etag": [ + "xrJk0GebkxdpykUugJRu6g==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pXFHllG7inJmVXpBRUZoeWpnsFlZql29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwnrGSvVxgIhAFqF+CJwAAAA" + } + }, + { + "ID": "2a89bf236c040cc3", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "269" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "07b1a9833dab3cbb4eeec99f9c062797/13201554723524670496;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJOVU1FUklDIn0sInBhcmFtZXRlclZhbHVlIjp7InZhbHVlIjoiMS4zMDAwMDAwMDAifX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6ImNKSEJTQmZLN2pKTE1CT3MxZFJRdFo5RFhIMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:45 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/er-ZEfzLdEEXrfDY5jW87IvW20w\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TXW/aMBT9K5P3WkhCvpGmtYWszUpZG6C0XSfkONepIcQhdkAd4r/PCek0dVO1PDk559xz77nOHq1YnqA+ilm6qaB8+bjkMTpBIHGqvj6hEX70ct0aelfrixBmyU0WjkdrwPMLoUHZeQzoz1ESBPclHT7Yy7nnhtt5T989IVWE1YWTKiMgOwUvZcd1ev3ZpEu+Xp5PzumVu/w6uj7/JowkupWP/vD+0lAqARkdsXyltM9SFqKvabvdrptynmaACya6hK+11361bU8rSr4EIoX2xktTswjtHbfPGSdYMp5/mk2Us6JHQKGEnADq71FbN/zHGEd2g7w/zauDIiqPwwkiPKcsrcr2676uM30plCG6nQXRg9I0g9VQe0CTYBQMph9OtzhTcAJCsrzRT3Gc/UerCZZYwBFdEI96eqz7seHFVO9RoLZrEdBt3QNbt4A6iec6DlY6WZdvVDjnObHBtEzPNU3LsnyMXd2wHMPxTJvimFqG7QIltu80U5aAJQyZKLhg7fyDKDibBovwy2IcBMNgqAx2JXvLmkehIk2j2Xig2IpTlIwrWp1DOJ4G0dlgGt7VQCVgBCkmL5NNhvoUZwLa7G5widcgoRSo/32PcvWi1Mf0ilfsGPoeyWP449l1EIWDuvnflDucVQ1nezwgo2vq7YMOhx8HRRYSy0rUpPpUk1Tr43B8gVqQqW2RhtCEUm+NNf0Ytum4Rs/wbNuot6TIpfwLc0zzzyvRmKwhl+2dOV4NVHei8igXsMZMpYFMxzF93zQNy+6oTUvd4Gvp457rr4iZkpRtnjerzIt5/FydJrCFjBdQdlNVY8sIYEJ4lcv6V0OHX1BaFQElBAAA" + } + }, + { + "ID": "6390da3d0a939aa9", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/cJHBSBfK7jJLMBOs1dRQtZ9DXH1?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7d275d063c2643c2c6cce4fef3b5345f/14837786732137180592;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/cJHBSBfK7jJLMBOs1dRQtZ9DXH1?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:46 GMT" + ], + "Etag": [ + "YzTibHdGPndy6exOKY/Paw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/yWP3U7CQBCF32W8hQheQGzChUVigSKlSCIaY7a709q67dbdabA2fXd3y9X8fXPmTAffeSXAgyTPfhrU7U2GdHBJjKaRZGyoVWUQRoDEMkue/17yJBBPUSXaGf7ut+fbiF0WC0sY/oUlA6+DNEcpDHjvHVSsRLuWTj4tQW3tiufTbhWvl7ZRKnFthOGDH66g/+hHUKgkxhQ1VhydWq1VgZzWzqhoJEca10rTeD67g4EeJnwT+Ec/3c6LTbjz92Yq4gO93T++BlNLScUZ5aqy4OkI9ggpYjJWF+sSHDDUfktoIq04GoNOdHI9sFRlLZGsG9INjoAz+2qQE3gpkwb7fxyhLcpIAQAA" + } + }, + { + "ID": "851f295e9f372f95", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonc5e34387334449aa7014616835fabf4157efc596/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7d275d063c2643c2c6cce4fef3b5345f/6360614944706554360;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonc5e34387334449aa7014616835fabf4157efc596/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:46 GMT" + ], + "Etag": [ + "a3MItnbUT0Fx5NCNuMyH8w==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8onGvt6luQlhYYYuFWY+jn7lfpWeliU29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwnrGSvVxgIhABgLW8NwAAAA" + } + }, + { + "ID": "b20843f252a6a58c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "259" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "bed977a3e1be69279350c4279782738b/7996846953335841160;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJCT09MIn0sInBhcmFtZXRlclZhbHVlIjp7InZhbHVlIjoidHJ1ZSJ9fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiWHFvQk5pOWhuZmc2VENhWnlNclNKRkpINk8xIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:47 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/KZrPT2Y3w7la8joA-fkaPpD4ZBU\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TXW/aMBT9K5P3WsgnIUGa1hbSLi2jDEK7sk7Ica5TlxAH2wEhxH+fE+g0dVO1pzg+59xz77G9R0tWpKiHEpatKxC7jy88QWcIFM707hMa4rlfmO7Av11dRzBLx3k0Gq4AP1xL43YuxrH96Gy7OfZf+EWLLvG4HLjzy9kT0kVYXTitcgKqVXKhWl3P7s2m7e9rfjliwXNBMy/u4/nuq5jeXN188e4srZKQ0yErllr7rFQpe4ax3W7bGedZDrhksk34ynjt19jYRin4CxAljTdehp5FGu+4fc45wYrx4tNsqp01fQIUBBQEUG+PTnWjf4xxZDfI+9O8Omii9jicIcILyrJKnHb3dZ14V2pD9G0WTh61phmshk4LNA2HYT/+cL7BuYZTkIoVjT7GSf4fraZYYQlHdEF86puJGSSWn1DTpkA7XZeA2TF96JguUC/1u56HtU7V5RsVLngRUOKYFAJKwbU7ietark88j1iEYmoR23f9NEmw20wpACsYMFlyyU7z9yfhRRwuoqvFKAwH4UAbbAV7y3qYRJoUT2ajvmZrTikY17Q6h2gUh5OLfhzd10AlYQgZJrvpOkc9inMJp+zGWOAVKBAS9X7sUaF/tPqYXvmKHUPfI3UM//Lublh3/hu/x3nVEDbHBVJCfw6HnwfNkgqrStZovapR3fAoGl2jE8j0GZGG0ERRnxVrurA6jte1bMvvmqaLGrJQf2O+++dFaExWUKjTTTleCFR3olMQC1hhpjNAjuc5QeA4lttp6fNVpsVXKsB2N1gSJyMZWz+vl7mf8OS5Ok9hAzkvQbQzXWPDCGBCeFWo+oGhwy80x7HJGwQAAA==" + } + }, + { + "ID": "70b3a2baaf80bdc3", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/XqoBNi9hnfg6TCaZyMrSJFJH6O1?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0a67d890d50d40dc4701ca52e8517d8e/9561021367927200280;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/XqoBNi9hnfg6TCaZyMrSJFJH6O1?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:47 GMT" + ], + "Etag": [ + "dtIbdzLQM6KNQQ3dllbPSA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/yWP3WqDQBCF32V6ayBtwVIhFxpSktSYaBooLaWsu6MxXV2zO1Ks+O7ZtVfz982ZMwP8VI2AAPKqvHao+7sSKXVJhqaTZGxoVWMQPEBipSUFbXLxF6c7/zVJ00chZX44houFJQw/Y80gGKCoUAoDwecADavRrhXzb0tQ37oi2u/jVZjYRq2EaySnOA6jeAXj1+jBReUZFqix4ejUWq0uyGnjjIpOcqRZqzTNnvwHmOhp8n5VUVI9n5ui9N+W7KPf6eP2Zbv29/eWkoozqlRjwdMR7BFSxGSmfq1LcMBURz2hOWjF0Rh0ovP/A0tVtxLJuiHdoQec2VfXFUFQMGlwvAF63enYSAEAAA==" + } + }, + { + "ID": "a64d5f552f3d9209", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon9fc30fe9ffe425b44148c66c1cfaf1c2848dbba4/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0a67d890d50d40dc4701ca52e8517d8e/1083849580496574048;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon9fc30fe9ffe425b44148c66c1cfaf1c2848dbba4/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:48 GMT" + ], + "Etag": [ + "1sj8EtLTl+5iI9iUMS+g/A==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8obFmdZuJb4hORom2Z6WmaG+gZrp+s72toCVZTklyTmBOWXF4OUAflFYGZ0tVIamCwDCpcUlaYq1cYCIQByPgxIcQAAAA==" + } + }, + { + "ID": "9f40464ba10b2740", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "260" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "96a1c7b3fe4d3a171a4acb0c7cf84740/2720081589125861104;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJTVFJJTkcifSwicGFyYW1ldGVyVmFsdWUiOnsidmFsdWUiOiJBQkMifX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6InROdnJZblplQ2lNWWxiWFppNm1RV3dNNlc2dyIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:48 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/S6ojXyQoH6J-3Y5OljXpDwuaAzM\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TYXOaQBT8K53r1ygocIIzncYqTWkMTRRjTNNxjuNBToFD7tCxjv+9B5pOJ+1k+u243bf73r7jgNYsj1AfhSzZVFDu3694iC4QSJKo2yc0Jo92rpsj+zq78mAW3aaeP86AzK+ENsV89bC/41/w15axsL6lq4ditKvI4OfNE1IirBaOqpSCbBW8lK0e7vZn07b0t+Uif4Qhu1mk4cMjw9ndfHeD53inqgSk8Zjla1X7LGUh+pq22+3aCedJCqRgok15pr30q227WlHyFVAptFdemppFaG+4fUw5JZLx/MNsqpwVfQIxlJBTQP0DOut6/xjjxG6Qt6d5cVBE5XG8QJTnMUuq8nx7qHWCfaEM0d3MnSxUTTNYDZ0PaOqO3WHw7nJLUgVHICTLm/qAhOl/tBoRSQSc0CW1Y1sPdSfs2GGsd2OIrZ5JQbd0GyzdhBhHdg9joupkLd9UkZznOCKKSSyDYAqmg0PbjA3HsSKr65gmsYHqIYQ9s5myBCJhxETBBTvPP5y4g8Bdep+XvuuO3JEy2JXsNWs+8RQpmMz8oWIrTlEyrmh1Dp4fuJPBMPDua6ASMIaE0P10k6J+TFIB5+xuSUkykFAK1P9+QLn6UNWn9IoX7BT6AclT+NNg4vlXde+/GfckrRrK9nRAg09DdDz+OCqSkERWogbrUw2qjv2zQn3F1JJoQ2iyqJfFmjY6loF7nW7Htk3LQQ25lH9hlmH8+RIakwxyeX4qpxeB6k5UDOUSMsJUCMjAWK3EMDqm1VILlnqHZ9Ih3Z6zpkZCE7Z53qxTO+Thc3UZwRZSXkDZTpTGllEglPIql/Ufho6/AAqt8SAcBAAA" + } + }, + { + "ID": "367899551668790c", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/tNvrYnZeCiMYlbXZi6mQWwM6W6w?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1b7c330e26977a35e8687106f41bbaae/4284256008012121984;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/tNvrYnZeCiMYlbXZi6mQWwM6W6w?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:49 GMT" + ], + "Etag": [ + "8F8Q5AM/lvvMqDQTzRDwEw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8bWM1ERuSXvRPbQJEaJvaGmOWZcCtC0t3BwgS3t2lejVzMt/MOdPBtygScCEW2aVC3d5kSOHQRGgqScaWUhUGYQRILLPk9GkaPsz9W1nX/mUV7n6iVbNuZjNLGP6FOQO3g1SgTAy47x0ULEe7lk4+LUFtOYjtLtoEz1bnKhl0sPe8+cJbQ//Rj+Cs4ghT1FhwHI6VWp2R02bImVSSI41LpWn86NzDlb5OKKj1sTjhUvhHGb+dhJOHh8Z3Dk5jKak4I6EKC+63YE1IEZORamxIuIN/vWgJzatWHI3B4ejkz2Cp8lIi2TSkKxwBZ/bTF0Hgpkwa7H8BtLGgxEcBAAA=" + } + }, + { + "ID": "35d4f766bb99111c", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon6da574a53a6ce496b84f3995d52944a8ec0beb74/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1b7c330e26977a35e8687106f41bbaae/14325603309545735112;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon6da574a53a6ce496b84f3995d52944a8ec0beb74/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:49 GMT" + ], + "Etag": [ + "8iDuCAcnUyebmtn8Fh56aw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pbZLqUOjsm54VWpiblluRZuGWYmiWW29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwo7Ojkr1cYCIQCbU4BjcAAAAA==" + } + }, + { + "ID": "a36b190fa15dce48", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "260" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a04915099ca7a9b89c190579c867a072/15889778823631944792;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJCWVRFUyJ9LCJwYXJhbWV0ZXJWYWx1ZSI6eyJ2YWx1ZSI6IlptOXYifX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6Ik80RWlmeHJrN0UxSXBlYkw0bURMUVRJR05IaCIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:50 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/Y_xUBLOW1HmvoYfA4tadc_DXvZE\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2+bMBT9K5P3tQ3P8Ig0rW3CUjSUtglpl65TZMyFuAFMsCGtovz3GUKnqZqqfTM+59xz77nmgLa0iNEIRTTd1VC9fn5mETpDIHAqb59QgB+dQjUnzvd86sMyvs38WZADfphyZbV+WV4FNw/add6wVXJpChyT9eRH8+g9IVmEtoXjOiMgzktWiXPb0kfLxeDG9GjyUm1tT/NLiAIznwR3oT+dXW+kikOWBLTYSu1GiJKPFGW/3w9SxtIMcEn5gLBceetXaXSlrNgzEMGVd16KnIUrH7h9zRjBgrLiy3IhnSV9DglUUBBAowPq6/r/GOPE7pCPp3lzkETpcTxDhBUJTeuqvz20dcLXUhqiu6U3X0lNN1gL9Qe08AJvHH66aHAm4Ri4oEWnD3GU/UerMRaYwwldEydx1Eh1I82JElVPIBnaJgF1qDowVE1IrNixLQtLnWjLdypcsMK2YtuMhhHYhqvbjqvFcQSGpcVOopMkToC4xMXgdlNWgAVMKC8Zp/3847l3GXpr/9t65nkTbyIN9hV9z3qY+5IUzpezsWRLTllRJmltDv4s9OaX49C/b4GaQwApJq+LXYZGCc449Nnd4grnIKDiaPTzgAr5IdWn9Mo37BT6AYlT+Fer0OsW9Idwj7O6YzSnA3rM3QYdj7+OksUFFjVv0fbUorLjmT+boh6kckmkI3RZtMuiXRva0LBsTdcc13EM1JEr8Q5zVdVQ/34JnUkOheifyulFoLYTGUO1hhxTGQIyLMtwXcPQzOG5XLBQNZYLF+u2uyVGSlK62+y2mROxaFNfxNBAxkqoBqms0VACmBBWF6L9w9DxN0C3dW4cBAAA" + } + }, + { + "ID": "c840601eda7d1b23", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/O4Eifxrk7E1IpebL4mDLQTIGNHh?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0ebfd66f970710b3dc21158c9f8cc809/17453954342029833448;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/O4Eifxrk7E1IpebL4mDLQTIGNHh?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:50 GMT" + ], + "Etag": [ + "er15T+tJ8k+8svmSS4EYIA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PQU+DQBCF/8t4LE2KQduQ9FCUWAypFuihMcYsy0ApuyzuDipp+O8u1dPMy3wz780FmrotwIe8rj571MNNhbSfmgRNL8jY0qnWIDiAxCpLonbvshk9r5rZynzJNPXCY7RZry1h+AklA/8CZY2iMOC/XaBlEu1aufiwBA3dJIJjFqZWSlVMcneI400QhzC+jw6cVZ5giRpbjtOtTqszcoqmmEUvONK8U5rmy/tbuNLXyYsX1uWPbpahG3WYx558jPdZ9LTbniwlFGdUq9aChxSsCSliIlHfNiO48K+DgdC8asXRGJyOLv4MHpTsBJJNQ7pHBzizj25rAr9kwuD4CzJ4tAFGAQAA" + } + }, + { + "ID": "bc3df1099cfc7cc0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon76d74b5be73927891ddbe361d8f2cfdfec9c9ae9/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0ebfd66f970710b3dc21158c9f8cc809/9048837945335754800;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon76d74b5be73927891ddbe361d8f2cfdfec9c9ae9/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:50 GMT" + ], + "Etag": [ + "On+r6qzGZEgXU04oStJrTg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8r752kXmRVWuUe5pkeEGpjkB5d4FYWk29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwpH5VqWKdXGAiEA+pepBnEAAAA=" + } + }, + { + "ID": "4c7b5ebd2866bedf", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "285" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "edc564981ea81fe965dd331a1678a574/10613013463716866496;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJUSU1FU1RBTVAifSwicGFyYW1ldGVyVmFsdWUiOnsidmFsdWUiOiIyMDE2LTAzLTIwIDE1OjA0OjA1KzAwOjAwIn19XSwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJyMGVyaFdZODJabWhjUEIxaXM0MGw2cFRLcEgiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:51 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/hXJFfD8QVVLKXOm-j0b9VrUDSjE\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2/aMBT9K5X3cYXYeZFEmtYO0i4rZRQCfawTcsxNMOSFY0AV4r/PCXSauqnaN8fnnHvuPdfZoxXP58hDEU/WGxAvH5ZFhM4RSJqo22fUp09Ojs2ec5NdBzCZD9Ng0M+A3l9X2uLh21Xcc+6m0/7Nw/estcSROxWT3njpPyNVhNeF55uUgWyVhZCtjq17k3FbYBCL+0dHf8oWbPiF8MrEqV2GN+VXpaogjfs8XyntQsqy8jRtt9u1k6JIUqAlr9qsyLTXfrWtrpWiWAKTlfbGS1OzVNo7bp/TglHJi/zTZKycFX0EMQjIGSBvj051g3+McWQ3yPvTvDooovI4nCNW5DFPNuJ0u6/rhC+lMkR3E3/0qDTNYDV0OqCx3/e74dnFlqYKnkMled7oQxql/9HqnEpawRGdMSd2cITdiDhRjPUYYqtjMsAWdsDCJsT23OnYNlU6WZdvVDQvctsgjmnrugUdYjBsEpMS3XUdrNiWxRgh1CDMjZspBVAJPV6VRcVP83dH/mXoz4Kr2cD3e35PGewEf8u6HwWKFI4mg65iK04peKFodQ7BIPRHl90wmNbApoI+JJS9jNcp8mKaVnDKbkgFzUCCqJD3Y49y9aHUx/TKV+wY+h7JY/hhcOuPw8vbYd3+b9KUppuGtT0ekI6J3cJGS8dnxPKw6WHrI8Yexuhw+HlQ0kpSualqSX2qJWqUQTC4RieQq+2xhtCEVG+RN/0Ry7A7RCcuwaaDGrKQf2FE1/98Io1JBrk8vaHjU0F1JyofMYOMcpUOMmzbcF3DIKbVUpuXmBSZdKnecVfMSFjC14v1KnWiIlpsLuawhbQoQbQTVWPLGVDGik0u618PHX4Bo9m3FDUEAAA=" + } + }, + { + "ID": "bf59e4c5cc75bd8a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/r0erhWY82ZmhcPB1is40l6pTKpH?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e4c730f19af011c47f61259879438ac7/12248964001664409936;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/r0erhWY82ZmhcPB1is40l6pTKpH?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:51 GMT" + ], + "Etag": [ + "aHDwO0LNaTlseaBguNzBXQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2QyW7CQAyG38W9ghRQRatIHEiLFNSQsgTRRVU1TJyFTjLTGUcojfLudWhP3j7bv93BV1mn4MOpzL8btO1NjrQdnB26RpFjY3TtEEaAJHImRfh4efaiWCTKoQjyJv4JXrbzORNOFlgJ8DvISlSpA/+9g1pUyG2Z98kEtWYIktV6uU8W6w2nKp0OqfgQRYsgWkL/0Y/grE87zNBiLXGYZ6w+o6TVIDVtlEQaG21pfDebwpW+VqyHtji+3k/fqkJugknpbj01M8mTCZlSWgoqdc3gYQ+8hDQJtdMX1gkT+I+DltBtrJboHA5Dvb8FD7oyConVkG1wBFLwsWFJ4GeCH9H/ApqQj39KAQAA" + } + }, + { + "ID": "cbb8e389576924f1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon631846225e713c0414a12998076655cc11a31c9f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e4c730f19af011c47f61259879438ac7/3771791114738933144;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon631846225e713c0414a12998076655cc11a31c9f/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:52 GMT" + ], + "Etag": [ + "Gsb2sTEF0LPTqMSC0KQHJQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8q7FycZFYe4uhn4BIQU+gY7G3gHengF2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwmbmFqYWJgZmZjqGSjVxgIhAPepRzN5AAAA" + } + }, + { + "ID": "f6de461c4b7370fc", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "370" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a6f50d25dd2da5414405515f2aa5ba03/5335966628825142824;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7ImFycmF5VHlwZSI6eyJ0eXBlIjoiVElNRVNUQU1QIn0sInR5cGUiOiJBUlJBWSJ9LCJwYXJhbWV0ZXJWYWx1ZSI6eyJhcnJheVZhbHVlcyI6W3sidmFsdWUiOiIyMDE2LTAzLTIwIDE1OjA0OjA1KzAwOjAwIn0seyJ2YWx1ZSI6IjIwMTYtMDMtMjAgMTU6MDQ6MDUrMDA6MDAifV19fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiWWVzS0JUVzI4RllYaENCbXc4dldMTnRQcnB0IiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:52 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/hR5WiQMi_yst1sh3oAdN9suNXZk\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TbW+bMBj8K5X3cUswrwGkaUsTVqGlqCWkafeiyJgH4oVgik2iKMp/nyGpVHXTNIkPhrt7jjs9PqINqzLko5QVzy00h3e/eIo+IJCkUF9/oBn55lbYmrpftzchLLK7MoxmWyDLG6GtY3vJ7m/Z6iCkLtYmH2eRJ9ro8dvmB1JDWDc4a0sKclDzRg5GjuEv5sMnEF+vk6Xhfnl6XE+ut3t3t5xF8q6ppVIJKPMZqzZKu5ayFr6m7ff7YcF5UQKpmRhSvtVe/lfbGVrd8F9ApdDeeGkqi9D+4fap5JRIxquPi7lyVvQYcmigooD8I7rMDf8S48zukX+neXFQROVx+oAor3JWtM3l67GbkxxqZYjuF0H8pDR9sA66HNA8mAWT5OrzjpQKzkBIVvX6hKTlf/xqRiQRcEZX1M1dnGIv1d00x0YOuT2yKGAbu2BjC3Inc0eOQ5ROduN7Fal4RUc68XDquDTTDRgZnmViwzVMh2SWk4KrW5ZuZjn0KRsgEqZM1FywS/5JHIyTYBV+WUVBMA2mymDfsLesZRwqUhIvooliK07dMK5oXQ9hlATxeJKEDx3QCphBQehh/lwiPyelgEt3d6QhW5DQCOR/P6JKvSj1ub36BTuXfkTyXP44jsdd+aRpyOENloS3wTwZ396h0+nVhAdStj2t1/RvZ8PdGUAG1p0BNgcGvtJtH1s+tt9j7GOsKvov1s9T96g7IYlsRWfVnTqR6icKoxt0AZlaCdoT+ua71WB9aN02nZFu6J5h6yPUkxv5J+Z6r/euN9lCJS+Led6/PrwqvVnBljBVOTIdx/Q809Qte6DWSWKdb6VHjJG3oWZBC/a8ft6UbsrTdfs5gx2UvIZmWKgZO0aBUMrbSnb3GZ1+A+2nkVCKBAAA" + } + }, + { + "ID": "deeef56b7619c97b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/YesKBTW28FYXhCBmw8vWLNtPrpt?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3fd5068a07c1f6fde3cfd883ee34de54/6972198637454429880;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/YesKBTW28FYXhCBmw8vWLNtPrpt?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:53 GMT" + ], + "Etag": [ + "y2wGHj8Yj2ru9YdeBZNPlw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8pUnlQpGkF6WibbQNUpqKxpjtMlBwYdfdQUII7+5SvZq/b86cGeCrbDLw4VQW3y3q/qpAepmSGE0ryNigZGMQHEBihSV7t3tcV15aubq9SzMM3naR6BYLSxh+xpqBP0BeosgM+O8DNKxGu5bPPy1BvZqKZLMN98lyG9lWLbOpFYdRuEzCexg/RgcqeYoxR40Nx0lPaVkhp81kNWsFR5opqWl2e+PChb5MUjRPQXJ0vYf09bwK6s77OT7vKNKKLCUkZ1TKxoKHPdgjJImJWHbWJ1zDfx30hCbSkqMxOInO/w6sZK0EknVDukUHOLPPrksCP2fC4PgLcQQQHEoBAAA=" + } + }, + { + "ID": "4f7af7919e330cee", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonc71a90b68cd12e72943028236ad46be814413dfe/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3fd5068a07c1f6fde3cfd883ee34de54/16941489448739867392;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonc71a90b68cd12e72943028236ad46be814413dfe/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:53 GMT" + ], + "Etag": [ + "1mLKPW33Jqa8Qs6yEX2WuQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8ob5vp4B4QbG3sVJloEFptVukYYhZcG2toCVZTklyTmBOWXF4OUAflFYGZ0tVIamCyDkUqGJqYWJhZmRiamegZKtTrYBGPBEACpcFRelgAAAA==" + } + }, + { + "ID": "c093d7f5a750a10d", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "285" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "2ea5c1cc76ec8755768bf54e6ca20b9b/131257759141462928;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJEQVRFVElNRSJ9LCJwYXJhbWV0ZXJWYWx1ZSI6eyJ2YWx1ZSI6IjIwMTYtMDMtMjAgMTU6MDQ6MDUuMDAwMDAzIn19XSwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJld0tFU0tVTkNEZDN1Zk5Senk3TWZ6TmFQTFUiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:54 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/kU1Uc3K4NaP-msKCG-mzXaXLVJY\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2+bMBT9K5P3tQnmTZCmtUpYxJKiLoE+tk6RMRfqhlewSZRG+e8zJJ2mbqrGJ+Nzzj33HtsHtGZlglwUs2zTQrP/+FzF6AKBIJncfURz8t0psTFxZsXUhyi5yf1gXgC5m3JlHakR1WdGQG4GBZ+Np4Pi5Z7cz2+/PjwiWYR1hZM2pyAGddWIgW1pbrQcwm7mLWdRMJ4kepsGi5e9fZ2+yCrzSKo45OmclWupfRKi5q6i7Ha7YVZVWQ6kZnxIq0J57VfZakrdVM9ABVfeeClyFq684/Y5rygRrCo/RUvpLOkLSKGBkgJyD+hc1//HGCd2j7w/zauDJEqP4wWiVZmyrG3Ou4euTrivpSH6FnmLB6npB+ug8wItvbk3Dj9cbkku4QS4YGWvD0mc/0erCRGEwwldUSd1cIxHserEKdZSSE3boIBN7ICJDUitxLEti0id6Mr3KlJWpY0TW7dsQyNUM5NRahhmDJbcIZYdA+hWrOspdcx+ygaIgAnjdcXZef7xwrsKvZX/ZRV43sSbSINdw96y7ha+JIULGahkS07dsErSuhz8IPQWV+PQv+2AlsMcMkL3y02O3JTkHM7Z3ZCGFCCg4cj9cUCl/JHqU3r1K3YK/YDEKfyJdAv9a6/r/jfnluRtT9qeFkjDqjXA+kDDH1TTxYaLzSHuPh0djz+PUssFES3vNN2q08hRAj+YojPI5OnRntCH1J0i6/tTTZmlqqkjQ8Mm6smN+BtzjD+vSG9SQCnOd+h0VVDXicynWUFBmEwH6Zalj0a6rhrmQJ68wGpViBHR7NGa6hnN2OZps86duIqf2ssEtpBXNTTDTNbYMgqE0qotRff00PEXn6eiODUEAAA=" + } + }, + { + "ID": "fc2601e00f130e0c", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/ewKESKUNCDd3ufNRzy7MfzNaPLU?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0df548cd7a765c6fa36af31e395b9ebf/1695433273227738143;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/ewKESKUNCDd3ufNRzy7MfzNaPLU?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:55 GMT" + ], + "Etag": [ + "Jv3y5TGyj6Ecv7fuvLmwKQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P206DQBCG32W8bZNqY0lIetED0QolLYUrY8x2mUVwYZEdIJTw7u5Wr+b0zT//jPCdVym4cM2znxab4SFDOtskQt1K0ibUqtIIM0BimSHfuuXwHL8MxcrjnSPaLih7/7xeG0LzLywZuCOIHGWqwX0foWIlmjWx+DQEDbUt9pvYiw9Hz3RKldpOmATBZht4MH1MMyjUNUKBDVYcrVzdqAI5HazTtJUcaV6rhubO6gnu9H2Cve9d/CTc7dNlK8LoNjhHcQvZKUgMJRVnlKvKgMkFzBFSxGSkemMTHuG/3g6E+tQojlqjFV38HdipspZIxg01Lc6AM/Pra07gCiY1Tr/0+AtwSQEAAA==" + } + }, + { + "ID": "5dbdfb53e6e1ba57", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon70d736742ac25d9f445be6367a67bee36b33fc85/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0df548cd7a765c6fa36af31e395b9ebf/11736780579056253031;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon70d736742ac25d9f445be6367a67bee36b33fc85/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:55 GMT" + ], + "Etag": [ + "R8872kfnOaTo3FmGLPbFsQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8oHWViYG2Wn5fknhuQbu+W6+wQkuRUH2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwobGRia6RoY6xoZhBiaWhmYWBmY6hmAgLFSbSwQAgBMLM9ChwAAAA==" + } + }, + { + "ID": "39905db0fe08a147", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "265" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "4a44d7f69fe1a14c98722a423edeead9/13300954993664389367;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJEQVRFIn0sInBhcmFtZXRlclZhbHVlIjp7InZhbHVlIjoiMjAxNi0wMy0yMCJ9fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoibnVMWUtkZVExTFgyTzdYU3RkVGlKS1hQTHVZIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:56 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/i9zWYo0Diuy_cRlfHEWtTYT0j3k\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2/aMBT9K5P3tZAXeSFNawVZlzWibQilbJ2Q49ykLiEOsQNiiP8+59FpqqZq3xyfc+6591znhDa0SNAYxTTb1VAdP76wGF0gEDiTt08owN+dQh1NnZvttQ+L5C73Z8EW8PKaK9T9tVwxdUrr45qEefrVW4poFakvxuYJySK0KZzUOQExKFklBraljxfzYVEHq5sE7rXgUb+1H+ciiei3m8e7oF5JFYc8DWixkdpnIUo+VpTD4TDMGMtywCXlQ8K2ymu/yl5Xyoq9ABFceeOlyFm48o7b55wRLCgrPi3m0lnSQ0ihgoIAGp9QX9f/xxgdu0Xen+bVQRKlx/kCEVakNKur/vbU1ImOpTRE9wsvbDTtYA3UH9DcC7xJ9OFyj3MJJ8AFLVp9hOP8P1pNsMAcOnRNnNRRY9WNNSdOVT2F1LRHBFRTdcBUR5BaiWNbFpY60ZRvVbhgBdYsh5hOaiQjSAwX2wl2XTcGU0sw0a04JWaqW6nWTlkBFjClvGSc9vNPQu8q8tb+l/XM86beVBocKvqWtQx9SYrCxWwi2ZJTVpRJWpODP4u88GoS+Q8NUHMIIMPkON/laJzinEOf3R2u8BYEVByNf5xQIT+kukuvfMW60E9IdOFPG7fzX/gDzuuWsO8OSFc1a6AaA11F5/PPs+RygUXNG05zajiy7Zk/u0Y9SOWmSEtoA2k2RtteNNOwbE3XXNPVTNSSK/EWs9QW+/McWpMtFKJ/L92zQE0nMotqDVtMZRLIsCzDdQ1DG5kDuWWhamwrXKzb7oYYGcno7nm3yZ2Yxc/1ZQJ7yFkJ1TCTNfaUACaE1YVofjN0/g03XzEwIQQAAA==" + } + }, + { + "ID": "c4da81d2da181594", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/nuLYKdeQ1LX2O7XStdTiJKXPLuY?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8a3a2faa9fcf4dfa078d6225ab4a0762/14865130507750599047;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/nuLYKdeQ1LX2O7XStdTiJKXPLuY?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:56 GMT" + ], + "Etag": [ + "gstMqM5T09OSzsi5uHQ3gQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3W7CMAyF38W7LVJhYmiVuIANiY0w6A9S0TRNIXW7sLQpjaOpq/rupGxX9pE/+xx38C2rDAI4yeJisWnvCqRwaCI0VpFxpdaVQfAAiReOLAxtL9tp4j/u4l8jp3Yd3hfhfO4II76w5BB0kEtUmYHgvYOKl+jWcv/TEdTWg3heJCunSp0N6u3A2GLJVtB/9B6c9SnCHBusBA6n6kafUdDLkDKzSiCNat3QaPYwgRt9m1SWHTcZhmOWTnazNKYska+bdM/s0VFKC05SVw48xOBMSBNXkf5xEWEM/3rZEpp9owUag8NR/8/gSZe1QnJpqLHogeDuz7UkCHKuDPZXWja2AUUBAAA=" + } + }, + { + "ID": "5b6bb190df97b1b0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anona168c58f3d4ed39a7da999be51dac26bfc5f26f1/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8a3a2faa9fcf4dfa078d6225ab4a0762/6460015214846272975;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anona168c58f3d4ed39a7da999be51dac26bfc5f26f1/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:57 GMT" + ], + "Etag": [ + "gnFSdd7A0+l9vP6Swbgvkg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qn57kFp6SYOxpo51iWBZgFlyell2Wn29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwobGRia6RoY6xoZKNXGAiEAiQA8jXcAAAA=" + } + }, + { + "ID": "81aa72ce91ac01f5", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "270" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "034b1628f2aea602dade81e33476f1e3/8024190728932482655;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InR5cGUiOiJUSU1FIn0sInBhcmFtZXRlclZhbHVlIjp7InZhbHVlIjoiMTU6MDQ6MDUuMDAwMDAzIn19XSwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJoMXJKV3E3a1F5alJIVkdXNmh0ZHYxb2ljN28iLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:57 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/UcYSvS3bScYvsQyHsb9FKOAaLpA\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1T226bMBh+lcm7bcP5KE1rlNCWNcvahDTq1iky5oe4IZhgQxRFefcZSKepm6pxZfhO/8Ec0YYWCfJRTLNdDdXh4wuL0QUCgTP59RlN8He3UM2xe7e9CWGR3OfhdLIFvLzhyoI8zZu5Ec/JU8MfDrc89q7vvg3xpBw+I2lCW+OkzgmIy5JV4tKxdX8xH6y16sty52weDi+z28ebpb0WSaMxShwmVRzydEKLjdSuhSi5ryj7/X6QMZblgEvKB4Rtldd6lUZXyoq9ABFceZOlyF648k7a55wRLCgrPi3mMlnSZ5BCBQUB5B/R2Tf8Rxs9u0Pe7+Y1QRJlxukCEVakNKur89dj6xMdShmIHhbB7ElqusZa6HxA82ASjKIPVw3OJZwAF7To9BGO8/8oNcECc+jRFXFTV41VL9bcOFX1FFLLMQmoluqCpZqQ2onr2DaWOtHadypcsMLRwTRxDHFipybW1djSYt2zDc/CNia6NMBubOK067ICLGBMeck4Pfc/mgXDKFiF16tpEIyDsQzYV/QtazkLJSmaLaYjyZacsqJM0to5hNMomA1HUfjYAjWHCWSYHOa7HPkpzjmcZ3ePK7wFARVH/o8jKuSLVPfTK1+xfuhHJPrhR+HXoK38N/6I87ojNP0BaZavmr5qDdT2MdDp9PMkBVxgUfOW2J5aoqx9Gk5v0Bmkcl2kI3RTaddGt72hYTuarnmObruoI1fiL8xwrD/vRBeyhUKcL01/N1BbiRxItYItpnIcyLDlZjzD0EzrUq5aqBrbCg/rjrchRkYyulvvNrkbs3hdXyXQQM5KqAaZ9GgoAUwIqwvR/mvo9AuPN0mlJgQAAA==" + } + }, + { + "ID": "52696759f1cc4da6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/h1rJWq7kQyjRHVGW6htdv1oic7o?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d5c27c9124431f703781edaed207fb89/9588365147835520751;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/h1rJWq7kQyjRHVGW6htdv1oic7o?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:58 GMT" + ], + "Etag": [ + "6JwQW3FLeqjTlDOfjrb2Nw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PQW+CQBCF/8v0ionYBBMSD7W1VUNtoVoOTdMsy6DgwuDuUEII/93F9jTzMt/Me9PDOa9S8CHJj5cGdXd3RA7HJkLTKDa21FQZBAeQxdGS3rYN4/vnAC/FXj29ZYVOZrt2sbCEkScsBfg9ZDmq1ID/1UMlSrRr2fTHEtzVo9hvXldWlZSOancIgodlsILhe3CgoCTCDDVWEsdTtaYCJW/GlGmjJPKkJs2TuTeDG32bnFy9jS/zc9gV0frzJfZOnP66lMs5WUqRFJxTZcHDB1gTJhYqotZGBBf+9bJjNO+aJBqD49Hpn8EjlbVCtmlYN+iAFPbPdc7gZ0IZHK6UnQoqRQEAAA==" + } + }, + { + "ID": "1f0880c903f5e9e5", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon72e44abebd6f4a20b51b296395a6ac2050a8b4af/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d5c27c9124431f703781edaed207fb89/1183249850636292663;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon72e44abebd6f4a20b51b296395a6ac2050a8b4af/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:58 GMT" + ], + "Etag": [ + "3C+6UmjX12kUkUE8Xtkf3g==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8obO2ubheZmRRgaZYdmh7paRJRkpxmn29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwmbWhmYWBmY6hmAgLFSbSwQAgBifs5+fAAAAA==" + } + }, + { + "ID": "975b8efd813f8d0e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "932" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5fd02df69605e0ed174b25758d811066/2747425364722502599;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUIEB2YWwiLCJxdWVyeVBhcmFtZXRlcnMiOlt7Im5hbWUiOiJ2YWwiLCJwYXJhbWV0ZXJUeXBlIjp7InN0cnVjdFR5cGVzIjpbeyJuYW1lIjoiVGltZXN0YW1wIiwidHlwZSI6eyJ0eXBlIjoiVElNRVNUQU1QIn19LHsibmFtZSI6IlN0cmluZ0FycmF5IiwidHlwZSI6eyJhcnJheVR5cGUiOnsidHlwZSI6IlNUUklORyJ9LCJ0eXBlIjoiQVJSQVkifX0seyJuYW1lIjoiU3ViU3RydWN0IiwidHlwZSI6eyJzdHJ1Y3RUeXBlcyI6W3sibmFtZSI6IlN0cmluZyIsInR5cGUiOnsidHlwZSI6IlNUUklORyJ9fV0sInR5cGUiOiJTVFJVQ1QifX0seyJuYW1lIjoiU3ViU3RydWN0QXJyYXkiLCJ0eXBlIjp7ImFycmF5VHlwZSI6eyJzdHJ1Y3RUeXBlcyI6W3sibmFtZSI6IlN0cmluZyIsInR5cGUiOnsidHlwZSI6IlNUUklORyJ9fV0sInR5cGUiOiJTVFJVQ1QifSwidHlwZSI6IkFSUkFZIn19XSwidHlwZSI6IlNUUlVDVCJ9LCJwYXJhbWV0ZXJWYWx1ZSI6eyJzdHJ1Y3RWYWx1ZXMiOnsiU3RyaW5nQXJyYXkiOnsiYXJyYXlWYWx1ZXMiOlt7InZhbHVlIjoiYSJ9LHsidmFsdWUiOiJiIn1dfSwiU3ViU3RydWN0Ijp7InN0cnVjdFZhbHVlcyI6eyJTdHJpbmciOnsidmFsdWUiOiJjIn19fSwiU3ViU3RydWN0QXJyYXkiOnsiYXJyYXlWYWx1ZXMiOlt7InN0cnVjdFZhbHVlcyI6eyJTdHJpbmciOnsidmFsdWUiOiJkIn19fSx7InN0cnVjdFZhbHVlcyI6eyJTdHJpbmciOnsidmFsdWUiOiJlIn19fV19LCJUaW1lc3RhbXAiOnsidmFsdWUiOiIyMDE2LTAzLTIwIDE1OjA0OjA1KzAwOjAwIn19fX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IjN1dEY1b0JjZWowYlJhamFVNlFFMmpjWjdTaSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:58 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/fC7q2PhBDm_YJYN2WEwOhGIYoGA\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection":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WCrwGAAA=" + } + }, + { + "ID": "9cee68aea36123c4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/3utF5oBcej0bRajaU6QE2jcZ7Si?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "52843763bbd4c9d46410e7d431d2bcfd/4383656278151840599;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/3utF5oBcej0bRajaU6QE2jcZ7Si?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:59 GMT" + ], + "Etag": [ + "rwkeEgAnYSJsFX0Jg18JQg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6VSXW+CMBT9L90rJugyXUh8QMVNo04LJvvIspRyYSBQ1l5iiPG/r+gimXMvW/rQnvace05u745s4jwgFvHj6KMEWV1FgKv6QEGVKSq9FSJXQAwCyCLNlNsNOJGdP7lTNX40p1H7drqK+n3NUPwdMkasHQljSANFrJcdyVkGWhaab5qBVVED6gwf6EjjTAQ1XqxnM3swc/TNT6UXZ6CQZUWj9yZzx/Xs+fJCib1xUroo4zyypWRVo3U9OlncNULqLB3bc0bfhKWvtSXHP0Y+Gv/u2YR9veR6lvjc+pT4v9b1MkgifAohSMg51H9XSJEAx0k9FkGZcsBWISS2et0OObAPL9cljm/EgENi+pQlbN1dOZ2EP/fcWLNSwRnGItfEtas7S1AgS6nY6qykTb7woEJQSyk4KAV1UfNoMBRZkQLqNLodYBDO9GDdx0iskKUK9p+ze/EctgIAAA==" + } + }, + { + "ID": "26eb39b66b131c01", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonb75ff2f7282c54cd167a6d584579fe39da451147/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "52843763bbd4c9d46410e7d431d2bcfd/14352947085159153567;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonb75ff2f7282c54cd167a6d584579fe39da451147/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:29:59 GMT" + ], + "Etag": [ + "iseY2ksfsAX5BXew1G30Qg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pnFqdGGmUXpxU7Rpg6RaSWG7obGwSm29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsU7JCYioZmphamFiYGZmY6hko1eqABaFSiTC+UpJSbSyUjaw3GSSMogdZNgVJFlk8FSweCyMAOivOlvMAAAA=" + } + }, + { + "ID": "5553d2716df58925", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "823" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f20330499c19149862bab819adf918c6/15989179098066565167;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026pretty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am9iUmVmZXJlbmNlIjp7ImpvYklkIjoibkFSVDJNTkp4NWkyeThnRmplYzZxREQ4SWRyIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:00 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/xVSxA7Q3ZX4rb3U2jpgvpx1sn-A\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKVUW2+bSBT+K9X0sbEZwGCMVG2RTSO2jpUCTrfdrqJhGMgk3DwMTiwr/71nwEndOmpXuw+WGc53OTdmj+54lSIXJTzfdEzsXt/WCTpDTJIc3n5FS/LFqfBk4XwozwO2Ti+LYLUsGfl03moPV9GDN/1ofvlrIhJzbdw2+bZ50Ntq5H1FIMKVcNoVlMlRUws5mtqGu47GlRfGxsXqzweLGzsnf3/LqL1ZLJwgFcBqWZEteXUH3Bspm9bVtPv7+3Fe13nBSMPbMa1L7SlfbWtojahBQrbaT14a1NJqv3D7o6gpkbyu3q4jcAZ4yDImWEUZcvfooBu8UMaA7iO/rubJAYDg8XiGaF1lPO/E4e1e6cS7BgzRx7UffgZOX5gKHR5Q5C/9efzq3ZYU45iXrJWkbM6Gc9QlkRQdlWP441UO/BQAvOoNYpIU/6KWlEjSsiF6TZ3MwQmeJbqTZNjIWGZNJ5RhCzvMwhOW2akztW0CPKnkexap6opiyhxzpicmJYlJLNN0DDLLbJpkbEJImljYMo0k7dsgGJFswdumbvmhQfPQ92L/Onh/vfL9hb8Ag3vBf0Z9CgMAxeF6NQc0YBrBa4CpRgWr2A+9eRxcqUDXsiXLCd1FmwK5GSladmjuJRGkZJKJFrl/71EFB2BDO5XcU2yYyh7JYToRWM5jtaB9u1X0B/bzYFRffqTGwYUfxd7FJXp8PHsmDPPyhCC7U4oXhp7aBaLCp5kEq3PQOhZ7WoNTqd8l/rw3p7zB5p8Xjf5b4v87E/gdzeiKFF2PHBT7Y6vO3/vxUnDwgaftwEek7+bRDI9iBtbtETZHBn6lWy6euNh6g7GLseL0zQEDIrt2sIK1BhKs56rPeQhy+CJpD+gXX32ZvC9Zt0x7qhsGxrpp950hQp7EjKlzfC/0JiWr5OHiGO4HtVxq58U1KwmHjUembZuzmWnqE2sEX7PEel3KGTGmsztq5jTnm5vNXeEkdXLTvUvZlhV1w8Q4B40tp4xQWneVVPctevwGSMnQFyoGAAA=" + } + }, + { + "ID": "a137b434d5f2fa95", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/nART2MNJx5i2y8gFjec6qDD8Idr?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3049c2285afface4ca7cea96277a1ad7/17553072041992958143;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/nART2MNJx5i2y8gFjec6qDD8Idr?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:00 GMT" + ], + "Etag": [ + "Z/I/mbL9iGT1KbhGnP/X3w==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/22QT0/CQBDFv8t4LUEwIjbhAIJYLQTbkhiNh+12KIv7p+xOgw3hu7tFoxdPO/v292bfzBE+hC4ghFyU+xptc1EiPbdFgq6W5PxRGe0QAkBipSdfu1FX5fGtmGe9p3w716vuy9VhNPKE41tUDMIjbATKwkH4dgTNFHpbJhQ6YqryHDXVWYoWszQbL1ZeUqZopeU6jseTeAan4NeZkhW6/LOlWRIt5/953k8B7Eye4AYtao5tksqaHXKK2iGLWnKkTmUsdW4GfTjT5xc9TrL+Yvn4eS36zbC895bBfjodRoX1lDSckTDag+vURwMyxGRiDn5C6MHPfdIQupU1HJ3Dtunl9wd3RlUSyachW2MAnPk1PQiCcMOkw9MXSCwujIQBAAA=" + } + }, + { + "ID": "ce247bf9388656d6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonc0ce8391b3cab3a53382a9f6cbfe4aadb50532bd/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3049c2285afface4ca7cea96277a1ad7/9147956744776953095;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonc0ce8391b3cab3a53382a9f6cbfe4aadb50532bd/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:01 GMT" + ], + "Etag": [ + "G5nt7AgS538pP8cn0rD2SA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8q7m+aVmDumB5saWxQEWCTnGRS5GAU72toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwmbmFqYWJgZmZjqGSjV6kAEE5VqY4EQADYEi+ODAAAA" + } + }, + { + "ID": "0913ddbbff4d4779", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "229" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "952be7a21fcf408bffe22e46d2565b0e/10712132263174841751;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7ImRyeVJ1biI6dHJ1ZSwicXVlcnkiOnsicXVlcnkiOiJTRUxFQ1Qgd29yZCBmcm9tIGBiaWdxdWVyeS1wdWJsaWMtZGF0YS5zYW1wbGVzLnNoYWtlc3BlYXJlYCBMSU1JVCAxMCIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiNzFRVkJ0UVNGb3Vha1l3eDhnU29FbU5tM3hPIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:01 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/NR8l5m3YaaAN0u0XtKuF1_Jthss\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TXXObMBD8Kx71NXaFMRjnqY5NUhpKU4ybfiTjCHHYigFhSSTjyfi/V8JkmmQ6074h7d3eaXd5QltWZegUpWy9a0Ds393zFJ0gUGStb29QSH56FR7NvcvyIoBldlUEUVgCub6Q76PYK5zS/kHINMIN/q4um3Nr9UltpLxBmkRTxZCDgIoCOn1CteD3QFVg5mVNQUH1ay5Uf+wOdXXBKVGMVxpcLtDhBFFe5WzdiO72yfAl+1pToa9LP/6he9qVDdR9oIUf+rOk98hF1ssFL3t3zw/r101aMNrPiCIDScq6ADmQG7IFWQMRcNcLg89B0rOw5s1AKla1gxOSFv+xvaGVcERX1Ms9nOJJanlpjoc55M54RAE72AMHjyB3M2/sukT3KUPfdpGKV07mERcTinHuutRx8rGTTRzHdTBxRxhcJ0tH+RCnrTwCiII5kzWXrBNuFvvTxF8F56vI9+f+XA94FOxt1XUc6KIkXkYzXa1rasG4LjMCBlHix9NZEnwzQCMhhDWh+8WuQKc5KSToyZnYx40mUqIxR6mIaqSRyHwZe+ZfIh91CNNK0hZtFzaKstIUWY7tjq3hEFu2axkluCLF2V6BvBKcgpRgVLFsezgZ2S+9/lfhH/yMFUULGk8poRv4yFT3jhMknrOZtR7rHX+9dvlv0XljdRekV0a+CBU63GoV9NySmM1zBkV2nFORVgQTVNN8jPUiiYPoQp9LnplztAzD6Vmotbzt1IQSKtX9BMeso8Oh9Ums9BCmXUK269qTiW1bI6evE6iwxUs1IcPxZEvtNV2z3Wa3LbyUp5vmQwYPUPAaxGCtOR4YBUIpbyo1oLxEh9+8Aci0IAQAAA==" + } + }, + { + "ID": "4cf26026ffc5fe90", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "266" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0b16c74c789c9ff8e9cef6a43379a2eb/12276307777261051431;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJudW0iLCJ0eXBlIjoiSU5URUdFUiJ9XX0sInRhYmxlUmVmZXJlbmNlIjp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwidGFibGVJZCI6InRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAxNCJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:02 GMT" + ], + "Etag": [ + "ItZEVuVpre90xZIxfzifTw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2QUW+CMBDHv0v3Oi2wDZTEh5kQQ+J8QLYHl8VUOLATKGvL0Bm/+w7UmBiNpmmau/vf/369LVnxIiYuWfD0pwK5edBskQF5JKBZinlfz7yP6qOU0DfWM3+d/PEkrAcDVPCmL66yCHSnFFJ3HNtyY6aZAj23DLNn9E1rbtpOH49tOYZhzPGa3XbEdYX5jOYKsmTMixWOWGpdKpfSuq67qRBpBqzkqhuJnB6p6a9FSym+IdKKniHRA5Kid7DRlk3RexBbTQAJSCgiIO6WHBD8C4tB/WH8vnob5Tih1d/m2eHOoiXkrAFJOGSxIu7nlhQsR7b9g46bsommYeBPRthzqlf5qexPQm/kBWT3ha5YGW40oBsxSBuORZGGIM/TgaiPUSSBaS6KkLfm5suT7ZiWZVi202wC1iWXFwR2D7/T9GdM6TcRc/xHfMXjgBq+Dsde0yGi1hBT71Oy+wdUQAvl2AIAAA==" + } + }, + { + "ID": "68e2975d40e2649b", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "292" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9cb600ce9746530fa00e741fe4781104/13840482191869187767;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiSU5TRVJUIGRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxLnRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAxNCAobmFtZSwgbnVtKVxuXHRcdCAgICAgICAgICAgICAgICBWQUxVRVMgKCdhJywgMSksICgnYicsIDIpLCAoJ2MnLCAzKSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiRE5hQWdpdjRVNTNscEhPZ0U3ZVI5UVZYeUhUIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:03 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/dn8_wGPTwNkMM2v8sFpq5QEdciU\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVTa2viQBT9KzL7oS1Y89I8hGW3bLNWarOtJu4DQSaTazo1mYnJRJHS/7430cI+a0LgMPfce86ZS57JmouEDEnM000N5f7dk4xJl4CiKZ4uyIT+cIXev3Zv89EYouQ+GweTHOjXUaUlwl3uRvfhLljf3Zlbt/pcbAYPfsJ4tCA4hDeDkzpjoC4LWapLxzaH0ax3HdCrlG/70cDKipsvqe/A1HuYf9vfhNhVQbaacLHG3kelimqoabvdrpdKmWZAC171mMy1V7/a1tSKUj4BU2jody0Ns1TaG2ofMsmo4lK8j2aojPQprKAEwYAMn8lx7vgfMQ7stvJ2mlcFJKLGS5cwKVY8rcvj6XMzJ9wXKEgeIn/6HXvaYE3pCMg4mPnTsJNQRStQS1M3XN0zzKVhOx6+tunour7Ez+gpGmfwf4bR75wLmkO3I+r8YiEWaqE6fzzzq0nkzzrnZ/Ss2zEuuohiRGaLGCLrAk0mUCku2hRho3n6wo72D9XTUbCjDdPyT8ZqrrYouSy5OtxY6E+vPoXjuY9z6gomkFK2n20yMlzRrIIX5FeKqrpqjDeo2cA0CoJxMCLHIseIrCWwEg5Red7wjIFlO4Zp6patN9GQXKq/ak7f/HWbrUgOQh3XfdgqaZygwXIJOeVoj1i2bXmeZRn9wWVsuEo3ZK48ajremlkpS/nmcbPO3FjGj/XHBLaQyQLKXooztpwBZUzWQjV/CXn5CU+g0DDgAwAA" + } + }, + { + "ID": "4f5c1124232cb36b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/DNaAgiv4U53lpHOgE7eR9QVXyHT?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "775868119dd56669a8e5ed2a930378fc/15476714204793376327;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/DNaAgiv4U53lpHOgE7eR9QVXyHT?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:04 GMT" + ], + "Etag": [ + "fSrdidPrpeTb6WPyh0gbLg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/0WPQU/DMAyF/4u5dtLEYBOVdhisWiehsXUdICEOaepmGWkTEhdUTf3vuOOwk+O8z8/PZ/jSTQkxFFp9t+i7G4W0Gx4ZhtZQ4OJsExAiQBKKyWrvS11uvcO8mL5tu+NYFc9qPmciyCPWAuIzVBpNGSD+OEMjauSxS4mAOjd0+zxbb1bQR1e9ra/yepMnqySD/rOP4GSLDCv02EgcvJ23J5S0HmKXrZFII2c9jWbTW7jQF2W5EQulf+4O9xPj0heVzDB72L2+d2nOlLFSkLYNg4c9xwCyJMxjRxi23koMAQeT8b/hk62dQeLt5FuMQAo+NNUEcSVM4A8Ov6zNoqo4F5aZ/eXTYQL9H62Ip1pfAQAA" + } + }, + { + "ID": "b199d07119ae9c27", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "374" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "efa13cb3efaa43a27766867175f0c76c/17040889718879586263;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7ImV4dHJhY3QiOnsiZGVzdGluYXRpb25Gb3JtYXQiOiJDU1YiLCJkZXN0aW5hdGlvblVyaXMiOlsiZ3M6Ly9kdWxjZXQtcG9ydC03NjIvYnEtdGVzdC10YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTQuY3N2Il0sInNvdXJjZVRhYmxlIjp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwidGFibGVJZCI6InRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAxNCJ9fX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IlhWZkRSeVhBQ0kxdEhFTjVCcUNQU0lNamt3MSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:05 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/UR_0BPu14mklpxMB-TPrVztVB8k\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAK2TX2/aMBTFv4v32pA4gZAgTVuhHYtGIwQJQ1sn5DgmmPxxsB0oQ3z32Sl9GNu6PUxRJMvn3N+590Y5gZxWKRiAhGa7hvDjmy1LwA0gEmXq9hFM0Bevsrp33qdyHJA4nRZBOCkJ+jwWZjxbWcNpA7tlXtRPD0MjmvLFd7kYevkjUBCqwWlTYCKNmnFp9F17EM87y8X6bnZc3o4CKD/eh73hbjSdBw/b/ABVlSDFekKrXNVupKzFwDQPh0MnYywrCKqp6GBWmi/9mnvbrDnbEiyFeZVlqlmE+Urau4JhJCmr3sZzlazsM7ImnFSYgMEJXLjBb8Z4drfK69O8JCijyjjfAMyqNc0afrk9aU50rFUguF9Gs9tRpNf/JDnCUsuCNRyTCCXFP/SUIokEuajP55VtQc/yob2Cbt9Xj2v3LctaqVf3JzW49benP7thV3efEiFp1fYec6qqMv19rvee7AypjMZfkR0s9uCaKsDg6//gfvsJ/IHxEqmNgtF8Ac5qFCGRbES7YnXS+5/FYRiEY3ARqarFrQFz0jIiWmof7DluH9q21fNsvXVl5vIXzYe+JjWC8BUpES2U6riu4/uOA7s9I4GetCArpY/svp9jJ8MZ3W12eeElLNk071OyJwWrCe9kirGnmCCMWVNJ/QOA8w+fE0hFuwMAAA==" + } + }, + { + "ID": "dc19168fd4a67ad7", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/XVfDRyXACI1tHEN5BqCPSIMjkw1?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "25d94594f6c9bb96cb175e0c654cc0eb/10199948840566619311;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/XVfDRyXACI1tHEN5BqCPSIMjkw1?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:06 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/UR_0BPu14mklpxMB-TPrVztVB8k\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:06 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKi5JLCktVrKqBrNSlayUgkL9/Dz93JVqdcBCmcUlmclgBclFqUBufl5IZi5InaGpsZm5oZGRgamFkZESWHFRCYacpaGlUm0tABW4+RloAAAA" + } + }, + { + "ID": "c30d25d07c4a8ea2", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/XVfDRyXACI1tHEN5BqCPSIMjkw1?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "25d94594f6c9bb96cb175e0c654cc0eb/11764124354669605951;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/XVfDRyXACI1tHEN5BqCPSIMjkw1?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:06 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/UR_0BPu14mklpxMB-TPrVztVB8k\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:06 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKi5JLCktVrKqBrNSlayUgkL9/Dz93JVqdcBCmcUlmclgBclFqUBufl5IZi5InaGpsZm5oZGRgamFkZESWHFRCYacpaGlUm0tABW4+RloAAAA" + } + }, + { + "ID": "b75d3069db1490d1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/XVfDRyXACI1tHEN5BqCPSIMjkw1?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "25d94594f6c9bb96cb175e0c654cc0eb/13400355263787265487;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/XVfDRyXACI1tHEN5BqCPSIMjkw1?alt=json\u0026fields=status%2Cstatistics\u0026location=US\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:08 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/azLPbMdUHVlotP6XBmgQpOUIwtI\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:08 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAGWOMQvCMBSE/8ubRZpoo8mqdqwgOolDSd8QaBNJXkEo+e++ZNTtju+4uxUSDbQkMGtVCAbO1/4CeVO9S+RspTYi2+Dvbi4h0e7UQUjZtEcpoYYj/TEtNDP04y9RSu+Z2DC/Jyy1t1IORmwbzn8oDpbK6oh8wNfhR3Sdm/AUFk/86AkCXjnnL9bh0+XCAAAA" + } + }, + { + "ID": "2a9b045adf95cc13", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "421" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6b92822f0503703936ae7f88fa8e0ce5/14964530782185153887;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUICogRlJPTSBjc3YiLCJ0YWJsZURlZmluaXRpb25zIjp7ImNzdiI6eyJjc3ZPcHRpb25zIjp7InNraXBMZWFkaW5nUm93cyI6IjEifSwic2NoZW1hIjp7ImZpZWxkcyI6W3sibmFtZSI6Im5hbWUiLCJ0eXBlIjoiU1RSSU5HIn0seyJuYW1lIjoibnVtIiwidHlwZSI6IklOVEVHRVIifV19LCJzb3VyY2VGb3JtYXQiOiJDU1YiLCJzb3VyY2VVcmlzIjpbImdzOi8vZHVsY2V0LXBvcnQtNzYyL2JxLXRlc3QtdGFibGVfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDE0LmNzdiJdfX0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiQ1lHVlRGYm1wakpFVHlkdU1jRE9CQ3pFdnpHIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:08 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/kh6oT9wVsgbRzcbCK5Vi8yGFyBo\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta6/aRhD9K1fbb1XAD/ALqWoTMIiGcFtjiNImstbrsdmL7TXeNYh7xX/vrCFNdVtFlT/saubMmXN2xi/kwOuMTEjKi2MH7eWHJ5GSNwQULTD6mazoH35tjmf++2qxhG32W7lcryqgHxfSOOxdEQfnnSzS6Jml0/fOjvuXxfzyTnwmSMI1cdaVDNSgEa0aeK492W6G00+LXTxPq+bp1zC+ZN0HNnt8N30OT88LrJJQ5iteH7B2r1QjJ4ZxPp+HhRBFCbThcshEZXzVa5xso2nFEzAljVe9DPQije90+7kUjCou6p+2G+yM8AhyaKFmQCYv5M67/A8bN3Sf+b6brx0QiD2ubwgTdc6Lrr1HXzRPfGmwIfl9G0afsKY3plP3C9mEq3AaP/z4MI8ePzwweUJQBlLxumeJaVr+D8EZVVTCLZswP/fN1AxSy09z084hd7wxA9MxfXDMMeRu5nuuS7FOafq+itaiTh3foQGjiZmPs2TMPD9Jwc2SgGVmameOa4OtffZVM8h5zbVGqfVp5XhI0bUMti3H4J+k0BN+Pbn0OFBocNCzJLZp+WZg2YnlegF+ru2ZppmYpjUeas4vuDVsDxXV7DmHMtPML6SmlX7X/kBFt1fexNFyvUCJ3/Jd9S29XMfhIozI9QuauCmdi7aiSo96s0Mgdnxs/vYkD7xZAc14XUTijCFiketVD7oFqmDGZSMkv6/ANArfxmGynCfrMJyFM2Q7t/w16mO0RFAcbddTRCOmablA2OUuL3o7jZc7negkrKCg7LI5lmSS01KCbi0VVd1NHd60K+Ra31z3IY67w24j0Sr1DvH+KSxn5HqWbZu+EzikB7fqXznPc/+5pn2TCmp13+PbuhKtBAW2CQ6Gozwyct1REIxG1tgZ4N4p0xKVCqjtBQc2KljBj/vjofRTke67XzI4QSkaaIcFcpw4A8qY6Gqlf39y/Qu75jcluQQAAA==" + } + }, + { + "ID": "0394c949cf38cbd7", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/CYGVTFbmpjJETyduMcDOBCzEvzG?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ec37aea296a94e9be061489da4468c21/16528706296271363823;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/CYGVTFbmpjJETyduMcDOBCzEvzG?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:10 GMT" + ], + "Etag": [ + "LurDmnQQBU+dFvaKJd5/Hw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/21QTU/CQBD9L+PREqNGTZpwsKV8WVFKMTHGw7I7YHG3W3dnIYXw39klJFw8zbzMe/PezB5+q1pADItq9efQtFcrpGloCrROkvWl0bVFiACJrTwzd6an6uk0mV+L/oa9jMXDzXDb7XqG5T+oGMR7WFYohYX4aw81U+hlpxIBtU1As7IYTQYeKy0Cnszz/DnJMzhEF4VTF8FoUmaDrPhP8X2IYK0XBS7RYM0x+DdGr5HTKJwmnORInUYb6jw93sGJfZqkn4OPsr9QzXqcla1wr7z3lqS7bLML0aTmjCpde+J85oMBaWKy0Ft/F9zDGSctoX03mqO1GJbenh1SrRqJ5OOQcRgBZ/47w4ogXjJp8XAEFCOVxXsBAAA=" + } + }, + { + "ID": "29cf78c149245395", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonb585a9ca_0f4d_4c78_be6d_9cd0b2d562e2/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ec37aea296a94e9be061489da4468c21/8123590999072135735;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonb585a9ca_0f4d_4c78_be6d_9cd0b2d562e2/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:10 GMT" + ], + "Etag": [ + "EanIMP5LeWxxkk3DWcREyg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8q7JuZ5+gaY+qSGV1RkZxu7hCcHuVam29oCVZTklyTmBOWXFwOVGQP5RWBmdLVSGpgsAwonKtXqQFiGSrWxIDZCLhkuZ4whlwSXMwLJxdYCAPLaUVWwAAAA" + } + }, + { + "ID": "23e628191fc275f3", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "524" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "44ca1931cfe15a926a49b5a360a01670/9687765417975173831;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJleHRlcm5hbERhdGFDb25maWd1cmF0aW9uIjp7ImNzdk9wdGlvbnMiOnsic2tpcExlYWRpbmdSb3dzIjoiMSJ9LCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJudW0iLCJ0eXBlIjoiSU5URUdFUiJ9XX0sInNvdXJjZUZvcm1hdCI6IkNTViIsInNvdXJjZVVyaXMiOlsiZ3M6Ly9kdWxjZXQtcG9ydC03NjIvYnEtdGVzdC10YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTQuY3N2Il19LCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJudW0iLCJ0eXBlIjoiSU5URUdFUiJ9XX0sInRhYmxlUmVmZXJlbmNlIjp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwidGFibGVJZCI6InRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAxNSJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:11 GMT" + ], + "Etag": [ + "MzLKFaiZ4mCEKK5l5KLmrw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SUW+bMBSF/4v32sSYJdAi9WHLaBWFZhKh07Spihy4oV4AU9uEZVH++64JUaWoVSpkIften/PdI+/JRlQZCchK5C8NqN0nw1cFkCsChud4/vAvmt1x8WtUTsLZbFyMZ1Gp2ttb7BD2XtYUKZhBLZUZ+J4bZNxwDWbpOuzauWHuknn+DX6e6zuOs8TFhp3F+x1sjOIainUkqg1aPBtT64DStm2HuZR5AbwWepjKkp6o6daltZJ/IDWaniHRHknTD7DRjk3TjyB2PTGsQUGVAgn2pEeYvhEM9vf2x+pllJND13+Z54CZpc9QcguyFlBkmgS/96TiJbIdf6i4q+1ukcTT+T3eea035Wt5Ok/C+zAmhydUxcrXnQFUIw7ptpGs8gTU+XEs29MuVcCNkFUiOnE2/uz5zHUZYyPfvq2/tVBvNHjXOI69X3BtHmQmcI7sHY0eNfyZhPH8S9SpGlAVL75hthNZrUXeHE1sIlo2KoVHJWwqJLfv6fydrF4GOI8ZXMp6NEz1ljxd9Zp3UpXcIMpk8cOOrrffa+uqO9uNqCPgmajyPh5GDhhqIdMejTwuyOE/jCUrrocDAAA=" + } + }, + { + "ID": "e37032103644abf5", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "230" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3c798b0825854bbdee6e5ac03d2338cf/11251940932061383511;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUICogRlJPTSBkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMS50YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTUiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IjZ1aHFXMmVuQWJiMzZpeW1xZEdTOEZ2QW1nbSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:11 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/7LQbke9bzkn40ZvQ3B5l0y_PaSM\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVTXW+bMBT9K5X3NrXBfEOkacsSGqGlaUvIqlWVkG0uxA1gAiZRVvW/z9B0D93WCSFZvueec+658IS2vErRGFGe7zpojh8eBUXnCCTJ1e0DWpB7r8LWzPtWzkNYpzdFuFyUQO7mreYubukWfPpzW1n4fn9rfrULfExuyOrqASkS3hOnXcFAXtSikReuY4zXq5HTbXZ3BlQTSk2HH8tdOl95l/tJmZeqq4UiW/Bqq3o3UtbtWNMOh8MoFyIvgNS8HTFRaq9+tb2h1Y14BCZb7Y2WpmZptXfUPheCEclF9Wm9UsoKHkEGDVQM0PgJnXjDv4zxgh4q70/zqqCASuP5HDFRZTzvmtPtU88TH2sliG7XQfRD9QyD9aXTAa2CRTCNzz6eXUbXV2cpkaQFmRhY97CvG4nuuL56HMPFGCfq1UeS0AL+jdBtJZNCK3k1+Ih7+P9HPikP1YR5mYcp9qnu0QwbGWS2azHANvbAxhZkTuq5jkNU3+Bm6CKVqMCm1DJsP3EIyxLL0LOEGpafmIy4aZplRmbRIakGiIQZb2vR8lOG0yiYxEESXibLIJgFM0V+aPhb1F0UKlAcrZdThVaYuuFCwfosw2UcRJNpHH7vC10LC8gJO652BRpnpGjhWUm3ksiu7QPpT/1uFNcyXM7RqchVdGwADC77CHnZ43TbdFzdMHTddC00gBv5R80eFvB7z4NICZU8fQgv+0a9E2WwSaAkXNlDpuOYvm+aumVfqNgl1kUpfWK4/paZOcv5brPbFh4VdNN9SWEPhaihGeWKY88ZEMZEV8n+/0HPvwCfbAFD+gMAAA==" + } + }, + { + "ID": "36788212ea298ea2", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/6uhqW2enAbb36iymqdGS8FvAmgm?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3a962d2bf7d05488e74598ff00f99f2f/12888171841195820007;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/6uhqW2enAbb36iymqdGS8FvAmgm?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:12 GMT" + ], + "Etag": [ + "R8kcpFHO6JPidRqa5MjmGQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/21QwW7CMAz9F+9aDgOtQ5U4wFQKE+sggDhMO6SpKYGkaRt3U4X49yUVEped7Ce/5/fsK1xkmUMEmSzqFpvuqUDa+IahbRVZVypTWoQAkHjhmGx8EdV88Rm+r2XOav7ycdbJZjJxDCtOqDlEVzhKVLmF6OsKJdfoZH0JgLrKo+2OLdPEYW1yj9P9ajWdrWK4BQ9Fqx+CZbqLk5j9p/i+BXA2GcMjNlgK9P5VY84oaOlPy1slkAaVaWjwGg6hZ/eTsD3VhyGW0ywbhbLTdZ5sx/OfqS68szKCkzSlI+63LhiQIa6Y+XV3wQjueNYR2nVjBFqLfunz3eHN6EohuTjUtBiA4O47C0kQHbmyePsDWMjymHsBAAA=" + } + }, + { + "ID": "831124755eb34e24", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anone5bb4259_6acf_421f_b249_3ca7ddff2f4b/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3a962d2bf7d05488e74598ff00f99f2f/4410718583083450159;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anone5bb4259_6acf_421f_b249_3ca7ddff2f4b/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:12 GMT" + ], + "Etag": [ + "m0dlHNtoF+1bdbWSXdhuiQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8rnGqTkePiV5LtpGyalJIUHR6RklGYG2toCVZTklyTmBOWXFwOVGQP5RWBmdLVSGpgsAwonKtXqQFiGSrWxIDZCLhkuZ4whlwSXMwLJxdYCADij6E+wAAAA" + } + }, + { + "ID": "a96f869aae3f5123", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0015?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ee5313dafa57f55c14da8e1516826f0b/6046950591695960255;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0015?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:12 GMT" + ], + "Etag": [ + "MzLKFaiZ4mCEKK5l5KLmrw==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:12 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SUW+bMBSF/4v32sSYJdAi9WHLaBWFZhKh07Spihy4oV4AU9uEZVH++64JUaWoVSpkIften/PdI+/JRlQZCchK5C8NqN0nw1cFkCsChud4/vAvmt1x8WtUTsLZbFyMZ1Gp2ttb7BD2XtYUKZhBLZUZ+J4bZNxwDWbpOuzauWHuknn+DX6e6zuOs8TFhp3F+x1sjOIainUkqg1aPBtT64DStm2HuZR5AbwWepjKkp6o6daltZJ/IDWaniHRHknTD7DRjk3TjyB2PTGsQUGVAgn2pEeYvhEM9vf2x+pllJND13+Z54CZpc9QcguyFlBkmgS/96TiJbIdf6i4q+1ukcTT+T3eea035Wt5Ok/C+zAmhydUxcrXnQFUIw7ptpGs8gTU+XEs29MuVcCNkFUiOnE2/uz5zHUZYyPfvq2/tVBvNHjXOI69X3BtHmQmcI7sHY0eNfyZhPH8S9SpGlAVL75hthNZrUXeHE1sIlo2KoVHJWwqJLfv6fydrF4GOI8ZXMp6NEz1ljxd9Zp3UpXcIMpk8cOOrrffa+uqO9uNqCPgmajyPh5GDhhqIdMejTwuyOE/jCUrrocDAAA=" + } + }, + { + "ID": "779215f35c4c6077", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/dulcet-port-762/o/bq-test-table_20180912_1679797627000_0014.csv?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e3346174fac9ff7c478eea2358b901a9/16016241402998174727;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/dulcet-port-762/o/bq-test-table_20180912_1679797627000_0014.csv?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:13 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq3bi7pahGCBveBW-0-gi_9ZPvIEh5V_0emFpjroUkHBlLKyCC5Y0sRPhUOpG1WDlmtesGyKH4xpmZOo3Dz35iuDdWtfg" + ] + }, + "Body": "" + } + }, + { + "ID": "453f1174fc0272ff", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0014?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "05d399b385907face39188820b2e1f1b/17652472312115834263;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0014?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:14 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "090683d6b520a5ad", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "360" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f0c50be5f29471bac7b8221eb5ae1f47/770185227485979943;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTYifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:14 GMT" + ], + "Etag": [ + "6oz7GnAQpjNGuUN60FbqvQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SX0/CMBTFv0t9VbpN2WSJD6CTkOCQOZ+MIWW7jMK2jrVjIuG7ezsgGP9E0zTLvfece35ptiVLnsfEJVOerCooN2eKTVMg5wQUS7Bvi3enn3fHxcLvV8++bdxPV+vxzQ0quPbFVRqBuihEqS4c23JjppgENbEM89romNbEtJ0OHttyDMOY4DVbTcTvCtPG5RLS2ZDnS4yYK1VIl9K6rluJEEkKrOCyFYmMHqnp2qJFKRYQKUm/INEDkqT/YKMNm6T/QWw0AcyghDwC4m7JAWHww8Og/hC/n/6Nckxo9H/z7PDNojlkTIPMOKSxJO7LluQsQ7b9BzduCl09hcHA76PnNK8yeZoP/NDrewE2MhHrRuA9et3Qu/tsKSE6OQLvdhTcYf09eipEehL2RqOh1/XJ7hXPuc7tbRSggRikKYciT0Iov7YDUR+rqASmuMhD3uw325e2Y1qWeWW12/rPfSt4+YPAvsbH0v6USfUgYo6o8S87DrBhtzf0tENEzUJsPT+R3Qd/5H6qNgMAAA==" + } + }, + { + "ID": "da49f60e4cc2ab52", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0016/insertAll?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "105" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b3b8ceffbbfb1aee6012217b20ffb804/2334360745867091639;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0016/insertAll?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJyb3dzIjpbeyJpbnNlcnRJZCI6Ims3Zzc5V3ZrT3Rqc2hnM01najN6VGNoc21rdiIsImpzb24iOnsibmFtZSI6bnVsbCwibnVtcyI6W10sInJlYyI6eyJib29sIjpudWxsfX19XX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:14 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTMK04tKnHMyQlKLS7IB3KUagGmFzWCLgAAAA==" + } + }, + { + "ID": "b3a0024cc5ec8592", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0016/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "eaf27dbd4c8cb28a4118791dde166504/12375708047400704767;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0016/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:14 GMT" + ], + "Etag": [ + "RaUmEwNufD/hz5bmhot8yA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8oHJYbmupb7laa56GdUmSblZuSXWFQ62toCVZTklyTmBOWXFwOVGQD5RWBmdLVSGpgsU7LKK83JqdUBM6NjoQx06dhaIIqtBQBRX9PikQAAAA==" + } + }, + { + "ID": "3826e22588adc16d", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0016?alt=json\u0026fields=schema\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "aeb62bbbd6fd52724af6b373d30bb31a/3898535160475227719;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0016?alt=json\u0026fields=schema\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:14 GMT" + ], + "Etag": [ + "6oz7GnAQpjNGuUN60FbqvQ==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:14 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKtWKk7OSM1NVLKqVkrLTM1JKVayiq5WykvMTVWyglA6SiWVBSBecEiQp5+7Uq0OQr40txgh7+kX4uruGgQUyM1PAQkEuQa4Ooa4uiBrKUpNRugIcnX2D3IB8jGtTsrPz0EodPL393F19FOqjQXCWgCN1fK3tQAAAA==" + } + }, + { + "ID": "fd83e06e958a29fe", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "296" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ffc39c7e96ef88885aa5cf85fee15cc6/5534767169104514775;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7ImRlZmF1bHREYXRhc2V0Ijp7ImRhdGFzZXRJZCI6ImRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn0sInF1ZXJ5Ijoic2VsZWN0IG5hbWUgZnJvbSB0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTYiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6Ik5pWXVMZXBBekpPaGpLblh1djExTlNPSTlmcyIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:15 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/wOunfEE2V2-j71EPReoh36100x0\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVTW2+bMBT+K5X32gSbO5GmrUpYxRrRLpd2nSohYw7ECeAETLKuyn+fTVOp6rZOvFg+3/ku55gntOF1hkYo5cWug+bxw1qk6ByBpIW6fUBT+sOvsT3xr6rLCJbZTRnF0wro3WVrHK67Og9D89YcrD0S3sxArCyXYPwTPyBFwjVx1pUM5GArGjnwXHO0nA9jft9NYXvx6+v1an1Vf+/2hMTz6yjIW9XVQplPeb1RvSspt+3IMA6Hw7AQoiiBbnk7ZKIyXvwae9PYNmINTLbGGy1DZWmNd9Q+lYJRyUX9cTlXygo+gxwaqBmg0RM68UZ/ifGM7ivvp3lRUEClcTxHTNQ5L7rmdPukeRaPWyWIvi3D2b3q6YPp0umgR6J8nNW0grO8EdWZpGkJiYmJjwNiJsT1AvW5pocxTjAmrmLJoJW87mUWGv7/RBmVtIXnasL83McpDlLipzk2c8gdz2aAHeyDg23I3cz3XJeqvt5N30VrUdsZpKqDJTahTmJ7YCVpYEPi0Nx3qe07WZr2g2iASpjwditafhrReBZeLMIk+pLEYTgJJ4r80PC3qLtZpECL2TIeK3QfNaddKSfP/nXQ11FO53+PCxPF8d5ojrrMhXKitxHFi3B2MV5Et1q7a2EKBWWP812JRjktWzgqfCup7FptRZ/0dpXdOIov0anI1XZYD+gHobfEK40jjuV6xDSJg4mHenAj/6gRx3n9UnqRCmp5ekrzcBqOF0g7UQabBCrKlT1kua4VBJZFbGegNisxEZUMqOkFG2YVrOC71W5T+qlIV93nDPZQii00w0Jx7DkDypjoaqn/QHT8DXRHL/E8BAAA" + } + }, + { + "ID": "3d87866bee23faa0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/NiYuLepAzJOhjKnXuv11NSOI9fs?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "36799562027429e4fe7095554a42be54/7098942683190724455;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/NiYuLepAzJOhjKnXuv11NSOI9fs?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:16 GMT" + ], + "Etag": [ + "gZnFGG05VYJRE1Fsczo0ZA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PQU+DQBCF/8t4pQmYqJGkB2papBKq1Da2xsN2GSi47K7soKGE/+6CnmZe5pt5b3r4LGUGPpzK4qvFprsqkF7GJkXTCjK2aCUNggNIrLBkcZSrMHRv9od1uvRWhl+Uewzmc0sYfsaagd9DXqLIDPjvPUhWo12bigPU6VFtX9MoCa2uVTbqZBfHwSJewvAxOFCpU4o5Nig5jtd0oyrkFI1Bs1ZwpJlWDc3ubq9hoqdJUh7aGHVwWW/O1ZN8a789L9luovvcWEoozqhU0oK7LVgTUsREqn5sSvDgXy86QvPcKI7G4HjU/TN4ULUWSDYNNS06wJl99bEk8HMmDA6/QeAgSkgBAAA=" + } + }, + { + "ID": "72706e31f9e8b9d5", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon4debbf0c_41a5_47e3_b94e_5af86a485dbb/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "36799562027429e4fe7095554a42be54/17140289989019239343;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon4debbf0c_41a5_47e3_b94e_5af86a485dbb/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:16 GMT" + ], + "Etag": [ + "rt92sU6r8BvpiT27bpLikQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8oXlVgaFYeaFVk4lRVkhhiZJxX4ZGYH2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsU7LKK83JqY0FQgDF6uTpbwAAAA==" + } + }, + { + "ID": "0eb9fd1da8580667", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0016?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6356051d6dbc89d1c09b0698ccd6fd28/258001804877823038;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0016?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:16 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "15d19c4358f1b16e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "213" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "da3146d26ff286106643574cb5631198/1822177318980809934;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0IHdvcmQgZnJvbSBbYmlncXVlcnktcHVibGljLWRhdGE6c2FtcGxlcy5zaGFrZXNwZWFyZV0gbGltaXQgMSIsInVzZUxlZ2FjeVNxbCI6dHJ1ZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJvOHdnQ1JOd2QySEhWZU15OVN1bVdhcGxXNGQiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:16 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/XLMiNp1azyF0mqH-085-w_D1wog\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2vbMBT9K0H72sTPOHZgbCVxW7PUbHk0e3QESb521diWI8k1Wel/n+SmMLpR9sUInXPPuecIP6I9qzM0RYQVhxbE8d09J+gMgcKFvr1FC/w9rG1/Hn6qLhPYZJ/LJF1UgLeX0vq6uGZp4+Bfxwu7OlwN7XA87HZzp+PFLdIizAhnbUlBDRsu1HASuNPNasTDrpgt0y5zr65u4PoYrdpqi5ty62d6SkKZL1i917N3SjVyalld140KzosScMPkiPLKetnXenCtRvB7oEpar7wsnUVab7h9KDnFivH6/WalnTV9CTkIqCmg6SM66Sb/iPHM7pG307w4aKL2eDpDlNc5K1pxun00Outjow3Rl028/KZn+mAGOh1MJXqPQcdFNsgFrwY/XuIPm5aUjA4zrPBU4qopQY7kHd6DbAAL+DkoWcXUwNGyGUjF6t53jUn5HxGNqoRndEfDPLSJHREnJLnt5pCPJz4Fe2yHMLZ9yIMsnAQB1nPKyPdTuOa14xNCbD8AF4Ofe3gcEdclNNKfwPdI7oZulgH1+nYEYAVzJhsu2am32TI+X8e75GKXxvE8nmuDTrDXrO0y0aT1cpPONFtzGsG4ppn+knQdL89n6+TGAK2EBRSYHleHEk2VaOFJO0uFVStNJ+ZknkNLpUl6iU4g0+3RntAvaVpkleE5Yy+YOK7rBBPPRj1ZqL+w0HP/fNrepIJand5+FS/i2RqZTfR+YgcVZno75AWBF0We5/jjoW5e2Q6vVITdSbSnXkELdrg77MuQcHLXfszgAUregBgVWuOBUcCU8rZW5pdBT78BfkmBYu0DAAA=" + } + }, + { + "ID": "f8bcb74c607f9fd1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/o8wgCRNwd2HHVeMy9SumWaplW4d?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7e2fb13ee392e829c990597e7caa9a96/3458409331888221534;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/o8wgCRNwd2HHVeMy9SumWaplW4d?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:17 GMT" + ], + "Etag": [ + "YWl+C83epwapb7YwQhL6TQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2Py27CQAxF/8VdNiwgiEckFiWqClKKmoSHUNXFMDEhdBJPZxxFEeLfO0O7sq987Ht9g++qKSCCU1X+tGj6pxI59U2GtlVsXdHUWIQAkEXpyONBPcezEHUn9Gl67NJLMtmmi4UjrLxgLSC6wblCVViIPm/QiBrdWkemcAj32qt8m603b07XVHi92SXJyzJ5hfvXPYArnTI8o8FGor+mDV1R8toHLVolkQeaDA+mkxE86MeEZl0ZZ5uuGK1We3zv53lbH4RWh7E3ViQFV9Q4cJeDM2FioTLqXEoYwr9e9oz2w5BEa9EfHYbhaD4O/2xiqrVCdpnYtBiAFO7hVcUQnYWyeP8F9qvgGU4BAAA=" + } + }, + { + "ID": "775419735b9d9d73", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "214" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9625f9e0a0d491f2c4da8285d890d864/5022583746496357870;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0IHdvcmQgZnJvbSBbYmlncXVlcnktcHVibGljLWRhdGE6c2FtcGxlcy5zaGFrZXNwZWFyZV0gbGltaXQgMSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiWFdwSGF3aE9PUW9SYWs4VElWMW9yMmppY21ZIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:17 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/xNTOCvvXzEJMcuiBCAU43gPq0Hk\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAN1T7U7bMBR9Fcv7SxPSQD8iTRuDCrp1LfRjsLXVcJybxNSxU9tp6VDffXZWNG1DPMCk/LDuOffcc+ybJ7xiIsERjlm2rkDt3jzIGB9hMCSz1QUekG8dcXxy0flUXPZhllzz/nBQALm91P7jcDo632zufvQ+fqYV+3B+NjsJs+v18dVqga0Ic8JJxSmYRimVabRbzWg28e5uyyuyzUejGzkmq860/yWQqvnAaPHVdmng6YCJle3NjSl15Pvb7dbLpMw4kJJpj8rCf/brb5p+qeQDUKP9v2b5Nov2X5n2jktKDJPi7WxiJ1v6GFJQICjg6AkfdPsvxPjFrpHX0zxPsEQ7Y3+EqRQpyyp1qD45nemutAPxzaw3dj11MAcdDu5KrA+0lSpBqZIFmj/Hb5RVzBltJMSQSJOi5KA9nZMV6BKIgiXirGAGBVa2VEwqZpxgfzjtjc/OrdeeBSoNA8gI3U3WHEcp4Rr21qk2xFTa+XAnZ/BiNHR8UEqqMeiKG4cqILoOyMSGcJbc1K7/iL4+lArQmmROarIThjyiWipCMwGPpY0ICVrg+QIjYtA8iILO0kP9FJmcaWQ/ggyJOSCWgDAsZaCOEGhKSrAUQIIUgLbM5Oje1r3MQ/c133PAPbJXnoOyTCLQ/Dew9Nyz1EZs2Pl/kWd5eD6mDaP1E1KbypmfssLZDU7DVjtoNoN2O2zhmqzMv1jL7Q2I5EVkX2+O+g4FYXZvcNhqhd1uGAYnp4046JjjQBamS5rt7oqGGc3YOl+veCeWcV69T2ADXJagvMxqbBgFQqmshHF/N97/BBGU0rmYBAAA" + } + }, + { + "ID": "b8467cf5424675a6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/XWpHawhOOQoRak8TIV1or2jicmY?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "68f00977cf36f4019058888427b39293/6586759260582567550;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/XWpHawhOOQoRak8TIV1or2jicmY?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:18 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/9WQzWrDMBCE736KRecgEuih+BZoKYY00J/04ph6Y20cgS250qZNCH73SoqheYWCQMzMp2W0lwxAkHPWiRwuQQTZWEVB3c3ns6vRk/fYRk+8nQ3jCdKLHDaGTgM1TAq2otwKQIZykS/uKwnFHvigPYSDwLjrCLQiw3qvyc2AfIMDBYTAYE/wo/kAdfBlK6FOvIxBDQ4D5AKJBsq/oJJiqpfK+NCuTBqmf/yD6qmisj1qExu2nd1hd5s5Qm9Tps03dlq9HMmdb4nONsj6ygzownQm5+WXmJAx3dW0Ks/Ix7gqUaw/lqvi4XP5+rR5fly/R37MxuwX442FphECAAA=" + } + }, + { + "ID": "f4ea12b0833e696a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "214" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b81c9ba6a9f4b21bb2c56eff9433be9b/8150934778980455950;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0IHdvcmQgZnJvbSBbYmlncXVlcnktcHVibGljLWRhdGE6c2FtcGxlcy5zaGFrZXNwZWFyZV0gbGltaXQgMSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiV1UxbFZ1dDVKTXh5WXdrTlB3Q2x5OFdZakJjIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:18 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/31YezV_bOQU2z4nF-5XoA8DsMIc\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAN1T0W7aMBT9Fct7LUlDCg2Rpq1ru4mN0hZIOwaodZxLcHHsYDtQWvHvszOqaVvVD5iUB+uec889x755xksmMhzjlOWrCtT23YNM8QEGQ3JbneIe+RGJw6Oz6FvxpQtJdsW7/V4B5PaL9sNgDE83d+nlddJ8OhKfG63v8iQ60xddOsVWhDnhrOIUTKOUyjSO2804GXq3ScBvKtP6evG4HW+W/avNKd9Gt+OHT9R2aeDzHhNL27swptSx7282Gy+XMudASqY9Kgv/xa+/bvqlkg9Ajfb/muXbLNp/Y9oHLikxTIr3ydBOtvQBzEGBoIDjZ7zX7b4S4xe7Rt5O8zLBEu2M3QGmUsxZXql99dnpjLalHYivk/PB2PbUwRy0P7grsT7QRqoMzZUs0OQlfqOsUs5oIyOGxJoUJQft6QVZgi6BKJghzgpmUGBlS8WkYsYJdvuj88HJ6ah7c26BSkMPckK3wxXH8ZxwDTvrVBtiKu18uJMzeHbZd3xQSqoB6Iobhyogug7IxJpwll3Xrv+IvtqXCtCa5E5quBWGPKJaKkaJgMfSRoQMTfFkihExaBLEQTTzUHeOzIJpZD+CDEk5IJaBMGzOQB0g0JSUYCmABCkAbZhZoHtb93IP3dd8zwH3yF75ApRlEoEmv4GZ556lNmLDTv6LPLP98zFtGK2fkNpUzvyIFc5u0Arbx0GzGUTNqI1rsjL/YGHgFh1E9iqyqzdH3UFBmN0bHLbbYacThsFRq5EGkTkMZGE6pHncWdIwpzlbLVZLHqUyXVQfM1gDlyUoL7caa0aBUCorYdzfjXc/Aeoo4Z6YBAAA" + } + }, + { + "ID": "0f83b3f78836957b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/WU1lVut5JMxyYwkNPwCly8WYjBc?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7bebdb93a069147050ed889215cb957a/9787165688114892446;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/WU1lVut5JMxyYwkNPwCly8WYjBc?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:18 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/9WQzWrDMBCE736KRecgEuih+BZoKYY00J/04ph6Y20cgS250qZNCH73SoqheYWCQMzMp2W0lwxAkHPWiRwuQQTZWEVB3c3ns6vRk/fYRk+8nQ3jCdKLHDaGTgM1TAq2otwKQIZykS/uKwnFHvigPYSDwLjrCLQiw3qvyc2AfIMDBYTAYE/wo/kAdfBlK6FOvIxBDQ4D5AKJBsq/oJJiqpfK+NCuTBqmf/yD6qmisj1qExu2nd1hd5s5Qm9Tps03dlq9HMmdb4nONsj6ygzownQm5+WXmJAx3dW0Ks/Ix7gqUaw/lqvi4XP5+rR5fly/R37MxuwX442FphECAAA=" + } + }, + { + "ID": "3c467de0598a7e3a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "213" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "33a3571aee83b2c22bc0d99ccbf788e5/2945944438615032694;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0IHdvcmQgZnJvbSBgYmlncXVlcnktcHVibGljLWRhdGEuc2FtcGxlcy5zaGFrZXNwZWFyZWAgbGltaXQgMSIsInVzZUxlZ2FjeVNxbCI6dHJ1ZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJKdjJ6WmpQbVJpdGoxSER0N0szSlNFMDE1c1IiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:18 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/W0hW9-lTqBlLEPxcadSygweHJEM\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAO1S627aMBh9lcj7s0lNQpIWSKRpt6KWlnaUy6r1otVxPoLBsYPtwBji3WenIK0b6hPsn/VdznfO8dmgOeUZSlBK80UFcv1mJlJ0hEDj3FQfUA/ftXnj+LR9WZx1YZz1Wfe6VwC+PVP+bWN6G7tstPjMep3+T4Kz4TpfwflF5+oBGRBqgbOKEdBuKaR2W80wGQ+9i2X4627WLwZUz4LzU926jC6GnUZwogZmSwGb9Cifm92p1qVKfH+1Wnm5EDkDXFLlEVH4e77+MvRLKWZAtPL/uuUbLcp/5doHJgjWVPD346G5bMYHMAEJnABKNmiH2z0g43m67ryuZn/BDJob2yNEBJ/QvJK76sbijNalOYhuxp3Bd7NTC7Ot3cNaYng4KyEzZyJF4Tzt5btllTJK3Axr7ClclAyUp6Z4DqoELOHJYbSg2gkMbCmpkFRbwO71qDP49GXU/dYxjUpBD3JM1sMFQ4mWFWwNUaWxrpSlYV+W3+nXazsOUgo5AFUxbbsSsKr1Ub7EzPz5C9EHmSaHmJq9ApTCuT3VfcZyNE4ZOBwXkBwWfRDqgd+P5NqpFOW5Y9jzDBvnhjc95+0+UoSJKtuF6mWgMkGUL/c58PfrrlowH7jhY0DdP6vvHj37sbUtxq/7/5Y8W/K4CxFVmpI6SMQYY00Y0cIqCk6iZisIw6AdN45RPSz1v70wtqHj2cHOto6v/AEFpia8KGo2oziOouD4xE2Dtm4EotAxDlvxnEQ5yeliupizdirSafUxgyUwUYL0coOxpAQwIaLi2spH29+WgAqXHQUAAA==" + } + }, + { + "ID": "7258db3d41f3e446", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/Jv2zZjPmRitj1HDt7K3JSE015sR?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "309877ab5a6bef18efc169f339190369/4510118853206391814;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/Jv2zZjPmRitj1HDt7K3JSE015sR?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:19 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/92QzWrDMBCE734K4VMLtZVDT74FWkogDbRNe0lDs5a2iqh+HK1cCMHvXllxIM/Q0zIz2kHfngrGSgzBh7JhpySSFF5iUvez2d3ZsEgEavTKhfsFoyWL0BpkDiw2bNdqdegxHKuub40WlYQIDYHtDFJNe/hB6hAC7j7dZh2OrCftFKMITkKQ7O1lyW72MXbUcC6M72WtvFcGa+Etv5Rz6QXxgN8Y0Ankl/WKDoajS/9JpdW1e7uty4kgE1IC2GTNJtT/QZcppLeg3QihjG/BXGcBgXzO9BmwnLIhz+10pNQee8p3WH3Ml4uHr/nr0/vz42o9vh+KofgDBW7y0y4CAAA=" + } + }, + { + "ID": "023fa9f1941efee2", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "214" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6d45b40b450ffd6a0784ba7351a460dc/6074294367309378710;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0IHdvcmQgZnJvbSBgYmlncXVlcnktcHVibGljLWRhdGEuc2FtcGxlcy5zaGFrZXNwZWFyZWAgbGltaXQgMSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiMU1FUHBLdEV6dTNha1V2eEllZmhJYzFHYmhZIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:19 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/Hs8iL-nuIwWSeKmihHcgQn3qXr0\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TW2/aMBT+K8h7LeR+Q5q2CjIalaIWwrpNlajjnASXJA62A+uq/vfZKZWmbqr2Zvl857tZfkI72uRojDJa7jvgjx8eWIbOEEhcqts7NMc/wsZ0p+FlPUtgnV9XyWJeA76dCeNChHQ+bLrkeLuCy5puL0h50zj7b9y8Q4qEauK8qwjIYcu4HAa+PV6vRtZVfN1eyvhX5+Dd+vAzgWKbEGuWbb+rLQFVMafNTu1upWzF2DCOx+OoZKysALdUjAirjVe/xsE2Ws4egEhhvNEyVBZhvKP2qWIES8qaj+uVUlbwJRTAoSGAxk/oxJv8I8YLup+8n+ZVQQGVxvMZIqwpaNnx0+2T5kkfWyWIbtbxUu/0wfTodNCVKB+DI+P5oOCsHty/xh+2XVZRMsyxxCOB67YCMRJbvAPRAuZwP6hoTeXAUrQ5CEmbXjfFWfUfETWrgJfphoRFaGZmlFlhVph2AYUXuARMzwzBM10o/DwMfB+rPanp+y3csMYEP7NN18+DwnW8ws4icALILXAy0zJtO3DCwHWDom+HA5YwpaJlgp56myzj8zTeJF82iziexlMlcOT0Lep2mShQulwvJgqtMC2nTMF0f8kijZfnkzT5qgedgDmUmDyu9hUaF7gS8KykhcSyE7oUfdLvobgWyWKGTkOq6iM9oHepa6S1xlme4weWbVuRa3moB3P518yz7T/fthepoZGnx1/F83iSIu1EGeQbqDFV9pDj+04UOY7lekNVvTQtVssI20G0I05JSrrf7ndVmLFs233O4QAVa4GPSsVxoAQwIaxrpP4z6Pk3r73TvO4DAAA=" + } + }, + { + "ID": "31d20df69d1a0f01", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/1MEPpKtEzu3akUvxIefhIc1GbhY?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d10cd8b8356b67c389d47beca29f5016/7638469881395588390;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/1MEPpKtEzu3akUvxIefhIc1GbhY?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:20 GMT" + ], + "Etag": [ + "Q8wlAlr+gyk/qvSOA9M7Nw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PT2+CQBDFv8v0WE2jNLWSeMCGWFK1CuXQND0sy/BHFhZ3ByklfncX2tPMy/zem5keiryKwYYoT88Nqu4uRToOjY+6EaRNqWWlESaAxFJDHp9b4Qh1n3bFw/kSvDvL3WLfrlaG0DzDkoHdQ5KjiDXYXz1UrERja6WKDUJdPajgw/f2G6NLGQ96H263znrrwvX7OoGTjHxMUGHFcUirlTwhJ284NG4ER5rWUtF08TSHkR4ns517qN/I/W0sVoSXHw+TzOOzTZR9GkpIziiXlQHDAMwSksSEL1s9WOFfrztCfVCSo9Y4hlrWfPlo/a15kWUtkMxNpBqcAGfm4decwE6Y0Hi9AS8IpxVOAQAA" + } + }, + { + "ID": "a9b6728427c56b81", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "214" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "665e360e6fd26801bf8c3168842de20f/9274700794824926646;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0IHdvcmQgZnJvbSBgYmlncXVlcnktcHVibGljLWRhdGEuc2FtcGxlcy5zaGFrZXNwZWFyZWAgbGltaXQgMSIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiQnhJeWx3eHB2WVlJOE9YdkVaYkJMbnV6RWdrIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:20 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/YmV1zYvvdw3jgFIOe07WQfP7Xic\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TW0/bMBT+K5X3Shvn0iStNG3QBhStKtALUIRUHOckNU3iNHZSCuK/zw5FmtiE9mb5fOe7WX5FW1bEaIgilu5qqA7fnniEThBIkqrbBzQh936BnbH/K78IYRlfZeF0kgO5vRDGKr8xX1ZNE+/tp/Q8vATs3V4nV94dow9IkTBNHNcZBdkteSW7nmsNl/Pe2XN4yPbPZbNahf7lXRPcR2eTon4J0q3aEpAlE1Zs1e5GylIMDWO/3/dSztMMSMlEj/Lc+PBrNJZRVvwJqBTGJy1DZRHGF2o/Mk6JZLz4vpwrZQWfQQIVFBTQ8BUdecN/xHhHt5Ov03woKKDSeDtBlBcJS+vqePuqeRaHUgmi62UwW6mdNpgeHQ+6EuWjs+dV3EkqnnceP+J3yzrKGO3GRJKeIHmZgeiJDdmCKIFU8NjJWM5kx1S0MQjJilZ3QaLsPyJqVgHv0zX1Ex9HeBCZfpRgK4Gk7zkUcB/70McOJG7se65L1J7U9O0WKXiBwY0s7Lixlzh2P7GiAdgexCbYETaxZXm27zmOl7TtVEAkjJkouWDH3kaz4HQRrMPz9TQIxsFYCewr9hl1OwsVaDFbTkcKrTBlxbiC6f7C6SKYnY4W4Y0e1AImkBJ6mO8yNExIJuBNSQtJZC10Kfqk30NxTcPpBToOmaqPtoDWpa6R5Rpn9m3XMy3Lwr7poRZcyb9mA2z9+batSA6FPD7+PJgEowXSTpTBag05Ycoesl3XHgxs23T6XVW9xCbP5YBY3mBL7ZSmbLfZbTM/4tGm/hlDAxkvoeqliqNhFAilvC6k/jPo7Te1viMo7gMAAA==" + } + }, + { + "ID": "c5bd5ebb96aa927d", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/BxIylwxpvYYI8OXvEZbBLnuzEgk?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f7c6ba6976b450f6236b8a300ae862a7/10838876308911136326;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/BxIylwxpvYYI8OXvEZbBLnuzEgk?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:21 GMT" + ], + "Etag": [ + "2kXaAJI11mlHQ57JvCTuGw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PUW+CMBDHv8vtVZNhsrmQ+CCGKIa4iZrolj2UcjKktKw9QEb47hbdU++X+/Xufx3kmUzAhThLfyvU7VOKtB2KCE0lyNinVNIgjACJpdac5Ec2XweOU4jV9mW6rhf7atnMZtYw/AcLBm4H5wxFYsD96kCyAu23RunEKtSWA+32UbBZWi5UMvDmEIZzL/Sh/+5HcFFxhGfUKDkO00qtLsgpGIImleBI41JpGk9fJ3C37x3vGrSiuZb16RS8vR9r/zP2Qln9+WluLaE4o0xJKx52YJeQIiYi1diU4MA/ey2h+dCKozE4DH1+LFioohRINg3pCkfAmT11ldGD+xt5cGxpRwEAAA==" + } + }, + { + "ID": "3cfffc230c90c523", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "360" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "23354b91a6cc2048c171664bb1a34615/3997935430614946334;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im1vZGUiOiJSRVBFQVRFRCIsIm5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifSx7ImZpZWxkcyI6W3sibmFtZSI6ImJvb2wiLCJ0eXBlIjoiQk9PTEVBTiJ9XSwibmFtZSI6InJlYyIsInR5cGUiOiJSRUNPUkQifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTcifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:21 GMT" + ], + "Etag": [ + "782tfXljAlYhYkNUnBzK+w==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Rb0/CMBDGv0t9qdCt6oZLfAGyGCKCGTORGEPKdoxKt861OJHw3b0NCMY/0TTNcnfPc88v3ZosRBYTj0xF8rKEYnVk+FQCOSFgeIJ9t8XM7EE+t+V4Pl4M7rPO+81xeXmJClH54qWMwDRyVZiG6zAv5oZrMBNm2S3rwmYT23Ev8DjMtSxrgtdu1hG/K2wXl2uQs77IFhgxNybXHqVlWTYTpRIJPBe6GamU7qnpK6N5oZ4hMpp+QaI7JE3/wUZrNk3/g1hrAphBAVkExFuTHULvh4dB/S5+O/0bZZ9Q6//m2eCbRXNIeQUyEyBjTbzHNcl4imzbD25c5VU1CoPe4Bo9h/ky1Yd5bxD6136AjVTFVSPw7/x26Hc/WwqIDo7AvxoGXay/R0+VkgdhZzjs++0B2TzhOalyOysDaCAWqcu+ypIQiq/tQJX7KiqAG6GyUNT77fNTx7UZY/aZW/0XeMtF8YPAaeFjVX7JtblVsUDU+JcdO9iw3en7lUNF9UJs3Y/I5gODAaFeNgMAAA==" + } + }, + { + "ID": "0967dc2b7f67c4c9", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "221" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "cfa2c3679803ffb05afe9200964df9b1/5562110944701156270;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X3ZpZXdfMCJ9LCJ2aWV3Ijp7InF1ZXJ5IjoiU0VMRUNUIHdvcmQgZnJvbSBbYmlncXVlcnktcHVibGljLWRhdGE6c2FtcGxlcy5zaGFrZXNwZWFyZV0iLCJ1c2VMZWdhY3lTcWwiOnRydWV9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:21 GMT" + ], + "Etag": [ + "0JrMjzAGe5joXnrlJbcSDg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1RW0vDMBT+KyO+uqWtuEvBB3VFJlOwmxeQUbL0rMuWNjVJLXPsv3tSNxFRlJCH75yT75KzJWtRpCQkc5G9VKA3R5bNJZBjApZlWPeu9c3q7fwKTlfqqdDyes4nw+zsDCeEe5dWkoNtl0rbdq8bhCmzzIBNAs/vewM/SPxub4CnG/Q8z0vw+h2bvAqoEw85DMjFWBRrZFpaW5qQ0rquO5lSmQRWCtPhKqcHc/Q1oKVWK+DW0G/KdK9s6D8s0CaloV+cNJUYFqCh4EDCLdkrjX6IifN7lY/u34oHhWb+U3aHP8CXkDOntxAgU0PC5y0pWI4WSK106h5uSocm03h0e4U4V6nDcXR3P4qjIdnNkKeo8ouNBeN2Rho4VkU2Bf29HKv6gLgGZoUqpqKR809Puj0/CAK/7/exLZmxNyoVaCz9ZWRv7WEUPSJyqVySZlnOcTSOLqctF6O10CpvPR822S6ruRS87X4uNCwvcRsds2RrMCUwDTNkqwyMIWN8M3mRJLS6AowpFW8sI/v9hOzeAdigPRzAAgAA" + } + }, + { + "ID": "554cf7cc44337d68", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_0?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b9d14feeed84c5157fe01c62e56789c1/7198342953330443070;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_0?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:22 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "dada705b48c0ce01", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "222" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9ba407d5f4819da4303e343e735724bd/8762517372216704206;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X3ZpZXdfMSJ9LCJ2aWV3Ijp7InF1ZXJ5IjoiU0VMRUNUIHdvcmQgZnJvbSBbYmlncXVlcnktcHVibGljLWRhdGE6c2FtcGxlcy5zaGFrZXNwZWFyZV0iLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0K" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:22 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:22 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAM2PwWrDMAyGX0XoHEwLOwy/QY+j3SkNRI3VVODYme2tDSHvPiU9dI8w0EF8/4fQPyOnFBPa+blktPWMLg4kAS32Pl7IY4WJKceVSPghL+7jm9OkfOCcqWcNjlMo9IDtioXPwI+Ru8IOzlifEahAvbf798bA4QrlJhl0CApdPIM4DkWuwqkCzh2NrApDoIHhLuUGrXLTG2g336xBC4lUSmpSgPoVNEYf87GjIjGcpnH9Lq7mH6zoa6uwNBV20anzttv92z7L8guRf3+WqQEAAA==" + } + }, + { + "ID": "0bfff11c217617ae", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "af4d09f15c927ae0686145599607d01b/10326692886319690846;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:22 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:22 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAALXNQQqDMBAF0KvIrLUkQbTmAF121V0pYTRTEaJTkrFdiHdvpGcow4fPW/zZgGLkCHb7lQT2voHnGacFLIyBewxQQiRMfMjCcuF18dlmSglHynhlKZ6H2uKGfaDCr2EgqV4cpWobYz0KJhJnlD6rThunm7bL15hWKeVy9Ence6KP07A/ShjY5+Fa1X98s38Bi7Csr/0AAAA=" + } + }, + { + "ID": "c9693635cab45831", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "222" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "870ab24ba63aa7e142f9f1c55858e53a/11890868400405900782;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X3ZpZXdfMiJ9LCJ2aWV3Ijp7InF1ZXJ5IjoiU0VMRUNUIHdvcmQgZnJvbSBbYmlncXVlcnktcHVibGljLWRhdGE6c2FtcGxlcy5zaGFrZXNwZWFyZV0iLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0K" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:22 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:22 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAM2PwWrDMAyGX0XoHEwLOwy/QY+j3SkNRI3VVODYme2tDSHvPiU9dI8w0EF8/4fQPyOnFBPa+blktPWMLg4kAS32Pl7IY4WJKceVSPghL+7jm9OkfOCcqWcNjlMo9IDtioXPwI+Ru8IOzlifEahAvbf798bA4QrlJhl0CApdPIM4DkWuwqkCzh2NrApDoIHhLuUGrXLTG2g336xBC4lUSmpSgPoVNEYf87GjIjGcpnH9Lq7mH6zoa6uwNBV20anzttv92z7L8guRf3+WqQEAAA==" + } + }, + { + "ID": "e26ef9bbf848cfd4", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a2729d74bcb15e7d8a5cfd282a1b5046/13527099309540337022;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:23 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:23 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAALXNQQqDMBAF0KvIrLUkQbTmAF121V0pYTRTEaJTkrFdiHdvpGcow4fPW/zZgGLkCHb7lQT2voHnGacFLIyBewxQQiRMfMjCcuF18dlmSglHynhlKZ6H2uKGfaDCr2EgqV4cpWobYz0KJhJnlD6rThunm7bL15hWKeVy9Ence6KPM7A/ShjY5+Fa1X98s38BKwEyd/0AAAA=" + } + }, + { + "ID": "1e67800a6b2326c4", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_3?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9ec935e497670141ca4d61fce8f49972/6685878060040477270;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_3?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:23 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:23 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAALXNQQqDMBAF0KvIrLUkqWjNAbrsqrtSwmimIqROScZ2Id69kZ6hDB8+b/FnBYqRI9j1VxLY2wqenzjNYGEM3GOAEiJh4l1mljMvs8/2pJRwpIwXluKxqy2u2Acq/BIGkurFUaq2MdajYCJxRumT6rRxumm7fI1plVIuRx/EvSf6uCNs9xIG9nm4VvUf32xfdGyXif0AAAA=" + } + }, + { + "ID": "a231a3766f31c664", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "221" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c7ef93bc9d0f6245c6a74540cf12ba8b/8250052478943515366;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X3ZpZXdfNCJ9LCJ2aWV3Ijp7InF1ZXJ5IjoiU0VMRUNUIHdvcmQgZnJvbSBgYmlncXVlcnktcHVibGljLWRhdGEuc2FtcGxlcy5zaGFrZXNwZWFyZWAiLCJ1c2VMZWdhY3lTcWwiOnRydWV9fQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:23 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:23 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAANXQwWrDMAwG4FcxPm3QxD3s5DcY7DLWW1eoYmuOmW2lkjMIIe8+l1LocdfdxAf6+aVVIzOxtuttEG2Pq/aUIRZtdUg0QNI7zQhCV4nlB1L0jTKKQMBmrzdTFYaEqkBGq85DDJcZeemmeUjRdR4qWIE8JZReRvhGmRAYz5/leOBFzRJLUFKheGCvPt7f1NNY6yTWGJdo9n0gCgl7R9ncw40nJ4bxCxmLQ3Nf7+SSDJbWp4V2j/p86lv3RA5qpHJYpusBVEfkB2709/56O+20I9+CXvb7//yXbfsFV1U0dg8CAAA=" + } + }, + { + "ID": "90c2e69e0393f3d4", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_4?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "fb16fa75e3fc5a0ee3cd9ab6d588178f/9814227993029725046;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_4?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:23 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:23 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAALXNQQqDMBAF0KvIrLUkQbTmAF121V0pYTRTEaJTkrFdiHdvpGcow4fPW/zZgGLkCHb7lQT2voHnGacFLIyBewxQQiRMfMjCcuF18dlmSglHynhlKZ6H2uKGfaDCr2EgqV4cpWobYz0KJhJnlD6rThunm7bL15hWKeVy9Ence6KPq2F/lDCwz8O1qv/4Zv8CKmR+Hf0AAAA=" + } + }, + { + "ID": "efd6e68267dabeba", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "222" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "dd2a43878f27fcd9e06ac3b41946763e/11450460001659011846;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X3ZpZXdfNSJ9LCJ2aWV3Ijp7InF1ZXJ5IjoiU0VMRUNUIHdvcmQgZnJvbSBgYmlncXVlcnktcHVibGljLWRhdGEuc2FtcGxlcy5zaGFrZXNwZWFyZWAiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:24 GMT" + ], + "Etag": [ + "SXlUj+2NbepFWdZcSw+RnA==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1R32vbMBD+V4L22MWy1dVZDX1oRzoCXh7iZB0bxVWks6NGtlxLrgkh/3tPXjJGWVkRevhOd98P3Z5sVS1JQtaqfOqg3X1wfK2BfCTgeIn17IdePZ6x+Rqa2zv5U2T92aK+vrrCDuXnZKcFuHFjWjeexCyR3HELLmdh9Dm8jFgexZNLPDGbhGGY440Clz8r6PML5LCgi1TVW2TaONfYhNK+74PSmFIDb5QNhKnoyRx9ZrRpzSMIZ+krZXpUtvQdFuiQ0tK/nAyVBRTQQi2AJHtyVJr9Iyb2H1V+v/5f8aQw9P+RPeAPiA1U3OsVCrS0JPm1JzWv0ALpTSv94K7xKFsuZvOviCsjPZ6v0vT6Jp2Swz3y1F11s3OA8yQkA0xNXS6hfV1emP6ERAvcKVMv1SAXXZzHk4gx9imKz/FZc+u+GanQmHyj5Wjt+2x6h8in8kmGZXnH03T6ZTnyMUZFa6rRw2mT46ZbayXG/ucCy6sGtxHYDd+CbYC38IBsnYUUSi522ZMmScG1BcypjRg8I/0qI4cXgS3Vz8ECAAA=" + } + }, + { + "ID": "610948612843a429", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_5?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "09ef248cefc2c2627431ed853bf2b7ac/13014634416250371222;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_5?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:24 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "37b8bf55fe87f857", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "222" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9aff8c55d8171370ec36df95dbc17e1c/14578809934648259622;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0X3ZpZXdfNiJ9LCJ2aWV3Ijp7InF1ZXJ5IjoiU0VMRUNUIHdvcmQgZnJvbSBgYmlncXVlcnktcHVibGljLWRhdGEuc2FtcGxlcy5zaGFrZXNwZWFyZWAiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:24 GMT" + ], + "Etag": [ + "vJVIODVCQISgti/cr8WrMQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1R30/bMBD+VyrvdY2TDBKIxAOwagoKTLSlPExTcJ1L6tWJg+00qqr+7ztnLUJoCGT54TvffT98O7IWTUESshTVcwd6+8WypQTylYBlFdY3N4v05/fF9X06q6ygXJ896tv7iwvsEG6u6CQHO26VtuM4CpOCWWbA5qEfnPnnQZgHUXyOJwpj3/dzvIFn842APo+Qw4AsM9GskWllbWsSSvu+9yqlKgmsFcbjqqZHc3QT0larP8CtoW+U6UHZ0E9YoENKQ185GSpTKEFDw4EkO3JQSv8TE/sPKv9eP1Y8Kgz9L7J7/AG+gpo5vVKALAxJfu1Iw2q0QHqlCze4bR2azafp3Q/EtSocvnvIssurbEL2v5Gn6eqrrQWcJz4ZYKaaag76bXmq+iPiGpgVqpmLQS44/RbFQRiGJ3F0gs+SGXurCoHGindaDtYW6eQRkUvlkgzLco4n2eR6PnIxRqVW9ejpuMlx2y2l4GP3c55hdYvb8MyKrcG0wDQ8IVtnIIOK8e3sWZKkZNIA5pSKD56R/mFG9n8BJwQDSMECAAA=" + } + }, + { + "ID": "94b7fe393b40cc41", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_6?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9b198d9565acb19b441d97dcea2cf37f/16142985448734469558;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_6?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:25 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "e1ac3dc4af7e4bef", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_7?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "821755830578b15058bbc77c33867a57/9302044570438279566;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/t_view_7?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:25 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:25 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAALXNQQqDMBAF0KvIrLUkQZKaA3TZVXelhGimIkSnJGO7EO/eSM9Qhg+ft/izAaZECez2KxnsfYNAs58WsDBG6n2EGhL6TIcsxBdal1Bsxpz9iAWvxNXzUFvdfB+xCmsckJsXJW6MVjZ49hnZKSHPopPKSW26cloZIYQrkSd27wk/zsD+qGGgUIZb0f7xzf4FitXgxf0AAAA=" + } + }, + { + "ID": "65ba4d41330a8a87", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0017?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "aaf0c53848769888d2b37e84491ee3dd/10938276579050789406;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0017?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:25 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "a6dd780a69021bb4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?allUsers=false\u0026alt=json\u0026pageToken=\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e1d081dc5b751a05cc11f76e56b14139/2461104791620163174;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?allUsers=false\u0026alt=json\u0026pageToken=\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:27 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/tuY4_VPtLXmEVyNvkcFEiw98KHw\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:27 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [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9p3Ak/pHcRe6YSaEo4IAQU9RjZtSBNRdUAebgmLj6eb6Xc0FwRm8e6hsgoddl216m/dfgrvdnLExe6R8sBELu06JpTBnvlBC5lPYiBJg7MRGw5LTJp2SIICEnjYFWhud1CmZqaCgjSRGBTbTgoLP58XYgnufTYuZSqdkU1VpYPYqDcuNjM93dJtZvmg6lJcXuaAC/33abWOIWBgMqLAvfeVjR+uGGhahotwjMhBhAxo/QK/OynFMrO2stR/c5v3mDtp3/D5eK9cvO/e3xxt3lzljYvZI+WAiQtgWpRv2PTD326ZIPgUwzBQTUQy+KUzUYDBFlG4sfT+nL4LZ5oNq9YtwQIVAWN83YugxY4v8yaDMitOVAmAZKvWCIU4oTFVQSBZaeLQ3W6hGdwlYkXHJI4MOjvfLlZ2NohhchUmLLHKSKJ9jnfrhsyq9CVvUL1Kd1Ac831OCCujCAHpcIhdy33MdvWsiQBCU0lW+eoXOMehsnXpi5+TL9o+rw8/XdzcHa5udjYMvR5QfiJyhM3ukfKATMGYLqKVhOIkZOiFh81EngaTSBJ0Q4HScTwELKQA5pvOFnVynd0LaCa0KI1jlWCZUzUn90WhotRIN1clfNpy2WKAZ17GcgKUi1ySaZ2+XyEkJV3Ep9FEOn9sivZSOq5HFgRhTyIXrUsECGgCihV3pBYog5UsgoHitlzsOnWdb97KnNm8OCK4f13cD55IG57d9/76cd2O17JFygU4iIbOFyBKJLM3EiZQQZrJiTtBJJKYmrZNIIkzRPUwLgVA+vU8U8Uukrwxxw0YydATymQIrZxLhp/d0kKwNWDMIX2CJhXC6ZuLQ2kx82UNkV/HCtMvIA7JM5eTFHOvbhg9mgcVtPeoBLxCuAwPf9dyw6ShmFFDuaoZzgOvr0Rj5DVueffv7/wMuP6Wjr4EBAA==" + } + }, + { + "ID": "b7f3fe408683f120", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "72" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a6c4ffc320699ab4f8ef41facee2c9b6/4097335700737822710;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkYXRhc2V0UmVmZXJlbmNlIjp7ImRhdGFzZXRJZCI6InRva3lvIn0sImxvY2F0aW9uIjoiYXNpYS1ub3J0aGVhc3QxIn0K" + }, + "Response": { + "StatusCode": 409, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:28 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:28 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKXMQQrCQAwF0KsMWbcgIoqzE/QU0kWchDKYmjJJwTL07o54BHefx/+/ApeiBWL9BYN4r0A6YX5BhFH0gQIdFEbTr9AyS07o3HBiMxy56UVagdZwe2dzi+GKjsYeaJHE3s9avD8d99H1uSpsQwdJqQ0Pu/MfN9sHl9pVZ74AAAA=" + } + }, + { + "ID": "b4e07f87ffdedf38", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "94df401ac8a5651cf8c1d3e31ea9573c/5661511214840809350;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:29 GMT" + ], + "Etag": [ + "x0yfw4kU2qQ7q7BjenGZPg==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:29 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAH2QUW+CMBSF/0v3qiKgICRLNjNjTLa5EReTLXuo5VIrhUJbZMT431cMLssyfT33nO+eew8oZXmMQrRhtKxANjcx1liBRj0EGlMz+Ro2ST1K35zy1S/96Q7y+fsLvb01DtYm44oT0P1CSN33PSfUIm2EGSrgySPLU2PZal2o0LLquh5QISgHXDA1ICKzznutvWMVUuyAaGX9QVpdJ2Wd2Z0QQQIScgIoPJy1Rdvp7OuIi396omMPYUJAKRR+HJAU3FDQOlqsZlHbvgDCMJ9LURVG70BryTRIZbI/ieX6+UpgWecX/JUCOW1mGWbcqK7nuUHguvZo3N/YEz20RaYD7PhBSlxKKCu3ZconG7HZVncx7IGLAuSAGsieETCHiCrX7Ud/74pm9w9XykWA41O7zx4iErBmIl+xrE3aY8e2R85wNPa9wAA4VvpJxCxhEF+yCHIimBFWDPdz8+gtmJyNjt9fKYgcZwIAAA==" + } + }, + { + "ID": "fd1bb2f54a89fcbf", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "237" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9246d5f5793944c91427c0f51ac7c749/7225686733238763285;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJ0b2t5byIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTgifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:31 GMT" + ], + "Etag": [ + "rexvj97G7P1fci0HFZ85jQ==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SQW+CQBCF/8v2Wt1djKAkHmpirYk1LeXUpjErDLgKLGVXqTH+9w6rxsTYtOFA5r2Z780Q9mQti5j4ZCHTrw1UuzsjFhmQewJGpKhX8L1d9b2x98KTSLKnx/ded/U6GGCHbObiTRaBaZWqMi3PdXyj1jvVtpC5w3iP9bkz567Xx8d1PMbYnKGM4xqyZCqLNUKWxpTap7Su63aqVJqBKKVuRyqn573o1qFlpVYQGU2vQmksjNCAhk2nNl3T/yxhewJIoIIiAuLvySlkcuM47D8lWdeGnRlH5c/EA94dLSEXTVQiIYs18T/2pBA5ph9fSNyVTfUWBpPZGGcu/ibXF38yC0fjUUAOn4hFa7gzgDjCiC2nqkhDqK7lQNXnKqpAGKmKUFo673ZcjztOh7u82/wC36WsbjS4Pbynmc+ENs8qlnhI/AvjtGr4MJyOmgkVWSBKQkvRKvDTLgExnBx+AOV80RuMAgAA" + } + }, + { + "ID": "35904e62d2ed0020", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=45321648bd4b506bdbb038acdc28da434a140deea1b073e1bf98cb13cdd4" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d79f3e1aa70d8b1fda32b0ca54bd2e17/8861917642356422821;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "LS00NTMyMTY0OGJkNGI1MDZiZGJiMDM4YWNkYzI4ZGE0MzRhMTQwZGVlYTFiMDczZTFiZjk4Y2IxM2NkZDQNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImNvbmZpZ3VyYXRpb24iOnsibG9hZCI6eyJkZXN0aW5hdGlvblRhYmxlIjp7ImRhdGFzZXRJZCI6InRva3lvIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwidGFibGVJZCI6InRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAxOCJ9fX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkJKcU9HWGRZTWdnMmIyU0NnMFhsN0Z1TlpZZyIsImxvY2F0aW9uIjoiYXNpYS1ub3J0aGVhc3QxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg0KLS00NTMyMTY0OGJkNGI1MDZiZGJiMDM4YWNkYzI4ZGE0MzRhMTQwZGVlYTFiMDczZTFiZjk4Y2IxM2NkZDQNCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA0KDQphLDAKYiwxCmMsMgoNCi0tNDUzMjE2NDhiZDRiNTA2YmRiYjAzOGFjZGMyOGRhNDM0YTE0MGRlZWExYjA3M2UxYmY5OGNiMTNjZGQ0LS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "849" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:36 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/3YC_ru9V70K6TctkoNlB3TPuwSE\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpPNs_i7WySJew6245I-62YbzEY7a4Ho7n_B3ff8InyIUR2JoOOs9v2oZrUexZLcdcClilNGD4rsXU-QDfn28-MCJzwhZbTqH3F4s1ng5WNk26-EzI" + ] + }, + "Body": "eyJraW5kIjoiYmlncXVlcnkjam9iIiwiZXRhZyI6IlwiTGFaOG4wNEQ4S21HSWVVZFBsSU5MbWVhV0dzLzNZQ19ydTlWNzBLNlRjdGtvTm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request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "938a20a38bd2da7a31db523fde19816a/10426093156459409461;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:36 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:36 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAK3MvQrCMBRA4Vcpd26hhGIho0KFgnVwaRWHpImXQpqr+ZlC390UX8Ht8A0ngXaOHPD0Cw/8kUDRKhYLHNCQFAZKcFp42sVS6ChalW3V3gvUGQcKxWtXXvQkCxXNrEP1Jheq9sD4sf9cz6OaLohMstsJ69G0XRzuE8L2LGEmlS9N3fzruX0BX0OBZ9cAAAA=" + } + }, + { + "ID": "602659a8ceac2000", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026location=US\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b7e500182049302eb027067c84b6ff22/11990268670545619397;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026location=US\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:36 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:36 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAK3MvQrCMBRA4VcJd26lhGIho0KFgnUoQqs4JE0MQpqr+ZlC390UX8Ht8A0ngXIOHbD0Cw/snkDiwl8WGGiDghsowCnucROLocVoZbZFec+1ythjIM9NGelQEBnNrEL5RhfKZk/Zddgdus/lNMrprDUVdDjqajRNG/vbpGF9FDCjzKO6qv+4Xb8saBg63QAAAA==" + } + }, + { + "ID": "203b01c96db80db8", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026location=asia-northeast1\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f85b47d79ae514adaedc8bb270aa1599/13554161618766913877;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026location=asia-northeast1\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:37 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/KP3YDkPCv-r-qw4n9Qtd0yLVwSs\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:37 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1QW2uDMBT+L+fZjiTtdPVtl650bBashXZjlDSJNp0aZ+JDEf/7kjgo7Gnk4RzOdznfSQ9ndUxFLlpRMwFxD02rzoKZFYcYeFcyYSaNas0kCgkEju2Rh5fv9XLH929FQY5k81igXRk9d8n7vrCsUjFqpKotkWpJJ7U1OAmqDYYhAKbqXBZd+0vpnWl2aex2eF3fP3k95Q7Q7CQq6rpcipJriD96qGnlqL4EYEbhJktXydK6X/Gu0ld8lWSL5SKF4dMG4EIbWfv1GT2W/zibU0O1GFGjvi7KOTvpOHHdgSB8h+aYHHAYze0LSYQQOiA7hmGwa7WhptP+Ltu5VOk2ScbYfiRtLOYJrBVjPOlvwbfTMMKETGfzaQie3Jq/WIjwDNzvVk0pnDh1FhCjGzQMP9OxEMXoAQAA" + } + }, + { + "ID": "dfe354c8b9d1d863", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg?alt=json\u0026fields=status%2Cstatistics\u0026location=asia-northeast1\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "11284afd8ff816e366a3f0fc7fb33ab7/6713221839948797485;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg?alt=json\u0026fields=status%2Cstatistics\u0026location=asia-northeast1\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:38 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/1nSJgX2A04NoMgwjGlSN548y2wk\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:38 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAF2Nyw6CMBBF/2XWxJSWh7A06FIT4g9g20UTaAkdYgzpv9upkQW7uefcmdnA44Crh3ZLk4YWusf9CiFL2Xg0Mlm56BidfZqJSnkpqjrnXBSNqCCVFzy6iuVFdNqqo6nL5hyNdNM8ajrb03Fo2YllMLpB0Utj5xVvZtSeVmN9B5cP/iCP1K0Yce/eRMQO/h1B6DWoXku3KCIMQghfofZqY/oAAAA=" + } + }, + { + "ID": "392cba5837ba672a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg/cancel?alt=json\u0026fields=\u0026location=asia-northeast1\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "0" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "065cfbdee1726343a5ebde6d0472e2c1/16754569141482410613;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/BJqOGXdYMgg2b2SCg0Xl7FuNZYg/cancel?alt=json\u0026fields=\u0026location=asia-northeast1\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:39 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/-CJBMPacuI_iZ5pGeOgpdsAh1fI\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKuuBQBDv6ajAgAAAA==" + } + }, + { + "ID": "b1cdb976afac1ef4", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "229" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "af42e88b15d7b175a2a43d3adc4a9841/18318743556073769733;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUICogRlJPTSB0b2t5by50YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTgiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkhQbTBWeERKRGE3NkxxdjlFVVpZREVYeU9hZiIsImxvY2F0aW9uIjoiYXNpYS1ub3J0aGVhc3QxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:41 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/lqx4KwhQ1X3RWdkXuSZtPTwIEwk\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVTa2+bMBT9K5X3bWoC5k2kaasS2rFmaUtJX6oU+QVxA5hgkzSK+t9naCpN0dSJL8bn3HPOvVfegxWvKBgBzPN1y5rdlxeBwSlgCuX69hlM0VNQmc4kuCwvYjan10U8m5YM3V9Io1i/Opfb5Q18sJN7unpob5/UdbqNo+3qGWgR3gnTtiBMDWrRqIHvWSMkORpU+m/JkFRw+PO6NO9eJ78myPem600YzZ8eJ9HD7gplWkKyIpvyaqWFlkrVcmQY2+12mAuRFwzVXA6JKI2P8MbGMupGvDCipHFkbOjGpPGJ2/dCEKS4qL4dRdQxdG3CMtawijAw2oODSfyPBt/ZPfJ5ax92mnhs+HYKiKgynrfNgbLvRNNdrd3BzTxKHrVA33IHHQ7gNppG4/Tk68l5cvX7RInVTgwVwgVbWCYMzBBaC+j5of48yzdNc2Hqay1EmVS86p3Sjv7/DilSSLJ3dIGR5dGMhm4nB5EVEEyx65MMuhBThH3Hoi5xuro+TV+FKlEh5jouxpCaHqKZjSlFBDNIAifAiLiu7eo6zw76eTQMKTbhshaSH8Y2TqKzNFrE54tZFE2iiTbYNvyYdZ/EmpQm89lYszWnbrjQtG5i8SyNkrNxGt91QCvZlOWI7G7XBRhlqJDsTVtLhVQru6F0p24DWmsWzy7AAeR6fKQn9Cm7MfKy40HX9nxoWY7pByHoyY06xiB04N/b7E1KVqnDut+3CrokOmCzYCXiOh6wPc8OQ9uGjjvAMFAmFKUKkeWHK2LnJOfr5XpVBFjgZfuDsg0rRM2aYa41NpwwRIhoK9W9H/D2B5BQ7bUHBAAA" + } + }, + { + "ID": "f43f1330ca469695", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/HPm0VxDJDa76Lqv9EUZYDEXyOaf?alt=json\u0026location=asia-northeast1\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "25276a787fb2b997100fc879914c1984/1508512970265117589;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/HPm0VxDJDa76Lqv9EUZYDEXyOaf?alt=json\u0026location=asia-northeast1\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:43 GMT" + ], + "Etag": [ + "TH5e3OTzPLhwqJYLYPJs5Q==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/22QQW+CQBCF/8v0iklboqYkHmoloiGKFJvapod1GRS7sMgMtUj4711sEy89zbzs92bebAOfaR6DA9t0d6ywrG92yKuuCZEqxWRKoXNCsABZ7AwZeX20l9E58Pen43zjb4I59VejkSFI7jET4DSQpKhiAue9gVxkaGyXYgHXRaeeo3C2mBqd6bjTi7XvP459F1rr6qgyujpmi8iduuF/lo/WgoPehphgibnELkBR6gNKnnW3xZWSyL1Cl9wbDu7hQl9evCC7ffmezCdiOPCPXw/u+m0zcV/rpUgMpbQUnOrcgIJS0cvNgD0K4jsTE1izUKE+mSvBhj89rhkpKLVEIuw22PbvuiedFQrZZOOyQgukMH/lpQxOIhRh+wPqdqvRiQEAAA==" + } + }, + { + "ID": "bfd1e8521988820f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_ba26dfd9500181a28cbdb57cf151bdab742d5c42/tables/anonae545bb1d06adf3bddacbe1c848bac5535d5c638/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "25276a787fb2b997100fc879914c1984/11477803777272430557;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_ba26dfd9500181a28cbdb57cf151bdab742d5c42/tables/anonae545bb1d06adf3bddacbe1c848bac5535d5c638/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:44 GMT" + ], + "Etag": [ + "gkt+/o1d1FXt/vsRharYIg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qnZ5do6+cbphi6RZTolxUHZSQWRXqm29oCVZTklyTmBOWXFwOVGQP5RWBmdLVSGpgsAwonKtXqQFgGSrWxIDZCLgkuZ4ghlwyXMwLJxdYCAOaAQ86wAAAA" + } + }, + { + "ID": "7e930494359d15a1", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "375" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "818e5e2b30431e00c594d2a5e3de0c64/3072688484351327269;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7ImNvcHkiOnsiZGVzdGluYXRpb25UYWJsZSI6eyJkYXRhc2V0SWQiOiJ0b2t5byIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTkifSwic291cmNlVGFibGVzIjpbeyJkYXRhc2V0SWQiOiJ0b2t5byIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTgifV19fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiQnNlTkFwTFFlMHdUUlJpQU9ZajRodFA1QTg4IiwibG9jYXRpb24iOiJhc2lhLW5vcnRoZWFzdDEiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:45 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/7NWNzeXzF5yRtkXOkcv2EpvA8YE\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKVSXW/aMBT9L95rId+f0tSxrUNoKNCIqmXrhBznkph8OMROUIr473MCfaFT+zD55fqe43POvfIRZbSMkY8imuwbqLtPOxahGwQCJ7L7jOb4l1uq5nf3ZzGdwUO8zGfBvAD8OOWKEzwGL/D08sPqQpE9LTLS6ndVO3HXd89IitBeOG5yAmJUsVqMHFv3Mad4VMpbCpgLbfyVQzCp5vegHlZhSCeL9c5MxdKauK6U4JBv57TMpFAqRMV9RTkcDuOEsSQHXFE+JqxQXsMrra5UNdsBEVy5MlbkYFx5x+02ZwQLysrPVxFlDPk2hC3UUBJA/hFdTGb/GPDMHpD3R3u1k8Rrw9MNIqzc0qSpL5RjL7rqKumOvi2Wa9Qzqq4HOGtqAisc5cCR//ujcDEWmMMZFSzrmOyJ/vG501cbXdVc1dP0jWY7njy27qiqulFlG53+SA3ggpZDtMH345X8n6uHTie5Ey6waPgws6z6VYQPQTALpugCUhmLDARSwzkeLXqeZhm2o+m6aWmeiQZyLd5glj6svuFQb6DANJeoYduG5xmGZlqjSHOFqrFCeFh3vIwYCUnoPt1nuRuxKG2+xNBCziqox4nUaCkBTAhrStH/UnT6C+FvRTNtAwAA" + } + }, + { + "ID": "d43750b3a1dc541d", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "373" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "547f566cb95c3a4c70dcf5e9ddfd38d1/4636862898959463605;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7ImV4dHJhY3QiOnsiZGVzdGluYXRpb25Gb3JtYXQiOiJDU1YiLCJkZXN0aW5hdGlvblVyaXMiOlsiZ3M6Ly9kdWxjZXQtcG9ydC03NjIvYnEtdGVzdC10YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTguY3N2Il0sInNvdXJjZVRhYmxlIjp7ImRhdGFzZXRJZCI6InRva3lvIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwidGFibGVJZCI6InRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAxOCJ9fX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6Im9jUjNjT1RISjhJZFBsQlBVbXBHbno1bXB1SyIsImxvY2F0aW9uIjoiYXNpYS1ub3J0aGVhc3QxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:47 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/d9roD_jNaE9oGcJfaDXaviWBK_g\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAK2S227aQBCG32V7G+MT+IBUtU1IKQHRiJomalNZ6/VgFmyv2V1DKeLdOzbkIqhKe1H5Zj3zzzf/zO6BrHmZkj5JeLapQe7frERCrghommH0iUzot6C0uoNgXAxHME/v89F0UgB9GCozDaUYxKspvQ3FkN0t6OCRbvnD9TjOnghCeANO65yBNiohteF7Tp8qTo0S/5ZAlbY7gs1c9jn6dBeMEH59Py+qYfmrV1T1GBEK8sWEl2sELbWuVN80d7tdJxMiy4FWXHWYKMxn8+bWMSspVsA0unvZ2MTBlPlKt3e5YFRzUb69sIg2sHYGC5BQMiD9Azk3Gf1hwJO6zbw+2nM7FF42PF4RJsoFz2p5lhwaaLSvsDu5fYxmH26i5pZ+akmZbtJK1JJBRJP8HwymVFMFp6wW673AmG5KT5HmFDuWHVih7cS254f4eY5vWVZsYbjxl4LSvGzdzSXHqqy5m8udJxtDo9D4K7LD1JZcUhXpf/8f3B8vwB+FLCjujNx8+UqOOIrSVNeqXSKemg3P5tPpaDok5yTHWtYKmISWEfGi0dk91/Ntx+l6geOSViz1Zc53bbch1QpkDAXlOWZdz3PD0HXtbs9I7EBbtih0SB0/XDM3YxnfLDfrPEhEsqzfp7CFXFQgOxkytpwBZUzUpW4ePzn+BuBYpLPEAwAA" + } + }, + { + "ID": "3c8bb05c4a5c9ea1", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/dulcet-port-762/o/bq-test-table_20180912_1679797627000_0018.csv?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1fc58c5249eb700e4a0de795db37432f/14678210204787978493;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/dulcet-port-762/o/bq-test-table_20180912_1679797627000_0018.csv?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "253" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:47 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:47 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqw1DYWtC5WmeMTgDO_UckYCG0UISGi84UhZMb9OnZuT_O1ujFPbt1br92Oor7qGkRCJfvUMUFM5p66yZbeplFui9B-Zw" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vIHN1Y2ggb2JqZWN0OiBkdWxjZXQtcG9ydC03NjIvYnEtdGVzdC10YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMTguY3N2In1dLCJjb2RlIjo0MDQsIm1lc3NhZ2UiOiJObyBzdWNoIG9iamVjdDogZHVsY2V0LXBvcnQtNzYyL2JxLXRlc3QtdGFibGVfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDE4LmNzdiJ9fQ==" + } + }, + { + "ID": "0142332eed6f61a6", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo/tables/table_20180912_1679797627000_0018?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6642c123742c2c21ccceb77849a18371/16242385718874188173;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo/tables/table_20180912_1679797627000_0018?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:48 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "30a0a801f4883cbd", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "72" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "084bd9ed16399eb1676e3634b6536482/17806560133482324253;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJkYXRhc2V0UmVmZXJlbmNlIjp7ImRhdGFzZXRJZCI6InRva3lvIn0sImxvY2F0aW9uIjoiYXNpYS1ub3J0aGVhc3QxIn0K" + }, + "Response": { + "StatusCode": 409, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:49 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:49 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKXMQQrCQAwF0KsMWbcgIoqzE/QU0kWchDKYmjJJwTL07o54BHefx/+/ApeiBWL9BYN4r0A6YX5BhFH0gQIdFEbTr9AyS07o3HBiMxy56UVagdZwe2dzi+GKjsYeaJHE3s9avD8d99H1uSpsQwdJqQ0Pu/MfN9sHl9pVZ74AAAA=" + } + }, + { + "ID": "435c8297bd27c6f1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5a36119c792ae24c1b548ca1aa3e0969/996329547656895149;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:50 GMT" + ], + "Etag": [ + "x0yfw4kU2qQ7q7BjenGZPg==" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:50 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAH2QUW+CMBSF/0v3qiKgICRLNjNjTLa5EReTLXuo5VIrhUJbZMT431cMLssyfT33nO+eew8oZXmMQrRhtKxANjcx1liBRj0EGlMz+Ro2ST1K35zy1S/96Q7y+fsLvb01DtYm44oT0P1CSN33PSfUIm2EGSrgySPLU2PZal2o0LLquh5QISgHXDA1ICKzznutvWMVUuyAaGX9QVpdJ2Wd2Z0QQQIScgIoPJy1Rdvp7OuIi396omMPYUJAKRR+HJAU3FDQOlqsZlHbvgDCMJ9LURVG70BryTRIZbI/ieX6+UpgWecX/JUCOW1mGWbcqK7nuUHguvZo3N/YEz20RaYD7PhBSlxKKCu3ZconG7HZVncx7IGLAuSAGsieETCHiCrX7Ud/74pm9w9XykWA41O7zx4iErBmIl+xrE3aY8e2R85wNPa9wAA4VvpJxCxhEF+yCHIimBFWDPdz8+gtmJyNjt9fKYgcZwIAAA==" + } + }, + { + "ID": "4419c23c7fdd82be", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "237" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8a858541fcc6d3590c4264dc0214a934/2560505061759881789;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibmFtZSIsInR5cGUiOiJTVFJJTkcifSx7Im5hbWUiOiJudW1zIiwidHlwZSI6IklOVEVHRVIifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJ0b2t5byIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMjAifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:51 GMT" + ], + "Etag": [ + "2ztXYQO6ZcAVAJRmuK6aPg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2S3U7CQBCF32W9FXa7SgtNuICEEBRRa2P8iSFLO5SVtlu7i7US3t1pgZAQjKYXzcyZ+c6cpmuylGlIXDKT0ccK8vLMiFkM5JyAERH2+bd5er6/tV+C3mPvyktW17a4i7pdnJDVXriKAzCNTOWm4djcNWpZqmYNmXJmtVnH4lPLdjr42NxhjE0Z4wzXNcTzsUyXCFkYk2mX0qIompFSUQwik7oZqITu76KfnGa5eofAaHpkSkNhhAYUandau2v6nyPqGQ/mkEMaAHHXZGcyOhEO53dOtVqb7Rnbzp+OG8wdLCARldVcQhxq4r6uSSoSdN++kFhmVfXge6PJEHcO+irRB3008QfDgUc2b4hFqV8aQBypgmE5VmnkQ37c9lSxr4IchJEq9WVNt1oXtmNx3rJa7LL6Bb4ymZ8YsNuYp9qPhTY3KpQYJPyFsTvV7/XHg2pDBTUQW0JL0Ujx0y4AMRbZ/ABvZEBQjAIAAA==" + } + }, + { + "ID": "a60d55e8257fb336", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=d3c790e6cbddf96f2451698f679d71dd3d2c50a7b156443ba891830c7856" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e18655e0be1ac048e62f9aab46b1b4a2/4124679476351241165;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "LS1kM2M3OTBlNmNiZGRmOTZmMjQ1MTY5OGY2NzlkNzFkZDNkMmM1MGE3YjE1NjQ0M2JhODkxODMwYzc4NTYNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImNvbmZpZ3VyYXRpb24iOnsibG9hZCI6eyJkZXN0aW5hdGlvblRhYmxlIjp7ImRhdGFzZXRJZCI6InRva3lvIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwidGFibGVJZCI6InRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAyMCJ9fX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkFGY2t0SXBOQmNjR21sMmZpZjZUZnhxeFVZRSIsImxvY2F0aW9uIjoiYXNpYS1ub3J0aGVhc3QxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg0KLS1kM2M3OTBlNmNiZGRmOTZmMjQ1MTY5OGY2NzlkNzFkZDNkMmM1MGE3YjE1NjQ0M2JhODkxODMwYzc4NTYNCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA0KDQphLDAKYiwxCmMsMgoNCi0tZDNjNzkwZTZjYmRkZjk2ZjI0NTE2OThmNjc5ZDcxZGQzZDJjNTBhN2IxNTY0NDNiYTg5MTgzMGM3ODU2LS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "849" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:54 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/FHFVD80dL1k30b7opqCD2hGbWU8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Guploader-Uploadid": [ + "AEnB2UruRN6zQMcsk1zkSsjKyRLcL3Ja1lBrAMqkDKB5kWBMfcqiazujCVu1PpY_4q0ubh3N-KhwavsTduteJAOU3l7_mMC-caaUCebEJStzEikOlwpV2_Q" + ] + }, + "Body": "eyJraW5kIjoiYmlncXVlcnkjam9iIiwiZ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bG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9" + } + }, + { + "ID": "6865a4cf1b054259", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026location=asia-northeast1\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "0d1c53a0dd6b08ed6027aa2e23b31c37/5760911484980527965;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026location=asia-northeast1\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:55 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/lv0RANluI0CMR6eZVHCyzAL9ssQ\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:55 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Q32uDMBD+X+65HTG22vrWsU6E4cDZhzGGpDGuadU4c0KL+L8viYPCnkYe7rjvx32XEc7qmIlK9KLlAqIRul6dBcekhAjKoeYCl53qcRkGFBaW7ZDdM79g0qWPnMdNTStZBXl1/b4e3veGVSvOUKrWEJmWbNkag5NgGj2YFsBVW8mvof+ljNY0v3VmO7y87p6cnpUW0PwkGma7Soq61BB9jNCyxlJdWQDOwrc8S9LYuN/xodF3PEnzfbzPYPo0AUqhUbZufc6O9T/OLhkyLWYU1eWmrLOVzhPbFZR4G7L1aOEF4da8gIaEkIIQSmCazFqNDAft7jKdTZUd0nSO7UbSxOKOwHsxx5PuFm/tB6FH6doPfQKO3ONfbBVsVmB/t+lqYcWZtYCIPJBp+gGDJYl06AEAAA==" + } + }, + { + "ID": "04b944990d83c523", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026location=US\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3d3c0d19511f0863336b6c9e46a0f4fe/7325087003361639661;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026location=US\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:56 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:56 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAK3MvQrCMBRA4VcJd25FSqmQTcEWHbpoBxGHND+lmOTWJIVC6Lub4iu4Hb7hRJDOoQMaf+GBPiMINGy0QGHQ2DMNGTjJPG5iMdQ4W5HMSO/ZIBO2GIjalJIr9kTMmsuQT+hCfqgK2t12x5q/w2VqT5w3RhdqVNVdLZ+le5xhfWXAUaRRuS//uF2/jITznN0AAAA=" + } + }, + { + "ID": "d53ddaaf6764efaa", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b6dccabaa46625234b49c9291cc8d4ee/8888979947288032381;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE?alt=json\u0026fields=configuration%2CjobReference%2Cstatus%2Cstatistics\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:56 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:56 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAK3MvQrCMBRA4VcJd25BSqmQTcGKDp10EHFI81OKSW5NbqEQ+u6m+Apuh284CXQIGICnX0TgzwQKnRg9cBgs9sJCAUGLiJt4pBZnr7I5HaMYdMYOiZlNObtiz9RspaZywkDlvqn4oZVvukzdUcqzs5UZTXMzy2e5P06wvgqQqPKl3tX/eq5fsiN8xtcAAAA=" + } + }, + { + "ID": "f3e44228be7ec479", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE?alt=json\u0026fields=status%2Cstatistics\u0026location=asia-northeast1\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ac489408d3334bfa6f944e320517e1ae/2048040168469915989;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE?alt=json\u0026fields=status%2Cstatistics\u0026location=asia-northeast1\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:57 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vLzotdoIeRAfAq5XaeSND9KTbZc\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:30:57 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAF2NywrCMBBF/2XWRdKmD+1S1KVC8AdikkWgbUoyRaTk381E7KK7mXPu3FkhoMQlQL/myUAPl8f9CrHIuw1oVbbKm7S66WlHCpUNb7uyqhrecQY57HHv6vZYJ2cmvTctP1XJKDfOg6FaQeXQswMrYHBS00s7zQve7GACnab4Bs4f/EEqcQsmLNybCN/AP8MJvaQWRjmviTCIMX4BAOv1MfoAAAA=" + } + }, + { + "ID": "9a6e2acac01a1c46", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE/cancel?alt=json\u0026fields=\u0026location=asia-northeast1\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "0" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e7e3b184932e821c03db0b49e6b11914/12089387470003529117;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs/AFcktIpNBccGml2fif6TfxqxUYE/cancel?alt=json\u0026fields=\u0026location=asia-northeast1\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:30:59 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/FYRZenj0_wi9EAWS9uhnL30WT5s\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKuuBQBDv6ajAgAAAA==" + } + }, + { + "ID": "f7d7c99e6fc38d79", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "229" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5e2ae3ad8217a8632dd2e8974d55f3e5/13653561888889789997;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUICogRlJPTSB0b2t5by50YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMjAiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6ImlNUk1TMG5QOThkYWtTOWo4SHZtbHJ4RHN3ZCIsImxvY2F0aW9uIjoiYXNpYS1ub3J0aGVhc3QxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:00 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/TwqWc01yE5HaA4dg8gGAcv2ZdsE\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVTXW+bMBT9K5X3NjUBzHekaYsSmqKlWUfoqlWVIn9B3AAm2EkaVf3vs2m6h2jqxIvxOfecc++FF7DhDQUjgHm53bHu+OlJYHAJmEKlvn0Ec/QQNbY3jb7Xs5Td0dsqXcxrhu5n0soP23tiO8fEv0Zjj5ZRORuTPXygMnkEWoQbYbqrCFODVnRqEAZwhCRHg0a/rRmSyhnym+xmaTe3cUTRZhk/Rdf7uuqep/JAtYRkVTHnzUYLrZVq5ciyDofDsBSirBhquRwSUVvv4a09tNpOPDGipHVmbOnGpPWB29dKEKS4aL6cRdQxdG3GCtaxhjAwegEnk/QfDb6xe+Tj1t7tNPHc8PUSENEUvNx1J8qLEc2PrXYHP++S7LcW6Fs20OkAlsk8meQXny+ush83F0psjmKoEK7YCtpOZMcOXDlBGOsngKFt2yvbhrYWokwq3vROuaH/v0OKFJLsDV1hBANa0Ni3tYuDYEQwxX5ICsd3MEU49CD1iWfq+jR9FWpE40KqC5EHC08XxaEd+25AMSZB6BY4oJHnoABR3M+jY0ixKZetkPw0tkmWjPNklV6tFkkyTaba4NDxc9Z9lmpSnt0tJpqtOW3HhaaZiaWLPMnGkzz9ZYCdZHNWInJcbiswKlAl2au2lgqpnTRDMSezAa21SBczcAK5Hh/pCX1KM0ZeG56j+wkdCP04Cs1npMmdOsMCG/bY3232JjVr1Gndb1sFJokO2K1YjbiOB9wgcOPYdR3PH2AnUrYjahUjGMYb4pak5Nv1dlNFWOD17htle1aJlnXDUmvsOWGIELFrlPl/wOsfaRg8CQcEAAA=" + } + }, + { + "ID": "db51252884dcb040", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/iMRMS0nP98dakS9j8HvmlrxDswd?alt=json\u0026location=asia-northeast1\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "41e0796c438e8d481617e749151a5c1c/15217737402992776893;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/iMRMS0nP98dakS9j8HvmlrxDswd?alt=json\u0026location=asia-northeast1\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:02 GMT" + ], + "Etag": [ + "q0P763YqUXuYxkSz0uhmww==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/22Qy27CMBBF/2W6DRJtJB6RWJQ2AiRANAGpqOrCOBMw+BHscQNF/HsdWolNVzNXPnfmji9wELqABDZie/Rozw9bpLemydB5SS6UymiHEAES2wby2F50O/H6uHr369Mh/277narrwSAQju9QMUguUAqUhYPk4wKaKQy2W4mAzlWj8mU2mY+CVqZo9Hw1nT4Ppylco7vDK3d3TObLdJRm/1k+rxHszSbDEi1qjk2Aypo9cpo0txVecqRWZSy1up0nuNG3FzHLZnlbL/q9gh3y/r43/lLSnl5dXQRKGs5IGB1A5gRr6TBgh8zRY4gJZIjJzNThSojhTw/PhG5hDUfnsNkQx7/rXoyqJFLIRtZjBJyFvxoLgqRk0uH1B0TcCXGJAQAA" + } + }, + { + "ID": "6945493da1918c63", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_ba26dfd9500181a28cbdb57cf151bdab742d5c42/tables/anon32d6dfa42f428c9709536dbbc673fb6d841a6adb/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "41e0796c438e8d481617e749151a5c1c/6812622110088450565;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_ba26dfd9500181a28cbdb57cf151bdab742d5c42/tables/anon32d6dfa42f428c9709536dbbc673fb6d841a6adb/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:03 GMT" + ], + "Etag": [ + "fsFBenpiboN23psVgfr5bA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qnFbs5peYVZCbl+xkZFxSHpacVmSY52toCVZTklyTmBOWXFwOVGQP5RWBmdLVSGpgsAwonKtXqQFgGSrWxIDZCLgkuZ4ghlwyXMwLJxdYCAFDbuFmwAAAA" + } + }, + { + "ID": "05b9820d53c796c1", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "375" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e70d520f80907ec0e0a2f290060f833d/16853969411605286733;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7ImNvcHkiOnsiZGVzdGluYXRpb25UYWJsZSI6eyJkYXRhc2V0SWQiOiJ0b2t5byIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMjEifSwic291cmNlVGFibGVzIjpbeyJkYXRhc2V0SWQiOiJ0b2t5byIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMjAifV19fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoieDVJMG9YdmZGNkcybFVuRDQ1MU5VUlhZT2V1IiwibG9jYXRpb24iOiJhc2lhLW5vcnRoZWFzdDEiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:04 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/8szw75xMVgNMojn8m5wNPl6lJuc\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAKVSXW/aMBT9L95rIc6XkyBNm7RqiI2mCJWt7Tohx1yCwbFD7JAyxH+fE+gLndqHyS/X9xyfc+6VD2jD5QINUMbzbQ3V/sNaZegKgaG57T6hMX2MJQ6u4+/FcASzxUSM0nEB9OdQO7H+00Th882PPL1RaxkXYZNOBBHfavaErAhvhRe1YGB6papMLyLegGpOe9LeVkC1cfvP4Qir+93yKxl6Yiavg9BNZ9P7h1uorYQGsRxzubFCK2NKPXCcpmn6uVK5AFpy3WeqcF7COzvPKSu1Bma0c2Hs2MG084bbJ6EYNVzJjxcRbQz7dgpLqEAyQIMDOpuM/jHgid0hb4/2YmeJl4bHK8SUXPK8rs6UQyt6ty+tO/pyO3lALaPct4BWdcXgjmYCNBr8ei/cghqq4YQatdkr2zPt41OnreYedmOcuN7cJVFiD/EijPEcYw+j42+rAdpw2UXrfN9fyf+52o0c7U60oabW3cy2alcxnaXpKB2iM8htLNYRWAWneLxoeW7ok8j1PBIEJEAduTKvMBKFrVKtoZpDQbmwqE+InyS+7wZhL3Njg11VmIR6UbJhfs5yvl1tNyLOVLaqPy9gB0KVUPVzq7HjDChjqpam/aXo+BdNCurGbQMAAA==" + } + }, + { + "ID": "01f1f14c432b3c00", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "373" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a29cb76b0fd3a4de21cf9ab85ba98319/18418143830508324829;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7ImV4dHJhY3QiOnsiZGVzdGluYXRpb25Gb3JtYXQiOiJDU1YiLCJkZXN0aW5hdGlvblVyaXMiOlsiZ3M6Ly9kdWxjZXQtcG9ydC03NjIvYnEtdGVzdC10YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMjAuY3N2Il0sInNvdXJjZVRhYmxlIjp7ImRhdGFzZXRJZCI6InRva3lvIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIiwidGFibGVJZCI6InRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAyMCJ9fX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6Im9WWnFkVGpQTXhFTUtuUmxONlk5bVlySWVGUCIsImxvY2F0aW9uIjoiYXNpYS1ub3J0aGVhc3QxIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:05 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/NPfQy2UoEEGvil4wFtl45Nc9hDc\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAK1SXW/aMBT9L95rQz4JBGnqphYQKo0YC+3adUKOcwkGJw62A0WI/z470IexqdvDlBfnnnPPOffaB7SmZYZ6KKX5pgax/7DiKbpCoHCuqy9ojJ+7pRPcdu+K4Qhm2YSN4nEB+HEo7Xiy+LL3ZrzfH24pC3YDxYJ2TKLlLXlBWoQa4axmBJRVcaGsTuj1sKTYKvXfErBUbos/PG+yZDW5f+3f35VTFodPUfEkRjCYaAkJbDGm5VoLLZWqZM+2d7tdK+c8Z4ArKluEF/ZbeHvr2ZXgKyBK2hfGth5M2u+4XTNOsKK8/HgRUcfQvVNYgICSAOod0Nlk9IcBT+wGeX+0NztNvDQ8XiHCywXNa3GmHIxosq+0O+p/S6afbxJzS69KYKIMLHktCCQ4Zf8QMMMKSzihiq/3XNeUaT1VzGnuOW7XiVxv7oadSH+h13EcZ+44nmPyZSAVLZt0M0F1V27u5nLn6cZSmmj9VbJF5BZdqkrU+/4/dH/8IjzgosB6Z+jm6wM66lGkwqqWzRL1yWx4OovjUTxEZ5DqXtIQiIBGI6GF4bltP+y4nhe2/SBADVmo3zAdxijVEsQcCkyZRv0w9KPI992gbaVuVzkuL1SEvU60Jn5OcrpZbtasm/J0WX/KYAuMVyBaudbYUgKYEF6Xyjx+dPwJAYwZfcQDAAA=" + } + }, + { + "ID": "69c877ae66307f4c", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/dulcet-port-762/o/bq-test-table_20180912_1679797627000_0020.csv?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1dd80d8c3edfb659b7bbd5fdbdc7651d/10013028533309096741;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/dulcet-port-762/o/bq-test-table_20180912_1679797627000_0020.csv?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "253" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:06 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:31:06 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo5hheQHSA-BVXA_izvYruXRWA0LNZ39C4qofT-2fPF1LGhOuodKQteoYrAXlghKODkXEIFLooqXCGI2xUVJFSM71lEdw" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vIHN1Y2ggb2JqZWN0OiBkdWxjZXQtcG9ydC03NjIvYnEtdGVzdC10YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMjAuY3N2In1dLCJjb2RlIjo0MDQsIm1lc3NhZ2UiOiJObyBzdWNoIG9iamVjdDogZHVsY2V0LXBvcnQtNzYyL2JxLXRlc3QtdGFibGVfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDIwLmNzdiJ9fQ==" + } + }, + { + "ID": "3a4b7c3f4e7458b7", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo/tables/table_20180912_1679797627000_0020?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9958c7bef1b56ee97602d73e00fd37f9/11577204047395306677;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/tokyo/tables/table_20180912_1679797627000_0020?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:06 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "adbb2de3de4040fb", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "232" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d9f3325c5ce08772885d9f11f7fc478b/13141378466298344517;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoibiIsInR5cGUiOiJOVU1FUklDIn1dfSwidGFibGVSZWZlcmVuY2UiOnsiZGF0YXNldElkIjoiZGF0YXNldF8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMDEiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIiLCJ0YWJsZUlkIjoidGFibGVfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDIyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:07 GMT" + ], + "Etag": [ + "oE4MvRlbpGzA05nLkGiiHw==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2SwW7CMAyG3yW7DpJmo4VKHGBCDKns0MFpmlBoTclok64JdAzx7nO7ckEgUJQodn7//mTlQDZSxcQnS5l8b6HYP1ixTIE8ErAiwbwePU93YbrMx78D1lHBZizla9nvo0JWdfE2jcC2cl3YludyPxZWGLALzpwu6zl84bheD5fLPcbYArfTrltcV3CO5gbSVSDVBlusrc2NT2lZlu1E6yQFkUvTjnRGT9R0x2le6C+IrKFnSLRBMvQONlqzGXoPYq0JYQUFqAiIfyANwuTCYFDftP9/vY1y6lDrb/MccWbRGjJRgawkpLEh/seBKJEhG1GV3T6vrm/z6SicvJDjJ9aobTbcW0AtYaQOA62SGRTn6VCXpygqQFip1UzW1k7nyfUczvFgvern/OSyuCBwuwhb1afC2KmOJVLGVzwa1NlgGIyqCh3Vhpiav5PjH4br7762AgAA" + } + }, + { + "ID": "c0729a14dc303d4f", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0022/insertAll?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "121" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a7127fb39a13cc3555af0ff9b97477e1/14705553980384554453;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0022/insertAll?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJyb3dzIjpbeyJpbnNlcnRJZCI6ImNJa3djSEdOa0dBR1RnWTBubjhWbFFhb1NuRSIsImpzb24iOnsibiI6IjEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwLjAwMDAwMDAwMCJ9fV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:07 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/42MuwoCMRBFf2UZ20XWNp3oFim0WLASi4kZQzBONA9RFv/dYQVtvdPMOXDvCGfPFhQY726V0nNW0ARaY0HNmVJZhjBQvkYBaMFPrk8ppgxqP4qw9ADVtUA/mQhzZBn1fMfgrRRDPGLxk2RBS6Y6zacoLHihnNGRgP40mu1u0w961QhVUs2i+zPz7wevg9wb8ASitOAAAAA=" + } + }, + { + "ID": "eb07855b7046be89", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0022?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "58b3f28b9286ad9be07ddad223294a26/16341785989013841253;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0022?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:07 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "4c2f87b45d2066f3", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "163" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "9e495a194d645c4257f06ffe67ba0ac5/17905960403605200629;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiYmxhaCBibGFoIGJyb2tlbiIsInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiOGw4ZU9FZG15d3hPRVU5T2paZlVwaG42Q1NMIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:07 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/145v-gcAADv9Zmv2PH15HLO9A-s\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAL1TXW/aMBT9K5H3WghJ+EgiTRsqqEVDpQWyaZRqMs4lGBw72E4AIf777JQ+bKv6uJfIuufcc+65ds5oR3mKYrSi2b4Eefq0FSt0g0DjzFSXaIwXIW+1B+G3/G4ESfrIRg/jHPCPO+V67U7VyEi/P6iiRV75j/de5348ifoNtURGhFrhtGQEdKMQUjd6XT9OZs2QhTAZpvnpcJwMk2iyXayTYsO7t7Ox6VLA1mPKd6Z3o3WhYtc9HA7NTIiMAS6oahKRu2/zupXvFlJsgWjl/uXlmizK/cDtCxMEayr452RmnA19CmuQwAmg+IyuuqN3Yryya+TjNG8Ohmg8LjeICL6mWSmv1bPVmZ8KY4iekuH0p+mpg1noekArhjfO60eKHXDDKSQVkmqLjh7mw2n/dj76PjRAqWAMGSan2Z6heI2ZgouxVRrrUllRe7Jug8mD5YOUQk5BlUxbVAJW9bSUV5jR9Kke4Y8c+2spB6VwZqVmJ67x0amlYifhcCzM3iB1aApc0zUF6SzrFEvkYO08e7H3YpdRd5ipnv+v8ct1IVRpSuqlEGNvXeY0t7peJ+j2PN/v9qJWG9Vkqf/FgsAukKfvIpf6LuQvyDE1N4GCbjeIDGD+msbKC3XLE7mOsN+LdiTISEb3m/2OhSux2pRfU6iAiQJkMzMaFSWACREl1/bxo8tvUzylmrcDAAA=" + } + }, + { + "ID": "ee5e91a8b4c0233a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/8l8eOEdmywxOEU9OjZfUphn6CSL?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6f1b545d2e93cdd01d4538d8fc24436b/1023673323270248069;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/8l8eOEdmywxOEU9OjZfUphn6CSL?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:08 GMT" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/61PSwrCMBDd9xRD1iIWXHVXUETQgp+6qSJjM9ZAmtQkFUvp3W1jFx7A1fDm/XhtAMDIGG1YBG0PephrTj2az2aT76Mka7EYfuzQKIdv8I4IUkXvinJHHAQn5cRdkIEzu0l8nBmggyyMwgsbc7zL9jGZxzAW/rPDZ3FdolBDVCH1DeUvZwit9pxQL5SC72oyza9C6hyd+GoqNFiSI2OnTzZKOn8v4ybr0NXDJrZOTvFmvbjG+1W6XSbHQd8FXfABQ4/2rWMBAAA=" + } + }, + { + "ID": "2595ad8d754bf40c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "270" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "db0451fd42f5e546cf6fff00b2a580c5/2659905331882757909;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJleHBpcmF0aW9uVGltZSI6IjE1MzY3MTI2ODAwMDAiLCJzY2hlbWEiOnsiZmllbGRzIjpbeyJuYW1lIjoiaW5wdXQiLCJ0eXBlIjoiSU5URUdFUiJ9LHsibmFtZSI6ImxhYmVsIiwidHlwZSI6IklOVEVHRVIifV19LCJ0YWJsZVJlZmVyZW5jZSI6eyJkYXRhc2V0SWQiOiJkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiIsInRhYmxlSWQiOiJ0YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMjMifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:08 GMT" + ], + "Etag": [ + "KnBUVD6XmEtMdjKdrRwgcg==" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Q0U7CMBSG36XeCt2KbrCEC4mLIaAXcxgTY0hpD6OwtXPtnITw7nZzeEEgkGUX5/Q7//naHdoIyVGAFiL5KqHY3hi6SAHdIjA0sf2JHM3eHr33LDTPfD3hRVQlLBkOLSHqOV6mDEwnV4Xp+B4JODVUg5kTx+07A5fMXc8f2M8jvuM4c/u73WbFeYL0bLiGdDkVcmNXrIzJdYBxVVXdRKkkBZoL3WUqwwdr/E1wXqg1MKPxkRJulTS+wg03bhpfo9gwESyhAMkABTvUKoxPPIzl2/V/p5dVDhsa/rLP3r4ZW0FGa5GlgJRrFHzskKSZdUNC5qWpI7d5XY5f4vApjOzUP5HSBaQniE+bLMtstDVgE5GDmnKqZBJDcdyOVHWoWAHUCCVj0cS79z3Pdwnx+nekPoafXBQnAK9vr1QDKdXmWXFh78LPZLSq8cNoGtYTijWBtjV7Rftf73B9ctwCAAA=" + } + }, + { + "ID": "1b71e2ad0cce4db7", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "297" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e72b30de3a240a5a044656a3fce8912d/4224079746490894245;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiSU5TRVJUIGRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxLnRhYmxlXzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAyMyAoaW5wdXQsIGxhYmVsKVxuXHRcdCAgICAgICAgICAgICAgICBWQUxVRVMgKDEsIDApLCAoMiwgMSksICgzLCAwKSwgKDQsIDEpIiwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiIxUmlnY1NUc2pGUTh0aUYwMHhrUnZzZXlyYVUiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:08 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/BAGzcS23vtRLYzEcmQit3LiWSdI\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAIVT72+bMBD9V5D3JZWS8CsFEmnaui2N0FC0QmjVKVJkzIU4AUywSZZW+d9nE7oP3daCELbv3Xv37uRntKNliiYoodm+gfr0YcsS1EcgcCZPlyjAP73SGH3zvhczH+L0R+7PgwLww4zrX25mTySy7IMIg8enKSnuqLAD+hCl/hJJEqqI0yYnIAYVq8XAdaxJHA3NkGYkWvDt7Z0n6K1h/NqFBw6nGscyi0O+Dmi5k7kbISo+0fXj8TjMGMtywBXlQ8IK/aVe/WDpVc22QATXX2np0gvX31D7lDOCBWXlxziSyhIewhpqKAmgyTPqeP1/2Lig28jbbl4UJFBqnPuIsHJNs6buTp8Vz+JUSUF0F0/DR5nTGlOhboH8eTQNF1qKBeYgVpZhesbYtFam447l61iuYRgr+ZlDgZMc/o+wbK1Hy6oRfS3HCeRXy3IplkJ79dzfBPE00npmXzOu+lrP6mum+tvdfqT2stIUuKBla2WhhN/vWufhEn3fj8xoHbX4d72p/lY1ZTUVl7YtpuHN14V/P5U8DYcAMkxO0T5HkzXOOZwlngssGq4KVys1hjCez/35DHVBKi2SFkBquFilhcKZ17bjmpbleI7nohZci79ibhv7M9JWpIBSdDO/jBapSmSB9QoKTGV5yHYcezy2bXN0PUhMTxgmK8QYW+54R+yMZHS/2e9yL2HJpvmcwgFyVkE9zCTHgRLAhLCmFOqqoPNvBYfAnOUDAAA=" + } + }, + { + "ID": "eb22cff0af71d27f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/1RigcSTsjFQ8tiF00xkRvseyraU?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "ef9b6121be7f050669883891e33edfe3/5787973794207104820;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/1RigcSTsjFQ8tiF00xkRvseyraU?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:09 GMT" + ], + "Etag": [ + "/e7dTLxDvn70K63bYxw3/Q==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/22PTU/CQBCG/8t4LaGKoaYJBxVQojG2wMEYD9vttC5sd+vuFNo0/HemmHjyNF/PvPNOD3tlcoghU+VPg667KpGSIUnRN5o8h9oajxAAkiiZHGOUb17b+cFE4ct0kn20x8k4mc2Y8PIbKwFxD4VCnXuIP3swokJeU6ZuiBnq6qFcvW0WT4sUTsEfoUWG+h/i6xTAzmYpFujQSBz0a2d3KGk1WM8bLZFGtXU0iqY3cKEvk+tUlXK98btlckdqGYbtPj147JzYMqWtFKSsYXC7ZiNAloR+6Aj9u7MSvcdBJPwVfLRVrZH4OrkGA5CCn31WBHEhtOeGaap5pe+Lgn1hntojvw+3cDoDbXG7bGMBAAA=" + } + }, + { + "ID": "adadd13afa997262", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "338" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f2d238346b3788ff469978b870904074/7352149308293314756;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiQ1JFQVRFIE1PREVMIGRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxLm15X21vZGVsIE9QVElPTlMgKG1vZGVsX3R5cGU9J2xvZ2lzdGljX3JlZycpIEFTIFNFTEVDVCBpbnB1dCwgbGFiZWwgRlJPTSBkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMS50YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMjMiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6Im4yaUVyNHhsR1k2THNTU3JzRHhhU2NmMnZlMyIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:10 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/b_IQ02hGSsFhTTFbiLe9G7HVHro\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1T/U/bMBD9VyLvBzYJmq+SNpXQhiCUiNBCkzIxIUWOc01NnTi1nUKF+N/npEWa9gGTFcnxvbv33p39gla0ytEIZbRYNyC2nx55hg4RKFzo0wcU4R/DyuqfD6/KcQjz/IaFk6gE/H0szSwNby1nOY7lxTJJLjIagT8eXN5dCv6AdBHaFs4bRkAd1Vyoo4HnjOZxr3JoIPrPbHzvRTKOhTx/xjFZOBtwdZYEtohotdK5S6VqOTLNp6enXsF5wQDXVPYIL803vebGMWvBH4Eoaf7GZWov0nyH7SvjBCvKq5N5rJk1fAYLEFARQKMXtK8b/sXGDt1F3nfzxqCBmuP1EBFeLWjRiP3pS1sn2daaEN3Og9m9zumMtaH9Bp3NgtMkMK6n50Fk5FhhCSp1LHto+baT2t7A18tzBpZlpfqze+U2LXkOzJjeJOF0Ehufu99UaaKTA8YLKhUlqYDi4ItxGhtxEAVniUGrulGHBsOZTr2YTa//i0zhjMG/EU7bhhw0YdV5Tlr4x+3dM++iH6vQGZ2ODv9mv+13LSgXVLVtDCdJMDs9S8K7QMMbCREUmGzjNUOjBWYSXjVeKqwa2eprd+1YZvPJJJyM0T7Yta4DEAE7R7Rscfax6w1sR2uy3T7qwEL9EXP6/q8j7khKqNT+DuxGnXajRq0eLVOkUGKqRSLX81zfd127f3yU2UNl2bxUPnYG/oq4BSnoerlesWHGs2XzLYcNMF6D6BW6xoYSwITwplLtA0KvPwHa4weD+wMAAA==" + } + }, + { + "ID": "bc33f882b9544840", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/n2iEr4xlGY6LsSSrsDxaScf2ve3?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a692b811e555fbe1a66074ec23c81b36/8988380217427750996;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/n2iEr4xlGY6LsSSrsDxaScf2ve3?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:20 GMT" + ], + "Etag": [ + "SePSBe+EUFrqZSTfxB9l1A==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/yXNsQ6CMBQF0H+pozKIBiMJgygaEwelMuhWyisp1hbaYjCEf7fgdF9yz8vt0YvLAoUo52XTgv7OSrC38UjBtMIaF7WSBtACgSWlkxiuOIZ5kh1188R31sVbsdxFkROVylNgoEFSQGGPaq0qoPY8DhStoGC9WmnrbQL/r6dG+jzR606cHsHFYKzNoSOYMv8DK6eEosRyJR3MMBqmt7161wKs22BEGBh+YAMMcsYAAAA=" + } + }, + { + "ID": "7977497a948e0983", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/n2iEr4xlGY6LsSSrsDxaScf2ve3?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a692b811e555fbe1a66074ec23c81b36/511208429980347804;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/n2iEr4xlGY6LsSSrsDxaScf2ve3?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:30 GMT" + ], + "Etag": [ + "W1F92XraymntRQbo+afAvQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/yXNT0vDQBAF8O8yHk1BU6kY6MH/Ch5MgqjHzfYl3brdiTuT0lD63d3Y0zyYH+8d6MeFFRXUuO53QBzPOmg5hQoyeJV0eg4CyghquiQ/L59u8q9oxm3Qqmz43LS3u3K5TGLDTYUWEcGCigP1kTew+joNrAZvobOeo86uF/lJ/39C7h7j1d4/fy/epK6jPOxNbdt8h3lSnq1RxyHBj5qOGSmr8XejQt4jW4hgKrk4Fd7ztvfQtK5xQEbW2DVenFLRGi84/gH3ZSvQ8AAAAA==" + } + }, + { + "ID": "45574ac42a27e48a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "300" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "13527f6a059baee6a455a783a443e824/2147440438609634604;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5IjoiU0VMRUNUICogRlJPTSBtbC5QUkVESUNUKE1PREVMIGRhdGFzZXRfMjAxODA5MTJfMTY3OTc5NzYyNzAwMF8wMDAxLm15X21vZGVsLCBUQUJMRSBkYXRhc2V0XzIwMTgwOTEyXzE2Nzk3OTc2MjcwMDBfMDAwMS50YWJsZV8yMDE4MDkxMl8xNjc5Nzk3NjI3MDAwXzAwMjMpIiwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJaVGZzdXRkSTJ1MVByeXJXazBGbjlOY295aXQiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:43 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/FInW9bX304XYgQ5Wny1hStPc2U0\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2+bMBT9K5H3ZZvaYEx4RZq2LqEVWpqmhCxtVQkZcyFeABMwjaKq/32GptLUbd2ELFm+555z7oNHtOVlgsYo5tmuhfrw7oeI0QkCSTP1eo9m9M4p8WjqfCsufFgli9yfzwqg64tGO/fLtRvfGHh0c5tdm+vyoG+WcsHICt8jRcI74qTNGcjTStTy1LbIeLUc3oVp08rEJ62+qA/1eovPS3fOxIFLldVAns54uVW5GymrZqxp+/1+mAmR5UAr3gyZKLQXv9oD0apa/AAmG+2VlqZqabQ31D7nglHJRflptVTKCh5ACjWUDND4ER15/T+U8YzuI29X86KggErj6QQxUaY8a+vj62PHEx4qJYiuV15wq3L6wrrQ8YKW3sybhIOPg/Pg6nJQ5MNF4E39Sfj+8mrqzQYJlbQBGRGsO9jVSaRbtqs+i9gY40gdfVgcokIkkJ8MwrOvM++/ciSNc/g7ghgflNkEGsnLvpqww/+7cUfpPhoxJ3VwjN1Yd+IUkxRS0x4xwCZ2wMQjSK3EsS2LqrzeTp9FS1EaLmHYcVyb2JQCxDFLTCtJDJyalm7Epkns2NEd0ve8BiphyptKNPw4jUngnYVe5J9Hc8+belMlsK/5a9Q68BUoDFbziUIrTFVzoWDdVPx56AVnk9D/3gXaBmaQUXZY7nI0TmnewJOSbiSVbdM1pbt1U1Zcc39+gY5BrtrHekDvsmsjLzqcbhqWrRMDG7ptoR5cy99ixHZ/3ZhepIBSHlfqeXNQ50QZrCMoKFf2kGFZhusahj4yT1XrJdZFIV2q2LbMyFjGd5vdNndiEW/aLwk8QC4qqIeZ4njgDChjoi1l9yeip5+0n2eyRAQAAA==" + } + }, + { + "ID": "47f9e953871d8291", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/ZTfsutdI2u1PryrWk0Fn9Ncoyit?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b8e4078d2fd34a6edc4fc201727f4ca7/3711614853200993980;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/ZTfsutdI2u1PryrWk0Fn9Ncoyit?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:44 GMT" + ], + "Etag": [ + "AKQWj2M3NfkhvZ42PxviOA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/51SbU/CMBD+L/UrJDiJL0v4MHAocY4xR0gwhnTdDQrdOtsbuhD+uy2aYKIm6qde7563XLsjG15mxCUpXz7XoJqTJeDEFjHoWqA2RyVLDaRFAOnSIL27yWzt3J+F+Wa1nXed6HXLx16vZxCaraCgxN2RnIPINHEfd6SkBRhapSDjDCFbCJqCMGhsKjsYhYl/48emUcjMNsJpEHj9wCf71k/sRaVkqo8asT8Yx9dHidiPfC/xbedrkv/5y/RIGQZjL/mO8PSJwsuqxj/a/D6acSJrmcaQg4KSgV26CbkGhiP7nlktGGC7kgrbF+cOOaAPk3mS6xqzkVOfRqpRs01nWF6FTDbcphWSUeSyNMDpg4lGUCIVsXwxKyRd8nHvNwg6UpKB1mBFLzvvDgNZVALQxEFVQ4swar7ErVF2cyo07N8ALzxfb3ACAAA=" + } + }, + { + "ID": "2553982631aee796", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon392c0889727aaeebbcd56dd30f5613b5527b8182/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "b8e4078d2fd34a6edc4fc201727f4ca7/13752962159029508612;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon392c0889727aaeebbcd56dd30f5613b5527b8182/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:44 GMT" + ], + "Etag": [ + "J5WSO78wI0zV3ElLcKd20w==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6WRTWsCMRCG/8v0KmWSzORD8NYe2gqCBT2UPcS6ytKlUk1dqux/N6xad+1SFryEmXnfSZ6Z7OEj+5xDH2bZ8us7Xf/cBT/L0wcf/DDbBOhBGvwy6s88fR0ZWzzhbqIe8+H7y1xiMRhER1gFn49XxSbaKObrKnzbw6I6t7GMUPaq6JjXJXGWAO+VZWJrUCnlJDu0UCblSW69LvZoQUxCOq01GkJrqp7kbJC/VgHHasvT/1NZlGi0I2YrjXUkOlAJZ5xUyETCSIHsmlR0O1Vz7i5MV9ttEqmL8Q9Rx9+7nll3YGrfbVLbTp0qKQ+nPsgosAIAAA==" + } + }, + { + "ID": "13f71ccbef91dad6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026pageToken=\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "2fdc007d79ec19ab498ea08dbb090280/5275790367303980620;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables?alt=json\u0026pageToken=\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:44 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/VGhoMTYH5d0oo5eFRQfnWXetnP4\"" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:31:44 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAM2VXW/TMBSG/4u53cB2vnNX1K5UpKOrCttgU+Qlp8WQrzmORFX1v3O8thSJlsJgXRTlxn593pP3yZEX5KssUhKSOzm7b0DNX2hxl0Eka01OCGgxw70bEomPfkHtrv827w/gfTrKBudRDuKyX7/60P9cDifXb5yUlqUDZ+OLaXF5BboY2TcEizwUrEn4abHbCyXSrKZNloA+rUqlTz2Xh6nQogYdc8p8GjAeM9cL8HG5RymN8WUv83mclylkG5sxTEFBkQAJF6RS5RdI9GBHcdSvy692D1ttHB70P2yXuDqv0I0M33V7EYoSBULLspjI3Cwzx3I9xrln8yBA+RNkoOMcORllXAmlpXGPk6ypNaiYHjmZA81s85p0Xkc9cxRzGm2UspiZ9taSbufaHFifXu9NJWSp+ZtIITDh2+W+yKnv+I75fPhWSbVD4PrYPX0GJqxNTNjfM/k50mFtAl3l+HhSvuOxNpLibSLFH0NKwX0j1VZzJjOsRUKtGvgHYgGz3FYSs9pEzPpfs3WyQrPqD54Qq2093yCaAvsVzDk22YP9bOH2ria98XnnN/c/Y8z22pksP/rMHOzn17HZE6vr2/xP7vhbLFhqkQ005DgJ3vI7i0sGlvgKAAA=" + } + }, + { + "ID": "c8b227a96b7a2281", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/my_model?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "38531a00c54b0e04c83601fb097fd647/6912022380211392476;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/my_model?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:45 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "4a3e2801117dcc2e", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/my_model?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8235851eb506716912b992e86342842c/8476196794819528556;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/my_model?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:45 GMT" + ], + "Expires": [ + "Wed, 12 Sep 2018 00:31:45 GMT" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAALXNQQrCMBAF0KuEWbeShNLaHMClK3ciYdqMRUgykqQLKb27KZ5BPh8+b/M3oJQ4gdl+I4O5b+A44CuCgcXzhB4aSISZD4lcLrxGVy1QzrhQxSsX8TzUiBtOnoRb/UylfXMq7dBr47BgpmK1VGc5Km1VP4w1vR6klLZWncLHBnbkYX80MNcFppPdH2/2L6lBb0v9AAAA" + } + }, + { + "ID": "31a386ffea9e7dd4", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0023?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5e9d037939264596278ee677404beca3/10040372308922515452;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001/tables/table_20180912_1679797627000_0023?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:45 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + }, + { + "ID": "ad1c86aa72ee34bb", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "155" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "086104c5814119e861666406996e7c88/11604547827303626892;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ICoiLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6ImJzSUZmZjVmQ1kxOURGTXZTV0d3T3BmRHMxSSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:45 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/Mv8TNOflLzPguuj5N9GyEwhqN70\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAALWSUW/aMBSF/0rkvVWFEFJCQJq2CQKKBqGFsKprq8k4N8HFiYPtBDHEf5+d0YdtVd/2Zt1z7/nuufIJ7WiRoCHa0GxfgTh+eOEbdI1A4UxXn9AMf/eLzs3Y/5pPQ1gntyyMZjng+6m057UfR4uUzX7eZlX10osG02Nw2O6jfucJaRNqjJOKEVCtkgvV6nvd4XrV3shwkqa9dPTgDMaTeb26nx4WZTqWTqinJLB0Roudnt0qVcqhbR8Oh3bGecYAl1S2Cc/t133tumuXgr8AUdL+i2XrLNJ+h/aJcYIV5cXH9UqTdfsSUhBQEEDDE7r4hm/E+N3dKO+neSXoRs04XyPCi5RmlbhUT8YnPpYaiO7WwfJBzzTBjHR5mJPoPawrrZWCckGVqYZRHCy/jOLwW6CFSsIMMkyOqz1DwxQzCWeNkwqrShoz8zKU8SIy/SAEF0uQFVNGFYBlsyUtasxocteg/9h/fynlICXOjNUqmAWj2Lqy8koqa4trsLA1WS7mFmFYL2RhZT06Q//ZBG+AepPH/w97vgSnUlHShCcaaZxjmhsvp+d6fafrdnqe10FNs1D/aH3XM4cqkjeVc3Nz8QNyTPXFket57mDgus5Nr7VxfNVxeK4GuNsf7IibkYzut/sd8zd8s60+J1AD4yWIdqY9akoAE8KrQpnPjc6/ALj0Rs2XAwAA" + } + }, + { + "ID": "37ed6993bb102b34", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "241" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a537a4d2b1dc702276cb9bb3f91f50d3/13240778736438063132;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IklOVDY0In0sInBhcmFtZXRlclZhbHVlIjp7InZhbHVlIjoiMCJ9fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiZVh6Y012anczcXpoQ0RFSWh6MFJES0JGZE1VIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:46 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/dHpsGSs5dyWA0K48XUljgnFqF2s\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2/aMBT9K5P3tSUmLxKkqesgsKgUtTzabuuEHOcmGJI4xA6IIv777ECnrZqqfbN9zr3nnHuTA1qzIkZdFLF0U0O1/7jiEbpAIEmqXp/RiHz3Cmz3vZt8GMI8vsvC8SgH8jgURvy1FMOpcOL94zW+sb2nebZKi8FmYIpnpJow3TiuMwrysuSVvOy4Znc+bcHTC73drnbW5mXZ6wfh8gVP+jdfBvHtXFUJyJIRK9aqdillKbqGsdvtWinnaQakZKJFeW68+jW2plFWfAVUKkN/axkqizDeUbvKOCWS8eLTfKqUFX0CCVRQUEDdAzr3Df8R48RukPfTvCoootI4XiDKi4SldXV+Peg+s32pBNH9PJh8UzVNMA2dD3okyseHK4XFICQrmuIZibL/8BkTSQSc0AX1Eg9H2I/aXpRgM4HE6dgUsIM9cLANiRt7Hdclqk7q9k0VKXjh0JiqKuwAAHVMoC71/Q62rSiOrMRy/diJTNuMmogVEAl9Jkou2Dl8bxJcz4JFOFiMg6Af9JXArmJvWY+TUJFmk/m4p9iKU1aMK5oeQjieBZPr3ix80EAtYAQpofvpJkPdhGQCzoO7IxXJQUIlUPeHGs7r9TTkA5KnYat2rq3d/iY8kKxuGNvTAWF0PP48KoqQRNZCQ/qkIeVwHI6H6AwytRTaEJrsejks17y2Y7mdtmlhx/c91JAr+RZzsWf+ufZGJIdCnr+LaTAKejOknajY1QJywlRoZLmu5fuW1badS7VQids8lz4xO/6aWilN2Wa5WWdexKNl/TmGLWS8hKqVqh5bRoFQyutC6t8JHX8Bhd46fgkEAAA=" + } + }, + { + "ID": "d7faa277fb2bf8a4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/eXzcMvjw3qzhCDEIhz0RDKBFdMU?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6f42fa58ddfd49edc16feec08d833d4d/14804954250524273068;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/eXzcMvjw3qzhCDEIhz0RDKBFdMU?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:46 GMT" + ], + "Etag": [ + "wKNgfynWvMyk5B6z+hNNww==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "6f42fa58ddfd49edc16feec08d833d4d" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P206DQBCG32W8lCaosSYkvZAWlZQSxRJNjDHbZTh1YenuUAKEd3epXs3pm3/+GeFY1Ak4cCiyU4uqv8qQ3uYkQt0K0iY0stYIFiCxzJDdNszSvv447/rjvbscrvMw7LrVyhCa51gxcEZICxSJBudrhJpVaNZS+8cQ1Ddz4Yd779mLTKOSydwI4yB4dAMPpu/JglIeIkxRYc1xVmuULJGTPxtNWsGRFo1UtHhY3sKFvkzwc+C7c9ndnYZ8vfH8fLCjzdZ9SnaxoYTkjApZGzB+B3OEJDERyc64hBv4r92eUL8qyVFrnEXtvwNrWTUCybgh1aIFnJlXXwoCJ2VC4/QLXtNYaEgBAAA=" + } + }, + { + "ID": "c888da947632f2bd", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon5cdc9b105eeec52ec6c997043bdb3f369d5b242b/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6f42fa58ddfd49edc16feec08d833d4d/6399838957619946996;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon5cdc9b105eeec52ec6c997043bdb3f369d5b242b/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:47 GMT" + ], + "Etag": [ + "mBJdqoHVkzGK0Izu9/IdgA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "6f42fa58ddfd49edc16feec08d833d4d" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8rnOnmlFOZ7hGVXuXsbeFaVWup7pqQ72toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwobKNXGAiEAlh31B24AAAA=" + } + }, + { + "ID": "3dc8e6fbb4b77c69", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "246" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8cdd4369871520af5ff2eca55718c07f/7964014471706156676;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IkZMT0FUNjQifSwicGFyYW1ldGVyVmFsdWUiOnsidmFsdWUiOiIzLjE0In19XSwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJMaWtIREhkdFdWMGlycDg2Q0xFb0hqdTBPVk4iLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:47 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/yoIc1PWRZs7y1gKNiljmqspiKRU\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Ta2/aMBSG/8rkfW2JQyAXpKmrIG2jorQLAbSuE3Kck9QliUPsgBDiv88OdJq6qdo32+9zznsuyQGtWZWiEUpYvmmh2X9+5Qm6QCBJrl6f0ZQ8uRUeTNz78jaAefpYBOG0BLK8FcaeB9R8XEZPwtmb+X3IitdyI2p2H82fkUrCdOK0LSjIy5o38tKx+6P5rDdl67vJXSqXC8ya2rXHU5/fvbb4YRGqKAFFNmXVWsW+SFmLkWHsdrteznleAKmZ6FFeGm/1Gtu+UTf8FagUxjsvQ/UijA/crgpOiWS8+jKfKWeFR5BBAxUFNDqgc97gH22c6E75uJs3BwUqj+MForzKWN4259eDzhPva2WIvs396LuK6RrT0vmgR6Lq+HSltBSEZFUXHJOk+I86UyKJgJO6om7m4gR7iekmGe5nkA2dAQU8xC4M8QAyO3Ud2yYqTur0XRSpeAUWIa7tOTbYtkUgS8gALA9jClZCLXPQT01ME2/YtdgAkTBhouaCnZsfR/517K+Cm1Xo+xN/ogx2DXtPLaNAQXE0D8eKVkzdMK4wPYQgjP3oehwHCy20AqaQE7qfbQo0ykgh4Dy4R9KQEiQ0Ao1+qOG8XU9DPiB5GvbN9OE6tge63t/IghRtx2xPB2T1TEUcfx4VJSSRrdCqPmlVlRkG4S06i0xthnZANwC9IVZqzhxatmP2LewMTQt1cCP/0myM/9x9Z1JCJc8fx8yf+uMY6UpU780KSsIKXaLah+dZagXDS7VViU1eSo/0HW9NrZzmbPOyWRduwpOX9msKWyh4DU0vVzm2jAKhlLeV1P8UOv4CyxjwUQ4EAAA=" + } + }, + { + "ID": "ecb80579551568f3", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/LikHDHdtWV0irp86CLEoHju0OVN?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e6fd9e3aec6244a75722cdf28725eb5c/9528188886314292756;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/LikHDHdtWV0irp86CLEoHju0OVN?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:48 GMT" + ], + "Etag": [ + "3Ae1LB2khJzJooW6W5J33w==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "e6fd9e3aec6244a75722cdf28725eb5c" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PQW/CMAyF/4t3BamAxqZKHIAxdSiCjQ16mKYppG5JSesucYW6qv+dlO1kP/mz33MLZ10mEMJRZz812uYuQ37rmx262rDzpaLSIQwAWWaenMxxJBbj82n9uyaKp/H9ejK5zGaecOqEhYSwhVSjSRyEny2UskC/lgbfnuCm6sWz2M4/vCwo6eVmL8R8IVbQfXUDyOm4wxQtlgr7W5WlHBW/9DGT2ijkYUWWhw/TMdzo20Toc/QUJRwfAm2rx+lSrCjK62B72HjKkJKsqfTg/h28CRNLs6OLzwgj+NeLhtG9WlLoHPZHgz+DJRWVQfZp2NY4ACX9o5FmCFNpHHZXOPJHMEYBAAA=" + } + }, + { + "ID": "192bff9bf8042233", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anone3aa86976e663aefba4e3900ce3bc3142d10cb95/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e6fd9e3aec6244a75722cdf28725eb5c/1123073593409966684;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anone3aa86976e663aefba4e3900ce3bc3142d10cb95/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:49 GMT" + ], + "Etag": [ + "njqOAG4hzOa/p8mHIVrFyQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "e6fd9e3aec6244a75722cdf28725eb5c" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8rnZRX6O7qbZFT5J+oXWOR6eIYVuVUG2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwob6xmaKNXGAiEA44jPuXEAAAA=" + } + }, + { + "ID": "0e2620bfdc150202", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "253" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "2aafaff8313b432ed0f106b8558f3710/2686967636814433260;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IkZMT0FUNjQifSwicGFyYW1ldGVyVmFsdWUiOnsidmFsdWUiOiIzLjE0MTU5ZS04NyJ9fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiVElNaXc5RTdtMWZqbXQwWHpuVkhzVkZiV3QwIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:49 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/DwC62ZFk5HS9ESLF4CEj-kq1sWM\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Tb2/aMBDGv8rkvS3kf0iQpq6C0EajrIMAW9cJOeaSGpI4xA6IIb777JBOUzdVe+f4fnfP3XPOCW1psUZ9FNN0V0N1fL9hMbpCIHAqb5/QGD96hW4PvU/5bQjz9UMWTsY54OUt14aHgWs+jrbO3cwPZuORPQg2ne3O4Mv7JySLUFV4XWcERKdklej0XLM/n3Wj8J4e/KCXG8kmF/rXn8Xiji9G8VLoMotDloxpsZW5z0KUvK9ph8OhmzKWZoBLyruE5dpLv9re1MqKbYAIrr3S0uQsXHtD7TpjBAvKig/zmVSW+BQSqKAggPon1NYN/zHGhW4ib0/zoiBBqXG+QoQVCU3rqr09qTrRsZSC6Ms8mH6TOc1gKtQelCWyj3fXMrYGLmjRJEc4zv6jzzUWmMMluiJe4umx7seGFye6mUDi9GwCuqN74Og2JO7a67kulnlClW+ycMEKzyeW68WGDdiy3dg0MfGIY8hLJ4EYXAKO4RLHb0asAAsYUl4yTtvhB9PgJgpW4Wg1CYJhMJQCh4q+ppbTUELRdD4ZSFoyZUWZxJQJ4SQKpjeDKFyoQM1hDCkmx9kuQ/0EZxxa4x5whXMQUHHU/y7Nefm8mHxC4mL2aPz5JnJt1e9vZIGzumH2lwOyuoZtOD50vB46n3+cJcwFFjVXkDopSHY7CSe3qA1SuSDSAI0PalE0V5zhWG7PMC3dt3QPNXAl/orZpv7nE2hEcihE+0ZmwTgYREh1Ii2oVpBjmqlOXdfyfcsybKcjlyt0g+XCx2bP3xIrJSndPe+2mRez+Ln+uIY9ZKyEqpvKGntKABPC6kKoXwudfwHTaLFeFQQAAA==" + } + }, + { + "ID": "a10c1b77d47414aa", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/TIMiw9E7m1fjmt0XznVHsVFbWt0?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "39fe7a89e5c97f870d11fe7586125a60/4323198545948869500;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/TIMiw9E7m1fjmt0XznVHsVFbWt0?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:50 GMT" + ], + "Etag": [ + "hOD34xfijgtbu39mVu4A8Q==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "39fe7a89e5c97f870d11fe7586125a60" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U7CQBCF32W8LUkRItKEi6IQSKpIhWpijNlup2Xr/tTuNFibvrtb9GrmZL6Zc6aDT6EzCCAVxVeDdXtVIO2HJkbbSLKuVEZbBA+QWOHI0+5+Mv3ORVlQ2kzmKmmm4e1+sXCE5SdUDIIOcoEysxC8daCZQreW+x+OoLYaxDrahQcnlckG+XiMonAZraB/7z0oTRpjjjVqjsOtqjYlctoOMbNGcqRRZWoazW6u4UJfJoftgzjPVzM1zktF/uuPTjY2Wacv5DtKGs5IGO3A4zM4EzLEZGzOLiOM4V8vW0L7VBuO1uJw1P8zuDOqkkguDdUNesCZe3QjCIKcSYv9Lxc2qvdGAQAA" + } + }, + { + "ID": "3e8713fbb4a69777", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon89c368b14ea346b22ac8c51c365febe6ce516c59/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "39fe7a89e5c97f870d11fe7586125a60/14292489357234307268;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon89c368b14ea346b22ac8c51c365febe6ce516c59/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:50 GMT" + ], + "Etag": [ + "4ECZ+QCznL0WtspmF+ng8Q==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "39fe7a89e5c97f870d11fe7586125a60" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qbuDpHaQc6V+X5GISXFBfkumnnpVsE2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwob6xmaGJpapupamCvVxgIhAE9fquF4AAAA" + } + }, + { + "ID": "a61539ce7b1bbf52", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "243" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "35274084dd3f6d485834311e7dd301a5/15856664871337293908;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IkJPT0wifSwicGFyYW1ldGVyVmFsdWUiOnsidmFsdWUiOiJ0cnVlIn19XSwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJiUXM3RUFBNDdJbUhSYmh5dnFYdExtTlJuRnQiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:50 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/YPs8xJyppVpUQe_c4LAbK6kkHdc\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TXW+bMBT9K5P32gbCN5GmLktoy4rSliTtunWKjLkQN4AJNsmiKP99NkmnqZumPWF8zr3nnnNhj1a0StEAJTRft9Ds3r+wBJ0hEDiXt88owl+9SrfG3k15FcI8vSvCSVQCfrzi2tMd93583tX1Qz2/hwWxomFy46xW1yl5RrIJVY3TtiAgzmvWiHPXMQbzaS+5524wHFpuWF7HyXK3WX8RUTmJq0shqzgUWUSrlaxdClHzgaZtt9tezlheAK4p7xFWaq/zahtDqxv2AkRw7Y2WJr1w7R9qFwUjWFBWfZhPpbKkx5BBAxUBNNijU9/wLzaO7A75t5tXBUmUGoczRFiV0bxtTrd71We2q6Ugup8H8ZOs6Ywp6HRQkcg53l1ILAUuaNUVz3BS/MecKRaYwxFdEC/z9ET3k76XZLqRQWa7FgHd1j2wdQsyJ/Vcx8GyTqj2XRWuWAW+Q5zUMPuZl/rEth07dczEtw0vTXW3T5zEJ75h2Z3FBrCAMeU14/RkfhQHw1mwCC8XkyAYB2MpsG3oW9ZjHErSLJ5PRpItOXVDmaSpEMLJLIiHo1n4oICWQwQ5JrvpukCDDBccTsHd4QaXIKDhaPBNhvP6egx5j8Qx7E+3t5Ea9hf+gIu2I2yOByQa+Tgcvh8kiwssWq5QdVKonHESTq7QCaRyLaQjdO7VemipeH3bdNy+DE53LR915Eb8gXmG+/viO5ESKnH6MqZBFIxmSE0ijTcLKDGVtpHpOKbvm2bfss/lSoXeZ6XwseH6K2LmJKfr5XpVeAlLlu3HFDZQsBqaXi57bCgBTAhrK6F+KHT4CVejPe4LBAAA" + } + }, + { + "ID": "ba860fefd748e371", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/bQs7EAA47ImHRbhyvqXtLmNRnFt?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "19d4e6800c9fb465f17bea31449e7461/17492895784766632164;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/bQs7EAA47ImHRbhyvqXtLmNRnFt?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:51 GMT" + ], + "Etag": [ + "JnAbfnZwP0x8B/iTdIpdRA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "19d4e6800c9fb465f17bea31449e7461" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8pRGNEUPSCzCYYght0SaNxphld6DUZZfuDlZCeHeX6tX8fXPmzAhfjRIQQtnUpx7NcFUjbeekQNtLsi50WlkED5BY7chnFZWVejtv/J+H+Lp5FWknimi5dITlB2wZhCNUDUphIXwfQbEW3VrlfzqChm4u4vU6S6LcNVot5ka+y7IozhKYPiYPjrossEKDiuOs1hl9RE7pbFT0kiMtOm1oEdzfwoW+TMqtDZIougvSdlWUh+H7tKeszQv1RI6SmjNqtHLg7gXcEdLEZKHPziXcwH8dD4R2YzRHa3EW9f8OPOq2k0jODZkePeDMvbpqCMKKSYvTL+AE47VIAQAA" + } + }, + { + "ID": "d1f374d3bcfc5532", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anone96c6d231f8d9c5565d63b9528dd071c6b9c9245/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "19d4e6800c9fb465f17bea31449e7461/9015723993024326956;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anone96c6d231f8d9c5565d63b9528dd071c6b9c9245/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:51 GMT" + ], + "Etag": [ + "H4rCBIQmGR//+MI3e/zwHA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "19d4e6800c9fb465f17bea31449e7461" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8p7mBQ5O3kG5roH6etr+3oap+pXlXs42toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwqXFJWmKtXGAiEAwlLhIHEAAAA=" + } + }, + { + "ID": "14130b4c2be27779", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "247" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "7c6128b511c71ee214684319482eabe8/10651956001653614012;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IlNUUklORyJ9LCJwYXJhbWV0ZXJWYWx1ZSI6eyJ2YWx1ZSI6InN0cmluZyJ9fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiYlhWdzhNY1Nwb25OZlhiSUl0alVnR2lZRHliIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:52 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/Dmfxdk16HLCHEr6sLkkO60_yRYI\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2/aMBT9K5P3tSUvEhKkqasgo9Eo60LoY+uEHOcmdUniYDswhPjvswOdpm6q9s32Ofeee85N9mhF6wwNUUqLdQt89/6ZpegMgcSFen1EU/zNr83+2P9cTSJYZDdlNJtWgO8mwhhX+c9sZXlX09FVyD0xXa2+eOZyFz9Ej0g1obpx1pYE5HnDuDwfePZwMe+l97db/5rMG1bP8vs0iuTzopjQh/FOSwso8ymtV6r2ScpGDA1ju932CsaKEnBDRY+wyniZ19jYRsPZMxApjFdahvIijDfULkpGsKSs/rCYK2VFjyEHDjUBNNyjU9/oHzaO7A55282LgiIqjcMZIqzOadHy0+te90l2jRJEXxdh/KBqOmMaOh10JGqOdxcKy0BIWnfFCU7L/5gzwxILOKJL4ue+mZpBavlpbto55O6gT8B0TR9csw+5l/kDz8OqTur2XRWuWe0OPNfOwAQzxYGbB2Zm2gPXAstyIfDAzDwfO1bf7ixywBLGVDRM0JP5URxeJuEy+rScheE4HCuBLaevWXdxpEhJvJiNFFtxGk6ZoukQolkSxpejJLrVQCtgCgUmu/m6RMMclwJOwd1gjiuQwAUaflfhvFyPIe+RPIY9T+JoNtHj/mbc4rLtKJvjAQnJaV2gw+HHQfGExLIVGtcnjas5Z6cm+omq1ZCO0CWgV0QrzbNcxxtYtmPZVt9HHZnLvzDb8f5cfidSQS1PX8c8nIajBOlJlHm+hApTZR05nucEgaPCd8/VWqVpsUoG2B4EK+IUpKDrp/Wq9FOWPrUfM9hAyRrgvUL12FACmBDW1lL/VOjwC7tjHZEPBAAA" + } + }, + { + "ID": "f5ef0a7129a6fec9", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/bXVw8McSponNfXbIItjUgGiYDyb?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "76f3796a2b740b314da636630081f1b2/12216131520034725452;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/bXVw8McSponNfXbIItjUgGiYDyb?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:53 GMT" + ], + "Etag": [ + "fuX/YJxINiP+HyifgbDtrQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "76f3796a2b740b314da636630081f1b2" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PQU/DMAyF/4s50onBAVClHRhDW1GptpaiTQihNHVKStqUxNWoqv73JYOT/eTPfs8jfMu2hBAKWf30aIaLCmnnmxRtr8i60unWIgSAxCpHin5/dXj+jRK5vdwMUlTFisxusXCE5V/YMAhHEBJVaSF8H6FlDfq1+acjaOi8yF7TKFk73ejS6ySP44dl/ATTxxRArYsUBRpsOfpjndE1cop8zrJXHGnWaUOzu9sbONPnSbF/O96/8MzFTcS+iCKq82otD6uhcJTSnJHUrQPzDJwJaWIq1UcXEq7hXy8HQrs1mqO16I/O/wweddMpJJeGTI8BcOY+3UiCUDBlcToBzqyGnEcBAAA=" + } + }, + { + "ID": "a9340f05db829f75", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon57652de0e0ba95f90d02751e115e96e0d68a3142/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "76f3796a2b740b314da636630081f1b2/3811015123340647060;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon57652de0e0ba95f90d02751e115e96e0d68a3142/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:53 GMT" + ], + "Etag": [ + "UlFFX1REA974RY1d0zLcvQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "76f3796a2b740b314da636630081f1b2" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8qH5ri5RRgGuTpampsERRqmGFT5JJcF2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwoXlxRl5qUr1cYCIQA//B0FcwAAAA==" + } + }, + { + "ID": "713a092cf711a45e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "252" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "56f21fd32a93b4db6b1ebe585f2f6333/5375190641738535460;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IlNUUklORyJ9LCJwYXJhbWV0ZXJWYWx1ZSI6eyJ2YWx1ZSI6IuaXpeacrOiqnlxuIn19XSwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiIzMVVzb2hTTFoyTXhQNkE2SFh3eTl2MFpFZkIiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:53 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/NrDwZDIFwLAF2CAbVLgxM5wCAoE\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2T227TQBCGXwUtt218ik+RUAmJWyzcqCROC6EoWq/HzhLH69jruFGU5+AGcccN4rkqHoNdJ0WooIq79cw388/8u96hJc1j1EMRTdc1lNvnn1iEThBwnIroLQrwzMnV7tB5s7rwYRpfZf4oWAG+uaiUUTlsZkP/vAn65/qgH10H6d2l2Qz6zLtFogmVjeM6I8BPC1byU9vSe9NJx9CmFVtMgpl+eXdl9a3X75qtu1FnXvJKVFWQJQHNl6J2wXlR9RSlaZpOyliaAS5o1SFspTzMq2x0pSjZJyC8Uh5pKWKXSnlC7SxjBHPK8hfTiVAW+BgSKCEngHo7dOzr/2ONA91mnt7mQUGAQmN/ggjLE5rW5TG6k33CbSEE0dupN34vatrFZOp4kJaIOZ6diVwMFad5WxziKPuPOWPMcQWH7Jw4iaNGqhtpTpSoegKJaXcJqKbqgKl2IbFix7YsLOq4bN9W4VzMbJIkckWxqaoWcZykCzZOdNexcZw4ru7aBhYRaFcsAXMY0qpgFT0uPxh7/dCb++fzkecNvaEQaEr6mLoZ+wIKx9PRQNCCKUrKBCZN8EehN+4PQv9aJuoKAkgx2U7WGeolOKvgaNwVLvEKOJQV6n0Q5jx8HkzeIX4wexKO/dGFHPc3cY2zukU2hwO6//zt/suPn9+/3uZov/+4F3DFMa8rCcmThMSwo2MnGaLifkgLtDbIe6IryWmmYdmabmiG5WiohUv+V842nD9fQCuygpwfn8jEC7xBiOQkwoFyDitMM/kILctwXcPQuuapuFuuamzFXazb7pIYKUnperFeZk7EokX9MoYNZKyAspOKHhtKABPC6pzLPwvtfwFj+yj/FAQAAA==" + } + }, + { + "ID": "15e06ea6ff49ee86", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/31UsohSLZ2MxP6A6HXwy9v0ZEfB?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c30fa919e1be1052600d340c1f84803d/6939366155824745396;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/31UsohSLZ2MxP6A6HXwy9v0ZEfB?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:54 GMT" + ], + "Etag": [ + "/KyzyQmttC73LqlrrgeDIg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "c30fa919e1be1052600d340c1f84803d" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P0W6CQBBF/2X6iilqgimJD2JNJaVGoSSNTdOsy4DYhcXdoZYS/t1d26eZmzkz904PX2WdgQ+Hsji3qLq7Amlnmxh1K0ib0shaIziAxApD3j93v92uIlrOptFZKFXgY1jM54bQ/IgVA7+HvESRafDfe6hZhWYtdz8NQV1jRfIah5snoyuZWb1Jo2gRRCsYPgYHTvIQY44Ka472WKPkCTmFNmfWCo40aqSi0cybwI2+TabjVMtjEu0nLz9bb+Gt3y7dw7e7X+WBoYTkjEpZGzBNwJiQJCZieTEhYQz/OugI9VZJjlqjPer+GSxl1Qgkk4ZUiw5wZj5dlwR+zoTG4QoHR1ZzRwEAAA==" + } + }, + { + "ID": "4d4f410bd63f756e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonf5cfb9f805006c88f4e7af2987adf892973ae7ae/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "c30fa919e1be1052600d340c1f84803d/16980713461653260284;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonf5cfb9f805006c88f4e7af2987adf892973ae7ae/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:54 GMT" + ], + "Etag": [ + "mQl8gDuys0qc1iYRrYsGng==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "c30fa919e1be1052600d340c1f84803d" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8rnBuZYpLuUVhYbFCYbZkYGFUUWu+el29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwo/m7702Zw1L1bNi8lTqo0FQgCBnykVeAAAAA==" + } + }, + { + "ID": "50f1a2cf650a49a0", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "245" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "37d736db24dc79fbbc8ca6cd40d32885/98425277511778444;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IkZMT0FUNjQifSwicGFyYW1ldGVyVmFsdWUiOnsidmFsdWUiOiJOYU4ifX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkZDSjlMcXhmR0psUlhHS3Z4czhqMmFCb0dESSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:55 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/_zEVlcXF_2p0q3oyBWr7JxPnM-k\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2TbW+bMBSF/8rkfW3CWyAQaerahES0GesS0nZbp8iYa+oGMMEmaRblv8+QdJq6qdo3w3nuPfdcwx6tWJGgAYpZuq6h2r1/4jE6QyBxqt4+oCn+5hZ6b+Re55MAFslNFoTTHPDdRGjLn/5tRu7HS7PU1xbfXd5V/avnm+JTZ/WAVBPWNE7qjIDslLySnb5jDhbz7nh45U3Xz3Rylc3uJ9ebZ+E+mfiST0aBqhKQ0SkrVqr2UcpSDDRtu912U87TDHDJRJfwXHuZV9uYWlnxJyBSaK+8NJVFaG+4nWecYMl48WExV84KnwGFCgoCaLBHp77BP2Ic6VZ5O82LgwKVx+EMEV5QltbV6e2+6RPtSmWIviz82VdV0wZrpNOhWYma49250hIQkhVtcYTj7D/mTLDEAo7qkrjU1WPdiw03prpJgdr9HgHd1l2w9R5QJ3H7joNVnWzat1W44AWhdtzXHRrbhkHcuE9pQl1Hx1T3TNvpJTpY1LaduI1YAZYwYqLkgp3CD2f+ReQvg/Ey9P2RP1IG24q9pu5mgYKi2SIcKloxZcW4wpolBGHkzy6GUXDbCLWAKaSY7ObrDA0ozgScFneDK5yDhEqgwXe1nJfH45L3SB6XPZ5+voicXjPvb+QWZ3XLbI4HFOIQHQ4/DgoSEstaNGJzakQ1ZRiEE3QSmboY0gJt/uaCWN5whm05fcO0DFu3PdTClfxLM0zjz6tvTXIo5OnbmPtTfxihZhIVvVpCjpkKjizHsTzPsoye3VGXKnWD59LDZt9bESslKVs/rleZG/P4sf6YwAYyXkLVTVWPDSOACeF1IZtfCh1+AXCKKbkNBAAA" + } + }, + { + "ID": "4564c7525f659016", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/FCJ9LqxfGJlRXGKvxs8j2aBoGDI?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a904695cf505abcfebbb54157a7c57cd/1662600791614765084;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/FCJ9LqxfGJlRXGKvxs8j2aBoGDI?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:55 GMT" + ], + "Etag": [ + "AdsTsQjst9fVLoPR6MhGog==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "a904695cf505abcfebbb54157a7c57cd" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PUU/CUAyF/0t9hQR5QFnCw4YywakwwJgYYy533di8W8faKcuy/+4d+tSe9GvPaQtfaRGBA4c0OdVYNVcJyqZvQuTaCNtSUsEIA0BRiSXdiHe8yVim8WtA63DydPQpmc0swfqIuQKnhThFEzE47y0UKke7Fo8+LSFN2YtF8OLurMwp6uXzPghcL7iH7qMbQEaHEGOssNDY3yorylDLso8Z1UajDEuqZHgzGcOFvkwW89U0OJ1jf2XCN//x+8y32Vh55N8tLWVIK0mpsOB+C9ZESJQJ6cdmhGv4114jyOuKNDJjf3T0ZzCnvDQoNo1UNQ5AK/voQyrgxMowdr/Nc783RgEAAA==" + } + }, + { + "ID": "483af213d69da99b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anoncf5b706fb511c8b7ffdf860af092564d0e3f556b/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "a904695cf505abcfebbb54157a7c57cd/11703948097443279972;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anoncf5b706fb511c8b7ffdf860af092564d0e3f556b/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:56 GMT" + ], + "Etag": [ + "SVJYPuuqfSRD8gVN5t5V/A==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "a904695cf505abcfebbb54157a7c57cd" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8oHh3lFBpSWFqYFB7lYpIf5mZaYhuk72toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwr7Jfop1cYCIQC0/hg1cAAAAA==" + } + }, + { + "ID": "94e118a9ddd35413", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "244" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e124eb7482672e54e270545b252ce9e2/13268122512034639348;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IkJZVEVTIn0sInBhcmFtZXRlclZhbHVlIjp7InZhbHVlIjoiWm05diJ9fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiYUxiSFlETEl0M0JtdzY2eUYxYmdzanhwa2RIIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:56 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/Q3oOEsu7KXk-Jj7o9OiYywboDR4\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2+bMBT9K5P3tQmv8Io0dW1CW1aUtglpl65TZMyFOgFMsEkWRfnvM4ROUzdN+2b7nHvPPefCAa1pEaMhimi6qaHaf1yxCJ0hEDiVry8owM9OoQ7Gzm1+7cM8vs/8SZADfrrmyoPB7jxe27df170vK5u5d3Sx30VsPB28INmENo3jOiMgeiWrRM+29OF81sdBdLMYB74wLvOdZe2vtCjlqx/lOr6RVRyyJKDFWta+ClHyoaLsdrt+yliaAS4p7xOWK2/zKltdKSu2AiK48k5LkV648g+184wRLCgrPs1nUlnSp5BABQUBNDygrq//Fxsndov8282bgiRKjeMZIqxIaFpX3euh6RPuSymIHubedCFrWmMN1B2aSOQcH84lFgMXtGiLQxxl/zFnjAXmcEKXxEkcNVLdSHOiRNUTSEx7QEA1VQdMdQCJFTu2ZWFZJ5r2J4cFKzTDiFQMFtGxNlCJq9tq7Lqqa+txYpumrZNY02LVbC1WgAWMKS8Zp5350dS7CL2lf7WceN7YG0uBXUXfs56mviSF0/lkJNmSU1aUSVoTgj8JvenFKPQfG6DmEECKyX62ydAwwRmHLrh7XOEcBFQcDb/JcN6up5APSJzCvlyEXruQX4RHnNUtY3s6oOfc3aLj8ftRsrjAouYN2pwaVA458SfXqAOp3AtpCa39Zj80b3iaaVi2phuaZRs2asmV+ANzZHS/bb4VyaEQ3acx8wJvFKJmEum8WkKOqfSNDMsyXNcwtIHZkzsVqsZy4WLddtfESElKN6+bdeZELHqtP8ewhYyVUPVT2WNLCWBCWF2I5o9Cx58a0GqZDAQAAA==" + } + }, + { + "ID": "1f00ec054b0ff940", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/aLbHYDLIt3Bmw66yF1bgsjxpkdH?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "878490007a87617e96a26350cab06c0a/14904354520663926148;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/aLbHYDLIt3Bmw66yF1bgsjxpkdH?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:57 GMT" + ], + "Etag": [ + "eglgNBI83k9/3Od+HVST1g==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "878490007a87617e96a26350cab06c0a" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P0U6DQBBF/2V8lMYiCSpJH0RrICFVoTVpjDHLMqzAwuLukEoI/+5SfZq5mTNz70zQVF0BAeSV+B5QjxcC6XVpUjSDJGNLrzqD4AASE5ZEIcUujG+95u7Key4uo7ds74rNxhKGf2HLIJigrFAWBoL3CTrWol0r15+WoLFfRHjcbzMrW1UscndIkvsw2cL8MTtQqzzFEjV2HJdbvVY1coqXmMUgOdKqV5pWN/41nOnzhCV5dHxMYvLC9uT745ObC1P/9E0RWUoqzqhSnQUPGVgTUsRkqk42I7jwr8OR0LxoxdEYXI6u/wweVNtLJJuG9IAOcGYfjSqCoGTS4PwLBpzHrEYBAAA=" + } + }, + { + "ID": "4d356cb0b5f2e735", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon133b0ae6c2a140c9270d990972df75572cd11d05/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "878490007a87617e96a26350cab06c0a/6427182733233299916;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon133b0ae6c2a140c9270d990972df75572cd11d05/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:58 GMT" + ], + "Etag": [ + "rRrYJfVSi0l95NdarS6jeA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8oXBRVFeqWFBWca5Fia+qUkFgWbZaU62toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwpH5VqWKdXGAiEAZauNsHEAAAA=" + } + }, + { + "ID": "424d3e31a460d7bf", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "276" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "1e7eb5badbc64a8db73655e028c19a5d/8063133271164066396;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IlRJTUVTVEFNUCJ9LCJwYXJhbWV0ZXJWYWx1ZSI6eyJ2YWx1ZSI6IjIwMTYtMDMtMjAgMDQ6MjI6MDkuMDAwMDA1LTAxOjAyIn19XSwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJHUTV4dmczVmRSTldVMVpXRHhzRFBRS2dGM2giLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:58 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/zKg8go6oO-qm3dRVwkIpKriSUwg\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TW2/aMBT+K5X3WohzITdp6ipIUQRlFAJoXSfkJCfBJYlD4kA7xH+fHeg0dVO1PDk+3+Wc7yRHtKVFjFwU0nTXQPX66ZmF6BoBJ6m4fUJj8mgX2BjYo3zowyKeZv5knANZDWvl5yi1U2ayr51drsez5WHrl6OKzheH9AkJESqF4yaLgHdKVvGOZWruYt4dPvRe9qm+jGeT1UJ9XA1e6sH0YZTe6RvBqiFLxrTYCu6G87J2FeVwOHRTxtIMSEnrbsRy5a1fZa8pZcWeIeK18s5LEbPUygduNxmLCKes+LyYC2cBn0ECFRQRIPeILrr+P8Y4o9vKx9O8OQig8Dhdo4gVCU2b6nJ7lDrBaykM0cPCm30TnHYwWbocZCSij6sbUYuh5rRoyQEJs//oMyac1HCuriM7sXGInVC1wwRrCSQ9y4gA97ANPWxAYsa2ZZpE8LiUb1mkYAW2rFCzNEN1MAHbieJY00zAmmE4CdYJWJoZ416ctCNWQDgMaF2yml6G78+828Bb+3friecNvIEwOFT0PWo18wUomC0mfYEWmLKiTMBkCP4k8Ga3/cBfykJTwxhSEr3OdxlyE5LVcAluSiqSA4eqRu53Ec7b6znkI+LnsAP/3psHt/dT2fFv0JJkTYvanw9Iw6rZwXpHw1fYcDXNxU4Xy6fXwaqLNXQ6/TgJhZoT3tSSKU+SKYaY+JMhuhSp2FvUAtp45P5oLnFqTzctVdNVW1flvgS44n/XHOPPL6M1yaHgl09n7o29foBkJyKZag05oSIXpJum7ji6rhq9jtg5xyrLuUM0y9lGehqldLfZbTM7ZOGm+RLDHjJWQtVNhcaeRkCiiDUFl38cOv0CUL+kySwEAAA=" + } + }, + { + "ID": "bb70974be6f646db", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/GQ5xvg3VdRNWU1ZWDxsDPQKgF3h?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "83468fe90194d9a426da1f31dbc65c86/9627307685772202732;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/GQ5xvg3VdRNWU1ZWDxsDPQKgF3h?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:59 GMT" + ], + "Etag": [ + "s0iGu0vYc60mW23SNgC6rg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "83468fe90194d9a426da1f31dbc65c86" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P207CQBCG32W8haRArEkTLjiJxEKgUIkaY5btdFncduvuFGka3t1d9GpO3/zzTwtfsswggoMU3zWa5k4gbXySoK0VWRcqXVqEDiAx4UgbyHkdnF95GBT7/mC7EpPQiOHQEZYfsWAQtZBLVJmF6L2FkhXo1vLg0xHUVL7YLZaz7W60XLtWoTPfWqVxPBrHM7h+XDtw0ocEczRYcvR6ldEn5LTwVrNacaRupQ11H8I+3OjbZL65v5zF4CVLVvu097afXux0vXkWj4Ojo5TmjKQuHZhuwR0hTUwl+sf5hB781+OG0K6N5mgtetHg78BEF5VCcm7I1NgBztyzT5IgypmyeP0FkOG5qEoBAAA=" + } + }, + { + "ID": "bebb486dac7fb8d2", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon077b2724190ae89cdd226e02449f03ae726d05df/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "83468fe90194d9a426da1f31dbc65c86/1222192392851099444;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon077b2724190ae89cdd226e02449f03ae726d05df/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:59 GMT" + ], + "Etag": [ + "2y5FEPF26ue5VUbSEiHstQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "83468fe90194d9a426da1f31dbc65c86" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8obVZq6uQa4GZmVppqGhSYFu2Z6FJcE2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwmbmFqYmBqamFjqGYCAqVJtLBACADMRtex+AAAA" + } + }, + { + "ID": "91472137bb29b89f", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "249" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "e0abf10aace9f54456184ef095a23b23/2786367906954086340;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IkRBVEUifSwicGFyYW1ldGVyVmFsdWUiOnsidmFsdWUiOiIyMDE2LTAzLTIwIn19XSwidXNlTGVnYWN5U3FsIjpmYWxzZX19LCJqb2JSZWZlcmVuY2UiOnsiam9iSWQiOiJIa1BTRnJBalFINVkyOE5vM2dqVGVKTkpscnQiLCJwcm9qZWN0SWQiOiJkdWxjZXQtcG9ydC03NjIifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:31:59 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/_NvP1gWy2bA5Gu2RxN5Ps8jP1gE\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2TbW/aMBSF/8rkfS2Nk5A3pKlDkNJsKKIQWnXrhBznJjUkcYgdGEL89zmBTlM3Vfvm+Dz3nnuu4Yg2rEzQAMUs2zZQHz6ueYyuEEiSqdtnNCXf3BL3x+7XYhLAMpnlQTgtgDxOhLYKdzM9ezwY8dCaNMb8Z2jNhLtWd/4zUk1Y2zhpcgqyV/Fa9hzbGCwX13eb2eK2Hq7v76wnww25ma0j+BJ+yWupqgTk6ZSVG1X7ImUlBpq23++vM86zHEjFxDXlhfY6r7YztKrma6BSaG+8NJVFaO+43eScEsl4+Wm5UM4Kn0MKNZQU0OCILn2Df8Q4053yfppXBwUqj9MVorxMWdbUl9tj2yc6VMoQ3S/9+ZOq6YK10uXQrkTN8eFGaQkIycquOCJx/h9zJkQSAWd1Rd3UxTH2Yt2NU2ykkFpOnwK2sAsW7kNqJ65j20TVybZ9V0VKXhLdTaidGk5CaApW4lr9fkIITj3cx4ZtkcQmuoPtLmINRMKYiYoLdgk/mvvDyF8Ft6vQ98f+WBnsa/aWepwHCormy3CkaMVUNeMKa5cQhJE/H46i4KEVGgFTyAg9LLY5GqQkF3BZ3IzUpAAJtUCD72o5r5/nJR+RPC973BqoYX/rDyRvOmB3PiAD63YPmz0Do9Ppx0mxQhLZiJZpTy2jJg2DcIIuIlOPQzug20H7SKxoOd0ybUc3TN1zdIw6uJZ/aS72/nz+zqSAUl5+Hwt/6o8i1E6i4tcrKAhT4ZFp26bnmabet3rqYSXWeSE9YjjehpoZzdj2ZbvJ3ZjHL83nBHaQ8wrq60z12DEKhFLelLL9W6HTL7AS6vkRBAAA" + } + }, + { + "ID": "f9288c41866f5c85", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/HkPSFrAjQH5Y28No3gjTeJNJlrt?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d3c47b1f72be279396d44c5ba497f255/4350542325840347220;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/HkPSFrAjQH5Y28No3gjTeJNJlrt?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:00 GMT" + ], + "Etag": [ + "lwGvI474/3sknEH8s1nsFQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "d3c47b1f72be279396d44c5ba497f255" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PW2+DMAyF/4v3SrXetlZIfaAbHa0QKr08TNM0pcEwICQsMasQ4r83dHuyj/zZ57iDMpcJuHDJs58GdfuQIcVDc0DTCDK21EoaBAeQWGZJcX373c4X88eZKaUfLM1Emk28WlnC8G+sGLgdpDmKxID70YFkFdq1dPxlCWrrQbx6J9+qSiWDis5h6K1DH/rP3oFCXQ6YokbJcThVa1Ugp+2QMmkERxrVStNo8TyFO32fBOX+uNFeEQdP79NlpGZZccJdtBOaLCUUZ5QracHzEawJKWLioK42IkzgX69bQrPXiqMxOBwd/xm8qKoWSDYN6QYd4Mz+GeQEbsqEwf4GEfijOUUBAAA=" + } + }, + { + "ID": "dec9746d65cbd3f4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anona18dc6f27dacfe5d8544daa0f9040265ad6a1706/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "d3c47b1f72be279396d44c5ba497f255/14391889627374025883;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anona18dc6f27dacfe5d8544daa0f9040265ad6a1706/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:01 GMT" + ], + "Etag": [ + "h7n6B7xuJDQXjL/sYXKKgQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "d3c47b1f72be279396d44c5ba497f255" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pnmOeZOZlXlHq5BEZk+egXR0Z4e6cH2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwobGRia6RoY6xoZKNXGAiEAuTAZ6ncAAAA=" + } + }, + { + "ID": "e91758f8bf0ab458", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "254" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "58a1968eb7ca3940f05d261bf35cdd44/15956065141477012523;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IlRJTUUifSwicGFyYW1ldGVyVmFsdWUiOnsidmFsdWUiOiIwNDowNTowNi43ODkwMDAifX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6ImN6Tnd3TGZPR1dBU0sxT2hPRXlzR1VIemNRVyIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:01 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/tqh4LgdBETSCB98dDeZA1XMyWUQ\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2/aMBT9K5P3tSVP8pKmjkLGolJoIZSt64Qc5ya45EXsgCjiv88OdJq6qdo3x+fce8491zmgNS1i5KGIppsG6v3H5zJCFwg4TsXtExrhR6dQzYFzkw8DmMd3WTAe5YAXQ6bwzcocpfG1H876164TD+Cxp3273S/m909INKGycdxkBPhlVdb80rZ0bz7rkJfxbjdKJsNFb3ajTVYTf8+G868v5H4hqhhkyYgWa1G74rxinqLsdrtOWpZpBriirEPKXHn1q2x1parLZyCcKW+0FDELU95Ru8pKgjkti0/zmVAW9CkkUENBAHkHdO4b/GOME7tF3p/mVUEQhcbxApGySGja1Ofbg+wT7ishiO7n/vS7qGkHk9D5ICMRPj5cCSwGxmnRFoc4yv7DZ4w5ZnBCl8RJHDVS3UhzokTVE0i6tklA7aoOdFUTEit2bMvCoo7L9m0VLoRnBzu2icE0u45hWUacJDjGsYn1xEgix8DYNcAiRjtiDZjDgLKqZPQ8fH/q90J/GXxZjn1/4A+EwK6mb1mLaSBI4XQ+7gu24FQ1LQVNhhCMQ3/a64fBgwQaBiNIMdnPNhnyEpwxOAd3h2ucA4eaIe+HCOf18xTyAfFT2GFw60uzv/EHnDUtYXs6INX01K6nWh3bcVVVRcfjz6MoYBzzhkmiPEmisDsOxkN0BqnYEGkJbRByUzSXPK1rWLamG7qmOxpqyTX/CzNs88830IrkUPDzI5n5I78fIulEZFAvIcdUJIDkUlzXMDSzeym2y1WtzLmLddtdEyMlKd2sNuvMicpo1XyOYQtZWUHdSUWPLSWACSmbgst/Cx1/AV0uEw0WBAAA" + } + }, + { + "ID": "55288dd31cb66583", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/czNwwLfOGWASK1OhOEysGUHzcQW?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "93acebc30da0257e2610020940c46219/17520239560363273659;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/czNwwLfOGWASK1OhOEysGUHzcQW?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:02 GMT" + ], + "Etag": [ + "GrVjqTei3Yf1QuMjALagow==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "93acebc30da0257e2610020940c46219" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P0WqDQBBF/2X6mkBsoQUhD6aICTWxmthQSimbdTTa1TW7I2LEf+9u0qeZy5yZe2eE37LJwIVTWVw6VMNDgRTbJkHdCdKmtLLRCDNAYoUhA/VRXQ5YPn3mTtxtKy9kheyXS0NofsaagTtCXqLINLhfIzSsRrOWL34MQUNrxWGz9Y2qZWbVLg1DbxX6MH1PM6jkKcEcFTYc7alWyQo5bWzKrBMcad5KRfOX50e40bcJv+76Psyj4Ojt35zoHPmDDtL1lcdHQwnJGZWyMWC6B2NCkphIZG8iggP/ejUQ6nclOWqN9ujibvAq61YgmTSkOpwBZ+bPdUng5kxonP4AVpYoIkUBAAA=" + } + }, + { + "ID": "6ee1ba7860ad81fb", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonf8a874ae44583663dffadad4a2f3fb83aa93e6c3/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "93acebc30da0257e2610020940c46219/9115124263164045571;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonf8a874ae44583663dffadad4a2f3fb83aa93e6c3/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:02 GMT" + ], + "Etag": [ + "BSq3ihcvSWSGl2rlH5GXGQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "93acebc30da0257e2610020940c46219" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8o7BRcaZ2YklwWHB7vnGBXleJi6R7gH2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwobmFgZmFoZmOmZW1gaGBgo1cYCIQCSQc8rfAAAAA==" + } + }, + { + "ID": "5c6fefdb27e7746b", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "269" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "87f3fc3b2a5c8fb9e9e9c60c8e4021f3/10679299781561934227;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6IkRBVEVUSU1FIn0sInBhcmFtZXRlclZhbHVlIjp7InZhbHVlIjoiMjAxNi0wMy0yMCAwNDowNTowNi43ODkwMDAifX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6IkFNZ2lJZG94V1dyVVJmODlqYkpWUk1sUUQ5YSIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:03 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/lmqOB9DHDKCzOh44G5gO7MyPNO8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2+bMBT9K5X3tQnm/ZCmrgssY82jJaTRtk6RMYa4AUzASZZF+e+zSTpN1VTtm/E9555zzzVHsKZVCjyQ0HyzJc3h3TNLwDUgHOXi9gmM0Dengobv3JXDkMzT+yKcjEqCFsNWKcrN9KPrf/bvBr+mK8MYmvnUHh/uJ1PnCYgmVDZOtwUmvFezhvdsS/Pms/7tOKdhyn4uFs08yhz3OfnyGI2LB99FgtWSIhvRai24K87r1lOU/X7fzxnLC4Jq2vYxK5UXv8pOU+qGPRPMW+WVliJmaZU31G4KhhGnrHo/nwllAY9IRhpSYQK8I7j0Df8xxhndVd6e5kVBAIXG6RpgVmU03zaX26PsEx9qIQge5kH0VXC6wWTpcpCRCB9XN6KWkpbTqiPHKCn+w2eKOGrJubrETubABLqJ6iQZ1DKSmbaBCTShQ0xokMxKHduypHMu23csVLEqTV2o2hlysIqxrTuqY5PMtk1Ddw1D1RwzyzTkqmY3YkMQJz5ta9bSy/CDKLiNg2X4aTkJAj/whcC+oa9RiygUoDiaTwYCLTB1Q5mAyRDCSRxEt4M4fJSFbUtGJEf4MNsUwMtQ0ZJLcPeoQSXhpGmB912E8/J5DvkI+DlsXwjE4TiQhv9gHlGx7UC78wFoULV6UO9p8AoaHjQ9aPVtx4UQgtPpx0lwW474tpUceZIc4X4STobgUqRiYbgDdLnIxdFS4lRTt2xV0zXNdSHowA1/XdNV1fj7SXQiJan45c3MglEwiIF0IiJplqREVAQCdMvSXVfXVcPsiWVzqLKSu0iz3TXWc5zTzWqzLpyEJavth5TsSMFq0vRz0WNHMUEYs23F5a8GTr8BRd4lOiUEAAA=" + } + }, + { + "ID": "de109e8f3cb0ce4c", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/AMgiIdoxWWrURf89jbJVRMlQD9a?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "27d7ef90da26473e904ebaca15450c60/12315531790174444067;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/AMgiIdoxWWrURf89jbJVRMlQD9a?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:04 GMT" + ], + "Etag": [ + "s/7fFcXjqXgb3/asgS0aeA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "27d7ef90da26473e904ebaca15450c60" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8pSlqYi1JL6jFiAFjabFNjDHLMiC4sHR3iBLCu3e3ejV/35w5M8J31ebgQVaVpx7VcFUibW2SoO4FaRM62WoEB5BYaUg9XxSP/FifjmV2O2e63LkM/dXKEJp/YcPAG6GoUOQavPcRWtagWSvcT0PQ0Nli4++DfRgHptPI3HZe0ijy11EA08fkQC2zBAtU2HK0cp2SNXIKrdO8Fxxp1klFs8XdDVzoy8SPyyrM5e/hoNKkuF/W2fNbEovtZskMJSRnVMnWgOkOzBGSxEQif4xNuIb/ej0Q6lclOWqNVtT9O/Agm04gGTekenSAM/PrU0XgFUxonM74JCXLSQEAAA==" + } + }, + { + "ID": "4481752fe4d2efc3", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anondd9017fa8c1cc738187ef775439441285ff2a915/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "27d7ef90da26473e904ebaca15450c60/3838358898954065515;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anondd9017fa8c1cc738187ef775439441285ff2a915/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:04 GMT" + ], + "Etag": [ + "8Z2L7JaSClRpuCHleqBmpA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "27d7ef90da26473e904ebaca15450c60" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pbRBn5mHslBjvnBBWUOnvkpBY65RY42toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwobGRia6RoY6xoZhBiYWBmYWhmY6ZlbWBoYGCjVxgIhAOduLtmHAAAA" + } + }, + { + "ID": "03e09476c802da34", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "254" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "4b09afb1a5f1a436939973c7c10bab71/5474590911861477371;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsidHlwZSI6Ik5VTUVSSUMifSwicGFyYW1ldGVyVmFsdWUiOnsidmFsdWUiOiIxMi4zNDUwMDAwMDAifX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6Ik9rZjR4UkpqMm9uWENlcEVUa2ZmMFVoSWJyQiIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:04 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/s4x1LJMdXYwz3zgIMkCN02_Ckr0\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI2Ta2+bMBSG/8rkfW3D/RZp6jrCKrqUdYT0snWKjDlQF4IJNknbKP99hqTT1E3V+GR8nnPec17bW1TSOkNjlNJi1UH79P6BpegIgcCF3L1DU/zdrVVz4n5ZnoUwzy6rMJouAV+fcYWbj9r0/CK7ud08G89FeFH6kaov/LJV75AsQvvCWVcREMcNa8WxY+vj+Wz0tczNx/j8QWf1jQ9NkJR5rs7vw7T9JLM4VPmU1qXMvRei4WNF2Ww2o4KxogLcUD4ibKm89KusdaVp2QMQwZVXWoqchStvqJ1UjGBBWf1hPpPKEo8hhxZqAmi8RYe64T/G2NND5O1pXhQkKDV2R4iwOqdF1x52t32d5KmRgujbPIhvZc4wWB86LHpLZB/vTmQsAy5oPSQnOK3+o88MC8xhH10QN3fVVPVSzU1zVc8htxyTgGqpLliqCbmduY5tY5kn+vJDFq6ZvAI2NnMdW4ah2wbWCdie6Ti6oeXYMnPiOJ6jeUCGEVvAAiaUN4zTw/B+HJwmwSL8vIiCYBJMpMCmpa+p6ziUUBLPI1/SkmlayiTWmxBGSRCf+kl41Qc6DlMoMHmarSo0znHF4WDcJW7xEgS0HI1/SHNefvcmb5HYmx3NL4I49Pt+fyNXuOoGZr1fIE0fGaalDh/a7X7uJM0FFh3vqX7VU7LdKIzO0CFI5QmRARiM6E+KLodqlmE7mm7opqk7aIBb8XfMM/68A4PIEmpxuCSzYBr4Ceo7kR60C1hiKh1Ahm0bnmcYmmkdy9MVqsaWwsO645XEKEhBV/ersnJTlt53HzNYQ8UaaEeFrLGmBDAhrKtF/7bQ7hcmG5xhFgQAAA==" + } + }, + { + "ID": "afc35f39ea47488c", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/Okf4xRJj2onXCepETkff0UhIbrB?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3627ad631f1005ed4f6d266e8a9e97ff/7038766425964464011;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/Okf4xRJj2onXCepETkff0UhIbrB?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:05 GMT" + ], + "Etag": [ + "1naVHUx5PEW74lQj1xVGNQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "3627ad631f1005ed4f6d266e8a9e97ff" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P0W7CMAxF/8V7BakgNqRKPAxUjU4dg25lk6ZpCqlTWtIkS1wNVPHvJLAn+9rH13YPh1qVEMOurn47tKe7CmkTkhxdJ8n5YLRyCANAYpUnR4ptl8Xxfp18TCdy04yO26fVZjbzhON7bBnEPYgaZekg/upBsRb9mIh+PEEnE8SqeEnydOELrS5vhSx7nGcJnL/PA2j0LkeBFhXH4GasbpBTGg4tO8mRhkZbGk4fxnClr53Xg5gc8+dmrNXnAk3yfhAiKvbpzs49JTVnVGvlweIN/BLSxGSu/1z4Cf71/ETo1lZzdA6DaXRbsNCtkUj+GrIdDoAz/+qyJogFkw7PF+r7QWtIAQAA" + } + }, + { + "ID": "9fc91f19f9bbd730", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon046a4f2a533263a2ce69477231fa54fc779719ec/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "3627ad631f1005ed4f6d266e8a9e97ff/17008057237266678739;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon046a4f2a533263a2ce69477231fa54fc779719ec/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:05 GMT" + ], + "Etag": [ + "JE8J+J/9VDKBzEnXyKGG7A==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "3627ad631f1005ed4f6d266e8a9e97ff" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8p7uVp4aXvpW4a5eDtVueZFVHq7u5s72toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsAwkb6RmbmCrVxgIhAG0j2vZzAAAA" + } + }, + { + "ID": "97b393012d4a31ab", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "259" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "17b0c83b2bf2b4c7123f67d9e8df3304/197825547651497059;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsiYXJyYXlUeXBlIjp7InR5cGUiOiJJTlQ2NCJ9LCJ0eXBlIjoiQVJSQVkifSwicGFyYW1ldGVyVmFsdWUiOnt9fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiUE5ZNE05ZHpveU1UTktSZ2x4b1c0VnJuQXdoIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:06 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/4StGW_UTn3TJx84WbsBjJ9Zn-fQ\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1TXW+bMBT9K5P32oRvApGmLktYRJeilpBG7TpFBi7EDWBim6ZZlP8+Q1JpiqZqb7bPuffccy4c0IZUKRqimOTbBtj+8wuN0RUCgXP5+oxm+MmpVHPi/CinPizSu8IPZiXg5ZQr5lxMl6tFVBnRzZtjLmP+7eXGfap62f0zkk1I2zhtigREr6ZM9Aa2PlzM+3fBo3nrpr/p/jYKfoR58UaX5gOrRru1rOJQZDNSbWTtWoiaDxVlt9v1c0rzAnBNeD+hpfI+r/KqKzWjL5AIrlxoKdILVz5Quy5oggWh1ZfFXCpLeggZMKgSQMMDOvf1/2HjxO6Qj928K0ii1DheoYRWGckbdn49tH2ifS0F0f3CCx9lTWeshc6HNhI5x6driaXABam64gjHxX/MmWKBOZzQVeJkjhqrbqw5cabqGWTWwExAtVQHLNWEzE6dgW1jWSfa9l0VrmhlZpabGaC58cCysWZYOrbVzFRjQzdNW3fTDDuqatudRQZYwITwmnJyNj8OvVHkrfzvq8DzJt5ECuwYuWQtQ1+SonARjCVbcmpGqKS1IfhB5IWjceQ/tEDDYQY5TvbzbYGGGS44nIO7wwyXIIBxNPwpw3m/nkI+IHEKexSGozZszBjeX2BSyjbR8Xj8dZR2uMCi4S3cnlpczhf4wRSdQSJXknSEznm7GlK2PM0y7IGmG7rlOBrqyExcYraqmX8vvRMpoRLnr2LuzbxxhNpJpGm2ghITaRkZtm24rmFoptWT6xSqRkvhYn3gbhIjT3KyXW83hRPTeN18TeEVCloD6+eyxytJACcJbSrR/kzo+AeXTHkABwQAAA==" + } + }, + { + "ID": "47f51f821cf0ba18", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/PNY4M9dzoyMTNKRglxoW4VrnAwh?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "371fc72b7beb99c37351a821ebd69946/1762001061754483955;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/PNY4M9dzoyMTNKRglxoW4VrnAwh?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:06 GMT" + ], + "Etag": [ + "e3iAtbn2HDW8u0Hv+NgnrQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "371fc72b7beb99c37351a821ebd69946" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P207CQBCG32W8FBJE4qEJFyiNJYamrFVijDHLdlqK2526OxVLw7u7Ra/m9M0//3TwWZoMAtiUxVeDtj0rkFd9ItA1mp0PNRmHMABkWXgSL8sZb8w4mq9vmlH0fR4Xxq6mU084tcVKQtBBXqLOHARvHRhZoV/LRx+e4Lbui0Wchg+h8I2Ksr4hwiScpeEcju/HAexoIzBHi0Zhr1Zb2qHiRW80a7RCHtZkeXh9NYYTfZok8etkeZsdqF2m8aMo9A+tJy/WzPZbT2lSkksyHnx+An+EiaUWtPcu4QL+67uW0SWWFDqHvejo78A9VbVG9m7YNjgAJf2rUckQ5FI7PP4C7PHXB0gBAAA=" + } + }, + { + "ID": "ca51ee1301f1f216", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon4f59f3e19b756a1352a60f40b3244629dfa80066/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "371fc72b7beb99c37351a821ebd69946/11803348367582998587;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon4f59f3e19b756a1352a60f40b3244629dfa80066/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:07 GMT" + ], + "Etag": [ + "BeeiZdkdAp0HxZhH+PCtEQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "371fc72b7beb99c37351a821ebd69946" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8o7paZmRqVkpzgWGHhURGV4aAc4l7gG2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsA5KxtSAIAEAVChNtAAAA" + } + }, + { + "ID": "0bbd13f8d2264cf8", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "259" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8319ced35ba4b629a15f9f80fc9f2523/13367522782174357963;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsiYXJyYXlUeXBlIjp7InR5cGUiOiJJTlQ2NCJ9LCJ0eXBlIjoiQVJSQVkifSwicGFyYW1ldGVyVmFsdWUiOnt9fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoibnBwaUk3WHBBZjlhR2JHbExEZzFOblFuOEpyIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:07 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/aOOYnWSlE9Xi_783cQm3fHHGqjU\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2/aMBT9K5P3tSXvF9LUIchoNkTbAGu7dUKOc526JHZwDAgh/vucQKWpm6p9s33Oveeec5MDWjGeoz7KWLHegNx/fBEZukCgcKFfn9AE/wi56Y7Cb9U4gUV+WybTSQX4ftwY+Obmkd/Pyjh6YMsgdMhd5dDr6/H6ZfGEdBPWNs43JQF1WQupLgPf7i9mPV7XLAke6gGN8Dgbl5NRYU35HQ+/Sl3VQEknjK907bNSddM3jN1u1yuEKErANWt6RFTG67zG1jZqKV6AqMZ4o2VoL43xjtpVKQhWTPBPi5lW1vQUKEjgBFD/gM59k3/YOLE75H03rwqaqDWOF4gITlmxkefXQ9tnvq+1ILpbxOmjrumMtdD50Eai5/hwpbEcGsV4VzzHWfkfc+ZY4QZO6JKENDQzM8qsMKOmTYF6gUvA9MwQPNMF6udh4PtY16m2fVeFueAu9SLqgBVlgedjy/Fs7JvUNTPHdl3fjnKKQ9P0/c6iBKxgxJpaNOxsfpjGg3m8TL4sp3E8ikdaYCfZW9Z9mmjSPF1Mh5qtObVkQtPaEJLpPE4Hw3nyvQU2DUygwGQ/W5eoT3HZwDm4WyxxBQpkg/o/dTiv11PIB6ROYQ/SdNCGjaXE+zeYlvJddDwefx21nUZhtWlauD21uJ5vmkzH6AwyvRLSETrn7WpY1fIsz/EDy3bswA191JGl+gvzAuvPpXciFXB1/ipm8SQezlE7iTYtl1Bhpi0jx/edKHIcy/Uu9TqVaYlKRdgOohVxClKw9fN6VYaZyJ43n3PYQilqkL1C99gyApgQseGq/ZnQ8TeT1/pKBwQAAA==" + } + }, + { + "ID": "c4e060731733fd86", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/nppiI7XpAf9aGbGlLDg1NnQn8Jr?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5faa04e7f2dd600a0979801441a72842/14931416825595601243;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/nppiI7XpAf9aGbGlLDg1NnQn8Jr?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:07 GMT" + ], + "Etag": [ + "Tf6BmMFN04NRDM9YC9sIXw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "5faa04e7f2dd600a0979801441a72842" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2PYW+CQAyG/0v3FRNcFp0mflBhjGUSZSxxWZblOArDHXe3uxJDCP/dQ/epfdun7dsefmtZwBLyuvpr0XR3FdJhTFK0rSDrglbSIniAxCpHZuVs0+yeEv8hSYPd4mO7sPHxvFo5wvIfbBgseyhrFIWF5WcPkjXoxkr/2xHU6VHESRZGYeoKjSrGQhruw3UWBjB8DR6cVJ5iiQYlx3GbNuqEnOLRaNEKjjTRytBkPruHK33tSK3reH7U63LBojwSr0E1TeRBPr4YRwnFGdVKOvD9DdwRUsREqs7OJUzhX286Qrs3iqO1OC71bwe2qtECybkh06IHnLlXn2u66eECSPjC00cBAAA=" + } + }, + { + "ID": "7be6942ad918d3a4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon4f59f3e19b756a1352a60f40b3244629dfa80066/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5faa04e7f2dd600a0979801441a72842/6526301532674498211;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon4f59f3e19b756a1352a60f40b3244629dfa80066/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:08 GMT" + ], + "Etag": [ + "BeeiZdkdAp0HxZhH+PCtEQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8o7paZmRqVkpzgWGHhURGV4aAc4l7gG2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsA5KxtSAIAEAVChNtAAAA" + } + }, + { + "ID": "74bb806e039d1dde", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "302" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "605a0f8b2d333d6c235e07d64202205d/8090475947282634291;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsiYXJyYXlUeXBlIjp7InR5cGUiOiJJTlQ2NCJ9LCJ0eXBlIjoiQVJSQVkifSwicGFyYW1ldGVyVmFsdWUiOnsiYXJyYXlWYWx1ZXMiOlt7InZhbHVlIjoiMSJ9LHsidmFsdWUiOiIyIn1dfX1dLCJ1c2VMZWdhY3lTcWwiOmZhbHNlfX0sImpvYlJlZmVyZW5jZSI6eyJqb2JJZCI6InEwVHhzaEQzNXBhM2sxSm1uY09vbTlrRTVCQiIsInByb2plY3RJZCI6ImR1bGNldC1wb3J0LTc2MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:08 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/oiU-MuepI5dGF6C7j23BXGgmvBI\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2/aMBT9K5P3tZCnQ4I0dTxSlI2xDkK7RyfkODfBJYlD4sAQ4r/PDnSbuqmalA+2z7n3+BzfHNGGFTHqo4il2waqw+tHHqErBIKk8vQBTclXt9Dtsfs+nwSwjG+zYDbNgdxPao2zZedDA2WA48mNM+o9mtbw8yTNd8PgAckmTDWOm4yC6JS8Ep2eY/aXi+5WD3/U67GFS2JtjHd5QT/y3Nv4eDiUVTVkyZQVG1m7FqKs+5q23++7KedpBqRkdZfyXHu6r7YztbLij0BFrT3T0qSXWntB7TrjlAjGizfLhVSW9DkkUEFBAfWP6NI3+IeNM7tFXnbzpCCJUuN0hSgvEpY21eX0qPqEh1IKok9Lf/5F1rTGFHRZqEjkPV5dSyyGWrCiLQ5JlP3HPWMiSA1ndEXdxNUj3YsMN0p0M4EE92wKOtZdwLoNiRO7Pcchsk6o9m0VKXhBYts2k9jGnq1oFnYwTaKYGiZ2qWtFBjYsTD3cWqyACBizuuQ1u5gfzf1B6K+Cm9XM98f+WArsK/acdT8PJCmcL2cjyZacsmJc0lQIwSz054NRGNwpoKlhCimhh8U2Q/2EZDVcgrslFclBQFWj/jcZztP2HPIRiXPYg/l8oMImVUUOzzAp5djoJK38qr4jWdNSWn67O/ffnQFkSOe/dyY6fT+pT86zIKKpValaKVDamwWzCbqATL4obQltcOplWd62xJbTM0zLdG1LvaQkV+IvDNu9P2emFcmhEJehWvhTfxS2ZmRm1QpywmRiyHIcy/Msy7BxR06D0A2eC4+YPW9DrZSmbLvebjI34tG6eRvDDjJeQtVNZY8do0Ao5U0h1L+ITj8BRAH5gEYEAAA=" + } + }, + { + "ID": "7ae9af72b06b315e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/q0TxshD35pa3k1JmncOom9kE5BB?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "416fa4a05dea9fadb028ea217f6b5818/9726707955895144387;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/q0TxshD35pa3k1JmncOom9kE5BB?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:09 GMT" + ], + "Etag": [ + "B2hcXpNk7QfkBsc2xuC/QA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "416fa4a05dea9fadb028ea217f6b5818" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P206DQBCG32W8pZHS1EaSXpSWaL2oBTExMcZsl+FQdtktO8QSwru7W72a0zf//DNCU7c5hHCqy0uP3XBXIiUuSdH0gowNWrUGwQMkVloyCir+oQ/NKimayPDg2m/vk816bQnDK5QMwhGKGkVuIPwcoWUS7Vrhf1uCBu2K/SGLn+LUNqTKXSONj/Emi3cwfU0enNUpxQI7bDk6Nd2pM3LaO6N5LzjSTKuOZquHAG70bXLxs6updoulZotm/iJb/qrkYxMvo8hSQnFGtWot+P4G9ggpYiJVP9YlzOG/jgZCc+wUR2PQifp/B7ZKaoFk3VDXowec2Vefa4KwYMLg9Au9u8/rSAEAAA==" + } + }, + { + "ID": "0f4e2c4ee36ef2d8", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonad442fd459404ef3565cfbdc1258c83b15135c95/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "416fa4a05dea9fadb028ea217f6b5818/1249536168464517899;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anonad442fd459404ef3565cfbdc1258c83b15135c95/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:09 GMT" + ], + "Etag": [ + "iUorJw75VEUEERa69rr9Zw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pnhuYXeZWbm4a5hrq6BiWaWRYVWUaV29oCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsg5FAyVodCMtIqTYWDAGAlA4agAAAAA==" + } + }, + { + "ID": "eed8181ccc910da1", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "316" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "6f49510813a049cda43e57e9d0669a38/2813711682567504795;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsiYXJyYXlUeXBlIjp7InR5cGUiOiJJTlQ2NCJ9LCJ0eXBlIjoiQVJSQVkifSwicGFyYW1ldGVyVmFsdWUiOnsiYXJyYXlWYWx1ZXMiOlt7InZhbHVlIjoiMSJ9LHsidmFsdWUiOiIyIn0seyJ2YWx1ZSI6IjMifV19fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiV0VQQVlIa2pZNDhNWUNhNTNsMzQzanExZVRKIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:10 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/PZsWaEDtO1rVantKcp6bYuBVpuM\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1Ta2/aMBT9K5P3tSUJIS+kqWOQdVkpYyGA6Dohx9ykhiQOjgNCiP8+O9A9uqmalA+2z7n3+BzfHNGGFivURTFNtzXww9s1i9EVAoFTefqIhvjBLfTOwL3LbwOYrsZZMBrmgOe3lTZ+qObYH4gvBp/hQtyR0o4X9YdZWd8/ItmEqsarOiMgrkvGxbVjt7vTSWvuj3uLT5v1ouPeL/rYMjOzY663BkSfZVUFWTKkxUbWPglRVl1N2+/3rZSxNANc0qpFWK4931fbtbWSszUQUWkvtDTppdJeUbvJGMGCsuLddCKVJT2EBDgUBFD3iC59g3/YOLMb5HU3zwqSKDVOV4iwIqFpzS+nR9UnOpRSEH2d+uFC1jTGFHRZqEjkPd7cSGwFlaBFUxzhOPuPe66wwBWc0SVxE1ePdS823DjR2wkkltMhoFu6C5begcReuY5tY1knVPumChescL3EcV0zcZzEwdi1Egt0M8EGBtsDwyKxrhs6ic3GIgcsYECrklX0Yr4f+r3IXwYflyPfH/gDKbDn9CVrHgaSFIXTUV+yJafklEmaCiEYRX7Y60fBTAF1BUNIMTlMthnqJjir4BLcGHOcgwBeoe43Gc7z9hzyEYlz2L0w7KmwMef48AKTUnYHnaSVn9UznNUNpeE3u3P/3RlAhnT+a9f+YydT+X5Sn5xugUVdqUZqpUBpdhSMbtEFpPJ9SUNoYlTvTPNGwDJtx2ibbc/xbNSQufgL8xzn9wlqRHIoxGXEJv7Q70eNNZkgX0KOaaZuaNum55mm0bGu5WwI3WC58HDb8TbETElKt0/bTebGLH6q369gBxkrgbdS2WNHCWBCWF0I9Wei0w+gRn8cVAQAAA==" + } + }, + { + "ID": "dea496b0c85830ab", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/WEPAYHkjY48MYCa53l343jq1eTJ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5a05f852d4bcaf489c70a2317eb28f71/4449942595980065835;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/WEPAYHkjY48MYCa53l343jq1eTJ?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:10 GMT" + ], + "Etag": [ + "ldw+I1jBRB6tcKv1av6FDg==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "5a05f852d4bcaf489c70a2317eb28f71" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/y2P3U6DQBCF32W8lCZFKhqSXpQWLRoNrhhDjDHbZUDowlJ2aEMI796lejV/35w5M8C+qFPwYFfkhw7b/ipHepsShrqTpE1oVK0RLEDiuSFleroO7dJnvkvi+Wjzo/uwyZdLQ2jxixUHb4CsQJlq8L4GqHmFZi2b/xiC+mYqwtc4eAyYaVQqnRosiIJVHGxg/B4tKNWOYYYt1gIntaZVJQoKJ6NpJwXSrFEtze7cG7jQl8lnEK2S7b5MFvcvyZrfOtJZOOXBxvjJUFIJToWqDfjxDuYIKeKSqZNxCTb8135PqKNWCdQaJ9H534G1qhqJZNxQ26EFgptXtwWBl3GpcTwDqB7FMEgBAAA=" + } + }, + { + "ID": "91013769445da8ba", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon89f7883f77f7aa85f5e03fa1ae69e15cb0010cb3/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "5a05f852d4bcaf489c70a2317eb28f71/14419233402987378803;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon89f7883f77f7aa85f5e03fa1ae69e15cb0010cb3/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:10 GMT" + ], + "Etag": [ + "PbU4eb8rBrueMeUb4eaILQ==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "5a05f852d4bcaf489c70a2317eb28f71" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8oHJIWapCZZFDkVlab6poYmmaQmevoE2toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsg5FAyVodCMsIzjJWqo0FQwCZHJnFigAAAA==" + } + }, + { + "ID": "16cebfb48bd0423d", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "475" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f7bec0797f4566644a66cfbad8568086/16055465415911567363;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsic3RydWN0VHlwZXMiOlt7Im5hbWUiOiJBIiwidHlwZSI6eyJ0eXBlIjoiSU5UNjQifX0seyJuYW1lIjoiQiIsInR5cGUiOnsic3RydWN0VHlwZXMiOlt7Im5hbWUiOiJEIiwidHlwZSI6eyJ0eXBlIjoiU1RSSU5HIn19XSwidHlwZSI6IlNUUlVDVCJ9fSx7Im5hbWUiOiJDIiwidHlwZSI6eyJ0eXBlIjoiQk9PTCJ9fV0sInR5cGUiOiJTVFJVQ1QifSwicGFyYW1ldGVyVmFsdWUiOnsic3RydWN0VmFsdWVzIjp7IkEiOnsidmFsdWUiOiIwIn0sIkIiOnt9LCJDIjp7InZhbHVlIjoiZmFsc2UifX19fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiZjR3Q0t3cnBlelpYNkFOdGFKM2llTlJldzI3IiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:11 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/f5Hne7fmw0mS3r8Br6ylwqN9sVA\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1UWW/aQBD+K9X2lYDvA6lKCbipG+SkHEmPVGhtj50NvlivsSjiv3dskzZN0uMFeXe+Y+abFXuyZllIhsRn8aYCvnt9n/ukR0DQGG9vyZR+sTJJm1gX6bkLy/Aqcb1pCvTmvBxE+vsMzCitpXSucuuMG7uk3nh2eT26JSjCGuGwSgIQJ0XOxYlpKMPlvB9p9fii5gV8//LJGHmCflAZeDOoFRNZJSTRlGVr5N4JUZTDwaCu636c53ECtGBlP8jTwUO/g60yKHh+D4EoB0+8BjgLdvlnt9MkD6hgefZmOUdnhM8gAg5ZAGS4J0dd94UxOnRb+fs0Dw4IRI9DjwR5FrG44sfbfaOz2BVoSD4undln5LSDNaXjRxMJ9vHqFGshlIJlLXlB/eQ/+gypoCV01VVgRZbkS7YvW34kKRFEuqkFIOmSBbqkQWSElmkYFHmikW9ZNMsz0wcp0iyQNc2XJFmJKCiyDKEaGaaqWyDZoIS2b7YjcqACJqws8pIdhx/PnNHCWbnvVp7jTJwJGtScPUXdzFwELWZLb4xoxBSc5QhrQnC9hTMbjRfudVOoSphCTIPdfJOQYUSTEo7BXVFOUxDASzL8iuE8HLuQ90R0Yc/RZbxo3pvgVSCaakfIEI71URPB7xTswNDI4dD7CTp7DvqX7uRFiuudo/C3x9rj58Czy8tpC+v9GuuaJlWL6fzaY9mcR83PtqsSqdnL+PFNGxmKda7IpqIqOx1cHgJwCV7bVldk+O6CFtCut3l/rO1T1lXDlBVVlWVdaeemXDyrKZjco5fdmqSQiePTnztTB1NrOsHN8hWklOFeiWoYqm0jX9NP8M0KSc5TYVPFtNeBGgcx29xt1onl5/5d9TaELSR5Abwfo8aWBUCDIK8y0fxjkMMP2jHgF+wEAAA=" + } + }, + { + "ID": "06a37b69de2853a7", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/f4wCKwrpezZX6ANtaJ3ieNRew27?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8a073dbba95947881342cd1012ef7c60/17619639830502926739;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/f4wCKwrpezZX6ANtaJ3ieNRew27?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:12 GMT" + ], + "Etag": [ + "gnxO9CzbXYgaoVZPR9gK7w==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "8a073dbba95947881342cd1012ef7c60" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/52RX0/CMBTFv8v1FRL8EwhLeNjGgsiyYQGDGGNKdzeH2zrbu0wgfHc7NGIiTz61pz2/nvZ0D29pEYEF6zR5r1BtLxKk+2bCUFcZaTOUstAILUDiiXEmxUfYd3fr5WPC5cNqyvrJpFcPBsahxSvmHKw9xClmkQbraQ8Fz9FgcefFOGhbNoJ5bsiGRucyanSw8H3b8T2z8pe0T9w4mHsjj50BD60fv/PPnOGJm83ZOBidi3n+FeSeACcMfc8OzhOGgY1cM4xRYSGwKahUcoOCxk33UZUJpHYpFbV73Ss4uo878U3tTmpV4m617NoB8bvrFAOG9VXPuDIpOKWyMMbFzDQAJIlnTNbmWXAJ39rZEuqpkgK1xubQzleAK/MyQzK3IVVhCwQ3v3ebElgxzzQePgFCS8LTGwIAAA==" + } + }, + { + "ID": "5389bb897a7d9d4e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon7be0f48e144b0012fae211ed3f67358e09e2d9b7/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "8a073dbba95947881342cd1012ef7c60/9214524533303698907;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon7be0f48e144b0012fae211ed3f67358e09e2d9b7/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:12 GMT" + ], + "Etag": [ + "8q2CaNSMAybnbCCFaRZtnA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "8a073dbba95947881342cd1012ef7c60" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8pbFBo5J/oF+zpWJuUlOTu7JQZFleQ52toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsU7JCYioZKNXqgFl5pTk5UKZSWmJOcapSbWwtEMXWAgD3QyHnlQAAAA==" + } + }, + { + "ID": "3ba5aa93392b6bf4", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "508" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "14802d13ac2e9d83c3ba5e1b114035b3/10778700051684810347;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/jobs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "eyJjb25maWd1cmF0aW9uIjp7InF1ZXJ5Ijp7InF1ZXJ5Ijoic2VsZWN0ID8iLCJxdWVyeVBhcmFtZXRlcnMiOlt7InBhcmFtZXRlclR5cGUiOnsic3RydWN0VHlwZXMiOlt7Im5hbWUiOiJBIiwidHlwZSI6eyJ0eXBlIjoiSU5UNjQifX0seyJuYW1lIjoiQiIsInR5cGUiOnsic3RydWN0VHlwZXMiOlt7Im5hbWUiOiJEIiwidHlwZSI6eyJ0eXBlIjoiU1RSSU5HIn19XSwidHlwZSI6IlNUUlVDVCJ9fSx7Im5hbWUiOiJDIiwidHlwZSI6eyJ0eXBlIjoiQk9PTCJ9fV0sInR5cGUiOiJTVFJVQ1QifSwicGFyYW1ldGVyVmFsdWUiOnsic3RydWN0VmFsdWVzIjp7IkEiOnsidmFsdWUiOiIxIn0sIkIiOnsic3RydWN0VmFsdWVzIjp7IkQiOnsidmFsdWUiOiJzIn19fSwiQyI6eyJ2YWx1ZSI6InRydWUifX19fV0sInVzZUxlZ2FjeVNxbCI6ZmFsc2V9fSwiam9iUmVmZXJlbmNlIjp7ImpvYklkIjoiaXBvZXVRZFRJeFh1YkNvM1YxbVdlUklkTzJDIiwicHJvamVjdElkIjoiZHVsY2V0LXBvcnQtNzYyIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:12 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/MtRxMlbEaOt34O-LWo4xQktouMs\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAAAI1UbVObQBD+K53r1ygQCJDMdKwS6jCNieZF+2LHOY4FryEc4Q6jk8l/7x7E1qpj+yUT7nnb3VvYkiUvEjIgMc/WNVQP73+KmHQIKJrh6TUZ0W9+YTpD//PqNIJFcp5H49EK6NWpNM7U9P4sj0M6UbYzORhdCef+YqlEfSavCZpwbZzUOQN1UIpKHXhud7CYHfJSQH2RzKP7L3UcCPvSWl3BNEom3QBVEvJ0xIslam+VKuXAMDabzWEmRJYDLbk8ZGJlPNZr3HWNshI/gSlpPMsysBdpvJF2lAtGFRfFh8UMk5E+hRQqKBiQwZbsfaNX2mjZDfJ2N48JSMSMXYcwUaQ8q6v96Vb7zB9KDCQXi3D6FTVNYxra/9EjwTreHSGWgFS8aMRzGuf/UWdCFZXQojfMT30zNvux5cep2U0h7XkOA7Nn+tAzHUjdxPdcl6JOaftGRQtRmLbpgotC0/ao2aO25Zm071s9SJmVOiiyPOhD0rRYAVUw5LIUku+bD6bh8Ty8iT7djMNwGA4xYFPx56yraYSk+XQxDpCNnLLiAml6CNF4Hk6Pg3l0qYFawggyyh5m65wMUppL2A/unFZ0BQoqSQbfcTiPj+2Qt0S1w55hSjDX+6aqmimNtoIC6Ygf6xH8LcEKXIfsdp3fpJOXpH/5Dl+VRONTNP7x1Dt4STyZTEYNrfOnrUua1w2nzWsepX4+1j93LUosfS8nr9GGT2kS3ZEYPD1DPujjpjqUU1XL1ggvGXG8rHFTfgty3E/WEJo10HvKm36snu16Vte2u57Zb+ZDK/UC80336RvQhKygUPtXZBaOQpyurgQ3oLqBFeV4/8R2Xbvft23L6R3gbivTEivVp12vv2R2xjK+vl0vcz8W8W39MYE7yEUJ1WGGHnecAWVM1IXSXxay+wUrFazBFAUAAA==" + } + }, + { + "ID": "2be3d4756b63da0e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/ipoeuQdTIxXubCo3V1mWeRIdO2C?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f969d1f156ce27c928d46bf034482d1d/12342875565787797243;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/queries/ipoeuQdTIxXubCo3V1mWeRIdO2C?alt=json\u0026location=US\u0026maxResults=0\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:13 GMT" + ], + "Etag": [ + "9CCB8gPFt690kYd7t6vUqw==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "f969d1f156ce27c928d46bf034482d1d" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/52RX2+CMBTFv8vdqybqEp0kPggyR0JAq+xPlmVBemFooUgvc8b43de6ZS6ZT3tqT3t+Pe3pATZ5ycGCVZ5tG6z3VxnS3EwYqkaQ0kMlS4XQAqQ4086h49g32eyW+sPO5okPqP8ebXejkXao5A2LGKwDpDkKrsB6PkAZF6ixtPOqHbSvjGCuE7KJ1oXkRgeR749t39Urf8nxmfOCpTt12QXw2Prx2//MmZy5xZJ5wfRSzMuvIOcM2GHou+PgMqEZWMsVwxRrLBM0BVW1XGNCnumeNyJBaleypvag34OT+7STVxKbOV96H4/NypHX993iAZnHw57JFjKJKZelNkYL3QCQpFgwudPPgi58a3tPqGa1TFApNId2vgIcWVQCSd+G6gZbkMT69+5yAiuNhcLjJ5CADL0bAgAA" + } + }, + { + "ID": "1ca912afb9e5c78a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon0306e609b037a05a3170a9815efc1f487617e9ed/data?alt=json\u0026prettyPrint=false\u0026startIndex=0", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "f969d1f156ce27c928d46bf034482d1d/3937759173388620355;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/_c8f80b09b18bf02fef574ce0508e504ef6d8766a/tables/anon0306e609b037a05a3170a9815efc1f487617e9ed/data?alt=json\u0026prettyPrint=false\u0026startIndex=0" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:13 GMT" + ], + "Etag": [ + "GSvmflBrdh2De5ki1v9ATA==" + ], + "Server": [ + "ESF" + ], + "Vary": [ + "Origin", + "X-Origin", + "Referer" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "X-Frame-Options": [ + "SAMEORIGIN" + ], + "X-Goog-Trace-Id": [ + "f969d1f156ce27c928d46bf034482d1d" + ], + "X-Xss-Protection": [ + "1; mode=block" + ] + }, + "Body": "H4sIAAAAAAAC/6tWys7MS1GyUkrKTC8sTS2qVC5JTMpJdUksSfTJLC5R0lFKLUlMB8q7B5flpuU4FaVkGLmkmmZnGpZZOoY42toCVZTklyTmBOWXFwOVGQL5RWBmdLVSGpgsU7JCYgJV1OpgCBYr1cbWQsWVSopKU8H8WCAEAGHK9dihAAAA" + } + }, + { + "ID": "342e529cefed34af", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026deleteContents=true\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-46cd593a36b506a79df7" + ], + "X-Cloud-Trace-Context": [ + "002948bdaea5602eb7e1e54c70719110/5501934687474830291;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/bigquery/v2/projects/dulcet-port-762/datasets/dataset_20180912_1679797627000_0001?alt=json\u0026deleteContents=true\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Date": [ + "Wed, 12 Sep 2018 00:32:14 GMT" + ], + "Etag": [ + "\"LaZ8n04D8KmGIeUdPlINLmeaWGs/vyGp6PvFo4RvsFtPoIWeCReyIC8\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "GSE" + ], + "Vary": [ + "Origin", + "X-Origin" + ] + }, + "Body": "" + } + } + ] +} \ No newline at end of file diff --git a/vendor/cloud.google.com/go/bigquery/copy.go b/vendor/cloud.google.com/go/bigquery/copy.go new file mode 100644 index 000000000..44cc68d12 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/copy.go @@ -0,0 +1,107 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bigquery + +import ( + "context" + + bq "google.golang.org/api/bigquery/v2" +) + +// CopyConfig holds the configuration for a copy job. +type CopyConfig struct { + // Srcs are the tables from which data will be copied. + Srcs []*Table + + // Dst is the table into which the data will be copied. + Dst *Table + + // CreateDisposition specifies the circumstances under which the destination table will be created. + // The default is CreateIfNeeded. + CreateDisposition TableCreateDisposition + + // WriteDisposition specifies how existing data in the destination table is treated. + // The default is WriteEmpty. + WriteDisposition TableWriteDisposition + + // The labels associated with this job. + Labels map[string]string + + // Custom encryption configuration (e.g., Cloud KMS keys). + DestinationEncryptionConfig *EncryptionConfig +} + +func (c *CopyConfig) toBQ() *bq.JobConfiguration { + var ts []*bq.TableReference + for _, t := range c.Srcs { + ts = append(ts, t.toBQ()) + } + return &bq.JobConfiguration{ + Labels: c.Labels, + Copy: &bq.JobConfigurationTableCopy{ + CreateDisposition: string(c.CreateDisposition), + WriteDisposition: string(c.WriteDisposition), + DestinationTable: c.Dst.toBQ(), + DestinationEncryptionConfiguration: c.DestinationEncryptionConfig.toBQ(), + SourceTables: ts, + }, + } +} + +func bqToCopyConfig(q *bq.JobConfiguration, c *Client) *CopyConfig { + cc := &CopyConfig{ + Labels: q.Labels, + CreateDisposition: TableCreateDisposition(q.Copy.CreateDisposition), + WriteDisposition: TableWriteDisposition(q.Copy.WriteDisposition), + Dst: bqToTable(q.Copy.DestinationTable, c), + DestinationEncryptionConfig: bqToEncryptionConfig(q.Copy.DestinationEncryptionConfiguration), + } + for _, t := range q.Copy.SourceTables { + cc.Srcs = append(cc.Srcs, bqToTable(t, c)) + } + return cc +} + +// A Copier copies data into a BigQuery table from one or more BigQuery tables. +type Copier struct { + JobIDConfig + CopyConfig + c *Client +} + +// CopierFrom returns a Copier which can be used to copy data into a +// BigQuery table from one or more BigQuery tables. +// The returned Copier may optionally be further configured before its Run method is called. +func (t *Table) CopierFrom(srcs ...*Table) *Copier { + return &Copier{ + c: t.c, + CopyConfig: CopyConfig{ + Srcs: srcs, + Dst: t, + }, + } +} + +// Run initiates a copy job. +func (c *Copier) Run(ctx context.Context) (*Job, error) { + return c.c.insertJob(ctx, c.newJob(), nil) +} + +func (c *Copier) newJob() *bq.Job { + return &bq.Job{ + JobReference: c.JobIDConfig.createJobRef(c.c), + Configuration: c.CopyConfig.toBQ(), + } +} diff --git a/vendor/cloud.google.com/go/bigquery/copy_test.go b/vendor/cloud.google.com/go/bigquery/copy_test.go new file mode 100644 index 000000000..5b4ef8786 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/copy_test.go @@ -0,0 +1,163 @@ +// Copyright 2015 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 bigquery + +import ( + "testing" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp/cmpopts" + bq "google.golang.org/api/bigquery/v2" +) + +func defaultCopyJob() *bq.Job { + return &bq.Job{ + JobReference: &bq.JobReference{JobId: "RANDOM", ProjectId: "client-project-id"}, + Configuration: &bq.JobConfiguration{ + Copy: &bq.JobConfigurationTableCopy{ + DestinationTable: &bq.TableReference{ + ProjectId: "d-project-id", + DatasetId: "d-dataset-id", + TableId: "d-table-id", + }, + SourceTables: []*bq.TableReference{ + { + ProjectId: "s-project-id", + DatasetId: "s-dataset-id", + TableId: "s-table-id", + }, + }, + }, + }, + } +} + +func TestCopy(t *testing.T) { + defer fixRandomID("RANDOM")() + testCases := []struct { + dst *Table + srcs []*Table + jobID string + location string + config CopyConfig + want *bq.Job + }{ + { + dst: &Table{ + ProjectID: "d-project-id", + DatasetID: "d-dataset-id", + TableID: "d-table-id", + }, + srcs: []*Table{ + { + ProjectID: "s-project-id", + DatasetID: "s-dataset-id", + TableID: "s-table-id", + }, + }, + want: defaultCopyJob(), + }, + { + dst: &Table{ + ProjectID: "d-project-id", + DatasetID: "d-dataset-id", + TableID: "d-table-id", + }, + srcs: []*Table{ + { + ProjectID: "s-project-id", + DatasetID: "s-dataset-id", + TableID: "s-table-id", + }, + }, + config: CopyConfig{ + CreateDisposition: CreateNever, + WriteDisposition: WriteTruncate, + DestinationEncryptionConfig: &EncryptionConfig{KMSKeyName: "keyName"}, + Labels: map[string]string{"a": "b"}, + }, + want: func() *bq.Job { + j := defaultCopyJob() + j.Configuration.Labels = map[string]string{"a": "b"} + j.Configuration.Copy.CreateDisposition = "CREATE_NEVER" + j.Configuration.Copy.WriteDisposition = "WRITE_TRUNCATE" + j.Configuration.Copy.DestinationEncryptionConfiguration = &bq.EncryptionConfiguration{KmsKeyName: "keyName"} + return j + }(), + }, + { + dst: &Table{ + ProjectID: "d-project-id", + DatasetID: "d-dataset-id", + TableID: "d-table-id", + }, + srcs: []*Table{ + { + ProjectID: "s-project-id", + DatasetID: "s-dataset-id", + TableID: "s-table-id", + }, + }, + jobID: "job-id", + want: func() *bq.Job { + j := defaultCopyJob() + j.JobReference.JobId = "job-id" + return j + }(), + }, + { + dst: &Table{ + ProjectID: "d-project-id", + DatasetID: "d-dataset-id", + TableID: "d-table-id", + }, + srcs: []*Table{ + { + ProjectID: "s-project-id", + DatasetID: "s-dataset-id", + TableID: "s-table-id", + }, + }, + location: "asia-northeast1", + want: func() *bq.Job { + j := defaultCopyJob() + j.JobReference.Location = "asia-northeast1" + return j + }(), + }, + } + c := &Client{projectID: "client-project-id"} + for i, tc := range testCases { + tc.dst.c = c + copier := tc.dst.CopierFrom(tc.srcs...) + copier.JobID = tc.jobID + copier.Location = tc.location + tc.config.Srcs = tc.srcs + tc.config.Dst = tc.dst + copier.CopyConfig = tc.config + got := copier.newJob() + checkJob(t, i, got, tc.want) + + jc, err := bqToJobConfig(got.Configuration, c) + if err != nil { + t.Fatalf("#%d: %v", i, err) + } + diff := testutil.Diff(jc.(*CopyConfig), &copier.CopyConfig, + cmpopts.IgnoreUnexported(Table{})) + if diff != "" { + t.Errorf("#%d: (got=-, want=+:\n%s", i, diff) + } + } +} diff --git a/vendor/cloud.google.com/go/bigquery/dataset.go b/vendor/cloud.google.com/go/bigquery/dataset.go new file mode 100644 index 000000000..7bdb70a59 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/dataset.go @@ -0,0 +1,536 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "errors" + "fmt" + "time" + + "cloud.google.com/go/internal/optional" + "cloud.google.com/go/internal/trace" + bq "google.golang.org/api/bigquery/v2" + "google.golang.org/api/iterator" +) + +// Dataset is a reference to a BigQuery dataset. +type Dataset struct { + ProjectID string + DatasetID string + c *Client +} + +// DatasetMetadata contains information about a BigQuery dataset. +type DatasetMetadata struct { + // These fields can be set when creating a dataset. + Name string // The user-friendly name for this dataset. + Description string // The user-friendly description of this dataset. + Location string // The geo location of the dataset. + DefaultTableExpiration time.Duration // The default expiration time for new tables. + Labels map[string]string // User-provided labels. + Access []*AccessEntry // Access permissions. + + // These fields are read-only. + CreationTime time.Time + LastModifiedTime time.Time // When the dataset or any of its tables were modified. + FullID string // The full dataset ID in the form projectID:datasetID. + + // ETag is the ETag obtained when reading metadata. Pass it to Dataset.Update to + // ensure that the metadata hasn't changed since it was read. + ETag string +} + +// DatasetMetadataToUpdate is used when updating a dataset's metadata. +// Only non-nil fields will be updated. +type DatasetMetadataToUpdate struct { + Description optional.String // The user-friendly description of this table. + Name optional.String // The user-friendly name for this dataset. + + // DefaultTableExpiration is the default expiration time for new tables. + // If set to time.Duration(0), new tables never expire. + DefaultTableExpiration optional.Duration + + // The entire access list. It is not possible to replace individual entries. + Access []*AccessEntry + + labelUpdater +} + +// Dataset creates a handle to a BigQuery dataset in the client's project. +func (c *Client) Dataset(id string) *Dataset { + return c.DatasetInProject(c.projectID, id) +} + +// DatasetInProject creates a handle to a BigQuery dataset in the specified project. +func (c *Client) DatasetInProject(projectID, datasetID string) *Dataset { + return &Dataset{ + ProjectID: projectID, + DatasetID: datasetID, + c: c, + } +} + +// Create creates a dataset in the BigQuery service. An error will be returned if the +// dataset already exists. Pass in a DatasetMetadata value to configure the dataset. +func (d *Dataset) Create(ctx context.Context, md *DatasetMetadata) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Dataset.Create") + defer func() { trace.EndSpan(ctx, err) }() + + ds, err := md.toBQ() + if err != nil { + return err + } + ds.DatasetReference = &bq.DatasetReference{DatasetId: d.DatasetID} + // Use Client.Location as a default. + if ds.Location == "" { + ds.Location = d.c.Location + } + call := d.c.bqs.Datasets.Insert(d.ProjectID, ds).Context(ctx) + setClientHeader(call.Header()) + _, err = call.Do() + return err +} + +func (dm *DatasetMetadata) toBQ() (*bq.Dataset, error) { + ds := &bq.Dataset{} + if dm == nil { + return ds, nil + } + ds.FriendlyName = dm.Name + ds.Description = dm.Description + ds.Location = dm.Location + ds.DefaultTableExpirationMs = int64(dm.DefaultTableExpiration / time.Millisecond) + ds.Labels = dm.Labels + var err error + ds.Access, err = accessListToBQ(dm.Access) + if err != nil { + return nil, err + } + if !dm.CreationTime.IsZero() { + return nil, errors.New("bigquery: Dataset.CreationTime is not writable") + } + if !dm.LastModifiedTime.IsZero() { + return nil, errors.New("bigquery: Dataset.LastModifiedTime is not writable") + } + if dm.FullID != "" { + return nil, errors.New("bigquery: Dataset.FullID is not writable") + } + if dm.ETag != "" { + return nil, errors.New("bigquery: Dataset.ETag is not writable") + } + return ds, nil +} + +func accessListToBQ(a []*AccessEntry) ([]*bq.DatasetAccess, error) { + var q []*bq.DatasetAccess + for _, e := range a { + a, err := e.toBQ() + if err != nil { + return nil, err + } + q = append(q, a) + } + return q, nil +} + +// Delete deletes the dataset. Delete will fail if the dataset is not empty. +func (d *Dataset) Delete(ctx context.Context) (err error) { + return d.deleteInternal(ctx, false) +} + +// DeleteWithContents deletes the dataset, as well as contained resources. +func (d *Dataset) DeleteWithContents(ctx context.Context) (err error) { + return d.deleteInternal(ctx, true) +} + +func (d *Dataset) deleteInternal(ctx context.Context, deleteContents bool) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Dataset.Delete") + defer func() { trace.EndSpan(ctx, err) }() + + call := d.c.bqs.Datasets.Delete(d.ProjectID, d.DatasetID).Context(ctx).DeleteContents(deleteContents) + setClientHeader(call.Header()) + return call.Do() +} + +// Metadata fetches the metadata for the dataset. +func (d *Dataset) Metadata(ctx context.Context) (md *DatasetMetadata, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Dataset.Metadata") + defer func() { trace.EndSpan(ctx, err) }() + + call := d.c.bqs.Datasets.Get(d.ProjectID, d.DatasetID).Context(ctx) + setClientHeader(call.Header()) + var ds *bq.Dataset + if err := runWithRetry(ctx, func() (err error) { + ds, err = call.Do() + return err + }); err != nil { + return nil, err + } + return bqToDatasetMetadata(ds) +} + +func bqToDatasetMetadata(d *bq.Dataset) (*DatasetMetadata, error) { + dm := &DatasetMetadata{ + CreationTime: unixMillisToTime(d.CreationTime), + LastModifiedTime: unixMillisToTime(d.LastModifiedTime), + DefaultTableExpiration: time.Duration(d.DefaultTableExpirationMs) * time.Millisecond, + Description: d.Description, + Name: d.FriendlyName, + FullID: d.Id, + Location: d.Location, + Labels: d.Labels, + ETag: d.Etag, + } + for _, a := range d.Access { + e, err := bqToAccessEntry(a, nil) + if err != nil { + return nil, err + } + dm.Access = append(dm.Access, e) + } + return dm, nil +} + +// Update modifies specific Dataset metadata fields. +// To perform a read-modify-write that protects against intervening reads, +// set the etag argument to the DatasetMetadata.ETag field from the read. +// Pass the empty string for etag for a "blind write" that will always succeed. +func (d *Dataset) Update(ctx context.Context, dm DatasetMetadataToUpdate, etag string) (md *DatasetMetadata, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Dataset.Update") + defer func() { trace.EndSpan(ctx, err) }() + + ds, err := dm.toBQ() + if err != nil { + return nil, err + } + call := d.c.bqs.Datasets.Patch(d.ProjectID, d.DatasetID, ds).Context(ctx) + setClientHeader(call.Header()) + if etag != "" { + call.Header().Set("If-Match", etag) + } + var ds2 *bq.Dataset + if err := runWithRetry(ctx, func() (err error) { + ds2, err = call.Do() + return err + }); err != nil { + return nil, err + } + return bqToDatasetMetadata(ds2) +} + +func (dm *DatasetMetadataToUpdate) toBQ() (*bq.Dataset, error) { + ds := &bq.Dataset{} + forceSend := func(field string) { + ds.ForceSendFields = append(ds.ForceSendFields, field) + } + + if dm.Description != nil { + ds.Description = optional.ToString(dm.Description) + forceSend("Description") + } + if dm.Name != nil { + ds.FriendlyName = optional.ToString(dm.Name) + forceSend("FriendlyName") + } + if dm.DefaultTableExpiration != nil { + dur := optional.ToDuration(dm.DefaultTableExpiration) + if dur == 0 { + // Send a null to delete the field. + ds.NullFields = append(ds.NullFields, "DefaultTableExpirationMs") + } else { + ds.DefaultTableExpirationMs = int64(dur / time.Millisecond) + } + } + if dm.Access != nil { + var err error + ds.Access, err = accessListToBQ(dm.Access) + if err != nil { + return nil, err + } + if len(ds.Access) == 0 { + ds.NullFields = append(ds.NullFields, "Access") + } + } + labels, forces, nulls := dm.update() + ds.Labels = labels + ds.ForceSendFields = append(ds.ForceSendFields, forces...) + ds.NullFields = append(ds.NullFields, nulls...) + return ds, nil +} + +// Table creates a handle to a BigQuery table in the dataset. +// To determine if a table exists, call Table.Metadata. +// If the table does not already exist, use Table.Create to create it. +func (d *Dataset) Table(tableID string) *Table { + return &Table{ProjectID: d.ProjectID, DatasetID: d.DatasetID, TableID: tableID, c: d.c} +} + +// Tables returns an iterator over the tables in the Dataset. +func (d *Dataset) Tables(ctx context.Context) *TableIterator { + it := &TableIterator{ + ctx: ctx, + dataset: d, + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.tables) }, + func() interface{} { b := it.tables; it.tables = nil; return b }) + return it +} + +// A TableIterator is an iterator over Tables. +type TableIterator struct { + ctx context.Context + dataset *Dataset + tables []*Table + pageInfo *iterator.PageInfo + nextFunc func() error +} + +// Next returns the next result. Its second return value is Done if there are +// no more results. Once Next returns Done, all subsequent calls will return +// Done. +func (it *TableIterator) Next() (*Table, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + t := it.tables[0] + it.tables = it.tables[1:] + return t, nil +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TableIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// for testing +var listTables = func(it *TableIterator, pageSize int, pageToken string) (*bq.TableList, error) { + call := it.dataset.c.bqs.Tables.List(it.dataset.ProjectID, it.dataset.DatasetID). + PageToken(pageToken). + Context(it.ctx) + setClientHeader(call.Header()) + if pageSize > 0 { + call.MaxResults(int64(pageSize)) + } + var res *bq.TableList + err := runWithRetry(it.ctx, func() (err error) { + res, err = call.Do() + return err + }) + return res, err +} + +func (it *TableIterator) fetch(pageSize int, pageToken string) (string, error) { + res, err := listTables(it, pageSize, pageToken) + if err != nil { + return "", err + } + for _, t := range res.Tables { + it.tables = append(it.tables, bqToTable(t.TableReference, it.dataset.c)) + } + return res.NextPageToken, nil +} + +func bqToTable(tr *bq.TableReference, c *Client) *Table { + if tr == nil { + return nil + } + return &Table{ + ProjectID: tr.ProjectId, + DatasetID: tr.DatasetId, + TableID: tr.TableId, + c: c, + } +} + +// Datasets returns an iterator over the datasets in a project. +// The Client's project is used by default, but that can be +// changed by setting ProjectID on the returned iterator before calling Next. +func (c *Client) Datasets(ctx context.Context) *DatasetIterator { + return c.DatasetsInProject(ctx, c.projectID) +} + +// DatasetsInProject returns an iterator over the datasets in the provided project. +// +// Deprecated: call Client.Datasets, then set ProjectID on the returned iterator. +func (c *Client) DatasetsInProject(ctx context.Context, projectID string) *DatasetIterator { + it := &DatasetIterator{ + ctx: ctx, + c: c, + ProjectID: projectID, + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +// DatasetIterator iterates over the datasets in a project. +type DatasetIterator struct { + // ListHidden causes hidden datasets to be listed when set to true. + // Set before the first call to Next. + ListHidden bool + + // Filter restricts the datasets returned by label. The filter syntax is described in + // https://cloud.google.com/bigquery/docs/labeling-datasets#filtering_datasets_using_labels + // Set before the first call to Next. + Filter string + + // The project ID of the listed datasets. + // Set before the first call to Next. + ProjectID string + + ctx context.Context + c *Client + pageInfo *iterator.PageInfo + nextFunc func() error + items []*Dataset +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *DatasetIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next Dataset. Its second return value is iterator.Done if +// there are no more results. Once Next returns Done, all subsequent calls will +// return Done. +func (it *DatasetIterator) Next() (*Dataset, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +// for testing +var listDatasets = func(it *DatasetIterator, pageSize int, pageToken string) (*bq.DatasetList, error) { + call := it.c.bqs.Datasets.List(it.ProjectID). + Context(it.ctx). + PageToken(pageToken). + All(it.ListHidden) + setClientHeader(call.Header()) + if pageSize > 0 { + call.MaxResults(int64(pageSize)) + } + if it.Filter != "" { + call.Filter(it.Filter) + } + var res *bq.DatasetList + err := runWithRetry(it.ctx, func() (err error) { + res, err = call.Do() + return err + }) + return res, err +} + +func (it *DatasetIterator) fetch(pageSize int, pageToken string) (string, error) { + res, err := listDatasets(it, pageSize, pageToken) + if err != nil { + return "", err + } + for _, d := range res.Datasets { + it.items = append(it.items, &Dataset{ + ProjectID: d.DatasetReference.ProjectId, + DatasetID: d.DatasetReference.DatasetId, + c: it.c, + }) + } + return res.NextPageToken, nil +} + +// An AccessEntry describes the permissions that an entity has on a dataset. +type AccessEntry struct { + Role AccessRole // The role of the entity + EntityType EntityType // The type of entity + Entity string // The entity (individual or group) granted access + View *Table // The view granted access (EntityType must be ViewEntity) +} + +// AccessRole is the level of access to grant to a dataset. +type AccessRole string + +const ( + // OwnerRole is the OWNER AccessRole. + OwnerRole AccessRole = "OWNER" + // ReaderRole is the READER AccessRole. + ReaderRole AccessRole = "READER" + // WriterRole is the WRITER AccessRole. + WriterRole AccessRole = "WRITER" +) + +// EntityType is the type of entity in an AccessEntry. +type EntityType int + +const ( + // DomainEntity is a domain (e.g. "example.com"). + DomainEntity EntityType = iota + 1 + + // GroupEmailEntity is an email address of a Google Group. + GroupEmailEntity + + // UserEmailEntity is an email address of an individual user. + UserEmailEntity + + // SpecialGroupEntity is a special group: one of projectOwners, projectReaders, projectWriters or + // allAuthenticatedUsers. + SpecialGroupEntity + + // ViewEntity is a BigQuery view. + ViewEntity +) + +func (e *AccessEntry) toBQ() (*bq.DatasetAccess, error) { + q := &bq.DatasetAccess{Role: string(e.Role)} + switch e.EntityType { + case DomainEntity: + q.Domain = e.Entity + case GroupEmailEntity: + q.GroupByEmail = e.Entity + case UserEmailEntity: + q.UserByEmail = e.Entity + case SpecialGroupEntity: + q.SpecialGroup = e.Entity + case ViewEntity: + q.View = e.View.toBQ() + default: + return nil, fmt.Errorf("bigquery: unknown entity type %d", e.EntityType) + } + return q, nil +} + +func bqToAccessEntry(q *bq.DatasetAccess, c *Client) (*AccessEntry, error) { + e := &AccessEntry{Role: AccessRole(q.Role)} + switch { + case q.Domain != "": + e.Entity = q.Domain + e.EntityType = DomainEntity + case q.GroupByEmail != "": + e.Entity = q.GroupByEmail + e.EntityType = GroupEmailEntity + case q.UserByEmail != "": + e.Entity = q.UserByEmail + e.EntityType = UserEmailEntity + case q.SpecialGroup != "": + e.Entity = q.SpecialGroup + e.EntityType = SpecialGroupEntity + case q.View != nil: + e.View = c.DatasetInProject(q.View.ProjectId, q.View.DatasetId).Table(q.View.TableId) + e.EntityType = ViewEntity + default: + return nil, errors.New("bigquery: invalid access value") + } + return e, nil +} diff --git a/vendor/cloud.google.com/go/bigquery/dataset_test.go b/vendor/cloud.google.com/go/bigquery/dataset_test.go new file mode 100644 index 000000000..03a050971 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/dataset_test.go @@ -0,0 +1,326 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "errors" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + bq "google.golang.org/api/bigquery/v2" + itest "google.golang.org/api/iterator/testing" +) + +// readServiceStub services read requests by returning data from an in-memory list of values. +type listTablesStub struct { + expectedProject, expectedDataset string + tables []*bq.TableListTables +} + +func (s *listTablesStub) listTables(it *TableIterator, pageSize int, pageToken string) (*bq.TableList, error) { + if it.dataset.ProjectID != s.expectedProject { + return nil, errors.New("wrong project id") + } + if it.dataset.DatasetID != s.expectedDataset { + return nil, errors.New("wrong dataset id") + } + const maxPageSize = 2 + if pageSize <= 0 || pageSize > maxPageSize { + pageSize = maxPageSize + } + start := 0 + if pageToken != "" { + var err error + start, err = strconv.Atoi(pageToken) + if err != nil { + return nil, err + } + } + end := start + pageSize + if end > len(s.tables) { + end = len(s.tables) + } + nextPageToken := "" + if end < len(s.tables) { + nextPageToken = strconv.Itoa(end) + } + return &bq.TableList{ + Tables: s.tables[start:end], + NextPageToken: nextPageToken, + }, nil +} + +func TestTables(t *testing.T) { + c := &Client{projectID: "p1"} + inTables := []*bq.TableListTables{ + {TableReference: &bq.TableReference{ProjectId: "p1", DatasetId: "d1", TableId: "t1"}}, + {TableReference: &bq.TableReference{ProjectId: "p1", DatasetId: "d1", TableId: "t2"}}, + {TableReference: &bq.TableReference{ProjectId: "p1", DatasetId: "d1", TableId: "t3"}}, + } + outTables := []*Table{ + {ProjectID: "p1", DatasetID: "d1", TableID: "t1", c: c}, + {ProjectID: "p1", DatasetID: "d1", TableID: "t2", c: c}, + {ProjectID: "p1", DatasetID: "d1", TableID: "t3", c: c}, + } + + lts := &listTablesStub{ + expectedProject: "p1", + expectedDataset: "d1", + tables: inTables, + } + old := listTables + listTables = lts.listTables // cannot use t.Parallel with this test + defer func() { listTables = old }() + + msg, ok := itest.TestIterator(outTables, + func() interface{} { return c.Dataset("d1").Tables(context.Background()) }, + func(it interface{}) (interface{}, error) { return it.(*TableIterator).Next() }) + if !ok { + t.Error(msg) + } +} + +type listDatasetsStub struct { + expectedProject string + datasets []*bq.DatasetListDatasets + hidden map[*bq.DatasetListDatasets]bool +} + +func (s *listDatasetsStub) listDatasets(it *DatasetIterator, pageSize int, pageToken string) (*bq.DatasetList, error) { + const maxPageSize = 2 + if pageSize <= 0 || pageSize > maxPageSize { + pageSize = maxPageSize + } + if it.Filter != "" { + return nil, errors.New("filter not supported") + } + if it.ProjectID != s.expectedProject { + return nil, errors.New("bad project ID") + } + start := 0 + if pageToken != "" { + var err error + start, err = strconv.Atoi(pageToken) + if err != nil { + return nil, err + } + } + var ( + i int + result []*bq.DatasetListDatasets + nextPageToken string + ) + for i = start; len(result) < pageSize && i < len(s.datasets); i++ { + if s.hidden[s.datasets[i]] && !it.ListHidden { + continue + } + result = append(result, s.datasets[i]) + } + if i < len(s.datasets) { + nextPageToken = strconv.Itoa(i) + } + return &bq.DatasetList{ + Datasets: result, + NextPageToken: nextPageToken, + }, nil +} + +func TestDatasets(t *testing.T) { + client := &Client{projectID: "p"} + inDatasets := []*bq.DatasetListDatasets{ + {DatasetReference: &bq.DatasetReference{ProjectId: "p", DatasetId: "a"}}, + {DatasetReference: &bq.DatasetReference{ProjectId: "p", DatasetId: "b"}}, + {DatasetReference: &bq.DatasetReference{ProjectId: "p", DatasetId: "hidden"}}, + {DatasetReference: &bq.DatasetReference{ProjectId: "p", DatasetId: "c"}}, + } + outDatasets := []*Dataset{ + {"p", "a", client}, + {"p", "b", client}, + {"p", "hidden", client}, + {"p", "c", client}, + } + lds := &listDatasetsStub{ + expectedProject: "p", + datasets: inDatasets, + hidden: map[*bq.DatasetListDatasets]bool{inDatasets[2]: true}, + } + old := listDatasets + listDatasets = lds.listDatasets // cannot use t.Parallel with this test + defer func() { listDatasets = old }() + + msg, ok := itest.TestIterator(outDatasets, + func() interface{} { it := client.Datasets(context.Background()); it.ListHidden = true; return it }, + func(it interface{}) (interface{}, error) { return it.(*DatasetIterator).Next() }) + if !ok { + t.Fatalf("ListHidden=true: %s", msg) + } + + msg, ok = itest.TestIterator([]*Dataset{outDatasets[0], outDatasets[1], outDatasets[3]}, + func() interface{} { it := client.Datasets(context.Background()); it.ListHidden = false; return it }, + func(it interface{}) (interface{}, error) { return it.(*DatasetIterator).Next() }) + if !ok { + t.Fatalf("ListHidden=false: %s", msg) + } +} + +func TestDatasetToBQ(t *testing.T) { + for _, test := range []struct { + in *DatasetMetadata + want *bq.Dataset + }{ + {nil, &bq.Dataset{}}, + {&DatasetMetadata{Name: "name"}, &bq.Dataset{FriendlyName: "name"}}, + {&DatasetMetadata{ + Name: "name", + Description: "desc", + DefaultTableExpiration: time.Hour, + Location: "EU", + Labels: map[string]string{"x": "y"}, + Access: []*AccessEntry{{Role: OwnerRole, Entity: "example.com", EntityType: DomainEntity}}, + }, &bq.Dataset{ + FriendlyName: "name", + Description: "desc", + DefaultTableExpirationMs: 60 * 60 * 1000, + Location: "EU", + Labels: map[string]string{"x": "y"}, + Access: []*bq.DatasetAccess{{Role: "OWNER", Domain: "example.com"}}, + }}, + } { + got, err := test.in.toBQ() + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, test.want) { + t.Errorf("%v:\ngot %+v\nwant %+v", test.in, got, test.want) + } + } + + // Check that non-writeable fields are unset. + aTime := time.Date(2017, 1, 26, 0, 0, 0, 0, time.Local) + for _, dm := range []*DatasetMetadata{ + {CreationTime: aTime}, + {LastModifiedTime: aTime}, + {FullID: "x"}, + {ETag: "e"}, + } { + if _, err := dm.toBQ(); err == nil { + t.Errorf("%+v: got nil, want error", dm) + } + } +} + +func TestBQToDatasetMetadata(t *testing.T) { + cTime := time.Date(2017, 1, 26, 0, 0, 0, 0, time.Local) + cMillis := cTime.UnixNano() / 1e6 + mTime := time.Date(2017, 10, 31, 0, 0, 0, 0, time.Local) + mMillis := mTime.UnixNano() / 1e6 + q := &bq.Dataset{ + CreationTime: cMillis, + LastModifiedTime: mMillis, + FriendlyName: "name", + Description: "desc", + DefaultTableExpirationMs: 60 * 60 * 1000, + Location: "EU", + Labels: map[string]string{"x": "y"}, + Access: []*bq.DatasetAccess{ + {Role: "READER", UserByEmail: "joe@example.com"}, + {Role: "WRITER", GroupByEmail: "users@example.com"}, + }, + Etag: "etag", + } + want := &DatasetMetadata{ + CreationTime: cTime, + LastModifiedTime: mTime, + Name: "name", + Description: "desc", + DefaultTableExpiration: time.Hour, + Location: "EU", + Labels: map[string]string{"x": "y"}, + Access: []*AccessEntry{ + {Role: ReaderRole, Entity: "joe@example.com", EntityType: UserEmailEntity}, + {Role: WriterRole, Entity: "users@example.com", EntityType: GroupEmailEntity}, + }, + ETag: "etag", + } + got, err := bqToDatasetMetadata(q) + if err != nil { + t.Fatal(err) + } + if diff := testutil.Diff(got, want); diff != "" { + t.Errorf("-got, +want:\n%s", diff) + } +} + +func TestDatasetMetadataToUpdateToBQ(t *testing.T) { + dm := DatasetMetadataToUpdate{ + Description: "desc", + Name: "name", + DefaultTableExpiration: time.Hour, + } + dm.SetLabel("label", "value") + dm.DeleteLabel("del") + + got, err := dm.toBQ() + if err != nil { + t.Fatal(err) + } + want := &bq.Dataset{ + Description: "desc", + FriendlyName: "name", + DefaultTableExpirationMs: 60 * 60 * 1000, + Labels: map[string]string{"label": "value"}, + ForceSendFields: []string{"Description", "FriendlyName"}, + NullFields: []string{"Labels.del"}, + } + if diff := testutil.Diff(got, want); diff != "" { + t.Errorf("-got, +want:\n%s", diff) + } +} + +func TestConvertAccessEntry(t *testing.T) { + c := &Client{projectID: "pid"} + for _, e := range []*AccessEntry{ + {Role: ReaderRole, Entity: "e", EntityType: DomainEntity}, + {Role: WriterRole, Entity: "e", EntityType: GroupEmailEntity}, + {Role: OwnerRole, Entity: "e", EntityType: UserEmailEntity}, + {Role: ReaderRole, Entity: "e", EntityType: SpecialGroupEntity}, + {Role: ReaderRole, EntityType: ViewEntity, + View: &Table{ProjectID: "p", DatasetID: "d", TableID: "t", c: c}}, + } { + q, err := e.toBQ() + if err != nil { + t.Fatal(err) + } + got, err := bqToAccessEntry(q, c) + if err != nil { + t.Fatal(err) + } + if diff := testutil.Diff(got, e, cmp.AllowUnexported(Table{}, Client{})); diff != "" { + t.Errorf("got=-, want=+:\n%s", diff) + } + } + + e := &AccessEntry{Role: ReaderRole, Entity: "e"} + if _, err := e.toBQ(); err == nil { + t.Error("got nil, want error") + } + if _, err := bqToAccessEntry(&bq.DatasetAccess{Role: "WRITER"}, nil); err == nil { + t.Error("got nil, want error") + } +} diff --git a/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/ListDataSources_smoke_test.go b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/ListDataSources_smoke_test.go new file mode 100644 index 000000000..3367617fa --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/ListDataSources_smoke_test.go @@ -0,0 +1,67 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package datatransfer + +import ( + datatransferpb "google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestDataTransferServiceSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var formattedParent string = fmt.Sprintf("projects/%s", projectId) + var request = &datatransferpb.ListDataSourcesRequest{ + Parent: formattedParent, + } + + iter := c.ListDataSources(ctx, request) + if _, err := iter.Next(); err != nil && err != iterator.Done { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/data_transfer_client.go b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/data_transfer_client.go new file mode 100644 index 000000000..fea963e0b --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/data_transfer_client.go @@ -0,0 +1,625 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package datatransfer + +import ( + "context" + "fmt" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + datatransferpb "google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + GetDataSource []gax.CallOption + ListDataSources []gax.CallOption + CreateTransferConfig []gax.CallOption + UpdateTransferConfig []gax.CallOption + DeleteTransferConfig []gax.CallOption + GetTransferConfig []gax.CallOption + ListTransferConfigs []gax.CallOption + ScheduleTransferRuns []gax.CallOption + GetTransferRun []gax.CallOption + DeleteTransferRun []gax.CallOption + ListTransferRuns []gax.CallOption + ListTransferLogs []gax.CallOption + CheckValidCreds []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("bigquerydatatransfer.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + GetDataSource: retry[[2]string{"default", "idempotent"}], + ListDataSources: retry[[2]string{"default", "idempotent"}], + CreateTransferConfig: retry[[2]string{"default", "non_idempotent"}], + UpdateTransferConfig: retry[[2]string{"default", "non_idempotent"}], + DeleteTransferConfig: retry[[2]string{"default", "idempotent"}], + GetTransferConfig: retry[[2]string{"default", "idempotent"}], + ListTransferConfigs: retry[[2]string{"default", "idempotent"}], + ScheduleTransferRuns: retry[[2]string{"default", "non_idempotent"}], + GetTransferRun: retry[[2]string{"default", "idempotent"}], + DeleteTransferRun: retry[[2]string{"default", "idempotent"}], + ListTransferRuns: retry[[2]string{"default", "idempotent"}], + ListTransferLogs: retry[[2]string{"default", "idempotent"}], + CheckValidCreds: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with BigQuery Data Transfer API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client datatransferpb.DataTransferServiceClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new data transfer service client. +// +// The Google BigQuery Data Transfer Service API enables BigQuery users to +// configure the transfer of their data from other Google Products into BigQuery. +// This service contains methods that are end user exposed. It backs up the +// frontend. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: datatransferpb.NewDataTransferServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// GetDataSource retrieves a supported data source and returns its settings, +// which can be used for UI rendering. +func (c *Client) GetDataSource(ctx context.Context, req *datatransferpb.GetDataSourceRequest, opts ...gax.CallOption) (*datatransferpb.DataSource, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetDataSource[0:len(c.CallOptions.GetDataSource):len(c.CallOptions.GetDataSource)], opts...) + var resp *datatransferpb.DataSource + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetDataSource(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListDataSources lists supported data sources and returns their settings, +// which can be used for UI rendering. +func (c *Client) ListDataSources(ctx context.Context, req *datatransferpb.ListDataSourcesRequest, opts ...gax.CallOption) *DataSourceIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListDataSources[0:len(c.CallOptions.ListDataSources):len(c.CallOptions.ListDataSources)], opts...) + it := &DataSourceIterator{} + req = proto.Clone(req).(*datatransferpb.ListDataSourcesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*datatransferpb.DataSource, string, error) { + var resp *datatransferpb.ListDataSourcesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListDataSources(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.DataSources, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// CreateTransferConfig creates a new data transfer configuration. +func (c *Client) CreateTransferConfig(ctx context.Context, req *datatransferpb.CreateTransferConfigRequest, opts ...gax.CallOption) (*datatransferpb.TransferConfig, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateTransferConfig[0:len(c.CallOptions.CreateTransferConfig):len(c.CallOptions.CreateTransferConfig)], opts...) + var resp *datatransferpb.TransferConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateTransferConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateTransferConfig updates a data transfer configuration. +// All fields must be set, even if they are not updated. +func (c *Client) UpdateTransferConfig(ctx context.Context, req *datatransferpb.UpdateTransferConfigRequest, opts ...gax.CallOption) (*datatransferpb.TransferConfig, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "transfer_config.name", req.GetTransferConfig().GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateTransferConfig[0:len(c.CallOptions.UpdateTransferConfig):len(c.CallOptions.UpdateTransferConfig)], opts...) + var resp *datatransferpb.TransferConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateTransferConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteTransferConfig deletes a data transfer configuration, +// including any associated transfer runs and logs. +func (c *Client) DeleteTransferConfig(ctx context.Context, req *datatransferpb.DeleteTransferConfigRequest, opts ...gax.CallOption) error { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteTransferConfig[0:len(c.CallOptions.DeleteTransferConfig):len(c.CallOptions.DeleteTransferConfig)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteTransferConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// GetTransferConfig returns information about a data transfer config. +func (c *Client) GetTransferConfig(ctx context.Context, req *datatransferpb.GetTransferConfigRequest, opts ...gax.CallOption) (*datatransferpb.TransferConfig, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetTransferConfig[0:len(c.CallOptions.GetTransferConfig):len(c.CallOptions.GetTransferConfig)], opts...) + var resp *datatransferpb.TransferConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetTransferConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListTransferConfigs returns information about all data transfers in the project. +func (c *Client) ListTransferConfigs(ctx context.Context, req *datatransferpb.ListTransferConfigsRequest, opts ...gax.CallOption) *TransferConfigIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListTransferConfigs[0:len(c.CallOptions.ListTransferConfigs):len(c.CallOptions.ListTransferConfigs)], opts...) + it := &TransferConfigIterator{} + req = proto.Clone(req).(*datatransferpb.ListTransferConfigsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*datatransferpb.TransferConfig, string, error) { + var resp *datatransferpb.ListTransferConfigsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListTransferConfigs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.TransferConfigs, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ScheduleTransferRuns creates transfer runs for a time range [start_time, end_time]. +// For each date - or whatever granularity the data source supports - in the +// range, one transfer run is created. +// Note that runs are created per UTC time in the time range. +func (c *Client) ScheduleTransferRuns(ctx context.Context, req *datatransferpb.ScheduleTransferRunsRequest, opts ...gax.CallOption) (*datatransferpb.ScheduleTransferRunsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ScheduleTransferRuns[0:len(c.CallOptions.ScheduleTransferRuns):len(c.CallOptions.ScheduleTransferRuns)], opts...) + var resp *datatransferpb.ScheduleTransferRunsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ScheduleTransferRuns(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetTransferRun returns information about the particular transfer run. +func (c *Client) GetTransferRun(ctx context.Context, req *datatransferpb.GetTransferRunRequest, opts ...gax.CallOption) (*datatransferpb.TransferRun, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetTransferRun[0:len(c.CallOptions.GetTransferRun):len(c.CallOptions.GetTransferRun)], opts...) + var resp *datatransferpb.TransferRun + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetTransferRun(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteTransferRun deletes the specified transfer run. +func (c *Client) DeleteTransferRun(ctx context.Context, req *datatransferpb.DeleteTransferRunRequest, opts ...gax.CallOption) error { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteTransferRun[0:len(c.CallOptions.DeleteTransferRun):len(c.CallOptions.DeleteTransferRun)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteTransferRun(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListTransferRuns returns information about running and completed jobs. +func (c *Client) ListTransferRuns(ctx context.Context, req *datatransferpb.ListTransferRunsRequest, opts ...gax.CallOption) *TransferRunIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListTransferRuns[0:len(c.CallOptions.ListTransferRuns):len(c.CallOptions.ListTransferRuns)], opts...) + it := &TransferRunIterator{} + req = proto.Clone(req).(*datatransferpb.ListTransferRunsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*datatransferpb.TransferRun, string, error) { + var resp *datatransferpb.ListTransferRunsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListTransferRuns(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.TransferRuns, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListTransferLogs returns user facing log messages for the data transfer run. +func (c *Client) ListTransferLogs(ctx context.Context, req *datatransferpb.ListTransferLogsRequest, opts ...gax.CallOption) *TransferMessageIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListTransferLogs[0:len(c.CallOptions.ListTransferLogs):len(c.CallOptions.ListTransferLogs)], opts...) + it := &TransferMessageIterator{} + req = proto.Clone(req).(*datatransferpb.ListTransferLogsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*datatransferpb.TransferMessage, string, error) { + var resp *datatransferpb.ListTransferLogsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListTransferLogs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.TransferMessages, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// CheckValidCreds returns true if valid credentials exist for the given data source and +// requesting user. +// Some data sources doesn't support service account, so we need to talk to +// them on behalf of the end user. This API just checks whether we have OAuth +// token for the particular user, which is a pre-requisite before user can +// create a transfer config. +func (c *Client) CheckValidCreds(ctx context.Context, req *datatransferpb.CheckValidCredsRequest, opts ...gax.CallOption) (*datatransferpb.CheckValidCredsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CheckValidCreds[0:len(c.CallOptions.CheckValidCreds):len(c.CallOptions.CheckValidCreds)], opts...) + var resp *datatransferpb.CheckValidCredsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CheckValidCreds(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DataSourceIterator manages a stream of *datatransferpb.DataSource. +type DataSourceIterator struct { + items []*datatransferpb.DataSource + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*datatransferpb.DataSource, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *DataSourceIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *DataSourceIterator) Next() (*datatransferpb.DataSource, error) { + var item *datatransferpb.DataSource + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *DataSourceIterator) bufLen() int { + return len(it.items) +} + +func (it *DataSourceIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// TransferConfigIterator manages a stream of *datatransferpb.TransferConfig. +type TransferConfigIterator struct { + items []*datatransferpb.TransferConfig + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*datatransferpb.TransferConfig, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TransferConfigIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *TransferConfigIterator) Next() (*datatransferpb.TransferConfig, error) { + var item *datatransferpb.TransferConfig + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TransferConfigIterator) bufLen() int { + return len(it.items) +} + +func (it *TransferConfigIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// TransferMessageIterator manages a stream of *datatransferpb.TransferMessage. +type TransferMessageIterator struct { + items []*datatransferpb.TransferMessage + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*datatransferpb.TransferMessage, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TransferMessageIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *TransferMessageIterator) Next() (*datatransferpb.TransferMessage, error) { + var item *datatransferpb.TransferMessage + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TransferMessageIterator) bufLen() int { + return len(it.items) +} + +func (it *TransferMessageIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// TransferRunIterator manages a stream of *datatransferpb.TransferRun. +type TransferRunIterator struct { + items []*datatransferpb.TransferRun + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*datatransferpb.TransferRun, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TransferRunIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *TransferRunIterator) Next() (*datatransferpb.TransferRun, error) { + var item *datatransferpb.TransferRun + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TransferRunIterator) bufLen() int { + return len(it.items) +} + +func (it *TransferRunIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/data_transfer_client_example_test.go b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/data_transfer_client_example_test.go new file mode 100644 index 000000000..6e43c6ba7 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/data_transfer_client_example_test.go @@ -0,0 +1,289 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package datatransfer_test + +import ( + "context" + + datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" + "google.golang.org/api/iterator" + datatransferpb "google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_GetDataSource() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.GetDataSourceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDataSource(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListDataSources() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.ListDataSourcesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListDataSources(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_CreateTransferConfig() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.CreateTransferConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateTransferConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateTransferConfig() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.UpdateTransferConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateTransferConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteTransferConfig() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.DeleteTransferConfigRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteTransferConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_GetTransferConfig() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.GetTransferConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTransferConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListTransferConfigs() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.ListTransferConfigsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTransferConfigs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_ScheduleTransferRuns() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.ScheduleTransferRunsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ScheduleTransferRuns(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetTransferRun() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.GetTransferRunRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTransferRun(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteTransferRun() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.DeleteTransferRunRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteTransferRun(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_ListTransferRuns() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.ListTransferRunsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTransferRuns(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_ListTransferLogs() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.ListTransferLogsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTransferLogs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_CheckValidCreds() { + ctx := context.Background() + c, err := datatransfer.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &datatransferpb.CheckValidCredsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CheckValidCreds(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/doc.go b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/doc.go new file mode 100644 index 000000000..6cd68697a --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/doc.go @@ -0,0 +1,90 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package datatransfer is an auto-generated package for the +// BigQuery Data Transfer API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Transfers data from partner SaaS applications to Google BigQuery on a +// scheduled, managed basis. +package datatransfer // import "cloud.google.com/go/bigquery/datatransfer/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/mock_test.go b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/mock_test.go new file mode 100644 index 000000000..f406f6725 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/mock_test.go @@ -0,0 +1,1146 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package datatransfer + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + timestamppb "github.com/golang/protobuf/ptypes/timestamp" + datatransferpb "google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1" + field_maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockDataTransferServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + datatransferpb.DataTransferServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockDataTransferServer) GetDataSource(ctx context.Context, req *datatransferpb.GetDataSourceRequest) (*datatransferpb.DataSource, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.DataSource), nil +} + +func (s *mockDataTransferServer) ListDataSources(ctx context.Context, req *datatransferpb.ListDataSourcesRequest) (*datatransferpb.ListDataSourcesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.ListDataSourcesResponse), nil +} + +func (s *mockDataTransferServer) CreateTransferConfig(ctx context.Context, req *datatransferpb.CreateTransferConfigRequest) (*datatransferpb.TransferConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.TransferConfig), nil +} + +func (s *mockDataTransferServer) UpdateTransferConfig(ctx context.Context, req *datatransferpb.UpdateTransferConfigRequest) (*datatransferpb.TransferConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.TransferConfig), nil +} + +func (s *mockDataTransferServer) DeleteTransferConfig(ctx context.Context, req *datatransferpb.DeleteTransferConfigRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockDataTransferServer) GetTransferConfig(ctx context.Context, req *datatransferpb.GetTransferConfigRequest) (*datatransferpb.TransferConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.TransferConfig), nil +} + +func (s *mockDataTransferServer) ListTransferConfigs(ctx context.Context, req *datatransferpb.ListTransferConfigsRequest) (*datatransferpb.ListTransferConfigsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.ListTransferConfigsResponse), nil +} + +func (s *mockDataTransferServer) ScheduleTransferRuns(ctx context.Context, req *datatransferpb.ScheduleTransferRunsRequest) (*datatransferpb.ScheduleTransferRunsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.ScheduleTransferRunsResponse), nil +} + +func (s *mockDataTransferServer) GetTransferRun(ctx context.Context, req *datatransferpb.GetTransferRunRequest) (*datatransferpb.TransferRun, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.TransferRun), nil +} + +func (s *mockDataTransferServer) DeleteTransferRun(ctx context.Context, req *datatransferpb.DeleteTransferRunRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockDataTransferServer) ListTransferRuns(ctx context.Context, req *datatransferpb.ListTransferRunsRequest) (*datatransferpb.ListTransferRunsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.ListTransferRunsResponse), nil +} + +func (s *mockDataTransferServer) ListTransferLogs(ctx context.Context, req *datatransferpb.ListTransferLogsRequest) (*datatransferpb.ListTransferLogsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.ListTransferLogsResponse), nil +} + +func (s *mockDataTransferServer) CheckValidCreds(ctx context.Context, req *datatransferpb.CheckValidCredsRequest) (*datatransferpb.CheckValidCredsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*datatransferpb.CheckValidCredsResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockDataTransfer mockDataTransferServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + datatransferpb.RegisterDataTransferServiceServer(serv, &mockDataTransfer) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestDataTransferServiceGetDataSource(t *testing.T) { + var name2 string = "name2-1052831874" + var dataSourceId string = "dataSourceId-1015796374" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var clientId string = "clientId-1904089585" + var supportsMultipleTransfers bool = true + var updateDeadlineSeconds int32 = 991471694 + var defaultSchedule string = "defaultSchedule-800168235" + var supportsCustomSchedule bool = true + var helpUrl string = "helpUrl-789431439" + var defaultDataRefreshWindowDays int32 = 1804935157 + var manualRunsDisabled bool = true + var expectedResponse = &datatransferpb.DataSource{ + Name: name2, + DataSourceId: dataSourceId, + DisplayName: displayName, + Description: description, + ClientId: clientId, + SupportsMultipleTransfers: supportsMultipleTransfers, + UpdateDeadlineSeconds: updateDeadlineSeconds, + DefaultSchedule: defaultSchedule, + SupportsCustomSchedule: supportsCustomSchedule, + HelpUrl: helpUrl, + DefaultDataRefreshWindowDays: defaultDataRefreshWindowDays, + ManualRunsDisabled: manualRunsDisabled, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/dataSources/%s", "[PROJECT]", "[DATA_SOURCE]") + var request = &datatransferpb.GetDataSourceRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDataSource(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceGetDataSourceError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/dataSources/%s", "[PROJECT]", "[DATA_SOURCE]") + var request = &datatransferpb.GetDataSourceRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDataSource(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceListDataSources(t *testing.T) { + var nextPageToken string = "" + var dataSourcesElement *datatransferpb.DataSource = &datatransferpb.DataSource{} + var dataSources = []*datatransferpb.DataSource{dataSourcesElement} + var expectedResponse = &datatransferpb.ListDataSourcesResponse{ + NextPageToken: nextPageToken, + DataSources: dataSources, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &datatransferpb.ListDataSourcesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDataSources(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.DataSources[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceListDataSourcesError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &datatransferpb.ListDataSourcesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDataSources(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceCreateTransferConfig(t *testing.T) { + var name string = "name3373707" + var destinationDatasetId string = "destinationDatasetId1541564179" + var displayName string = "displayName1615086568" + var dataSourceId string = "dataSourceId-1015796374" + var schedule string = "schedule-697920873" + var dataRefreshWindowDays int32 = 327632845 + var disabled bool = true + var userId int64 = 147132913 + var datasetRegion string = "datasetRegion959248539" + var expectedResponse = &datatransferpb.TransferConfig{ + Name: name, + DestinationDatasetId: destinationDatasetId, + DisplayName: displayName, + DataSourceId: dataSourceId, + Schedule: schedule, + DataRefreshWindowDays: dataRefreshWindowDays, + Disabled: disabled, + UserId: userId, + DatasetRegion: datasetRegion, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var transferConfig *datatransferpb.TransferConfig = &datatransferpb.TransferConfig{} + var request = &datatransferpb.CreateTransferConfigRequest{ + Parent: formattedParent, + TransferConfig: transferConfig, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateTransferConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceCreateTransferConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var transferConfig *datatransferpb.TransferConfig = &datatransferpb.TransferConfig{} + var request = &datatransferpb.CreateTransferConfigRequest{ + Parent: formattedParent, + TransferConfig: transferConfig, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateTransferConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceUpdateTransferConfig(t *testing.T) { + var name string = "name3373707" + var destinationDatasetId string = "destinationDatasetId1541564179" + var displayName string = "displayName1615086568" + var dataSourceId string = "dataSourceId-1015796374" + var schedule string = "schedule-697920873" + var dataRefreshWindowDays int32 = 327632845 + var disabled bool = true + var userId int64 = 147132913 + var datasetRegion string = "datasetRegion959248539" + var expectedResponse = &datatransferpb.TransferConfig{ + Name: name, + DestinationDatasetId: destinationDatasetId, + DisplayName: displayName, + DataSourceId: dataSourceId, + Schedule: schedule, + DataRefreshWindowDays: dataRefreshWindowDays, + Disabled: disabled, + UserId: userId, + DatasetRegion: datasetRegion, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var transferConfig *datatransferpb.TransferConfig = &datatransferpb.TransferConfig{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &datatransferpb.UpdateTransferConfigRequest{ + TransferConfig: transferConfig, + UpdateMask: updateMask, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateTransferConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceUpdateTransferConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var transferConfig *datatransferpb.TransferConfig = &datatransferpb.TransferConfig{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &datatransferpb.UpdateTransferConfigRequest{ + TransferConfig: transferConfig, + UpdateMask: updateMask, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateTransferConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceDeleteTransferConfig(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/transferConfigs/%s", "[PROJECT]", "[TRANSFER_CONFIG]") + var request = &datatransferpb.DeleteTransferConfigRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTransferConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDataTransferServiceDeleteTransferConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/transferConfigs/%s", "[PROJECT]", "[TRANSFER_CONFIG]") + var request = &datatransferpb.DeleteTransferConfigRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTransferConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDataTransferServiceGetTransferConfig(t *testing.T) { + var name2 string = "name2-1052831874" + var destinationDatasetId string = "destinationDatasetId1541564179" + var displayName string = "displayName1615086568" + var dataSourceId string = "dataSourceId-1015796374" + var schedule string = "schedule-697920873" + var dataRefreshWindowDays int32 = 327632845 + var disabled bool = true + var userId int64 = 147132913 + var datasetRegion string = "datasetRegion959248539" + var expectedResponse = &datatransferpb.TransferConfig{ + Name: name2, + DestinationDatasetId: destinationDatasetId, + DisplayName: displayName, + DataSourceId: dataSourceId, + Schedule: schedule, + DataRefreshWindowDays: dataRefreshWindowDays, + Disabled: disabled, + UserId: userId, + DatasetRegion: datasetRegion, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/transferConfigs/%s", "[PROJECT]", "[TRANSFER_CONFIG]") + var request = &datatransferpb.GetTransferConfigRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTransferConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceGetTransferConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/transferConfigs/%s", "[PROJECT]", "[TRANSFER_CONFIG]") + var request = &datatransferpb.GetTransferConfigRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTransferConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceListTransferConfigs(t *testing.T) { + var nextPageToken string = "" + var transferConfigsElement *datatransferpb.TransferConfig = &datatransferpb.TransferConfig{} + var transferConfigs = []*datatransferpb.TransferConfig{transferConfigsElement} + var expectedResponse = &datatransferpb.ListTransferConfigsResponse{ + NextPageToken: nextPageToken, + TransferConfigs: transferConfigs, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &datatransferpb.ListTransferConfigsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTransferConfigs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.TransferConfigs[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceListTransferConfigsError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &datatransferpb.ListTransferConfigsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTransferConfigs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceScheduleTransferRuns(t *testing.T) { + var expectedResponse *datatransferpb.ScheduleTransferRunsResponse = &datatransferpb.ScheduleTransferRunsResponse{} + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/transferConfigs/%s", "[PROJECT]", "[TRANSFER_CONFIG]") + var startTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var endTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &datatransferpb.ScheduleTransferRunsRequest{ + Parent: formattedParent, + StartTime: startTime, + EndTime: endTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ScheduleTransferRuns(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceScheduleTransferRunsError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/transferConfigs/%s", "[PROJECT]", "[TRANSFER_CONFIG]") + var startTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var endTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &datatransferpb.ScheduleTransferRunsRequest{ + Parent: formattedParent, + StartTime: startTime, + EndTime: endTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ScheduleTransferRuns(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceGetTransferRun(t *testing.T) { + var name2 string = "name2-1052831874" + var destinationDatasetId string = "destinationDatasetId1541564179" + var dataSourceId string = "dataSourceId-1015796374" + var userId int64 = 147132913 + var schedule string = "schedule-697920873" + var expectedResponse = &datatransferpb.TransferRun{ + Name: name2, + DestinationDatasetId: destinationDatasetId, + DataSourceId: dataSourceId, + UserId: userId, + Schedule: schedule, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/transferConfigs/%s/runs/%s", "[PROJECT]", "[TRANSFER_CONFIG]", "[RUN]") + var request = &datatransferpb.GetTransferRunRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTransferRun(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceGetTransferRunError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/transferConfigs/%s/runs/%s", "[PROJECT]", "[TRANSFER_CONFIG]", "[RUN]") + var request = &datatransferpb.GetTransferRunRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTransferRun(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceDeleteTransferRun(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/transferConfigs/%s/runs/%s", "[PROJECT]", "[TRANSFER_CONFIG]", "[RUN]") + var request = &datatransferpb.DeleteTransferRunRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTransferRun(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDataTransferServiceDeleteTransferRunError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/transferConfigs/%s/runs/%s", "[PROJECT]", "[TRANSFER_CONFIG]", "[RUN]") + var request = &datatransferpb.DeleteTransferRunRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTransferRun(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDataTransferServiceListTransferRuns(t *testing.T) { + var nextPageToken string = "" + var transferRunsElement *datatransferpb.TransferRun = &datatransferpb.TransferRun{} + var transferRuns = []*datatransferpb.TransferRun{transferRunsElement} + var expectedResponse = &datatransferpb.ListTransferRunsResponse{ + NextPageToken: nextPageToken, + TransferRuns: transferRuns, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/transferConfigs/%s", "[PROJECT]", "[TRANSFER_CONFIG]") + var request = &datatransferpb.ListTransferRunsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTransferRuns(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.TransferRuns[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceListTransferRunsError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/transferConfigs/%s", "[PROJECT]", "[TRANSFER_CONFIG]") + var request = &datatransferpb.ListTransferRunsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTransferRuns(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceListTransferLogs(t *testing.T) { + var nextPageToken string = "" + var transferMessagesElement *datatransferpb.TransferMessage = &datatransferpb.TransferMessage{} + var transferMessages = []*datatransferpb.TransferMessage{transferMessagesElement} + var expectedResponse = &datatransferpb.ListTransferLogsResponse{ + NextPageToken: nextPageToken, + TransferMessages: transferMessages, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/transferConfigs/%s/runs/%s", "[PROJECT]", "[TRANSFER_CONFIG]", "[RUN]") + var request = &datatransferpb.ListTransferLogsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTransferLogs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.TransferMessages[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceListTransferLogsError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/transferConfigs/%s/runs/%s", "[PROJECT]", "[TRANSFER_CONFIG]", "[RUN]") + var request = &datatransferpb.ListTransferLogsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTransferLogs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDataTransferServiceCheckValidCreds(t *testing.T) { + var hasValidCreds bool = false + var expectedResponse = &datatransferpb.CheckValidCredsResponse{ + HasValidCreds: hasValidCreds, + } + + mockDataTransfer.err = nil + mockDataTransfer.reqs = nil + + mockDataTransfer.resps = append(mockDataTransfer.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/dataSources/%s", "[PROJECT]", "[DATA_SOURCE]") + var request = &datatransferpb.CheckValidCredsRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CheckValidCreds(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDataTransfer.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDataTransferServiceCheckValidCredsError(t *testing.T) { + errCode := codes.PermissionDenied + mockDataTransfer.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/dataSources/%s", "[PROJECT]", "[DATA_SOURCE]") + var request = &datatransferpb.CheckValidCredsRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CheckValidCreds(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/path_funcs.go b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/path_funcs.go new file mode 100644 index 000000000..89eb5bb17 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/datatransfer/apiv1/path_funcs.go @@ -0,0 +1,135 @@ +// 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 +// +// https://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 datatransfer + +// ProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func ProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// LocationPath returns the path for the location resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/locations/%s", project, location) +// instead. +func LocationPath(project, location string) string { + return "" + + "projects/" + + project + + "/locations/" + + location + + "" +} + +// LocationDataSourcePath returns the path for the location data source resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/locations/%s/dataSources/%s", project, location, dataSource) +// instead. +func LocationDataSourcePath(project, location, dataSource string) string { + return "" + + "projects/" + + project + + "/locations/" + + location + + "/dataSources/" + + dataSource + + "" +} + +// LocationTransferConfigPath returns the path for the location transfer config resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/locations/%s/transferConfigs/%s", project, location, transferConfig) +// instead. +func LocationTransferConfigPath(project, location, transferConfig string) string { + return "" + + "projects/" + + project + + "/locations/" + + location + + "/transferConfigs/" + + transferConfig + + "" +} + +// LocationRunPath returns the path for the location run resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/locations/%s/transferConfigs/%s/runs/%s", project, location, transferConfig, run) +// instead. +func LocationRunPath(project, location, transferConfig, run string) string { + return "" + + "projects/" + + project + + "/locations/" + + location + + "/transferConfigs/" + + transferConfig + + "/runs/" + + run + + "" +} + +// DataSourcePath returns the path for the data source resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/dataSources/%s", project, dataSource) +// instead. +func DataSourcePath(project, dataSource string) string { + return "" + + "projects/" + + project + + "/dataSources/" + + dataSource + + "" +} + +// TransferConfigPath returns the path for the transfer config resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/transferConfigs/%s", project, transferConfig) +// instead. +func TransferConfigPath(project, transferConfig string) string { + return "" + + "projects/" + + project + + "/transferConfigs/" + + transferConfig + + "" +} + +// RunPath returns the path for the run resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/transferConfigs/%s/runs/%s", project, transferConfig, run) +// instead. +func RunPath(project, transferConfig, run string) string { + return "" + + "projects/" + + project + + "/transferConfigs/" + + transferConfig + + "/runs/" + + run + + "" +} diff --git a/vendor/cloud.google.com/go/bigquery/doc.go b/vendor/cloud.google.com/go/bigquery/doc.go new file mode 100644 index 000000000..43e491ce4 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/doc.go @@ -0,0 +1,310 @@ +// Copyright 2015 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 bigquery provides a client for the BigQuery service. + +Note: This package is in beta. Some backwards-incompatible changes may occur. + +The following assumes a basic familiarity with BigQuery concepts. +See https://cloud.google.com/bigquery/docs. + +See https://godoc.org/cloud.google.com/go for authentication, timeouts, +connection pooling and similar aspects of this package. + + +Creating a Client + +To start working with this package, create a client: + + ctx := context.Background() + client, err := bigquery.NewClient(ctx, projectID) + if err != nil { + // TODO: Handle error. + } + +Querying + +To query existing tables, create a Query and call its Read method: + + q := client.Query(` + SELECT year, SUM(number) as num + FROM [bigquery-public-data:usa_names.usa_1910_2013] + WHERE name = "William" + GROUP BY year + ORDER BY year + `) + it, err := q.Read(ctx) + if err != nil { + // TODO: Handle error. + } + +Then iterate through the resulting rows. You can store a row using +anything that implements the ValueLoader interface, or with a slice or map of bigquery.Value. +A slice is simplest: + + for { + var values []bigquery.Value + err := it.Next(&values) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(values) + } + +You can also use a struct whose exported fields match the query: + + type Count struct { + Year int + Num int + } + for { + var c Count + err := it.Next(&c) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(c) + } + +You can also start the query running and get the results later. +Create the query as above, but call Run instead of Read. This returns a Job, +which represents an asynchronous operation. + + job, err := q.Run(ctx) + if err != nil { + // TODO: Handle error. + } + +Get the job's ID, a printable string. You can save this string to retrieve +the results at a later time, even in another process. + + jobID := job.ID() + fmt.Printf("The job ID is %s\n", jobID) + +To retrieve the job's results from the ID, first look up the Job: + + job, err = client.JobFromID(ctx, jobID) + if err != nil { + // TODO: Handle error. + } + +Use the Job.Read method to obtain an iterator, and loop over the rows. +Query.Read is just a convenience method that combines Query.Run and Job.Read. + + it, err = job.Read(ctx) + if err != nil { + // TODO: Handle error. + } + // Proceed with iteration as above. + +Datasets and Tables + +You can refer to datasets in the client's project with the Dataset method, and +in other projects with the DatasetInProject method: + + myDataset := client.Dataset("my_dataset") + yourDataset := client.DatasetInProject("your-project-id", "your_dataset") + +These methods create references to datasets, not the datasets themselves. You can have +a dataset reference even if the dataset doesn't exist yet. Use Dataset.Create to +create a dataset from a reference: + + if err := myDataset.Create(ctx, nil); err != nil { + // TODO: Handle error. + } + +You can refer to tables with Dataset.Table. Like bigquery.Dataset, bigquery.Table is a reference +to an object in BigQuery that may or may not exist. + + table := myDataset.Table("my_table") + +You can create, delete and update the metadata of tables with methods on Table. +For instance, you could create a temporary table with: + + err = myDataset.Table("temp").Create(ctx, &bigquery.TableMetadata{ + ExpirationTime: time.Now().Add(1*time.Hour)}) + if err != nil { + // TODO: Handle error. + } + +We'll see how to create a table with a schema in the next section. + +Schemas + +There are two ways to construct schemas with this package. +You can build a schema by hand, like so: + + schema1 := bigquery.Schema{ + {Name: "Name", Required: true, Type: bigquery.StringFieldType}, + {Name: "Grades", Repeated: true, Type: bigquery.IntegerFieldType}, + {Name: "Optional", Required: false, Type: bigquery.IntegerFieldType}, + } + +Or you can infer the schema from a struct: + + type student struct { + Name string + Grades []int + Optional bigquery.NullInt64 + } + schema2, err := bigquery.InferSchema(student{}) + if err != nil { + // TODO: Handle error. + } + // schema1 and schema2 are identical. + +Struct inference supports tags like those of the encoding/json package, so you can +change names, ignore fields, or mark a field as nullable (non-required). Fields +declared as one of the Null types (NullInt64, NullFloat64, NullString, NullBool, +NullTimestamp, NullDate, NullTime and NullDateTime) are automatically inferred as +nullable, so the "nullable" tag is only needed for []byte, *big.Rat and +pointer-to-struct fields. + + type student2 struct { + Name string `bigquery:"full_name"` + Grades []int + Secret string `bigquery:"-"` + Optional []byte `bigquery:",nullable" + } + schema3, err := bigquery.InferSchema(student2{}) + if err != nil { + // TODO: Handle error. + } + // schema3 has required fields "full_name" and "Grade", and nullable BYTES field "Optional". + +Having constructed a schema, you can create a table with it like so: + + if err := table.Create(ctx, &bigquery.TableMetadata{Schema: schema1}); err != nil { + // TODO: Handle error. + } + +Copying + +You can copy one or more tables to another table. Begin by constructing a Copier +describing the copy. Then set any desired copy options, and finally call Run to get a Job: + + copier := myDataset.Table("dest").CopierFrom(myDataset.Table("src")) + copier.WriteDisposition = bigquery.WriteTruncate + job, err = copier.Run(ctx) + if err != nil { + // TODO: Handle error. + } + +You can chain the call to Run if you don't want to set options: + + job, err = myDataset.Table("dest").CopierFrom(myDataset.Table("src")).Run(ctx) + if err != nil { + // TODO: Handle error. + } + +You can wait for your job to complete: + + status, err := job.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + +Job.Wait polls with exponential backoff. You can also poll yourself, if you +wish: + + for { + status, err := job.Status(ctx) + if err != nil { + // TODO: Handle error. + } + if status.Done() { + if status.Err() != nil { + log.Fatalf("Job failed with error %v", status.Err()) + } + break + } + time.Sleep(pollInterval) + } + +Loading and Uploading + +There are two ways to populate a table with this package: load the data from a Google Cloud Storage +object, or upload rows directly from your program. + +For loading, first create a GCSReference, configuring it if desired. Then make a Loader, optionally configure +it as well, and call its Run method. + + gcsRef := bigquery.NewGCSReference("gs://my-bucket/my-object") + gcsRef.AllowJaggedRows = true + loader := myDataset.Table("dest").LoaderFrom(gcsRef) + loader.CreateDisposition = bigquery.CreateNever + job, err = loader.Run(ctx) + // Poll the job for completion if desired, as above. + +To upload, first define a type that implements the ValueSaver interface, which has a single method named Save. +Then create an Uploader, and call its Put method with a slice of values. + + u := table.Uploader() + // Item implements the ValueSaver interface. + items := []*Item{ + {Name: "n1", Size: 32.6, Count: 7}, + {Name: "n2", Size: 4, Count: 2}, + {Name: "n3", Size: 101.5, Count: 1}, + } + if err := u.Put(ctx, items); err != nil { + // TODO: Handle error. + } + +You can also upload a struct that doesn't implement ValueSaver. Use the StructSaver type +to specify the schema and insert ID by hand, or just supply the struct or struct pointer +directly and the schema will be inferred: + + type Item2 struct { + Name string + Size float64 + Count int + } + // Item implements the ValueSaver interface. + items2 := []*Item2{ + {Name: "n1", Size: 32.6, Count: 7}, + {Name: "n2", Size: 4, Count: 2}, + {Name: "n3", Size: 101.5, Count: 1}, + } + if err := u.Put(ctx, items2); err != nil { + // TODO: Handle error. + } + +Extracting + +If you've been following so far, extracting data from a BigQuery table +into a Google Cloud Storage object will feel familiar. First create an +Extractor, then optionally configure it, and lastly call its Run method. + + extractor := table.ExtractorTo(gcsRef) + extractor.DisableHeader = true + job, err = extractor.Run(ctx) + // Poll the job for completion if desired, as above. + +Errors + +Errors returned by this client are often of the type [`googleapi.Error`](https://godoc.org/google.golang.org/api/googleapi#Error). +These errors can be introspected for more information by type asserting to the richer `googleapi.Error` type. For example: + + if e, ok := err.(*googleapi.Error); ok { + if e.Code = 409 { ... } + } +*/ +package bigquery // import "cloud.google.com/go/bigquery" diff --git a/vendor/cloud.google.com/go/bigquery/error.go b/vendor/cloud.google.com/go/bigquery/error.go new file mode 100644 index 000000000..27e869825 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/error.go @@ -0,0 +1,83 @@ +// Copyright 2015 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 bigquery + +import ( + "fmt" + + bq "google.golang.org/api/bigquery/v2" +) + +// An Error contains detailed information about a failed bigquery operation. +// Detailed description of possible Reasons can be found here: https://cloud.google.com/bigquery/troubleshooting-errors. +type Error struct { + // Mirrors bq.ErrorProto, but drops DebugInfo + Location, Message, Reason string +} + +func (e Error) Error() string { + return fmt.Sprintf("{Location: %q; Message: %q; Reason: %q}", e.Location, e.Message, e.Reason) +} + +func bqToError(ep *bq.ErrorProto) *Error { + if ep == nil { + return nil + } + return &Error{ + Location: ep.Location, + Message: ep.Message, + Reason: ep.Reason, + } +} + +// A MultiError contains multiple related errors. +type MultiError []error + +func (m MultiError) Error() string { + switch len(m) { + case 0: + return "(0 errors)" + case 1: + return m[0].Error() + case 2: + return m[0].Error() + " (and 1 other error)" + } + return fmt.Sprintf("%s (and %d other errors)", m[0].Error(), len(m)-1) +} + +// RowInsertionError contains all errors that occurred when attempting to insert a row. +type RowInsertionError struct { + InsertID string // The InsertID associated with the affected row. + RowIndex int // The 0-based index of the affected row in the batch of rows being inserted. + Errors MultiError +} + +func (e *RowInsertionError) Error() string { + errFmt := "insertion of row [insertID: %q; insertIndex: %v] failed with error: %s" + return fmt.Sprintf(errFmt, e.InsertID, e.RowIndex, e.Errors.Error()) +} + +// PutMultiError contains an error for each row which was not successfully inserted +// into a BigQuery table. +type PutMultiError []RowInsertionError + +func (pme PutMultiError) Error() string { + plural := "s" + if len(pme) == 1 { + plural = "" + } + + return fmt.Sprintf("%v row insertion%s failed", len(pme), plural) +} diff --git a/vendor/cloud.google.com/go/bigquery/error_test.go b/vendor/cloud.google.com/go/bigquery/error_test.go new file mode 100644 index 000000000..7442f6205 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/error_test.go @@ -0,0 +1,109 @@ +// Copyright 2015 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 bigquery + +import ( + "errors" + "strings" + "testing" + + "cloud.google.com/go/internal/testutil" + bq "google.golang.org/api/bigquery/v2" +) + +func rowInsertionError(msg string) RowInsertionError { + return RowInsertionError{Errors: []error{errors.New(msg)}} +} + +func TestPutMultiErrorString(t *testing.T) { + testCases := []struct { + errs PutMultiError + want string + }{ + { + errs: PutMultiError{}, + want: "0 row insertions failed", + }, + { + errs: PutMultiError{rowInsertionError("a")}, + want: "1 row insertion failed", + }, + { + errs: PutMultiError{rowInsertionError("a"), rowInsertionError("b")}, + want: "2 row insertions failed", + }, + } + + for _, tc := range testCases { + if tc.errs.Error() != tc.want { + t.Errorf("PutMultiError string: got:\n%v\nwant:\n%v", tc.errs.Error(), tc.want) + } + } +} + +func TestMultiErrorString(t *testing.T) { + testCases := []struct { + errs MultiError + want string + }{ + { + errs: MultiError{}, + want: "(0 errors)", + }, + { + errs: MultiError{errors.New("a")}, + want: "a", + }, + { + errs: MultiError{errors.New("a"), errors.New("b")}, + want: "a (and 1 other error)", + }, + { + errs: MultiError{errors.New("a"), errors.New("b"), errors.New("c")}, + want: "a (and 2 other errors)", + }, + } + + for _, tc := range testCases { + if tc.errs.Error() != tc.want { + t.Errorf("PutMultiError string: got:\n%v\nwant:\n%v", tc.errs.Error(), tc.want) + } + } +} + +func TestErrorFromErrorProto(t *testing.T) { + for _, test := range []struct { + in *bq.ErrorProto + want *Error + }{ + {nil, nil}, + { + in: &bq.ErrorProto{Location: "L", Message: "M", Reason: "R"}, + want: &Error{Location: "L", Message: "M", Reason: "R"}, + }, + } { + if got := bqToError(test.in); !testutil.Equal(got, test.want) { + t.Errorf("%v: got %v, want %v", test.in, got, test.want) + } + } +} + +func TestErrorString(t *testing.T) { + e := &Error{Location: "", Message: "", Reason: ""} + got := e.Error() + if !strings.Contains(got, "") || !strings.Contains(got, "") || !strings.Contains(got, "") { + t.Errorf(`got %q, expected to see "", "" and ""`, got) + } +} diff --git a/vendor/cloud.google.com/go/bigquery/examples_test.go b/vendor/cloud.google.com/go/bigquery/examples_test.go new file mode 100644 index 000000000..4c5681386 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/examples_test.go @@ -0,0 +1,829 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bigquery_test + +import ( + "context" + "fmt" + "os" + "time" + + "cloud.google.com/go/bigquery" + "google.golang.org/api/iterator" +) + +func ExampleNewClient() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + _ = client // TODO: Use client. +} + +func ExampleClient_Dataset() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ds := client.Dataset("my_dataset") + fmt.Println(ds) +} + +func ExampleClient_DatasetInProject() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ds := client.DatasetInProject("their-project-id", "their-dataset") + fmt.Println(ds) +} + +func ExampleClient_Datasets() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.Datasets(ctx) + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleClient_DatasetsInProject() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.DatasetsInProject(ctx, "their-project-id") + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func getJobID() string { return "" } + +func ExampleClient_JobFromID() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + jobID := getJobID() // Get a job ID using Job.ID, the console or elsewhere. + job, err := client.JobFromID(ctx, jobID) + if err != nil { + // TODO: Handle error. + } + fmt.Println(job.LastStatus()) // Display the job's status. +} + +func ExampleClient_Jobs() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.Jobs(ctx) + it.State = bigquery.Running // list only running jobs. + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleNewGCSReference() { + gcsRef := bigquery.NewGCSReference("gs://my-bucket/my-object") + fmt.Println(gcsRef) +} + +func ExampleClient_Query() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + q := client.Query("select name, num from t1") + q.DefaultProjectID = "project-id" + // TODO: set other options on the Query. + // TODO: Call Query.Run or Query.Read. +} + +func ExampleClient_Query_parameters() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + q := client.Query("select num from t1 where name = @user") + q.Parameters = []bigquery.QueryParameter{ + {Name: "user", Value: "Elizabeth"}, + } + // TODO: set other options on the Query. + // TODO: Call Query.Run or Query.Read. +} + +// This example demonstrates how to run a query job on a table +// with a customer-managed encryption key. The same +// applies to load and copy jobs as well. +func ExampleClient_Query_encryptionKey() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + q := client.Query("select name, num from t1") + // TODO: Replace this key with a key you have created in Cloud KMS. + keyName := "projects/P/locations/L/keyRings/R/cryptoKeys/K" + q.DestinationEncryptionConfig = &bigquery.EncryptionConfig{KMSKeyName: keyName} + // TODO: set other options on the Query. + // TODO: Call Query.Run or Query.Read. +} + +func ExampleQuery_Read() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + q := client.Query("select name, num from t1") + it, err := q.Read(ctx) + if err != nil { + // TODO: Handle error. + } + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleRowIterator_Next() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + q := client.Query("select name, num from t1") + it, err := q.Read(ctx) + if err != nil { + // TODO: Handle error. + } + for { + var row []bigquery.Value + err := it.Next(&row) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(row) + } +} + +func ExampleRowIterator_Next_struct() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + type score struct { + Name string + Num int + } + + q := client.Query("select name, num from t1") + it, err := q.Read(ctx) + if err != nil { + // TODO: Handle error. + } + for { + var s score + err := it.Next(&s) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(s) + } +} + +func ExampleJob_Read() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + q := client.Query("select name, num from t1") + // Call Query.Run to get a Job, then call Read on the job. + // Note: Query.Read is a shorthand for this. + job, err := q.Run(ctx) + if err != nil { + // TODO: Handle error. + } + it, err := job.Read(ctx) + if err != nil { + // TODO: Handle error. + } + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleJob_Wait() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ds := client.Dataset("my_dataset") + job, err := ds.Table("t1").CopierFrom(ds.Table("t2")).Run(ctx) + if err != nil { + // TODO: Handle error. + } + status, err := job.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + if status.Err() != nil { + // TODO: Handle error. + } +} + +func ExampleJob_Config() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ds := client.Dataset("my_dataset") + job, err := ds.Table("t1").CopierFrom(ds.Table("t2")).Run(ctx) + if err != nil { + // TODO: Handle error. + } + jc, err := job.Config() + if err != nil { + // TODO: Handle error. + } + copyConfig := jc.(*bigquery.CopyConfig) + fmt.Println(copyConfig.Dst, copyConfig.CreateDisposition) +} + +func ExampleDataset_Create() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ds := client.Dataset("my_dataset") + if err := ds.Create(ctx, &bigquery.DatasetMetadata{Location: "EU"}); err != nil { + // TODO: Handle error. + } +} + +func ExampleDataset_Delete() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + if err := client.Dataset("my_dataset").Delete(ctx); err != nil { + // TODO: Handle error. + } +} + +func ExampleDataset_Metadata() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + md, err := client.Dataset("my_dataset").Metadata(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Println(md) +} + +// This example illustrates how to perform a read-modify-write sequence on dataset +// metadata. Passing the metadata's ETag to the Update call ensures that the call +// will fail if the metadata was changed since the read. +func ExampleDataset_Update_readModifyWrite() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ds := client.Dataset("my_dataset") + md, err := ds.Metadata(ctx) + if err != nil { + // TODO: Handle error. + } + md2, err := ds.Update(ctx, + bigquery.DatasetMetadataToUpdate{Name: "new " + md.Name}, + md.ETag) + if err != nil { + // TODO: Handle error. + } + fmt.Println(md2) +} + +// To perform a blind write, ignoring the existing state (and possibly overwriting +// other updates), pass the empty string as the etag. +func ExampleDataset_Update_blindWrite() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + md, err := client.Dataset("my_dataset").Update(ctx, bigquery.DatasetMetadataToUpdate{Name: "blind"}, "") + if err != nil { + // TODO: Handle error. + } + fmt.Println(md) +} + +func ExampleDataset_Table() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + // Table creates a reference to the table. It does not create the actual + // table in BigQuery; to do so, use Table.Create. + t := client.Dataset("my_dataset").Table("my_table") + fmt.Println(t) +} + +func ExampleDataset_Tables() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.Dataset("my_dataset").Tables(ctx) + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleDatasetIterator_Next() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.Datasets(ctx) + for { + ds, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(ds) + } +} + +func ExampleInferSchema() { + type Item struct { + Name string + Size float64 + Count int + } + schema, err := bigquery.InferSchema(Item{}) + if err != nil { + fmt.Println(err) + // TODO: Handle error. + } + for _, fs := range schema { + fmt.Println(fs.Name, fs.Type) + } + // Output: + // Name STRING + // Size FLOAT + // Count INTEGER +} + +func ExampleInferSchema_tags() { + type Item struct { + Name string + Size float64 + Count int `bigquery:"number"` + Secret []byte `bigquery:"-"` + Optional bigquery.NullBool + OptBytes []byte `bigquery:",nullable"` + } + schema, err := bigquery.InferSchema(Item{}) + if err != nil { + fmt.Println(err) + // TODO: Handle error. + } + for _, fs := range schema { + fmt.Println(fs.Name, fs.Type, fs.Required) + } + // Output: + // Name STRING true + // Size FLOAT true + // number INTEGER true + // Optional BOOLEAN false + // OptBytes BYTES false +} + +func ExampleTable_Create() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + t := client.Dataset("my_dataset").Table("new-table") + if err := t.Create(ctx, nil); err != nil { + // TODO: Handle error. + } +} + +// Initialize a new table by passing TableMetadata to Table.Create. +func ExampleTable_Create_initialize() { + ctx := context.Background() + // Infer table schema from a Go type. + schema, err := bigquery.InferSchema(Item{}) + if err != nil { + // TODO: Handle error. + } + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + t := client.Dataset("my_dataset").Table("new-table") + if err := t.Create(ctx, + &bigquery.TableMetadata{ + Name: "My New Table", + Schema: schema, + ExpirationTime: time.Now().Add(24 * time.Hour), + }); err != nil { + // TODO: Handle error. + } +} + +// This example demonstrates how to create a table with +// a customer-managed encryption key. +func ExampleTable_Create_encryptionKey() { + ctx := context.Background() + // Infer table schema from a Go type. + schema, err := bigquery.InferSchema(Item{}) + if err != nil { + // TODO: Handle error. + } + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + t := client.Dataset("my_dataset").Table("new-table") + + // TODO: Replace this key with a key you have created in Cloud KMS. + keyName := "projects/P/locations/L/keyRings/R/cryptoKeys/K" + if err := t.Create(ctx, + &bigquery.TableMetadata{ + Name: "My New Table", + Schema: schema, + EncryptionConfig: &bigquery.EncryptionConfig{KMSKeyName: keyName}, + }); err != nil { + // TODO: Handle error. + } +} + +func ExampleTable_Delete() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + if err := client.Dataset("my_dataset").Table("my_table").Delete(ctx); err != nil { + // TODO: Handle error. + } +} + +func ExampleTable_Metadata() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + md, err := client.Dataset("my_dataset").Table("my_table").Metadata(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Println(md) +} + +func ExampleTable_Inserter() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ins := client.Dataset("my_dataset").Table("my_table").Inserter() + _ = ins // TODO: Use ins. +} + +func ExampleTable_Inserter_options() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ins := client.Dataset("my_dataset").Table("my_table").Inserter() + ins.SkipInvalidRows = true + ins.IgnoreUnknownValues = true + _ = ins // TODO: Use ins. +} + +func ExampleTable_CopierFrom() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ds := client.Dataset("my_dataset") + c := ds.Table("combined").CopierFrom(ds.Table("t1"), ds.Table("t2")) + c.WriteDisposition = bigquery.WriteTruncate + // TODO: set other options on the Copier. + job, err := c.Run(ctx) + if err != nil { + // TODO: Handle error. + } + status, err := job.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + if status.Err() != nil { + // TODO: Handle error. + } +} + +func ExampleTable_ExtractorTo() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + gcsRef := bigquery.NewGCSReference("gs://my-bucket/my-object") + gcsRef.FieldDelimiter = ":" + // TODO: set other options on the GCSReference. + ds := client.Dataset("my_dataset") + extractor := ds.Table("my_table").ExtractorTo(gcsRef) + extractor.DisableHeader = true + // TODO: set other options on the Extractor. + job, err := extractor.Run(ctx) + if err != nil { + // TODO: Handle error. + } + status, err := job.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + if status.Err() != nil { + // TODO: Handle error. + } +} + +func ExampleTable_LoaderFrom() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + gcsRef := bigquery.NewGCSReference("gs://my-bucket/my-object") + gcsRef.AllowJaggedRows = true + gcsRef.MaxBadRecords = 5 + gcsRef.Schema = schema + // TODO: set other options on the GCSReference. + ds := client.Dataset("my_dataset") + loader := ds.Table("my_table").LoaderFrom(gcsRef) + loader.CreateDisposition = bigquery.CreateNever + // TODO: set other options on the Loader. + job, err := loader.Run(ctx) + if err != nil { + // TODO: Handle error. + } + status, err := job.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + if status.Err() != nil { + // TODO: Handle error. + } +} + +func ExampleTable_LoaderFrom_reader() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + f, err := os.Open("data.csv") + if err != nil { + // TODO: Handle error. + } + rs := bigquery.NewReaderSource(f) + rs.AllowJaggedRows = true + rs.MaxBadRecords = 5 + rs.Schema = schema + // TODO: set other options on the GCSReference. + ds := client.Dataset("my_dataset") + loader := ds.Table("my_table").LoaderFrom(rs) + loader.CreateDisposition = bigquery.CreateNever + // TODO: set other options on the Loader. + job, err := loader.Run(ctx) + if err != nil { + // TODO: Handle error. + } + status, err := job.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + if status.Err() != nil { + // TODO: Handle error. + } +} + +func ExampleTable_Read() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.Dataset("my_dataset").Table("my_table").Read(ctx) + _ = it // TODO: iterate using Next or iterator.Pager. +} + +// This example illustrates how to perform a read-modify-write sequence on table +// metadata. Passing the metadata's ETag to the Update call ensures that the call +// will fail if the metadata was changed since the read. +func ExampleTable_Update_readModifyWrite() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + t := client.Dataset("my_dataset").Table("my_table") + md, err := t.Metadata(ctx) + if err != nil { + // TODO: Handle error. + } + md2, err := t.Update(ctx, + bigquery.TableMetadataToUpdate{Name: "new " + md.Name}, + md.ETag) + if err != nil { + // TODO: Handle error. + } + fmt.Println(md2) +} + +// To perform a blind write, ignoring the existing state (and possibly overwriting +// other updates), pass the empty string as the etag. +func ExampleTable_Update_blindWrite() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + t := client.Dataset("my_dataset").Table("my_table") + tm, err := t.Update(ctx, bigquery.TableMetadataToUpdate{ + Description: "my favorite table", + }, "") + if err != nil { + // TODO: Handle error. + } + fmt.Println(tm) +} + +func ExampleTableIterator_Next() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.Dataset("my_dataset").Tables(ctx) + for { + t, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(t) + } +} + +type Item struct { + Name string + Size float64 + Count int +} + +// Save implements the ValueSaver interface. +func (i *Item) Save() (map[string]bigquery.Value, string, error) { + return map[string]bigquery.Value{ + "Name": i.Name, + "Size": i.Size, + "Count": i.Count, + }, "", nil +} + +func ExampleInserter_Put() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ins := client.Dataset("my_dataset").Table("my_table").Inserter() + // Item implements the ValueSaver interface. + items := []*Item{ + {Name: "n1", Size: 32.6, Count: 7}, + {Name: "n2", Size: 4, Count: 2}, + {Name: "n3", Size: 101.5, Count: 1}, + } + if err := ins.Put(ctx, items); err != nil { + // TODO: Handle error. + } +} + +var schema bigquery.Schema + +func ExampleInserter_Put_structSaver() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ins := client.Dataset("my_dataset").Table("my_table").Inserter() + + type score struct { + Name string + Num int + } + + // Assume schema holds the table's schema. + savers := []*bigquery.StructSaver{ + {Struct: score{Name: "n1", Num: 12}, Schema: schema, InsertID: "id1"}, + {Struct: score{Name: "n2", Num: 31}, Schema: schema, InsertID: "id2"}, + {Struct: score{Name: "n3", Num: 7}, Schema: schema, InsertID: "id3"}, + } + if err := ins.Put(ctx, savers); err != nil { + // TODO: Handle error. + } +} + +func ExampleInserter_Put_struct() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + ins := client.Dataset("my_dataset").Table("my_table").Inserter() + + type score struct { + Name string + Num int + } + scores := []score{ + {Name: "n1", Num: 12}, + {Name: "n2", Num: 31}, + {Name: "n3", Num: 7}, + } + // Schema is inferred from the score type. + if err := ins.Put(ctx, scores); err != nil { + // TODO: Handle error. + } +} + +func ExampleInserter_Put_valuesSaver() { + ctx := context.Background() + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + ins := client.Dataset("my_dataset").Table("my_table").Inserter() + + var vss []*bigquery.ValuesSaver + for i, name := range []string{"n1", "n2", "n3"} { + // Assume schema holds the table's schema. + vss = append(vss, &bigquery.ValuesSaver{ + Schema: schema, + InsertID: name, + Row: []bigquery.Value{name, int64(i)}, + }) + } + + if err := ins.Put(ctx, vss); err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/bigquery/external.go b/vendor/cloud.google.com/go/bigquery/external.go new file mode 100644 index 000000000..2ceb38d54 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/external.go @@ -0,0 +1,400 @@ +// Copyright 2017 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 bigquery + +import ( + "encoding/base64" + "unicode/utf8" + + bq "google.golang.org/api/bigquery/v2" +) + +// DataFormat describes the format of BigQuery table data. +type DataFormat string + +// Constants describing the format of BigQuery table data. +const ( + CSV DataFormat = "CSV" + Avro DataFormat = "AVRO" + JSON DataFormat = "NEWLINE_DELIMITED_JSON" + DatastoreBackup DataFormat = "DATASTORE_BACKUP" + GoogleSheets DataFormat = "GOOGLE_SHEETS" + Bigtable DataFormat = "BIGTABLE" + Parquet DataFormat = "PARQUET" + ORC DataFormat = "ORC" +) + +// ExternalData is a table which is stored outside of BigQuery. It is implemented by +// *ExternalDataConfig. +// GCSReference also implements it, for backwards compatibility. +type ExternalData interface { + toBQ() bq.ExternalDataConfiguration +} + +// ExternalDataConfig describes data external to BigQuery that can be used +// in queries and to create external tables. +type ExternalDataConfig struct { + // The format of the data. Required. + SourceFormat DataFormat + + // The fully-qualified URIs that point to your + // data in Google Cloud. Required. + // + // For Google Cloud Storage URIs, each URI can contain one '*' wildcard character + // and it must come after the 'bucket' name. Size limits related to load jobs + // apply to external data sources. + // + // For Google Cloud Bigtable URIs, exactly one URI can be specified and it has be + // a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. + // + // For Google Cloud Datastore backups, exactly one URI can be specified. Also, + // the '*' wildcard character is not allowed. + SourceURIs []string + + // The schema of the data. Required for CSV and JSON; disallowed for the + // other formats. + Schema Schema + + // Try to detect schema and format options automatically. + // Any option specified explicitly will be honored. + AutoDetect bool + + // The compression type of the data. + Compression Compression + + // IgnoreUnknownValues causes values not matching the schema to be + // tolerated. Unknown values are ignored. For CSV this ignores extra values + // at the end of a line. For JSON this ignores named values that do not + // match any column name. If this field is not set, records containing + // unknown values are treated as bad records. The MaxBadRecords field can + // be used to customize how bad records are handled. + IgnoreUnknownValues bool + + // MaxBadRecords is the maximum number of bad records that will be ignored + // when reading data. + MaxBadRecords int64 + + // Additional options for CSV, GoogleSheets and Bigtable formats. + Options ExternalDataConfigOptions +} + +func (e *ExternalDataConfig) toBQ() bq.ExternalDataConfiguration { + q := bq.ExternalDataConfiguration{ + SourceFormat: string(e.SourceFormat), + SourceUris: e.SourceURIs, + Autodetect: e.AutoDetect, + Compression: string(e.Compression), + IgnoreUnknownValues: e.IgnoreUnknownValues, + MaxBadRecords: e.MaxBadRecords, + } + if e.Schema != nil { + q.Schema = e.Schema.toBQ() + } + if e.Options != nil { + e.Options.populateExternalDataConfig(&q) + } + return q +} + +func bqToExternalDataConfig(q *bq.ExternalDataConfiguration) (*ExternalDataConfig, error) { + e := &ExternalDataConfig{ + SourceFormat: DataFormat(q.SourceFormat), + SourceURIs: q.SourceUris, + AutoDetect: q.Autodetect, + Compression: Compression(q.Compression), + IgnoreUnknownValues: q.IgnoreUnknownValues, + MaxBadRecords: q.MaxBadRecords, + Schema: bqToSchema(q.Schema), + } + switch { + case q.CsvOptions != nil: + e.Options = bqToCSVOptions(q.CsvOptions) + case q.GoogleSheetsOptions != nil: + e.Options = bqToGoogleSheetsOptions(q.GoogleSheetsOptions) + case q.BigtableOptions != nil: + var err error + e.Options, err = bqToBigtableOptions(q.BigtableOptions) + if err != nil { + return nil, err + } + } + return e, nil +} + +// ExternalDataConfigOptions are additional options for external data configurations. +// This interface is implemented by CSVOptions, GoogleSheetsOptions and BigtableOptions. +type ExternalDataConfigOptions interface { + populateExternalDataConfig(*bq.ExternalDataConfiguration) +} + +// CSVOptions are additional options for CSV external data sources. +type CSVOptions struct { + // AllowJaggedRows causes missing trailing optional columns to be tolerated + // when reading CSV data. Missing values are treated as nulls. + AllowJaggedRows bool + + // AllowQuotedNewlines sets whether quoted data sections containing + // newlines are allowed when reading CSV data. + AllowQuotedNewlines bool + + // Encoding is the character encoding of data to be read. + Encoding Encoding + + // FieldDelimiter is the separator for fields in a CSV file, used when + // reading or exporting data. The default is ",". + FieldDelimiter string + + // Quote is the value used to quote data sections in a CSV file. The + // default quotation character is the double quote ("), which is used if + // both Quote and ForceZeroQuote are unset. + // To specify that no character should be interpreted as a quotation + // character, set ForceZeroQuote to true. + // Only used when reading data. + Quote string + ForceZeroQuote bool + + // The number of rows at the top of a CSV file that BigQuery will skip when + // reading data. + SkipLeadingRows int64 +} + +func (o *CSVOptions) populateExternalDataConfig(c *bq.ExternalDataConfiguration) { + c.CsvOptions = &bq.CsvOptions{ + AllowJaggedRows: o.AllowJaggedRows, + AllowQuotedNewlines: o.AllowQuotedNewlines, + Encoding: string(o.Encoding), + FieldDelimiter: o.FieldDelimiter, + Quote: o.quote(), + SkipLeadingRows: o.SkipLeadingRows, + } +} + +// quote returns the CSV quote character, or nil if unset. +func (o *CSVOptions) quote() *string { + if o.ForceZeroQuote { + quote := "" + return "e + } + if o.Quote == "" { + return nil + } + return &o.Quote +} + +func (o *CSVOptions) setQuote(ps *string) { + if ps != nil { + o.Quote = *ps + if o.Quote == "" { + o.ForceZeroQuote = true + } + } +} + +func bqToCSVOptions(q *bq.CsvOptions) *CSVOptions { + o := &CSVOptions{ + AllowJaggedRows: q.AllowJaggedRows, + AllowQuotedNewlines: q.AllowQuotedNewlines, + Encoding: Encoding(q.Encoding), + FieldDelimiter: q.FieldDelimiter, + SkipLeadingRows: q.SkipLeadingRows, + } + o.setQuote(q.Quote) + return o +} + +// GoogleSheetsOptions are additional options for GoogleSheets external data sources. +type GoogleSheetsOptions struct { + // The number of rows at the top of a sheet that BigQuery will skip when + // reading data. + SkipLeadingRows int64 +} + +func (o *GoogleSheetsOptions) populateExternalDataConfig(c *bq.ExternalDataConfiguration) { + c.GoogleSheetsOptions = &bq.GoogleSheetsOptions{ + SkipLeadingRows: o.SkipLeadingRows, + } +} + +func bqToGoogleSheetsOptions(q *bq.GoogleSheetsOptions) *GoogleSheetsOptions { + return &GoogleSheetsOptions{ + SkipLeadingRows: q.SkipLeadingRows, + } +} + +// BigtableOptions are additional options for Bigtable external data sources. +type BigtableOptions struct { + // A list of column families to expose in the table schema along with their + // types. If omitted, all column families are present in the table schema and + // their values are read as BYTES. + ColumnFamilies []*BigtableColumnFamily + + // If true, then the column families that are not specified in columnFamilies + // list are not exposed in the table schema. Otherwise, they are read with BYTES + // type values. The default is false. + IgnoreUnspecifiedColumnFamilies bool + + // If true, then the rowkey column families will be read and converted to string. + // Otherwise they are read with BYTES type values and users need to manually cast + // them with CAST if necessary. The default is false. + ReadRowkeyAsString bool +} + +func (o *BigtableOptions) populateExternalDataConfig(c *bq.ExternalDataConfiguration) { + q := &bq.BigtableOptions{ + IgnoreUnspecifiedColumnFamilies: o.IgnoreUnspecifiedColumnFamilies, + ReadRowkeyAsString: o.ReadRowkeyAsString, + } + for _, f := range o.ColumnFamilies { + q.ColumnFamilies = append(q.ColumnFamilies, f.toBQ()) + } + c.BigtableOptions = q +} + +func bqToBigtableOptions(q *bq.BigtableOptions) (*BigtableOptions, error) { + b := &BigtableOptions{ + IgnoreUnspecifiedColumnFamilies: q.IgnoreUnspecifiedColumnFamilies, + ReadRowkeyAsString: q.ReadRowkeyAsString, + } + for _, f := range q.ColumnFamilies { + f2, err := bqToBigtableColumnFamily(f) + if err != nil { + return nil, err + } + b.ColumnFamilies = append(b.ColumnFamilies, f2) + } + return b, nil +} + +// BigtableColumnFamily describes how BigQuery should access a Bigtable column family. +type BigtableColumnFamily struct { + // Identifier of the column family. + FamilyID string + + // Lists of columns that should be exposed as individual fields as opposed to a + // list of (column name, value) pairs. All columns whose qualifier matches a + // qualifier in this list can be accessed as .. Other columns can be accessed as + // a list through .Column field. + Columns []*BigtableColumn + + // The encoding of the values when the type is not STRING. Acceptable encoding values are: + // - TEXT - indicates values are alphanumeric text strings. + // - BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. + // This can be overridden for a specific column by listing that column in 'columns' and + // specifying an encoding for it. + Encoding string + + // If true, only the latest version of values are exposed for all columns in this + // column family. This can be overridden for a specific column by listing that + // column in 'columns' and specifying a different setting for that column. + OnlyReadLatest bool + + // The type to convert the value in cells of this + // column family. The values are expected to be encoded using HBase + // Bytes.toBytes function when using the BINARY encoding value. + // Following BigQuery types are allowed (case-sensitive): + // BYTES STRING INTEGER FLOAT BOOLEAN. + // The default type is BYTES. This can be overridden for a specific column by + // listing that column in 'columns' and specifying a type for it. + Type string +} + +func (b *BigtableColumnFamily) toBQ() *bq.BigtableColumnFamily { + q := &bq.BigtableColumnFamily{ + FamilyId: b.FamilyID, + Encoding: b.Encoding, + OnlyReadLatest: b.OnlyReadLatest, + Type: b.Type, + } + for _, col := range b.Columns { + q.Columns = append(q.Columns, col.toBQ()) + } + return q +} + +func bqToBigtableColumnFamily(q *bq.BigtableColumnFamily) (*BigtableColumnFamily, error) { + b := &BigtableColumnFamily{ + FamilyID: q.FamilyId, + Encoding: q.Encoding, + OnlyReadLatest: q.OnlyReadLatest, + Type: q.Type, + } + for _, col := range q.Columns { + c, err := bqToBigtableColumn(col) + if err != nil { + return nil, err + } + b.Columns = append(b.Columns, c) + } + return b, nil +} + +// BigtableColumn describes how BigQuery should access a Bigtable column. +type BigtableColumn struct { + // Qualifier of the column. Columns in the parent column family that have this + // exact qualifier are exposed as . field. The column field name is the + // same as the column qualifier. + Qualifier string + + // If the qualifier is not a valid BigQuery field identifier i.e. does not match + // [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field + // name and is used as field name in queries. + FieldName string + + // If true, only the latest version of values are exposed for this column. + // See BigtableColumnFamily.OnlyReadLatest. + OnlyReadLatest bool + + // The encoding of the values when the type is not STRING. + // See BigtableColumnFamily.Encoding + Encoding string + + // The type to convert the value in cells of this column. + // See BigtableColumnFamily.Type + Type string +} + +func (b *BigtableColumn) toBQ() *bq.BigtableColumn { + q := &bq.BigtableColumn{ + FieldName: b.FieldName, + OnlyReadLatest: b.OnlyReadLatest, + Encoding: b.Encoding, + Type: b.Type, + } + if utf8.ValidString(b.Qualifier) { + q.QualifierString = b.Qualifier + } else { + q.QualifierEncoded = base64.RawStdEncoding.EncodeToString([]byte(b.Qualifier)) + } + return q +} + +func bqToBigtableColumn(q *bq.BigtableColumn) (*BigtableColumn, error) { + b := &BigtableColumn{ + FieldName: q.FieldName, + OnlyReadLatest: q.OnlyReadLatest, + Encoding: q.Encoding, + Type: q.Type, + } + if q.QualifierString != "" { + b.Qualifier = q.QualifierString + } else { + bytes, err := base64.RawStdEncoding.DecodeString(q.QualifierEncoded) + if err != nil { + return nil, err + } + b.Qualifier = string(bytes) + } + return b, nil +} diff --git a/vendor/cloud.google.com/go/bigquery/external_test.go b/vendor/cloud.google.com/go/bigquery/external_test.go new file mode 100644 index 000000000..454bb0867 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/external_test.go @@ -0,0 +1,143 @@ +// Copyright 2017 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 bigquery + +import ( + "testing" + + "cloud.google.com/go/internal/pretty" + "cloud.google.com/go/internal/testutil" +) + +func TestExternalDataConfig(t *testing.T) { + // Round-trip of ExternalDataConfig to underlying representation. + for i, want := range []*ExternalDataConfig{ + { + SourceFormat: CSV, + SourceURIs: []string{"uri"}, + Schema: Schema{{Name: "n", Type: IntegerFieldType}}, + AutoDetect: true, + Compression: Gzip, + IgnoreUnknownValues: true, + MaxBadRecords: 17, + Options: &CSVOptions{ + AllowJaggedRows: true, + AllowQuotedNewlines: true, + Encoding: UTF_8, + FieldDelimiter: "f", + Quote: "q", + SkipLeadingRows: 3, + }, + }, + { + SourceFormat: GoogleSheets, + Options: &GoogleSheetsOptions{SkipLeadingRows: 4}, + }, + { + SourceFormat: Bigtable, + Options: &BigtableOptions{ + IgnoreUnspecifiedColumnFamilies: true, + ReadRowkeyAsString: true, + ColumnFamilies: []*BigtableColumnFamily{ + { + FamilyID: "f1", + Encoding: "TEXT", + OnlyReadLatest: true, + Type: "FLOAT", + Columns: []*BigtableColumn{ + { + Qualifier: "valid-utf-8", + FieldName: "fn", + OnlyReadLatest: true, + Encoding: "BINARY", + Type: "STRING", + }, + }, + }, + }, + }, + }, + } { + q := want.toBQ() + got, err := bqToExternalDataConfig(&q) + if err != nil { + t.Fatal(err) + } + if diff := testutil.Diff(got, want); diff != "" { + t.Errorf("#%d: got=-, want=+:\n%s", i, diff) + } + } +} + +func TestQuote(t *testing.T) { + ptr := func(s string) *string { return &s } + + for _, test := range []struct { + quote string + force bool + want *string + }{ + {"", false, nil}, + {"", true, ptr("")}, + {"-", false, ptr("-")}, + {"-", true, ptr("")}, + } { + o := CSVOptions{ + Quote: test.quote, + ForceZeroQuote: test.force, + } + got := o.quote() + if (got == nil) != (test.want == nil) { + t.Errorf("%+v\ngot %v\nwant %v", test, pretty.Value(got), pretty.Value(test.want)) + } + if got != nil && test.want != nil && *got != *test.want { + t.Errorf("%+v: got %q, want %q", test, *got, *test.want) + } + } +} + +func TestQualifier(t *testing.T) { + b := BigtableColumn{Qualifier: "a"} + q := b.toBQ() + if q.QualifierString != b.Qualifier || q.QualifierEncoded != "" { + t.Errorf("got (%q, %q), want (%q, %q)", + q.QualifierString, q.QualifierEncoded, b.Qualifier, "") + } + b2, err := bqToBigtableColumn(q) + if err != nil { + t.Fatal(err) + } + if got, want := b2.Qualifier, b.Qualifier; got != want { + t.Errorf("got %q, want %q", got, want) + } + + const ( + invalidUTF8 = "\xDF\xFF" + invalidEncoded = "3/8" + ) + b = BigtableColumn{Qualifier: invalidUTF8} + q = b.toBQ() + if q.QualifierString != "" || q.QualifierEncoded != invalidEncoded { + t.Errorf("got (%q, %q), want (%q, %q)", + q.QualifierString, "", b.Qualifier, invalidEncoded) + } + b2, err = bqToBigtableColumn(q) + if err != nil { + t.Fatal(err) + } + if got, want := b2.Qualifier, b.Qualifier; got != want { + t.Errorf("got %q, want %q", got, want) + } +} diff --git a/vendor/cloud.google.com/go/bigquery/extract.go b/vendor/cloud.google.com/go/bigquery/extract.go new file mode 100644 index 000000000..a77f27594 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/extract.go @@ -0,0 +1,110 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bigquery + +import ( + "context" + + "cloud.google.com/go/internal/trace" + bq "google.golang.org/api/bigquery/v2" +) + +// ExtractConfig holds the configuration for an extract job. +type ExtractConfig struct { + // Src is the table from which data will be extracted. + Src *Table + + // Dst is the destination into which the data will be extracted. + Dst *GCSReference + + // DisableHeader disables the printing of a header row in exported data. + DisableHeader bool + + // The labels associated with this job. + Labels map[string]string +} + +func (e *ExtractConfig) toBQ() *bq.JobConfiguration { + var printHeader *bool + if e.DisableHeader { + f := false + printHeader = &f + } + return &bq.JobConfiguration{ + Labels: e.Labels, + Extract: &bq.JobConfigurationExtract{ + DestinationUris: append([]string{}, e.Dst.URIs...), + Compression: string(e.Dst.Compression), + DestinationFormat: string(e.Dst.DestinationFormat), + FieldDelimiter: e.Dst.FieldDelimiter, + SourceTable: e.Src.toBQ(), + PrintHeader: printHeader, + }, + } +} + +func bqToExtractConfig(q *bq.JobConfiguration, c *Client) *ExtractConfig { + qe := q.Extract + return &ExtractConfig{ + Labels: q.Labels, + Dst: &GCSReference{ + URIs: qe.DestinationUris, + Compression: Compression(qe.Compression), + DestinationFormat: DataFormat(qe.DestinationFormat), + FileConfig: FileConfig{ + CSVOptions: CSVOptions{ + FieldDelimiter: qe.FieldDelimiter, + }, + }, + }, + DisableHeader: qe.PrintHeader != nil && !*qe.PrintHeader, + Src: bqToTable(qe.SourceTable, c), + } +} + +// An Extractor extracts data from a BigQuery table into Google Cloud Storage. +type Extractor struct { + JobIDConfig + ExtractConfig + c *Client +} + +// ExtractorTo returns an Extractor which can be used to extract data from a +// BigQuery table into Google Cloud Storage. +// The returned Extractor may optionally be further configured before its Run method is called. +func (t *Table) ExtractorTo(dst *GCSReference) *Extractor { + return &Extractor{ + c: t.c, + ExtractConfig: ExtractConfig{ + Src: t, + Dst: dst, + }, + } +} + +// Run initiates an extract job. +func (e *Extractor) Run(ctx context.Context) (j *Job, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Extractor.Run") + defer func() { trace.EndSpan(ctx, err) }() + + return e.c.insertJob(ctx, e.newJob(), nil) +} + +func (e *Extractor) newJob() *bq.Job { + return &bq.Job{ + JobReference: e.JobIDConfig.createJobRef(e.c), + Configuration: e.ExtractConfig.toBQ(), + } +} diff --git a/vendor/cloud.google.com/go/bigquery/extract_test.go b/vendor/cloud.google.com/go/bigquery/extract_test.go new file mode 100644 index 000000000..ddf73092f --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/extract_test.go @@ -0,0 +1,116 @@ +// Copyright 2015 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 bigquery + +import ( + "testing" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + bq "google.golang.org/api/bigquery/v2" +) + +func defaultExtractJob() *bq.Job { + return &bq.Job{ + JobReference: &bq.JobReference{JobId: "RANDOM", ProjectId: "client-project-id"}, + Configuration: &bq.JobConfiguration{ + Extract: &bq.JobConfigurationExtract{ + SourceTable: &bq.TableReference{ + ProjectId: "client-project-id", + DatasetId: "dataset-id", + TableId: "table-id", + }, + DestinationUris: []string{"uri"}, + }, + }, + } +} + +func defaultGCS() *GCSReference { + return &GCSReference{ + URIs: []string{"uri"}, + } +} + +func TestExtract(t *testing.T) { + defer fixRandomID("RANDOM")() + c := &Client{ + projectID: "client-project-id", + } + + testCases := []struct { + dst *GCSReference + src *Table + config ExtractConfig + want *bq.Job + }{ + { + dst: defaultGCS(), + src: c.Dataset("dataset-id").Table("table-id"), + want: defaultExtractJob(), + }, + { + dst: defaultGCS(), + src: c.Dataset("dataset-id").Table("table-id"), + config: ExtractConfig{ + DisableHeader: true, + Labels: map[string]string{"a": "b"}, + }, + want: func() *bq.Job { + j := defaultExtractJob() + j.Configuration.Labels = map[string]string{"a": "b"} + f := false + j.Configuration.Extract.PrintHeader = &f + return j + }(), + }, + { + dst: func() *GCSReference { + g := NewGCSReference("uri") + g.Compression = Gzip + g.DestinationFormat = JSON + g.FieldDelimiter = "\t" + return g + }(), + src: c.Dataset("dataset-id").Table("table-id"), + want: func() *bq.Job { + j := defaultExtractJob() + j.Configuration.Extract.Compression = "GZIP" + j.Configuration.Extract.DestinationFormat = "NEWLINE_DELIMITED_JSON" + j.Configuration.Extract.FieldDelimiter = "\t" + return j + }(), + }, + } + + for i, tc := range testCases { + ext := tc.src.ExtractorTo(tc.dst) + tc.config.Src = ext.Src + tc.config.Dst = ext.Dst + ext.ExtractConfig = tc.config + got := ext.newJob() + checkJob(t, i, got, tc.want) + + jc, err := bqToJobConfig(got.Configuration, c) + if err != nil { + t.Fatalf("#%d: %v", i, err) + } + diff := testutil.Diff(jc, &ext.ExtractConfig, + cmp.AllowUnexported(Table{}, Client{})) + if diff != "" { + t.Errorf("#%d: (got=-, want=+:\n%s", i, diff) + } + } +} diff --git a/vendor/cloud.google.com/go/bigquery/file.go b/vendor/cloud.google.com/go/bigquery/file.go new file mode 100644 index 000000000..8dd86f5d0 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/file.go @@ -0,0 +1,137 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bigquery + +import ( + "io" + + bq "google.golang.org/api/bigquery/v2" +) + +// A ReaderSource is a source for a load operation that gets +// data from an io.Reader. +// +// When a ReaderSource is part of a LoadConfig obtained via Job.Config, +// its internal io.Reader will be nil, so it cannot be used for a +// subsequent load operation. +type ReaderSource struct { + r io.Reader + FileConfig +} + +// NewReaderSource creates a ReaderSource from an io.Reader. You may +// optionally configure properties on the ReaderSource that describe the +// data being read, before passing it to Table.LoaderFrom. +func NewReaderSource(r io.Reader) *ReaderSource { + return &ReaderSource{r: r} +} + +func (r *ReaderSource) populateLoadConfig(lc *bq.JobConfigurationLoad) io.Reader { + r.FileConfig.populateLoadConfig(lc) + return r.r +} + +// FileConfig contains configuration options that pertain to files, typically +// text files that require interpretation to be used as a BigQuery table. A +// file may live in Google Cloud Storage (see GCSReference), or it may be +// loaded into a table via the Table.LoaderFromReader. +type FileConfig struct { + // SourceFormat is the format of the data to be read. + // Allowed values are: Avro, CSV, DatastoreBackup, JSON, ORC, and Parquet. The default is CSV. + SourceFormat DataFormat + + // Indicates if we should automatically infer the options and + // schema for CSV and JSON sources. + AutoDetect bool + + // MaxBadRecords is the maximum number of bad records that will be ignored + // when reading data. + MaxBadRecords int64 + + // IgnoreUnknownValues causes values not matching the schema to be + // tolerated. Unknown values are ignored. For CSV this ignores extra values + // at the end of a line. For JSON this ignores named values that do not + // match any column name. If this field is not set, records containing + // unknown values are treated as bad records. The MaxBadRecords field can + // be used to customize how bad records are handled. + IgnoreUnknownValues bool + + // Schema describes the data. It is required when reading CSV or JSON data, + // unless the data is being loaded into a table that already exists. + Schema Schema + + // Additional options for CSV files. + CSVOptions +} + +func (fc *FileConfig) populateLoadConfig(conf *bq.JobConfigurationLoad) { + conf.SkipLeadingRows = fc.SkipLeadingRows + conf.SourceFormat = string(fc.SourceFormat) + conf.Autodetect = fc.AutoDetect + conf.AllowJaggedRows = fc.AllowJaggedRows + conf.AllowQuotedNewlines = fc.AllowQuotedNewlines + conf.Encoding = string(fc.Encoding) + conf.FieldDelimiter = fc.FieldDelimiter + conf.IgnoreUnknownValues = fc.IgnoreUnknownValues + conf.MaxBadRecords = fc.MaxBadRecords + if fc.Schema != nil { + conf.Schema = fc.Schema.toBQ() + } + conf.Quote = fc.quote() +} + +func bqPopulateFileConfig(conf *bq.JobConfigurationLoad, fc *FileConfig) { + fc.SourceFormat = DataFormat(conf.SourceFormat) + fc.AutoDetect = conf.Autodetect + fc.MaxBadRecords = conf.MaxBadRecords + fc.IgnoreUnknownValues = conf.IgnoreUnknownValues + fc.Schema = bqToSchema(conf.Schema) + fc.SkipLeadingRows = conf.SkipLeadingRows + fc.AllowJaggedRows = conf.AllowJaggedRows + fc.AllowQuotedNewlines = conf.AllowQuotedNewlines + fc.Encoding = Encoding(conf.Encoding) + fc.FieldDelimiter = conf.FieldDelimiter + fc.CSVOptions.setQuote(conf.Quote) +} + +func (fc *FileConfig) populateExternalDataConfig(conf *bq.ExternalDataConfiguration) { + format := fc.SourceFormat + if format == "" { + // Format must be explicitly set for external data sources. + format = CSV + } + conf.Autodetect = fc.AutoDetect + conf.IgnoreUnknownValues = fc.IgnoreUnknownValues + conf.MaxBadRecords = fc.MaxBadRecords + conf.SourceFormat = string(format) + if fc.Schema != nil { + conf.Schema = fc.Schema.toBQ() + } + if format == CSV { + fc.CSVOptions.populateExternalDataConfig(conf) + } +} + +// Encoding specifies the character encoding of data to be loaded into BigQuery. +// See https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.load.encoding +// for more details about how this is used. +type Encoding string + +const ( + // UTF_8 specifies the UTF-8 encoding type. + UTF_8 Encoding = "UTF-8" + // ISO_8859_1 specifies the ISO-8859-1 encoding type. + ISO_8859_1 Encoding = "ISO-8859-1" +) diff --git a/vendor/cloud.google.com/go/bigquery/file_test.go b/vendor/cloud.google.com/go/bigquery/file_test.go new file mode 100644 index 000000000..96e18bff3 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/file_test.go @@ -0,0 +1,98 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bigquery + +import ( + "testing" + + "cloud.google.com/go/internal/pretty" + "cloud.google.com/go/internal/testutil" + bq "google.golang.org/api/bigquery/v2" +) + +var ( + hyphen = "-" + fc = FileConfig{ + SourceFormat: CSV, + AutoDetect: true, + MaxBadRecords: 7, + IgnoreUnknownValues: true, + Schema: Schema{ + stringFieldSchema(), + nestedFieldSchema(), + }, + CSVOptions: CSVOptions{ + Quote: hyphen, + FieldDelimiter: "\t", + SkipLeadingRows: 8, + AllowJaggedRows: true, + AllowQuotedNewlines: true, + Encoding: UTF_8, + }, + } +) + +func TestFileConfigPopulateLoadConfig(t *testing.T) { + want := &bq.JobConfigurationLoad{ + SourceFormat: "CSV", + FieldDelimiter: "\t", + SkipLeadingRows: 8, + AllowJaggedRows: true, + AllowQuotedNewlines: true, + Autodetect: true, + Encoding: "UTF-8", + MaxBadRecords: 7, + IgnoreUnknownValues: true, + Schema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqStringFieldSchema(), + bqNestedFieldSchema(), + }}, + Quote: &hyphen, + } + got := &bq.JobConfigurationLoad{} + fc.populateLoadConfig(got) + if !testutil.Equal(got, want) { + t.Errorf("got:\n%v\nwant:\n%v", pretty.Value(got), pretty.Value(want)) + } +} + +func TestFileConfigPopulateExternalDataConfig(t *testing.T) { + got := &bq.ExternalDataConfiguration{} + fc.populateExternalDataConfig(got) + + want := &bq.ExternalDataConfiguration{ + SourceFormat: "CSV", + Autodetect: true, + MaxBadRecords: 7, + IgnoreUnknownValues: true, + Schema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqStringFieldSchema(), + bqNestedFieldSchema(), + }}, + CsvOptions: &bq.CsvOptions{ + AllowJaggedRows: true, + AllowQuotedNewlines: true, + Encoding: "UTF-8", + FieldDelimiter: "\t", + Quote: &hyphen, + SkipLeadingRows: 8, + }, + } + if diff := testutil.Diff(got, want); diff != "" { + t.Errorf("got=-, want=+:\n%s", diff) + } +} diff --git a/vendor/cloud.google.com/go/bigquery/gcs.go b/vendor/cloud.google.com/go/bigquery/gcs.go new file mode 100644 index 000000000..6b70126b4 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/gcs.go @@ -0,0 +1,75 @@ +// Copyright 2015 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 bigquery + +import ( + "io" + + bq "google.golang.org/api/bigquery/v2" +) + +// GCSReference is a reference to one or more Google Cloud Storage objects, which together constitute +// an input or output to a BigQuery operation. +type GCSReference struct { + // URIs refer to Google Cloud Storage objects. + URIs []string + + FileConfig + + // DestinationFormat is the format to use when writing exported files. + // Allowed values are: CSV, Avro, JSON. The default is CSV. + // CSV is not supported for tables with nested or repeated fields. + DestinationFormat DataFormat + + // Compression specifies the type of compression to apply when writing data + // to Google Cloud Storage, or using this GCSReference as an ExternalData + // source with CSV or JSON SourceFormat. Default is None. + Compression Compression +} + +// NewGCSReference constructs a reference to one or more Google Cloud Storage objects, which together constitute a data source or destination. +// In the simple case, a single URI in the form gs://bucket/object may refer to a single GCS object. +// Data may also be split into mutiple files, if multiple URIs or URIs containing wildcards are provided. +// Each URI may contain one '*' wildcard character, which (if present) must come after the bucket name. +// For more information about the treatment of wildcards and multiple URIs, +// see https://cloud.google.com/bigquery/exporting-data-from-bigquery#exportingmultiple +func NewGCSReference(uri ...string) *GCSReference { + return &GCSReference{URIs: uri} +} + +// Compression is the type of compression to apply when writing data to Google Cloud Storage. +type Compression string + +const ( + // None specifies no compression. + None Compression = "NONE" + // Gzip specifies gzip compression. + Gzip Compression = "GZIP" +) + +func (gcs *GCSReference) populateLoadConfig(lc *bq.JobConfigurationLoad) io.Reader { + lc.SourceUris = gcs.URIs + gcs.FileConfig.populateLoadConfig(lc) + return nil +} + +func (gcs *GCSReference) toBQ() bq.ExternalDataConfiguration { + conf := bq.ExternalDataConfiguration{ + Compression: string(gcs.Compression), + SourceUris: append([]string{}, gcs.URIs...), + } + gcs.FileConfig.populateExternalDataConfig(&conf) + return conf +} diff --git a/vendor/cloud.google.com/go/bigquery/inserter.go b/vendor/cloud.google.com/go/bigquery/inserter.go new file mode 100644 index 000000000..132994e9b --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/inserter.go @@ -0,0 +1,238 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "errors" + "fmt" + "reflect" + + "cloud.google.com/go/internal/trace" + bq "google.golang.org/api/bigquery/v2" +) + +// An Inserter does streaming inserts into a BigQuery table. +// It is safe for concurrent use. +type Inserter struct { + t *Table + + // SkipInvalidRows causes rows containing invalid data to be silently + // ignored. The default value is false, which causes the entire request to + // fail if there is an attempt to insert an invalid row. + SkipInvalidRows bool + + // IgnoreUnknownValues causes values not matching the schema to be ignored. + // The default value is false, which causes records containing such values + // to be treated as invalid records. + IgnoreUnknownValues bool + + // A TableTemplateSuffix allows Inserters to create tables automatically. + // + // Experimental: this option is experimental and may be modified or removed in future versions, + // regardless of any other documented package stability guarantees. + // + // When you specify a suffix, the table you upload data to + // will be used as a template for creating a new table, with the same schema, + // called + . + // + // More information is available at + // https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables + TableTemplateSuffix string +} + +// Inserter returns an Inserter that can be used to append rows to t. +// The returned Inserter may optionally be further configured before its Put method is called. +// +// To stream rows into a date-partitioned table at a particular date, add the +// $yyyymmdd suffix to the table name when constructing the Table. +func (t *Table) Inserter() *Inserter { + return &Inserter{t: t} +} + +// Uploader calls Inserter. +// Deprecated: use Table.Inserter instead. +func (t *Table) Uploader() *Inserter { return t.Inserter() } + +// Put uploads one or more rows to the BigQuery service. +// +// If src is ValueSaver, then its Save method is called to produce a row for uploading. +// +// If src is a struct or pointer to a struct, then a schema is inferred from it +// and used to create a StructSaver. The InsertID of the StructSaver will be +// empty. +// +// If src is a slice of ValueSavers, structs, or struct pointers, then each +// element of the slice is treated as above, and multiple rows are uploaded. +// +// Put returns a PutMultiError if one or more rows failed to be uploaded. +// The PutMultiError contains a RowInsertionError for each failed row. +// +// Put will retry on temporary errors (see +// https://cloud.google.com/bigquery/troubleshooting-errors). This can result +// in duplicate rows if you do not use insert IDs. Also, if the error persists, +// the call will run indefinitely. Pass a context with a timeout to prevent +// hanging calls. +func (u *Inserter) Put(ctx context.Context, src interface{}) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Inserter.Put") + defer func() { trace.EndSpan(ctx, err) }() + + savers, err := valueSavers(src) + if err != nil { + return err + } + return u.putMulti(ctx, savers) +} + +func valueSavers(src interface{}) ([]ValueSaver, error) { + saver, ok, err := toValueSaver(src) + if err != nil { + return nil, err + } + if ok { + return []ValueSaver{saver}, nil + } + srcVal := reflect.ValueOf(src) + if srcVal.Kind() != reflect.Slice { + return nil, fmt.Errorf("%T is not a ValueSaver, struct, struct pointer, or slice", src) + + } + var savers []ValueSaver + for i := 0; i < srcVal.Len(); i++ { + s := srcVal.Index(i).Interface() + saver, ok, err := toValueSaver(s) + if err != nil { + return nil, err + } + if !ok { + return nil, fmt.Errorf("src[%d] has type %T, which is not a ValueSaver, struct or struct pointer", i, s) + } + savers = append(savers, saver) + } + return savers, nil +} + +// Make a ValueSaver from x, which must implement ValueSaver already +// or be a struct or pointer to struct. +func toValueSaver(x interface{}) (ValueSaver, bool, error) { + if _, ok := x.(StructSaver); ok { + return nil, false, errors.New("bigquery: use &StructSaver, not StructSaver") + } + var insertID string + // Handle StructSavers specially so we can infer the schema if necessary. + if ss, ok := x.(*StructSaver); ok && ss.Schema == nil { + x = ss.Struct + insertID = ss.InsertID + // Fall through so we can infer the schema. + } + if saver, ok := x.(ValueSaver); ok { + return saver, ok, nil + } + v := reflect.ValueOf(x) + // Support Put with []interface{} + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() != reflect.Struct { + return nil, false, nil + } + schema, err := inferSchemaReflectCached(v.Type()) + if err != nil { + return nil, false, err + } + return &StructSaver{ + Struct: x, + InsertID: insertID, + Schema: schema, + }, true, nil +} + +func (u *Inserter) putMulti(ctx context.Context, src []ValueSaver) error { + req, err := u.newInsertRequest(src) + if err != nil { + return err + } + if req == nil { + return nil + } + call := u.t.c.bqs.Tabledata.InsertAll(u.t.ProjectID, u.t.DatasetID, u.t.TableID, req) + call = call.Context(ctx) + setClientHeader(call.Header()) + var res *bq.TableDataInsertAllResponse + err = runWithRetry(ctx, func() (err error) { + res, err = call.Do() + return err + }) + if err != nil { + return err + } + return handleInsertErrors(res.InsertErrors, req.Rows) +} + +func (u *Inserter) newInsertRequest(savers []ValueSaver) (*bq.TableDataInsertAllRequest, error) { + if savers == nil { // If there are no rows, do nothing. + return nil, nil + } + req := &bq.TableDataInsertAllRequest{ + TemplateSuffix: u.TableTemplateSuffix, + IgnoreUnknownValues: u.IgnoreUnknownValues, + SkipInvalidRows: u.SkipInvalidRows, + } + for _, saver := range savers { + row, insertID, err := saver.Save() + if err != nil { + return nil, err + } + if insertID == "" { + insertID = randomIDFn() + } + m := make(map[string]bq.JsonValue) + for k, v := range row { + m[k] = bq.JsonValue(v) + } + req.Rows = append(req.Rows, &bq.TableDataInsertAllRequestRows{ + InsertId: insertID, + Json: m, + }) + } + return req, nil +} + +func handleInsertErrors(ierrs []*bq.TableDataInsertAllResponseInsertErrors, rows []*bq.TableDataInsertAllRequestRows) error { + if len(ierrs) == 0 { + return nil + } + var errs PutMultiError + for _, e := range ierrs { + if int(e.Index) > len(rows) { + return fmt.Errorf("internal error: unexpected row index: %v", e.Index) + } + rie := RowInsertionError{ + InsertID: rows[e.Index].InsertId, + RowIndex: int(e.Index), + } + for _, errp := range e.Errors { + rie.Errors = append(rie.Errors, bqToError(errp)) + } + errs = append(errs, rie) + } + return errs +} + +// Uploader is an obsolete name for Inserter. +type Uploader = Inserter diff --git a/vendor/cloud.google.com/go/bigquery/inserter_test.go b/vendor/cloud.google.com/go/bigquery/inserter_test.go new file mode 100644 index 000000000..0fafeac25 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/inserter_test.go @@ -0,0 +1,210 @@ +// Copyright 2015 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 bigquery + +import ( + "errors" + "strconv" + "testing" + + "cloud.google.com/go/internal/pretty" + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + bq "google.golang.org/api/bigquery/v2" +) + +type testSaver struct { + row map[string]Value + insertID string + err error +} + +func (ts testSaver) Save() (map[string]Value, string, error) { + return ts.row, ts.insertID, ts.err +} + +func TestNewInsertRequest(t *testing.T) { + prev := randomIDFn + n := 0 + randomIDFn = func() string { n++; return strconv.Itoa(n) } + defer func() { randomIDFn = prev }() + + tests := []struct { + ul *Uploader + savers []ValueSaver + req *bq.TableDataInsertAllRequest + }{ + { + ul: &Uploader{}, + savers: nil, + req: nil, + }, + { + ul: &Uploader{}, + savers: []ValueSaver{ + testSaver{row: map[string]Value{"one": 1}}, + testSaver{row: map[string]Value{"two": 2}}, + }, + req: &bq.TableDataInsertAllRequest{ + Rows: []*bq.TableDataInsertAllRequestRows{ + {InsertId: "1", Json: map[string]bq.JsonValue{"one": 1}}, + {InsertId: "2", Json: map[string]bq.JsonValue{"two": 2}}, + }, + }, + }, + { + ul: &Uploader{ + TableTemplateSuffix: "suffix", + IgnoreUnknownValues: true, + SkipInvalidRows: true, + }, + savers: []ValueSaver{ + testSaver{insertID: "a", row: map[string]Value{"one": 1}}, + testSaver{insertID: "", row: map[string]Value{"two": 2}}, + }, + req: &bq.TableDataInsertAllRequest{ + Rows: []*bq.TableDataInsertAllRequestRows{ + {InsertId: "a", Json: map[string]bq.JsonValue{"one": 1}}, + {InsertId: "3", Json: map[string]bq.JsonValue{"two": 2}}, + }, + TemplateSuffix: "suffix", + SkipInvalidRows: true, + IgnoreUnknownValues: true, + }, + }, + } + for i, tc := range tests { + got, err := tc.ul.newInsertRequest(tc.savers) + if err != nil { + t.Fatal(err) + } + want := tc.req + if !testutil.Equal(got, want) { + t.Errorf("%d: %#v: got %#v, want %#v", i, tc.ul, got, want) + } + } +} + +func TestNewInsertRequestErrors(t *testing.T) { + var u Uploader + _, err := u.newInsertRequest([]ValueSaver{testSaver{err: errors.New("bang")}}) + if err == nil { + t.Error("got nil, want error") + } +} + +func TestHandleInsertErrors(t *testing.T) { + rows := []*bq.TableDataInsertAllRequestRows{ + {InsertId: "a"}, + {InsertId: "b"}, + } + for _, test := range []struct { + in []*bq.TableDataInsertAllResponseInsertErrors + want error + }{ + { + in: nil, + want: nil, + }, + { + in: []*bq.TableDataInsertAllResponseInsertErrors{{Index: 1}}, + want: PutMultiError{RowInsertionError{InsertID: "b", RowIndex: 1}}, + }, + { + in: []*bq.TableDataInsertAllResponseInsertErrors{{Index: 1}}, + want: PutMultiError{RowInsertionError{InsertID: "b", RowIndex: 1}}, + }, + { + in: []*bq.TableDataInsertAllResponseInsertErrors{ + {Errors: []*bq.ErrorProto{{Message: "m0"}}, Index: 0}, + {Errors: []*bq.ErrorProto{{Message: "m1"}}, Index: 1}, + }, + want: PutMultiError{ + RowInsertionError{InsertID: "a", RowIndex: 0, Errors: []error{&Error{Message: "m0"}}}, + RowInsertionError{InsertID: "b", RowIndex: 1, Errors: []error{&Error{Message: "m1"}}}, + }, + }, + } { + got := handleInsertErrors(test.in, rows) + if !testutil.Equal(got, test.want) { + t.Errorf("%#v:\ngot\n%#v\nwant\n%#v", test.in, got, test.want) + } + } +} + +func TestValueSavers(t *testing.T) { + ts := &testSaver{} + type T struct{ I int } + schema, err := InferSchema(T{}) + if err != nil { + t.Fatal(err) + } + for _, test := range []struct { + in interface{} + want []ValueSaver + }{ + {[]interface{}(nil), nil}, + {[]interface{}{}, nil}, + {ts, []ValueSaver{ts}}, + {T{I: 1}, []ValueSaver{&StructSaver{Schema: schema, Struct: T{I: 1}}}}, + {[]ValueSaver{ts, ts}, []ValueSaver{ts, ts}}, + {[]interface{}{ts, ts}, []ValueSaver{ts, ts}}, + {[]T{{I: 1}, {I: 2}}, []ValueSaver{ + &StructSaver{Schema: schema, Struct: T{I: 1}}, + &StructSaver{Schema: schema, Struct: T{I: 2}}, + }}, + {[]interface{}{T{I: 1}, &T{I: 2}}, []ValueSaver{ + &StructSaver{Schema: schema, Struct: T{I: 1}}, + &StructSaver{Schema: schema, Struct: &T{I: 2}}, + }}, + {&StructSaver{Struct: T{I: 3}, InsertID: "foo"}, + []ValueSaver{ + &StructSaver{Schema: schema, Struct: T{I: 3}, InsertID: "foo"}, + }}, + } { + got, err := valueSavers(test.in) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, test.want, cmp.AllowUnexported(testSaver{})) { + t.Errorf("%+v: got %v, want %v", test.in, pretty.Value(got), pretty.Value(test.want)) + } + // Make sure Save is successful. + for i, vs := range got { + _, _, err := vs.Save() + if err != nil { + t.Fatalf("%+v, #%d: got error %v, want nil", test.in, i, err) + } + } + } +} + +func TestValueSaversErrors(t *testing.T) { + inputs := []interface{}{ + nil, + 1, + []int{1, 2}, + []interface{}{ + testSaver{row: map[string]Value{"one": 1}, insertID: "a"}, + 1, + }, + StructSaver{}, + } + for _, in := range inputs { + if _, err := valueSavers(in); err == nil { + t.Errorf("%#v: got nil, want error", in) + } + } +} diff --git a/vendor/cloud.google.com/go/bigquery/integration_test.go b/vendor/cloud.google.com/go/bigquery/integration_test.go new file mode 100644 index 000000000..84ce2881f --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/integration_test.go @@ -0,0 +1,2141 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "encoding/json" + "errors" + "flag" + "fmt" + "log" + "math/big" + "net/http" + "os" + "sort" + "strings" + "testing" + "time" + + "cloud.google.com/go/civil" + "cloud.google.com/go/httpreplay" + "cloud.google.com/go/internal" + "cloud.google.com/go/internal/pretty" + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/internal/uid" + "cloud.google.com/go/storage" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/googleapi" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +const replayFilename = "bigquery.replay" + +var record = flag.Bool("record", false, "record RPCs") + +var ( + client *Client + storageClient *storage.Client + dataset *Dataset + schema = Schema{ + {Name: "name", Type: StringFieldType}, + {Name: "nums", Type: IntegerFieldType, Repeated: true}, + {Name: "rec", Type: RecordFieldType, Schema: Schema{ + {Name: "bool", Type: BooleanFieldType}, + }}, + } + testTableExpiration time.Time + datasetIDs, tableIDs *uid.Space +) + +// Note: integration tests cannot be run in parallel, because TestIntegration_Location +// modifies the client. + +func TestMain(m *testing.M) { + cleanup := initIntegrationTest() + r := m.Run() + cleanup() + os.Exit(r) +} + +func getClient(t *testing.T) *Client { + if client == nil { + t.Skip("Integration tests skipped") + } + return client +} + +// If integration tests will be run, create a unique dataset for them. +// Return a cleanup function. +func initIntegrationTest() func() { + ctx := context.Background() + flag.Parse() // needed for testing.Short() + projID := testutil.ProjID() + switch { + case testing.Short() && *record: + log.Fatal("cannot combine -short and -record") + return func() {} + + case testing.Short() && httpreplay.Supported() && testutil.CanReplay(replayFilename) && projID != "": + // go test -short with a replay file will replay the integration tests if the + // environment variables are set. + log.Printf("replaying from %s", replayFilename) + httpreplay.DebugHeaders() + replayer, err := httpreplay.NewReplayer(replayFilename) + if err != nil { + log.Fatal(err) + } + var t time.Time + if err := json.Unmarshal(replayer.Initial(), &t); err != nil { + log.Fatal(err) + } + hc, err := replayer.Client(ctx) // no creds needed + if err != nil { + log.Fatal(err) + } + client, err = NewClient(ctx, projID, option.WithHTTPClient(hc)) + if err != nil { + log.Fatal(err) + } + storageClient, err = storage.NewClient(ctx, option.WithHTTPClient(hc)) + if err != nil { + log.Fatal(err) + } + cleanup := initTestState(client, t) + return func() { + cleanup() + _ = replayer.Close() // No actionable error returned. + } + + case testing.Short(): + // go test -short without a replay file skips the integration tests. + if testutil.CanReplay(replayFilename) && projID != "" { + log.Print("replay not supported for Go versions before 1.8") + } + client = nil + storageClient = nil + return func() {} + + default: // Run integration tests against a real backend. + ts := testutil.TokenSource(ctx, Scope) + if ts == nil { + log.Println("Integration tests skipped. See CONTRIBUTING.md for details") + return func() {} + } + bqOpt := option.WithTokenSource(ts) + sOpt := option.WithTokenSource(testutil.TokenSource(ctx, storage.ScopeFullControl)) + cleanup := func() {} + now := time.Now().UTC() + if *record { + if !httpreplay.Supported() { + log.Print("record not supported for Go versions before 1.8") + } else { + nowBytes, err := json.Marshal(now) + if err != nil { + log.Fatal(err) + } + recorder, err := httpreplay.NewRecorder(replayFilename, nowBytes) + if err != nil { + log.Fatalf("could not record: %v", err) + } + log.Printf("recording to %s", replayFilename) + hc, err := recorder.Client(ctx, bqOpt) + if err != nil { + log.Fatal(err) + } + bqOpt = option.WithHTTPClient(hc) + hc, err = recorder.Client(ctx, sOpt) + if err != nil { + log.Fatal(err) + } + sOpt = option.WithHTTPClient(hc) + cleanup = func() { + if err := recorder.Close(); err != nil { + log.Printf("saving recording: %v", err) + } + } + } + } + var err error + client, err = NewClient(ctx, projID, bqOpt) + if err != nil { + log.Fatalf("NewClient: %v", err) + } + storageClient, err = storage.NewClient(ctx, sOpt) + if err != nil { + log.Fatalf("storage.NewClient: %v", err) + } + c := initTestState(client, now) + return func() { c(); cleanup() } + } +} + +func initTestState(client *Client, t time.Time) func() { + // BigQuery does not accept hyphens in dataset or table IDs, so we create IDs + // with underscores. + ctx := context.Background() + opts := &uid.Options{Sep: '_', Time: t} + datasetIDs = uid.NewSpace("dataset", opts) + tableIDs = uid.NewSpace("table", opts) + testTableExpiration = t.Add(10 * time.Minute).Round(time.Second) + // For replayability, seed the random source with t. + Seed(t.UnixNano()) + + dataset = client.Dataset(datasetIDs.New()) + if err := dataset.Create(ctx, nil); err != nil { + log.Fatalf("creating dataset %s: %v", dataset.DatasetID, err) + } + return func() { + if err := dataset.DeleteWithContents(ctx); err != nil { + log.Printf("could not delete %s", dataset.DatasetID) + } + } +} + +func TestIntegration_TableCreate(t *testing.T) { + // Check that creating a record field with an empty schema is an error. + if client == nil { + t.Skip("Integration tests skipped") + } + table := dataset.Table("t_bad") + schema := Schema{ + {Name: "rec", Type: RecordFieldType, Schema: Schema{}}, + } + err := table.Create(context.Background(), &TableMetadata{ + Schema: schema, + ExpirationTime: testTableExpiration.Add(5 * time.Minute), + }) + if err == nil { + t.Fatal("want error, got nil") + } + if !hasStatusCode(err, http.StatusBadRequest) { + t.Fatalf("want a 400 error, got %v", err) + } +} + +func TestIntegration_TableCreateView(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + + // Test that standard SQL views work. + view := dataset.Table("t_view_standardsql") + query := fmt.Sprintf("SELECT APPROX_COUNT_DISTINCT(name) FROM `%s.%s.%s`", + dataset.ProjectID, dataset.DatasetID, table.TableID) + err := view.Create(context.Background(), &TableMetadata{ + ViewQuery: query, + UseStandardSQL: true, + }) + if err != nil { + t.Fatalf("table.create: Did not expect an error, got: %v", err) + } + if err := view.Delete(ctx); err != nil { + t.Fatal(err) + } +} + +func TestIntegration_TableMetadata(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + // Check table metadata. + md, err := table.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + // TODO(jba): check md more thorougly. + if got, want := md.FullID, fmt.Sprintf("%s:%s.%s", dataset.ProjectID, dataset.DatasetID, table.TableID); got != want { + t.Errorf("metadata.FullID: got %q, want %q", got, want) + } + if got, want := md.Type, RegularTable; got != want { + t.Errorf("metadata.Type: got %v, want %v", got, want) + } + if got, want := md.ExpirationTime, testTableExpiration; !got.Equal(want) { + t.Errorf("metadata.Type: got %v, want %v", got, want) + } + + // Check that timePartitioning is nil by default + if md.TimePartitioning != nil { + t.Errorf("metadata.TimePartitioning: got %v, want %v", md.TimePartitioning, nil) + } + + // Create tables that have time partitioning + partitionCases := []struct { + timePartitioning TimePartitioning + wantExpiration time.Duration + wantField string + wantPruneFilter bool + }{ + {TimePartitioning{}, time.Duration(0), "", false}, + {TimePartitioning{Expiration: time.Second}, time.Second, "", false}, + {TimePartitioning{RequirePartitionFilter: true}, time.Duration(0), "", true}, + { + TimePartitioning{ + Expiration: time.Second, + Field: "date", + RequirePartitionFilter: true, + }, time.Second, "date", true}, + } + + schema2 := Schema{ + {Name: "name", Type: StringFieldType}, + {Name: "date", Type: DateFieldType}, + } + + clustering := &Clustering{ + Fields: []string{"name"}, + } + + // Currently, clustering depends on partitioning. Interleave testing of the two features. + for i, c := range partitionCases { + table := dataset.Table(fmt.Sprintf("t_metadata_partition_nocluster_%v", i)) + clusterTable := dataset.Table(fmt.Sprintf("t_metadata_partition_cluster_%v", i)) + + // Create unclustered, partitioned variant and get metadata. + err = table.Create(context.Background(), &TableMetadata{ + Schema: schema2, + TimePartitioning: &c.timePartitioning, + ExpirationTime: testTableExpiration, + }) + if err != nil { + t.Fatal(err) + } + defer table.Delete(ctx) + md, err := table.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + + // Created clustered table and get metadata. + err = clusterTable.Create(context.Background(), &TableMetadata{ + Schema: schema2, + TimePartitioning: &c.timePartitioning, + ExpirationTime: testTableExpiration, + Clustering: clustering, + }) + if err != nil { + t.Fatal(err) + } + clusterMD, err := clusterTable.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + + for _, v := range []*TableMetadata{md, clusterMD} { + got := v.TimePartitioning + want := &TimePartitioning{ + Expiration: c.wantExpiration, + Field: c.wantField, + RequirePartitionFilter: c.wantPruneFilter, + } + if !testutil.Equal(got, want) { + t.Errorf("metadata.TimePartitioning: got %v, want %v", got, want) + } + // check that RequirePartitionFilter can be inverted. + mdUpdate := TableMetadataToUpdate{ + TimePartitioning: &TimePartitioning{ + Expiration: v.TimePartitioning.Expiration, + RequirePartitionFilter: !want.RequirePartitionFilter, + }, + } + + newmd, err := table.Update(ctx, mdUpdate, "") + if err != nil { + t.Errorf("failed to invert RequirePartitionFilter on %s: %v", table.FullyQualifiedName(), err) + } + if newmd.TimePartitioning.RequirePartitionFilter == want.RequirePartitionFilter { + t.Errorf("inverting RequirePartitionFilter on %s failed, want %t got %t", table.FullyQualifiedName(), !want.RequirePartitionFilter, newmd.TimePartitioning.RequirePartitionFilter) + } + + } + + if md.Clustering != nil { + t.Errorf("metadata.Clustering was not nil on unclustered table %s", table.TableID) + } + got := clusterMD.Clustering + want := clustering + if clusterMD.Clustering != clustering { + if !testutil.Equal(got, want) { + t.Errorf("metadata.Clustering: got %v, want %v", got, want) + } + } + } + +} + +func TestIntegration_DatasetCreate(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + ds := client.Dataset(datasetIDs.New()) + wmd := &DatasetMetadata{Name: "name", Location: "EU"} + err := ds.Create(ctx, wmd) + if err != nil { + t.Fatal(err) + } + gmd, err := ds.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + if got, want := gmd.Name, wmd.Name; got != want { + t.Errorf("name: got %q, want %q", got, want) + } + if got, want := gmd.Location, wmd.Location; got != want { + t.Errorf("location: got %q, want %q", got, want) + } + if err := ds.Delete(ctx); err != nil { + t.Fatalf("deleting dataset %v: %v", ds, err) + } +} + +func TestIntegration_DatasetMetadata(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + md, err := dataset.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + if got, want := md.FullID, fmt.Sprintf("%s:%s", dataset.ProjectID, dataset.DatasetID); got != want { + t.Errorf("FullID: got %q, want %q", got, want) + } + jan2016 := time.Date(2016, 1, 1, 0, 0, 0, 0, time.UTC) + if md.CreationTime.Before(jan2016) { + t.Errorf("CreationTime: got %s, want > 2016-1-1", md.CreationTime) + } + if md.LastModifiedTime.Before(jan2016) { + t.Errorf("LastModifiedTime: got %s, want > 2016-1-1", md.LastModifiedTime) + } + + // Verify that we get a NotFound for a nonexistent dataset. + _, err = client.Dataset("does_not_exist").Metadata(ctx) + if err == nil || !hasStatusCode(err, http.StatusNotFound) { + t.Errorf("got %v, want NotFound error", err) + } +} + +func TestIntegration_DatasetDelete(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + ds := client.Dataset(datasetIDs.New()) + if err := ds.Create(ctx, nil); err != nil { + t.Fatalf("creating dataset %s: %v", ds.DatasetID, err) + } + if err := ds.Delete(ctx); err != nil { + t.Fatalf("deleting dataset %s: %v", ds.DatasetID, err) + } +} + +func TestIntegration_DatasetDeleteWithContents(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + ds := client.Dataset(datasetIDs.New()) + if err := ds.Create(ctx, nil); err != nil { + t.Fatalf("creating dataset %s: %v", ds.DatasetID, err) + } + table := ds.Table(tableIDs.New()) + if err := table.Create(ctx, nil); err != nil { + t.Fatalf("creating table %s in dataset %s: %v", table.TableID, table.DatasetID, err) + } + // We expect failure here + if err := ds.Delete(ctx); err == nil { + t.Fatalf("non-recursive delete of dataset %s succeeded unexpectedly.", ds.DatasetID) + } + if err := ds.DeleteWithContents(ctx); err != nil { + t.Fatalf("deleting recursively dataset %s: %v", ds.DatasetID, err) + } +} + +func TestIntegration_DatasetUpdateETags(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + + check := func(md *DatasetMetadata, wantDesc, wantName string) { + if md.Description != wantDesc { + t.Errorf("description: got %q, want %q", md.Description, wantDesc) + } + if md.Name != wantName { + t.Errorf("name: got %q, want %q", md.Name, wantName) + } + } + + ctx := context.Background() + md, err := dataset.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + if md.ETag == "" { + t.Fatal("empty ETag") + } + // Write without ETag succeeds. + desc := md.Description + "d2" + name := md.Name + "n2" + md2, err := dataset.Update(ctx, DatasetMetadataToUpdate{Description: desc, Name: name}, "") + if err != nil { + t.Fatal(err) + } + check(md2, desc, name) + + // Write with original ETag fails because of intervening write. + _, err = dataset.Update(ctx, DatasetMetadataToUpdate{Description: "d", Name: "n"}, md.ETag) + if err == nil { + t.Fatal("got nil, want error") + } + + // Write with most recent ETag succeeds. + md3, err := dataset.Update(ctx, DatasetMetadataToUpdate{Description: "", Name: ""}, md2.ETag) + if err != nil { + t.Fatal(err) + } + check(md3, "", "") +} + +func TestIntegration_DatasetUpdateDefaultExpiration(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + _, err := dataset.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + // Set the default expiration time. + md, err := dataset.Update(ctx, DatasetMetadataToUpdate{DefaultTableExpiration: time.Hour}, "") + if err != nil { + t.Fatal(err) + } + if md.DefaultTableExpiration != time.Hour { + t.Fatalf("got %s, want 1h", md.DefaultTableExpiration) + } + // Omitting DefaultTableExpiration doesn't change it. + md, err = dataset.Update(ctx, DatasetMetadataToUpdate{Name: "xyz"}, "") + if err != nil { + t.Fatal(err) + } + if md.DefaultTableExpiration != time.Hour { + t.Fatalf("got %s, want 1h", md.DefaultTableExpiration) + } + // Setting it to 0 deletes it (which looks like a 0 duration). + md, err = dataset.Update(ctx, DatasetMetadataToUpdate{DefaultTableExpiration: time.Duration(0)}, "") + if err != nil { + t.Fatal(err) + } + if md.DefaultTableExpiration != 0 { + t.Fatalf("got %s, want 0", md.DefaultTableExpiration) + } +} + +func TestIntegration_DatasetUpdateAccess(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + md, err := dataset.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + origAccess := append([]*AccessEntry(nil), md.Access...) + newEntry := &AccessEntry{ + Role: ReaderRole, + Entity: "Joe@example.com", + EntityType: UserEmailEntity, + } + newAccess := append(md.Access, newEntry) + dm := DatasetMetadataToUpdate{Access: newAccess} + md, err = dataset.Update(ctx, dm, md.ETag) + if err != nil { + t.Fatal(err) + } + defer func() { + _, err := dataset.Update(ctx, DatasetMetadataToUpdate{Access: origAccess}, md.ETag) + if err != nil { + t.Log("could not restore dataset access list") + } + }() + if diff := testutil.Diff(md.Access, newAccess); diff != "" { + t.Fatalf("got=-, want=+:\n%s", diff) + } +} + +func TestIntegration_DatasetUpdateLabels(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + _, err := dataset.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + var dm DatasetMetadataToUpdate + dm.SetLabel("label", "value") + md, err := dataset.Update(ctx, dm, "") + if err != nil { + t.Fatal(err) + } + if got, want := md.Labels["label"], "value"; got != want { + t.Errorf("got %q, want %q", got, want) + } + dm = DatasetMetadataToUpdate{} + dm.DeleteLabel("label") + md, err = dataset.Update(ctx, dm, "") + if err != nil { + t.Fatal(err) + } + if _, ok := md.Labels["label"]; ok { + t.Error("label still present after deletion") + } +} + +func TestIntegration_TableUpdateLabels(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + + var tm TableMetadataToUpdate + tm.SetLabel("label", "value") + md, err := table.Update(ctx, tm, "") + if err != nil { + t.Fatal(err) + } + if got, want := md.Labels["label"], "value"; got != want { + t.Errorf("got %q, want %q", got, want) + } + tm = TableMetadataToUpdate{} + tm.DeleteLabel("label") + md, err = table.Update(ctx, tm, "") + if err != nil { + t.Fatal(err) + } + if _, ok := md.Labels["label"]; ok { + t.Error("label still present after deletion") + } +} + +func TestIntegration_Tables(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + wantName := table.FullyQualifiedName() + + // This test is flaky due to eventual consistency. + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + err := internal.Retry(ctx, gax.Backoff{}, func() (stop bool, err error) { + // Iterate over tables in the dataset. + it := dataset.Tables(ctx) + var tableNames []string + for { + tbl, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + return false, err + } + tableNames = append(tableNames, tbl.FullyQualifiedName()) + } + // Other tests may be running with this dataset, so there might be more + // than just our table in the list. So don't try for an exact match; just + // make sure that our table is there somewhere. + for _, tn := range tableNames { + if tn == wantName { + return true, nil + } + } + return false, fmt.Errorf("got %v\nwant %s in the list", tableNames, wantName) + }) + if err != nil { + t.Fatal(err) + } +} + +func TestIntegration_InsertAndRead(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + + // Populate the table. + ins := table.Inserter() + var ( + wantRows [][]Value + saverRows []*ValuesSaver + ) + for i, name := range []string{"a", "b", "c"} { + row := []Value{name, []Value{int64(i)}, []Value{true}} + wantRows = append(wantRows, row) + saverRows = append(saverRows, &ValuesSaver{ + Schema: schema, + InsertID: name, + Row: row, + }) + } + if err := ins.Put(ctx, saverRows); err != nil { + t.Fatal(putError(err)) + } + + // Wait until the data has been uploaded. This can take a few seconds, according + // to https://cloud.google.com/bigquery/streaming-data-into-bigquery. + if err := waitForRow(ctx, table); err != nil { + t.Fatal(err) + } + // Read the table. + checkRead(t, "upload", table.Read(ctx), wantRows) + + // Query the table. + q := client.Query(fmt.Sprintf("select name, nums, rec from %s", table.TableID)) + q.DefaultProjectID = dataset.ProjectID + q.DefaultDatasetID = dataset.DatasetID + + rit, err := q.Read(ctx) + if err != nil { + t.Fatal(err) + } + checkRead(t, "query", rit, wantRows) + + // Query the long way. + job1, err := q.Run(ctx) + if err != nil { + t.Fatal(err) + } + if job1.LastStatus() == nil { + t.Error("no LastStatus") + } + job2, err := client.JobFromID(ctx, job1.ID()) + if err != nil { + t.Fatal(err) + } + if job2.LastStatus() == nil { + t.Error("no LastStatus") + } + rit, err = job2.Read(ctx) + if err != nil { + t.Fatal(err) + } + checkRead(t, "job.Read", rit, wantRows) + + // Get statistics. + jobStatus, err := job2.Status(ctx) + if err != nil { + t.Fatal(err) + } + if jobStatus.Statistics == nil { + t.Fatal("jobStatus missing statistics") + } + if _, ok := jobStatus.Statistics.Details.(*QueryStatistics); !ok { + t.Errorf("expected QueryStatistics, got %T", jobStatus.Statistics.Details) + } + + // Test reading directly into a []Value. + valueLists, schema, _, err := readAll(table.Read(ctx)) + if err != nil { + t.Fatal(err) + } + it := table.Read(ctx) + for i, vl := range valueLists { + var got []Value + if err := it.Next(&got); err != nil { + t.Fatal(err) + } + if !testutil.Equal(it.Schema, schema) { + t.Fatalf("got schema %v, want %v", it.Schema, schema) + } + want := []Value(vl) + if !testutil.Equal(got, want) { + t.Errorf("%d: got %v, want %v", i, got, want) + } + } + + // Test reading into a map. + it = table.Read(ctx) + for _, vl := range valueLists { + var vm map[string]Value + if err := it.Next(&vm); err != nil { + t.Fatal(err) + } + if got, want := len(vm), len(vl); got != want { + t.Fatalf("valueMap len: got %d, want %d", got, want) + } + // With maps, structs become nested maps. + vl[2] = map[string]Value{"bool": vl[2].([]Value)[0]} + for i, v := range vl { + if got, want := vm[schema[i].Name], v; !testutil.Equal(got, want) { + t.Errorf("%d, name=%s: got %#v, want %#v", + i, schema[i].Name, got, want) + } + } + } + +} + +type SubSubTestStruct struct { + Integer int64 +} + +type SubTestStruct struct { + String string + Record SubSubTestStruct + RecordArray []SubSubTestStruct +} + +type TestStruct struct { + Name string + Bytes []byte + Integer int64 + Float float64 + Boolean bool + Timestamp time.Time + Date civil.Date + Time civil.Time + DateTime civil.DateTime + Numeric *big.Rat + + StringArray []string + IntegerArray []int64 + FloatArray []float64 + BooleanArray []bool + TimestampArray []time.Time + DateArray []civil.Date + TimeArray []civil.Time + DateTimeArray []civil.DateTime + NumericArray []*big.Rat + + Record SubTestStruct + RecordArray []SubTestStruct +} + +// Round times to the microsecond for comparison purposes. +var roundToMicros = cmp.Transformer("RoundToMicros", + func(t time.Time) time.Time { return t.Round(time.Microsecond) }) + +func TestIntegration_InsertAndReadStructs(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + schema, err := InferSchema(TestStruct{}) + if err != nil { + t.Fatal(err) + } + + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + + d := civil.Date{Year: 2016, Month: 3, Day: 20} + tm := civil.Time{Hour: 15, Minute: 4, Second: 5, Nanosecond: 6000} + ts := time.Date(2016, 3, 20, 15, 4, 5, 6000, time.UTC) + dtm := civil.DateTime{Date: d, Time: tm} + d2 := civil.Date{Year: 1994, Month: 5, Day: 15} + tm2 := civil.Time{Hour: 1, Minute: 2, Second: 4, Nanosecond: 0} + ts2 := time.Date(1994, 5, 15, 1, 2, 4, 0, time.UTC) + dtm2 := civil.DateTime{Date: d2, Time: tm2} + + // Populate the table. + ins := table.Inserter() + want := []*TestStruct{ + { + "a", + []byte("byte"), + 42, + 3.14, + true, + ts, + d, + tm, + dtm, + big.NewRat(57, 100), + []string{"a", "b"}, + []int64{1, 2}, + []float64{1, 1.41}, + []bool{true, false}, + []time.Time{ts, ts2}, + []civil.Date{d, d2}, + []civil.Time{tm, tm2}, + []civil.DateTime{dtm, dtm2}, + []*big.Rat{big.NewRat(1, 2), big.NewRat(3, 5)}, + SubTestStruct{ + "string", + SubSubTestStruct{24}, + []SubSubTestStruct{{1}, {2}}, + }, + []SubTestStruct{ + {String: "empty"}, + { + "full", + SubSubTestStruct{1}, + []SubSubTestStruct{{1}, {2}}, + }, + }, + }, + { + Name: "b", + Bytes: []byte("byte2"), + Integer: 24, + Float: 4.13, + Boolean: false, + Timestamp: ts, + Date: d, + Time: tm, + DateTime: dtm, + Numeric: big.NewRat(4499, 10000), + }, + } + var savers []*StructSaver + for _, s := range want { + savers = append(savers, &StructSaver{Schema: schema, Struct: s}) + } + if err := ins.Put(ctx, savers); err != nil { + t.Fatal(putError(err)) + } + + // Wait until the data has been uploaded. This can take a few seconds, according + // to https://cloud.google.com/bigquery/streaming-data-into-bigquery. + if err := waitForRow(ctx, table); err != nil { + t.Fatal(err) + } + + // Test iteration with structs. + it := table.Read(ctx) + var got []*TestStruct + for { + var g TestStruct + err := it.Next(&g) + if err == iterator.Done { + break + } + if err != nil { + t.Fatal(err) + } + got = append(got, &g) + } + sort.Sort(byName(got)) + + // BigQuery does not elide nils. It reports an error for nil fields. + for i, g := range got { + if i >= len(want) { + t.Errorf("%d: got %v, past end of want", i, pretty.Value(g)) + } else if diff := testutil.Diff(g, want[i], roundToMicros); diff != "" { + t.Errorf("%d: got=-, want=+:\n%s", i, diff) + } + } +} + +type byName []*TestStruct + +func (b byName) Len() int { return len(b) } +func (b byName) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byName) Less(i, j int) bool { return b[i].Name < b[j].Name } + +func TestIntegration_InsertAndReadNullable(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctm := civil.Time{Hour: 15, Minute: 4, Second: 5, Nanosecond: 6000} + cdt := civil.DateTime{Date: testDate, Time: ctm} + rat := big.NewRat(33, 100) + testInsertAndReadNullable(t, testStructNullable{}, make([]Value, len(testStructNullableSchema))) + testInsertAndReadNullable(t, testStructNullable{ + String: NullString{"x", true}, + Bytes: []byte{1, 2, 3}, + Integer: NullInt64{1, true}, + Float: NullFloat64{2.3, true}, + Boolean: NullBool{true, true}, + Timestamp: NullTimestamp{testTimestamp, true}, + Date: NullDate{testDate, true}, + Time: NullTime{ctm, true}, + DateTime: NullDateTime{cdt, true}, + Numeric: rat, + Record: &subNullable{X: NullInt64{4, true}}, + }, + []Value{"x", []byte{1, 2, 3}, int64(1), 2.3, true, testTimestamp, testDate, ctm, cdt, rat, []Value{int64(4)}}) +} + +func testInsertAndReadNullable(t *testing.T, ts testStructNullable, wantRow []Value) { + ctx := context.Background() + table := newTable(t, testStructNullableSchema) + defer table.Delete(ctx) + + // Populate the table. + ins := table.Inserter() + if err := ins.Put(ctx, []*StructSaver{{Schema: testStructNullableSchema, Struct: ts}}); err != nil { + t.Fatal(putError(err)) + } + // Wait until the data has been uploaded. This can take a few seconds, according + // to https://cloud.google.com/bigquery/streaming-data-into-bigquery. + if err := waitForRow(ctx, table); err != nil { + t.Fatal(err) + } + + // Read into a []Value. + iter := table.Read(ctx) + gotRows, _, _, err := readAll(iter) + if err != nil { + t.Fatal(err) + } + if len(gotRows) != 1 { + t.Fatalf("got %d rows, want 1", len(gotRows)) + } + if diff := testutil.Diff(gotRows[0], wantRow, roundToMicros); diff != "" { + t.Error(diff) + } + + // Read into a struct. + want := ts + var sn testStructNullable + it := table.Read(ctx) + if err := it.Next(&sn); err != nil { + t.Fatal(err) + } + if diff := testutil.Diff(sn, want, roundToMicros); diff != "" { + t.Error(diff) + } +} + +func TestIntegration_TableUpdate(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + + // Test Update of non-schema fields. + tm, err := table.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + wantDescription := tm.Description + "more" + wantName := tm.Name + "more" + wantExpiration := tm.ExpirationTime.Add(time.Hour * 24) + got, err := table.Update(ctx, TableMetadataToUpdate{ + Description: wantDescription, + Name: wantName, + ExpirationTime: wantExpiration, + }, tm.ETag) + if err != nil { + t.Fatal(err) + } + if got.Description != wantDescription { + t.Errorf("Description: got %q, want %q", got.Description, wantDescription) + } + if got.Name != wantName { + t.Errorf("Name: got %q, want %q", got.Name, wantName) + } + if got.ExpirationTime != wantExpiration { + t.Errorf("ExpirationTime: got %q, want %q", got.ExpirationTime, wantExpiration) + } + if !testutil.Equal(got.Schema, schema) { + t.Errorf("Schema: got %v, want %v", pretty.Value(got.Schema), pretty.Value(schema)) + } + + // Blind write succeeds. + _, err = table.Update(ctx, TableMetadataToUpdate{Name: "x"}, "") + if err != nil { + t.Fatal(err) + } + // Write with old etag fails. + _, err = table.Update(ctx, TableMetadataToUpdate{Name: "y"}, got.ETag) + if err == nil { + t.Fatal("Update with old ETag succeeded, wanted failure") + } + + // Test schema update. + // Columns can be added. schema2 is the same as schema, except for the + // added column in the middle. + nested := Schema{ + {Name: "nested", Type: BooleanFieldType}, + {Name: "other", Type: StringFieldType}, + } + schema2 := Schema{ + schema[0], + {Name: "rec2", Type: RecordFieldType, Schema: nested}, + schema[1], + schema[2], + } + + got, err = table.Update(ctx, TableMetadataToUpdate{Schema: schema2}, "") + if err != nil { + t.Fatal(err) + } + + // Wherever you add the column, it appears at the end. + schema3 := Schema{schema2[0], schema2[2], schema2[3], schema2[1]} + if !testutil.Equal(got.Schema, schema3) { + t.Errorf("add field:\ngot %v\nwant %v", + pretty.Value(got.Schema), pretty.Value(schema3)) + } + + // Updating with the empty schema succeeds, but is a no-op. + got, err = table.Update(ctx, TableMetadataToUpdate{Schema: Schema{}}, "") + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got.Schema, schema3) { + t.Errorf("empty schema:\ngot %v\nwant %v", + pretty.Value(got.Schema), pretty.Value(schema3)) + } + + // Error cases when updating schema. + for _, test := range []struct { + desc string + fields Schema + }{ + {"change from optional to required", Schema{ + {Name: "name", Type: StringFieldType, Required: true}, + schema3[1], + schema3[2], + schema3[3], + }}, + {"add a required field", Schema{ + schema3[0], schema3[1], schema3[2], schema3[3], + {Name: "req", Type: StringFieldType, Required: true}, + }}, + {"remove a field", Schema{schema3[0], schema3[1], schema3[2]}}, + {"remove a nested field", Schema{ + schema3[0], schema3[1], schema3[2], + {Name: "rec2", Type: RecordFieldType, Schema: Schema{nested[0]}}}}, + {"remove all nested fields", Schema{ + schema3[0], schema3[1], schema3[2], + {Name: "rec2", Type: RecordFieldType, Schema: Schema{}}}}, + } { + _, err = table.Update(ctx, TableMetadataToUpdate{Schema: Schema(test.fields)}, "") + if err == nil { + t.Errorf("%s: want error, got nil", test.desc) + } else if !hasStatusCode(err, 400) { + t.Errorf("%s: want 400, got %v", test.desc, err) + } + } +} + +func TestIntegration_Load(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + // CSV data can't be loaded into a repeated field, so we use a different schema. + table := newTable(t, Schema{ + {Name: "name", Type: StringFieldType}, + {Name: "nums", Type: IntegerFieldType}, + }) + defer table.Delete(ctx) + + // Load the table from a reader. + r := strings.NewReader("a,0\nb,1\nc,2\n") + wantRows := [][]Value{ + {"a", int64(0)}, + {"b", int64(1)}, + {"c", int64(2)}, + } + rs := NewReaderSource(r) + loader := table.LoaderFrom(rs) + loader.WriteDisposition = WriteTruncate + loader.Labels = map[string]string{"test": "go"} + job, err := loader.Run(ctx) + if err != nil { + t.Fatal(err) + } + if job.LastStatus() == nil { + t.Error("no LastStatus") + } + conf, err := job.Config() + if err != nil { + t.Fatal(err) + } + config, ok := conf.(*LoadConfig) + if !ok { + t.Fatalf("got %T, want LoadConfig", conf) + } + diff := testutil.Diff(config, &loader.LoadConfig, + cmp.AllowUnexported(Table{}), + cmpopts.IgnoreUnexported(Client{}, ReaderSource{}), + // returned schema is at top level, not in the config + cmpopts.IgnoreFields(FileConfig{}, "Schema")) + if diff != "" { + t.Errorf("got=-, want=+:\n%s", diff) + } + if err := wait(ctx, job); err != nil { + t.Fatal(err) + } + checkReadAndTotalRows(t, "reader load", table.Read(ctx), wantRows) + +} + +func TestIntegration_DML(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + + sql := fmt.Sprintf(`INSERT %s.%s (name, nums, rec) + VALUES ('a', [0], STRUCT(TRUE)), + ('b', [1], STRUCT(FALSE)), + ('c', [2], STRUCT(TRUE))`, + table.DatasetID, table.TableID) + if err := runDML(ctx, sql); err != nil { + t.Fatal(err) + } + wantRows := [][]Value{ + {"a", []Value{int64(0)}, []Value{true}}, + {"b", []Value{int64(1)}, []Value{false}}, + {"c", []Value{int64(2)}, []Value{true}}, + } + checkRead(t, "DML", table.Read(ctx), wantRows) +} + +func runDML(ctx context.Context, sql string) error { + // Retry insert; sometimes it fails with INTERNAL. + return internal.Retry(ctx, gax.Backoff{}, func() (stop bool, err error) { + ri, err := client.Query(sql).Read(ctx) + if err != nil { + if e, ok := err.(*googleapi.Error); ok && e.Code < 500 { + return true, err // fail on 4xx + } + return false, err + } + // It is OK to try to iterate over DML results. The first call to Next + // will return iterator.Done. + err = ri.Next(nil) + if err == nil { + return true, errors.New("want iterator.Done on the first call, got nil") + } + if err == iterator.Done { + return true, nil + } + if e, ok := err.(*googleapi.Error); ok && e.Code < 500 { + return true, err // fail on 4xx + } + return false, err + }) +} + +func TestIntegration_TimeTypes(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + dtSchema := Schema{ + {Name: "d", Type: DateFieldType}, + {Name: "t", Type: TimeFieldType}, + {Name: "dt", Type: DateTimeFieldType}, + {Name: "ts", Type: TimestampFieldType}, + } + table := newTable(t, dtSchema) + defer table.Delete(ctx) + + d := civil.Date{Year: 2016, Month: 3, Day: 20} + tm := civil.Time{Hour: 12, Minute: 30, Second: 0, Nanosecond: 6000} + dtm := civil.DateTime{Date: d, Time: tm} + ts := time.Date(2016, 3, 20, 15, 04, 05, 0, time.UTC) + wantRows := [][]Value{ + {d, tm, dtm, ts}, + } + ins := table.Inserter() + if err := ins.Put(ctx, []*ValuesSaver{ + {Schema: dtSchema, Row: wantRows[0]}, + }); err != nil { + t.Fatal(putError(err)) + } + if err := waitForRow(ctx, table); err != nil { + t.Fatal(err) + } + + // SQL wants DATETIMEs with a space between date and time, but the service + // returns them in RFC3339 form, with a "T" between. + query := fmt.Sprintf("INSERT %s.%s (d, t, dt, ts) "+ + "VALUES ('%s', '%s', '%s', '%s')", + table.DatasetID, table.TableID, + d, CivilTimeString(tm), CivilDateTimeString(dtm), ts.Format("2006-01-02 15:04:05")) + if err := runDML(ctx, query); err != nil { + t.Fatal(err) + } + wantRows = append(wantRows, wantRows[0]) + checkRead(t, "TimeTypes", table.Read(ctx), wantRows) +} + +func TestIntegration_StandardQuery(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + + d := civil.Date{Year: 2016, Month: 3, Day: 20} + tm := civil.Time{Hour: 15, Minute: 04, Second: 05, Nanosecond: 0} + ts := time.Date(2016, 3, 20, 15, 04, 05, 0, time.UTC) + dtm := ts.Format("2006-01-02 15:04:05") + + // Constructs Value slices made up of int64s. + ints := func(args ...int) []Value { + vals := make([]Value, len(args)) + for i, arg := range args { + vals[i] = int64(arg) + } + return vals + } + + testCases := []struct { + query string + wantRow []Value + }{ + {"SELECT 1", ints(1)}, + {"SELECT 1.3", []Value{1.3}}, + {"SELECT CAST(1.3 AS NUMERIC)", []Value{big.NewRat(13, 10)}}, + {"SELECT NUMERIC '0.25'", []Value{big.NewRat(1, 4)}}, + {"SELECT TRUE", []Value{true}}, + {"SELECT 'ABC'", []Value{"ABC"}}, + {"SELECT CAST('foo' AS BYTES)", []Value{[]byte("foo")}}, + {fmt.Sprintf("SELECT TIMESTAMP '%s'", dtm), []Value{ts}}, + {fmt.Sprintf("SELECT [TIMESTAMP '%s', TIMESTAMP '%s']", dtm, dtm), []Value{[]Value{ts, ts}}}, + {fmt.Sprintf("SELECT ('hello', TIMESTAMP '%s')", dtm), []Value{[]Value{"hello", ts}}}, + {fmt.Sprintf("SELECT DATETIME(TIMESTAMP '%s')", dtm), []Value{civil.DateTime{Date: d, Time: tm}}}, + {fmt.Sprintf("SELECT DATE(TIMESTAMP '%s')", dtm), []Value{d}}, + {fmt.Sprintf("SELECT TIME(TIMESTAMP '%s')", dtm), []Value{tm}}, + {"SELECT (1, 2)", []Value{ints(1, 2)}}, + {"SELECT [1, 2, 3]", []Value{ints(1, 2, 3)}}, + {"SELECT ([1, 2], 3, [4, 5])", []Value{[]Value{ints(1, 2), int64(3), ints(4, 5)}}}, + {"SELECT [(1, 2, 3), (4, 5, 6)]", []Value{[]Value{ints(1, 2, 3), ints(4, 5, 6)}}}, + {"SELECT [([1, 2, 3], 4), ([5, 6], 7)]", []Value{[]Value{[]Value{ints(1, 2, 3), int64(4)}, []Value{ints(5, 6), int64(7)}}}}, + {"SELECT ARRAY(SELECT STRUCT([1, 2]))", []Value{[]Value{[]Value{ints(1, 2)}}}}, + } + for _, c := range testCases { + q := client.Query(c.query) + it, err := q.Read(ctx) + if err != nil { + t.Fatal(err) + } + checkRead(t, "StandardQuery", it, [][]Value{c.wantRow}) + } +} + +func TestIntegration_LegacyQuery(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + + ts := time.Date(2016, 3, 20, 15, 04, 05, 0, time.UTC) + dtm := ts.Format("2006-01-02 15:04:05") + + testCases := []struct { + query string + wantRow []Value + }{ + {"SELECT 1", []Value{int64(1)}}, + {"SELECT 1.3", []Value{1.3}}, + {"SELECT TRUE", []Value{true}}, + {"SELECT 'ABC'", []Value{"ABC"}}, + {"SELECT CAST('foo' AS BYTES)", []Value{[]byte("foo")}}, + {fmt.Sprintf("SELECT TIMESTAMP('%s')", dtm), []Value{ts}}, + {fmt.Sprintf("SELECT DATE(TIMESTAMP('%s'))", dtm), []Value{"2016-03-20"}}, + {fmt.Sprintf("SELECT TIME(TIMESTAMP('%s'))", dtm), []Value{"15:04:05"}}, + } + for _, c := range testCases { + q := client.Query(c.query) + q.UseLegacySQL = true + it, err := q.Read(ctx) + if err != nil { + t.Fatal(err) + } + checkRead(t, "LegacyQuery", it, [][]Value{c.wantRow}) + } +} + +func TestIntegration_QueryParameters(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + + d := civil.Date{Year: 2016, Month: 3, Day: 20} + tm := civil.Time{Hour: 15, Minute: 04, Second: 05, Nanosecond: 3008} + rtm := tm + rtm.Nanosecond = 3000 // round to microseconds + dtm := civil.DateTime{Date: d, Time: tm} + ts := time.Date(2016, 3, 20, 15, 04, 05, 0, time.UTC) + rat := big.NewRat(13, 10) + + type ss struct { + String string + } + + type s struct { + Timestamp time.Time + StringArray []string + SubStruct ss + SubStructArray []ss + } + + testCases := []struct { + query string + parameters []QueryParameter + wantRow []Value + wantConfig interface{} + }{ + { + "SELECT @val", + []QueryParameter{{"val", 1}}, + []Value{int64(1)}, + int64(1), + }, + { + "SELECT @val", + []QueryParameter{{"val", 1.3}}, + []Value{1.3}, + 1.3, + }, + { + "SELECT @val", + []QueryParameter{{"val", rat}}, + []Value{rat}, + rat, + }, + { + "SELECT @val", + []QueryParameter{{"val", true}}, + []Value{true}, + true, + }, + { + "SELECT @val", + []QueryParameter{{"val", "ABC"}}, + []Value{"ABC"}, + "ABC", + }, + { + "SELECT @val", + []QueryParameter{{"val", []byte("foo")}}, + []Value{[]byte("foo")}, + []byte("foo"), + }, + { + "SELECT @val", + []QueryParameter{{"val", ts}}, + []Value{ts}, + ts, + }, + { + "SELECT @val", + []QueryParameter{{"val", []time.Time{ts, ts}}}, + []Value{[]Value{ts, ts}}, + []interface{}{ts, ts}, + }, + { + "SELECT @val", + []QueryParameter{{"val", dtm}}, + []Value{civil.DateTime{Date: d, Time: rtm}}, + civil.DateTime{Date: d, Time: rtm}, + }, + { + "SELECT @val", + []QueryParameter{{"val", d}}, + []Value{d}, + d, + }, + { + "SELECT @val", + []QueryParameter{{"val", tm}}, + []Value{rtm}, + rtm, + }, + { + "SELECT @val", + []QueryParameter{{"val", s{ts, []string{"a", "b"}, ss{"c"}, []ss{{"d"}, {"e"}}}}}, + []Value{[]Value{ts, []Value{"a", "b"}, []Value{"c"}, []Value{[]Value{"d"}, []Value{"e"}}}}, + map[string]interface{}{ + "Timestamp": ts, + "StringArray": []interface{}{"a", "b"}, + "SubStruct": map[string]interface{}{"String": "c"}, + "SubStructArray": []interface{}{ + map[string]interface{}{"String": "d"}, + map[string]interface{}{"String": "e"}, + }, + }, + }, + { + "SELECT @val.Timestamp, @val.SubStruct.String", + []QueryParameter{{"val", s{Timestamp: ts, SubStruct: ss{"a"}}}}, + []Value{ts, "a"}, + map[string]interface{}{ + "Timestamp": ts, + "SubStruct": map[string]interface{}{"String": "a"}, + "StringArray": nil, + "SubStructArray": nil, + }, + }, + } + for _, c := range testCases { + q := client.Query(c.query) + q.Parameters = c.parameters + job, err := q.Run(ctx) + if err != nil { + t.Fatal(err) + } + if job.LastStatus() == nil { + t.Error("no LastStatus") + } + it, err := job.Read(ctx) + if err != nil { + t.Fatal(err) + } + checkRead(t, "QueryParameters", it, [][]Value{c.wantRow}) + config, err := job.Config() + if err != nil { + t.Fatal(err) + } + got := config.(*QueryConfig).Parameters[0].Value + if !testutil.Equal(got, c.wantConfig) { + t.Errorf("param %[1]v (%[1]T): config:\ngot %[2]v (%[2]T)\nwant %[3]v (%[3]T)", + c.parameters[0].Value, got, c.wantConfig) + } + } +} + +func TestIntegration_QueryDryRun(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + q := client.Query("SELECT word from " + stdName + " LIMIT 10") + q.DryRun = true + job, err := q.Run(ctx) + if err != nil { + t.Fatal(err) + } + + s := job.LastStatus() + if s.State != Done { + t.Errorf("state is %v, expected Done", s.State) + } + if s.Statistics == nil { + t.Fatal("no statistics") + } + if s.Statistics.Details.(*QueryStatistics).Schema == nil { + t.Fatal("no schema") + } +} + +func TestIntegration_ExtractExternal(t *testing.T) { + // Create a table, extract it to GCS, then query it externally. + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + schema := Schema{ + {Name: "name", Type: StringFieldType}, + {Name: "num", Type: IntegerFieldType}, + } + table := newTable(t, schema) + defer table.Delete(ctx) + + // Insert table data. + sql := fmt.Sprintf(`INSERT %s.%s (name, num) + VALUES ('a', 1), ('b', 2), ('c', 3)`, + table.DatasetID, table.TableID) + if err := runDML(ctx, sql); err != nil { + t.Fatal(err) + } + // Extract to a GCS object as CSV. + bucketName := testutil.ProjID() + objectName := fmt.Sprintf("bq-test-%s.csv", table.TableID) + uri := fmt.Sprintf("gs://%s/%s", bucketName, objectName) + defer storageClient.Bucket(bucketName).Object(objectName).Delete(ctx) + gr := NewGCSReference(uri) + gr.DestinationFormat = CSV + e := table.ExtractorTo(gr) + job, err := e.Run(ctx) + if err != nil { + t.Fatal(err) + } + conf, err := job.Config() + if err != nil { + t.Fatal(err) + } + config, ok := conf.(*ExtractConfig) + if !ok { + t.Fatalf("got %T, want ExtractConfig", conf) + } + diff := testutil.Diff(config, &e.ExtractConfig, + cmp.AllowUnexported(Table{}), + cmpopts.IgnoreUnexported(Client{})) + if diff != "" { + t.Errorf("got=-, want=+:\n%s", diff) + } + if err := wait(ctx, job); err != nil { + t.Fatal(err) + } + + edc := &ExternalDataConfig{ + SourceFormat: CSV, + SourceURIs: []string{uri}, + Schema: schema, + Options: &CSVOptions{SkipLeadingRows: 1}, + } + // Query that CSV file directly. + q := client.Query("SELECT * FROM csv") + q.TableDefinitions = map[string]ExternalData{"csv": edc} + wantRows := [][]Value{ + {"a", int64(1)}, + {"b", int64(2)}, + {"c", int64(3)}, + } + iter, err := q.Read(ctx) + if err != nil { + t.Fatal(err) + } + checkReadAndTotalRows(t, "external query", iter, wantRows) + + // Make a table pointing to the file, and query it. + // BigQuery does not allow a Table.Read on an external table. + table = dataset.Table(tableIDs.New()) + err = table.Create(context.Background(), &TableMetadata{ + Schema: schema, + ExpirationTime: testTableExpiration, + ExternalDataConfig: edc, + }) + if err != nil { + t.Fatal(err) + } + q = client.Query(fmt.Sprintf("SELECT * FROM %s.%s", table.DatasetID, table.TableID)) + iter, err = q.Read(ctx) + if err != nil { + t.Fatal(err) + } + checkReadAndTotalRows(t, "external table", iter, wantRows) + + // While we're here, check that the table metadata is correct. + md, err := table.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + // One difference: since BigQuery returns the schema as part of the ordinary + // table metadata, it does not populate ExternalDataConfig.Schema. + md.ExternalDataConfig.Schema = md.Schema + if diff := testutil.Diff(md.ExternalDataConfig, edc); diff != "" { + t.Errorf("got=-, want=+\n%s", diff) + } +} + +func TestIntegration_ReadNullIntoStruct(t *testing.T) { + // Reading a null into a struct field should return an error (not panic). + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + + ins := table.Inserter() + row := &ValuesSaver{ + Schema: schema, + Row: []Value{nil, []Value{}, []Value{nil}}, + } + if err := ins.Put(ctx, []*ValuesSaver{row}); err != nil { + t.Fatal(putError(err)) + } + if err := waitForRow(ctx, table); err != nil { + t.Fatal(err) + } + + q := client.Query(fmt.Sprintf("select name from %s", table.TableID)) + q.DefaultProjectID = dataset.ProjectID + q.DefaultDatasetID = dataset.DatasetID + it, err := q.Read(ctx) + if err != nil { + t.Fatal(err) + } + type S struct{ Name string } + var s S + if err := it.Next(&s); err == nil { + t.Fatal("got nil, want error") + } +} + +const ( + stdName = "`bigquery-public-data.samples.shakespeare`" + legacyName = "[bigquery-public-data:samples.shakespeare]" +) + +// These tests exploit the fact that the two SQL versions have different syntaxes for +// fully-qualified table names. +var useLegacySQLTests = []struct { + t string // name of table + std, legacy bool // use standard/legacy SQL + err bool // do we expect an error? +}{ + {t: legacyName, std: false, legacy: true, err: false}, + {t: legacyName, std: true, legacy: false, err: true}, + {t: legacyName, std: false, legacy: false, err: true}, // standard SQL is default + {t: legacyName, std: true, legacy: true, err: true}, + {t: stdName, std: false, legacy: true, err: true}, + {t: stdName, std: true, legacy: false, err: false}, + {t: stdName, std: false, legacy: false, err: false}, // standard SQL is default + {t: stdName, std: true, legacy: true, err: true}, +} + +func TestIntegration_QueryUseLegacySQL(t *testing.T) { + // Test the UseLegacySQL and UseStandardSQL options for queries. + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + for _, test := range useLegacySQLTests { + q := client.Query(fmt.Sprintf("select word from %s limit 1", test.t)) + q.UseStandardSQL = test.std + q.UseLegacySQL = test.legacy + _, err := q.Read(ctx) + gotErr := err != nil + if gotErr && !test.err { + t.Errorf("%+v:\nunexpected error: %v", test, err) + } else if !gotErr && test.err { + t.Errorf("%+v:\nsucceeded, but want error", test) + } + } +} + +func TestIntegration_TableUseLegacySQL(t *testing.T) { + // Test UseLegacySQL and UseStandardSQL for Table.Create. + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + table := newTable(t, schema) + defer table.Delete(ctx) + for i, test := range useLegacySQLTests { + view := dataset.Table(fmt.Sprintf("t_view_%d", i)) + tm := &TableMetadata{ + ViewQuery: fmt.Sprintf("SELECT word from %s", test.t), + UseStandardSQL: test.std, + UseLegacySQL: test.legacy, + } + err := view.Create(ctx, tm) + gotErr := err != nil + if gotErr && !test.err { + t.Errorf("%+v:\nunexpected error: %v", test, err) + } else if !gotErr && test.err { + t.Errorf("%+v:\nsucceeded, but want error", test) + } + _ = view.Delete(ctx) + } +} + +func TestIntegration_ListJobs(t *testing.T) { + // It's difficult to test the list of jobs, because we can't easily + // control what's in it. Also, there are many jobs in the test project, + // and it takes considerable time to list them all. + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + + // About all we can do is list a few jobs. + const max = 20 + var jobs []*Job + it := client.Jobs(ctx) + for { + job, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + t.Fatal(err) + } + jobs = append(jobs, job) + if len(jobs) >= max { + break + } + } + // We expect that there is at least one job in the last few months. + if len(jobs) == 0 { + t.Fatal("did not get any jobs") + } +} + +const tokyo = "asia-northeast1" + +func TestIntegration_Location(t *testing.T) { + if client == nil { + t.Skip("Integration tests skipped") + } + client.Location = "" + testLocation(t, tokyo) + client.Location = tokyo + defer func() { + client.Location = "" + }() + testLocation(t, "") +} + +func testLocation(t *testing.T, loc string) { + ctx := context.Background() + tokyoDataset := client.Dataset("tokyo") + err := tokyoDataset.Create(ctx, &DatasetMetadata{Location: loc}) + if err != nil && !hasStatusCode(err, 409) { // 409 = already exists + t.Fatal(err) + } + md, err := tokyoDataset.Metadata(ctx) + if err != nil { + t.Fatal(err) + } + if md.Location != tokyo { + t.Fatalf("dataset location: got %s, want %s", md.Location, tokyo) + } + table := tokyoDataset.Table(tableIDs.New()) + err = table.Create(context.Background(), &TableMetadata{ + Schema: Schema{ + {Name: "name", Type: StringFieldType}, + {Name: "nums", Type: IntegerFieldType}, + }, + ExpirationTime: testTableExpiration, + }) + if err != nil { + t.Fatal(err) + } + defer table.Delete(ctx) + loader := table.LoaderFrom(NewReaderSource(strings.NewReader("a,0\nb,1\nc,2\n"))) + loader.Location = loc + job, err := loader.Run(ctx) + if err != nil { + t.Fatal("loader.Run", err) + } + if job.Location() != tokyo { + t.Fatalf("job location: got %s, want %s", job.Location(), tokyo) + } + _, err = client.JobFromID(ctx, job.ID()) + if client.Location == "" && err == nil { + t.Error("JobFromID with Tokyo job, no client location: want error, got nil") + } + if client.Location != "" && err != nil { + t.Errorf("JobFromID with Tokyo job, with client location: want nil, got %v", err) + } + _, err = client.JobFromIDLocation(ctx, job.ID(), "US") + if err == nil { + t.Error("JobFromIDLocation with US: want error, got nil") + } + job2, err := client.JobFromIDLocation(ctx, job.ID(), loc) + if loc == tokyo && err != nil { + t.Errorf("loc=tokyo: %v", err) + } + if loc == "" && err == nil { + t.Error("loc empty: got nil, want error") + } + if job2 != nil && (job2.ID() != job.ID() || job2.Location() != tokyo) { + t.Errorf("got id %s loc %s, want id%s loc %s", job2.ID(), job2.Location(), job.ID(), tokyo) + } + if err := wait(ctx, job); err != nil { + t.Fatal(err) + } + // Cancel should succeed even if the job is done. + if err := job.Cancel(ctx); err != nil { + t.Fatal(err) + } + + q := client.Query(fmt.Sprintf("SELECT * FROM %s.%s", table.DatasetID, table.TableID)) + q.Location = loc + iter, err := q.Read(ctx) + if err != nil { + t.Fatal(err) + } + wantRows := [][]Value{ + {"a", int64(0)}, + {"b", int64(1)}, + {"c", int64(2)}, + } + checkRead(t, "location", iter, wantRows) + + table2 := tokyoDataset.Table(tableIDs.New()) + copier := table2.CopierFrom(table) + copier.Location = loc + if _, err := copier.Run(ctx); err != nil { + t.Fatal(err) + } + bucketName := testutil.ProjID() + objectName := fmt.Sprintf("bq-test-%s.csv", table.TableID) + uri := fmt.Sprintf("gs://%s/%s", bucketName, objectName) + defer storageClient.Bucket(bucketName).Object(objectName).Delete(ctx) + gr := NewGCSReference(uri) + gr.DestinationFormat = CSV + e := table.ExtractorTo(gr) + e.Location = loc + if _, err := e.Run(ctx); err != nil { + t.Fatal(err) + } +} + +func TestIntegration_NumericErrors(t *testing.T) { + // Verify that the service returns an error for a big.Rat that's too large. + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + schema := Schema{{Name: "n", Type: NumericFieldType}} + table := newTable(t, schema) + defer table.Delete(ctx) + tooBigRat := &big.Rat{} + if _, ok := tooBigRat.SetString("1e40"); !ok { + t.Fatal("big.Rat.SetString failed") + } + ins := table.Inserter() + err := ins.Put(ctx, []*ValuesSaver{{Schema: schema, Row: []Value{tooBigRat}}}) + if err == nil { + t.Fatal("got nil, want error") + } +} + +func TestIntegration_QueryErrors(t *testing.T) { + // Verify that a bad query returns an appropriate error. + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + q := client.Query("blah blah broken") + _, err := q.Read(ctx) + const want = "invalidQuery" + if !strings.Contains(err.Error(), want) { + t.Fatalf("got %q, want substring %q", err, want) + } +} + +func TestIntegration_Model(t *testing.T) { + // Create an ML model. + if client == nil { + t.Skip("Integration tests skipped") + } + ctx := context.Background() + schema := Schema{ + {Name: "input", Type: IntegerFieldType}, + {Name: "label", Type: IntegerFieldType}, + } + table := newTable(t, schema) + defer table.Delete(ctx) + + // Insert table data. + tableName := fmt.Sprintf("%s.%s", table.DatasetID, table.TableID) + sql := fmt.Sprintf(`INSERT %s (input, label) + VALUES (1, 0), (2, 1), (3, 0), (4, 1)`, + tableName) + wantNumRows := 4 + + if err := runDML(ctx, sql); err != nil { + t.Fatal(err) + } + + model := dataset.Table("my_model") + modelName := fmt.Sprintf("%s.%s", model.DatasetID, model.TableID) + sql = fmt.Sprintf(`CREATE MODEL %s OPTIONS (model_type='logistic_reg') AS SELECT input, label FROM %s`, + modelName, tableName) + if err := runDML(ctx, sql); err != nil { + t.Fatal(err) + } + defer model.Delete(ctx) + + sql = fmt.Sprintf(`SELECT * FROM ml.PREDICT(MODEL %s, TABLE %s)`, modelName, tableName) + q := client.Query(sql) + ri, err := q.Read(ctx) + if err != nil { + t.Fatal(err) + } + rows, _, _, err := readAll(ri) + if err != nil { + t.Fatal(err) + } + if got := len(rows); got != wantNumRows { + t.Fatalf("got %d rows in prediction table, want %d", got, wantNumRows) + } + iter := dataset.Tables(ctx) + seen := false + for { + tbl, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + t.Fatal(err) + } + if tbl.TableID == "my_model" { + seen = true + } + } + if !seen { + t.Fatal("model not listed in dataset") + } + if err := model.Delete(ctx); err != nil { + t.Fatal(err) + } +} + +// Creates a new, temporary table with a unique name and the given schema. +func newTable(t *testing.T, s Schema) *Table { + table := dataset.Table(tableIDs.New()) + err := table.Create(context.Background(), &TableMetadata{ + Schema: s, + ExpirationTime: testTableExpiration, + }) + if err != nil { + t.Fatal(err) + } + return table +} + +func checkRead(t *testing.T, msg string, it *RowIterator, want [][]Value) { + if msg2, ok := compareRead(it, want, false); !ok { + t.Errorf("%s: %s", msg, msg2) + } +} + +func checkReadAndTotalRows(t *testing.T, msg string, it *RowIterator, want [][]Value) { + if msg2, ok := compareRead(it, want, true); !ok { + t.Errorf("%s: %s", msg, msg2) + } +} + +func compareRead(it *RowIterator, want [][]Value, compareTotalRows bool) (msg string, ok bool) { + got, _, totalRows, err := readAll(it) + if err != nil { + return err.Error(), false + } + if len(got) != len(want) { + return fmt.Sprintf("got %d rows, want %d", len(got), len(want)), false + } + if compareTotalRows && len(got) != int(totalRows) { + return fmt.Sprintf("got %d rows, but totalRows = %d", len(got), totalRows), false + } + sort.Sort(byCol0(got)) + for i, r := range got { + gotRow := []Value(r) + wantRow := want[i] + if !testutil.Equal(gotRow, wantRow) { + return fmt.Sprintf("#%d: got %#v, want %#v", i, gotRow, wantRow), false + } + } + return "", true +} + +func readAll(it *RowIterator) ([][]Value, Schema, uint64, error) { + var ( + rows [][]Value + schema Schema + totalRows uint64 + ) + for { + var vals []Value + err := it.Next(&vals) + if err == iterator.Done { + return rows, schema, totalRows, nil + } + if err != nil { + return nil, nil, 0, err + } + rows = append(rows, vals) + schema = it.Schema + totalRows = it.TotalRows + } +} + +type byCol0 [][]Value + +func (b byCol0) Len() int { return len(b) } +func (b byCol0) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byCol0) Less(i, j int) bool { + switch a := b[i][0].(type) { + case string: + return a < b[j][0].(string) + case civil.Date: + return a.Before(b[j][0].(civil.Date)) + default: + panic("unknown type") + } +} + +func hasStatusCode(err error, code int) bool { + if e, ok := err.(*googleapi.Error); ok && e.Code == code { + return true + } + return false +} + +// wait polls the job until it is complete or an error is returned. +func wait(ctx context.Context, job *Job) error { + status, err := job.Wait(ctx) + if err != nil { + return err + } + if status.Err() != nil { + return fmt.Errorf("job status error: %#v", status.Err()) + } + if status.Statistics == nil { + return errors.New("nil Statistics") + } + if status.Statistics.EndTime.IsZero() { + return errors.New("EndTime is zero") + } + if status.Statistics.Details == nil { + return errors.New("nil Statistics.Details") + } + return nil +} + +// waitForRow polls the table until it contains a row. +// TODO(jba): use internal.Retry. +func waitForRow(ctx context.Context, table *Table) error { + for { + it := table.Read(ctx) + var v []Value + err := it.Next(&v) + if err == nil { + return nil + } + if err != iterator.Done { + return err + } + time.Sleep(1 * time.Second) + } +} + +func putError(err error) string { + pme, ok := err.(PutMultiError) + if !ok { + return err.Error() + } + var msgs []string + for _, err := range pme { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "\n") +} diff --git a/vendor/cloud.google.com/go/bigquery/iterator.go b/vendor/cloud.google.com/go/bigquery/iterator.go new file mode 100644 index 000000000..298143cbb --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/iterator.go @@ -0,0 +1,222 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "fmt" + "reflect" + + bq "google.golang.org/api/bigquery/v2" + "google.golang.org/api/iterator" +) + +// Construct a RowIterator. +// If pf is nil, there are no rows in the result set. +func newRowIterator(ctx context.Context, t *Table, pf pageFetcher) *RowIterator { + it := &RowIterator{ + ctx: ctx, + table: t, + pf: pf, + } + if pf != nil { + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.rows) }, + func() interface{} { r := it.rows; it.rows = nil; return r }) + } + return it +} + +// A RowIterator provides access to the result of a BigQuery lookup. +type RowIterator struct { + ctx context.Context + table *Table + pf pageFetcher + pageInfo *iterator.PageInfo + nextFunc func() error + + // StartIndex can be set before the first call to Next. If PageInfo().Token + // is also set, StartIndex is ignored. + StartIndex uint64 + + // The schema of the table. Available after the first call to Next. + Schema Schema + + // The total number of rows in the result. Available after the first call to Next. + // May be zero just after rows were inserted. + TotalRows uint64 + + rows [][]Value + structLoader structLoader // used to populate a pointer to a struct +} + +// Next loads the next row into dst. Its return value is iterator.Done if there +// are no more results. Once Next returns iterator.Done, all subsequent calls +// will return iterator.Done. +// +// dst may implement ValueLoader, or may be a *[]Value, *map[string]Value, or struct pointer. +// +// If dst is a *[]Value, it will be set to new []Value whose i'th element +// will be populated with the i'th column of the row. +// +// If dst is a *map[string]Value, a new map will be created if dst is nil. Then +// for each schema column name, the map key of that name will be set to the column's +// value. STRUCT types (RECORD types or nested schemas) become nested maps. +// +// If dst is pointer to a struct, each column in the schema will be matched +// with an exported field of the struct that has the same name, ignoring case. +// Unmatched schema columns and struct fields will be ignored. +// +// Each BigQuery column type corresponds to one or more Go types; a matching struct +// field must be of the correct type. The correspondences are: +// +// STRING string +// BOOL bool +// INTEGER int, int8, int16, int32, int64, uint8, uint16, uint32 +// FLOAT float32, float64 +// BYTES []byte +// TIMESTAMP time.Time +// DATE civil.Date +// TIME civil.Time +// DATETIME civil.DateTime +// +// A repeated field corresponds to a slice or array of the element type. A STRUCT +// type (RECORD or nested schema) corresponds to a nested struct or struct pointer. +// All calls to Next on the same iterator must use the same struct type. +// +// It is an error to attempt to read a BigQuery NULL value into a struct field, +// unless the field is of type []byte or is one of the special Null types: NullInt64, +// NullFloat64, NullBool, NullString, NullTimestamp, NullDate, NullTime or +// NullDateTime. You can also use a *[]Value or *map[string]Value to read from a +// table with NULLs. +func (it *RowIterator) Next(dst interface{}) error { + if it.pf == nil { // There are no rows in the result set. + return iterator.Done + } + var vl ValueLoader + switch dst := dst.(type) { + case ValueLoader: + vl = dst + case *[]Value: + vl = (*valueList)(dst) + case *map[string]Value: + vl = (*valueMap)(dst) + default: + if !isStructPtr(dst) { + return fmt.Errorf("bigquery: cannot convert %T to ValueLoader (need pointer to []Value, map[string]Value, or struct)", dst) + } + } + if err := it.nextFunc(); err != nil { + return err + } + row := it.rows[0] + it.rows = it.rows[1:] + + if vl == nil { + // This can only happen if dst is a pointer to a struct. We couldn't + // set vl above because we need the schema. + if err := it.structLoader.set(dst, it.Schema); err != nil { + return err + } + vl = &it.structLoader + } + return vl.Load(row, it.Schema) +} + +func isStructPtr(x interface{}) bool { + t := reflect.TypeOf(x) + return t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Struct +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *RowIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +func (it *RowIterator) fetch(pageSize int, pageToken string) (string, error) { + res, err := it.pf(it.ctx, it.table, it.Schema, it.StartIndex, int64(pageSize), pageToken) + if err != nil { + return "", err + } + it.rows = append(it.rows, res.rows...) + it.Schema = res.schema + it.TotalRows = res.totalRows + return res.pageToken, nil +} + +// A pageFetcher returns a page of rows from a destination table. +type pageFetcher func(ctx context.Context, _ *Table, _ Schema, startIndex uint64, pageSize int64, pageToken string) (*fetchPageResult, error) + +type fetchPageResult struct { + pageToken string + rows [][]Value + totalRows uint64 + schema Schema +} + +// fetchPage gets a page of rows from t. +func fetchPage(ctx context.Context, t *Table, schema Schema, startIndex uint64, pageSize int64, pageToken string) (*fetchPageResult, error) { + // Fetch the table schema in the background, if necessary. + errc := make(chan error, 1) + if schema != nil { + errc <- nil + } else { + go func() { + var bqt *bq.Table + err := runWithRetry(ctx, func() (err error) { + bqt, err = t.c.bqs.Tables.Get(t.ProjectID, t.DatasetID, t.TableID). + Fields("schema"). + Context(ctx). + Do() + return err + }) + if err == nil && bqt.Schema != nil { + schema = bqToSchema(bqt.Schema) + } + errc <- err + }() + } + call := t.c.bqs.Tabledata.List(t.ProjectID, t.DatasetID, t.TableID) + setClientHeader(call.Header()) + if pageToken != "" { + call.PageToken(pageToken) + } else { + call.StartIndex(startIndex) + } + if pageSize > 0 { + call.MaxResults(pageSize) + } + var res *bq.TableDataList + err := runWithRetry(ctx, func() (err error) { + res, err = call.Context(ctx).Do() + return err + }) + if err != nil { + return nil, err + } + err = <-errc + if err != nil { + return nil, err + } + rows, err := convertRows(res.Rows, schema) + if err != nil { + return nil, err + } + return &fetchPageResult{ + pageToken: res.PageToken, + rows: rows, + totalRows: uint64(res.TotalRows), + schema: schema, + }, nil +} diff --git a/vendor/cloud.google.com/go/bigquery/iterator_test.go b/vendor/cloud.google.com/go/bigquery/iterator_test.go new file mode 100644 index 000000000..125796d7c --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/iterator_test.go @@ -0,0 +1,362 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "errors" + "fmt" + "testing" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" +) + +type fetchResponse struct { + result *fetchPageResult // The result to return. + err error // The error to return. +} + +// pageFetcherStub services fetch requests by returning data from an in-memory list of values. +type pageFetcherStub struct { + fetchResponses map[string]fetchResponse + err error +} + +func (pf *pageFetcherStub) fetchPage(ctx context.Context, _ *Table, _ Schema, _ uint64, _ int64, pageToken string) (*fetchPageResult, error) { + call, ok := pf.fetchResponses[pageToken] + if !ok { + pf.err = fmt.Errorf("Unexpected page token: %q", pageToken) + } + return call.result, call.err +} + +func TestIterator(t *testing.T) { + var ( + iiSchema = Schema{ + {Type: IntegerFieldType}, + {Type: IntegerFieldType}, + } + siSchema = Schema{ + {Type: StringFieldType}, + {Type: IntegerFieldType}, + } + ) + fetchFailure := errors.New("fetch failure") + + testCases := []struct { + desc string + pageToken string + fetchResponses map[string]fetchResponse + want [][]Value + wantErr error + wantSchema Schema + wantTotalRows uint64 + }{ + { + desc: "Iteration over single empty page", + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "", + rows: [][]Value{}, + schema: Schema{}, + }, + }, + }, + want: [][]Value{}, + wantSchema: Schema{}, + }, + { + desc: "Iteration over single page", + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "", + rows: [][]Value{{1, 2}, {11, 12}}, + schema: iiSchema, + totalRows: 4, + }, + }, + }, + want: [][]Value{{1, 2}, {11, 12}}, + wantSchema: iiSchema, + wantTotalRows: 4, + }, + { + desc: "Iteration over single page with different schema", + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "", + rows: [][]Value{{"1", 2}, {"11", 12}}, + schema: siSchema, + }, + }, + }, + want: [][]Value{{"1", 2}, {"11", 12}}, + wantSchema: siSchema, + }, + { + desc: "Iteration over two pages", + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "a", + rows: [][]Value{{1, 2}, {11, 12}}, + schema: iiSchema, + totalRows: 4, + }, + }, + "a": { + result: &fetchPageResult{ + pageToken: "", + rows: [][]Value{{101, 102}, {111, 112}}, + schema: iiSchema, + totalRows: 4, + }, + }, + }, + want: [][]Value{{1, 2}, {11, 12}, {101, 102}, {111, 112}}, + wantSchema: iiSchema, + wantTotalRows: 4, + }, + { + desc: "Server response includes empty page", + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "a", + rows: [][]Value{{1, 2}, {11, 12}}, + schema: iiSchema, + }, + }, + "a": { + result: &fetchPageResult{ + pageToken: "b", + rows: [][]Value{}, + schema: iiSchema, + }, + }, + "b": { + result: &fetchPageResult{ + pageToken: "", + rows: [][]Value{{101, 102}, {111, 112}}, + schema: iiSchema, + }, + }, + }, + want: [][]Value{{1, 2}, {11, 12}, {101, 102}, {111, 112}}, + wantSchema: iiSchema, + }, + { + desc: "Fetch error", + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "a", + rows: [][]Value{{1, 2}, {11, 12}}, + schema: iiSchema, + }, + }, + "a": { + // We returns some data from this fetch, but also an error. + // So the end result should include only data from the previous fetch. + err: fetchFailure, + result: &fetchPageResult{ + pageToken: "b", + rows: [][]Value{{101, 102}, {111, 112}}, + schema: iiSchema, + }, + }, + }, + want: [][]Value{{1, 2}, {11, 12}}, + wantErr: fetchFailure, + wantSchema: iiSchema, + }, + + { + desc: "Skip over an entire page", + pageToken: "a", + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "a", + rows: [][]Value{{1, 2}, {11, 12}}, + schema: iiSchema, + }, + }, + "a": { + result: &fetchPageResult{ + pageToken: "", + rows: [][]Value{{101, 102}, {111, 112}}, + schema: iiSchema, + }, + }, + }, + want: [][]Value{{101, 102}, {111, 112}}, + wantSchema: iiSchema, + }, + + { + desc: "Skip beyond all data", + pageToken: "b", + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "a", + rows: [][]Value{{1, 2}, {11, 12}}, + schema: iiSchema, + }, + }, + "a": { + result: &fetchPageResult{ + pageToken: "b", + rows: [][]Value{{101, 102}, {111, 112}}, + schema: iiSchema, + }, + }, + "b": { + result: &fetchPageResult{}, + }, + }, + // In this test case, Next will return false on its first call, + // so we won't even attempt to call Get. + want: [][]Value{}, + wantSchema: Schema{}, + }, + } + + for _, tc := range testCases { + pf := &pageFetcherStub{ + fetchResponses: tc.fetchResponses, + } + it := newRowIterator(context.Background(), nil, pf.fetchPage) + it.PageInfo().Token = tc.pageToken + values, schema, totalRows, err := consumeRowIterator(it) + if err != tc.wantErr { + t.Fatalf("%s: got %v, want %v", tc.desc, err, tc.wantErr) + } + if (len(values) != 0 || len(tc.want) != 0) && !testutil.Equal(values, tc.want) { + t.Errorf("%s: values:\ngot: %v\nwant:%v", tc.desc, values, tc.want) + } + if (len(schema) != 0 || len(tc.wantSchema) != 0) && !testutil.Equal(schema, tc.wantSchema) { + t.Errorf("%s: iterator.Schema:\ngot: %v\nwant: %v", tc.desc, schema, tc.wantSchema) + } + if totalRows != tc.wantTotalRows { + t.Errorf("%s: totalRows: got %d, want %d", tc.desc, totalRows, tc.wantTotalRows) + } + } +} + +// consumeRowIterator reads the schema and all values from a RowIterator and returns them. +func consumeRowIterator(it *RowIterator) ([][]Value, Schema, uint64, error) { + var ( + got [][]Value + schema Schema + totalRows uint64 + ) + for { + var vls []Value + err := it.Next(&vls) + if err == iterator.Done { + return got, schema, totalRows, nil + } + if err != nil { + return got, schema, totalRows, err + } + got = append(got, vls) + schema = it.Schema + totalRows = it.TotalRows + } +} + +func TestNextDuringErrorState(t *testing.T) { + pf := &pageFetcherStub{ + fetchResponses: map[string]fetchResponse{ + "": {err: errors.New("bang")}, + }, + } + it := newRowIterator(context.Background(), nil, pf.fetchPage) + var vals []Value + if err := it.Next(&vals); err == nil { + t.Errorf("Expected error after calling Next") + } + if err := it.Next(&vals); err == nil { + t.Errorf("Expected error calling Next again when iterator has a non-nil error.") + } +} + +func TestNextAfterFinished(t *testing.T) { + testCases := []struct { + fetchResponses map[string]fetchResponse + want [][]Value + }{ + { + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "", + rows: [][]Value{{1, 2}, {11, 12}}, + }, + }, + }, + want: [][]Value{{1, 2}, {11, 12}}, + }, + { + fetchResponses: map[string]fetchResponse{ + "": { + result: &fetchPageResult{ + pageToken: "", + rows: [][]Value{}, + }, + }, + }, + want: [][]Value{}, + }, + } + + for _, tc := range testCases { + pf := &pageFetcherStub{ + fetchResponses: tc.fetchResponses, + } + it := newRowIterator(context.Background(), nil, pf.fetchPage) + + values, _, _, err := consumeRowIterator(it) + if err != nil { + t.Fatal(err) + } + if (len(values) != 0 || len(tc.want) != 0) && !testutil.Equal(values, tc.want) { + t.Errorf("values: got:\n%v\nwant:\n%v", values, tc.want) + } + // Try calling Get again. + var vals []Value + if err := it.Next(&vals); err != iterator.Done { + t.Errorf("Expected Done calling Next when there are no more values") + } + } +} + +func TestIteratorNextTypes(t *testing.T) { + it := newRowIterator(context.Background(), nil, nil) + for _, v := range []interface{}{3, "s", []int{}, &[]int{}, + map[string]Value{}, &map[string]interface{}{}, + struct{}{}, + } { + if err := it.Next(v); err == nil { + t.Errorf("%v: want error, got nil", v) + } + } +} diff --git a/vendor/cloud.google.com/go/bigquery/job.go b/vendor/cloud.google.com/go/bigquery/job.go new file mode 100644 index 000000000..d98211d91 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/job.go @@ -0,0 +1,821 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "errors" + "fmt" + "time" + + "cloud.google.com/go/internal" + "cloud.google.com/go/internal/trace" + gax "github.com/googleapis/gax-go" + bq "google.golang.org/api/bigquery/v2" + "google.golang.org/api/googleapi" + "google.golang.org/api/iterator" +) + +// A Job represents an operation which has been submitted to BigQuery for processing. +type Job struct { + c *Client + projectID string + jobID string + location string + email string + config *bq.JobConfiguration + lastStatus *JobStatus +} + +// JobFromID creates a Job which refers to an existing BigQuery job. The job +// need not have been created by this package. For example, the job may have +// been created in the BigQuery console. +// +// For jobs whose location is other than "US" or "EU", set Client.Location or use +// JobFromIDLocation. +func (c *Client) JobFromID(ctx context.Context, id string) (*Job, error) { + return c.JobFromIDLocation(ctx, id, c.Location) +} + +// JobFromIDLocation creates a Job which refers to an existing BigQuery job. The job +// need not have been created by this package (for example, it may have +// been created in the BigQuery console), but it must exist in the specified location. +func (c *Client) JobFromIDLocation(ctx context.Context, id, location string) (j *Job, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.JobFromIDLocation") + defer func() { trace.EndSpan(ctx, err) }() + + bqjob, err := c.getJobInternal(ctx, id, location, "configuration", "jobReference", "status", "statistics") + if err != nil { + return nil, err + } + return bqToJob(bqjob, c) +} + +// ID returns the job's ID. +func (j *Job) ID() string { + return j.jobID +} + +// Location returns the job's location. +func (j *Job) Location() string { + return j.location +} + +// Email returns the email of the job's creator. +func (j *Job) Email() string { + return j.email +} + +// State is one of a sequence of states that a Job progresses through as it is processed. +type State int + +const ( + // StateUnspecified is the default JobIterator state. + StateUnspecified State = iota + // Pending is a state that describes that the job is pending. + Pending + // Running is a state that describes that the job is running. + Running + // Done is a state that describes that the job is done. + Done +) + +// JobStatus contains the current State of a job, and errors encountered while processing that job. +type JobStatus struct { + State State + + err error + + // All errors encountered during the running of the job. + // Not all Errors are fatal, so errors here do not necessarily mean that the job has completed or was unsuccessful. + Errors []*Error + + // Statistics about the job. + Statistics *JobStatistics +} + +// JobConfig contains configuration information for a job. It is implemented by +// *CopyConfig, *ExtractConfig, *LoadConfig and *QueryConfig. +type JobConfig interface { + isJobConfig() +} + +func (*CopyConfig) isJobConfig() {} +func (*ExtractConfig) isJobConfig() {} +func (*LoadConfig) isJobConfig() {} +func (*QueryConfig) isJobConfig() {} + +// Config returns the configuration information for j. +func (j *Job) Config() (JobConfig, error) { + return bqToJobConfig(j.config, j.c) +} + +func bqToJobConfig(q *bq.JobConfiguration, c *Client) (JobConfig, error) { + switch { + case q == nil: + return nil, nil + case q.Copy != nil: + return bqToCopyConfig(q, c), nil + case q.Extract != nil: + return bqToExtractConfig(q, c), nil + case q.Load != nil: + return bqToLoadConfig(q, c), nil + case q.Query != nil: + return bqToQueryConfig(q, c) + default: + return nil, nil + } +} + +// JobIDConfig describes how to create an ID for a job. +type JobIDConfig struct { + // JobID is the ID to use for the job. If empty, a random job ID will be generated. + JobID string + + // If AddJobIDSuffix is true, then a random string will be appended to JobID. + AddJobIDSuffix bool + + // Location is the location for the job. + Location string +} + +// createJobRef creates a JobReference. +func (j *JobIDConfig) createJobRef(c *Client) *bq.JobReference { + // We don't check whether projectID is empty; the server will return an + // error when it encounters the resulting JobReference. + loc := j.Location + if loc == "" { // Use Client.Location as a default. + loc = c.Location + } + jr := &bq.JobReference{ProjectId: c.projectID, Location: loc} + if j.JobID == "" { + jr.JobId = randomIDFn() + } else if j.AddJobIDSuffix { + jr.JobId = j.JobID + "-" + randomIDFn() + } else { + jr.JobId = j.JobID + } + return jr +} + +// Done reports whether the job has completed. +// After Done returns true, the Err method will return an error if the job completed unsuccessfully. +func (s *JobStatus) Done() bool { + return s.State == Done +} + +// Err returns the error that caused the job to complete unsuccessfully (if any). +func (s *JobStatus) Err() error { + return s.err +} + +// Status retrieves the current status of the job from BigQuery. It fails if the Status could not be determined. +func (j *Job) Status(ctx context.Context) (js *JobStatus, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Job.Status") + defer func() { trace.EndSpan(ctx, err) }() + + bqjob, err := j.c.getJobInternal(ctx, j.jobID, j.location, "status", "statistics") + if err != nil { + return nil, err + } + if err := j.setStatus(bqjob.Status); err != nil { + return nil, err + } + j.setStatistics(bqjob.Statistics, j.c) + return j.lastStatus, nil +} + +// LastStatus returns the most recently retrieved status of the job. The status is +// retrieved when a new job is created, or when JobFromID or Job.Status is called. +// Call Job.Status to get the most up-to-date information about a job. +func (j *Job) LastStatus() *JobStatus { + return j.lastStatus +} + +// Cancel requests that a job be cancelled. This method returns without waiting for +// cancellation to take effect. To check whether the job has terminated, use Job.Status. +// Cancelled jobs may still incur costs. +func (j *Job) Cancel(ctx context.Context) error { + // Jobs.Cancel returns a job entity, but the only relevant piece of + // data it may contain (the status of the job) is unreliable. From the + // docs: "This call will return immediately, and the client will need + // to poll for the job status to see if the cancel completed + // successfully". So it would be misleading to return a status. + call := j.c.bqs.Jobs.Cancel(j.projectID, j.jobID). + Location(j.location). + Fields(). // We don't need any of the response data. + Context(ctx) + setClientHeader(call.Header()) + return runWithRetry(ctx, func() error { + _, err := call.Do() + return err + }) +} + +// Wait blocks until the job or the context is done. It returns the final status +// of the job. +// If an error occurs while retrieving the status, Wait returns that error. But +// Wait returns nil if the status was retrieved successfully, even if +// status.Err() != nil. So callers must check both errors. See the example. +func (j *Job) Wait(ctx context.Context) (js *JobStatus, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Job.Wait") + defer func() { trace.EndSpan(ctx, err) }() + + if j.isQuery() { + // We can avoid polling for query jobs. + if _, _, err := j.waitForQuery(ctx, j.projectID); err != nil { + return nil, err + } + // Note: extra RPC even if you just want to wait for the query to finish. + js, err := j.Status(ctx) + if err != nil { + return nil, err + } + return js, nil + } + // Non-query jobs must poll. + err = internal.Retry(ctx, gax.Backoff{}, func() (stop bool, err error) { + js, err = j.Status(ctx) + if err != nil { + return true, err + } + if js.Done() { + return true, nil + } + return false, nil + }) + if err != nil { + return nil, err + } + return js, nil +} + +// Read fetches the results of a query job. +// If j is not a query job, Read returns an error. +func (j *Job) Read(ctx context.Context) (ri *RowIterator, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Job.Read") + defer func() { trace.EndSpan(ctx, err) }() + + return j.read(ctx, j.waitForQuery, fetchPage) +} + +func (j *Job) read(ctx context.Context, waitForQuery func(context.Context, string) (Schema, uint64, error), pf pageFetcher) (*RowIterator, error) { + if !j.isQuery() { + return nil, errors.New("bigquery: cannot read from a non-query job") + } + destTable := j.config.Query.DestinationTable + // The destination table should only be nil if there was a query error. + projectID := j.projectID + if destTable != nil && projectID != destTable.ProjectId { + return nil, fmt.Errorf("bigquery: job project ID is %q, but destination table's is %q", projectID, destTable.ProjectId) + } + schema, totalRows, err := waitForQuery(ctx, projectID) + if err != nil { + return nil, err + } + if destTable == nil { + return nil, errors.New("bigquery: query job missing destination table") + } + dt := bqToTable(destTable, j.c) + if totalRows == 0 { + pf = nil + } + it := newRowIterator(ctx, dt, pf) + it.Schema = schema + it.TotalRows = totalRows + return it, nil +} + +// waitForQuery waits for the query job to complete and returns its schema. It also +// returns the total number of rows in the result set. +func (j *Job) waitForQuery(ctx context.Context, projectID string) (Schema, uint64, error) { + // Use GetQueryResults only to wait for completion, not to read results. + call := j.c.bqs.Jobs.GetQueryResults(projectID, j.jobID).Location(j.location).Context(ctx).MaxResults(0) + setClientHeader(call.Header()) + backoff := gax.Backoff{ + Initial: 1 * time.Second, + Multiplier: 2, + Max: 60 * time.Second, + } + var res *bq.GetQueryResultsResponse + err := internal.Retry(ctx, backoff, func() (stop bool, err error) { + res, err = call.Do() + if err != nil { + return !retryableError(err), err + } + if !res.JobComplete { // GetQueryResults may return early without error; retry. + return false, nil + } + return true, nil + }) + if err != nil { + return nil, 0, err + } + return bqToSchema(res.Schema), res.TotalRows, nil +} + +// JobStatistics contains statistics about a job. +type JobStatistics struct { + CreationTime time.Time + StartTime time.Time + EndTime time.Time + TotalBytesProcessed int64 + + Details Statistics +} + +// Statistics is one of ExtractStatistics, LoadStatistics or QueryStatistics. +type Statistics interface { + implementsStatistics() +} + +// ExtractStatistics contains statistics about an extract job. +type ExtractStatistics struct { + // The number of files per destination URI or URI pattern specified in the + // extract configuration. These values will be in the same order as the + // URIs specified in the 'destinationUris' field. + DestinationURIFileCounts []int64 +} + +// LoadStatistics contains statistics about a load job. +type LoadStatistics struct { + // The number of bytes of source data in a load job. + InputFileBytes int64 + + // The number of source files in a load job. + InputFiles int64 + + // Size of the loaded data in bytes. Note that while a load job is in the + // running state, this value may change. + OutputBytes int64 + + // The number of rows imported in a load job. Note that while an import job is + // in the running state, this value may change. + OutputRows int64 +} + +// QueryStatistics contains statistics about a query job. +type QueryStatistics struct { + // Billing tier for the job. + BillingTier int64 + + // Whether the query result was fetched from the query cache. + CacheHit bool + + // The type of query statement, if valid. + StatementType string + + // Total bytes billed for the job. + TotalBytesBilled int64 + + // Total bytes processed for the job. + TotalBytesProcessed int64 + + // Describes execution plan for the query. + QueryPlan []*ExplainQueryStage + + // The number of rows affected by a DML statement. Present only for DML + // statements INSERT, UPDATE or DELETE. + NumDMLAffectedRows int64 + + // Describes a timeline of job execution. + Timeline []*QueryTimelineSample + + // ReferencedTables: [Output-only, Experimental] Referenced tables for + // the job. Queries that reference more than 50 tables will not have a + // complete list. + ReferencedTables []*Table + + // The schema of the results. Present only for successful dry run of + // non-legacy SQL queries. + Schema Schema + + // Slot-milliseconds consumed by this query job. + SlotMillis int64 + + // Standard SQL: list of undeclared query parameter names detected during a + // dry run validation. + UndeclaredQueryParameterNames []string + + // DDL target table. + DDLTargetTable *Table + + // DDL Operation performed on the target table. Used to report how the + // query impacted the DDL target table. + DDLOperationPerformed string +} + +// ExplainQueryStage describes one stage of a query. +type ExplainQueryStage struct { + // CompletedParallelInputs: Number of parallel input segments completed. + CompletedParallelInputs int64 + + // ComputeAvg: Duration the average shard spent on CPU-bound tasks. + ComputeAvg time.Duration + + // ComputeMax: Duration the slowest shard spent on CPU-bound tasks. + ComputeMax time.Duration + + // Relative amount of the total time the average shard spent on CPU-bound tasks. + ComputeRatioAvg float64 + + // Relative amount of the total time the slowest shard spent on CPU-bound tasks. + ComputeRatioMax float64 + + // EndTime: Stage end time. + EndTime time.Time + + // Unique ID for stage within plan. + ID int64 + + // InputStages: IDs for stages that are inputs to this stage. + InputStages []int64 + + // Human-readable name for stage. + Name string + + // ParallelInputs: Number of parallel input segments to be processed. + ParallelInputs int64 + + // ReadAvg: Duration the average shard spent reading input. + ReadAvg time.Duration + + // ReadMax: Duration the slowest shard spent reading input. + ReadMax time.Duration + + // Relative amount of the total time the average shard spent reading input. + ReadRatioAvg float64 + + // Relative amount of the total time the slowest shard spent reading input. + ReadRatioMax float64 + + // Number of records read into the stage. + RecordsRead int64 + + // Number of records written by the stage. + RecordsWritten int64 + + // ShuffleOutputBytes: Total number of bytes written to shuffle. + ShuffleOutputBytes int64 + + // ShuffleOutputBytesSpilled: Total number of bytes written to shuffle + // and spilled to disk. + ShuffleOutputBytesSpilled int64 + + // StartTime: Stage start time. + StartTime time.Time + + // Current status for the stage. + Status string + + // List of operations within the stage in dependency order (approximately + // chronological). + Steps []*ExplainQueryStep + + // WaitAvg: Duration the average shard spent waiting to be scheduled. + WaitAvg time.Duration + + // WaitMax: Duration the slowest shard spent waiting to be scheduled. + WaitMax time.Duration + + // Relative amount of the total time the average shard spent waiting to be scheduled. + WaitRatioAvg float64 + + // Relative amount of the total time the slowest shard spent waiting to be scheduled. + WaitRatioMax float64 + + // WriteAvg: Duration the average shard spent on writing output. + WriteAvg time.Duration + + // WriteMax: Duration the slowest shard spent on writing output. + WriteMax time.Duration + + // Relative amount of the total time the average shard spent on writing output. + WriteRatioAvg float64 + + // Relative amount of the total time the slowest shard spent on writing output. + WriteRatioMax float64 +} + +// ExplainQueryStep describes one step of a query stage. +type ExplainQueryStep struct { + // Machine-readable operation type. + Kind string + + // Human-readable stage descriptions. + Substeps []string +} + +// QueryTimelineSample represents a sample of execution statistics at a point in time. +type QueryTimelineSample struct { + + // Total number of units currently being processed by workers, represented as largest value since last sample. + ActiveUnits int64 + + // Total parallel units of work completed by this query. + CompletedUnits int64 + + // Time elapsed since start of query execution. + Elapsed time.Duration + + // Total parallel units of work remaining for the active stages. + PendingUnits int64 + + // Cumulative slot-milliseconds consumed by the query. + SlotMillis int64 +} + +func (*ExtractStatistics) implementsStatistics() {} +func (*LoadStatistics) implementsStatistics() {} +func (*QueryStatistics) implementsStatistics() {} + +// Jobs lists jobs within a project. +func (c *Client) Jobs(ctx context.Context) *JobIterator { + it := &JobIterator{ + ctx: ctx, + c: c, + ProjectID: c.projectID, + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +// JobIterator iterates over jobs in a project. +type JobIterator struct { + ProjectID string // Project ID of the jobs to list. Default is the client's project. + AllUsers bool // Whether to list jobs owned by all users in the project, or just the current caller. + State State // List only jobs in the given state. Defaults to all states. + MinCreationTime time.Time // List only jobs created after this time. + MaxCreationTime time.Time // List only jobs created before this time. + + ctx context.Context + c *Client + pageInfo *iterator.PageInfo + nextFunc func() error + items []*Job +} + +// PageInfo is a getter for the JobIterator's PageInfo. +func (it *JobIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next Job. Its second return value is iterator.Done if +// there are no more results. Once Next returns Done, all subsequent calls will +// return Done. +func (it *JobIterator) Next() (*Job, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *JobIterator) fetch(pageSize int, pageToken string) (string, error) { + var st string + switch it.State { + case StateUnspecified: + st = "" + case Pending: + st = "pending" + case Running: + st = "running" + case Done: + st = "done" + default: + return "", fmt.Errorf("bigquery: invalid value for JobIterator.State: %d", it.State) + } + + req := it.c.bqs.Jobs.List(it.ProjectID). + Context(it.ctx). + PageToken(pageToken). + Projection("full"). + AllUsers(it.AllUsers) + if st != "" { + req.StateFilter(st) + } + if !it.MinCreationTime.IsZero() { + req.MinCreationTime(uint64(it.MinCreationTime.UnixNano() / 1e6)) + } + if !it.MaxCreationTime.IsZero() { + req.MaxCreationTime(uint64(it.MaxCreationTime.UnixNano() / 1e6)) + } + setClientHeader(req.Header()) + if pageSize > 0 { + req.MaxResults(int64(pageSize)) + } + res, err := req.Do() + if err != nil { + return "", err + } + for _, j := range res.Jobs { + job, err := convertListedJob(j, it.c) + if err != nil { + return "", err + } + it.items = append(it.items, job) + } + return res.NextPageToken, nil +} + +func convertListedJob(j *bq.JobListJobs, c *Client) (*Job, error) { + return bqToJob2(j.JobReference, j.Configuration, j.Status, j.Statistics, j.UserEmail, c) +} + +func (c *Client) getJobInternal(ctx context.Context, jobID, location string, fields ...googleapi.Field) (*bq.Job, error) { + var job *bq.Job + call := c.bqs.Jobs.Get(c.projectID, jobID).Context(ctx) + if location != "" { + call = call.Location(location) + } + if len(fields) > 0 { + call = call.Fields(fields...) + } + setClientHeader(call.Header()) + err := runWithRetry(ctx, func() (err error) { + job, err = call.Do() + return err + }) + if err != nil { + return nil, err + } + return job, nil +} + +func bqToJob(q *bq.Job, c *Client) (*Job, error) { + return bqToJob2(q.JobReference, q.Configuration, q.Status, q.Statistics, q.UserEmail, c) +} + +func bqToJob2(qr *bq.JobReference, qc *bq.JobConfiguration, qs *bq.JobStatus, qt *bq.JobStatistics, email string, c *Client) (*Job, error) { + j := &Job{ + projectID: qr.ProjectId, + jobID: qr.JobId, + location: qr.Location, + c: c, + email: email, + } + j.setConfig(qc) + if err := j.setStatus(qs); err != nil { + return nil, err + } + j.setStatistics(qt, c) + return j, nil +} + +func (j *Job) setConfig(config *bq.JobConfiguration) { + if config == nil { + return + } + j.config = config +} + +func (j *Job) isQuery() bool { + return j.config != nil && j.config.Query != nil +} + +var stateMap = map[string]State{"PENDING": Pending, "RUNNING": Running, "DONE": Done} + +func (j *Job) setStatus(qs *bq.JobStatus) error { + if qs == nil { + return nil + } + state, ok := stateMap[qs.State] + if !ok { + return fmt.Errorf("unexpected job state: %v", qs.State) + } + j.lastStatus = &JobStatus{ + State: state, + err: nil, + } + if err := bqToError(qs.ErrorResult); state == Done && err != nil { + j.lastStatus.err = err + } + for _, ep := range qs.Errors { + j.lastStatus.Errors = append(j.lastStatus.Errors, bqToError(ep)) + } + return nil +} + +func (j *Job) setStatistics(s *bq.JobStatistics, c *Client) { + if s == nil || j.lastStatus == nil { + return + } + js := &JobStatistics{ + CreationTime: unixMillisToTime(s.CreationTime), + StartTime: unixMillisToTime(s.StartTime), + EndTime: unixMillisToTime(s.EndTime), + TotalBytesProcessed: s.TotalBytesProcessed, + } + switch { + case s.Extract != nil: + js.Details = &ExtractStatistics{ + DestinationURIFileCounts: []int64(s.Extract.DestinationUriFileCounts), + } + case s.Load != nil: + js.Details = &LoadStatistics{ + InputFileBytes: s.Load.InputFileBytes, + InputFiles: s.Load.InputFiles, + OutputBytes: s.Load.OutputBytes, + OutputRows: s.Load.OutputRows, + } + case s.Query != nil: + var names []string + for _, qp := range s.Query.UndeclaredQueryParameters { + names = append(names, qp.Name) + } + var tables []*Table + for _, tr := range s.Query.ReferencedTables { + tables = append(tables, bqToTable(tr, c)) + } + js.Details = &QueryStatistics{ + BillingTier: s.Query.BillingTier, + CacheHit: s.Query.CacheHit, + DDLTargetTable: bqToTable(s.Query.DdlTargetTable, c), + DDLOperationPerformed: s.Query.DdlOperationPerformed, + StatementType: s.Query.StatementType, + TotalBytesBilled: s.Query.TotalBytesBilled, + TotalBytesProcessed: s.Query.TotalBytesProcessed, + NumDMLAffectedRows: s.Query.NumDmlAffectedRows, + QueryPlan: queryPlanFromProto(s.Query.QueryPlan), + Schema: bqToSchema(s.Query.Schema), + SlotMillis: s.Query.TotalSlotMs, + Timeline: timelineFromProto(s.Query.Timeline), + ReferencedTables: tables, + UndeclaredQueryParameterNames: names, + } + } + j.lastStatus.Statistics = js +} + +func queryPlanFromProto(stages []*bq.ExplainQueryStage) []*ExplainQueryStage { + var res []*ExplainQueryStage + for _, s := range stages { + var steps []*ExplainQueryStep + for _, p := range s.Steps { + steps = append(steps, &ExplainQueryStep{ + Kind: p.Kind, + Substeps: p.Substeps, + }) + } + res = append(res, &ExplainQueryStage{ + CompletedParallelInputs: s.CompletedParallelInputs, + ComputeAvg: time.Duration(s.ComputeMsAvg) * time.Millisecond, + ComputeMax: time.Duration(s.ComputeMsMax) * time.Millisecond, + ComputeRatioAvg: s.ComputeRatioAvg, + ComputeRatioMax: s.ComputeRatioMax, + EndTime: time.Unix(0, s.EndMs*1e6), + ID: s.Id, + InputStages: s.InputStages, + Name: s.Name, + ParallelInputs: s.ParallelInputs, + ReadAvg: time.Duration(s.ReadMsAvg) * time.Millisecond, + ReadMax: time.Duration(s.ReadMsMax) * time.Millisecond, + ReadRatioAvg: s.ReadRatioAvg, + ReadRatioMax: s.ReadRatioMax, + RecordsRead: s.RecordsRead, + RecordsWritten: s.RecordsWritten, + ShuffleOutputBytes: s.ShuffleOutputBytes, + ShuffleOutputBytesSpilled: s.ShuffleOutputBytesSpilled, + StartTime: time.Unix(0, s.StartMs*1e6), + Status: s.Status, + Steps: steps, + WaitAvg: time.Duration(s.WaitMsAvg) * time.Millisecond, + WaitMax: time.Duration(s.WaitMsMax) * time.Millisecond, + WaitRatioAvg: s.WaitRatioAvg, + WaitRatioMax: s.WaitRatioMax, + WriteAvg: time.Duration(s.WriteMsAvg) * time.Millisecond, + WriteMax: time.Duration(s.WriteMsMax) * time.Millisecond, + WriteRatioAvg: s.WriteRatioAvg, + WriteRatioMax: s.WriteRatioMax, + }) + } + return res +} + +func timelineFromProto(timeline []*bq.QueryTimelineSample) []*QueryTimelineSample { + var res []*QueryTimelineSample + for _, s := range timeline { + res = append(res, &QueryTimelineSample{ + ActiveUnits: s.ActiveUnits, + CompletedUnits: s.CompletedUnits, + Elapsed: time.Duration(s.ElapsedMs) * time.Millisecond, + PendingUnits: s.PendingUnits, + SlotMillis: s.TotalSlotMs, + }) + } + return res +} diff --git a/vendor/cloud.google.com/go/bigquery/job_test.go b/vendor/cloud.google.com/go/bigquery/job_test.go new file mode 100644 index 000000000..fbde305a8 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/job_test.go @@ -0,0 +1,95 @@ +// Copyright 2017 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 bigquery + +import ( + "testing" + + "cloud.google.com/go/internal/testutil" + bq "google.golang.org/api/bigquery/v2" +) + +func TestCreateJobRef(t *testing.T) { + defer fixRandomID("RANDOM")() + cNoLoc := &Client{projectID: "projectID"} + cLoc := &Client{projectID: "projectID", Location: "defaultLoc"} + for _, test := range []struct { + in JobIDConfig + client *Client + want *bq.JobReference + }{ + { + in: JobIDConfig{JobID: "foo"}, + want: &bq.JobReference{JobId: "foo"}, + }, + { + in: JobIDConfig{}, + want: &bq.JobReference{JobId: "RANDOM"}, + }, + { + in: JobIDConfig{AddJobIDSuffix: true}, + want: &bq.JobReference{JobId: "RANDOM"}, + }, + { + in: JobIDConfig{JobID: "foo", AddJobIDSuffix: true}, + want: &bq.JobReference{JobId: "foo-RANDOM"}, + }, + { + in: JobIDConfig{JobID: "foo", Location: "loc"}, + want: &bq.JobReference{JobId: "foo", Location: "loc"}, + }, + { + in: JobIDConfig{JobID: "foo"}, + client: cLoc, + want: &bq.JobReference{JobId: "foo", Location: "defaultLoc"}, + }, + { + in: JobIDConfig{JobID: "foo", Location: "loc"}, + client: cLoc, + want: &bq.JobReference{JobId: "foo", Location: "loc"}, + }, + } { + client := test.client + if client == nil { + client = cNoLoc + } + got := test.in.createJobRef(client) + test.want.ProjectId = "projectID" + if !testutil.Equal(got, test.want) { + t.Errorf("%+v: got %+v, want %+v", test.in, got, test.want) + } + } +} + +func fixRandomID(s string) func() { + prev := randomIDFn + randomIDFn = func() string { return s } + return func() { randomIDFn = prev } +} + +func checkJob(t *testing.T, i int, got, want *bq.Job) { + if got.JobReference == nil { + t.Errorf("#%d: empty job reference", i) + return + } + if got.JobReference.JobId == "" { + t.Errorf("#%d: empty job ID", i) + return + } + d := testutil.Diff(got, want) + if d != "" { + t.Errorf("#%d: (got=-, want=+) %s", i, d) + } +} diff --git a/vendor/cloud.google.com/go/bigquery/load.go b/vendor/cloud.google.com/go/bigquery/load.go new file mode 100644 index 000000000..1cbcc84ae --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/load.go @@ -0,0 +1,146 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bigquery + +import ( + "context" + "io" + + "cloud.google.com/go/internal/trace" + bq "google.golang.org/api/bigquery/v2" +) + +// LoadConfig holds the configuration for a load job. +type LoadConfig struct { + // Src is the source from which data will be loaded. + Src LoadSource + + // Dst is the table into which the data will be loaded. + Dst *Table + + // CreateDisposition specifies the circumstances under which the destination table will be created. + // The default is CreateIfNeeded. + CreateDisposition TableCreateDisposition + + // WriteDisposition specifies how existing data in the destination table is treated. + // The default is WriteAppend. + WriteDisposition TableWriteDisposition + + // The labels associated with this job. + Labels map[string]string + + // If non-nil, the destination table is partitioned by time. + TimePartitioning *TimePartitioning + + // Clustering specifies the data clustering configuration for the destination table. + Clustering *Clustering + + // Custom encryption configuration (e.g., Cloud KMS keys). + DestinationEncryptionConfig *EncryptionConfig + + // Allows the schema of the destination table to be updated as a side effect of + // the load job. + SchemaUpdateOptions []string +} + +func (l *LoadConfig) toBQ() (*bq.JobConfiguration, io.Reader) { + config := &bq.JobConfiguration{ + Labels: l.Labels, + Load: &bq.JobConfigurationLoad{ + CreateDisposition: string(l.CreateDisposition), + WriteDisposition: string(l.WriteDisposition), + DestinationTable: l.Dst.toBQ(), + TimePartitioning: l.TimePartitioning.toBQ(), + Clustering: l.Clustering.toBQ(), + DestinationEncryptionConfiguration: l.DestinationEncryptionConfig.toBQ(), + SchemaUpdateOptions: l.SchemaUpdateOptions, + }, + } + media := l.Src.populateLoadConfig(config.Load) + return config, media +} + +func bqToLoadConfig(q *bq.JobConfiguration, c *Client) *LoadConfig { + lc := &LoadConfig{ + Labels: q.Labels, + CreateDisposition: TableCreateDisposition(q.Load.CreateDisposition), + WriteDisposition: TableWriteDisposition(q.Load.WriteDisposition), + Dst: bqToTable(q.Load.DestinationTable, c), + TimePartitioning: bqToTimePartitioning(q.Load.TimePartitioning), + Clustering: bqToClustering(q.Load.Clustering), + DestinationEncryptionConfig: bqToEncryptionConfig(q.Load.DestinationEncryptionConfiguration), + SchemaUpdateOptions: q.Load.SchemaUpdateOptions, + } + var fc *FileConfig + if len(q.Load.SourceUris) == 0 { + s := NewReaderSource(nil) + fc = &s.FileConfig + lc.Src = s + } else { + s := NewGCSReference(q.Load.SourceUris...) + fc = &s.FileConfig + lc.Src = s + } + bqPopulateFileConfig(q.Load, fc) + return lc +} + +// A Loader loads data from Google Cloud Storage into a BigQuery table. +type Loader struct { + JobIDConfig + LoadConfig + c *Client +} + +// A LoadSource represents a source of data that can be loaded into +// a BigQuery table. +// +// This package defines two LoadSources: GCSReference, for Google Cloud Storage +// objects, and ReaderSource, for data read from an io.Reader. +type LoadSource interface { + // populates config, returns media + populateLoadConfig(*bq.JobConfigurationLoad) io.Reader +} + +// LoaderFrom returns a Loader which can be used to load data into a BigQuery table. +// The returned Loader may optionally be further configured before its Run method is called. +// See GCSReference and ReaderSource for additional configuration options that +// affect loading. +func (t *Table) LoaderFrom(src LoadSource) *Loader { + return &Loader{ + c: t.c, + LoadConfig: LoadConfig{ + Src: src, + Dst: t, + }, + } +} + +// Run initiates a load job. +func (l *Loader) Run(ctx context.Context) (j *Job, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Load.Run") + defer func() { trace.EndSpan(ctx, err) }() + + job, media := l.newJob() + return l.c.insertJob(ctx, job, media) +} + +func (l *Loader) newJob() (*bq.Job, io.Reader) { + config, media := l.LoadConfig.toBQ() + return &bq.Job{ + JobReference: l.JobIDConfig.createJobRef(l.c), + Configuration: config, + }, media +} diff --git a/vendor/cloud.google.com/go/bigquery/load_test.go b/vendor/cloud.google.com/go/bigquery/load_test.go new file mode 100644 index 000000000..e2af9d076 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/load_test.go @@ -0,0 +1,263 @@ +// Copyright 2015 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 bigquery + +import ( + "strings" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + bq "google.golang.org/api/bigquery/v2" +) + +func defaultLoadJob() *bq.Job { + return &bq.Job{ + JobReference: &bq.JobReference{JobId: "RANDOM", ProjectId: "client-project-id"}, + Configuration: &bq.JobConfiguration{ + Load: &bq.JobConfigurationLoad{ + DestinationTable: &bq.TableReference{ + ProjectId: "client-project-id", + DatasetId: "dataset-id", + TableId: "table-id", + }, + SourceUris: []string{"uri"}, + }, + }, + } +} + +func stringFieldSchema() *FieldSchema { + return &FieldSchema{Name: "fieldname", Type: StringFieldType} +} + +func nestedFieldSchema() *FieldSchema { + return &FieldSchema{ + Name: "nested", + Type: RecordFieldType, + Schema: Schema{stringFieldSchema()}, + } +} + +func bqStringFieldSchema() *bq.TableFieldSchema { + return &bq.TableFieldSchema{ + Name: "fieldname", + Type: "STRING", + } +} + +func bqNestedFieldSchema() *bq.TableFieldSchema { + return &bq.TableFieldSchema{ + Name: "nested", + Type: "RECORD", + Fields: []*bq.TableFieldSchema{bqStringFieldSchema()}, + } +} + +func TestLoad(t *testing.T) { + defer fixRandomID("RANDOM")() + c := &Client{projectID: "client-project-id"} + + testCases := []struct { + dst *Table + src LoadSource + jobID string + location string + config LoadConfig + want *bq.Job + }{ + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: NewGCSReference("uri"), + want: defaultLoadJob(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: NewGCSReference("uri"), + location: "loc", + want: func() *bq.Job { + j := defaultLoadJob() + j.JobReference.Location = "loc" + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + jobID: "ajob", + config: LoadConfig{ + CreateDisposition: CreateNever, + WriteDisposition: WriteTruncate, + Labels: map[string]string{"a": "b"}, + TimePartitioning: &TimePartitioning{Expiration: 1234 * time.Millisecond}, + Clustering: &Clustering{Fields: []string{"cfield1"}}, + DestinationEncryptionConfig: &EncryptionConfig{KMSKeyName: "keyName"}, + SchemaUpdateOptions: []string{"ALLOW_FIELD_ADDITION"}, + }, + src: NewGCSReference("uri"), + want: func() *bq.Job { + j := defaultLoadJob() + j.Configuration.Labels = map[string]string{"a": "b"} + j.Configuration.Load.CreateDisposition = "CREATE_NEVER" + j.Configuration.Load.WriteDisposition = "WRITE_TRUNCATE" + j.Configuration.Load.TimePartitioning = &bq.TimePartitioning{ + Type: "DAY", + ExpirationMs: 1234, + } + j.Configuration.Load.Clustering = &bq.Clustering{ + Fields: []string{"cfield1"}, + } + j.Configuration.Load.DestinationEncryptionConfiguration = &bq.EncryptionConfiguration{KmsKeyName: "keyName"} + j.JobReference = &bq.JobReference{ + JobId: "ajob", + ProjectId: "client-project-id", + } + j.Configuration.Load.SchemaUpdateOptions = []string{"ALLOW_FIELD_ADDITION"} + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: func() *GCSReference { + g := NewGCSReference("uri") + g.MaxBadRecords = 1 + g.AllowJaggedRows = true + g.AllowQuotedNewlines = true + g.IgnoreUnknownValues = true + return g + }(), + want: func() *bq.Job { + j := defaultLoadJob() + j.Configuration.Load.MaxBadRecords = 1 + j.Configuration.Load.AllowJaggedRows = true + j.Configuration.Load.AllowQuotedNewlines = true + j.Configuration.Load.IgnoreUnknownValues = true + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: func() *GCSReference { + g := NewGCSReference("uri") + g.Schema = Schema{ + stringFieldSchema(), + nestedFieldSchema(), + } + return g + }(), + want: func() *bq.Job { + j := defaultLoadJob() + j.Configuration.Load.Schema = &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqStringFieldSchema(), + bqNestedFieldSchema(), + }} + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: func() *GCSReference { + g := NewGCSReference("uri") + g.SkipLeadingRows = 1 + g.SourceFormat = JSON + g.Encoding = UTF_8 + g.FieldDelimiter = "\t" + g.Quote = "-" + return g + }(), + want: func() *bq.Job { + j := defaultLoadJob() + j.Configuration.Load.SkipLeadingRows = 1 + j.Configuration.Load.SourceFormat = "NEWLINE_DELIMITED_JSON" + j.Configuration.Load.Encoding = "UTF-8" + j.Configuration.Load.FieldDelimiter = "\t" + hyphen := "-" + j.Configuration.Load.Quote = &hyphen + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: NewGCSReference("uri"), + want: func() *bq.Job { + j := defaultLoadJob() + // Quote is left unset in GCSReference, so should be nil here. + j.Configuration.Load.Quote = nil + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: func() *GCSReference { + g := NewGCSReference("uri") + g.ForceZeroQuote = true + return g + }(), + want: func() *bq.Job { + j := defaultLoadJob() + empty := "" + j.Configuration.Load.Quote = &empty + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: func() *ReaderSource { + r := NewReaderSource(strings.NewReader("foo")) + r.SkipLeadingRows = 1 + r.SourceFormat = JSON + r.Encoding = UTF_8 + r.FieldDelimiter = "\t" + r.Quote = "-" + return r + }(), + want: func() *bq.Job { + j := defaultLoadJob() + j.Configuration.Load.SourceUris = nil + j.Configuration.Load.SkipLeadingRows = 1 + j.Configuration.Load.SourceFormat = "NEWLINE_DELIMITED_JSON" + j.Configuration.Load.Encoding = "UTF-8" + j.Configuration.Load.FieldDelimiter = "\t" + hyphen := "-" + j.Configuration.Load.Quote = &hyphen + return j + }(), + }, + } + + for i, tc := range testCases { + loader := tc.dst.LoaderFrom(tc.src) + loader.JobID = tc.jobID + loader.Location = tc.location + tc.config.Src = tc.src + tc.config.Dst = tc.dst + loader.LoadConfig = tc.config + got, _ := loader.newJob() + checkJob(t, i, got, tc.want) + + jc, err := bqToJobConfig(got.Configuration, c) + if err != nil { + t.Fatalf("#%d: %v", i, err) + } + diff := testutil.Diff(jc.(*LoadConfig), &loader.LoadConfig, + cmp.AllowUnexported(Table{}, Client{}), + cmpopts.IgnoreUnexported(ReaderSource{})) + if diff != "" { + t.Errorf("#%d: (got=-, want=+:\n%s", i, diff) + } + } +} diff --git a/vendor/cloud.google.com/go/bigquery/nulls.go b/vendor/cloud.google.com/go/bigquery/nulls.go new file mode 100644 index 000000000..5b4fbd960 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/nulls.go @@ -0,0 +1,320 @@ +// Copyright 2015 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 bigquery + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strconv" + "time" + + "cloud.google.com/go/civil" +) + +// NullInt64 represents a BigQuery INT64 that may be NULL. +type NullInt64 struct { + Int64 int64 + Valid bool // Valid is true if Int64 is not NULL. +} + +func (n NullInt64) String() string { return nullstr(n.Valid, n.Int64) } + +// NullString represents a BigQuery STRING that may be NULL. +type NullString struct { + StringVal string + Valid bool // Valid is true if StringVal is not NULL. +} + +func (n NullString) String() string { return nullstr(n.Valid, n.StringVal) } + +// NullFloat64 represents a BigQuery FLOAT64 that may be NULL. +type NullFloat64 struct { + Float64 float64 + Valid bool // Valid is true if Float64 is not NULL. +} + +func (n NullFloat64) String() string { return nullstr(n.Valid, n.Float64) } + +// NullBool represents a BigQuery BOOL that may be NULL. +type NullBool struct { + Bool bool + Valid bool // Valid is true if Bool is not NULL. +} + +func (n NullBool) String() string { return nullstr(n.Valid, n.Bool) } + +// NullTimestamp represents a BigQuery TIMESTAMP that may be null. +type NullTimestamp struct { + Timestamp time.Time + Valid bool // Valid is true if Time is not NULL. +} + +func (n NullTimestamp) String() string { return nullstr(n.Valid, n.Timestamp) } + +// NullDate represents a BigQuery DATE that may be null. +type NullDate struct { + Date civil.Date + Valid bool // Valid is true if Date is not NULL. +} + +func (n NullDate) String() string { return nullstr(n.Valid, n.Date) } + +// NullTime represents a BigQuery TIME that may be null. +type NullTime struct { + Time civil.Time + Valid bool // Valid is true if Time is not NULL. +} + +func (n NullTime) String() string { + if !n.Valid { + return "" + } + return CivilTimeString(n.Time) +} + +// NullDateTime represents a BigQuery DATETIME that may be null. +type NullDateTime struct { + DateTime civil.DateTime + Valid bool // Valid is true if DateTime is not NULL. +} + +func (n NullDateTime) String() string { + if !n.Valid { + return "" + } + return CivilDateTimeString(n.DateTime) +} + +// MarshalJSON converts the NullInt64 to JSON. +func (n NullInt64) MarshalJSON() ([]byte, error) { return nulljson(n.Valid, n.Int64) } + +// MarshalJSON converts the NullFloat64 to JSON. +func (n NullFloat64) MarshalJSON() ([]byte, error) { return nulljson(n.Valid, n.Float64) } + +// MarshalJSON converts the NullBool to JSON. +func (n NullBool) MarshalJSON() ([]byte, error) { return nulljson(n.Valid, n.Bool) } + +// MarshalJSON converts the NullString to JSON. +func (n NullString) MarshalJSON() ([]byte, error) { return nulljson(n.Valid, n.StringVal) } + +// MarshalJSON converts the NullTimestamp to JSON. +func (n NullTimestamp) MarshalJSON() ([]byte, error) { return nulljson(n.Valid, n.Timestamp) } + +// MarshalJSON converts the NullDate to JSON. +func (n NullDate) MarshalJSON() ([]byte, error) { return nulljson(n.Valid, n.Date) } + +// MarshalJSON converts the NullTime to JSON. +func (n NullTime) MarshalJSON() ([]byte, error) { + if !n.Valid { + return jsonNull, nil + } + return []byte(`"` + CivilTimeString(n.Time) + `"`), nil +} + +// MarshalJSON converts the NullDateTime to JSON. +func (n NullDateTime) MarshalJSON() ([]byte, error) { + if !n.Valid { + return jsonNull, nil + } + return []byte(`"` + CivilDateTimeString(n.DateTime) + `"`), nil +} + +func nullstr(valid bool, v interface{}) string { + if !valid { + return "NULL" + } + return fmt.Sprint(v) +} + +var jsonNull = []byte("null") + +func nulljson(valid bool, v interface{}) ([]byte, error) { + if !valid { + return jsonNull, nil + } + return json.Marshal(v) +} + +// UnmarshalJSON converts JSON into a NullInt64. +func (n *NullInt64) UnmarshalJSON(b []byte) error { + n.Valid = false + n.Int64 = 0 + if bytes.Equal(b, jsonNull) { + return nil + } + + if err := json.Unmarshal(b, &n.Int64); err != nil { + return err + } + n.Valid = true + return nil +} + +// UnmarshalJSON converts JSON into a NullFloat64. +func (n *NullFloat64) UnmarshalJSON(b []byte) error { + n.Valid = false + n.Float64 = 0 + if bytes.Equal(b, jsonNull) { + return nil + } + + if err := json.Unmarshal(b, &n.Float64); err != nil { + return err + } + n.Valid = true + return nil +} + +// UnmarshalJSON converts JSON into a NullBool. +func (n *NullBool) UnmarshalJSON(b []byte) error { + n.Valid = false + n.Bool = false + if bytes.Equal(b, jsonNull) { + return nil + } + + if err := json.Unmarshal(b, &n.Bool); err != nil { + return err + } + n.Valid = true + return nil +} + +// UnmarshalJSON converts JSON into a NullString. +func (n *NullString) UnmarshalJSON(b []byte) error { + n.Valid = false + n.StringVal = "" + if bytes.Equal(b, jsonNull) { + return nil + } + + if err := json.Unmarshal(b, &n.StringVal); err != nil { + return err + } + n.Valid = true + return nil +} + +// UnmarshalJSON converts JSON into a NullTimestamp. +func (n *NullTimestamp) UnmarshalJSON(b []byte) error { + n.Valid = false + n.Timestamp = time.Time{} + if bytes.Equal(b, jsonNull) { + return nil + } + + if err := json.Unmarshal(b, &n.Timestamp); err != nil { + return err + } + n.Valid = true + return nil +} + +// UnmarshalJSON converts JSON into a NullDate. +func (n *NullDate) UnmarshalJSON(b []byte) error { + n.Valid = false + n.Date = civil.Date{} + if bytes.Equal(b, jsonNull) { + return nil + } + + if err := json.Unmarshal(b, &n.Date); err != nil { + return err + } + n.Valid = true + return nil +} + +// UnmarshalJSON converts JSON into a NullTime. +func (n *NullTime) UnmarshalJSON(b []byte) error { + n.Valid = false + n.Time = civil.Time{} + if bytes.Equal(b, jsonNull) { + return nil + } + + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + + t, err := civil.ParseTime(s) + if err != nil { + return err + } + n.Time = t + + n.Valid = true + return nil +} + +// UnmarshalJSON converts JSON into a NullDateTime. +func (n *NullDateTime) UnmarshalJSON(b []byte) error { + n.Valid = false + n.DateTime = civil.DateTime{} + if bytes.Equal(b, jsonNull) { + return nil + } + + s, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + + dt, err := parseCivilDateTime(s) + if err != nil { + return err + } + n.DateTime = dt + + n.Valid = true + return nil +} + +var ( + typeOfNullInt64 = reflect.TypeOf(NullInt64{}) + typeOfNullFloat64 = reflect.TypeOf(NullFloat64{}) + typeOfNullBool = reflect.TypeOf(NullBool{}) + typeOfNullString = reflect.TypeOf(NullString{}) + typeOfNullTimestamp = reflect.TypeOf(NullTimestamp{}) + typeOfNullDate = reflect.TypeOf(NullDate{}) + typeOfNullTime = reflect.TypeOf(NullTime{}) + typeOfNullDateTime = reflect.TypeOf(NullDateTime{}) +) + +func nullableFieldType(t reflect.Type) FieldType { + switch t { + case typeOfNullInt64: + return IntegerFieldType + case typeOfNullFloat64: + return FloatFieldType + case typeOfNullBool: + return BooleanFieldType + case typeOfNullString: + return StringFieldType + case typeOfNullTimestamp: + return TimestampFieldType + case typeOfNullDate: + return DateFieldType + case typeOfNullTime: + return TimeFieldType + case typeOfNullDateTime: + return DateTimeFieldType + default: + return "" + } +} diff --git a/vendor/cloud.google.com/go/bigquery/nulls_test.go b/vendor/cloud.google.com/go/bigquery/nulls_test.go new file mode 100644 index 000000000..144e8e0e0 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/nulls_test.go @@ -0,0 +1,73 @@ +// Copyright 2015 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 bigquery + +import ( + "encoding/json" + "reflect" + "testing" + + "cloud.google.com/go/civil" + "cloud.google.com/go/internal/testutil" +) + +var ( + nullsTestTime = civil.Time{Hour: 7, Minute: 50, Second: 22, Nanosecond: 1000} + nullsTestDateTime = civil.DateTime{Date: civil.Date{Year: 2016, Month: 11, Day: 5}, Time: nullsTestTime} +) + +func TestNullsJSON(t *testing.T) { + for _, test := range []struct { + in interface{} + want string + }{ + {&NullInt64{Valid: true, Int64: 3}, `3`}, + {&NullFloat64{Valid: true, Float64: 3.14}, `3.14`}, + {&NullBool{Valid: true, Bool: true}, `true`}, + {&NullString{Valid: true, StringVal: "foo"}, `"foo"`}, + {&NullTimestamp{Valid: true, Timestamp: testTimestamp}, `"2016-11-05T07:50:22.000000008Z"`}, + {&NullDate{Valid: true, Date: testDate}, `"2016-11-05"`}, + {&NullTime{Valid: true, Time: nullsTestTime}, `"07:50:22.000001"`}, + {&NullDateTime{Valid: true, DateTime: nullsTestDateTime}, `"2016-11-05 07:50:22.000001"`}, + + {&NullInt64{}, `null`}, + {&NullFloat64{}, `null`}, + {&NullBool{}, `null`}, + {&NullString{}, `null`}, + {&NullTimestamp{}, `null`}, + {&NullDate{}, `null`}, + {&NullTime{}, `null`}, + {&NullDateTime{}, `null`}, + } { + bytes, err := json.Marshal(test.in) + if err != nil { + t.Fatal(err) + } + if got, want := string(bytes), test.want; got != want { + t.Errorf("%#v: got %s, want %s", test.in, got, want) + } + + typ := reflect.Indirect(reflect.ValueOf(test.in)).Type() + value := reflect.New(typ).Interface() + err = json.Unmarshal(bytes, value) + if err != nil { + t.Fatal(err) + } + + if !testutil.Equal(value, test.in) { + t.Errorf("%#v: got %#v, want %#v", test.in, value, test.in) + } + } +} diff --git a/vendor/cloud.google.com/go/bigquery/oc_test.go b/vendor/cloud.google.com/go/bigquery/oc_test.go new file mode 100644 index 000000000..de85173f4 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/oc_test.go @@ -0,0 +1,38 @@ +// 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. + +package bigquery + +import ( + "context" + "testing" + + "cloud.google.com/go/internal/testutil" +) + +func TestOCTracing(t *testing.T) { + ctx := context.Background() + client := getClient(t) + defer client.Close() + + te := testutil.NewTestExporter() + defer te.Unregister() + + q := client.Query("select *") + q.Run(ctx) // Doesn't matter if we get an error; span should be created either way + + if len(te.Spans) == 0 { + t.Fatalf("Expected some spans to be created, but got %d", 0) + } +} diff --git a/vendor/cloud.google.com/go/bigquery/params.go b/vendor/cloud.google.com/go/bigquery/params.go new file mode 100644 index 000000000..fb79947ab --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/params.go @@ -0,0 +1,356 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bigquery + +import ( + "encoding/base64" + "errors" + "fmt" + "math/big" + "reflect" + "regexp" + "time" + + "cloud.google.com/go/civil" + "cloud.google.com/go/internal/fields" + bq "google.golang.org/api/bigquery/v2" +) + +var ( + // See https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#timestamp-type. + timestampFormat = "2006-01-02 15:04:05.999999-07:00" + + // See https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#schema.fields.name + validFieldName = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]{0,127}$") +) + +const nullableTagOption = "nullable" + +func bqTagParser(t reflect.StructTag) (name string, keep bool, other interface{}, err error) { + name, keep, opts, err := fields.ParseStandardTag("bigquery", t) + if err != nil { + return "", false, nil, err + } + if name != "" && !validFieldName.MatchString(name) { + return "", false, nil, errInvalidFieldName + } + for _, opt := range opts { + if opt != nullableTagOption { + return "", false, nil, fmt.Errorf( + "bigquery: invalid tag option %q. The only valid option is %q", + opt, nullableTagOption) + } + } + return name, keep, opts, nil +} + +var fieldCache = fields.NewCache(bqTagParser, nil, nil) + +var ( + int64ParamType = &bq.QueryParameterType{Type: "INT64"} + float64ParamType = &bq.QueryParameterType{Type: "FLOAT64"} + boolParamType = &bq.QueryParameterType{Type: "BOOL"} + stringParamType = &bq.QueryParameterType{Type: "STRING"} + bytesParamType = &bq.QueryParameterType{Type: "BYTES"} + dateParamType = &bq.QueryParameterType{Type: "DATE"} + timeParamType = &bq.QueryParameterType{Type: "TIME"} + dateTimeParamType = &bq.QueryParameterType{Type: "DATETIME"} + timestampParamType = &bq.QueryParameterType{Type: "TIMESTAMP"} + numericParamType = &bq.QueryParameterType{Type: "NUMERIC"} +) + +var ( + typeOfDate = reflect.TypeOf(civil.Date{}) + typeOfTime = reflect.TypeOf(civil.Time{}) + typeOfDateTime = reflect.TypeOf(civil.DateTime{}) + typeOfGoTime = reflect.TypeOf(time.Time{}) + typeOfRat = reflect.TypeOf(&big.Rat{}) +) + +// A QueryParameter is a parameter to a query. +type QueryParameter struct { + // Name is used for named parameter mode. + // It must match the name in the query case-insensitively. + Name string + + // Value is the value of the parameter. + // + // When you create a QueryParameter to send to BigQuery, the following Go types + // are supported, with their corresponding Bigquery types: + // int, int8, int16, int32, int64, uint8, uint16, uint32: INT64 + // Note that uint, uint64 and uintptr are not supported, because + // they may contain values that cannot fit into a 64-bit signed integer. + // float32, float64: FLOAT64 + // bool: BOOL + // string: STRING + // []byte: BYTES + // time.Time: TIMESTAMP + // *big.Rat: NUMERIC + // Arrays and slices of the above. + // Structs of the above. Only the exported fields are used. + // + // When a QueryParameter is returned inside a QueryConfig from a call to + // Job.Config: + // Integers are of type int64. + // Floating-point values are of type float64. + // Arrays are of type []interface{}, regardless of the array element type. + // Structs are of type map[string]interface{}. + Value interface{} +} + +func (p QueryParameter) toBQ() (*bq.QueryParameter, error) { + pv, err := paramValue(reflect.ValueOf(p.Value)) + if err != nil { + return nil, err + } + pt, err := paramType(reflect.TypeOf(p.Value)) + if err != nil { + return nil, err + } + return &bq.QueryParameter{ + Name: p.Name, + ParameterValue: &pv, + ParameterType: pt, + }, nil +} + +func paramType(t reflect.Type) (*bq.QueryParameterType, error) { + if t == nil { + return nil, errors.New("bigquery: nil parameter") + } + switch t { + case typeOfDate: + return dateParamType, nil + case typeOfTime: + return timeParamType, nil + case typeOfDateTime: + return dateTimeParamType, nil + case typeOfGoTime: + return timestampParamType, nil + case typeOfRat: + return numericParamType, nil + } + switch t.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint8, reflect.Uint16, reflect.Uint32: + return int64ParamType, nil + + case reflect.Float32, reflect.Float64: + return float64ParamType, nil + + case reflect.Bool: + return boolParamType, nil + + case reflect.String: + return stringParamType, nil + + case reflect.Slice: + if t.Elem().Kind() == reflect.Uint8 { + return bytesParamType, nil + } + fallthrough + + case reflect.Array: + et, err := paramType(t.Elem()) + if err != nil { + return nil, err + } + return &bq.QueryParameterType{Type: "ARRAY", ArrayType: et}, nil + + case reflect.Ptr: + if t.Elem().Kind() != reflect.Struct { + break + } + t = t.Elem() + fallthrough + + case reflect.Struct: + var fts []*bq.QueryParameterTypeStructTypes + fields, err := fieldCache.Fields(t) + if err != nil { + return nil, err + } + for _, f := range fields { + pt, err := paramType(f.Type) + if err != nil { + return nil, err + } + fts = append(fts, &bq.QueryParameterTypeStructTypes{ + Name: f.Name, + Type: pt, + }) + } + return &bq.QueryParameterType{Type: "STRUCT", StructTypes: fts}, nil + } + return nil, fmt.Errorf("bigquery: Go type %s cannot be represented as a parameter type", t) +} + +func paramValue(v reflect.Value) (bq.QueryParameterValue, error) { + var res bq.QueryParameterValue + if !v.IsValid() { + return res, errors.New("bigquery: nil parameter") + } + t := v.Type() + switch t { + case typeOfDate: + res.Value = v.Interface().(civil.Date).String() + return res, nil + + case typeOfTime: + // civil.Time has nanosecond resolution, but BigQuery TIME only microsecond. + // (If we send nanoseconds, then when we try to read the result we get "query job + // missing destination table"). + res.Value = CivilTimeString(v.Interface().(civil.Time)) + return res, nil + + case typeOfDateTime: + res.Value = CivilDateTimeString(v.Interface().(civil.DateTime)) + return res, nil + + case typeOfGoTime: + res.Value = v.Interface().(time.Time).Format(timestampFormat) + return res, nil + + case typeOfRat: + res.Value = NumericString(v.Interface().(*big.Rat)) + return res, nil + } + switch t.Kind() { + case reflect.Slice: + if t.Elem().Kind() == reflect.Uint8 { + res.Value = base64.StdEncoding.EncodeToString(v.Interface().([]byte)) + return res, nil + } + fallthrough + + case reflect.Array: + var vals []*bq.QueryParameterValue + for i := 0; i < v.Len(); i++ { + val, err := paramValue(v.Index(i)) + if err != nil { + return bq.QueryParameterValue{}, err + } + vals = append(vals, &val) + } + return bq.QueryParameterValue{ArrayValues: vals}, nil + + case reflect.Ptr: + if t.Elem().Kind() != reflect.Struct { + return res, fmt.Errorf("bigquery: Go type %s cannot be represented as a parameter value", t) + } + t = t.Elem() + v = v.Elem() + if !v.IsValid() { + // nil pointer becomes empty value + return res, nil + } + fallthrough + + case reflect.Struct: + fields, err := fieldCache.Fields(t) + if err != nil { + return bq.QueryParameterValue{}, err + } + res.StructValues = map[string]bq.QueryParameterValue{} + for _, f := range fields { + fv := v.FieldByIndex(f.Index) + fp, err := paramValue(fv) + if err != nil { + return bq.QueryParameterValue{}, err + } + res.StructValues[f.Name] = fp + } + return res, nil + } + // None of the above: assume a scalar type. (If it's not a valid type, + // paramType will catch the error.) + res.Value = fmt.Sprint(v.Interface()) + return res, nil +} + +func bqToQueryParameter(q *bq.QueryParameter) (QueryParameter, error) { + p := QueryParameter{Name: q.Name} + val, err := convertParamValue(q.ParameterValue, q.ParameterType) + if err != nil { + return QueryParameter{}, err + } + p.Value = val + return p, nil +} + +var paramTypeToFieldType = map[string]FieldType{ + int64ParamType.Type: IntegerFieldType, + float64ParamType.Type: FloatFieldType, + boolParamType.Type: BooleanFieldType, + stringParamType.Type: StringFieldType, + bytesParamType.Type: BytesFieldType, + dateParamType.Type: DateFieldType, + timeParamType.Type: TimeFieldType, + numericParamType.Type: NumericFieldType, +} + +// Convert a parameter value from the service to a Go value. This is similar to, but +// not quite the same as, converting data values. +func convertParamValue(qval *bq.QueryParameterValue, qtype *bq.QueryParameterType) (interface{}, error) { + switch qtype.Type { + case "ARRAY": + if qval == nil { + return []interface{}(nil), nil + } + return convertParamArray(qval.ArrayValues, qtype.ArrayType) + case "STRUCT": + if qval == nil { + return map[string]interface{}(nil), nil + } + return convertParamStruct(qval.StructValues, qtype.StructTypes) + case "TIMESTAMP": + return time.Parse(timestampFormat, qval.Value) + case "DATETIME": + return parseCivilDateTime(qval.Value) + default: + return convertBasicType(qval.Value, paramTypeToFieldType[qtype.Type]) + } +} + +// convertParamArray converts a query parameter array value to a Go value. It +// always returns a []interface{}. +func convertParamArray(elVals []*bq.QueryParameterValue, elType *bq.QueryParameterType) ([]interface{}, error) { + var vals []interface{} + for _, el := range elVals { + val, err := convertParamValue(el, elType) + if err != nil { + return nil, err + } + vals = append(vals, val) + } + return vals, nil +} + +// convertParamStruct converts a query parameter struct value into a Go value. It +// always returns a map[string]interface{}. +func convertParamStruct(sVals map[string]bq.QueryParameterValue, sTypes []*bq.QueryParameterTypeStructTypes) (map[string]interface{}, error) { + vals := map[string]interface{}{} + for _, st := range sTypes { + if sv, ok := sVals[st.Name]; ok { + val, err := convertParamValue(&sv, st.Type) + if err != nil { + return nil, err + } + vals[st.Name] = val + } else { + vals[st.Name] = nil + } + } + return vals, nil +} diff --git a/vendor/cloud.google.com/go/bigquery/params_test.go b/vendor/cloud.google.com/go/bigquery/params_test.go new file mode 100644 index 000000000..6464e7966 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/params_test.go @@ -0,0 +1,362 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bigquery + +import ( + "context" + "errors" + "math" + "math/big" + "reflect" + "testing" + "time" + + "cloud.google.com/go/civil" + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + bq "google.golang.org/api/bigquery/v2" +) + +var scalarTests = []struct { + val interface{} // The Go value + wantVal string // paramValue's desired output + wantType *bq.QueryParameterType // paramType's desired output +}{ + {int64(0), "0", int64ParamType}, + {3.14, "3.14", float64ParamType}, + {3.14159e-87, "3.14159e-87", float64ParamType}, + {true, "true", boolParamType}, + {"string", "string", stringParamType}, + {"\u65e5\u672c\u8a9e\n", "\u65e5\u672c\u8a9e\n", stringParamType}, + {math.NaN(), "NaN", float64ParamType}, + {[]byte("foo"), "Zm9v", bytesParamType}, // base64 encoding of "foo" + {time.Date(2016, 3, 20, 4, 22, 9, 5000, time.FixedZone("neg1-2", -3720)), + "2016-03-20 04:22:09.000005-01:02", + timestampParamType}, + {civil.Date{Year: 2016, Month: 3, Day: 20}, "2016-03-20", dateParamType}, + {civil.Time{Hour: 4, Minute: 5, Second: 6, Nanosecond: 789000000}, "04:05:06.789000", timeParamType}, + {civil.DateTime{Date: civil.Date{Year: 2016, Month: 3, Day: 20}, Time: civil.Time{Hour: 4, Minute: 5, Second: 6, Nanosecond: 789000000}}, + "2016-03-20 04:05:06.789000", + dateTimeParamType}, + {big.NewRat(12345, 1000), "12.345000000", numericParamType}, +} + +type ( + S1 struct { + A int + B *S2 + C bool + } + S2 struct { + D string + e int + } +) + +var ( + s1 = S1{ + A: 1, + B: &S2{D: "s"}, + C: true, + } + + s1ParamType = &bq.QueryParameterType{ + Type: "STRUCT", + StructTypes: []*bq.QueryParameterTypeStructTypes{ + {Name: "A", Type: int64ParamType}, + {Name: "B", Type: &bq.QueryParameterType{ + Type: "STRUCT", + StructTypes: []*bq.QueryParameterTypeStructTypes{ + {Name: "D", Type: stringParamType}, + }, + }}, + {Name: "C", Type: boolParamType}, + }, + } + + s1ParamValue = bq.QueryParameterValue{ + StructValues: map[string]bq.QueryParameterValue{ + "A": sval("1"), + "B": { + StructValues: map[string]bq.QueryParameterValue{ + "D": sval("s"), + }, + }, + "C": sval("true"), + }, + } + + s1ParamReturnValue = map[string]interface{}{ + "A": int64(1), + "B": map[string]interface{}{"D": "s"}, + "C": true, + } +) + +func sval(s string) bq.QueryParameterValue { + return bq.QueryParameterValue{Value: s} +} + +func TestParamValueScalar(t *testing.T) { + for _, test := range scalarTests { + got, err := paramValue(reflect.ValueOf(test.val)) + if err != nil { + t.Errorf("%v: got %v, want nil", test.val, err) + continue + } + want := sval(test.wantVal) + if !testutil.Equal(got, want) { + t.Errorf("%v:\ngot %+v\nwant %+v", test.val, got, want) + } + } +} + +func TestParamValueArray(t *testing.T) { + qpv := bq.QueryParameterValue{ArrayValues: []*bq.QueryParameterValue{ + {Value: "1"}, + {Value: "2"}, + }, + } + for _, test := range []struct { + val interface{} + want bq.QueryParameterValue + }{ + {[]int(nil), bq.QueryParameterValue{}}, + {[]int{}, bq.QueryParameterValue{}}, + {[]int{1, 2}, qpv}, + {[2]int{1, 2}, qpv}, + } { + got, err := paramValue(reflect.ValueOf(test.val)) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, test.want) { + t.Errorf("%#v:\ngot %+v\nwant %+v", test.val, got, test.want) + } + } +} + +func TestParamValueStruct(t *testing.T) { + got, err := paramValue(reflect.ValueOf(s1)) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, s1ParamValue) { + t.Errorf("got %+v\nwant %+v", got, s1ParamValue) + } +} + +func TestParamValueErrors(t *testing.T) { + // paramValue lets a few invalid types through, but paramType catches them. + // Since we never call one without the other that's fine. + for _, val := range []interface{}{nil, new([]int)} { + _, err := paramValue(reflect.ValueOf(val)) + if err == nil { + t.Errorf("%v (%T): got nil, want error", val, val) + } + } +} + +func TestParamType(t *testing.T) { + for _, test := range scalarTests { + got, err := paramType(reflect.TypeOf(test.val)) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, test.wantType) { + t.Errorf("%v (%T): got %v, want %v", test.val, test.val, got, test.wantType) + } + } + for _, test := range []struct { + val interface{} + want *bq.QueryParameterType + }{ + {uint32(32767), int64ParamType}, + {[]byte("foo"), bytesParamType}, + {[]int{}, &bq.QueryParameterType{Type: "ARRAY", ArrayType: int64ParamType}}, + {[3]bool{}, &bq.QueryParameterType{Type: "ARRAY", ArrayType: boolParamType}}, + {S1{}, s1ParamType}, + } { + got, err := paramType(reflect.TypeOf(test.val)) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, test.want) { + t.Errorf("%v (%T): got %v, want %v", test.val, test.val, got, test.want) + } + } +} + +func TestParamTypeErrors(t *testing.T) { + for _, val := range []interface{}{ + nil, uint(0), new([]int), make(chan int), + } { + _, err := paramType(reflect.TypeOf(val)) + if err == nil { + t.Errorf("%v (%T): got nil, want error", val, val) + } + } +} + +func TestConvertParamValue(t *testing.T) { + // Scalars. + for _, test := range scalarTests { + pval, err := paramValue(reflect.ValueOf(test.val)) + if err != nil { + t.Fatal(err) + } + ptype, err := paramType(reflect.TypeOf(test.val)) + if err != nil { + t.Fatal(err) + } + got, err := convertParamValue(&pval, ptype) + if err != nil { + t.Fatalf("convertParamValue(%+v, %+v): %v", pval, ptype, err) + } + if !testutil.Equal(got, test.val) { + t.Errorf("%#v: got %#v", test.val, got) + } + } + // Arrays. + for _, test := range []struct { + pval *bq.QueryParameterValue + want []interface{} + }{ + { + &bq.QueryParameterValue{}, + nil, + }, + { + &bq.QueryParameterValue{ + ArrayValues: []*bq.QueryParameterValue{{Value: "1"}, {Value: "2"}}, + }, + []interface{}{int64(1), int64(2)}, + }, + } { + ptype := &bq.QueryParameterType{Type: "ARRAY", ArrayType: int64ParamType} + got, err := convertParamValue(test.pval, ptype) + if err != nil { + t.Fatalf("%+v: %v", test.pval, err) + } + if !testutil.Equal(got, test.want) { + t.Errorf("%+v: got %+v, want %+v", test.pval, got, test.want) + } + } + // Structs. + got, err := convertParamValue(&s1ParamValue, s1ParamType) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, s1ParamReturnValue) { + t.Errorf("got %+v, want %+v", got, s1ParamReturnValue) + } +} + +func TestIntegration_ScalarParam(t *testing.T) { + roundToMicros := cmp.Transformer("RoundToMicros", + func(t time.Time) time.Time { return t.Round(time.Microsecond) }) + c := getClient(t) + for _, test := range scalarTests { + gotData, gotParam, err := paramRoundTrip(c, test.val) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(gotData, test.val, roundToMicros) { + t.Errorf("\ngot %#v (%T)\nwant %#v (%T)", gotData, gotData, test.val, test.val) + } + if !testutil.Equal(gotParam, test.val, roundToMicros) { + t.Errorf("\ngot %#v (%T)\nwant %#v (%T)", gotParam, gotParam, test.val, test.val) + } + } +} + +func TestIntegration_OtherParam(t *testing.T) { + c := getClient(t) + for _, test := range []struct { + val interface{} + wantData interface{} + wantParam interface{} + }{ + {[]int(nil), []Value(nil), []interface{}(nil)}, + {[]int{}, []Value(nil), []interface{}(nil)}, + { + []int{1, 2}, + []Value{int64(1), int64(2)}, + []interface{}{int64(1), int64(2)}, + }, + { + [3]int{1, 2, 3}, + []Value{int64(1), int64(2), int64(3)}, + []interface{}{int64(1), int64(2), int64(3)}, + }, + { + S1{}, + []Value{int64(0), nil, false}, + map[string]interface{}{ + "A": int64(0), + "B": nil, + "C": false, + }, + }, + { + s1, + []Value{int64(1), []Value{"s"}, true}, + s1ParamReturnValue, + }, + } { + gotData, gotParam, err := paramRoundTrip(c, test.val) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(gotData, test.wantData) { + t.Errorf("%#v:\ngot %#v (%T)\nwant %#v (%T)", + test.val, gotData, gotData, test.wantData, test.wantData) + } + if !testutil.Equal(gotParam, test.wantParam) { + t.Errorf("%#v:\ngot %#v (%T)\nwant %#v (%T)", + test.val, gotParam, gotParam, test.wantParam, test.wantParam) + } + } +} + +// paramRoundTrip passes x as a query parameter to BigQuery. It returns +// the resulting data value from running the query and the parameter value from +// the returned job configuration. +func paramRoundTrip(c *Client, x interface{}) (data Value, param interface{}, err error) { + ctx := context.Background() + q := c.Query("select ?") + q.Parameters = []QueryParameter{{Value: x}} + job, err := q.Run(ctx) + if err != nil { + return nil, nil, err + } + it, err := job.Read(ctx) + if err != nil { + return nil, nil, err + } + var val []Value + err = it.Next(&val) + if err != nil { + return nil, nil, err + } + if len(val) != 1 { + return nil, nil, errors.New("wrong number of values") + } + conf, err := job.Config() + if err != nil { + return nil, nil, err + } + return val[0], conf.(*QueryConfig).Parameters[0].Value, nil +} diff --git a/vendor/cloud.google.com/go/bigquery/query.go b/vendor/cloud.google.com/go/bigquery/query.go new file mode 100644 index 000000000..735a54c45 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/query.go @@ -0,0 +1,328 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "errors" + + "cloud.google.com/go/internal/trace" + bq "google.golang.org/api/bigquery/v2" +) + +// QueryConfig holds the configuration for a query job. +type QueryConfig struct { + // Dst is the table into which the results of the query will be written. + // If this field is nil, a temporary table will be created. + Dst *Table + + // The query to execute. See https://cloud.google.com/bigquery/query-reference for details. + Q string + + // DefaultProjectID and DefaultDatasetID specify the dataset to use for unqualified table names in the query. + // If DefaultProjectID is set, DefaultDatasetID must also be set. + DefaultProjectID string + DefaultDatasetID string + + // TableDefinitions describes data sources outside of BigQuery. + // The map keys may be used as table names in the query string. + // + // When a QueryConfig is returned from Job.Config, the map values + // are always of type *ExternalDataConfig. + TableDefinitions map[string]ExternalData + + // CreateDisposition specifies the circumstances under which the destination table will be created. + // The default is CreateIfNeeded. + CreateDisposition TableCreateDisposition + + // WriteDisposition specifies how existing data in the destination table is treated. + // The default is WriteEmpty. + WriteDisposition TableWriteDisposition + + // DisableQueryCache prevents results being fetched from the query cache. + // If this field is false, results are fetched from the cache if they are available. + // The query cache is a best-effort cache that is flushed whenever tables in the query are modified. + // Cached results are only available when TableID is unspecified in the query's destination Table. + // For more information, see https://cloud.google.com/bigquery/querying-data#querycaching + DisableQueryCache bool + + // DisableFlattenedResults prevents results being flattened. + // If this field is false, results from nested and repeated fields are flattened. + // DisableFlattenedResults implies AllowLargeResults + // For more information, see https://cloud.google.com/bigquery/docs/data#nested + DisableFlattenedResults bool + + // AllowLargeResults allows the query to produce arbitrarily large result tables. + // The destination must be a table. + // When using this option, queries will take longer to execute, even if the result set is small. + // For additional limitations, see https://cloud.google.com/bigquery/querying-data#largequeryresults + AllowLargeResults bool + + // Priority specifies the priority with which to schedule the query. + // The default priority is InteractivePriority. + // For more information, see https://cloud.google.com/bigquery/querying-data#batchqueries + Priority QueryPriority + + // MaxBillingTier sets the maximum billing tier for a Query. + // Queries that have resource usage beyond this tier will fail (without + // incurring a charge). If this field is zero, the project default will be used. + MaxBillingTier int + + // MaxBytesBilled limits the number of bytes billed for + // this job. Queries that would exceed this limit will fail (without incurring + // a charge). + // If this field is less than 1, the project default will be + // used. + MaxBytesBilled int64 + + // UseStandardSQL causes the query to use standard SQL. The default. + // Deprecated: use UseLegacySQL. + UseStandardSQL bool + + // UseLegacySQL causes the query to use legacy SQL. + UseLegacySQL bool + + // Parameters is a list of query parameters. The presence of parameters + // implies the use of standard SQL. + // If the query uses positional syntax ("?"), then no parameter may have a name. + // If the query uses named syntax ("@p"), then all parameters must have names. + // It is illegal to mix positional and named syntax. + Parameters []QueryParameter + + // TimePartitioning specifies time-based partitioning + // for the destination table. + TimePartitioning *TimePartitioning + + // Clustering specifies the data clustering configuration for the destination table. + Clustering *Clustering + + // The labels associated with this job. + Labels map[string]string + + // If true, don't actually run this job. A valid query will return a mostly + // empty response with some processing statistics, while an invalid query will + // return the same error it would if it wasn't a dry run. + // + // Query.Read will fail with dry-run queries. Call Query.Run instead, and then + // call LastStatus on the returned job to get statistics. Calling Status on a + // dry-run job will fail. + DryRun bool + + // Custom encryption configuration (e.g., Cloud KMS keys). + DestinationEncryptionConfig *EncryptionConfig + + // Allows the schema of the destination table to be updated as a side effect of + // the query job. + SchemaUpdateOptions []string +} + +func (qc *QueryConfig) toBQ() (*bq.JobConfiguration, error) { + qconf := &bq.JobConfigurationQuery{ + Query: qc.Q, + CreateDisposition: string(qc.CreateDisposition), + WriteDisposition: string(qc.WriteDisposition), + AllowLargeResults: qc.AllowLargeResults, + Priority: string(qc.Priority), + MaximumBytesBilled: qc.MaxBytesBilled, + TimePartitioning: qc.TimePartitioning.toBQ(), + Clustering: qc.Clustering.toBQ(), + DestinationEncryptionConfiguration: qc.DestinationEncryptionConfig.toBQ(), + SchemaUpdateOptions: qc.SchemaUpdateOptions, + } + if len(qc.TableDefinitions) > 0 { + qconf.TableDefinitions = make(map[string]bq.ExternalDataConfiguration) + } + for name, data := range qc.TableDefinitions { + qconf.TableDefinitions[name] = data.toBQ() + } + if qc.DefaultProjectID != "" || qc.DefaultDatasetID != "" { + qconf.DefaultDataset = &bq.DatasetReference{ + DatasetId: qc.DefaultDatasetID, + ProjectId: qc.DefaultProjectID, + } + } + if tier := int64(qc.MaxBillingTier); tier > 0 { + qconf.MaximumBillingTier = &tier + } + f := false + if qc.DisableQueryCache { + qconf.UseQueryCache = &f + } + if qc.DisableFlattenedResults { + qconf.FlattenResults = &f + // DisableFlattenResults implies AllowLargeResults. + qconf.AllowLargeResults = true + } + if qc.UseStandardSQL && qc.UseLegacySQL { + return nil, errors.New("bigquery: cannot provide both UseStandardSQL and UseLegacySQL") + } + if len(qc.Parameters) > 0 && qc.UseLegacySQL { + return nil, errors.New("bigquery: cannot provide both Parameters (implying standard SQL) and UseLegacySQL") + } + ptrue := true + pfalse := false + if qc.UseLegacySQL { + qconf.UseLegacySql = &ptrue + } else { + qconf.UseLegacySql = &pfalse + } + if qc.Dst != nil && !qc.Dst.implicitTable() { + qconf.DestinationTable = qc.Dst.toBQ() + } + for _, p := range qc.Parameters { + qp, err := p.toBQ() + if err != nil { + return nil, err + } + qconf.QueryParameters = append(qconf.QueryParameters, qp) + } + return &bq.JobConfiguration{ + Labels: qc.Labels, + DryRun: qc.DryRun, + Query: qconf, + }, nil +} + +func bqToQueryConfig(q *bq.JobConfiguration, c *Client) (*QueryConfig, error) { + qq := q.Query + qc := &QueryConfig{ + Labels: q.Labels, + DryRun: q.DryRun, + Q: qq.Query, + CreateDisposition: TableCreateDisposition(qq.CreateDisposition), + WriteDisposition: TableWriteDisposition(qq.WriteDisposition), + AllowLargeResults: qq.AllowLargeResults, + Priority: QueryPriority(qq.Priority), + MaxBytesBilled: qq.MaximumBytesBilled, + UseLegacySQL: qq.UseLegacySql == nil || *qq.UseLegacySql, + TimePartitioning: bqToTimePartitioning(qq.TimePartitioning), + Clustering: bqToClustering(qq.Clustering), + DestinationEncryptionConfig: bqToEncryptionConfig(qq.DestinationEncryptionConfiguration), + SchemaUpdateOptions: qq.SchemaUpdateOptions, + } + qc.UseStandardSQL = !qc.UseLegacySQL + + if len(qq.TableDefinitions) > 0 { + qc.TableDefinitions = make(map[string]ExternalData) + } + for name, qedc := range qq.TableDefinitions { + edc, err := bqToExternalDataConfig(&qedc) + if err != nil { + return nil, err + } + qc.TableDefinitions[name] = edc + } + if qq.DefaultDataset != nil { + qc.DefaultProjectID = qq.DefaultDataset.ProjectId + qc.DefaultDatasetID = qq.DefaultDataset.DatasetId + } + if qq.MaximumBillingTier != nil { + qc.MaxBillingTier = int(*qq.MaximumBillingTier) + } + if qq.UseQueryCache != nil && !*qq.UseQueryCache { + qc.DisableQueryCache = true + } + if qq.FlattenResults != nil && !*qq.FlattenResults { + qc.DisableFlattenedResults = true + } + if qq.DestinationTable != nil { + qc.Dst = bqToTable(qq.DestinationTable, c) + } + for _, qp := range qq.QueryParameters { + p, err := bqToQueryParameter(qp) + if err != nil { + return nil, err + } + qc.Parameters = append(qc.Parameters, p) + } + return qc, nil +} + +// QueryPriority specifies a priority with which a query is to be executed. +type QueryPriority string + +const ( + // BatchPriority specifies that the query should be scheduled with the + // batch priority. BigQuery queues each batch query on your behalf, and + // starts the query as soon as idle resources are available, usually within + // a few minutes. If BigQuery hasn't started the query within 24 hours, + // BigQuery changes the job priority to interactive. Batch queries don't + // count towards your concurrent rate limit, which can make it easier to + // start many queries at once. + // + // More information can be found at https://cloud.google.com/bigquery/docs/running-queries#batchqueries. + BatchPriority QueryPriority = "BATCH" + // InteractivePriority specifies that the query should be scheduled with + // interactive priority, which means that the query is executed as soon as + // possible. Interactive queries count towards your concurrent rate limit + // and your daily limit. It is the default priority with which queries get + // executed. + // + // More information can be found at https://cloud.google.com/bigquery/docs/running-queries#queries. + InteractivePriority QueryPriority = "INTERACTIVE" +) + +// A Query queries data from a BigQuery table. Use Client.Query to create a Query. +type Query struct { + JobIDConfig + QueryConfig + client *Client +} + +// Query creates a query with string q. +// The returned Query may optionally be further configured before its Run method is called. +func (c *Client) Query(q string) *Query { + return &Query{ + client: c, + QueryConfig: QueryConfig{Q: q}, + } +} + +// Run initiates a query job. +func (q *Query) Run(ctx context.Context) (j *Job, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Query.Run") + defer func() { trace.EndSpan(ctx, err) }() + + job, err := q.newJob() + if err != nil { + return nil, err + } + j, err = q.client.insertJob(ctx, job, nil) + if err != nil { + return nil, err + } + return j, nil +} + +func (q *Query) newJob() (*bq.Job, error) { + config, err := q.QueryConfig.toBQ() + if err != nil { + return nil, err + } + return &bq.Job{ + JobReference: q.JobIDConfig.createJobRef(q.client), + Configuration: config, + }, nil +} + +// Read submits a query for execution and returns the results via a RowIterator. +// It is a shorthand for Query.Run followed by Job.Read. +func (q *Query) Read(ctx context.Context) (*RowIterator, error) { + job, err := q.Run(ctx) + if err != nil { + return nil, err + } + return job.Read(ctx) +} diff --git a/vendor/cloud.google.com/go/bigquery/query_test.go b/vendor/cloud.google.com/go/bigquery/query_test.go new file mode 100644 index 000000000..f56eeef63 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/query_test.go @@ -0,0 +1,408 @@ +// Copyright 2015 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 bigquery + +import ( + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + bq "google.golang.org/api/bigquery/v2" +) + +func defaultQueryJob() *bq.Job { + pfalse := false + return &bq.Job{ + JobReference: &bq.JobReference{JobId: "RANDOM", ProjectId: "client-project-id"}, + Configuration: &bq.JobConfiguration{ + Query: &bq.JobConfigurationQuery{ + DestinationTable: &bq.TableReference{ + ProjectId: "client-project-id", + DatasetId: "dataset-id", + TableId: "table-id", + }, + Query: "query string", + DefaultDataset: &bq.DatasetReference{ + ProjectId: "def-project-id", + DatasetId: "def-dataset-id", + }, + UseLegacySql: &pfalse, + }, + }, + } +} + +var defaultQuery = &QueryConfig{ + Q: "query string", + DefaultProjectID: "def-project-id", + DefaultDatasetID: "def-dataset-id", +} + +func TestQuery(t *testing.T) { + defer fixRandomID("RANDOM")() + c := &Client{ + projectID: "client-project-id", + } + testCases := []struct { + dst *Table + src *QueryConfig + jobIDConfig JobIDConfig + want *bq.Job + }{ + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: defaultQuery, + want: defaultQueryJob(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: &QueryConfig{ + Q: "query string", + Labels: map[string]string{"a": "b"}, + DryRun: true, + }, + want: func() *bq.Job { + j := defaultQueryJob() + j.Configuration.Labels = map[string]string{"a": "b"} + j.Configuration.DryRun = true + j.Configuration.Query.DefaultDataset = nil + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + jobIDConfig: JobIDConfig{JobID: "jobID", AddJobIDSuffix: true}, + src: &QueryConfig{Q: "query string"}, + want: func() *bq.Job { + j := defaultQueryJob() + j.Configuration.Query.DefaultDataset = nil + j.JobReference.JobId = "jobID-RANDOM" + return j + }(), + }, + { + dst: &Table{}, + src: defaultQuery, + want: func() *bq.Job { + j := defaultQueryJob() + j.Configuration.Query.DestinationTable = nil + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: &QueryConfig{ + Q: "query string", + TableDefinitions: map[string]ExternalData{ + "atable": func() *GCSReference { + g := NewGCSReference("uri") + g.AllowJaggedRows = true + g.AllowQuotedNewlines = true + g.Compression = Gzip + g.Encoding = UTF_8 + g.FieldDelimiter = ";" + g.IgnoreUnknownValues = true + g.MaxBadRecords = 1 + g.Quote = "'" + g.SkipLeadingRows = 2 + g.Schema = Schema{{Name: "name", Type: StringFieldType}} + return g + }(), + }, + }, + want: func() *bq.Job { + j := defaultQueryJob() + j.Configuration.Query.DefaultDataset = nil + td := make(map[string]bq.ExternalDataConfiguration) + quote := "'" + td["atable"] = bq.ExternalDataConfiguration{ + Compression: "GZIP", + IgnoreUnknownValues: true, + MaxBadRecords: 1, + SourceFormat: "CSV", // must be explicitly set. + SourceUris: []string{"uri"}, + CsvOptions: &bq.CsvOptions{ + AllowJaggedRows: true, + AllowQuotedNewlines: true, + Encoding: "UTF-8", + FieldDelimiter: ";", + SkipLeadingRows: 2, + Quote: "e, + }, + Schema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + {Name: "name", Type: "STRING"}, + }, + }, + } + j.Configuration.Query.TableDefinitions = td + return j + }(), + }, + { + dst: &Table{ + ProjectID: "project-id", + DatasetID: "dataset-id", + TableID: "table-id", + }, + src: &QueryConfig{ + Q: "query string", + DefaultProjectID: "def-project-id", + DefaultDatasetID: "def-dataset-id", + CreateDisposition: CreateNever, + WriteDisposition: WriteTruncate, + }, + want: func() *bq.Job { + j := defaultQueryJob() + j.Configuration.Query.DestinationTable.ProjectId = "project-id" + j.Configuration.Query.WriteDisposition = "WRITE_TRUNCATE" + j.Configuration.Query.CreateDisposition = "CREATE_NEVER" + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: &QueryConfig{ + Q: "query string", + DefaultProjectID: "def-project-id", + DefaultDatasetID: "def-dataset-id", + DisableQueryCache: true, + }, + want: func() *bq.Job { + j := defaultQueryJob() + f := false + j.Configuration.Query.UseQueryCache = &f + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: &QueryConfig{ + Q: "query string", + DefaultProjectID: "def-project-id", + DefaultDatasetID: "def-dataset-id", + AllowLargeResults: true, + }, + want: func() *bq.Job { + j := defaultQueryJob() + j.Configuration.Query.AllowLargeResults = true + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: &QueryConfig{ + Q: "query string", + DefaultProjectID: "def-project-id", + DefaultDatasetID: "def-dataset-id", + DisableFlattenedResults: true, + }, + want: func() *bq.Job { + j := defaultQueryJob() + f := false + j.Configuration.Query.FlattenResults = &f + j.Configuration.Query.AllowLargeResults = true + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: &QueryConfig{ + Q: "query string", + DefaultProjectID: "def-project-id", + DefaultDatasetID: "def-dataset-id", + Priority: QueryPriority("low"), + }, + want: func() *bq.Job { + j := defaultQueryJob() + j.Configuration.Query.Priority = "low" + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: &QueryConfig{ + Q: "query string", + DefaultProjectID: "def-project-id", + DefaultDatasetID: "def-dataset-id", + MaxBillingTier: 3, + MaxBytesBilled: 5, + }, + want: func() *bq.Job { + j := defaultQueryJob() + tier := int64(3) + j.Configuration.Query.MaximumBillingTier = &tier + j.Configuration.Query.MaximumBytesBilled = 5 + return j + }(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: &QueryConfig{ + Q: "query string", + DefaultProjectID: "def-project-id", + DefaultDatasetID: "def-dataset-id", + UseStandardSQL: true, + }, + want: defaultQueryJob(), + }, + { + dst: c.Dataset("dataset-id").Table("table-id"), + src: &QueryConfig{ + Q: "query string", + DefaultProjectID: "def-project-id", + DefaultDatasetID: "def-dataset-id", + UseLegacySQL: true, + }, + want: func() *bq.Job { + j := defaultQueryJob() + ptrue := true + j.Configuration.Query.UseLegacySql = &ptrue + j.Configuration.Query.ForceSendFields = nil + return j + }(), + }, + } + for i, tc := range testCases { + query := c.Query("") + query.JobIDConfig = tc.jobIDConfig + query.QueryConfig = *tc.src + query.Dst = tc.dst + got, err := query.newJob() + if err != nil { + t.Errorf("#%d: err calling query: %v", i, err) + continue + } + checkJob(t, i, got, tc.want) + + // Round-trip. + jc, err := bqToJobConfig(got.Configuration, c) + if err != nil { + t.Fatalf("#%d: %v", i, err) + } + wantConfig := query.QueryConfig + // We set AllowLargeResults to true when DisableFlattenedResults is true. + if wantConfig.DisableFlattenedResults { + wantConfig.AllowLargeResults = true + } + // A QueryConfig with neither UseXXXSQL field set is equivalent + // to one where UseStandardSQL = true. + if !wantConfig.UseLegacySQL && !wantConfig.UseStandardSQL { + wantConfig.UseStandardSQL = true + } + // Treat nil and empty tables the same, and ignore the client. + tableEqual := func(t1, t2 *Table) bool { + if t1 == nil { + t1 = &Table{} + } + if t2 == nil { + t2 = &Table{} + } + return t1.ProjectID == t2.ProjectID && t1.DatasetID == t2.DatasetID && t1.TableID == t2.TableID + } + // A table definition that is a GCSReference round-trips as an ExternalDataConfig. + // TODO(jba): see if there is a way to express this with a transformer. + gcsRefToEDC := func(g *GCSReference) *ExternalDataConfig { + q := g.toBQ() + e, _ := bqToExternalDataConfig(&q) + return e + } + externalDataEqual := func(e1, e2 ExternalData) bool { + if r, ok := e1.(*GCSReference); ok { + e1 = gcsRefToEDC(r) + } + if r, ok := e2.(*GCSReference); ok { + e2 = gcsRefToEDC(r) + } + return cmp.Equal(e1, e2) + } + diff := testutil.Diff(jc.(*QueryConfig), &wantConfig, + cmp.Comparer(tableEqual), + cmp.Comparer(externalDataEqual), + ) + if diff != "" { + t.Errorf("#%d: (got=-, want=+:\n%s", i, diff) + } + } +} + +func TestConfiguringQuery(t *testing.T) { + c := &Client{ + projectID: "project-id", + } + + query := c.Query("q") + query.JobID = "ajob" + query.DefaultProjectID = "def-project-id" + query.DefaultDatasetID = "def-dataset-id" + query.TimePartitioning = &TimePartitioning{Expiration: 1234 * time.Second, Field: "f"} + query.Clustering = &Clustering{ + Fields: []string{"cfield1"}, + } + query.DestinationEncryptionConfig = &EncryptionConfig{KMSKeyName: "keyName"} + query.SchemaUpdateOptions = []string{"ALLOW_FIELD_ADDITION"} + + // Note: Other configuration fields are tested in other tests above. + // A lot of that can be consolidated once Client.Copy is gone. + + pfalse := false + want := &bq.Job{ + Configuration: &bq.JobConfiguration{ + Query: &bq.JobConfigurationQuery{ + Query: "q", + DefaultDataset: &bq.DatasetReference{ + ProjectId: "def-project-id", + DatasetId: "def-dataset-id", + }, + UseLegacySql: &pfalse, + TimePartitioning: &bq.TimePartitioning{ExpirationMs: 1234000, Field: "f", Type: "DAY"}, + Clustering: &bq.Clustering{Fields: []string{"cfield1"}}, + DestinationEncryptionConfiguration: &bq.EncryptionConfiguration{KmsKeyName: "keyName"}, + SchemaUpdateOptions: []string{"ALLOW_FIELD_ADDITION"}, + }, + }, + JobReference: &bq.JobReference{ + JobId: "ajob", + ProjectId: "project-id", + }, + } + + got, err := query.newJob() + if err != nil { + t.Fatalf("err calling Query.newJob: %v", err) + } + if diff := testutil.Diff(got, want); diff != "" { + t.Errorf("querying: -got +want:\n%s", diff) + } +} + +func TestQueryLegacySQL(t *testing.T) { + c := &Client{projectID: "project-id"} + q := c.Query("q") + q.UseStandardSQL = true + q.UseLegacySQL = true + _, err := q.newJob() + if err == nil { + t.Error("UseStandardSQL and UseLegacySQL: got nil, want error") + } + q = c.Query("q") + q.Parameters = []QueryParameter{{Name: "p", Value: 3}} + q.UseLegacySQL = true + _, err = q.newJob() + if err == nil { + t.Error("Parameters and UseLegacySQL: got nil, want error") + } +} diff --git a/vendor/cloud.google.com/go/bigquery/random.go b/vendor/cloud.google.com/go/bigquery/random.go new file mode 100644 index 000000000..65f938434 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/random.go @@ -0,0 +1,56 @@ +// 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. + +package bigquery + +import ( + "math/rand" + "os" + "sync" + "time" +) + +// Support for random values (typically job IDs and insert IDs). + +const alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + +var ( + rngMu sync.Mutex + rng = rand.New(rand.NewSource(time.Now().UnixNano() ^ int64(os.Getpid()))) +) + +// For testing. +var randomIDFn = randomID + +// As of August 2017, the BigQuery service uses 27 alphanumeric characters for +// suffixes. +const randomIDLen = 27 + +func randomID() string { + // This is used for both job IDs and insert IDs. + var b [randomIDLen]byte + rngMu.Lock() + for i := 0; i < len(b); i++ { + b[i] = alphanum[rng.Intn(len(alphanum))] + } + rngMu.Unlock() + return string(b[:]) +} + +// Seed seeds this package's random number generator, used for generating job and +// insert IDs. Use Seed to obtain repeatable, deterministic behavior from bigquery +// clients. Seed should be called before any clients are created. +func Seed(s int64) { + rng = rand.New(rand.NewSource(s)) +} diff --git a/vendor/cloud.google.com/go/bigquery/read_test.go b/vendor/cloud.google.com/go/bigquery/read_test.go new file mode 100644 index 000000000..883430a00 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/read_test.go @@ -0,0 +1,233 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "errors" + "testing" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + bq "google.golang.org/api/bigquery/v2" + "google.golang.org/api/iterator" +) + +type pageFetcherArgs struct { + table *Table + schema Schema + startIndex uint64 + pageSize int64 + pageToken string +} + +// pageFetcherReadStub services read requests by returning data from an in-memory list of values. +type pageFetcherReadStub struct { + // values and pageTokens are used as sources of data to return in response to calls to readTabledata or readQuery. + values [][][]Value // contains pages / rows / columns. + pageTokens map[string]string // maps incoming page token to returned page token. + + // arguments are recorded for later inspection. + calls []pageFetcherArgs +} + +func (s *pageFetcherReadStub) fetchPage(ctx context.Context, t *Table, schema Schema, startIndex uint64, pageSize int64, pageToken string) (*fetchPageResult, error) { + s.calls = append(s.calls, + pageFetcherArgs{t, schema, startIndex, pageSize, pageToken}) + result := &fetchPageResult{ + pageToken: s.pageTokens[pageToken], + rows: s.values[0], + } + s.values = s.values[1:] + return result, nil +} + +func waitForQueryStub(context.Context, string) (Schema, uint64, error) { + return nil, 1, nil +} + +func TestRead(t *testing.T) { + // The data for the service stub to return is populated for each test case in the testCases for loop. + ctx := context.Background() + c := &Client{projectID: "project-id"} + pf := &pageFetcherReadStub{} + queryJob := &Job{ + projectID: "project-id", + jobID: "job-id", + c: c, + config: &bq.JobConfiguration{ + Query: &bq.JobConfigurationQuery{ + DestinationTable: &bq.TableReference{ + ProjectId: "project-id", + DatasetId: "dataset-id", + TableId: "table-id", + }, + }, + }, + } + + for _, readFunc := range []func() *RowIterator{ + func() *RowIterator { + return c.Dataset("dataset-id").Table("table-id").read(ctx, pf.fetchPage) + }, + func() *RowIterator { + it, err := queryJob.read(ctx, waitForQueryStub, pf.fetchPage) + if err != nil { + t.Fatal(err) + } + return it + }, + } { + testCases := []struct { + data [][][]Value + pageTokens map[string]string + want [][]Value + }{ + { + data: [][][]Value{{{1, 2}, {11, 12}}, {{30, 40}, {31, 41}}}, + pageTokens: map[string]string{"": "a", "a": ""}, + want: [][]Value{{1, 2}, {11, 12}, {30, 40}, {31, 41}}, + }, + { + data: [][][]Value{{{1, 2}, {11, 12}}, {{30, 40}, {31, 41}}}, + pageTokens: map[string]string{"": ""}, // no more pages after first one. + want: [][]Value{{1, 2}, {11, 12}}, + }, + } + for _, tc := range testCases { + pf.values = tc.data + pf.pageTokens = tc.pageTokens + if got, ok := collectValues(t, readFunc()); ok { + if !testutil.Equal(got, tc.want) { + t.Errorf("reading: got:\n%v\nwant:\n%v", got, tc.want) + } + } + } + } +} + +func collectValues(t *testing.T, it *RowIterator) ([][]Value, bool) { + var got [][]Value + for { + var vals []Value + err := it.Next(&vals) + if err == iterator.Done { + break + } + if err != nil { + t.Errorf("err calling Next: %v", err) + return nil, false + } + got = append(got, vals) + } + return got, true +} + +func TestNoMoreValues(t *testing.T) { + c := &Client{projectID: "project-id"} + pf := &pageFetcherReadStub{ + values: [][][]Value{{{1, 2}, {11, 12}}}, + } + it := c.Dataset("dataset-id").Table("table-id").read(context.Background(), pf.fetchPage) + var vals []Value + // We expect to retrieve two values and then fail on the next attempt. + if err := it.Next(&vals); err != nil { + t.Fatalf("Next: got: %v: want: nil", err) + } + if err := it.Next(&vals); err != nil { + t.Fatalf("Next: got: %v: want: nil", err) + } + if err := it.Next(&vals); err != iterator.Done { + t.Fatalf("Next: got: %v: want: iterator.Done", err) + } +} + +var errBang = errors.New("bang") + +func errorFetchPage(context.Context, *Table, Schema, uint64, int64, string) (*fetchPageResult, error) { + return nil, errBang +} + +func TestReadError(t *testing.T) { + // test that service read errors are propagated back to the caller. + c := &Client{projectID: "project-id"} + it := c.Dataset("dataset-id").Table("table-id").read(context.Background(), errorFetchPage) + var vals []Value + if err := it.Next(&vals); err != errBang { + t.Fatalf("Get: got: %v: want: %v", err, errBang) + } +} + +func TestReadTabledataOptions(t *testing.T) { + // test that read options are propagated. + s := &pageFetcherReadStub{ + values: [][][]Value{{{1, 2}}}, + } + c := &Client{projectID: "project-id"} + tr := c.Dataset("dataset-id").Table("table-id") + it := tr.read(context.Background(), s.fetchPage) + it.PageInfo().MaxSize = 5 + var vals []Value + if err := it.Next(&vals); err != nil { + t.Fatal(err) + } + want := []pageFetcherArgs{{ + table: tr, + pageSize: 5, + pageToken: "", + }} + if diff := testutil.Diff(s.calls, want, cmp.AllowUnexported(pageFetcherArgs{}, pageFetcherReadStub{}, Table{}, Client{})); diff != "" { + t.Errorf("reading (got=-, want=+):\n%s", diff) + } +} + +func TestReadQueryOptions(t *testing.T) { + // test that read options are propagated. + c := &Client{projectID: "project-id"} + pf := &pageFetcherReadStub{ + values: [][][]Value{{{1, 2}}}, + } + tr := &bq.TableReference{ + ProjectId: "project-id", + DatasetId: "dataset-id", + TableId: "table-id", + } + queryJob := &Job{ + projectID: "project-id", + jobID: "job-id", + c: c, + config: &bq.JobConfiguration{ + Query: &bq.JobConfigurationQuery{DestinationTable: tr}, + }, + } + it, err := queryJob.read(context.Background(), waitForQueryStub, pf.fetchPage) + if err != nil { + t.Fatalf("err calling Read: %v", err) + } + it.PageInfo().MaxSize = 5 + var vals []Value + if err := it.Next(&vals); err != nil { + t.Fatalf("Next: got: %v: want: nil", err) + } + + want := []pageFetcherArgs{{ + table: bqToTable(tr, c), + pageSize: 5, + pageToken: "", + }} + if !testutil.Equal(pf.calls, want, cmp.AllowUnexported(pageFetcherArgs{}, Table{}, Client{})) { + t.Errorf("reading: got:\n%v\nwant:\n%v", pf.calls, want) + } +} diff --git a/vendor/cloud.google.com/go/bigquery/schema.go b/vendor/cloud.google.com/go/bigquery/schema.go new file mode 100644 index 000000000..e84547677 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/schema.go @@ -0,0 +1,488 @@ +// Copyright 2015 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 bigquery + +import ( + "encoding/json" + "errors" + "fmt" + "reflect" + "sync" + + bq "google.golang.org/api/bigquery/v2" +) + +// Schema describes the fields in a table or query result. +type Schema []*FieldSchema + +// FieldSchema describes a single field. +type FieldSchema struct { + // The field name. + // Must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), + // and must start with a letter or underscore. + // The maximum length is 128 characters. + Name string + + // A description of the field. The maximum length is 16,384 characters. + Description string + + // Whether the field may contain multiple values. + Repeated bool + // Whether the field is required. Ignored if Repeated is true. + Required bool + + // The field data type. If Type is Record, then this field contains a nested schema, + // which is described by Schema. + Type FieldType + // Describes the nested schema if Type is set to Record. + Schema Schema +} + +func (fs *FieldSchema) toBQ() *bq.TableFieldSchema { + tfs := &bq.TableFieldSchema{ + Description: fs.Description, + Name: fs.Name, + Type: string(fs.Type), + } + + if fs.Repeated { + tfs.Mode = "REPEATED" + } else if fs.Required { + tfs.Mode = "REQUIRED" + } // else leave as default, which is interpreted as NULLABLE. + + for _, f := range fs.Schema { + tfs.Fields = append(tfs.Fields, f.toBQ()) + } + + return tfs +} + +func (s Schema) toBQ() *bq.TableSchema { + var fields []*bq.TableFieldSchema + for _, f := range s { + fields = append(fields, f.toBQ()) + } + return &bq.TableSchema{Fields: fields} +} + +func bqToFieldSchema(tfs *bq.TableFieldSchema) *FieldSchema { + fs := &FieldSchema{ + Description: tfs.Description, + Name: tfs.Name, + Repeated: tfs.Mode == "REPEATED", + Required: tfs.Mode == "REQUIRED", + Type: FieldType(tfs.Type), + } + + for _, f := range tfs.Fields { + fs.Schema = append(fs.Schema, bqToFieldSchema(f)) + } + return fs +} + +func bqToSchema(ts *bq.TableSchema) Schema { + if ts == nil { + return nil + } + var s Schema + for _, f := range ts.Fields { + s = append(s, bqToFieldSchema(f)) + } + return s +} + +// FieldType is the type of field. +type FieldType string + +const ( + // StringFieldType is a string field type. + StringFieldType FieldType = "STRING" + // BytesFieldType is a bytes field type. + BytesFieldType FieldType = "BYTES" + // IntegerFieldType is a integer field type. + IntegerFieldType FieldType = "INTEGER" + // FloatFieldType is a float field type. + FloatFieldType FieldType = "FLOAT" + // BooleanFieldType is a boolean field type. + BooleanFieldType FieldType = "BOOLEAN" + // TimestampFieldType is a timestamp field type. + TimestampFieldType FieldType = "TIMESTAMP" + // RecordFieldType is a record field type. It is typically used to create columns with repeated or nested data. + RecordFieldType FieldType = "RECORD" + // DateFieldType is a date field type. + DateFieldType FieldType = "DATE" + // TimeFieldType is a time field type. + TimeFieldType FieldType = "TIME" + // DateTimeFieldType is a datetime field type. + DateTimeFieldType FieldType = "DATETIME" + // NumericFieldType is a numeric field type. Numeric types include integer types, floating point types and the + // NUMERIC data type. + NumericFieldType FieldType = "NUMERIC" +) + +var ( + errNoStruct = errors.New("bigquery: can only infer schema from struct or pointer to struct") + errUnsupportedFieldType = errors.New("bigquery: unsupported type of field in struct") + errInvalidFieldName = errors.New("bigquery: invalid name of field in struct") + errBadNullable = errors.New(`bigquery: use "nullable" only for []byte and struct pointers; for all other types, use a NullXXX type`) + errEmptyJSONSchema = errors.New("bigquery: empty JSON schema") + fieldTypes = map[FieldType]bool{ + StringFieldType: true, + BytesFieldType: true, + IntegerFieldType: true, + FloatFieldType: true, + BooleanFieldType: true, + TimestampFieldType: true, + RecordFieldType: true, + DateFieldType: true, + TimeFieldType: true, + DateTimeFieldType: true, + NumericFieldType: true, + } +) + +var typeOfByteSlice = reflect.TypeOf([]byte{}) + +// InferSchema tries to derive a BigQuery schema from the supplied struct value. +// Each exported struct field is mapped to a field in the schema. +// +// The following BigQuery types are inferred from the corresponding Go types. +// (This is the same mapping as that used for RowIterator.Next.) Fields inferred +// from these types are marked required (non-nullable). +// +// STRING string +// BOOL bool +// INTEGER int, int8, int16, int32, int64, uint8, uint16, uint32 +// FLOAT float32, float64 +// BYTES []byte +// TIMESTAMP time.Time +// DATE civil.Date +// TIME civil.Time +// DATETIME civil.DateTime +// NUMERIC *big.Rat +// +// The big.Rat type supports numbers of arbitrary size and precision. Values +// will be rounded to 9 digits after the decimal point before being transmitted +// to BigQuery. See https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#numeric-type +// for more on NUMERIC. +// +// A Go slice or array type is inferred to be a BigQuery repeated field of the +// element type. The element type must be one of the above listed types. +// +// Nullable fields are inferred from the NullXXX types, declared in this package: +// +// STRING NullString +// BOOL NullBool +// INTEGER NullInt64 +// FLOAT NullFloat64 +// TIMESTAMP NullTimestamp +// DATE NullDate +// TIME NullTime +// DATETIME NullDateTime +// +// For a nullable BYTES field, use the type []byte and tag the field "nullable" (see below). +// For a nullable NUMERIC field, use the type *big.Rat and tag the field "nullable". +// +// A struct field that is of struct type is inferred to be a required field of type +// RECORD with a schema inferred recursively. For backwards compatibility, a field of +// type pointer to struct is also inferred to be required. To get a nullable RECORD +// field, use the "nullable" tag (see below). +// +// InferSchema returns an error if any of the examined fields is of type uint, +// uint64, uintptr, map, interface, complex64, complex128, func, or chan. Future +// versions may handle these cases without error. +// +// Recursively defined structs are also disallowed. +// +// Struct fields may be tagged in a way similar to the encoding/json package. +// A tag of the form +// bigquery:"name" +// uses "name" instead of the struct field name as the BigQuery field name. +// A tag of the form +// bigquery:"-" +// omits the field from the inferred schema. +// The "nullable" option marks the field as nullable (not required). It is only +// needed for []byte, *big.Rat and pointer-to-struct fields, and cannot appear on other +// fields. In this example, the Go name of the field is retained: +// bigquery:",nullable" +func InferSchema(st interface{}) (Schema, error) { + return inferSchemaReflectCached(reflect.TypeOf(st)) +} + +var schemaCache sync.Map + +type cacheVal struct { + schema Schema + err error +} + +func inferSchemaReflectCached(t reflect.Type) (Schema, error) { + var cv cacheVal + v, ok := schemaCache.Load(t) + if ok { + cv = v.(cacheVal) + } else { + s, err := inferSchemaReflect(t) + cv = cacheVal{s, err} + schemaCache.Store(t, cv) + } + return cv.schema, cv.err +} + +func inferSchemaReflect(t reflect.Type) (Schema, error) { + rec, err := hasRecursiveType(t, nil) + if err != nil { + return nil, err + } + if rec { + return nil, fmt.Errorf("bigquery: schema inference for recursive type %s", t) + } + return inferStruct(t) +} + +func inferStruct(t reflect.Type) (Schema, error) { + switch t.Kind() { + case reflect.Ptr: + if t.Elem().Kind() != reflect.Struct { + return nil, errNoStruct + } + t = t.Elem() + fallthrough + + case reflect.Struct: + return inferFields(t) + default: + return nil, errNoStruct + } +} + +// inferFieldSchema infers the FieldSchema for a Go type +func inferFieldSchema(rt reflect.Type, nullable bool) (*FieldSchema, error) { + // Only []byte and struct pointers can be tagged nullable. + if nullable && !(rt == typeOfByteSlice || rt.Kind() == reflect.Ptr && rt.Elem().Kind() == reflect.Struct) { + return nil, errBadNullable + } + switch rt { + case typeOfByteSlice: + return &FieldSchema{Required: !nullable, Type: BytesFieldType}, nil + case typeOfGoTime: + return &FieldSchema{Required: true, Type: TimestampFieldType}, nil + case typeOfDate: + return &FieldSchema{Required: true, Type: DateFieldType}, nil + case typeOfTime: + return &FieldSchema{Required: true, Type: TimeFieldType}, nil + case typeOfDateTime: + return &FieldSchema{Required: true, Type: DateTimeFieldType}, nil + case typeOfRat: + return &FieldSchema{Required: !nullable, Type: NumericFieldType}, nil + } + if ft := nullableFieldType(rt); ft != "" { + return &FieldSchema{Required: false, Type: ft}, nil + } + if isSupportedIntType(rt) || isSupportedUintType(rt) { + return &FieldSchema{Required: true, Type: IntegerFieldType}, nil + } + switch rt.Kind() { + case reflect.Slice, reflect.Array: + et := rt.Elem() + if et != typeOfByteSlice && (et.Kind() == reflect.Slice || et.Kind() == reflect.Array) { + // Multi dimensional slices/arrays are not supported by BigQuery + return nil, errUnsupportedFieldType + } + if nullableFieldType(et) != "" { + // Repeated nullable types are not supported by BigQuery. + return nil, errUnsupportedFieldType + } + f, err := inferFieldSchema(et, false) + if err != nil { + return nil, err + } + f.Repeated = true + f.Required = false + return f, nil + case reflect.Ptr: + if rt.Elem().Kind() != reflect.Struct { + return nil, errUnsupportedFieldType + } + fallthrough + case reflect.Struct: + nested, err := inferStruct(rt) + if err != nil { + return nil, err + } + return &FieldSchema{Required: !nullable, Type: RecordFieldType, Schema: nested}, nil + case reflect.String: + return &FieldSchema{Required: !nullable, Type: StringFieldType}, nil + case reflect.Bool: + return &FieldSchema{Required: !nullable, Type: BooleanFieldType}, nil + case reflect.Float32, reflect.Float64: + return &FieldSchema{Required: !nullable, Type: FloatFieldType}, nil + default: + return nil, errUnsupportedFieldType + } +} + +// inferFields extracts all exported field types from struct type. +func inferFields(rt reflect.Type) (Schema, error) { + var s Schema + fields, err := fieldCache.Fields(rt) + if err != nil { + return nil, err + } + for _, field := range fields { + var nullable bool + for _, opt := range field.ParsedTag.([]string) { + if opt == nullableTagOption { + nullable = true + break + } + } + f, err := inferFieldSchema(field.Type, nullable) + if err != nil { + return nil, err + } + f.Name = field.Name + s = append(s, f) + } + return s, nil +} + +// isSupportedIntType reports whether t is an int type that can be properly +// represented by the BigQuery INTEGER/INT64 type. +func isSupportedIntType(t reflect.Type) bool { + switch t.Kind() { + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + return true + default: + return false + } +} + +// isSupportedIntType reports whether t is a uint type that can be properly +// represented by the BigQuery INTEGER/INT64 type. +func isSupportedUintType(t reflect.Type) bool { + switch t.Kind() { + case reflect.Uint8, reflect.Uint16, reflect.Uint32: + return true + default: + return false + } +} + +// typeList is a linked list of reflect.Types. +type typeList struct { + t reflect.Type + next *typeList +} + +func (l *typeList) has(t reflect.Type) bool { + for l != nil { + if l.t == t { + return true + } + l = l.next + } + return false +} + +// hasRecursiveType reports whether t or any type inside t refers to itself, directly or indirectly, +// via exported fields. (Schema inference ignores unexported fields.) +func hasRecursiveType(t reflect.Type, seen *typeList) (bool, error) { + for t.Kind() == reflect.Ptr || t.Kind() == reflect.Slice || t.Kind() == reflect.Array { + t = t.Elem() + } + if t.Kind() != reflect.Struct { + return false, nil + } + if seen.has(t) { + return true, nil + } + fields, err := fieldCache.Fields(t) + if err != nil { + return false, err + } + seen = &typeList{t, seen} + // Because seen is a linked list, additions to it from one field's + // recursive call will not affect the value for subsequent fields' calls. + for _, field := range fields { + ok, err := hasRecursiveType(field.Type, seen) + if err != nil { + return false, err + } + if ok { + return true, nil + } + } + return false, nil +} + +// bigQuerySchemaJSONField is an individual field in a JSON BigQuery table schema definition +// (as generated by https://github.com/GoogleCloudPlatform/protoc-gen-bq-schema). +type bigQueryJSONField struct { + Description string `json:"description"` + Fields []bigQueryJSONField `json:"fields"` + Mode string `json:"mode"` + Name string `json:"name"` + Type string `json:"type"` +} + +// convertSchemaFromJSON generates a Schema: +func convertSchemaFromJSON(fs []bigQueryJSONField) (Schema, error) { + convertedSchema := Schema{} + for _, f := range fs { + convertedFieldSchema := &FieldSchema{ + Description: f.Description, + Name: f.Name, + Required: f.Mode == "REQUIRED", + Repeated: f.Mode == "REPEATED", + } + if len(f.Fields) > 0 { + convertedNestedFieldSchema, err := convertSchemaFromJSON(f.Fields) + if err != nil { + return nil, err + } + convertedFieldSchema.Schema = convertedNestedFieldSchema + } + + // Check that the field-type (string) maps to a known FieldType: + if _, ok := fieldTypes[FieldType(f.Type)]; !ok { + return nil, fmt.Errorf("unknown field type (%v)", f.Type) + } + convertedFieldSchema.Type = FieldType(f.Type) + + convertedSchema = append(convertedSchema, convertedFieldSchema) + } + return convertedSchema, nil +} + +// SchemaFromJSON takes a JSON BigQuery table schema definition +// (as generated by https://github.com/GoogleCloudPlatform/protoc-gen-bq-schema) +// and returns a fully-populated Schema. +func SchemaFromJSON(schemaJSON []byte) (Schema, error) { + + var bigQuerySchema []bigQueryJSONField + + // Make sure we actually have some content: + if len(schemaJSON) == 0 { + return nil, errEmptyJSONSchema + } + + if err := json.Unmarshal(schemaJSON, &bigQuerySchema); err != nil { + return nil, err + } + + return convertSchemaFromJSON(bigQuerySchema) +} diff --git a/vendor/cloud.google.com/go/bigquery/schema_test.go b/vendor/cloud.google.com/go/bigquery/schema_test.go new file mode 100644 index 000000000..3a14a5ecb --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/schema_test.go @@ -0,0 +1,1054 @@ +// Copyright 2015 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 bigquery + +import ( + "fmt" + "math/big" + "reflect" + "testing" + "time" + + "cloud.google.com/go/civil" + "cloud.google.com/go/internal/pretty" + "cloud.google.com/go/internal/testutil" + bq "google.golang.org/api/bigquery/v2" +) + +func (fs *FieldSchema) GoString() string { + if fs == nil { + return "" + } + + return fmt.Sprintf("{Name:%s Description:%s Repeated:%t Required:%t Type:%s Schema:%s}", + fs.Name, + fs.Description, + fs.Repeated, + fs.Required, + fs.Type, + fmt.Sprintf("%#v", fs.Schema), + ) +} + +func bqTableFieldSchema(desc, name, typ, mode string) *bq.TableFieldSchema { + return &bq.TableFieldSchema{ + Description: desc, + Name: name, + Mode: mode, + Type: typ, + } +} + +func fieldSchema(desc, name, typ string, repeated, required bool) *FieldSchema { + return &FieldSchema{ + Description: desc, + Name: name, + Repeated: repeated, + Required: required, + Type: FieldType(typ), + } +} + +func TestSchemaConversion(t *testing.T) { + testCases := []struct { + schema Schema + bqSchema *bq.TableSchema + }{ + { + // required + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "name", "STRING", "REQUIRED"), + }, + }, + schema: Schema{ + fieldSchema("desc", "name", "STRING", false, true), + }, + }, + { + // repeated + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "name", "STRING", "REPEATED"), + }, + }, + schema: Schema{ + fieldSchema("desc", "name", "STRING", true, false), + }, + }, + { + // nullable, string + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "name", "STRING", ""), + }, + }, + schema: Schema{ + fieldSchema("desc", "name", "STRING", false, false), + }, + }, + { + // integer + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "name", "INTEGER", ""), + }, + }, + schema: Schema{ + fieldSchema("desc", "name", "INTEGER", false, false), + }, + }, + { + // float + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "name", "FLOAT", ""), + }, + }, + schema: Schema{ + fieldSchema("desc", "name", "FLOAT", false, false), + }, + }, + { + // boolean + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "name", "BOOLEAN", ""), + }, + }, + schema: Schema{ + fieldSchema("desc", "name", "BOOLEAN", false, false), + }, + }, + { + // timestamp + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "name", "TIMESTAMP", ""), + }, + }, + schema: Schema{ + fieldSchema("desc", "name", "TIMESTAMP", false, false), + }, + }, + { + // civil times + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "f1", "TIME", ""), + bqTableFieldSchema("desc", "f2", "DATE", ""), + bqTableFieldSchema("desc", "f3", "DATETIME", ""), + }, + }, + schema: Schema{ + fieldSchema("desc", "f1", "TIME", false, false), + fieldSchema("desc", "f2", "DATE", false, false), + fieldSchema("desc", "f3", "DATETIME", false, false), + }, + }, + { + // numeric + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "n", "NUMERIC", ""), + }, + }, + schema: Schema{ + fieldSchema("desc", "n", "NUMERIC", false, false), + }, + }, + { + // nested + bqSchema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + { + Description: "An outer schema wrapping a nested schema", + Name: "outer", + Mode: "REQUIRED", + Type: "RECORD", + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("inner field", "inner", "STRING", ""), + }, + }, + }, + }, + schema: Schema{ + &FieldSchema{ + Description: "An outer schema wrapping a nested schema", + Name: "outer", + Required: true, + Type: "RECORD", + Schema: Schema{ + { + Description: "inner field", + Name: "inner", + Type: "STRING", + }, + }, + }, + }, + }, + } + for _, tc := range testCases { + bqSchema := tc.schema.toBQ() + if !testutil.Equal(bqSchema, tc.bqSchema) { + t.Errorf("converting to TableSchema: got:\n%v\nwant:\n%v", + pretty.Value(bqSchema), pretty.Value(tc.bqSchema)) + } + schema := bqToSchema(tc.bqSchema) + if !testutil.Equal(schema, tc.schema) { + t.Errorf("converting to Schema: got:\n%v\nwant:\n%v", schema, tc.schema) + } + } +} + +type allStrings struct { + String string + ByteSlice []byte +} + +type allSignedIntegers struct { + Int64 int64 + Int32 int32 + Int16 int16 + Int8 int8 + Int int +} + +type allUnsignedIntegers struct { + Uint32 uint32 + Uint16 uint16 + Uint8 uint8 +} + +type allFloat struct { + Float64 float64 + Float32 float32 + // NOTE: Complex32 and Complex64 are unsupported by BigQuery +} + +type allBoolean struct { + Bool bool +} + +type allTime struct { + Timestamp time.Time + Time civil.Time + Date civil.Date + DateTime civil.DateTime +} + +type allNumeric struct { + Numeric *big.Rat +} + +func reqField(name, typ string) *FieldSchema { + return &FieldSchema{ + Name: name, + Type: FieldType(typ), + Required: true, + } +} + +func optField(name, typ string) *FieldSchema { + return &FieldSchema{ + Name: name, + Type: FieldType(typ), + Required: false, + } +} + +func TestSimpleInference(t *testing.T) { + testCases := []struct { + in interface{} + want Schema + }{ + { + in: allSignedIntegers{}, + want: Schema{ + reqField("Int64", "INTEGER"), + reqField("Int32", "INTEGER"), + reqField("Int16", "INTEGER"), + reqField("Int8", "INTEGER"), + reqField("Int", "INTEGER"), + }, + }, + { + in: allUnsignedIntegers{}, + want: Schema{ + reqField("Uint32", "INTEGER"), + reqField("Uint16", "INTEGER"), + reqField("Uint8", "INTEGER"), + }, + }, + { + in: allFloat{}, + want: Schema{ + reqField("Float64", "FLOAT"), + reqField("Float32", "FLOAT"), + }, + }, + { + in: allBoolean{}, + want: Schema{ + reqField("Bool", "BOOLEAN"), + }, + }, + { + in: &allBoolean{}, + want: Schema{ + reqField("Bool", "BOOLEAN"), + }, + }, + { + in: allTime{}, + want: Schema{ + reqField("Timestamp", "TIMESTAMP"), + reqField("Time", "TIME"), + reqField("Date", "DATE"), + reqField("DateTime", "DATETIME"), + }, + }, + { + in: &allNumeric{}, + want: Schema{ + reqField("Numeric", "NUMERIC"), + }, + }, + { + in: allStrings{}, + want: Schema{ + reqField("String", "STRING"), + reqField("ByteSlice", "BYTES"), + }, + }, + } + for _, tc := range testCases { + got, err := InferSchema(tc.in) + if err != nil { + t.Fatalf("%T: error inferring TableSchema: %v", tc.in, err) + } + if !testutil.Equal(got, tc.want) { + t.Errorf("%T: inferring TableSchema: got:\n%#v\nwant:\n%#v", tc.in, + pretty.Value(got), pretty.Value(tc.want)) + } + } +} + +type containsNested struct { + hidden string + NotNested int + Nested struct { + Inside int + } +} + +type containsDoubleNested struct { + NotNested int + Nested struct { + InsideNested struct { + Inside int + } + } +} + +type ptrNested struct { + Ptr *struct{ Inside int } +} + +type dup struct { // more than one field of the same struct type + A, B allBoolean +} + +func TestNestedInference(t *testing.T) { + testCases := []struct { + in interface{} + want Schema + }{ + { + in: containsNested{}, + want: Schema{ + reqField("NotNested", "INTEGER"), + &FieldSchema{ + Name: "Nested", + Required: true, + Type: "RECORD", + Schema: Schema{reqField("Inside", "INTEGER")}, + }, + }, + }, + { + in: containsDoubleNested{}, + want: Schema{ + reqField("NotNested", "INTEGER"), + &FieldSchema{ + Name: "Nested", + Required: true, + Type: "RECORD", + Schema: Schema{ + { + Name: "InsideNested", + Required: true, + Type: "RECORD", + Schema: Schema{reqField("Inside", "INTEGER")}, + }, + }, + }, + }, + }, + { + in: ptrNested{}, + want: Schema{ + &FieldSchema{ + Name: "Ptr", + Required: true, + Type: "RECORD", + Schema: Schema{reqField("Inside", "INTEGER")}, + }, + }, + }, + { + in: dup{}, + want: Schema{ + &FieldSchema{ + Name: "A", + Required: true, + Type: "RECORD", + Schema: Schema{reqField("Bool", "BOOLEAN")}, + }, + &FieldSchema{ + Name: "B", + Required: true, + Type: "RECORD", + Schema: Schema{reqField("Bool", "BOOLEAN")}, + }, + }, + }, + } + + for _, tc := range testCases { + got, err := InferSchema(tc.in) + if err != nil { + t.Fatalf("%T: error inferring TableSchema: %v", tc.in, err) + } + if !testutil.Equal(got, tc.want) { + t.Errorf("%T: inferring TableSchema: got:\n%#v\nwant:\n%#v", tc.in, + pretty.Value(got), pretty.Value(tc.want)) + } + } +} + +type repeated struct { + NotRepeated []byte + RepeatedByteSlice [][]byte + Slice []int + Array [5]bool +} + +type nestedRepeated struct { + NotRepeated int + Repeated []struct { + Inside int + } + RepeatedPtr []*struct{ Inside int } +} + +func repField(name, typ string) *FieldSchema { + return &FieldSchema{ + Name: name, + Type: FieldType(typ), + Repeated: true, + } +} + +func TestRepeatedInference(t *testing.T) { + testCases := []struct { + in interface{} + want Schema + }{ + { + in: repeated{}, + want: Schema{ + reqField("NotRepeated", "BYTES"), + repField("RepeatedByteSlice", "BYTES"), + repField("Slice", "INTEGER"), + repField("Array", "BOOLEAN"), + }, + }, + { + in: nestedRepeated{}, + want: Schema{ + reqField("NotRepeated", "INTEGER"), + { + Name: "Repeated", + Repeated: true, + Type: "RECORD", + Schema: Schema{reqField("Inside", "INTEGER")}, + }, + { + Name: "RepeatedPtr", + Repeated: true, + Type: "RECORD", + Schema: Schema{reqField("Inside", "INTEGER")}, + }, + }, + }, + } + + for i, tc := range testCases { + got, err := InferSchema(tc.in) + if err != nil { + t.Fatalf("%d: error inferring TableSchema: %v", i, err) + } + if !testutil.Equal(got, tc.want) { + t.Errorf("%d: inferring TableSchema: got:\n%#v\nwant:\n%#v", i, + pretty.Value(got), pretty.Value(tc.want)) + } + } +} + +type allNulls struct { + A NullInt64 + B NullFloat64 + C NullBool + D NullString + E NullTimestamp + F NullTime + G NullDate + H NullDateTime +} + +func TestNullInference(t *testing.T) { + got, err := InferSchema(allNulls{}) + if err != nil { + t.Fatal(err) + } + want := Schema{ + optField("A", "INTEGER"), + optField("B", "FLOAT"), + optField("C", "BOOLEAN"), + optField("D", "STRING"), + optField("E", "TIMESTAMP"), + optField("F", "TIME"), + optField("G", "DATE"), + optField("H", "DATETIME"), + } + if diff := testutil.Diff(got, want); diff != "" { + t.Error(diff) + } +} + +type Embedded struct { + Embedded int +} + +type embedded struct { + Embedded2 int +} + +type nestedEmbedded struct { + Embedded + embedded +} + +func TestEmbeddedInference(t *testing.T) { + got, err := InferSchema(nestedEmbedded{}) + if err != nil { + t.Fatal(err) + } + want := Schema{ + reqField("Embedded", "INTEGER"), + reqField("Embedded2", "INTEGER"), + } + if !testutil.Equal(got, want) { + t.Errorf("got %v, want %v", pretty.Value(got), pretty.Value(want)) + } +} + +func TestRecursiveInference(t *testing.T) { + type List struct { + Val int + Next *List + } + + _, err := InferSchema(List{}) + if err == nil { + t.Fatal("got nil, want error") + } +} + +type withTags struct { + NoTag int + ExcludeTag int `bigquery:"-"` + SimpleTag int `bigquery:"simple_tag"` + UnderscoreTag int `bigquery:"_id"` + MixedCase int `bigquery:"MIXEDcase"` + Nullable []byte `bigquery:",nullable"` + NullNumeric *big.Rat `bigquery:",nullable"` +} + +type withTagsNested struct { + Nested withTags `bigquery:"nested"` + NestedAnonymous struct { + ExcludeTag int `bigquery:"-"` + Inside int `bigquery:"inside"` + } `bigquery:"anon"` + PNested *struct{ X int } // not nullable, for backwards compatibility + PNestedNullable *struct{ X int } `bigquery:",nullable"` +} + +type withTagsRepeated struct { + Repeated []withTags `bigquery:"repeated"` + RepeatedAnonymous []struct { + ExcludeTag int `bigquery:"-"` + Inside int `bigquery:"inside"` + } `bigquery:"anon"` +} + +type withTagsEmbedded struct { + withTags +} + +var withTagsSchema = Schema{ + reqField("NoTag", "INTEGER"), + reqField("simple_tag", "INTEGER"), + reqField("_id", "INTEGER"), + reqField("MIXEDcase", "INTEGER"), + optField("Nullable", "BYTES"), + optField("NullNumeric", "NUMERIC"), +} + +func TestTagInference(t *testing.T) { + testCases := []struct { + in interface{} + want Schema + }{ + { + in: withTags{}, + want: withTagsSchema, + }, + { + in: withTagsNested{}, + want: Schema{ + &FieldSchema{ + Name: "nested", + Required: true, + Type: "RECORD", + Schema: withTagsSchema, + }, + &FieldSchema{ + Name: "anon", + Required: true, + Type: "RECORD", + Schema: Schema{reqField("inside", "INTEGER")}, + }, + &FieldSchema{ + Name: "PNested", + Required: true, + Type: "RECORD", + Schema: Schema{reqField("X", "INTEGER")}, + }, + &FieldSchema{ + Name: "PNestedNullable", + Required: false, + Type: "RECORD", + Schema: Schema{reqField("X", "INTEGER")}, + }, + }, + }, + { + in: withTagsRepeated{}, + want: Schema{ + &FieldSchema{ + Name: "repeated", + Repeated: true, + Type: "RECORD", + Schema: withTagsSchema, + }, + &FieldSchema{ + Name: "anon", + Repeated: true, + Type: "RECORD", + Schema: Schema{reqField("inside", "INTEGER")}, + }, + }, + }, + { + in: withTagsEmbedded{}, + want: withTagsSchema, + }, + } + for i, tc := range testCases { + got, err := InferSchema(tc.in) + if err != nil { + t.Fatalf("%d: error inferring TableSchema: %v", i, err) + } + if !testutil.Equal(got, tc.want) { + t.Errorf("%d: inferring TableSchema: got:\n%#v\nwant:\n%#v", i, + pretty.Value(got), pretty.Value(tc.want)) + } + } +} + +func TestTagInferenceErrors(t *testing.T) { + testCases := []struct { + in interface{} + err error + }{ + { + in: struct { + LongTag int `bigquery:"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy"` + }{}, + err: errInvalidFieldName, + }, + { + in: struct { + UnsupporedStartChar int `bigquery:"øab"` + }{}, + err: errInvalidFieldName, + }, + { + in: struct { + UnsupportedEndChar int `bigquery:"abø"` + }{}, + err: errInvalidFieldName, + }, + { + in: struct { + UnsupportedMiddleChar int `bigquery:"aøb"` + }{}, + err: errInvalidFieldName, + }, + { + in: struct { + StartInt int `bigquery:"1abc"` + }{}, + err: errInvalidFieldName, + }, + { + in: struct { + Hyphens int `bigquery:"a-b"` + }{}, + err: errInvalidFieldName, + }, + } + for i, tc := range testCases { + want := tc.err + _, got := InferSchema(tc.in) + if got != want { + t.Errorf("%d: inferring TableSchema: got:\n%#v\nwant:\n%#v", i, got, want) + } + } + + _, err := InferSchema(struct { + X int `bigquery:",optional"` + }{}) + if err == nil { + t.Error("got nil, want error") + } +} + +func TestSchemaErrors(t *testing.T) { + testCases := []struct { + in interface{} + err error + }{ + { + in: []byte{}, + err: errNoStruct, + }, + { + in: new(int), + err: errNoStruct, + }, + { + in: struct{ Uint uint }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ Uint64 uint64 }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ Uintptr uintptr }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ Complex complex64 }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ Map map[string]int }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ Chan chan bool }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ Ptr *int }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ Interface interface{} }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ MultiDimensional [][]int }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ MultiDimensional [][][]byte }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ SliceOfPointer []*int }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ SliceOfNull []NullInt64 }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ ChanSlice []chan bool }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ NestedChan struct{ Chan []chan bool } }{}, + err: errUnsupportedFieldType, + }, + { + in: struct { + X int `bigquery:",nullable"` + }{}, + err: errBadNullable, + }, + { + in: struct { + X bool `bigquery:",nullable"` + }{}, + err: errBadNullable, + }, + { + in: struct { + X struct{ N int } `bigquery:",nullable"` + }{}, + err: errBadNullable, + }, + { + in: struct { + X []int `bigquery:",nullable"` + }{}, + err: errBadNullable, + }, + { + in: struct{ X *[]byte }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ X *[]int }{}, + err: errUnsupportedFieldType, + }, + { + in: struct{ X *int }{}, + err: errUnsupportedFieldType, + }, + } + for _, tc := range testCases { + want := tc.err + _, got := InferSchema(tc.in) + if got != want { + t.Errorf("%#v: got:\n%#v\nwant:\n%#v", tc.in, got, want) + } + } +} + +func TestHasRecursiveType(t *testing.T) { + type ( + nonStruct int + nonRec struct{ A string } + dup struct{ A, B nonRec } + rec struct { + A int + B *rec + } + recUnexported struct { + A int + b *rec + } + hasRec struct { + A int + R *rec + } + recSlicePointer struct { + A []*recSlicePointer + } + ) + for _, test := range []struct { + in interface{} + want bool + }{ + {nonStruct(0), false}, + {nonRec{}, false}, + {dup{}, false}, + {rec{}, true}, + {recUnexported{}, false}, + {hasRec{}, true}, + {&recSlicePointer{}, true}, + } { + got, err := hasRecursiveType(reflect.TypeOf(test.in), nil) + if err != nil { + t.Fatal(err) + } + if got != test.want { + t.Errorf("%T: got %t, want %t", test.in, got, test.want) + } + } +} + +func TestSchemaFromJSON(t *testing.T) { + testCasesExpectingSuccess := []struct { + bqSchemaJSON []byte + description string + expectedSchema Schema + }{ + { + description: "Flat table with a mixture of NULLABLE and REQUIRED fields", + bqSchemaJSON: []byte(` +[ + {"name":"flat_string","type":"STRING","mode":"NULLABLE","description":"Flat nullable string"}, + {"name":"flat_bytes","type":"BYTES","mode":"REQUIRED","description":"Flat required BYTES"}, + {"name":"flat_integer","type":"INTEGER","mode":"NULLABLE","description":"Flat nullable INTEGER"}, + {"name":"flat_float","type":"FLOAT","mode":"REQUIRED","description":"Flat required FLOAT"}, + {"name":"flat_boolean","type":"BOOLEAN","mode":"NULLABLE","description":"Flat nullable BOOLEAN"}, + {"name":"flat_timestamp","type":"TIMESTAMP","mode":"REQUIRED","description":"Flat required TIMESTAMP"}, + {"name":"flat_date","type":"DATE","mode":"NULLABLE","description":"Flat required DATE"}, + {"name":"flat_time","type":"TIME","mode":"REQUIRED","description":"Flat nullable TIME"}, + {"name":"flat_datetime","type":"DATETIME","mode":"NULLABLE","description":"Flat required DATETIME"}, + {"name":"flat_numeric","type":"NUMERIC","mode":"REQUIRED","description":"Flat nullable NUMERIC"} +]`), + expectedSchema: Schema{ + fieldSchema("Flat nullable string", "flat_string", "STRING", false, false), + fieldSchema("Flat required BYTES", "flat_bytes", "BYTES", false, true), + fieldSchema("Flat nullable INTEGER", "flat_integer", "INTEGER", false, false), + fieldSchema("Flat required FLOAT", "flat_float", "FLOAT", false, true), + fieldSchema("Flat nullable BOOLEAN", "flat_boolean", "BOOLEAN", false, false), + fieldSchema("Flat required TIMESTAMP", "flat_timestamp", "TIMESTAMP", false, true), + fieldSchema("Flat required DATE", "flat_date", "DATE", false, false), + fieldSchema("Flat nullable TIME", "flat_time", "TIME", false, true), + fieldSchema("Flat required DATETIME", "flat_datetime", "DATETIME", false, false), + fieldSchema("Flat nullable NUMERIC", "flat_numeric", "NUMERIC", false, true), + }, + }, + { + description: "Table with a nested RECORD", + bqSchemaJSON: []byte(` +[ + {"name":"flat_string","type":"STRING","mode":"NULLABLE","description":"Flat nullable string"}, + {"name":"nested_record","type":"RECORD","mode":"NULLABLE","description":"Nested nullable RECORD","fields":[{"name":"record_field_1","type":"STRING","mode":"NULLABLE","description":"First nested record field"},{"name":"record_field_2","type":"INTEGER","mode":"REQUIRED","description":"Second nested record field"}]} +]`), + expectedSchema: Schema{ + fieldSchema("Flat nullable string", "flat_string", "STRING", false, false), + &FieldSchema{ + Description: "Nested nullable RECORD", + Name: "nested_record", + Required: false, + Type: "RECORD", + Schema: Schema{ + { + Description: "First nested record field", + Name: "record_field_1", + Required: false, + Type: "STRING", + }, + { + Description: "Second nested record field", + Name: "record_field_2", + Required: true, + Type: "INTEGER", + }, + }, + }, + }, + }, + { + description: "Table with a repeated RECORD", + bqSchemaJSON: []byte(` +[ + {"name":"flat_string","type":"STRING","mode":"NULLABLE","description":"Flat nullable string"}, + {"name":"nested_record","type":"RECORD","mode":"REPEATED","description":"Nested nullable RECORD","fields":[{"name":"record_field_1","type":"STRING","mode":"NULLABLE","description":"First nested record field"},{"name":"record_field_2","type":"INTEGER","mode":"REQUIRED","description":"Second nested record field"}]} +]`), + expectedSchema: Schema{ + fieldSchema("Flat nullable string", "flat_string", "STRING", false, false), + &FieldSchema{ + Description: "Nested nullable RECORD", + Name: "nested_record", + Repeated: true, + Required: false, + Type: "RECORD", + Schema: Schema{ + { + Description: "First nested record field", + Name: "record_field_1", + Required: false, + Type: "STRING", + }, + { + Description: "Second nested record field", + Name: "record_field_2", + Required: true, + Type: "INTEGER", + }, + }, + }, + }, + }, + } + for _, tc := range testCasesExpectingSuccess { + convertedSchema, err := SchemaFromJSON(tc.bqSchemaJSON) + if err != nil { + t.Errorf("encountered an error when converting JSON table schema (%s): %v", tc.description, err) + continue + } + if !testutil.Equal(convertedSchema, tc.expectedSchema) { + t.Errorf("generated JSON table schema (%s) differs from the expected schema", tc.description) + } + } + + testCasesExpectingFailure := []struct { + bqSchemaJSON []byte + description string + }{ + { + description: "Schema with invalid JSON", + bqSchemaJSON: []byte(`This is not JSON`), + }, + { + description: "Schema with unknown field type", + bqSchemaJSON: []byte(`[{"name":"strange_type","type":"STRANGE","description":"This type should not exist"}]`), + }, + { + description: "Schema with zero length", + bqSchemaJSON: []byte(``), + }, + } + for _, tc := range testCasesExpectingFailure { + _, err := SchemaFromJSON(tc.bqSchemaJSON) + if err == nil { + t.Errorf("converting this schema should have returned an error (%s): %v", tc.description, err) + continue + } + } +} diff --git a/vendor/cloud.google.com/go/bigquery/table.go b/vendor/cloud.google.com/go/bigquery/table.go new file mode 100644 index 000000000..6181f460b --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/table.go @@ -0,0 +1,617 @@ +// Copyright 2015 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 bigquery + +import ( + "context" + "errors" + "fmt" + "time" + + "cloud.google.com/go/internal/optional" + "cloud.google.com/go/internal/trace" + bq "google.golang.org/api/bigquery/v2" +) + +// A Table is a reference to a BigQuery table. +type Table struct { + // ProjectID, DatasetID and TableID may be omitted if the Table is the destination for a query. + // In this case the result will be stored in an ephemeral table. + ProjectID string + DatasetID string + // TableID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). + // The maximum length is 1,024 characters. + TableID string + + c *Client +} + +// TableMetadata contains information about a BigQuery table. +type TableMetadata struct { + // The following fields can be set when creating a table. + + // The user-friendly name for the table. + Name string + + // The user-friendly description of the table. + Description string + + // The table schema. If provided on create, ViewQuery must be empty. + Schema Schema + + // The query to use for a view. If provided on create, Schema must be nil. + ViewQuery string + + // Use Legacy SQL for the view query. + // At most one of UseLegacySQL and UseStandardSQL can be true. + UseLegacySQL bool + + // Use Legacy SQL for the view query. The default. + // At most one of UseLegacySQL and UseStandardSQL can be true. + // Deprecated: use UseLegacySQL. + UseStandardSQL bool + + // If non-nil, the table is partitioned by time. + TimePartitioning *TimePartitioning + + // Clustering specifies the data clustering configuration for the table. + Clustering *Clustering + + // The time when this table expires. If set, this table will expire at the + // specified time. Expired tables will be deleted and their storage + // reclaimed. The zero value is ignored. + ExpirationTime time.Time + + // User-provided labels. + Labels map[string]string + + // Information about a table stored outside of BigQuery. + ExternalDataConfig *ExternalDataConfig + + // Custom encryption configuration (e.g., Cloud KMS keys). + EncryptionConfig *EncryptionConfig + + // All the fields below are read-only. + + FullID string // An opaque ID uniquely identifying the table. + Type TableType + CreationTime time.Time + LastModifiedTime time.Time + + // The size of the table in bytes. + // This does not include data that is being buffered during a streaming insert. + NumBytes int64 + + // The number of rows of data in this table. + // This does not include data that is being buffered during a streaming insert. + NumRows uint64 + + // Contains information regarding this table's streaming buffer, if one is + // present. This field will be nil if the table is not being streamed to or if + // there is no data in the streaming buffer. + StreamingBuffer *StreamingBuffer + + // ETag is the ETag obtained when reading metadata. Pass it to Table.Update to + // ensure that the metadata hasn't changed since it was read. + ETag string +} + +// TableCreateDisposition specifies the circumstances under which destination table will be created. +// Default is CreateIfNeeded. +type TableCreateDisposition string + +const ( + // CreateIfNeeded will create the table if it does not already exist. + // Tables are created atomically on successful completion of a job. + CreateIfNeeded TableCreateDisposition = "CREATE_IF_NEEDED" + + // CreateNever ensures the table must already exist and will not be + // automatically created. + CreateNever TableCreateDisposition = "CREATE_NEVER" +) + +// TableWriteDisposition specifies how existing data in a destination table is treated. +// Default is WriteAppend. +type TableWriteDisposition string + +const ( + // WriteAppend will append to any existing data in the destination table. + // Data is appended atomically on successful completion of a job. + WriteAppend TableWriteDisposition = "WRITE_APPEND" + + // WriteTruncate overrides the existing data in the destination table. + // Data is overwritten atomically on successful completion of a job. + WriteTruncate TableWriteDisposition = "WRITE_TRUNCATE" + + // WriteEmpty fails writes if the destination table already contains data. + WriteEmpty TableWriteDisposition = "WRITE_EMPTY" +) + +// TableType is the type of table. +type TableType string + +const ( + // RegularTable is a regular table. + RegularTable TableType = "TABLE" + // ViewTable is a table type describing that the table is view. See more + // information at https://cloud.google.com/bigquery/docs/views. + ViewTable TableType = "VIEW" + // ExternalTable is a table type describing that the table is an external + // table (also known as a federated data source). See more information at + // https://cloud.google.com/bigquery/external-data-sources. + ExternalTable TableType = "EXTERNAL" +) + +// TimePartitioning describes the time-based date partitioning on a table. +// For more information see: https://cloud.google.com/bigquery/docs/creating-partitioned-tables. +type TimePartitioning struct { + // The amount of time to keep the storage for a partition. + // If the duration is empty (0), the data in the partitions do not expire. + Expiration time.Duration + + // If empty, the table is partitioned by pseudo column '_PARTITIONTIME'; if set, the + // table is partitioned by this field. The field must be a top-level TIMESTAMP or + // DATE field. Its mode must be NULLABLE or REQUIRED. + Field string + + // If true, queries that reference this table must include a filter (e.g. a WHERE predicate) + // that can be used for partition elimination. + RequirePartitionFilter bool +} + +func (p *TimePartitioning) toBQ() *bq.TimePartitioning { + if p == nil { + return nil + } + return &bq.TimePartitioning{ + Type: "DAY", + ExpirationMs: int64(p.Expiration / time.Millisecond), + Field: p.Field, + RequirePartitionFilter: p.RequirePartitionFilter, + } +} + +func bqToTimePartitioning(q *bq.TimePartitioning) *TimePartitioning { + if q == nil { + return nil + } + return &TimePartitioning{ + Expiration: time.Duration(q.ExpirationMs) * time.Millisecond, + Field: q.Field, + RequirePartitionFilter: q.RequirePartitionFilter, + } +} + +// Clustering governs the organization of data within a partitioned table. +// For more information, see https://cloud.google.com/bigquery/docs/clustered-tables +type Clustering struct { + Fields []string +} + +func (c *Clustering) toBQ() *bq.Clustering { + if c == nil { + return nil + } + return &bq.Clustering{ + Fields: c.Fields, + } +} + +func bqToClustering(q *bq.Clustering) *Clustering { + if q == nil { + return nil + } + return &Clustering{ + Fields: q.Fields, + } +} + +// EncryptionConfig configures customer-managed encryption on tables. +type EncryptionConfig struct { + // Describes the Cloud KMS encryption key that will be used to protect + // destination BigQuery table. The BigQuery Service Account associated with your + // project requires access to this encryption key. + KMSKeyName string +} + +func (e *EncryptionConfig) toBQ() *bq.EncryptionConfiguration { + if e == nil { + return nil + } + return &bq.EncryptionConfiguration{ + KmsKeyName: e.KMSKeyName, + } +} + +func bqToEncryptionConfig(q *bq.EncryptionConfiguration) *EncryptionConfig { + if q == nil { + return nil + } + return &EncryptionConfig{ + KMSKeyName: q.KmsKeyName, + } +} + +// StreamingBuffer holds information about the streaming buffer. +type StreamingBuffer struct { + // A lower-bound estimate of the number of bytes currently in the streaming + // buffer. + EstimatedBytes uint64 + + // A lower-bound estimate of the number of rows currently in the streaming + // buffer. + EstimatedRows uint64 + + // The time of the oldest entry in the streaming buffer. + OldestEntryTime time.Time +} + +func (t *Table) toBQ() *bq.TableReference { + return &bq.TableReference{ + ProjectId: t.ProjectID, + DatasetId: t.DatasetID, + TableId: t.TableID, + } +} + +// FullyQualifiedName returns the ID of the table in projectID:datasetID.tableID format. +func (t *Table) FullyQualifiedName() string { + return fmt.Sprintf("%s:%s.%s", t.ProjectID, t.DatasetID, t.TableID) +} + +// implicitTable reports whether Table is an empty placeholder, which signifies that a new table should be created with an auto-generated Table ID. +func (t *Table) implicitTable() bool { + return t.ProjectID == "" && t.DatasetID == "" && t.TableID == "" +} + +// Create creates a table in the BigQuery service. +// Pass in a TableMetadata value to configure the table. +// If tm.View.Query is non-empty, the created table will be of type VIEW. +// If no ExpirationTime is specified, the table will never expire. +// After table creation, a view can be modified only if its table was initially created +// with a view. +func (t *Table) Create(ctx context.Context, tm *TableMetadata) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Table.Create") + defer func() { trace.EndSpan(ctx, err) }() + + table, err := tm.toBQ() + if err != nil { + return err + } + table.TableReference = &bq.TableReference{ + ProjectId: t.ProjectID, + DatasetId: t.DatasetID, + TableId: t.TableID, + } + req := t.c.bqs.Tables.Insert(t.ProjectID, t.DatasetID, table).Context(ctx) + setClientHeader(req.Header()) + _, err = req.Do() + return err +} + +func (tm *TableMetadata) toBQ() (*bq.Table, error) { + t := &bq.Table{} + if tm == nil { + return t, nil + } + if tm.Schema != nil && tm.ViewQuery != "" { + return nil, errors.New("bigquery: provide Schema or ViewQuery, not both") + } + t.FriendlyName = tm.Name + t.Description = tm.Description + t.Labels = tm.Labels + if tm.Schema != nil { + t.Schema = tm.Schema.toBQ() + } + if tm.ViewQuery != "" { + if tm.UseStandardSQL && tm.UseLegacySQL { + return nil, errors.New("bigquery: cannot provide both UseStandardSQL and UseLegacySQL") + } + t.View = &bq.ViewDefinition{Query: tm.ViewQuery} + if tm.UseLegacySQL { + t.View.UseLegacySql = true + } else { + t.View.UseLegacySql = false + t.View.ForceSendFields = append(t.View.ForceSendFields, "UseLegacySql") + } + } else if tm.UseLegacySQL || tm.UseStandardSQL { + return nil, errors.New("bigquery: UseLegacy/StandardSQL requires ViewQuery") + } + t.TimePartitioning = tm.TimePartitioning.toBQ() + t.Clustering = tm.Clustering.toBQ() + + if !validExpiration(tm.ExpirationTime) { + return nil, fmt.Errorf("invalid expiration time: %v.\n"+ + "Valid expiration times are after 1678 and before 2262", tm.ExpirationTime) + } + if !tm.ExpirationTime.IsZero() && tm.ExpirationTime != NeverExpire { + t.ExpirationTime = tm.ExpirationTime.UnixNano() / 1e6 + } + if tm.ExternalDataConfig != nil { + edc := tm.ExternalDataConfig.toBQ() + t.ExternalDataConfiguration = &edc + } + t.EncryptionConfiguration = tm.EncryptionConfig.toBQ() + if tm.FullID != "" { + return nil, errors.New("cannot set FullID on create") + } + if tm.Type != "" { + return nil, errors.New("cannot set Type on create") + } + if !tm.CreationTime.IsZero() { + return nil, errors.New("cannot set CreationTime on create") + } + if !tm.LastModifiedTime.IsZero() { + return nil, errors.New("cannot set LastModifiedTime on create") + } + if tm.NumBytes != 0 { + return nil, errors.New("cannot set NumBytes on create") + } + if tm.NumRows != 0 { + return nil, errors.New("cannot set NumRows on create") + } + if tm.StreamingBuffer != nil { + return nil, errors.New("cannot set StreamingBuffer on create") + } + if tm.ETag != "" { + return nil, errors.New("cannot set ETag on create") + } + return t, nil +} + +// Metadata fetches the metadata for the table. +func (t *Table) Metadata(ctx context.Context) (md *TableMetadata, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Table.Metadata") + defer func() { trace.EndSpan(ctx, err) }() + + req := t.c.bqs.Tables.Get(t.ProjectID, t.DatasetID, t.TableID).Context(ctx) + setClientHeader(req.Header()) + var table *bq.Table + err = runWithRetry(ctx, func() (err error) { + table, err = req.Do() + return err + }) + if err != nil { + return nil, err + } + return bqToTableMetadata(table) +} + +func bqToTableMetadata(t *bq.Table) (*TableMetadata, error) { + md := &TableMetadata{ + Description: t.Description, + Name: t.FriendlyName, + Type: TableType(t.Type), + FullID: t.Id, + Labels: t.Labels, + NumBytes: t.NumBytes, + NumRows: t.NumRows, + ExpirationTime: unixMillisToTime(t.ExpirationTime), + CreationTime: unixMillisToTime(t.CreationTime), + LastModifiedTime: unixMillisToTime(int64(t.LastModifiedTime)), + ETag: t.Etag, + EncryptionConfig: bqToEncryptionConfig(t.EncryptionConfiguration), + } + if t.Schema != nil { + md.Schema = bqToSchema(t.Schema) + } + if t.View != nil { + md.ViewQuery = t.View.Query + md.UseLegacySQL = t.View.UseLegacySql + } + md.TimePartitioning = bqToTimePartitioning(t.TimePartitioning) + md.Clustering = bqToClustering(t.Clustering) + if t.StreamingBuffer != nil { + md.StreamingBuffer = &StreamingBuffer{ + EstimatedBytes: t.StreamingBuffer.EstimatedBytes, + EstimatedRows: t.StreamingBuffer.EstimatedRows, + OldestEntryTime: unixMillisToTime(int64(t.StreamingBuffer.OldestEntryTime)), + } + } + if t.ExternalDataConfiguration != nil { + edc, err := bqToExternalDataConfig(t.ExternalDataConfiguration) + if err != nil { + return nil, err + } + md.ExternalDataConfig = edc + } + return md, nil +} + +// Delete deletes the table. +func (t *Table) Delete(ctx context.Context) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Table.Delete") + defer func() { trace.EndSpan(ctx, err) }() + + req := t.c.bqs.Tables.Delete(t.ProjectID, t.DatasetID, t.TableID).Context(ctx) + setClientHeader(req.Header()) + return req.Do() +} + +// Read fetches the contents of the table. +func (t *Table) Read(ctx context.Context) *RowIterator { + return t.read(ctx, fetchPage) +} + +func (t *Table) read(ctx context.Context, pf pageFetcher) *RowIterator { + return newRowIterator(ctx, t, pf) +} + +// NeverExpire is a sentinel value used to remove a table'e expiration time. +var NeverExpire = time.Time{}.Add(-1) + +// Update modifies specific Table metadata fields. +func (t *Table) Update(ctx context.Context, tm TableMetadataToUpdate, etag string) (md *TableMetadata, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/bigquery.Table.Update") + defer func() { trace.EndSpan(ctx, err) }() + + bqt, err := tm.toBQ() + if err != nil { + return nil, err + } + call := t.c.bqs.Tables.Patch(t.ProjectID, t.DatasetID, t.TableID, bqt).Context(ctx) + setClientHeader(call.Header()) + if etag != "" { + call.Header().Set("If-Match", etag) + } + var res *bq.Table + if err := runWithRetry(ctx, func() (err error) { + res, err = call.Do() + return err + }); err != nil { + return nil, err + } + return bqToTableMetadata(res) +} + +func (tm *TableMetadataToUpdate) toBQ() (*bq.Table, error) { + t := &bq.Table{} + forceSend := func(field string) { + t.ForceSendFields = append(t.ForceSendFields, field) + } + + if tm.Description != nil { + t.Description = optional.ToString(tm.Description) + forceSend("Description") + } + if tm.Name != nil { + t.FriendlyName = optional.ToString(tm.Name) + forceSend("FriendlyName") + } + if tm.Schema != nil { + t.Schema = tm.Schema.toBQ() + forceSend("Schema") + } + if tm.EncryptionConfig != nil { + t.EncryptionConfiguration = tm.EncryptionConfig.toBQ() + } + + if !validExpiration(tm.ExpirationTime) { + return nil, fmt.Errorf("invalid expiration time: %v.\n"+ + "Valid expiration times are after 1678 and before 2262", tm.ExpirationTime) + } + if tm.ExpirationTime == NeverExpire { + t.NullFields = append(t.NullFields, "ExpirationTime") + } else if !tm.ExpirationTime.IsZero() { + t.ExpirationTime = tm.ExpirationTime.UnixNano() / 1e6 + forceSend("ExpirationTime") + } + if tm.TimePartitioning != nil { + t.TimePartitioning = tm.TimePartitioning.toBQ() + t.TimePartitioning.ForceSendFields = []string{"Expiration", "RequirePartitionFilter"} + } + if tm.ViewQuery != nil { + t.View = &bq.ViewDefinition{ + Query: optional.ToString(tm.ViewQuery), + ForceSendFields: []string{"Query"}, + } + } + if tm.UseLegacySQL != nil { + if t.View == nil { + t.View = &bq.ViewDefinition{} + } + t.View.UseLegacySql = optional.ToBool(tm.UseLegacySQL) + t.View.ForceSendFields = append(t.View.ForceSendFields, "UseLegacySql") + } + labels, forces, nulls := tm.update() + t.Labels = labels + t.ForceSendFields = append(t.ForceSendFields, forces...) + t.NullFields = append(t.NullFields, nulls...) + return t, nil +} + +// validExpiration ensures a specified time is either the sentinel NeverExpire, +// the zero value, or within the defined range of UnixNano. Internal +// represetations of expiration times are based upon Time.UnixNano. Any time +// before 1678 or after 2262 cannot be represented by an int64 and is therefore +// undefined and invalid. See https://godoc.org/time#Time.UnixNano. +func validExpiration(t time.Time) bool { + return t == NeverExpire || t.IsZero() || time.Unix(0, t.UnixNano()).Equal(t) +} + +// TableMetadataToUpdate is used when updating a table's metadata. +// Only non-nil fields will be updated. +type TableMetadataToUpdate struct { + // The user-friendly description of this table. + Description optional.String + + // The user-friendly name for this table. + Name optional.String + + // The table's schema. + // When updating a schema, you can add columns but not remove them. + Schema Schema + + // The table's encryption configuration. When calling Update, ensure that + // all mutable fields of EncryptionConfig are populated. + EncryptionConfig *EncryptionConfig + + // The time when this table expires. To remove a table's expiration, + // set ExpirationTime to NeverExpire. The zero value is ignored. + ExpirationTime time.Time + + // The query to use for a view. + ViewQuery optional.String + + // Use Legacy SQL for the view query. + UseLegacySQL optional.Bool + + // TimePartitioning allows modification of certain aspects of partition + // configuration such as partition expiration and whether partition + // filtration is required at query time. When calling Update, ensure + // that all mutable fields of TimePartitioning are populated. + TimePartitioning *TimePartitioning + + labelUpdater +} + +// labelUpdater contains common code for updating labels. +type labelUpdater struct { + setLabels map[string]string + deleteLabels map[string]bool +} + +// SetLabel causes a label to be added or modified on a call to Update. +func (u *labelUpdater) SetLabel(name, value string) { + if u.setLabels == nil { + u.setLabels = map[string]string{} + } + u.setLabels[name] = value +} + +// DeleteLabel causes a label to be deleted on a call to Update. +func (u *labelUpdater) DeleteLabel(name string) { + if u.deleteLabels == nil { + u.deleteLabels = map[string]bool{} + } + u.deleteLabels[name] = true +} + +func (u *labelUpdater) update() (labels map[string]string, forces, nulls []string) { + if u.setLabels == nil && u.deleteLabels == nil { + return nil, nil, nil + } + labels = map[string]string{} + for k, v := range u.setLabels { + labels[k] = v + } + if len(labels) == 0 && len(u.deleteLabels) > 0 { + forces = []string{"Labels"} + } + for l := range u.deleteLabels { + nulls = append(nulls, "Labels."+l) + } + return labels, forces, nulls +} diff --git a/vendor/cloud.google.com/go/bigquery/table_test.go b/vendor/cloud.google.com/go/bigquery/table_test.go new file mode 100644 index 000000000..c8a77663d --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/table_test.go @@ -0,0 +1,350 @@ +// Copyright 2017 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 bigquery + +import ( + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + bq "google.golang.org/api/bigquery/v2" +) + +func TestBQToTableMetadata(t *testing.T) { + aTime := time.Date(2017, 1, 26, 0, 0, 0, 0, time.Local) + aTimeMillis := aTime.UnixNano() / 1e6 + for _, test := range []struct { + in *bq.Table + want *TableMetadata + }{ + {&bq.Table{}, &TableMetadata{}}, // test minimal case + { + &bq.Table{ + CreationTime: aTimeMillis, + Description: "desc", + Etag: "etag", + ExpirationTime: aTimeMillis, + FriendlyName: "fname", + Id: "id", + LastModifiedTime: uint64(aTimeMillis), + Location: "loc", + NumBytes: 123, + NumLongTermBytes: 23, + NumRows: 7, + StreamingBuffer: &bq.Streamingbuffer{ + EstimatedBytes: 11, + EstimatedRows: 3, + OldestEntryTime: uint64(aTimeMillis), + }, + TimePartitioning: &bq.TimePartitioning{ + ExpirationMs: 7890, + Type: "DAY", + Field: "pfield", + }, + Clustering: &bq.Clustering{ + Fields: []string{"cfield1", "cfield2"}, + }, + EncryptionConfiguration: &bq.EncryptionConfiguration{KmsKeyName: "keyName"}, + Type: "EXTERNAL", + View: &bq.ViewDefinition{Query: "view-query"}, + Labels: map[string]string{"a": "b"}, + ExternalDataConfiguration: &bq.ExternalDataConfiguration{ + SourceFormat: "GOOGLE_SHEETS", + }, + }, + &TableMetadata{ + Description: "desc", + Name: "fname", + ViewQuery: "view-query", + FullID: "id", + Type: ExternalTable, + Labels: map[string]string{"a": "b"}, + ExternalDataConfig: &ExternalDataConfig{SourceFormat: GoogleSheets}, + ExpirationTime: aTime.Truncate(time.Millisecond), + CreationTime: aTime.Truncate(time.Millisecond), + LastModifiedTime: aTime.Truncate(time.Millisecond), + NumBytes: 123, + NumRows: 7, + TimePartitioning: &TimePartitioning{ + Expiration: 7890 * time.Millisecond, + Field: "pfield", + }, + Clustering: &Clustering{ + Fields: []string{"cfield1", "cfield2"}, + }, + StreamingBuffer: &StreamingBuffer{ + EstimatedBytes: 11, + EstimatedRows: 3, + OldestEntryTime: aTime, + }, + EncryptionConfig: &EncryptionConfig{KMSKeyName: "keyName"}, + ETag: "etag", + }, + }, + } { + got, err := bqToTableMetadata(test.in) + if err != nil { + t.Fatal(err) + } + if diff := testutil.Diff(got, test.want); diff != "" { + t.Errorf("%+v:\n, -got, +want:\n%s", test.in, diff) + } + } +} + +func TestTableMetadataToBQ(t *testing.T) { + aTime := time.Date(2017, 1, 26, 0, 0, 0, 0, time.Local) + aTimeMillis := aTime.UnixNano() / 1e6 + sc := Schema{fieldSchema("desc", "name", "STRING", false, true)} + + for _, test := range []struct { + in *TableMetadata + want *bq.Table + }{ + {nil, &bq.Table{}}, + {&TableMetadata{}, &bq.Table{}}, + { + &TableMetadata{ + Name: "n", + Description: "d", + Schema: sc, + ExpirationTime: aTime, + Labels: map[string]string{"a": "b"}, + ExternalDataConfig: &ExternalDataConfig{SourceFormat: Bigtable}, + EncryptionConfig: &EncryptionConfig{KMSKeyName: "keyName"}, + }, + &bq.Table{ + FriendlyName: "n", + Description: "d", + Schema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "name", "STRING", "REQUIRED"), + }, + }, + ExpirationTime: aTimeMillis, + Labels: map[string]string{"a": "b"}, + ExternalDataConfiguration: &bq.ExternalDataConfiguration{SourceFormat: "BIGTABLE"}, + EncryptionConfiguration: &bq.EncryptionConfiguration{KmsKeyName: "keyName"}, + }, + }, + { + &TableMetadata{ViewQuery: "q"}, + &bq.Table{ + View: &bq.ViewDefinition{ + Query: "q", + UseLegacySql: false, + ForceSendFields: []string{"UseLegacySql"}, + }, + }, + }, + { + &TableMetadata{ + ViewQuery: "q", + UseLegacySQL: true, + TimePartitioning: &TimePartitioning{}, + }, + &bq.Table{ + View: &bq.ViewDefinition{ + Query: "q", + UseLegacySql: true, + }, + TimePartitioning: &bq.TimePartitioning{ + Type: "DAY", + ExpirationMs: 0, + }, + }, + }, + { + &TableMetadata{ + ViewQuery: "q", + UseStandardSQL: true, + TimePartitioning: &TimePartitioning{ + Expiration: time.Second, + Field: "ofDreams", + }, + Clustering: &Clustering{ + Fields: []string{"cfield1"}, + }, + }, + &bq.Table{ + View: &bq.ViewDefinition{ + Query: "q", + UseLegacySql: false, + ForceSendFields: []string{"UseLegacySql"}, + }, + TimePartitioning: &bq.TimePartitioning{ + Type: "DAY", + ExpirationMs: 1000, + Field: "ofDreams", + }, + Clustering: &bq.Clustering{ + Fields: []string{"cfield1"}, + }, + }, + }, + { + &TableMetadata{ExpirationTime: NeverExpire}, + &bq.Table{ExpirationTime: 0}, + }, + } { + got, err := test.in.toBQ() + if err != nil { + t.Fatalf("%+v: %v", test.in, err) + } + if diff := testutil.Diff(got, test.want); diff != "" { + t.Errorf("%+v:\n-got, +want:\n%s", test.in, diff) + } + } + + // Errors + for _, in := range []*TableMetadata{ + {Schema: sc, ViewQuery: "q"}, // can't have both schema and query + {UseLegacySQL: true}, // UseLegacySQL without query + {UseStandardSQL: true}, // UseStandardSQL without query + // read-only fields + {FullID: "x"}, + {Type: "x"}, + {CreationTime: aTime}, + {LastModifiedTime: aTime}, + {NumBytes: 1}, + {NumRows: 1}, + {StreamingBuffer: &StreamingBuffer{}}, + {ETag: "x"}, + // expiration time outside allowable range is invalid + // See https://godoc.org/time#Time.UnixNano + {ExpirationTime: time.Date(1677, 9, 21, 0, 12, 43, 145224192, time.UTC).Add(-1)}, + {ExpirationTime: time.Date(2262, 04, 11, 23, 47, 16, 854775807, time.UTC).Add(1)}, + } { + _, err := in.toBQ() + if err == nil { + t.Errorf("%+v: got nil, want error", in) + } + } +} + +func TestTableMetadataToUpdateToBQ(t *testing.T) { + aTime := time.Date(2017, 1, 26, 0, 0, 0, 0, time.Local) + for _, test := range []struct { + tm TableMetadataToUpdate + want *bq.Table + }{ + { + tm: TableMetadataToUpdate{}, + want: &bq.Table{}, + }, + { + tm: TableMetadataToUpdate{ + Description: "d", + Name: "n", + }, + want: &bq.Table{ + Description: "d", + FriendlyName: "n", + ForceSendFields: []string{"Description", "FriendlyName"}, + }, + }, + { + tm: TableMetadataToUpdate{ + Schema: Schema{fieldSchema("desc", "name", "STRING", false, true)}, + ExpirationTime: aTime, + }, + want: &bq.Table{ + Schema: &bq.TableSchema{ + Fields: []*bq.TableFieldSchema{ + bqTableFieldSchema("desc", "name", "STRING", "REQUIRED"), + }, + }, + ExpirationTime: aTime.UnixNano() / 1e6, + ForceSendFields: []string{"Schema", "ExpirationTime"}, + }, + }, + { + tm: TableMetadataToUpdate{ViewQuery: "q"}, + want: &bq.Table{ + View: &bq.ViewDefinition{Query: "q", ForceSendFields: []string{"Query"}}, + }, + }, + { + tm: TableMetadataToUpdate{UseLegacySQL: false}, + want: &bq.Table{ + View: &bq.ViewDefinition{ + UseLegacySql: false, + ForceSendFields: []string{"UseLegacySql"}, + }, + }, + }, + { + tm: TableMetadataToUpdate{ViewQuery: "q", UseLegacySQL: true}, + want: &bq.Table{ + View: &bq.ViewDefinition{ + Query: "q", + UseLegacySql: true, + ForceSendFields: []string{"Query", "UseLegacySql"}, + }, + }, + }, + { + tm: func() (tm TableMetadataToUpdate) { + tm.SetLabel("L", "V") + tm.DeleteLabel("D") + return tm + }(), + want: &bq.Table{ + Labels: map[string]string{"L": "V"}, + NullFields: []string{"Labels.D"}, + }, + }, + { + tm: TableMetadataToUpdate{ExpirationTime: NeverExpire}, + want: &bq.Table{ + NullFields: []string{"ExpirationTime"}, + }, + }, + } { + got, _ := test.tm.toBQ() + if !testutil.Equal(got, test.want) { + t.Errorf("%+v:\ngot %+v\nwant %+v", test.tm, got, test.want) + } + } +} + +func TestTableMetadataToUpdateToBQErrors(t *testing.T) { + // See https://godoc.org/time#Time.UnixNano + start := time.Date(1677, 9, 21, 0, 12, 43, 145224192, time.UTC) + end := time.Date(2262, 04, 11, 23, 47, 16, 854775807, time.UTC) + + for _, test := range []struct { + desc string + aTime time.Time + wantErr bool + }{ + {desc: "ignored zero value", aTime: time.Time{}, wantErr: false}, + {desc: "earliest valid time", aTime: start, wantErr: false}, + {desc: "latested valid time", aTime: end, wantErr: false}, + {desc: "invalid times before 1678", aTime: start.Add(-1), wantErr: true}, + {desc: "invalid times after 2262", aTime: end.Add(1), wantErr: true}, + {desc: "valid times after 1678", aTime: start.Add(1), wantErr: false}, + {desc: "valid times before 2262", aTime: end.Add(-1), wantErr: false}, + } { + tm := &TableMetadataToUpdate{ExpirationTime: test.aTime} + _, err := tm.toBQ() + if test.wantErr && err == nil { + t.Errorf("[%s] got no error, want error", test.desc) + } + if !test.wantErr && err != nil { + t.Errorf("[%s] got error, want no error", test.desc) + } + } +} diff --git a/vendor/cloud.google.com/go/bigquery/value.go b/vendor/cloud.google.com/go/bigquery/value.go new file mode 100644 index 000000000..2755a5f3e --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/value.go @@ -0,0 +1,870 @@ +// Copyright 2015 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 bigquery + +import ( + "encoding/base64" + "errors" + "fmt" + "math" + "math/big" + "reflect" + "strconv" + "strings" + "time" + + "cloud.google.com/go/civil" + bq "google.golang.org/api/bigquery/v2" +) + +// Value stores the contents of a single cell from a BigQuery result. +type Value interface{} + +// ValueLoader stores a slice of Values representing a result row from a Read operation. +// See RowIterator.Next for more information. +type ValueLoader interface { + Load(v []Value, s Schema) error +} + +// valueList converts a []Value to implement ValueLoader. +type valueList []Value + +// Load stores a sequence of values in a valueList. +// It resets the slice length to zero, then appends each value to it. +func (vs *valueList) Load(v []Value, _ Schema) error { + *vs = append((*vs)[:0], v...) + return nil +} + +// valueMap converts a map[string]Value to implement ValueLoader. +type valueMap map[string]Value + +// Load stores a sequence of values in a valueMap. +func (vm *valueMap) Load(v []Value, s Schema) error { + if *vm == nil { + *vm = map[string]Value{} + } + loadMap(*vm, v, s) + return nil +} + +func loadMap(m map[string]Value, vals []Value, s Schema) { + for i, f := range s { + val := vals[i] + var v interface{} + switch { + case val == nil: + v = val + case f.Schema == nil: + v = val + case !f.Repeated: + m2 := map[string]Value{} + loadMap(m2, val.([]Value), f.Schema) + v = m2 + default: // repeated and nested + sval := val.([]Value) + vs := make([]Value, len(sval)) + for j, e := range sval { + m2 := map[string]Value{} + loadMap(m2, e.([]Value), f.Schema) + vs[j] = m2 + } + v = vs + } + + m[f.Name] = v + } +} + +type structLoader struct { + typ reflect.Type // type of struct + err error + ops []structLoaderOp + + vstructp reflect.Value // pointer to current struct value; changed by set +} + +// A setFunc is a function that sets a struct field or slice/array +// element to a value. +type setFunc func(v reflect.Value, val interface{}) error + +// A structLoaderOp instructs the loader to set a struct field to a row value. +type structLoaderOp struct { + fieldIndex []int + valueIndex int + setFunc setFunc + repeated bool +} + +var errNoNulls = errors.New("bigquery: NULL values cannot be read into structs") + +func setAny(v reflect.Value, x interface{}) error { + if x == nil { + return errNoNulls + } + v.Set(reflect.ValueOf(x)) + return nil +} + +func setInt(v reflect.Value, x interface{}) error { + if x == nil { + return errNoNulls + } + xx := x.(int64) + if v.OverflowInt(xx) { + return fmt.Errorf("bigquery: value %v overflows struct field of type %v", xx, v.Type()) + } + v.SetInt(xx) + return nil +} + +func setUint(v reflect.Value, x interface{}) error { + if x == nil { + return errNoNulls + } + xx := x.(int64) + if xx < 0 || v.OverflowUint(uint64(xx)) { + return fmt.Errorf("bigquery: value %v overflows struct field of type %v", xx, v.Type()) + } + v.SetUint(uint64(xx)) + return nil +} + +func setFloat(v reflect.Value, x interface{}) error { + if x == nil { + return errNoNulls + } + xx := x.(float64) + if v.OverflowFloat(xx) { + return fmt.Errorf("bigquery: value %v overflows struct field of type %v", xx, v.Type()) + } + v.SetFloat(xx) + return nil +} + +func setBool(v reflect.Value, x interface{}) error { + if x == nil { + return errNoNulls + } + v.SetBool(x.(bool)) + return nil +} + +func setString(v reflect.Value, x interface{}) error { + if x == nil { + return errNoNulls + } + v.SetString(x.(string)) + return nil +} + +func setBytes(v reflect.Value, x interface{}) error { + if x == nil { + v.SetBytes(nil) + } else { + v.SetBytes(x.([]byte)) + } + return nil +} + +func setNull(v reflect.Value, x interface{}, build func() interface{}) error { + if x == nil { + v.Set(reflect.Zero(v.Type())) + } else { + n := build() + v.Set(reflect.ValueOf(n)) + } + return nil +} + +// set remembers a value for the next call to Load. The value must be +// a pointer to a struct. (This is checked in RowIterator.Next.) +func (sl *structLoader) set(structp interface{}, schema Schema) error { + if sl.err != nil { + return sl.err + } + sl.vstructp = reflect.ValueOf(structp) + typ := sl.vstructp.Type().Elem() + if sl.typ == nil { + // First call: remember the type and compile the schema. + sl.typ = typ + ops, err := compileToOps(typ, schema) + if err != nil { + sl.err = err + return err + } + sl.ops = ops + } else if sl.typ != typ { + return fmt.Errorf("bigquery: struct type changed from %s to %s", sl.typ, typ) + } + return nil +} + +// compileToOps produces a sequence of operations that will set the fields of a +// value of structType to the contents of a row with schema. +func compileToOps(structType reflect.Type, schema Schema) ([]structLoaderOp, error) { + var ops []structLoaderOp + fields, err := fieldCache.Fields(structType) + if err != nil { + return nil, err + } + for i, schemaField := range schema { + // Look for an exported struct field with the same name as the schema + // field, ignoring case (BigQuery column names are case-insensitive, + // and we want to act like encoding/json anyway). + structField := fields.Match(schemaField.Name) + if structField == nil { + // Ignore schema fields with no corresponding struct field. + continue + } + op := structLoaderOp{ + fieldIndex: structField.Index, + valueIndex: i, + } + t := structField.Type + if schemaField.Repeated { + if t.Kind() != reflect.Slice && t.Kind() != reflect.Array { + return nil, fmt.Errorf("bigquery: repeated schema field %s requires slice or array, but struct field %s has type %s", + schemaField.Name, structField.Name, t) + } + t = t.Elem() + op.repeated = true + } + if schemaField.Type == RecordFieldType { + // Field can be a struct or a pointer to a struct. + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + if t.Kind() != reflect.Struct { + return nil, fmt.Errorf("bigquery: field %s has type %s, expected struct or *struct", + structField.Name, structField.Type) + } + nested, err := compileToOps(t, schemaField.Schema) + if err != nil { + return nil, err + } + op.setFunc = func(v reflect.Value, val interface{}) error { + return setNested(nested, v, val) + } + } else { + op.setFunc = determineSetFunc(t, schemaField.Type) + if op.setFunc == nil { + return nil, fmt.Errorf("bigquery: schema field %s of type %s is not assignable to struct field %s of type %s", + schemaField.Name, schemaField.Type, structField.Name, t) + } + } + ops = append(ops, op) + } + return ops, nil +} + +// determineSetFunc chooses the best function for setting a field of type ftype +// to a value whose schema field type is stype. It returns nil if stype +// is not assignable to ftype. +// determineSetFunc considers only basic types. See compileToOps for +// handling of repetition and nesting. +func determineSetFunc(ftype reflect.Type, stype FieldType) setFunc { + switch stype { + case StringFieldType: + if ftype.Kind() == reflect.String { + return setString + } + if ftype == typeOfNullString { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { + return NullString{StringVal: x.(string), Valid: true} + }) + } + } + + case BytesFieldType: + if ftype == typeOfByteSlice { + return setBytes + } + + case IntegerFieldType: + if isSupportedUintType(ftype) { + return setUint + } else if isSupportedIntType(ftype) { + return setInt + } + if ftype == typeOfNullInt64 { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { + return NullInt64{Int64: x.(int64), Valid: true} + }) + } + } + + case FloatFieldType: + switch ftype.Kind() { + case reflect.Float32, reflect.Float64: + return setFloat + } + if ftype == typeOfNullFloat64 { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { + return NullFloat64{Float64: x.(float64), Valid: true} + }) + } + } + + case BooleanFieldType: + if ftype.Kind() == reflect.Bool { + return setBool + } + if ftype == typeOfNullBool { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { + return NullBool{Bool: x.(bool), Valid: true} + }) + } + } + + case TimestampFieldType: + if ftype == typeOfGoTime { + return setAny + } + if ftype == typeOfNullTimestamp { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { + return NullTimestamp{Timestamp: x.(time.Time), Valid: true} + }) + } + } + + case DateFieldType: + if ftype == typeOfDate { + return setAny + } + if ftype == typeOfNullDate { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { + return NullDate{Date: x.(civil.Date), Valid: true} + }) + } + } + + case TimeFieldType: + if ftype == typeOfTime { + return setAny + } + if ftype == typeOfNullTime { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { + return NullTime{Time: x.(civil.Time), Valid: true} + }) + } + } + + case DateTimeFieldType: + if ftype == typeOfDateTime { + return setAny + } + if ftype == typeOfNullDateTime { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { + return NullDateTime{DateTime: x.(civil.DateTime), Valid: true} + }) + } + } + + case NumericFieldType: + if ftype == typeOfRat { + return func(v reflect.Value, x interface{}) error { + return setNull(v, x, func() interface{} { return x.(*big.Rat) }) + } + } + } + return nil +} + +func (sl *structLoader) Load(values []Value, _ Schema) error { + if sl.err != nil { + return sl.err + } + return runOps(sl.ops, sl.vstructp.Elem(), values) +} + +// runOps executes a sequence of ops, setting the fields of vstruct to the +// supplied values. +func runOps(ops []structLoaderOp, vstruct reflect.Value, values []Value) error { + for _, op := range ops { + field := vstruct.FieldByIndex(op.fieldIndex) + var err error + if op.repeated { + err = setRepeated(field, values[op.valueIndex].([]Value), op.setFunc) + } else { + err = op.setFunc(field, values[op.valueIndex]) + } + if err != nil { + return err + } + } + return nil +} + +func setNested(ops []structLoaderOp, v reflect.Value, val interface{}) error { + // v is either a struct or a pointer to a struct. + if v.Kind() == reflect.Ptr { + // If the value is nil, set the pointer to nil. + if val == nil { + v.Set(reflect.Zero(v.Type())) + return nil + } + // If the pointer is nil, set it to a zero struct value. + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + v = v.Elem() + } + return runOps(ops, v, val.([]Value)) +} + +func setRepeated(field reflect.Value, vslice []Value, setElem setFunc) error { + vlen := len(vslice) + var flen int + switch field.Type().Kind() { + case reflect.Slice: + // Make a slice of the right size, avoiding allocation if possible. + switch { + case field.Len() < vlen: + field.Set(reflect.MakeSlice(field.Type(), vlen, vlen)) + case field.Len() > vlen: + field.SetLen(vlen) + } + flen = vlen + + case reflect.Array: + flen = field.Len() + if flen > vlen { + // Set extra elements to their zero value. + z := reflect.Zero(field.Type().Elem()) + for i := vlen; i < flen; i++ { + field.Index(i).Set(z) + } + } + default: + return fmt.Errorf("bigquery: impossible field type %s", field.Type()) + } + for i, val := range vslice { + if i < flen { // avoid writing past the end of a short array + if err := setElem(field.Index(i), val); err != nil { + return err + } + } + } + return nil +} + +// A ValueSaver returns a row of data to be inserted into a table. +type ValueSaver interface { + // Save returns a row to be inserted into a BigQuery table, represented + // as a map from field name to Value. + // If insertID is non-empty, BigQuery will use it to de-duplicate + // insertions of this row on a best-effort basis. + Save() (row map[string]Value, insertID string, err error) +} + +// ValuesSaver implements ValueSaver for a slice of Values. +type ValuesSaver struct { + Schema Schema + + // If non-empty, BigQuery will use InsertID to de-duplicate insertions + // of this row on a best-effort basis. + InsertID string + + Row []Value +} + +// Save implements ValueSaver. +func (vls *ValuesSaver) Save() (map[string]Value, string, error) { + m, err := valuesToMap(vls.Row, vls.Schema) + return m, vls.InsertID, err +} + +func valuesToMap(vs []Value, schema Schema) (map[string]Value, error) { + if len(vs) != len(schema) { + return nil, errors.New("Schema does not match length of row to be inserted") + } + + m := make(map[string]Value) + for i, fieldSchema := range schema { + if vs[i] == nil { + m[fieldSchema.Name] = nil + continue + } + if fieldSchema.Type != RecordFieldType { + m[fieldSchema.Name] = toUploadValue(vs[i], fieldSchema) + continue + } + // Nested record, possibly repeated. + vals, ok := vs[i].([]Value) + if !ok { + return nil, errors.New("nested record is not a []Value") + } + if !fieldSchema.Repeated { + value, err := valuesToMap(vals, fieldSchema.Schema) + if err != nil { + return nil, err + } + m[fieldSchema.Name] = value + continue + } + // A repeated nested field is converted into a slice of maps. + var maps []Value + for _, v := range vals { + sv, ok := v.([]Value) + if !ok { + return nil, errors.New("nested record in slice is not a []Value") + } + value, err := valuesToMap(sv, fieldSchema.Schema) + if err != nil { + return nil, err + } + maps = append(maps, value) + } + m[fieldSchema.Name] = maps + } + return m, nil +} + +// StructSaver implements ValueSaver for a struct. +// The struct is converted to a map of values by using the values of struct +// fields corresponding to schema fields. Additional and missing +// fields are ignored, as are nested struct pointers that are nil. +type StructSaver struct { + // Schema determines what fields of the struct are uploaded. It should + // match the table's schema. + // Schema is optional for StructSavers that are passed to Uploader.Put. + Schema Schema + + // If non-empty, BigQuery will use InsertID to de-duplicate insertions + // of this row on a best-effort basis. + InsertID string + + // Struct should be a struct or a pointer to a struct. + Struct interface{} +} + +// Save implements ValueSaver. +func (ss *StructSaver) Save() (row map[string]Value, insertID string, err error) { + vstruct := reflect.ValueOf(ss.Struct) + row, err = structToMap(vstruct, ss.Schema) + if err != nil { + return nil, "", err + } + return row, ss.InsertID, nil +} + +func structToMap(vstruct reflect.Value, schema Schema) (map[string]Value, error) { + if vstruct.Kind() == reflect.Ptr { + vstruct = vstruct.Elem() + } + if !vstruct.IsValid() { + return nil, nil + } + m := map[string]Value{} + if vstruct.Kind() != reflect.Struct { + return nil, fmt.Errorf("bigquery: type is %s, need struct or struct pointer", vstruct.Type()) + } + fields, err := fieldCache.Fields(vstruct.Type()) + if err != nil { + return nil, err + } + for _, schemaField := range schema { + // Look for an exported struct field with the same name as the schema + // field, ignoring case. + structField := fields.Match(schemaField.Name) + if structField == nil { + continue + } + val, err := structFieldToUploadValue(vstruct.FieldByIndex(structField.Index), schemaField) + if err != nil { + return nil, err + } + // Add the value to the map, unless it is nil. + if val != nil { + m[schemaField.Name] = val + } + } + return m, nil +} + +// structFieldToUploadValue converts a struct field to a value suitable for ValueSaver.Save, using +// the schemaField as a guide. +// structFieldToUploadValue is careful to return a true nil interface{} when needed, so its +// caller can easily identify a nil value. +func structFieldToUploadValue(vfield reflect.Value, schemaField *FieldSchema) (interface{}, error) { + if schemaField.Repeated && (vfield.Kind() != reflect.Slice && vfield.Kind() != reflect.Array) { + return nil, fmt.Errorf("bigquery: repeated schema field %s requires slice or array, but value has type %s", + schemaField.Name, vfield.Type()) + } + + // A non-nested field can be represented by its Go value, except for some types. + if schemaField.Type != RecordFieldType { + return toUploadValueReflect(vfield, schemaField), nil + } + // A non-repeated nested field is converted into a map[string]Value. + if !schemaField.Repeated { + m, err := structToMap(vfield, schemaField.Schema) + if err != nil { + return nil, err + } + if m == nil { + return nil, nil + } + return m, nil + } + // A repeated nested field is converted into a slice of maps. + // If the field is zero-length (but not nil), we return a zero-length []Value. + if vfield.IsNil() { + return nil, nil + } + vals := []Value{} + for i := 0; i < vfield.Len(); i++ { + m, err := structToMap(vfield.Index(i), schemaField.Schema) + if err != nil { + return nil, err + } + vals = append(vals, m) + } + return vals, nil +} + +func toUploadValue(val interface{}, fs *FieldSchema) interface{} { + if fs.Type == TimeFieldType || fs.Type == DateTimeFieldType || fs.Type == NumericFieldType { + return toUploadValueReflect(reflect.ValueOf(val), fs) + } + return val +} + +func toUploadValueReflect(v reflect.Value, fs *FieldSchema) interface{} { + switch fs.Type { + case TimeFieldType: + if v.Type() == typeOfNullTime { + return v.Interface() + } + return formatUploadValue(v, fs, func(v reflect.Value) string { + return CivilTimeString(v.Interface().(civil.Time)) + }) + case DateTimeFieldType: + if v.Type() == typeOfNullDateTime { + return v.Interface() + } + return formatUploadValue(v, fs, func(v reflect.Value) string { + return CivilDateTimeString(v.Interface().(civil.DateTime)) + }) + case NumericFieldType: + if r, ok := v.Interface().(*big.Rat); ok && r == nil { + return nil + } + return formatUploadValue(v, fs, func(v reflect.Value) string { + return NumericString(v.Interface().(*big.Rat)) + }) + default: + if !fs.Repeated || v.Len() > 0 { + return v.Interface() + } + // The service treats a null repeated field as an error. Return + // nil to omit the field entirely. + return nil + } +} + +func formatUploadValue(v reflect.Value, fs *FieldSchema, cvt func(reflect.Value) string) interface{} { + if !fs.Repeated { + return cvt(v) + } + if v.Len() == 0 { + return nil + } + s := make([]string, v.Len()) + for i := 0; i < v.Len(); i++ { + s[i] = cvt(v.Index(i)) + } + return s +} + +// CivilTimeString returns a string representing a civil.Time in a format compatible +// with BigQuery SQL. It rounds the time to the nearest microsecond and returns a +// string with six digits of sub-second precision. +// +// Use CivilTimeString when using civil.Time in DML, for example in INSERT +// statements. +func CivilTimeString(t civil.Time) string { + if t.Nanosecond == 0 { + return t.String() + } + micro := (t.Nanosecond + 500) / 1000 // round to nearest microsecond + t.Nanosecond = 0 + return t.String() + fmt.Sprintf(".%06d", micro) +} + +// CivilDateTimeString returns a string representing a civil.DateTime in a format compatible +// with BigQuery SQL. It separate the date and time with a space, and formats the time +// with CivilTimeString. +// +// Use CivilDateTimeString when using civil.DateTime in DML, for example in INSERT +// statements. +func CivilDateTimeString(dt civil.DateTime) string { + return dt.Date.String() + " " + CivilTimeString(dt.Time) +} + +// parseCivilDateTime parses a date-time represented in a BigQuery SQL +// compatible format and returns a civil.DateTime. +func parseCivilDateTime(s string) (civil.DateTime, error) { + parts := strings.Fields(s) + if len(parts) != 2 { + return civil.DateTime{}, fmt.Errorf("bigquery: bad DATETIME value %q", s) + } + return civil.ParseDateTime(parts[0] + "T" + parts[1]) +} + +const ( + // NumericPrecisionDigits is the maximum number of digits in a NUMERIC value. + NumericPrecisionDigits = 38 + + // NumericScaleDigits is the maximum number of digits after the decimal point in a NUMERIC value. + NumericScaleDigits = 9 +) + +// NumericString returns a string representing a *big.Rat in a format compatible +// with BigQuery SQL. It returns a floating-point literal with 9 digits +// after the decimal point. +func NumericString(r *big.Rat) string { + return r.FloatString(NumericScaleDigits) +} + +// convertRows converts a series of TableRows into a series of Value slices. +// schema is used to interpret the data from rows; its length must match the +// length of each row. +func convertRows(rows []*bq.TableRow, schema Schema) ([][]Value, error) { + var rs [][]Value + for _, r := range rows { + row, err := convertRow(r, schema) + if err != nil { + return nil, err + } + rs = append(rs, row) + } + return rs, nil +} + +func convertRow(r *bq.TableRow, schema Schema) ([]Value, error) { + if len(schema) != len(r.F) { + return nil, errors.New("schema length does not match row length") + } + var values []Value + for i, cell := range r.F { + fs := schema[i] + v, err := convertValue(cell.V, fs.Type, fs.Schema) + if err != nil { + return nil, err + } + values = append(values, v) + } + return values, nil +} + +func convertValue(val interface{}, typ FieldType, schema Schema) (Value, error) { + switch val := val.(type) { + case nil: + return nil, nil + case []interface{}: + return convertRepeatedRecord(val, typ, schema) + case map[string]interface{}: + return convertNestedRecord(val, schema) + case string: + return convertBasicType(val, typ) + default: + return nil, fmt.Errorf("got value %v; expected a value of type %s", val, typ) + } +} + +func convertRepeatedRecord(vals []interface{}, typ FieldType, schema Schema) (Value, error) { + var values []Value + for _, cell := range vals { + // each cell contains a single entry, keyed by "v" + val := cell.(map[string]interface{})["v"] + v, err := convertValue(val, typ, schema) + if err != nil { + return nil, err + } + values = append(values, v) + } + return values, nil +} + +func convertNestedRecord(val map[string]interface{}, schema Schema) (Value, error) { + // convertNestedRecord is similar to convertRow, as a record has the same structure as a row. + + // Nested records are wrapped in a map with a single key, "f". + record := val["f"].([]interface{}) + if len(record) != len(schema) { + return nil, errors.New("schema length does not match record length") + } + + var values []Value + for i, cell := range record { + // each cell contains a single entry, keyed by "v" + val := cell.(map[string]interface{})["v"] + fs := schema[i] + v, err := convertValue(val, fs.Type, fs.Schema) + if err != nil { + return nil, err + } + values = append(values, v) + } + return values, nil +} + +// convertBasicType returns val as an interface with a concrete type specified by typ. +func convertBasicType(val string, typ FieldType) (Value, error) { + switch typ { + case StringFieldType: + return val, nil + case BytesFieldType: + return base64.StdEncoding.DecodeString(val) + case IntegerFieldType: + return strconv.ParseInt(val, 10, 64) + case FloatFieldType: + return strconv.ParseFloat(val, 64) + case BooleanFieldType: + return strconv.ParseBool(val) + case TimestampFieldType: + f, err := strconv.ParseFloat(val, 64) + if err != nil { + return nil, err + } + secs := math.Trunc(f) + nanos := (f - secs) * 1e9 + return Value(time.Unix(int64(secs), int64(nanos)).UTC()), nil + case DateFieldType: + return civil.ParseDate(val) + case TimeFieldType: + return civil.ParseTime(val) + case DateTimeFieldType: + return civil.ParseDateTime(val) + case NumericFieldType: + r, ok := (&big.Rat{}).SetString(val) + if !ok { + return nil, fmt.Errorf("bigquery: invalid NUMERIC value %q", val) + } + return Value(r), nil + default: + return nil, fmt.Errorf("unrecognized type: %s", typ) + } +} diff --git a/vendor/cloud.google.com/go/bigquery/value_test.go b/vendor/cloud.google.com/go/bigquery/value_test.go new file mode 100644 index 000000000..3b441ee01 --- /dev/null +++ b/vendor/cloud.google.com/go/bigquery/value_test.go @@ -0,0 +1,1216 @@ +// Copyright 2015 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 bigquery + +import ( + "encoding/base64" + "fmt" + "math" + "math/big" + "testing" + "time" + + "cloud.google.com/go/civil" + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + bq "google.golang.org/api/bigquery/v2" +) + +func TestConvertBasicValues(t *testing.T) { + schema := Schema{ + {Type: StringFieldType}, + {Type: IntegerFieldType}, + {Type: FloatFieldType}, + {Type: BooleanFieldType}, + {Type: BytesFieldType}, + {Type: NumericFieldType}, + } + row := &bq.TableRow{ + F: []*bq.TableCell{ + {V: "a"}, + {V: "1"}, + {V: "1.2"}, + {V: "true"}, + {V: base64.StdEncoding.EncodeToString([]byte("foo"))}, + {V: "123.123456789"}, + }, + } + got, err := convertRow(row, schema) + if err != nil { + t.Fatalf("error converting: %v", err) + } + + want := []Value{"a", int64(1), 1.2, true, []byte("foo"), big.NewRat(123123456789, 1e9)} + if !testutil.Equal(got, want) { + t.Errorf("converting basic values: got:\n%v\nwant:\n%v", got, want) + } +} + +func TestConvertTime(t *testing.T) { + schema := Schema{ + {Type: TimestampFieldType}, + {Type: DateFieldType}, + {Type: TimeFieldType}, + {Type: DateTimeFieldType}, + } + ts := testTimestamp.Round(time.Millisecond) + row := &bq.TableRow{ + F: []*bq.TableCell{ + {V: fmt.Sprintf("%.10f", float64(ts.UnixNano())/1e9)}, + {V: testDate.String()}, + {V: testTime.String()}, + {V: testDateTime.String()}, + }, + } + got, err := convertRow(row, schema) + if err != nil { + t.Fatalf("error converting: %v", err) + } + want := []Value{ts, testDate, testTime, testDateTime} + for i, g := range got { + w := want[i] + if !testutil.Equal(g, w) { + t.Errorf("#%d: got:\n%v\nwant:\n%v", i, g, w) + } + } + if got[0].(time.Time).Location() != time.UTC { + t.Errorf("expected time zone UTC: got:\n%v", got) + } +} + +func TestConvertSmallTimes(t *testing.T) { + for _, year := range []int{1600, 1066, 1} { + want := time.Date(year, time.January, 1, 0, 0, 0, 0, time.UTC) + s := fmt.Sprintf("%.10f", float64(want.Unix())) + got, err := convertBasicType(s, TimestampFieldType) + if err != nil { + t.Fatal(err) + } + if !got.(time.Time).Equal(want) { + t.Errorf("got %v, want %v", got, want) + } + } +} + +func TestConvertNullValues(t *testing.T) { + schema := Schema{{Type: StringFieldType}} + row := &bq.TableRow{ + F: []*bq.TableCell{ + {V: nil}, + }, + } + got, err := convertRow(row, schema) + if err != nil { + t.Fatalf("error converting: %v", err) + } + want := []Value{nil} + if !testutil.Equal(got, want) { + t.Errorf("converting null values: got:\n%v\nwant:\n%v", got, want) + } +} + +func TestBasicRepetition(t *testing.T) { + schema := Schema{ + {Type: IntegerFieldType, Repeated: true}, + } + row := &bq.TableRow{ + F: []*bq.TableCell{ + { + V: []interface{}{ + map[string]interface{}{ + "v": "1", + }, + map[string]interface{}{ + "v": "2", + }, + map[string]interface{}{ + "v": "3", + }, + }, + }, + }, + } + got, err := convertRow(row, schema) + if err != nil { + t.Fatalf("error converting: %v", err) + } + want := []Value{[]Value{int64(1), int64(2), int64(3)}} + if !testutil.Equal(got, want) { + t.Errorf("converting basic repeated values: got:\n%v\nwant:\n%v", got, want) + } +} + +func TestNestedRecordContainingRepetition(t *testing.T) { + schema := Schema{ + { + Type: RecordFieldType, + Schema: Schema{ + {Type: IntegerFieldType, Repeated: true}, + }, + }, + } + row := &bq.TableRow{ + F: []*bq.TableCell{ + { + V: map[string]interface{}{ + "f": []interface{}{ + map[string]interface{}{ + "v": []interface{}{ + map[string]interface{}{"v": "1"}, + map[string]interface{}{"v": "2"}, + map[string]interface{}{"v": "3"}, + }, + }, + }, + }, + }, + }, + } + + got, err := convertRow(row, schema) + if err != nil { + t.Fatalf("error converting: %v", err) + } + want := []Value{[]Value{[]Value{int64(1), int64(2), int64(3)}}} + if !testutil.Equal(got, want) { + t.Errorf("converting basic repeated values: got:\n%v\nwant:\n%v", got, want) + } +} + +func TestRepeatedRecordContainingRepetition(t *testing.T) { + schema := Schema{ + { + Type: RecordFieldType, + Repeated: true, + Schema: Schema{ + {Type: IntegerFieldType, Repeated: true}, + }, + }, + } + row := &bq.TableRow{F: []*bq.TableCell{ + { + V: []interface{}{ // repeated records. + map[string]interface{}{ // first record. + "v": map[string]interface{}{ // pointless single-key-map wrapper. + "f": []interface{}{ // list of record fields. + map[string]interface{}{ // only record (repeated ints) + "v": []interface{}{ // pointless wrapper. + map[string]interface{}{ + "v": "1", + }, + map[string]interface{}{ + "v": "2", + }, + map[string]interface{}{ + "v": "3", + }, + }, + }, + }, + }, + }, + map[string]interface{}{ // second record. + "v": map[string]interface{}{ + "f": []interface{}{ + map[string]interface{}{ + "v": []interface{}{ + map[string]interface{}{ + "v": "4", + }, + map[string]interface{}{ + "v": "5", + }, + map[string]interface{}{ + "v": "6", + }, + }, + }, + }, + }, + }, + }, + }, + }} + + got, err := convertRow(row, schema) + if err != nil { + t.Fatalf("error converting: %v", err) + } + want := []Value{ // the row is a list of length 1, containing an entry for the repeated record. + []Value{ // the repeated record is a list of length 2, containing an entry for each repetition. + []Value{ // the record is a list of length 1, containing an entry for the repeated integer field. + []Value{int64(1), int64(2), int64(3)}, // the repeated integer field is a list of length 3. + }, + []Value{ // second record + []Value{int64(4), int64(5), int64(6)}, + }, + }, + } + if !testutil.Equal(got, want) { + t.Errorf("converting repeated records with repeated values: got:\n%v\nwant:\n%v", got, want) + } +} + +func TestRepeatedRecordContainingRecord(t *testing.T) { + schema := Schema{ + { + Type: RecordFieldType, + Repeated: true, + Schema: Schema{ + { + Type: StringFieldType, + }, + { + Type: RecordFieldType, + Schema: Schema{ + {Type: IntegerFieldType}, + {Type: StringFieldType}, + }, + }, + }, + }, + } + row := &bq.TableRow{F: []*bq.TableCell{ + { + V: []interface{}{ // repeated records. + map[string]interface{}{ // first record. + "v": map[string]interface{}{ // pointless single-key-map wrapper. + "f": []interface{}{ // list of record fields. + map[string]interface{}{ // first record field (name) + "v": "first repeated record", + }, + map[string]interface{}{ // second record field (nested record). + "v": map[string]interface{}{ // pointless single-key-map wrapper. + "f": []interface{}{ // nested record fields + map[string]interface{}{ + "v": "1", + }, + map[string]interface{}{ + "v": "two", + }, + }, + }, + }, + }, + }, + }, + map[string]interface{}{ // second record. + "v": map[string]interface{}{ + "f": []interface{}{ + map[string]interface{}{ + "v": "second repeated record", + }, + map[string]interface{}{ + "v": map[string]interface{}{ + "f": []interface{}{ + map[string]interface{}{ + "v": "3", + }, + map[string]interface{}{ + "v": "four", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }} + + got, err := convertRow(row, schema) + if err != nil { + t.Fatalf("error converting: %v", err) + } + // TODO: test with flattenresults. + want := []Value{ // the row is a list of length 1, containing an entry for the repeated record. + []Value{ // the repeated record is a list of length 2, containing an entry for each repetition. + []Value{ // record contains a string followed by a nested record. + "first repeated record", + []Value{ + int64(1), + "two", + }, + }, + []Value{ // second record. + "second repeated record", + []Value{ + int64(3), + "four", + }, + }, + }, + } + if !testutil.Equal(got, want) { + t.Errorf("converting repeated records containing record : got:\n%v\nwant:\n%v", got, want) + } +} + +func TestConvertRowErrors(t *testing.T) { + // mismatched lengths + if _, err := convertRow(&bq.TableRow{F: []*bq.TableCell{{V: ""}}}, Schema{}); err == nil { + t.Error("got nil, want error") + } + v3 := map[string]interface{}{"v": 3} + for _, test := range []struct { + value interface{} + fs FieldSchema + }{ + {3, FieldSchema{Type: IntegerFieldType}}, // not a string + {[]interface{}{v3}, // not a string, repeated + FieldSchema{Type: IntegerFieldType, Repeated: true}}, + {map[string]interface{}{"f": []interface{}{v3}}, // not a string, nested + FieldSchema{Type: RecordFieldType, Schema: Schema{{Type: IntegerFieldType}}}}, + {map[string]interface{}{"f": []interface{}{v3}}, // wrong length, nested + FieldSchema{Type: RecordFieldType, Schema: Schema{}}}, + } { + _, err := convertRow( + &bq.TableRow{F: []*bq.TableCell{{V: test.value}}}, + Schema{&test.fs}) + if err == nil { + t.Errorf("value %v, fs %v: got nil, want error", test.value, test.fs) + } + } + + // bad field type + if _, err := convertBasicType("", FieldType("BAD")); err == nil { + t.Error("got nil, want error") + } +} + +func TestValuesSaverConvertsToMap(t *testing.T) { + testCases := []struct { + vs ValuesSaver + wantInsertID string + wantRow map[string]Value + }{ + { + vs: ValuesSaver{ + Schema: Schema{ + {Name: "intField", Type: IntegerFieldType}, + {Name: "strField", Type: StringFieldType}, + {Name: "dtField", Type: DateTimeFieldType}, + {Name: "nField", Type: NumericFieldType}, + }, + InsertID: "iid", + Row: []Value{1, "a", + civil.DateTime{ + Date: civil.Date{Year: 1, Month: 2, Day: 3}, + Time: civil.Time{Hour: 4, Minute: 5, Second: 6, Nanosecond: 7000}}, + big.NewRat(123456789000, 1e9), + }, + }, + wantInsertID: "iid", + wantRow: map[string]Value{ + "intField": 1, + "strField": "a", + "dtField": "0001-02-03 04:05:06.000007", + "nField": "123.456789000", + }, + }, + { + vs: ValuesSaver{ + Schema: Schema{ + {Name: "intField", Type: IntegerFieldType}, + { + Name: "recordField", + Type: RecordFieldType, + Schema: Schema{ + {Name: "nestedInt", Type: IntegerFieldType, Repeated: true}, + }, + }, + }, + InsertID: "iid", + Row: []Value{1, []Value{[]Value{2, 3}}}, + }, + wantInsertID: "iid", + wantRow: map[string]Value{ + "intField": 1, + "recordField": map[string]Value{ + "nestedInt": []Value{2, 3}, + }, + }, + }, + { // repeated nested field + vs: ValuesSaver{ + Schema: Schema{ + { + Name: "records", + Type: RecordFieldType, + Schema: Schema{ + {Name: "x", Type: IntegerFieldType}, + {Name: "y", Type: IntegerFieldType}, + }, + Repeated: true, + }, + }, + InsertID: "iid", + Row: []Value{ // a row is a []Value + []Value{ // repeated field's value is a []Value + []Value{1, 2}, // first record of the repeated field + []Value{3, 4}, // second record + }, + }, + }, + wantInsertID: "iid", + wantRow: map[string]Value{ + "records": []Value{ + map[string]Value{"x": 1, "y": 2}, + map[string]Value{"x": 3, "y": 4}, + }, + }, + }, + } + for _, tc := range testCases { + gotRow, gotInsertID, err := tc.vs.Save() + if err != nil { + t.Errorf("Expected successful save; got: %v", err) + continue + } + if !testutil.Equal(gotRow, tc.wantRow) { + t.Errorf("%v row:\ngot:\n%+v\nwant:\n%+v", tc.vs, gotRow, tc.wantRow) + } + if !testutil.Equal(gotInsertID, tc.wantInsertID) { + t.Errorf("%v ID:\ngot:\n%+v\nwant:\n%+v", tc.vs, gotInsertID, tc.wantInsertID) + } + } +} + +func TestValuesToMapErrors(t *testing.T) { + for _, test := range []struct { + values []Value + schema Schema + }{ + { // mismatched length + []Value{1}, + Schema{}, + }, + { // nested record not a slice + []Value{1}, + Schema{{Type: RecordFieldType}}, + }, + { // nested record mismatched length + []Value{[]Value{1}}, + Schema{{Type: RecordFieldType}}, + }, + { // nested repeated record not a slice + []Value{[]Value{1}}, + Schema{{Type: RecordFieldType, Repeated: true}}, + }, + { // nested repeated record mismatched length + []Value{[]Value{[]Value{1}}}, + Schema{{Type: RecordFieldType, Repeated: true}}, + }, + } { + _, err := valuesToMap(test.values, test.schema) + if err == nil { + t.Errorf("%v, %v: got nil, want error", test.values, test.schema) + } + } +} + +func TestStructSaver(t *testing.T) { + schema := Schema{ + {Name: "s", Type: StringFieldType}, + {Name: "r", Type: IntegerFieldType, Repeated: true}, + {Name: "t", Type: TimeFieldType}, + {Name: "tr", Type: TimeFieldType, Repeated: true}, + {Name: "nested", Type: RecordFieldType, Schema: Schema{ + {Name: "b", Type: BooleanFieldType}, + }}, + {Name: "rnested", Type: RecordFieldType, Repeated: true, Schema: Schema{ + {Name: "b", Type: BooleanFieldType}, + }}, + {Name: "p", Type: IntegerFieldType, Required: false}, + {Name: "n", Type: NumericFieldType, Required: false}, + {Name: "nr", Type: NumericFieldType, Repeated: true}, + } + + type ( + N struct{ B bool } + T struct { + S string + R []int + T civil.Time + TR []civil.Time + Nested *N + Rnested []*N + P NullInt64 + N *big.Rat + NR []*big.Rat + } + ) + + check := func(msg string, in interface{}, want map[string]Value) { + ss := StructSaver{ + Schema: schema, + InsertID: "iid", + Struct: in, + } + got, gotIID, err := ss.Save() + if err != nil { + t.Fatalf("%s: %v", msg, err) + } + if wantIID := "iid"; gotIID != wantIID { + t.Errorf("%s: InsertID: got %q, want %q", msg, gotIID, wantIID) + } + if diff := testutil.Diff(got, want); diff != "" { + t.Errorf("%s: %s", msg, diff) + } + } + + ct1 := civil.Time{Hour: 1, Minute: 2, Second: 3, Nanosecond: 4000} + ct2 := civil.Time{Hour: 5, Minute: 6, Second: 7, Nanosecond: 8000} + in := T{ + S: "x", + R: []int{1, 2}, + T: ct1, + TR: []civil.Time{ct1, ct2}, + Nested: &N{B: true}, + Rnested: []*N{{true}, {false}}, + P: NullInt64{Valid: true, Int64: 17}, + N: big.NewRat(123456, 1000), + NR: []*big.Rat{big.NewRat(3, 1), big.NewRat(56789, 1e5)}, + } + want := map[string]Value{ + "s": "x", + "r": []int{1, 2}, + "t": "01:02:03.000004", + "tr": []string{"01:02:03.000004", "05:06:07.000008"}, + "nested": map[string]Value{"b": true}, + "rnested": []Value{map[string]Value{"b": true}, map[string]Value{"b": false}}, + "p": NullInt64{Valid: true, Int64: 17}, + "n": "123.456000000", + "nr": []string{"3.000000000", "0.567890000"}, + } + check("all values", in, want) + check("all values, ptr", &in, want) + check("empty struct", T{}, map[string]Value{"s": "", "t": "00:00:00", "p": NullInt64{}}) + + // Missing and extra fields ignored. + type T2 struct { + S string + // missing R, Nested, RNested + Extra int + } + check("missing and extra", T2{S: "x"}, map[string]Value{"s": "x"}) + + check("nils in slice", T{Rnested: []*N{{true}, nil, {false}}}, + map[string]Value{ + "s": "", + "t": "00:00:00", + "p": NullInt64{}, + "rnested": []Value{map[string]Value{"b": true}, map[string]Value(nil), map[string]Value{"b": false}}, + }) + + check("zero-length repeated", T{Rnested: []*N{}}, + map[string]Value{ + "rnested": []Value{}, + "s": "", + "t": "00:00:00", + "p": NullInt64{}, + }) +} + +func TestStructSaverErrors(t *testing.T) { + type ( + badField struct { + I int `bigquery:"@"` + } + badR struct{ R int } + badRN struct{ R []int } + ) + + for i, test := range []struct { + inputStruct interface{} + schema Schema + }{ + {0, nil}, // not a struct + {&badField{}, nil}, // bad field name + {&badR{}, Schema{{Name: "r", Repeated: true}}}, // repeated field has bad type + {&badR{}, Schema{{Name: "r", Type: RecordFieldType}}}, // nested field has bad type + {&badRN{[]int{0}}, // nested repeated field has bad type + Schema{{Name: "r", Type: RecordFieldType, Repeated: true}}}, + } { + ss := &StructSaver{Struct: test.inputStruct, Schema: test.schema} + _, _, err := ss.Save() + if err == nil { + t.Errorf("#%d, %v, %v: got nil, want error", i, test.inputStruct, test.schema) + } + } +} + +func TestNumericString(t *testing.T) { + for _, test := range []struct { + in *big.Rat + want string + }{ + {big.NewRat(2, 3), "0.666666667"}, // round to 9 places + {big.NewRat(1, 2), "0.500000000"}, + {big.NewRat(1, 2*1e8), "0.000000005"}, + {big.NewRat(5, 1e10), "0.000000001"}, // round up the 5 in the 10th decimal place + {big.NewRat(-5, 1e10), "-0.000000001"}, // round half away from zero + } { + got := NumericString(test.in) + if got != test.want { + t.Errorf("%v: got %q, want %q", test.in, got, test.want) + } + } +} + +func TestConvertRows(t *testing.T) { + schema := Schema{ + {Type: StringFieldType}, + {Type: IntegerFieldType}, + {Type: FloatFieldType}, + {Type: BooleanFieldType}, + } + rows := []*bq.TableRow{ + {F: []*bq.TableCell{ + {V: "a"}, + {V: "1"}, + {V: "1.2"}, + {V: "true"}, + }}, + {F: []*bq.TableCell{ + {V: "b"}, + {V: "2"}, + {V: "2.2"}, + {V: "false"}, + }}, + } + want := [][]Value{ + {"a", int64(1), 1.2, true}, + {"b", int64(2), 2.2, false}, + } + got, err := convertRows(rows, schema) + if err != nil { + t.Fatalf("got %v, want nil", err) + } + if !testutil.Equal(got, want) { + t.Errorf("\ngot %v\nwant %v", got, want) + } + + rows[0].F[0].V = 1 + _, err = convertRows(rows, schema) + if err == nil { + t.Error("got nil, want error") + } +} + +func TestValueList(t *testing.T) { + schema := Schema{ + {Name: "s", Type: StringFieldType}, + {Name: "i", Type: IntegerFieldType}, + {Name: "f", Type: FloatFieldType}, + {Name: "b", Type: BooleanFieldType}, + } + want := []Value{"x", 7, 3.14, true} + var got []Value + vl := (*valueList)(&got) + if err := vl.Load(want, schema); err != nil { + t.Fatal(err) + } + + if !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } + + // Load truncates, not appends. + // https://github.com/GoogleCloudPlatform/google-cloud-go/issues/437 + if err := vl.Load(want, schema); err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } +} + +func TestValueMap(t *testing.T) { + ns := Schema{ + {Name: "x", Type: IntegerFieldType}, + {Name: "y", Type: IntegerFieldType}, + } + schema := Schema{ + {Name: "s", Type: StringFieldType}, + {Name: "i", Type: IntegerFieldType}, + {Name: "f", Type: FloatFieldType}, + {Name: "b", Type: BooleanFieldType}, + {Name: "n", Type: RecordFieldType, Schema: ns}, + {Name: "rn", Type: RecordFieldType, Schema: ns, Repeated: true}, + } + in := []Value{"x", 7, 3.14, true, + []Value{1, 2}, + []Value{[]Value{3, 4}, []Value{5, 6}}, + } + var vm valueMap + if err := vm.Load(in, schema); err != nil { + t.Fatal(err) + } + want := map[string]Value{ + "s": "x", + "i": 7, + "f": 3.14, + "b": true, + "n": map[string]Value{"x": 1, "y": 2}, + "rn": []Value{ + map[string]Value{"x": 3, "y": 4}, + map[string]Value{"x": 5, "y": 6}, + }, + } + if !testutil.Equal(vm, valueMap(want)) { + t.Errorf("got\n%+v\nwant\n%+v", vm, want) + } + + in = make([]Value, len(schema)) + want = map[string]Value{ + "s": nil, + "i": nil, + "f": nil, + "b": nil, + "n": nil, + "rn": nil, + } + var vm2 valueMap + if err := vm2.Load(in, schema); err != nil { + t.Fatal(err) + } + if !testutil.Equal(vm2, valueMap(want)) { + t.Errorf("got\n%+v\nwant\n%+v", vm2, want) + } +} + +var ( + // For testing StructLoader + schema2 = Schema{ + {Name: "s", Type: StringFieldType}, + {Name: "s2", Type: StringFieldType}, + {Name: "by", Type: BytesFieldType}, + {Name: "I", Type: IntegerFieldType}, + {Name: "U", Type: IntegerFieldType}, + {Name: "F", Type: FloatFieldType}, + {Name: "B", Type: BooleanFieldType}, + {Name: "TS", Type: TimestampFieldType}, + {Name: "D", Type: DateFieldType}, + {Name: "T", Type: TimeFieldType}, + {Name: "DT", Type: DateTimeFieldType}, + {Name: "N", Type: NumericFieldType}, + {Name: "nested", Type: RecordFieldType, Schema: Schema{ + {Name: "nestS", Type: StringFieldType}, + {Name: "nestI", Type: IntegerFieldType}, + }}, + {Name: "t", Type: StringFieldType}, + } + + testTimestamp = time.Date(2016, 11, 5, 7, 50, 22, 8, time.UTC) + testDate = civil.Date{Year: 2016, Month: 11, Day: 5} + testTime = civil.Time{Hour: 7, Minute: 50, Second: 22, Nanosecond: 8} + testDateTime = civil.DateTime{Date: testDate, Time: testTime} + testNumeric = big.NewRat(123, 456) + + testValues = []Value{"x", "y", []byte{1, 2, 3}, int64(7), int64(8), 3.14, true, + testTimestamp, testDate, testTime, testDateTime, testNumeric, + []Value{"nested", int64(17)}, "z"} +) + +type testStruct1 struct { + B bool + I int + U uint16 + times + S string + S2 String + By []byte + s string + F float64 + N *big.Rat + Nested nested + Tagged string `bigquery:"t"` +} + +type String string + +type nested struct { + NestS string + NestI int +} + +type times struct { + TS time.Time + T civil.Time + D civil.Date + DT civil.DateTime +} + +func TestStructLoader(t *testing.T) { + var ts1 testStruct1 + mustLoad(t, &ts1, schema2, testValues) + // Note: the schema field named "s" gets matched to the exported struct + // field "S", not the unexported "s". + want := &testStruct1{ + B: true, + I: 7, + U: 8, + F: 3.14, + times: times{TS: testTimestamp, T: testTime, D: testDate, DT: testDateTime}, + S: "x", + S2: "y", + By: []byte{1, 2, 3}, + N: big.NewRat(123, 456), + Nested: nested{NestS: "nested", NestI: 17}, + Tagged: "z", + } + if diff := testutil.Diff(&ts1, want, cmp.AllowUnexported(testStruct1{})); diff != "" { + t.Error(diff) + } + + // Test pointers to nested structs. + type nestedPtr struct{ Nested *nested } + var np nestedPtr + mustLoad(t, &np, schema2, testValues) + want2 := &nestedPtr{Nested: &nested{NestS: "nested", NestI: 17}} + if diff := testutil.Diff(&np, want2); diff != "" { + t.Error(diff) + } + + // Existing values should be reused. + nst := &nested{NestS: "x", NestI: -10} + np = nestedPtr{Nested: nst} + mustLoad(t, &np, schema2, testValues) + if diff := testutil.Diff(&np, want2); diff != "" { + t.Error(diff) + } + if np.Nested != nst { + t.Error("nested struct pointers not equal") + } +} + +type repStruct struct { + Nums []int + ShortNums [2]int // to test truncation + LongNums [5]int // to test padding with zeroes + Nested []*nested +} + +var ( + repSchema = Schema{ + {Name: "nums", Type: IntegerFieldType, Repeated: true}, + {Name: "shortNums", Type: IntegerFieldType, Repeated: true}, + {Name: "longNums", Type: IntegerFieldType, Repeated: true}, + {Name: "nested", Type: RecordFieldType, Repeated: true, Schema: Schema{ + {Name: "nestS", Type: StringFieldType}, + {Name: "nestI", Type: IntegerFieldType}, + }}, + } + v123 = []Value{int64(1), int64(2), int64(3)} + repValues = []Value{v123, v123, v123, + []Value{ + []Value{"x", int64(1)}, + []Value{"y", int64(2)}, + }, + } +) + +func TestStructLoaderRepeated(t *testing.T) { + var r1 repStruct + mustLoad(t, &r1, repSchema, repValues) + want := repStruct{ + Nums: []int{1, 2, 3}, + ShortNums: [...]int{1, 2}, // extra values discarded + LongNums: [...]int{1, 2, 3, 0, 0}, + Nested: []*nested{{"x", 1}, {"y", 2}}, + } + if diff := testutil.Diff(r1, want); diff != "" { + t.Error(diff) + } + r2 := repStruct{ + Nums: []int{-1, -2, -3, -4, -5}, // truncated to zero and appended to + LongNums: [...]int{-1, -2, -3, -4, -5}, // unset elements are zeroed + } + mustLoad(t, &r2, repSchema, repValues) + if diff := testutil.Diff(r2, want); diff != "" { + t.Error(diff) + } + if got, want := cap(r2.Nums), 5; got != want { + t.Errorf("cap(r2.Nums) = %d, want %d", got, want) + } + + // Short slice case. + r3 := repStruct{Nums: []int{-1}} + mustLoad(t, &r3, repSchema, repValues) + if diff := testutil.Diff(r3, want); diff != "" { + t.Error(diff) + } + if got, want := cap(r3.Nums), 3; got != want { + t.Errorf("cap(r3.Nums) = %d, want %d", got, want) + } +} + +type testStructNullable struct { + String NullString + Bytes []byte + Integer NullInt64 + Float NullFloat64 + Boolean NullBool + Timestamp NullTimestamp + Date NullDate + Time NullTime + DateTime NullDateTime + Numeric *big.Rat + Record *subNullable +} + +type subNullable struct { + X NullInt64 +} + +var testStructNullableSchema = Schema{ + {Name: "String", Type: StringFieldType, Required: false}, + {Name: "Bytes", Type: BytesFieldType, Required: false}, + {Name: "Integer", Type: IntegerFieldType, Required: false}, + {Name: "Float", Type: FloatFieldType, Required: false}, + {Name: "Boolean", Type: BooleanFieldType, Required: false}, + {Name: "Timestamp", Type: TimestampFieldType, Required: false}, + {Name: "Date", Type: DateFieldType, Required: false}, + {Name: "Time", Type: TimeFieldType, Required: false}, + {Name: "DateTime", Type: DateTimeFieldType, Required: false}, + {Name: "Numeric", Type: NumericFieldType, Required: false}, + {Name: "Record", Type: RecordFieldType, Required: false, Schema: Schema{ + {Name: "X", Type: IntegerFieldType, Required: false}, + }}, +} + +func TestStructLoaderNullable(t *testing.T) { + var ts testStructNullable + nilVals := make([]Value, len(testStructNullableSchema)) + mustLoad(t, &ts, testStructNullableSchema, nilVals) + want := testStructNullable{} + if diff := testutil.Diff(ts, want); diff != "" { + t.Error(diff) + } + + nonnilVals := []Value{"x", []byte{1, 2, 3}, int64(1), 2.3, true, testTimestamp, testDate, testTime, + testDateTime, big.NewRat(1, 2), []Value{int64(4)}} + + // All ts fields are nil. Loading non-nil values will cause them all to + // be allocated. + mustLoad(t, &ts, testStructNullableSchema, nonnilVals) + want = testStructNullable{ + String: NullString{StringVal: "x", Valid: true}, + Bytes: []byte{1, 2, 3}, + Integer: NullInt64{Int64: 1, Valid: true}, + Float: NullFloat64{Float64: 2.3, Valid: true}, + Boolean: NullBool{Bool: true, Valid: true}, + Timestamp: NullTimestamp{Timestamp: testTimestamp, Valid: true}, + Date: NullDate{Date: testDate, Valid: true}, + Time: NullTime{Time: testTime, Valid: true}, + DateTime: NullDateTime{DateTime: testDateTime, Valid: true}, + Numeric: big.NewRat(1, 2), + Record: &subNullable{X: NullInt64{Int64: 4, Valid: true}}, + } + if diff := testutil.Diff(ts, want); diff != "" { + t.Error(diff) + } + + // Struct pointers are reused, byte slices are not. + want = ts + want.Bytes = []byte{17} + vals2 := []Value{nil, []byte{17}, nil, nil, nil, nil, nil, nil, nil, nil, []Value{int64(7)}} + mustLoad(t, &ts, testStructNullableSchema, vals2) + if ts.Record != want.Record { + t.Error("record pointers not identical") + } +} + +func TestStructLoaderOverflow(t *testing.T) { + type S struct { + I int16 + U uint16 + F float32 + } + schema := Schema{ + {Name: "I", Type: IntegerFieldType}, + {Name: "U", Type: IntegerFieldType}, + {Name: "F", Type: FloatFieldType}, + } + var s S + z64 := int64(0) + for _, vals := range [][]Value{ + {int64(math.MaxInt16 + 1), z64, 0}, + {z64, int64(math.MaxInt32), 0}, + {z64, int64(-1), 0}, + {z64, z64, math.MaxFloat32 * 2}, + } { + if err := load(&s, schema, vals); err == nil { + t.Errorf("%+v: got nil, want error", vals) + } + } +} + +func TestStructLoaderFieldOverlap(t *testing.T) { + // It's OK if the struct has fields that the schema does not, and vice versa. + type S1 struct { + I int + X [][]int // not in the schema; does not even correspond to a valid BigQuery type + // many schema fields missing + } + var s1 S1 + if err := load(&s1, schema2, testValues); err != nil { + t.Fatal(err) + } + want1 := S1{I: 7} + if diff := testutil.Diff(s1, want1); diff != "" { + t.Error(diff) + } + + // It's even valid to have no overlapping fields at all. + type S2 struct{ Z int } + + var s2 S2 + mustLoad(t, &s2, schema2, testValues) + want2 := S2{} + if diff := testutil.Diff(s2, want2); diff != "" { + t.Error(diff) + } +} + +func TestStructLoaderErrors(t *testing.T) { + check := func(sp interface{}) { + var sl structLoader + err := sl.set(sp, schema2) + if err == nil { + t.Errorf("%T: got nil, want error", sp) + } + } + + type bad1 struct{ F int32 } // wrong type for FLOAT column + check(&bad1{}) + + type bad2 struct{ I uint } // unsupported integer type + check(&bad2{}) + + type bad3 struct { + I int `bigquery:"@"` + } // bad field name + check(&bad3{}) + + type bad4 struct{ Nested int } // non-struct for nested field + check(&bad4{}) + + type bad5 struct{ Nested struct{ NestS int } } // bad nested struct + check(&bad5{}) + + bad6 := &struct{ Nums int }{} // non-slice for repeated field + sl := structLoader{} + err := sl.set(bad6, repSchema) + if err == nil { + t.Errorf("%T: got nil, want error", bad6) + } + + // sl.set's error is sticky, even with good input. + err2 := sl.set(&repStruct{}, repSchema) + if err2 != err { + t.Errorf("%v != %v, expected equal", err2, err) + } + // sl.Load is similarly sticky + err2 = sl.Load(nil, nil) + if err2 != err { + t.Errorf("%v != %v, expected equal", err2, err) + } + + // Null values. + schema := Schema{ + {Name: "i", Type: IntegerFieldType}, + {Name: "f", Type: FloatFieldType}, + {Name: "b", Type: BooleanFieldType}, + {Name: "s", Type: StringFieldType}, + {Name: "d", Type: DateFieldType}, + {Name: "r", Type: RecordFieldType, Schema: Schema{{Name: "X", Type: IntegerFieldType}}}, + } + type s struct { + I int + F float64 + B bool + S string + D civil.Date + } + vals := []Value{int64(0), 0.0, false, "", testDate} + mustLoad(t, &s{}, schema, vals) + for i, e := range vals { + vals[i] = nil + got := load(&s{}, schema, vals) + if got != errNoNulls { + t.Errorf("#%d: got %v, want %v", i, got, errNoNulls) + } + vals[i] = e + } + + // Using more than one struct type with the same structLoader. + type different struct { + B bool + I int + times + S string + s string + Nums []int + } + + sl = structLoader{} + if err := sl.set(&testStruct1{}, schema2); err != nil { + t.Fatal(err) + } + err = sl.set(&different{}, schema2) + if err == nil { + t.Error("different struct types: got nil, want error") + } +} + +func mustLoad(t *testing.T, pval interface{}, schema Schema, vals []Value) { + if err := load(pval, schema, vals); err != nil { + t.Fatalf("loading: %v", err) + } +} + +func load(pval interface{}, schema Schema, vals []Value) error { + var sl structLoader + if err := sl.set(pval, schema); err != nil { + return err + } + return sl.Load(vals, nil) +} + +func BenchmarkStructLoader_NoCompile(b *testing.B) { + benchmarkStructLoader(b, false) +} + +func BenchmarkStructLoader_Compile(b *testing.B) { + benchmarkStructLoader(b, true) +} + +func benchmarkStructLoader(b *testing.B, compile bool) { + var ts1 testStruct1 + for i := 0; i < b.N; i++ { + var sl structLoader + for j := 0; j < 10; j++ { + if err := load(&ts1, schema2, testValues); err != nil { + b.Fatal(err) + } + if !compile { + sl.typ = nil + } + } + } +} diff --git a/vendor/cloud.google.com/go/bigtable/admin.go b/vendor/cloud.google.com/go/bigtable/admin.go new file mode 100644 index 000000000..5a0c23480 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/admin.go @@ -0,0 +1,1135 @@ +/* +Copyright 2015 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 bigtable + +import ( + "context" + "errors" + "fmt" + "math" + "regexp" + "strings" + "time" + + "cloud.google.com/go/bigtable/internal/gax" + btopt "cloud.google.com/go/bigtable/internal/option" + "cloud.google.com/go/iam" + "cloud.google.com/go/internal/optional" + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/ptypes" + durpb "github.com/golang/protobuf/ptypes/duration" + "google.golang.org/api/cloudresourcemanager/v1" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + gtransport "google.golang.org/api/transport/grpc" + btapb "google.golang.org/genproto/googleapis/bigtable/admin/v2" + "google.golang.org/genproto/protobuf/field_mask" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +const adminAddr = "bigtableadmin.googleapis.com:443" + +// AdminClient is a client type for performing admin operations within a specific instance. +type AdminClient struct { + conn *grpc.ClientConn + tClient btapb.BigtableTableAdminClient + lroClient *lroauto.OperationsClient + + project, instance string + + // Metadata to be sent with each request. + md metadata.MD +} + +// NewAdminClient creates a new AdminClient for a given project and instance. +func NewAdminClient(ctx context.Context, project, instance string, opts ...option.ClientOption) (*AdminClient, error) { + o, err := btopt.DefaultClientOptions(adminAddr, AdminScope, clientUserAgent) + if err != nil { + return nil, err + } + // Need to add scopes for long running operations (for create table & snapshots) + o = append(o, option.WithScopes(cloudresourcemanager.CloudPlatformScope)) + o = append(o, opts...) + conn, err := gtransport.Dial(ctx, o...) + if err != nil { + return nil, fmt.Errorf("dialing: %v", err) + } + + lroClient, err := lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + + return &AdminClient{ + conn: conn, + tClient: btapb.NewBigtableTableAdminClient(conn), + lroClient: lroClient, + project: project, + instance: instance, + md: metadata.Pairs(resourcePrefixHeader, fmt.Sprintf("projects/%s/instances/%s", project, instance)), + }, nil +} + +// Close closes the AdminClient. +func (ac *AdminClient) Close() error { + return ac.conn.Close() +} + +func (ac *AdminClient) instancePrefix() string { + return fmt.Sprintf("projects/%s/instances/%s", ac.project, ac.instance) +} + +// Tables returns a list of the tables in the instance. +func (ac *AdminClient) Tables(ctx context.Context) ([]string, error) { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + req := &btapb.ListTablesRequest{ + Parent: prefix, + } + + var res *btapb.ListTablesResponse + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + res, err = ac.tClient.ListTables(ctx, req) + return err + }, retryOptions...) + if err != nil { + return nil, err + } + + names := make([]string, 0, len(res.Tables)) + for _, tbl := range res.Tables { + names = append(names, strings.TrimPrefix(tbl.Name, prefix+"/tables/")) + } + return names, nil +} + +// TableConf contains all of the information necessary to create a table with column families. +type TableConf struct { + TableID string + SplitKeys []string + // Families is a map from family name to GCPolicy + Families map[string]GCPolicy +} + +// CreateTable creates a new table in the instance. +// This method may return before the table's creation is complete. +func (ac *AdminClient) CreateTable(ctx context.Context, table string) error { + return ac.CreateTableFromConf(ctx, &TableConf{TableID: table}) +} + +// CreatePresplitTable creates a new table in the instance. +// The list of row keys will be used to initially split the table into multiple tablets. +// Given two split keys, "s1" and "s2", three tablets will be created, +// spanning the key ranges: [, s1), [s1, s2), [s2, ). +// This method may return before the table's creation is complete. +func (ac *AdminClient) CreatePresplitTable(ctx context.Context, table string, splitKeys []string) error { + return ac.CreateTableFromConf(ctx, &TableConf{TableID: table, SplitKeys: splitKeys}) +} + +// CreateTableFromConf creates a new table in the instance from the given configuration. +func (ac *AdminClient) CreateTableFromConf(ctx context.Context, conf *TableConf) error { + ctx = mergeOutgoingMetadata(ctx, ac.md) + var reqSplits []*btapb.CreateTableRequest_Split + for _, split := range conf.SplitKeys { + reqSplits = append(reqSplits, &btapb.CreateTableRequest_Split{Key: []byte(split)}) + } + var tbl btapb.Table + if conf.Families != nil { + tbl.ColumnFamilies = make(map[string]*btapb.ColumnFamily) + for fam, policy := range conf.Families { + tbl.ColumnFamilies[fam] = &btapb.ColumnFamily{GcRule: policy.proto()} + } + } + prefix := ac.instancePrefix() + req := &btapb.CreateTableRequest{ + Parent: prefix, + TableId: conf.TableID, + Table: &tbl, + InitialSplits: reqSplits, + } + _, err := ac.tClient.CreateTable(ctx, req) + return err +} + +// CreateColumnFamily creates a new column family in a table. +func (ac *AdminClient) CreateColumnFamily(ctx context.Context, table, family string) error { + // TODO(dsymonds): Permit specifying gcexpr and any other family settings. + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + req := &btapb.ModifyColumnFamiliesRequest{ + Name: prefix + "/tables/" + table, + Modifications: []*btapb.ModifyColumnFamiliesRequest_Modification{{ + Id: family, + Mod: &btapb.ModifyColumnFamiliesRequest_Modification_Create{Create: &btapb.ColumnFamily{}}, + }}, + } + _, err := ac.tClient.ModifyColumnFamilies(ctx, req) + return err +} + +// DeleteTable deletes a table and all of its data. +func (ac *AdminClient) DeleteTable(ctx context.Context, table string) error { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + req := &btapb.DeleteTableRequest{ + Name: prefix + "/tables/" + table, + } + _, err := ac.tClient.DeleteTable(ctx, req) + return err +} + +// DeleteColumnFamily deletes a column family in a table and all of its data. +func (ac *AdminClient) DeleteColumnFamily(ctx context.Context, table, family string) error { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + req := &btapb.ModifyColumnFamiliesRequest{ + Name: prefix + "/tables/" + table, + Modifications: []*btapb.ModifyColumnFamiliesRequest_Modification{{ + Id: family, + Mod: &btapb.ModifyColumnFamiliesRequest_Modification_Drop{Drop: true}, + }}, + } + _, err := ac.tClient.ModifyColumnFamilies(ctx, req) + return err +} + +// TableInfo represents information about a table. +type TableInfo struct { + // DEPRECATED - This field is deprecated. Please use FamilyInfos instead. + Families []string + FamilyInfos []FamilyInfo +} + +// FamilyInfo represents information about a column family. +type FamilyInfo struct { + Name string + GCPolicy string +} + +// TableInfo retrieves information about a table. +func (ac *AdminClient) TableInfo(ctx context.Context, table string) (*TableInfo, error) { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + req := &btapb.GetTableRequest{ + Name: prefix + "/tables/" + table, + } + + var res *btapb.Table + + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + res, err = ac.tClient.GetTable(ctx, req) + return err + }, retryOptions...) + if err != nil { + return nil, err + } + + ti := &TableInfo{} + for name, fam := range res.ColumnFamilies { + ti.Families = append(ti.Families, name) + ti.FamilyInfos = append(ti.FamilyInfos, FamilyInfo{Name: name, GCPolicy: GCRuleToString(fam.GcRule)}) + } + return ti, nil +} + +// SetGCPolicy specifies which cells in a column family should be garbage collected. +// GC executes opportunistically in the background; table reads may return data +// matching the GC policy. +func (ac *AdminClient) SetGCPolicy(ctx context.Context, table, family string, policy GCPolicy) error { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + req := &btapb.ModifyColumnFamiliesRequest{ + Name: prefix + "/tables/" + table, + Modifications: []*btapb.ModifyColumnFamiliesRequest_Modification{{ + Id: family, + Mod: &btapb.ModifyColumnFamiliesRequest_Modification_Update{Update: &btapb.ColumnFamily{GcRule: policy.proto()}}, + }}, + } + _, err := ac.tClient.ModifyColumnFamilies(ctx, req) + return err +} + +// DropRowRange permanently deletes a row range from the specified table. +func (ac *AdminClient) DropRowRange(ctx context.Context, table, rowKeyPrefix string) error { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + req := &btapb.DropRowRangeRequest{ + Name: prefix + "/tables/" + table, + Target: &btapb.DropRowRangeRequest_RowKeyPrefix{RowKeyPrefix: []byte(rowKeyPrefix)}, + } + _, err := ac.tClient.DropRowRange(ctx, req) + return err +} + +// CreateTableFromSnapshot creates a table from snapshot. +// The table will be created in the same cluster as the snapshot. +// +// This is a private alpha release of Cloud Bigtable snapshots. This feature +// is not currently available to most Cloud Bigtable customers. This feature +// might be changed in backward-incompatible ways and is not recommended for +// production use. It is not subject to any SLA or deprecation policy. +func (ac *AdminClient) CreateTableFromSnapshot(ctx context.Context, table, cluster, snapshot string) error { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + snapshotPath := prefix + "/clusters/" + cluster + "/snapshots/" + snapshot + + req := &btapb.CreateTableFromSnapshotRequest{ + Parent: prefix, + TableId: table, + SourceSnapshot: snapshotPath, + } + op, err := ac.tClient.CreateTableFromSnapshot(ctx, req) + if err != nil { + return err + } + resp := btapb.Table{} + return longrunning.InternalNewOperation(ac.lroClient, op).Wait(ctx, &resp) +} + +// DefaultSnapshotDuration is the default TTL for a snapshot. +const DefaultSnapshotDuration time.Duration = 0 + +// SnapshotTable creates a new snapshot in the specified cluster from the +// specified source table. Setting the TTL to `DefaultSnapshotDuration` will +// use the server side default for the duration. +// +// This is a private alpha release of Cloud Bigtable snapshots. This feature +// is not currently available to most Cloud Bigtable customers. This feature +// might be changed in backward-incompatible ways and is not recommended for +// production use. It is not subject to any SLA or deprecation policy. +func (ac *AdminClient) SnapshotTable(ctx context.Context, table, cluster, snapshot string, ttl time.Duration) error { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + + var ttlProto *durpb.Duration + + if ttl > 0 { + ttlProto = ptypes.DurationProto(ttl) + } + + req := &btapb.SnapshotTableRequest{ + Name: prefix + "/tables/" + table, + Cluster: prefix + "/clusters/" + cluster, + SnapshotId: snapshot, + Ttl: ttlProto, + } + + op, err := ac.tClient.SnapshotTable(ctx, req) + if err != nil { + return err + } + resp := btapb.Snapshot{} + return longrunning.InternalNewOperation(ac.lroClient, op).Wait(ctx, &resp) +} + +// Snapshots returns a SnapshotIterator for iterating over the snapshots in a cluster. +// To list snapshots across all of the clusters in the instance specify "-" as the cluster. +// +// This is a private alpha release of Cloud Bigtable snapshots. This feature is not +// currently available to most Cloud Bigtable customers. This feature might be +// changed in backward-incompatible ways and is not recommended for production use. +// It is not subject to any SLA or deprecation policy. +func (ac *AdminClient) Snapshots(ctx context.Context, cluster string) *SnapshotIterator { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + clusterPath := prefix + "/clusters/" + cluster + + it := &SnapshotIterator{} + req := &btapb.ListSnapshotsRequest{ + Parent: clusterPath, + } + + fetch := func(pageSize int, pageToken string) (string, error) { + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + + var resp *btapb.ListSnapshotsResponse + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + resp, err = ac.tClient.ListSnapshots(ctx, req) + return err + }, retryOptions...) + if err != nil { + return "", err + } + for _, s := range resp.Snapshots { + snapshotInfo, err := newSnapshotInfo(s) + if err != nil { + return "", fmt.Errorf("Failed to parse snapshot proto %v", err) + } + it.items = append(it.items, snapshotInfo) + } + return resp.NextPageToken, nil + } + bufLen := func() int { return len(it.items) } + takeBuf := func() interface{} { b := it.items; it.items = nil; return b } + + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, bufLen, takeBuf) + + return it +} + +func newSnapshotInfo(snapshot *btapb.Snapshot) (*SnapshotInfo, error) { + nameParts := strings.Split(snapshot.Name, "/") + name := nameParts[len(nameParts)-1] + tablePathParts := strings.Split(snapshot.SourceTable.Name, "/") + tableID := tablePathParts[len(tablePathParts)-1] + + createTime, err := ptypes.Timestamp(snapshot.CreateTime) + if err != nil { + return nil, fmt.Errorf("Invalid createTime: %v", err) + } + + deleteTime, err := ptypes.Timestamp(snapshot.DeleteTime) + if err != nil { + return nil, fmt.Errorf("Invalid deleteTime: %v", err) + } + + return &SnapshotInfo{ + Name: name, + SourceTable: tableID, + DataSize: snapshot.DataSizeBytes, + CreateTime: createTime, + DeleteTime: deleteTime, + }, nil +} + +// SnapshotIterator is an EntryIterator that iterates over log entries. +// +// This is a private alpha release of Cloud Bigtable snapshots. This feature +// is not currently available to most Cloud Bigtable customers. This feature +// might be changed in backward-incompatible ways and is not recommended for +// production use. It is not subject to any SLA or deprecation policy. +type SnapshotIterator struct { + items []*SnapshotInfo + pageInfo *iterator.PageInfo + nextFunc func() error +} + +// PageInfo supports pagination. See https://godoc.org/google.golang.org/api/iterator package for details. +func (it *SnapshotIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done +// (https://godoc.org/google.golang.org/api/iterator) if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *SnapshotIterator) Next() (*SnapshotInfo, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +// SnapshotInfo contains snapshot metadata. +type SnapshotInfo struct { + Name string + SourceTable string + DataSize int64 + CreateTime time.Time + DeleteTime time.Time +} + +// SnapshotInfo gets snapshot metadata. +// +// This is a private alpha release of Cloud Bigtable snapshots. This feature +// is not currently available to most Cloud Bigtable customers. This feature +// might be changed in backward-incompatible ways and is not recommended for +// production use. It is not subject to any SLA or deprecation policy. +func (ac *AdminClient) SnapshotInfo(ctx context.Context, cluster, snapshot string) (*SnapshotInfo, error) { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + clusterPath := prefix + "/clusters/" + cluster + snapshotPath := clusterPath + "/snapshots/" + snapshot + + req := &btapb.GetSnapshotRequest{ + Name: snapshotPath, + } + + var resp *btapb.Snapshot + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + resp, err = ac.tClient.GetSnapshot(ctx, req) + return err + }, retryOptions...) + if err != nil { + return nil, err + } + + return newSnapshotInfo(resp) +} + +// DeleteSnapshot deletes a snapshot in a cluster. +// +// This is a private alpha release of Cloud Bigtable snapshots. This feature +// is not currently available to most Cloud Bigtable customers. This feature +// might be changed in backward-incompatible ways and is not recommended for +// production use. It is not subject to any SLA or deprecation policy. +func (ac *AdminClient) DeleteSnapshot(ctx context.Context, cluster, snapshot string) error { + ctx = mergeOutgoingMetadata(ctx, ac.md) + prefix := ac.instancePrefix() + clusterPath := prefix + "/clusters/" + cluster + snapshotPath := clusterPath + "/snapshots/" + snapshot + + req := &btapb.DeleteSnapshotRequest{ + Name: snapshotPath, + } + _, err := ac.tClient.DeleteSnapshot(ctx, req) + return err +} + +// getConsistencyToken gets the consistency token for a table. +func (ac *AdminClient) getConsistencyToken(ctx context.Context, tableName string) (string, error) { + req := &btapb.GenerateConsistencyTokenRequest{ + Name: tableName, + } + resp, err := ac.tClient.GenerateConsistencyToken(ctx, req) + if err != nil { + return "", err + } + return resp.GetConsistencyToken(), nil +} + +// isConsistent checks if a token is consistent for a table. +func (ac *AdminClient) isConsistent(ctx context.Context, tableName, token string) (bool, error) { + req := &btapb.CheckConsistencyRequest{ + Name: tableName, + ConsistencyToken: token, + } + var resp *btapb.CheckConsistencyResponse + + // Retry calls on retryable errors to avoid losing the token gathered before. + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + resp, err = ac.tClient.CheckConsistency(ctx, req) + return err + }, retryOptions...) + if err != nil { + return false, err + } + return resp.GetConsistent(), nil +} + +// WaitForReplication waits until all the writes committed before the call started have been propagated to all the clusters in the instance via replication. +func (ac *AdminClient) WaitForReplication(ctx context.Context, table string) error { + // Get the token. + prefix := ac.instancePrefix() + tableName := prefix + "/tables/" + table + token, err := ac.getConsistencyToken(ctx, tableName) + if err != nil { + return err + } + + // Periodically check if the token is consistent. + timer := time.NewTicker(time.Second * 10) + defer timer.Stop() + for { + consistent, err := ac.isConsistent(ctx, tableName, token) + if err != nil { + return err + } + if consistent { + return nil + } + // Sleep for a bit or until the ctx is cancelled. + select { + case <-ctx.Done(): + return ctx.Err() + case <-timer.C: + } + } +} + +const instanceAdminAddr = "bigtableadmin.googleapis.com:443" + +// InstanceAdminClient is a client type for performing admin operations on instances. +// These operations can be substantially more dangerous than those provided by AdminClient. +type InstanceAdminClient struct { + conn *grpc.ClientConn + iClient btapb.BigtableInstanceAdminClient + lroClient *lroauto.OperationsClient + + project string + + // Metadata to be sent with each request. + md metadata.MD +} + +// NewInstanceAdminClient creates a new InstanceAdminClient for a given project. +func NewInstanceAdminClient(ctx context.Context, project string, opts ...option.ClientOption) (*InstanceAdminClient, error) { + o, err := btopt.DefaultClientOptions(instanceAdminAddr, InstanceAdminScope, clientUserAgent) + if err != nil { + return nil, err + } + o = append(o, opts...) + conn, err := gtransport.Dial(ctx, o...) + if err != nil { + return nil, fmt.Errorf("dialing: %v", err) + } + + lroClient, err := lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + + return &InstanceAdminClient{ + conn: conn, + iClient: btapb.NewBigtableInstanceAdminClient(conn), + lroClient: lroClient, + + project: project, + md: metadata.Pairs(resourcePrefixHeader, "projects/"+project), + }, nil +} + +// Close closes the InstanceAdminClient. +func (iac *InstanceAdminClient) Close() error { + return iac.conn.Close() +} + +// StorageType is the type of storage used for all tables in an instance +type StorageType int + +const ( + SSD StorageType = iota + HDD +) + +func (st StorageType) proto() btapb.StorageType { + if st == HDD { + return btapb.StorageType_HDD + } + return btapb.StorageType_SSD +} + +// InstanceType is the type of the instance +type InstanceType int32 + +const ( + PRODUCTION InstanceType = InstanceType(btapb.Instance_PRODUCTION) + DEVELOPMENT = InstanceType(btapb.Instance_DEVELOPMENT) +) + +// InstanceInfo represents information about an instance +type InstanceInfo struct { + Name string // name of the instance + DisplayName string // display name for UIs +} + +// InstanceConf contains the information necessary to create an Instance +type InstanceConf struct { + InstanceId, DisplayName, ClusterId, Zone string + // NumNodes must not be specified for DEVELOPMENT instance types + NumNodes int32 + StorageType StorageType + InstanceType InstanceType +} + +// InstanceWithClustersConfig contains the information necessary to create an Instance +type InstanceWithClustersConfig struct { + InstanceID, DisplayName string + Clusters []ClusterConfig + InstanceType InstanceType +} + +var instanceNameRegexp = regexp.MustCompile(`^projects/([^/]+)/instances/([a-z][-a-z0-9]*)$`) + +// CreateInstance creates a new instance in the project. +// This method will return when the instance has been created or when an error occurs. +func (iac *InstanceAdminClient) CreateInstance(ctx context.Context, conf *InstanceConf) error { + newConfig := InstanceWithClustersConfig{ + InstanceID: conf.InstanceId, + DisplayName: conf.DisplayName, + InstanceType: conf.InstanceType, + Clusters: []ClusterConfig{ + { + InstanceID: conf.InstanceId, + ClusterID: conf.ClusterId, + Zone: conf.Zone, + NumNodes: conf.NumNodes, + StorageType: conf.StorageType, + }, + }, + } + return iac.CreateInstanceWithClusters(ctx, &newConfig) +} + +// CreateInstanceWithClusters creates a new instance with configured clusters in the project. +// This method will return when the instance has been created or when an error occurs. +func (iac *InstanceAdminClient) CreateInstanceWithClusters(ctx context.Context, conf *InstanceWithClustersConfig) error { + ctx = mergeOutgoingMetadata(ctx, iac.md) + clusters := make(map[string]*btapb.Cluster) + for _, cluster := range conf.Clusters { + clusters[cluster.ClusterID] = cluster.proto(iac.project) + } + + req := &btapb.CreateInstanceRequest{ + Parent: "projects/" + iac.project, + InstanceId: conf.InstanceID, + Instance: &btapb.Instance{DisplayName: conf.DisplayName, Type: btapb.Instance_Type(conf.InstanceType)}, + Clusters: clusters, + } + + lro, err := iac.iClient.CreateInstance(ctx, req) + if err != nil { + return err + } + resp := btapb.Instance{} + return longrunning.InternalNewOperation(iac.lroClient, lro).Wait(ctx, &resp) +} + +// DeleteInstance deletes an instance from the project. +func (iac *InstanceAdminClient) DeleteInstance(ctx context.Context, instanceID string) error { + ctx = mergeOutgoingMetadata(ctx, iac.md) + req := &btapb.DeleteInstanceRequest{Name: "projects/" + iac.project + "/instances/" + instanceID} + _, err := iac.iClient.DeleteInstance(ctx, req) + return err +} + +// Instances returns a list of instances in the project. +func (iac *InstanceAdminClient) Instances(ctx context.Context) ([]*InstanceInfo, error) { + ctx = mergeOutgoingMetadata(ctx, iac.md) + req := &btapb.ListInstancesRequest{ + Parent: "projects/" + iac.project, + } + var res *btapb.ListInstancesResponse + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + res, err = iac.iClient.ListInstances(ctx, req) + return err + }, retryOptions...) + if err != nil { + return nil, err + } + if len(res.FailedLocations) > 0 { + // We don't have a good way to return a partial result in the face of some zones being unavailable. + // Fail the entire request. + return nil, status.Errorf(codes.Unavailable, "Failed locations: %v", res.FailedLocations) + } + + var is []*InstanceInfo + for _, i := range res.Instances { + m := instanceNameRegexp.FindStringSubmatch(i.Name) + if m == nil { + return nil, fmt.Errorf("malformed instance name %q", i.Name) + } + is = append(is, &InstanceInfo{ + Name: m[2], + DisplayName: i.DisplayName, + }) + } + return is, nil +} + +// InstanceInfo returns information about an instance. +func (iac *InstanceAdminClient) InstanceInfo(ctx context.Context, instanceID string) (*InstanceInfo, error) { + ctx = mergeOutgoingMetadata(ctx, iac.md) + req := &btapb.GetInstanceRequest{ + Name: "projects/" + iac.project + "/instances/" + instanceID, + } + var res *btapb.Instance + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + res, err = iac.iClient.GetInstance(ctx, req) + return err + }, retryOptions...) + if err != nil { + return nil, err + } + + m := instanceNameRegexp.FindStringSubmatch(res.Name) + if m == nil { + return nil, fmt.Errorf("malformed instance name %q", res.Name) + } + return &InstanceInfo{ + Name: m[2], + DisplayName: res.DisplayName, + }, nil +} + +// ClusterConfig contains the information necessary to create a cluster +type ClusterConfig struct { + InstanceID, ClusterID, Zone string + NumNodes int32 + StorageType StorageType +} + +func (cc *ClusterConfig) proto(project string) *btapb.Cluster { + return &btapb.Cluster{ + ServeNodes: cc.NumNodes, + DefaultStorageType: cc.StorageType.proto(), + Location: "projects/" + project + "/locations/" + cc.Zone, + } +} + +// ClusterInfo represents information about a cluster. +type ClusterInfo struct { + Name string // name of the cluster + Zone string // GCP zone of the cluster (e.g. "us-central1-a") + ServeNodes int // number of allocated serve nodes + State string // state of the cluster +} + +// CreateCluster creates a new cluster in an instance. +// This method will return when the cluster has been created or when an error occurs. +func (iac *InstanceAdminClient) CreateCluster(ctx context.Context, conf *ClusterConfig) error { + ctx = mergeOutgoingMetadata(ctx, iac.md) + + req := &btapb.CreateClusterRequest{ + Parent: "projects/" + iac.project + "/instances/" + conf.InstanceID, + ClusterId: conf.ClusterID, + Cluster: conf.proto(iac.project), + } + + lro, err := iac.iClient.CreateCluster(ctx, req) + if err != nil { + return err + } + resp := btapb.Cluster{} + return longrunning.InternalNewOperation(iac.lroClient, lro).Wait(ctx, &resp) +} + +// DeleteCluster deletes a cluster from an instance. +func (iac *InstanceAdminClient) DeleteCluster(ctx context.Context, instanceID, clusterID string) error { + ctx = mergeOutgoingMetadata(ctx, iac.md) + req := &btapb.DeleteClusterRequest{Name: "projects/" + iac.project + "/instances/" + instanceID + "/clusters/" + clusterID} + _, err := iac.iClient.DeleteCluster(ctx, req) + return err +} + +// UpdateCluster updates attributes of a cluster +func (iac *InstanceAdminClient) UpdateCluster(ctx context.Context, instanceID, clusterID string, serveNodes int32) error { + ctx = mergeOutgoingMetadata(ctx, iac.md) + cluster := &btapb.Cluster{ + Name: "projects/" + iac.project + "/instances/" + instanceID + "/clusters/" + clusterID, + ServeNodes: serveNodes} + lro, err := iac.iClient.UpdateCluster(ctx, cluster) + if err != nil { + return err + } + return longrunning.InternalNewOperation(iac.lroClient, lro).Wait(ctx, nil) +} + +// Clusters lists the clusters in an instance. +func (iac *InstanceAdminClient) Clusters(ctx context.Context, instanceID string) ([]*ClusterInfo, error) { + ctx = mergeOutgoingMetadata(ctx, iac.md) + req := &btapb.ListClustersRequest{Parent: "projects/" + iac.project + "/instances/" + instanceID} + var res *btapb.ListClustersResponse + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + res, err = iac.iClient.ListClusters(ctx, req) + return err + }, retryOptions...) + if err != nil { + return nil, err + } + // TODO(garyelliott): Deal with failed_locations. + var cis []*ClusterInfo + for _, c := range res.Clusters { + nameParts := strings.Split(c.Name, "/") + locParts := strings.Split(c.Location, "/") + cis = append(cis, &ClusterInfo{ + Name: nameParts[len(nameParts)-1], + Zone: locParts[len(locParts)-1], + ServeNodes: int(c.ServeNodes), + State: c.State.String(), + }) + } + return cis, nil +} + +// GetCluster fetches a cluster in an instance +func (iac *InstanceAdminClient) GetCluster(ctx context.Context, instanceID, clusterID string) (*ClusterInfo, error) { + ctx = mergeOutgoingMetadata(ctx, iac.md) + req := &btapb.GetClusterRequest{Name: "projects/" + iac.project + "/instances/" + instanceID + "/clusters/" + clusterID} + var c *btapb.Cluster + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + c, err = iac.iClient.GetCluster(ctx, req) + return err + }, retryOptions...) + if err != nil { + return nil, err + } + + nameParts := strings.Split(c.Name, "/") + locParts := strings.Split(c.Location, "/") + cis := &ClusterInfo{ + Name: nameParts[len(nameParts)-1], + Zone: locParts[len(locParts)-1], + ServeNodes: int(c.ServeNodes), + State: c.State.String(), + } + return cis, nil +} + +// InstanceIAM returns the instance's IAM handle. +func (iac *InstanceAdminClient) InstanceIAM(instanceID string) *iam.Handle { + return iam.InternalNewHandleGRPCClient(iac.iClient, "projects/"+iac.project+"/instances/"+instanceID) + +} + +// Routing policies. +const ( + // MultiClusterRouting is a policy that allows read/write requests to be + // routed to any cluster in the instance. Requests will will fail over to + // another cluster in the event of transient errors or delays. Choosing + // this option sacrifices read-your-writes consistency to improve + // availability. + MultiClusterRouting = "multi_cluster_routing_use_any" + // SingleClusterRouting is a policy that unconditionally routes all + // read/write requests to a specific cluster. This option preserves + // read-your-writes consistency, but does not improve availability. + SingleClusterRouting = "single_cluster_routing" +) + +// ProfileConf contains the information necessary to create an profile +type ProfileConf struct { + Name string + ProfileID string + InstanceID string + Etag string + Description string + RoutingPolicy string + ClusterID string + AllowTransactionalWrites bool + + // If true, warnings are ignored + IgnoreWarnings bool +} + +// ProfileIterator iterates over profiles. +type ProfileIterator struct { + items []*btapb.AppProfile + pageInfo *iterator.PageInfo + nextFunc func() error +} + +// ProfileAttrsToUpdate define addrs to update during an Update call. If unset, no fields will be replaced. +type ProfileAttrsToUpdate struct { + // If set, updates the description. + Description optional.String + + //If set, updates the routing policy. + RoutingPolicy optional.String + + //If RoutingPolicy is updated to SingleClusterRouting, set these fields as well. + ClusterID string + AllowTransactionalWrites bool + + // If true, warnings are ignored + IgnoreWarnings bool +} + +// GetFieldMaskPath returns the field mask path. +func (p *ProfileAttrsToUpdate) GetFieldMaskPath() []string { + path := make([]string, 0) + if p.Description != nil { + path = append(path, "description") + } + + if p.RoutingPolicy != nil { + path = append(path, optional.ToString(p.RoutingPolicy)) + } + return path +} + +// PageInfo supports pagination. See https://godoc.org/google.golang.org/api/iterator package for details. +func (it *ProfileIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done +// (https://godoc.org/google.golang.org/api/iterator) if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ProfileIterator) Next() (*btapb.AppProfile, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +// CreateAppProfile creates an app profile within an instance. +func (iac *InstanceAdminClient) CreateAppProfile(ctx context.Context, profile ProfileConf) (*btapb.AppProfile, error) { + ctx = mergeOutgoingMetadata(ctx, iac.md) + parent := "projects/" + iac.project + "/instances/" + profile.InstanceID + appProfile := &btapb.AppProfile{ + Etag: profile.Etag, + Description: profile.Description, + } + + if profile.RoutingPolicy == "" { + return nil, errors.New("invalid routing policy") + } + + switch profile.RoutingPolicy { + case MultiClusterRouting: + appProfile.RoutingPolicy = &btapb.AppProfile_MultiClusterRoutingUseAny_{ + MultiClusterRoutingUseAny: &btapb.AppProfile_MultiClusterRoutingUseAny{}, + } + case SingleClusterRouting: + appProfile.RoutingPolicy = &btapb.AppProfile_SingleClusterRouting_{ + SingleClusterRouting: &btapb.AppProfile_SingleClusterRouting{ + ClusterId: profile.ClusterID, + AllowTransactionalWrites: profile.AllowTransactionalWrites, + }, + } + default: + return nil, errors.New("invalid routing policy") + } + + return iac.iClient.CreateAppProfile(ctx, &btapb.CreateAppProfileRequest{ + Parent: parent, + AppProfile: appProfile, + AppProfileId: profile.ProfileID, + IgnoreWarnings: profile.IgnoreWarnings, + }) +} + +// GetAppProfile gets information about an app profile. +func (iac *InstanceAdminClient) GetAppProfile(ctx context.Context, instanceID, name string) (*btapb.AppProfile, error) { + ctx = mergeOutgoingMetadata(ctx, iac.md) + profileRequest := &btapb.GetAppProfileRequest{ + Name: "projects/" + iac.project + "/instances/" + instanceID + "/appProfiles/" + name, + } + var ap *btapb.AppProfile + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + ap, err = iac.iClient.GetAppProfile(ctx, profileRequest) + return err + }, retryOptions...) + if err != nil { + return nil, err + } + return ap, err +} + +// ListAppProfiles lists information about app profiles in an instance. +func (iac *InstanceAdminClient) ListAppProfiles(ctx context.Context, instanceID string) *ProfileIterator { + ctx = mergeOutgoingMetadata(ctx, iac.md) + listRequest := &btapb.ListAppProfilesRequest{ + Parent: "projects/" + iac.project + "/instances/" + instanceID, + } + + pit := &ProfileIterator{} + fetch := func(pageSize int, pageToken string) (string, error) { + listRequest.PageToken = pageToken + var profileRes *btapb.ListAppProfilesResponse + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + profileRes, err = iac.iClient.ListAppProfiles(ctx, listRequest) + return err + }, retryOptions...) + if err != nil { + return "", err + } + + for _, a := range profileRes.AppProfiles { + pit.items = append(pit.items, a) + } + return profileRes.NextPageToken, nil + } + + bufLen := func() int { return len(pit.items) } + takeBuf := func() interface{} { b := pit.items; pit.items = nil; return b } + pit.pageInfo, pit.nextFunc = iterator.NewPageInfo(fetch, bufLen, takeBuf) + return pit + +} + +// UpdateAppProfile updates an app profile within an instance. +// updateAttrs should be set. If unset, all fields will be replaced. +func (iac *InstanceAdminClient) UpdateAppProfile(ctx context.Context, instanceID, profileID string, updateAttrs ProfileAttrsToUpdate) error { + ctx = mergeOutgoingMetadata(ctx, iac.md) + + profile := &btapb.AppProfile{ + Name: "projects/" + iac.project + "/instances/" + instanceID + "/appProfiles/" + profileID, + } + + if updateAttrs.Description != nil { + profile.Description = optional.ToString(updateAttrs.Description) + } + if updateAttrs.RoutingPolicy != nil { + switch optional.ToString(updateAttrs.RoutingPolicy) { + case MultiClusterRouting: + profile.RoutingPolicy = &btapb.AppProfile_MultiClusterRoutingUseAny_{ + MultiClusterRoutingUseAny: &btapb.AppProfile_MultiClusterRoutingUseAny{}, + } + case SingleClusterRouting: + profile.RoutingPolicy = &btapb.AppProfile_SingleClusterRouting_{ + SingleClusterRouting: &btapb.AppProfile_SingleClusterRouting{ + ClusterId: updateAttrs.ClusterID, + AllowTransactionalWrites: updateAttrs.AllowTransactionalWrites, + }, + } + default: + return errors.New("invalid routing policy") + } + } + patchRequest := &btapb.UpdateAppProfileRequest{ + AppProfile: profile, + UpdateMask: &field_mask.FieldMask{ + Paths: updateAttrs.GetFieldMaskPath(), + }, + IgnoreWarnings: updateAttrs.IgnoreWarnings, + } + updateRequest, err := iac.iClient.UpdateAppProfile(ctx, patchRequest) + if err != nil { + return err + } + + return longrunning.InternalNewOperation(iac.lroClient, updateRequest).Wait(ctx, nil) + +} + +// DeleteAppProfile deletes an app profile from an instance. +func (iac *InstanceAdminClient) DeleteAppProfile(ctx context.Context, instanceID, name string) error { + ctx = mergeOutgoingMetadata(ctx, iac.md) + deleteProfileRequest := &btapb.DeleteAppProfileRequest{ + Name: "projects/" + iac.project + "/instances/" + instanceID + "/appProfiles/" + name, + IgnoreWarnings: true, + } + _, err := iac.iClient.DeleteAppProfile(ctx, deleteProfileRequest) + return err + +} diff --git a/vendor/cloud.google.com/go/bigtable/admin_test.go b/vendor/cloud.google.com/go/bigtable/admin_test.go new file mode 100644 index 000000000..907f483ed --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/admin_test.go @@ -0,0 +1,578 @@ +// Copyright 2015 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 bigtable + +import ( + "context" + "fmt" + "math" + "sort" + "strings" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/proto" + "google.golang.org/api/iterator" + btapb "google.golang.org/genproto/googleapis/bigtable/admin/v2" +) + +func TestAdminIntegration(t *testing.T) { + testEnv, err := NewIntegrationEnv() + if err != nil { + t.Fatalf("IntegrationEnv: %v", err) + } + defer testEnv.Close() + + timeout := 2 * time.Second + if testEnv.Config().UseProd { + timeout = 5 * time.Minute + } + ctx, _ := context.WithTimeout(context.Background(), timeout) + + adminClient, err := testEnv.NewAdminClient() + if err != nil { + t.Fatalf("NewAdminClient: %v", err) + } + defer adminClient.Close() + + iAdminClient, err := testEnv.NewInstanceAdminClient() + if err != nil { + t.Fatalf("NewInstanceAdminClient: %v", err) + } + if iAdminClient != nil { + defer iAdminClient.Close() + + iInfo, err := iAdminClient.InstanceInfo(ctx, adminClient.instance) + if err != nil { + t.Errorf("InstanceInfo: %v", err) + } + if iInfo.Name != adminClient.instance { + t.Errorf("InstanceInfo returned name %#v, want %#v", iInfo.Name, adminClient.instance) + } + } + + list := func() []string { + tbls, err := adminClient.Tables(ctx) + if err != nil { + t.Fatalf("Fetching list of tables: %v", err) + } + sort.Strings(tbls) + return tbls + } + containsAll := func(got, want []string) bool { + gotSet := make(map[string]bool) + + for _, s := range got { + gotSet[s] = true + } + for _, s := range want { + if !gotSet[s] { + return false + } + } + return true + } + + defer adminClient.DeleteTable(ctx, "mytable") + + if err := adminClient.CreateTable(ctx, "mytable"); err != nil { + t.Fatalf("Creating table: %v", err) + } + + defer adminClient.DeleteTable(ctx, "myothertable") + + if err := adminClient.CreateTable(ctx, "myothertable"); err != nil { + t.Fatalf("Creating table: %v", err) + } + + if got, want := list(), []string{"myothertable", "mytable"}; !containsAll(got, want) { + t.Errorf("adminClient.Tables returned %#v, want %#v", got, want) + } + + must(adminClient.WaitForReplication(ctx, "mytable")) + + if err := adminClient.DeleteTable(ctx, "myothertable"); err != nil { + t.Fatalf("Deleting table: %v", err) + } + tables := list() + if got, want := tables, []string{"mytable"}; !containsAll(got, want) { + t.Errorf("adminClient.Tables returned %#v, want %#v", got, want) + } + if got, unwanted := tables, []string{"myothertable"}; containsAll(got, unwanted) { + t.Errorf("adminClient.Tables return %#v. unwanted %#v", got, unwanted) + } + + tblConf := TableConf{ + TableID: "conftable", + Families: map[string]GCPolicy{ + "fam1": MaxVersionsPolicy(1), + "fam2": MaxVersionsPolicy(2), + }, + } + if err := adminClient.CreateTableFromConf(ctx, &tblConf); err != nil { + t.Fatalf("Creating table from TableConf: %v", err) + } + defer adminClient.DeleteTable(ctx, tblConf.TableID) + + tblInfo, err := adminClient.TableInfo(ctx, tblConf.TableID) + if err != nil { + t.Fatalf("Getting table info: %v", err) + } + sort.Strings(tblInfo.Families) + wantFams := []string{"fam1", "fam2"} + if !testutil.Equal(tblInfo.Families, wantFams) { + t.Errorf("Column family mismatch, got %v, want %v", tblInfo.Families, wantFams) + } + + // Populate mytable and drop row ranges + if err = adminClient.CreateColumnFamily(ctx, "mytable", "cf"); err != nil { + t.Fatalf("Creating column family: %v", err) + } + + client, err := testEnv.NewClient() + if err != nil { + t.Fatalf("NewClient: %v", err) + } + defer client.Close() + + tbl := client.Open("mytable") + + prefixes := []string{"a", "b", "c"} + for _, prefix := range prefixes { + for i := 0; i < 5; i++ { + mut := NewMutation() + mut.Set("cf", "col", 1000, []byte("1")) + if err := tbl.Apply(ctx, fmt.Sprintf("%v-%v", prefix, i), mut); err != nil { + t.Fatalf("Mutating row: %v", err) + } + } + } + + if err = adminClient.DropRowRange(ctx, "mytable", "a"); err != nil { + t.Errorf("DropRowRange a: %v", err) + } + if err = adminClient.DropRowRange(ctx, "mytable", "c"); err != nil { + t.Errorf("DropRowRange c: %v", err) + } + if err = adminClient.DropRowRange(ctx, "mytable", "x"); err != nil { + t.Errorf("DropRowRange x: %v", err) + } + + var gotRowCount int + must(tbl.ReadRows(ctx, RowRange{}, func(row Row) bool { + gotRowCount++ + if !strings.HasPrefix(row.Key(), "b") { + t.Errorf("Invalid row after dropping range: %v", row) + } + return true + })) + if gotRowCount != 5 { + t.Errorf("Invalid row count after dropping range: got %v, want %v", gotRowCount, 5) + } +} + +func TestInstanceUpdate(t *testing.T) { + testEnv, err := NewIntegrationEnv() + if err != nil { + t.Fatalf("IntegrationEnv: %v", err) + } + defer testEnv.Close() + + timeout := 2 * time.Second + if testEnv.Config().UseProd { + timeout = 5 * time.Minute + } + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + + adminClient, err := testEnv.NewAdminClient() + if err != nil { + t.Fatalf("NewAdminClient: %v", err) + } + + defer adminClient.Close() + + iAdminClient, err := testEnv.NewInstanceAdminClient() + if err != nil { + t.Fatalf("NewInstanceAdminClient: %v", err) + } + + if iAdminClient == nil { + return + } + + defer iAdminClient.Close() + + iInfo, err := iAdminClient.InstanceInfo(ctx, adminClient.instance) + if err != nil { + t.Errorf("InstanceInfo: %v", err) + } + + if iInfo.Name != adminClient.instance { + t.Errorf("InstanceInfo returned name %#v, want %#v", iInfo.Name, adminClient.instance) + } + + if iInfo.DisplayName != adminClient.instance { + t.Errorf("InstanceInfo returned name %#v, want %#v", iInfo.Name, adminClient.instance) + } + + const numNodes = 4 + // update cluster nodes + if err := iAdminClient.UpdateCluster(ctx, adminClient.instance, testEnv.Config().Cluster, int32(numNodes)); err != nil { + t.Errorf("UpdateCluster: %v", err) + } + + // get cluster after updating + cis, err := iAdminClient.GetCluster(ctx, adminClient.instance, testEnv.Config().Cluster) + if err != nil { + t.Errorf("GetCluster %v", err) + } + if cis.ServeNodes != int(numNodes) { + t.Errorf("ServeNodes returned %d, want %d", cis.ServeNodes, int(numNodes)) + } +} + +func TestAdminSnapshotIntegration(t *testing.T) { + testEnv, err := NewIntegrationEnv() + if err != nil { + t.Fatalf("IntegrationEnv: %v", err) + } + defer testEnv.Close() + + if !testEnv.Config().UseProd { + t.Skip("emulator doesn't support snapshots") + } + + timeout := 2 * time.Second + if testEnv.Config().UseProd { + timeout = 5 * time.Minute + } + ctx, _ := context.WithTimeout(context.Background(), timeout) + + adminClient, err := testEnv.NewAdminClient() + if err != nil { + t.Fatalf("NewAdminClient: %v", err) + } + defer adminClient.Close() + + table := testEnv.Config().Table + cluster := testEnv.Config().Cluster + + list := func(cluster string) ([]*SnapshotInfo, error) { + infos := []*SnapshotInfo(nil) + + it := adminClient.Snapshots(ctx, cluster) + for { + s, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + return nil, err + } + infos = append(infos, s) + } + return infos, err + } + + // Delete the table at the end of the test. Schedule ahead of time + // in case the client fails + defer adminClient.DeleteTable(ctx, table) + + if err := adminClient.CreateTable(ctx, table); err != nil { + t.Fatalf("Creating table: %v", err) + } + + // Precondition: no snapshots + snapshots, err := list(cluster) + if err != nil { + t.Fatalf("Initial snapshot list: %v", err) + } + if got, want := len(snapshots), 0; got != want { + t.Fatalf("Initial snapshot list len: %d, want: %d", got, want) + } + + // Create snapshot + defer adminClient.DeleteSnapshot(ctx, cluster, "mysnapshot") + + if err = adminClient.SnapshotTable(ctx, table, cluster, "mysnapshot", 5*time.Hour); err != nil { + t.Fatalf("Creating snaphot: %v", err) + } + + // List snapshot + snapshots, err = list(cluster) + if err != nil { + t.Fatalf("Listing snapshots: %v", err) + } + if got, want := len(snapshots), 1; got != want { + t.Fatalf("Listing snapshot count: %d, want: %d", got, want) + } + if got, want := snapshots[0].Name, "mysnapshot"; got != want { + t.Fatalf("Snapshot name: %s, want: %s", got, want) + } + if got, want := snapshots[0].SourceTable, table; got != want { + t.Fatalf("Snapshot SourceTable: %s, want: %s", got, want) + } + if got, want := snapshots[0].DeleteTime, snapshots[0].CreateTime.Add(5*time.Hour); math.Abs(got.Sub(want).Minutes()) > 1 { + t.Fatalf("Snapshot DeleteTime: %s, want: %s", got, want) + } + + // Get snapshot + snapshot, err := adminClient.SnapshotInfo(ctx, cluster, "mysnapshot") + if err != nil { + t.Fatalf("SnapshotInfo: %v", snapshot) + } + if got, want := *snapshot, *snapshots[0]; got != want { + t.Fatalf("SnapshotInfo: %v, want: %v", got, want) + } + + // Restore + restoredTable := table + "-restored" + defer adminClient.DeleteTable(ctx, restoredTable) + if err = adminClient.CreateTableFromSnapshot(ctx, restoredTable, cluster, "mysnapshot"); err != nil { + t.Fatalf("CreateTableFromSnapshot: %v", err) + } + if _, err := adminClient.TableInfo(ctx, restoredTable); err != nil { + t.Fatalf("Restored TableInfo: %v", err) + } + + // Delete snapshot + if err = adminClient.DeleteSnapshot(ctx, cluster, "mysnapshot"); err != nil { + t.Fatalf("DeleteSnapshot: %v", err) + } + snapshots, err = list(cluster) + if err != nil { + t.Fatalf("List after Delete: %v", err) + } + if got, want := len(snapshots), 0; got != want { + t.Fatalf("List after delete len: %d, want: %d", got, want) + } +} + +func TestGranularity(t *testing.T) { + testEnv, err := NewIntegrationEnv() + if err != nil { + t.Fatalf("IntegrationEnv: %v", err) + } + defer testEnv.Close() + + timeout := 2 * time.Second + if testEnv.Config().UseProd { + timeout = 5 * time.Minute + } + ctx, _ := context.WithTimeout(context.Background(), timeout) + + adminClient, err := testEnv.NewAdminClient() + if err != nil { + t.Fatalf("NewAdminClient: %v", err) + } + defer adminClient.Close() + + list := func() []string { + tbls, err := adminClient.Tables(ctx) + if err != nil { + t.Fatalf("Fetching list of tables: %v", err) + } + sort.Strings(tbls) + return tbls + } + containsAll := func(got, want []string) bool { + gotSet := make(map[string]bool) + + for _, s := range got { + gotSet[s] = true + } + for _, s := range want { + if !gotSet[s] { + return false + } + } + return true + } + + defer adminClient.DeleteTable(ctx, "mytable") + + if err := adminClient.CreateTable(ctx, "mytable"); err != nil { + t.Fatalf("Creating table: %v", err) + } + + tables := list() + if got, want := tables, []string{"mytable"}; !containsAll(got, want) { + t.Errorf("adminClient.Tables returned %#v, want %#v", got, want) + } + + // calling ModifyColumnFamilies to check the granularity of table + prefix := adminClient.instancePrefix() + req := &btapb.ModifyColumnFamiliesRequest{ + Name: prefix + "/tables/" + "mytable", + Modifications: []*btapb.ModifyColumnFamiliesRequest_Modification{{ + Id: "cf", + Mod: &btapb.ModifyColumnFamiliesRequest_Modification_Create{&btapb.ColumnFamily{}}, + }}, + } + table, err := adminClient.tClient.ModifyColumnFamilies(ctx, req) + if err != nil { + t.Fatalf("Creating column family: %v", err) + } + if table.Granularity != btapb.Table_TimestampGranularity(btapb.Table_MILLIS) { + t.Errorf("ModifyColumnFamilies returned granularity %#v, want %#v", table.Granularity, btapb.Table_TimestampGranularity(btapb.Table_MILLIS)) + } +} + +func TestInstanceAdminClient_AppProfile(t *testing.T) { + testEnv, err := NewIntegrationEnv() + if err != nil { + t.Fatalf("IntegrationEnv: %v", err) + } + defer testEnv.Close() + + timeout := 2 * time.Second + if testEnv.Config().UseProd { + timeout = 5 * time.Minute + } + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + + adminClient, err := testEnv.NewAdminClient() + if err != nil { + t.Fatalf("NewAdminClient: %v", err) + } + defer adminClient.Close() + + iAdminClient, err := testEnv.NewInstanceAdminClient() + if err != nil { + t.Fatalf("NewInstanceAdminClient: %v", err) + } + + if iAdminClient == nil { + return + } + + defer iAdminClient.Close() + profile := ProfileConf{ + ProfileID: "app_profile1", + InstanceID: adminClient.instance, + ClusterID: testEnv.Config().Cluster, + Description: "creating new app profile 1", + RoutingPolicy: SingleClusterRouting, + } + + createdProfile, err := iAdminClient.CreateAppProfile(ctx, profile) + if err != nil { + t.Fatalf("Creating app profile: %v", err) + + } + + gotProfile, err := iAdminClient.GetAppProfile(ctx, adminClient.instance, "app_profile1") + + if err != nil { + t.Fatalf("Get app profile: %v", err) + } + + if !proto.Equal(createdProfile, gotProfile) { + t.Fatalf("created profile: %s, got profile: %s", createdProfile.Name, gotProfile.Name) + + } + + list := func(instanceID string) ([]*btapb.AppProfile, error) { + profiles := []*btapb.AppProfile(nil) + + it := iAdminClient.ListAppProfiles(ctx, instanceID) + for { + s, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + return nil, err + } + profiles = append(profiles, s) + } + return profiles, err + } + + profiles, err := list(adminClient.instance) + if err != nil { + t.Fatalf("List app profile: %v", err) + } + + if got, want := len(profiles), 1; got != want { + t.Fatalf("Initial app profile list len: %d, want: %d", got, want) + } + + for _, test := range []struct { + desc string + uattrs ProfileAttrsToUpdate + want *btapb.AppProfile // nil means error + }{ + { + desc: "empty update", + uattrs: ProfileAttrsToUpdate{}, + want: nil, + }, + + { + desc: "empty description update", + uattrs: ProfileAttrsToUpdate{Description: ""}, + want: &btapb.AppProfile{ + Name: gotProfile.Name, + Description: "", + RoutingPolicy: gotProfile.RoutingPolicy, + Etag: gotProfile.Etag}, + }, + { + desc: "routing update", + uattrs: ProfileAttrsToUpdate{ + RoutingPolicy: SingleClusterRouting, + ClusterID: testEnv.Config().Cluster, + }, + want: &btapb.AppProfile{ + Name: gotProfile.Name, + Description: "", + Etag: gotProfile.Etag, + RoutingPolicy: &btapb.AppProfile_SingleClusterRouting_{ + SingleClusterRouting: &btapb.AppProfile_SingleClusterRouting{ + ClusterId: testEnv.Config().Cluster, + }}, + }, + }, + } { + err = iAdminClient.UpdateAppProfile(ctx, adminClient.instance, "app_profile1", test.uattrs) + if err != nil { + if test.want != nil { + t.Errorf("%s: %v", test.desc, err) + } + continue + } + if err == nil && test.want == nil { + t.Errorf("%s: got nil, want error", test.desc) + continue + } + + got, _ := iAdminClient.GetAppProfile(ctx, adminClient.instance, "app_profile1") + + if !proto.Equal(got, test.want) { + t.Fatalf("%s : got profile : %v, want profile: %v", test.desc, gotProfile, test.want) + } + + } + + err = iAdminClient.DeleteAppProfile(ctx, adminClient.instance, "app_profile1") + if err != nil { + t.Fatalf("Delete app profile: %v", err) + } + +} diff --git a/vendor/cloud.google.com/go/bigtable/bigtable.go b/vendor/cloud.google.com/go/bigtable/bigtable.go new file mode 100644 index 000000000..07b4ee885 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/bigtable.go @@ -0,0 +1,914 @@ +/* +Copyright 2015 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 bigtable // import "cloud.google.com/go/bigtable" + +import ( + "context" + "errors" + "fmt" + "io" + "strconv" + "time" + + "cloud.google.com/go/bigtable/internal/gax" + btopt "cloud.google.com/go/bigtable/internal/option" + "github.com/golang/protobuf/proto" + "google.golang.org/api/option" + gtransport "google.golang.org/api/transport/grpc" + btpb "google.golang.org/genproto/googleapis/bigtable/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +const prodAddr = "bigtable.googleapis.com:443" + +// Client is a client for reading and writing data to tables in an instance. +// +// A Client is safe to use concurrently, except for its Close method. +type Client struct { + conn *grpc.ClientConn + client btpb.BigtableClient + project, instance string + appProfile string +} + +// ClientConfig has configurations for the client. +type ClientConfig struct { + // The id of the app profile to associate with all data operations sent from this client. + // If unspecified, the default app profile for the instance will be used. + AppProfile string +} + +// NewClient creates a new Client for a given project and instance. +// The default ClientConfig will be used. +func NewClient(ctx context.Context, project, instance string, opts ...option.ClientOption) (*Client, error) { + return NewClientWithConfig(ctx, project, instance, ClientConfig{}, opts...) +} + +// NewClientWithConfig creates a new client with the given config. +func NewClientWithConfig(ctx context.Context, project, instance string, config ClientConfig, opts ...option.ClientOption) (*Client, error) { + o, err := btopt.DefaultClientOptions(prodAddr, Scope, clientUserAgent) + if err != nil { + return nil, err + } + // Default to a small connection pool that can be overridden. + o = append(o, + option.WithGRPCConnectionPool(4), + // Set the max size to correspond to server-side limits. + option.WithGRPCDialOption(grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(100<<20), grpc.MaxCallRecvMsgSize(100<<20))), + // TODO(grpc/grpc-go#1388) using connection pool without WithBlock + // can cause RPCs to fail randomly. We can delete this after the issue is fixed. + option.WithGRPCDialOption(grpc.WithBlock())) + o = append(o, opts...) + conn, err := gtransport.Dial(ctx, o...) + if err != nil { + return nil, fmt.Errorf("dialing: %v", err) + } + + return &Client{ + conn: conn, + client: btpb.NewBigtableClient(conn), + project: project, + instance: instance, + appProfile: config.AppProfile, + }, nil +} + +// Close closes the Client. +func (c *Client) Close() error { + return c.conn.Close() +} + +var ( + idempotentRetryCodes = []codes.Code{codes.DeadlineExceeded, codes.Unavailable, codes.Aborted} + isIdempotentRetryCode = make(map[codes.Code]bool) + retryOptions = []gax.CallOption{ + gax.WithDelayTimeoutSettings(100*time.Millisecond, 2000*time.Millisecond, 1.2), + gax.WithRetryCodes(idempotentRetryCodes), + } +) + +func init() { + for _, code := range idempotentRetryCodes { + isIdempotentRetryCode[code] = true + } +} + +func (c *Client) fullTableName(table string) string { + return fmt.Sprintf("projects/%s/instances/%s/tables/%s", c.project, c.instance, table) +} + +// A Table refers to a table. +// +// A Table is safe to use concurrently. +type Table struct { + c *Client + table string + + // Metadata to be sent with each request. + md metadata.MD +} + +// Open opens a table. +func (c *Client) Open(table string) *Table { + return &Table{ + c: c, + table: table, + md: metadata.Pairs(resourcePrefixHeader, c.fullTableName(table)), + } +} + +// TODO(dsymonds): Read method that returns a sequence of ReadItems. + +// ReadRows reads rows from a table. f is called for each row. +// If f returns false, the stream is shut down and ReadRows returns. +// f owns its argument, and f is called serially in order by row key. +// +// By default, the yielded rows will contain all values in all cells. +// Use RowFilter to limit the cells returned. +func (t *Table) ReadRows(ctx context.Context, arg RowSet, f func(Row) bool, opts ...ReadOption) error { + ctx = mergeOutgoingMetadata(ctx, t.md) + + var prevRowKey string + var err error + ctx = traceStartSpan(ctx, "cloud.google.com/go/bigtable.ReadRows") + defer func() { traceEndSpan(ctx, err) }() + attrMap := make(map[string]interface{}) + err = gax.Invoke(ctx, func(ctx context.Context) error { + if !arg.valid() { + // Empty row set, no need to make an API call. + // NOTE: we must return early if arg == RowList{} because reading + // an empty RowList from bigtable returns all rows from that table. + return nil + } + req := &btpb.ReadRowsRequest{ + TableName: t.c.fullTableName(t.table), + AppProfileId: t.c.appProfile, + Rows: arg.proto(), + } + for _, opt := range opts { + opt.set(req) + } + ctx, cancel := context.WithCancel(ctx) // for aborting the stream + defer cancel() + + startTime := time.Now() + stream, err := t.c.client.ReadRows(ctx, req) + if err != nil { + return err + } + cr := newChunkReader() + for { + res, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // Reset arg for next Invoke call. + arg = arg.retainRowsAfter(prevRowKey) + attrMap["rowKey"] = prevRowKey + attrMap["error"] = err.Error() + attrMap["time_secs"] = time.Since(startTime).Seconds() + tracePrintf(ctx, attrMap, "Retry details in ReadRows") + return err + } + attrMap["time_secs"] = time.Since(startTime).Seconds() + attrMap["rowCount"] = len(res.Chunks) + tracePrintf(ctx, attrMap, "Details in ReadRows") + + for _, cc := range res.Chunks { + row, err := cr.Process(cc) + if err != nil { + // No need to prepare for a retry, this is an unretryable error. + return err + } + if row == nil { + continue + } + prevRowKey = row.Key() + if !f(row) { + // Cancel and drain stream. + cancel() + for { + if _, err := stream.Recv(); err != nil { + // The stream has ended. We don't return an error + // because the caller has intentionally interrupted the scan. + return nil + } + } + } + } + if err := cr.Close(); err != nil { + // No need to prepare for a retry, this is an unretryable error. + return err + } + } + return err + }, retryOptions...) + + return err +} + +// ReadRow is a convenience implementation of a single-row reader. +// A missing row will return a zero-length map and a nil error. +func (t *Table) ReadRow(ctx context.Context, row string, opts ...ReadOption) (Row, error) { + var r Row + err := t.ReadRows(ctx, SingleRow(row), func(rr Row) bool { + r = rr + return true + }, opts...) + return r, err +} + +// decodeFamilyProto adds the cell data from f to the given row. +func decodeFamilyProto(r Row, row string, f *btpb.Family) { + fam := f.Name // does not have colon + for _, col := range f.Columns { + for _, cell := range col.Cells { + ri := ReadItem{ + Row: row, + Column: fam + ":" + string(col.Qualifier), + Timestamp: Timestamp(cell.TimestampMicros), + Value: cell.Value, + } + r[fam] = append(r[fam], ri) + } + } +} + +// RowSet is a set of rows to be read. It is satisfied by RowList, RowRange and RowRangeList. +// The serialized size of the RowSet must be no larger than 1MiB. +type RowSet interface { + proto() *btpb.RowSet + + // retainRowsAfter returns a new RowSet that does not include the + // given row key or any row key lexicographically less than it. + retainRowsAfter(lastRowKey string) RowSet + + // Valid reports whether this set can cover at least one row. + valid() bool +} + +// RowList is a sequence of row keys. +type RowList []string + +func (r RowList) proto() *btpb.RowSet { + keys := make([][]byte, len(r)) + for i, row := range r { + keys[i] = []byte(row) + } + return &btpb.RowSet{RowKeys: keys} +} + +func (r RowList) retainRowsAfter(lastRowKey string) RowSet { + var retryKeys RowList + for _, key := range r { + if key > lastRowKey { + retryKeys = append(retryKeys, key) + } + } + return retryKeys +} + +func (r RowList) valid() bool { + return len(r) > 0 +} + +// A RowRange is a half-open interval [Start, Limit) encompassing +// all the rows with keys at least as large as Start, and less than Limit. +// (Bigtable string comparison is the same as Go's.) +// A RowRange can be unbounded, encompassing all keys at least as large as Start. +type RowRange struct { + start string + limit string +} + +// NewRange returns the new RowRange [begin, end). +func NewRange(begin, end string) RowRange { + return RowRange{ + start: begin, + limit: end, + } +} + +// Unbounded tests whether a RowRange is unbounded. +func (r RowRange) Unbounded() bool { + return r.limit == "" +} + +// Contains says whether the RowRange contains the key. +func (r RowRange) Contains(row string) bool { + return r.start <= row && (r.limit == "" || r.limit > row) +} + +// String provides a printable description of a RowRange. +func (r RowRange) String() string { + a := strconv.Quote(r.start) + if r.Unbounded() { + return fmt.Sprintf("[%s,∞)", a) + } + return fmt.Sprintf("[%s,%q)", a, r.limit) +} + +func (r RowRange) proto() *btpb.RowSet { + rr := &btpb.RowRange{ + StartKey: &btpb.RowRange_StartKeyClosed{StartKeyClosed: []byte(r.start)}, + } + if !r.Unbounded() { + rr.EndKey = &btpb.RowRange_EndKeyOpen{EndKeyOpen: []byte(r.limit)} + } + return &btpb.RowSet{RowRanges: []*btpb.RowRange{rr}} +} + +func (r RowRange) retainRowsAfter(lastRowKey string) RowSet { + if lastRowKey == "" || lastRowKey < r.start { + return r + } + // Set the beginning of the range to the row after the last scanned. + start := lastRowKey + "\x00" + if r.Unbounded() { + return InfiniteRange(start) + } + return NewRange(start, r.limit) +} + +func (r RowRange) valid() bool { + return r.Unbounded() || r.start < r.limit +} + +// RowRangeList is a sequence of RowRanges representing the union of the ranges. +type RowRangeList []RowRange + +func (r RowRangeList) proto() *btpb.RowSet { + ranges := make([]*btpb.RowRange, len(r)) + for i, rr := range r { + // RowRange.proto() returns a RowSet with a single element RowRange array + ranges[i] = rr.proto().RowRanges[0] + } + return &btpb.RowSet{RowRanges: ranges} +} + +func (r RowRangeList) retainRowsAfter(lastRowKey string) RowSet { + if lastRowKey == "" { + return r + } + // Return a list of any range that has not yet been completely processed + var ranges RowRangeList + for _, rr := range r { + retained := rr.retainRowsAfter(lastRowKey) + if retained.valid() { + ranges = append(ranges, retained.(RowRange)) + } + } + return ranges +} + +func (r RowRangeList) valid() bool { + for _, rr := range r { + if rr.valid() { + return true + } + } + return false +} + +// SingleRow returns a RowSet for reading a single row. +func SingleRow(row string) RowSet { + return RowList{row} +} + +// PrefixRange returns a RowRange consisting of all keys starting with the prefix. +func PrefixRange(prefix string) RowRange { + return RowRange{ + start: prefix, + limit: prefixSuccessor(prefix), + } +} + +// InfiniteRange returns the RowRange consisting of all keys at least as +// large as start. +func InfiniteRange(start string) RowRange { + return RowRange{ + start: start, + limit: "", + } +} + +// prefixSuccessor returns the lexically smallest string greater than the +// prefix, if it exists, or "" otherwise. In either case, it is the string +// needed for the Limit of a RowRange. +func prefixSuccessor(prefix string) string { + if prefix == "" { + return "" // infinite range + } + n := len(prefix) + for n--; n >= 0 && prefix[n] == '\xff'; n-- { + } + if n == -1 { + return "" + } + ans := []byte(prefix[:n]) + ans = append(ans, prefix[n]+1) + return string(ans) +} + +// A ReadOption is an optional argument to ReadRows. +type ReadOption interface { + set(req *btpb.ReadRowsRequest) +} + +// RowFilter returns a ReadOption that applies f to the contents of read rows. +// +// If multiple RowFilters are provided, only the last is used. To combine filters, +// use ChainFilters or InterleaveFilters instead. +func RowFilter(f Filter) ReadOption { return rowFilter{f} } + +type rowFilter struct{ f Filter } + +func (rf rowFilter) set(req *btpb.ReadRowsRequest) { req.Filter = rf.f.proto() } + +// LimitRows returns a ReadOption that will limit the number of rows to be read. +func LimitRows(limit int64) ReadOption { return limitRows{limit} } + +type limitRows struct{ limit int64 } + +func (lr limitRows) set(req *btpb.ReadRowsRequest) { req.RowsLimit = lr.limit } + +// mutationsAreRetryable returns true if all mutations are idempotent +// and therefore retryable. A mutation is idempotent iff all cell timestamps +// have an explicit timestamp set and do not rely on the timestamp being set on the server. +func mutationsAreRetryable(muts []*btpb.Mutation) bool { + serverTime := int64(ServerTime) + for _, mut := range muts { + setCell := mut.GetSetCell() + if setCell != nil && setCell.TimestampMicros == serverTime { + return false + } + } + return true +} + +const maxMutations = 100000 + +// Apply mutates a row atomically. A mutation must contain at least one +// operation and at most 100000 operations. +func (t *Table) Apply(ctx context.Context, row string, m *Mutation, opts ...ApplyOption) error { + ctx = mergeOutgoingMetadata(ctx, t.md) + after := func(res proto.Message) { + for _, o := range opts { + o.after(res) + } + } + + var err error + ctx = traceStartSpan(ctx, "cloud.google.com/go/bigtable/Apply") + defer func() { traceEndSpan(ctx, err) }() + var callOptions []gax.CallOption + if m.cond == nil { + req := &btpb.MutateRowRequest{ + TableName: t.c.fullTableName(t.table), + AppProfileId: t.c.appProfile, + RowKey: []byte(row), + Mutations: m.ops, + } + if mutationsAreRetryable(m.ops) { + callOptions = retryOptions + } + var res *btpb.MutateRowResponse + err := gax.Invoke(ctx, func(ctx context.Context) error { + var err error + res, err = t.c.client.MutateRow(ctx, req) + return err + }, callOptions...) + if err == nil { + after(res) + } + return err + } + + req := &btpb.CheckAndMutateRowRequest{ + TableName: t.c.fullTableName(t.table), + AppProfileId: t.c.appProfile, + RowKey: []byte(row), + PredicateFilter: m.cond.proto(), + } + if m.mtrue != nil { + if m.mtrue.cond != nil { + return errors.New("bigtable: conditional mutations cannot be nested") + } + req.TrueMutations = m.mtrue.ops + } + if m.mfalse != nil { + if m.mfalse.cond != nil { + return errors.New("bigtable: conditional mutations cannot be nested") + } + req.FalseMutations = m.mfalse.ops + } + if mutationsAreRetryable(req.TrueMutations) && mutationsAreRetryable(req.FalseMutations) { + callOptions = retryOptions + } + var cmRes *btpb.CheckAndMutateRowResponse + err = gax.Invoke(ctx, func(ctx context.Context) error { + var err error + cmRes, err = t.c.client.CheckAndMutateRow(ctx, req) + return err + }, callOptions...) + if err == nil { + after(cmRes) + } + return err +} + +// An ApplyOption is an optional argument to Apply. +type ApplyOption interface { + after(res proto.Message) +} + +type applyAfterFunc func(res proto.Message) + +func (a applyAfterFunc) after(res proto.Message) { a(res) } + +// GetCondMutationResult returns an ApplyOption that reports whether the conditional +// mutation's condition matched. +func GetCondMutationResult(matched *bool) ApplyOption { + return applyAfterFunc(func(res proto.Message) { + if res, ok := res.(*btpb.CheckAndMutateRowResponse); ok { + *matched = res.PredicateMatched + } + }) +} + +// Mutation represents a set of changes for a single row of a table. +type Mutation struct { + ops []*btpb.Mutation + + // for conditional mutations + cond Filter + mtrue, mfalse *Mutation +} + +// NewMutation returns a new mutation. +func NewMutation() *Mutation { + return new(Mutation) +} + +// NewCondMutation returns a conditional mutation. +// The given row filter determines which mutation is applied: +// If the filter matches any cell in the row, mtrue is applied; +// otherwise, mfalse is applied. +// Either given mutation may be nil. +func NewCondMutation(cond Filter, mtrue, mfalse *Mutation) *Mutation { + return &Mutation{cond: cond, mtrue: mtrue, mfalse: mfalse} +} + +// Set sets a value in a specified column, with the given timestamp. +// The timestamp will be truncated to millisecond granularity. +// A timestamp of ServerTime means to use the server timestamp. +func (m *Mutation) Set(family, column string, ts Timestamp, value []byte) { + m.ops = append(m.ops, &btpb.Mutation{Mutation: &btpb.Mutation_SetCell_{SetCell: &btpb.Mutation_SetCell{ + FamilyName: family, + ColumnQualifier: []byte(column), + TimestampMicros: int64(ts.TruncateToMilliseconds()), + Value: value, + }}}) +} + +// DeleteCellsInColumn will delete all the cells whose columns are family:column. +func (m *Mutation) DeleteCellsInColumn(family, column string) { + m.ops = append(m.ops, &btpb.Mutation{Mutation: &btpb.Mutation_DeleteFromColumn_{DeleteFromColumn: &btpb.Mutation_DeleteFromColumn{ + FamilyName: family, + ColumnQualifier: []byte(column), + }}}) +} + +// DeleteTimestampRange deletes all cells whose columns are family:column +// and whose timestamps are in the half-open interval [start, end). +// If end is zero, it will be interpreted as infinity. +// The timestamps will be truncated to millisecond granularity. +func (m *Mutation) DeleteTimestampRange(family, column string, start, end Timestamp) { + m.ops = append(m.ops, &btpb.Mutation{Mutation: &btpb.Mutation_DeleteFromColumn_{DeleteFromColumn: &btpb.Mutation_DeleteFromColumn{ + FamilyName: family, + ColumnQualifier: []byte(column), + TimeRange: &btpb.TimestampRange{ + StartTimestampMicros: int64(start.TruncateToMilliseconds()), + EndTimestampMicros: int64(end.TruncateToMilliseconds()), + }, + }}}) +} + +// DeleteCellsInFamily will delete all the cells whose columns are family:*. +func (m *Mutation) DeleteCellsInFamily(family string) { + m.ops = append(m.ops, &btpb.Mutation{Mutation: &btpb.Mutation_DeleteFromFamily_{DeleteFromFamily: &btpb.Mutation_DeleteFromFamily{ + FamilyName: family, + }}}) +} + +// DeleteRow deletes the entire row. +func (m *Mutation) DeleteRow() { + m.ops = append(m.ops, &btpb.Mutation{Mutation: &btpb.Mutation_DeleteFromRow_{DeleteFromRow: &btpb.Mutation_DeleteFromRow{}}}) +} + +// entryErr is a container that combines an entry with the error that was returned for it. +// Err may be nil if no error was returned for the Entry, or if the Entry has not yet been processed. +type entryErr struct { + Entry *btpb.MutateRowsRequest_Entry + Err error +} + +// ApplyBulk applies multiple Mutations, up to a maximum of 100,000. +// Each mutation is individually applied atomically, +// but the set of mutations may be applied in any order. +// +// Two types of failures may occur. If the entire process +// fails, (nil, err) will be returned. If specific mutations +// fail to apply, ([]err, nil) will be returned, and the errors +// will correspond to the relevant rowKeys/muts arguments. +// +// Conditional mutations cannot be applied in bulk and providing one will result in an error. +func (t *Table) ApplyBulk(ctx context.Context, rowKeys []string, muts []*Mutation, opts ...ApplyOption) ([]error, error) { + ctx = mergeOutgoingMetadata(ctx, t.md) + if len(rowKeys) != len(muts) { + return nil, fmt.Errorf("mismatched rowKeys and mutation array lengths: %d, %d", len(rowKeys), len(muts)) + } + + origEntries := make([]*entryErr, len(rowKeys)) + for i, key := range rowKeys { + mut := muts[i] + if mut.cond != nil { + return nil, errors.New("conditional mutations cannot be applied in bulk") + } + origEntries[i] = &entryErr{Entry: &btpb.MutateRowsRequest_Entry{RowKey: []byte(key), Mutations: mut.ops}} + } + + var err error + ctx = traceStartSpan(ctx, "cloud.google.com/go/bigtable/ApplyBulk") + defer func() { traceEndSpan(ctx, err) }() + + for _, group := range groupEntries(origEntries, maxMutations) { + attrMap := make(map[string]interface{}) + err = gax.Invoke(ctx, func(ctx context.Context) error { + attrMap["rowCount"] = len(group) + tracePrintf(ctx, attrMap, "Row count in ApplyBulk") + err := t.doApplyBulk(ctx, group, opts...) + if err != nil { + // We want to retry the entire request with the current group + return err + } + group = t.getApplyBulkRetries(group) + if len(group) > 0 && len(idempotentRetryCodes) > 0 { + // We have at least one mutation that needs to be retried. + // Return an arbitrary error that is retryable according to callOptions. + return status.Errorf(idempotentRetryCodes[0], "Synthetic error: partial failure of ApplyBulk") + } + return nil + }, retryOptions...) + if err != nil { + return nil, err + } + } + + // Accumulate all of the errors into an array to return, interspersed with nils for successful + // entries. The absence of any errors means we should return nil. + var errs []error + var foundErr bool + for _, entry := range origEntries { + if entry.Err != nil { + foundErr = true + } + errs = append(errs, entry.Err) + } + if foundErr { + return errs, nil + } + return nil, nil +} + +// getApplyBulkRetries returns the entries that need to be retried +func (t *Table) getApplyBulkRetries(entries []*entryErr) []*entryErr { + var retryEntries []*entryErr + for _, entry := range entries { + err := entry.Err + if err != nil && isIdempotentRetryCode[grpc.Code(err)] && mutationsAreRetryable(entry.Entry.Mutations) { + // There was an error and the entry is retryable. + retryEntries = append(retryEntries, entry) + } + } + return retryEntries +} + +// doApplyBulk does the work of a single ApplyBulk invocation +func (t *Table) doApplyBulk(ctx context.Context, entryErrs []*entryErr, opts ...ApplyOption) error { + after := func(res proto.Message) { + for _, o := range opts { + o.after(res) + } + } + + entries := make([]*btpb.MutateRowsRequest_Entry, len(entryErrs)) + for i, entryErr := range entryErrs { + entries[i] = entryErr.Entry + } + req := &btpb.MutateRowsRequest{ + TableName: t.c.fullTableName(t.table), + AppProfileId: t.c.appProfile, + Entries: entries, + } + stream, err := t.c.client.MutateRows(ctx, req) + if err != nil { + return err + } + for { + res, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + + for i, entry := range res.Entries { + s := entry.Status + if s.Code == int32(codes.OK) { + entryErrs[i].Err = nil + } else { + entryErrs[i].Err = status.Errorf(codes.Code(s.Code), s.Message) + } + } + after(res) + } + return nil +} + +// groupEntries groups entries into groups of a specified size without breaking up +// individual entries. +func groupEntries(entries []*entryErr, maxSize int) [][]*entryErr { + var ( + res [][]*entryErr + start int + gmuts int + ) + addGroup := func(end int) { + if end-start > 0 { + res = append(res, entries[start:end]) + start = end + gmuts = 0 + } + } + for i, e := range entries { + emuts := len(e.Entry.Mutations) + if gmuts+emuts > maxSize { + addGroup(i) + } + gmuts += emuts + } + addGroup(len(entries)) + return res +} + +// Timestamp is in units of microseconds since 1 January 1970. +type Timestamp int64 + +// ServerTime is a specific Timestamp that may be passed to (*Mutation).Set. +// It indicates that the server's timestamp should be used. +const ServerTime Timestamp = -1 + +// Time converts a time.Time into a Timestamp. +func Time(t time.Time) Timestamp { return Timestamp(t.UnixNano() / 1e3) } + +// Now returns the Timestamp representation of the current time on the client. +func Now() Timestamp { return Time(time.Now()) } + +// Time converts a Timestamp into a time.Time. +func (ts Timestamp) Time() time.Time { return time.Unix(0, int64(ts)*1e3) } + +// TruncateToMilliseconds truncates a Timestamp to millisecond granularity, +// which is currently the only granularity supported. +func (ts Timestamp) TruncateToMilliseconds() Timestamp { + if ts == ServerTime { + return ts + } + return ts - ts%1000 +} + +// ApplyReadModifyWrite applies a ReadModifyWrite to a specific row. +// It returns the newly written cells. +func (t *Table) ApplyReadModifyWrite(ctx context.Context, row string, m *ReadModifyWrite) (Row, error) { + ctx = mergeOutgoingMetadata(ctx, t.md) + req := &btpb.ReadModifyWriteRowRequest{ + TableName: t.c.fullTableName(t.table), + AppProfileId: t.c.appProfile, + RowKey: []byte(row), + Rules: m.ops, + } + res, err := t.c.client.ReadModifyWriteRow(ctx, req) + if err != nil { + return nil, err + } + if res.Row == nil { + return nil, errors.New("unable to apply ReadModifyWrite: res.Row=nil") + } + r := make(Row) + for _, fam := range res.Row.Families { // res is *btpb.Row, fam is *btpb.Family + decodeFamilyProto(r, row, fam) + } + return r, nil +} + +// ReadModifyWrite represents a set of operations on a single row of a table. +// It is like Mutation but for non-idempotent changes. +// When applied, these operations operate on the latest values of the row's cells, +// and result in a new value being written to the relevant cell with a timestamp +// that is max(existing timestamp, current server time). +// +// The application of a ReadModifyWrite is atomic; concurrent ReadModifyWrites will +// be executed serially by the server. +type ReadModifyWrite struct { + ops []*btpb.ReadModifyWriteRule +} + +// NewReadModifyWrite returns a new ReadModifyWrite. +func NewReadModifyWrite() *ReadModifyWrite { return new(ReadModifyWrite) } + +// AppendValue appends a value to a specific cell's value. +// If the cell is unset, it will be treated as an empty value. +func (m *ReadModifyWrite) AppendValue(family, column string, v []byte) { + m.ops = append(m.ops, &btpb.ReadModifyWriteRule{ + FamilyName: family, + ColumnQualifier: []byte(column), + Rule: &btpb.ReadModifyWriteRule_AppendValue{AppendValue: v}, + }) +} + +// Increment interprets the value in a specific cell as a 64-bit big-endian signed integer, +// and adds a value to it. If the cell is unset, it will be treated as zero. +// If the cell is set and is not an 8-byte value, the entire ApplyReadModifyWrite +// operation will fail. +func (m *ReadModifyWrite) Increment(family, column string, delta int64) { + m.ops = append(m.ops, &btpb.ReadModifyWriteRule{ + FamilyName: family, + ColumnQualifier: []byte(column), + Rule: &btpb.ReadModifyWriteRule_IncrementAmount{IncrementAmount: delta}, + }) +} + +// mergeOutgoingMetadata returns a context populated by the existing outgoing metadata, +// if any, joined with internal metadata. +func mergeOutgoingMetadata(ctx context.Context, md metadata.MD) context.Context { + mdCopy, _ := metadata.FromOutgoingContext(ctx) + return metadata.NewOutgoingContext(ctx, metadata.Join(mdCopy, md)) +} + +// SampleRowKeys returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of +// the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces. +func (t *Table) SampleRowKeys(ctx context.Context) ([]string, error) { + ctx = mergeOutgoingMetadata(ctx, t.md) + var sampledRowKeys []string + err := gax.Invoke(ctx, func(ctx context.Context) error { + sampledRowKeys = nil + req := &btpb.SampleRowKeysRequest{ + TableName: t.c.fullTableName(t.table), + AppProfileId: t.c.appProfile, + } + ctx, cancel := context.WithCancel(ctx) // for aborting the stream + defer cancel() + + stream, err := t.c.client.SampleRowKeys(ctx, req) + if err != nil { + return err + } + for { + res, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + + key := string(res.RowKey) + if key == "" { + continue + } + + sampledRowKeys = append(sampledRowKeys, key) + } + return nil + }, retryOptions...) + return sampledRowKeys, err +} diff --git a/vendor/cloud.google.com/go/bigtable/bigtable_test.go b/vendor/cloud.google.com/go/bigtable/bigtable_test.go new file mode 100644 index 000000000..55bf17aaa --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/bigtable_test.go @@ -0,0 +1,1255 @@ +/* +Copyright 2015 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 bigtable + +import ( + "context" + "fmt" + "math/rand" + "strings" + "sync" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + "google.golang.org/api/option" + btpb "google.golang.org/genproto/googleapis/bigtable/v2" + "google.golang.org/grpc" +) + +func TestPrefix(t *testing.T) { + tests := []struct { + prefix, succ string + }{ + {"", ""}, + {"\xff", ""}, // when used, "" means Infinity + {"x\xff", "y"}, + {"\xfe", "\xff"}, + } + for _, tc := range tests { + got := prefixSuccessor(tc.prefix) + if got != tc.succ { + t.Errorf("prefixSuccessor(%q) = %q, want %s", tc.prefix, got, tc.succ) + continue + } + r := PrefixRange(tc.prefix) + if tc.succ == "" && r.limit != "" { + t.Errorf("PrefixRange(%q) got limit %q", tc.prefix, r.limit) + } + if tc.succ != "" && r.limit != tc.succ { + t.Errorf("PrefixRange(%q) got limit %q, want %q", tc.prefix, r.limit, tc.succ) + } + } +} + +func TestApplyErrors(t *testing.T) { + ctx := context.Background() + table := &Table{ + c: &Client{ + project: "P", + instance: "I", + }, + table: "t", + } + f := ColumnFilter("C") + m := NewMutation() + m.DeleteRow() + // Test nested conditional mutations. + cm := NewCondMutation(f, NewCondMutation(f, m, nil), nil) + if err := table.Apply(ctx, "x", cm); err == nil { + t.Error("got nil, want error") + } + cm = NewCondMutation(f, nil, NewCondMutation(f, m, nil)) + if err := table.Apply(ctx, "x", cm); err == nil { + t.Error("got nil, want error") + } +} + +func TestGroupEntries(t *testing.T) { + tests := []struct { + desc string + in []*entryErr + size int + want [][]*entryErr + }{ + { + desc: "one entry less than max size is one group", + in: []*entryErr{buildEntry(5)}, + size: 10, + want: [][]*entryErr{{buildEntry(5)}}, + }, + { + desc: "one entry equal to max size is one group", + in: []*entryErr{buildEntry(10)}, + size: 10, + want: [][]*entryErr{{buildEntry(10)}}, + }, + { + desc: "one entry greater than max size is one group", + in: []*entryErr{buildEntry(15)}, + size: 10, + want: [][]*entryErr{{buildEntry(15)}}, + }, + { + desc: "all entries fitting within max size are one group", + in: []*entryErr{buildEntry(10), buildEntry(10)}, + size: 20, + want: [][]*entryErr{{buildEntry(10), buildEntry(10)}}, + }, + { + desc: "entries each under max size and together over max size are grouped separately", + in: []*entryErr{buildEntry(10), buildEntry(10)}, + size: 15, + want: [][]*entryErr{{buildEntry(10)}, {buildEntry(10)}}, + }, + { + desc: "entries together over max size are grouped by max size", + in: []*entryErr{buildEntry(5), buildEntry(5), buildEntry(5)}, + size: 10, + want: [][]*entryErr{{buildEntry(5), buildEntry(5)}, {buildEntry(5)}}, + }, + { + desc: "one entry over max size and one entry under max size are two groups", + in: []*entryErr{buildEntry(15), buildEntry(5)}, + size: 10, + want: [][]*entryErr{{buildEntry(15)}, {buildEntry(5)}}, + }, + } + + for _, test := range tests { + if got, want := groupEntries(test.in, test.size), test.want; !cmp.Equal(mutationCounts(got), mutationCounts(want)) { + t.Errorf("[%s] want = %v, got = %v", test.desc, mutationCounts(want), mutationCounts(got)) + } + } +} + +func buildEntry(numMutations int) *entryErr { + var muts []*btpb.Mutation + for i := 0; i < numMutations; i++ { + muts = append(muts, &btpb.Mutation{}) + } + return &entryErr{Entry: &btpb.MutateRowsRequest_Entry{Mutations: muts}} +} + +func mutationCounts(batched [][]*entryErr) []int { + var res []int + for _, entries := range batched { + var count int + for _, e := range entries { + count += len(e.Entry.Mutations) + } + res = append(res, count) + } + return res +} + +func TestClientIntegration(t *testing.T) { + // TODO(jba): go1.9: Use subtests. + start := time.Now() + lastCheckpoint := start + checkpoint := func(s string) { + n := time.Now() + t.Logf("[%s] %v since start, %v since last checkpoint", s, n.Sub(start), n.Sub(lastCheckpoint)) + lastCheckpoint = n + } + + testEnv, err := NewIntegrationEnv() + if err != nil { + t.Fatalf("IntegrationEnv: %v", err) + } + + var timeout time.Duration + if testEnv.Config().UseProd { + timeout = 10 * time.Minute + t.Logf("Running test against production") + } else { + timeout = 1 * time.Minute + t.Logf("bttest.Server running on %s", testEnv.Config().AdminEndpoint) + } + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + + client, err := testEnv.NewClient() + if err != nil { + t.Fatalf("Client: %v", err) + } + defer client.Close() + checkpoint("dialed Client") + + adminClient, err := testEnv.NewAdminClient() + if err != nil { + t.Fatalf("AdminClient: %v", err) + } + defer adminClient.Close() + checkpoint("dialed AdminClient") + + table := testEnv.Config().Table + + // Delete the table at the end of the test. + // Do this even before creating the table so that if this is running + // against production and CreateTable fails there's a chance of cleaning it up. + defer adminClient.DeleteTable(ctx, table) + + if err := adminClient.CreateTable(ctx, table); err != nil { + t.Fatalf("Creating table: %v", err) + } + checkpoint("created table") + if err := adminClient.CreateColumnFamily(ctx, table, "follows"); err != nil { + t.Fatalf("Creating column family: %v", err) + } + checkpoint(`created "follows" column family`) + + tbl := client.Open(table) + + // Insert some data. + initialData := map[string][]string{ + "wmckinley": {"tjefferson"}, + "gwashington": {"jadams"}, + "tjefferson": {"gwashington", "jadams"}, // wmckinley set conditionally below + "jadams": {"gwashington", "tjefferson"}, + } + for row, ss := range initialData { + mut := NewMutation() + for _, name := range ss { + mut.Set("follows", name, 1000, []byte("1")) + } + if err := tbl.Apply(ctx, row, mut); err != nil { + t.Errorf("Mutating row %q: %v", row, err) + } + } + checkpoint("inserted initial data") + + // TODO(igorbernstein): re-enable this when ready + //if err := adminClient.WaitForReplication(ctx, table); err != nil { + // t.Errorf("Waiting for replication for table %q: %v", table, err) + //} + //checkpoint("waited for replication") + + // Do a conditional mutation with a complex filter. + mutTrue := NewMutation() + mutTrue.Set("follows", "wmckinley", 1000, []byte("1")) + filter := ChainFilters(ColumnFilter("gwash[iz].*"), ValueFilter(".")) + mut := NewCondMutation(filter, mutTrue, nil) + if err := tbl.Apply(ctx, "tjefferson", mut); err != nil { + t.Errorf("Conditionally mutating row: %v", err) + } + // Do a second condition mutation with a filter that does not match, + // and thus no changes should be made. + mutTrue = NewMutation() + mutTrue.DeleteRow() + filter = ColumnFilter("snoop.dogg") + mut = NewCondMutation(filter, mutTrue, nil) + if err := tbl.Apply(ctx, "tjefferson", mut); err != nil { + t.Errorf("Conditionally mutating row: %v", err) + } + checkpoint("did two conditional mutations") + + // Fetch a row. + row, err := tbl.ReadRow(ctx, "jadams") + if err != nil { + t.Fatalf("Reading a row: %v", err) + } + wantRow := Row{ + "follows": []ReadItem{ + {Row: "jadams", Column: "follows:gwashington", Timestamp: 1000, Value: []byte("1")}, + {Row: "jadams", Column: "follows:tjefferson", Timestamp: 1000, Value: []byte("1")}, + }, + } + if !testutil.Equal(row, wantRow) { + t.Errorf("Read row mismatch.\n got %#v\nwant %#v", row, wantRow) + } + checkpoint("tested ReadRow") + + // Do a bunch of reads with filters. + readTests := []struct { + desc string + rr RowSet + filter Filter // may be nil + limit ReadOption // may be nil + + // We do the read, grab all the cells, turn them into "--", + // and join with a comma. + want string + }{ + { + desc: "read all, unfiltered", + rr: RowRange{}, + want: "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1,tjefferson-gwashington-1,tjefferson-jadams-1,tjefferson-wmckinley-1,wmckinley-tjefferson-1", + }, + { + desc: "read with InfiniteRange, unfiltered", + rr: InfiniteRange("tjefferson"), + want: "tjefferson-gwashington-1,tjefferson-jadams-1,tjefferson-wmckinley-1,wmckinley-tjefferson-1", + }, + { + desc: "read with NewRange, unfiltered", + rr: NewRange("gargamel", "hubbard"), + want: "gwashington-jadams-1", + }, + { + desc: "read with PrefixRange, unfiltered", + rr: PrefixRange("jad"), + want: "jadams-gwashington-1,jadams-tjefferson-1", + }, + { + desc: "read with SingleRow, unfiltered", + rr: SingleRow("wmckinley"), + want: "wmckinley-tjefferson-1", + }, + { + desc: "read all, with ColumnFilter", + rr: RowRange{}, + filter: ColumnFilter(".*j.*"), // matches "jadams" and "tjefferson" + want: "gwashington-jadams-1,jadams-tjefferson-1,tjefferson-jadams-1,wmckinley-tjefferson-1", + }, + { + desc: "read all, with ColumnFilter, prefix", + rr: RowRange{}, + filter: ColumnFilter("j"), // no matches + want: "", + }, + { + desc: "read range, with ColumnRangeFilter", + rr: RowRange{}, + filter: ColumnRangeFilter("follows", "h", "k"), + want: "gwashington-jadams-1,tjefferson-jadams-1", + }, + { + desc: "read range from empty, with ColumnRangeFilter", + rr: RowRange{}, + filter: ColumnRangeFilter("follows", "", "u"), + want: "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1,tjefferson-gwashington-1,tjefferson-jadams-1,wmckinley-tjefferson-1", + }, + { + desc: "read range from start to empty, with ColumnRangeFilter", + rr: RowRange{}, + filter: ColumnRangeFilter("follows", "h", ""), + want: "gwashington-jadams-1,jadams-tjefferson-1,tjefferson-jadams-1,tjefferson-wmckinley-1,wmckinley-tjefferson-1", + }, + { + desc: "read with RowKeyFilter", + rr: RowRange{}, + filter: RowKeyFilter(".*wash.*"), + want: "gwashington-jadams-1", + }, + { + desc: "read with RowKeyFilter, prefix", + rr: RowRange{}, + filter: RowKeyFilter("gwash"), + want: "", + }, + { + desc: "read with RowKeyFilter, no matches", + rr: RowRange{}, + filter: RowKeyFilter(".*xxx.*"), + want: "", + }, + { + desc: "read with FamilyFilter, no matches", + rr: RowRange{}, + filter: FamilyFilter(".*xxx.*"), + want: "", + }, + { + desc: "read with ColumnFilter + row limit", + rr: RowRange{}, + filter: ColumnFilter(".*j.*"), // matches "jadams" and "tjefferson" + limit: LimitRows(2), + want: "gwashington-jadams-1,jadams-tjefferson-1", + }, + { + desc: "read all, strip values", + rr: RowRange{}, + filter: StripValueFilter(), + want: "gwashington-jadams-,jadams-gwashington-,jadams-tjefferson-,tjefferson-gwashington-,tjefferson-jadams-,tjefferson-wmckinley-,wmckinley-tjefferson-", + }, + { + desc: "read with ColumnFilter + row limit + strip values", + rr: RowRange{}, + filter: ChainFilters(ColumnFilter(".*j.*"), StripValueFilter()), // matches "jadams" and "tjefferson" + limit: LimitRows(2), + want: "gwashington-jadams-,jadams-tjefferson-", + }, + { + desc: "read with condition, strip values on true", + rr: RowRange{}, + filter: ConditionFilter(ColumnFilter(".*j.*"), StripValueFilter(), nil), + want: "gwashington-jadams-,jadams-gwashington-,jadams-tjefferson-,tjefferson-gwashington-,tjefferson-jadams-,tjefferson-wmckinley-,wmckinley-tjefferson-", + }, + { + desc: "read with condition, strip values on false", + rr: RowRange{}, + filter: ConditionFilter(ColumnFilter(".*xxx.*"), nil, StripValueFilter()), + want: "gwashington-jadams-,jadams-gwashington-,jadams-tjefferson-,tjefferson-gwashington-,tjefferson-jadams-,tjefferson-wmckinley-,wmckinley-tjefferson-", + }, + { + desc: "read with ValueRangeFilter + row limit", + rr: RowRange{}, + filter: ValueRangeFilter([]byte("1"), []byte("5")), // matches our value of "1" + limit: LimitRows(2), + want: "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1", + }, + { + desc: "read with ValueRangeFilter, no match on exclusive end", + rr: RowRange{}, + filter: ValueRangeFilter([]byte("0"), []byte("1")), // no match + want: "", + }, + { + desc: "read with ValueRangeFilter, no matches", + rr: RowRange{}, + filter: ValueRangeFilter([]byte("3"), []byte("5")), // matches nothing + want: "", + }, + { + desc: "read with InterleaveFilter, no matches on all filters", + rr: RowRange{}, + filter: InterleaveFilters(ColumnFilter(".*x.*"), ColumnFilter(".*z.*")), + want: "", + }, + { + desc: "read with InterleaveFilter, no duplicate cells", + rr: RowRange{}, + filter: InterleaveFilters(ColumnFilter(".*g.*"), ColumnFilter(".*j.*")), + want: "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1,tjefferson-gwashington-1,tjefferson-jadams-1,wmckinley-tjefferson-1", + }, + { + desc: "read with InterleaveFilter, with duplicate cells", + rr: RowRange{}, + filter: InterleaveFilters(ColumnFilter(".*g.*"), ColumnFilter(".*g.*")), + want: "jadams-gwashington-1,jadams-gwashington-1,tjefferson-gwashington-1,tjefferson-gwashington-1", + }, + { + desc: "read with a RowRangeList and no filter", + rr: RowRangeList{NewRange("gargamel", "hubbard"), InfiniteRange("wmckinley")}, + want: "gwashington-jadams-1,wmckinley-tjefferson-1", + }, + { + desc: "chain that excludes rows and matches nothing, in a condition", + rr: RowRange{}, + filter: ConditionFilter(ChainFilters(ColumnFilter(".*j.*"), ColumnFilter(".*mckinley.*")), StripValueFilter(), nil), + want: "", + }, + { + desc: "chain that ends with an interleave that has no match. covers #804", + rr: RowRange{}, + filter: ConditionFilter(ChainFilters(ColumnFilter(".*j.*"), InterleaveFilters(ColumnFilter(".*x.*"), ColumnFilter(".*z.*"))), StripValueFilter(), nil), + want: "", + }, + } + for _, tc := range readTests { + var opts []ReadOption + if tc.filter != nil { + opts = append(opts, RowFilter(tc.filter)) + } + if tc.limit != nil { + opts = append(opts, tc.limit) + } + var elt []string + err := tbl.ReadRows(ctx, tc.rr, func(r Row) bool { + for _, ris := range r { + for _, ri := range ris { + elt = append(elt, formatReadItem(ri)) + } + } + return true + }, opts...) + if err != nil { + t.Errorf("%s: %v", tc.desc, err) + continue + } + if got := strings.Join(elt, ","); got != tc.want { + t.Errorf("%s: wrong reads.\n got %q\nwant %q", tc.desc, got, tc.want) + } + } + + // Read a RowList + var elt []string + keys := RowList{"wmckinley", "gwashington", "jadams"} + want := "gwashington-jadams-1,jadams-gwashington-1,jadams-tjefferson-1,wmckinley-tjefferson-1" + err = tbl.ReadRows(ctx, keys, func(r Row) bool { + for _, ris := range r { + for _, ri := range ris { + elt = append(elt, formatReadItem(ri)) + } + } + return true + }) + if err != nil { + t.Errorf("read RowList: %v", err) + } + + if got := strings.Join(elt, ","); got != want { + t.Errorf("bulk read: wrong reads.\n got %q\nwant %q", got, want) + } + checkpoint("tested ReadRows in a few ways") + + // Do a scan and stop part way through. + // Verify that the ReadRows callback doesn't keep running. + stopped := false + err = tbl.ReadRows(ctx, InfiniteRange(""), func(r Row) bool { + if r.Key() < "h" { + return true + } + if !stopped { + stopped = true + return false + } + t.Errorf("ReadRows kept scanning to row %q after being told to stop", r.Key()) + return false + }) + if err != nil { + t.Errorf("Partial ReadRows: %v", err) + } + checkpoint("did partial ReadRows test") + + // Delete a row and check it goes away. + mut = NewMutation() + mut.DeleteRow() + if err := tbl.Apply(ctx, "wmckinley", mut); err != nil { + t.Errorf("Apply DeleteRow: %v", err) + } + row, err = tbl.ReadRow(ctx, "wmckinley") + if err != nil { + t.Fatalf("Reading a row after DeleteRow: %v", err) + } + if len(row) != 0 { + t.Fatalf("Read non-zero row after DeleteRow: %v", row) + } + checkpoint("exercised DeleteRow") + + // Check ReadModifyWrite. + + if err := adminClient.CreateColumnFamily(ctx, table, "counter"); err != nil { + t.Fatalf("Creating column family: %v", err) + } + + appendRMW := func(b []byte) *ReadModifyWrite { + rmw := NewReadModifyWrite() + rmw.AppendValue("counter", "likes", b) + return rmw + } + incRMW := func(n int64) *ReadModifyWrite { + rmw := NewReadModifyWrite() + rmw.Increment("counter", "likes", n) + return rmw + } + rmwSeq := []struct { + desc string + rmw *ReadModifyWrite + want []byte + }{ + { + desc: "append #1", + rmw: appendRMW([]byte{0, 0, 0}), + want: []byte{0, 0, 0}, + }, + { + desc: "append #2", + rmw: appendRMW([]byte{0, 0, 0, 0, 17}), // the remaining 40 bits to make a big-endian 17 + want: []byte{0, 0, 0, 0, 0, 0, 0, 17}, + }, + { + desc: "increment", + rmw: incRMW(8), + want: []byte{0, 0, 0, 0, 0, 0, 0, 25}, + }, + } + for _, step := range rmwSeq { + row, err := tbl.ApplyReadModifyWrite(ctx, "gwashington", step.rmw) + if err != nil { + t.Fatalf("ApplyReadModifyWrite %+v: %v", step.rmw, err) + } + // Make sure the modified cell returned by the RMW operation has a timestamp. + if row["counter"][0].Timestamp == 0 { + t.Errorf("RMW returned cell timestamp: got %v, want > 0", row["counter"][0].Timestamp) + } + clearTimestamps(row) + wantRow := Row{"counter": []ReadItem{{Row: "gwashington", Column: "counter:likes", Value: step.want}}} + if !testutil.Equal(row, wantRow) { + t.Fatalf("After %s,\n got %v\nwant %v", step.desc, row, wantRow) + } + } + + // Check for google-cloud-go/issues/723. RMWs that insert new rows should keep row order sorted in the emulator. + _, err = tbl.ApplyReadModifyWrite(ctx, "issue-723-2", appendRMW([]byte{0})) + if err != nil { + t.Fatalf("ApplyReadModifyWrite null string: %v", err) + } + _, err = tbl.ApplyReadModifyWrite(ctx, "issue-723-1", appendRMW([]byte{0})) + if err != nil { + t.Fatalf("ApplyReadModifyWrite null string: %v", err) + } + // Get only the correct row back on read. + r, err := tbl.ReadRow(ctx, "issue-723-1") + if err != nil { + t.Fatalf("Reading row: %v", err) + } + if r.Key() != "issue-723-1" { + t.Errorf("ApplyReadModifyWrite: incorrect read after RMW,\n got %v\nwant %v", r.Key(), "issue-723-1") + } + checkpoint("tested ReadModifyWrite") + + // Test arbitrary timestamps more thoroughly. + if err := adminClient.CreateColumnFamily(ctx, table, "ts"); err != nil { + t.Fatalf("Creating column family: %v", err) + } + const numVersions = 4 + mut = NewMutation() + for i := 1; i < numVersions; i++ { + // Timestamps are used in thousands because the server + // only permits that granularity. + mut.Set("ts", "col", Timestamp(i*1000), []byte(fmt.Sprintf("val-%d", i))) + mut.Set("ts", "col2", Timestamp(i*1000), []byte(fmt.Sprintf("val-%d", i))) + } + if err := tbl.Apply(ctx, "testrow", mut); err != nil { + t.Fatalf("Mutating row: %v", err) + } + r, err = tbl.ReadRow(ctx, "testrow") + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{"ts": []ReadItem{ + // These should be returned in descending timestamp order. + {Row: "testrow", Column: "ts:col", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col", Timestamp: 2000, Value: []byte("val-2")}, + {Row: "testrow", Column: "ts:col", Timestamp: 1000, Value: []byte("val-1")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 2000, Value: []byte("val-2")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 1000, Value: []byte("val-1")}, + }} + if !testutil.Equal(r, wantRow) { + t.Errorf("Cell with multiple versions,\n got %v\nwant %v", r, wantRow) + } + // Do the same read, but filter to the latest two versions. + r, err = tbl.ReadRow(ctx, "testrow", RowFilter(LatestNFilter(2))) + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{"ts": []ReadItem{ + {Row: "testrow", Column: "ts:col", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col", Timestamp: 2000, Value: []byte("val-2")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 2000, Value: []byte("val-2")}, + }} + if !testutil.Equal(r, wantRow) { + t.Errorf("Cell with multiple versions and LatestNFilter(2),\n got %v\nwant %v", r, wantRow) + } + // Check cell offset / limit + r, err = tbl.ReadRow(ctx, "testrow", RowFilter(CellsPerRowLimitFilter(3))) + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{"ts": []ReadItem{ + {Row: "testrow", Column: "ts:col", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col", Timestamp: 2000, Value: []byte("val-2")}, + {Row: "testrow", Column: "ts:col", Timestamp: 1000, Value: []byte("val-1")}, + }} + if !testutil.Equal(r, wantRow) { + t.Errorf("Cell with multiple versions and CellsPerRowLimitFilter(3),\n got %v\nwant %v", r, wantRow) + } + r, err = tbl.ReadRow(ctx, "testrow", RowFilter(CellsPerRowOffsetFilter(3))) + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{"ts": []ReadItem{ + {Row: "testrow", Column: "ts:col2", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 2000, Value: []byte("val-2")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 1000, Value: []byte("val-1")}, + }} + if !testutil.Equal(r, wantRow) { + t.Errorf("Cell with multiple versions and CellsPerRowOffsetFilter(3),\n got %v\nwant %v", r, wantRow) + } + // Check timestamp range filtering (with truncation) + r, err = tbl.ReadRow(ctx, "testrow", RowFilter(TimestampRangeFilterMicros(1001, 3000))) + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{"ts": []ReadItem{ + {Row: "testrow", Column: "ts:col", Timestamp: 2000, Value: []byte("val-2")}, + {Row: "testrow", Column: "ts:col", Timestamp: 1000, Value: []byte("val-1")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 2000, Value: []byte("val-2")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 1000, Value: []byte("val-1")}, + }} + if !testutil.Equal(r, wantRow) { + t.Errorf("Cell with multiple versions and TimestampRangeFilter(1000, 3000),\n got %v\nwant %v", r, wantRow) + } + r, err = tbl.ReadRow(ctx, "testrow", RowFilter(TimestampRangeFilterMicros(1000, 0))) + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{"ts": []ReadItem{ + {Row: "testrow", Column: "ts:col", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col", Timestamp: 2000, Value: []byte("val-2")}, + {Row: "testrow", Column: "ts:col", Timestamp: 1000, Value: []byte("val-1")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 2000, Value: []byte("val-2")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 1000, Value: []byte("val-1")}, + }} + if !testutil.Equal(r, wantRow) { + t.Errorf("Cell with multiple versions and TimestampRangeFilter(1000, 0),\n got %v\nwant %v", r, wantRow) + } + // Delete non-existing cells, no such column family in this row + // Should not delete anything + if err := adminClient.CreateColumnFamily(ctx, table, "non-existing"); err != nil { + t.Fatalf("Creating column family: %v", err) + } + mut = NewMutation() + mut.DeleteTimestampRange("non-existing", "col", 2000, 3000) // half-open interval + if err := tbl.Apply(ctx, "testrow", mut); err != nil { + t.Fatalf("Mutating row: %v", err) + } + r, err = tbl.ReadRow(ctx, "testrow", RowFilter(LatestNFilter(3))) + if err != nil { + t.Fatalf("Reading row: %v", err) + } + if !testutil.Equal(r, wantRow) { + t.Errorf("Cell was deleted unexpectly,\n got %v\nwant %v", r, wantRow) + } + // Delete non-existing cells, no such column in this column family + // Should not delete anything + mut = NewMutation() + mut.DeleteTimestampRange("ts", "non-existing", 2000, 3000) // half-open interval + if err := tbl.Apply(ctx, "testrow", mut); err != nil { + t.Fatalf("Mutating row: %v", err) + } + r, err = tbl.ReadRow(ctx, "testrow", RowFilter(LatestNFilter(3))) + if err != nil { + t.Fatalf("Reading row: %v", err) + } + if !testutil.Equal(r, wantRow) { + t.Errorf("Cell was deleted unexpectly,\n got %v\nwant %v", r, wantRow) + } + // Delete the cell with timestamp 2000 and repeat the last read, + // checking that we get ts 3000 and ts 1000. + mut = NewMutation() + mut.DeleteTimestampRange("ts", "col", 2001, 3000) // half-open interval + if err := tbl.Apply(ctx, "testrow", mut); err != nil { + t.Fatalf("Mutating row: %v", err) + } + r, err = tbl.ReadRow(ctx, "testrow", RowFilter(LatestNFilter(2))) + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{"ts": []ReadItem{ + {Row: "testrow", Column: "ts:col", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col", Timestamp: 1000, Value: []byte("val-1")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 3000, Value: []byte("val-3")}, + {Row: "testrow", Column: "ts:col2", Timestamp: 2000, Value: []byte("val-2")}, + }} + if !testutil.Equal(r, wantRow) { + t.Errorf("Cell with multiple versions and LatestNFilter(2), after deleting timestamp 2000,\n got %v\nwant %v", r, wantRow) + } + checkpoint("tested multiple versions in a cell") + + // Check DeleteCellsInFamily + if err := adminClient.CreateColumnFamily(ctx, table, "status"); err != nil { + t.Fatalf("Creating column family: %v", err) + } + + mut = NewMutation() + mut.Set("status", "start", 2000, []byte("2")) + mut.Set("status", "end", 3000, []byte("3")) + mut.Set("ts", "col", 1000, []byte("1")) + if err := tbl.Apply(ctx, "row1", mut); err != nil { + t.Errorf("Mutating row: %v", err) + } + if err := tbl.Apply(ctx, "row2", mut); err != nil { + t.Errorf("Mutating row: %v", err) + } + + mut = NewMutation() + mut.DeleteCellsInFamily("status") + if err := tbl.Apply(ctx, "row1", mut); err != nil { + t.Errorf("Delete cf: %v", err) + } + + // ColumnFamily removed + r, err = tbl.ReadRow(ctx, "row1") + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{"ts": []ReadItem{ + {Row: "row1", Column: "ts:col", Timestamp: 1000, Value: []byte("1")}, + }} + if !testutil.Equal(r, wantRow) { + t.Errorf("column family was not deleted.\n got %v\n want %v", r, wantRow) + } + + // ColumnFamily not removed + r, err = tbl.ReadRow(ctx, "row2") + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{ + "ts": []ReadItem{ + {Row: "row2", Column: "ts:col", Timestamp: 1000, Value: []byte("1")}, + }, + "status": []ReadItem{ + {Row: "row2", Column: "status:end", Timestamp: 3000, Value: []byte("3")}, + {Row: "row2", Column: "status:start", Timestamp: 2000, Value: []byte("2")}, + }, + } + if !testutil.Equal(r, wantRow) { + t.Errorf("Column family was deleted unexpectly.\n got %v\n want %v", r, wantRow) + } + checkpoint("tested family delete") + + // Check DeleteCellsInColumn + mut = NewMutation() + mut.Set("status", "start", 2000, []byte("2")) + mut.Set("status", "middle", 3000, []byte("3")) + mut.Set("status", "end", 1000, []byte("1")) + if err := tbl.Apply(ctx, "row3", mut); err != nil { + t.Errorf("Mutating row: %v", err) + } + mut = NewMutation() + mut.DeleteCellsInColumn("status", "middle") + if err := tbl.Apply(ctx, "row3", mut); err != nil { + t.Errorf("Delete column: %v", err) + } + r, err = tbl.ReadRow(ctx, "row3") + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{ + "status": []ReadItem{ + {Row: "row3", Column: "status:end", Timestamp: 1000, Value: []byte("1")}, + {Row: "row3", Column: "status:start", Timestamp: 2000, Value: []byte("2")}, + }, + } + if !testutil.Equal(r, wantRow) { + t.Errorf("Column was not deleted.\n got %v\n want %v", r, wantRow) + } + mut = NewMutation() + mut.DeleteCellsInColumn("status", "start") + if err := tbl.Apply(ctx, "row3", mut); err != nil { + t.Errorf("Delete column: %v", err) + } + r, err = tbl.ReadRow(ctx, "row3") + if err != nil { + t.Fatalf("Reading row: %v", err) + } + wantRow = Row{ + "status": []ReadItem{ + {Row: "row3", Column: "status:end", Timestamp: 1000, Value: []byte("1")}, + }, + } + if !testutil.Equal(r, wantRow) { + t.Errorf("Column was not deleted.\n got %v\n want %v", r, wantRow) + } + mut = NewMutation() + mut.DeleteCellsInColumn("status", "end") + if err := tbl.Apply(ctx, "row3", mut); err != nil { + t.Errorf("Delete column: %v", err) + } + r, err = tbl.ReadRow(ctx, "row3") + if err != nil { + t.Fatalf("Reading row: %v", err) + } + if len(r) != 0 { + t.Errorf("Delete column: got %v, want empty row", r) + } + // Add same cell after delete + mut = NewMutation() + mut.Set("status", "end", 1000, []byte("1")) + if err := tbl.Apply(ctx, "row3", mut); err != nil { + t.Errorf("Mutating row: %v", err) + } + r, err = tbl.ReadRow(ctx, "row3") + if err != nil { + t.Fatalf("Reading row: %v", err) + } + if !testutil.Equal(r, wantRow) { + t.Errorf("Column was not deleted correctly.\n got %v\n want %v", r, wantRow) + } + checkpoint("tested column delete") + + // Do highly concurrent reads/writes. + // TODO(dsymonds): Raise this to 1000 when https://github.com/grpc/grpc-go/issues/205 is resolved. + const maxConcurrency = 100 + var wg sync.WaitGroup + for i := 0; i < maxConcurrency; i++ { + wg.Add(1) + go func() { + defer wg.Done() + switch r := rand.Intn(100); { // r ∈ [0,100) + case 0 <= r && r < 30: + // Do a read. + _, err := tbl.ReadRow(ctx, "testrow", RowFilter(LatestNFilter(1))) + if err != nil { + t.Errorf("Concurrent read: %v", err) + } + case 30 <= r && r < 100: + // Do a write. + mut := NewMutation() + mut.Set("ts", "col", 1000, []byte("data")) + if err := tbl.Apply(ctx, "testrow", mut); err != nil { + t.Errorf("Concurrent write: %v", err) + } + } + }() + } + wg.Wait() + checkpoint("tested high concurrency") + + // Large reads, writes and scans. + bigBytes := make([]byte, 5<<20) // 5 MB is larger than current default gRPC max of 4 MB, but less than the max we set. + nonsense := []byte("lorem ipsum dolor sit amet, ") + fill(bigBytes, nonsense) + mut = NewMutation() + mut.Set("ts", "col", 1000, bigBytes) + if err := tbl.Apply(ctx, "bigrow", mut); err != nil { + t.Errorf("Big write: %v", err) + } + r, err = tbl.ReadRow(ctx, "bigrow") + if err != nil { + t.Errorf("Big read: %v", err) + } + wantRow = Row{"ts": []ReadItem{ + {Row: "bigrow", Column: "ts:col", Timestamp: 1000, Value: bigBytes}, + }} + if !testutil.Equal(r, wantRow) { + t.Errorf("Big read returned incorrect bytes: %v", r) + } + // Now write 1000 rows, each with 82 KB values, then scan them all. + medBytes := make([]byte, 82<<10) + fill(medBytes, nonsense) + sem := make(chan int, 50) // do up to 50 mutations at a time. + for i := 0; i < 1000; i++ { + mut := NewMutation() + mut.Set("ts", "big-scan", 1000, medBytes) + row := fmt.Sprintf("row-%d", i) + wg.Add(1) + go func() { + defer wg.Done() + defer func() { <-sem }() + sem <- 1 + if err := tbl.Apply(ctx, row, mut); err != nil { + t.Errorf("Preparing large scan: %v", err) + } + }() + } + wg.Wait() + n := 0 + err = tbl.ReadRows(ctx, PrefixRange("row-"), func(r Row) bool { + for _, ris := range r { + for _, ri := range ris { + n += len(ri.Value) + } + } + return true + }, RowFilter(ColumnFilter("big-scan"))) + if err != nil { + t.Errorf("Doing large scan: %v", err) + } + if want := 1000 * len(medBytes); n != want { + t.Errorf("Large scan returned %d bytes, want %d", n, want) + } + // Scan a subset of the 1000 rows that we just created, using a LimitRows ReadOption. + rc := 0 + wantRc := 3 + err = tbl.ReadRows(ctx, PrefixRange("row-"), func(r Row) bool { + rc++ + return true + }, LimitRows(int64(wantRc))) + if err != nil { + t.Fatal(err) + } + if rc != wantRc { + t.Errorf("Scan with row limit returned %d rows, want %d", rc, wantRc) + } + checkpoint("tested big read/write/scan") + + // Test bulk mutations + if err := adminClient.CreateColumnFamily(ctx, table, "bulk"); err != nil { + t.Fatalf("Creating column family: %v", err) + } + bulkData := map[string][]string{ + "red sox": {"2004", "2007", "2013"}, + "patriots": {"2001", "2003", "2004", "2014"}, + "celtics": {"1981", "1984", "1986", "2008"}, + } + var rowKeys []string + var muts []*Mutation + for row, ss := range bulkData { + mut := NewMutation() + for _, name := range ss { + mut.Set("bulk", name, 1000, []byte("1")) + } + rowKeys = append(rowKeys, row) + muts = append(muts, mut) + } + status, err := tbl.ApplyBulk(ctx, rowKeys, muts) + if err != nil { + t.Fatalf("Bulk mutating rows %q: %v", rowKeys, err) + } + if status != nil { + t.Errorf("non-nil errors: %v", err) + } + checkpoint("inserted bulk data") + + // Read each row back + for rowKey, ss := range bulkData { + row, err := tbl.ReadRow(ctx, rowKey) + if err != nil { + t.Fatalf("Reading a bulk row: %v", err) + } + var wantItems []ReadItem + for _, val := range ss { + wantItems = append(wantItems, ReadItem{Row: rowKey, Column: "bulk:" + val, Timestamp: 1000, Value: []byte("1")}) + } + wantRow := Row{"bulk": wantItems} + if !testutil.Equal(row, wantRow) { + t.Errorf("Read row mismatch.\n got %#v\nwant %#v", row, wantRow) + } + } + checkpoint("tested reading from bulk insert") + + // Test bulk write errors. + // Note: Setting timestamps as ServerTime makes sure the mutations are not retried on error. + badMut := NewMutation() + badMut.Set("badfamily", "col", ServerTime, nil) + badMut2 := NewMutation() + badMut2.Set("badfamily2", "goodcol", ServerTime, []byte("1")) + status, err = tbl.ApplyBulk(ctx, []string{"badrow", "badrow2"}, []*Mutation{badMut, badMut2}) + if err != nil { + t.Fatalf("Bulk mutating rows %q: %v", rowKeys, err) + } + if status == nil { + t.Errorf("No errors for bad bulk mutation") + } else if status[0] == nil || status[1] == nil { + t.Errorf("No error for bad bulk mutation") + } +} + +type requestCountingInterceptor struct { + grpc.ClientStream + requestCallback func() +} + +func (i *requestCountingInterceptor) SendMsg(m interface{}) error { + i.requestCallback() + return i.ClientStream.SendMsg(m) +} + +func (i *requestCountingInterceptor) RecvMsg(m interface{}) error { + return i.ClientStream.RecvMsg(m) +} + +func requestCallback(callback func()) func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { + clientStream, err := streamer(ctx, desc, cc, method, opts...) + return &requestCountingInterceptor{ + ClientStream: clientStream, + requestCallback: callback, + }, err + } +} + +// TestReadRowsInvalidRowSet verifies that the client doesn't send ReadRows() requests with invalid RowSets. +func TestReadRowsInvalidRowSet(t *testing.T) { + testEnv, err := NewEmulatedEnv(IntegrationTestConfig{}) + if err != nil { + t.Fatalf("NewEmulatedEnv failed: %v", err) + } + var requestCount int + incrementRequestCount := func() { requestCount++ } + conn, err := grpc.Dial(testEnv.server.Addr, grpc.WithInsecure(), grpc.WithBlock(), + grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(100<<20), grpc.MaxCallRecvMsgSize(100<<20)), + grpc.WithStreamInterceptor(requestCallback(incrementRequestCount)), + ) + if err != nil { + t.Fatalf("grpc.Dial failed: %v", err) + } + ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) + defer cancel() + adminClient, err := NewAdminClient(ctx, testEnv.config.Project, testEnv.config.Instance, option.WithGRPCConn(conn)) + if err != nil { + t.Fatalf("NewClient failed: %v", err) + } + defer adminClient.Close() + if err := adminClient.CreateTable(ctx, testEnv.config.Table); err != nil { + t.Fatalf("CreateTable(%v) failed: %v", testEnv.config.Table, err) + } + client, err := NewClient(ctx, testEnv.config.Project, testEnv.config.Instance, option.WithGRPCConn(conn)) + if err != nil { + t.Fatalf("NewClient failed: %v", err) + } + defer client.Close() + table := client.Open(testEnv.config.Table) + tests := []struct { + rr RowSet + valid bool + }{ + { + rr: RowRange{}, + valid: true, + }, + { + rr: RowRange{start: "b"}, + valid: true, + }, + { + rr: RowRange{start: "b", limit: "c"}, + valid: true, + }, + { + rr: RowRange{start: "b", limit: "a"}, + valid: false, + }, + { + rr: RowList{"a"}, + valid: true, + }, + { + rr: RowList{}, + valid: false, + }, + } + for _, test := range tests { + requestCount = 0 + err = table.ReadRows(ctx, test.rr, func(r Row) bool { return true }) + if err != nil { + t.Fatalf("ReadRows(%v) failed: %v", test.rr, err) + } + requestValid := requestCount != 0 + if requestValid != test.valid { + t.Errorf("%s: got %v, want %v", test.rr, requestValid, test.valid) + } + } +} + +func formatReadItem(ri ReadItem) string { + // Use the column qualifier only to make the test data briefer. + col := ri.Column[strings.Index(ri.Column, ":")+1:] + return fmt.Sprintf("%s-%s-%s", ri.Row, col, ri.Value) +} + +func fill(b, sub []byte) { + for len(b) > len(sub) { + n := copy(b, sub) + b = b[n:] + } +} + +func clearTimestamps(r Row) { + for _, ris := range r { + for i := range ris { + ris[i].Timestamp = 0 + } + } +} + +func TestSampleRowKeys(t *testing.T) { + start := time.Now() + lastCheckpoint := start + checkpoint := func(s string) { + n := time.Now() + t.Logf("[%s] %v since start, %v since last checkpoint", s, n.Sub(start), n.Sub(lastCheckpoint)) + lastCheckpoint = n + } + ctx := context.Background() + client, adminClient, table, err := doSetup(ctx) + if err != nil { + t.Fatalf("%v", err) + } + defer client.Close() + defer adminClient.Close() + tbl := client.Open(table) + // Delete the table at the end of the test. + // Do this even before creating the table so that if this is running + // against production and CreateTable fails there's a chance of cleaning it up. + defer adminClient.DeleteTable(ctx, table) + + // Insert some data. + initialData := map[string][]string{ + "wmckinley11": {"tjefferson11"}, + "gwashington77": {"jadams77"}, + "tjefferson0": {"gwashington0", "jadams0"}, + } + + for row, ss := range initialData { + mut := NewMutation() + for _, name := range ss { + mut.Set("follows", name, 1000, []byte("1")) + } + if err := tbl.Apply(ctx, row, mut); err != nil { + t.Errorf("Mutating row %q: %v", row, err) + } + } + checkpoint("inserted initial data") + sampleKeys, err := tbl.SampleRowKeys(context.Background()) + if err != nil { + t.Errorf("%s: %v", "SampleRowKeys:", err) + } + if len(sampleKeys) == 0 { + t.Error("SampleRowKeys length 0") + } + checkpoint("tested SampleRowKeys.") +} + +func doSetup(ctx context.Context) (*Client, *AdminClient, string, error) { + start := time.Now() + lastCheckpoint := start + checkpoint := func(s string) { + n := time.Now() + fmt.Printf("[%s] %v since start, %v since last checkpoint", s, n.Sub(start), n.Sub(lastCheckpoint)) + lastCheckpoint = n + } + + testEnv, err := NewIntegrationEnv() + if err != nil { + return nil, nil, "", fmt.Errorf("IntegrationEnv: %v", err) + } + + var timeout time.Duration + if testEnv.Config().UseProd { + timeout = 10 * time.Minute + fmt.Printf("Running test against production") + } else { + timeout = 1 * time.Minute + fmt.Printf("bttest.Server running on %s", testEnv.Config().AdminEndpoint) + } + ctx, cancel := context.WithTimeout(ctx, timeout) + defer cancel() + + client, err := testEnv.NewClient() + if err != nil { + return nil, nil, "", fmt.Errorf("Client: %v", err) + } + checkpoint("dialed Client") + + adminClient, err := testEnv.NewAdminClient() + if err != nil { + return nil, nil, "", fmt.Errorf("AdminClient: %v", err) + } + checkpoint("dialed AdminClient") + + table := testEnv.Config().Table + if err := adminClient.CreateTable(ctx, table); err != nil { + return nil, nil, "", fmt.Errorf("Creating table: %v", err) + } + checkpoint("created table") + if err := adminClient.CreateColumnFamily(ctx, table, "follows"); err != nil { + return nil, nil, "", fmt.Errorf("Creating column family: %v", err) + } + checkpoint(`created "follows" column family`) + + return client, adminClient, table, nil +} diff --git a/vendor/cloud.google.com/go/bigtable/bttest/example_test.go b/vendor/cloud.google.com/go/bigtable/bttest/example_test.go new file mode 100644 index 000000000..6348c7c48 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/bttest/example_test.go @@ -0,0 +1,83 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package bttest_test + +import ( + "context" + "fmt" + "log" + + "cloud.google.com/go/bigtable" + "cloud.google.com/go/bigtable/bttest" + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +func ExampleNewServer() { + + srv, err := bttest.NewServer("localhost:0") + + if err != nil { + log.Fatalln(err) + } + + ctx := context.Background() + + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure()) + if err != nil { + log.Fatalln(err) + } + + proj, instance := "proj", "instance" + + adminClient, err := bigtable.NewAdminClient(ctx, proj, instance, option.WithGRPCConn(conn)) + if err != nil { + log.Fatalln(err) + } + + if err = adminClient.CreateTable(ctx, "example"); err != nil { + log.Fatalln(err) + } + + if err = adminClient.CreateColumnFamily(ctx, "example", "links"); err != nil { + log.Fatalln(err) + } + + client, err := bigtable.NewClient(ctx, proj, instance, option.WithGRPCConn(conn)) + if err != nil { + log.Fatalln(err) + } + tbl := client.Open("example") + + mut := bigtable.NewMutation() + mut.Set("links", "golang.org", bigtable.Now(), []byte("Gophers!")) + if err = tbl.Apply(ctx, "com.google.cloud", mut); err != nil { + log.Fatalln(err) + } + + if row, err := tbl.ReadRow(ctx, "com.google.cloud"); err != nil { + log.Fatalln(err) + } else { + for _, column := range row["links"] { + fmt.Println(column.Column) + fmt.Println(string(column.Value)) + } + } + + // Output: + // links:golang.org + // Gophers! +} diff --git a/vendor/cloud.google.com/go/bigtable/bttest/inmem.go b/vendor/cloud.google.com/go/bigtable/bttest/inmem.go new file mode 100644 index 000000000..81bcf4efd --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/bttest/inmem.go @@ -0,0 +1,1400 @@ +/* +Copyright 2015 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 bttest contains test helpers for working with the bigtable package. + +To use a Server, create it, and then connect to it with no security: +(The project/instance values are ignored.) + srv, err := bttest.NewServer("localhost:0") + ... + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure()) + ... + client, err := bigtable.NewClient(ctx, proj, instance, + option.WithGRPCConn(conn)) + ... +*/ +package bttest // import "cloud.google.com/go/bigtable/bttest" + +import ( + "bytes" + "context" + "encoding/binary" + "fmt" + "log" + "math/rand" + "net" + "regexp" + "sort" + "strings" + "sync" + "time" + + emptypb "github.com/golang/protobuf/ptypes/empty" + "github.com/golang/protobuf/ptypes/wrappers" + "github.com/google/btree" + btapb "google.golang.org/genproto/googleapis/bigtable/admin/v2" + btpb "google.golang.org/genproto/googleapis/bigtable/v2" + "google.golang.org/genproto/googleapis/longrunning" + statpb "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +const ( + // MilliSeconds field of the minimum valid Timestamp. + minValidMilliSeconds = 0 + + // MilliSeconds field of the max valid Timestamp. + maxValidMilliSeconds = int64(time.Millisecond) * 253402300800 +) + +var ( + validLabelTransformer = regexp.MustCompile(`[a-z0-9\-]{1,15}`) +) + +// Server is an in-memory Cloud Bigtable fake. +// It is unauthenticated, and only a rough approximation. +type Server struct { + Addr string + + l net.Listener + srv *grpc.Server + s *server +} + +// server is the real implementation of the fake. +// It is a separate and unexported type so the API won't be cluttered with +// methods that are only relevant to the fake's implementation. +type server struct { + mu sync.Mutex + tables map[string]*table // keyed by fully qualified name + gcc chan int // set when gcloop starts, closed when server shuts down + + // Any unimplemented methods will cause a panic. + btapb.BigtableTableAdminServer + btpb.BigtableServer +} + +// NewServer creates a new Server. +// The Server will be listening for gRPC connections, without TLS, +// on the provided address. The resolved address is named by the Addr field. +func NewServer(laddr string, opt ...grpc.ServerOption) (*Server, error) { + l, err := net.Listen("tcp", laddr) + if err != nil { + return nil, err + } + + s := &Server{ + Addr: l.Addr().String(), + l: l, + srv: grpc.NewServer(opt...), + s: &server{ + tables: make(map[string]*table), + }, + } + btapb.RegisterBigtableTableAdminServer(s.srv, s.s) + btpb.RegisterBigtableServer(s.srv, s.s) + + go s.srv.Serve(s.l) + + return s, nil +} + +// Close shuts down the server. +func (s *Server) Close() { + s.s.mu.Lock() + if s.s.gcc != nil { + close(s.s.gcc) + } + s.s.mu.Unlock() + + s.srv.Stop() + s.l.Close() +} + +func (s *server) CreateTable(ctx context.Context, req *btapb.CreateTableRequest) (*btapb.Table, error) { + tbl := req.Parent + "/tables/" + req.TableId + + s.mu.Lock() + if _, ok := s.tables[tbl]; ok { + s.mu.Unlock() + return nil, status.Errorf(codes.AlreadyExists, "table %q already exists", tbl) + } + s.tables[tbl] = newTable(req) + s.mu.Unlock() + + return &btapb.Table{Name: tbl}, nil +} + +func (s *server) CreateTableFromSnapshot(context.Context, *btapb.CreateTableFromSnapshotRequest) (*longrunning.Operation, error) { + return nil, status.Errorf(codes.Unimplemented, "the emulator does not currently support snapshots") +} + +func (s *server) ListTables(ctx context.Context, req *btapb.ListTablesRequest) (*btapb.ListTablesResponse, error) { + res := &btapb.ListTablesResponse{} + prefix := req.Parent + "/tables/" + + s.mu.Lock() + for tbl := range s.tables { + if strings.HasPrefix(tbl, prefix) { + res.Tables = append(res.Tables, &btapb.Table{Name: tbl}) + } + } + s.mu.Unlock() + + return res, nil +} + +func (s *server) GetTable(ctx context.Context, req *btapb.GetTableRequest) (*btapb.Table, error) { + tbl := req.Name + + s.mu.Lock() + tblIns, ok := s.tables[tbl] + s.mu.Unlock() + if !ok { + return nil, status.Errorf(codes.NotFound, "table %q not found", tbl) + } + + return &btapb.Table{ + Name: tbl, + ColumnFamilies: toColumnFamilies(tblIns.columnFamilies()), + }, nil +} + +func (s *server) DeleteTable(ctx context.Context, req *btapb.DeleteTableRequest) (*emptypb.Empty, error) { + s.mu.Lock() + defer s.mu.Unlock() + if _, ok := s.tables[req.Name]; !ok { + return nil, status.Errorf(codes.NotFound, "table %q not found", req.Name) + } + delete(s.tables, req.Name) + return &emptypb.Empty{}, nil +} + +func (s *server) ModifyColumnFamilies(ctx context.Context, req *btapb.ModifyColumnFamiliesRequest) (*btapb.Table, error) { + s.mu.Lock() + tbl, ok := s.tables[req.Name] + s.mu.Unlock() + if !ok { + return nil, status.Errorf(codes.NotFound, "table %q not found", req.Name) + } + + tbl.mu.Lock() + defer tbl.mu.Unlock() + + for _, mod := range req.Modifications { + if create := mod.GetCreate(); create != nil { + if _, ok := tbl.families[mod.Id]; ok { + return nil, status.Errorf(codes.AlreadyExists, "family %q already exists", mod.Id) + } + newcf := &columnFamily{ + name: req.Name + "/columnFamilies/" + mod.Id, + order: tbl.counter, + gcRule: create.GcRule, + } + tbl.counter++ + tbl.families[mod.Id] = newcf + } else if mod.GetDrop() { + if _, ok := tbl.families[mod.Id]; !ok { + return nil, fmt.Errorf("can't delete unknown family %q", mod.Id) + } + delete(tbl.families, mod.Id) + } else if modify := mod.GetUpdate(); modify != nil { + if _, ok := tbl.families[mod.Id]; !ok { + return nil, fmt.Errorf("no such family %q", mod.Id) + } + newcf := &columnFamily{ + name: req.Name + "/columnFamilies/" + mod.Id, + gcRule: modify.GcRule, + } + // assume that we ALWAYS want to replace by the new setting + // we may need partial update through + tbl.families[mod.Id] = newcf + } + } + + s.needGC() + return &btapb.Table{ + Name: req.Name, + ColumnFamilies: toColumnFamilies(tbl.families), + Granularity: btapb.Table_TimestampGranularity(btapb.Table_MILLIS), + }, nil +} + +func (s *server) DropRowRange(ctx context.Context, req *btapb.DropRowRangeRequest) (*emptypb.Empty, error) { + s.mu.Lock() + defer s.mu.Unlock() + tbl, ok := s.tables[req.Name] + if !ok { + return nil, status.Errorf(codes.NotFound, "table %q not found", req.Name) + } + + if req.GetDeleteAllDataFromTable() { + tbl.rows = btree.New(btreeDegree) + } else { + // Delete rows by prefix. + prefixBytes := req.GetRowKeyPrefix() + if prefixBytes == nil { + return nil, fmt.Errorf("missing row key prefix") + } + prefix := string(prefixBytes) + + // The BTree does not specify what happens if rows are deleted during + // iteration, and it provides no "delete range" method. + // So we collect the rows first, then delete them one by one. + var rowsToDelete []*row + tbl.rows.AscendGreaterOrEqual(btreeKey(prefix), func(i btree.Item) bool { + r := i.(*row) + if strings.HasPrefix(r.key, prefix) { + rowsToDelete = append(rowsToDelete, r) + return true + } + return false // stop iteration + }) + for _, r := range rowsToDelete { + tbl.rows.Delete(r) + } + } + return &emptypb.Empty{}, nil +} + +func (s *server) GenerateConsistencyToken(ctx context.Context, req *btapb.GenerateConsistencyTokenRequest) (*btapb.GenerateConsistencyTokenResponse, error) { + // Check that the table exists. + _, ok := s.tables[req.Name] + if !ok { + return nil, status.Errorf(codes.NotFound, "table %q not found", req.Name) + } + + return &btapb.GenerateConsistencyTokenResponse{ + ConsistencyToken: "TokenFor-" + req.Name, + }, nil +} + +func (s *server) CheckConsistency(ctx context.Context, req *btapb.CheckConsistencyRequest) (*btapb.CheckConsistencyResponse, error) { + // Check that the table exists. + _, ok := s.tables[req.Name] + if !ok { + return nil, status.Errorf(codes.NotFound, "table %q not found", req.Name) + } + + // Check this is the right token. + if req.ConsistencyToken != "TokenFor-"+req.Name { + return nil, status.Errorf(codes.InvalidArgument, "token %q not valid", req.ConsistencyToken) + } + + // Single cluster instances are always consistent. + return &btapb.CheckConsistencyResponse{ + Consistent: true, + }, nil +} + +func (s *server) SnapshotTable(context.Context, *btapb.SnapshotTableRequest) (*longrunning.Operation, error) { + return nil, status.Errorf(codes.Unimplemented, "the emulator does not currently support snapshots") +} + +func (s *server) GetSnapshot(context.Context, *btapb.GetSnapshotRequest) (*btapb.Snapshot, error) { + return nil, status.Errorf(codes.Unimplemented, "the emulator does not currently support snapshots") +} +func (s *server) ListSnapshots(context.Context, *btapb.ListSnapshotsRequest) (*btapb.ListSnapshotsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "the emulator does not currently support snapshots") +} +func (s *server) DeleteSnapshot(context.Context, *btapb.DeleteSnapshotRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "the emulator does not currently support snapshots") +} + +func (s *server) ReadRows(req *btpb.ReadRowsRequest, stream btpb.Bigtable_ReadRowsServer) error { + s.mu.Lock() + tbl, ok := s.tables[req.TableName] + s.mu.Unlock() + if !ok { + return status.Errorf(codes.NotFound, "table %q not found", req.TableName) + } + + // Rows to read can be specified by a set of row keys and/or a set of row ranges. + // Output is a stream of sorted, de-duped rows. + tbl.mu.RLock() + rowSet := make(map[string]*row) + + addRow := func(i btree.Item) bool { + r := i.(*row) + rowSet[r.key] = r + return true + } + + if req.Rows != nil && + len(req.Rows.RowKeys)+len(req.Rows.RowRanges) > 0 { + // Add the explicitly given keys + for _, key := range req.Rows.RowKeys { + k := string(key) + if i := tbl.rows.Get(btreeKey(k)); i != nil { + addRow(i) + } + } + + // Add keys from row ranges + for _, rr := range req.Rows.RowRanges { + var start, end string + switch sk := rr.StartKey.(type) { + case *btpb.RowRange_StartKeyClosed: + start = string(sk.StartKeyClosed) + case *btpb.RowRange_StartKeyOpen: + start = string(sk.StartKeyOpen) + "\x00" + } + switch ek := rr.EndKey.(type) { + case *btpb.RowRange_EndKeyClosed: + end = string(ek.EndKeyClosed) + "\x00" + case *btpb.RowRange_EndKeyOpen: + end = string(ek.EndKeyOpen) + } + switch { + case start == "" && end == "": + tbl.rows.Ascend(addRow) // all rows + case start == "": + tbl.rows.AscendLessThan(btreeKey(end), addRow) + case end == "": + tbl.rows.AscendGreaterOrEqual(btreeKey(start), addRow) + default: + tbl.rows.AscendRange(btreeKey(start), btreeKey(end), addRow) + } + } + } else { + // Read all rows + tbl.rows.Ascend(addRow) + } + tbl.mu.RUnlock() + + rows := make([]*row, 0, len(rowSet)) + for _, r := range rowSet { + rows = append(rows, r) + } + sort.Sort(byRowKey(rows)) + + limit := int(req.RowsLimit) + count := 0 + for _, r := range rows { + if limit > 0 && count >= limit { + return nil + } + streamed, err := streamRow(stream, r, req.Filter) + if err != nil { + return err + } + if streamed { + count++ + } + } + return nil +} + +// streamRow filters the given row and sends it via the given stream. +// Returns true if at least one cell matched the filter and was streamed, false otherwise. +func streamRow(stream btpb.Bigtable_ReadRowsServer, r *row, f *btpb.RowFilter) (bool, error) { + r.mu.Lock() + nr := r.copy() + r.mu.Unlock() + r = nr + + match, err := filterRow(f, r) + if err != nil { + return false, err + } + if !match { + return false, nil + } + + rrr := &btpb.ReadRowsResponse{} + families := r.sortedFamilies() + for _, fam := range families { + for _, colName := range fam.colNames { + cells := fam.cells[colName] + if len(cells) == 0 { + continue + } + for _, cell := range cells { + rrr.Chunks = append(rrr.Chunks, &btpb.ReadRowsResponse_CellChunk{ + RowKey: []byte(r.key), + FamilyName: &wrappers.StringValue{Value: fam.name}, + Qualifier: &wrappers.BytesValue{Value: []byte(colName)}, + TimestampMicros: cell.ts, + Value: cell.value, + Labels: cell.labels, + }) + } + } + } + // We can't have a cell with just COMMIT set, which would imply a new empty cell. + // So modify the last cell to have the COMMIT flag set. + if len(rrr.Chunks) > 0 { + rrr.Chunks[len(rrr.Chunks)-1].RowStatus = &btpb.ReadRowsResponse_CellChunk_CommitRow{CommitRow: true} + } + + return true, stream.Send(rrr) +} + +// filterRow modifies a row with the given filter. Returns true if at least one cell from the row matches, +// false otherwise. If a filter is invalid, filterRow returns false and an error. +func filterRow(f *btpb.RowFilter, r *row) (bool, error) { + if f == nil { + return true, nil + } + // Handle filters that apply beyond just including/excluding cells. + switch f := f.Filter.(type) { + case *btpb.RowFilter_BlockAllFilter: + return !f.BlockAllFilter, nil + case *btpb.RowFilter_PassAllFilter: + return f.PassAllFilter, nil + case *btpb.RowFilter_Chain_: + for _, sub := range f.Chain.Filters { + match, err := filterRow(sub, r) + if err != nil { + return false, err + } + if !match { + return false, nil + } + } + return true, nil + case *btpb.RowFilter_Interleave_: + srs := make([]*row, 0, len(f.Interleave.Filters)) + for _, sub := range f.Interleave.Filters { + sr := r.copy() + filterRow(sub, sr) + srs = append(srs, sr) + } + // merge + // TODO(dsymonds): is this correct? + r.families = make(map[string]*family) + for _, sr := range srs { + for _, fam := range sr.families { + f := r.getOrCreateFamily(fam.name, fam.order) + for colName, cs := range fam.cells { + f.cells[colName] = append(f.cellsByColumn(colName), cs...) + } + } + } + var count int + for _, fam := range r.families { + for _, cs := range fam.cells { + sort.Sort(byDescTS(cs)) + count += len(cs) + } + } + return count > 0, nil + case *btpb.RowFilter_CellsPerColumnLimitFilter: + lim := int(f.CellsPerColumnLimitFilter) + for _, fam := range r.families { + for col, cs := range fam.cells { + if len(cs) > lim { + fam.cells[col] = cs[:lim] + } + } + } + return true, nil + case *btpb.RowFilter_Condition_: + match, err := filterRow(f.Condition.PredicateFilter, r.copy()) + if err != nil { + return false, err + } + if match { + if f.Condition.TrueFilter == nil { + return false, nil + } + return filterRow(f.Condition.TrueFilter, r) + } + if f.Condition.FalseFilter == nil { + return false, nil + } + return filterRow(f.Condition.FalseFilter, r) + case *btpb.RowFilter_RowKeyRegexFilter: + rx, err := newRegexp(f.RowKeyRegexFilter) + if err != nil { + return false, status.Errorf(codes.InvalidArgument, "Error in field 'rowkey_regex_filter' : %v", err) + } + if !rx.MatchString(r.key) { + return false, nil + } + case *btpb.RowFilter_CellsPerRowLimitFilter: + // Grab the first n cells in the row. + lim := int(f.CellsPerRowLimitFilter) + for _, fam := range r.families { + for _, col := range fam.colNames { + cs := fam.cells[col] + if len(cs) > lim { + fam.cells[col] = cs[:lim] + lim = 0 + } else { + lim -= len(cs) + } + } + } + return true, nil + case *btpb.RowFilter_CellsPerRowOffsetFilter: + // Skip the first n cells in the row. + offset := int(f.CellsPerRowOffsetFilter) + for _, fam := range r.families { + for _, col := range fam.colNames { + cs := fam.cells[col] + if len(cs) > offset { + fam.cells[col] = cs[offset:] + offset = 0 + return true, nil + } + fam.cells[col] = cs[:0] + offset -= len(cs) + } + } + return true, nil + case *btpb.RowFilter_RowSampleFilter: + // The row sample filter "matches all cells from a row with probability + // p, and matches no cells from the row with probability 1-p." + // See https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto + if f.RowSampleFilter <= 0.0 || f.RowSampleFilter >= 1.0 { + return false, status.Error(codes.InvalidArgument, "row_sample_filter argument must be between 0.0 and 1.0") + } + return randFloat() < f.RowSampleFilter, nil + } + + // Any other case, operate on a per-cell basis. + cellCount := 0 + for _, fam := range r.families { + for colName, cs := range fam.cells { + filtered, err := filterCells(f, fam.name, colName, cs) + if err != nil { + return false, err + } + fam.cells[colName] = filtered + cellCount += len(fam.cells[colName]) + } + } + return cellCount > 0, nil +} + +var randFloat = rand.Float64 + +func filterCells(f *btpb.RowFilter, fam, col string, cs []cell) ([]cell, error) { + var ret []cell + for _, cell := range cs { + include, err := includeCell(f, fam, col, cell) + if err != nil { + return nil, err + } + if include { + cell, err = modifyCell(f, cell) + if err != nil { + return nil, err + } + ret = append(ret, cell) + } + } + return ret, nil +} + +func modifyCell(f *btpb.RowFilter, c cell) (cell, error) { + if f == nil { + return c, nil + } + // Consider filters that may modify the cell contents + switch filter := f.Filter.(type) { + case *btpb.RowFilter_StripValueTransformer: + return cell{ts: c.ts}, nil + case *btpb.RowFilter_ApplyLabelTransformer: + if !validLabelTransformer.MatchString(filter.ApplyLabelTransformer) { + return cell{}, status.Errorf( + codes.InvalidArgument, + `apply_label_transformer must match RE2([a-z0-9\-]+), but found %v`, + filter.ApplyLabelTransformer, + ) + } + return cell{ts: c.ts, value: c.value, labels: []string{filter.ApplyLabelTransformer}}, nil + default: + return c, nil + } +} + +func includeCell(f *btpb.RowFilter, fam, col string, cell cell) (bool, error) { + if f == nil { + return true, nil + } + // TODO(dsymonds): Implement many more filters. + switch f := f.Filter.(type) { + case *btpb.RowFilter_CellsPerColumnLimitFilter: + // Don't log, row-level filter + return true, nil + case *btpb.RowFilter_RowKeyRegexFilter: + // Don't log, row-level filter + return true, nil + case *btpb.RowFilter_StripValueTransformer: + // Don't log, cell-modifying filter + return true, nil + case *btpb.RowFilter_ApplyLabelTransformer: + // Don't log, cell-modifying filter + return true, nil + default: + log.Printf("WARNING: don't know how to handle filter of type %T (ignoring it)", f) + return true, nil + case *btpb.RowFilter_FamilyNameRegexFilter: + rx, err := newRegexp([]byte(f.FamilyNameRegexFilter)) + if err != nil { + return false, status.Errorf(codes.InvalidArgument, "Error in field 'family_name_regex_filter' : %v", err) + } + return rx.MatchString(fam), nil + case *btpb.RowFilter_ColumnQualifierRegexFilter: + rx, err := newRegexp(f.ColumnQualifierRegexFilter) + if err != nil { + return false, status.Errorf(codes.InvalidArgument, "Error in field 'column_qualifier_regex_filter' : %v", err) + } + return rx.MatchString(toUTF8([]byte(col))), nil + case *btpb.RowFilter_ValueRegexFilter: + rx, err := newRegexp(f.ValueRegexFilter) + if err != nil { + return false, status.Errorf(codes.InvalidArgument, "Error in field 'value_regex_filter' : %v", err) + } + return rx.Match(cell.value), nil + case *btpb.RowFilter_ColumnRangeFilter: + if fam != f.ColumnRangeFilter.FamilyName { + return false, nil + } + // Start qualifier defaults to empty string closed + inRangeStart := func() bool { return col >= "" } + switch sq := f.ColumnRangeFilter.StartQualifier.(type) { + case *btpb.ColumnRange_StartQualifierOpen: + inRangeStart = func() bool { return col > string(sq.StartQualifierOpen) } + case *btpb.ColumnRange_StartQualifierClosed: + inRangeStart = func() bool { return col >= string(sq.StartQualifierClosed) } + } + // End qualifier defaults to no upper boundary + inRangeEnd := func() bool { return true } + switch eq := f.ColumnRangeFilter.EndQualifier.(type) { + case *btpb.ColumnRange_EndQualifierClosed: + inRangeEnd = func() bool { return col <= string(eq.EndQualifierClosed) } + case *btpb.ColumnRange_EndQualifierOpen: + inRangeEnd = func() bool { return col < string(eq.EndQualifierOpen) } + } + return inRangeStart() && inRangeEnd(), nil + case *btpb.RowFilter_TimestampRangeFilter: + // Lower bound is inclusive and defaults to 0, upper bound is exclusive and defaults to infinity. + return cell.ts >= f.TimestampRangeFilter.StartTimestampMicros && + (f.TimestampRangeFilter.EndTimestampMicros == 0 || cell.ts < f.TimestampRangeFilter.EndTimestampMicros), nil + case *btpb.RowFilter_ValueRangeFilter: + v := cell.value + // Start value defaults to empty string closed + inRangeStart := func() bool { return bytes.Compare(v, []byte{}) >= 0 } + switch sv := f.ValueRangeFilter.StartValue.(type) { + case *btpb.ValueRange_StartValueOpen: + inRangeStart = func() bool { return bytes.Compare(v, sv.StartValueOpen) > 0 } + case *btpb.ValueRange_StartValueClosed: + inRangeStart = func() bool { return bytes.Compare(v, sv.StartValueClosed) >= 0 } + } + // End value defaults to no upper boundary + inRangeEnd := func() bool { return true } + switch ev := f.ValueRangeFilter.EndValue.(type) { + case *btpb.ValueRange_EndValueClosed: + inRangeEnd = func() bool { return bytes.Compare(v, ev.EndValueClosed) <= 0 } + case *btpb.ValueRange_EndValueOpen: + inRangeEnd = func() bool { return bytes.Compare(v, ev.EndValueOpen) < 0 } + } + return inRangeStart() && inRangeEnd(), nil + } +} + +func toUTF8(bs []byte) string { + var rs []rune + for _, b := range bs { + rs = append(rs, rune(b)) + } + return string(rs) +} + +func newRegexp(patBytes []byte) (*regexp.Regexp, error) { + pat := toUTF8(patBytes) + re, err := regexp.Compile("^" + pat + "$") // match entire target + if err != nil { + log.Printf("Bad pattern %q: %v", pat, err) + } + return re, err +} + +func (s *server) MutateRow(ctx context.Context, req *btpb.MutateRowRequest) (*btpb.MutateRowResponse, error) { + s.mu.Lock() + tbl, ok := s.tables[req.TableName] + s.mu.Unlock() + if !ok { + return nil, status.Errorf(codes.NotFound, "table %q not found", req.TableName) + } + fs := tbl.columnFamilies() + r := tbl.mutableRow(string(req.RowKey)) + r.mu.Lock() + defer r.mu.Unlock() + if err := applyMutations(tbl, r, req.Mutations, fs); err != nil { + return nil, err + } + return &btpb.MutateRowResponse{}, nil +} + +func (s *server) MutateRows(req *btpb.MutateRowsRequest, stream btpb.Bigtable_MutateRowsServer) error { + s.mu.Lock() + tbl, ok := s.tables[req.TableName] + s.mu.Unlock() + if !ok { + return status.Errorf(codes.NotFound, "table %q not found", req.TableName) + } + res := &btpb.MutateRowsResponse{Entries: make([]*btpb.MutateRowsResponse_Entry, len(req.Entries))} + + fs := tbl.columnFamilies() + + for i, entry := range req.Entries { + r := tbl.mutableRow(string(entry.RowKey)) + r.mu.Lock() + code, msg := int32(codes.OK), "" + if err := applyMutations(tbl, r, entry.Mutations, fs); err != nil { + code = int32(codes.Internal) + msg = err.Error() + } + res.Entries[i] = &btpb.MutateRowsResponse_Entry{ + Index: int64(i), + Status: &statpb.Status{Code: code, Message: msg}, + } + r.mu.Unlock() + } + return stream.Send(res) +} + +func (s *server) CheckAndMutateRow(ctx context.Context, req *btpb.CheckAndMutateRowRequest) (*btpb.CheckAndMutateRowResponse, error) { + s.mu.Lock() + tbl, ok := s.tables[req.TableName] + s.mu.Unlock() + if !ok { + return nil, status.Errorf(codes.NotFound, "table %q not found", req.TableName) + } + res := &btpb.CheckAndMutateRowResponse{} + + fs := tbl.columnFamilies() + + r := tbl.mutableRow(string(req.RowKey)) + r.mu.Lock() + defer r.mu.Unlock() + + // Figure out which mutation to apply. + whichMut := false + if req.PredicateFilter == nil { + // Use true_mutations iff row contains any cells. + whichMut = !r.isEmpty() + } else { + // Use true_mutations iff any cells in the row match the filter. + // TODO(dsymonds): This could be cheaper. + nr := r.copy() + filterRow(req.PredicateFilter, nr) + whichMut = !nr.isEmpty() + } + res.PredicateMatched = whichMut + muts := req.FalseMutations + if whichMut { + muts = req.TrueMutations + } + + if err := applyMutations(tbl, r, muts, fs); err != nil { + return nil, err + } + return res, nil +} + +// applyMutations applies a sequence of mutations to a row. +// fam should be a snapshot of the keys of tbl.families. +// It assumes r.mu is locked. +func applyMutations(tbl *table, r *row, muts []*btpb.Mutation, fs map[string]*columnFamily) error { + for _, mut := range muts { + switch mut := mut.Mutation.(type) { + default: + return fmt.Errorf("can't handle mutation type %T", mut) + case *btpb.Mutation_SetCell_: + set := mut.SetCell + if _, ok := fs[set.FamilyName]; !ok { + return fmt.Errorf("unknown family %q", set.FamilyName) + } + ts := set.TimestampMicros + if ts == -1 { // bigtable.ServerTime + ts = newTimestamp() + } + if !tbl.validTimestamp(ts) { + return fmt.Errorf("invalid timestamp %d", ts) + } + fam := set.FamilyName + col := string(set.ColumnQualifier) + + newCell := cell{ts: ts, value: set.Value} + f := r.getOrCreateFamily(fam, fs[fam].order) + f.cells[col] = appendOrReplaceCell(f.cellsByColumn(col), newCell) + case *btpb.Mutation_DeleteFromColumn_: + del := mut.DeleteFromColumn + if _, ok := fs[del.FamilyName]; !ok { + return fmt.Errorf("unknown family %q", del.FamilyName) + } + fam := del.FamilyName + col := string(del.ColumnQualifier) + if _, ok := r.families[fam]; ok { + cs := r.families[fam].cells[col] + if del.TimeRange != nil { + tsr := del.TimeRange + if !tbl.validTimestamp(tsr.StartTimestampMicros) { + return fmt.Errorf("invalid timestamp %d", tsr.StartTimestampMicros) + } + if !tbl.validTimestamp(tsr.EndTimestampMicros) && tsr.EndTimestampMicros != 0 { + return fmt.Errorf("invalid timestamp %d", tsr.EndTimestampMicros) + } + if tsr.StartTimestampMicros >= tsr.EndTimestampMicros && tsr.EndTimestampMicros != 0 { + return fmt.Errorf("inverted or invalid timestamp range [%d, %d]", tsr.StartTimestampMicros, tsr.EndTimestampMicros) + } + + // Find half-open interval to remove. + // Cells are in descending timestamp order, + // so the predicates to sort.Search are inverted. + si, ei := 0, len(cs) + if tsr.StartTimestampMicros > 0 { + ei = sort.Search(len(cs), func(i int) bool { return cs[i].ts < tsr.StartTimestampMicros }) + } + if tsr.EndTimestampMicros > 0 { + si = sort.Search(len(cs), func(i int) bool { return cs[i].ts < tsr.EndTimestampMicros }) + } + if si < ei { + copy(cs[si:], cs[ei:]) + cs = cs[:len(cs)-(ei-si)] + } + } else { + cs = nil + } + if len(cs) == 0 { + delete(r.families[fam].cells, col) + colNames := r.families[fam].colNames + i := sort.Search(len(colNames), func(i int) bool { return colNames[i] >= col }) + if i < len(colNames) && colNames[i] == col { + r.families[fam].colNames = append(colNames[:i], colNames[i+1:]...) + } + if len(r.families[fam].cells) == 0 { + delete(r.families, fam) + } + } else { + r.families[fam].cells[col] = cs + } + } + case *btpb.Mutation_DeleteFromRow_: + r.families = make(map[string]*family) + case *btpb.Mutation_DeleteFromFamily_: + fampre := mut.DeleteFromFamily.FamilyName + delete(r.families, fampre) + } + } + return nil +} + +func maxTimestamp(x, y int64) int64 { + if x > y { + return x + } + return y +} + +func newTimestamp() int64 { + ts := time.Now().UnixNano() / 1e3 + ts -= ts % 1000 // round to millisecond granularity + return ts +} + +func appendOrReplaceCell(cs []cell, newCell cell) []cell { + replaced := false + for i, cell := range cs { + if cell.ts == newCell.ts { + cs[i] = newCell + replaced = true + break + } + } + if !replaced { + cs = append(cs, newCell) + } + sort.Sort(byDescTS(cs)) + return cs +} + +func (s *server) ReadModifyWriteRow(ctx context.Context, req *btpb.ReadModifyWriteRowRequest) (*btpb.ReadModifyWriteRowResponse, error) { + s.mu.Lock() + tbl, ok := s.tables[req.TableName] + s.mu.Unlock() + if !ok { + return nil, status.Errorf(codes.NotFound, "table %q not found", req.TableName) + } + + fs := tbl.columnFamilies() + + rowKey := string(req.RowKey) + r := tbl.mutableRow(rowKey) + resultRow := newRow(rowKey) // copy of updated cells + + // This must be done before the row lock, acquired below, is released. + r.mu.Lock() + defer r.mu.Unlock() + // Assume all mutations apply to the most recent version of the cell. + // TODO(dsymonds): Verify this assumption and document it in the proto. + for _, rule := range req.Rules { + if _, ok := fs[rule.FamilyName]; !ok { + return nil, fmt.Errorf("unknown family %q", rule.FamilyName) + } + + fam := rule.FamilyName + col := string(rule.ColumnQualifier) + isEmpty := false + f := r.getOrCreateFamily(fam, fs[fam].order) + cs := f.cells[col] + isEmpty = len(cs) == 0 + + ts := newTimestamp() + var newCell, prevCell cell + if !isEmpty { + cells := r.families[fam].cells[col] + prevCell = cells[0] + + // ts is the max of now or the prev cell's timestamp in case the + // prev cell is in the future + ts = maxTimestamp(ts, prevCell.ts) + } + + switch rule := rule.Rule.(type) { + default: + return nil, fmt.Errorf("unknown RMW rule oneof %T", rule) + case *btpb.ReadModifyWriteRule_AppendValue: + newCell = cell{ts: ts, value: append(prevCell.value, rule.AppendValue...)} + case *btpb.ReadModifyWriteRule_IncrementAmount: + var v int64 + if !isEmpty { + prevVal := prevCell.value + if len(prevVal) != 8 { + return nil, fmt.Errorf("increment on non-64-bit value") + } + v = int64(binary.BigEndian.Uint64(prevVal)) + } + v += rule.IncrementAmount + var val [8]byte + binary.BigEndian.PutUint64(val[:], uint64(v)) + newCell = cell{ts: ts, value: val[:]} + } + + // Store the new cell + f.cells[col] = appendOrReplaceCell(f.cellsByColumn(col), newCell) + + // Store a copy for the result row + resultFamily := resultRow.getOrCreateFamily(fam, fs[fam].order) + resultFamily.cellsByColumn(col) // create the column + resultFamily.cells[col] = []cell{newCell} // overwrite the cells + } + + // Build the response using the result row + res := &btpb.Row{ + Key: req.RowKey, + Families: make([]*btpb.Family, len(resultRow.families)), + } + + for i, family := range resultRow.sortedFamilies() { + res.Families[i] = &btpb.Family{ + Name: family.name, + Columns: make([]*btpb.Column, len(family.colNames)), + } + + for j, colName := range family.colNames { + res.Families[i].Columns[j] = &btpb.Column{ + Qualifier: []byte(colName), + Cells: []*btpb.Cell{{ + TimestampMicros: family.cells[colName][0].ts, + Value: family.cells[colName][0].value, + }}, + } + } + } + return &btpb.ReadModifyWriteRowResponse{Row: res}, nil +} + +func (s *server) SampleRowKeys(req *btpb.SampleRowKeysRequest, stream btpb.Bigtable_SampleRowKeysServer) error { + s.mu.Lock() + tbl, ok := s.tables[req.TableName] + s.mu.Unlock() + if !ok { + return status.Errorf(codes.NotFound, "table %q not found", req.TableName) + } + + tbl.mu.RLock() + defer tbl.mu.RUnlock() + + // The return value of SampleRowKeys is very loosely defined. Return at least the + // final row key in the table and choose other row keys randomly. + var offset int64 + var err error + i := 0 + tbl.rows.Ascend(func(it btree.Item) bool { + row := it.(*row) + if i == tbl.rows.Len()-1 || rand.Int31n(100) == 0 { + resp := &btpb.SampleRowKeysResponse{ + RowKey: []byte(row.key), + OffsetBytes: offset, + } + err = stream.Send(resp) + if err != nil { + return false + } + } + offset += int64(row.size()) + i++ + return true + }) + return err +} + +// needGC is invoked whenever the server needs gcloop running. +func (s *server) needGC() { + s.mu.Lock() + if s.gcc == nil { + s.gcc = make(chan int) + go s.gcloop(s.gcc) + } + s.mu.Unlock() +} + +func (s *server) gcloop(done <-chan int) { + const ( + minWait = 500 // ms + maxWait = 1500 // ms + ) + + for { + // Wait for a random time interval. + d := time.Duration(minWait+rand.Intn(maxWait-minWait)) * time.Millisecond + select { + case <-time.After(d): + case <-done: + return // server has been closed + } + + // Do a GC pass over all tables. + var tables []*table + s.mu.Lock() + for _, tbl := range s.tables { + tables = append(tables, tbl) + } + s.mu.Unlock() + for _, tbl := range tables { + tbl.gc() + } + } +} + +type table struct { + mu sync.RWMutex + counter uint64 // increment by 1 when a new family is created + families map[string]*columnFamily // keyed by plain family name + rows *btree.BTree // indexed by row key +} + +const btreeDegree = 16 + +func newTable(ctr *btapb.CreateTableRequest) *table { + fams := make(map[string]*columnFamily) + c := uint64(0) + if ctr.Table != nil { + for id, cf := range ctr.Table.ColumnFamilies { + fams[id] = &columnFamily{ + name: ctr.Parent + "/columnFamilies/" + id, + order: c, + gcRule: cf.GcRule, + } + c++ + } + } + return &table{ + families: fams, + counter: c, + rows: btree.New(btreeDegree), + } +} + +func (t *table) validTimestamp(ts int64) bool { + if ts < minValidMilliSeconds || ts > maxValidMilliSeconds { + return false + } + + // Assume millisecond granularity is required. + return ts%1000 == 0 +} + +func (t *table) columnFamilies() map[string]*columnFamily { + cp := make(map[string]*columnFamily) + t.mu.RLock() + for fam, cf := range t.families { + cp[fam] = cf + } + t.mu.RUnlock() + return cp +} + +func (t *table) mutableRow(key string) *row { + bkey := btreeKey(key) + // Try fast path first. + t.mu.RLock() + i := t.rows.Get(bkey) + t.mu.RUnlock() + if i != nil { + return i.(*row) + } + + // We probably need to create the row. + t.mu.Lock() + defer t.mu.Unlock() + i = t.rows.Get(bkey) + if i != nil { + return i.(*row) + } + r := newRow(key) + t.rows.ReplaceOrInsert(r) + return r +} + +func (t *table) gc() { + // This method doesn't add or remove rows, so we only need a read lock for the table. + t.mu.RLock() + defer t.mu.RUnlock() + + // Gather GC rules we'll apply. + rules := make(map[string]*btapb.GcRule) // keyed by "fam" + for fam, cf := range t.families { + if cf.gcRule != nil { + rules[fam] = cf.gcRule + } + } + if len(rules) == 0 { + return + } + + t.rows.Ascend(func(i btree.Item) bool { + r := i.(*row) + r.mu.Lock() + r.gc(rules) + r.mu.Unlock() + return true + }) +} + +type byRowKey []*row + +func (b byRowKey) Len() int { return len(b) } +func (b byRowKey) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byRowKey) Less(i, j int) bool { return b[i].key < b[j].key } + +type row struct { + key string + + mu sync.Mutex + families map[string]*family // keyed by family name +} + +func newRow(key string) *row { + return &row{ + key: key, + families: make(map[string]*family), + } +} + +// copy returns a copy of the row. +// Cell values are aliased. +// r.mu should be held. +func (r *row) copy() *row { + nr := newRow(r.key) + for _, fam := range r.families { + nr.families[fam.name] = &family{ + name: fam.name, + order: fam.order, + colNames: fam.colNames, + cells: make(map[string][]cell), + } + for col, cs := range fam.cells { + // Copy the []cell slice, but not the []byte inside each cell. + nr.families[fam.name].cells[col] = append([]cell(nil), cs...) + } + } + return nr +} + +// isEmpty returns true if a row doesn't contain any cell +func (r *row) isEmpty() bool { + for _, fam := range r.families { + for _, cs := range fam.cells { + if len(cs) > 0 { + return false + } + } + } + return true +} + +// sortedFamilies returns a column family set +// sorted in ascending creation order in a row. +func (r *row) sortedFamilies() []*family { + var families []*family + for _, fam := range r.families { + families = append(families, fam) + } + sort.Sort(byCreationOrder(families)) + return families +} + +func (r *row) getOrCreateFamily(name string, order uint64) *family { + if _, ok := r.families[name]; !ok { + r.families[name] = &family{ + name: name, + order: order, + cells: make(map[string][]cell), + } + } + return r.families[name] +} + +// gc applies the given GC rules to the row. +// r.mu should be held. +func (r *row) gc(rules map[string]*btapb.GcRule) { + for _, fam := range r.families { + rule, ok := rules[fam.name] + if !ok { + continue + } + for col, cs := range fam.cells { + r.families[fam.name].cells[col] = applyGC(cs, rule) + } + } +} + +// size returns the total size of all cell values in the row. +func (r *row) size() int { + size := 0 + for _, fam := range r.families { + for _, cells := range fam.cells { + for _, cell := range cells { + size += len(cell.value) + } + } + } + return size +} + +// Less implements btree.Less. +func (r *row) Less(i btree.Item) bool { + return r.key < i.(*row).key +} + +// btreeKey returns a row for use as a key into the BTree. +func btreeKey(s string) *row { return &row{key: s} } + +func (r *row) String() string { + return r.key +} + +var gcTypeWarn sync.Once + +// applyGC applies the given GC rule to the cells. +func applyGC(cells []cell, rule *btapb.GcRule) []cell { + switch rule := rule.Rule.(type) { + default: + // TODO(dsymonds): Support GcRule_Intersection_ + gcTypeWarn.Do(func() { + log.Printf("Unsupported GC rule type %T", rule) + }) + case *btapb.GcRule_Union_: + for _, sub := range rule.Union.Rules { + cells = applyGC(cells, sub) + } + return cells + case *btapb.GcRule_MaxAge: + // Timestamps are in microseconds. + cutoff := time.Now().UnixNano() / 1e3 + cutoff -= rule.MaxAge.Seconds * 1e6 + cutoff -= int64(rule.MaxAge.Nanos) / 1e3 + // The slice of cells in in descending timestamp order. + // This sort.Search will return the index of the first cell whose timestamp is chronologically before the cutoff. + si := sort.Search(len(cells), func(i int) bool { return cells[i].ts < cutoff }) + if si < len(cells) { + log.Printf("bttest: GC MaxAge(%v) deleted %d cells.", rule.MaxAge, len(cells)-si) + } + return cells[:si] + case *btapb.GcRule_MaxNumVersions: + n := int(rule.MaxNumVersions) + if len(cells) > n { + cells = cells[:n] + } + return cells + } + return cells +} + +type family struct { + name string // Column family name + order uint64 // Creation order of column family + colNames []string // Column names are sorted in lexicographical ascending order + cells map[string][]cell // Keyed by column name; cells are in descending timestamp order +} + +type byCreationOrder []*family + +func (b byCreationOrder) Len() int { return len(b) } +func (b byCreationOrder) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byCreationOrder) Less(i, j int) bool { return b[i].order < b[j].order } + +// cellsByColumn adds the column name to colNames set if it does not exist +// and returns all cells within a column +func (f *family) cellsByColumn(name string) []cell { + if _, ok := f.cells[name]; !ok { + f.colNames = append(f.colNames, name) + sort.Strings(f.colNames) + } + return f.cells[name] +} + +type cell struct { + ts int64 + value []byte + labels []string +} + +type byDescTS []cell + +func (b byDescTS) Len() int { return len(b) } +func (b byDescTS) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byDescTS) Less(i, j int) bool { return b[i].ts > b[j].ts } + +type columnFamily struct { + name string + order uint64 // Creation order of column family + gcRule *btapb.GcRule +} + +func (c *columnFamily) proto() *btapb.ColumnFamily { + return &btapb.ColumnFamily{ + GcRule: c.gcRule, + } +} + +func toColumnFamilies(families map[string]*columnFamily) map[string]*btapb.ColumnFamily { + fs := make(map[string]*btapb.ColumnFamily) + for k, v := range families { + fs[k] = v.proto() + } + return fs +} diff --git a/vendor/cloud.google.com/go/bigtable/bttest/inmem_test.go b/vendor/cloud.google.com/go/bigtable/bttest/inmem_test.go new file mode 100644 index 000000000..df36c3ca6 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/bttest/inmem_test.go @@ -0,0 +1,1153 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package bttest + +import ( + "context" + "fmt" + "math/rand" + "strconv" + "sync" + "sync/atomic" + "testing" + "time" + + "github.com/golang/protobuf/proto" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + btapb "google.golang.org/genproto/googleapis/bigtable/admin/v2" + btpb "google.golang.org/genproto/googleapis/bigtable/v2" + "google.golang.org/grpc" +) + +func TestConcurrentMutationsReadModifyAndGC(t *testing.T) { + s := &server{ + tables: make(map[string]*table), + } + ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) + defer cancel() + if _, err := s.CreateTable( + ctx, + &btapb.CreateTableRequest{Parent: "cluster", TableId: "t"}); err != nil { + t.Fatal(err) + } + const name = `cluster/tables/t` + tbl := s.tables[name] + req := &btapb.ModifyColumnFamiliesRequest{ + Name: name, + Modifications: []*btapb.ModifyColumnFamiliesRequest_Modification{{ + Id: "cf", + Mod: &btapb.ModifyColumnFamiliesRequest_Modification_Create{Create: &btapb.ColumnFamily{}}, + }}, + } + _, err := s.ModifyColumnFamilies(ctx, req) + if err != nil { + t.Fatal(err) + } + req = &btapb.ModifyColumnFamiliesRequest{ + Name: name, + Modifications: []*btapb.ModifyColumnFamiliesRequest_Modification{{ + Id: "cf", + Mod: &btapb.ModifyColumnFamiliesRequest_Modification_Update{Update: &btapb.ColumnFamily{ + GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}}, + }}, + }}, + } + if _, err := s.ModifyColumnFamilies(ctx, req); err != nil { + t.Fatal(err) + } + + var wg sync.WaitGroup + var ts int64 + ms := func() []*btpb.Mutation { + return []*btpb.Mutation{{ + Mutation: &btpb.Mutation_SetCell_{SetCell: &btpb.Mutation_SetCell{ + FamilyName: "cf", + ColumnQualifier: []byte(`col`), + TimestampMicros: atomic.AddInt64(&ts, 1000), + }}, + }} + } + + rmw := func() *btpb.ReadModifyWriteRowRequest { + return &btpb.ReadModifyWriteRowRequest{ + TableName: name, + RowKey: []byte(fmt.Sprint(rand.Intn(100))), + Rules: []*btpb.ReadModifyWriteRule{{ + FamilyName: "cf", + ColumnQualifier: []byte("col"), + Rule: &btpb.ReadModifyWriteRule_IncrementAmount{IncrementAmount: 1}, + }}, + } + } + for i := 0; i < 100; i++ { + wg.Add(1) + go func() { + defer wg.Done() + for ctx.Err() == nil { + req := &btpb.MutateRowRequest{ + TableName: name, + RowKey: []byte(fmt.Sprint(rand.Intn(100))), + Mutations: ms(), + } + if _, err := s.MutateRow(ctx, req); err != nil { + panic(err) // can't use t.Fatal in goroutine + } + } + }() + wg.Add(1) + go func() { + defer wg.Done() + for ctx.Err() == nil { + _, _ = s.ReadModifyWriteRow(ctx, rmw()) + } + }() + + wg.Add(1) + go func() { + defer wg.Done() + tbl.gc() + }() + } + done := make(chan struct{}) + go func() { + wg.Wait() + close(done) + }() + select { + case <-done: + case <-time.After(1 * time.Second): + t.Error("Concurrent mutations and GCs haven't completed after 1s") + } +} + +func TestCreateTableWithFamily(t *testing.T) { + // The Go client currently doesn't support creating a table with column families + // in one operation but it is allowed by the API. This must still be supported by the + // fake server so this test lives here instead of in the main bigtable + // integration test. + s := &server{ + tables: make(map[string]*table), + } + ctx := context.Background() + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf1": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 123}}}, + "cf2": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 456}}}, + }, + } + cTbl, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + t.Fatalf("Creating table: %v", err) + } + tbl, err := s.GetTable(ctx, &btapb.GetTableRequest{Name: cTbl.Name}) + if err != nil { + t.Fatalf("Getting table: %v", err) + } + cf := tbl.ColumnFamilies["cf1"] + if cf == nil { + t.Fatalf("Missing col family cf1") + } + if got, want := cf.GcRule.GetMaxNumVersions(), int32(123); got != want { + t.Errorf("Invalid MaxNumVersions: wanted:%d, got:%d", want, got) + } + cf = tbl.ColumnFamilies["cf2"] + if cf == nil { + t.Fatalf("Missing col family cf2") + } + if got, want := cf.GcRule.GetMaxNumVersions(), int32(456); got != want { + t.Errorf("Invalid MaxNumVersions: wanted:%d, got:%d", want, got) + } +} + +type MockSampleRowKeysServer struct { + responses []*btpb.SampleRowKeysResponse + grpc.ServerStream +} + +func (s *MockSampleRowKeysServer) Send(resp *btpb.SampleRowKeysResponse) error { + s.responses = append(s.responses, resp) + return nil +} + +func TestSampleRowKeys(t *testing.T) { + s := &server{ + tables: make(map[string]*table), + } + ctx := context.Background() + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}}}, + }, + } + tbl, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + t.Fatalf("Creating table: %v", err) + } + + // Populate the table + val := []byte("value") + rowCount := 1000 + for i := 0; i < rowCount; i++ { + req := &btpb.MutateRowRequest{ + TableName: tbl.Name, + RowKey: []byte("row-" + strconv.Itoa(i)), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_SetCell_{SetCell: &btpb.Mutation_SetCell{ + FamilyName: "cf", + ColumnQualifier: []byte("col"), + TimestampMicros: 1000, + Value: val, + }}, + }}, + } + if _, err := s.MutateRow(ctx, req); err != nil { + t.Fatalf("Populating table: %v", err) + } + } + + mock := &MockSampleRowKeysServer{} + if err := s.SampleRowKeys(&btpb.SampleRowKeysRequest{TableName: tbl.Name}, mock); err != nil { + t.Errorf("SampleRowKeys error: %v", err) + } + if len(mock.responses) == 0 { + t.Fatal("Response count: got 0, want > 0") + } + // Make sure the offset of the final response is the offset of the final row + got := mock.responses[len(mock.responses)-1].OffsetBytes + want := int64((rowCount - 1) * len(val)) + if got != want { + t.Errorf("Invalid offset: got %d, want %d", got, want) + } +} + +func TestDropRowRange(t *testing.T) { + s := &server{ + tables: make(map[string]*table), + } + ctx := context.Background() + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}}}, + }, + } + tblInfo, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + t.Fatalf("Creating table: %v", err) + } + + tbl := s.tables[tblInfo.Name] + + // Populate the table + prefixes := []string{"AAA", "BBB", "CCC", "DDD"} + count := 3 + doWrite := func() { + for _, prefix := range prefixes { + for i := 0; i < count; i++ { + req := &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte(prefix + strconv.Itoa(i)), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_SetCell_{SetCell: &btpb.Mutation_SetCell{ + FamilyName: "cf", + ColumnQualifier: []byte("col"), + TimestampMicros: 1000, + Value: []byte{}, + }}, + }}, + } + if _, err := s.MutateRow(ctx, req); err != nil { + t.Fatalf("Populating table: %v", err) + } + } + } + } + + doWrite() + tblSize := tbl.rows.Len() + req := &btapb.DropRowRangeRequest{ + Name: tblInfo.Name, + Target: &btapb.DropRowRangeRequest_RowKeyPrefix{RowKeyPrefix: []byte("AAA")}, + } + if _, err = s.DropRowRange(ctx, req); err != nil { + t.Fatalf("Dropping first range: %v", err) + } + got, want := tbl.rows.Len(), tblSize-count + if got != want { + t.Errorf("Row count after first drop: got %d (%v), want %d", got, tbl.rows, want) + } + + req = &btapb.DropRowRangeRequest{ + Name: tblInfo.Name, + Target: &btapb.DropRowRangeRequest_RowKeyPrefix{RowKeyPrefix: []byte("DDD")}, + } + if _, err = s.DropRowRange(ctx, req); err != nil { + t.Fatalf("Dropping second range: %v", err) + } + got, want = tbl.rows.Len(), tblSize-(2*count) + if got != want { + t.Errorf("Row count after second drop: got %d (%v), want %d", got, tbl.rows, want) + } + + req = &btapb.DropRowRangeRequest{ + Name: tblInfo.Name, + Target: &btapb.DropRowRangeRequest_RowKeyPrefix{RowKeyPrefix: []byte("XXX")}, + } + if _, err = s.DropRowRange(ctx, req); err != nil { + t.Fatalf("Dropping invalid range: %v", err) + } + got, want = tbl.rows.Len(), tblSize-(2*count) + if got != want { + t.Errorf("Row count after invalid drop: got %d (%v), want %d", got, tbl.rows, want) + } + + req = &btapb.DropRowRangeRequest{ + Name: tblInfo.Name, + Target: &btapb.DropRowRangeRequest_DeleteAllDataFromTable{DeleteAllDataFromTable: true}, + } + if _, err = s.DropRowRange(ctx, req); err != nil { + t.Fatalf("Dropping all data: %v", err) + } + got, want = tbl.rows.Len(), 0 + if got != want { + t.Errorf("Row count after drop all: got %d, want %d", got, want) + } + + // Test that we can write rows, delete some and then write them again. + count = 1 + doWrite() + + req = &btapb.DropRowRangeRequest{ + Name: tblInfo.Name, + Target: &btapb.DropRowRangeRequest_DeleteAllDataFromTable{DeleteAllDataFromTable: true}, + } + if _, err = s.DropRowRange(ctx, req); err != nil { + t.Fatalf("Dropping all data: %v", err) + } + got, want = tbl.rows.Len(), 0 + if got != want { + t.Errorf("Row count after drop all: got %d, want %d", got, want) + } + + doWrite() + got, want = tbl.rows.Len(), len(prefixes) + if got != want { + t.Errorf("Row count after rewrite: got %d, want %d", got, want) + } + + req = &btapb.DropRowRangeRequest{ + Name: tblInfo.Name, + Target: &btapb.DropRowRangeRequest_RowKeyPrefix{RowKeyPrefix: []byte("BBB")}, + } + if _, err = s.DropRowRange(ctx, req); err != nil { + t.Fatalf("Dropping range: %v", err) + } + doWrite() + got, want = tbl.rows.Len(), len(prefixes) + if got != want { + t.Errorf("Row count after drop range: got %d, want %d", got, want) + } +} + +type MockReadRowsServer struct { + responses []*btpb.ReadRowsResponse + grpc.ServerStream +} + +func (s *MockReadRowsServer) Send(resp *btpb.ReadRowsResponse) error { + s.responses = append(s.responses, resp) + return nil +} + +func TestReadRows(t *testing.T) { + ctx := context.Background() + s := &server{ + tables: make(map[string]*table), + } + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf0": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}}}, + }, + } + tblInfo, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + t.Fatalf("Creating table: %v", err) + } + mreq := &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_SetCell_{SetCell: &btpb.Mutation_SetCell{ + FamilyName: "cf0", + ColumnQualifier: []byte("col"), + TimestampMicros: 1000, + Value: []byte{}, + }}, + }}, + } + if _, err := s.MutateRow(ctx, mreq); err != nil { + t.Fatalf("Populating table: %v", err) + } + + for _, rowset := range []*btpb.RowSet{ + {RowKeys: [][]byte{[]byte("row")}}, + {RowRanges: []*btpb.RowRange{{StartKey: &btpb.RowRange_StartKeyClosed{StartKeyClosed: []byte("")}}}}, + {RowRanges: []*btpb.RowRange{{StartKey: &btpb.RowRange_StartKeyClosed{StartKeyClosed: []byte("r")}}}}, + {RowRanges: []*btpb.RowRange{{ + StartKey: &btpb.RowRange_StartKeyClosed{StartKeyClosed: []byte("")}, + EndKey: &btpb.RowRange_EndKeyOpen{EndKeyOpen: []byte("s")}, + }}}, + } { + mock := &MockReadRowsServer{} + req := &btpb.ReadRowsRequest{TableName: tblInfo.Name, Rows: rowset} + if err = s.ReadRows(req, mock); err != nil { + t.Fatalf("ReadRows error: %v", err) + } + if got, want := len(mock.responses), 1; got != want { + t.Errorf("%+v: response count: got %d, want %d", rowset, got, want) + } + } +} + +func TestReadRowsError(t *testing.T) { + ctx := context.Background() + s := &server{ + tables: make(map[string]*table), + } + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf0": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}}}, + }, + } + tblInfo, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + t.Fatalf("Creating table: %v", err) + } + mreq := &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_SetCell_{SetCell: &btpb.Mutation_SetCell{ + FamilyName: "cf0", + ColumnQualifier: []byte("col"), + TimestampMicros: 1000, + Value: []byte{}, + }}, + }}, + } + if _, err := s.MutateRow(ctx, mreq); err != nil { + t.Fatalf("Populating table: %v", err) + } + + mock := &MockReadRowsServer{} + req := &btpb.ReadRowsRequest{TableName: tblInfo.Name, Filter: &btpb.RowFilter{ + Filter: &btpb.RowFilter_RowKeyRegexFilter{RowKeyRegexFilter: []byte("[")}}, // Invalid regex. + } + if err = s.ReadRows(req, mock); err == nil { + t.Fatal("ReadRows got no error, want error") + } +} + +func TestReadRowsOrder(t *testing.T) { + s := &server{ + tables: make(map[string]*table), + } + ctx := context.Background() + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf0": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}}}, + }, + } + tblInfo, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + t.Fatalf("Creating table: %v", err) + } + count := 3 + mcf := func(i int) *btapb.ModifyColumnFamiliesRequest { + return &btapb.ModifyColumnFamiliesRequest{ + Name: tblInfo.Name, + Modifications: []*btapb.ModifyColumnFamiliesRequest_Modification{{ + Id: "cf" + strconv.Itoa(i), + Mod: &btapb.ModifyColumnFamiliesRequest_Modification_Create{Create: &btapb.ColumnFamily{}}, + }}, + } + } + for i := 1; i <= count; i++ { + _, err = s.ModifyColumnFamilies(ctx, mcf(i)) + if err != nil { + t.Fatal(err) + } + } + // Populate the table + for fc := 0; fc < count; fc++ { + for cc := count; cc > 0; cc-- { + for tc := 0; tc < count; tc++ { + req := &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_SetCell_{SetCell: &btpb.Mutation_SetCell{ + FamilyName: "cf" + strconv.Itoa(fc), + ColumnQualifier: []byte("col" + strconv.Itoa(cc)), + TimestampMicros: int64((tc + 1) * 1000), + Value: []byte{}, + }}, + }}, + } + if _, err := s.MutateRow(ctx, req); err != nil { + t.Fatalf("Populating table: %v", err) + } + } + } + } + req := &btpb.ReadRowsRequest{ + TableName: tblInfo.Name, + Rows: &btpb.RowSet{RowKeys: [][]byte{[]byte("row")}}, + } + mock := &MockReadRowsServer{} + if err = s.ReadRows(req, mock); err != nil { + t.Errorf("ReadRows error: %v", err) + } + if len(mock.responses) == 0 { + t.Fatal("Response count: got 0, want > 0") + } + if len(mock.responses[0].Chunks) != 27 { + t.Fatalf("Chunk count: got %d, want 27", len(mock.responses[0].Chunks)) + } + testOrder := func(ms *MockReadRowsServer) { + var prevFam, prevCol string + var prevTime int64 + for _, cc := range ms.responses[0].Chunks { + if prevFam == "" { + prevFam = cc.FamilyName.Value + prevCol = string(cc.Qualifier.Value) + prevTime = cc.TimestampMicros + continue + } + if cc.FamilyName.Value < prevFam { + t.Errorf("Family order is not correct: got %s < %s", cc.FamilyName.Value, prevFam) + } else if cc.FamilyName.Value == prevFam { + if string(cc.Qualifier.Value) < prevCol { + t.Errorf("Column order is not correct: got %s < %s", string(cc.Qualifier.Value), prevCol) + } else if string(cc.Qualifier.Value) == prevCol { + if cc.TimestampMicros > prevTime { + t.Errorf("cell order is not correct: got %d > %d", cc.TimestampMicros, prevTime) + } + } + } + prevFam = cc.FamilyName.Value + prevCol = string(cc.Qualifier.Value) + prevTime = cc.TimestampMicros + } + } + testOrder(mock) + + // Read with interleave filter + inter := &btpb.RowFilter_Interleave{} + fnr := &btpb.RowFilter{Filter: &btpb.RowFilter_FamilyNameRegexFilter{FamilyNameRegexFilter: "cf1"}} + cqr := &btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{ColumnQualifierRegexFilter: []byte("col2")}} + inter.Filters = append(inter.Filters, fnr, cqr) + req = &btpb.ReadRowsRequest{ + TableName: tblInfo.Name, + Rows: &btpb.RowSet{RowKeys: [][]byte{[]byte("row")}}, + Filter: &btpb.RowFilter{ + Filter: &btpb.RowFilter_Interleave_{Interleave: inter}, + }, + } + + mock = &MockReadRowsServer{} + if err = s.ReadRows(req, mock); err != nil { + t.Errorf("ReadRows error: %v", err) + } + if len(mock.responses) == 0 { + t.Fatal("Response count: got 0, want > 0") + } + if len(mock.responses[0].Chunks) != 18 { + t.Fatalf("Chunk count: got %d, want 18", len(mock.responses[0].Chunks)) + } + testOrder(mock) + + // Check order after ReadModifyWriteRow + rmw := func(i int) *btpb.ReadModifyWriteRowRequest { + return &btpb.ReadModifyWriteRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Rules: []*btpb.ReadModifyWriteRule{{ + FamilyName: "cf3", + ColumnQualifier: []byte("col" + strconv.Itoa(i)), + Rule: &btpb.ReadModifyWriteRule_IncrementAmount{IncrementAmount: 1}, + }}, + } + } + for i := count; i > 0; i-- { + if _, err := s.ReadModifyWriteRow(ctx, rmw(i)); err != nil { + t.Fatal(err) + } + } + req = &btpb.ReadRowsRequest{ + TableName: tblInfo.Name, + Rows: &btpb.RowSet{RowKeys: [][]byte{[]byte("row")}}, + } + mock = &MockReadRowsServer{} + if err = s.ReadRows(req, mock); err != nil { + t.Errorf("ReadRows error: %v", err) + } + if len(mock.responses) == 0 { + t.Fatal("Response count: got 0, want > 0") + } + if len(mock.responses[0].Chunks) != 30 { + t.Fatalf("Chunk count: got %d, want 30", len(mock.responses[0].Chunks)) + } + testOrder(mock) +} + +func TestReadRowsWithlabelTransformer(t *testing.T) { + ctx := context.Background() + s := &server{ + tables: make(map[string]*table), + } + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf0": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}}}, + }, + } + tblInfo, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + t.Fatalf("Creating table: %v", err) + } + mreq := &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_SetCell_{SetCell: &btpb.Mutation_SetCell{ + FamilyName: "cf0", + ColumnQualifier: []byte("col"), + TimestampMicros: 1000, + Value: []byte{}, + }}, + }}, + } + if _, err := s.MutateRow(ctx, mreq); err != nil { + t.Fatalf("Populating table: %v", err) + } + + mock := &MockReadRowsServer{} + req := &btpb.ReadRowsRequest{ + TableName: tblInfo.Name, + Filter: &btpb.RowFilter{ + Filter: &btpb.RowFilter_ApplyLabelTransformer{ + ApplyLabelTransformer: "label", + }, + }, + } + if err = s.ReadRows(req, mock); err != nil { + t.Fatalf("ReadRows error: %v", err) + } + + if got, want := len(mock.responses), 1; got != want { + t.Fatalf("response count: got %d, want %d", got, want) + } + resp := mock.responses[0] + if got, want := len(resp.Chunks), 1; got != want { + t.Fatalf("chunks count: got %d, want %d", got, want) + } + chunk := resp.Chunks[0] + if got, want := len(chunk.Labels), 1; got != want { + t.Fatalf("labels count: got %d, want %d", got, want) + } + if got, want := chunk.Labels[0], "label"; got != want { + t.Fatalf("label: got %s, want %s", got, want) + } + + mock = &MockReadRowsServer{} + req = &btpb.ReadRowsRequest{ + TableName: tblInfo.Name, + Filter: &btpb.RowFilter{ + Filter: &btpb.RowFilter_ApplyLabelTransformer{ + ApplyLabelTransformer: "", // invalid label + }, + }, + } + if err = s.ReadRows(req, mock); err == nil { + t.Fatal("ReadRows want invalid label error, got none") + } +} + +func TestCheckAndMutateRowWithoutPredicate(t *testing.T) { + s := &server{ + tables: make(map[string]*table), + } + ctx := context.Background() + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}}}, + }, + } + tbl, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + t.Fatalf("Creating table: %v", err) + } + + // Populate the table + val := []byte("value") + mrreq := &btpb.MutateRowRequest{ + TableName: tbl.Name, + RowKey: []byte("row-present"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_SetCell_{SetCell: &btpb.Mutation_SetCell{ + FamilyName: "cf", + ColumnQualifier: []byte("col"), + TimestampMicros: 1000, + Value: val, + }}, + }}, + } + if _, err := s.MutateRow(ctx, mrreq); err != nil { + t.Fatalf("Populating table: %v", err) + } + + req := &btpb.CheckAndMutateRowRequest{ + TableName: tbl.Name, + RowKey: []byte("row-not-present"), + } + if res, err := s.CheckAndMutateRow(ctx, req); err != nil { + t.Errorf("CheckAndMutateRow error: %v", err) + } else if got, want := res.PredicateMatched, false; got != want { + t.Errorf("Invalid PredicateMatched value: got %t, want %t", got, want) + } + + req = &btpb.CheckAndMutateRowRequest{ + TableName: tbl.Name, + RowKey: []byte("row-present"), + } + if res, err := s.CheckAndMutateRow(ctx, req); err != nil { + t.Errorf("CheckAndMutateRow error: %v", err) + } else if got, want := res.PredicateMatched, true; got != want { + t.Errorf("Invalid PredicateMatched value: got %t, want %t", got, want) + } +} + +func TestServer_ReadModifyWriteRow(t *testing.T) { + s := &server{ + tables: make(map[string]*table), + } + + ctx := context.Background() + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{MaxNumVersions: 1}}}, + }, + } + tbl, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + t.Fatalf("Creating table: %v", err) + } + + req := &btpb.ReadModifyWriteRowRequest{ + TableName: tbl.Name, + RowKey: []byte("row-key"), + Rules: []*btpb.ReadModifyWriteRule{ + { + FamilyName: "cf", + ColumnQualifier: []byte("q1"), + Rule: &btpb.ReadModifyWriteRule_AppendValue{ + AppendValue: []byte("a"), + }, + }, + // multiple ops for same cell + { + FamilyName: "cf", + ColumnQualifier: []byte("q1"), + Rule: &btpb.ReadModifyWriteRule_AppendValue{ + AppendValue: []byte("b"), + }, + }, + // different cell whose qualifier should sort before the prior rules + { + FamilyName: "cf", + ColumnQualifier: []byte("q0"), + Rule: &btpb.ReadModifyWriteRule_IncrementAmount{ + IncrementAmount: 1, + }, + }, + }, + } + + got, err := s.ReadModifyWriteRow(ctx, req) + + if err != nil { + t.Fatalf("ReadModifyWriteRow error: %v", err) + } + + want := &btpb.ReadModifyWriteRowResponse{ + Row: &btpb.Row{ + Key: []byte("row-key"), + Families: []*btpb.Family{{ + Name: "cf", + Columns: []*btpb.Column{ + { + Qualifier: []byte("q0"), + Cells: []*btpb.Cell{{ + Value: []byte{0, 0, 0, 0, 0, 0, 0, 1}, + }}, + }, + { + Qualifier: []byte("q1"), + Cells: []*btpb.Cell{{ + Value: []byte("ab"), + }}, + }, + }, + }}, + }, + } + + diff := cmp.Diff(got, want, cmpopts.IgnoreFields(btpb.Cell{}, "TimestampMicros")) + if diff != "" { + t.Errorf("unexpected response: %s", diff) + } +} + +// helper function to populate table data +func populateTable(ctx context.Context, s *server) (*btapb.Table, error) { + newTbl := btapb.Table{ + ColumnFamilies: map[string]*btapb.ColumnFamily{ + "cf0": {GcRule: &btapb.GcRule{Rule: &btapb.GcRule_MaxNumVersions{1}}}, + }, + } + tblInfo, err := s.CreateTable(ctx, &btapb.CreateTableRequest{Parent: "cluster", TableId: "t", Table: &newTbl}) + if err != nil { + return nil, err + } + count := 3 + mcf := func(i int) *btapb.ModifyColumnFamiliesRequest { + return &btapb.ModifyColumnFamiliesRequest{ + Name: tblInfo.Name, + Modifications: []*btapb.ModifyColumnFamiliesRequest_Modification{{ + Id: "cf" + strconv.Itoa(i), + Mod: &btapb.ModifyColumnFamiliesRequest_Modification_Create{&btapb.ColumnFamily{}}, + }}, + } + } + for i := 1; i <= count; i++ { + _, err = s.ModifyColumnFamilies(ctx, mcf(i)) + if err != nil { + return nil, err + } + } + // Populate the table + for fc := 0; fc < count; fc++ { + for cc := count; cc > 0; cc-- { + for tc := 0; tc < count; tc++ { + req := &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_SetCell_{&btpb.Mutation_SetCell{ + FamilyName: "cf" + strconv.Itoa(fc), + ColumnQualifier: []byte("col" + strconv.Itoa(cc)), + TimestampMicros: int64((tc + 1) * 1000), + Value: []byte{}, + }}, + }}, + } + if _, err := s.MutateRow(ctx, req); err != nil { + return nil, err + } + } + } + } + + return tblInfo, nil +} + +func TestFilters(t *testing.T) { + tests := []struct { + in *btpb.RowFilter + out int + }{ + {in: &btpb.RowFilter{Filter: &btpb.RowFilter_BlockAllFilter{true}}, out: 0}, + {in: &btpb.RowFilter{Filter: &btpb.RowFilter_BlockAllFilter{false}}, out: 1}, + {in: &btpb.RowFilter{Filter: &btpb.RowFilter_PassAllFilter{true}}, out: 1}, + {in: &btpb.RowFilter{Filter: &btpb.RowFilter_PassAllFilter{false}}, out: 0}, + } + + ctx := context.Background() + + s := &server{ + tables: make(map[string]*table), + } + + tblInfo, err := populateTable(ctx, s) + if err != nil { + t.Fatal(err) + } + + req := &btpb.ReadRowsRequest{ + TableName: tblInfo.Name, + Rows: &btpb.RowSet{RowKeys: [][]byte{[]byte("row")}}, + } + + for _, tc := range tests { + req.Filter = tc.in + + mock := &MockReadRowsServer{} + if err = s.ReadRows(req, mock); err != nil { + t.Errorf("ReadRows error: %v", err) + continue + } + + if len(mock.responses) != tc.out { + t.Errorf("Response count: got %d, want %d", len(mock.responses), tc.out) + continue + } + } +} + +func Test_Mutation_DeleteFromColumn(t *testing.T) { + ctx := context.Background() + + s := &server{ + tables: make(map[string]*table), + } + + tblInfo, err := populateTable(ctx, s) + if err != nil { + t.Fatal(err) + } + + tests := []struct { + in *btpb.MutateRowRequest + fail bool + }{ + {in: &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_DeleteFromColumn_{DeleteFromColumn: &btpb.Mutation_DeleteFromColumn{ + FamilyName: "cf1", + ColumnQualifier: []byte("col1"), + TimeRange: &btpb.TimestampRange{ + StartTimestampMicros: 2000, + EndTimestampMicros: 1000, + }, + }}, + }}, + }, + fail: true, + }, + {in: &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_DeleteFromColumn_{DeleteFromColumn: &btpb.Mutation_DeleteFromColumn{ + FamilyName: "cf2", + ColumnQualifier: []byte("col2"), + TimeRange: &btpb.TimestampRange{ + StartTimestampMicros: 1000, + EndTimestampMicros: 2000, + }, + }}, + }}, + }, + fail: false, + }, + {in: &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_DeleteFromColumn_{DeleteFromColumn: &btpb.Mutation_DeleteFromColumn{ + FamilyName: "cf3", + ColumnQualifier: []byte("col3"), + TimeRange: &btpb.TimestampRange{ + StartTimestampMicros: 1000, + EndTimestampMicros: 0, + }, + }}, + }}, + }, + fail: false, + }, + {in: &btpb.MutateRowRequest{ + TableName: tblInfo.Name, + RowKey: []byte("row"), + Mutations: []*btpb.Mutation{{ + Mutation: &btpb.Mutation_DeleteFromColumn_{DeleteFromColumn: &btpb.Mutation_DeleteFromColumn{ + FamilyName: "cf4", + ColumnQualifier: []byte("col4"), + TimeRange: &btpb.TimestampRange{ + StartTimestampMicros: 0, + EndTimestampMicros: 1000, + }, + }}, + }}, + }, + fail: true, + }, + } + + for _, tst := range tests { + _, err = s.MutateRow(ctx, tst.in) + + if err != nil && !tst.fail { + t.Errorf("expected passed got failure for : %v \n with err: %v", tst.in, err) + } + + if err == nil && tst.fail { + t.Errorf("expected failure got passed for : %v", tst) + } + } +} + +func TestFilterRow(t *testing.T) { + row := &row{ + key: "row", + families: map[string]*family{ + "fam": { + name: "fam", + cells: map[string][]cell{ + "col": {{ts: 100, value: []byte("val")}}, + }, + }, + }, + } + for _, test := range []struct { + filter *btpb.RowFilter + want bool + }{ + // The regexp-based filters perform whole-string, case-sensitive matches. + {&btpb.RowFilter{Filter: &btpb.RowFilter_RowKeyRegexFilter{[]byte("row")}}, true}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_RowKeyRegexFilter{[]byte("ro")}}, false}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_RowKeyRegexFilter{[]byte("ROW")}}, false}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_RowKeyRegexFilter{[]byte("moo")}}, false}, + + {&btpb.RowFilter{Filter: &btpb.RowFilter_FamilyNameRegexFilter{"fam"}}, true}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_FamilyNameRegexFilter{"f.*"}}, true}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_FamilyNameRegexFilter{"[fam]+"}}, true}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_FamilyNameRegexFilter{"fa"}}, false}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_FamilyNameRegexFilter{"FAM"}}, false}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_FamilyNameRegexFilter{"moo"}}, false}, + + {&btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{[]byte("col")}}, true}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{[]byte("co")}}, false}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{[]byte("COL")}}, false}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{[]byte("moo")}}, false}, + + {&btpb.RowFilter{Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("val")}}, true}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("va")}}, false}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("VAL")}}, false}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("moo")}}, false}, + } { + got, _ := filterRow(test.filter, row.copy()) + if got != test.want { + t.Errorf("%s: got %t, want %t", proto.CompactTextString(test.filter), got, test.want) + } + } +} + +func TestFilterRowWithErrors(t *testing.T) { + row := &row{ + key: "row", + families: map[string]*family{ + "fam": { + name: "fam", + cells: map[string][]cell{ + "col": {{ts: 100, value: []byte("val")}}, + }, + }, + }, + } + for _, test := range []struct { + badRegex *btpb.RowFilter + }{ + {&btpb.RowFilter{Filter: &btpb.RowFilter_RowKeyRegexFilter{[]byte("[")}}}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_FamilyNameRegexFilter{"["}}}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{[]byte("[")}}}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("[")}}}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_Chain_{ + Chain: &btpb.RowFilter_Chain{Filters: []*btpb.RowFilter{ + {Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("[")}}}, + }, + }}}, + {&btpb.RowFilter{Filter: &btpb.RowFilter_Condition_{ + Condition: &btpb.RowFilter_Condition{ + PredicateFilter: &btpb.RowFilter{Filter: &btpb.RowFilter_ValueRegexFilter{[]byte("[")}}, + }, + }}}, + + {&btpb.RowFilter{Filter: &btpb.RowFilter_RowSampleFilter{0.0}}}, // 0.0 is invalid. + {&btpb.RowFilter{Filter: &btpb.RowFilter_RowSampleFilter{1.0}}}, // 1.0 is invalid. + } { + got, err := filterRow(test.badRegex, row.copy()) + if got != false { + t.Errorf("%s: got true, want false", proto.CompactTextString(test.badRegex)) + } + if err == nil { + t.Errorf("%s: got no error, want error", proto.CompactTextString(test.badRegex)) + } + } +} + +func TestFilterRowWithRowSampleFilter(t *testing.T) { + prev := randFloat + randFloat = func() float64 { return 0.5 } + defer func() { randFloat = prev }() + for _, test := range []struct { + p float64 + want bool + }{ + {0.1, false}, // Less than random float. Return no rows. + {0.5, false}, // Equal to random float. Return no rows. + {0.9, true}, // Greater than random float. Return all rows. + } { + got, err := filterRow(&btpb.RowFilter{Filter: &btpb.RowFilter_RowSampleFilter{test.p}}, &row{}) + if err != nil { + t.Fatalf("%f: %v", test.p, err) + } + if got != test.want { + t.Errorf("%v: got %t, want %t", test.p, got, test.want) + } + } +} + +func TestFilterRowWithBinaryColumnQualifier(t *testing.T) { + rs := []byte{128, 128} + row := &row{ + key: string(rs), + families: map[string]*family{ + "fam": { + name: "fam", + cells: map[string][]cell{ + string(rs): {{ts: 100, value: []byte("val")}}, + }, + }, + }, + } + for _, test := range []struct { + filter []byte + want bool + }{ + {[]byte{128, 128}, true}, // succeeds, exact match + {[]byte{128, 129}, false}, // fails + {[]byte{128}, false}, // fails, because the regexp must match the entire input + {[]byte{128, '*'}, true}, // succeeds: 0 or more 128s + {[]byte{'[', 127, 128, ']', '{', '2', '}'}, true}, // succeeds: exactly two of either 127 or 128 + } { + got, _ := filterRow(&btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{test.filter}}, row.copy()) + if got != test.want { + t.Errorf("%v: got %t, want %t", test.filter, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/bigtable/cmd/cbt/cbt.go b/vendor/cloud.google.com/go/bigtable/cmd/cbt/cbt.go new file mode 100644 index 000000000..b6986d4de --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/cmd/cbt/cbt.go @@ -0,0 +1,1614 @@ +/* +Copyright 2015 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 main + +// Command docs are in cbtdoc.go. + +import ( + "bytes" + "context" + "encoding/csv" + "flag" + "fmt" + "go/format" + "io" + "log" + "os" + "regexp" + "sort" + "strconv" + "strings" + "text/tabwriter" + "text/template" + "time" + + "cloud.google.com/go/bigtable" + "cloud.google.com/go/bigtable/internal/cbtconfig" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +var ( + oFlag = flag.String("o", "", "if set, redirect stdout to this file") + + config *cbtconfig.Config + client *bigtable.Client + adminClient *bigtable.AdminClient + instanceAdminClient *bigtable.InstanceAdminClient + + version = "" + revision = "" + revisionDate = "" + cliUserAgent = "cbt-cli-go/unknown" +) + +func getCredentialOpts(opts []option.ClientOption) []option.ClientOption { + if ts := config.TokenSource; ts != nil { + opts = append(opts, option.WithTokenSource(ts)) + } + if tlsCreds := config.TLSCreds; tlsCreds != nil { + opts = append(opts, option.WithGRPCDialOption(grpc.WithTransportCredentials(tlsCreds))) + } + return opts +} + +func getClient(clientConf bigtable.ClientConfig) *bigtable.Client { + if client == nil { + var opts []option.ClientOption + if ep := config.DataEndpoint; ep != "" { + opts = append(opts, option.WithEndpoint(ep)) + } + opts = append(opts, option.WithUserAgent(cliUserAgent)) + opts = getCredentialOpts(opts) + var err error + client, err = bigtable.NewClientWithConfig(context.Background(), config.Project, config.Instance, clientConf, opts...) + if err != nil { + log.Fatalf("Making bigtable.Client: %v", err) + } + } + return client +} + +func getAdminClient() *bigtable.AdminClient { + if adminClient == nil { + var opts []option.ClientOption + if ep := config.AdminEndpoint; ep != "" { + opts = append(opts, option.WithEndpoint(ep)) + } + opts = append(opts, option.WithUserAgent(cliUserAgent)) + opts = getCredentialOpts(opts) + var err error + adminClient, err = bigtable.NewAdminClient(context.Background(), config.Project, config.Instance, opts...) + if err != nil { + log.Fatalf("Making bigtable.AdminClient: %v", err) + } + } + return adminClient +} + +func getInstanceAdminClient() *bigtable.InstanceAdminClient { + if instanceAdminClient == nil { + var opts []option.ClientOption + if ep := config.AdminEndpoint; ep != "" { + opts = append(opts, option.WithEndpoint(ep)) + } + opts = getCredentialOpts(opts) + var err error + instanceAdminClient, err = bigtable.NewInstanceAdminClient(context.Background(), config.Project, opts...) + if err != nil { + log.Fatalf("Making bigtable.InstanceAdminClient: %v", err) + } + } + return instanceAdminClient +} + +func main() { + var err error + config, err = cbtconfig.Load() + if err != nil { + log.Fatal(err) + } + config.RegisterFlags() + + flag.Usage = func() { usage(os.Stderr) } + flag.Parse() + if flag.NArg() == 0 { + usage(os.Stderr) + os.Exit(1) + } + + if *oFlag != "" { + f, err := os.Create(*oFlag) + if err != nil { + log.Fatal(err) + } + defer func() { + if err := f.Close(); err != nil { + log.Fatal(err) + } + }() + os.Stdout = f + } + + if config.UserAgent != "" { + cliUserAgent = config.UserAgent + } + + ctx := context.Background() + for _, cmd := range commands { + if cmd.Name == flag.Arg(0) { + if err := config.CheckFlags(cmd.Required); err != nil { + log.Fatal(err) + } + cmd.do(ctx, flag.Args()[1:]...) + return + } + } + log.Fatalf("Unknown command %q", flag.Arg(0)) +} + +func usage(w io.Writer) { + fmt.Fprintf(w, "Usage: %s [flags] ...\n", os.Args[0]) + flag.CommandLine.SetOutput(w) + flag.CommandLine.PrintDefaults() + fmt.Fprintf(w, "\n%s", cmdSummary) +} + +var cmdSummary string // generated in init, below + +func init() { + var buf bytes.Buffer + tw := tabwriter.NewWriter(&buf, 10, 8, 4, '\t', 0) + for _, cmd := range commands { + fmt.Fprintf(tw, "cbt %s\t%s\n", cmd.Name, cmd.Desc) + } + tw.Flush() + buf.WriteString(configHelp) + buf.WriteString("\ncbt " + version + " " + revision + " " + revisionDate + "\n") + cmdSummary = buf.String() +} + +var configHelp = ` +Alpha features are not currently available to most Cloud Bigtable customers. The +features might be changed in backward-incompatible ways and are not recommended +for production use. They are not subject to any SLA or deprecation policy. + +Note: cbt does not support specifying arbitrary bytes on the command line for +any value that Bigtable otherwise supports (e.g., row key, column qualifier, +etc.). + +For convenience, values of the -project, -instance, -creds, +-admin-endpoint and -data-endpoint flags may be specified in +~/.cbtrc in this format: + + project = my-project-123 + instance = my-instance + creds = path-to-account-key.json + admin-endpoint = hostname:port + data-endpoint = hostname:port + +All values are optional, and all will be overridden by flags. +` + +var commands = []struct { + Name, Desc string + do func(context.Context, ...string) + Usage string + Required cbtconfig.RequiredFlags +}{ + { + Name: "count", + Desc: "Count rows in a table", + do: doCount, + Usage: "cbt count
", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "createinstance", + Desc: "Create an instance with an initial cluster", + do: doCreateInstance, + Usage: "cbt createinstance \n" + + " instance-id Permanent, unique id for the instance\n" + + " display-name Description of the instance\n" + + " cluster-id Permanent, unique id for the cluster in the instance\n" + + " zone The zone in which to create the cluster\n" + + " num-nodes The number of nodes to create\n" + + " storage-type SSD or HDD\n", + Required: cbtconfig.ProjectRequired, + }, + { + Name: "createcluster", + Desc: "Create a cluster in the configured instance ", + do: doCreateCluster, + Usage: "cbt createcluster \n" + + " cluster-id Permanent, unique id for the cluster in the instance\n" + + " zone The zone in which to create the cluster\n" + + " num-nodes The number of nodes to create\n" + + " storage-type SSD or HDD\n", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "createfamily", + Desc: "Create a column family", + do: doCreateFamily, + Usage: "cbt createfamily
", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "createtable", + Desc: "Create a table", + do: doCreateTable, + Usage: "cbt createtable
[families=family[:gcpolicy],...] [splits=split,...]\n" + + " families: Column families and their associated GC policies. For gcpolicy,\n" + + " see \"setgcpolicy\".\n" + + " Example: families=family1:maxage=1w,family2:maxversions=1\n" + + " splits: Row key to be used to initially split the table", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "updatecluster", + Desc: "Update a cluster in the configured instance", + do: doUpdateCluster, + Usage: "cbt updatecluster [num-nodes=num-nodes]\n" + + " cluster-id Permanent, unique id for the cluster in the instance\n" + + " num-nodes The number of nodes to update to", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "deleteinstance", + Desc: "Delete an instance", + do: doDeleteInstance, + Usage: "cbt deleteinstance ", + Required: cbtconfig.ProjectRequired, + }, + { + Name: "deletecluster", + Desc: "Delete a cluster from the configured instance ", + do: doDeleteCluster, + Usage: "cbt deletecluster ", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "deletecolumn", + Desc: "Delete all cells in a column", + do: doDeleteColumn, + Usage: "cbt deletecolumn
[app-profile=]\n" + + " app-profile= The app profile id to use for the request\n", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "deletefamily", + Desc: "Delete a column family", + do: doDeleteFamily, + Usage: "cbt deletefamily
", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "deleterow", + Desc: "Delete a row", + do: doDeleteRow, + Usage: "cbt deleterow
[app-profile=]\n" + + " app-profile= The app profile id to use for the request\n", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "deletetable", + Desc: "Delete a table", + do: doDeleteTable, + Usage: "cbt deletetable
", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "doc", + Desc: "Print godoc-suitable documentation for cbt", + do: doDoc, + Usage: "cbt doc", + Required: cbtconfig.NoneRequired, + }, + { + Name: "help", + Desc: "Print help text", + do: doHelp, + Usage: "cbt help [command]", + Required: cbtconfig.NoneRequired, + }, + { + Name: "listinstances", + Desc: "List instances in a project", + do: doListInstances, + Usage: "cbt listinstances", + Required: cbtconfig.ProjectRequired, + }, + { + Name: "listclusters", + Desc: "List clusters in an instance", + do: doListClusters, + Usage: "cbt listclusters", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "lookup", + Desc: "Read from a single row", + do: doLookup, + Usage: "cbt lookup
[columns=[family]:[qualifier],...] [cells-per-column=] " + + "[app-profile=]\n" + + " columns=[family]:[qualifier],... Read only these columns, comma-separated\n" + + " cells-per-column= Read only this many cells per column\n" + + " app-profile= The app profile id to use for the request\n", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "ls", + Desc: "List tables and column families", + do: doLS, + Usage: "cbt ls List tables\n" + + "cbt ls
List column families in
", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "mddoc", + Desc: "Print documentation for cbt in Markdown format", + do: doMDDoc, + Usage: "cbt mddoc", + Required: cbtconfig.NoneRequired, + }, + { + Name: "read", + Desc: "Read rows", + do: doRead, + Usage: "cbt read
[start=] [end=] [prefix=]" + + " [regex=] [columns=[family]:[qualifier],...] [count=] [cells-per-column=]" + + " [app-profile=]\n" + + " start= Start reading at this row\n" + + " end= Stop reading before this row\n" + + " prefix= Read rows with this prefix\n" + + " regex= Read rows with keys matching this regex\n" + + " columns=[family]:[qualifier],... Read only these columns, comma-separated\n" + + " count= Read only this many rows\n" + + " cells-per-column= Read only this many cells per column\n" + + " app-profile= The app profile id to use for the request\n", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "set", + Desc: "Set value of a cell", + do: doSet, + Usage: "cbt set
[app-profile=] family:column=val[@ts] ...\n" + + " app-profile= The app profile id to use for the request\n" + + " family:column=val[@ts] may be repeated to set multiple cells.\n" + + "\n" + + " ts is an optional integer timestamp.\n" + + " If it cannot be parsed, the `@ts` part will be\n" + + " interpreted as part of the value.", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "setgcpolicy", + Desc: "Set the GC policy for a column family", + do: doSetGCPolicy, + Usage: "cbt setgcpolicy
((maxage= | maxversions=) [(and|or) (maxage= | maxversions=),...] | never)\n" + + "\n" + + ` maxage= Maximum timestamp age to preserve (e.g. "1h", "4d")` + "\n" + + " maxversions= Maximum number of versions to preserve", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "waitforreplication", + Desc: "Block until all the completed writes have been replicated to all the clusters", + do: doWaitForReplicaiton, + Usage: "cbt waitforreplication
", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "createtablefromsnapshot", + Desc: "Create a table from a snapshot (snapshots alpha)", + do: doCreateTableFromSnapshot, + Usage: "cbt createtablefromsnapshot
\n" + + " table The name of the table to create\n" + + " cluster The cluster where the snapshot is located\n" + + " snapshot The snapshot to restore", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "createsnapshot", + Desc: "Create a snapshot from a source table (snapshots alpha)", + do: doSnapshotTable, + Usage: "cbt createsnapshot
[ttl=]\n" + + "\n" + + ` [ttl=] Lifespan of the snapshot (e.g. "1h", "4d")` + "\n", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "listsnapshots", + Desc: "List snapshots in a cluster (snapshots alpha)", + do: doListSnapshots, + Usage: "cbt listsnapshots []", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "getsnapshot", + Desc: "Get snapshot info (snapshots alpha)", + do: doGetSnapshot, + Usage: "cbt getsnapshot ", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "deletesnapshot", + Desc: "Delete snapshot in a cluster (snapshots alpha)", + do: doDeleteSnapshot, + Usage: "cbt deletesnapshot ", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "version", + Desc: "Print the current cbt version", + do: doVersion, + Usage: "cbt version", + Required: cbtconfig.NoneRequired, + }, + { + Name: "createappprofile", + Desc: "Creates app profile for an instance", + do: doCreateAppProfile, + Usage: "usage: cbt createappprofile " + + "(route-any | [ route-to= : transactional-writes]) [optional flag] \n" + + "optional flags may be `force`", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "getappprofile", + Desc: "Reads app profile for an instance", + do: doGetAppProfile, + Usage: "cbt getappprofile ", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "listappprofile", + Desc: "Lists app profile for an instance", + do: doListAppProfiles, + Usage: "cbt listappprofile ", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "updateappprofile", + Desc: "Updates app profile for an instance", + do: doUpdateAppProfile, + Usage: "usage: cbt updateappprofile " + + "(route-any | [ route-to= : transactional-writes]) [optional flag] \n" + + "optional flags may be `force`", + Required: cbtconfig.ProjectAndInstanceRequired, + }, + { + Name: "deleteappprofile", + Desc: "Deletes app profile for an instance", + do: doDeleteAppProfile, + Usage: "cbt deleteappprofile ", + Required: cbtconfig.ProjectAndInstanceRequired, + }, +} + +func doCount(ctx context.Context, args ...string) { + if len(args) != 1 { + log.Fatal("usage: cbt count
") + } + tbl := getClient(bigtable.ClientConfig{}).Open(args[0]) + + n := 0 + err := tbl.ReadRows(ctx, bigtable.InfiniteRange(""), func(_ bigtable.Row) bool { + n++ + return true + }, bigtable.RowFilter(bigtable.StripValueFilter())) + if err != nil { + log.Fatalf("Reading rows: %v", err) + } + fmt.Println(n) +} + +func doCreateTable(ctx context.Context, args ...string) { + if len(args) < 1 { + log.Fatal("usage: cbt createtable
[families=family[:gcpolicy],...] [splits=split,...]") + } + + tblConf := bigtable.TableConf{TableID: args[0]} + parsed, err := parseArgs(args[1:], []string{"families", "splits"}) + if err != nil { + log.Fatal(err) + } + for key, val := range parsed { + chunks, err := csv.NewReader(strings.NewReader(val)).Read() + if err != nil { + log.Fatalf("Invalid %s arg format: %v", key, err) + } + switch key { + case "families": + tblConf.Families = make(map[string]bigtable.GCPolicy) + for _, family := range chunks { + famPolicy := strings.Split(family, ":") + var gcPolicy bigtable.GCPolicy + if len(famPolicy) < 2 { + gcPolicy = bigtable.MaxVersionsPolicy(1) + log.Printf("Using default GC Policy of %v for family %v", gcPolicy, family) + } else { + gcPolicy, err = parseGCPolicy(famPolicy[1]) + if err != nil { + log.Fatal(err) + } + } + tblConf.Families[famPolicy[0]] = gcPolicy + } + case "splits": + tblConf.SplitKeys = chunks + } + } + + if err := getAdminClient().CreateTableFromConf(ctx, &tblConf); err != nil { + log.Fatalf("Creating table: %v", err) + } +} + +func doCreateFamily(ctx context.Context, args ...string) { + if len(args) != 2 { + log.Fatal("usage: cbt createfamily
") + } + err := getAdminClient().CreateColumnFamily(ctx, args[0], args[1]) + if err != nil { + log.Fatalf("Creating column family: %v", err) + } +} + +func doCreateInstance(ctx context.Context, args ...string) { + if len(args) < 6 { + log.Fatal("cbt createinstance ") + } + + numNodes, err := strconv.ParseInt(args[4], 0, 32) + if err != nil { + log.Fatalf("Bad num-nodes %q: %v", args[4], err) + } + + sType, err := parseStorageType(args[5]) + if err != nil { + log.Fatal(err) + } + + ic := bigtable.InstanceWithClustersConfig{ + InstanceID: args[0], + DisplayName: args[1], + Clusters: []bigtable.ClusterConfig{{ + ClusterID: args[2], + Zone: args[3], + NumNodes: int32(numNodes), + StorageType: sType, + }}, + } + err = getInstanceAdminClient().CreateInstanceWithClusters(ctx, &ic) + if err != nil { + log.Fatalf("Creating instance: %v", err) + } +} + +func doCreateCluster(ctx context.Context, args ...string) { + if len(args) < 4 { + log.Fatal("usage: cbt createcluster ") + } + + numNodes, err := strconv.ParseInt(args[2], 0, 32) + if err != nil { + log.Fatalf("Bad num_nodes %q: %v", args[2], err) + } + + sType, err := parseStorageType(args[3]) + if err != nil { + log.Fatal(err) + } + + cc := bigtable.ClusterConfig{ + InstanceID: config.Instance, + ClusterID: args[0], + Zone: args[1], + NumNodes: int32(numNodes), + StorageType: sType, + } + err = getInstanceAdminClient().CreateCluster(ctx, &cc) + if err != nil { + log.Fatalf("Creating cluster: %v", err) + } +} + +func doUpdateCluster(ctx context.Context, args ...string) { + if len(args) < 2 { + log.Fatal("cbt updatecluster [num-nodes=num-nodes]") + } + + numNodes := int64(0) + parsed, err := parseArgs(args[1:], []string{"num-nodes"}) + if err != nil { + log.Fatal(err) + } + if val, ok := parsed["num-nodes"]; ok { + numNodes, err = strconv.ParseInt(val, 0, 32) + if err != nil { + log.Fatalf("Bad num-nodes %q: %v", val, err) + } + } + if numNodes > 0 { + err = getInstanceAdminClient().UpdateCluster(ctx, config.Instance, args[0], int32(numNodes)) + if err != nil { + log.Fatalf("Updating cluster: %v", err) + } + } else { + log.Fatal("Updating cluster: nothing to update") + } +} + +func doDeleteInstance(ctx context.Context, args ...string) { + if len(args) != 1 { + log.Fatal("usage: cbt deleteinstance ") + } + err := getInstanceAdminClient().DeleteInstance(ctx, args[0]) + if err != nil { + log.Fatalf("Deleting instance: %v", err) + } +} + +func doDeleteCluster(ctx context.Context, args ...string) { + if len(args) != 1 { + log.Fatal("usage: cbt deletecluster ") + } + err := getInstanceAdminClient().DeleteCluster(ctx, config.Instance, args[0]) + if err != nil { + log.Fatalf("Deleting cluster: %v", err) + } +} + +func doDeleteColumn(ctx context.Context, args ...string) { + usage := "usage: cbt deletecolumn
[app-profile=]" + if len(args) != 4 && len(args) != 5 { + log.Fatal(usage) + } + var appProfile string + if len(args) == 5 { + if !strings.HasPrefix(args[4], "app-profile=") { + log.Fatal(usage) + } + appProfile = strings.Split(args[4], "=")[1] + } + tbl := getClient(bigtable.ClientConfig{AppProfile: appProfile}).Open(args[0]) + mut := bigtable.NewMutation() + mut.DeleteCellsInColumn(args[2], args[3]) + if err := tbl.Apply(ctx, args[1], mut); err != nil { + log.Fatalf("Deleting cells in column: %v", err) + } +} + +func doDeleteFamily(ctx context.Context, args ...string) { + if len(args) != 2 { + log.Fatal("usage: cbt deletefamily
") + } + err := getAdminClient().DeleteColumnFamily(ctx, args[0], args[1]) + if err != nil { + log.Fatalf("Deleting column family: %v", err) + } +} + +func doDeleteRow(ctx context.Context, args ...string) { + usage := "usage: cbt deleterow
[app-profile=]" + if len(args) != 2 && len(args) != 3 { + log.Fatal(usage) + } + var appProfile string + if len(args) == 3 { + if !strings.HasPrefix(args[2], "app-profile=") { + log.Fatal(usage) + } + appProfile = strings.Split(args[2], "=")[1] + } + tbl := getClient(bigtable.ClientConfig{AppProfile: appProfile}).Open(args[0]) + mut := bigtable.NewMutation() + mut.DeleteRow() + if err := tbl.Apply(ctx, args[1], mut); err != nil { + log.Fatalf("Deleting row: %v", err) + } +} + +func doDeleteTable(ctx context.Context, args ...string) { + if len(args) != 1 { + log.Fatalf("Can't do `cbt deletetable %s`", args) + } + err := getAdminClient().DeleteTable(ctx, args[0]) + if err != nil { + log.Fatalf("Deleting table: %v", err) + } +} + +// to break circular dependencies +var ( + doDocFn func(ctx context.Context, args ...string) + doHelpFn func(ctx context.Context, args ...string) + doMDDocFn func(ctx context.Context, args ...string) +) + +func init() { + doDocFn = doDocReal + doHelpFn = doHelpReal + doMDDocFn = doMDDocReal +} + +func doDoc(ctx context.Context, args ...string) { doDocFn(ctx, args...) } +func doHelp(ctx context.Context, args ...string) { doHelpFn(ctx, args...) } +func doMDDoc(ctx context.Context, args ...string) { doMDDocFn(ctx, args...) } + +func docFlags() []*flag.Flag { + // Only include specific flags, in a specific order. + var flags []*flag.Flag + for _, name := range []string{"project", "instance", "creds"} { + f := flag.Lookup(name) + if f == nil { + log.Fatalf("Flag not linked: -%s", name) + } + flags = append(flags, f) + } + return flags +} + +func doDocReal(ctx context.Context, args ...string) { + data := map[string]interface{}{ + "Commands": commands, + "Flags": docFlags(), + "ConfigHelp": configHelp, + } + var buf bytes.Buffer + if err := docTemplate.Execute(&buf, data); err != nil { + log.Fatalf("Bad doc template: %v", err) + } + out, err := format.Source(buf.Bytes()) + if err != nil { + log.Fatalf("Bad doc output: %v", err) + } + os.Stdout.Write(out) +} + +func indentLines(s, ind string) string { + ss := strings.Split(s, "\n") + for i, p := range ss { + ss[i] = ind + p + } + return strings.Join(ss, "\n") +} + +var docTemplate = template.Must(template.New("doc").Funcs(template.FuncMap{ + "indent": indentLines, +}). + Parse(` +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// DO NOT EDIT. THIS IS AUTOMATICALLY GENERATED. +// Run "go generate" to regenerate. +//go:generate go run cbt.go gcpolicy.go -o cbtdoc.go doc + +/* +Cbt is a tool for doing basic interactions with Cloud Bigtable. To learn how to +install the cbt tool, see the +[cbt overview](https://cloud.google.com/bigtable/docs/cbt-overview). + +Usage: + + cbt [options] command [arguments] + +The commands are: +{{range .Commands}} + {{printf "%-25s %s" .Name .Desc}}{{end}} + +Use "cbt help " for more information about a command. + +The options are: +{{range .Flags}} + -{{.Name}} string + {{.Usage}}{{end}} + +{{.ConfigHelp}} + +{{range .Commands}} +{{.Desc}} + +Usage: +{{indent .Usage "\t"}} + + + +{{end}} +*/ +package main +`)) + +func doHelpReal(ctx context.Context, args ...string) { + if len(args) == 0 { + usage(os.Stdout) + return + } + for _, cmd := range commands { + if cmd.Name == args[0] { + fmt.Println(cmd.Usage) + return + } + } + log.Fatalf("Don't know command %q", args[0]) +} + +func doListInstances(ctx context.Context, args ...string) { + if len(args) != 0 { + log.Fatalf("usage: cbt listinstances") + } + is, err := getInstanceAdminClient().Instances(ctx) + if err != nil { + log.Fatalf("Getting list of instances: %v", err) + } + tw := tabwriter.NewWriter(os.Stdout, 10, 8, 4, '\t', 0) + fmt.Fprintf(tw, "Instance Name\tInfo\n") + fmt.Fprintf(tw, "-------------\t----\n") + for _, i := range is { + fmt.Fprintf(tw, "%s\t%s\n", i.Name, i.DisplayName) + } + tw.Flush() +} + +func doListClusters(ctx context.Context, args ...string) { + if len(args) != 0 { + log.Fatalf("usage: cbt listclusters") + } + cis, err := getInstanceAdminClient().Clusters(ctx, config.Instance) + if err != nil { + log.Fatalf("Getting list of clusters: %v", err) + } + tw := tabwriter.NewWriter(os.Stdout, 10, 8, 4, '\t', 0) + fmt.Fprintf(tw, "Cluster Name\tZone\tState\n") + fmt.Fprintf(tw, "------------\t----\t----\n") + for _, ci := range cis { + fmt.Fprintf(tw, "%s\t%s\t%s (%d serve nodes)\n", ci.Name, ci.Zone, ci.State, ci.ServeNodes) + } + tw.Flush() +} + +func doLookup(ctx context.Context, args ...string) { + if len(args) < 2 { + log.Fatalf("usage: cbt lookup
[columns=...] [cells-per-column=] " + + "[app-profile=]") + } + + parsed, err := parseArgs(args[2:], []string{"columns", "cells-per-column", "app-profile"}) + if err != nil { + log.Fatal(err) + } + var opts []bigtable.ReadOption + var filters []bigtable.Filter + if cellsPerColumn := parsed["cells-per-column"]; cellsPerColumn != "" { + n, err := strconv.Atoi(cellsPerColumn) + if err != nil { + log.Fatalf("Bad number of cells per column %q: %v", cellsPerColumn, err) + } + filters = append(filters, bigtable.LatestNFilter(n)) + } + if columns := parsed["columns"]; columns != "" { + columnFilters, err := parseColumnsFilter(columns) + if err != nil { + log.Fatal(err) + } + filters = append(filters, columnFilters) + } + + if len(filters) > 1 { + opts = append(opts, bigtable.RowFilter(bigtable.ChainFilters(filters...))) + } else if len(filters) == 1 { + opts = append(opts, bigtable.RowFilter(filters[0])) + } + + table, row := args[0], args[1] + tbl := getClient(bigtable.ClientConfig{AppProfile: parsed["app-profile"]}).Open(table) + r, err := tbl.ReadRow(ctx, row, opts...) + if err != nil { + log.Fatalf("Reading row: %v", err) + } + printRow(r) +} + +func printRow(r bigtable.Row) { + fmt.Println(strings.Repeat("-", 40)) + fmt.Println(r.Key()) + + var fams []string + for fam := range r { + fams = append(fams, fam) + } + sort.Strings(fams) + for _, fam := range fams { + ris := r[fam] + sort.Sort(byColumn(ris)) + for _, ri := range ris { + ts := time.Unix(0, int64(ri.Timestamp)*1e3) + fmt.Printf(" %-40s @ %s\n", ri.Column, ts.Format("2006/01/02-15:04:05.000000")) + fmt.Printf(" %q\n", ri.Value) + } + } +} + +type byColumn []bigtable.ReadItem + +func (b byColumn) Len() int { return len(b) } +func (b byColumn) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byColumn) Less(i, j int) bool { return b[i].Column < b[j].Column } + +type byFamilyName []bigtable.FamilyInfo + +func (b byFamilyName) Len() int { return len(b) } +func (b byFamilyName) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byFamilyName) Less(i, j int) bool { return b[i].Name < b[j].Name } + +func doLS(ctx context.Context, args ...string) { + switch len(args) { + default: + log.Fatalf("Can't do `cbt ls %s`", args) + case 0: + tables, err := getAdminClient().Tables(ctx) + if err != nil { + log.Fatalf("Getting list of tables: %v", err) + } + sort.Strings(tables) + for _, table := range tables { + fmt.Println(table) + } + case 1: + table := args[0] + ti, err := getAdminClient().TableInfo(ctx, table) + if err != nil { + log.Fatalf("Getting table info: %v", err) + } + sort.Sort(byFamilyName(ti.FamilyInfos)) + tw := tabwriter.NewWriter(os.Stdout, 10, 8, 4, '\t', 0) + fmt.Fprintf(tw, "Family Name\tGC Policy\n") + fmt.Fprintf(tw, "-----------\t---------\n") + for _, fam := range ti.FamilyInfos { + fmt.Fprintf(tw, "%s\t%s\n", fam.Name, fam.GCPolicy) + } + tw.Flush() + } +} + +func doMDDocReal(ctx context.Context, args ...string) { + data := map[string]interface{}{ + "Commands": commands, + "Flags": docFlags(), + "ConfigHelp": configHelp, + } + var buf bytes.Buffer + if err := mddocTemplate.Execute(&buf, data); err != nil { + log.Fatalf("Bad mddoc template: %v", err) + } + io.Copy(os.Stdout, &buf) +} + +var mddocTemplate = template.Must(template.New("mddoc").Funcs(template.FuncMap{ + "indent": indentLines, +}). + Parse(` +Cbt is a tool for doing basic interactions with Cloud Bigtable. To learn how to +install the cbt tool, see the +[cbt overview](https://cloud.google.com/bigtable/docs/cbt-overview). + +Usage: + + cbt [options] command [arguments] + +The commands are: +{{range .Commands}} + {{printf "%-25s %s" .Name .Desc}}{{end}} + +Use "cbt help " for more information about a command. + +The options are: +{{range .Flags}} + -{{.Name}} string + {{.Usage}}{{end}} + +{{.ConfigHelp}} + +{{range .Commands}} +## {{.Desc}} + +{{indent .Usage "\t"}} + + + +{{end}} +`)) + +func doRead(ctx context.Context, args ...string) { + if len(args) < 1 { + log.Fatalf("usage: cbt read
[args ...]") + } + + parsed, err := parseArgs(args[1:], []string{ + "start", "end", "prefix", "columns", "count", "cells-per-column", "regex", "app-profile", "limit", + }) + if err != nil { + log.Fatal(err) + } + if _, ok := parsed["limit"]; ok { + // Be nicer; we used to support this, but renamed it to "end". + log.Fatal("Unknown arg key 'limit'; did you mean 'end'?") + } + if (parsed["start"] != "" || parsed["end"] != "") && parsed["prefix"] != "" { + log.Fatal(`"start"/"end" may not be mixed with "prefix"`) + } + + var rr bigtable.RowRange + if start, end := parsed["start"], parsed["end"]; end != "" { + rr = bigtable.NewRange(start, end) + } else if start != "" { + rr = bigtable.InfiniteRange(start) + } + if prefix := parsed["prefix"]; prefix != "" { + rr = bigtable.PrefixRange(prefix) + } + + var opts []bigtable.ReadOption + if count := parsed["count"]; count != "" { + n, err := strconv.ParseInt(count, 0, 64) + if err != nil { + log.Fatalf("Bad count %q: %v", count, err) + } + opts = append(opts, bigtable.LimitRows(n)) + } + + var filters []bigtable.Filter + if cellsPerColumn := parsed["cells-per-column"]; cellsPerColumn != "" { + n, err := strconv.Atoi(cellsPerColumn) + if err != nil { + log.Fatalf("Bad number of cells per column %q: %v", cellsPerColumn, err) + } + filters = append(filters, bigtable.LatestNFilter(n)) + } + if regex := parsed["regex"]; regex != "" { + filters = append(filters, bigtable.RowKeyFilter(regex)) + } + if columns := parsed["columns"]; columns != "" { + columnFilters, err := parseColumnsFilter(columns) + if err != nil { + log.Fatal(err) + } + filters = append(filters, columnFilters) + } + + if len(filters) > 1 { + opts = append(opts, bigtable.RowFilter(bigtable.ChainFilters(filters...))) + } else if len(filters) == 1 { + opts = append(opts, bigtable.RowFilter(filters[0])) + } + + // TODO(dsymonds): Support filters. + tbl := getClient(bigtable.ClientConfig{AppProfile: parsed["app-profile"]}).Open(args[0]) + err = tbl.ReadRows(ctx, rr, func(r bigtable.Row) bool { + printRow(r) + return true + }, opts...) + if err != nil { + log.Fatalf("Reading rows: %v", err) + } +} + +var setArg = regexp.MustCompile(`([^:]+):([^=]*)=(.*)`) + +func doSet(ctx context.Context, args ...string) { + if len(args) < 3 { + log.Fatalf("usage: cbt set
[app-profile=] family:[column]=val[@ts] ...") + } + var appProfile string + row := args[1] + mut := bigtable.NewMutation() + for _, arg := range args[2:] { + if strings.HasPrefix(arg, "app-profile=") { + appProfile = strings.Split(arg, "=")[1] + continue + } + m := setArg.FindStringSubmatch(arg) + if m == nil { + log.Fatalf("Bad set arg %q", arg) + } + val := m[3] + ts := bigtable.Now() + if i := strings.LastIndex(val, "@"); i >= 0 { + // Try parsing a timestamp. + n, err := strconv.ParseInt(val[i+1:], 0, 64) + if err == nil { + val = val[:i] + ts = bigtable.Timestamp(n) + } + } + mut.Set(m[1], m[2], ts, []byte(val)) + } + tbl := getClient(bigtable.ClientConfig{AppProfile: appProfile}).Open(args[0]) + if err := tbl.Apply(ctx, row, mut); err != nil { + log.Fatalf("Applying mutation: %v", err) + } +} + +func doSetGCPolicy(ctx context.Context, args ...string) { + if len(args) < 3 { + log.Fatalf("usage: cbt setgcpolicy
((maxage= | maxversions=) [(and|or) (maxage= | maxversions=),...] | never)") + } + table := args[0] + fam := args[1] + pol, err := parseGCPolicy(strings.Join(args[2:], " ")) + if err != nil { + log.Fatal(err) + } + if err := getAdminClient().SetGCPolicy(ctx, table, fam, pol); err != nil { + log.Fatalf("Setting GC policy: %v", err) + } +} + +func doWaitForReplicaiton(ctx context.Context, args ...string) { + if len(args) != 1 { + log.Fatalf("usage: cbt waitforreplication
") + } + table := args[0] + + fmt.Printf("Waiting for all writes up to %s to be replicated.\n", time.Now().Format("2006/01/02-15:04:05")) + if err := getAdminClient().WaitForReplication(ctx, table); err != nil { + log.Fatalf("Waiting for replication: %v", err) + } +} + +func parseStorageType(storageTypeStr string) (bigtable.StorageType, error) { + switch storageTypeStr { + case "SSD": + return bigtable.SSD, nil + case "HDD": + return bigtable.HDD, nil + } + return -1, fmt.Errorf("Invalid storage type: %v, must be SSD or HDD", storageTypeStr) +} + +func doCreateTableFromSnapshot(ctx context.Context, args ...string) { + if len(args) != 3 { + log.Fatal("usage: cbt createtablefromsnapshot
") + } + tableName := args[0] + clusterName := args[1] + snapshotName := args[2] + err := getAdminClient().CreateTableFromSnapshot(ctx, tableName, clusterName, snapshotName) + + if err != nil { + log.Fatalf("Creating table: %v", err) + } +} + +func doSnapshotTable(ctx context.Context, args ...string) { + if len(args) != 3 && len(args) != 4 { + log.Fatal("usage: cbt createsnapshot
[ttl=]") + } + clusterName := args[0] + snapshotName := args[1] + tableName := args[2] + ttl := bigtable.DefaultSnapshotDuration + + parsed, err := parseArgs(args[3:], []string{"ttl"}) + if err != nil { + log.Fatal(err) + } + if val, ok := parsed["ttl"]; ok { + var err error + ttl, err = parseDuration(val) + if err != nil { + log.Fatalf("Invalid snapshot ttl value %q: %v", val, err) + } + } + + err = getAdminClient().SnapshotTable(ctx, tableName, clusterName, snapshotName, ttl) + if err != nil { + log.Fatalf("Failed to create Snapshot: %v", err) + } +} + +func doListSnapshots(ctx context.Context, args ...string) { + if len(args) != 0 && len(args) != 1 { + log.Fatal("usage: cbt listsnapshots []") + } + + var cluster string + + if len(args) == 0 { + cluster = "-" + } else { + cluster = args[0] + } + + it := getAdminClient().Snapshots(ctx, cluster) + + tw := tabwriter.NewWriter(os.Stdout, 10, 8, 4, '\t', 0) + fmt.Fprintf(tw, "Snapshot\tSource Table\tCreated At\tExpires At\n") + fmt.Fprintf(tw, "--------\t------------\t----------\t----------\n") + timeLayout := "2006-01-02 15:04 MST" + + for { + snapshot, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + log.Fatalf("Failed to fetch snapshots %v", err) + } + fmt.Fprintf(tw, "%s\t%s\t%s\t%s\n", snapshot.Name, snapshot.SourceTable, snapshot.CreateTime.Format(timeLayout), snapshot.DeleteTime.Format(timeLayout)) + } + tw.Flush() +} + +func doGetSnapshot(ctx context.Context, args ...string) { + if len(args) != 2 { + log.Fatalf("usage: cbt getsnapshot ") + } + clusterName := args[0] + snapshotName := args[1] + + snapshot, err := getAdminClient().SnapshotInfo(ctx, clusterName, snapshotName) + if err != nil { + log.Fatalf("Failed to get snapshot: %v", err) + } + + timeLayout := "2006-01-02 15:04 MST" + + fmt.Printf("Name: %s\n", snapshot.Name) + fmt.Printf("Source table: %s\n", snapshot.SourceTable) + fmt.Printf("Created at: %s\n", snapshot.CreateTime.Format(timeLayout)) + fmt.Printf("Expires at: %s\n", snapshot.DeleteTime.Format(timeLayout)) +} + +func doDeleteSnapshot(ctx context.Context, args ...string) { + if len(args) != 2 { + log.Fatal("usage: cbt deletesnapshot ") + } + cluster := args[0] + snapshot := args[1] + + err := getAdminClient().DeleteSnapshot(ctx, cluster, snapshot) + + if err != nil { + log.Fatalf("Failed to delete snapshot: %v", err) + } +} + +func doCreateAppProfile(ctx context.Context, args ...string) { + if len(args) < 4 || len(args) > 6 { + log.Fatal("usage: cbt createappprofile " + + " (route-any | [ route-to= : transactional-writes]) [optional flag] \n" + + "optional flags may be `force`") + } + + routingPolicy, clusterID, err := parseProfileRoute(args[3]) + if err != nil { + log.Fatalln("Exactly one of (route-any | [route-to : transactional-writes]) must be specified.") + } + + config := bigtable.ProfileConf{ + RoutingPolicy: routingPolicy, + InstanceID: args[0], + ProfileID: args[1], + Description: args[2], + } + + opFlags := []string{"force", "transactional-writes"} + parseValues, err := parseArgs(args[4:], opFlags) + if err != nil { + log.Fatalf("optional flags can be specified as (force=|transactional-writes=) got %s ", args[4:]) + } + + for _, f := range opFlags { + fv, err := parseProfileOpts(f, parseValues) + if err != nil { + log.Fatalf("optional flags can be specified as (force=|transactional-writes=) got %s ", args[4:]) + } + + switch f { + case opFlags[0]: + config.IgnoreWarnings = fv + case opFlags[1]: + config.AllowTransactionalWrites = fv + default: + + } + } + + if routingPolicy == bigtable.SingleClusterRouting { + config.ClusterID = clusterID + } + + profile, err := getInstanceAdminClient().CreateAppProfile(ctx, config) + if err != nil { + log.Fatalf("Failed to create app profile : %v", err) + } + + fmt.Printf("Name: %s\n", profile.Name) + fmt.Printf("RoutingPolicy: %v\n", profile.RoutingPolicy) +} + +func doGetAppProfile(ctx context.Context, args ...string) { + if len(args) != 2 { + log.Fatalln("usage: cbt getappprofile ") + } + + instanceID := args[0] + profileID := args[1] + profile, err := getInstanceAdminClient().GetAppProfile(ctx, instanceID, profileID) + if err != nil { + log.Fatalf("Failed to get app profile : %v", err) + } + + fmt.Printf("Name: %s\n", profile.Name) + fmt.Printf("Etag: %s\n", profile.Etag) + fmt.Printf("Description: %s\n", profile.Description) + fmt.Printf("RoutingPolicy: %v\n", profile.RoutingPolicy) +} + +func doListAppProfiles(ctx context.Context, args ...string) { + if len(args) != 1 { + log.Fatalln("usage: cbt listappprofile ") + } + + instance := args[0] + + it := getInstanceAdminClient().ListAppProfiles(ctx, instance) + + tw := tabwriter.NewWriter(os.Stdout, 10, 8, 4, '\t', 0) + fmt.Fprintf(tw, "AppProfile\tProfile Description\tProfile Etag\tProfile Routing Policy\n") + fmt.Fprintf(tw, "-----------\t--------------------\t------------\t----------------------\n") + + for { + profile, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + log.Fatalf("Failed to fetch app profile %v", err) + } + fmt.Fprintf(tw, "%s\t%s\t%s\t%s\n", profile.Name, profile.Description, profile.Etag, profile.RoutingPolicy) + } + tw.Flush() +} + +func doUpdateAppProfile(ctx context.Context, args ...string) { + + if len(args) < 4 { + log.Fatal("usage: cbt updateappprofile " + + " (route-any | [ route-to= : transactional-writes]) [optional flag] \n" + + "optional flags may be `force`") + } + + routingPolicy, clusterID, err := parseProfileRoute(args[3]) + if err != nil { + log.Fatalln("Exactly one of (route-any | [route-to : transactional-writes]) must be specified.") + } + InstanceID := args[0] + ProfileID := args[1] + config := bigtable.ProfileAttrsToUpdate{ + RoutingPolicy: routingPolicy, + Description: args[2], + } + opFlags := []string{"force", "transactional-writes"} + parseValues, err := parseArgs(args[4:], opFlags) + if err != nil { + log.Fatalf("optional flags can be specified as (force=|transactional-writes=) got %s ", args[4:]) + } + + for _, f := range opFlags { + fv, err := parseProfileOpts(f, parseValues) + if err != nil { + log.Fatalf("optional flags can be specified as (force=|transactional-writes=) got %s ", args[4:]) + } + + switch f { + case opFlags[0]: + config.IgnoreWarnings = fv + case opFlags[1]: + config.AllowTransactionalWrites = fv + default: + + } + } + if routingPolicy == bigtable.SingleClusterRouting { + config.ClusterID = clusterID + } + + err = getInstanceAdminClient().UpdateAppProfile(ctx, InstanceID, ProfileID, config) + if err != nil { + log.Fatalf("Failed to update app profile : %v", err) + } +} + +func doDeleteAppProfile(ctx context.Context, args ...string) { + if len(args) != 2 { + log.Println("usage: cbt deleteappprofile ") + } + + err := getInstanceAdminClient().DeleteAppProfile(ctx, args[0], args[1]) + if err != nil { + log.Fatalf("Failed to delete app profile : %v", err) + } +} + +// parseDuration parses a duration string. +// It is similar to Go's time.ParseDuration, except with a different set of supported units, +// and only simple formats supported. +func parseDuration(s string) (time.Duration, error) { + // [0-9]+[a-z]+ + + // Split [0-9]+ from [a-z]+. + i := 0 + for ; i < len(s); i++ { + c := s[i] + if c < '0' || c > '9' { + break + } + } + ds, u := s[:i], s[i:] + if ds == "" || u == "" { + return 0, fmt.Errorf("invalid duration %q", s) + } + // Parse them. + d, err := strconv.ParseUint(ds, 10, 32) + if err != nil { + return 0, fmt.Errorf("invalid duration %q: %v", s, err) + } + unit, ok := unitMap[u] + if !ok { + return 0, fmt.Errorf("unknown unit %q in duration %q", u, s) + } + if d > uint64((1<<63-1)/unit) { + // overflow + return 0, fmt.Errorf("invalid duration %q overflows", s) + } + return time.Duration(d) * unit, nil +} + +var unitMap = map[string]time.Duration{ + "ms": time.Millisecond, + "s": time.Second, + "m": time.Minute, + "h": time.Hour, + "d": 24 * time.Hour, +} + +func doVersion(ctx context.Context, args ...string) { + fmt.Printf("%s %s %s\n", version, revision, revisionDate) +} + +// parseArgs takes a slice of arguments of the form key=value and returns a map from +// key to value. It returns an error if an argument is malformed or a key is not in +// the valid slice. +func parseArgs(args []string, valid []string) (map[string]string, error) { + parsed := make(map[string]string) + for _, arg := range args { + i := strings.Index(arg, "=") + if i < 0 { + return nil, fmt.Errorf("Bad arg %q", arg) + } + key, val := arg[:i], arg[i+1:] + if !stringInSlice(key, valid) { + return nil, fmt.Errorf("Unknown arg key %q", key) + } + parsed[key] = val + } + return parsed, nil +} + +func stringInSlice(s string, list []string) bool { + for _, e := range list { + if s == e { + return true + } + } + return false +} + +func parseColumnsFilter(columns string) (bigtable.Filter, error) { + splitColumns := strings.FieldsFunc(columns, func(c rune) bool { return c == ',' }) + if len(splitColumns) == 1 { + filter, err := columnFilter(splitColumns[0]) + if err != nil { + return nil, err + } + return filter, nil + } + + var columnFilters []bigtable.Filter + for _, column := range splitColumns { + filter, err := columnFilter(column) + if err != nil { + return nil, err + } + columnFilters = append(columnFilters, filter) + } + return bigtable.InterleaveFilters(columnFilters...), nil +} + +func columnFilter(column string) (bigtable.Filter, error) { + splitColumn := strings.Split(column, ":") + if len(splitColumn) == 1 { + return bigtable.ColumnFilter(splitColumn[0]), nil + } else if len(splitColumn) == 2 { + if strings.HasSuffix(column, ":") { + return bigtable.FamilyFilter(splitColumn[0]), nil + } else if strings.HasPrefix(column, ":") { + return bigtable.ColumnFilter(splitColumn[1]), nil + } else { + familyFilter := bigtable.FamilyFilter(splitColumn[0]) + qualifierFilter := bigtable.ColumnFilter(splitColumn[1]) + return bigtable.ChainFilters(familyFilter, qualifierFilter), nil + } + } else { + return nil, fmt.Errorf("Bad format for column %q", column) + } +} + +func parseProfileRoute(str string) (routingPolicy, clusterID string, err error) { + + route := strings.Split(str, "=") + switch route[0] { + case "route-any": + if len(route) > 1 { + err = fmt.Errorf("got %v", route) + break + } + routingPolicy = bigtable.MultiClusterRouting + + case "route-to": + if len(route) != 2 || route[1] == "" { + err = fmt.Errorf("got %v", route) + break + } + routingPolicy = bigtable.SingleClusterRouting + clusterID = route[1] + default: + err = fmt.Errorf("got %v", route) + } + + return +} + +func parseProfileOpts(opt string, parsedArgs map[string]string) (bool, error) { + + if val, ok := parsedArgs[opt]; ok { + status, err := strconv.ParseBool(val) + if err != nil { + return false, fmt.Errorf("expected %s = got %s ", opt, val) + } + + return status, nil + } + return false, nil +} diff --git a/vendor/cloud.google.com/go/bigtable/cmd/cbt/cbt_test.go b/vendor/cloud.google.com/go/bigtable/cmd/cbt/cbt_test.go new file mode 100644 index 000000000..e7c6ea2ce --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/cmd/cbt/cbt_test.go @@ -0,0 +1,173 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "testing" + "time" + + "cloud.google.com/go/bigtable" + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" +) + +func TestParseDuration(t *testing.T) { + tests := []struct { + in string + // out or fail are mutually exclusive + out time.Duration + fail bool + }{ + {in: "10ms", out: 10 * time.Millisecond}, + {in: "3s", out: 3 * time.Second}, + {in: "60m", out: 60 * time.Minute}, + {in: "12h", out: 12 * time.Hour}, + {in: "7d", out: 168 * time.Hour}, + + {in: "", fail: true}, + {in: "0", fail: true}, + {in: "7ns", fail: true}, + {in: "14mo", fail: true}, + {in: "3.5h", fail: true}, + {in: "106752d", fail: true}, // overflow + } + for _, tc := range tests { + got, err := parseDuration(tc.in) + if !tc.fail && err != nil { + t.Errorf("parseDuration(%q) unexpectedly failed: %v", tc.in, err) + continue + } + if tc.fail && err == nil { + t.Errorf("parseDuration(%q) did not fail", tc.in) + continue + } + if tc.fail { + continue + } + if got != tc.out { + t.Errorf("parseDuration(%q) = %v, want %v", tc.in, got, tc.out) + } + } +} + +func TestParseArgs(t *testing.T) { + got, err := parseArgs([]string{"a=1", "b=2"}, []string{"a", "b"}) + if err != nil { + t.Fatal(err) + } + want := map[string]string{"a": "1", "b": "2"} + if !testutil.Equal(got, want) { + t.Fatalf("got %v, want %v", got, want) + } + + if _, err := parseArgs([]string{"a1"}, []string{"a1"}); err == nil { + t.Error("malformed: got nil, want error") + } + if _, err := parseArgs([]string{"a=1"}, []string{"b"}); err == nil { + t.Error("invalid: got nil, want error") + } +} + +func TestParseColumnsFilter(t *testing.T) { + tests := []struct { + in string + out bigtable.Filter + fail bool + }{ + { + in: "columnA", + out: bigtable.ColumnFilter("columnA"), + }, + { + in: "familyA:columnA", + out: bigtable.ChainFilters(bigtable.FamilyFilter("familyA"), bigtable.ColumnFilter("columnA")), + }, + { + in: "columnA,columnB", + out: bigtable.InterleaveFilters(bigtable.ColumnFilter("columnA"), bigtable.ColumnFilter("columnB")), + }, + { + in: "familyA:columnA,columnB", + out: bigtable.InterleaveFilters( + bigtable.ChainFilters(bigtable.FamilyFilter("familyA"), bigtable.ColumnFilter("columnA")), + bigtable.ColumnFilter("columnB"), + ), + }, + { + in: "columnA,familyB:columnB", + out: bigtable.InterleaveFilters( + bigtable.ColumnFilter("columnA"), + bigtable.ChainFilters(bigtable.FamilyFilter("familyB"), bigtable.ColumnFilter("columnB")), + ), + }, + { + in: "familyA:columnA,familyB:columnB", + out: bigtable.InterleaveFilters( + bigtable.ChainFilters(bigtable.FamilyFilter("familyA"), bigtable.ColumnFilter("columnA")), + bigtable.ChainFilters(bigtable.FamilyFilter("familyB"), bigtable.ColumnFilter("columnB")), + ), + }, + { + in: "familyA:", + out: bigtable.FamilyFilter("familyA"), + }, + { + in: ":columnA", + out: bigtable.ColumnFilter("columnA"), + }, + { + in: ",:columnA,,familyB:columnB,", + out: bigtable.InterleaveFilters( + bigtable.ColumnFilter("columnA"), + bigtable.ChainFilters(bigtable.FamilyFilter("familyB"), bigtable.ColumnFilter("columnB")), + ), + }, + { + in: "familyA:columnA:cellA", + fail: true, + }, + { + in: "familyA::columnA", + fail: true, + }, + } + + for _, tc := range tests { + got, err := parseColumnsFilter(tc.in) + + if !tc.fail && err != nil { + t.Errorf("parseColumnsFilter(%q) unexpectedly failed: %v", tc.in, err) + continue + } + if tc.fail && err == nil { + t.Errorf("parseColumnsFilter(%q) did not fail", tc.in) + continue + } + if tc.fail { + continue + } + + var cmpOpts cmp.Options + cmpOpts = + append( + cmpOpts, + cmp.AllowUnexported(bigtable.ChainFilters([]bigtable.Filter{}...)), + cmp.AllowUnexported(bigtable.InterleaveFilters([]bigtable.Filter{}...))) + + if !cmp.Equal(got, tc.out, cmpOpts) { + t.Errorf("parseColumnsFilter(%q) = %v, want %v", tc.in, got, tc.out) + } + } +} diff --git a/vendor/cloud.google.com/go/bigtable/cmd/cbt/cbtdoc.go b/vendor/cloud.google.com/go/bigtable/cmd/cbt/cbtdoc.go new file mode 100644 index 000000000..2c91a1af7 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/cmd/cbt/cbtdoc.go @@ -0,0 +1,425 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// DO NOT EDIT. THIS IS AUTOMATICALLY GENERATED. +// Run "go generate" to regenerate. +//go:generate go run cbt.go gcpolicy.go -o cbtdoc.go doc + +/* +Cbt is a tool for doing basic interactions with Cloud Bigtable. To learn how to +install the cbt tool, see the +[cbt overview](https://cloud.google.com/bigtable/docs/cbt-overview). + +Usage: + + cbt [options] command [arguments] + +The commands are: + + count Count rows in a table + createinstance Create an instance with an initial cluster + createcluster Create a cluster in the configured instance + createfamily Create a column family + createtable Create a table + updatecluster Update a cluster in the configured instance + deleteinstance Delete an instance + deletecluster Delete a cluster from the configured instance + deletecolumn Delete all cells in a column + deletefamily Delete a column family + deleterow Delete a row + deletetable Delete a table + doc Print godoc-suitable documentation for cbt + help Print help text + listinstances List instances in a project + listclusters List clusters in an instance + lookup Read from a single row + ls List tables and column families + mddoc Print documentation for cbt in Markdown format + read Read rows + set Set value of a cell + setgcpolicy Set the GC policy for a column family + waitforreplication Block until all the completed writes have been replicated to all the clusters + createtablefromsnapshot Create a table from a snapshot (snapshots alpha) + createsnapshot Create a snapshot from a source table (snapshots alpha) + listsnapshots List snapshots in a cluster (snapshots alpha) + getsnapshot Get snapshot info (snapshots alpha) + deletesnapshot Delete snapshot in a cluster (snapshots alpha) + version Print the current cbt version + createappprofile Creates app profile for an instance + getappprofile Reads app profile for an instance + listappprofile Lists app profile for an instance + updateappprofile Updates app profile for an instance + deleteappprofile Deletes app profile for an instance + +Use "cbt help " for more information about a command. + +The options are: + + -project string + project ID, if unset uses gcloud configured project + -instance string + Cloud Bigtable instance + -creds string + if set, use application credentials in this file + + +Alpha features are not currently available to most Cloud Bigtable customers. The +features might be changed in backward-incompatible ways and are not recommended +for production use. They are not subject to any SLA or deprecation policy. + +Note: cbt does not support specifying arbitrary bytes on the command line for +any value that Bigtable otherwise supports (e.g., row key, column qualifier, +etc.). + +For convenience, values of the -project, -instance, -creds, +-admin-endpoint and -data-endpoint flags may be specified in +~/.cbtrc in this format: + + project = my-project-123 + instance = my-instance + creds = path-to-account-key.json + admin-endpoint = hostname:port + data-endpoint = hostname:port + +All values are optional, and all will be overridden by flags. + + + +Count rows in a table + +Usage: + cbt count
+ + + + +Create an instance with an initial cluster + +Usage: + cbt createinstance + instance-id Permanent, unique id for the instance + display-name Description of the instance + cluster-id Permanent, unique id for the cluster in the instance + zone The zone in which to create the cluster + num-nodes The number of nodes to create + storage-type SSD or HDD + + + + + +Create a cluster in the configured instance + +Usage: + cbt createcluster + cluster-id Permanent, unique id for the cluster in the instance + zone The zone in which to create the cluster + num-nodes The number of nodes to create + storage-type SSD or HDD + + + + + +Create a column family + +Usage: + cbt createfamily
+ + + + +Create a table + +Usage: + cbt createtable
[families=family[:gcpolicy],...] [splits=split,...] + families: Column families and their associated GC policies. For gcpolicy, + see "setgcpolicy". + Example: families=family1:maxage=1w,family2:maxversions=1 + splits: Row key to be used to initially split the table + + + + +Update a cluster in the configured instance + +Usage: + cbt updatecluster [num-nodes=num-nodes] + cluster-id Permanent, unique id for the cluster in the instance + num-nodes The number of nodes to update to + + + + +Delete an instance + +Usage: + cbt deleteinstance + + + + +Delete a cluster from the configured instance + +Usage: + cbt deletecluster + + + + +Delete all cells in a column + +Usage: + cbt deletecolumn
[app-profile=] + app-profile= The app profile id to use for the request + + + + + +Delete a column family + +Usage: + cbt deletefamily
+ + + + +Delete a row + +Usage: + cbt deleterow
[app-profile=] + app-profile= The app profile id to use for the request + + + + + +Delete a table + +Usage: + cbt deletetable
+ + + + +Print godoc-suitable documentation for cbt + +Usage: + cbt doc + + + + +Print help text + +Usage: + cbt help [command] + + + + +List instances in a project + +Usage: + cbt listinstances + + + + +List clusters in an instance + +Usage: + cbt listclusters + + + + +Read from a single row + +Usage: + cbt lookup
[columns=[family]:[qualifier],...] [cells-per-column=] [app-profile=] + columns=[family]:[qualifier],... Read only these columns, comma-separated + cells-per-column= Read only this many cells per column + app-profile= The app profile id to use for the request + + + + + +List tables and column families + +Usage: + cbt ls List tables + cbt ls
List column families in
+ + + + +Print documentation for cbt in Markdown format + +Usage: + cbt mddoc + + + + +Read rows + +Usage: + cbt read
[start=] [end=] [prefix=] [regex=] [columns=[family]:[qualifier],...] [count=] [cells-per-column=] [app-profile=] + start= Start reading at this row + end= Stop reading before this row + prefix= Read rows with this prefix + regex= Read rows with keys matching this regex + columns=[family]:[qualifier],... Read only these columns, comma-separated + count= Read only this many rows + cells-per-column= Read only this many cells per column + app-profile= The app profile id to use for the request + + + + + +Set value of a cell + +Usage: + cbt set
[app-profile=] family:column=val[@ts] ... + app-profile= The app profile id to use for the request + family:column=val[@ts] may be repeated to set multiple cells. + + ts is an optional integer timestamp. + If it cannot be parsed, the `@ts` part will be + interpreted as part of the value. + + + + +Set the GC policy for a column family + +Usage: + cbt setgcpolicy
((maxage= | maxversions=) [(and|or) (maxage= | maxversions=),...] | never) + + maxage= Maximum timestamp age to preserve (e.g. "1h", "4d") + maxversions= Maximum number of versions to preserve + + + + +Block until all the completed writes have been replicated to all the clusters + +Usage: + cbt waitforreplication
+ + + + +Create a table from a snapshot (snapshots alpha) + +Usage: + cbt createtablefromsnapshot
+ table The name of the table to create + cluster The cluster where the snapshot is located + snapshot The snapshot to restore + + + + +Create a snapshot from a source table (snapshots alpha) + +Usage: + cbt createsnapshot
[ttl=] + + [ttl=] Lifespan of the snapshot (e.g. "1h", "4d") + + + + + +List snapshots in a cluster (snapshots alpha) + +Usage: + cbt listsnapshots [] + + + + +Get snapshot info (snapshots alpha) + +Usage: + cbt getsnapshot + + + + +Delete snapshot in a cluster (snapshots alpha) + +Usage: + cbt deletesnapshot + + + + +Print the current cbt version + +Usage: + cbt version + + + + +Creates app profile for an instance + +Usage: + usage: cbt createappprofile (route-any | [ route-to= : transactional-writes]) [optional flag] + optional flags may be `force` + + + + +Reads app profile for an instance + +Usage: + cbt getappprofile + + + + +Lists app profile for an instance + +Usage: + cbt listappprofile + + + + +Updates app profile for an instance + +Usage: + usage: cbt updateappprofile (route-any | [ route-to= : transactional-writes]) [optional flag] + optional flags may be `force` + + + + +Deletes app profile for an instance + +Usage: + cbt deleteappprofile + + + + +*/ +package main diff --git a/vendor/cloud.google.com/go/bigtable/cmd/cbt/gcpolicy.go b/vendor/cloud.google.com/go/bigtable/cmd/cbt/gcpolicy.go new file mode 100644 index 000000000..5a7c05b48 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/cmd/cbt/gcpolicy.go @@ -0,0 +1,215 @@ +/* +Copyright 2015 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 main + +import ( + "bytes" + "errors" + "fmt" + "io" + "strconv" + "strings" + "unicode" + + "cloud.google.com/go/bigtable" +) + +// Parse a GC policy. Valid policies include +// never +// maxage = 5d +// maxversions = 3 +// maxage = 5d || maxversions = 3 +// maxage=30d || (maxage=3d && maxversions=100) +func parseGCPolicy(s string) (bigtable.GCPolicy, error) { + if strings.TrimSpace(s) == "never" { + return bigtable.NoGcPolicy(), nil + } + r := strings.NewReader(s) + p, err := parsePolicyExpr(r) + if err != nil { + return nil, fmt.Errorf("invalid GC policy: %v", err) + } + tok, err := getToken(r) + if err != nil { + return nil, err + } + if tok != "" { + return nil, fmt.Errorf("invalid GC policy: want end of input, got %q", tok) + } + return p, nil +} + +// expr ::= term (op term)* +// op ::= "and" | "or" | "&&" | "||" +func parsePolicyExpr(r io.RuneScanner) (bigtable.GCPolicy, error) { + policy, err := parsePolicyTerm(r) + if err != nil { + return nil, err + } + for { + tok, err := getToken(r) + if err != nil { + return nil, err + } + var f func(...bigtable.GCPolicy) bigtable.GCPolicy + switch tok { + case "and", "&&": + f = bigtable.IntersectionPolicy + case "or", "||": + f = bigtable.UnionPolicy + default: + ungetToken(tok) + return policy, nil + } + p2, err := parsePolicyTerm(r) + if err != nil { + return nil, err + } + policy = f(policy, p2) + } +} + +// term ::= "maxage" "=" duration | "maxversions" "=" int | "(" policy ")" +func parsePolicyTerm(r io.RuneScanner) (bigtable.GCPolicy, error) { + tok, err := getToken(r) + if err != nil { + return nil, err + } + switch tok { + case "": + return nil, errors.New("empty GC policy term") + + case "maxage", "maxversions": + if err := expectToken(r, "="); err != nil { + return nil, err + } + tok2, err := getToken(r) + if err != nil { + return nil, err + } + if tok2 == "" { + return nil, errors.New("expected a token after '='") + } + if tok == "maxage" { + dur, err := parseDuration(tok2) + if err != nil { + return nil, err + } + return bigtable.MaxAgePolicy(dur), nil + } + n, err := strconv.ParseUint(tok2, 10, 16) + if err != nil { + return nil, err + } + return bigtable.MaxVersionsPolicy(int(n)), nil + + case "(": + p, err := parsePolicyExpr(r) + if err != nil { + return nil, err + } + if err := expectToken(r, ")"); err != nil { + return nil, err + } + return p, nil + + default: + return nil, fmt.Errorf("unexpected token: %q", tok) + } + +} + +func expectToken(r io.RuneScanner, want string) error { + got, err := getToken(r) + if err != nil { + return err + } + if got != want { + return fmt.Errorf("expected %q, saw %q", want, got) + } + return nil +} + +const noToken = "_" // empty token is valid, so use "_" instead + +// If not noToken, getToken will return this instead of reading a new token +// from the input. +var ungotToken = noToken + +// getToken extracts the first token from the input. Valid tokens include +// any sequence of letters and digits, and these symbols: &&, ||, =, ( and ). +// getToken returns ("", nil) at end of input. +func getToken(r io.RuneScanner) (string, error) { + if ungotToken != noToken { + t := ungotToken + ungotToken = noToken + return t, nil + } + var err error + // Skip leading whitespace. + c := ' ' + for unicode.IsSpace(c) { + c, _, err = r.ReadRune() + if err == io.EOF { + return "", nil + } + if err != nil { + return "", err + } + } + switch { + case c == '=' || c == '(' || c == ')': + return string(c), nil + + case c == '&' || c == '|': + c2, _, err := r.ReadRune() + if err != nil && err != io.EOF { + return "", err + } + if c != c2 { + return "", fmt.Errorf("expected %c%c", c, c) + } + return string([]rune{c, c}), nil + + case unicode.IsLetter(c) || unicode.IsDigit(c): + // Collect an alphanumeric token. + var b bytes.Buffer + for unicode.IsLetter(c) || unicode.IsDigit(c) { + b.WriteRune(c) + c, _, err = r.ReadRune() + if err == io.EOF { + break + } + if err != nil { + return "", err + } + } + r.UnreadRune() + return b.String(), nil + + default: + return "", fmt.Errorf("bad rune %q", c) + } +} + +// "unget" a token so the next call to getToken will return it. +func ungetToken(tok string) { + if ungotToken != noToken { + panic("ungetToken called twice") + } + ungotToken = tok +} diff --git a/vendor/cloud.google.com/go/bigtable/cmd/cbt/gcpolicy_test.go b/vendor/cloud.google.com/go/bigtable/cmd/cbt/gcpolicy_test.go new file mode 100644 index 000000000..da9f72e19 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/cmd/cbt/gcpolicy_test.go @@ -0,0 +1,196 @@ +/* +Copyright 2015 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 main + +import ( + "strings" + "testing" + "time" + + "cloud.google.com/go/bigtable" + "github.com/google/go-cmp/cmp" +) + +func TestParseGCPolicy(t *testing.T) { + for _, test := range []struct { + in string + want bigtable.GCPolicy + }{ + { + "never", + bigtable.NoGcPolicy(), + }, + { + "maxage=3h", + bigtable.MaxAgePolicy(3 * time.Hour), + }, + { + "maxversions=2", + bigtable.MaxVersionsPolicy(2), + }, + { + "maxversions=2 and maxage=1h", + bigtable.IntersectionPolicy(bigtable.MaxVersionsPolicy(2), bigtable.MaxAgePolicy(time.Hour)), + }, + { + "(((maxversions=2 and (maxage=1h))))", + bigtable.IntersectionPolicy(bigtable.MaxVersionsPolicy(2), bigtable.MaxAgePolicy(time.Hour)), + }, + { + "maxversions=7 or maxage=8h", + bigtable.UnionPolicy(bigtable.MaxVersionsPolicy(7), bigtable.MaxAgePolicy(8*time.Hour)), + }, + { + "maxversions = 7||maxage = 8h", + bigtable.UnionPolicy(bigtable.MaxVersionsPolicy(7), bigtable.MaxAgePolicy(8*time.Hour)), + }, + { + "maxversions=7||maxage=8h", + bigtable.UnionPolicy(bigtable.MaxVersionsPolicy(7), bigtable.MaxAgePolicy(8*time.Hour)), + }, + { + "maxage=30d || (maxage=3d && maxversions=100)", + bigtable.UnionPolicy( + bigtable.MaxAgePolicy(30*24*time.Hour), + bigtable.IntersectionPolicy( + bigtable.MaxAgePolicy(3*24*time.Hour), + bigtable.MaxVersionsPolicy(100))), + }, + { + "maxage=30d || (maxage=3d && maxversions=100) || maxversions=7", + bigtable.UnionPolicy( + bigtable.UnionPolicy( + bigtable.MaxAgePolicy(30*24*time.Hour), + bigtable.IntersectionPolicy( + bigtable.MaxAgePolicy(3*24*time.Hour), + bigtable.MaxVersionsPolicy(100))), + bigtable.MaxVersionsPolicy(7)), + }, + { + // && and || have same precedence, left associativity + "maxage=1h && maxage=2h || maxage=3h", + bigtable.UnionPolicy( + bigtable.IntersectionPolicy( + bigtable.MaxAgePolicy(1*time.Hour), + bigtable.MaxAgePolicy(2*time.Hour)), + bigtable.MaxAgePolicy(3*time.Hour)), + }, + } { + got, err := parseGCPolicy(test.in) + if err != nil { + t.Errorf("%s: %v", test.in, err) + continue + } + if !cmp.Equal(got, test.want, cmp.AllowUnexported(bigtable.IntersectionPolicy(), bigtable.UnionPolicy())) { + t.Errorf("%s: got %+v, want %+v", test.in, got, test.want) + } + } +} + +func TestParseGCPolicyErrors(t *testing.T) { + for _, in := range []string{ + "", + "a", + "b = 1h", + "c = 1", + "maxage=1", // need duration + "maxversions=1h", // need int + "maxage", + "maxversions", + "never=never", + "maxversions=1 && never", + "(((maxage=1h))", + "((maxage=1h)))", + "maxage=30d || ((maxage=3d && maxversions=100)", + "maxversions = 3 and", + } { + _, err := parseGCPolicy(in) + if err == nil { + t.Errorf("%s: got nil, want error", in) + } + } +} + +func TestTokenizeGCPolicy(t *testing.T) { + for _, test := range []struct { + in string + want []string + }{ + { + "maxage=5d", + []string{"maxage", "=", "5d"}, + }, + { + "maxage = 5d", + []string{"maxage", "=", "5d"}, + }, + { + "maxage=5d or maxversions=5", + []string{"maxage", "=", "5d", "or", "maxversions", "=", "5"}, + }, + { + "maxage=5d || (maxversions=5)", + []string{"maxage", "=", "5d", "||", "(", "maxversions", "=", "5", ")"}, + }, + { + "maxage=5d||( maxversions=5 )", + []string{"maxage", "=", "5d", "||", "(", "maxversions", "=", "5", ")"}, + }, + } { + got, err := tokenizeGCPolicy(test.in) + if err != nil { + t.Errorf("%s: %v", test.in, err) + continue + } + if diff := cmp.Diff(got, test.want); diff != "" { + t.Errorf("%s: %s", test.in, diff) + } + } +} + +func TestTokenizeGCPolicyErrors(t *testing.T) { + for _, in := range []string{ + "a &", + "a & b", + "a &x b", + "a |", + "a | b", + "a |& b", + "a % b", + } { + _, err := tokenizeGCPolicy(in) + if err == nil { + t.Errorf("%s: got nil, want error", in) + } + } +} + +func tokenizeGCPolicy(s string) ([]string, error) { + var tokens []string + r := strings.NewReader(s) + for { + tok, err := getToken(r) + if err != nil { + return nil, err + } + if tok == "" { + break + } + tokens = append(tokens, tok) + } + return tokens, nil +} diff --git a/vendor/cloud.google.com/go/bigtable/cmd/emulator/cbtemulator.go b/vendor/cloud.google.com/go/bigtable/cmd/emulator/cbtemulator.go new file mode 100644 index 000000000..2477a6420 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/cmd/emulator/cbtemulator.go @@ -0,0 +1,44 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +cbtemulator launches the in-memory Cloud Bigtable server on the given address. +*/ +package main + +import ( + "flag" + "fmt" + "log" + + "cloud.google.com/go/bigtable/bttest" + "google.golang.org/grpc" +) + +var ( + host = flag.String("host", "localhost", "the address to bind to on the local machine") + port = flag.Int("port", 9000, "the port number to bind to on the local machine") +) + +func main() { + grpc.EnableTracing = false + flag.Parse() + srv, err := bttest.NewServer(fmt.Sprintf("%s:%d", *host, *port)) + if err != nil { + log.Fatalf("failed to start emulator: %v", err) + } + + fmt.Printf("Cloud Bigtable emulator running on %s\n", srv.Addr) + select {} +} diff --git a/vendor/cloud.google.com/go/bigtable/cmd/loadtest/loadtest.go b/vendor/cloud.google.com/go/bigtable/cmd/loadtest/loadtest.go new file mode 100644 index 000000000..d05aac132 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/cmd/loadtest/loadtest.go @@ -0,0 +1,205 @@ +/* +Copyright 2015 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. +*/ + +/* +Loadtest does some load testing through the Go client library for Cloud Bigtable. +*/ +package main + +import ( + "bytes" + "context" + "flag" + "fmt" + "log" + "math/rand" + "os" + "os/signal" + "sync" + "sync/atomic" + "time" + + "cloud.google.com/go/bigtable" + "cloud.google.com/go/bigtable/internal/cbtconfig" + "cloud.google.com/go/bigtable/internal/stat" + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +var ( + runFor = flag.Duration("run_for", 5*time.Second, + "how long to run the load test for; 0 to run forever until SIGTERM") + scratchTable = flag.String("scratch_table", "loadtest-scratch", "name of table to use; should not already exist") + csvOutput = flag.String("csv_output", "", + "output path for statistics in .csv format. If this file already exists it will be overwritten.") + poolSize = flag.Int("pool_size", 1, "size of the gRPC connection pool to use for the data client") + reqCount = flag.Int("req_count", 100, "number of concurrent requests") + + config *cbtconfig.Config + client *bigtable.Client + adminClient *bigtable.AdminClient +) + +func main() { + var err error + config, err = cbtconfig.Load() + if err != nil { + log.Fatal(err) + } + config.RegisterFlags() + + flag.Parse() + if err := config.CheckFlags(cbtconfig.ProjectAndInstanceRequired); err != nil { + log.Fatal(err) + } + if config.Creds != "" { + os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", config.Creds) + } + if flag.NArg() != 0 { + flag.Usage() + os.Exit(1) + } + + var options []option.ClientOption + if *poolSize > 1 { + options = append(options, + option.WithGRPCConnectionPool(*poolSize), + + // TODO(grpc/grpc-go#1388) using connection pool without WithBlock + // can cause RPCs to fail randomly. We can delete this after the issue is fixed. + option.WithGRPCDialOption(grpc.WithBlock())) + } + + var csvFile *os.File + if *csvOutput != "" { + csvFile, err = os.Create(*csvOutput) + if err != nil { + log.Fatalf("creating csv output file: %v", err) + } + defer csvFile.Close() + log.Printf("Writing statistics to %q ...", *csvOutput) + } + + log.Printf("Dialing connections...") + client, err = bigtable.NewClient(context.Background(), config.Project, config.Instance, options...) + if err != nil { + log.Fatalf("Making bigtable.Client: %v", err) + } + defer client.Close() + adminClient, err = bigtable.NewAdminClient(context.Background(), config.Project, config.Instance) + if err != nil { + log.Fatalf("Making bigtable.AdminClient: %v", err) + } + defer adminClient.Close() + + // Create a scratch table. + log.Printf("Setting up scratch table...") + tblConf := bigtable.TableConf{ + TableID: *scratchTable, + Families: map[string]bigtable.GCPolicy{"f": bigtable.MaxVersionsPolicy(1)}, + } + if err := adminClient.CreateTableFromConf(context.Background(), &tblConf); err != nil { + log.Fatalf("Making scratch table %q: %v", *scratchTable, err) + } + // Upon a successful run, delete the table. Don't bother checking for errors. + defer adminClient.DeleteTable(context.Background(), *scratchTable) + + // Also delete the table on SIGTERM. + c := make(chan os.Signal, 1) + signal.Notify(c, os.Interrupt) + go func() { + s := <-c + log.Printf("Caught %v, cleaning scratch table.", s) + _ = adminClient.DeleteTable(context.Background(), *scratchTable) + os.Exit(1) + }() + + log.Printf("Starting load test... (run for %v)", *runFor) + tbl := client.Open(*scratchTable) + sem := make(chan int, *reqCount) // limit the number of requests happening at once + var reads, writes stats + stopTime := time.Now().Add(*runFor) + var wg sync.WaitGroup + for time.Now().Before(stopTime) || *runFor == 0 { + sem <- 1 + wg.Add(1) + go func() { + defer wg.Done() + defer func() { <-sem }() + + ok := true + opStart := time.Now() + var stats *stats + defer func() { + stats.Record(ok, time.Since(opStart)) + }() + + row := fmt.Sprintf("row%d", rand.Intn(100)) // operate on 1 of 100 rows + + switch rand.Intn(10) { + default: + // read + stats = &reads + _, err := tbl.ReadRow(context.Background(), row, bigtable.RowFilter(bigtable.LatestNFilter(1))) + if err != nil { + log.Printf("Error doing read: %v", err) + ok = false + } + case 0, 1, 2, 3, 4: + // write + stats = &writes + mut := bigtable.NewMutation() + mut.Set("f", "col", bigtable.Now(), bytes.Repeat([]byte("0"), 1<<10)) // 1 KB write + if err := tbl.Apply(context.Background(), row, mut); err != nil { + log.Printf("Error doing mutation: %v", err) + ok = false + } + } + }() + } + wg.Wait() + + readsAgg := stat.NewAggregate("reads", reads.ds, reads.tries-reads.ok) + writesAgg := stat.NewAggregate("writes", writes.ds, writes.tries-writes.ok) + log.Printf("Reads (%d ok / %d tries):\n%v", reads.ok, reads.tries, readsAgg) + log.Printf("Writes (%d ok / %d tries):\n%v", writes.ok, writes.tries, writesAgg) + + if csvFile != nil { + stat.WriteCSV([]*stat.Aggregate{readsAgg, writesAgg}, csvFile) + } +} + +var allStats int64 // atomic + +type stats struct { + mu sync.Mutex + tries, ok int + ds []time.Duration +} + +func (s *stats) Record(ok bool, d time.Duration) { + s.mu.Lock() + s.tries++ + if ok { + s.ok++ + } + s.ds = append(s.ds, d) + s.mu.Unlock() + + if n := atomic.AddInt64(&allStats, 1); n%1000 == 0 { + log.Printf("Progress: done %d ops", n) + } +} diff --git a/vendor/cloud.google.com/go/bigtable/cmd/scantest/scantest.go b/vendor/cloud.google.com/go/bigtable/cmd/scantest/scantest.go new file mode 100644 index 000000000..bcfde8cc6 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/cmd/scantest/scantest.go @@ -0,0 +1,155 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/* +Scantest does scan-related load testing against Cloud Bigtable. The logic here +mimics a similar test written using the Java client. +*/ +package main + +import ( + "bytes" + "context" + "flag" + "fmt" + "log" + "math/rand" + "os" + "sync" + "sync/atomic" + "text/tabwriter" + "time" + + "cloud.google.com/go/bigtable" + "cloud.google.com/go/bigtable/internal/cbtconfig" + "cloud.google.com/go/bigtable/internal/stat" +) + +var ( + runFor = flag.Duration("run_for", 5*time.Second, "how long to run the load test for") + numScans = flag.Int("concurrent_scans", 1, "number of concurrent scans") + rowLimit = flag.Int("row_limit", 10000, "max number of records per scan") + + config *cbtconfig.Config + client *bigtable.Client +) + +func main() { + flag.Usage = func() { + fmt.Printf("Usage: scantest [options] \n\n") + flag.PrintDefaults() + } + + var err error + config, err = cbtconfig.Load() + if err != nil { + log.Fatal(err) + } + config.RegisterFlags() + + flag.Parse() + if err := config.CheckFlags(cbtconfig.ProjectAndInstanceRequired); err != nil { + log.Fatal(err) + } + if config.Creds != "" { + os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", config.Creds) + } + if flag.NArg() != 1 { + flag.Usage() + os.Exit(1) + } + + table := flag.Arg(0) + + log.Printf("Dialing connections...") + client, err = bigtable.NewClient(context.Background(), config.Project, config.Instance) + if err != nil { + log.Fatalf("Making bigtable.Client: %v", err) + } + defer client.Close() + + log.Printf("Starting scan test... (run for %v)", *runFor) + tbl := client.Open(table) + sem := make(chan int, *numScans) // limit the number of requests happening at once + var scans stats + + stopTime := time.Now().Add(*runFor) + var wg sync.WaitGroup + for time.Now().Before(stopTime) { + sem <- 1 + wg.Add(1) + go func() { + defer wg.Done() + defer func() { <-sem }() + + ok := true + opStart := time.Now() + defer func() { + scans.Record(ok, time.Since(opStart)) + }() + + // Start at a random row key + key := fmt.Sprintf("user%d", rand.Int63()) + limit := bigtable.LimitRows(int64(*rowLimit)) + noop := func(bigtable.Row) bool { return true } + if err := tbl.ReadRows(context.Background(), bigtable.NewRange(key, ""), noop, limit); err != nil { + log.Printf("Error during scan: %v", err) + ok = false + } + }() + } + wg.Wait() + + agg := stat.NewAggregate("scans", scans.ds, scans.tries-scans.ok) + log.Printf("Scans (%d ok / %d tries):\nscan times:\n%v\nthroughput (rows/second):\n%v", + scans.ok, scans.tries, agg, throughputString(agg)) +} + +func throughputString(agg *stat.Aggregate) string { + var buf bytes.Buffer + tw := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', 0) // one-space padding + rowLimitF := float64(*rowLimit) + fmt.Fprintf( + tw, + "min:\t%.2f\nmedian:\t%.2f\nmax:\t%.2f\n", + rowLimitF/agg.Max.Seconds(), + rowLimitF/agg.Median.Seconds(), + rowLimitF/agg.Min.Seconds()) + tw.Flush() + return buf.String() +} + +var allStats int64 // atomic + +type stats struct { + mu sync.Mutex + tries, ok int + ds []time.Duration +} + +func (s *stats) Record(ok bool, d time.Duration) { + s.mu.Lock() + s.tries++ + if ok { + s.ok++ + } + s.ds = append(s.ds, d) + s.mu.Unlock() + + if n := atomic.AddInt64(&allStats, 1); n%1000 == 0 { + log.Printf("Progress: done %d ops", n) + } +} diff --git a/vendor/cloud.google.com/go/bigtable/doc.go b/vendor/cloud.google.com/go/bigtable/doc.go new file mode 100644 index 000000000..1b75ff7ce --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/doc.go @@ -0,0 +1,123 @@ +/* +Copyright 2015 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 bigtable is an API to Google Cloud Bigtable. + +See https://cloud.google.com/bigtable/docs/ for general product documentation. + +See https://godoc.org/cloud.google.com/go for authentication, timeouts, +connection pooling and similar aspects of this package. + + +Setup and Credentials + +Use NewClient or NewAdminClient to create a client that can be used to access +the data or admin APIs respectively. Both require credentials that have permission +to access the Cloud Bigtable API. + +If your program is run on Google App Engine or Google Compute Engine, using the Application Default Credentials +(https://developers.google.com/accounts/docs/application-default-credentials) +is the simplest option. Those credentials will be used by default when NewClient or NewAdminClient are called. + +To use alternate credentials, pass them to NewClient or NewAdminClient using option.WithTokenSource. +For instance, you can use service account credentials by visiting +https://cloud.google.com/console/project/MYPROJECT/apiui/credential, +creating a new OAuth "Client ID", storing the JSON key somewhere accessible, and writing + jsonKey, err := ioutil.ReadFile(pathToKeyFile) + ... + config, err := google.JWTConfigFromJSON(jsonKey, bigtable.Scope) // or bigtable.AdminScope, etc. + ... + client, err := bigtable.NewClient(ctx, project, instance, option.WithTokenSource(config.TokenSource(ctx))) + ... +Here, `google` means the golang.org/x/oauth2/google package +and `option` means the google.golang.org/api/option package. + +Reading + +The principal way to read from a Bigtable is to use the ReadRows method on *Table. +A RowRange specifies a contiguous portion of a table. A Filter may be provided through +RowFilter to limit or transform the data that is returned. + tbl := client.Open("mytable") + ... + // Read all the rows starting with "com.google.", + // but only fetch the columns in the "links" family. + rr := bigtable.PrefixRange("com.google.") + err := tbl.ReadRows(ctx, rr, func(r Row) bool { + // do something with r + return true // keep going + }, bigtable.RowFilter(bigtable.FamilyFilter("links"))) + ... + +To read a single row, use the ReadRow helper method. + r, err := tbl.ReadRow(ctx, "com.google.cloud") // "com.google.cloud" is the entire row key + ... + +Writing + +This API exposes two distinct forms of writing to a Bigtable: a Mutation and a ReadModifyWrite. +The former expresses idempotent operations. +The latter expresses non-idempotent operations and returns the new values of updated cells. +These operations are performed by creating a Mutation or ReadModifyWrite (with NewMutation or NewReadModifyWrite), +building up one or more operations on that, and then using the Apply or ApplyReadModifyWrite +methods on a Table. + +For instance, to set a couple of cells in a table, + tbl := client.Open("mytable") + mut := bigtable.NewMutation() + mut.Set("links", "maps.google.com", bigtable.Now(), []byte("1")) + mut.Set("links", "golang.org", bigtable.Now(), []byte("1")) + err := tbl.Apply(ctx, "com.google.cloud", mut) + ... + +To increment an encoded value in one cell, + tbl := client.Open("mytable") + rmw := bigtable.NewReadModifyWrite() + rmw.Increment("links", "golang.org", 12) // add 12 to the cell in column "links:golang.org" + r, err := tbl.ApplyReadModifyWrite(ctx, "com.google.cloud", rmw) + ... + +Retries + +If a read or write operation encounters a transient error it will be retried until a successful +response, an unretryable error or the context deadline is reached. Non-idempotent writes (where +the timestamp is set to ServerTime) will not be retried. In the case of ReadRows, retried calls +will not re-scan rows that have already been processed. +*/ +package bigtable // import "cloud.google.com/go/bigtable" + +// Scope constants for authentication credentials. +// These should be used when using credential creation functions such as oauth.NewServiceAccountFromFile. +const ( + // Scope is the OAuth scope for Cloud Bigtable data operations. + Scope = "https://www.googleapis.com/auth/bigtable.data" + // ReadonlyScope is the OAuth scope for Cloud Bigtable read-only data operations. + ReadonlyScope = "https://www.googleapis.com/auth/bigtable.readonly" + + // AdminScope is the OAuth scope for Cloud Bigtable table admin operations. + AdminScope = "https://www.googleapis.com/auth/bigtable.admin.table" + + // InstanceAdminScope is the OAuth scope for Cloud Bigtable instance (and cluster) admin operations. + InstanceAdminScope = "https://www.googleapis.com/auth/bigtable.admin.cluster" +) + +// clientUserAgent identifies the version of this package. +// It should be bumped upon significant changes only. +const clientUserAgent = "cbt-go/20180601" + +// resourcePrefixHeader is the name of the metadata header used to indicate +// the resource being operated on. +const resourcePrefixHeader = "google-cloud-resource-prefix" diff --git a/vendor/cloud.google.com/go/bigtable/export_test.go b/vendor/cloud.google.com/go/bigtable/export_test.go new file mode 100644 index 000000000..33f55deab --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/export_test.go @@ -0,0 +1,215 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package bigtable + +import ( + "context" + "errors" + "flag" + "fmt" + "strings" + "time" + + "cloud.google.com/go/bigtable/bttest" + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +var legacyUseProd string +var integrationConfig IntegrationTestConfig + +func init() { + c := &integrationConfig + + flag.BoolVar(&c.UseProd, "it.use-prod", false, "Use remote bigtable instead of local emulator") + flag.StringVar(&c.AdminEndpoint, "it.admin-endpoint", "", "Admin api host and port") + flag.StringVar(&c.DataEndpoint, "it.data-endpoint", "", "Data api host and port") + flag.StringVar(&c.Project, "it.project", "", "Project to use for integration test") + flag.StringVar(&c.Instance, "it.instance", "", "Bigtable instance to use") + flag.StringVar(&c.Cluster, "it.cluster", "", "Bigtable cluster to use") + flag.StringVar(&c.Table, "it.table", "", "Bigtable table to create") + + // Backwards compat + flag.StringVar(&legacyUseProd, "use_prod", "", `DEPRECATED: if set to "proj,instance,table", run integration test against production`) + +} + +// IntegrationTestConfig contains parameters to pick and setup a IntegrationEnv for testing +type IntegrationTestConfig struct { + UseProd bool + AdminEndpoint string + DataEndpoint string + Project string + Instance string + Cluster string + Table string +} + +// IntegrationEnv represents a testing environment. +// The environment can be implemented using production or an emulator +type IntegrationEnv interface { + Config() IntegrationTestConfig + NewAdminClient() (*AdminClient, error) + // NewInstanceAdminClient will return nil if instance administration is unsupported in this environment + NewInstanceAdminClient() (*InstanceAdminClient, error) + NewClient() (*Client, error) + Close() +} + +// NewIntegrationEnv creates a new environment based on the command line args +func NewIntegrationEnv() (IntegrationEnv, error) { + c := integrationConfig + + if legacyUseProd != "" { + fmt.Println("WARNING: using legacy commandline arg -use_prod, please switch to -it.*") + parts := strings.SplitN(legacyUseProd, ",", 3) + c.UseProd = true + c.Project = parts[0] + c.Instance = parts[1] + c.Table = parts[2] + } + + if integrationConfig.UseProd { + return NewProdEnv(c) + } + return NewEmulatedEnv(c) +} + +// EmulatedEnv encapsulates the state of an emulator +type EmulatedEnv struct { + config IntegrationTestConfig + server *bttest.Server +} + +// NewEmulatedEnv builds and starts the emulator based environment +func NewEmulatedEnv(config IntegrationTestConfig) (*EmulatedEnv, error) { + srv, err := bttest.NewServer("localhost:0", grpc.MaxRecvMsgSize(200<<20), grpc.MaxSendMsgSize(100<<20)) + if err != nil { + return nil, err + } + + if config.Project == "" { + config.Project = "project" + } + if config.Instance == "" { + config.Instance = "instance" + } + if config.Table == "" { + config.Table = "mytable" + } + config.AdminEndpoint = srv.Addr + config.DataEndpoint = srv.Addr + + env := &EmulatedEnv{ + config: config, + server: srv, + } + return env, nil +} + +// Close stops & cleans up the emulator +func (e *EmulatedEnv) Close() { + e.server.Close() +} + +// Config gets the config used to build this environment +func (e *EmulatedEnv) Config() IntegrationTestConfig { + return e.config +} + +// NewAdminClient builds a new connected admin client for this environment +func (e *EmulatedEnv) NewAdminClient() (*AdminClient, error) { + timeout := 20 * time.Second + ctx, _ := context.WithTimeout(context.Background(), timeout) + conn, err := grpc.Dial(e.server.Addr, grpc.WithInsecure(), grpc.WithBlock()) + if err != nil { + return nil, err + } + return NewAdminClient(ctx, e.config.Project, e.config.Instance, option.WithGRPCConn(conn)) +} + +// NewInstanceAdminClient returns nil for the emulated environment since the API is not implemented. +func (e *EmulatedEnv) NewInstanceAdminClient() (*InstanceAdminClient, error) { + return nil, nil +} + +// NewClient builds a new connected data client for this environment +func (e *EmulatedEnv) NewClient() (*Client, error) { + timeout := 20 * time.Second + ctx, _ := context.WithTimeout(context.Background(), timeout) + conn, err := grpc.Dial(e.server.Addr, grpc.WithInsecure(), grpc.WithBlock(), + grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(100<<20), grpc.MaxCallRecvMsgSize(100<<20))) + if err != nil { + return nil, err + } + return NewClient(ctx, e.config.Project, e.config.Instance, option.WithGRPCConn(conn)) +} + +// ProdEnv encapsulates the state necessary to connect to the external Bigtable service +type ProdEnv struct { + config IntegrationTestConfig +} + +// NewProdEnv builds the environment representation +func NewProdEnv(config IntegrationTestConfig) (*ProdEnv, error) { + if config.Project == "" { + return nil, errors.New("Project not set") + } + if config.Instance == "" { + return nil, errors.New("Instance not set") + } + if config.Table == "" { + return nil, errors.New("Table not set") + } + + return &ProdEnv{config}, nil +} + +// Close is a no-op for production environments +func (e *ProdEnv) Close() {} + +// Config gets the config used to build this environment +func (e *ProdEnv) Config() IntegrationTestConfig { + return e.config +} + +// NewAdminClient builds a new connected admin client for this environment +func (e *ProdEnv) NewAdminClient() (*AdminClient, error) { + var clientOpts []option.ClientOption + if endpoint := e.config.AdminEndpoint; endpoint != "" { + clientOpts = append(clientOpts, option.WithEndpoint(endpoint)) + } + return NewAdminClient(context.Background(), e.config.Project, e.config.Instance, clientOpts...) +} + +// NewInstanceAdminClient returns a new connected instance admin client for this environment +func (e *ProdEnv) NewInstanceAdminClient() (*InstanceAdminClient, error) { + var clientOpts []option.ClientOption + if endpoint := e.config.AdminEndpoint; endpoint != "" { + clientOpts = append(clientOpts, option.WithEndpoint(endpoint)) + } + return NewInstanceAdminClient(context.Background(), e.config.Project, clientOpts...) +} + +// NewClient builds a connected data client for this environment +func (e *ProdEnv) NewClient() (*Client, error) { + var clientOpts []option.ClientOption + if endpoint := e.config.DataEndpoint; endpoint != "" { + clientOpts = append(clientOpts, option.WithEndpoint(endpoint)) + } + return NewClient(context.Background(), e.config.Project, e.config.Instance, clientOpts...) +} diff --git a/vendor/cloud.google.com/go/bigtable/filter.go b/vendor/cloud.google.com/go/bigtable/filter.go new file mode 100644 index 000000000..c42574f15 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/filter.go @@ -0,0 +1,330 @@ +/* +Copyright 2015 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 bigtable + +import ( + "fmt" + "strings" + "time" + + btpb "google.golang.org/genproto/googleapis/bigtable/v2" +) + +// A Filter represents a row filter. +type Filter interface { + String() string + proto() *btpb.RowFilter +} + +// ChainFilters returns a filter that applies a sequence of filters. +func ChainFilters(sub ...Filter) Filter { return chainFilter{sub} } + +type chainFilter struct { + sub []Filter +} + +func (cf chainFilter) String() string { + var ss []string + for _, sf := range cf.sub { + ss = append(ss, sf.String()) + } + return "(" + strings.Join(ss, " | ") + ")" +} + +func (cf chainFilter) proto() *btpb.RowFilter { + chain := &btpb.RowFilter_Chain{} + for _, sf := range cf.sub { + chain.Filters = append(chain.Filters, sf.proto()) + } + return &btpb.RowFilter{ + Filter: &btpb.RowFilter_Chain_{Chain: chain}, + } +} + +// InterleaveFilters returns a filter that applies a set of filters in parallel +// and interleaves the results. +func InterleaveFilters(sub ...Filter) Filter { return interleaveFilter{sub} } + +type interleaveFilter struct { + sub []Filter +} + +func (ilf interleaveFilter) String() string { + var ss []string + for _, sf := range ilf.sub { + ss = append(ss, sf.String()) + } + return "(" + strings.Join(ss, " + ") + ")" +} + +func (ilf interleaveFilter) proto() *btpb.RowFilter { + inter := &btpb.RowFilter_Interleave{} + for _, sf := range ilf.sub { + inter.Filters = append(inter.Filters, sf.proto()) + } + return &btpb.RowFilter{ + Filter: &btpb.RowFilter_Interleave_{Interleave: inter}, + } +} + +// RowKeyFilter returns a filter that matches cells from rows whose +// key matches the provided RE2 pattern. +// See https://github.com/google/re2/wiki/Syntax for the accepted syntax. +func RowKeyFilter(pattern string) Filter { return rowKeyFilter(pattern) } + +type rowKeyFilter string + +func (rkf rowKeyFilter) String() string { return fmt.Sprintf("row(%s)", string(rkf)) } + +func (rkf rowKeyFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{Filter: &btpb.RowFilter_RowKeyRegexFilter{RowKeyRegexFilter: []byte(rkf)}} +} + +// FamilyFilter returns a filter that matches cells whose family name +// matches the provided RE2 pattern. +// See https://github.com/google/re2/wiki/Syntax for the accepted syntax. +func FamilyFilter(pattern string) Filter { return familyFilter(pattern) } + +type familyFilter string + +func (ff familyFilter) String() string { return fmt.Sprintf("col(%s:)", string(ff)) } + +func (ff familyFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{Filter: &btpb.RowFilter_FamilyNameRegexFilter{FamilyNameRegexFilter: string(ff)}} +} + +// ColumnFilter returns a filter that matches cells whose column name +// matches the provided RE2 pattern. +// See https://github.com/google/re2/wiki/Syntax for the accepted syntax. +func ColumnFilter(pattern string) Filter { return columnFilter(pattern) } + +type columnFilter string + +func (cf columnFilter) String() string { return fmt.Sprintf("col(.*:%s)", string(cf)) } + +func (cf columnFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{Filter: &btpb.RowFilter_ColumnQualifierRegexFilter{ColumnQualifierRegexFilter: []byte(cf)}} +} + +// ValueFilter returns a filter that matches cells whose value +// matches the provided RE2 pattern. +// See https://github.com/google/re2/wiki/Syntax for the accepted syntax. +func ValueFilter(pattern string) Filter { return valueFilter(pattern) } + +type valueFilter string + +func (vf valueFilter) String() string { return fmt.Sprintf("value_match(%s)", string(vf)) } + +func (vf valueFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{Filter: &btpb.RowFilter_ValueRegexFilter{ValueRegexFilter: []byte(vf)}} +} + +// LatestNFilter returns a filter that matches the most recent N cells in each column. +func LatestNFilter(n int) Filter { return latestNFilter(n) } + +type latestNFilter int32 + +func (lnf latestNFilter) String() string { return fmt.Sprintf("col(*,%d)", lnf) } + +func (lnf latestNFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{Filter: &btpb.RowFilter_CellsPerColumnLimitFilter{CellsPerColumnLimitFilter: int32(lnf)}} +} + +// StripValueFilter returns a filter that replaces each value with the empty string. +func StripValueFilter() Filter { return stripValueFilter{} } + +type stripValueFilter struct{} + +func (stripValueFilter) String() string { return "strip_value()" } +func (stripValueFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{Filter: &btpb.RowFilter_StripValueTransformer{StripValueTransformer: true}} +} + +// TimestampRangeFilter returns a filter that matches any cells whose timestamp is within the given time bounds. A zero +// time means no bound. +// The timestamp will be truncated to millisecond granularity. +func TimestampRangeFilter(startTime time.Time, endTime time.Time) Filter { + trf := timestampRangeFilter{} + if !startTime.IsZero() { + trf.startTime = Time(startTime) + } + if !endTime.IsZero() { + trf.endTime = Time(endTime) + } + return trf +} + +// TimestampRangeFilterMicros returns a filter that matches any cells whose timestamp is within the given time bounds, +// specified in units of microseconds since 1 January 1970. A zero value for the end time is interpreted as no bound. +// The timestamp will be truncated to millisecond granularity. +func TimestampRangeFilterMicros(startTime Timestamp, endTime Timestamp) Filter { + return timestampRangeFilter{startTime, endTime} +} + +type timestampRangeFilter struct { + startTime Timestamp + endTime Timestamp +} + +func (trf timestampRangeFilter) String() string { + return fmt.Sprintf("timestamp_range(%v,%v)", trf.startTime, trf.endTime) +} + +func (trf timestampRangeFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{ + Filter: &btpb.RowFilter_TimestampRangeFilter{TimestampRangeFilter: &btpb.TimestampRange{ + StartTimestampMicros: int64(trf.startTime.TruncateToMilliseconds()), + EndTimestampMicros: int64(trf.endTime.TruncateToMilliseconds()), + }, + }} +} + +// ColumnRangeFilter returns a filter that matches a contiguous range of columns within a single +// family, as specified by an inclusive start qualifier and exclusive end qualifier. +func ColumnRangeFilter(family, start, end string) Filter { + return columnRangeFilter{family, start, end} +} + +type columnRangeFilter struct { + family string + start string + end string +} + +func (crf columnRangeFilter) String() string { + return fmt.Sprintf("columnRangeFilter(%s,%s,%s)", crf.family, crf.start, crf.end) +} + +func (crf columnRangeFilter) proto() *btpb.RowFilter { + r := &btpb.ColumnRange{FamilyName: crf.family} + if crf.start != "" { + r.StartQualifier = &btpb.ColumnRange_StartQualifierClosed{StartQualifierClosed: []byte(crf.start)} + } + if crf.end != "" { + r.EndQualifier = &btpb.ColumnRange_EndQualifierOpen{EndQualifierOpen: []byte(crf.end)} + } + return &btpb.RowFilter{Filter: &btpb.RowFilter_ColumnRangeFilter{ColumnRangeFilter: r}} +} + +// ValueRangeFilter returns a filter that matches cells with values that fall within +// the given range, as specified by an inclusive start value and exclusive end value. +func ValueRangeFilter(start, end []byte) Filter { + return valueRangeFilter{start, end} +} + +type valueRangeFilter struct { + start []byte + end []byte +} + +func (vrf valueRangeFilter) String() string { + return fmt.Sprintf("valueRangeFilter(%s,%s)", vrf.start, vrf.end) +} + +func (vrf valueRangeFilter) proto() *btpb.RowFilter { + r := &btpb.ValueRange{} + if vrf.start != nil { + r.StartValue = &btpb.ValueRange_StartValueClosed{StartValueClosed: vrf.start} + } + if vrf.end != nil { + r.EndValue = &btpb.ValueRange_EndValueOpen{EndValueOpen: vrf.end} + } + return &btpb.RowFilter{Filter: &btpb.RowFilter_ValueRangeFilter{ValueRangeFilter: r}} +} + +// ConditionFilter returns a filter that evaluates to one of two possible filters depending +// on whether or not the given predicate filter matches at least one cell. +// If the matched filter is nil then no results will be returned. +// IMPORTANT NOTE: The predicate filter does not execute atomically with the +// true and false filters, which may lead to inconsistent or unexpected +// results. Additionally, condition filters have poor performance, especially +// when filters are set for the false condition. +func ConditionFilter(predicateFilter, trueFilter, falseFilter Filter) Filter { + return conditionFilter{predicateFilter, trueFilter, falseFilter} +} + +type conditionFilter struct { + predicateFilter Filter + trueFilter Filter + falseFilter Filter +} + +func (cf conditionFilter) String() string { + return fmt.Sprintf("conditionFilter(%s,%s,%s)", cf.predicateFilter, cf.trueFilter, cf.falseFilter) +} + +func (cf conditionFilter) proto() *btpb.RowFilter { + var tf *btpb.RowFilter + var ff *btpb.RowFilter + if cf.trueFilter != nil { + tf = cf.trueFilter.proto() + } + if cf.falseFilter != nil { + ff = cf.falseFilter.proto() + } + return &btpb.RowFilter{ + Filter: &btpb.RowFilter_Condition_{Condition: &btpb.RowFilter_Condition{ + PredicateFilter: cf.predicateFilter.proto(), + TrueFilter: tf, + FalseFilter: ff, + }}} +} + +// CellsPerRowOffsetFilter returns a filter that skips the first N cells of each row, matching all subsequent cells. +func CellsPerRowOffsetFilter(n int) Filter { + return cellsPerRowOffsetFilter(n) +} + +type cellsPerRowOffsetFilter int32 + +func (cof cellsPerRowOffsetFilter) String() string { + return fmt.Sprintf("cells_per_row_offset(%d)", cof) +} + +func (cof cellsPerRowOffsetFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{Filter: &btpb.RowFilter_CellsPerRowOffsetFilter{CellsPerRowOffsetFilter: int32(cof)}} +} + +// CellsPerRowLimitFilter returns a filter that matches only the first N cells of each row. +func CellsPerRowLimitFilter(n int) Filter { + return cellsPerRowLimitFilter(n) +} + +type cellsPerRowLimitFilter int32 + +func (clf cellsPerRowLimitFilter) String() string { + return fmt.Sprintf("cells_per_row_limit(%d)", clf) +} + +func (clf cellsPerRowLimitFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{Filter: &btpb.RowFilter_CellsPerRowLimitFilter{CellsPerRowLimitFilter: int32(clf)}} +} + +// RowSampleFilter returns a filter that matches a row with a probability of p (must be in the interval (0, 1)). +func RowSampleFilter(p float64) Filter { + return rowSampleFilter(p) +} + +type rowSampleFilter float64 + +func (rsf rowSampleFilter) String() string { + return fmt.Sprintf("filter(%f)", rsf) +} + +func (rsf rowSampleFilter) proto() *btpb.RowFilter { + return &btpb.RowFilter{Filter: &btpb.RowFilter_RowSampleFilter{RowSampleFilter: float64(rsf)}} +} diff --git a/vendor/cloud.google.com/go/bigtable/gc.go b/vendor/cloud.google.com/go/bigtable/gc.go new file mode 100644 index 000000000..dce4c823f --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/gc.go @@ -0,0 +1,167 @@ +/* +Copyright 2015 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 bigtable + +import ( + "fmt" + "strings" + "time" + + durpb "github.com/golang/protobuf/ptypes/duration" + bttdpb "google.golang.org/genproto/googleapis/bigtable/admin/v2" +) + +// A GCPolicy represents a rule that determines which cells are eligible for garbage collection. +type GCPolicy interface { + String() string + proto() *bttdpb.GcRule +} + +// IntersectionPolicy returns a GC policy that only applies when all its sub-policies apply. +func IntersectionPolicy(sub ...GCPolicy) GCPolicy { return intersectionPolicy{sub} } + +type intersectionPolicy struct { + sub []GCPolicy +} + +func (ip intersectionPolicy) String() string { + var ss []string + for _, sp := range ip.sub { + ss = append(ss, sp.String()) + } + return "(" + strings.Join(ss, " && ") + ")" +} + +func (ip intersectionPolicy) proto() *bttdpb.GcRule { + inter := &bttdpb.GcRule_Intersection{} + for _, sp := range ip.sub { + inter.Rules = append(inter.Rules, sp.proto()) + } + return &bttdpb.GcRule{ + Rule: &bttdpb.GcRule_Intersection_{Intersection: inter}, + } +} + +// UnionPolicy returns a GC policy that applies when any of its sub-policies apply. +func UnionPolicy(sub ...GCPolicy) GCPolicy { return unionPolicy{sub} } + +type unionPolicy struct { + sub []GCPolicy +} + +func (up unionPolicy) String() string { + var ss []string + for _, sp := range up.sub { + ss = append(ss, sp.String()) + } + return "(" + strings.Join(ss, " || ") + ")" +} + +func (up unionPolicy) proto() *bttdpb.GcRule { + union := &bttdpb.GcRule_Union{} + for _, sp := range up.sub { + union.Rules = append(union.Rules, sp.proto()) + } + return &bttdpb.GcRule{ + Rule: &bttdpb.GcRule_Union_{Union: union}, + } +} + +// MaxVersionsPolicy returns a GC policy that applies to all versions of a cell +// except for the most recent n. +func MaxVersionsPolicy(n int) GCPolicy { return maxVersionsPolicy(n) } + +type maxVersionsPolicy int + +func (mvp maxVersionsPolicy) String() string { return fmt.Sprintf("versions() > %d", int(mvp)) } + +func (mvp maxVersionsPolicy) proto() *bttdpb.GcRule { + return &bttdpb.GcRule{Rule: &bttdpb.GcRule_MaxNumVersions{MaxNumVersions: int32(mvp)}} +} + +// MaxAgePolicy returns a GC policy that applies to all cells +// older than the given age. +func MaxAgePolicy(d time.Duration) GCPolicy { return maxAgePolicy(d) } + +type maxAgePolicy time.Duration + +var units = []struct { + d time.Duration + suffix string +}{ + {24 * time.Hour, "d"}, + {time.Hour, "h"}, + {time.Minute, "m"}, +} + +func (ma maxAgePolicy) String() string { + d := time.Duration(ma) + for _, u := range units { + if d%u.d == 0 { + return fmt.Sprintf("age() > %d%s", d/u.d, u.suffix) + } + } + return fmt.Sprintf("age() > %d", d/time.Microsecond) +} + +func (ma maxAgePolicy) proto() *bttdpb.GcRule { + // This doesn't handle overflows, etc. + // Fix this if people care about GC policies over 290 years. + ns := time.Duration(ma).Nanoseconds() + return &bttdpb.GcRule{ + Rule: &bttdpb.GcRule_MaxAge{MaxAge: &durpb.Duration{ + Seconds: ns / 1e9, + Nanos: int32(ns % 1e9), + }}, + } +} + +type noGCPolicy struct{} + +func (n noGCPolicy) String() string { return "" } + +func (n noGCPolicy) proto() *bttdpb.GcRule { return &bttdpb.GcRule{Rule: nil} } + +// NoGcPolicy applies to all cells setting maxage and maxversions to nil implies no gc policies +func NoGcPolicy() GCPolicy { return noGCPolicy{} } + +// GCRuleToString converts the given GcRule proto to a user-visible string. +func GCRuleToString(rule *bttdpb.GcRule) string { + if rule == nil { + return "" + } + switch r := rule.Rule.(type) { + case *bttdpb.GcRule_MaxNumVersions: + return MaxVersionsPolicy(int(r.MaxNumVersions)).String() + case *bttdpb.GcRule_MaxAge: + return MaxAgePolicy(time.Duration(r.MaxAge.Seconds) * time.Second).String() + case *bttdpb.GcRule_Intersection_: + return joinRules(r.Intersection.Rules, " && ") + case *bttdpb.GcRule_Union_: + return joinRules(r.Union.Rules, " || ") + default: + return "" + } +} + +func joinRules(rules []*bttdpb.GcRule, sep string) string { + var chunks []string + for _, r := range rules { + chunks = append(chunks, GCRuleToString(r)) + } + return "(" + strings.Join(chunks, sep) + ")" +} diff --git a/vendor/cloud.google.com/go/bigtable/gc_test.go b/vendor/cloud.google.com/go/bigtable/gc_test.go new file mode 100644 index 000000000..70849ab41 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/gc_test.go @@ -0,0 +1,46 @@ +/* +Copyright 2017 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 bigtable + +import ( + "testing" + "time" + + bttdpb "google.golang.org/genproto/googleapis/bigtable/admin/v2" +) + +func TestGcRuleToString(t *testing.T) { + + intersection := IntersectionPolicy(MaxVersionsPolicy(5), MaxVersionsPolicy(10), MaxAgePolicy(16*time.Hour)) + + var tests = []struct { + proto *bttdpb.GcRule + want string + }{ + {MaxAgePolicy(72 * time.Hour).proto(), "age() > 3d"}, + {MaxVersionsPolicy(5).proto(), "versions() > 5"}, + {intersection.proto(), "(versions() > 5 && versions() > 10 && age() > 16h)"}, + {UnionPolicy(intersection, MaxAgePolicy(72*time.Hour)).proto(), + "((versions() > 5 && versions() > 10 && age() > 16h) || age() > 3d)"}, + } + + for _, test := range tests { + got := GCRuleToString(test.proto) + if got != test.want { + t.Errorf("got gc rule string: %v, wanted: %v", got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/bigtable/internal/cbtconfig/cbtconfig.go b/vendor/cloud.google.com/go/bigtable/internal/cbtconfig/cbtconfig.go new file mode 100644 index 000000000..f60c5e9f2 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/internal/cbtconfig/cbtconfig.go @@ -0,0 +1,262 @@ +/* +Copyright 2015 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 cbtconfig encapsulates common code for reading configuration from .cbtrc and gcloud. +package cbtconfig + +import ( + "bufio" + "bytes" + "crypto/tls" + "crypto/x509" + "encoding/json" + "flag" + "fmt" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "time" + + "golang.org/x/oauth2" + "google.golang.org/grpc/credentials" +) + +// Config represents a configuration. +type Config struct { + Project, Instance string // required + Creds string // optional + AdminEndpoint string // optional + DataEndpoint string // optional + CertFile string // optional + UserAgent string // optional + TokenSource oauth2.TokenSource // derived + TLSCreds credentials.TransportCredentials // derived +} + +// RequiredFlags describes the flag requirements for a cbt command. +type RequiredFlags uint + +const ( + // NoneRequired specifies that not flags are required. + NoneRequired RequiredFlags = 0 + // ProjectRequired specifies that the -project flag is required. + ProjectRequired RequiredFlags = 1 << iota + // InstanceRequired specifies that the -instance flag is required. + InstanceRequired + // ProjectAndInstanceRequired specifies that both -project and -instance is required. + ProjectAndInstanceRequired = ProjectRequired | InstanceRequired +) + +// RegisterFlags registers a set of standard flags for this config. +// It should be called before flag.Parse. +func (c *Config) RegisterFlags() { + flag.StringVar(&c.Project, "project", c.Project, "project ID, if unset uses gcloud configured project") + flag.StringVar(&c.Instance, "instance", c.Instance, "Cloud Bigtable instance") + flag.StringVar(&c.Creds, "creds", c.Creds, "if set, use application credentials in this file") + flag.StringVar(&c.AdminEndpoint, "admin-endpoint", c.AdminEndpoint, "Override the admin api endpoint") + flag.StringVar(&c.DataEndpoint, "data-endpoint", c.DataEndpoint, "Override the data api endpoint") + flag.StringVar(&c.CertFile, "cert-file", c.CertFile, "Override the TLS certificates file") + flag.StringVar(&c.UserAgent, "user-agent", c.UserAgent, "Override the user agent string") +} + +// CheckFlags checks that the required config values are set. +func (c *Config) CheckFlags(required RequiredFlags) error { + var missing []string + if c.CertFile != "" { + b, err := ioutil.ReadFile(c.CertFile) + if err != nil { + return fmt.Errorf("Failed to load certificates from %s: %v", c.CertFile, err) + } + + cp := x509.NewCertPool() + if !cp.AppendCertsFromPEM(b) { + return fmt.Errorf("Failed to append certificates from %s", c.CertFile) + } + + c.TLSCreds = credentials.NewTLS(&tls.Config{RootCAs: cp}) + } + if required != NoneRequired { + c.SetFromGcloud() + } + if required&ProjectRequired != 0 && c.Project == "" { + missing = append(missing, "-project") + } + if required&InstanceRequired != 0 && c.Instance == "" { + missing = append(missing, "-instance") + } + if len(missing) > 0 { + return fmt.Errorf("Missing %s", strings.Join(missing, " and ")) + } + return nil +} + +// Filename returns the filename consulted for standard configuration. +func Filename() string { + // TODO(dsymonds): Might need tweaking for Windows. + return filepath.Join(os.Getenv("HOME"), ".cbtrc") +} + +// Load loads a .cbtrc file. +// If the file is not present, an empty config is returned. +func Load() (*Config, error) { + filename := Filename() + data, err := ioutil.ReadFile(filename) + if err != nil { + // silent fail if the file isn't there + if os.IsNotExist(err) { + return &Config{}, nil + } + return nil, fmt.Errorf("Reading %s: %v", filename, err) + } + c := new(Config) + s := bufio.NewScanner(bytes.NewReader(data)) + for s.Scan() { + line := s.Text() + i := strings.Index(line, "=") + if i < 0 { + return nil, fmt.Errorf("Bad line in %s: %q", filename, line) + } + key, val := strings.TrimSpace(line[:i]), strings.TrimSpace(line[i+1:]) + switch key { + default: + return nil, fmt.Errorf("Unknown key in %s: %q", filename, key) + case "project": + c.Project = val + case "instance": + c.Instance = val + case "creds": + c.Creds = val + case "admin-endpoint": + c.AdminEndpoint = val + case "data-endpoint": + c.DataEndpoint = val + case "cert-file": + c.CertFile = val + case "user-agent": + c.UserAgent = val + } + + } + return c, s.Err() +} + +// GcloudCredential holds gcloud credential information. +type GcloudCredential struct { + AccessToken string `json:"access_token"` + Expiry time.Time `json:"token_expiry"` +} + +// Token creates an oauth2 token using gcloud credentials. +func (cred *GcloudCredential) Token() *oauth2.Token { + return &oauth2.Token{AccessToken: cred.AccessToken, TokenType: "Bearer", Expiry: cred.Expiry} +} + +// GcloudConfig holds gcloud configuration values. +type GcloudConfig struct { + Configuration struct { + Properties struct { + Core struct { + Project string `json:"project"` + } `json:"core"` + } `json:"properties"` + } `json:"configuration"` + Credential GcloudCredential `json:"credential"` +} + +// GcloudCmdTokenSource holds the comamnd arguments. It is only intended to be set by the program. +// TODO(deklerk) Can this be unexported? +type GcloudCmdTokenSource struct { + Command string + Args []string +} + +// Token implements the oauth2.TokenSource interface +func (g *GcloudCmdTokenSource) Token() (*oauth2.Token, error) { + gcloudConfig, err := LoadGcloudConfig(g.Command, g.Args) + if err != nil { + return nil, err + } + return gcloudConfig.Credential.Token(), nil +} + +// LoadGcloudConfig retrieves the gcloud configuration values we need use via the +// 'config-helper' command +func LoadGcloudConfig(gcloudCmd string, gcloudCmdArgs []string) (*GcloudConfig, error) { + out, err := exec.Command(gcloudCmd, gcloudCmdArgs...).Output() + if err != nil { + return nil, fmt.Errorf("Could not retrieve gcloud configuration") + } + + var gcloudConfig GcloudConfig + if err := json.Unmarshal(out, &gcloudConfig); err != nil { + return nil, fmt.Errorf("Could not parse gcloud configuration") + } + + return &gcloudConfig, nil +} + +// SetFromGcloud retrieves and sets any missing config values from the gcloud +// configuration if possible possible +func (c *Config) SetFromGcloud() error { + + if c.Creds == "" { + c.Creds = os.Getenv("GOOGLE_APPLICATION_CREDENTIALS") + if c.Creds == "" { + log.Printf("-creds flag unset, will use gcloud credential") + } + } else { + os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", c.Creds) + } + + if c.Project == "" { + log.Printf("-project flag unset, will use gcloud active project") + } + + if c.Creds != "" && c.Project != "" { + return nil + } + + gcloudCmd := "gcloud" + if runtime.GOOS == "windows" { + gcloudCmd = gcloudCmd + ".cmd" + } + + gcloudCmdArgs := []string{"config", "config-helper", + "--format=json(configuration.properties.core.project,credential)"} + + gcloudConfig, err := LoadGcloudConfig(gcloudCmd, gcloudCmdArgs) + if err != nil { + return err + } + + if c.Project == "" && gcloudConfig.Configuration.Properties.Core.Project != "" { + log.Printf("gcloud active project is \"%s\"", + gcloudConfig.Configuration.Properties.Core.Project) + c.Project = gcloudConfig.Configuration.Properties.Core.Project + } + + if c.Creds == "" { + c.TokenSource = oauth2.ReuseTokenSource( + gcloudConfig.Credential.Token(), + &GcloudCmdTokenSource{Command: gcloudCmd, Args: gcloudCmdArgs}) + } + + return nil +} diff --git a/vendor/cloud.google.com/go/bigtable/internal/gax/call_option.go b/vendor/cloud.google.com/go/bigtable/internal/gax/call_option.go new file mode 100644 index 000000000..79c580b00 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/internal/gax/call_option.go @@ -0,0 +1,110 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package gax is a snapshot from github.com/googleapis/gax-go with minor modifications. +package gax + +import ( + "time" + + "google.golang.org/grpc/codes" +) + +// CallOption is a generic interface for modifying the behavior of outbound calls. +type CallOption interface { + Resolve(*CallSettings) +} + +type callOptions []CallOption + +// Resolve resolves all call options individually. +func (opts callOptions) Resolve(s *CallSettings) *CallSettings { + for _, opt := range opts { + opt.Resolve(s) + } + return s +} + +// CallSettings encapsulates the call settings for a particular API call. +type CallSettings struct { + Timeout time.Duration + RetrySettings RetrySettings +} + +// RetrySettings are per-call configurable settings for retrying upon transient failure. +type RetrySettings struct { + RetryCodes map[codes.Code]bool + BackoffSettings BackoffSettings +} + +// BackoffSettings are parameters to the exponential backoff algorithm for retrying. +type BackoffSettings struct { + DelayTimeoutSettings MultipliableDuration + RPCTimeoutSettings MultipliableDuration +} + +// MultipliableDuration defines parameters for backoff settings. +type MultipliableDuration struct { + Initial time.Duration + Max time.Duration + Multiplier float64 +} + +// Resolve merges the receiver CallSettings into the given CallSettings. +func (w CallSettings) Resolve(s *CallSettings) { + s.Timeout = w.Timeout + s.RetrySettings = w.RetrySettings + + s.RetrySettings.RetryCodes = make(map[codes.Code]bool, len(w.RetrySettings.RetryCodes)) + for key, value := range w.RetrySettings.RetryCodes { + s.RetrySettings.RetryCodes[key] = value + } +} + +type withRetryCodes []codes.Code + +func (w withRetryCodes) Resolve(s *CallSettings) { + s.RetrySettings.RetryCodes = make(map[codes.Code]bool) + for _, code := range w { + s.RetrySettings.RetryCodes[code] = true + } +} + +// WithRetryCodes sets a list of Google API canonical error codes upon which a +// retry should be attempted. +func WithRetryCodes(retryCodes []codes.Code) CallOption { + return withRetryCodes(retryCodes) +} + +type withDelayTimeoutSettings MultipliableDuration + +func (w withDelayTimeoutSettings) Resolve(s *CallSettings) { + s.RetrySettings.BackoffSettings.DelayTimeoutSettings = MultipliableDuration(w) +} + +// WithDelayTimeoutSettings specifies: +// - The initial delay time, in milliseconds, between the completion of +// the first failed request and the initiation of the first retrying +// request. +// - The multiplier by which to increase the delay time between the +// completion of failed requests, and the initiation of the subsequent +// retrying request. +// - The maximum delay time, in milliseconds, between requests. When this +// value is reached, `RetryDelayMultiplier` will no longer be used to +// increase delay time. +func WithDelayTimeoutSettings(initial time.Duration, max time.Duration, multiplier float64) CallOption { + return withDelayTimeoutSettings(MultipliableDuration{initial, max, multiplier}) +} diff --git a/vendor/cloud.google.com/go/bigtable/internal/gax/invoke.go b/vendor/cloud.google.com/go/bigtable/internal/gax/invoke.go new file mode 100644 index 000000000..228dd4438 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/internal/gax/invoke.go @@ -0,0 +1,87 @@ +/* +Copyright 2015 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 gax is a snapshot from github.com/googleapis/gax-go with minor modifications. +package gax + +import ( + "context" + "log" + "math/rand" + "os" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +// Logger is a logger that logs to stderr. +var Logger = log.New(os.Stderr, "", log.LstdFlags) + +// APICall is a user defined call stub. +type APICall func(context.Context) error + +// scaleDuration returns the product of a and mult. +func scaleDuration(a time.Duration, mult float64) time.Duration { + ns := float64(a) * mult + return time.Duration(ns) +} + +// invokeWithRetry calls stub using an exponential backoff retry mechanism +// based on the values provided in callSettings. +func invokeWithRetry(ctx context.Context, stub APICall, callSettings CallSettings) error { + retrySettings := callSettings.RetrySettings + backoffSettings := callSettings.RetrySettings.BackoffSettings + delay := backoffSettings.DelayTimeoutSettings.Initial + for { + // If the deadline is exceeded... + if ctx.Err() != nil { + return ctx.Err() + } + err := stub(ctx) + code := grpc.Code(err) + if code == codes.OK { + return nil + } + + if !retrySettings.RetryCodes[code] { + return err + } + + // Sleep a random amount up to the current delay + d := time.Duration(rand.Int63n(int64(delay))) + delayCtx, _ := context.WithTimeout(ctx, delay) + if Logger != nil { + Logger.Printf("Retryable error: %v, retrying in %v", err, d) + } + <-delayCtx.Done() + + delay = scaleDuration(delay, backoffSettings.DelayTimeoutSettings.Multiplier) + if delay > backoffSettings.DelayTimeoutSettings.Max { + delay = backoffSettings.DelayTimeoutSettings.Max + } + } +} + +// Invoke calls stub with a child of context modified by the specified options. +func Invoke(ctx context.Context, stub APICall, opts ...CallOption) error { + settings := &CallSettings{} + callOptions(opts).Resolve(settings) + if len(settings.RetrySettings.RetryCodes) > 0 { + return invokeWithRetry(ctx, stub, *settings) + } + return stub(ctx) +} diff --git a/vendor/cloud.google.com/go/bigtable/internal/gax/invoke_test.go b/vendor/cloud.google.com/go/bigtable/internal/gax/invoke_test.go new file mode 100644 index 000000000..633ba6878 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/internal/gax/invoke_test.go @@ -0,0 +1,49 @@ +/* +Copyright 2015 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 gax + +import ( + "context" + "testing" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestRandomizedDelays(t *testing.T) { + max := 200 * time.Millisecond + settings := []CallOption{ + WithRetryCodes([]codes.Code{codes.Unavailable, codes.DeadlineExceeded}), + WithDelayTimeoutSettings(10*time.Millisecond, max, 1.5), + } + + deadline := time.Now().Add(1 * time.Second) + ctx, _ := context.WithDeadline(context.Background(), deadline) + var invokeTime time.Time + _ = Invoke(ctx, func(childCtx context.Context) error { + // Keep failing, make sure we never slept more than max (plus a fudge factor) + if !invokeTime.IsZero() { + if got, want := time.Since(invokeTime), max; got > (want + 20*time.Millisecond) { + t.Logf("Slept too long. Got: %v, want: %v", got, max) + } + } + invokeTime = time.Now() + // Workaround for `go vet`: https://github.com/grpc/grpc-go/issues/90 + errf := status.Errorf + return errf(codes.Unavailable, "") + }, settings...) +} diff --git a/vendor/cloud.google.com/go/bigtable/internal/option/option.go b/vendor/cloud.google.com/go/bigtable/internal/option/option.go new file mode 100644 index 000000000..d08698631 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/internal/option/option.go @@ -0,0 +1,48 @@ +/* +Copyright 2015 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 option contains common code for dealing with client options. +package option + +import ( + "fmt" + "os" + + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +// DefaultClientOptions returns the default client options to use for the +// client's gRPC connection. +func DefaultClientOptions(endpoint, scope, userAgent string) ([]option.ClientOption, error) { + var o []option.ClientOption + // Check the environment variables for the bigtable emulator. + // Dial it directly and don't pass any credentials. + if addr := os.Getenv("BIGTABLE_EMULATOR_HOST"); addr != "" { + conn, err := grpc.Dial(addr, grpc.WithInsecure()) + if err != nil { + return nil, fmt.Errorf("emulator grpc.Dial: %v", err) + } + o = []option.ClientOption{option.WithGRPCConn(conn)} + } else { + o = []option.ClientOption{ + option.WithEndpoint(endpoint), + option.WithScopes(scope), + option.WithUserAgent(userAgent), + } + } + return o, nil +} diff --git a/vendor/cloud.google.com/go/bigtable/internal/stat/stats.go b/vendor/cloud.google.com/go/bigtable/internal/stat/stats.go new file mode 100644 index 000000000..1470130a0 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/internal/stat/stats.go @@ -0,0 +1,150 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package stat + +import ( + "bytes" + "encoding/csv" + "fmt" + "io" + "math" + "sort" + "strconv" + "text/tabwriter" + "time" +) + +type byDuration []time.Duration + +func (data byDuration) Len() int { return len(data) } +func (data byDuration) Swap(i, j int) { data[i], data[j] = data[j], data[i] } +func (data byDuration) Less(i, j int) bool { return data[i] < data[j] } + +// quantile returns a value representing the kth of q quantiles. +// May alter the order of data. +func quantile(data []time.Duration, k, q int) (quantile time.Duration, ok bool) { + if len(data) < 1 { + return 0, false + } + if k > q { + return 0, false + } + if k < 0 || q < 1 { + return 0, false + } + + sort.Sort(byDuration(data)) + + if k == 0 { + return data[0], true + } + if k == q { + return data[len(data)-1], true + } + + bucketSize := float64(len(data)-1) / float64(q) + i := float64(k) * bucketSize + + lower := int(math.Trunc(i)) + var upper int + if i > float64(lower) && lower+1 < len(data) { + // If the quantile lies between two elements + upper = lower + 1 + } else { + upper = lower + } + weightUpper := i - float64(lower) + weightLower := 1 - weightUpper + return time.Duration(weightLower*float64(data[lower]) + weightUpper*float64(data[upper])), true +} + +// Aggregate is an aggregate of latencies. +type Aggregate struct { + Name string + Count, Errors int + Min, Median, Max time.Duration + P75, P90, P95, P99 time.Duration // percentiles +} + +// NewAggregate constructs an aggregate from latencies. Returns nil if latencies does not contain aggregateable data. +func NewAggregate(name string, latencies []time.Duration, errorCount int) *Aggregate { + agg := Aggregate{Name: name, Count: len(latencies), Errors: errorCount} + + if len(latencies) == 0 { + return nil + } + var ok bool + if agg.Min, ok = quantile(latencies, 0, 2); !ok { + return nil + } + if agg.Median, ok = quantile(latencies, 1, 2); !ok { + return nil + } + if agg.Max, ok = quantile(latencies, 2, 2); !ok { + return nil + } + if agg.P75, ok = quantile(latencies, 75, 100); !ok { + return nil + } + if agg.P90, ok = quantile(latencies, 90, 100); !ok { + return nil + } + if agg.P95, ok = quantile(latencies, 95, 100); !ok { + return nil + } + if agg.P99, ok = quantile(latencies, 99, 100); !ok { + return nil + } + return &agg +} + +func (agg *Aggregate) String() string { + if agg == nil { + return "no data" + } + var buf bytes.Buffer + tw := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', 0) // one-space padding + fmt.Fprintf(tw, "min:\t%v\nmedian:\t%v\nmax:\t%v\n95th percentile:\t%v\n99th percentile:\t%v\n", + agg.Min, agg.Median, agg.Max, agg.P95, agg.P99) + tw.Flush() + return buf.String() +} + +// WriteCSV writes a csv file to the given Writer, +// with a header row and one row per aggregate. +func WriteCSV(aggs []*Aggregate, iow io.Writer) (err error) { + w := csv.NewWriter(iow) + defer func() { + w.Flush() + if err == nil { + err = w.Error() + } + }() + err = w.Write([]string{"name", "count", "errors", "min", "median", "max", "p75", "p90", "p95", "p99"}) + if err != nil { + return err + } + for _, agg := range aggs { + err = w.Write([]string{ + agg.Name, strconv.Itoa(agg.Count), strconv.Itoa(agg.Errors), + agg.Min.String(), agg.Median.String(), agg.Max.String(), + agg.P75.String(), agg.P90.String(), agg.P95.String(), agg.P99.String(), + }) + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/cloud.google.com/go/bigtable/reader.go b/vendor/cloud.google.com/go/bigtable/reader.go new file mode 100644 index 000000000..c84a61e4e --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/reader.go @@ -0,0 +1,249 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package bigtable + +import ( + "bytes" + "fmt" + + btpb "google.golang.org/genproto/googleapis/bigtable/v2" +) + +// A Row is returned by ReadRows. The map is keyed by column family (the prefix +// of the column name before the colon). The values are the returned ReadItems +// for that column family in the order returned by Read. +type Row map[string][]ReadItem + +// Key returns the row's key, or "" if the row is empty. +func (r Row) Key() string { + for _, items := range r { + if len(items) > 0 { + return items[0].Row + } + } + return "" +} + +// A ReadItem is returned by Read. A ReadItem contains data from a specific row and column. +type ReadItem struct { + Row, Column string + Timestamp Timestamp + Value []byte +} + +// The current state of the read rows state machine. +type rrState int64 + +const ( + newRow rrState = iota + rowInProgress + cellInProgress +) + +// chunkReader handles cell chunks from the read rows response and combines +// them into full Rows. +type chunkReader struct { + state rrState + curKey []byte + curFam string + curQual []byte + curTS int64 + curVal []byte + curRow Row + lastKey string +} + +// newChunkReader returns a new chunkReader for handling read rows responses. +func newChunkReader() *chunkReader { + return &chunkReader{state: newRow} +} + +// Process takes a cell chunk and returns a new Row if the given chunk +// completes a Row, or nil otherwise. +func (cr *chunkReader) Process(cc *btpb.ReadRowsResponse_CellChunk) (Row, error) { + var row Row + switch cr.state { + case newRow: + if err := cr.validateNewRow(cc); err != nil { + return nil, err + } + + cr.curRow = make(Row) + cr.curKey = cc.RowKey + cr.curFam = cc.FamilyName.Value + cr.curQual = cc.Qualifier.Value + cr.curTS = cc.TimestampMicros + row = cr.handleCellValue(cc) + + case rowInProgress: + if err := cr.validateRowInProgress(cc); err != nil { + return nil, err + } + + if cc.GetResetRow() { + cr.resetToNewRow() + return nil, nil + } + + if cc.FamilyName != nil { + cr.curFam = cc.FamilyName.Value + } + if cc.Qualifier != nil { + cr.curQual = cc.Qualifier.Value + } + cr.curTS = cc.TimestampMicros + row = cr.handleCellValue(cc) + + case cellInProgress: + if err := cr.validateCellInProgress(cc); err != nil { + return nil, err + } + if cc.GetResetRow() { + cr.resetToNewRow() + return nil, nil + } + row = cr.handleCellValue(cc) + } + + return row, nil +} + +// Close must be called after all cell chunks from the response +// have been processed. An error will be returned if the reader is +// in an invalid state, in which case the error should be propagated to the caller. +func (cr *chunkReader) Close() error { + if cr.state != newRow { + return fmt.Errorf("invalid state for end of stream %q", cr.state) + } + return nil +} + +// handleCellValue returns a Row if the cell value includes a commit, otherwise nil. +func (cr *chunkReader) handleCellValue(cc *btpb.ReadRowsResponse_CellChunk) Row { + if cc.ValueSize > 0 { + // ValueSize is specified so expect a split value of ValueSize bytes + if cr.curVal == nil { + cr.curVal = make([]byte, 0, cc.ValueSize) + } + cr.curVal = append(cr.curVal, cc.Value...) + cr.state = cellInProgress + } else { + // This cell is either the complete value or the last chunk of a split + if cr.curVal == nil { + cr.curVal = cc.Value + } else { + cr.curVal = append(cr.curVal, cc.Value...) + } + cr.finishCell() + + if cc.GetCommitRow() { + return cr.commitRow() + } + cr.state = rowInProgress + } + + return nil +} + +func (cr *chunkReader) finishCell() { + ri := ReadItem{ + Row: string(cr.curKey), + Column: string(cr.curFam) + ":" + string(cr.curQual), + Timestamp: Timestamp(cr.curTS), + Value: cr.curVal, + } + cr.curRow[cr.curFam] = append(cr.curRow[cr.curFam], ri) + cr.curVal = nil +} + +func (cr *chunkReader) commitRow() Row { + row := cr.curRow + cr.lastKey = cr.curRow.Key() + cr.resetToNewRow() + return row +} + +func (cr *chunkReader) resetToNewRow() { + cr.curKey = nil + cr.curFam = "" + cr.curQual = nil + cr.curVal = nil + cr.curRow = nil + cr.curTS = 0 + cr.state = newRow +} + +func (cr *chunkReader) validateNewRow(cc *btpb.ReadRowsResponse_CellChunk) error { + if cc.GetResetRow() { + return fmt.Errorf("reset_row not allowed between rows") + } + if cc.RowKey == nil || cc.FamilyName == nil || cc.Qualifier == nil { + return fmt.Errorf("missing key field for new row %v", cc) + } + if cr.lastKey != "" && cr.lastKey >= string(cc.RowKey) { + return fmt.Errorf("out of order row key: %q, %q", cr.lastKey, string(cc.RowKey)) + } + return nil +} + +func (cr *chunkReader) validateRowInProgress(cc *btpb.ReadRowsResponse_CellChunk) error { + if err := cr.validateRowStatus(cc); err != nil { + return err + } + if cc.RowKey != nil && !bytes.Equal(cc.RowKey, cr.curKey) { + return fmt.Errorf("received new row key %q during existing row %q", cc.RowKey, cr.curKey) + } + if cc.FamilyName != nil && cc.Qualifier == nil { + return fmt.Errorf("family name %q specified without a qualifier", cc.FamilyName) + } + return nil +} + +func (cr *chunkReader) validateCellInProgress(cc *btpb.ReadRowsResponse_CellChunk) error { + if err := cr.validateRowStatus(cc); err != nil { + return err + } + if cr.curVal == nil { + return fmt.Errorf("no cached cell while CELL_IN_PROGRESS %v", cc) + } + if cc.GetResetRow() == false && cr.isAnyKeyPresent(cc) { + return fmt.Errorf("cell key components found while CELL_IN_PROGRESS %v", cc) + } + return nil +} + +func (cr *chunkReader) isAnyKeyPresent(cc *btpb.ReadRowsResponse_CellChunk) bool { + return cc.RowKey != nil || + cc.FamilyName != nil || + cc.Qualifier != nil || + cc.TimestampMicros != 0 +} + +// Validate a RowStatus, commit or reset, if present. +func (cr *chunkReader) validateRowStatus(cc *btpb.ReadRowsResponse_CellChunk) error { + // Resets can't be specified with any other part of a cell + if cc.GetResetRow() && (cr.isAnyKeyPresent(cc) || + cc.Value != nil || + cc.ValueSize != 0 || + cc.Labels != nil) { + return fmt.Errorf("reset must not be specified with other fields %v", cc) + } + if cc.GetCommitRow() && cc.ValueSize > 0 { + return fmt.Errorf("commit row found in between chunks in a cell") + } + return nil +} diff --git a/vendor/cloud.google.com/go/bigtable/reader_test.go b/vendor/cloud.google.com/go/bigtable/reader_test.go new file mode 100644 index 000000000..8264dc3e2 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/reader_test.go @@ -0,0 +1,350 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package bigtable + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "strings" + "testing" + + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/wrappers" + btspb "google.golang.org/genproto/googleapis/bigtable/v2" +) + +// Indicates that a field in the proto should be omitted, rather than included +// as a wrapped empty string. +const nilStr = "<>" + +func TestSingleCell(t *testing.T) { + cr := newChunkReader() + + // All in one cell + row, err := cr.Process(cc("rk", "fm", "col", 1, "value", 0, true)) + if err != nil { + t.Fatalf("Processing chunk: %v", err) + } + if row == nil { + t.Fatalf("Missing row") + } + if len(row["fm"]) != 1 { + t.Fatalf("Family name length mismatch %d, %d", 1, len(row["fm"])) + } + want := []ReadItem{ri("rk", "fm", "col", 1, "value")} + if !testutil.Equal(row["fm"], want) { + t.Fatalf("Incorrect ReadItem: got: %v\nwant: %v\n", row["fm"], want) + } + if err := cr.Close(); err != nil { + t.Fatalf("Close: %v", err) + } +} + +func TestMultipleCells(t *testing.T) { + cr := newChunkReader() + + mustProcess(t, cr, cc("rs", "fm1", "col1", 0, "val1", 0, false)) + mustProcess(t, cr, cc("rs", "fm1", "col1", 1, "val2", 0, false)) + mustProcess(t, cr, cc("rs", "fm1", "col2", 0, "val3", 0, false)) + mustProcess(t, cr, cc("rs", "fm2", "col1", 0, "val4", 0, false)) + row, err := cr.Process(cc("rs", "fm2", "col2", 1, "extralongval5", 0, true)) + if err != nil { + t.Fatalf("Processing chunk: %v", err) + } + if row == nil { + t.Fatalf("Missing row") + } + + want := []ReadItem{ + ri("rs", "fm1", "col1", 0, "val1"), + ri("rs", "fm1", "col1", 1, "val2"), + ri("rs", "fm1", "col2", 0, "val3"), + } + if !testutil.Equal(row["fm1"], want) { + t.Fatalf("Incorrect ReadItem: got: %v\nwant: %v\n", row["fm1"], want) + } + want = []ReadItem{ + ri("rs", "fm2", "col1", 0, "val4"), + ri("rs", "fm2", "col2", 1, "extralongval5"), + } + if !testutil.Equal(row["fm2"], want) { + t.Fatalf("Incorrect ReadItem: got: %v\nwant: %v\n", row["fm2"], want) + } + if err := cr.Close(); err != nil { + t.Fatalf("Close: %v", err) + } +} + +func TestSplitCells(t *testing.T) { + cr := newChunkReader() + + mustProcess(t, cr, cc("rs", "fm1", "col1", 0, "hello ", 11, false)) + mustProcess(t, cr, ccData("world", 0, false)) + row, err := cr.Process(cc("rs", "fm1", "col2", 0, "val2", 0, true)) + if err != nil { + t.Fatalf("Processing chunk: %v", err) + } + if row == nil { + t.Fatalf("Missing row") + } + + want := []ReadItem{ + ri("rs", "fm1", "col1", 0, "hello world"), + ri("rs", "fm1", "col2", 0, "val2"), + } + if !testutil.Equal(row["fm1"], want) { + t.Fatalf("Incorrect ReadItem: got: %v\nwant: %v\n", row["fm1"], want) + } + if err := cr.Close(); err != nil { + t.Fatalf("Close: %v", err) + } +} + +func TestMultipleRows(t *testing.T) { + cr := newChunkReader() + + row, err := cr.Process(cc("rs1", "fm1", "col1", 1, "val1", 0, true)) + if err != nil { + t.Fatalf("Processing chunk: %v", err) + } + want := []ReadItem{ri("rs1", "fm1", "col1", 1, "val1")} + if !testutil.Equal(row["fm1"], want) { + t.Fatalf("Incorrect ReadItem: got: %v\nwant: %v\n", row["fm1"], want) + } + + row, err = cr.Process(cc("rs2", "fm2", "col2", 2, "val2", 0, true)) + if err != nil { + t.Fatalf("Processing chunk: %v", err) + } + want = []ReadItem{ri("rs2", "fm2", "col2", 2, "val2")} + if !testutil.Equal(row["fm2"], want) { + t.Fatalf("Incorrect ReadItem: got: %v\nwant: %v\n", row["fm2"], want) + } + + if err := cr.Close(); err != nil { + t.Fatalf("Close: %v", err) + } +} + +func TestBlankQualifier(t *testing.T) { + cr := newChunkReader() + + row, err := cr.Process(cc("rs1", "fm1", "", 1, "val1", 0, true)) + if err != nil { + t.Fatalf("Processing chunk: %v", err) + } + want := []ReadItem{ri("rs1", "fm1", "", 1, "val1")} + if !testutil.Equal(row["fm1"], want) { + t.Fatalf("Incorrect ReadItem: got: %v\nwant: %v\n", row["fm1"], want) + } + + row, err = cr.Process(cc("rs2", "fm2", "col2", 2, "val2", 0, true)) + if err != nil { + t.Fatalf("Processing chunk: %v", err) + } + want = []ReadItem{ri("rs2", "fm2", "col2", 2, "val2")} + if !testutil.Equal(row["fm2"], want) { + t.Fatalf("Incorrect ReadItem: got: %v\nwant: %v\n", row["fm2"], want) + } + + if err := cr.Close(); err != nil { + t.Fatalf("Close: %v", err) + } +} + +func TestReset(t *testing.T) { + cr := newChunkReader() + mustProcess(t, cr, cc("rs", "fm1", "col1", 0, "val1", 0, false)) + mustProcess(t, cr, cc("rs", "fm1", "col1", 1, "val2", 0, false)) + mustProcess(t, cr, cc("rs", "fm1", "col2", 0, "val3", 0, false)) + mustProcess(t, cr, ccReset()) + row := mustProcess(t, cr, cc("rs1", "fm1", "col1", 1, "val1", 0, true)) + want := []ReadItem{ri("rs1", "fm1", "col1", 1, "val1")} + if !testutil.Equal(row["fm1"], want) { + t.Fatalf("Reset: got: %v\nwant: %v\n", row["fm1"], want) + } + if err := cr.Close(); err != nil { + t.Fatalf("Close: %v", err) + } +} + +func TestNewFamEmptyQualifier(t *testing.T) { + cr := newChunkReader() + + mustProcess(t, cr, cc("rs", "fm1", "col1", 0, "val1", 0, false)) + _, err := cr.Process(cc(nilStr, "fm2", nilStr, 0, "val2", 0, true)) + if err == nil { + t.Fatalf("Expected error on second chunk with no qualifier set") + } +} + +func mustProcess(t *testing.T, cr *chunkReader, cc *btspb.ReadRowsResponse_CellChunk) Row { + row, err := cr.Process(cc) + if err != nil { + t.Fatal(err) + } + return row +} + +// The read rows acceptance test reads a json file specifying a number of tests, +// each consisting of one or more cell chunk text protos and one or more resulting +// cells or errors. +type AcceptanceTest struct { + Tests []TestCase `json:"tests"` +} + +type TestCase struct { + Name string `json:"name"` + Chunks []string `json:"chunks"` + Results []TestResult `json:"results"` +} + +type TestResult struct { + RK string `json:"rk"` + FM string `json:"fm"` + Qual string `json:"qual"` + TS int64 `json:"ts"` + Value string `json:"value"` + Error bool `json:"error"` // If true, expect an error. Ignore any other field. +} + +func TestAcceptance(t *testing.T) { + testJSON, err := ioutil.ReadFile("./testdata/read-rows-acceptance-test.json") + if err != nil { + t.Fatalf("could not open acceptance test file %v", err) + } + + var accTest AcceptanceTest + err = json.Unmarshal(testJSON, &accTest) + if err != nil { + t.Fatalf("could not parse acceptance test file: %v", err) + } + + for _, test := range accTest.Tests { + runTestCase(t, test) + } +} + +func runTestCase(t *testing.T, test TestCase) { + // Increment an index into the result array as we get results + cr := newChunkReader() + var results []TestResult + var seenErr bool + for _, chunkText := range test.Chunks { + // Parse and pass each cell chunk to the ChunkReader + cc := &btspb.ReadRowsResponse_CellChunk{} + err := proto.UnmarshalText(chunkText, cc) + if err != nil { + t.Errorf("[%s] failed to unmarshal text proto: %s\n%s", test.Name, chunkText, err) + return + } + row, err := cr.Process(cc) + if err != nil { + results = append(results, TestResult{Error: true}) + seenErr = true + break + } else { + // Turn the Row into TestResults + for fm, ris := range row { + for _, ri := range ris { + tr := TestResult{ + RK: ri.Row, + FM: fm, + Qual: strings.Split(ri.Column, ":")[1], + TS: int64(ri.Timestamp), + Value: string(ri.Value), + } + results = append(results, tr) + } + } + } + } + + // Only Close if we don't have an error yet, otherwise Close: is expected. + if !seenErr { + err := cr.Close() + if err != nil { + results = append(results, TestResult{Error: true}) + } + } + + got := toSet(results) + want := toSet(test.Results) + if !testutil.Equal(got, want) { + t.Fatalf("[%s]: got: %v\nwant: %v\n", test.Name, got, want) + } +} + +func toSet(res []TestResult) map[TestResult]bool { + set := make(map[TestResult]bool) + for _, tr := range res { + set[tr] = true + } + return set +} + +// ri returns a ReadItem for the given components +func ri(rk string, fm string, qual string, ts int64, val string) ReadItem { + return ReadItem{Row: rk, Column: fmt.Sprintf("%s:%s", fm, qual), Value: []byte(val), Timestamp: Timestamp(ts)} +} + +// cc returns a CellChunk proto +func cc(rk string, fm string, qual string, ts int64, val string, size int32, commit bool) *btspb.ReadRowsResponse_CellChunk { + // The components of the cell key are wrapped and can be null or empty + var rkWrapper []byte + if rk == nilStr { + rkWrapper = nil + } else { + rkWrapper = []byte(rk) + } + + var fmWrapper *wrappers.StringValue + if fm != nilStr { + fmWrapper = &wrappers.StringValue{Value: fm} + } else { + fmWrapper = nil + } + + var qualWrapper *wrappers.BytesValue + if qual != nilStr { + qualWrapper = &wrappers.BytesValue{Value: []byte(qual)} + } else { + qualWrapper = nil + } + + return &btspb.ReadRowsResponse_CellChunk{ + RowKey: rkWrapper, + FamilyName: fmWrapper, + Qualifier: qualWrapper, + TimestampMicros: ts, + Value: []byte(val), + ValueSize: size, + RowStatus: &btspb.ReadRowsResponse_CellChunk_CommitRow{CommitRow: commit}} +} + +// ccData returns a CellChunk with only a value and size +func ccData(val string, size int32, commit bool) *btspb.ReadRowsResponse_CellChunk { + return cc(nilStr, nilStr, nilStr, 0, val, size, commit) +} + +// ccReset returns a CellChunk with RestRow set to true +func ccReset() *btspb.ReadRowsResponse_CellChunk { + return &btspb.ReadRowsResponse_CellChunk{ + RowStatus: &btspb.ReadRowsResponse_CellChunk_ResetRow{ResetRow: true}} +} diff --git a/vendor/cloud.google.com/go/bigtable/retry_test.go b/vendor/cloud.google.com/go/bigtable/retry_test.go new file mode 100644 index 000000000..9ffb6f961 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/retry_test.go @@ -0,0 +1,381 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package bigtable + +import ( + "context" + "strings" + "testing" + "time" + + "cloud.google.com/go/bigtable/bttest" + "cloud.google.com/go/bigtable/internal/gax" + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/ptypes/wrappers" + "github.com/google/go-cmp/cmp" + "google.golang.org/api/option" + btpb "google.golang.org/genproto/googleapis/bigtable/v2" + rpcpb "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func setupFakeServer(opt ...grpc.ServerOption) (tbl *Table, cleanup func(), err error) { + srv, err := bttest.NewServer("localhost:0", opt...) + if err != nil { + return nil, nil, err + } + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure(), grpc.WithBlock()) + if err != nil { + return nil, nil, err + } + + client, err := NewClient(context.Background(), "client", "instance", option.WithGRPCConn(conn), option.WithGRPCDialOption(grpc.WithBlock())) + if err != nil { + return nil, nil, err + } + + adminClient, err := NewAdminClient(context.Background(), "client", "instance", option.WithGRPCConn(conn), option.WithGRPCDialOption(grpc.WithBlock())) + if err != nil { + return nil, nil, err + } + if err := adminClient.CreateTable(context.Background(), "table"); err != nil { + return nil, nil, err + } + if err := adminClient.CreateColumnFamily(context.Background(), "table", "cf"); err != nil { + return nil, nil, err + } + t := client.Open("table") + + cleanupFunc := func() { + adminClient.Close() + client.Close() + srv.Close() + } + return t, cleanupFunc, nil +} + +func TestRetryApply(t *testing.T) { + gax.Logger = nil + ctx := context.Background() + + errCount := 0 + code := codes.Unavailable // Will be retried + // Intercept requests and return an error or defer to the underlying handler + errInjector := func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { + if strings.HasSuffix(info.FullMethod, "MutateRow") && errCount < 3 { + errCount++ + return nil, status.Errorf(code, "") + } + return handler(ctx, req) + } + tbl, cleanup, err := setupFakeServer(grpc.UnaryInterceptor(errInjector)) + if err != nil { + t.Fatalf("fake server setup: %v", err) + } + defer cleanup() + + mut := NewMutation() + mut.Set("cf", "col", 1000, []byte("val")) + if err := tbl.Apply(ctx, "row1", mut); err != nil { + t.Errorf("applying single mutation with retries: %v", err) + } + row, err := tbl.ReadRow(ctx, "row1") + if err != nil { + t.Errorf("reading single value with retries: %v", err) + } + if row == nil { + t.Errorf("applying single mutation with retries: could not read back row") + } + + code = codes.FailedPrecondition // Won't be retried + errCount = 0 + if err := tbl.Apply(ctx, "row", mut); err == nil { + t.Errorf("applying single mutation with no retries: no error") + } + + // Check and mutate + mutTrue := NewMutation() + mutTrue.DeleteRow() + mutFalse := NewMutation() + mutFalse.Set("cf", "col", 1000, []byte("val")) + condMut := NewCondMutation(ValueFilter(".*"), mutTrue, mutFalse) + + errCount = 0 + code = codes.Unavailable // Will be retried + if err := tbl.Apply(ctx, "row1", condMut); err != nil { + t.Errorf("conditionally mutating row with retries: %v", err) + } + row, err = tbl.ReadRow(ctx, "row1") // row1 already in the table + if err != nil { + t.Errorf("reading single value after conditional mutation: %v", err) + } + if row != nil { + t.Errorf("reading single value after conditional mutation: row not deleted") + } + + errCount = 0 + code = codes.FailedPrecondition // Won't be retried + if err := tbl.Apply(ctx, "row", condMut); err == nil { + t.Errorf("conditionally mutating row with no retries: no error") + } +} + +func TestRetryApplyBulk(t *testing.T) { + ctx := context.Background() + gax.Logger = nil + + // Intercept requests and delegate to an interceptor defined by the test case + errCount := 0 + var f func(grpc.ServerStream) error + errInjector := func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { + if strings.HasSuffix(info.FullMethod, "MutateRows") { + return f(ss) + } + return handler(ctx, ss) + } + + tbl, cleanup, err := setupFakeServer(grpc.StreamInterceptor(errInjector)) + defer cleanup() + if err != nil { + t.Fatalf("fake server setup: %v", err) + } + + errCount = 0 + // Test overall request failure and retries + f = func(ss grpc.ServerStream) error { + if errCount < 3 { + errCount++ + return status.Errorf(codes.Aborted, "") + } + return nil + } + mut := NewMutation() + mut.Set("cf", "col", 1, []byte{}) + errors, err := tbl.ApplyBulk(ctx, []string{"row2"}, []*Mutation{mut}) + if errors != nil || err != nil { + t.Errorf("bulk with request failure: got: %v, %v, want: nil", errors, err) + } + + // Test failures and retries in one request + errCount = 0 + m1 := NewMutation() + m1.Set("cf", "col", 1, []byte{}) + m2 := NewMutation() + m2.Set("cf", "col2", 1, []byte{}) + m3 := NewMutation() + m3.Set("cf", "col3", 1, []byte{}) + f = func(ss grpc.ServerStream) error { + var err error + req := new(btpb.MutateRowsRequest) + must(ss.RecvMsg(req)) + switch errCount { + case 0: + // Retryable request failure + err = status.Errorf(codes.Unavailable, "") + case 1: + // Two mutations fail + must(writeMutateRowsResponse(ss, codes.Unavailable, codes.OK, codes.Aborted)) + err = nil + case 2: + // Two failures were retried. One will succeed. + if want, got := 2, len(req.Entries); want != got { + t.Errorf("2 bulk retries, got: %d, want %d", got, want) + } + must(writeMutateRowsResponse(ss, codes.OK, codes.Aborted)) + err = nil + case 3: + // One failure was retried and will succeed. + if want, got := 1, len(req.Entries); want != got { + t.Errorf("1 bulk retry, got: %d, want %d", got, want) + } + must(writeMutateRowsResponse(ss, codes.OK)) + err = nil + } + errCount++ + return err + } + errors, err = tbl.ApplyBulk(ctx, []string{"row1", "row2", "row3"}, []*Mutation{m1, m2, m3}) + if errors != nil || err != nil { + t.Errorf("bulk with retries: got: %v, %v, want: nil", errors, err) + } + + // Test unretryable errors + niMut := NewMutation() + niMut.Set("cf", "col", ServerTime, []byte{}) // Non-idempotent + errCount = 0 + f = func(ss grpc.ServerStream) error { + var err error + req := new(btpb.MutateRowsRequest) + must(ss.RecvMsg(req)) + switch errCount { + case 0: + // Give non-idempotent mutation a retryable error code. + // Nothing should be retried. + must(writeMutateRowsResponse(ss, codes.FailedPrecondition, codes.Aborted)) + err = nil + case 1: + t.Errorf("unretryable errors: got one retry, want no retries") + } + errCount++ + return err + } + errors, err = tbl.ApplyBulk(ctx, []string{"row1", "row2"}, []*Mutation{m1, niMut}) + if err != nil { + t.Errorf("unretryable errors: request failed %v", err) + } + want := []error{ + status.Errorf(codes.FailedPrecondition, ""), + status.Errorf(codes.Aborted, ""), + } + if !testutil.Equal(want, errors) { + t.Errorf("unretryable errors: got: %v, want: %v", errors, want) + } + + // Test individual errors and a deadline exceeded + f = func(ss grpc.ServerStream) error { + return writeMutateRowsResponse(ss, codes.FailedPrecondition, codes.OK, codes.Aborted) + } + ctx, _ = context.WithTimeout(ctx, 100*time.Millisecond) + errors, err = tbl.ApplyBulk(ctx, []string{"row1", "row2", "row3"}, []*Mutation{m1, m2, m3}) + wantErr := context.DeadlineExceeded + if wantErr != err { + t.Errorf("deadline exceeded error: got: %v, want: %v", err, wantErr) + } + if errors != nil { + t.Errorf("deadline exceeded errors: got: %v, want: nil", err) + } +} + +func writeMutateRowsResponse(ss grpc.ServerStream, codes ...codes.Code) error { + res := &btpb.MutateRowsResponse{Entries: make([]*btpb.MutateRowsResponse_Entry, len(codes))} + for i, code := range codes { + res.Entries[i] = &btpb.MutateRowsResponse_Entry{ + Index: int64(i), + Status: &rpcpb.Status{Code: int32(code), Message: ""}, + } + } + return ss.SendMsg(res) +} + +func TestRetainRowsAfter(t *testing.T) { + prevRowRange := NewRange("a", "z") + prevRowKey := "m" + want := NewRange("m\x00", "z") + got := prevRowRange.retainRowsAfter(prevRowKey) + if !testutil.Equal(want, got, cmp.AllowUnexported(RowRange{})) { + t.Errorf("range retry: got %v, want %v", got, want) + } + + prevRowRangeList := RowRangeList{NewRange("a", "d"), NewRange("e", "g"), NewRange("h", "l")} + prevRowKey = "f" + wantRowRangeList := RowRangeList{NewRange("f\x00", "g"), NewRange("h", "l")} + got = prevRowRangeList.retainRowsAfter(prevRowKey) + if !testutil.Equal(wantRowRangeList, got, cmp.AllowUnexported(RowRange{})) { + t.Errorf("range list retry: got %v, want %v", got, wantRowRangeList) + } + + prevRowList := RowList{"a", "b", "c", "d", "e", "f"} + prevRowKey = "b" + wantList := RowList{"c", "d", "e", "f"} + got = prevRowList.retainRowsAfter(prevRowKey) + if !testutil.Equal(wantList, got) { + t.Errorf("list retry: got %v, want %v", got, wantList) + } +} + +func TestRetryReadRows(t *testing.T) { + ctx := context.Background() + gax.Logger = nil + + // Intercept requests and delegate to an interceptor defined by the test case + errCount := 0 + var f func(grpc.ServerStream) error + errInjector := func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { + if strings.HasSuffix(info.FullMethod, "ReadRows") { + return f(ss) + } + return handler(ctx, ss) + } + + tbl, cleanup, err := setupFakeServer(grpc.StreamInterceptor(errInjector)) + defer cleanup() + if err != nil { + t.Fatalf("fake server setup: %v", err) + } + + errCount = 0 + // Test overall request failure and retries + f = func(ss grpc.ServerStream) error { + var err error + req := new(btpb.ReadRowsRequest) + must(ss.RecvMsg(req)) + switch errCount { + case 0: + // Retryable request failure + err = status.Errorf(codes.Unavailable, "") + case 1: + // Write two rows then error + if want, got := "a", string(req.Rows.RowRanges[0].GetStartKeyClosed()); want != got { + t.Errorf("first retry, no data received yet: got %q, want %q", got, want) + } + must(writeReadRowsResponse(ss, "a", "b")) + err = status.Errorf(codes.Unavailable, "") + case 2: + // Retryable request failure + if want, got := "b\x00", string(req.Rows.RowRanges[0].GetStartKeyClosed()); want != got { + t.Errorf("2 range retries: got %q, want %q", got, want) + } + err = status.Errorf(codes.Unavailable, "") + case 3: + // Write two more rows + must(writeReadRowsResponse(ss, "c", "d")) + err = nil + } + errCount++ + return err + } + + var got []string + must(tbl.ReadRows(ctx, NewRange("a", "z"), func(r Row) bool { + got = append(got, r.Key()) + return true + })) + want := []string{"a", "b", "c", "d"} + if !testutil.Equal(got, want) { + t.Errorf("retry range integration: got %v, want %v", got, want) + } +} + +func writeReadRowsResponse(ss grpc.ServerStream, rowKeys ...string) error { + var chunks []*btpb.ReadRowsResponse_CellChunk + for _, key := range rowKeys { + chunks = append(chunks, &btpb.ReadRowsResponse_CellChunk{ + RowKey: []byte(key), + FamilyName: &wrappers.StringValue{Value: "fm"}, + Qualifier: &wrappers.BytesValue{Value: []byte("col")}, + RowStatus: &btpb.ReadRowsResponse_CellChunk_CommitRow{CommitRow: true}, + }) + } + return ss.SendMsg(&btpb.ReadRowsResponse{Chunks: chunks}) +} + +func must(err error) { + if err != nil { + panic(err) + } +} diff --git a/vendor/cloud.google.com/go/bigtable/testdata/read-rows-acceptance-test.json b/vendor/cloud.google.com/go/bigtable/testdata/read-rows-acceptance-test.json new file mode 100644 index 000000000..4973831f4 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/testdata/read-rows-acceptance-test.json @@ -0,0 +1,1178 @@ +{ + "tests": [ + { + "name": "invalid - no commit", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - no cell key before commit", + "chunks": [ + "commit_row: true\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - no cell key before value", + "chunks": [ + "timestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - new col family must specify qualifier", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "family_name: \u003c\n value: \"B\"\n\u003e\ntimestamp_micros: 102\nvalue: \"value-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "bare commit implies ts=0", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n", + "commit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 0, + "value": "", + "label": "", + "error": false + } + ] + }, + { + "name": "simple row with timestamp", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + } + ] + }, + { + "name": "missing timestamp, implied ts=0", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 0, + "value": "value-VAL", + "label": "", + "error": false + } + ] + }, + { + "name": "empty cell value", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 0, + "value": "", + "label": "", + "error": false + } + ] + }, + { + "name": "two unsplit cells", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "timestamp_micros: 102\nvalue: \"value-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "two qualifiers", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "qualifier: \u003c\n value: \"D\"\n\u003e\ntimestamp_micros: 102\nvalue: \"value-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "D", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "two families", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "family_name: \u003c\n value: \"B\"\n\u003e\nqualifier: \u003c\n value: \"E\"\n\u003e\ntimestamp_micros: 102\nvalue: \"value-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "B", + "qual": "E", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "with labels", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nlabels: \"L_1\"\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "timestamp_micros: 102\nlabels: \"L_2\"\nvalue: \"value-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "L_1", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 102, + "value": "value-VAL_2", + "label": "L_2", + "error": false + } + ] + }, + { + "name": "split cell, bare commit", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL\"\ncommit_row: false\n", + "commit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 0, + "value": "", + "label": "", + "error": false + } + ] + }, + { + "name": "split cell", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + } + ] + }, + { + "name": "split four ways", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nlabels: \"L\"\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"a\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"l\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"ue-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "L", + "error": false + } + ] + }, + { + "name": "two split cells", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL_1\"\ncommit_row: false\n", + "timestamp_micros: 102\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "multi-qualifier splits", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL_1\"\ncommit_row: false\n", + "qualifier: \u003c\n value: \"D\"\n\u003e\ntimestamp_micros: 102\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "D", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "multi-qualifier multi-split", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"a\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"lue-VAL_1\"\ncommit_row: false\n", + "qualifier: \u003c\n value: \"D\"\n\u003e\ntimestamp_micros: 102\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"a\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"lue-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "D", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "multi-family split", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL_1\"\ncommit_row: false\n", + "family_name: \u003c\n value: \"B\"\n\u003e\nqualifier: \u003c\n value: \"E\"\n\u003e\ntimestamp_micros: 102\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "B", + "qual": "E", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "invalid - no commit between rows", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - no commit after first row", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - last row missing commit", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + }, + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - duplicate row key", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n", + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"B\"\n\u003e\nqualifier: \u003c\n value: \"D\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + }, + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - new row missing row key", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n", + "timestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + }, + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "two rows", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + } + ] + }, + { + "name": "two rows implicit timestamp", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\nvalue: \"value-VAL\"\ncommit_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 0, + "value": "value-VAL", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + } + ] + }, + { + "name": "two rows empty value", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ncommit_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 0, + "value": "", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + } + ] + }, + { + "name": "two rows, one with multiple cells", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "timestamp_micros: 102\nvalue: \"value-VAL_2\"\ncommit_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"B\"\n\u003e\nqualifier: \u003c\n value: \"D\"\n\u003e\ntimestamp_micros: 103\nvalue: \"value-VAL_3\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "B", + "qual": "D", + "ts": 103, + "value": "value-VAL_3", + "label": "", + "error": false + } + ] + }, + { + "name": "two rows, multiple cells", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "qualifier: \u003c\n value: \"D\"\n\u003e\ntimestamp_micros: 102\nvalue: \"value-VAL_2\"\ncommit_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"B\"\n\u003e\nqualifier: \u003c\n value: \"E\"\n\u003e\ntimestamp_micros: 103\nvalue: \"value-VAL_3\"\ncommit_row: false\n", + "qualifier: \u003c\n value: \"F\"\n\u003e\ntimestamp_micros: 104\nvalue: \"value-VAL_4\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK_1", + "fm": "A", + "qual": "D", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "B", + "qual": "E", + "ts": 103, + "value": "value-VAL_3", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "B", + "qual": "F", + "ts": 104, + "value": "value-VAL_4", + "label": "", + "error": false + } + ] + }, + { + "name": "two rows, multiple cells, multiple families", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "family_name: \u003c\n value: \"B\"\n\u003e\nqualifier: \u003c\n value: \"E\"\n\u003e\ntimestamp_micros: 102\nvalue: \"value-VAL_2\"\ncommit_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"M\"\n\u003e\nqualifier: \u003c\n value: \"O\"\n\u003e\ntimestamp_micros: 103\nvalue: \"value-VAL_3\"\ncommit_row: false\n", + "family_name: \u003c\n value: \"N\"\n\u003e\nqualifier: \u003c\n value: \"P\"\n\u003e\ntimestamp_micros: 104\nvalue: \"value-VAL_4\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK_1", + "fm": "B", + "qual": "E", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "M", + "qual": "O", + "ts": 103, + "value": "value-VAL_3", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "N", + "qual": "P", + "ts": 104, + "value": "value-VAL_4", + "label": "", + "error": false + } + ] + }, + { + "name": "two rows, four cells, 2 labels", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 101\nlabels: \"L_1\"\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "timestamp_micros: 102\nvalue: \"value-VAL_2\"\ncommit_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"B\"\n\u003e\nqualifier: \u003c\n value: \"D\"\n\u003e\ntimestamp_micros: 103\nlabels: \"L_3\"\nvalue: \"value-VAL_3\"\ncommit_row: false\n", + "timestamp_micros: 104\nvalue: \"value-VAL_4\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 101, + "value": "value-VAL_1", + "label": "L_1", + "error": false + }, + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 102, + "value": "value-VAL_2", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "B", + "qual": "D", + "ts": 103, + "value": "value-VAL_3", + "label": "L_3", + "error": false + }, + { + "rk": "RK_2", + "fm": "B", + "qual": "D", + "ts": 104, + "value": "value-VAL_4", + "label": "", + "error": false + } + ] + }, + { + "name": "two rows with splits, same timestamp", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL_1\"\ncommit_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"alue-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL_1", + "label": "", + "error": false + }, + { + "rk": "RK_2", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "invalid - bare reset", + "chunks": [ + "reset_row: true\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - bad reset, no commit", + "chunks": [ + "reset_row: true\n", + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - missing key after reset", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n", + "reset_row: true\n", + "timestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "no data after reset", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n", + "reset_row: true\n" + ], + "results": null + }, + { + "name": "simple reset", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + } + ] + }, + { + "name": "reset to new val", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "reset to new qual", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"D\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_1\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "D", + "ts": 100, + "value": "value-VAL_1", + "label": "", + "error": false + } + ] + }, + { + "name": "reset with splits", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "timestamp_micros: 102\nvalue: \"value-VAL_2\"\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "reset two cells", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_2\"\ncommit_row: false\n", + "timestamp_micros: 103\nvalue: \"value-VAL_3\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL_2", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 103, + "value": "value-VAL_3", + "label": "", + "error": false + } + ] + }, + { + "name": "two resets", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_2\"\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_3\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL_3", + "label": "", + "error": false + } + ] + }, + { + "name": "reset then two cells", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"B\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_2\"\ncommit_row: false\n", + "qualifier: \u003c\n value: \"D\"\n\u003e\ntimestamp_micros: 103\nvalue: \"value-VAL_3\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "B", + "qual": "C", + "ts": 100, + "value": "value-VAL_2", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "B", + "qual": "D", + "ts": 103, + "value": "value-VAL_3", + "label": "", + "error": false + } + ] + }, + { + "name": "reset to new row", + "chunks": [ + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_1\"\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK_2\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_2\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_2", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL_2", + "label": "", + "error": false + } + ] + }, + { + "name": "reset in between chunks", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nlabels: \"L\"\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"a\"\nvalue_size: 10\ncommit_row: false\n", + "reset_row: true\n", + "row_key: \"RK_1\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL_1\"\ncommit_row: true\n" + ], + "results": [ + { + "rk": "RK_1", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL_1", + "label": "", + "error": false + } + ] + }, + { + "name": "invalid - reset with chunk", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nlabels: \"L\"\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"a\"\nvalue_size: 10\nreset_row: true\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "invalid - commit with chunk", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nlabels: \"L\"\nvalue: \"v\"\nvalue_size: 10\ncommit_row: false\n", + "value: \"a\"\nvalue_size: 10\ncommit_row: true\n" + ], + "results": [ + { + "rk": "", + "fm": "", + "qual": "", + "ts": 0, + "value": "", + "label": "", + "error": true + } + ] + }, + { + "name": "empty cell chunk", + "chunks": [ + "row_key: \"RK\"\nfamily_name: \u003c\n value: \"A\"\n\u003e\nqualifier: \u003c\n value: \"C\"\n\u003e\ntimestamp_micros: 100\nvalue: \"value-VAL\"\ncommit_row: false\n", + "commit_row: false\n", + "commit_row: true\n" + ], + "results": [ + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 100, + "value": "value-VAL", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 0, + "value": "", + "label": "", + "error": false + }, + { + "rk": "RK", + "fm": "A", + "qual": "C", + "ts": 0, + "value": "", + "label": "", + "error": false + } + ] + } + ] +} \ No newline at end of file diff --git a/vendor/cloud.google.com/go/bigtable/trace.go b/vendor/cloud.google.com/go/bigtable/trace.go new file mode 100644 index 000000000..6c579b185 --- /dev/null +++ b/vendor/cloud.google.com/go/bigtable/trace.go @@ -0,0 +1,57 @@ +// 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. + +package bigtable + +import ( + "context" + "fmt" + + "go.opencensus.io/trace" +) + +func traceStartSpan(ctx context.Context, name string) context.Context { + ctx, _ = trace.StartSpan(ctx, name) + return ctx +} + +func traceEndSpan(ctx context.Context, err error) { + span := trace.FromContext(ctx) + if err != nil { + span.SetStatus(trace.Status{Message: err.Error()}) + } + + span.End() +} + +func tracePrintf(ctx context.Context, attrMap map[string]interface{}, format string, args ...interface{}) { + var attrs []trace.Attribute + for k, v := range attrMap { + var a trace.Attribute + switch v := v.(type) { + case string: + a = trace.StringAttribute(k, v) + case bool: + a = trace.BoolAttribute(k, v) + case int: + a = trace.Int64Attribute(k, int64(v)) + case int64: + a = trace.Int64Attribute(k, v) + default: + a = trace.StringAttribute(k, fmt.Sprintf("%#v", v)) + } + attrs = append(attrs, a) + } + trace.FromContext(ctx).Annotatef(attrs, format, args...) +} diff --git a/vendor/cloud.google.com/go/civil/civil.go b/vendor/cloud.google.com/go/civil/civil.go new file mode 100644 index 000000000..29272ef26 --- /dev/null +++ b/vendor/cloud.google.com/go/civil/civil.go @@ -0,0 +1,277 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package civil implements types for civil time, a time-zone-independent +// representation of time that follows the rules of the proleptic +// Gregorian calendar with exactly 24-hour days, 60-minute hours, and 60-second +// minutes. +// +// Because they lack location information, these types do not represent unique +// moments or intervals of time. Use time.Time for that purpose. +package civil + +import ( + "fmt" + "time" +) + +// A Date represents a date (year, month, day). +// +// This type does not include location information, and therefore does not +// describe a unique 24-hour timespan. +type Date struct { + Year int // Year (e.g., 2014). + Month time.Month // Month of the year (January = 1, ...). + Day int // Day of the month, starting at 1. +} + +// DateOf returns the Date in which a time occurs in that time's location. +func DateOf(t time.Time) Date { + var d Date + d.Year, d.Month, d.Day = t.Date() + return d +} + +// ParseDate parses a string in RFC3339 full-date format and returns the date value it represents. +func ParseDate(s string) (Date, error) { + t, err := time.Parse("2006-01-02", s) + if err != nil { + return Date{}, err + } + return DateOf(t), nil +} + +// String returns the date in RFC3339 full-date format. +func (d Date) String() string { + return fmt.Sprintf("%04d-%02d-%02d", d.Year, d.Month, d.Day) +} + +// IsValid reports whether the date is valid. +func (d Date) IsValid() bool { + return DateOf(d.In(time.UTC)) == d +} + +// In returns the time corresponding to time 00:00:00 of the date in the location. +// +// In is always consistent with time.Date, even when time.Date returns a time +// on a different day. For example, if loc is America/Indiana/Vincennes, then both +// time.Date(1955, time.May, 1, 0, 0, 0, 0, loc) +// and +// civil.Date{Year: 1955, Month: time.May, Day: 1}.In(loc) +// return 23:00:00 on April 30, 1955. +// +// In panics if loc is nil. +func (d Date) In(loc *time.Location) time.Time { + return time.Date(d.Year, d.Month, d.Day, 0, 0, 0, 0, loc) +} + +// AddDays returns the date that is n days in the future. +// n can also be negative to go into the past. +func (d Date) AddDays(n int) Date { + return DateOf(d.In(time.UTC).AddDate(0, 0, n)) +} + +// DaysSince returns the signed number of days between the date and s, not including the end day. +// This is the inverse operation to AddDays. +func (d Date) DaysSince(s Date) (days int) { + // We convert to Unix time so we do not have to worry about leap seconds: + // Unix time increases by exactly 86400 seconds per day. + deltaUnix := d.In(time.UTC).Unix() - s.In(time.UTC).Unix() + return int(deltaUnix / 86400) +} + +// Before reports whether d1 occurs before d2. +func (d1 Date) Before(d2 Date) bool { + if d1.Year != d2.Year { + return d1.Year < d2.Year + } + if d1.Month != d2.Month { + return d1.Month < d2.Month + } + return d1.Day < d2.Day +} + +// After reports whether d1 occurs after d2. +func (d1 Date) After(d2 Date) bool { + return d2.Before(d1) +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The output is the result of d.String(). +func (d Date) MarshalText() ([]byte, error) { + return []byte(d.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// The date is expected to be a string in a format accepted by ParseDate. +func (d *Date) UnmarshalText(data []byte) error { + var err error + *d, err = ParseDate(string(data)) + return err +} + +// A Time represents a time with nanosecond precision. +// +// This type does not include location information, and therefore does not +// describe a unique moment in time. +// +// This type exists to represent the TIME type in storage-based APIs like BigQuery. +// Most operations on Times are unlikely to be meaningful. Prefer the DateTime type. +type Time struct { + Hour int // The hour of the day in 24-hour format; range [0-23] + Minute int // The minute of the hour; range [0-59] + Second int // The second of the minute; range [0-59] + Nanosecond int // The nanosecond of the second; range [0-999999999] +} + +// TimeOf returns the Time representing the time of day in which a time occurs +// in that time's location. It ignores the date. +func TimeOf(t time.Time) Time { + var tm Time + tm.Hour, tm.Minute, tm.Second = t.Clock() + tm.Nanosecond = t.Nanosecond() + return tm +} + +// ParseTime parses a string and returns the time value it represents. +// ParseTime accepts an extended form of the RFC3339 partial-time format. After +// the HH:MM:SS part of the string, an optional fractional part may appear, +// consisting of a decimal point followed by one to nine decimal digits. +// (RFC3339 admits only one digit after the decimal point). +func ParseTime(s string) (Time, error) { + t, err := time.Parse("15:04:05.999999999", s) + if err != nil { + return Time{}, err + } + return TimeOf(t), nil +} + +// String returns the date in the format described in ParseTime. If Nanoseconds +// is zero, no fractional part will be generated. Otherwise, the result will +// end with a fractional part consisting of a decimal point and nine digits. +func (t Time) String() string { + s := fmt.Sprintf("%02d:%02d:%02d", t.Hour, t.Minute, t.Second) + if t.Nanosecond == 0 { + return s + } + return s + fmt.Sprintf(".%09d", t.Nanosecond) +} + +// IsValid reports whether the time is valid. +func (t Time) IsValid() bool { + // Construct a non-zero time. + tm := time.Date(2, 2, 2, t.Hour, t.Minute, t.Second, t.Nanosecond, time.UTC) + return TimeOf(tm) == t +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The output is the result of t.String(). +func (t Time) MarshalText() ([]byte, error) { + return []byte(t.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// The time is expected to be a string in a format accepted by ParseTime. +func (t *Time) UnmarshalText(data []byte) error { + var err error + *t, err = ParseTime(string(data)) + return err +} + +// A DateTime represents a date and time. +// +// This type does not include location information, and therefore does not +// describe a unique moment in time. +type DateTime struct { + Date Date + Time Time +} + +// Note: We deliberately do not embed Date into DateTime, to avoid promoting AddDays and Sub. + +// DateTimeOf returns the DateTime in which a time occurs in that time's location. +func DateTimeOf(t time.Time) DateTime { + return DateTime{ + Date: DateOf(t), + Time: TimeOf(t), + } +} + +// ParseDateTime parses a string and returns the DateTime it represents. +// ParseDateTime accepts a variant of the RFC3339 date-time format that omits +// the time offset but includes an optional fractional time, as described in +// ParseTime. Informally, the accepted format is +// YYYY-MM-DDTHH:MM:SS[.FFFFFFFFF] +// where the 'T' may be a lower-case 't'. +func ParseDateTime(s string) (DateTime, error) { + t, err := time.Parse("2006-01-02T15:04:05.999999999", s) + if err != nil { + t, err = time.Parse("2006-01-02t15:04:05.999999999", s) + if err != nil { + return DateTime{}, err + } + } + return DateTimeOf(t), nil +} + +// String returns the date in the format described in ParseDate. +func (dt DateTime) String() string { + return dt.Date.String() + "T" + dt.Time.String() +} + +// IsValid reports whether the datetime is valid. +func (dt DateTime) IsValid() bool { + return dt.Date.IsValid() && dt.Time.IsValid() +} + +// In returns the time corresponding to the DateTime in the given location. +// +// If the time is missing or ambigous at the location, In returns the same +// result as time.Date. For example, if loc is America/Indiana/Vincennes, then +// both +// time.Date(1955, time.May, 1, 0, 30, 0, 0, loc) +// and +// civil.DateTime{ +// civil.Date{Year: 1955, Month: time.May, Day: 1}}, +// civil.Time{Minute: 30}}.In(loc) +// return 23:30:00 on April 30, 1955. +// +// In panics if loc is nil. +func (dt DateTime) In(loc *time.Location) time.Time { + return time.Date(dt.Date.Year, dt.Date.Month, dt.Date.Day, dt.Time.Hour, dt.Time.Minute, dt.Time.Second, dt.Time.Nanosecond, loc) +} + +// Before reports whether dt1 occurs before dt2. +func (dt1 DateTime) Before(dt2 DateTime) bool { + return dt1.In(time.UTC).Before(dt2.In(time.UTC)) +} + +// After reports whether dt1 occurs after dt2. +func (dt1 DateTime) After(dt2 DateTime) bool { + return dt2.Before(dt1) +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The output is the result of dt.String(). +func (dt DateTime) MarshalText() ([]byte, error) { + return []byte(dt.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// The datetime is expected to be a string in a format accepted by ParseDateTime +func (dt *DateTime) UnmarshalText(data []byte) error { + var err error + *dt, err = ParseDateTime(string(data)) + return err +} diff --git a/vendor/cloud.google.com/go/civil/civil_test.go b/vendor/cloud.google.com/go/civil/civil_test.go new file mode 100644 index 000000000..0720092e2 --- /dev/null +++ b/vendor/cloud.google.com/go/civil/civil_test.go @@ -0,0 +1,442 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package civil + +import ( + "encoding/json" + "testing" + "time" + + "github.com/google/go-cmp/cmp" +) + +func TestDates(t *testing.T) { + for _, test := range []struct { + date Date + loc *time.Location + wantStr string + wantTime time.Time + }{ + { + date: Date{2014, 7, 29}, + loc: time.Local, + wantStr: "2014-07-29", + wantTime: time.Date(2014, time.July, 29, 0, 0, 0, 0, time.Local), + }, + { + date: DateOf(time.Date(2014, 8, 20, 15, 8, 43, 1, time.Local)), + loc: time.UTC, + wantStr: "2014-08-20", + wantTime: time.Date(2014, 8, 20, 0, 0, 0, 0, time.UTC), + }, + { + date: DateOf(time.Date(999, time.January, 26, 0, 0, 0, 0, time.Local)), + loc: time.UTC, + wantStr: "0999-01-26", + wantTime: time.Date(999, 1, 26, 0, 0, 0, 0, time.UTC), + }, + } { + if got := test.date.String(); got != test.wantStr { + t.Errorf("%#v.String() = %q, want %q", test.date, got, test.wantStr) + } + if got := test.date.In(test.loc); !got.Equal(test.wantTime) { + t.Errorf("%#v.In(%v) = %v, want %v", test.date, test.loc, got, test.wantTime) + } + } +} + +func TestDateIsValid(t *testing.T) { + for _, test := range []struct { + date Date + want bool + }{ + {Date{2014, 7, 29}, true}, + {Date{2000, 2, 29}, true}, + {Date{10000, 12, 31}, true}, + {Date{1, 1, 1}, true}, + {Date{0, 1, 1}, true}, // year zero is OK + {Date{-1, 1, 1}, true}, // negative year is OK + {Date{1, 0, 1}, false}, + {Date{1, 1, 0}, false}, + {Date{2016, 1, 32}, false}, + {Date{2016, 13, 1}, false}, + {Date{1, -1, 1}, false}, + {Date{1, 1, -1}, false}, + } { + got := test.date.IsValid() + if got != test.want { + t.Errorf("%#v: got %t, want %t", test.date, got, test.want) + } + } +} + +func TestParseDate(t *testing.T) { + for _, test := range []struct { + str string + want Date // if empty, expect an error + }{ + {"2016-01-02", Date{2016, 1, 2}}, + {"2016-12-31", Date{2016, 12, 31}}, + {"0003-02-04", Date{3, 2, 4}}, + {"999-01-26", Date{}}, + {"", Date{}}, + {"2016-01-02x", Date{}}, + } { + got, err := ParseDate(test.str) + if got != test.want { + t.Errorf("ParseDate(%q) = %+v, want %+v", test.str, got, test.want) + } + if err != nil && test.want != (Date{}) { + t.Errorf("Unexpected error %v from ParseDate(%q)", err, test.str) + } + } +} + +func TestDateArithmetic(t *testing.T) { + for _, test := range []struct { + desc string + start Date + end Date + days int + }{ + { + desc: "zero days noop", + start: Date{2014, 5, 9}, + end: Date{2014, 5, 9}, + days: 0, + }, + { + desc: "crossing a year boundary", + start: Date{2014, 12, 31}, + end: Date{2015, 1, 1}, + days: 1, + }, + { + desc: "negative number of days", + start: Date{2015, 1, 1}, + end: Date{2014, 12, 31}, + days: -1, + }, + { + desc: "full leap year", + start: Date{2004, 1, 1}, + end: Date{2005, 1, 1}, + days: 366, + }, + { + desc: "full non-leap year", + start: Date{2001, 1, 1}, + end: Date{2002, 1, 1}, + days: 365, + }, + { + desc: "crossing a leap second", + start: Date{1972, 6, 30}, + end: Date{1972, 7, 1}, + days: 1, + }, + { + desc: "dates before the unix epoch", + start: Date{101, 1, 1}, + end: Date{102, 1, 1}, + days: 365, + }, + } { + if got := test.start.AddDays(test.days); got != test.end { + t.Errorf("[%s] %#v.AddDays(%v) = %#v, want %#v", test.desc, test.start, test.days, got, test.end) + } + if got := test.end.DaysSince(test.start); got != test.days { + t.Errorf("[%s] %#v.Sub(%#v) = %v, want %v", test.desc, test.end, test.start, got, test.days) + } + } +} + +func TestDateBefore(t *testing.T) { + for _, test := range []struct { + d1, d2 Date + want bool + }{ + {Date{2016, 12, 31}, Date{2017, 1, 1}, true}, + {Date{2016, 1, 1}, Date{2016, 1, 1}, false}, + {Date{2016, 12, 30}, Date{2016, 12, 31}, true}, + } { + if got := test.d1.Before(test.d2); got != test.want { + t.Errorf("%v.Before(%v): got %t, want %t", test.d1, test.d2, got, test.want) + } + } +} + +func TestDateAfter(t *testing.T) { + for _, test := range []struct { + d1, d2 Date + want bool + }{ + {Date{2016, 12, 31}, Date{2017, 1, 1}, false}, + {Date{2016, 1, 1}, Date{2016, 1, 1}, false}, + {Date{2016, 12, 30}, Date{2016, 12, 31}, false}, + } { + if got := test.d1.After(test.d2); got != test.want { + t.Errorf("%v.After(%v): got %t, want %t", test.d1, test.d2, got, test.want) + } + } +} + +func TestTimeToString(t *testing.T) { + for _, test := range []struct { + str string + time Time + roundTrip bool // ParseTime(str).String() == str? + }{ + {"13:26:33", Time{13, 26, 33, 0}, true}, + {"01:02:03.000023456", Time{1, 2, 3, 23456}, true}, + {"00:00:00.000000001", Time{0, 0, 0, 1}, true}, + {"13:26:03.1", Time{13, 26, 3, 100000000}, false}, + {"13:26:33.0000003", Time{13, 26, 33, 300}, false}, + } { + gotTime, err := ParseTime(test.str) + if err != nil { + t.Errorf("ParseTime(%q): got error: %v", test.str, err) + continue + } + if gotTime != test.time { + t.Errorf("ParseTime(%q) = %+v, want %+v", test.str, gotTime, test.time) + } + if test.roundTrip { + gotStr := test.time.String() + if gotStr != test.str { + t.Errorf("%#v.String() = %q, want %q", test.time, gotStr, test.str) + } + } + } +} + +func TestTimeOf(t *testing.T) { + for _, test := range []struct { + time time.Time + want Time + }{ + {time.Date(2014, 8, 20, 15, 8, 43, 1, time.Local), Time{15, 8, 43, 1}}, + {time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC), Time{0, 0, 0, 0}}, + } { + if got := TimeOf(test.time); got != test.want { + t.Errorf("TimeOf(%v) = %+v, want %+v", test.time, got, test.want) + } + } +} + +func TestTimeIsValid(t *testing.T) { + for _, test := range []struct { + time Time + want bool + }{ + {Time{0, 0, 0, 0}, true}, + {Time{23, 0, 0, 0}, true}, + {Time{23, 59, 59, 999999999}, true}, + {Time{24, 59, 59, 999999999}, false}, + {Time{23, 60, 59, 999999999}, false}, + {Time{23, 59, 60, 999999999}, false}, + {Time{23, 59, 59, 1000000000}, false}, + {Time{-1, 0, 0, 0}, false}, + {Time{0, -1, 0, 0}, false}, + {Time{0, 0, -1, 0}, false}, + {Time{0, 0, 0, -1}, false}, + } { + got := test.time.IsValid() + if got != test.want { + t.Errorf("%#v: got %t, want %t", test.time, got, test.want) + } + } +} + +func TestDateTimeToString(t *testing.T) { + for _, test := range []struct { + str string + dateTime DateTime + roundTrip bool // ParseDateTime(str).String() == str? + }{ + {"2016-03-22T13:26:33", DateTime{Date{2016, 03, 22}, Time{13, 26, 33, 0}}, true}, + {"2016-03-22T13:26:33.000000600", DateTime{Date{2016, 03, 22}, Time{13, 26, 33, 600}}, true}, + {"2016-03-22t13:26:33", DateTime{Date{2016, 03, 22}, Time{13, 26, 33, 0}}, false}, + } { + gotDateTime, err := ParseDateTime(test.str) + if err != nil { + t.Errorf("ParseDateTime(%q): got error: %v", test.str, err) + continue + } + if gotDateTime != test.dateTime { + t.Errorf("ParseDateTime(%q) = %+v, want %+v", test.str, gotDateTime, test.dateTime) + } + if test.roundTrip { + gotStr := test.dateTime.String() + if gotStr != test.str { + t.Errorf("%#v.String() = %q, want %q", test.dateTime, gotStr, test.str) + } + } + } +} + +func TestParseDateTimeErrors(t *testing.T) { + for _, str := range []string{ + "", + "2016-03-22", // just a date + "13:26:33", // just a time + "2016-03-22 13:26:33", // wrong separating character + "2016-03-22T13:26:33x", // extra at end + } { + if _, err := ParseDateTime(str); err == nil { + t.Errorf("ParseDateTime(%q) succeeded, want error", str) + } + } +} + +func TestDateTimeOf(t *testing.T) { + for _, test := range []struct { + time time.Time + want DateTime + }{ + {time.Date(2014, 8, 20, 15, 8, 43, 1, time.Local), + DateTime{Date{2014, 8, 20}, Time{15, 8, 43, 1}}}, + {time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC), + DateTime{Date{1, 1, 1}, Time{0, 0, 0, 0}}}, + } { + if got := DateTimeOf(test.time); got != test.want { + t.Errorf("DateTimeOf(%v) = %+v, want %+v", test.time, got, test.want) + } + } +} + +func TestDateTimeIsValid(t *testing.T) { + // No need to be exhaustive here; it's just Date.IsValid && Time.IsValid. + for _, test := range []struct { + dt DateTime + want bool + }{ + {DateTime{Date{2016, 3, 20}, Time{0, 0, 0, 0}}, true}, + {DateTime{Date{2016, -3, 20}, Time{0, 0, 0, 0}}, false}, + {DateTime{Date{2016, 3, 20}, Time{24, 0, 0, 0}}, false}, + } { + got := test.dt.IsValid() + if got != test.want { + t.Errorf("%#v: got %t, want %t", test.dt, got, test.want) + } + } +} + +func TestDateTimeIn(t *testing.T) { + dt := DateTime{Date{2016, 1, 2}, Time{3, 4, 5, 6}} + got := dt.In(time.UTC) + want := time.Date(2016, 1, 2, 3, 4, 5, 6, time.UTC) + if !got.Equal(want) { + t.Errorf("got %v, want %v", got, want) + } +} + +func TestDateTimeBefore(t *testing.T) { + d1 := Date{2016, 12, 31} + d2 := Date{2017, 1, 1} + t1 := Time{5, 6, 7, 8} + t2 := Time{5, 6, 7, 9} + for _, test := range []struct { + dt1, dt2 DateTime + want bool + }{ + {DateTime{d1, t1}, DateTime{d2, t1}, true}, + {DateTime{d1, t1}, DateTime{d1, t2}, true}, + {DateTime{d2, t1}, DateTime{d1, t1}, false}, + {DateTime{d2, t1}, DateTime{d2, t1}, false}, + } { + if got := test.dt1.Before(test.dt2); got != test.want { + t.Errorf("%v.Before(%v): got %t, want %t", test.dt1, test.dt2, got, test.want) + } + } +} + +func TestDateTimeAfter(t *testing.T) { + d1 := Date{2016, 12, 31} + d2 := Date{2017, 1, 1} + t1 := Time{5, 6, 7, 8} + t2 := Time{5, 6, 7, 9} + for _, test := range []struct { + dt1, dt2 DateTime + want bool + }{ + {DateTime{d1, t1}, DateTime{d2, t1}, false}, + {DateTime{d1, t1}, DateTime{d1, t2}, false}, + {DateTime{d2, t1}, DateTime{d1, t1}, true}, + {DateTime{d2, t1}, DateTime{d2, t1}, false}, + } { + if got := test.dt1.After(test.dt2); got != test.want { + t.Errorf("%v.After(%v): got %t, want %t", test.dt1, test.dt2, got, test.want) + } + } +} + +func TestMarshalJSON(t *testing.T) { + for _, test := range []struct { + value interface{} + want string + }{ + {Date{1987, 4, 15}, `"1987-04-15"`}, + {Time{18, 54, 2, 0}, `"18:54:02"`}, + {DateTime{Date{1987, 4, 15}, Time{18, 54, 2, 0}}, `"1987-04-15T18:54:02"`}, + } { + bgot, err := json.Marshal(test.value) + if err != nil { + t.Fatal(err) + } + if got := string(bgot); got != test.want { + t.Errorf("%#v: got %s, want %s", test.value, got, test.want) + } + } +} + +func TestUnmarshalJSON(t *testing.T) { + var d Date + var tm Time + var dt DateTime + for _, test := range []struct { + data string + ptr interface{} + want interface{} + }{ + {`"1987-04-15"`, &d, &Date{1987, 4, 15}}, + {`"1987-04-\u0031\u0035"`, &d, &Date{1987, 4, 15}}, + {`"18:54:02"`, &tm, &Time{18, 54, 2, 0}}, + {`"1987-04-15T18:54:02"`, &dt, &DateTime{Date{1987, 4, 15}, Time{18, 54, 2, 0}}}, + } { + if err := json.Unmarshal([]byte(test.data), test.ptr); err != nil { + t.Fatalf("%s: %v", test.data, err) + } + if !cmp.Equal(test.ptr, test.want) { + t.Errorf("%s: got %#v, want %#v", test.data, test.ptr, test.want) + } + } + + for _, bad := range []string{"", `""`, `"bad"`, `"1987-04-15x"`, + `19870415`, // a JSON number + `11987-04-15x`, // not a JSON string + + } { + if json.Unmarshal([]byte(bad), &d) == nil { + t.Errorf("%q, Date: got nil, want error", bad) + } + if json.Unmarshal([]byte(bad), &tm) == nil { + t.Errorf("%q, Time: got nil, want error", bad) + } + if json.Unmarshal([]byte(bad), &dt) == nil { + t.Errorf("%q, DateTime: got nil, want error", bad) + } + } +} diff --git a/vendor/cloud.google.com/go/cloud.go b/vendor/cloud.google.com/go/cloud.go new file mode 100644 index 000000000..9cf75c5e1 --- /dev/null +++ b/vendor/cloud.google.com/go/cloud.go @@ -0,0 +1,79 @@ +// 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/GoogleCloudPlatform/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". + +*/ +package cloud // import "cloud.google.com/go" diff --git a/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/cloud_tasks_client.go b/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/cloud_tasks_client.go new file mode 100644 index 000000000..0a2d93e49 --- /dev/null +++ b/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/cloud_tasks_client.go @@ -0,0 +1,784 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package cloudtasks + +import ( + "context" + "fmt" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2" + iampb "google.golang.org/genproto/googleapis/iam/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + ListQueues []gax.CallOption + GetQueue []gax.CallOption + CreateQueue []gax.CallOption + UpdateQueue []gax.CallOption + DeleteQueue []gax.CallOption + PurgeQueue []gax.CallOption + PauseQueue []gax.CallOption + ResumeQueue []gax.CallOption + GetIamPolicy []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption + ListTasks []gax.CallOption + GetTask []gax.CallOption + CreateTask []gax.CallOption + DeleteTask []gax.CallOption + LeaseTasks []gax.CallOption + AcknowledgeTask []gax.CallOption + RenewLease []gax.CallOption + CancelLease []gax.CallOption + RunTask []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cloudtasks.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + ListQueues: retry[[2]string{"default", "idempotent"}], + GetQueue: retry[[2]string{"default", "idempotent"}], + CreateQueue: retry[[2]string{"default", "non_idempotent"}], + UpdateQueue: retry[[2]string{"default", "non_idempotent"}], + DeleteQueue: retry[[2]string{"default", "idempotent"}], + PurgeQueue: retry[[2]string{"default", "non_idempotent"}], + PauseQueue: retry[[2]string{"default", "non_idempotent"}], + ResumeQueue: retry[[2]string{"default", "non_idempotent"}], + GetIamPolicy: retry[[2]string{"default", "idempotent"}], + SetIamPolicy: retry[[2]string{"default", "non_idempotent"}], + TestIamPermissions: retry[[2]string{"default", "idempotent"}], + ListTasks: retry[[2]string{"default", "idempotent"}], + GetTask: retry[[2]string{"default", "idempotent"}], + CreateTask: retry[[2]string{"default", "non_idempotent"}], + DeleteTask: retry[[2]string{"default", "idempotent"}], + LeaseTasks: retry[[2]string{"default", "non_idempotent"}], + AcknowledgeTask: retry[[2]string{"default", "non_idempotent"}], + RenewLease: retry[[2]string{"default", "non_idempotent"}], + CancelLease: retry[[2]string{"default", "non_idempotent"}], + RunTask: retry[[2]string{"default", "non_idempotent"}], + } +} + +// Client is a client for interacting with Cloud Tasks API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client taskspb.CloudTasksClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new cloud tasks client. +// +// Cloud Tasks allows developers to manage the execution of background +// work in their applications. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: taskspb.NewCloudTasksClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListQueues lists queues. +// +// Queues are returned in lexicographical order. +func (c *Client) ListQueues(ctx context.Context, req *taskspb.ListQueuesRequest, opts ...gax.CallOption) *QueueIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListQueues[0:len(c.CallOptions.ListQueues):len(c.CallOptions.ListQueues)], opts...) + it := &QueueIterator{} + req = proto.Clone(req).(*taskspb.ListQueuesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*taskspb.Queue, string, error) { + var resp *taskspb.ListQueuesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListQueues(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Queues, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetQueue gets a queue. +func (c *Client) GetQueue(ctx context.Context, req *taskspb.GetQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetQueue[0:len(c.CallOptions.GetQueue):len(c.CallOptions.GetQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateQueue creates a queue. +// +// Queues created with this method allow tasks to live for a maximum of 31 +// days. After a task is 31 days old, the task will be deleted regardless of whether +// it was dispatched or not. +// +// WARNING: Using this method may have unintended side effects if you are +// using an App Engine queue.yaml or queue.xml file to manage your queues. +// Read +// Overview of Queue Management and queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml) +// before using this method. +func (c *Client) CreateQueue(ctx context.Context, req *taskspb.CreateQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateQueue[0:len(c.CallOptions.CreateQueue):len(c.CallOptions.CreateQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateQueue updates a queue. +// +// This method creates the queue if it does not exist and updates +// the queue if it does exist. +// +// Queues created with this method allow tasks to live for a maximum of 31 +// days. After a task is 31 days old, the task will be deleted regardless of whether +// it was dispatched or not. +// +// WARNING: Using this method may have unintended side effects if you are +// using an App Engine queue.yaml or queue.xml file to manage your queues. +// Read +// Overview of Queue Management and queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml) +// before using this method. +func (c *Client) UpdateQueue(ctx context.Context, req *taskspb.UpdateQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "queue.name", req.GetQueue().GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateQueue[0:len(c.CallOptions.UpdateQueue):len(c.CallOptions.UpdateQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteQueue deletes a queue. +// +// This command will delete the queue even if it has tasks in it. +// +// Note: If you delete a queue, a queue with the same name can't be created +// for 7 days. +// +// WARNING: Using this method may have unintended side effects if you are +// using an App Engine queue.yaml or queue.xml file to manage your queues. +// Read +// Overview of Queue Management and queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml) +// before using this method. +func (c *Client) DeleteQueue(ctx context.Context, req *taskspb.DeleteQueueRequest, opts ...gax.CallOption) error { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteQueue[0:len(c.CallOptions.DeleteQueue):len(c.CallOptions.DeleteQueue)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// PurgeQueue purges a queue by deleting all of its tasks. +// +// All tasks created before this method is called are permanently deleted. +// +// Purge operations can take up to one minute to take effect. Tasks +// might be dispatched before the purge takes effect. A purge is irreversible. +func (c *Client) PurgeQueue(ctx context.Context, req *taskspb.PurgeQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.PurgeQueue[0:len(c.CallOptions.PurgeQueue):len(c.CallOptions.PurgeQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.PurgeQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// PauseQueue pauses the queue. +// +// If a queue is paused then the system will stop dispatching tasks +// until the queue is resumed via +// [ResumeQueue][google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue]. Tasks can still be added +// when the queue is paused. A queue is paused if its +// [state][google.cloud.tasks.v2beta2.Queue.state] is [PAUSED][google.cloud.tasks.v2beta2.Queue.State.PAUSED]. +func (c *Client) PauseQueue(ctx context.Context, req *taskspb.PauseQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.PauseQueue[0:len(c.CallOptions.PauseQueue):len(c.CallOptions.PauseQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.PauseQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ResumeQueue resume a queue. +// +// This method resumes a queue after it has been +// [PAUSED][google.cloud.tasks.v2beta2.Queue.State.PAUSED] or +// [DISABLED][google.cloud.tasks.v2beta2.Queue.State.DISABLED]. The state of a queue is stored +// in the queue's [state][google.cloud.tasks.v2beta2.Queue.state]; after calling this method it +// will be set to [RUNNING][google.cloud.tasks.v2beta2.Queue.State.RUNNING]. +// +// WARNING: Resuming many high-QPS queues at the same time can +// lead to target overloading. If you are resuming high-QPS +// queues, follow the 500/50/5 pattern described in +// Managing Cloud Tasks Scaling Risks (at https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). +func (c *Client) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ResumeQueue[0:len(c.CallOptions.ResumeQueue):len(c.CallOptions.ResumeQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ResumeQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetIamPolicy gets the access control policy for a [Queue][google.cloud.tasks.v2beta2.Queue]. +// Returns an empty policy if the resource exists and does not have a policy +// set. +// +// Authorization requires the following +// Google IAM (at https://cloud.google.com/iam) permission on the specified +// resource parent: +// +// cloudtasks.queues.getIamPolicy +func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", req.GetResource())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetIamPolicy[0:len(c.CallOptions.GetIamPolicy):len(c.CallOptions.GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetIamPolicy sets the access control policy for a [Queue][google.cloud.tasks.v2beta2.Queue]. Replaces any existing +// policy. +// +// Note: The Cloud Console does not check queue-level IAM permissions yet. +// Project-level permissions are required to use the Cloud Console. +// +// Authorization requires the following +// Google IAM (at https://cloud.google.com/iam) permission on the specified +// resource parent: +// +// cloudtasks.queues.setIamPolicy +func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", req.GetResource())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.SetIamPolicy[0:len(c.CallOptions.SetIamPolicy):len(c.CallOptions.SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// TestIamPermissions returns permissions that a caller has on a [Queue][google.cloud.tasks.v2beta2.Queue]. +// If the resource does not exist, this will return an empty set of +// permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. +// +// Note: This operation is designed to be used for building permission-aware +// UIs and command-line tools, not for authorization checking. This operation +// may "fail open" without warning. +func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", req.GetResource())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.TestIamPermissions[0:len(c.CallOptions.TestIamPermissions):len(c.CallOptions.TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListTasks lists the tasks in a queue. +// +// By default, only the [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC] view is retrieved +// due to performance considerations; +// [response_view][google.cloud.tasks.v2beta2.ListTasksRequest.response_view] controls the +// subset of information which is returned. +// +// The tasks may be returned in any order. The ordering may change at any +// time. +func (c *Client) ListTasks(ctx context.Context, req *taskspb.ListTasksRequest, opts ...gax.CallOption) *TaskIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListTasks[0:len(c.CallOptions.ListTasks):len(c.CallOptions.ListTasks)], opts...) + it := &TaskIterator{} + req = proto.Clone(req).(*taskspb.ListTasksRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*taskspb.Task, string, error) { + var resp *taskspb.ListTasksResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListTasks(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Tasks, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetTask gets a task. +func (c *Client) GetTask(ctx context.Context, req *taskspb.GetTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetTask[0:len(c.CallOptions.GetTask):len(c.CallOptions.GetTask)], opts...) + var resp *taskspb.Task + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetTask(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateTask creates a task and adds it to a queue. +// +// Tasks cannot be updated after creation; there is no UpdateTask command. +// +// For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum task size is +// 100KB. +// +// For [pull queues][google.cloud.tasks.v2beta2.PullTarget], the maximum task size is 1MB. +func (c *Client) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateTask[0:len(c.CallOptions.CreateTask):len(c.CallOptions.CreateTask)], opts...) + var resp *taskspb.Task + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateTask(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteTask deletes a task. +// +// A task can be deleted if it is scheduled or dispatched. A task +// cannot be deleted if it has completed successfully or permanently +// failed. +func (c *Client) DeleteTask(ctx context.Context, req *taskspb.DeleteTaskRequest, opts ...gax.CallOption) error { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteTask[0:len(c.CallOptions.DeleteTask):len(c.CallOptions.DeleteTask)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteTask(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// LeaseTasks leases tasks from a pull queue for +// [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration]. +// +// This method is invoked by the worker to obtain a lease. The +// worker must acknowledge the task via +// [AcknowledgeTask][google.cloud.tasks.v2beta2.CloudTasks.AcknowledgeTask] after they have +// performed the work associated with the task. +// +// The [payload][google.cloud.tasks.v2beta2.PullMessage.payload] is intended to store data that +// the worker needs to perform the work associated with the task. To +// return the payloads in the [response][google.cloud.tasks.v2beta2.LeaseTasksResponse], set +// [response_view][google.cloud.tasks.v2beta2.LeaseTasksRequest.response_view] to +// [FULL][google.cloud.tasks.v2beta2.Task.View.FULL]. +// +// A maximum of 10 qps of [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] +// requests are allowed per +// queue. [RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED] +// is returned when this limit is +// exceeded. [RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED] +// is also returned when +// [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second] +// is exceeded. +func (c *Client) LeaseTasks(ctx context.Context, req *taskspb.LeaseTasksRequest, opts ...gax.CallOption) (*taskspb.LeaseTasksResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.LeaseTasks[0:len(c.CallOptions.LeaseTasks):len(c.CallOptions.LeaseTasks)], opts...) + var resp *taskspb.LeaseTasksResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.LeaseTasks(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AcknowledgeTask acknowledges a pull task. +// +// The worker, that is, the entity that +// [leased][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] this task must call this method +// to indicate that the work associated with the task has finished. +// +// The worker must acknowledge a task within the +// [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration] or the lease +// will expire and the task will become available to be leased +// again. After the task is acknowledged, it will not be returned +// by a later [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks], +// [GetTask][google.cloud.tasks.v2beta2.CloudTasks.GetTask], or +// [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks]. +func (c *Client) AcknowledgeTask(ctx context.Context, req *taskspb.AcknowledgeTaskRequest, opts ...gax.CallOption) error { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.AcknowledgeTask[0:len(c.CallOptions.AcknowledgeTask):len(c.CallOptions.AcknowledgeTask)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.AcknowledgeTask(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// RenewLease renew the current lease of a pull task. +// +// The worker can use this method to extend the lease by a new +// duration, starting from now. The new task lease will be +// returned in the task's [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time]. +func (c *Client) RenewLease(ctx context.Context, req *taskspb.RenewLeaseRequest, opts ...gax.CallOption) (*taskspb.Task, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.RenewLease[0:len(c.CallOptions.RenewLease):len(c.CallOptions.RenewLease)], opts...) + var resp *taskspb.Task + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.RenewLease(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CancelLease cancel a pull task's lease. +// +// The worker can use this method to cancel a task's lease by +// setting its [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] to now. This will +// make the task available to be leased to the next caller of +// [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks]. +func (c *Client) CancelLease(ctx context.Context, req *taskspb.CancelLeaseRequest, opts ...gax.CallOption) (*taskspb.Task, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CancelLease[0:len(c.CallOptions.CancelLease):len(c.CallOptions.CancelLease)], opts...) + var resp *taskspb.Task + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CancelLease(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// RunTask forces a task to run now. +// +// When this method is called, Cloud Tasks will dispatch the task, even if +// the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2beta2.RateLimits] or +// is [PAUSED][google.cloud.tasks.v2beta2.Queue.State.PAUSED]. +// +// This command is meant to be used for manual debugging. For +// example, [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] can be used to retry a failed +// task after a fix has been made or to manually force a task to be +// dispatched now. +// +// The dispatched task is returned. That is, the task that is returned +// contains the [status][google.cloud.tasks.v2beta2.Task.status] after the task is dispatched but +// before the task is received by its target. +// +// If Cloud Tasks receives a successful response from the task's +// target, then the task will be deleted; otherwise the task's +// [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] will be reset to the time that +// [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] was called plus the retry delay specified +// in the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig]. +// +// [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] returns +// [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a +// task that has already succeeded or permanently failed. +// +// [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] cannot be called on a +// [pull task][google.cloud.tasks.v2beta2.PullMessage]. +func (c *Client) RunTask(ctx context.Context, req *taskspb.RunTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.RunTask[0:len(c.CallOptions.RunTask):len(c.CallOptions.RunTask)], opts...) + var resp *taskspb.Task + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.RunTask(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// QueueIterator manages a stream of *taskspb.Queue. +type QueueIterator struct { + items []*taskspb.Queue + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*taskspb.Queue, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *QueueIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *QueueIterator) Next() (*taskspb.Queue, error) { + var item *taskspb.Queue + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *QueueIterator) bufLen() int { + return len(it.items) +} + +func (it *QueueIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// TaskIterator manages a stream of *taskspb.Task. +type TaskIterator struct { + items []*taskspb.Task + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*taskspb.Task, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TaskIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *TaskIterator) Next() (*taskspb.Task, error) { + var item *taskspb.Task + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TaskIterator) bufLen() int { + return len(it.items) +} + +func (it *TaskIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/cloud_tasks_client_example_test.go b/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/cloud_tasks_client_example_test.go new file mode 100644 index 000000000..4c2893436 --- /dev/null +++ b/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/cloud_tasks_client_example_test.go @@ -0,0 +1,402 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package cloudtasks_test + +import ( + "context" + + cloudtasks "cloud.google.com/go/cloudtasks/apiv2beta2" + "google.golang.org/api/iterator" + taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_ListQueues() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.ListQueuesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListQueues(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.GetQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.CreateQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.UpdateQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.DeleteQueueRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_PurgeQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.PurgeQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PurgeQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_PauseQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.PauseQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PauseQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ResumeQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.ResumeQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ResumeQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetIamPolicy() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_SetIamPolicy() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_TestIamPermissions() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListTasks() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.ListTasksRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTasks(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetTask() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.GetTaskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTask(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateTask() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.CreateTaskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateTask(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteTask() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.DeleteTaskRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteTask(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_LeaseTasks() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.LeaseTasksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.LeaseTasks(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_AcknowledgeTask() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.AcknowledgeTaskRequest{ + // TODO: Fill request struct fields. + } + err = c.AcknowledgeTask(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_RenewLease() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.RenewLeaseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RenewLease(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CancelLease() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.CancelLeaseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CancelLease(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_RunTask() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.RunTaskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RunTask(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/doc.go b/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/doc.go new file mode 100644 index 000000000..755307513 --- /dev/null +++ b/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package cloudtasks is an auto-generated package for the +// Cloud Tasks API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Manages the execution of large numbers of distributed requests. +package cloudtasks // import "cloud.google.com/go/cloudtasks/apiv2beta2" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/mock_test.go b/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/mock_test.go new file mode 100644 index 000000000..e3f62aa7a --- /dev/null +++ b/vendor/cloud.google.com/go/cloudtasks/apiv2beta2/mock_test.go @@ -0,0 +1,1554 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package cloudtasks + +import ( + durationpb "github.com/golang/protobuf/ptypes/duration" + emptypb "github.com/golang/protobuf/ptypes/empty" + timestamppb "github.com/golang/protobuf/ptypes/timestamp" + taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockCloudTasksServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + taskspb.CloudTasksServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockCloudTasksServer) ListQueues(ctx context.Context, req *taskspb.ListQueuesRequest) (*taskspb.ListQueuesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.ListQueuesResponse), nil +} + +func (s *mockCloudTasksServer) GetQueue(ctx context.Context, req *taskspb.GetQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) CreateQueue(ctx context.Context, req *taskspb.CreateQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) UpdateQueue(ctx context.Context, req *taskspb.UpdateQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) DeleteQueue(ctx context.Context, req *taskspb.DeleteQueueRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockCloudTasksServer) PurgeQueue(ctx context.Context, req *taskspb.PurgeQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) PauseQueue(ctx context.Context, req *taskspb.PauseQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockCloudTasksServer) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockCloudTasksServer) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.TestIamPermissionsResponse), nil +} + +func (s *mockCloudTasksServer) ListTasks(ctx context.Context, req *taskspb.ListTasksRequest) (*taskspb.ListTasksResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.ListTasksResponse), nil +} + +func (s *mockCloudTasksServer) GetTask(ctx context.Context, req *taskspb.GetTaskRequest) (*taskspb.Task, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Task), nil +} + +func (s *mockCloudTasksServer) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest) (*taskspb.Task, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Task), nil +} + +func (s *mockCloudTasksServer) DeleteTask(ctx context.Context, req *taskspb.DeleteTaskRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockCloudTasksServer) LeaseTasks(ctx context.Context, req *taskspb.LeaseTasksRequest) (*taskspb.LeaseTasksResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.LeaseTasksResponse), nil +} + +func (s *mockCloudTasksServer) AcknowledgeTask(ctx context.Context, req *taskspb.AcknowledgeTaskRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockCloudTasksServer) RenewLease(ctx context.Context, req *taskspb.RenewLeaseRequest) (*taskspb.Task, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Task), nil +} + +func (s *mockCloudTasksServer) CancelLease(ctx context.Context, req *taskspb.CancelLeaseRequest) (*taskspb.Task, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Task), nil +} + +func (s *mockCloudTasksServer) RunTask(ctx context.Context, req *taskspb.RunTaskRequest) (*taskspb.Task, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Task), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockCloudTasks mockCloudTasksServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + taskspb.RegisterCloudTasksServer(serv, &mockCloudTasks) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestCloudTasksListQueues(t *testing.T) { + var nextPageToken string = "" + var queuesElement *taskspb.Queue = &taskspb.Queue{} + var queues = []*taskspb.Queue{queuesElement} + var expectedResponse = &taskspb.ListQueuesResponse{ + NextPageToken: nextPageToken, + Queues: queues, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &taskspb.ListQueuesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListQueues(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Queues[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksListQueuesError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &taskspb.ListQueuesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListQueues(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksGetQueue(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Queue{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.GetQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksGetQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.GetQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksCreateQueue(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &taskspb.Queue{ + Name: name, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var queue *taskspb.Queue = &taskspb.Queue{} + var request = &taskspb.CreateQueueRequest{ + Parent: formattedParent, + Queue: queue, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksCreateQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var queue *taskspb.Queue = &taskspb.Queue{} + var request = &taskspb.CreateQueueRequest{ + Parent: formattedParent, + Queue: queue, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksUpdateQueue(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &taskspb.Queue{ + Name: name, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var queue *taskspb.Queue = &taskspb.Queue{} + var request = &taskspb.UpdateQueueRequest{ + Queue: queue, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksUpdateQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var queue *taskspb.Queue = &taskspb.Queue{} + var request = &taskspb.UpdateQueueRequest{ + Queue: queue, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksDeleteQueue(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.DeleteQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestCloudTasksDeleteQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.DeleteQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestCloudTasksPurgeQueue(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Queue{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.PurgeQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PurgeQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksPurgeQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.PurgeQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PurgeQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksPauseQueue(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Queue{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.PauseQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PauseQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksPauseQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.PauseQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PauseQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksResumeQueue(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Queue{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.ResumeQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ResumeQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksResumeQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.ResumeQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ResumeQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksGetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksGetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksSetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksSetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksTestIamPermissions(t *testing.T) { + var expectedResponse *iampb.TestIamPermissionsResponse = &iampb.TestIamPermissionsResponse{} + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksTestIamPermissionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksListTasks(t *testing.T) { + var nextPageToken string = "" + var tasksElement *taskspb.Task = &taskspb.Task{} + var tasks = []*taskspb.Task{tasksElement} + var expectedResponse = &taskspb.ListTasksResponse{ + NextPageToken: nextPageToken, + Tasks: tasks, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.ListTasksRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTasks(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Tasks[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksListTasksError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.ListTasksRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTasks(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksGetTask(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Task{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.GetTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTask(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksGetTaskError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.GetTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTask(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksCreateTask(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &taskspb.Task{ + Name: name, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var task *taskspb.Task = &taskspb.Task{} + var request = &taskspb.CreateTaskRequest{ + Parent: formattedParent, + Task: task, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateTask(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksCreateTaskError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var task *taskspb.Task = &taskspb.Task{} + var request = &taskspb.CreateTaskRequest{ + Parent: formattedParent, + Task: task, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateTask(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksDeleteTask(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.DeleteTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTask(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestCloudTasksDeleteTaskError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.DeleteTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTask(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestCloudTasksLeaseTasks(t *testing.T) { + var expectedResponse *taskspb.LeaseTasksResponse = &taskspb.LeaseTasksResponse{} + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var leaseDuration *durationpb.Duration = &durationpb.Duration{} + var request = &taskspb.LeaseTasksRequest{ + Parent: formattedParent, + LeaseDuration: leaseDuration, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.LeaseTasks(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksLeaseTasksError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var leaseDuration *durationpb.Duration = &durationpb.Duration{} + var request = &taskspb.LeaseTasksRequest{ + Parent: formattedParent, + LeaseDuration: leaseDuration, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.LeaseTasks(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksAcknowledgeTask(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var scheduleTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &taskspb.AcknowledgeTaskRequest{ + Name: formattedName, + ScheduleTime: scheduleTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.AcknowledgeTask(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestCloudTasksAcknowledgeTaskError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var scheduleTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &taskspb.AcknowledgeTaskRequest{ + Name: formattedName, + ScheduleTime: scheduleTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.AcknowledgeTask(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestCloudTasksRenewLease(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Task{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var scheduleTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var leaseDuration *durationpb.Duration = &durationpb.Duration{} + var request = &taskspb.RenewLeaseRequest{ + Name: formattedName, + ScheduleTime: scheduleTime, + LeaseDuration: leaseDuration, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RenewLease(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksRenewLeaseError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var scheduleTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var leaseDuration *durationpb.Duration = &durationpb.Duration{} + var request = &taskspb.RenewLeaseRequest{ + Name: formattedName, + ScheduleTime: scheduleTime, + LeaseDuration: leaseDuration, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RenewLease(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksCancelLease(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Task{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var scheduleTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &taskspb.CancelLeaseRequest{ + Name: formattedName, + ScheduleTime: scheduleTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CancelLease(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksCancelLeaseError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var scheduleTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &taskspb.CancelLeaseRequest{ + Name: formattedName, + ScheduleTime: scheduleTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CancelLease(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksRunTask(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Task{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.RunTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RunTask(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksRunTaskError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.RunTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RunTask(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/cloud_tasks_client.go b/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/cloud_tasks_client.go new file mode 100644 index 000000000..e956a7e03 --- /dev/null +++ b/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/cloud_tasks_client.go @@ -0,0 +1,665 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package cloudtasks + +import ( + "context" + "fmt" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3" + iampb "google.golang.org/genproto/googleapis/iam/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + ListQueues []gax.CallOption + GetQueue []gax.CallOption + CreateQueue []gax.CallOption + UpdateQueue []gax.CallOption + DeleteQueue []gax.CallOption + PurgeQueue []gax.CallOption + PauseQueue []gax.CallOption + ResumeQueue []gax.CallOption + GetIamPolicy []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption + ListTasks []gax.CallOption + GetTask []gax.CallOption + CreateTask []gax.CallOption + DeleteTask []gax.CallOption + RunTask []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cloudtasks.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + ListQueues: retry[[2]string{"default", "idempotent"}], + GetQueue: retry[[2]string{"default", "idempotent"}], + CreateQueue: retry[[2]string{"default", "non_idempotent"}], + UpdateQueue: retry[[2]string{"default", "non_idempotent"}], + DeleteQueue: retry[[2]string{"default", "idempotent"}], + PurgeQueue: retry[[2]string{"default", "non_idempotent"}], + PauseQueue: retry[[2]string{"default", "non_idempotent"}], + ResumeQueue: retry[[2]string{"default", "non_idempotent"}], + GetIamPolicy: retry[[2]string{"default", "idempotent"}], + SetIamPolicy: retry[[2]string{"default", "non_idempotent"}], + TestIamPermissions: retry[[2]string{"default", "idempotent"}], + ListTasks: retry[[2]string{"default", "idempotent"}], + GetTask: retry[[2]string{"default", "idempotent"}], + CreateTask: retry[[2]string{"default", "non_idempotent"}], + DeleteTask: retry[[2]string{"default", "idempotent"}], + RunTask: retry[[2]string{"default", "non_idempotent"}], + } +} + +// Client is a client for interacting with Cloud Tasks API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client taskspb.CloudTasksClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new cloud tasks client. +// +// Cloud Tasks allows developers to manage the execution of background +// work in their applications. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: taskspb.NewCloudTasksClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListQueues lists queues. +// +// Queues are returned in lexicographical order. +func (c *Client) ListQueues(ctx context.Context, req *taskspb.ListQueuesRequest, opts ...gax.CallOption) *QueueIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListQueues[0:len(c.CallOptions.ListQueues):len(c.CallOptions.ListQueues)], opts...) + it := &QueueIterator{} + req = proto.Clone(req).(*taskspb.ListQueuesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*taskspb.Queue, string, error) { + var resp *taskspb.ListQueuesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListQueues(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Queues, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetQueue gets a queue. +func (c *Client) GetQueue(ctx context.Context, req *taskspb.GetQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetQueue[0:len(c.CallOptions.GetQueue):len(c.CallOptions.GetQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateQueue creates a queue. +// +// Queues created with this method allow tasks to live for a maximum of 31 +// days. After a task is 31 days old, the task will be deleted regardless of whether +// it was dispatched or not. +// +// WARNING: Using this method may have unintended side effects if you are +// using an App Engine queue.yaml or queue.xml file to manage your queues. +// Read +// Overview of Queue Management and queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml) +// before using this method. +func (c *Client) CreateQueue(ctx context.Context, req *taskspb.CreateQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateQueue[0:len(c.CallOptions.CreateQueue):len(c.CallOptions.CreateQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateQueue updates a queue. +// +// This method creates the queue if it does not exist and updates +// the queue if it does exist. +// +// Queues created with this method allow tasks to live for a maximum of 31 +// days. After a task is 31 days old, the task will be deleted regardless of whether +// it was dispatched or not. +// +// WARNING: Using this method may have unintended side effects if you are +// using an App Engine queue.yaml or queue.xml file to manage your queues. +// Read +// Overview of Queue Management and queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml) +// before using this method. +func (c *Client) UpdateQueue(ctx context.Context, req *taskspb.UpdateQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "queue.name", req.GetQueue().GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateQueue[0:len(c.CallOptions.UpdateQueue):len(c.CallOptions.UpdateQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteQueue deletes a queue. +// +// This command will delete the queue even if it has tasks in it. +// +// Note: If you delete a queue, a queue with the same name can't be created +// for 7 days. +// +// WARNING: Using this method may have unintended side effects if you are +// using an App Engine queue.yaml or queue.xml file to manage your queues. +// Read +// Overview of Queue Management and queue.yaml (at https://cloud.google.com/tasks/docs/queue-yaml) +// before using this method. +func (c *Client) DeleteQueue(ctx context.Context, req *taskspb.DeleteQueueRequest, opts ...gax.CallOption) error { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteQueue[0:len(c.CallOptions.DeleteQueue):len(c.CallOptions.DeleteQueue)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// PurgeQueue purges a queue by deleting all of its tasks. +// +// All tasks created before this method is called are permanently deleted. +// +// Purge operations can take up to one minute to take effect. Tasks +// might be dispatched before the purge takes effect. A purge is irreversible. +func (c *Client) PurgeQueue(ctx context.Context, req *taskspb.PurgeQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.PurgeQueue[0:len(c.CallOptions.PurgeQueue):len(c.CallOptions.PurgeQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.PurgeQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// PauseQueue pauses the queue. +// +// If a queue is paused then the system will stop dispatching tasks +// until the queue is resumed via +// [ResumeQueue][google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue]. Tasks can still be added +// when the queue is paused. A queue is paused if its +// [state][google.cloud.tasks.v2beta3.Queue.state] is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED]. +func (c *Client) PauseQueue(ctx context.Context, req *taskspb.PauseQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.PauseQueue[0:len(c.CallOptions.PauseQueue):len(c.CallOptions.PauseQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.PauseQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ResumeQueue resume a queue. +// +// This method resumes a queue after it has been +// [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED] or +// [DISABLED][google.cloud.tasks.v2beta3.Queue.State.DISABLED]. The state of a queue is stored +// in the queue's [state][google.cloud.tasks.v2beta3.Queue.state]; after calling this method it +// will be set to [RUNNING][google.cloud.tasks.v2beta3.Queue.State.RUNNING]. +// +// WARNING: Resuming many high-QPS queues at the same time can +// lead to target overloading. If you are resuming high-QPS +// queues, follow the 500/50/5 pattern described in +// Managing Cloud Tasks Scaling Risks (at https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). +func (c *Client) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueRequest, opts ...gax.CallOption) (*taskspb.Queue, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ResumeQueue[0:len(c.CallOptions.ResumeQueue):len(c.CallOptions.ResumeQueue)], opts...) + var resp *taskspb.Queue + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ResumeQueue(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetIamPolicy gets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. +// Returns an empty policy if the resource exists and does not have a policy +// set. +// +// Authorization requires the following +// Google IAM (at https://cloud.google.com/iam) permission on the specified +// resource parent: +// +// cloudtasks.queues.getIamPolicy +func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", req.GetResource())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetIamPolicy[0:len(c.CallOptions.GetIamPolicy):len(c.CallOptions.GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetIamPolicy sets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. Replaces any existing +// policy. +// +// Note: The Cloud Console does not check queue-level IAM permissions yet. +// Project-level permissions are required to use the Cloud Console. +// +// Authorization requires the following +// Google IAM (at https://cloud.google.com/iam) permission on the specified +// resource parent: +// +// cloudtasks.queues.setIamPolicy +func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", req.GetResource())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.SetIamPolicy[0:len(c.CallOptions.SetIamPolicy):len(c.CallOptions.SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// TestIamPermissions returns permissions that a caller has on a [Queue][google.cloud.tasks.v2beta3.Queue]. +// If the resource does not exist, this will return an empty set of +// permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. +// +// Note: This operation is designed to be used for building permission-aware +// UIs and command-line tools, not for authorization checking. This operation +// may "fail open" without warning. +func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", req.GetResource())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.TestIamPermissions[0:len(c.CallOptions.TestIamPermissions):len(c.CallOptions.TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListTasks lists the tasks in a queue. +// +// By default, only the [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC] view is retrieved +// due to performance considerations; +// [response_view][google.cloud.tasks.v2beta3.ListTasksRequest.response_view] controls the +// subset of information which is returned. +// +// The tasks may be returned in any order. The ordering may change at any +// time. +func (c *Client) ListTasks(ctx context.Context, req *taskspb.ListTasksRequest, opts ...gax.CallOption) *TaskIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListTasks[0:len(c.CallOptions.ListTasks):len(c.CallOptions.ListTasks)], opts...) + it := &TaskIterator{} + req = proto.Clone(req).(*taskspb.ListTasksRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*taskspb.Task, string, error) { + var resp *taskspb.ListTasksResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListTasks(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Tasks, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetTask gets a task. +func (c *Client) GetTask(ctx context.Context, req *taskspb.GetTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetTask[0:len(c.CallOptions.GetTask):len(c.CallOptions.GetTask)], opts...) + var resp *taskspb.Task + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetTask(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateTask creates a task and adds it to a queue. +// +// Tasks cannot be updated after creation; there is no UpdateTask command. +// +// For [App Engine queues][google.cloud.tasks.v2beta3.AppEngineHttpQueue], the maximum task size is +// 100KB. +func (c *Client) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateTask[0:len(c.CallOptions.CreateTask):len(c.CallOptions.CreateTask)], opts...) + var resp *taskspb.Task + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateTask(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteTask deletes a task. +// +// A task can be deleted if it is scheduled or dispatched. A task +// cannot be deleted if it has executed successfully or permanently +// failed. +func (c *Client) DeleteTask(ctx context.Context, req *taskspb.DeleteTaskRequest, opts ...gax.CallOption) error { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteTask[0:len(c.CallOptions.DeleteTask):len(c.CallOptions.DeleteTask)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteTask(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// RunTask forces a task to run now. +// +// When this method is called, Cloud Tasks will dispatch the task, even if +// the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2beta3.RateLimits] or +// is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED]. +// +// This command is meant to be used for manual debugging. For +// example, [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] can be used to retry a failed +// task after a fix has been made or to manually force a task to be +// dispatched now. +// +// The dispatched task is returned. That is, the task that is returned +// contains the [status][Task.status] after the task is dispatched but +// before the task is received by its target. +// +// If Cloud Tasks receives a successful response from the task's +// target, then the task will be deleted; otherwise the task's +// [schedule_time][google.cloud.tasks.v2beta3.Task.schedule_time] will be reset to the time that +// [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] was called plus the retry delay specified +// in the queue's [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig]. +// +// [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] returns +// [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a +// task that has already succeeded or permanently failed. +func (c *Client) RunTask(ctx context.Context, req *taskspb.RunTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.RunTask[0:len(c.CallOptions.RunTask):len(c.CallOptions.RunTask)], opts...) + var resp *taskspb.Task + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.RunTask(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// QueueIterator manages a stream of *taskspb.Queue. +type QueueIterator struct { + items []*taskspb.Queue + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*taskspb.Queue, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *QueueIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *QueueIterator) Next() (*taskspb.Queue, error) { + var item *taskspb.Queue + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *QueueIterator) bufLen() int { + return len(it.items) +} + +func (it *QueueIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// TaskIterator manages a stream of *taskspb.Task. +type TaskIterator struct { + items []*taskspb.Task + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*taskspb.Task, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TaskIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *TaskIterator) Next() (*taskspb.Task, error) { + var item *taskspb.Task + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TaskIterator) bufLen() int { + return len(it.items) +} + +func (it *TaskIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/cloud_tasks_client_example_test.go b/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/cloud_tasks_client_example_test.go new file mode 100644 index 000000000..477cba258 --- /dev/null +++ b/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/cloud_tasks_client_example_test.go @@ -0,0 +1,332 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package cloudtasks_test + +import ( + "context" + + cloudtasks "cloud.google.com/go/cloudtasks/apiv2beta3" + "google.golang.org/api/iterator" + taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_ListQueues() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.ListQueuesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListQueues(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.GetQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.CreateQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.UpdateQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.DeleteQueueRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_PurgeQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.PurgeQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PurgeQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_PauseQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.PauseQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PauseQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ResumeQueue() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.ResumeQueueRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ResumeQueue(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetIamPolicy() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_SetIamPolicy() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_TestIamPermissions() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListTasks() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.ListTasksRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTasks(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetTask() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.GetTaskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTask(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateTask() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.CreateTaskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateTask(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteTask() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.DeleteTaskRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteTask(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_RunTask() { + ctx := context.Background() + c, err := cloudtasks.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &taskspb.RunTaskRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RunTask(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/doc.go b/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/doc.go new file mode 100644 index 000000000..d0a6f7b5d --- /dev/null +++ b/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package cloudtasks is an auto-generated package for the +// Cloud Tasks API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Manages the execution of large numbers of distributed requests. +package cloudtasks // import "cloud.google.com/go/cloudtasks/apiv2beta3" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/mock_test.go b/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/mock_test.go new file mode 100644 index 000000000..f7d747ff6 --- /dev/null +++ b/vendor/cloud.google.com/go/cloudtasks/apiv2beta3/mock_test.go @@ -0,0 +1,1270 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package cloudtasks + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockCloudTasksServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + taskspb.CloudTasksServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockCloudTasksServer) ListQueues(ctx context.Context, req *taskspb.ListQueuesRequest) (*taskspb.ListQueuesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.ListQueuesResponse), nil +} + +func (s *mockCloudTasksServer) GetQueue(ctx context.Context, req *taskspb.GetQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) CreateQueue(ctx context.Context, req *taskspb.CreateQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) UpdateQueue(ctx context.Context, req *taskspb.UpdateQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) DeleteQueue(ctx context.Context, req *taskspb.DeleteQueueRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockCloudTasksServer) PurgeQueue(ctx context.Context, req *taskspb.PurgeQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) PauseQueue(ctx context.Context, req *taskspb.PauseQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueRequest) (*taskspb.Queue, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Queue), nil +} + +func (s *mockCloudTasksServer) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockCloudTasksServer) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockCloudTasksServer) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.TestIamPermissionsResponse), nil +} + +func (s *mockCloudTasksServer) ListTasks(ctx context.Context, req *taskspb.ListTasksRequest) (*taskspb.ListTasksResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.ListTasksResponse), nil +} + +func (s *mockCloudTasksServer) GetTask(ctx context.Context, req *taskspb.GetTaskRequest) (*taskspb.Task, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Task), nil +} + +func (s *mockCloudTasksServer) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest) (*taskspb.Task, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Task), nil +} + +func (s *mockCloudTasksServer) DeleteTask(ctx context.Context, req *taskspb.DeleteTaskRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockCloudTasksServer) RunTask(ctx context.Context, req *taskspb.RunTaskRequest) (*taskspb.Task, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*taskspb.Task), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockCloudTasks mockCloudTasksServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + taskspb.RegisterCloudTasksServer(serv, &mockCloudTasks) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestCloudTasksListQueues(t *testing.T) { + var nextPageToken string = "" + var queuesElement *taskspb.Queue = &taskspb.Queue{} + var queues = []*taskspb.Queue{queuesElement} + var expectedResponse = &taskspb.ListQueuesResponse{ + NextPageToken: nextPageToken, + Queues: queues, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &taskspb.ListQueuesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListQueues(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Queues[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksListQueuesError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &taskspb.ListQueuesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListQueues(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksGetQueue(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Queue{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.GetQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksGetQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.GetQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksCreateQueue(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &taskspb.Queue{ + Name: name, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var queue *taskspb.Queue = &taskspb.Queue{} + var request = &taskspb.CreateQueueRequest{ + Parent: formattedParent, + Queue: queue, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksCreateQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var queue *taskspb.Queue = &taskspb.Queue{} + var request = &taskspb.CreateQueueRequest{ + Parent: formattedParent, + Queue: queue, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksUpdateQueue(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &taskspb.Queue{ + Name: name, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var queue *taskspb.Queue = &taskspb.Queue{} + var request = &taskspb.UpdateQueueRequest{ + Queue: queue, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksUpdateQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var queue *taskspb.Queue = &taskspb.Queue{} + var request = &taskspb.UpdateQueueRequest{ + Queue: queue, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksDeleteQueue(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.DeleteQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestCloudTasksDeleteQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.DeleteQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestCloudTasksPurgeQueue(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Queue{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.PurgeQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PurgeQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksPurgeQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.PurgeQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PurgeQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksPauseQueue(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Queue{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.PauseQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PauseQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksPauseQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.PauseQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PauseQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksResumeQueue(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &taskspb.Queue{ + Name: name2, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.ResumeQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ResumeQueue(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksResumeQueueError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.ResumeQueueRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ResumeQueue(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksGetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksGetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksSetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksSetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksTestIamPermissions(t *testing.T) { + var expectedResponse *iampb.TestIamPermissionsResponse = &iampb.TestIamPermissionsResponse{} + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksTestIamPermissionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksListTasks(t *testing.T) { + var nextPageToken string = "" + var tasksElement *taskspb.Task = &taskspb.Task{} + var tasks = []*taskspb.Task{tasksElement} + var expectedResponse = &taskspb.ListTasksResponse{ + NextPageToken: nextPageToken, + Tasks: tasks, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.ListTasksRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTasks(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Tasks[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksListTasksError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var request = &taskspb.ListTasksRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTasks(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksGetTask(t *testing.T) { + var name2 string = "name2-1052831874" + var dispatchCount int32 = 1217252086 + var responseCount int32 = 424727441 + var expectedResponse = &taskspb.Task{ + Name: name2, + DispatchCount: dispatchCount, + ResponseCount: responseCount, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.GetTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTask(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksGetTaskError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.GetTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTask(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksCreateTask(t *testing.T) { + var name string = "name3373707" + var dispatchCount int32 = 1217252086 + var responseCount int32 = 424727441 + var expectedResponse = &taskspb.Task{ + Name: name, + DispatchCount: dispatchCount, + ResponseCount: responseCount, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var task *taskspb.Task = &taskspb.Task{} + var request = &taskspb.CreateTaskRequest{ + Parent: formattedParent, + Task: task, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateTask(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksCreateTaskError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") + var task *taskspb.Task = &taskspb.Task{} + var request = &taskspb.CreateTaskRequest{ + Parent: formattedParent, + Task: task, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateTask(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudTasksDeleteTask(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.DeleteTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTask(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestCloudTasksDeleteTaskError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.DeleteTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTask(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestCloudTasksRunTask(t *testing.T) { + var name2 string = "name2-1052831874" + var dispatchCount int32 = 1217252086 + var responseCount int32 = 424727441 + var expectedResponse = &taskspb.Task{ + Name: name2, + DispatchCount: dispatchCount, + ResponseCount: responseCount, + } + + mockCloudTasks.err = nil + mockCloudTasks.reqs = nil + + mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.RunTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RunTask(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudTasksRunTaskError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudTasks.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") + var request = &taskspb.RunTaskRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RunTask(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/debuglet.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/debuglet.go new file mode 100644 index 000000000..b5852b6f6 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/debuglet.go @@ -0,0 +1,450 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build linux,go1.7 + +package main + +import ( + "context" + "encoding/json" + "flag" + "fmt" + "io/ioutil" + "log" + "math/rand" + "os" + "sync" + "time" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/breakpoints" + debuglet "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/controller" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/local" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/valuecollector" + "cloud.google.com/go/compute/metadata" + "golang.org/x/oauth2" + "golang.org/x/oauth2/google" + cd "google.golang.org/api/clouddebugger/v2" +) + +var ( + appModule = flag.String("appmodule", "", "Optional application module name.") + appVersion = flag.String("appversion", "", "Optional application module version name.") + sourceContextFile = flag.String("sourcecontext", "", "File containing JSON-encoded source context.") + verbose = flag.Bool("v", false, "Output verbose log messages.") + projectNumber = flag.String("projectnumber", "", "Project number."+ + " If this is not set, it is read from the GCP metadata server.") + projectID = flag.String("projectid", "", "Project ID."+ + " If this is not set, it is read from the GCP metadata server.") + serviceAccountFile = flag.String("serviceaccountfile", "", "File containing JSON service account credentials.") +) + +const ( + maxCapturedStackFrames = 50 + maxCapturedVariables = 1000 +) + +func main() { + flag.Usage = usage + flag.Parse() + args := flag.Args() + if len(args) == 0 { + // The user needs to supply the name of the executable to run. + flag.Usage() + return + } + if *projectNumber == "" { + var err error + *projectNumber, err = metadata.NumericProjectID() + if err != nil { + log.Print("Debuglet initialization: ", err) + } + } + if *projectID == "" { + var err error + *projectID, err = metadata.ProjectID() + if err != nil { + log.Print("Debuglet initialization: ", err) + } + } + sourceContexts, err := readSourceContextFile(*sourceContextFile) + if err != nil { + log.Print("Reading source context file: ", err) + } + var ts oauth2.TokenSource + ctx := context.Background() + if *serviceAccountFile != "" { + if ts, err = serviceAcctTokenSource(ctx, *serviceAccountFile, cd.CloudDebuggerScope); err != nil { + log.Fatalf("Error getting credentials from file %s: %v", *serviceAccountFile, err) + } + } else if ts, err = google.DefaultTokenSource(ctx, cd.CloudDebuggerScope); err != nil { + log.Print("Error getting application default credentials for Cloud Debugger:", err) + os.Exit(103) + } + c, err := debuglet.NewController(ctx, debuglet.Options{ + ProjectNumber: *projectNumber, + ProjectID: *projectID, + AppModule: *appModule, + AppVersion: *appVersion, + SourceContexts: sourceContexts, + Verbose: *verbose, + TokenSource: ts, + }) + if err != nil { + log.Fatal("Error connecting to Cloud Debugger: ", err) + } + prog, err := local.New(args[0]) + if err != nil { + log.Fatal("Error loading program: ", err) + } + // Load the program, but don't actually start it running yet. + if _, err = prog.Run(args[1:]...); err != nil { + log.Fatal("Error loading program: ", err) + } + bs := breakpoints.NewBreakpointStore(prog) + + // Seed the random number generator. + rand.Seed(time.Now().UnixNano()) + + // Now we want to do two things: run the user's program, and start sending + // List requests periodically to the Debuglet Controller to get breakpoints + // to set. + // + // We want to give the Debuglet Controller a chance to give us breakpoints + // before we start the program, otherwise we would miss any breakpoint + // triggers that occur during program startup -- for example, a breakpoint on + // the first line of main. But if the Debuglet Controller is not responding or + // is returning errors, we don't want to delay starting the program + // indefinitely. + // + // We pass a channel to breakpointListLoop, which will close it when the first + // List call finishes. Then we wait until either the channel is closed or a + // 5-second timer has finished before starting the program. + ch := make(chan bool) + // Start a goroutine that sends List requests to the Debuglet Controller, and + // sets any breakpoints it gets back. + go breakpointListLoop(ctx, c, bs, ch) + // Wait until 5 seconds have passed or breakpointListLoop has closed ch. + select { + case <-time.After(5 * time.Second): + case <-ch: + } + // Run the debuggee. + programLoop(ctx, c, bs, prog) +} + +// usage prints a usage message to stderr and exits. +func usage() { + me := "a.out" + if len(os.Args) >= 1 { + me = os.Args[0] + } + fmt.Fprintf(os.Stderr, "Usage of %s:\n", me) + fmt.Fprintf(os.Stderr, "\t%s [flags...] -- args...\n", me) + fmt.Fprintf(os.Stderr, "Flags:\n") + flag.PrintDefaults() + fmt.Fprintf(os.Stderr, + "See https://cloud.google.com/tools/cloud-debugger/setting-up-on-compute-engine for more information.\n") + os.Exit(2) +} + +// readSourceContextFile reads a JSON-encoded source context from the given file. +// It returns a non-empty slice on success. +func readSourceContextFile(filename string) ([]*cd.SourceContext, error) { + if filename == "" { + return nil, nil + } + scJSON, err := ioutil.ReadFile(filename) + if err != nil { + return nil, fmt.Errorf("reading file %q: %v", filename, err) + } + var sc cd.SourceContext + if err = json.Unmarshal(scJSON, &sc); err != nil { + return nil, fmt.Errorf("parsing file %q: %v", filename, err) + } + return []*cd.SourceContext{&sc}, nil +} + +// breakpointListLoop repeatedly calls the Debuglet Controller's List RPC, and +// passes the results to the BreakpointStore so it can set and unset breakpoints +// in the program. +// +// After the first List call finishes, ch is closed. +func breakpointListLoop(ctx context.Context, c *debuglet.Controller, bs *breakpoints.BreakpointStore, first chan bool) { + const ( + avgTimeBetweenCalls = time.Second + errorDelay = 5 * time.Second + ) + + // randomDuration returns a random duration with expected value avg. + randomDuration := func(avg time.Duration) time.Duration { + return time.Duration(rand.Int63n(int64(2*avg + 1))) + } + + var consecutiveFailures uint + + for { + callStart := time.Now() + resp, err := c.List(ctx) + if err != nil && err != debuglet.ErrListUnchanged { + log.Printf("Debuglet controller server error: %v", err) + } + if err == nil { + bs.ProcessBreakpointList(resp.Breakpoints) + } + + if first != nil { + // We've finished one call to List and set any breakpoints we received. + close(first) + first = nil + } + + // Asynchronously send updates for any breakpoints that caused an error when + // the BreakpointStore tried to process them. We don't wait for the update + // to finish before the program can exit, as we do for normal updates. + errorBps := bs.ErrorBreakpoints() + for _, bp := range errorBps { + go func(bp *cd.Breakpoint) { + if err := c.Update(ctx, bp.Id, bp); err != nil { + log.Printf("Failed to send breakpoint update for %s: %s", bp.Id, err) + } + }(bp) + } + + // Make the next call not too soon after the one we just did. + delay := randomDuration(avgTimeBetweenCalls) + + // If the call returned an error other than ErrListUnchanged, wait longer. + if err != nil && err != debuglet.ErrListUnchanged { + // Wait twice as long after each consecutive failure, to a maximum of 16x. + delay += randomDuration(errorDelay * (1 << consecutiveFailures)) + if consecutiveFailures < 4 { + consecutiveFailures++ + } + } else { + consecutiveFailures = 0 + } + + // Sleep until we reach time callStart+delay. If we've already passed that + // time, time.Sleep will return immediately -- this should be the common + // case, since the server will delay responding to List for a while when + // there are no changes to report. + time.Sleep(callStart.Add(delay).Sub(time.Now())) + } +} + +// programLoop runs the program being debugged to completion. When a breakpoint's +// conditions are satisfied, it sends an Update RPC to the Debuglet Controller. +// The function returns when the program exits and all Update RPCs have finished. +func programLoop(ctx context.Context, c *debuglet.Controller, bs *breakpoints.BreakpointStore, prog debug.Program) { + var wg sync.WaitGroup + for { + // Run the program until it hits a breakpoint or exits. + status, err := prog.Resume() + if err != nil { + break + } + + // Get the breakpoints at this address whose conditions were satisfied, + // and remove the ones that aren't logpoints. + bps := bs.BreakpointsAtPC(status.PC) + bps = bpsWithConditionSatisfied(bps, prog) + for _, bp := range bps { + if bp.Action != "LOG" { + bs.RemoveBreakpoint(bp) + } + } + + if len(bps) == 0 { + continue + } + + // Evaluate expressions and get the stack. + vc := valuecollector.NewCollector(prog, maxCapturedVariables) + needStackFrames := false + for _, bp := range bps { + // If evaluating bp's condition didn't return an error, evaluate bp's + // expressions, and later get the stack frames. + if bp.Status == nil { + bp.EvaluatedExpressions = expressionValues(bp.Expressions, prog, vc) + needStackFrames = true + } + } + var ( + stack []*cd.StackFrame + stackFramesStatusMessage *cd.StatusMessage + ) + if needStackFrames { + stack, stackFramesStatusMessage = stackFrames(prog, vc) + } + + // Read variable values from the program. + variableTable := vc.ReadValues() + + // Start a goroutine to send updates to the Debuglet Controller or write + // to logs, concurrently with resuming the program. + // TODO: retry Update on failure. + for _, bp := range bps { + wg.Add(1) + switch bp.Action { + case "LOG": + go func(format string, evaluatedExpressions []*cd.Variable) { + s := valuecollector.LogString(format, evaluatedExpressions, variableTable) + log.Print(s) + wg.Done() + }(bp.LogMessageFormat, bp.EvaluatedExpressions) + bp.Status = nil + bp.EvaluatedExpressions = nil + default: + go func(bp *cd.Breakpoint) { + defer wg.Done() + bp.IsFinalState = true + if bp.Status == nil { + // If evaluating bp's condition didn't return an error, include the + // stack frames, variable table, and any status message produced when + // getting the stack frames. + bp.StackFrames = stack + bp.VariableTable = variableTable + bp.Status = stackFramesStatusMessage + } + if err := c.Update(ctx, bp.Id, bp); err != nil { + log.Printf("Failed to send breakpoint update for %s: %s", bp.Id, err) + } + }(bp) + } + } + } + + // Wait for all updates to finish before returning. + wg.Wait() +} + +// bpsWithConditionSatisfied returns the breakpoints whose conditions are true +// (or that do not have a condition.) +func bpsWithConditionSatisfied(bpsIn []*cd.Breakpoint, prog debug.Program) []*cd.Breakpoint { + var bpsOut []*cd.Breakpoint + for _, bp := range bpsIn { + cond, err := condTruth(bp.Condition, prog) + if err != nil { + bp.Status = errorStatusMessage(err.Error(), refersToBreakpointCondition) + // Include bp in the list to be updated when there's an error, so that + // the user gets a response. + bpsOut = append(bpsOut, bp) + } else if cond { + bpsOut = append(bpsOut, bp) + } + } + return bpsOut +} + +// condTruth evaluates a condition. +func condTruth(condition string, prog debug.Program) (bool, error) { + if condition == "" { + // A condition wasn't set. + return true, nil + } + val, err := prog.Evaluate(condition) + if err != nil { + return false, err + } + if v, ok := val.(bool); !ok { + return false, fmt.Errorf("condition expression has type %T, should be bool", val) + } else { + return v, nil + } +} + +// expressionValues evaluates a slice of expressions and returns a []*cd.Variable +// containing the results. +// If the result of an expression evaluation refers to values from the program's +// memory (e.g., the expression evaluates to a slice) a corresponding variable is +// added to the value collector, to be read later. +func expressionValues(expressions []string, prog debug.Program, vc *valuecollector.Collector) []*cd.Variable { + evaluatedExpressions := make([]*cd.Variable, len(expressions)) + for i, exp := range expressions { + ee := &cd.Variable{Name: exp} + evaluatedExpressions[i] = ee + if val, err := prog.Evaluate(exp); err != nil { + ee.Status = errorStatusMessage(err.Error(), refersToBreakpointExpression) + } else { + vc.FillValue(val, ee) + } + } + return evaluatedExpressions +} + +// stackFrames returns a stack trace for the program. It passes references to +// function parameters and local variables to the value collector, so it can read +// their values later. +func stackFrames(prog debug.Program, vc *valuecollector.Collector) ([]*cd.StackFrame, *cd.StatusMessage) { + frames, err := prog.Frames(maxCapturedStackFrames) + if err != nil { + return nil, errorStatusMessage("Error getting stack: "+err.Error(), refersToUnspecified) + } + stackFrames := make([]*cd.StackFrame, len(frames)) + for i, f := range frames { + frame := &cd.StackFrame{} + frame.Function = f.Function + for _, v := range f.Params { + frame.Arguments = append(frame.Arguments, vc.AddVariable(debug.LocalVar(v))) + } + for _, v := range f.Vars { + frame.Locals = append(frame.Locals, vc.AddVariable(v)) + } + frame.Location = &cd.SourceLocation{ + Path: f.File, + Line: int64(f.Line), + } + stackFrames[i] = frame + } + return stackFrames, nil +} + +// errorStatusMessage returns a *cd.StatusMessage indicating an error, +// with the given message and refersTo field. +func errorStatusMessage(msg string, refersTo int) *cd.StatusMessage { + return &cd.StatusMessage{ + Description: &cd.FormatMessage{Format: "$0", Parameters: []string{msg}}, + IsError: true, + RefersTo: refersToString[refersTo], + } +} + +const ( + // RefersTo values for cd.StatusMessage. + refersToUnspecified = iota + refersToBreakpointCondition + refersToBreakpointExpression +) + +// refersToString contains the strings for each refersTo value. +// See the definition of StatusMessage in the v2/clouddebugger package. +var refersToString = map[int]string{ + refersToUnspecified: "UNSPECIFIED", + refersToBreakpointCondition: "BREAKPOINT_CONDITION", + refersToBreakpointExpression: "BREAKPOINT_EXPRESSION", +} + +func serviceAcctTokenSource(ctx context.Context, filename string, scope ...string) (oauth2.TokenSource, error) { + data, err := ioutil.ReadFile(filename) + if err != nil { + return nil, fmt.Errorf("cannot read service account file: %v", err) + } + cfg, err := google.JWTConfigFromJSON(data, scope...) + if err != nil { + return nil, fmt.Errorf("google.JWTConfigFromJSON: %v", err) + } + return cfg.TokenSource(ctx), nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/breakpoints/breakpoints.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/breakpoints/breakpoints.go new file mode 100644 index 000000000..351def954 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/breakpoints/breakpoints.go @@ -0,0 +1,174 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package breakpoints handles breakpoint requests we get from the user through +// the Debuglet Controller, and manages corresponding breakpoints set in the code. +package breakpoints + +import ( + "log" + "sync" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + cd "google.golang.org/api/clouddebugger/v2" +) + +// BreakpointStore stores the set of breakpoints for a program. +type BreakpointStore struct { + mu sync.Mutex + // prog is the program being debugged. + prog debug.Program + // idToBreakpoint is a map from breakpoint identifier to *cd.Breakpoint. The + // map value is nil if the breakpoint is inactive. A breakpoint is active if: + // - We received it from the Debuglet Controller, and it was active at the time; + // - We were able to set code breakpoints for it; + // - We have not reached any of those code breakpoints while satisfying the + // breakpoint's conditions, or the breakpoint has action LOG; and + // - The Debuglet Controller hasn't informed us the breakpoint has become inactive. + idToBreakpoint map[string]*cd.Breakpoint + // pcToBps and bpToPCs store the many-to-many relationship between breakpoints we + // received from the Debuglet Controller and the code breakpoints we set for them. + pcToBps map[uint64][]*cd.Breakpoint + bpToPCs map[*cd.Breakpoint][]uint64 + // errors contains any breakpoints which couldn't be set because they caused an + // error. These are retrieved with ErrorBreakpoints, and the caller is + // expected to handle sending updates for them. + errors []*cd.Breakpoint +} + +// NewBreakpointStore returns a BreakpointStore for the given program. +func NewBreakpointStore(prog debug.Program) *BreakpointStore { + return &BreakpointStore{ + idToBreakpoint: make(map[string]*cd.Breakpoint), + pcToBps: make(map[uint64][]*cd.Breakpoint), + bpToPCs: make(map[*cd.Breakpoint][]uint64), + prog: prog, + } +} + +// ProcessBreakpointList applies updates received from the Debuglet Controller through a List call. +func (bs *BreakpointStore) ProcessBreakpointList(bps []*cd.Breakpoint) { + bs.mu.Lock() + defer bs.mu.Unlock() + for _, bp := range bps { + if storedBp, ok := bs.idToBreakpoint[bp.Id]; ok { + if storedBp != nil && bp.IsFinalState { + // IsFinalState indicates that the breakpoint has been made inactive. + bs.removeBreakpointLocked(storedBp) + } + } else { + if bp.IsFinalState { + // The controller is notifying us that the breakpoint is no longer active, + // but we didn't know about it anyway. + continue + } + if bp.Action != "" && bp.Action != "CAPTURE" && bp.Action != "LOG" { + bp.IsFinalState = true + bp.Status = &cd.StatusMessage{ + Description: &cd.FormatMessage{Format: "Action is not supported"}, + IsError: true, + } + bs.errors = append(bs.errors, bp) + // Note in idToBreakpoint that we've already seen this breakpoint, so that we + // don't try to report it as an error multiple times. + bs.idToBreakpoint[bp.Id] = nil + continue + } + pcs, err := bs.prog.BreakpointAtLine(bp.Location.Path, uint64(bp.Location.Line)) + if err != nil { + log.Printf("error setting breakpoint at %s:%d: %v", bp.Location.Path, bp.Location.Line, err) + } + if len(pcs) == 0 { + // We can't find a PC for this breakpoint's source line, so don't make it active. + // TODO: we could snap the line to a location where we can break, or report an error to the user. + bs.idToBreakpoint[bp.Id] = nil + } else { + bs.idToBreakpoint[bp.Id] = bp + for _, pc := range pcs { + bs.pcToBps[pc] = append(bs.pcToBps[pc], bp) + } + bs.bpToPCs[bp] = pcs + } + } + } +} + +// ErrorBreakpoints returns a slice of Breakpoints that caused errors when the +// BreakpointStore tried to process them, and resets the list of such +// breakpoints. +// The caller is expected to send updates to the server to indicate the errors. +func (bs *BreakpointStore) ErrorBreakpoints() []*cd.Breakpoint { + bs.mu.Lock() + defer bs.mu.Unlock() + bps := bs.errors + bs.errors = nil + return bps +} + +// BreakpointsAtPC returns all the breakpoints for which we set a code +// breakpoint at the given address. +func (bs *BreakpointStore) BreakpointsAtPC(pc uint64) []*cd.Breakpoint { + bs.mu.Lock() + defer bs.mu.Unlock() + return bs.pcToBps[pc] +} + +// RemoveBreakpoint makes the given breakpoint inactive. +// This is called when either the debugged program hits the breakpoint, or the Debuglet +// Controller informs us that the breakpoint is now inactive. +func (bs *BreakpointStore) RemoveBreakpoint(bp *cd.Breakpoint) { + bs.mu.Lock() + bs.removeBreakpointLocked(bp) + bs.mu.Unlock() +} + +func (bs *BreakpointStore) removeBreakpointLocked(bp *cd.Breakpoint) { + // Set the ID's corresponding breakpoint to nil, so that we won't activate it + // if we see it again. + // TODO: we could delete it after a few seconds. + bs.idToBreakpoint[bp.Id] = nil + + // Delete bp from the list of cd breakpoints at each of its corresponding + // code breakpoint locations, and delete any code breakpoints which no longer + // have a corresponding cd breakpoint. + var codeBreakpointsToDelete []uint64 + for _, pc := range bs.bpToPCs[bp] { + bps := remove(bs.pcToBps[pc], bp) + if len(bps) == 0 { + // bp was the last breakpoint set at this PC, so delete the code breakpoint. + codeBreakpointsToDelete = append(codeBreakpointsToDelete, pc) + delete(bs.pcToBps, pc) + } else { + bs.pcToBps[pc] = bps + } + } + if len(codeBreakpointsToDelete) > 0 { + bs.prog.DeleteBreakpoints(codeBreakpointsToDelete) + } + delete(bs.bpToPCs, bp) +} + +// remove updates rs by removing r, then returns rs. +// The mutex in the BreakpointStore which contains rs should be held. +func remove(rs []*cd.Breakpoint, r *cd.Breakpoint) []*cd.Breakpoint { + for i := range rs { + if rs[i] == r { + rs[i] = rs[len(rs)-1] + rs = rs[0 : len(rs)-1] + return rs + } + } + // We shouldn't reach here. + return rs +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/breakpoints/breakpoints_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/breakpoints/breakpoints_test.go new file mode 100644 index 000000000..54ef38392 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/breakpoints/breakpoints_test.go @@ -0,0 +1,168 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package breakpoints + +import ( + "testing" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/internal/testutil" + cd "google.golang.org/api/clouddebugger/v2" +) + +var ( + testPC1 uint64 = 0x1234 + testPC2 uint64 = 0x5678 + testPC3 uint64 = 0x3333 + testFile = "foo.go" + testLine uint64 = 42 + testLine2 uint64 = 99 + testLogPC uint64 = 0x9abc + testLogLine uint64 = 43 + testBadPC uint64 = 0xdef0 + testBadLine uint64 = 44 + testBP = &cd.Breakpoint{ + Action: "CAPTURE", + Id: "TestBreakpoint", + IsFinalState: false, + Location: &cd.SourceLocation{Path: testFile, Line: int64(testLine)}, + } + testBP2 = &cd.Breakpoint{ + Action: "CAPTURE", + Id: "TestBreakpoint2", + IsFinalState: false, + Location: &cd.SourceLocation{Path: testFile, Line: int64(testLine2)}, + } + testLogBP = &cd.Breakpoint{ + Action: "LOG", + Id: "TestLogBreakpoint", + IsFinalState: false, + Location: &cd.SourceLocation{Path: testFile, Line: int64(testLogLine)}, + } + testBadBP = &cd.Breakpoint{ + Action: "BEEP", + Id: "TestBadBreakpoint", + IsFinalState: false, + Location: &cd.SourceLocation{Path: testFile, Line: int64(testBadLine)}, + } +) + +func TestBreakpointStore(t *testing.T) { + p := &Program{breakpointPCs: make(map[uint64]bool)} + bs := NewBreakpointStore(p) + checkPCs := func(expected map[uint64]bool) { + if !testutil.Equal(p.breakpointPCs, expected) { + t.Errorf("got breakpoint map %v want %v", p.breakpointPCs, expected) + } + } + bs.ProcessBreakpointList([]*cd.Breakpoint{testBP, testBP2, testLogBP, testBadBP}) + checkPCs(map[uint64]bool{ + testPC1: true, + testPC2: true, + testPC3: true, + testLogPC: true, + }) + for _, test := range []struct { + pc uint64 + expected []*cd.Breakpoint + }{ + {testPC1, []*cd.Breakpoint{testBP}}, + {testPC2, []*cd.Breakpoint{testBP}}, + {testPC3, []*cd.Breakpoint{testBP2}}, + {testLogPC, []*cd.Breakpoint{testLogBP}}, + } { + if bps := bs.BreakpointsAtPC(test.pc); !testutil.Equal(bps, test.expected) { + t.Errorf("BreakpointsAtPC(%x): got %v want %v", test.pc, bps, test.expected) + } + } + testBP2.IsFinalState = true + bs.ProcessBreakpointList([]*cd.Breakpoint{testBP, testBP2, testLogBP, testBadBP}) + checkPCs(map[uint64]bool{ + testPC1: true, + testPC2: true, + testPC3: false, + testLogPC: true, + }) + bs.RemoveBreakpoint(testBP) + checkPCs(map[uint64]bool{ + testPC1: false, + testPC2: false, + testPC3: false, + testLogPC: true, + }) + for _, pc := range []uint64{testPC1, testPC2, testPC3} { + if bps := bs.BreakpointsAtPC(pc); len(bps) != 0 { + t.Errorf("BreakpointsAtPC(%x): got %v want []", pc, bps) + } + } + // bs.ErrorBreakpoints should return testBadBP. + errorBps := bs.ErrorBreakpoints() + if len(errorBps) != 1 { + t.Errorf("ErrorBreakpoints: got %d want 1", len(errorBps)) + } else { + bp := errorBps[0] + if bp.Id != testBadBP.Id { + t.Errorf("ErrorBreakpoints: got id %q want 1", bp.Id) + } + if bp.Status == nil || !bp.Status.IsError { + t.Errorf("ErrorBreakpoints: got %v, want error", bp.Status) + } + } + // The error should have been removed by the last call to bs.ErrorBreakpoints. + errorBps = bs.ErrorBreakpoints() + if len(errorBps) != 0 { + t.Errorf("ErrorBreakpoints: got %d want 0", len(errorBps)) + } + // Even if testBadBP is sent in a new list, it should not be returned again. + bs.ProcessBreakpointList([]*cd.Breakpoint{testBadBP}) + errorBps = bs.ErrorBreakpoints() + if len(errorBps) != 0 { + t.Errorf("ErrorBreakpoints: got %d want 0", len(errorBps)) + } +} + +// Program implements the similarly-named interface in x/debug. +// ValueCollector should only call its BreakpointAtLine and DeleteBreakpoints methods. +type Program struct { + debug.Program + // breakpointPCs contains the state of code breakpoints -- true if the + // breakpoint is currently set, false if it has been deleted. + breakpointPCs map[uint64]bool +} + +func (p *Program) BreakpointAtLine(file string, line uint64) ([]uint64, error) { + var pcs []uint64 + switch { + case file == testFile && line == testLine: + pcs = []uint64{testPC1, testPC2} + case file == testFile && line == testLine2: + pcs = []uint64{testPC3} + case file == testFile && line == testLogLine: + pcs = []uint64{testLogPC} + default: + pcs = []uint64{0xbad} + } + for _, pc := range pcs { + p.breakpointPCs[pc] = true + } + return pcs, nil +} + +func (p *Program) DeleteBreakpoints(pcs []uint64) error { + for _, pc := range pcs { + p.breakpointPCs[pc] = false + } + return nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/controller/client.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/controller/client.go new file mode 100644 index 000000000..da5caaf2d --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/controller/client.go @@ -0,0 +1,291 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package controller is a library for interacting with the Google Cloud Debugger's Debuglet Controller service. +package controller + +import ( + "context" + "crypto/sha256" + "encoding/json" + "errors" + "fmt" + "log" + "sync" + + "golang.org/x/oauth2" + cd "google.golang.org/api/clouddebugger/v2" + "google.golang.org/api/googleapi" + "google.golang.org/api/option" + htransport "google.golang.org/api/transport/http" +) + +const ( + // agentVersionString identifies the agent to the service. + agentVersionString = "google.com/go-gcp/v0.2" + // initWaitToken is the wait token sent in the first Update request to a server. + initWaitToken = "init" +) + +var ( + // ErrListUnchanged is returned by List if the server time limit is reached + // before the list of breakpoints changes. + ErrListUnchanged = errors.New("breakpoint list unchanged") + // ErrDebuggeeDisabled is returned by List or Update if the server has disabled + // this Debuggee. The caller can retry later. + ErrDebuggeeDisabled = errors.New("debuglet disabled by server") +) + +// Controller manages a connection to the Debuglet Controller service. +type Controller struct { + s serviceInterface + // waitToken is sent with List requests so the server knows which set of + // breakpoints this client has already seen. Each successful List request + // returns a new waitToken to send in the next request. + waitToken string + // verbose determines whether to do some logging + verbose bool + // options, uniquifier and description are used in register. + options Options + uniquifier string + description string + // labels are included when registering the debuggee. They should contain + // the module name, version and minorversion, and are used by the debug UI + // to label the correct version active for debugging. + labels map[string]string + // mu protects debuggeeID + mu sync.Mutex + // debuggeeID is returned from the server on registration, and is passed back + // to the server in List and Update requests. + debuggeeID string +} + +// Options controls how the Debuglet Controller client identifies itself to the server. +// See https://cloud.google.com/storage/docs/projects and +// https://cloud.google.com/tools/cloud-debugger/setting-up-on-compute-engine +// for further documentation of these parameters. +type Options struct { + ProjectNumber string // GCP Project Number. + ProjectID string // GCP Project ID. + AppModule string // Module name for the debugged program. + AppVersion string // Version number for this module. + SourceContexts []*cd.SourceContext // Description of source. + Verbose bool + TokenSource oauth2.TokenSource // Source of Credentials used for Stackdriver Debugger. +} + +type serviceInterface interface { + Register(ctx context.Context, req *cd.RegisterDebuggeeRequest) (*cd.RegisterDebuggeeResponse, error) + Update(ctx context.Context, debuggeeID, breakpointID string, req *cd.UpdateActiveBreakpointRequest) (*cd.UpdateActiveBreakpointResponse, error) + List(ctx context.Context, debuggeeID, waitToken string) (*cd.ListActiveBreakpointsResponse, error) +} + +var newService = func(ctx context.Context, tokenSource oauth2.TokenSource) (serviceInterface, error) { + httpClient, endpoint, err := htransport.NewClient(ctx, option.WithTokenSource(tokenSource)) + if err != nil { + return nil, err + } + s, err := cd.New(httpClient) + if err != nil { + return nil, err + } + if endpoint != "" { + s.BasePath = endpoint + } + return &service{s: s}, nil +} + +type service struct { + s *cd.Service +} + +func (s service) Register(ctx context.Context, req *cd.RegisterDebuggeeRequest) (*cd.RegisterDebuggeeResponse, error) { + call := cd.NewControllerDebuggeesService(s.s).Register(req) + return call.Context(ctx).Do() +} + +func (s service) Update(ctx context.Context, debuggeeID, breakpointID string, req *cd.UpdateActiveBreakpointRequest) (*cd.UpdateActiveBreakpointResponse, error) { + call := cd.NewControllerDebuggeesBreakpointsService(s.s).Update(debuggeeID, breakpointID, req) + return call.Context(ctx).Do() +} + +func (s service) List(ctx context.Context, debuggeeID, waitToken string) (*cd.ListActiveBreakpointsResponse, error) { + call := cd.NewControllerDebuggeesBreakpointsService(s.s).List(debuggeeID) + call.WaitToken(waitToken) + return call.Context(ctx).Do() +} + +// NewController connects to the Debuglet Controller server using the given options, +// and returns a Controller for that connection. +// Google Application Default Credentials are used to connect to the Debuglet Controller; +// see https://developers.google.com/identity/protocols/application-default-credentials +func NewController(ctx context.Context, o Options) (*Controller, error) { + // We build a JSON encoding of o.SourceContexts so we can hash it. + scJSON, err := json.Marshal(o.SourceContexts) + if err != nil { + scJSON = nil + o.SourceContexts = nil + } + const minorversion = "107157" // any arbitrary numeric string + + // Compute a uniquifier string by hashing the project number, app module name, + // app module version, debuglet version, and source context. + // The choice of hash function is arbitrary. + h := sha256.Sum256([]byte(fmt.Sprintf("%d %s %d %s %d %s %d %s %d %s %d %s", + len(o.ProjectNumber), o.ProjectNumber, + len(o.AppModule), o.AppModule, + len(o.AppVersion), o.AppVersion, + len(agentVersionString), agentVersionString, + len(scJSON), scJSON, + len(minorversion), minorversion))) + uniquifier := fmt.Sprintf("%X", h[0:16]) // 32 hex characters + + description := o.ProjectID + if o.AppModule != "" { + description += "-" + o.AppModule + } + if o.AppVersion != "" { + description += "-" + o.AppVersion + } + + s, err := newService(ctx, o.TokenSource) + if err != nil { + return nil, err + } + + // Construct client. + c := &Controller{ + s: s, + waitToken: initWaitToken, + verbose: o.Verbose, + options: o, + uniquifier: uniquifier, + description: description, + labels: map[string]string{ + "module": o.AppModule, + "version": o.AppVersion, + "minorversion": minorversion, + }, + } + + return c, nil +} + +func (c *Controller) getDebuggeeID(ctx context.Context) (string, error) { + c.mu.Lock() + defer c.mu.Unlock() + if c.debuggeeID != "" { + return c.debuggeeID, nil + } + // The debuglet hasn't been registered yet, or it is disabled and we should try registering again. + if err := c.register(ctx); err != nil { + return "", err + } + return c.debuggeeID, nil +} + +// List retrieves the current list of breakpoints from the server. +// If the set of breakpoints on the server is the same as the one returned in +// the previous call to List, the server can delay responding until it changes, +// and return an error instead if no change occurs before a time limit the +// server sets. List can't be called concurrently with itself. +func (c *Controller) List(ctx context.Context) (*cd.ListActiveBreakpointsResponse, error) { + id, err := c.getDebuggeeID(ctx) + if err != nil { + return nil, err + } + resp, err := c.s.List(ctx, id, c.waitToken) + if err != nil { + if isAbortedError(err) { + return nil, ErrListUnchanged + } + // For other errors, the protocol requires that we attempt to re-register. + c.mu.Lock() + defer c.mu.Unlock() + if regError := c.register(ctx); regError != nil { + return nil, regError + } + return nil, err + } + if resp == nil { + return nil, errors.New("no response") + } + if c.verbose { + log.Printf("List response: %v", resp) + } + c.waitToken = resp.NextWaitToken + return resp, nil +} + +// isAbortedError tests if err is a *googleapi.Error, that it contains one error +// in Errors, and that that error's Reason is "aborted". +func isAbortedError(err error) bool { + e, _ := err.(*googleapi.Error) + if e == nil { + return false + } + if len(e.Errors) != 1 { + return false + } + return e.Errors[0].Reason == "aborted" +} + +// Update reports information to the server about a breakpoint that was hit. +// Update can be called concurrently with List and Update. +func (c *Controller) Update(ctx context.Context, breakpointID string, bp *cd.Breakpoint) error { + req := &cd.UpdateActiveBreakpointRequest{Breakpoint: bp} + if c.verbose { + log.Printf("sending update for %s: %v", breakpointID, req) + } + id, err := c.getDebuggeeID(ctx) + if err != nil { + return err + } + _, err = c.s.Update(ctx, id, breakpointID, req) + return err +} + +// register calls the Debuglet Controller Register method, and sets c.debuggeeID. +// c.mu should be locked while calling this function. List and Update can't +// make progress until it returns. +func (c *Controller) register(ctx context.Context) error { + req := cd.RegisterDebuggeeRequest{ + Debuggee: &cd.Debuggee{ + AgentVersion: agentVersionString, + Description: c.description, + Project: c.options.ProjectNumber, + SourceContexts: c.options.SourceContexts, + Uniquifier: c.uniquifier, + Labels: c.labels, + }, + } + resp, err := c.s.Register(ctx, &req) + if err != nil { + return err + } + if resp == nil { + return errors.New("register: no response") + } + if resp.Debuggee.IsDisabled { + // Setting c.debuggeeID to empty makes sure future List and Update calls + // will call register first. + c.debuggeeID = "" + } else { + c.debuggeeID = resp.Debuggee.Id + } + if c.debuggeeID == "" { + return ErrDebuggeeDisabled + } + return nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/controller/client_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/controller/client_test.go new file mode 100644 index 000000000..a5a9e3227 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/controller/client_test.go @@ -0,0 +1,253 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controller + +import ( + "bytes" + "context" + "errors" + "fmt" + "strconv" + "testing" + + "golang.org/x/oauth2" + cd "google.golang.org/api/clouddebugger/v2" + "google.golang.org/api/googleapi" +) + +const ( + testDebuggeeID = "d12345" + testBreakpointID = "bp12345" +) + +var ( + // The sequence of wait tokens in List requests and responses. + expectedWaitToken = []string{"init", "token1", "token2", "token1", "token1"} + // The set of breakpoints returned from each List call. + expectedBreakpoints = [][]*cd.Breakpoint{ + nil, + { + &cd.Breakpoint{ + Id: testBreakpointID, + IsFinalState: false, + Location: &cd.SourceLocation{Line: 42, Path: "foo.go"}, + }, + }, + nil, + } + abortedError error = &googleapi.Error{ + Code: 409, + Message: "Conflict", + Body: `{ + "error": { + "errors": [ + { + "domain": "global", + "reason": "aborted", + "message": "Conflict" + } + ], + "code": 409, + "message": "Conflict" + } + }`, + Errors: []googleapi.ErrorItem{ + {Reason: "aborted", Message: "Conflict"}, + }, + } + backendError error = &googleapi.Error{ + Code: 503, + Message: "Backend Error", + Body: `{ + "error": { + "errors": [ + { + "domain": "global", + "reason": "backendError", + "message": "Backend Error" + } + ], + "code": 503, + "message": "Backend Error" + } + }`, + Errors: []googleapi.ErrorItem{ + {Reason: "backendError", Message: "Backend Error"}, + }, + } +) + +type mockService struct { + t *testing.T + listCallsSeen int + registerCallsSeen int +} + +func (s *mockService) Register(ctx context.Context, req *cd.RegisterDebuggeeRequest) (*cd.RegisterDebuggeeResponse, error) { + s.registerCallsSeen++ + if req.Debuggee == nil { + s.t.Errorf("missing debuggee") + return nil, nil + } + if req.Debuggee.AgentVersion == "" { + s.t.Errorf("missing agent version") + } + if req.Debuggee.Description == "" { + s.t.Errorf("missing debuglet description") + } + if req.Debuggee.Project == "" { + s.t.Errorf("missing project id") + } + if req.Debuggee.Uniquifier == "" { + s.t.Errorf("missing uniquifier") + } + return &cd.RegisterDebuggeeResponse{ + Debuggee: &cd.Debuggee{Id: testDebuggeeID}, + }, nil +} + +func (s *mockService) Update(ctx context.Context, id, breakpointID string, req *cd.UpdateActiveBreakpointRequest) (*cd.UpdateActiveBreakpointResponse, error) { + if id != testDebuggeeID { + s.t.Errorf("got debuggee ID %s want %s", id, testDebuggeeID) + } + if breakpointID != testBreakpointID { + s.t.Errorf("got breakpoint ID %s want %s", breakpointID, testBreakpointID) + } + if !req.Breakpoint.IsFinalState { + s.t.Errorf("got IsFinalState = false, want true") + } + return nil, nil +} + +func (s *mockService) List(ctx context.Context, id, waitToken string) (*cd.ListActiveBreakpointsResponse, error) { + if id != testDebuggeeID { + s.t.Errorf("got debuggee ID %s want %s", id, testDebuggeeID) + } + if waitToken != expectedWaitToken[s.listCallsSeen] { + s.t.Errorf("got wait token %s want %s", waitToken, expectedWaitToken[s.listCallsSeen]) + } + s.listCallsSeen++ + if s.listCallsSeen == 4 { + return nil, backendError + } + if s.listCallsSeen == 5 { + return nil, abortedError + } + resp := &cd.ListActiveBreakpointsResponse{ + Breakpoints: expectedBreakpoints[s.listCallsSeen-1], + NextWaitToken: expectedWaitToken[s.listCallsSeen], + } + return resp, nil +} + +func TestDebugletControllerClientLibrary(t *testing.T) { + var ( + m *mockService + c *Controller + list *cd.ListActiveBreakpointsResponse + err error + ) + m = &mockService{t: t} + newService = func(context.Context, oauth2.TokenSource) (serviceInterface, error) { return m, nil } + opts := Options{ + ProjectNumber: "5", + ProjectID: "p1", + AppModule: "mod1", + AppVersion: "v1", + } + ctx := context.Background() + if c, err = NewController(ctx, opts); err != nil { + t.Fatal("Initializing Controller client:", err) + } + if err := validateLabels(c, opts); err != nil { + t.Fatalf("Invalid labels:\n%v", err) + } + if list, err = c.List(ctx); err != nil { + t.Fatal("List:", err) + } + if m.registerCallsSeen != 1 { + t.Errorf("saw %d Register calls, want 1", m.registerCallsSeen) + } + if list, err = c.List(ctx); err != nil { + t.Fatal("List:", err) + } + if len(list.Breakpoints) != 1 { + t.Fatalf("got %d breakpoints, want 1", len(list.Breakpoints)) + } + if err = c.Update(ctx, list.Breakpoints[0].Id, &cd.Breakpoint{Id: testBreakpointID, IsFinalState: true}); err != nil { + t.Fatal("Update:", err) + } + if list, err = c.List(ctx); err != nil { + t.Fatal("List:", err) + } + if m.registerCallsSeen != 1 { + t.Errorf("saw %d Register calls, want 1", m.registerCallsSeen) + } + // The next List call produces an error that should cause a Register call. + if list, err = c.List(ctx); err == nil { + t.Fatal("List should have returned an error") + } + if m.registerCallsSeen != 2 { + t.Errorf("saw %d Register calls, want 2", m.registerCallsSeen) + } + // The next List call produces an error that should not cause a Register call. + if list, err = c.List(ctx); err == nil { + t.Fatal("List should have returned an error") + } + if m.registerCallsSeen != 2 { + t.Errorf("saw %d Register calls, want 2", m.registerCallsSeen) + } + if m.listCallsSeen != 5 { + t.Errorf("saw %d list calls, want 5", m.listCallsSeen) + } +} + +func validateLabels(c *Controller, o Options) error { + errMsg := new(bytes.Buffer) + if m, ok := c.labels["module"]; ok { + if m != o.AppModule { + errMsg.WriteString(fmt.Sprintf("label module: want %s, got %s\n", o.AppModule, m)) + } + } else { + errMsg.WriteString("Missing \"module\" label\n") + } + if v, ok := c.labels["version"]; ok { + if v != o.AppVersion { + errMsg.WriteString(fmt.Sprintf("label version: want %s, got %s\n", o.AppVersion, v)) + } + } else { + errMsg.WriteString("Missing \"version\" label\n") + } + if mv, ok := c.labels["minorversion"]; ok { + if _, err := strconv.Atoi(mv); err != nil { + errMsg.WriteString(fmt.Sprintln("label minorversion: not a numeric string:", mv)) + } + } else { + errMsg.WriteString("Missing \"minorversion\" label\n") + } + if errMsg.Len() != 0 { + return errors.New(errMsg.String()) + } + return nil +} + +func TestIsAbortedError(t *testing.T) { + if !isAbortedError(abortedError) { + t.Errorf("isAborted(%+v): got false, want true", abortedError) + } + if isAbortedError(backendError) { + t.Errorf("isAborted(%+v): got true, want false", backendError) + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/arch/arch.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/arch/arch.go new file mode 100644 index 000000000..3ec2b0299 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/arch/arch.go @@ -0,0 +1,186 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package arch contains architecture-specific definitions. +package arch + +import ( + "encoding/binary" + "math" +) + +const MaxBreakpointSize = 4 // TODO + +// Architecture defines the architecture-specific details for a given machine. +type Architecture struct { + // BreakpointSize is the size of a breakpoint instruction, in bytes. + BreakpointSize int + // IntSize is the size of the int type, in bytes. + IntSize int + // PointerSize is the size of a pointer, in bytes. + PointerSize int + // ByteOrder is the byte order for ints and pointers. + ByteOrder binary.ByteOrder + // FloatByteOrder is the byte order for floats. + FloatByteOrder binary.ByteOrder + BreakpointInstr [MaxBreakpointSize]byte +} + +func (a *Architecture) Int(buf []byte) int64 { + return int64(a.Uint(buf)) +} + +func (a *Architecture) Uint(buf []byte) uint64 { + if len(buf) != a.IntSize { + panic("bad IntSize") + } + switch a.IntSize { + case 4: + return uint64(a.ByteOrder.Uint32(buf[:4])) + case 8: + return a.ByteOrder.Uint64(buf[:8]) + } + panic("no IntSize") +} + +func (a *Architecture) Int16(buf []byte) int16 { + return int16(a.Uint16(buf)) +} + +func (a *Architecture) Int32(buf []byte) int32 { + return int32(a.Uint32(buf)) +} + +func (a *Architecture) Int64(buf []byte) int64 { + return int64(a.Uint64(buf)) +} + +func (a *Architecture) Uint16(buf []byte) uint16 { + return a.ByteOrder.Uint16(buf) +} + +func (a *Architecture) Uint32(buf []byte) uint32 { + return a.ByteOrder.Uint32(buf) +} + +func (a *Architecture) Uint64(buf []byte) uint64 { + return a.ByteOrder.Uint64(buf) +} + +func (a *Architecture) IntN(buf []byte) int64 { + if len(buf) == 0 { + return 0 + } + x := int64(0) + if a.ByteOrder == binary.LittleEndian { + i := len(buf) - 1 + x = int64(int8(buf[i])) // sign-extended + for i--; i >= 0; i-- { + x <<= 8 + x |= int64(buf[i]) // not sign-extended + } + } else { + x = int64(int8(buf[0])) // sign-extended + for i := 1; i < len(buf); i++ { + x <<= 8 + x |= int64(buf[i]) // not sign-extended + } + } + return x +} + +func (a *Architecture) UintN(buf []byte) uint64 { + u := uint64(0) + if a.ByteOrder == binary.LittleEndian { + shift := uint(0) + for _, c := range buf { + u |= uint64(c) << shift + shift += 8 + } + } else { + for _, c := range buf { + u <<= 8 + u |= uint64(c) + } + } + return u +} + +func (a *Architecture) Uintptr(buf []byte) uint64 { + if len(buf) != a.PointerSize { + panic("bad PointerSize") + } + switch a.PointerSize { + case 4: + return uint64(a.ByteOrder.Uint32(buf[:4])) + case 8: + return a.ByteOrder.Uint64(buf[:8]) + } + panic("no PointerSize") +} + +func (a *Architecture) Float32(buf []byte) float32 { + if len(buf) != 4 { + panic("bad float32 size") + } + return math.Float32frombits(a.FloatByteOrder.Uint32(buf)) +} + +func (a *Architecture) Float64(buf []byte) float64 { + if len(buf) != 8 { + panic("bad float64 size") + } + return math.Float64frombits(a.FloatByteOrder.Uint64(buf)) +} + +func (a *Architecture) Complex64(buf []byte) complex64 { + if len(buf) != 8 { + panic("bad complex64 size") + } + return complex(a.Float32(buf[0:4]), a.Float32(buf[4:8])) +} + +func (a *Architecture) Complex128(buf []byte) complex128 { + if len(buf) != 16 { + panic("bad complex128 size") + } + return complex(a.Float64(buf[0:8]), a.Float64(buf[8:16])) +} + +var AMD64 = Architecture{ + BreakpointSize: 1, + IntSize: 8, + PointerSize: 8, + ByteOrder: binary.LittleEndian, + FloatByteOrder: binary.LittleEndian, + BreakpointInstr: [MaxBreakpointSize]byte{0xCC}, // INT 3 +} + +var X86 = Architecture{ + BreakpointSize: 1, + IntSize: 4, + PointerSize: 4, + ByteOrder: binary.LittleEndian, + FloatByteOrder: binary.LittleEndian, + BreakpointInstr: [MaxBreakpointSize]byte{0xCC}, // INT 3 +} + +var ARM = Architecture{ + BreakpointSize: 4, // TODO + IntSize: 4, + PointerSize: 4, + ByteOrder: binary.LittleEndian, + FloatByteOrder: binary.LittleEndian, // TODO + BreakpointInstr: [MaxBreakpointSize]byte{0x00, 0x00, 0x00, 0x00}, // TODO +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/cmd/debugproxy/main.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/cmd/debugproxy/main.go new file mode 100644 index 000000000..c8c2f75f4 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/cmd/debugproxy/main.go @@ -0,0 +1,85 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// debugproxy connects to the target binary, and serves an RPC interface using +// the types in server/protocol to access and control it. + +// +build linux + +package main + +import ( + "flag" + "fmt" + "log" + "net/rpc" + "os" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server" +) + +var ( + textFlag = flag.String("text", "", "file name of binary being debugged") +) + +func main() { + log.SetFlags(0) + log.SetPrefix("debugproxy: ") + flag.Parse() + if *textFlag == "" { + flag.Usage() + os.Exit(2) + } + s, err := server.New(*textFlag) + if err != nil { + fmt.Printf("server.New: %v\n", err) + os.Exit(2) + } + err = rpc.Register(s) + if err != nil { + fmt.Printf("rpc.Register: %v\n", err) + os.Exit(2) + } + fmt.Println("OK") + log.Print("starting server") + rpc.ServeConn(&rwc{ + os.Stdin, + os.Stdout, + }) + log.Print("server finished") +} + +// rwc creates a single io.ReadWriteCloser from a read side and a write side. +// It allows us to do RPC using standard in and standard out. +type rwc struct { + r *os.File + w *os.File +} + +func (rwc *rwc) Read(p []byte) (int, error) { + return rwc.r.Read(p) +} + +func (rwc *rwc) Write(p []byte) (int, error) { + return rwc.w.Write(p) +} + +func (rwc *rwc) Close() error { + rerr := rwc.r.Close() + werr := rwc.w.Close() + if rerr != nil { + return rerr + } + return werr +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/doc/ptrace-nptl.txt b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/doc/ptrace-nptl.txt new file mode 100644 index 000000000..81f6a1069 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/doc/ptrace-nptl.txt @@ -0,0 +1,128 @@ +ptrace and NTPL, the missing manpage + +== Signals == + +A signal sent to a ptrace'd process or thread causes only the thread +that receives it to stop and report to the attached process. + +Use tgkill to target a signal (for example, SIGSTOP) at a particular +thread. If you use kill, the signal could be delivered to another +thread in the same process. + +Note that SIGSTOP differs from its usual behavior when a process is +being traced. Usually, a SIGSTOP sent to any thread in a thread group +will stop all threads in the thread group. When a thread is traced, +however, a SIGSTOP affects only the receiving thread (and any other +threads in the thread group that are not traced). + +SIGKILL behaves like it does for non-traced processes. It affects all +threads in the process and terminates them without the WSTOPSIG event +generated by other signals. However, if PTRACE_O_TRACEEXIT is set, +the attached process will still receive PTRACE_EVENT_EXIT events +before receiving WIFSIGNALED events. + +See "Following thread death" for a caveat regarding signal delivery to +zombie threads. + +== Waiting on threads == + +Cloned threads in ptrace'd processes are treated similarly to cloned +threads in your own process. Thus, you must use the __WALL option in +order to receive notifications from threads created by the child +process. Similarly, the __WCLONE option will wait only on +notifications from threads created by the child process and *not* on +notifications from the initial child thread. + +Even when waiting on a specific thread's PID using waitpid or similar, +__WALL or __WCLONE is necessary or waitpid will return ECHILD. + +== Attaching to existing threads == + +libthread_db (which gdb uses), attaches to existing threads by pulling +the pthread data structures out of the traced process. The much +easier way is to traverse the /proc/PID/task directory, though it's +unclear how the semantics of these two approaches differ. + +Unfortunately, if the main thread has exited (but the overall process +has not), it sticks around as a zombie process. This zombie will +appear in the /proc/PID/task directory, but trying to attach to it +will yield EPERM. In this case, the third field of the +/proc/PID/task/PID/stat file will be "Z". Attempting to open the stat +file is also a convenient way to detect races between listing the task +directory and the thread exiting. Coincidentally, gdb will simply +fail to attach to a process whose main thread is a zombie. + +Because new threads may be created while the debugger is in the +process of attaching to existing threads, the debugger must repeatedly +re-list the task directory until it has attached to (and thus stopped) +every thread listed. + +In order to follow new threads created by existing threads, +PTRACE_O_TRACECLONE must be set on each thread attached to. + +== Following new threads == + +With the child process stopped, use PTRACE_SETOPTIONS to set the +PTRACE_O_TRACECLONE option. This option is per-thread, and thus must +be set on each existing thread individually. When an existing thread +with PTRACE_O_TRACECLONE set spawns a new thread, the existing thread +will stop with (SIGTRAP | PTRACE_EVENT_CLONE << 8) and the PID of the +new thread can be retrieved with PTRACE_GETEVENTMSG on the creating +thread. At this time, the new thread will exist, but will initially +be stopped with a SIGSTOP. The new thread will automatically be +traced and will inherit the PTRACE_O_TRACECLONE option from its +parent. The attached process should wait on the new thread to receive +the SIGSTOP notification. + +When using waitpid(-1, ...), don't rely on the parent thread reporting +a SIGTRAP before receiving the SIGSTOP from the new child thread. + +Without PTRACE_O_TRACECLONE, newly cloned threads will not be +ptrace'd. As a result, signals received by new threads will be +handled in the usual way, which may affect the parent and in turn +appear to the attached process, but attributed to the parent (possibly +in unexpected ways). + +== Following thread death == + +If any thread with the PTRACE_O_TRACEEXIT option set exits (either by +returning or pthread_exit'ing), the tracing process will receive an +immediate PTRACE_EVENT_EXIT. At this point, the thread will still +exist. The exit status, encoded as for wait, can be queried using +PTRACE_GETEVENTMSG on the exiting thread's PID. The thread should be +continued so it can actually exit, after which its wait behavior is +the same as for a thread without the PTRACE_O_TRACEEXIT option. + +If a non-main thread exits (either by returning or pthread_exit'ing), +its corresponding process will also exit, producing a WIFEXITED event +(after the process is continued from a possible PTRACE_EVENT_EXIT +event). It is *not* necessary for another thread to ptrace_join for +this to happen. + +If the main thread exits by returning, then all threads will exit, +first generating a PTRACE_EVENT_EXIT event for each thread if +appropriate, then producing a WIFEXITED event for each thread. + +If the main thread exits using pthread_exit, then it enters a +non-waitable zombie state. It will still produce an immediate +PTRACE_O_TRACEEXIT event, but the WIFEXITED event will be delayed +until the entire process exits. This state exists so that shells +don't think the process is done until all of the threads have exited. +Unfortunately, signals cannot be delivered to non-waitable zombies. +Most notably, SIGSTOP cannot be delivered; as a result, when you +broadcast SIGSTOP to all of the threads, you must not wait for +non-waitable zombies to stop. Furthermore, any ptrace command on a +non-waitable zombie, including PTRACE_DETACH, will return ESRCH. + +== Multi-threaded debuggers == + +If the debugger itself is multi-threaded, ptrace calls must come from +the same thread that originally attached to the remote thread. The +kernel simply compares the PID of the caller of ptrace against the +tracer PID of the process passed to ptrace. Because each debugger +thread has a different PID, calling ptrace from a different thread +might as well be calling it from a different process and the kernel +will return ESRCH. + +wait, on the other hand, does not have this restriction. Any debugger +thread can wait on any thread in the attached process. diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/buf.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/buf.go new file mode 100644 index 000000000..df4dcadec --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/buf.go @@ -0,0 +1,213 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Buffered reading and decoding of DWARF data streams. + +package dwarf + +import ( + "encoding/binary" + "fmt" + "strconv" +) + +// Data buffer being decoded. +type buf struct { + dwarf *Data + order binary.ByteOrder + format dataFormat + name string + off Offset + data []byte + err error +} + +// Data format, other than byte order. This affects the handling of +// certain field formats. +type dataFormat interface { + // DWARF version number. Zero means unknown. + version() int + + // 64-bit DWARF format? + dwarf64() (dwarf64 bool, isKnown bool) + + // Size of an address, in bytes. Zero means unknown. + addrsize() int +} + +// Some parts of DWARF have no data format, e.g., abbrevs. +type unknownFormat struct{} + +func (u unknownFormat) version() int { + return 0 +} + +func (u unknownFormat) dwarf64() (bool, bool) { + return false, false +} + +func (u unknownFormat) addrsize() int { + return 0 +} + +func makeBuf(d *Data, format dataFormat, name string, off Offset, data []byte) buf { + return buf{d, d.order, format, name, off, data, nil} +} + +func (b *buf) slice(length int) buf { + n := *b + data := b.data + b.skip(length) // Will validate length. + n.data = data[:length] + return n +} + +func (b *buf) uint8() uint8 { + if len(b.data) < 1 { + b.error("underflow") + return 0 + } + val := b.data[0] + b.data = b.data[1:] + b.off++ + return val +} + +func (b *buf) bytes(n int) []byte { + if len(b.data) < n { + b.error("underflow") + return nil + } + data := b.data[0:n] + b.data = b.data[n:] + b.off += Offset(n) + return data +} + +func (b *buf) skip(n int) { b.bytes(n) } + +// string returns the NUL-terminated (C-like) string at the start of the buffer. +// The terminal NUL is discarded. +func (b *buf) string() string { + for i := 0; i < len(b.data); i++ { + if b.data[i] == 0 { + s := string(b.data[0:i]) + b.data = b.data[i+1:] + b.off += Offset(i + 1) + return s + } + } + b.error("underflow") + return "" +} + +func (b *buf) uint16() uint16 { + a := b.bytes(2) + if a == nil { + return 0 + } + return b.order.Uint16(a) +} + +func (b *buf) uint32() uint32 { + a := b.bytes(4) + if a == nil { + return 0 + } + return b.order.Uint32(a) +} + +func (b *buf) uint64() uint64 { + a := b.bytes(8) + if a == nil { + return 0 + } + return b.order.Uint64(a) +} + +// Read a varint, which is 7 bits per byte, little endian. +// the 0x80 bit means read another byte. +func (b *buf) varint() (c uint64, bits uint) { + for i := 0; i < len(b.data); i++ { + byte := b.data[i] + c |= uint64(byte&0x7F) << bits + bits += 7 + if byte&0x80 == 0 { + b.off += Offset(i + 1) + b.data = b.data[i+1:] + return c, bits + } + } + return 0, 0 +} + +// Unsigned int is just a varint. +func (b *buf) uint() uint64 { + x, _ := b.varint() + return x +} + +// Signed int is a sign-extended varint. +func (b *buf) int() int64 { + ux, bits := b.varint() + x := int64(ux) + if x&(1<<(bits-1)) != 0 { + x |= -1 << bits + } + return x +} + +// Address-sized uint. +func (b *buf) addr() uint64 { + switch b.format.addrsize() { + case 1: + return uint64(b.uint8()) + case 2: + return uint64(b.uint16()) + case 4: + return uint64(b.uint32()) + case 8: + return uint64(b.uint64()) + } + b.error("unknown address size") + return 0 +} + +// assertEmpty checks that everything has been read from b. +func (b *buf) assertEmpty() { + if len(b.data) == 0 { + return + } + if len(b.data) > 5 { + b.error(fmt.Sprintf("unexpected extra data: %x...", b.data[0:5])) + } + b.error(fmt.Sprintf("unexpected extra data: %x", b.data)) +} + +func (b *buf) error(s string) { + if b.err == nil { + b.data = nil + b.err = DecodeError{b.name, b.off, s} + } +} + +type DecodeError struct { + Name string + Offset Offset + Err string +} + +func (e DecodeError) Error() string { + return "decoding dwarf section " + e.Name + " at offset 0x" + strconv.FormatInt(int64(e.Offset), 16) + ": " + e.Err +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/cache.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/cache.go new file mode 100644 index 000000000..bd00128db --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/cache.go @@ -0,0 +1,277 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dwarf + +import ( + "fmt" + "sort" +) + +// pcToFuncEntries maps PC ranges to function entries. +// +// Each element contains a *Entry for a function and its corresponding start PC. +// If we know the address one past the last instruction of a function, and it is +// not equal to the start address of the next function, we mark that with +// another element containing that address and a nil entry. The elements are +// sorted by PC. Among elements with the same PC, those with non-nil *Entry +// are put earlier. +type pcToFuncEntries []pcToFuncEntry +type pcToFuncEntry struct { + pc uint64 + entry *Entry +} + +func (p pcToFuncEntries) Len() int { return len(p) } +func (p pcToFuncEntries) Swap(i, j int) { p[i], p[j] = p[j], p[i] } +func (p pcToFuncEntries) Less(i, j int) bool { + if p[i].pc != p[j].pc { + return p[i].pc < p[j].pc + } + return p[i].entry != nil && p[j].entry == nil +} + +// nameCache maps each symbol name to a linked list of the entries with that name. +type nameCache map[string]*nameCacheEntry +type nameCacheEntry struct { + entry *Entry + link *nameCacheEntry +} + +// pcToLineEntries maps PCs to line numbers. +// +// It is a slice of (PC, line, file number) triples, sorted by PC. The file +// number is an index into the source files slice. +// If (PC1, line1, file1) and (PC2, line2, file2) are two consecutive elements, +// then the span of addresses [PC1, PC2) belongs to (line1, file1). If an +// element's file number is zero, it only marks the end of a span. +// +// TODO: could save memory by changing pcToLineEntries and lineToPCEntries to use +// interval trees containing references into .debug_line. +type pcToLineEntries []pcToLineEntry +type pcToLineEntry struct { + pc uint64 + line uint64 + file uint64 +} + +func (p pcToLineEntries) Len() int { return len(p) } +func (p pcToLineEntries) Swap(i, j int) { p[i], p[j] = p[j], p[i] } +func (p pcToLineEntries) Less(i, j int) bool { + if p[i].pc != p[j].pc { + return p[i].pc < p[j].pc + } + return p[i].file > p[j].file +} + +// byFileLine is used temporarily while building lineToPCEntries. +type byFileLine []pcToLineEntry + +func (b byFileLine) Len() int { return len(b) } +func (b byFileLine) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byFileLine) Less(i, j int) bool { + if b[i].file != b[j].file { + return b[i].file < b[j].file + } + return b[i].line < b[j].line +} + +// lineToPCEntries maps line numbers to breakpoint addresses. +// +// The slice contains, for each source file in Data, a slice of (line, PC) +// pairs, sorted by line. Note that there may be more than one PC for a line. +type lineToPCEntries [][]lineToPCEntry +type lineToPCEntry struct { + line uint64 + pc uint64 +} + +func (d *Data) buildLineToPCCache(pclfs pcToLineEntries) { + // TODO: only include lines where is_stmt is true + sort.Sort(byFileLine(pclfs)) + // Make a slice of (line, PC) pairs for each (non-zero) file. + var ( + c = make(lineToPCEntries, len(d.sourceFiles)) + curSlice []lineToPCEntry + ) + for i, pclf := range pclfs { + if pclf.file == 0 { + // This entry indicated the end of an instruction sequence, not a breakpoint. + continue + } + curSlice = append(curSlice, lineToPCEntry{line: pclf.line, pc: pclf.pc}) + if i+1 == len(pclfs) || pclf.file != pclfs[i+1].file { + // curSlice now contains all of the entries for pclf.file. + if pclf.file > 0 && pclf.file < uint64(len(c)) { + c[pclf.file] = curSlice + } + curSlice = nil + } + } + d.lineToPCEntries = c +} + +func (d *Data) buildPCToLineCache(cache pcToLineEntries) { + // Sort cache by PC (in increasing order), then by file number (in decreasing order). + sort.Sort(cache) + + // Build a copy without redundant entries. + var out pcToLineEntries + for i, pclf := range cache { + if i > 0 && pclf.pc == cache[i-1].pc { + // This entry is for the same PC as the previous entry. + continue + } + if i > 0 && pclf.file == cache[i-1].file && pclf.line == cache[i-1].line { + // This entry is for the same file and line as the previous entry. + continue + } + out = append(out, pclf) + } + d.pcToLineEntries = out +} + +// buildLineCaches constructs d.sourceFiles, d.lineToPCEntries, d.pcToLineEntries. +func (d *Data) buildLineCaches() error { + var cache pcToLineEntries + r := d.Reader() + for { + entry, err := r.Next() + if err != nil { + return err + } + if entry == nil { + break + } + if entry.Tag != TagCompileUnit { + r.SkipChildren() + continue + } + // Get the offset of this unit's line number program in .debug_line. + offset, ok := entry.Val(AttrStmtList).(int64) + if !ok { + return fmt.Errorf("AttrStmtList not present or not int64 for unit %d", r.unit) + } + buf := makeBuf(d, &d.unit[r.unit], "line", Offset(offset), d.line[offset:]) + var m lineMachine + if err := m.parseHeader(&buf); err != nil { + return err + } + fileNumOffset := uint64(len(d.sourceFiles)) + for _, f := range m.header.file { + d.sourceFiles = append(d.sourceFiles, f.name) + } + fn := func(m *lineMachine) bool { + if m.endSequence { + cache = append(cache, pcToLineEntry{ + pc: m.address, + line: 0, + file: 0, + }) + } else { + // m.file is a 1-based index into the files of this line number program's + // header. Translate it to a 0-based index into d.sourceFiles. + fnum := fileNumOffset + m.file - 1 + cache = append(cache, pcToLineEntry{ + pc: m.address, + line: m.line, + file: fnum, + }) + } + return true + } + if err := m.evalCompilationUnit(&buf, fn); err != nil { + return err + } + } + d.buildLineToPCCache(cache) + d.buildPCToLineCache(cache) + return nil +} + +// buildInfoCaches initializes nameCache and pcToFuncEntries by walking the +// top-level entries under each compile unit. It swallows any errors in parsing. +func (d *Data) buildInfoCaches() { + // TODO: record errors somewhere? + d.nameCache = make(map[string]*nameCacheEntry) + + var pcToFuncEntries pcToFuncEntries + + r := d.Reader() +loop: + for { + entry, err := r.Next() + if entry == nil || err != nil { + break loop + } + if entry.Tag != TagCompileUnit /* DW_TAG_compile_unit */ { + r.SkipChildren() + continue + } + for { + entry, err := r.Next() + if entry == nil || err != nil { + break loop + } + if entry.Tag == 0 { + // End of children of current compile unit. + break + } + r.SkipChildren() + // Update name-to-entry cache. + if name, ok := entry.Val(AttrName).(string); ok { + d.nameCache[name] = &nameCacheEntry{entry: entry, link: d.nameCache[name]} + } + + // If this entry is a function, update PC-to-containing-function cache. + if entry.Tag != TagSubprogram /* DW_TAG_subprogram */ { + continue + } + + // DW_AT_low_pc, if present, is the address of the first instruction of + // the function. + lowpc, ok := entry.Val(AttrLowpc).(uint64) + if !ok { + continue + } + pcToFuncEntries = append(pcToFuncEntries, pcToFuncEntry{lowpc, entry}) + + // DW_AT_high_pc, if present (TODO: and of class address) is the address + // one past the last instruction of the function. + highpc, ok := entry.Val(AttrHighpc).(uint64) + if !ok { + continue + } + pcToFuncEntries = append(pcToFuncEntries, pcToFuncEntry{highpc, nil}) + } + } + // Sort elements by PC. If there are multiple elements with the same PC, + // those with non-nil *Entry are placed earlier. + sort.Sort(pcToFuncEntries) + + // Copy only the first element for each PC to out. + n := 0 + for i, ce := range pcToFuncEntries { + if i == 0 || ce.pc != pcToFuncEntries[i-1].pc { + n++ + } + } + out := make([]pcToFuncEntry, 0, n) + for i, ce := range pcToFuncEntries { + if i == 0 || ce.pc != pcToFuncEntries[i-1].pc { + out = append(out, ce) + } + } + d.pcToFuncEntries = out +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/const.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/const.go new file mode 100644 index 000000000..adf7882fc --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/const.go @@ -0,0 +1,480 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Constants + +package dwarf + +import "strconv" + +// An Attr identifies the attribute type in a DWARF Entry's Field. +type Attr uint32 + +const ( + AttrSibling Attr = 0x01 + AttrLocation Attr = 0x02 + AttrName Attr = 0x03 + AttrOrdering Attr = 0x09 + AttrByteSize Attr = 0x0B + AttrBitOffset Attr = 0x0C + AttrBitSize Attr = 0x0D + AttrStmtList Attr = 0x10 + AttrLowpc Attr = 0x11 + AttrHighpc Attr = 0x12 + AttrLanguage Attr = 0x13 + AttrDiscr Attr = 0x15 + AttrDiscrValue Attr = 0x16 + AttrVisibility Attr = 0x17 + AttrImport Attr = 0x18 + AttrStringLength Attr = 0x19 + AttrCommonRef Attr = 0x1A + AttrCompDir Attr = 0x1B + AttrConstValue Attr = 0x1C + AttrContainingType Attr = 0x1D + AttrDefaultValue Attr = 0x1E + AttrInline Attr = 0x20 + AttrIsOptional Attr = 0x21 + AttrLowerBound Attr = 0x22 + AttrProducer Attr = 0x25 + AttrPrototyped Attr = 0x27 + AttrReturnAddr Attr = 0x2A + AttrStartScope Attr = 0x2C + AttrStrideSize Attr = 0x2E + AttrUpperBound Attr = 0x2F + AttrAbstractOrigin Attr = 0x31 + AttrAccessibility Attr = 0x32 + AttrAddrClass Attr = 0x33 + AttrArtificial Attr = 0x34 + AttrBaseTypes Attr = 0x35 + AttrCalling Attr = 0x36 + AttrCount Attr = 0x37 + AttrDataMemberLoc Attr = 0x38 + AttrDeclColumn Attr = 0x39 + AttrDeclFile Attr = 0x3A + AttrDeclLine Attr = 0x3B + AttrDeclaration Attr = 0x3C + AttrDiscrList Attr = 0x3D + AttrEncoding Attr = 0x3E + AttrExternal Attr = 0x3F + AttrFrameBase Attr = 0x40 + AttrFriend Attr = 0x41 + AttrIdentifierCase Attr = 0x42 + AttrMacroInfo Attr = 0x43 + AttrNamelistItem Attr = 0x44 + AttrPriority Attr = 0x45 + AttrSegment Attr = 0x46 + AttrSpecification Attr = 0x47 + AttrStaticLink Attr = 0x48 + AttrType Attr = 0x49 + AttrUseLocation Attr = 0x4A + AttrVarParam Attr = 0x4B + AttrVirtuality Attr = 0x4C + AttrVtableElemLoc Attr = 0x4D + AttrAllocated Attr = 0x4E + AttrAssociated Attr = 0x4F + AttrDataLocation Attr = 0x50 + AttrStride Attr = 0x51 + AttrEntrypc Attr = 0x52 + AttrUseUTF8 Attr = 0x53 + AttrExtension Attr = 0x54 + AttrRanges Attr = 0x55 + AttrTrampoline Attr = 0x56 + AttrCallColumn Attr = 0x57 + AttrCallFile Attr = 0x58 + AttrCallLine Attr = 0x59 + AttrDescription Attr = 0x5A + + // Go-specific attributes. + AttrGoKind Attr = 0x2900 + AttrGoKey Attr = 0x2901 + AttrGoElem Attr = 0x2902 + AttrGoEmbeddedField Attr = 0x2903 +) + +var attrNames = [...]string{ + AttrSibling: "Sibling", + AttrLocation: "Location", + AttrName: "Name", + AttrOrdering: "Ordering", + AttrByteSize: "ByteSize", + AttrBitOffset: "BitOffset", + AttrBitSize: "BitSize", + AttrStmtList: "StmtList", + AttrLowpc: "Lowpc", + AttrHighpc: "Highpc", + AttrLanguage: "Language", + AttrDiscr: "Discr", + AttrDiscrValue: "DiscrValue", + AttrVisibility: "Visibility", + AttrImport: "Import", + AttrStringLength: "StringLength", + AttrCommonRef: "CommonRef", + AttrCompDir: "CompDir", + AttrConstValue: "ConstValue", + AttrContainingType: "ContainingType", + AttrDefaultValue: "DefaultValue", + AttrInline: "Inline", + AttrIsOptional: "IsOptional", + AttrLowerBound: "LowerBound", + AttrProducer: "Producer", + AttrPrototyped: "Prototyped", + AttrReturnAddr: "ReturnAddr", + AttrStartScope: "StartScope", + AttrStrideSize: "StrideSize", + AttrUpperBound: "UpperBound", + AttrAbstractOrigin: "AbstractOrigin", + AttrAccessibility: "Accessibility", + AttrAddrClass: "AddrClass", + AttrArtificial: "Artificial", + AttrBaseTypes: "BaseTypes", + AttrCalling: "Calling", + AttrCount: "Count", + AttrDataMemberLoc: "DataMemberLoc", + AttrDeclColumn: "DeclColumn", + AttrDeclFile: "DeclFile", + AttrDeclLine: "DeclLine", + AttrDeclaration: "Declaration", + AttrDiscrList: "DiscrList", + AttrEncoding: "Encoding", + AttrExternal: "External", + AttrFrameBase: "FrameBase", + AttrFriend: "Friend", + AttrIdentifierCase: "IdentifierCase", + AttrMacroInfo: "MacroInfo", + AttrNamelistItem: "NamelistItem", + AttrPriority: "Priority", + AttrSegment: "Segment", + AttrSpecification: "Specification", + AttrStaticLink: "StaticLink", + AttrType: "Type", + AttrUseLocation: "UseLocation", + AttrVarParam: "VarParam", + AttrVirtuality: "Virtuality", + AttrVtableElemLoc: "VtableElemLoc", + AttrAllocated: "Allocated", + AttrAssociated: "Associated", + AttrDataLocation: "DataLocation", + AttrStride: "Stride", + AttrEntrypc: "Entrypc", + AttrUseUTF8: "UseUTF8", + AttrExtension: "Extension", + AttrRanges: "Ranges", + AttrTrampoline: "Trampoline", + AttrCallColumn: "CallColumn", + AttrCallFile: "CallFile", + AttrCallLine: "CallLine", + AttrDescription: "Description", +} + +func (a Attr) String() string { + if int(a) < len(attrNames) { + s := attrNames[a] + if s != "" { + return s + } + } + switch a { + case AttrGoKind: + return "GoKind" + case AttrGoKey: + return "GoKey" + case AttrGoElem: + return "GoElem" + case AttrGoEmbeddedField: + return "GoEmbeddedField" + } + return strconv.Itoa(int(a)) +} + +func (a Attr) GoString() string { + if int(a) < len(attrNames) { + s := attrNames[a] + if s != "" { + return "dwarf.Attr" + s + } + } + return "dwarf.Attr(" + strconv.FormatInt(int64(a), 10) + ")" +} + +// A format is a DWARF data encoding format. +type format uint32 + +const ( + // value formats + formAddr format = 0x01 + formDwarfBlock2 format = 0x03 + formDwarfBlock4 format = 0x04 + formData2 format = 0x05 + formData4 format = 0x06 + formData8 format = 0x07 + formString format = 0x08 + formDwarfBlock format = 0x09 + formDwarfBlock1 format = 0x0A + formData1 format = 0x0B + formFlag format = 0x0C + formSdata format = 0x0D + formStrp format = 0x0E + formUdata format = 0x0F + formRefAddr format = 0x10 + formRef1 format = 0x11 + formRef2 format = 0x12 + formRef4 format = 0x13 + formRef8 format = 0x14 + formRefUdata format = 0x15 + formIndirect format = 0x16 + // The following are new in DWARF 4. + formSecOffset format = 0x17 + formExprloc format = 0x18 + formFlagPresent format = 0x19 + formRefSig8 format = 0x20 + // Extensions for multi-file compression (.dwz) + // http://www.dwarfstd.org/ShowIssue.php?issue=120604.1 + formGnuRefAlt format = 0x1f20 + formGnuStrpAlt format = 0x1f21 +) + +// A Tag is the classification (the type) of an Entry. +type Tag uint32 + +const ( + TagArrayType Tag = 0x01 + TagClassType Tag = 0x02 + TagEntryPoint Tag = 0x03 + TagEnumerationType Tag = 0x04 + TagFormalParameter Tag = 0x05 + TagImportedDeclaration Tag = 0x08 + TagLabel Tag = 0x0A + TagLexDwarfBlock Tag = 0x0B + TagMember Tag = 0x0D + TagPointerType Tag = 0x0F + TagReferenceType Tag = 0x10 + TagCompileUnit Tag = 0x11 + TagStringType Tag = 0x12 + TagStructType Tag = 0x13 + TagSubroutineType Tag = 0x15 + TagTypedef Tag = 0x16 + TagUnionType Tag = 0x17 + TagUnspecifiedParameters Tag = 0x18 + TagVariant Tag = 0x19 + TagCommonDwarfBlock Tag = 0x1A + TagCommonInclusion Tag = 0x1B + TagInheritance Tag = 0x1C + TagInlinedSubroutine Tag = 0x1D + TagModule Tag = 0x1E + TagPtrToMemberType Tag = 0x1F + TagSetType Tag = 0x20 + TagSubrangeType Tag = 0x21 + TagWithStmt Tag = 0x22 + TagAccessDeclaration Tag = 0x23 + TagBaseType Tag = 0x24 + TagCatchDwarfBlock Tag = 0x25 + TagConstType Tag = 0x26 + TagConstant Tag = 0x27 + TagEnumerator Tag = 0x28 + TagFileType Tag = 0x29 + TagFriend Tag = 0x2A + TagNamelist Tag = 0x2B + TagNamelistItem Tag = 0x2C + TagPackedType Tag = 0x2D + TagSubprogram Tag = 0x2E + TagTemplateTypeParameter Tag = 0x2F + TagTemplateValueParameter Tag = 0x30 + TagThrownType Tag = 0x31 + TagTryDwarfBlock Tag = 0x32 + TagVariantPart Tag = 0x33 + TagVariable Tag = 0x34 + TagVolatileType Tag = 0x35 + // The following are new in DWARF 3. + TagDwarfProcedure Tag = 0x36 + TagRestrictType Tag = 0x37 + TagInterfaceType Tag = 0x38 + TagNamespace Tag = 0x39 + TagImportedModule Tag = 0x3A + TagUnspecifiedType Tag = 0x3B + TagPartialUnit Tag = 0x3C + TagImportedUnit Tag = 0x3D + TagMutableType Tag = 0x3E // Later removed from DWARF. + TagCondition Tag = 0x3F + TagSharedType Tag = 0x40 + // The following are new in DWARF 4. + TagTypeUnit Tag = 0x41 + TagRvalueReferenceType Tag = 0x42 + TagTemplateAlias Tag = 0x43 +) + +var tagNames = [...]string{ + TagArrayType: "ArrayType", + TagClassType: "ClassType", + TagEntryPoint: "EntryPoint", + TagEnumerationType: "EnumerationType", + TagFormalParameter: "FormalParameter", + TagImportedDeclaration: "ImportedDeclaration", + TagLabel: "Label", + TagLexDwarfBlock: "LexDwarfBlock", + TagMember: "Member", + TagPointerType: "PointerType", + TagReferenceType: "ReferenceType", + TagCompileUnit: "CompileUnit", + TagStringType: "StringType", + TagStructType: "StructType", + TagSubroutineType: "SubroutineType", + TagTypedef: "Typedef", + TagUnionType: "UnionType", + TagUnspecifiedParameters: "UnspecifiedParameters", + TagVariant: "Variant", + TagCommonDwarfBlock: "CommonDwarfBlock", + TagCommonInclusion: "CommonInclusion", + TagInheritance: "Inheritance", + TagInlinedSubroutine: "InlinedSubroutine", + TagModule: "Module", + TagPtrToMemberType: "PtrToMemberType", + TagSetType: "SetType", + TagSubrangeType: "SubrangeType", + TagWithStmt: "WithStmt", + TagAccessDeclaration: "AccessDeclaration", + TagBaseType: "BaseType", + TagCatchDwarfBlock: "CatchDwarfBlock", + TagConstType: "ConstType", + TagConstant: "Constant", + TagEnumerator: "Enumerator", + TagFileType: "FileType", + TagFriend: "Friend", + TagNamelist: "Namelist", + TagNamelistItem: "NamelistItem", + TagPackedType: "PackedType", + TagSubprogram: "Subprogram", + TagTemplateTypeParameter: "TemplateTypeParameter", + TagTemplateValueParameter: "TemplateValueParameter", + TagThrownType: "ThrownType", + TagTryDwarfBlock: "TryDwarfBlock", + TagVariantPart: "VariantPart", + TagVariable: "Variable", + TagVolatileType: "VolatileType", + TagDwarfProcedure: "DwarfProcedure", + TagRestrictType: "RestrictType", + TagInterfaceType: "InterfaceType", + TagNamespace: "Namespace", + TagImportedModule: "ImportedModule", + TagUnspecifiedType: "UnspecifiedType", + TagPartialUnit: "PartialUnit", + TagImportedUnit: "ImportedUnit", + TagMutableType: "MutableType", + TagCondition: "Condition", + TagSharedType: "SharedType", + TagTypeUnit: "TypeUnit", + TagRvalueReferenceType: "RvalueReferenceType", + TagTemplateAlias: "TemplateAlias", +} + +func (t Tag) String() string { + if int(t) < len(tagNames) { + s := tagNames[t] + if s != "" { + return s + } + } + return strconv.Itoa(int(t)) +} + +func (t Tag) GoString() string { + if int(t) < len(tagNames) { + s := tagNames[t] + if s != "" { + return "dwarf.Tag" + s + } + } + return "dwarf.Tag(" + strconv.FormatInt(int64(t), 10) + ")" +} + +// Location expression operators. +// The debug info encodes value locations like 8(R3) +// as a sequence of these op codes. +// This package does not implement full expressions; +// the opPlusUconst operator is expected by the type parser. +const ( + opAddr = 0x03 /* 1 op, const addr */ + opDeref = 0x06 + opConst1u = 0x08 /* 1 op, 1 byte const */ + opConst1s = 0x09 /* " signed */ + opConst2u = 0x0A /* 1 op, 2 byte const */ + opConst2s = 0x0B /* " signed */ + opConst4u = 0x0C /* 1 op, 4 byte const */ + opConst4s = 0x0D /* " signed */ + opConst8u = 0x0E /* 1 op, 8 byte const */ + opConst8s = 0x0F /* " signed */ + opConstu = 0x10 /* 1 op, LEB128 const */ + opConsts = 0x11 /* " signed */ + opDup = 0x12 + opDrop = 0x13 + opOver = 0x14 + opPick = 0x15 /* 1 op, 1 byte stack index */ + opSwap = 0x16 + opRot = 0x17 + opXderef = 0x18 + opAbs = 0x19 + opAnd = 0x1A + opDiv = 0x1B + opMinus = 0x1C + opMod = 0x1D + opMul = 0x1E + opNeg = 0x1F + opNot = 0x20 + opOr = 0x21 + opPlus = 0x22 + opPlusUconst = 0x23 /* 1 op, ULEB128 addend */ + opShl = 0x24 + opShr = 0x25 + opShra = 0x26 + opXor = 0x27 + opSkip = 0x2F /* 1 op, signed 2-byte constant */ + opBra = 0x28 /* 1 op, signed 2-byte constant */ + opEq = 0x29 + opGe = 0x2A + opGt = 0x2B + opLe = 0x2C + opLt = 0x2D + opNe = 0x2E + opLit0 = 0x30 + /* OpLitN = OpLit0 + N for N = 0..31 */ + opReg0 = 0x50 + /* OpRegN = OpReg0 + N for N = 0..31 */ + opBreg0 = 0x70 /* 1 op, signed LEB128 constant */ + /* OpBregN = OpBreg0 + N for N = 0..31 */ + opRegx = 0x90 /* 1 op, ULEB128 register */ + opFbreg = 0x91 /* 1 op, SLEB128 offset */ + opBregx = 0x92 /* 2 op, ULEB128 reg; SLEB128 off */ + opPiece = 0x93 /* 1 op, ULEB128 size of piece */ + opDerefSize = 0x94 /* 1-byte size of data retrieved */ + opXderefSize = 0x95 /* 1-byte size of data retrieved */ + opNop = 0x96 + /* next four new in Dwarf v3 */ + opPushObjAddr = 0x97 + opCall2 = 0x98 /* 2-byte offset of DIE */ + opCall4 = 0x99 /* 4-byte offset of DIE */ + opCallRef = 0x9A /* 4- or 8- byte offset of DIE */ + /* 0xE0-0xFF reserved for user-specific */ +) + +// Basic type encodings -- the value for AttrEncoding in a TagBaseType Entry. +const ( + encAddress = 0x01 + encBoolean = 0x02 + encComplexFloat = 0x03 + encFloat = 0x04 + encSigned = 0x05 + encSignedChar = 0x06 + encUnsigned = 0x07 + encUnsignedChar = 0x08 + encImaginaryFloat = 0x09 +) diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/entry.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/entry.go new file mode 100644 index 000000000..ecf2a0845 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/entry.go @@ -0,0 +1,417 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// DWARF debug information entry parser. +// An entry is a sequence of data items of a given format. +// The first word in the entry is an index into what DWARF +// calls the ``abbreviation table.'' An abbreviation is really +// just a type descriptor: it's an array of attribute tag/value format pairs. + +package dwarf + +import ( + "errors" + "strconv" +) + +// a single entry's description: a sequence of attributes +type abbrev struct { + tag Tag + children bool + field []afield +} + +type afield struct { + attr Attr + fmt format +} + +// a map from entry format ids to their descriptions +type abbrevTable map[uint32]abbrev + +// ParseAbbrev returns the abbreviation table that starts at byte off +// in the .debug_abbrev section. +func (d *Data) parseAbbrev(off uint32) (abbrevTable, error) { + if m, ok := d.abbrevCache[off]; ok { + return m, nil + } + + data := d.abbrev + if off > uint32(len(data)) { + data = nil + } else { + data = data[off:] + } + b := makeBuf(d, unknownFormat{}, "abbrev", 0, data) + + // Error handling is simplified by the buf getters + // returning an endless stream of 0s after an error. + m := make(abbrevTable) + for { + // Table ends with id == 0. + id := uint32(b.uint()) + if id == 0 { + break + } + + // Walk over attributes, counting. + n := 0 + b1 := b // Read from copy of b. + b1.uint() + b1.uint8() + for { + tag := b1.uint() + fmt := b1.uint() + if tag == 0 && fmt == 0 { + break + } + n++ + } + if b1.err != nil { + return nil, b1.err + } + + // Walk over attributes again, this time writing them down. + var a abbrev + a.tag = Tag(b.uint()) + a.children = b.uint8() != 0 + a.field = make([]afield, n) + for i := range a.field { + a.field[i].attr = Attr(b.uint()) + a.field[i].fmt = format(b.uint()) + } + b.uint() + b.uint() + + m[id] = a + } + if b.err != nil { + return nil, b.err + } + d.abbrevCache[off] = m + return m, nil +} + +// An entry is a sequence of attribute/value pairs. +type Entry struct { + Offset Offset // offset of Entry in DWARF info + Tag Tag // tag (kind of Entry) + Children bool // whether Entry is followed by children + Field []Field +} + +// A Field is a single attribute/value pair in an Entry. +type Field struct { + Attr Attr + Val interface{} +} + +// Val returns the value associated with attribute Attr in Entry, +// or nil if there is no such attribute. +// +// A common idiom is to merge the check for nil return with +// the check that the value has the expected dynamic type, as in: +// v, ok := e.Val(AttrSibling).(int64); +// +func (e *Entry) Val(a Attr) interface{} { + for _, f := range e.Field { + if f.Attr == a { + return f.Val + } + } + return nil +} + +// An Offset represents the location of an Entry within the DWARF info. +// (See Reader.Seek.) +type Offset uint32 + +// Entry reads a single entry from buf, decoding +// according to the given abbreviation table. +func (b *buf) entry(atab abbrevTable, ubase Offset) *Entry { + off := b.off + id := uint32(b.uint()) + if id == 0 { + return &Entry{} + } + a, ok := atab[id] + if !ok { + b.error("unknown abbreviation table index") + return nil + } + e := &Entry{ + Offset: off, + Tag: a.tag, + Children: a.children, + Field: make([]Field, len(a.field)), + } + for i := range e.Field { + e.Field[i].Attr = a.field[i].attr + fmt := a.field[i].fmt + if fmt == formIndirect { + fmt = format(b.uint()) + } + var val interface{} + switch fmt { + default: + b.error("unknown entry attr format 0x" + strconv.FormatInt(int64(fmt), 16)) + + // address + case formAddr: + val = b.addr() + + // block + case formDwarfBlock1: + val = b.bytes(int(b.uint8())) + case formDwarfBlock2: + val = b.bytes(int(b.uint16())) + case formDwarfBlock4: + val = b.bytes(int(b.uint32())) + case formDwarfBlock: + val = b.bytes(int(b.uint())) + + // constant + case formData1: + val = int64(b.uint8()) + case formData2: + val = int64(b.uint16()) + case formData4: + val = int64(b.uint32()) + case formData8: + val = int64(b.uint64()) + case formSdata: + val = int64(b.int()) + case formUdata: + val = int64(b.uint()) + + // flag + case formFlag: + val = b.uint8() == 1 + // New in DWARF 4. + case formFlagPresent: + // The attribute is implicitly indicated as present, and no value is + // encoded in the debugging information entry itself. + val = true + + // reference to other entry + case formRefAddr: + vers := b.format.version() + if vers == 0 { + b.error("unknown version for DW_FORM_ref_addr") + } else if vers == 2 { + val = Offset(b.addr()) + } else { + is64, known := b.format.dwarf64() + if !known { + b.error("unknown size for DW_FORM_ref_addr") + } else if is64 { + val = Offset(b.uint64()) + } else { + val = Offset(b.uint32()) + } + } + case formRef1: + val = Offset(b.uint8()) + ubase + case formRef2: + val = Offset(b.uint16()) + ubase + case formRef4: + val = Offset(b.uint32()) + ubase + case formRef8: + val = Offset(b.uint64()) + ubase + case formRefUdata: + val = Offset(b.uint()) + ubase + + // string + case formString: + val = b.string() + case formStrp: + off := b.uint32() // offset into .debug_str + if b.err != nil { + return nil + } + b1 := makeBuf(b.dwarf, unknownFormat{}, "str", 0, b.dwarf.str) + b1.skip(int(off)) + val = b1.string() + if b1.err != nil { + b.err = b1.err + return nil + } + + // lineptr, loclistptr, macptr, rangelistptr + // New in DWARF 4, but clang can generate them with -gdwarf-2. + // Section reference, replacing use of formData4 and formData8. + case formSecOffset, formGnuRefAlt, formGnuStrpAlt: + is64, known := b.format.dwarf64() + if !known { + b.error("unknown size for form 0x" + strconv.FormatInt(int64(fmt), 16)) + } else if is64 { + val = int64(b.uint64()) + } else { + val = int64(b.uint32()) + } + + // exprloc + // New in DWARF 4. + case formExprloc: + val = b.bytes(int(b.uint())) + + // reference + // New in DWARF 4. + case formRefSig8: + // 64-bit type signature. + val = b.uint64() + } + e.Field[i].Val = val + } + if b.err != nil { + return nil + } + return e +} + +// A Reader allows reading Entry structures from a DWARF ``info'' section. +// The Entry structures are arranged in a tree. The Reader's Next function +// return successive entries from a pre-order traversal of the tree. +// If an entry has children, its Children field will be true, and the children +// follow, terminated by an Entry with Tag 0. +type Reader struct { + b buf + d *Data + err error + unit int + lastChildren bool // .Children of last entry returned by Next + lastSibling Offset // .Val(AttrSibling) of last entry returned by Next +} + +// Reader returns a new Reader for Data. +// The reader is positioned at byte offset 0 in the DWARF ``info'' section. +func (d *Data) Reader() *Reader { + r := &Reader{d: d} + r.Seek(0) + return r +} + +// AddressSize returns the size in bytes of addresses in the current compilation +// unit. +func (r *Reader) AddressSize() int { + return r.d.unit[r.unit].asize +} + +// Seek positions the Reader at offset off in the encoded entry stream. +// Offset 0 can be used to denote the first entry. +func (r *Reader) Seek(off Offset) { + d := r.d + r.err = nil + r.lastChildren = false + if off == 0 { + if len(d.unit) == 0 { + return + } + u := &d.unit[0] + r.unit = 0 + r.b = makeBuf(r.d, u, "info", u.off, u.data) + return + } + + // TODO(rsc): binary search (maybe a new package) + var i int + var u *unit + for i = range d.unit { + u = &d.unit[i] + if u.off <= off && off < u.off+Offset(len(u.data)) { + r.unit = i + r.b = makeBuf(r.d, u, "info", off, u.data[off-u.off:]) + return + } + } + r.err = errors.New("offset out of range") +} + +// maybeNextUnit advances to the next unit if this one is finished. +func (r *Reader) maybeNextUnit() { + for len(r.b.data) == 0 && r.unit+1 < len(r.d.unit) { + r.unit++ + u := &r.d.unit[r.unit] + r.b = makeBuf(r.d, u, "info", u.off, u.data) + } +} + +// Next reads the next entry from the encoded entry stream. +// It returns nil, nil when it reaches the end of the section. +// It returns an error if the current offset is invalid or the data at the +// offset cannot be decoded as a valid Entry. +func (r *Reader) Next() (*Entry, error) { + if r.err != nil { + return nil, r.err + } + r.maybeNextUnit() + if len(r.b.data) == 0 { + return nil, nil + } + u := &r.d.unit[r.unit] + e := r.b.entry(u.atable, u.base) + if r.b.err != nil { + r.err = r.b.err + return nil, r.err + } + if e != nil { + r.lastChildren = e.Children + if r.lastChildren { + r.lastSibling, _ = e.Val(AttrSibling).(Offset) + } + } else { + r.lastChildren = false + } + return e, nil +} + +// SkipChildren skips over the child entries associated with +// the last Entry returned by Next. If that Entry did not have +// children or Next has not been called, SkipChildren is a no-op. +func (r *Reader) SkipChildren() { + if r.err != nil || !r.lastChildren { + return + } + + // If the last entry had a sibling attribute, + // that attribute gives the offset of the next + // sibling, so we can avoid decoding the + // child subtrees. + if r.lastSibling >= r.b.off { + r.Seek(r.lastSibling) + return + } + + for { + e, err := r.Next() + if err != nil || e == nil || e.Tag == 0 { + break + } + if e.Children { + r.SkipChildren() + } + } +} + +// clone returns a copy of the reader. This is used by the typeReader +// interface. +func (r *Reader) clone() typeReader { + return r.d.Reader() +} + +// offset returns the current buffer offset. This is used by the +// typeReader interface. +func (r *Reader) offset() Offset { + return r.b.off +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/frame.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/frame.go new file mode 100644 index 000000000..56cae8d8e --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/frame.go @@ -0,0 +1,309 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Mapping from PC to SP offset (called CFA - Canonical Frame Address - in DWARF). +// This value is the offset from the stack pointer to the virtual frame pointer +// (address of zeroth argument) at each PC value in the program. + +package dwarf + +import "fmt" + +// http://www.dwarfstd.org/doc/DWARF4.pdf Section 6.4 page 126 +// We implement only the CFA column of the table, not the location +// information about other registers. In other words, we implement +// only what we need to understand Go programs compiled by gc. + +// PCToSPOffset returns the offset, at the specified PC, to add to the +// SP to reach the virtual frame pointer, which corresponds to the +// address of the zeroth argument of the function, the word on the +// stack immediately above the return PC. +func (d *Data) PCToSPOffset(pc uint64) (offset int64, err error) { + if len(d.frame) == 0 { + return 0, fmt.Errorf("PCToSPOffset: no frame table") + } + var m frameMachine + // Assume the first info unit is the same as us. Extremely likely. TODO? + if len(d.unit) == 0 { + return 0, fmt.Errorf("PCToSPOffset: no info section") + } + buf := makeBuf(d, &d.unit[0], "frame", 0, d.frame) + for len(buf.data) > 0 { + offset, err := m.evalCompilationUnit(&buf, pc) + if err != nil { + return 0, err + } + return offset, nil + } + return 0, fmt.Errorf("PCToSPOffset: no frame defined for PC %#x", pc) +} + +// Call Frame instructions. Figure 40, page 181. +// Structure is high two bits plus low 6 bits specified by + in comment. +// Some take one or two operands. +const ( + frameNop = 0<<6 + 0x00 + frameAdvanceLoc = 1<<6 + 0x00 // + delta + frameOffset = 2<<6 + 0x00 // + register op: ULEB128 offset + frameRestore = 3<<6 + 0x00 // + register + frameSetLoc = 0<<6 + 0x01 // op: address + frameAdvanceLoc1 = 0<<6 + 0x02 // op: 1-byte delta + frameAdvanceLoc2 = 0<<6 + 0x03 // op: 2-byte delta + frameAdvanceLoc4 = 0<<6 + 0x04 // op: 4-byte delta + frameOffsetExtended = 0<<6 + 0x05 // ops: ULEB128 register ULEB128 offset + frameRestoreExtended = 0<<6 + 0x06 // op: ULEB128 register + frameUndefined = 0<<6 + 0x07 // op: ULEB128 register + frameSameValue = 0<<6 + 0x08 // op: ULEB128 register + frameRegister = 0<<6 + 0x09 // op: ULEB128 register ULEB128 register + frameRememberState = 0<<6 + 0x0a + frameRestoreState = 0<<6 + 0x0b + frameDefCFA = 0<<6 + 0x0c // op: ULEB128 register ULEB128 offset + frameDefCFARegister = 0<<6 + 0x0d // op: ULEB128 register + frameDefCFAOffset = 0<<6 + 0x0e // op: ULEB128 offset + frameDefCFAExpression = 0<<6 + 0x0f // op: BLOCK + frameExpression = 0<<6 + 0x10 // op: ULEB128 register BLOCK + frameOffsetExtendedSf = 0<<6 + 0x11 // op: ULEB128 register SLEB128 offset + frameDefCFASf = 0<<6 + 0x12 // op: ULEB128 register SLEB128 offset + frameDefCFAOffsetSf = 0<<6 + 0x13 // op: SLEB128 offset + frameValOffset = 0<<6 + 0x14 // op: ULEB128 ULEB128 + frameValOffsetSf = 0<<6 + 0x15 // op: ULEB128 SLEB128 + frameValExpression = 0<<6 + 0x16 // op: ULEB128 BLOCK + frameLoUser = 0<<6 + 0x1c + frameHiUser = 0<<6 + 0x3f +) + +// frameMachine represents the PC/SP engine. +// Section 6.4, page 129. +type frameMachine struct { + // Initial values from CIE. + version uint8 // Version number, "independent of DWARF version" + augmentation string // Augmentation; treated as unexpected for now. TODO. + addressSize uint8 // In DWARF v4 and above. Size of a target address. + segmentSize uint8 // In DWARF v4 and above. Size of a segment selector. + codeAlignmentFactor uint64 // Unit of code size in advance instructions. + dataAlignmentFactor int64 // Unit of data size in certain offset instructions. + returnAddressRegister int // Pseudo-register (actually data column) representing return address. + returnRegisterOffset int64 // Offset to saved PC from CFA in bytes. + // CFA definition. + cfaRegister int // Which register represents the SP. + cfaOffset int64 // CFA offset value. + // Running machine. + location uint64 +} + +// evalCompilationUnit scans the frame data for one compilation unit to retrieve +// the offset information for the specified pc. +func (m *frameMachine) evalCompilationUnit(b *buf, pc uint64) (int64, error) { + err := m.parseCIE(b) + if err != nil { + return 0, err + } + for { + offset, found, err := m.scanFDE(b, pc) + if err != nil { + return 0, err + } + if found { + return offset, nil + } + } +} + +// parseCIE assumes the incoming buffer starts with a CIE block and parses it +// to initialize a frameMachine. +func (m *frameMachine) parseCIE(allBuf *buf) error { + length := int(allBuf.uint32()) + if len(allBuf.data) < length { + return fmt.Errorf("CIE parse error: too short") + } + // Create buffer for just this section. + b := allBuf.slice(length) + cie := b.uint32() + if cie != 0xFFFFFFFF { + return fmt.Errorf("CIE parse error: not CIE: %x", cie) + } + m.version = b.uint8() + if m.version != 3 && m.version != 4 { + return fmt.Errorf("CIE parse error: unsupported version %d", m.version) + } + m.augmentation = b.string() + if len(m.augmentation) > 0 { + return fmt.Errorf("CIE: can't handled augmentation string %q", m.augmentation) + } + if m.version >= 4 { + m.addressSize = b.uint8() + m.segmentSize = b.uint8() + } else { + // Unused. Gc generates version 3, so these values will not be + // set, but they are also not used so it's OK. + } + m.codeAlignmentFactor = b.uint() + m.dataAlignmentFactor = b.int() + m.returnAddressRegister = int(b.uint()) + + // Initial instructions. At least for Go, establishes SP register number + // and initial value of CFA offset at start of function. + _, err := m.run(&b, ^uint64(0)) + if err != nil { + return err + } + + // There's padding, but we can ignore it. + return nil +} + +// scanFDE assumes the incoming buffer starts with a FDE block and parses it +// to run a frameMachine and, if the PC is represented in its range, return +// the CFA offset for that PC. The boolean returned reports whether the +// PC is in range for this FDE. +func (m *frameMachine) scanFDE(allBuf *buf, pc uint64) (int64, bool, error) { + length := int(allBuf.uint32()) + if len(allBuf.data) < length { + return 0, false, fmt.Errorf("FDE parse error: too short") + } + if length <= 0 { + if length == 0 { + // EOF. + return 0, false, fmt.Errorf("PC %#x not found in PC/SP table", pc) + } + return 0, false, fmt.Errorf("bad FDE length %d", length) + } + // Create buffer for just this section. + b := allBuf.slice(length) + cieOffset := b.uint32() // TODO assumes 32 bits. + // Expect 0: first CIE in this segment. TODO. + if cieOffset != 0 { + return 0, false, fmt.Errorf("FDE parse error: bad CIE offset: %.2x", cieOffset) + } + // Initial location. + m.location = b.addr() + addressRange := b.addr() + // If the PC is not in this function, there's no point in executing the instructions. + if pc < m.location || m.location+addressRange <= pc { + return 0, false, nil + } + // The PC appears in this FDE. Scan to find the location. + offset, err := m.run(&b, pc) + if err != nil { + return 0, false, err + } + + // There's padding, but we can ignore it. + return offset, true, nil +} + +// run executes the instructions in the buffer, which has been sliced to contain +// only the data for this block. When we run out of data, we return. +// Since we are only called when we know the PC is in this block, reaching +// EOF is not an error, it just means the final CFA definition matches the +// tail of the block that holds the PC. +// The return value is the CFA at the end of the block or the PC, whichever +// comes first. +func (m *frameMachine) run(b *buf, pc uint64) (int64, error) { + // We run the machine at location == PC because if the PC is at the first + // instruction of a block, the definition of its offset arrives as an + // offset-defining operand after the PC is set to that location. + for m.location <= pc && len(b.data) > 0 { + op := b.uint8() + // Ops with embedded operands + switch op & 0xC0 { + case frameAdvanceLoc: // (6.4.2.1) + // delta in low bits + m.location += uint64(op & 0x3F) + continue + case frameOffset: // (6.4.2.3) + // Register in low bits; ULEB128 offset. + // For Go binaries we only see this in the CIE for the return address register. + if int(op&0x3F) != m.returnAddressRegister { + return 0, fmt.Errorf("invalid frameOffset register R%d should be R%d", op&0x3f, m.returnAddressRegister) + } + m.returnRegisterOffset = int64(b.uint()) * m.dataAlignmentFactor + continue + case frameRestore: // (6.4.2.3) + // register in low bits + return 0, fmt.Errorf("unimplemented frameRestore(R%d)\n", op&0x3F) + } + + // The remaining ops do not have embedded operands. + + switch op { + // Row creation instructions (6.4.2.1) + case frameNop: + case frameSetLoc: // op: address + return 0, fmt.Errorf("unimplemented setloc") // what size is operand? + case frameAdvanceLoc1: // op: 1-byte delta + m.location += uint64(b.uint8()) + case frameAdvanceLoc2: // op: 2-byte delta + m.location += uint64(b.uint16()) + case frameAdvanceLoc4: // op: 4-byte delta + m.location += uint64(b.uint32()) + + // CFA definition instructions (6.4.2.2) + case frameDefCFA: // op: ULEB128 register ULEB128 offset + m.cfaRegister = int(b.int()) + m.cfaOffset = int64(b.uint()) + case frameDefCFASf: // op: ULEB128 register SLEB128 offset + return 0, fmt.Errorf("unimplemented frameDefCFASf") + case frameDefCFARegister: // op: ULEB128 register + return 0, fmt.Errorf("unimplemented frameDefCFARegister") + case frameDefCFAOffset: // op: ULEB128 offset + return 0, fmt.Errorf("unimplemented frameDefCFAOffset") + case frameDefCFAOffsetSf: // op: SLEB128 offset + offset := b.int() + m.cfaOffset = offset * m.dataAlignmentFactor + // TODO: Verify we are using a factored offset. + case frameDefCFAExpression: // op: BLOCK + return 0, fmt.Errorf("unimplemented frameDefCFAExpression") + + // Register Rule instructions (6.4.2.3) + case frameOffsetExtended: // ops: ULEB128 register ULEB128 offset + // The same as frameOffset, but with the register specified in an operand. + reg := b.uint() + // For Go binaries we only see this in the CIE for the return address register. + if reg != uint64(m.returnAddressRegister) { + return 0, fmt.Errorf("invalid frameOffsetExtended: register R%d should be R%d", reg, m.returnAddressRegister) + } + m.returnRegisterOffset = int64(b.uint()) * m.dataAlignmentFactor + case frameRestoreExtended: // op: ULEB128 register + return 0, fmt.Errorf("unimplemented frameRestoreExtended") + case frameUndefined: // op: ULEB128 register; unimplemented + return 0, fmt.Errorf("unimplemented frameUndefined") + case frameSameValue: // op: ULEB128 register + return 0, fmt.Errorf("unimplemented frameSameValue") + case frameRegister: // op: ULEB128 register ULEB128 register + return 0, fmt.Errorf("unimplemented frameRegister") + case frameRememberState: + return 0, fmt.Errorf("unimplemented frameRememberState") + case frameRestoreState: + return 0, fmt.Errorf("unimplemented frameRestoreState") + case frameExpression: // op: ULEB128 register BLOCK + return 0, fmt.Errorf("unimplemented frameExpression") + case frameOffsetExtendedSf: // op: ULEB128 register SLEB128 offset + return 0, fmt.Errorf("unimplemented frameOffsetExtended_sf") + case frameValOffset: // op: ULEB128 ULEB128 + return 0, fmt.Errorf("unimplemented frameValOffset") + case frameValOffsetSf: // op: ULEB128 SLEB128 + return 0, fmt.Errorf("unimplemented frameValOffsetSf") + case frameValExpression: // op: ULEB128 BLOCK + return 0, fmt.Errorf("unimplemented frameValExpression") + + default: + if frameLoUser <= op && op <= frameHiUser { + return 0, fmt.Errorf("unknown user-defined frame op %#x", op) + } + return 0, fmt.Errorf("unknown frame op %#x", op) + } + } + return m.cfaOffset, nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/frame_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/frame_test.go new file mode 100644 index 000000000..ba4105b76 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/frame_test.go @@ -0,0 +1,158 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dwarf_test + +import ( + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf" +) + +var ( + pcspTempDir string + pcsptestBinary string +) + +func doPCToSPTest(self bool) bool { + // For now, only works on amd64 platforms. + if runtime.GOARCH != "amd64" { + return false + } + // Self test reads test binary; only works on Linux or Mac. + if self { + if runtime.GOOS != "linux" && runtime.GOOS != "darwin" { + return false + } + } + // Command below expects "sh", so Unix. + if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { + return false + } + if pcsptestBinary != "" { + return true + } + var err error + pcspTempDir, err = ioutil.TempDir("", "pcsptest") + if err != nil { + panic(err) + } + if strings.Contains(pcspTempDir, " ") { + panic("unexpected space in tempdir") + } + // This command builds pcsptest from testdata/pcsptest.go. + pcsptestBinary = filepath.Join(pcspTempDir, "pcsptest") + command := fmt.Sprintf("go tool compile -o %s.6 testdata/pcsptest.go && go tool link -H %s -o %s %s.6", + pcsptestBinary, runtime.GOOS, pcsptestBinary, pcsptestBinary) + cmd := exec.Command("sh", "-c", command) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + panic(err) + } + return true +} + +func endPCToSPTest() { + if pcspTempDir != "" { + os.RemoveAll(pcspTempDir) + pcspTempDir = "" + pcsptestBinary = "" + } +} + +func TestPCToSPOffset(t *testing.T) { + t.Skip("gets a stack layout it doesn't expect") + + if !doPCToSPTest(false) { + return + } + defer endPCToSPTest() + + data, err := getData(pcsptestBinary) + if err != nil { + t.Fatal(err) + } + entry, err := data.LookupFunction("main.test") + if err != nil { + t.Fatal("lookup startPC:", err) + } + startPC, ok := entry.Val(dwarf.AttrLowpc).(uint64) + if !ok { + t.Fatal(`DWARF data for function "main.test" has no low PC`) + } + endPC, ok := entry.Val(dwarf.AttrHighpc).(uint64) + if !ok { + t.Fatal(`DWARF data for function "main.test" has no high PC`) + } + + const addrSize = 8 // TODO: Assumes amd64. + const argSize = 8 // Defined by int64 arguments in test binary. + + // On 64-bit machines, the first offset must be one address size, + // for the return PC. + offset, err := data.PCToSPOffset(startPC) + if err != nil { + t.Fatal("startPC:", err) + } + if offset != addrSize { + t.Fatalf("expected %d at start of function; got %d", addrSize, offset) + } + // On 64-bit machines, expect some 8s and some 32s. (See the + // comments in testdata/pcsptest.go. + // TODO: The test could be stronger, but not much unless we + // disassemble the binary. + count := make(map[int64]int) + for pc := startPC; pc < endPC; pc++ { + offset, err := data.PCToSPOffset(pc) + if err != nil { + t.Fatal("scanning function:", err) + } + count[offset]++ + } + if len(count) != 2 { + t.Errorf("expected 2 offset values, got %d; counts are: %v", len(count), count) + } + if count[addrSize] == 0 { + t.Errorf("expected some values at offset %d; got %v", addrSize, count) + } + if count[addrSize+3*argSize] == 0 { + t.Errorf("expected some values at offset %d; got %v", addrSize+3*argSize, count) + } +} + +func getData(file string) (*dwarf.Data, error) { + switch runtime.GOOS { + case "linux": + f, err := elf.Open(file) + if err != nil { + return nil, err + } + dwarf, err := f.DWARF() + if err != nil { + return nil, err + } + f.Close() + return dwarf, nil + } + panic("unimplemented DWARF for GOOS=" + runtime.GOOS) +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/line.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/line.go new file mode 100644 index 000000000..e93bec55a --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/line.go @@ -0,0 +1,463 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dwarf + +// This file implements the mapping from PC to lines. +// TODO: Find a way to test this properly. + +// http://www.dwarfstd.org/doc/DWARF4.pdf Section 6.2 page 108 + +import ( + "fmt" + "sort" + "strings" +) + +// PCToLine returns the file and line number corresponding to the PC value. +// It returns an error if a correspondence cannot be found. +func (d *Data) PCToLine(pc uint64) (file string, line uint64, err error) { + c := d.pcToLineEntries + if len(c) == 0 { + return "", 0, fmt.Errorf("PCToLine: no line table") + } + i := sort.Search(len(c), func(i int) bool { return c[i].pc > pc }) - 1 + // c[i] is now the entry in pcToLineEntries with the largest pc that is not + // larger than the query pc. + // The search has failed if: + // - All pcs in c were larger than the query pc (i == -1). + // - c[i] marked the end of a sequence of instructions (c[i].file == 0). + // - c[i] is the last element of c, and isn't the end of a sequence of + // instructions, and the search pc is much larger than c[i].pc. In this + // case, we don't know the range of the last instruction, but the search + // pc is probably past it. + if i == -1 || c[i].file == 0 || (i+1 == len(c) && pc-c[i].pc > 1024) { + return "", 0, fmt.Errorf("no source line defined for PC %#x", pc) + } + if c[i].file >= uint64(len(d.sourceFiles)) { + return "", 0, fmt.Errorf("invalid file number in DWARF data") + } + return d.sourceFiles[c[i].file], c[i].line, nil +} + +// LineToBreakpointPCs returns the PCs that should be used as breakpoints +// corresponding to the given file and line number. +// It returns an empty slice if no PCs were found. +func (d *Data) LineToBreakpointPCs(file string, line uint64) ([]uint64, error) { + compDir := d.compilationDirectory() + + // Find the closest match in the executable for the specified file. + // We choose the file with the largest number of path components matching + // at the end of the name. If there is a tie, we prefer files that are + // under the compilation directory. If there is still a tie, we choose + // the file with the shortest name. + // TODO: handle duplicate file names in the DWARF? + var bestFile struct { + fileNum uint64 // Index of the file in the DWARF data. + components int // Number of matching path components. + length int // Length of the filename. + underComp bool // File is under the compilation directory. + } + for filenum, filename := range d.sourceFiles { + c := matchingPathComponentSuffixSize(filename, file) + underComp := strings.HasPrefix(filename, compDir) + better := false + if c != bestFile.components { + better = c > bestFile.components + } else if underComp != bestFile.underComp { + better = underComp + } else { + better = len(filename) < bestFile.length + } + if better { + bestFile.fileNum = uint64(filenum) + bestFile.components = c + bestFile.length = len(filename) + bestFile.underComp = underComp + } + } + if bestFile.components == 0 { + return nil, fmt.Errorf("couldn't find file %q", file) + } + c := d.lineToPCEntries[bestFile.fileNum] + // c contains all (pc, line) pairs for the appropriate file. + start := sort.Search(len(c), func(i int) bool { return c[i].line >= line }) + end := sort.Search(len(c), func(i int) bool { return c[i].line > line }) + // c[i].line == line for all i in the range [start, end). + pcs := make([]uint64, 0, end-start) + for i := start; i < end; i++ { + pcs = append(pcs, c[i].pc) + } + return pcs, nil +} + +// compilationDirectory finds the first compilation unit entry in d and returns +// the compilation directory contained in it. +// If it fails, it returns the empty string. +func (d *Data) compilationDirectory() string { + r := d.Reader() + for { + entry, err := r.Next() + if entry == nil || err != nil { + return "" + } + if entry.Tag == TagCompileUnit { + name, _ := entry.Val(AttrCompDir).(string) + return name + } + } +} + +// matchingPathComponentSuffixSize returns the largest n such that the last n +// components of the paths p1 and p2 are equal. +// e.g. matchingPathComponentSuffixSize("a/b/x/y.go", "b/a/x/y.go") returns 2. +func matchingPathComponentSuffixSize(p1, p2 string) int { + // TODO: deal with other path separators. + c1 := strings.Split(p1, "/") + c2 := strings.Split(p2, "/") + min := len(c1) + if len(c2) < min { + min = len(c2) + } + var n int + for n = 0; n < min; n++ { + if c1[len(c1)-1-n] != c2[len(c2)-1-n] { + break + } + } + return n +} + +// Standard opcodes. Figure 37, page 178. +// If an opcode >= lineMachine.prologue.opcodeBase, it is a special +// opcode rather than the opcode defined in this table. +const ( + lineStdCopy = 0x01 + lineStdAdvancePC = 0x02 + lineStdAdvanceLine = 0x03 + lineStdSetFile = 0x04 + lineStdSetColumn = 0x05 + lineStdNegateStmt = 0x06 + lineStdSetBasicBlock = 0x07 + lineStdConstAddPC = 0x08 + lineStdFixedAdvancePC = 0x09 + lineStdSetPrologueEnd = 0x0a + lineStdSetEpilogueBegin = 0x0b + lineStdSetISA = 0x0c +) + +// Extended opcodes. Figure 38, page 179. +const ( + lineStartExtendedOpcode = 0x00 // Not defined as a named constant in the spec. + lineExtEndSequence = 0x01 + lineExtSetAddress = 0x02 + lineExtDefineFile = 0x03 + lineExtSetDiscriminator = 0x04 // New in version 4. + lineExtLoUser = 0x80 + lineExtHiUser = 0xff +) + +// lineHeader holds the information stored in the header of the line table for a +// single compilation unit. +// Section 6.2.4, page 112. +type lineHeader struct { + unitLength int + version int + headerLength int + minInstructionLength int + maxOpsPerInstruction int + defaultIsStmt bool + lineBase int + lineRange int + opcodeBase byte + stdOpcodeLengths []byte + include []string // entry 0 is empty; means current directory + file []lineFile // entry 0 is empty. +} + +// lineFile represents a file name stored in the PC/line table, usually in the header. +type lineFile struct { + name string + index int // index into include directories + time int // implementation-defined time of last modification + length int // length in bytes, 0 if not available. +} + +// lineMachine holds the registers evaluated during executing of the PC/line mapping engine. +// Section 6.2.2, page 109. +// A .debug_line section consists of multiple line number programs, one for each compilation unit. +type lineMachine struct { + // The program-counter value corresponding to a machine instruction generated by the compiler. + address uint64 + + // An unsigned integer representing the index of an operation within a VLIW + // instruction. The index of the first operation is 0. For non-VLIW + // architectures, this register will always be 0. + // The address and op_index registers, taken together, form an operation + // pointer that can reference any individual operation with the instruction + // stream. + opIndex uint64 + + // An unsigned integer indicating the identity of the source file corresponding to a machine instruction. + file uint64 + + // An unsigned integer indicating a source line number. Lines are numbered + // beginning at 1. The compiler may emit the value 0 in cases where an + // instruction cannot be attributed to any source line. + line uint64 + + // An unsigned integer indicating a column number within a source line. + // Columns are numbered beginning at 1. The value 0 is reserved to indicate + // that a statement begins at the “left edge” of the line. + column uint64 + + // A boolean indicating that the current instruction is a recommended + // breakpoint location. A recommended breakpoint location is intended to + // “represent” a line, a statement and/or a semantically distinct subpart of a + // statement. + isStmt bool + + // A boolean indicating that the current instruction is the beginning of a basic + // block. + basicBlock bool + + // A boolean indicating that the current address is that of the first byte after + // the end of a sequence of target machine instructions. end_sequence + // terminates a sequence of lines; therefore other information in the same + // row is not meaningful. + endSequence bool + + // A boolean indicating that the current address is one (of possibly many) + // where execution should be suspended for an entry breakpoint of a + // function. + prologueEnd bool + + // A boolean indicating that the current address is one (of possibly many) + // where execution should be suspended for an exit breakpoint of a function. + epilogueBegin bool + + // An unsigned integer whose value encodes the applicable instruction set + // architecture for the current instruction. + // The encoding of instruction sets should be shared by all users of a given + // architecture. It is recommended that this encoding be defined by the ABI + // authoring committee for each architecture. + isa uint64 + + // An unsigned integer identifying the block to which the current instruction + // belongs. Discriminator values are assigned arbitrarily by the DWARF + // producer and serve to distinguish among multiple blocks that may all be + // associated with the same source file, line, and column. Where only one + // block exists for a given source position, the discriminator value should be + // zero. + discriminator uint64 + + // The header for the current compilation unit. + // Not an actual register, but stored here for cleanliness. + header lineHeader + + // Offset in buf of the end of the line number program for the current unit. + unitEndOff Offset +} + +// parseHeader parses the header describing the compilation unit in the line +// table starting at the specified offset. +func (m *lineMachine) parseHeader(b *buf) error { + m.header = lineHeader{} + m.header.unitLength = int(b.uint32()) // Note: We are assuming 32-bit DWARF format. + m.unitEndOff = b.off + Offset(m.header.unitLength) + if m.header.unitLength > len(b.data) { + return fmt.Errorf("DWARF: bad PC/line header length") + } + m.header.version = int(b.uint16()) + m.header.headerLength = int(b.uint32()) + m.header.minInstructionLength = int(b.uint8()) + if m.header.version >= 4 { + m.header.maxOpsPerInstruction = int(b.uint8()) + } else { + m.header.maxOpsPerInstruction = 1 + } + m.header.defaultIsStmt = b.uint8() != 0 + m.header.lineBase = int(int8(b.uint8())) + m.header.lineRange = int(b.uint8()) + m.header.opcodeBase = b.uint8() + m.header.stdOpcodeLengths = make([]byte, m.header.opcodeBase-1) + copy(m.header.stdOpcodeLengths, b.bytes(int(m.header.opcodeBase-1))) + m.header.include = make([]string, 1) // First entry is empty; file index entries are 1-indexed. + // Includes + for { + name := b.string() + if name == "" { + break + } + m.header.include = append(m.header.include, name) + } + // Files + // Files are 1-indexed in line number program, but we'll deal with that in Data.buildLineCaches. + // Here, just collect the filenames. + for { + name := b.string() + if name == "" { + break + } + index := b.uint() + time := b.uint() + length := b.uint() + f := lineFile{ + name: name, + index: int(index), + time: int(time), + length: int(length), + } + m.header.file = append(m.header.file, f) + } + return nil +} + +// Special opcodes, page 117. +// There are seven steps to processing special opcodes. We break them up here +// because the caller needs to output a row between steps 2 and 4, and because +// we need to perform just step 2 for the opcode DW_LNS_const_add_pc. + +func (m *lineMachine) specialOpcodeStep1(opcode byte) { + adjustedOpcode := int(opcode - m.header.opcodeBase) + lineAdvance := m.header.lineBase + (adjustedOpcode % m.header.lineRange) + m.line += uint64(lineAdvance) +} + +func (m *lineMachine) specialOpcodeStep2(opcode byte) { + adjustedOpcode := int(opcode - m.header.opcodeBase) + advance := adjustedOpcode / m.header.lineRange + delta := (int(m.opIndex) + advance) / m.header.maxOpsPerInstruction + m.address += uint64(m.header.minInstructionLength * delta) + m.opIndex = (m.opIndex + uint64(advance)) % uint64(m.header.maxOpsPerInstruction) +} + +func (m *lineMachine) specialOpcodeSteps4To7() { + m.basicBlock = false + m.prologueEnd = false + m.epilogueBegin = false + m.discriminator = 0 +} + +// evalCompilationUnit reads the next compilation unit and calls f at each output row. +// Line machine execution continues while f returns true. +func (m *lineMachine) evalCompilationUnit(b *buf, f func(m *lineMachine) (cont bool)) error { + m.reset() + for b.off < m.unitEndOff { + op := b.uint8() + if op >= m.header.opcodeBase { + m.specialOpcodeStep1(op) + m.specialOpcodeStep2(op) + // Step 3 is to output a row, so we call f here. + if !f(m) { + return nil + } + m.specialOpcodeSteps4To7() + continue + } + switch op { + case lineStartExtendedOpcode: + if len(b.data) == 0 { + return fmt.Errorf("DWARF: short extended opcode (1)") + } + size := b.uint() + if uint64(len(b.data)) < size { + return fmt.Errorf("DWARF: short extended opcode (2)") + } + op = b.uint8() + switch op { + case lineExtEndSequence: + m.endSequence = true + if !f(m) { + return nil + } + if len(b.data) == 0 { + return nil + } + m.reset() + case lineExtSetAddress: + m.address = b.addr() + m.opIndex = 0 + case lineExtDefineFile: + return fmt.Errorf("DWARF: unimplemented define_file op") + case lineExtSetDiscriminator: + discriminator := b.uint() + m.discriminator = discriminator + default: + return fmt.Errorf("DWARF: unknown extended opcode %#x", op) + } + case lineStdCopy: + if !f(m) { + return nil + } + m.discriminator = 0 + m.basicBlock = false + m.prologueEnd = false + m.epilogueBegin = false + case lineStdAdvancePC: + advance := b.uint() + delta := (int(m.opIndex) + int(advance)) / m.header.maxOpsPerInstruction + m.address += uint64(m.header.minInstructionLength * delta) + m.opIndex = (m.opIndex + uint64(advance)) % uint64(m.header.maxOpsPerInstruction) + m.basicBlock = false + m.prologueEnd = false + m.epilogueBegin = false + m.discriminator = 0 + case lineStdAdvanceLine: + advance := b.int() + m.line = uint64(int64(m.line) + advance) + case lineStdSetFile: + index := b.uint() + m.file = index + case lineStdSetColumn: + column := b.uint() + m.column = column + case lineStdNegateStmt: + m.isStmt = !m.isStmt + case lineStdSetBasicBlock: + m.basicBlock = true + case lineStdFixedAdvancePC: + m.address += uint64(b.uint16()) + m.opIndex = 0 + case lineStdSetPrologueEnd: + m.prologueEnd = true + case lineStdSetEpilogueBegin: + m.epilogueBegin = true + case lineStdSetISA: + m.isa = b.uint() + case lineStdConstAddPC: + // Update the address and op_index registers. + m.specialOpcodeStep2(255) + default: + panic("not reached") + } + } + return nil +} + +// reset sets the machine's registers to the initial state. Page 111. +func (m *lineMachine) reset() { + m.address = 0 + m.opIndex = 0 + m.file = 1 + m.line = 1 + m.column = 0 + m.isStmt = m.header.defaultIsStmt + m.basicBlock = false + m.endSequence = false + m.prologueEnd = false + m.epilogueBegin = false + m.isa = 0 + m.discriminator = 0 +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/open.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/open.go new file mode 100644 index 000000000..56531cee4 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/open.go @@ -0,0 +1,106 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package dwarf provides access to DWARF debugging information loaded from +// executable files, as defined in the DWARF 2.0 Standard at +// http://dwarfstd.org/doc/dwarf-2.0.0.pdf +package dwarf // import "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" + +import "encoding/binary" + +// Data represents the DWARF debugging information +// loaded from an executable file (for example, an ELF or Mach-O executable). +type Data struct { + // raw data + abbrev []byte + aranges []byte + frame []byte + info []byte + line []byte + pubnames []byte + ranges []byte + str []byte + + // parsed data + abbrevCache map[uint32]abbrevTable + order binary.ByteOrder + typeCache map[Offset]Type + typeSigs map[uint64]*typeUnit + unit []unit + sourceFiles []string // All the source files listed in .debug_line, from all the compilation units. + nameCache // map from name to top-level entries in .debug_info. + pcToFuncEntries // cache of .debug_info data for function bounds. + pcToLineEntries // cache of .debug_line data, used for efficient PC-to-line mapping. + lineToPCEntries // cache of .debug_line data, used for efficient line-to-[]PC mapping. +} + +// New returns a new Data object initialized from the given parameters. +// Rather than calling this function directly, clients should typically use +// the DWARF method of the File type of the appropriate package debug/elf, +// debug/macho, or debug/pe. +// +// The []byte arguments are the data from the corresponding debug section +// in the object file; for example, for an ELF object, abbrev is the contents of +// the ".debug_abbrev" section. +func New(abbrev, aranges, frame, info, line, pubnames, ranges, str []byte) (*Data, error) { + d := &Data{ + abbrev: abbrev, + aranges: aranges, + frame: frame, + info: info, + line: line, + pubnames: pubnames, + ranges: ranges, + str: str, + abbrevCache: make(map[uint32]abbrevTable), + typeCache: make(map[Offset]Type), + typeSigs: make(map[uint64]*typeUnit), + } + + // Sniff .debug_info to figure out byte order. + // bytes 4:6 are the version, a tiny 16-bit number (1, 2, 3). + if len(d.info) < 6 { + return nil, DecodeError{"info", Offset(len(d.info)), "too short"} + } + x, y := d.info[4], d.info[5] + switch { + case x == 0 && y == 0: + return nil, DecodeError{"info", 4, "unsupported version 0"} + case x == 0: + d.order = binary.BigEndian + case y == 0: + d.order = binary.LittleEndian + default: + return nil, DecodeError{"info", 4, "cannot determine byte order"} + } + + u, err := d.parseUnits() + if err != nil { + return nil, err + } + d.unit = u + d.buildInfoCaches() + if err := d.buildLineCaches(); err != nil { + return nil, err + } + return d, nil +} + +// AddTypes will add one .debug_types section to the DWARF data. A +// typical object with DWARF version 4 debug info will have multiple +// .debug_types sections. The name is used for error reporting only, +// and serves to distinguish one .debug_types section from another. +func (d *Data) AddTypes(name string, types []byte) error { + return d.parseTypes(name, types) +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/pclntab_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/pclntab_test.go new file mode 100644 index 000000000..779718b89 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/pclntab_test.go @@ -0,0 +1,154 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build go1.10 + +package dwarf_test + +// Stripped-down, simplified version of ../../gosym/pclntab_test.go + +import ( + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" + + . "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" +) + +var ( + pclineTempDir string + pclinetestBinary string +) + +func dotest(self bool) bool { + // For now, only works on amd64 platforms. + if runtime.GOARCH != "amd64" { + return false + } + // Self test reads test binary; only works on Linux or Mac. + if self { + if runtime.GOOS != "linux" && runtime.GOOS != "darwin" { + return false + } + } + // Command below expects "sh", so Unix. + if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { + return false + } + if pclinetestBinary != "" { + return true + } + var err error + pclineTempDir, err = ioutil.TempDir("", "pclinetest") + if err != nil { + panic(err) + } + if strings.Contains(pclineTempDir, " ") { + panic("unexpected space in tempdir") + } + pclinetestBinary = filepath.Join(pclineTempDir, "pclinetest") + command := fmt.Sprintf("go tool compile -o %s.6 testdata/pclinetest.go && go tool link -H %s -E main -o %s %s.6", + pclinetestBinary, runtime.GOOS, pclinetestBinary, pclinetestBinary) + cmd := exec.Command("sh", "-c", command) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + panic(err) + } + return true +} + +func endtest() { + if pclineTempDir != "" { + os.RemoveAll(pclineTempDir) + pclineTempDir = "" + pclinetestBinary = "" + } +} + +func TestPCAndLine(t *testing.T) { + // TODO(jba): go1.9: use subtests + if !dotest(false) { + return + } + defer endtest() + + data, err := getData(pclinetestBinary) + if err != nil { + t.Fatal(err) + } + + testLineToBreakpointPCs(t, data) + testPCToLine(t, data) +} + +func testPCToLine(t *testing.T, data *Data) { + entry, err := data.LookupFunction("main.main") + if err != nil { + t.Fatal(err) + } + pc, ok := entry.Val(AttrLowpc).(uint64) + if !ok { + t.Fatal(`DWARF data for function "main" has no PC`) + } + for _, tt := range []struct { + offset, want uint64 + }{ + {0, 19}, + {19, 19}, + {33, 20}, + {97, 22}, + {165, 23}, + } { + file, line, err := data.PCToLine(pc + tt.offset) + if err != nil { + t.Fatal(err) + } + if !strings.HasSuffix(file, "/pclinetest.go") { + t.Errorf("got %s; want %s", file, "/pclinetest.go") + } + if line != tt.want { + t.Errorf("line for offset %d: got %d; want %d", tt.offset, line, tt.want) + } + } +} + +func testLineToBreakpointPCs(t *testing.T, data *Data) { + for _, tt := range []struct { + line uint64 + want bool + }{ + {18, false}, + {19, true}, + {20, true}, + {21, false}, + {22, true}, + {23, true}, + {24, false}, + } { + pcs, err := data.LineToBreakpointPCs("pclinetest.go", uint64(tt.line)) + if err != nil { + t.Fatal(err) + } + if got := len(pcs) > 0; got != tt.want { + t.Errorf("line %d: got pcs=%t, want pcs=%t", tt.line, got, tt.want) + + } + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/symbol.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/symbol.go new file mode 100644 index 000000000..7bbdf48dc --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/symbol.go @@ -0,0 +1,129 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dwarf + +// This file provides simple methods to access the symbol table by name and address. + +import ( + "fmt" + "regexp" + "sort" +) + +// lookupEntry returns the first Entry for the name. +// If tag is non-zero, only entries with that tag are considered. +func (d *Data) lookupEntry(name string, tag Tag) (*Entry, error) { + x, ok := d.nameCache[name] + if !ok { + return nil, fmt.Errorf("DWARF entry for %q not found", name) + } + for ; x != nil; x = x.link { + if tag == 0 || x.entry.Tag == tag { + return x.entry, nil + } + } + return nil, fmt.Errorf("no DWARF entry for %q with tag %s", name, tag) +} + +// LookupMatchingSymbols returns the names of all top-level entries matching +// the given regular expression. +func (d *Data) LookupMatchingSymbols(nameRE *regexp.Regexp) (result []string, err error) { + for name := range d.nameCache { + if nameRE.MatchString(name) { + result = append(result, name) + } + } + return result, nil +} + +// LookupEntry returns the Entry for the named symbol. +func (d *Data) LookupEntry(name string) (*Entry, error) { + return d.lookupEntry(name, 0) +} + +// LookupFunction returns the entry for a function. +func (d *Data) LookupFunction(name string) (*Entry, error) { + return d.lookupEntry(name, TagSubprogram) +} + +// LookupVariable returns the entry for a (global) variable. +func (d *Data) LookupVariable(name string) (*Entry, error) { + return d.lookupEntry(name, TagVariable) +} + +// EntryLocation returns the address of the object referred to by the given Entry. +func (d *Data) EntryLocation(e *Entry) (uint64, error) { + loc, _ := e.Val(AttrLocation).([]byte) + if len(loc) == 0 { + return 0, fmt.Errorf("DWARF entry has no Location attribute") + } + // TODO: implement the DWARF Location bytecode. What we have here only + // recognizes a program with a single literal opAddr bytecode. + if asize := d.unit[0].asize; loc[0] == opAddr && len(loc) == 1+asize { + switch asize { + case 1: + return uint64(loc[1]), nil + case 2: + return uint64(d.order.Uint16(loc[1:])), nil + case 4: + return uint64(d.order.Uint32(loc[1:])), nil + case 8: + return d.order.Uint64(loc[1:]), nil + } + } + return 0, fmt.Errorf("DWARF entry has an unimplemented Location op") +} + +// EntryType returns the Type for an Entry. +func (d *Data) EntryType(e *Entry) (Type, error) { + off, err := d.EntryTypeOffset(e) + if err != nil { + return nil, err + } + return d.Type(off) +} + +// EntryTypeOffset returns the offset in the given Entry's type attribute. +func (d *Data) EntryTypeOffset(e *Entry) (Offset, error) { + v := e.Val(AttrType) + if v == nil { + return 0, fmt.Errorf("DWARF entry has no Type attribute") + } + off, ok := v.(Offset) + if !ok { + return 0, fmt.Errorf("DWARF entry has an invalid Type attribute") + } + return off, nil +} + +// PCToFunction returns the entry and address for the function containing the +// specified PC. +func (d *Data) PCToFunction(pc uint64) (entry *Entry, lowpc uint64, err error) { + p := d.pcToFuncEntries + if len(p) == 0 { + return nil, 0, fmt.Errorf("no function addresses loaded") + } + i := sort.Search(len(p), func(i int) bool { return p[i].pc > pc }) - 1 + // The search failed if: + // - pc was before the start of any function. + // - The largest function bound not larger than pc was the end of a function, + // not the start of one. + // - The largest function bound not larger than pc was the start of a function + // that we don't know the end of, and the PC is much larger than the start. + if i == -1 || p[i].entry == nil || (i+1 == len(p) && pc-p[i].pc >= 1<<20) { + return nil, 0, fmt.Errorf("no function at %x", pc) + } + return p[i].entry, p[i].pc, nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/pclinetest.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/pclinetest.go new file mode 100644 index 000000000..88c3da419 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/pclinetest.go @@ -0,0 +1,23 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import "fmt" + +func main() { + fmt.Print("line 20") + + fmt.Print("line 22") +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/pcsptest.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/pcsptest.go new file mode 100644 index 000000000..96202ffe2 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/pcsptest.go @@ -0,0 +1,39 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import "fmt" + +func main() { + test(1, 2, 3) +} + +// This is the function we examine. After the preamble its stack should be +// pulled down 1*addrSize for the return PC plus 3*8 for the three +// arguments. That will be (1+3)*8=32 on 64-bit machines. +func test(a, b, c int64) int64 { + // Put in enough code that it's not inlined. + for a = 0; a < 100; a++ { + b += c + } + afterTest(a, b, c) + return b +} + +// This function follows test in the binary. We use it to force arguments +// onto the stack and as a delimiter in the text we scan in the test. +func afterTest(a, b, c int64) { + fmt.Println(a, b, c) +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.c b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.c new file mode 100644 index 000000000..a9659b30b --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.c @@ -0,0 +1,95 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Linux ELF: +gcc -gdwarf-2 -m64 -c typedef.c && gcc -gdwarf-2 -m64 -o typedef.elf typedef.o + +OS X Mach-O: +gcc -gdwarf-2 -m64 -c typedef.c -o typedef.macho +*/ +#include + +typedef volatile int* t_ptr_volatile_int; +typedef const char *t_ptr_const_char; +typedef long t_long; +typedef unsigned short t_ushort; +typedef int t_func_int_of_float_double(float, double); +typedef int (*t_ptr_func_int_of_float_double)(float, double); +typedef int (*t_ptr_func_int_of_float_complex)(float complex); +typedef int (*t_ptr_func_int_of_double_complex)(double complex); +typedef int (*t_ptr_func_int_of_long_double_complex)(long double complex); +typedef int *t_func_ptr_int_of_char_schar_uchar(char, signed char, unsigned char); +typedef void t_func_void_of_char(char); +typedef void t_func_void_of_void(void); +typedef void t_func_void_of_ptr_char_dots(char*, ...); +typedef struct my_struct { + volatile int vi; + char x : 1; + int y : 4; + int z[0]; + long long array[40]; + int zz[0]; +} t_my_struct; +typedef struct my_struct1 { + int zz [1]; +} t_my_struct1; +typedef union my_union { + volatile int vi; + char x : 1; + int y : 4; + long long array[40]; +} t_my_union; +typedef enum my_enum { + e1 = 1, + e2 = 2, + e3 = -5, + e4 = 1000000000000000LL, +} t_my_enum; + +typedef struct list t_my_list; +struct list { + short val; + t_my_list *next; +}; + +typedef struct tree { + struct tree *left, *right; + unsigned long long val; +} t_my_tree; + +t_ptr_volatile_int *a2; +t_ptr_const_char **a3a; +t_long *a4; +t_ushort *a5; +t_func_int_of_float_double *a6; +t_ptr_func_int_of_float_double *a7; +t_func_ptr_int_of_char_schar_uchar *a8; +t_func_void_of_char *a9; +t_func_void_of_void *a10; +t_func_void_of_ptr_char_dots *a11; +t_my_struct *a12; +t_my_struct1 *a12a; +t_my_union *a12b; +t_my_enum *a13; +t_my_list *a14; +t_my_tree *a15; +t_ptr_func_int_of_float_complex *a16; +t_ptr_func_int_of_double_complex *a17; +t_ptr_func_int_of_long_double_complex *a18; + +int main() +{ + return 0; +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.elf b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.elf new file mode 100755 index 000000000..b2062d2c4 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.elf differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.elf4 b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.elf4 new file mode 100644 index 000000000..3d5a5a1b1 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.elf4 differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.macho b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.macho new file mode 100644 index 000000000..f75afcccb Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/testdata/typedef.macho differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/type.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/type.go new file mode 100644 index 000000000..04722caec --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/type.go @@ -0,0 +1,877 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// DWARF type information structures. +// The format is heavily biased toward C, but for simplicity +// the String methods use a pseudo-Go syntax. + +package dwarf + +import ( + "fmt" + "reflect" + "strconv" +) + +// A Type conventionally represents a pointer to any of the +// specific Type structures (CharType, StructType, etc.). +type Type interface { + Common() *CommonType + String() string + Size() int64 +} + +// A CommonType holds fields common to multiple types. +// If a field is not known or not applicable for a given type, +// the zero value is used. +type CommonType struct { + ByteSize int64 // size of value of this type, in bytes + Name string // name that can be used to refer to type + ReflectKind reflect.Kind // the reflect kind of the type. + Offset Offset // the offset at which this type was read +} + +func (c *CommonType) Common() *CommonType { return c } + +func (c *CommonType) Size() int64 { return c.ByteSize } + +// Basic types + +// A BasicType holds fields common to all basic types. +type BasicType struct { + CommonType + BitSize int64 + BitOffset int64 +} + +func (b *BasicType) Basic() *BasicType { return b } + +func (t *BasicType) String() string { + if t.Name != "" { + return t.Name + } + return "?" +} + +// A CharType represents a signed character type. +type CharType struct { + BasicType +} + +// A UcharType represents an unsigned character type. +type UcharType struct { + BasicType +} + +// An IntType represents a signed integer type. +type IntType struct { + BasicType +} + +// A UintType represents an unsigned integer type. +type UintType struct { + BasicType +} + +// A FloatType represents a floating point type. +type FloatType struct { + BasicType +} + +// A ComplexType represents a complex floating point type. +type ComplexType struct { + BasicType +} + +// A BoolType represents a boolean type. +type BoolType struct { + BasicType +} + +// An AddrType represents a machine address type. +type AddrType struct { + BasicType +} + +// An UnspecifiedType represents an implicit, unknown, ambiguous or nonexistent type. +type UnspecifiedType struct { + BasicType +} + +// qualifiers + +// A QualType represents a type that has the C/C++ "const", "restrict", or "volatile" qualifier. +type QualType struct { + CommonType + Qual string + Type Type +} + +func (t *QualType) String() string { return t.Qual + " " + t.Type.String() } + +func (t *QualType) Size() int64 { return t.Type.Size() } + +// An ArrayType represents a fixed size array type. +type ArrayType struct { + CommonType + Type Type + StrideBitSize int64 // if > 0, number of bits to hold each element + Count int64 // if == -1, an incomplete array, like char x[]. +} + +func (t *ArrayType) String() string { + return "[" + strconv.FormatInt(t.Count, 10) + "]" + t.Type.String() +} + +func (t *ArrayType) Size() int64 { return t.Count * t.Type.Size() } + +// A VoidType represents the C void type. +type VoidType struct { + CommonType +} + +func (t *VoidType) String() string { return "void" } + +// A PtrType represents a pointer type. +type PtrType struct { + CommonType + Type Type +} + +func (t *PtrType) String() string { return "*" + t.Type.String() } + +// A StructType represents a struct, union, or C++ class type. +type StructType struct { + CommonType + StructName string + Kind string // "struct", "union", or "class". + Field []*StructField + Incomplete bool // if true, struct, union, class is declared but not defined +} + +// A StructField represents a field in a struct, union, or C++ class type. +type StructField struct { + Name string + Type Type + ByteOffset int64 + ByteSize int64 + BitOffset int64 // within the ByteSize bytes at ByteOffset + BitSize int64 // zero if not a bit field + Embedded bool +} + +func (t *StructType) String() string { + if t.StructName != "" { + return t.Kind + " " + t.StructName + } + return t.Defn() +} + +func (t *StructType) Defn() string { + s := t.Kind + if t.StructName != "" { + s += " " + t.StructName + } + if t.Incomplete { + s += " /*incomplete*/" + return s + } + s += " {" + for i, f := range t.Field { + if i > 0 { + s += "; " + } + s += f.Name + " " + f.Type.String() + s += "@" + strconv.FormatInt(f.ByteOffset, 10) + if f.BitSize > 0 { + s += " : " + strconv.FormatInt(f.BitSize, 10) + s += "@" + strconv.FormatInt(f.BitOffset, 10) + } + } + s += "}" + return s +} + +// A SliceType represents a Go slice type. It looks like a StructType, describing +// the runtime-internal structure, with extra fields. +type SliceType struct { + StructType + ElemType Type +} + +func (t *SliceType) String() string { + if t.Name != "" { + return t.Name + } + return "[]" + t.ElemType.String() +} + +// A StringType represents a Go string type. It looks like a StructType, describing +// the runtime-internal structure, but we wrap it for neatness. +type StringType struct { + StructType +} + +func (t *StringType) String() string { + if t.Name != "" { + return t.Name + } + return "string" +} + +// An InterfaceType represents a Go interface. +type InterfaceType struct { + TypedefType +} + +func (t *InterfaceType) String() string { + if t.Name != "" { + return t.Name + } + return "Interface" +} + +// An EnumType represents an enumerated type. +// The only indication of its native integer type is its ByteSize +// (inside CommonType). +type EnumType struct { + CommonType + EnumName string + Val []*EnumValue +} + +// An EnumValue represents a single enumeration value. +type EnumValue struct { + Name string + Val int64 +} + +func (t *EnumType) String() string { + s := "enum" + if t.EnumName != "" { + s += " " + t.EnumName + } + s += " {" + for i, v := range t.Val { + if i > 0 { + s += "; " + } + s += v.Name + "=" + strconv.FormatInt(v.Val, 10) + } + s += "}" + return s +} + +// A FuncType represents a function type. +type FuncType struct { + CommonType + ReturnType Type + ParamType []Type +} + +func (t *FuncType) String() string { + s := "func(" + for i, t := range t.ParamType { + if i > 0 { + s += ", " + } + s += t.String() + } + s += ")" + if t.ReturnType != nil { + s += " " + t.ReturnType.String() + } + return s +} + +// A DotDotDotType represents the variadic ... function parameter. +type DotDotDotType struct { + CommonType +} + +func (t *DotDotDotType) String() string { return "..." } + +// A TypedefType represents a named type. +type TypedefType struct { + CommonType + Type Type +} + +func (t *TypedefType) String() string { return t.Name } + +func (t *TypedefType) Size() int64 { return t.Type.Size() } + +// A MapType represents a Go map type. It looks like a TypedefType, describing +// the runtime-internal structure, with extra fields. +type MapType struct { + TypedefType + KeyType Type + ElemType Type +} + +func (t *MapType) String() string { + if t.Name != "" { + return t.Name + } + return "map[" + t.KeyType.String() + "]" + t.ElemType.String() +} + +// A ChanType represents a Go channel type. +type ChanType struct { + TypedefType + ElemType Type +} + +func (t *ChanType) String() string { + if t.Name != "" { + return t.Name + } + return "chan " + t.ElemType.String() +} + +// typeReader is used to read from either the info section or the +// types section. +type typeReader interface { + Seek(Offset) + Next() (*Entry, error) + clone() typeReader + offset() Offset + // AddressSize returns the size in bytes of addresses in the current + // compilation unit. + AddressSize() int +} + +// Type reads the type at off in the DWARF ``info'' section. +func (d *Data) Type(off Offset) (Type, error) { + return d.readType("info", d.Reader(), off, d.typeCache) +} + +func getKind(e *Entry) reflect.Kind { + integer, _ := e.Val(AttrGoKind).(int64) + return reflect.Kind(integer) +} + +// readType reads a type from r at off of name using and updating a +// type cache. +func (d *Data) readType(name string, r typeReader, off Offset, typeCache map[Offset]Type) (Type, error) { + if t, ok := typeCache[off]; ok { + return t, nil + } + r.Seek(off) + e, err := r.Next() + if err != nil { + return nil, err + } + addressSize := r.AddressSize() + if e == nil || e.Offset != off { + return nil, DecodeError{name, off, "no type at offset"} + } + + // Parse type from Entry. + // Must always set typeCache[off] before calling + // d.Type recursively, to handle circular types correctly. + var typ Type + + nextDepth := 0 + + // Get next child; set err if error happens. + next := func() *Entry { + if !e.Children { + return nil + } + // Only return direct children. + // Skip over composite entries that happen to be nested + // inside this one. Most DWARF generators wouldn't generate + // such a thing, but clang does. + // See golang.org/issue/6472. + for { + kid, err1 := r.Next() + if err1 != nil { + err = err1 + return nil + } + if kid == nil { + err = DecodeError{name, r.offset(), "unexpected end of DWARF entries"} + return nil + } + if kid.Tag == 0 { + if nextDepth > 0 { + nextDepth-- + continue + } + return nil + } + if kid.Children { + nextDepth++ + } + if nextDepth > 0 { + continue + } + return kid + } + } + + // Get Type referred to by Entry's attr. + // Set err if error happens. Not having a type is an error. + typeOf := func(e *Entry, attr Attr) Type { + tval := e.Val(attr) + var t Type + switch toff := tval.(type) { + case Offset: + if t, err = d.readType(name, r.clone(), toff, typeCache); err != nil { + return nil + } + case uint64: + if t, err = d.sigToType(toff); err != nil { + return nil + } + default: + // It appears that no Type means "void". + return new(VoidType) + } + return t + } + + switch e.Tag { + case TagArrayType: + // Multi-dimensional array. (DWARF v2 §5.4) + // Attributes: + // AttrType:subtype [required] + // AttrStrideSize: distance in bits between each element of the array + // AttrStride: distance in bytes between each element of the array + // AttrByteSize: size of entire array + // Children: + // TagSubrangeType or TagEnumerationType giving one dimension. + // dimensions are in left to right order. + t := new(ArrayType) + t.Name, _ = e.Val(AttrName).(string) + t.ReflectKind = getKind(e) + typ = t + typeCache[off] = t + if t.Type = typeOf(e, AttrType); err != nil { + goto Error + } + if bytes, ok := e.Val(AttrStride).(int64); ok { + t.StrideBitSize = 8 * bytes + } else if bits, ok := e.Val(AttrStrideSize).(int64); ok { + t.StrideBitSize = bits + } else { + // If there's no stride specified, assume it's the size of the + // array's element type. + t.StrideBitSize = 8 * t.Type.Size() + } + + // Accumulate dimensions, + ndim := 0 + for kid := next(); kid != nil; kid = next() { + // TODO(rsc): Can also be TagEnumerationType + // but haven't seen that in the wild yet. + switch kid.Tag { + case TagSubrangeType: + count, ok := kid.Val(AttrCount).(int64) + if !ok { + // Old binaries may have an upper bound instead. + count, ok = kid.Val(AttrUpperBound).(int64) + if ok { + count++ // Length is one more than upper bound. + } else { + count = -1 // As in x[]. + } + } + if ndim == 0 { + t.Count = count + } else { + // Multidimensional array. + // Create new array type underneath this one. + t.Type = &ArrayType{Type: t.Type, Count: count} + } + ndim++ + case TagEnumerationType: + err = DecodeError{name, kid.Offset, "cannot handle enumeration type as array bound"} + goto Error + } + } + if ndim == 0 { + // LLVM generates this for x[]. + t.Count = -1 + } + + case TagBaseType: + // Basic type. (DWARF v2 §5.1) + // Attributes: + // AttrName: name of base type in programming language of the compilation unit [required] + // AttrEncoding: encoding value for type (encFloat etc) [required] + // AttrByteSize: size of type in bytes [required] + // AttrBitOffset: for sub-byte types, size in bits + // AttrBitSize: for sub-byte types, bit offset of high order bit in the AttrByteSize bytes + name, _ := e.Val(AttrName).(string) + enc, ok := e.Val(AttrEncoding).(int64) + if !ok { + err = DecodeError{name, e.Offset, "missing encoding attribute for " + name} + goto Error + } + switch enc { + default: + err = DecodeError{name, e.Offset, "unrecognized encoding attribute value"} + goto Error + + case encAddress: + typ = new(AddrType) + case encBoolean: + typ = new(BoolType) + case encComplexFloat: + typ = new(ComplexType) + if name == "complex" { + // clang writes out 'complex' instead of 'complex float' or 'complex double'. + // clang also writes out a byte size that we can use to distinguish. + // See issue 8694. + switch byteSize, _ := e.Val(AttrByteSize).(int64); byteSize { + case 8: + name = "complex float" + case 16: + name = "complex double" + } + } + case encFloat: + typ = new(FloatType) + case encSigned: + typ = new(IntType) + case encUnsigned: + typ = new(UintType) + case encSignedChar: + typ = new(CharType) + case encUnsignedChar: + typ = new(UcharType) + } + typeCache[off] = typ + t := typ.(interface { + Basic() *BasicType + }).Basic() + t.Name = name + t.BitSize, _ = e.Val(AttrBitSize).(int64) + t.BitOffset, _ = e.Val(AttrBitOffset).(int64) + t.ReflectKind = getKind(e) + + case TagClassType, TagStructType, TagUnionType: + // Structure, union, or class type. (DWARF v2 §5.5) + // Also Slices and Strings (Go-specific). + // Attributes: + // AttrName: name of struct, union, or class + // AttrByteSize: byte size [required] + // AttrDeclaration: if true, struct/union/class is incomplete + // AttrGoElem: present for slices only. + // Children: + // TagMember to describe one member. + // AttrName: name of member [required] + // AttrType: type of member [required] + // AttrByteSize: size in bytes + // AttrBitOffset: bit offset within bytes for bit fields + // AttrBitSize: bit size for bit fields + // AttrDataMemberLoc: location within struct [required for struct, class] + // There is much more to handle C++, all ignored for now. + t := new(StructType) + t.ReflectKind = getKind(e) + switch t.ReflectKind { + case reflect.Slice: + slice := new(SliceType) + slice.ElemType = typeOf(e, AttrGoElem) + t = &slice.StructType + typ = slice + case reflect.String: + str := new(StringType) + t = &str.StructType + typ = str + default: + typ = t + } + typeCache[off] = typ + switch e.Tag { + case TagClassType: + t.Kind = "class" + case TagStructType: + t.Kind = "struct" + case TagUnionType: + t.Kind = "union" + } + t.Name, _ = e.Val(AttrName).(string) + t.StructName, _ = e.Val(AttrName).(string) + t.Incomplete = e.Val(AttrDeclaration) != nil + t.Field = make([]*StructField, 0, 8) + var lastFieldType Type + var lastFieldBitOffset int64 + for kid := next(); kid != nil; kid = next() { + if kid.Tag == TagMember { + f := new(StructField) + if f.Type = typeOf(kid, AttrType); err != nil { + goto Error + } + switch loc := kid.Val(AttrDataMemberLoc).(type) { + case []byte: + // TODO: Should have original compilation + // unit here, not unknownFormat. + if len(loc) == 0 { + // Empty exprloc. f.ByteOffset=0. + break + } + b := makeBuf(d, unknownFormat{}, "location", 0, loc) + op := b.uint8() + switch op { + case opPlusUconst: + // Handle opcode sequence [DW_OP_plus_uconst ] + f.ByteOffset = int64(b.uint()) + b.assertEmpty() + case opConsts: + // Handle opcode sequence [DW_OP_consts DW_OP_plus] + f.ByteOffset = b.int() + op = b.uint8() + if op != opPlus { + err = DecodeError{name, kid.Offset, fmt.Sprintf("unexpected opcode 0x%x", op)} + goto Error + } + b.assertEmpty() + default: + err = DecodeError{name, kid.Offset, fmt.Sprintf("unexpected opcode 0x%x", op)} + goto Error + } + if b.err != nil { + err = b.err + goto Error + } + case int64: + f.ByteOffset = loc + } + + haveBitOffset := false + f.Name, _ = kid.Val(AttrName).(string) + f.ByteSize, _ = kid.Val(AttrByteSize).(int64) + f.BitOffset, haveBitOffset = kid.Val(AttrBitOffset).(int64) + f.BitSize, _ = kid.Val(AttrBitSize).(int64) + f.Embedded, _ = kid.Val(AttrGoEmbeddedField).(bool) + t.Field = append(t.Field, f) + + bito := f.BitOffset + if !haveBitOffset { + bito = f.ByteOffset * 8 + } + if bito == lastFieldBitOffset && t.Kind != "union" { + // Last field was zero width. Fix array length. + // (DWARF writes out 0-length arrays as if they were 1-length arrays.) + zeroArray(lastFieldType) + } + lastFieldType = f.Type + lastFieldBitOffset = bito + } + } + if t.Kind != "union" { + b, ok := e.Val(AttrByteSize).(int64) + if ok && b*8 == lastFieldBitOffset { + // Final field must be zero width. Fix array length. + zeroArray(lastFieldType) + } + } + + case TagConstType, TagVolatileType, TagRestrictType: + // Type modifier (DWARF v2 §5.2) + // Attributes: + // AttrType: subtype + t := new(QualType) + t.Name, _ = e.Val(AttrName).(string) + t.ReflectKind = getKind(e) + typ = t + typeCache[off] = t + if t.Type = typeOf(e, AttrType); err != nil { + goto Error + } + switch e.Tag { + case TagConstType: + t.Qual = "const" + case TagRestrictType: + t.Qual = "restrict" + case TagVolatileType: + t.Qual = "volatile" + } + + case TagEnumerationType: + // Enumeration type (DWARF v2 §5.6) + // Attributes: + // AttrName: enum name if any + // AttrByteSize: bytes required to represent largest value + // Children: + // TagEnumerator: + // AttrName: name of constant + // AttrConstValue: value of constant + t := new(EnumType) + t.ReflectKind = getKind(e) + typ = t + typeCache[off] = t + t.Name, _ = e.Val(AttrName).(string) + t.EnumName, _ = e.Val(AttrName).(string) + t.Val = make([]*EnumValue, 0, 8) + for kid := next(); kid != nil; kid = next() { + if kid.Tag == TagEnumerator { + f := new(EnumValue) + f.Name, _ = kid.Val(AttrName).(string) + f.Val, _ = kid.Val(AttrConstValue).(int64) + n := len(t.Val) + if n >= cap(t.Val) { + val := make([]*EnumValue, n, n*2) + copy(val, t.Val) + t.Val = val + } + t.Val = t.Val[0 : n+1] + t.Val[n] = f + } + } + + case TagPointerType: + // Type modifier (DWARF v2 §5.2) + // Attributes: + // AttrType: subtype [not required! void* has no AttrType] + // AttrAddrClass: address class [ignored] + t := new(PtrType) + t.Name, _ = e.Val(AttrName).(string) + t.ReflectKind = getKind(e) + typ = t + typeCache[off] = t + if e.Val(AttrType) == nil { + t.Type = &VoidType{} + break + } + t.Type = typeOf(e, AttrType) + + case TagSubroutineType: + // Subroutine type. (DWARF v2 §5.7) + // Attributes: + // AttrType: type of return value if any + // AttrName: possible name of type [ignored] + // AttrPrototyped: whether used ANSI C prototype [ignored] + // Children: + // TagFormalParameter: typed parameter + // AttrType: type of parameter + // TagUnspecifiedParameter: final ... + t := new(FuncType) + t.Name, _ = e.Val(AttrName).(string) + t.ReflectKind = getKind(e) + typ = t + typeCache[off] = t + if t.ReturnType = typeOf(e, AttrType); err != nil { + goto Error + } + t.ParamType = make([]Type, 0, 8) + for kid := next(); kid != nil; kid = next() { + var tkid Type + switch kid.Tag { + default: + continue + case TagFormalParameter: + if tkid = typeOf(kid, AttrType); err != nil { + goto Error + } + case TagUnspecifiedParameters: + tkid = &DotDotDotType{} + } + t.ParamType = append(t.ParamType, tkid) + } + + case TagTypedef: + // Typedef (DWARF v2 §5.3) + // Also maps and channels (Go-specific). + // Attributes: + // AttrName: name [required] + // AttrType: type definition [required] + // AttrGoKey: present for maps. + // AttrGoElem: present for maps and channels. + t := new(TypedefType) + t.ReflectKind = getKind(e) + switch t.ReflectKind { + case reflect.Map: + m := new(MapType) + m.KeyType = typeOf(e, AttrGoKey) + m.ElemType = typeOf(e, AttrGoElem) + t = &m.TypedefType + typ = m + case reflect.Chan: + c := new(ChanType) + c.ElemType = typeOf(e, AttrGoElem) + t = &c.TypedefType + typ = c + case reflect.Interface: + it := new(InterfaceType) + t = &it.TypedefType + typ = it + default: + typ = t + } + typeCache[off] = typ + t.Name, _ = e.Val(AttrName).(string) + t.Type = typeOf(e, AttrType) + + case TagUnspecifiedType: + // Unspecified type (DWARF v3 §5.2) + // Attributes: + // AttrName: name + t := new(UnspecifiedType) + typ = t + typeCache[off] = t + t.Name, _ = e.Val(AttrName).(string) + + default: + err = DecodeError{name, off, "unsupported type tag"} + } + + if err != nil { + goto Error + } + + typ.Common().Offset = off + + { + b, ok := e.Val(AttrByteSize).(int64) + if !ok { + b = -1 + switch t := typ.(type) { + case *TypedefType: + b = t.Type.Size() + case *MapType: + b = t.Type.Size() + case *ChanType: + b = t.Type.Size() + case *InterfaceType: + b = t.Type.Size() + case *PtrType: + b = int64(addressSize) + } + } + typ.Common().ByteSize = b + } + return typ, nil + +Error: + // If the parse fails, take the type out of the cache + // so that the next call with this offset doesn't hit + // the cache and return success. + delete(typeCache, off) + return nil, err +} + +func zeroArray(t Type) { + for { + at, ok := t.(*ArrayType) + if !ok { + break + } + at.Count = 0 + t = at.Type + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/type_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/type_test.go new file mode 100644 index 000000000..5be303db5 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/type_test.go @@ -0,0 +1,122 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dwarf_test + +import ( + "testing" + + . "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf" +) + +var typedefTests = map[string]string{ + "t_ptr_volatile_int": "*volatile int", + "t_ptr_const_char": "*const char", + "t_long": "long int", + "t_ushort": "short unsigned int", + "t_func_int_of_float_double": "func(float, double) int", + "t_ptr_func_int_of_float_double": "*func(float, double) int", + "t_ptr_func_int_of_float_complex": "*func(complex float) int", + "t_ptr_func_int_of_double_complex": "*func(complex double) int", + "t_ptr_func_int_of_long_double_complex": "*func(complex long double) int", + "t_func_ptr_int_of_char_schar_uchar": "func(char, signed char, unsigned char) *int", + "t_func_void_of_char": "func(char) void", + "t_func_void_of_void": "func() void", + "t_func_void_of_ptr_char_dots": "func(*char, ...) void", + "t_my_struct": "struct my_struct {vi volatile int@0; x char@4 : 1@7; y int@4 : 4@27; z [0]int@8; array [40]long long int@8; zz [0]int@328}", + "t_my_struct1": "struct my_struct1 {zz [1]int@0}", + "t_my_union": "union my_union {vi volatile int@0; x char@0 : 1@7; y int@0 : 4@28; array [40]long long int@0}", + "t_my_enum": "enum my_enum {e1=1; e2=2; e3=-5; e4=1000000000000000}", + "t_my_list": "struct list {val short int@0; next *t_my_list@8}", + "t_my_tree": "struct tree {left *struct tree@0; right *struct tree@8; val long long unsigned int@16}", +} + +func elfData(t *testing.T, name string) *Data { + f, err := elf.Open(name) + if err != nil { + t.Fatal(err) + } + + d, err := f.DWARF() + if err != nil { + t.Fatal(err) + } + return d +} + +func TestTypedefsELF(t *testing.T) { testTypedefs(t, elfData(t, "testdata/typedef.elf"), "elf") } + +func TestTypedefsELFDwarf4(t *testing.T) { testTypedefs(t, elfData(t, "testdata/typedef.elf4"), "elf") } + +func testTypedefs(t *testing.T, d *Data, kind string) { + r := d.Reader() + seen := make(map[string]bool) + for { + e, err := r.Next() + if err != nil { + t.Fatal("r.Next:", err) + } + if e == nil { + break + } + if e.Tag == TagTypedef { + typ, err := d.Type(e.Offset) + if err != nil { + t.Fatal("d.Type:", err) + } + t1 := typ.(*TypedefType) + var typstr string + if ts, ok := t1.Type.(*StructType); ok { + typstr = ts.Defn() + } else { + typstr = t1.Type.String() + } + + if want, ok := typedefTests[t1.Name]; ok { + if seen[t1.Name] { + t.Errorf("multiple definitions for %s", t1.Name) + } + seen[t1.Name] = true + if typstr != want { + t.Errorf("%s:\n\thave %s\n\twant %s", t1.Name, typstr, want) + } + } + } + if e.Tag != TagCompileUnit { + r.SkipChildren() + } + } + + for k := range typedefTests { + if !seen[k] { + t.Errorf("missing %s", k) + } + } +} + +func TestTypeForNonTypeEntry(t *testing.T) { + d := elfData(t, "testdata/typedef.elf") + + // The returned entry will be a Subprogram. + ent, err := d.LookupFunction("main") + if err != nil { + t.Fatal("d.LookupFunction:", err) + } + + _, err = d.Type(ent.Offset) + if err == nil { + t.Fatal("nil error for unreadable entry") + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/typeunit.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/typeunit.go new file mode 100644 index 000000000..eeb99add1 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/typeunit.go @@ -0,0 +1,181 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dwarf + +import ( + "fmt" + "strconv" +) + +// Parse the type units stored in a DWARF4 .debug_types section. Each +// type unit defines a single primary type and an 8-byte signature. +// Other sections may then use formRefSig8 to refer to the type. + +// The typeUnit format is a single type with a signature. It holds +// the same data as a compilation unit. +type typeUnit struct { + unit + toff Offset // Offset to signature type within data. + name string // Name of .debug_type section. + cache Type // Cache the type, nil to start. +} + +// Parse a .debug_types section. +func (d *Data) parseTypes(name string, types []byte) error { + b := makeBuf(d, unknownFormat{}, name, 0, types) + for len(b.data) > 0 { + base := b.off + dwarf64 := false + n := b.uint32() + if n == 0xffffffff { + n64 := b.uint64() + if n64 != uint64(uint32(n64)) { + b.error("type unit length overflow") + return b.err + } + n = uint32(n64) + dwarf64 = true + } + hdroff := b.off + vers := b.uint16() + if vers != 4 { + b.error("unsupported DWARF version " + strconv.Itoa(int(vers))) + return b.err + } + var ao uint32 + if !dwarf64 { + ao = b.uint32() + } else { + ao64 := b.uint64() + if ao64 != uint64(uint32(ao64)) { + b.error("type unit abbrev offset overflow") + return b.err + } + ao = uint32(ao64) + } + atable, err := d.parseAbbrev(ao) + if err != nil { + return err + } + asize := b.uint8() + sig := b.uint64() + + var toff uint32 + if !dwarf64 { + toff = b.uint32() + } else { + to64 := b.uint64() + if to64 != uint64(uint32(to64)) { + b.error("type unit type offset overflow") + return b.err + } + toff = uint32(to64) + } + + boff := b.off + d.typeSigs[sig] = &typeUnit{ + unit: unit{ + base: base, + off: boff, + data: b.bytes(int(Offset(n) - (b.off - hdroff))), + atable: atable, + asize: int(asize), + vers: int(vers), + is64: dwarf64, + }, + toff: Offset(toff), + name: name, + } + if b.err != nil { + return b.err + } + } + return nil +} + +// Return the type for a type signature. +func (d *Data) sigToType(sig uint64) (Type, error) { + tu := d.typeSigs[sig] + if tu == nil { + return nil, fmt.Errorf("no type unit with signature %v", sig) + } + if tu.cache != nil { + return tu.cache, nil + } + + b := makeBuf(d, tu, tu.name, tu.off, tu.data) + r := &typeUnitReader{d: d, tu: tu, b: b} + t, err := d.readType(tu.name, r, Offset(tu.toff), make(map[Offset]Type)) + if err != nil { + return nil, err + } + + tu.cache = t + return t, nil +} + +// typeUnitReader is a typeReader for a tagTypeUnit. +type typeUnitReader struct { + d *Data + tu *typeUnit + b buf + err error +} + +// Seek to a new position in the type unit. +func (tur *typeUnitReader) Seek(off Offset) { + tur.err = nil + doff := off - tur.tu.off + if doff < 0 || doff >= Offset(len(tur.tu.data)) { + tur.err = fmt.Errorf("%s: offset %d out of range; max %d", tur.tu.name, doff, len(tur.tu.data)) + return + } + tur.b = makeBuf(tur.d, tur.tu, tur.tu.name, off, tur.tu.data[doff:]) +} + +// AddressSize returns the size in bytes of addresses in the current type unit. +func (tur *typeUnitReader) AddressSize() int { + return tur.tu.unit.asize +} + +// Next reads the next Entry from the type unit. +func (tur *typeUnitReader) Next() (*Entry, error) { + if tur.err != nil { + return nil, tur.err + } + if len(tur.tu.data) == 0 { + return nil, nil + } + e := tur.b.entry(tur.tu.atable, tur.tu.base) + if tur.b.err != nil { + tur.err = tur.b.err + return nil, tur.err + } + return e, nil +} + +// clone returns a new reader for the type unit. +func (tur *typeUnitReader) clone() typeReader { + return &typeUnitReader{ + d: tur.d, + tu: tur.tu, + b: makeBuf(tur.d, tur.tu, tur.tu.name, tur.tu.off, tur.tu.data), + } +} + +// offset returns the current offset. +func (tur *typeUnitReader) offset() Offset { + return tur.b.off +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/unit.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/unit.go new file mode 100644 index 000000000..ddbfd1dc6 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/unit.go @@ -0,0 +1,100 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package dwarf + +import "strconv" + +// DWARF debug info is split into a sequence of compilation units. +// Each unit has its own abbreviation table and address size. + +type unit struct { + base Offset // byte offset of header within the aggregate info + off Offset // byte offset of data within the aggregate info + data []byte + atable abbrevTable + asize int + vers int + is64 bool // True for 64-bit DWARF format +} + +// Implement the dataFormat interface. + +func (u *unit) version() int { + return u.vers +} + +func (u *unit) dwarf64() (bool, bool) { + return u.is64, true +} + +func (u *unit) addrsize() int { + return u.asize +} + +func (d *Data) parseUnits() ([]unit, error) { + // Count units. + nunit := 0 + b := makeBuf(d, unknownFormat{}, "info", 0, d.info) + for len(b.data) > 0 { + len := b.uint32() + if len == 0xffffffff { + len64 := b.uint64() + if len64 != uint64(uint32(len64)) { + b.error("unit length overflow") + break + } + len = uint32(len64) + } + b.skip(int(len)) + nunit++ + } + if b.err != nil { + return nil, b.err + } + + // Again, this time writing them down. + b = makeBuf(d, unknownFormat{}, "info", 0, d.info) + units := make([]unit, nunit) + for i := range units { + u := &units[i] + u.base = b.off + n := b.uint32() + if n == 0xffffffff { + u.is64 = true + n = uint32(b.uint64()) + } + vers := b.uint16() + if vers != 2 && vers != 3 && vers != 4 { + b.error("unsupported DWARF version " + strconv.Itoa(int(vers))) + break + } + u.vers = int(vers) + atable, err := d.parseAbbrev(b.uint32()) + if err != nil { + if b.err == nil { + b.err = err + } + break + } + u.atable = atable + u.asize = int(b.uint8()) + u.off = b.off + u.data = b.bytes(int(n - (2 + 4 + 1))) + } + if b.err != nil { + return nil, b.err + } + return units, nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/elf.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/elf.go new file mode 100644 index 000000000..b326713e6 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/elf.go @@ -0,0 +1,2993 @@ +/* + * ELF constants and data structures + * + * Derived from: + * $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.1 2005/12/30 22:13:58 marcel Exp $ + * $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.1 2005/12/30 22:13:58 marcel Exp $ + * $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.1 2005/12/30 22:13:58 marcel Exp $ + * $FreeBSD: src/sys/alpha/include/elf.h,v 1.14 2003/09/25 01:10:22 peter Exp $ + * $FreeBSD: src/sys/amd64/include/elf.h,v 1.18 2004/08/03 08:21:48 dfr Exp $ + * $FreeBSD: src/sys/arm/include/elf.h,v 1.5.2.1 2006/06/30 21:42:52 cognet Exp $ + * $FreeBSD: src/sys/i386/include/elf.h,v 1.16 2004/08/02 19:12:17 dfr Exp $ + * $FreeBSD: src/sys/powerpc/include/elf.h,v 1.7 2004/11/02 09:47:01 ssouhlal Exp $ + * $FreeBSD: src/sys/sparc64/include/elf.h,v 1.12 2003/09/25 01:10:26 peter Exp $ + * "System V ABI" (http://www.sco.com/developers/gabi/latest/ch4.eheader.html) + * "ELF for the ARM® 64-bit Architecture (AArch64)" (ARM IHI 0056B) + * "RISC-V ELF psABI specification" (https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md) + * llvm/BinaryFormat/ELF.h - ELF constants and structures + * + * Copyright (c) 1996-1998 John D. Polstra. All rights reserved. + * Copyright (c) 2001 David E. O'Brien + * Portions Copyright 2018 Google LLC. + + * 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 AUTHOR 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 AUTHOR 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 elf + +import "strconv" + +/* + * Constants + */ + +// Indexes into the Header.Ident array. +const ( + EI_CLASS = 4 /* Class of machine. */ + EI_DATA = 5 /* Data format. */ + EI_VERSION = 6 /* ELF format version. */ + EI_OSABI = 7 /* Operating system / ABI identification */ + EI_ABIVERSION = 8 /* ABI version */ + EI_PAD = 9 /* Start of padding (per SVR4 ABI). */ + EI_NIDENT = 16 /* Size of e_ident array. */ +) + +// Initial magic number for ELF files. +const ELFMAG = "\177ELF" + +// Version is found in Header.Ident[EI_VERSION] and Header.Version. +type Version byte + +const ( + EV_NONE Version = 0 + EV_CURRENT Version = 1 +) + +var versionStrings = []intName{ + {0, "EV_NONE"}, + {1, "EV_CURRENT"}, +} + +func (i Version) String() string { return stringName(uint32(i), versionStrings, false) } +func (i Version) GoString() string { return stringName(uint32(i), versionStrings, true) } + +// Class is found in Header.Ident[EI_CLASS] and Header.Class. +type Class byte + +const ( + ELFCLASSNONE Class = 0 /* Unknown class. */ + ELFCLASS32 Class = 1 /* 32-bit architecture. */ + ELFCLASS64 Class = 2 /* 64-bit architecture. */ +) + +var classStrings = []intName{ + {0, "ELFCLASSNONE"}, + {1, "ELFCLASS32"}, + {2, "ELFCLASS64"}, +} + +func (i Class) String() string { return stringName(uint32(i), classStrings, false) } +func (i Class) GoString() string { return stringName(uint32(i), classStrings, true) } + +// Data is found in Header.Ident[EI_DATA] and Header.Data. +type Data byte + +const ( + ELFDATANONE Data = 0 /* Unknown data format. */ + ELFDATA2LSB Data = 1 /* 2's complement little-endian. */ + ELFDATA2MSB Data = 2 /* 2's complement big-endian. */ +) + +var dataStrings = []intName{ + {0, "ELFDATANONE"}, + {1, "ELFDATA2LSB"}, + {2, "ELFDATA2MSB"}, +} + +func (i Data) String() string { return stringName(uint32(i), dataStrings, false) } +func (i Data) GoString() string { return stringName(uint32(i), dataStrings, true) } + +// OSABI is found in Header.Ident[EI_OSABI] and Header.OSABI. +type OSABI byte + +const ( + ELFOSABI_NONE OSABI = 0 /* UNIX System V ABI */ + ELFOSABI_HPUX OSABI = 1 /* HP-UX operating system */ + ELFOSABI_NETBSD OSABI = 2 /* NetBSD */ + ELFOSABI_LINUX OSABI = 3 /* GNU/Linux */ + ELFOSABI_HURD OSABI = 4 /* GNU/Hurd */ + ELFOSABI_86OPEN OSABI = 5 /* 86Open common IA32 ABI */ + ELFOSABI_SOLARIS OSABI = 6 /* Solaris */ + ELFOSABI_AIX OSABI = 7 /* AIX */ + ELFOSABI_IRIX OSABI = 8 /* IRIX */ + ELFOSABI_FREEBSD OSABI = 9 /* FreeBSD */ + ELFOSABI_TRU64 OSABI = 10 /* TRU64 UNIX */ + ELFOSABI_MODESTO OSABI = 11 /* Novell Modesto */ + ELFOSABI_OPENBSD OSABI = 12 /* OpenBSD */ + ELFOSABI_OPENVMS OSABI = 13 /* Open VMS */ + ELFOSABI_NSK OSABI = 14 /* HP Non-Stop Kernel */ + ELFOSABI_AROS OSABI = 15 /* Amiga Research OS */ + ELFOSABI_FENIXOS OSABI = 16 /* The FenixOS highly scalable multi-core OS */ + ELFOSABI_CLOUDABI OSABI = 17 /* Nuxi CloudABI */ + ELFOSABI_ARM OSABI = 97 /* ARM */ + ELFOSABI_STANDALONE OSABI = 255 /* Standalone (embedded) application */ +) + +var osabiStrings = []intName{ + {0, "ELFOSABI_NONE"}, + {1, "ELFOSABI_HPUX"}, + {2, "ELFOSABI_NETBSD"}, + {3, "ELFOSABI_LINUX"}, + {4, "ELFOSABI_HURD"}, + {5, "ELFOSABI_86OPEN"}, + {6, "ELFOSABI_SOLARIS"}, + {7, "ELFOSABI_AIX"}, + {8, "ELFOSABI_IRIX"}, + {9, "ELFOSABI_FREEBSD"}, + {10, "ELFOSABI_TRU64"}, + {11, "ELFOSABI_MODESTO"}, + {12, "ELFOSABI_OPENBSD"}, + {13, "ELFOSABI_OPENVMS"}, + {14, "ELFOSABI_NSK"}, + {15, "ELFOSABI_AROS"}, + {16, "ELFOSABI_FENIXOS"}, + {17, "ELFOSABI_CLOUDABI"}, + {97, "ELFOSABI_ARM"}, + {255, "ELFOSABI_STANDALONE"}, +} + +func (i OSABI) String() string { return stringName(uint32(i), osabiStrings, false) } +func (i OSABI) GoString() string { return stringName(uint32(i), osabiStrings, true) } + +// Type is found in Header.Type. +type Type uint16 + +const ( + ET_NONE Type = 0 /* Unknown type. */ + ET_REL Type = 1 /* Relocatable. */ + ET_EXEC Type = 2 /* Executable. */ + ET_DYN Type = 3 /* Shared object. */ + ET_CORE Type = 4 /* Core file. */ + ET_LOOS Type = 0xfe00 /* First operating system specific. */ + ET_HIOS Type = 0xfeff /* Last operating system-specific. */ + ET_LOPROC Type = 0xff00 /* First processor-specific. */ + ET_HIPROC Type = 0xffff /* Last processor-specific. */ +) + +var typeStrings = []intName{ + {0, "ET_NONE"}, + {1, "ET_REL"}, + {2, "ET_EXEC"}, + {3, "ET_DYN"}, + {4, "ET_CORE"}, + {0xfe00, "ET_LOOS"}, + {0xfeff, "ET_HIOS"}, + {0xff00, "ET_LOPROC"}, + {0xffff, "ET_HIPROC"}, +} + +func (i Type) String() string { return stringName(uint32(i), typeStrings, false) } +func (i Type) GoString() string { return stringName(uint32(i), typeStrings, true) } + +// Machine is found in Header.Machine. +type Machine uint16 + +const ( + EM_NONE Machine = 0 /* Unknown machine. */ + EM_M32 Machine = 1 /* AT&T WE32100. */ + EM_SPARC Machine = 2 /* Sun SPARC. */ + EM_386 Machine = 3 /* Intel i386. */ + EM_68K Machine = 4 /* Motorola 68000. */ + EM_88K Machine = 5 /* Motorola 88000. */ + EM_860 Machine = 7 /* Intel i860. */ + EM_MIPS Machine = 8 /* MIPS R3000 Big-Endian only. */ + EM_S370 Machine = 9 /* IBM System/370. */ + EM_MIPS_RS3_LE Machine = 10 /* MIPS R3000 Little-Endian. */ + EM_PARISC Machine = 15 /* HP PA-RISC. */ + EM_VPP500 Machine = 17 /* Fujitsu VPP500. */ + EM_SPARC32PLUS Machine = 18 /* SPARC v8plus. */ + EM_960 Machine = 19 /* Intel 80960. */ + EM_PPC Machine = 20 /* PowerPC 32-bit. */ + EM_PPC64 Machine = 21 /* PowerPC 64-bit. */ + EM_S390 Machine = 22 /* IBM System/390. */ + EM_V800 Machine = 36 /* NEC V800. */ + EM_FR20 Machine = 37 /* Fujitsu FR20. */ + EM_RH32 Machine = 38 /* TRW RH-32. */ + EM_RCE Machine = 39 /* Motorola RCE. */ + EM_ARM Machine = 40 /* ARM. */ + EM_SH Machine = 42 /* Hitachi SH. */ + EM_SPARCV9 Machine = 43 /* SPARC v9 64-bit. */ + EM_TRICORE Machine = 44 /* Siemens TriCore embedded processor. */ + EM_ARC Machine = 45 /* Argonaut RISC Core. */ + EM_H8_300 Machine = 46 /* Hitachi H8/300. */ + EM_H8_300H Machine = 47 /* Hitachi H8/300H. */ + EM_H8S Machine = 48 /* Hitachi H8S. */ + EM_H8_500 Machine = 49 /* Hitachi H8/500. */ + EM_IA_64 Machine = 50 /* Intel IA-64 Processor. */ + EM_MIPS_X Machine = 51 /* Stanford MIPS-X. */ + EM_COLDFIRE Machine = 52 /* Motorola ColdFire. */ + EM_68HC12 Machine = 53 /* Motorola M68HC12. */ + EM_MMA Machine = 54 /* Fujitsu MMA. */ + EM_PCP Machine = 55 /* Siemens PCP. */ + EM_NCPU Machine = 56 /* Sony nCPU. */ + EM_NDR1 Machine = 57 /* Denso NDR1 microprocessor. */ + EM_STARCORE Machine = 58 /* Motorola Star*Core processor. */ + EM_ME16 Machine = 59 /* Toyota ME16 processor. */ + EM_ST100 Machine = 60 /* STMicroelectronics ST100 processor. */ + EM_TINYJ Machine = 61 /* Advanced Logic Corp. TinyJ processor. */ + EM_X86_64 Machine = 62 /* Advanced Micro Devices x86-64 */ + EM_PDSP Machine = 63 /* Sony DSP Processor */ + EM_PDP10 Machine = 64 /* Digital Equipment Corp. PDP-10 */ + EM_PDP11 Machine = 65 /* Digital Equipment Corp. PDP-11 */ + EM_FX66 Machine = 66 /* Siemens FX66 microcontroller */ + EM_ST9PLUS Machine = 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */ + EM_ST7 Machine = 68 /* STMicroelectronics ST7 8-bit microcontroller */ + EM_68HC16 Machine = 69 /* Motorola MC68HC16 Microcontroller */ + EM_68HC11 Machine = 70 /* Motorola MC68HC11 Microcontroller */ + EM_68HC08 Machine = 71 /* Motorola MC68HC08 Microcontroller */ + EM_68HC05 Machine = 72 /* Motorola MC68HC05 Microcontroller */ + EM_SVX Machine = 73 /* Silicon Graphics SVx */ + EM_ST19 Machine = 74 /* STMicroelectronics ST19 8-bit microcontroller */ + EM_VAX Machine = 75 /* Digital VAX */ + EM_CRIS Machine = 76 /* Axis Communications 32-bit embedded processor */ + EM_JAVELIN Machine = 77 /* Infineon Technologies 32-bit embedded processor */ + EM_FIREPATH Machine = 78 /* Element 14 64-bit DSP Processor */ + EM_ZSP Machine = 79 /* LSI Logic 16-bit DSP Processor */ + EM_MMIX Machine = 80 /* Donald Knuth's educational 64-bit processor */ + EM_HUANY Machine = 81 /* Harvard University machine-independent object files */ + EM_PRISM Machine = 82 /* SiTera Prism */ + EM_AVR Machine = 83 /* Atmel AVR 8-bit microcontroller */ + EM_FR30 Machine = 84 /* Fujitsu FR30 */ + EM_D10V Machine = 85 /* Mitsubishi D10V */ + EM_D30V Machine = 86 /* Mitsubishi D30V */ + EM_V850 Machine = 87 /* NEC v850 */ + EM_M32R Machine = 88 /* Mitsubishi M32R */ + EM_MN10300 Machine = 89 /* Matsushita MN10300 */ + EM_MN10200 Machine = 90 /* Matsushita MN10200 */ + EM_PJ Machine = 91 /* picoJava */ + EM_OPENRISC Machine = 92 /* OpenRISC 32-bit embedded processor */ + EM_ARC_COMPACT Machine = 93 /* ARC International ARCompact processor (old spelling/synonym: EM_ARC_A5) */ + EM_XTENSA Machine = 94 /* Tensilica Xtensa Architecture */ + EM_VIDEOCORE Machine = 95 /* Alphamosaic VideoCore processor */ + EM_TMM_GPP Machine = 96 /* Thompson Multimedia General Purpose Processor */ + EM_NS32K Machine = 97 /* National Semiconductor 32000 series */ + EM_TPC Machine = 98 /* Tenor Network TPC processor */ + EM_SNP1K Machine = 99 /* Trebia SNP 1000 processor */ + EM_ST200 Machine = 100 /* STMicroelectronics (www.st.com) ST200 microcontroller */ + EM_IP2K Machine = 101 /* Ubicom IP2xxx microcontroller family */ + EM_MAX Machine = 102 /* MAX Processor */ + EM_CR Machine = 103 /* National Semiconductor CompactRISC microprocessor */ + EM_F2MC16 Machine = 104 /* Fujitsu F2MC16 */ + EM_MSP430 Machine = 105 /* Texas Instruments embedded microcontroller msp430 */ + EM_BLACKFIN Machine = 106 /* Analog Devices Blackfin (DSP) processor */ + EM_SE_C33 Machine = 107 /* S1C33 Family of Seiko Epson processors */ + EM_SEP Machine = 108 /* Sharp embedded microprocessor */ + EM_ARCA Machine = 109 /* Arca RISC Microprocessor */ + EM_UNICORE Machine = 110 /* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */ + EM_EXCESS Machine = 111 /* eXcess: 16/32/64-bit configurable embedded CPU */ + EM_DXP Machine = 112 /* Icera Semiconductor Inc. Deep Execution Processor */ + EM_ALTERA_NIOS2 Machine = 113 /* Altera Nios II soft-core processor */ + EM_CRX Machine = 114 /* National Semiconductor CompactRISC CRX microprocessor */ + EM_XGATE Machine = 115 /* Motorola XGATE embedded processor */ + EM_C166 Machine = 116 /* Infineon C16x/XC16x processor */ + EM_M16C Machine = 117 /* Renesas M16C series microprocessors */ + EM_DSPIC30F Machine = 118 /* Microchip Technology dsPIC30F Digital Signal Controller */ + EM_CE Machine = 119 /* Freescale Communication Engine RISC core */ + EM_M32C Machine = 120 /* Renesas M32C series microprocessors */ + EM_TSK3000 Machine = 131 /* Altium TSK3000 core */ + EM_RS08 Machine = 132 /* Freescale RS08 embedded processor */ + EM_SHARC Machine = 133 /* Analog Devices SHARC family of 32-bit DSP processors */ + EM_ECOG2 Machine = 134 /* Cyan Technology eCOG2 microprocessor */ + EM_SCORE7 Machine = 135 /* Sunplus S+core7 RISC processor */ + EM_DSP24 Machine = 136 /* New Japan Radio (NJR) 24-bit DSP Processor */ + EM_VIDEOCORE3 Machine = 137 /* Broadcom VideoCore III processor */ + EM_LATTICEMICO32 Machine = 138 /* RISC processor for Lattice FPGA architecture */ + EM_SE_C17 Machine = 139 /* Seiko Epson C17 family */ + EM_TI_C6000 Machine = 140 /* The Texas Instruments TMS320C6000 DSP family */ + EM_TI_C2000 Machine = 141 /* The Texas Instruments TMS320C2000 DSP family */ + EM_TI_C5500 Machine = 142 /* The Texas Instruments TMS320C55x DSP family */ + EM_TI_ARP32 Machine = 143 /* Texas Instruments Application Specific RISC Processor, 32bit fetch */ + EM_TI_PRU Machine = 144 /* Texas Instruments Programmable Realtime Unit */ + EM_MMDSP_PLUS Machine = 160 /* STMicroelectronics 64bit VLIW Data Signal Processor */ + EM_CYPRESS_M8C Machine = 161 /* Cypress M8C microprocessor */ + EM_R32C Machine = 162 /* Renesas R32C series microprocessors */ + EM_TRIMEDIA Machine = 163 /* NXP Semiconductors TriMedia architecture family */ + EM_QDSP6 Machine = 164 /* QUALCOMM DSP6 Processor */ + EM_8051 Machine = 165 /* Intel 8051 and variants */ + EM_STXP7X Machine = 166 /* STMicroelectronics STxP7x family of configurable and extensible RISC processors */ + EM_NDS32 Machine = 167 /* Andes Technology compact code size embedded RISC processor family */ + EM_ECOG1 Machine = 168 /* Cyan Technology eCOG1X family */ + EM_ECOG1X Machine = 168 /* Cyan Technology eCOG1X family */ + EM_MAXQ30 Machine = 169 /* Dallas Semiconductor MAXQ30 Core Micro-controllers */ + EM_XIMO16 Machine = 170 /* New Japan Radio (NJR) 16-bit DSP Processor */ + EM_MANIK Machine = 171 /* M2000 Reconfigurable RISC Microprocessor */ + EM_CRAYNV2 Machine = 172 /* Cray Inc. NV2 vector architecture */ + EM_RX Machine = 173 /* Renesas RX family */ + EM_METAG Machine = 174 /* Imagination Technologies META processor architecture */ + EM_MCST_ELBRUS Machine = 175 /* MCST Elbrus general purpose hardware architecture */ + EM_ECOG16 Machine = 176 /* Cyan Technology eCOG16 family */ + EM_CR16 Machine = 177 /* National Semiconductor CompactRISC CR16 16-bit microprocessor */ + EM_ETPU Machine = 178 /* Freescale Extended Time Processing Unit */ + EM_SLE9X Machine = 179 /* Infineon Technologies SLE9X core */ + EM_L10M Machine = 180 /* Intel L10M */ + EM_K10M Machine = 181 /* Intel K10M */ + EM_AARCH64 Machine = 183 /* ARM 64-bit Architecture (AArch64) */ + EM_AVR32 Machine = 185 /* Atmel Corporation 32-bit microprocessor family */ + EM_STM8 Machine = 186 /* STMicroeletronics STM8 8-bit microcontroller */ + EM_TILE64 Machine = 187 /* Tilera TILE64 multicore architecture family */ + EM_TILEPRO Machine = 188 /* Tilera TILEPro multicore architecture family */ + EM_MICROBLAZE Machine = 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */ + EM_CUDA Machine = 190 /* NVIDIA CUDA architecture */ + EM_TILEGX Machine = 191 /* Tilera TILE-Gx multicore architecture family */ + EM_CLOUDSHIELD Machine = 192 /* CloudShield architecture family */ + EM_COREA_1ST Machine = 193 /* KIPO-KAIST Core-A 1st generation processor family */ + EM_COREA_2ND Machine = 194 /* KIPO-KAIST Core-A 2nd generation processor family */ + EM_ARC_COMPACT2 Machine = 195 /* Synopsys ARCompact V2 */ + EM_OPEN8 Machine = 196 /* Open8 8-bit RISC soft processor core */ + EM_RL78 Machine = 197 /* Renesas RL78 family */ + EM_VIDEOCORE5 Machine = 198 /* Broadcom VideoCore V processor */ + EM_78KOR Machine = 199 /* Renesas 78KOR family */ + EM_56800EX Machine = 200 /* Freescale 56800EX Digital Signal Controller (DSC) */ + EM_BA1 Machine = 201 /* Beyond BA1 CPU architecture */ + EM_BA2 Machine = 202 /* Beyond BA2 CPU architecture */ + EM_XCORE Machine = 203 /* XMOS xCORE processor family */ + EM_MCHP_PIC Machine = 204 /* Microchip 8-bit PIC(r) family */ + EM_INTEL205 Machine = 205 /* Reserved by Intel */ + EM_INTEL206 Machine = 206 /* Reserved by Intel */ + EM_INTEL207 Machine = 207 /* Reserved by Intel */ + EM_INTEL208 Machine = 208 /* Reserved by Intel */ + EM_INTEL209 Machine = 209 /* Reserved by Intel */ + EM_KM32 Machine = 210 /* KM211 KM32 32-bit processor */ + EM_KMX32 Machine = 211 /* KM211 KMX32 32-bit processor */ + EM_KMX16 Machine = 212 /* KM211 KMX16 16-bit processor */ + EM_KMX8 Machine = 213 /* KM211 KMX8 8-bit processor */ + EM_KVARC Machine = 214 /* KM211 KVARC processor */ + EM_CDP Machine = 215 /* Paneve CDP architecture family */ + EM_COGE Machine = 216 /* Cognitive Smart Memory Processor */ + EM_COOL Machine = 217 /* Bluechip Systems CoolEngine */ + EM_NORC Machine = 218 /* Nanoradio Optimized RISC */ + EM_CSR_KALIMBA Machine = 219 /* CSR Kalimba architecture family */ + EM_Z80 Machine = 220 /* Zilog Z80 */ + EM_VISIUM Machine = 221 /* Controls and Data Services VISIUMcore processor */ + EM_FT32 Machine = 222 /* FTDI Chip FT32 high performance 32-bit RISC architecture */ + EM_MOXIE Machine = 223 /* Moxie processor family */ + EM_AMDGPU Machine = 224 /* AMD GPU architecture */ + EM_RISCV Machine = 243 /* RISC-V */ + EM_LANAI Machine = 244 /* Lanai 32-bit processor */ + EM_BPF Machine = 247 /* Linux BPF – in-kernel virtual machine */ + + /* Non-standard or deprecated. */ + EM_486 Machine = 6 /* Intel i486. */ + EM_MIPS_RS4_BE Machine = 10 /* MIPS R4000 Big-Endian */ + EM_ALPHA_STD Machine = 41 /* Digital Alpha (standard value). */ + EM_ALPHA Machine = 0x9026 /* Alpha (written in the absence of an ABI) */ +) + +var machineStrings = []intName{ + {0, "EM_NONE"}, + {1, "EM_M32"}, + {2, "EM_SPARC"}, + {3, "EM_386"}, + {4, "EM_68K"}, + {5, "EM_88K"}, + {7, "EM_860"}, + {8, "EM_MIPS"}, + {9, "EM_S370"}, + {10, "EM_MIPS_RS3_LE"}, + {15, "EM_PARISC"}, + {17, "EM_VPP500"}, + {18, "EM_SPARC32PLUS"}, + {19, "EM_960"}, + {20, "EM_PPC"}, + {21, "EM_PPC64"}, + {22, "EM_S390"}, + {36, "EM_V800"}, + {37, "EM_FR20"}, + {38, "EM_RH32"}, + {39, "EM_RCE"}, + {40, "EM_ARM"}, + {42, "EM_SH"}, + {43, "EM_SPARCV9"}, + {44, "EM_TRICORE"}, + {45, "EM_ARC"}, + {46, "EM_H8_300"}, + {47, "EM_H8_300H"}, + {48, "EM_H8S"}, + {49, "EM_H8_500"}, + {50, "EM_IA_64"}, + {51, "EM_MIPS_X"}, + {52, "EM_COLDFIRE"}, + {53, "EM_68HC12"}, + {54, "EM_MMA"}, + {55, "EM_PCP"}, + {56, "EM_NCPU"}, + {57, "EM_NDR1"}, + {58, "EM_STARCORE"}, + {59, "EM_ME16"}, + {60, "EM_ST100"}, + {61, "EM_TINYJ"}, + {62, "EM_X86_64"}, + {63, "EM_PDSP"}, + {64, "EM_PDP10"}, + {65, "EM_PDP11"}, + {66, "EM_FX66"}, + {67, "EM_ST9PLUS"}, + {68, "EM_ST7"}, + {69, "EM_68HC16"}, + {70, "EM_68HC11"}, + {71, "EM_68HC08"}, + {72, "EM_68HC05"}, + {73, "EM_SVX"}, + {74, "EM_ST19"}, + {75, "EM_VAX"}, + {76, "EM_CRIS"}, + {77, "EM_JAVELIN"}, + {78, "EM_FIREPATH"}, + {79, "EM_ZSP"}, + {80, "EM_MMIX"}, + {81, "EM_HUANY"}, + {82, "EM_PRISM"}, + {83, "EM_AVR"}, + {84, "EM_FR30"}, + {85, "EM_D10V"}, + {86, "EM_D30V"}, + {87, "EM_V850"}, + {88, "EM_M32R"}, + {89, "EM_MN10300"}, + {90, "EM_MN10200"}, + {91, "EM_PJ"}, + {92, "EM_OPENRISC"}, + {93, "EM_ARC_COMPACT"}, + {94, "EM_XTENSA"}, + {95, "EM_VIDEOCORE"}, + {96, "EM_TMM_GPP"}, + {97, "EM_NS32K"}, + {98, "EM_TPC"}, + {99, "EM_SNP1K"}, + {100, "EM_ST200"}, + {101, "EM_IP2K"}, + {102, "EM_MAX"}, + {103, "EM_CR"}, + {104, "EM_F2MC16"}, + {105, "EM_MSP430"}, + {106, "EM_BLACKFIN"}, + {107, "EM_SE_C33"}, + {108, "EM_SEP"}, + {109, "EM_ARCA"}, + {110, "EM_UNICORE"}, + {111, "EM_EXCESS"}, + {112, "EM_DXP"}, + {113, "EM_ALTERA_NIOS2"}, + {114, "EM_CRX"}, + {115, "EM_XGATE"}, + {116, "EM_C166"}, + {117, "EM_M16C"}, + {118, "EM_DSPIC30F"}, + {119, "EM_CE"}, + {120, "EM_M32C"}, + {131, "EM_TSK3000"}, + {132, "EM_RS08"}, + {133, "EM_SHARC"}, + {134, "EM_ECOG2"}, + {135, "EM_SCORE7"}, + {136, "EM_DSP24"}, + {137, "EM_VIDEOCORE3"}, + {138, "EM_LATTICEMICO32"}, + {139, "EM_SE_C17"}, + {140, "EM_TI_C6000"}, + {141, "EM_TI_C2000"}, + {142, "EM_TI_C5500"}, + {143, "EM_TI_ARP32"}, + {144, "EM_TI_PRU"}, + {160, "EM_MMDSP_PLUS"}, + {161, "EM_CYPRESS_M8C"}, + {162, "EM_R32C"}, + {163, "EM_TRIMEDIA"}, + {164, "EM_QDSP6"}, + {165, "EM_8051"}, + {166, "EM_STXP7X"}, + {167, "EM_NDS32"}, + {168, "EM_ECOG1"}, + {168, "EM_ECOG1X"}, + {169, "EM_MAXQ30"}, + {170, "EM_XIMO16"}, + {171, "EM_MANIK"}, + {172, "EM_CRAYNV2"}, + {173, "EM_RX"}, + {174, "EM_METAG"}, + {175, "EM_MCST_ELBRUS"}, + {176, "EM_ECOG16"}, + {177, "EM_CR16"}, + {178, "EM_ETPU"}, + {179, "EM_SLE9X"}, + {180, "EM_L10M"}, + {181, "EM_K10M"}, + {183, "EM_AARCH64"}, + {185, "EM_AVR32"}, + {186, "EM_STM8"}, + {187, "EM_TILE64"}, + {188, "EM_TILEPRO"}, + {189, "EM_MICROBLAZE"}, + {190, "EM_CUDA"}, + {191, "EM_TILEGX"}, + {192, "EM_CLOUDSHIELD"}, + {193, "EM_COREA_1ST"}, + {194, "EM_COREA_2ND"}, + {195, "EM_ARC_COMPACT2"}, + {196, "EM_OPEN8"}, + {197, "EM_RL78"}, + {198, "EM_VIDEOCORE5"}, + {199, "EM_78KOR"}, + {200, "EM_56800EX"}, + {201, "EM_BA1"}, + {202, "EM_BA2"}, + {203, "EM_XCORE"}, + {204, "EM_MCHP_PIC"}, + {205, "EM_INTEL205"}, + {206, "EM_INTEL206"}, + {207, "EM_INTEL207"}, + {208, "EM_INTEL208"}, + {209, "EM_INTEL209"}, + {210, "EM_KM32"}, + {211, "EM_KMX32"}, + {212, "EM_KMX16"}, + {213, "EM_KMX8"}, + {214, "EM_KVARC"}, + {215, "EM_CDP"}, + {216, "EM_COGE"}, + {217, "EM_COOL"}, + {218, "EM_NORC"}, + {219, "EM_CSR_KALIMBA "}, + {220, "EM_Z80 "}, + {221, "EM_VISIUM "}, + {222, "EM_FT32 "}, + {223, "EM_MOXIE"}, + {224, "EM_AMDGPU"}, + {243, "EM_RISCV"}, + {244, "EM_LANAI"}, + {247, "EM_BPF"}, + + /* Non-standard or deprecated. */ + {6, "EM_486"}, + {10, "EM_MIPS_RS4_BE"}, + {41, "EM_ALPHA_STD"}, + {0x9026, "EM_ALPHA"}, +} + +func (i Machine) String() string { return stringName(uint32(i), machineStrings, false) } +func (i Machine) GoString() string { return stringName(uint32(i), machineStrings, true) } + +// Special section indices. +type SectionIndex int + +const ( + SHN_UNDEF SectionIndex = 0 /* Undefined, missing, irrelevant. */ + SHN_LORESERVE SectionIndex = 0xff00 /* First of reserved range. */ + SHN_LOPROC SectionIndex = 0xff00 /* First processor-specific. */ + SHN_HIPROC SectionIndex = 0xff1f /* Last processor-specific. */ + SHN_LOOS SectionIndex = 0xff20 /* First operating system-specific. */ + SHN_HIOS SectionIndex = 0xff3f /* Last operating system-specific. */ + SHN_ABS SectionIndex = 0xfff1 /* Absolute values. */ + SHN_COMMON SectionIndex = 0xfff2 /* Common data. */ + SHN_XINDEX SectionIndex = 0xffff /* Escape; index stored elsewhere. */ + SHN_HIRESERVE SectionIndex = 0xffff /* Last of reserved range. */ +) + +var shnStrings = []intName{ + {0, "SHN_UNDEF"}, + {0xff00, "SHN_LOPROC"}, + {0xff20, "SHN_LOOS"}, + {0xfff1, "SHN_ABS"}, + {0xfff2, "SHN_COMMON"}, + {0xffff, "SHN_XINDEX"}, +} + +func (i SectionIndex) String() string { return stringName(uint32(i), shnStrings, false) } +func (i SectionIndex) GoString() string { return stringName(uint32(i), shnStrings, true) } + +// Section type. +type SectionType uint32 + +const ( + SHT_NULL SectionType = 0 /* inactive */ + SHT_PROGBITS SectionType = 1 /* program defined information */ + SHT_SYMTAB SectionType = 2 /* symbol table section */ + SHT_STRTAB SectionType = 3 /* string table section */ + SHT_RELA SectionType = 4 /* relocation section with addends */ + SHT_HASH SectionType = 5 /* symbol hash table section */ + SHT_DYNAMIC SectionType = 6 /* dynamic section */ + SHT_NOTE SectionType = 7 /* note section */ + SHT_NOBITS SectionType = 8 /* no space section */ + SHT_REL SectionType = 9 /* relocation section - no addends */ + SHT_SHLIB SectionType = 10 /* reserved - purpose unknown */ + SHT_DYNSYM SectionType = 11 /* dynamic symbol table section */ + SHT_INIT_ARRAY SectionType = 14 /* Initialization function pointers. */ + SHT_FINI_ARRAY SectionType = 15 /* Termination function pointers. */ + SHT_PREINIT_ARRAY SectionType = 16 /* Pre-initialization function ptrs. */ + SHT_GROUP SectionType = 17 /* Section group. */ + SHT_SYMTAB_SHNDX SectionType = 18 /* Section indexes (see SHN_XINDEX). */ + SHT_LOOS SectionType = 0x60000000 /* First of OS specific semantics */ + SHT_GNU_ATTRIBUTES SectionType = 0x6ffffff5 /* GNU object attributes */ + SHT_GNU_HASH SectionType = 0x6ffffff6 /* GNU hash table */ + SHT_GNU_LIBLIST SectionType = 0x6ffffff7 /* GNU prelink library list */ + SHT_GNU_VERDEF SectionType = 0x6ffffffd /* GNU version definition section */ + SHT_GNU_VERNEED SectionType = 0x6ffffffe /* GNU version needs section */ + SHT_GNU_VERSYM SectionType = 0x6fffffff /* GNU version symbol table */ + SHT_HIOS SectionType = 0x6fffffff /* Last of OS specific semantics */ + SHT_LOPROC SectionType = 0x70000000 /* reserved range for processor */ + SHT_HIPROC SectionType = 0x7fffffff /* specific section header types */ + SHT_LOUSER SectionType = 0x80000000 /* reserved range for application */ + SHT_HIUSER SectionType = 0xffffffff /* specific indexes */ +) + +var shtStrings = []intName{ + {0, "SHT_NULL"}, + {1, "SHT_PROGBITS"}, + {2, "SHT_SYMTAB"}, + {3, "SHT_STRTAB"}, + {4, "SHT_RELA"}, + {5, "SHT_HASH"}, + {6, "SHT_DYNAMIC"}, + {7, "SHT_NOTE"}, + {8, "SHT_NOBITS"}, + {9, "SHT_REL"}, + {10, "SHT_SHLIB"}, + {11, "SHT_DYNSYM"}, + {14, "SHT_INIT_ARRAY"}, + {15, "SHT_FINI_ARRAY"}, + {16, "SHT_PREINIT_ARRAY"}, + {17, "SHT_GROUP"}, + {18, "SHT_SYMTAB_SHNDX"}, + {0x60000000, "SHT_LOOS"}, + {0x6ffffff5, "SHT_GNU_ATTRIBUTES"}, + {0x6ffffff6, "SHT_GNU_HASH"}, + {0x6ffffff7, "SHT_GNU_LIBLIST"}, + {0x6ffffffd, "SHT_GNU_VERDEF"}, + {0x6ffffffe, "SHT_GNU_VERNEED"}, + {0x6fffffff, "SHT_GNU_VERSYM"}, + {0x70000000, "SHT_LOPROC"}, + {0x7fffffff, "SHT_HIPROC"}, + {0x80000000, "SHT_LOUSER"}, + {0xffffffff, "SHT_HIUSER"}, +} + +func (i SectionType) String() string { return stringName(uint32(i), shtStrings, false) } +func (i SectionType) GoString() string { return stringName(uint32(i), shtStrings, true) } + +// Section flags. +type SectionFlag uint32 + +const ( + SHF_WRITE SectionFlag = 0x1 /* Section contains writable data. */ + SHF_ALLOC SectionFlag = 0x2 /* Section occupies memory. */ + SHF_EXECINSTR SectionFlag = 0x4 /* Section contains instructions. */ + SHF_MERGE SectionFlag = 0x10 /* Section may be merged. */ + SHF_STRINGS SectionFlag = 0x20 /* Section contains strings. */ + SHF_INFO_LINK SectionFlag = 0x40 /* sh_info holds section index. */ + SHF_LINK_ORDER SectionFlag = 0x80 /* Special ordering requirements. */ + SHF_OS_NONCONFORMING SectionFlag = 0x100 /* OS-specific processing required. */ + SHF_GROUP SectionFlag = 0x200 /* Member of section group. */ + SHF_TLS SectionFlag = 0x400 /* Section contains TLS data. */ + SHF_COMPRESSED SectionFlag = 0x800 /* Section is compressed. */ + SHF_MASKOS SectionFlag = 0x0ff00000 /* OS-specific semantics. */ + SHF_MASKPROC SectionFlag = 0xf0000000 /* Processor-specific semantics. */ +) + +var shfStrings = []intName{ + {0x1, "SHF_WRITE"}, + {0x2, "SHF_ALLOC"}, + {0x4, "SHF_EXECINSTR"}, + {0x10, "SHF_MERGE"}, + {0x20, "SHF_STRINGS"}, + {0x40, "SHF_INFO_LINK"}, + {0x80, "SHF_LINK_ORDER"}, + {0x100, "SHF_OS_NONCONFORMING"}, + {0x200, "SHF_GROUP"}, + {0x400, "SHF_TLS"}, + {0x800, "SHF_COMPRESSED"}, +} + +func (i SectionFlag) String() string { return flagName(uint32(i), shfStrings, false) } +func (i SectionFlag) GoString() string { return flagName(uint32(i), shfStrings, true) } + +// Section compression type. +type CompressionType int + +const ( + COMPRESS_ZLIB CompressionType = 1 /* ZLIB compression. */ + COMPRESS_LOOS CompressionType = 0x60000000 /* First OS-specific. */ + COMPRESS_HIOS CompressionType = 0x6fffffff /* Last OS-specific. */ + COMPRESS_LOPROC CompressionType = 0x70000000 /* First processor-specific type. */ + COMPRESS_HIPROC CompressionType = 0x7fffffff /* Last processor-specific type. */ +) + +var compressionStrings = []intName{ + {0, "COMPRESS_ZLIB"}, + {0x60000000, "COMPRESS_LOOS"}, + {0x6fffffff, "COMPRESS_HIOS"}, + {0x70000000, "COMPRESS_LOPROC"}, + {0x7fffffff, "COMPRESS_HIPROC"}, +} + +func (i CompressionType) String() string { return stringName(uint32(i), compressionStrings, false) } +func (i CompressionType) GoString() string { return stringName(uint32(i), compressionStrings, true) } + +// Prog.Type +type ProgType int + +const ( + PT_NULL ProgType = 0 /* Unused entry. */ + PT_LOAD ProgType = 1 /* Loadable segment. */ + PT_DYNAMIC ProgType = 2 /* Dynamic linking information segment. */ + PT_INTERP ProgType = 3 /* Pathname of interpreter. */ + PT_NOTE ProgType = 4 /* Auxiliary information. */ + PT_SHLIB ProgType = 5 /* Reserved (not used). */ + PT_PHDR ProgType = 6 /* Location of program header itself. */ + PT_TLS ProgType = 7 /* Thread local storage segment */ + PT_LOOS ProgType = 0x60000000 /* First OS-specific. */ + PT_HIOS ProgType = 0x6fffffff /* Last OS-specific. */ + PT_LOPROC ProgType = 0x70000000 /* First processor-specific type. */ + PT_HIPROC ProgType = 0x7fffffff /* Last processor-specific type. */ +) + +var ptStrings = []intName{ + {0, "PT_NULL"}, + {1, "PT_LOAD"}, + {2, "PT_DYNAMIC"}, + {3, "PT_INTERP"}, + {4, "PT_NOTE"}, + {5, "PT_SHLIB"}, + {6, "PT_PHDR"}, + {7, "PT_TLS"}, + {0x60000000, "PT_LOOS"}, + {0x6fffffff, "PT_HIOS"}, + {0x70000000, "PT_LOPROC"}, + {0x7fffffff, "PT_HIPROC"}, +} + +func (i ProgType) String() string { return stringName(uint32(i), ptStrings, false) } +func (i ProgType) GoString() string { return stringName(uint32(i), ptStrings, true) } + +// Prog.Flag +type ProgFlag uint32 + +const ( + PF_X ProgFlag = 0x1 /* Executable. */ + PF_W ProgFlag = 0x2 /* Writable. */ + PF_R ProgFlag = 0x4 /* Readable. */ + PF_MASKOS ProgFlag = 0x0ff00000 /* Operating system-specific. */ + PF_MASKPROC ProgFlag = 0xf0000000 /* Processor-specific. */ +) + +var pfStrings = []intName{ + {0x1, "PF_X"}, + {0x2, "PF_W"}, + {0x4, "PF_R"}, +} + +func (i ProgFlag) String() string { return flagName(uint32(i), pfStrings, false) } +func (i ProgFlag) GoString() string { return flagName(uint32(i), pfStrings, true) } + +// Dyn.Tag +type DynTag int + +const ( + DT_NULL DynTag = 0 /* Terminating entry. */ + DT_NEEDED DynTag = 1 /* String table offset of a needed shared library. */ + DT_PLTRELSZ DynTag = 2 /* Total size in bytes of PLT relocations. */ + DT_PLTGOT DynTag = 3 /* Processor-dependent address. */ + DT_HASH DynTag = 4 /* Address of symbol hash table. */ + DT_STRTAB DynTag = 5 /* Address of string table. */ + DT_SYMTAB DynTag = 6 /* Address of symbol table. */ + DT_RELA DynTag = 7 /* Address of ElfNN_Rela relocations. */ + DT_RELASZ DynTag = 8 /* Total size of ElfNN_Rela relocations. */ + DT_RELAENT DynTag = 9 /* Size of each ElfNN_Rela relocation entry. */ + DT_STRSZ DynTag = 10 /* Size of string table. */ + DT_SYMENT DynTag = 11 /* Size of each symbol table entry. */ + DT_INIT DynTag = 12 /* Address of initialization function. */ + DT_FINI DynTag = 13 /* Address of finalization function. */ + DT_SONAME DynTag = 14 /* String table offset of shared object name. */ + DT_RPATH DynTag = 15 /* String table offset of library path. [sup] */ + DT_SYMBOLIC DynTag = 16 /* Indicates "symbolic" linking. [sup] */ + DT_REL DynTag = 17 /* Address of ElfNN_Rel relocations. */ + DT_RELSZ DynTag = 18 /* Total size of ElfNN_Rel relocations. */ + DT_RELENT DynTag = 19 /* Size of each ElfNN_Rel relocation. */ + DT_PLTREL DynTag = 20 /* Type of relocation used for PLT. */ + DT_DEBUG DynTag = 21 /* Reserved (not used). */ + DT_TEXTREL DynTag = 22 /* Indicates there may be relocations in non-writable segments. [sup] */ + DT_JMPREL DynTag = 23 /* Address of PLT relocations. */ + DT_BIND_NOW DynTag = 24 /* [sup] */ + DT_INIT_ARRAY DynTag = 25 /* Address of the array of pointers to initialization functions */ + DT_FINI_ARRAY DynTag = 26 /* Address of the array of pointers to termination functions */ + DT_INIT_ARRAYSZ DynTag = 27 /* Size in bytes of the array of initialization functions. */ + DT_FINI_ARRAYSZ DynTag = 28 /* Size in bytes of the array of termination functions. */ + DT_RUNPATH DynTag = 29 /* String table offset of a null-terminated library search path string. */ + DT_FLAGS DynTag = 30 /* Object specific flag values. */ + DT_ENCODING DynTag = 32 /* Values greater than or equal to DT_ENCODING + and less than DT_LOOS follow the rules for + the interpretation of the d_un union + as follows: even == 'd_ptr', even == 'd_val' + or none */ + DT_PREINIT_ARRAY DynTag = 32 /* Address of the array of pointers to pre-initialization functions. */ + DT_PREINIT_ARRAYSZ DynTag = 33 /* Size in bytes of the array of pre-initialization functions. */ + DT_LOOS DynTag = 0x6000000d /* First OS-specific */ + DT_HIOS DynTag = 0x6ffff000 /* Last OS-specific */ + DT_VERSYM DynTag = 0x6ffffff0 + DT_VERNEED DynTag = 0x6ffffffe + DT_VERNEEDNUM DynTag = 0x6fffffff + DT_LOPROC DynTag = 0x70000000 /* First processor-specific type. */ + DT_HIPROC DynTag = 0x7fffffff /* Last processor-specific type. */ +) + +var dtStrings = []intName{ + {0, "DT_NULL"}, + {1, "DT_NEEDED"}, + {2, "DT_PLTRELSZ"}, + {3, "DT_PLTGOT"}, + {4, "DT_HASH"}, + {5, "DT_STRTAB"}, + {6, "DT_SYMTAB"}, + {7, "DT_RELA"}, + {8, "DT_RELASZ"}, + {9, "DT_RELAENT"}, + {10, "DT_STRSZ"}, + {11, "DT_SYMENT"}, + {12, "DT_INIT"}, + {13, "DT_FINI"}, + {14, "DT_SONAME"}, + {15, "DT_RPATH"}, + {16, "DT_SYMBOLIC"}, + {17, "DT_REL"}, + {18, "DT_RELSZ"}, + {19, "DT_RELENT"}, + {20, "DT_PLTREL"}, + {21, "DT_DEBUG"}, + {22, "DT_TEXTREL"}, + {23, "DT_JMPREL"}, + {24, "DT_BIND_NOW"}, + {25, "DT_INIT_ARRAY"}, + {26, "DT_FINI_ARRAY"}, + {27, "DT_INIT_ARRAYSZ"}, + {28, "DT_FINI_ARRAYSZ"}, + {29, "DT_RUNPATH"}, + {30, "DT_FLAGS"}, + {32, "DT_ENCODING"}, + {32, "DT_PREINIT_ARRAY"}, + {33, "DT_PREINIT_ARRAYSZ"}, + {0x6000000d, "DT_LOOS"}, + {0x6ffff000, "DT_HIOS"}, + {0x6ffffff0, "DT_VERSYM"}, + {0x6ffffffe, "DT_VERNEED"}, + {0x6fffffff, "DT_VERNEEDNUM"}, + {0x70000000, "DT_LOPROC"}, + {0x7fffffff, "DT_HIPROC"}, +} + +func (i DynTag) String() string { return stringName(uint32(i), dtStrings, false) } +func (i DynTag) GoString() string { return stringName(uint32(i), dtStrings, true) } + +// DT_FLAGS values. +type DynFlag int + +const ( + DF_ORIGIN DynFlag = 0x0001 /* Indicates that the object being loaded may + make reference to the + $ORIGIN substitution string */ + DF_SYMBOLIC DynFlag = 0x0002 /* Indicates "symbolic" linking. */ + DF_TEXTREL DynFlag = 0x0004 /* Indicates there may be relocations in non-writable segments. */ + DF_BIND_NOW DynFlag = 0x0008 /* Indicates that the dynamic linker should + process all relocations for the object + containing this entry before transferring + control to the program. */ + DF_STATIC_TLS DynFlag = 0x0010 /* Indicates that the shared object or + executable contains code using a static + thread-local storage scheme. */ +) + +var dflagStrings = []intName{ + {0x0001, "DF_ORIGIN"}, + {0x0002, "DF_SYMBOLIC"}, + {0x0004, "DF_TEXTREL"}, + {0x0008, "DF_BIND_NOW"}, + {0x0010, "DF_STATIC_TLS"}, +} + +func (i DynFlag) String() string { return flagName(uint32(i), dflagStrings, false) } +func (i DynFlag) GoString() string { return flagName(uint32(i), dflagStrings, true) } + +// NType values; used in core files. +type NType int + +const ( + NT_PRSTATUS NType = 1 /* Process status. */ + NT_FPREGSET NType = 2 /* Floating point registers. */ + NT_PRPSINFO NType = 3 /* Process state info. */ +) + +var ntypeStrings = []intName{ + {1, "NT_PRSTATUS"}, + {2, "NT_FPREGSET"}, + {3, "NT_PRPSINFO"}, +} + +func (i NType) String() string { return stringName(uint32(i), ntypeStrings, false) } +func (i NType) GoString() string { return stringName(uint32(i), ntypeStrings, true) } + +/* Symbol Binding - ELFNN_ST_BIND - st_info */ +type SymBind int + +const ( + STB_LOCAL SymBind = 0 /* Local symbol */ + STB_GLOBAL SymBind = 1 /* Global symbol */ + STB_WEAK SymBind = 2 /* like global - lower precedence */ + STB_LOOS SymBind = 10 /* Reserved range for operating system */ + STB_HIOS SymBind = 12 /* specific semantics. */ + STB_LOPROC SymBind = 13 /* reserved range for processor */ + STB_HIPROC SymBind = 15 /* specific semantics. */ +) + +var stbStrings = []intName{ + {0, "STB_LOCAL"}, + {1, "STB_GLOBAL"}, + {2, "STB_WEAK"}, + {10, "STB_LOOS"}, + {12, "STB_HIOS"}, + {13, "STB_LOPROC"}, + {15, "STB_HIPROC"}, +} + +func (i SymBind) String() string { return stringName(uint32(i), stbStrings, false) } +func (i SymBind) GoString() string { return stringName(uint32(i), stbStrings, true) } + +/* Symbol type - ELFNN_ST_TYPE - st_info */ +type SymType int + +const ( + STT_NOTYPE SymType = 0 /* Unspecified type. */ + STT_OBJECT SymType = 1 /* Data object. */ + STT_FUNC SymType = 2 /* Function. */ + STT_SECTION SymType = 3 /* Section. */ + STT_FILE SymType = 4 /* Source file. */ + STT_COMMON SymType = 5 /* Uninitialized common block. */ + STT_TLS SymType = 6 /* TLS object. */ + STT_LOOS SymType = 10 /* Reserved range for operating system */ + STT_HIOS SymType = 12 /* specific semantics. */ + STT_LOPROC SymType = 13 /* reserved range for processor */ + STT_HIPROC SymType = 15 /* specific semantics. */ +) + +var sttStrings = []intName{ + {0, "STT_NOTYPE"}, + {1, "STT_OBJECT"}, + {2, "STT_FUNC"}, + {3, "STT_SECTION"}, + {4, "STT_FILE"}, + {5, "STT_COMMON"}, + {6, "STT_TLS"}, + {10, "STT_LOOS"}, + {12, "STT_HIOS"}, + {13, "STT_LOPROC"}, + {15, "STT_HIPROC"}, +} + +func (i SymType) String() string { return stringName(uint32(i), sttStrings, false) } +func (i SymType) GoString() string { return stringName(uint32(i), sttStrings, true) } + +/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */ +type SymVis int + +const ( + STV_DEFAULT SymVis = 0x0 /* Default visibility (see binding). */ + STV_INTERNAL SymVis = 0x1 /* Special meaning in relocatable objects. */ + STV_HIDDEN SymVis = 0x2 /* Not visible. */ + STV_PROTECTED SymVis = 0x3 /* Visible but not preemptible. */ +) + +var stvStrings = []intName{ + {0x0, "STV_DEFAULT"}, + {0x1, "STV_INTERNAL"}, + {0x2, "STV_HIDDEN"}, + {0x3, "STV_PROTECTED"}, +} + +func (i SymVis) String() string { return stringName(uint32(i), stvStrings, false) } +func (i SymVis) GoString() string { return stringName(uint32(i), stvStrings, true) } + +/* + * Relocation types. + */ + +// Relocation types for x86-64. +type R_X86_64 int + +const ( + R_X86_64_NONE R_X86_64 = 0 /* No relocation. */ + R_X86_64_64 R_X86_64 = 1 /* Add 64 bit symbol value. */ + R_X86_64_PC32 R_X86_64 = 2 /* PC-relative 32 bit signed sym value. */ + R_X86_64_GOT32 R_X86_64 = 3 /* PC-relative 32 bit GOT offset. */ + R_X86_64_PLT32 R_X86_64 = 4 /* PC-relative 32 bit PLT offset. */ + R_X86_64_COPY R_X86_64 = 5 /* Copy data from shared object. */ + R_X86_64_GLOB_DAT R_X86_64 = 6 /* Set GOT entry to data address. */ + R_X86_64_JMP_SLOT R_X86_64 = 7 /* Set GOT entry to code address. */ + R_X86_64_RELATIVE R_X86_64 = 8 /* Add load address of shared object. */ + R_X86_64_GOTPCREL R_X86_64 = 9 /* Add 32 bit signed pcrel offset to GOT. */ + R_X86_64_32 R_X86_64 = 10 /* Add 32 bit zero extended symbol value */ + R_X86_64_32S R_X86_64 = 11 /* Add 32 bit sign extended symbol value */ + R_X86_64_16 R_X86_64 = 12 /* Add 16 bit zero extended symbol value */ + R_X86_64_PC16 R_X86_64 = 13 /* Add 16 bit signed extended pc relative symbol value */ + R_X86_64_8 R_X86_64 = 14 /* Add 8 bit zero extended symbol value */ + R_X86_64_PC8 R_X86_64 = 15 /* Add 8 bit signed extended pc relative symbol value */ + R_X86_64_DTPMOD64 R_X86_64 = 16 /* ID of module containing symbol */ + R_X86_64_DTPOFF64 R_X86_64 = 17 /* Offset in TLS block */ + R_X86_64_TPOFF64 R_X86_64 = 18 /* Offset in static TLS block */ + R_X86_64_TLSGD R_X86_64 = 19 /* PC relative offset to GD GOT entry */ + R_X86_64_TLSLD R_X86_64 = 20 /* PC relative offset to LD GOT entry */ + R_X86_64_DTPOFF32 R_X86_64 = 21 /* Offset in TLS block */ + R_X86_64_GOTTPOFF R_X86_64 = 22 /* PC relative offset to IE GOT entry */ + R_X86_64_TPOFF32 R_X86_64 = 23 /* Offset in static TLS block */ + R_X86_64_PC64 R_X86_64 = 24 /* PC relative 64-bit sign extended symbol value. */ + R_X86_64_GOTOFF64 R_X86_64 = 25 + R_X86_64_GOTPC32 R_X86_64 = 26 + R_X86_64_GOT64 R_X86_64 = 27 + R_X86_64_GOTPCREL64 R_X86_64 = 28 + R_X86_64_GOTPC64 R_X86_64 = 29 + R_X86_64_GOTPLT64 R_X86_64 = 30 + R_X86_64_PLTOFF64 R_X86_64 = 31 + R_X86_64_SIZE32 R_X86_64 = 32 + R_X86_64_SIZE64 R_X86_64 = 33 + R_X86_64_GOTPC32_TLSDESC R_X86_64 = 34 + R_X86_64_TLSDESC_CALL R_X86_64 = 35 + R_X86_64_TLSDESC R_X86_64 = 36 + R_X86_64_IRELATIVE R_X86_64 = 37 + R_X86_64_RELATIVE64 R_X86_64 = 38 + R_X86_64_PC32_BND R_X86_64 = 39 + R_X86_64_PLT32_BND R_X86_64 = 40 + R_X86_64_GOTPCRELX R_X86_64 = 41 + R_X86_64_REX_GOTPCRELX R_X86_64 = 42 +) + +var rx86_64Strings = []intName{ + {0, "R_X86_64_NONE"}, + {1, "R_X86_64_64"}, + {2, "R_X86_64_PC32"}, + {3, "R_X86_64_GOT32"}, + {4, "R_X86_64_PLT32"}, + {5, "R_X86_64_COPY"}, + {6, "R_X86_64_GLOB_DAT"}, + {7, "R_X86_64_JMP_SLOT"}, + {8, "R_X86_64_RELATIVE"}, + {9, "R_X86_64_GOTPCREL"}, + {10, "R_X86_64_32"}, + {11, "R_X86_64_32S"}, + {12, "R_X86_64_16"}, + {13, "R_X86_64_PC16"}, + {14, "R_X86_64_8"}, + {15, "R_X86_64_PC8"}, + {16, "R_X86_64_DTPMOD64"}, + {17, "R_X86_64_DTPOFF64"}, + {18, "R_X86_64_TPOFF64"}, + {19, "R_X86_64_TLSGD"}, + {20, "R_X86_64_TLSLD"}, + {21, "R_X86_64_DTPOFF32"}, + {22, "R_X86_64_GOTTPOFF"}, + {23, "R_X86_64_TPOFF32"}, + {24, "R_X86_64_PC64"}, + {25, "R_X86_64_GOTOFF64"}, + {26, "R_X86_64_GOTPC32"}, + {27, "R_X86_64_GOT64"}, + {28, "R_X86_64_GOTPCREL64"}, + {29, "R_X86_64_GOTPC64"}, + {30, "R_X86_64_GOTPLT64"}, + {31, "R_X86_64_PLTOFF64"}, + {32, "R_X86_64_SIZE32"}, + {33, "R_X86_64_SIZE64"}, + {34, "R_X86_64_GOTPC32_TLSDESC"}, + {35, "R_X86_64_TLSDESC_CALL"}, + {36, "R_X86_64_TLSDESC"}, + {37, "R_X86_64_IRELATIVE"}, + {38, "R_X86_64_RELATIVE64"}, + {39, "R_X86_64_PC32_BND"}, + {40, "R_X86_64_PLT32_BND"}, + {41, "R_X86_64_GOTPCRELX"}, + {42, "R_X86_64_REX_GOTPCRELX"}, +} + +func (i R_X86_64) String() string { return stringName(uint32(i), rx86_64Strings, false) } +func (i R_X86_64) GoString() string { return stringName(uint32(i), rx86_64Strings, true) } + +// Relocation types for AArch64 (aka arm64) +type R_AARCH64 int + +const ( + R_AARCH64_NONE R_AARCH64 = 0 + R_AARCH64_P32_ABS32 R_AARCH64 = 1 + R_AARCH64_P32_ABS16 R_AARCH64 = 2 + R_AARCH64_P32_PREL32 R_AARCH64 = 3 + R_AARCH64_P32_PREL16 R_AARCH64 = 4 + R_AARCH64_P32_MOVW_UABS_G0 R_AARCH64 = 5 + R_AARCH64_P32_MOVW_UABS_G0_NC R_AARCH64 = 6 + R_AARCH64_P32_MOVW_UABS_G1 R_AARCH64 = 7 + R_AARCH64_P32_MOVW_SABS_G0 R_AARCH64 = 8 + R_AARCH64_P32_LD_PREL_LO19 R_AARCH64 = 9 + R_AARCH64_P32_ADR_PREL_LO21 R_AARCH64 = 10 + R_AARCH64_P32_ADR_PREL_PG_HI21 R_AARCH64 = 11 + R_AARCH64_P32_ADD_ABS_LO12_NC R_AARCH64 = 12 + R_AARCH64_P32_LDST8_ABS_LO12_NC R_AARCH64 = 13 + R_AARCH64_P32_LDST16_ABS_LO12_NC R_AARCH64 = 14 + R_AARCH64_P32_LDST32_ABS_LO12_NC R_AARCH64 = 15 + R_AARCH64_P32_LDST64_ABS_LO12_NC R_AARCH64 = 16 + R_AARCH64_P32_LDST128_ABS_LO12_NC R_AARCH64 = 17 + R_AARCH64_P32_TSTBR14 R_AARCH64 = 18 + R_AARCH64_P32_CONDBR19 R_AARCH64 = 19 + R_AARCH64_P32_JUMP26 R_AARCH64 = 20 + R_AARCH64_P32_CALL26 R_AARCH64 = 21 + R_AARCH64_P32_GOT_LD_PREL19 R_AARCH64 = 25 + R_AARCH64_P32_ADR_GOT_PAGE R_AARCH64 = 26 + R_AARCH64_P32_LD32_GOT_LO12_NC R_AARCH64 = 27 + R_AARCH64_P32_TLSGD_ADR_PAGE21 R_AARCH64 = 81 + R_AARCH64_P32_TLSGD_ADD_LO12_NC R_AARCH64 = 82 + R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64 = 103 + R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC R_AARCH64 = 104 + R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64 = 105 + R_AARCH64_P32_TLSLE_MOVW_TPREL_G1 R_AARCH64 = 106 + R_AARCH64_P32_TLSLE_MOVW_TPREL_G0 R_AARCH64 = 107 + R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC R_AARCH64 = 108 + R_AARCH64_P32_TLSLE_ADD_TPREL_HI12 R_AARCH64 = 109 + R_AARCH64_P32_TLSLE_ADD_TPREL_LO12 R_AARCH64 = 110 + R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC R_AARCH64 = 111 + R_AARCH64_P32_TLSDESC_LD_PREL19 R_AARCH64 = 122 + R_AARCH64_P32_TLSDESC_ADR_PREL21 R_AARCH64 = 123 + R_AARCH64_P32_TLSDESC_ADR_PAGE21 R_AARCH64 = 124 + R_AARCH64_P32_TLSDESC_LD32_LO12_NC R_AARCH64 = 125 + R_AARCH64_P32_TLSDESC_ADD_LO12_NC R_AARCH64 = 126 + R_AARCH64_P32_TLSDESC_CALL R_AARCH64 = 127 + R_AARCH64_P32_COPY R_AARCH64 = 180 + R_AARCH64_P32_GLOB_DAT R_AARCH64 = 181 + R_AARCH64_P32_JUMP_SLOT R_AARCH64 = 182 + R_AARCH64_P32_RELATIVE R_AARCH64 = 183 + R_AARCH64_P32_TLS_DTPMOD R_AARCH64 = 184 + R_AARCH64_P32_TLS_DTPREL R_AARCH64 = 185 + R_AARCH64_P32_TLS_TPREL R_AARCH64 = 186 + R_AARCH64_P32_TLSDESC R_AARCH64 = 187 + R_AARCH64_P32_IRELATIVE R_AARCH64 = 188 + R_AARCH64_NULL R_AARCH64 = 256 + R_AARCH64_ABS64 R_AARCH64 = 257 + R_AARCH64_ABS32 R_AARCH64 = 258 + R_AARCH64_ABS16 R_AARCH64 = 259 + R_AARCH64_PREL64 R_AARCH64 = 260 + R_AARCH64_PREL32 R_AARCH64 = 261 + R_AARCH64_PREL16 R_AARCH64 = 262 + R_AARCH64_MOVW_UABS_G0 R_AARCH64 = 263 + R_AARCH64_MOVW_UABS_G0_NC R_AARCH64 = 264 + R_AARCH64_MOVW_UABS_G1 R_AARCH64 = 265 + R_AARCH64_MOVW_UABS_G1_NC R_AARCH64 = 266 + R_AARCH64_MOVW_UABS_G2 R_AARCH64 = 267 + R_AARCH64_MOVW_UABS_G2_NC R_AARCH64 = 268 + R_AARCH64_MOVW_UABS_G3 R_AARCH64 = 269 + R_AARCH64_MOVW_SABS_G0 R_AARCH64 = 270 + R_AARCH64_MOVW_SABS_G1 R_AARCH64 = 271 + R_AARCH64_MOVW_SABS_G2 R_AARCH64 = 272 + R_AARCH64_LD_PREL_LO19 R_AARCH64 = 273 + R_AARCH64_ADR_PREL_LO21 R_AARCH64 = 274 + R_AARCH64_ADR_PREL_PG_HI21 R_AARCH64 = 275 + R_AARCH64_ADR_PREL_PG_HI21_NC R_AARCH64 = 276 + R_AARCH64_ADD_ABS_LO12_NC R_AARCH64 = 277 + R_AARCH64_LDST8_ABS_LO12_NC R_AARCH64 = 278 + R_AARCH64_TSTBR14 R_AARCH64 = 279 + R_AARCH64_CONDBR19 R_AARCH64 = 280 + R_AARCH64_JUMP26 R_AARCH64 = 282 + R_AARCH64_CALL26 R_AARCH64 = 283 + R_AARCH64_LDST16_ABS_LO12_NC R_AARCH64 = 284 + R_AARCH64_LDST32_ABS_LO12_NC R_AARCH64 = 285 + R_AARCH64_LDST64_ABS_LO12_NC R_AARCH64 = 286 + R_AARCH64_LDST128_ABS_LO12_NC R_AARCH64 = 299 + R_AARCH64_GOT_LD_PREL19 R_AARCH64 = 309 + R_AARCH64_LD64_GOTOFF_LO15 R_AARCH64 = 310 + R_AARCH64_ADR_GOT_PAGE R_AARCH64 = 311 + R_AARCH64_LD64_GOT_LO12_NC R_AARCH64 = 312 + R_AARCH64_LD64_GOTPAGE_LO15 R_AARCH64 = 313 + R_AARCH64_TLSGD_ADR_PREL21 R_AARCH64 = 512 + R_AARCH64_TLSGD_ADR_PAGE21 R_AARCH64 = 513 + R_AARCH64_TLSGD_ADD_LO12_NC R_AARCH64 = 514 + R_AARCH64_TLSGD_MOVW_G1 R_AARCH64 = 515 + R_AARCH64_TLSGD_MOVW_G0_NC R_AARCH64 = 516 + R_AARCH64_TLSLD_ADR_PREL21 R_AARCH64 = 517 + R_AARCH64_TLSLD_ADR_PAGE21 R_AARCH64 = 518 + R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 R_AARCH64 = 539 + R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC R_AARCH64 = 540 + R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64 = 541 + R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC R_AARCH64 = 542 + R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64 = 543 + R_AARCH64_TLSLE_MOVW_TPREL_G2 R_AARCH64 = 544 + R_AARCH64_TLSLE_MOVW_TPREL_G1 R_AARCH64 = 545 + R_AARCH64_TLSLE_MOVW_TPREL_G1_NC R_AARCH64 = 546 + R_AARCH64_TLSLE_MOVW_TPREL_G0 R_AARCH64 = 547 + R_AARCH64_TLSLE_MOVW_TPREL_G0_NC R_AARCH64 = 548 + R_AARCH64_TLSLE_ADD_TPREL_HI12 R_AARCH64 = 549 + R_AARCH64_TLSLE_ADD_TPREL_LO12 R_AARCH64 = 550 + R_AARCH64_TLSLE_ADD_TPREL_LO12_NC R_AARCH64 = 551 + R_AARCH64_TLSDESC_LD_PREL19 R_AARCH64 = 560 + R_AARCH64_TLSDESC_ADR_PREL21 R_AARCH64 = 561 + R_AARCH64_TLSDESC_ADR_PAGE21 R_AARCH64 = 562 + R_AARCH64_TLSDESC_LD64_LO12_NC R_AARCH64 = 563 + R_AARCH64_TLSDESC_ADD_LO12_NC R_AARCH64 = 564 + R_AARCH64_TLSDESC_OFF_G1 R_AARCH64 = 565 + R_AARCH64_TLSDESC_OFF_G0_NC R_AARCH64 = 566 + R_AARCH64_TLSDESC_LDR R_AARCH64 = 567 + R_AARCH64_TLSDESC_ADD R_AARCH64 = 568 + R_AARCH64_TLSDESC_CALL R_AARCH64 = 569 + R_AARCH64_TLSLE_LDST128_TPREL_LO12 R_AARCH64 = 570 + R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC R_AARCH64 = 571 + R_AARCH64_TLSLD_LDST128_DTPREL_LO12 R_AARCH64 = 572 + R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC R_AARCH64 = 573 + R_AARCH64_COPY R_AARCH64 = 1024 + R_AARCH64_GLOB_DAT R_AARCH64 = 1025 + R_AARCH64_JUMP_SLOT R_AARCH64 = 1026 + R_AARCH64_RELATIVE R_AARCH64 = 1027 + R_AARCH64_TLS_DTPMOD64 R_AARCH64 = 1028 + R_AARCH64_TLS_DTPREL64 R_AARCH64 = 1029 + R_AARCH64_TLS_TPREL64 R_AARCH64 = 1030 + R_AARCH64_TLSDESC R_AARCH64 = 1031 + R_AARCH64_IRELATIVE R_AARCH64 = 1032 +) + +var raarch64Strings = []intName{ + {0, "R_AARCH64_NONE"}, + {1, "R_AARCH64_P32_ABS32"}, + {2, "R_AARCH64_P32_ABS16"}, + {3, "R_AARCH64_P32_PREL32"}, + {4, "R_AARCH64_P32_PREL16"}, + {5, "R_AARCH64_P32_MOVW_UABS_G0"}, + {6, "R_AARCH64_P32_MOVW_UABS_G0_NC"}, + {7, "R_AARCH64_P32_MOVW_UABS_G1"}, + {8, "R_AARCH64_P32_MOVW_SABS_G0"}, + {9, "R_AARCH64_P32_LD_PREL_LO19"}, + {10, "R_AARCH64_P32_ADR_PREL_LO21"}, + {11, "R_AARCH64_P32_ADR_PREL_PG_HI21"}, + {12, "R_AARCH64_P32_ADD_ABS_LO12_NC"}, + {13, "R_AARCH64_P32_LDST8_ABS_LO12_NC"}, + {14, "R_AARCH64_P32_LDST16_ABS_LO12_NC"}, + {15, "R_AARCH64_P32_LDST32_ABS_LO12_NC"}, + {16, "R_AARCH64_P32_LDST64_ABS_LO12_NC"}, + {17, "R_AARCH64_P32_LDST128_ABS_LO12_NC"}, + {18, "R_AARCH64_P32_TSTBR14"}, + {19, "R_AARCH64_P32_CONDBR19"}, + {20, "R_AARCH64_P32_JUMP26"}, + {21, "R_AARCH64_P32_CALL26"}, + {25, "R_AARCH64_P32_GOT_LD_PREL19"}, + {26, "R_AARCH64_P32_ADR_GOT_PAGE"}, + {27, "R_AARCH64_P32_LD32_GOT_LO12_NC"}, + {81, "R_AARCH64_P32_TLSGD_ADR_PAGE21"}, + {82, "R_AARCH64_P32_TLSGD_ADD_LO12_NC"}, + {103, "R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21"}, + {104, "R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC"}, + {105, "R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19"}, + {106, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G1"}, + {107, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0"}, + {108, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC"}, + {109, "R_AARCH64_P32_TLSLE_ADD_TPREL_HI12"}, + {110, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12"}, + {111, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC"}, + {122, "R_AARCH64_P32_TLSDESC_LD_PREL19"}, + {123, "R_AARCH64_P32_TLSDESC_ADR_PREL21"}, + {124, "R_AARCH64_P32_TLSDESC_ADR_PAGE21"}, + {125, "R_AARCH64_P32_TLSDESC_LD32_LO12_NC"}, + {126, "R_AARCH64_P32_TLSDESC_ADD_LO12_NC"}, + {127, "R_AARCH64_P32_TLSDESC_CALL"}, + {180, "R_AARCH64_P32_COPY"}, + {181, "R_AARCH64_P32_GLOB_DAT"}, + {182, "R_AARCH64_P32_JUMP_SLOT"}, + {183, "R_AARCH64_P32_RELATIVE"}, + {184, "R_AARCH64_P32_TLS_DTPMOD"}, + {185, "R_AARCH64_P32_TLS_DTPREL"}, + {186, "R_AARCH64_P32_TLS_TPREL"}, + {187, "R_AARCH64_P32_TLSDESC"}, + {188, "R_AARCH64_P32_IRELATIVE"}, + {256, "R_AARCH64_NULL"}, + {257, "R_AARCH64_ABS64"}, + {258, "R_AARCH64_ABS32"}, + {259, "R_AARCH64_ABS16"}, + {260, "R_AARCH64_PREL64"}, + {261, "R_AARCH64_PREL32"}, + {262, "R_AARCH64_PREL16"}, + {263, "R_AARCH64_MOVW_UABS_G0"}, + {264, "R_AARCH64_MOVW_UABS_G0_NC"}, + {265, "R_AARCH64_MOVW_UABS_G1"}, + {266, "R_AARCH64_MOVW_UABS_G1_NC"}, + {267, "R_AARCH64_MOVW_UABS_G2"}, + {268, "R_AARCH64_MOVW_UABS_G2_NC"}, + {269, "R_AARCH64_MOVW_UABS_G3"}, + {270, "R_AARCH64_MOVW_SABS_G0"}, + {271, "R_AARCH64_MOVW_SABS_G1"}, + {272, "R_AARCH64_MOVW_SABS_G2"}, + {273, "R_AARCH64_LD_PREL_LO19"}, + {274, "R_AARCH64_ADR_PREL_LO21"}, + {275, "R_AARCH64_ADR_PREL_PG_HI21"}, + {276, "R_AARCH64_ADR_PREL_PG_HI21_NC"}, + {277, "R_AARCH64_ADD_ABS_LO12_NC"}, + {278, "R_AARCH64_LDST8_ABS_LO12_NC"}, + {279, "R_AARCH64_TSTBR14"}, + {280, "R_AARCH64_CONDBR19"}, + {282, "R_AARCH64_JUMP26"}, + {283, "R_AARCH64_CALL26"}, + {284, "R_AARCH64_LDST16_ABS_LO12_NC"}, + {285, "R_AARCH64_LDST32_ABS_LO12_NC"}, + {286, "R_AARCH64_LDST64_ABS_LO12_NC"}, + {299, "R_AARCH64_LDST128_ABS_LO12_NC"}, + {309, "R_AARCH64_GOT_LD_PREL19"}, + {310, "R_AARCH64_LD64_GOTOFF_LO15"}, + {311, "R_AARCH64_ADR_GOT_PAGE"}, + {312, "R_AARCH64_LD64_GOT_LO12_NC"}, + {313, "R_AARCH64_LD64_GOTPAGE_LO15"}, + {512, "R_AARCH64_TLSGD_ADR_PREL21"}, + {513, "R_AARCH64_TLSGD_ADR_PAGE21"}, + {514, "R_AARCH64_TLSGD_ADD_LO12_NC"}, + {515, "R_AARCH64_TLSGD_MOVW_G1"}, + {516, "R_AARCH64_TLSGD_MOVW_G0_NC"}, + {517, "R_AARCH64_TLSLD_ADR_PREL21"}, + {518, "R_AARCH64_TLSLD_ADR_PAGE21"}, + {539, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G1"}, + {540, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC"}, + {541, "R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21"}, + {542, "R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC"}, + {543, "R_AARCH64_TLSIE_LD_GOTTPREL_PREL19"}, + {544, "R_AARCH64_TLSLE_MOVW_TPREL_G2"}, + {545, "R_AARCH64_TLSLE_MOVW_TPREL_G1"}, + {546, "R_AARCH64_TLSLE_MOVW_TPREL_G1_NC"}, + {547, "R_AARCH64_TLSLE_MOVW_TPREL_G0"}, + {548, "R_AARCH64_TLSLE_MOVW_TPREL_G0_NC"}, + {549, "R_AARCH64_TLSLE_ADD_TPREL_HI12"}, + {550, "R_AARCH64_TLSLE_ADD_TPREL_LO12"}, + {551, "R_AARCH64_TLSLE_ADD_TPREL_LO12_NC"}, + {560, "R_AARCH64_TLSDESC_LD_PREL19"}, + {561, "R_AARCH64_TLSDESC_ADR_PREL21"}, + {562, "R_AARCH64_TLSDESC_ADR_PAGE21"}, + {563, "R_AARCH64_TLSDESC_LD64_LO12_NC"}, + {564, "R_AARCH64_TLSDESC_ADD_LO12_NC"}, + {565, "R_AARCH64_TLSDESC_OFF_G1"}, + {566, "R_AARCH64_TLSDESC_OFF_G0_NC"}, + {567, "R_AARCH64_TLSDESC_LDR"}, + {568, "R_AARCH64_TLSDESC_ADD"}, + {569, "R_AARCH64_TLSDESC_CALL"}, + {570, "R_AARCH64_TLSLE_LDST128_TPREL_LO12"}, + {571, "R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC"}, + {572, "R_AARCH64_TLSLD_LDST128_DTPREL_LO12"}, + {573, "R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC"}, + {1024, "R_AARCH64_COPY"}, + {1025, "R_AARCH64_GLOB_DAT"}, + {1026, "R_AARCH64_JUMP_SLOT"}, + {1027, "R_AARCH64_RELATIVE"}, + {1028, "R_AARCH64_TLS_DTPMOD64"}, + {1029, "R_AARCH64_TLS_DTPREL64"}, + {1030, "R_AARCH64_TLS_TPREL64"}, + {1031, "R_AARCH64_TLSDESC"}, + {1032, "R_AARCH64_IRELATIVE"}, +} + +func (i R_AARCH64) String() string { return stringName(uint32(i), raarch64Strings, false) } +func (i R_AARCH64) GoString() string { return stringName(uint32(i), raarch64Strings, true) } + +// Relocation types for Alpha. +type R_ALPHA int + +const ( + R_ALPHA_NONE R_ALPHA = 0 /* No reloc */ + R_ALPHA_REFLONG R_ALPHA = 1 /* Direct 32 bit */ + R_ALPHA_REFQUAD R_ALPHA = 2 /* Direct 64 bit */ + R_ALPHA_GPREL32 R_ALPHA = 3 /* GP relative 32 bit */ + R_ALPHA_LITERAL R_ALPHA = 4 /* GP relative 16 bit w/optimization */ + R_ALPHA_LITUSE R_ALPHA = 5 /* Optimization hint for LITERAL */ + R_ALPHA_GPDISP R_ALPHA = 6 /* Add displacement to GP */ + R_ALPHA_BRADDR R_ALPHA = 7 /* PC+4 relative 23 bit shifted */ + R_ALPHA_HINT R_ALPHA = 8 /* PC+4 relative 16 bit shifted */ + R_ALPHA_SREL16 R_ALPHA = 9 /* PC relative 16 bit */ + R_ALPHA_SREL32 R_ALPHA = 10 /* PC relative 32 bit */ + R_ALPHA_SREL64 R_ALPHA = 11 /* PC relative 64 bit */ + R_ALPHA_OP_PUSH R_ALPHA = 12 /* OP stack push */ + R_ALPHA_OP_STORE R_ALPHA = 13 /* OP stack pop and store */ + R_ALPHA_OP_PSUB R_ALPHA = 14 /* OP stack subtract */ + R_ALPHA_OP_PRSHIFT R_ALPHA = 15 /* OP stack right shift */ + R_ALPHA_GPVALUE R_ALPHA = 16 + R_ALPHA_GPRELHIGH R_ALPHA = 17 + R_ALPHA_GPRELLOW R_ALPHA = 18 + R_ALPHA_IMMED_GP_16 R_ALPHA = 19 + R_ALPHA_IMMED_GP_HI32 R_ALPHA = 20 + R_ALPHA_IMMED_SCN_HI32 R_ALPHA = 21 + R_ALPHA_IMMED_BR_HI32 R_ALPHA = 22 + R_ALPHA_IMMED_LO32 R_ALPHA = 23 + R_ALPHA_COPY R_ALPHA = 24 /* Copy symbol at runtime */ + R_ALPHA_GLOB_DAT R_ALPHA = 25 /* Create GOT entry */ + R_ALPHA_JMP_SLOT R_ALPHA = 26 /* Create PLT entry */ + R_ALPHA_RELATIVE R_ALPHA = 27 /* Adjust by program base */ +) + +var ralphaStrings = []intName{ + {0, "R_ALPHA_NONE"}, + {1, "R_ALPHA_REFLONG"}, + {2, "R_ALPHA_REFQUAD"}, + {3, "R_ALPHA_GPREL32"}, + {4, "R_ALPHA_LITERAL"}, + {5, "R_ALPHA_LITUSE"}, + {6, "R_ALPHA_GPDISP"}, + {7, "R_ALPHA_BRADDR"}, + {8, "R_ALPHA_HINT"}, + {9, "R_ALPHA_SREL16"}, + {10, "R_ALPHA_SREL32"}, + {11, "R_ALPHA_SREL64"}, + {12, "R_ALPHA_OP_PUSH"}, + {13, "R_ALPHA_OP_STORE"}, + {14, "R_ALPHA_OP_PSUB"}, + {15, "R_ALPHA_OP_PRSHIFT"}, + {16, "R_ALPHA_GPVALUE"}, + {17, "R_ALPHA_GPRELHIGH"}, + {18, "R_ALPHA_GPRELLOW"}, + {19, "R_ALPHA_IMMED_GP_16"}, + {20, "R_ALPHA_IMMED_GP_HI32"}, + {21, "R_ALPHA_IMMED_SCN_HI32"}, + {22, "R_ALPHA_IMMED_BR_HI32"}, + {23, "R_ALPHA_IMMED_LO32"}, + {24, "R_ALPHA_COPY"}, + {25, "R_ALPHA_GLOB_DAT"}, + {26, "R_ALPHA_JMP_SLOT"}, + {27, "R_ALPHA_RELATIVE"}, +} + +func (i R_ALPHA) String() string { return stringName(uint32(i), ralphaStrings, false) } +func (i R_ALPHA) GoString() string { return stringName(uint32(i), ralphaStrings, true) } + +// Relocation types for ARM. +type R_ARM int + +const ( + R_ARM_NONE R_ARM = 0 /* No relocation. */ + R_ARM_PC24 R_ARM = 1 + R_ARM_ABS32 R_ARM = 2 + R_ARM_REL32 R_ARM = 3 + R_ARM_PC13 R_ARM = 4 + R_ARM_ABS16 R_ARM = 5 + R_ARM_ABS12 R_ARM = 6 + R_ARM_THM_ABS5 R_ARM = 7 + R_ARM_ABS8 R_ARM = 8 + R_ARM_SBREL32 R_ARM = 9 + R_ARM_THM_PC22 R_ARM = 10 + R_ARM_THM_PC8 R_ARM = 11 + R_ARM_AMP_VCALL9 R_ARM = 12 + R_ARM_SWI24 R_ARM = 13 + R_ARM_THM_SWI8 R_ARM = 14 + R_ARM_XPC25 R_ARM = 15 + R_ARM_THM_XPC22 R_ARM = 16 + R_ARM_TLS_DTPMOD32 R_ARM = 17 + R_ARM_TLS_DTPOFF32 R_ARM = 18 + R_ARM_TLS_TPOFF32 R_ARM = 19 + R_ARM_COPY R_ARM = 20 /* Copy data from shared object. */ + R_ARM_GLOB_DAT R_ARM = 21 /* Set GOT entry to data address. */ + R_ARM_JUMP_SLOT R_ARM = 22 /* Set GOT entry to code address. */ + R_ARM_RELATIVE R_ARM = 23 /* Add load address of shared object. */ + R_ARM_GOTOFF R_ARM = 24 /* Add GOT-relative symbol address. */ + R_ARM_GOTPC R_ARM = 25 /* Add PC-relative GOT table address. */ + R_ARM_GOT32 R_ARM = 26 /* Add PC-relative GOT offset. */ + R_ARM_PLT32 R_ARM = 27 /* Add PC-relative PLT offset. */ + R_ARM_CALL R_ARM = 28 + R_ARM_JUMP24 R_ARM = 29 + R_ARM_THM_JUMP24 R_ARM = 30 + R_ARM_BASE_ABS R_ARM = 31 + R_ARM_ALU_PCREL_7_0 R_ARM = 32 + R_ARM_ALU_PCREL_15_8 R_ARM = 33 + R_ARM_ALU_PCREL_23_15 R_ARM = 34 + R_ARM_LDR_SBREL_11_10_NC R_ARM = 35 + R_ARM_ALU_SBREL_19_12_NC R_ARM = 36 + R_ARM_ALU_SBREL_27_20_CK R_ARM = 37 + R_ARM_TARGET1 R_ARM = 38 + R_ARM_SBREL31 R_ARM = 39 + R_ARM_V4BX R_ARM = 40 + R_ARM_TARGET2 R_ARM = 41 + R_ARM_PREL31 R_ARM = 42 + R_ARM_MOVW_ABS_NC R_ARM = 43 + R_ARM_MOVT_ABS R_ARM = 44 + R_ARM_MOVW_PREL_NC R_ARM = 45 + R_ARM_MOVT_PREL R_ARM = 46 + R_ARM_THM_MOVW_ABS_NC R_ARM = 47 + R_ARM_THM_MOVT_ABS R_ARM = 48 + R_ARM_THM_MOVW_PREL_NC R_ARM = 49 + R_ARM_THM_MOVT_PREL R_ARM = 50 + R_ARM_THM_JUMP19 R_ARM = 51 + R_ARM_THM_JUMP6 R_ARM = 52 + R_ARM_THM_ALU_PREL_11_0 R_ARM = 53 + R_ARM_THM_PC12 R_ARM = 54 + R_ARM_ABS32_NOI R_ARM = 55 + R_ARM_REL32_NOI R_ARM = 56 + R_ARM_ALU_PC_G0_NC R_ARM = 57 + R_ARM_ALU_PC_G0 R_ARM = 58 + R_ARM_ALU_PC_G1_NC R_ARM = 59 + R_ARM_ALU_PC_G1 R_ARM = 60 + R_ARM_ALU_PC_G2 R_ARM = 61 + R_ARM_LDR_PC_G1 R_ARM = 62 + R_ARM_LDR_PC_G2 R_ARM = 63 + R_ARM_LDRS_PC_G0 R_ARM = 64 + R_ARM_LDRS_PC_G1 R_ARM = 65 + R_ARM_LDRS_PC_G2 R_ARM = 66 + R_ARM_LDC_PC_G0 R_ARM = 67 + R_ARM_LDC_PC_G1 R_ARM = 68 + R_ARM_LDC_PC_G2 R_ARM = 69 + R_ARM_ALU_SB_G0_NC R_ARM = 70 + R_ARM_ALU_SB_G0 R_ARM = 71 + R_ARM_ALU_SB_G1_NC R_ARM = 72 + R_ARM_ALU_SB_G1 R_ARM = 73 + R_ARM_ALU_SB_G2 R_ARM = 74 + R_ARM_LDR_SB_G0 R_ARM = 75 + R_ARM_LDR_SB_G1 R_ARM = 76 + R_ARM_LDR_SB_G2 R_ARM = 77 + R_ARM_LDRS_SB_G0 R_ARM = 78 + R_ARM_LDRS_SB_G1 R_ARM = 79 + R_ARM_LDRS_SB_G2 R_ARM = 80 + R_ARM_LDC_SB_G0 R_ARM = 81 + R_ARM_LDC_SB_G1 R_ARM = 82 + R_ARM_LDC_SB_G2 R_ARM = 83 + R_ARM_MOVW_BREL_NC R_ARM = 84 + R_ARM_MOVT_BREL R_ARM = 85 + R_ARM_MOVW_BREL R_ARM = 86 + R_ARM_THM_MOVW_BREL_NC R_ARM = 87 + R_ARM_THM_MOVT_BREL R_ARM = 88 + R_ARM_THM_MOVW_BREL R_ARM = 89 + R_ARM_TLS_GOTDESC R_ARM = 90 + R_ARM_TLS_CALL R_ARM = 91 + R_ARM_TLS_DESCSEQ R_ARM = 92 + R_ARM_THM_TLS_CALL R_ARM = 93 + R_ARM_PLT32_ABS R_ARM = 94 + R_ARM_GOT_ABS R_ARM = 95 + R_ARM_GOT_PREL R_ARM = 96 + R_ARM_GOT_BREL12 R_ARM = 97 + R_ARM_GOTOFF12 R_ARM = 98 + R_ARM_GOTRELAX R_ARM = 99 + R_ARM_GNU_VTENTRY R_ARM = 100 + R_ARM_GNU_VTINHERIT R_ARM = 101 + R_ARM_THM_JUMP11 R_ARM = 102 + R_ARM_THM_JUMP8 R_ARM = 103 + R_ARM_TLS_GD32 R_ARM = 104 + R_ARM_TLS_LDM32 R_ARM = 105 + R_ARM_TLS_LDO32 R_ARM = 106 + R_ARM_TLS_IE32 R_ARM = 107 + R_ARM_TLS_LE32 R_ARM = 108 + R_ARM_TLS_LDO12 R_ARM = 109 + R_ARM_TLS_LE12 R_ARM = 110 + R_ARM_TLS_IE12GP R_ARM = 111 + R_ARM_PRIVATE_0 R_ARM = 112 + R_ARM_PRIVATE_1 R_ARM = 113 + R_ARM_PRIVATE_2 R_ARM = 114 + R_ARM_PRIVATE_3 R_ARM = 115 + R_ARM_PRIVATE_4 R_ARM = 116 + R_ARM_PRIVATE_5 R_ARM = 117 + R_ARM_PRIVATE_6 R_ARM = 118 + R_ARM_PRIVATE_7 R_ARM = 119 + R_ARM_PRIVATE_8 R_ARM = 120 + R_ARM_PRIVATE_9 R_ARM = 121 + R_ARM_PRIVATE_10 R_ARM = 122 + R_ARM_PRIVATE_11 R_ARM = 123 + R_ARM_PRIVATE_12 R_ARM = 124 + R_ARM_PRIVATE_13 R_ARM = 125 + R_ARM_PRIVATE_14 R_ARM = 126 + R_ARM_PRIVATE_15 R_ARM = 127 + R_ARM_ME_TOO R_ARM = 128 + R_ARM_THM_TLS_DESCSEQ16 R_ARM = 129 + R_ARM_THM_TLS_DESCSEQ32 R_ARM = 130 + R_ARM_THM_GOT_BREL12 R_ARM = 131 + R_ARM_THM_ALU_ABS_G0_NC R_ARM = 132 + R_ARM_THM_ALU_ABS_G1_NC R_ARM = 133 + R_ARM_THM_ALU_ABS_G2_NC R_ARM = 134 + R_ARM_THM_ALU_ABS_G3 R_ARM = 135 + R_ARM_IRELATIVE R_ARM = 160 + R_ARM_RXPC25 R_ARM = 249 + R_ARM_RSBREL32 R_ARM = 250 + R_ARM_THM_RPC22 R_ARM = 251 + R_ARM_RREL32 R_ARM = 252 + R_ARM_RABS32 R_ARM = 253 + R_ARM_RPC24 R_ARM = 254 + R_ARM_RBASE R_ARM = 255 +) + +var rarmStrings = []intName{ + {0, "R_ARM_NONE"}, + {1, "R_ARM_PC24"}, + {2, "R_ARM_ABS32"}, + {3, "R_ARM_REL32"}, + {4, "R_ARM_PC13"}, + {5, "R_ARM_ABS16"}, + {6, "R_ARM_ABS12"}, + {7, "R_ARM_THM_ABS5"}, + {8, "R_ARM_ABS8"}, + {9, "R_ARM_SBREL32"}, + {10, "R_ARM_THM_PC22"}, + {11, "R_ARM_THM_PC8"}, + {12, "R_ARM_AMP_VCALL9"}, + {13, "R_ARM_SWI24"}, + {14, "R_ARM_THM_SWI8"}, + {15, "R_ARM_XPC25"}, + {16, "R_ARM_THM_XPC22"}, + {17, "R_ARM_TLS_DTPMOD32"}, + {18, "R_ARM_TLS_DTPOFF32"}, + {19, "R_ARM_TLS_TPOFF32"}, + {20, "R_ARM_COPY"}, + {21, "R_ARM_GLOB_DAT"}, + {22, "R_ARM_JUMP_SLOT"}, + {23, "R_ARM_RELATIVE"}, + {24, "R_ARM_GOTOFF"}, + {25, "R_ARM_GOTPC"}, + {26, "R_ARM_GOT32"}, + {27, "R_ARM_PLT32"}, + {28, "R_ARM_CALL"}, + {29, "R_ARM_JUMP24"}, + {30, "R_ARM_THM_JUMP24"}, + {31, "R_ARM_BASE_ABS"}, + {32, "R_ARM_ALU_PCREL_7_0"}, + {33, "R_ARM_ALU_PCREL_15_8"}, + {34, "R_ARM_ALU_PCREL_23_15"}, + {35, "R_ARM_LDR_SBREL_11_10_NC"}, + {36, "R_ARM_ALU_SBREL_19_12_NC"}, + {37, "R_ARM_ALU_SBREL_27_20_CK"}, + {38, "R_ARM_TARGET1"}, + {39, "R_ARM_SBREL31"}, + {40, "R_ARM_V4BX"}, + {41, "R_ARM_TARGET2"}, + {42, "R_ARM_PREL31"}, + {43, "R_ARM_MOVW_ABS_NC"}, + {44, "R_ARM_MOVT_ABS"}, + {45, "R_ARM_MOVW_PREL_NC"}, + {46, "R_ARM_MOVT_PREL"}, + {47, "R_ARM_THM_MOVW_ABS_NC"}, + {48, "R_ARM_THM_MOVT_ABS"}, + {49, "R_ARM_THM_MOVW_PREL_NC"}, + {50, "R_ARM_THM_MOVT_PREL"}, + {51, "R_ARM_THM_JUMP19"}, + {52, "R_ARM_THM_JUMP6"}, + {53, "R_ARM_THM_ALU_PREL_11_0"}, + {54, "R_ARM_THM_PC12"}, + {55, "R_ARM_ABS32_NOI"}, + {56, "R_ARM_REL32_NOI"}, + {57, "R_ARM_ALU_PC_G0_NC"}, + {58, "R_ARM_ALU_PC_G0"}, + {59, "R_ARM_ALU_PC_G1_NC"}, + {60, "R_ARM_ALU_PC_G1"}, + {61, "R_ARM_ALU_PC_G2"}, + {62, "R_ARM_LDR_PC_G1"}, + {63, "R_ARM_LDR_PC_G2"}, + {64, "R_ARM_LDRS_PC_G0"}, + {65, "R_ARM_LDRS_PC_G1"}, + {66, "R_ARM_LDRS_PC_G2"}, + {67, "R_ARM_LDC_PC_G0"}, + {68, "R_ARM_LDC_PC_G1"}, + {69, "R_ARM_LDC_PC_G2"}, + {70, "R_ARM_ALU_SB_G0_NC"}, + {71, "R_ARM_ALU_SB_G0"}, + {72, "R_ARM_ALU_SB_G1_NC"}, + {73, "R_ARM_ALU_SB_G1"}, + {74, "R_ARM_ALU_SB_G2"}, + {75, "R_ARM_LDR_SB_G0"}, + {76, "R_ARM_LDR_SB_G1"}, + {77, "R_ARM_LDR_SB_G2"}, + {78, "R_ARM_LDRS_SB_G0"}, + {79, "R_ARM_LDRS_SB_G1"}, + {80, "R_ARM_LDRS_SB_G2"}, + {81, "R_ARM_LDC_SB_G0"}, + {82, "R_ARM_LDC_SB_G1"}, + {83, "R_ARM_LDC_SB_G2"}, + {84, "R_ARM_MOVW_BREL_NC"}, + {85, "R_ARM_MOVT_BREL"}, + {86, "R_ARM_MOVW_BREL"}, + {87, "R_ARM_THM_MOVW_BREL_NC"}, + {88, "R_ARM_THM_MOVT_BREL"}, + {89, "R_ARM_THM_MOVW_BREL"}, + {90, "R_ARM_TLS_GOTDESC"}, + {91, "R_ARM_TLS_CALL"}, + {92, "R_ARM_TLS_DESCSEQ"}, + {93, "R_ARM_THM_TLS_CALL"}, + {94, "R_ARM_PLT32_ABS"}, + {95, "R_ARM_GOT_ABS"}, + {96, "R_ARM_GOT_PREL"}, + {97, "R_ARM_GOT_BREL12"}, + {98, "R_ARM_GOTOFF12"}, + {99, "R_ARM_GOTRELAX"}, + {100, "R_ARM_GNU_VTENTRY"}, + {101, "R_ARM_GNU_VTINHERIT"}, + {102, "R_ARM_THM_JUMP11"}, + {103, "R_ARM_THM_JUMP8"}, + {104, "R_ARM_TLS_GD32"}, + {105, "R_ARM_TLS_LDM32"}, + {106, "R_ARM_TLS_LDO32"}, + {107, "R_ARM_TLS_IE32"}, + {108, "R_ARM_TLS_LE32"}, + {109, "R_ARM_TLS_LDO12"}, + {110, "R_ARM_TLS_LE12"}, + {111, "R_ARM_TLS_IE12GP"}, + {112, "R_ARM_PRIVATE_0"}, + {113, "R_ARM_PRIVATE_1"}, + {114, "R_ARM_PRIVATE_2"}, + {115, "R_ARM_PRIVATE_3"}, + {116, "R_ARM_PRIVATE_4"}, + {117, "R_ARM_PRIVATE_5"}, + {118, "R_ARM_PRIVATE_6"}, + {119, "R_ARM_PRIVATE_7"}, + {120, "R_ARM_PRIVATE_8"}, + {121, "R_ARM_PRIVATE_9"}, + {122, "R_ARM_PRIVATE_10"}, + {123, "R_ARM_PRIVATE_11"}, + {124, "R_ARM_PRIVATE_12"}, + {125, "R_ARM_PRIVATE_13"}, + {126, "R_ARM_PRIVATE_14"}, + {127, "R_ARM_PRIVATE_15"}, + {128, "R_ARM_ME_TOO"}, + {129, "R_ARM_THM_TLS_DESCSEQ16"}, + {130, "R_ARM_THM_TLS_DESCSEQ32"}, + {131, "R_ARM_THM_GOT_BREL12"}, + {132, "R_ARM_THM_ALU_ABS_G0_NC"}, + {133, "R_ARM_THM_ALU_ABS_G1_NC"}, + {134, "R_ARM_THM_ALU_ABS_G2_NC"}, + {135, "R_ARM_THM_ALU_ABS_G3"}, + {160, "R_ARM_IRELATIVE"}, + {249, "R_ARM_RXPC25"}, + {250, "R_ARM_RSBREL32"}, + {251, "R_ARM_THM_RPC22"}, + {252, "R_ARM_RREL32"}, + {253, "R_ARM_RABS32"}, + {254, "R_ARM_RPC24"}, + {255, "R_ARM_RBASE"}, +} + +func (i R_ARM) String() string { return stringName(uint32(i), rarmStrings, false) } +func (i R_ARM) GoString() string { return stringName(uint32(i), rarmStrings, true) } + +// Relocation types for 386. +type R_386 int + +const ( + R_386_NONE R_386 = 0 /* No relocation. */ + R_386_32 R_386 = 1 /* Add symbol value. */ + R_386_PC32 R_386 = 2 /* Add PC-relative symbol value. */ + R_386_GOT32 R_386 = 3 /* Add PC-relative GOT offset. */ + R_386_PLT32 R_386 = 4 /* Add PC-relative PLT offset. */ + R_386_COPY R_386 = 5 /* Copy data from shared object. */ + R_386_GLOB_DAT R_386 = 6 /* Set GOT entry to data address. */ + R_386_JMP_SLOT R_386 = 7 /* Set GOT entry to code address. */ + R_386_RELATIVE R_386 = 8 /* Add load address of shared object. */ + R_386_GOTOFF R_386 = 9 /* Add GOT-relative symbol address. */ + R_386_GOTPC R_386 = 10 /* Add PC-relative GOT table address. */ + R_386_32PLT R_386 = 11 + R_386_TLS_TPOFF R_386 = 14 /* Negative offset in static TLS block */ + R_386_TLS_IE R_386 = 15 /* Absolute address of GOT for -ve static TLS */ + R_386_TLS_GOTIE R_386 = 16 /* GOT entry for negative static TLS block */ + R_386_TLS_LE R_386 = 17 /* Negative offset relative to static TLS */ + R_386_TLS_GD R_386 = 18 /* 32 bit offset to GOT (index,off) pair */ + R_386_TLS_LDM R_386 = 19 /* 32 bit offset to GOT (index,zero) pair */ + R_386_16 R_386 = 20 + R_386_PC16 R_386 = 21 + R_386_8 R_386 = 22 + R_386_PC8 R_386 = 23 + R_386_TLS_GD_32 R_386 = 24 /* 32 bit offset to GOT (index,off) pair */ + R_386_TLS_GD_PUSH R_386 = 25 /* pushl instruction for Sun ABI GD sequence */ + R_386_TLS_GD_CALL R_386 = 26 /* call instruction for Sun ABI GD sequence */ + R_386_TLS_GD_POP R_386 = 27 /* popl instruction for Sun ABI GD sequence */ + R_386_TLS_LDM_32 R_386 = 28 /* 32 bit offset to GOT (index,zero) pair */ + R_386_TLS_LDM_PUSH R_386 = 29 /* pushl instruction for Sun ABI LD sequence */ + R_386_TLS_LDM_CALL R_386 = 30 /* call instruction for Sun ABI LD sequence */ + R_386_TLS_LDM_POP R_386 = 31 /* popl instruction for Sun ABI LD sequence */ + R_386_TLS_LDO_32 R_386 = 32 /* 32 bit offset from start of TLS block */ + R_386_TLS_IE_32 R_386 = 33 /* 32 bit offset to GOT static TLS offset entry */ + R_386_TLS_LE_32 R_386 = 34 /* 32 bit offset within static TLS block */ + R_386_TLS_DTPMOD32 R_386 = 35 /* GOT entry containing TLS index */ + R_386_TLS_DTPOFF32 R_386 = 36 /* GOT entry containing TLS offset */ + R_386_TLS_TPOFF32 R_386 = 37 /* GOT entry of -ve static TLS offset */ + R_386_SIZE32 R_386 = 38 + R_386_TLS_GOTDESC R_386 = 39 + R_386_TLS_DESC_CALL R_386 = 40 + R_386_TLS_DESC R_386 = 41 + R_386_IRELATIVE R_386 = 42 + R_386_GOT32X R_386 = 43 +) + +var r386Strings = []intName{ + {0, "R_386_NONE"}, + {1, "R_386_32"}, + {2, "R_386_PC32"}, + {3, "R_386_GOT32"}, + {4, "R_386_PLT32"}, + {5, "R_386_COPY"}, + {6, "R_386_GLOB_DAT"}, + {7, "R_386_JMP_SLOT"}, + {8, "R_386_RELATIVE"}, + {9, "R_386_GOTOFF"}, + {10, "R_386_GOTPC"}, + {11, "R_386_32PLT"}, + {14, "R_386_TLS_TPOFF"}, + {15, "R_386_TLS_IE"}, + {16, "R_386_TLS_GOTIE"}, + {17, "R_386_TLS_LE"}, + {18, "R_386_TLS_GD"}, + {19, "R_386_TLS_LDM"}, + {20, "R_386_16"}, + {21, "R_386_PC16"}, + {22, "R_386_8"}, + {23, "R_386_PC8"}, + {24, "R_386_TLS_GD_32"}, + {25, "R_386_TLS_GD_PUSH"}, + {26, "R_386_TLS_GD_CALL"}, + {27, "R_386_TLS_GD_POP"}, + {28, "R_386_TLS_LDM_32"}, + {29, "R_386_TLS_LDM_PUSH"}, + {30, "R_386_TLS_LDM_CALL"}, + {31, "R_386_TLS_LDM_POP"}, + {32, "R_386_TLS_LDO_32"}, + {33, "R_386_TLS_IE_32"}, + {34, "R_386_TLS_LE_32"}, + {35, "R_386_TLS_DTPMOD32"}, + {36, "R_386_TLS_DTPOFF32"}, + {37, "R_386_TLS_TPOFF32"}, + {38, "R_386_SIZE32"}, + {39, "R_386_TLS_GOTDESC"}, + {40, "R_386_TLS_DESC_CALL"}, + {41, "R_386_TLS_DESC"}, + {42, "R_386_IRELATIVE"}, + {43, "R_386_GOT32X"}, +} + +func (i R_386) String() string { return stringName(uint32(i), r386Strings, false) } +func (i R_386) GoString() string { return stringName(uint32(i), r386Strings, true) } + +// Relocation types for MIPS. +type R_MIPS int + +const ( + R_MIPS_NONE R_MIPS = 0 + R_MIPS_16 R_MIPS = 1 + R_MIPS_32 R_MIPS = 2 + R_MIPS_REL32 R_MIPS = 3 + R_MIPS_26 R_MIPS = 4 + R_MIPS_HI16 R_MIPS = 5 /* high 16 bits of symbol value */ + R_MIPS_LO16 R_MIPS = 6 /* low 16 bits of symbol value */ + R_MIPS_GPREL16 R_MIPS = 7 /* GP-relative reference */ + R_MIPS_LITERAL R_MIPS = 8 /* Reference to literal section */ + R_MIPS_GOT16 R_MIPS = 9 /* Reference to global offset table */ + R_MIPS_PC16 R_MIPS = 10 /* 16 bit PC relative reference */ + R_MIPS_CALL16 R_MIPS = 11 /* 16 bit call through glbl offset tbl */ + R_MIPS_GPREL32 R_MIPS = 12 + R_MIPS_SHIFT5 R_MIPS = 16 + R_MIPS_SHIFT6 R_MIPS = 17 + R_MIPS_64 R_MIPS = 18 + R_MIPS_GOT_DISP R_MIPS = 19 + R_MIPS_GOT_PAGE R_MIPS = 20 + R_MIPS_GOT_OFST R_MIPS = 21 + R_MIPS_GOT_HI16 R_MIPS = 22 + R_MIPS_GOT_LO16 R_MIPS = 23 + R_MIPS_SUB R_MIPS = 24 + R_MIPS_INSERT_A R_MIPS = 25 + R_MIPS_INSERT_B R_MIPS = 26 + R_MIPS_DELETE R_MIPS = 27 + R_MIPS_HIGHER R_MIPS = 28 + R_MIPS_HIGHEST R_MIPS = 29 + R_MIPS_CALL_HI16 R_MIPS = 30 + R_MIPS_CALL_LO16 R_MIPS = 31 + R_MIPS_SCN_DISP R_MIPS = 32 + R_MIPS_REL16 R_MIPS = 33 + R_MIPS_ADD_IMMEDIATE R_MIPS = 34 + R_MIPS_PJUMP R_MIPS = 35 + R_MIPS_RELGOT R_MIPS = 36 + R_MIPS_JALR R_MIPS = 37 + + R_MIPS_TLS_DTPMOD32 R_MIPS = 38 /* Module number 32 bit */ + R_MIPS_TLS_DTPREL32 R_MIPS = 39 /* Module-relative offset 32 bit */ + R_MIPS_TLS_DTPMOD64 R_MIPS = 40 /* Module number 64 bit */ + R_MIPS_TLS_DTPREL64 R_MIPS = 41 /* Module-relative offset 64 bit */ + R_MIPS_TLS_GD R_MIPS = 42 /* 16 bit GOT offset for GD */ + R_MIPS_TLS_LDM R_MIPS = 43 /* 16 bit GOT offset for LDM */ + R_MIPS_TLS_DTPREL_HI16 R_MIPS = 44 /* Module-relative offset, high 16 bits */ + R_MIPS_TLS_DTPREL_LO16 R_MIPS = 45 /* Module-relative offset, low 16 bits */ + R_MIPS_TLS_GOTTPREL R_MIPS = 46 /* 16 bit GOT offset for IE */ + R_MIPS_TLS_TPREL32 R_MIPS = 47 /* TP-relative offset, 32 bit */ + R_MIPS_TLS_TPREL64 R_MIPS = 48 /* TP-relative offset, 64 bit */ + R_MIPS_TLS_TPREL_HI16 R_MIPS = 49 /* TP-relative offset, high 16 bits */ + R_MIPS_TLS_TPREL_LO16 R_MIPS = 50 /* TP-relative offset, low 16 bits */ +) + +var rmipsStrings = []intName{ + {0, "R_MIPS_NONE"}, + {1, "R_MIPS_16"}, + {2, "R_MIPS_32"}, + {3, "R_MIPS_REL32"}, + {4, "R_MIPS_26"}, + {5, "R_MIPS_HI16"}, + {6, "R_MIPS_LO16"}, + {7, "R_MIPS_GPREL16"}, + {8, "R_MIPS_LITERAL"}, + {9, "R_MIPS_GOT16"}, + {10, "R_MIPS_PC16"}, + {11, "R_MIPS_CALL16"}, + {12, "R_MIPS_GPREL32"}, + {16, "R_MIPS_SHIFT5"}, + {17, "R_MIPS_SHIFT6"}, + {18, "R_MIPS_64"}, + {19, "R_MIPS_GOT_DISP"}, + {20, "R_MIPS_GOT_PAGE"}, + {21, "R_MIPS_GOT_OFST"}, + {22, "R_MIPS_GOT_HI16"}, + {23, "R_MIPS_GOT_LO16"}, + {24, "R_MIPS_SUB"}, + {25, "R_MIPS_INSERT_A"}, + {26, "R_MIPS_INSERT_B"}, + {27, "R_MIPS_DELETE"}, + {28, "R_MIPS_HIGHER"}, + {29, "R_MIPS_HIGHEST"}, + {30, "R_MIPS_CALL_HI16"}, + {31, "R_MIPS_CALL_LO16"}, + {32, "R_MIPS_SCN_DISP"}, + {33, "R_MIPS_REL16"}, + {34, "R_MIPS_ADD_IMMEDIATE"}, + {35, "R_MIPS_PJUMP"}, + {36, "R_MIPS_RELGOT"}, + {37, "R_MIPS_JALR"}, + {38, "R_MIPS_TLS_DTPMOD32"}, + {39, "R_MIPS_TLS_DTPREL32"}, + {40, "R_MIPS_TLS_DTPMOD64"}, + {41, "R_MIPS_TLS_DTPREL64"}, + {42, "R_MIPS_TLS_GD"}, + {43, "R_MIPS_TLS_LDM"}, + {44, "R_MIPS_TLS_DTPREL_HI16"}, + {45, "R_MIPS_TLS_DTPREL_LO16"}, + {46, "R_MIPS_TLS_GOTTPREL"}, + {47, "R_MIPS_TLS_TPREL32"}, + {48, "R_MIPS_TLS_TPREL64"}, + {49, "R_MIPS_TLS_TPREL_HI16"}, + {50, "R_MIPS_TLS_TPREL_LO16"}, +} + +func (i R_MIPS) String() string { return stringName(uint32(i), rmipsStrings, false) } +func (i R_MIPS) GoString() string { return stringName(uint32(i), rmipsStrings, true) } + +// Relocation types for PowerPC. +// +// Values that are shared by both R_PPC and R_PPC64 are prefixed with +// R_POWERPC_ in the ELF standard. For the R_PPC type, the relevant +// shared relocations have been renamed with the prefix R_PPC_. +// The original name follows the value in a comment. +type R_PPC int + +const ( + R_PPC_NONE R_PPC = 0 // R_POWERPC_NONE + R_PPC_ADDR32 R_PPC = 1 // R_POWERPC_ADDR32 + R_PPC_ADDR24 R_PPC = 2 // R_POWERPC_ADDR24 + R_PPC_ADDR16 R_PPC = 3 // R_POWERPC_ADDR16 + R_PPC_ADDR16_LO R_PPC = 4 // R_POWERPC_ADDR16_LO + R_PPC_ADDR16_HI R_PPC = 5 // R_POWERPC_ADDR16_HI + R_PPC_ADDR16_HA R_PPC = 6 // R_POWERPC_ADDR16_HA + R_PPC_ADDR14 R_PPC = 7 // R_POWERPC_ADDR14 + R_PPC_ADDR14_BRTAKEN R_PPC = 8 // R_POWERPC_ADDR14_BRTAKEN + R_PPC_ADDR14_BRNTAKEN R_PPC = 9 // R_POWERPC_ADDR14_BRNTAKEN + R_PPC_REL24 R_PPC = 10 // R_POWERPC_REL24 + R_PPC_REL14 R_PPC = 11 // R_POWERPC_REL14 + R_PPC_REL14_BRTAKEN R_PPC = 12 // R_POWERPC_REL14_BRTAKEN + R_PPC_REL14_BRNTAKEN R_PPC = 13 // R_POWERPC_REL14_BRNTAKEN + R_PPC_GOT16 R_PPC = 14 // R_POWERPC_GOT16 + R_PPC_GOT16_LO R_PPC = 15 // R_POWERPC_GOT16_LO + R_PPC_GOT16_HI R_PPC = 16 // R_POWERPC_GOT16_HI + R_PPC_GOT16_HA R_PPC = 17 // R_POWERPC_GOT16_HA + R_PPC_PLTREL24 R_PPC = 18 + R_PPC_COPY R_PPC = 19 // R_POWERPC_COPY + R_PPC_GLOB_DAT R_PPC = 20 // R_POWERPC_GLOB_DAT + R_PPC_JMP_SLOT R_PPC = 21 // R_POWERPC_JMP_SLOT + R_PPC_RELATIVE R_PPC = 22 // R_POWERPC_RELATIVE + R_PPC_LOCAL24PC R_PPC = 23 + R_PPC_UADDR32 R_PPC = 24 // R_POWERPC_UADDR32 + R_PPC_UADDR16 R_PPC = 25 // R_POWERPC_UADDR16 + R_PPC_REL32 R_PPC = 26 // R_POWERPC_REL32 + R_PPC_PLT32 R_PPC = 27 // R_POWERPC_PLT32 + R_PPC_PLTREL32 R_PPC = 28 // R_POWERPC_PLTREL32 + R_PPC_PLT16_LO R_PPC = 29 // R_POWERPC_PLT16_LO + R_PPC_PLT16_HI R_PPC = 30 // R_POWERPC_PLT16_HI + R_PPC_PLT16_HA R_PPC = 31 // R_POWERPC_PLT16_HA + R_PPC_SDAREL16 R_PPC = 32 + R_PPC_SECTOFF R_PPC = 33 // R_POWERPC_SECTOFF + R_PPC_SECTOFF_LO R_PPC = 34 // R_POWERPC_SECTOFF_LO + R_PPC_SECTOFF_HI R_PPC = 35 // R_POWERPC_SECTOFF_HI + R_PPC_SECTOFF_HA R_PPC = 36 // R_POWERPC_SECTOFF_HA + R_PPC_TLS R_PPC = 67 // R_POWERPC_TLS + R_PPC_DTPMOD32 R_PPC = 68 // R_POWERPC_DTPMOD32 + R_PPC_TPREL16 R_PPC = 69 // R_POWERPC_TPREL16 + R_PPC_TPREL16_LO R_PPC = 70 // R_POWERPC_TPREL16_LO + R_PPC_TPREL16_HI R_PPC = 71 // R_POWERPC_TPREL16_HI + R_PPC_TPREL16_HA R_PPC = 72 // R_POWERPC_TPREL16_HA + R_PPC_TPREL32 R_PPC = 73 // R_POWERPC_TPREL32 + R_PPC_DTPREL16 R_PPC = 74 // R_POWERPC_DTPREL16 + R_PPC_DTPREL16_LO R_PPC = 75 // R_POWERPC_DTPREL16_LO + R_PPC_DTPREL16_HI R_PPC = 76 // R_POWERPC_DTPREL16_HI + R_PPC_DTPREL16_HA R_PPC = 77 // R_POWERPC_DTPREL16_HA + R_PPC_DTPREL32 R_PPC = 78 // R_POWERPC_DTPREL32 + R_PPC_GOT_TLSGD16 R_PPC = 79 // R_POWERPC_GOT_TLSGD16 + R_PPC_GOT_TLSGD16_LO R_PPC = 80 // R_POWERPC_GOT_TLSGD16_LO + R_PPC_GOT_TLSGD16_HI R_PPC = 81 // R_POWERPC_GOT_TLSGD16_HI + R_PPC_GOT_TLSGD16_HA R_PPC = 82 // R_POWERPC_GOT_TLSGD16_HA + R_PPC_GOT_TLSLD16 R_PPC = 83 // R_POWERPC_GOT_TLSLD16 + R_PPC_GOT_TLSLD16_LO R_PPC = 84 // R_POWERPC_GOT_TLSLD16_LO + R_PPC_GOT_TLSLD16_HI R_PPC = 85 // R_POWERPC_GOT_TLSLD16_HI + R_PPC_GOT_TLSLD16_HA R_PPC = 86 // R_POWERPC_GOT_TLSLD16_HA + R_PPC_GOT_TPREL16 R_PPC = 87 // R_POWERPC_GOT_TPREL16 + R_PPC_GOT_TPREL16_LO R_PPC = 88 // R_POWERPC_GOT_TPREL16_LO + R_PPC_GOT_TPREL16_HI R_PPC = 89 // R_POWERPC_GOT_TPREL16_HI + R_PPC_GOT_TPREL16_HA R_PPC = 90 // R_POWERPC_GOT_TPREL16_HA + R_PPC_EMB_NADDR32 R_PPC = 101 + R_PPC_EMB_NADDR16 R_PPC = 102 + R_PPC_EMB_NADDR16_LO R_PPC = 103 + R_PPC_EMB_NADDR16_HI R_PPC = 104 + R_PPC_EMB_NADDR16_HA R_PPC = 105 + R_PPC_EMB_SDAI16 R_PPC = 106 + R_PPC_EMB_SDA2I16 R_PPC = 107 + R_PPC_EMB_SDA2REL R_PPC = 108 + R_PPC_EMB_SDA21 R_PPC = 109 + R_PPC_EMB_MRKREF R_PPC = 110 + R_PPC_EMB_RELSEC16 R_PPC = 111 + R_PPC_EMB_RELST_LO R_PPC = 112 + R_PPC_EMB_RELST_HI R_PPC = 113 + R_PPC_EMB_RELST_HA R_PPC = 114 + R_PPC_EMB_BIT_FLD R_PPC = 115 + R_PPC_EMB_RELSDA R_PPC = 116 +) + +var rppcStrings = []intName{ + {0, "R_PPC_NONE"}, + {1, "R_PPC_ADDR32"}, + {2, "R_PPC_ADDR24"}, + {3, "R_PPC_ADDR16"}, + {4, "R_PPC_ADDR16_LO"}, + {5, "R_PPC_ADDR16_HI"}, + {6, "R_PPC_ADDR16_HA"}, + {7, "R_PPC_ADDR14"}, + {8, "R_PPC_ADDR14_BRTAKEN"}, + {9, "R_PPC_ADDR14_BRNTAKEN"}, + {10, "R_PPC_REL24"}, + {11, "R_PPC_REL14"}, + {12, "R_PPC_REL14_BRTAKEN"}, + {13, "R_PPC_REL14_BRNTAKEN"}, + {14, "R_PPC_GOT16"}, + {15, "R_PPC_GOT16_LO"}, + {16, "R_PPC_GOT16_HI"}, + {17, "R_PPC_GOT16_HA"}, + {18, "R_PPC_PLTREL24"}, + {19, "R_PPC_COPY"}, + {20, "R_PPC_GLOB_DAT"}, + {21, "R_PPC_JMP_SLOT"}, + {22, "R_PPC_RELATIVE"}, + {23, "R_PPC_LOCAL24PC"}, + {24, "R_PPC_UADDR32"}, + {25, "R_PPC_UADDR16"}, + {26, "R_PPC_REL32"}, + {27, "R_PPC_PLT32"}, + {28, "R_PPC_PLTREL32"}, + {29, "R_PPC_PLT16_LO"}, + {30, "R_PPC_PLT16_HI"}, + {31, "R_PPC_PLT16_HA"}, + {32, "R_PPC_SDAREL16"}, + {33, "R_PPC_SECTOFF"}, + {34, "R_PPC_SECTOFF_LO"}, + {35, "R_PPC_SECTOFF_HI"}, + {36, "R_PPC_SECTOFF_HA"}, + {67, "R_PPC_TLS"}, + {68, "R_PPC_DTPMOD32"}, + {69, "R_PPC_TPREL16"}, + {70, "R_PPC_TPREL16_LO"}, + {71, "R_PPC_TPREL16_HI"}, + {72, "R_PPC_TPREL16_HA"}, + {73, "R_PPC_TPREL32"}, + {74, "R_PPC_DTPREL16"}, + {75, "R_PPC_DTPREL16_LO"}, + {76, "R_PPC_DTPREL16_HI"}, + {77, "R_PPC_DTPREL16_HA"}, + {78, "R_PPC_DTPREL32"}, + {79, "R_PPC_GOT_TLSGD16"}, + {80, "R_PPC_GOT_TLSGD16_LO"}, + {81, "R_PPC_GOT_TLSGD16_HI"}, + {82, "R_PPC_GOT_TLSGD16_HA"}, + {83, "R_PPC_GOT_TLSLD16"}, + {84, "R_PPC_GOT_TLSLD16_LO"}, + {85, "R_PPC_GOT_TLSLD16_HI"}, + {86, "R_PPC_GOT_TLSLD16_HA"}, + {87, "R_PPC_GOT_TPREL16"}, + {88, "R_PPC_GOT_TPREL16_LO"}, + {89, "R_PPC_GOT_TPREL16_HI"}, + {90, "R_PPC_GOT_TPREL16_HA"}, + {101, "R_PPC_EMB_NADDR32"}, + {102, "R_PPC_EMB_NADDR16"}, + {103, "R_PPC_EMB_NADDR16_LO"}, + {104, "R_PPC_EMB_NADDR16_HI"}, + {105, "R_PPC_EMB_NADDR16_HA"}, + {106, "R_PPC_EMB_SDAI16"}, + {107, "R_PPC_EMB_SDA2I16"}, + {108, "R_PPC_EMB_SDA2REL"}, + {109, "R_PPC_EMB_SDA21"}, + {110, "R_PPC_EMB_MRKREF"}, + {111, "R_PPC_EMB_RELSEC16"}, + {112, "R_PPC_EMB_RELST_LO"}, + {113, "R_PPC_EMB_RELST_HI"}, + {114, "R_PPC_EMB_RELST_HA"}, + {115, "R_PPC_EMB_BIT_FLD"}, + {116, "R_PPC_EMB_RELSDA"}, +} + +func (i R_PPC) String() string { return stringName(uint32(i), rppcStrings, false) } +func (i R_PPC) GoString() string { return stringName(uint32(i), rppcStrings, true) } + +// Relocation types for 64-bit PowerPC or Power Architecture processors. +// +// Values that are shared by both R_PPC and R_PPC64 are prefixed with +// R_POWERPC_ in the ELF standard. For the R_PPC64 type, the relevant +// shared relocations have been renamed with the prefix R_PPC64_. +// The original name follows the value in a comment. +type R_PPC64 int + +const ( + R_PPC64_NONE R_PPC64 = 0 // R_POWERPC_NONE + R_PPC64_ADDR32 R_PPC64 = 1 // R_POWERPC_ADDR32 + R_PPC64_ADDR24 R_PPC64 = 2 // R_POWERPC_ADDR24 + R_PPC64_ADDR16 R_PPC64 = 3 // R_POWERPC_ADDR16 + R_PPC64_ADDR16_LO R_PPC64 = 4 // R_POWERPC_ADDR16_LO + R_PPC64_ADDR16_HI R_PPC64 = 5 // R_POWERPC_ADDR16_HI + R_PPC64_ADDR16_HA R_PPC64 = 6 // R_POWERPC_ADDR16_HA + R_PPC64_ADDR14 R_PPC64 = 7 // R_POWERPC_ADDR14 + R_PPC64_ADDR14_BRTAKEN R_PPC64 = 8 // R_POWERPC_ADDR14_BRTAKEN + R_PPC64_ADDR14_BRNTAKEN R_PPC64 = 9 // R_POWERPC_ADDR14_BRNTAKEN + R_PPC64_REL24 R_PPC64 = 10 // R_POWERPC_REL24 + R_PPC64_REL14 R_PPC64 = 11 // R_POWERPC_REL14 + R_PPC64_REL14_BRTAKEN R_PPC64 = 12 // R_POWERPC_REL14_BRTAKEN + R_PPC64_REL14_BRNTAKEN R_PPC64 = 13 // R_POWERPC_REL14_BRNTAKEN + R_PPC64_GOT16 R_PPC64 = 14 // R_POWERPC_GOT16 + R_PPC64_GOT16_LO R_PPC64 = 15 // R_POWERPC_GOT16_LO + R_PPC64_GOT16_HI R_PPC64 = 16 // R_POWERPC_GOT16_HI + R_PPC64_GOT16_HA R_PPC64 = 17 // R_POWERPC_GOT16_HA + R_PPC64_JMP_SLOT R_PPC64 = 21 // R_POWERPC_JMP_SLOT + R_PPC64_REL32 R_PPC64 = 26 // R_POWERPC_REL32 + R_PPC64_ADDR64 R_PPC64 = 38 + R_PPC64_ADDR16_HIGHER R_PPC64 = 39 + R_PPC64_ADDR16_HIGHERA R_PPC64 = 40 + R_PPC64_ADDR16_HIGHEST R_PPC64 = 41 + R_PPC64_ADDR16_HIGHESTA R_PPC64 = 42 + R_PPC64_REL64 R_PPC64 = 44 + R_PPC64_TOC16 R_PPC64 = 47 + R_PPC64_TOC16_LO R_PPC64 = 48 + R_PPC64_TOC16_HI R_PPC64 = 49 + R_PPC64_TOC16_HA R_PPC64 = 50 + R_PPC64_TOC R_PPC64 = 51 + R_PPC64_PLTGOT16 R_PPC64 = 52 + R_PPC64_PLTGOT16_LO R_PPC64 = 53 + R_PPC64_PLTGOT16_HI R_PPC64 = 54 + R_PPC64_PLTGOT16_HA R_PPC64 = 55 + R_PPC64_ADDR16_DS R_PPC64 = 56 + R_PPC64_ADDR16_LO_DS R_PPC64 = 57 + R_PPC64_GOT16_DS R_PPC64 = 58 + R_PPC64_GOT16_LO_DS R_PPC64 = 59 + R_PPC64_PLT16_LO_DS R_PPC64 = 60 + R_PPC64_SECTOFF_DS R_PPC64 = 61 + R_PPC64_SECTOFF_LO_DS R_PPC64 = 61 + R_PPC64_TOC16_DS R_PPC64 = 63 + R_PPC64_TOC16_LO_DS R_PPC64 = 64 + R_PPC64_PLTGOT16_DS R_PPC64 = 65 + R_PPC64_PLTGOT_LO_DS R_PPC64 = 66 + R_PPC64_TLS R_PPC64 = 67 // R_POWERPC_TLS + R_PPC64_DTPMOD64 R_PPC64 = 68 // R_POWERPC_DTPMOD64 + R_PPC64_TPREL16 R_PPC64 = 69 // R_POWERPC_TPREL16 + R_PPC64_TPREL16_LO R_PPC64 = 70 // R_POWERPC_TPREL16_LO + R_PPC64_TPREL16_HI R_PPC64 = 71 // R_POWERPC_TPREL16_HI + R_PPC64_TPREL16_HA R_PPC64 = 72 // R_POWERPC_TPREL16_HA + R_PPC64_TPREL64 R_PPC64 = 73 // R_POWERPC_TPREL64 + R_PPC64_DTPREL16 R_PPC64 = 74 // R_POWERPC_DTPREL16 + R_PPC64_DTPREL16_LO R_PPC64 = 75 // R_POWERPC_DTPREL16_LO + R_PPC64_DTPREL16_HI R_PPC64 = 76 // R_POWERPC_DTPREL16_HI + R_PPC64_DTPREL16_HA R_PPC64 = 77 // R_POWERPC_DTPREL16_HA + R_PPC64_DTPREL64 R_PPC64 = 78 // R_POWERPC_DTPREL64 + R_PPC64_GOT_TLSGD16 R_PPC64 = 79 // R_POWERPC_GOT_TLSGD16 + R_PPC64_GOT_TLSGD16_LO R_PPC64 = 80 // R_POWERPC_GOT_TLSGD16_LO + R_PPC64_GOT_TLSGD16_HI R_PPC64 = 81 // R_POWERPC_GOT_TLSGD16_HI + R_PPC64_GOT_TLSGD16_HA R_PPC64 = 82 // R_POWERPC_GOT_TLSGD16_HA + R_PPC64_GOT_TLSLD16 R_PPC64 = 83 // R_POWERPC_GOT_TLSLD16 + R_PPC64_GOT_TLSLD16_LO R_PPC64 = 84 // R_POWERPC_GOT_TLSLD16_LO + R_PPC64_GOT_TLSLD16_HI R_PPC64 = 85 // R_POWERPC_GOT_TLSLD16_HI + R_PPC64_GOT_TLSLD16_HA R_PPC64 = 86 // R_POWERPC_GOT_TLSLD16_HA + R_PPC64_GOT_TPREL16_DS R_PPC64 = 87 // R_POWERPC_GOT_TPREL16_DS + R_PPC64_GOT_TPREL16_LO_DS R_PPC64 = 88 // R_POWERPC_GOT_TPREL16_LO_DS + R_PPC64_GOT_TPREL16_HI R_PPC64 = 89 // R_POWERPC_GOT_TPREL16_HI + R_PPC64_GOT_TPREL16_HA R_PPC64 = 90 // R_POWERPC_GOT_TPREL16_HA + R_PPC64_GOT_DTPREL16_DS R_PPC64 = 91 // R_POWERPC_GOT_DTPREL16_DS + R_PPC64_GOT_DTPREL16_LO_DS R_PPC64 = 92 // R_POWERPC_GOT_DTPREL16_LO_DS + R_PPC64_GOT_DTPREL16_HI R_PPC64 = 93 // R_POWERPC_GOT_DTPREL16_HI + R_PPC64_GOT_DTPREL16_HA R_PPC64 = 94 // R_POWERPC_GOT_DTPREL16_HA + R_PPC64_TPREL16_DS R_PPC64 = 95 + R_PPC64_TPREL16_LO_DS R_PPC64 = 96 + R_PPC64_TPREL16_HIGHER R_PPC64 = 97 + R_PPC64_TPREL16_HIGHERA R_PPC64 = 98 + R_PPC64_TPREL16_HIGHEST R_PPC64 = 99 + R_PPC64_TPREL16_HIGHESTA R_PPC64 = 100 + R_PPC64_DTPREL16_DS R_PPC64 = 101 + R_PPC64_DTPREL16_LO_DS R_PPC64 = 102 + R_PPC64_DTPREL16_HIGHER R_PPC64 = 103 + R_PPC64_DTPREL16_HIGHERA R_PPC64 = 104 + R_PPC64_DTPREL16_HIGHEST R_PPC64 = 105 + R_PPC64_DTPREL16_HIGHESTA R_PPC64 = 106 + R_PPC64_TLSGD R_PPC64 = 107 + R_PPC64_TLSLD R_PPC64 = 108 + R_PPC64_TOCSAVE R_PPC64 = 109 + R_PPC64_ADDR16_HIGH R_PPC64 = 110 + R_PPC64_ADDR16_HIGHA R_PPC64 = 111 + R_PPC64_TPREL16_HIGH R_PPC64 = 112 + R_PPC64_TPREL16_HIGHA R_PPC64 = 113 + R_PPC64_DTPREL16_HIGH R_PPC64 = 114 + R_PPC64_DTPREL16_HIGHA R_PPC64 = 115 + R_PPC64_REL24_NOTOC R_PPC64 = 116 + R_PPC64_ADDR64_LOCAL R_PPC64 = 117 + R_PPC64_ENTRY R_PPC64 = 118 + R_PPC64_REL16DX_HA R_PPC64 = 246 // R_POWERPC_REL16DX_HA + R_PPC64_JMP_IREL R_PPC64 = 247 + R_PPC64_IRELATIVE R_PPC64 = 248 // R_POWERPC_IRELATIVE + R_PPC64_REL16 R_PPC64 = 249 // R_POWERPC_REL16 + R_PPC64_REL16_LO R_PPC64 = 250 // R_POWERPC_REL16_LO + R_PPC64_REL16_HI R_PPC64 = 251 // R_POWERPC_REL16_HI + R_PPC64_REL16_HA R_PPC64 = 252 // R_POWERPC_REL16_HA +) + +var rppc64Strings = []intName{ + {0, "R_PPC64_NONE"}, + {1, "R_PPC64_ADDR32"}, + {2, "R_PPC64_ADDR24"}, + {3, "R_PPC64_ADDR16"}, + {4, "R_PPC64_ADDR16_LO"}, + {5, "R_PPC64_ADDR16_HI"}, + {6, "R_PPC64_ADDR16_HA"}, + {7, "R_PPC64_ADDR14"}, + {8, "R_PPC64_ADDR14_BRTAKEN"}, + {9, "R_PPC64_ADDR14_BRNTAKEN"}, + {10, "R_PPC64_REL24"}, + {11, "R_PPC64_REL14"}, + {12, "R_PPC64_REL14_BRTAKEN"}, + {13, "R_PPC64_REL14_BRNTAKEN"}, + {14, "R_PPC64_GOT16"}, + {15, "R_PPC64_GOT16_LO"}, + {16, "R_PPC64_GOT16_HI"}, + {17, "R_PPC64_GOT16_HA"}, + {21, "R_PPC64_JMP_SLOT"}, + {26, "R_PPC64_REL32"}, + {38, "R_PPC64_ADDR64"}, + {39, "R_PPC64_ADDR16_HIGHER"}, + {40, "R_PPC64_ADDR16_HIGHERA"}, + {41, "R_PPC64_ADDR16_HIGHEST"}, + {42, "R_PPC64_ADDR16_HIGHESTA"}, + {44, "R_PPC64_REL64"}, + {47, "R_PPC64_TOC16"}, + {48, "R_PPC64_TOC16_LO"}, + {49, "R_PPC64_TOC16_HI"}, + {50, "R_PPC64_TOC16_HA"}, + {51, "R_PPC64_TOC"}, + {52, "R_PPC64_PLTGOT16"}, + {53, "R_PPC64_PLTGOT16_LO"}, + {54, "R_PPC64_PLTGOT16_HI"}, + {55, "R_PPC64_PLTGOT16_HA"}, + {56, "R_PPC64_ADDR16_DS"}, + {57, "R_PPC64_ADDR16_LO_DS"}, + {58, "R_PPC64_GOT16_DS"}, + {59, "R_PPC64_GOT16_LO_DS"}, + {60, "R_PPC64_PLT16_LO_DS"}, + {61, "R_PPC64_SECTOFF_DS"}, + {61, "R_PPC64_SECTOFF_LO_DS"}, + {63, "R_PPC64_TOC16_DS"}, + {64, "R_PPC64_TOC16_LO_DS"}, + {65, "R_PPC64_PLTGOT16_DS"}, + {66, "R_PPC64_PLTGOT_LO_DS"}, + {67, "R_PPC64_TLS"}, + {68, "R_PPC64_DTPMOD64"}, + {69, "R_PPC64_TPREL16"}, + {70, "R_PPC64_TPREL16_LO"}, + {71, "R_PPC64_TPREL16_HI"}, + {72, "R_PPC64_TPREL16_HA"}, + {73, "R_PPC64_TPREL64"}, + {74, "R_PPC64_DTPREL16"}, + {75, "R_PPC64_DTPREL16_LO"}, + {76, "R_PPC64_DTPREL16_HI"}, + {77, "R_PPC64_DTPREL16_HA"}, + {78, "R_PPC64_DTPREL64"}, + {79, "R_PPC64_GOT_TLSGD16"}, + {80, "R_PPC64_GOT_TLSGD16_LO"}, + {81, "R_PPC64_GOT_TLSGD16_HI"}, + {82, "R_PPC64_GOT_TLSGD16_HA"}, + {83, "R_PPC64_GOT_TLSLD16"}, + {84, "R_PPC64_GOT_TLSLD16_LO"}, + {85, "R_PPC64_GOT_TLSLD16_HI"}, + {86, "R_PPC64_GOT_TLSLD16_HA"}, + {87, "R_PPC64_GOT_TPREL16_DS"}, + {88, "R_PPC64_GOT_TPREL16_LO_DS"}, + {89, "R_PPC64_GOT_TPREL16_HI"}, + {90, "R_PPC64_GOT_TPREL16_HA"}, + {91, "R_PPC64_GOT_DTPREL16_DS"}, + {92, "R_PPC64_GOT_DTPREL16_LO_DS"}, + {93, "R_PPC64_GOT_DTPREL16_HI"}, + {94, "R_PPC64_GOT_DTPREL16_HA"}, + {95, "R_PPC64_TPREL16_DS"}, + {96, "R_PPC64_TPREL16_LO_DS"}, + {97, "R_PPC64_TPREL16_HIGHER"}, + {98, "R_PPC64_TPREL16_HIGHERA"}, + {99, "R_PPC64_TPREL16_HIGHEST"}, + {100, "R_PPC64_TPREL16_HIGHESTA"}, + {101, "R_PPC64_DTPREL16_DS"}, + {102, "R_PPC64_DTPREL16_LO_DS"}, + {103, "R_PPC64_DTPREL16_HIGHER"}, + {104, "R_PPC64_DTPREL16_HIGHERA"}, + {105, "R_PPC64_DTPREL16_HIGHEST"}, + {106, "R_PPC64_DTPREL16_HIGHESTA"}, + {107, "R_PPC64_TLSGD"}, + {108, "R_PPC64_TLSLD"}, + {109, "R_PPC64_TOCSAVE"}, + {110, "R_PPC64_ADDR16_HIGH"}, + {111, "R_PPC64_ADDR16_HIGHA"}, + {112, "R_PPC64_TPREL16_HIGH"}, + {113, "R_PPC64_TPREL16_HIGHA"}, + {114, "R_PPC64_DTPREL16_HIGH"}, + {115, "R_PPC64_DTPREL16_HIGHA"}, + {116, "R_PPC64_REL24_NOTOC"}, + {117, "R_PPC64_ADDR64_LOCAL"}, + {118, "R_PPC64_ENTRY"}, + {246, "R_PPC64_REL16DX_HA"}, + {247, "R_PPC64_JMP_IREL"}, + {248, "R_PPC64_IRELATIVE"}, + {249, "R_PPC64_REL16"}, + {250, "R_PPC64_REL16_LO"}, + {251, "R_PPC64_REL16_HI"}, + {252, "R_PPC64_REL16_HA"}, +} + +func (i R_PPC64) String() string { return stringName(uint32(i), rppc64Strings, false) } +func (i R_PPC64) GoString() string { return stringName(uint32(i), rppc64Strings, true) } + +// Relocation types for RISC-V processors. +type R_RISCV int + +const ( + R_RISCV_NONE R_RISCV = 0 /* No relocation. */ + R_RISCV_32 R_RISCV = 1 /* Add 32 bit zero extended symbol value */ + R_RISCV_64 R_RISCV = 2 /* Add 64 bit symbol value. */ + R_RISCV_RELATIVE R_RISCV = 3 /* Add load address of shared object. */ + R_RISCV_COPY R_RISCV = 4 /* Copy data from shared object. */ + R_RISCV_JUMP_SLOT R_RISCV = 5 /* Set GOT entry to code address. */ + R_RISCV_TLS_DTPMOD32 R_RISCV = 6 /* 32 bit ID of module containing symbol */ + R_RISCV_TLS_DTPMOD64 R_RISCV = 7 /* ID of module containing symbol */ + R_RISCV_TLS_DTPREL32 R_RISCV = 8 /* 32 bit relative offset in TLS block */ + R_RISCV_TLS_DTPREL64 R_RISCV = 9 /* Relative offset in TLS block */ + R_RISCV_TLS_TPREL32 R_RISCV = 10 /* 32 bit relative offset in static TLS block */ + R_RISCV_TLS_TPREL64 R_RISCV = 11 /* Relative offset in static TLS block */ + R_RISCV_BRANCH R_RISCV = 16 /* PC-relative branch */ + R_RISCV_JAL R_RISCV = 17 /* PC-relative jump */ + R_RISCV_CALL R_RISCV = 18 /* PC-relative call */ + R_RISCV_CALL_PLT R_RISCV = 19 /* PC-relative call (PLT) */ + R_RISCV_GOT_HI20 R_RISCV = 20 /* PC-relative GOT reference */ + R_RISCV_TLS_GOT_HI20 R_RISCV = 21 /* PC-relative TLS IE GOT offset */ + R_RISCV_TLS_GD_HI20 R_RISCV = 22 /* PC-relative TLS GD reference */ + R_RISCV_PCREL_HI20 R_RISCV = 23 /* PC-relative reference */ + R_RISCV_PCREL_LO12_I R_RISCV = 24 /* PC-relative reference */ + R_RISCV_PCREL_LO12_S R_RISCV = 25 /* PC-relative reference */ + R_RISCV_HI20 R_RISCV = 26 /* Absolute address */ + R_RISCV_LO12_I R_RISCV = 27 /* Absolute address */ + R_RISCV_LO12_S R_RISCV = 28 /* Absolute address */ + R_RISCV_TPREL_HI20 R_RISCV = 29 /* TLS LE thread offset */ + R_RISCV_TPREL_LO12_I R_RISCV = 30 /* TLS LE thread offset */ + R_RISCV_TPREL_LO12_S R_RISCV = 31 /* TLS LE thread offset */ + R_RISCV_TPREL_ADD R_RISCV = 32 /* TLS LE thread usage */ + R_RISCV_ADD8 R_RISCV = 33 /* 8-bit label addition */ + R_RISCV_ADD16 R_RISCV = 34 /* 16-bit label addition */ + R_RISCV_ADD32 R_RISCV = 35 /* 32-bit label addition */ + R_RISCV_ADD64 R_RISCV = 36 /* 64-bit label addition */ + R_RISCV_SUB8 R_RISCV = 37 /* 8-bit label subtraction */ + R_RISCV_SUB16 R_RISCV = 38 /* 16-bit label subtraction */ + R_RISCV_SUB32 R_RISCV = 39 /* 32-bit label subtraction */ + R_RISCV_SUB64 R_RISCV = 40 /* 64-bit label subtraction */ + R_RISCV_GNU_VTINHERIT R_RISCV = 41 /* GNU C++ vtable hierarchy */ + R_RISCV_GNU_VTENTRY R_RISCV = 42 /* GNU C++ vtable member usage */ + R_RISCV_ALIGN R_RISCV = 43 /* Alignment statement */ + R_RISCV_RVC_BRANCH R_RISCV = 44 /* PC-relative branch offset */ + R_RISCV_RVC_JUMP R_RISCV = 45 /* PC-relative jump offset */ + R_RISCV_RVC_LUI R_RISCV = 46 /* Absolute address */ + R_RISCV_GPREL_I R_RISCV = 47 /* GP-relative reference */ + R_RISCV_GPREL_S R_RISCV = 48 /* GP-relative reference */ + R_RISCV_TPREL_I R_RISCV = 49 /* TP-relative TLS LE load */ + R_RISCV_TPREL_S R_RISCV = 50 /* TP-relative TLS LE store */ + R_RISCV_RELAX R_RISCV = 51 /* Instruction pair can be relaxed */ + R_RISCV_SUB6 R_RISCV = 52 /* Local label subtraction */ + R_RISCV_SET6 R_RISCV = 53 /* Local label subtraction */ + R_RISCV_SET8 R_RISCV = 54 /* Local label subtraction */ + R_RISCV_SET16 R_RISCV = 55 /* Local label subtraction */ + R_RISCV_SET32 R_RISCV = 56 /* Local label subtraction */ +) + +var rriscvStrings = []intName{ + {0, "R_RISCV_NONE"}, + {1, "R_RISCV_32"}, + {2, "R_RISCV_64"}, + {3, "R_RISCV_RELATIVE"}, + {4, "R_RISCV_COPY"}, + {5, "R_RISCV_JUMP_SLOT"}, + {6, "R_RISCV_TLS_DTPMOD32"}, + {7, "R_RISCV_TLS_DTPMOD64"}, + {8, "R_RISCV_TLS_DTPREL32"}, + {9, "R_RISCV_TLS_DTPREL64"}, + {10, "R_RISCV_TLS_TPREL32"}, + {11, "R_RISCV_TLS_TPREL64"}, + {16, "R_RISCV_BRANCH"}, + {17, "R_RISCV_JAL"}, + {18, "R_RISCV_CALL"}, + {19, "R_RISCV_CALL_PLT"}, + {20, "R_RISCV_GOT_HI20"}, + {21, "R_RISCV_TLS_GOT_HI20"}, + {22, "R_RISCV_TLS_GD_HI20"}, + {23, "R_RISCV_PCREL_HI20"}, + {24, "R_RISCV_PCREL_LO12_I"}, + {25, "R_RISCV_PCREL_LO12_S"}, + {26, "R_RISCV_HI20"}, + {27, "R_RISCV_LO12_I"}, + {28, "R_RISCV_LO12_S"}, + {29, "R_RISCV_TPREL_HI20"}, + {30, "R_RISCV_TPREL_LO12_I"}, + {31, "R_RISCV_TPREL_LO12_S"}, + {32, "R_RISCV_TPREL_ADD"}, + {33, "R_RISCV_ADD8"}, + {34, "R_RISCV_ADD16"}, + {35, "R_RISCV_ADD32"}, + {36, "R_RISCV_ADD64"}, + {37, "R_RISCV_SUB8"}, + {38, "R_RISCV_SUB16"}, + {39, "R_RISCV_SUB32"}, + {40, "R_RISCV_SUB64"}, + {41, "R_RISCV_GNU_VTINHERIT"}, + {42, "R_RISCV_GNU_VTENTRY"}, + {43, "R_RISCV_ALIGN"}, + {44, "R_RISCV_RVC_BRANCH"}, + {45, "R_RISCV_RVC_JUMP"}, + {46, "R_RISCV_RVC_LUI"}, + {47, "R_RISCV_GPREL_I"}, + {48, "R_RISCV_GPREL_S"}, + {49, "R_RISCV_TPREL_I"}, + {50, "R_RISCV_TPREL_S"}, + {51, "R_RISCV_RELAX"}, + {52, "R_RISCV_SUB6"}, + {53, "R_RISCV_SET6"}, + {54, "R_RISCV_SET8"}, + {55, "R_RISCV_SET16"}, + {56, "R_RISCV_SET32"}, +} + +func (i R_RISCV) String() string { return stringName(uint32(i), rriscvStrings, false) } +func (i R_RISCV) GoString() string { return stringName(uint32(i), rriscvStrings, true) } + +// Relocation types for s390x processors. +type R_390 int + +const ( + R_390_NONE R_390 = 0 + R_390_8 R_390 = 1 + R_390_12 R_390 = 2 + R_390_16 R_390 = 3 + R_390_32 R_390 = 4 + R_390_PC32 R_390 = 5 + R_390_GOT12 R_390 = 6 + R_390_GOT32 R_390 = 7 + R_390_PLT32 R_390 = 8 + R_390_COPY R_390 = 9 + R_390_GLOB_DAT R_390 = 10 + R_390_JMP_SLOT R_390 = 11 + R_390_RELATIVE R_390 = 12 + R_390_GOTOFF R_390 = 13 + R_390_GOTPC R_390 = 14 + R_390_GOT16 R_390 = 15 + R_390_PC16 R_390 = 16 + R_390_PC16DBL R_390 = 17 + R_390_PLT16DBL R_390 = 18 + R_390_PC32DBL R_390 = 19 + R_390_PLT32DBL R_390 = 20 + R_390_GOTPCDBL R_390 = 21 + R_390_64 R_390 = 22 + R_390_PC64 R_390 = 23 + R_390_GOT64 R_390 = 24 + R_390_PLT64 R_390 = 25 + R_390_GOTENT R_390 = 26 + R_390_GOTOFF16 R_390 = 27 + R_390_GOTOFF64 R_390 = 28 + R_390_GOTPLT12 R_390 = 29 + R_390_GOTPLT16 R_390 = 30 + R_390_GOTPLT32 R_390 = 31 + R_390_GOTPLT64 R_390 = 32 + R_390_GOTPLTENT R_390 = 33 + R_390_GOTPLTOFF16 R_390 = 34 + R_390_GOTPLTOFF32 R_390 = 35 + R_390_GOTPLTOFF64 R_390 = 36 + R_390_TLS_LOAD R_390 = 37 + R_390_TLS_GDCALL R_390 = 38 + R_390_TLS_LDCALL R_390 = 39 + R_390_TLS_GD32 R_390 = 40 + R_390_TLS_GD64 R_390 = 41 + R_390_TLS_GOTIE12 R_390 = 42 + R_390_TLS_GOTIE32 R_390 = 43 + R_390_TLS_GOTIE64 R_390 = 44 + R_390_TLS_LDM32 R_390 = 45 + R_390_TLS_LDM64 R_390 = 46 + R_390_TLS_IE32 R_390 = 47 + R_390_TLS_IE64 R_390 = 48 + R_390_TLS_IEENT R_390 = 49 + R_390_TLS_LE32 R_390 = 50 + R_390_TLS_LE64 R_390 = 51 + R_390_TLS_LDO32 R_390 = 52 + R_390_TLS_LDO64 R_390 = 53 + R_390_TLS_DTPMOD R_390 = 54 + R_390_TLS_DTPOFF R_390 = 55 + R_390_TLS_TPOFF R_390 = 56 + R_390_20 R_390 = 57 + R_390_GOT20 R_390 = 58 + R_390_GOTPLT20 R_390 = 59 + R_390_TLS_GOTIE20 R_390 = 60 +) + +var r390Strings = []intName{ + {0, "R_390_NONE"}, + {1, "R_390_8"}, + {2, "R_390_12"}, + {3, "R_390_16"}, + {4, "R_390_32"}, + {5, "R_390_PC32"}, + {6, "R_390_GOT12"}, + {7, "R_390_GOT32"}, + {8, "R_390_PLT32"}, + {9, "R_390_COPY"}, + {10, "R_390_GLOB_DAT"}, + {11, "R_390_JMP_SLOT"}, + {12, "R_390_RELATIVE"}, + {13, "R_390_GOTOFF"}, + {14, "R_390_GOTPC"}, + {15, "R_390_GOT16"}, + {16, "R_390_PC16"}, + {17, "R_390_PC16DBL"}, + {18, "R_390_PLT16DBL"}, + {19, "R_390_PC32DBL"}, + {20, "R_390_PLT32DBL"}, + {21, "R_390_GOTPCDBL"}, + {22, "R_390_64"}, + {23, "R_390_PC64"}, + {24, "R_390_GOT64"}, + {25, "R_390_PLT64"}, + {26, "R_390_GOTENT"}, + {27, "R_390_GOTOFF16"}, + {28, "R_390_GOTOFF64"}, + {29, "R_390_GOTPLT12"}, + {30, "R_390_GOTPLT16"}, + {31, "R_390_GOTPLT32"}, + {32, "R_390_GOTPLT64"}, + {33, "R_390_GOTPLTENT"}, + {34, "R_390_GOTPLTOFF16"}, + {35, "R_390_GOTPLTOFF32"}, + {36, "R_390_GOTPLTOFF64"}, + {37, "R_390_TLS_LOAD"}, + {38, "R_390_TLS_GDCALL"}, + {39, "R_390_TLS_LDCALL"}, + {40, "R_390_TLS_GD32"}, + {41, "R_390_TLS_GD64"}, + {42, "R_390_TLS_GOTIE12"}, + {43, "R_390_TLS_GOTIE32"}, + {44, "R_390_TLS_GOTIE64"}, + {45, "R_390_TLS_LDM32"}, + {46, "R_390_TLS_LDM64"}, + {47, "R_390_TLS_IE32"}, + {48, "R_390_TLS_IE64"}, + {49, "R_390_TLS_IEENT"}, + {50, "R_390_TLS_LE32"}, + {51, "R_390_TLS_LE64"}, + {52, "R_390_TLS_LDO32"}, + {53, "R_390_TLS_LDO64"}, + {54, "R_390_TLS_DTPMOD"}, + {55, "R_390_TLS_DTPOFF"}, + {56, "R_390_TLS_TPOFF"}, + {57, "R_390_20"}, + {58, "R_390_GOT20"}, + {59, "R_390_GOTPLT20"}, + {60, "R_390_TLS_GOTIE20"}, +} + +func (i R_390) String() string { return stringName(uint32(i), r390Strings, false) } +func (i R_390) GoString() string { return stringName(uint32(i), r390Strings, true) } + +// Relocation types for SPARC. +type R_SPARC int + +const ( + R_SPARC_NONE R_SPARC = 0 + R_SPARC_8 R_SPARC = 1 + R_SPARC_16 R_SPARC = 2 + R_SPARC_32 R_SPARC = 3 + R_SPARC_DISP8 R_SPARC = 4 + R_SPARC_DISP16 R_SPARC = 5 + R_SPARC_DISP32 R_SPARC = 6 + R_SPARC_WDISP30 R_SPARC = 7 + R_SPARC_WDISP22 R_SPARC = 8 + R_SPARC_HI22 R_SPARC = 9 + R_SPARC_22 R_SPARC = 10 + R_SPARC_13 R_SPARC = 11 + R_SPARC_LO10 R_SPARC = 12 + R_SPARC_GOT10 R_SPARC = 13 + R_SPARC_GOT13 R_SPARC = 14 + R_SPARC_GOT22 R_SPARC = 15 + R_SPARC_PC10 R_SPARC = 16 + R_SPARC_PC22 R_SPARC = 17 + R_SPARC_WPLT30 R_SPARC = 18 + R_SPARC_COPY R_SPARC = 19 + R_SPARC_GLOB_DAT R_SPARC = 20 + R_SPARC_JMP_SLOT R_SPARC = 21 + R_SPARC_RELATIVE R_SPARC = 22 + R_SPARC_UA32 R_SPARC = 23 + R_SPARC_PLT32 R_SPARC = 24 + R_SPARC_HIPLT22 R_SPARC = 25 + R_SPARC_LOPLT10 R_SPARC = 26 + R_SPARC_PCPLT32 R_SPARC = 27 + R_SPARC_PCPLT22 R_SPARC = 28 + R_SPARC_PCPLT10 R_SPARC = 29 + R_SPARC_10 R_SPARC = 30 + R_SPARC_11 R_SPARC = 31 + R_SPARC_64 R_SPARC = 32 + R_SPARC_OLO10 R_SPARC = 33 + R_SPARC_HH22 R_SPARC = 34 + R_SPARC_HM10 R_SPARC = 35 + R_SPARC_LM22 R_SPARC = 36 + R_SPARC_PC_HH22 R_SPARC = 37 + R_SPARC_PC_HM10 R_SPARC = 38 + R_SPARC_PC_LM22 R_SPARC = 39 + R_SPARC_WDISP16 R_SPARC = 40 + R_SPARC_WDISP19 R_SPARC = 41 + R_SPARC_GLOB_JMP R_SPARC = 42 + R_SPARC_7 R_SPARC = 43 + R_SPARC_5 R_SPARC = 44 + R_SPARC_6 R_SPARC = 45 + R_SPARC_DISP64 R_SPARC = 46 + R_SPARC_PLT64 R_SPARC = 47 + R_SPARC_HIX22 R_SPARC = 48 + R_SPARC_LOX10 R_SPARC = 49 + R_SPARC_H44 R_SPARC = 50 + R_SPARC_M44 R_SPARC = 51 + R_SPARC_L44 R_SPARC = 52 + R_SPARC_REGISTER R_SPARC = 53 + R_SPARC_UA64 R_SPARC = 54 + R_SPARC_UA16 R_SPARC = 55 +) + +var rsparcStrings = []intName{ + {0, "R_SPARC_NONE"}, + {1, "R_SPARC_8"}, + {2, "R_SPARC_16"}, + {3, "R_SPARC_32"}, + {4, "R_SPARC_DISP8"}, + {5, "R_SPARC_DISP16"}, + {6, "R_SPARC_DISP32"}, + {7, "R_SPARC_WDISP30"}, + {8, "R_SPARC_WDISP22"}, + {9, "R_SPARC_HI22"}, + {10, "R_SPARC_22"}, + {11, "R_SPARC_13"}, + {12, "R_SPARC_LO10"}, + {13, "R_SPARC_GOT10"}, + {14, "R_SPARC_GOT13"}, + {15, "R_SPARC_GOT22"}, + {16, "R_SPARC_PC10"}, + {17, "R_SPARC_PC22"}, + {18, "R_SPARC_WPLT30"}, + {19, "R_SPARC_COPY"}, + {20, "R_SPARC_GLOB_DAT"}, + {21, "R_SPARC_JMP_SLOT"}, + {22, "R_SPARC_RELATIVE"}, + {23, "R_SPARC_UA32"}, + {24, "R_SPARC_PLT32"}, + {25, "R_SPARC_HIPLT22"}, + {26, "R_SPARC_LOPLT10"}, + {27, "R_SPARC_PCPLT32"}, + {28, "R_SPARC_PCPLT22"}, + {29, "R_SPARC_PCPLT10"}, + {30, "R_SPARC_10"}, + {31, "R_SPARC_11"}, + {32, "R_SPARC_64"}, + {33, "R_SPARC_OLO10"}, + {34, "R_SPARC_HH22"}, + {35, "R_SPARC_HM10"}, + {36, "R_SPARC_LM22"}, + {37, "R_SPARC_PC_HH22"}, + {38, "R_SPARC_PC_HM10"}, + {39, "R_SPARC_PC_LM22"}, + {40, "R_SPARC_WDISP16"}, + {41, "R_SPARC_WDISP19"}, + {42, "R_SPARC_GLOB_JMP"}, + {43, "R_SPARC_7"}, + {44, "R_SPARC_5"}, + {45, "R_SPARC_6"}, + {46, "R_SPARC_DISP64"}, + {47, "R_SPARC_PLT64"}, + {48, "R_SPARC_HIX22"}, + {49, "R_SPARC_LOX10"}, + {50, "R_SPARC_H44"}, + {51, "R_SPARC_M44"}, + {52, "R_SPARC_L44"}, + {53, "R_SPARC_REGISTER"}, + {54, "R_SPARC_UA64"}, + {55, "R_SPARC_UA16"}, +} + +func (i R_SPARC) String() string { return stringName(uint32(i), rsparcStrings, false) } +func (i R_SPARC) GoString() string { return stringName(uint32(i), rsparcStrings, true) } + +// Magic number for the elf trampoline, chosen wisely to be an immediate value. +const ARM_MAGIC_TRAMP_NUMBER = 0x5c000003 + +// ELF32 File header. +type Header32 struct { + Ident [EI_NIDENT]byte /* File identification. */ + Type uint16 /* File type. */ + Machine uint16 /* Machine architecture. */ + Version uint32 /* ELF format version. */ + Entry uint32 /* Entry point. */ + Phoff uint32 /* Program header file offset. */ + Shoff uint32 /* Section header file offset. */ + Flags uint32 /* Architecture-specific flags. */ + Ehsize uint16 /* Size of ELF header in bytes. */ + Phentsize uint16 /* Size of program header entry. */ + Phnum uint16 /* Number of program header entries. */ + Shentsize uint16 /* Size of section header entry. */ + Shnum uint16 /* Number of section header entries. */ + Shstrndx uint16 /* Section name strings section. */ +} + +// ELF32 Section header. +type Section32 struct { + Name uint32 /* Section name (index into the section header string table). */ + Type uint32 /* Section type. */ + Flags uint32 /* Section flags. */ + Addr uint32 /* Address in memory image. */ + Off uint32 /* Offset in file. */ + Size uint32 /* Size in bytes. */ + Link uint32 /* Index of a related section. */ + Info uint32 /* Depends on section type. */ + Addralign uint32 /* Alignment in bytes. */ + Entsize uint32 /* Size of each entry in section. */ +} + +// ELF32 Program header. +type Prog32 struct { + Type uint32 /* Entry type. */ + Off uint32 /* File offset of contents. */ + Vaddr uint32 /* Virtual address in memory image. */ + Paddr uint32 /* Physical address (not used). */ + Filesz uint32 /* Size of contents in file. */ + Memsz uint32 /* Size of contents in memory. */ + Flags uint32 /* Access permission flags. */ + Align uint32 /* Alignment in memory and file. */ +} + +// ELF32 Dynamic structure. The ".dynamic" section contains an array of them. +type Dyn32 struct { + Tag int32 /* Entry type. */ + Val uint32 /* Integer/Address value. */ +} + +// ELF32 Compression header. +type Chdr32 struct { + Type uint32 + Size uint32 + Addralign uint32 +} + +/* + * Relocation entries. + */ + +// ELF32 Relocations that don't need an addend field. +type Rel32 struct { + Off uint32 /* Location to be relocated. */ + Info uint32 /* Relocation type and symbol index. */ +} + +// ELF32 Relocations that need an addend field. +type Rela32 struct { + Off uint32 /* Location to be relocated. */ + Info uint32 /* Relocation type and symbol index. */ + Addend int32 /* Addend. */ +} + +func R_SYM32(info uint32) uint32 { return info >> 8 } +func R_TYPE32(info uint32) uint32 { return info & 0xff } +func R_INFO32(sym, typ uint32) uint32 { return sym<<8 | typ } + +// ELF32 Symbol. +type Sym32 struct { + Name uint32 + Value uint32 + Size uint32 + Info uint8 + Other uint8 + Shndx uint16 +} + +const Sym32Size = 16 + +func ST_BIND(info uint8) SymBind { return SymBind(info >> 4) } +func ST_TYPE(info uint8) SymType { return SymType(info & 0xF) } +func ST_INFO(bind SymBind, typ SymType) uint8 { + return uint8(bind)<<4 | uint8(typ)&0xf +} +func ST_VISIBILITY(other uint8) SymVis { return SymVis(other & 3) } + +/* + * ELF64 + */ + +// ELF64 file header. +type Header64 struct { + Ident [EI_NIDENT]byte /* File identification. */ + Type uint16 /* File type. */ + Machine uint16 /* Machine architecture. */ + Version uint32 /* ELF format version. */ + Entry uint64 /* Entry point. */ + Phoff uint64 /* Program header file offset. */ + Shoff uint64 /* Section header file offset. */ + Flags uint32 /* Architecture-specific flags. */ + Ehsize uint16 /* Size of ELF header in bytes. */ + Phentsize uint16 /* Size of program header entry. */ + Phnum uint16 /* Number of program header entries. */ + Shentsize uint16 /* Size of section header entry. */ + Shnum uint16 /* Number of section header entries. */ + Shstrndx uint16 /* Section name strings section. */ +} + +// ELF64 Section header. +type Section64 struct { + Name uint32 /* Section name (index into the section header string table). */ + Type uint32 /* Section type. */ + Flags uint64 /* Section flags. */ + Addr uint64 /* Address in memory image. */ + Off uint64 /* Offset in file. */ + Size uint64 /* Size in bytes. */ + Link uint32 /* Index of a related section. */ + Info uint32 /* Depends on section type. */ + Addralign uint64 /* Alignment in bytes. */ + Entsize uint64 /* Size of each entry in section. */ +} + +// ELF64 Program header. +type Prog64 struct { + Type uint32 /* Entry type. */ + Flags uint32 /* Access permission flags. */ + Off uint64 /* File offset of contents. */ + Vaddr uint64 /* Virtual address in memory image. */ + Paddr uint64 /* Physical address (not used). */ + Filesz uint64 /* Size of contents in file. */ + Memsz uint64 /* Size of contents in memory. */ + Align uint64 /* Alignment in memory and file. */ +} + +// ELF64 Dynamic structure. The ".dynamic" section contains an array of them. +type Dyn64 struct { + Tag int64 /* Entry type. */ + Val uint64 /* Integer/address value */ +} + +// ELF64 Compression header. +type Chdr64 struct { + Type uint32 + _ uint32 /* Reserved. */ + Size uint64 + Addralign uint64 +} + +/* + * Relocation entries. + */ + +/* ELF64 relocations that don't need an addend field. */ +type Rel64 struct { + Off uint64 /* Location to be relocated. */ + Info uint64 /* Relocation type and symbol index. */ +} + +/* ELF64 relocations that need an addend field. */ +type Rela64 struct { + Off uint64 /* Location to be relocated. */ + Info uint64 /* Relocation type and symbol index. */ + Addend int64 /* Addend. */ +} + +func R_SYM64(info uint64) uint32 { return uint32(info >> 32) } +func R_TYPE64(info uint64) uint32 { return uint32(info) } +func R_INFO(sym, typ uint32) uint64 { return uint64(sym)<<32 | uint64(typ) } + +// ELF64 symbol table entries. +type Sym64 struct { + Name uint32 /* String table index of name. */ + Info uint8 /* Type and binding information. */ + Other uint8 /* Reserved (not used). */ + Shndx uint16 /* Section index of symbol. */ + Value uint64 /* Symbol value. */ + Size uint64 /* Size of associated object. */ +} + +const Sym64Size = 24 + +type intName struct { + i uint32 + s string +} + +func stringName(i uint32, names []intName, goSyntax bool) string { + for _, n := range names { + if n.i == i { + if goSyntax { + return "elf." + n.s + } + return n.s + } + } + + // second pass - look for smaller to add with. + // assume sorted already + for j := len(names) - 1; j >= 0; j-- { + n := names[j] + if n.i < i { + s := n.s + if goSyntax { + s = "elf." + s + } + return s + "+" + strconv.FormatUint(uint64(i-n.i), 10) + } + } + + return strconv.FormatUint(uint64(i), 10) +} + +func flagName(i uint32, names []intName, goSyntax bool) string { + s := "" + for _, n := range names { + if n.i&i == n.i { + if len(s) > 0 { + s += "+" + } + if goSyntax { + s += "elf." + } + s += n.s + i -= n.i + } + } + if len(s) == 0 { + return "0x" + strconv.FormatUint(uint64(i), 16) + } + if i != 0 { + s += "+0x" + strconv.FormatUint(uint64(i), 16) + } + return s +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/elf_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/elf_test.go new file mode 100644 index 000000000..49238c903 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/elf_test.go @@ -0,0 +1,59 @@ +// 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. + +package elf + +import ( + "fmt" + "testing" +) + +type nameTest struct { + val interface{} + str string +} + +var nameTests = []nameTest{ + {ELFOSABI_LINUX, "ELFOSABI_LINUX"}, + {ET_EXEC, "ET_EXEC"}, + {EM_860, "EM_860"}, + {SHN_LOPROC, "SHN_LOPROC"}, + {SHT_PROGBITS, "SHT_PROGBITS"}, + {SHF_MERGE + SHF_TLS, "SHF_MERGE+SHF_TLS"}, + {PT_LOAD, "PT_LOAD"}, + {PF_W + PF_R + 0x50, "PF_W+PF_R+0x50"}, + {DT_SYMBOLIC, "DT_SYMBOLIC"}, + {DF_BIND_NOW, "DF_BIND_NOW"}, + {NT_FPREGSET, "NT_FPREGSET"}, + {STB_GLOBAL, "STB_GLOBAL"}, + {STT_COMMON, "STT_COMMON"}, + {STV_HIDDEN, "STV_HIDDEN"}, + {R_X86_64_PC32, "R_X86_64_PC32"}, + {R_ALPHA_OP_PUSH, "R_ALPHA_OP_PUSH"}, + {R_ARM_THM_ABS5, "R_ARM_THM_ABS5"}, + {R_386_GOT32, "R_386_GOT32"}, + {R_PPC_GOT16_HI, "R_PPC_GOT16_HI"}, + {R_SPARC_GOT22, "R_SPARC_GOT22"}, + {ET_LOOS + 5, "ET_LOOS+5"}, + {ProgFlag(0x50), "0x50"}, +} + +func TestNames(t *testing.T) { + for i, tt := range nameTests { + s := fmt.Sprint(tt.val) + if s != tt.str { + t.Errorf("#%d: Sprint(%d) = %q, want %q", i, tt.val, s, tt.str) + } + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/file.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/file.go new file mode 100644 index 000000000..4441a7844 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/file.go @@ -0,0 +1,1417 @@ +// 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. + +// Package elf implements access to ELF object files. +package elf + +import ( + "bytes" + "compress/zlib" + "encoding/binary" + "errors" + "fmt" + "io" + "os" + "strings" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" +) + +// seekStart, seekCurrent, seekEnd are copies of +// io.SeekStart, io.SeekCurrent, and io.SeekEnd. +// We can't use the ones from package io because +// we want this code to build with Go 1.4 during +// cmd/dist bootstrap. +const ( + seekStart int = 0 + seekCurrent int = 1 + seekEnd int = 2 +) + +// TODO: error reporting detail + +/* + * Internal ELF representation + */ + +// A FileHeader represents an ELF file header. +type FileHeader struct { + Class Class + Data Data + Version Version + OSABI OSABI + ABIVersion uint8 + ByteOrder binary.ByteOrder + Type Type + Machine Machine + Entry uint64 +} + +// A File represents an open ELF file. +type File struct { + FileHeader + Sections []*Section + Progs []*Prog + closer io.Closer + gnuNeed []verneed + gnuVersym []byte +} + +// A SectionHeader represents a single ELF section header. +type SectionHeader struct { + Name string + Type SectionType + Flags SectionFlag + Addr uint64 + Offset uint64 + Size uint64 + Link uint32 + Info uint32 + Addralign uint64 + Entsize uint64 + + // FileSize is the size of this section in the file in bytes. + // If a section is compressed, FileSize is the size of the + // compressed data, while Size (above) is the size of the + // uncompressed data. + FileSize uint64 +} + +// A Section represents a single section in an ELF file. +type Section struct { + SectionHeader + + // Embed ReaderAt for ReadAt method. + // Do not embed SectionReader directly + // to avoid having Read and Seek. + // If a client wants Read and Seek it must use + // Open() to avoid fighting over the seek offset + // with other clients. + // + // ReaderAt may be nil if the section is not easily available + // in a random-access form. For example, a compressed section + // may have a nil ReaderAt. + io.ReaderAt + sr *io.SectionReader + + compressionType CompressionType + compressionOffset int64 +} + +// Data reads and returns the contents of the ELF section. +// Even if the section is stored compressed in the ELF file, +// Data returns uncompressed data. +func (s *Section) Data() ([]byte, error) { + dat := make([]byte, s.Size) + n, err := io.ReadFull(s.Open(), dat) + return dat[0:n], err +} + +// stringTable reads and returns the string table given by the +// specified link value. +func (f *File) stringTable(link uint32) ([]byte, error) { + if link <= 0 || link >= uint32(len(f.Sections)) { + return nil, errors.New("section has invalid string table link") + } + return f.Sections[link].Data() +} + +// Open returns a new ReadSeeker reading the ELF section. +// Even if the section is stored compressed in the ELF file, +// the ReadSeeker reads uncompressed data. +func (s *Section) Open() io.ReadSeeker { + if s.Flags&SHF_COMPRESSED == 0 { + return io.NewSectionReader(s.sr, 0, 1<<63-1) + } + if s.compressionType == COMPRESS_ZLIB { + return &readSeekerFromReader{ + reset: func() (io.Reader, error) { + fr := io.NewSectionReader(s.sr, s.compressionOffset, int64(s.FileSize)-s.compressionOffset) + return zlib.NewReader(fr) + }, + size: int64(s.Size), + } + } + err := &FormatError{int64(s.Offset), "unknown compression type", s.compressionType} + return errorReader{err} +} + +// A ProgHeader represents a single ELF program header. +type ProgHeader struct { + Type ProgType + Flags ProgFlag + Off uint64 + Vaddr uint64 + Paddr uint64 + Filesz uint64 + Memsz uint64 + Align uint64 +} + +// A Prog represents a single ELF program header in an ELF binary. +type Prog struct { + ProgHeader + + // Embed ReaderAt for ReadAt method. + // Do not embed SectionReader directly + // to avoid having Read and Seek. + // If a client wants Read and Seek it must use + // Open() to avoid fighting over the seek offset + // with other clients. + io.ReaderAt + sr *io.SectionReader +} + +// Open returns a new ReadSeeker reading the ELF program body. +func (p *Prog) Open() io.ReadSeeker { return io.NewSectionReader(p.sr, 0, 1<<63-1) } + +// A Symbol represents an entry in an ELF symbol table section. +type Symbol struct { + Name string + Info, Other byte + Section SectionIndex + Value, Size uint64 +} + +/* + * ELF reader + */ + +type FormatError struct { + off int64 + msg string + val interface{} +} + +func (e *FormatError) Error() string { + msg := e.msg + if e.val != nil { + msg += fmt.Sprintf(" '%v' ", e.val) + } + msg += fmt.Sprintf("in record at byte %#x", e.off) + return msg +} + +// Open opens the named file using os.Open and prepares it for use as an ELF binary. +func Open(name string) (*File, error) { + f, err := os.Open(name) + if err != nil { + return nil, err + } + ff, err := NewFile(f) + if err != nil { + f.Close() + return nil, err + } + ff.closer = f + return ff, nil +} + +// Close closes the File. +// If the File was created using NewFile directly instead of Open, +// Close has no effect. +func (f *File) Close() error { + var err error + if f.closer != nil { + err = f.closer.Close() + f.closer = nil + } + return err +} + +// SectionByType returns the first section in f with the +// given type, or nil if there is no such section. +func (f *File) SectionByType(typ SectionType) *Section { + for _, s := range f.Sections { + if s.Type == typ { + return s + } + } + return nil +} + +// NewFile creates a new File for accessing an ELF binary in an underlying reader. +// The ELF binary is expected to start at position 0 in the ReaderAt. +func NewFile(r io.ReaderAt) (*File, error) { + sr := io.NewSectionReader(r, 0, 1<<63-1) + // Read and decode ELF identifier + var ident [16]uint8 + if _, err := r.ReadAt(ident[0:], 0); err != nil { + return nil, err + } + if ident[0] != '\x7f' || ident[1] != 'E' || ident[2] != 'L' || ident[3] != 'F' { + return nil, &FormatError{0, "bad magic number", ident[0:4]} + } + + f := new(File) + f.Class = Class(ident[EI_CLASS]) + switch f.Class { + case ELFCLASS32: + case ELFCLASS64: + // ok + default: + return nil, &FormatError{0, "unknown ELF class", f.Class} + } + + f.Data = Data(ident[EI_DATA]) + switch f.Data { + case ELFDATA2LSB: + f.ByteOrder = binary.LittleEndian + case ELFDATA2MSB: + f.ByteOrder = binary.BigEndian + default: + return nil, &FormatError{0, "unknown ELF data encoding", f.Data} + } + + f.Version = Version(ident[EI_VERSION]) + if f.Version != EV_CURRENT { + return nil, &FormatError{0, "unknown ELF version", f.Version} + } + + f.OSABI = OSABI(ident[EI_OSABI]) + f.ABIVersion = ident[EI_ABIVERSION] + + // Read ELF file header + var phoff int64 + var phentsize, phnum int + var shoff int64 + var shentsize, shnum, shstrndx int + shstrndx = -1 + switch f.Class { + case ELFCLASS32: + hdr := new(Header32) + sr.Seek(0, seekStart) + if err := binary.Read(sr, f.ByteOrder, hdr); err != nil { + return nil, err + } + f.Type = Type(hdr.Type) + f.Machine = Machine(hdr.Machine) + f.Entry = uint64(hdr.Entry) + if v := Version(hdr.Version); v != f.Version { + return nil, &FormatError{0, "mismatched ELF version", v} + } + phoff = int64(hdr.Phoff) + phentsize = int(hdr.Phentsize) + phnum = int(hdr.Phnum) + shoff = int64(hdr.Shoff) + shentsize = int(hdr.Shentsize) + shnum = int(hdr.Shnum) + shstrndx = int(hdr.Shstrndx) + case ELFCLASS64: + hdr := new(Header64) + sr.Seek(0, seekStart) + if err := binary.Read(sr, f.ByteOrder, hdr); err != nil { + return nil, err + } + f.Type = Type(hdr.Type) + f.Machine = Machine(hdr.Machine) + f.Entry = hdr.Entry + if v := Version(hdr.Version); v != f.Version { + return nil, &FormatError{0, "mismatched ELF version", v} + } + phoff = int64(hdr.Phoff) + phentsize = int(hdr.Phentsize) + phnum = int(hdr.Phnum) + shoff = int64(hdr.Shoff) + shentsize = int(hdr.Shentsize) + shnum = int(hdr.Shnum) + shstrndx = int(hdr.Shstrndx) + } + + if shnum > 0 && shoff > 0 && (shstrndx < 0 || shstrndx >= shnum) { + return nil, &FormatError{0, "invalid ELF shstrndx", shstrndx} + } + + // Read program headers + f.Progs = make([]*Prog, phnum) + for i := 0; i < phnum; i++ { + off := phoff + int64(i)*int64(phentsize) + sr.Seek(off, seekStart) + p := new(Prog) + switch f.Class { + case ELFCLASS32: + ph := new(Prog32) + if err := binary.Read(sr, f.ByteOrder, ph); err != nil { + return nil, err + } + p.ProgHeader = ProgHeader{ + Type: ProgType(ph.Type), + Flags: ProgFlag(ph.Flags), + Off: uint64(ph.Off), + Vaddr: uint64(ph.Vaddr), + Paddr: uint64(ph.Paddr), + Filesz: uint64(ph.Filesz), + Memsz: uint64(ph.Memsz), + Align: uint64(ph.Align), + } + case ELFCLASS64: + ph := new(Prog64) + if err := binary.Read(sr, f.ByteOrder, ph); err != nil { + return nil, err + } + p.ProgHeader = ProgHeader{ + Type: ProgType(ph.Type), + Flags: ProgFlag(ph.Flags), + Off: ph.Off, + Vaddr: ph.Vaddr, + Paddr: ph.Paddr, + Filesz: ph.Filesz, + Memsz: ph.Memsz, + Align: ph.Align, + } + } + p.sr = io.NewSectionReader(r, int64(p.Off), int64(p.Filesz)) + p.ReaderAt = p.sr + f.Progs[i] = p + } + + // Read section headers + f.Sections = make([]*Section, shnum) + names := make([]uint32, shnum) + for i := 0; i < shnum; i++ { + off := shoff + int64(i)*int64(shentsize) + sr.Seek(off, seekStart) + s := new(Section) + switch f.Class { + case ELFCLASS32: + sh := new(Section32) + if err := binary.Read(sr, f.ByteOrder, sh); err != nil { + return nil, err + } + names[i] = sh.Name + s.SectionHeader = SectionHeader{ + Type: SectionType(sh.Type), + Flags: SectionFlag(sh.Flags), + Addr: uint64(sh.Addr), + Offset: uint64(sh.Off), + FileSize: uint64(sh.Size), + Link: sh.Link, + Info: sh.Info, + Addralign: uint64(sh.Addralign), + Entsize: uint64(sh.Entsize), + } + case ELFCLASS64: + sh := new(Section64) + if err := binary.Read(sr, f.ByteOrder, sh); err != nil { + return nil, err + } + names[i] = sh.Name + s.SectionHeader = SectionHeader{ + Type: SectionType(sh.Type), + Flags: SectionFlag(sh.Flags), + Offset: sh.Off, + FileSize: sh.Size, + Addr: sh.Addr, + Link: sh.Link, + Info: sh.Info, + Addralign: sh.Addralign, + Entsize: sh.Entsize, + } + } + s.sr = io.NewSectionReader(r, int64(s.Offset), int64(s.FileSize)) + + if s.Flags&SHF_COMPRESSED == 0 { + s.ReaderAt = s.sr + s.Size = s.FileSize + } else { + // Read the compression header. + switch f.Class { + case ELFCLASS32: + ch := new(Chdr32) + if err := binary.Read(s.sr, f.ByteOrder, ch); err != nil { + return nil, err + } + s.compressionType = CompressionType(ch.Type) + s.Size = uint64(ch.Size) + s.Addralign = uint64(ch.Addralign) + s.compressionOffset = int64(binary.Size(ch)) + case ELFCLASS64: + ch := new(Chdr64) + if err := binary.Read(s.sr, f.ByteOrder, ch); err != nil { + return nil, err + } + s.compressionType = CompressionType(ch.Type) + s.Size = ch.Size + s.Addralign = ch.Addralign + s.compressionOffset = int64(binary.Size(ch)) + } + } + + f.Sections[i] = s + } + + if len(f.Sections) == 0 { + return f, nil + } + + // Load section header string table. + shstrtab, err := f.Sections[shstrndx].Data() + if err != nil { + return nil, err + } + for i, s := range f.Sections { + var ok bool + s.Name, ok = getString(shstrtab, int(names[i])) + if !ok { + return nil, &FormatError{shoff + int64(i*shentsize), "bad section name index", names[i]} + } + } + + return f, nil +} + +// getSymbols returns a slice of Symbols from parsing the symbol table +// with the given type, along with the associated string table. +func (f *File) getSymbols(typ SectionType) ([]Symbol, []byte, error) { + switch f.Class { + case ELFCLASS64: + return f.getSymbols64(typ) + + case ELFCLASS32: + return f.getSymbols32(typ) + } + + return nil, nil, errors.New("not implemented") +} + +// ErrNoSymbols is returned by File.Symbols and File.DynamicSymbols +// if there is no such section in the File. +var ErrNoSymbols = errors.New("no symbol section") + +func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, error) { + symtabSection := f.SectionByType(typ) + if symtabSection == nil { + return nil, nil, ErrNoSymbols + } + + data, err := symtabSection.Data() + if err != nil { + return nil, nil, errors.New("cannot load symbol section") + } + symtab := bytes.NewReader(data) + if symtab.Len()%Sym32Size != 0 { + return nil, nil, errors.New("length of symbol section is not a multiple of SymSize") + } + + strdata, err := f.stringTable(symtabSection.Link) + if err != nil { + return nil, nil, errors.New("cannot load string table section") + } + + // The first entry is all zeros. + var skip [Sym32Size]byte + symtab.Read(skip[:]) + + symbols := make([]Symbol, symtab.Len()/Sym32Size) + + i := 0 + var sym Sym32 + for symtab.Len() > 0 { + binary.Read(symtab, f.ByteOrder, &sym) + str, _ := getString(strdata, int(sym.Name)) + symbols[i].Name = str + symbols[i].Info = sym.Info + symbols[i].Other = sym.Other + symbols[i].Section = SectionIndex(sym.Shndx) + symbols[i].Value = uint64(sym.Value) + symbols[i].Size = uint64(sym.Size) + i++ + } + + return symbols, strdata, nil +} + +func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, error) { + symtabSection := f.SectionByType(typ) + if symtabSection == nil { + return nil, nil, ErrNoSymbols + } + + data, err := symtabSection.Data() + if err != nil { + return nil, nil, errors.New("cannot load symbol section") + } + symtab := bytes.NewReader(data) + if symtab.Len()%Sym64Size != 0 { + return nil, nil, errors.New("length of symbol section is not a multiple of Sym64Size") + } + + strdata, err := f.stringTable(symtabSection.Link) + if err != nil { + return nil, nil, errors.New("cannot load string table section") + } + + // The first entry is all zeros. + var skip [Sym64Size]byte + symtab.Read(skip[:]) + + symbols := make([]Symbol, symtab.Len()/Sym64Size) + + i := 0 + var sym Sym64 + for symtab.Len() > 0 { + binary.Read(symtab, f.ByteOrder, &sym) + str, _ := getString(strdata, int(sym.Name)) + symbols[i].Name = str + symbols[i].Info = sym.Info + symbols[i].Other = sym.Other + symbols[i].Section = SectionIndex(sym.Shndx) + symbols[i].Value = sym.Value + symbols[i].Size = sym.Size + i++ + } + + return symbols, strdata, nil +} + +// getString extracts a string from an ELF string table. +func getString(section []byte, start int) (string, bool) { + if start < 0 || start >= len(section) { + return "", false + } + + for end := start; end < len(section); end++ { + if section[end] == 0 { + return string(section[start:end]), true + } + } + return "", false +} + +// Section returns a section with the given name, or nil if no such +// section exists. +func (f *File) Section(name string) *Section { + for _, s := range f.Sections { + if s.Name == name { + return s + } + } + return nil +} + +// applyRelocations applies relocations to dst. rels is a relocations section +// in REL or RELA format. +func (f *File) applyRelocations(dst []byte, rels []byte) error { + switch { + case f.Class == ELFCLASS64 && f.Machine == EM_X86_64: + return f.applyRelocationsAMD64(dst, rels) + case f.Class == ELFCLASS32 && f.Machine == EM_386: + return f.applyRelocations386(dst, rels) + case f.Class == ELFCLASS32 && f.Machine == EM_ARM: + return f.applyRelocationsARM(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_AARCH64: + return f.applyRelocationsARM64(dst, rels) + case f.Class == ELFCLASS32 && f.Machine == EM_PPC: + return f.applyRelocationsPPC(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_PPC64: + return f.applyRelocationsPPC64(dst, rels) + case f.Class == ELFCLASS32 && f.Machine == EM_MIPS: + return f.applyRelocationsMIPS(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_MIPS: + return f.applyRelocationsMIPS64(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_RISCV: + return f.applyRelocationsRISCV64(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_S390: + return f.applyRelocationss390x(dst, rels) + case f.Class == ELFCLASS64 && f.Machine == EM_SPARCV9: + return f.applyRelocationsSPARC64(dst, rels) + default: + return errors.New("applyRelocations: not implemented") + } +} + +func (f *File) applyRelocationsAMD64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_X86_64(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if SymType(sym.Info&0xf) != STT_SECTION { + // We don't handle non-section relocations for now. + continue + } + + // There are relocations, so this must be a normal + // object file, and we only look at section symbols, + // so we assume that the symbol value is 0. + + switch t { + case R_X86_64_64: + if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend)) + case R_X86_64_32: + if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) + } + } + + return nil +} + +func (f *File) applyRelocations386(dst []byte, rels []byte) error { + // 8 is the size of Rel32. + if len(rels)%8 != 0 { + return errors.New("length of relocation section is not a multiple of 8") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rel Rel32 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rel) + symNo := rel.Info >> 8 + t := R_386(rel.Info & 0xff) + + if symNo == 0 || symNo > uint32(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + + if t == R_386_32 { + if rel.Off+4 >= uint32(len(dst)) { + continue + } + val := f.ByteOrder.Uint32(dst[rel.Off : rel.Off+4]) + val += uint32(sym.Value) + f.ByteOrder.PutUint32(dst[rel.Off:rel.Off+4], val) + } + } + + return nil +} + +func (f *File) applyRelocationsARM(dst []byte, rels []byte) error { + // 8 is the size of Rel32. + if len(rels)%8 != 0 { + return errors.New("length of relocation section is not a multiple of 8") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rel Rel32 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rel) + symNo := rel.Info >> 8 + t := R_ARM(rel.Info & 0xff) + + if symNo == 0 || symNo > uint32(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + + switch t { + case R_ARM_ABS32: + if rel.Off+4 >= uint32(len(dst)) { + continue + } + val := f.ByteOrder.Uint32(dst[rel.Off : rel.Off+4]) + val += uint32(sym.Value) + f.ByteOrder.PutUint32(dst[rel.Off:rel.Off+4], val) + } + } + + return nil +} + +func (f *File) applyRelocationsARM64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_AARCH64(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if SymType(sym.Info&0xf) != STT_SECTION { + // We don't handle non-section relocations for now. + continue + } + + // There are relocations, so this must be a normal + // object file, and we only look at section symbols, + // so we assume that the symbol value is 0. + + switch t { + case R_AARCH64_ABS64: + if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend)) + case R_AARCH64_ABS32: + if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) + } + } + + return nil +} + +func (f *File) applyRelocationsPPC(dst []byte, rels []byte) error { + // 12 is the size of Rela32. + if len(rels)%12 != 0 { + return errors.New("length of relocation section is not a multiple of 12") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela32 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 8 + t := R_PPC(rela.Info & 0xff) + + if symNo == 0 || symNo > uint32(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if SymType(sym.Info&0xf) != STT_SECTION { + // We don't handle non-section relocations for now. + continue + } + + switch t { + case R_PPC_ADDR32: + if rela.Off+4 >= uint32(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) + } + } + + return nil +} + +func (f *File) applyRelocationsPPC64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_PPC64(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if SymType(sym.Info&0xf) != STT_SECTION { + // We don't handle non-section relocations for now. + continue + } + + switch t { + case R_PPC64_ADDR64: + if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend)) + case R_PPC64_ADDR32: + if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) + } + } + + return nil +} + +func (f *File) applyRelocationsMIPS(dst []byte, rels []byte) error { + // 8 is the size of Rel32. + if len(rels)%8 != 0 { + return errors.New("length of relocation section is not a multiple of 8") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rel Rel32 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rel) + symNo := rel.Info >> 8 + t := R_MIPS(rel.Info & 0xff) + + if symNo == 0 || symNo > uint32(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + + switch t { + case R_MIPS_32: + if rel.Off+4 >= uint32(len(dst)) { + continue + } + val := f.ByteOrder.Uint32(dst[rel.Off : rel.Off+4]) + val += uint32(sym.Value) + f.ByteOrder.PutUint32(dst[rel.Off:rel.Off+4], val) + } + } + + return nil +} + +func (f *File) applyRelocationsMIPS64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + var symNo uint64 + var t R_MIPS + if f.ByteOrder == binary.BigEndian { + symNo = rela.Info >> 32 + t = R_MIPS(rela.Info & 0xff) + } else { + symNo = rela.Info & 0xffffffff + t = R_MIPS(rela.Info >> 56) + } + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if SymType(sym.Info&0xf) != STT_SECTION { + // We don't handle non-section relocations for now. + continue + } + + switch t { + case R_MIPS_64: + if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend)) + case R_MIPS_32: + if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) + } + } + + return nil +} + +func (f *File) applyRelocationsRISCV64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_RISCV(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + switch SymType(sym.Info & 0xf) { + case STT_SECTION, STT_NOTYPE: + break + default: + continue + } + + switch t { + case R_RISCV_64: + if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + val := sym.Value + uint64(rela.Addend) + f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], val) + case R_RISCV_32: + if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + val := uint32(sym.Value) + uint32(rela.Addend) + f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], val) + } + } + + return nil +} + +func (f *File) applyRelocationss390x(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_390(rela.Info & 0xffff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + switch SymType(sym.Info & 0xf) { + case STT_SECTION, STT_NOTYPE: + break + default: + continue + } + + switch t { + case R_390_64: + if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + val := sym.Value + uint64(rela.Addend) + f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], val) + case R_390_32: + if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + val := uint32(sym.Value) + uint32(rela.Addend) + f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], val) + } + } + + return nil +} + +func (f *File) applyRelocationsSPARC64(dst []byte, rels []byte) error { + // 24 is the size of Rela64. + if len(rels)%24 != 0 { + return errors.New("length of relocation section is not a multiple of 24") + } + + symbols, _, err := f.getSymbols(SHT_SYMTAB) + if err != nil { + return err + } + + b := bytes.NewReader(rels) + var rela Rela64 + + for b.Len() > 0 { + binary.Read(b, f.ByteOrder, &rela) + symNo := rela.Info >> 32 + t := R_SPARC(rela.Info & 0xff) + + if symNo == 0 || symNo > uint64(len(symbols)) { + continue + } + sym := &symbols[symNo-1] + if SymType(sym.Info&0xf) != STT_SECTION { + // We don't handle non-section relocations for now. + continue + } + + switch t { + case R_SPARC_64, R_SPARC_UA64: + if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend)) + case R_SPARC_32, R_SPARC_UA32: + if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { + continue + } + f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) + } + } + + return nil +} + +func (f *File) DWARF() (*dwarf.Data, error) { + dwarfSuffix := func(s *Section) string { + switch { + case strings.HasPrefix(s.Name, ".debug_"): + return s.Name[7:] + case strings.HasPrefix(s.Name, ".zdebug_"): + return s.Name[8:] + default: + return "" + } + + } + // sectionData gets the data for s, checks its size, and + // applies any applicable relations. + sectionData := func(i int, s *Section) ([]byte, error) { + b, err := s.Data() + if err != nil && uint64(len(b)) < s.Size { + return nil, err + } + + if len(b) >= 12 && string(b[:4]) == "ZLIB" { + dlen := binary.BigEndian.Uint64(b[4:12]) + dbuf := make([]byte, dlen) + r, err := zlib.NewReader(bytes.NewBuffer(b[12:])) + if err != nil { + return nil, err + } + if _, err := io.ReadFull(r, dbuf); err != nil { + return nil, err + } + if err := r.Close(); err != nil { + return nil, err + } + b = dbuf + } + + for _, r := range f.Sections { + if r.Type != SHT_RELA && r.Type != SHT_REL { + continue + } + if int(r.Info) != i { + continue + } + rd, err := r.Data() + if err != nil { + return nil, err + } + err = f.applyRelocations(b, rd) + if err != nil { + return nil, err + } + } + return b, nil + } + + // There are many other DWARF sections, but these + // are the ones the debug/dwarf package uses. + // Don't bother loading others. + var dat = map[string][]byte{"abbrev": nil, "info": nil, "str": nil, "line": nil, "ranges": nil} + for i, s := range f.Sections { + suffix := dwarfSuffix(s) + if suffix == "" { + continue + } + if _, ok := dat[suffix]; !ok { + continue + } + b, err := sectionData(i, s) + if err != nil { + return nil, err + } + dat[suffix] = b + } + + d, err := dwarf.New(dat["abbrev"], nil, nil, dat["info"], dat["line"], nil, dat["ranges"], dat["str"]) + if err != nil { + return nil, err + } + + // Look for DWARF4 .debug_types sections. + for i, s := range f.Sections { + suffix := dwarfSuffix(s) + if suffix != "types" { + continue + } + + b, err := sectionData(i, s) + if err != nil { + return nil, err + } + + err = d.AddTypes(fmt.Sprintf("types-%d", i), b) + if err != nil { + return nil, err + } + } + + return d, nil +} + +// Symbols returns the symbol table for f. The symbols will be listed in the order +// they appear in f. +// +// For compatibility with Go 1.0, Symbols omits the null symbol at index 0. +// After retrieving the symbols as symtab, an externally supplied index x +// corresponds to symtab[x-1], not symtab[x]. +func (f *File) Symbols() ([]Symbol, error) { + sym, _, err := f.getSymbols(SHT_SYMTAB) + return sym, err +} + +// DynamicSymbols returns the dynamic symbol table for f. The symbols +// will be listed in the order they appear in f. +// +// For compatibility with Symbols, DynamicSymbols omits the null symbol at index 0. +// After retrieving the symbols as symtab, an externally supplied index x +// corresponds to symtab[x-1], not symtab[x]. +func (f *File) DynamicSymbols() ([]Symbol, error) { + sym, _, err := f.getSymbols(SHT_DYNSYM) + return sym, err +} + +type ImportedSymbol struct { + Name string + Version string + Library string +} + +// ImportedSymbols returns the names of all symbols +// referred to by the binary f that are expected to be +// satisfied by other libraries at dynamic load time. +// It does not return weak symbols. +func (f *File) ImportedSymbols() ([]ImportedSymbol, error) { + sym, str, err := f.getSymbols(SHT_DYNSYM) + if err != nil { + return nil, err + } + f.gnuVersionInit(str) + var all []ImportedSymbol + for i, s := range sym { + if ST_BIND(s.Info) == STB_GLOBAL && s.Section == SHN_UNDEF { + all = append(all, ImportedSymbol{Name: s.Name}) + f.gnuVersion(i, &all[len(all)-1]) + } + } + return all, nil +} + +type verneed struct { + File string + Name string +} + +// gnuVersionInit parses the GNU version tables +// for use by calls to gnuVersion. +func (f *File) gnuVersionInit(str []byte) { + // Accumulate verneed information. + vn := f.SectionByType(SHT_GNU_VERNEED) + if vn == nil { + return + } + d, _ := vn.Data() + + var need []verneed + i := 0 + for { + if i+16 > len(d) { + break + } + vers := f.ByteOrder.Uint16(d[i : i+2]) + if vers != 1 { + break + } + cnt := f.ByteOrder.Uint16(d[i+2 : i+4]) + fileoff := f.ByteOrder.Uint32(d[i+4 : i+8]) + aux := f.ByteOrder.Uint32(d[i+8 : i+12]) + next := f.ByteOrder.Uint32(d[i+12 : i+16]) + file, _ := getString(str, int(fileoff)) + + var name string + j := i + int(aux) + for c := 0; c < int(cnt); c++ { + if j+16 > len(d) { + break + } + // hash := f.ByteOrder.Uint32(d[j:j+4]) + // flags := f.ByteOrder.Uint16(d[j+4:j+6]) + other := f.ByteOrder.Uint16(d[j+6 : j+8]) + nameoff := f.ByteOrder.Uint32(d[j+8 : j+12]) + next := f.ByteOrder.Uint32(d[j+12 : j+16]) + name, _ = getString(str, int(nameoff)) + ndx := int(other) + if ndx >= len(need) { + a := make([]verneed, 2*(ndx+1)) + copy(a, need) + need = a + } + + need[ndx] = verneed{file, name} + if next == 0 { + break + } + j += int(next) + } + + if next == 0 { + break + } + i += int(next) + } + + // Versym parallels symbol table, indexing into verneed. + vs := f.SectionByType(SHT_GNU_VERSYM) + if vs == nil { + return + } + d, _ = vs.Data() + + f.gnuNeed = need + f.gnuVersym = d +} + +// gnuVersion adds Library and Version information to sym, +// which came from offset i of the symbol table. +func (f *File) gnuVersion(i int, sym *ImportedSymbol) { + // Each entry is two bytes. + i = (i + 1) * 2 + if i >= len(f.gnuVersym) { + return + } + j := int(f.ByteOrder.Uint16(f.gnuVersym[i:])) + if j < 2 || j >= len(f.gnuNeed) { + return + } + n := &f.gnuNeed[j] + sym.Library = n.File + sym.Version = n.Name +} + +// ImportedLibraries returns the names of all libraries +// referred to by the binary f that are expected to be +// linked with the binary at dynamic link time. +func (f *File) ImportedLibraries() ([]string, error) { + return f.DynString(DT_NEEDED) +} + +// DynString returns the strings listed for the given tag in the file's dynamic +// section. +// +// The tag must be one that takes string values: DT_NEEDED, DT_SONAME, DT_RPATH, or +// DT_RUNPATH. +func (f *File) DynString(tag DynTag) ([]string, error) { + switch tag { + case DT_NEEDED, DT_SONAME, DT_RPATH, DT_RUNPATH: + default: + return nil, fmt.Errorf("non-string-valued tag %v", tag) + } + ds := f.SectionByType(SHT_DYNAMIC) + if ds == nil { + // not dynamic, so no libraries + return nil, nil + } + d, err := ds.Data() + if err != nil { + return nil, err + } + str, err := f.stringTable(ds.Link) + if err != nil { + return nil, err + } + var all []string + for len(d) > 0 { + var t DynTag + var v uint64 + switch f.Class { + case ELFCLASS32: + t = DynTag(f.ByteOrder.Uint32(d[0:4])) + v = uint64(f.ByteOrder.Uint32(d[4:8])) + d = d[8:] + case ELFCLASS64: + t = DynTag(f.ByteOrder.Uint64(d[0:8])) + v = f.ByteOrder.Uint64(d[8:16]) + d = d[16:] + } + if t == tag { + s, ok := getString(str, int(v)) + if ok { + all = append(all, s) + } + } + } + return all, nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/file_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/file_test.go new file mode 100644 index 000000000..4cc2699db --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/file_test.go @@ -0,0 +1,825 @@ +// 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. + +// +build go1.7 + +package elf + +import ( + "bytes" + "compress/gzip" + "encoding/binary" + "io" + "math/rand" + "net" + "os" + "path" + "reflect" + "runtime" + "testing" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" +) + +type fileTest struct { + file string + hdr FileHeader + sections []SectionHeader + progs []ProgHeader + needed []string +} + +var fileTests = []fileTest{ + { + "testdata/gcc-386-freebsd-exec", + FileHeader{ELFCLASS32, ELFDATA2LSB, EV_CURRENT, ELFOSABI_FREEBSD, 0, binary.LittleEndian, ET_EXEC, EM_386, 0x80483cc}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".interp", SHT_PROGBITS, SHF_ALLOC, 0x80480d4, 0xd4, 0x15, 0x0, 0x0, 0x1, 0x0, 0x15}, + {".hash", SHT_HASH, SHF_ALLOC, 0x80480ec, 0xec, 0x90, 0x3, 0x0, 0x4, 0x4, 0x90}, + {".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x804817c, 0x17c, 0x110, 0x4, 0x1, 0x4, 0x10, 0x110}, + {".dynstr", SHT_STRTAB, SHF_ALLOC, 0x804828c, 0x28c, 0xbb, 0x0, 0x0, 0x1, 0x0, 0xbb}, + {".rel.plt", SHT_REL, SHF_ALLOC, 0x8048348, 0x348, 0x20, 0x3, 0x7, 0x4, 0x8, 0x20}, + {".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x8048368, 0x368, 0x11, 0x0, 0x0, 0x4, 0x0, 0x11}, + {".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804837c, 0x37c, 0x50, 0x0, 0x0, 0x4, 0x4, 0x50}, + {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x80483cc, 0x3cc, 0x180, 0x0, 0x0, 0x4, 0x0, 0x180}, + {".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804854c, 0x54c, 0xc, 0x0, 0x0, 0x4, 0x0, 0xc}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x8048558, 0x558, 0xa3, 0x0, 0x0, 0x1, 0x0, 0xa3}, + {".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80495fc, 0x5fc, 0xc, 0x0, 0x0, 0x4, 0x0, 0xc}, + {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x8049608, 0x608, 0x4, 0x0, 0x0, 0x4, 0x0, 0x4}, + {".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x804960c, 0x60c, 0x98, 0x4, 0x0, 0x4, 0x8, 0x98}, + {".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496a4, 0x6a4, 0x8, 0x0, 0x0, 0x4, 0x0, 0x8}, + {".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496ac, 0x6ac, 0x8, 0x0, 0x0, 0x4, 0x0, 0x8}, + {".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b4, 0x6b4, 0x4, 0x0, 0x0, 0x4, 0x0, 0x4}, + {".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b8, 0x6b8, 0x1c, 0x0, 0x0, 0x4, 0x4, 0x1c}, + {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x80496d4, 0x6d4, 0x20, 0x0, 0x0, 0x4, 0x0, 0x20}, + {".comment", SHT_PROGBITS, 0x0, 0x0, 0x6d4, 0x12d, 0x0, 0x0, 0x1, 0x0, 0x12d}, + {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x801, 0x20, 0x0, 0x0, 0x1, 0x0, 0x20}, + {".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0x821, 0x1b, 0x0, 0x0, 0x1, 0x0, 0x1b}, + {".debug_info", SHT_PROGBITS, 0x0, 0x0, 0x83c, 0x11d, 0x0, 0x0, 0x1, 0x0, 0x11d}, + {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0x959, 0x41, 0x0, 0x0, 0x1, 0x0, 0x41}, + {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x99a, 0x35, 0x0, 0x0, 0x1, 0x0, 0x35}, + {".debug_frame", SHT_PROGBITS, 0x0, 0x0, 0x9d0, 0x30, 0x0, 0x0, 0x4, 0x0, 0x30}, + {".debug_str", SHT_PROGBITS, 0x0, 0x0, 0xa00, 0xd, 0x0, 0x0, 0x1, 0x0, 0xd}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xa0d, 0xf8, 0x0, 0x0, 0x1, 0x0, 0xf8}, + {".symtab", SHT_SYMTAB, 0x0, 0x0, 0xfb8, 0x4b0, 0x1d, 0x38, 0x4, 0x10, 0x4b0}, + {".strtab", SHT_STRTAB, 0x0, 0x0, 0x1468, 0x206, 0x0, 0x0, 0x1, 0x0, 0x206}, + }, + []ProgHeader{ + {PT_PHDR, PF_R + PF_X, 0x34, 0x8048034, 0x8048034, 0xa0, 0xa0, 0x4}, + {PT_INTERP, PF_R, 0xd4, 0x80480d4, 0x80480d4, 0x15, 0x15, 0x1}, + {PT_LOAD, PF_R + PF_X, 0x0, 0x8048000, 0x8048000, 0x5fb, 0x5fb, 0x1000}, + {PT_LOAD, PF_R + PF_W, 0x5fc, 0x80495fc, 0x80495fc, 0xd8, 0xf8, 0x1000}, + {PT_DYNAMIC, PF_R + PF_W, 0x60c, 0x804960c, 0x804960c, 0x98, 0x98, 0x4}, + }, + []string{"libc.so.6"}, + }, + { + "testdata/gcc-amd64-linux-exec", + FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0, binary.LittleEndian, ET_EXEC, EM_X86_64, 0x4003e0}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".interp", SHT_PROGBITS, SHF_ALLOC, 0x400200, 0x200, 0x1c, 0x0, 0x0, 0x1, 0x0, 0x1c}, + {".note.ABI-tag", SHT_NOTE, SHF_ALLOC, 0x40021c, 0x21c, 0x20, 0x0, 0x0, 0x4, 0x0, 0x20}, + {".hash", SHT_HASH, SHF_ALLOC, 0x400240, 0x240, 0x24, 0x5, 0x0, 0x8, 0x4, 0x24}, + {".gnu.hash", SHT_LOOS + 268435446, SHF_ALLOC, 0x400268, 0x268, 0x1c, 0x5, 0x0, 0x8, 0x0, 0x1c}, + {".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x400288, 0x288, 0x60, 0x6, 0x1, 0x8, 0x18, 0x60}, + {".dynstr", SHT_STRTAB, SHF_ALLOC, 0x4002e8, 0x2e8, 0x3d, 0x0, 0x0, 0x1, 0x0, 0x3d}, + {".gnu.version", SHT_HIOS, SHF_ALLOC, 0x400326, 0x326, 0x8, 0x5, 0x0, 0x2, 0x2, 0x8}, + {".gnu.version_r", SHT_LOOS + 268435454, SHF_ALLOC, 0x400330, 0x330, 0x20, 0x6, 0x1, 0x8, 0x0, 0x20}, + {".rela.dyn", SHT_RELA, SHF_ALLOC, 0x400350, 0x350, 0x18, 0x5, 0x0, 0x8, 0x18, 0x18}, + {".rela.plt", SHT_RELA, SHF_ALLOC, 0x400368, 0x368, 0x30, 0x5, 0xc, 0x8, 0x18, 0x30}, + {".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400398, 0x398, 0x18, 0x0, 0x0, 0x4, 0x0, 0x18}, + {".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003b0, 0x3b0, 0x30, 0x0, 0x0, 0x4, 0x10, 0x30}, + {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003e0, 0x3e0, 0x1b4, 0x0, 0x0, 0x10, 0x0, 0x1b4}, + {".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400594, 0x594, 0xe, 0x0, 0x0, 0x4, 0x0, 0xe}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x4005a4, 0x5a4, 0x11, 0x0, 0x0, 0x4, 0x0, 0x11}, + {".eh_frame_hdr", SHT_PROGBITS, SHF_ALLOC, 0x4005b8, 0x5b8, 0x24, 0x0, 0x0, 0x4, 0x0, 0x24}, + {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x4005e0, 0x5e0, 0xa4, 0x0, 0x0, 0x8, 0x0, 0xa4}, + {".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600688, 0x688, 0x10, 0x0, 0x0, 0x8, 0x0, 0x10}, + {".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600698, 0x698, 0x10, 0x0, 0x0, 0x8, 0x0, 0x10}, + {".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x6006a8, 0x6a8, 0x8, 0x0, 0x0, 0x8, 0x0, 0x8}, + {".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x6006b0, 0x6b0, 0x1a0, 0x6, 0x0, 0x8, 0x10, 0x1a0}, + {".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600850, 0x850, 0x8, 0x0, 0x0, 0x8, 0x8, 0x8}, + {".got.plt", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600858, 0x858, 0x28, 0x0, 0x0, 0x8, 0x8, 0x28}, + {".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600880, 0x880, 0x18, 0x0, 0x0, 0x8, 0x0, 0x18}, + {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x600898, 0x898, 0x8, 0x0, 0x0, 0x4, 0x0, 0x8}, + {".comment", SHT_PROGBITS, 0x0, 0x0, 0x898, 0x126, 0x0, 0x0, 0x1, 0x0, 0x126}, + {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x9c0, 0x90, 0x0, 0x0, 0x10, 0x0, 0x90}, + {".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0xa50, 0x25, 0x0, 0x0, 0x1, 0x0, 0x25}, + {".debug_info", SHT_PROGBITS, 0x0, 0x0, 0xa75, 0x1a7, 0x0, 0x0, 0x1, 0x0, 0x1a7}, + {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0xc1c, 0x6f, 0x0, 0x0, 0x1, 0x0, 0x6f}, + {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0xc8b, 0x13f, 0x0, 0x0, 0x1, 0x0, 0x13f}, + {".debug_str", SHT_PROGBITS, SHF_MERGE + SHF_STRINGS, 0x0, 0xdca, 0xb1, 0x0, 0x0, 0x1, 0x1, 0xb1}, + {".debug_ranges", SHT_PROGBITS, 0x0, 0x0, 0xe80, 0x90, 0x0, 0x0, 0x10, 0x0, 0x90}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xf10, 0x149, 0x0, 0x0, 0x1, 0x0, 0x149}, + {".symtab", SHT_SYMTAB, 0x0, 0x0, 0x19a0, 0x6f0, 0x24, 0x39, 0x8, 0x18, 0x6f0}, + {".strtab", SHT_STRTAB, 0x0, 0x0, 0x2090, 0x1fc, 0x0, 0x0, 0x1, 0x0, 0x1fc}, + }, + []ProgHeader{ + {PT_PHDR, PF_R + PF_X, 0x40, 0x400040, 0x400040, 0x1c0, 0x1c0, 0x8}, + {PT_INTERP, PF_R, 0x200, 0x400200, 0x400200, 0x1c, 0x1c, 1}, + {PT_LOAD, PF_R + PF_X, 0x0, 0x400000, 0x400000, 0x684, 0x684, 0x200000}, + {PT_LOAD, PF_R + PF_W, 0x688, 0x600688, 0x600688, 0x210, 0x218, 0x200000}, + {PT_DYNAMIC, PF_R + PF_W, 0x6b0, 0x6006b0, 0x6006b0, 0x1a0, 0x1a0, 0x8}, + {PT_NOTE, PF_R, 0x21c, 0x40021c, 0x40021c, 0x20, 0x20, 0x4}, + {PT_LOOS + 0x474E550, PF_R, 0x5b8, 0x4005b8, 0x4005b8, 0x24, 0x24, 0x4}, + {PT_LOOS + 0x474E551, PF_R + PF_W, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8}, + }, + []string{"libc.so.6"}, + }, + { + "testdata/hello-world-core.gz", + FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0x0, binary.LittleEndian, ET_CORE, EM_X86_64, 0x0}, + []SectionHeader{}, + []ProgHeader{ + {Type: PT_NOTE, Flags: 0x0, Off: 0x3f8, Vaddr: 0x0, Paddr: 0x0, Filesz: 0x8ac, Memsz: 0x0, Align: 0x0}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x1000, Vaddr: 0x400000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_R, Off: 0x1000, Vaddr: 0x401000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x2000, Vaddr: 0x402000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3000, Vaddr: 0x7f54078b8000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1b5000, Align: 0x1000}, + {Type: PT_LOAD, Flags: 0x0, Off: 0x3000, Vaddr: 0x7f5407a6d000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1ff000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_R, Off: 0x3000, Vaddr: 0x7f5407c6c000, Paddr: 0x0, Filesz: 0x4000, Memsz: 0x4000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x7000, Vaddr: 0x7f5407c70000, Paddr: 0x0, Filesz: 0x2000, Memsz: 0x2000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x9000, Vaddr: 0x7f5407c72000, Paddr: 0x0, Filesz: 0x5000, Memsz: 0x5000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0xe000, Vaddr: 0x7f5407c77000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x22000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0xe000, Vaddr: 0x7f5407e81000, Paddr: 0x0, Filesz: 0x3000, Memsz: 0x3000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x11000, Vaddr: 0x7f5407e96000, Paddr: 0x0, Filesz: 0x3000, Memsz: 0x3000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_R, Off: 0x14000, Vaddr: 0x7f5407e99000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x15000, Vaddr: 0x7f5407e9a000, Paddr: 0x0, Filesz: 0x2000, Memsz: 0x2000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x17000, Vaddr: 0x7fff79972000, Paddr: 0x0, Filesz: 0x23000, Memsz: 0x23000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3a000, Vaddr: 0x7fff799f8000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3b000, Vaddr: 0xffffffffff600000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, + }, + nil, + }, + { + "testdata/compressed-32.obj", + FileHeader{ELFCLASS32, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0x0, binary.LittleEndian, ET_REL, EM_386, 0x0}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".text", SHT_PROGBITS, SHF_ALLOC | SHF_EXECINSTR, 0x0, 0x34, 0x17, 0x0, 0x0, 0x1, 0x0, 0x17}, + {".rel.text", SHT_REL, SHF_INFO_LINK, 0x0, 0x3dc, 0x10, 0x13, 0x1, 0x4, 0x8, 0x10}, + {".data", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC, 0x0, 0x4b, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".bss", SHT_NOBITS, SHF_WRITE | SHF_ALLOC, 0x0, 0x4b, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x0, 0x4b, 0xd, 0x0, 0x0, 0x1, 0x0, 0xd}, + {".debug_info", SHT_PROGBITS, SHF_COMPRESSED, 0x0, 0x58, 0xb4, 0x0, 0x0, 0x1, 0x0, 0x84}, + {".rel.debug_info", SHT_REL, SHF_INFO_LINK, 0x0, 0x3ec, 0xa0, 0x13, 0x6, 0x4, 0x8, 0xa0}, + {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0xdc, 0x5a, 0x0, 0x0, 0x1, 0x0, 0x5a}, + {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x136, 0x20, 0x0, 0x0, 0x1, 0x0, 0x20}, + {".rel.debug_aranges", SHT_REL, SHF_INFO_LINK, 0x0, 0x48c, 0x10, 0x13, 0x9, 0x4, 0x8, 0x10}, + {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x156, 0x5c, 0x0, 0x0, 0x1, 0x0, 0x5c}, + {".rel.debug_line", SHT_REL, SHF_INFO_LINK, 0x0, 0x49c, 0x8, 0x13, 0xb, 0x4, 0x8, 0x8}, + {".debug_str", SHT_PROGBITS, SHF_MERGE | SHF_STRINGS | SHF_COMPRESSED, 0x0, 0x1b2, 0x10f, 0x0, 0x0, 0x1, 0x1, 0xb3}, + {".comment", SHT_PROGBITS, SHF_MERGE | SHF_STRINGS, 0x0, 0x265, 0x2a, 0x0, 0x0, 0x1, 0x1, 0x2a}, + {".note.GNU-stack", SHT_PROGBITS, 0x0, 0x0, 0x28f, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x0, 0x290, 0x38, 0x0, 0x0, 0x4, 0x0, 0x38}, + {".rel.eh_frame", SHT_REL, SHF_INFO_LINK, 0x0, 0x4a4, 0x8, 0x13, 0x10, 0x4, 0x8, 0x8}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0x4ac, 0xab, 0x0, 0x0, 0x1, 0x0, 0xab}, + {".symtab", SHT_SYMTAB, 0x0, 0x0, 0x2c8, 0x100, 0x14, 0xe, 0x4, 0x10, 0x100}, + {".strtab", SHT_STRTAB, 0x0, 0x0, 0x3c8, 0x13, 0x0, 0x0, 0x1, 0x0, 0x13}, + }, + []ProgHeader{}, + nil, + }, + { + "testdata/compressed-64.obj", + FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0x0, binary.LittleEndian, ET_REL, EM_X86_64, 0x0}, + []SectionHeader{ + {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + {".text", SHT_PROGBITS, SHF_ALLOC | SHF_EXECINSTR, 0x0, 0x40, 0x1b, 0x0, 0x0, 0x1, 0x0, 0x1b}, + {".rela.text", SHT_RELA, SHF_INFO_LINK, 0x0, 0x488, 0x30, 0x13, 0x1, 0x8, 0x18, 0x30}, + {".data", SHT_PROGBITS, SHF_WRITE | SHF_ALLOC, 0x0, 0x5b, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".bss", SHT_NOBITS, SHF_WRITE | SHF_ALLOC, 0x0, 0x5b, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x0, 0x5b, 0xd, 0x0, 0x0, 0x1, 0x0, 0xd}, + {".debug_info", SHT_PROGBITS, SHF_COMPRESSED, 0x0, 0x68, 0xba, 0x0, 0x0, 0x1, 0x0, 0x72}, + {".rela.debug_info", SHT_RELA, SHF_INFO_LINK, 0x0, 0x4b8, 0x1c8, 0x13, 0x6, 0x8, 0x18, 0x1c8}, + {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0xda, 0x5c, 0x0, 0x0, 0x1, 0x0, 0x5c}, + {".debug_aranges", SHT_PROGBITS, SHF_COMPRESSED, 0x0, 0x136, 0x30, 0x0, 0x0, 0x1, 0x0, 0x2f}, + {".rela.debug_aranges", SHT_RELA, SHF_INFO_LINK, 0x0, 0x680, 0x30, 0x13, 0x9, 0x8, 0x18, 0x30}, + {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x165, 0x60, 0x0, 0x0, 0x1, 0x0, 0x60}, + {".rela.debug_line", SHT_RELA, SHF_INFO_LINK, 0x0, 0x6b0, 0x18, 0x13, 0xb, 0x8, 0x18, 0x18}, + {".debug_str", SHT_PROGBITS, SHF_MERGE | SHF_STRINGS | SHF_COMPRESSED, 0x0, 0x1c5, 0x104, 0x0, 0x0, 0x1, 0x1, 0xc3}, + {".comment", SHT_PROGBITS, SHF_MERGE | SHF_STRINGS, 0x0, 0x288, 0x2a, 0x0, 0x0, 0x1, 0x1, 0x2a}, + {".note.GNU-stack", SHT_PROGBITS, 0x0, 0x0, 0x2b2, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, + {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x0, 0x2b8, 0x38, 0x0, 0x0, 0x8, 0x0, 0x38}, + {".rela.eh_frame", SHT_RELA, SHF_INFO_LINK, 0x0, 0x6c8, 0x18, 0x13, 0x10, 0x8, 0x18, 0x18}, + {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0x6e0, 0xb0, 0x0, 0x0, 0x1, 0x0, 0xb0}, + {".symtab", SHT_SYMTAB, 0x0, 0x0, 0x2f0, 0x180, 0x14, 0xe, 0x8, 0x18, 0x180}, + {".strtab", SHT_STRTAB, 0x0, 0x0, 0x470, 0x13, 0x0, 0x0, 0x1, 0x0, 0x13}, + }, + []ProgHeader{}, + nil, + }, +} + +func TestOpen(t *testing.T) { + for i := range fileTests { + tt := &fileTests[i] + + var f *File + var err error + if path.Ext(tt.file) == ".gz" { + var r io.ReaderAt + if r, err = decompress(tt.file); err == nil { + f, err = NewFile(r) + } + } else { + f, err = Open(tt.file) + } + if err != nil { + t.Errorf("cannot open file %s: %v", tt.file, err) + continue + } + defer f.Close() + if !reflect.DeepEqual(f.FileHeader, tt.hdr) { + t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.FileHeader, tt.hdr) + continue + } + for i, s := range f.Sections { + if i >= len(tt.sections) { + break + } + sh := &tt.sections[i] + if !reflect.DeepEqual(&s.SectionHeader, sh) { + t.Errorf("open %s, section %d:\n\thave %#v\n\twant %#v\n", tt.file, i, &s.SectionHeader, sh) + } + } + for i, p := range f.Progs { + if i >= len(tt.progs) { + break + } + ph := &tt.progs[i] + if !reflect.DeepEqual(&p.ProgHeader, ph) { + t.Errorf("open %s, program %d:\n\thave %#v\n\twant %#v\n", tt.file, i, &p.ProgHeader, ph) + } + } + tn := len(tt.sections) + fn := len(f.Sections) + if tn != fn { + t.Errorf("open %s: len(Sections) = %d, want %d", tt.file, fn, tn) + } + tn = len(tt.progs) + fn = len(f.Progs) + if tn != fn { + t.Errorf("open %s: len(Progs) = %d, want %d", tt.file, fn, tn) + } + tl := tt.needed + fl, err := f.ImportedLibraries() + if err != nil { + t.Error(err) + } + if !reflect.DeepEqual(tl, fl) { + t.Errorf("open %s: DT_NEEDED = %v, want %v", tt.file, tl, fl) + } + } +} + +// elf.NewFile requires io.ReaderAt, which compress/gzip cannot +// provide. Decompress the file to a bytes.Reader. +func decompress(gz string) (io.ReaderAt, error) { + in, err := os.Open(gz) + if err != nil { + return nil, err + } + defer in.Close() + r, err := gzip.NewReader(in) + if err != nil { + return nil, err + } + var out bytes.Buffer + _, err = io.Copy(&out, r) + return bytes.NewReader(out.Bytes()), err +} + +type relocationTestEntry struct { + entryNumber int + entry *dwarf.Entry +} + +type relocationTest struct { + file string + entries []relocationTestEntry +} + +var relocationTests = []relocationTest{ + { + "testdata/go-relocation-test-gcc441-x86-64.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1"}, + {Attr: dwarf.AttrLanguage, Val: int64(1)}, + {Attr: dwarf.AttrName, Val: "go-relocation-test.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x6)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc441-x86.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1"}, + {Attr: dwarf.AttrLanguage, Val: int64(1)}, + {Attr: dwarf.AttrName, Val: "t.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x5)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc424-x86-64.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.2.4 (Ubuntu 4.2.4-1ubuntu4)"}, + {Attr: dwarf.AttrLanguage, Val: int64(1)}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc424.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x6)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc482-aarch64.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.8.2 -g -fstack-protector"}, + {Attr: dwarf.AttrLanguage, Val: int64(1)}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc482.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: int64(0x24)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc492-arm.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.9.2 20141224 (prerelease) -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mtls-dialect=gnu -g"}, + {Attr: dwarf.AttrLanguage, Val: int64(1)}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc492.c"}, + {Attr: dwarf.AttrCompDir, Val: "/root/go/src/debug/elf/testdata"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: int64(0x28)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-clang-arm.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)"}, + {Attr: dwarf.AttrLanguage, Val: int64(12)}, + {Attr: dwarf.AttrName, Val: "hello.c"}, + {Attr: dwarf.AttrStmtList, Val: int64(0x0)}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: int64(48)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc5-ppc.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 5.0.0 20150116 (experimental) -Asystem=linux -Asystem=unix -Asystem=posix -g"}, + {Attr: dwarf.AttrLanguage, Val: int64(12)}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc5-ppc.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: int64(0x44)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc482-ppc64le.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.8.2 -Asystem=linux -Asystem=unix -Asystem=posix -msecure-plt -mtune=power8 -mcpu=power7 -gdwarf-2 -fstack-protector"}, + {Attr: dwarf.AttrLanguage, Val: int64(1)}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc482-ppc64le.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x24)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc492-mips64.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.9.2 -meb -mabi=64 -march=mips3 -mtune=mips64 -mllsc -mno-shared -g"}, + {Attr: dwarf.AttrLanguage, Val: int64(1)}, + {Attr: dwarf.AttrName, Val: "hello.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: int64(100)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc531-s390x.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 5.3.1 20160316 -march=zEC12 -m64 -mzarch -g -fstack-protector-strong"}, + {Attr: dwarf.AttrLanguage, Val: int64(12)}, + {Attr: dwarf.AttrName, Val: "hello.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: int64(58)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc620-sparc64.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 6.2.0 20160914 -mcpu=v9 -g -fstack-protector-strong"}, + {Attr: dwarf.AttrLanguage, Val: int64(12)}, + {Attr: dwarf.AttrName, Val: "hello.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: int64(0x2c)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc492-mipsle.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.9.2 -mel -march=mips2 -mtune=mips32 -mllsc -mno-shared -mabi=32 -g"}, + {Attr: dwarf.AttrLanguage, Val: int64(1)}, + {Attr: dwarf.AttrName, Val: "hello.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: int64(0x58)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc540-mips.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 5.4.0 20160609 -meb -mips32 -mtune=mips32r2 -mfpxx -mllsc -mno-shared -mabi=32 -g -gdwarf-2"}, + {Attr: dwarf.AttrLanguage, Val: int64(12)}, + {Attr: dwarf.AttrName, Val: "hello.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x5c)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc493-mips64le.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C 4.9.3 -mel -mabi=64 -mllsc -mno-shared -g -fstack-protector-strong"}, + {Attr: dwarf.AttrLanguage, Val: int64(1)}, + {Attr: dwarf.AttrName, Val: "hello.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: int64(100)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-gcc720-riscv64.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "GNU C11 7.2.0 -march=rv64imafdc -mabi=lp64d -g -gdwarf-2"}, + {Attr: dwarf.AttrLanguage, Val: int64(12)}, + {Attr: dwarf.AttrName, Val: "hello.c"}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + {Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, + {Attr: dwarf.AttrHighpc, Val: uint64(0x2c)}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + }, + }}, + }, + }, + { + "testdata/go-relocation-test-clang-x86.obj", + []relocationTestEntry{ + {0, &dwarf.Entry{ + Offset: 0xb, + Tag: dwarf.TagCompileUnit, + Children: true, + Field: []dwarf.Field{ + {Attr: dwarf.AttrProducer, Val: "clang version google3-trunk (trunk r209387)"}, + {Attr: dwarf.AttrLanguage, Val: int64(12)}, + {Attr: dwarf.AttrName, Val: "go-relocation-test-clang.c"}, + {Attr: dwarf.AttrStmtList, Val: int64(0)}, + {Attr: dwarf.AttrCompDir, Val: "/tmp"}, + }, + }}, + }, + }, + { + "testdata/gcc-amd64-openbsd-debug-with-rela.obj", + []relocationTestEntry{ + {203, &dwarf.Entry{ + Offset: 0xc62, + Tag: dwarf.TagMember, + Children: false, + Field: []dwarf.Field{ + {Attr: dwarf.AttrName, Val: "it_interval"}, + {Attr: dwarf.AttrDeclFile, Val: int64(7)}, + {Attr: dwarf.AttrDeclLine, Val: int64(236)}, + {Attr: dwarf.AttrType, Val: dwarf.Offset(0xb7f)}, + {Attr: dwarf.AttrDataMemberLoc, Val: []byte{0x23, 0x0}}, + }, + }}, + {204, &dwarf.Entry{ + Offset: 0xc70, + Tag: dwarf.TagMember, + Children: false, + Field: []dwarf.Field{ + {Attr: dwarf.AttrName, Val: "it_value"}, + {Attr: dwarf.AttrDeclFile, Val: int64(7)}, + {Attr: dwarf.AttrDeclLine, Val: int64(237)}, + {Attr: dwarf.AttrType, Val: dwarf.Offset(0xb7f)}, + {Attr: dwarf.AttrDataMemberLoc, Val: []byte{0x23, 0x10}}, + }, + }}, + }, + }, +} + +func TestDWARFRelocations(t *testing.T) { + for i, test := range relocationTests { + f, err := Open(test.file) + if err != nil { + t.Error(err) + continue + } + dwarf, err := f.DWARF() + if err != nil { + t.Error(err) + continue + } + for _, testEntry := range test.entries { + reader := dwarf.Reader() + for j := 0; j < testEntry.entryNumber; j++ { + entry, err := reader.Next() + if entry == nil || err != nil { + t.Errorf("Failed to skip to entry %d: %v", testEntry.entryNumber, err) + continue + } + } + entry, err := reader.Next() + if err != nil { + t.Error(err) + continue + } + if !reflect.DeepEqual(testEntry.entry, entry) { + t.Errorf("#%d/%d: mismatch: got:%#v want:%#v", i, testEntry.entryNumber, entry, testEntry.entry) + continue + } + } + } +} + +func TestCompressedDWARF(t *testing.T) { + // Test file built with GCC 4.8.4 and as 2.24 using: + // gcc -Wa,--compress-debug-sections -g -c -o zdebug-test-gcc484-x86-64.obj hello.c + f, err := Open("testdata/zdebug-test-gcc484-x86-64.obj") + if err != nil { + t.Fatal(err) + } + dwarf, err := f.DWARF() + if err != nil { + t.Fatal(err) + } + reader := dwarf.Reader() + n := 0 + for { + entry, err := reader.Next() + if err != nil { + t.Fatal(err) + } + if entry == nil { + break + } + n++ + } + if n != 18 { + t.Fatalf("want %d DWARF entries, got %d", 18, n) + } +} + +func TestCompressedSection(t *testing.T) { + // Test files built with gcc -g -S hello.c and assembled with + // --compress-debug-sections=zlib-gabi. + f, err := Open("testdata/compressed-64.obj") + if err != nil { + t.Fatal(err) + } + sec := f.Section(".debug_info") + wantData := []byte{ + 182, 0, 0, 0, 4, 0, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 7, + 0, 0, 0, 0, 2, 1, 8, 0, 0, 0, 0, 2, 2, 7, 0, 0, + 0, 0, 2, 4, 7, 0, 0, 0, 0, 2, 1, 6, 0, 0, 0, 0, + 2, 2, 5, 0, 0, 0, 0, 3, 4, 5, 105, 110, 116, 0, 2, 8, + 5, 0, 0, 0, 0, 2, 8, 7, 0, 0, 0, 0, 4, 8, 114, 0, + 0, 0, 2, 1, 6, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1, 4, + 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, + 1, 156, 179, 0, 0, 0, 6, 0, 0, 0, 0, 1, 4, 87, 0, 0, + 0, 2, 145, 108, 6, 0, 0, 0, 0, 1, 4, 179, 0, 0, 0, 2, + 145, 96, 0, 4, 8, 108, 0, 0, 0, 0, + } + + // Test Data method. + b, err := sec.Data() + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(wantData, b) { + t.Fatalf("want data %x, got %x", wantData, b) + } + + // Test Open method and seeking. + buf, have, count := make([]byte, len(b)), make([]bool, len(b)), 0 + sf := sec.Open() + if got, err := sf.Seek(0, io.SeekEnd); got != int64(len(b)) || err != nil { + t.Fatalf("want seek end %d, got %d error %v", len(b), got, err) + } + if n, err := sf.Read(buf); n != 0 || err != io.EOF { + t.Fatalf("want EOF with 0 bytes, got %v with %d bytes", err, n) + } + pos := int64(len(buf)) + for count < len(buf) { + // Construct random seek arguments. + whence := rand.Intn(3) + target := rand.Int63n(int64(len(buf))) + var offset int64 + switch whence { + case io.SeekStart: + offset = target + case io.SeekCurrent: + offset = target - pos + case io.SeekEnd: + offset = target - int64(len(buf)) + } + pos, err = sf.Seek(offset, whence) + if err != nil { + t.Fatal(err) + } + if pos != target { + t.Fatalf("want position %d, got %d", target, pos) + } + + // Read data from the new position. + end := pos + 16 + if end > int64(len(buf)) { + end = int64(len(buf)) + } + n, err := io.ReadFull(sf, buf[pos:end]) + if err != nil { + t.Fatal(err) + } + for i := 0; i < n; i++ { + if !have[pos] { + have[pos] = true + count++ + } + pos++ + } + } + if !bytes.Equal(wantData, buf) { + t.Fatalf("want data %x, got %x", wantData, buf) + } +} + +func TestNoSectionOverlaps(t *testing.T) { + // Ensure cmd/link outputs sections without overlaps. + switch runtime.GOOS { + case "android", "darwin", "js", "nacl", "plan9", "windows": + t.Skipf("cmd/link doesn't produce ELF binaries on %s", runtime.GOOS) + } + _ = net.ResolveIPAddr // force dynamic linkage + f, err := Open(os.Args[0]) + if err != nil { + t.Error(err) + return + } + for i, si := range f.Sections { + sih := si.SectionHeader + if sih.Type == SHT_NOBITS { + continue + } + for j, sj := range f.Sections { + sjh := sj.SectionHeader + if i == j || sjh.Type == SHT_NOBITS || sih.Offset == sjh.Offset && sih.Size == 0 { + continue + } + if sih.Offset >= sjh.Offset && sih.Offset < sjh.Offset+sjh.Size { + t.Errorf("ld produced ELF with section %s within %s: 0x%x <= 0x%x..0x%x < 0x%x", + sih.Name, sjh.Name, sjh.Offset, sih.Offset, sih.Offset+sih.Size, sjh.Offset+sjh.Size) + } + } + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/reader.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/reader.go new file mode 100644 index 000000000..bfb893fe9 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/reader.go @@ -0,0 +1,118 @@ +// 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. + +package elf + +import ( + "io" + "os" +) + +// errorReader returns error from all operations. +type errorReader struct { + error +} + +func (r errorReader) Read(p []byte) (n int, err error) { + return 0, r.error +} + +func (r errorReader) ReadAt(p []byte, off int64) (n int, err error) { + return 0, r.error +} + +func (r errorReader) Seek(offset int64, whence int) (int64, error) { + return 0, r.error +} + +func (r errorReader) Close() error { + return r.error +} + +// readSeekerFromReader converts an io.Reader into an io.ReadSeeker. +// In general Seek may not be efficient, but it is optimized for +// common cases such as seeking to the end to find the length of the +// data. +type readSeekerFromReader struct { + reset func() (io.Reader, error) + r io.Reader + size int64 + offset int64 +} + +func (r *readSeekerFromReader) start() { + x, err := r.reset() + if err != nil { + r.r = errorReader{err} + } else { + r.r = x + } + r.offset = 0 +} + +func (r *readSeekerFromReader) Read(p []byte) (n int, err error) { + if r.r == nil { + r.start() + } + n, err = r.r.Read(p) + r.offset += int64(n) + return n, err +} + +func (r *readSeekerFromReader) Seek(offset int64, whence int) (int64, error) { + var newOffset int64 + switch whence { + case seekStart: + newOffset = offset + case seekCurrent: + newOffset = r.offset + offset + case seekEnd: + newOffset = r.size + offset + default: + return 0, os.ErrInvalid + } + + switch { + case newOffset == r.offset: + return newOffset, nil + + case newOffset < 0, newOffset > r.size: + return 0, os.ErrInvalid + + case newOffset == 0: + r.r = nil + + case newOffset == r.size: + r.r = errorReader{io.EOF} + + default: + if newOffset < r.offset { + // Restart at the beginning. + r.start() + } + // Read until we reach offset. + var buf [512]byte + for r.offset < newOffset { + b := buf[:] + if newOffset-r.offset < int64(len(buf)) { + b = buf[:newOffset-r.offset] + } + if _, err := r.Read(b); err != nil { + return 0, err + } + } + } + r.offset = newOffset + return r.offset, nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/symbols_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/symbols_test.go new file mode 100644 index 000000000..1eac61fd6 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/symbols_test.go @@ -0,0 +1,846 @@ +// 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. + +// +build go1.7 + +package elf + +import ( + "io" + "path" + "reflect" + "testing" +) + +// TODO: remove duplicate code +func TestSymbols(t *testing.T) { + do := func(file string, ts []Symbol, getfunc func(*File) ([]Symbol, error)) { + var f *File + var err error + if path.Ext(file) == ".gz" { + var r io.ReaderAt + if r, err = decompress(file); err == nil { + f, err = NewFile(r) + } + } else { + f, err = Open(file) + } + if err != nil { + t.Errorf("TestSymbols: cannot open file %s: %v", file, err) + return + } + defer f.Close() + fs, err := getfunc(f) + if err != nil && err != ErrNoSymbols { + t.Error(err) + return + } else if err == ErrNoSymbols { + fs = []Symbol{} + } + if !reflect.DeepEqual(ts, fs) { + t.Errorf("%s: Symbols = %v, want %v", file, ts, fs) + } + } + for file, ts := range symbolsGolden { + do(file, ts, (*File).Symbols) + } + for file, ts := range dynamicSymbolsGolden { + do(file, ts, (*File).DynamicSymbols) + } +} + +// golden symbol table data generated by testdata/getgoldsym.c + +var symbolsGolden = map[string][]Symbol{ + "testdata/gcc-amd64-linux-exec": { + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x1, + Value: 0x400200, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x2, + Value: 0x40021C, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x3, + Value: 0x400240, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x4, + Value: 0x400268, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x5, + Value: 0x400288, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x6, + Value: 0x4002E8, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x7, + Value: 0x400326, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x8, + Value: 0x400330, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x9, + Value: 0x400350, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xA, + Value: 0x400368, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xB, + Value: 0x400398, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xC, + Value: 0x4003B0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xD, + Value: 0x4003E0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xE, + Value: 0x400594, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xF, + Value: 0x4005A4, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x10, + Value: 0x4005B8, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x11, + Value: 0x4005E0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x12, + Value: 0x600688, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x13, + Value: 0x600698, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x14, + Value: 0x6006A8, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x15, + Value: 0x6006B0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x16, + Value: 0x600850, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x17, + Value: 0x600858, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x18, + Value: 0x600880, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x19, + Value: 0x600898, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x1A, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x1B, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x1C, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x1D, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x1E, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x1F, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x20, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x21, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "init.c", + Info: 0x4, + Other: 0x0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "initfini.c", + Info: 0x4, + Other: 0x0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "call_gmon_start", + Info: 0x2, + Other: 0x0, + Section: 0xD, + Value: 0x40040C, + Size: 0x0, + }, + Symbol{ + Name: "crtstuff.c", + Info: 0x4, + Other: 0x0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "__CTOR_LIST__", + Info: 0x1, + Other: 0x0, + Section: 0x12, + Value: 0x600688, + Size: 0x0, + }, + Symbol{ + Name: "__DTOR_LIST__", + Info: 0x1, + Other: 0x0, + Section: 0x13, + Value: 0x600698, + Size: 0x0, + }, + Symbol{ + Name: "__JCR_LIST__", + Info: 0x1, + Other: 0x0, + Section: 0x14, + Value: 0x6006A8, + Size: 0x0, + }, + Symbol{ + Name: "__do_global_dtors_aux", + Info: 0x2, + Other: 0x0, + Section: 0xD, + Value: 0x400430, + Size: 0x0, + }, + Symbol{ + Name: "completed.6183", + Info: 0x1, + Other: 0x0, + Section: 0x19, + Value: 0x600898, + Size: 0x1, + }, + Symbol{ + Name: "p.6181", + Info: 0x1, + Other: 0x0, + Section: 0x18, + Value: 0x600890, + Size: 0x0, + }, + Symbol{ + Name: "frame_dummy", + Info: 0x2, + Other: 0x0, + Section: 0xD, + Value: 0x400470, + Size: 0x0, + }, + Symbol{ + Name: "crtstuff.c", + Info: 0x4, + Other: 0x0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "__CTOR_END__", + Info: 0x1, + Other: 0x0, + Section: 0x12, + Value: 0x600690, + Size: 0x0, + }, + Symbol{ + Name: "__DTOR_END__", + Info: 0x1, + Other: 0x0, + Section: 0x13, + Value: 0x6006A0, + Size: 0x0, + }, + Symbol{ + Name: "__FRAME_END__", + Info: 0x1, + Other: 0x0, + Section: 0x11, + Value: 0x400680, + Size: 0x0, + }, + Symbol{ + Name: "__JCR_END__", + Info: 0x1, + Other: 0x0, + Section: 0x14, + Value: 0x6006A8, + Size: 0x0, + }, + Symbol{ + Name: "__do_global_ctors_aux", + Info: 0x2, + Other: 0x0, + Section: 0xD, + Value: 0x400560, + Size: 0x0, + }, + Symbol{ + Name: "initfini.c", + Info: 0x4, + Other: 0x0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "hello.c", + Info: 0x4, + Other: 0x0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "_GLOBAL_OFFSET_TABLE_", + Info: 0x1, + Other: 0x2, + Section: 0x17, + Value: 0x600858, + Size: 0x0, + }, + Symbol{ + Name: "__init_array_end", + Info: 0x0, + Other: 0x2, + Section: 0x12, + Value: 0x600684, + Size: 0x0, + }, + Symbol{ + Name: "__init_array_start", + Info: 0x0, + Other: 0x2, + Section: 0x12, + Value: 0x600684, + Size: 0x0, + }, + Symbol{ + Name: "_DYNAMIC", + Info: 0x1, + Other: 0x2, + Section: 0x15, + Value: 0x6006B0, + Size: 0x0, + }, + Symbol{ + Name: "data_start", + Info: 0x20, + Other: 0x0, + Section: 0x18, + Value: 0x600880, + Size: 0x0, + }, + Symbol{ + Name: "__libc_csu_fini", + Info: 0x12, + Other: 0x0, + Section: 0xD, + Value: 0x4004C0, + Size: 0x2, + }, + Symbol{ + Name: "_start", + Info: 0x12, + Other: 0x0, + Section: 0xD, + Value: 0x4003E0, + Size: 0x0, + }, + Symbol{ + Name: "__gmon_start__", + Info: 0x20, + Other: 0x0, + Section: 0x0, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "_Jv_RegisterClasses", + Info: 0x20, + Other: 0x0, + Section: 0x0, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "puts@@GLIBC_2.2.5", + Info: 0x12, + Other: 0x0, + Section: 0x0, + Value: 0x0, + Size: 0x18C, + }, + Symbol{ + Name: "_fini", + Info: 0x12, + Other: 0x0, + Section: 0xE, + Value: 0x400594, + Size: 0x0, + }, + Symbol{ + Name: "__libc_start_main@@GLIBC_2.2.5", + Info: 0x12, + Other: 0x0, + Section: 0x0, + Value: 0x0, + Size: 0x1C2, + }, + Symbol{ + Name: "_IO_stdin_used", + Info: 0x11, + Other: 0x0, + Section: 0xF, + Value: 0x4005A4, + Size: 0x4, + }, + Symbol{ + Name: "__data_start", + Info: 0x10, + Other: 0x0, + Section: 0x18, + Value: 0x600880, + Size: 0x0, + }, + Symbol{ + Name: "__dso_handle", + Info: 0x11, + Other: 0x2, + Section: 0x18, + Value: 0x600888, + Size: 0x0, + }, + Symbol{ + Name: "__libc_csu_init", + Info: 0x12, + Other: 0x0, + Section: 0xD, + Value: 0x4004D0, + Size: 0x89, + }, + Symbol{ + Name: "__bss_start", + Info: 0x10, + Other: 0x0, + Section: 0xFFF1, + Value: 0x600898, + Size: 0x0, + }, + Symbol{ + Name: "_end", + Info: 0x10, + Other: 0x0, + Section: 0xFFF1, + Value: 0x6008A0, + Size: 0x0, + }, + Symbol{ + Name: "_edata", + Info: 0x10, + Other: 0x0, + Section: 0xFFF1, + Value: 0x600898, + Size: 0x0, + }, + Symbol{ + Name: "main", + Info: 0x12, + Other: 0x0, + Section: 0xD, + Value: 0x400498, + Size: 0x1B, + }, + Symbol{ + Name: "_init", + Info: 0x12, + Other: 0x0, + Section: 0xB, + Value: 0x400398, + Size: 0x0, + }, + }, + "testdata/go-relocation-test-clang-x86.obj": { + Symbol{ + Name: "go-relocation-test-clang.c", + Info: 0x4, + Other: 0x0, + Section: 0xFFF1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string0", + Info: 0x0, + Other: 0x0, + Section: 0xC, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string1", + Info: 0x0, + Other: 0x0, + Section: 0xC, + Value: 0x2C, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string2", + Info: 0x0, + Other: 0x0, + Section: 0xC, + Value: 0x47, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string3", + Info: 0x0, + Other: 0x0, + Section: 0xC, + Value: 0x4C, + Size: 0x0, + }, + Symbol{ + Name: ".Linfo_string4", + Info: 0x0, + Other: 0x0, + Section: 0xC, + Value: 0x4E, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x1, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x2, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x3, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x4, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x6, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x7, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x8, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xA, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xC, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xD, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xE, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0xF, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "", + Info: 0x3, + Other: 0x0, + Section: 0x10, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "v", + Info: 0x11, + Other: 0x0, + Section: 0xFFF2, + Value: 0x4, + Size: 0x4, + }, + }, + "testdata/hello-world-core.gz": {}, +} + +var dynamicSymbolsGolden = map[string][]Symbol{ + "testdata/gcc-amd64-linux-exec": { + Symbol{ + Name: "__gmon_start__", + Info: 0x20, + Other: 0x0, + Section: 0x0, + Value: 0x0, + Size: 0x0, + }, + Symbol{ + Name: "puts", + Info: 0x12, + Other: 0x0, + Section: 0x0, + Value: 0x0, + Size: 0x18C, + }, + Symbol{ + Name: "__libc_start_main", + Info: 0x12, + Other: 0x0, + Section: 0x0, + Value: 0x0, + Size: 0x1C2, + }, + }, + "testdata/go-relocation-test-clang-x86.obj": {}, + "testdata/hello-world-core.gz": {}, +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/compressed-32.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/compressed-32.obj new file mode 100755 index 000000000..2bfdb4424 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/compressed-32.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/compressed-64.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/compressed-64.obj new file mode 100755 index 000000000..ffae56a93 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/compressed-64.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/gcc-386-freebsd-exec b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/gcc-386-freebsd-exec new file mode 100755 index 000000000..7af9c58ca Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/gcc-386-freebsd-exec differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/gcc-amd64-linux-exec b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/gcc-amd64-linux-exec new file mode 100755 index 000000000..c6cb1de28 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/gcc-amd64-linux-exec differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj new file mode 100755 index 000000000..f62b1ea1c Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-clang-arm.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-clang-arm.obj new file mode 100755 index 000000000..1cc7e4b11 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-clang-arm.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-clang-x86.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-clang-x86.obj new file mode 100755 index 000000000..e909cf4e6 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-clang-x86.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj new file mode 100755 index 000000000..a7c6d6e56 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj new file mode 100755 index 000000000..2d37ab6e6 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc441-x86.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc441-x86.obj new file mode 100755 index 000000000..0d59fe303 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc441-x86.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj new file mode 100755 index 000000000..849e2644e Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc482-ppc64le.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc482-ppc64le.obj new file mode 100755 index 000000000..dad744548 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc482-ppc64le.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc492-arm.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc492-arm.obj new file mode 100755 index 000000000..ed45be2c5 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc492-arm.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc492-mips64.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc492-mips64.obj new file mode 100755 index 000000000..68febe18f Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc492-mips64.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc492-mipsle.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc492-mipsle.obj new file mode 100755 index 000000000..a5fbcfbbd Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc492-mipsle.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc493-mips64le.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc493-mips64le.obj new file mode 100755 index 000000000..20bbd6c4e Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc493-mips64le.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj new file mode 100755 index 000000000..f4165af09 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc531-s390x.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc531-s390x.obj new file mode 100755 index 000000000..caacb9b90 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc531-s390x.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc540-mips.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc540-mips.obj new file mode 100755 index 000000000..270c77759 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc540-mips.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc620-sparc64.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc620-sparc64.obj new file mode 100755 index 000000000..d65c23e1c Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc620-sparc64.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc720-riscv64.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc720-riscv64.obj new file mode 100755 index 000000000..91ae6487a Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/go-relocation-test-gcc720-riscv64.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/hello-world-core.gz b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/hello-world-core.gz new file mode 100755 index 000000000..6d76ab093 Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/hello-world-core.gz differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/hello.c b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/hello.c new file mode 100755 index 000000000..34d9ee792 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/hello.c @@ -0,0 +1,7 @@ +#include + +void +main(int argc, char *argv[]) +{ + printf("hello, world\n"); +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/zdebug-test-gcc484-x86-64.obj b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/zdebug-test-gcc484-x86-64.obj new file mode 100755 index 000000000..a595a01df Binary files /dev/null and b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/testdata/zdebug-test-gcc484-x86-64.obj differ diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclinetest.asm b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclinetest.asm new file mode 100644 index 000000000..b9ee9c0a5 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclinetest.asm @@ -0,0 +1,58 @@ +TEXT linefrompc(SB),4,$0 // Each byte stores its line delta +BYTE $2; +BYTE $1; +BYTE $1; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; +BYTE $1; +BYTE $1; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; +#include "pclinetest.h" +BYTE $2; +#include "pclinetest.h" +BYTE $2; +BYTE $255; + +TEXT pcfromline(SB),4,$0 // Each record stores its line delta, then n, then n more bytes +BYTE $32; BYTE $0; +BYTE $1; BYTE $1; BYTE $0; +BYTE $1; BYTE $0; + +BYTE $2; BYTE $4; BYTE $0; BYTE $0; BYTE $0; BYTE $0; + + +#include "pclinetest.h" +BYTE $4; BYTE $0; + + +BYTE $3; BYTE $3; BYTE $0; BYTE $0; BYTE $0; +#include "pclinetest.h" + + +BYTE $4; BYTE $3; BYTE $0; BYTE $0; BYTE $0; +BYTE $255; + +// Keep the linker happy +TEXT main·main(SB),4,$0 + RET + +TEXT main·init(SB),4,$0 + // Prevent GC of our test symbols + CALL linefrompc(SB) + CALL pcfromline(SB) + RET diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclinetest.h b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclinetest.h new file mode 100644 index 000000000..156c0b87b --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclinetest.h @@ -0,0 +1,9 @@ +// +build ignore + +// Empty include file to generate z symbols + + + + + +// EOF diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclntab.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclntab.go new file mode 100644 index 000000000..dcd7015bb --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclntab.go @@ -0,0 +1,472 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* + * Line tables + */ + +package gosym + +import ( + "encoding/binary" + "sync" +) + +// A LineTable is a data structure mapping program counters to line numbers. +// +// In Go 1.1 and earlier, each function (represented by a Func) had its own LineTable, +// and the line number corresponded to a numbering of all source lines in the +// program, across all files. That absolute line number would then have to be +// converted separately to a file name and line number within the file. +// +// In Go 1.2, the format of the data changed so that there is a single LineTable +// for the entire program, shared by all Funcs, and there are no absolute line +// numbers, just line numbers within specific files. +// +// For the most part, LineTable's methods should be treated as an internal +// detail of the package; callers should use the methods on Table instead. +type LineTable struct { + Data []byte + PC uint64 + Line int + + // Go 1.2 state + mu sync.Mutex + go12 int // is this in Go 1.2 format? -1 no, 0 unknown, 1 yes + binary binary.ByteOrder + quantum uint32 + ptrsize uint32 + functab []byte + nfunctab uint32 + filetab []byte + nfiletab uint32 + fileMap map[string]uint32 +} + +// NOTE(rsc): This is wrong for GOARCH=arm, which uses a quantum of 4, +// but we have no idea whether we're using arm or not. This only +// matters in the old (pre-Go 1.2) symbol table format, so it's not worth +// fixing. +const oldQuantum = 1 + +func (t *LineTable) parse(targetPC uint64, targetLine int) (b []byte, pc uint64, line int) { + // The PC/line table can be thought of as a sequence of + // * + // batches. Each update batch results in a (pc, line) pair, + // where line applies to every PC from pc up to but not + // including the pc of the next pair. + // + // Here we process each update individually, which simplifies + // the code, but makes the corner cases more confusing. + b, pc, line = t.Data, t.PC, t.Line + for pc <= targetPC && line != targetLine && len(b) > 0 { + code := b[0] + b = b[1:] + switch { + case code == 0: + if len(b) < 4 { + b = b[0:0] + break + } + val := binary.BigEndian.Uint32(b) + b = b[4:] + line += int(val) + case code <= 64: + line += int(code) + case code <= 128: + line -= int(code - 64) + default: + pc += oldQuantum * uint64(code-128) + continue + } + pc += oldQuantum + } + return b, pc, line +} + +func (t *LineTable) slice(pc uint64) *LineTable { + data, pc, line := t.parse(pc, -1) + return &LineTable{Data: data, PC: pc, Line: line} +} + +// PCToLine returns the line number for the given program counter. +// Callers should use Table's PCToLine method instead. +func (t *LineTable) PCToLine(pc uint64) int { + if t.isGo12() { + return t.go12PCToLine(pc) + } + _, _, line := t.parse(pc, -1) + return line +} + +// LineToPC returns the program counter for the given line number, +// considering only program counters before maxpc. +// Callers should use Table's LineToPC method instead. +func (t *LineTable) LineToPC(line int, maxpc uint64) uint64 { + if t.isGo12() { + return 0 + } + _, pc, line1 := t.parse(maxpc, line) + if line1 != line { + return 0 + } + // Subtract quantum from PC to account for post-line increment + return pc - oldQuantum +} + +// NewLineTable returns a new PC/line table +// corresponding to the encoded data. +// Text must be the start address of the +// corresponding text segment. +func NewLineTable(data []byte, text uint64) *LineTable { + return &LineTable{Data: data, PC: text, Line: 0} +} + +// Go 1.2 symbol table format. +// See golang.org/s/go12symtab. +// +// A general note about the methods here: rather than try to avoid +// index out of bounds errors, we trust Go to detect them, and then +// we recover from the panics and treat them as indicative of a malformed +// or incomplete table. +// +// The methods called by symtab.go, which begin with "go12" prefixes, +// are expected to have that recovery logic. + +// isGo12 reports whether this is a Go 1.2 (or later) symbol table. +func (t *LineTable) isGo12() bool { + t.go12Init() + return t.go12 == 1 +} + +const go12magic = 0xfffffffb + +// uintptr returns the pointer-sized value encoded at b. +// The pointer size is dictated by the table being read. +func (t *LineTable) uintptr(b []byte) uint64 { + if t.ptrsize == 4 { + return uint64(t.binary.Uint32(b)) + } + return t.binary.Uint64(b) +} + +// go12init initializes the Go 1.2 metadata if t is a Go 1.2 symbol table. +func (t *LineTable) go12Init() { + t.mu.Lock() + defer t.mu.Unlock() + if t.go12 != 0 { + return + } + + defer func() { + // If we panic parsing, assume it's not a Go 1.2 symbol table. + recover() + }() + + // Check header: 4-byte magic, two zeros, pc quantum, pointer size. + t.go12 = -1 // not Go 1.2 until proven otherwise + if len(t.Data) < 16 || t.Data[4] != 0 || t.Data[5] != 0 || + (t.Data[6] != 1 && t.Data[6] != 4) || // pc quantum + (t.Data[7] != 4 && t.Data[7] != 8) { // pointer size + return + } + + switch uint32(go12magic) { + case binary.LittleEndian.Uint32(t.Data): + t.binary = binary.LittleEndian + case binary.BigEndian.Uint32(t.Data): + t.binary = binary.BigEndian + default: + return + } + + t.quantum = uint32(t.Data[6]) + t.ptrsize = uint32(t.Data[7]) + + t.nfunctab = uint32(t.uintptr(t.Data[8:])) + t.functab = t.Data[8+t.ptrsize:] + functabsize := t.nfunctab*2*t.ptrsize + t.ptrsize + fileoff := t.binary.Uint32(t.functab[functabsize:]) + t.functab = t.functab[:functabsize] + t.filetab = t.Data[fileoff:] + t.nfiletab = t.binary.Uint32(t.filetab) + t.filetab = t.filetab[:t.nfiletab*4] + + t.go12 = 1 // so far so good +} + +// go12Funcs returns a slice of Funcs derived from the Go 1.2 pcln table. +func (t *LineTable) go12Funcs() []Func { + // Assume it is malformed and return nil on error. + defer func() { + recover() + }() + + n := len(t.functab) / int(t.ptrsize) / 2 + funcs := make([]Func, n) + for i := range funcs { + f := &funcs[i] + f.Entry = uint64(t.uintptr(t.functab[2*i*int(t.ptrsize):])) + f.End = uint64(t.uintptr(t.functab[(2*i+2)*int(t.ptrsize):])) + info := t.Data[t.uintptr(t.functab[(2*i+1)*int(t.ptrsize):]):] + f.LineTable = t + f.FrameSize = int(t.binary.Uint32(info[t.ptrsize+2*4:])) + f.Sym = &Sym{ + Value: f.Entry, + Type: 'T', + Name: t.string(t.binary.Uint32(info[t.ptrsize:])), + GoType: 0, + Func: f, + } + } + return funcs +} + +// findFunc returns the func corresponding to the given program counter. +func (t *LineTable) findFunc(pc uint64) []byte { + if pc < t.uintptr(t.functab) || pc >= t.uintptr(t.functab[len(t.functab)-int(t.ptrsize):]) { + return nil + } + + // The function table is a list of 2*nfunctab+1 uintptrs, + // alternating program counters and offsets to func structures. + f := t.functab + nf := t.nfunctab + for nf > 0 { + m := nf / 2 + fm := f[2*t.ptrsize*m:] + if t.uintptr(fm) <= pc && pc < t.uintptr(fm[2*t.ptrsize:]) { + return t.Data[t.uintptr(fm[t.ptrsize:]):] + } else if pc < t.uintptr(fm) { + nf = m + } else { + f = f[(m+1)*2*t.ptrsize:] + nf -= m + 1 + } + } + return nil +} + +// readvarint reads, removes, and returns a varint from *pp. +func (t *LineTable) readvarint(pp *[]byte) uint32 { + var v, shift uint32 + p := *pp + for shift = 0; ; shift += 7 { + b := p[0] + p = p[1:] + v |= (uint32(b) & 0x7F) << shift + if b&0x80 == 0 { + break + } + } + *pp = p + return v +} + +// string returns a Go string found at off. +func (t *LineTable) string(off uint32) string { + for i := off; ; i++ { + if t.Data[i] == 0 { + return string(t.Data[off:i]) + } + } +} + +// step advances to the next pc, value pair in the encoded table. +func (t *LineTable) step(p *[]byte, pc *uint64, val *int32, first bool) bool { + uvdelta := t.readvarint(p) + if uvdelta == 0 && !first { + return false + } + if uvdelta&1 != 0 { + uvdelta = ^(uvdelta >> 1) + } else { + uvdelta >>= 1 + } + vdelta := int32(uvdelta) + pcdelta := t.readvarint(p) * t.quantum + *pc += uint64(pcdelta) + *val += vdelta + return true +} + +// pcvalue reports the value associated with the target pc. +// off is the offset to the beginning of the pc-value table, +// and entry is the start PC for the corresponding function. +func (t *LineTable) pcvalue(off uint32, entry, targetpc uint64) int32 { + if off == 0 { + return -1 + } + p := t.Data[off:] + + val := int32(-1) + pc := entry + for t.step(&p, &pc, &val, pc == entry) { + if targetpc < pc { + return val + } + } + return -1 +} + +// findFileLine scans one function in the binary looking for a +// program counter in the given file on the given line. +// It does so by running the pc-value tables mapping program counter +// to file number. Since most functions come from a single file, these +// are usually short and quick to scan. If a file match is found, then the +// code goes to the expense of looking for a simultaneous line number match. +func (t *LineTable) findFileLine(entry uint64, filetab, linetab uint32, filenum, line int32) uint64 { + if filetab == 0 || linetab == 0 { + return 0 + } + + fp := t.Data[filetab:] + fl := t.Data[linetab:] + fileVal := int32(-1) + filePC := entry + lineVal := int32(-1) + linePC := entry + fileStartPC := filePC + for t.step(&fp, &filePC, &fileVal, filePC == entry) { + if fileVal == filenum && fileStartPC < filePC { + // fileVal is in effect starting at fileStartPC up to + // but not including filePC, and it's the file we want. + // Run the PC table looking for a matching line number + // or until we reach filePC. + lineStartPC := linePC + for linePC < filePC && t.step(&fl, &linePC, &lineVal, linePC == entry) { + // lineVal is in effect until linePC, and lineStartPC < filePC. + if lineVal == line { + if fileStartPC <= lineStartPC { + return lineStartPC + } + if fileStartPC < linePC { + return fileStartPC + } + } + lineStartPC = linePC + } + } + fileStartPC = filePC + } + return 0 +} + +// go12PCToLine maps program counter to line number for the Go 1.2 pcln table. +func (t *LineTable) go12PCToLine(pc uint64) (line int) { + return t.go12PCToVal(pc, t.ptrsize+5*4) +} + +// go12PCToSPAdj maps program counter to Stack Pointer adjustment for the Go 1.2 pcln table. +func (t *LineTable) go12PCToSPAdj(pc uint64) (spadj int) { + return t.go12PCToVal(pc, t.ptrsize+3*4) +} + +func (t *LineTable) go12PCToVal(pc uint64, fOffset uint32) (val int) { + defer func() { + if recover() != nil { + val = -1 + } + }() + + f := t.findFunc(pc) + if f == nil { + return -1 + } + entry := t.uintptr(f) + linetab := t.binary.Uint32(f[fOffset:]) + return int(t.pcvalue(linetab, entry, pc)) +} + +// go12PCToFile maps program counter to file name for the Go 1.2 pcln table. +func (t *LineTable) go12PCToFile(pc uint64) (file string) { + defer func() { + if recover() != nil { + file = "" + } + }() + + f := t.findFunc(pc) + if f == nil { + return "" + } + entry := t.uintptr(f) + filetab := t.binary.Uint32(f[t.ptrsize+4*4:]) + fno := t.pcvalue(filetab, entry, pc) + if fno <= 0 { + return "" + } + return t.string(t.binary.Uint32(t.filetab[4*fno:])) +} + +// go12LineToPC maps a (file, line) pair to a program counter for the Go 1.2 pcln table. +func (t *LineTable) go12LineToPC(file string, line int) (pc uint64) { + defer func() { + if recover() != nil { + pc = 0 + } + }() + + t.initFileMap() + filenum := t.fileMap[file] + if filenum == 0 { + return 0 + } + + // Scan all functions. + // If this turns out to be a bottleneck, we could build a map[int32][]int32 + // mapping file number to a list of functions with code from that file. + for i := uint32(0); i < t.nfunctab; i++ { + f := t.Data[t.uintptr(t.functab[2*t.ptrsize*i+t.ptrsize:]):] + entry := t.uintptr(f) + filetab := t.binary.Uint32(f[t.ptrsize+4*4:]) + linetab := t.binary.Uint32(f[t.ptrsize+5*4:]) + pc := t.findFileLine(entry, filetab, linetab, int32(filenum), int32(line)) + if pc != 0 { + return pc + } + } + return 0 +} + +// initFileMap initializes the map from file name to file number. +func (t *LineTable) initFileMap() { + t.mu.Lock() + defer t.mu.Unlock() + + if t.fileMap != nil { + return + } + m := make(map[string]uint32) + + for i := uint32(1); i < t.nfiletab; i++ { + s := t.string(t.binary.Uint32(t.filetab[4*i:])) + m[s] = i + } + t.fileMap = m +} + +// go12MapFiles adds to m a key for every file in the Go 1.2 LineTable. +// Every key maps to obj. That's not a very interesting map, but it provides +// a way for callers to obtain the list of files in the program. +func (t *LineTable) go12MapFiles(m map[string]*Obj, obj *Obj) { + defer func() { + recover() + }() + + t.initFileMap() + for file := range t.fileMap { + m[file] = obj + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclntab_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclntab_test.go new file mode 100644 index 000000000..4bd3b0972 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/pclntab_test.go @@ -0,0 +1,287 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gosym + +import ( + "debug/elf" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" +) + +var ( + pclineTempDir string + pclinetestBinary string +) + +func dotest(self bool) bool { + // For now, only works on amd64 platforms. + if runtime.GOARCH != "amd64" { + return false + } + // Self test reads test binary; only works on Linux. + if self && runtime.GOOS != "linux" { + return false + } + // Command below expects "sh", so Unix. + if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { + return false + } + if pclinetestBinary != "" { + return true + } + var err error + pclineTempDir, err = ioutil.TempDir("", "pclinetest") + if err != nil { + panic(err) + } + if strings.Contains(pclineTempDir, " ") { + panic("unexpected space in tempdir") + } + // This command builds pclinetest from pclinetest.asm; + // the resulting binary looks like it was built from pclinetest.s, + // but we have renamed it to keep it away from the go tool. + pclinetestBinary = filepath.Join(pclineTempDir, "pclinetest") + command := fmt.Sprintf("go tool 6a -o %s.6 pclinetest.asm && go tool 6l -H linux -E main -o %s %s.6", + pclinetestBinary, pclinetestBinary, pclinetestBinary) + cmd := exec.Command("sh", "-c", command) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + panic(err) + } + return true +} + +func endtest() { + if pclineTempDir != "" { + os.RemoveAll(pclineTempDir) + pclineTempDir = "" + pclinetestBinary = "" + } +} + +func getTable(t *testing.T) *Table { + f, tab := crack(os.Args[0], t) + f.Close() + return tab +} + +func crack(file string, t *testing.T) (*elf.File, *Table) { + // Open self + f, err := elf.Open(file) + if err != nil { + t.Fatal(err) + } + return parse(file, f, t) +} + +func parse(file string, f *elf.File, t *testing.T) (*elf.File, *Table) { + symdat, err := f.Section(".gosymtab").Data() + if err != nil { + f.Close() + t.Fatalf("reading %s gosymtab: %v", file, err) + } + pclndat, err := f.Section(".gopclntab").Data() + if err != nil { + f.Close() + t.Fatalf("reading %s gopclntab: %v", file, err) + } + + pcln := NewLineTable(pclndat, f.Section(".text").Addr) + tab, err := NewTable(symdat, pcln) + if err != nil { + f.Close() + t.Fatalf("parsing %s gosymtab: %v", file, err) + } + + return f, tab +} + +var goarch = os.Getenv("O") + +func TestLineFromAline(t *testing.T) { + t.Skip("wants to use go tool 6a which hasn't existed for who knows how long") + if !dotest(true) { + return + } + defer endtest() + + tab := getTable(t) + if tab.go12line != nil { + // aline's don't exist in the Go 1.2 table. + t.Skip("not relevant to Go 1.2 symbol table") + } + + // Find the sym package + pkg := tab.LookupFunc("debug/gosym.TestLineFromAline").Obj + if pkg == nil { + t.Fatalf("nil pkg") + } + + // Walk every absolute line and ensure that we hit every + // source line monotonically + lastline := make(map[string]int) + final := -1 + for i := 0; i < 10000; i++ { + path, line := pkg.lineFromAline(i) + // Check for end of object + if path == "" { + if final == -1 { + final = i - 1 + } + continue + } else if final != -1 { + t.Fatalf("reached end of package at absolute line %d, but absolute line %d mapped to %s:%d", final, i, path, line) + } + // It's okay to see files multiple times (e.g., sys.a) + if line == 1 { + lastline[path] = 1 + continue + } + // Check that the is the next line in path + ll, ok := lastline[path] + if !ok { + t.Errorf("file %s starts on line %d", path, line) + } else if line != ll+1 { + t.Fatalf("expected next line of file %s to be %d, got %d", path, ll+1, line) + } + lastline[path] = line + } + if final == -1 { + t.Errorf("never reached end of object") + } +} + +func TestLineAline(t *testing.T) { + t.Skip("wants to use go tool 6a which hasn't existed for who knows how long") + if !dotest(true) { + return + } + defer endtest() + + tab := getTable(t) + if tab.go12line != nil { + // aline's don't exist in the Go 1.2 table. + t.Skip("not relevant to Go 1.2 symbol table") + } + + for _, o := range tab.Files { + // A source file can appear multiple times in a + // object. alineFromLine will always return alines in + // the first file, so track which lines we've seen. + found := make(map[string]int) + for i := 0; i < 1000; i++ { + path, line := o.lineFromAline(i) + if path == "" { + break + } + + // cgo files are full of 'Z' symbols, which we don't handle + if len(path) > 4 && path[len(path)-4:] == ".cgo" { + continue + } + + if minline, ok := found[path]; path != "" && ok { + if minline >= line { + // We've already covered this file + continue + } + } + found[path] = line + + a, err := o.alineFromLine(path, line) + if err != nil { + t.Errorf("absolute line %d in object %s maps to %s:%d, but mapping that back gives error %s", i, o.Paths[0].Name, path, line, err) + } else if a != i { + t.Errorf("absolute line %d in object %s maps to %s:%d, which maps back to absolute line %d\n", i, o.Paths[0].Name, path, line, a) + } + } + } +} + +func TestPCLine(t *testing.T) { + t.Skip("wants to use go tool 6a which hasn't existed for who knows how long") + if !dotest(false) { + return + } + defer endtest() + + f, tab := crack(pclinetestBinary, t) + text := f.Section(".text") + textdat, err := text.Data() + if err != nil { + t.Fatalf("reading .text: %v", err) + } + + // Test PCToLine + sym := tab.LookupFunc("linefrompc") + wantLine := 0 + for pc := sym.Entry; pc < sym.End; pc++ { + off := pc - text.Addr // TODO(rsc): should not need off; bug in 8g + if textdat[off] == 255 { + break + } + wantLine += int(textdat[off]) + t.Logf("off is %d %#x (max %d)", off, textdat[off], sym.End-pc) + file, line, fn := tab.PCToLine(pc) + if fn == nil { + t.Errorf("failed to get line of PC %#x", pc) + } else if !strings.HasSuffix(file, "pclinetest.asm") || line != wantLine || fn != sym { + t.Errorf("PCToLine(%#x) = %s:%d (%s), want %s:%d (%s)", pc, file, line, fn.Name, "pclinetest.asm", wantLine, sym.Name) + } + } + + // Test LineToPC + sym = tab.LookupFunc("pcfromline") + lookupline := -1 + wantLine = 0 + off := uint64(0) // TODO(rsc): should not need off; bug in 8g + for pc := sym.Value; pc < sym.End; pc += 2 + uint64(textdat[off]) { + file, line, fn := tab.PCToLine(pc) + off = pc - text.Addr + if textdat[off] == 255 { + break + } + wantLine += int(textdat[off]) + if line != wantLine { + t.Errorf("expected line %d at PC %#x in pcfromline, got %d", wantLine, pc, line) + off = pc + 1 - text.Addr + continue + } + if lookupline == -1 { + lookupline = line + } + for ; lookupline <= line; lookupline++ { + pc2, fn2, err := tab.LineToPC(file, lookupline) + if lookupline != line { + // Should be nothing on this line + if err == nil { + t.Errorf("expected no PC at line %d, got %#x (%s)", lookupline, pc2, fn2.Name) + } + } else if err != nil { + t.Errorf("failed to get PC of line %d: %s", lookupline, err) + } else if pc != pc2 { + t.Errorf("expected PC %#x (%s) at line %d, got PC %#x (%s)", pc, fn.Name, line, pc2, fn2.Name) + } + } + off = pc + 1 - text.Addr + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/symtab.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/symtab.go new file mode 100644 index 000000000..2c83b841c --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/gosym/symtab.go @@ -0,0 +1,731 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package gosym implements access to the Go symbol +// and line number tables embedded in Go binaries generated +// by the gc compilers. +package gosym + +// The table format is a variant of the format used in Plan 9's a.out +// format, documented at http://plan9.bell-labs.com/magic/man2html/6/a.out. +// The best reference for the differences between the Plan 9 format +// and the Go format is the runtime source, specifically ../../runtime/symtab.c. + +import ( + "bytes" + "encoding/binary" + "fmt" + "strconv" + "strings" +) + +/* + * Symbols + */ + +// A Sym represents a single symbol table entry. +type Sym struct { + Value uint64 + Type byte + Name string + GoType uint64 + // If this symbol if a function symbol, the corresponding Func + Func *Func +} + +// Static reports whether this symbol is static (not visible outside its file). +func (s *Sym) Static() bool { return s.Type >= 'a' } + +// PackageName returns the package part of the symbol name, +// or the empty string if there is none. +func (s *Sym) PackageName() string { + if i := strings.Index(s.Name, "."); i != -1 { + return s.Name[0:i] + } + return "" +} + +// ReceiverName returns the receiver type name of this symbol, +// or the empty string if there is none. +func (s *Sym) ReceiverName() string { + l := strings.Index(s.Name, ".") + r := strings.LastIndex(s.Name, ".") + if l == -1 || r == -1 || l == r { + return "" + } + return s.Name[l+1 : r] +} + +// BaseName returns the symbol name without the package or receiver name. +func (s *Sym) BaseName() string { + if i := strings.LastIndex(s.Name, "."); i != -1 { + return s.Name[i+1:] + } + return s.Name +} + +// A Func collects information about a single function. +type Func struct { + Entry uint64 + *Sym + End uint64 + Params []*Sym + Locals []*Sym + FrameSize int + LineTable *LineTable + Obj *Obj +} + +// An Obj represents a collection of functions in a symbol table. +// +// The exact method of division of a binary into separate Objs is an internal detail +// of the symbol table format. +// +// In early versions of Go each source file became a different Obj. +// +// In Go 1 and Go 1.1, each package produced one Obj for all Go sources +// and one Obj per C source file. +// +// In Go 1.2, there is a single Obj for the entire program. +type Obj struct { + // Funcs is a list of functions in the Obj. + Funcs []Func + + // In Go 1.1 and earlier, Paths is a list of symbols corresponding + // to the source file names that produced the Obj. + // In Go 1.2, Paths is nil. + // Use the keys of Table.Files to obtain a list of source files. + Paths []Sym // meta +} + +/* + * Symbol tables + */ + +// Table represents a Go symbol table. It stores all of the +// symbols decoded from the program and provides methods to translate +// between symbols, names, and addresses. +type Table struct { + Syms []Sym + Funcs []Func + Files map[string]*Obj // nil for Go 1.2 and later binaries + Objs []Obj // nil for Go 1.2 and later binaries + + go12line *LineTable // Go 1.2 line number table +} + +type sym struct { + value uint64 + gotype uint64 + typ byte + name []byte +} + +var ( + littleEndianSymtab = []byte{0xFD, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00} + bigEndianSymtab = []byte{0xFF, 0xFF, 0xFF, 0xFD, 0x00, 0x00, 0x00} + oldLittleEndianSymtab = []byte{0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00} +) + +func walksymtab(data []byte, fn func(sym) error) error { + if len(data) == 0 { // missing symtab is okay + return nil + } + var order binary.ByteOrder = binary.BigEndian + newTable := false + switch { + case bytes.HasPrefix(data, oldLittleEndianSymtab): + // Same as Go 1.0, but little endian. + // Format was used during interim development between Go 1.0 and Go 1.1. + // Should not be widespread, but easy to support. + data = data[6:] + order = binary.LittleEndian + case bytes.HasPrefix(data, bigEndianSymtab): + newTable = true + case bytes.HasPrefix(data, littleEndianSymtab): + newTable = true + order = binary.LittleEndian + } + var ptrsz int + if newTable { + if len(data) < 8 { + return &DecodingError{len(data), "unexpected EOF", nil} + } + ptrsz = int(data[7]) + if ptrsz != 4 && ptrsz != 8 { + return &DecodingError{7, "invalid pointer size", ptrsz} + } + data = data[8:] + } + var s sym + p := data + for len(p) >= 4 { + var typ byte + if newTable { + // Symbol type, value, Go type. + typ = p[0] & 0x3F + wideValue := p[0]&0x40 != 0 + goType := p[0]&0x80 != 0 + if typ < 26 { + typ += 'A' + } else { + typ += 'a' - 26 + } + s.typ = typ + p = p[1:] + if wideValue { + if len(p) < ptrsz { + return &DecodingError{len(data), "unexpected EOF", nil} + } + // fixed-width value + if ptrsz == 8 { + s.value = order.Uint64(p[0:8]) + p = p[8:] + } else { + s.value = uint64(order.Uint32(p[0:4])) + p = p[4:] + } + } else { + // varint value + s.value = 0 + shift := uint(0) + for len(p) > 0 && p[0]&0x80 != 0 { + s.value |= uint64(p[0]&0x7F) << shift + shift += 7 + p = p[1:] + } + if len(p) == 0 { + return &DecodingError{len(data), "unexpected EOF", nil} + } + s.value |= uint64(p[0]) << shift + p = p[1:] + } + if goType { + if len(p) < ptrsz { + return &DecodingError{len(data), "unexpected EOF", nil} + } + // fixed-width go type + if ptrsz == 8 { + s.gotype = order.Uint64(p[0:8]) + p = p[8:] + } else { + s.gotype = uint64(order.Uint32(p[0:4])) + p = p[4:] + } + } + } else { + // Value, symbol type. + s.value = uint64(order.Uint32(p[0:4])) + if len(p) < 5 { + return &DecodingError{len(data), "unexpected EOF", nil} + } + typ = p[4] + if typ&0x80 == 0 { + return &DecodingError{len(data) - len(p) + 4, "bad symbol type", typ} + } + typ &^= 0x80 + s.typ = typ + p = p[5:] + } + + // Name. + var i int + var nnul int + for i = 0; i < len(p); i++ { + if p[i] == 0 { + nnul = 1 + break + } + } + switch typ { + case 'z', 'Z': + p = p[i+nnul:] + for i = 0; i+2 <= len(p); i += 2 { + if p[i] == 0 && p[i+1] == 0 { + nnul = 2 + break + } + } + } + if len(p) < i+nnul { + return &DecodingError{len(data), "unexpected EOF", nil} + } + s.name = p[0:i] + i += nnul + p = p[i:] + + if !newTable { + if len(p) < 4 { + return &DecodingError{len(data), "unexpected EOF", nil} + } + // Go type. + s.gotype = uint64(order.Uint32(p[:4])) + p = p[4:] + } + fn(s) + } + return nil +} + +// NewTable decodes the Go symbol table in data, +// returning an in-memory representation. +func NewTable(symtab []byte, pcln *LineTable) (*Table, error) { + var n int + err := walksymtab(symtab, func(s sym) error { + n++ + return nil + }) + if err != nil { + return nil, err + } + + var t Table + if pcln.isGo12() { + t.go12line = pcln + } + fname := make(map[uint16]string) + t.Syms = make([]Sym, 0, n) + nf := 0 + nz := 0 + lasttyp := uint8(0) + err = walksymtab(symtab, func(s sym) error { + n := len(t.Syms) + t.Syms = t.Syms[0 : n+1] + ts := &t.Syms[n] + ts.Type = s.typ + ts.Value = uint64(s.value) + ts.GoType = uint64(s.gotype) + switch s.typ { + default: + // rewrite name to use . instead of · (c2 b7) + w := 0 + b := s.name + for i := 0; i < len(b); i++ { + if b[i] == 0xc2 && i+1 < len(b) && b[i+1] == 0xb7 { + i++ + b[i] = '.' + } + b[w] = b[i] + w++ + } + ts.Name = string(s.name[0:w]) + case 'z', 'Z': + if lasttyp != 'z' && lasttyp != 'Z' { + nz++ + } + for i := 0; i < len(s.name); i += 2 { + eltIdx := binary.BigEndian.Uint16(s.name[i : i+2]) + elt, ok := fname[eltIdx] + if !ok { + return &DecodingError{-1, "bad filename code", eltIdx} + } + if n := len(ts.Name); n > 0 && ts.Name[n-1] != '/' { + ts.Name += "/" + } + ts.Name += elt + } + } + switch s.typ { + case 'T', 't', 'L', 'l': + nf++ + case 'f': + fname[uint16(s.value)] = ts.Name + } + lasttyp = s.typ + return nil + }) + if err != nil { + return nil, err + } + + t.Funcs = make([]Func, 0, nf) + t.Files = make(map[string]*Obj) + + var obj *Obj + if t.go12line != nil { + // Put all functions into one Obj. + t.Objs = make([]Obj, 1) + obj = &t.Objs[0] + t.go12line.go12MapFiles(t.Files, obj) + } else { + t.Objs = make([]Obj, 0, nz) + } + + // Count text symbols and attach frame sizes, parameters, and + // locals to them. Also, find object file boundaries. + lastf := 0 + for i := 0; i < len(t.Syms); i++ { + sym := &t.Syms[i] + switch sym.Type { + case 'Z', 'z': // path symbol + if t.go12line != nil { + // Go 1.2 binaries have the file information elsewhere. Ignore. + break + } + // Finish the current object + if obj != nil { + obj.Funcs = t.Funcs[lastf:] + } + lastf = len(t.Funcs) + + // Start new object + n := len(t.Objs) + t.Objs = t.Objs[0 : n+1] + obj = &t.Objs[n] + + // Count & copy path symbols + var end int + for end = i + 1; end < len(t.Syms); end++ { + if c := t.Syms[end].Type; c != 'Z' && c != 'z' { + break + } + } + obj.Paths = t.Syms[i:end] + i = end - 1 // loop will i++ + + // Record file names + depth := 0 + for j := range obj.Paths { + s := &obj.Paths[j] + if s.Name == "" { + depth-- + } else { + if depth == 0 { + t.Files[s.Name] = obj + } + depth++ + } + } + + case 'T', 't', 'L', 'l': // text symbol + if n := len(t.Funcs); n > 0 { + t.Funcs[n-1].End = sym.Value + } + if sym.Name == "etext" { + continue + } + + // Count parameter and local (auto) syms + var np, na int + var end int + countloop: + for end = i + 1; end < len(t.Syms); end++ { + switch t.Syms[end].Type { + case 'T', 't', 'L', 'l', 'Z', 'z': + break countloop + case 'p': + np++ + case 'a': + na++ + } + } + + // Fill in the function symbol + n := len(t.Funcs) + t.Funcs = t.Funcs[0 : n+1] + fn := &t.Funcs[n] + sym.Func = fn + fn.Params = make([]*Sym, 0, np) + fn.Locals = make([]*Sym, 0, na) + fn.Sym = sym + fn.Entry = sym.Value + fn.Obj = obj + if t.go12line != nil { + // All functions share the same line table. + // It knows how to narrow down to a specific + // function quickly. + fn.LineTable = t.go12line + } else if pcln != nil { + fn.LineTable = pcln.slice(fn.Entry) + pcln = fn.LineTable + } + for j := i; j < end; j++ { + s := &t.Syms[j] + switch s.Type { + case 'm': + fn.FrameSize = int(s.Value) + case 'p': + n := len(fn.Params) + fn.Params = fn.Params[0 : n+1] + fn.Params[n] = s + case 'a': + n := len(fn.Locals) + fn.Locals = fn.Locals[0 : n+1] + fn.Locals[n] = s + } + } + i = end - 1 // loop will i++ + } + } + + if t.go12line != nil && nf == 0 { + t.Funcs = t.go12line.go12Funcs() + } + if obj != nil { + obj.Funcs = t.Funcs[lastf:] + } + return &t, nil +} + +// PCToFunc returns the function containing the program counter pc, +// or nil if there is no such function. +func (t *Table) PCToFunc(pc uint64) *Func { + funcs := t.Funcs + for len(funcs) > 0 { + m := len(funcs) / 2 + fn := &funcs[m] + switch { + case pc < fn.Entry: + funcs = funcs[0:m] + case fn.Entry <= pc && pc < fn.End: + return fn + default: + funcs = funcs[m+1:] + } + } + return nil +} + +// PCToLine looks up line number information for a program counter. +// If there is no information, it returns fn == nil. +func (t *Table) PCToLine(pc uint64) (file string, line int, fn *Func) { + if fn = t.PCToFunc(pc); fn == nil { + return + } + if t.go12line != nil { + file = t.go12line.go12PCToFile(pc) + line = t.go12line.go12PCToLine(pc) + } else { + file, line = fn.Obj.lineFromAline(fn.LineTable.PCToLine(pc)) + } + return +} + +// PCToSPAdj returns the stack pointer adjustment for a program counter. +func (t *Table) PCToSPAdj(pc uint64) (spadj int) { + if fn := t.PCToFunc(pc); fn == nil { + return 0 + } + if t.go12line != nil { + return t.go12line.go12PCToSPAdj(pc) + } + return 0 +} + +// LineToPC looks up the first program counter on the given line in +// the named file. It returns UnknownPathError or UnknownLineError if +// there is an error looking up this line. +func (t *Table) LineToPC(file string, line int) (pc uint64, fn *Func, err error) { + obj, ok := t.Files[file] + if !ok { + return 0, nil, UnknownFileError(file) + } + + if t.go12line != nil { + pc := t.go12line.go12LineToPC(file, line) + if pc == 0 { + return 0, nil, &UnknownLineError{file, line} + } + return pc, t.PCToFunc(pc), nil + } + + abs, err := obj.alineFromLine(file, line) + if err != nil { + return + } + for i := range obj.Funcs { + f := &obj.Funcs[i] + pc := f.LineTable.LineToPC(abs, f.End) + if pc != 0 { + return pc, f, nil + } + } + return 0, nil, &UnknownLineError{file, line} +} + +// LookupSym returns the text, data, or bss symbol with the given name, +// or nil if no such symbol is found. +func (t *Table) LookupSym(name string) *Sym { + // TODO(austin) Maybe make a map + for i := range t.Syms { + s := &t.Syms[i] + switch s.Type { + case 'T', 't', 'L', 'l', 'D', 'd', 'B', 'b': + if s.Name == name { + return s + } + } + } + return nil +} + +// LookupFunc returns the text, data, or bss symbol with the given name, +// or nil if no such symbol is found. +func (t *Table) LookupFunc(name string) *Func { + for i := range t.Funcs { + f := &t.Funcs[i] + if f.Sym.Name == name { + return f + } + } + return nil +} + +// SymByAddr returns the text, data, or bss symbol starting at the given address. +func (t *Table) SymByAddr(addr uint64) *Sym { + for i := range t.Syms { + s := &t.Syms[i] + switch s.Type { + case 'T', 't', 'L', 'l', 'D', 'd', 'B', 'b': + if s.Value == addr { + return s + } + } + } + return nil +} + +/* + * Object files + */ + +// This is legacy code for Go 1.1 and earlier, which used the +// Plan 9 format for pc-line tables. This code was never quite +// correct. It's probably very close, and it's usually correct, but +// we never quite found all the corner cases. +// +// Go 1.2 and later use a simpler format, documented at golang.org/s/go12symtab. + +func (o *Obj) lineFromAline(aline int) (string, int) { + type stackEnt struct { + path string + start int + offset int + prev *stackEnt + } + + noPath := &stackEnt{"", 0, 0, nil} + tos := noPath + +pathloop: + for _, s := range o.Paths { + val := int(s.Value) + switch { + case val > aline: + break pathloop + + case val == 1: + // Start a new stack + tos = &stackEnt{s.Name, val, 0, noPath} + + case s.Name == "": + // Pop + if tos == noPath { + return "", 0 + } + tos.prev.offset += val - tos.start + tos = tos.prev + + default: + // Push + tos = &stackEnt{s.Name, val, 0, tos} + } + } + + if tos == noPath { + return "", 0 + } + return tos.path, aline - tos.start - tos.offset + 1 +} + +func (o *Obj) alineFromLine(path string, line int) (int, error) { + if line < 1 { + return 0, &UnknownLineError{path, line} + } + + for i, s := range o.Paths { + // Find this path + if s.Name != path { + continue + } + + // Find this line at this stack level + depth := 0 + var incstart int + line += int(s.Value) + pathloop: + for _, s := range o.Paths[i:] { + val := int(s.Value) + switch { + case depth == 1 && val >= line: + return line - 1, nil + + case s.Name == "": + depth-- + if depth == 0 { + break pathloop + } else if depth == 1 { + line += val - incstart + } + + default: + if depth == 1 { + incstart = val + } + depth++ + } + } + return 0, &UnknownLineError{path, line} + } + return 0, UnknownFileError(path) +} + +/* + * Errors + */ + +// UnknownFileError represents a failure to find the specific file in +// the symbol table. +type UnknownFileError string + +func (e UnknownFileError) Error() string { return "unknown file: " + string(e) } + +// UnknownLineError represents a failure to map a line to a program +// counter, either because the line is beyond the bounds of the file +// or because there is no code on the given line. +type UnknownLineError struct { + File string + Line int +} + +func (e *UnknownLineError) Error() string { + return "no code at " + e.File + ":" + strconv.Itoa(e.Line) +} + +// DecodingError represents an error during the decoding of +// the symbol table. +type DecodingError struct { + off int + msg string + val interface{} +} + +func (e *DecodingError) Error() string { + msg := e.msg + if e.val != nil { + msg += fmt.Sprintf(" '%v'", e.val) + } + msg += fmt.Sprintf(" at byte %#x", e.off) + return msg +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/local/local.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/local/local.go new file mode 100644 index 000000000..b75004bfd --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/local/local.go @@ -0,0 +1,205 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build linux + +// Package local provides access to a local program. +package local + +import ( + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/protocol" +) + +var _ debug.Program = (*Program)(nil) +var _ debug.File = (*File)(nil) + +// Program implements the debug.Program interface. +// Through that interface it provides access to a program being debugged. +type Program struct { + s *server.Server +} + +// New creates a new program from the specified file. +// The program can then be started by the Run method. +func New(textFile string) (*Program, error) { + s, err := server.New(textFile) + return &Program{s: s}, err +} + +func (p *Program) Open(name string, mode string) (debug.File, error) { + req := protocol.OpenRequest{ + Name: name, + Mode: mode, + } + var resp protocol.OpenResponse + err := p.s.Open(&req, &resp) + if err != nil { + return nil, err + } + f := &File{ + prog: p, + fd: resp.FD, + } + return f, nil +} + +func (p *Program) Run(args ...string) (debug.Status, error) { + req := protocol.RunRequest{args} + var resp protocol.RunResponse + err := p.s.Run(&req, &resp) + if err != nil { + return debug.Status{}, err + } + return resp.Status, nil +} + +func (p *Program) Stop() (debug.Status, error) { + panic("unimplemented") +} + +func (p *Program) Resume() (debug.Status, error) { + req := protocol.ResumeRequest{} + var resp protocol.ResumeResponse + err := p.s.Resume(&req, &resp) + if err != nil { + return debug.Status{}, err + } + return resp.Status, nil +} + +func (p *Program) Kill() (debug.Status, error) { + panic("unimplemented") +} + +func (p *Program) Breakpoint(address uint64) ([]uint64, error) { + req := protocol.BreakpointRequest{ + Address: address, + } + var resp protocol.BreakpointResponse + err := p.s.Breakpoint(&req, &resp) + return resp.PCs, err +} + +func (p *Program) BreakpointAtFunction(name string) ([]uint64, error) { + req := protocol.BreakpointAtFunctionRequest{ + Function: name, + } + var resp protocol.BreakpointResponse + err := p.s.BreakpointAtFunction(&req, &resp) + return resp.PCs, err +} + +func (p *Program) BreakpointAtLine(file string, line uint64) ([]uint64, error) { + req := protocol.BreakpointAtLineRequest{ + File: file, + Line: line, + } + var resp protocol.BreakpointResponse + err := p.s.BreakpointAtLine(&req, &resp) + return resp.PCs, err +} + +func (p *Program) DeleteBreakpoints(pcs []uint64) error { + req := protocol.DeleteBreakpointsRequest{PCs: pcs} + var resp protocol.DeleteBreakpointsResponse + return p.s.DeleteBreakpoints(&req, &resp) +} + +func (p *Program) Eval(expr string) ([]string, error) { + req := protocol.EvalRequest{ + Expr: expr, + } + var resp protocol.EvalResponse + err := p.s.Eval(&req, &resp) + return resp.Result, err +} + +func (p *Program) Evaluate(e string) (debug.Value, error) { + req := protocol.EvaluateRequest{ + Expression: e, + } + var resp protocol.EvaluateResponse + err := p.s.Evaluate(&req, &resp) + return resp.Result, err +} + +func (p *Program) Frames(count int) ([]debug.Frame, error) { + req := protocol.FramesRequest{ + Count: count, + } + var resp protocol.FramesResponse + err := p.s.Frames(&req, &resp) + return resp.Frames, err +} + +func (p *Program) Goroutines() ([]*debug.Goroutine, error) { + req := protocol.GoroutinesRequest{} + var resp protocol.GoroutinesResponse + err := p.s.Goroutines(&req, &resp) + return resp.Goroutines, err +} + +func (p *Program) VarByName(name string) (debug.Var, error) { + req := protocol.VarByNameRequest{Name: name} + var resp protocol.VarByNameResponse + err := p.s.VarByName(&req, &resp) + return resp.Var, err +} + +func (p *Program) Value(v debug.Var) (debug.Value, error) { + req := protocol.ValueRequest{Var: v} + var resp protocol.ValueResponse + err := p.s.Value(&req, &resp) + return resp.Value, err +} + +func (p *Program) MapElement(m debug.Map, index uint64) (debug.Var, debug.Var, error) { + req := protocol.MapElementRequest{Map: m, Index: index} + var resp protocol.MapElementResponse + err := p.s.MapElement(&req, &resp) + return resp.Key, resp.Value, err +} + +// File implements the debug.File interface, providing access +// to file-like resources associated with the target program. +type File struct { + prog *Program // The Program associated with the file. + fd int // File descriptor. +} + +func (f *File) ReadAt(p []byte, offset int64) (int, error) { + req := protocol.ReadAtRequest{ + FD: f.fd, + Len: len(p), + Offset: offset, + } + var resp protocol.ReadAtResponse + err := f.prog.s.ReadAt(&req, &resp) + return copy(p, resp.Data), err +} + +func (f *File) WriteAt(p []byte, offset int64) (int, error) { + panic("unimplemented") +} + +func (f *File) Close() error { + req := protocol.CloseRequest{ + FD: f.fd, + } + var resp protocol.CloseResponse + err := f.prog.s.Close(&req, &resp) + return err +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/program.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/program.go new file mode 100644 index 000000000..8cbf53db3 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/program.go @@ -0,0 +1,327 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package debug provides the portable interface to a program being debugged. +package debug + +import ( + "fmt" + "io" + "strings" +) + +// Program is the interface to a (possibly remote) program being debugged. +// The process (if any) and text file associated with it may change during +// the session, but many resources are associated with the Program rather +// than process or text file so they persist across debuggging runs. +type Program interface { + // Open opens a virtual file associated with the process. + // Names are things like "text", "mem", "fd/2". + // Mode is one of "r", "w", "rw". + // Return values are open File and error. + // When the target binary is re-run, open files are + // automatically updated to refer to the corresponding + // file in the new process. + Open(name string, mode string) (File, error) + + // Run abandons the current running process, if any, + // and execs a new instance of the target binary file + // (which may have changed underfoot). + // Breakpoints and open files are re-established. + // The call hangs until the program stops executing, + // at which point it returns the program status. + // args contains the command-line arguments for the process. + Run(args ...string) (Status, error) + + // Stop stops execution of the current process but + // does not kill it. + Stop() (Status, error) + + // Resume resumes execution of a stopped process. + // The call hangs until the program stops executing, + // at which point it returns the program status. + Resume() (Status, error) + + // TODO: Step(). Where does the granularity happen, + // on the proxy end or the debugging control end? + + // Kill kills the current process. + Kill() (Status, error) + + // Breakpoint sets a breakpoint at the specified address. + Breakpoint(address uint64) (PCs []uint64, err error) + + // BreakpointAtFunction sets a breakpoint at the start of the specified function. + BreakpointAtFunction(name string) (PCs []uint64, err error) + + // BreakpointAtLine sets a breakpoint at the specified source line. + BreakpointAtLine(file string, line uint64) (PCs []uint64, err error) + + // DeleteBreakpoints removes the breakpoints at the specified addresses. + // Addresses where no breakpoint is set are ignored. + DeleteBreakpoints(pcs []uint64) error + + // Eval evaluates the expression (typically an address) and returns + // its string representation(s). Multivalued expressions such as + // matches for regular expressions return multiple values. + // TODO: change this to multiple functions with more specific names. + // Syntax: + // re:regexp + // Returns a list of symbol names that match the expression + // addr:symbol + // Returns a one-element list holding the hexadecimal + // ("0x1234") value of the address of the symbol + // val:symbol + // Returns a one-element list holding the formatted + // value of the symbol + // 0x1234, 01234, 467 + // Returns a one-element list holding the name of the + // symbol ("main.foo") at that address (hex, octal, decimal). + Eval(expr string) ([]string, error) + + // Evaluate evaluates an expression. Accepts a subset of Go expression syntax: + // basic literals, identifiers, parenthesized expressions, and most operators. + // Only the len function call is available. + // + // The expression can refer to local variables and function parameters of the + // function where the program is stopped. + // + // On success, the type of the value returned will be one of: + // int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64, + // complex64, complex128, bool, Pointer, Array, Slice, String, Map, Struct, + // Channel, Func, or Interface. + Evaluate(e string) (Value, error) + + // Frames returns up to count stack frames from where the program + // is currently stopped. + Frames(count int) ([]Frame, error) + + // VarByName returns a Var referring to a global variable with the given name. + // TODO: local variables + VarByName(name string) (Var, error) + + // Value gets the value of a variable by reading the program's memory. + Value(v Var) (Value, error) + + // MapElement returns Vars for the key and value of a map element specified by + // a 0-based index. + MapElement(m Map, index uint64) (Var, Var, error) + + // Goroutines gets the current goroutines. + Goroutines() ([]*Goroutine, error) +} + +type Goroutine struct { + ID int64 + Status GoroutineStatus + StatusString string // A human-readable string explaining the status in more detail. + Function string // Name of the goroutine function. + Caller string // Name of the function that created this goroutine. + StackFrames []Frame +} + +type GoroutineStatus byte + +const ( + Running GoroutineStatus = iota + Queued + Blocked +) + +func (g GoroutineStatus) String() string { + switch g { + case Running: + return "running" + case Queued: + return "queued" + case Blocked: + return "blocked" + } + return "invalid status" +} + +func (g *Goroutine) String() string { + return fmt.Sprintf("goroutine %d [%s] %s -> %s", g.ID, g.StatusString, g.Caller, g.Function) +} + +// A reference to a variable in a program. +// TODO: handle variables stored in registers +type Var struct { + TypeID uint64 // A type identifier, opaque to the user. + Address uint64 // The address of the variable. +} + +// A value read from a remote program. +type Value interface{} + +// Pointer is a Value representing a pointer. +// Note that the TypeID field will be the type of the variable being pointed to, +// not the type of this pointer. +type Pointer struct { + TypeID uint64 // A type identifier, opaque to the user. + Address uint64 // The address of the variable. +} + +// Array is a Value representing an array. +type Array struct { + ElementTypeID uint64 + Address uint64 + Length uint64 // Number of elements in the array + StrideBits uint64 // Number of bits between array entries +} + +// Len returns the number of elements in the array. +func (a Array) Len() uint64 { + return a.Length +} + +// Element returns a Var referring to the given element of the array. +func (a Array) Element(index uint64) Var { + return Var{ + TypeID: a.ElementTypeID, + Address: a.Address + index*(a.StrideBits/8), + } +} + +// Slice is a Value representing a slice. +type Slice struct { + Array + Capacity uint64 +} + +// String is a Value representing a string. +// TODO: a method to access more of a truncated string. +type String struct { + // Length contains the length of the remote string, in bytes. + Length uint64 + // String contains the string itself; it may be truncated to fewer bytes than the value of the Length field. + String string +} + +// Map is a Value representing a map. +type Map struct { + TypeID uint64 + Address uint64 + Length uint64 // Number of elements in the map. +} + +// Struct is a Value representing a struct. +type Struct struct { + Fields []StructField +} + +// StructField represents a field in a struct object. +type StructField struct { + Name string + Var Var +} + +// Channel is a Value representing a channel. +type Channel struct { + ElementTypeID uint64 + Address uint64 // Location of the channel struct in memory. + Buffer uint64 // Location of the buffer; zero for nil channels. + Length uint64 // Number of elements stored in the channel buffer. + Capacity uint64 // Capacity of the buffer; zero for unbuffered channels. + Stride uint64 // Number of bytes between buffer entries. + BufferStart uint64 // Index in the buffer of the element at the head of the queue. +} + +// Element returns a Var referring to the given element of the channel's queue. +// If the channel is unbuffered, nil, or if the index is too large, returns a Var with Address == 0. +func (m Channel) Element(index uint64) Var { + if index >= m.Length { + return Var{ + TypeID: m.ElementTypeID, + Address: 0, + } + } + if index < m.Capacity-m.BufferStart { + // The element is in the part of the queue that occurs later in the buffer + // than the head of the queue. + return Var{ + TypeID: m.ElementTypeID, + Address: m.Buffer + (m.BufferStart+index)*m.Stride, + } + } + // The element is in the part of the queue that has wrapped around to the + // start of the buffer. + return Var{ + TypeID: m.ElementTypeID, + Address: m.Buffer + (m.BufferStart+index-m.Capacity)*m.Stride, + } +} + +// Func is a Value representing a func. +type Func struct { + Address uint64 +} + +// Interface is a Value representing an interface. +type Interface struct{} + +// The File interface provides access to file-like resources in the program. +// It implements only ReaderAt and WriterAt, not Reader and Writer, because +// random access is a far more common pattern for things like symbol tables, +// and because enormous address space of virtual memory makes routines +// like io.Copy dangerous. +type File interface { + io.ReaderAt + io.WriterAt + io.Closer +} + +type Status struct { + PC, SP uint64 +} + +type Frame struct { + // PC is the hardware program counter. + PC uint64 + // SP is the hardware stack pointer. + SP uint64 + // File and Line are the source code location of the PC. + File string + Line uint64 + // Function is the name of this frame's function. + Function string + // FunctionStart is the starting PC of the function. + FunctionStart uint64 + // Params contains the function's parameters. + Params []Param + // Vars contains the function's local variables. + Vars []LocalVar +} + +func (f Frame) String() string { + params := make([]string, len(f.Params)) + for i, p := range f.Params { + params[i] = p.Name // TODO: more information + } + p := strings.Join(params, ", ") + off := f.PC - f.FunctionStart + return fmt.Sprintf("%s(%s)\n\t%s:%d +0x%x", f.Function, p, f.File, f.Line, off) +} + +// Param is a parameter of a function. +type Param struct { + Name string + Var Var +} + +// LocalVar is a local variable of a function. +type LocalVar struct { + Name string + Var Var +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/remote/remote.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/remote/remote.go new file mode 100644 index 000000000..0790623d6 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/remote/remote.go @@ -0,0 +1,305 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package remote provides remote access to a debugproxy server. +package remote + +import ( + "fmt" + "io" + "net/rpc" + "os" + "os/exec" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/protocol" +) + +var _ debug.Program = (*Program)(nil) +var _ debug.File = (*File)(nil) + +// Program implements the debug.Program interface. +// Through that interface it provides access to a program being +// debugged on a possibly remote machine by communicating +// with a debugproxy adjacent to the target program. +type Program struct { + client *rpc.Client +} + +// DebugproxyCmd is the path to the debugproxy command. It is a variable in case +// the default value, "debugproxy", is not in the $PATH. +var DebugproxyCmd = "debugproxy" + +// New connects to the specified host using SSH, starts DebugproxyCmd +// there, and creates a new program from the specified file. +// The program can then be started by the Run method. +func New(host string, textFile string) (*Program, error) { + // TODO: add args. + cmdStrs := []string{"/usr/bin/ssh", host, DebugproxyCmd, "-text", textFile} + if host == "localhost" { + cmdStrs = cmdStrs[2:] + } + cmd := exec.Command(cmdStrs[0], cmdStrs[1:]...) + stdin, toStdin, err := os.Pipe() + if err != nil { + return nil, err + } + fromStdout, stdout, err := os.Pipe() + if err != nil { + return nil, err + } + cmd.Stdin = stdin + cmd.Stdout = stdout + cmd.Stderr = os.Stderr // Stderr from proxy appears on our stderr. + err = cmd.Start() + if err != nil { + return nil, err + } + stdout.Close() + if msg, err := readLine(fromStdout); err != nil { + return nil, err + } else if msg != "OK" { + // Communication error. + return nil, fmt.Errorf("unrecognized message %q", msg) + } + program := &Program{ + client: rpc.NewClient(&rwc{ + ssh: cmd, + r: fromStdout, + w: toStdin, + }), + } + return program, nil +} + +// readLine reads one line of text from the reader. It does no buffering. +// The trailing newline is read but not returned. +func readLine(r io.Reader) (string, error) { + b := make([]byte, 0, 10) + var c [1]byte + for { + _, err := io.ReadFull(r, c[:]) + if err != nil { + return "", err + } + if c[0] == '\n' { + break + } + b = append(b, c[0]) + } + return string(b), nil +} + +// rwc creates a single io.ReadWriteCloser from a read side and a write side. +// It also holds the command object so we can wait for SSH to complete. +// It allows us to do RPC over an SSH connection. +type rwc struct { + ssh *exec.Cmd + r *os.File + w *os.File +} + +func (rwc *rwc) Read(p []byte) (int, error) { + return rwc.r.Read(p) +} + +func (rwc *rwc) Write(p []byte) (int, error) { + return rwc.w.Write(p) +} + +func (rwc *rwc) Close() error { + rerr := rwc.r.Close() + werr := rwc.w.Close() + cerr := rwc.ssh.Wait() + if cerr != nil { + // Wait exit status is most important. + return cerr + } + if rerr != nil { + return rerr + } + return werr +} + +func (p *Program) Open(name string, mode string) (debug.File, error) { + req := protocol.OpenRequest{ + Name: name, + Mode: mode, + } + var resp protocol.OpenResponse + err := p.client.Call("Server.Open", &req, &resp) + if err != nil { + return nil, err + } + f := &File{ + prog: p, + fd: resp.FD, + } + return f, nil +} + +func (p *Program) Run(args ...string) (debug.Status, error) { + req := protocol.RunRequest{args} + var resp protocol.RunResponse + err := p.client.Call("Server.Run", &req, &resp) + if err != nil { + return debug.Status{}, err + } + return resp.Status, nil +} + +func (p *Program) Stop() (debug.Status, error) { + panic("unimplemented") +} + +func (p *Program) Resume() (debug.Status, error) { + req := protocol.ResumeRequest{} + var resp protocol.ResumeResponse + err := p.client.Call("Server.Resume", &req, &resp) + if err != nil { + return debug.Status{}, err + } + return resp.Status, nil +} + +func (p *Program) Kill() (debug.Status, error) { + panic("unimplemented") +} + +func (p *Program) Breakpoint(address uint64) ([]uint64, error) { + req := protocol.BreakpointRequest{ + Address: address, + } + var resp protocol.BreakpointResponse + err := p.client.Call("Server.Breakpoint", &req, &resp) + return resp.PCs, err +} + +func (p *Program) BreakpointAtFunction(name string) ([]uint64, error) { + req := protocol.BreakpointAtFunctionRequest{ + Function: name, + } + var resp protocol.BreakpointResponse + err := p.client.Call("Server.BreakpointAtFunction", &req, &resp) + return resp.PCs, err +} + +func (p *Program) BreakpointAtLine(file string, line uint64) ([]uint64, error) { + req := protocol.BreakpointAtLineRequest{ + File: file, + Line: line, + } + var resp protocol.BreakpointResponse + err := p.client.Call("Server.BreakpointAtLine", &req, &resp) + return resp.PCs, err +} + +func (p *Program) DeleteBreakpoints(pcs []uint64) error { + req := protocol.DeleteBreakpointsRequest{PCs: pcs} + var resp protocol.DeleteBreakpointsResponse + return p.client.Call("Server.DeleteBreakpoints", &req, &resp) +} + +func (p *Program) Eval(expr string) ([]string, error) { + req := protocol.EvalRequest{ + Expr: expr, + } + var resp protocol.EvalResponse + err := p.client.Call("Server.Eval", &req, &resp) + return resp.Result, err +} + +func (p *Program) Evaluate(e string) (debug.Value, error) { + req := protocol.EvaluateRequest{ + Expression: e, + } + var resp protocol.EvaluateResponse + err := p.client.Call("Server.Evaluate", &req, &resp) + return resp.Result, err +} + +func (p *Program) Frames(count int) ([]debug.Frame, error) { + req := protocol.FramesRequest{ + Count: count, + } + var resp protocol.FramesResponse + err := p.client.Call("Server.Frames", &req, &resp) + return resp.Frames, err +} + +func (p *Program) Goroutines() ([]*debug.Goroutine, error) { + req := protocol.GoroutinesRequest{} + var resp protocol.GoroutinesResponse + err := p.client.Call("Server.Goroutines", &req, &resp) + return resp.Goroutines, err +} + +func (p *Program) VarByName(name string) (debug.Var, error) { + req := protocol.VarByNameRequest{Name: name} + var resp protocol.VarByNameResponse + err := p.client.Call("Server.VarByName", &req, &resp) + return resp.Var, err +} + +func (p *Program) Value(v debug.Var) (debug.Value, error) { + req := protocol.ValueRequest{Var: v} + var resp protocol.ValueResponse + err := p.client.Call("Server.Value", &req, &resp) + return resp.Value, err +} + +func (p *Program) MapElement(m debug.Map, index uint64) (debug.Var, debug.Var, error) { + req := protocol.MapElementRequest{Map: m, Index: index} + var resp protocol.MapElementResponse + err := p.client.Call("Server.MapElement", &req, &resp) + return resp.Key, resp.Value, err +} + +// File implements the debug.File interface, providing access +// to file-like resources associated with the target program. +type File struct { + prog *Program // The Program associated with the file. + fd int // File descriptor. +} + +func (f *File) ReadAt(p []byte, offset int64) (int, error) { + req := protocol.ReadAtRequest{ + FD: f.fd, + Len: len(p), + Offset: offset, + } + var resp protocol.ReadAtResponse + err := f.prog.client.Call("Server.ReadAt", &req, &resp) + return copy(p, resp.Data), err +} + +func (f *File) WriteAt(p []byte, offset int64) (int, error) { + req := protocol.WriteAtRequest{ + FD: f.fd, + Data: p, + Offset: offset, + } + var resp protocol.WriteAtResponse + err := f.prog.client.Call("Server.WriteAt", &req, &resp) + return resp.Len, err +} + +func (f *File) Close() error { + req := protocol.CloseRequest{ + FD: f.fd, + } + var resp protocol.CloseResponse + err := f.prog.client.Call("Server.Close", &req, &resp) + return err +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/dwarf.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/dwarf.go new file mode 100644 index 000000000..c0ae9c108 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/dwarf.go @@ -0,0 +1,112 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build linux + +package server + +import ( + "errors" + "fmt" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" +) + +func (s *Server) functionStartAddress(name string) (uint64, error) { + entry, err := s.dwarfData.LookupFunction(name) + if err != nil { + return 0, err + } + addrAttr := entry.Val(dwarf.AttrLowpc) + if addrAttr == nil { + return 0, fmt.Errorf("symbol %q has no LowPC attribute", name) + } + addr, ok := addrAttr.(uint64) + if !ok { + return 0, fmt.Errorf("symbol %q has non-uint64 LowPC attribute", name) + } + return addr, nil +} + +// evalLocation parses a DWARF location description encoded in v. It works for +// cases where the variable is stored at an offset from the Canonical Frame +// Address. The return value is this offset. +// TODO: a more general location-description-parsing function. +func evalLocation(v []uint8) (int64, error) { + // Some DWARF constants. + const ( + opConsts = 0x11 + opPlus = 0x22 + opCallFrameCFA = 0x9C + ) + if len(v) == 0 { + return 0, errors.New("empty location specifier") + } + if v[0] != opCallFrameCFA { + return 0, errors.New("unsupported location specifier") + } + if len(v) == 1 { + // The location description was just DW_OP_call_frame_cfa, so the location is exactly the CFA. + return 0, nil + } + if v[1] != opConsts { + return 0, errors.New("unsupported location specifier") + } + offset, v, err := sleb128(v[2:]) + if err != nil { + return 0, err + } + if len(v) == 1 && v[0] == opPlus { + // The location description was DW_OP_call_frame_cfa, DW_OP_consts , DW_OP_plus. + // So return the offset. + return offset, nil + } + return 0, errors.New("unsupported location specifier") +} + +func uleb128(v []uint8) (u uint64) { + var shift uint + for _, x := range v { + u |= (uint64(x) & 0x7F) << shift + shift += 7 + if x&0x80 == 0 { + break + } + } + return u +} + +// sleb128 parses a signed integer encoded with sleb128 at the start of v, and +// returns the integer and the remainder of v. +func sleb128(v []uint8) (s int64, rest []uint8, err error) { + var shift uint + var sign int64 = -1 + var i int + var x uint8 + for i, x = range v { + s |= (int64(x) & 0x7F) << shift + shift += 7 + sign <<= 7 + if x&0x80 == 0 { + if x&0x40 != 0 { + s |= sign + } + break + } + } + if i == len(v) { + return 0, nil, errors.New("truncated sleb128") + } + return s, v[i+1:], nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/eval.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/eval.go new file mode 100644 index 000000000..6a6493a41 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/eval.go @@ -0,0 +1,2115 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Evaluates Go expressions, using the current values of variables in a program +// being debugged. +// +// TODOs: +// More overflow checking. +// Stricter type checking. +// More expression types. + +// +build linux + +package server + +import ( + "errors" + "fmt" + "go/ast" + "go/parser" + "go/token" + "math" + "math/big" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" +) + +const prec = 256 // precision for untyped float and complex constants. + +var ( + // Some big.Ints to use in overflow checks. + bigIntMaxInt32 = big.NewInt(math.MaxInt32) + bigIntMinInt32 = big.NewInt(math.MinInt32) + bigIntMaxInt64 = big.NewInt(math.MaxInt64) + bigIntMinInt64 = big.NewInt(math.MinInt64) + bigIntMaxUint64 = new(big.Int).SetUint64(math.MaxUint64) +) + +// result stores an intermediate value produced during evaluation of an expression. +// +// d contains the DWARF type of the value. For untyped values, d will be nil. +// +// v contains the value itself. For numeric and bool types, v will have the +// corresponding predeclared Go type. +// For untyped integer, rune, float, complex, string, and bool constants, v will +// have type untInt, untRune, untFloat, untComplex, untString, or bool, +// respectively. +// For values of type int, uint and uintptr, v will be an int32, int64, uint32 +// or uint64 as appropriate. +// For address operations, v will have type pointerToValue. +// For the operands of address operations, v will have type addressableValue. +// Other types are represented using the corresponding implementation of +// debug.Value in program.go. +// +// If an evaluation results in an error, the zero value of result is used. +type result struct { + d dwarf.Type + v interface{} +} + +// untInt is an untyped integer constant +type untInt struct { + *big.Int +} + +// untRune is an untyped rune constant +type untRune struct { + *big.Int +} + +// untFloat is an untyped floating-point constant +type untFloat struct { + *big.Float +} + +// untComplex is an untyped complex constant +type untComplex struct { + r *big.Float + i *big.Float +} + +// untString is an untyped string constant +type untString string + +// pointerToValue is a pointer to a value in memory. +// The evaluator constructs these as the result of address operations like "&x". +// Unlike debug.Pointer, the DWARF type stored alongside values of this type +// is the type of the variable, not the type of the pointer. +type pointerToValue struct { + a uint64 +} + +// addressableValue is the memory location of a value. +// The evaluator constructs these while evaluating the operands of address +// operations like "&x", instead of computing the value of x itself. +type addressableValue struct { + a uint64 +} + +// A sliceOf is a slice created by slicing an array. +// Unlike debug.Slice, the DWARF type stored alongside a value of this type is +// the type of the slice's elements, not the type of the slice. +type sliceOf debug.Slice + +// ident is a value for representing a special identifier. +type ident string + +// identLookup is a built-in function of the expression evaluator which gets the +// value of a global symbol. +var identLookup ident = "lookup" + +// evalExpression evaluates a Go expression. +// If the program counter and stack pointer are nonzero, they are used to determine +// what local variables are available and where in memory they are. +func (s *Server) evalExpression(expression string, pc, sp uint64) (debug.Value, error) { + e := evaluator{server: s, expression: expression, pc: pc, sp: sp} + node, err := parser.ParseExpr(expression) + if err != nil { + return nil, err + } + val := e.evalNode(node, false) + if e.evalError != nil { + return nil, e.evalError + } + + // Convert untyped constants to their default types. + switch v := val.v.(type) { + case untInt: + return e.intFromInteger(v) + case untRune: + if v.Cmp(bigIntMaxInt32) == +1 { + return nil, errors.New("constant overflows rune") + } + if v.Cmp(bigIntMinInt32) == -1 { + return nil, errors.New("constant overflows rune") + } + return int32(v.Int64()), nil + case untFloat: + f, _ := v.Float64() + if math.IsInf(f, 0) { + return nil, errors.New("constant overflows float64") + } + if math.IsNaN(f) { + return nil, errors.New("constant is NaN") + } + return f, nil + case untComplex: + r, _ := v.r.Float64() + i, _ := v.i.Float64() + if math.IsInf(r, 0) || math.IsInf(i, 0) { + return nil, errors.New("constant overflows complex128") + } + if math.IsNaN(r) || math.IsNaN(i) { + return nil, errors.New("constant is NaN") + } + return complex(r, i), nil + case untString: + return debug.String{Length: uint64(len(v)), String: string(v)}, nil + case pointerToValue: + return debug.Pointer{TypeID: uint64(val.d.Common().Offset), Address: v.a}, nil + case sliceOf: + return debug.Slice(v), nil + case nil, addressableValue: + // This case should not be reachable. + return nil, errors.New("unknown error") + } + return val.v, nil +} + +type evaluator struct { + // expression is the expression being evaluated. + expression string + // server interacts with the program being debugged. + server *Server + // curNode is the current parse tree node. This is set so that error messages + // can quote the part of the expression that caused an error. + curNode ast.Node + // evalError is the first error that occurred while evaluating the expression, + // or nil if no error has occurred. + evalError error + // pc and sp are the current program counter and stack pointer, used for + // finding local variables. If either are zero, the expression is evaluated + // without using local variables. + pc uint64 + sp uint64 +} + +// setNode sets curNode, and returns curNode's previous value. +func (e *evaluator) setNode(node ast.Node) (old ast.Node) { + old, e.curNode = e.curNode, node + return old +} + +// err saves an error that occurred during evaluation. +// It returns a zero result, so that functions can exit and set an error with +// return e.err(...) +func (e *evaluator) err(s string) result { + if e.evalError != nil { + return result{} + } + // Append the substring of the expression that corresponds to the current AST node. + start := int(e.curNode.Pos() - 1) + end := int(e.curNode.End() - 1) + if start < 0 { + start = 0 + } + if end > len(e.expression) { + end = len(e.expression) + } + if start > end { + start, end = 0, 0 + } + e.evalError = errors.New(s + `: "` + e.expression[start:end] + `"`) + return result{} +} + +// evalNode computes the value of a node in the expression tree. +// If getAddress is true, the node is the argument of an & operator, so evalNode +// will return a result with a value of type addressableValue if possible. +func (e *evaluator) evalNode(node ast.Node, getAddress bool) result { + // Set the current node in the evaluator, so that error messages can refer to + // it. Defer a function call that changes it back. + defer e.setNode(e.setNode(node)) + + switch n := node.(type) { + case *ast.Ident: + if e.pc != 0 && e.sp != 0 { + a, t := e.server.findLocalVar(n.Name, e.pc, e.sp) + if t != nil { + return e.resultFrom(a, t, getAddress) + } + } + a, t := e.server.findGlobalVar(n.Name) + if t != nil { + return e.resultFrom(a, t, getAddress) + } + switch n.Name { + // Note: these could have been redefined as constants in the code, but we + // don't have a way to detect that. + case "true": + return result{nil, true} + case "false": + return result{nil, false} + case "lookup": + return result{nil, identLookup} + } + return e.err("unknown identifier") + + case *ast.BasicLit: + switch n.Kind { + case token.INT: + i := new(big.Int) + if _, ok := i.SetString(n.Value, 0); !ok { + return e.err("invalid integer constant") + } + return result{nil, untInt{i}} + case token.FLOAT: + r, _, err := big.ParseFloat(n.Value, 10, prec, big.ToNearestEven) + if err != nil { + return e.err(err.Error()) + } + return result{nil, untFloat{r}} + case token.IMAG: + if len(n.Value) <= 1 || n.Value[len(n.Value)-1] != 'i' { + return e.err("invalid imaginary constant") + } + r, _, err := big.ParseFloat(n.Value[:len(n.Value)-1], 10, prec, big.ToNearestEven) + if err != nil { + return e.err(err.Error()) + } + return result{nil, untComplex{new(big.Float), r}} + case token.CHAR: + // TODO: unescaping + return result{nil, untRune{new(big.Int).SetInt64(int64(n.Value[1]))}} + case token.STRING: + // TODO: unescaping + if len(n.Value) <= 1 { + return e.err("invalid string constant") + } + return result{nil, untString(n.Value[1 : len(n.Value)-1])} + } + + case *ast.ParenExpr: + return e.evalNode(n.X, getAddress) + + case *ast.StarExpr: + x := e.evalNode(n.X, false) + switch v := x.v.(type) { + case debug.Pointer: + // x.d may be a typedef pointing to a pointer type (or a typedef pointing + // to a typedef pointing to a pointer type, etc.), so remove typedefs + // until we get the underlying pointer type. + t := followTypedefs(x.d) + if pt, ok := t.(*dwarf.PtrType); ok { + return e.resultFrom(v.Address, pt.Type, getAddress) + } else { + return e.err("invalid DWARF type for pointer") + } + case pointerToValue: + return e.resultFrom(v.a, x.d, getAddress) + case nil: + return x + } + return e.err("invalid indirect") + + case *ast.SelectorExpr: + x := e.evalNode(n.X, false) + sel := n.Sel.Name + switch v := x.v.(type) { + case debug.Struct: + for _, f := range v.Fields { + if f.Name == sel { + t, err := e.server.dwarfData.Type(dwarf.Offset(f.Var.TypeID)) + if err != nil { + return e.err(err.Error()) + } + return e.resultFrom(f.Var.Address, t, getAddress) + } + } + return e.err("struct field not found") + case debug.Pointer: + pt, ok := followTypedefs(x.d).(*dwarf.PtrType) // x.d should be a pointer to struct. + if !ok { + return e.err("invalid DWARF information for pointer") + } + st, ok := followTypedefs(pt.Type).(*dwarf.StructType) + if !ok { + break + } + for _, f := range st.Field { + if f.Name == sel { + return e.resultFrom(v.Address+uint64(f.ByteOffset), f.Type, getAddress) + } + } + return e.err("struct field not found") + case pointerToValue: + st, ok := followTypedefs(x.d).(*dwarf.StructType) // x.d should be a struct. + if !ok { + break + } + for _, f := range st.Field { + if f.Name == sel { + return e.resultFrom(v.a+uint64(f.ByteOffset), f.Type, getAddress) + } + } + return e.err("struct field not found") + } + return e.err("invalid selector expression") + + case *ast.IndexExpr: + x, index := e.evalNode(n.X, false), e.evalNode(n.Index, false) + if x.v == nil || index.v == nil { + return result{} + } + // The expression is x[index] + if m, ok := x.v.(debug.Map); ok { + if getAddress { + return e.err("can't take address of map value") + } + mt, ok := followTypedefs(x.d).(*dwarf.MapType) + if !ok { + return e.err("invalid DWARF type for map") + } + var ( + found bool // true if the key was found + value result // the map value for the key + abort bool // true if an error occurred while searching + // fn is a function that checks if one (key, value) pair corresponds + // to the index in the expression. + fn = func(keyAddr, valAddr uint64, keyType, valType dwarf.Type) bool { + key := e.resultFrom(keyAddr, keyType, false) + if key.v == nil { + abort = true + return false // stop searching map + } + equal, ok := e.evalBinaryOp(token.EQL, index, key).v.(bool) + if !ok { + abort = true + return false // stop searching map + } + if equal { + found = true + value = e.resultFrom(valAddr, valType, false) + return false // stop searching map + } + return true // continue searching map + } + ) + if err := e.server.peekMapValues(mt, m.Address, fn); err != nil { + return e.err(err.Error()) + } + if abort { + // Some operation on individual map keys failed. + return result{} + } + if found { + return value + } + // The key wasn't in the map; return the zero value. + return e.zero(mt.ElemType) + } + + // The index should be a non-negative integer for the remaining cases. + u, err := uint64FromResult(index) + if err != nil { + return e.err("invalid index: " + err.Error()) + } + switch v := x.v.(type) { + case debug.Array: + if u >= v.Length { + return e.err("array index out of bounds") + } + elemType, err := e.server.dwarfData.Type(dwarf.Offset(v.ElementTypeID)) + if err != nil { + return e.err(err.Error()) + } + return e.resultFrom(v.Element(u).Address, elemType, getAddress) + case debug.Slice: + if u >= v.Length { + return e.err("slice index out of bounds") + } + elemType, err := e.server.dwarfData.Type(dwarf.Offset(v.ElementTypeID)) + if err != nil { + return e.err(err.Error()) + } + return e.resultFrom(v.Element(u).Address, elemType, getAddress) + case sliceOf: + if u >= v.Length { + return e.err("slice index out of bounds") + } + return e.resultFrom(v.Element(u).Address, x.d, getAddress) + case debug.String: + if getAddress { + return e.err("can't take address of string element") + } + if u >= v.Length { + return e.err("string index out of bounds") + } + if u >= uint64(len(v.String)) { + return e.err("string element unavailable") + } + return e.uint8Result(v.String[u]) + case untString: + if getAddress { + return e.err("can't take address of string element") + } + if u >= uint64(len(v)) { + return e.err("string index out of bounds") + } + return e.uint8Result(v[u]) + } + return e.err("invalid index expression") + + case *ast.SliceExpr: + if n.Slice3 && n.High == nil { + return e.err("middle index required in full slice") + } + if n.Slice3 && n.Max == nil { + return e.err("final index required in full slice") + } + var ( + low, high, max uint64 + err error + ) + if n.Low != nil { + low, err = uint64FromResult(e.evalNode(n.Low, false)) + if err != nil { + return e.err("invalid slice lower bound: " + err.Error()) + } + } + if n.High != nil { + high, err = uint64FromResult(e.evalNode(n.High, false)) + if err != nil { + return e.err("invalid slice upper bound: " + err.Error()) + } + } + if n.Max != nil { + max, err = uint64FromResult(e.evalNode(n.Max, false)) + if err != nil { + return e.err("invalid slice capacity: " + err.Error()) + } + } + x := e.evalNode(n.X, false) + switch v := x.v.(type) { + case debug.Array, debug.Pointer, pointerToValue: + // This case handles the slicing of arrays and pointers to arrays. + var arr debug.Array + switch v := x.v.(type) { + case debug.Array: + arr = v + case debug.Pointer: + pt, ok := followTypedefs(x.d).(*dwarf.PtrType) + if !ok { + return e.err("invalid DWARF type for pointer") + } + a := e.resultFrom(v.Address, pt.Type, false) + arr, ok = a.v.(debug.Array) + if !ok { + // v is a pointer to something other than an array. + return e.err("cannot slice pointer") + } + case pointerToValue: + a := e.resultFrom(v.a, x.d, false) + var ok bool + arr, ok = a.v.(debug.Array) + if !ok { + // v is a pointer to something other than an array. + return e.err("cannot slice pointer") + } + } + elemType, err := e.server.dwarfData.Type(dwarf.Offset(arr.ElementTypeID)) + if err != nil { + return e.err(err.Error()) + } + if n.High == nil { + high = arr.Length + } else if high > arr.Length { + return e.err("slice upper bound is too large") + } + if n.Max == nil { + max = arr.Length + } else if max > arr.Length { + return e.err("slice capacity is too large") + } + if low > high || high > max { + return e.err("invalid slice index") + } + return result{ + d: elemType, + v: sliceOf{ + Array: debug.Array{ + ElementTypeID: arr.ElementTypeID, + Address: arr.Element(low).Address, + Length: high - low, + StrideBits: uint64(elemType.Common().ByteSize) * 8, + }, + Capacity: max - low, + }, + } + case debug.Slice: + if n.High == nil { + high = v.Length + } else if high > v.Capacity { + return e.err("slice upper bound is too large") + } + if n.Max == nil { + max = v.Capacity + } else if max > v.Capacity { + return e.err("slice capacity is too large") + } + if low > high || high > max { + return e.err("invalid slice index") + } + v.Address += low * (v.StrideBits / 8) + v.Length = high - low + v.Capacity = max - low + return result{x.d, v} + case sliceOf: + if n.High == nil { + high = v.Length + } else if high > v.Capacity { + return e.err("slice upper bound is too large") + } + if n.Max == nil { + max = v.Capacity + } else if max > v.Capacity { + return e.err("slice capacity is too large") + } + if low > high || high > max { + return e.err("invalid slice index") + } + v.Address += low * (v.StrideBits / 8) + v.Length = high - low + v.Capacity = max - low + return result{x.d, v} + case debug.String: + if n.Max != nil { + return e.err("full slice of string") + } + if n.High == nil { + high = v.Length + } + if low > high || high > v.Length { + return e.err("invalid slice index") + } + v.Length = high - low + if low > uint64(len(v.String)) { + // v.String was truncated before the point where this slice starts. + v.String = "" + } else { + if high > uint64(len(v.String)) { + // v.String was truncated before the point where this slice ends. + high = uint64(len(v.String)) + } + v.String = v.String[low:high] + } + return result{x.d, v} + case untString: + if n.Max != nil { + return e.err("full slice of string") + } + if n.High == nil { + high = uint64(len(v)) + } + if low > high { + return e.err("invalid slice expression") + } + if high > uint64(len(v)) { + return e.err("slice upper bound is too large") + } + return e.stringResult(string(v[low:high])) + default: + return e.err("invalid slice expression") + } + + case *ast.CallExpr: + // Only supports lookup("x"), which gets the value of a global symbol x. + fun := e.evalNode(n.Fun, false) + var args []result + for _, a := range n.Args { + args = append(args, e.evalNode(a, false)) + } + if fun.v == identLookup { + if len(args) != 1 { + return e.err("lookup should have one argument") + } + ident, ok := args[0].v.(untString) + if !ok { + return e.err("argument for lookup should be a string constant") + } + if a, t := e.server.findGlobalVar(string(ident)); t == nil { + return e.err("symbol not found") + } else { + return e.resultFrom(a, t, getAddress) + } + } + return e.err("function calls not implemented") + + case *ast.UnaryExpr: + if n.Op == token.AND { + x := e.evalNode(n.X, true) + switch v := x.v.(type) { + case addressableValue: + return result{x.d, pointerToValue{v.a}} + case nil: + return x + } + return e.err("can't take address") + } + + x := e.evalNode(n.X, false) + if x.v == nil { + return x + } + switch v := x.v.(type) { + + case int8: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + case token.XOR: + v = ^v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case int16: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + case token.XOR: + v = ^v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case int32: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + case token.XOR: + v = ^v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case int64: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + case token.XOR: + v = ^v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case uint8: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + case token.XOR: + v = ^v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case uint16: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + case token.XOR: + v = ^v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case uint32: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + case token.XOR: + v = ^v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case uint64: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + case token.XOR: + v = ^v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case float32: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case float64: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case complex64: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case complex128: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case untInt: + switch n.Op { + case token.ADD: + case token.SUB: + v.Int.Neg(v.Int) + case token.XOR: + v.Int.Not(v.Int) + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case untRune: + switch n.Op { + case token.ADD: + case token.SUB: + v.Int.Neg(v.Int) + case token.XOR: + v.Int.Not(v.Int) + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case untFloat: + switch n.Op { + case token.ADD: + case token.SUB: + v.Float.Neg(v.Float) + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case untComplex: + switch n.Op { + case token.ADD: + case token.SUB: + v.r.Neg(v.r) + v.i.Neg(v.i) + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case bool: + switch n.Op { + case token.NOT: + v = !v + default: + return e.err("invalid operation") + } + return result{x.d, v} + } + + case *ast.BinaryExpr: + x := e.evalNode(n.X, false) + if x.v == nil { + return x + } + y := e.evalNode(n.Y, false) + if y.v == nil { + return y + } + return e.evalBinaryOp(n.Op, x, y) + } + return e.err("invalid expression") +} + +// evalBinaryOp evaluates a binary operator op applied to x and y. +func (e *evaluator) evalBinaryOp(op token.Token, x, y result) result { + if op == token.NEQ { + tmp := e.evalBinaryOp(token.EQL, x, y) + b, ok := tmp.v.(bool) + if !ok { + return tmp + } + return result{nil, !b} + } + if op == token.GTR { + return e.evalBinaryOp(token.LSS, y, x) + } + if op == token.GEQ { + return e.evalBinaryOp(token.LEQ, x, y) + } + + x = convertUntyped(x, y) + y = convertUntyped(y, x) + + switch a := x.v.(type) { + + case int8: + b, ok := y.v.(int8) + if !ok { + return e.err("type mismatch") + } + var c int8 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case int16: + b, ok := y.v.(int16) + if !ok { + return e.err("type mismatch") + } + var c int16 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case int32: + b, ok := y.v.(int32) + if !ok { + return e.err("type mismatch") + } + var c int32 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case int64: + b, ok := y.v.(int64) + if !ok { + return e.err("type mismatch") + } + var c int64 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case uint8: + b, ok := y.v.(uint8) + if !ok { + return e.err("type mismatch") + } + var c uint8 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case uint16: + b, ok := y.v.(uint16) + if !ok { + return e.err("type mismatch") + } + var c uint16 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case uint32: + b, ok := y.v.(uint32) + if !ok { + return e.err("type mismatch") + } + var c uint32 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case uint64: + b, ok := y.v.(uint64) + if !ok { + return e.err("type mismatch") + } + var c uint64 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case float32: + b, ok := y.v.(float32) + if !ok { + return e.err("type mismatch") + } + var c float32 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.MUL: + c = a * b + case token.QUO: + c = a / b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case float64: + b, ok := y.v.(float64) + if !ok { + return e.err("type mismatch") + } + var c float64 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.MUL: + c = a * b + case token.QUO: + c = a / b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case complex64: + b, ok := y.v.(complex64) + if !ok { + return e.err("type mismatch") + } + var c complex64 + switch op { + case token.EQL: + return result{nil, a == b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.MUL: + c = a * b + case token.QUO: + c = a / b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case complex128: + b, ok := y.v.(complex128) + if !ok { + return e.err("type mismatch") + } + var c complex128 + switch op { + case token.EQL: + return result{nil, a == b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.MUL: + c = a * b + case token.QUO: + c = a / b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case bool: + b, ok := y.v.(bool) + if !ok { + return e.err("type mismatch") + } + var c bool + switch op { + case token.LOR: + c = a || b + case token.LAND: + c = a && b + case token.EQL: + c = a == b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case debug.String: + b, ok := y.v.(debug.String) + if !ok { + return e.err("type mismatch") + } + var c debug.String + switch op { + // TODO: these comparison operators only use the part of the string that + // was read. Very large strings do not have their entire contents read by + // server.value. + case token.EQL: + return result{nil, a.Length == b.Length && a.String == b.String} + case token.LSS: + return result{nil, a.String < b.String} + case token.LEQ: + return result{nil, a.String <= b.String} + case token.ADD: + c.Length = a.Length + b.Length + if a.Length == uint64(len(a.String)) { + c.String = a.String + b.String + } else { + // The first string was truncated at a.Length characters, so the sum + // must be truncated there too. + c.String = a.String + } + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case untString: + b, ok := y.v.(untString) + if !ok { + return e.err("type mismatch") + } + var c untString + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case untInt: + i := a.Int + b, ok := y.v.(untInt) + if !ok { + return e.err("type mismatch") + } + switch op { + case token.EQL: + return result{nil, i.Cmp(b.Int) == 0} + case token.LSS: + return result{nil, i.Cmp(b.Int) < 0} + case token.LEQ: + return result{nil, i.Cmp(b.Int) <= 0} + } + c := new(big.Int) + switch op { + case token.ADD: + c.Add(i, b.Int) + case token.SUB: + c.Sub(i, b.Int) + case token.OR: + c.Or(i, b.Int) + case token.XOR: + c.Xor(i, b.Int) + case token.MUL: + c.Mul(i, b.Int) + case token.QUO: + if b.Sign() == 0 { + return e.err("integer divide by zero") + } + c.Quo(i, b.Int) + case token.REM: + if b.Sign() == 0 { + return e.err("integer divide by zero") + } + c.Mod(i, b.Int) + case token.AND: + c.And(i, b.Int) + case token.AND_NOT: + c.AndNot(i, b.Int) + default: + return e.err("invalid operation") + } + return result{nil, untInt{c}} + + case untRune: + i := a.Int + b, ok := y.v.(untRune) + if !ok { + return e.err("type mismatch") + } + switch op { + case token.EQL: + return result{nil, i.Cmp(b.Int) == 0} + case token.LSS: + return result{nil, i.Cmp(b.Int) < 0} + case token.LEQ: + return result{nil, i.Cmp(b.Int) <= 0} + } + c := new(big.Int) + switch op { + case token.ADD: + c.Add(i, b.Int) + case token.SUB: + c.Sub(i, b.Int) + case token.OR: + c.Or(i, b.Int) + case token.XOR: + c.Xor(i, b.Int) + case token.MUL: + c.Mul(i, b.Int) + case token.QUO: + if b.Sign() == 0 { + return e.err("integer divide by zero") + } + c.Quo(i, b.Int) + case token.REM: + if b.Sign() == 0 { + return e.err("integer divide by zero") + } + c.Mod(i, b.Int) + case token.AND: + c.And(i, b.Int) + case token.AND_NOT: + c.AndNot(i, b.Int) + default: + return e.err("invalid operation") + } + return result{nil, untRune{c}} + + case untFloat: + r := a.Float + b, ok := y.v.(untFloat) + if !ok { + return e.err("type mismatch") + } + switch op { + case token.EQL: + return result{nil, r.Cmp(b.Float) == 0} + case token.LSS: + return result{nil, r.Cmp(b.Float) < 0} + case token.LEQ: + return result{nil, r.Cmp(b.Float) <= 0} + } + c := new(big.Float) + switch op { + case token.ADD: + c.Add(r, b.Float) + case token.SUB: + c.Sub(r, b.Float) + case token.MUL: + c.Mul(r, b.Float) + case token.QUO: + if b.Sign() == 0 { + return e.err("divide by zero") + } + c.Quo(r, b.Float) + default: + return e.err("invalid operation") + } + return result{nil, untFloat{c}} + + case untComplex: + b, ok := y.v.(untComplex) + if !ok { + return e.err("type mismatch") + } + var ( + ar = a.r + br = b.r + ai = a.i + bi = b.i + ) + if op == token.EQL { + return result{nil, ar.Cmp(br) == 0 && ai.Cmp(bi) == 0} + } + var ( + cr = new(big.Float) + ci = new(big.Float) + ) + switch op { + case token.ADD: + cr.Add(ar, br) + ci.Add(ai, bi) + case token.SUB: + cr.Sub(ar, br) + ci.Sub(ai, bi) + case token.MUL: + var t0, t1 big.Float + t0.Mul(ar, br) + t1.Mul(ai, bi) + cr.Sub(&t0, &t1) + t0.Mul(ar, bi) + t1.Mul(ai, br) + ci.Add(&t0, &t1) + case token.QUO: + // a/b = a*conj(b)/|b|^2 + var t0, t1 big.Float + cr.Mul(ar, br) + t0.Mul(ai, bi) + cr.Add(cr, &t0) // cr = Re(a*conj(b)) + ci.Mul(ai, br) + t0.Mul(ar, bi) + ci.Sub(ci, &t0) // ci = Im(a*conj(b)) + t0.Mul(br, br) + t1.Mul(bi, bi) + t0.Add(&t0, &t1) // t0 = |b|^2 + if t0.Sign() == 0 { + return e.err("divide by zero") + } + cr.Quo(cr, &t0) // cr = Re(a*conj(b))/|b|^2 = Re(a/b) + ci.Quo(ci, &t0) // ci = Im(a*conj(b))/|b|^2 = Im(a/b) + } + return result{nil, untComplex{cr, ci}} + } + + return e.err("invalid operation") +} + +// findLocalVar finds a local variable (or function parameter) by name, and +// returns its address and DWARF type. It returns a nil type on failure. +// The PC and SP are used to determine the current function and stack frame. +func (s *Server) findLocalVar(name string, pc, sp uint64) (uint64, dwarf.Type) { + // Find the DWARF entry for the function at pc. + funcEntry, _, err := s.dwarfData.PCToFunction(uint64(pc)) + if err != nil { + return 0, nil + } + + // Compute the stack frame pointer. + fpOffset, err := s.dwarfData.PCToSPOffset(uint64(pc)) + if err != nil { + return 0, nil + } + framePointer := sp + uint64(fpOffset) + + // Check each child of the function's DWARF entry to see if it is a parameter + // or local variable with the right name. If so, return its address and type. + r := s.dwarfData.Reader() + r.Seek(funcEntry.Offset) + for { + varEntry, err := r.Next() + if err != nil { + break + } + if varEntry.Tag == 0 { + // This tag marks the end of the function's DWARF entry's children. + break + } + + // Check this entry corresponds to a local variable or function parameter, + // that it has the correct name, and that we can get its type and location. + // If so, return them. + if varEntry.Tag != dwarf.TagFormalParameter && varEntry.Tag != dwarf.TagVariable { + continue + } + varName, ok := varEntry.Val(dwarf.AttrName).(string) + if !ok { + continue + } + if varName != name { + continue + } + varTypeOffset, ok := varEntry.Val(dwarf.AttrType).(dwarf.Offset) + if !ok { + continue + } + varType, err := s.dwarfData.Type(varTypeOffset) + if err != nil { + continue + } + locationAttribute := varEntry.Val(dwarf.AttrLocation) + if locationAttribute == nil { + continue + } + locationDescription, ok := locationAttribute.([]uint8) + if !ok { + continue + } + frameOffset, err := evalLocation(locationDescription) + if err != nil { + continue + } + return framePointer + uint64(frameOffset), varType + } + + return 0, nil +} + +// findGlobalVar finds a global variable by name, and returns its address and +// DWARF type. It returns a nil type on failure. +func (s *Server) findGlobalVar(name string) (uint64, dwarf.Type) { + entry, err := s.dwarfData.LookupVariable(name) + if err != nil { + return 0, nil + } + loc, err := s.dwarfData.EntryLocation(entry) + if err != nil { + return 0, nil + } + ofs, err := s.dwarfData.EntryTypeOffset(entry) + if err != nil { + return 0, nil + } + typ, err := s.dwarfData.Type(ofs) + if err != nil { + return 0, nil + } + return loc, typ +} + +// intFromInteger converts an untyped integer constant to an int32 or int64, +// depending on the int size of the debugged program. +// It returns an error on overflow, or if it can't determine the int size. +func (e *evaluator) intFromInteger(v untInt) (interface{}, error) { + t, ok := e.getBaseType("int") + if !ok { + return nil, errors.New("couldn't get int size from DWARF info") + } + switch t.Common().ByteSize { + case 4: + if v.Cmp(bigIntMaxInt32) == +1 || v.Cmp(bigIntMinInt32) == -1 { + return nil, errors.New("constant overflows int") + } + return int32(v.Int64()), nil + case 8: + if v.Cmp(bigIntMaxInt64) == +1 || v.Cmp(bigIntMinInt64) == -1 { + return nil, errors.New("constant overflows int") + } + return v.Int64(), nil + } + return nil, errors.New("invalid int size in DWARF info") +} + +// uint8Result constructs a result for a uint8 value. +func (e *evaluator) uint8Result(v uint8) result { + t, ok := e.getBaseType("uint8") + if !ok { + e.err("couldn't construct uint8") + } + return result{t, uint8(v)} +} + +// stringResult constructs a result for a string value. +func (e *evaluator) stringResult(s string) result { + t, ok := e.getBaseType("string") + if !ok { + e.err("couldn't construct string") + } + return result{t, debug.String{Length: uint64(len(s)), String: s}} +} + +// getBaseType returns the *dwarf.Type with a given name. +// TODO: cache this. +func (e *evaluator) getBaseType(name string) (dwarf.Type, bool) { + entry, err := e.server.dwarfData.LookupEntry(name) + if err != nil { + return nil, false + } + t, err := e.server.dwarfData.Type(entry.Offset) + if err != nil { + return nil, false + } + return t, true +} + +// resultFrom constructs a result corresponding to a value in the program with +// the given address and DWARF type. +// If getAddress is true, the result will be the operand of an address expression, +// so resultFrom returns a result containing a value of type addressableValue. +func (e *evaluator) resultFrom(a uint64, t dwarf.Type, getAddress bool) result { + if a == 0 { + return e.err("nil pointer dereference") + } + if getAddress { + return result{t, addressableValue{a}} + } + v, err := e.server.value(t, a) + if err != nil { + return e.err(err.Error()) + } + return result{t, v} +} + +// zero returns the zero value of type t. +// TODO: implement for array and struct. +func (e *evaluator) zero(t dwarf.Type) result { + var v interface{} + switch typ := followTypedefs(t).(type) { + case *dwarf.CharType, *dwarf.IntType, *dwarf.EnumType: + switch typ.Common().ByteSize { + case 1: + v = int8(0) + case 2: + v = int16(0) + case 4: + v = int32(0) + case 8: + v = int64(0) + default: + return e.err("invalid integer size " + fmt.Sprint(typ.Common().ByteSize)) + } + case *dwarf.UcharType, *dwarf.UintType: + switch typ.Common().ByteSize { + case 1: + v = uint8(0) + case 2: + v = uint16(0) + case 4: + v = uint32(0) + case 8: + v = uint64(0) + default: + return e.err("invalid unsigned integer size " + fmt.Sprint(typ.Common().ByteSize)) + } + case *dwarf.FloatType: + switch typ.Common().ByteSize { + case 4: + v = float32(0) + case 8: + v = float64(0) + default: + return e.err("invalid float size " + fmt.Sprint(typ.Common().ByteSize)) + } + case *dwarf.ComplexType: + switch typ.Common().ByteSize { + case 8: + v = complex64(0) + case 16: + v = complex128(0) + default: + return e.err("invalid complex size " + fmt.Sprint(typ.Common().ByteSize)) + } + case *dwarf.BoolType: + v = false + case *dwarf.PtrType: + v = debug.Pointer{TypeID: uint64(t.Common().Offset)} + case *dwarf.SliceType: + v = debug.Slice{ + Array: debug.Array{ + ElementTypeID: uint64(typ.ElemType.Common().Offset), + StrideBits: uint64(typ.ElemType.Common().ByteSize) * 8, + }, + } + case *dwarf.StringType: + v = debug.String{} + case *dwarf.InterfaceType: + v = debug.Interface{} + case *dwarf.FuncType: + v = debug.Func{} + case *dwarf.MapType: + v = debug.Map{TypeID: uint64(t.Common().Offset)} + case *dwarf.ChanType: + v = debug.Channel{ + ElementTypeID: uint64(typ.ElemType.Common().Offset), + Stride: uint64(typ.ElemType.Common().ByteSize), + } + default: + return e.err("can't get zero value of this type") + } + return result{t, v} +} + +// convertUntyped converts x to be the same type as y, if x is untyped and the +// conversion is possible. +// +// An untyped bool can be converted to a boolean type. +// An untyped string can be converted to a string type. +// An untyped integer, rune, float or complex value can be converted to a +// numeric type, or to an untyped value later in that list. +// +// x is returned unchanged if none of these cases apply. +func convertUntyped(x, y result) result { + switch a := x.v.(type) { + case untInt: + i := a.Int + switch y.v.(type) { + case int8: + return result{y.d, int8(i.Int64())} + case int16: + return result{y.d, int16(i.Int64())} + case int32: + return result{y.d, int32(i.Int64())} + case int64: + return result{y.d, int64(i.Int64())} + case uint8: + return result{y.d, uint8(i.Uint64())} + case uint16: + return result{y.d, uint16(i.Uint64())} + case uint32: + return result{y.d, uint32(i.Uint64())} + case uint64: + return result{y.d, uint64(i.Uint64())} + case float32: + f, _ := new(big.Float).SetInt(i).Float32() + return result{y.d, f} + case float64: + f, _ := new(big.Float).SetInt(i).Float64() + return result{y.d, f} + case complex64: + f, _ := new(big.Float).SetInt(i).Float32() + return result{y.d, complex(f, 0)} + case complex128: + f, _ := new(big.Float).SetInt(i).Float64() + return result{y.d, complex(f, 0)} + case untRune: + return result{nil, untRune{i}} + case untFloat: + return result{nil, untFloat{new(big.Float).SetPrec(prec).SetInt(i)}} + case untComplex: + return result{nil, untComplex{new(big.Float).SetPrec(prec).SetInt(i), new(big.Float)}} + } + case untRune: + i := a.Int + switch y.v.(type) { + case int8: + return result{y.d, int8(i.Int64())} + case int16: + return result{y.d, int16(i.Int64())} + case int32: + return result{y.d, int32(i.Int64())} + case int64: + return result{y.d, int64(i.Int64())} + case uint8: + return result{y.d, uint8(i.Uint64())} + case uint16: + return result{y.d, uint16(i.Uint64())} + case uint32: + return result{y.d, uint32(i.Uint64())} + case uint64: + return result{y.d, uint64(i.Uint64())} + case float32: + f, _ := new(big.Float).SetInt(i).Float32() + return result{y.d, f} + case float64: + f, _ := new(big.Float).SetInt(i).Float64() + return result{y.d, f} + case complex64: + f, _ := new(big.Float).SetInt(i).Float32() + return result{y.d, complex(f, 0)} + case complex128: + f, _ := new(big.Float).SetInt(i).Float64() + return result{y.d, complex(f, 0)} + case untRune: + return result{nil, untRune{i}} + case untFloat: + return result{nil, untFloat{new(big.Float).SetPrec(prec).SetInt(i)}} + case untComplex: + return result{nil, untComplex{new(big.Float).SetPrec(prec).SetInt(i), new(big.Float)}} + } + case untFloat: + if a.IsInt() { + i, _ := a.Int(nil) + switch y.v.(type) { + case int8: + return result{y.d, int8(i.Int64())} + case int16: + return result{y.d, int16(i.Int64())} + case int32: + return result{y.d, int32(i.Int64())} + case int64: + return result{y.d, int64(i.Int64())} + case uint8: + return result{y.d, uint8(i.Uint64())} + case uint16: + return result{y.d, uint16(i.Uint64())} + case uint32: + return result{y.d, uint32(i.Uint64())} + case uint64: + return result{y.d, uint64(i.Uint64())} + } + } + switch y.v.(type) { + case float32: + f, _ := a.Float32() + return result{y.d, float32(f)} + case float64: + f, _ := a.Float64() + return result{y.d, float64(f)} + case complex64: + f, _ := a.Float32() + return result{y.d, complex(f, 0)} + case complex128: + f, _ := a.Float64() + return result{y.d, complex(f, 0)} + case untComplex: + return result{nil, untComplex{a.Float, new(big.Float)}} + } + case untComplex: + if a.i.Sign() == 0 { + // a is a real number. + if a.r.IsInt() { + // a is an integer. + i, _ := a.r.Int(nil) + switch y.v.(type) { + case int8: + return result{y.d, int8(i.Int64())} + case int16: + return result{y.d, int16(i.Int64())} + case int32: + return result{y.d, int32(i.Int64())} + case int64: + return result{y.d, int64(i.Int64())} + case uint8: + return result{y.d, uint8(i.Uint64())} + case uint16: + return result{y.d, uint16(i.Uint64())} + case uint32: + return result{y.d, uint32(i.Uint64())} + case uint64: + return result{y.d, uint64(i.Uint64())} + } + } + switch y.v.(type) { + case float32: + f, _ := a.r.Float32() + return result{y.d, float32(f)} + case float64: + f, _ := a.r.Float64() + return result{y.d, float64(f)} + } + } + switch y.v.(type) { + case complex64: + r, _ := a.r.Float32() + i, _ := a.i.Float32() + return result{y.d, complex(r, i)} + case complex128: + r, _ := a.r.Float64() + i, _ := a.i.Float64() + return result{y.d, complex(r, i)} + } + case bool: + if x.d != nil { + // x is a typed bool, not an untyped bool. + break + } + switch y.v.(type) { + case bool: + return result{y.d, bool(a)} + } + case untString: + switch y.v.(type) { + case debug.String: + return result{y.d, debug.String{Length: uint64(len(a)), String: string(a)}} + } + } + return x +} + +// uint64FromResult converts a result into a uint64 for slice or index expressions. +// It returns an error if the conversion cannot be done. +func uint64FromResult(x result) (uint64, error) { + switch v := x.v.(type) { + case int8: + if v < 0 { + return 0, errors.New("value is negative") + } + return uint64(v), nil + case int16: + if v < 0 { + return 0, errors.New("value is negative") + } + return uint64(v), nil + case int32: + if v < 0 { + return 0, errors.New("value is negative") + } + return uint64(v), nil + case int64: + if v < 0 { + return 0, errors.New("value is negative") + } + return uint64(v), nil + case uint8: + return uint64(v), nil + case uint16: + return uint64(v), nil + case uint32: + return uint64(v), nil + case uint64: + return v, nil + case untInt: + if v.Int.Sign() == -1 { + return 0, errors.New("value is negative") + } + if v.Int.Cmp(bigIntMaxUint64) == +1 { + return 0, errors.New("value is too large") + } + return v.Int.Uint64(), nil + case untRune: + if v.Sign() == -1 { + return 0, errors.New("value is negative") + } + if v.Cmp(bigIntMaxUint64) == +1 { + return 0, errors.New("value is too large") + } + return v.Uint64(), nil + case untFloat: + if !v.IsInt() { + return 0, errors.New("value is not an integer") + } + if v.Sign() == -1 { + return 0, errors.New("value is negative") + } + i, _ := v.Int(nil) + if i.Cmp(bigIntMaxUint64) == +1 { + return 0, errors.New("value is too large") + } + return i.Uint64(), nil + case untComplex: + if v.i.Sign() != 0 { + return 0, errors.New("value is complex") + } + if !v.r.IsInt() { + return 0, errors.New("value is not an integer") + } + if v.r.Sign() == -1 { + return 0, errors.New("value is negative") + } + i, _ := v.r.Int(nil) + if i.Cmp(bigIntMaxUint64) == +1 { + return 0, errors.New("value is too large") + } + return i.Uint64(), nil + } + return 0, fmt.Errorf("cannot convert to unsigned integer") +} + +// followTypedefs returns the underlying type of t, removing any typedefs. +// If t leads to a cycle of typedefs, followTypedefs returns nil. +func followTypedefs(t dwarf.Type) dwarf.Type { + // If t is a *dwarf.TypedefType, next returns t.Type, otherwise it returns t. + // The bool returned is true when the argument was a typedef. + next := func(t dwarf.Type) (dwarf.Type, bool) { + tt, ok := t.(*dwarf.TypedefType) + if !ok { + return t, false + } + return tt.Type, true + } + // Advance two pointers, one at twice the speed, so we can detect if we get + // stuck in a cycle. + slow, fast := t, t + for { + var wasTypedef bool + fast, wasTypedef = next(fast) + if !wasTypedef { + return fast + } + fast, wasTypedef = next(fast) + if !wasTypedef { + return fast + } + slow, _ = next(slow) + if slow == fast { + return nil + } + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/eval.m4 b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/eval.m4 new file mode 100644 index 000000000..a191b3644 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/eval.m4 @@ -0,0 +1,1721 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//m4_changequote(`@',`@') +// Evaluates Go expressions, using the current values of variables in a program +// being debugged. +// +// TODOs: +// More overflow checking. +// Stricter type checking. +// More expression types. + +package server + +import ( + "errors" + "fmt" + "go/ast" + "go/parser" + "go/token" + "math" + "math/big" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" +) + +const prec = 256 // precision for untyped float and complex constants. + +var ( + // Some big.Ints to use in overflow checks. + bigIntMaxInt32 = big.NewInt(math.MaxInt32) + bigIntMinInt32 = big.NewInt(math.MinInt32) + bigIntMaxInt64 = big.NewInt(math.MaxInt64) + bigIntMinInt64 = big.NewInt(math.MinInt64) + bigIntMaxUint64 = new(big.Int).SetUint64(math.MaxUint64) +) + +// result stores an intermediate value produced during evaluation of an expression. +// +// d contains the DWARF type of the value. For untyped values, d will be nil. +// +// v contains the value itself. For numeric and bool types, v will have the +// corresponding predeclared Go type. +// For untyped integer, rune, float, complex, string, and bool constants, v will +// have type untInt, untRune, untFloat, untComplex, untString, or bool, +// respectively. +// For values of type int, uint and uintptr, v will be an int32, int64, uint32 +// or uint64 as appropriate. +// For address operations, v will have type pointerToValue. +// For the operands of address operations, v will have type addressableValue. +// Other types are represented using the corresponding implementation of +// debug.Value in program.go. +// +// If an evaluation results in an error, the zero value of result is used. +type result struct { + d dwarf.Type + v interface{} +} + +// untInt is an untyped integer constant +type untInt struct { + *big.Int +} + +// untRune is an untyped rune constant +type untRune struct { + *big.Int +} + +// untFloat is an untyped floating-point constant +type untFloat struct { + *big.Float +} + +// untComplex is an untyped complex constant +type untComplex struct { + r *big.Float + i *big.Float +} + +// untString is an untyped string constant +type untString string + +// pointerToValue is a pointer to a value in memory. +// The evaluator constructs these as the result of address operations like "&x". +// Unlike debug.Pointer, the DWARF type stored alongside values of this type +// is the type of the variable, not the type of the pointer. +type pointerToValue struct { + a uint64 +} + +// addressableValue is the memory location of a value. +// The evaluator constructs these while evaluating the operands of address +// operations like "&x", instead of computing the value of x itself. +type addressableValue struct { + a uint64 +} + +// A sliceOf is a slice created by slicing an array. +// Unlike debug.Slice, the DWARF type stored alongside a value of this type is +// the type of the slice's elements, not the type of the slice. +type sliceOf debug.Slice + +// ident is a value for representing a special identifier. +type ident string + +// identLookup is a built-in function of the expression evaluator which gets the +// value of a global symbol. +var identLookup ident = "lookup" + +// evalExpression evaluates a Go expression. +// If the program counter and stack pointer are nonzero, they are used to determine +// what local variables are available and where in memory they are. +func (s *Server) evalExpression(expression string, pc, sp uint64) (debug.Value, error) { + e := evaluator{server: s, expression: expression, pc: pc, sp: sp} + node, err := parser.ParseExpr(expression) + if err != nil { + return nil, err + } + val := e.evalNode(node, false) + if e.evalError != nil { + return nil, e.evalError + } + + // Convert untyped constants to their default types. + switch v := val.v.(type) { + case untInt: + return e.intFromInteger(v) + case untRune: + if v.Cmp(bigIntMaxInt32) == +1 { + return nil, errors.New("constant overflows rune") + } + if v.Cmp(bigIntMinInt32) == -1 { + return nil, errors.New("constant overflows rune") + } + return int32(v.Int64()), nil + case untFloat: + f, _ := v.Float64() + if math.IsInf(f, 0) { + return nil, errors.New("constant overflows float64") + } + if math.IsNaN(f) { + return nil, errors.New("constant is NaN") + } + return f, nil + case untComplex: + r, _ := v.r.Float64() + i, _ := v.i.Float64() + if math.IsInf(r, 0) || math.IsInf(i, 0) { + return nil, errors.New("constant overflows complex128") + } + if math.IsNaN(r) || math.IsNaN(i) { + return nil, errors.New("constant is NaN") + } + return complex(r, i), nil + case untString: + return debug.String{Length: uint64(len(v)), String: string(v)}, nil + case pointerToValue: + return debug.Pointer{TypeID: uint64(val.d.Common().Offset), Address: v.a}, nil + case sliceOf: + return debug.Slice(v), nil + case nil, addressableValue: + // This case should not be reachable. + return nil, errors.New("unknown error") + } + return val.v, nil +} + +type evaluator struct { + // expression is the expression being evaluated. + expression string + // server interacts with the program being debugged. + server *Server + // curNode is the current parse tree node. This is set so that error messages + // can quote the part of the expression that caused an error. + curNode ast.Node + // evalError is the first error that occurred while evaluating the expression, + // or nil if no error has occurred. + evalError error + // pc and sp are the current program counter and stack pointer, used for + // finding local variables. If either are zero, the expression is evaluated + // without using local variables. + pc uint64 + sp uint64 +} + +// setNode sets curNode, and returns curNode's previous value. +func (e *evaluator) setNode(node ast.Node) (old ast.Node) { + old, e.curNode = e.curNode, node + return old +} + +// err saves an error that occurred during evaluation. +// It returns a zero result, so that functions can exit and set an error with +// return e.err(...) +func (e *evaluator) err(s string) result { + if e.evalError != nil { + return result{} + } + // Append the substring of the expression that corresponds to the current AST node. + start := int(e.curNode.Pos() - 1) + end := int(e.curNode.End() - 1) + if start < 0 { + start = 0 + } + if end > len(e.expression) { + end = len(e.expression) + } + if start > end { + start, end = 0, 0 + } + e.evalError = errors.New(s + `: "` + e.expression[start:end] + `"`) + return result{} +} + +// evalNode computes the value of a node in the expression tree. +// If getAddress is true, the node is the argument of an & operator, so evalNode +// will return a result with a value of type addressableValue if possible. +func (e *evaluator) evalNode(node ast.Node, getAddress bool) result { + // Set the current node in the evaluator, so that error messages can refer to + // it. Defer a function call that changes it back. + defer e.setNode(e.setNode(node)) + + switch n := node.(type) { + case *ast.Ident: + if e.pc != 0 && e.sp != 0 { + a, t := e.server.findLocalVar(n.Name, e.pc, e.sp) + if t != nil { + return e.resultFrom(a, t, getAddress) + } + } + a, t := e.server.findGlobalVar(n.Name) + if t != nil { + return e.resultFrom(a, t, getAddress) + } + switch n.Name { + // Note: these could have been redefined as constants in the code, but we + // don't have a way to detect that. + case "true": + return result{nil, true} + case "false": + return result{nil, false} + case "lookup": + return result{nil, identLookup} + } + return e.err("unknown identifier") + + case *ast.BasicLit: + switch n.Kind { + case token.INT: + i := new(big.Int) + if _, ok := i.SetString(n.Value, 0); !ok { + return e.err("invalid integer constant") + } + return result{nil, untInt{i}} + case token.FLOAT: + r, _, err := big.ParseFloat(n.Value, 10, prec, big.ToNearestEven) + if err != nil { + return e.err(err.Error()) + } + return result{nil, untFloat{r}} + case token.IMAG: + if len(n.Value) <= 1 || n.Value[len(n.Value)-1] != 'i' { + return e.err("invalid imaginary constant") + } + r, _, err := big.ParseFloat(n.Value[:len(n.Value)-1], 10, prec, big.ToNearestEven) + if err != nil { + return e.err(err.Error()) + } + return result{nil, untComplex{new(big.Float), r}} + case token.CHAR: + // TODO: unescaping + return result{nil, untRune{new(big.Int).SetInt64(int64(n.Value[1]))}} + case token.STRING: + // TODO: unescaping + if len(n.Value) <= 1 { + return e.err("invalid string constant") + } + return result{nil, untString(n.Value[1 : len(n.Value)-1])} + } + + case *ast.ParenExpr: + return e.evalNode(n.X, getAddress) + + case *ast.StarExpr: + x := e.evalNode(n.X, false) + switch v := x.v.(type) { + case debug.Pointer: + // x.d may be a typedef pointing to a pointer type (or a typedef pointing + // to a typedef pointing to a pointer type, etc.), so remove typedefs + // until we get the underlying pointer type. + t := followTypedefs(x.d) + if pt, ok := t.(*dwarf.PtrType); ok { + return e.resultFrom(v.Address, pt.Type, getAddress) + } else { + return e.err("invalid DWARF type for pointer") + } + case pointerToValue: + return e.resultFrom(v.a, x.d, getAddress) + case nil: + return x + } + return e.err("invalid indirect") + + case *ast.SelectorExpr: + x := e.evalNode(n.X, false) + sel := n.Sel.Name + switch v := x.v.(type) { + case debug.Struct: + for _, f := range v.Fields { + if f.Name == sel { + t, err := e.server.dwarfData.Type(dwarf.Offset(f.Var.TypeID)) + if err != nil { + return e.err(err.Error()) + } + return e.resultFrom(f.Var.Address, t, getAddress) + } + } + return e.err("struct field not found") + case debug.Pointer: + pt, ok := followTypedefs(x.d).(*dwarf.PtrType) // x.d should be a pointer to struct. + if !ok { + return e.err("invalid DWARF information for pointer") + } + st, ok := followTypedefs(pt.Type).(*dwarf.StructType) + if !ok { + break + } + for _, f := range st.Field { + if f.Name == sel { + return e.resultFrom(v.Address+uint64(f.ByteOffset), f.Type, getAddress) + } + } + return e.err("struct field not found") + case pointerToValue: + st, ok := followTypedefs(x.d).(*dwarf.StructType) // x.d should be a struct. + if !ok { + break + } + for _, f := range st.Field { + if f.Name == sel { + return e.resultFrom(v.a+uint64(f.ByteOffset), f.Type, getAddress) + } + } + return e.err("struct field not found") + } + return e.err("invalid selector expression") + + case *ast.IndexExpr: + x, index := e.evalNode(n.X, false), e.evalNode(n.Index, false) + if x.v == nil || index.v == nil { + return result{} + } + // The expression is x[index] + if m, ok := x.v.(debug.Map); ok { + if getAddress { + return e.err("can't take address of map value") + } + mt, ok := followTypedefs(x.d).(*dwarf.MapType) + if !ok { + return e.err("invalid DWARF type for map") + } + var ( + found bool // true if the key was found + value result // the map value for the key + abort bool // true if an error occurred while searching + // fn is a function that checks if one (key, value) pair corresponds + // to the index in the expression. + fn = func(keyAddr, valAddr uint64, keyType, valType dwarf.Type) bool { + key := e.resultFrom(keyAddr, keyType, false) + if key.v == nil { + abort = true + return false // stop searching map + } + equal, ok := e.evalBinaryOp(token.EQL, index, key).v.(bool) + if !ok { + abort = true + return false // stop searching map + } + if equal { + found = true + value = e.resultFrom(valAddr, valType, false) + return false // stop searching map + } + return true // continue searching map + } + ) + if err := e.server.peekMapValues(mt, m.Address, fn); err != nil { + return e.err(err.Error()) + } + if abort { + // Some operation on individual map keys failed. + return result{} + } + if found { + return value + } + // The key wasn't in the map; return the zero value. + return e.zero(mt.ElemType) + } + + // The index should be a non-negative integer for the remaining cases. + u, err := uint64FromResult(index) + if err != nil { + return e.err("invalid index: " + err.Error()) + } + switch v := x.v.(type) { + case debug.Array: + if u >= v.Length { + return e.err("array index out of bounds") + } + elemType, err := e.server.dwarfData.Type(dwarf.Offset(v.ElementTypeID)) + if err != nil { + return e.err(err.Error()) + } + return e.resultFrom(v.Element(u).Address, elemType, getAddress) + case debug.Slice: + if u >= v.Length { + return e.err("slice index out of bounds") + } + elemType, err := e.server.dwarfData.Type(dwarf.Offset(v.ElementTypeID)) + if err != nil { + return e.err(err.Error()) + } + return e.resultFrom(v.Element(u).Address, elemType, getAddress) + case sliceOf: + if u >= v.Length { + return e.err("slice index out of bounds") + } + return e.resultFrom(v.Element(u).Address, x.d, getAddress) + case debug.String: + if getAddress { + return e.err("can't take address of string element") + } + if u >= v.Length { + return e.err("string index out of bounds") + } + if u >= uint64(len(v.String)) { + return e.err("string element unavailable") + } + return e.uint8Result(v.String[u]) + case untString: + if getAddress { + return e.err("can't take address of string element") + } + if u >= uint64(len(v)) { + return e.err("string index out of bounds") + } + return e.uint8Result(v[u]) + } + return e.err("invalid index expression") + + case *ast.SliceExpr: + if n.Slice3 && n.High == nil { + return e.err("middle index required in full slice") + } + if n.Slice3 && n.Max == nil { + return e.err("final index required in full slice") + } + var ( + low, high, max uint64 + err error + ) + if n.Low != nil { + low, err = uint64FromResult(e.evalNode(n.Low, false)) + if err != nil { + return e.err("invalid slice lower bound: " + err.Error()) + } + } + if n.High != nil { + high, err = uint64FromResult(e.evalNode(n.High, false)) + if err != nil { + return e.err("invalid slice upper bound: " + err.Error()) + } + } + if n.Max != nil { + max, err = uint64FromResult(e.evalNode(n.Max, false)) + if err != nil { + return e.err("invalid slice capacity: " + err.Error()) + } + } + x := e.evalNode(n.X, false) + switch v := x.v.(type) { + case debug.Array, debug.Pointer, pointerToValue: + // This case handles the slicing of arrays and pointers to arrays. + var arr debug.Array + switch v := x.v.(type) { + case debug.Array: + arr = v + case debug.Pointer: + pt, ok := followTypedefs(x.d).(*dwarf.PtrType) + if !ok { + return e.err("invalid DWARF type for pointer") + } + a := e.resultFrom(v.Address, pt.Type, false) + arr, ok = a.v.(debug.Array) + if !ok { + // v is a pointer to something other than an array. + return e.err("cannot slice pointer") + } + case pointerToValue: + a := e.resultFrom(v.a, x.d, false) + var ok bool + arr, ok = a.v.(debug.Array) + if !ok { + // v is a pointer to something other than an array. + return e.err("cannot slice pointer") + } + } + elemType, err := e.server.dwarfData.Type(dwarf.Offset(arr.ElementTypeID)) + if err != nil { + return e.err(err.Error()) + } + if n.High == nil { + high = arr.Length + } else if high > arr.Length { + return e.err("slice upper bound is too large") + } + if n.Max == nil { + max = arr.Length + } else if max > arr.Length { + return e.err("slice capacity is too large") + } + if low > high || high > max { + return e.err("invalid slice index") + } + return result{ + d: elemType, + v: sliceOf{ + Array: debug.Array{ + ElementTypeID: arr.ElementTypeID, + Address: arr.Element(low).Address, + Length: high - low, + StrideBits: uint64(elemType.Common().ByteSize) * 8, + }, + Capacity: max - low, + }, + } + case debug.Slice: + if n.High == nil { + high = v.Length + } else if high > v.Capacity { + return e.err("slice upper bound is too large") + } + if n.Max == nil { + max = v.Capacity + } else if max > v.Capacity { + return e.err("slice capacity is too large") + } + if low > high || high > max { + return e.err("invalid slice index") + } + v.Address += low * (v.StrideBits / 8) + v.Length = high - low + v.Capacity = max - low + return result{x.d, v} + case sliceOf: + if n.High == nil { + high = v.Length + } else if high > v.Capacity { + return e.err("slice upper bound is too large") + } + if n.Max == nil { + max = v.Capacity + } else if max > v.Capacity { + return e.err("slice capacity is too large") + } + if low > high || high > max { + return e.err("invalid slice index") + } + v.Address += low * (v.StrideBits / 8) + v.Length = high - low + v.Capacity = max - low + return result{x.d, v} + case debug.String: + if n.Max != nil { + return e.err("full slice of string") + } + if n.High == nil { + high = v.Length + } + if low > high || high > v.Length { + return e.err("invalid slice index") + } + v.Length = high - low + if low > uint64(len(v.String)) { + // v.String was truncated before the point where this slice starts. + v.String = "" + } else { + if high > uint64(len(v.String)) { + // v.String was truncated before the point where this slice ends. + high = uint64(len(v.String)) + } + v.String = v.String[low:high] + } + return result{x.d, v} + case untString: + if n.Max != nil { + return e.err("full slice of string") + } + if n.High == nil { + high = uint64(len(v)) + } + if low > high { + return e.err("invalid slice expression") + } + if high > uint64(len(v)) { + return e.err("slice upper bound is too large") + } + return e.stringResult(string(v[low:high])) + default: + return e.err("invalid slice expression") + } + + case *ast.CallExpr: + // Only supports lookup("x"), which gets the value of a global symbol x. + fun := e.evalNode(n.Fun, false) + var args []result + for _, a := range n.Args { + args = append(args, e.evalNode(a, false)) + } + if fun.v == identLookup { + if len(args) != 1 { + return e.err("lookup should have one argument") + } + ident, ok := args[0].v.(untString) + if !ok { + return e.err("argument for lookup should be a string constant") + } + if a, t := e.server.findGlobalVar(string(ident)); t == nil { + return e.err("symbol not found") + } else { + return e.resultFrom(a, t, getAddress) + } + } + return e.err("function calls not implemented") + + case *ast.UnaryExpr: + if n.Op == token.AND { + x := e.evalNode(n.X, true) + switch v := x.v.(type) { + case addressableValue: + return result{x.d, pointerToValue{v.a}} + case nil: + return x + } + return e.err("can't take address") + } + + x := e.evalNode(n.X, false) + if x.v == nil { + return x + } + switch v := x.v.(type) { +m4_define(UNARY_INT_OPS, @case $1: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + case token.XOR: + v = ^v + default: + return e.err("invalid operation") + } + return result{x.d, v} +@) +m4_define(UNARY_FLOAT_OPS, @case $1: + switch n.Op { + case token.ADD: + case token.SUB: + v = -v + default: + return e.err("invalid operation") + } + return result{x.d, v} +@) + UNARY_INT_OPS(int8) + UNARY_INT_OPS(int16) + UNARY_INT_OPS(int32) + UNARY_INT_OPS(int64) + UNARY_INT_OPS(uint8) + UNARY_INT_OPS(uint16) + UNARY_INT_OPS(uint32) + UNARY_INT_OPS(uint64) + UNARY_FLOAT_OPS(float32) + UNARY_FLOAT_OPS(float64) + UNARY_FLOAT_OPS(complex64) + UNARY_FLOAT_OPS(complex128) + case untInt: + switch n.Op { + case token.ADD: + case token.SUB: + v.Int.Neg(v.Int) + case token.XOR: + v.Int.Not(v.Int) + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case untRune: + switch n.Op { + case token.ADD: + case token.SUB: + v.Int.Neg(v.Int) + case token.XOR: + v.Int.Not(v.Int) + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case untFloat: + switch n.Op { + case token.ADD: + case token.SUB: + v.Float.Neg(v.Float) + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case untComplex: + switch n.Op { + case token.ADD: + case token.SUB: + v.r.Neg(v.r) + v.i.Neg(v.i) + default: + return e.err("invalid operation") + } + return result{x.d, v} + + case bool: + switch n.Op { + case token.NOT: + v = !v + default: + return e.err("invalid operation") + } + return result{x.d, v} + } + + case *ast.BinaryExpr: + x := e.evalNode(n.X, false) + if x.v == nil { + return x + } + y := e.evalNode(n.Y, false) + if y.v == nil { + return y + } + return e.evalBinaryOp(n.Op, x, y) + } + return e.err("invalid expression") +} + +// evalBinaryOp evaluates a binary operator op applied to x and y. +func (e *evaluator) evalBinaryOp(op token.Token, x, y result) result { + if op == token.NEQ { + tmp := e.evalBinaryOp(token.EQL, x, y) + b, ok := tmp.v.(bool) + if !ok { + return tmp + } + return result{nil, !b} + } + if op == token.GTR { + return e.evalBinaryOp(token.LSS, y, x) + } + if op == token.GEQ { + return e.evalBinaryOp(token.LEQ, x, y) + } + + x = convertUntyped(x, y) + y = convertUntyped(y, x) + + switch a := x.v.(type) { +m4_define(INT_OPS, @case $1: + b, ok := y.v.($1) + if !ok { + return e.err("type mismatch") + } + var c $1 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} +@) +m4_define(UINT_OPS, @case $1: + b, ok := y.v.($1) + if !ok { + return e.err("type mismatch") + } + var c $1 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.OR: + c = a | b + case token.XOR: + c = a ^ b + case token.MUL: + c = a * b + case token.QUO: + if b == 0 { + return e.err("integer divide by zero") + } + c = a / b + case token.REM: + if b == 0 { + return e.err("integer divide by zero") + } + c = a % b + case token.AND: + c = a & b + case token.AND_NOT: + c = a &^ b + default: + return e.err("invalid operation") + } + return result{x.d, c} +@) +m4_define(FLOAT_OPS, @case $1: + b, ok := y.v.($1) + if !ok { + return e.err("type mismatch") + } + var c $1 + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.MUL: + c = a * b + case token.QUO: + c = a / b + default: + return e.err("invalid operation") + } + return result{x.d, c} +@) +m4_define(COMPLEX_OPS, @case $1: + b, ok := y.v.($1) + if !ok { + return e.err("type mismatch") + } + var c $1 + switch op { + case token.EQL: + return result{nil, a == b} + case token.ADD: + c = a + b + case token.SUB: + c = a - b + case token.MUL: + c = a * b + case token.QUO: + c = a / b + default: + return e.err("invalid operation") + } + return result{x.d, c} +@) + INT_OPS(int8) + INT_OPS(int16) + INT_OPS(int32) + INT_OPS(int64) + UINT_OPS(uint8) + UINT_OPS(uint16) + UINT_OPS(uint32) + UINT_OPS(uint64) + FLOAT_OPS(float32) + FLOAT_OPS(float64) + COMPLEX_OPS(complex64) + COMPLEX_OPS(complex128) + case bool: + b, ok := y.v.(bool) + if !ok { + return e.err("type mismatch") + } + var c bool + switch op { + case token.LOR: + c = a || b + case token.LAND: + c = a && b + case token.EQL: + c = a == b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case debug.String: + b, ok := y.v.(debug.String) + if !ok { + return e.err("type mismatch") + } + var c debug.String + switch op { + // TODO: these comparison operators only use the part of the string that + // was read. Very large strings do not have their entire contents read by + // server.value. + case token.EQL: + return result{nil, a.Length == b.Length && a.String == b.String} + case token.LSS: + return result{nil, a.String < b.String} + case token.LEQ: + return result{nil, a.String <= b.String} + case token.ADD: + c.Length = a.Length + b.Length + if a.Length == uint64(len(a.String)) { + c.String = a.String + b.String + } else { + // The first string was truncated at a.Length characters, so the sum + // must be truncated there too. + c.String = a.String + } + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case untString: + b, ok := y.v.(untString) + if !ok { + return e.err("type mismatch") + } + var c untString + switch op { + case token.EQL: + return result{nil, a == b} + case token.LSS: + return result{nil, a < b} + case token.LEQ: + return result{nil, a <= b} + case token.ADD: + c = a + b + default: + return e.err("invalid operation") + } + return result{x.d, c} + + case untInt: + i := a.Int + b, ok := y.v.(untInt) + if !ok { + return e.err("type mismatch") + } + switch op { + case token.EQL: + return result{nil, i.Cmp(b.Int) == 0} + case token.LSS: + return result{nil, i.Cmp(b.Int) < 0} + case token.LEQ: + return result{nil, i.Cmp(b.Int) <= 0} + } + c := new(big.Int) + switch op { + case token.ADD: + c.Add(i, b.Int) + case token.SUB: + c.Sub(i, b.Int) + case token.OR: + c.Or(i, b.Int) + case token.XOR: + c.Xor(i, b.Int) + case token.MUL: + c.Mul(i, b.Int) + case token.QUO: + if b.Sign() == 0 { + return e.err("integer divide by zero") + } + c.Quo(i, b.Int) + case token.REM: + if b.Sign() == 0 { + return e.err("integer divide by zero") + } + c.Mod(i, b.Int) + case token.AND: + c.And(i, b.Int) + case token.AND_NOT: + c.AndNot(i, b.Int) + default: + return e.err("invalid operation") + } + return result{nil, untInt{c}} + + case untRune: + i := a.Int + b, ok := y.v.(untRune) + if !ok { + return e.err("type mismatch") + } + switch op { + case token.EQL: + return result{nil, i.Cmp(b.Int) == 0} + case token.LSS: + return result{nil, i.Cmp(b.Int) < 0} + case token.LEQ: + return result{nil, i.Cmp(b.Int) <= 0} + } + c := new(big.Int) + switch op { + case token.ADD: + c.Add(i, b.Int) + case token.SUB: + c.Sub(i, b.Int) + case token.OR: + c.Or(i, b.Int) + case token.XOR: + c.Xor(i, b.Int) + case token.MUL: + c.Mul(i, b.Int) + case token.QUO: + if b.Sign() == 0 { + return e.err("integer divide by zero") + } + c.Quo(i, b.Int) + case token.REM: + if b.Sign() == 0 { + return e.err("integer divide by zero") + } + c.Mod(i, b.Int) + case token.AND: + c.And(i, b.Int) + case token.AND_NOT: + c.AndNot(i, b.Int) + default: + return e.err("invalid operation") + } + return result{nil, untRune{c}} + + case untFloat: + r := a.Float + b, ok := y.v.(untFloat) + if !ok { + return e.err("type mismatch") + } + switch op { + case token.EQL: + return result{nil, r.Cmp(b.Float) == 0} + case token.LSS: + return result{nil, r.Cmp(b.Float) < 0} + case token.LEQ: + return result{nil, r.Cmp(b.Float) <= 0} + } + c := new(big.Float) + switch op { + case token.ADD: + c.Add(r, b.Float) + case token.SUB: + c.Sub(r, b.Float) + case token.MUL: + c.Mul(r, b.Float) + case token.QUO: + if b.Sign() == 0 { + return e.err("divide by zero") + } + c.Quo(r, b.Float) + default: + return e.err("invalid operation") + } + return result{nil, untFloat{c}} + + case untComplex: + b, ok := y.v.(untComplex) + if !ok { + return e.err("type mismatch") + } + var ( + ar = a.r + br = b.r + ai = a.i + bi = b.i + ) + if op == token.EQL { + return result{nil, ar.Cmp(br) == 0 && ai.Cmp(bi) == 0} + } + var ( + cr = new(big.Float) + ci = new(big.Float) + ) + switch op { + case token.ADD: + cr.Add(ar, br) + ci.Add(ai, bi) + case token.SUB: + cr.Sub(ar, br) + ci.Sub(ai, bi) + case token.MUL: + var t0, t1 big.Float + t0.Mul(ar, br) + t1.Mul(ai, bi) + cr.Sub(&t0, &t1) + t0.Mul(ar, bi) + t1.Mul(ai, br) + ci.Add(&t0, &t1) + case token.QUO: + // a/b = a*conj(b)/|b|^2 + var t0, t1 big.Float + cr.Mul(ar, br) + t0.Mul(ai, bi) + cr.Add(cr, &t0) // cr = Re(a*conj(b)) + ci.Mul(ai, br) + t0.Mul(ar, bi) + ci.Sub(ci, &t0) // ci = Im(a*conj(b)) + t0.Mul(br, br) + t1.Mul(bi, bi) + t0.Add(&t0, &t1) // t0 = |b|^2 + if t0.Sign() == 0 { + return e.err("divide by zero") + } + cr.Quo(cr, &t0) // cr = Re(a*conj(b))/|b|^2 = Re(a/b) + ci.Quo(ci, &t0) // ci = Im(a*conj(b))/|b|^2 = Im(a/b) + } + return result{nil, untComplex{cr, ci}} + } + + return e.err("invalid operation") +} + +// findLocalVar finds a local variable (or function parameter) by name, and +// returns its address and DWARF type. It returns a nil type on failure. +// The PC and SP are used to determine the current function and stack frame. +func (s *Server) findLocalVar(name string, pc, sp uint64) (uint64, dwarf.Type) { + // Find the DWARF entry for the function at pc. + funcEntry, _, err := s.dwarfData.PCToFunction(uint64(pc)) + if err != nil { + return 0, nil + } + + // Compute the stack frame pointer. + fpOffset, err := s.dwarfData.PCToSPOffset(uint64(pc)) + if err != nil { + return 0, nil + } + framePointer := sp + uint64(fpOffset) + + // Check each child of the function's DWARF entry to see if it is a parameter + // or local variable with the right name. If so, return its address and type. + r := s.dwarfData.Reader() + r.Seek(funcEntry.Offset) + for { + varEntry, err := r.Next() + if err != nil { + break + } + if varEntry.Tag == 0 { + // This tag marks the end of the function's DWARF entry's children. + break + } + + // Check this entry corresponds to a local variable or function parameter, + // that it has the correct name, and that we can get its type and location. + // If so, return them. + if varEntry.Tag != dwarf.TagFormalParameter && varEntry.Tag != dwarf.TagVariable { + continue + } + varName, ok := varEntry.Val(dwarf.AttrName).(string) + if !ok { + continue + } + if varName != name { + continue + } + varTypeOffset, ok := varEntry.Val(dwarf.AttrType).(dwarf.Offset) + if !ok { + continue + } + varType, err := s.dwarfData.Type(varTypeOffset) + if err != nil { + continue + } + locationAttribute := varEntry.Val(dwarf.AttrLocation) + if locationAttribute == nil { + continue + } + locationDescription, ok := locationAttribute.([]uint8) + if !ok { + continue + } + frameOffset, err := evalLocation(locationDescription) + if err != nil { + continue + } + return framePointer + uint64(frameOffset), varType + } + + return 0, nil +} + +// findGlobalVar finds a global variable by name, and returns its address and +// DWARF type. It returns a nil type on failure. +func (s *Server) findGlobalVar(name string) (uint64, dwarf.Type) { + entry, err := s.dwarfData.LookupVariable(name) + if err != nil { + return 0, nil + } + loc, err := s.dwarfData.EntryLocation(entry) + if err != nil { + return 0, nil + } + ofs, err := s.dwarfData.EntryTypeOffset(entry) + if err != nil { + return 0, nil + } + typ, err := s.dwarfData.Type(ofs) + if err != nil { + return 0, nil + } + return loc, typ +} + +// intFromInteger converts an untyped integer constant to an int32 or int64, +// depending on the int size of the debugged program. +// It returns an error on overflow, or if it can't determine the int size. +func (e *evaluator) intFromInteger(v untInt) (interface{}, error) { + t, ok := e.getBaseType("int") + if !ok { + return nil, errors.New("couldn't get int size from DWARF info") + } + switch t.Common().ByteSize { + case 4: + if v.Cmp(bigIntMaxInt32) == +1 || v.Cmp(bigIntMinInt32) == -1 { + return nil, errors.New("constant overflows int") + } + return int32(v.Int64()), nil + case 8: + if v.Cmp(bigIntMaxInt64) == +1 || v.Cmp(bigIntMinInt64) == -1 { + return nil, errors.New("constant overflows int") + } + return v.Int64(), nil + } + return nil, errors.New("invalid int size in DWARF info") +} + +// uint8Result constructs a result for a uint8 value. +func (e *evaluator) uint8Result(v uint8) result { + t, ok := e.getBaseType("uint8") + if !ok { + e.err("couldn't construct uint8") + } + return result{t, uint8(v)} +} + +// stringResult constructs a result for a string value. +func (e *evaluator) stringResult(s string) result { + t, ok := e.getBaseType("string") + if !ok { + e.err("couldn't construct string") + } + return result{t, debug.String{Length: uint64(len(s)), String: s}} +} + +// getBaseType returns the *dwarf.Type with a given name. +// TODO: cache this. +func (e *evaluator) getBaseType(name string) (dwarf.Type, bool) { + entry, err := e.server.dwarfData.LookupEntry(name) + if err != nil { + return nil, false + } + t, err := e.server.dwarfData.Type(entry.Offset) + if err != nil { + return nil, false + } + return t, true +} + +// resultFrom constructs a result corresponding to a value in the program with +// the given address and DWARF type. +// If getAddress is true, the result will be the operand of an address expression, +// so resultFrom returns a result containing a value of type addressableValue. +func (e *evaluator) resultFrom(a uint64, t dwarf.Type, getAddress bool) result { + if a == 0 { + return e.err("nil pointer dereference") + } + if getAddress { + return result{t, addressableValue{a}} + } + v, err := e.server.value(t, a) + if err != nil { + return e.err(err.Error()) + } + return result{t, v} +} + +// zero returns the zero value of type t. +// TODO: implement for array and struct. +func (e *evaluator) zero(t dwarf.Type) result { + var v interface{} + switch typ := followTypedefs(t).(type) { + case *dwarf.CharType, *dwarf.IntType, *dwarf.EnumType: + switch typ.Common().ByteSize { + case 1: + v = int8(0) + case 2: + v = int16(0) + case 4: + v = int32(0) + case 8: + v = int64(0) + default: + return e.err("invalid integer size " + fmt.Sprint(typ.Common().ByteSize)) + } + case *dwarf.UcharType, *dwarf.UintType: + switch typ.Common().ByteSize { + case 1: + v = uint8(0) + case 2: + v = uint16(0) + case 4: + v = uint32(0) + case 8: + v = uint64(0) + default: + return e.err("invalid unsigned integer size " + fmt.Sprint(typ.Common().ByteSize)) + } + case *dwarf.FloatType: + switch typ.Common().ByteSize { + case 4: + v = float32(0) + case 8: + v = float64(0) + default: + return e.err("invalid float size " + fmt.Sprint(typ.Common().ByteSize)) + } + case *dwarf.ComplexType: + switch typ.Common().ByteSize { + case 8: + v = complex64(0) + case 16: + v = complex128(0) + default: + return e.err("invalid complex size " + fmt.Sprint(typ.Common().ByteSize)) + } + case *dwarf.BoolType: + v = false + case *dwarf.PtrType: + v = debug.Pointer{TypeID: uint64(t.Common().Offset)} + case *dwarf.SliceType: + v = debug.Slice{ + Array: debug.Array{ + ElementTypeID: uint64(typ.ElemType.Common().Offset), + StrideBits: uint64(typ.ElemType.Common().ByteSize) * 8, + }, + } + case *dwarf.StringType: + v = debug.String{} + case *dwarf.InterfaceType: + v = debug.Interface{} + case *dwarf.FuncType: + v = debug.Func{} + case *dwarf.MapType: + v = debug.Map{TypeID: uint64(t.Common().Offset)} + case *dwarf.ChanType: + v = debug.Channel{ + ElementTypeID: uint64(typ.ElemType.Common().Offset), + Stride: uint64(typ.ElemType.Common().ByteSize), + } + default: + return e.err("can't get zero value of this type") + } + return result{t, v} +} + +// convertUntyped converts x to be the same type as y, if x is untyped and the +// conversion is possible. +// +// An untyped bool can be converted to a boolean type. +// An untyped string can be converted to a string type. +// An untyped integer, rune, float or complex value can be converted to a +// numeric type, or to an untyped value later in that list. +// +// x is returned unchanged if none of these cases apply. +func convertUntyped(x, y result) result { + switch a := x.v.(type) { + case untInt: + i := a.Int + switch y.v.(type) { + case int8: + return result{y.d, int8(i.Int64())} + case int16: + return result{y.d, int16(i.Int64())} + case int32: + return result{y.d, int32(i.Int64())} + case int64: + return result{y.d, int64(i.Int64())} + case uint8: + return result{y.d, uint8(i.Uint64())} + case uint16: + return result{y.d, uint16(i.Uint64())} + case uint32: + return result{y.d, uint32(i.Uint64())} + case uint64: + return result{y.d, uint64(i.Uint64())} + case float32: + f, _ := new(big.Float).SetInt(i).Float32() + return result{y.d, f} + case float64: + f, _ := new(big.Float).SetInt(i).Float64() + return result{y.d, f} + case complex64: + f, _ := new(big.Float).SetInt(i).Float32() + return result{y.d, complex(f, 0)} + case complex128: + f, _ := new(big.Float).SetInt(i).Float64() + return result{y.d, complex(f, 0)} + case untRune: + return result{nil, untRune{i}} + case untFloat: + return result{nil, untFloat{new(big.Float).SetPrec(prec).SetInt(i)}} + case untComplex: + return result{nil, untComplex{new(big.Float).SetPrec(prec).SetInt(i), new(big.Float)}} + } + case untRune: + i := a.Int + switch y.v.(type) { + case int8: + return result{y.d, int8(i.Int64())} + case int16: + return result{y.d, int16(i.Int64())} + case int32: + return result{y.d, int32(i.Int64())} + case int64: + return result{y.d, int64(i.Int64())} + case uint8: + return result{y.d, uint8(i.Uint64())} + case uint16: + return result{y.d, uint16(i.Uint64())} + case uint32: + return result{y.d, uint32(i.Uint64())} + case uint64: + return result{y.d, uint64(i.Uint64())} + case float32: + f, _ := new(big.Float).SetInt(i).Float32() + return result{y.d, f} + case float64: + f, _ := new(big.Float).SetInt(i).Float64() + return result{y.d, f} + case complex64: + f, _ := new(big.Float).SetInt(i).Float32() + return result{y.d, complex(f, 0)} + case complex128: + f, _ := new(big.Float).SetInt(i).Float64() + return result{y.d, complex(f, 0)} + case untRune: + return result{nil, untRune{i}} + case untFloat: + return result{nil, untFloat{new(big.Float).SetPrec(prec).SetInt(i)}} + case untComplex: + return result{nil, untComplex{new(big.Float).SetPrec(prec).SetInt(i), new(big.Float)}} + } + case untFloat: + if a.IsInt() { + i, _ := a.Int(nil) + switch y.v.(type) { + case int8: + return result{y.d, int8(i.Int64())} + case int16: + return result{y.d, int16(i.Int64())} + case int32: + return result{y.d, int32(i.Int64())} + case int64: + return result{y.d, int64(i.Int64())} + case uint8: + return result{y.d, uint8(i.Uint64())} + case uint16: + return result{y.d, uint16(i.Uint64())} + case uint32: + return result{y.d, uint32(i.Uint64())} + case uint64: + return result{y.d, uint64(i.Uint64())} + } + } + switch y.v.(type) { + case float32: + f, _ := a.Float32() + return result{y.d, float32(f)} + case float64: + f, _ := a.Float64() + return result{y.d, float64(f)} + case complex64: + f, _ := a.Float32() + return result{y.d, complex(f, 0)} + case complex128: + f, _ := a.Float64() + return result{y.d, complex(f, 0)} + case untComplex: + return result{nil, untComplex{a.Float, new(big.Float)}} + } + case untComplex: + if a.i.Sign() == 0 { + // a is a real number. + if a.r.IsInt() { + // a is an integer. + i, _ := a.r.Int(nil) + switch y.v.(type) { + case int8: + return result{y.d, int8(i.Int64())} + case int16: + return result{y.d, int16(i.Int64())} + case int32: + return result{y.d, int32(i.Int64())} + case int64: + return result{y.d, int64(i.Int64())} + case uint8: + return result{y.d, uint8(i.Uint64())} + case uint16: + return result{y.d, uint16(i.Uint64())} + case uint32: + return result{y.d, uint32(i.Uint64())} + case uint64: + return result{y.d, uint64(i.Uint64())} + } + } + switch y.v.(type) { + case float32: + f, _ := a.r.Float32() + return result{y.d, float32(f)} + case float64: + f, _ := a.r.Float64() + return result{y.d, float64(f)} + } + } + switch y.v.(type) { + case complex64: + r, _ := a.r.Float32() + i, _ := a.i.Float32() + return result{y.d, complex(r, i)} + case complex128: + r, _ := a.r.Float64() + i, _ := a.i.Float64() + return result{y.d, complex(r, i)} + } + case bool: + if x.d != nil { + // x is a typed bool, not an untyped bool. + break + } + switch y.v.(type) { + case bool: + return result{y.d, bool(a)} + } + case untString: + switch y.v.(type) { + case debug.String: + return result{y.d, debug.String{Length: uint64(len(a)), String: string(a)}} + } + } + return x +} + +// uint64FromResult converts a result into a uint64 for slice or index expressions. +// It returns an error if the conversion cannot be done. +func uint64FromResult(x result) (uint64, error) { + switch v := x.v.(type) { + case int8: + if v < 0 { + return 0, errors.New("value is negative") + } + return uint64(v), nil + case int16: + if v < 0 { + return 0, errors.New("value is negative") + } + return uint64(v), nil + case int32: + if v < 0 { + return 0, errors.New("value is negative") + } + return uint64(v), nil + case int64: + if v < 0 { + return 0, errors.New("value is negative") + } + return uint64(v), nil + case uint8: + return uint64(v), nil + case uint16: + return uint64(v), nil + case uint32: + return uint64(v), nil + case uint64: + return v, nil + case untInt: + if v.Int.Sign() == -1 { + return 0, errors.New("value is negative") + } + if v.Int.Cmp(bigIntMaxUint64) == +1 { + return 0, errors.New("value is too large") + } + return v.Int.Uint64(), nil + case untRune: + if v.Sign() == -1 { + return 0, errors.New("value is negative") + } + if v.Cmp(bigIntMaxUint64) == +1 { + return 0, errors.New("value is too large") + } + return v.Uint64(), nil + case untFloat: + if !v.IsInt() { + return 0, errors.New("value is not an integer") + } + if v.Sign() == -1 { + return 0, errors.New("value is negative") + } + i, _ := v.Int(nil) + if i.Cmp(bigIntMaxUint64) == +1 { + return 0, errors.New("value is too large") + } + return i.Uint64(), nil + case untComplex: + if v.i.Sign() != 0 { + return 0, errors.New("value is complex") + } + if !v.r.IsInt() { + return 0, errors.New("value is not an integer") + } + if v.r.Sign() == -1 { + return 0, errors.New("value is negative") + } + i, _ := v.r.Int(nil) + if i.Cmp(bigIntMaxUint64) == +1 { + return 0, errors.New("value is too large") + } + return i.Uint64(), nil + } + return 0, fmt.Errorf("cannot convert to unsigned integer") +} + +// followTypedefs returns the underlying type of t, removing any typedefs. +// If t leads to a cycle of typedefs, followTypedefs returns nil. +func followTypedefs(t dwarf.Type) dwarf.Type { + // If t is a *dwarf.TypedefType, next returns t.Type, otherwise it returns t. + // The bool returned is true when the argument was a typedef. + next := func(t dwarf.Type) (dwarf.Type, bool) { + tt, ok := t.(*dwarf.TypedefType) + if !ok { + return t, false + } + return tt.Type, true + } + // Advance two pointers, one at twice the speed, so we can detect if we get + // stuck in a cycle. + slow, fast := t, t + for { + var wasTypedef bool + fast, wasTypedef = next(fast) + if !wasTypedef { + return fast + } + fast, wasTypedef = next(fast) + if !wasTypedef { + return fast + } + slow, _ = next(slow) + if slow == fast { + return nil + } + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/peek.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/peek.go new file mode 100644 index 000000000..8b0e11bab --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/peek.go @@ -0,0 +1,378 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Functions for reading values of various types from a program's memory. + +// +build linux + +package server + +import ( + "errors" + "fmt" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" +) + +// peekBytes reads len(buf) bytes at addr. +func (s *Server) peekBytes(addr uint64, buf []byte) error { + return s.ptracePeek(s.stoppedPid, uintptr(addr), buf) +} + +// peekPtr reads a pointer at addr. +func (s *Server) peekPtr(addr uint64) (uint64, error) { + buf := make([]byte, s.arch.PointerSize) + if err := s.peekBytes(addr, buf); err != nil { + return 0, err + } + return s.arch.Uintptr(buf), nil +} + +// peekUint8 reads a single byte at addr. +func (s *Server) peekUint8(addr uint64) (byte, error) { + buf := make([]byte, 1) + if err := s.peekBytes(addr, buf); err != nil { + return 0, err + } + return uint8(s.arch.UintN(buf)), nil +} + +// peekInt reads an int of size n bytes at addr. +func (s *Server) peekInt(addr uint64, n int64) (int64, error) { + buf := make([]byte, n) + if err := s.peekBytes(addr, buf); err != nil { + return 0, err + } + return s.arch.IntN(buf), nil +} + +// peekUint reads a uint of size n bytes at addr. +func (s *Server) peekUint(addr uint64, n int64) (uint64, error) { + buf := make([]byte, n) + if err := s.peekBytes(addr, buf); err != nil { + return 0, err + } + return s.arch.UintN(buf), nil +} + +// peekSlice reads the header of a slice with the given type and address. +func (s *Server) peekSlice(t *dwarf.SliceType, addr uint64) (debug.Slice, error) { + ptr, err := s.peekPtrStructField(&t.StructType, addr, "array") + if err != nil { + return debug.Slice{}, fmt.Errorf("reading slice location: %s", err) + } + length, err := s.peekUintOrIntStructField(&t.StructType, addr, "len") + if err != nil { + return debug.Slice{}, fmt.Errorf("reading slice length: %s", err) + } + capacity, err := s.peekUintOrIntStructField(&t.StructType, addr, "cap") + if err != nil { + return debug.Slice{}, fmt.Errorf("reading slice capacity: %s", err) + } + if capacity < length { + return debug.Slice{}, fmt.Errorf("slice's capacity %d is less than its length %d", capacity, length) + } + + return debug.Slice{ + debug.Array{ + ElementTypeID: uint64(t.ElemType.Common().Offset), + Address: uint64(ptr), + Length: length, + StrideBits: uint64(t.ElemType.Common().ByteSize) * 8, + }, + capacity, + }, nil +} + +// peekString reads a string of the given type at the given address. +// At most byteLimit bytes will be read. If the string is longer, "..." is appended. +func (s *Server) peekString(typ *dwarf.StringType, a uint64, byteLimit uint64) (string, error) { + ptr, err := s.peekPtrStructField(&typ.StructType, a, "str") + if err != nil { + return "", err + } + length, err := s.peekUintOrIntStructField(&typ.StructType, a, "len") + if err != nil { + return "", err + } + if length > byteLimit { + buf := make([]byte, byteLimit, byteLimit+3) + if err := s.peekBytes(ptr, buf); err != nil { + return "", err + } else { + buf = append(buf, '.', '.', '.') + return string(buf), nil + } + } else { + buf := make([]byte, length) + if err := s.peekBytes(ptr, buf); err != nil { + return "", err + } else { + return string(buf), nil + } + } +} + +// peekCString reads a NUL-terminated string at the given address. +// At most byteLimit bytes will be read. If the string is longer, "..." is appended. +// peekCString never returns errors; if an error occurs, the string will be truncated in some way. +func (s *Server) peekCString(a uint64, byteLimit uint64) string { + buf := make([]byte, byteLimit, byteLimit+3) + s.peekBytes(a, buf) + for i, c := range buf { + if c == 0 { + return string(buf[0:i]) + } + } + buf = append(buf, '.', '.', '.') + return string(buf) +} + +// peekPtrStructField reads a pointer in the field fieldName of the struct +// of type t at addr. +func (s *Server) peekPtrStructField(t *dwarf.StructType, addr uint64, fieldName string) (uint64, error) { + f, err := getField(t, fieldName) + if err != nil { + return 0, fmt.Errorf("reading field %s: %s", fieldName, err) + } + if _, ok := f.Type.(*dwarf.PtrType); !ok { + return 0, fmt.Errorf("field %s is not a pointer", fieldName) + } + return s.peekPtr(addr + uint64(f.ByteOffset)) +} + +// peekUintOrIntStructField reads a signed or unsigned integer in the field fieldName +// of the struct of type t at addr. If the value is negative, it returns an error. +// This function is used when the value should be non-negative, but the DWARF +// type of the field may be signed or unsigned. +func (s *Server) peekUintOrIntStructField(t *dwarf.StructType, addr uint64, fieldName string) (uint64, error) { + f, err := getField(t, fieldName) + if err != nil { + return 0, fmt.Errorf("reading field %s: %s", fieldName, err) + } + ut, ok := f.Type.(*dwarf.UintType) + if ok { + return s.peekUint(addr+uint64(f.ByteOffset), ut.ByteSize) + } + it, ok := f.Type.(*dwarf.IntType) + if !ok { + return 0, fmt.Errorf("field %s is not an integer", fieldName) + } + i, err := s.peekInt(addr+uint64(f.ByteOffset), it.ByteSize) + if err != nil { + return 0, err + } + if i < 0 { + return 0, fmt.Errorf("field %s is negative", fieldName) + } + return uint64(i), nil +} + +// peekUintStructField reads a uint in the field fieldName of the struct +// of type t at addr. The size of the uint is determined by the field. +func (s *Server) peekUintStructField(t *dwarf.StructType, addr uint64, fieldName string) (uint64, error) { + f, err := getField(t, fieldName) + if err != nil { + return 0, fmt.Errorf("reading field %s: %s", fieldName, err) + } + ut, ok := f.Type.(*dwarf.UintType) + if !ok { + return 0, fmt.Errorf("field %s is not an unsigned integer", fieldName) + } + return s.peekUint(addr+uint64(f.ByteOffset), ut.ByteSize) +} + +// peekIntStructField reads an int in the field fieldName of the struct +// of type t at addr. The size of the int is determined by the field. +func (s *Server) peekIntStructField(t *dwarf.StructType, addr uint64, fieldName string) (int64, error) { + f, err := getField(t, fieldName) + if err != nil { + return 0, fmt.Errorf("reading field %s: %s", fieldName, err) + } + it, ok := f.Type.(*dwarf.IntType) + if !ok { + return 0, fmt.Errorf("field %s is not a signed integer", fieldName) + } + return s.peekInt(addr+uint64(f.ByteOffset), it.ByteSize) +} + +// peekStringStructField reads a string field from the struct of the given type +// at the given address. +// At most byteLimit bytes will be read. If the string is longer, "..." is appended. +func (s *Server) peekStringStructField(t *dwarf.StructType, addr uint64, fieldName string, byteLimit uint64) (string, error) { + f, err := getField(t, fieldName) + if err != nil { + return "", fmt.Errorf("reading field %s: %s", fieldName, err) + } + st, ok := followTypedefs(f.Type).(*dwarf.StringType) + if !ok { + return "", fmt.Errorf("field %s is not a string", fieldName) + } + return s.peekString(st, addr+uint64(f.ByteOffset), byteLimit) +} + +// peekMapLocationAndType returns the address and DWARF type of the underlying +// struct of a map variable. +func (s *Server) peekMapLocationAndType(t *dwarf.MapType, a uint64) (uint64, *dwarf.StructType, error) { + // Maps are pointers to structs. + pt, ok := t.Type.(*dwarf.PtrType) + if !ok { + return 0, nil, errors.New("bad map type: not a pointer") + } + st, ok := pt.Type.(*dwarf.StructType) + if !ok { + return 0, nil, errors.New("bad map type: not a pointer to a struct") + } + // a is the address of a pointer to a struct. Get the pointer's value. + a, err := s.peekPtr(a) + if err != nil { + return 0, nil, fmt.Errorf("reading map pointer: %s", err) + } + return a, st, nil +} + +// peekMapValues reads a map at the given address and calls fn with the addresses for each (key, value) pair. +// If fn returns false, peekMapValues stops. +func (s *Server) peekMapValues(t *dwarf.MapType, a uint64, fn func(keyAddr, valAddr uint64, keyType, valType dwarf.Type) bool) error { + a, st, err := s.peekMapLocationAndType(t, a) + if err != nil { + return err + } + if a == 0 { + // The pointer was nil, so the map is empty. + return nil + } + // Gather information about the struct type and the map bucket type. + b, err := s.peekUintStructField(st, a, "B") + if err != nil { + return fmt.Errorf("reading map: %s", err) + } + buckets, err := s.peekPtrStructField(st, a, "buckets") + if err != nil { + return fmt.Errorf("reading map: %s", err) + } + oldbuckets, err := s.peekPtrStructField(st, a, "oldbuckets") + if err != nil { + return fmt.Errorf("reading map: %s", err) + } + bf, err := getField(st, "buckets") + if err != nil { + return fmt.Errorf("reading map: %s", err) + } + bucketPtrType, ok := bf.Type.(*dwarf.PtrType) + if !ok { + return errors.New("bad map bucket type: not a pointer") + } + bt, ok := bucketPtrType.Type.(*dwarf.StructType) + if !ok { + return errors.New("bad map bucket type: not a pointer to a struct") + } + bucketSize := uint64(bucketPtrType.Type.Size()) + tophashField, err := getField(bt, "tophash") + if err != nil { + return fmt.Errorf("reading map: %s", err) + } + bucketCnt := uint64(tophashField.Type.Size()) + tophashFieldOffset := uint64(tophashField.ByteOffset) + keysField, err := getField(bt, "keys") + if err != nil { + return fmt.Errorf("reading map: %s", err) + } + keysType, ok := keysField.Type.(*dwarf.ArrayType) + if !ok { + return errors.New(`bad map bucket type: "keys" is not an array`) + } + keyType := keysType.Type + keysStride := uint64(keysType.StrideBitSize / 8) + keysFieldOffset := uint64(keysField.ByteOffset) + valuesField, err := getField(bt, "values") + if err != nil { + return fmt.Errorf("reading map: %s", err) + } + valuesType, ok := valuesField.Type.(*dwarf.ArrayType) + if !ok { + return errors.New(`bad map bucket type: "values" is not an array`) + } + valueType := valuesType.Type + valuesStride := uint64(valuesType.StrideBitSize / 8) + valuesFieldOffset := uint64(valuesField.ByteOffset) + overflowField, err := getField(bt, "overflow") + if err != nil { + return fmt.Errorf("reading map: %s", err) + } + overflowFieldOffset := uint64(overflowField.ByteOffset) + + // Iterate through the two arrays of buckets. + bucketArrays := [2]struct { + addr uint64 + size uint64 + }{ + {buckets, 1 << b}, + {oldbuckets, 1 << (b - 1)}, + } + for _, bucketArray := range bucketArrays { + if bucketArray.addr == 0 { + continue + } + for i := uint64(0); i < bucketArray.size; i++ { + bucketAddr := bucketArray.addr + i*bucketSize + // Iterate through the linked list of buckets. + // TODO: check for repeated bucket pointers. + for bucketAddr != 0 { + // Iterate through each entry in the bucket. + for j := uint64(0); j < bucketCnt; j++ { + tophash, err := s.peekUint8(bucketAddr + tophashFieldOffset + j) + if err != nil { + return errors.New("reading map: " + err.Error()) + } + // From runtime/hashmap.go + const minTopHash = 4 + if tophash < minTopHash { + continue + } + keyAddr := bucketAddr + keysFieldOffset + j*keysStride + valAddr := bucketAddr + valuesFieldOffset + j*valuesStride + if !fn(keyAddr, valAddr, keyType, valueType) { + return nil + } + } + var err error + bucketAddr, err = s.peekPtr(bucketAddr + overflowFieldOffset) + if err != nil { + return errors.New("reading map: " + err.Error()) + } + } + } + } + + return nil +} + +// peekMapLength returns the number of elements in a map at the given address. +func (s *Server) peekMapLength(t *dwarf.MapType, a uint64) (uint64, error) { + a, st, err := s.peekMapLocationAndType(t, a) + if err != nil { + return 0, err + } + if a == 0 { + // The pointer was nil, so the map is empty. + return 0, nil + } + length, err := s.peekUintOrIntStructField(st, a, "count") + if err != nil { + return 0, fmt.Errorf("reading map: %s", err) + } + return uint64(length), nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/print.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/print.go new file mode 100644 index 000000000..7a004e5a2 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/print.go @@ -0,0 +1,548 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build linux + +package server + +import ( + "bytes" + "fmt" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/arch" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" +) + +// typeAndAddress associates an address in the target with a DWARF type. +type typeAndAddress struct { + Type dwarf.Type + Address uint64 +} + +// Routines to print a value using DWARF type descriptions. +// TODO: Does this deserve its own package? It has no dependencies on Server. + +// A Printer pretty-prints values in the target address space. +// It can be reused after each printing operation to avoid unnecessary +// allocations. However, it is not safe for concurrent access. +type Printer struct { + err error // Sticky error value. + server *Server + dwarf *dwarf.Data + arch *arch.Architecture + printBuf bytes.Buffer // Accumulates the output. + visited map[typeAndAddress]bool // Prevents looping on cyclic data. +} + +// printf prints to printBuf. +func (p *Printer) printf(format string, args ...interface{}) { + fmt.Fprintf(&p.printBuf, format, args...) +} + +// errorf prints the error to printBuf, then sets the sticky error for the +// printer, if not already set. +func (p *Printer) errorf(format string, args ...interface{}) { + fmt.Fprintf(&p.printBuf, "<"+format+">", args...) + if p.err != nil { + return + } + p.err = fmt.Errorf(format, args...) +} + +// NewPrinter returns a printer that can use the Server to access and print +// values of the specified architecture described by the provided DWARF data. +func NewPrinter(arch *arch.Architecture, dwarf *dwarf.Data, server *Server) *Printer { + return &Printer{ + server: server, + arch: arch, + dwarf: dwarf, + visited: make(map[typeAndAddress]bool), + } +} + +// reset resets the Printer. It must be called before starting a new +// printing operation. +func (p *Printer) reset() { + p.err = nil + p.printBuf.Reset() + // Just wipe the map rather than reallocating. It's almost always tiny. + for k := range p.visited { + delete(p.visited, k) + } +} + +// Sprint returns the pretty-printed value of the item with the given name, such as "main.global". +func (p *Printer) Sprint(name string) (string, error) { + entry, err := p.dwarf.LookupEntry(name) + if err != nil { + return "", err + } + p.reset() + switch entry.Tag { + case dwarf.TagVariable: // TODO: What other entries have global location attributes? + var a uint64 + iface := entry.Val(dwarf.AttrLocation) + if iface != nil { + a = p.decodeLocation(iface.([]byte)) + } + p.printEntryValueAt(entry, a) + default: + p.errorf("unrecognized entry type %s", entry.Tag) + } + return p.printBuf.String(), p.err +} + +// Figure 24 of DWARF v4. +const ( + locationAddr = 0x03 +) + +// decodeLocation decodes the dwarf data describing an address. +func (p *Printer) decodeLocation(data []byte) uint64 { + switch data[0] { + case locationAddr: + return p.arch.Uintptr(data[1:]) + default: + p.errorf("unimplemented location type %#x", data[0]) + } + return 0 +} + +// SprintEntry returns the pretty-printed value of the item with the specified DWARF Entry and address. +func (p *Printer) SprintEntry(entry *dwarf.Entry, a uint64) (string, error) { + p.reset() + p.printEntryValueAt(entry, a) + return p.printBuf.String(), p.err +} + +// printEntryValueAt pretty-prints the data at the specified address. +// using the type information in the Entry. +func (p *Printer) printEntryValueAt(entry *dwarf.Entry, a uint64) { + if a == 0 { + p.printf("") + return + } + switch entry.Tag { + case dwarf.TagVariable, dwarf.TagFormalParameter: + // OK + default: + p.errorf("unrecognized entry type %s", entry.Tag) + return + } + iface := entry.Val(dwarf.AttrType) + if iface == nil { + p.errorf("no type") + return + } + typ, err := p.dwarf.Type(iface.(dwarf.Offset)) + if err != nil { + p.errorf("type lookup: %v", err) + return + } + p.printValueAt(typ, a) +} + +// printValueAt pretty-prints the data at the specified address. +// using the provided type information. +func (p *Printer) printValueAt(typ dwarf.Type, a uint64) { + if a != 0 { + // Check if we are repeating the same type and address. + ta := typeAndAddress{typ, a} + if p.visited[ta] { + p.printf("(%v %#x)", typ, a) + return + } + p.visited[ta] = true + } + switch typ := typ.(type) { + case *dwarf.BoolType: + if typ.ByteSize != 1 { + p.errorf("unrecognized bool size %d", typ.ByteSize) + return + } + if b, err := p.server.peekUint8(a); err != nil { + p.errorf("reading bool: %s", err) + } else { + p.printf("%t", b != 0) + } + case *dwarf.PtrType: + if ptr, err := p.server.peekPtr(a); err != nil { + p.errorf("reading pointer: %s", err) + } else { + p.printf("%#x", ptr) + } + case *dwarf.IntType: + // Sad we can't tell a rune from an int32. + if i, err := p.server.peekInt(a, typ.ByteSize); err != nil { + p.errorf("reading integer: %s", err) + } else { + p.printf("%d", i) + } + case *dwarf.UintType: + if u, err := p.server.peekUint(a, typ.ByteSize); err != nil { + p.errorf("reading unsigned integer: %s", err) + } else { + p.printf("%d", u) + } + case *dwarf.FloatType: + buf := make([]byte, typ.ByteSize) + if err := p.server.peekBytes(a, buf); err != nil { + p.errorf("reading float: %s", err) + return + } + switch typ.ByteSize { + case 4: + p.printf("%g", p.arch.Float32(buf)) + case 8: + p.printf("%g", p.arch.Float64(buf)) + default: + p.errorf("unrecognized float size %d", typ.ByteSize) + } + case *dwarf.ComplexType: + buf := make([]byte, typ.ByteSize) + if err := p.server.peekBytes(a, buf); err != nil { + p.errorf("reading complex: %s", err) + return + } + switch typ.ByteSize { + case 8: + p.printf("%g", p.arch.Complex64(buf)) + case 16: + p.printf("%g", p.arch.Complex128(buf)) + default: + p.errorf("unrecognized complex size %d", typ.ByteSize) + } + case *dwarf.StructType: + if typ.Kind != "struct" { + // Could be "class" or "union". + p.errorf("can't handle struct type %s", typ.Kind) + return + } + p.printf("%s {", typ.String()) + for i, field := range typ.Field { + if i != 0 { + p.printf(", ") + } + p.printValueAt(field.Type, a+uint64(field.ByteOffset)) + } + p.printf("}") + case *dwarf.ArrayType: + p.printArrayAt(typ, a) + case *dwarf.InterfaceType: + p.printInterfaceAt(typ, a) + case *dwarf.MapType: + p.printMapAt(typ, a) + case *dwarf.ChanType: + p.printChannelAt(typ, a) + case *dwarf.SliceType: + p.printSliceAt(typ, a) + case *dwarf.StringType: + p.printStringAt(typ, a) + case *dwarf.TypedefType: + p.printValueAt(typ.Type, a) + case *dwarf.FuncType: + p.printf("%v @%#x ", typ, a) + case *dwarf.VoidType: + p.printf("void") + default: + p.errorf("unimplemented type %v", typ) + } +} + +func (p *Printer) printArrayAt(typ *dwarf.ArrayType, a uint64) { + elemType := typ.Type + length := typ.Count + stride, ok := p.arrayStride(typ) + if !ok { + p.errorf("can't determine element size") + } + p.printf("%s{", typ) + n := length + if n > 100 { + n = 100 // TODO: Have a way to control this? + } + for i := int64(0); i < n; i++ { + if i != 0 { + p.printf(", ") + } + p.printValueAt(elemType, a) + a += stride // TODO: Alignment and padding - not given by Type + } + if n < length { + p.printf(", ...") + } + p.printf("}") +} + +func (p *Printer) printInterfaceAt(t *dwarf.InterfaceType, a uint64) { + // t embeds a TypedefType, which may point to another typedef. + // The underlying type should be a struct. + st, ok := followTypedefs(&t.TypedefType).(*dwarf.StructType) + if !ok { + p.errorf("bad interface type: not a struct") + return + } + p.printf("(") + tab, err := p.server.peekPtrStructField(st, a, "tab") + if err != nil { + p.errorf("reading interface type: %s", err) + } else { + f, err := getField(st, "tab") + if err != nil { + p.errorf("%s", err) + } else { + p.printTypeOfInterface(f.Type, tab) + } + } + p.printf(", ") + data, err := p.server.peekPtrStructField(st, a, "data") + if err != nil { + p.errorf("reading interface value: %s", err) + } else if data == 0 { + p.printf("") + } else { + p.printf("%#x", data) + } + p.printf(")") +} + +// printTypeOfInterface prints the type of the given tab pointer. +func (p *Printer) printTypeOfInterface(t dwarf.Type, a uint64) { + if a == 0 { + p.printf("") + return + } + // t should be a pointer to a struct containing _type, which is a pointer to a + // struct containing _string, which is the name of the type. + // Depending on the compiler version, some of these types can be typedefs, and + // _string may be a string or a *string. + t1, ok := followTypedefs(t).(*dwarf.PtrType) + if !ok { + p.errorf("interface's tab is not a pointer") + return + } + t2, ok := followTypedefs(t1.Type).(*dwarf.StructType) + if !ok { + p.errorf("interface's tab is not a pointer to struct") + return + } + typeField, err := getField(t2, "_type") + if err != nil { + p.errorf("%s", err) + return + } + t3, ok := followTypedefs(typeField.Type).(*dwarf.PtrType) + if !ok { + p.errorf("interface's _type is not a pointer") + return + } + t4, ok := followTypedefs(t3.Type).(*dwarf.StructType) + if !ok { + p.errorf("interface's _type is not a pointer to struct") + return + } + stringField, err := getField(t4, "_string") + if err != nil { + p.errorf("%s", err) + return + } + if t5, ok := stringField.Type.(*dwarf.PtrType); ok { + stringType, ok := t5.Type.(*dwarf.StringType) + if !ok { + p.errorf("interface _string is a pointer to %T, want string or *string", t5.Type) + return + } + typeAddr, err := p.server.peekPtrStructField(t2, a, "_type") + if err != nil { + p.errorf("reading interface type: %s", err) + return + } + stringAddr, err := p.server.peekPtrStructField(t4, typeAddr, "_string") + if err != nil { + p.errorf("reading interface type: %s", err) + return + } + p.printStringAt(stringType, stringAddr) + } else { + stringType, ok := stringField.Type.(*dwarf.StringType) + if !ok { + p.errorf("interface _string is a %T, want string or *string", stringField.Type) + return + } + typeAddr, err := p.server.peekPtrStructField(t2, a, "_type") + if err != nil { + p.errorf("reading interface type: %s", err) + return + } + stringAddr := typeAddr + uint64(stringField.ByteOffset) + p.printStringAt(stringType, stringAddr) + } +} + +// maxMapValuesToPrint values are printed for each map; any remaining values are +// truncated to "...". +const maxMapValuesToPrint = 8 + +func (p *Printer) printMapAt(typ *dwarf.MapType, a uint64) { + count := 0 + fn := func(keyAddr, valAddr uint64, keyType, valType dwarf.Type) (stop bool) { + count++ + if count > maxMapValuesToPrint { + return false + } + if count > 1 { + p.printf(" ") + } + p.printValueAt(keyType, keyAddr) + p.printf(":") + p.printValueAt(valType, valAddr) + return true + } + p.printf("map[") + if err := p.server.peekMapValues(typ, a, fn); err != nil { + p.errorf("reading map values: %s", err) + } + if count > maxMapValuesToPrint { + p.printf(" ...") + } + p.printf("]") +} + +func (p *Printer) printChannelAt(ct *dwarf.ChanType, a uint64) { + p.printf("(chan %s ", ct.ElemType) + defer p.printf(")") + + a, err := p.server.peekPtr(a) + if err != nil { + p.errorf("reading channel: %s", err) + return + } + if a == 0 { + p.printf("") + return + } + p.printf("%#x", a) + + // ct is a typedef for a pointer to a struct. + pt, ok := ct.TypedefType.Type.(*dwarf.PtrType) + if !ok { + p.errorf("bad channel type: not a pointer") + return + } + st, ok := pt.Type.(*dwarf.StructType) + if !ok { + p.errorf("bad channel type: not a pointer to a struct") + return + } + + // Print the channel buffer's length (qcount) and capacity (dataqsiz), + // if not 0/0. + qcount, err := p.server.peekUintOrIntStructField(st, a, "qcount") + if err != nil { + p.errorf("reading channel: %s", err) + return + } + dataqsiz, err := p.server.peekUintOrIntStructField(st, a, "dataqsiz") + if err != nil { + p.errorf("reading channel: %s", err) + return + } + if qcount != 0 || dataqsiz != 0 { + p.printf(" [%d/%d]", qcount, dataqsiz) + } +} + +func (p *Printer) printSliceAt(typ *dwarf.SliceType, a uint64) { + // Slices look like a struct with fields array *elemtype, len uint32/64, cap uint32/64. + // BUG: Slice header appears to have fields with ByteSize == 0 + ptr, err := p.server.peekPtrStructField(&typ.StructType, a, "array") + if err != nil { + p.errorf("reading slice: %s", err) + return + } + length, err := p.server.peekUintOrIntStructField(&typ.StructType, a, "len") + if err != nil { + p.errorf("reading slice: %s", err) + return + } + // Capacity is not used yet. + _, err = p.server.peekUintOrIntStructField(&typ.StructType, a, "cap") + if err != nil { + p.errorf("reading slice: %s", err) + return + } + elemType := typ.ElemType + size, ok := p.sizeof(typ.ElemType) + if !ok { + p.errorf("can't determine element size") + } + p.printf("%s{", typ) + for i := uint64(0); i < length; i++ { + if i != 0 { + p.printf(", ") + } + p.printValueAt(elemType, ptr) + ptr += size // TODO: Alignment and padding - not given by Type + } + p.printf("}") +} + +func (p *Printer) printStringAt(typ *dwarf.StringType, a uint64) { + const maxStringSize = 100 + if s, err := p.server.peekString(typ, a, maxStringSize); err != nil { + p.errorf("reading string: %s", err) + } else { + p.printf("%q", s) + } +} + +// sizeof returns the byte size of the type. +func (p *Printer) sizeof(typ dwarf.Type) (uint64, bool) { + size := typ.Size() // Will be -1 if ByteSize is not set. + if size >= 0 { + return uint64(size), true + } + switch typ.(type) { + case *dwarf.PtrType: + // This is the only one we know of, but more may arise. + return uint64(p.arch.PointerSize), true + } + return 0, false +} + +// arrayStride returns the stride of a dwarf.ArrayType in bytes. +func (p *Printer) arrayStride(t *dwarf.ArrayType) (uint64, bool) { + stride := t.StrideBitSize + if stride > 0 { + return uint64(stride / 8), true + } + return p.sizeof(t.Type) +} + +// getField finds the *dwarf.StructField in a dwarf.StructType with name fieldName. +func getField(t *dwarf.StructType, fieldName string) (*dwarf.StructField, error) { + var r *dwarf.StructField + for _, f := range t.Field { + if f.Name == fieldName { + if r != nil { + return nil, fmt.Errorf("struct definition repeats field %s", fieldName) + } + r = f + } + } + if r == nil { + return nil, fmt.Errorf("struct field %s missing", fieldName) + } + return r, nil +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/protocol/protocol.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/protocol/protocol.go new file mode 100644 index 000000000..31c852c0d --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/protocol/protocol.go @@ -0,0 +1,174 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package protocol defines the types used to represent calls to the debug server. +package protocol + +import ( + "encoding/gob" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" +) + +func init() { + // Register implementations of debug.Value with gob. + gob.Register(debug.Pointer{}) + gob.Register(debug.Array{}) + gob.Register(debug.Struct{}) + gob.Register(debug.Slice{}) + gob.Register(debug.Map{}) + gob.Register(debug.String{}) + gob.Register(debug.Channel{}) + gob.Register(debug.Func{}) + gob.Register(debug.Interface{}) +} + +// For regularity, each method has a unique Request and a Response type even +// when not strictly necessary. + +// File I/O, at the top because they're simple. + +type ReadAtRequest struct { + FD int + Len int + Offset int64 +} + +type ReadAtResponse struct { + Data []byte +} + +type WriteAtRequest struct { + FD int + Data []byte + Offset int64 +} + +type WriteAtResponse struct { + Len int +} + +type CloseRequest struct { + FD int +} + +type CloseResponse struct { +} + +// Program methods. + +type OpenRequest struct { + Name string + Mode string +} + +type OpenResponse struct { + FD int +} + +type RunRequest struct { + Args []string +} + +type RunResponse struct { + Status debug.Status +} + +type ResumeRequest struct { +} + +type ResumeResponse struct { + Status debug.Status +} + +type BreakpointRequest struct { + Address uint64 +} + +type BreakpointAtFunctionRequest struct { + Function string +} + +type BreakpointAtLineRequest struct { + File string + Line uint64 +} + +type BreakpointResponse struct { + PCs []uint64 +} + +type DeleteBreakpointsRequest struct { + PCs []uint64 +} + +type DeleteBreakpointsResponse struct { +} + +type EvalRequest struct { + Expr string +} + +type EvalResponse struct { + Result []string +} + +type EvaluateRequest struct { + Expression string +} + +type EvaluateResponse struct { + Result debug.Value +} + +type FramesRequest struct { + Count int +} + +type FramesResponse struct { + Frames []debug.Frame +} + +type VarByNameRequest struct { + Name string +} + +type VarByNameResponse struct { + Var debug.Var +} + +type ValueRequest struct { + Var debug.Var +} + +type ValueResponse struct { + Value debug.Value +} + +type MapElementRequest struct { + Map debug.Map + Index uint64 +} + +type MapElementResponse struct { + Key debug.Var + Value debug.Var +} + +type GoroutinesRequest struct { +} + +type GoroutinesResponse struct { + Goroutines []*debug.Goroutine +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/ptrace.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/ptrace.go new file mode 100644 index 000000000..dba82454b --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/ptrace.go @@ -0,0 +1,157 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build linux + +package server + +import ( + "fmt" + "os" + "runtime" + "syscall" + "time" +) + +// ptraceRun runs all the closures from fc on a dedicated OS thread. Errors +// are returned on ec. Both channels must be unbuffered, to ensure that the +// resultant error is sent back to the same goroutine that sent the closure. +func ptraceRun(fc chan func() error, ec chan error) { + if cap(fc) != 0 || cap(ec) != 0 { + panic("ptraceRun was given buffered channels") + } + runtime.LockOSThread() + for f := range fc { + ec <- f() + } +} + +func (s *Server) startProcess(name string, argv []string, attr *os.ProcAttr) (proc *os.Process, err error) { + s.fc <- func() error { + var err1 error + proc, err1 = os.StartProcess(name, argv, attr) + return err1 + } + err = <-s.ec + return +} + +func (s *Server) ptraceCont(pid int, signal int) (err error) { + s.fc <- func() error { + return syscall.PtraceCont(pid, signal) + } + return <-s.ec +} + +func (s *Server) ptraceGetRegs(pid int, regsout *syscall.PtraceRegs) (err error) { + s.fc <- func() error { + return syscall.PtraceGetRegs(pid, regsout) + } + return <-s.ec +} + +func (s *Server) ptracePeek(pid int, addr uintptr, out []byte) (err error) { + s.fc <- func() error { + n, err := syscall.PtracePeekText(pid, addr, out) + if err != nil { + return err + } + if n != len(out) { + return fmt.Errorf("ptracePeek: peeked %d bytes, want %d", n, len(out)) + } + return nil + } + return <-s.ec +} + +func (s *Server) ptracePoke(pid int, addr uintptr, data []byte) (err error) { + s.fc <- func() error { + n, err := syscall.PtracePokeText(pid, addr, data) + if err != nil { + return err + } + if n != len(data) { + return fmt.Errorf("ptracePoke: poked %d bytes, want %d", n, len(data)) + } + return nil + } + return <-s.ec +} + +func (s *Server) ptraceSetOptions(pid int, options int) (err error) { + s.fc <- func() error { + return syscall.PtraceSetOptions(pid, options) + } + return <-s.ec +} + +func (s *Server) ptraceSetRegs(pid int, regs *syscall.PtraceRegs) (err error) { + s.fc <- func() error { + return syscall.PtraceSetRegs(pid, regs) + } + return <-s.ec +} + +func (s *Server) ptraceSingleStep(pid int) (err error) { + s.fc <- func() error { + return syscall.PtraceSingleStep(pid) + } + return <-s.ec +} + +type breakpointsChangedError struct { + call call +} + +func (*breakpointsChangedError) Error() string { + return "breakpoints changed" +} + +func (s *Server) wait(pid int, allowBreakpointsChange bool) (wpid int, status syscall.WaitStatus, err error) { + // We poll syscall.Wait4 with WNOHANG, sleeping in between, as a poor man's + // waitpid-with-timeout. This allows adding and removing breakpoints + // concurrently with waiting to hit an existing breakpoint. + f := func() error { + var err1 error + wpid, err1 = syscall.Wait4(pid, &status, syscall.WALL|syscall.WNOHANG, nil) + return err1 + } + + const ( + minSleep = 1 * time.Microsecond + maxSleep = 100 * time.Millisecond + ) + for sleep := minSleep; ; { + s.fc <- f + err = <-s.ec + + // wpid == 0 means that wait found nothing (and returned due to WNOHANG). + if wpid != 0 { + return + } + + if allowBreakpointsChange { + select { + case c := <-s.breakpointc: + return 0, 0, &breakpointsChangedError{c} + default: + } + } + + time.Sleep(sleep) + if sleep < maxSleep { + sleep *= 10 + } + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/server.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/server.go new file mode 100644 index 000000000..6bed24f12 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/server.go @@ -0,0 +1,1136 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build linux + +// Package server provides RPC access to a local program being debugged. +// It is the remote end of the client implementation of the Program interface. +package server + +//go:generate sh -c "m4 -P eval.m4 > eval.go" + +import ( + "bytes" + "errors" + "fmt" + "os" + "regexp" + "strconv" + "strings" + "sync" + "syscall" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/arch" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/protocol" +) + +type breakpoint struct { + pc uint64 + origInstr [arch.MaxBreakpointSize]byte +} + +type call struct { + req, resp interface{} + errc chan error +} + +type Server struct { + arch arch.Architecture + executable string // Name of executable. + dwarfData *dwarf.Data + + breakpointc chan call + otherc chan call + + fc chan func() error + ec chan error + + proc *os.Process + procIsUp bool + stoppedPid int + stoppedRegs syscall.PtraceRegs + topOfStackAddrs []uint64 + breakpoints map[uint64]breakpoint + files []*file // Index == file descriptor. + printer *Printer + + // goroutineStack reads the stack of a (non-running) goroutine. + goroutineStack func(uint64) ([]debug.Frame, error) + goroutineStackOnce sync.Once +} + +// peek implements the Peeker interface required by the printer. +func (s *Server) peek(offset uintptr, buf []byte) error { + return s.ptracePeek(s.stoppedPid, offset, buf) +} + +// New parses the executable and builds local data structures for answering requests. +// It returns a Server ready to serve requests about the executable. +func New(executable string) (*Server, error) { + fd, err := os.Open(executable) + if err != nil { + return nil, err + } + defer fd.Close() + architecture, dwarfData, err := loadExecutable(fd) + if err != nil { + return nil, err + } + srv := &Server{ + arch: *architecture, + executable: executable, + dwarfData: dwarfData, + breakpointc: make(chan call), + otherc: make(chan call), + fc: make(chan func() error), + ec: make(chan error), + breakpoints: make(map[uint64]breakpoint), + } + srv.printer = NewPrinter(architecture, dwarfData, srv) + go ptraceRun(srv.fc, srv.ec) + go srv.loop() + return srv, nil +} + +func loadExecutable(f *os.File) (*arch.Architecture, *dwarf.Data, error) { + // TODO: How do we detect NaCl? + if obj, err := elf.NewFile(f); err == nil { + dwarfData, err := obj.DWARF() + if err != nil { + return nil, nil, err + } + + switch obj.Machine { + case elf.EM_ARM: + return &arch.ARM, dwarfData, nil + case elf.EM_386: + switch obj.Class { + case elf.ELFCLASS32: + return &arch.X86, dwarfData, nil + case elf.ELFCLASS64: + return &arch.AMD64, dwarfData, nil + } + case elf.EM_X86_64: + return &arch.AMD64, dwarfData, nil + } + return nil, nil, fmt.Errorf("unrecognized ELF architecture") + } + return nil, nil, fmt.Errorf("unrecognized binary format") +} + +func (s *Server) loop() { + for { + var c call + select { + case c = <-s.breakpointc: + case c = <-s.otherc: + } + s.dispatch(c) + } +} + +func (s *Server) dispatch(c call) { + switch req := c.req.(type) { + case *protocol.BreakpointRequest: + c.errc <- s.handleBreakpoint(req, c.resp.(*protocol.BreakpointResponse)) + case *protocol.BreakpointAtFunctionRequest: + c.errc <- s.handleBreakpointAtFunction(req, c.resp.(*protocol.BreakpointResponse)) + case *protocol.BreakpointAtLineRequest: + c.errc <- s.handleBreakpointAtLine(req, c.resp.(*protocol.BreakpointResponse)) + case *protocol.DeleteBreakpointsRequest: + c.errc <- s.handleDeleteBreakpoints(req, c.resp.(*protocol.DeleteBreakpointsResponse)) + case *protocol.CloseRequest: + c.errc <- s.handleClose(req, c.resp.(*protocol.CloseResponse)) + case *protocol.EvalRequest: + c.errc <- s.handleEval(req, c.resp.(*protocol.EvalResponse)) + case *protocol.EvaluateRequest: + c.errc <- s.handleEvaluate(req, c.resp.(*protocol.EvaluateResponse)) + case *protocol.FramesRequest: + c.errc <- s.handleFrames(req, c.resp.(*protocol.FramesResponse)) + case *protocol.OpenRequest: + c.errc <- s.handleOpen(req, c.resp.(*protocol.OpenResponse)) + case *protocol.ReadAtRequest: + c.errc <- s.handleReadAt(req, c.resp.(*protocol.ReadAtResponse)) + case *protocol.ResumeRequest: + c.errc <- s.handleResume(req, c.resp.(*protocol.ResumeResponse)) + case *protocol.RunRequest: + c.errc <- s.handleRun(req, c.resp.(*protocol.RunResponse)) + case *protocol.VarByNameRequest: + c.errc <- s.handleVarByName(req, c.resp.(*protocol.VarByNameResponse)) + case *protocol.ValueRequest: + c.errc <- s.handleValue(req, c.resp.(*protocol.ValueResponse)) + case *protocol.MapElementRequest: + c.errc <- s.handleMapElement(req, c.resp.(*protocol.MapElementResponse)) + case *protocol.GoroutinesRequest: + c.errc <- s.handleGoroutines(req, c.resp.(*protocol.GoroutinesResponse)) + default: + panic(fmt.Sprintf("unexpected call request type %T", c.req)) + } +} + +func (s *Server) call(c chan call, req, resp interface{}) error { + errc := make(chan error) + c <- call{req, resp, errc} + return <-errc +} + +type file struct { + mode string + index int + f debug.File +} + +func (s *Server) Open(req *protocol.OpenRequest, resp *protocol.OpenResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleOpen(req *protocol.OpenRequest, resp *protocol.OpenResponse) error { + // TODO: Better simulation. For now we just open the named OS file. + var flag int + switch req.Mode { + case "r": + flag = os.O_RDONLY + case "w": + flag = os.O_WRONLY + case "rw": + flag = os.O_RDWR + default: + return fmt.Errorf("Open: bad open mode %q", req.Mode) + } + osFile, err := os.OpenFile(req.Name, flag, 0) + if err != nil { + return err + } + // Find a file descriptor (index) slot. + index := 0 + for ; index < len(s.files) && s.files[index] != nil; index++ { + } + f := &file{ + mode: req.Mode, + index: index, + f: osFile, + } + if index == len(s.files) { + s.files = append(s.files, f) + } else { + s.files[index] = f + } + return nil +} + +func (s *Server) ReadAt(req *protocol.ReadAtRequest, resp *protocol.ReadAtResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleReadAt(req *protocol.ReadAtRequest, resp *protocol.ReadAtResponse) error { + fd := req.FD + if fd < 0 || len(s.files) <= fd || s.files[fd] == nil { + return fmt.Errorf("ReadAt: bad file descriptor %d", fd) + } + f := s.files[fd] + buf := make([]byte, req.Len) // TODO: Don't allocate every time + n, err := f.f.ReadAt(buf, req.Offset) + resp.Data = buf[:n] + return err +} + +func (s *Server) Close(req *protocol.CloseRequest, resp *protocol.CloseResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleClose(req *protocol.CloseRequest, resp *protocol.CloseResponse) error { + fd := req.FD + if fd < 0 || fd >= len(s.files) || s.files[fd] == nil { + return fmt.Errorf("Close: bad file descriptor %d", fd) + } + err := s.files[fd].f.Close() + // Remove it regardless + s.files[fd] = nil + return err +} + +func (s *Server) Run(req *protocol.RunRequest, resp *protocol.RunResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleRun(req *protocol.RunRequest, resp *protocol.RunResponse) error { + if s.proc != nil { + s.proc.Kill() + s.proc = nil + s.procIsUp = false + s.stoppedPid = 0 + s.stoppedRegs = syscall.PtraceRegs{} + s.topOfStackAddrs = nil + } + argv := append([]string{s.executable}, req.Args...) + p, err := s.startProcess(s.executable, argv, &os.ProcAttr{ + Files: []*os.File{ + nil, // TODO: be able to feed the target's stdin. + os.Stderr, // TODO: be able to capture the target's stdout. + os.Stderr, + }, + Sys: &syscall.SysProcAttr{ + Pdeathsig: syscall.SIGKILL, + Ptrace: true, + }, + }) + if err != nil { + return err + } + s.proc = p + s.stoppedPid = p.Pid + return nil +} + +func (s *Server) Resume(req *protocol.ResumeRequest, resp *protocol.ResumeResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleResume(req *protocol.ResumeRequest, resp *protocol.ResumeResponse) error { + if s.proc == nil { + return fmt.Errorf("Resume: Run did not successfully start a process") + } + + if !s.procIsUp { + s.procIsUp = true + if _, err := s.waitForTrap(s.stoppedPid, false); err != nil { + return err + } + if err := s.ptraceSetOptions(s.stoppedPid, syscall.PTRACE_O_TRACECLONE); err != nil { + return fmt.Errorf("ptraceSetOptions: %v", err) + } + } else if _, ok := s.breakpoints[s.stoppedRegs.Rip]; ok { + if err := s.ptraceSingleStep(s.stoppedPid); err != nil { + return fmt.Errorf("ptraceSingleStep: %v", err) + } + if _, err := s.waitForTrap(s.stoppedPid, false); err != nil { + return err + } + } + + for { + if err := s.setBreakpoints(); err != nil { + return err + } + if err := s.ptraceCont(s.stoppedPid, 0); err != nil { + return fmt.Errorf("ptraceCont: %v", err) + } + + wpid, err := s.waitForTrap(-1, true) + if err == nil { + s.stoppedPid = wpid + break + } + bce, ok := err.(*breakpointsChangedError) + if !ok { + return err + } + + if err := syscall.Kill(s.stoppedPid, syscall.SIGSTOP); err != nil { + return fmt.Errorf("kill(SIGSTOP): %v", err) + } + _, status, err := s.wait(s.stoppedPid, false) + if err != nil { + return fmt.Errorf("wait (after SIGSTOP): %v", err) + } + if !status.Stopped() || status.StopSignal() != syscall.SIGSTOP { + return fmt.Errorf("wait (after SIGSTOP): unexpected wait status 0x%x", status) + } + + if err := s.liftBreakpoints(); err != nil { + return err + } + + loop: + for c := bce.call; ; { + s.dispatch(c) + select { + case c = <-s.breakpointc: + default: + break loop + } + } + } + if err := s.liftBreakpoints(); err != nil { + return err + } + + if err := s.ptraceGetRegs(s.stoppedPid, &s.stoppedRegs); err != nil { + return fmt.Errorf("ptraceGetRegs: %v", err) + } + + s.stoppedRegs.Rip -= uint64(s.arch.BreakpointSize) + + if err := s.ptraceSetRegs(s.stoppedPid, &s.stoppedRegs); err != nil { + return fmt.Errorf("ptraceSetRegs: %v", err) + } + + resp.Status.PC = s.stoppedRegs.Rip + resp.Status.SP = s.stoppedRegs.Rsp + return nil +} + +func (s *Server) waitForTrap(pid int, allowBreakpointsChange bool) (wpid int, err error) { + for { + wpid, status, err := s.wait(pid, allowBreakpointsChange) + if err != nil { + if _, ok := err.(*breakpointsChangedError); !ok { + err = fmt.Errorf("wait: %v", err) + } + return 0, err + } + if status.StopSignal() == syscall.SIGTRAP && status.TrapCause() != syscall.PTRACE_EVENT_CLONE { + return wpid, nil + } + if status.StopSignal() == syscall.SIGPROF { + err = s.ptraceCont(wpid, int(syscall.SIGPROF)) + } else { + err = s.ptraceCont(wpid, 0) // TODO: non-zero when wait catches other signals? + } + if err != nil { + return 0, fmt.Errorf("ptraceCont: %v", err) + } + } +} + +func (s *Server) Breakpoint(req *protocol.BreakpointRequest, resp *protocol.BreakpointResponse) error { + return s.call(s.breakpointc, req, resp) +} + +func (s *Server) handleBreakpoint(req *protocol.BreakpointRequest, resp *protocol.BreakpointResponse) error { + return s.addBreakpoints([]uint64{req.Address}, resp) +} + +func (s *Server) BreakpointAtFunction(req *protocol.BreakpointAtFunctionRequest, resp *protocol.BreakpointResponse) error { + return s.call(s.breakpointc, req, resp) +} + +func (s *Server) handleBreakpointAtFunction(req *protocol.BreakpointAtFunctionRequest, resp *protocol.BreakpointResponse) error { + pc, err := s.functionStartAddress(req.Function) + if err != nil { + return err + } + return s.addBreakpoints([]uint64{pc}, resp) +} + +func (s *Server) BreakpointAtLine(req *protocol.BreakpointAtLineRequest, resp *protocol.BreakpointResponse) error { + return s.call(s.breakpointc, req, resp) +} + +func (s *Server) handleBreakpointAtLine(req *protocol.BreakpointAtLineRequest, resp *protocol.BreakpointResponse) error { + if s.dwarfData == nil { + return fmt.Errorf("no DWARF data") + } + if pcs, err := s.dwarfData.LineToBreakpointPCs(req.File, req.Line); err != nil { + return err + } else { + return s.addBreakpoints(pcs, resp) + } +} + +// addBreakpoints adds breakpoints at the addresses in pcs, then stores pcs in the response. +func (s *Server) addBreakpoints(pcs []uint64, resp *protocol.BreakpointResponse) error { + // Get the original code at each address with ptracePeek. + bps := make([]breakpoint, 0, len(pcs)) + for _, pc := range pcs { + if _, alreadySet := s.breakpoints[pc]; alreadySet { + continue + } + var bp breakpoint + if err := s.ptracePeek(s.stoppedPid, uintptr(pc), bp.origInstr[:s.arch.BreakpointSize]); err != nil { + return fmt.Errorf("ptracePeek: %v", err) + } + bp.pc = pc + bps = append(bps, bp) + } + // If all the peeks succeeded, update the list of breakpoints. + for _, bp := range bps { + s.breakpoints[bp.pc] = bp + } + resp.PCs = pcs + return nil +} + +func (s *Server) DeleteBreakpoints(req *protocol.DeleteBreakpointsRequest, resp *protocol.DeleteBreakpointsResponse) error { + return s.call(s.breakpointc, req, resp) +} + +func (s *Server) handleDeleteBreakpoints(req *protocol.DeleteBreakpointsRequest, resp *protocol.DeleteBreakpointsResponse) error { + for _, pc := range req.PCs { + delete(s.breakpoints, pc) + } + return nil +} + +func (s *Server) setBreakpoints() error { + for pc := range s.breakpoints { + err := s.ptracePoke(s.stoppedPid, uintptr(pc), s.arch.BreakpointInstr[:s.arch.BreakpointSize]) + if err != nil { + return fmt.Errorf("setBreakpoints: %v", err) + } + } + return nil +} + +func (s *Server) liftBreakpoints() error { + for pc, breakpoint := range s.breakpoints { + err := s.ptracePoke(s.stoppedPid, uintptr(pc), breakpoint.origInstr[:s.arch.BreakpointSize]) + if err != nil { + return fmt.Errorf("liftBreakpoints: %v", err) + } + } + return nil +} + +func (s *Server) Eval(req *protocol.EvalRequest, resp *protocol.EvalResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleEval(req *protocol.EvalRequest, resp *protocol.EvalResponse) (err error) { + resp.Result, err = s.eval(req.Expr) + return err +} + +// eval evaluates an expression. +// TODO: very weak. +func (s *Server) eval(expr string) ([]string, error) { + switch { + case strings.HasPrefix(expr, "re:"): + // Regular expression. Return list of symbols. + re, err := regexp.Compile(expr[3:]) + if err != nil { + return nil, err + } + return s.dwarfData.LookupMatchingSymbols(re) + + case strings.HasPrefix(expr, "addr:"): + // Symbol lookup. Return address. + addr, err := s.functionStartAddress(expr[5:]) + if err != nil { + return nil, err + } + return []string{fmt.Sprintf("%#x", addr)}, nil + + case strings.HasPrefix(expr, "val:"): + // Symbol lookup. Return formatted value. + value, err := s.printer.Sprint(expr[4:]) + if err != nil { + return nil, err + } + return []string{value}, nil + + case strings.HasPrefix(expr, "src:"): + // Numerical address. Return file.go:123. + addr, err := strconv.ParseUint(expr[4:], 0, 0) + if err != nil { + return nil, err + } + file, line, err := s.lookupSource(addr) + if err != nil { + return nil, err + } + return []string{fmt.Sprintf("%s:%d", file, line)}, nil + + case len(expr) > 0 && '0' <= expr[0] && expr[0] <= '9': + // Numerical address. Return symbol. + addr, err := strconv.ParseUint(expr, 0, 0) + if err != nil { + return nil, err + } + entry, _, err := s.dwarfData.PCToFunction(addr) + if err != nil { + return nil, err + } + name, ok := entry.Val(dwarf.AttrName).(string) + if !ok { + return nil, fmt.Errorf("function at 0x%x has no name", addr) + } + return []string{name}, nil + } + + return nil, fmt.Errorf("bad expression syntax: %q", expr) +} + +func (s *Server) Evaluate(req *protocol.EvaluateRequest, resp *protocol.EvaluateResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleEvaluate(req *protocol.EvaluateRequest, resp *protocol.EvaluateResponse) (err error) { + resp.Result, err = s.evalExpression(req.Expression, s.stoppedRegs.Rip, s.stoppedRegs.Rsp) + return err +} + +func (s *Server) lookupSource(pc uint64) (file string, line uint64, err error) { + if s.dwarfData == nil { + return + } + // TODO: The gosym equivalent also returns the relevant Func. Do that when + // DWARF has the same facility. + return s.dwarfData.PCToLine(pc) +} + +func (s *Server) Frames(req *protocol.FramesRequest, resp *protocol.FramesResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleFrames(req *protocol.FramesRequest, resp *protocol.FramesResponse) error { + // TODO: verify that we're stopped. + if s.topOfStackAddrs == nil { + if err := s.evaluateTopOfStackAddrs(); err != nil { + return err + } + } + + regs := syscall.PtraceRegs{} + err := s.ptraceGetRegs(s.stoppedPid, ®s) + if err != nil { + return err + } + resp.Frames, err = s.walkStack(regs.Rip, regs.Rsp, req.Count) + return err +} + +// walkStack returns up to the requested number of stack frames. +func (s *Server) walkStack(pc, sp uint64, count int) ([]debug.Frame, error) { + var frames []debug.Frame + + var buf [8]byte + b := new(bytes.Buffer) + r := s.dwarfData.Reader() + + // TODO: handle walking over a split stack. + for i := 0; i < count; i++ { + b.Reset() + file, line, err := s.dwarfData.PCToLine(pc) + if err != nil { + return frames, err + } + fpOffset, err := s.dwarfData.PCToSPOffset(pc) + if err != nil { + return frames, err + } + fp := sp + uint64(fpOffset) + entry, funcEntry, err := s.dwarfData.PCToFunction(pc) + if err != nil { + return frames, err + } + frame := debug.Frame{ + PC: pc, + SP: sp, + File: file, + Line: line, + FunctionStart: funcEntry, + } + frame.Function, _ = entry.Val(dwarf.AttrName).(string) + r.Seek(entry.Offset) + for { + entry, err := r.Next() + if err != nil { + return frames, err + } + if entry.Tag == 0 { + break + } + // TODO: report variables we couldn't parse? + if entry.Tag == dwarf.TagFormalParameter { + if v, err := s.parseParameterOrLocal(entry, fp); err == nil { + frame.Params = append(frame.Params, debug.Param(v)) + } + } + if entry.Tag == dwarf.TagVariable { + if v, err := s.parseParameterOrLocal(entry, fp); err == nil { + frame.Vars = append(frame.Vars, v) + } + } + } + frames = append(frames, frame) + + // Walk to the caller's PC and SP. + if s.topOfStack(funcEntry) { + break + } + err = s.ptracePeek(s.stoppedPid, uintptr(fp-uint64(s.arch.PointerSize)), buf[:s.arch.PointerSize]) + if err != nil { + return frames, fmt.Errorf("ptracePeek: %v", err) + } + pc, sp = s.arch.Uintptr(buf[:s.arch.PointerSize]), fp + } + return frames, nil +} + +// parseParameterOrLocal parses the entry for a function parameter or local +// variable, which are both specified the same way. fp contains the frame +// pointer, which is used to calculate the variable location. +func (s *Server) parseParameterOrLocal(entry *dwarf.Entry, fp uint64) (debug.LocalVar, error) { + var v debug.LocalVar + v.Name, _ = entry.Val(dwarf.AttrName).(string) + if off, err := s.dwarfData.EntryTypeOffset(entry); err != nil { + return v, err + } else { + v.Var.TypeID = uint64(off) + } + if i := entry.Val(dwarf.AttrLocation); i == nil { + return v, fmt.Errorf("missing location description") + } else if locationDescription, ok := i.([]uint8); !ok { + return v, fmt.Errorf("unsupported location description") + } else if offset, err := evalLocation(locationDescription); err != nil { + return v, err + } else { + v.Var.Address = fp + uint64(offset) + } + return v, nil +} + +func (s *Server) evaluateTopOfStackAddrs() error { + var ( + lookup func(name string) (uint64, error) + indirect bool + names []string + ) + if _, err := s.dwarfData.LookupVariable("runtime.rt0_goPC"); err != nil { + // Look for a Go 1.3 binary (or earlier version). + lookup, indirect, names = s.functionStartAddress, false, []string{ + "runtime.goexit", + "runtime.mstart", + "runtime.mcall", + "runtime.morestack", + "runtime.lessstack", + "_rt0_go", + } + } else { + // Look for a Go 1.4 binary (or later version). + lookup = func(name string) (uint64, error) { + entry, err := s.dwarfData.LookupVariable(name) + if err != nil { + return 0, err + } + return s.dwarfData.EntryLocation(entry) + } + indirect, names = true, []string{ + "runtime.goexitPC", + "runtime.mstartPC", + "runtime.mcallPC", + "runtime.morestackPC", + "runtime.rt0_goPC", + } + } + // TODO: also look for runtime.externalthreadhandlerp, on Windows. + + addrs := make([]uint64, 0, len(names)) + for _, name := range names { + addr, err := lookup(name) + if err != nil { + return err + } + addrs = append(addrs, addr) + } + + if indirect { + buf := make([]byte, s.arch.PointerSize) + for i, addr := range addrs { + if err := s.ptracePeek(s.stoppedPid, uintptr(addr), buf); err != nil { + return fmt.Errorf("ptracePeek: %v", err) + } + addrs[i] = s.arch.Uintptr(buf) + } + } + + s.topOfStackAddrs = addrs + return nil +} + +// topOfStack is the out-of-process equivalent of runtime·topofstack. +func (s *Server) topOfStack(funcEntry uint64) bool { + for _, addr := range s.topOfStackAddrs { + if addr == funcEntry { + return true + } + } + return false +} + +func (s *Server) VarByName(req *protocol.VarByNameRequest, resp *protocol.VarByNameResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleVarByName(req *protocol.VarByNameRequest, resp *protocol.VarByNameResponse) error { + entry, err := s.dwarfData.LookupVariable(req.Name) + if err != nil { + return fmt.Errorf("variable %s: %s", req.Name, err) + } + + loc, err := s.dwarfData.EntryLocation(entry) + if err != nil { + return fmt.Errorf("variable %s: %s", req.Name, err) + } + + off, err := s.dwarfData.EntryTypeOffset(entry) + if err != nil { + return fmt.Errorf("variable %s: %s", req.Name, err) + } + + resp.Var.TypeID = uint64(off) + resp.Var.Address = loc + return nil +} + +func (s *Server) Value(req *protocol.ValueRequest, resp *protocol.ValueResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleValue(req *protocol.ValueRequest, resp *protocol.ValueResponse) error { + t, err := s.dwarfData.Type(dwarf.Offset(req.Var.TypeID)) + if err != nil { + return err + } + resp.Value, err = s.value(t, req.Var.Address) + return err +} + +func (s *Server) MapElement(req *protocol.MapElementRequest, resp *protocol.MapElementResponse) error { + return s.call(s.otherc, req, resp) +} + +func (s *Server) handleMapElement(req *protocol.MapElementRequest, resp *protocol.MapElementResponse) error { + t, err := s.dwarfData.Type(dwarf.Offset(req.Map.TypeID)) + if err != nil { + return err + } + m, ok := t.(*dwarf.MapType) + if !ok { + return fmt.Errorf("variable is not a map") + } + var count uint64 + // fn will be called for each element of the map. + // When we reach the requested element, we fill in *resp and stop. + // TODO: cache locations of elements. + fn := func(keyAddr, valAddr uint64, keyType, valType dwarf.Type) bool { + count++ + if count == req.Index+1 { + resp.Key = debug.Var{TypeID: uint64(keyType.Common().Offset), Address: keyAddr} + resp.Value = debug.Var{TypeID: uint64(valType.Common().Offset), Address: valAddr} + return false + } + return true + } + if err := s.peekMapValues(m, req.Map.Address, fn); err != nil { + return err + } + if count <= req.Index { + // There weren't enough elements. + return fmt.Errorf("map has no element %d", req.Index) + } + return nil +} + +func (s *Server) Goroutines(req *protocol.GoroutinesRequest, resp *protocol.GoroutinesResponse) error { + return s.call(s.otherc, req, resp) +} + +const invalidStatus debug.GoroutineStatus = 99 + +var ( + gStatus = [...]debug.GoroutineStatus{ + 0: debug.Queued, // _Gidle + 1: debug.Queued, // _Grunnable + 2: debug.Running, // _Grunning + 3: debug.Blocked, // _Gsyscall + 4: debug.Blocked, // _Gwaiting + 5: invalidStatus, // _Gmoribund_unused + 6: invalidStatus, // _Gdead + 7: invalidStatus, // _Genqueue + 8: debug.Running, // _Gcopystack + } + gScanStatus = [...]debug.GoroutineStatus{ + 0: invalidStatus, // _Gscan + _Gidle + 1: debug.Queued, // _Gscanrunnable + 2: debug.Running, // _Gscanrunning + 3: debug.Blocked, // _Gscansyscall + 4: debug.Blocked, // _Gscanwaiting + 5: invalidStatus, // _Gscan + _Gmoribund_unused + 6: invalidStatus, // _Gscan + _Gdead + 7: debug.Queued, // _Gscanenqueue + } + gStatusString = [...]string{ + 0: "idle", + 1: "runnable", + 2: "running", + 3: "syscall", + 4: "waiting", + 8: "copystack", + } + gScanStatusString = [...]string{ + 1: "scanrunnable", + 2: "scanrunning", + 3: "scansyscall", + 4: "scanwaiting", + 7: "scanenqueue", + } +) + +func (s *Server) handleGoroutines(req *protocol.GoroutinesRequest, resp *protocol.GoroutinesResponse) error { + // Get DWARF type information for runtime.g. + ge, err := s.dwarfData.LookupEntry("runtime.g") + if err != nil { + return err + } + t, err := s.dwarfData.Type(ge.Offset) + if err != nil { + return err + } + gType, ok := followTypedefs(t).(*dwarf.StructType) + if !ok { + return errors.New("runtime.g is not a struct") + } + + var ( + allgPtr, allgLen uint64 + allgPtrOk bool + ) + for { + // Try to read the slice runtime.allgs. + allgsEntry, err := s.dwarfData.LookupVariable("runtime.allgs") + if err != nil { + break + } + allgsAddr, err := s.dwarfData.EntryLocation(allgsEntry) + if err != nil { + break + } + off, err := s.dwarfData.EntryTypeOffset(allgsEntry) + if err != nil { + break + } + t, err := s.dwarfData.Type(off) + if err != nil { + break + } + allgsType, ok := followTypedefs(t).(*dwarf.SliceType) + if !ok { + break + } + allgs, err := s.peekSlice(allgsType, allgsAddr) + if err != nil { + break + } + + allgPtr, allgLen, allgPtrOk = allgs.Address, allgs.Length, true + break + } + if !allgPtrOk { + // Read runtime.allg. + allgEntry, err := s.dwarfData.LookupVariable("runtime.allg") + if err != nil { + return err + } + allgAddr, err := s.dwarfData.EntryLocation(allgEntry) + if err != nil { + return err + } + allgPtr, err = s.peekPtr(allgAddr) + if err != nil { + return fmt.Errorf("reading allg: %v", err) + } + + // Read runtime.allglen. + allglenEntry, err := s.dwarfData.LookupVariable("runtime.allglen") + if err != nil { + return err + } + off, err := s.dwarfData.EntryTypeOffset(allglenEntry) + if err != nil { + return err + } + allglenType, err := s.dwarfData.Type(off) + if err != nil { + return err + } + allglenAddr, err := s.dwarfData.EntryLocation(allglenEntry) + if err != nil { + return err + } + switch followTypedefs(allglenType).(type) { + case *dwarf.UintType, *dwarf.IntType: + allgLen, err = s.peekUint(allglenAddr, allglenType.Common().ByteSize) + if err != nil { + return fmt.Errorf("reading allglen: %v", err) + } + default: + // Some runtimes don't specify the type for allglen. Assume it's uint32. + allgLen, err = s.peekUint(allglenAddr, 4) + if err != nil { + return fmt.Errorf("reading allglen: %v", err) + } + if allgLen != 0 { + break + } + // Zero? Let's try uint64. + allgLen, err = s.peekUint(allglenAddr, 8) + if err != nil { + return fmt.Errorf("reading allglen: %v", err) + } + } + } + + // Initialize s.goroutineStack. + s.goroutineStackOnce.Do(func() { s.goroutineStackInit(gType) }) + + for i := uint64(0); i < allgLen; i++ { + // allg is an array of pointers to g structs. Read allg[i]. + g, err := s.peekPtr(allgPtr + i*uint64(s.arch.PointerSize)) + if err != nil { + return err + } + gr := debug.Goroutine{} + + // Read status from the field named "atomicstatus" or "status". + status, err := s.peekUintStructField(gType, g, "atomicstatus") + if err != nil { + status, err = s.peekUintOrIntStructField(gType, g, "status") + } + if err != nil { + return err + } + if status == 6 { + // _Gdead. + continue + } + gr.Status = invalidStatus + if status < uint64(len(gStatus)) { + gr.Status = gStatus[status] + gr.StatusString = gStatusString[status] + } else if status^0x1000 < uint64(len(gScanStatus)) { + gr.Status = gScanStatus[status^0x1000] + gr.StatusString = gScanStatusString[status^0x1000] + } + if gr.Status == invalidStatus { + return fmt.Errorf("unexpected goroutine status 0x%x", status) + } + if status == 4 || status == 0x1004 { + // _Gwaiting or _Gscanwaiting. + // Try reading waitreason to get a better value for StatusString. + // Depending on the runtime, waitreason may be a Go string or a C string. + if waitreason, err := s.peekStringStructField(gType, g, "waitreason", 80); err == nil { + if waitreason != "" { + gr.StatusString = waitreason + } + } else if ptr, err := s.peekPtrStructField(gType, g, "waitreason"); err == nil { + waitreason := s.peekCString(ptr, 80) + if waitreason != "" { + gr.StatusString = waitreason + } + } + } + + gr.ID, err = s.peekIntStructField(gType, g, "goid") + if err != nil { + return err + } + + // Best-effort attempt to get the names of the goroutine function and the + // function that created the goroutine. They aren't always available. + functionName := func(pc uint64) string { + entry, _, err := s.dwarfData.PCToFunction(pc) + if err != nil { + return "" + } + name, _ := entry.Val(dwarf.AttrName).(string) + return name + } + if startpc, err := s.peekUintStructField(gType, g, "startpc"); err == nil { + gr.Function = functionName(startpc) + } + if gopc, err := s.peekUintStructField(gType, g, "gopc"); err == nil { + gr.Caller = functionName(gopc) + } + if gr.Status != debug.Running { + // TODO: running goroutines too. + gr.StackFrames, _ = s.goroutineStack(g) + } + + resp.Goroutines = append(resp.Goroutines, &gr) + } + + return nil +} + +// TODO: let users specify how many frames they want. 10 will be enough to +// determine the reason a goroutine is blocked. +const goroutineStackFrameCount = 10 + +// goroutineStackInit initializes s.goroutineStack. +func (s *Server) goroutineStackInit(gType *dwarf.StructType) { + // If we fail to read the DWARF data needed for s.goroutineStack, calling it + // will always return the error that occurred during initialization. + var err error // err is captured by the func below. + s.goroutineStack = func(gAddr uint64) ([]debug.Frame, error) { + return nil, err + } + + // Get g field "sched", which contains fields pc and sp. + schedField, err := getField(gType, "sched") + if err != nil { + return + } + schedOffset := uint64(schedField.ByteOffset) + schedType, ok := followTypedefs(schedField.Type).(*dwarf.StructType) + if !ok { + err = errors.New(`g field "sched" has the wrong type`) + return + } + + // Get the size of the pc and sp fields and their offsets inside the g struct, + // so we can quickly peek those values for each goroutine later. + var ( + schedPCOffset, schedSPOffset uint64 + schedPCByteSize, schedSPByteSize int64 + ) + for _, x := range []struct { + field string + offset *uint64 + bytesize *int64 + }{ + {"pc", &schedPCOffset, &schedPCByteSize}, + {"sp", &schedSPOffset, &schedSPByteSize}, + } { + var f *dwarf.StructField + f, err = getField(schedType, x.field) + if err != nil { + return + } + *x.offset = schedOffset + uint64(f.ByteOffset) + switch t := followTypedefs(f.Type).(type) { + case *dwarf.UintType, *dwarf.IntType: + *x.bytesize = t.Common().ByteSize + default: + err = fmt.Errorf("gobuf field %q has the wrong type", x.field) + return + } + } + + s.goroutineStack = func(gAddr uint64) ([]debug.Frame, error) { + schedPC, err := s.peekUint(gAddr+schedPCOffset, schedPCByteSize) + if err != nil { + return nil, err + } + schedSP, err := s.peekUint(gAddr+schedSPOffset, schedSPByteSize) + if err != nil { + return nil, err + } + return s.walkStack(schedPC, schedSP, goroutineStackFrameCount) + } +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/value.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/value.go new file mode 100644 index 000000000..324b24435 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/value.go @@ -0,0 +1,260 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build linux + +package server + +import ( + "fmt" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf" +) + +// value peeks the program's memory at the given address, parsing it as a value of type t. +func (s *Server) value(t dwarf.Type, addr uint64) (debug.Value, error) { + // readBasic reads the memory for a basic type of size n bytes. + readBasic := func(n int64) ([]byte, error) { + switch n { + case 1, 2, 4, 8, 16: + default: + return nil, fmt.Errorf("invalid size: %d", n) + } + buf := make([]byte, n) + if err := s.peek(uintptr(addr), buf); err != nil { + return nil, err + } + return buf, nil + } + + switch t := t.(type) { + case *dwarf.CharType, *dwarf.IntType: + bs := t.Common().ByteSize + buf, err := readBasic(bs) + if err != nil { + return nil, fmt.Errorf("reading integer: %s", err) + } + x := s.arch.IntN(buf) + switch bs { + case 1: + return int8(x), nil + case 2: + return int16(x), nil + case 4: + return int32(x), nil + case 8: + return int64(x), nil + default: + return nil, fmt.Errorf("invalid integer size: %d", bs) + } + case *dwarf.UcharType, *dwarf.UintType, *dwarf.AddrType: + bs := t.Common().ByteSize + buf, err := readBasic(bs) + if err != nil { + return nil, fmt.Errorf("reading unsigned integer: %s", err) + } + x := s.arch.UintN(buf) + switch bs { + case 1: + return uint8(x), nil + case 2: + return uint16(x), nil + case 4: + return uint32(x), nil + case 8: + return uint64(x), nil + default: + return nil, fmt.Errorf("invalid unsigned integer size: %d", bs) + } + case *dwarf.BoolType: + bs := t.Common().ByteSize + buf, err := readBasic(bs) + if err != nil { + return nil, fmt.Errorf("reading boolean: %s", err) + } + for _, b := range buf { + if b != 0 { + return true, nil + } + } + return false, nil + case *dwarf.FloatType: + bs := t.Common().ByteSize + buf, err := readBasic(bs) + if err != nil { + return nil, fmt.Errorf("reading float: %s", err) + } + switch bs { + case 4: + return s.arch.Float32(buf), nil + case 8: + return s.arch.Float64(buf), nil + default: + return nil, fmt.Errorf("invalid float size: %d", bs) + } + case *dwarf.ComplexType: + bs := t.Common().ByteSize + buf, err := readBasic(bs) + if err != nil { + return nil, fmt.Errorf("reading complex: %s", err) + } + switch bs { + case 8: + return s.arch.Complex64(buf), nil + case 16: + return s.arch.Complex128(buf), nil + default: + return nil, fmt.Errorf("invalid complex size: %d", bs) + } + case *dwarf.PtrType: + bs := t.Common().ByteSize + if bs != int64(s.arch.PointerSize) { + return nil, fmt.Errorf("invalid pointer size: %d", bs) + } + buf, err := readBasic(bs) + if err != nil { + return nil, fmt.Errorf("reading pointer: %s", err) + } + return debug.Pointer{ + TypeID: uint64(t.Type.Common().Offset), + Address: uint64(s.arch.Uintptr(buf)), + }, nil + case *dwarf.SliceType: + if s, err := s.peekSlice(t, addr); err != nil { + return nil, err + } else { + return s, nil + } + case *dwarf.ArrayType: + length := t.Count + stride := t.StrideBitSize + if stride%8 != 0 { + return nil, fmt.Errorf("array is not byte-aligned") + } + return debug.Array{ + ElementTypeID: uint64(t.Type.Common().Offset), + Address: uint64(addr), + Length: uint64(length), + StrideBits: uint64(stride), + }, nil + case *dwarf.StructType: + fields := make([]debug.StructField, len(t.Field)) + for i, field := range t.Field { + fields[i] = debug.StructField{ + Name: field.Name, + Var: debug.Var{ + TypeID: uint64(field.Type.Common().Offset), + Address: uint64(addr) + uint64(field.ByteOffset), + }, + } + } + return debug.Struct{fields}, nil + case *dwarf.TypedefType: + return s.value(t.Type, addr) + case *dwarf.MapType: + length, err := s.peekMapLength(t, addr) + if err != nil { + return nil, err + } + return debug.Map{ + TypeID: uint64(t.Common().Offset), + Address: addr, + Length: length, + }, nil + case *dwarf.StringType: + ptr, err := s.peekPtrStructField(&t.StructType, addr, "str") + if err != nil { + return nil, fmt.Errorf("reading string location: %s", err) + } + length, err := s.peekUintOrIntStructField(&t.StructType, addr, "len") + if err != nil { + return nil, fmt.Errorf("reading string length: %s", err) + } + + const maxStringSize = 256 + + n := length + if n > maxStringSize { + n = maxStringSize + } + tmp := make([]byte, n) + if err := s.peekBytes(ptr, tmp); err != nil { + return nil, fmt.Errorf("reading string contents: %s", err) + } + return debug.String{Length: length, String: string(tmp)}, nil + case *dwarf.ChanType: + pt, ok := t.TypedefType.Type.(*dwarf.PtrType) + if !ok { + return nil, fmt.Errorf("reading channel: type is not a pointer") + } + st, ok := pt.Type.(*dwarf.StructType) + if !ok { + return nil, fmt.Errorf("reading channel: type is not a pointer to struct") + } + + a, err := s.peekPtr(addr) + if err != nil { + return nil, fmt.Errorf("reading channel pointer: %s", err) + } + if a == 0 { + // This channel is nil. + return debug.Channel{ + ElementTypeID: uint64(t.ElemType.Common().Offset), + Address: 0, + Buffer: 0, + Length: 0, + Capacity: 0, + Stride: uint64(t.ElemType.Common().ByteSize), + BufferStart: 0, + }, nil + } + + buf, err := s.peekPtrStructField(st, a, "buf") + if err != nil { + return nil, fmt.Errorf("reading channel buffer location: %s", err) + } + qcount, err := s.peekUintOrIntStructField(st, a, "qcount") + if err != nil { + return nil, fmt.Errorf("reading channel length: %s", err) + } + capacity, err := s.peekUintOrIntStructField(st, a, "dataqsiz") + if err != nil { + return nil, fmt.Errorf("reading channel capacity: %s", err) + } + recvx, err := s.peekUintOrIntStructField(st, a, "recvx") + if err != nil { + return nil, fmt.Errorf("reading channel buffer index: %s", err) + } + return debug.Channel{ + ElementTypeID: uint64(t.ElemType.Common().Offset), + Address: a, + Buffer: buf, + Length: qcount, + Capacity: capacity, + Stride: uint64(t.ElemType.Common().ByteSize), + BufferStart: recvx, + }, nil + case *dwarf.FuncType: + a, err := s.peekPtr(addr) + if err != nil { + return nil, fmt.Errorf("reading func: %s", err) + } + return debug.Func{Address: a}, nil + case *dwarf.InterfaceType: + return debug.Interface{}, nil + // TODO: more types + } + return nil, fmt.Errorf("Unsupported type %T", t) +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/doc.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/doc.go new file mode 100644 index 000000000..425722765 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/doc.go @@ -0,0 +1,15 @@ +// 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 +// +// https://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 peek diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/peek_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/peek_test.go new file mode 100644 index 000000000..c72e4162e --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/peek_test.go @@ -0,0 +1,1074 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build linux + +package peek_test + +import ( + "flag" + "fmt" + "log" + "os" + "os/exec" + "reflect" + "regexp" + "sync" + "testing" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/local" + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/remote" +) + +var expectedVarValues = map[string]interface{}{ + `main.Z_bool_false`: false, + `main.Z_bool_true`: true, + `main.Z_complex128`: complex128(1.987654321 - 2.987654321i), + `main.Z_complex64`: complex64(1.54321 + 2.54321i), + `main.Z_float32`: float32(1.54321), + `main.Z_float64`: float64(1.987654321), + `main.Z_int16`: int16(-32321), + `main.Z_int32`: int32(-1987654321), + `main.Z_int64`: int64(-9012345678987654321), + `main.Z_int8`: int8(-121), + `main.Z_uint16`: uint16(54321), + `main.Z_uint32`: uint32(3217654321), + `main.Z_uint64`: uint64(12345678900987654321), + `main.Z_uint8`: uint8(231), +} + +// TODO: the string forms of some types we're testing aren't stable +var expectedVars = map[string]string{ + `main.Z_array`: `[5]int8{-121, 121, 3, 2, 1}`, + `main.Z_array_empty`: `[0]int8{}`, + `main.Z_bool_false`: `false`, + `main.Z_bool_true`: `true`, + `main.Z_channel`: `(chan int16 0xX)`, + `main.Z_channel_2`: `(chan int16 0xX)`, + `main.Z_channel_buffered`: `(chan int16 0xX [6/10])`, + `main.Z_channel_nil`: `(chan int16 )`, + `main.Z_array_of_empties`: `[2]{}{{} {}, ({} 0xX)}`, + `main.Z_complex128`: `(1.987654321-2.987654321i)`, + `main.Z_complex64`: `(1.54321+2.54321i)`, + `main.Z_float32`: `1.54321`, + `main.Z_float64`: `1.987654321`, + `main.Z_func_int8_r_int8`: `func(int8, *int8) void @0xX `, + `main.Z_func_int8_r_pint8`: `func(int8, **int8) void @0xX `, + `main.Z_func_bar`: `func(*main.FooStruct) void @0xX `, + `main.Z_func_nil`: `func(int8, *int8) void @0xX `, + `main.Z_int`: `-21`, + `main.Z_int16`: `-32321`, + `main.Z_int32`: `-1987654321`, + `main.Z_int64`: `-9012345678987654321`, + `main.Z_int8`: `-121`, + `main.Z_int_typedef`: `88`, + `main.Z_interface`: `("*main.FooStruct", 0xX)`, + `main.Z_interface_nil`: `(, )`, + `main.Z_interface_typed_nil`: `("*main.FooStruct", )`, + `main.Z_map`: `map[-21:3.54321]`, + `main.Z_map_2`: `map[1024:1]`, + `main.Z_map_3`: `map[1024:1 512:-1]`, + `main.Z_map_empty`: `map[]`, + `main.Z_map_nil`: `map[]`, + `main.Z_pointer`: `0xX`, + `main.Z_pointer_nil`: `0x0`, + `main.Z_slice`: `[]uint8{115, 108, 105, 99, 101}`, + `main.Z_slice_2`: `[]int8{-121, 121}`, + `main.Z_slice_nil`: `[]uint8{}`, + `main.Z_string`: `"I'm a string"`, + `main.Z_struct`: `main.FooStruct {21, "hi"}`, + `main.Z_uint`: `21`, + `main.Z_uint16`: `54321`, + `main.Z_uint32`: `3217654321`, + `main.Z_uint64`: `12345678900987654321`, + `main.Z_uint8`: `231`, + `main.Z_uintptr`: `21`, + `main.Z_unsafe_pointer`: `0xX`, + `main.Z_unsafe_pointer_nil`: `0x0`, +} + +// expectedEvaluate contains expected results of the debug.Evaluate function. +// A nil value indicates that an error is expected. +var expectedEvaluate = map[string]debug.Value{ + `x`: int16(42), + `local_array`: debug.Array{42, 42, 5, 8}, + `local_channel`: debug.Channel{42, 42, 42, 0, 0, 2, 0}, + `local_channel_buffered`: debug.Channel{42, 42, 42, 6, 10, 2, 8}, + `local_map`: debug.Map{42, 42, 1}, + `local_map_2`: debug.Map{42, 42, 1}, + `local_map_3`: debug.Map{42, 42, 2}, + `local_map_empty`: debug.Map{42, 42, 0}, + `x + 5`: int16(47), + `x - 5`: int16(37), + `x / 5`: int16(8), + `x % 5`: int16(2), + `x & 2`: int16(2), + `x | 1`: int16(43), + `x ^ 3`: int16(41), + `5 + x`: int16(47), + `5 - x`: int16(-37), + `100 / x`: int16(2), + `100 % x`: int16(16), + `2 & x`: int16(2), + `1 | x`: int16(43), + `3 ^ x`: int16(41), + `12`: 12, + `+42`: 42, + `23i`: 23i, + `34.0`: 34.0, + `34.5`: 34.5, + `1e5`: 100000.0, + `0x42`: 66, + `'c'`: 'c', + `"de"`: debug.String{2, `de`}, + "`ef`": debug.String{2, `ef`}, + `"de" + "fg"`: debug.String{4, `defg`}, + `/* comment */ -5`: -5, + `false`: false, + `true`: true, + `!false`: true, + `!true`: false, + `5 + 5`: 10, + `true || false`: true, + `false || false`: false, + `true && false`: false, + `true && true`: true, + `!(5 > 8)`: true, + `10 + 'a'`: 'k', + `10 + 10.5`: 20.5, + `10 + 10.5i`: 10 + 10.5i, + `'a' + 10.5`: 107.5, + `'a' + 10.5i`: 97 + 10.5i, + `10.5 + 20.5i`: 10.5 + 20.5i, + `10 * 20`: 200, + `10.0 - 20.5`: -10.5, + `(6 + 8i) * 4`: 24 + 32i, + `(6 + 8i) * (1 + 1i)`: -2 + 14i, + `(6 + 8i) * (6 - 8i)`: complex128(100), + `(6 + 8i) / (3 + 4i)`: complex128(2), + `local_array[2]`: int8(3), + `&local_array[1]`: debug.Pointer{42, 42}, + `local_map[-21]`: float32(3.54321), + `local_map[+21]`: float32(0), + `local_map_3[1024]`: int8(1), + `local_map_3[512]`: int8(-1), + `local_map_empty[21]`: float32(0), + `"hello"[2]`: uint8('l'), + `local_array[1:3][1]`: int8(3), + `local_array[0:4][2:3][0]`: int8(3), + `local_array[:]`: debug.Slice{debug.Array{42, 42, 5, 8}, 5}, + `local_array[:2]`: debug.Slice{debug.Array{42, 42, 2, 8}, 5}, + `local_array[2:]`: debug.Slice{debug.Array{42, 42, 3, 8}, 3}, + `local_array[1:3]`: debug.Slice{debug.Array{42, 42, 2, 8}, 4}, + `local_array[:3:4]`: debug.Slice{debug.Array{42, 42, 3, 8}, 4}, + `local_array[1:3:4]`: debug.Slice{debug.Array{42, 42, 2, 8}, 3}, + `local_array[1:][1:][1:]`: debug.Slice{debug.Array{42, 42, 2, 8}, 2}, + `(&local_array)[:]`: debug.Slice{debug.Array{42, 42, 5, 8}, 5}, + `(&local_array)[:2]`: debug.Slice{debug.Array{42, 42, 2, 8}, 5}, + `(&local_array)[2:]`: debug.Slice{debug.Array{42, 42, 3, 8}, 3}, + `(&local_array)[1:3]`: debug.Slice{debug.Array{42, 42, 2, 8}, 4}, + `(&local_array)[:3:4]`: debug.Slice{debug.Array{42, 42, 3, 8}, 4}, + `(&local_array)[1:3:4]`: debug.Slice{debug.Array{42, 42, 2, 8}, 3}, + `lookup("main.Z_array")`: debug.Array{42, 42, 5, 8}, + `lookup("main.Z_array_empty")`: debug.Array{42, 42, 0, 8}, + `lookup("main.Z_bool_false")`: false, + `lookup("main.Z_bool_true")`: true, + `lookup("main.Z_channel")`: debug.Channel{42, 42, 42, 0, 0, 2, 0}, + `lookup("main.Z_channel_buffered")`: debug.Channel{42, 42, 42, 6, 10, 2, 8}, + `lookup("main.Z_channel_nil")`: debug.Channel{42, 0, 0, 0, 0, 2, 0}, + `lookup("main.Z_array_of_empties")`: debug.Array{42, 42, 2, 0}, + `lookup("main.Z_complex128")`: complex128(1.987654321 - 2.987654321i), + `lookup("main.Z_complex64")`: complex64(1.54321 + 2.54321i), + `lookup("main.Z_float32")`: float32(1.54321), + `lookup("main.Z_float64")`: float64(1.987654321), + `lookup("main.Z_func_int8_r_int8")`: debug.Func{42}, + `lookup("main.Z_func_int8_r_pint8")`: debug.Func{42}, + `lookup("main.Z_func_bar")`: debug.Func{42}, + `lookup("main.Z_func_nil")`: debug.Func{0}, + `lookup("main.Z_int")`: -21, + `lookup("main.Z_int16")`: int16(-32321), + `lookup("main.Z_int32")`: int32(-1987654321), + `lookup("main.Z_int64")`: int64(-9012345678987654321), + `lookup("main.Z_int8")`: int8(-121), + `lookup("main.Z_int_typedef")`: int16(88), + `lookup("main.Z_interface")`: debug.Interface{}, + `lookup("main.Z_interface_nil")`: debug.Interface{}, + `lookup("main.Z_interface_typed_nil")`: debug.Interface{}, + `lookup("main.Z_map")`: debug.Map{42, 42, 1}, + `lookup("main.Z_map_2")`: debug.Map{42, 42, 1}, + `lookup("main.Z_map_3")`: debug.Map{42, 42, 2}, + `lookup("main.Z_map_empty")`: debug.Map{42, 42, 0}, + `lookup("main.Z_map_nil")`: debug.Map{42, 42, 0}, + `lookup("main.Z_pointer")`: debug.Pointer{42, 42}, + `lookup("main.Z_pointer_nil")`: debug.Pointer{42, 0}, + `lookup("main.Z_slice")`: debug.Slice{debug.Array{42, 42, 5, 8}, 5}, + `lookup("main.Z_slice_2")`: debug.Slice{debug.Array{42, 42, 2, 8}, 5}, + `lookup("main.Z_slice_nil")`: debug.Slice{debug.Array{42, 0, 0, 8}, 0}, + `lookup("main.Z_string")`: debug.String{12, `I'm a string`}, + `lookup("main.Z_struct")`: debug.Struct{[]debug.StructField{{"a", debug.Var{}}, {"b", debug.Var{}}}}, + `lookup("main.Z_uint")`: uint(21), + `lookup("main.Z_uint16")`: uint16(54321), + `lookup("main.Z_uint32")`: uint32(3217654321), + `lookup("main.Z_uint64")`: uint64(12345678900987654321), + `lookup("main.Z_uint8")`: uint8(231), + `lookup("main.Z_uintptr")`: uint(21), + `lookup("main.Z_unsafe_pointer")`: debug.Pointer{0, 42}, + `lookup("main.Z_unsafe_pointer_nil")`: debug.Pointer{0, 0}, + `lookup("main.Z_int") + lookup("main.Z_int")`: -42, + `lookup("main.Z_int16") < 0`: true, + `lookup("main.Z_uint32") + lookup("main.Z_uint32")`: uint32(2140341346), + `lookup("main.Z_bool_true") || lookup("main.Z_bool_false")`: true, + `lookup("main.Z_bool_true") && lookup("main.Z_bool_false")`: false, + `lookup("main.Z_bool_false") || lookup("main.Z_bool_false")`: false, + `!lookup("main.Z_bool_true")`: false, + `!lookup("main.Z_bool_false")`: true, + `lookup("main.Z_array")[2]`: int8(3), + `lookup("main.Z_array")[1:3][1]`: int8(3), + `lookup("main.Z_array")[0:4][2:3][0]`: int8(3), + `lookup("main.Z_array_of_empties")[0]`: debug.Struct{}, + `lookup("main.Z_complex128") * 10.0`: complex128(19.87654321 - 29.87654321i), + `lookup("main.Z_complex64") * 0.1`: complex64(0.154321 + 0.254321i), + `lookup("main.Z_float32") * 10.0`: float32(15.4321), + `lookup("main.Z_float64") * 0.1`: float64(0.1987654321), + `lookup("main.Z_int") + 1`: int(-20), + `lookup("main.Z_int16") - 10`: int16(-32331), + `lookup("main.Z_int32") / 10`: int32(-198765432), + `lookup("main.Z_int64") / 10`: int64(-901234567898765432), + `lookup("main.Z_int8") + 10`: int8(-111), + `lookup("main.Z_map")[-21]`: float32(3.54321), + `lookup("main.Z_map")[+21]`: float32(0), + `lookup("main.Z_map_empty")[21]`: float32(0), + `lookup("main.Z_slice")[1]`: uint8(108), + `lookup("main.Z_slice_2")[1]`: int8(121), + `lookup("main.Z_slice")[1:5][0:3][1]`: uint8('i'), + `lookup("main.Z_array")[1:3:4]`: debug.Slice{debug.Array{42, 42, 2, 8}, 3}, + `(&lookup("main.Z_array"))[1:3:4]`: debug.Slice{debug.Array{42, 42, 2, 8}, 3}, + `lookup("main.Z_string") + "!"`: debug.String{13, `I'm a string!`}, + `lookup("main.Z_struct").a`: 21, + `(&lookup("main.Z_struct")).a`: 21, + `lookup("main.Z_uint")/10`: uint(2), + `lookup("main.Z_uint16")/10`: uint16(5432), + `lookup("main.Z_uint32")/10`: uint32(321765432), + `lookup("main.Z_uint64")/10`: uint64(1234567890098765432), + `lookup("main.Z_uint8")/10`: uint8(23), + `lookup("main.Z_pointer").a`: 21, + `(*lookup("main.Z_pointer")).a`: 21, + `(&*lookup("main.Z_pointer")).a`: 21, + `lookup("main.Z_pointer").b`: debug.String{2, `hi`}, + `(*lookup("main.Z_pointer")).b`: debug.String{2, `hi`}, + `(&*lookup("main.Z_pointer")).b`: debug.String{2, `hi`}, + `lookup("main.Z_map_nil")[32]`: float32(0), + `&lookup("main.Z_int16")`: debug.Pointer{42, 42}, + `&lookup("main.Z_array")[1]`: debug.Pointer{42, 42}, + `&lookup("main.Z_slice")[1]`: debug.Pointer{42, 42}, + `*&lookup("main.Z_int16")`: int16(-32321), + `*&*&*&*&lookup("main.Z_int16")`: int16(-32321), + `lookup("time.Local")`: debug.Pointer{42, 42}, + `5 + false`: nil, + ``: nil, + `x + ""`: nil, + `x / 0`: nil, + `0 / 0`: nil, + `'a' / ('a'-'a')`: nil, + `0.0 / 0.0`: nil, + `3i / 0.0`: nil, + `x % 0`: nil, + `0 % 0`: nil, + `'a' % ('a'-'a')`: nil, + `local_array[-2] + 1`: nil, + `local_array[22] + 1`: nil, + `local_slice[-2] + 1`: nil, + `local_slice[22] + 1`: nil, + `local_string[-2]`: nil, + `local_string[22]`: nil, + `"hello"[-2]`: nil, + `"hello"[22]`: nil, + `local_pointer_nil.a`: nil, + `(local_struct).c`: nil, + `(&local_struct).c`: nil, + `(*local_pointer).c`: nil, + `lookup("not a real symbol")`: nil, + `lookup("x")`: nil, + `lookup(x)`: nil, + `lookup(42)`: nil, +} + +func isHex(r uint8) bool { + switch { + case '0' <= r && r <= '9': + return true + case 'a' <= r && r <= 'f': + return true + case 'A' <= r && r <= 'F': + return true + default: + return false + } +} + +// structRE is used by matches to remove 'struct ' from type names, which is not +// output by every version of the compiler. +var structRE = regexp.MustCompile("struct *") + +// Check s matches the pattern in p. +// An 'X' in p greedily matches one or more hex characters in s. +func matches(p, s string) bool { + // Remove 'struct' and following spaces from s. + s = structRE.ReplaceAllString(s, "") + j := 0 + for i := 0; i < len(p); i++ { + if j == len(s) { + return false + } + c := p[i] + if c == 'X' { + if !isHex(s[j]) { + return false + } + for j < len(s) && isHex(s[j]) { + j++ + } + continue + } + if c != s[j] { + return false + } + j++ + } + return j == len(s) +} + +const ( + proxySrc = "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/cmd/debugproxy" + traceeSrc = "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/testdata" +) + +var ( + // Locations of the proxy and tracee executables. + proxyBinary = "./debugproxy.out" + traceeBinary = "./tracee.out" + // Onces that ensure initProxy and initTracee are called at most once. + proxyOnce sync.Once + traceeOnce sync.Once + // Flags for setting the location of the proxy and tracee, so they don't need to be built. + proxyFlag = flag.String("proxy", "", "Location of debugproxy. If empty, proxy will be built.") + traceeFlag = flag.String("target", "", "Location of target. If empty, target will be built.") + // Executables this test has built, which will be removed on completion of the tests. + filesToRemove []string +) + +func TestMain(m *testing.M) { + flag.Parse() + x := m.Run() + for _, f := range filesToRemove { + os.Remove(f) + } + os.Exit(x) +} + +func run(name string, args ...string) error { + cmd := exec.Command(name, args...) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + return cmd.Run() +} + +func initProxy() { + if *proxyFlag != "" { + proxyBinary = *proxyFlag + remote.DebugproxyCmd = proxyBinary + return + } + if err := run("go", "build", "-o", proxyBinary, proxySrc); err != nil { + log.Fatalf("couldn't build proxy: %v", err) + } + filesToRemove = append(filesToRemove, proxyBinary) + remote.DebugproxyCmd = proxyBinary +} + +func initTracee() { + if *traceeFlag != "" { + traceeBinary = *traceeFlag + return + } + if err := run("go", "build", "-o", traceeBinary, traceeSrc); err != nil { + log.Fatalf("couldn't build target: %v", err) + } + filesToRemove = append(filesToRemove, traceeBinary) +} + +func TestLocalProgram(t *testing.T) { + t.Skip("Fails looking for runtime.lessstack for some reason") + traceeOnce.Do(initTracee) + prog, err := local.New(traceeBinary) + if err != nil { + t.Fatal("local.New:", err) + } + testProgram(t, prog) +} + +func TestRemoteProgram(t *testing.T) { + t.Skip("Fails looking for runtime.lessstack for some reason") + traceeOnce.Do(initTracee) + proxyOnce.Do(initProxy) + prog, err := remote.New("localhost", traceeBinary) + if err != nil { + t.Fatal("remote.New:", err) + } + testProgram(t, prog) +} + +func testProgram(t *testing.T, prog debug.Program) { + _, err := prog.Run("some", "arguments") + if err != nil { + log.Fatalf("Run: %v", err) + } + + pcs, err := prog.BreakpointAtFunction("main.foo") + if err != nil { + log.Fatalf("BreakpointAtFunction: %v", err) + } + fmt.Printf("breakpoints set at %x\n", pcs) + + _, err = prog.Resume() + if err != nil { + log.Fatalf("Resume: %v", err) + } + + gs, err := prog.Goroutines() + if err != nil { + t.Fatalf("Goroutines(): got error %s", err) + } + for _, g := range gs { + fmt.Println(g) + for _, f := range g.StackFrames { + fmt.Println(f) + } + } + + frames, err := prog.Frames(100) + if err != nil { + log.Fatalf("prog.Frames error: %v", err) + } + fmt.Printf("%#v\n", frames) + if len(frames) == 0 { + t.Fatalf("no stack frames returned") + } + if frames[0].Function != "main.foo" { + t.Errorf("function name: got %s expected main.foo", frames[0].Function) + } + if len(frames[0].Params) != 2 { + t.Errorf("got %d parameters, expected 2", len(frames[0].Params)) + } else { + x := frames[0].Params[0] + y := frames[0].Params[1] + if x.Name != "x" { + x, y = y, x + } + if x.Name != "x" { + t.Errorf("parameter name: got %s expected x", x.Name) + } + if y.Name != "y" { + t.Errorf("parameter name: got %s expected y", y.Name) + } + if val, err := prog.Value(x.Var); err != nil { + t.Errorf("value of x: %s", err) + } else if val != int16(42) { + t.Errorf("value of x: got %T(%v) expected int16(42)", val, val) + } + if val, err := prog.Value(y.Var); err != nil { + t.Errorf("value of y: %s", err) + } else if val != float32(1.5) { + t.Errorf("value of y: got %T(%v) expected float32(1.5)", val, val) + } + } + + varnames, err := prog.Eval(`re:main\.Z_.*`) + if err != nil { + log.Fatalf("prog.Eval error: %v", err) + } + + // Evaluate each of the variables found above, and check they match + // expectedVars. + seen := make(map[string]bool) + for _, v := range varnames { + val, err := prog.Eval("val:" + v) + if err != nil { + log.Fatalf("prog.Eval error for %s: %v", v, err) + } else { + fmt.Printf("%s = %v\n", v, val) + if seen[v] { + log.Fatalf("repeated variable %s\n", v) + } + seen[v] = true + if len(val) != 1 { + log.Fatalf("should be one value for %s\n", v) + } + expected, ok := expectedVars[v] + if !ok { + log.Fatalf("unexpected variable %s\n", v) + } else { + if !matches(expected, val[0]) { + log.Fatalf("expected %s = %s\n", v, expected) + } + } + } + } + for v, e := range expectedVars { + if !seen[v] { + log.Fatalf("didn't get %s = %s\n", v, e) + } + } + + // Remove the breakpoint at main.foo. + err = prog.DeleteBreakpoints(pcs) + if err != nil { + log.Fatalf("DeleteBreakpoints: %v", err) + } + + // Set a breakpoint at line 125, resume, and check we stopped there. + pcsLine125, err := prog.BreakpointAtLine("testdata/main.go", 125) + if err != nil { + t.Fatal("BreakpointAtLine:", err) + } + status, err := prog.Resume() + if err != nil { + log.Fatalf("Resume: %v", err) + } + stoppedAt := func(pcs []uint64) bool { + for _, pc := range pcs { + if status.PC == pc { + return true + } + } + return false + } + if !stoppedAt(pcsLine125) { + t.Errorf("stopped at %X; expected one of %X.", status.PC, pcsLine125) + } + + for k, v := range expectedEvaluate { + val, err := prog.Evaluate(k) + if v == nil { + if err == nil { + t.Errorf("got Evaluate(%s) = %v, expected error", k, val) + } + continue + } + if err != nil { + t.Errorf("Evaluate(%s): got error %s, expected %v", k, err, v) + continue + } + typ := reflect.TypeOf(v) + if typ != reflect.TypeOf(val) && typ != reflect.TypeOf(int(0)) && typ != reflect.TypeOf(uint(0)) { + t.Errorf("got Evaluate(%s) = %T(%v), expected %T(%v)", k, val, val, v, v) + continue + } + + // For types with fields like Address, TypeID, etc., we can't know the exact + // value, so we only test whether those fields are zero or not. + switch v := v.(type) { + default: + if v != val { + t.Errorf("got Evaluate(%s) = %T(%v), expected %T(%v)", k, val, val, v, v) + } + case debug.Array: + val := val.(debug.Array) + if v.ElementTypeID == 0 && val.ElementTypeID != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero ElementTypeID", k, val) + } + if v.ElementTypeID != 0 && val.ElementTypeID == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero ElementTypeID", k, val) + } + if v.Address == 0 && val.Address != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero Address", k, val) + } + if v.Address != 0 && val.Address == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero Address", k, val) + } + case debug.Slice: + val := val.(debug.Slice) + if v.ElementTypeID == 0 && val.ElementTypeID != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero ElementTypeID", k, val) + } + if v.ElementTypeID != 0 && val.ElementTypeID == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero ElementTypeID", k, val) + } + if v.Address == 0 && val.Address != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero Address", k, val) + } + if v.Address != 0 && val.Address == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero Address", k, val) + } + case debug.Map: + val := val.(debug.Map) + if v.TypeID == 0 && val.TypeID != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero TypeID", k, val) + } + if v.TypeID != 0 && val.TypeID == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero TypeID", k, val) + } + if v.Address == 0 && val.Address != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero Address", k, val) + } + if v.Address != 0 && val.Address == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero Address", k, val) + } + case debug.Pointer: + val := val.(debug.Pointer) + if v.TypeID == 0 && val.TypeID != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero TypeID", k, val) + } + if v.TypeID != 0 && val.TypeID == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero TypeID", k, val) + } + if v.Address == 0 && val.Address != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero Address", k, val) + } + if v.Address != 0 && val.Address == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero Address", k, val) + } + case debug.Channel: + val := val.(debug.Channel) + if v.ElementTypeID == 0 && val.ElementTypeID != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero ElementTypeID", k, val) + } + if v.ElementTypeID != 0 && val.ElementTypeID == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero ElementTypeID", k, val) + } + if v.Address == 0 && val.Address != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero Address", k, val) + } + if v.Address != 0 && val.Address == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero Address", k, val) + } + if v.Buffer == 0 && val.Buffer != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero Buffer", k, val) + } + if v.Buffer != 0 && val.Buffer == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero Buffer", k, val) + } + case debug.Struct: + val := val.(debug.Struct) + if len(v.Fields) != len(val.Fields) { + t.Errorf("got Evaluate(%s) = %T(%v), expected %T(%v)", k, val, val, v, v) + break + } + for i := range v.Fields { + a := v.Fields[i].Name + b := val.Fields[i].Name + if a != b { + t.Errorf("Evaluate(%s): field name mismatch: %s vs %s", k, a, b) + break + } + } + case debug.Func: + val := val.(debug.Func) + if v.Address == 0 && val.Address != 0 { + t.Errorf("got Evaluate(%s) = %+v, expected zero Address", k, val) + } + if v.Address != 0 && val.Address == 0 { + t.Errorf("got Evaluate(%s) = %+v, expected non-zero Address", k, val) + } + case int: + // ints in a remote program can be returned as int32 or int64 + switch val := val.(type) { + case int32: + if val != int32(v) { + t.Errorf("got Evaluate(%s) = %T(%v), expected %v", k, val, val, v) + } + case int64: + if val != int64(v) { + t.Errorf("got Evaluate(%s) = %T(%v), expected %v", k, val, val, v) + } + default: + t.Errorf("got Evaluate(%s) = %T(%v), expected %T(%v)", k, val, val, v, v) + } + case uint: + // uints in a remote program can be returned as uint32 or uint64 + switch val := val.(type) { + case uint32: + if val != uint32(v) { + t.Errorf("got Evaluate(%s) = %T(%v), expected %v", k, val, val, v) + } + case uint64: + if val != uint64(v) { + t.Errorf("got Evaluate(%s) = %T(%v), expected %v", k, val, val, v) + } + default: + t.Errorf("got Evaluate(%s) = %T(%v), expected %T(%v)", k, val, val, v, v) + } + } + } + + // Evaluate a struct. + v := `lookup("main.Z_struct")` + val, err := prog.Evaluate(v) + if err != nil { + t.Fatalf("Evaluate: %s", err) + } + s, ok := val.(debug.Struct) + if !ok { + t.Fatalf("got Evaluate(%q) = %T(%v), expected debug.Struct", v, val, val) + } + // Check the values of its fields. + if len(s.Fields) != 2 { + t.Fatalf("got Evaluate(%q) = %+v, expected 2 fields", v, s) + } + if v0, err := prog.Value(s.Fields[0].Var); err != nil { + t.Errorf("Value: %s", err) + } else if v0 != int32(21) && v0 != int64(21) { + t.Errorf("Value: got %T(%v), expected 21", v0, v0) + } + if v1, err := prog.Value(s.Fields[1].Var); err != nil { + t.Errorf("Value: %s", err) + } else if v1 != (debug.String{2, "hi"}) { + t.Errorf("Value: got %T(%v), expected `hi`", v1, v1) + } + + // Remove the breakpoint at line 125, set a breakpoint at main.f1 and main.f2, + // then delete the breakpoint at main.f1. Resume, then check we stopped at + // main.f2. + err = prog.DeleteBreakpoints(pcsLine125) + if err != nil { + log.Fatalf("DeleteBreakpoints: %v", err) + } + pcs1, err := prog.BreakpointAtFunction("main.f1") + if err != nil { + log.Fatalf("BreakpointAtFunction: %v", err) + } + pcs2, err := prog.BreakpointAtFunction("main.f2") + if err != nil { + log.Fatalf("BreakpointAtFunction: %v", err) + } + err = prog.DeleteBreakpoints(pcs1) + if err != nil { + log.Fatalf("DeleteBreakpoints: %v", err) + } + status, err = prog.Resume() + if err != nil { + log.Fatalf("Resume: %v", err) + } + if !stoppedAt(pcs2) { + t.Errorf("stopped at %X; expected one of %X.", status.PC, pcs2) + } + + // Check we get the expected results calling VarByName then Value + // for the variables in expectedVarValues. + for name, exp := range expectedVarValues { + if v, err := prog.VarByName(name); err != nil { + t.Errorf("VarByName(%s): %s", name, err) + } else if val, err := prog.Value(v); err != nil { + t.Errorf("value of %s: %s", name, err) + } else if val != exp { + t.Errorf("value of %s: got %T(%v) want %T(%v)", name, val, val, exp, exp) + } + } + + // Check some error cases for VarByName and Value. + if _, err = prog.VarByName("not a real name"); err == nil { + t.Error("VarByName for invalid name: expected error") + } + if _, err = prog.Value(debug.Var{}); err == nil { + t.Error("value of invalid var: expected error") + } + if v, err := prog.VarByName("main.Z_int16"); err != nil { + t.Error("VarByName(main.Z_int16) error:", err) + } else { + v.Address = 0 + // v now has a valid type but a bad address. + _, err = prog.Value(v) + if err == nil { + t.Error("value of invalid location: expected error") + } + } + + // checkValue tests that we can get a Var for a variable with the given name, + // that we can then get the value of that Var, and that calling fn for that + // value succeeds. + checkValue := func(name string, fn func(val debug.Value) error) { + if v, err := prog.VarByName(name); err != nil { + t.Errorf("VarByName(%s): %s", name, err) + } else if val, err := prog.Value(v); err != nil { + t.Errorf("value of %s: %s", name, err) + } else if err := fn(val); err != nil { + t.Errorf("value of %s: %s", name, err) + } + } + + checkValue("main.Z_uintptr", func(val debug.Value) error { + if val != uint32(21) && val != uint64(21) { + // Z_uintptr should be an unsigned integer with size equal to the debugged + // program's address size. + return fmt.Errorf("got %T(%v) want 21", val, val) + } + return nil + }) + + checkValue("main.Z_int", func(val debug.Value) error { + if val != int32(-21) && val != int64(-21) { + return fmt.Errorf("got %T(%v) want -21", val, val) + } + return nil + }) + + checkValue("main.Z_uint", func(val debug.Value) error { + if val != uint32(21) && val != uint64(21) { + return fmt.Errorf("got %T(%v) want 21", val, val) + } + return nil + }) + + checkValue("main.Z_pointer", func(val debug.Value) error { + if _, ok := val.(debug.Pointer); !ok { + return fmt.Errorf("got %T(%v) expected Pointer", val, val) + } + return nil + }) + + checkValue("main.Z_pointer_nil", func(val debug.Value) error { + if p, ok := val.(debug.Pointer); !ok { + return fmt.Errorf("got %T(%v) expected Pointer", val, val) + } else if p.Address != 0 { + return fmt.Errorf("got %T(%v) expected nil pointer", val, val) + } + return nil + }) + + checkValue("main.Z_array", func(val debug.Value) error { + a, ok := val.(debug.Array) + if !ok { + return fmt.Errorf("got %T(%v) expected Array", val, val) + } + if a.Len() != 5 { + return fmt.Errorf("got array length %d expected 5", a.Len()) + } + expected := [5]int8{-121, 121, 3, 2, 1} + for i := uint64(0); i < 5; i++ { + if v, err := prog.Value(a.Element(i)); err != nil { + return fmt.Errorf("reading element %d: %s", i, err) + } else if v != expected[i] { + return fmt.Errorf("element %d: got %T(%v) want %T(%d)", i, v, v, expected[i], expected[i]) + } + } + return nil + }) + + checkValue("main.Z_slice", func(val debug.Value) error { + s, ok := val.(debug.Slice) + if !ok { + return fmt.Errorf("got %T(%v) expected Slice", val, val) + } + if s.Len() != 5 { + return fmt.Errorf("got slice length %d expected 5", s.Len()) + } + expected := []uint8{115, 108, 105, 99, 101} + for i := uint64(0); i < 5; i++ { + if v, err := prog.Value(s.Element(i)); err != nil { + return fmt.Errorf("reading element %d: %s", i, err) + } else if v != expected[i] { + return fmt.Errorf("element %d: got %T(%v) want %T(%d)", i, v, v, expected[i], expected[i]) + } + } + return nil + }) + + checkValue("main.Z_map_empty", func(val debug.Value) error { + m, ok := val.(debug.Map) + if !ok { + return fmt.Errorf("got %T(%v) expected Map", val, val) + } + if m.Length != 0 { + return fmt.Errorf("got map length %d expected 0", m.Length) + } + return nil + }) + + checkValue("main.Z_map_nil", func(val debug.Value) error { + m, ok := val.(debug.Map) + if !ok { + return fmt.Errorf("got %T(%v) expected Map", val, val) + } + if m.Length != 0 { + return fmt.Errorf("got map length %d expected 0", m.Length) + } + return nil + }) + + checkValue("main.Z_map_3", func(val debug.Value) error { + m, ok := val.(debug.Map) + if !ok { + return fmt.Errorf("got %T(%v) expected Map", val, val) + } + if m.Length != 2 { + return fmt.Errorf("got map length %d expected 2", m.Length) + } + keyVar0, valVar0, err := prog.MapElement(m, 0) + if err != nil { + return err + } + keyVar1, valVar1, err := prog.MapElement(m, 1) + if err != nil { + return err + } + key0, err := prog.Value(keyVar0) + if err != nil { + return err + } + key1, err := prog.Value(keyVar1) + if err != nil { + return err + } + val0, err := prog.Value(valVar0) + if err != nil { + return err + } + val1, err := prog.Value(valVar1) + if err != nil { + return err + } + // The map should contain 1024,1 and 512,-1 in some order. + ok1 := key0 == int16(1024) && val0 == int8(1) && key1 == int16(512) && val1 == int8(-1) + ok2 := key1 == int16(1024) && val1 == int8(1) && key0 == int16(512) && val0 == int8(-1) + if !ok1 && !ok2 { + return fmt.Errorf("got values (%d,%d) and (%d,%d), expected (1024,1) and (512,-1) in some order", key0, val0, key1, val1) + } + _, _, err = prog.MapElement(m, 2) + if err == nil { + return fmt.Errorf("MapElement: reading at a bad index succeeded, expected error") + } + return nil + }) + + checkValue("main.Z_string", func(val debug.Value) error { + s, ok := val.(debug.String) + if !ok { + return fmt.Errorf("got %T(%v) expected String", val, val) + } + if s.Length != 12 { + return fmt.Errorf("got string length %d expected 12", s.Length) + } + expected := "I'm a string" + if s.String != expected { + return fmt.Errorf("got %s expected %s", s.String, expected) + } + return nil + }) + + checkValue("main.Z_channel", func(val debug.Value) error { + c, ok := val.(debug.Channel) + if !ok { + return fmt.Errorf("got %T(%v) expected Channel", val, val) + } + if c.Buffer == 0 { + return fmt.Errorf("got buffer address %d expected nonzero", c.Buffer) + } + if c.Length != 0 { + return fmt.Errorf("got length %d expected 0", c.Length) + } + if c.Capacity != 0 { + return fmt.Errorf("got capacity %d expected 0", c.Capacity) + } + return nil + }) + + checkValue("main.Z_channel_2", func(val debug.Value) error { + c, ok := val.(debug.Channel) + if !ok { + return fmt.Errorf("got %T(%v) expected Channel", val, val) + } + if c.Buffer == 0 { + return fmt.Errorf("got buffer address %d expected nonzero", c.Buffer) + } + if c.Length != 0 { + return fmt.Errorf("got length %d expected 0", c.Length) + } + if c.Capacity != 0 { + return fmt.Errorf("got capacity %d expected 0", c.Capacity) + } + return nil + }) + + checkValue("main.Z_channel_nil", func(val debug.Value) error { + c, ok := val.(debug.Channel) + if !ok { + return fmt.Errorf("got %T(%v) expected Channel", val, val) + } + if c.Buffer != 0 { + return fmt.Errorf("got buffer address %d expected 0", c.Buffer) + } + if c.Length != 0 { + return fmt.Errorf("got length %d expected 0", c.Length) + } + if c.Capacity != 0 { + return fmt.Errorf("got capacity %d expected 0", c.Capacity) + } + return nil + }) + + checkValue("main.Z_channel_buffered", func(val debug.Value) error { + c, ok := val.(debug.Channel) + if !ok { + return fmt.Errorf("got %T(%v) expected Channel", val, val) + } + if c.Buffer == 0 { + return fmt.Errorf("got buffer address %d expected nonzero", c.Buffer) + } + if c.Length != 6 { + return fmt.Errorf("got length %d expected 6", c.Length) + } + if c.Capacity != 10 { + return fmt.Errorf("got capacity %d expected 10", c.Capacity) + } + if c.Stride != 2 { + return fmt.Errorf("got stride %d expected 2", c.Stride) + } + expected := []int16{8, 9, 10, 11, 12, 13} + for i := uint64(0); i < 6; i++ { + if v, err := prog.Value(c.Element(i)); err != nil { + return fmt.Errorf("reading element %d: %s", i, err) + } else if v != expected[i] { + return fmt.Errorf("element %d: got %T(%v) want %T(%d)", i, v, v, expected[i], expected[i]) + } + } + v := c.Element(6) + if v.Address != 0 { + return fmt.Errorf("invalid element returned Var with address %d, expected 0", v.Address) + } + return nil + }) + + checkValue("main.Z_func_bar", func(val debug.Value) error { + f, ok := val.(debug.Func) + if !ok { + return fmt.Errorf("got %T(%v) expected Func", val, val) + } + if f.Address == 0 { + return fmt.Errorf("got func address %d expected nonzero", f.Address) + } + return nil + }) + + checkValue("main.Z_func_nil", func(val debug.Value) error { + f, ok := val.(debug.Func) + if !ok { + return fmt.Errorf("got %T(%v) expected Func", val, val) + } + if f.Address != 0 { + return fmt.Errorf("got func address %d expected zero", f.Address) + } + return nil + }) +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/testdata/main.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/testdata/main.go new file mode 100644 index 000000000..68c22c175 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/tests/peek/testdata/main.go @@ -0,0 +1,203 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "fmt" + "log" + "os" + "time" + "unsafe" +) + +type FooInterface interface { + Bar() +} + +type FooStruct struct { + a int + b string +} + +func (f *FooStruct) Bar() {} + +type myInt int16 + +var ( + Z_bool_false bool = false + Z_bool_true bool = true + Z_int int = -21 + Z_int8 int8 = -121 + Z_int16 int16 = -32321 + Z_int32 int32 = -1987654321 + Z_int64 int64 = -9012345678987654321 + Z_int_typedef myInt = 88 + Z_uint uint = 21 + Z_uint8 uint8 = 231 + Z_uint16 uint16 = 54321 + Z_uint32 uint32 = 3217654321 + Z_uint64 uint64 = 12345678900987654321 + Z_uintptr uintptr = 21 + Z_float32 float32 = 1.54321 + Z_float64 float64 = 1.987654321 + Z_complex64 complex64 = 1.54321 + 2.54321i + Z_complex128 complex128 = 1.987654321 - 2.987654321i + Z_array [5]int8 = [5]int8{-121, 121, 3, 2, 1} + Z_array_empty [0]int8 = [0]int8{} + Z_array_of_empties [2]struct{} = [2]struct{}{{}, {}} + Z_channel chan int16 = make(chan int16) + Z_channel_2 chan int16 = make(chan int16) + Z_channel_buffered chan int16 = make(chan int16, 10) + Z_channel_nil chan int16 + Z_func_bar = (*FooStruct).Bar + Z_func_int8_r_int8 = func(x int8) int8 { return x + 1 } + Z_func_int8_r_pint8 = func(x int8) *int8 { y := x + 1; return &y } + Z_func_nil func(x int8) int8 = nil + Z_interface FooInterface = &Z_struct + Z_interface_typed_nil FooInterface = Z_pointer_nil + Z_interface_nil FooInterface + Z_map map[int8]float32 = map[int8]float32{-21: 3.54321} + Z_map_2 map[int16]int8 = map[int16]int8{1024: 1} + Z_map_3 map[int16]int8 = map[int16]int8{1024: 1, 512: -1} + Z_map_empty map[int8]float32 = map[int8]float32{} + Z_map_nil map[int8]float32 + Z_pointer *FooStruct = &Z_struct + Z_pointer_nil *FooStruct + Z_slice []byte = []byte{'s', 'l', 'i', 'c', 'e'} + Z_slice_2 []int8 = Z_array[0:2] + Z_slice_nil []byte + Z_string string = "I'm a string" + Z_struct FooStruct = FooStruct{a: 21, b: "hi"} + Z_unsafe_pointer unsafe.Pointer = unsafe.Pointer(&Z_uint) + Z_unsafe_pointer_nil unsafe.Pointer +) + +func foo(x int16, y float32) { + var ( + local_array [5]int8 = [5]int8{-121, 121, 3, 2, 1} + local_bool_false bool = false + local_bool_true bool = true + local_channel chan int16 = Z_channel + local_channel_buffered chan int16 = Z_channel_buffered + local_channel_nil chan int16 + local_complex128 complex128 = 1.987654321 - 2.987654321i + local_complex64 complex64 = 1.54321 + 2.54321i + local_float32 float32 = 1.54321 + local_float64 float64 = 1.987654321 + local_func_bar = (*FooStruct).Bar + local_func_int8_r_int8 = func(x int8) int8 { return x + 1 } + local_func_int8_r_pint8 = func(x int8) *int8 { y := x + 1; return &y } + local_func_nil func(x int8) int8 = nil + local_int int = -21 + local_int16 int16 = -32321 + local_int32 int32 = -1987654321 + local_int64 int64 = -9012345678987654321 + local_int8 int8 = -121 + local_int_typedef myInt = 88 + local_interface FooInterface = &Z_struct + local_interface_nil FooInterface + local_interface_typed_nil FooInterface = Z_pointer_nil + local_map map[int8]float32 = map[int8]float32{-21: 3.54321} + local_map_2 map[int16]int8 = map[int16]int8{1024: 1} + local_map_3 map[int16]int8 = map[int16]int8{1024: 1, 512: -1} + local_map_empty map[int8]float32 = map[int8]float32{} + local_map_nil map[int8]float32 + local_pointer *FooStruct = &Z_struct + local_pointer_nil *FooStruct + local_slice []byte = []byte{'s', 'l', 'i', 'c', 'e'} + local_slice_2 []int8 = Z_array[0:2] + local_slice_nil []byte + local_string string = "I'm a string" + local_struct FooStruct = FooStruct{a: 21, b: "hi"} + local_uint uint = 21 + local_uint16 uint16 = 54321 + local_uint32 uint32 = 3217654321 + local_uint64 uint64 = 12345678900987654321 + local_uint8 uint8 = 231 + local_uintptr uintptr = 21 + local_unsafe_pointer unsafe.Pointer = unsafe.Pointer(&Z_uint) + local_unsafe_pointer_nil unsafe.Pointer + ) + fmt.Println(Z_bool_false, Z_bool_true) + fmt.Println(Z_int, Z_int8, Z_int16, Z_int32, Z_int64, Z_int_typedef) + fmt.Println(Z_uint, Z_uint8, Z_uint16, Z_uint32, Z_uint64, Z_uintptr) + fmt.Println(Z_float32, Z_float64, Z_complex64, Z_complex128) + fmt.Println(Z_array, Z_array_empty, Z_array_of_empties) + fmt.Println(Z_channel, Z_channel_buffered, Z_channel_nil) + fmt.Println(Z_func_bar, Z_func_int8_r_int8, Z_func_int8_r_pint8, Z_func_nil) + fmt.Println(Z_interface, Z_interface_nil, Z_interface_typed_nil) + fmt.Println(Z_map, Z_map_2, Z_map_3, Z_map_empty, Z_map_nil) + fmt.Println(Z_pointer, Z_pointer_nil) + fmt.Println(Z_slice, Z_slice_2, Z_slice_nil) + fmt.Println(Z_string, Z_struct) + fmt.Println(Z_unsafe_pointer, Z_unsafe_pointer_nil) + fmt.Println(local_bool_false, local_bool_true) + fmt.Println(local_int, local_int8, local_int16, local_int32, local_int64, local_int_typedef) + fmt.Println(local_uint, local_uint8, local_uint16, local_uint32, local_uint64, local_uintptr) + fmt.Println(local_float32, local_float64, local_complex64, local_complex128, local_array) + fmt.Println(local_channel, local_channel_buffered, local_channel_nil) + fmt.Println(local_func_bar, local_func_int8_r_int8, local_func_int8_r_pint8, local_func_nil) + fmt.Println(local_interface, local_interface_nil, local_interface_typed_nil) + fmt.Println(local_map, local_map_2, local_map_3, local_map_empty, local_map_nil) + fmt.Println(local_pointer, local_pointer_nil) + fmt.Println(local_slice, local_slice_2, local_slice_nil) + fmt.Println(local_string, local_struct) + fmt.Println(local_unsafe_pointer, local_unsafe_pointer_nil) + f1() + f2() +} + +func f1() { + fmt.Println() +} + +func f2() { + fmt.Println() +} + +func bar() { + foo(42, 1.5) + fmt.Print() +} + +func populateChannels() { + go func() { + Z_channel_2 <- 8 + }() + go func() { + for i := int16(0); i < 14; i++ { + Z_channel_buffered <- i + } + }() + go func() { + for i := 0; i < 8; i++ { + <-Z_channel_buffered + } + }() + time.Sleep(time.Second / 20) +} + +func main() { + args := os.Args[1:] + expected := []string{"some", "arguments"} + if len(args) != 2 || args[0] != expected[0] || args[1] != expected[1] { + log.Fatalf("got command-line args %v, expected %v", args, expected) + } + populateChannels() + for ; ; time.Sleep(2 * time.Second) { + bar() + } + select {} +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/valuecollector/valuecollector.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/valuecollector/valuecollector.go new file mode 100644 index 000000000..5467df970 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/valuecollector/valuecollector.go @@ -0,0 +1,460 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package valuecollector is used to collect the values of variables in a program. +package valuecollector + +import ( + "bytes" + "fmt" + "strconv" + "strings" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + cd "google.golang.org/api/clouddebugger/v2" +) + +const ( + maxArrayLength = 50 + maxMapLength = 20 +) + +// Collector is given references to variables from a program being debugged +// using AddVariable. Then when ReadValues is called, the Collector will fetch +// the values of those variables. Any variables referred to by those values +// will also be fetched; e.g. the targets of pointers, members of structs, +// elements of slices, etc. This continues iteratively, building a graph of +// values, until all the reachable values are fetched, or a size limit is +// reached. +// +// Variables are passed to the Collector as debug.Var, which is used by x/debug +// to represent references to variables. Values are returned as cd.Variable, +// which is used by the Debuglet Controller to represent the graph of values. +// +// For example, if the program has a struct variable: +// +// foo := SomeStruct{a:42, b:"xyz"} +// +// and we call AddVariable with a reference to foo, we will get back a result +// like: +// +// cd.Variable{Name:"foo", VarTableIndex:10} +// +// which denotes a variable named "foo" which will have its value stored in +// element 10 of the table that will later be returned by ReadValues. That +// element might be: +// +// out[10] = &cd.Variable{Members:{{Name:"a", VarTableIndex:11},{Name:"b", VarTableIndex:12}}} +// +// which denotes a struct with two members a and b, whose values are in elements +// 11 and 12 of the output table: +// +// out[11] = &cd.Variable{Value:"42"} +// out[12] = &cd.Variable{Value:"xyz"} +type Collector struct { + // prog is the program being debugged. + prog debug.Program + // limit is the maximum size of the output slice of values. + limit int + // index is a map from references (variables and map elements) to their + // locations in the table. + index map[reference]int + // table contains the references, including those given to the + // Collector directly and those the Collector itself found. + // If VarTableIndex is set to 0 in a cd.Variable, it is ignored, so the first entry + // of table can't be used. On initialization we put a dummy value there. + table []reference +} + +// reference represents a value which is in the queue to be read by the +// collector. It is either a debug.Var, or a mapElement. +type reference interface{} + +// mapElement represents an element of a map in the debugged program's memory. +type mapElement struct { + debug.Map + index uint64 +} + +// NewCollector returns a Collector for the given program and size limit. +// The limit is the maximum size of the slice of values returned by ReadValues. +func NewCollector(prog debug.Program, limit int) *Collector { + return &Collector{ + prog: prog, + limit: limit, + index: make(map[reference]int), + table: []reference{debug.Var{}}, + } +} + +// AddVariable adds another variable to be collected. +// The Collector doesn't get the value immediately; it returns a cd.Variable +// that contains an index into the table which will later be returned by +// ReadValues. +func (c *Collector) AddVariable(lv debug.LocalVar) *cd.Variable { + ret := &cd.Variable{Name: lv.Name} + if index, ok := c.add(lv.Var); !ok { + // If the add call failed, it's because we reached the size limit. + // The Debuglet Controller's convention is to pass it a "Not Captured" error + // in this case. + ret.Status = statusMessage(messageNotCaptured, true, refersToVariableName) + } else { + ret.VarTableIndex = int64(index) + } + return ret +} + +// add adds a reference to the set of values to be read from the +// program. It returns the index in the output table that will contain the +// corresponding value. It fails if the table has reached the size limit. +// It deduplicates references, so the index may be the same as one that was +// returned from an earlier add call. +func (c *Collector) add(r reference) (outputIndex int, ok bool) { + if i, ok := c.index[r]; ok { + return i, true + } + i := len(c.table) + if i >= c.limit { + return 0, false + } + c.index[r] = i + c.table = append(c.table, r) + return i, true +} + +func addMember(v *cd.Variable, name string) *cd.Variable { + v2 := &cd.Variable{Name: name} + v.Members = append(v.Members, v2) + return v2 +} + +// ReadValues fetches values of the variables that were passed to the Collector +// with AddVariable. The values of any new variables found are also fetched, +// e.g. the targets of pointers or the members of structs, until we reach the +// size limit or we run out of values to fetch. +// The results are output as a []*cd.Variable, which is the type we need to send +// to the Debuglet Controller after we trigger a breakpoint. +func (c *Collector) ReadValues() (out []*cd.Variable) { + for i := 0; i < len(c.table); i++ { + // Create a new cd.Variable for this value, and append it to the output. + dcv := new(cd.Variable) + out = append(out, dcv) + if i == 0 { + // The first element is unused. + continue + } + switch x := c.table[i].(type) { + case mapElement: + key, value, err := c.prog.MapElement(x.Map, x.index) + if err != nil { + dcv.Status = statusMessage(err.Error(), true, refersToVariableValue) + continue + } + // Add a member for the key. + member := addMember(dcv, "key") + if index, ok := c.add(key); !ok { + // The table is full. + member.Status = statusMessage(messageNotCaptured, true, refersToVariableName) + continue + } else { + member.VarTableIndex = int64(index) + } + // Add a member for the value. + member = addMember(dcv, "value") + if index, ok := c.add(value); !ok { + // The table is full. + member.Status = statusMessage(messageNotCaptured, true, refersToVariableName) + } else { + member.VarTableIndex = int64(index) + } + case debug.Var: + if v, err := c.prog.Value(x); err != nil { + dcv.Status = statusMessage(err.Error(), true, refersToVariableValue) + } else { + c.FillValue(v, dcv) + } + } + } + return out +} + +// indexable is an interface for arrays, slices and channels. +type indexable interface { + Len() uint64 + Element(uint64) debug.Var +} + +// channel implements indexable. +type channel struct { + debug.Channel +} + +func (c channel) Len() uint64 { + return c.Length +} + +var ( + _ indexable = debug.Array{} + _ indexable = debug.Slice{} + _ indexable = channel{} +) + +// FillValue copies a value into a cd.Variable. Any variables referred to by +// that value, e.g. struct members and pointer targets, are added to the +// collector's queue, to be fetched later by ReadValues. +func (c *Collector) FillValue(v debug.Value, dcv *cd.Variable) { + if c, ok := v.(debug.Channel); ok { + // Convert to channel, which implements indexable. + v = channel{c} + } + // Fill in dcv in a manner depending on the type of the value we got. + switch val := v.(type) { + case int8, int16, int32, int64, bool, uint8, uint16, uint32, uint64, float32, float64, complex64, complex128: + // For simple types, we just print the value to dcv.Value. + dcv.Value = fmt.Sprint(val) + case string: + // Put double quotes around strings. + dcv.Value = strconv.Quote(val) + case debug.String: + if uint64(len(val.String)) < val.Length { + // This string value was truncated. + dcv.Value = strconv.Quote(val.String + "...") + } else { + dcv.Value = strconv.Quote(val.String) + } + case debug.Struct: + // For structs, we add an entry to dcv.Members for each field in the + // struct. + // Each member will contain the name of the field, and the index in the + // output table which will contain the value of that field. + for _, f := range val.Fields { + member := addMember(dcv, f.Name) + if index, ok := c.add(f.Var); !ok { + // The table is full. + member.Status = statusMessage(messageNotCaptured, true, refersToVariableName) + } else { + member.VarTableIndex = int64(index) + } + } + case debug.Map: + dcv.Value = fmt.Sprintf("len = %d", val.Length) + for i := uint64(0); i < val.Length; i++ { + field := addMember(dcv, `⚫`) + if i == maxMapLength { + field.Name = "..." + field.Status = statusMessage(messageTruncated, true, refersToVariableName) + break + } + if index, ok := c.add(mapElement{val, i}); !ok { + // The value table is full; add a member to contain the error message. + field.Name = "..." + field.Status = statusMessage(messageNotCaptured, true, refersToVariableName) + break + } else { + field.VarTableIndex = int64(index) + } + } + case debug.Pointer: + if val.Address == 0 { + dcv.Value = "" + } else if val.TypeID == 0 { + // We don't know the type of the pointer, so just output the address as + // the value. + dcv.Value = fmt.Sprintf("0x%X", val.Address) + dcv.Status = statusMessage(messageUnknownPointerType, false, refersToVariableName) + } else { + // Adds the pointed-to variable to the table, and links this value to + // that table entry through VarTableIndex. + dcv.Value = fmt.Sprintf("0x%X", val.Address) + target := addMember(dcv, "") + if index, ok := c.add(debug.Var(val)); !ok { + target.Status = statusMessage(messageNotCaptured, true, refersToVariableName) + } else { + target.VarTableIndex = int64(index) + } + } + case indexable: + // Arrays, slices and channels. + dcv.Value = "len = " + fmt.Sprint(val.Len()) + for j := uint64(0); j < val.Len(); j++ { + field := addMember(dcv, fmt.Sprint(`[`, j, `]`)) + if j == maxArrayLength { + field.Name = "..." + field.Status = statusMessage(messageTruncated, true, refersToVariableName) + break + } + vr := val.Element(j) + if index, ok := c.add(vr); !ok { + // The value table is full; add a member to contain the error message. + field.Name = "..." + field.Status = statusMessage(messageNotCaptured, true, refersToVariableName) + break + } else { + // Add a member with the index as the name. + field.VarTableIndex = int64(index) + } + } + default: + dcv.Status = statusMessage(messageUnknownType, false, refersToVariableName) + } +} + +// statusMessage returns a *cd.StatusMessage with the given message, IsError +// field and refersTo field. +func statusMessage(msg string, isError bool, refersTo int) *cd.StatusMessage { + return &cd.StatusMessage{ + Description: &cd.FormatMessage{Format: "$0", Parameters: []string{msg}}, + IsError: isError, + RefersTo: refersToString[refersTo], + } +} + +// LogString produces a string for a logpoint, substituting in variable values +// using evaluatedExpressions and varTable. +func LogString(s string, evaluatedExpressions []*cd.Variable, varTable []*cd.Variable) string { + var buf bytes.Buffer + fmt.Fprintf(&buf, "LOGPOINT: ") + seen := make(map[*cd.Variable]bool) + for i := 0; i < len(s); { + if s[i] == '$' { + i++ + if num, n, ok := parseToken(s[i:], len(evaluatedExpressions)-1); ok { + // This token is one of $0, $1, etc. Write the corresponding expression. + writeExpression(&buf, evaluatedExpressions[num], false, varTable, seen) + i += n + } else { + // Something else, like $$. + buf.WriteByte(s[i]) + i++ + } + } else { + buf.WriteByte(s[i]) + i++ + } + } + return buf.String() +} + +func parseToken(s string, max int) (num int, bytesRead int, ok bool) { + var i int + for i < len(s) && s[i] >= '0' && s[i] <= '9' { + i++ + } + num, err := strconv.Atoi(s[:i]) + return num, i, err == nil && num <= max +} + +// writeExpression recursively writes variables to buf, in a format suitable +// for logging. If printName is true, writes the name of the variable. +func writeExpression(buf *bytes.Buffer, v *cd.Variable, printName bool, varTable []*cd.Variable, seen map[*cd.Variable]bool) { + if v == nil { + // Shouldn't happen. + return + } + name, value, status, members := v.Name, v.Value, v.Status, v.Members + + // If v.VarTableIndex is not zero, it refers to an element of varTable. + // We merge its fields with the fields we got from v. + var other *cd.Variable + if idx := int(v.VarTableIndex); idx > 0 && idx < len(varTable) { + other = varTable[idx] + } + if other != nil { + if name == "" { + name = other.Name + } + if value == "" { + value = other.Value + } + if status == nil { + status = other.Status + } + if len(members) == 0 { + members = other.Members + } + } + if printName && name != "" { + buf.WriteString(name) + buf.WriteByte(':') + } + + // If we have seen this value before, write "..." rather than repeating it. + if seen[v] { + buf.WriteString("...") + return + } + seen[v] = true + if other != nil { + if seen[other] { + buf.WriteString("...") + return + } + seen[other] = true + } + + if value != "" && !strings.HasPrefix(value, "len = ") { + // A plain value. + buf.WriteString(value) + } else if status != nil && status.Description != nil { + // An error. + for _, p := range status.Description.Parameters { + buf.WriteByte('(') + buf.WriteString(p) + buf.WriteByte(')') + } + } else if name == `⚫` { + // A map element. + first := true + for _, member := range members { + if first { + first = false + } else { + buf.WriteByte(':') + } + writeExpression(buf, member, false, varTable, seen) + } + } else { + // A map, array, slice, channel, or struct. + isStruct := value == "" + first := true + buf.WriteByte('{') + for _, member := range members { + if first { + first = false + } else { + buf.WriteString(", ") + } + writeExpression(buf, member, isStruct, varTable, seen) + } + buf.WriteByte('}') + } +} + +const ( + // Error messages for cd.StatusMessage + messageNotCaptured = "Not captured" + messageTruncated = "Truncated" + messageUnknownPointerType = "Unknown pointer type" + messageUnknownType = "Unknown type" + // RefersTo values for cd.StatusMessage. + refersToVariableName = iota + refersToVariableValue +) + +// refersToString contains the strings for each refersTo value. +// See the definition of StatusMessage in the v2/clouddebugger package. +var refersToString = map[int]string{ + refersToVariableName: "VARIABLE_NAME", + refersToVariableValue: "VARIABLE_VALUE", +} diff --git a/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/valuecollector/valuecollector_test.go b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/valuecollector/valuecollector_test.go new file mode 100644 index 000000000..30da2cc31 --- /dev/null +++ b/vendor/cloud.google.com/go/cmd/go-cloud-debug-agent/internal/valuecollector/valuecollector_test.go @@ -0,0 +1,418 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package valuecollector + +import ( + "fmt" + "testing" + + "cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug" + "cloud.google.com/go/internal/testutil" + cd "google.golang.org/api/clouddebugger/v2" +) + +const ( + // Some arbitrary type IDs for the test, for use in debug.Var's TypeID field. + // A TypeID of 0 means the type is unknown, so we start at 1. + int16Type = iota + 1 + stringType + structType + pointerType + arrayType + int32Type + debugStringType + mapType + channelType + sliceType +) + +func TestValueCollector(t *testing.T) { + // Construct the collector. + c := NewCollector(&Program{}, 26) + // Add some variables of various types, whose values we want the collector to read. + variablesToAdd := []debug.LocalVar{ + {Name: "a", Var: debug.Var{TypeID: int16Type, Address: 0x1}}, + {Name: "b", Var: debug.Var{TypeID: stringType, Address: 0x2}}, + {Name: "c", Var: debug.Var{TypeID: structType, Address: 0x3}}, + {Name: "d", Var: debug.Var{TypeID: pointerType, Address: 0x4}}, + {Name: "e", Var: debug.Var{TypeID: arrayType, Address: 0x5}}, + {Name: "f", Var: debug.Var{TypeID: debugStringType, Address: 0x6}}, + {Name: "g", Var: debug.Var{TypeID: mapType, Address: 0x7}}, + {Name: "h", Var: debug.Var{TypeID: channelType, Address: 0x8}}, + {Name: "i", Var: debug.Var{TypeID: sliceType, Address: 0x9}}, + } + expectedResults := []*cd.Variable{ + {Name: "a", VarTableIndex: 1}, + {Name: "b", VarTableIndex: 2}, + {Name: "c", VarTableIndex: 3}, + {Name: "d", VarTableIndex: 4}, + {Name: "e", VarTableIndex: 5}, + {Name: "f", VarTableIndex: 6}, + {Name: "g", VarTableIndex: 7}, + {Name: "h", VarTableIndex: 8}, + {Name: "i", VarTableIndex: 9}, + } + for i, v := range variablesToAdd { + added := c.AddVariable(v) + if !testutil.Equal(added, expectedResults[i]) { + t.Errorf("AddVariable: got %+v want %+v", *added, *expectedResults[i]) + } + } + // Read the values, compare the output to what we expect. + v := c.ReadValues() + expectedValues := []*cd.Variable{ + {}, + {Value: "1"}, + {Value: `"hello"`}, + { + Members: []*cd.Variable{ + {Name: "x", VarTableIndex: 1}, + {Name: "y", VarTableIndex: 2}, + }, + }, + { + Members: []*cd.Variable{ + {VarTableIndex: 1}, + }, + Value: "0x1", + }, + { + Members: []*cd.Variable{ + {Name: "[0]", VarTableIndex: 10}, + {Name: "[1]", VarTableIndex: 11}, + {Name: "[2]", VarTableIndex: 12}, + {Name: "[3]", VarTableIndex: 13}, + }, + Value: "len = 4", + }, + {Value: `"world"`}, + { + Members: []*cd.Variable{ + {Name: "⚫", VarTableIndex: 14}, + {Name: "⚫", VarTableIndex: 15}, + {Name: "⚫", VarTableIndex: 16}, + }, + Value: "len = 3", + }, + { + Members: []*cd.Variable{ + {Name: "[0]", VarTableIndex: 17}, + {Name: "[1]", VarTableIndex: 18}, + }, + Value: "len = 2", + }, + { + Members: []*cd.Variable{ + {Name: "[0]", VarTableIndex: 19}, + {Name: "[1]", VarTableIndex: 20}, + }, + Value: "len = 2", + }, + {Value: "100"}, + {Value: "104"}, + {Value: "108"}, + {Value: "112"}, + { + Members: []*cd.Variable{ + {Name: "key", VarTableIndex: 21}, + {Name: "value", VarTableIndex: 22}, + }, + }, + { + Members: []*cd.Variable{ + {Name: "key", VarTableIndex: 23}, + {Name: "value", VarTableIndex: 24}, + }, + }, + { + Members: []*cd.Variable{ + {Name: "key", VarTableIndex: 25}, + { + Name: "value", + Status: &cd.StatusMessage{ + Description: &cd.FormatMessage{ + Format: "$0", + Parameters: []string{"Not captured"}, + }, + IsError: true, + RefersTo: "VARIABLE_NAME", + }, + }, + }, + }, + {Value: "246"}, + {Value: "210"}, + {Value: "300"}, + {Value: "304"}, + {Value: "400"}, + {Value: "404"}, + {Value: "1400"}, + {Value: "1404"}, + {Value: "2400"}, + } + if !testutil.Equal(v, expectedValues) { + t.Errorf("ReadValues: got %v want %v", v, expectedValues) + // Do element-by-element comparisons, for more useful error messages. + for i := range v { + if i < len(expectedValues) && !testutil.Equal(v[i], expectedValues[i]) { + t.Errorf("element %d: got %+v want %+v", i, *v[i], *expectedValues[i]) + } + } + } +} + +// Program implements the similarly-named interface in x/debug. +// ValueCollector should only call its Value and MapElement methods. +type Program struct { + debug.Program +} + +func (p *Program) Value(v debug.Var) (debug.Value, error) { + // We determine what to return using v.TypeID. + switch v.TypeID { + case int16Type: + // We use the address as the value, so that we're testing whether the right + // address was calculated. + return int16(v.Address), nil + case stringType: + // A string. + return "hello", nil + case structType: + // A struct with two elements. + return debug.Struct{ + Fields: []debug.StructField{ + { + Name: "x", + Var: debug.Var{TypeID: int16Type, Address: 0x1}, + }, + { + Name: "y", + Var: debug.Var{TypeID: stringType, Address: 0x2}, + }, + }, + }, nil + case pointerType: + // A pointer to the first variable above. + return debug.Pointer{TypeID: int16Type, Address: 0x1}, nil + case arrayType: + // An array of 4 32-bit-wide elements. + return debug.Array{ + ElementTypeID: int32Type, + Address: 0x64, + Length: 4, + StrideBits: 32, + }, nil + case debugStringType: + return debug.String{ + Length: 5, + String: "world", + }, nil + case mapType: + return debug.Map{ + TypeID: 99, + Address: 0x100, + Length: 3, + }, nil + case channelType: + return debug.Channel{ + ElementTypeID: int32Type, + Address: 200, + Buffer: 210, + Length: 2, + Capacity: 10, + Stride: 4, + BufferStart: 9, + }, nil + case sliceType: + // A slice of 2 32-bit-wide elements. + return debug.Slice{ + Array: debug.Array{ + ElementTypeID: int32Type, + Address: 300, + Length: 2, + StrideBits: 32, + }, + Capacity: 50, + }, nil + case int32Type: + // We use the address as the value, so that we're testing whether the right + // address was calculated. + return int32(v.Address), nil + } + return nil, fmt.Errorf("unexpected Value request") +} + +func (p *Program) MapElement(m debug.Map, index uint64) (debug.Var, debug.Var, error) { + return debug.Var{TypeID: int16Type, Address: 1000*index + 400}, + debug.Var{TypeID: int32Type, Address: 1000*index + 404}, + nil +} + +func TestLogString(t *testing.T) { + bp := cd.Breakpoint{ + Action: "LOG", + LogMessageFormat: "$0 hello, $$7world! $1 $2 $3 $4 $5$6 $7 $8", + EvaluatedExpressions: []*cd.Variable{ + {Name: "a", VarTableIndex: 1}, + {Name: "b", VarTableIndex: 2}, + {Name: "c", VarTableIndex: 3}, + {Name: "d", VarTableIndex: 4}, + {Name: "e", VarTableIndex: 5}, + {Name: "f", VarTableIndex: 6}, + {Name: "g", VarTableIndex: 7}, + {Name: "h", VarTableIndex: 8}, + {Name: "i", VarTableIndex: 9}, + }, + } + varTable := []*cd.Variable{ + {}, + {Value: "1"}, + {Value: `"hello"`}, + { + Members: []*cd.Variable{ + {Name: "x", Value: "1"}, + {Name: "y", Value: `"hello"`}, + {Name: "z", VarTableIndex: 3}, + }, + }, + { + Members: []*cd.Variable{ + {VarTableIndex: 1}, + }, + Value: "0x1", + }, + { + Members: []*cd.Variable{ + {Name: "[0]", VarTableIndex: 10}, + {Name: "[1]", VarTableIndex: 11}, + {Name: "[2]", VarTableIndex: 12}, + {Name: "[3]", VarTableIndex: 13}, + }, + Value: "len = 4", + }, + {Value: `"world"`}, + { + Members: []*cd.Variable{ + {Name: "⚫", VarTableIndex: 14}, + {Name: "⚫", VarTableIndex: 15}, + {Name: "⚫", VarTableIndex: 16}, + }, + Value: "len = 3", + }, + { + Members: []*cd.Variable{ + {Name: "[0]", VarTableIndex: 17}, + {Name: "[1]", VarTableIndex: 18}, + }, + Value: "len = 2", + }, + { + Members: []*cd.Variable{ + {Name: "[0]", VarTableIndex: 19}, + {Name: "[1]", VarTableIndex: 20}, + }, + Value: "len = 2", + }, + {Value: "100"}, + {Value: "104"}, + {Value: "108"}, + {Value: "112"}, + { + Members: []*cd.Variable{ + {Name: "key", VarTableIndex: 21}, + {Name: "value", VarTableIndex: 22}, + }, + }, + { + Members: []*cd.Variable{ + {Name: "key", VarTableIndex: 23}, + {Name: "value", VarTableIndex: 24}, + }, + }, + { + Members: []*cd.Variable{ + {Name: "key", VarTableIndex: 25}, + { + Name: "value", + Status: &cd.StatusMessage{ + Description: &cd.FormatMessage{ + Format: "$0", + Parameters: []string{"Not captured"}, + }, + IsError: true, + RefersTo: "VARIABLE_NAME", + }, + }, + }, + }, + {Value: "246"}, + {Value: "210"}, + {Value: "300"}, + {Value: "304"}, + {Value: "400"}, + {Value: "404"}, + {Value: "1400"}, + {Value: "1404"}, + {Value: "2400"}, + } + s := LogString(bp.LogMessageFormat, bp.EvaluatedExpressions, varTable) + expected := `LOGPOINT: 1 hello, $7world! "hello" {x:1, y:"hello", z:...} ` + + `0x1 {100, 104, 108, 112} "world"{400:404, 1400:1404, 2400:(Not captured)} ` + + `{246, 210} {300, 304}` + if s != expected { + t.Errorf("LogString: got %q want %q", s, expected) + } +} + +func TestParseToken(t *testing.T) { + for _, c := range []struct { + s string + max int + num int + n int + ok bool + }{ + {"", 0, 0, 0, false}, + {".", 0, 0, 0, false}, + {"0", 0, 0, 1, true}, + {"0", 1, 0, 1, true}, + {"00", 0, 0, 2, true}, + {"1.", 1, 1, 1, true}, + {"1.", 0, 0, 0, false}, + {"10", 10, 10, 2, true}, + {"10..", 10, 10, 2, true}, + {"10", 11, 10, 2, true}, + {"10..", 11, 10, 2, true}, + {"10", 9, 0, 0, false}, + {"10..", 9, 0, 0, false}, + {" 10", 10, 0, 0, false}, + {"010", 10, 10, 3, true}, + {"123456789", 123456789, 123456789, 9, true}, + {"123456789", 123456788, 0, 0, false}, + {"123456789123456789123456789", 999999999, 0, 0, false}, + } { + num, n, ok := parseToken(c.s, c.max) + if ok != c.ok { + t.Errorf("parseToken(%q, %d): got ok=%t want ok=%t", c.s, c.max, ok, c.ok) + continue + } + if !ok { + continue + } + if num != c.num || n != c.n { + t.Errorf("parseToken(%q, %d): got %d,%d,%t want %d,%d,%t", c.s, c.max, num, n, ok, c.num, c.n, c.ok) + } + } +} diff --git a/vendor/cloud.google.com/go/compute/metadata/examples_test.go b/vendor/cloud.google.com/go/compute/metadata/examples_test.go new file mode 100644 index 000000000..6c546a63c --- /dev/null +++ b/vendor/cloud.google.com/go/compute/metadata/examples_test.go @@ -0,0 +1,46 @@ +// 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. + +package metadata_test + +import ( + "net/http" + + "cloud.google.com/go/compute/metadata" +) + +// This example demonstrates how to use your own transport when using this package. +func ExampleNewClient() { + c := metadata.NewClient(&http.Client{Transport: userAgentTransport{ + userAgent: "my-user-agent", + base: http.DefaultTransport, + }}) + p, err := c.ProjectID() + if err != nil { + // TODO: Handle error. + } + _ = p // TODO: Use p. +} + +// userAgentTransport sets the User-Agent header before calling base. +type userAgentTransport struct { + userAgent string + base http.RoundTripper +} + +// RoundTrip implements the http.RoundTripper interface. +func (t userAgentTransport) RoundTrip(req *http.Request) (*http.Response, error) { + req.Header.Set("User-Agent", t.userAgent) + return t.base.RoundTrip(req) +} diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata.go b/vendor/cloud.google.com/go/compute/metadata/metadata.go new file mode 100644 index 000000000..0d929a619 --- /dev/null +++ b/vendor/cloud.google.com/go/compute/metadata/metadata.go @@ -0,0 +1,501 @@ +// 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 metadata provides access to Google Compute Engine (GCE) +// metadata and API service accounts. +// +// This package is a wrapper around the GCE metadata service, +// as documented at https://developers.google.com/compute/docs/metadata. +package metadata // import "cloud.google.com/go/compute/metadata" + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net" + "net/http" + "net/url" + "os" + "runtime" + "strings" + "sync" + "time" +) + +const ( + // metadataIP is the documented metadata server IP address. + metadataIP = "169.254.169.254" + + // metadataHostEnv is the environment variable specifying the + // GCE metadata hostname. If empty, the default value of + // metadataIP ("169.254.169.254") is used instead. + // This is variable name is not defined by any spec, as far as + // I know; it was made up for the Go package. + metadataHostEnv = "GCE_METADATA_HOST" + + userAgent = "gcloud-golang/0.1" +) + +type cachedValue struct { + k string + trim bool + mu sync.Mutex + v string +} + +var ( + projID = &cachedValue{k: "project/project-id", trim: true} + projNum = &cachedValue{k: "project/numeric-project-id", trim: true} + instID = &cachedValue{k: "instance/id", trim: true} +) + +var ( + defaultClient = &Client{hc: &http.Client{ + Transport: &http.Transport{ + Dial: (&net.Dialer{ + Timeout: 2 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + ResponseHeaderTimeout: 2 * time.Second, + }, + }} + subscribeClient = &Client{hc: &http.Client{ + Transport: &http.Transport{ + Dial: (&net.Dialer{ + Timeout: 2 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + }, + }} +) + +// NotDefinedError is returned when requested metadata is not defined. +// +// The underlying string is the suffix after "/computeMetadata/v1/". +// +// This error is not returned if the value is defined to be the empty +// string. +type NotDefinedError string + +func (suffix NotDefinedError) Error() string { + return fmt.Sprintf("metadata: GCE metadata %q not defined", string(suffix)) +} + +func (c *cachedValue) get(cl *Client) (v string, err error) { + defer c.mu.Unlock() + c.mu.Lock() + if c.v != "" { + return c.v, nil + } + if c.trim { + v, err = cl.getTrimmed(c.k) + } else { + v, err = cl.Get(c.k) + } + if err == nil { + c.v = v + } + return +} + +var ( + onGCEOnce sync.Once + onGCE bool +) + +// OnGCE reports whether this process is running on Google Compute Engine. +func OnGCE() bool { + onGCEOnce.Do(initOnGCE) + return onGCE +} + +func initOnGCE() { + onGCE = testOnGCE() +} + +func testOnGCE() bool { + // The user explicitly said they're on GCE, so trust them. + if os.Getenv(metadataHostEnv) != "" { + return true + } + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + resc := make(chan bool, 2) + + // Try two strategies in parallel. + // See https://github.com/GoogleCloudPlatform/google-cloud-go/issues/194 + go func() { + req, _ := http.NewRequest("GET", "http://"+metadataIP, nil) + req.Header.Set("User-Agent", userAgent) + res, err := defaultClient.hc.Do(req.WithContext(ctx)) + if err != nil { + resc <- false + return + } + defer res.Body.Close() + resc <- res.Header.Get("Metadata-Flavor") == "Google" + }() + + go func() { + addrs, err := net.LookupHost("metadata.google.internal") + if err != nil || len(addrs) == 0 { + resc <- false + return + } + resc <- strsContains(addrs, metadataIP) + }() + + tryHarder := systemInfoSuggestsGCE() + if tryHarder { + res := <-resc + if res { + // The first strategy succeeded, so let's use it. + return true + } + // Wait for either the DNS or metadata server probe to + // contradict the other one and say we are running on + // GCE. Give it a lot of time to do so, since the system + // info already suggests we're running on a GCE BIOS. + timer := time.NewTimer(5 * time.Second) + defer timer.Stop() + select { + case res = <-resc: + return res + case <-timer.C: + // Too slow. Who knows what this system is. + return false + } + } + + // There's no hint from the system info that we're running on + // GCE, so use the first probe's result as truth, whether it's + // true or false. The goal here is to optimize for speed for + // users who are NOT running on GCE. We can't assume that + // either a DNS lookup or an HTTP request to a blackholed IP + // address is fast. Worst case this should return when the + // metaClient's Transport.ResponseHeaderTimeout or + // Transport.Dial.Timeout fires (in two seconds). + return <-resc +} + +// systemInfoSuggestsGCE reports whether the local system (without +// doing network requests) suggests that we're running on GCE. If this +// returns true, testOnGCE tries a bit harder to reach its metadata +// server. +func systemInfoSuggestsGCE() bool { + if runtime.GOOS != "linux" { + // We don't have any non-Linux clues available, at least yet. + return false + } + slurp, _ := ioutil.ReadFile("/sys/class/dmi/id/product_name") + name := strings.TrimSpace(string(slurp)) + return name == "Google" || name == "Google Compute Engine" +} + +// Subscribe calls Client.Subscribe on a client designed for subscribing (one with no +// ResponseHeaderTimeout). +func Subscribe(suffix string, fn func(v string, ok bool) error) error { + return subscribeClient.Subscribe(suffix, fn) +} + +// Get calls Client.Get on the default client. +func Get(suffix string) (string, error) { return defaultClient.Get(suffix) } + +// ProjectID returns the current instance's project ID string. +func ProjectID() (string, error) { return defaultClient.ProjectID() } + +// NumericProjectID returns the current instance's numeric project ID. +func NumericProjectID() (string, error) { return defaultClient.NumericProjectID() } + +// InternalIP returns the instance's primary internal IP address. +func InternalIP() (string, error) { return defaultClient.InternalIP() } + +// ExternalIP returns the instance's primary external (public) IP address. +func ExternalIP() (string, error) { return defaultClient.ExternalIP() } + +// Hostname returns the instance's hostname. This will be of the form +// ".c..internal". +func Hostname() (string, error) { return defaultClient.Hostname() } + +// InstanceTags returns the list of user-defined instance tags, +// assigned when initially creating a GCE instance. +func InstanceTags() ([]string, error) { return defaultClient.InstanceTags() } + +// InstanceID returns the current VM's numeric instance ID. +func InstanceID() (string, error) { return defaultClient.InstanceID() } + +// InstanceName returns the current VM's instance ID string. +func InstanceName() (string, error) { return defaultClient.InstanceName() } + +// Zone returns the current VM's zone, such as "us-central1-b". +func Zone() (string, error) { return defaultClient.Zone() } + +// InstanceAttributes calls Client.InstanceAttributes on the default client. +func InstanceAttributes() ([]string, error) { return defaultClient.InstanceAttributes() } + +// ProjectAttributes calls Client.ProjectAttributes on the default client. +func ProjectAttributes() ([]string, error) { return defaultClient.ProjectAttributes() } + +// InstanceAttributeValue calls Client.InstanceAttributeValue on the default client. +func InstanceAttributeValue(attr string) (string, error) { + return defaultClient.InstanceAttributeValue(attr) +} + +// ProjectAttributeValue calls Client.ProjectAttributeValue on the default client. +func ProjectAttributeValue(attr string) (string, error) { + return defaultClient.ProjectAttributeValue(attr) +} + +// Scopes calls Client.Scopes on the default client. +func Scopes(serviceAccount string) ([]string, error) { return defaultClient.Scopes(serviceAccount) } + +func strsContains(ss []string, s string) bool { + for _, v := range ss { + if v == s { + return true + } + } + return false +} + +// A Client provides metadata. +type Client struct { + hc *http.Client +} + +// NewClient returns a Client that can be used to fetch metadata. All HTTP requests +// will use the given http.Client instead of the default client. +func NewClient(c *http.Client) *Client { + return &Client{hc: c} +} + +// getETag returns a value from the metadata service as well as the associated ETag. +// This func is otherwise equivalent to Get. +func (c *Client) getETag(suffix string) (value, etag string, err error) { + // Using a fixed IP makes it very difficult to spoof the metadata service in + // a container, which is an important use-case for local testing of cloud + // deployments. To enable spoofing of the metadata service, the environment + // variable GCE_METADATA_HOST is first inspected to decide where metadata + // requests shall go. + host := os.Getenv(metadataHostEnv) + if host == "" { + // Using 169.254.169.254 instead of "metadata" here because Go + // binaries built with the "netgo" tag and without cgo won't + // know the search suffix for "metadata" is + // ".google.internal", and this IP address is documented as + // being stable anyway. + host = metadataIP + } + url := "http://" + host + "/computeMetadata/v1/" + suffix + req, _ := http.NewRequest("GET", url, nil) + req.Header.Set("Metadata-Flavor", "Google") + req.Header.Set("User-Agent", userAgent) + res, err := c.hc.Do(req) + if err != nil { + return "", "", err + } + defer res.Body.Close() + if res.StatusCode == http.StatusNotFound { + return "", "", NotDefinedError(suffix) + } + if res.StatusCode != 200 { + return "", "", fmt.Errorf("status code %d trying to fetch %s", res.StatusCode, url) + } + all, err := ioutil.ReadAll(res.Body) + if err != nil { + return "", "", err + } + return string(all), res.Header.Get("Etag"), nil +} + +// Get returns a value from the metadata service. +// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/". +// +// If the GCE_METADATA_HOST environment variable is not defined, a default of +// 169.254.169.254 will be used instead. +// +// If the requested metadata is not defined, the returned error will +// be of type NotDefinedError. +func (c *Client) Get(suffix string) (string, error) { + val, _, err := c.getETag(suffix) + return val, err +} + +func (c *Client) getTrimmed(suffix string) (s string, err error) { + s, err = c.Get(suffix) + s = strings.TrimSpace(s) + return +} + +func (c *Client) lines(suffix string) ([]string, error) { + j, err := c.Get(suffix) + if err != nil { + return nil, err + } + s := strings.Split(strings.TrimSpace(j), "\n") + for i := range s { + s[i] = strings.TrimSpace(s[i]) + } + return s, nil +} + +// ProjectID returns the current instance's project ID string. +func (c *Client) ProjectID() (string, error) { return projID.get(c) } + +// NumericProjectID returns the current instance's numeric project ID. +func (c *Client) NumericProjectID() (string, error) { return projNum.get(c) } + +// InstanceID returns the current VM's numeric instance ID. +func (c *Client) InstanceID() (string, error) { return instID.get(c) } + +// InternalIP returns the instance's primary internal IP address. +func (c *Client) InternalIP() (string, error) { + return c.getTrimmed("instance/network-interfaces/0/ip") +} + +// 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") +} + +// Hostname returns the instance's hostname. This will be of the form +// ".c..internal". +func (c *Client) Hostname() (string, error) { + return c.getTrimmed("instance/hostname") +} + +// InstanceTags returns the list of user-defined instance tags, +// assigned when initially creating a GCE instance. +func (c *Client) InstanceTags() ([]string, error) { + var s []string + j, err := c.Get("instance/tags") + if err != nil { + return nil, err + } + if err := json.NewDecoder(strings.NewReader(j)).Decode(&s); err != nil { + return nil, err + } + return s, nil +} + +// InstanceName returns the current VM's instance ID string. +func (c *Client) InstanceName() (string, error) { + host, err := c.Hostname() + if err != nil { + return "", err + } + return strings.Split(host, ".")[0], nil +} + +// Zone returns the current VM's zone, such as "us-central1-b". +func (c *Client) Zone() (string, error) { + zone, err := c.getTrimmed("instance/zone") + // zone is of the form "projects//zones/". + if err != nil { + return "", err + } + return zone[strings.LastIndex(zone, "/")+1:], nil +} + +// InstanceAttributes returns the list of user-defined attributes, +// assigned when initially creating a GCE VM instance. The value of an +// attribute can be obtained with InstanceAttributeValue. +func (c *Client) InstanceAttributes() ([]string, error) { return c.lines("instance/attributes/") } + +// ProjectAttributes returns the list of user-defined attributes +// applying to the project as a whole, not just this VM. The value of +// an attribute can be obtained with ProjectAttributeValue. +func (c *Client) ProjectAttributes() ([]string, error) { return c.lines("project/attributes/") } + +// InstanceAttributeValue returns the value of the provided VM +// instance attribute. +// +// If the requested attribute is not defined, the returned error will +// be of type NotDefinedError. +// +// InstanceAttributeValue may return ("", nil) if the attribute was +// defined to be the empty string. +func (c *Client) InstanceAttributeValue(attr string) (string, error) { + return c.Get("instance/attributes/" + attr) +} + +// ProjectAttributeValue returns the value of the provided +// project attribute. +// +// If the requested attribute is not defined, the returned error will +// be of type NotDefinedError. +// +// ProjectAttributeValue may return ("", nil) if the attribute was +// defined to be the empty string. +func (c *Client) ProjectAttributeValue(attr string) (string, error) { + return c.Get("project/attributes/" + attr) +} + +// Scopes returns the service account scopes for the given account. +// The account may be empty or the string "default" to use the instance's +// main account. +func (c *Client) Scopes(serviceAccount string) ([]string, error) { + if serviceAccount == "" { + serviceAccount = "default" + } + return c.lines("instance/service-accounts/" + serviceAccount + "/scopes") +} + +// Subscribe subscribes to a value from the metadata service. +// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/". +// The suffix may contain query parameters. +// +// Subscribe calls fn with the latest metadata value indicated by the provided +// suffix. If the metadata value is deleted, fn is called with the empty string +// and ok false. Subscribe blocks until fn returns a non-nil error or the value +// is deleted. Subscribe returns the error value returned from the last call to +// fn, which may be nil when ok == false. +func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) error { + const failedSubscribeSleep = time.Second * 5 + + // First check to see if the metadata value exists at all. + val, lastETag, err := c.getETag(suffix) + if err != nil { + return err + } + + if err := fn(val, true); err != nil { + return err + } + + ok := true + if strings.ContainsRune(suffix, '?') { + suffix += "&wait_for_change=true&last_etag=" + } else { + suffix += "?wait_for_change=true&last_etag=" + } + for { + val, etag, err := c.getETag(suffix + url.QueryEscape(lastETag)) + if err != nil { + if _, deleted := err.(NotDefinedError); !deleted { + time.Sleep(failedSubscribeSleep) + continue // Retry on other errors. + } + ok = false + } + lastETag = etag + + if err := fn(val, ok); err != nil || !ok { + return err + } + } +} diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata_test.go b/vendor/cloud.google.com/go/compute/metadata/metadata_test.go new file mode 100644 index 000000000..83142b26b --- /dev/null +++ b/vendor/cloud.google.com/go/compute/metadata/metadata_test.go @@ -0,0 +1,80 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metadata + +import ( + "bytes" + "io/ioutil" + "net/http" + "os" + "sync" + "testing" +) + +func TestOnGCE_Stress(t *testing.T) { + if testing.Short() { + t.Skip("skipping in -short mode") + } + var last bool + for i := 0; i < 100; i++ { + onGCEOnce = sync.Once{} + + now := OnGCE() + if i > 0 && now != last { + t.Errorf("%d. changed from %v to %v", i, last, now) + } + last = now + } + t.Logf("OnGCE() = %v", last) +} + +func TestOnGCE_Force(t *testing.T) { + onGCEOnce = sync.Once{} + old := os.Getenv(metadataHostEnv) + defer os.Setenv(metadataHostEnv, old) + os.Setenv(metadataHostEnv, "127.0.0.1") + if !OnGCE() { + t.Error("OnGCE() = false; want true") + } +} + +func TestOverrideUserAgent(t *testing.T) { + const userAgent = "my-user-agent" + rt := &rrt{} + c := NewClient(&http.Client{Transport: userAgentTransport{userAgent, rt}}) + c.Get("foo") + if got, want := rt.gotUserAgent, userAgent; got != want { + t.Errorf("got %q, want %q", got, want) + } +} + +type userAgentTransport struct { + userAgent string + base http.RoundTripper +} + +func (t userAgentTransport) RoundTrip(req *http.Request) (*http.Response, error) { + req.Header.Set("User-Agent", t.userAgent) + return t.base.RoundTrip(req) +} + +type rrt struct { + gotUserAgent string +} + +func (r *rrt) RoundTrip(req *http.Request) (*http.Response, error) { + r.gotUserAgent = req.Header.Get("User-Agent") + return &http.Response{Body: ioutil.NopCloser(bytes.NewReader(nil))}, nil +} diff --git a/vendor/cloud.google.com/go/container/apiv1/ListClusters_smoke_test.go b/vendor/cloud.google.com/go/container/apiv1/ListClusters_smoke_test.go new file mode 100644 index 000000000..7d55b2f5d --- /dev/null +++ b/vendor/cloud.google.com/go/container/apiv1/ListClusters_smoke_test.go @@ -0,0 +1,68 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package container + +import ( + containerpb "google.golang.org/genproto/googleapis/container/v1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestClusterManagerSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClusterManagerClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var projectId2 string = projectId + var zone string = "us-central1-a" + var request = &containerpb.ListClustersRequest{ + ProjectId: projectId2, + Zone: zone, + } + + if _, err := c.ListClusters(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/container/apiv1/cluster_manager_client.go b/vendor/cloud.google.com/go/container/apiv1/cluster_manager_client.go new file mode 100644 index 000000000..bb3011c37 --- /dev/null +++ b/vendor/cloud.google.com/go/container/apiv1/cluster_manager_client.go @@ -0,0 +1,676 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package container + +import ( + "context" + "time" + + "cloud.google.com/go/internal/version" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + containerpb "google.golang.org/genproto/googleapis/container/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ClusterManagerCallOptions contains the retry settings for each method of ClusterManagerClient. +type ClusterManagerCallOptions struct { + ListClusters []gax.CallOption + GetCluster []gax.CallOption + CreateCluster []gax.CallOption + UpdateCluster []gax.CallOption + UpdateNodePool []gax.CallOption + SetNodePoolAutoscaling []gax.CallOption + SetLoggingService []gax.CallOption + SetMonitoringService []gax.CallOption + SetAddonsConfig []gax.CallOption + SetLocations []gax.CallOption + UpdateMaster []gax.CallOption + SetMasterAuth []gax.CallOption + DeleteCluster []gax.CallOption + ListOperations []gax.CallOption + GetOperation []gax.CallOption + CancelOperation []gax.CallOption + GetServerConfig []gax.CallOption + ListNodePools []gax.CallOption + GetNodePool []gax.CallOption + CreateNodePool []gax.CallOption + DeleteNodePool []gax.CallOption + RollbackNodePoolUpgrade []gax.CallOption + SetNodePoolManagement []gax.CallOption + SetLabels []gax.CallOption + SetLegacyAbac []gax.CallOption + StartIPRotation []gax.CallOption + CompleteIPRotation []gax.CallOption + SetNodePoolSize []gax.CallOption + SetNetworkPolicy []gax.CallOption + SetMaintenancePolicy []gax.CallOption +} + +func defaultClusterManagerClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("container.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultClusterManagerCallOptions() *ClusterManagerCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ClusterManagerCallOptions{ + ListClusters: retry[[2]string{"default", "idempotent"}], + GetCluster: retry[[2]string{"default", "idempotent"}], + CreateCluster: retry[[2]string{"default", "non_idempotent"}], + UpdateCluster: retry[[2]string{"default", "non_idempotent"}], + UpdateNodePool: retry[[2]string{"default", "non_idempotent"}], + SetNodePoolAutoscaling: retry[[2]string{"default", "non_idempotent"}], + SetLoggingService: retry[[2]string{"default", "non_idempotent"}], + SetMonitoringService: retry[[2]string{"default", "non_idempotent"}], + SetAddonsConfig: retry[[2]string{"default", "non_idempotent"}], + SetLocations: retry[[2]string{"default", "non_idempotent"}], + UpdateMaster: retry[[2]string{"default", "non_idempotent"}], + SetMasterAuth: retry[[2]string{"default", "non_idempotent"}], + DeleteCluster: retry[[2]string{"default", "idempotent"}], + ListOperations: retry[[2]string{"default", "idempotent"}], + GetOperation: retry[[2]string{"default", "idempotent"}], + CancelOperation: retry[[2]string{"default", "non_idempotent"}], + GetServerConfig: retry[[2]string{"default", "idempotent"}], + ListNodePools: retry[[2]string{"default", "idempotent"}], + GetNodePool: retry[[2]string{"default", "idempotent"}], + CreateNodePool: retry[[2]string{"default", "non_idempotent"}], + DeleteNodePool: retry[[2]string{"default", "idempotent"}], + RollbackNodePoolUpgrade: retry[[2]string{"default", "non_idempotent"}], + SetNodePoolManagement: retry[[2]string{"default", "non_idempotent"}], + SetLabels: retry[[2]string{"default", "non_idempotent"}], + SetLegacyAbac: retry[[2]string{"default", "non_idempotent"}], + StartIPRotation: retry[[2]string{"default", "non_idempotent"}], + CompleteIPRotation: retry[[2]string{"default", "non_idempotent"}], + SetNodePoolSize: retry[[2]string{"default", "non_idempotent"}], + SetNetworkPolicy: retry[[2]string{"default", "non_idempotent"}], + SetMaintenancePolicy: retry[[2]string{"default", "non_idempotent"}], + } +} + +// ClusterManagerClient is a client for interacting with Google Container Engine API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ClusterManagerClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + clusterManagerClient containerpb.ClusterManagerClient + + // The call options for this service. + CallOptions *ClusterManagerCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClusterManagerClient creates a new cluster manager client. +// +// Google Container Engine Cluster Manager v1 +func NewClusterManagerClient(ctx context.Context, opts ...option.ClientOption) (*ClusterManagerClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClusterManagerClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ClusterManagerClient{ + conn: conn, + CallOptions: defaultClusterManagerCallOptions(), + + clusterManagerClient: containerpb.NewClusterManagerClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ClusterManagerClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ClusterManagerClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ClusterManagerClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", version.Go()}, keyval...) + kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListClusters lists all clusters owned by a project in either the specified zone or all +// zones. +func (c *ClusterManagerClient) ListClusters(ctx context.Context, req *containerpb.ListClustersRequest, opts ...gax.CallOption) (*containerpb.ListClustersResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListClusters[0:len(c.CallOptions.ListClusters):len(c.CallOptions.ListClusters)], opts...) + var resp *containerpb.ListClustersResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.ListClusters(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetCluster gets the details of a specific cluster. +func (c *ClusterManagerClient) GetCluster(ctx context.Context, req *containerpb.GetClusterRequest, opts ...gax.CallOption) (*containerpb.Cluster, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetCluster[0:len(c.CallOptions.GetCluster):len(c.CallOptions.GetCluster)], opts...) + var resp *containerpb.Cluster + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.GetCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateCluster creates a cluster, consisting of the specified number and type of Google +// Compute Engine instances. +// +// By default, the cluster is created in the project's +// default network (at /compute/docs/networks-and-firewalls#networks). +// +// One firewall is added for the cluster. After cluster creation, +// the cluster creates routes for each node to allow the containers +// on that node to communicate with all other instances in the +// cluster. +// +// Finally, an entry is added to the project's global metadata indicating +// which CIDR range is being used by the cluster. +func (c *ClusterManagerClient) CreateCluster(ctx context.Context, req *containerpb.CreateClusterRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateCluster[0:len(c.CallOptions.CreateCluster):len(c.CallOptions.CreateCluster)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.CreateCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateCluster updates the settings of a specific cluster. +func (c *ClusterManagerClient) UpdateCluster(ctx context.Context, req *containerpb.UpdateClusterRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateCluster[0:len(c.CallOptions.UpdateCluster):len(c.CallOptions.UpdateCluster)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.UpdateCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateNodePool updates the version and/or image type of a specific node pool. +func (c *ClusterManagerClient) UpdateNodePool(ctx context.Context, req *containerpb.UpdateNodePoolRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateNodePool[0:len(c.CallOptions.UpdateNodePool):len(c.CallOptions.UpdateNodePool)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.UpdateNodePool(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetNodePoolAutoscaling sets the autoscaling settings of a specific node pool. +func (c *ClusterManagerClient) SetNodePoolAutoscaling(ctx context.Context, req *containerpb.SetNodePoolAutoscalingRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetNodePoolAutoscaling[0:len(c.CallOptions.SetNodePoolAutoscaling):len(c.CallOptions.SetNodePoolAutoscaling)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetNodePoolAutoscaling(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetLoggingService sets the logging service of a specific cluster. +func (c *ClusterManagerClient) SetLoggingService(ctx context.Context, req *containerpb.SetLoggingServiceRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetLoggingService[0:len(c.CallOptions.SetLoggingService):len(c.CallOptions.SetLoggingService)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetLoggingService(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetMonitoringService sets the monitoring service of a specific cluster. +func (c *ClusterManagerClient) SetMonitoringService(ctx context.Context, req *containerpb.SetMonitoringServiceRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetMonitoringService[0:len(c.CallOptions.SetMonitoringService):len(c.CallOptions.SetMonitoringService)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetMonitoringService(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetAddonsConfig sets the addons of a specific cluster. +func (c *ClusterManagerClient) SetAddonsConfig(ctx context.Context, req *containerpb.SetAddonsConfigRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetAddonsConfig[0:len(c.CallOptions.SetAddonsConfig):len(c.CallOptions.SetAddonsConfig)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetAddonsConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetLocations sets the locations of a specific cluster. +func (c *ClusterManagerClient) SetLocations(ctx context.Context, req *containerpb.SetLocationsRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetLocations[0:len(c.CallOptions.SetLocations):len(c.CallOptions.SetLocations)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetLocations(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateMaster updates the master of a specific cluster. +func (c *ClusterManagerClient) UpdateMaster(ctx context.Context, req *containerpb.UpdateMasterRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateMaster[0:len(c.CallOptions.UpdateMaster):len(c.CallOptions.UpdateMaster)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.UpdateMaster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetMasterAuth used to set master auth materials. Currently supports :- +// Changing the admin password of a specific cluster. +// This can be either via password generation or explicitly set the password. +func (c *ClusterManagerClient) SetMasterAuth(ctx context.Context, req *containerpb.SetMasterAuthRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetMasterAuth[0:len(c.CallOptions.SetMasterAuth):len(c.CallOptions.SetMasterAuth)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetMasterAuth(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteCluster deletes the cluster, including the Kubernetes endpoint and all worker +// nodes. +// +// Firewalls and routes that were configured during cluster creation +// are also deleted. +// +// Other Google Compute Engine resources that might be in use by the cluster +// (e.g. load balancer resources) will not be deleted if they weren't present +// at the initial create time. +func (c *ClusterManagerClient) DeleteCluster(ctx context.Context, req *containerpb.DeleteClusterRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteCluster[0:len(c.CallOptions.DeleteCluster):len(c.CallOptions.DeleteCluster)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.DeleteCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListOperations lists all operations in a project in a specific zone or all zones. +func (c *ClusterManagerClient) ListOperations(ctx context.Context, req *containerpb.ListOperationsRequest, opts ...gax.CallOption) (*containerpb.ListOperationsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListOperations[0:len(c.CallOptions.ListOperations):len(c.CallOptions.ListOperations)], opts...) + var resp *containerpb.ListOperationsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.ListOperations(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetOperation gets the specified operation. +func (c *ClusterManagerClient) GetOperation(ctx context.Context, req *containerpb.GetOperationRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetOperation[0:len(c.CallOptions.GetOperation):len(c.CallOptions.GetOperation)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.GetOperation(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CancelOperation cancels the specified operation. +func (c *ClusterManagerClient) CancelOperation(ctx context.Context, req *containerpb.CancelOperationRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CancelOperation[0:len(c.CallOptions.CancelOperation):len(c.CallOptions.CancelOperation)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.clusterManagerClient.CancelOperation(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// GetServerConfig returns configuration info about the Container Engine service. +func (c *ClusterManagerClient) GetServerConfig(ctx context.Context, req *containerpb.GetServerConfigRequest, opts ...gax.CallOption) (*containerpb.ServerConfig, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetServerConfig[0:len(c.CallOptions.GetServerConfig):len(c.CallOptions.GetServerConfig)], opts...) + var resp *containerpb.ServerConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.GetServerConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListNodePools lists the node pools for a cluster. +func (c *ClusterManagerClient) ListNodePools(ctx context.Context, req *containerpb.ListNodePoolsRequest, opts ...gax.CallOption) (*containerpb.ListNodePoolsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListNodePools[0:len(c.CallOptions.ListNodePools):len(c.CallOptions.ListNodePools)], opts...) + var resp *containerpb.ListNodePoolsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.ListNodePools(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetNodePool retrieves the node pool requested. +func (c *ClusterManagerClient) GetNodePool(ctx context.Context, req *containerpb.GetNodePoolRequest, opts ...gax.CallOption) (*containerpb.NodePool, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetNodePool[0:len(c.CallOptions.GetNodePool):len(c.CallOptions.GetNodePool)], opts...) + var resp *containerpb.NodePool + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.GetNodePool(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateNodePool creates a node pool for a cluster. +func (c *ClusterManagerClient) CreateNodePool(ctx context.Context, req *containerpb.CreateNodePoolRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateNodePool[0:len(c.CallOptions.CreateNodePool):len(c.CallOptions.CreateNodePool)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.CreateNodePool(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteNodePool deletes a node pool from a cluster. +func (c *ClusterManagerClient) DeleteNodePool(ctx context.Context, req *containerpb.DeleteNodePoolRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteNodePool[0:len(c.CallOptions.DeleteNodePool):len(c.CallOptions.DeleteNodePool)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.DeleteNodePool(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// RollbackNodePoolUpgrade roll back the previously Aborted or Failed NodePool upgrade. +// This will be an no-op if the last upgrade successfully completed. +func (c *ClusterManagerClient) RollbackNodePoolUpgrade(ctx context.Context, req *containerpb.RollbackNodePoolUpgradeRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.RollbackNodePoolUpgrade[0:len(c.CallOptions.RollbackNodePoolUpgrade):len(c.CallOptions.RollbackNodePoolUpgrade)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.RollbackNodePoolUpgrade(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetNodePoolManagement sets the NodeManagement options for a node pool. +func (c *ClusterManagerClient) SetNodePoolManagement(ctx context.Context, req *containerpb.SetNodePoolManagementRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetNodePoolManagement[0:len(c.CallOptions.SetNodePoolManagement):len(c.CallOptions.SetNodePoolManagement)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetNodePoolManagement(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetLabels sets labels on a cluster. +func (c *ClusterManagerClient) SetLabels(ctx context.Context, req *containerpb.SetLabelsRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetLabels[0:len(c.CallOptions.SetLabels):len(c.CallOptions.SetLabels)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetLabels(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetLegacyAbac enables or disables the ABAC authorization mechanism on a cluster. +func (c *ClusterManagerClient) SetLegacyAbac(ctx context.Context, req *containerpb.SetLegacyAbacRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetLegacyAbac[0:len(c.CallOptions.SetLegacyAbac):len(c.CallOptions.SetLegacyAbac)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetLegacyAbac(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// StartIPRotation start master IP rotation. +func (c *ClusterManagerClient) StartIPRotation(ctx context.Context, req *containerpb.StartIPRotationRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.StartIPRotation[0:len(c.CallOptions.StartIPRotation):len(c.CallOptions.StartIPRotation)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.StartIPRotation(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CompleteIPRotation completes master IP rotation. +func (c *ClusterManagerClient) CompleteIPRotation(ctx context.Context, req *containerpb.CompleteIPRotationRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CompleteIPRotation[0:len(c.CallOptions.CompleteIPRotation):len(c.CallOptions.CompleteIPRotation)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.CompleteIPRotation(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetNodePoolSize sets the size of a specific node pool. +func (c *ClusterManagerClient) SetNodePoolSize(ctx context.Context, req *containerpb.SetNodePoolSizeRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetNodePoolSize[0:len(c.CallOptions.SetNodePoolSize):len(c.CallOptions.SetNodePoolSize)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetNodePoolSize(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetNetworkPolicy enables/Disables Network Policy for a cluster. +func (c *ClusterManagerClient) SetNetworkPolicy(ctx context.Context, req *containerpb.SetNetworkPolicyRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetNetworkPolicy[0:len(c.CallOptions.SetNetworkPolicy):len(c.CallOptions.SetNetworkPolicy)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetNetworkPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetMaintenancePolicy sets the maintenance policy for a cluster. +func (c *ClusterManagerClient) SetMaintenancePolicy(ctx context.Context, req *containerpb.SetMaintenancePolicyRequest, opts ...gax.CallOption) (*containerpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetMaintenancePolicy[0:len(c.CallOptions.SetMaintenancePolicy):len(c.CallOptions.SetMaintenancePolicy)], opts...) + var resp *containerpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterManagerClient.SetMaintenancePolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/container/apiv1/cluster_manager_client_example_test.go b/vendor/cloud.google.com/go/container/apiv1/cluster_manager_client_example_test.go new file mode 100644 index 000000000..ffd986103 --- /dev/null +++ b/vendor/cloud.google.com/go/container/apiv1/cluster_manager_client_example_test.go @@ -0,0 +1,572 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package container_test + +import ( + "context" + + container "cloud.google.com/go/container/apiv1" + containerpb "google.golang.org/genproto/googleapis/container/v1" +) + +func ExampleNewClusterManagerClient() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClusterManagerClient_ListClusters() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.ListClustersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListClusters(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_GetCluster() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.GetClusterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_CreateCluster() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.CreateClusterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_UpdateCluster() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.UpdateClusterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_UpdateNodePool() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.UpdateNodePoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateNodePool(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetNodePoolAutoscaling() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetNodePoolAutoscalingRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetNodePoolAutoscaling(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetLoggingService() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetLoggingServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLoggingService(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetMonitoringService() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetMonitoringServiceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetMonitoringService(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetAddonsConfig() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetAddonsConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetAddonsConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetLocations() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetLocationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLocations(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_UpdateMaster() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.UpdateMasterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateMaster(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetMasterAuth() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetMasterAuthRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetMasterAuth(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_DeleteCluster() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.DeleteClusterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_ListOperations() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.ListOperationsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListOperations(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_GetOperation() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.GetOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetOperation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_CancelOperation() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.CancelOperationRequest{ + // TODO: Fill request struct fields. + } + err = c.CancelOperation(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClusterManagerClient_GetServerConfig() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.GetServerConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetServerConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_ListNodePools() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.ListNodePoolsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListNodePools(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_GetNodePool() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.GetNodePoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetNodePool(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_CreateNodePool() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.CreateNodePoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateNodePool(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_DeleteNodePool() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.DeleteNodePoolRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteNodePool(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_RollbackNodePoolUpgrade() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.RollbackNodePoolUpgradeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RollbackNodePoolUpgrade(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetNodePoolManagement() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetNodePoolManagementRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetNodePoolManagement(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetLabels() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetLabelsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLabels(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetLegacyAbac() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetLegacyAbacRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetLegacyAbac(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_StartIPRotation() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.StartIPRotationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.StartIPRotation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_CompleteIPRotation() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.CompleteIPRotationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CompleteIPRotation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetNodePoolSize() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetNodePoolSizeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetNodePoolSize(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetNetworkPolicy() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetNetworkPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetNetworkPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterManagerClient_SetMaintenancePolicy() { + ctx := context.Background() + c, err := container.NewClusterManagerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containerpb.SetMaintenancePolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetMaintenancePolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/container/apiv1/doc.go b/vendor/cloud.google.com/go/container/apiv1/doc.go new file mode 100644 index 000000000..0f995054c --- /dev/null +++ b/vendor/cloud.google.com/go/container/apiv1/doc.go @@ -0,0 +1,49 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package container is an auto-generated package for the +// Google Container Engine API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// The Google Kubernetes Engine API is used for building and managing +// container +// based applications, powered by the open source Kubernetes technology. +package container // import "cloud.google.com/go/container/apiv1" + +import ( + "context" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} diff --git a/vendor/cloud.google.com/go/container/apiv1/mock_test.go b/vendor/cloud.google.com/go/container/apiv1/mock_test.go new file mode 100644 index 000000000..f90aa7a4b --- /dev/null +++ b/vendor/cloud.google.com/go/container/apiv1/mock_test.go @@ -0,0 +1,2912 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package container + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + containerpb "google.golang.org/genproto/googleapis/container/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockClusterManagerServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + containerpb.ClusterManagerServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockClusterManagerServer) ListClusters(ctx context.Context, req *containerpb.ListClustersRequest) (*containerpb.ListClustersResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.ListClustersResponse), nil +} + +func (s *mockClusterManagerServer) GetCluster(ctx context.Context, req *containerpb.GetClusterRequest) (*containerpb.Cluster, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Cluster), nil +} + +func (s *mockClusterManagerServer) CreateCluster(ctx context.Context, req *containerpb.CreateClusterRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) UpdateCluster(ctx context.Context, req *containerpb.UpdateClusterRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) UpdateNodePool(ctx context.Context, req *containerpb.UpdateNodePoolRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetNodePoolAutoscaling(ctx context.Context, req *containerpb.SetNodePoolAutoscalingRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetLoggingService(ctx context.Context, req *containerpb.SetLoggingServiceRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetMonitoringService(ctx context.Context, req *containerpb.SetMonitoringServiceRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetAddonsConfig(ctx context.Context, req *containerpb.SetAddonsConfigRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetLocations(ctx context.Context, req *containerpb.SetLocationsRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) UpdateMaster(ctx context.Context, req *containerpb.UpdateMasterRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetMasterAuth(ctx context.Context, req *containerpb.SetMasterAuthRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) DeleteCluster(ctx context.Context, req *containerpb.DeleteClusterRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) ListOperations(ctx context.Context, req *containerpb.ListOperationsRequest) (*containerpb.ListOperationsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.ListOperationsResponse), nil +} + +func (s *mockClusterManagerServer) GetOperation(ctx context.Context, req *containerpb.GetOperationRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) CancelOperation(ctx context.Context, req *containerpb.CancelOperationRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockClusterManagerServer) GetServerConfig(ctx context.Context, req *containerpb.GetServerConfigRequest) (*containerpb.ServerConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.ServerConfig), nil +} + +func (s *mockClusterManagerServer) ListNodePools(ctx context.Context, req *containerpb.ListNodePoolsRequest) (*containerpb.ListNodePoolsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.ListNodePoolsResponse), nil +} + +func (s *mockClusterManagerServer) GetNodePool(ctx context.Context, req *containerpb.GetNodePoolRequest) (*containerpb.NodePool, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.NodePool), nil +} + +func (s *mockClusterManagerServer) CreateNodePool(ctx context.Context, req *containerpb.CreateNodePoolRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) DeleteNodePool(ctx context.Context, req *containerpb.DeleteNodePoolRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) RollbackNodePoolUpgrade(ctx context.Context, req *containerpb.RollbackNodePoolUpgradeRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetNodePoolManagement(ctx context.Context, req *containerpb.SetNodePoolManagementRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetLabels(ctx context.Context, req *containerpb.SetLabelsRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetLegacyAbac(ctx context.Context, req *containerpb.SetLegacyAbacRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) StartIPRotation(ctx context.Context, req *containerpb.StartIPRotationRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) CompleteIPRotation(ctx context.Context, req *containerpb.CompleteIPRotationRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetNodePoolSize(ctx context.Context, req *containerpb.SetNodePoolSizeRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetNetworkPolicy(ctx context.Context, req *containerpb.SetNetworkPolicyRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +func (s *mockClusterManagerServer) SetMaintenancePolicy(ctx context.Context, req *containerpb.SetMaintenancePolicyRequest) (*containerpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containerpb.Operation), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockClusterManager mockClusterManagerServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + containerpb.RegisterClusterManagerServer(serv, &mockClusterManager) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestClusterManagerListClusters(t *testing.T) { + var expectedResponse *containerpb.ListClustersResponse = &containerpb.ListClustersResponse{} + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var request = &containerpb.ListClustersRequest{ + ProjectId: projectId, + Zone: zone, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListClusters(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerListClustersError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var request = &containerpb.ListClustersRequest{ + ProjectId: projectId, + Zone: zone, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListClusters(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerGetCluster(t *testing.T) { + var name string = "name3373707" + var description string = "description-1724546052" + var initialNodeCount int32 = 1682564205 + var loggingService string = "loggingService-1700501035" + var monitoringService string = "monitoringService1469270462" + var network string = "network1843485230" + var clusterIpv4Cidr string = "clusterIpv4Cidr-141875831" + var subnetwork string = "subnetwork-1302785042" + var enableKubernetesAlpha bool = false + var labelFingerprint string = "labelFingerprint714995737" + var selfLink string = "selfLink-1691268851" + var zone2 string = "zone2-696322977" + var endpoint string = "endpoint1741102485" + var initialClusterVersion string = "initialClusterVersion-276373352" + var currentMasterVersion string = "currentMasterVersion-920953983" + var currentNodeVersion string = "currentNodeVersion-407476063" + var createTime string = "createTime-493574096" + var statusMessage string = "statusMessage-239442758" + var nodeIpv4CidrSize int32 = 1181176815 + var servicesIpv4Cidr string = "servicesIpv4Cidr1966438125" + var currentNodeCount int32 = 178977560 + var expireTime string = "expireTime-96179731" + var expectedResponse = &containerpb.Cluster{ + Name: name, + Description: description, + InitialNodeCount: initialNodeCount, + LoggingService: loggingService, + MonitoringService: monitoringService, + Network: network, + ClusterIpv4Cidr: clusterIpv4Cidr, + Subnetwork: subnetwork, + EnableKubernetesAlpha: enableKubernetesAlpha, + LabelFingerprint: labelFingerprint, + SelfLink: selfLink, + Zone: zone2, + Endpoint: endpoint, + InitialClusterVersion: initialClusterVersion, + CurrentMasterVersion: currentMasterVersion, + CurrentNodeVersion: currentNodeVersion, + CreateTime: createTime, + StatusMessage: statusMessage, + NodeIpv4CidrSize: nodeIpv4CidrSize, + ServicesIpv4Cidr: servicesIpv4Cidr, + CurrentNodeCount: currentNodeCount, + ExpireTime: expireTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.GetClusterRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCluster(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerGetClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.GetClusterRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCluster(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerCreateCluster(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var cluster *containerpb.Cluster = &containerpb.Cluster{} + var request = &containerpb.CreateClusterRequest{ + ProjectId: projectId, + Zone: zone, + Cluster: cluster, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateCluster(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerCreateClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var cluster *containerpb.Cluster = &containerpb.Cluster{} + var request = &containerpb.CreateClusterRequest{ + ProjectId: projectId, + Zone: zone, + Cluster: cluster, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateCluster(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerUpdateCluster(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var update *containerpb.ClusterUpdate = &containerpb.ClusterUpdate{} + var request = &containerpb.UpdateClusterRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + Update: update, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateCluster(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerUpdateClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var update *containerpb.ClusterUpdate = &containerpb.ClusterUpdate{} + var request = &containerpb.UpdateClusterRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + Update: update, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateCluster(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerUpdateNodePool(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var nodeVersion string = "nodeVersion1790136219" + var imageType string = "imageType-1442758754" + var request = &containerpb.UpdateNodePoolRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + NodeVersion: nodeVersion, + ImageType: imageType, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateNodePool(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerUpdateNodePoolError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var nodeVersion string = "nodeVersion1790136219" + var imageType string = "imageType-1442758754" + var request = &containerpb.UpdateNodePoolRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + NodeVersion: nodeVersion, + ImageType: imageType, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateNodePool(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetNodePoolAutoscaling(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var autoscaling *containerpb.NodePoolAutoscaling = &containerpb.NodePoolAutoscaling{} + var request = &containerpb.SetNodePoolAutoscalingRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + Autoscaling: autoscaling, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetNodePoolAutoscaling(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetNodePoolAutoscalingError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var autoscaling *containerpb.NodePoolAutoscaling = &containerpb.NodePoolAutoscaling{} + var request = &containerpb.SetNodePoolAutoscalingRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + Autoscaling: autoscaling, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetNodePoolAutoscaling(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetLoggingService(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var loggingService string = "loggingService-1700501035" + var request = &containerpb.SetLoggingServiceRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + LoggingService: loggingService, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetLoggingService(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetLoggingServiceError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var loggingService string = "loggingService-1700501035" + var request = &containerpb.SetLoggingServiceRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + LoggingService: loggingService, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetLoggingService(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetMonitoringService(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var monitoringService string = "monitoringService1469270462" + var request = &containerpb.SetMonitoringServiceRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + MonitoringService: monitoringService, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetMonitoringService(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetMonitoringServiceError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var monitoringService string = "monitoringService1469270462" + var request = &containerpb.SetMonitoringServiceRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + MonitoringService: monitoringService, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetMonitoringService(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetAddonsConfig(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var addonsConfig *containerpb.AddonsConfig = &containerpb.AddonsConfig{} + var request = &containerpb.SetAddonsConfigRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + AddonsConfig: addonsConfig, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetAddonsConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetAddonsConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var addonsConfig *containerpb.AddonsConfig = &containerpb.AddonsConfig{} + var request = &containerpb.SetAddonsConfigRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + AddonsConfig: addonsConfig, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetAddonsConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetLocations(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var locations []string = nil + var request = &containerpb.SetLocationsRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + Locations: locations, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetLocations(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetLocationsError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var locations []string = nil + var request = &containerpb.SetLocationsRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + Locations: locations, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetLocations(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerUpdateMaster(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var masterVersion string = "masterVersion-2139460613" + var request = &containerpb.UpdateMasterRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + MasterVersion: masterVersion, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateMaster(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerUpdateMasterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var masterVersion string = "masterVersion-2139460613" + var request = &containerpb.UpdateMasterRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + MasterVersion: masterVersion, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateMaster(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetMasterAuth(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var action containerpb.SetMasterAuthRequest_Action = containerpb.SetMasterAuthRequest_UNKNOWN + var update *containerpb.MasterAuth = &containerpb.MasterAuth{} + var request = &containerpb.SetMasterAuthRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + Action: action, + Update: update, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetMasterAuth(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetMasterAuthError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var action containerpb.SetMasterAuthRequest_Action = containerpb.SetMasterAuthRequest_UNKNOWN + var update *containerpb.MasterAuth = &containerpb.MasterAuth{} + var request = &containerpb.SetMasterAuthRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + Action: action, + Update: update, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetMasterAuth(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerDeleteCluster(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.DeleteClusterRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DeleteCluster(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerDeleteClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.DeleteClusterRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DeleteCluster(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerListOperations(t *testing.T) { + var expectedResponse *containerpb.ListOperationsResponse = &containerpb.ListOperationsResponse{} + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var request = &containerpb.ListOperationsRequest{ + ProjectId: projectId, + Zone: zone, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListOperations(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerListOperationsError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var request = &containerpb.ListOperationsRequest{ + ProjectId: projectId, + Zone: zone, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListOperations(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerGetOperation(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var operationId string = "operationId-274116877" + var request = &containerpb.GetOperationRequest{ + ProjectId: projectId, + Zone: zone, + OperationId: operationId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOperation(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerGetOperationError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var operationId string = "operationId-274116877" + var request = &containerpb.GetOperationRequest{ + ProjectId: projectId, + Zone: zone, + OperationId: operationId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOperation(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerCancelOperation(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var operationId string = "operationId-274116877" + var request = &containerpb.CancelOperationRequest{ + ProjectId: projectId, + Zone: zone, + OperationId: operationId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.CancelOperation(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestClusterManagerCancelOperationError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var operationId string = "operationId-274116877" + var request = &containerpb.CancelOperationRequest{ + ProjectId: projectId, + Zone: zone, + OperationId: operationId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.CancelOperation(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestClusterManagerGetServerConfig(t *testing.T) { + var defaultClusterVersion string = "defaultClusterVersion111003029" + var defaultImageType string = "defaultImageType-918225828" + var expectedResponse = &containerpb.ServerConfig{ + DefaultClusterVersion: defaultClusterVersion, + DefaultImageType: defaultImageType, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var request = &containerpb.GetServerConfigRequest{ + ProjectId: projectId, + Zone: zone, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetServerConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerGetServerConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var request = &containerpb.GetServerConfigRequest{ + ProjectId: projectId, + Zone: zone, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetServerConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerListNodePools(t *testing.T) { + var expectedResponse *containerpb.ListNodePoolsResponse = &containerpb.ListNodePoolsResponse{} + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.ListNodePoolsRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNodePools(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerListNodePoolsError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.ListNodePoolsRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNodePools(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerGetNodePool(t *testing.T) { + var name string = "name3373707" + var initialNodeCount int32 = 1682564205 + var selfLink string = "selfLink-1691268851" + var version string = "version351608024" + var statusMessage string = "statusMessage-239442758" + var expectedResponse = &containerpb.NodePool{ + Name: name, + InitialNodeCount: initialNodeCount, + SelfLink: selfLink, + Version: version, + StatusMessage: statusMessage, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var request = &containerpb.GetNodePoolRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetNodePool(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerGetNodePoolError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var request = &containerpb.GetNodePoolRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetNodePool(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerCreateNodePool(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePool *containerpb.NodePool = &containerpb.NodePool{} + var request = &containerpb.CreateNodePoolRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePool: nodePool, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateNodePool(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerCreateNodePoolError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePool *containerpb.NodePool = &containerpb.NodePool{} + var request = &containerpb.CreateNodePoolRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePool: nodePool, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateNodePool(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerDeleteNodePool(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var request = &containerpb.DeleteNodePoolRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DeleteNodePool(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerDeleteNodePoolError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var request = &containerpb.DeleteNodePoolRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DeleteNodePool(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerRollbackNodePoolUpgrade(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var request = &containerpb.RollbackNodePoolUpgradeRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RollbackNodePoolUpgrade(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerRollbackNodePoolUpgradeError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var request = &containerpb.RollbackNodePoolUpgradeRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RollbackNodePoolUpgrade(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetNodePoolManagement(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var management *containerpb.NodeManagement = &containerpb.NodeManagement{} + var request = &containerpb.SetNodePoolManagementRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + Management: management, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetNodePoolManagement(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetNodePoolManagementError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var management *containerpb.NodeManagement = &containerpb.NodeManagement{} + var request = &containerpb.SetNodePoolManagementRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + Management: management, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetNodePoolManagement(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetLabels(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var resourceLabels map[string]string = nil + var labelFingerprint string = "labelFingerprint714995737" + var request = &containerpb.SetLabelsRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + ResourceLabels: resourceLabels, + LabelFingerprint: labelFingerprint, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetLabels(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetLabelsError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var resourceLabels map[string]string = nil + var labelFingerprint string = "labelFingerprint714995737" + var request = &containerpb.SetLabelsRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + ResourceLabels: resourceLabels, + LabelFingerprint: labelFingerprint, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetLabels(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetLegacyAbac(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var enabled bool = false + var request = &containerpb.SetLegacyAbacRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + Enabled: enabled, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetLegacyAbac(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetLegacyAbacError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var enabled bool = false + var request = &containerpb.SetLegacyAbacRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + Enabled: enabled, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetLegacyAbac(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerStartIPRotation(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.StartIPRotationRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.StartIPRotation(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerStartIPRotationError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.StartIPRotationRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.StartIPRotation(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerCompleteIPRotation(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.CompleteIPRotationRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CompleteIPRotation(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerCompleteIPRotationError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var request = &containerpb.CompleteIPRotationRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CompleteIPRotation(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetNodePoolSize(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var nodeCount int32 = 1539922066 + var request = &containerpb.SetNodePoolSizeRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + NodeCount: nodeCount, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetNodePoolSize(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetNodePoolSizeError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var nodePoolId string = "nodePoolId1043384033" + var nodeCount int32 = 1539922066 + var request = &containerpb.SetNodePoolSizeRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NodePoolId: nodePoolId, + NodeCount: nodeCount, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetNodePoolSize(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetNetworkPolicy(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var networkPolicy *containerpb.NetworkPolicy = &containerpb.NetworkPolicy{} + var request = &containerpb.SetNetworkPolicyRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NetworkPolicy: networkPolicy, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetNetworkPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetNetworkPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var networkPolicy *containerpb.NetworkPolicy = &containerpb.NetworkPolicy{} + var request = &containerpb.SetNetworkPolicyRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + NetworkPolicy: networkPolicy, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetNetworkPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterManagerSetMaintenancePolicy(t *testing.T) { + var name string = "name3373707" + var zone2 string = "zone2-696322977" + var detail string = "detail-1335224239" + var statusMessage string = "statusMessage-239442758" + var selfLink string = "selfLink-1691268851" + var targetLink string = "targetLink-2084812312" + var startTime string = "startTime-1573145462" + var endTime string = "endTime1725551537" + var expectedResponse = &containerpb.Operation{ + Name: name, + Zone: zone2, + Detail: detail, + StatusMessage: statusMessage, + SelfLink: selfLink, + TargetLink: targetLink, + StartTime: startTime, + EndTime: endTime, + } + + mockClusterManager.err = nil + mockClusterManager.reqs = nil + + mockClusterManager.resps = append(mockClusterManager.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var maintenancePolicy *containerpb.MaintenancePolicy = &containerpb.MaintenancePolicy{} + var request = &containerpb.SetMaintenancePolicyRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + MaintenancePolicy: maintenancePolicy, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetMaintenancePolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterManager.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterManagerSetMaintenancePolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterManager.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var zone string = "zone3744684" + var clusterId string = "clusterId240280960" + var maintenancePolicy *containerpb.MaintenancePolicy = &containerpb.MaintenancePolicy{} + var request = &containerpb.SetMaintenancePolicyRequest{ + ProjectId: projectId, + Zone: zone, + ClusterId: clusterId, + MaintenancePolicy: maintenancePolicy, + } + + c, err := NewClusterManagerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetMaintenancePolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/container/container.go b/vendor/cloud.google.com/go/container/container.go new file mode 100644 index 000000000..aac46d823 --- /dev/null +++ b/vendor/cloud.google.com/go/container/container.go @@ -0,0 +1,276 @@ +// 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 container contains a deprecated Google Container Engine client. +// +// Deprecated: Use cloud.google.com/go/container/apiv1 instead. +package container // import "cloud.google.com/go/container" + +import ( + "context" + "errors" + "fmt" + "time" + + raw "google.golang.org/api/container/v1" + "google.golang.org/api/option" + htransport "google.golang.org/api/transport/http" +) + +// Type is the operation type. +type Type string + +const ( + // TypeCreate describes that the operation is "create cluster". + TypeCreate = Type("createCluster") + // TypeDelete describes that the operation is "delete cluster". + TypeDelete = Type("deleteCluster") +) + +// Status is the current status of the operation or resource. +type Status string + +const ( + // StatusDone is a status indicating that the resource or operation is in done state. + StatusDone = Status("done") + // StatusPending is a status indicating that the resource or operation is in pending state. + StatusPending = Status("pending") + // StatusRunning is a status indicating that the resource or operation is in running state. + StatusRunning = Status("running") + // StatusError is a status indicating that the resource or operation is in error state. + StatusError = Status("error") + // StatusProvisioning is a status indicating that the resource or operation is in provisioning state. + StatusProvisioning = Status("provisioning") + // StatusStopping is a status indicating that the resource or operation is in stopping state. + StatusStopping = Status("stopping") +) + +const prodAddr = "https://container.googleapis.com/" +const userAgent = "gcloud-golang-container/20151008" + +// Client is a Google Container Engine client, which may be used to manage +// clusters with a project. It must be constructed via NewClient. +type Client struct { + projectID string + svc *raw.Service +} + +// NewClient creates a new Google Container Engine client. +func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) { + o := []option.ClientOption{ + option.WithEndpoint(prodAddr), + option.WithScopes(raw.CloudPlatformScope), + option.WithUserAgent(userAgent), + } + o = append(o, opts...) + httpClient, endpoint, err := htransport.NewClient(ctx, o...) + if err != nil { + return nil, fmt.Errorf("dialing: %v", err) + } + + svc, err := raw.New(httpClient) + if err != nil { + return nil, fmt.Errorf("constructing container client: %v", err) + } + svc.BasePath = endpoint + + c := &Client{ + projectID: projectID, + svc: svc, + } + + return c, nil +} + +// Resource is a Google Container Engine cluster resource. +type Resource struct { + // Name is the name of this cluster. The name must be unique + // within this project and zone, and can be up to 40 characters. + Name string + + // Description is the description of the cluster. Optional. + Description string + + // Zone is the Google Compute Engine zone in which the cluster resides. + Zone string + + // Status is the current status of the cluster. It could either be + // StatusError, StatusProvisioning, StatusRunning or StatusStopping. + Status Status + + // Num is the number of the nodes in this cluster resource. + Num int64 + + // APIVersion is the version of the Kubernetes master and kubelets running + // in this cluster. Allowed value is 0.4.2, or leave blank to + // pick up the latest stable release. + APIVersion string + + // Endpoint is the IP address of this cluster's Kubernetes master. + // The endpoint can be accessed at https://username:password@endpoint/. + // See Username and Password fields for the username and password information. + Endpoint string + + // Username is the username to use when accessing the Kubernetes master endpoint. + Username string + + // Password is the password to use when accessing the Kubernetes master endpoint. + Password string + + // ContainerIPv4CIDR is the IP addresses of the container pods in + // this cluster, in CIDR notation (e.g. 1.2.3.4/29). + ContainerIPv4CIDR string + + // ServicesIPv4CIDR is the IP addresses of the Kubernetes services in this + // cluster, in CIDR notation (e.g. 1.2.3.4/29). Service addresses are + // always in the 10.0.0.0/16 range. + ServicesIPv4CIDR string + + // MachineType is a Google Compute Engine machine type (e.g. n1-standard-1). + // If none set, the default type is used while creating a new cluster. + MachineType string + + // This field is ignored. It was removed from the underlying container API in v1. + SourceImage string + + // Created is the creation time of this cluster. + Created time.Time +} + +func resourceFromRaw(c *raw.Cluster) *Resource { + if c == nil { + return nil + } + r := &Resource{ + Name: c.Name, + Description: c.Description, + Zone: c.Zone, + Status: Status(c.Status), + Num: c.CurrentNodeCount, + APIVersion: c.InitialClusterVersion, + Endpoint: c.Endpoint, + Username: c.MasterAuth.Username, + Password: c.MasterAuth.Password, + ContainerIPv4CIDR: c.ClusterIpv4Cidr, + ServicesIPv4CIDR: c.ServicesIpv4Cidr, + MachineType: c.NodeConfig.MachineType, + } + r.Created, _ = time.Parse(time.RFC3339, c.CreateTime) + return r +} + +func resourcesFromRaw(c []*raw.Cluster) []*Resource { + r := make([]*Resource, len(c)) + for i, val := range c { + r[i] = resourceFromRaw(val) + } + return r +} + +// Op represents a Google Container Engine API operation. +type Op struct { + // Name is the name of the operation. + Name string + + // Zone is the Google Compute Engine zone. + Zone string + + // This field is ignored. It was removed from the underlying container API in v1. + TargetURL string + + // Type is the operation type. It could be either be TypeCreate or TypeDelete. + Type Type + + // Status is the current status of this operation. It could be either + // OpDone or OpPending. + Status Status +} + +func opFromRaw(o *raw.Operation) *Op { + if o == nil { + return nil + } + return &Op{ + Name: o.Name, + Zone: o.Zone, + Type: Type(o.OperationType), + Status: Status(o.Status), + } +} + +func opsFromRaw(o []*raw.Operation) []*Op { + ops := make([]*Op, len(o)) + for i, val := range o { + ops[i] = opFromRaw(val) + } + return ops +} + +// Clusters returns a list of cluster resources from the specified zone. +// If no zone is specified, it returns all clusters under the user project. +func (c *Client) Clusters(ctx context.Context, zone string) ([]*Resource, error) { + if zone == "" { + zone = "-" + } + resp, err := c.svc.Projects.Zones.Clusters.List(c.projectID, zone).Do() + if err != nil { + return nil, err + } + return resourcesFromRaw(resp.Clusters), nil +} + +// Cluster returns metadata about the specified cluster. +func (c *Client) Cluster(ctx context.Context, zone, name string) (*Resource, error) { + resp, err := c.svc.Projects.Zones.Clusters.Get(c.projectID, zone, name).Do() + if err != nil { + return nil, err + } + return resourceFromRaw(resp), nil +} + +// DeleteCluster deletes a cluster. +func (c *Client) DeleteCluster(ctx context.Context, zone, name string) error { + _, err := c.svc.Projects.Zones.Clusters.Delete(c.projectID, zone, name).Do() + return err +} + +// Operations returns a list of operations from the specified zone. +// If no zone is specified, it looks up for all of the operations +// that are running under the user's project. +func (c *Client) Operations(ctx context.Context, zone string) ([]*Op, error) { + if zone == "" { + resp, err := c.svc.Projects.Zones.Operations.List(c.projectID, "-").Do() + if err != nil { + return nil, err + } + return opsFromRaw(resp.Operations), nil + } + resp, err := c.svc.Projects.Zones.Operations.List(c.projectID, zone).Do() + if err != nil { + return nil, err + } + return opsFromRaw(resp.Operations), nil +} + +// Operation returns an operation. +func (c *Client) Operation(ctx context.Context, zone, name string) (*Op, error) { + resp, err := c.svc.Projects.Zones.Operations.Get(c.projectID, zone, name).Do() + if err != nil { + return nil, err + } + if resp.StatusMessage != "" { + return nil, errors.New(resp.StatusMessage) + } + return opFromRaw(resp), nil +} diff --git a/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go new file mode 100644 index 000000000..1a5dd24f3 --- /dev/null +++ b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go @@ -0,0 +1,322 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package containeranalysis + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + containeranalysispb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1" + iampb "google.golang.org/genproto/googleapis/iam/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ContainerAnalysisV1Beta1CallOptions contains the retry settings for each method of ContainerAnalysisV1Beta1Client. +type ContainerAnalysisV1Beta1CallOptions struct { + SetIamPolicy []gax.CallOption + GetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption + GetScanConfig []gax.CallOption + ListScanConfigs []gax.CallOption + UpdateScanConfig []gax.CallOption +} + +func defaultContainerAnalysisV1Beta1ClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("containeranalysis.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultContainerAnalysisV1Beta1CallOptions() *ContainerAnalysisV1Beta1CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ContainerAnalysisV1Beta1CallOptions{ + SetIamPolicy: retry[[2]string{"default", "non_idempotent"}], + GetIamPolicy: retry[[2]string{"default", "non_idempotent"}], + TestIamPermissions: retry[[2]string{"default", "non_idempotent"}], + GetScanConfig: retry[[2]string{"default", "idempotent"}], + ListScanConfigs: retry[[2]string{"default", "idempotent"}], + UpdateScanConfig: retry[[2]string{"default", "non_idempotent"}], + } +} + +// ContainerAnalysisV1Beta1Client is a client for interacting with Container Analysis API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ContainerAnalysisV1Beta1Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + containerAnalysisV1Beta1Client containeranalysispb.ContainerAnalysisV1Beta1Client + + // The call options for this service. + CallOptions *ContainerAnalysisV1Beta1CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewContainerAnalysisV1Beta1Client creates a new container analysis v1 beta1 client. +// +// Retrieves analysis results of Cloud components such as Docker container +// images. The Container Analysis API is an implementation of the +// Grafeas (at grafeas.io) API. +// +// Analysis results are stored as a series of occurrences. An Occurrence +// contains information about a specific analysis instance on a resource. An +// occurrence refers to a Note. A note contains details describing the +// analysis and is generally stored in a separate project, called a Provider. +// Multiple occurrences can refer to the same note. +// +// For example, an SSL vulnerability could affect multiple images. In this case, +// there would be one note for the vulnerability and an occurrence for each +// image with the vulnerability referring to that note. +func NewContainerAnalysisV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*ContainerAnalysisV1Beta1Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultContainerAnalysisV1Beta1ClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ContainerAnalysisV1Beta1Client{ + conn: conn, + CallOptions: defaultContainerAnalysisV1Beta1CallOptions(), + + containerAnalysisV1Beta1Client: containeranalysispb.NewContainerAnalysisV1Beta1Client(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ContainerAnalysisV1Beta1Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ContainerAnalysisV1Beta1Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ContainerAnalysisV1Beta1Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// SetIamPolicy sets the access control policy on the specified note or occurrence. +// Requires containeranalysis.notes.setIamPolicy or +// containeranalysis.occurrences.setIamPolicy permission if the resource is +// a note or an occurrence, respectively. +// +// The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for +// notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for +// occurrences. +func (c *ContainerAnalysisV1Beta1Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetIamPolicy[0:len(c.CallOptions.SetIamPolicy):len(c.CallOptions.SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.containerAnalysisV1Beta1Client.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetIamPolicy gets the access control policy for a note or an occurrence resource. +// Requires containeranalysis.notes.setIamPolicy or +// containeranalysis.occurrences.setIamPolicy permission if the resource is +// a note or occurrence, respectively. +// +// The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for +// notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for +// occurrences. +func (c *ContainerAnalysisV1Beta1Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetIamPolicy[0:len(c.CallOptions.GetIamPolicy):len(c.CallOptions.GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.containerAnalysisV1Beta1Client.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// TestIamPermissions returns the permissions that a caller has on the specified note or +// occurrence. Requires list permission on the project (for example, +// containeranalysis.notes.list). +// +// The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for +// notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for +// occurrences. +func (c *ContainerAnalysisV1Beta1Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.TestIamPermissions[0:len(c.CallOptions.TestIamPermissions):len(c.CallOptions.TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.containerAnalysisV1Beta1Client.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetScanConfig gets the specified scan configuration. +func (c *ContainerAnalysisV1Beta1Client) GetScanConfig(ctx context.Context, req *containeranalysispb.GetScanConfigRequest, opts ...gax.CallOption) (*containeranalysispb.ScanConfig, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetScanConfig[0:len(c.CallOptions.GetScanConfig):len(c.CallOptions.GetScanConfig)], opts...) + var resp *containeranalysispb.ScanConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.containerAnalysisV1Beta1Client.GetScanConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListScanConfigs lists scan configurations for the specified project. +func (c *ContainerAnalysisV1Beta1Client) ListScanConfigs(ctx context.Context, req *containeranalysispb.ListScanConfigsRequest, opts ...gax.CallOption) *ScanConfigIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListScanConfigs[0:len(c.CallOptions.ListScanConfigs):len(c.CallOptions.ListScanConfigs)], opts...) + it := &ScanConfigIterator{} + req = proto.Clone(req).(*containeranalysispb.ListScanConfigsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*containeranalysispb.ScanConfig, string, error) { + var resp *containeranalysispb.ListScanConfigsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.containerAnalysisV1Beta1Client.ListScanConfigs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.ScanConfigs, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// UpdateScanConfig updates the specified scan configuration. +func (c *ContainerAnalysisV1Beta1Client) UpdateScanConfig(ctx context.Context, req *containeranalysispb.UpdateScanConfigRequest, opts ...gax.CallOption) (*containeranalysispb.ScanConfig, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateScanConfig[0:len(c.CallOptions.UpdateScanConfig):len(c.CallOptions.UpdateScanConfig)], opts...) + var resp *containeranalysispb.ScanConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.containerAnalysisV1Beta1Client.UpdateScanConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ScanConfigIterator manages a stream of *containeranalysispb.ScanConfig. +type ScanConfigIterator struct { + items []*containeranalysispb.ScanConfig + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*containeranalysispb.ScanConfig, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ScanConfigIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ScanConfigIterator) Next() (*containeranalysispb.ScanConfig, error) { + var item *containeranalysispb.ScanConfig + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ScanConfigIterator) bufLen() int { + return len(it.items) +} + +func (it *ScanConfigIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client_example_test.go b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client_example_test.go new file mode 100644 index 000000000..78c7bd9ca --- /dev/null +++ b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client_example_test.go @@ -0,0 +1,150 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package containeranalysis_test + +import ( + "context" + + containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1" + "google.golang.org/api/iterator" + containeranalysispb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func ExampleNewContainerAnalysisV1Beta1Client() { + ctx := context.Background() + c, err := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleContainerAnalysisV1Beta1Client_SetIamPolicy() { + ctx := context.Background() + c, err := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleContainerAnalysisV1Beta1Client_GetIamPolicy() { + ctx := context.Background() + c, err := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleContainerAnalysisV1Beta1Client_TestIamPermissions() { + ctx := context.Background() + c, err := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleContainerAnalysisV1Beta1Client_GetScanConfig() { + ctx := context.Background() + c, err := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containeranalysispb.GetScanConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetScanConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleContainerAnalysisV1Beta1Client_ListScanConfigs() { + ctx := context.Background() + c, err := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containeranalysispb.ListScanConfigsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListScanConfigs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleContainerAnalysisV1Beta1Client_UpdateScanConfig() { + ctx := context.Background() + c, err := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &containeranalysispb.UpdateScanConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateScanConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/doc.go b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/doc.go new file mode 100644 index 000000000..1f13e5bff --- /dev/null +++ b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/doc.go @@ -0,0 +1,91 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package containeranalysis is an auto-generated package for the +// Container Analysis API. +// +// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// +// An implementation of the Grafeas API, which stores, and enables querying +// and +// retrieval of critical metadata about all of your software artifacts. +package containeranalysis // import "cloud.google.com/go/containeranalysis/apiv1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go new file mode 100644 index 000000000..b5d2c21a3 --- /dev/null +++ b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go @@ -0,0 +1,545 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package containeranalysis + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// GrafeasV1Beta1CallOptions contains the retry settings for each method of GrafeasV1Beta1Client. +type GrafeasV1Beta1CallOptions struct { + GetOccurrence []gax.CallOption + ListOccurrences []gax.CallOption + DeleteOccurrence []gax.CallOption + CreateOccurrence []gax.CallOption + BatchCreateOccurrences []gax.CallOption + UpdateOccurrence []gax.CallOption + GetOccurrenceNote []gax.CallOption + GetNote []gax.CallOption + ListNotes []gax.CallOption + DeleteNote []gax.CallOption + CreateNote []gax.CallOption + BatchCreateNotes []gax.CallOption + UpdateNote []gax.CallOption + ListNoteOccurrences []gax.CallOption + GetVulnerabilityOccurrencesSummary []gax.CallOption +} + +func defaultGrafeasV1Beta1ClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("containeranalysis.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultGrafeasV1Beta1CallOptions() *GrafeasV1Beta1CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &GrafeasV1Beta1CallOptions{ + GetOccurrence: retry[[2]string{"default", "idempotent"}], + ListOccurrences: retry[[2]string{"default", "idempotent"}], + DeleteOccurrence: retry[[2]string{"default", "idempotent"}], + CreateOccurrence: retry[[2]string{"default", "non_idempotent"}], + BatchCreateOccurrences: retry[[2]string{"default", "non_idempotent"}], + UpdateOccurrence: retry[[2]string{"default", "non_idempotent"}], + GetOccurrenceNote: retry[[2]string{"default", "idempotent"}], + GetNote: retry[[2]string{"default", "idempotent"}], + ListNotes: retry[[2]string{"default", "idempotent"}], + DeleteNote: retry[[2]string{"default", "idempotent"}], + CreateNote: retry[[2]string{"default", "non_idempotent"}], + BatchCreateNotes: retry[[2]string{"default", "non_idempotent"}], + UpdateNote: retry[[2]string{"default", "non_idempotent"}], + ListNoteOccurrences: retry[[2]string{"default", "idempotent"}], + GetVulnerabilityOccurrencesSummary: retry[[2]string{"default", "idempotent"}], + } +} + +// GrafeasV1Beta1Client is a client for interacting with Container Analysis API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type GrafeasV1Beta1Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + grafeasV1Beta1Client grafeaspb.GrafeasV1Beta1Client + + // The call options for this service. + CallOptions *GrafeasV1Beta1CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewGrafeasV1Beta1Client creates a new grafeas v1 beta1 client. +// +// Grafeas (at grafeas.io) API. +// +// Retrieves analysis results of Cloud components such as Docker container +// images. +// +// Analysis results are stored as a series of occurrences. An Occurrence +// contains information about a specific analysis instance on a resource. An +// occurrence refers to a Note. A note contains details describing the +// analysis and is generally stored in a separate project, called a Provider. +// Multiple occurrences can refer to the same note. +// +// For example, an SSL vulnerability could affect multiple images. In this case, +// there would be one note for the vulnerability and an occurrence for each +// image with the vulnerability referring to that note. +func NewGrafeasV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*GrafeasV1Beta1Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultGrafeasV1Beta1ClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &GrafeasV1Beta1Client{ + conn: conn, + CallOptions: defaultGrafeasV1Beta1CallOptions(), + + grafeasV1Beta1Client: grafeaspb.NewGrafeasV1Beta1Client(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *GrafeasV1Beta1Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *GrafeasV1Beta1Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *GrafeasV1Beta1Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// GetOccurrence gets the specified occurrence. +func (c *GrafeasV1Beta1Client) GetOccurrence(ctx context.Context, req *grafeaspb.GetOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetOccurrence[0:len(c.CallOptions.GetOccurrence):len(c.CallOptions.GetOccurrence)], opts...) + var resp *grafeaspb.Occurrence + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.GetOccurrence(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListOccurrences lists occurrences for the specified project. +func (c *GrafeasV1Beta1Client) ListOccurrences(ctx context.Context, req *grafeaspb.ListOccurrencesRequest, opts ...gax.CallOption) *OccurrenceIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListOccurrences[0:len(c.CallOptions.ListOccurrences):len(c.CallOptions.ListOccurrences)], opts...) + it := &OccurrenceIterator{} + req = proto.Clone(req).(*grafeaspb.ListOccurrencesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*grafeaspb.Occurrence, string, error) { + var resp *grafeaspb.ListOccurrencesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.ListOccurrences(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Occurrences, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteOccurrence deletes the specified occurrence. For example, use this method to delete an +// occurrence when the occurrence is no longer applicable for the given +// resource. +func (c *GrafeasV1Beta1Client) DeleteOccurrence(ctx context.Context, req *grafeaspb.DeleteOccurrenceRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteOccurrence[0:len(c.CallOptions.DeleteOccurrence):len(c.CallOptions.DeleteOccurrence)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.grafeasV1Beta1Client.DeleteOccurrence(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// CreateOccurrence creates a new occurrence. +func (c *GrafeasV1Beta1Client) CreateOccurrence(ctx context.Context, req *grafeaspb.CreateOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateOccurrence[0:len(c.CallOptions.CreateOccurrence):len(c.CallOptions.CreateOccurrence)], opts...) + var resp *grafeaspb.Occurrence + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.CreateOccurrence(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// BatchCreateOccurrences creates new occurrences in batch. +func (c *GrafeasV1Beta1Client) BatchCreateOccurrences(ctx context.Context, req *grafeaspb.BatchCreateOccurrencesRequest, opts ...gax.CallOption) (*grafeaspb.BatchCreateOccurrencesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchCreateOccurrences[0:len(c.CallOptions.BatchCreateOccurrences):len(c.CallOptions.BatchCreateOccurrences)], opts...) + var resp *grafeaspb.BatchCreateOccurrencesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.BatchCreateOccurrences(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateOccurrence updates the specified occurrence. +func (c *GrafeasV1Beta1Client) UpdateOccurrence(ctx context.Context, req *grafeaspb.UpdateOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateOccurrence[0:len(c.CallOptions.UpdateOccurrence):len(c.CallOptions.UpdateOccurrence)], opts...) + var resp *grafeaspb.Occurrence + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.UpdateOccurrence(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetOccurrenceNote gets the note attached to the specified occurrence. Consumer projects can +// use this method to get a note that belongs to a provider project. +func (c *GrafeasV1Beta1Client) GetOccurrenceNote(ctx context.Context, req *grafeaspb.GetOccurrenceNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetOccurrenceNote[0:len(c.CallOptions.GetOccurrenceNote):len(c.CallOptions.GetOccurrenceNote)], opts...) + var resp *grafeaspb.Note + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.GetOccurrenceNote(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetNote gets the specified note. +func (c *GrafeasV1Beta1Client) GetNote(ctx context.Context, req *grafeaspb.GetNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetNote[0:len(c.CallOptions.GetNote):len(c.CallOptions.GetNote)], opts...) + var resp *grafeaspb.Note + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.GetNote(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListNotes lists notes for the specified project. +func (c *GrafeasV1Beta1Client) ListNotes(ctx context.Context, req *grafeaspb.ListNotesRequest, opts ...gax.CallOption) *NoteIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListNotes[0:len(c.CallOptions.ListNotes):len(c.CallOptions.ListNotes)], opts...) + it := &NoteIterator{} + req = proto.Clone(req).(*grafeaspb.ListNotesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*grafeaspb.Note, string, error) { + var resp *grafeaspb.ListNotesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.ListNotes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Notes, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteNote deletes the specified note. +func (c *GrafeasV1Beta1Client) DeleteNote(ctx context.Context, req *grafeaspb.DeleteNoteRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteNote[0:len(c.CallOptions.DeleteNote):len(c.CallOptions.DeleteNote)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.grafeasV1Beta1Client.DeleteNote(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// CreateNote creates a new note. +func (c *GrafeasV1Beta1Client) CreateNote(ctx context.Context, req *grafeaspb.CreateNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateNote[0:len(c.CallOptions.CreateNote):len(c.CallOptions.CreateNote)], opts...) + var resp *grafeaspb.Note + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.CreateNote(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// BatchCreateNotes creates new notes in batch. +func (c *GrafeasV1Beta1Client) BatchCreateNotes(ctx context.Context, req *grafeaspb.BatchCreateNotesRequest, opts ...gax.CallOption) (*grafeaspb.BatchCreateNotesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchCreateNotes[0:len(c.CallOptions.BatchCreateNotes):len(c.CallOptions.BatchCreateNotes)], opts...) + var resp *grafeaspb.BatchCreateNotesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.BatchCreateNotes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateNote updates the specified note. +func (c *GrafeasV1Beta1Client) UpdateNote(ctx context.Context, req *grafeaspb.UpdateNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateNote[0:len(c.CallOptions.UpdateNote):len(c.CallOptions.UpdateNote)], opts...) + var resp *grafeaspb.Note + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.UpdateNote(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListNoteOccurrences lists occurrences referencing the specified note. Provider projects can use +// this method to get all occurrences across consumer projects referencing the +// specified note. +func (c *GrafeasV1Beta1Client) ListNoteOccurrences(ctx context.Context, req *grafeaspb.ListNoteOccurrencesRequest, opts ...gax.CallOption) *OccurrenceIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListNoteOccurrences[0:len(c.CallOptions.ListNoteOccurrences):len(c.CallOptions.ListNoteOccurrences)], opts...) + it := &OccurrenceIterator{} + req = proto.Clone(req).(*grafeaspb.ListNoteOccurrencesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*grafeaspb.Occurrence, string, error) { + var resp *grafeaspb.ListNoteOccurrencesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.ListNoteOccurrences(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Occurrences, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetVulnerabilityOccurrencesSummary gets a summary of the number and severity of occurrences. +func (c *GrafeasV1Beta1Client) GetVulnerabilityOccurrencesSummary(ctx context.Context, req *grafeaspb.GetVulnerabilityOccurrencesSummaryRequest, opts ...gax.CallOption) (*grafeaspb.VulnerabilityOccurrencesSummary, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetVulnerabilityOccurrencesSummary[0:len(c.CallOptions.GetVulnerabilityOccurrencesSummary):len(c.CallOptions.GetVulnerabilityOccurrencesSummary)], opts...) + var resp *grafeaspb.VulnerabilityOccurrencesSummary + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.grafeasV1Beta1Client.GetVulnerabilityOccurrencesSummary(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// NoteIterator manages a stream of *grafeaspb.Note. +type NoteIterator struct { + items []*grafeaspb.Note + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*grafeaspb.Note, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *NoteIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *NoteIterator) Next() (*grafeaspb.Note, error) { + var item *grafeaspb.Note + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *NoteIterator) bufLen() int { + return len(it.items) +} + +func (it *NoteIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// OccurrenceIterator manages a stream of *grafeaspb.Occurrence. +type OccurrenceIterator struct { + items []*grafeaspb.Occurrence + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*grafeaspb.Occurrence, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *OccurrenceIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *OccurrenceIterator) Next() (*grafeaspb.Occurrence, error) { + var item *grafeaspb.Occurrence + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *OccurrenceIterator) bufLen() int { + return len(it.items) +} + +func (it *OccurrenceIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/grafeas_v1_beta1_client_example_test.go b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/grafeas_v1_beta1_client_example_test.go new file mode 100644 index 000000000..55e8e477b --- /dev/null +++ b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/grafeas_v1_beta1_client_example_test.go @@ -0,0 +1,319 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package containeranalysis_test + +import ( + "context" + + containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1" + "google.golang.org/api/iterator" + grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas" +) + +func ExampleNewGrafeasV1Beta1Client() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleGrafeasV1Beta1Client_GetOccurrence() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.GetOccurrenceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetOccurrence(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGrafeasV1Beta1Client_ListOccurrences() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.ListOccurrencesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListOccurrences(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleGrafeasV1Beta1Client_DeleteOccurrence() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.DeleteOccurrenceRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteOccurrence(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleGrafeasV1Beta1Client_CreateOccurrence() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.CreateOccurrenceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateOccurrence(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGrafeasV1Beta1Client_BatchCreateOccurrences() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.BatchCreateOccurrencesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BatchCreateOccurrences(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGrafeasV1Beta1Client_UpdateOccurrence() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.UpdateOccurrenceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateOccurrence(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGrafeasV1Beta1Client_GetOccurrenceNote() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.GetOccurrenceNoteRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetOccurrenceNote(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGrafeasV1Beta1Client_GetNote() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.GetNoteRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetNote(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGrafeasV1Beta1Client_ListNotes() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.ListNotesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListNotes(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleGrafeasV1Beta1Client_DeleteNote() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.DeleteNoteRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteNote(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleGrafeasV1Beta1Client_CreateNote() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.CreateNoteRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateNote(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGrafeasV1Beta1Client_BatchCreateNotes() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.BatchCreateNotesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BatchCreateNotes(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGrafeasV1Beta1Client_UpdateNote() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.UpdateNoteRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateNote(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGrafeasV1Beta1Client_ListNoteOccurrences() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.ListNoteOccurrencesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListNoteOccurrences(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleGrafeasV1Beta1Client_GetVulnerabilityOccurrencesSummary() { + ctx := context.Background() + c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &grafeaspb.GetVulnerabilityOccurrencesSummaryRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetVulnerabilityOccurrencesSummary(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/mock_test.go b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/mock_test.go new file mode 100644 index 000000000..bfa61fc2a --- /dev/null +++ b/vendor/cloud.google.com/go/containeranalysis/apiv1beta1/mock_test.go @@ -0,0 +1,1708 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package containeranalysis + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + containeranalysispb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1" + grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockContainerAnalysisV1Beta1Server struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + containeranalysispb.ContainerAnalysisV1Beta1Server + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockContainerAnalysisV1Beta1Server) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockContainerAnalysisV1Beta1Server) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockContainerAnalysisV1Beta1Server) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.TestIamPermissionsResponse), nil +} + +func (s *mockContainerAnalysisV1Beta1Server) GetScanConfig(ctx context.Context, req *containeranalysispb.GetScanConfigRequest) (*containeranalysispb.ScanConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containeranalysispb.ScanConfig), nil +} + +func (s *mockContainerAnalysisV1Beta1Server) ListScanConfigs(ctx context.Context, req *containeranalysispb.ListScanConfigsRequest) (*containeranalysispb.ListScanConfigsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containeranalysispb.ListScanConfigsResponse), nil +} + +func (s *mockContainerAnalysisV1Beta1Server) UpdateScanConfig(ctx context.Context, req *containeranalysispb.UpdateScanConfigRequest) (*containeranalysispb.ScanConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*containeranalysispb.ScanConfig), nil +} + +type mockGrafeasV1Beta1Server struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + grafeaspb.GrafeasV1Beta1Server + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockGrafeasV1Beta1Server) GetOccurrence(ctx context.Context, req *grafeaspb.GetOccurrenceRequest) (*grafeaspb.Occurrence, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.Occurrence), nil +} + +func (s *mockGrafeasV1Beta1Server) ListOccurrences(ctx context.Context, req *grafeaspb.ListOccurrencesRequest) (*grafeaspb.ListOccurrencesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.ListOccurrencesResponse), nil +} + +func (s *mockGrafeasV1Beta1Server) DeleteOccurrence(ctx context.Context, req *grafeaspb.DeleteOccurrenceRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockGrafeasV1Beta1Server) CreateOccurrence(ctx context.Context, req *grafeaspb.CreateOccurrenceRequest) (*grafeaspb.Occurrence, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.Occurrence), nil +} + +func (s *mockGrafeasV1Beta1Server) BatchCreateOccurrences(ctx context.Context, req *grafeaspb.BatchCreateOccurrencesRequest) (*grafeaspb.BatchCreateOccurrencesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.BatchCreateOccurrencesResponse), nil +} + +func (s *mockGrafeasV1Beta1Server) UpdateOccurrence(ctx context.Context, req *grafeaspb.UpdateOccurrenceRequest) (*grafeaspb.Occurrence, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.Occurrence), nil +} + +func (s *mockGrafeasV1Beta1Server) GetOccurrenceNote(ctx context.Context, req *grafeaspb.GetOccurrenceNoteRequest) (*grafeaspb.Note, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.Note), nil +} + +func (s *mockGrafeasV1Beta1Server) GetNote(ctx context.Context, req *grafeaspb.GetNoteRequest) (*grafeaspb.Note, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.Note), nil +} + +func (s *mockGrafeasV1Beta1Server) ListNotes(ctx context.Context, req *grafeaspb.ListNotesRequest) (*grafeaspb.ListNotesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.ListNotesResponse), nil +} + +func (s *mockGrafeasV1Beta1Server) DeleteNote(ctx context.Context, req *grafeaspb.DeleteNoteRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockGrafeasV1Beta1Server) CreateNote(ctx context.Context, req *grafeaspb.CreateNoteRequest) (*grafeaspb.Note, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.Note), nil +} + +func (s *mockGrafeasV1Beta1Server) BatchCreateNotes(ctx context.Context, req *grafeaspb.BatchCreateNotesRequest) (*grafeaspb.BatchCreateNotesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.BatchCreateNotesResponse), nil +} + +func (s *mockGrafeasV1Beta1Server) UpdateNote(ctx context.Context, req *grafeaspb.UpdateNoteRequest) (*grafeaspb.Note, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.Note), nil +} + +func (s *mockGrafeasV1Beta1Server) ListNoteOccurrences(ctx context.Context, req *grafeaspb.ListNoteOccurrencesRequest) (*grafeaspb.ListNoteOccurrencesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.ListNoteOccurrencesResponse), nil +} + +func (s *mockGrafeasV1Beta1Server) GetVulnerabilityOccurrencesSummary(ctx context.Context, req *grafeaspb.GetVulnerabilityOccurrencesSummaryRequest) (*grafeaspb.VulnerabilityOccurrencesSummary, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*grafeaspb.VulnerabilityOccurrencesSummary), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockContainerAnalysisV1Beta1 mockContainerAnalysisV1Beta1Server + mockGrafeasV1Beta1 mockGrafeasV1Beta1Server +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + containeranalysispb.RegisterContainerAnalysisV1Beta1Server(serv, &mockContainerAnalysisV1Beta1) + grafeaspb.RegisterGrafeasV1Beta1Server(serv, &mockGrafeasV1Beta1) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestContainerAnalysisV1Beta1SetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockContainerAnalysisV1Beta1.err = nil + mockContainerAnalysisV1Beta1.reqs = nil + + mockContainerAnalysisV1Beta1.resps = append(mockContainerAnalysisV1Beta1.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContainerAnalysisV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContainerAnalysisV1Beta1SetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockContainerAnalysisV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestContainerAnalysisV1Beta1GetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockContainerAnalysisV1Beta1.err = nil + mockContainerAnalysisV1Beta1.reqs = nil + + mockContainerAnalysisV1Beta1.resps = append(mockContainerAnalysisV1Beta1.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContainerAnalysisV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContainerAnalysisV1Beta1GetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockContainerAnalysisV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestContainerAnalysisV1Beta1TestIamPermissions(t *testing.T) { + var expectedResponse *iampb.TestIamPermissionsResponse = &iampb.TestIamPermissionsResponse{} + + mockContainerAnalysisV1Beta1.err = nil + mockContainerAnalysisV1Beta1.reqs = nil + + mockContainerAnalysisV1Beta1.resps = append(mockContainerAnalysisV1Beta1.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContainerAnalysisV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContainerAnalysisV1Beta1TestIamPermissionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockContainerAnalysisV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestContainerAnalysisV1Beta1GetScanConfig(t *testing.T) { + var name2 string = "name2-1052831874" + var description string = "description-1724546052" + var enabled bool = false + var expectedResponse = &containeranalysispb.ScanConfig{ + Name: name2, + Description: description, + Enabled: enabled, + } + + mockContainerAnalysisV1Beta1.err = nil + mockContainerAnalysisV1Beta1.reqs = nil + + mockContainerAnalysisV1Beta1.resps = append(mockContainerAnalysisV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/scanConfigs/%s", "[PROJECT]", "[SCAN_CONFIG]") + var request = &containeranalysispb.GetScanConfigRequest{ + Name: formattedName, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetScanConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContainerAnalysisV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContainerAnalysisV1Beta1GetScanConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockContainerAnalysisV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/scanConfigs/%s", "[PROJECT]", "[SCAN_CONFIG]") + var request = &containeranalysispb.GetScanConfigRequest{ + Name: formattedName, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetScanConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestContainerAnalysisV1Beta1ListScanConfigs(t *testing.T) { + var nextPageToken string = "" + var scanConfigsElement *containeranalysispb.ScanConfig = &containeranalysispb.ScanConfig{} + var scanConfigs = []*containeranalysispb.ScanConfig{scanConfigsElement} + var expectedResponse = &containeranalysispb.ListScanConfigsResponse{ + NextPageToken: nextPageToken, + ScanConfigs: scanConfigs, + } + + mockContainerAnalysisV1Beta1.err = nil + mockContainerAnalysisV1Beta1.reqs = nil + + mockContainerAnalysisV1Beta1.resps = append(mockContainerAnalysisV1Beta1.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &containeranalysispb.ListScanConfigsRequest{ + Parent: formattedParent, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListScanConfigs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContainerAnalysisV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.ScanConfigs[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContainerAnalysisV1Beta1ListScanConfigsError(t *testing.T) { + errCode := codes.PermissionDenied + mockContainerAnalysisV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &containeranalysispb.ListScanConfigsRequest{ + Parent: formattedParent, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListScanConfigs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestContainerAnalysisV1Beta1UpdateScanConfig(t *testing.T) { + var name2 string = "name2-1052831874" + var description string = "description-1724546052" + var enabled bool = false + var expectedResponse = &containeranalysispb.ScanConfig{ + Name: name2, + Description: description, + Enabled: enabled, + } + + mockContainerAnalysisV1Beta1.err = nil + mockContainerAnalysisV1Beta1.reqs = nil + + mockContainerAnalysisV1Beta1.resps = append(mockContainerAnalysisV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/scanConfigs/%s", "[PROJECT]", "[SCAN_CONFIG]") + var scanConfig *containeranalysispb.ScanConfig = &containeranalysispb.ScanConfig{} + var request = &containeranalysispb.UpdateScanConfigRequest{ + Name: formattedName, + ScanConfig: scanConfig, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateScanConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContainerAnalysisV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContainerAnalysisV1Beta1UpdateScanConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockContainerAnalysisV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/scanConfigs/%s", "[PROJECT]", "[SCAN_CONFIG]") + var scanConfig *containeranalysispb.ScanConfig = &containeranalysispb.ScanConfig{} + var request = &containeranalysispb.UpdateScanConfigRequest{ + Name: formattedName, + ScanConfig: scanConfig, + } + + c, err := NewContainerAnalysisV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateScanConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1GetOccurrence(t *testing.T) { + var name2 string = "name2-1052831874" + var noteName string = "noteName1780787896" + var remediation string = "remediation779381797" + var expectedResponse = &grafeaspb.Occurrence{ + Name: name2, + NoteName: noteName, + Remediation: remediation, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/occurrences/%s", "[PROJECT]", "[OCCURRENCE]") + var request = &grafeaspb.GetOccurrenceRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOccurrence(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1GetOccurrenceError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/occurrences/%s", "[PROJECT]", "[OCCURRENCE]") + var request = &grafeaspb.GetOccurrenceRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOccurrence(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1ListOccurrences(t *testing.T) { + var nextPageToken string = "" + var occurrencesElement *grafeaspb.Occurrence = &grafeaspb.Occurrence{} + var occurrences = []*grafeaspb.Occurrence{occurrencesElement} + var expectedResponse = &grafeaspb.ListOccurrencesResponse{ + NextPageToken: nextPageToken, + Occurrences: occurrences, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &grafeaspb.ListOccurrencesRequest{ + Parent: formattedParent, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListOccurrences(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Occurrences[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1ListOccurrencesError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &grafeaspb.ListOccurrencesRequest{ + Parent: formattedParent, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListOccurrences(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1DeleteOccurrence(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/occurrences/%s", "[PROJECT]", "[OCCURRENCE]") + var request = &grafeaspb.DeleteOccurrenceRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteOccurrence(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestGrafeasV1Beta1DeleteOccurrenceError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/occurrences/%s", "[PROJECT]", "[OCCURRENCE]") + var request = &grafeaspb.DeleteOccurrenceRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteOccurrence(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestGrafeasV1Beta1CreateOccurrence(t *testing.T) { + var name string = "name3373707" + var noteName string = "noteName1780787896" + var remediation string = "remediation779381797" + var expectedResponse = &grafeaspb.Occurrence{ + Name: name, + NoteName: noteName, + Remediation: remediation, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var occurrence *grafeaspb.Occurrence = &grafeaspb.Occurrence{} + var request = &grafeaspb.CreateOccurrenceRequest{ + Parent: formattedParent, + Occurrence: occurrence, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateOccurrence(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1CreateOccurrenceError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var occurrence *grafeaspb.Occurrence = &grafeaspb.Occurrence{} + var request = &grafeaspb.CreateOccurrenceRequest{ + Parent: formattedParent, + Occurrence: occurrence, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateOccurrence(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1BatchCreateOccurrences(t *testing.T) { + var expectedResponse *grafeaspb.BatchCreateOccurrencesResponse = &grafeaspb.BatchCreateOccurrencesResponse{} + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var occurrences []*grafeaspb.Occurrence = nil + var request = &grafeaspb.BatchCreateOccurrencesRequest{ + Parent: formattedParent, + Occurrences: occurrences, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchCreateOccurrences(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1BatchCreateOccurrencesError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var occurrences []*grafeaspb.Occurrence = nil + var request = &grafeaspb.BatchCreateOccurrencesRequest{ + Parent: formattedParent, + Occurrences: occurrences, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchCreateOccurrences(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1UpdateOccurrence(t *testing.T) { + var name2 string = "name2-1052831874" + var noteName string = "noteName1780787896" + var remediation string = "remediation779381797" + var expectedResponse = &grafeaspb.Occurrence{ + Name: name2, + NoteName: noteName, + Remediation: remediation, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/occurrences/%s", "[PROJECT]", "[OCCURRENCE]") + var occurrence *grafeaspb.Occurrence = &grafeaspb.Occurrence{} + var request = &grafeaspb.UpdateOccurrenceRequest{ + Name: formattedName, + Occurrence: occurrence, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateOccurrence(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1UpdateOccurrenceError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/occurrences/%s", "[PROJECT]", "[OCCURRENCE]") + var occurrence *grafeaspb.Occurrence = &grafeaspb.Occurrence{} + var request = &grafeaspb.UpdateOccurrenceRequest{ + Name: formattedName, + Occurrence: occurrence, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateOccurrence(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1GetOccurrenceNote(t *testing.T) { + var name2 string = "name2-1052831874" + var shortDescription string = "shortDescription-235369287" + var longDescription string = "longDescription-1747792199" + var expectedResponse = &grafeaspb.Note{ + Name: name2, + ShortDescription: shortDescription, + LongDescription: longDescription, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/occurrences/%s", "[PROJECT]", "[OCCURRENCE]") + var request = &grafeaspb.GetOccurrenceNoteRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOccurrenceNote(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1GetOccurrenceNoteError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/occurrences/%s", "[PROJECT]", "[OCCURRENCE]") + var request = &grafeaspb.GetOccurrenceNoteRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOccurrenceNote(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1GetNote(t *testing.T) { + var name2 string = "name2-1052831874" + var shortDescription string = "shortDescription-235369287" + var longDescription string = "longDescription-1747792199" + var expectedResponse = &grafeaspb.Note{ + Name: name2, + ShortDescription: shortDescription, + LongDescription: longDescription, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var request = &grafeaspb.GetNoteRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetNote(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1GetNoteError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var request = &grafeaspb.GetNoteRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetNote(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1ListNotes(t *testing.T) { + var nextPageToken string = "" + var notesElement *grafeaspb.Note = &grafeaspb.Note{} + var notes = []*grafeaspb.Note{notesElement} + var expectedResponse = &grafeaspb.ListNotesResponse{ + NextPageToken: nextPageToken, + Notes: notes, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &grafeaspb.ListNotesRequest{ + Parent: formattedParent, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNotes(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Notes[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1ListNotesError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &grafeaspb.ListNotesRequest{ + Parent: formattedParent, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNotes(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1DeleteNote(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var request = &grafeaspb.DeleteNoteRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteNote(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestGrafeasV1Beta1DeleteNoteError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var request = &grafeaspb.DeleteNoteRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteNote(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestGrafeasV1Beta1CreateNote(t *testing.T) { + var name string = "name3373707" + var shortDescription string = "shortDescription-235369287" + var longDescription string = "longDescription-1747792199" + var expectedResponse = &grafeaspb.Note{ + Name: name, + ShortDescription: shortDescription, + LongDescription: longDescription, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var noteId string = "noteId2129224840" + var note *grafeaspb.Note = &grafeaspb.Note{} + var request = &grafeaspb.CreateNoteRequest{ + Parent: formattedParent, + NoteId: noteId, + Note: note, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateNote(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1CreateNoteError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var noteId string = "noteId2129224840" + var note *grafeaspb.Note = &grafeaspb.Note{} + var request = &grafeaspb.CreateNoteRequest{ + Parent: formattedParent, + NoteId: noteId, + Note: note, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateNote(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1BatchCreateNotes(t *testing.T) { + var expectedResponse *grafeaspb.BatchCreateNotesResponse = &grafeaspb.BatchCreateNotesResponse{} + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var notes map[string]*grafeaspb.Note = nil + var request = &grafeaspb.BatchCreateNotesRequest{ + Parent: formattedParent, + Notes: notes, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchCreateNotes(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1BatchCreateNotesError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var notes map[string]*grafeaspb.Note = nil + var request = &grafeaspb.BatchCreateNotesRequest{ + Parent: formattedParent, + Notes: notes, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchCreateNotes(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1UpdateNote(t *testing.T) { + var name2 string = "name2-1052831874" + var shortDescription string = "shortDescription-235369287" + var longDescription string = "longDescription-1747792199" + var expectedResponse = &grafeaspb.Note{ + Name: name2, + ShortDescription: shortDescription, + LongDescription: longDescription, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var note *grafeaspb.Note = &grafeaspb.Note{} + var request = &grafeaspb.UpdateNoteRequest{ + Name: formattedName, + Note: note, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateNote(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1UpdateNoteError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var note *grafeaspb.Note = &grafeaspb.Note{} + var request = &grafeaspb.UpdateNoteRequest{ + Name: formattedName, + Note: note, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateNote(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1ListNoteOccurrences(t *testing.T) { + var nextPageToken string = "" + var occurrencesElement *grafeaspb.Occurrence = &grafeaspb.Occurrence{} + var occurrences = []*grafeaspb.Occurrence{occurrencesElement} + var expectedResponse = &grafeaspb.ListNoteOccurrencesResponse{ + NextPageToken: nextPageToken, + Occurrences: occurrences, + } + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var request = &grafeaspb.ListNoteOccurrencesRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNoteOccurrences(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Occurrences[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1ListNoteOccurrencesError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/notes/%s", "[PROJECT]", "[NOTE]") + var request = &grafeaspb.ListNoteOccurrencesRequest{ + Name: formattedName, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNoteOccurrences(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGrafeasV1Beta1GetVulnerabilityOccurrencesSummary(t *testing.T) { + var expectedResponse *grafeaspb.VulnerabilityOccurrencesSummary = &grafeaspb.VulnerabilityOccurrencesSummary{} + + mockGrafeasV1Beta1.err = nil + mockGrafeasV1Beta1.reqs = nil + + mockGrafeasV1Beta1.resps = append(mockGrafeasV1Beta1.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &grafeaspb.GetVulnerabilityOccurrencesSummaryRequest{ + Parent: formattedParent, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetVulnerabilityOccurrencesSummary(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGrafeasV1Beta1.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGrafeasV1Beta1GetVulnerabilityOccurrencesSummaryError(t *testing.T) { + errCode := codes.PermissionDenied + mockGrafeasV1Beta1.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &grafeaspb.GetVulnerabilityOccurrencesSummaryRequest{ + Parent: formattedParent, + } + + c, err := NewGrafeasV1Beta1Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetVulnerabilityOccurrencesSummary(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1/ListClusters_smoke_test.go b/vendor/cloud.google.com/go/dataproc/apiv1/ListClusters_smoke_test.go new file mode 100644 index 000000000..0a1b5c14b --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1/ListClusters_smoke_test.go @@ -0,0 +1,69 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestClusterControllerSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClusterControllerClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var projectId2 string = projectId + var region string = "global" + var request = &dataprocpb.ListClustersRequest{ + ProjectId: projectId2, + Region: region, + } + + iter := c.ListClusters(ctx, request) + if _, err := iter.Next(); err != nil && err != iterator.Done { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1/cluster_controller_client.go b/vendor/cloud.google.com/go/dataproc/apiv1/cluster_controller_client.go new file mode 100644 index 000000000..16394c238 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1/cluster_controller_client.go @@ -0,0 +1,609 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ClusterControllerCallOptions contains the retry settings for each method of ClusterControllerClient. +type ClusterControllerCallOptions struct { + CreateCluster []gax.CallOption + UpdateCluster []gax.CallOption + DeleteCluster []gax.CallOption + GetCluster []gax.CallOption + ListClusters []gax.CallOption + DiagnoseCluster []gax.CallOption +} + +func defaultClusterControllerClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dataproc.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultClusterControllerCallOptions() *ClusterControllerCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"default", "non_idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ClusterControllerCallOptions{ + CreateCluster: retry[[2]string{"default", "non_idempotent"}], + UpdateCluster: retry[[2]string{"default", "non_idempotent"}], + DeleteCluster: retry[[2]string{"default", "non_idempotent"}], + GetCluster: retry[[2]string{"default", "idempotent"}], + ListClusters: retry[[2]string{"default", "idempotent"}], + DiagnoseCluster: retry[[2]string{"default", "non_idempotent"}], + } +} + +// ClusterControllerClient is a client for interacting with Google Cloud Dataproc API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ClusterControllerClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + clusterControllerClient dataprocpb.ClusterControllerClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *ClusterControllerCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClusterControllerClient creates a new cluster controller client. +// +// The ClusterControllerService provides methods to manage clusters +// of Compute Engine instances. +func NewClusterControllerClient(ctx context.Context, opts ...option.ClientOption) (*ClusterControllerClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClusterControllerClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ClusterControllerClient{ + conn: conn, + CallOptions: defaultClusterControllerCallOptions(), + + clusterControllerClient: dataprocpb.NewClusterControllerClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ClusterControllerClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ClusterControllerClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ClusterControllerClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// CreateCluster creates a cluster in a project. +func (c *ClusterControllerClient) CreateCluster(ctx context.Context, req *dataprocpb.CreateClusterRequest, opts ...gax.CallOption) (*CreateClusterOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateCluster[0:len(c.CallOptions.CreateCluster):len(c.CallOptions.CreateCluster)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.CreateCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// UpdateCluster updates a cluster in a project. +func (c *ClusterControllerClient) UpdateCluster(ctx context.Context, req *dataprocpb.UpdateClusterRequest, opts ...gax.CallOption) (*UpdateClusterOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateCluster[0:len(c.CallOptions.UpdateCluster):len(c.CallOptions.UpdateCluster)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.UpdateCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DeleteCluster deletes a cluster in a project. +func (c *ClusterControllerClient) DeleteCluster(ctx context.Context, req *dataprocpb.DeleteClusterRequest, opts ...gax.CallOption) (*DeleteClusterOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteCluster[0:len(c.CallOptions.DeleteCluster):len(c.CallOptions.DeleteCluster)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.DeleteCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// GetCluster gets the resource representation for a cluster in a project. +func (c *ClusterControllerClient) GetCluster(ctx context.Context, req *dataprocpb.GetClusterRequest, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetCluster[0:len(c.CallOptions.GetCluster):len(c.CallOptions.GetCluster)], opts...) + var resp *dataprocpb.Cluster + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.GetCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListClusters lists all regions/{region}/clusters in a project. +func (c *ClusterControllerClient) ListClusters(ctx context.Context, req *dataprocpb.ListClustersRequest, opts ...gax.CallOption) *ClusterIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListClusters[0:len(c.CallOptions.ListClusters):len(c.CallOptions.ListClusters)], opts...) + it := &ClusterIterator{} + req = proto.Clone(req).(*dataprocpb.ListClustersRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataprocpb.Cluster, string, error) { + var resp *dataprocpb.ListClustersResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.ListClusters(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Clusters, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DiagnoseCluster gets cluster diagnostic information. +// After the operation completes, the Operation.response field +// contains DiagnoseClusterOutputLocation. +func (c *ClusterControllerClient) DiagnoseCluster(ctx context.Context, req *dataprocpb.DiagnoseClusterRequest, opts ...gax.CallOption) (*DiagnoseClusterOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DiagnoseCluster[0:len(c.CallOptions.DiagnoseCluster):len(c.CallOptions.DiagnoseCluster)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.DiagnoseCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DiagnoseClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ClusterIterator manages a stream of *dataprocpb.Cluster. +type ClusterIterator struct { + items []*dataprocpb.Cluster + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataprocpb.Cluster, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ClusterIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ClusterIterator) Next() (*dataprocpb.Cluster, error) { + var item *dataprocpb.Cluster + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ClusterIterator) bufLen() int { + return len(it.items) +} + +func (it *ClusterIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// CreateClusterOperation manages a long-running operation from CreateCluster. +type CreateClusterOperation struct { + lro *longrunning.Operation +} + +// CreateClusterOperation returns a new CreateClusterOperation from a given name. +// The name must be that of a previously created CreateClusterOperation, possibly from a different process. +func (c *ClusterControllerClient) CreateClusterOperation(name string) *CreateClusterOperation { + return &CreateClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + var resp dataprocpb.Cluster + if err := op.lro.WaitWithInterval(ctx, &resp, 10000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + var resp dataprocpb.Cluster + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateClusterOperation) Metadata() (*dataprocpb.ClusterOperationMetadata, error) { + var meta dataprocpb.ClusterOperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateClusterOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateClusterOperation) Name() string { + return op.lro.Name() +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *CreateClusterOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} + +// DeleteClusterOperation manages a long-running operation from DeleteCluster. +type DeleteClusterOperation struct { + lro *longrunning.Operation +} + +// DeleteClusterOperation returns a new DeleteClusterOperation from a given name. +// The name must be that of a previously created DeleteClusterOperation, possibly from a different process. +func (c *ClusterControllerClient) DeleteClusterOperation(name string) *DeleteClusterOperation { + return &DeleteClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeleteClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *DeleteClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteClusterOperation) Metadata() (*dataprocpb.ClusterOperationMetadata, error) { + var meta dataprocpb.ClusterOperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeleteClusterOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeleteClusterOperation) Name() string { + return op.lro.Name() +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *DeleteClusterOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} + +// DiagnoseClusterOperation manages a long-running operation from DiagnoseCluster. +type DiagnoseClusterOperation struct { + lro *longrunning.Operation +} + +// DiagnoseClusterOperation returns a new DiagnoseClusterOperation from a given name. +// The name must be that of a previously created DiagnoseClusterOperation, possibly from a different process. +func (c *ClusterControllerClient) DiagnoseClusterOperation(name string) *DiagnoseClusterOperation { + return &DiagnoseClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *DiagnoseClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *DiagnoseClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DiagnoseClusterOperation) Metadata() (*dataprocpb.DiagnoseClusterResults, error) { + var meta dataprocpb.DiagnoseClusterResults + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DiagnoseClusterOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DiagnoseClusterOperation) Name() string { + return op.lro.Name() +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *DiagnoseClusterOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} + +// UpdateClusterOperation manages a long-running operation from UpdateCluster. +type UpdateClusterOperation struct { + lro *longrunning.Operation +} + +// UpdateClusterOperation returns a new UpdateClusterOperation from a given name. +// The name must be that of a previously created UpdateClusterOperation, possibly from a different process. +func (c *ClusterControllerClient) UpdateClusterOperation(name string) *UpdateClusterOperation { + return &UpdateClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + var resp dataprocpb.Cluster + if err := op.lro.WaitWithInterval(ctx, &resp, 10000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *UpdateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + var resp dataprocpb.Cluster + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateClusterOperation) Metadata() (*dataprocpb.ClusterOperationMetadata, error) { + var meta dataprocpb.ClusterOperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateClusterOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateClusterOperation) Name() string { + return op.lro.Name() +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *UpdateClusterOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1/cluster_controller_client_example_test.go b/vendor/cloud.google.com/go/dataproc/apiv1/cluster_controller_client_example_test.go new file mode 100644 index 000000000..103cde035 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1/cluster_controller_client_example_test.go @@ -0,0 +1,161 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc_test + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1" + "google.golang.org/api/iterator" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" +) + +func ExampleNewClusterControllerClient() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClusterControllerClient_CreateCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.CreateClusterRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterControllerClient_UpdateCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.UpdateClusterRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterControllerClient_DeleteCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.DeleteClusterRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleClusterControllerClient_GetCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.GetClusterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterControllerClient_ListClusters() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.ListClustersRequest{ + // TODO: Fill request struct fields. + } + it := c.ListClusters(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClusterControllerClient_DiagnoseCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.DiagnoseClusterRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DiagnoseCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1/doc.go b/vendor/cloud.google.com/go/dataproc/apiv1/doc.go new file mode 100644 index 000000000..8130fb236 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package dataproc is an auto-generated package for the +// Google Cloud Dataproc API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Manages Hadoop-based clusters and jobs on Google Cloud Platform. +package dataproc // import "cloud.google.com/go/dataproc/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/dataproc/apiv1/job_controller_client.go b/vendor/cloud.google.com/go/dataproc/apiv1/job_controller_client.go new file mode 100644 index 000000000..f38ecb5fa --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1/job_controller_client.go @@ -0,0 +1,301 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// JobControllerCallOptions contains the retry settings for each method of JobControllerClient. +type JobControllerCallOptions struct { + SubmitJob []gax.CallOption + GetJob []gax.CallOption + ListJobs []gax.CallOption + UpdateJob []gax.CallOption + CancelJob []gax.CallOption + DeleteJob []gax.CallOption +} + +func defaultJobControllerClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dataproc.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultJobControllerCallOptions() *JobControllerCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"default", "non_idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &JobControllerCallOptions{ + SubmitJob: retry[[2]string{"default", "non_idempotent"}], + GetJob: retry[[2]string{"default", "idempotent"}], + ListJobs: retry[[2]string{"default", "idempotent"}], + UpdateJob: retry[[2]string{"default", "non_idempotent"}], + CancelJob: retry[[2]string{"default", "idempotent"}], + DeleteJob: retry[[2]string{"default", "non_idempotent"}], + } +} + +// JobControllerClient is a client for interacting with Google Cloud Dataproc API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type JobControllerClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + jobControllerClient dataprocpb.JobControllerClient + + // The call options for this service. + CallOptions *JobControllerCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewJobControllerClient creates a new job controller client. +// +// The JobController provides methods to manage jobs. +func NewJobControllerClient(ctx context.Context, opts ...option.ClientOption) (*JobControllerClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultJobControllerClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &JobControllerClient{ + conn: conn, + CallOptions: defaultJobControllerCallOptions(), + + jobControllerClient: dataprocpb.NewJobControllerClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *JobControllerClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *JobControllerClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *JobControllerClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// SubmitJob submits a job to a cluster. +func (c *JobControllerClient) SubmitJob(ctx context.Context, req *dataprocpb.SubmitJobRequest, opts ...gax.CallOption) (*dataprocpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SubmitJob[0:len(c.CallOptions.SubmitJob):len(c.CallOptions.SubmitJob)], opts...) + var resp *dataprocpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.SubmitJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetJob gets the resource representation for a job in a project. +func (c *JobControllerClient) GetJob(ctx context.Context, req *dataprocpb.GetJobRequest, opts ...gax.CallOption) (*dataprocpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetJob[0:len(c.CallOptions.GetJob):len(c.CallOptions.GetJob)], opts...) + var resp *dataprocpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.GetJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListJobs lists regions/{region}/jobs in a project. +func (c *JobControllerClient) ListJobs(ctx context.Context, req *dataprocpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListJobs[0:len(c.CallOptions.ListJobs):len(c.CallOptions.ListJobs)], opts...) + it := &JobIterator{} + req = proto.Clone(req).(*dataprocpb.ListJobsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataprocpb.Job, string, error) { + var resp *dataprocpb.ListJobsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.ListJobs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Jobs, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// UpdateJob updates a job in a project. +func (c *JobControllerClient) UpdateJob(ctx context.Context, req *dataprocpb.UpdateJobRequest, opts ...gax.CallOption) (*dataprocpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateJob[0:len(c.CallOptions.UpdateJob):len(c.CallOptions.UpdateJob)], opts...) + var resp *dataprocpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.UpdateJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CancelJob starts a job cancellation request. To access the job resource +// after cancellation, call +// regions/{region}/jobs.list (at /dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or +// regions/{region}/jobs.get (at /dataproc/docs/reference/rest/v1/projects.regions.jobs/get). +func (c *JobControllerClient) CancelJob(ctx context.Context, req *dataprocpb.CancelJobRequest, opts ...gax.CallOption) (*dataprocpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CancelJob[0:len(c.CallOptions.CancelJob):len(c.CallOptions.CancelJob)], opts...) + var resp *dataprocpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.CancelJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteJob deletes the job from the project. If the job is active, the delete fails, +// and the response returns FAILED_PRECONDITION. +func (c *JobControllerClient) DeleteJob(ctx context.Context, req *dataprocpb.DeleteJobRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteJob[0:len(c.CallOptions.DeleteJob):len(c.CallOptions.DeleteJob)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.jobControllerClient.DeleteJob(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// JobIterator manages a stream of *dataprocpb.Job. +type JobIterator struct { + items []*dataprocpb.Job + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataprocpb.Job, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *JobIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *JobIterator) Next() (*dataprocpb.Job, error) { + var item *dataprocpb.Job + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *JobIterator) bufLen() int { + return len(it.items) +} + +func (it *JobIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1/job_controller_client_example_test.go b/vendor/cloud.google.com/go/dataproc/apiv1/job_controller_client_example_test.go new file mode 100644 index 000000000..eaaf5b62d --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1/job_controller_client_example_test.go @@ -0,0 +1,147 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc_test + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1" + "google.golang.org/api/iterator" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" +) + +func ExampleNewJobControllerClient() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleJobControllerClient_SubmitJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.SubmitJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SubmitJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobControllerClient_GetJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.GetJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobControllerClient_ListJobs() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.ListJobsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListJobs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleJobControllerClient_UpdateJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.UpdateJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobControllerClient_CancelJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.CancelJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CancelJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobControllerClient_DeleteJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.DeleteJobRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteJob(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1/mock_test.go b/vendor/cloud.google.com/go/dataproc/apiv1/mock_test.go new file mode 100644 index 000000000..992af278a --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1/mock_test.go @@ -0,0 +1,1782 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + field_maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockClusterControllerServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dataprocpb.ClusterControllerServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockClusterControllerServer) CreateCluster(ctx context.Context, req *dataprocpb.CreateClusterRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockClusterControllerServer) UpdateCluster(ctx context.Context, req *dataprocpb.UpdateClusterRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockClusterControllerServer) DeleteCluster(ctx context.Context, req *dataprocpb.DeleteClusterRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockClusterControllerServer) GetCluster(ctx context.Context, req *dataprocpb.GetClusterRequest) (*dataprocpb.Cluster, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Cluster), nil +} + +func (s *mockClusterControllerServer) ListClusters(ctx context.Context, req *dataprocpb.ListClustersRequest) (*dataprocpb.ListClustersResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.ListClustersResponse), nil +} + +func (s *mockClusterControllerServer) DiagnoseCluster(ctx context.Context, req *dataprocpb.DiagnoseClusterRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +type mockJobControllerServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dataprocpb.JobControllerServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockJobControllerServer) SubmitJob(ctx context.Context, req *dataprocpb.SubmitJobRequest) (*dataprocpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Job), nil +} + +func (s *mockJobControllerServer) GetJob(ctx context.Context, req *dataprocpb.GetJobRequest) (*dataprocpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Job), nil +} + +func (s *mockJobControllerServer) ListJobs(ctx context.Context, req *dataprocpb.ListJobsRequest) (*dataprocpb.ListJobsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.ListJobsResponse), nil +} + +func (s *mockJobControllerServer) UpdateJob(ctx context.Context, req *dataprocpb.UpdateJobRequest) (*dataprocpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Job), nil +} + +func (s *mockJobControllerServer) CancelJob(ctx context.Context, req *dataprocpb.CancelJobRequest) (*dataprocpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Job), nil +} + +func (s *mockJobControllerServer) DeleteJob(ctx context.Context, req *dataprocpb.DeleteJobRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +type mockWorkflowTemplateServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dataprocpb.WorkflowTemplateServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockWorkflowTemplateServer) CreateWorkflowTemplate(ctx context.Context, req *dataprocpb.CreateWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.WorkflowTemplate), nil +} + +func (s *mockWorkflowTemplateServer) GetWorkflowTemplate(ctx context.Context, req *dataprocpb.GetWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.WorkflowTemplate), nil +} + +func (s *mockWorkflowTemplateServer) InstantiateWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateWorkflowTemplateRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockWorkflowTemplateServer) InstantiateInlineWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateInlineWorkflowTemplateRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockWorkflowTemplateServer) UpdateWorkflowTemplate(ctx context.Context, req *dataprocpb.UpdateWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.WorkflowTemplate), nil +} + +func (s *mockWorkflowTemplateServer) ListWorkflowTemplates(ctx context.Context, req *dataprocpb.ListWorkflowTemplatesRequest) (*dataprocpb.ListWorkflowTemplatesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.ListWorkflowTemplatesResponse), nil +} + +func (s *mockWorkflowTemplateServer) DeleteWorkflowTemplate(ctx context.Context, req *dataprocpb.DeleteWorkflowTemplateRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockClusterController mockClusterControllerServer + mockJobController mockJobControllerServer + mockWorkflowTemplate mockWorkflowTemplateServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + dataprocpb.RegisterClusterControllerServer(serv, &mockClusterController) + dataprocpb.RegisterJobControllerServer(serv, &mockJobController) + dataprocpb.RegisterWorkflowTemplateServiceServer(serv, &mockWorkflowTemplate) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestClusterControllerCreateCluster(t *testing.T) { + var projectId2 string = "projectId2939242356" + var clusterName string = "clusterName-1018081872" + var clusterUuid string = "clusterUuid-1017854240" + var expectedResponse = &dataprocpb.Cluster{ + ProjectId: projectId2, + ClusterName: clusterName, + ClusterUuid: clusterUuid, + } + + mockClusterController.err = nil + mockClusterController.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var cluster *dataprocpb.Cluster = &dataprocpb.Cluster{} + var request = &dataprocpb.CreateClusterRequest{ + ProjectId: projectId, + Region: region, + Cluster: cluster, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterControllerCreateClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = nil + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var cluster *dataprocpb.Cluster = &dataprocpb.Cluster{} + var request = &dataprocpb.CreateClusterRequest{ + ProjectId: projectId, + Region: region, + Cluster: cluster, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterControllerUpdateCluster(t *testing.T) { + var projectId2 string = "projectId2939242356" + var clusterName2 string = "clusterName2875867491" + var clusterUuid string = "clusterUuid-1017854240" + var expectedResponse = &dataprocpb.Cluster{ + ProjectId: projectId2, + ClusterName: clusterName2, + ClusterUuid: clusterUuid, + } + + mockClusterController.err = nil + mockClusterController.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var cluster *dataprocpb.Cluster = &dataprocpb.Cluster{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &dataprocpb.UpdateClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + Cluster: cluster, + UpdateMask: updateMask, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterControllerUpdateClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = nil + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var cluster *dataprocpb.Cluster = &dataprocpb.Cluster{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &dataprocpb.UpdateClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + Cluster: cluster, + UpdateMask: updateMask, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterControllerDeleteCluster(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockClusterController.err = nil + mockClusterController.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.DeleteClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DeleteCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestClusterControllerDeleteClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = nil + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.DeleteClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DeleteCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestClusterControllerGetCluster(t *testing.T) { + var projectId2 string = "projectId2939242356" + var clusterName2 string = "clusterName2875867491" + var clusterUuid string = "clusterUuid-1017854240" + var expectedResponse = &dataprocpb.Cluster{ + ProjectId: projectId2, + ClusterName: clusterName2, + ClusterUuid: clusterUuid, + } + + mockClusterController.err = nil + mockClusterController.reqs = nil + + mockClusterController.resps = append(mockClusterController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.GetClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCluster(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterControllerGetClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.GetClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCluster(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterControllerListClusters(t *testing.T) { + var nextPageToken string = "" + var clustersElement *dataprocpb.Cluster = &dataprocpb.Cluster{} + var clusters = []*dataprocpb.Cluster{clustersElement} + var expectedResponse = &dataprocpb.ListClustersResponse{ + NextPageToken: nextPageToken, + Clusters: clusters, + } + + mockClusterController.err = nil + mockClusterController.reqs = nil + + mockClusterController.resps = append(mockClusterController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var request = &dataprocpb.ListClustersRequest{ + ProjectId: projectId, + Region: region, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListClusters(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Clusters[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterControllerListClustersError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var request = &dataprocpb.ListClustersRequest{ + ProjectId: projectId, + Region: region, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListClusters(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterControllerDiagnoseCluster(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockClusterController.err = nil + mockClusterController.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.DiagnoseClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DiagnoseCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestClusterControllerDiagnoseClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = nil + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.DiagnoseClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DiagnoseCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestJobControllerSubmitJob(t *testing.T) { + var driverOutputResourceUri string = "driverOutputResourceUri-542229086" + var driverControlFilesUri string = "driverControlFilesUri207057643" + var jobUuid string = "jobUuid-1615012099" + var expectedResponse = &dataprocpb.Job{ + DriverOutputResourceUri: driverOutputResourceUri, + DriverControlFilesUri: driverControlFilesUri, + JobUuid: jobUuid, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var job *dataprocpb.Job = &dataprocpb.Job{} + var request = &dataprocpb.SubmitJobRequest{ + ProjectId: projectId, + Region: region, + Job: job, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SubmitJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerSubmitJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var job *dataprocpb.Job = &dataprocpb.Job{} + var request = &dataprocpb.SubmitJobRequest{ + ProjectId: projectId, + Region: region, + Job: job, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SubmitJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerGetJob(t *testing.T) { + var driverOutputResourceUri string = "driverOutputResourceUri-542229086" + var driverControlFilesUri string = "driverControlFilesUri207057643" + var jobUuid string = "jobUuid-1615012099" + var expectedResponse = &dataprocpb.Job{ + DriverOutputResourceUri: driverOutputResourceUri, + DriverControlFilesUri: driverControlFilesUri, + JobUuid: jobUuid, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.GetJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerGetJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.GetJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerListJobs(t *testing.T) { + var nextPageToken string = "" + var jobsElement *dataprocpb.Job = &dataprocpb.Job{} + var jobs = []*dataprocpb.Job{jobsElement} + var expectedResponse = &dataprocpb.ListJobsResponse{ + NextPageToken: nextPageToken, + Jobs: jobs, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var request = &dataprocpb.ListJobsRequest{ + ProjectId: projectId, + Region: region, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListJobs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Jobs[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerListJobsError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var request = &dataprocpb.ListJobsRequest{ + ProjectId: projectId, + Region: region, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListJobs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerUpdateJob(t *testing.T) { + var driverOutputResourceUri string = "driverOutputResourceUri-542229086" + var driverControlFilesUri string = "driverControlFilesUri207057643" + var jobUuid string = "jobUuid-1615012099" + var expectedResponse = &dataprocpb.Job{ + DriverOutputResourceUri: driverOutputResourceUri, + DriverControlFilesUri: driverControlFilesUri, + JobUuid: jobUuid, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var job *dataprocpb.Job = &dataprocpb.Job{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &dataprocpb.UpdateJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + Job: job, + UpdateMask: updateMask, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerUpdateJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var job *dataprocpb.Job = &dataprocpb.Job{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &dataprocpb.UpdateJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + Job: job, + UpdateMask: updateMask, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerCancelJob(t *testing.T) { + var driverOutputResourceUri string = "driverOutputResourceUri-542229086" + var driverControlFilesUri string = "driverControlFilesUri207057643" + var jobUuid string = "jobUuid-1615012099" + var expectedResponse = &dataprocpb.Job{ + DriverOutputResourceUri: driverOutputResourceUri, + DriverControlFilesUri: driverControlFilesUri, + JobUuid: jobUuid, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.CancelJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CancelJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerCancelJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.CancelJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CancelJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerDeleteJob(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.DeleteJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestJobControllerDeleteJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.DeleteJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestWorkflowTemplateServiceCreateWorkflowTemplate(t *testing.T) { + var id string = "id3355" + var name string = "name3373707" + var version int32 = 351608024 + var expectedResponse = &dataprocpb.WorkflowTemplate{ + Id: id, + Name: name, + Version: version, + } + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.CreateWorkflowTemplateRequest{ + Parent: formattedParent, + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateWorkflowTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestWorkflowTemplateServiceCreateWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.CreateWorkflowTemplateRequest{ + Parent: formattedParent, + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateWorkflowTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestWorkflowTemplateServiceGetWorkflowTemplate(t *testing.T) { + var id string = "id3355" + var name2 string = "name2-1052831874" + var version int32 = 351608024 + var expectedResponse = &dataprocpb.WorkflowTemplate{ + Id: id, + Name: name2, + Version: version, + } + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.GetWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetWorkflowTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestWorkflowTemplateServiceGetWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.GetWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetWorkflowTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestWorkflowTemplateServiceInstantiateWorkflowTemplate(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.InstantiateWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.InstantiateWorkflowTemplate(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestWorkflowTemplateServiceInstantiateWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.InstantiateWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.InstantiateWorkflowTemplate(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestWorkflowTemplateServiceInstantiateInlineWorkflowTemplate(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.InstantiateInlineWorkflowTemplateRequest{ + Parent: formattedParent, + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.InstantiateInlineWorkflowTemplate(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestWorkflowTemplateServiceInstantiateInlineWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.InstantiateInlineWorkflowTemplateRequest{ + Parent: formattedParent, + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.InstantiateInlineWorkflowTemplate(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestWorkflowTemplateServiceUpdateWorkflowTemplate(t *testing.T) { + var id string = "id3355" + var name string = "name3373707" + var version int32 = 351608024 + var expectedResponse = &dataprocpb.WorkflowTemplate{ + Id: id, + Name: name, + Version: version, + } + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.UpdateWorkflowTemplateRequest{ + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateWorkflowTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestWorkflowTemplateServiceUpdateWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.UpdateWorkflowTemplateRequest{ + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateWorkflowTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestWorkflowTemplateServiceListWorkflowTemplates(t *testing.T) { + var nextPageToken string = "" + var templatesElement *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var templates = []*dataprocpb.WorkflowTemplate{templatesElement} + var expectedResponse = &dataprocpb.ListWorkflowTemplatesResponse{ + NextPageToken: nextPageToken, + Templates: templates, + } + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var request = &dataprocpb.ListWorkflowTemplatesRequest{ + Parent: formattedParent, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListWorkflowTemplates(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Templates[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestWorkflowTemplateServiceListWorkflowTemplatesError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var request = &dataprocpb.ListWorkflowTemplatesRequest{ + Parent: formattedParent, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListWorkflowTemplates(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestWorkflowTemplateServiceDeleteWorkflowTemplate(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.DeleteWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteWorkflowTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestWorkflowTemplateServiceDeleteWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.DeleteWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteWorkflowTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1/workflow_template_client.go b/vendor/cloud.google.com/go/dataproc/apiv1/workflow_template_client.go new file mode 100644 index 000000000..c7817a664 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1/workflow_template_client.go @@ -0,0 +1,525 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// WorkflowTemplateCallOptions contains the retry settings for each method of WorkflowTemplateClient. +type WorkflowTemplateCallOptions struct { + CreateWorkflowTemplate []gax.CallOption + GetWorkflowTemplate []gax.CallOption + InstantiateWorkflowTemplate []gax.CallOption + InstantiateInlineWorkflowTemplate []gax.CallOption + UpdateWorkflowTemplate []gax.CallOption + ListWorkflowTemplates []gax.CallOption + DeleteWorkflowTemplate []gax.CallOption +} + +func defaultWorkflowTemplateClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dataproc.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultWorkflowTemplateCallOptions() *WorkflowTemplateCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"default", "non_idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &WorkflowTemplateCallOptions{ + CreateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + GetWorkflowTemplate: retry[[2]string{"default", "idempotent"}], + InstantiateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + InstantiateInlineWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + UpdateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + ListWorkflowTemplates: retry[[2]string{"default", "idempotent"}], + DeleteWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + } +} + +// WorkflowTemplateClient is a client for interacting with Google Cloud Dataproc API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type WorkflowTemplateClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + workflowTemplateClient dataprocpb.WorkflowTemplateServiceClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *WorkflowTemplateCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewWorkflowTemplateClient creates a new workflow template service client. +// +// The API interface for managing Workflow Templates in the +// Cloud Dataproc API. +func NewWorkflowTemplateClient(ctx context.Context, opts ...option.ClientOption) (*WorkflowTemplateClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultWorkflowTemplateClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &WorkflowTemplateClient{ + conn: conn, + CallOptions: defaultWorkflowTemplateCallOptions(), + + workflowTemplateClient: dataprocpb.NewWorkflowTemplateServiceClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *WorkflowTemplateClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *WorkflowTemplateClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *WorkflowTemplateClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// CreateWorkflowTemplate creates new workflow template. +func (c *WorkflowTemplateClient) CreateWorkflowTemplate(ctx context.Context, req *dataprocpb.CreateWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateWorkflowTemplate[0:len(c.CallOptions.CreateWorkflowTemplate):len(c.CallOptions.CreateWorkflowTemplate)], opts...) + var resp *dataprocpb.WorkflowTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.CreateWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetWorkflowTemplate retrieves the latest workflow template. +// +// Can retrieve previously instantiated template by specifying optional +// version parameter. +func (c *WorkflowTemplateClient) GetWorkflowTemplate(ctx context.Context, req *dataprocpb.GetWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetWorkflowTemplate[0:len(c.CallOptions.GetWorkflowTemplate):len(c.CallOptions.GetWorkflowTemplate)], opts...) + var resp *dataprocpb.WorkflowTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.GetWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// InstantiateWorkflowTemplate instantiates a template and begins execution. +// +// The returned Operation can be used to track execution of +// workflow by polling +// [operations.get][google.longrunning.Operations.GetOperation]. +// The Operation will complete when entire workflow is finished. +// +// The running workflow can be aborted via +// [operations.cancel][google.longrunning.Operations.CancelOperation]. +// This will cause any inflight jobs to be cancelled and workflow-owned +// clusters to be deleted. +// +// The [Operation.metadata][google.longrunning.Operation.metadata] will be +// [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata]. +// +// On successful completion, +// [Operation.response][google.longrunning.Operation.response] will be +// [Empty][google.protobuf.Empty]. +func (c *WorkflowTemplateClient) InstantiateWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateWorkflowTemplateRequest, opts ...gax.CallOption) (*InstantiateWorkflowTemplateOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.InstantiateWorkflowTemplate[0:len(c.CallOptions.InstantiateWorkflowTemplate):len(c.CallOptions.InstantiateWorkflowTemplate)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.InstantiateWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &InstantiateWorkflowTemplateOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// InstantiateInlineWorkflowTemplate instantiates a template and begins execution. +// +// This method is equivalent to executing the sequence +// [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], +// [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. +// +// The returned Operation can be used to track execution of +// workflow by polling +// [operations.get][google.longrunning.Operations.GetOperation]. +// The Operation will complete when entire workflow is finished. +// +// The running workflow can be aborted via +// [operations.cancel][google.longrunning.Operations.CancelOperation]. +// This will cause any inflight jobs to be cancelled and workflow-owned +// clusters to be deleted. +// +// The [Operation.metadata][google.longrunning.Operation.metadata] will be +// [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata]. +// +// On successful completion, +// [Operation.response][google.longrunning.Operation.response] will be +// [Empty][google.protobuf.Empty]. +func (c *WorkflowTemplateClient) InstantiateInlineWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateInlineWorkflowTemplateRequest, opts ...gax.CallOption) (*InstantiateInlineWorkflowTemplateOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.InstantiateInlineWorkflowTemplate[0:len(c.CallOptions.InstantiateInlineWorkflowTemplate):len(c.CallOptions.InstantiateInlineWorkflowTemplate)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.InstantiateInlineWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &InstantiateInlineWorkflowTemplateOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// UpdateWorkflowTemplate updates (replaces) workflow template. The updated template +// must contain version that matches the current server version. +func (c *WorkflowTemplateClient) UpdateWorkflowTemplate(ctx context.Context, req *dataprocpb.UpdateWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateWorkflowTemplate[0:len(c.CallOptions.UpdateWorkflowTemplate):len(c.CallOptions.UpdateWorkflowTemplate)], opts...) + var resp *dataprocpb.WorkflowTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.UpdateWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListWorkflowTemplates lists workflows that match the specified filter in the request. +func (c *WorkflowTemplateClient) ListWorkflowTemplates(ctx context.Context, req *dataprocpb.ListWorkflowTemplatesRequest, opts ...gax.CallOption) *WorkflowTemplateIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListWorkflowTemplates[0:len(c.CallOptions.ListWorkflowTemplates):len(c.CallOptions.ListWorkflowTemplates)], opts...) + it := &WorkflowTemplateIterator{} + req = proto.Clone(req).(*dataprocpb.ListWorkflowTemplatesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataprocpb.WorkflowTemplate, string, error) { + var resp *dataprocpb.ListWorkflowTemplatesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.ListWorkflowTemplates(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Templates, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteWorkflowTemplate deletes a workflow template. It does not cancel in-progress workflows. +func (c *WorkflowTemplateClient) DeleteWorkflowTemplate(ctx context.Context, req *dataprocpb.DeleteWorkflowTemplateRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteWorkflowTemplate[0:len(c.CallOptions.DeleteWorkflowTemplate):len(c.CallOptions.DeleteWorkflowTemplate)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.workflowTemplateClient.DeleteWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// WorkflowTemplateIterator manages a stream of *dataprocpb.WorkflowTemplate. +type WorkflowTemplateIterator struct { + items []*dataprocpb.WorkflowTemplate + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataprocpb.WorkflowTemplate, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *WorkflowTemplateIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *WorkflowTemplateIterator) Next() (*dataprocpb.WorkflowTemplate, error) { + var item *dataprocpb.WorkflowTemplate + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *WorkflowTemplateIterator) bufLen() int { + return len(it.items) +} + +func (it *WorkflowTemplateIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// InstantiateInlineWorkflowTemplateOperation manages a long-running operation from InstantiateInlineWorkflowTemplate. +type InstantiateInlineWorkflowTemplateOperation struct { + lro *longrunning.Operation +} + +// InstantiateInlineWorkflowTemplateOperation returns a new InstantiateInlineWorkflowTemplateOperation from a given name. +// The name must be that of a previously created InstantiateInlineWorkflowTemplateOperation, possibly from a different process. +func (c *WorkflowTemplateClient) InstantiateInlineWorkflowTemplateOperation(name string) *InstantiateInlineWorkflowTemplateOperation { + return &InstantiateInlineWorkflowTemplateOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *InstantiateInlineWorkflowTemplateOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *InstantiateInlineWorkflowTemplateOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *InstantiateInlineWorkflowTemplateOperation) Metadata() (*dataprocpb.WorkflowMetadata, error) { + var meta dataprocpb.WorkflowMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *InstantiateInlineWorkflowTemplateOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *InstantiateInlineWorkflowTemplateOperation) Name() string { + return op.lro.Name() +} + +// Cancel starts asynchronous cancellation on a long-running operation. +// The server makes a best effort to cancel the operation, but success is not guaranteed. +// Clients can use Poll or other methods to check whether the cancellation succeeded or whether the operation +// completed despite cancellation. On successful cancellation, the operation is not deleted; +// instead, op.Poll returns an error with code Canceled. +func (op *InstantiateInlineWorkflowTemplateOperation) Cancel(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Cancel(ctx, opts...) +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *InstantiateInlineWorkflowTemplateOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} + +// InstantiateWorkflowTemplateOperation manages a long-running operation from InstantiateWorkflowTemplate. +type InstantiateWorkflowTemplateOperation struct { + lro *longrunning.Operation +} + +// InstantiateWorkflowTemplateOperation returns a new InstantiateWorkflowTemplateOperation from a given name. +// The name must be that of a previously created InstantiateWorkflowTemplateOperation, possibly from a different process. +func (c *WorkflowTemplateClient) InstantiateWorkflowTemplateOperation(name string) *InstantiateWorkflowTemplateOperation { + return &InstantiateWorkflowTemplateOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *InstantiateWorkflowTemplateOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *InstantiateWorkflowTemplateOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *InstantiateWorkflowTemplateOperation) Metadata() (*dataprocpb.WorkflowMetadata, error) { + var meta dataprocpb.WorkflowMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *InstantiateWorkflowTemplateOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *InstantiateWorkflowTemplateOperation) Name() string { + return op.lro.Name() +} + +// Cancel starts asynchronous cancellation on a long-running operation. +// The server makes a best effort to cancel the operation, but success is not guaranteed. +// Clients can use Poll or other methods to check whether the cancellation succeeded or whether the operation +// completed despite cancellation. On successful cancellation, the operation is not deleted; +// instead, op.Poll returns an error with code Canceled. +func (op *InstantiateWorkflowTemplateOperation) Cancel(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Cancel(ctx, opts...) +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *InstantiateWorkflowTemplateOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1/workflow_template_client_example_test.go b/vendor/cloud.google.com/go/dataproc/apiv1/workflow_template_client_example_test.go new file mode 100644 index 000000000..0756d4bb8 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1/workflow_template_client_example_test.go @@ -0,0 +1,167 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc_test + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1" + "google.golang.org/api/iterator" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1" +) + +func ExampleNewWorkflowTemplateClient() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleWorkflowTemplateClient_CreateWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.CreateWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleWorkflowTemplateClient_GetWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.GetWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleWorkflowTemplateClient_InstantiateWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.InstantiateWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + op, err := c.InstantiateWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleWorkflowTemplateClient_InstantiateInlineWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.InstantiateInlineWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + op, err := c.InstantiateInlineWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleWorkflowTemplateClient_UpdateWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.UpdateWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleWorkflowTemplateClient_ListWorkflowTemplates() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.ListWorkflowTemplatesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListWorkflowTemplates(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleWorkflowTemplateClient_DeleteWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.DeleteWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1beta2/ListClusters_smoke_test.go b/vendor/cloud.google.com/go/dataproc/apiv1beta2/ListClusters_smoke_test.go new file mode 100644 index 000000000..020c8a068 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1beta2/ListClusters_smoke_test.go @@ -0,0 +1,69 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestClusterControllerSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClusterControllerClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var projectId2 string = projectId + var region string = "global" + var request = &dataprocpb.ListClustersRequest{ + ProjectId: projectId2, + Region: region, + } + + iter := c.ListClusters(ctx, request) + if _, err := iter.Next(); err != nil && err != iterator.Done { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1beta2/cluster_controller_client.go b/vendor/cloud.google.com/go/dataproc/apiv1beta2/cluster_controller_client.go new file mode 100644 index 000000000..25c3d575b --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1beta2/cluster_controller_client.go @@ -0,0 +1,609 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ClusterControllerCallOptions contains the retry settings for each method of ClusterControllerClient. +type ClusterControllerCallOptions struct { + CreateCluster []gax.CallOption + UpdateCluster []gax.CallOption + DeleteCluster []gax.CallOption + GetCluster []gax.CallOption + ListClusters []gax.CallOption + DiagnoseCluster []gax.CallOption +} + +func defaultClusterControllerClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dataproc.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultClusterControllerCallOptions() *ClusterControllerCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"default", "non_idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ClusterControllerCallOptions{ + CreateCluster: retry[[2]string{"default", "non_idempotent"}], + UpdateCluster: retry[[2]string{"default", "non_idempotent"}], + DeleteCluster: retry[[2]string{"default", "non_idempotent"}], + GetCluster: retry[[2]string{"default", "idempotent"}], + ListClusters: retry[[2]string{"default", "idempotent"}], + DiagnoseCluster: retry[[2]string{"default", "non_idempotent"}], + } +} + +// ClusterControllerClient is a client for interacting with Google Cloud Dataproc API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ClusterControllerClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + clusterControllerClient dataprocpb.ClusterControllerClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *ClusterControllerCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClusterControllerClient creates a new cluster controller client. +// +// The ClusterControllerService provides methods to manage clusters +// of Compute Engine instances. +func NewClusterControllerClient(ctx context.Context, opts ...option.ClientOption) (*ClusterControllerClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClusterControllerClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ClusterControllerClient{ + conn: conn, + CallOptions: defaultClusterControllerCallOptions(), + + clusterControllerClient: dataprocpb.NewClusterControllerClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ClusterControllerClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ClusterControllerClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ClusterControllerClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// CreateCluster creates a cluster in a project. +func (c *ClusterControllerClient) CreateCluster(ctx context.Context, req *dataprocpb.CreateClusterRequest, opts ...gax.CallOption) (*CreateClusterOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateCluster[0:len(c.CallOptions.CreateCluster):len(c.CallOptions.CreateCluster)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.CreateCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// UpdateCluster updates a cluster in a project. +func (c *ClusterControllerClient) UpdateCluster(ctx context.Context, req *dataprocpb.UpdateClusterRequest, opts ...gax.CallOption) (*UpdateClusterOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateCluster[0:len(c.CallOptions.UpdateCluster):len(c.CallOptions.UpdateCluster)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.UpdateCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DeleteCluster deletes a cluster in a project. +func (c *ClusterControllerClient) DeleteCluster(ctx context.Context, req *dataprocpb.DeleteClusterRequest, opts ...gax.CallOption) (*DeleteClusterOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteCluster[0:len(c.CallOptions.DeleteCluster):len(c.CallOptions.DeleteCluster)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.DeleteCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// GetCluster gets the resource representation for a cluster in a project. +func (c *ClusterControllerClient) GetCluster(ctx context.Context, req *dataprocpb.GetClusterRequest, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetCluster[0:len(c.CallOptions.GetCluster):len(c.CallOptions.GetCluster)], opts...) + var resp *dataprocpb.Cluster + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.GetCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListClusters lists all regions/{region}/clusters in a project. +func (c *ClusterControllerClient) ListClusters(ctx context.Context, req *dataprocpb.ListClustersRequest, opts ...gax.CallOption) *ClusterIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListClusters[0:len(c.CallOptions.ListClusters):len(c.CallOptions.ListClusters)], opts...) + it := &ClusterIterator{} + req = proto.Clone(req).(*dataprocpb.ListClustersRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataprocpb.Cluster, string, error) { + var resp *dataprocpb.ListClustersResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.ListClusters(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Clusters, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DiagnoseCluster gets cluster diagnostic information. +// After the operation completes, the Operation.response field +// contains DiagnoseClusterOutputLocation. +func (c *ClusterControllerClient) DiagnoseCluster(ctx context.Context, req *dataprocpb.DiagnoseClusterRequest, opts ...gax.CallOption) (*DiagnoseClusterOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DiagnoseCluster[0:len(c.CallOptions.DiagnoseCluster):len(c.CallOptions.DiagnoseCluster)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.clusterControllerClient.DiagnoseCluster(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DiagnoseClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ClusterIterator manages a stream of *dataprocpb.Cluster. +type ClusterIterator struct { + items []*dataprocpb.Cluster + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataprocpb.Cluster, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ClusterIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ClusterIterator) Next() (*dataprocpb.Cluster, error) { + var item *dataprocpb.Cluster + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ClusterIterator) bufLen() int { + return len(it.items) +} + +func (it *ClusterIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// CreateClusterOperation manages a long-running operation from CreateCluster. +type CreateClusterOperation struct { + lro *longrunning.Operation +} + +// CreateClusterOperation returns a new CreateClusterOperation from a given name. +// The name must be that of a previously created CreateClusterOperation, possibly from a different process. +func (c *ClusterControllerClient) CreateClusterOperation(name string) *CreateClusterOperation { + return &CreateClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + var resp dataprocpb.Cluster + if err := op.lro.WaitWithInterval(ctx, &resp, 10000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + var resp dataprocpb.Cluster + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateClusterOperation) Metadata() (*dataprocpb.ClusterOperationMetadata, error) { + var meta dataprocpb.ClusterOperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateClusterOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateClusterOperation) Name() string { + return op.lro.Name() +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *CreateClusterOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} + +// DeleteClusterOperation manages a long-running operation from DeleteCluster. +type DeleteClusterOperation struct { + lro *longrunning.Operation +} + +// DeleteClusterOperation returns a new DeleteClusterOperation from a given name. +// The name must be that of a previously created DeleteClusterOperation, possibly from a different process. +func (c *ClusterControllerClient) DeleteClusterOperation(name string) *DeleteClusterOperation { + return &DeleteClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeleteClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *DeleteClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteClusterOperation) Metadata() (*dataprocpb.ClusterOperationMetadata, error) { + var meta dataprocpb.ClusterOperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeleteClusterOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeleteClusterOperation) Name() string { + return op.lro.Name() +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *DeleteClusterOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} + +// DiagnoseClusterOperation manages a long-running operation from DiagnoseCluster. +type DiagnoseClusterOperation struct { + lro *longrunning.Operation +} + +// DiagnoseClusterOperation returns a new DiagnoseClusterOperation from a given name. +// The name must be that of a previously created DiagnoseClusterOperation, possibly from a different process. +func (c *ClusterControllerClient) DiagnoseClusterOperation(name string) *DiagnoseClusterOperation { + return &DiagnoseClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *DiagnoseClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *DiagnoseClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DiagnoseClusterOperation) Metadata() (*dataprocpb.DiagnoseClusterResults, error) { + var meta dataprocpb.DiagnoseClusterResults + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DiagnoseClusterOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DiagnoseClusterOperation) Name() string { + return op.lro.Name() +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *DiagnoseClusterOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} + +// UpdateClusterOperation manages a long-running operation from UpdateCluster. +type UpdateClusterOperation struct { + lro *longrunning.Operation +} + +// UpdateClusterOperation returns a new UpdateClusterOperation from a given name. +// The name must be that of a previously created UpdateClusterOperation, possibly from a different process. +func (c *ClusterControllerClient) UpdateClusterOperation(name string) *UpdateClusterOperation { + return &UpdateClusterOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + var resp dataprocpb.Cluster + if err := op.lro.WaitWithInterval(ctx, &resp, 10000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *UpdateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dataprocpb.Cluster, error) { + var resp dataprocpb.Cluster + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateClusterOperation) Metadata() (*dataprocpb.ClusterOperationMetadata, error) { + var meta dataprocpb.ClusterOperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateClusterOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateClusterOperation) Name() string { + return op.lro.Name() +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *UpdateClusterOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1beta2/cluster_controller_client_example_test.go b/vendor/cloud.google.com/go/dataproc/apiv1beta2/cluster_controller_client_example_test.go new file mode 100644 index 000000000..f6c18bc07 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1beta2/cluster_controller_client_example_test.go @@ -0,0 +1,161 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc_test + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1beta2" + "google.golang.org/api/iterator" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2" +) + +func ExampleNewClusterControllerClient() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClusterControllerClient_CreateCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.CreateClusterRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterControllerClient_UpdateCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.UpdateClusterRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterControllerClient_DeleteCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.DeleteClusterRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleClusterControllerClient_GetCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.GetClusterRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClusterControllerClient_ListClusters() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.ListClustersRequest{ + // TODO: Fill request struct fields. + } + it := c.ListClusters(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClusterControllerClient_DiagnoseCluster() { + ctx := context.Background() + c, err := dataproc.NewClusterControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.DiagnoseClusterRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DiagnoseCluster(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1beta2/doc.go b/vendor/cloud.google.com/go/dataproc/apiv1beta2/doc.go new file mode 100644 index 000000000..de8a575c9 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1beta2/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package dataproc is an auto-generated package for the +// Google Cloud Dataproc API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Manages Hadoop-based clusters and jobs on Google Cloud Platform. +package dataproc // import "cloud.google.com/go/dataproc/apiv1beta2" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/dataproc/apiv1beta2/job_controller_client.go b/vendor/cloud.google.com/go/dataproc/apiv1beta2/job_controller_client.go new file mode 100644 index 000000000..6049a7dbd --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1beta2/job_controller_client.go @@ -0,0 +1,301 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// JobControllerCallOptions contains the retry settings for each method of JobControllerClient. +type JobControllerCallOptions struct { + SubmitJob []gax.CallOption + GetJob []gax.CallOption + ListJobs []gax.CallOption + UpdateJob []gax.CallOption + CancelJob []gax.CallOption + DeleteJob []gax.CallOption +} + +func defaultJobControllerClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dataproc.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultJobControllerCallOptions() *JobControllerCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"default", "non_idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &JobControllerCallOptions{ + SubmitJob: retry[[2]string{"default", "non_idempotent"}], + GetJob: retry[[2]string{"default", "idempotent"}], + ListJobs: retry[[2]string{"default", "idempotent"}], + UpdateJob: retry[[2]string{"default", "non_idempotent"}], + CancelJob: retry[[2]string{"default", "idempotent"}], + DeleteJob: retry[[2]string{"default", "non_idempotent"}], + } +} + +// JobControllerClient is a client for interacting with Google Cloud Dataproc API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type JobControllerClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + jobControllerClient dataprocpb.JobControllerClient + + // The call options for this service. + CallOptions *JobControllerCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewJobControllerClient creates a new job controller client. +// +// The JobController provides methods to manage jobs. +func NewJobControllerClient(ctx context.Context, opts ...option.ClientOption) (*JobControllerClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultJobControllerClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &JobControllerClient{ + conn: conn, + CallOptions: defaultJobControllerCallOptions(), + + jobControllerClient: dataprocpb.NewJobControllerClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *JobControllerClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *JobControllerClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *JobControllerClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// SubmitJob submits a job to a cluster. +func (c *JobControllerClient) SubmitJob(ctx context.Context, req *dataprocpb.SubmitJobRequest, opts ...gax.CallOption) (*dataprocpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SubmitJob[0:len(c.CallOptions.SubmitJob):len(c.CallOptions.SubmitJob)], opts...) + var resp *dataprocpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.SubmitJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetJob gets the resource representation for a job in a project. +func (c *JobControllerClient) GetJob(ctx context.Context, req *dataprocpb.GetJobRequest, opts ...gax.CallOption) (*dataprocpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetJob[0:len(c.CallOptions.GetJob):len(c.CallOptions.GetJob)], opts...) + var resp *dataprocpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.GetJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListJobs lists regions/{region}/jobs in a project. +func (c *JobControllerClient) ListJobs(ctx context.Context, req *dataprocpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListJobs[0:len(c.CallOptions.ListJobs):len(c.CallOptions.ListJobs)], opts...) + it := &JobIterator{} + req = proto.Clone(req).(*dataprocpb.ListJobsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataprocpb.Job, string, error) { + var resp *dataprocpb.ListJobsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.ListJobs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Jobs, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// UpdateJob updates a job in a project. +func (c *JobControllerClient) UpdateJob(ctx context.Context, req *dataprocpb.UpdateJobRequest, opts ...gax.CallOption) (*dataprocpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateJob[0:len(c.CallOptions.UpdateJob):len(c.CallOptions.UpdateJob)], opts...) + var resp *dataprocpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.UpdateJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CancelJob starts a job cancellation request. To access the job resource +// after cancellation, call +// regions/{region}/jobs.list (at /dataproc/docs/reference/rest/v1beta2/projects.regions.jobs/list) or +// regions/{region}/jobs.get (at /dataproc/docs/reference/rest/v1beta2/projects.regions.jobs/get). +func (c *JobControllerClient) CancelJob(ctx context.Context, req *dataprocpb.CancelJobRequest, opts ...gax.CallOption) (*dataprocpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CancelJob[0:len(c.CallOptions.CancelJob):len(c.CallOptions.CancelJob)], opts...) + var resp *dataprocpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.jobControllerClient.CancelJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteJob deletes the job from the project. If the job is active, the delete fails, +// and the response returns FAILED_PRECONDITION. +func (c *JobControllerClient) DeleteJob(ctx context.Context, req *dataprocpb.DeleteJobRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteJob[0:len(c.CallOptions.DeleteJob):len(c.CallOptions.DeleteJob)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.jobControllerClient.DeleteJob(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// JobIterator manages a stream of *dataprocpb.Job. +type JobIterator struct { + items []*dataprocpb.Job + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataprocpb.Job, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *JobIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *JobIterator) Next() (*dataprocpb.Job, error) { + var item *dataprocpb.Job + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *JobIterator) bufLen() int { + return len(it.items) +} + +func (it *JobIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1beta2/job_controller_client_example_test.go b/vendor/cloud.google.com/go/dataproc/apiv1beta2/job_controller_client_example_test.go new file mode 100644 index 000000000..588d0a79a --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1beta2/job_controller_client_example_test.go @@ -0,0 +1,147 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc_test + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1beta2" + "google.golang.org/api/iterator" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2" +) + +func ExampleNewJobControllerClient() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleJobControllerClient_SubmitJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.SubmitJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SubmitJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobControllerClient_GetJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.GetJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobControllerClient_ListJobs() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.ListJobsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListJobs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleJobControllerClient_UpdateJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.UpdateJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobControllerClient_CancelJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.CancelJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CancelJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleJobControllerClient_DeleteJob() { + ctx := context.Background() + c, err := dataproc.NewJobControllerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.DeleteJobRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteJob(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1beta2/mock_test.go b/vendor/cloud.google.com/go/dataproc/apiv1beta2/mock_test.go new file mode 100644 index 000000000..733f2dddd --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1beta2/mock_test.go @@ -0,0 +1,1790 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + field_maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockClusterControllerServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dataprocpb.ClusterControllerServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockClusterControllerServer) CreateCluster(ctx context.Context, req *dataprocpb.CreateClusterRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockClusterControllerServer) UpdateCluster(ctx context.Context, req *dataprocpb.UpdateClusterRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockClusterControllerServer) DeleteCluster(ctx context.Context, req *dataprocpb.DeleteClusterRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockClusterControllerServer) GetCluster(ctx context.Context, req *dataprocpb.GetClusterRequest) (*dataprocpb.Cluster, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Cluster), nil +} + +func (s *mockClusterControllerServer) ListClusters(ctx context.Context, req *dataprocpb.ListClustersRequest) (*dataprocpb.ListClustersResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.ListClustersResponse), nil +} + +func (s *mockClusterControllerServer) DiagnoseCluster(ctx context.Context, req *dataprocpb.DiagnoseClusterRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +type mockJobControllerServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dataprocpb.JobControllerServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockJobControllerServer) SubmitJob(ctx context.Context, req *dataprocpb.SubmitJobRequest) (*dataprocpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Job), nil +} + +func (s *mockJobControllerServer) GetJob(ctx context.Context, req *dataprocpb.GetJobRequest) (*dataprocpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Job), nil +} + +func (s *mockJobControllerServer) ListJobs(ctx context.Context, req *dataprocpb.ListJobsRequest) (*dataprocpb.ListJobsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.ListJobsResponse), nil +} + +func (s *mockJobControllerServer) UpdateJob(ctx context.Context, req *dataprocpb.UpdateJobRequest) (*dataprocpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Job), nil +} + +func (s *mockJobControllerServer) CancelJob(ctx context.Context, req *dataprocpb.CancelJobRequest) (*dataprocpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.Job), nil +} + +func (s *mockJobControllerServer) DeleteJob(ctx context.Context, req *dataprocpb.DeleteJobRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +type mockWorkflowTemplateServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dataprocpb.WorkflowTemplateServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockWorkflowTemplateServer) CreateWorkflowTemplate(ctx context.Context, req *dataprocpb.CreateWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.WorkflowTemplate), nil +} + +func (s *mockWorkflowTemplateServer) GetWorkflowTemplate(ctx context.Context, req *dataprocpb.GetWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.WorkflowTemplate), nil +} + +func (s *mockWorkflowTemplateServer) InstantiateWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateWorkflowTemplateRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockWorkflowTemplateServer) InstantiateInlineWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateInlineWorkflowTemplateRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockWorkflowTemplateServer) UpdateWorkflowTemplate(ctx context.Context, req *dataprocpb.UpdateWorkflowTemplateRequest) (*dataprocpb.WorkflowTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.WorkflowTemplate), nil +} + +func (s *mockWorkflowTemplateServer) ListWorkflowTemplates(ctx context.Context, req *dataprocpb.ListWorkflowTemplatesRequest) (*dataprocpb.ListWorkflowTemplatesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dataprocpb.ListWorkflowTemplatesResponse), nil +} + +func (s *mockWorkflowTemplateServer) DeleteWorkflowTemplate(ctx context.Context, req *dataprocpb.DeleteWorkflowTemplateRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockClusterController mockClusterControllerServer + mockJobController mockJobControllerServer + mockWorkflowTemplate mockWorkflowTemplateServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + dataprocpb.RegisterClusterControllerServer(serv, &mockClusterController) + dataprocpb.RegisterJobControllerServer(serv, &mockJobController) + dataprocpb.RegisterWorkflowTemplateServiceServer(serv, &mockWorkflowTemplate) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestClusterControllerCreateCluster(t *testing.T) { + var projectId2 string = "projectId2939242356" + var clusterName string = "clusterName-1018081872" + var clusterUuid string = "clusterUuid-1017854240" + var expectedResponse = &dataprocpb.Cluster{ + ProjectId: projectId2, + ClusterName: clusterName, + ClusterUuid: clusterUuid, + } + + mockClusterController.err = nil + mockClusterController.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var cluster *dataprocpb.Cluster = &dataprocpb.Cluster{} + var request = &dataprocpb.CreateClusterRequest{ + ProjectId: projectId, + Region: region, + Cluster: cluster, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterControllerCreateClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = nil + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var cluster *dataprocpb.Cluster = &dataprocpb.Cluster{} + var request = &dataprocpb.CreateClusterRequest{ + ProjectId: projectId, + Region: region, + Cluster: cluster, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterControllerUpdateCluster(t *testing.T) { + var projectId2 string = "projectId2939242356" + var clusterName2 string = "clusterName2875867491" + var clusterUuid string = "clusterUuid-1017854240" + var expectedResponse = &dataprocpb.Cluster{ + ProjectId: projectId2, + ClusterName: clusterName2, + ClusterUuid: clusterUuid, + } + + mockClusterController.err = nil + mockClusterController.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var cluster *dataprocpb.Cluster = &dataprocpb.Cluster{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &dataprocpb.UpdateClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + Cluster: cluster, + UpdateMask: updateMask, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterControllerUpdateClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = nil + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var cluster *dataprocpb.Cluster = &dataprocpb.Cluster{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &dataprocpb.UpdateClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + Cluster: cluster, + UpdateMask: updateMask, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterControllerDeleteCluster(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockClusterController.err = nil + mockClusterController.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.DeleteClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DeleteCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestClusterControllerDeleteClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = nil + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.DeleteClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DeleteCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestClusterControllerGetCluster(t *testing.T) { + var projectId2 string = "projectId2939242356" + var clusterName2 string = "clusterName2875867491" + var clusterUuid string = "clusterUuid-1017854240" + var expectedResponse = &dataprocpb.Cluster{ + ProjectId: projectId2, + ClusterName: clusterName2, + ClusterUuid: clusterUuid, + } + + mockClusterController.err = nil + mockClusterController.reqs = nil + + mockClusterController.resps = append(mockClusterController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.GetClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCluster(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterControllerGetClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.GetClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCluster(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterControllerListClusters(t *testing.T) { + var nextPageToken string = "" + var clustersElement *dataprocpb.Cluster = &dataprocpb.Cluster{} + var clusters = []*dataprocpb.Cluster{clustersElement} + var expectedResponse = &dataprocpb.ListClustersResponse{ + NextPageToken: nextPageToken, + Clusters: clusters, + } + + mockClusterController.err = nil + mockClusterController.reqs = nil + + mockClusterController.resps = append(mockClusterController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var request = &dataprocpb.ListClustersRequest{ + ProjectId: projectId, + Region: region, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListClusters(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Clusters[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestClusterControllerListClustersError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var request = &dataprocpb.ListClustersRequest{ + ProjectId: projectId, + Region: region, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListClusters(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestClusterControllerDiagnoseCluster(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockClusterController.err = nil + mockClusterController.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.DiagnoseClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DiagnoseCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockClusterController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestClusterControllerDiagnoseClusterError(t *testing.T) { + errCode := codes.PermissionDenied + mockClusterController.err = nil + mockClusterController.resps = append(mockClusterController.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var clusterName string = "clusterName-1018081872" + var request = &dataprocpb.DiagnoseClusterRequest{ + ProjectId: projectId, + Region: region, + ClusterName: clusterName, + } + + c, err := NewClusterControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DiagnoseCluster(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestJobControllerSubmitJob(t *testing.T) { + var submittedBy string = "submittedBy-2047729125" + var driverOutputResourceUri string = "driverOutputResourceUri-542229086" + var driverControlFilesUri string = "driverControlFilesUri207057643" + var jobUuid string = "jobUuid-1615012099" + var expectedResponse = &dataprocpb.Job{ + SubmittedBy: submittedBy, + DriverOutputResourceUri: driverOutputResourceUri, + DriverControlFilesUri: driverControlFilesUri, + JobUuid: jobUuid, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var job *dataprocpb.Job = &dataprocpb.Job{} + var request = &dataprocpb.SubmitJobRequest{ + ProjectId: projectId, + Region: region, + Job: job, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SubmitJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerSubmitJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var job *dataprocpb.Job = &dataprocpb.Job{} + var request = &dataprocpb.SubmitJobRequest{ + ProjectId: projectId, + Region: region, + Job: job, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SubmitJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerGetJob(t *testing.T) { + var submittedBy string = "submittedBy-2047729125" + var driverOutputResourceUri string = "driverOutputResourceUri-542229086" + var driverControlFilesUri string = "driverControlFilesUri207057643" + var jobUuid string = "jobUuid-1615012099" + var expectedResponse = &dataprocpb.Job{ + SubmittedBy: submittedBy, + DriverOutputResourceUri: driverOutputResourceUri, + DriverControlFilesUri: driverControlFilesUri, + JobUuid: jobUuid, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.GetJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerGetJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.GetJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerListJobs(t *testing.T) { + var nextPageToken string = "" + var jobsElement *dataprocpb.Job = &dataprocpb.Job{} + var jobs = []*dataprocpb.Job{jobsElement} + var expectedResponse = &dataprocpb.ListJobsResponse{ + NextPageToken: nextPageToken, + Jobs: jobs, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var request = &dataprocpb.ListJobsRequest{ + ProjectId: projectId, + Region: region, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListJobs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Jobs[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerListJobsError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var request = &dataprocpb.ListJobsRequest{ + ProjectId: projectId, + Region: region, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListJobs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerUpdateJob(t *testing.T) { + var submittedBy string = "submittedBy-2047729125" + var driverOutputResourceUri string = "driverOutputResourceUri-542229086" + var driverControlFilesUri string = "driverControlFilesUri207057643" + var jobUuid string = "jobUuid-1615012099" + var expectedResponse = &dataprocpb.Job{ + SubmittedBy: submittedBy, + DriverOutputResourceUri: driverOutputResourceUri, + DriverControlFilesUri: driverControlFilesUri, + JobUuid: jobUuid, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var job *dataprocpb.Job = &dataprocpb.Job{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &dataprocpb.UpdateJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + Job: job, + UpdateMask: updateMask, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerUpdateJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var job *dataprocpb.Job = &dataprocpb.Job{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &dataprocpb.UpdateJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + Job: job, + UpdateMask: updateMask, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerCancelJob(t *testing.T) { + var submittedBy string = "submittedBy-2047729125" + var driverOutputResourceUri string = "driverOutputResourceUri-542229086" + var driverControlFilesUri string = "driverControlFilesUri207057643" + var jobUuid string = "jobUuid-1615012099" + var expectedResponse = &dataprocpb.Job{ + SubmittedBy: submittedBy, + DriverOutputResourceUri: driverOutputResourceUri, + DriverControlFilesUri: driverControlFilesUri, + JobUuid: jobUuid, + } + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.CancelJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CancelJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestJobControllerCancelJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.CancelJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CancelJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestJobControllerDeleteJob(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockJobController.err = nil + mockJobController.reqs = nil + + mockJobController.resps = append(mockJobController.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.DeleteJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockJobController.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestJobControllerDeleteJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockJobController.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var region string = "region-934795532" + var jobId string = "jobId-1154752291" + var request = &dataprocpb.DeleteJobRequest{ + ProjectId: projectId, + Region: region, + JobId: jobId, + } + + c, err := NewJobControllerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestWorkflowTemplateServiceCreateWorkflowTemplate(t *testing.T) { + var id string = "id3355" + var name string = "name3373707" + var version int32 = 351608024 + var expectedResponse = &dataprocpb.WorkflowTemplate{ + Id: id, + Name: name, + Version: version, + } + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.CreateWorkflowTemplateRequest{ + Parent: formattedParent, + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateWorkflowTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestWorkflowTemplateServiceCreateWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.CreateWorkflowTemplateRequest{ + Parent: formattedParent, + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateWorkflowTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestWorkflowTemplateServiceGetWorkflowTemplate(t *testing.T) { + var id string = "id3355" + var name2 string = "name2-1052831874" + var version int32 = 351608024 + var expectedResponse = &dataprocpb.WorkflowTemplate{ + Id: id, + Name: name2, + Version: version, + } + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.GetWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetWorkflowTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestWorkflowTemplateServiceGetWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.GetWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetWorkflowTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestWorkflowTemplateServiceInstantiateWorkflowTemplate(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.InstantiateWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.InstantiateWorkflowTemplate(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestWorkflowTemplateServiceInstantiateWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.InstantiateWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.InstantiateWorkflowTemplate(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestWorkflowTemplateServiceInstantiateInlineWorkflowTemplate(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.InstantiateInlineWorkflowTemplateRequest{ + Parent: formattedParent, + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.InstantiateInlineWorkflowTemplate(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestWorkflowTemplateServiceInstantiateInlineWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.InstantiateInlineWorkflowTemplateRequest{ + Parent: formattedParent, + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.InstantiateInlineWorkflowTemplate(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestWorkflowTemplateServiceUpdateWorkflowTemplate(t *testing.T) { + var id string = "id3355" + var name string = "name3373707" + var version int32 = 351608024 + var expectedResponse = &dataprocpb.WorkflowTemplate{ + Id: id, + Name: name, + Version: version, + } + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.UpdateWorkflowTemplateRequest{ + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateWorkflowTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestWorkflowTemplateServiceUpdateWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var template *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var request = &dataprocpb.UpdateWorkflowTemplateRequest{ + Template: template, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateWorkflowTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestWorkflowTemplateServiceListWorkflowTemplates(t *testing.T) { + var nextPageToken string = "" + var templatesElement *dataprocpb.WorkflowTemplate = &dataprocpb.WorkflowTemplate{} + var templates = []*dataprocpb.WorkflowTemplate{templatesElement} + var expectedResponse = &dataprocpb.ListWorkflowTemplatesResponse{ + NextPageToken: nextPageToken, + Templates: templates, + } + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var request = &dataprocpb.ListWorkflowTemplatesRequest{ + Parent: formattedParent, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListWorkflowTemplates(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Templates[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestWorkflowTemplateServiceListWorkflowTemplatesError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/regions/%s", "[PROJECT]", "[REGION]") + var request = &dataprocpb.ListWorkflowTemplatesRequest{ + Parent: formattedParent, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListWorkflowTemplates(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestWorkflowTemplateServiceDeleteWorkflowTemplate(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockWorkflowTemplate.err = nil + mockWorkflowTemplate.reqs = nil + + mockWorkflowTemplate.resps = append(mockWorkflowTemplate.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.DeleteWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteWorkflowTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockWorkflowTemplate.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestWorkflowTemplateServiceDeleteWorkflowTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockWorkflowTemplate.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/regions/%s/workflowTemplates/%s", "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") + var request = &dataprocpb.DeleteWorkflowTemplateRequest{ + Name: formattedName, + } + + c, err := NewWorkflowTemplateClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteWorkflowTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1beta2/workflow_template_client.go b/vendor/cloud.google.com/go/dataproc/apiv1beta2/workflow_template_client.go new file mode 100644 index 000000000..4af9232b0 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1beta2/workflow_template_client.go @@ -0,0 +1,525 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// WorkflowTemplateCallOptions contains the retry settings for each method of WorkflowTemplateClient. +type WorkflowTemplateCallOptions struct { + CreateWorkflowTemplate []gax.CallOption + GetWorkflowTemplate []gax.CallOption + InstantiateWorkflowTemplate []gax.CallOption + InstantiateInlineWorkflowTemplate []gax.CallOption + UpdateWorkflowTemplate []gax.CallOption + ListWorkflowTemplates []gax.CallOption + DeleteWorkflowTemplate []gax.CallOption +} + +func defaultWorkflowTemplateClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dataproc.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultWorkflowTemplateCallOptions() *WorkflowTemplateCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"default", "non_idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &WorkflowTemplateCallOptions{ + CreateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + GetWorkflowTemplate: retry[[2]string{"default", "idempotent"}], + InstantiateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + InstantiateInlineWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + UpdateWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + ListWorkflowTemplates: retry[[2]string{"default", "idempotent"}], + DeleteWorkflowTemplate: retry[[2]string{"default", "non_idempotent"}], + } +} + +// WorkflowTemplateClient is a client for interacting with Google Cloud Dataproc API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type WorkflowTemplateClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + workflowTemplateClient dataprocpb.WorkflowTemplateServiceClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *WorkflowTemplateCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewWorkflowTemplateClient creates a new workflow template service client. +// +// The API interface for managing Workflow Templates in the +// Cloud Dataproc API. +func NewWorkflowTemplateClient(ctx context.Context, opts ...option.ClientOption) (*WorkflowTemplateClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultWorkflowTemplateClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &WorkflowTemplateClient{ + conn: conn, + CallOptions: defaultWorkflowTemplateCallOptions(), + + workflowTemplateClient: dataprocpb.NewWorkflowTemplateServiceClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *WorkflowTemplateClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *WorkflowTemplateClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *WorkflowTemplateClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// CreateWorkflowTemplate creates new workflow template. +func (c *WorkflowTemplateClient) CreateWorkflowTemplate(ctx context.Context, req *dataprocpb.CreateWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateWorkflowTemplate[0:len(c.CallOptions.CreateWorkflowTemplate):len(c.CallOptions.CreateWorkflowTemplate)], opts...) + var resp *dataprocpb.WorkflowTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.CreateWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetWorkflowTemplate retrieves the latest workflow template. +// +// Can retrieve previously instantiated template by specifying optional +// version parameter. +func (c *WorkflowTemplateClient) GetWorkflowTemplate(ctx context.Context, req *dataprocpb.GetWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetWorkflowTemplate[0:len(c.CallOptions.GetWorkflowTemplate):len(c.CallOptions.GetWorkflowTemplate)], opts...) + var resp *dataprocpb.WorkflowTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.GetWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// InstantiateWorkflowTemplate instantiates a template and begins execution. +// +// The returned Operation can be used to track execution of +// workflow by polling +// [operations.get][google.longrunning.Operations.GetOperation]. +// The Operation will complete when entire workflow is finished. +// +// The running workflow can be aborted via +// [operations.cancel][google.longrunning.Operations.CancelOperation]. +// This will cause any inflight jobs to be cancelled and workflow-owned +// clusters to be deleted. +// +// The [Operation.metadata][google.longrunning.Operation.metadata] will be +// [WorkflowMetadata][google.cloud.dataproc.v1beta2.WorkflowMetadata]. +// +// On successful completion, +// [Operation.response][google.longrunning.Operation.response] will be +// [Empty][google.protobuf.Empty]. +func (c *WorkflowTemplateClient) InstantiateWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateWorkflowTemplateRequest, opts ...gax.CallOption) (*InstantiateWorkflowTemplateOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.InstantiateWorkflowTemplate[0:len(c.CallOptions.InstantiateWorkflowTemplate):len(c.CallOptions.InstantiateWorkflowTemplate)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.InstantiateWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &InstantiateWorkflowTemplateOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// InstantiateInlineWorkflowTemplate instantiates a template and begins execution. +// +// This method is equivalent to executing the sequence +// [CreateWorkflowTemplate][google.cloud.dataproc.v1beta2.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1beta2.WorkflowTemplateService.InstantiateWorkflowTemplate], +// [DeleteWorkflowTemplate][google.cloud.dataproc.v1beta2.WorkflowTemplateService.DeleteWorkflowTemplate]. +// +// The returned Operation can be used to track execution of +// workflow by polling +// [operations.get][google.longrunning.Operations.GetOperation]. +// The Operation will complete when entire workflow is finished. +// +// The running workflow can be aborted via +// [operations.cancel][google.longrunning.Operations.CancelOperation]. +// This will cause any inflight jobs to be cancelled and workflow-owned +// clusters to be deleted. +// +// The [Operation.metadata][google.longrunning.Operation.metadata] will be +// [WorkflowMetadata][google.cloud.dataproc.v1beta2.WorkflowMetadata]. +// +// On successful completion, +// [Operation.response][google.longrunning.Operation.response] will be +// [Empty][google.protobuf.Empty]. +func (c *WorkflowTemplateClient) InstantiateInlineWorkflowTemplate(ctx context.Context, req *dataprocpb.InstantiateInlineWorkflowTemplateRequest, opts ...gax.CallOption) (*InstantiateInlineWorkflowTemplateOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.InstantiateInlineWorkflowTemplate[0:len(c.CallOptions.InstantiateInlineWorkflowTemplate):len(c.CallOptions.InstantiateInlineWorkflowTemplate)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.InstantiateInlineWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &InstantiateInlineWorkflowTemplateOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// UpdateWorkflowTemplate updates (replaces) workflow template. The updated template +// must contain version that matches the current server version. +func (c *WorkflowTemplateClient) UpdateWorkflowTemplate(ctx context.Context, req *dataprocpb.UpdateWorkflowTemplateRequest, opts ...gax.CallOption) (*dataprocpb.WorkflowTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateWorkflowTemplate[0:len(c.CallOptions.UpdateWorkflowTemplate):len(c.CallOptions.UpdateWorkflowTemplate)], opts...) + var resp *dataprocpb.WorkflowTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.UpdateWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListWorkflowTemplates lists workflows that match the specified filter in the request. +func (c *WorkflowTemplateClient) ListWorkflowTemplates(ctx context.Context, req *dataprocpb.ListWorkflowTemplatesRequest, opts ...gax.CallOption) *WorkflowTemplateIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListWorkflowTemplates[0:len(c.CallOptions.ListWorkflowTemplates):len(c.CallOptions.ListWorkflowTemplates)], opts...) + it := &WorkflowTemplateIterator{} + req = proto.Clone(req).(*dataprocpb.ListWorkflowTemplatesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dataprocpb.WorkflowTemplate, string, error) { + var resp *dataprocpb.ListWorkflowTemplatesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.workflowTemplateClient.ListWorkflowTemplates(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Templates, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteWorkflowTemplate deletes a workflow template. It does not cancel in-progress workflows. +func (c *WorkflowTemplateClient) DeleteWorkflowTemplate(ctx context.Context, req *dataprocpb.DeleteWorkflowTemplateRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteWorkflowTemplate[0:len(c.CallOptions.DeleteWorkflowTemplate):len(c.CallOptions.DeleteWorkflowTemplate)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.workflowTemplateClient.DeleteWorkflowTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// WorkflowTemplateIterator manages a stream of *dataprocpb.WorkflowTemplate. +type WorkflowTemplateIterator struct { + items []*dataprocpb.WorkflowTemplate + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dataprocpb.WorkflowTemplate, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *WorkflowTemplateIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *WorkflowTemplateIterator) Next() (*dataprocpb.WorkflowTemplate, error) { + var item *dataprocpb.WorkflowTemplate + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *WorkflowTemplateIterator) bufLen() int { + return len(it.items) +} + +func (it *WorkflowTemplateIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// InstantiateInlineWorkflowTemplateOperation manages a long-running operation from InstantiateInlineWorkflowTemplate. +type InstantiateInlineWorkflowTemplateOperation struct { + lro *longrunning.Operation +} + +// InstantiateInlineWorkflowTemplateOperation returns a new InstantiateInlineWorkflowTemplateOperation from a given name. +// The name must be that of a previously created InstantiateInlineWorkflowTemplateOperation, possibly from a different process. +func (c *WorkflowTemplateClient) InstantiateInlineWorkflowTemplateOperation(name string) *InstantiateInlineWorkflowTemplateOperation { + return &InstantiateInlineWorkflowTemplateOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *InstantiateInlineWorkflowTemplateOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *InstantiateInlineWorkflowTemplateOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *InstantiateInlineWorkflowTemplateOperation) Metadata() (*dataprocpb.WorkflowMetadata, error) { + var meta dataprocpb.WorkflowMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *InstantiateInlineWorkflowTemplateOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *InstantiateInlineWorkflowTemplateOperation) Name() string { + return op.lro.Name() +} + +// Cancel starts asynchronous cancellation on a long-running operation. +// The server makes a best effort to cancel the operation, but success is not guaranteed. +// Clients can use Poll or other methods to check whether the cancellation succeeded or whether the operation +// completed despite cancellation. On successful cancellation, the operation is not deleted; +// instead, op.Poll returns an error with code Canceled. +func (op *InstantiateInlineWorkflowTemplateOperation) Cancel(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Cancel(ctx, opts...) +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *InstantiateInlineWorkflowTemplateOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} + +// InstantiateWorkflowTemplateOperation manages a long-running operation from InstantiateWorkflowTemplate. +type InstantiateWorkflowTemplateOperation struct { + lro *longrunning.Operation +} + +// InstantiateWorkflowTemplateOperation returns a new InstantiateWorkflowTemplateOperation from a given name. +// The name must be that of a previously created InstantiateWorkflowTemplateOperation, possibly from a different process. +func (c *WorkflowTemplateClient) InstantiateWorkflowTemplateOperation(name string) *InstantiateWorkflowTemplateOperation { + return &InstantiateWorkflowTemplateOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *InstantiateWorkflowTemplateOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 10000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *InstantiateWorkflowTemplateOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *InstantiateWorkflowTemplateOperation) Metadata() (*dataprocpb.WorkflowMetadata, error) { + var meta dataprocpb.WorkflowMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *InstantiateWorkflowTemplateOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *InstantiateWorkflowTemplateOperation) Name() string { + return op.lro.Name() +} + +// Cancel starts asynchronous cancellation on a long-running operation. +// The server makes a best effort to cancel the operation, but success is not guaranteed. +// Clients can use Poll or other methods to check whether the cancellation succeeded or whether the operation +// completed despite cancellation. On successful cancellation, the operation is not deleted; +// instead, op.Poll returns an error with code Canceled. +func (op *InstantiateWorkflowTemplateOperation) Cancel(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Cancel(ctx, opts...) +} + +// Delete deletes a long-running operation. +// This method indicates that the client is no longer interested in the operation result. +// It does not cancel the operation. +func (op *InstantiateWorkflowTemplateOperation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Delete(ctx, opts...) +} diff --git a/vendor/cloud.google.com/go/dataproc/apiv1beta2/workflow_template_client_example_test.go b/vendor/cloud.google.com/go/dataproc/apiv1beta2/workflow_template_client_example_test.go new file mode 100644 index 000000000..56c971fa0 --- /dev/null +++ b/vendor/cloud.google.com/go/dataproc/apiv1beta2/workflow_template_client_example_test.go @@ -0,0 +1,167 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dataproc_test + +import ( + "context" + + dataproc "cloud.google.com/go/dataproc/apiv1beta2" + "google.golang.org/api/iterator" + dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2" +) + +func ExampleNewWorkflowTemplateClient() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleWorkflowTemplateClient_CreateWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.CreateWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleWorkflowTemplateClient_GetWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.GetWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleWorkflowTemplateClient_InstantiateWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.InstantiateWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + op, err := c.InstantiateWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleWorkflowTemplateClient_InstantiateInlineWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.InstantiateInlineWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + op, err := c.InstantiateInlineWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleWorkflowTemplateClient_UpdateWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.UpdateWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleWorkflowTemplateClient_ListWorkflowTemplates() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.ListWorkflowTemplatesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListWorkflowTemplates(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleWorkflowTemplateClient_DeleteWorkflowTemplate() { + ctx := context.Background() + c, err := dataproc.NewWorkflowTemplateClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dataprocpb.DeleteWorkflowTemplateRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteWorkflowTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/datastore/client.go b/vendor/cloud.google.com/go/datastore/client.go new file mode 100644 index 000000000..8eee203be --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/client.go @@ -0,0 +1,117 @@ +// Copyright 2017 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 datastore + +import ( + "context" + "fmt" + + "cloud.google.com/go/internal" + "cloud.google.com/go/internal/version" + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/datastore/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// datastoreClient is a wrapper for the pb.DatastoreClient that includes gRPC +// metadata to be sent in each request for server-side traffic management. +type datastoreClient struct { + // Embed so we still implement the DatastoreClient interface, + // if the interface adds more methods. + pb.DatastoreClient + + c pb.DatastoreClient + md metadata.MD +} + +func newDatastoreClient(conn *grpc.ClientConn, projectID string) pb.DatastoreClient { + return &datastoreClient{ + c: pb.NewDatastoreClient(conn), + md: metadata.Pairs( + resourcePrefixHeader, "projects/"+projectID, + "x-goog-api-client", fmt.Sprintf("gl-go/%s gccl/%s grpc/", version.Go(), version.Repo)), + } +} + +func (dc *datastoreClient) Lookup(ctx context.Context, in *pb.LookupRequest, opts ...grpc.CallOption) (res *pb.LookupResponse, err error) { + err = dc.invoke(ctx, func(ctx context.Context) error { + res, err = dc.c.Lookup(ctx, in, opts...) + return err + }) + return res, err +} + +func (dc *datastoreClient) RunQuery(ctx context.Context, in *pb.RunQueryRequest, opts ...grpc.CallOption) (res *pb.RunQueryResponse, err error) { + err = dc.invoke(ctx, func(ctx context.Context) error { + res, err = dc.c.RunQuery(ctx, in, opts...) + return err + }) + return res, err +} + +func (dc *datastoreClient) BeginTransaction(ctx context.Context, in *pb.BeginTransactionRequest, opts ...grpc.CallOption) (res *pb.BeginTransactionResponse, err error) { + err = dc.invoke(ctx, func(ctx context.Context) error { + res, err = dc.c.BeginTransaction(ctx, in, opts...) + return err + }) + return res, err +} + +func (dc *datastoreClient) Commit(ctx context.Context, in *pb.CommitRequest, opts ...grpc.CallOption) (res *pb.CommitResponse, err error) { + err = dc.invoke(ctx, func(ctx context.Context) error { + res, err = dc.c.Commit(ctx, in, opts...) + return err + }) + return res, err +} + +func (dc *datastoreClient) Rollback(ctx context.Context, in *pb.RollbackRequest, opts ...grpc.CallOption) (res *pb.RollbackResponse, err error) { + err = dc.invoke(ctx, func(ctx context.Context) error { + res, err = dc.c.Rollback(ctx, in, opts...) + return err + }) + return res, err +} + +func (dc *datastoreClient) AllocateIds(ctx context.Context, in *pb.AllocateIdsRequest, opts ...grpc.CallOption) (res *pb.AllocateIdsResponse, err error) { + err = dc.invoke(ctx, func(ctx context.Context) error { + res, err = dc.c.AllocateIds(ctx, in, opts...) + return err + }) + return res, err +} + +func (dc *datastoreClient) invoke(ctx context.Context, f func(ctx context.Context) error) error { + ctx = metadata.NewOutgoingContext(ctx, dc.md) + return internal.Retry(ctx, gax.Backoff{}, func() (stop bool, err error) { + err = f(ctx) + return !shouldRetry(err), err + }) +} + +func shouldRetry(err error) bool { + if err == nil { + return false + } + s, ok := status.FromError(err) + if !ok { + return false + } + // See https://cloud.google.com/datastore/docs/concepts/errors. + return s.Code() == codes.Unavailable || s.Code() == codes.DeadlineExceeded +} diff --git a/vendor/cloud.google.com/go/datastore/datastore.go b/vendor/cloud.google.com/go/datastore/datastore.go new file mode 100644 index 000000000..315df2b0f --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/datastore.go @@ -0,0 +1,645 @@ +// 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 datastore + +import ( + "context" + "errors" + "fmt" + "log" + "os" + "reflect" + + "cloud.google.com/go/internal/trace" + "google.golang.org/api/option" + gtransport "google.golang.org/api/transport/grpc" + pb "google.golang.org/genproto/googleapis/datastore/v1" + "google.golang.org/grpc" +) + +const ( + prodAddr = "datastore.googleapis.com:443" + userAgent = "gcloud-golang-datastore/20160401" +) + +// ScopeDatastore grants permissions to view and/or manage datastore entities +const ScopeDatastore = "https://www.googleapis.com/auth/datastore" + +// resourcePrefixHeader is the name of the metadata header used to indicate +// the resource being operated on. +const resourcePrefixHeader = "google-cloud-resource-prefix" + +// Client is a client for reading and writing data in a datastore dataset. +type Client struct { + conn *grpc.ClientConn + client pb.DatastoreClient + endpoint string + dataset string // Called dataset by the datastore API, synonym for project ID. +} + +// NewClient creates a new Client for a given dataset. +// If the project ID is empty, it is derived from the DATASTORE_PROJECT_ID environment variable. +// If the DATASTORE_EMULATOR_HOST environment variable is set, client will use its value +// to connect to a locally-running datastore emulator. +func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) { + var o []option.ClientOption + // Environment variables for gcd emulator: + // https://cloud.google.com/datastore/docs/tools/datastore-emulator + // If the emulator is available, dial it without passing any credentials. + if addr := os.Getenv("DATASTORE_EMULATOR_HOST"); addr != "" { + o = []option.ClientOption{ + option.WithEndpoint(addr), + option.WithoutAuthentication(), + option.WithGRPCDialOption(grpc.WithInsecure()), + } + } else { + o = []option.ClientOption{ + option.WithEndpoint(prodAddr), + option.WithScopes(ScopeDatastore), + option.WithUserAgent(userAgent), + } + } + // Warn if we see the legacy emulator environment variables. + if os.Getenv("DATASTORE_HOST") != "" && os.Getenv("DATASTORE_EMULATOR_HOST") == "" { + log.Print("WARNING: legacy environment variable DATASTORE_HOST is ignored. Use DATASTORE_EMULATOR_HOST instead.") + } + if os.Getenv("DATASTORE_DATASET") != "" && os.Getenv("DATASTORE_PROJECT_ID") == "" { + log.Print("WARNING: legacy environment variable DATASTORE_DATASET is ignored. Use DATASTORE_PROJECT_ID instead.") + } + if projectID == "" { + projectID = os.Getenv("DATASTORE_PROJECT_ID") + } + if projectID == "" { + return nil, errors.New("datastore: missing project/dataset id") + } + o = append(o, opts...) + conn, err := gtransport.Dial(ctx, o...) + if err != nil { + return nil, fmt.Errorf("dialing: %v", err) + } + return &Client{ + conn: conn, + client: newDatastoreClient(conn, projectID), + dataset: projectID, + }, nil + +} + +var ( + // ErrInvalidEntityType is returned when functions like Get or Next are + // passed a dst or src argument of invalid type. + ErrInvalidEntityType = errors.New("datastore: invalid entity type") + // ErrInvalidKey is returned when an invalid key is presented. + ErrInvalidKey = errors.New("datastore: invalid key") + // ErrNoSuchEntity is returned when no entity was found for a given key. + ErrNoSuchEntity = errors.New("datastore: no such entity") +) + +type multiArgType int + +const ( + multiArgTypeInvalid multiArgType = iota + multiArgTypePropertyLoadSaver + multiArgTypeStruct + multiArgTypeStructPtr + multiArgTypeInterface +) + +// ErrFieldMismatch is returned when a field is to be loaded into a different +// type than the one it was stored from, or when a field is missing or +// unexported in the destination struct. +// StructType is the type of the struct pointed to by the destination argument +// passed to Get or to Iterator.Next. +type ErrFieldMismatch struct { + StructType reflect.Type + FieldName string + Reason string +} + +func (e *ErrFieldMismatch) Error() string { + return fmt.Sprintf("datastore: cannot load field %q into a %q: %s", + e.FieldName, e.StructType, e.Reason) +} + +// GeoPoint represents a location as latitude/longitude in degrees. +type GeoPoint struct { + Lat, Lng float64 +} + +// Valid returns whether a GeoPoint is within [-90, 90] latitude and [-180, 180] longitude. +func (g GeoPoint) Valid() bool { + return -90 <= g.Lat && g.Lat <= 90 && -180 <= g.Lng && g.Lng <= 180 +} + +func keyToProto(k *Key) *pb.Key { + if k == nil { + return nil + } + + var path []*pb.Key_PathElement + for { + el := &pb.Key_PathElement{Kind: k.Kind} + if k.ID != 0 { + el.IdType = &pb.Key_PathElement_Id{Id: k.ID} + } else if k.Name != "" { + el.IdType = &pb.Key_PathElement_Name{Name: k.Name} + } + path = append(path, el) + if k.Parent == nil { + break + } + k = k.Parent + } + + // The path should be in order [grandparent, parent, child] + // We did it backward above, so reverse back. + for i := 0; i < len(path)/2; i++ { + path[i], path[len(path)-i-1] = path[len(path)-i-1], path[i] + } + + key := &pb.Key{Path: path} + if k.Namespace != "" { + key.PartitionId = &pb.PartitionId{ + NamespaceId: k.Namespace, + } + } + return key +} + +// protoToKey decodes a protocol buffer representation of a key into an +// equivalent *Key object. If the key is invalid, protoToKey will return the +// invalid key along with ErrInvalidKey. +func protoToKey(p *pb.Key) (*Key, error) { + var key *Key + var namespace string + if partition := p.PartitionId; partition != nil { + namespace = partition.NamespaceId + } + for _, el := range p.Path { + key = &Key{ + Namespace: namespace, + Kind: el.Kind, + ID: el.GetId(), + Name: el.GetName(), + Parent: key, + } + } + if !key.valid() { // Also detects key == nil. + return key, ErrInvalidKey + } + return key, nil +} + +// multiKeyToProto is a batch version of keyToProto. +func multiKeyToProto(keys []*Key) []*pb.Key { + ret := make([]*pb.Key, len(keys)) + for i, k := range keys { + ret[i] = keyToProto(k) + } + return ret +} + +// multiKeyToProto is a batch version of keyToProto. +func multiProtoToKey(keys []*pb.Key) ([]*Key, error) { + hasErr := false + ret := make([]*Key, len(keys)) + err := make(MultiError, len(keys)) + for i, k := range keys { + ret[i], err[i] = protoToKey(k) + if err[i] != nil { + hasErr = true + } + } + if hasErr { + return nil, err + } + return ret, nil +} + +// multiValid is a batch version of Key.valid. It returns an error, not a +// []bool. +func multiValid(key []*Key) error { + invalid := false + for _, k := range key { + if !k.valid() { + invalid = true + break + } + } + if !invalid { + return nil + } + err := make(MultiError, len(key)) + for i, k := range key { + if !k.valid() { + err[i] = ErrInvalidKey + } + } + return err +} + +// checkMultiArg checks that v has type []S, []*S, []I, or []P, for some struct +// type S, for some interface type I, or some non-interface non-pointer type P +// such that P or *P implements PropertyLoadSaver. +// +// It returns what category the slice's elements are, and the reflect.Type +// that represents S, I or P. +// +// As a special case, PropertyList is an invalid type for v. +func checkMultiArg(v reflect.Value) (m multiArgType, elemType reflect.Type) { + // TODO(djd): multiArg is very confusing. Fold this logic into the + // relevant Put/Get methods to make the logic less opaque. + if v.Kind() != reflect.Slice { + return multiArgTypeInvalid, nil + } + if v.Type() == typeOfPropertyList { + return multiArgTypeInvalid, nil + } + elemType = v.Type().Elem() + if reflect.PtrTo(elemType).Implements(typeOfPropertyLoadSaver) { + return multiArgTypePropertyLoadSaver, elemType + } + switch elemType.Kind() { + case reflect.Struct: + return multiArgTypeStruct, elemType + case reflect.Interface: + return multiArgTypeInterface, elemType + case reflect.Ptr: + elemType = elemType.Elem() + if elemType.Kind() == reflect.Struct { + return multiArgTypeStructPtr, elemType + } + } + return multiArgTypeInvalid, nil +} + +// Close closes the Client. +func (c *Client) Close() error { + return c.conn.Close() +} + +// Get loads the entity stored for key into dst, which must be a struct pointer +// or implement PropertyLoadSaver. If there is no such entity for the key, Get +// returns ErrNoSuchEntity. +// +// The values of dst's unmatched struct fields are not modified, and matching +// slice-typed fields are not reset before appending to them. In particular, it +// is recommended to pass a pointer to a zero valued struct on each Get call. +// +// ErrFieldMismatch is returned when a field is to be loaded into a different +// type than the one it was stored from, or when a field is missing or +// unexported in the destination struct. ErrFieldMismatch is only returned if +// dst is a struct pointer. +func (c *Client) Get(ctx context.Context, key *Key, dst interface{}) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.Get") + defer func() { trace.EndSpan(ctx, err) }() + + if dst == nil { // get catches nil interfaces; we need to catch nil ptr here + return ErrInvalidEntityType + } + err = c.get(ctx, []*Key{key}, []interface{}{dst}, nil) + if me, ok := err.(MultiError); ok { + return me[0] + } + return err +} + +// GetMulti is a batch version of Get. +// +// dst must be a []S, []*S, []I or []P, for some struct type S, some interface +// type I, or some non-interface non-pointer type P such that P or *P +// implements PropertyLoadSaver. If an []I, each element must be a valid dst +// for Get: it must be a struct pointer or implement PropertyLoadSaver. +// +// As a special case, PropertyList is an invalid type for dst, even though a +// PropertyList is a slice of structs. It is treated as invalid to avoid being +// mistakenly passed when []PropertyList was intended. +// +// err may be a MultiError. See ExampleMultiError to check it. +func (c *Client) GetMulti(ctx context.Context, keys []*Key, dst interface{}) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.GetMulti") + defer func() { trace.EndSpan(ctx, err) }() + + return c.get(ctx, keys, dst, nil) +} + +func (c *Client) get(ctx context.Context, keys []*Key, dst interface{}, opts *pb.ReadOptions) error { + v := reflect.ValueOf(dst) + multiArgType, _ := checkMultiArg(v) + + // Sanity checks + if multiArgType == multiArgTypeInvalid { + return errors.New("datastore: dst has invalid type") + } + if len(keys) != v.Len() { + return errors.New("datastore: keys and dst slices have different length") + } + if len(keys) == 0 { + return nil + } + + // Go through keys, validate them, serialize then, and create a dict mapping them to their indices. + // Equal keys are deduped. + multiErr, any := make(MultiError, len(keys)), false + keyMap := make(map[string][]int, len(keys)) + pbKeys := make([]*pb.Key, 0, len(keys)) + for i, k := range keys { + if !k.valid() { + multiErr[i] = ErrInvalidKey + any = true + } else if k.Incomplete() { + multiErr[i] = fmt.Errorf("datastore: can't get the incomplete key: %v", k) + any = true + } else { + ks := k.String() + if _, ok := keyMap[ks]; !ok { + pbKeys = append(pbKeys, keyToProto(k)) + } + keyMap[ks] = append(keyMap[ks], i) + } + } + if any { + return multiErr + } + req := &pb.LookupRequest{ + ProjectId: c.dataset, + Keys: pbKeys, + ReadOptions: opts, + } + resp, err := c.client.Lookup(ctx, req) + if err != nil { + return err + } + found := resp.Found + missing := resp.Missing + // Upper bound 100 iterations to prevent infinite loop. + // We choose 100 iterations somewhat logically: + // Max number of Entities you can request from Datastore is 1,000. + // Max size for a Datastore Entity is 1 MiB. + // Max request size is 10 MiB, so we assume max response size is also 10 MiB. + // 1,000 / 10 = 100. + // Note that if ctx has a deadline, the deadline will probably + // be hit before we reach 100 iterations. + for i := 0; len(resp.Deferred) > 0 && i < 100; i++ { + req.Keys = resp.Deferred + resp, err = c.client.Lookup(ctx, req) + if err != nil { + return err + } + found = append(found, resp.Found...) + missing = append(missing, resp.Missing...) + } + + filled := 0 + for _, e := range found { + k, err := protoToKey(e.Entity.Key) + if err != nil { + return errors.New("datastore: internal error: server returned an invalid key") + } + filled += len(keyMap[k.String()]) + for _, index := range keyMap[k.String()] { + elem := v.Index(index) + if multiArgType == multiArgTypePropertyLoadSaver || multiArgType == multiArgTypeStruct { + elem = elem.Addr() + } + if multiArgType == multiArgTypeStructPtr && elem.IsNil() { + elem.Set(reflect.New(elem.Type().Elem())) + } + if err := loadEntityProto(elem.Interface(), e.Entity); err != nil { + multiErr[index] = err + any = true + } + } + } + for _, e := range missing { + k, err := protoToKey(e.Entity.Key) + if err != nil { + return errors.New("datastore: internal error: server returned an invalid key") + } + filled += len(keyMap[k.String()]) + for _, index := range keyMap[k.String()] { + multiErr[index] = ErrNoSuchEntity + } + any = true + } + + if filled != len(keys) { + return errors.New("datastore: internal error: server returned the wrong number of entities") + } + + if any { + return multiErr + } + return nil +} + +// Put saves the entity src into the datastore with the given key. src must be +// a struct pointer or implement PropertyLoadSaver; if the struct pointer has +// any unexported fields they will be skipped. If the key is incomplete, the +// returned key will be a unique key generated by the datastore. +func (c *Client) Put(ctx context.Context, key *Key, src interface{}) (*Key, error) { + k, err := c.PutMulti(ctx, []*Key{key}, []interface{}{src}) + if err != nil { + if me, ok := err.(MultiError); ok { + return nil, me[0] + } + return nil, err + } + return k[0], nil +} + +// PutMulti is a batch version of Put. +// +// src must satisfy the same conditions as the dst argument to GetMulti. +// err may be a MultiError. See ExampleMultiError to check it. +func (c *Client) PutMulti(ctx context.Context, keys []*Key, src interface{}) (ret []*Key, err error) { + // TODO(jba): rewrite in terms of Mutate. + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.PutMulti") + defer func() { trace.EndSpan(ctx, err) }() + + mutations, err := putMutations(keys, src) + if err != nil { + return nil, err + } + + // Make the request. + req := &pb.CommitRequest{ + ProjectId: c.dataset, + Mutations: mutations, + Mode: pb.CommitRequest_NON_TRANSACTIONAL, + } + resp, err := c.client.Commit(ctx, req) + if err != nil { + return nil, err + } + + // Copy any newly minted keys into the returned keys. + ret = make([]*Key, len(keys)) + for i, key := range keys { + if key.Incomplete() { + // This key is in the mutation results. + ret[i], err = protoToKey(resp.MutationResults[i].Key) + if err != nil { + return nil, errors.New("datastore: internal error: server returned an invalid key") + } + } else { + ret[i] = key + } + } + return ret, nil +} + +func putMutations(keys []*Key, src interface{}) ([]*pb.Mutation, error) { + v := reflect.ValueOf(src) + multiArgType, _ := checkMultiArg(v) + if multiArgType == multiArgTypeInvalid { + return nil, errors.New("datastore: src has invalid type") + } + if len(keys) != v.Len() { + return nil, errors.New("datastore: key and src slices have different length") + } + if len(keys) == 0 { + return nil, nil + } + if err := multiValid(keys); err != nil { + return nil, err + } + mutations := make([]*pb.Mutation, 0, len(keys)) + multiErr := make(MultiError, len(keys)) + hasErr := false + for i, k := range keys { + elem := v.Index(i) + // Two cases where we need to take the address: + // 1) multiArgTypePropertyLoadSaver => &elem implements PLS + // 2) multiArgTypeStruct => saveEntity needs *struct + if multiArgType == multiArgTypePropertyLoadSaver || multiArgType == multiArgTypeStruct { + elem = elem.Addr() + } + p, err := saveEntity(k, elem.Interface()) + if err != nil { + multiErr[i] = err + hasErr = true + } + var mut *pb.Mutation + if k.Incomplete() { + mut = &pb.Mutation{Operation: &pb.Mutation_Insert{Insert: p}} + } else { + mut = &pb.Mutation{Operation: &pb.Mutation_Upsert{Upsert: p}} + } + mutations = append(mutations, mut) + } + if hasErr { + return nil, multiErr + } + return mutations, nil +} + +// Delete deletes the entity for the given key. +func (c *Client) Delete(ctx context.Context, key *Key) error { + err := c.DeleteMulti(ctx, []*Key{key}) + if me, ok := err.(MultiError); ok { + return me[0] + } + return err +} + +// DeleteMulti is a batch version of Delete. +// +// err may be a MultiError. See ExampleMultiError to check it. +func (c *Client) DeleteMulti(ctx context.Context, keys []*Key) (err error) { + // TODO(jba): rewrite in terms of Mutate. + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.DeleteMulti") + defer func() { trace.EndSpan(ctx, err) }() + + mutations, err := deleteMutations(keys) + if err != nil { + return err + } + + req := &pb.CommitRequest{ + ProjectId: c.dataset, + Mutations: mutations, + Mode: pb.CommitRequest_NON_TRANSACTIONAL, + } + _, err = c.client.Commit(ctx, req) + return err +} + +func deleteMutations(keys []*Key) ([]*pb.Mutation, error) { + mutations := make([]*pb.Mutation, 0, len(keys)) + set := make(map[string]bool, len(keys)) + multiErr := make(MultiError, len(keys)) + hasErr := false + for i, k := range keys { + if !k.valid() { + multiErr[i] = ErrInvalidKey + hasErr = true + } else if k.Incomplete() { + multiErr[i] = fmt.Errorf("datastore: can't delete the incomplete key: %v", k) + hasErr = true + } else { + ks := k.String() + if !set[ks] { + mutations = append(mutations, &pb.Mutation{ + Operation: &pb.Mutation_Delete{Delete: keyToProto(k)}, + }) + } + set[ks] = true + } + } + if hasErr { + return nil, multiErr + } + return mutations, nil +} + +// Mutate applies one or more mutations atomically. +// It returns the keys of the argument Mutations, in the same order. +// +// If any of the mutations are invalid, Mutate returns a MultiError with the errors. +// Mutate returns a MultiError in this case even if there is only one Mutation. +// See ExampleMultiError to check it. +func (c *Client) Mutate(ctx context.Context, muts ...*Mutation) (ret []*Key, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.Mutate") + defer func() { trace.EndSpan(ctx, err) }() + + pmuts, err := mutationProtos(muts) + if err != nil { + return nil, err + } + req := &pb.CommitRequest{ + ProjectId: c.dataset, + Mutations: pmuts, + Mode: pb.CommitRequest_NON_TRANSACTIONAL, + } + resp, err := c.client.Commit(ctx, req) + if err != nil { + return nil, err + } + // Copy any newly minted keys into the returned keys. + ret = make([]*Key, len(muts)) + for i, mut := range muts { + if mut.key.Incomplete() { + // This key is in the mutation results. + ret[i], err = protoToKey(resp.MutationResults[i].Key) + if err != nil { + return nil, errors.New("datastore: internal error: server returned an invalid key") + } + } else { + ret[i] = mut.key + } + } + return ret, nil +} diff --git a/vendor/cloud.google.com/go/datastore/datastore.replay b/vendor/cloud.google.com/go/datastore/datastore.replay new file mode 100644 index 000000000..25235ecd8 Binary files /dev/null and b/vendor/cloud.google.com/go/datastore/datastore.replay differ diff --git a/vendor/cloud.google.com/go/datastore/datastore_test.go b/vendor/cloud.google.com/go/datastore/datastore_test.go new file mode 100644 index 000000000..bc805d8fb --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/datastore_test.go @@ -0,0 +1,3568 @@ +// 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 datastore + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "reflect" + "sort" + "strings" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/proto" + "github.com/google/go-cmp/cmp" + pb "google.golang.org/genproto/googleapis/datastore/v1" + "google.golang.org/grpc" +) + +type ( + myBlob []byte + myByte byte + myString string +) + +func makeMyByteSlice(n int) []myByte { + b := make([]myByte, n) + for i := range b { + b[i] = myByte(i) + } + return b +} + +func makeInt8Slice(n int) []int8 { + b := make([]int8, n) + for i := range b { + b[i] = int8(i) + } + return b +} + +func makeUint8Slice(n int) []uint8 { + b := make([]uint8, n) + for i := range b { + b[i] = uint8(i) + } + return b +} + +func newKey(stringID string, parent *Key) *Key { + return NameKey("kind", stringID, parent) +} + +var ( + testKey0 = newKey("name0", nil) + testKey1a = newKey("name1", nil) + testKey1b = newKey("name1", nil) + testKey2a = newKey("name2", testKey0) + testKey2b = newKey("name2", testKey0) + testGeoPt0 = GeoPoint{Lat: 1.2, Lng: 3.4} + testGeoPt1 = GeoPoint{Lat: 5, Lng: 10} + testBadGeoPt = GeoPoint{Lat: 1000, Lng: 34} + + ts = time.Unix(1e9, 0).UTC() +) + +type B0 struct { + B []byte `datastore:",noindex"` +} + +type B1 struct { + B []int8 +} + +type B2 struct { + B myBlob `datastore:",noindex"` +} + +type B3 struct { + B []myByte `datastore:",noindex"` +} + +type B4 struct { + B [][]byte +} + +type C0 struct { + I int + C chan int +} + +type C1 struct { + I int + C *chan int +} + +type C2 struct { + I int + C []chan int +} + +type C3 struct { + C string +} + +type c4 struct { + C string +} + +type E struct{} + +type G0 struct { + G GeoPoint +} + +type G1 struct { + G []GeoPoint +} + +type K0 struct { + K *Key +} + +type K1 struct { + K []*Key +} + +type S struct { + St string +} + +type NoOmit struct { + A string + B int `datastore:"Bb"` + C bool `datastore:",noindex"` +} + +type OmitAll struct { + A string `datastore:",omitempty"` + B int `datastore:"Bb,omitempty"` + C bool `datastore:",omitempty,noindex"` + D time.Time `datastore:",omitempty"` + F []int `datastore:",omitempty"` +} + +type Omit struct { + A string `datastore:",omitempty"` + B int `datastore:"Bb,omitempty"` + C bool `datastore:",omitempty,noindex"` + D time.Time `datastore:",omitempty"` + F []int `datastore:",omitempty"` + S `datastore:",omitempty"` +} + +type NoOmits struct { + No []NoOmit `datastore:",omitempty"` + S `datastore:",omitempty"` + Ss S `datastore:",omitempty"` +} + +type N0 struct { + X0 + Nonymous X0 + Ignore string `datastore:"-"` + Other string +} + +type N1 struct { + X0 + Nonymous []X0 + Ignore string `datastore:"-"` + Other string +} + +type N2 struct { + N1 `datastore:"red"` + Green N1 `datastore:"green"` + Blue N1 + White N1 `datastore:"-"` +} + +type N3 struct { + C3 `datastore:"red"` +} + +type N4 struct { + c4 +} + +type N5 struct { + c4 `datastore:"red"` +} + +type O0 struct { + I int64 +} + +type O1 struct { + I int32 +} + +type U0 struct { + U uint +} + +type U1 struct { + U string +} + +type T struct { + T time.Time +} + +type X0 struct { + S string + I int + i int +} + +type X1 struct { + S myString + I int32 + J int64 +} + +type X2 struct { + Z string + i int +} + +type X3 struct { + S bool + I int +} + +type Y0 struct { + B bool + F []float64 + G []float64 +} + +type Y1 struct { + B bool + F float64 +} + +type Y2 struct { + B bool + F []int64 +} + +type Pointers struct { + Pi *int + Ps *string + Pb *bool + Pf *float64 + Pg *GeoPoint + Pt *time.Time +} + +type PointersOmitEmpty struct { + Pi *int `datastore:",omitempty"` + Ps *string `datastore:",omitempty"` + Pb *bool `datastore:",omitempty"` + Pf *float64 `datastore:",omitempty"` + Pg *GeoPoint `datastore:",omitempty"` + Pt *time.Time `datastore:",omitempty"` +} + +func populatedPointers() *Pointers { + var ( + i int + s string + b bool + f float64 + g GeoPoint + t time.Time + ) + return &Pointers{ + Pi: &i, + Ps: &s, + Pb: &b, + Pf: &f, + Pg: &g, + Pt: &t, + } +} + +type Tagged struct { + A int `datastore:"a,noindex"` + B []int `datastore:"b"` + C int `datastore:",noindex"` + D int `datastore:""` + E int + I int `datastore:"-"` + J int `datastore:",noindex" json:"j"` + + Y0 `datastore:"-"` + Z chan int `datastore:"-"` +} + +type InvalidTagged1 struct { + I int `datastore:"\t"` +} + +type InvalidTagged2 struct { + I int + J int `datastore:"I"` +} + +type InvalidTagged3 struct { + X string `datastore:"-,noindex"` +} + +type InvalidTagged4 struct { + X string `datastore:",garbage"` +} + +type Inner1 struct { + W int32 + X string +} + +type Inner2 struct { + Y float64 +} + +type Inner3 struct { + Z bool +} + +type Inner5 struct { + WW int +} + +type Inner4 struct { + X Inner5 +} + +type Outer struct { + A int16 + I []Inner1 + J Inner2 + Inner3 +} + +type OuterFlatten struct { + A int16 + I []Inner1 `datastore:",flatten"` + J Inner2 `datastore:",flatten,noindex"` + Inner3 `datastore:",flatten"` + K Inner4 `datastore:",flatten"` +} + +type OuterEquivalent struct { + A int16 + IDotW []int32 `datastore:"I.W"` + IDotX []string `datastore:"I.X"` + JDotY float64 `datastore:"J.Y"` + Z bool +} + +type Dotted struct { + A DottedA `datastore:"A0.A1.A2"` +} + +type DottedA struct { + B DottedB `datastore:"B3"` +} + +type DottedB struct { + C int `datastore:"C4.C5"` +} + +type SliceOfSlices struct { + I int + S []struct { + J int + F []float64 + } `datastore:",flatten"` +} + +type Recursive struct { + I int + R []Recursive +} + +type MutuallyRecursive0 struct { + I int + R []MutuallyRecursive1 +} + +type MutuallyRecursive1 struct { + I int + R []MutuallyRecursive0 +} + +type EntityWithKey struct { + I int + S string + K *Key `datastore:"__key__"` +} + +type EntityWithKey2 EntityWithKey + +type WithNestedEntityWithKey struct { + N EntityWithKey +} + +type WithNonKeyField struct { + I int + K string `datastore:"__key__"` +} + +type NestedWithNonKeyField struct { + N WithNonKeyField +} + +type Basic struct { + A string +} + +type PtrToStructField struct { + B *Basic + C *Basic `datastore:"c,noindex"` + *Basic + D []*Basic +} + +var two = 2 + +type EmbeddedTime struct { + time.Time +} + +type SpecialTime struct { + MyTime EmbeddedTime +} + +type Doubler struct { + S string + I int64 + B bool +} + +type Repeat struct { + Key string + Value []byte +} + +type Repeated struct { + Repeats []Repeat +} + +func (d *Doubler) Load(props []Property) error { + return LoadStruct(d, props) +} + +func (d *Doubler) Save() ([]Property, error) { + // Save the default Property slice to an in-memory buffer (a PropertyList). + props, err := SaveStruct(d) + if err != nil { + return nil, err + } + var list PropertyList + if err := list.Load(props); err != nil { + return nil, err + } + + // Edit that PropertyList, and send it on. + for i := range list { + switch v := list[i].Value.(type) { + case string: + // + means string concatenation. + list[i].Value = v + v + case int64: + // + means integer addition. + list[i].Value = v + v + } + } + return list.Save() +} + +var _ PropertyLoadSaver = (*Doubler)(nil) + +type Deriver struct { + S, Derived, Ignored string +} + +func (e *Deriver) Load(props []Property) error { + for _, p := range props { + if p.Name != "S" { + continue + } + e.S = p.Value.(string) + e.Derived = "derived+" + e.S + } + return nil +} + +func (e *Deriver) Save() ([]Property, error) { + return []Property{ + { + Name: "S", + Value: e.S, + }, + }, nil +} + +var _ PropertyLoadSaver = (*Deriver)(nil) + +type BadMultiPropEntity struct{} + +func (e *BadMultiPropEntity) Load(props []Property) error { + return errors.New("unimplemented") +} + +func (e *BadMultiPropEntity) Save() ([]Property, error) { + // Write multiple properties with the same name "I". + var props []Property + for i := 0; i < 3; i++ { + props = append(props, Property{ + Name: "I", + Value: int64(i), + }) + } + return props, nil +} + +var _ PropertyLoadSaver = (*BadMultiPropEntity)(nil) + +type testCase struct { + desc string + src interface{} + want interface{} + putErr string + getErr string +} + +var testCases = []testCase{ + { + "chan save fails", + &C0{I: -1}, + &E{}, + "unsupported struct field", + "", + }, + { + "*chan save fails", + &C1{I: -1}, + &E{}, + "unsupported struct field", + "", + }, + { + "[]chan save fails", + &C2{I: -1, C: make([]chan int, 8)}, + &E{}, + "unsupported struct field", + "", + }, + { + "chan load fails", + &C3{C: "not a chan"}, + &C0{}, + "", + "type mismatch", + }, + { + "*chan load fails", + &C3{C: "not a *chan"}, + &C1{}, + "", + "type mismatch", + }, + { + "[]chan load fails", + &C3{C: "not a []chan"}, + &C2{}, + "", + "type mismatch", + }, + { + "empty struct", + &E{}, + &E{}, + "", + "", + }, + { + "geopoint", + &G0{G: testGeoPt0}, + &G0{G: testGeoPt0}, + "", + "", + }, + { + "geopoint invalid", + &G0{G: testBadGeoPt}, + &G0{}, + "invalid GeoPoint value", + "", + }, + { + "geopoint as props", + &G0{G: testGeoPt0}, + &PropertyList{ + Property{Name: "G", Value: testGeoPt0, NoIndex: false}, + }, + "", + "", + }, + { + "geopoint slice", + &G1{G: []GeoPoint{testGeoPt0, testGeoPt1}}, + &G1{G: []GeoPoint{testGeoPt0, testGeoPt1}}, + "", + "", + }, + { + "omit empty, all", + &OmitAll{}, + new(PropertyList), + "", + "", + }, + { + "omit empty", + &Omit{}, + &PropertyList{ + Property{Name: "St", Value: "", NoIndex: false}, + }, + "", + "", + }, + { + "omit empty, fields populated", + &Omit{ + A: "a", + B: 10, + C: true, + F: []int{11}, + }, + &PropertyList{ + Property{Name: "A", Value: "a", NoIndex: false}, + Property{Name: "Bb", Value: int64(10), NoIndex: false}, + Property{Name: "C", Value: true, NoIndex: true}, + Property{Name: "F", Value: []interface{}{int64(11)}, NoIndex: false}, + Property{Name: "St", Value: "", NoIndex: false}, + }, + "", + "", + }, + { + "omit empty, fields populated", + &Omit{ + A: "a", + B: 10, + C: true, + F: []int{11}, + S: S{St: "string"}, + }, + &PropertyList{ + Property{Name: "A", Value: "a", NoIndex: false}, + Property{Name: "Bb", Value: int64(10), NoIndex: false}, + Property{Name: "C", Value: true, NoIndex: true}, + Property{Name: "F", Value: []interface{}{int64(11)}, NoIndex: false}, + Property{Name: "St", Value: "string", NoIndex: false}, + }, + "", + "", + }, + { + "omit empty does not propagate", + &NoOmits{ + No: []NoOmit{ + {}, + }, + S: S{}, + Ss: S{}, + }, + &PropertyList{ + Property{Name: "No", Value: []interface{}{ + &Entity{ + Properties: []Property{ + {Name: "A", Value: "", NoIndex: false}, + {Name: "Bb", Value: int64(0), NoIndex: false}, + {Name: "C", Value: false, NoIndex: true}, + }, + }, + }, NoIndex: false}, + Property{Name: "Ss", Value: &Entity{ + Properties: []Property{ + {Name: "St", Value: "", NoIndex: false}, + }, + }, NoIndex: false}, + Property{Name: "St", Value: "", NoIndex: false}, + }, + "", + "", + }, + { + "key", + &K0{K: testKey1a}, + &K0{K: testKey1b}, + "", + "", + }, + { + "key with parent", + &K0{K: testKey2a}, + &K0{K: testKey2b}, + "", + "", + }, + { + "nil key", + &K0{}, + &K0{}, + "", + "", + }, + { + "all nil keys in slice", + &K1{[]*Key{nil, nil}}, + &K1{[]*Key{nil, nil}}, + "", + "", + }, + { + "some nil keys in slice", + &K1{[]*Key{testKey1a, nil, testKey2a}}, + &K1{[]*Key{testKey1b, nil, testKey2b}}, + "", + "", + }, + { + "overflow", + &O0{I: 1 << 48}, + &O1{}, + "", + "overflow", + }, + { + "time", + &T{T: time.Unix(1e9, 0)}, + &T{T: time.Unix(1e9, 0)}, + "", + "", + }, + { + "time as props", + &T{T: time.Unix(1e9, 0)}, + &PropertyList{ + Property{Name: "T", Value: time.Unix(1e9, 0), NoIndex: false}, + }, + "", + "", + }, + { + "uint save", + &U0{U: 1}, + &U0{}, + "unsupported struct field", + "", + }, + { + "uint load", + &U1{U: "not a uint"}, + &U0{}, + "", + "type mismatch", + }, + { + "zero", + &X0{}, + &X0{}, + "", + "", + }, + { + "basic", + &X0{S: "one", I: 2, i: 3}, + &X0{S: "one", I: 2}, + "", + "", + }, + { + "save string/int load myString/int32", + &X0{S: "one", I: 2, i: 3}, + &X1{S: "one", I: 2}, + "", + "", + }, + { + "missing fields", + &X0{S: "one", I: 2, i: 3}, + &X2{}, + "", + "no such struct field", + }, + { + "save string load bool", + &X0{S: "one", I: 2, i: 3}, + &X3{I: 2}, + "", + "type mismatch", + }, + { + "basic slice", + &Y0{B: true, F: []float64{7, 8, 9}}, + &Y0{B: true, F: []float64{7, 8, 9}}, + "", + "", + }, + { + "save []float64 load float64", + &Y0{B: true, F: []float64{7, 8, 9}}, + &Y1{B: true}, + "", + "requires a slice", + }, + { + "save []float64 load []int64", + &Y0{B: true, F: []float64{7, 8, 9}}, + &Y2{B: true}, + "", + "type mismatch", + }, + { + "single slice is too long", + &Y0{F: make([]float64, maxIndexedProperties+1)}, + &Y0{}, + "too many indexed properties", + "", + }, + { + "two slices are too long", + &Y0{F: make([]float64, maxIndexedProperties), G: make([]float64, maxIndexedProperties)}, + &Y0{}, + "too many indexed properties", + "", + }, + { + "one slice and one scalar are too long", + &Y0{F: make([]float64, maxIndexedProperties), B: true}, + &Y0{}, + "too many indexed properties", + "", + }, + { + "slice of slices of bytes", + &Repeated{ + Repeats: []Repeat{ + { + Key: "key 1", + Value: []byte("value 1"), + }, + { + Key: "key 2", + Value: []byte("value 2"), + }, + }, + }, + &Repeated{ + Repeats: []Repeat{ + { + Key: "key 1", + Value: []byte("value 1"), + }, + { + Key: "key 2", + Value: []byte("value 2"), + }, + }, + }, + "", + "", + }, + { + "long blob", + &B0{B: makeUint8Slice(maxIndexedProperties + 1)}, + &B0{B: makeUint8Slice(maxIndexedProperties + 1)}, + "", + "", + }, + { + "long []int8 is too long", + &B1{B: makeInt8Slice(maxIndexedProperties + 1)}, + &B1{}, + "too many indexed properties", + "", + }, + { + "short []int8", + &B1{B: makeInt8Slice(3)}, + &B1{B: makeInt8Slice(3)}, + "", + "", + }, + { + "long myBlob", + &B2{B: makeUint8Slice(maxIndexedProperties + 1)}, + &B2{B: makeUint8Slice(maxIndexedProperties + 1)}, + "", + "", + }, + { + "short myBlob", + &B2{B: makeUint8Slice(3)}, + &B2{B: makeUint8Slice(3)}, + "", + "", + }, + { + "long []myByte", + &B3{B: makeMyByteSlice(maxIndexedProperties + 1)}, + &B3{B: makeMyByteSlice(maxIndexedProperties + 1)}, + "", + "", + }, + { + "short []myByte", + &B3{B: makeMyByteSlice(3)}, + &B3{B: makeMyByteSlice(3)}, + "", + "", + }, + { + "slice of blobs", + &B4{B: [][]byte{ + makeUint8Slice(3), + makeUint8Slice(4), + makeUint8Slice(5), + }}, + &B4{B: [][]byte{ + makeUint8Slice(3), + makeUint8Slice(4), + makeUint8Slice(5), + }}, + "", + "", + }, + { + "[]byte must be noindex", + &PropertyList{ + Property{Name: "B", Value: makeUint8Slice(1501), NoIndex: false}, + }, + nil, + "[]byte property too long to index", + "", + }, + { + "string must be noindex", + &PropertyList{ + Property{Name: "B", Value: strings.Repeat("x", 1501), NoIndex: false}, + }, + nil, + "string property too long to index", + "", + }, + { + "slice of []byte must be noindex", + &PropertyList{ + Property{Name: "B", Value: []interface{}{ + []byte("short"), + makeUint8Slice(1501), + }, NoIndex: false}, + }, + nil, + "[]byte property too long to index", + "", + }, + { + "slice of string must be noindex", + &PropertyList{ + Property{Name: "B", Value: []interface{}{ + "short", + strings.Repeat("x", 1501), + }, NoIndex: false}, + }, + nil, + "string property too long to index", + "", + }, + { + "save tagged load props", + &Tagged{A: 1, B: []int{21, 22, 23}, C: 3, D: 4, E: 5, I: 6, J: 7}, + &PropertyList{ + // A and B are renamed to a and b; A and C are noindex, I is ignored. + // Order is sorted as per byName. + Property{Name: "C", Value: int64(3), NoIndex: true}, + Property{Name: "D", Value: int64(4), NoIndex: false}, + Property{Name: "E", Value: int64(5), NoIndex: false}, + Property{Name: "J", Value: int64(7), NoIndex: true}, + Property{Name: "a", Value: int64(1), NoIndex: true}, + Property{Name: "b", Value: []interface{}{int64(21), int64(22), int64(23)}, NoIndex: false}, + }, + "", + "", + }, + { + "save tagged load tagged", + &Tagged{A: 1, B: []int{21, 22, 23}, C: 3, D: 4, E: 5, I: 6, J: 7}, + &Tagged{A: 1, B: []int{21, 22, 23}, C: 3, D: 4, E: 5, J: 7}, + "", + "", + }, + { + "invalid tagged1", + &InvalidTagged1{I: 1}, + &InvalidTagged1{}, + "struct tag has invalid property name", + "", + }, + { + "invalid tagged2", + &InvalidTagged2{I: 1, J: 2}, + &InvalidTagged2{J: 2}, + "", + "", + }, + { + "invalid tagged3", + &InvalidTagged3{X: "hello"}, + &InvalidTagged3{}, + "struct tag has invalid property name: \"-\"", + "", + }, + { + "invalid tagged4", + &InvalidTagged4{X: "hello"}, + &InvalidTagged4{}, + "struct tag has invalid option: \"garbage\"", + "", + }, + { + "doubler", + &Doubler{S: "s", I: 1, B: true}, + &Doubler{S: "ss", I: 2, B: true}, + "", + "", + }, + { + "save struct load props", + &X0{S: "s", I: 1}, + &PropertyList{ + Property{Name: "I", Value: int64(1), NoIndex: false}, + Property{Name: "S", Value: "s", NoIndex: false}, + }, + "", + "", + }, + { + "save props load struct", + &PropertyList{ + Property{Name: "I", Value: int64(1), NoIndex: false}, + Property{Name: "S", Value: "s", NoIndex: false}, + }, + &X0{S: "s", I: 1}, + "", + "", + }, + { + "nil-value props", + &PropertyList{ + Property{Name: "I", Value: nil, NoIndex: false}, + Property{Name: "B", Value: nil, NoIndex: false}, + Property{Name: "S", Value: nil, NoIndex: false}, + Property{Name: "F", Value: nil, NoIndex: false}, + Property{Name: "K", Value: nil, NoIndex: false}, + Property{Name: "T", Value: nil, NoIndex: false}, + Property{Name: "J", Value: []interface{}{nil, int64(7), nil}, NoIndex: false}, + }, + &struct { + I int64 + B bool + S string + F float64 + K *Key + T time.Time + J []int64 + }{ + J: []int64{0, 7, 0}, + }, + "", + "", + }, + { + "save outer load props flatten", + &OuterFlatten{ + A: 1, + I: []Inner1{ + {10, "ten"}, + {20, "twenty"}, + {30, "thirty"}, + }, + J: Inner2{ + Y: 3.14, + }, + Inner3: Inner3{ + Z: true, + }, + K: Inner4{ + X: Inner5{ + WW: 12, + }, + }, + }, + &PropertyList{ + Property{Name: "A", Value: int64(1), NoIndex: false}, + Property{Name: "I.W", Value: []interface{}{int64(10), int64(20), int64(30)}, NoIndex: false}, + Property{Name: "I.X", Value: []interface{}{"ten", "twenty", "thirty"}, NoIndex: false}, + Property{Name: "J.Y", Value: float64(3.14), NoIndex: true}, + Property{Name: "K.X.WW", Value: int64(12), NoIndex: false}, + Property{Name: "Z", Value: true, NoIndex: false}, + }, + "", + "", + }, + { + "load outer props flatten", + &PropertyList{ + Property{Name: "A", Value: int64(1), NoIndex: false}, + Property{Name: "I.W", Value: []interface{}{int64(10), int64(20), int64(30)}, NoIndex: false}, + Property{Name: "I.X", Value: []interface{}{"ten", "twenty", "thirty"}, NoIndex: false}, + Property{Name: "J.Y", Value: float64(3.14), NoIndex: true}, + Property{Name: "Z", Value: true, NoIndex: false}, + }, + &OuterFlatten{ + A: 1, + I: []Inner1{ + {10, "ten"}, + {20, "twenty"}, + {30, "thirty"}, + }, + J: Inner2{ + Y: 3.14, + }, + Inner3: Inner3{ + Z: true, + }, + }, + "", + "", + }, + { + "save outer load props", + &Outer{ + A: 1, + I: []Inner1{ + {10, "ten"}, + {20, "twenty"}, + {30, "thirty"}, + }, + J: Inner2{ + Y: 3.14, + }, + Inner3: Inner3{ + Z: true, + }, + }, + &PropertyList{ + Property{Name: "A", Value: int64(1), NoIndex: false}, + Property{Name: "I", Value: []interface{}{ + &Entity{ + Properties: []Property{ + {Name: "W", Value: int64(10), NoIndex: false}, + {Name: "X", Value: "ten", NoIndex: false}, + }, + }, + &Entity{ + Properties: []Property{ + {Name: "W", Value: int64(20), NoIndex: false}, + {Name: "X", Value: "twenty", NoIndex: false}, + }, + }, + &Entity{ + Properties: []Property{ + {Name: "W", Value: int64(30), NoIndex: false}, + {Name: "X", Value: "thirty", NoIndex: false}, + }, + }, + }, NoIndex: false}, + Property{Name: "J", Value: &Entity{ + Properties: []Property{ + {Name: "Y", Value: float64(3.14), NoIndex: false}, + }, + }, NoIndex: false}, + Property{Name: "Z", Value: true, NoIndex: false}, + }, + "", + "", + }, + { + "save props load outer-equivalent", + &PropertyList{ + Property{Name: "A", Value: int64(1), NoIndex: false}, + Property{Name: "I.W", Value: []interface{}{int64(10), int64(20), int64(30)}, NoIndex: false}, + Property{Name: "I.X", Value: []interface{}{"ten", "twenty", "thirty"}, NoIndex: false}, + Property{Name: "J.Y", Value: float64(3.14), NoIndex: false}, + Property{Name: "Z", Value: true, NoIndex: false}, + }, + &OuterEquivalent{ + A: 1, + IDotW: []int32{10, 20, 30}, + IDotX: []string{"ten", "twenty", "thirty"}, + JDotY: 3.14, + Z: true, + }, + "", + "", + }, + { + "dotted names save", + &Dotted{A: DottedA{B: DottedB{C: 88}}}, + &PropertyList{ + Property{Name: "A0.A1.A2", Value: &Entity{ + Properties: []Property{ + {Name: "B3", Value: &Entity{ + Properties: []Property{ + {Name: "C4.C5", Value: int64(88), NoIndex: false}, + }, + }, NoIndex: false}, + }, + }, NoIndex: false}, + }, + "", + "", + }, + { + "dotted names load", + &PropertyList{ + Property{Name: "A0.A1.A2", Value: &Entity{ + Properties: []Property{ + {Name: "B3", Value: &Entity{ + Properties: []Property{ + {Name: "C4.C5", Value: 99, NoIndex: false}, + }, + }, NoIndex: false}, + }, + }, NoIndex: false}, + }, + &Dotted{A: DottedA{B: DottedB{C: 99}}}, + "", + "", + }, + { + "save struct load deriver", + &X0{S: "s", I: 1}, + &Deriver{S: "s", Derived: "derived+s"}, + "", + "", + }, + { + "save deriver load struct", + &Deriver{S: "s", Derived: "derived+s", Ignored: "ignored"}, + &X0{S: "s"}, + "", + "", + }, + { + "zero time.Time", + &T{T: time.Time{}}, + &T{T: time.Time{}}, + "", + "", + }, + { + "time.Time near Unix zero time", + &T{T: time.Unix(0, 4e3)}, + &T{T: time.Unix(0, 4e3)}, + "", + "", + }, + { + "time.Time, far in the future", + &T{T: time.Date(99999, 1, 1, 0, 0, 0, 0, time.UTC)}, + &T{T: time.Date(99999, 1, 1, 0, 0, 0, 0, time.UTC)}, + "", + "", + }, + { + "time.Time, very far in the past", + &T{T: time.Date(-300000, 1, 1, 0, 0, 0, 0, time.UTC)}, + &T{}, + "time value out of range", + "", + }, + { + "time.Time, very far in the future", + &T{T: time.Date(294248, 1, 1, 0, 0, 0, 0, time.UTC)}, + &T{}, + "time value out of range", + "", + }, + { + "structs", + &N0{ + X0: X0{S: "one", I: 2, i: 3}, + Nonymous: X0{S: "four", I: 5, i: 6}, + Ignore: "ignore", + Other: "other", + }, + &N0{ + X0: X0{S: "one", I: 2}, + Nonymous: X0{S: "four", I: 5}, + Other: "other", + }, + "", + "", + }, + { + "slice of structs", + &N1{ + X0: X0{S: "one", I: 2, i: 3}, + Nonymous: []X0{ + {S: "four", I: 5, i: 6}, + {S: "seven", I: 8, i: 9}, + {S: "ten", I: 11, i: 12}, + {S: "thirteen", I: 14, i: 15}, + }, + Ignore: "ignore", + Other: "other", + }, + &N1{ + X0: X0{S: "one", I: 2}, + Nonymous: []X0{ + {S: "four", I: 5}, + {S: "seven", I: 8}, + {S: "ten", I: 11}, + {S: "thirteen", I: 14}, + }, + Other: "other", + }, + "", + "", + }, + { + "structs with slices of structs", + &N2{ + N1: N1{ + X0: X0{S: "rouge"}, + Nonymous: []X0{ + {S: "rosso0"}, + {S: "rosso1"}, + }, + }, + Green: N1{ + X0: X0{S: "vert"}, + Nonymous: []X0{ + {S: "verde0"}, + {S: "verde1"}, + {S: "verde2"}, + }, + }, + Blue: N1{ + X0: X0{S: "bleu"}, + Nonymous: []X0{ + {S: "blu0"}, + {S: "blu1"}, + {S: "blu2"}, + {S: "blu3"}, + }, + }, + }, + &N2{ + N1: N1{ + X0: X0{S: "rouge"}, + Nonymous: []X0{ + {S: "rosso0"}, + {S: "rosso1"}, + }, + }, + Green: N1{ + X0: X0{S: "vert"}, + Nonymous: []X0{ + {S: "verde0"}, + {S: "verde1"}, + {S: "verde2"}, + }, + }, + Blue: N1{ + X0: X0{S: "bleu"}, + Nonymous: []X0{ + {S: "blu0"}, + {S: "blu1"}, + {S: "blu2"}, + {S: "blu3"}, + }, + }, + }, + "", + "", + }, + { + "save structs load props", + &N2{ + N1: N1{ + X0: X0{S: "rouge"}, + Nonymous: []X0{ + {S: "rosso0"}, + {S: "rosso1"}, + }, + }, + Green: N1{ + X0: X0{S: "vert"}, + Nonymous: []X0{ + {S: "verde0"}, + {S: "verde1"}, + {S: "verde2"}, + }, + }, + Blue: N1{ + X0: X0{S: "bleu"}, + Nonymous: []X0{ + {S: "blu0"}, + {S: "blu1"}, + {S: "blu2"}, + {S: "blu3"}, + }, + }, + }, + &PropertyList{ + Property{Name: "Blue", Value: &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "Nonymous", Value: []interface{}{ + &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "S", Value: "blu0", NoIndex: false}, + }, + }, + &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "S", Value: "blu1", NoIndex: false}, + }, + }, + &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "S", Value: "blu2", NoIndex: false}, + }, + }, + &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "S", Value: "blu3", NoIndex: false}, + }, + }, + }, NoIndex: false}, + {Name: "Other", Value: "", NoIndex: false}, + {Name: "S", Value: "bleu", NoIndex: false}, + }, + }, NoIndex: false}, + Property{Name: "green", Value: &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "Nonymous", Value: []interface{}{ + &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "S", Value: "verde0", NoIndex: false}, + }, + }, + &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "S", Value: "verde1", NoIndex: false}, + }, + }, + &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "S", Value: "verde2", NoIndex: false}, + }, + }, + }, NoIndex: false}, + {Name: "Other", Value: "", NoIndex: false}, + {Name: "S", Value: "vert", NoIndex: false}, + }, + }, NoIndex: false}, + Property{Name: "red", Value: &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "Nonymous", Value: []interface{}{ + &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "S", Value: "rosso0", NoIndex: false}, + }, + }, + &Entity{ + Properties: []Property{ + {Name: "I", Value: int64(0), NoIndex: false}, + {Name: "S", Value: "rosso1", NoIndex: false}, + }, + }, + }, NoIndex: false}, + {Name: "Other", Value: "", NoIndex: false}, + {Name: "S", Value: "rouge", NoIndex: false}, + }, + }, NoIndex: false}, + }, + "", + "", + }, + { + "nested entity with key", + &WithNestedEntityWithKey{ + N: EntityWithKey{ + I: 12, + S: "abcd", + K: testKey0, + }, + }, + &WithNestedEntityWithKey{ + N: EntityWithKey{ + I: 12, + S: "abcd", + K: testKey0, + }, + }, + "", + "", + }, + { + "entity with key at top level", + &EntityWithKey{ + I: 12, + S: "abc", + K: testKey0, + }, + &EntityWithKey{ + I: 12, + S: "abc", + K: testKey0, + }, + "", + "", + }, + { + "entity with key at top level (key is populated on load)", + &EntityWithKey{ + I: 12, + S: "abc", + }, + &EntityWithKey{ + I: 12, + S: "abc", + K: testKey0, + }, + "", + "", + }, + { + "__key__ field not a *Key", + &NestedWithNonKeyField{ + N: WithNonKeyField{ + I: 12, + K: "abcd", + }, + }, + &NestedWithNonKeyField{ + N: WithNonKeyField{ + I: 12, + K: "abcd", + }, + }, + "datastore: __key__ field on struct datastore.WithNonKeyField is not a *datastore.Key", + "", + }, + { + "save struct with ptr to struct fields", + &PtrToStructField{ + &Basic{ + A: "b", + }, + &Basic{ + A: "c", + }, + &Basic{ + A: "anon", + }, + []*Basic{ + { + A: "slice0", + }, + { + A: "slice1", + }, + }, + }, + &PropertyList{ + Property{Name: "A", Value: "anon", NoIndex: false}, + Property{Name: "B", Value: &Entity{ + Properties: []Property{ + {Name: "A", Value: "b", NoIndex: false}, + }, + }}, + Property{Name: "D", Value: []interface{}{ + &Entity{ + Properties: []Property{ + {Name: "A", Value: "slice0", NoIndex: false}, + }, + }, + &Entity{ + Properties: []Property{ + {Name: "A", Value: "slice1", NoIndex: false}, + }, + }, + }, NoIndex: false}, + Property{Name: "c", Value: &Entity{ + Properties: []Property{ + {Name: "A", Value: "c", NoIndex: true}, + }, + }, NoIndex: true}, + }, + "", + "", + }, + { + "save and load struct with ptr to struct fields", + &PtrToStructField{ + &Basic{ + A: "b", + }, + &Basic{ + A: "c", + }, + &Basic{ + A: "anon", + }, + []*Basic{ + { + A: "slice0", + }, + { + A: "slice1", + }, + }, + }, + &PtrToStructField{ + &Basic{ + A: "b", + }, + &Basic{ + A: "c", + }, + &Basic{ + A: "anon", + }, + []*Basic{ + { + A: "slice0", + }, + { + A: "slice1", + }, + }, + }, + "", + "", + }, + { + "struct with nil ptr to struct fields", + &PtrToStructField{ + nil, + nil, + nil, + nil, + }, + new(PropertyList), + "", + "", + }, + { + "nested load entity with key", + &WithNestedEntityWithKey{ + N: EntityWithKey{ + I: 12, + S: "abcd", + K: testKey0, + }, + }, + &PropertyList{ + Property{Name: "N", Value: &Entity{ + Key: testKey0, + Properties: []Property{ + {Name: "I", Value: int64(12), NoIndex: false}, + {Name: "S", Value: "abcd", NoIndex: false}, + }, + }, + NoIndex: false}, + }, + "", + "", + }, + { + "nested save entity with key", + &PropertyList{ + Property{Name: "N", Value: &Entity{ + Key: testKey0, + Properties: []Property{ + {Name: "I", Value: int64(12), NoIndex: false}, + {Name: "S", Value: "abcd", NoIndex: false}, + }, + }, NoIndex: false}, + }, + + &WithNestedEntityWithKey{ + N: EntityWithKey{ + I: 12, + S: "abcd", + K: testKey0, + }, + }, + "", + "", + }, + { + "anonymous field with tag", + &N3{ + C3: C3{C: "s"}, + }, + &PropertyList{ + Property{Name: "red", Value: &Entity{ + Properties: []Property{ + {Name: "C", Value: "s", NoIndex: false}, + }, + }, NoIndex: false}, + }, + "", + "", + }, + { + "unexported anonymous field", + &N4{ + c4: c4{C: "s"}, + }, + &PropertyList{ + Property{Name: "C", Value: "s", NoIndex: false}, + }, + "", + "", + }, + { + "unexported anonymous field with tag", + &N5{ + c4: c4{C: "s"}, + }, + new(PropertyList), + "", + "", + }, + { + "save props load structs with ragged fields", + &PropertyList{ + Property{Name: "red.S", Value: "rot", NoIndex: false}, + Property{Name: "green.Nonymous.I", Value: []interface{}{int64(10), int64(11), int64(12), int64(13)}, NoIndex: false}, + Property{Name: "Blue.Nonymous.I", Value: []interface{}{int64(20), int64(21)}, NoIndex: false}, + Property{Name: "Blue.Nonymous.S", Value: []interface{}{"blau0", "blau1", "blau2"}, NoIndex: false}, + }, + &N2{ + N1: N1{ + X0: X0{S: "rot"}, + }, + Green: N1{ + Nonymous: []X0{ + {I: 10}, + {I: 11}, + {I: 12}, + {I: 13}, + }, + }, + Blue: N1{ + Nonymous: []X0{ + {S: "blau0", I: 20}, + {S: "blau1", I: 21}, + {S: "blau2"}, + }, + }, + }, + "", + "", + }, + { + "save structs with noindex tags", + &struct { + A struct { + X string `datastore:",noindex"` + Y string + } `datastore:",noindex"` + B struct { + X string `datastore:",noindex"` + Y string + } + }{}, + &PropertyList{ + Property{Name: "A", Value: &Entity{ + Properties: []Property{ + {Name: "X", Value: "", NoIndex: true}, + {Name: "Y", Value: "", NoIndex: true}, + }, + }, NoIndex: true}, + Property{Name: "B", Value: &Entity{ + Properties: []Property{ + {Name: "X", Value: "", NoIndex: true}, + {Name: "Y", Value: "", NoIndex: false}, + }, + }, NoIndex: false}, + }, + "", + "", + }, + { + "embedded struct with name override", + &struct { + Inner1 `datastore:"foo"` + }{}, + &PropertyList{ + Property{Name: "foo", Value: &Entity{ + Properties: []Property{ + {Name: "W", Value: int64(0), NoIndex: false}, + {Name: "X", Value: "", NoIndex: false}, + }, + }, NoIndex: false}, + }, + "", + "", + }, + { + "slice of slices", + &SliceOfSlices{}, + nil, + "flattening nested structs leads to a slice of slices", + "", + }, + { + "recursive struct", + &Recursive{}, + &Recursive{}, + "", + "", + }, + { + "mutually recursive struct", + &MutuallyRecursive0{}, + &MutuallyRecursive0{}, + "", + "", + }, + { + "non-exported struct fields", + &struct { + i, J int64 + }{i: 1, J: 2}, + &PropertyList{ + Property{Name: "J", Value: int64(2), NoIndex: false}, + }, + "", + "", + }, + { + "json.RawMessage", + &struct { + J json.RawMessage + }{ + J: json.RawMessage("rawr"), + }, + &PropertyList{ + Property{Name: "J", Value: []byte("rawr"), NoIndex: false}, + }, + "", + "", + }, + { + "json.RawMessage to myBlob", + &struct { + B json.RawMessage + }{ + B: json.RawMessage("rawr"), + }, + &B2{B: myBlob("rawr")}, + "", + "", + }, + { + "repeated property names", + &PropertyList{ + Property{Name: "A", Value: ""}, + Property{Name: "A", Value: ""}, + }, + nil, + "duplicate Property", + "", + }, + { + "embedded time field", + &SpecialTime{MyTime: EmbeddedTime{ts}}, + &SpecialTime{MyTime: EmbeddedTime{ts}}, + "", + "", + }, + { + "embedded time load", + &PropertyList{ + Property{Name: "MyTime.Time", Value: ts}, + }, + &SpecialTime{MyTime: EmbeddedTime{ts}}, + "", + "", + }, + { + "pointer fields: nil", + &Pointers{}, + &Pointers{}, + "", + "", + }, + { + "pointer fields: populated with zeroes", + populatedPointers(), + populatedPointers(), + "", + "", + }, +} + +// checkErr returns the empty string if either both want and err are zero, +// or if want is a non-empty substring of err's string representation. +func checkErr(want string, err error) string { + if err != nil { + got := err.Error() + if want == "" || strings.Index(got, want) == -1 { + return got + } + } else if want != "" { + return fmt.Sprintf("want error %q", want) + } + return "" +} + +func TestRoundTrip(t *testing.T) { + for _, tc := range testCases { + p, err := saveEntity(testKey0, tc.src) + if s := checkErr(tc.putErr, err); s != "" { + t.Errorf("%s: save: %s", tc.desc, s) + continue + } + if p == nil { + continue + } + var got interface{} + if _, ok := tc.want.(*PropertyList); ok { + got = new(PropertyList) + } else { + got = reflect.New(reflect.TypeOf(tc.want).Elem()).Interface() + } + err = loadEntityProto(got, p) + if s := checkErr(tc.getErr, err); s != "" { + t.Errorf("%s: load: %s", tc.desc, s) + continue + } + if pl, ok := got.(*PropertyList); ok { + // Sort by name to make sure we have a deterministic order. + sortPL(*pl) + } + + if !testutil.Equal(got, tc.want, cmp.AllowUnexported(X0{}, X2{})) { + t.Errorf("%s: compare:\ngot: %+#v\nwant: %+#v", tc.desc, got, tc.want) + continue + } + } +} + +type aPtrPLS struct { + Count int +} + +func (pls *aPtrPLS) Load([]Property) error { + pls.Count++ + return nil +} + +func (pls *aPtrPLS) Save() ([]Property, error) { + return []Property{{Name: "Count", Value: 4}}, nil +} + +type aValuePLS struct { + Count int +} + +func (pls aValuePLS) Load([]Property) error { + pls.Count += 2 + return nil +} + +func (pls aValuePLS) Save() ([]Property, error) { + return []Property{{Name: "Count", Value: 8}}, nil +} + +type aValuePtrPLS struct { + Count int +} + +func (pls *aValuePtrPLS) Load([]Property) error { + pls.Count = 11 + return nil +} + +func (pls *aValuePtrPLS) Save() ([]Property, error) { + return []Property{{Name: "Count", Value: 12}}, nil +} + +type aNotPLS struct { + Count int +} + +type plsString string + +func (s *plsString) Load([]Property) error { + *s = "LOADED" + return nil +} + +func (s *plsString) Save() ([]Property, error) { + return []Property{{Name: "SS", Value: "SAVED"}}, nil +} + +func ptrToplsString(s string) *plsString { + plsStr := plsString(s) + return &plsStr +} + +type aSubPLS struct { + Foo string + Bar *aPtrPLS + Baz aValuePtrPLS + S plsString +} + +type aSubNotPLS struct { + Foo string + Bar *aNotPLS +} + +type aSubPLSErr struct { + Foo string + Bar aValuePLS +} + +type aSubPLSNoErr struct { + Foo string + Bar aPtrPLS +} + +type GrandparentFlatten struct { + Parent Parent `datastore:",flatten"` +} + +type GrandparentOfPtrFlatten struct { + Parent ParentOfPtr `datastore:",flatten"` +} + +type GrandparentOfSlice struct { + Parent ParentOfSlice +} + +type GrandparentOfSlicePtrs struct { + Parent ParentOfSlicePtrs +} + +type GrandparentOfSliceFlatten struct { + Parent ParentOfSlice `datastore:",flatten"` +} + +type GrandparentOfSlicePtrsFlatten struct { + Parent ParentOfSlicePtrs `datastore:",flatten"` +} + +type Grandparent struct { + Parent Parent +} + +type Parent struct { + Child Child + String plsString +} + +type ParentOfPtr struct { + Child *Child + String *plsString +} + +type ParentOfSlice struct { + Children []Child + Strings []plsString +} + +type ParentOfSlicePtrs struct { + Children []*Child + Strings []*plsString +} + +type Child struct { + I int + Grandchild Grandchild +} + +type Grandchild struct { + S string +} + +func (c *Child) Load(props []Property) error { + for _, p := range props { + if p.Name == "I" { + c.I++ + } else if p.Name == "Grandchild.S" { + c.Grandchild.S = "grandchild loaded" + } + } + + return nil +} + +func (c *Child) Save() ([]Property, error) { + v := c.I + 1 + return []Property{ + {Name: "I", Value: v}, + {Name: "Grandchild.S", Value: fmt.Sprintf("grandchild saved %d", v)}, + }, nil +} + +func TestLoadSavePLS(t *testing.T) { + type testCase struct { + desc string + src interface{} + wantSave *pb.Entity + wantLoad interface{} + saveErr string + loadErr string + } + + testCases := []testCase{ + { + desc: "non-struct implements PLS (top-level)", + src: ptrToplsString("hello"), + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + wantLoad: ptrToplsString("LOADED"), + }, + { + desc: "substructs do implement PLS", + src: &aSubPLS{Foo: "foo", Bar: &aPtrPLS{Count: 2}, Baz: aValuePtrPLS{Count: 15}, S: "something"}, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Foo": {ValueType: &pb.Value_StringValue{StringValue: "foo"}}, + "Bar": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "Count": {ValueType: &pb.Value_IntegerValue{IntegerValue: 4}}, + }, + }, + }}, + "Baz": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "Count": {ValueType: &pb.Value_IntegerValue{IntegerValue: 12}}, + }, + }, + }}, + "S": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + }}, + }, + }, + wantLoad: &aSubPLS{Foo: "foo", Bar: &aPtrPLS{Count: 1}, Baz: aValuePtrPLS{Count: 11}, S: "LOADED"}, + }, + { + desc: "substruct (ptr) does implement PLS, nil valued substruct", + src: &aSubPLS{Foo: "foo", S: "something"}, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Foo": {ValueType: &pb.Value_StringValue{StringValue: "foo"}}, + "Baz": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "Count": {ValueType: &pb.Value_IntegerValue{IntegerValue: 12}}, + }, + }, + }}, + "S": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + }}, + }, + }, + wantLoad: &aSubPLS{Foo: "foo", Baz: aValuePtrPLS{Count: 11}, S: "LOADED"}, + }, + { + desc: "substruct (ptr) does not implement PLS", + src: &aSubNotPLS{Foo: "foo", Bar: &aNotPLS{Count: 2}}, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Foo": {ValueType: &pb.Value_StringValue{StringValue: "foo"}}, + "Bar": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "Count": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + }}, + }, + }, + wantLoad: &aSubNotPLS{Foo: "foo", Bar: &aNotPLS{Count: 2}}, + }, + { + desc: "substruct (value) does implement PLS, error on save", + src: &aSubPLSErr{Foo: "foo", Bar: aValuePLS{Count: 2}}, + wantSave: (*pb.Entity)(nil), + wantLoad: &aSubPLSErr{}, + saveErr: "PropertyLoadSaver methods must be implemented on a pointer", + }, + { + desc: "substruct (value) does implement PLS, error on load", + src: &aSubPLSNoErr{Foo: "foo", Bar: aPtrPLS{Count: 2}}, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Foo": {ValueType: &pb.Value_StringValue{StringValue: "foo"}}, + "Bar": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "Count": {ValueType: &pb.Value_IntegerValue{IntegerValue: 4}}, + }, + }, + }}, + }, + }, + wantLoad: &aSubPLSErr{}, + loadErr: "PropertyLoadSaver methods must be implemented on a pointer", + }, + + { + desc: "parent does not have flatten option, child impl PLS", + src: &Grandparent{ + Parent: Parent{ + Child: Child{ + I: 9, + Grandchild: Grandchild{ + S: "BAD", + }, + }, + String: plsString("something"), + }, + }, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Parent": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "Child": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 10}}, + "Grandchild.S": {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 10"}}, + }, + }, + }}, + "String": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + }}, + }, + }, + }}, + }, + }, + wantLoad: &Grandparent{ + Parent: Parent{ + Child: Child{ + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + String: "LOADED", + }, + }, + }, + { + desc: "parent has flatten option enabled, child impl PLS", + src: &GrandparentFlatten{ + Parent: Parent{ + Child: Child{ + I: 7, + Grandchild: Grandchild{ + S: "BAD", + }, + }, + String: plsString("something"), + }, + }, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Parent.Child.I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 8}}, + "Parent.Child.Grandchild.S": {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 8"}}, + "Parent.String.SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + wantLoad: &GrandparentFlatten{ + Parent: Parent{ + Child: Child{ + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + String: "LOADED", + }, + }, + }, + + { + desc: "parent has flatten option enabled, child (ptr to) impl PLS", + src: &GrandparentOfPtrFlatten{ + Parent: ParentOfPtr{ + Child: &Child{ + I: 7, + Grandchild: Grandchild{ + S: "BAD", + }, + }, + String: ptrToplsString("something"), + }, + }, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Parent.Child.I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 8}}, + "Parent.Child.Grandchild.S": {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 8"}}, + "Parent.String.SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + wantLoad: &GrandparentOfPtrFlatten{ + Parent: ParentOfPtr{ + Child: &Child{ + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + String: ptrToplsString("LOADED"), + }, + }, + }, + { + desc: "children (slice of) impl PLS", + src: &GrandparentOfSlice{ + Parent: ParentOfSlice{ + Children: []Child{ + { + I: 7, + Grandchild: Grandchild{ + S: "BAD", + }, + }, + { + I: 9, + Grandchild: Grandchild{ + S: "BAD2", + }, + }, + }, + Strings: []plsString{ + "something1", + "something2", + }, + }, + }, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Parent": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "Children": {ValueType: &pb.Value_ArrayValue{ + ArrayValue: &pb.ArrayValue{Values: []*pb.Value{ + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 8}}, + "Grandchild.S": {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 8"}}, + }, + }, + }}, + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 10}}, + "Grandchild.S": {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 10"}}, + }, + }, + }}, + }}, + }}, + "Strings": {ValueType: &pb.Value_ArrayValue{ + ArrayValue: &pb.ArrayValue{Values: []*pb.Value{ + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + }}, + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + }}, + }}, + }}, + }, + }, + }}, + }, + }, + wantLoad: &GrandparentOfSlice{ + Parent: ParentOfSlice{ + Children: []Child{ + { + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + { + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + }, + Strings: []plsString{ + "LOADED", + "LOADED", + }, + }, + }, + }, + { + desc: "children (slice of ptrs) impl PLS", + src: &GrandparentOfSlicePtrs{ + Parent: ParentOfSlicePtrs{ + Children: []*Child{ + { + I: 7, + Grandchild: Grandchild{ + S: "BAD", + }, + }, + { + I: 9, + Grandchild: Grandchild{ + S: "BAD2", + }, + }, + }, + Strings: []*plsString{ + ptrToplsString("something1"), + ptrToplsString("something2"), + }, + }, + }, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Parent": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "Children": {ValueType: &pb.Value_ArrayValue{ + ArrayValue: &pb.ArrayValue{Values: []*pb.Value{ + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 8}}, + "Grandchild.S": {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 8"}}, + }, + }, + }}, + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 10}}, + "Grandchild.S": {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 10"}}, + }, + }, + }}, + }}, + }}, + "Strings": {ValueType: &pb.Value_ArrayValue{ + ArrayValue: &pb.ArrayValue{Values: []*pb.Value{ + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + }}, + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "SS": {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + }}, + }}, + }}, + }, + }, + }}, + }, + }, + wantLoad: &GrandparentOfSlicePtrs{ + Parent: ParentOfSlicePtrs{ + Children: []*Child{ + { + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + { + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + }, + Strings: []*plsString{ + ptrToplsString("LOADED"), + ptrToplsString("LOADED"), + }, + }, + }, + }, + { + desc: "parent has flatten option, children (slice of) impl PLS", + src: &GrandparentOfSliceFlatten{ + Parent: ParentOfSlice{ + Children: []Child{ + { + I: 7, + Grandchild: Grandchild{ + S: "BAD", + }, + }, + { + I: 9, + Grandchild: Grandchild{ + S: "BAD2", + }, + }, + }, + Strings: []plsString{ + "something1", + "something2", + }, + }, + }, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Parent.Children.I": {ValueType: &pb.Value_ArrayValue{ArrayValue: &pb.ArrayValue{ + Values: []*pb.Value{ + {ValueType: &pb.Value_IntegerValue{IntegerValue: 8}}, + {ValueType: &pb.Value_IntegerValue{IntegerValue: 10}}, + }, + }, + }}, + "Parent.Children.Grandchild.S": {ValueType: &pb.Value_ArrayValue{ArrayValue: &pb.ArrayValue{ + Values: []*pb.Value{ + {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 8"}}, + {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 10"}}, + }, + }, + }}, + "Parent.Strings.SS": {ValueType: &pb.Value_ArrayValue{ArrayValue: &pb.ArrayValue{ + Values: []*pb.Value{ + {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + }}, + }, + }, + wantLoad: &GrandparentOfSliceFlatten{ + Parent: ParentOfSlice{ + Children: []Child{ + { + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + { + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + }, + Strings: []plsString{ + "LOADED", + "LOADED", + }, + }, + }, + }, + { + desc: "parent has flatten option, children (slice of ptrs) impl PLS", + src: &GrandparentOfSlicePtrsFlatten{ + Parent: ParentOfSlicePtrs{ + Children: []*Child{ + { + I: 7, + Grandchild: Grandchild{ + S: "BAD", + }, + }, + { + I: 9, + Grandchild: Grandchild{ + S: "BAD2", + }, + }, + }, + Strings: []*plsString{ + ptrToplsString("something1"), + ptrToplsString("something1"), + }, + }, + }, + wantSave: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Parent.Children.I": {ValueType: &pb.Value_ArrayValue{ArrayValue: &pb.ArrayValue{ + Values: []*pb.Value{ + {ValueType: &pb.Value_IntegerValue{IntegerValue: 8}}, + {ValueType: &pb.Value_IntegerValue{IntegerValue: 10}}, + }, + }, + }}, + "Parent.Children.Grandchild.S": {ValueType: &pb.Value_ArrayValue{ArrayValue: &pb.ArrayValue{ + Values: []*pb.Value{ + {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 8"}}, + {ValueType: &pb.Value_StringValue{StringValue: "grandchild saved 10"}}, + }, + }, + }}, + "Parent.Strings.SS": {ValueType: &pb.Value_ArrayValue{ArrayValue: &pb.ArrayValue{ + Values: []*pb.Value{ + {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + {ValueType: &pb.Value_StringValue{StringValue: "SAVED"}}, + }, + }, + }}, + }, + }, + wantLoad: &GrandparentOfSlicePtrsFlatten{ + Parent: ParentOfSlicePtrs{ + Children: []*Child{ + { + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + { + I: 1, + Grandchild: Grandchild{ + S: "grandchild loaded", + }, + }, + }, + Strings: []*plsString{ + ptrToplsString("LOADED"), + ptrToplsString("LOADED"), + }, + }, + }, + }, + } + + for _, tc := range testCases { + e, err := saveEntity(testKey0, tc.src) + if tc.saveErr == "" { // Want no error. + if err != nil { + t.Errorf("%s: save: %v", tc.desc, err) + continue + } + if !testutil.Equal(e, tc.wantSave) { + t.Errorf("%s: save: \ngot: %+v\nwant: %+v", tc.desc, e, tc.wantSave) + continue + } + } else { // Want error. + if err == nil { + t.Errorf("%s: save: want err", tc.desc) + continue + } + if !strings.Contains(err.Error(), tc.saveErr) { + t.Errorf("%s: save: \ngot err '%s'\nwant err '%s'", tc.desc, err.Error(), tc.saveErr) + } + continue + } + + gota := reflect.New(reflect.TypeOf(tc.wantLoad).Elem()).Interface() + err = loadEntityProto(gota, e) + if tc.loadErr == "" { // Want no error. + if err != nil { + t.Errorf("%s: load: %v", tc.desc, err) + continue + } + if !testutil.Equal(gota, tc.wantLoad) { + t.Errorf("%s: load: \ngot: %+v\nwant: %+v", tc.desc, gota, tc.wantLoad) + continue + } + } else { // Want error. + if err == nil { + t.Errorf("%s: load: want err", tc.desc) + continue + } + if !strings.Contains(err.Error(), tc.loadErr) { + t.Errorf("%s: load: \ngot err '%s'\nwant err '%s'", tc.desc, err.Error(), tc.loadErr) + } + } + } +} + +func TestQueryConstruction(t *testing.T) { + tests := []struct { + q, exp *Query + err string + }{ + { + q: NewQuery("Foo"), + exp: &Query{ + kind: "Foo", + limit: -1, + }, + }, + { + // Regular filtered query with standard spacing. + q: NewQuery("Foo").Filter("foo >", 7), + exp: &Query{ + kind: "Foo", + filter: []filter{ + { + FieldName: "foo", + Op: greaterThan, + Value: 7, + }, + }, + limit: -1, + }, + }, + { + // Filtered query with no spacing. + q: NewQuery("Foo").Filter("foo=", 6), + exp: &Query{ + kind: "Foo", + filter: []filter{ + { + FieldName: "foo", + Op: equal, + Value: 6, + }, + }, + limit: -1, + }, + }, + { + // Filtered query with funky spacing. + q: NewQuery("Foo").Filter(" foo< ", 8), + exp: &Query{ + kind: "Foo", + filter: []filter{ + { + FieldName: "foo", + Op: lessThan, + Value: 8, + }, + }, + limit: -1, + }, + }, + { + // Filtered query with multicharacter op. + q: NewQuery("Foo").Filter("foo >=", 9), + exp: &Query{ + kind: "Foo", + filter: []filter{ + { + FieldName: "foo", + Op: greaterEq, + Value: 9, + }, + }, + limit: -1, + }, + }, + { + // Query with ordering. + q: NewQuery("Foo").Order("bar"), + exp: &Query{ + kind: "Foo", + order: []order{ + { + FieldName: "bar", + Direction: ascending, + }, + }, + limit: -1, + }, + }, + { + // Query with reverse ordering, and funky spacing. + q: NewQuery("Foo").Order(" - bar"), + exp: &Query{ + kind: "Foo", + order: []order{ + { + FieldName: "bar", + Direction: descending, + }, + }, + limit: -1, + }, + }, + { + // Query with an empty ordering. + q: NewQuery("Foo").Order(""), + err: "empty order", + }, + { + // Query with a + ordering. + q: NewQuery("Foo").Order("+bar"), + err: "invalid order", + }, + } + for i, test := range tests { + if test.q.err != nil { + got := test.q.err.Error() + if !strings.Contains(got, test.err) { + t.Errorf("%d: error mismatch: got %q want something containing %q", i, got, test.err) + } + continue + } + if !testutil.Equal(test.q, test.exp, cmp.AllowUnexported(Query{})) { + t.Errorf("%d: mismatch: got %v want %v", i, test.q, test.exp) + } + } +} + +func TestPutMultiTypes(t *testing.T) { + ctx := context.Background() + type S struct { + A int + B string + } + + testCases := []struct { + desc string + src interface{} + wantErr bool + }{ + // Test cases to check each of the valid input types for src. + // Each case has the same elements. + { + desc: "type []struct", + src: []S{ + {1, "one"}, {2, "two"}, + }, + }, + { + desc: "type []*struct", + src: []*S{ + {1, "one"}, {2, "two"}, + }, + }, + { + desc: "type []interface{} with PLS elems", + src: []interface{}{ + &PropertyList{Property{Name: "A", Value: 1}, Property{Name: "B", Value: "one"}}, + &PropertyList{Property{Name: "A", Value: 2}, Property{Name: "B", Value: "two"}}, + }, + }, + { + desc: "type []interface{} with struct ptr elems", + src: []interface{}{ + &S{1, "one"}, &S{2, "two"}, + }, + }, + { + desc: "type []PropertyLoadSaver{}", + src: []PropertyLoadSaver{ + &PropertyList{Property{Name: "A", Value: 1}, Property{Name: "B", Value: "one"}}, + &PropertyList{Property{Name: "A", Value: 2}, Property{Name: "B", Value: "two"}}, + }, + }, + { + desc: "type []P (non-pointer, *P implements PropertyLoadSaver)", + src: []PropertyList{ + {Property{Name: "A", Value: 1}, Property{Name: "B", Value: "one"}}, + {Property{Name: "A", Value: 2}, Property{Name: "B", Value: "two"}}, + }, + }, + // Test some invalid cases. + { + desc: "type []interface{} with struct elems", + src: []interface{}{ + S{1, "one"}, S{2, "two"}, + }, + wantErr: true, + }, + { + desc: "PropertyList", + src: PropertyList{ + Property{Name: "A", Value: 1}, + Property{Name: "B", Value: "one"}, + }, + wantErr: true, + }, + { + desc: "type []int", + src: []int{1, 2}, + wantErr: true, + }, + { + desc: "not a slice", + src: S{1, "one"}, + wantErr: true, + }, + } + + // Use the same keys and expected entities for all tests. + keys := []*Key{ + NameKey("testKind", "first", nil), + NameKey("testKind", "second", nil), + } + want := []*pb.Mutation{ + {Operation: &pb.Mutation_Upsert{ + Upsert: &pb.Entity{ + Key: keyToProto(keys[0]), + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_IntegerValue{IntegerValue: 1}}, + "B": {ValueType: &pb.Value_StringValue{StringValue: "one"}}, + }, + }}}, + {Operation: &pb.Mutation_Upsert{ + Upsert: &pb.Entity{ + Key: keyToProto(keys[1]), + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + "B": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + }, + }}}, + } + + for _, tt := range testCases { + // Set up a fake client which captures upserts. + var got []*pb.Mutation + client := &Client{ + client: &fakeClient{ + commitFn: func(req *pb.CommitRequest) (*pb.CommitResponse, error) { + got = req.Mutations + return &pb.CommitResponse{}, nil + }, + }, + } + + _, err := client.PutMulti(ctx, keys, tt.src) + if err != nil { + if !tt.wantErr { + t.Errorf("%s: error %v", tt.desc, err) + } + continue + } + if tt.wantErr { + t.Errorf("%s: wanted error, but none returned", tt.desc) + continue + } + if len(got) != len(want) { + t.Errorf("%s: got %d entities, want %d", tt.desc, len(got), len(want)) + continue + } + for i, e := range got { + if !proto.Equal(e, want[i]) { + t.Logf("%s: entity %d doesn't match\ngot: %v\nwant: %v", tt.desc, i, e, want[i]) + } + } + } +} + +func TestNoIndexOnSliceProperties(t *testing.T) { + // Check that ExcludeFromIndexes is set on the inner elements, + // rather than the top-level ArrayValue value. + pl := PropertyList{ + Property{ + Name: "repeated", + Value: []interface{}{ + 123, + false, + "short", + strings.Repeat("a", 1503), + }, + NoIndex: true, + }, + } + key := NameKey("dummy", "dummy", nil) + + entity, err := saveEntity(key, &pl) + if err != nil { + t.Fatalf("saveEntity: %v", err) + } + + want := &pb.Value{ + ValueType: &pb.Value_ArrayValue{ArrayValue: &pb.ArrayValue{Values: []*pb.Value{ + {ValueType: &pb.Value_IntegerValue{IntegerValue: 123}, ExcludeFromIndexes: true}, + {ValueType: &pb.Value_BooleanValue{BooleanValue: false}, ExcludeFromIndexes: true}, + {ValueType: &pb.Value_StringValue{StringValue: "short"}, ExcludeFromIndexes: true}, + {ValueType: &pb.Value_StringValue{StringValue: strings.Repeat("a", 1503)}, ExcludeFromIndexes: true}, + }}}, + } + if got := entity.Properties["repeated"]; !proto.Equal(got, want) { + t.Errorf("Entity proto differs\ngot: %v\nwant: %v", got, want) + } +} + +type byName PropertyList + +func (s byName) Len() int { return len(s) } +func (s byName) Less(i, j int) bool { return s[i].Name < s[j].Name } +func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// sortPL sorts the property list by property name, and +// recursively sorts any nested property lists, or nested slices of +// property lists. +func sortPL(pl PropertyList) { + sort.Stable(byName(pl)) + for _, p := range pl { + switch p.Value.(type) { + case *Entity: + sortPL(p.Value.(*Entity).Properties) + case []interface{}: + for _, p2 := range p.Value.([]interface{}) { + if nent, ok := p2.(*Entity); ok { + sortPL(nent.Properties) + } + } + } + } +} + +func TestValidGeoPoint(t *testing.T) { + testCases := []struct { + desc string + pt GeoPoint + want bool + }{ + { + "valid", + GeoPoint{67.21, 13.37}, + true, + }, + { + "high lat", + GeoPoint{-90.01, 13.37}, + false, + }, + { + "low lat", + GeoPoint{90.01, 13.37}, + false, + }, + { + "high lng", + GeoPoint{67.21, 182}, + false, + }, + { + "low lng", + GeoPoint{67.21, -181}, + false, + }, + } + + for _, tc := range testCases { + if got := tc.pt.Valid(); got != tc.want { + t.Errorf("%s: got %v, want %v", tc.desc, got, tc.want) + } + } +} + +func TestPutInvalidEntity(t *testing.T) { + // Test that trying to put an invalid entity always returns the correct error + // type. + + // Fake client that can pretend to start a transaction. + fakeClient := &fakeDatastoreClient{ + beginTransaction: func(*pb.BeginTransactionRequest) (*pb.BeginTransactionResponse, error) { + return &pb.BeginTransactionResponse{ + Transaction: []byte("deadbeef"), + }, nil + }, + } + client := &Client{ + client: fakeClient, + } + + ctx := context.Background() + key := IncompleteKey("kind", nil) + + _, err := client.Put(ctx, key, "invalid entity") + if err != ErrInvalidEntityType { + t.Errorf("client.Put returned err %v, want %v", err, ErrInvalidEntityType) + } + + _, err = client.PutMulti(ctx, []*Key{key}, []interface{}{"invalid entity"}) + if me, ok := err.(MultiError); !ok { + t.Errorf("client.PutMulti returned err %v, want MultiError type", err) + } else if len(me) != 1 || me[0] != ErrInvalidEntityType { + t.Errorf("client.PutMulti returned err %v, want MulitError{ErrInvalidEntityType}", err) + } + + client.RunInTransaction(ctx, func(tx *Transaction) error { + _, err := tx.Put(key, "invalid entity") + if err != ErrInvalidEntityType { + t.Errorf("tx.Put returned err %v, want %v", err, ErrInvalidEntityType) + } + + _, err = tx.PutMulti([]*Key{key}, []interface{}{"invalid entity"}) + if me, ok := err.(MultiError); !ok { + t.Errorf("tx.PutMulti returned err %v, want MultiError type", err) + } else if len(me) != 1 || me[0] != ErrInvalidEntityType { + t.Errorf("tx.PutMulti returned err %v, want MulitError{ErrInvalidEntityType}", err) + } + + return errors.New("bang") // Return error: we don't actually want to commit. + }) +} + +func TestDeferred(t *testing.T) { + type Ent struct { + A int + B string + } + + keys := []*Key{ + NameKey("testKind", "first", nil), + NameKey("testKind", "second", nil), + } + + entity1 := &pb.Entity{ + Key: keyToProto(keys[0]), + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_IntegerValue{IntegerValue: 1}}, + "B": {ValueType: &pb.Value_StringValue{StringValue: "one"}}, + }, + } + entity2 := &pb.Entity{ + Key: keyToProto(keys[1]), + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + "B": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + }, + } + + // count keeps track of the number of times fakeClient.lookup has been + // called. + var count int + // Fake client that will return Deferred keys in resp on the first call. + fakeClient := &fakeDatastoreClient{ + lookup: func(*pb.LookupRequest) (*pb.LookupResponse, error) { + count++ + // On the first call, we return deferred keys. + if count == 1 { + return &pb.LookupResponse{ + Found: []*pb.EntityResult{ + { + Entity: entity1, + Version: 1, + }, + }, + Deferred: []*pb.Key{ + keyToProto(keys[1]), + }, + }, nil + } + + // On the second call, we do not return any more deferred keys. + return &pb.LookupResponse{ + Found: []*pb.EntityResult{ + { + Entity: entity2, + Version: 1, + }, + }, + }, nil + }, + } + client := &Client{ + client: fakeClient, + } + + ctx := context.Background() + + dst := make([]Ent, len(keys)) + err := client.GetMulti(ctx, keys, dst) + if err != nil { + t.Fatalf("client.Get: %v", err) + } + + if count != 2 { + t.Fatalf("expected client.lookup to be called 2 times. Got %d", count) + } + + if len(dst) != 2 { + t.Fatalf("expected 2 entities returned, got %d", len(dst)) + } + + for _, e := range dst { + if e.A == 1 { + if e.B != "one" { + t.Fatalf("unexpected entity %+v", e) + } + } else if e.A == 2 { + if e.B != "two" { + t.Fatalf("unexpected entity %+v", e) + } + } else { + t.Fatalf("unexpected entity %+v", e) + } + } + +} + +type KeyLoaderEnt struct { + A int + K *Key +} + +func (e *KeyLoaderEnt) Load(p []Property) error { + e.A = 2 + return nil +} + +func (e *KeyLoaderEnt) LoadKey(k *Key) error { + e.K = k + return nil +} + +func (e *KeyLoaderEnt) Save() ([]Property, error) { + return []Property{{Name: "A", Value: int64(3)}}, nil +} + +func TestKeyLoaderEndToEnd(t *testing.T) { + keys := []*Key{ + NameKey("testKind", "first", nil), + NameKey("testKind", "second", nil), + } + + entity1 := &pb.Entity{ + Key: keyToProto(keys[0]), + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_IntegerValue{IntegerValue: 1}}, + "B": {ValueType: &pb.Value_StringValue{StringValue: "one"}}, + }, + } + entity2 := &pb.Entity{ + Key: keyToProto(keys[1]), + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + "B": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + }, + } + + fakeClient := &fakeDatastoreClient{ + lookup: func(*pb.LookupRequest) (*pb.LookupResponse, error) { + return &pb.LookupResponse{ + Found: []*pb.EntityResult{ + { + Entity: entity1, + Version: 1, + }, + { + Entity: entity2, + Version: 1, + }, + }, + }, nil + }, + } + client := &Client{ + client: fakeClient, + } + + ctx := context.Background() + + dst := make([]*KeyLoaderEnt, len(keys)) + err := client.GetMulti(ctx, keys, dst) + if err != nil { + t.Fatalf("client.Get: %v", err) + } + + for i := range dst { + if !testutil.Equal(dst[i].K, keys[i]) { + t.Fatalf("unexpected entity %d to have key %+v, got %+v", i, keys[i], dst[i].K) + } + } +} + +func TestDeferredMissing(t *testing.T) { + type Ent struct { + A int + B string + } + + keys := []*Key{ + NameKey("testKind", "first", nil), + NameKey("testKind", "second", nil), + } + + entity1 := &pb.Entity{ + Key: keyToProto(keys[0]), + } + entity2 := &pb.Entity{ + Key: keyToProto(keys[1]), + } + + var count int + fakeClient := &fakeDatastoreClient{ + lookup: func(*pb.LookupRequest) (*pb.LookupResponse, error) { + count++ + + if count == 1 { + return &pb.LookupResponse{ + Missing: []*pb.EntityResult{ + { + Entity: entity1, + Version: 1, + }, + }, + Deferred: []*pb.Key{ + keyToProto(keys[1]), + }, + }, nil + } + + return &pb.LookupResponse{ + Missing: []*pb.EntityResult{ + { + Entity: entity2, + Version: 1, + }, + }, + }, nil + }, + } + client := &Client{ + client: fakeClient, + } + + ctx := context.Background() + + dst := make([]Ent, len(keys)) + err := client.GetMulti(ctx, keys, dst) + errs, ok := err.(MultiError) + if !ok { + t.Fatalf("expected error returns to be MultiError; got %v", err) + } + if len(errs) != 2 { + t.Fatalf("expected 2 errors returns, got %d", len(errs)) + } + if errs[0] != ErrNoSuchEntity { + t.Fatalf("expected error to be ErrNoSuchEntity; got %v", errs[0]) + } + if errs[1] != ErrNoSuchEntity { + t.Fatalf("expected error to be ErrNoSuchEntity; got %v", errs[1]) + } + + if count != 2 { + t.Fatalf("expected client.lookup to be called 2 times. Got %d", count) + } + + if len(dst) != 2 { + t.Fatalf("expected 2 entities returned, got %d", len(dst)) + } + + for _, e := range dst { + if e.A != 0 || e.B != "" { + t.Fatalf("unexpected entity %+v", e) + } + } +} + +func TestGetWithNilKey(t *testing.T) { + client := &Client{} + err := client.Get(context.Background(), nil, []Property{}) + if err != ErrInvalidKey { + t.Fatalf("want ErrInvalidKey, got %v", err) + } +} + +func TestGetMultiWithNilKey(t *testing.T) { + client := &Client{} + dest := make([]PropertyList, 1) + err := client.GetMulti(context.Background(), []*Key{nil}, dest) + if me, ok := err.(MultiError); !ok { + t.Fatalf("want MultiError, got %v", err) + } else if len(me) != 1 || me[0] != ErrInvalidKey { + t.Fatalf("want MultiError{ErrInvalidKey}, got %v", me) + } +} + +func TestGetWithIncompleteKey(t *testing.T) { + client := &Client{} + err := client.Get(context.Background(), &Key{Kind: "testKind"}, []Property{}) + if err == nil { + t.Fatalf("want err, got nil") + } +} + +func TestGetMultiWithIncompleteKey(t *testing.T) { + client := &Client{} + dest := make([]PropertyList, 1) + err := client.GetMulti(context.Background(), []*Key{{Kind: "testKind"}}, dest) + if me, ok := err.(MultiError); !ok { + t.Fatalf("want MultiError, got %v", err) + } else if len(me) != 1 || me[0] == nil { + t.Fatalf("want MultiError{err}, got %v", me) + } +} + +func TestDeleteWithNilKey(t *testing.T) { + client := &Client{} + err := client.Delete(context.Background(), nil) + if err != ErrInvalidKey { + t.Fatalf("want ErrInvalidKey, got %v", err) + } +} + +func TestDeleteMultiWithNilKey(t *testing.T) { + client := &Client{} + err := client.DeleteMulti(context.Background(), []*Key{nil}) + if me, ok := err.(MultiError); !ok { + t.Fatalf("want MultiError, got %v", err) + } else if len(me) != 1 || me[0] != ErrInvalidKey { + t.Fatalf("want MultiError{ErrInvalidKey}, got %v", me) + } +} + +func TestDeleteWithIncompleteKey(t *testing.T) { + client := &Client{} + err := client.Delete(context.Background(), &Key{Kind: "testKind"}) + if err == nil { + t.Fatalf("want err, got nil") + } +} + +func TestDeleteMultiWithIncompleteKey(t *testing.T) { + client := &Client{} + err := client.DeleteMulti(context.Background(), []*Key{{Kind: "testKind"}}) + if me, ok := err.(MultiError); !ok { + t.Fatalf("want MultiError, got %v", err) + } else if len(me) != 1 || me[0] == nil { + t.Fatalf("want MultiError{err}, got %v", me) + } +} + +type fakeDatastoreClient struct { + pb.DatastoreClient + + // Optional handlers for the datastore methods. + // Any handlers left undefined will return an error. + lookup func(*pb.LookupRequest) (*pb.LookupResponse, error) + runQuery func(*pb.RunQueryRequest) (*pb.RunQueryResponse, error) + beginTransaction func(*pb.BeginTransactionRequest) (*pb.BeginTransactionResponse, error) + commit func(*pb.CommitRequest) (*pb.CommitResponse, error) + rollback func(*pb.RollbackRequest) (*pb.RollbackResponse, error) + allocateIds func(*pb.AllocateIdsRequest) (*pb.AllocateIdsResponse, error) +} + +func (c *fakeDatastoreClient) Lookup(ctx context.Context, in *pb.LookupRequest, opts ...grpc.CallOption) (*pb.LookupResponse, error) { + if c.lookup == nil { + return nil, errors.New("no lookup handler defined") + } + return c.lookup(in) +} +func (c *fakeDatastoreClient) RunQuery(ctx context.Context, in *pb.RunQueryRequest, opts ...grpc.CallOption) (*pb.RunQueryResponse, error) { + if c.runQuery == nil { + return nil, errors.New("no runQuery handler defined") + } + return c.runQuery(in) +} +func (c *fakeDatastoreClient) BeginTransaction(ctx context.Context, in *pb.BeginTransactionRequest, opts ...grpc.CallOption) (*pb.BeginTransactionResponse, error) { + if c.beginTransaction == nil { + return nil, errors.New("no beginTransaction handler defined") + } + return c.beginTransaction(in) +} +func (c *fakeDatastoreClient) Commit(ctx context.Context, in *pb.CommitRequest, opts ...grpc.CallOption) (*pb.CommitResponse, error) { + if c.commit == nil { + return nil, errors.New("no commit handler defined") + } + return c.commit(in) +} +func (c *fakeDatastoreClient) Rollback(ctx context.Context, in *pb.RollbackRequest, opts ...grpc.CallOption) (*pb.RollbackResponse, error) { + if c.rollback == nil { + return nil, errors.New("no rollback handler defined") + } + return c.rollback(in) +} +func (c *fakeDatastoreClient) AllocateIds(ctx context.Context, in *pb.AllocateIdsRequest, opts ...grpc.CallOption) (*pb.AllocateIdsResponse, error) { + if c.allocateIds == nil { + return nil, errors.New("no allocateIds handler defined") + } + return c.allocateIds(in) +} diff --git a/vendor/cloud.google.com/go/datastore/doc.go b/vendor/cloud.google.com/go/datastore/doc.go new file mode 100644 index 000000000..2d252e03e --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/doc.go @@ -0,0 +1,490 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package datastore provides a client for Google Cloud Datastore. + +See https://godoc.org/cloud.google.com/go for authentication, timeouts, +connection pooling and similar aspects of this package. + + +Basic Operations + +Entities are the unit of storage and are associated with a key. A key +consists of an optional parent key, a string application ID, a string kind +(also known as an entity type), and either a StringID or an IntID. A +StringID is also known as an entity name or key name. + +It is valid to create a key with a zero StringID and a zero IntID; this is +called an incomplete key, and does not refer to any saved entity. Putting an +entity into the datastore under an incomplete key will cause a unique key +to be generated for that entity, with a non-zero IntID. + +An entity's contents are a mapping from case-sensitive field names to values. +Valid value types are: + - Signed integers (int, int8, int16, int32 and int64) + - bool + - string + - float32 and float64 + - []byte (up to 1 megabyte in length) + - Any type whose underlying type is one of the above predeclared types + - *Key + - GeoPoint + - time.Time (stored with microsecond precision, retrieved as local time) + - Structs whose fields are all valid value types + - Pointers to structs whose fields are all valid value types + - Slices of any of the above + - Pointers to a signed integer, bool, string, float32, or float64 + +Slices of structs are valid, as are structs that contain slices. + +The Get and Put functions load and save an entity's contents. An entity's +contents are typically represented by a struct pointer. + +Example code: + + type Entity struct { + Value string + } + + func main() { + ctx := context.Background() + + // Create a datastore client. In a typical application, you would create + // a single client which is reused for every datastore operation. + dsClient, err := datastore.NewClient(ctx, "my-project") + if err != nil { + // Handle error. + } + + k := datastore.NameKey("Entity", "stringID", nil) + e := new(Entity) + if err := dsClient.Get(ctx, k, e); err != nil { + // Handle error. + } + + old := e.Value + e.Value = "Hello World!" + + if _, err := dsClient.Put(ctx, k, e); err != nil { + // Handle error. + } + + fmt.Printf("Updated value from %q to %q\n", old, e.Value) + } + +GetMulti, PutMulti and DeleteMulti are batch versions of the Get, Put and +Delete functions. They take a []*Key instead of a *Key, and may return a +datastore.MultiError when encountering partial failure. + +Mutate generalizes PutMulti and DeleteMulti to a sequence of any Datastore mutations. +It takes a series of mutations created with NewInsert, NewUpdate, NewUpsert and +NewDelete and applies them atomically. + + +Properties + +An entity's contents can be represented by a variety of types. These are +typically struct pointers, but can also be any type that implements the +PropertyLoadSaver interface. If using a struct pointer, you do not have to +explicitly implement the PropertyLoadSaver interface; the datastore will +automatically convert via reflection. If a struct pointer does implement +PropertyLoadSaver then those methods will be used in preference to the default +behavior for struct pointers. Struct pointers are more strongly typed and are +easier to use; PropertyLoadSavers are more flexible. + +The actual types passed do not have to match between Get and Put calls or even +across different calls to datastore. It is valid to put a *PropertyList and +get that same entity as a *myStruct, or put a *myStruct0 and get a *myStruct1. +Conceptually, any entity is saved as a sequence of properties, and is loaded +into the destination value on a property-by-property basis. When loading into +a struct pointer, an entity that cannot be completely represented (such as a +missing field) will result in an ErrFieldMismatch error but it is up to the +caller whether this error is fatal, recoverable or ignorable. + +By default, for struct pointers, all properties are potentially indexed, and +the property name is the same as the field name (and hence must start with an +upper case letter). + +Fields may have a `datastore:"name,options"` tag. The tag name is the +property name, which must be one or more valid Go identifiers joined by ".", +but may start with a lower case letter. An empty tag name means to just use the +field name. A "-" tag name means that the datastore will ignore that field. + +The only valid options are "omitempty", "noindex" and "flatten". + +If the options include "omitempty" and the value of the field is a zero value, +then the field will be omitted on Save. Zero values are best defined in the +golang spec (https://golang.org/ref/spec#The_zero_value). Struct field values +will never be empty, except for nil pointers. + +If options include "noindex" then the field will not be indexed. All fields +are indexed by default. Strings or byte slices longer than 1500 bytes cannot +be indexed; fields used to store long strings and byte slices must be tagged +with "noindex" or they will cause Put operations to fail. + +For a nested struct field, the options may also include "flatten". This +indicates that the immediate fields and any nested substruct fields of the +nested struct should be flattened. See below for examples. + +To use multiple options together, separate them by a comma. +The order does not matter. + +If the options is "" then the comma may be omitted. + +Example code: + + // A and B are renamed to a and b. + // A, C and J are not indexed. + // D's tag is equivalent to having no tag at all (E). + // I is ignored entirely by the datastore. + // J has tag information for both the datastore and json packages. + type TaggedStruct struct { + A int `datastore:"a,noindex"` + B int `datastore:"b"` + C int `datastore:",noindex"` + D int `datastore:""` + E int + I int `datastore:"-"` + J int `datastore:",noindex" json:"j"` + } + + +Slice Fields + +A field of slice type corresponds to a Datastore array property, except for []byte, which corresponds +to a Datastore blob. + +Zero-length slice fields are not saved. Slice fields of length 1 or greater are saved +as Datastore arrays. When a zero-length Datastore array is loaded into a slice field, +the slice field remains unchanged. + +If a non-array value is loaded into a slice field, the result will be a slice with +one element, containing the value. + +Loading Nulls + +Loading a Datastore Null into a basic type (int, float, etc.) results in a zero value. +Loading a Null into a slice of basic type results in a slice of size 1 containing the zero value. +Loading a Null into a pointer field results in nil. +Loading a Null into a field of struct type is an error. + +Pointer Fields + +A struct field can be a pointer to a signed integer, floating-point number, string or +bool. Putting a non-nil pointer will store its dereferenced value. Putting a nil +pointer will store a Datastore Null property, unless the field is marked omitempty, +in which case no property will be stored. + +Loading a Null into a pointer field sets the pointer to nil. Loading any other value +allocates new storage with the value, and sets the field to point to it. + + +Key Field + +If the struct contains a *datastore.Key field tagged with the name "__key__", +its value will be ignored on Put. When reading the Entity back into the Go struct, +the field will be populated with the *datastore.Key value used to query for +the Entity. + +Example code: + + type MyEntity struct { + A int + K *datastore.Key `datastore:"__key__"` + } + + k := datastore.NameKey("Entity", "stringID", nil) + e := MyEntity{A: 12} + k, err = dsClient.Put(ctx, k, e) + if err != nil { + // Handle error. + } + + var entities []MyEntity + q := datastore.NewQuery("Entity").Filter("A =", 12).Limit(1) + _, err := dsClient.GetAll(ctx, q, &entities) + if err != nil { + // Handle error + } + + log.Println(entities[0]) + // Prints {12 /Entity,stringID} + + + +Structured Properties + +If the struct pointed to contains other structs, then the nested or embedded +structs are themselves saved as Entity values. For example, given these definitions: + + type Inner struct { + W int32 + X string + } + + type Outer struct { + I Inner + } + +then an Outer would have one property, Inner, encoded as an Entity value. + +If an outer struct is tagged "noindex" then all of its implicit flattened +fields are effectively "noindex". + +If the Inner struct contains a *Key field with the name "__key__", like so: + + type Inner struct { + W int32 + X string + K *datastore.Key `datastore:"__key__"` + } + + type Outer struct { + I Inner + } + +then the value of K will be used as the Key for Inner, represented +as an Entity value in datastore. + +If any nested struct fields should be flattened, instead of encoded as +Entity values, the nested struct field should be tagged with the "flatten" +option. For example, given the following: + + type Inner1 struct { + W int32 + X string + } + + type Inner2 struct { + Y float64 + } + + type Inner3 struct { + Z bool + } + + type Inner4 struct { + WW int + } + + type Inner5 struct { + X Inner4 + } + + type Outer struct { + A int16 + I []Inner1 `datastore:",flatten"` + J Inner2 `datastore:",flatten"` + K Inner5 `datastore:",flatten"` + Inner3 `datastore:",flatten"` + } + +an Outer's properties would be equivalent to those of: + + type OuterEquivalent struct { + A int16 + IDotW []int32 `datastore:"I.W"` + IDotX []string `datastore:"I.X"` + JDotY float64 `datastore:"J.Y"` + KDotXDotWW int `datastore:"K.X.WW"` + Z bool + } + +Note that the "flatten" option cannot be used for Entity value fields. +The server will reject any dotted field names for an Entity value. + + +The PropertyLoadSaver Interface + +An entity's contents can also be represented by any type that implements the +PropertyLoadSaver interface. This type may be a struct pointer, but it does +not have to be. The datastore package will call Load when getting the entity's +contents, and Save when putting the entity's contents. +Possible uses include deriving non-stored fields, verifying fields, or indexing +a field only if its value is positive. + +Example code: + + type CustomPropsExample struct { + I, J int + // Sum is not stored, but should always be equal to I + J. + Sum int `datastore:"-"` + } + + func (x *CustomPropsExample) Load(ps []datastore.Property) error { + // Load I and J as usual. + if err := datastore.LoadStruct(x, ps); err != nil { + return err + } + // Derive the Sum field. + x.Sum = x.I + x.J + return nil + } + + func (x *CustomPropsExample) Save() ([]datastore.Property, error) { + // Validate the Sum field. + if x.Sum != x.I + x.J { + return nil, errors.New("CustomPropsExample has inconsistent sum") + } + // Save I and J as usual. The code below is equivalent to calling + // "return datastore.SaveStruct(x)", but is done manually for + // demonstration purposes. + return []datastore.Property{ + { + Name: "I", + Value: int64(x.I), + }, + { + Name: "J", + Value: int64(x.J), + }, + }, nil + } + +The *PropertyList type implements PropertyLoadSaver, and can therefore hold an +arbitrary entity's contents. + +The KeyLoader Interface + +If a type implements the PropertyLoadSaver interface, it may +also want to implement the KeyLoader interface. +The KeyLoader interface exists to allow implementations of PropertyLoadSaver +to also load an Entity's Key into the Go type. This type may be a struct +pointer, but it does not have to be. The datastore package will call LoadKey +when getting the entity's contents, after calling Load. + +Example code: + + type WithKeyExample struct { + I int + Key *datastore.Key + } + + func (x *WithKeyExample) LoadKey(k *datastore.Key) error { + x.Key = k + return nil + } + + func (x *WithKeyExample) Load(ps []datastore.Property) error { + // Load I as usual. + return datastore.LoadStruct(x, ps) + } + + func (x *WithKeyExample) Save() ([]datastore.Property, error) { + // Save I as usual. + return datastore.SaveStruct(x) + } + +To load a Key into a struct which does not implement the PropertyLoadSaver +interface, see the "Key Field" section above. + + +Queries + +Queries retrieve entities based on their properties or key's ancestry. Running +a query yields an iterator of results: either keys or (key, entity) pairs. +Queries are re-usable and it is safe to call Query.Run from concurrent +goroutines. Iterators are not safe for concurrent use. + +Queries are immutable, and are either created by calling NewQuery, or derived +from an existing query by calling a method like Filter or Order that returns a +new query value. A query is typically constructed by calling NewQuery followed +by a chain of zero or more such methods. These methods are: + - Ancestor and Filter constrain the entities returned by running a query. + - Order affects the order in which they are returned. + - Project constrains the fields returned. + - Distinct de-duplicates projected entities. + - KeysOnly makes the iterator return only keys, not (key, entity) pairs. + - Start, End, Offset and Limit define which sub-sequence of matching entities + to return. Start and End take cursors, Offset and Limit take integers. Start + and Offset affect the first result, End and Limit affect the last result. + If both Start and Offset are set, then the offset is relative to Start. + If both End and Limit are set, then the earliest constraint wins. Limit is + relative to Start+Offset, not relative to End. As a special case, a + negative limit means unlimited. + +Example code: + + type Widget struct { + Description string + Price int + } + + func printWidgets(ctx context.Context, client *datastore.Client) { + q := datastore.NewQuery("Widget"). + Filter("Price <", 1000). + Order("-Price") + + t := client.Run(ctx, q) + for { + var x Widget + key, err := t.Next(&x) + if err == iterator.Done { + break + } + if err != nil { + // Handle error. + } + fmt.Printf("Key=%v\nWidget=%#v\n\n", key, x) + } + } + + +Transactions + +Client.RunInTransaction runs a function in a transaction. + +Example code: + + type Counter struct { + Count int + } + + func incCount(ctx context.Context, client *datastore.Client) { + var count int + key := datastore.NameKey("Counter", "singleton", nil) + _, err := client.RunInTransaction(ctx, func(tx *datastore.Transaction) error { + var x Counter + if err := tx.Get(key, &x); err != nil && err != datastore.ErrNoSuchEntity { + return err + } + x.Count++ + if _, err := tx.Put(key, &x); err != nil { + return err + } + count = x.Count + return nil + }) + if err != nil { + // Handle error. + } + // The value of count is only valid once the transaction is successful + // (RunInTransaction has returned nil). + fmt.Printf("Count=%d\n", count) + } + +Pass the ReadOnly option to RunInTransaction if your transaction is used only for Get, +GetMulti or queries. Read-only transactions are more efficient. + +Google Cloud Datastore Emulator + +This package supports the Cloud Datastore emulator, which is useful for testing and +development. Environment variables are used to indicate that datastore traffic should be +directed to the emulator instead of the production Datastore service. + +To install and set up the emulator and its environment variables, see the documentation +at https://cloud.google.com/datastore/docs/tools/datastore-emulator. +*/ +package datastore // import "cloud.google.com/go/datastore" diff --git a/vendor/cloud.google.com/go/datastore/errors.go b/vendor/cloud.google.com/go/datastore/errors.go new file mode 100644 index 000000000..ee1f00221 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/errors.go @@ -0,0 +1,47 @@ +// 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. + +// This file provides error functions for common API failure modes. + +package datastore + +import ( + "fmt" +) + +// MultiError is returned by batch operations when there are errors with +// particular elements. Errors will be in a one-to-one correspondence with +// the input elements; successful elements will have a nil entry. +type MultiError []error + +func (m MultiError) Error() string { + s, n := "", 0 + for _, e := range m { + if e != nil { + if n == 0 { + s = e.Error() + } + n++ + } + } + switch n { + case 0: + return "(0 errors)" + case 1: + return s + case 2: + return s + " (and 1 other error)" + } + return fmt.Sprintf("%s (and %d other errors)", s, n-1) +} diff --git a/vendor/cloud.google.com/go/datastore/example_test.go b/vendor/cloud.google.com/go/datastore/example_test.go new file mode 100644 index 000000000..bbeba4267 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/example_test.go @@ -0,0 +1,593 @@ +// 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 datastore_test + +import ( + "context" + "fmt" + "log" + "time" + + "cloud.google.com/go/datastore" + "google.golang.org/api/iterator" +) + +func ExampleNewClient() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + _ = client // TODO: Use client. +} + +func ExampleClient_Get() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + type Article struct { + Title string + Description string + Body string `datastore:",noindex"` + Author *datastore.Key + PublishedAt time.Time + } + key := datastore.NameKey("Article", "articled1", nil) + article := &Article{} + if err := client.Get(ctx, key, article); err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_Put() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + type Article struct { + Title string + Description string + Body string `datastore:",noindex"` + Author *datastore.Key + PublishedAt time.Time + } + newKey := datastore.IncompleteKey("Article", nil) + _, err = client.Put(ctx, newKey, &Article{ + Title: "The title of the article", + Description: "The description of the article...", + Body: "...", + Author: datastore.NameKey("Author", "jbd", nil), + PublishedAt: time.Now(), + }) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_Put_flatten() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + log.Fatal(err) + } + + type Animal struct { + Name string + Type string + Breed string + } + + type Human struct { + Name string + Height int + Pet Animal `datastore:",flatten"` + } + + newKey := datastore.IncompleteKey("Human", nil) + _, err = client.Put(ctx, newKey, &Human{ + Name: "Susan", + Height: 67, + Pet: Animal{ + Name: "Fluffy", + Type: "Cat", + Breed: "Sphynx", + }, + }) + if err != nil { + log.Fatal(err) + } +} + +func ExampleClient_Delete() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + key := datastore.NameKey("Article", "articled1", nil) + if err := client.Delete(ctx, key); err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_DeleteMulti() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + var keys []*datastore.Key + for i := 1; i <= 10; i++ { + keys = append(keys, datastore.IDKey("Article", int64(i), nil)) + } + if err := client.DeleteMulti(ctx, keys); err != nil { + // TODO: Handle error. + } +} + +type Post struct { + Title string + PublishedAt time.Time + Comments int +} + +func ExampleClient_GetMulti() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + keys := []*datastore.Key{ + datastore.NameKey("Post", "post1", nil), + datastore.NameKey("Post", "post2", nil), + datastore.NameKey("Post", "post3", nil), + } + posts := make([]Post, 3) + if err := client.GetMulti(ctx, keys, posts); err != nil { + // TODO: Handle error. + } +} + +func ExampleMultiError() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + keys := []*datastore.Key{ + datastore.NameKey("bad-key", "bad-key", nil), + } + posts := make([]Post, 1) + if err := client.GetMulti(ctx, keys, posts); err != nil { + if merr, ok := err.(datastore.MultiError); ok { + for _, err := range merr { + // TODO: Handle error. + _ = err + } + } else { + // TODO: Handle error. + } + } +} + +func ExampleClient_PutMulti_slice() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + keys := []*datastore.Key{ + datastore.NameKey("Post", "post1", nil), + datastore.NameKey("Post", "post2", nil), + } + + // PutMulti with a Post slice. + posts := []*Post{ + {Title: "Post 1", PublishedAt: time.Now()}, + {Title: "Post 2", PublishedAt: time.Now()}, + } + if _, err := client.PutMulti(ctx, keys, posts); err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_PutMulti_interfaceSlice() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + keys := []*datastore.Key{ + datastore.NameKey("Post", "post1", nil), + datastore.NameKey("Post", "post2", nil), + } + + // PutMulti with an empty interface slice. + posts := []interface{}{ + &Post{Title: "Post 1", PublishedAt: time.Now()}, + &Post{Title: "Post 2", PublishedAt: time.Now()}, + } + if _, err := client.PutMulti(ctx, keys, posts); err != nil { + // TODO: Handle error. + } +} + +func ExampleNewQuery() { + // Query for Post entities. + q := datastore.NewQuery("Post") + _ = q // TODO: Use the query with Client.Run. +} + +func ExampleNewQuery_options() { + // Query to order the posts by the number of comments they have received. + q := datastore.NewQuery("Post").Order("-Comments") + // Start listing from an offset and limit the results. + q = q.Offset(20).Limit(10) + _ = q // TODO: Use the query. +} + +func ExampleClient_Count() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + // Count the number of the post entities. + q := datastore.NewQuery("Post") + n, err := client.Count(ctx, q) + if err != nil { + // TODO: Handle error. + } + fmt.Printf("There are %d posts.", n) +} + +func ExampleClient_Run() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + // List the posts published since yesterday. + yesterday := time.Now().Add(-24 * time.Hour) + q := datastore.NewQuery("Post").Filter("PublishedAt >", yesterday) + it := client.Run(ctx, q) + _ = it // TODO: iterate using Next. +} + +func ExampleClient_NewTransaction() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + const retries = 3 + + // Increment a counter. + // See https://cloud.google.com/appengine/articles/sharding_counters for + // a more scalable solution. + type Counter struct { + Count int + } + + key := datastore.NameKey("counter", "CounterA", nil) + var tx *datastore.Transaction + for i := 0; i < retries; i++ { + tx, err = client.NewTransaction(ctx) + if err != nil { + break + } + + var c Counter + if err = tx.Get(key, &c); err != nil && err != datastore.ErrNoSuchEntity { + break + } + c.Count++ + if _, err = tx.Put(key, &c); err != nil { + break + } + + // Attempt to commit the transaction. If there's a conflict, try again. + if _, err = tx.Commit(); err != datastore.ErrConcurrentTransaction { + break + } + } + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_RunInTransaction() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + // Increment a counter. + // See https://cloud.google.com/appengine/articles/sharding_counters for + // a more scalable solution. + type Counter struct { + Count int + } + + var count int + key := datastore.NameKey("Counter", "singleton", nil) + _, err = client.RunInTransaction(ctx, func(tx *datastore.Transaction) error { + var x Counter + if err := tx.Get(key, &x); err != nil && err != datastore.ErrNoSuchEntity { + return err + } + x.Count++ + if _, err := tx.Put(key, &x); err != nil { + return err + } + count = x.Count + return nil + }) + if err != nil { + // TODO: Handle error. + } + // The value of count is only valid once the transaction is successful + // (RunInTransaction has returned nil). + fmt.Printf("Count=%d\n", count) +} + +func ExampleClient_AllocateIDs() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + var keys []*datastore.Key + for i := 0; i < 10; i++ { + keys = append(keys, datastore.IncompleteKey("Article", nil)) + } + keys, err = client.AllocateIDs(ctx, keys) + if err != nil { + // TODO: Handle error. + } + _ = keys // TODO: Use keys. +} + +func ExampleKey_Encode() { + key := datastore.IDKey("Article", 1, nil) + encoded := key.Encode() + fmt.Println(encoded) + // Output: EgsKB0FydGljbGUQAQ +} + +func ExampleDecodeKey() { + const encoded = "EgsKB0FydGljbGUQAQ" + key, err := datastore.DecodeKey(encoded) + if err != nil { + // TODO: Handle error. + } + fmt.Println(key) + // Output: /Article,1 +} + +func ExampleIDKey() { + // Key with numeric ID. + k := datastore.IDKey("Article", 1, nil) + _ = k // TODO: Use key. +} + +func ExampleNameKey() { + // Key with string ID. + k := datastore.NameKey("Article", "article8", nil) + _ = k // TODO: Use key. +} + +func ExampleIncompleteKey() { + k := datastore.IncompleteKey("Article", nil) + _ = k // TODO: Use incomplete key. +} + +func ExampleClient_GetAll() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + var posts []*Post + keys, err := client.GetAll(ctx, datastore.NewQuery("Post"), &posts) + if err != nil { + // TODO: Handle error. + } + for i, key := range keys { + fmt.Println(key) + fmt.Println(posts[i]) + } +} + +func ExampleClient_Mutate() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + key1 := datastore.NameKey("Post", "post1", nil) + key2 := datastore.NameKey("Post", "post2", nil) + key3 := datastore.NameKey("Post", "post3", nil) + key4 := datastore.NameKey("Post", "post4", nil) + + _, err = client.Mutate(ctx, + datastore.NewInsert(key1, Post{Title: "Post 1"}), + datastore.NewUpsert(key2, Post{Title: "Post 2"}), + datastore.NewUpdate(key3, Post{Title: "Post 3"}), + datastore.NewDelete(key4)) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleCommit_Key() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "") + if err != nil { + // TODO: Handle error. + } + var pk1, pk2 *datastore.PendingKey + // Create two posts in a single transaction. + commit, err := client.RunInTransaction(ctx, func(tx *datastore.Transaction) error { + var err error + pk1, err = tx.Put(datastore.IncompleteKey("Post", nil), &Post{Title: "Post 1", PublishedAt: time.Now()}) + if err != nil { + return err + } + pk2, err = tx.Put(datastore.IncompleteKey("Post", nil), &Post{Title: "Post 2", PublishedAt: time.Now()}) + if err != nil { + return err + } + return nil + }) + if err != nil { + // TODO: Handle error. + } + // Now pk1, pk2 are valid PendingKeys. Let's convert them into real keys + // using the Commit object. + k1 := commit.Key(pk1) + k2 := commit.Key(pk2) + fmt.Println(k1, k2) +} + +func ExampleIterator_Next() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.Run(ctx, datastore.NewQuery("Post")) + for { + var p Post + key, err := it.Next(&p) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(key, p) + } +} + +func ExampleIterator_Cursor() { + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.Run(ctx, datastore.NewQuery("Post")) + for { + var p Post + _, err := it.Next(&p) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(p) + cursor, err := it.Cursor() + if err != nil { + // TODO: Handle error. + } + // When printed, a cursor will display as a string that can be passed + // to datastore.NewCursor. + fmt.Printf("to resume with this post, use cursor %s\n", cursor) + } +} + +func ExampleDecodeCursor() { + // See Query.Start for a fuller example of DecodeCursor. + // getCursor represents a function that returns a cursor from a previous + // iteration in string form. + cursorString := getCursor() + cursor, err := datastore.DecodeCursor(cursorString) + if err != nil { + // TODO: Handle error. + } + _ = cursor // TODO: Use the cursor with Query.Start or Query.End. +} + +func getCursor() string { return "" } + +func ExampleQuery_Start() { + // This example demonstrates how to use cursors and Query.Start + // to resume an iteration. + ctx := context.Background() + client, err := datastore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + // getCursor represents a function that returns a cursor from a previous + // iteration in string form. + cursorString := getCursor() + cursor, err := datastore.DecodeCursor(cursorString) + if err != nil { + // TODO: Handle error. + } + it := client.Run(ctx, datastore.NewQuery("Post").Start(cursor)) + _ = it // TODO: Use iterator. +} + +func ExampleLoadStruct() { + type Player struct { + User string + Score int + } + // Normally LoadStruct would only be used inside a custom implementation of + // PropertyLoadSaver; this is for illustrative purposes only. + props := []datastore.Property{ + {Name: "User", Value: "Alice"}, + {Name: "Score", Value: int64(97)}, + } + + var p Player + if err := datastore.LoadStruct(&p, props); err != nil { + // TODO: Handle error. + } + fmt.Println(p) + // Output: {Alice 97} +} + +func ExampleSaveStruct() { + type Player struct { + User string + Score int + } + + p := &Player{ + User: "Alice", + Score: 97, + } + props, err := datastore.SaveStruct(p) + if err != nil { + // TODO: Handle error. + } + fmt.Println(props) + // TODO(jba): make this output stable: Output: [{User Alice false} {Score 97 false}] +} diff --git a/vendor/cloud.google.com/go/datastore/integration_test.go b/vendor/cloud.google.com/go/datastore/integration_test.go new file mode 100644 index 000000000..bb8e6d55a --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/integration_test.go @@ -0,0 +1,1280 @@ +// 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 datastore + +import ( + "context" + "encoding/json" + "errors" + "flag" + "fmt" + "log" + "net" + "os" + "reflect" + "sort" + "strings" + "sync" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/rpcreplay" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// TODO(djd): Make test entity clean up more robust: some test entities may +// be left behind if tests are aborted, the transport fails, etc. + +var timeNow = time.Now() + +// suffix is a timestamp-based suffix which is appended to key names, +// particularly for the root keys of entity groups. This reduces flakiness +// when the tests are run in parallel. +var suffix string + +const replayFilename = "datastore.replay" + +type replayInfo struct { + ProjectID string + Time time.Time +} + +var ( + record = flag.Bool("record", false, "record RPCs") + + newTestClient = func(ctx context.Context, t *testing.T) *Client { + return newClient(ctx, t, nil) + } +) + +func TestMain(m *testing.M) { + os.Exit(testMain(m)) +} + +func testMain(m *testing.M) int { + flag.Parse() + if testing.Short() { + if *record { + log.Fatal("cannot combine -short and -record") + } + if testutil.CanReplay(replayFilename) { + initReplay() + } + } else if *record { + if testutil.ProjID() == "" { + log.Fatal("must record with a project ID") + } + b, err := json.Marshal(replayInfo{ + ProjectID: testutil.ProjID(), + Time: timeNow, + }) + if err != nil { + log.Fatal(err) + } + rec, err := rpcreplay.NewRecorder(replayFilename, b) + if err != nil { + log.Fatal(err) + } + defer func() { + if err := rec.Close(); err != nil { + log.Fatalf("closing recorder: %v", err) + } + }() + newTestClient = func(ctx context.Context, t *testing.T) *Client { + return newClient(ctx, t, rec.DialOptions()) + } + log.Printf("recording to %s", replayFilename) + } + suffix = fmt.Sprintf("-t%d", timeNow.UnixNano()) + return m.Run() +} + +func initReplay() { + rep, err := rpcreplay.NewReplayer(replayFilename) + if err != nil { + log.Fatal(err) + } + defer rep.Close() + + var ri replayInfo + if err := json.Unmarshal(rep.Initial(), &ri); err != nil { + log.Fatalf("unmarshaling initial replay info: %v", err) + } + timeNow = ri.Time.In(time.Local) + + conn, err := replayConn(rep) + if err != nil { + log.Fatal(err) + } + newTestClient = func(ctx context.Context, t *testing.T) *Client { + client, err := NewClient(ctx, ri.ProjectID, option.WithGRPCConn(conn)) + if err != nil { + t.Fatalf("NewClient: %v", err) + } + return client + } + log.Printf("replaying from %s", replayFilename) +} + +func replayConn(rep *rpcreplay.Replayer) (*grpc.ClientConn, error) { + // If we make a real connection we need creds from somewhere, and they + // might not be available, for instance on Travis. + // Replaying doesn't require a connection live at all, but we need + // something to attach gRPC interceptors to. + // So we start a local listener and connect to it, then close them down. + // TODO(jba): build something like this into the replayer? + l, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + return nil, err + } + conn, err := grpc.Dial(l.Addr().String(), + append([]grpc.DialOption{grpc.WithInsecure()}, rep.DialOptions()...)...) + if err != nil { + return nil, err + } + conn.Close() + l.Close() + return conn, nil +} + +func newClient(ctx context.Context, t *testing.T, dialOpts []grpc.DialOption) *Client { + if testing.Short() { + t.Skip("Integration tests skipped in short mode") + } + ts := testutil.TokenSource(ctx, ScopeDatastore) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + opts := []option.ClientOption{option.WithTokenSource(ts)} + for _, opt := range dialOpts { + opts = append(opts, option.WithGRPCDialOption(opt)) + } + client, err := NewClient(ctx, testutil.ProjID(), opts...) + if err != nil { + t.Fatalf("NewClient: %v", err) + } + return client +} + +func TestBasics(t *testing.T) { + ctx, _ := context.WithTimeout(context.Background(), time.Second*20) + client := newTestClient(ctx, t) + defer client.Close() + + type X struct { + I int + S string + T time.Time + } + + x0 := X{66, "99", timeNow.Truncate(time.Millisecond)} + k, err := client.Put(ctx, IncompleteKey("BasicsX", nil), &x0) + if err != nil { + t.Fatalf("client.Put: %v", err) + } + x1 := X{} + err = client.Get(ctx, k, &x1) + if err != nil { + t.Errorf("client.Get: %v", err) + } + err = client.Delete(ctx, k) + if err != nil { + t.Errorf("client.Delete: %v", err) + } + if !testutil.Equal(x0, x1) { + t.Errorf("compare: x0=%v, x1=%v", x0, x1) + } +} + +func TestTopLevelKeyLoaded(t *testing.T) { + ctx, _ := context.WithTimeout(context.Background(), time.Second*20) + client := newTestClient(ctx, t) + defer client.Close() + + completeKey := NameKey("EntityWithKey", "myent", nil) + + type EntityWithKey struct { + I int + S string + K *Key `datastore:"__key__"` + } + + in := &EntityWithKey{ + I: 12, + S: "abcd", + } + + k, err := client.Put(ctx, completeKey, in) + if err != nil { + t.Fatalf("client.Put: %v", err) + } + + var e EntityWithKey + err = client.Get(ctx, k, &e) + if err != nil { + t.Fatalf("client.Get: %v", err) + } + + // The two keys should be absolutely identical. + if !testutil.Equal(e.K, k) { + t.Fatalf("e.K not equal to k; got %#v, want %#v", e.K, k) + } + +} + +func TestListValues(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + p0 := PropertyList{ + {Name: "L", Value: []interface{}{int64(12), "string", true}}, + } + k, err := client.Put(ctx, IncompleteKey("ListValue", nil), &p0) + if err != nil { + t.Fatalf("client.Put: %v", err) + } + var p1 PropertyList + if err := client.Get(ctx, k, &p1); err != nil { + t.Errorf("client.Get: %v", err) + } + if !testutil.Equal(p0, p1) { + t.Errorf("compare:\np0=%v\np1=%#v", p0, p1) + } + if err = client.Delete(ctx, k); err != nil { + t.Errorf("client.Delete: %v", err) + } +} + +func TestGetMulti(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + type X struct { + I int + } + p := NameKey("X", "x"+suffix, nil) + + cases := []struct { + key *Key + put bool + }{ + {key: NameKey("X", "item1", p), put: true}, + {key: NameKey("X", "item2", p), put: false}, + {key: NameKey("X", "item3", p), put: false}, + {key: NameKey("X", "item3", p), put: false}, + {key: NameKey("X", "item4", p), put: true}, + } + + var src, dst []*X + var srcKeys, dstKeys []*Key + for _, c := range cases { + dst = append(dst, &X{}) + dstKeys = append(dstKeys, c.key) + if c.put { + src = append(src, &X{}) + srcKeys = append(srcKeys, c.key) + } + } + if _, err := client.PutMulti(ctx, srcKeys, src); err != nil { + t.Error(err) + } + err := client.GetMulti(ctx, dstKeys, dst) + if err == nil { + t.Errorf("client.GetMulti got %v, expected error", err) + } + e, ok := err.(MultiError) + if !ok { + t.Errorf("client.GetMulti got %T, expected MultiError", err) + } + for i, err := range e { + got, want := err, (error)(nil) + if !cases[i].put { + got, want = err, ErrNoSuchEntity + } + if got != want { + t.Errorf("MultiError[%d] == %v, want %v", i, got, want) + } + } +} + +type Z struct { + S string + T string `datastore:",noindex"` + P []byte + K []byte `datastore:",noindex"` +} + +func (z Z) String() string { + var lens []string + v := reflect.ValueOf(z) + for i := 0; i < v.NumField(); i++ { + if l := v.Field(i).Len(); l > 0 { + lens = append(lens, fmt.Sprintf("len(%s)=%d", v.Type().Field(i).Name, l)) + } + } + return fmt.Sprintf("Z{ %s }", strings.Join(lens, ",")) +} + +func TestUnindexableValues(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + x1500 := strings.Repeat("x", 1500) + x1501 := strings.Repeat("x", 1501) + testCases := []struct { + in Z + wantErr bool + }{ + {in: Z{S: x1500}, wantErr: false}, + {in: Z{S: x1501}, wantErr: true}, + {in: Z{T: x1500}, wantErr: false}, + {in: Z{T: x1501}, wantErr: false}, + {in: Z{P: []byte(x1500)}, wantErr: false}, + {in: Z{P: []byte(x1501)}, wantErr: true}, + {in: Z{K: []byte(x1500)}, wantErr: false}, + {in: Z{K: []byte(x1501)}, wantErr: false}, + } + for _, tt := range testCases { + _, err := client.Put(ctx, IncompleteKey("BasicsZ", nil), &tt.in) + if (err != nil) != tt.wantErr { + t.Errorf("client.Put %s got err %v, want err %t", tt.in, err, tt.wantErr) + } + } +} + +func TestNilKey(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + testCases := []struct { + in K0 + wantErr bool + }{ + {in: K0{K: testKey0}, wantErr: false}, + {in: K0{}, wantErr: false}, + } + for _, tt := range testCases { + _, err := client.Put(ctx, IncompleteKey("NilKey", nil), &tt.in) + if (err != nil) != tt.wantErr { + t.Errorf("client.Put %s got err %v, want err %t", tt.in, err, tt.wantErr) + } + } +} + +type SQChild struct { + I, J int + T, U int64 +} + +type SQTestCase struct { + desc string + q *Query + wantCount int + wantSum int +} + +func testSmallQueries(ctx context.Context, t *testing.T, client *Client, parent *Key, children []*SQChild, + testCases []SQTestCase, extraTests ...func()) { + keys := make([]*Key, len(children)) + for i := range keys { + keys[i] = IncompleteKey("SQChild", parent) + } + keys, err := client.PutMulti(ctx, keys, children) + if err != nil { + t.Fatalf("client.PutMulti: %v", err) + } + defer func() { + err := client.DeleteMulti(ctx, keys) + if err != nil { + t.Errorf("client.DeleteMulti: %v", err) + } + }() + + for _, tc := range testCases { + count, err := client.Count(ctx, tc.q) + if err != nil { + t.Errorf("Count %q: %v", tc.desc, err) + continue + } + if count != tc.wantCount { + t.Errorf("Count %q: got %d want %d", tc.desc, count, tc.wantCount) + continue + } + } + + for _, tc := range testCases { + var got []SQChild + _, err := client.GetAll(ctx, tc.q, &got) + if err != nil { + t.Errorf("client.GetAll %q: %v", tc.desc, err) + continue + } + sum := 0 + for _, c := range got { + sum += c.I + c.J + } + if sum != tc.wantSum { + t.Errorf("sum %q: got %d want %d", tc.desc, sum, tc.wantSum) + continue + } + } + for _, x := range extraTests { + x() + } +} + +func TestFilters(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + parent := NameKey("SQParent", "TestFilters"+suffix, nil) + now := timeNow.Truncate(time.Millisecond).Unix() + children := []*SQChild{ + {I: 0, T: now, U: now}, + {I: 1, T: now, U: now}, + {I: 2, T: now, U: now}, + {I: 3, T: now, U: now}, + {I: 4, T: now, U: now}, + {I: 5, T: now, U: now}, + {I: 6, T: now, U: now}, + {I: 7, T: now, U: now}, + } + baseQuery := NewQuery("SQChild").Ancestor(parent).Filter("T=", now) + testSmallQueries(ctx, t, client, parent, children, []SQTestCase{ + { + "I>1", + baseQuery.Filter("I>", 1), + 6, + 2 + 3 + 4 + 5 + 6 + 7, + }, + { + "I>2 AND I<=5", + baseQuery.Filter("I>", 2).Filter("I<=", 5), + 3, + 3 + 4 + 5, + }, + { + "I>=3 AND I<3", + baseQuery.Filter("I>=", 3).Filter("I<", 3), + 0, + 0, + }, + { + "I=4", + baseQuery.Filter("I=", 4), + 1, + 4, + }, + }, func() { + got := []*SQChild{} + want := []*SQChild{ + {I: 0, T: now, U: now}, + {I: 1, T: now, U: now}, + {I: 2, T: now, U: now}, + {I: 3, T: now, U: now}, + {I: 4, T: now, U: now}, + {I: 5, T: now, U: now}, + {I: 6, T: now, U: now}, + {I: 7, T: now, U: now}, + } + _, err := client.GetAll(ctx, baseQuery.Order("I"), &got) + if err != nil { + t.Errorf("client.GetAll: %v", err) + } + if !testutil.Equal(got, want) { + t.Errorf("compare: got=%v, want=%v", got, want) + } + }, func() { + got := []*SQChild{} + want := []*SQChild{ + {I: 7, T: now, U: now}, + {I: 6, T: now, U: now}, + {I: 5, T: now, U: now}, + {I: 4, T: now, U: now}, + {I: 3, T: now, U: now}, + {I: 2, T: now, U: now}, + {I: 1, T: now, U: now}, + {I: 0, T: now, U: now}, + } + _, err := client.GetAll(ctx, baseQuery.Order("-I"), &got) + if err != nil { + t.Errorf("client.GetAll: %v", err) + } + if !testutil.Equal(got, want) { + t.Errorf("compare: got=%v, want=%v", got, want) + } + }) +} + +type ckey struct{} + +func TestLargeQuery(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + parent := NameKey("LQParent", "TestFilters"+suffix, nil) + now := timeNow.Truncate(time.Millisecond).Unix() + + // Make a large number of children entities. + const n = 800 + children := make([]*SQChild, 0, n) + keys := make([]*Key, 0, n) + for i := 0; i < n; i++ { + children = append(children, &SQChild{I: i, T: now, U: now}) + keys = append(keys, IncompleteKey("SQChild", parent)) + } + + // Store using PutMulti in batches. + const batchSize = 500 + for i := 0; i < n; i = i + 500 { + j := i + batchSize + if j > n { + j = n + } + fullKeys, err := client.PutMulti(ctx, keys[i:j], children[i:j]) + if err != nil { + t.Fatalf("PutMulti(%d, %d): %v", i, j, err) + } + defer func() { + err := client.DeleteMulti(ctx, fullKeys) + if err != nil { + t.Errorf("client.DeleteMulti: %v", err) + } + }() + } + + q := NewQuery("SQChild").Ancestor(parent).Filter("T=", now).Order("I") + + // Wait group to allow us to run query tests in parallel below. + var wg sync.WaitGroup + + // Check we get the expected count and results for various limits/offsets. + queryTests := []struct { + limit, offset, want int + }{ + // Just limit. + {limit: 0, want: 0}, + {limit: 100, want: 100}, + {limit: 501, want: 501}, + {limit: n, want: n}, + {limit: n * 2, want: n}, + {limit: -1, want: n}, + // Just offset. + {limit: -1, offset: 100, want: n - 100}, + {limit: -1, offset: 500, want: n - 500}, + {limit: -1, offset: n, want: 0}, + // Limit and offset. + {limit: 100, offset: 100, want: 100}, + {limit: 1000, offset: 100, want: n - 100}, + {limit: 500, offset: 500, want: n - 500}, + } + for _, tt := range queryTests { + q := q.Limit(tt.limit).Offset(tt.offset) + wg.Add(1) + + go func(limit, offset, want int) { + defer wg.Done() + // Check Count returns the expected number of results. + count, err := client.Count(ctx, q) + if err != nil { + t.Errorf("client.Count(limit=%d offset=%d): %v", limit, offset, err) + return + } + if count != want { + t.Errorf("Count(limit=%d offset=%d) returned %d, want %d", limit, offset, count, want) + } + + var got []SQChild + _, err = client.GetAll(ctx, q, &got) + if err != nil { + t.Errorf("client.GetAll(limit=%d offset=%d): %v", limit, offset, err) + return + } + if len(got) != want { + t.Errorf("GetAll(limit=%d offset=%d) returned %d, want %d", limit, offset, len(got), want) + } + for i, child := range got { + if got, want := child.I, i+offset; got != want { + t.Errorf("GetAll(limit=%d offset=%d) got[%d].I == %d; want %d", limit, offset, i, got, want) + break + } + } + }(tt.limit, tt.offset, tt.want) + } + + // Also check iterator cursor behaviour. + cursorTests := []struct { + limit, offset int // Query limit and offset. + count int // The number of times to call "next" + want int // The I value of the desired element, -1 for "Done". + }{ + // No limits. + {count: 0, limit: -1, want: 0}, + {count: 5, limit: -1, want: 5}, + {count: 500, limit: -1, want: 500}, + {count: 1000, limit: -1, want: -1}, // No more results. + // Limits. + {count: 5, limit: 5, want: 5}, + {count: 500, limit: 5, want: 5}, + {count: 1000, limit: 1000, want: -1}, // No more results. + // Offsets. + {count: 0, offset: 5, limit: -1, want: 5}, + {count: 5, offset: 5, limit: -1, want: 10}, + {count: 200, offset: 500, limit: -1, want: 700}, + {count: 200, offset: 1000, limit: -1, want: -1}, // No more results. + } + for _, tt := range cursorTests { + wg.Add(1) + + go func(count, limit, offset, want int) { + defer wg.Done() + + ctx := context.WithValue(ctx, ckey{}, fmt.Sprintf("c=%d,l=%d,o=%d", count, limit, offset)) + // Run iterator through count calls to Next. + it := client.Run(ctx, q.Limit(limit).Offset(offset).KeysOnly()) + for i := 0; i < count; i++ { + _, err := it.Next(nil) + if err == iterator.Done { + break + } + if err != nil { + t.Errorf("count=%d, limit=%d, offset=%d: it.Next failed at i=%d", count, limit, offset, i) + return + } + } + + // Grab the cursor. + cursor, err := it.Cursor() + if err != nil { + t.Errorf("count=%d, limit=%d, offset=%d: it.Cursor: %v", count, limit, offset, err) + return + } + + // Make a request for the next element. + it = client.Run(ctx, q.Limit(1).Start(cursor)) + var entity SQChild + _, err = it.Next(&entity) + switch { + case want == -1: + if err != iterator.Done { + t.Errorf("count=%d, limit=%d, offset=%d: it.Next from cursor %v, want Done", count, limit, offset, err) + } + case err != nil: + t.Errorf("count=%d, limit=%d, offset=%d: it.Next from cursor: %v, want nil", count, limit, offset, err) + case entity.I != want: + t.Errorf("count=%d, limit=%d, offset=%d: got.I = %d, want %d", count, limit, offset, entity.I, want) + } + }(tt.count, tt.limit, tt.offset, tt.want) + } + wg.Wait() +} + +func TestEventualConsistency(t *testing.T) { + // TODO(jba): either make this actually test eventual consistency, or + // delete it. Currently it behaves the same with or without the + // EventualConsistency call. + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + parent := NameKey("SQParent", "TestEventualConsistency"+suffix, nil) + now := timeNow.Truncate(time.Millisecond).Unix() + children := []*SQChild{ + {I: 0, T: now, U: now}, + {I: 1, T: now, U: now}, + {I: 2, T: now, U: now}, + } + query := NewQuery("SQChild").Ancestor(parent).Filter("T =", now).EventualConsistency() + testSmallQueries(ctx, t, client, parent, children, nil, func() { + got, err := client.Count(ctx, query) + if err != nil { + t.Fatalf("Count: %v", err) + } + if got < 0 || 3 < got { + t.Errorf("Count: got %d, want [0,3]", got) + } + }) +} + +func TestProjection(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + parent := NameKey("SQParent", "TestProjection"+suffix, nil) + now := timeNow.Truncate(time.Millisecond).Unix() + children := []*SQChild{ + {I: 1 << 0, J: 100, T: now, U: now}, + {I: 1 << 1, J: 100, T: now, U: now}, + {I: 1 << 2, J: 200, T: now, U: now}, + {I: 1 << 3, J: 300, T: now, U: now}, + {I: 1 << 4, J: 300, T: now, U: now}, + } + baseQuery := NewQuery("SQChild").Ancestor(parent).Filter("T=", now).Filter("J>", 150) + testSmallQueries(ctx, t, client, parent, children, []SQTestCase{ + { + "project", + baseQuery.Project("J"), + 3, + 200 + 300 + 300, + }, + { + "distinct", + baseQuery.Project("J").Distinct(), + 2, + 200 + 300, + }, + { + "distinct on", + baseQuery.Project("J").DistinctOn("J"), + 2, + 200 + 300, + }, + { + "project on meaningful (GD_WHEN) field", + baseQuery.Project("U"), + 3, + 0, + }, + }) +} + +func TestAllocateIDs(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + keys := make([]*Key, 5) + for i := range keys { + keys[i] = IncompleteKey("AllocID", nil) + } + keys, err := client.AllocateIDs(ctx, keys) + if err != nil { + t.Errorf("AllocID #0 failed: %v", err) + } + if want := len(keys); want != 5 { + t.Errorf("Expected to allocate 5 keys, %d keys are found", want) + } + for _, k := range keys { + if k.Incomplete() { + t.Errorf("Unexpeceted incomplete key found: %v", k) + } + } +} + +func TestGetAllWithFieldMismatch(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + type Fat struct { + X, Y int + } + type Thin struct { + X int + } + + // Ancestor queries (those within an entity group) are strongly consistent + // by default, which prevents a test from being flaky. + // See https://cloud.google.com/appengine/docs/go/datastore/queries#Go_Data_consistency + // for more information. + parent := NameKey("SQParent", "TestGetAllWithFieldMismatch"+suffix, nil) + putKeys := make([]*Key, 3) + for i := range putKeys { + putKeys[i] = IDKey("GetAllThing", int64(10+i), parent) + _, err := client.Put(ctx, putKeys[i], &Fat{X: 20 + i, Y: 30 + i}) + if err != nil { + t.Fatalf("client.Put: %v", err) + } + } + + var got []Thin + want := []Thin{ + {X: 20}, + {X: 21}, + {X: 22}, + } + getKeys, err := client.GetAll(ctx, NewQuery("GetAllThing").Ancestor(parent), &got) + if len(getKeys) != 3 && !testutil.Equal(getKeys, putKeys) { + t.Errorf("client.GetAll: keys differ\ngetKeys=%v\nputKeys=%v", getKeys, putKeys) + } + if !testutil.Equal(got, want) { + t.Errorf("client.GetAll: entities differ\ngot =%v\nwant=%v", got, want) + } + if _, ok := err.(*ErrFieldMismatch); !ok { + t.Errorf("client.GetAll: got err=%v, want ErrFieldMismatch", err) + } +} + +func TestKindlessQueries(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + type Dee struct { + I int + Why string + } + type Dum struct { + I int + Pling string + } + + parent := NameKey("Tweedle", "tweedle"+suffix, nil) + + keys := []*Key{ + NameKey("Dee", "dee0", parent), + NameKey("Dum", "dum1", parent), + NameKey("Dum", "dum2", parent), + NameKey("Dum", "dum3", parent), + } + src := []interface{}{ + &Dee{1, "binary0001"}, + &Dum{2, "binary0010"}, + &Dum{4, "binary0100"}, + &Dum{8, "binary1000"}, + } + keys, err := client.PutMulti(ctx, keys, src) + if err != nil { + t.Fatalf("put: %v", err) + } + + testCases := []struct { + desc string + query *Query + want []int + wantErr string + }{ + { + desc: "Dee", + query: NewQuery("Dee"), + want: []int{1}, + }, + { + desc: "Doh", + query: NewQuery("Doh"), + want: nil}, + { + desc: "Dum", + query: NewQuery("Dum"), + want: []int{2, 4, 8}, + }, + { + desc: "", + query: NewQuery(""), + want: []int{1, 2, 4, 8}, + }, + { + desc: "Kindless filter", + query: NewQuery("").Filter("__key__ =", keys[2]), + want: []int{4}, + }, + { + desc: "Kindless order", + query: NewQuery("").Order("__key__"), + want: []int{1, 2, 4, 8}, + }, + { + desc: "Kindless bad filter", + query: NewQuery("").Filter("I =", 4), + wantErr: "kind is required", + }, + { + desc: "Kindless bad order", + query: NewQuery("").Order("-__key__"), + wantErr: "kind is required for all orders except __key__ ascending", + }, + } +loop: + for _, tc := range testCases { + q := tc.query.Ancestor(parent) + gotCount, err := client.Count(ctx, q) + if err != nil { + if tc.wantErr == "" || !strings.Contains(err.Error(), tc.wantErr) { + t.Errorf("count %q: err %v, want err %q", tc.desc, err, tc.wantErr) + } + continue + } + if tc.wantErr != "" { + t.Errorf("count %q: want err %q", tc.desc, tc.wantErr) + continue + } + if gotCount != len(tc.want) { + t.Errorf("count %q: got %d want %d", tc.desc, gotCount, len(tc.want)) + continue + } + var got []int + for iter := client.Run(ctx, q); ; { + var dst struct { + I int + Why, Pling string + } + _, err := iter.Next(&dst) + if err == iterator.Done { + break + } + if err != nil { + t.Errorf("iter.Next %q: %v", tc.desc, err) + continue loop + } + got = append(got, dst.I) + } + sort.Ints(got) + if !testutil.Equal(got, tc.want) { + t.Errorf("elems %q: got %+v want %+v", tc.desc, got, tc.want) + continue + } + } +} + +func TestTransaction(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + type Counter struct { + N int + T time.Time + } + + bangErr := errors.New("bang") + tests := []struct { + desc string + causeConflict []bool + retErr []error + want int + wantErr error + }{ + { + desc: "3 attempts, no conflicts", + causeConflict: []bool{false}, + retErr: []error{nil}, + want: 11, + }, + { + desc: "1 attempt, user error", + causeConflict: []bool{false}, + retErr: []error{bangErr}, + wantErr: bangErr, + }, + { + desc: "2 attempts, 1 conflict", + causeConflict: []bool{true, false}, + retErr: []error{nil, nil}, + want: 13, // Each conflict increments by 2. + }, + { + desc: "3 attempts, 3 conflicts", + causeConflict: []bool{true, true, true}, + retErr: []error{nil, nil, nil}, + wantErr: ErrConcurrentTransaction, + }, + } + + for i, tt := range tests { + // Put a new counter. + c := &Counter{N: 10, T: timeNow} + key, err := client.Put(ctx, IncompleteKey("TransCounter", nil), c) + if err != nil { + t.Errorf("%s: client.Put: %v", tt.desc, err) + continue + } + defer client.Delete(ctx, key) + + // Increment the counter in a transaction. + // The test case can manually cause a conflict or return an + // error at each attempt. + var attempts int + _, err = client.RunInTransaction(ctx, func(tx *Transaction) error { + attempts++ + if attempts > len(tt.causeConflict) { + return fmt.Errorf("too many attempts. Got %d, max %d", attempts, len(tt.causeConflict)) + } + + var c Counter + if err := tx.Get(key, &c); err != nil { + return err + } + c.N++ + if _, err := tx.Put(key, &c); err != nil { + return err + } + + if tt.causeConflict[attempts-1] { + c.N++ + if _, err := client.Put(ctx, key, &c); err != nil { + return err + } + } + + return tt.retErr[attempts-1] + }, MaxAttempts(i)) + + // Check the error returned by RunInTransaction. + if err != tt.wantErr { + t.Errorf("%s: got err %v, want %v", tt.desc, err, tt.wantErr) + continue + } + if err != nil { + continue + } + + // Check the final value of the counter. + if err := client.Get(ctx, key, c); err != nil { + t.Errorf("%s: client.Get: %v", tt.desc, err) + continue + } + if c.N != tt.want { + t.Errorf("%s: counter N=%d, want N=%d", tt.desc, c.N, tt.want) + } + } +} + +func TestReadOnlyTransaction(t *testing.T) { + if testing.Short() { + t.Skip("Integration tests skipped in short mode") + } + ctx := context.Background() + client := newClient(ctx, t, nil) + defer client.Close() + + type value struct{ N int } + + // Put a value. + const n = 5 + v := &value{N: n} + key, err := client.Put(ctx, IncompleteKey("roTxn", nil), v) + if err != nil { + t.Fatal(err) + } + defer client.Delete(ctx, key) + + // Read it from a read-only transaction. + _, err = client.RunInTransaction(ctx, func(tx *Transaction) error { + if err := tx.Get(key, v); err != nil { + return err + } + return nil + }, ReadOnly) + if err != nil { + t.Fatal(err) + } + if v.N != n { + t.Fatalf("got %d, want %d", v.N, n) + } + + // Attempting to write from a read-only transaction is an error. + _, err = client.RunInTransaction(ctx, func(tx *Transaction) error { + if _, err := tx.Put(key, v); err != nil { + return err + } + return nil + }, ReadOnly) + if err == nil { + t.Fatal("got nil, want error") + } +} + +func TestNilPointers(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + type X struct { + S string + } + + src := []*X{{"zero"}, {"one"}} + keys := []*Key{IncompleteKey("NilX", nil), IncompleteKey("NilX", nil)} + keys, err := client.PutMulti(ctx, keys, src) + if err != nil { + t.Fatalf("PutMulti: %v", err) + } + + // It's okay to store into a slice of nil *X. + xs := make([]*X, 2) + if err := client.GetMulti(ctx, keys, xs); err != nil { + t.Errorf("GetMulti: %v", err) + } else if !testutil.Equal(xs, src) { + t.Errorf("GetMulti fetched %v, want %v", xs, src) + } + + // It isn't okay to store into a single nil *X. + var x0 *X + if err, want := client.Get(ctx, keys[0], x0), ErrInvalidEntityType; err != want { + t.Errorf("Get: err %v; want %v", err, want) + } + + // Test that deleting with duplicate keys work. + keys = append(keys, keys...) + if err := client.DeleteMulti(ctx, keys); err != nil { + t.Errorf("Delete: %v", err) + } +} + +func TestNestedRepeatedElementNoIndex(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + type Inner struct { + Name string + Value string `datastore:",noindex"` + } + type Outer struct { + Config []Inner + } + m := &Outer{ + Config: []Inner{ + {Name: "short", Value: "a"}, + {Name: "long", Value: strings.Repeat("a", 2000)}, + }, + } + + key := NameKey("Nested", "Nested"+suffix, nil) + if _, err := client.Put(ctx, key, m); err != nil { + t.Fatalf("client.Put: %v", err) + } + if err := client.Delete(ctx, key); err != nil { + t.Fatalf("client.Delete: %v", err) + } +} + +func TestPointerFields(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + want := populatedPointers() + key, err := client.Put(ctx, IncompleteKey("pointers", nil), want) + if err != nil { + t.Fatal(err) + } + var got Pointers + if err := client.Get(ctx, key, &got); err != nil { + t.Fatal(err) + } + if got.Pi == nil || *got.Pi != *want.Pi { + t.Errorf("Pi: got %v, want %v", got.Pi, *want.Pi) + } + if got.Ps == nil || *got.Ps != *want.Ps { + t.Errorf("Ps: got %v, want %v", got.Ps, *want.Ps) + } + if got.Pb == nil || *got.Pb != *want.Pb { + t.Errorf("Pb: got %v, want %v", got.Pb, *want.Pb) + } + if got.Pf == nil || *got.Pf != *want.Pf { + t.Errorf("Pf: got %v, want %v", got.Pf, *want.Pf) + } + if got.Pg == nil || *got.Pg != *want.Pg { + t.Errorf("Pg: got %v, want %v", got.Pg, *want.Pg) + } + if got.Pt == nil || !got.Pt.Equal(*want.Pt) { + t.Errorf("Pt: got %v, want %v", got.Pt, *want.Pt) + } +} + +func TestMutate(t *testing.T) { + // test Client.Mutate + testMutate(t, func(ctx context.Context, client *Client, muts ...*Mutation) ([]*Key, error) { + return client.Mutate(ctx, muts...) + }) + // test Transaction.Mutate + testMutate(t, func(ctx context.Context, client *Client, muts ...*Mutation) ([]*Key, error) { + var pkeys []*PendingKey + commit, err := client.RunInTransaction(ctx, func(tx *Transaction) error { + var err error + pkeys, err = tx.Mutate(muts...) + return err + }) + if err != nil { + return nil, err + } + var keys []*Key + for _, pk := range pkeys { + keys = append(keys, commit.Key(pk)) + } + return keys, nil + }) +} + +func testMutate(t *testing.T, mutate func(ctx context.Context, client *Client, muts ...*Mutation) ([]*Key, error)) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + type T struct{ I int } + + check := func(k *Key, want interface{}) { + var x T + err := client.Get(ctx, k, &x) + switch want := want.(type) { + case error: + if err != want { + t.Errorf("key %s: got error %v, want %v", k, err, want) + } + case int: + if err != nil { + t.Fatalf("key %s: %v", k, err) + } + if x.I != want { + t.Errorf("key %s: got %d, want %d", k, x.I, want) + } + default: + panic("check: bad arg") + } + } + + keys, err := mutate(ctx, client, + NewInsert(IncompleteKey("t", nil), &T{1}), + NewUpsert(IncompleteKey("t", nil), &T{2}), + ) + if err != nil { + t.Fatal(err) + } + check(keys[0], 1) + check(keys[1], 2) + + _, err = mutate(ctx, client, + NewUpdate(keys[0], &T{3}), + NewDelete(keys[1]), + ) + if err != nil { + t.Fatal(err) + } + check(keys[0], 3) + check(keys[1], ErrNoSuchEntity) + + _, err = mutate(ctx, client, NewInsert(keys[0], &T{4})) + if got, want := status.Code(err), codes.AlreadyExists; got != want { + t.Errorf("Insert existing key: got %s, want %s", got, want) + } + + _, err = mutate(ctx, client, NewUpdate(keys[1], &T{4})) + if got, want := status.Code(err), codes.NotFound; got != want { + t.Errorf("Update non-existing key: got %s, want %s", got, want) + } +} diff --git a/vendor/cloud.google.com/go/datastore/key.go b/vendor/cloud.google.com/go/datastore/key.go new file mode 100644 index 000000000..778fa2605 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/key.go @@ -0,0 +1,280 @@ +// 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 datastore + +import ( + "bytes" + "context" + "encoding/base64" + "encoding/gob" + "errors" + "strconv" + "strings" + + "github.com/golang/protobuf/proto" + pb "google.golang.org/genproto/googleapis/datastore/v1" +) + +// Key represents the datastore key for a stored entity. +type Key struct { + // Kind cannot be empty. + Kind string + // Either ID or Name must be zero for the Key to be valid. + // If both are zero, the Key is incomplete. + ID int64 + Name string + // Parent must either be a complete Key or nil. + Parent *Key + + // Namespace provides the ability to partition your data for multiple + // tenants. In most cases, it is not necessary to specify a namespace. + // See docs on datastore multitenancy for details: + // https://cloud.google.com/datastore/docs/concepts/multitenancy + Namespace string +} + +// Incomplete reports whether the key does not refer to a stored entity. +func (k *Key) Incomplete() bool { + return k.Name == "" && k.ID == 0 +} + +// valid returns whether the key is valid. +func (k *Key) valid() bool { + if k == nil { + return false + } + for ; k != nil; k = k.Parent { + if k.Kind == "" { + return false + } + if k.Name != "" && k.ID != 0 { + return false + } + if k.Parent != nil { + if k.Parent.Incomplete() { + return false + } + if k.Parent.Namespace != k.Namespace { + return false + } + } + } + return true +} + +// Equal reports whether two keys are equal. Two keys are equal if they are +// both nil, or if their kinds, IDs, names, namespaces and parents are equal. +func (k *Key) Equal(o *Key) bool { + for { + if k == nil || o == nil { + return k == o // if either is nil, both must be nil + } + if k.Namespace != o.Namespace || k.Name != o.Name || k.ID != o.ID || k.Kind != o.Kind { + return false + } + if k.Parent == nil && o.Parent == nil { + return true + } + k = k.Parent + o = o.Parent + } +} + +// marshal marshals the key's string representation to the buffer. +func (k *Key) marshal(b *bytes.Buffer) { + if k.Parent != nil { + k.Parent.marshal(b) + } + b.WriteByte('/') + b.WriteString(k.Kind) + b.WriteByte(',') + if k.Name != "" { + b.WriteString(k.Name) + } else { + b.WriteString(strconv.FormatInt(k.ID, 10)) + } +} + +// String returns a string representation of the key. +func (k *Key) String() string { + if k == nil { + return "" + } + b := bytes.NewBuffer(make([]byte, 0, 512)) + k.marshal(b) + return b.String() +} + +// Note: Fields not renamed compared to appengine gobKey struct +// This ensures gobs created by appengine can be read here, and vice/versa +type gobKey struct { + Kind string + StringID string + IntID int64 + Parent *gobKey + AppID string + Namespace string +} + +func keyToGobKey(k *Key) *gobKey { + if k == nil { + return nil + } + return &gobKey{ + Kind: k.Kind, + StringID: k.Name, + IntID: k.ID, + Parent: keyToGobKey(k.Parent), + Namespace: k.Namespace, + } +} + +func gobKeyToKey(gk *gobKey) *Key { + if gk == nil { + return nil + } + return &Key{ + Kind: gk.Kind, + Name: gk.StringID, + ID: gk.IntID, + Parent: gobKeyToKey(gk.Parent), + Namespace: gk.Namespace, + } +} + +// GobEncode marshals the key into a sequence of bytes +// using an encoding/gob.Encoder. +func (k *Key) GobEncode() ([]byte, error) { + buf := new(bytes.Buffer) + if err := gob.NewEncoder(buf).Encode(keyToGobKey(k)); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +// GobDecode unmarshals a sequence of bytes using an encoding/gob.Decoder. +func (k *Key) GobDecode(buf []byte) error { + gk := new(gobKey) + if err := gob.NewDecoder(bytes.NewBuffer(buf)).Decode(gk); err != nil { + return err + } + *k = *gobKeyToKey(gk) + return nil +} + +// MarshalJSON marshals the key into JSON. +func (k *Key) MarshalJSON() ([]byte, error) { + return []byte(`"` + k.Encode() + `"`), nil +} + +// UnmarshalJSON unmarshals a key JSON object into a Key. +func (k *Key) UnmarshalJSON(buf []byte) error { + if len(buf) < 2 || buf[0] != '"' || buf[len(buf)-1] != '"' { + return errors.New("datastore: bad JSON key") + } + k2, err := DecodeKey(string(buf[1 : len(buf)-1])) + if err != nil { + return err + } + *k = *k2 + return nil +} + +// Encode returns an opaque representation of the key +// suitable for use in HTML and URLs. +// This is compatible with the Python and Java runtimes. +func (k *Key) Encode() string { + pKey := keyToProto(k) + + b, err := proto.Marshal(pKey) + if err != nil { + panic(err) + } + + // Trailing padding is stripped. + return strings.TrimRight(base64.URLEncoding.EncodeToString(b), "=") +} + +// DecodeKey decodes a key from the opaque representation returned by Encode. +func DecodeKey(encoded string) (*Key, error) { + // Re-add padding. + if m := len(encoded) % 4; m != 0 { + encoded += strings.Repeat("=", 4-m) + } + + b, err := base64.URLEncoding.DecodeString(encoded) + if err != nil { + return nil, err + } + + pKey := new(pb.Key) + if err := proto.Unmarshal(b, pKey); err != nil { + return nil, err + } + return protoToKey(pKey) +} + +// AllocateIDs accepts a slice of incomplete keys and returns a +// slice of complete keys that are guaranteed to be valid in the datastore. +func (c *Client) AllocateIDs(ctx context.Context, keys []*Key) ([]*Key, error) { + if keys == nil { + return nil, nil + } + + req := &pb.AllocateIdsRequest{ + ProjectId: c.dataset, + Keys: multiKeyToProto(keys), + } + resp, err := c.client.AllocateIds(ctx, req) + if err != nil { + return nil, err + } + + return multiProtoToKey(resp.Keys) +} + +// IncompleteKey creates a new incomplete key. +// The supplied kind cannot be empty. +// The namespace of the new key is empty. +func IncompleteKey(kind string, parent *Key) *Key { + return &Key{ + Kind: kind, + Parent: parent, + } +} + +// NameKey creates a new key with a name. +// The supplied kind cannot be empty. +// The supplied parent must either be a complete key or nil. +// The namespace of the new key is empty. +func NameKey(kind, name string, parent *Key) *Key { + return &Key{ + Kind: kind, + Name: name, + Parent: parent, + } +} + +// IDKey creates a new key with an ID. +// The supplied kind cannot be empty. +// The supplied parent must either be a complete key or nil. +// The namespace of the new key is empty. +func IDKey(kind string, id int64, parent *Key) *Key { + return &Key{ + Kind: kind, + ID: id, + Parent: parent, + } +} diff --git a/vendor/cloud.google.com/go/datastore/key_test.go b/vendor/cloud.google.com/go/datastore/key_test.go new file mode 100644 index 000000000..eaa81cf8f --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/key_test.go @@ -0,0 +1,210 @@ +// 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 datastore + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "testing" +) + +func TestEqual(t *testing.T) { + testCases := []struct { + x, y *Key + equal bool + }{ + { + x: nil, + y: nil, + equal: true, + }, + { + x: &Key{Kind: "kindA"}, + y: &Key{Kind: "kindA"}, + equal: true, + }, + { + x: &Key{Kind: "kindA", Name: "nameA"}, + y: &Key{Kind: "kindA", Name: "nameA"}, + equal: true, + }, + { + x: &Key{Kind: "kindA", Name: "nameA", Namespace: "gopherspace"}, + y: &Key{Kind: "kindA", Name: "nameA", Namespace: "gopherspace"}, + equal: true, + }, + { + x: &Key{Kind: "kindA", ID: 1337, Parent: &Key{Kind: "kindX", Name: "nameX"}}, + y: &Key{Kind: "kindA", ID: 1337, Parent: &Key{Kind: "kindX", Name: "nameX"}}, + equal: true, + }, + { + x: &Key{Kind: "kindA", Name: "nameA"}, + y: &Key{Kind: "kindB", Name: "nameA"}, + equal: false, + }, + { + x: &Key{Kind: "kindA", Name: "nameA"}, + y: &Key{Kind: "kindA", Name: "nameB"}, + equal: false, + }, + { + x: &Key{Kind: "kindA", Name: "nameA"}, + y: &Key{Kind: "kindA", ID: 1337}, + equal: false, + }, + { + x: &Key{Kind: "kindA", Name: "nameA"}, + y: &Key{Kind: "kindA", Name: "nameA", Namespace: "gopherspace"}, + equal: false, + }, + { + x: &Key{Kind: "kindA", ID: 1337, Parent: &Key{Kind: "kindX", Name: "nameX"}}, + y: &Key{Kind: "kindA", ID: 1337, Parent: &Key{Kind: "kindY", Name: "nameX"}}, + equal: false, + }, + { + x: &Key{Kind: "kindA", ID: 1337, Parent: &Key{Kind: "kindX", Name: "nameX"}}, + y: &Key{Kind: "kindA", ID: 1337}, + equal: false, + }, + } + + for _, tt := range testCases { + if got := tt.x.Equal(tt.y); got != tt.equal { + t.Errorf("Equal(%v, %v) = %t; want %t", tt.x, tt.y, got, tt.equal) + } + if got := tt.y.Equal(tt.x); got != tt.equal { + t.Errorf("Equal(%v, %v) = %t; want %t", tt.y, tt.x, got, tt.equal) + } + } +} + +func TestEncoding(t *testing.T) { + testCases := []struct { + k *Key + valid bool + }{ + { + k: nil, + valid: false, + }, + { + k: &Key{}, + valid: false, + }, + { + k: &Key{Kind: "kindA"}, + valid: true, + }, + { + k: &Key{Kind: "kindA", Namespace: "gopherspace"}, + valid: true, + }, + { + k: &Key{Kind: "kindA", Name: "nameA"}, + valid: true, + }, + { + k: &Key{Kind: "kindA", ID: 1337}, + valid: true, + }, + { + k: &Key{Kind: "kindA", Name: "nameA", ID: 1337}, + valid: false, + }, + { + k: &Key{Kind: "kindA", Parent: &Key{Kind: "kindB", Name: "nameB"}}, + valid: true, + }, + { + k: &Key{Kind: "kindA", Parent: &Key{Kind: "kindB"}}, + valid: false, + }, + { + k: &Key{Kind: "kindA", Parent: &Key{Kind: "kindB", Name: "nameB", Namespace: "gopherspace"}}, + valid: false, + }, + } + + for _, tt := range testCases { + if got := tt.k.valid(); got != tt.valid { + t.Errorf("valid(%v) = %t; want %t", tt.k, got, tt.valid) + } + + // Check encoding/decoding for valid keys. + if !tt.valid { + continue + } + enc := tt.k.Encode() + dec, err := DecodeKey(enc) + if err != nil { + t.Errorf("DecodeKey(%q) from %v: %v", enc, tt.k, err) + continue + } + if !tt.k.Equal(dec) { + t.Logf("Proto: %s", keyToProto(tt.k)) + t.Errorf("Decoded key %v not equal to %v", dec, tt.k) + } + + b, err := json.Marshal(tt.k) + if err != nil { + t.Errorf("json.Marshal(%v): %v", tt.k, err) + continue + } + key := &Key{} + if err := json.Unmarshal(b, key); err != nil { + t.Errorf("json.Unmarshal(%s) for key %v: %v", b, tt.k, err) + continue + } + if !tt.k.Equal(key) { + t.Errorf("JSON decoded key %v not equal to %v", dec, tt.k) + } + + buf := &bytes.Buffer{} + gobEnc := gob.NewEncoder(buf) + if err := gobEnc.Encode(tt.k); err != nil { + t.Errorf("gobEnc.Encode(%v): %v", tt.k, err) + continue + } + gobDec := gob.NewDecoder(buf) + key = &Key{} + if err := gobDec.Decode(key); err != nil { + t.Errorf("gobDec.Decode() for key %v: %v", tt.k, err) + } + if !tt.k.Equal(key) { + t.Errorf("gob decoded key %v not equal to %v", dec, tt.k) + } + } +} + +func TestInvalidKeyDecode(t *testing.T) { + // Check that decoding an invalid key returns an err and doesn't panic. + enc := NameKey("Kind", "Foo", nil).Encode() + + invalid := []string{ + "", + "Laboratorio", + enc + "Junk", + enc[:len(enc)-4], + } + for _, enc := range invalid { + key, err := DecodeKey(enc) + if err == nil || key != nil { + t.Errorf("DecodeKey(%q) = %v, %v; want nil, error", enc, key, err) + } + } +} diff --git a/vendor/cloud.google.com/go/datastore/load.go b/vendor/cloud.google.com/go/datastore/load.go new file mode 100644 index 000000000..61aa3ed28 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/load.go @@ -0,0 +1,509 @@ +// 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 datastore + +import ( + "fmt" + "reflect" + "strings" + "time" + + "cloud.google.com/go/internal/fields" + pb "google.golang.org/genproto/googleapis/datastore/v1" +) + +var ( + typeOfByteSlice = reflect.TypeOf([]byte(nil)) + typeOfTime = reflect.TypeOf(time.Time{}) + typeOfGeoPoint = reflect.TypeOf(GeoPoint{}) + typeOfKeyPtr = reflect.TypeOf(&Key{}) + typeOfEntityPtr = reflect.TypeOf(&Entity{}) +) + +// typeMismatchReason returns a string explaining why the property p could not +// be stored in an entity field of type v.Type(). +func typeMismatchReason(p Property, v reflect.Value) string { + entityType := "empty" + switch p.Value.(type) { + case int64: + entityType = "int" + case bool: + entityType = "bool" + case string: + entityType = "string" + case float64: + entityType = "float" + case *Key: + entityType = "*datastore.Key" + case *Entity: + entityType = "*datastore.Entity" + case GeoPoint: + entityType = "GeoPoint" + case time.Time: + entityType = "time.Time" + case []byte: + entityType = "[]byte" + } + + return fmt.Sprintf("type mismatch: %s versus %v", entityType, v.Type()) +} + +func overflowReason(x interface{}, v reflect.Value) string { + return fmt.Sprintf("value %v overflows struct field of type %v", x, v.Type()) +} + +type propertyLoader struct { + // m holds the number of times a substruct field like "Foo.Bar.Baz" has + // been seen so far. The map is constructed lazily. + m map[string]int +} + +func (l *propertyLoader) load(codec fields.List, structValue reflect.Value, p Property, prev map[string]struct{}) string { + sl, ok := p.Value.([]interface{}) + if !ok { + return l.loadOneElement(codec, structValue, p, prev) + } + for _, val := range sl { + p.Value = val + if errStr := l.loadOneElement(codec, structValue, p, prev); errStr != "" { + return errStr + } + } + return "" +} + +// loadOneElement loads the value of Property p into structValue based on the provided +// codec. codec is used to find the field in structValue into which p should be loaded. +// prev is the set of property names already seen for structValue. +func (l *propertyLoader) loadOneElement(codec fields.List, structValue reflect.Value, p Property, prev map[string]struct{}) string { + var sliceOk bool + var sliceIndex int + var v reflect.Value + + name := p.Name + fieldNames := strings.Split(name, ".") + + for len(fieldNames) > 0 { + var field *fields.Field + + // Start by trying to find a field with name. If none found, + // cut off the last field (delimited by ".") and find its parent + // in the codec. + // eg. for name "A.B.C.D", split off "A.B.C" and try to + // find a field in the codec with this name. + // Loop again with "A.B", etc. + for i := len(fieldNames); i > 0; i-- { + parent := strings.Join(fieldNames[:i], ".") + field = codec.Match(parent) + if field != nil { + fieldNames = fieldNames[i:] + break + } + } + + // If we never found a matching field in the codec, return + // error message. + if field == nil { + return "no such struct field" + } + + v = initField(structValue, field.Index) + if !v.IsValid() { + return "no such struct field" + } + if !v.CanSet() { + return "cannot set struct field" + } + + // If field implements PLS, we delegate loading to the PLS's Load early, + // and stop iterating through fields. + ok, err := plsFieldLoad(v, p, fieldNames) + if err != nil { + return err.Error() + } + if ok { + return "" + } + + if field.Type.Kind() == reflect.Struct { + codec, err = structCache.Fields(field.Type) + if err != nil { + return err.Error() + } + structValue = v + } + + // If the element is a slice, we need to accommodate it. + if v.Kind() == reflect.Slice && v.Type() != typeOfByteSlice { + if l.m == nil { + l.m = make(map[string]int) + } + sliceIndex = l.m[p.Name] + l.m[p.Name] = sliceIndex + 1 + for v.Len() <= sliceIndex { + v.Set(reflect.Append(v, reflect.New(v.Type().Elem()).Elem())) + } + structValue = v.Index(sliceIndex) + + // If structValue implements PLS, we delegate loading to the PLS's + // Load early, and stop iterating through fields. + ok, err := plsFieldLoad(structValue, p, fieldNames) + if err != nil { + return err.Error() + } + if ok { + return "" + } + + if structValue.Type().Kind() == reflect.Struct { + codec, err = structCache.Fields(structValue.Type()) + if err != nil { + return err.Error() + } + } + sliceOk = true + } + } + + var slice reflect.Value + if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 { + slice = v + v = reflect.New(v.Type().Elem()).Elem() + } else if _, ok := prev[p.Name]; ok && !sliceOk { + // Zero the field back out that was set previously, turns out + // it's a slice and we don't know what to do with it + v.Set(reflect.Zero(v.Type())) + return "multiple-valued property requires a slice field type" + } + + prev[p.Name] = struct{}{} + + if errReason := setVal(v, p); errReason != "" { + // Set the slice back to its zero value. + if slice.IsValid() { + slice.Set(reflect.Zero(slice.Type())) + } + return errReason + } + + if slice.IsValid() { + slice.Index(sliceIndex).Set(v) + } + + return "" +} + +// plsFieldLoad first tries to converts v's value to a PLS, then v's addressed +// value to a PLS. If neither succeeds, plsFieldLoad returns false for first return +// value. Otherwise, the first return value will be true. +// If v is successfully converted to a PLS, plsFieldLoad will then try to Load +// the property p into v (by way of the PLS's Load method). +// +// If the field v has been flattened, the Property's name must be altered +// before calling Load to reflect the field v. +// For example, if our original field name was "A.B.C.D", +// and at this point in iteration we had initialized the field +// corresponding to "A" and have moved into the struct, so that now +// v corresponds to the field named "B", then we want to let the +// PLS handle this field (B)'s subfields ("C", "D"), +// so we send the property to the PLS's Load, renamed to "C.D". +// +// If subfields are present, the field v has been flattened. +func plsFieldLoad(v reflect.Value, p Property, subfields []string) (ok bool, err error) { + vpls, err := plsForLoad(v) + if err != nil { + return false, err + } + + if vpls == nil { + return false, nil + } + + // If Entity, load properties as well as key. + if e, ok := p.Value.(*Entity); ok { + err = loadEntity(vpls, e) + return true, err + } + + // If flattened, we must alter the property's name to reflect + // the field v. + if len(subfields) > 0 { + p.Name = strings.Join(subfields, ".") + } + + return true, vpls.Load([]Property{p}) +} + +// setVal sets 'v' to the value of the Property 'p'. +func setVal(v reflect.Value, p Property) (s string) { + pValue := p.Value + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + x, ok := pValue.(int64) + if !ok && pValue != nil { + return typeMismatchReason(p, v) + } + if v.OverflowInt(x) { + return overflowReason(x, v) + } + v.SetInt(x) + case reflect.Bool: + x, ok := pValue.(bool) + if !ok && pValue != nil { + return typeMismatchReason(p, v) + } + v.SetBool(x) + case reflect.String: + x, ok := pValue.(string) + if !ok && pValue != nil { + return typeMismatchReason(p, v) + } + v.SetString(x) + case reflect.Float32, reflect.Float64: + x, ok := pValue.(float64) + if !ok && pValue != nil { + return typeMismatchReason(p, v) + } + if v.OverflowFloat(x) { + return overflowReason(x, v) + } + v.SetFloat(x) + case reflect.Ptr: + // v must be a pointer to either a Key, an Entity, or one of the supported basic types. + if v.Type() != typeOfKeyPtr && v.Type().Elem().Kind() != reflect.Struct && !isValidPointerType(v.Type().Elem()) { + return typeMismatchReason(p, v) + } + + if pValue == nil { + // If v is populated already, set it to nil. + if !v.IsNil() { + v.Set(reflect.New(v.Type()).Elem()) + } + return "" + } + + if x, ok := p.Value.(*Key); ok { + if _, ok := v.Interface().(*Key); !ok { + return typeMismatchReason(p, v) + } + v.Set(reflect.ValueOf(x)) + return "" + } + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + switch x := pValue.(type) { + case *Entity: + err := loadEntity(v.Interface(), x) + if err != nil { + return err.Error() + } + case int64: + if v.Elem().OverflowInt(x) { + return overflowReason(x, v.Elem()) + } + v.Elem().SetInt(x) + case float64: + if v.Elem().OverflowFloat(x) { + return overflowReason(x, v.Elem()) + } + v.Elem().SetFloat(x) + case bool: + v.Elem().SetBool(x) + case string: + v.Elem().SetString(x) + case GeoPoint, time.Time: + v.Elem().Set(reflect.ValueOf(x)) + default: + return typeMismatchReason(p, v) + } + case reflect.Struct: + switch v.Type() { + case typeOfTime: + x, ok := pValue.(time.Time) + if !ok && pValue != nil { + return typeMismatchReason(p, v) + } + v.Set(reflect.ValueOf(x)) + case typeOfGeoPoint: + x, ok := pValue.(GeoPoint) + if !ok && pValue != nil { + return typeMismatchReason(p, v) + } + v.Set(reflect.ValueOf(x)) + default: + ent, ok := pValue.(*Entity) + if !ok { + return typeMismatchReason(p, v) + } + err := loadEntity(v.Addr().Interface(), ent) + if err != nil { + return err.Error() + } + } + case reflect.Slice: + x, ok := pValue.([]byte) + if !ok && pValue != nil { + return typeMismatchReason(p, v) + } + if v.Type().Elem().Kind() != reflect.Uint8 { + return typeMismatchReason(p, v) + } + v.SetBytes(x) + default: + return typeMismatchReason(p, v) + } + return "" +} + +// initField is similar to reflect's Value.FieldByIndex, in that it +// returns the nested struct field corresponding to index, but it +// initialises any nil pointers encountered when traversing the structure. +func initField(val reflect.Value, index []int) reflect.Value { + for _, i := range index[:len(index)-1] { + val = val.Field(i) + if val.Kind() == reflect.Ptr { + if val.IsNil() { + val.Set(reflect.New(val.Type().Elem())) + } + val = val.Elem() + } + } + return val.Field(index[len(index)-1]) +} + +// loadEntityProto loads an EntityProto into PropertyLoadSaver or struct pointer. +func loadEntityProto(dst interface{}, src *pb.Entity) error { + ent, err := protoToEntity(src) + if err != nil { + return err + } + return loadEntity(dst, ent) +} + +func loadEntity(dst interface{}, ent *Entity) error { + if pls, ok := dst.(PropertyLoadSaver); ok { + err := pls.Load(ent.Properties) + if err != nil { + return err + } + if e, ok := dst.(KeyLoader); ok { + err = e.LoadKey(ent.Key) + } + return err + } + return loadEntityToStruct(dst, ent) +} + +func loadEntityToStruct(dst interface{}, ent *Entity) error { + pls, err := newStructPLS(dst) + if err != nil { + return err + } + + // Try and load key. + keyField := pls.codec.Match(keyFieldName) + if keyField != nil && ent.Key != nil { + pls.v.FieldByIndex(keyField.Index).Set(reflect.ValueOf(ent.Key)) + } + + // Load properties. + return pls.Load(ent.Properties) +} + +func (s structPLS) Load(props []Property) error { + var fieldName, errReason string + var l propertyLoader + + prev := make(map[string]struct{}) + for _, p := range props { + if errStr := l.load(s.codec, s.v, p, prev); errStr != "" { + // We don't return early, as we try to load as many properties as possible. + // It is valid to load an entity into a struct that cannot fully represent it. + // That case returns an error, but the caller is free to ignore it. + fieldName, errReason = p.Name, errStr + } + } + if errReason != "" { + return &ErrFieldMismatch{ + StructType: s.v.Type(), + FieldName: fieldName, + Reason: errReason, + } + } + return nil +} + +func protoToEntity(src *pb.Entity) (*Entity, error) { + props := make([]Property, 0, len(src.Properties)) + for name, val := range src.Properties { + v, err := propToValue(val) + if err != nil { + return nil, err + } + props = append(props, Property{ + Name: name, + Value: v, + NoIndex: val.ExcludeFromIndexes, + }) + } + var key *Key + if src.Key != nil { + // Ignore any error, since nested entity values + // are allowed to have an invalid key. + key, _ = protoToKey(src.Key) + } + + return &Entity{key, props}, nil +} + +// propToValue returns a Go value that represents the PropertyValue. For +// example, a TimestampValue becomes a time.Time. +func propToValue(v *pb.Value) (interface{}, error) { + switch v := v.ValueType.(type) { + case *pb.Value_NullValue: + return nil, nil + case *pb.Value_BooleanValue: + return v.BooleanValue, nil + case *pb.Value_IntegerValue: + return v.IntegerValue, nil + case *pb.Value_DoubleValue: + return v.DoubleValue, nil + case *pb.Value_TimestampValue: + return time.Unix(v.TimestampValue.Seconds, int64(v.TimestampValue.Nanos)), nil + case *pb.Value_KeyValue: + return protoToKey(v.KeyValue) + case *pb.Value_StringValue: + return v.StringValue, nil + case *pb.Value_BlobValue: + return []byte(v.BlobValue), nil + case *pb.Value_GeoPointValue: + return GeoPoint{Lat: v.GeoPointValue.Latitude, Lng: v.GeoPointValue.Longitude}, nil + case *pb.Value_EntityValue: + return protoToEntity(v.EntityValue) + case *pb.Value_ArrayValue: + arr := make([]interface{}, 0, len(v.ArrayValue.Values)) + for _, v := range v.ArrayValue.Values { + vv, err := propToValue(v) + if err != nil { + return nil, err + } + arr = append(arr, vv) + } + return arr, nil + default: + return nil, nil + } +} diff --git a/vendor/cloud.google.com/go/datastore/load_test.go b/vendor/cloud.google.com/go/datastore/load_test.go new file mode 100644 index 000000000..f381cdf0a --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/load_test.go @@ -0,0 +1,909 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package datastore + +import ( + "reflect" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + pb "google.golang.org/genproto/googleapis/datastore/v1" +) + +type Simple struct { + I int64 +} + +type SimpleWithTag struct { + I int64 `datastore:"II"` +} + +type NestedSimpleWithTag struct { + A SimpleWithTag `datastore:"AA"` +} + +type NestedSliceOfSimple struct { + A []Simple +} + +type SimpleTwoFields struct { + S string + SS string +} + +type NestedSimpleAnonymous struct { + Simple + X string +} + +type NestedSimple struct { + A Simple + I int +} + +type NestedSimple1 struct { + A Simple + X string +} + +type NestedSimple2X struct { + AA NestedSimple + A SimpleTwoFields + S string +} + +type BDotB struct { + B string `datastore:"B.B"` +} + +type ABDotB struct { + A BDotB +} + +type MultiAnonymous struct { + Simple + SimpleTwoFields + X string +} + +func TestLoadEntityNestedLegacy(t *testing.T) { + testCases := []struct { + desc string + src *pb.Entity + want interface{} + }{ + { + desc: "nested", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "X": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + "A.I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + want: &NestedSimple1{ + A: Simple{I: 2}, + X: "two", + }, + }, + { + desc: "nested with tag", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "AA.II": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + want: &NestedSimpleWithTag{ + A: SimpleWithTag{I: 2}, + }, + }, + { + desc: "nested with anonymous struct field", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "X": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + want: &NestedSimpleAnonymous{ + Simple: Simple{I: 2}, + X: "two", + }, + }, + { + desc: "nested with dotted field tag", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "A.B.B": {ValueType: &pb.Value_StringValue{StringValue: "bb"}}, + }, + }, + want: &ABDotB{ + A: BDotB{ + B: "bb", + }, + }, + }, + { + desc: "nested with multiple anonymous fields", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 3}}, + "S": {ValueType: &pb.Value_StringValue{StringValue: "S"}}, + "SS": {ValueType: &pb.Value_StringValue{StringValue: "s"}}, + "X": {ValueType: &pb.Value_StringValue{StringValue: "s"}}, + }, + }, + want: &MultiAnonymous{ + Simple: Simple{I: 3}, + SimpleTwoFields: SimpleTwoFields{S: "S", SS: "s"}, + X: "s", + }, + }, + } + + for _, tc := range testCases { + dst := reflect.New(reflect.TypeOf(tc.want).Elem()).Interface() + err := loadEntityProto(dst, tc.src) + if err != nil { + t.Errorf("loadEntityProto: %s: %v", tc.desc, err) + continue + } + + if !testutil.Equal(tc.want, dst) { + t.Errorf("%s: compare:\ngot: %#v\nwant: %#v", tc.desc, dst, tc.want) + } + } +} + +type WithKey struct { + X string + I int + K *Key `datastore:"__key__"` +} + +type NestedWithKey struct { + Y string + N WithKey +} + +var ( + incompleteKey = newKey("", nil) + invalidKey = newKey("s", incompleteKey) +) + +func TestLoadEntityNested(t *testing.T) { + testCases := []struct { + desc string + src *pb.Entity + want interface{} + }{ + { + desc: "nested basic", + src: &pb.Entity{ + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 3}}, + }, + }, + }}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 10}}, + }, + }, + want: &NestedSimple{ + A: Simple{I: 3}, + I: 10, + }, + }, + { + desc: "nested with struct tags", + src: &pb.Entity{ + Properties: map[string]*pb.Value{ + "AA": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "II": {ValueType: &pb.Value_IntegerValue{IntegerValue: 1}}, + }, + }, + }}, + }, + }, + want: &NestedSimpleWithTag{ + A: SimpleWithTag{I: 1}, + }, + }, + { + desc: "nested 2x", + src: &pb.Entity{ + Properties: map[string]*pb.Value{ + "AA": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 3}}, + }, + }, + }}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 1}}, + }, + }, + }}, + "A": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "S": {ValueType: &pb.Value_StringValue{StringValue: "S"}}, + "SS": {ValueType: &pb.Value_StringValue{StringValue: "s"}}, + }, + }, + }}, + "S": {ValueType: &pb.Value_StringValue{StringValue: "SS"}}, + }, + }, + want: &NestedSimple2X{ + AA: NestedSimple{ + A: Simple{I: 3}, + I: 1, + }, + A: SimpleTwoFields{S: "S", SS: "s"}, + S: "SS", + }, + }, + { + desc: "nested anonymous", + src: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 3}}, + "X": {ValueType: &pb.Value_StringValue{StringValue: "SomeX"}}, + }, + }, + want: &NestedSimpleAnonymous{ + Simple: Simple{I: 3}, + X: "SomeX", + }, + }, + { + desc: "nested simple with slice", + src: &pb.Entity{ + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_ArrayValue{ + ArrayValue: &pb.ArrayValue{ + Values: []*pb.Value{ + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 3}}, + }, + }, + }}, + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 4}}, + }, + }, + }}, + }, + }, + }}, + }, + }, + + want: &NestedSliceOfSimple{ + A: []Simple{{I: 3}, {I: 4}}, + }, + }, + { + desc: "nested with multiple anonymous fields", + src: &pb.Entity{ + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 3}}, + "S": {ValueType: &pb.Value_StringValue{StringValue: "S"}}, + "SS": {ValueType: &pb.Value_StringValue{StringValue: "s"}}, + "X": {ValueType: &pb.Value_StringValue{StringValue: "ss"}}, + }, + }, + want: &MultiAnonymous{ + Simple: Simple{I: 3}, + SimpleTwoFields: SimpleTwoFields{S: "S", SS: "s"}, + X: "ss", + }, + }, + { + desc: "nested with dotted field tag", + src: &pb.Entity{ + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "B.B": {ValueType: &pb.Value_StringValue{StringValue: "bb"}}, + }, + }, + }}, + }, + }, + want: &ABDotB{ + A: BDotB{ + B: "bb", + }, + }, + }, + { + desc: "nested entity with key", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Y": {ValueType: &pb.Value_StringValue{StringValue: "yyy"}}, + "N": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Key: keyToProto(testKey1a), + Properties: map[string]*pb.Value{ + "X": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + }}, + }, + }, + want: &NestedWithKey{ + Y: "yyy", + N: WithKey{ + X: "two", + I: 2, + K: testKey1a, + }, + }, + }, + { + desc: "nested entity with invalid key", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Y": {ValueType: &pb.Value_StringValue{StringValue: "yyy"}}, + "N": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Key: keyToProto(invalidKey), + Properties: map[string]*pb.Value{ + "X": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + }}, + }, + }, + want: &NestedWithKey{ + Y: "yyy", + N: WithKey{ + X: "two", + I: 2, + K: invalidKey, + }, + }, + }, + } + + for _, tc := range testCases { + dst := reflect.New(reflect.TypeOf(tc.want).Elem()).Interface() + err := loadEntityProto(dst, tc.src) + if err != nil { + t.Errorf("loadEntityProto: %s: %v", tc.desc, err) + continue + } + + if !testutil.Equal(tc.want, dst) { + t.Errorf("%s: compare:\ngot: %#v\nwant: %#v", tc.desc, dst, tc.want) + } + } +} + +type NestedStructPtrs struct { + *SimpleTwoFields + Nest *SimpleTwoFields + TwiceNest *NestedSimple2 + I int +} + +type NestedSimple2 struct { + A *Simple + I int +} + +func TestAlreadyPopulatedDst(t *testing.T) { + testCases := []struct { + desc string + src *pb.Entity + dst interface{} + want interface{} + }{ + { + desc: "simple already populated, nil properties", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "I": {ValueType: &pb.Value_NullValue{}}, + }, + }, + dst: &Simple{ + I: 12, + }, + want: &Simple{}, + }, + { + desc: "nested structs already populated", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "SS": {ValueType: &pb.Value_StringValue{StringValue: "world"}}, + }, + }, + dst: &SimpleTwoFields{S: "hello" /* SS: "" */}, + want: &SimpleTwoFields{S: "hello", SS: "world"}, + }, + { + desc: "nested structs already populated, pValues nil", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "S": {ValueType: &pb.Value_NullValue{}}, + "SS": {ValueType: &pb.Value_StringValue{StringValue: "ss hello"}}, + "Nest": {ValueType: &pb.Value_NullValue{}}, + "TwiceNest": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_NullValue{}}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + }}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 5}}, + }, + }, + dst: &NestedStructPtrs{ + &SimpleTwoFields{S: "hello" /* SS: "" */}, + &SimpleTwoFields{ /* S: "" */ SS: "twice hello"}, + &NestedSimple2{ + A: &Simple{I: 2}, + /* I: 0 */ + }, + 0, + }, + want: &NestedStructPtrs{ + &SimpleTwoFields{ /* S: "" */ SS: "ss hello"}, + nil, + &NestedSimple2{ + /* A: nil, */ + I: 2, + }, + 5, + }, + }, + } + + for _, tc := range testCases { + err := loadEntityProto(tc.dst, tc.src) + if err != nil { + t.Errorf("loadEntityProto: %s: %v", tc.desc, err) + continue + } + + if !testutil.Equal(tc.want, tc.dst) { + t.Errorf("%s: compare:\ngot: %#v\nwant: %#v", tc.desc, tc.dst, tc.want) + } + } +} + +type PLS0 struct { + A string +} + +func (p *PLS0) Load(props []Property) error { + for _, pp := range props { + if pp.Name == "A" { + p.A = pp.Value.(string) + } + } + return nil +} + +func (p *PLS0) Save() (props []Property, err error) { + return []Property{{Name: "A", Value: p.A}}, nil +} + +type KeyLoader1 struct { + A string + K *Key +} + +func (kl *KeyLoader1) Load(props []Property) error { + for _, pp := range props { + if pp.Name == "A" { + kl.A = pp.Value.(string) + } + } + return nil +} + +func (kl *KeyLoader1) Save() (props []Property, err error) { + return []Property{{Name: "A", Value: kl.A}}, nil +} + +func (kl *KeyLoader1) LoadKey(k *Key) error { + kl.K = k + return nil +} + +type KeyLoader2 struct { + B int + Key *Key +} + +func (kl *KeyLoader2) Load(props []Property) error { + for _, pp := range props { + if pp.Name == "B" { + kl.B = int(pp.Value.(int64)) + } + } + return nil +} + +func (kl *KeyLoader2) Save() (props []Property, err error) { + return []Property{{Name: "B", Value: int64(kl.B)}}, nil +} + +func (kl *KeyLoader2) LoadKey(k *Key) error { + kl.Key = k + return nil +} + +type KeyLoader3 struct { + C bool + K *Key +} + +func (kl *KeyLoader3) Load(props []Property) error { + for _, pp := range props { + if pp.Name == "C" { + kl.C = pp.Value.(bool) + } + } + return nil +} + +func (kl *KeyLoader3) Save() (props []Property, err error) { + return []Property{{Name: "C", Value: kl.C}}, nil +} + +func (kl *KeyLoader3) LoadKey(k *Key) error { + kl.K = k + return nil +} + +type KeyLoader4 struct { + PLS0 + K *Key +} + +func (kl *KeyLoader4) LoadKey(k *Key) error { + kl.K = k + return nil +} + +type NotKeyLoader struct { + A string + K *Key +} + +func (p *NotKeyLoader) Load(props []Property) error { + for _, pp := range props { + if pp.Name == "A" { + p.A = pp.Value.(string) + } + } + return nil +} + +func (p *NotKeyLoader) Save() (props []Property, err error) { + return []Property{{Name: "A", Value: p.A}}, nil +} + +type NotPLSKeyLoader struct { + A string + K *Key `datastore:"__key__"` +} + +type NestedKeyLoaders struct { + Two *KeyLoader2 + Three []*KeyLoader3 + Four *KeyLoader4 + PLS *NotKeyLoader +} + +func TestKeyLoader(t *testing.T) { + testCases := []struct { + desc string + src *pb.Entity + dst interface{} + want interface{} + }{ + { + desc: "simple key loader", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_StringValue{StringValue: "hello"}}, + }, + }, + dst: &KeyLoader1{}, + want: &KeyLoader1{ + A: "hello", + K: testKey0, + }, + }, + { + desc: "simple key loader with unmatched properties", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_StringValue{StringValue: "hello"}}, + "B": {ValueType: &pb.Value_StringValue{StringValue: "unmatched"}}, + }, + }, + dst: &NotPLSKeyLoader{}, + want: &NotPLSKeyLoader{ + A: "hello", + K: testKey0, + }, + }, + { + desc: "embedded PLS key loader", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_StringValue{StringValue: "hello"}}, + }, + }, + dst: &KeyLoader4{}, + want: &KeyLoader4{ + PLS0: PLS0{A: "hello"}, + K: testKey0, + }, + }, + { + desc: "nested key loaders", + src: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Two": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "B": {ValueType: &pb.Value_IntegerValue{IntegerValue: 12}}, + }, + Key: keyToProto(testKey1a), + }, + }}, + "Three": {ValueType: &pb.Value_ArrayValue{ + ArrayValue: &pb.ArrayValue{ + Values: []*pb.Value{ + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "C": {ValueType: &pb.Value_BooleanValue{BooleanValue: true}}, + }, + Key: keyToProto(testKey1b), + }, + }}, + {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "C": {ValueType: &pb.Value_BooleanValue{BooleanValue: false}}, + }, + Key: keyToProto(testKey0), + }, + }}, + }, + }, + }}, + "Four": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_StringValue{StringValue: "testing"}}, + }, + Key: keyToProto(testKey2a), + }, + }}, + "PLS": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "A": {ValueType: &pb.Value_StringValue{StringValue: "something"}}, + }, + + Key: keyToProto(testKey1a), + }, + }}, + }, + }, + dst: &NestedKeyLoaders{}, + want: &NestedKeyLoaders{ + Two: &KeyLoader2{B: 12, Key: testKey1a}, + Three: []*KeyLoader3{ + { + C: true, + K: testKey1b, + }, + { + C: false, + K: testKey0, + }, + }, + Four: &KeyLoader4{ + PLS0: PLS0{A: "testing"}, + K: testKey2a, + }, + PLS: &NotKeyLoader{A: "something"}, + }, + }, + } + + for _, tc := range testCases { + err := loadEntityProto(tc.dst, tc.src) + if err != nil { + // While loadEntityProto may return an error, if that error is + // ErrFieldMismatch, then there is still data in tc.dst to compare. + if _, ok := err.(*ErrFieldMismatch); !ok { + t.Errorf("loadEntityProto: %s: %v", tc.desc, err) + continue + } + } + + if !testutil.Equal(tc.want, tc.dst) { + t.Errorf("%s: compare:\ngot: %+v\nwant: %+v", tc.desc, tc.dst, tc.want) + } + } +} + +func TestLoadPointers(t *testing.T) { + for _, test := range []struct { + desc string + in []Property + want Pointers + }{ + { + desc: "nil properties load as nil pointers", + in: []Property{ + {Name: "Pi", Value: nil}, + {Name: "Ps", Value: nil}, + {Name: "Pb", Value: nil}, + {Name: "Pf", Value: nil}, + {Name: "Pg", Value: nil}, + {Name: "Pt", Value: nil}, + }, + want: Pointers{}, + }, + { + desc: "missing properties load as nil pointers", + in: []Property(nil), + want: Pointers{}, + }, + { + desc: "non-nil properties load as the appropriate values", + in: []Property{ + {Name: "Pi", Value: int64(1)}, + {Name: "Ps", Value: "x"}, + {Name: "Pb", Value: true}, + {Name: "Pf", Value: 3.14}, + {Name: "Pg", Value: GeoPoint{Lat: 1, Lng: 2}}, + {Name: "Pt", Value: time.Unix(100, 0)}, + }, + want: func() Pointers { + p := populatedPointers() + *p.Pi = 1 + *p.Ps = "x" + *p.Pb = true + *p.Pf = 3.14 + *p.Pg = GeoPoint{Lat: 1, Lng: 2} + *p.Pt = time.Unix(100, 0) + return *p + }(), + }, + } { + var got Pointers + if err := LoadStruct(&got, test.in); err != nil { + t.Fatalf("%s: %v", test.desc, err) + } + if !testutil.Equal(got, test.want) { + t.Errorf("%s:\ngot %+v\nwant %+v", test.desc, got, test.want) + } + } +} + +func TestLoadNonArrayIntoSlice(t *testing.T) { + // Loading a non-array value into a slice field results in a slice of size 1. + var got struct{ S []string } + if err := LoadStruct(&got, []Property{{Name: "S", Value: "x"}}); err != nil { + t.Fatal(err) + } + if want := []string{"x"}; !testutil.Equal(got.S, want) { + t.Errorf("got %#v, want %#v", got.S, want) + } +} + +func TestLoadEmptyArrayIntoSlice(t *testing.T) { + // Loading an empty array into a slice field is a no-op. + var got = struct{ S []string }{[]string{"x"}} + if err := LoadStruct(&got, []Property{{Name: "S", Value: []interface{}{}}}); err != nil { + t.Fatal(err) + } + if want := []string{"x"}; !testutil.Equal(got.S, want) { + t.Errorf("got %#v, want %#v", got.S, want) + } +} + +func TestLoadNull(t *testing.T) { + // Loading a Datastore Null into a basic type (int, float, etc.) results in a zero value. + // Loading a Null into a slice of basic type results in a slice of size 1 containing the zero value. + // (As expected from the behavior of slices and nulls with basic types.) + type S struct { + I int64 + F float64 + S string + B bool + A []string + } + got := S{ + I: 1, + F: 1.0, + S: "1", + B: true, + A: []string{"X"}, + } + want := S{A: []string{""}} + props := []Property{{Name: "I"}, {Name: "F"}, {Name: "S"}, {Name: "B"}, {Name: "A"}} + if err := LoadStruct(&got, props); err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } + + // Loading a Null into a pointer to struct field results in a nil field. + got2 := struct{ X *S }{X: &S{}} + if err := LoadStruct(&got2, []Property{{Name: "X"}}); err != nil { + t.Fatal(err) + } + if got2.X != nil { + t.Errorf("got %v, want nil", got2.X) + } + + // Loading a Null into a struct field is an error. + got3 := struct{ X S }{} + err := LoadStruct(&got3, []Property{{Name: "X"}}) + if err == nil { + t.Error("got nil, want error") + } +} + +// var got2 struct{ S []Pet } +// if err := LoadStruct(&got2, []Property{{Name: "S", Value: nil}}); err != nil { +// t.Fatal(err) +// } + +// } diff --git a/vendor/cloud.google.com/go/datastore/mutation.go b/vendor/cloud.google.com/go/datastore/mutation.go new file mode 100644 index 000000000..f80f96465 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/mutation.go @@ -0,0 +1,129 @@ +// 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. + +package datastore + +import ( + "fmt" + + pb "google.golang.org/genproto/googleapis/datastore/v1" +) + +// A Mutation represents a change to a Datastore entity. +type Mutation struct { + key *Key // needed for transaction PendingKeys and to dedup deletions + mut *pb.Mutation + err error +} + +func (m *Mutation) isDelete() bool { + _, ok := m.mut.Operation.(*pb.Mutation_Delete) + return ok +} + +// NewInsert creates a mutation that will save the entity src into the datastore with +// key k, returning an error if k already exists. +// See Client.Put for valid values of src. +func NewInsert(k *Key, src interface{}) *Mutation { + if !k.valid() { + return &Mutation{err: ErrInvalidKey} + } + p, err := saveEntity(k, src) + if err != nil { + return &Mutation{err: err} + } + return &Mutation{ + key: k, + mut: &pb.Mutation{Operation: &pb.Mutation_Insert{Insert: p}}, + } +} + +// NewUpsert creates a mutation that saves the entity src into the datastore with key +// k, whether or not k exists. See Client.Put for valid values of src. +func NewUpsert(k *Key, src interface{}) *Mutation { + if !k.valid() { + return &Mutation{err: ErrInvalidKey} + } + p, err := saveEntity(k, src) + if err != nil { + return &Mutation{err: err} + } + return &Mutation{ + key: k, + mut: &pb.Mutation{Operation: &pb.Mutation_Upsert{Upsert: p}}, + } +} + +// NewUpdate creates a mutation that replaces the entity in the datastore with key k, +// returning an error if k does not exist. See Client.Put for valid values of src. +func NewUpdate(k *Key, src interface{}) *Mutation { + if !k.valid() { + return &Mutation{err: ErrInvalidKey} + } + if k.Incomplete() { + return &Mutation{err: fmt.Errorf("datastore: can't update the incomplete key: %v", k)} + } + p, err := saveEntity(k, src) + if err != nil { + return &Mutation{err: err} + } + return &Mutation{ + key: k, + mut: &pb.Mutation{Operation: &pb.Mutation_Update{Update: p}}, + } +} + +// NewDelete creates a mutation that deletes the entity with key k. +func NewDelete(k *Key) *Mutation { + if !k.valid() { + return &Mutation{err: ErrInvalidKey} + } + if k.Incomplete() { + return &Mutation{err: fmt.Errorf("datastore: can't delete the incomplete key: %v", k)} + } + return &Mutation{ + key: k, + mut: &pb.Mutation{Operation: &pb.Mutation_Delete{Delete: keyToProto(k)}}, + } +} + +func mutationProtos(muts []*Mutation) ([]*pb.Mutation, error) { + // If any of the mutations have errors, collect and return them. + var merr MultiError + for i, m := range muts { + if m.err != nil { + if merr == nil { + merr = make(MultiError, len(muts)) + } + merr[i] = m.err + } + } + if merr != nil { + return nil, merr + } + var protos []*pb.Mutation + // Collect protos. Remove duplicate deletions (see deleteMutations). + seen := map[string]bool{} + for _, m := range muts { + if m.isDelete() { + ks := m.key.String() + if seen[ks] { + continue + } + seen[ks] = true + } + protos = append(protos, m.mut) + } + return protos, nil +} diff --git a/vendor/cloud.google.com/go/datastore/mutation_test.go b/vendor/cloud.google.com/go/datastore/mutation_test.go new file mode 100644 index 000000000..0d21141ad --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/mutation_test.go @@ -0,0 +1,150 @@ +// 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. + +package datastore + +import ( + "testing" + + "cloud.google.com/go/internal/testutil" + pb "google.golang.org/genproto/googleapis/datastore/v1" +) + +func TestMutationProtos(t *testing.T) { + var keys []*Key + for i := 1; i <= 4; i++ { + k := IDKey("kind", int64(i), nil) + keys = append(keys, k) + } + entity := &PropertyList{{Name: "n", Value: "v"}} + entityForKey := func(k *Key) *pb.Entity { + return &pb.Entity{ + Key: keyToProto(k), + Properties: map[string]*pb.Value{ + "n": {ValueType: &pb.Value_StringValue{StringValue: "v"}}, + }, + } + } + for _, test := range []struct { + desc string + in []*Mutation + want []*pb.Mutation + }{ + { + desc: "nil", + in: nil, + want: nil, + }, + { + desc: "empty", + in: []*Mutation{}, + want: nil, + }, + { + desc: "various", + in: []*Mutation{ + NewInsert(keys[0], entity), + NewUpsert(keys[1], entity), + NewUpdate(keys[2], entity), + NewDelete(keys[3]), + }, + want: []*pb.Mutation{ + {Operation: &pb.Mutation_Insert{Insert: entityForKey(keys[0])}}, + {Operation: &pb.Mutation_Upsert{Upsert: entityForKey(keys[1])}}, + {Operation: &pb.Mutation_Update{Update: entityForKey(keys[2])}}, + {Operation: &pb.Mutation_Delete{Delete: keyToProto(keys[3])}}, + }, + }, + { + desc: "duplicate deletes", + in: []*Mutation{ + NewDelete(keys[0]), + NewInsert(keys[1], entity), + NewDelete(keys[0]), + NewDelete(keys[2]), + NewDelete(keys[0]), + }, + want: []*pb.Mutation{ + {Operation: &pb.Mutation_Delete{Delete: keyToProto(keys[0])}}, + {Operation: &pb.Mutation_Insert{Insert: entityForKey(keys[1])}}, + {Operation: &pb.Mutation_Delete{Delete: keyToProto(keys[2])}}, + }, + }, + } { + got, err := mutationProtos(test.in) + if err != nil { + t.Errorf("%s: %v", test.desc, err) + continue + } + if diff := testutil.Diff(got, test.want); diff != "" { + t.Errorf("%s: %s", test.desc, diff) + } + } +} + +func TestMutationProtosErrors(t *testing.T) { + entity := &PropertyList{{Name: "n", Value: "v"}} + k := IDKey("kind", 1, nil) + ik := IncompleteKey("kind", nil) + for _, test := range []struct { + desc string + in []*Mutation + want []int // non-nil indexes of MultiError + }{ + { + desc: "invalid key", + in: []*Mutation{ + NewInsert(nil, entity), + NewUpdate(nil, entity), + NewUpsert(nil, entity), + NewDelete(nil), + }, + want: []int{0, 1, 2, 3}, + }, + { + desc: "incomplete key", + in: []*Mutation{ + NewInsert(ik, entity), + NewUpdate(ik, entity), + NewUpsert(ik, entity), + NewDelete(ik), + }, + want: []int{1, 3}, + }, + { + desc: "bad entity", + in: []*Mutation{ + NewInsert(k, 1), + NewUpdate(k, 2), + NewUpsert(k, 3), + }, + want: []int{0, 1, 2}, + }, + } { + _, err := mutationProtos(test.in) + if err == nil { + t.Errorf("%s: got nil, want error", test.desc) + continue + } + var got []int + for i, err := range err.(MultiError) { + if err != nil { + got = append(got, i) + } + } + if !testutil.Equal(got, test.want) { + t.Errorf("%s: got errors at %v, want at %v", test.desc, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/datastore/oc_test.go b/vendor/cloud.google.com/go/datastore/oc_test.go new file mode 100644 index 000000000..be1e5a4fd --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/oc_test.go @@ -0,0 +1,43 @@ +// 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. + +package datastore + +import ( + "context" + "testing" + + "cloud.google.com/go/internal/testutil" +) + +func TestOCTracing(t *testing.T) { + ctx := context.Background() + client := newTestClient(ctx, t) + defer client.Close() + + te := testutil.NewTestExporter() + defer te.Unregister() + + type SomeValue struct { + S string + } + _, err := client.Put(ctx, IncompleteKey("SomeKey", nil), &SomeValue{"foo"}) + if err != nil { + t.Fatalf("client.Put: %v", err) + } + + if len(te.Spans) == 0 { + t.Fatalf("Expected some span to be created, but got %d", 0) + } +} diff --git a/vendor/cloud.google.com/go/datastore/prop.go b/vendor/cloud.google.com/go/datastore/prop.go new file mode 100644 index 000000000..98084d033 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/prop.go @@ -0,0 +1,342 @@ +// 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 datastore + +import ( + "fmt" + "reflect" + "strings" + "unicode" + + "cloud.google.com/go/internal/fields" +) + +// Entities with more than this many indexed properties will not be saved. +const maxIndexedProperties = 20000 + +// []byte fields more than 1 megabyte long will not be loaded or saved. +const maxBlobLen = 1 << 20 + +// Property is a name/value pair plus some metadata. A datastore entity's +// contents are loaded and saved as a sequence of Properties. Each property +// name must be unique within an entity. +type Property struct { + // Name is the property name. + Name string + // Value is the property value. The valid types are: + // - int64 + // - bool + // - string + // - float64 + // - *Key + // - time.Time (retrieved as local time) + // - GeoPoint + // - []byte (up to 1 megabyte in length) + // - *Entity (representing a nested struct) + // Value can also be: + // - []interface{} where each element is one of the above types + // This set is smaller than the set of valid struct field types that the + // datastore can load and save. A Value's type must be explicitly on + // the list above; it is not sufficient for the underlying type to be + // on that list. For example, a Value of "type myInt64 int64" is + // invalid. Smaller-width integers and floats are also invalid. Again, + // this is more restrictive than the set of valid struct field types. + // + // A Value will have an opaque type when loading entities from an index, + // such as via a projection query. Load entities into a struct instead + // of a PropertyLoadSaver when using a projection query. + // + // A Value may also be the nil interface value; this is equivalent to + // Python's None but not directly representable by a Go struct. Loading + // a nil-valued property into a struct will set that field to the zero + // value. + Value interface{} + // NoIndex is whether the datastore cannot index this property. + // If NoIndex is set to false, []byte and string values are limited to + // 1500 bytes. + NoIndex bool +} + +// An Entity is the value type for a nested struct. +// This type is only used for a Property's Value. +type Entity struct { + Key *Key + Properties []Property +} + +// PropertyLoadSaver can be converted from and to a slice of Properties. +type PropertyLoadSaver interface { + Load([]Property) error + Save() ([]Property, error) +} + +// KeyLoader can store a Key. +type KeyLoader interface { + // PropertyLoadSaver is embedded because a KeyLoader + // must also always implement PropertyLoadSaver. + PropertyLoadSaver + LoadKey(k *Key) error +} + +// PropertyList converts a []Property to implement PropertyLoadSaver. +type PropertyList []Property + +var ( + typeOfPropertyLoadSaver = reflect.TypeOf((*PropertyLoadSaver)(nil)).Elem() + typeOfPropertyList = reflect.TypeOf(PropertyList(nil)) +) + +// Load loads all of the provided properties into l. +// It does not first reset *l to an empty slice. +func (l *PropertyList) Load(p []Property) error { + *l = append(*l, p...) + return nil +} + +// Save saves all of l's properties as a slice of Properties. +func (l *PropertyList) Save() ([]Property, error) { + return *l, nil +} + +// validPropertyName returns whether name consists of one or more valid Go +// identifiers joined by ".". +func validPropertyName(name string) bool { + if name == "" { + return false + } + for _, s := range strings.Split(name, ".") { + if s == "" { + return false + } + first := true + for _, c := range s { + if first { + first = false + if c != '_' && !unicode.IsLetter(c) { + return false + } + } else { + if c != '_' && !unicode.IsLetter(c) && !unicode.IsDigit(c) { + return false + } + } + } + } + return true +} + +// parseTag interprets datastore struct field tags +func parseTag(t reflect.StructTag) (name string, keep bool, other interface{}, err error) { + s := t.Get("datastore") + parts := strings.Split(s, ",") + if parts[0] == "-" && len(parts) == 1 { + return "", false, nil, nil + } + if parts[0] != "" && !validPropertyName(parts[0]) { + err = fmt.Errorf("datastore: struct tag has invalid property name: %q", parts[0]) + return "", false, nil, err + } + + var opts saveOpts + if len(parts) > 1 { + for _, p := range parts[1:] { + switch p { + case "flatten": + opts.flatten = true + case "omitempty": + opts.omitEmpty = true + case "noindex": + opts.noIndex = true + default: + err = fmt.Errorf("datastore: struct tag has invalid option: %q", p) + return "", false, nil, err + } + } + other = opts + } + return parts[0], true, other, nil +} + +func validateType(t reflect.Type) error { + if t.Kind() != reflect.Struct { + return fmt.Errorf("datastore: validate called with non-struct type %s", t) + } + + return validateChildType(t, "", false, false, map[reflect.Type]bool{}) +} + +// validateChildType is a recursion helper func for validateType +func validateChildType(t reflect.Type, fieldName string, flatten, prevSlice bool, prevTypes map[reflect.Type]bool) error { + if prevTypes[t] { + return nil + } + prevTypes[t] = true + + switch t.Kind() { + case reflect.Slice: + if flatten && prevSlice { + return fmt.Errorf("datastore: flattening nested structs leads to a slice of slices: field %q", fieldName) + } + return validateChildType(t.Elem(), fieldName, flatten, true, prevTypes) + case reflect.Struct: + if t == typeOfTime || t == typeOfGeoPoint { + return nil + } + + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + + // If a named field is unexported, ignore it. An anonymous + // unexported field is processed, because it may contain + // exported fields, which are visible. + exported := (f.PkgPath == "") + if !exported && !f.Anonymous { + continue + } + + _, keep, other, err := parseTag(f.Tag) + // Handle error from parseTag now instead of later (in cache.Fields call). + if err != nil { + return err + } + if !keep { + continue + } + if other != nil { + opts := other.(saveOpts) + flatten = flatten || opts.flatten + } + if err := validateChildType(f.Type, f.Name, flatten, prevSlice, prevTypes); err != nil { + return err + } + } + case reflect.Ptr: + if t == typeOfKeyPtr { + return nil + } + return validateChildType(t.Elem(), fieldName, flatten, prevSlice, prevTypes) + } + return nil +} + +// isLeafType determines whether or not a type is a 'leaf type' +// and should not be recursed into, but considered one field. +func isLeafType(t reflect.Type) bool { + return t == typeOfTime || t == typeOfGeoPoint +} + +// structCache collects the structs whose fields have already been calculated. +var structCache = fields.NewCache(parseTag, validateType, isLeafType) + +// structPLS adapts a struct to be a PropertyLoadSaver. +type structPLS struct { + v reflect.Value + codec fields.List +} + +// newStructPLS returns a structPLS, which implements the +// PropertyLoadSaver interface, for the struct pointer p. +func newStructPLS(p interface{}) (*structPLS, error) { + v := reflect.ValueOf(p) + if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct { + return nil, ErrInvalidEntityType + } + v = v.Elem() + f, err := structCache.Fields(v.Type()) + if err != nil { + return nil, err + } + return &structPLS{v, f}, nil +} + +// LoadStruct loads the properties from p to dst. +// dst must be a struct pointer. +// +// The values of dst's unmatched struct fields are not modified, +// and matching slice-typed fields are not reset before appending to +// them. In particular, it is recommended to pass a pointer to a zero +// valued struct on each LoadStruct call. +func LoadStruct(dst interface{}, p []Property) error { + x, err := newStructPLS(dst) + if err != nil { + return err + } + return x.Load(p) +} + +// SaveStruct returns the properties from src as a slice of Properties. +// src must be a struct pointer. +func SaveStruct(src interface{}) ([]Property, error) { + x, err := newStructPLS(src) + if err != nil { + return nil, err + } + return x.Save() +} + +// plsForLoad tries to convert v to a PropertyLoadSaver. +// If successful, plsForLoad returns a settable v as a PropertyLoadSaver. +// +// plsForLoad is intended to be used with nested struct fields which +// may implement PropertyLoadSaver. +// +// v must be settable. +func plsForLoad(v reflect.Value) (PropertyLoadSaver, error) { + var nilPtr bool + if v.Kind() == reflect.Ptr && v.IsNil() { + nilPtr = true + v.Set(reflect.New(v.Type().Elem())) + } + + vpls, err := pls(v) + if nilPtr && (vpls == nil || err != nil) { + // unset v + v.Set(reflect.Zero(v.Type())) + } + + return vpls, err +} + +// plsForSave tries to convert v to a PropertyLoadSaver. +// If successful, plsForSave returns v as a PropertyLoadSaver. +// +// plsForSave is intended to be used with nested struct fields which +// may implement PropertyLoadSaver. +// +// v must be settable. +func plsForSave(v reflect.Value) (PropertyLoadSaver, error) { + switch v.Kind() { + case reflect.Ptr, reflect.Slice, reflect.Map, reflect.Interface, reflect.Chan, reflect.Func: + // If v is nil, return early. v contains no data to save. + if v.IsNil() { + return nil, nil + } + } + + return pls(v) +} + +func pls(v reflect.Value) (PropertyLoadSaver, error) { + if v.Kind() != reflect.Ptr { + if _, ok := v.Interface().(PropertyLoadSaver); ok { + return nil, fmt.Errorf("datastore: PropertyLoadSaver methods must be implemented on a pointer to %T", v.Interface()) + } + + v = v.Addr() + } + + vpls, _ := v.Interface().(PropertyLoadSaver) + return vpls, nil +} diff --git a/vendor/cloud.google.com/go/datastore/query.go b/vendor/cloud.google.com/go/datastore/query.go new file mode 100644 index 000000000..19576cddc --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/query.go @@ -0,0 +1,784 @@ +// 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 datastore + +import ( + "context" + "encoding/base64" + "errors" + "fmt" + "math" + "reflect" + "strconv" + "strings" + + "cloud.google.com/go/internal/trace" + wrapperspb "github.com/golang/protobuf/ptypes/wrappers" + "google.golang.org/api/iterator" + pb "google.golang.org/genproto/googleapis/datastore/v1" +) + +type operator int + +const ( + lessThan operator = iota + 1 + lessEq + equal + greaterEq + greaterThan + + keyFieldName = "__key__" +) + +var operatorToProto = map[operator]pb.PropertyFilter_Operator{ + lessThan: pb.PropertyFilter_LESS_THAN, + lessEq: pb.PropertyFilter_LESS_THAN_OR_EQUAL, + equal: pb.PropertyFilter_EQUAL, + greaterEq: pb.PropertyFilter_GREATER_THAN_OR_EQUAL, + greaterThan: pb.PropertyFilter_GREATER_THAN, +} + +// filter is a conditional filter on query results. +type filter struct { + FieldName string + Op operator + Value interface{} +} + +type sortDirection bool + +const ( + ascending sortDirection = false + descending sortDirection = true +) + +var sortDirectionToProto = map[sortDirection]pb.PropertyOrder_Direction{ + ascending: pb.PropertyOrder_ASCENDING, + descending: pb.PropertyOrder_DESCENDING, +} + +// order is a sort order on query results. +type order struct { + FieldName string + Direction sortDirection +} + +// NewQuery creates a new Query for a specific entity kind. +// +// An empty kind means to return all entities, including entities created and +// managed by other App Engine features, and is called a kindless query. +// Kindless queries cannot include filters or sort orders on property values. +func NewQuery(kind string) *Query { + return &Query{ + kind: kind, + limit: -1, + } +} + +// Query represents a datastore query. +type Query struct { + kind string + ancestor *Key + filter []filter + order []order + projection []string + + distinct bool + distinctOn []string + keysOnly bool + eventual bool + limit int32 + offset int32 + start []byte + end []byte + + namespace string + + trans *Transaction + + err error +} + +func (q *Query) clone() *Query { + x := *q + // Copy the contents of the slice-typed fields to a new backing store. + if len(q.filter) > 0 { + x.filter = make([]filter, len(q.filter)) + copy(x.filter, q.filter) + } + if len(q.order) > 0 { + x.order = make([]order, len(q.order)) + copy(x.order, q.order) + } + return &x +} + +// Ancestor returns a derivative query with an ancestor filter. +// The ancestor should not be nil. +func (q *Query) Ancestor(ancestor *Key) *Query { + q = q.clone() + if ancestor == nil { + q.err = errors.New("datastore: nil query ancestor") + return q + } + q.ancestor = ancestor + return q +} + +// EventualConsistency returns a derivative query that returns eventually +// consistent results. +// It only has an effect on ancestor queries. +func (q *Query) EventualConsistency() *Query { + q = q.clone() + q.eventual = true + return q +} + +// Namespace returns a derivative query that is associated with the given +// namespace. +// +// A namespace may be used to partition data for multi-tenant applications. +// For details, see https://cloud.google.com/datastore/docs/concepts/multitenancy. +func (q *Query) Namespace(ns string) *Query { + q = q.clone() + q.namespace = ns + return q +} + +// Transaction returns a derivative query that is associated with the given +// transaction. +// +// All reads performed as part of the transaction will come from a single +// consistent snapshot. Furthermore, if the transaction is set to a +// serializable isolation level, another transaction cannot concurrently modify +// the data that is read or modified by this transaction. +func (q *Query) Transaction(t *Transaction) *Query { + q = q.clone() + q.trans = t + return q +} + +// Filter returns a derivative query with a field-based filter. +// The filterStr argument must be a field name followed by optional space, +// followed by an operator, one of ">", "<", ">=", "<=", or "=". +// Fields are compared against the provided value using the operator. +// Multiple filters are AND'ed together. +// Field names which contain spaces, quote marks, or operator characters +// should be passed as quoted Go string literals as returned by strconv.Quote +// or the fmt package's %q verb. +func (q *Query) Filter(filterStr string, value interface{}) *Query { + q = q.clone() + filterStr = strings.TrimSpace(filterStr) + if filterStr == "" { + q.err = fmt.Errorf("datastore: invalid filter %q", filterStr) + return q + } + f := filter{ + FieldName: strings.TrimRight(filterStr, " ><=!"), + Value: value, + } + switch op := strings.TrimSpace(filterStr[len(f.FieldName):]); op { + case "<=": + f.Op = lessEq + case ">=": + f.Op = greaterEq + case "<": + f.Op = lessThan + case ">": + f.Op = greaterThan + case "=": + f.Op = equal + default: + q.err = fmt.Errorf("datastore: invalid operator %q in filter %q", op, filterStr) + return q + } + var err error + f.FieldName, err = unquote(f.FieldName) + if err != nil { + q.err = fmt.Errorf("datastore: invalid syntax for quoted field name %q", f.FieldName) + return q + } + q.filter = append(q.filter, f) + return q +} + +// Order returns a derivative query with a field-based sort order. Orders are +// applied in the order they are added. The default order is ascending; to sort +// in descending order prefix the fieldName with a minus sign (-). +// Field names which contain spaces, quote marks, or the minus sign +// should be passed as quoted Go string literals as returned by strconv.Quote +// or the fmt package's %q verb. +func (q *Query) Order(fieldName string) *Query { + q = q.clone() + fieldName, dir := strings.TrimSpace(fieldName), ascending + if strings.HasPrefix(fieldName, "-") { + fieldName, dir = strings.TrimSpace(fieldName[1:]), descending + } else if strings.HasPrefix(fieldName, "+") { + q.err = fmt.Errorf("datastore: invalid order: %q", fieldName) + return q + } + fieldName, err := unquote(fieldName) + if err != nil { + q.err = fmt.Errorf("datastore: invalid syntax for quoted field name %q", fieldName) + return q + } + if fieldName == "" { + q.err = errors.New("datastore: empty order") + return q + } + q.order = append(q.order, order{ + Direction: dir, + FieldName: fieldName, + }) + return q +} + +// unquote optionally interprets s as a double-quoted or backquoted Go +// string literal if it begins with the relevant character. +func unquote(s string) (string, error) { + if s == "" || (s[0] != '`' && s[0] != '"') { + return s, nil + } + return strconv.Unquote(s) +} + +// Project returns a derivative query that yields only the given fields. It +// cannot be used with KeysOnly. +func (q *Query) Project(fieldNames ...string) *Query { + q = q.clone() + q.projection = append([]string(nil), fieldNames...) + return q +} + +// Distinct returns a derivative query that yields de-duplicated entities with +// respect to the set of projected fields. It is only used for projection +// queries. Distinct cannot be used with DistinctOn. +func (q *Query) Distinct() *Query { + q = q.clone() + q.distinct = true + return q +} + +// DistinctOn returns a derivative query that yields de-duplicated entities with +// respect to the set of the specified fields. It is only used for projection +// queries. The field list should be a subset of the projected field list. +// DistinctOn cannot be used with Distinct. +func (q *Query) DistinctOn(fieldNames ...string) *Query { + q = q.clone() + q.distinctOn = fieldNames + return q +} + +// KeysOnly returns a derivative query that yields only keys, not keys and +// entities. It cannot be used with projection queries. +func (q *Query) KeysOnly() *Query { + q = q.clone() + q.keysOnly = true + return q +} + +// Limit returns a derivative query that has a limit on the number of results +// returned. A negative value means unlimited. +func (q *Query) Limit(limit int) *Query { + q = q.clone() + if limit < math.MinInt32 || limit > math.MaxInt32 { + q.err = errors.New("datastore: query limit overflow") + return q + } + q.limit = int32(limit) + return q +} + +// Offset returns a derivative query that has an offset of how many keys to +// skip over before returning results. A negative value is invalid. +func (q *Query) Offset(offset int) *Query { + q = q.clone() + if offset < 0 { + q.err = errors.New("datastore: negative query offset") + return q + } + if offset > math.MaxInt32 { + q.err = errors.New("datastore: query offset overflow") + return q + } + q.offset = int32(offset) + return q +} + +// Start returns a derivative query with the given start point. +func (q *Query) Start(c Cursor) *Query { + q = q.clone() + q.start = c.cc + return q +} + +// End returns a derivative query with the given end point. +func (q *Query) End(c Cursor) *Query { + q = q.clone() + q.end = c.cc + return q +} + +// toProto converts the query to a protocol buffer. +func (q *Query) toProto(req *pb.RunQueryRequest) error { + if len(q.projection) != 0 && q.keysOnly { + return errors.New("datastore: query cannot both project and be keys-only") + } + if len(q.distinctOn) != 0 && q.distinct { + return errors.New("datastore: query cannot be both distinct and distinct-on") + } + dst := &pb.Query{} + if q.kind != "" { + dst.Kind = []*pb.KindExpression{{Name: q.kind}} + } + if q.projection != nil { + for _, propertyName := range q.projection { + dst.Projection = append(dst.Projection, &pb.Projection{Property: &pb.PropertyReference{Name: propertyName}}) + } + + for _, propertyName := range q.distinctOn { + dst.DistinctOn = append(dst.DistinctOn, &pb.PropertyReference{Name: propertyName}) + } + + if q.distinct { + for _, propertyName := range q.projection { + dst.DistinctOn = append(dst.DistinctOn, &pb.PropertyReference{Name: propertyName}) + } + } + } + if q.keysOnly { + dst.Projection = []*pb.Projection{{Property: &pb.PropertyReference{Name: keyFieldName}}} + } + + var filters []*pb.Filter + for _, qf := range q.filter { + if qf.FieldName == "" { + return errors.New("datastore: empty query filter field name") + } + v, err := interfaceToProto(reflect.ValueOf(qf.Value).Interface(), false) + if err != nil { + return fmt.Errorf("datastore: bad query filter value type: %v", err) + } + op, ok := operatorToProto[qf.Op] + if !ok { + return errors.New("datastore: unknown query filter operator") + } + xf := &pb.PropertyFilter{ + Op: op, + Property: &pb.PropertyReference{Name: qf.FieldName}, + Value: v, + } + filters = append(filters, &pb.Filter{ + FilterType: &pb.Filter_PropertyFilter{PropertyFilter: xf}, + }) + } + + if q.ancestor != nil { + filters = append(filters, &pb.Filter{ + FilterType: &pb.Filter_PropertyFilter{PropertyFilter: &pb.PropertyFilter{ + Property: &pb.PropertyReference{Name: keyFieldName}, + Op: pb.PropertyFilter_HAS_ANCESTOR, + Value: &pb.Value{ValueType: &pb.Value_KeyValue{KeyValue: keyToProto(q.ancestor)}}, + }}}) + } + + if len(filters) == 1 { + dst.Filter = filters[0] + } else if len(filters) > 1 { + dst.Filter = &pb.Filter{FilterType: &pb.Filter_CompositeFilter{CompositeFilter: &pb.CompositeFilter{ + Op: pb.CompositeFilter_AND, + Filters: filters, + }}} + } + + for _, qo := range q.order { + if qo.FieldName == "" { + return errors.New("datastore: empty query order field name") + } + xo := &pb.PropertyOrder{ + Property: &pb.PropertyReference{Name: qo.FieldName}, + Direction: sortDirectionToProto[qo.Direction], + } + dst.Order = append(dst.Order, xo) + } + if q.limit >= 0 { + dst.Limit = &wrapperspb.Int32Value{Value: q.limit} + } + dst.Offset = q.offset + dst.StartCursor = q.start + dst.EndCursor = q.end + + if t := q.trans; t != nil { + if t.id == nil { + return errExpiredTransaction + } + if q.eventual { + return errors.New("datastore: cannot use EventualConsistency query in a transaction") + } + req.ReadOptions = &pb.ReadOptions{ + ConsistencyType: &pb.ReadOptions_Transaction{Transaction: t.id}, + } + } + + if q.eventual { + req.ReadOptions = &pb.ReadOptions{ConsistencyType: &pb.ReadOptions_ReadConsistency_{ReadConsistency: pb.ReadOptions_EVENTUAL}} + } + + req.QueryType = &pb.RunQueryRequest_Query{Query: dst} + return nil +} + +// Count returns the number of results for the given query. +// +// The running time and number of API calls made by Count scale linearly with +// the sum of the query's offset and limit. Unless the result count is +// expected to be small, it is best to specify a limit; otherwise Count will +// continue until it finishes counting or the provided context expires. +func (c *Client) Count(ctx context.Context, q *Query) (n int, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.Query.Count") + defer func() { trace.EndSpan(ctx, err) }() + + // Check that the query is well-formed. + if q.err != nil { + return 0, q.err + } + + // Create a copy of the query, with keysOnly true (if we're not a projection, + // since the two are incompatible). + newQ := q.clone() + newQ.keysOnly = len(newQ.projection) == 0 + + // Create an iterator and use it to walk through the batches of results + // directly. + it := c.Run(ctx, newQ) + for { + err := it.nextBatch() + if err == iterator.Done { + return n, nil + } + if err != nil { + return 0, err + } + n += len(it.results) + } +} + +// GetAll runs the provided query in the given context and returns all keys +// that match that query, as well as appending the values to dst. +// +// dst must have type *[]S or *[]*S or *[]P, for some struct type S or some non- +// interface, non-pointer type P such that P or *P implements PropertyLoadSaver. +// +// As a special case, *PropertyList is an invalid type for dst, even though a +// PropertyList is a slice of structs. It is treated as invalid to avoid being +// mistakenly passed when *[]PropertyList was intended. +// +// The keys returned by GetAll will be in a 1-1 correspondence with the entities +// added to dst. +// +// If q is a ``keys-only'' query, GetAll ignores dst and only returns the keys. +// +// The running time and number of API calls made by GetAll scale linearly with +// with the sum of the query's offset and limit. Unless the result count is +// expected to be small, it is best to specify a limit; otherwise GetAll will +// continue until it finishes collecting results or the provided context +// expires. +func (c *Client) GetAll(ctx context.Context, q *Query, dst interface{}) (keys []*Key, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.Query.GetAll") + defer func() { trace.EndSpan(ctx, err) }() + + var ( + dv reflect.Value + mat multiArgType + elemType reflect.Type + errFieldMismatch error + ) + if !q.keysOnly { + dv = reflect.ValueOf(dst) + if dv.Kind() != reflect.Ptr || dv.IsNil() { + return nil, ErrInvalidEntityType + } + dv = dv.Elem() + mat, elemType = checkMultiArg(dv) + if mat == multiArgTypeInvalid || mat == multiArgTypeInterface { + return nil, ErrInvalidEntityType + } + } + + for t := c.Run(ctx, q); ; { + k, e, err := t.next() + if err == iterator.Done { + break + } + if err != nil { + return keys, err + } + if !q.keysOnly { + ev := reflect.New(elemType) + if elemType.Kind() == reflect.Map { + // This is a special case. The zero values of a map type are + // not immediately useful; they have to be make'd. + // + // Funcs and channels are similar, in that a zero value is not useful, + // but even a freshly make'd channel isn't useful: there's no fixed + // channel buffer size that is always going to be large enough, and + // there's no goroutine to drain the other end. Theoretically, these + // types could be supported, for example by sniffing for a constructor + // method or requiring prior registration, but for now it's not a + // frequent enough concern to be worth it. Programmers can work around + // it by explicitly using Iterator.Next instead of the Query.GetAll + // convenience method. + x := reflect.MakeMap(elemType) + ev.Elem().Set(x) + } + if err = loadEntityProto(ev.Interface(), e); err != nil { + if _, ok := err.(*ErrFieldMismatch); ok { + // We continue loading entities even in the face of field mismatch errors. + // If we encounter any other error, that other error is returned. Otherwise, + // an ErrFieldMismatch is returned. + errFieldMismatch = err + } else { + return keys, err + } + } + if mat != multiArgTypeStructPtr { + ev = ev.Elem() + } + dv.Set(reflect.Append(dv, ev)) + } + keys = append(keys, k) + } + return keys, errFieldMismatch +} + +// Run runs the given query in the given context. +func (c *Client) Run(ctx context.Context, q *Query) *Iterator { + if q.err != nil { + return &Iterator{err: q.err} + } + t := &Iterator{ + ctx: ctx, + client: c, + limit: q.limit, + offset: q.offset, + keysOnly: q.keysOnly, + pageCursor: q.start, + entityCursor: q.start, + req: &pb.RunQueryRequest{ + ProjectId: c.dataset, + }, + } + + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.Query.Run") + defer func() { trace.EndSpan(ctx, t.err) }() + if q.namespace != "" { + t.req.PartitionId = &pb.PartitionId{ + NamespaceId: q.namespace, + } + } + + if err := q.toProto(t.req); err != nil { + t.err = err + } + return t +} + +// Iterator is the result of running a query. +type Iterator struct { + ctx context.Context + client *Client + err error + + // results is the list of EntityResults still to be iterated over from the + // most recent API call. It will be nil if no requests have yet been issued. + results []*pb.EntityResult + // req is the request to send. It may be modified and used multiple times. + req *pb.RunQueryRequest + + // limit is the limit on the number of results this iterator should return. + // The zero value is used to prevent further fetches from the server. + // A negative value means unlimited. + limit int32 + // offset is the number of results that still need to be skipped. + offset int32 + // keysOnly records whether the query was keys-only (skip entity loading). + keysOnly bool + + // pageCursor is the compiled cursor for the next batch/page of result. + // TODO(djd): Can we delete this in favour of paging with the last + // entityCursor from each batch? + pageCursor []byte + // entityCursor is the compiled cursor of the next result. + entityCursor []byte +} + +// Next returns the key of the next result. When there are no more results, +// iterator.Done is returned as the error. +// +// If the query is not keys only and dst is non-nil, it also loads the entity +// stored for that key into the struct pointer or PropertyLoadSaver dst, with +// the same semantics and possible errors as for the Get function. +func (t *Iterator) Next(dst interface{}) (k *Key, err error) { + k, e, err := t.next() + if err != nil { + return nil, err + } + if dst != nil && !t.keysOnly { + err = loadEntityProto(dst, e) + } + return k, err +} + +func (t *Iterator) next() (*Key, *pb.Entity, error) { + // Fetch additional batches while there are no more results. + for t.err == nil && len(t.results) == 0 { + t.err = t.nextBatch() + } + if t.err != nil { + return nil, nil, t.err + } + + // Extract the next result, update cursors, and parse the entity's key. + e := t.results[0] + t.results = t.results[1:] + t.entityCursor = e.Cursor + if len(t.results) == 0 { + t.entityCursor = t.pageCursor // At the end of the batch. + } + if e.Entity.Key == nil { + return nil, nil, errors.New("datastore: internal error: server did not return a key") + } + k, err := protoToKey(e.Entity.Key) + if err != nil || k.Incomplete() { + return nil, nil, errors.New("datastore: internal error: server returned an invalid key") + } + + return k, e.Entity, nil +} + +// nextBatch makes a single call to the server for a batch of results. +func (t *Iterator) nextBatch() error { + if t.limit == 0 { + return iterator.Done // Short-circuits the zero-item response. + } + + // Adjust the query with the latest start cursor, limit and offset. + q := t.req.GetQuery() + q.StartCursor = t.pageCursor + q.Offset = t.offset + if t.limit >= 0 { + q.Limit = &wrapperspb.Int32Value{Value: t.limit} + } else { + q.Limit = nil + } + + // Run the query. + resp, err := t.client.client.RunQuery(t.ctx, t.req) + if err != nil { + return err + } + + // Adjust any offset from skipped results. + skip := resp.Batch.SkippedResults + if skip < 0 { + return errors.New("datastore: internal error: negative number of skipped_results") + } + t.offset -= skip + if t.offset < 0 { + return errors.New("datastore: internal error: query skipped too many results") + } + if t.offset > 0 && len(resp.Batch.EntityResults) > 0 { + return errors.New("datastore: internal error: query returned results before requested offset") + } + + // Adjust the limit. + if t.limit >= 0 { + t.limit -= int32(len(resp.Batch.EntityResults)) + if t.limit < 0 { + return errors.New("datastore: internal error: query returned more results than the limit") + } + } + + // If there are no more results available, set limit to zero to prevent + // further fetches. Otherwise, check that there is a next page cursor available. + if resp.Batch.MoreResults != pb.QueryResultBatch_NOT_FINISHED { + t.limit = 0 + } else if resp.Batch.EndCursor == nil { + return errors.New("datastore: internal error: server did not return a cursor") + } + + // Update cursors. + // If any results were skipped, use the SkippedCursor as the next entity cursor. + if skip > 0 { + t.entityCursor = resp.Batch.SkippedCursor + } else { + t.entityCursor = q.StartCursor + } + t.pageCursor = resp.Batch.EndCursor + + t.results = resp.Batch.EntityResults + return nil +} + +// Cursor returns a cursor for the iterator's current location. +func (t *Iterator) Cursor() (c Cursor, err error) { + t.ctx = trace.StartSpan(t.ctx, "cloud.google.com/go/datastore.Query.Cursor") + defer func() { trace.EndSpan(t.ctx, err) }() + + // If there is still an offset, we need to the skip those results first. + for t.err == nil && t.offset > 0 { + t.err = t.nextBatch() + } + + if t.err != nil && t.err != iterator.Done { + return Cursor{}, t.err + } + + return Cursor{t.entityCursor}, nil +} + +// Cursor is an iterator's position. It can be converted to and from an opaque +// string. A cursor can be used from different HTTP requests, but only with a +// query with the same kind, ancestor, filter and order constraints. +// +// The zero Cursor can be used to indicate that there is no start and/or end +// constraint for a query. +type Cursor struct { + cc []byte +} + +// String returns a base-64 string representation of a cursor. +func (c Cursor) String() string { + if c.cc == nil { + return "" + } + + return strings.TrimRight(base64.URLEncoding.EncodeToString(c.cc), "=") +} + +// DecodeCursor decodes a cursor from its base-64 string representation. +func DecodeCursor(s string) (Cursor, error) { + if s == "" { + return Cursor{}, nil + } + if n := len(s) % 4; n != 0 { + s += strings.Repeat("=", 4-n) + } + b, err := base64.URLEncoding.DecodeString(s) + if err != nil { + return Cursor{}, err + } + return Cursor{b}, nil +} diff --git a/vendor/cloud.google.com/go/datastore/query_test.go b/vendor/cloud.google.com/go/datastore/query_test.go new file mode 100644 index 000000000..180606524 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/query_test.go @@ -0,0 +1,547 @@ +// 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 datastore + +import ( + "context" + "errors" + "fmt" + "reflect" + "sort" + "testing" + + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/proto" + "github.com/google/go-cmp/cmp" + pb "google.golang.org/genproto/googleapis/datastore/v1" + "google.golang.org/grpc" +) + +var ( + key1 = &pb.Key{ + Path: []*pb.Key_PathElement{ + { + Kind: "Gopher", + IdType: &pb.Key_PathElement_Id{Id: 6}, + }, + }, + } + key2 = &pb.Key{ + Path: []*pb.Key_PathElement{ + { + Kind: "Gopher", + IdType: &pb.Key_PathElement_Id{Id: 6}, + }, + { + Kind: "Gopher", + IdType: &pb.Key_PathElement_Id{Id: 8}, + }, + }, + } +) + +type fakeClient struct { + pb.DatastoreClient + queryFn func(*pb.RunQueryRequest) (*pb.RunQueryResponse, error) + commitFn func(*pb.CommitRequest) (*pb.CommitResponse, error) +} + +func (c *fakeClient) RunQuery(_ context.Context, req *pb.RunQueryRequest, _ ...grpc.CallOption) (*pb.RunQueryResponse, error) { + return c.queryFn(req) +} + +func (c *fakeClient) Commit(_ context.Context, req *pb.CommitRequest, _ ...grpc.CallOption) (*pb.CommitResponse, error) { + return c.commitFn(req) +} + +func fakeRunQuery(in *pb.RunQueryRequest) (*pb.RunQueryResponse, error) { + expectedIn := &pb.RunQueryRequest{ + QueryType: &pb.RunQueryRequest_Query{Query: &pb.Query{ + Kind: []*pb.KindExpression{{Name: "Gopher"}}, + }}, + } + if !proto.Equal(in, expectedIn) { + return nil, fmt.Errorf("unsupported argument: got %v want %v", in, expectedIn) + } + return &pb.RunQueryResponse{ + Batch: &pb.QueryResultBatch{ + MoreResults: pb.QueryResultBatch_NO_MORE_RESULTS, + EntityResultType: pb.EntityResult_FULL, + EntityResults: []*pb.EntityResult{ + { + Entity: &pb.Entity{ + Key: key1, + Properties: map[string]*pb.Value{ + "Name": {ValueType: &pb.Value_StringValue{StringValue: "George"}}, + "Height": {ValueType: &pb.Value_IntegerValue{IntegerValue: 32}}, + }, + }, + }, + { + Entity: &pb.Entity{ + Key: key2, + Properties: map[string]*pb.Value{ + "Name": {ValueType: &pb.Value_StringValue{StringValue: "Rufus"}}, + // No height for Rufus. + }, + }, + }, + }, + }, + }, nil +} + +type StructThatImplementsPLS struct{} + +func (StructThatImplementsPLS) Load(p []Property) error { return nil } +func (StructThatImplementsPLS) Save() ([]Property, error) { return nil, nil } + +var _ PropertyLoadSaver = StructThatImplementsPLS{} + +type StructPtrThatImplementsPLS struct{} + +func (*StructPtrThatImplementsPLS) Load(p []Property) error { return nil } +func (*StructPtrThatImplementsPLS) Save() ([]Property, error) { return nil, nil } + +var _ PropertyLoadSaver = &StructPtrThatImplementsPLS{} + +type PropertyMap map[string]Property + +func (m PropertyMap) Load(props []Property) error { + for _, p := range props { + m[p.Name] = p + } + return nil +} + +func (m PropertyMap) Save() ([]Property, error) { + props := make([]Property, 0, len(m)) + for _, p := range m { + props = append(props, p) + } + return props, nil +} + +var _ PropertyLoadSaver = PropertyMap{} + +type Gopher struct { + Name string + Height int +} + +// typeOfEmptyInterface is the type of interface{}, but we can't use +// reflect.TypeOf((interface{})(nil)) directly because TypeOf takes an +// interface{}. +var typeOfEmptyInterface = reflect.TypeOf((*interface{})(nil)).Elem() + +func TestCheckMultiArg(t *testing.T) { + testCases := []struct { + v interface{} + mat multiArgType + elemType reflect.Type + }{ + // Invalid cases. + {nil, multiArgTypeInvalid, nil}, + {Gopher{}, multiArgTypeInvalid, nil}, + {&Gopher{}, multiArgTypeInvalid, nil}, + {PropertyList{}, multiArgTypeInvalid, nil}, // This is a special case. + {PropertyMap{}, multiArgTypeInvalid, nil}, + {[]*PropertyList(nil), multiArgTypeInvalid, nil}, + {[]*PropertyMap(nil), multiArgTypeInvalid, nil}, + {[]**Gopher(nil), multiArgTypeInvalid, nil}, + {[]*interface{}(nil), multiArgTypeInvalid, nil}, + // Valid cases. + { + []PropertyList(nil), + multiArgTypePropertyLoadSaver, + reflect.TypeOf(PropertyList{}), + }, + { + []PropertyMap(nil), + multiArgTypePropertyLoadSaver, + reflect.TypeOf(PropertyMap{}), + }, + { + []StructThatImplementsPLS(nil), + multiArgTypePropertyLoadSaver, + reflect.TypeOf(StructThatImplementsPLS{}), + }, + { + []StructPtrThatImplementsPLS(nil), + multiArgTypePropertyLoadSaver, + reflect.TypeOf(StructPtrThatImplementsPLS{}), + }, + { + []Gopher(nil), + multiArgTypeStruct, + reflect.TypeOf(Gopher{}), + }, + { + []*Gopher(nil), + multiArgTypeStructPtr, + reflect.TypeOf(Gopher{}), + }, + { + []interface{}(nil), + multiArgTypeInterface, + typeOfEmptyInterface, + }, + } + for _, tc := range testCases { + mat, elemType := checkMultiArg(reflect.ValueOf(tc.v)) + if mat != tc.mat || elemType != tc.elemType { + t.Errorf("checkMultiArg(%T): got %v, %v want %v, %v", + tc.v, mat, elemType, tc.mat, tc.elemType) + } + } +} + +func TestSimpleQuery(t *testing.T) { + struct1 := Gopher{Name: "George", Height: 32} + struct2 := Gopher{Name: "Rufus"} + pList1 := PropertyList{ + { + Name: "Height", + Value: int64(32), + }, + { + Name: "Name", + Value: "George", + }, + } + pList2 := PropertyList{ + { + Name: "Name", + Value: "Rufus", + }, + } + pMap1 := PropertyMap{ + "Name": Property{ + Name: "Name", + Value: "George", + }, + "Height": Property{ + Name: "Height", + Value: int64(32), + }, + } + pMap2 := PropertyMap{ + "Name": Property{ + Name: "Name", + Value: "Rufus", + }, + } + + testCases := []struct { + dst interface{} + want interface{} + }{ + // The destination must have type *[]P, *[]S or *[]*S, for some non-interface + // type P such that *P implements PropertyLoadSaver, or for some struct type S. + {new([]Gopher), &[]Gopher{struct1, struct2}}, + {new([]*Gopher), &[]*Gopher{&struct1, &struct2}}, + {new([]PropertyList), &[]PropertyList{pList1, pList2}}, + {new([]PropertyMap), &[]PropertyMap{pMap1, pMap2}}, + + // Any other destination type is invalid. + {0, nil}, + {Gopher{}, nil}, + {PropertyList{}, nil}, + {PropertyMap{}, nil}, + {[]int{}, nil}, + {[]Gopher{}, nil}, + {[]PropertyList{}, nil}, + {new(int), nil}, + {new(Gopher), nil}, + {new(PropertyList), nil}, // This is a special case. + {new(PropertyMap), nil}, + {new([]int), nil}, + {new([]map[int]int), nil}, + {new([]map[string]Property), nil}, + {new([]map[string]interface{}), nil}, + {new([]*int), nil}, + {new([]*map[int]int), nil}, + {new([]*map[string]Property), nil}, + {new([]*map[string]interface{}), nil}, + {new([]**Gopher), nil}, + {new([]*PropertyList), nil}, + {new([]*PropertyMap), nil}, + } + for _, tc := range testCases { + nCall := 0 + client := &Client{ + client: &fakeClient{ + queryFn: func(req *pb.RunQueryRequest) (*pb.RunQueryResponse, error) { + nCall++ + return fakeRunQuery(req) + }, + }, + } + ctx := context.Background() + + var ( + expectedErr error + expectedNCall int + ) + if tc.want == nil { + expectedErr = ErrInvalidEntityType + } else { + expectedNCall = 1 + } + keys, err := client.GetAll(ctx, NewQuery("Gopher"), tc.dst) + if err != expectedErr { + t.Errorf("dst type %T: got error %v, want %v", tc.dst, err, expectedErr) + continue + } + if nCall != expectedNCall { + t.Errorf("dst type %T: Context.Call was called an incorrect number of times: got %d want %d", tc.dst, nCall, expectedNCall) + continue + } + if err != nil { + continue + } + + key1 := IDKey("Gopher", 6, nil) + expectedKeys := []*Key{ + key1, + IDKey("Gopher", 8, key1), + } + if l1, l2 := len(keys), len(expectedKeys); l1 != l2 { + t.Errorf("dst type %T: got %d keys, want %d keys", tc.dst, l1, l2) + continue + } + for i, key := range keys { + if !keysEqual(key, expectedKeys[i]) { + t.Errorf("dst type %T: got key #%d %v, want %v", tc.dst, i, key, expectedKeys[i]) + continue + } + } + + // Make sure we sort any PropertyList items (the order is not deterministic). + if pLists, ok := tc.dst.(*[]PropertyList); ok { + for _, p := range *pLists { + sort.Sort(byName(p)) + } + } + + if !testutil.Equal(tc.dst, tc.want) { + t.Errorf("dst type %T: Entities\ngot %+v\nwant %+v", tc.dst, tc.dst, tc.want) + continue + } + } +} + +// keysEqual is like (*Key).Equal, but ignores the App ID. +func keysEqual(a, b *Key) bool { + for a != nil && b != nil { + if a.Kind != b.Kind || a.Name != b.Name || a.ID != b.ID { + return false + } + a, b = a.Parent, b.Parent + } + return a == b +} + +func TestQueriesAreImmutable(t *testing.T) { + // Test that deriving q2 from q1 does not modify q1. + q0 := NewQuery("foo") + q1 := NewQuery("foo") + q2 := q1.Offset(2) + if !testutil.Equal(q0, q1, cmp.AllowUnexported(Query{})) { + t.Errorf("q0 and q1 were not equal") + } + if testutil.Equal(q1, q2, cmp.AllowUnexported(Query{})) { + t.Errorf("q1 and q2 were equal") + } + + // Test that deriving from q4 twice does not conflict, even though + // q4 has a long list of order clauses. This tests that the arrays + // backed by a query's slice of orders are not shared. + f := func() *Query { + q := NewQuery("bar") + // 47 is an ugly number that is unlikely to be near a re-allocation + // point in repeated append calls. For example, it's not near a power + // of 2 or a multiple of 10. + for i := 0; i < 47; i++ { + q = q.Order(fmt.Sprintf("x%d", i)) + } + return q + } + q3 := f().Order("y") + q4 := f() + q5 := q4.Order("y") + q6 := q4.Order("z") + if !testutil.Equal(q3, q5, cmp.AllowUnexported(Query{})) { + t.Errorf("q3 and q5 were not equal") + } + if testutil.Equal(q5, q6, cmp.AllowUnexported(Query{})) { + t.Errorf("q5 and q6 were equal") + } +} + +func TestFilterParser(t *testing.T) { + testCases := []struct { + filterStr string + wantOK bool + wantFieldName string + wantOp operator + }{ + // Supported ops. + {"x<", true, "x", lessThan}, + {"x <", true, "x", lessThan}, + {"x <", true, "x", lessThan}, + {" x < ", true, "x", lessThan}, + {"x <=", true, "x", lessEq}, + {"x =", true, "x", equal}, + {"x >=", true, "x", greaterEq}, + {"x >", true, "x", greaterThan}, + {"in >", true, "in", greaterThan}, + {"in>", true, "in", greaterThan}, + // Valid but (currently) unsupported ops. + {"x!=", false, "", 0}, + {"x !=", false, "", 0}, + {" x != ", false, "", 0}, + {"x IN", false, "", 0}, + {"x in", false, "", 0}, + // Invalid ops. + {"x EQ", false, "", 0}, + {"x lt", false, "", 0}, + {"x <>", false, "", 0}, + {"x >>", false, "", 0}, + {"x ==", false, "", 0}, + {"x =<", false, "", 0}, + {"x =>", false, "", 0}, + {"x !", false, "", 0}, + {"x ", false, "", 0}, + {"x", false, "", 0}, + // Quoted and interesting field names. + {"x > y =", true, "x > y", equal}, + {"` x ` =", true, " x ", equal}, + {`" x " =`, true, " x ", equal}, + {`" \"x " =`, true, ` "x `, equal}, + {`" x =`, false, "", 0}, + {`" x ="`, false, "", 0}, + {"` x \" =", false, "", 0}, + } + for _, tc := range testCases { + q := NewQuery("foo").Filter(tc.filterStr, 42) + if ok := q.err == nil; ok != tc.wantOK { + t.Errorf("%q: ok=%t, want %t", tc.filterStr, ok, tc.wantOK) + continue + } + if !tc.wantOK { + continue + } + if len(q.filter) != 1 { + t.Errorf("%q: len=%d, want %d", tc.filterStr, len(q.filter), 1) + continue + } + got, want := q.filter[0], filter{tc.wantFieldName, tc.wantOp, 42} + if got != want { + t.Errorf("%q: got %v, want %v", tc.filterStr, got, want) + continue + } + } +} + +func TestNamespaceQuery(t *testing.T) { + gotNamespace := make(chan string, 1) + ctx := context.Background() + client := &Client{ + client: &fakeClient{ + queryFn: func(req *pb.RunQueryRequest) (*pb.RunQueryResponse, error) { + if part := req.PartitionId; part != nil { + gotNamespace <- part.NamespaceId + } else { + gotNamespace <- "" + } + return nil, errors.New("not implemented") + }, + }, + } + + var gs []Gopher + + // Ignore errors for the rest of this test. + client.GetAll(ctx, NewQuery("gopher"), &gs) + if got, want := <-gotNamespace, ""; got != want { + t.Errorf("GetAll: got namespace %q, want %q", got, want) + } + client.Count(ctx, NewQuery("gopher")) + if got, want := <-gotNamespace, ""; got != want { + t.Errorf("Count: got namespace %q, want %q", got, want) + } + + const ns = "not_default" + client.GetAll(ctx, NewQuery("gopher").Namespace(ns), &gs) + if got, want := <-gotNamespace, ns; got != want { + t.Errorf("GetAll: got namespace %q, want %q", got, want) + } + client.Count(ctx, NewQuery("gopher").Namespace(ns)) + if got, want := <-gotNamespace, ns; got != want { + t.Errorf("Count: got namespace %q, want %q", got, want) + } +} + +func TestReadOptions(t *testing.T) { + tid := []byte{1} + for _, test := range []struct { + q *Query + want *pb.ReadOptions + }{ + { + q: NewQuery(""), + want: nil, + }, + { + q: NewQuery("").Transaction(nil), + want: nil, + }, + { + q: NewQuery("").Transaction(&Transaction{id: tid}), + want: &pb.ReadOptions{ + ConsistencyType: &pb.ReadOptions_Transaction{ + Transaction: tid, + }, + }, + }, + { + q: NewQuery("").EventualConsistency(), + want: &pb.ReadOptions{ + ConsistencyType: &pb.ReadOptions_ReadConsistency_{ + ReadConsistency: pb.ReadOptions_EVENTUAL, + }, + }, + }, + } { + req := &pb.RunQueryRequest{} + if err := test.q.toProto(req); err != nil { + t.Fatalf("%+v: got %v, want no error", test.q, err) + } + if got := req.ReadOptions; !proto.Equal(got, test.want) { + t.Errorf("%+v:\ngot %+v\nwant %+v", test.q, got, test.want) + } + } + // Test errors. + for _, q := range []*Query{ + NewQuery("").Transaction(&Transaction{id: nil}), + NewQuery("").Transaction(&Transaction{id: tid}).EventualConsistency(), + } { + req := &pb.RunQueryRequest{} + if err := q.toProto(req); err == nil { + t.Errorf("%+v: got nil, wanted error", q) + } + } +} diff --git a/vendor/cloud.google.com/go/datastore/save.go b/vendor/cloud.google.com/go/datastore/save.go new file mode 100644 index 000000000..2a4446999 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/save.go @@ -0,0 +1,470 @@ +// 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 datastore + +import ( + "errors" + "fmt" + "reflect" + "time" + "unicode/utf8" + + timepb "github.com/golang/protobuf/ptypes/timestamp" + pb "google.golang.org/genproto/googleapis/datastore/v1" + llpb "google.golang.org/genproto/googleapis/type/latlng" +) + +type saveOpts struct { + noIndex bool + flatten bool + omitEmpty bool +} + +// saveEntity saves an EntityProto into a PropertyLoadSaver or struct pointer. +func saveEntity(key *Key, src interface{}) (*pb.Entity, error) { + var err error + var props []Property + if e, ok := src.(PropertyLoadSaver); ok { + props, err = e.Save() + } else { + props, err = SaveStruct(src) + } + if err != nil { + return nil, err + } + return propertiesToProto(key, props) +} + +// TODO(djd): Convert this and below to return ([]Property, error). +func saveStructProperty(props *[]Property, name string, opts saveOpts, v reflect.Value) error { + p := Property{ + Name: name, + NoIndex: opts.noIndex, + } + + if opts.omitEmpty && isEmptyValue(v) { + return nil + } + + // First check if field type implements PLS. If so, use PLS to + // save. + ok, err := plsFieldSave(props, p, name, opts, v) + if err != nil { + return err + } + if ok { + return nil + } + + switch x := v.Interface().(type) { + case *Key, time.Time, GeoPoint: + p.Value = x + default: + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + p.Value = v.Int() + case reflect.Bool: + p.Value = v.Bool() + case reflect.String: + p.Value = v.String() + case reflect.Float32, reflect.Float64: + p.Value = v.Float() + case reflect.Slice: + if v.Type().Elem().Kind() == reflect.Uint8 { + p.Value = v.Bytes() + } else { + return saveSliceProperty(props, name, opts, v) + } + case reflect.Ptr: + if isValidPointerType(v.Type().Elem()) { + if v.IsNil() { + // Nil pointer becomes a nil property value (unless omitempty, handled above). + p.Value = nil + *props = append(*props, p) + return nil + } + // When we recurse on the derefenced pointer, omitempty no longer applies: + // we already know the pointer is not empty, it doesn't matter if its referent + // is empty or not. + opts.omitEmpty = false + return saveStructProperty(props, name, opts, v.Elem()) + } + if v.Type().Elem().Kind() != reflect.Struct { + return fmt.Errorf("datastore: unsupported struct field type: %s", v.Type()) + } + // Pointer to struct is a special case. + if v.IsNil() { + return nil + } + v = v.Elem() + fallthrough + case reflect.Struct: + if !v.CanAddr() { + return fmt.Errorf("datastore: unsupported struct field: value is unaddressable") + } + vi := v.Addr().Interface() + + sub, err := newStructPLS(vi) + if err != nil { + return fmt.Errorf("datastore: unsupported struct field: %v", err) + } + + if opts.flatten { + return sub.save(props, opts, name+".") + } + + var subProps []Property + err = sub.save(&subProps, opts, "") + if err != nil { + return err + } + subKey, err := sub.key(v) + if err != nil { + return err + } + + p.Value = &Entity{ + Key: subKey, + Properties: subProps, + } + } + } + if p.Value == nil { + return fmt.Errorf("datastore: unsupported struct field type: %v", v.Type()) + } + *props = append(*props, p) + return nil +} + +// plsFieldSave first tries to converts v's value to a PLS, then v's addressed +// value to a PLS. If neither succeeds, plsFieldSave returns false for first return +// value. +// If v is successfully converted to a PLS, plsFieldSave will then add the +// Value to property p by way of the PLS's Save method, and append it to props. +// +// If the flatten option is present in opts, name must be prepended to each property's +// name before it is appended to props. Eg. if name were "A" and a subproperty's name +// were "B", the resultant name of the property to be appended to props would be "A.B". +func plsFieldSave(props *[]Property, p Property, name string, opts saveOpts, v reflect.Value) (ok bool, err error) { + vpls, err := plsForSave(v) + if err != nil { + return false, err + } + + if vpls == nil { + return false, nil + } + + subProps, err := vpls.Save() + if err != nil { + return true, err + } + + if opts.flatten { + for _, subp := range subProps { + subp.Name = name + "." + subp.Name + *props = append(*props, subp) + } + return true, nil + } + + p.Value = &Entity{Properties: subProps} + *props = append(*props, p) + + return true, nil +} + +// key extracts the *Key struct field from struct v based on the structCodec of s. +func (s structPLS) key(v reflect.Value) (*Key, error) { + if v.Kind() != reflect.Struct { + return nil, errors.New("datastore: cannot save key of non-struct type") + } + + keyField := s.codec.Match(keyFieldName) + + if keyField == nil { + return nil, nil + } + + f := v.FieldByIndex(keyField.Index) + k, ok := f.Interface().(*Key) + if !ok { + return nil, fmt.Errorf("datastore: %s field on struct %T is not a *datastore.Key", keyFieldName, v.Interface()) + } + + return k, nil +} + +func saveSliceProperty(props *[]Property, name string, opts saveOpts, v reflect.Value) error { + // Easy case: if the slice is empty, we're done. + if v.Len() == 0 { + return nil + } + // Work out the properties generated by the first element in the slice. This will + // usually be a single property, but will be more if this is a slice of structs. + var headProps []Property + if err := saveStructProperty(&headProps, name, opts, v.Index(0)); err != nil { + return err + } + + // Convert the first element's properties into slice properties, and + // keep track of the values in a map. + values := make(map[string][]interface{}, len(headProps)) + for _, p := range headProps { + values[p.Name] = append(make([]interface{}, 0, v.Len()), p.Value) + } + + // Find the elements for the subsequent elements. + for i := 1; i < v.Len(); i++ { + elemProps := make([]Property, 0, len(headProps)) + if err := saveStructProperty(&elemProps, name, opts, v.Index(i)); err != nil { + return err + } + for _, p := range elemProps { + v, ok := values[p.Name] + if !ok { + return fmt.Errorf("datastore: unexpected property %q in elem %d of slice", p.Name, i) + } + values[p.Name] = append(v, p.Value) + } + } + + // Convert to the final properties. + for _, p := range headProps { + p.Value = values[p.Name] + *props = append(*props, p) + } + return nil +} + +func (s structPLS) Save() ([]Property, error) { + var props []Property + if err := s.save(&props, saveOpts{}, ""); err != nil { + return nil, err + } + return props, nil +} + +func (s structPLS) save(props *[]Property, opts saveOpts, prefix string) error { + for _, f := range s.codec { + name := prefix + f.Name + v := getField(s.v, f.Index) + if !v.IsValid() || !v.CanSet() { + continue + } + + var tagOpts saveOpts + if f.ParsedTag != nil { + tagOpts = f.ParsedTag.(saveOpts) + } + + var opts1 saveOpts + opts1.noIndex = opts.noIndex || tagOpts.noIndex + opts1.flatten = opts.flatten || tagOpts.flatten + opts1.omitEmpty = tagOpts.omitEmpty // don't propagate + if err := saveStructProperty(props, name, opts1, v); err != nil { + return err + } + } + return nil +} + +// getField returns the field from v at the given index path. +// If it encounters a nil-valued field in the path, getField +// stops and returns a zero-valued reflect.Value, preventing the +// panic that would have been caused by reflect's FieldByIndex. +func getField(v reflect.Value, index []int) reflect.Value { + var zero reflect.Value + if v.Type().Kind() != reflect.Struct { + return zero + } + + for _, i := range index { + if v.Kind() == reflect.Ptr && v.Type().Elem().Kind() == reflect.Struct { + if v.IsNil() { + return zero + } + v = v.Elem() + } + v = v.Field(i) + } + return v +} + +func propertiesToProto(key *Key, props []Property) (*pb.Entity, error) { + e := &pb.Entity{ + Key: keyToProto(key), + Properties: map[string]*pb.Value{}, + } + indexedProps := 0 + for _, p := range props { + // Do not send a Key value a field to datastore. + if p.Name == keyFieldName { + continue + } + + val, err := interfaceToProto(p.Value, p.NoIndex) + if err != nil { + return nil, fmt.Errorf("datastore: %v for a Property with Name %q", err, p.Name) + } + if !p.NoIndex { + rVal := reflect.ValueOf(p.Value) + if rVal.Kind() == reflect.Slice && rVal.Type().Elem().Kind() != reflect.Uint8 { + indexedProps += rVal.Len() + } else { + indexedProps++ + } + } + if indexedProps > maxIndexedProperties { + return nil, errors.New("datastore: too many indexed properties") + } + + if _, ok := e.Properties[p.Name]; ok { + return nil, fmt.Errorf("datastore: duplicate Property with Name %q", p.Name) + } + e.Properties[p.Name] = val + } + return e, nil +} + +func interfaceToProto(iv interface{}, noIndex bool) (*pb.Value, error) { + val := &pb.Value{ExcludeFromIndexes: noIndex} + switch v := iv.(type) { + case int: + val.ValueType = &pb.Value_IntegerValue{IntegerValue: int64(v)} + case int32: + val.ValueType = &pb.Value_IntegerValue{IntegerValue: int64(v)} + case int64: + val.ValueType = &pb.Value_IntegerValue{IntegerValue: v} + case bool: + val.ValueType = &pb.Value_BooleanValue{BooleanValue: v} + case string: + if len(v) > 1500 && !noIndex { + return nil, errors.New("string property too long to index") + } + if !utf8.ValidString(v) { + return nil, fmt.Errorf("string is not valid utf8: %q", v) + } + val.ValueType = &pb.Value_StringValue{StringValue: v} + case float32: + val.ValueType = &pb.Value_DoubleValue{DoubleValue: float64(v)} + case float64: + val.ValueType = &pb.Value_DoubleValue{DoubleValue: v} + case *Key: + if v == nil { + val.ValueType = &pb.Value_NullValue{} + } else { + val.ValueType = &pb.Value_KeyValue{KeyValue: keyToProto(v)} + } + case GeoPoint: + if !v.Valid() { + return nil, errors.New("invalid GeoPoint value") + } + val.ValueType = &pb.Value_GeoPointValue{GeoPointValue: &llpb.LatLng{ + Latitude: v.Lat, + Longitude: v.Lng, + }} + case time.Time: + if v.Before(minTime) || v.After(maxTime) { + return nil, errors.New("time value out of range") + } + val.ValueType = &pb.Value_TimestampValue{TimestampValue: &timepb.Timestamp{ + Seconds: v.Unix(), + Nanos: int32(v.Nanosecond()), + }} + case []byte: + if len(v) > 1500 && !noIndex { + return nil, errors.New("[]byte property too long to index") + } + val.ValueType = &pb.Value_BlobValue{BlobValue: v} + case *Entity: + e, err := propertiesToProto(v.Key, v.Properties) + if err != nil { + return nil, err + } + val.ValueType = &pb.Value_EntityValue{EntityValue: e} + case []interface{}: + arr := make([]*pb.Value, 0, len(v)) + for i, v := range v { + elem, err := interfaceToProto(v, noIndex) + if err != nil { + return nil, fmt.Errorf("%v at index %d", err, i) + } + arr = append(arr, elem) + } + val.ValueType = &pb.Value_ArrayValue{ArrayValue: &pb.ArrayValue{Values: arr}} + // ArrayValues have ExcludeFromIndexes set on the individual items, rather + // than the top-level value. + val.ExcludeFromIndexes = false + default: + rv := reflect.ValueOf(iv) + if !rv.IsValid() { + val.ValueType = &pb.Value_NullValue{} + } else if rv.Kind() == reflect.Ptr { // non-nil pointer: dereference + if rv.IsNil() { + val.ValueType = &pb.Value_NullValue{} + return val, nil + } + return interfaceToProto(rv.Elem().Interface(), noIndex) + } else { + return nil, fmt.Errorf("invalid Value type %T", iv) + } + } + // TODO(jbd): Support EntityValue. + return val, nil +} + +// isEmptyValue is taken from the encoding/json package in the +// standard library. +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + case reflect.Struct: + if t, ok := v.Interface().(time.Time); ok { + return t.IsZero() + } + } + return false +} + +// isValidPointerType reports whether a struct field can be a pointer to type t +// for the purposes of saving and loading. +func isValidPointerType(t reflect.Type) bool { + if t == typeOfTime || t == typeOfGeoPoint { + return true + } + switch t.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return true + case reflect.Bool: + return true + case reflect.String: + return true + case reflect.Float32, reflect.Float64: + return true + } + return false +} diff --git a/vendor/cloud.google.com/go/datastore/save_test.go b/vendor/cloud.google.com/go/datastore/save_test.go new file mode 100644 index 000000000..36e9fb04b --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/save_test.go @@ -0,0 +1,289 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package datastore + +import ( + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + pb "google.golang.org/genproto/googleapis/datastore/v1" +) + +func TestInterfaceToProtoNil(t *testing.T) { + // A nil *Key, or a nil value of any other pointer type, should convert to a NullValue. + for _, in := range []interface{}{ + (*Key)(nil), + (*int)(nil), + (*string)(nil), + (*bool)(nil), + (*float64)(nil), + (*GeoPoint)(nil), + (*time.Time)(nil), + } { + got, err := interfaceToProto(in, false) + if err != nil { + t.Fatalf("%T: %v", in, err) + } + _, ok := got.ValueType.(*pb.Value_NullValue) + if !ok { + t.Errorf("%T: got: %T\nwant: %T", in, got.ValueType, &pb.Value_NullValue{}) + } + } +} + +func TestSaveEntityNested(t *testing.T) { + type WithKey struct { + X string + I int + K *Key `datastore:"__key__"` + } + + type NestedWithKey struct { + Y string + N WithKey + } + + type WithoutKey struct { + X string + I int + } + + type NestedWithoutKey struct { + Y string + N WithoutKey + } + + type a struct { + S string + } + + type UnexpAnonym struct { + a + } + + testCases := []struct { + desc string + src interface{} + key *Key + want *pb.Entity + }{ + { + desc: "nested entity with key", + src: &NestedWithKey{ + Y: "yyy", + N: WithKey{ + X: "two", + I: 2, + K: testKey1a, + }, + }, + key: testKey0, + want: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Y": {ValueType: &pb.Value_StringValue{StringValue: "yyy"}}, + "N": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Key: keyToProto(testKey1a), + Properties: map[string]*pb.Value{ + "X": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + }}, + }, + }, + }, + { + desc: "nested entity with incomplete key", + src: &NestedWithKey{ + Y: "yyy", + N: WithKey{ + X: "two", + I: 2, + K: incompleteKey, + }, + }, + key: testKey0, + want: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Y": {ValueType: &pb.Value_StringValue{StringValue: "yyy"}}, + "N": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Key: keyToProto(incompleteKey), + Properties: map[string]*pb.Value{ + "X": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + }}, + }, + }, + }, + { + desc: "nested entity without key", + src: &NestedWithoutKey{ + Y: "yyy", + N: WithoutKey{ + X: "two", + I: 2, + }, + }, + key: testKey0, + want: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "Y": {ValueType: &pb.Value_StringValue{StringValue: "yyy"}}, + "N": {ValueType: &pb.Value_EntityValue{ + EntityValue: &pb.Entity{ + Properties: map[string]*pb.Value{ + "X": {ValueType: &pb.Value_StringValue{StringValue: "two"}}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 2}}, + }, + }, + }}, + }, + }, + }, + { + desc: "key at top level", + src: &WithKey{ + X: "three", + I: 3, + K: testKey0, + }, + key: testKey0, + want: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "X": {ValueType: &pb.Value_StringValue{StringValue: "three"}}, + "I": {ValueType: &pb.Value_IntegerValue{IntegerValue: 3}}, + }, + }, + }, + { + desc: "nested unexported anonymous struct field", + src: &UnexpAnonym{ + a{S: "hello"}, + }, + key: testKey0, + want: &pb.Entity{ + Key: keyToProto(testKey0), + Properties: map[string]*pb.Value{ + "S": {ValueType: &pb.Value_StringValue{StringValue: "hello"}}, + }, + }, + }, + } + + for _, tc := range testCases { + got, err := saveEntity(tc.key, tc.src) + if err != nil { + t.Errorf("saveEntity: %s: %v", tc.desc, err) + continue + } + + if !testutil.Equal(tc.want, got) { + t.Errorf("%s: compare:\ngot: %#v\nwant: %#v", tc.desc, got, tc.want) + } + } +} + +func TestSavePointers(t *testing.T) { + for _, test := range []struct { + desc string + in interface{} + want []Property + }{ + { + desc: "nil pointers save as nil-valued properties", + in: &Pointers{}, + want: []Property{ + {Name: "Pi", Value: nil}, + {Name: "Ps", Value: nil}, + {Name: "Pb", Value: nil}, + {Name: "Pf", Value: nil}, + {Name: "Pg", Value: nil}, + {Name: "Pt", Value: nil}, + }, + }, + { + desc: "nil omitempty pointers not saved", + in: &PointersOmitEmpty{}, + want: []Property(nil), + }, + { + desc: "non-nil omitempty zero-valued pointers are saved", + in: func() *PointersOmitEmpty { pi := 0; return &PointersOmitEmpty{Pi: &pi} }(), + want: []Property{{Name: "Pi", Value: int64(0)}}, + }, + { + desc: "non-nil zero-valued pointers save as zero values", + in: populatedPointers(), + want: []Property{ + {Name: "Pi", Value: int64(0)}, + {Name: "Ps", Value: ""}, + {Name: "Pb", Value: false}, + {Name: "Pf", Value: 0.0}, + {Name: "Pg", Value: GeoPoint{}}, + {Name: "Pt", Value: time.Time{}}, + }, + }, + { + desc: "non-nil non-zero-valued pointers save as the appropriate values", + in: func() *Pointers { + p := populatedPointers() + *p.Pi = 1 + *p.Ps = "x" + *p.Pb = true + *p.Pf = 3.14 + *p.Pg = GeoPoint{Lat: 1, Lng: 2} + *p.Pt = time.Unix(100, 0) + return p + }(), + want: []Property{ + {Name: "Pi", Value: int64(1)}, + {Name: "Ps", Value: "x"}, + {Name: "Pb", Value: true}, + {Name: "Pf", Value: 3.14}, + {Name: "Pg", Value: GeoPoint{Lat: 1, Lng: 2}}, + {Name: "Pt", Value: time.Unix(100, 0)}, + }, + }, + } { + got, err := SaveStruct(test.in) + if err != nil { + t.Fatalf("%s: %v", test.desc, err) + } + if !testutil.Equal(got, test.want) { + t.Errorf("%s\ngot %#v\nwant %#v\n", test.desc, got, test.want) + } + } +} + +func TestSaveEmptySlice(t *testing.T) { + // Zero-length slice fields are not saved. + for _, slice := range [][]string{nil, {}} { + got, err := SaveStruct(&struct{ S []string }{S: slice}) + if err != nil { + t.Fatal(err) + } + if len(got) != 0 { + t.Errorf("%#v: got %d properties, wanted zero", slice, len(got)) + } + } +} diff --git a/vendor/cloud.google.com/go/datastore/testdata/index.yaml b/vendor/cloud.google.com/go/datastore/testdata/index.yaml new file mode 100644 index 000000000..47bc9de86 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/testdata/index.yaml @@ -0,0 +1,41 @@ +indexes: + +- kind: SQChild + ancestor: yes + properties: + - name: T + - name: I + +- kind: SQChild + ancestor: yes + properties: + - name: T + - name: I + direction: desc + +- kind: SQChild + ancestor: yes + properties: + - name: I + - name: T + - name: U + +- kind: SQChild + ancestor: yes + properties: + - name: I + - name: T + - name: U + +- kind: SQChild + ancestor: yes + properties: + - name: T + - name: J + +- kind: SQChild + ancestor: yes + properties: + - name: T + - name: J + - name: U \ No newline at end of file diff --git a/vendor/cloud.google.com/go/datastore/time.go b/vendor/cloud.google.com/go/datastore/time.go new file mode 100644 index 000000000..da6c780da --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/time.go @@ -0,0 +1,36 @@ +// 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 datastore + +import ( + "math" + "time" +) + +var ( + minTime = time.Unix(int64(math.MinInt64)/1e6, (int64(math.MinInt64)%1e6)*1e3) + maxTime = time.Unix(int64(math.MaxInt64)/1e6, (int64(math.MaxInt64)%1e6)*1e3) +) + +func toUnixMicro(t time.Time) int64 { + // We cannot use t.UnixNano() / 1e3 because we want to handle times more than + // 2^63 nanoseconds (which is about 292 years) away from 1970, and those cannot + // be represented in the numerator of a single int64 divide. + return t.Unix()*1e6 + int64(t.Nanosecond()/1e3) +} + +func fromUnixMicro(t int64) time.Time { + return time.Unix(t/1e6, (t%1e6)*1e3) +} diff --git a/vendor/cloud.google.com/go/datastore/time_test.go b/vendor/cloud.google.com/go/datastore/time_test.go new file mode 100644 index 000000000..f82efc7e5 --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/time_test.go @@ -0,0 +1,75 @@ +// 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 datastore + +import ( + "testing" + "time" +) + +func TestUnixMicro(t *testing.T) { + // Test that all these time.Time values survive a round trip to unix micros. + testCases := []time.Time{ + {}, + time.Date(2, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(23, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(234, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1000, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1600, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1700, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1800, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), + time.Unix(-1e6, -1000), + time.Unix(-1e6, 0), + time.Unix(-1e6, +1000), + time.Unix(-60, -1000), + time.Unix(-60, 0), + time.Unix(-60, +1000), + time.Unix(-1, -1000), + time.Unix(-1, 0), + time.Unix(-1, +1000), + time.Unix(0, -3000), + time.Unix(0, -2000), + time.Unix(0, -1000), + time.Unix(0, 0), + time.Unix(0, +1000), + time.Unix(0, +2000), + time.Unix(+60, -1000), + time.Unix(+60, 0), + time.Unix(+60, +1000), + time.Unix(+1e6, -1000), + time.Unix(+1e6, 0), + time.Unix(+1e6, +1000), + time.Date(1999, 12, 31, 23, 59, 59, 999000, time.UTC), + time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(2006, 1, 2, 15, 4, 5, 678000, time.UTC), + time.Date(2009, 11, 10, 23, 0, 0, 0, time.UTC), + time.Date(3456, 1, 1, 0, 0, 0, 0, time.UTC), + } + for _, tc := range testCases { + got := fromUnixMicro(toUnixMicro(tc)) + if !got.Equal(tc) { + t.Errorf("got %q, want %q", got, tc) + } + } + + // Test that a time.Time that isn't an integral number of microseconds + // is not perfectly reconstructed after a round trip. + t0 := time.Unix(0, 123) + t1 := fromUnixMicro(toUnixMicro(t0)) + if t1.Nanosecond()%1000 != 0 || t0.Nanosecond()%1000 == 0 { + t.Errorf("quantization to µs: got %q with %d ns, started with %d ns", t1, t1.Nanosecond(), t0.Nanosecond()) + } +} diff --git a/vendor/cloud.google.com/go/datastore/transaction.go b/vendor/cloud.google.com/go/datastore/transaction.go new file mode 100644 index 000000000..236f505da --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/transaction.go @@ -0,0 +1,408 @@ +// 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 datastore + +import ( + "context" + "errors" + + "cloud.google.com/go/internal/trace" + pb "google.golang.org/genproto/googleapis/datastore/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +// ErrConcurrentTransaction is returned when a transaction is rolled back due +// to a conflict with a concurrent transaction. +var ErrConcurrentTransaction = errors.New("datastore: concurrent transaction") + +var errExpiredTransaction = errors.New("datastore: transaction expired") + +type transactionSettings struct { + attempts int + readOnly bool + prevID []byte // ID of the transaction to retry +} + +// newTransactionSettings creates a transactionSettings with a given TransactionOption slice. +// Unconfigured options will be set to default values. +func newTransactionSettings(opts []TransactionOption) *transactionSettings { + s := &transactionSettings{attempts: 3} + for _, o := range opts { + o.apply(s) + } + return s +} + +// TransactionOption configures the way a transaction is executed. +type TransactionOption interface { + apply(*transactionSettings) +} + +// MaxAttempts returns a TransactionOption that overrides the default 3 attempt times. +func MaxAttempts(attempts int) TransactionOption { + return maxAttempts(attempts) +} + +type maxAttempts int + +func (w maxAttempts) apply(s *transactionSettings) { + if w > 0 { + s.attempts = int(w) + } +} + +// ReadOnly is a TransactionOption that marks the transaction as read-only. +var ReadOnly TransactionOption + +func init() { + ReadOnly = readOnly{} +} + +type readOnly struct{} + +func (readOnly) apply(s *transactionSettings) { + s.readOnly = true +} + +// Transaction represents a set of datastore operations to be committed atomically. +// +// Operations are enqueued by calling the Put and Delete methods on Transaction +// (or their Multi-equivalents). These operations are only committed when the +// Commit method is invoked. To ensure consistency, reads must be performed by +// using Transaction's Get method or by using the Transaction method when +// building a query. +// +// A Transaction must be committed or rolled back exactly once. +type Transaction struct { + id []byte + client *Client + ctx context.Context + mutations []*pb.Mutation // The mutations to apply. + pending map[int]*PendingKey // Map from mutation index to incomplete keys pending transaction completion. +} + +// NewTransaction starts a new transaction. +func (c *Client) NewTransaction(ctx context.Context, opts ...TransactionOption) (t *Transaction, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.NewTransaction") + defer func() { trace.EndSpan(ctx, err) }() + + for _, o := range opts { + if _, ok := o.(maxAttempts); ok { + return nil, errors.New("datastore: NewTransaction does not accept MaxAttempts option") + } + } + return c.newTransaction(ctx, newTransactionSettings(opts)) +} + +func (c *Client) newTransaction(ctx context.Context, s *transactionSettings) (*Transaction, error) { + req := &pb.BeginTransactionRequest{ProjectId: c.dataset} + if s.readOnly { + req.TransactionOptions = &pb.TransactionOptions{ + Mode: &pb.TransactionOptions_ReadOnly_{ReadOnly: &pb.TransactionOptions_ReadOnly{}}, + } + } else if s.prevID != nil { + req.TransactionOptions = &pb.TransactionOptions{ + Mode: &pb.TransactionOptions_ReadWrite_{ReadWrite: &pb.TransactionOptions_ReadWrite{ + PreviousTransaction: s.prevID, + }}, + } + } + resp, err := c.client.BeginTransaction(ctx, req) + if err != nil { + return nil, err + } + return &Transaction{ + id: resp.Transaction, + ctx: ctx, + client: c, + mutations: nil, + pending: make(map[int]*PendingKey), + }, nil +} + +// RunInTransaction runs f in a transaction. f is invoked with a Transaction +// that f should use for all the transaction's datastore operations. +// +// f must not call Commit or Rollback on the provided Transaction. +// +// If f returns nil, RunInTransaction commits the transaction, +// returning the Commit and a nil error if it succeeds. If the commit fails due +// to a conflicting transaction, RunInTransaction retries f with a new +// Transaction. It gives up and returns ErrConcurrentTransaction after three +// failed attempts (or as configured with MaxAttempts). +// +// If f returns non-nil, then the transaction will be rolled back and +// RunInTransaction will return the same error. The function f is not retried. +// +// Note that when f returns, the transaction is not committed. Calling code +// must not assume that any of f's changes have been committed until +// RunInTransaction returns nil. +// +// Since f may be called multiple times, f should usually be idempotent – that +// is, it should have the same result when called multiple times. Note that +// Transaction.Get will append when unmarshalling slice fields, so it is not +// necessarily idempotent. +func (c *Client) RunInTransaction(ctx context.Context, f func(tx *Transaction) error, opts ...TransactionOption) (cmt *Commit, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/datastore.RunInTransaction") + defer func() { trace.EndSpan(ctx, err) }() + + settings := newTransactionSettings(opts) + for n := 0; n < settings.attempts; n++ { + tx, err := c.newTransaction(ctx, settings) + if err != nil { + return nil, err + } + if err := f(tx); err != nil { + _ = tx.Rollback() + return nil, err + } + if cmt, err := tx.Commit(); err != ErrConcurrentTransaction { + return cmt, err + } + // Pass this transaction's ID to the retry transaction to preserve + // transaction priority. + if !settings.readOnly { + settings.prevID = tx.id + } + } + return nil, ErrConcurrentTransaction +} + +// Commit applies the enqueued operations atomically. +func (t *Transaction) Commit() (c *Commit, err error) { + t.ctx = trace.StartSpan(t.ctx, "cloud.google.com/go/datastore.Transaction.Commit") + defer func() { trace.EndSpan(t.ctx, err) }() + + if t.id == nil { + return nil, errExpiredTransaction + } + req := &pb.CommitRequest{ + ProjectId: t.client.dataset, + TransactionSelector: &pb.CommitRequest_Transaction{Transaction: t.id}, + Mutations: t.mutations, + Mode: pb.CommitRequest_TRANSACTIONAL, + } + resp, err := t.client.client.Commit(t.ctx, req) + if grpc.Code(err) == codes.Aborted { + return nil, ErrConcurrentTransaction + } + t.id = nil // mark the transaction as expired + if err != nil { + return nil, err + } + + // Copy any newly minted keys into the returned keys. + for i, p := range t.pending { + if i >= len(resp.MutationResults) || resp.MutationResults[i].Key == nil { + return nil, errors.New("datastore: internal error: server returned the wrong mutation results") + } + key, err := protoToKey(resp.MutationResults[i].Key) + if err != nil { + return nil, errors.New("datastore: internal error: server returned an invalid key") + } + p.key = key + p.commit = c + } + + return c, nil +} + +// Rollback abandons a pending transaction. +func (t *Transaction) Rollback() (err error) { + t.ctx = trace.StartSpan(t.ctx, "cloud.google.com/go/datastore.Transaction.Rollback") + defer func() { trace.EndSpan(t.ctx, err) }() + + if t.id == nil { + return errExpiredTransaction + } + id := t.id + t.id = nil + _, err = t.client.client.Rollback(t.ctx, &pb.RollbackRequest{ + ProjectId: t.client.dataset, + Transaction: id, + }) + return err +} + +// Get is the transaction-specific version of the package function Get. +// All reads performed during the transaction will come from a single consistent +// snapshot. Furthermore, if the transaction is set to a serializable isolation +// level, another transaction cannot concurrently modify the data that is read +// or modified by this transaction. +func (t *Transaction) Get(key *Key, dst interface{}) (err error) { + t.ctx = trace.StartSpan(t.ctx, "cloud.google.com/go/datastore.Transaction.Get") + defer func() { trace.EndSpan(t.ctx, err) }() + + opts := &pb.ReadOptions{ + ConsistencyType: &pb.ReadOptions_Transaction{Transaction: t.id}, + } + err = t.client.get(t.ctx, []*Key{key}, []interface{}{dst}, opts) + if me, ok := err.(MultiError); ok { + return me[0] + } + return err +} + +// GetMulti is a batch version of Get. +func (t *Transaction) GetMulti(keys []*Key, dst interface{}) (err error) { + t.ctx = trace.StartSpan(t.ctx, "cloud.google.com/go/datastore.Transaction.GetMulti") + defer func() { trace.EndSpan(t.ctx, err) }() + + if t.id == nil { + return errExpiredTransaction + } + opts := &pb.ReadOptions{ + ConsistencyType: &pb.ReadOptions_Transaction{Transaction: t.id}, + } + return t.client.get(t.ctx, keys, dst, opts) +} + +// Put is the transaction-specific version of the package function Put. +// +// Put returns a PendingKey which can be resolved into a Key using the +// return value from a successful Commit. If key is an incomplete key, the +// returned pending key will resolve to a unique key generated by the +// datastore. +func (t *Transaction) Put(key *Key, src interface{}) (*PendingKey, error) { + h, err := t.PutMulti([]*Key{key}, []interface{}{src}) + if err != nil { + if me, ok := err.(MultiError); ok { + return nil, me[0] + } + return nil, err + } + return h[0], nil +} + +// PutMulti is a batch version of Put. One PendingKey is returned for each +// element of src in the same order. +// TODO(jba): rewrite in terms of Mutate. +func (t *Transaction) PutMulti(keys []*Key, src interface{}) (ret []*PendingKey, err error) { + t.ctx = trace.StartSpan(t.ctx, "cloud.google.com/go/datastore.Transaction.PutMulti") + defer func() { trace.EndSpan(t.ctx, err) }() + + if t.id == nil { + return nil, errExpiredTransaction + } + mutations, err := putMutations(keys, src) + if err != nil { + return nil, err + } + origin := len(t.mutations) + t.mutations = append(t.mutations, mutations...) + + // Prepare the returned handles, pre-populating where possible. + ret = make([]*PendingKey, len(keys)) + for i, key := range keys { + p := &PendingKey{} + if key.Incomplete() { + // This key will be in the final commit result. + t.pending[origin+i] = p + } else { + p.key = key + } + ret[i] = p + } + + return ret, nil +} + +// Delete is the transaction-specific version of the package function Delete. +// Delete enqueues the deletion of the entity for the given key, to be +// committed atomically upon calling Commit. +func (t *Transaction) Delete(key *Key) error { + err := t.DeleteMulti([]*Key{key}) + if me, ok := err.(MultiError); ok { + return me[0] + } + return err +} + +// DeleteMulti is a batch version of Delete. +// TODO(jba): rewrite in terms of Mutate. +func (t *Transaction) DeleteMulti(keys []*Key) (err error) { + t.ctx = trace.StartSpan(t.ctx, "cloud.google.com/go/datastore.Transaction.DeleteMulti") + defer func() { trace.EndSpan(t.ctx, err) }() + + if t.id == nil { + return errExpiredTransaction + } + mutations, err := deleteMutations(keys) + if err != nil { + return err + } + t.mutations = append(t.mutations, mutations...) + return nil +} + +// Mutate adds the mutations to the transaction. They will all be applied atomically +// upon calling Commit. Mutate returns a PendingKey for each Mutation in the argument +// list, in the same order. PendingKeys for Delete mutations are always nil. +// +// If any of the mutations are invalid, Mutate returns a MultiError with the errors. +// Mutate returns a MultiError in this case even if there is only one Mutation. +// +// For an example, see Client.Mutate. +func (t *Transaction) Mutate(muts ...*Mutation) ([]*PendingKey, error) { + if t.id == nil { + return nil, errExpiredTransaction + } + pmuts, err := mutationProtos(muts) + if err != nil { + return nil, err + } + origin := len(t.mutations) + t.mutations = append(t.mutations, pmuts...) + // Prepare the returned handles, pre-populating where possible. + ret := make([]*PendingKey, len(muts)) + for i, mut := range muts { + if mut.isDelete() { + continue + } + p := &PendingKey{} + if mut.key.Incomplete() { + // This key will be in the final commit result. + t.pending[origin+i] = p + } else { + p.key = mut.key + } + ret[i] = p + } + return ret, nil +} + +// Commit represents the result of a committed transaction. +type Commit struct{} + +// Key resolves a pending key handle into a final key. +func (c *Commit) Key(p *PendingKey) *Key { + if p == nil { // if called on a *PendingKey from a Delete mutation + return nil + } + // If p.commit is nil, the PendingKey did not come from an incomplete key, + // so p.key is valid. + if p.commit != nil && c != p.commit { + panic("PendingKey was not created by corresponding transaction") + } + return p.key +} + +// PendingKey represents the key for newly-inserted entity. It can be +// resolved into a Key by calling the Key method of Commit. +type PendingKey struct { + key *Key + commit *Commit +} diff --git a/vendor/cloud.google.com/go/datastore/transaction_test.go b/vendor/cloud.google.com/go/datastore/transaction_test.go new file mode 100644 index 000000000..31d7e9fcb --- /dev/null +++ b/vendor/cloud.google.com/go/datastore/transaction_test.go @@ -0,0 +1,77 @@ +// Copyright 2017 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 datastore + +import ( + "context" + "testing" + + "github.com/golang/protobuf/proto" + pb "google.golang.org/genproto/googleapis/datastore/v1" +) + +func TestNewTransaction(t *testing.T) { + var got *pb.BeginTransactionRequest + client := &Client{ + dataset: "project", + client: &fakeDatastoreClient{ + beginTransaction: func(req *pb.BeginTransactionRequest) (*pb.BeginTransactionResponse, error) { + got = req + return &pb.BeginTransactionResponse{ + Transaction: []byte("tid"), + }, nil + }, + }, + } + ctx := context.Background() + for _, test := range []struct { + settings *transactionSettings + want *pb.BeginTransactionRequest + }{ + { + &transactionSettings{}, + &pb.BeginTransactionRequest{ProjectId: "project"}, + }, + { + &transactionSettings{readOnly: true}, + &pb.BeginTransactionRequest{ + ProjectId: "project", + TransactionOptions: &pb.TransactionOptions{ + Mode: &pb.TransactionOptions_ReadOnly_{ReadOnly: &pb.TransactionOptions_ReadOnly{}}, + }, + }, + }, + { + &transactionSettings{prevID: []byte("tid")}, + &pb.BeginTransactionRequest{ + ProjectId: "project", + TransactionOptions: &pb.TransactionOptions{ + Mode: &pb.TransactionOptions_ReadWrite_{ReadWrite: &pb.TransactionOptions_ReadWrite{ + PreviousTransaction: []byte("tid"), + }, + }, + }, + }, + }, + } { + _, err := client.newTransaction(ctx, test.settings) + if err != nil { + t.Fatal(err) + } + if !proto.Equal(got, test.want) { + t.Errorf("%+v:\ngot %+v\nwant %+v", test.settings, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/debugger/apiv2/controller2_client.go b/vendor/cloud.google.com/go/debugger/apiv2/controller2_client.go new file mode 100644 index 000000000..3c12efbf7 --- /dev/null +++ b/vendor/cloud.google.com/go/debugger/apiv2/controller2_client.go @@ -0,0 +1,216 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package debugger + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// Controller2CallOptions contains the retry settings for each method of Controller2Client. +type Controller2CallOptions struct { + RegisterDebuggee []gax.CallOption + ListActiveBreakpoints []gax.CallOption + UpdateActiveBreakpoint []gax.CallOption +} + +func defaultController2ClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("clouddebugger.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultController2CallOptions() *Controller2CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &Controller2CallOptions{ + RegisterDebuggee: retry[[2]string{"default", "non_idempotent"}], + ListActiveBreakpoints: retry[[2]string{"default", "idempotent"}], + UpdateActiveBreakpoint: retry[[2]string{"default", "idempotent"}], + } +} + +// Controller2Client is a client for interacting with Stackdriver Debugger API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Controller2Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + controller2Client clouddebuggerpb.Controller2Client + + // The call options for this service. + CallOptions *Controller2CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewController2Client creates a new controller2 client. +// +// The Controller service provides the API for orchestrating a collection of +// debugger agents to perform debugging tasks. These agents are each attached +// to a process of an application which may include one or more replicas. +// +// The debugger agents register with the Controller to identify the application +// being debugged, the Debuggee. All agents that register with the same data, +// represent the same Debuggee, and are assigned the same debuggee_id. +// +// The debugger agents call the Controller to retrieve the list of active +// Breakpoints. Agents with the same debuggee_id get the same breakpoints +// list. An agent that can fulfill the breakpoint request updates the +// Controller with the breakpoint result. The controller selects the first +// result received and discards the rest of the results. +// Agents that poll again for active breakpoints will no longer have +// the completed breakpoint in the list and should remove that breakpoint from +// their attached process. +// +// The Controller service does not provide a way to retrieve the results of +// a completed breakpoint. This functionality is available using the Debugger +// service. +func NewController2Client(ctx context.Context, opts ...option.ClientOption) (*Controller2Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultController2ClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Controller2Client{ + conn: conn, + CallOptions: defaultController2CallOptions(), + + controller2Client: clouddebuggerpb.NewController2Client(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Controller2Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Controller2Client) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Controller2Client) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// RegisterDebuggee registers the debuggee with the controller service. +// +// All agents attached to the same application must call this method with +// exactly the same request content to get back the same stable debuggee_id. +// Agents should call this method again whenever google.rpc.Code.NOT_FOUND +// is returned from any controller method. +// +// This protocol allows the controller service to disable debuggees, recover +// from data loss, or change the debuggee_id format. Agents must handle +// debuggee_id value changing upon re-registration. +func (c *Controller2Client) RegisterDebuggee(ctx context.Context, req *clouddebuggerpb.RegisterDebuggeeRequest, opts ...gax.CallOption) (*clouddebuggerpb.RegisterDebuggeeResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.RegisterDebuggee[0:len(c.CallOptions.RegisterDebuggee):len(c.CallOptions.RegisterDebuggee)], opts...) + var resp *clouddebuggerpb.RegisterDebuggeeResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.controller2Client.RegisterDebuggee(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListActiveBreakpoints returns the list of all active breakpoints for the debuggee. +// +// The breakpoint specification (location, condition, and expressions +// fields) is semantically immutable, although the field values may +// change. For example, an agent may update the location line number +// to reflect the actual line where the breakpoint was set, but this +// doesn't change the breakpoint semantics. +// +// This means that an agent does not need to check if a breakpoint has changed +// when it encounters the same breakpoint on a successive call. +// Moreover, an agent should remember the breakpoints that are completed +// until the controller removes them from the active list to avoid +// setting those breakpoints again. +func (c *Controller2Client) ListActiveBreakpoints(ctx context.Context, req *clouddebuggerpb.ListActiveBreakpointsRequest, opts ...gax.CallOption) (*clouddebuggerpb.ListActiveBreakpointsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListActiveBreakpoints[0:len(c.CallOptions.ListActiveBreakpoints):len(c.CallOptions.ListActiveBreakpoints)], opts...) + var resp *clouddebuggerpb.ListActiveBreakpointsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.controller2Client.ListActiveBreakpoints(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateActiveBreakpoint updates the breakpoint state or mutable fields. +// The entire Breakpoint message must be sent back to the controller service. +// +// Updates to active breakpoint fields are only allowed if the new value +// does not change the breakpoint specification. Updates to the location, +// condition and expressions fields should not alter the breakpoint +// semantics. These may only make changes such as canonicalizing a value +// or snapping the location to the correct line of code. +func (c *Controller2Client) UpdateActiveBreakpoint(ctx context.Context, req *clouddebuggerpb.UpdateActiveBreakpointRequest, opts ...gax.CallOption) (*clouddebuggerpb.UpdateActiveBreakpointResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateActiveBreakpoint[0:len(c.CallOptions.UpdateActiveBreakpoint):len(c.CallOptions.UpdateActiveBreakpoint)], opts...) + var resp *clouddebuggerpb.UpdateActiveBreakpointResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.controller2Client.UpdateActiveBreakpoint(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/debugger/apiv2/controller2_client_example_test.go b/vendor/cloud.google.com/go/debugger/apiv2/controller2_client_example_test.go new file mode 100644 index 000000000..cbe64c3fd --- /dev/null +++ b/vendor/cloud.google.com/go/debugger/apiv2/controller2_client_example_test.go @@ -0,0 +1,88 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package debugger_test + +import ( + "context" + + debugger "cloud.google.com/go/debugger/apiv2" + clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2" +) + +func ExampleNewController2Client() { + ctx := context.Background() + c, err := debugger.NewController2Client(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleController2Client_RegisterDebuggee() { + ctx := context.Background() + c, err := debugger.NewController2Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouddebuggerpb.RegisterDebuggeeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RegisterDebuggee(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleController2Client_ListActiveBreakpoints() { + ctx := context.Background() + c, err := debugger.NewController2Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouddebuggerpb.ListActiveBreakpointsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListActiveBreakpoints(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleController2Client_UpdateActiveBreakpoint() { + ctx := context.Background() + c, err := debugger.NewController2Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouddebuggerpb.UpdateActiveBreakpointRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateActiveBreakpoint(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/debugger/apiv2/debugger2_client.go b/vendor/cloud.google.com/go/debugger/apiv2/debugger2_client.go new file mode 100644 index 000000000..de5e0f133 --- /dev/null +++ b/vendor/cloud.google.com/go/debugger/apiv2/debugger2_client.go @@ -0,0 +1,212 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package debugger + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// Debugger2CallOptions contains the retry settings for each method of Debugger2Client. +type Debugger2CallOptions struct { + SetBreakpoint []gax.CallOption + GetBreakpoint []gax.CallOption + DeleteBreakpoint []gax.CallOption + ListBreakpoints []gax.CallOption + ListDebuggees []gax.CallOption +} + +func defaultDebugger2ClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("clouddebugger.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultDebugger2CallOptions() *Debugger2CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &Debugger2CallOptions{ + SetBreakpoint: retry[[2]string{"default", "non_idempotent"}], + GetBreakpoint: retry[[2]string{"default", "idempotent"}], + DeleteBreakpoint: retry[[2]string{"default", "idempotent"}], + ListBreakpoints: retry[[2]string{"default", "idempotent"}], + ListDebuggees: retry[[2]string{"default", "idempotent"}], + } +} + +// Debugger2Client is a client for interacting with Stackdriver Debugger API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Debugger2Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + debugger2Client clouddebuggerpb.Debugger2Client + + // The call options for this service. + CallOptions *Debugger2CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewDebugger2Client creates a new debugger2 client. +// +// The Debugger service provides the API that allows users to collect run-time +// information from a running application, without stopping or slowing it down +// and without modifying its state. An application may include one or +// more replicated processes performing the same work. +// +// A debugged application is represented using the Debuggee concept. The +// Debugger service provides a way to query for available debuggees, but does +// not provide a way to create one. A debuggee is created using the Controller +// service, usually by running a debugger agent with the application. +// +// The Debugger service enables the client to set one or more Breakpoints on a +// Debuggee and collect the results of the set Breakpoints. +func NewDebugger2Client(ctx context.Context, opts ...option.ClientOption) (*Debugger2Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultDebugger2ClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Debugger2Client{ + conn: conn, + CallOptions: defaultDebugger2CallOptions(), + + debugger2Client: clouddebuggerpb.NewDebugger2Client(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Debugger2Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Debugger2Client) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Debugger2Client) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// SetBreakpoint sets the breakpoint to the debuggee. +func (c *Debugger2Client) SetBreakpoint(ctx context.Context, req *clouddebuggerpb.SetBreakpointRequest, opts ...gax.CallOption) (*clouddebuggerpb.SetBreakpointResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetBreakpoint[0:len(c.CallOptions.SetBreakpoint):len(c.CallOptions.SetBreakpoint)], opts...) + var resp *clouddebuggerpb.SetBreakpointResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.debugger2Client.SetBreakpoint(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetBreakpoint gets breakpoint information. +func (c *Debugger2Client) GetBreakpoint(ctx context.Context, req *clouddebuggerpb.GetBreakpointRequest, opts ...gax.CallOption) (*clouddebuggerpb.GetBreakpointResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetBreakpoint[0:len(c.CallOptions.GetBreakpoint):len(c.CallOptions.GetBreakpoint)], opts...) + var resp *clouddebuggerpb.GetBreakpointResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.debugger2Client.GetBreakpoint(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteBreakpoint deletes the breakpoint from the debuggee. +func (c *Debugger2Client) DeleteBreakpoint(ctx context.Context, req *clouddebuggerpb.DeleteBreakpointRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteBreakpoint[0:len(c.CallOptions.DeleteBreakpoint):len(c.CallOptions.DeleteBreakpoint)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.debugger2Client.DeleteBreakpoint(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListBreakpoints lists all breakpoints for the debuggee. +func (c *Debugger2Client) ListBreakpoints(ctx context.Context, req *clouddebuggerpb.ListBreakpointsRequest, opts ...gax.CallOption) (*clouddebuggerpb.ListBreakpointsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListBreakpoints[0:len(c.CallOptions.ListBreakpoints):len(c.CallOptions.ListBreakpoints)], opts...) + var resp *clouddebuggerpb.ListBreakpointsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.debugger2Client.ListBreakpoints(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListDebuggees lists all the debuggees that the user has access to. +func (c *Debugger2Client) ListDebuggees(ctx context.Context, req *clouddebuggerpb.ListDebuggeesRequest, opts ...gax.CallOption) (*clouddebuggerpb.ListDebuggeesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListDebuggees[0:len(c.CallOptions.ListDebuggees):len(c.CallOptions.ListDebuggees)], opts...) + var resp *clouddebuggerpb.ListDebuggeesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.debugger2Client.ListDebuggees(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/debugger/apiv2/debugger2_client_example_test.go b/vendor/cloud.google.com/go/debugger/apiv2/debugger2_client_example_test.go new file mode 100644 index 000000000..a7a9cb8e5 --- /dev/null +++ b/vendor/cloud.google.com/go/debugger/apiv2/debugger2_client_example_test.go @@ -0,0 +1,122 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package debugger_test + +import ( + "context" + + debugger "cloud.google.com/go/debugger/apiv2" + clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2" +) + +func ExampleNewDebugger2Client() { + ctx := context.Background() + c, err := debugger.NewDebugger2Client(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleDebugger2Client_SetBreakpoint() { + ctx := context.Background() + c, err := debugger.NewDebugger2Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouddebuggerpb.SetBreakpointRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetBreakpoint(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDebugger2Client_GetBreakpoint() { + ctx := context.Background() + c, err := debugger.NewDebugger2Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouddebuggerpb.GetBreakpointRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetBreakpoint(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDebugger2Client_DeleteBreakpoint() { + ctx := context.Background() + c, err := debugger.NewDebugger2Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouddebuggerpb.DeleteBreakpointRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteBreakpoint(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleDebugger2Client_ListBreakpoints() { + ctx := context.Background() + c, err := debugger.NewDebugger2Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouddebuggerpb.ListBreakpointsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListBreakpoints(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDebugger2Client_ListDebuggees() { + ctx := context.Background() + c, err := debugger.NewDebugger2Client(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouddebuggerpb.ListDebuggeesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListDebuggees(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/debugger/apiv2/doc.go b/vendor/cloud.google.com/go/debugger/apiv2/doc.go new file mode 100644 index 000000000..e3d5256af --- /dev/null +++ b/vendor/cloud.google.com/go/debugger/apiv2/doc.go @@ -0,0 +1,93 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package debugger is an auto-generated package for the +// Stackdriver Debugger API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Examines the call stack and variables of a running application without +// stopping or slowing it down. +// +// Use the client at cloud.google.com/go/cmd/go-cloud-debug-agent in preference to this. +package debugger // import "cloud.google.com/go/debugger/apiv2" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud_debugger", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/debugger/apiv2/mock_test.go b/vendor/cloud.google.com/go/debugger/apiv2/mock_test.go new file mode 100644 index 000000000..022a4d07f --- /dev/null +++ b/vendor/cloud.google.com/go/debugger/apiv2/mock_test.go @@ -0,0 +1,693 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package debugger + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockController2Server struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + clouddebuggerpb.Controller2Server + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockController2Server) RegisterDebuggee(ctx context.Context, req *clouddebuggerpb.RegisterDebuggeeRequest) (*clouddebuggerpb.RegisterDebuggeeResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouddebuggerpb.RegisterDebuggeeResponse), nil +} + +func (s *mockController2Server) ListActiveBreakpoints(ctx context.Context, req *clouddebuggerpb.ListActiveBreakpointsRequest) (*clouddebuggerpb.ListActiveBreakpointsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouddebuggerpb.ListActiveBreakpointsResponse), nil +} + +func (s *mockController2Server) UpdateActiveBreakpoint(ctx context.Context, req *clouddebuggerpb.UpdateActiveBreakpointRequest) (*clouddebuggerpb.UpdateActiveBreakpointResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouddebuggerpb.UpdateActiveBreakpointResponse), nil +} + +type mockDebugger2Server struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + clouddebuggerpb.Debugger2Server + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockDebugger2Server) SetBreakpoint(ctx context.Context, req *clouddebuggerpb.SetBreakpointRequest) (*clouddebuggerpb.SetBreakpointResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouddebuggerpb.SetBreakpointResponse), nil +} + +func (s *mockDebugger2Server) GetBreakpoint(ctx context.Context, req *clouddebuggerpb.GetBreakpointRequest) (*clouddebuggerpb.GetBreakpointResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouddebuggerpb.GetBreakpointResponse), nil +} + +func (s *mockDebugger2Server) DeleteBreakpoint(ctx context.Context, req *clouddebuggerpb.DeleteBreakpointRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockDebugger2Server) ListBreakpoints(ctx context.Context, req *clouddebuggerpb.ListBreakpointsRequest) (*clouddebuggerpb.ListBreakpointsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouddebuggerpb.ListBreakpointsResponse), nil +} + +func (s *mockDebugger2Server) ListDebuggees(ctx context.Context, req *clouddebuggerpb.ListDebuggeesRequest) (*clouddebuggerpb.ListDebuggeesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouddebuggerpb.ListDebuggeesResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockController2 mockController2Server + mockDebugger2 mockDebugger2Server +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + clouddebuggerpb.RegisterController2Server(serv, &mockController2) + clouddebuggerpb.RegisterDebugger2Server(serv, &mockDebugger2) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestController2RegisterDebuggee(t *testing.T) { + var expectedResponse *clouddebuggerpb.RegisterDebuggeeResponse = &clouddebuggerpb.RegisterDebuggeeResponse{} + + mockController2.err = nil + mockController2.reqs = nil + + mockController2.resps = append(mockController2.resps[:0], expectedResponse) + + var debuggee *clouddebuggerpb.Debuggee = &clouddebuggerpb.Debuggee{} + var request = &clouddebuggerpb.RegisterDebuggeeRequest{ + Debuggee: debuggee, + } + + c, err := NewController2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RegisterDebuggee(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockController2.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestController2RegisterDebuggeeError(t *testing.T) { + errCode := codes.PermissionDenied + mockController2.err = gstatus.Error(errCode, "test error") + + var debuggee *clouddebuggerpb.Debuggee = &clouddebuggerpb.Debuggee{} + var request = &clouddebuggerpb.RegisterDebuggeeRequest{ + Debuggee: debuggee, + } + + c, err := NewController2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RegisterDebuggee(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestController2ListActiveBreakpoints(t *testing.T) { + var nextWaitToken string = "nextWaitToken1006864251" + var waitExpired bool = false + var expectedResponse = &clouddebuggerpb.ListActiveBreakpointsResponse{ + NextWaitToken: nextWaitToken, + WaitExpired: waitExpired, + } + + mockController2.err = nil + mockController2.reqs = nil + + mockController2.resps = append(mockController2.resps[:0], expectedResponse) + + var debuggeeId string = "debuggeeId-997255898" + var request = &clouddebuggerpb.ListActiveBreakpointsRequest{ + DebuggeeId: debuggeeId, + } + + c, err := NewController2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListActiveBreakpoints(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockController2.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestController2ListActiveBreakpointsError(t *testing.T) { + errCode := codes.PermissionDenied + mockController2.err = gstatus.Error(errCode, "test error") + + var debuggeeId string = "debuggeeId-997255898" + var request = &clouddebuggerpb.ListActiveBreakpointsRequest{ + DebuggeeId: debuggeeId, + } + + c, err := NewController2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListActiveBreakpoints(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestController2UpdateActiveBreakpoint(t *testing.T) { + var expectedResponse *clouddebuggerpb.UpdateActiveBreakpointResponse = &clouddebuggerpb.UpdateActiveBreakpointResponse{} + + mockController2.err = nil + mockController2.reqs = nil + + mockController2.resps = append(mockController2.resps[:0], expectedResponse) + + var debuggeeId string = "debuggeeId-997255898" + var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{} + var request = &clouddebuggerpb.UpdateActiveBreakpointRequest{ + DebuggeeId: debuggeeId, + Breakpoint: breakpoint, + } + + c, err := NewController2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateActiveBreakpoint(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockController2.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestController2UpdateActiveBreakpointError(t *testing.T) { + errCode := codes.PermissionDenied + mockController2.err = gstatus.Error(errCode, "test error") + + var debuggeeId string = "debuggeeId-997255898" + var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{} + var request = &clouddebuggerpb.UpdateActiveBreakpointRequest{ + DebuggeeId: debuggeeId, + Breakpoint: breakpoint, + } + + c, err := NewController2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateActiveBreakpoint(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDebugger2SetBreakpoint(t *testing.T) { + var expectedResponse *clouddebuggerpb.SetBreakpointResponse = &clouddebuggerpb.SetBreakpointResponse{} + + mockDebugger2.err = nil + mockDebugger2.reqs = nil + + mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse) + + var debuggeeId string = "debuggeeId-997255898" + var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{} + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.SetBreakpointRequest{ + DebuggeeId: debuggeeId, + Breakpoint: breakpoint, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetBreakpoint(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDebugger2SetBreakpointError(t *testing.T) { + errCode := codes.PermissionDenied + mockDebugger2.err = gstatus.Error(errCode, "test error") + + var debuggeeId string = "debuggeeId-997255898" + var breakpoint *clouddebuggerpb.Breakpoint = &clouddebuggerpb.Breakpoint{} + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.SetBreakpointRequest{ + DebuggeeId: debuggeeId, + Breakpoint: breakpoint, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetBreakpoint(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDebugger2GetBreakpoint(t *testing.T) { + var expectedResponse *clouddebuggerpb.GetBreakpointResponse = &clouddebuggerpb.GetBreakpointResponse{} + + mockDebugger2.err = nil + mockDebugger2.reqs = nil + + mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse) + + var debuggeeId string = "debuggeeId-997255898" + var breakpointId string = "breakpointId498424873" + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.GetBreakpointRequest{ + DebuggeeId: debuggeeId, + BreakpointId: breakpointId, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetBreakpoint(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDebugger2GetBreakpointError(t *testing.T) { + errCode := codes.PermissionDenied + mockDebugger2.err = gstatus.Error(errCode, "test error") + + var debuggeeId string = "debuggeeId-997255898" + var breakpointId string = "breakpointId498424873" + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.GetBreakpointRequest{ + DebuggeeId: debuggeeId, + BreakpointId: breakpointId, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetBreakpoint(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDebugger2DeleteBreakpoint(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDebugger2.err = nil + mockDebugger2.reqs = nil + + mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse) + + var debuggeeId string = "debuggeeId-997255898" + var breakpointId string = "breakpointId498424873" + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.DeleteBreakpointRequest{ + DebuggeeId: debuggeeId, + BreakpointId: breakpointId, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteBreakpoint(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDebugger2DeleteBreakpointError(t *testing.T) { + errCode := codes.PermissionDenied + mockDebugger2.err = gstatus.Error(errCode, "test error") + + var debuggeeId string = "debuggeeId-997255898" + var breakpointId string = "breakpointId498424873" + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.DeleteBreakpointRequest{ + DebuggeeId: debuggeeId, + BreakpointId: breakpointId, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteBreakpoint(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDebugger2ListBreakpoints(t *testing.T) { + var nextWaitToken string = "nextWaitToken1006864251" + var expectedResponse = &clouddebuggerpb.ListBreakpointsResponse{ + NextWaitToken: nextWaitToken, + } + + mockDebugger2.err = nil + mockDebugger2.reqs = nil + + mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse) + + var debuggeeId string = "debuggeeId-997255898" + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.ListBreakpointsRequest{ + DebuggeeId: debuggeeId, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListBreakpoints(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDebugger2ListBreakpointsError(t *testing.T) { + errCode := codes.PermissionDenied + mockDebugger2.err = gstatus.Error(errCode, "test error") + + var debuggeeId string = "debuggeeId-997255898" + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.ListBreakpointsRequest{ + DebuggeeId: debuggeeId, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListBreakpoints(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDebugger2ListDebuggees(t *testing.T) { + var expectedResponse *clouddebuggerpb.ListDebuggeesResponse = &clouddebuggerpb.ListDebuggeesResponse{} + + mockDebugger2.err = nil + mockDebugger2.reqs = nil + + mockDebugger2.resps = append(mockDebugger2.resps[:0], expectedResponse) + + var project string = "project-309310695" + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.ListDebuggeesRequest{ + Project: project, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDebuggees(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDebugger2.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDebugger2ListDebuggeesError(t *testing.T) { + errCode := codes.PermissionDenied + mockDebugger2.err = gstatus.Error(errCode, "test error") + + var project string = "project-309310695" + var clientVersion string = "clientVersion-1506231196" + var request = &clouddebuggerpb.ListDebuggeesRequest{ + Project: project, + ClientVersion: clientVersion, + } + + c, err := NewDebugger2Client(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDebuggees(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/agents_client.go b/vendor/cloud.google.com/go/dialogflow/apiv2/agents_client.go new file mode 100644 index 000000000..a6f725090 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/agents_client.go @@ -0,0 +1,603 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + structpbpb "github.com/golang/protobuf/ptypes/struct" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// AgentsCallOptions contains the retry settings for each method of AgentsClient. +type AgentsCallOptions struct { + GetAgent []gax.CallOption + SearchAgents []gax.CallOption + TrainAgent []gax.CallOption + ExportAgent []gax.CallOption + ImportAgent []gax.CallOption + RestoreAgent []gax.CallOption +} + +func defaultAgentsClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dialogflow.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultAgentsCallOptions() *AgentsCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &AgentsCallOptions{ + GetAgent: retry[[2]string{"default", "idempotent"}], + SearchAgents: retry[[2]string{"default", "idempotent"}], + TrainAgent: retry[[2]string{"default", "idempotent"}], + ExportAgent: retry[[2]string{"default", "idempotent"}], + ImportAgent: retry[[2]string{"default", "non_idempotent"}], + RestoreAgent: retry[[2]string{"default", "idempotent"}], + } +} + +// AgentsClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type AgentsClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + agentsClient dialogflowpb.AgentsClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *AgentsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewAgentsClient creates a new agents client. +// +// Agents are best described as Natural Language Understanding (NLU) modules +// that transform user requests into actionable data. You can include agents +// in your app, product, or service to determine user intent and respond to the +// user in a natural way. +// +// After you create an agent, you can add [Intents][google.cloud.dialogflow.v2.Intents], [Contexts][google.cloud.dialogflow.v2.Contexts], +// [Entity Types][google.cloud.dialogflow.v2.EntityTypes], [Webhooks][google.cloud.dialogflow.v2.WebhookRequest], and so on to +// manage the flow of a conversation and match user input to predefined intents +// and actions. +// +// You can create an agent using both Dialogflow Standard Edition and +// Dialogflow Enterprise Edition. For details, see +// Dialogflow Editions (at /dialogflow-enterprise/docs/editions). +// +// You can save your agent for backup or versioning by exporting the agent by +// using the [ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent] method. You can import a saved +// agent by using the [ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent] method. +// +// Dialogflow provides several +// prebuilt agents (at https://dialogflow.com/docs/prebuilt-agents) for common +// conversation scenarios such as determining a date and time, converting +// currency, and so on. +// +// For more information about agents, see the +// Dialogflow documentation (at https://dialogflow.com/docs/agents). +func NewAgentsClient(ctx context.Context, opts ...option.ClientOption) (*AgentsClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultAgentsClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &AgentsClient{ + conn: conn, + CallOptions: defaultAgentsCallOptions(), + + agentsClient: dialogflowpb.NewAgentsClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *AgentsClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *AgentsClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *AgentsClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// GetAgent retrieves the specified agent. +func (c *AgentsClient) GetAgent(ctx context.Context, req *dialogflowpb.GetAgentRequest, opts ...gax.CallOption) (*dialogflowpb.Agent, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetAgent[0:len(c.CallOptions.GetAgent):len(c.CallOptions.GetAgent)], opts...) + var resp *dialogflowpb.Agent + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.agentsClient.GetAgent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SearchAgents returns the list of agents. +// +// Since there is at most one conversational agent per project, this method is +// useful primarily for listing all agents across projects the caller has +// access to. One can achieve that with a wildcard project collection id "-". +// Refer to List +// Sub-Collections (at https://cloud.google.com/apis/design/design_patterns#list_sub-collections). +func (c *AgentsClient) SearchAgents(ctx context.Context, req *dialogflowpb.SearchAgentsRequest, opts ...gax.CallOption) *AgentIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SearchAgents[0:len(c.CallOptions.SearchAgents):len(c.CallOptions.SearchAgents)], opts...) + it := &AgentIterator{} + req = proto.Clone(req).(*dialogflowpb.SearchAgentsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.Agent, string, error) { + var resp *dialogflowpb.SearchAgentsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.agentsClient.SearchAgents(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Agents, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// TrainAgent trains the specified agent. +// +// Operation +func (c *AgentsClient) TrainAgent(ctx context.Context, req *dialogflowpb.TrainAgentRequest, opts ...gax.CallOption) (*TrainAgentOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.TrainAgent[0:len(c.CallOptions.TrainAgent):len(c.CallOptions.TrainAgent)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.agentsClient.TrainAgent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &TrainAgentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ExportAgent exports the specified agent to a ZIP file. +// +// Operation +func (c *AgentsClient) ExportAgent(ctx context.Context, req *dialogflowpb.ExportAgentRequest, opts ...gax.CallOption) (*ExportAgentOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ExportAgent[0:len(c.CallOptions.ExportAgent):len(c.CallOptions.ExportAgent)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.agentsClient.ExportAgent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ExportAgentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ImportAgent imports the specified agent from a ZIP file. +// +// Uploads new intents and entity types without deleting the existing ones. +// Intents and entity types with the same name are replaced with the new +// versions from ImportAgentRequest. +// +// Operation +func (c *AgentsClient) ImportAgent(ctx context.Context, req *dialogflowpb.ImportAgentRequest, opts ...gax.CallOption) (*ImportAgentOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ImportAgent[0:len(c.CallOptions.ImportAgent):len(c.CallOptions.ImportAgent)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.agentsClient.ImportAgent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ImportAgentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// RestoreAgent restores the specified agent from a ZIP file. +// +// Replaces the current agent version with a new one. All the intents and +// entity types in the older version are deleted. +// +// Operation +func (c *AgentsClient) RestoreAgent(ctx context.Context, req *dialogflowpb.RestoreAgentRequest, opts ...gax.CallOption) (*RestoreAgentOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.RestoreAgent[0:len(c.CallOptions.RestoreAgent):len(c.CallOptions.RestoreAgent)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.agentsClient.RestoreAgent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &RestoreAgentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// AgentIterator manages a stream of *dialogflowpb.Agent. +type AgentIterator struct { + items []*dialogflowpb.Agent + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.Agent, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *AgentIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *AgentIterator) Next() (*dialogflowpb.Agent, error) { + var item *dialogflowpb.Agent + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *AgentIterator) bufLen() int { + return len(it.items) +} + +func (it *AgentIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ExportAgentOperation manages a long-running operation from ExportAgent. +type ExportAgentOperation struct { + lro *longrunning.Operation +} + +// ExportAgentOperation returns a new ExportAgentOperation from a given name. +// The name must be that of a previously created ExportAgentOperation, possibly from a different process. +func (c *AgentsClient) ExportAgentOperation(name string) *ExportAgentOperation { + return &ExportAgentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *ExportAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ExportAgentResponse, error) { + var resp dialogflowpb.ExportAgentResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 5000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *ExportAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ExportAgentResponse, error) { + var resp dialogflowpb.ExportAgentResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *ExportAgentOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *ExportAgentOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *ExportAgentOperation) Name() string { + return op.lro.Name() +} + +// ImportAgentOperation manages a long-running operation from ImportAgent. +type ImportAgentOperation struct { + lro *longrunning.Operation +} + +// ImportAgentOperation returns a new ImportAgentOperation from a given name. +// The name must be that of a previously created ImportAgentOperation, possibly from a different process. +func (c *AgentsClient) ImportAgentOperation(name string) *ImportAgentOperation { + return &ImportAgentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *ImportAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 5000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *ImportAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *ImportAgentOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *ImportAgentOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *ImportAgentOperation) Name() string { + return op.lro.Name() +} + +// RestoreAgentOperation manages a long-running operation from RestoreAgent. +type RestoreAgentOperation struct { + lro *longrunning.Operation +} + +// RestoreAgentOperation returns a new RestoreAgentOperation from a given name. +// The name must be that of a previously created RestoreAgentOperation, possibly from a different process. +func (c *AgentsClient) RestoreAgentOperation(name string) *RestoreAgentOperation { + return &RestoreAgentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *RestoreAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 5000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *RestoreAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *RestoreAgentOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *RestoreAgentOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *RestoreAgentOperation) Name() string { + return op.lro.Name() +} + +// TrainAgentOperation manages a long-running operation from TrainAgent. +type TrainAgentOperation struct { + lro *longrunning.Operation +} + +// TrainAgentOperation returns a new TrainAgentOperation from a given name. +// The name must be that of a previously created TrainAgentOperation, possibly from a different process. +func (c *AgentsClient) TrainAgentOperation(name string) *TrainAgentOperation { + return &TrainAgentOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *TrainAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 5000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *TrainAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *TrainAgentOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *TrainAgentOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *TrainAgentOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/agents_client_example_test.go b/vendor/cloud.google.com/go/dialogflow/apiv2/agents_client_example_test.go new file mode 100644 index 000000000..43cf3d3d6 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/agents_client_example_test.go @@ -0,0 +1,157 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewAgentsClient() { + ctx := context.Background() + c, err := dialogflow.NewAgentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleAgentsClient_GetAgent() { + ctx := context.Background() + c, err := dialogflow.NewAgentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetAgentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetAgent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAgentsClient_SearchAgents() { + ctx := context.Background() + c, err := dialogflow.NewAgentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.SearchAgentsRequest{ + // TODO: Fill request struct fields. + } + it := c.SearchAgents(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleAgentsClient_TrainAgent() { + ctx := context.Background() + c, err := dialogflow.NewAgentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.TrainAgentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.TrainAgent(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleAgentsClient_ExportAgent() { + ctx := context.Background() + c, err := dialogflow.NewAgentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ExportAgentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ExportAgent(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAgentsClient_ImportAgent() { + ctx := context.Background() + c, err := dialogflow.NewAgentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ImportAgentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ImportAgent(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleAgentsClient_RestoreAgent() { + ctx := context.Background() + c, err := dialogflow.NewAgentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.RestoreAgentRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RestoreAgent(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/contexts_client.go b/vendor/cloud.google.com/go/dialogflow/apiv2/contexts_client.go new file mode 100644 index 000000000..6d016ee49 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/contexts_client.go @@ -0,0 +1,297 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ContextsCallOptions contains the retry settings for each method of ContextsClient. +type ContextsCallOptions struct { + ListContexts []gax.CallOption + GetContext []gax.CallOption + CreateContext []gax.CallOption + UpdateContext []gax.CallOption + DeleteContext []gax.CallOption + DeleteAllContexts []gax.CallOption +} + +func defaultContextsClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dialogflow.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultContextsCallOptions() *ContextsCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ContextsCallOptions{ + ListContexts: retry[[2]string{"default", "idempotent"}], + GetContext: retry[[2]string{"default", "idempotent"}], + CreateContext: retry[[2]string{"default", "non_idempotent"}], + UpdateContext: retry[[2]string{"default", "non_idempotent"}], + DeleteContext: retry[[2]string{"default", "idempotent"}], + DeleteAllContexts: retry[[2]string{"default", "idempotent"}], + } +} + +// ContextsClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ContextsClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + contextsClient dialogflowpb.ContextsClient + + // The call options for this service. + CallOptions *ContextsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewContextsClient creates a new contexts client. +// +// A context represents additional information included with user input or with +// an intent returned by the Dialogflow API. Contexts are helpful for +// differentiating user input which may be vague or have a different meaning +// depending on additional details from your application such as user setting +// and preferences, previous user input, where the user is in your application, +// geographic location, and so on. +// +// You can include contexts as input parameters of a +// [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or +// [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) request, +// or as output contexts included in the returned intent. +// Contexts expire when an intent is matched, after the number of DetectIntent +// requests specified by the lifespan_count parameter, or after 10 minutes +// if no intents are matched for a DetectIntent request. +// +// For more information about contexts, see the +// Dialogflow documentation (at https://dialogflow.com/docs/contexts). +func NewContextsClient(ctx context.Context, opts ...option.ClientOption) (*ContextsClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultContextsClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ContextsClient{ + conn: conn, + CallOptions: defaultContextsCallOptions(), + + contextsClient: dialogflowpb.NewContextsClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ContextsClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ContextsClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ContextsClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListContexts returns the list of all contexts in the specified session. +func (c *ContextsClient) ListContexts(ctx context.Context, req *dialogflowpb.ListContextsRequest, opts ...gax.CallOption) *ContextIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListContexts[0:len(c.CallOptions.ListContexts):len(c.CallOptions.ListContexts)], opts...) + it := &ContextIterator{} + req = proto.Clone(req).(*dialogflowpb.ListContextsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.Context, string, error) { + var resp *dialogflowpb.ListContextsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.contextsClient.ListContexts(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Contexts, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetContext retrieves the specified context. +func (c *ContextsClient) GetContext(ctx context.Context, req *dialogflowpb.GetContextRequest, opts ...gax.CallOption) (*dialogflowpb.Context, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetContext[0:len(c.CallOptions.GetContext):len(c.CallOptions.GetContext)], opts...) + var resp *dialogflowpb.Context + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.contextsClient.GetContext(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateContext creates a context. +func (c *ContextsClient) CreateContext(ctx context.Context, req *dialogflowpb.CreateContextRequest, opts ...gax.CallOption) (*dialogflowpb.Context, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateContext[0:len(c.CallOptions.CreateContext):len(c.CallOptions.CreateContext)], opts...) + var resp *dialogflowpb.Context + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.contextsClient.CreateContext(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateContext updates the specified context. +func (c *ContextsClient) UpdateContext(ctx context.Context, req *dialogflowpb.UpdateContextRequest, opts ...gax.CallOption) (*dialogflowpb.Context, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateContext[0:len(c.CallOptions.UpdateContext):len(c.CallOptions.UpdateContext)], opts...) + var resp *dialogflowpb.Context + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.contextsClient.UpdateContext(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteContext deletes the specified context. +func (c *ContextsClient) DeleteContext(ctx context.Context, req *dialogflowpb.DeleteContextRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteContext[0:len(c.CallOptions.DeleteContext):len(c.CallOptions.DeleteContext)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.contextsClient.DeleteContext(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// DeleteAllContexts deletes all active contexts in the specified session. +func (c *ContextsClient) DeleteAllContexts(ctx context.Context, req *dialogflowpb.DeleteAllContextsRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteAllContexts[0:len(c.CallOptions.DeleteAllContexts):len(c.CallOptions.DeleteAllContexts)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.contextsClient.DeleteAllContexts(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ContextIterator manages a stream of *dialogflowpb.Context. +type ContextIterator struct { + items []*dialogflowpb.Context + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.Context, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ContextIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ContextIterator) Next() (*dialogflowpb.Context, error) { + var item *dialogflowpb.Context + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ContextIterator) bufLen() int { + return len(it.items) +} + +func (it *ContextIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/contexts_client_example_test.go b/vendor/cloud.google.com/go/dialogflow/apiv2/contexts_client_example_test.go new file mode 100644 index 000000000..d8192a512 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/contexts_client_example_test.go @@ -0,0 +1,145 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewContextsClient() { + ctx := context.Background() + c, err := dialogflow.NewContextsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleContextsClient_ListContexts() { + ctx := context.Background() + c, err := dialogflow.NewContextsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListContextsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListContexts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleContextsClient_GetContext() { + ctx := context.Background() + c, err := dialogflow.NewContextsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetContextRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleContextsClient_CreateContext() { + ctx := context.Background() + c, err := dialogflow.NewContextsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateContextRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleContextsClient_UpdateContext() { + ctx := context.Background() + c, err := dialogflow.NewContextsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.UpdateContextRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateContext(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleContextsClient_DeleteContext() { + ctx := context.Background() + c, err := dialogflow.NewContextsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DeleteContextRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteContext(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleContextsClient_DeleteAllContexts() { + ctx := context.Background() + c, err := dialogflow.NewContextsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DeleteAllContextsRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteAllContexts(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/doc.go b/vendor/cloud.google.com/go/dialogflow/apiv2/doc.go new file mode 100644 index 000000000..61f42d7c3 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/doc.go @@ -0,0 +1,90 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package dialogflow is an auto-generated package for the +// Dialogflow API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// An end-to-end development suite for conversational interfaces (e.g., +// chatbots, voice-powered apps and devices). +package dialogflow // import "cloud.google.com/go/dialogflow/apiv2" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/entity_types_client.go b/vendor/cloud.google.com/go/dialogflow/apiv2/entity_types_client.go new file mode 100644 index 000000000..2536b5402 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/entity_types_client.go @@ -0,0 +1,722 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + structpbpb "github.com/golang/protobuf/ptypes/struct" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// EntityTypesCallOptions contains the retry settings for each method of EntityTypesClient. +type EntityTypesCallOptions struct { + ListEntityTypes []gax.CallOption + GetEntityType []gax.CallOption + CreateEntityType []gax.CallOption + UpdateEntityType []gax.CallOption + DeleteEntityType []gax.CallOption + BatchUpdateEntityTypes []gax.CallOption + BatchDeleteEntityTypes []gax.CallOption + BatchCreateEntities []gax.CallOption + BatchUpdateEntities []gax.CallOption + BatchDeleteEntities []gax.CallOption +} + +func defaultEntityTypesClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dialogflow.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultEntityTypesCallOptions() *EntityTypesCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &EntityTypesCallOptions{ + ListEntityTypes: retry[[2]string{"default", "idempotent"}], + GetEntityType: retry[[2]string{"default", "idempotent"}], + CreateEntityType: retry[[2]string{"default", "non_idempotent"}], + UpdateEntityType: retry[[2]string{"default", "non_idempotent"}], + DeleteEntityType: retry[[2]string{"default", "idempotent"}], + BatchUpdateEntityTypes: retry[[2]string{"default", "non_idempotent"}], + BatchDeleteEntityTypes: retry[[2]string{"default", "idempotent"}], + BatchCreateEntities: retry[[2]string{"default", "non_idempotent"}], + BatchUpdateEntities: retry[[2]string{"default", "non_idempotent"}], + BatchDeleteEntities: retry[[2]string{"default", "idempotent"}], + } +} + +// EntityTypesClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type EntityTypesClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + entityTypesClient dialogflowpb.EntityTypesClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *EntityTypesCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewEntityTypesClient creates a new entity types client. +// +// Entities are extracted from user input and represent parameters that are +// meaningful to your application. For example, a date range, a proper name +// such as a geographic location or landmark, and so on. Entities represent +// actionable data for your application. +// +// When you define an entity, you can also include synonyms that all map to +// that entity. For example, "soft drink", "soda", "pop", and so on. +// +// There are three types of entities: +// +// * **System** - entities that are defined by the Dialogflow API for common +// data types such as date, time, currency, and so on. A system entity is +// represented by the `EntityType` type. +// +// * **Developer** - entities that are defined by you that represent +// actionable data that is meaningful to your application. For example, +// you could define a `pizza.sauce` entity for red or white pizza sauce, +// a `pizza.cheese` entity for the different types of cheese on a pizza, +// a `pizza.topping` entity for different toppings, and so on. A developer +// entity is represented by the `EntityType` type. +// +// * **User** - entities that are built for an individual user such as +// favorites, preferences, playlists, and so on. A user entity is +// represented by the [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] type. +// +// For more information about entity types, see the +// [Dialogflow documentation](https://dialogflow.com/docs/entities). +func NewEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*EntityTypesClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultEntityTypesClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &EntityTypesClient{ + conn: conn, + CallOptions: defaultEntityTypesCallOptions(), + + entityTypesClient: dialogflowpb.NewEntityTypesClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *EntityTypesClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *EntityTypesClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *EntityTypesClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListEntityTypes returns the list of all entity types in the specified agent. +func (c *EntityTypesClient) ListEntityTypes(ctx context.Context, req *dialogflowpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListEntityTypes[0:len(c.CallOptions.ListEntityTypes):len(c.CallOptions.ListEntityTypes)], opts...) + it := &EntityTypeIterator{} + req = proto.Clone(req).(*dialogflowpb.ListEntityTypesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.EntityType, string, error) { + var resp *dialogflowpb.ListEntityTypesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.entityTypesClient.ListEntityTypes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.EntityTypes, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetEntityType retrieves the specified entity type. +func (c *EntityTypesClient) GetEntityType(ctx context.Context, req *dialogflowpb.GetEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetEntityType[0:len(c.CallOptions.GetEntityType):len(c.CallOptions.GetEntityType)], opts...) + var resp *dialogflowpb.EntityType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.entityTypesClient.GetEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateEntityType creates an entity type in the specified agent. +func (c *EntityTypesClient) CreateEntityType(ctx context.Context, req *dialogflowpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateEntityType[0:len(c.CallOptions.CreateEntityType):len(c.CallOptions.CreateEntityType)], opts...) + var resp *dialogflowpb.EntityType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.entityTypesClient.CreateEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateEntityType updates the specified entity type. +func (c *EntityTypesClient) UpdateEntityType(ctx context.Context, req *dialogflowpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateEntityType[0:len(c.CallOptions.UpdateEntityType):len(c.CallOptions.UpdateEntityType)], opts...) + var resp *dialogflowpb.EntityType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.entityTypesClient.UpdateEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteEntityType deletes the specified entity type. +func (c *EntityTypesClient) DeleteEntityType(ctx context.Context, req *dialogflowpb.DeleteEntityTypeRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteEntityType[0:len(c.CallOptions.DeleteEntityType):len(c.CallOptions.DeleteEntityType)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.entityTypesClient.DeleteEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// BatchUpdateEntityTypes updates/Creates multiple entity types in the specified agent. +// +// Operation +func (c *EntityTypesClient) BatchUpdateEntityTypes(ctx context.Context, req *dialogflowpb.BatchUpdateEntityTypesRequest, opts ...gax.CallOption) (*BatchUpdateEntityTypesOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchUpdateEntityTypes[0:len(c.CallOptions.BatchUpdateEntityTypes):len(c.CallOptions.BatchUpdateEntityTypes)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.entityTypesClient.BatchUpdateEntityTypes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &BatchUpdateEntityTypesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// BatchDeleteEntityTypes deletes entity types in the specified agent. +// +// Operation +func (c *EntityTypesClient) BatchDeleteEntityTypes(ctx context.Context, req *dialogflowpb.BatchDeleteEntityTypesRequest, opts ...gax.CallOption) (*BatchDeleteEntityTypesOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchDeleteEntityTypes[0:len(c.CallOptions.BatchDeleteEntityTypes):len(c.CallOptions.BatchDeleteEntityTypes)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.entityTypesClient.BatchDeleteEntityTypes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &BatchDeleteEntityTypesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// BatchCreateEntities creates multiple new entities in the specified entity type (extends the +// existing collection of entries). +// +// Operation +func (c *EntityTypesClient) BatchCreateEntities(ctx context.Context, req *dialogflowpb.BatchCreateEntitiesRequest, opts ...gax.CallOption) (*BatchCreateEntitiesOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchCreateEntities[0:len(c.CallOptions.BatchCreateEntities):len(c.CallOptions.BatchCreateEntities)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.entityTypesClient.BatchCreateEntities(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &BatchCreateEntitiesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// BatchUpdateEntities updates entities in the specified entity type (replaces the existing +// collection of entries). +// +// Operation +func (c *EntityTypesClient) BatchUpdateEntities(ctx context.Context, req *dialogflowpb.BatchUpdateEntitiesRequest, opts ...gax.CallOption) (*BatchUpdateEntitiesOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchUpdateEntities[0:len(c.CallOptions.BatchUpdateEntities):len(c.CallOptions.BatchUpdateEntities)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.entityTypesClient.BatchUpdateEntities(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &BatchUpdateEntitiesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// BatchDeleteEntities deletes entities in the specified entity type. +// +// Operation +func (c *EntityTypesClient) BatchDeleteEntities(ctx context.Context, req *dialogflowpb.BatchDeleteEntitiesRequest, opts ...gax.CallOption) (*BatchDeleteEntitiesOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchDeleteEntities[0:len(c.CallOptions.BatchDeleteEntities):len(c.CallOptions.BatchDeleteEntities)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.entityTypesClient.BatchDeleteEntities(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &BatchDeleteEntitiesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// EntityTypeIterator manages a stream of *dialogflowpb.EntityType. +type EntityTypeIterator struct { + items []*dialogflowpb.EntityType + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.EntityType, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *EntityTypeIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *EntityTypeIterator) Next() (*dialogflowpb.EntityType, error) { + var item *dialogflowpb.EntityType + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *EntityTypeIterator) bufLen() int { + return len(it.items) +} + +func (it *EntityTypeIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// BatchCreateEntitiesOperation manages a long-running operation from BatchCreateEntities. +type BatchCreateEntitiesOperation struct { + lro *longrunning.Operation +} + +// BatchCreateEntitiesOperation returns a new BatchCreateEntitiesOperation from a given name. +// The name must be that of a previously created BatchCreateEntitiesOperation, possibly from a different process. +func (c *EntityTypesClient) BatchCreateEntitiesOperation(name string) *BatchCreateEntitiesOperation { + return &BatchCreateEntitiesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *BatchCreateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 5000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *BatchCreateEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *BatchCreateEntitiesOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *BatchCreateEntitiesOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *BatchCreateEntitiesOperation) Name() string { + return op.lro.Name() +} + +// BatchDeleteEntitiesOperation manages a long-running operation from BatchDeleteEntities. +type BatchDeleteEntitiesOperation struct { + lro *longrunning.Operation +} + +// BatchDeleteEntitiesOperation returns a new BatchDeleteEntitiesOperation from a given name. +// The name must be that of a previously created BatchDeleteEntitiesOperation, possibly from a different process. +func (c *EntityTypesClient) BatchDeleteEntitiesOperation(name string) *BatchDeleteEntitiesOperation { + return &BatchDeleteEntitiesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *BatchDeleteEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 5000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *BatchDeleteEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *BatchDeleteEntitiesOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *BatchDeleteEntitiesOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *BatchDeleteEntitiesOperation) Name() string { + return op.lro.Name() +} + +// BatchDeleteEntityTypesOperation manages a long-running operation from BatchDeleteEntityTypes. +type BatchDeleteEntityTypesOperation struct { + lro *longrunning.Operation +} + +// BatchDeleteEntityTypesOperation returns a new BatchDeleteEntityTypesOperation from a given name. +// The name must be that of a previously created BatchDeleteEntityTypesOperation, possibly from a different process. +func (c *EntityTypesClient) BatchDeleteEntityTypesOperation(name string) *BatchDeleteEntityTypesOperation { + return &BatchDeleteEntityTypesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *BatchDeleteEntityTypesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 5000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *BatchDeleteEntityTypesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *BatchDeleteEntityTypesOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *BatchDeleteEntityTypesOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *BatchDeleteEntityTypesOperation) Name() string { + return op.lro.Name() +} + +// BatchUpdateEntitiesOperation manages a long-running operation from BatchUpdateEntities. +type BatchUpdateEntitiesOperation struct { + lro *longrunning.Operation +} + +// BatchUpdateEntitiesOperation returns a new BatchUpdateEntitiesOperation from a given name. +// The name must be that of a previously created BatchUpdateEntitiesOperation, possibly from a different process. +func (c *EntityTypesClient) BatchUpdateEntitiesOperation(name string) *BatchUpdateEntitiesOperation { + return &BatchUpdateEntitiesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *BatchUpdateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 5000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *BatchUpdateEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *BatchUpdateEntitiesOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *BatchUpdateEntitiesOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *BatchUpdateEntitiesOperation) Name() string { + return op.lro.Name() +} + +// BatchUpdateEntityTypesOperation manages a long-running operation from BatchUpdateEntityTypes. +type BatchUpdateEntityTypesOperation struct { + lro *longrunning.Operation +} + +// BatchUpdateEntityTypesOperation returns a new BatchUpdateEntityTypesOperation from a given name. +// The name must be that of a previously created BatchUpdateEntityTypesOperation, possibly from a different process. +func (c *EntityTypesClient) BatchUpdateEntityTypesOperation(name string) *BatchUpdateEntityTypesOperation { + return &BatchUpdateEntityTypesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *BatchUpdateEntityTypesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateEntityTypesResponse, error) { + var resp dialogflowpb.BatchUpdateEntityTypesResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 5000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *BatchUpdateEntityTypesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateEntityTypesResponse, error) { + var resp dialogflowpb.BatchUpdateEntityTypesResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *BatchUpdateEntityTypesOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *BatchUpdateEntityTypesOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *BatchUpdateEntityTypesOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/entity_types_client_example_test.go b/vendor/cloud.google.com/go/dialogflow/apiv2/entity_types_client_example_test.go new file mode 100644 index 000000000..4dab88d7e --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/entity_types_client_example_test.go @@ -0,0 +1,228 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewEntityTypesClient() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleEntityTypesClient_ListEntityTypes() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListEntityTypesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListEntityTypes(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleEntityTypesClient_GetEntityType() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetEntityTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleEntityTypesClient_CreateEntityType() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateEntityTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleEntityTypesClient_UpdateEntityType() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.UpdateEntityTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleEntityTypesClient_DeleteEntityType() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DeleteEntityTypeRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleEntityTypesClient_BatchUpdateEntityTypes() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.BatchUpdateEntityTypesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.BatchUpdateEntityTypes(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleEntityTypesClient_BatchDeleteEntityTypes() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.BatchDeleteEntityTypesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.BatchDeleteEntityTypes(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleEntityTypesClient_BatchCreateEntities() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.BatchCreateEntitiesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.BatchCreateEntities(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleEntityTypesClient_BatchUpdateEntities() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.BatchUpdateEntitiesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.BatchUpdateEntities(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleEntityTypesClient_BatchDeleteEntities() { + ctx := context.Background() + c, err := dialogflow.NewEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.BatchDeleteEntitiesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.BatchDeleteEntities(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/intents_client.go b/vendor/cloud.google.com/go/dialogflow/apiv2/intents_client.go new file mode 100644 index 000000000..73f5ed35c --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/intents_client.go @@ -0,0 +1,486 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + structpbpb "github.com/golang/protobuf/ptypes/struct" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// IntentsCallOptions contains the retry settings for each method of IntentsClient. +type IntentsCallOptions struct { + ListIntents []gax.CallOption + GetIntent []gax.CallOption + CreateIntent []gax.CallOption + UpdateIntent []gax.CallOption + DeleteIntent []gax.CallOption + BatchUpdateIntents []gax.CallOption + BatchDeleteIntents []gax.CallOption +} + +func defaultIntentsClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dialogflow.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultIntentsCallOptions() *IntentsCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &IntentsCallOptions{ + ListIntents: retry[[2]string{"default", "idempotent"}], + GetIntent: retry[[2]string{"default", "idempotent"}], + CreateIntent: retry[[2]string{"default", "non_idempotent"}], + UpdateIntent: retry[[2]string{"default", "non_idempotent"}], + DeleteIntent: retry[[2]string{"default", "idempotent"}], + BatchUpdateIntents: retry[[2]string{"default", "non_idempotent"}], + BatchDeleteIntents: retry[[2]string{"default", "idempotent"}], + } +} + +// IntentsClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type IntentsClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + intentsClient dialogflowpb.IntentsClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *IntentsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewIntentsClient creates a new intents client. +// +// An intent represents a mapping between input from a user and an action to +// be taken by your application. When you pass user input to the +// [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or +// [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method, the +// Dialogflow API analyzes the input and searches +// for a matching intent. If no match is found, the Dialogflow API returns a +// fallback intent (`is_fallback` = true). +// +// You can provide additional information for the Dialogflow API to use to +// match user input to an intent by adding the following to your intent. +// +// * **Contexts** - provide additional context for intent analysis. For +// example, if an intent is related to an object in your application that +// plays music, you can provide a context to determine when to match the +// intent if the user input is “turn it off”. You can include a context +// that matches the intent when there is previous user input of +// "play music", and not when there is previous user input of +// "turn on the light". +// +// * **Events** - allow for matching an intent by using an event name +// instead of user input. Your application can provide an event name and +// related parameters to the Dialogflow API to match an intent. For +// example, when your application starts, you can send a welcome event +// with a user name parameter to the Dialogflow API to match an intent with +// a personalized welcome message for the user. +// +// * **Training phrases** - provide examples of user input to train the +// Dialogflow API agent to better match intents. +// +// For more information about intents, see the +// [Dialogflow documentation](https://dialogflow.com/docs/intents). +func NewIntentsClient(ctx context.Context, opts ...option.ClientOption) (*IntentsClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultIntentsClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &IntentsClient{ + conn: conn, + CallOptions: defaultIntentsCallOptions(), + + intentsClient: dialogflowpb.NewIntentsClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *IntentsClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *IntentsClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *IntentsClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListIntents returns the list of all intents in the specified agent. +func (c *IntentsClient) ListIntents(ctx context.Context, req *dialogflowpb.ListIntentsRequest, opts ...gax.CallOption) *IntentIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListIntents[0:len(c.CallOptions.ListIntents):len(c.CallOptions.ListIntents)], opts...) + it := &IntentIterator{} + req = proto.Clone(req).(*dialogflowpb.ListIntentsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.Intent, string, error) { + var resp *dialogflowpb.ListIntentsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.intentsClient.ListIntents(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Intents, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetIntent retrieves the specified intent. +func (c *IntentsClient) GetIntent(ctx context.Context, req *dialogflowpb.GetIntentRequest, opts ...gax.CallOption) (*dialogflowpb.Intent, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetIntent[0:len(c.CallOptions.GetIntent):len(c.CallOptions.GetIntent)], opts...) + var resp *dialogflowpb.Intent + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.intentsClient.GetIntent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateIntent creates an intent in the specified agent. +func (c *IntentsClient) CreateIntent(ctx context.Context, req *dialogflowpb.CreateIntentRequest, opts ...gax.CallOption) (*dialogflowpb.Intent, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateIntent[0:len(c.CallOptions.CreateIntent):len(c.CallOptions.CreateIntent)], opts...) + var resp *dialogflowpb.Intent + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.intentsClient.CreateIntent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateIntent updates the specified intent. +func (c *IntentsClient) UpdateIntent(ctx context.Context, req *dialogflowpb.UpdateIntentRequest, opts ...gax.CallOption) (*dialogflowpb.Intent, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateIntent[0:len(c.CallOptions.UpdateIntent):len(c.CallOptions.UpdateIntent)], opts...) + var resp *dialogflowpb.Intent + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.intentsClient.UpdateIntent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteIntent deletes the specified intent. +func (c *IntentsClient) DeleteIntent(ctx context.Context, req *dialogflowpb.DeleteIntentRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteIntent[0:len(c.CallOptions.DeleteIntent):len(c.CallOptions.DeleteIntent)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.intentsClient.DeleteIntent(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// BatchUpdateIntents updates/Creates multiple intents in the specified agent. +// +// Operation +func (c *IntentsClient) BatchUpdateIntents(ctx context.Context, req *dialogflowpb.BatchUpdateIntentsRequest, opts ...gax.CallOption) (*BatchUpdateIntentsOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchUpdateIntents[0:len(c.CallOptions.BatchUpdateIntents):len(c.CallOptions.BatchUpdateIntents)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.intentsClient.BatchUpdateIntents(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &BatchUpdateIntentsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// BatchDeleteIntents deletes intents in the specified agent. +// +// Operation +func (c *IntentsClient) BatchDeleteIntents(ctx context.Context, req *dialogflowpb.BatchDeleteIntentsRequest, opts ...gax.CallOption) (*BatchDeleteIntentsOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchDeleteIntents[0:len(c.CallOptions.BatchDeleteIntents):len(c.CallOptions.BatchDeleteIntents)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.intentsClient.BatchDeleteIntents(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &BatchDeleteIntentsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// IntentIterator manages a stream of *dialogflowpb.Intent. +type IntentIterator struct { + items []*dialogflowpb.Intent + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.Intent, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *IntentIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *IntentIterator) Next() (*dialogflowpb.Intent, error) { + var item *dialogflowpb.Intent + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *IntentIterator) bufLen() int { + return len(it.items) +} + +func (it *IntentIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// BatchDeleteIntentsOperation manages a long-running operation from BatchDeleteIntents. +type BatchDeleteIntentsOperation struct { + lro *longrunning.Operation +} + +// BatchDeleteIntentsOperation returns a new BatchDeleteIntentsOperation from a given name. +// The name must be that of a previously created BatchDeleteIntentsOperation, possibly from a different process. +func (c *IntentsClient) BatchDeleteIntentsOperation(name string) *BatchDeleteIntentsOperation { + return &BatchDeleteIntentsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *BatchDeleteIntentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 5000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *BatchDeleteIntentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *BatchDeleteIntentsOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *BatchDeleteIntentsOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *BatchDeleteIntentsOperation) Name() string { + return op.lro.Name() +} + +// BatchUpdateIntentsOperation manages a long-running operation from BatchUpdateIntents. +type BatchUpdateIntentsOperation struct { + lro *longrunning.Operation +} + +// BatchUpdateIntentsOperation returns a new BatchUpdateIntentsOperation from a given name. +// The name must be that of a previously created BatchUpdateIntentsOperation, possibly from a different process. +func (c *IntentsClient) BatchUpdateIntentsOperation(name string) *BatchUpdateIntentsOperation { + return &BatchUpdateIntentsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *BatchUpdateIntentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateIntentsResponse, error) { + var resp dialogflowpb.BatchUpdateIntentsResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 5000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *BatchUpdateIntentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateIntentsResponse, error) { + var resp dialogflowpb.BatchUpdateIntentsResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *BatchUpdateIntentsOperation) Metadata() (*structpbpb.Struct, error) { + var meta structpbpb.Struct + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *BatchUpdateIntentsOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *BatchUpdateIntentsOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/intents_client_example_test.go b/vendor/cloud.google.com/go/dialogflow/apiv2/intents_client_example_test.go new file mode 100644 index 000000000..bedb628f4 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/intents_client_example_test.go @@ -0,0 +1,171 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewIntentsClient() { + ctx := context.Background() + c, err := dialogflow.NewIntentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleIntentsClient_ListIntents() { + ctx := context.Background() + c, err := dialogflow.NewIntentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListIntentsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListIntents(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleIntentsClient_GetIntent() { + ctx := context.Background() + c, err := dialogflow.NewIntentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetIntentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIntent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIntentsClient_CreateIntent() { + ctx := context.Background() + c, err := dialogflow.NewIntentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateIntentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateIntent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIntentsClient_UpdateIntent() { + ctx := context.Background() + c, err := dialogflow.NewIntentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.UpdateIntentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateIntent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIntentsClient_DeleteIntent() { + ctx := context.Background() + c, err := dialogflow.NewIntentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DeleteIntentRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteIntent(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleIntentsClient_BatchUpdateIntents() { + ctx := context.Background() + c, err := dialogflow.NewIntentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.BatchUpdateIntentsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.BatchUpdateIntents(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIntentsClient_BatchDeleteIntents() { + ctx := context.Background() + c, err := dialogflow.NewIntentsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.BatchDeleteIntentsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.BatchDeleteIntents(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/mock_test.go b/vendor/cloud.google.com/go/dialogflow/apiv2/mock_test.go new file mode 100644 index 000000000..2d58fe960 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/mock_test.go @@ -0,0 +1,3149 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockAgentsServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dialogflowpb.AgentsServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockAgentsServer) GetAgent(ctx context.Context, req *dialogflowpb.GetAgentRequest) (*dialogflowpb.Agent, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.Agent), nil +} + +func (s *mockAgentsServer) SearchAgents(ctx context.Context, req *dialogflowpb.SearchAgentsRequest) (*dialogflowpb.SearchAgentsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.SearchAgentsResponse), nil +} + +func (s *mockAgentsServer) TrainAgent(ctx context.Context, req *dialogflowpb.TrainAgentRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockAgentsServer) ExportAgent(ctx context.Context, req *dialogflowpb.ExportAgentRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockAgentsServer) ImportAgent(ctx context.Context, req *dialogflowpb.ImportAgentRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockAgentsServer) RestoreAgent(ctx context.Context, req *dialogflowpb.RestoreAgentRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +type mockContextsServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dialogflowpb.ContextsServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockContextsServer) ListContexts(ctx context.Context, req *dialogflowpb.ListContextsRequest) (*dialogflowpb.ListContextsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.ListContextsResponse), nil +} + +func (s *mockContextsServer) GetContext(ctx context.Context, req *dialogflowpb.GetContextRequest) (*dialogflowpb.Context, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.Context), nil +} + +func (s *mockContextsServer) CreateContext(ctx context.Context, req *dialogflowpb.CreateContextRequest) (*dialogflowpb.Context, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.Context), nil +} + +func (s *mockContextsServer) UpdateContext(ctx context.Context, req *dialogflowpb.UpdateContextRequest) (*dialogflowpb.Context, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.Context), nil +} + +func (s *mockContextsServer) DeleteContext(ctx context.Context, req *dialogflowpb.DeleteContextRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockContextsServer) DeleteAllContexts(ctx context.Context, req *dialogflowpb.DeleteAllContextsRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +type mockEntityTypesServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dialogflowpb.EntityTypesServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockEntityTypesServer) ListEntityTypes(ctx context.Context, req *dialogflowpb.ListEntityTypesRequest) (*dialogflowpb.ListEntityTypesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.ListEntityTypesResponse), nil +} + +func (s *mockEntityTypesServer) GetEntityType(ctx context.Context, req *dialogflowpb.GetEntityTypeRequest) (*dialogflowpb.EntityType, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.EntityType), nil +} + +func (s *mockEntityTypesServer) CreateEntityType(ctx context.Context, req *dialogflowpb.CreateEntityTypeRequest) (*dialogflowpb.EntityType, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.EntityType), nil +} + +func (s *mockEntityTypesServer) UpdateEntityType(ctx context.Context, req *dialogflowpb.UpdateEntityTypeRequest) (*dialogflowpb.EntityType, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.EntityType), nil +} + +func (s *mockEntityTypesServer) DeleteEntityType(ctx context.Context, req *dialogflowpb.DeleteEntityTypeRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockEntityTypesServer) BatchUpdateEntityTypes(ctx context.Context, req *dialogflowpb.BatchUpdateEntityTypesRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockEntityTypesServer) BatchDeleteEntityTypes(ctx context.Context, req *dialogflowpb.BatchDeleteEntityTypesRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockEntityTypesServer) BatchCreateEntities(ctx context.Context, req *dialogflowpb.BatchCreateEntitiesRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockEntityTypesServer) BatchUpdateEntities(ctx context.Context, req *dialogflowpb.BatchUpdateEntitiesRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockEntityTypesServer) BatchDeleteEntities(ctx context.Context, req *dialogflowpb.BatchDeleteEntitiesRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +type mockIntentsServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dialogflowpb.IntentsServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockIntentsServer) ListIntents(ctx context.Context, req *dialogflowpb.ListIntentsRequest) (*dialogflowpb.ListIntentsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.ListIntentsResponse), nil +} + +func (s *mockIntentsServer) GetIntent(ctx context.Context, req *dialogflowpb.GetIntentRequest) (*dialogflowpb.Intent, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.Intent), nil +} + +func (s *mockIntentsServer) CreateIntent(ctx context.Context, req *dialogflowpb.CreateIntentRequest) (*dialogflowpb.Intent, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.Intent), nil +} + +func (s *mockIntentsServer) UpdateIntent(ctx context.Context, req *dialogflowpb.UpdateIntentRequest) (*dialogflowpb.Intent, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.Intent), nil +} + +func (s *mockIntentsServer) DeleteIntent(ctx context.Context, req *dialogflowpb.DeleteIntentRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockIntentsServer) BatchUpdateIntents(ctx context.Context, req *dialogflowpb.BatchUpdateIntentsRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockIntentsServer) BatchDeleteIntents(ctx context.Context, req *dialogflowpb.BatchDeleteIntentsRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +type mockSessionEntityTypesServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dialogflowpb.SessionEntityTypesServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockSessionEntityTypesServer) ListSessionEntityTypes(ctx context.Context, req *dialogflowpb.ListSessionEntityTypesRequest) (*dialogflowpb.ListSessionEntityTypesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.ListSessionEntityTypesResponse), nil +} + +func (s *mockSessionEntityTypesServer) GetSessionEntityType(ctx context.Context, req *dialogflowpb.GetSessionEntityTypeRequest) (*dialogflowpb.SessionEntityType, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.SessionEntityType), nil +} + +func (s *mockSessionEntityTypesServer) CreateSessionEntityType(ctx context.Context, req *dialogflowpb.CreateSessionEntityTypeRequest) (*dialogflowpb.SessionEntityType, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.SessionEntityType), nil +} + +func (s *mockSessionEntityTypesServer) UpdateSessionEntityType(ctx context.Context, req *dialogflowpb.UpdateSessionEntityTypeRequest) (*dialogflowpb.SessionEntityType, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.SessionEntityType), nil +} + +func (s *mockSessionEntityTypesServer) DeleteSessionEntityType(ctx context.Context, req *dialogflowpb.DeleteSessionEntityTypeRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +type mockSessionsServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dialogflowpb.SessionsServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockSessionsServer) DetectIntent(ctx context.Context, req *dialogflowpb.DetectIntentRequest) (*dialogflowpb.DetectIntentResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dialogflowpb.DetectIntentResponse), nil +} + +func (s *mockSessionsServer) StreamingDetectIntent(stream dialogflowpb.Sessions_StreamingDetectIntentServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + for { + if req, err := stream.Recv(); err == io.EOF { + break + } else if err != nil { + return err + } else { + s.reqs = append(s.reqs, req) + } + } + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*dialogflowpb.StreamingDetectIntentResponse)); err != nil { + return err + } + } + return nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockAgents mockAgentsServer + mockContexts mockContextsServer + mockEntityTypes mockEntityTypesServer + mockIntents mockIntentsServer + mockSessionEntityTypes mockSessionEntityTypesServer + mockSessions mockSessionsServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + dialogflowpb.RegisterAgentsServer(serv, &mockAgents) + dialogflowpb.RegisterContextsServer(serv, &mockContexts) + dialogflowpb.RegisterEntityTypesServer(serv, &mockEntityTypes) + dialogflowpb.RegisterIntentsServer(serv, &mockIntents) + dialogflowpb.RegisterSessionEntityTypesServer(serv, &mockSessionEntityTypes) + dialogflowpb.RegisterSessionsServer(serv, &mockSessions) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestAgentsGetAgent(t *testing.T) { + var parent2 string = "parent21175163357" + var displayName string = "displayName1615086568" + var defaultLanguageCode string = "defaultLanguageCode856575222" + var timeZone string = "timeZone36848094" + var description string = "description-1724546052" + var avatarUri string = "avatarUri-402824826" + var enableLogging bool = false + var classificationThreshold float32 = 1.11581064E8 + var expectedResponse = &dialogflowpb.Agent{ + Parent: parent2, + DisplayName: displayName, + DefaultLanguageCode: defaultLanguageCode, + TimeZone: timeZone, + Description: description, + AvatarUri: avatarUri, + EnableLogging: enableLogging, + ClassificationThreshold: classificationThreshold, + } + + mockAgents.err = nil + mockAgents.reqs = nil + + mockAgents.resps = append(mockAgents.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.GetAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetAgent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAgents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAgentsGetAgentError(t *testing.T) { + errCode := codes.PermissionDenied + mockAgents.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.GetAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetAgent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestAgentsSearchAgents(t *testing.T) { + var nextPageToken string = "" + var agentsElement *dialogflowpb.Agent = &dialogflowpb.Agent{} + var agents = []*dialogflowpb.Agent{agentsElement} + var expectedResponse = &dialogflowpb.SearchAgentsResponse{ + NextPageToken: nextPageToken, + Agents: agents, + } + + mockAgents.err = nil + mockAgents.reqs = nil + + mockAgents.resps = append(mockAgents.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.SearchAgentsRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SearchAgents(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAgents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Agents[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAgentsSearchAgentsError(t *testing.T) { + errCode := codes.PermissionDenied + mockAgents.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.SearchAgentsRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SearchAgents(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestAgentsTrainAgent(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockAgents.err = nil + mockAgents.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockAgents.resps = append(mockAgents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.TrainAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.TrainAgent(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAgents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestAgentsTrainAgentError(t *testing.T) { + errCode := codes.PermissionDenied + mockAgents.err = nil + mockAgents.resps = append(mockAgents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.TrainAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.TrainAgent(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestAgentsExportAgent(t *testing.T) { + var agentUri string = "agentUri-1700713166" + var expectedResponse = &dialogflowpb.ExportAgentResponse{ + Agent: &dialogflowpb.ExportAgentResponse_AgentUri{ + AgentUri: agentUri, + }, + } + + mockAgents.err = nil + mockAgents.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockAgents.resps = append(mockAgents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.ExportAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ExportAgent(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAgents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAgentsExportAgentError(t *testing.T) { + errCode := codes.PermissionDenied + mockAgents.err = nil + mockAgents.resps = append(mockAgents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.ExportAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ExportAgent(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestAgentsImportAgent(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockAgents.err = nil + mockAgents.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockAgents.resps = append(mockAgents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.ImportAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ImportAgent(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAgents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestAgentsImportAgentError(t *testing.T) { + errCode := codes.PermissionDenied + mockAgents.err = nil + mockAgents.resps = append(mockAgents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.ImportAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ImportAgent(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestAgentsRestoreAgent(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockAgents.err = nil + mockAgents.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockAgents.resps = append(mockAgents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.RestoreAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.RestoreAgent(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAgents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestAgentsRestoreAgentError(t *testing.T) { + errCode := codes.PermissionDenied + mockAgents.err = nil + mockAgents.resps = append(mockAgents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dialogflowpb.RestoreAgentRequest{ + Parent: formattedParent, + } + + c, err := NewAgentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.RestoreAgent(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestContextsListContexts(t *testing.T) { + var nextPageToken string = "" + var contextsElement *dialogflowpb.Context = &dialogflowpb.Context{} + var contexts = []*dialogflowpb.Context{contextsElement} + var expectedResponse = &dialogflowpb.ListContextsResponse{ + NextPageToken: nextPageToken, + Contexts: contexts, + } + + mockContexts.err = nil + mockContexts.reqs = nil + + mockContexts.resps = append(mockContexts.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var request = &dialogflowpb.ListContextsRequest{ + Parent: formattedParent, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListContexts(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContexts.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Contexts[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContextsListContextsError(t *testing.T) { + errCode := codes.PermissionDenied + mockContexts.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var request = &dialogflowpb.ListContextsRequest{ + Parent: formattedParent, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListContexts(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestContextsGetContext(t *testing.T) { + var name2 string = "name2-1052831874" + var lifespanCount int32 = 1178775510 + var expectedResponse = &dialogflowpb.Context{ + Name: name2, + LifespanCount: lifespanCount, + } + + mockContexts.err = nil + mockContexts.reqs = nil + + mockContexts.resps = append(mockContexts.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/agent/sessions/%s/contexts/%s", "[PROJECT]", "[SESSION]", "[CONTEXT]") + var request = &dialogflowpb.GetContextRequest{ + Name: formattedName, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetContext(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContexts.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContextsGetContextError(t *testing.T) { + errCode := codes.PermissionDenied + mockContexts.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/agent/sessions/%s/contexts/%s", "[PROJECT]", "[SESSION]", "[CONTEXT]") + var request = &dialogflowpb.GetContextRequest{ + Name: formattedName, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetContext(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestContextsCreateContext(t *testing.T) { + var name string = "name3373707" + var lifespanCount int32 = 1178775510 + var expectedResponse = &dialogflowpb.Context{ + Name: name, + LifespanCount: lifespanCount, + } + + mockContexts.err = nil + mockContexts.reqs = nil + + mockContexts.resps = append(mockContexts.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var context_ *dialogflowpb.Context = &dialogflowpb.Context{} + var request = &dialogflowpb.CreateContextRequest{ + Parent: formattedParent, + Context: context_, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateContext(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContexts.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContextsCreateContextError(t *testing.T) { + errCode := codes.PermissionDenied + mockContexts.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var context_ *dialogflowpb.Context = &dialogflowpb.Context{} + var request = &dialogflowpb.CreateContextRequest{ + Parent: formattedParent, + Context: context_, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateContext(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestContextsUpdateContext(t *testing.T) { + var name string = "name3373707" + var lifespanCount int32 = 1178775510 + var expectedResponse = &dialogflowpb.Context{ + Name: name, + LifespanCount: lifespanCount, + } + + mockContexts.err = nil + mockContexts.reqs = nil + + mockContexts.resps = append(mockContexts.resps[:0], expectedResponse) + + var context_ *dialogflowpb.Context = &dialogflowpb.Context{} + var request = &dialogflowpb.UpdateContextRequest{ + Context: context_, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateContext(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContexts.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestContextsUpdateContextError(t *testing.T) { + errCode := codes.PermissionDenied + mockContexts.err = gstatus.Error(errCode, "test error") + + var context_ *dialogflowpb.Context = &dialogflowpb.Context{} + var request = &dialogflowpb.UpdateContextRequest{ + Context: context_, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateContext(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestContextsDeleteContext(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockContexts.err = nil + mockContexts.reqs = nil + + mockContexts.resps = append(mockContexts.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/agent/sessions/%s/contexts/%s", "[PROJECT]", "[SESSION]", "[CONTEXT]") + var request = &dialogflowpb.DeleteContextRequest{ + Name: formattedName, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteContext(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContexts.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestContextsDeleteContextError(t *testing.T) { + errCode := codes.PermissionDenied + mockContexts.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/agent/sessions/%s/contexts/%s", "[PROJECT]", "[SESSION]", "[CONTEXT]") + var request = &dialogflowpb.DeleteContextRequest{ + Name: formattedName, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteContext(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestContextsDeleteAllContexts(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockContexts.err = nil + mockContexts.reqs = nil + + mockContexts.resps = append(mockContexts.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var request = &dialogflowpb.DeleteAllContextsRequest{ + Parent: formattedParent, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteAllContexts(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockContexts.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestContextsDeleteAllContextsError(t *testing.T) { + errCode := codes.PermissionDenied + mockContexts.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var request = &dialogflowpb.DeleteAllContextsRequest{ + Parent: formattedParent, + } + + c, err := NewContextsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteAllContexts(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestEntityTypesListEntityTypes(t *testing.T) { + var nextPageToken string = "" + var entityTypesElement *dialogflowpb.EntityType = &dialogflowpb.EntityType{} + var entityTypes = []*dialogflowpb.EntityType{entityTypesElement} + var expectedResponse = &dialogflowpb.ListEntityTypesResponse{ + NextPageToken: nextPageToken, + EntityTypes: entityTypes, + } + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var request = &dialogflowpb.ListEntityTypesRequest{ + Parent: formattedParent, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListEntityTypes(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.EntityTypes[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestEntityTypesListEntityTypesError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var request = &dialogflowpb.ListEntityTypesRequest{ + Parent: formattedParent, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListEntityTypes(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestEntityTypesGetEntityType(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var expectedResponse = &dialogflowpb.EntityType{ + Name: name2, + DisplayName: displayName, + } + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var request = &dialogflowpb.GetEntityTypeRequest{ + Name: formattedName, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetEntityType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestEntityTypesGetEntityTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var request = &dialogflowpb.GetEntityTypeRequest{ + Name: formattedName, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetEntityType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestEntityTypesCreateEntityType(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var expectedResponse = &dialogflowpb.EntityType{ + Name: name, + DisplayName: displayName, + } + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var entityType *dialogflowpb.EntityType = &dialogflowpb.EntityType{} + var request = &dialogflowpb.CreateEntityTypeRequest{ + Parent: formattedParent, + EntityType: entityType, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateEntityType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestEntityTypesCreateEntityTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var entityType *dialogflowpb.EntityType = &dialogflowpb.EntityType{} + var request = &dialogflowpb.CreateEntityTypeRequest{ + Parent: formattedParent, + EntityType: entityType, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateEntityType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestEntityTypesUpdateEntityType(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var expectedResponse = &dialogflowpb.EntityType{ + Name: name, + DisplayName: displayName, + } + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], expectedResponse) + + var entityType *dialogflowpb.EntityType = &dialogflowpb.EntityType{} + var request = &dialogflowpb.UpdateEntityTypeRequest{ + EntityType: entityType, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateEntityType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestEntityTypesUpdateEntityTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = gstatus.Error(errCode, "test error") + + var entityType *dialogflowpb.EntityType = &dialogflowpb.EntityType{} + var request = &dialogflowpb.UpdateEntityTypeRequest{ + EntityType: entityType, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateEntityType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestEntityTypesDeleteEntityType(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var request = &dialogflowpb.DeleteEntityTypeRequest{ + Name: formattedName, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteEntityType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestEntityTypesDeleteEntityTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var request = &dialogflowpb.DeleteEntityTypeRequest{ + Name: formattedName, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteEntityType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestEntityTypesBatchUpdateEntityTypes(t *testing.T) { + var expectedResponse *dialogflowpb.BatchUpdateEntityTypesResponse = &dialogflowpb.BatchUpdateEntityTypesResponse{} + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var request = &dialogflowpb.BatchUpdateEntityTypesRequest{ + Parent: formattedParent, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchUpdateEntityTypes(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestEntityTypesBatchUpdateEntityTypesError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = nil + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var request = &dialogflowpb.BatchUpdateEntityTypesRequest{ + Parent: formattedParent, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchUpdateEntityTypes(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestEntityTypesBatchDeleteEntityTypes(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var entityTypeNames []string = nil + var request = &dialogflowpb.BatchDeleteEntityTypesRequest{ + Parent: formattedParent, + EntityTypeNames: entityTypeNames, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchDeleteEntityTypes(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestEntityTypesBatchDeleteEntityTypesError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = nil + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var entityTypeNames []string = nil + var request = &dialogflowpb.BatchDeleteEntityTypesRequest{ + Parent: formattedParent, + EntityTypeNames: entityTypeNames, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchDeleteEntityTypes(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestEntityTypesBatchCreateEntities(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var entities []*dialogflowpb.EntityType_Entity = nil + var request = &dialogflowpb.BatchCreateEntitiesRequest{ + Parent: formattedParent, + Entities: entities, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchCreateEntities(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestEntityTypesBatchCreateEntitiesError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = nil + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var entities []*dialogflowpb.EntityType_Entity = nil + var request = &dialogflowpb.BatchCreateEntitiesRequest{ + Parent: formattedParent, + Entities: entities, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchCreateEntities(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestEntityTypesBatchUpdateEntities(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var entities []*dialogflowpb.EntityType_Entity = nil + var request = &dialogflowpb.BatchUpdateEntitiesRequest{ + Parent: formattedParent, + Entities: entities, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchUpdateEntities(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestEntityTypesBatchUpdateEntitiesError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = nil + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var entities []*dialogflowpb.EntityType_Entity = nil + var request = &dialogflowpb.BatchUpdateEntitiesRequest{ + Parent: formattedParent, + Entities: entities, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchUpdateEntities(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestEntityTypesBatchDeleteEntities(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockEntityTypes.err = nil + mockEntityTypes.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var entityValues []string = nil + var request = &dialogflowpb.BatchDeleteEntitiesRequest{ + Parent: formattedParent, + EntityValues: entityValues, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchDeleteEntities(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestEntityTypesBatchDeleteEntitiesError(t *testing.T) { + errCode := codes.PermissionDenied + mockEntityTypes.err = nil + mockEntityTypes.resps = append(mockEntityTypes.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/entityTypes/%s", "[PROJECT]", "[ENTITY_TYPE]") + var entityValues []string = nil + var request = &dialogflowpb.BatchDeleteEntitiesRequest{ + Parent: formattedParent, + EntityValues: entityValues, + } + + c, err := NewEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchDeleteEntities(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestIntentsListIntents(t *testing.T) { + var nextPageToken string = "" + var intentsElement *dialogflowpb.Intent = &dialogflowpb.Intent{} + var intents = []*dialogflowpb.Intent{intentsElement} + var expectedResponse = &dialogflowpb.ListIntentsResponse{ + NextPageToken: nextPageToken, + Intents: intents, + } + + mockIntents.err = nil + mockIntents.reqs = nil + + mockIntents.resps = append(mockIntents.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var request = &dialogflowpb.ListIntentsRequest{ + Parent: formattedParent, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListIntents(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIntents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Intents[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIntentsListIntentsError(t *testing.T) { + errCode := codes.PermissionDenied + mockIntents.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var request = &dialogflowpb.ListIntentsRequest{ + Parent: formattedParent, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListIntents(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIntentsGetIntent(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var priority int32 = 1165461084 + var isFallback bool = false + var mlDisabled bool = true + var action string = "action-1422950858" + var resetContexts bool = true + var rootFollowupIntentName string = "rootFollowupIntentName402253784" + var parentFollowupIntentName string = "parentFollowupIntentName-1131901680" + var expectedResponse = &dialogflowpb.Intent{ + Name: name2, + DisplayName: displayName, + Priority: priority, + IsFallback: isFallback, + MlDisabled: mlDisabled, + Action: action, + ResetContexts: resetContexts, + RootFollowupIntentName: rootFollowupIntentName, + ParentFollowupIntentName: parentFollowupIntentName, + } + + mockIntents.err = nil + mockIntents.reqs = nil + + mockIntents.resps = append(mockIntents.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/agent/intents/%s", "[PROJECT]", "[INTENT]") + var request = &dialogflowpb.GetIntentRequest{ + Name: formattedName, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIntent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIntents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIntentsGetIntentError(t *testing.T) { + errCode := codes.PermissionDenied + mockIntents.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/agent/intents/%s", "[PROJECT]", "[INTENT]") + var request = &dialogflowpb.GetIntentRequest{ + Name: formattedName, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIntent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIntentsCreateIntent(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var priority int32 = 1165461084 + var isFallback bool = false + var mlDisabled bool = true + var action string = "action-1422950858" + var resetContexts bool = true + var rootFollowupIntentName string = "rootFollowupIntentName402253784" + var parentFollowupIntentName string = "parentFollowupIntentName-1131901680" + var expectedResponse = &dialogflowpb.Intent{ + Name: name, + DisplayName: displayName, + Priority: priority, + IsFallback: isFallback, + MlDisabled: mlDisabled, + Action: action, + ResetContexts: resetContexts, + RootFollowupIntentName: rootFollowupIntentName, + ParentFollowupIntentName: parentFollowupIntentName, + } + + mockIntents.err = nil + mockIntents.reqs = nil + + mockIntents.resps = append(mockIntents.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var intent *dialogflowpb.Intent = &dialogflowpb.Intent{} + var request = &dialogflowpb.CreateIntentRequest{ + Parent: formattedParent, + Intent: intent, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateIntent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIntents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIntentsCreateIntentError(t *testing.T) { + errCode := codes.PermissionDenied + mockIntents.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var intent *dialogflowpb.Intent = &dialogflowpb.Intent{} + var request = &dialogflowpb.CreateIntentRequest{ + Parent: formattedParent, + Intent: intent, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateIntent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIntentsUpdateIntent(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var priority int32 = 1165461084 + var isFallback bool = false + var mlDisabled bool = true + var action string = "action-1422950858" + var resetContexts bool = true + var rootFollowupIntentName string = "rootFollowupIntentName402253784" + var parentFollowupIntentName string = "parentFollowupIntentName-1131901680" + var expectedResponse = &dialogflowpb.Intent{ + Name: name, + DisplayName: displayName, + Priority: priority, + IsFallback: isFallback, + MlDisabled: mlDisabled, + Action: action, + ResetContexts: resetContexts, + RootFollowupIntentName: rootFollowupIntentName, + ParentFollowupIntentName: parentFollowupIntentName, + } + + mockIntents.err = nil + mockIntents.reqs = nil + + mockIntents.resps = append(mockIntents.resps[:0], expectedResponse) + + var intent *dialogflowpb.Intent = &dialogflowpb.Intent{} + var languageCode string = "languageCode-412800396" + var request = &dialogflowpb.UpdateIntentRequest{ + Intent: intent, + LanguageCode: languageCode, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateIntent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIntents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIntentsUpdateIntentError(t *testing.T) { + errCode := codes.PermissionDenied + mockIntents.err = gstatus.Error(errCode, "test error") + + var intent *dialogflowpb.Intent = &dialogflowpb.Intent{} + var languageCode string = "languageCode-412800396" + var request = &dialogflowpb.UpdateIntentRequest{ + Intent: intent, + LanguageCode: languageCode, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateIntent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIntentsDeleteIntent(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockIntents.err = nil + mockIntents.reqs = nil + + mockIntents.resps = append(mockIntents.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/agent/intents/%s", "[PROJECT]", "[INTENT]") + var request = &dialogflowpb.DeleteIntentRequest{ + Name: formattedName, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteIntent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIntents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestIntentsDeleteIntentError(t *testing.T) { + errCode := codes.PermissionDenied + mockIntents.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/agent/intents/%s", "[PROJECT]", "[INTENT]") + var request = &dialogflowpb.DeleteIntentRequest{ + Name: formattedName, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteIntent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestIntentsBatchUpdateIntents(t *testing.T) { + var expectedResponse *dialogflowpb.BatchUpdateIntentsResponse = &dialogflowpb.BatchUpdateIntentsResponse{} + + mockIntents.err = nil + mockIntents.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockIntents.resps = append(mockIntents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var languageCode string = "languageCode-412800396" + var request = &dialogflowpb.BatchUpdateIntentsRequest{ + Parent: formattedParent, + LanguageCode: languageCode, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchUpdateIntents(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIntents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIntentsBatchUpdateIntentsError(t *testing.T) { + errCode := codes.PermissionDenied + mockIntents.err = nil + mockIntents.resps = append(mockIntents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var languageCode string = "languageCode-412800396" + var request = &dialogflowpb.BatchUpdateIntentsRequest{ + Parent: formattedParent, + LanguageCode: languageCode, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchUpdateIntents(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIntentsBatchDeleteIntents(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockIntents.err = nil + mockIntents.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockIntents.resps = append(mockIntents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var intents []*dialogflowpb.Intent = nil + var request = &dialogflowpb.BatchDeleteIntentsRequest{ + Parent: formattedParent, + Intents: intents, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchDeleteIntents(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIntents.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestIntentsBatchDeleteIntentsError(t *testing.T) { + errCode := codes.PermissionDenied + mockIntents.err = nil + mockIntents.resps = append(mockIntents.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/agent", "[PROJECT]") + var intents []*dialogflowpb.Intent = nil + var request = &dialogflowpb.BatchDeleteIntentsRequest{ + Parent: formattedParent, + Intents: intents, + } + + c, err := NewIntentsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.BatchDeleteIntents(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSessionEntityTypesListSessionEntityTypes(t *testing.T) { + var nextPageToken string = "" + var sessionEntityTypesElement *dialogflowpb.SessionEntityType = &dialogflowpb.SessionEntityType{} + var sessionEntityTypes = []*dialogflowpb.SessionEntityType{sessionEntityTypesElement} + var expectedResponse = &dialogflowpb.ListSessionEntityTypesResponse{ + NextPageToken: nextPageToken, + SessionEntityTypes: sessionEntityTypes, + } + + mockSessionEntityTypes.err = nil + mockSessionEntityTypes.reqs = nil + + mockSessionEntityTypes.resps = append(mockSessionEntityTypes.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var request = &dialogflowpb.ListSessionEntityTypesRequest{ + Parent: formattedParent, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSessionEntityTypes(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSessionEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.SessionEntityTypes[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSessionEntityTypesListSessionEntityTypesError(t *testing.T) { + errCode := codes.PermissionDenied + mockSessionEntityTypes.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var request = &dialogflowpb.ListSessionEntityTypesRequest{ + Parent: formattedParent, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSessionEntityTypes(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSessionEntityTypesGetSessionEntityType(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &dialogflowpb.SessionEntityType{ + Name: name2, + } + + mockSessionEntityTypes.err = nil + mockSessionEntityTypes.reqs = nil + + mockSessionEntityTypes.resps = append(mockSessionEntityTypes.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/agent/sessions/%s/entityTypes/%s", "[PROJECT]", "[SESSION]", "[ENTITY_TYPE]") + var request = &dialogflowpb.GetSessionEntityTypeRequest{ + Name: formattedName, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSessionEntityType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSessionEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSessionEntityTypesGetSessionEntityTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSessionEntityTypes.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/agent/sessions/%s/entityTypes/%s", "[PROJECT]", "[SESSION]", "[ENTITY_TYPE]") + var request = &dialogflowpb.GetSessionEntityTypeRequest{ + Name: formattedName, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSessionEntityType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSessionEntityTypesCreateSessionEntityType(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &dialogflowpb.SessionEntityType{ + Name: name, + } + + mockSessionEntityTypes.err = nil + mockSessionEntityTypes.reqs = nil + + mockSessionEntityTypes.resps = append(mockSessionEntityTypes.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var sessionEntityType *dialogflowpb.SessionEntityType = &dialogflowpb.SessionEntityType{} + var request = &dialogflowpb.CreateSessionEntityTypeRequest{ + Parent: formattedParent, + SessionEntityType: sessionEntityType, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSessionEntityType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSessionEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSessionEntityTypesCreateSessionEntityTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSessionEntityTypes.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var sessionEntityType *dialogflowpb.SessionEntityType = &dialogflowpb.SessionEntityType{} + var request = &dialogflowpb.CreateSessionEntityTypeRequest{ + Parent: formattedParent, + SessionEntityType: sessionEntityType, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSessionEntityType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSessionEntityTypesUpdateSessionEntityType(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &dialogflowpb.SessionEntityType{ + Name: name, + } + + mockSessionEntityTypes.err = nil + mockSessionEntityTypes.reqs = nil + + mockSessionEntityTypes.resps = append(mockSessionEntityTypes.resps[:0], expectedResponse) + + var sessionEntityType *dialogflowpb.SessionEntityType = &dialogflowpb.SessionEntityType{} + var request = &dialogflowpb.UpdateSessionEntityTypeRequest{ + SessionEntityType: sessionEntityType, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSessionEntityType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSessionEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSessionEntityTypesUpdateSessionEntityTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSessionEntityTypes.err = gstatus.Error(errCode, "test error") + + var sessionEntityType *dialogflowpb.SessionEntityType = &dialogflowpb.SessionEntityType{} + var request = &dialogflowpb.UpdateSessionEntityTypeRequest{ + SessionEntityType: sessionEntityType, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSessionEntityType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSessionEntityTypesDeleteSessionEntityType(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockSessionEntityTypes.err = nil + mockSessionEntityTypes.reqs = nil + + mockSessionEntityTypes.resps = append(mockSessionEntityTypes.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/agent/sessions/%s/entityTypes/%s", "[PROJECT]", "[SESSION]", "[ENTITY_TYPE]") + var request = &dialogflowpb.DeleteSessionEntityTypeRequest{ + Name: formattedName, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSessionEntityType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSessionEntityTypes.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestSessionEntityTypesDeleteSessionEntityTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSessionEntityTypes.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/agent/sessions/%s/entityTypes/%s", "[PROJECT]", "[SESSION]", "[ENTITY_TYPE]") + var request = &dialogflowpb.DeleteSessionEntityTypeRequest{ + Name: formattedName, + } + + c, err := NewSessionEntityTypesClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSessionEntityType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSessionsDetectIntent(t *testing.T) { + var responseId string = "responseId1847552473" + var expectedResponse = &dialogflowpb.DetectIntentResponse{ + ResponseId: responseId, + } + + mockSessions.err = nil + mockSessions.reqs = nil + + mockSessions.resps = append(mockSessions.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var queryInput *dialogflowpb.QueryInput = &dialogflowpb.QueryInput{} + var request = &dialogflowpb.DetectIntentRequest{ + Session: formattedSession, + QueryInput: queryInput, + } + + c, err := NewSessionsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DetectIntent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSessions.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSessionsDetectIntentError(t *testing.T) { + errCode := codes.PermissionDenied + mockSessions.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/agent/sessions/%s", "[PROJECT]", "[SESSION]") + var queryInput *dialogflowpb.QueryInput = &dialogflowpb.QueryInput{} + var request = &dialogflowpb.DetectIntentRequest{ + Session: formattedSession, + QueryInput: queryInput, + } + + c, err := NewSessionsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DetectIntent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSessionsStreamingDetectIntent(t *testing.T) { + var responseId string = "responseId1847552473" + var expectedResponse = &dialogflowpb.StreamingDetectIntentResponse{ + ResponseId: responseId, + } + + mockSessions.err = nil + mockSessions.reqs = nil + + mockSessions.resps = append(mockSessions.resps[:0], expectedResponse) + + var session string = "session1984987798" + var queryInput *dialogflowpb.QueryInput = &dialogflowpb.QueryInput{} + var request = &dialogflowpb.StreamingDetectIntentRequest{ + Session: session, + QueryInput: queryInput, + } + + c, err := NewSessionsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingDetectIntent(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSessions.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSessionsStreamingDetectIntentError(t *testing.T) { + errCode := codes.PermissionDenied + mockSessions.err = gstatus.Error(errCode, "test error") + + var session string = "session1984987798" + var queryInput *dialogflowpb.QueryInput = &dialogflowpb.QueryInput{} + var request = &dialogflowpb.StreamingDetectIntentRequest{ + Session: session, + QueryInput: queryInput, + } + + c, err := NewSessionsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingDetectIntent(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/session_entity_types_client.go b/vendor/cloud.google.com/go/dialogflow/apiv2/session_entity_types_client.go new file mode 100644 index 000000000..8849a8555 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/session_entity_types_client.go @@ -0,0 +1,278 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// SessionEntityTypesCallOptions contains the retry settings for each method of SessionEntityTypesClient. +type SessionEntityTypesCallOptions struct { + ListSessionEntityTypes []gax.CallOption + GetSessionEntityType []gax.CallOption + CreateSessionEntityType []gax.CallOption + UpdateSessionEntityType []gax.CallOption + DeleteSessionEntityType []gax.CallOption +} + +func defaultSessionEntityTypesClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dialogflow.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultSessionEntityTypesCallOptions() *SessionEntityTypesCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &SessionEntityTypesCallOptions{ + ListSessionEntityTypes: retry[[2]string{"default", "idempotent"}], + GetSessionEntityType: retry[[2]string{"default", "idempotent"}], + CreateSessionEntityType: retry[[2]string{"default", "non_idempotent"}], + UpdateSessionEntityType: retry[[2]string{"default", "non_idempotent"}], + DeleteSessionEntityType: retry[[2]string{"default", "idempotent"}], + } +} + +// SessionEntityTypesClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type SessionEntityTypesClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + sessionEntityTypesClient dialogflowpb.SessionEntityTypesClient + + // The call options for this service. + CallOptions *SessionEntityTypesCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSessionEntityTypesClient creates a new session entity types client. +// +// Entities are extracted from user input and represent parameters that are +// meaningful to your application. For example, a date range, a proper name +// such as a geographic location or landmark, and so on. Entities represent +// actionable data for your application. +// +// Session entity types are referred to as **User** entity types and are +// entities that are built for an individual user such as +// favorites, preferences, playlists, and so on. You can redefine a session +// entity type at the session level. +// +// For more information about entity types, see the +// [Dialogflow documentation](https://dialogflow.com/docs/entities). +func NewSessionEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*SessionEntityTypesClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultSessionEntityTypesClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &SessionEntityTypesClient{ + conn: conn, + CallOptions: defaultSessionEntityTypesCallOptions(), + + sessionEntityTypesClient: dialogflowpb.NewSessionEntityTypesClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *SessionEntityTypesClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *SessionEntityTypesClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *SessionEntityTypesClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListSessionEntityTypes returns the list of all session entity types in the specified session. +func (c *SessionEntityTypesClient) ListSessionEntityTypes(ctx context.Context, req *dialogflowpb.ListSessionEntityTypesRequest, opts ...gax.CallOption) *SessionEntityTypeIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListSessionEntityTypes[0:len(c.CallOptions.ListSessionEntityTypes):len(c.CallOptions.ListSessionEntityTypes)], opts...) + it := &SessionEntityTypeIterator{} + req = proto.Clone(req).(*dialogflowpb.ListSessionEntityTypesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.SessionEntityType, string, error) { + var resp *dialogflowpb.ListSessionEntityTypesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.sessionEntityTypesClient.ListSessionEntityTypes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.SessionEntityTypes, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetSessionEntityType retrieves the specified session entity type. +func (c *SessionEntityTypesClient) GetSessionEntityType(ctx context.Context, req *dialogflowpb.GetSessionEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.SessionEntityType, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetSessionEntityType[0:len(c.CallOptions.GetSessionEntityType):len(c.CallOptions.GetSessionEntityType)], opts...) + var resp *dialogflowpb.SessionEntityType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.sessionEntityTypesClient.GetSessionEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateSessionEntityType creates a session entity type. +func (c *SessionEntityTypesClient) CreateSessionEntityType(ctx context.Context, req *dialogflowpb.CreateSessionEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.SessionEntityType, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateSessionEntityType[0:len(c.CallOptions.CreateSessionEntityType):len(c.CallOptions.CreateSessionEntityType)], opts...) + var resp *dialogflowpb.SessionEntityType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.sessionEntityTypesClient.CreateSessionEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateSessionEntityType updates the specified session entity type. +func (c *SessionEntityTypesClient) UpdateSessionEntityType(ctx context.Context, req *dialogflowpb.UpdateSessionEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.SessionEntityType, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateSessionEntityType[0:len(c.CallOptions.UpdateSessionEntityType):len(c.CallOptions.UpdateSessionEntityType)], opts...) + var resp *dialogflowpb.SessionEntityType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.sessionEntityTypesClient.UpdateSessionEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteSessionEntityType deletes the specified session entity type. +func (c *SessionEntityTypesClient) DeleteSessionEntityType(ctx context.Context, req *dialogflowpb.DeleteSessionEntityTypeRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteSessionEntityType[0:len(c.CallOptions.DeleteSessionEntityType):len(c.CallOptions.DeleteSessionEntityType)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.sessionEntityTypesClient.DeleteSessionEntityType(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// SessionEntityTypeIterator manages a stream of *dialogflowpb.SessionEntityType. +type SessionEntityTypeIterator struct { + items []*dialogflowpb.SessionEntityType + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.SessionEntityType, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *SessionEntityTypeIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *SessionEntityTypeIterator) Next() (*dialogflowpb.SessionEntityType, error) { + var item *dialogflowpb.SessionEntityType + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *SessionEntityTypeIterator) bufLen() int { + return len(it.items) +} + +func (it *SessionEntityTypeIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/session_entity_types_client_example_test.go b/vendor/cloud.google.com/go/dialogflow/apiv2/session_entity_types_client_example_test.go new file mode 100644 index 000000000..43afd8977 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/session_entity_types_client_example_test.go @@ -0,0 +1,129 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + "google.golang.org/api/iterator" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewSessionEntityTypesClient() { + ctx := context.Background() + c, err := dialogflow.NewSessionEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleSessionEntityTypesClient_ListSessionEntityTypes() { + ctx := context.Background() + c, err := dialogflow.NewSessionEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.ListSessionEntityTypesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListSessionEntityTypes(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleSessionEntityTypesClient_GetSessionEntityType() { + ctx := context.Background() + c, err := dialogflow.NewSessionEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.GetSessionEntityTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSessionEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSessionEntityTypesClient_CreateSessionEntityType() { + ctx := context.Background() + c, err := dialogflow.NewSessionEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.CreateSessionEntityTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateSessionEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSessionEntityTypesClient_UpdateSessionEntityType() { + ctx := context.Background() + c, err := dialogflow.NewSessionEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.UpdateSessionEntityTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateSessionEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSessionEntityTypesClient_DeleteSessionEntityType() { + ctx := context.Background() + c, err := dialogflow.NewSessionEntityTypesClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DeleteSessionEntityTypeRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteSessionEntityType(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/sessions_client.go b/vendor/cloud.google.com/go/dialogflow/apiv2/sessions_client.go new file mode 100644 index 000000000..7485e93b9 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/sessions_client.go @@ -0,0 +1,144 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow + +import ( + "context" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +// SessionsCallOptions contains the retry settings for each method of SessionsClient. +type SessionsCallOptions struct { + DetectIntent []gax.CallOption + StreamingDetectIntent []gax.CallOption +} + +func defaultSessionsClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dialogflow.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultSessionsCallOptions() *SessionsCallOptions { + retry := map[[2]string][]gax.CallOption{} + return &SessionsCallOptions{ + DetectIntent: retry[[2]string{"default", "non_idempotent"}], + StreamingDetectIntent: retry[[2]string{"default", "non_idempotent"}], + } +} + +// SessionsClient is a client for interacting with Dialogflow API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type SessionsClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + sessionsClient dialogflowpb.SessionsClient + + // The call options for this service. + CallOptions *SessionsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSessionsClient creates a new sessions client. +// +// A session represents an interaction with a user. You retrieve user input +// and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or +// [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method to determine +// user intent and respond. +func NewSessionsClient(ctx context.Context, opts ...option.ClientOption) (*SessionsClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultSessionsClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &SessionsClient{ + conn: conn, + CallOptions: defaultSessionsCallOptions(), + + sessionsClient: dialogflowpb.NewSessionsClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *SessionsClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *SessionsClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *SessionsClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// DetectIntent processes a natural language query and returns structured, actionable data +// as a result. This method is not idempotent, because it may cause contexts +// and session entity types to be updated, which in turn might affect +// results of future queries. +func (c *SessionsClient) DetectIntent(ctx context.Context, req *dialogflowpb.DetectIntentRequest, opts ...gax.CallOption) (*dialogflowpb.DetectIntentResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DetectIntent[0:len(c.CallOptions.DetectIntent):len(c.CallOptions.DetectIntent)], opts...) + var resp *dialogflowpb.DetectIntentResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.sessionsClient.DetectIntent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// StreamingDetectIntent processes a natural language query in audio format in a streaming fashion +// and returns structured, actionable data as a result. This method is only +// available via the gRPC API (not REST). +func (c *SessionsClient) StreamingDetectIntent(ctx context.Context, opts ...gax.CallOption) (dialogflowpb.Sessions_StreamingDetectIntentClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.StreamingDetectIntent[0:len(c.CallOptions.StreamingDetectIntent):len(c.CallOptions.StreamingDetectIntent)], opts...) + var resp dialogflowpb.Sessions_StreamingDetectIntentClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.sessionsClient.StreamingDetectIntent(ctx, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/dialogflow/apiv2/sessions_client_example_test.go b/vendor/cloud.google.com/go/dialogflow/apiv2/sessions_client_example_test.go new file mode 100644 index 000000000..e6b91eb32 --- /dev/null +++ b/vendor/cloud.google.com/go/dialogflow/apiv2/sessions_client_example_test.go @@ -0,0 +1,87 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dialogflow_test + +import ( + "context" + "io" + + dialogflow "cloud.google.com/go/dialogflow/apiv2" + dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" +) + +func ExampleNewSessionsClient() { + ctx := context.Background() + c, err := dialogflow.NewSessionsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleSessionsClient_DetectIntent() { + ctx := context.Background() + c, err := dialogflow.NewSessionsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dialogflowpb.DetectIntentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DetectIntent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSessionsClient_StreamingDetectIntent() { + ctx := context.Background() + c, err := dialogflow.NewSessionsClient(ctx) + if err != nil { + // TODO: Handle error. + } + stream, err := c.StreamingDetectIntent(ctx) + if err != nil { + // TODO: Handle error. + } + go func() { + reqs := []*dialogflowpb.StreamingDetectIntentRequest{ + // TODO: Create requests. + } + for _, req := range reqs { + if err := stream.Send(req); err != nil { + // TODO: Handle error. + } + } + stream.CloseSend() + }() + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/vendor/cloud.google.com/go/dlp/apiv2/dlp_client.go b/vendor/cloud.google.com/go/dlp/apiv2/dlp_client.go new file mode 100644 index 000000000..359daa57a --- /dev/null +++ b/vendor/cloud.google.com/go/dlp/apiv2/dlp_client.go @@ -0,0 +1,1036 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dlp + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + dlppb "google.golang.org/genproto/googleapis/privacy/dlp/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + InspectContent []gax.CallOption + RedactImage []gax.CallOption + DeidentifyContent []gax.CallOption + ReidentifyContent []gax.CallOption + ListInfoTypes []gax.CallOption + CreateInspectTemplate []gax.CallOption + UpdateInspectTemplate []gax.CallOption + GetInspectTemplate []gax.CallOption + ListInspectTemplates []gax.CallOption + DeleteInspectTemplate []gax.CallOption + CreateDeidentifyTemplate []gax.CallOption + UpdateDeidentifyTemplate []gax.CallOption + GetDeidentifyTemplate []gax.CallOption + ListDeidentifyTemplates []gax.CallOption + DeleteDeidentifyTemplate []gax.CallOption + CreateDlpJob []gax.CallOption + ListDlpJobs []gax.CallOption + GetDlpJob []gax.CallOption + DeleteDlpJob []gax.CallOption + CancelDlpJob []gax.CallOption + ListJobTriggers []gax.CallOption + GetJobTrigger []gax.CallOption + DeleteJobTrigger []gax.CallOption + UpdateJobTrigger []gax.CallOption + CreateJobTrigger []gax.CallOption + CreateStoredInfoType []gax.CallOption + UpdateStoredInfoType []gax.CallOption + GetStoredInfoType []gax.CallOption + ListStoredInfoTypes []gax.CallOption + DeleteStoredInfoType []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("dlp.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + InspectContent: retry[[2]string{"default", "idempotent"}], + RedactImage: retry[[2]string{"default", "idempotent"}], + DeidentifyContent: retry[[2]string{"default", "idempotent"}], + ReidentifyContent: retry[[2]string{"default", "idempotent"}], + ListInfoTypes: retry[[2]string{"default", "idempotent"}], + CreateInspectTemplate: retry[[2]string{"default", "non_idempotent"}], + UpdateInspectTemplate: retry[[2]string{"default", "non_idempotent"}], + GetInspectTemplate: retry[[2]string{"default", "idempotent"}], + ListInspectTemplates: retry[[2]string{"default", "idempotent"}], + DeleteInspectTemplate: retry[[2]string{"default", "idempotent"}], + CreateDeidentifyTemplate: retry[[2]string{"default", "non_idempotent"}], + UpdateDeidentifyTemplate: retry[[2]string{"default", "non_idempotent"}], + GetDeidentifyTemplate: retry[[2]string{"default", "idempotent"}], + ListDeidentifyTemplates: retry[[2]string{"default", "idempotent"}], + DeleteDeidentifyTemplate: retry[[2]string{"default", "idempotent"}], + CreateDlpJob: retry[[2]string{"default", "non_idempotent"}], + ListDlpJobs: retry[[2]string{"default", "idempotent"}], + GetDlpJob: retry[[2]string{"default", "idempotent"}], + DeleteDlpJob: retry[[2]string{"default", "idempotent"}], + CancelDlpJob: retry[[2]string{"default", "non_idempotent"}], + ListJobTriggers: retry[[2]string{"default", "idempotent"}], + GetJobTrigger: retry[[2]string{"default", "idempotent"}], + DeleteJobTrigger: retry[[2]string{"default", "idempotent"}], + UpdateJobTrigger: retry[[2]string{"default", "non_idempotent"}], + CreateJobTrigger: retry[[2]string{"default", "non_idempotent"}], + CreateStoredInfoType: retry[[2]string{"default", "non_idempotent"}], + UpdateStoredInfoType: retry[[2]string{"default", "non_idempotent"}], + GetStoredInfoType: retry[[2]string{"default", "idempotent"}], + ListStoredInfoTypes: retry[[2]string{"default", "idempotent"}], + DeleteStoredInfoType: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Cloud Data Loss Prevention (DLP) API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client dlppb.DlpServiceClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new dlp service client. +// +// The Cloud Data Loss Prevention (DLP) API is a service that allows clients +// to detect the presence of Personally Identifiable Information (PII) and other +// privacy-sensitive data in user-supplied, unstructured data streams, like text +// blocks or images. +// The service also includes methods for sensitive data redaction and +// scheduling of data scans on Google Cloud Platform based data sets. +// +// To learn more about concepts and find how-to guides see +// https://cloud.google.com/dlp/docs/. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: dlppb.NewDlpServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// InspectContent finds potentially sensitive info in content. +// This method has limits on input size, processing time, and output size. +// +// When no InfoTypes or CustomInfoTypes are specified in this request, the +// system will automatically choose what detectors to run. By default this may +// be all types, but may change over time as detectors are updated. +// +// For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images +// and https://cloud.google.com/dlp/docs/inspecting-text, +func (c *Client) InspectContent(ctx context.Context, req *dlppb.InspectContentRequest, opts ...gax.CallOption) (*dlppb.InspectContentResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.InspectContent[0:len(c.CallOptions.InspectContent):len(c.CallOptions.InspectContent)], opts...) + var resp *dlppb.InspectContentResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.InspectContent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// RedactImage redacts potentially sensitive info from an image. +// This method has limits on input size, processing time, and output size. +// See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to +// learn more. +// +// When no InfoTypes or CustomInfoTypes are specified in this request, the +// system will automatically choose what detectors to run. By default this may +// be all types, but may change over time as detectors are updated. +func (c *Client) RedactImage(ctx context.Context, req *dlppb.RedactImageRequest, opts ...gax.CallOption) (*dlppb.RedactImageResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.RedactImage[0:len(c.CallOptions.RedactImage):len(c.CallOptions.RedactImage)], opts...) + var resp *dlppb.RedactImageResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.RedactImage(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeidentifyContent de-identifies potentially sensitive info from a ContentItem. +// This method has limits on input size and output size. +// See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to +// learn more. +// +// When no InfoTypes or CustomInfoTypes are specified in this request, the +// system will automatically choose what detectors to run. By default this may +// be all types, but may change over time as detectors are updated. +func (c *Client) DeidentifyContent(ctx context.Context, req *dlppb.DeidentifyContentRequest, opts ...gax.CallOption) (*dlppb.DeidentifyContentResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeidentifyContent[0:len(c.CallOptions.DeidentifyContent):len(c.CallOptions.DeidentifyContent)], opts...) + var resp *dlppb.DeidentifyContentResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.DeidentifyContent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ReidentifyContent re-identifies content that has been de-identified. +// See +// https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example +// to learn more. +func (c *Client) ReidentifyContent(ctx context.Context, req *dlppb.ReidentifyContentRequest, opts ...gax.CallOption) (*dlppb.ReidentifyContentResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ReidentifyContent[0:len(c.CallOptions.ReidentifyContent):len(c.CallOptions.ReidentifyContent)], opts...) + var resp *dlppb.ReidentifyContentResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ReidentifyContent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListInfoTypes returns a list of the sensitive information types that the DLP API +// supports. See https://cloud.google.com/dlp/docs/infotypes-reference to +// learn more. +func (c *Client) ListInfoTypes(ctx context.Context, req *dlppb.ListInfoTypesRequest, opts ...gax.CallOption) (*dlppb.ListInfoTypesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListInfoTypes[0:len(c.CallOptions.ListInfoTypes):len(c.CallOptions.ListInfoTypes)], opts...) + var resp *dlppb.ListInfoTypesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListInfoTypes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateInspectTemplate creates an InspectTemplate for re-using frequently used configuration +// for inspecting content, images, and storage. +// See https://cloud.google.com/dlp/docs/creating-templates to learn more. +func (c *Client) CreateInspectTemplate(ctx context.Context, req *dlppb.CreateInspectTemplateRequest, opts ...gax.CallOption) (*dlppb.InspectTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateInspectTemplate[0:len(c.CallOptions.CreateInspectTemplate):len(c.CallOptions.CreateInspectTemplate)], opts...) + var resp *dlppb.InspectTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateInspectTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateInspectTemplate updates the InspectTemplate. +// See https://cloud.google.com/dlp/docs/creating-templates to learn more. +func (c *Client) UpdateInspectTemplate(ctx context.Context, req *dlppb.UpdateInspectTemplateRequest, opts ...gax.CallOption) (*dlppb.InspectTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateInspectTemplate[0:len(c.CallOptions.UpdateInspectTemplate):len(c.CallOptions.UpdateInspectTemplate)], opts...) + var resp *dlppb.InspectTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateInspectTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetInspectTemplate gets an InspectTemplate. +// See https://cloud.google.com/dlp/docs/creating-templates to learn more. +func (c *Client) GetInspectTemplate(ctx context.Context, req *dlppb.GetInspectTemplateRequest, opts ...gax.CallOption) (*dlppb.InspectTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetInspectTemplate[0:len(c.CallOptions.GetInspectTemplate):len(c.CallOptions.GetInspectTemplate)], opts...) + var resp *dlppb.InspectTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetInspectTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListInspectTemplates lists InspectTemplates. +// See https://cloud.google.com/dlp/docs/creating-templates to learn more. +func (c *Client) ListInspectTemplates(ctx context.Context, req *dlppb.ListInspectTemplatesRequest, opts ...gax.CallOption) *InspectTemplateIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListInspectTemplates[0:len(c.CallOptions.ListInspectTemplates):len(c.CallOptions.ListInspectTemplates)], opts...) + it := &InspectTemplateIterator{} + req = proto.Clone(req).(*dlppb.ListInspectTemplatesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dlppb.InspectTemplate, string, error) { + var resp *dlppb.ListInspectTemplatesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListInspectTemplates(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.InspectTemplates, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteInspectTemplate deletes an InspectTemplate. +// See https://cloud.google.com/dlp/docs/creating-templates to learn more. +func (c *Client) DeleteInspectTemplate(ctx context.Context, req *dlppb.DeleteInspectTemplateRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteInspectTemplate[0:len(c.CallOptions.DeleteInspectTemplate):len(c.CallOptions.DeleteInspectTemplate)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteInspectTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// CreateDeidentifyTemplate creates a DeidentifyTemplate for re-using frequently used configuration +// for de-identifying content, images, and storage. +// See https://cloud.google.com/dlp/docs/creating-templates-deid to learn +// more. +func (c *Client) CreateDeidentifyTemplate(ctx context.Context, req *dlppb.CreateDeidentifyTemplateRequest, opts ...gax.CallOption) (*dlppb.DeidentifyTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateDeidentifyTemplate[0:len(c.CallOptions.CreateDeidentifyTemplate):len(c.CallOptions.CreateDeidentifyTemplate)], opts...) + var resp *dlppb.DeidentifyTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateDeidentifyTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateDeidentifyTemplate updates the DeidentifyTemplate. +// See https://cloud.google.com/dlp/docs/creating-templates-deid to learn +// more. +func (c *Client) UpdateDeidentifyTemplate(ctx context.Context, req *dlppb.UpdateDeidentifyTemplateRequest, opts ...gax.CallOption) (*dlppb.DeidentifyTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateDeidentifyTemplate[0:len(c.CallOptions.UpdateDeidentifyTemplate):len(c.CallOptions.UpdateDeidentifyTemplate)], opts...) + var resp *dlppb.DeidentifyTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateDeidentifyTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetDeidentifyTemplate gets a DeidentifyTemplate. +// See https://cloud.google.com/dlp/docs/creating-templates-deid to learn +// more. +func (c *Client) GetDeidentifyTemplate(ctx context.Context, req *dlppb.GetDeidentifyTemplateRequest, opts ...gax.CallOption) (*dlppb.DeidentifyTemplate, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetDeidentifyTemplate[0:len(c.CallOptions.GetDeidentifyTemplate):len(c.CallOptions.GetDeidentifyTemplate)], opts...) + var resp *dlppb.DeidentifyTemplate + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetDeidentifyTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListDeidentifyTemplates lists DeidentifyTemplates. +// See https://cloud.google.com/dlp/docs/creating-templates-deid to learn +// more. +func (c *Client) ListDeidentifyTemplates(ctx context.Context, req *dlppb.ListDeidentifyTemplatesRequest, opts ...gax.CallOption) *DeidentifyTemplateIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListDeidentifyTemplates[0:len(c.CallOptions.ListDeidentifyTemplates):len(c.CallOptions.ListDeidentifyTemplates)], opts...) + it := &DeidentifyTemplateIterator{} + req = proto.Clone(req).(*dlppb.ListDeidentifyTemplatesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dlppb.DeidentifyTemplate, string, error) { + var resp *dlppb.ListDeidentifyTemplatesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListDeidentifyTemplates(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.DeidentifyTemplates, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteDeidentifyTemplate deletes a DeidentifyTemplate. +// See https://cloud.google.com/dlp/docs/creating-templates-deid to learn +// more. +func (c *Client) DeleteDeidentifyTemplate(ctx context.Context, req *dlppb.DeleteDeidentifyTemplateRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteDeidentifyTemplate[0:len(c.CallOptions.DeleteDeidentifyTemplate):len(c.CallOptions.DeleteDeidentifyTemplate)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteDeidentifyTemplate(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// CreateDlpJob creates a new job to inspect storage or calculate risk metrics. +// See https://cloud.google.com/dlp/docs/inspecting-storage and +// https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. +// +// When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the +// system will automatically choose what detectors to run. By default this may +// be all types, but may change over time as detectors are updated. +func (c *Client) CreateDlpJob(ctx context.Context, req *dlppb.CreateDlpJobRequest, opts ...gax.CallOption) (*dlppb.DlpJob, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateDlpJob[0:len(c.CallOptions.CreateDlpJob):len(c.CallOptions.CreateDlpJob)], opts...) + var resp *dlppb.DlpJob + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateDlpJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListDlpJobs lists DlpJobs that match the specified filter in the request. +// See https://cloud.google.com/dlp/docs/inspecting-storage and +// https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. +func (c *Client) ListDlpJobs(ctx context.Context, req *dlppb.ListDlpJobsRequest, opts ...gax.CallOption) *DlpJobIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListDlpJobs[0:len(c.CallOptions.ListDlpJobs):len(c.CallOptions.ListDlpJobs)], opts...) + it := &DlpJobIterator{} + req = proto.Clone(req).(*dlppb.ListDlpJobsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dlppb.DlpJob, string, error) { + var resp *dlppb.ListDlpJobsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListDlpJobs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Jobs, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetDlpJob gets the latest state of a long-running DlpJob. +// See https://cloud.google.com/dlp/docs/inspecting-storage and +// https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. +func (c *Client) GetDlpJob(ctx context.Context, req *dlppb.GetDlpJobRequest, opts ...gax.CallOption) (*dlppb.DlpJob, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetDlpJob[0:len(c.CallOptions.GetDlpJob):len(c.CallOptions.GetDlpJob)], opts...) + var resp *dlppb.DlpJob + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetDlpJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteDlpJob deletes a long-running DlpJob. This method indicates that the client is +// no longer interested in the DlpJob result. The job will be cancelled if +// possible. +// See https://cloud.google.com/dlp/docs/inspecting-storage and +// https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. +func (c *Client) DeleteDlpJob(ctx context.Context, req *dlppb.DeleteDlpJobRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteDlpJob[0:len(c.CallOptions.DeleteDlpJob):len(c.CallOptions.DeleteDlpJob)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteDlpJob(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// CancelDlpJob starts asynchronous cancellation on a long-running DlpJob. The server +// makes a best effort to cancel the DlpJob, but success is not +// guaranteed. +// See https://cloud.google.com/dlp/docs/inspecting-storage and +// https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. +func (c *Client) CancelDlpJob(ctx context.Context, req *dlppb.CancelDlpJobRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CancelDlpJob[0:len(c.CallOptions.CancelDlpJob):len(c.CallOptions.CancelDlpJob)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.CancelDlpJob(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListJobTriggers lists job triggers. +// See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. +func (c *Client) ListJobTriggers(ctx context.Context, req *dlppb.ListJobTriggersRequest, opts ...gax.CallOption) *JobTriggerIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListJobTriggers[0:len(c.CallOptions.ListJobTriggers):len(c.CallOptions.ListJobTriggers)], opts...) + it := &JobTriggerIterator{} + req = proto.Clone(req).(*dlppb.ListJobTriggersRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dlppb.JobTrigger, string, error) { + var resp *dlppb.ListJobTriggersResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListJobTriggers(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.JobTriggers, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetJobTrigger gets a job trigger. +// See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. +func (c *Client) GetJobTrigger(ctx context.Context, req *dlppb.GetJobTriggerRequest, opts ...gax.CallOption) (*dlppb.JobTrigger, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetJobTrigger[0:len(c.CallOptions.GetJobTrigger):len(c.CallOptions.GetJobTrigger)], opts...) + var resp *dlppb.JobTrigger + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetJobTrigger(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteJobTrigger deletes a job trigger. +// See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. +func (c *Client) DeleteJobTrigger(ctx context.Context, req *dlppb.DeleteJobTriggerRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteJobTrigger[0:len(c.CallOptions.DeleteJobTrigger):len(c.CallOptions.DeleteJobTrigger)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteJobTrigger(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// UpdateJobTrigger updates a job trigger. +// See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. +func (c *Client) UpdateJobTrigger(ctx context.Context, req *dlppb.UpdateJobTriggerRequest, opts ...gax.CallOption) (*dlppb.JobTrigger, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateJobTrigger[0:len(c.CallOptions.UpdateJobTrigger):len(c.CallOptions.UpdateJobTrigger)], opts...) + var resp *dlppb.JobTrigger + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateJobTrigger(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateJobTrigger creates a job trigger to run DLP actions such as scanning storage for +// sensitive information on a set schedule. +// See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. +func (c *Client) CreateJobTrigger(ctx context.Context, req *dlppb.CreateJobTriggerRequest, opts ...gax.CallOption) (*dlppb.JobTrigger, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateJobTrigger[0:len(c.CallOptions.CreateJobTrigger):len(c.CallOptions.CreateJobTrigger)], opts...) + var resp *dlppb.JobTrigger + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateJobTrigger(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateStoredInfoType creates a pre-built stored infoType to be used for inspection. +// See https://cloud.google.com/dlp/docs/creating-stored-infotypes to +// learn more. +func (c *Client) CreateStoredInfoType(ctx context.Context, req *dlppb.CreateStoredInfoTypeRequest, opts ...gax.CallOption) (*dlppb.StoredInfoType, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateStoredInfoType[0:len(c.CallOptions.CreateStoredInfoType):len(c.CallOptions.CreateStoredInfoType)], opts...) + var resp *dlppb.StoredInfoType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateStoredInfoType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateStoredInfoType updates the stored infoType by creating a new version. The existing version +// will continue to be used until the new version is ready. +// See https://cloud.google.com/dlp/docs/creating-stored-infotypes to +// learn more. +func (c *Client) UpdateStoredInfoType(ctx context.Context, req *dlppb.UpdateStoredInfoTypeRequest, opts ...gax.CallOption) (*dlppb.StoredInfoType, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateStoredInfoType[0:len(c.CallOptions.UpdateStoredInfoType):len(c.CallOptions.UpdateStoredInfoType)], opts...) + var resp *dlppb.StoredInfoType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateStoredInfoType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetStoredInfoType gets a stored infoType. +// See https://cloud.google.com/dlp/docs/creating-stored-infotypes to +// learn more. +func (c *Client) GetStoredInfoType(ctx context.Context, req *dlppb.GetStoredInfoTypeRequest, opts ...gax.CallOption) (*dlppb.StoredInfoType, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetStoredInfoType[0:len(c.CallOptions.GetStoredInfoType):len(c.CallOptions.GetStoredInfoType)], opts...) + var resp *dlppb.StoredInfoType + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetStoredInfoType(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListStoredInfoTypes lists stored infoTypes. +// See https://cloud.google.com/dlp/docs/creating-stored-infotypes to +// learn more. +func (c *Client) ListStoredInfoTypes(ctx context.Context, req *dlppb.ListStoredInfoTypesRequest, opts ...gax.CallOption) *StoredInfoTypeIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListStoredInfoTypes[0:len(c.CallOptions.ListStoredInfoTypes):len(c.CallOptions.ListStoredInfoTypes)], opts...) + it := &StoredInfoTypeIterator{} + req = proto.Clone(req).(*dlppb.ListStoredInfoTypesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*dlppb.StoredInfoType, string, error) { + var resp *dlppb.ListStoredInfoTypesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListStoredInfoTypes(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.StoredInfoTypes, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteStoredInfoType deletes a stored infoType. +// See https://cloud.google.com/dlp/docs/creating-stored-infotypes to +// learn more. +func (c *Client) DeleteStoredInfoType(ctx context.Context, req *dlppb.DeleteStoredInfoTypeRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteStoredInfoType[0:len(c.CallOptions.DeleteStoredInfoType):len(c.CallOptions.DeleteStoredInfoType)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteStoredInfoType(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// DeidentifyTemplateIterator manages a stream of *dlppb.DeidentifyTemplate. +type DeidentifyTemplateIterator struct { + items []*dlppb.DeidentifyTemplate + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dlppb.DeidentifyTemplate, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *DeidentifyTemplateIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *DeidentifyTemplateIterator) Next() (*dlppb.DeidentifyTemplate, error) { + var item *dlppb.DeidentifyTemplate + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *DeidentifyTemplateIterator) bufLen() int { + return len(it.items) +} + +func (it *DeidentifyTemplateIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// DlpJobIterator manages a stream of *dlppb.DlpJob. +type DlpJobIterator struct { + items []*dlppb.DlpJob + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dlppb.DlpJob, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *DlpJobIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *DlpJobIterator) Next() (*dlppb.DlpJob, error) { + var item *dlppb.DlpJob + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *DlpJobIterator) bufLen() int { + return len(it.items) +} + +func (it *DlpJobIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// InspectTemplateIterator manages a stream of *dlppb.InspectTemplate. +type InspectTemplateIterator struct { + items []*dlppb.InspectTemplate + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dlppb.InspectTemplate, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *InspectTemplateIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *InspectTemplateIterator) Next() (*dlppb.InspectTemplate, error) { + var item *dlppb.InspectTemplate + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *InspectTemplateIterator) bufLen() int { + return len(it.items) +} + +func (it *InspectTemplateIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// JobTriggerIterator manages a stream of *dlppb.JobTrigger. +type JobTriggerIterator struct { + items []*dlppb.JobTrigger + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dlppb.JobTrigger, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *JobTriggerIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *JobTriggerIterator) Next() (*dlppb.JobTrigger, error) { + var item *dlppb.JobTrigger + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *JobTriggerIterator) bufLen() int { + return len(it.items) +} + +func (it *JobTriggerIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// StoredInfoTypeIterator manages a stream of *dlppb.StoredInfoType. +type StoredInfoTypeIterator struct { + items []*dlppb.StoredInfoType + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*dlppb.StoredInfoType, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *StoredInfoTypeIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *StoredInfoTypeIterator) Next() (*dlppb.StoredInfoType, error) { + var item *dlppb.StoredInfoType + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *StoredInfoTypeIterator) bufLen() int { + return len(it.items) +} + +func (it *StoredInfoTypeIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/dlp/apiv2/dlp_client_example_test.go b/vendor/cloud.google.com/go/dlp/apiv2/dlp_client_example_test.go new file mode 100644 index 000000000..aef8debf5 --- /dev/null +++ b/vendor/cloud.google.com/go/dlp/apiv2/dlp_client_example_test.go @@ -0,0 +1,593 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dlp_test + +import ( + "context" + + dlp "cloud.google.com/go/dlp/apiv2" + "google.golang.org/api/iterator" + dlppb "google.golang.org/genproto/googleapis/privacy/dlp/v2" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_InspectContent() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.InspectContentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.InspectContent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_RedactImage() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.RedactImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RedactImage(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeidentifyContent() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.DeidentifyContentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeidentifyContent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ReidentifyContent() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.ReidentifyContentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ReidentifyContent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListInfoTypes() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.ListInfoTypesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListInfoTypes(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateInspectTemplate() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.CreateInspectTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateInspectTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateInspectTemplate() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.UpdateInspectTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateInspectTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetInspectTemplate() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.GetInspectTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetInspectTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListInspectTemplates() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.ListInspectTemplatesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListInspectTemplates(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_DeleteInspectTemplate() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.DeleteInspectTemplateRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteInspectTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_CreateDeidentifyTemplate() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.CreateDeidentifyTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateDeidentifyTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateDeidentifyTemplate() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.UpdateDeidentifyTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateDeidentifyTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetDeidentifyTemplate() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.GetDeidentifyTemplateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDeidentifyTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListDeidentifyTemplates() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.ListDeidentifyTemplatesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListDeidentifyTemplates(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_DeleteDeidentifyTemplate() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.DeleteDeidentifyTemplateRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteDeidentifyTemplate(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_CreateDlpJob() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.CreateDlpJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateDlpJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListDlpJobs() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.ListDlpJobsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListDlpJobs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetDlpJob() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.GetDlpJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDlpJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteDlpJob() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.DeleteDlpJobRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteDlpJob(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_CancelDlpJob() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.CancelDlpJobRequest{ + // TODO: Fill request struct fields. + } + err = c.CancelDlpJob(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_ListJobTriggers() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.ListJobTriggersRequest{ + // TODO: Fill request struct fields. + } + it := c.ListJobTriggers(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetJobTrigger() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.GetJobTriggerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetJobTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteJobTrigger() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.DeleteJobTriggerRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteJobTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_UpdateJobTrigger() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.UpdateJobTriggerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateJobTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateJobTrigger() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.CreateJobTriggerRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateJobTrigger(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateStoredInfoType() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.CreateStoredInfoTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateStoredInfoType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateStoredInfoType() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.UpdateStoredInfoTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateStoredInfoType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetStoredInfoType() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.GetStoredInfoTypeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetStoredInfoType(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListStoredInfoTypes() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.ListStoredInfoTypesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListStoredInfoTypes(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_DeleteStoredInfoType() { + ctx := context.Background() + c, err := dlp.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &dlppb.DeleteStoredInfoTypeRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteStoredInfoType(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/dlp/apiv2/doc.go b/vendor/cloud.google.com/go/dlp/apiv2/doc.go new file mode 100644 index 000000000..4ee9d0d41 --- /dev/null +++ b/vendor/cloud.google.com/go/dlp/apiv2/doc.go @@ -0,0 +1,90 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package dlp is an auto-generated package for the +// Cloud Data Loss Prevention (DLP) API. + +// +// Provides methods for detection, risk analysis, and de-identification of +// privacy-sensitive fragments in text, images, and Google Cloud Platform +// storage repositories. +package dlp // import "cloud.google.com/go/dlp/apiv2" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/dlp/apiv2/mock_test.go b/vendor/cloud.google.com/go/dlp/apiv2/mock_test.go new file mode 100644 index 000000000..2eed9e248 --- /dev/null +++ b/vendor/cloud.google.com/go/dlp/apiv2/mock_test.go @@ -0,0 +1,2263 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package dlp + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + dlppb "google.golang.org/genproto/googleapis/privacy/dlp/v2" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockDlpServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + dlppb.DlpServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockDlpServer) InspectContent(ctx context.Context, req *dlppb.InspectContentRequest) (*dlppb.InspectContentResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.InspectContentResponse), nil +} + +func (s *mockDlpServer) RedactImage(ctx context.Context, req *dlppb.RedactImageRequest) (*dlppb.RedactImageResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.RedactImageResponse), nil +} + +func (s *mockDlpServer) DeidentifyContent(ctx context.Context, req *dlppb.DeidentifyContentRequest) (*dlppb.DeidentifyContentResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.DeidentifyContentResponse), nil +} + +func (s *mockDlpServer) ReidentifyContent(ctx context.Context, req *dlppb.ReidentifyContentRequest) (*dlppb.ReidentifyContentResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.ReidentifyContentResponse), nil +} + +func (s *mockDlpServer) ListInfoTypes(ctx context.Context, req *dlppb.ListInfoTypesRequest) (*dlppb.ListInfoTypesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.ListInfoTypesResponse), nil +} + +func (s *mockDlpServer) CreateInspectTemplate(ctx context.Context, req *dlppb.CreateInspectTemplateRequest) (*dlppb.InspectTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.InspectTemplate), nil +} + +func (s *mockDlpServer) UpdateInspectTemplate(ctx context.Context, req *dlppb.UpdateInspectTemplateRequest) (*dlppb.InspectTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.InspectTemplate), nil +} + +func (s *mockDlpServer) GetInspectTemplate(ctx context.Context, req *dlppb.GetInspectTemplateRequest) (*dlppb.InspectTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.InspectTemplate), nil +} + +func (s *mockDlpServer) ListInspectTemplates(ctx context.Context, req *dlppb.ListInspectTemplatesRequest) (*dlppb.ListInspectTemplatesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.ListInspectTemplatesResponse), nil +} + +func (s *mockDlpServer) DeleteInspectTemplate(ctx context.Context, req *dlppb.DeleteInspectTemplateRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockDlpServer) CreateDeidentifyTemplate(ctx context.Context, req *dlppb.CreateDeidentifyTemplateRequest) (*dlppb.DeidentifyTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.DeidentifyTemplate), nil +} + +func (s *mockDlpServer) UpdateDeidentifyTemplate(ctx context.Context, req *dlppb.UpdateDeidentifyTemplateRequest) (*dlppb.DeidentifyTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.DeidentifyTemplate), nil +} + +func (s *mockDlpServer) GetDeidentifyTemplate(ctx context.Context, req *dlppb.GetDeidentifyTemplateRequest) (*dlppb.DeidentifyTemplate, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.DeidentifyTemplate), nil +} + +func (s *mockDlpServer) ListDeidentifyTemplates(ctx context.Context, req *dlppb.ListDeidentifyTemplatesRequest) (*dlppb.ListDeidentifyTemplatesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.ListDeidentifyTemplatesResponse), nil +} + +func (s *mockDlpServer) DeleteDeidentifyTemplate(ctx context.Context, req *dlppb.DeleteDeidentifyTemplateRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockDlpServer) CreateJobTrigger(ctx context.Context, req *dlppb.CreateJobTriggerRequest) (*dlppb.JobTrigger, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.JobTrigger), nil +} + +func (s *mockDlpServer) UpdateJobTrigger(ctx context.Context, req *dlppb.UpdateJobTriggerRequest) (*dlppb.JobTrigger, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.JobTrigger), nil +} + +func (s *mockDlpServer) GetJobTrigger(ctx context.Context, req *dlppb.GetJobTriggerRequest) (*dlppb.JobTrigger, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.JobTrigger), nil +} + +func (s *mockDlpServer) ListJobTriggers(ctx context.Context, req *dlppb.ListJobTriggersRequest) (*dlppb.ListJobTriggersResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.ListJobTriggersResponse), nil +} + +func (s *mockDlpServer) DeleteJobTrigger(ctx context.Context, req *dlppb.DeleteJobTriggerRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockDlpServer) CreateDlpJob(ctx context.Context, req *dlppb.CreateDlpJobRequest) (*dlppb.DlpJob, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.DlpJob), nil +} + +func (s *mockDlpServer) ListDlpJobs(ctx context.Context, req *dlppb.ListDlpJobsRequest) (*dlppb.ListDlpJobsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.ListDlpJobsResponse), nil +} + +func (s *mockDlpServer) GetDlpJob(ctx context.Context, req *dlppb.GetDlpJobRequest) (*dlppb.DlpJob, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.DlpJob), nil +} + +func (s *mockDlpServer) DeleteDlpJob(ctx context.Context, req *dlppb.DeleteDlpJobRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockDlpServer) CancelDlpJob(ctx context.Context, req *dlppb.CancelDlpJobRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockDlpServer) CreateStoredInfoType(ctx context.Context, req *dlppb.CreateStoredInfoTypeRequest) (*dlppb.StoredInfoType, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.StoredInfoType), nil +} + +func (s *mockDlpServer) UpdateStoredInfoType(ctx context.Context, req *dlppb.UpdateStoredInfoTypeRequest) (*dlppb.StoredInfoType, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.StoredInfoType), nil +} + +func (s *mockDlpServer) GetStoredInfoType(ctx context.Context, req *dlppb.GetStoredInfoTypeRequest) (*dlppb.StoredInfoType, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.StoredInfoType), nil +} + +func (s *mockDlpServer) ListStoredInfoTypes(ctx context.Context, req *dlppb.ListStoredInfoTypesRequest) (*dlppb.ListStoredInfoTypesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*dlppb.ListStoredInfoTypesResponse), nil +} + +func (s *mockDlpServer) DeleteStoredInfoType(ctx context.Context, req *dlppb.DeleteStoredInfoTypeRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockDlp mockDlpServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + dlppb.RegisterDlpServiceServer(serv, &mockDlp) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestDlpServiceInspectContent(t *testing.T) { + var expectedResponse *dlppb.InspectContentResponse = &dlppb.InspectContentResponse{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.InspectContentRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.InspectContent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceInspectContentError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.InspectContentRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.InspectContent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceRedactImage(t *testing.T) { + var redactedImage []byte = []byte("28") + var extractedText string = "extractedText998260012" + var expectedResponse = &dlppb.RedactImageResponse{ + RedactedImage: redactedImage, + ExtractedText: extractedText, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.RedactImageRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RedactImage(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceRedactImageError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.RedactImageRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RedactImage(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceDeidentifyContent(t *testing.T) { + var expectedResponse *dlppb.DeidentifyContentResponse = &dlppb.DeidentifyContentResponse{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.DeidentifyContentRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DeidentifyContent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceDeidentifyContentError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.DeidentifyContentRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DeidentifyContent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceReidentifyContent(t *testing.T) { + var expectedResponse *dlppb.ReidentifyContentResponse = &dlppb.ReidentifyContentResponse{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.ReidentifyContentRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ReidentifyContent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceReidentifyContentError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.ReidentifyContentRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ReidentifyContent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceListInfoTypes(t *testing.T) { + var expectedResponse *dlppb.ListInfoTypesResponse = &dlppb.ListInfoTypesResponse{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var request *dlppb.ListInfoTypesRequest = &dlppb.ListInfoTypesRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInfoTypes(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceListInfoTypesError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var request *dlppb.ListInfoTypesRequest = &dlppb.ListInfoTypesRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInfoTypes(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceCreateInspectTemplate(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &dlppb.InspectTemplate{ + Name: name, + DisplayName: displayName, + Description: description, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.CreateInspectTemplateRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateInspectTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceCreateInspectTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.CreateInspectTemplateRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateInspectTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceUpdateInspectTemplate(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &dlppb.InspectTemplate{ + Name: name2, + DisplayName: displayName, + Description: description, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/inspectTemplates/%s", "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + var request = &dlppb.UpdateInspectTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateInspectTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceUpdateInspectTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/inspectTemplates/%s", "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + var request = &dlppb.UpdateInspectTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateInspectTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceGetInspectTemplate(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &dlppb.InspectTemplate{ + Name: name, + DisplayName: displayName, + Description: description, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var request *dlppb.GetInspectTemplateRequest = &dlppb.GetInspectTemplateRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInspectTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceGetInspectTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var request *dlppb.GetInspectTemplateRequest = &dlppb.GetInspectTemplateRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInspectTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceListInspectTemplates(t *testing.T) { + var nextPageToken string = "" + var inspectTemplatesElement *dlppb.InspectTemplate = &dlppb.InspectTemplate{} + var inspectTemplates = []*dlppb.InspectTemplate{inspectTemplatesElement} + var expectedResponse = &dlppb.ListInspectTemplatesResponse{ + NextPageToken: nextPageToken, + InspectTemplates: inspectTemplates, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.ListInspectTemplatesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInspectTemplates(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.InspectTemplates[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceListInspectTemplatesError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.ListInspectTemplatesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInspectTemplates(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceDeleteInspectTemplate(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/inspectTemplates/%s", "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + var request = &dlppb.DeleteInspectTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteInspectTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDlpServiceDeleteInspectTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/inspectTemplates/%s", "[ORGANIZATION]", "[INSPECT_TEMPLATE]") + var request = &dlppb.DeleteInspectTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteInspectTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDlpServiceCreateDeidentifyTemplate(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &dlppb.DeidentifyTemplate{ + Name: name, + DisplayName: displayName, + Description: description, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.CreateDeidentifyTemplateRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateDeidentifyTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceCreateDeidentifyTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.CreateDeidentifyTemplateRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateDeidentifyTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceUpdateDeidentifyTemplate(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &dlppb.DeidentifyTemplate{ + Name: name2, + DisplayName: displayName, + Description: description, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/deidentifyTemplates/%s", "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + var request = &dlppb.UpdateDeidentifyTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateDeidentifyTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceUpdateDeidentifyTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/deidentifyTemplates/%s", "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + var request = &dlppb.UpdateDeidentifyTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateDeidentifyTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceGetDeidentifyTemplate(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &dlppb.DeidentifyTemplate{ + Name: name2, + DisplayName: displayName, + Description: description, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/deidentifyTemplates/%s", "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + var request = &dlppb.GetDeidentifyTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDeidentifyTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceGetDeidentifyTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/deidentifyTemplates/%s", "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + var request = &dlppb.GetDeidentifyTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDeidentifyTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceListDeidentifyTemplates(t *testing.T) { + var nextPageToken string = "" + var deidentifyTemplatesElement *dlppb.DeidentifyTemplate = &dlppb.DeidentifyTemplate{} + var deidentifyTemplates = []*dlppb.DeidentifyTemplate{deidentifyTemplatesElement} + var expectedResponse = &dlppb.ListDeidentifyTemplatesResponse{ + NextPageToken: nextPageToken, + DeidentifyTemplates: deidentifyTemplates, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.ListDeidentifyTemplatesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDeidentifyTemplates(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.DeidentifyTemplates[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceListDeidentifyTemplatesError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.ListDeidentifyTemplatesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDeidentifyTemplates(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceDeleteDeidentifyTemplate(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/deidentifyTemplates/%s", "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + var request = &dlppb.DeleteDeidentifyTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteDeidentifyTemplate(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDlpServiceDeleteDeidentifyTemplateError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/deidentifyTemplates/%s", "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]") + var request = &dlppb.DeleteDeidentifyTemplateRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteDeidentifyTemplate(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDlpServiceCreateDlpJob(t *testing.T) { + var name string = "name3373707" + var jobTriggerName string = "jobTriggerName1819490804" + var expectedResponse = &dlppb.DlpJob{ + Name: name, + JobTriggerName: jobTriggerName, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.CreateDlpJobRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateDlpJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceCreateDlpJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.CreateDlpJobRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateDlpJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceListDlpJobs(t *testing.T) { + var nextPageToken string = "" + var jobsElement *dlppb.DlpJob = &dlppb.DlpJob{} + var jobs = []*dlppb.DlpJob{jobsElement} + var expectedResponse = &dlppb.ListDlpJobsResponse{ + NextPageToken: nextPageToken, + Jobs: jobs, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.ListDlpJobsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDlpJobs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Jobs[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceListDlpJobsError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.ListDlpJobsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDlpJobs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceGetDlpJob(t *testing.T) { + var name2 string = "name2-1052831874" + var jobTriggerName string = "jobTriggerName1819490804" + var expectedResponse = &dlppb.DlpJob{ + Name: name2, + JobTriggerName: jobTriggerName, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/dlpJobs/%s", "[PROJECT]", "[DLP_JOB]") + var request = &dlppb.GetDlpJobRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDlpJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceGetDlpJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/dlpJobs/%s", "[PROJECT]", "[DLP_JOB]") + var request = &dlppb.GetDlpJobRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDlpJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceDeleteDlpJob(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/dlpJobs/%s", "[PROJECT]", "[DLP_JOB]") + var request = &dlppb.DeleteDlpJobRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteDlpJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDlpServiceDeleteDlpJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/dlpJobs/%s", "[PROJECT]", "[DLP_JOB]") + var request = &dlppb.DeleteDlpJobRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteDlpJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDlpServiceCancelDlpJob(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/dlpJobs/%s", "[PROJECT]", "[DLP_JOB]") + var request = &dlppb.CancelDlpJobRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.CancelDlpJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDlpServiceCancelDlpJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/dlpJobs/%s", "[PROJECT]", "[DLP_JOB]") + var request = &dlppb.CancelDlpJobRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.CancelDlpJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDlpServiceListJobTriggers(t *testing.T) { + var nextPageToken string = "" + var jobTriggersElement *dlppb.JobTrigger = &dlppb.JobTrigger{} + var jobTriggers = []*dlppb.JobTrigger{jobTriggersElement} + var expectedResponse = &dlppb.ListJobTriggersResponse{ + NextPageToken: nextPageToken, + JobTriggers: jobTriggers, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.ListJobTriggersRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListJobTriggers(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.JobTriggers[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceListJobTriggersError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.ListJobTriggersRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListJobTriggers(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceGetJobTrigger(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &dlppb.JobTrigger{ + Name: name2, + DisplayName: displayName, + Description: description, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/jobTriggers/%s", "[PROJECT]", "[JOB_TRIGGER]") + var request = &dlppb.GetJobTriggerRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetJobTrigger(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceGetJobTriggerError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/jobTriggers/%s", "[PROJECT]", "[JOB_TRIGGER]") + var request = &dlppb.GetJobTriggerRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetJobTrigger(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceDeleteJobTrigger(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var name string = "name3373707" + var request = &dlppb.DeleteJobTriggerRequest{ + Name: name, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteJobTrigger(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDlpServiceDeleteJobTriggerError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var name string = "name3373707" + var request = &dlppb.DeleteJobTriggerRequest{ + Name: name, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteJobTrigger(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDlpServiceUpdateJobTrigger(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &dlppb.JobTrigger{ + Name: name2, + DisplayName: displayName, + Description: description, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/jobTriggers/%s", "[PROJECT]", "[JOB_TRIGGER]") + var request = &dlppb.UpdateJobTriggerRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateJobTrigger(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceUpdateJobTriggerError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/jobTriggers/%s", "[PROJECT]", "[JOB_TRIGGER]") + var request = &dlppb.UpdateJobTriggerRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateJobTrigger(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceCreateJobTrigger(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &dlppb.JobTrigger{ + Name: name, + DisplayName: displayName, + Description: description, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.CreateJobTriggerRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateJobTrigger(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceCreateJobTriggerError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &dlppb.CreateJobTriggerRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateJobTrigger(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceCreateStoredInfoType(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &dlppb.StoredInfoType{ + Name: name, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.CreateStoredInfoTypeRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateStoredInfoType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceCreateStoredInfoTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.CreateStoredInfoTypeRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateStoredInfoType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceUpdateStoredInfoType(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &dlppb.StoredInfoType{ + Name: name2, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/storedInfoTypes/%s", "[ORGANIZATION]", "[STORED_INFO_TYPE]") + var request = &dlppb.UpdateStoredInfoTypeRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateStoredInfoType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceUpdateStoredInfoTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/storedInfoTypes/%s", "[ORGANIZATION]", "[STORED_INFO_TYPE]") + var request = &dlppb.UpdateStoredInfoTypeRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateStoredInfoType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceGetStoredInfoType(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &dlppb.StoredInfoType{ + Name: name2, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/storedInfoTypes/%s", "[ORGANIZATION]", "[STORED_INFO_TYPE]") + var request = &dlppb.GetStoredInfoTypeRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetStoredInfoType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceGetStoredInfoTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/storedInfoTypes/%s", "[ORGANIZATION]", "[STORED_INFO_TYPE]") + var request = &dlppb.GetStoredInfoTypeRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetStoredInfoType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceListStoredInfoTypes(t *testing.T) { + var nextPageToken string = "" + var storedInfoTypesElement *dlppb.StoredInfoType = &dlppb.StoredInfoType{} + var storedInfoTypes = []*dlppb.StoredInfoType{storedInfoTypesElement} + var expectedResponse = &dlppb.ListStoredInfoTypesResponse{ + NextPageToken: nextPageToken, + StoredInfoTypes: storedInfoTypes, + } + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.ListStoredInfoTypesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListStoredInfoTypes(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.StoredInfoTypes[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDlpServiceListStoredInfoTypesError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &dlppb.ListStoredInfoTypesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListStoredInfoTypes(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDlpServiceDeleteStoredInfoType(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDlp.err = nil + mockDlp.reqs = nil + + mockDlp.resps = append(mockDlp.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/storedInfoTypes/%s", "[ORGANIZATION]", "[STORED_INFO_TYPE]") + var request = &dlppb.DeleteStoredInfoTypeRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteStoredInfoType(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDlp.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDlpServiceDeleteStoredInfoTypeError(t *testing.T) { + errCode := codes.PermissionDenied + mockDlp.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/storedInfoTypes/%s", "[ORGANIZATION]", "[STORED_INFO_TYPE]") + var request = &dlppb.DeleteStoredInfoTypeRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteStoredInfoType(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/ReportErrorEvent_smoke_test.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/ReportErrorEvent_smoke_test.go new file mode 100644 index 000000000..3470a2fe1 --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/ReportErrorEvent_smoke_test.go @@ -0,0 +1,88 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package errorreporting + +import ( + clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestReportErrorsServiceSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewReportErrorsClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var formattedProjectName string = fmt.Sprintf("projects/%s", projectId) + var message string = "[MESSAGE]" + var service string = "[SERVICE]" + var serviceContext = &clouderrorreportingpb.ServiceContext{ + Service: service, + } + var filePath string = "path/to/file.lang" + var lineNumber int32 = 42 + var functionName string = "meaningOfLife" + var reportLocation = &clouderrorreportingpb.SourceLocation{ + FilePath: filePath, + LineNumber: lineNumber, + FunctionName: functionName, + } + var context_ = &clouderrorreportingpb.ErrorContext{ + ReportLocation: reportLocation, + } + var event = &clouderrorreportingpb.ReportedErrorEvent{ + Message: message, + ServiceContext: serviceContext, + Context: context_, + } + var request = &clouderrorreportingpb.ReportErrorEventRequest{ + ProjectName: formattedProjectName, + Event: event, + } + + if _, err := c.ReportErrorEvent(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/doc.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/doc.go new file mode 100644 index 000000000..65af37904 --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/doc.go @@ -0,0 +1,93 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package errorreporting is an auto-generated package for the +// Stackdriver Error Reporting API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Stackdriver Error Reporting groups and counts similar errors from cloud +// services. The Stackdriver Error Reporting API provides a way to report new +// errors and read access to error groups and their associated errors. +// +// Use the client at cloud.google.com/go/errorreporting in preference to this. +package errorreporting // import "cloud.google.com/go/errorreporting/apiv1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_group_client.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_group_client.go new file mode 100644 index 000000000..d4d360a8c --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_group_client.go @@ -0,0 +1,152 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package errorreporting + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ErrorGroupCallOptions contains the retry settings for each method of ErrorGroupClient. +type ErrorGroupCallOptions struct { + GetGroup []gax.CallOption + UpdateGroup []gax.CallOption +} + +func defaultErrorGroupClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("clouderrorreporting.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultErrorGroupCallOptions() *ErrorGroupCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ErrorGroupCallOptions{ + GetGroup: retry[[2]string{"default", "idempotent"}], + UpdateGroup: retry[[2]string{"default", "idempotent"}], + } +} + +// ErrorGroupClient is a client for interacting with Stackdriver Error Reporting API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ErrorGroupClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + errorGroupClient clouderrorreportingpb.ErrorGroupServiceClient + + // The call options for this service. + CallOptions *ErrorGroupCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewErrorGroupClient creates a new error group service client. +// +// Service for retrieving and updating individual error groups. +func NewErrorGroupClient(ctx context.Context, opts ...option.ClientOption) (*ErrorGroupClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultErrorGroupClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ErrorGroupClient{ + conn: conn, + CallOptions: defaultErrorGroupCallOptions(), + + errorGroupClient: clouderrorreportingpb.NewErrorGroupServiceClient(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ErrorGroupClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ErrorGroupClient) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ErrorGroupClient) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// GetGroup get the specified group. +func (c *ErrorGroupClient) GetGroup(ctx context.Context, req *clouderrorreportingpb.GetGroupRequest, opts ...gax.CallOption) (*clouderrorreportingpb.ErrorGroup, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetGroup[0:len(c.CallOptions.GetGroup):len(c.CallOptions.GetGroup)], opts...) + var resp *clouderrorreportingpb.ErrorGroup + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.errorGroupClient.GetGroup(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateGroup replace the data for the specified group. +// Fails if the group does not exist. +func (c *ErrorGroupClient) UpdateGroup(ctx context.Context, req *clouderrorreportingpb.UpdateGroupRequest, opts ...gax.CallOption) (*clouderrorreportingpb.ErrorGroup, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateGroup[0:len(c.CallOptions.UpdateGroup):len(c.CallOptions.UpdateGroup)], opts...) + var resp *clouderrorreportingpb.ErrorGroup + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.errorGroupClient.UpdateGroup(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_group_client_example_test.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_group_client_example_test.go new file mode 100644 index 000000000..de8435c20 --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_group_client_example_test.go @@ -0,0 +1,70 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package errorreporting_test + +import ( + "context" + + errorreporting "cloud.google.com/go/errorreporting/apiv1beta1" + clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" +) + +func ExampleNewErrorGroupClient() { + ctx := context.Background() + c, err := errorreporting.NewErrorGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleErrorGroupClient_GetGroup() { + ctx := context.Background() + c, err := errorreporting.NewErrorGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouderrorreportingpb.GetGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetGroup(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleErrorGroupClient_UpdateGroup() { + ctx := context.Background() + c, err := errorreporting.NewErrorGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouderrorreportingpb.UpdateGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateGroup(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_stats_client.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_stats_client.go new file mode 100644 index 000000000..52c06b5aa --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_stats_client.go @@ -0,0 +1,299 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package errorreporting + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ErrorStatsCallOptions contains the retry settings for each method of ErrorStatsClient. +type ErrorStatsCallOptions struct { + ListGroupStats []gax.CallOption + ListEvents []gax.CallOption + DeleteEvents []gax.CallOption +} + +func defaultErrorStatsClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("clouderrorreporting.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultErrorStatsCallOptions() *ErrorStatsCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ErrorStatsCallOptions{ + ListGroupStats: retry[[2]string{"default", "idempotent"}], + ListEvents: retry[[2]string{"default", "idempotent"}], + DeleteEvents: retry[[2]string{"default", "idempotent"}], + } +} + +// ErrorStatsClient is a client for interacting with Stackdriver Error Reporting API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ErrorStatsClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + errorStatsClient clouderrorreportingpb.ErrorStatsServiceClient + + // The call options for this service. + CallOptions *ErrorStatsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewErrorStatsClient creates a new error stats service client. +// +// An API for retrieving and managing error statistics as well as data for +// individual events. +func NewErrorStatsClient(ctx context.Context, opts ...option.ClientOption) (*ErrorStatsClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultErrorStatsClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ErrorStatsClient{ + conn: conn, + CallOptions: defaultErrorStatsCallOptions(), + + errorStatsClient: clouderrorreportingpb.NewErrorStatsServiceClient(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ErrorStatsClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ErrorStatsClient) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ErrorStatsClient) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListGroupStats lists the specified groups. +func (c *ErrorStatsClient) ListGroupStats(ctx context.Context, req *clouderrorreportingpb.ListGroupStatsRequest, opts ...gax.CallOption) *ErrorGroupStatsIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListGroupStats[0:len(c.CallOptions.ListGroupStats):len(c.CallOptions.ListGroupStats)], opts...) + it := &ErrorGroupStatsIterator{} + req = proto.Clone(req).(*clouderrorreportingpb.ListGroupStatsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*clouderrorreportingpb.ErrorGroupStats, string, error) { + var resp *clouderrorreportingpb.ListGroupStatsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.errorStatsClient.ListGroupStats(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.ErrorGroupStats, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListEvents lists the specified events. +func (c *ErrorStatsClient) ListEvents(ctx context.Context, req *clouderrorreportingpb.ListEventsRequest, opts ...gax.CallOption) *ErrorEventIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListEvents[0:len(c.CallOptions.ListEvents):len(c.CallOptions.ListEvents)], opts...) + it := &ErrorEventIterator{} + req = proto.Clone(req).(*clouderrorreportingpb.ListEventsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*clouderrorreportingpb.ErrorEvent, string, error) { + var resp *clouderrorreportingpb.ListEventsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.errorStatsClient.ListEvents(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.ErrorEvents, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteEvents deletes all error events of a given project. +func (c *ErrorStatsClient) DeleteEvents(ctx context.Context, req *clouderrorreportingpb.DeleteEventsRequest, opts ...gax.CallOption) (*clouderrorreportingpb.DeleteEventsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteEvents[0:len(c.CallOptions.DeleteEvents):len(c.CallOptions.DeleteEvents)], opts...) + var resp *clouderrorreportingpb.DeleteEventsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.errorStatsClient.DeleteEvents(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ErrorEventIterator manages a stream of *clouderrorreportingpb.ErrorEvent. +type ErrorEventIterator struct { + items []*clouderrorreportingpb.ErrorEvent + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*clouderrorreportingpb.ErrorEvent, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ErrorEventIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ErrorEventIterator) Next() (*clouderrorreportingpb.ErrorEvent, error) { + var item *clouderrorreportingpb.ErrorEvent + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ErrorEventIterator) bufLen() int { + return len(it.items) +} + +func (it *ErrorEventIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ErrorGroupStatsIterator manages a stream of *clouderrorreportingpb.ErrorGroupStats. +type ErrorGroupStatsIterator struct { + items []*clouderrorreportingpb.ErrorGroupStats + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*clouderrorreportingpb.ErrorGroupStats, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ErrorGroupStatsIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ErrorGroupStatsIterator) Next() (*clouderrorreportingpb.ErrorGroupStats, error) { + var item *clouderrorreportingpb.ErrorGroupStats + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ErrorGroupStatsIterator) bufLen() int { + return len(it.items) +} + +func (it *ErrorGroupStatsIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_stats_client_example_test.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_stats_client_example_test.go new file mode 100644 index 000000000..fdcf75a31 --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/error_stats_client_example_test.go @@ -0,0 +1,101 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package errorreporting_test + +import ( + "context" + + errorreporting "cloud.google.com/go/errorreporting/apiv1beta1" + "google.golang.org/api/iterator" + clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" +) + +func ExampleNewErrorStatsClient() { + ctx := context.Background() + c, err := errorreporting.NewErrorStatsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleErrorStatsClient_ListGroupStats() { + ctx := context.Background() + c, err := errorreporting.NewErrorStatsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouderrorreportingpb.ListGroupStatsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListGroupStats(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleErrorStatsClient_ListEvents() { + ctx := context.Background() + c, err := errorreporting.NewErrorStatsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouderrorreportingpb.ListEventsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListEvents(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleErrorStatsClient_DeleteEvents() { + ctx := context.Background() + c, err := errorreporting.NewErrorStatsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouderrorreportingpb.DeleteEventsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DeleteEvents(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/mock_test.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/mock_test.go new file mode 100644 index 000000000..75f5cb8c3 --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/mock_test.go @@ -0,0 +1,587 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package errorreporting + +import ( + clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockErrorGroupServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + clouderrorreportingpb.ErrorGroupServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockErrorGroupServer) GetGroup(ctx context.Context, req *clouderrorreportingpb.GetGroupRequest) (*clouderrorreportingpb.ErrorGroup, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouderrorreportingpb.ErrorGroup), nil +} + +func (s *mockErrorGroupServer) UpdateGroup(ctx context.Context, req *clouderrorreportingpb.UpdateGroupRequest) (*clouderrorreportingpb.ErrorGroup, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouderrorreportingpb.ErrorGroup), nil +} + +type mockErrorStatsServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + clouderrorreportingpb.ErrorStatsServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockErrorStatsServer) ListGroupStats(ctx context.Context, req *clouderrorreportingpb.ListGroupStatsRequest) (*clouderrorreportingpb.ListGroupStatsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouderrorreportingpb.ListGroupStatsResponse), nil +} + +func (s *mockErrorStatsServer) ListEvents(ctx context.Context, req *clouderrorreportingpb.ListEventsRequest) (*clouderrorreportingpb.ListEventsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouderrorreportingpb.ListEventsResponse), nil +} + +func (s *mockErrorStatsServer) DeleteEvents(ctx context.Context, req *clouderrorreportingpb.DeleteEventsRequest) (*clouderrorreportingpb.DeleteEventsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouderrorreportingpb.DeleteEventsResponse), nil +} + +type mockReportErrorsServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + clouderrorreportingpb.ReportErrorsServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockReportErrorsServer) ReportErrorEvent(ctx context.Context, req *clouderrorreportingpb.ReportErrorEventRequest) (*clouderrorreportingpb.ReportErrorEventResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*clouderrorreportingpb.ReportErrorEventResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockErrorGroup mockErrorGroupServer + mockErrorStats mockErrorStatsServer + mockReportErrors mockReportErrorsServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + clouderrorreportingpb.RegisterErrorGroupServiceServer(serv, &mockErrorGroup) + clouderrorreportingpb.RegisterErrorStatsServiceServer(serv, &mockErrorStats) + clouderrorreportingpb.RegisterReportErrorsServiceServer(serv, &mockReportErrors) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestErrorGroupServiceGetGroup(t *testing.T) { + var name string = "name3373707" + var groupId string = "groupId506361563" + var expectedResponse = &clouderrorreportingpb.ErrorGroup{ + Name: name, + GroupId: groupId, + } + + mockErrorGroup.err = nil + mockErrorGroup.reqs = nil + + mockErrorGroup.resps = append(mockErrorGroup.resps[:0], expectedResponse) + + var formattedGroupName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]") + var request = &clouderrorreportingpb.GetGroupRequest{ + GroupName: formattedGroupName, + } + + c, err := NewErrorGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetGroup(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockErrorGroup.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestErrorGroupServiceGetGroupError(t *testing.T) { + errCode := codes.PermissionDenied + mockErrorGroup.err = gstatus.Error(errCode, "test error") + + var formattedGroupName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]") + var request = &clouderrorreportingpb.GetGroupRequest{ + GroupName: formattedGroupName, + } + + c, err := NewErrorGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetGroup(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestErrorGroupServiceUpdateGroup(t *testing.T) { + var name string = "name3373707" + var groupId string = "groupId506361563" + var expectedResponse = &clouderrorreportingpb.ErrorGroup{ + Name: name, + GroupId: groupId, + } + + mockErrorGroup.err = nil + mockErrorGroup.reqs = nil + + mockErrorGroup.resps = append(mockErrorGroup.resps[:0], expectedResponse) + + var group *clouderrorreportingpb.ErrorGroup = &clouderrorreportingpb.ErrorGroup{} + var request = &clouderrorreportingpb.UpdateGroupRequest{ + Group: group, + } + + c, err := NewErrorGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateGroup(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockErrorGroup.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestErrorGroupServiceUpdateGroupError(t *testing.T) { + errCode := codes.PermissionDenied + mockErrorGroup.err = gstatus.Error(errCode, "test error") + + var group *clouderrorreportingpb.ErrorGroup = &clouderrorreportingpb.ErrorGroup{} + var request = &clouderrorreportingpb.UpdateGroupRequest{ + Group: group, + } + + c, err := NewErrorGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateGroup(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestErrorStatsServiceListGroupStats(t *testing.T) { + var nextPageToken string = "" + var errorGroupStatsElement *clouderrorreportingpb.ErrorGroupStats = &clouderrorreportingpb.ErrorGroupStats{} + var errorGroupStats = []*clouderrorreportingpb.ErrorGroupStats{errorGroupStatsElement} + var expectedResponse = &clouderrorreportingpb.ListGroupStatsResponse{ + NextPageToken: nextPageToken, + ErrorGroupStats: errorGroupStats, + } + + mockErrorStats.err = nil + mockErrorStats.reqs = nil + + mockErrorStats.resps = append(mockErrorStats.resps[:0], expectedResponse) + + var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var timeRange *clouderrorreportingpb.QueryTimeRange = &clouderrorreportingpb.QueryTimeRange{} + var request = &clouderrorreportingpb.ListGroupStatsRequest{ + ProjectName: formattedProjectName, + TimeRange: timeRange, + } + + c, err := NewErrorStatsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListGroupStats(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockErrorStats.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.ErrorGroupStats[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestErrorStatsServiceListGroupStatsError(t *testing.T) { + errCode := codes.PermissionDenied + mockErrorStats.err = gstatus.Error(errCode, "test error") + + var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var timeRange *clouderrorreportingpb.QueryTimeRange = &clouderrorreportingpb.QueryTimeRange{} + var request = &clouderrorreportingpb.ListGroupStatsRequest{ + ProjectName: formattedProjectName, + TimeRange: timeRange, + } + + c, err := NewErrorStatsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListGroupStats(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestErrorStatsServiceListEvents(t *testing.T) { + var nextPageToken string = "" + var errorEventsElement *clouderrorreportingpb.ErrorEvent = &clouderrorreportingpb.ErrorEvent{} + var errorEvents = []*clouderrorreportingpb.ErrorEvent{errorEventsElement} + var expectedResponse = &clouderrorreportingpb.ListEventsResponse{ + NextPageToken: nextPageToken, + ErrorEvents: errorEvents, + } + + mockErrorStats.err = nil + mockErrorStats.reqs = nil + + mockErrorStats.resps = append(mockErrorStats.resps[:0], expectedResponse) + + var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var groupId string = "groupId506361563" + var request = &clouderrorreportingpb.ListEventsRequest{ + ProjectName: formattedProjectName, + GroupId: groupId, + } + + c, err := NewErrorStatsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListEvents(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockErrorStats.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.ErrorEvents[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestErrorStatsServiceListEventsError(t *testing.T) { + errCode := codes.PermissionDenied + mockErrorStats.err = gstatus.Error(errCode, "test error") + + var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var groupId string = "groupId506361563" + var request = &clouderrorreportingpb.ListEventsRequest{ + ProjectName: formattedProjectName, + GroupId: groupId, + } + + c, err := NewErrorStatsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListEvents(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestErrorStatsServiceDeleteEvents(t *testing.T) { + var expectedResponse *clouderrorreportingpb.DeleteEventsResponse = &clouderrorreportingpb.DeleteEventsResponse{} + + mockErrorStats.err = nil + mockErrorStats.reqs = nil + + mockErrorStats.resps = append(mockErrorStats.resps[:0], expectedResponse) + + var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &clouderrorreportingpb.DeleteEventsRequest{ + ProjectName: formattedProjectName, + } + + c, err := NewErrorStatsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DeleteEvents(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockErrorStats.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestErrorStatsServiceDeleteEventsError(t *testing.T) { + errCode := codes.PermissionDenied + mockErrorStats.err = gstatus.Error(errCode, "test error") + + var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &clouderrorreportingpb.DeleteEventsRequest{ + ProjectName: formattedProjectName, + } + + c, err := NewErrorStatsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DeleteEvents(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestReportErrorsServiceReportErrorEvent(t *testing.T) { + var expectedResponse *clouderrorreportingpb.ReportErrorEventResponse = &clouderrorreportingpb.ReportErrorEventResponse{} + + mockReportErrors.err = nil + mockReportErrors.reqs = nil + + mockReportErrors.resps = append(mockReportErrors.resps[:0], expectedResponse) + + var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var event *clouderrorreportingpb.ReportedErrorEvent = &clouderrorreportingpb.ReportedErrorEvent{} + var request = &clouderrorreportingpb.ReportErrorEventRequest{ + ProjectName: formattedProjectName, + Event: event, + } + + c, err := NewReportErrorsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ReportErrorEvent(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockReportErrors.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestReportErrorsServiceReportErrorEventError(t *testing.T) { + errCode := codes.PermissionDenied + mockReportErrors.err = gstatus.Error(errCode, "test error") + + var formattedProjectName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var event *clouderrorreportingpb.ReportedErrorEvent = &clouderrorreportingpb.ReportedErrorEvent{} + var request = &clouderrorreportingpb.ReportErrorEventRequest{ + ProjectName: formattedProjectName, + Event: event, + } + + c, err := NewReportErrorsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ReportErrorEvent(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/path_funcs.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/path_funcs.go new file mode 100644 index 000000000..5ca5e9272 --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/path_funcs.go @@ -0,0 +1,51 @@ +// 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 +// +// https://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 errorreporting + +// ResultPath returns the path for the result resource. +// +// Deprecated: Use +// fmt.Sprintf("inspect/results/%s", result) +// instead. +func ResultPath(result string) string { + return "" + + "inspect/results/" + + result + + "" +} + +// ErrorStatsProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func ErrorStatsProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// ReportErrorsProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func ReportErrorsProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/report_errors_client.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/report_errors_client.go new file mode 100644 index 000000000..fa16976ce --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/report_errors_client.go @@ -0,0 +1,124 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package errorreporting + +import ( + "context" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +// ReportErrorsCallOptions contains the retry settings for each method of ReportErrorsClient. +type ReportErrorsCallOptions struct { + ReportErrorEvent []gax.CallOption +} + +func defaultReportErrorsClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("clouderrorreporting.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultReportErrorsCallOptions() *ReportErrorsCallOptions { + retry := map[[2]string][]gax.CallOption{} + return &ReportErrorsCallOptions{ + ReportErrorEvent: retry[[2]string{"default", "non_idempotent"}], + } +} + +// ReportErrorsClient is a client for interacting with Stackdriver Error Reporting API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ReportErrorsClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + reportErrorsClient clouderrorreportingpb.ReportErrorsServiceClient + + // The call options for this service. + CallOptions *ReportErrorsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewReportErrorsClient creates a new report errors service client. +// +// An API for reporting error events. +func NewReportErrorsClient(ctx context.Context, opts ...option.ClientOption) (*ReportErrorsClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultReportErrorsClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ReportErrorsClient{ + conn: conn, + CallOptions: defaultReportErrorsCallOptions(), + + reportErrorsClient: clouderrorreportingpb.NewReportErrorsServiceClient(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ReportErrorsClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ReportErrorsClient) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ReportErrorsClient) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ReportErrorEvent report an individual error event. +// +// This endpoint accepts either an OAuth token, +// or an +// API key +// for authentication. To use an API key, append it to the URL as the value of +// a key parameter. For example:
POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456
+func (c *ReportErrorsClient) ReportErrorEvent(ctx context.Context, req *clouderrorreportingpb.ReportErrorEventRequest, opts ...gax.CallOption) (*clouderrorreportingpb.ReportErrorEventResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ReportErrorEvent[0:len(c.CallOptions.ReportErrorEvent):len(c.CallOptions.ReportErrorEvent)], opts...) + var resp *clouderrorreportingpb.ReportErrorEventResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.reportErrorsClient.ReportErrorEvent(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/errorreporting/apiv1beta1/report_errors_client_example_test.go b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/report_errors_client_example_test.go new file mode 100644 index 000000000..eb1db0975 --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/apiv1beta1/report_errors_client_example_test.go @@ -0,0 +1,52 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package errorreporting_test + +import ( + "context" + + errorreporting "cloud.google.com/go/errorreporting/apiv1beta1" + clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" +) + +func ExampleNewReportErrorsClient() { + ctx := context.Background() + c, err := errorreporting.NewReportErrorsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleReportErrorsClient_ReportErrorEvent() { + ctx := context.Background() + c, err := errorreporting.NewReportErrorsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &clouderrorreportingpb.ReportErrorEventRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ReportErrorEvent(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/errorreporting/errors.go b/vendor/cloud.google.com/go/errorreporting/errors.go new file mode 100644 index 000000000..1a4705797 --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/errors.go @@ -0,0 +1,231 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package errorreporting is a Google Stackdriver Error Reporting library. +// +// This package is still experimental and subject to change. +// +// See https://cloud.google.com/error-reporting/ for more information. +package errorreporting // import "cloud.google.com/go/errorreporting" + +import ( + "bytes" + "context" + "fmt" + "log" + "net/http" + "runtime" + "time" + + vkit "cloud.google.com/go/errorreporting/apiv1beta1" + "cloud.google.com/go/internal/version" + "github.com/golang/protobuf/ptypes" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/support/bundler" + pb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" +) + +const ( + userAgent = `gcloud-golang-errorreporting/20160701` +) + +// Config is additional configuration for Client. +type Config struct { + // ServiceName identifies the running program and is included in the error reports. + // Optional. + ServiceName string + + // ServiceVersion identifies the version of the running program and is + // included in the error reports. + // Optional. + ServiceVersion string + + // OnError is the function to call if any background + // tasks errored. By default, errors are logged. + OnError func(err error) +} + +// Entry holds information about the reported error. +type Entry struct { + Error error + Req *http.Request // if error is associated with a request. + User string // an identifier for the user affected by the error + Stack []byte // if user does not provide a stack trace, runtime.Stack will be called +} + +// Client represents a Google Cloud Error Reporting client. +type Client struct { + projectName string + apiClient client + serviceContext *pb.ServiceContext + bundler *bundler.Bundler + + onErrorFn func(err error) +} + +var newClient = func(ctx context.Context, opts ...option.ClientOption) (client, error) { + client, err := vkit.NewReportErrorsClient(ctx, opts...) + if err != nil { + return nil, err + } + client.SetGoogleClientInfo("gccl", version.Repo) + return client, nil +} + +// NewClient returns a new error reporting client. Generally you will want +// to create a client on program initialization and use it through the lifetime +// of the process. +func NewClient(ctx context.Context, projectID string, cfg Config, opts ...option.ClientOption) (*Client, error) { + if cfg.ServiceName == "" { + cfg.ServiceName = "goapp" + } + c, err := newClient(ctx, opts...) + if err != nil { + return nil, fmt.Errorf("creating client: %v", err) + } + + client := &Client{ + apiClient: c, + projectName: "projects/" + projectID, + serviceContext: &pb.ServiceContext{ + Service: cfg.ServiceName, + Version: cfg.ServiceVersion, + }, + onErrorFn: cfg.OnError, + } + bundler := bundler.NewBundler((*pb.ReportErrorEventRequest)(nil), func(bundle interface{}) { + reqs := bundle.([]*pb.ReportErrorEventRequest) + for _, req := range reqs { + _, err = client.apiClient.ReportErrorEvent(ctx, req) + if err != nil { + client.onError(err) + } + } + }) + // TODO(jbd): Optimize bundler limits. + bundler.DelayThreshold = 2 * time.Second + bundler.BundleCountThreshold = 100 + bundler.BundleByteThreshold = 1000 + bundler.BundleByteLimit = 1000 + bundler.BufferedByteLimit = 10000 + client.bundler = bundler + return client, nil +} + +func (c *Client) onError(err error) { + if c.onErrorFn != nil { + c.onErrorFn(err) + return + } + log.Println(err) +} + +// Close calls Flush, then closes any resources held by the client. +// Close should be called when the client is no longer needed. +func (c *Client) Close() error { + c.Flush() + return c.apiClient.Close() +} + +// Report writes an error report. It doesn't block. Errors in +// writing the error report can be handled via Config.OnError. +func (c *Client) Report(e Entry) { + c.bundler.Add(c.newRequest(e), 1) +} + +// ReportSync writes an error report. It blocks until the entry is written. +func (c *Client) ReportSync(ctx context.Context, e Entry) error { + _, err := c.apiClient.ReportErrorEvent(ctx, c.newRequest(e)) + return err +} + +// Flush blocks until all currently buffered error reports are sent. +// +// If any errors occurred since the last call to Flush, or the +// creation of the client if this is the first call, then Flush reports the +// error via the Config.OnError handler. +func (c *Client) Flush() { + c.bundler.Flush() +} + +func (c *Client) newRequest(e Entry) *pb.ReportErrorEventRequest { + var stack string + if e.Stack != nil { + stack = string(e.Stack) + } else { + // limit the stack trace to 16k. + var buf [16 * 1024]byte + stack = chopStack(buf[0:runtime.Stack(buf[:], false)]) + } + message := e.Error.Error() + "\n" + stack + + var errorContext *pb.ErrorContext + if r := e.Req; r != nil { + errorContext = &pb.ErrorContext{ + HttpRequest: &pb.HttpRequestContext{ + Method: r.Method, + Url: r.Host + r.RequestURI, + UserAgent: r.UserAgent(), + Referrer: r.Referer(), + RemoteIp: r.RemoteAddr, + }, + } + } + if e.User != "" { + if errorContext == nil { + errorContext = &pb.ErrorContext{} + } + errorContext.User = e.User + } + return &pb.ReportErrorEventRequest{ + ProjectName: c.projectName, + Event: &pb.ReportedErrorEvent{ + EventTime: ptypes.TimestampNow(), + ServiceContext: c.serviceContext, + Message: message, + Context: errorContext, + }, + } +} + +// chopStack trims a stack trace so that the function which panics or calls +// Report is first. +func chopStack(s []byte) string { + f := []byte("cloud.google.com/go/errorreporting.(*Client).Report") + + lfFirst := bytes.IndexByte(s, '\n') + if lfFirst == -1 { + return string(s) + } + stack := s[lfFirst:] + panicLine := bytes.Index(stack, f) + if panicLine == -1 { + return string(s) + } + stack = stack[panicLine+1:] + for i := 0; i < 2; i++ { + nextLine := bytes.IndexByte(stack, '\n') + if nextLine == -1 { + return string(s) + } + stack = stack[nextLine+1:] + } + return string(s[:lfFirst+1]) + string(stack) +} + +type client interface { + ReportErrorEvent(ctx context.Context, req *pb.ReportErrorEventRequest, opts ...gax.CallOption) (*pb.ReportErrorEventResponse, error) + Close() error +} diff --git a/vendor/cloud.google.com/go/errorreporting/errors_test.go b/vendor/cloud.google.com/go/errorreporting/errors_test.go new file mode 100644 index 000000000..29a7adb84 --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/errors_test.go @@ -0,0 +1,175 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errorreporting + +import ( + "context" + "errors" + "strings" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + pb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1" +) + +type fakeReportErrorsClient struct { + req *pb.ReportErrorEventRequest + fail bool + doneCh chan struct{} +} + +func (c *fakeReportErrorsClient) ReportErrorEvent(ctx context.Context, req *pb.ReportErrorEventRequest, _ ...gax.CallOption) (*pb.ReportErrorEventResponse, error) { + defer close(c.doneCh) + if c.fail { + return nil, errors.New("request failed") + } + c.req = req + return &pb.ReportErrorEventResponse{}, nil +} + +func (c *fakeReportErrorsClient) Close() error { + return nil +} + +var defaultConfig = Config{ + ServiceName: "myservice", + ServiceVersion: "v1.0", +} + +func newFakeReportErrorsClient() *fakeReportErrorsClient { + c := &fakeReportErrorsClient{} + c.doneCh = make(chan struct{}) + return c +} + +func newTestClient(c *fakeReportErrorsClient, cfg Config) *Client { + newClient = func(ctx context.Context, opts ...option.ClientOption) (client, error) { + return c, nil + } + t, err := NewClient(context.Background(), testutil.ProjID(), cfg) + if err != nil { + panic(err) + } + return t +} + +func commonChecks(t *testing.T, req *pb.ReportErrorEventRequest, fn string) { + if req.Event.ServiceContext.Service != "myservice" { + t.Errorf("error report didn't contain service name") + } + if req.Event.ServiceContext.Version != "v1.0" { + t.Errorf("error report didn't contain version name") + } + if !strings.Contains(req.Event.Message, "error") { + t.Errorf("error report didn't contain message") + } + if !strings.Contains(req.Event.Message, fn) { + t.Errorf("error report didn't contain stack trace") + } + if got, want := req.Event.Context.User, "user"; got != want { + t.Errorf("got %q, want %q", got, want) + } +} + +func TestReport(t *testing.T) { + fc := newFakeReportErrorsClient() + c := newTestClient(fc, defaultConfig) + c.Report(Entry{Error: errors.New("error"), User: "user"}) + c.Flush() + <-fc.doneCh + r := fc.req + if r == nil { + t.Fatalf("got no error report, expected one") + } + commonChecks(t, r, "errorreporting.TestReport") +} + +func TestReportSync(t *testing.T) { + ctx := context.Background() + fc := newFakeReportErrorsClient() + c := newTestClient(fc, defaultConfig) + if err := c.ReportSync(ctx, Entry{Error: errors.New("error"), User: "user"}); err != nil { + t.Fatalf("cannot upload errors: %v", err) + } + + <-fc.doneCh + r := fc.req + if r == nil { + t.Fatalf("got no error report, expected one") + } + commonChecks(t, r, "errorreporting.TestReport") +} + +func TestOnError(t *testing.T) { + fc := newFakeReportErrorsClient() + fc.fail = true + cfg := defaultConfig + errc := make(chan error, 1) + cfg.OnError = func(err error) { errc <- err } + c := newTestClient(fc, cfg) + c.Report(Entry{Error: errors.New("error")}) + c.Flush() + <-fc.doneCh + select { + case err := <-errc: + if err == nil { + t.Error("got nil, want error") + } + case <-time.After(5 * time.Second): + t.Error("timeout") + } +} + +func TestChopStack(t *testing.T) { + for _, test := range []struct { + name string + in []byte + expected string + }{ + { + name: "Report", + in: []byte(` goroutine 39 [running]: +runtime/debug.Stack() + /gopath/runtime/debug/stack.go:24 +0x79 +cloud.google.com/go/errorreporting.(*Client).logInternal() + /gopath/cloud.google.com/go/errorreporting/errors.go:259 +0x18b +cloud.google.com/go/errorreporting.(*Client).Report() + /gopath/cloud.google.com/go/errorreporting/errors.go:248 +0x4ed +cloud.google.com/go/errorreporting.TestReport() + /gopath/cloud.google.com/go/errorreporting/errors_test.go:137 +0x2a1 +testing.tRunner() + /gopath/testing/testing.go:610 +0x81 +created by testing.(*T).Run + /gopath/testing/testing.go:646 +0x2ec +`), + expected: ` goroutine 39 [running]: +cloud.google.com/go/errorreporting.TestReport() + /gopath/cloud.google.com/go/errorreporting/errors_test.go:137 +0x2a1 +testing.tRunner() + /gopath/testing/testing.go:610 +0x81 +created by testing.(*T).Run + /gopath/testing/testing.go:646 +0x2ec +`, + }, + } { + out := chopStack(test.in) + if out != test.expected { + t.Errorf("case %q: chopStack(%q): got %q want %q", test.name, test.in, out, test.expected) + } + } +} diff --git a/vendor/cloud.google.com/go/errorreporting/example_test.go b/vendor/cloud.google.com/go/errorreporting/example_test.go new file mode 100644 index 000000000..f06c36b8d --- /dev/null +++ b/vendor/cloud.google.com/go/errorreporting/example_test.go @@ -0,0 +1,52 @@ +// Copyright 2017 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 errorreporting_test + +import ( + "context" + "errors" + "log" + + "cloud.google.com/go/errorreporting" +) + +func Example() { + // Create the client. + ctx := context.Background() + ec, err := errorreporting.NewClient(ctx, "my-gcp-project", errorreporting.Config{ + ServiceName: "myservice", + ServiceVersion: "v1.0", + }) + if err != nil { + // TODO: handle error + } + defer func() { + if err := ec.Close(); err != nil { + log.Printf("failed to report errors to Stackdriver: %v", err) + } + }() + + // Report an error. + err = doSomething() + if err != nil { + ec.Report(errorreporting.Entry{ + Error: err, + }) + } +} + +func doSomething() error { + return errors.New("something went wrong") +} diff --git a/vendor/cloud.google.com/go/examples_test.go b/vendor/cloud.google.com/go/examples_test.go new file mode 100644 index 000000000..c623ba9df --- /dev/null +++ b/vendor/cloud.google.com/go/examples_test.go @@ -0,0 +1,60 @@ +// 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. + +package cloud_test + +import ( + "context" + "time" + + "cloud.google.com/go/bigquery" +) + +// To set a timeout for an RPC, use context.WithTimeout. +func Example_timeout() { + ctx := context.Background() + // Do not set a timeout on the context passed to NewClient: dialing happens + // asynchronously, and the context is used to refresh credentials in the + // background. + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: handle error. + } + // Time out if it takes more than 10 seconds to create a dataset. + tctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() // Always call cancel. + + if err := client.Dataset("new-dataset").Create(tctx, nil); err != nil { + // TODO: handle error. + } +} + +// To arrange for an RPC to be canceled, use context.WithCancel. +func Example_cancellation() { + ctx := context.Background() + // Do not cancel the context passed to NewClient: dialing happens asynchronously, + // and the context is used to refresh credentials in the background. + client, err := bigquery.NewClient(ctx, "project-id") + if err != nil { + // TODO: handle error. + } + cctx, cancel := context.WithCancel(ctx) + defer cancel() // Always call cancel. + + // TODO: Make the cancel function available to whatever might want to cancel the + // call--perhaps a GUI button. + if err := client.Dataset("new-dataset").Create(cctx, nil); err != nil { + // TODO: handle error. + } +} diff --git a/vendor/cloud.google.com/go/expr/apiv1alpha1/cel_client.go b/vendor/cloud.google.com/go/expr/apiv1alpha1/cel_client.go new file mode 100644 index 000000000..fedeccb45 --- /dev/null +++ b/vendor/cloud.google.com/go/expr/apiv1alpha1/cel_client.go @@ -0,0 +1,160 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package expr + +import ( + "context" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +// CelCallOptions contains the retry settings for each method of CelClient. +type CelCallOptions struct { + Parse []gax.CallOption + Check []gax.CallOption + Eval []gax.CallOption +} + +func defaultCelClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cel.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCelCallOptions() *CelCallOptions { + retry := map[[2]string][]gax.CallOption{} + return &CelCallOptions{ + Parse: retry[[2]string{"default", "non_idempotent"}], + Check: retry[[2]string{"default", "non_idempotent"}], + Eval: retry[[2]string{"default", "non_idempotent"}], + } +} + +// CelClient is a client for interacting with Common Expression Language. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type CelClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + celClient exprpb.CelServiceClient + + // The call options for this service. + CallOptions *CelCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewCelClient creates a new cel service client. +// +// Access a CEL implementation from another process or machine. +// A CEL implementation is decomposed as a parser, a static checker, +// and an evaluator. Every CEL implementation is expected to provide +// a server for this API. The API will be used for conformance testing, +// utilities, and execution as a service. +func NewCelClient(ctx context.Context, opts ...option.ClientOption) (*CelClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultCelClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &CelClient{ + conn: conn, + CallOptions: defaultCelCallOptions(), + + celClient: exprpb.NewCelServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *CelClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *CelClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *CelClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Parse transforms CEL source text into a parsed representation. +func (c *CelClient) Parse(ctx context.Context, req *exprpb.ParseRequest, opts ...gax.CallOption) (*exprpb.ParseResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Parse[0:len(c.CallOptions.Parse):len(c.CallOptions.Parse)], opts...) + var resp *exprpb.ParseResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.celClient.Parse(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Check runs static checks on a parsed CEL representation and return +// an annotated representation, or a set of issues. +func (c *CelClient) Check(ctx context.Context, req *exprpb.CheckRequest, opts ...gax.CallOption) (*exprpb.CheckResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Check[0:len(c.CallOptions.Check):len(c.CallOptions.Check)], opts...) + var resp *exprpb.CheckResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.celClient.Check(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Eval evaluates a parsed or annotation CEL representation given +// values of external bindings. +func (c *CelClient) Eval(ctx context.Context, req *exprpb.EvalRequest, opts ...gax.CallOption) (*exprpb.EvalResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Eval[0:len(c.CallOptions.Eval):len(c.CallOptions.Eval)], opts...) + var resp *exprpb.EvalResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.celClient.Eval(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/expr/apiv1alpha1/cel_client_example_test.go b/vendor/cloud.google.com/go/expr/apiv1alpha1/cel_client_example_test.go new file mode 100644 index 000000000..598cac19c --- /dev/null +++ b/vendor/cloud.google.com/go/expr/apiv1alpha1/cel_client_example_test.go @@ -0,0 +1,88 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package expr_test + +import ( + "context" + + expr "cloud.google.com/go/expr/apiv1alpha1" + exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" +) + +func ExampleNewCelClient() { + ctx := context.Background() + c, err := expr.NewCelClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleCelClient_Parse() { + ctx := context.Background() + c, err := expr.NewCelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &exprpb.ParseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Parse(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCelClient_Check() { + ctx := context.Background() + c, err := expr.NewCelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &exprpb.CheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Check(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCelClient_Eval() { + ctx := context.Background() + c, err := expr.NewCelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &exprpb.EvalRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Eval(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/expr/apiv1alpha1/conformance_client.go b/vendor/cloud.google.com/go/expr/apiv1alpha1/conformance_client.go new file mode 100644 index 000000000..05acb8216 --- /dev/null +++ b/vendor/cloud.google.com/go/expr/apiv1alpha1/conformance_client.go @@ -0,0 +1,160 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package expr + +import ( + "context" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +// ConformanceCallOptions contains the retry settings for each method of ConformanceClient. +type ConformanceCallOptions struct { + Parse []gax.CallOption + Check []gax.CallOption + Eval []gax.CallOption +} + +func defaultConformanceClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cel.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultConformanceCallOptions() *ConformanceCallOptions { + retry := map[[2]string][]gax.CallOption{} + return &ConformanceCallOptions{ + Parse: retry[[2]string{"default", "non_idempotent"}], + Check: retry[[2]string{"default", "non_idempotent"}], + Eval: retry[[2]string{"default", "non_idempotent"}], + } +} + +// ConformanceClient is a client for interacting with Common Expression Language. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ConformanceClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + conformanceClient exprpb.ConformanceServiceClient + + // The call options for this service. + CallOptions *ConformanceCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewConformanceClient creates a new conformance service client. +// +// Access a CEL implementation from another process or machine. +// A CEL implementation is decomposed as a parser, a static checker, +// and an evaluator. Every CEL implementation is expected to provide +// a server for this API. The API will be used for conformance testing +// and other utilities. +func NewConformanceClient(ctx context.Context, opts ...option.ClientOption) (*ConformanceClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultConformanceClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ConformanceClient{ + conn: conn, + CallOptions: defaultConformanceCallOptions(), + + conformanceClient: exprpb.NewConformanceServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ConformanceClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ConformanceClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ConformanceClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Parse transforms CEL source text into a parsed representation. +func (c *ConformanceClient) Parse(ctx context.Context, req *exprpb.ParseRequest, opts ...gax.CallOption) (*exprpb.ParseResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Parse[0:len(c.CallOptions.Parse):len(c.CallOptions.Parse)], opts...) + var resp *exprpb.ParseResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conformanceClient.Parse(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Check runs static checks on a parsed CEL representation and return +// an annotated representation, or a set of issues. +func (c *ConformanceClient) Check(ctx context.Context, req *exprpb.CheckRequest, opts ...gax.CallOption) (*exprpb.CheckResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Check[0:len(c.CallOptions.Check):len(c.CallOptions.Check)], opts...) + var resp *exprpb.CheckResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conformanceClient.Check(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Eval evaluates a parsed or annotation CEL representation given +// values of external bindings. +func (c *ConformanceClient) Eval(ctx context.Context, req *exprpb.EvalRequest, opts ...gax.CallOption) (*exprpb.EvalResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Eval[0:len(c.CallOptions.Eval):len(c.CallOptions.Eval)], opts...) + var resp *exprpb.EvalResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.conformanceClient.Eval(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/expr/apiv1alpha1/conformance_client_example_test.go b/vendor/cloud.google.com/go/expr/apiv1alpha1/conformance_client_example_test.go new file mode 100644 index 000000000..2f33942b8 --- /dev/null +++ b/vendor/cloud.google.com/go/expr/apiv1alpha1/conformance_client_example_test.go @@ -0,0 +1,88 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package expr_test + +import ( + "context" + + expr "cloud.google.com/go/expr/apiv1alpha1" + exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" +) + +func ExampleNewConformanceClient() { + ctx := context.Background() + c, err := expr.NewConformanceClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleConformanceClient_Parse() { + ctx := context.Background() + c, err := expr.NewConformanceClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &exprpb.ParseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Parse(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConformanceClient_Check() { + ctx := context.Background() + c, err := expr.NewConformanceClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &exprpb.CheckRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Check(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConformanceClient_Eval() { + ctx := context.Background() + c, err := expr.NewConformanceClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &exprpb.EvalRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Eval(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/expr/apiv1alpha1/doc.go b/vendor/cloud.google.com/go/expr/apiv1alpha1/doc.go new file mode 100644 index 000000000..6d9588c86 --- /dev/null +++ b/vendor/cloud.google.com/go/expr/apiv1alpha1/doc.go @@ -0,0 +1,87 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package expr is an auto-generated package for the +// Common Expression Language. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Defines common types for the Common Expression Language. +package expr // import "cloud.google.com/go/expr/apiv1alpha1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{} +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/expr/apiv1alpha1/mock_test.go b/vendor/cloud.google.com/go/expr/apiv1alpha1/mock_test.go new file mode 100644 index 000000000..6b402ae18 --- /dev/null +++ b/vendor/cloud.google.com/go/expr/apiv1alpha1/mock_test.go @@ -0,0 +1,504 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package expr + +import ( + exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockConformanceServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + exprpb.ConformanceServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockConformanceServer) Parse(ctx context.Context, req *exprpb.ParseRequest) (*exprpb.ParseResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*exprpb.ParseResponse), nil +} + +func (s *mockConformanceServer) Check(ctx context.Context, req *exprpb.CheckRequest) (*exprpb.CheckResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*exprpb.CheckResponse), nil +} + +func (s *mockConformanceServer) Eval(ctx context.Context, req *exprpb.EvalRequest) (*exprpb.EvalResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*exprpb.EvalResponse), nil +} + +type mockCelServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + exprpb.CelServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockCelServer) Parse(ctx context.Context, req *exprpb.ParseRequest) (*exprpb.ParseResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*exprpb.ParseResponse), nil +} + +func (s *mockCelServer) Check(ctx context.Context, req *exprpb.CheckRequest) (*exprpb.CheckResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*exprpb.CheckResponse), nil +} + +func (s *mockCelServer) Eval(ctx context.Context, req *exprpb.EvalRequest) (*exprpb.EvalResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*exprpb.EvalResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockConformance mockConformanceServer + mockCel mockCelServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + exprpb.RegisterConformanceServiceServer(serv, &mockConformance) + exprpb.RegisterCelServiceServer(serv, &mockCel) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestConformanceServiceParse(t *testing.T) { + var expectedResponse *exprpb.ParseResponse = &exprpb.ParseResponse{} + + mockConformance.err = nil + mockConformance.reqs = nil + + mockConformance.resps = append(mockConformance.resps[:0], expectedResponse) + + var celSource string = "celSource912645552" + var request = &exprpb.ParseRequest{ + CelSource: celSource, + } + + c, err := NewConformanceClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Parse(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConformance.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConformanceServiceParseError(t *testing.T) { + errCode := codes.PermissionDenied + mockConformance.err = gstatus.Error(errCode, "test error") + + var celSource string = "celSource912645552" + var request = &exprpb.ParseRequest{ + CelSource: celSource, + } + + c, err := NewConformanceClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Parse(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConformanceServiceCheck(t *testing.T) { + var expectedResponse *exprpb.CheckResponse = &exprpb.CheckResponse{} + + mockConformance.err = nil + mockConformance.reqs = nil + + mockConformance.resps = append(mockConformance.resps[:0], expectedResponse) + + var parsedExpr *exprpb.ParsedExpr = &exprpb.ParsedExpr{} + var request = &exprpb.CheckRequest{ + ParsedExpr: parsedExpr, + } + + c, err := NewConformanceClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Check(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConformance.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConformanceServiceCheckError(t *testing.T) { + errCode := codes.PermissionDenied + mockConformance.err = gstatus.Error(errCode, "test error") + + var parsedExpr *exprpb.ParsedExpr = &exprpb.ParsedExpr{} + var request = &exprpb.CheckRequest{ + ParsedExpr: parsedExpr, + } + + c, err := NewConformanceClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Check(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConformanceServiceEval(t *testing.T) { + var expectedResponse *exprpb.EvalResponse = &exprpb.EvalResponse{} + + mockConformance.err = nil + mockConformance.reqs = nil + + mockConformance.resps = append(mockConformance.resps[:0], expectedResponse) + + var request *exprpb.EvalRequest = &exprpb.EvalRequest{} + + c, err := NewConformanceClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Eval(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConformance.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConformanceServiceEvalError(t *testing.T) { + errCode := codes.PermissionDenied + mockConformance.err = gstatus.Error(errCode, "test error") + + var request *exprpb.EvalRequest = &exprpb.EvalRequest{} + + c, err := NewConformanceClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Eval(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCelServiceParse(t *testing.T) { + var expectedResponse *exprpb.ParseResponse = &exprpb.ParseResponse{} + + mockCel.err = nil + mockCel.reqs = nil + + mockCel.resps = append(mockCel.resps[:0], expectedResponse) + + var celSource string = "celSource912645552" + var request = &exprpb.ParseRequest{ + CelSource: celSource, + } + + c, err := NewCelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Parse(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCelServiceParseError(t *testing.T) { + errCode := codes.PermissionDenied + mockCel.err = gstatus.Error(errCode, "test error") + + var celSource string = "celSource912645552" + var request = &exprpb.ParseRequest{ + CelSource: celSource, + } + + c, err := NewCelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Parse(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCelServiceCheck(t *testing.T) { + var expectedResponse *exprpb.CheckResponse = &exprpb.CheckResponse{} + + mockCel.err = nil + mockCel.reqs = nil + + mockCel.resps = append(mockCel.resps[:0], expectedResponse) + + var parsedExpr *exprpb.ParsedExpr = &exprpb.ParsedExpr{} + var request = &exprpb.CheckRequest{ + ParsedExpr: parsedExpr, + } + + c, err := NewCelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Check(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCelServiceCheckError(t *testing.T) { + errCode := codes.PermissionDenied + mockCel.err = gstatus.Error(errCode, "test error") + + var parsedExpr *exprpb.ParsedExpr = &exprpb.ParsedExpr{} + var request = &exprpb.CheckRequest{ + ParsedExpr: parsedExpr, + } + + c, err := NewCelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Check(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCelServiceEval(t *testing.T) { + var expectedResponse *exprpb.EvalResponse = &exprpb.EvalResponse{} + + mockCel.err = nil + mockCel.reqs = nil + + mockCel.resps = append(mockCel.resps[:0], expectedResponse) + + var request *exprpb.EvalRequest = &exprpb.EvalRequest{} + + c, err := NewCelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Eval(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCelServiceEvalError(t *testing.T) { + errCode := codes.PermissionDenied + mockCel.err = gstatus.Error(errCode, "test error") + + var request *exprpb.EvalRequest = &exprpb.EvalRequest{} + + c, err := NewCelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Eval(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/firestore/Makefile b/vendor/cloud.google.com/go/firestore/Makefile new file mode 100644 index 000000000..b1f9ff79a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/Makefile @@ -0,0 +1,13 @@ +# Copy textproto files in this directory from the source of truth. + +SRC=$(GOPATH)/src/github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore + +.PHONY: refresh-tests + +refresh-tests: + -rm genproto/*.pb.go + cp $(SRC)/genproto/*.pb.go genproto + -rm testdata/*.textproto + cp $(SRC)/testdata/*.textproto testdata + openssl dgst -sha1 $(SRC)/testdata/test-suite.binproto > testdata/VERSION + diff --git a/vendor/cloud.google.com/go/firestore/apiv1beta1/doc.go b/vendor/cloud.google.com/go/firestore/apiv1beta1/doc.go new file mode 100644 index 000000000..a3a68a24b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/apiv1beta1/doc.go @@ -0,0 +1,91 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package firestore is an auto-generated package for the +// Google Cloud Firestore API. +// +// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// +// +// Use the client at cloud.google.com/go/firestore in preference to this. +package firestore // import "cloud.google.com/go/firestore/apiv1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/firestore/apiv1beta1/firestore_client.go b/vendor/cloud.google.com/go/firestore/apiv1beta1/firestore_client.go new file mode 100644 index 000000000..24404e2cb --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/apiv1beta1/firestore_client.go @@ -0,0 +1,503 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package firestore + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + firestorepb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + GetDocument []gax.CallOption + ListDocuments []gax.CallOption + CreateDocument []gax.CallOption + UpdateDocument []gax.CallOption + DeleteDocument []gax.CallOption + BatchGetDocuments []gax.CallOption + BeginTransaction []gax.CallOption + Commit []gax.CallOption + Rollback []gax.CallOption + RunQuery []gax.CallOption + Write []gax.CallOption + Listen []gax.CallOption + ListCollectionIds []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("firestore.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"streaming", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + GetDocument: retry[[2]string{"default", "idempotent"}], + ListDocuments: retry[[2]string{"default", "idempotent"}], + CreateDocument: retry[[2]string{"default", "non_idempotent"}], + UpdateDocument: retry[[2]string{"default", "non_idempotent"}], + DeleteDocument: retry[[2]string{"default", "idempotent"}], + BatchGetDocuments: retry[[2]string{"streaming", "idempotent"}], + BeginTransaction: retry[[2]string{"default", "idempotent"}], + Commit: retry[[2]string{"default", "non_idempotent"}], + Rollback: retry[[2]string{"default", "idempotent"}], + RunQuery: retry[[2]string{"streaming", "idempotent"}], + Write: retry[[2]string{"streaming", "non_idempotent"}], + Listen: retry[[2]string{"streaming", "idempotent"}], + ListCollectionIds: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Google Cloud Firestore API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client firestorepb.FirestoreClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new firestore client. +// +// The Cloud Firestore service. +// +// This service exposes several types of comparable timestamps: +// +// create_time - The time at which a document was created. Changes only +// when a document is deleted, then re-created. Increases in a strict +// monotonic fashion. +// +// update_time - The time at which a document was last updated. Changes +// every time a document is modified. Does not change when a write results +// in no modifications. Increases in a strict monotonic fashion. +// +// read_time - The time at which a particular state was observed. Used +// to denote a consistent snapshot of the database or the time at which a +// Document was observed to not exist. +// +// commit_time - The time at which the writes in a transaction were +// committed. Any read with an equal or greater read_time is guaranteed +// to see the effects of the transaction. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: firestorepb.NewFirestoreClient(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// GetDocument gets a single document. +func (c *Client) GetDocument(ctx context.Context, req *firestorepb.GetDocumentRequest, opts ...gax.CallOption) (*firestorepb.Document, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetDocument[0:len(c.CallOptions.GetDocument):len(c.CallOptions.GetDocument)], opts...) + var resp *firestorepb.Document + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListDocuments lists documents. +func (c *Client) ListDocuments(ctx context.Context, req *firestorepb.ListDocumentsRequest, opts ...gax.CallOption) *DocumentIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListDocuments[0:len(c.CallOptions.ListDocuments):len(c.CallOptions.ListDocuments)], opts...) + it := &DocumentIterator{} + req = proto.Clone(req).(*firestorepb.ListDocumentsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*firestorepb.Document, string, error) { + var resp *firestorepb.ListDocumentsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListDocuments(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Documents, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// CreateDocument creates a new document. +func (c *Client) CreateDocument(ctx context.Context, req *firestorepb.CreateDocumentRequest, opts ...gax.CallOption) (*firestorepb.Document, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateDocument[0:len(c.CallOptions.CreateDocument):len(c.CallOptions.CreateDocument)], opts...) + var resp *firestorepb.Document + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateDocument updates or inserts a document. +func (c *Client) UpdateDocument(ctx context.Context, req *firestorepb.UpdateDocumentRequest, opts ...gax.CallOption) (*firestorepb.Document, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateDocument[0:len(c.CallOptions.UpdateDocument):len(c.CallOptions.UpdateDocument)], opts...) + var resp *firestorepb.Document + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteDocument deletes a document. +func (c *Client) DeleteDocument(ctx context.Context, req *firestorepb.DeleteDocumentRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteDocument[0:len(c.CallOptions.DeleteDocument):len(c.CallOptions.DeleteDocument)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteDocument(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// BatchGetDocuments gets multiple documents. +// +// Documents returned by this method are not guaranteed to be returned in the +// same order that they were requested. +func (c *Client) BatchGetDocuments(ctx context.Context, req *firestorepb.BatchGetDocumentsRequest, opts ...gax.CallOption) (firestorepb.Firestore_BatchGetDocumentsClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchGetDocuments[0:len(c.CallOptions.BatchGetDocuments):len(c.CallOptions.BatchGetDocuments)], opts...) + var resp firestorepb.Firestore_BatchGetDocumentsClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.BatchGetDocuments(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// BeginTransaction starts a new transaction. +func (c *Client) BeginTransaction(ctx context.Context, req *firestorepb.BeginTransactionRequest, opts ...gax.CallOption) (*firestorepb.BeginTransactionResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BeginTransaction[0:len(c.CallOptions.BeginTransaction):len(c.CallOptions.BeginTransaction)], opts...) + var resp *firestorepb.BeginTransactionResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.BeginTransaction(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Commit commits a transaction, while optionally updating documents. +func (c *Client) Commit(ctx context.Context, req *firestorepb.CommitRequest, opts ...gax.CallOption) (*firestorepb.CommitResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Commit[0:len(c.CallOptions.Commit):len(c.CallOptions.Commit)], opts...) + var resp *firestorepb.CommitResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.Commit(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Rollback rolls back a transaction. +func (c *Client) Rollback(ctx context.Context, req *firestorepb.RollbackRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Rollback[0:len(c.CallOptions.Rollback):len(c.CallOptions.Rollback)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.Rollback(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// RunQuery runs a query. +func (c *Client) RunQuery(ctx context.Context, req *firestorepb.RunQueryRequest, opts ...gax.CallOption) (firestorepb.Firestore_RunQueryClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.RunQuery[0:len(c.CallOptions.RunQuery):len(c.CallOptions.RunQuery)], opts...) + var resp firestorepb.Firestore_RunQueryClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.RunQuery(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Write streams batches of document updates and deletes, in order. +func (c *Client) Write(ctx context.Context, opts ...gax.CallOption) (firestorepb.Firestore_WriteClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Write[0:len(c.CallOptions.Write):len(c.CallOptions.Write)], opts...) + var resp firestorepb.Firestore_WriteClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.Write(ctx, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Listen listens to changes. +func (c *Client) Listen(ctx context.Context, opts ...gax.CallOption) (firestorepb.Firestore_ListenClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Listen[0:len(c.CallOptions.Listen):len(c.CallOptions.Listen)], opts...) + var resp firestorepb.Firestore_ListenClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.Listen(ctx, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListCollectionIds lists all the collection IDs underneath a document. +func (c *Client) ListCollectionIds(ctx context.Context, req *firestorepb.ListCollectionIdsRequest, opts ...gax.CallOption) *StringIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListCollectionIds[0:len(c.CallOptions.ListCollectionIds):len(c.CallOptions.ListCollectionIds)], opts...) + it := &StringIterator{} + req = proto.Clone(req).(*firestorepb.ListCollectionIdsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]string, string, error) { + var resp *firestorepb.ListCollectionIdsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListCollectionIds(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.CollectionIds, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DocumentIterator manages a stream of *firestorepb.Document. +type DocumentIterator struct { + items []*firestorepb.Document + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*firestorepb.Document, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *DocumentIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *DocumentIterator) Next() (*firestorepb.Document, error) { + var item *firestorepb.Document + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *DocumentIterator) bufLen() int { + return len(it.items) +} + +func (it *DocumentIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// StringIterator manages a stream of string. +type StringIterator struct { + items []string + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []string, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *StringIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *StringIterator) Next() (string, error) { + var item string + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *StringIterator) bufLen() int { + return len(it.items) +} + +func (it *StringIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/firestore/apiv1beta1/firestore_client_example_test.go b/vendor/cloud.google.com/go/firestore/apiv1beta1/firestore_client_example_test.go new file mode 100644 index 000000000..783686736 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/apiv1beta1/firestore_client_example_test.go @@ -0,0 +1,328 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package firestore_test + +import ( + "context" + "io" + + firestore "cloud.google.com/go/firestore/apiv1beta1" + "google.golang.org/api/iterator" + firestorepb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_GetDocument() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.GetDocumentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDocument(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListDocuments() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.ListDocumentsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListDocuments(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_CreateDocument() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.CreateDocumentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateDocument(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateDocument() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.UpdateDocumentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateDocument(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteDocument() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.DeleteDocumentRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteDocument(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_BatchGetDocuments() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.BatchGetDocumentsRequest{ + // TODO: Fill request struct fields. + } + stream, err := c.BatchGetDocuments(ctx, req) + if err != nil { + // TODO: Handle error. + } + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_BeginTransaction() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.BeginTransactionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BeginTransaction(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_Commit() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.CommitRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Commit(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_Rollback() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.RollbackRequest{ + // TODO: Fill request struct fields. + } + err = c.Rollback(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_RunQuery() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.RunQueryRequest{ + // TODO: Fill request struct fields. + } + stream, err := c.RunQuery(ctx, req) + if err != nil { + // TODO: Handle error. + } + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_Write() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + stream, err := c.Write(ctx) + if err != nil { + // TODO: Handle error. + } + go func() { + reqs := []*firestorepb.WriteRequest{ + // TODO: Create requests. + } + for _, req := range reqs { + if err := stream.Send(req); err != nil { + // TODO: Handle error. + } + } + stream.CloseSend() + }() + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_Listen() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + stream, err := c.Listen(ctx) + if err != nil { + // TODO: Handle error. + } + go func() { + reqs := []*firestorepb.ListenRequest{ + // TODO: Create requests. + } + for _, req := range reqs { + if err := stream.Send(req); err != nil { + // TODO: Handle error. + } + } + stream.CloseSend() + }() + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_ListCollectionIds() { + ctx := context.Background() + c, err := firestore.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &firestorepb.ListCollectionIdsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListCollectionIds(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/vendor/cloud.google.com/go/firestore/apiv1beta1/mock_test.go b/vendor/cloud.google.com/go/firestore/apiv1beta1/mock_test.go new file mode 100644 index 000000000..e0fd82972 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/apiv1beta1/mock_test.go @@ -0,0 +1,1153 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package firestore + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + firestorepb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockFirestoreServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + firestorepb.FirestoreServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockFirestoreServer) GetDocument(ctx context.Context, req *firestorepb.GetDocumentRequest) (*firestorepb.Document, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*firestorepb.Document), nil +} + +func (s *mockFirestoreServer) ListDocuments(ctx context.Context, req *firestorepb.ListDocumentsRequest) (*firestorepb.ListDocumentsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*firestorepb.ListDocumentsResponse), nil +} + +func (s *mockFirestoreServer) CreateDocument(ctx context.Context, req *firestorepb.CreateDocumentRequest) (*firestorepb.Document, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*firestorepb.Document), nil +} + +func (s *mockFirestoreServer) UpdateDocument(ctx context.Context, req *firestorepb.UpdateDocumentRequest) (*firestorepb.Document, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*firestorepb.Document), nil +} + +func (s *mockFirestoreServer) DeleteDocument(ctx context.Context, req *firestorepb.DeleteDocumentRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockFirestoreServer) BatchGetDocuments(req *firestorepb.BatchGetDocumentsRequest, stream firestorepb.Firestore_BatchGetDocumentsServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*firestorepb.BatchGetDocumentsResponse)); err != nil { + return err + } + } + return nil +} + +func (s *mockFirestoreServer) BeginTransaction(ctx context.Context, req *firestorepb.BeginTransactionRequest) (*firestorepb.BeginTransactionResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*firestorepb.BeginTransactionResponse), nil +} + +func (s *mockFirestoreServer) Commit(ctx context.Context, req *firestorepb.CommitRequest) (*firestorepb.CommitResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*firestorepb.CommitResponse), nil +} + +func (s *mockFirestoreServer) Rollback(ctx context.Context, req *firestorepb.RollbackRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockFirestoreServer) RunQuery(req *firestorepb.RunQueryRequest, stream firestorepb.Firestore_RunQueryServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*firestorepb.RunQueryResponse)); err != nil { + return err + } + } + return nil +} + +func (s *mockFirestoreServer) Write(stream firestorepb.Firestore_WriteServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + for { + if req, err := stream.Recv(); err == io.EOF { + break + } else if err != nil { + return err + } else { + s.reqs = append(s.reqs, req) + } + } + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*firestorepb.WriteResponse)); err != nil { + return err + } + } + return nil +} + +func (s *mockFirestoreServer) Listen(stream firestorepb.Firestore_ListenServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + for { + if req, err := stream.Recv(); err == io.EOF { + break + } else if err != nil { + return err + } else { + s.reqs = append(s.reqs, req) + } + } + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*firestorepb.ListenResponse)); err != nil { + return err + } + } + return nil +} + +func (s *mockFirestoreServer) ListCollectionIds(ctx context.Context, req *firestorepb.ListCollectionIdsRequest) (*firestorepb.ListCollectionIdsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*firestorepb.ListCollectionIdsResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockFirestore mockFirestoreServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + firestorepb.RegisterFirestoreServer(serv, &mockFirestore) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestFirestoreGetDocument(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &firestorepb.Document{ + Name: name2, + } + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var request = &firestorepb.GetDocumentRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDocument(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreGetDocumentError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var request = &firestorepb.GetDocumentRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDocument(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreListDocuments(t *testing.T) { + var nextPageToken string = "" + var documentsElement *firestorepb.Document = &firestorepb.Document{} + var documents = []*firestorepb.Document{documentsElement} + var expectedResponse = &firestorepb.ListDocumentsResponse{ + NextPageToken: nextPageToken, + Documents: documents, + } + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var collectionId string = "collectionId-821242276" + var request = &firestorepb.ListDocumentsRequest{ + Parent: formattedParent, + CollectionId: collectionId, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDocuments(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Documents[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreListDocumentsError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var collectionId string = "collectionId-821242276" + var request = &firestorepb.ListDocumentsRequest{ + Parent: formattedParent, + CollectionId: collectionId, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDocuments(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreCreateDocument(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &firestorepb.Document{ + Name: name, + } + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var collectionId string = "collectionId-821242276" + var documentId string = "documentId506676927" + var document *firestorepb.Document = &firestorepb.Document{} + var request = &firestorepb.CreateDocumentRequest{ + Parent: formattedParent, + CollectionId: collectionId, + DocumentId: documentId, + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateDocument(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreCreateDocumentError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var collectionId string = "collectionId-821242276" + var documentId string = "documentId506676927" + var document *firestorepb.Document = &firestorepb.Document{} + var request = &firestorepb.CreateDocumentRequest{ + Parent: formattedParent, + CollectionId: collectionId, + DocumentId: documentId, + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateDocument(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreUpdateDocument(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &firestorepb.Document{ + Name: name, + } + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var document *firestorepb.Document = &firestorepb.Document{} + var updateMask *firestorepb.DocumentMask = &firestorepb.DocumentMask{} + var request = &firestorepb.UpdateDocumentRequest{ + Document: document, + UpdateMask: updateMask, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateDocument(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreUpdateDocumentError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var document *firestorepb.Document = &firestorepb.Document{} + var updateMask *firestorepb.DocumentMask = &firestorepb.DocumentMask{} + var request = &firestorepb.UpdateDocumentRequest{ + Document: document, + UpdateMask: updateMask, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateDocument(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreDeleteDocument(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var request = &firestorepb.DeleteDocumentRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteDocument(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestFirestoreDeleteDocumentError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var request = &firestorepb.DeleteDocumentRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteDocument(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestFirestoreBatchGetDocuments(t *testing.T) { + var missing string = "missing1069449574" + var transaction []byte = []byte("-34") + var expectedResponse = &firestorepb.BatchGetDocumentsResponse{ + Result: &firestorepb.BatchGetDocumentsResponse_Missing{ + Missing: missing, + }, + Transaction: transaction, + } + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var documents []string = nil + var request = &firestorepb.BatchGetDocumentsRequest{ + Database: formattedDatabase, + Documents: documents, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.BatchGetDocuments(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreBatchGetDocumentsError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var documents []string = nil + var request = &firestorepb.BatchGetDocumentsRequest{ + Database: formattedDatabase, + Documents: documents, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.BatchGetDocuments(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreBeginTransaction(t *testing.T) { + var transaction []byte = []byte("-34") + var expectedResponse = &firestorepb.BeginTransactionResponse{ + Transaction: transaction, + } + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var request = &firestorepb.BeginTransactionRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BeginTransaction(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreBeginTransactionError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var request = &firestorepb.BeginTransactionRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BeginTransaction(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreCommit(t *testing.T) { + var expectedResponse *firestorepb.CommitResponse = &firestorepb.CommitResponse{} + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var writes []*firestorepb.Write = nil + var request = &firestorepb.CommitRequest{ + Database: formattedDatabase, + Writes: writes, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Commit(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreCommitError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var writes []*firestorepb.Write = nil + var request = &firestorepb.CommitRequest{ + Database: formattedDatabase, + Writes: writes, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Commit(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreRollback(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var transaction []byte = []byte("-34") + var request = &firestorepb.RollbackRequest{ + Database: formattedDatabase, + Transaction: transaction, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.Rollback(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestFirestoreRollbackError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var transaction []byte = []byte("-34") + var request = &firestorepb.RollbackRequest{ + Database: formattedDatabase, + Transaction: transaction, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.Rollback(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestFirestoreRunQuery(t *testing.T) { + var transaction []byte = []byte("-34") + var skippedResults int32 = 880286183 + var expectedResponse = &firestorepb.RunQueryResponse{ + Transaction: transaction, + SkippedResults: skippedResults, + } + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var request = &firestorepb.RunQueryRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.RunQuery(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreRunQueryError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var request = &firestorepb.RunQueryRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.RunQuery(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreWrite(t *testing.T) { + var streamId string = "streamId-315624902" + var streamToken []byte = []byte("122") + var expectedResponse = &firestorepb.WriteResponse{ + StreamId: streamId, + StreamToken: streamToken, + } + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var request = &firestorepb.WriteRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.Write(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreWriteError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var request = &firestorepb.WriteRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.Write(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreListen(t *testing.T) { + var expectedResponse *firestorepb.ListenResponse = &firestorepb.ListenResponse{} + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var request = &firestorepb.ListenRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.Listen(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreListenError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") + var request = &firestorepb.ListenRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.Listen(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestFirestoreListCollectionIds(t *testing.T) { + var nextPageToken string = "" + var collectionIdsElement string = "collectionIdsElement1368994900" + var collectionIds = []string{collectionIdsElement} + var expectedResponse = &firestorepb.ListCollectionIdsResponse{ + NextPageToken: nextPageToken, + CollectionIds: collectionIds, + } + + mockFirestore.err = nil + mockFirestore.reqs = nil + + mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var request = &firestorepb.ListCollectionIdsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListCollectionIds(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.CollectionIds[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestFirestoreListCollectionIdsError(t *testing.T) { + errCode := codes.PermissionDenied + mockFirestore.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") + var request = &firestorepb.ListCollectionIdsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListCollectionIds(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/firestore/apiv1beta1/path_funcs.go b/vendor/cloud.google.com/go/firestore/apiv1beta1/path_funcs.go new file mode 100644 index 000000000..7f4b0ad65 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/apiv1beta1/path_funcs.go @@ -0,0 +1,78 @@ +// 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 +// +// https://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 firestore + +// DatabaseRootPath returns the path for the database root resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/databases/%s", project, database) +// instead. +func DatabaseRootPath(project, database string) string { + return "" + + "projects/" + + project + + "/databases/" + + database + + "" +} + +// DocumentRootPath returns the path for the document root resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/databases/%s/documents", project, database) +// instead. +func DocumentRootPath(project, database string) string { + return "" + + "projects/" + + project + + "/databases/" + + database + + "/documents" + + "" +} + +// DocumentPathPath returns the path for the document path resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/databases/%s/documents/%s", project, database, documentPath) +// instead. +func DocumentPathPath(project, database, documentPath string) string { + return "" + + "projects/" + + project + + "/databases/" + + database + + "/documents/" + + documentPath + + "" +} + +// AnyPathPath returns the path for the any path resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", project, database, document, anyPath) +// instead. +func AnyPathPath(project, database, document, anyPath string) string { + return "" + + "projects/" + + project + + "/databases/" + + database + + "/documents/" + + document + + "/" + + anyPath + + "" +} diff --git a/vendor/cloud.google.com/go/firestore/client.go b/vendor/cloud.google.com/go/firestore/client.go new file mode 100644 index 000000000..a5f014f71 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/client.go @@ -0,0 +1,280 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "errors" + "fmt" + "io" + "strings" + "time" + + vkit "cloud.google.com/go/firestore/apiv1beta1" + "cloud.google.com/go/internal/version" + "github.com/golang/protobuf/ptypes" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// resourcePrefixHeader is the name of the metadata header used to indicate +// the resource being operated on. +const resourcePrefixHeader = "google-cloud-resource-prefix" + +// A Client provides access to the Firestore service. +type Client struct { + c *vkit.Client + projectID string + databaseID string // A client is tied to a single database. +} + +// NewClient creates a new Firestore client that uses the given project. +func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) { + vc, err := vkit.NewClient(ctx, opts...) + if err != nil { + return nil, err + } + vc.SetGoogleClientInfo("gccl", version.Repo) + c := &Client{ + c: vc, + projectID: projectID, + databaseID: "(default)", // always "(default)", for now + } + return c, nil + +} + +// Close closes any resources held by the client. +// +// Close need not be called at program exit. +func (c *Client) Close() error { + return c.c.Close() +} + +func (c *Client) path() string { + return fmt.Sprintf("projects/%s/databases/%s", c.projectID, c.databaseID) +} + +func withResourceHeader(ctx context.Context, resource string) context.Context { + md, _ := metadata.FromOutgoingContext(ctx) + md = md.Copy() + md[resourcePrefixHeader] = []string{resource} + return metadata.NewOutgoingContext(ctx, md) +} + +// Collection creates a reference to a collection with the given path. +// A path is a sequence of IDs separated by slashes. +// +// Collection returns nil if path contains an even number of IDs or any ID is empty. +func (c *Client) Collection(path string) *CollectionRef { + coll, _ := c.idsToRef(strings.Split(path, "/"), c.path()) + return coll +} + +// Doc creates a reference to a document with the given path. +// A path is a sequence of IDs separated by slashes. +// +// Doc returns nil if path contains an odd number of IDs or any ID is empty. +func (c *Client) Doc(path string) *DocumentRef { + _, doc := c.idsToRef(strings.Split(path, "/"), c.path()) + return doc +} + +func (c *Client) idsToRef(IDs []string, dbPath string) (*CollectionRef, *DocumentRef) { + if len(IDs) == 0 { + return nil, nil + } + for _, id := range IDs { + if id == "" { + return nil, nil + } + } + coll := newTopLevelCollRef(c, dbPath, IDs[0]) + i := 1 + for i < len(IDs) { + doc := newDocRef(coll, IDs[i]) + i++ + if i == len(IDs) { + return nil, doc + } + coll = newCollRefWithParent(c, doc, IDs[i]) + i++ + } + return coll, nil +} + +// GetAll retrieves multiple documents with a single call. The DocumentSnapshots are +// returned in the order of the given DocumentRefs. +// +// If a document is not present, the corresponding DocumentSnapshot's Exists method will return false. +func (c *Client) GetAll(ctx context.Context, docRefs []*DocumentRef) ([]*DocumentSnapshot, error) { + if err := checkTransaction(ctx); err != nil { + return nil, err + } + return c.getAll(ctx, docRefs, nil) +} + +func (c *Client) getAll(ctx context.Context, docRefs []*DocumentRef, tid []byte) ([]*DocumentSnapshot, error) { + var docNames []string + docIndex := map[string]int{} // doc name to position in docRefs + for i, dr := range docRefs { + if dr == nil { + return nil, errNilDocRef + } + docNames = append(docNames, dr.Path) + docIndex[dr.Path] = i + } + req := &pb.BatchGetDocumentsRequest{ + Database: c.path(), + Documents: docNames, + } + if tid != nil { + req.ConsistencySelector = &pb.BatchGetDocumentsRequest_Transaction{tid} + } + streamClient, err := c.c.BatchGetDocuments(withResourceHeader(ctx, req.Database), req) + if err != nil { + return nil, err + } + + // Read and remember all results from the stream. + var resps []*pb.BatchGetDocumentsResponse + for { + resp, err := streamClient.Recv() + if err == io.EOF { + break + } + if err != nil { + return nil, err + } + resps = append(resps, resp) + } + + // Results may arrive out of order. Put each at the right index. + docs := make([]*DocumentSnapshot, len(docNames)) + for _, resp := range resps { + var ( + i int + doc *pb.Document + err error + ) + switch r := resp.Result.(type) { + case *pb.BatchGetDocumentsResponse_Found: + i = docIndex[r.Found.Name] + doc = r.Found + case *pb.BatchGetDocumentsResponse_Missing: + i = docIndex[r.Missing] + doc = nil + default: + return nil, errors.New("firestore: unknown BatchGetDocumentsResponse result type") + } + if docs[i] != nil { + return nil, fmt.Errorf("firestore: %q seen twice", docRefs[i].Path) + } + docs[i], err = newDocumentSnapshot(docRefs[i], doc, c, resp.ReadTime) + if err != nil { + return nil, err + } + } + return docs, nil +} + +// Collections returns an interator over the top-level collections. +func (c *Client) Collections(ctx context.Context) *CollectionIterator { + it := &CollectionIterator{ + err: checkTransaction(ctx), + client: c, + it: c.c.ListCollectionIds( + withResourceHeader(ctx, c.path()), + &pb.ListCollectionIdsRequest{Parent: c.path()}), + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +// Batch returns a WriteBatch. +func (c *Client) Batch() *WriteBatch { + return &WriteBatch{c: c} +} + +// commit calls the Commit RPC outside of a transaction. +func (c *Client) commit(ctx context.Context, ws []*pb.Write) ([]*WriteResult, error) { + if err := checkTransaction(ctx); err != nil { + return nil, err + } + req := &pb.CommitRequest{ + Database: c.path(), + Writes: ws, + } + res, err := c.c.Commit(withResourceHeader(ctx, req.Database), req) + if err != nil { + return nil, err + } + if len(res.WriteResults) == 0 { + return nil, errors.New("firestore: missing WriteResult") + } + var wrs []*WriteResult + for _, pwr := range res.WriteResults { + wr, err := writeResultFromProto(pwr) + if err != nil { + return nil, err + } + wrs = append(wrs, wr) + } + return wrs, nil +} + +func (c *Client) commit1(ctx context.Context, ws []*pb.Write) (*WriteResult, error) { + wrs, err := c.commit(ctx, ws) + if err != nil { + return nil, err + } + return wrs[0], nil +} + +// A WriteResult is returned by methods that write documents. +type WriteResult struct { + // The time at which the document was updated, or created if it did not + // previously exist. Writes that do not actually change the document do + // not change the update time. + UpdateTime time.Time +} + +func writeResultFromProto(wr *pb.WriteResult) (*WriteResult, error) { + t, err := ptypes.Timestamp(wr.UpdateTime) + if err != nil { + t = time.Time{} + // TODO(jba): Follow up if Delete is supposed to return a nil timestamp. + } + return &WriteResult{UpdateTime: t}, nil +} + +func sleep(ctx context.Context, dur time.Duration) error { + switch err := gax.Sleep(ctx, dur); err { + case context.Canceled: + return status.Error(codes.Canceled, "context canceled") + case context.DeadlineExceeded: + return status.Error(codes.DeadlineExceeded, "context deadline exceeded") + default: + return err + } +} diff --git a/vendor/cloud.google.com/go/firestore/client_test.go b/vendor/cloud.google.com/go/firestore/client_test.go new file mode 100644 index 000000000..92ff877ec --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/client_test.go @@ -0,0 +1,212 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "testing" + + tspb "github.com/golang/protobuf/ptypes/timestamp" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var testClient = &Client{ + projectID: "projectID", + databaseID: "(default)", +} + +func TestClientCollectionAndDoc(t *testing.T) { + coll1 := testClient.Collection("X") + db := "projects/projectID/databases/(default)" + wantc1 := &CollectionRef{ + c: testClient, + parentPath: db, + Parent: nil, + ID: "X", + Path: "projects/projectID/databases/(default)/documents/X", + Query: Query{c: testClient, collectionID: "X", parentPath: db}, + } + if !testEqual(coll1, wantc1) { + t.Fatalf("got\n%+v\nwant\n%+v", coll1, wantc1) + } + doc1 := testClient.Doc("X/a") + wantd1 := &DocumentRef{ + Parent: coll1, + ID: "a", + Path: "projects/projectID/databases/(default)/documents/X/a", + } + + if !testEqual(doc1, wantd1) { + t.Fatalf("got %+v, want %+v", doc1, wantd1) + } + coll2 := testClient.Collection("X/a/Y") + parentPath := "projects/projectID/databases/(default)/documents/X/a" + wantc2 := &CollectionRef{ + c: testClient, + parentPath: parentPath, + Parent: doc1, + ID: "Y", + Path: "projects/projectID/databases/(default)/documents/X/a/Y", + Query: Query{c: testClient, collectionID: "Y", parentPath: parentPath}, + } + if !testEqual(coll2, wantc2) { + t.Fatalf("\ngot %+v\nwant %+v", coll2, wantc2) + } + doc2 := testClient.Doc("X/a/Y/b") + wantd2 := &DocumentRef{ + Parent: coll2, + ID: "b", + Path: "projects/projectID/databases/(default)/documents/X/a/Y/b", + } + if !testEqual(doc2, wantd2) { + t.Fatalf("got %+v, want %+v", doc2, wantd2) + } +} + +func TestClientCollDocErrors(t *testing.T) { + for _, badColl := range []string{"", "/", "/a/", "/a/b", "a/b/", "a//b"} { + coll := testClient.Collection(badColl) + if coll != nil { + t.Errorf("coll path %q: got %+v, want nil", badColl, coll) + } + } + for _, badDoc := range []string{"", "a", "/", "/a", "a/", "a/b/c", "a//b/c"} { + doc := testClient.Doc(badDoc) + if doc != nil { + t.Errorf("doc path %q: got %+v, want nil", badDoc, doc) + } + } +} + +func TestGetAll(t *testing.T) { + c, srv := newMock(t) + defer c.Close() + const dbPath = "projects/projectID/databases/(default)" + req := &pb.BatchGetDocumentsRequest{ + Database: dbPath, + Documents: []string{ + dbPath + "/documents/C/a", + dbPath + "/documents/C/b", + dbPath + "/documents/C/c", + }, + } + testGetAll(t, c, srv, dbPath, func(drs []*DocumentRef) ([]*DocumentSnapshot, error) { + return c.GetAll(context.Background(), drs) + }, req) +} + +func testGetAll(t *testing.T, c *Client, srv *mockServer, dbPath string, getAll func([]*DocumentRef) ([]*DocumentSnapshot, error), req *pb.BatchGetDocumentsRequest) { + wantPBDocs := []*pb.Document{ + { + Name: dbPath + "/documents/C/a", + CreateTime: aTimestamp, + UpdateTime: aTimestamp, + Fields: map[string]*pb.Value{"f": intval(2)}, + }, + nil, + { + Name: dbPath + "/documents/C/c", + CreateTime: aTimestamp, + UpdateTime: aTimestamp, + Fields: map[string]*pb.Value{"f": intval(1)}, + }, + } + wantReadTimes := []*tspb.Timestamp{aTimestamp, aTimestamp2, aTimestamp3} + srv.addRPC(req, + []interface{}{ + // deliberately put these out of order + &pb.BatchGetDocumentsResponse{ + Result: &pb.BatchGetDocumentsResponse_Found{wantPBDocs[2]}, + ReadTime: aTimestamp3, + }, + &pb.BatchGetDocumentsResponse{ + Result: &pb.BatchGetDocumentsResponse_Found{wantPBDocs[0]}, + ReadTime: aTimestamp, + }, + &pb.BatchGetDocumentsResponse{ + Result: &pb.BatchGetDocumentsResponse_Missing{dbPath + "/documents/C/b"}, + ReadTime: aTimestamp2, + }, + }, + ) + coll := c.Collection("C") + var docRefs []*DocumentRef + for _, name := range []string{"a", "b", "c"} { + docRefs = append(docRefs, coll.Doc(name)) + } + docs, err := getAll(docRefs) + if err != nil { + t.Fatal(err) + } + if got, want := len(docs), len(wantPBDocs); got != want { + t.Errorf("got %d docs, wanted %d", got, want) + } + for i, got := range docs { + want, err := newDocumentSnapshot(docRefs[i], wantPBDocs[i], c, wantReadTimes[i]) + if err != nil { + t.Fatal(err) + } + if diff := testDiff(got, want); diff != "" { + t.Errorf("#%d: got=--, want==++\n%s", i, diff) + } + } +} + +func TestGetAllErrors(t *testing.T) { + ctx := context.Background() + const ( + dbPath = "projects/projectID/databases/(default)" + docPath = dbPath + "/documents/C/a" + ) + c, srv := newMock(t) + if _, err := c.GetAll(ctx, []*DocumentRef{nil}); err != errNilDocRef { + t.Errorf("got %v, want errNilDocRef", err) + } + + // Internal server error. + srv.addRPC( + &pb.BatchGetDocumentsRequest{ + Database: dbPath, + Documents: []string{docPath}, + }, + []interface{}{status.Errorf(codes.Internal, "")}, + ) + _, err := c.GetAll(ctx, []*DocumentRef{c.Doc("C/a")}) + codeEq(t, "GetAll #1", codes.Internal, err) + + // Doc appears as both found and missing (server bug). + srv.reset() + srv.addRPC( + &pb.BatchGetDocumentsRequest{ + Database: dbPath, + Documents: []string{docPath}, + }, + []interface{}{ + &pb.BatchGetDocumentsResponse{ + Result: &pb.BatchGetDocumentsResponse_Found{&pb.Document{Name: docPath}}, + ReadTime: aTimestamp, + }, + &pb.BatchGetDocumentsResponse{ + Result: &pb.BatchGetDocumentsResponse_Missing{docPath}, + ReadTime: aTimestamp, + }, + }, + ) + if _, err := c.GetAll(ctx, []*DocumentRef{c.Doc("C/a")}); err == nil { + t.Error("got nil, want error") + } +} diff --git a/vendor/cloud.google.com/go/firestore/collref.go b/vendor/cloud.google.com/go/firestore/collref.go new file mode 100644 index 000000000..ff445d118 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/collref.go @@ -0,0 +1,123 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "math/rand" + "os" + "sync" + "time" +) + +// A CollectionRef is a reference to Firestore collection. +type CollectionRef struct { + c *Client + + // Typically Parent.Path, or c.path if Parent is nil. + // May be different if this CollectionRef was created from a stored reference + // to a different project/DB. + parentPath string + + // Parent is the document of which this collection is a part. It is + // nil for top-level collections. + Parent *DocumentRef + + // The full resource path of the collection: "projects/P/databases/D/documents..." + Path string + + // ID is the collection identifier. + ID string + + // Use the methods of Query on a CollectionRef to create and run queries. + Query +} + +func newTopLevelCollRef(c *Client, dbPath, id string) *CollectionRef { + return &CollectionRef{ + c: c, + ID: id, + parentPath: dbPath, + Path: dbPath + "/documents/" + id, + Query: Query{c: c, collectionID: id, parentPath: dbPath}, + } +} + +func newCollRefWithParent(c *Client, parent *DocumentRef, id string) *CollectionRef { + return &CollectionRef{ + c: c, + Parent: parent, + ID: id, + parentPath: parent.Path, + Path: parent.Path + "/" + id, + Query: Query{c: c, collectionID: id, parentPath: parent.Path}, + } +} + +// Doc returns a DocumentRef that refers to the document in the collection with the +// given identifier. +func (c *CollectionRef) Doc(id string) *DocumentRef { + if c == nil { + return nil + } + return newDocRef(c, id) +} + +// NewDoc returns a DocumentRef with a uniquely generated ID. +func (c *CollectionRef) NewDoc() *DocumentRef { + return c.Doc(uniqueID()) +} + +// Add generates a DocumentRef with a unique ID. It then creates the document +// with the given data, which can be a map[string]interface{}, a struct or a +// pointer to a struct. +// +// Add returns an error in the unlikely event that a document with the same ID +// already exists. +func (c *CollectionRef) Add(ctx context.Context, data interface{}) (*DocumentRef, *WriteResult, error) { + d := c.NewDoc() + wr, err := d.Create(ctx, data) + if err != nil { + return nil, nil, err + } + return d, wr, nil +} + +// DocumentRefs returns references to all the documents in the collection, including +// missing documents. A missing document is a document that does not exist but has +// sub-documents. +func (c *CollectionRef) DocumentRefs(ctx context.Context) *DocumentRefIterator { + if err := checkTransaction(ctx); err != nil { + return &DocumentRefIterator{err: err} + } + return newDocumentRefIterator(ctx, c, nil) +} + +const alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + +var ( + rngMu sync.Mutex + rng = rand.New(rand.NewSource(time.Now().UnixNano() ^ int64(os.Getpid()))) +) + +func uniqueID() string { + var b [20]byte + rngMu.Lock() + for i := 0; i < len(b); i++ { + b[i] = alphanum[rng.Intn(len(alphanum))] + } + rngMu.Unlock() + return string(b[:]) +} diff --git a/vendor/cloud.google.com/go/firestore/collref_test.go b/vendor/cloud.google.com/go/firestore/collref_test.go new file mode 100644 index 000000000..e77c0db66 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/collref_test.go @@ -0,0 +1,95 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "testing" + + "github.com/golang/protobuf/proto" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +func TestDoc(t *testing.T) { + coll := testClient.Collection("C") + got := coll.Doc("d") + want := &DocumentRef{ + Parent: coll, + ID: "d", + Path: "projects/projectID/databases/(default)/documents/C/d", + } + if !testEqual(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } +} + +func TestNewDoc(t *testing.T) { + c := &Client{} + coll := c.Collection("C") + got := coll.NewDoc() + if got.Parent != coll { + t.Errorf("got %v, want %v", got.Parent, coll) + } + if len(got.ID) != 20 { + t.Errorf("got %d-char ID, wanted 20", len(got.ID)) + } + + got2 := coll.NewDoc() + if got.ID == got2.ID { + t.Error("got same ID") + } +} + +func TestAdd(t *testing.T) { + ctx := context.Background() + c, srv := newMock(t) + wantReq := commitRequestForSet() + w := wantReq.Writes[0] + w.CurrentDocument = &pb.Precondition{ + ConditionType: &pb.Precondition_Exists{false}, + } + srv.addRPCAdjust(wantReq, commitResponseForSet, func(gotReq proto.Message) { + // We can't know the doc ID before Add is called, so we take it from + // the request. + w.Operation.(*pb.Write_Update).Update.Name = gotReq.(*pb.CommitRequest).Writes[0].Operation.(*pb.Write_Update).Update.Name + }) + _, wr, err := c.Collection("C").Add(ctx, testData) + if err != nil { + t.Fatal(err) + } + if !testEqual(wr, writeResultForSet) { + t.Errorf("got %v, want %v", wr, writeResultForSet) + } +} + +func TestNilErrors(t *testing.T) { + ctx := context.Background() + c, _ := newMock(t) + // Test that a nil CollectionRef results in a nil DocumentRef and errors + // where possible. + coll := c.Collection("a/b") // nil because "a/b" denotes a doc. + if coll != nil { + t.Fatal("collection not nil") + } + if got := coll.Doc("d"); got != nil { + t.Fatalf("got %v, want nil", got) + } + if got := coll.NewDoc(); got != nil { + t.Fatalf("got %v, want nil", got) + } + if _, _, err := coll.Add(ctx, testData); err != errNilDocRef { + t.Fatalf("got <%v>, want <%v>", err, errNilDocRef) + } +} diff --git a/vendor/cloud.google.com/go/firestore/conformance_test.go b/vendor/cloud.google.com/go/firestore/conformance_test.go new file mode 100644 index 000000000..1fcbaaa7a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/conformance_test.go @@ -0,0 +1,442 @@ +// Copyright 2017 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. + +// A runner for the conformance tests. + +package firestore + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "math" + "path" + "path/filepath" + "strings" + "testing" + "time" + + pb "cloud.google.com/go/firestore/genproto" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + ts "github.com/golang/protobuf/ptypes/timestamp" + "github.com/google/go-cmp/cmp" + "google.golang.org/api/iterator" + fspb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +const conformanceTestWatchTargetID = 1 + +func TestConformanceTests(t *testing.T) { + const dir = "testdata" + fis, err := ioutil.ReadDir(dir) + if err != nil { + t.Fatal(err) + } + wtid := watchTargetID + watchTargetID = conformanceTestWatchTargetID + defer func() { watchTargetID = wtid }() + n := 0 + for _, fi := range fis { + if strings.HasSuffix(fi.Name(), ".textproto") { + runTestFromFile(t, filepath.Join(dir, fi.Name())) + n++ + } + } + t.Logf("ran %d conformance tests", n) +} + +func runTestFromFile(t *testing.T, filename string) { + bytes, err := ioutil.ReadFile(filename) + if err != nil { + t.Fatalf("%s: %v", filename, err) + } + var test pb.Test + if err := proto.UnmarshalText(string(bytes), &test); err != nil { + t.Fatalf("unmarshalling %s: %v", filename, err) + } + msg := fmt.Sprintf("%s (file %s)", test.Description, filepath.Base(filename)) + runTest(t, msg, &test) +} + +func runTest(t *testing.T, msg string, test *pb.Test) { + check := func(gotErr error, wantErr bool) bool { + if wantErr && gotErr == nil { + t.Errorf("%s: got nil, want error", msg) + return false + } else if !wantErr && gotErr != nil { + t.Errorf("%s: %v", msg, gotErr) + return false + } + return true + } + + ctx := context.Background() + c, srv := newMock(t) + switch tt := test.Test.(type) { + case *pb.Test_Get: + req := &fspb.BatchGetDocumentsRequest{ + Database: c.path(), + Documents: []string{tt.Get.DocRefPath}, + } + srv.addRPC(req, []interface{}{ + &fspb.BatchGetDocumentsResponse{ + Result: &fspb.BatchGetDocumentsResponse_Found{&fspb.Document{ + Name: tt.Get.DocRefPath, + CreateTime: &ts.Timestamp{}, + UpdateTime: &ts.Timestamp{}, + }}, + ReadTime: &ts.Timestamp{}, + }, + }) + ref := docRefFromPath(tt.Get.DocRefPath, c) + _, err := ref.Get(ctx) + if err != nil { + t.Errorf("%s: %v", msg, err) + return + } + // Checking response would just be testing the function converting a Document + // proto to a DocumentSnapshot, hence uninteresting. + + case *pb.Test_Create: + srv.addRPC(tt.Create.Request, commitResponseForSet) + ref := docRefFromPath(tt.Create.DocRefPath, c) + data, err := convertData(tt.Create.JsonData) + if err != nil { + t.Errorf("%s: %v", msg, err) + return + } + _, err = ref.Create(ctx, data) + check(err, tt.Create.IsError) + + case *pb.Test_Set: + srv.addRPC(tt.Set.Request, commitResponseForSet) + ref := docRefFromPath(tt.Set.DocRefPath, c) + data, err := convertData(tt.Set.JsonData) + if err != nil { + t.Errorf("%s: %v", msg, err) + return + } + var opts []SetOption + if tt.Set.Option != nil { + opts = []SetOption{convertSetOption(tt.Set.Option)} + } + _, err = ref.Set(ctx, data, opts...) + check(err, tt.Set.IsError) + + case *pb.Test_Update: + // Ignore Update test because we only support UpdatePaths. + // Not to worry, every Update test has a corresponding UpdatePaths test. + + case *pb.Test_UpdatePaths: + srv.addRPC(tt.UpdatePaths.Request, commitResponseForSet) + ref := docRefFromPath(tt.UpdatePaths.DocRefPath, c) + preconds := convertPrecondition(t, tt.UpdatePaths.Precondition) + paths := convertFieldPaths(tt.UpdatePaths.FieldPaths) + var ups []Update + for i, path := range paths { + val, err := convertJSONValue(tt.UpdatePaths.JsonValues[i]) + if err != nil { + t.Fatalf("%s: %v", msg, err) + } + ups = append(ups, Update{ + FieldPath: path, + Value: val, + }) + } + _, err := ref.Update(ctx, ups, preconds...) + check(err, tt.UpdatePaths.IsError) + + case *pb.Test_Delete: + srv.addRPC(tt.Delete.Request, commitResponseForSet) + ref := docRefFromPath(tt.Delete.DocRefPath, c) + preconds := convertPrecondition(t, tt.Delete.Precondition) + _, err := ref.Delete(ctx, preconds...) + check(err, tt.Delete.IsError) + + case *pb.Test_Query: + q := convertQuery(t, tt.Query) + got, err := q.toProto() + if check(err, tt.Query.IsError) && err == nil { + if want := tt.Query.Query; !proto.Equal(got, want) { + t.Errorf("%s\ngot: %s\nwant: %s", msg, proto.MarshalTextString(got), proto.MarshalTextString(want)) + } + } + + case *pb.Test_Listen: + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + iter := c.Collection("C").OrderBy("a", Asc).Snapshots(ctx) + var rs []interface{} + for _, r := range tt.Listen.Responses { + rs = append(rs, r) + } + srv.addRPC(&fspb.ListenRequest{ + Database: "projects/projectID/databases/(default)", + TargetChange: &fspb.ListenRequest_AddTarget{iter.ws.target}, + }, rs) + got, err := nSnapshots(iter, len(tt.Listen.Snapshots)) + if err != nil { + t.Errorf("%s: %v", msg, err) + } else if diff := cmp.Diff(got, tt.Listen.Snapshots); diff != "" { + t.Errorf("%s:\n%s", msg, diff) + } + if tt.Listen.IsError { + _, err := iter.Next() + if err == nil { + t.Errorf("%s: got nil, want error", msg) + } + } + + default: + t.Fatalf("unknown test type %T", tt) + } +} + +func nSnapshots(iter *QuerySnapshotIterator, n int) ([]*pb.Snapshot, error) { + var snaps []*pb.Snapshot + for i := 0; i < n; i++ { + qsnap, err := iter.Next() + if err != nil { + return snaps, err + } + s := &pb.Snapshot{ReadTime: mustTimestampProto(qsnap.ReadTime)} + for { + doc, err := qsnap.Documents.Next() + if err == iterator.Done { + break + } + if err != nil { + return snaps, err + } + s.Docs = append(s.Docs, doc.proto) + } + for _, c := range qsnap.Changes { + var k pb.DocChange_Kind + switch c.Kind { + case DocumentAdded: + k = pb.DocChange_ADDED + case DocumentRemoved: + k = pb.DocChange_REMOVED + case DocumentModified: + k = pb.DocChange_MODIFIED + default: + panic("bad kind") + } + s.Changes = append(s.Changes, &pb.DocChange{ + Kind: k, + Doc: c.Doc.proto, + OldIndex: int32(c.OldIndex), + NewIndex: int32(c.NewIndex), + }) + } + snaps = append(snaps, s) + } + return snaps, nil +} + +func docRefFromPath(p string, c *Client) *DocumentRef { + return &DocumentRef{ + Path: p, + ID: path.Base(p), + Parent: &CollectionRef{c: c}, + } +} + +func convertJSONValue(jv string) (interface{}, error) { + var val interface{} + if err := json.Unmarshal([]byte(jv), &val); err != nil { + return nil, err + } + return convertTestValue(val), nil +} + +func convertData(jsonData string) (map[string]interface{}, error) { + var m map[string]interface{} + if err := json.Unmarshal([]byte(jsonData), &m); err != nil { + return nil, err + } + return convertTestMap(m), nil +} + +func convertTestMap(m map[string]interface{}) map[string]interface{} { + for k, v := range m { + m[k] = convertTestValue(v) + } + return m +} + +func convertTestValue(v interface{}) interface{} { + switch v := v.(type) { + case string: + switch v { + case "ServerTimestamp": + return ServerTimestamp + case "Delete": + return Delete + case "NaN": + return math.NaN() + default: + return v + } + case float64: + if v == float64(int(v)) { + return int(v) + } + return v + case []interface{}: + if len(v) > 0 { + if fv, ok := v[0].(string); ok { + if fv == "ArrayUnion" { + return ArrayUnion(convertTestValue(v[1:]).([]interface{})...) + } + if fv == "ArrayRemove" { + return ArrayRemove(convertTestValue(v[1:]).([]interface{})...) + } + } + } + for i, e := range v { + v[i] = convertTestValue(e) + } + return v + case map[string]interface{}: + return convertTestMap(v) + default: + return v + } +} + +func convertSetOption(opt *pb.SetOption) SetOption { + if opt.All { + return MergeAll + } + return Merge(convertFieldPaths(opt.Fields)...) +} + +func convertFieldPaths(fps []*pb.FieldPath) []FieldPath { + var res []FieldPath + for _, fp := range fps { + res = append(res, fp.Field) + } + return res +} + +func convertPrecondition(t *testing.T, fp *fspb.Precondition) []Precondition { + if fp == nil { + return nil + } + var pc Precondition + switch fp := fp.ConditionType.(type) { + case *fspb.Precondition_Exists: + pc = exists(fp.Exists) + case *fspb.Precondition_UpdateTime: + tm, err := ptypes.Timestamp(fp.UpdateTime) + if err != nil { + t.Fatal(err) + } + pc = LastUpdateTime(tm) + default: + t.Fatalf("unknown precondition type %T", fp) + } + return []Precondition{pc} +} + +func convertQuery(t *testing.T, qt *pb.QueryTest) Query { + parts := strings.Split(qt.CollPath, "/") + q := Query{ + parentPath: strings.Join(parts[:len(parts)-2], "/"), + collectionID: parts[len(parts)-1], + } + for _, c := range qt.Clauses { + switch c := c.Clause.(type) { + case *pb.Clause_Select: + q = q.SelectPaths(convertFieldPaths(c.Select.Fields)...) + case *pb.Clause_OrderBy: + var dir Direction + switch c.OrderBy.Direction { + case "asc": + dir = Asc + case "desc": + dir = Desc + default: + t.Fatalf("bad direction: %q", c.OrderBy.Direction) + } + q = q.OrderByPath(FieldPath(c.OrderBy.Path.Field), dir) + case *pb.Clause_Where: + val, err := convertJSONValue(c.Where.JsonValue) + if err != nil { + t.Fatal(err) + } + q = q.WherePath(FieldPath(c.Where.Path.Field), c.Where.Op, val) + case *pb.Clause_Offset: + q = q.Offset(int(c.Offset)) + case *pb.Clause_Limit: + q = q.Limit(int(c.Limit)) + case *pb.Clause_StartAt: + q = q.StartAt(convertCursor(t, c.StartAt)...) + case *pb.Clause_StartAfter: + q = q.StartAfter(convertCursor(t, c.StartAfter)...) + case *pb.Clause_EndAt: + q = q.EndAt(convertCursor(t, c.EndAt)...) + case *pb.Clause_EndBefore: + q = q.EndBefore(convertCursor(t, c.EndBefore)...) + default: + t.Fatalf("bad clause type %T", c) + } + } + return q +} + +// Returns args to a cursor method (StartAt, etc.). +func convertCursor(t *testing.T, c *pb.Cursor) []interface{} { + if c.DocSnapshot != nil { + ds, err := convertDocSnapshot(c.DocSnapshot) + if err != nil { + t.Fatal(err) + } + return []interface{}{ds} + } + var vals []interface{} + for _, jv := range c.JsonValues { + v, err := convertJSONValue(jv) + if err != nil { + t.Fatal(err) + } + vals = append(vals, v) + } + return vals +} + +func convertDocSnapshot(ds *pb.DocSnapshot) (*DocumentSnapshot, error) { + data, err := convertData(ds.JsonData) + if err != nil { + return nil, err + } + doc, transformPaths, err := toProtoDocument(data) + if err != nil { + return nil, err + } + if len(transformPaths) > 0 { + return nil, errors.New("saw transform paths in DocSnapshot") + } + return &DocumentSnapshot{ + Ref: &DocumentRef{ + Path: ds.Path, + Parent: &CollectionRef{Path: path.Dir(ds.Path)}, + }, + proto: doc, + }, nil +} diff --git a/vendor/cloud.google.com/go/firestore/doc.go b/vendor/cloud.google.com/go/firestore/doc.go new file mode 100644 index 000000000..1e4c3f1e5 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/doc.go @@ -0,0 +1,218 @@ +// Copyright 2017 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. + +// DO NOT EDIT doc.go. Modify internal/doc.template, then run make -C internal. + +/* +Package firestore provides a client for reading and writing to a Cloud Firestore +database. + +See https://cloud.google.com/firestore/docs for an introduction +to Cloud Firestore and additional help on using the Firestore API. + +See https://godoc.org/cloud.google.com/go for authentication, timeouts, +connection pooling and similar aspects of this package. + +Note: you can't use both Cloud Firestore and Cloud Datastore in the same +project. + +Creating a Client + +To start working with this package, create a client with a project ID: + + ctx := context.Background() + client, err := firestore.NewClient(ctx, "projectID") + if err != nil { + // TODO: Handle error. + } + +CollectionRefs and DocumentRefs + +In Firestore, documents are sets of key-value pairs, and collections are groups of +documents. A Firestore database consists of a hierarchy of alternating collections +and documents, referred to by slash-separated paths like +"States/California/Cities/SanFrancisco". + +This client is built around references to collections and documents. CollectionRefs +and DocumentRefs are lightweight values that refer to the corresponding database +entities. Creating a ref does not involve any network traffic. + + states := client.Collection("States") + ny := states.Doc("NewYork") + // Or, in a single call: + ny = client.Doc("States/NewYork") + +Reading + +Use DocumentRef.Get to read a document. The result is a DocumentSnapshot. +Call its Data method to obtain the entire document contents as a map. + + docsnap, err := ny.Get(ctx) + if err != nil { + // TODO: Handle error. + } + dataMap := docsnap.Data() + fmt.Println(dataMap) + +You can also obtain a single field with DataAt, or extract the data into a struct +with DataTo. With the type definition + + type State struct { + Capital string `firestore:"capital"` + Population float64 `firestore:"pop"` // in millions + } + +we can extract the document's data into a value of type State: + + var nyData State + if err := docsnap.DataTo(&nyData); err != nil { + // TODO: Handle error. + } + +Note that this client supports struct tags beginning with "firestore:" that work like +the tags of the encoding/json package, letting you rename fields, ignore them, or +omit their values when empty. + +To retrieve multiple documents from their references in a single call, use +Client.GetAll. + + docsnaps, err := client.GetAll(ctx, []*firestore.DocumentRef{ + states.Doc("Wisconsin"), states.Doc("Ohio"), + }) + if err != nil { + // TODO: Handle error. + } + for _, ds := range docsnaps { + _ = ds // TODO: Use ds. + } + + +Writing + +For writing individual documents, use the methods on DocumentReference. +Create creates a new document. + + wr, err := ny.Create(ctx, State{ + Capital: "Albany", + Population: 19.8, + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(wr) + +The first return value is a WriteResult, which contains the time +at which the document was updated. + +Create fails if the document exists. Another method, Set, either replaces an existing +document or creates a new one. + + ca := states.Doc("California") + _, err = ca.Set(ctx, State{ + Capital: "Sacramento", + Population: 39.14, + }) + +To update some fields of an existing document, use Update. It takes a list of +paths to update and their corresponding values. + + _, err = ca.Update(ctx, []firestore.Update{{Path: "capital", Value: "Sacramento"}}) + +Use DocumentRef.Delete to delete a document. + + _, err = ny.Delete(ctx) + +Preconditions + +You can condition Deletes or Updates on when a document was last changed. Specify +these preconditions as an option to a Delete or Update method. The check and the +write happen atomically with a single RPC. + + docsnap, err = ca.Get(ctx) + if err != nil { + // TODO: Handle error. + } + _, err = ca.Update(ctx, + []firestore.Update{{Path: "capital", Value: "Sacramento"}}, + firestore.LastUpdateTime(docsnap.UpdateTime)) + +Here we update a doc only if it hasn't changed since we read it. +You could also do this with a transaction. + +To perform multiple writes at once, use a WriteBatch. Its methods chain +for convenience. + +WriteBatch.Commit sends the collected writes to the server, where they happen +atomically. + + writeResults, err := client.Batch(). + Create(ny, State{Capital: "Albany"}). + Update(ca, []firestore.Update{{Path: "capital", Value: "Sacramento"}}). + Delete(client.Doc("States/WestDakota")). + Commit(ctx) + +Queries + +You can use SQL to select documents from a collection. Begin with the collection, and +build up a query using Select, Where and other methods of Query. + + q := states.Where("pop", ">", 10).OrderBy("pop", firestore.Desc) + +Supported operators include `<`, `<=`, `>`, `>=`, `==`, and 'array-contains'. + +Call the Query's Documents method to get an iterator, and use it like +the other Google Cloud Client iterators. + + iter := q.Documents(ctx) + defer iter.Stop() + for { + doc, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(doc.Data()) + } + +To get all the documents in a collection, you can use the collection itself +as a query. + + iter = client.Collection("States").Documents(ctx) + +Transactions + +Use a transaction to execute reads and writes atomically. All reads must happen +before any writes. Transaction creation, commit, rollback and retry are handled for +you by the Client.RunTransaction method; just provide a function and use the +read and write methods of the Transaction passed to it. + + ny := client.Doc("States/NewYork") + err := client.RunTransaction(ctx, func(ctx context.Context, tx *firestore.Transaction) error { + doc, err := tx.Get(ny) // tx.Get, NOT ny.Get! + if err != nil { + return err + } + pop, err := doc.DataAt("pop") + if err != nil { + return err + } + return tx.Update(ny, []firestore.Update{{Path: "pop", Value: pop.(float64) + 0.2}}) + }) + if err != nil { + // TODO: Handle error. + } +*/ +package firestore diff --git a/vendor/cloud.google.com/go/firestore/docref.go b/vendor/cloud.google.com/go/firestore/docref.go new file mode 100644 index 000000000..422b6bdea --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/docref.go @@ -0,0 +1,706 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "errors" + "fmt" + "io" + "reflect" + "sort" + + vkit "cloud.google.com/go/firestore/apiv1beta1" + "google.golang.org/api/iterator" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var errNilDocRef = errors.New("firestore: nil DocumentRef") + +// A DocumentRef is a reference to a Firestore document. +type DocumentRef struct { + // The CollectionRef that this document is a part of. Never nil. + Parent *CollectionRef + + // The full resource path of the document: "projects/P/databases/D/documents..." + Path string + + // The ID of the document: the last component of the resource path. + ID string +} + +func newDocRef(parent *CollectionRef, id string) *DocumentRef { + return &DocumentRef{ + Parent: parent, + ID: id, + Path: parent.Path + "/" + id, + } +} + +// Collection returns a reference to sub-collection of this document. +func (d *DocumentRef) Collection(id string) *CollectionRef { + return newCollRefWithParent(d.Parent.c, d, id) +} + +// Get retrieves the document. If the document does not exist, Get return a NotFound error, which +// can be checked with +// grpc.Code(err) == codes.NotFound +// In that case, Get returns a non-nil DocumentSnapshot whose Exists method return false and whose +// ReadTime is the time of the failed read operation. +func (d *DocumentRef) Get(ctx context.Context) (*DocumentSnapshot, error) { + if err := checkTransaction(ctx); err != nil { + return nil, err + } + if d == nil { + return nil, errNilDocRef + } + docsnaps, err := d.Parent.c.getAll(ctx, []*DocumentRef{d}, nil) + if err != nil { + return nil, err + } + ds := docsnaps[0] + if !ds.Exists() { + return ds, status.Errorf(codes.NotFound, "%q not found", d.Path) + } + return ds, nil +} + +// Create creates the document with the given data. +// It returns an error if a document with the same ID already exists. +// +// The data argument can be a map with string keys, a struct, or a pointer to a +// struct. The map keys or exported struct fields become the fields of the firestore +// document. +// The values of data are converted to Firestore values as follows: +// +// - bool converts to Bool. +// - string converts to String. +// - int, int8, int16, int32 and int64 convert to Integer. +// - uint8, uint16 and uint32 convert to Integer. uint64 is disallowed, +// because it can represent values that cannot be represented in an int64, which +// is the underlying type of a Integer. +// - float32 and float64 convert to Double. +// - []byte converts to Bytes. +// - time.Time and *ts.Timestamp convert to Timestamp. ts is the package +// "github.com/golang/protobuf/ptypes/timestamp". +// - *latlng.LatLng converts to GeoPoint. latlng is the package +// "google.golang.org/genproto/googleapis/type/latlng". You should always use +// a pointer to a LatLng. +// - Slices convert to Array. +// - *firestore.DocumentRef converts to Reference. +// - Maps and structs convert to Map. +// - nils of any type convert to Null. +// +// Pointers and interface{} are also permitted, and their elements processed +// recursively. +// +// Struct fields can have tags like those used by the encoding/json package. Tags +// begin with "firestore:" and are followed by "-", meaning "ignore this field," or +// an alternative name for the field. Following the name, these comma-separated +// options may be provided: +// +// - omitempty: Do not encode this field if it is empty. A value is empty +// if it is a zero value, or an array, slice or map of length zero. +// - serverTimestamp: The field must be of type time.Time. When writing, if +// the field has the zero value, the server will populate the stored document with +// the time that the request is processed. +func (d *DocumentRef) Create(ctx context.Context, data interface{}) (*WriteResult, error) { + ws, err := d.newCreateWrites(data) + if err != nil { + return nil, err + } + return d.Parent.c.commit1(ctx, ws) +} + +func (d *DocumentRef) newCreateWrites(data interface{}) ([]*pb.Write, error) { + if d == nil { + return nil, errNilDocRef + } + doc, transforms, err := toProtoDocument(data) + if err != nil { + return nil, err + } + doc.Name = d.Path + pc, err := exists(false).preconditionProto() + if err != nil { + return nil, err + } + return d.newUpdateWithTransform(doc, nil, pc, transforms, false), nil +} + +// Set creates or overwrites the document with the given data. See DocumentRef.Create +// for the acceptable values of data. Without options, Set overwrites the document +// completely. Specify one of the Merge options to preserve an existing document's +// fields. To delete some fields, use a Merge option with firestore.Delete as the +// field value. +func (d *DocumentRef) Set(ctx context.Context, data interface{}, opts ...SetOption) (*WriteResult, error) { + ws, err := d.newSetWrites(data, opts) + if err != nil { + return nil, err + } + return d.Parent.c.commit1(ctx, ws) +} + +func (d *DocumentRef) newSetWrites(data interface{}, opts []SetOption) ([]*pb.Write, error) { + if d == nil { + return nil, errNilDocRef + } + if data == nil { + return nil, errors.New("firestore: nil document contents") + } + if len(opts) == 0 { // Set without merge + doc, serverTimestampPaths, err := toProtoDocument(data) + if err != nil { + return nil, err + } + doc.Name = d.Path + return d.newUpdateWithTransform(doc, nil, nil, serverTimestampPaths, true), nil + } + // Set with merge. + // This is just like Update, except for the existence precondition. + // So we turn data into a list of (FieldPath, interface{}) pairs (fpv's), as we do + // for Update. + fieldPaths, allPaths, err := processSetOptions(opts) + if err != nil { + return nil, err + } + var fpvs []fpv + v := reflect.ValueOf(data) + if allPaths { + // Set with MergeAll. Collect all the leaves of the map. + if v.Kind() != reflect.Map { + return nil, errors.New("firestore: MergeAll can only be specified with map data") + } + if v.Len() == 0 { + // Special case: MergeAll with an empty map. + return d.newUpdateWithTransform(&pb.Document{Name: d.Path}, []FieldPath{}, nil, nil, true), nil + } + fpvsFromData(v, nil, &fpvs) + } else { + // Set with merge paths. Collect only the values at the given paths. + for _, fp := range fieldPaths { + val, err := getAtPath(v, fp) + if err != nil { + return nil, err + } + fpvs = append(fpvs, fpv{fp, val}) + } + } + return d.fpvsToWrites(fpvs, nil) +} + +// fpvsFromData converts v into a list of (FieldPath, value) pairs. +func fpvsFromData(v reflect.Value, prefix FieldPath, fpvs *[]fpv) { + switch v.Kind() { + case reflect.Map: + for _, k := range v.MapKeys() { + fpvsFromData(v.MapIndex(k), prefix.with(k.String()), fpvs) + } + case reflect.Interface: + fpvsFromData(v.Elem(), prefix, fpvs) + + default: + var val interface{} + if v.IsValid() { + val = v.Interface() + } + *fpvs = append(*fpvs, fpv{prefix, val}) + } +} + +// removePathsIf creates a new slice of FieldPaths that contains +// exactly those elements of fps for which pred returns false. +func removePathsIf(fps []FieldPath, pred func(FieldPath) bool) []FieldPath { + // Return fps if it's empty to preserve the distinction betweeen nil and zero-length. + if len(fps) == 0 { + return fps + } + var result []FieldPath + for _, fp := range fps { + if !pred(fp) { + result = append(result, fp) + } + } + return result +} + +// Delete deletes the document. If the document doesn't exist, it does nothing +// and returns no error. +func (d *DocumentRef) Delete(ctx context.Context, preconds ...Precondition) (*WriteResult, error) { + ws, err := d.newDeleteWrites(preconds) + if err != nil { + return nil, err + } + return d.Parent.c.commit1(ctx, ws) +} + +func (d *DocumentRef) newDeleteWrites(preconds []Precondition) ([]*pb.Write, error) { + if d == nil { + return nil, errNilDocRef + } + pc, err := processPreconditionsForDelete(preconds) + if err != nil { + return nil, err + } + return []*pb.Write{{ + Operation: &pb.Write_Delete{d.Path}, + CurrentDocument: pc, + }}, nil +} + +func (d *DocumentRef) newUpdatePathWrites(updates []Update, preconds []Precondition) ([]*pb.Write, error) { + if len(updates) == 0 { + return nil, errors.New("firestore: no paths to update") + } + var fpvs []fpv + for _, u := range updates { + v, err := u.process() + if err != nil { + return nil, err + } + fpvs = append(fpvs, v) + } + pc, err := processPreconditionsForUpdate(preconds) + if err != nil { + return nil, err + } + return d.fpvsToWrites(fpvs, pc) +} + +func (d *DocumentRef) fpvsToWrites(fpvs []fpv, pc *pb.Precondition) ([]*pb.Write, error) { + // Make sure there are no duplications or prefixes among the field paths. + var fps []FieldPath + for _, fpv := range fpvs { + fps = append(fps, fpv.fieldPath) + } + if err := checkNoDupOrPrefix(fps); err != nil { + return nil, err + } + + // Process each fpv. + var updatePaths []FieldPath + var transforms []*pb.DocumentTransform_FieldTransform + doc := &pb.Document{ + Name: d.Path, + Fields: map[string]*pb.Value{}, + } + for _, fpv := range fpvs { + switch fpv.value.(type) { + case arrayUnion: + au := fpv.value.(arrayUnion) + t, err := arrayUnionTransform(au, fpv.fieldPath) + if err != nil { + return nil, err + } + transforms = append(transforms, t) + case arrayRemove: + ar := fpv.value.(arrayRemove) + t, err := arrayRemoveTransform(ar, fpv.fieldPath) + if err != nil { + return nil, err + } + transforms = append(transforms, t) + default: + switch fpv.value { + case Delete: + // Send the field path without a corresponding value. + updatePaths = append(updatePaths, fpv.fieldPath) + + case ServerTimestamp: + // Use the path in a transform operation. + transforms = append(transforms, serverTimestamp(fpv.fieldPath.toServiceFieldPath())) + + default: + updatePaths = append(updatePaths, fpv.fieldPath) + // Convert the value to a proto and put it into the document. + v := reflect.ValueOf(fpv.value) + + pv, _, err := toProtoValue(v) + if err != nil { + return nil, err + } + setAtPath(doc.Fields, fpv.fieldPath, pv) + // Also accumulate any transforms within the value. + ts, err := extractTransforms(v, fpv.fieldPath) + if err != nil { + return nil, err + } + transforms = append(transforms, ts...) + } + } + } + return d.newUpdateWithTransform(doc, updatePaths, pc, transforms, false), nil +} + +// newUpdateWithTransform constructs operations for a commit. Most generally, it +// returns an update operation followed by a transform. +// +// If there are no serverTimestampPaths, the transform is omitted. +// +// If doc.Fields is empty, there are no updatePaths, and there is no precondition, +// the update is omitted, unless updateOnEmpty is true. +func (d *DocumentRef) newUpdateWithTransform(doc *pb.Document, updatePaths []FieldPath, pc *pb.Precondition, transforms []*pb.DocumentTransform_FieldTransform, updateOnEmpty bool) []*pb.Write { + var ws []*pb.Write + if updateOnEmpty || len(doc.Fields) > 0 || + len(updatePaths) > 0 || (pc != nil && len(transforms) == 0) { + var mask *pb.DocumentMask + if updatePaths != nil { + sfps := toServiceFieldPaths(updatePaths) + sort.Strings(sfps) // TODO(jba): make tests pass without this + mask = &pb.DocumentMask{FieldPaths: sfps} + } + w := &pb.Write{ + Operation: &pb.Write_Update{doc}, + UpdateMask: mask, + CurrentDocument: pc, + } + ws = append(ws, w) + pc = nil // If the precondition is in the write, we don't need it in the transform. + } + if len(transforms) > 0 || pc != nil { + ws = append(ws, &pb.Write{ + Operation: &pb.Write_Transform{ + Transform: &pb.DocumentTransform{ + Document: d.Path, + FieldTransforms: transforms, + }, + }, + CurrentDocument: pc, + }) + } + return ws +} + +// This helper turns server timestamp fields into a transform proto. +func (d *DocumentRef) newServerTimestampTransform(serverTimestampFieldPaths []FieldPath, pc *pb.Precondition) *pb.Write { + sort.Sort(byPath(serverTimestampFieldPaths)) // TODO(jba): make tests pass without this + var fts []*pb.DocumentTransform_FieldTransform + for _, p := range serverTimestampFieldPaths { + fts = append(fts, serverTimestamp(p.toServiceFieldPath())) + } + return &pb.Write{ + Operation: &pb.Write_Transform{ + &pb.DocumentTransform{ + Document: d.Path, + FieldTransforms: fts, + // TODO(jba): should the transform have the same preconditions as the write? + }, + }, + CurrentDocument: pc, + } +} + +// arrayUnion is a special type in firestore. It instructs the server to add its +// elements to whatever array already exists, or to create an array if no value +// exists. +type arrayUnion struct { + elems []interface{} +} + +// ArrayUnion specifies elements to be added to whatever array already exists in +// the server, or to create an array if no value exists. +// +// If a value exists and it's an array, values are appended to it. Any duplicate +// value is ignored. +// If a value exists and it's not an array, the value is replaced by an array of +// the values in the ArrayUnion. +// If a value does not exist, an array of the values in the ArrayUnion is created. +// +// ArrayUnion must be the value of a field directly; it cannot appear in +// array or struct values, or in any value that is itself inside an array or +// struct. +func ArrayUnion(elems ...interface{}) arrayUnion { + return arrayUnion{elems: elems} +} + +// This helper converts an arrayUnion into a proto object. +func arrayUnionTransform(au arrayUnion, fp FieldPath) (*pb.DocumentTransform_FieldTransform, error) { + var elems []*pb.Value + for _, v := range au.elems { + pv, _, err := toProtoValue(reflect.ValueOf(v)) + if err != nil { + return nil, err + } + elems = append(elems, pv) + } + return &pb.DocumentTransform_FieldTransform{ + FieldPath: fp.toServiceFieldPath(), + TransformType: &pb.DocumentTransform_FieldTransform_AppendMissingElements{ + AppendMissingElements: &pb.ArrayValue{Values: elems}, + }, + }, nil +} + +// arrayRemove is a special type in firestore. It instructs the server to remove +// the specified values. +type arrayRemove struct { + elems []interface{} +} + +// ArrayRemove specifies elements to be removed from whatever array already +// exists in the server. +// +// If a value exists and it's an array, values are removed from it. All +// duplicate values are removed. +// If a value exists and it's not an array, the value is replaced by an empty +// array. +// If a value does not exist, an empty array is created. +// +// ArrayRemove must be the value of a field directly; it cannot appear in +// array or struct values, or in any value that is itself inside an array or +// struct. +func ArrayRemove(elems ...interface{}) arrayRemove { + return arrayRemove{elems: elems} +} + +// This helper converts an arrayRemove into a proto object. +func arrayRemoveTransform(ar arrayRemove, fp FieldPath) (*pb.DocumentTransform_FieldTransform, error) { + var elems []*pb.Value + for _, v := range ar.elems { + // ServerTimestamp cannot occur in an array, so we ignore transformations here. + pv, _, err := toProtoValue(reflect.ValueOf(v)) + if err != nil { + return nil, err + } + elems = append(elems, pv) + } + return &pb.DocumentTransform_FieldTransform{ + FieldPath: fp.toServiceFieldPath(), + TransformType: &pb.DocumentTransform_FieldTransform_RemoveAllFromArray{ + RemoveAllFromArray: &pb.ArrayValue{Values: elems}, + }, + }, nil +} + +type sentinel int + +const ( + // Delete is used as a value in a call to Update or Set with merge to indicate + // that the corresponding key should be deleted. + Delete sentinel = iota + + // ServerTimestamp is used as a value in a call to Update to indicate that the + // key's value should be set to the time at which the server processed + // the request. + // + // ServerTimestamp must be the value of a field directly; it cannot appear in + // array or struct values, or in any value that is itself inside an array or + // struct. + ServerTimestamp +) + +func (s sentinel) String() string { + switch s { + case Delete: + return "Delete" + case ServerTimestamp: + return "ServerTimestamp" + default: + return "" + } +} + +// An Update describes an update to a value referred to by a path. +// An Update should have either a non-empty Path or a non-empty FieldPath, +// but not both. +// +// See DocumentRef.Create for acceptable values. +// To delete a field, specify firestore.Delete as the value. +type Update struct { + Path string // Will be split on dots, and must not contain any of "˜*/[]". + FieldPath FieldPath + Value interface{} +} + +// An fpv is a pair of validated FieldPath and value. +type fpv struct { + fieldPath FieldPath + value interface{} +} + +func (u *Update) process() (fpv, error) { + if (u.Path != "") == (u.FieldPath != nil) { + return fpv{}, fmt.Errorf("firestore: update %+v should have exactly one of Path or FieldPath", u) + } + fp := u.FieldPath + var err error + if fp == nil { + fp, err = parseDotSeparatedString(u.Path) + if err != nil { + return fpv{}, err + } + } + if err := fp.validate(); err != nil { + return fpv{}, err + } + return fpv{fp, u.Value}, nil +} + +// Update updates the document. The values at the given +// field paths are replaced, but other fields of the stored document are untouched. +func (d *DocumentRef) Update(ctx context.Context, updates []Update, preconds ...Precondition) (*WriteResult, error) { + ws, err := d.newUpdatePathWrites(updates, preconds) + if err != nil { + return nil, err + } + return d.Parent.c.commit1(ctx, ws) +} + +// Collections returns an interator over the immediate sub-collections of the document. +func (d *DocumentRef) Collections(ctx context.Context) *CollectionIterator { + client := d.Parent.c + it := &CollectionIterator{ + err: checkTransaction(ctx), + client: client, + parent: d, + it: client.c.ListCollectionIds( + withResourceHeader(ctx, client.path()), + &pb.ListCollectionIdsRequest{Parent: d.Path}), + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +// CollectionIterator is an iterator over sub-collections of a document. +type CollectionIterator struct { + client *Client + parent *DocumentRef + it *vkit.StringIterator + pageInfo *iterator.PageInfo + nextFunc func() error + items []*CollectionRef + err error +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *CollectionIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next result. Its second return value is iterator.Done if there +// are no more results. Once Next returns Done, all subsequent calls will return +// Done. +func (it *CollectionIterator) Next() (*CollectionRef, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *CollectionIterator) fetch(pageSize int, pageToken string) (string, error) { + if it.err != nil { + return "", it.err + } + return iterFetch(pageSize, pageToken, it.it.PageInfo(), func() error { + id, err := it.it.Next() + if err != nil { + return err + } + var cr *CollectionRef + if it.parent == nil { + cr = newTopLevelCollRef(it.client, it.client.path(), id) + } else { + cr = newCollRefWithParent(it.client, it.parent, id) + } + it.items = append(it.items, cr) + return nil + }) +} + +// GetAll returns all the collections remaining from the iterator. +func (it *CollectionIterator) GetAll() ([]*CollectionRef, error) { + var crs []*CollectionRef + for { + cr, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + return nil, err + } + crs = append(crs, cr) + } + return crs, nil +} + +// Common fetch code for iterators that are backed by vkit iterators. +// TODO(jba): dedup with same function in logging/logadmin. +func iterFetch(pageSize int, pageToken string, pi *iterator.PageInfo, next func() error) (string, error) { + pi.MaxSize = pageSize + pi.Token = pageToken + // Get one item, which will fill the buffer. + if err := next(); err != nil { + return "", err + } + // Collect the rest of the buffer. + for pi.Remaining() > 0 { + if err := next(); err != nil { + return "", err + } + } + return pi.Token, nil +} + +// Snapshots returns an iterator over snapshots of the document. Each time the document +// changes or is added or deleted, a new snapshot will be generated. +func (d *DocumentRef) Snapshots(ctx context.Context) *DocumentSnapshotIterator { + return &DocumentSnapshotIterator{ + docref: d, + ws: newWatchStreamForDocument(ctx, d), + } +} + +// DocumentSnapshotIterator is an iterator over snapshots of a document. +// Call Next on the iterator to get a snapshot of the document each time it changes. +// Call Stop on the iterator when done. +// +// For an example, see DocumentRef.Snapshots. +type DocumentSnapshotIterator struct { + docref *DocumentRef + ws *watchStream +} + +// Next blocks until the document changes, then returns the DocumentSnapshot for +// the current state of the document. If the document has been deleted, Next +// returns a DocumentSnapshot whose Exists method returns false. +// +// Next never returns iterator.Done unless it is called after Stop. +func (it *DocumentSnapshotIterator) Next() (*DocumentSnapshot, error) { + btree, _, readTime, err := it.ws.nextSnapshot() + if err != nil { + if err == io.EOF { + err = iterator.Done + } + // watchStream's error is sticky, so SnapshotIterator does not need to remember it. + return nil, err + } + if btree.Len() == 0 { // document deleted + return &DocumentSnapshot{Ref: it.docref, ReadTime: readTime}, nil + } + snap, _ := btree.At(0) + return snap.(*DocumentSnapshot), nil +} + +// Stop stops receiving snapshots. You should always call Stop when you are done with +// a DocumentSnapshotIterator, to free up resources. It is not safe to call Stop +// concurrently with Next. +func (it *DocumentSnapshotIterator) Stop() { + it.ws.stop() +} diff --git a/vendor/cloud.google.com/go/firestore/docref_test.go b/vendor/cloud.google.com/go/firestore/docref_test.go new file mode 100644 index 000000000..cda97a00c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/docref_test.go @@ -0,0 +1,311 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "reflect" + "sort" + "testing" + "time" + + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/genproto/googleapis/type/latlng" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +var ( + writeResultForSet = &WriteResult{UpdateTime: aTime} + commitResponseForSet = &pb.CommitResponse{ + WriteResults: []*pb.WriteResult{{UpdateTime: aTimestamp}}, + } +) + +func TestDocGet(t *testing.T) { + ctx := context.Background() + c, srv := newMock(t) + path := "projects/projectID/databases/(default)/documents/C/a" + pdoc := &pb.Document{ + Name: path, + CreateTime: aTimestamp, + UpdateTime: aTimestamp, + Fields: map[string]*pb.Value{"f": intval(1)}, + } + srv.addRPC(&pb.BatchGetDocumentsRequest{ + Database: c.path(), + Documents: []string{path}, + }, []interface{}{ + &pb.BatchGetDocumentsResponse{ + Result: &pb.BatchGetDocumentsResponse_Found{pdoc}, + ReadTime: aTimestamp2, + }, + }) + ref := c.Collection("C").Doc("a") + gotDoc, err := ref.Get(ctx) + if err != nil { + t.Fatal(err) + } + wantDoc := &DocumentSnapshot{ + Ref: ref, + CreateTime: aTime, + UpdateTime: aTime, + ReadTime: aTime2, + proto: pdoc, + c: c, + } + if !testEqual(gotDoc, wantDoc) { + t.Fatalf("\ngot %+v\nwant %+v", gotDoc, wantDoc) + } + + path2 := "projects/projectID/databases/(default)/documents/C/b" + srv.addRPC( + &pb.BatchGetDocumentsRequest{ + Database: c.path(), + Documents: []string{path2}, + }, []interface{}{ + &pb.BatchGetDocumentsResponse{ + Result: &pb.BatchGetDocumentsResponse_Missing{path2}, + ReadTime: aTimestamp3, + }, + }) + _, err = c.Collection("C").Doc("b").Get(ctx) + if grpc.Code(err) != codes.NotFound { + t.Errorf("got %v, want NotFound", err) + } +} + +func TestDocSet(t *testing.T) { + // Most tests for Set are in the conformance tests. + ctx := context.Background() + c, srv := newMock(t) + + doc := c.Collection("C").Doc("d") + // Merge with a struct and FieldPaths. + srv.addRPC(&pb.CommitRequest{ + Database: "projects/projectID/databases/(default)", + Writes: []*pb.Write{ + { + Operation: &pb.Write_Update{ + Update: &pb.Document{ + Name: "projects/projectID/databases/(default)/documents/C/d", + Fields: map[string]*pb.Value{ + "*": mapval(map[string]*pb.Value{ + "~": boolval(true), + }), + }, + }, + }, + UpdateMask: &pb.DocumentMask{FieldPaths: []string{"`*`.`~`"}}, + }, + }, + }, commitResponseForSet) + data := struct { + A map[string]bool `firestore:"*"` + }{A: map[string]bool{"~": true}} + wr, err := doc.Set(ctx, data, Merge([]string{"*", "~"})) + if err != nil { + t.Fatal(err) + } + if !testEqual(wr, writeResultForSet) { + t.Errorf("got %v, want %v", wr, writeResultForSet) + } + + // MergeAll cannot be used with structs. + _, err = doc.Set(ctx, data, MergeAll) + if err == nil { + t.Errorf("got nil, want error") + } +} + +func TestDocCreate(t *testing.T) { + // Verify creation with structs. In particular, make sure zero values + // are handled well. + // Other tests for Create are handled by the conformance tests. + ctx := context.Background() + c, srv := newMock(t) + + type create struct { + Time time.Time + Bytes []byte + Geo *latlng.LatLng + } + srv.addRPC( + &pb.CommitRequest{ + Database: "projects/projectID/databases/(default)", + Writes: []*pb.Write{ + { + Operation: &pb.Write_Update{ + Update: &pb.Document{ + Name: "projects/projectID/databases/(default)/documents/C/d", + Fields: map[string]*pb.Value{ + "Time": tsval(time.Time{}), + "Bytes": bytesval(nil), + "Geo": nullValue, + }, + }, + }, + CurrentDocument: &pb.Precondition{ + ConditionType: &pb.Precondition_Exists{false}, + }, + }, + }, + }, + commitResponseForSet, + ) + _, err := c.Collection("C").Doc("d").Create(ctx, &create{}) + if err != nil { + t.Fatal(err) + } +} + +func TestDocDelete(t *testing.T) { + ctx := context.Background() + c, srv := newMock(t) + srv.addRPC( + &pb.CommitRequest{ + Database: "projects/projectID/databases/(default)", + Writes: []*pb.Write{ + {Operation: &pb.Write_Delete{"projects/projectID/databases/(default)/documents/C/d"}}, + }, + }, + &pb.CommitResponse{ + WriteResults: []*pb.WriteResult{{}}, + }) + wr, err := c.Collection("C").Doc("d").Delete(ctx) + if err != nil { + t.Fatal(err) + } + if !testEqual(wr, &WriteResult{}) { + t.Errorf("got %+v, want %+v", wr, writeResultForSet) + } +} + +var ( + testData = map[string]interface{}{"a": 1} + testFields = map[string]*pb.Value{"a": intval(1)} +) + +// Update is tested by the conformance tests. + +func TestFPVsFromData(t *testing.T) { + type S struct{ X int } + + for _, test := range []struct { + in interface{} + want []fpv + }{ + { + in: nil, + want: []fpv{{nil, nil}}, + }, + { + in: map[string]interface{}{"a": nil}, + want: []fpv{{[]string{"a"}, nil}}, + }, + { + in: map[string]interface{}{"a": 1}, + want: []fpv{{[]string{"a"}, 1}}, + }, + { + in: map[string]interface{}{ + "a": 1, + "b": map[string]interface{}{"c": 2}, + }, + want: []fpv{{[]string{"a"}, 1}, {[]string{"b", "c"}, 2}}, + }, + { + in: map[string]interface{}{"s": &S{X: 3}}, + want: []fpv{{[]string{"s"}, &S{X: 3}}}, + }, + } { + var got []fpv + fpvsFromData(reflect.ValueOf(test.in), nil, &got) + sort.Sort(byFieldPath(got)) + if !testEqual(got, test.want) { + t.Errorf("%+v: got %v, want %v", test.in, got, test.want) + } + } +} + +type byFieldPath []fpv + +func (b byFieldPath) Len() int { return len(b) } +func (b byFieldPath) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byFieldPath) Less(i, j int) bool { return b[i].fieldPath.less(b[j].fieldPath) } + +func commitRequestForSet() *pb.CommitRequest { + return &pb.CommitRequest{ + Database: "projects/projectID/databases/(default)", + Writes: []*pb.Write{ + { + Operation: &pb.Write_Update{ + Update: &pb.Document{ + Name: "projects/projectID/databases/(default)/documents/C/d", + Fields: testFields, + }, + }, + }, + }, + } +} + +func TestUpdateProcess(t *testing.T) { + for _, test := range []struct { + in Update + want fpv + wantErr bool + }{ + { + in: Update{Path: "a", Value: 1}, + want: fpv{fieldPath: []string{"a"}, value: 1}, + }, + { + in: Update{Path: "c.d", Value: Delete}, + want: fpv{fieldPath: []string{"c", "d"}, value: Delete}, + }, + { + in: Update{FieldPath: []string{"*", "~"}, Value: ServerTimestamp}, + want: fpv{fieldPath: []string{"*", "~"}, value: ServerTimestamp}, + }, + { + in: Update{Path: "*"}, + wantErr: true, // bad rune in path + }, + { + in: Update{Path: "a", FieldPath: []string{"b"}}, + wantErr: true, // both Path and FieldPath + }, + { + in: Update{Value: 1}, + wantErr: true, // neither Path nor FieldPath + }, + { + in: Update{FieldPath: []string{"", "a"}}, + wantErr: true, // empty FieldPath component + }, + } { + got, err := test.in.process() + if test.wantErr { + if err == nil { + t.Errorf("%+v: got nil, want error", test.in) + } + } else if err != nil { + t.Errorf("%+v: got error %v, want nil", test.in, err) + } else if !testEqual(got, test.want) { + t.Errorf("%+v: got %+v, want %+v", test.in, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/firestore/document.go b/vendor/cloud.google.com/go/firestore/document.go new file mode 100644 index 000000000..75063acce --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/document.go @@ -0,0 +1,322 @@ +// Copyright 2017 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 firestore + +import ( + "errors" + "fmt" + "reflect" + "time" + + "github.com/golang/protobuf/ptypes" + tspb "github.com/golang/protobuf/ptypes/timestamp" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// A DocumentSnapshot contains document data and metadata. +type DocumentSnapshot struct { + // The DocumentRef for this document. + Ref *DocumentRef + + // Read-only. The time at which the document was created. + // Increases monotonically when a document is deleted then + // recreated. It can also be compared to values from other documents and + // the read time of a query. + CreateTime time.Time + + // Read-only. The time at which the document was last changed. This value + // is initially set to CreateTime then increases monotonically with each + // change to the document. It can also be compared to values from other + // documents and the read time of a query. + UpdateTime time.Time + + // Read-only. The time at which the document was read. + ReadTime time.Time + + c *Client + proto *pb.Document +} + +// Exists reports whether the DocumentSnapshot represents an existing document. +// Even if Exists returns false, the Ref and ReadTime fields of the DocumentSnapshot +// are valid. +func (d *DocumentSnapshot) Exists() bool { + return d.proto != nil +} + +// Data returns the DocumentSnapshot's fields as a map. +// It is equivalent to +// var m map[string]interface{} +// d.DataTo(&m) +// except that it returns nil if the document does not exist. +func (d *DocumentSnapshot) Data() map[string]interface{} { + if !d.Exists() { + return nil + } + m, err := createMapFromValueMap(d.proto.Fields, d.c) + // Any error here is a bug in the client. + if err != nil { + panic(fmt.Sprintf("firestore: %v", err)) + } + return m +} + +// DataTo uses the document's fields to populate p, which can be a pointer to a +// map[string]interface{} or a pointer to a struct. +// +// Firestore field values are converted to Go values as follows: +// - Null converts to nil. +// - Bool converts to bool. +// - String converts to string. +// - Integer converts int64. When setting a struct field, any signed or unsigned +// integer type is permitted except uint64. Overflow is detected and results in +// an error. +// - Double converts to float64. When setting a struct field, float32 is permitted. +// Overflow is detected and results in an error. +// - Bytes is converted to []byte. +// - Timestamp converts to time.Time. +// - GeoPoint converts to *latlng.LatLng, where latlng is the package +// "google.golang.org/genproto/googleapis/type/latlng". +// - Arrays convert to []interface{}. When setting a struct field, the field +// may be a slice or array of any type and is populated recursively. +// Slices are resized to the incoming value's size, while arrays that are too +// long have excess elements filled with zero values. If the array is too short, +// excess incoming values will be dropped. +// - Maps convert to map[string]interface{}. When setting a struct field, +// maps of key type string and any value type are permitted, and are populated +// recursively. +// - References are converted to *firestore.DocumentRefs. +// +// Field names given by struct field tags are observed, as described in +// DocumentRef.Create. +// +// Only the fields actually present in the document are used to populate p. Other fields +// of p are left unchanged. +// +// If the document does not exist, DataTo returns a NotFound error. +func (d *DocumentSnapshot) DataTo(p interface{}) error { + if !d.Exists() { + return status.Errorf(codes.NotFound, "document %s does not exist", d.Ref.Path) + } + return setFromProtoValue(p, &pb.Value{ValueType: &pb.Value_MapValue{&pb.MapValue{Fields: d.proto.Fields}}}, d.c) +} + +// DataAt returns the data value denoted by path. +// +// The path argument can be a single field or a dot-separated sequence of +// fields, and must not contain any of the runes "˜*/[]". Use DataAtPath instead for +// such a path. +// +// See DocumentSnapshot.DataTo for how Firestore values are converted to Go values. +// +// If the document does not exist, DataAt returns a NotFound error. +func (d *DocumentSnapshot) DataAt(path string) (interface{}, error) { + if !d.Exists() { + return nil, status.Errorf(codes.NotFound, "document %s does not exist", d.Ref.Path) + } + fp, err := parseDotSeparatedString(path) + if err != nil { + return nil, err + } + return d.DataAtPath(fp) +} + +// DataAtPath returns the data value denoted by the FieldPath fp. +// If the document does not exist, DataAtPath returns a NotFound error. +func (d *DocumentSnapshot) DataAtPath(fp FieldPath) (interface{}, error) { + if !d.Exists() { + return nil, status.Errorf(codes.NotFound, "document %s does not exist", d.Ref.Path) + } + v, err := valueAtPath(fp, d.proto.Fields) + if err != nil { + return nil, err + } + return createFromProtoValue(v, d.c) +} + +// valueAtPath returns the value of m referred to by fp. +func valueAtPath(fp FieldPath, m map[string]*pb.Value) (*pb.Value, error) { + for _, k := range fp[:len(fp)-1] { + v := m[k] + if v == nil { + return nil, fmt.Errorf("firestore: no field %q", k) + } + mv := v.GetMapValue() + if mv == nil { + return nil, fmt.Errorf("firestore: value for field %q is not a map", k) + } + m = mv.Fields + } + k := fp[len(fp)-1] + v := m[k] + if v == nil { + return nil, fmt.Errorf("firestore: no field %q", k) + } + return v, nil +} + +// toProtoDocument converts a Go value to a Document proto. +// Valid values are: map[string]T, struct, or pointer to a valid value. +// It also returns a list DocumentTransforms. +func toProtoDocument(x interface{}) (*pb.Document, []*pb.DocumentTransform_FieldTransform, error) { + if x == nil { + return nil, nil, errors.New("firestore: nil document contents") + } + v := reflect.ValueOf(x) + pv, _, err := toProtoValue(v) + if err != nil { + return nil, nil, err + } + var transforms []*pb.DocumentTransform_FieldTransform + transforms, err = extractTransforms(v, nil) + if err != nil { + return nil, nil, err + } + var fields map[string]*pb.Value + if pv != nil { + m := pv.GetMapValue() + if m == nil { + return nil, nil, fmt.Errorf("firestore: cannot convert value of type %T into a map", x) + } + fields = m.Fields + } + return &pb.Document{Fields: fields}, transforms, nil +} + +func extractTransforms(v reflect.Value, prefix FieldPath) ([]*pb.DocumentTransform_FieldTransform, error) { + switch v.Kind() { + case reflect.Map: + return extractTransformsFromMap(v, prefix) + case reflect.Struct: + return extractTransformsFromStruct(v, prefix) + case reflect.Ptr: + if v.IsNil() { + return nil, nil + } + return extractTransforms(v.Elem(), prefix) + case reflect.Interface: + if v.NumMethod() == 0 { // empty interface: recurse on its contents + return extractTransforms(v.Elem(), prefix) + } + return nil, nil + default: + return nil, nil + } +} + +func extractTransformsFromMap(v reflect.Value, prefix FieldPath) ([]*pb.DocumentTransform_FieldTransform, error) { + var transforms []*pb.DocumentTransform_FieldTransform + for _, k := range v.MapKeys() { + sk := k.Interface().(string) // assume keys are strings; checked in toProtoValue + path := prefix.with(sk) + mi := v.MapIndex(k) + if mi.Interface() == ServerTimestamp { + transforms = append(transforms, serverTimestamp(path.toServiceFieldPath())) + } else if au, ok := mi.Interface().(arrayUnion); ok { + t, err := arrayUnionTransform(au, path) + if err != nil { + return nil, err + } + transforms = append(transforms, t) + } else if ar, ok := mi.Interface().(arrayRemove); ok { + t, err := arrayRemoveTransform(ar, path) + if err != nil { + return nil, err + } + transforms = append(transforms, t) + } else { + ps, err := extractTransforms(mi, path) + if err != nil { + return nil, err + } + transforms = append(transforms, ps...) + } + } + return transforms, nil +} + +func extractTransformsFromStruct(v reflect.Value, prefix FieldPath) ([]*pb.DocumentTransform_FieldTransform, error) { + var transforms []*pb.DocumentTransform_FieldTransform + fields, err := fieldCache.Fields(v.Type()) + if err != nil { + return nil, err + } + for _, f := range fields { + fv := v.FieldByIndex(f.Index) + path := prefix.with(f.Name) + opts := f.ParsedTag.(tagOptions) + if opts.serverTimestamp { + var isZero bool + switch f.Type { + case typeOfGoTime: + isZero = fv.Interface().(time.Time).IsZero() + case reflect.PtrTo(typeOfGoTime): + isZero = fv.IsNil() || fv.Elem().Interface().(time.Time).IsZero() + default: + return nil, fmt.Errorf("firestore: field %s of struct %s with serverTimestamp tag must be of type time.Time or *time.Time", + f.Name, v.Type()) + } + if isZero { + transforms = append(transforms, serverTimestamp(path.toServiceFieldPath())) + } + } else { + ps, err := extractTransforms(fv, path) + if err != nil { + return nil, err + } + transforms = append(transforms, ps...) + } + } + return transforms, nil +} + +func newDocumentSnapshot(ref *DocumentRef, proto *pb.Document, c *Client, readTime *tspb.Timestamp) (*DocumentSnapshot, error) { + d := &DocumentSnapshot{ + Ref: ref, + c: c, + proto: proto, + } + if proto != nil { + ts, err := ptypes.Timestamp(proto.CreateTime) + if err != nil { + return nil, err + } + d.CreateTime = ts + ts, err = ptypes.Timestamp(proto.UpdateTime) + if err != nil { + return nil, err + } + d.UpdateTime = ts + } + if readTime != nil { + ts, err := ptypes.Timestamp(readTime) + if err != nil { + return nil, err + } + d.ReadTime = ts + } + return d, nil +} + +func serverTimestamp(path string) *pb.DocumentTransform_FieldTransform { + return &pb.DocumentTransform_FieldTransform{ + FieldPath: path, + TransformType: &pb.DocumentTransform_FieldTransform_SetToServerValue{ + SetToServerValue: pb.DocumentTransform_FieldTransform_REQUEST_TIME, + }, + } +} diff --git a/vendor/cloud.google.com/go/firestore/document_test.go b/vendor/cloud.google.com/go/firestore/document_test.go new file mode 100644 index 000000000..c4e57dfc9 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/document_test.go @@ -0,0 +1,300 @@ +// Copyright 2017 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 firestore + +import ( + "reflect" + "sort" + "strings" + "testing" + "time" + + tspb "github.com/golang/protobuf/ptypes/timestamp" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +func TestToProtoDocument(t *testing.T) { + type s struct{ I int } + + for _, test := range []struct { + in interface{} + want *pb.Document + wantErr bool + }{ + {nil, nil, true}, + {[]int{1}, nil, true}, + {map[string]int{"a": 1}, + &pb.Document{Fields: map[string]*pb.Value{"a": intval(1)}}, + false}, + {s{2}, &pb.Document{Fields: map[string]*pb.Value{"I": intval(2)}}, false}, + {&s{3}, &pb.Document{Fields: map[string]*pb.Value{"I": intval(3)}}, false}, + } { + got, _, gotErr := toProtoDocument(test.in) + if (gotErr != nil) != test.wantErr { + t.Errorf("%v: got error %v, want %t", test.in, gotErr, test.wantErr) + } + if gotErr != nil { + continue + } + if !testEqual(got, test.want) { + t.Errorf("%v: got %v, want %v", test.in, got, test.want) + } + } +} + +func TestNewDocumentSnapshot(t *testing.T) { + c := &Client{ + projectID: "projID", + databaseID: "(database)", + } + docRef := c.Doc("C/a") + in := &pb.Document{ + CreateTime: &tspb.Timestamp{Seconds: 10}, + UpdateTime: &tspb.Timestamp{Seconds: 20}, + Fields: map[string]*pb.Value{"a": intval(1)}, + } + want := &DocumentSnapshot{ + Ref: docRef, + CreateTime: time.Unix(10, 0).UTC(), + UpdateTime: time.Unix(20, 0).UTC(), + ReadTime: aTime, + proto: in, + c: c, + } + got, err := newDocumentSnapshot(docRef, in, c, aTimestamp) + if err != nil { + t.Fatal(err) + } + if !testEqual(got, want) { + t.Errorf("got %+v\nwant %+v", got, want) + } +} + +func TestData(t *testing.T) { + doc := &DocumentSnapshot{ + proto: &pb.Document{ + Fields: map[string]*pb.Value{"a": intval(1), "b": strval("x")}, + }, + } + got := doc.Data() + want := map[string]interface{}{"a": int64(1), "b": "x"} + if !testEqual(got, want) { + t.Errorf("got %#v\nwant %#v", got, want) + } + var got2 map[string]interface{} + if err := doc.DataTo(&got2); err != nil { + t.Fatal(err) + } + if !testEqual(got2, want) { + t.Errorf("got %#v\nwant %#v", got2, want) + } + + type s struct { + A int + B string + } + var got3 s + if err := doc.DataTo(&got3); err != nil { + t.Fatal(err) + } + want2 := s{A: 1, B: "x"} + if !testEqual(got3, want2) { + t.Errorf("got %#v\nwant %#v", got3, want2) + } +} + +var testDoc = &DocumentSnapshot{ + proto: &pb.Document{ + Fields: map[string]*pb.Value{ + "a": intval(1), + "b": mapval(map[string]*pb.Value{ + "`": intval(2), + "~": mapval(map[string]*pb.Value{ + "x": intval(3), + }), + }), + }, + }, +} + +func TestDataAt(t *testing.T) { + for _, test := range []struct { + fieldPath string + want interface{} + }{ + {"a", int64(1)}, + {"b.`", int64(2)}, + } { + got, err := testDoc.DataAt(test.fieldPath) + if err != nil { + t.Errorf("%q: %v", test.fieldPath, err) + continue + } + if !testEqual(got, test.want) { + t.Errorf("%q: got %v, want %v", test.fieldPath, got, test.want) + } + } + + for _, bad := range []string{ + "c.~.x", // bad field path + "a.b", // "a" isn't a map + "z.b", // bad non-final key + "b.z", // bad final key + } { + _, err := testDoc.DataAt(bad) + if err == nil { + t.Errorf("%q: got nil, want error", bad) + } + } +} + +func TestDataAtPath(t *testing.T) { + for _, test := range []struct { + fieldPath FieldPath + want interface{} + }{ + {[]string{"a"}, int64(1)}, + {[]string{"b", "`"}, int64(2)}, + {[]string{"b", "~"}, map[string]interface{}{"x": int64(3)}}, + {[]string{"b", "~", "x"}, int64(3)}, + } { + got, err := testDoc.DataAtPath(test.fieldPath) + if err != nil { + t.Errorf("%v: %v", test.fieldPath, err) + continue + } + if !testEqual(got, test.want) { + t.Errorf("%v: got %v, want %v", test.fieldPath, got, test.want) + } + } + + for _, bad := range []FieldPath{ + []string{"c", "", "x"}, // bad field path + []string{"a", "b"}, // "a" isn't a map + []string{"z", "~"}, // bad non-final key + []string{"b", "z"}, // bad final key + } { + _, err := testDoc.DataAtPath(bad) + if err == nil { + t.Errorf("%v: got nil, want error", bad) + } + } +} + +func TestExtractTransforms(t *testing.T) { + type S struct { + A time.Time `firestore:",serverTimestamp"` + B time.Time `firestore:",serverTimestamp"` + C *time.Time `firestore:",serverTimestamp"` + D *time.Time `firestore:"d.d,serverTimestamp"` + E *time.Time `firestore:",serverTimestamp"` + F time.Time + G int + } + + m := map[string]interface{}{ + "ar": map[string]interface{}{"k2": ArrayRemove("e", "f", "g")}, + "au": map[string]interface{}{"k1": ArrayUnion("a", "b", "c")}, + "x": 1, + "y": &S{ + // A is a zero time: included + B: aTime, // not a zero time: excluded + //C is nil: included + D: &time.Time{}, // pointer to a zero time: included + E: &aTime, // pointer to a non-zero time: excluded + //F is a zero time, but does not have the right tag: excluded + G: 15, // not a time.Time + }, + "z": map[string]interface{}{"w": ServerTimestamp}, + } + got, err := extractTransforms(reflect.ValueOf(m), nil) + if err != nil { + t.Fatal(err) + } + want := []*pb.DocumentTransform_FieldTransform{ + { + FieldPath: "ar.k2", + TransformType: &pb.DocumentTransform_FieldTransform_RemoveAllFromArray{ + RemoveAllFromArray: &pb.ArrayValue{Values: []*pb.Value{ + {ValueType: &pb.Value_StringValue{"e"}}, + {ValueType: &pb.Value_StringValue{"f"}}, + {ValueType: &pb.Value_StringValue{"g"}}, + }}, + }, + }, + { + FieldPath: "au.k1", + TransformType: &pb.DocumentTransform_FieldTransform_AppendMissingElements{ + AppendMissingElements: &pb.ArrayValue{Values: []*pb.Value{ + {ValueType: &pb.Value_StringValue{"a"}}, + {ValueType: &pb.Value_StringValue{"b"}}, + {ValueType: &pb.Value_StringValue{"c"}}, + }}, + }, + }, + { + FieldPath: "y.A", + TransformType: &pb.DocumentTransform_FieldTransform_SetToServerValue{ + SetToServerValue: pb.DocumentTransform_FieldTransform_REQUEST_TIME, + }, + }, + { + FieldPath: "y.C", + TransformType: &pb.DocumentTransform_FieldTransform_SetToServerValue{ + SetToServerValue: pb.DocumentTransform_FieldTransform_REQUEST_TIME, + }, + }, + { + FieldPath: "y.`d.d`", + TransformType: &pb.DocumentTransform_FieldTransform_SetToServerValue{ + SetToServerValue: pb.DocumentTransform_FieldTransform_REQUEST_TIME, + }, + }, + { + FieldPath: "z.w", + TransformType: &pb.DocumentTransform_FieldTransform_SetToServerValue{ + SetToServerValue: pb.DocumentTransform_FieldTransform_REQUEST_TIME, + }, + }, + } + if len(got) != len(want) { + t.Fatalf("Expected output array of size %d, got %d: %v", len(want), len(got), got) + } + sort.Sort(byDocumentTransformFieldPath(got)) + for i, vw := range want { + vg := got[i] + if !testEqual(vw, vg) { + t.Fatalf("index %d: got %#v, want %#v", i, vg, vw) + } + } +} + +type byDocumentTransformFieldPath []*pb.DocumentTransform_FieldTransform + +func (b byDocumentTransformFieldPath) Len() int { return len(b) } +func (b byDocumentTransformFieldPath) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byDocumentTransformFieldPath) Less(i, j int) bool { + return strings.Compare(b[i].FieldPath, b[j].FieldPath) < 1 +} + +func TestExtractTransformPathsErrors(t *testing.T) { + type S struct { + A int `firestore:",serverTimestamp"` + } + _, err := extractTransforms(reflect.ValueOf(S{}), nil) + if err == nil { + t.Error("got nil, want error") + } +} diff --git a/vendor/cloud.google.com/go/firestore/examples_test.go b/vendor/cloud.google.com/go/firestore/examples_test.go new file mode 100644 index 000000000..40e5d989e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/examples_test.go @@ -0,0 +1,609 @@ +// Copyright 2017 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. + +// TODO(jba): add Output comments to examples when feasible. + +package firestore_test + +import ( + "context" + "fmt" + + "cloud.google.com/go/firestore" + "google.golang.org/api/iterator" +) + +func ExampleNewClient() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() // Close client when done. + _ = client // TODO: Use client. +} + +func ExampleClient_Collection() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + coll1 := client.Collection("States") + coll2 := client.Collection("States/NewYork/Cities") + fmt.Println(coll1, coll2) +} + +func ExampleClient_Doc() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + doc1 := client.Doc("States/NewYork") + doc2 := client.Doc("States/NewYork/Cities/Albany") + fmt.Println(doc1, doc2) +} + +func ExampleClient_GetAll() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + docs, err := client.GetAll(ctx, []*firestore.DocumentRef{ + client.Doc("States/NorthCarolina"), + client.Doc("States/SouthCarolina"), + client.Doc("States/WestCarolina"), + client.Doc("States/EastCarolina"), + }) + if err != nil { + // TODO: Handle error. + } + // docs is a slice with four DocumentSnapshots, but the last two are + // nil because there is no West or East Carolina. + fmt.Println(docs) +} + +func ExampleClient_Batch() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + b := client.Batch() + _ = b // TODO: Use batch. +} + +func ExampleWriteBatch_Commit() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + type State struct { + Capital string `firestore:"capital"` + Population float64 `firestore:"pop"` // in millions + } + + ny := client.Doc("States/NewYork") + ca := client.Doc("States/California") + + writeResults, err := client.Batch(). + Create(ny, State{Capital: "Albany", Population: 19.8}). + Set(ca, State{Capital: "Sacramento", Population: 39.14}). + Delete(client.Doc("States/WestDakota")). + Commit(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Println(writeResults) +} + +func ExampleCollectionRef_Add() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + doc, wr, err := client.Collection("Users").Add(ctx, map[string]interface{}{ + "name": "Alice", + "email": "aj@example.com", + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(doc, wr) +} + +func ExampleCollectionRef_Doc() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + fl := client.Collection("States").Doc("Florida") + ta := client.Collection("States").Doc("Florida/Cities/Tampa") + + fmt.Println(fl, ta) +} + +func ExampleCollectionRef_NewDoc() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + doc := client.Collection("Users").NewDoc() + + fmt.Println(doc) +} + +func ExampleDocumentRef_Collection() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + mi := client.Collection("States").Doc("Michigan") + cities := mi.Collection("Cities") + + fmt.Println(cities) +} + +func ExampleDocumentRef_Create_map() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + wr, err := client.Doc("States/Colorado").Create(ctx, map[string]interface{}{ + "capital": "Denver", + "pop": 5.5, + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(wr.UpdateTime) +} + +func ExampleDocumentRef_Create_struct() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + type State struct { + Capital string `firestore:"capital"` + Population float64 `firestore:"pop"` // in millions + } + + wr, err := client.Doc("States/Colorado").Create(ctx, State{ + Capital: "Denver", + Population: 5.5, + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(wr.UpdateTime) +} + +func ExampleDocumentRef_Set() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + // Overwrite the document with the given data. Any other fields currently + // in the document will be removed. + wr, err := client.Doc("States/Alabama").Set(ctx, map[string]interface{}{ + "capital": "Montgomery", + "pop": 4.9, + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(wr.UpdateTime) +} + +func ExampleDocumentRef_Set_merge() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + // Overwrite only the fields in the map; preserve all others. + _, err = client.Doc("States/Alabama").Set(ctx, map[string]interface{}{ + "pop": 5.2, + }, firestore.MergeAll) + if err != nil { + // TODO: Handle error. + } + + type State struct { + Capital string `firestore:"capital"` + Population float64 `firestore:"pop"` // in millions + } + + // To do a merging Set with struct data, specify the exact fields to overwrite. + // MergeAll is disallowed here, because it would probably be a mistake: the "capital" + // field would be overwritten with the empty string. + _, err = client.Doc("States/Alabama").Set(ctx, State{Population: 5.2}, firestore.Merge([]string{"pop"})) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleDocumentRef_Update() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + tenn := client.Doc("States/Tennessee") + wr, err := tenn.Update(ctx, []firestore.Update{ + {Path: "pop", Value: 6.6}, + {FieldPath: []string{".", "*", "/"}, Value: "odd"}, + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(wr.UpdateTime) +} + +func ExampleDocumentRef_Delete() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + // Oops, Ontario is a Canadian province... + if _, err = client.Doc("States/Ontario").Delete(ctx); err != nil { + // TODO: Handle error. + } +} + +func ExampleDocumentRef_Get() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + docsnap, err := client.Doc("States/Ohio").Get(ctx) + if err != nil { + // TODO: Handle error. + } + _ = docsnap // TODO: Use DocumentSnapshot. +} + +func ExampleDocumentRef_Snapshots() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + iter := client.Doc("States/Idaho").Snapshots(ctx) + defer iter.Stop() + for { + docsnap, err := iter.Next() + if err != nil { + // TODO: Handle error. + } + _ = docsnap // TODO: Use DocumentSnapshot. + } +} + +func ExampleDocumentSnapshot_Data() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + docsnap, err := client.Doc("States/Ohio").Get(ctx) + if err != nil { + // TODO: Handle error. + } + ohioMap := docsnap.Data() + fmt.Println(ohioMap["capital"]) +} + +func ExampleDocumentSnapshot_DataAt() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + docsnap, err := client.Doc("States/Ohio").Get(ctx) + if err != nil { + // TODO: Handle error. + } + cap, err := docsnap.DataAt("capital") + if err != nil { + // TODO: Handle error. + } + fmt.Println(cap) +} + +func ExampleDocumentSnapshot_DataAtPath() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + docsnap, err := client.Doc("States/Ohio").Get(ctx) + if err != nil { + // TODO: Handle error. + } + pop, err := docsnap.DataAtPath([]string{"capital", "population"}) + if err != nil { + // TODO: Handle error. + } + fmt.Println(pop) +} + +func ExampleDocumentSnapshot_DataTo() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + docsnap, err := client.Doc("States/Ohio").Get(ctx) + if err != nil { + // TODO: Handle error. + } + + type State struct { + Capital string `firestore:"capital"` + Population float64 `firestore:"pop"` // in millions + } + + var s State + if err := docsnap.DataTo(&s); err != nil { + // TODO: Handle error. + } + fmt.Println(s) +} + +func ExampleQuery_Documents() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + q := client.Collection("States").Select("pop"). + Where("pop", ">", 10). + OrderBy("pop", firestore.Desc). + Limit(10) + iter1 := q.Documents(ctx) + _ = iter1 // TODO: Use iter1. + + // You can call Documents directly on a CollectionRef as well. + iter2 := client.Collection("States").Documents(ctx) + _ = iter2 // TODO: Use iter2. +} + +// This example is just like the one above, but illustrates +// how to use the XXXPath methods of Query for field paths +// that can't be expressed as a dot-separated string. +func ExampleQuery_Documents_path_methods() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + q := client.Collection("Unusual").SelectPaths([]string{"*"}, []string{"[~]"}). + WherePath([]string{"/"}, ">", 10). + OrderByPath([]string{"/"}, firestore.Desc). + Limit(10) + iter1 := q.Documents(ctx) + _ = iter1 // TODO: Use iter1. + + // You can call Documents directly on a CollectionRef as well. + iter2 := client.Collection("States").Documents(ctx) + _ = iter2 // TODO: Use iter2. +} + +func ExampleQuery_Snapshots() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + q := client.Collection("States").Select("pop"). + Where("pop", ">", 10). + OrderBy("pop", firestore.Desc). + Limit(10) + qsnapIter := q.Snapshots(ctx) + // Listen forever for changes to the query's results. + for { + qsnap, err := qsnapIter.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Printf("At %s there were %d results.\n", qsnap.ReadTime, qsnap.Size) + _ = qsnap.Documents // TODO: Iterate over the results if desired. + _ = qsnap.Changes // TODO: Use the list of incremental changes if desired. + } +} + +func ExampleDocumentIterator_Next() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + q := client.Collection("States"). + Where("pop", ">", 10). + OrderBy("pop", firestore.Desc) + iter := q.Documents(ctx) + defer iter.Stop() + for { + doc, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(doc.Data()) + } +} + +func ExampleDocumentIterator_GetAll() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + q := client.Collection("States"). + Where("pop", ">", 10). + OrderBy("pop", firestore.Desc). + Limit(10) // a good idea with GetAll, to avoid filling memory + docs, err := q.Documents(ctx).GetAll() + if err != nil { + // TODO: Handle error. + } + for _, doc := range docs { + fmt.Println(doc.Data()) + } +} + +func ExampleClient_RunTransaction() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + nm := client.Doc("States/NewMexico") + err = client.RunTransaction(ctx, func(ctx context.Context, tx *firestore.Transaction) error { + doc, err := tx.Get(nm) // tx.Get, NOT nm.Get! + if err != nil { + return err + } + pop, err := doc.DataAt("pop") + if err != nil { + return err + } + return tx.Update(nm, []firestore.Update{{Path: "pop", Value: pop.(float64) + 0.2}}) + }) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleArrayUnion_create() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + wr, err := client.Doc("States/Colorado").Create(ctx, map[string]interface{}{ + "cities": firestore.ArrayUnion("Denver", "Golden", "Boulder"), + "pop": 5.5, + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(wr.UpdateTime) +} + +func ExampleArrayUnion_update() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + co := client.Doc("States/Colorado") + wr, err := co.Update(ctx, []firestore.Update{ + {Path: "cities", Value: firestore.ArrayUnion("Broomfield")}, + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(wr.UpdateTime) +} + +func ExampleArrayRemove_update() { + ctx := context.Background() + client, err := firestore.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + + co := client.Doc("States/Colorado") + wr, err := co.Update(ctx, []firestore.Update{ + {Path: "cities", Value: firestore.ArrayRemove("Denver")}, + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(wr.UpdateTime) +} diff --git a/vendor/cloud.google.com/go/firestore/fieldpath.go b/vendor/cloud.google.com/go/firestore/fieldpath.go new file mode 100644 index 000000000..3f64ced89 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/fieldpath.go @@ -0,0 +1,277 @@ +// Copyright 2017 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 firestore + +import ( + "bytes" + "errors" + "fmt" + "reflect" + "regexp" + "sort" + "strings" + "sync" + + "cloud.google.com/go/internal/fields" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +// A FieldPath is a non-empty sequence of non-empty fields that reference a value. +// +// A FieldPath value should only be necessary if one of the field names contains +// one of the runes ".˜*/[]". Most methods accept a simpler form of field path +// as a string in which the individual fields are separated by dots. +// For example, +// []string{"a", "b"} +// is equivalent to the string form +// "a.b" +// but +// []string{"*"} +// has no equivalent string form. +type FieldPath []string + +// parseDotSeparatedString constructs a FieldPath from a string that separates +// path components with dots. Other than splitting at dots and checking for invalid +// characters, it ignores everything else about the string, +// including attempts to quote field path compontents. So "a.`b.c`.d" is parsed into +// four parts, "a", "`b", "c`" and "d". +func parseDotSeparatedString(s string) (FieldPath, error) { + const invalidRunes = "~*/[]" + if strings.ContainsAny(s, invalidRunes) { + return nil, fmt.Errorf("firestore: %q contains an invalid rune (one of %s)", s, invalidRunes) + } + fp := FieldPath(strings.Split(s, ".")) + if err := fp.validate(); err != nil { + return nil, err + } + return fp, nil +} + +func (fp1 FieldPath) equal(fp2 FieldPath) bool { + if len(fp1) != len(fp2) { + return false + } + for i, c1 := range fp1 { + if c1 != fp2[i] { + return false + } + } + return true +} + +func (fp1 FieldPath) prefixOf(fp2 FieldPath) bool { + return len(fp1) <= len(fp2) && fp1.equal(fp2[:len(fp1)]) +} + +// Lexicographic ordering. +func (fp1 FieldPath) less(fp2 FieldPath) bool { + for i := range fp1 { + switch { + case i >= len(fp2): + return false + case fp1[i] < fp2[i]: + return true + case fp1[i] > fp2[i]: + return false + } + } + // fp1 and fp2 are equal up to len(fp1). + return len(fp1) < len(fp2) +} + +// validate checks the validity of fp and returns an error if it is invalid. +func (fp FieldPath) validate() error { + if len(fp) == 0 { + return errors.New("firestore: empty field path") + } + for _, c := range fp { + if len(c) == 0 { + return errors.New("firestore: empty component in field path") + } + } + return nil +} + +// with creates a new FieldPath consisting of fp followed by k. +func (fp FieldPath) with(k string) FieldPath { + r := make(FieldPath, len(fp), len(fp)+1) + copy(r, fp) + return append(r, k) +} + +// concat creates a new FieldPath consisting of fp1 followed by fp2. +func (fp1 FieldPath) concat(fp2 FieldPath) FieldPath { + r := make(FieldPath, len(fp1)+len(fp2)) + copy(r, fp1) + copy(r[len(fp1):], fp2) + return r +} + +// in reports whether fp is equal to one of the fps. +func (fp FieldPath) in(fps []FieldPath) bool { + for _, e := range fps { + if fp.equal(e) { + return true + } + } + return false +} + +// checkNoDupOrPrefix checks whether any FieldPath is a prefix of (or equal to) +// another. +// It modifies the order of FieldPaths in its argument (via sorting). +func checkNoDupOrPrefix(fps []FieldPath) error { + // Sort fps lexicographically. + sort.Sort(byPath(fps)) + // Check adjacent pairs for prefix. + for i := 1; i < len(fps); i++ { + if fps[i-1].prefixOf(fps[i]) { + return fmt.Errorf("field path %v cannot be used in the same update as %v", fps[i-1], fps[i]) + } + } + return nil +} + +type byPath []FieldPath + +func (b byPath) Len() int { return len(b) } +func (b byPath) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byPath) Less(i, j int) bool { return b[i].less(b[j]) } + +// setAtPath sets val at the location in m specified by fp, creating sub-maps as +// needed. m must not be nil. fp is assumed to be valid. +func setAtPath(m map[string]*pb.Value, fp FieldPath, val *pb.Value) { + if val == nil { + return + } + if len(fp) == 1 { + m[fp[0]] = val + } else { + v, ok := m[fp[0]] + if !ok { + v = &pb.Value{ValueType: &pb.Value_MapValue{&pb.MapValue{Fields: map[string]*pb.Value{}}}} + m[fp[0]] = v + } + // The type assertion below cannot fail, because setAtPath is only called + // with either an empty map or one filled by setAtPath itself, and the + // set of FieldPaths it is called with has been checked to make sure that + // no path is the prefix of any other. + setAtPath(v.GetMapValue().Fields, fp[1:], val) + } +} + +// getAtPath gets the value in data referred to by fp. The data argument can +// be a map or a struct. +// Compare with valueAtPath, which does the same thing for a document. +func getAtPath(v reflect.Value, fp FieldPath) (interface{}, error) { + var err error + for _, k := range fp { + v, err = getAtField(v, k) + if err != nil { + return nil, err + } + } + return v.Interface(), nil +} + +// getAtField returns the equivalent of v[k], if v is a map, or v.k if v is a struct. +func getAtField(v reflect.Value, k string) (reflect.Value, error) { + switch v.Kind() { + case reflect.Map: + if r := v.MapIndex(reflect.ValueOf(k)); r.IsValid() { + return r, nil + } + + case reflect.Struct: + fm, err := fieldMap(v.Type()) + if err != nil { + return reflect.Value{}, err + } + if f, ok := fm[k]; ok { + return v.FieldByIndex(f.Index), nil + } + + case reflect.Interface: + return getAtField(v.Elem(), k) + + case reflect.Ptr: + return getAtField(v.Elem(), k) + } + return reflect.Value{}, fmt.Errorf("firestore: no field %q for value %#v", k, v) +} + +// fieldMapCache holds maps from from Firestore field name to struct field, +// keyed by struct type. +var fieldMapCache sync.Map + +func fieldMap(t reflect.Type) (map[string]fields.Field, error) { + x, ok := fieldMapCache.Load(t) + if !ok { + fieldList, err := fieldCache.Fields(t) + if err != nil { + x = err + } else { + m := map[string]fields.Field{} + for _, f := range fieldList { + m[f.Name] = f + } + x = m + } + fieldMapCache.Store(t, x) + } + if err, ok := x.(error); ok { + return nil, err + } + return x.(map[string]fields.Field), nil +} + +// toServiceFieldPath converts fp the form required by the Firestore service. +// It assumes fp has been validated. +func (fp FieldPath) toServiceFieldPath() string { + cs := make([]string, len(fp)) + for i, c := range fp { + cs[i] = toServiceFieldPathComponent(c) + } + return strings.Join(cs, ".") +} + +func toServiceFieldPaths(fps []FieldPath) []string { + var sfps []string + for _, fp := range fps { + sfps = append(sfps, fp.toServiceFieldPath()) + } + return sfps +} + +// Google SQL syntax for an unquoted field. +var unquotedFieldRegexp = regexp.MustCompile("^[A-Za-z_][A-Za-z_0-9]*$") + +// toServiceFieldPathComponent returns a string that represents key and is a valid +// field path component. +func toServiceFieldPathComponent(key string) string { + if unquotedFieldRegexp.MatchString(key) { + return key + } + var buf bytes.Buffer + buf.WriteRune('`') + for _, r := range key { + if r == '`' || r == '\\' { + buf.WriteRune('\\') + } + buf.WriteRune(r) + } + buf.WriteRune('`') + return buf.String() +} diff --git a/vendor/cloud.google.com/go/firestore/fieldpath_test.go b/vendor/cloud.google.com/go/firestore/fieldpath_test.go new file mode 100644 index 000000000..2c8072fdc --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/fieldpath_test.go @@ -0,0 +1,232 @@ +// Copyright 2017 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 firestore + +import ( + "reflect" + "strings" + "testing" + + "cloud.google.com/go/internal/testutil" +) + +func TestFieldPathValidate(t *testing.T) { + for _, in := range [][]string{nil, {}, {"a", "", "b"}} { + if err := FieldPath(in).validate(); err == nil { + t.Errorf("%v: want error, got nil", in) + } + } +} + +func TestFieldPathLess(t *testing.T) { + for _, test := range []struct { + in1, in2 string + want bool + }{ + {"a b", "a b", false}, + {"a", "b", true}, + {"b", "a", false}, + {"a", "a b", true}, + {"a b", "a", false}, + {"a b c", "a b d", true}, + {"a b d", "a b c", false}, + } { + fp1 := FieldPath(strings.Fields(test.in1)) + fp2 := FieldPath(strings.Fields(test.in2)) + got := fp1.less(fp2) + if got != test.want { + t.Errorf("%q.less(%q): got %t, want %t", test.in1, test.in2, got, test.want) + } + } +} + +func TestCheckForPrefix(t *testing.T) { + for _, test := range []struct { + in []string // field paths as space-separated strings + wantErr bool + }{ + {in: []string{"a", "b", "c"}, wantErr: false}, + {in: []string{"a b", "b", "c d"}, wantErr: false}, + {in: []string{"a b", "a c", "a d"}, wantErr: false}, + {in: []string{"a b", "b", "b d"}, wantErr: true}, + {in: []string{"a b", "b", "b d"}, wantErr: true}, + {in: []string{"b c d", "c d", "b c"}, wantErr: true}, + } { + var fps []FieldPath + for _, s := range test.in { + fps = append(fps, strings.Fields(s)) + } + err := checkNoDupOrPrefix(fps) + if got, want := (err != nil), test.wantErr; got != want { + t.Errorf("%#v: got '%v', want %t", test.in, err, want) + } + } +} + +func TestGetAtPath(t *testing.T) { + type S struct { + X int + Y int `firestore:"y"` + M map[string]interface{} + Next *S + } + + const fail = "ERROR" // value for expected error + + for _, test := range []struct { + val interface{} + fp FieldPath + want interface{} + }{ + { + val: map[string]int(nil), + fp: nil, + want: map[string]int(nil), + }, + { + val: 1, + fp: nil, + want: 1, + }, + { + val: 1, + fp: []string{"a"}, + want: fail, + }, + { + val: map[string]int{"a": 2}, + fp: []string{"a"}, + want: 2, + }, + { + val: map[string]int{"a": 2}, + fp: []string{"b"}, + want: fail, + }, + { + val: map[string]interface{}{"a": map[string]int{"b": 3}}, + fp: []string{"a", "b"}, + want: 3, + }, + { + val: map[string]interface{}{"a": map[string]int{"b": 3}}, + fp: []string{"a", "b", "c"}, + want: fail, + }, + { + val: S{X: 1, Y: 2}, + fp: nil, + want: S{X: 1, Y: 2}, + }, + { + val: S{X: 1, Y: 2}, + fp: []string{"X"}, + want: 1, + }, + { + val: S{X: 1, Y: 2}, + fp: []string{"Y"}, + want: fail, // because Y is tagged with name "y" + }, + { + val: S{X: 1, Y: 2}, + fp: []string{"y"}, + want: 2, + }, + { + val: &S{X: 1}, + fp: []string{"X"}, + want: 1, + }, + { + val: &S{X: 1, Next: nil}, + fp: []string{"Next"}, + want: (*S)(nil), + }, + { + val: &S{X: 1, Next: nil}, + fp: []string{"Next", "Next"}, + want: fail, + }, + { + val: map[string]S{"a": {X: 1, Y: 2}}, + fp: []string{"a", "y"}, + want: 2, + }, + { + val: map[string]S{"a": {X: 1, Y: 2}}, + fp: []string{"a", "z"}, + want: fail, + }, + { + val: map[string]*S{ + "a": { + M: map[string]interface{}{ + "b": S{ + Next: &S{ + X: 17, + }, + }, + }, + }, + }, + fp: []string{"a", "M", "b", "Next", "X"}, + want: 17, + }, + } { + got, err := getAtPath(reflect.ValueOf(test.val), test.fp) + if err != nil && test.want != fail { + t.Errorf("%+v: got error <%v>, want nil", test, err) + } + if err == nil && !testutil.Equal(got, test.want) { + t.Errorf("%+v: got %v, want %v, want nil", test, got, test.want) + } + } +} + +func TestToServiceFieldPath(t *testing.T) { + for _, test := range []struct { + in FieldPath + want string + }{ + {[]string{"a"}, "a"}, + {[]string{"a", "b"}, "a.b"}, + {[]string{"a.", "[b*", "c2"}, "`a.`.`[b*`.c2"}, + {[]string{"`a", `b\`}, "`\\`a`.`b\\\\`"}, + } { + got := test.in.toServiceFieldPath() + if got != test.want { + t.Errorf("%v: got %s, want %s", test.in, got, test.want) + } + } +} + +func TestToServiceFieldPathComponent(t *testing.T) { + for _, test := range []struct { + in, want string + }{ + {"", "``"}, + {"clam_chowder23", "clam_chowder23"}, + {"23skidoo", "`23skidoo`"}, + {"bak`tik", "`bak\\`tik`"}, + {"a\\b", "`a\\\\b`"}, + {"dots.are.confusing", "`dots.are.confusing`"}, + } { + got := toServiceFieldPathComponent(test.in) + if got != test.want { + t.Errorf("%q: got %q, want %q", test.in, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/firestore/from_value.go b/vendor/cloud.google.com/go/firestore/from_value.go new file mode 100644 index 000000000..feba34fce --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/from_value.go @@ -0,0 +1,430 @@ +// Copyright 2017 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 firestore + +import ( + "errors" + "fmt" + "reflect" + "strings" + + "github.com/golang/protobuf/ptypes" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +func setFromProtoValue(x interface{}, vproto *pb.Value, c *Client) error { + v := reflect.ValueOf(x) + if v.Kind() != reflect.Ptr || v.IsNil() { + return errors.New("firestore: nil or not a pointer") + } + return setReflectFromProtoValue(v.Elem(), vproto, c) +} + +// setReflectFromProtoValue sets v from a Firestore Value. +// v must be a settable value. +func setReflectFromProtoValue(v reflect.Value, vproto *pb.Value, c *Client) error { + typeErr := func() error { + return fmt.Errorf("firestore: cannot set type %s to %s", v.Type(), typeString(vproto)) + } + + val := vproto.ValueType + // A Null value sets anything nullable to nil, and has no effect + // on anything else. + if _, ok := val.(*pb.Value_NullValue); ok { + switch v.Kind() { + case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: + v.Set(reflect.Zero(v.Type())) + } + return nil + } + + // Handle special types first. + switch v.Type() { + case typeOfByteSlice: + x, ok := val.(*pb.Value_BytesValue) + if !ok { + return typeErr() + } + v.SetBytes(x.BytesValue) + return nil + + case typeOfGoTime: + x, ok := val.(*pb.Value_TimestampValue) + if !ok { + return typeErr() + } + t, err := ptypes.Timestamp(x.TimestampValue) + if err != nil { + return err + } + v.Set(reflect.ValueOf(t)) + return nil + + case typeOfProtoTimestamp: + x, ok := val.(*pb.Value_TimestampValue) + if !ok { + return typeErr() + } + v.Set(reflect.ValueOf(x.TimestampValue)) + return nil + + case typeOfLatLng: + x, ok := val.(*pb.Value_GeoPointValue) + if !ok { + return typeErr() + } + v.Set(reflect.ValueOf(x.GeoPointValue)) + return nil + + case typeOfDocumentRef: + x, ok := val.(*pb.Value_ReferenceValue) + if !ok { + return typeErr() + } + dr, err := pathToDoc(x.ReferenceValue, c) + if err != nil { + return err + } + v.Set(reflect.ValueOf(dr)) + return nil + } + + switch v.Kind() { + case reflect.Bool: + x, ok := val.(*pb.Value_BooleanValue) + if !ok { + return typeErr() + } + v.SetBool(x.BooleanValue) + + case reflect.String: + x, ok := val.(*pb.Value_StringValue) + if !ok { + return typeErr() + } + v.SetString(x.StringValue) + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + var i int64 + switch x := val.(type) { + case *pb.Value_IntegerValue: + i = x.IntegerValue + case *pb.Value_DoubleValue: + f := x.DoubleValue + i = int64(f) + if float64(i) != f { + return fmt.Errorf("firestore: float %f does not fit into %s", f, v.Type()) + } + default: + return typeErr() + } + if v.OverflowInt(i) { + return overflowErr(v, i) + } + v.SetInt(i) + + case reflect.Uint8, reflect.Uint16, reflect.Uint32: + var u uint64 + switch x := val.(type) { + case *pb.Value_IntegerValue: + u = uint64(x.IntegerValue) + case *pb.Value_DoubleValue: + f := x.DoubleValue + u = uint64(f) + if float64(u) != f { + return fmt.Errorf("firestore: float %f does not fit into %s", f, v.Type()) + } + default: + return typeErr() + } + if v.OverflowUint(u) { + return overflowErr(v, u) + } + v.SetUint(u) + + case reflect.Float32, reflect.Float64: + var f float64 + switch x := val.(type) { + case *pb.Value_DoubleValue: + f = x.DoubleValue + case *pb.Value_IntegerValue: + f = float64(x.IntegerValue) + if int64(f) != x.IntegerValue { + return overflowErr(v, x.IntegerValue) + } + default: + return typeErr() + } + if v.OverflowFloat(f) { + return overflowErr(v, f) + } + v.SetFloat(f) + + case reflect.Slice: + x, ok := val.(*pb.Value_ArrayValue) + if !ok { + return typeErr() + } + vals := x.ArrayValue.Values + vlen := v.Len() + xlen := len(vals) + // Make a slice of the right size, avoiding allocation if possible. + switch { + case vlen < xlen: + v.Set(reflect.MakeSlice(v.Type(), xlen, xlen)) + case vlen > xlen: + v.SetLen(xlen) + } + return populateRepeated(v, vals, xlen, c) + + case reflect.Array: + x, ok := val.(*pb.Value_ArrayValue) + if !ok { + return typeErr() + } + vals := x.ArrayValue.Values + xlen := len(vals) + vlen := v.Len() + minlen := vlen + // Set extra elements to their zero value. + if vlen > xlen { + z := reflect.Zero(v.Type().Elem()) + for i := xlen; i < vlen; i++ { + v.Index(i).Set(z) + } + minlen = xlen + } + return populateRepeated(v, vals, minlen, c) + + case reflect.Map: + x, ok := val.(*pb.Value_MapValue) + if !ok { + return typeErr() + } + return populateMap(v, x.MapValue.Fields, c) + + case reflect.Ptr: + // If the pointer is nil, set it to a zero value. + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + return setReflectFromProtoValue(v.Elem(), vproto, c) + + case reflect.Struct: + x, ok := val.(*pb.Value_MapValue) + if !ok { + return typeErr() + } + return populateStruct(v, x.MapValue.Fields, c) + + case reflect.Interface: + if v.NumMethod() == 0 { // empty interface + // If v holds a pointer, set the pointer. + if !v.IsNil() && v.Elem().Kind() == reflect.Ptr { + return setReflectFromProtoValue(v.Elem(), vproto, c) + } + // Otherwise, create a fresh value. + x, err := createFromProtoValue(vproto, c) + if err != nil { + return err + } + v.Set(reflect.ValueOf(x)) + return nil + } + // Any other kind of interface is an error. + fallthrough + + default: + return fmt.Errorf("firestore: cannot set type %s", v.Type()) + } + return nil +} + +// populateRepeated sets the first n elements of vr, which must be a slice or +// array, to the corresponding elements of vals. +func populateRepeated(vr reflect.Value, vals []*pb.Value, n int, c *Client) error { + for i := 0; i < n; i++ { + if err := setReflectFromProtoValue(vr.Index(i), vals[i], c); err != nil { + return err + } + } + return nil +} + +// populateMap sets the elements of vm, which must be a map, from the +// corresponding elements of pm. +// +// Since a map value is not settable, this function always creates a new +// element for each corresponding map key. Existing values of vm are +// overwritten. This happens even if the map value is something like a pointer +// to a struct, where we could in theory populate the existing struct value +// instead of discarding it. This behavior matches encoding/json. +func populateMap(vm reflect.Value, pm map[string]*pb.Value, c *Client) error { + t := vm.Type() + if t.Key().Kind() != reflect.String { + return errors.New("firestore: map key type is not string") + } + if vm.IsNil() { + vm.Set(reflect.MakeMap(t)) + } + et := t.Elem() + for k, vproto := range pm { + el := reflect.New(et).Elem() + if err := setReflectFromProtoValue(el, vproto, c); err != nil { + return err + } + vm.SetMapIndex(reflect.ValueOf(k), el) + } + return nil +} + +// createMapFromValueMap creates a fresh map and populates it with pm. +func createMapFromValueMap(pm map[string]*pb.Value, c *Client) (map[string]interface{}, error) { + m := map[string]interface{}{} + for k, pv := range pm { + v, err := createFromProtoValue(pv, c) + if err != nil { + return nil, err + } + m[k] = v + } + return m, nil +} + +// populateStruct sets the fields of vs, which must be a struct, from +// the matching elements of pm. +func populateStruct(vs reflect.Value, pm map[string]*pb.Value, c *Client) error { + fields, err := fieldCache.Fields(vs.Type()) + if err != nil { + return err + } + for k, vproto := range pm { + f := fields.Match(k) + if f == nil { + continue + } + if err := setReflectFromProtoValue(vs.FieldByIndex(f.Index), vproto, c); err != nil { + return fmt.Errorf("%s.%s: %v", vs.Type(), f.Name, err) + } + } + return nil +} + +func createFromProtoValue(vproto *pb.Value, c *Client) (interface{}, error) { + switch v := vproto.ValueType.(type) { + case *pb.Value_NullValue: + return nil, nil + case *pb.Value_BooleanValue: + return v.BooleanValue, nil + case *pb.Value_IntegerValue: + return v.IntegerValue, nil + case *pb.Value_DoubleValue: + return v.DoubleValue, nil + case *pb.Value_TimestampValue: + return ptypes.Timestamp(v.TimestampValue) + case *pb.Value_StringValue: + return v.StringValue, nil + case *pb.Value_BytesValue: + return v.BytesValue, nil + case *pb.Value_ReferenceValue: + return pathToDoc(v.ReferenceValue, c) + case *pb.Value_GeoPointValue: + return v.GeoPointValue, nil + + case *pb.Value_ArrayValue: + vals := v.ArrayValue.Values + ret := make([]interface{}, len(vals)) + for i, v := range vals { + r, err := createFromProtoValue(v, c) + if err != nil { + return nil, err + } + ret[i] = r + } + return ret, nil + + case *pb.Value_MapValue: + fields := v.MapValue.Fields + ret := make(map[string]interface{}, len(fields)) + for k, v := range fields { + r, err := createFromProtoValue(v, c) + if err != nil { + return nil, err + } + ret[k] = r + } + return ret, nil + + default: + return nil, fmt.Errorf("firestore: unknown value type %T", v) + } +} + +// Convert a document path to a DocumentRef. +func pathToDoc(docPath string, c *Client) (*DocumentRef, error) { + projID, dbID, docIDs, err := parseDocumentPath(docPath) + if err != nil { + return nil, err + } + parentResourceName := fmt.Sprintf("projects/%s/databases/%s", projID, dbID) + _, doc := c.idsToRef(docIDs, parentResourceName) + return doc, nil +} + +// A document path should be of the form "projects/P/databases/D/documents/coll1/doc1/coll2/doc2/...". +func parseDocumentPath(path string) (projectID, databaseID string, docPath []string, err error) { + parts := strings.Split(path, "/") + if len(parts) < 6 || parts[0] != "projects" || parts[2] != "databases" || parts[4] != "documents" { + return "", "", nil, fmt.Errorf("firestore: malformed document path %q", path) + } + docp := parts[5:] + if len(docp)%2 != 0 { + return "", "", nil, fmt.Errorf("firestore: path %q refers to collection, not document", path) + } + return parts[1], parts[3], docp, nil +} + +func typeString(vproto *pb.Value) string { + switch vproto.ValueType.(type) { + case *pb.Value_NullValue: + return "null" + case *pb.Value_BooleanValue: + return "bool" + case *pb.Value_IntegerValue: + return "int" + case *pb.Value_DoubleValue: + return "float" + case *pb.Value_TimestampValue: + return "timestamp" + case *pb.Value_StringValue: + return "string" + case *pb.Value_BytesValue: + return "bytes" + case *pb.Value_ReferenceValue: + return "reference" + case *pb.Value_GeoPointValue: + return "GeoPoint" + case *pb.Value_MapValue: + return "map" + case *pb.Value_ArrayValue: + return "array" + default: + return "" + } +} + +func overflowErr(v reflect.Value, x interface{}) error { + return fmt.Errorf("firestore: value %v overflows type %s", x, v.Type()) +} diff --git a/vendor/cloud.google.com/go/firestore/from_value_test.go b/vendor/cloud.google.com/go/firestore/from_value_test.go new file mode 100644 index 000000000..00937956e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/from_value_test.go @@ -0,0 +1,549 @@ +// Copyright 2017 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 firestore + +import ( + "encoding/json" + "fmt" + "io" + "math" + "reflect" + "strings" + "testing" + "time" + + ts "github.com/golang/protobuf/ptypes/timestamp" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/genproto/googleapis/type/latlng" +) + +var ( + tm = time.Date(2016, 12, 25, 0, 0, 0, 123456789, time.UTC) + ll = &latlng.LatLng{Latitude: 20, Longitude: 30} + ptm = &ts.Timestamp{Seconds: 12345, Nanos: 67890} +) + +func TestCreateFromProtoValue(t *testing.T) { + for _, test := range []struct { + in *pb.Value + want interface{} + }{ + {in: nullValue, want: nil}, + {in: boolval(true), want: true}, + {in: intval(3), want: int64(3)}, + {in: floatval(1.5), want: 1.5}, + {in: strval("str"), want: "str"}, + {in: tsval(tm), want: tm}, + { + in: bytesval([]byte{1, 2}), + want: []byte{1, 2}, + }, + { + in: &pb.Value{ValueType: &pb.Value_GeoPointValue{ll}}, + want: ll, + }, + { + in: arrayval(intval(1), intval(2)), + want: []interface{}{int64(1), int64(2)}, + }, + { + in: arrayval(), + want: []interface{}{}, + }, + { + in: mapval(map[string]*pb.Value{"a": intval(1), "b": intval(2)}), + want: map[string]interface{}{"a": int64(1), "b": int64(2)}, + }, + { + in: mapval(map[string]*pb.Value{}), + want: map[string]interface{}{}, + }, + { + in: refval("projects/P/databases/D/documents/c/d"), + want: &DocumentRef{ + ID: "d", + Parent: &CollectionRef{ + ID: "c", + parentPath: "projects/P/databases/D", + Path: "projects/P/databases/D/documents/c", + Query: Query{collectionID: "c", parentPath: "projects/P/databases/D"}, + }, + Path: "projects/P/databases/D/documents/c/d", + }, + }, + } { + got, err := createFromProtoValue(test.in, nil) + if err != nil { + t.Errorf("%v: %v", test.in, err) + continue + } + if !testEqual(got, test.want) { + t.Errorf("%+v:\ngot\n%#v\nwant\n%#v", test.in, got, test.want) + } + } +} + +func TestSetFromProtoValue(t *testing.T) { + testSetFromProtoValue(t, "json", jsonTester{}) + testSetFromProtoValue(t, "firestore", protoTester{}) +} + +func testSetFromProtoValue(t *testing.T, prefix string, r tester) { + pi := newfloat(7) + s := []float64{7, 8} + ar1 := [1]float64{7} + ar2 := [2]float64{7, 8} + ar3 := [3]float64{7, 8, 9} + mf := map[string]float64{"a": 7} + + type T struct { + I **float64 + J float64 + } + + one := newfloat(1) + six := newfloat(6) + st := []*T{{I: &six}, nil, {I: &six, J: 7}} + vs := interface{}(T{J: 1}) + vm := interface{}(map[string]float64{"i": 1}) + var ( + i int + i8 int8 + i16 int16 + i32 int32 + i64 int64 + u8 uint8 + u16 uint16 + u32 uint32 + b bool + ll *latlng.LatLng + mi map[string]interface{} + ms map[string]T + ) + + for i, test := range []struct { + in interface{} + val interface{} + want interface{} + }{ + {&pi, r.Null(), (*float64)(nil)}, + {pi, r.Float(1), 1.0}, + {&s, r.Null(), ([]float64)(nil)}, + {&s, r.Array(r.Float(1), r.Float(2)), []float64{1, 2}}, + {&ar1, r.Array(r.Float(1), r.Float(2)), [1]float64{1}}, + {&ar2, r.Array(r.Float(1), r.Float(2)), [2]float64{1, 2}}, + {&ar3, r.Array(r.Float(1), r.Float(2)), [3]float64{1, 2, 0}}, + {&mf, r.Null(), (map[string]float64)(nil)}, + {&mf, r.Map("a", r.Float(1), "b", r.Float(2)), map[string]float64{"a": 1, "b": 2}}, + {&st, r.Array( + r.Null(), // overwrites st[0] with nil + r.Map("i", r.Float(1)), // sets st[1] to a new struct + r.Map("i", r.Float(2)), // modifies st[2] + ), + []*T{nil, {I: &one}, {I: &six, J: 7}}}, + {&mi, r.Map("a", r.Float(1), "b", r.Float(2)), map[string]interface{}{"a": 1.0, "b": 2.0}}, + {&ms, r.Map("a", r.Map("j", r.Float(1))), map[string]T{"a": {J: 1}}}, + {&vs, r.Map("i", r.Float(2)), map[string]interface{}{"i": 2.0}}, + {&vm, r.Map("i", r.Float(2)), map[string]interface{}{"i": 2.0}}, + {&ll, r.Null(), (*latlng.LatLng)(nil)}, + {&i, r.Int(1), int(1)}, + {&i8, r.Int(1), int8(1)}, + {&i16, r.Int(1), int16(1)}, + {&i32, r.Int(1), int32(1)}, + {&i64, r.Int(1), int64(1)}, + {&u8, r.Int(1), uint8(1)}, + {&u16, r.Int(1), uint16(1)}, + {&u32, r.Int(1), uint32(1)}, + {&b, r.Bool(true), true}, + {&i, r.Float(1), int(1)}, // can put a float with no fractional part into an int + {pi, r.Int(1), float64(1)}, // can put an int into a float + } { + if err := r.Set(test.in, test.val); err != nil { + t.Errorf("%s: #%d: got error %v", prefix, i, err) + continue + } + got := reflect.ValueOf(test.in).Elem().Interface() + if !testEqual(got, test.want) { + t.Errorf("%s: #%d, %v:\ngot\n%+v (%T)\nwant\n%+v (%T)", + prefix, i, test.val, got, got, test.want, test.want) + } + } +} + +func TestSetFromProtoValueNoJSON(t *testing.T) { + // Test code paths that we cannot compare to JSON. + var ( + bs []byte + tmi time.Time + lli *latlng.LatLng + tmp *ts.Timestamp + ) + bytes := []byte{1, 2, 3} + + for i, test := range []struct { + in interface{} + val *pb.Value + want interface{} + }{ + {&bs, bytesval(bytes), bytes}, + {&tmi, tsval(tm), tm}, + {&tmp, &pb.Value{ValueType: &pb.Value_TimestampValue{ptm}}, ptm}, + {&lli, geoval(ll), ll}, + } { + if err := setFromProtoValue(test.in, test.val, &Client{}); err != nil { + t.Errorf("#%d: got error %v", i, err) + continue + } + got := reflect.ValueOf(test.in).Elem().Interface() + if !testEqual(got, test.want) { + t.Errorf("#%d, %v:\ngot\n%+v (%T)\nwant\n%+v (%T)", + i, test.val, got, got, test.want, test.want) + } + } +} + +func TestSetFromProtoValueErrors(t *testing.T) { + c := &Client{} + ival := intval(3) + for i, test := range []struct { + in interface{} + val *pb.Value + }{ + {3, ival}, // not a pointer + {new(int8), intval(128)}, // int overflow + {new(uint8), intval(256)}, // uint overflow + {new(float32), floatval(2 * math.MaxFloat32)}, // float overflow + {new(uint), ival}, // cannot set type + {new(uint64), ival}, // cannot set type + {new(io.Reader), ival}, // cannot set type + {new(map[int]int), + mapval(map[string]*pb.Value{"x": ival})}, // map key type is not string + // the rest are all type mismatches + {new(bool), ival}, + {new(*latlng.LatLng), ival}, + {new(time.Time), ival}, + {new(string), ival}, + {new([]byte), ival}, + {new([]int), ival}, + {new([1]int), ival}, + {new(map[string]int), ival}, + {new(*bool), ival}, + {new(struct{}), ival}, + {new(int), floatval(2.5)}, // float must be integral + {new(uint16), intval(-1)}, // uint cannot be negative + {new(int16), floatval(math.MaxFloat32)}, // doesn't fit + {new(uint16), floatval(math.MaxFloat32)}, // doesn't fit + {new(float32), + &pb.Value{ValueType: &pb.Value_IntegerValue{math.MaxInt64}}}, // overflow + } { + err := setFromProtoValue(test.in, test.val, c) + if err == nil { + t.Errorf("#%d: %v, %v: got nil, want error", i, test.in, test.val) + } + } +} + +func TestSetFromProtoValuePointers(t *testing.T) { + // Verify that pointers are set, instead of being replaced. + // Confirm that the behavior matches encoding/json. + testSetPointer(t, "json", jsonTester{}) + testSetPointer(t, "firestore", protoTester{&Client{}}) +} + +func testSetPointer(t *testing.T, prefix string, r tester) { + // If an interface{} holds a pointer, the pointer is set. + + set := func(x, val interface{}) { + if err := r.Set(x, val); err != nil { + t.Fatalf("%s: set(%v, %v): %v", prefix, x, val, err) + } + } + p := new(float64) + var st struct { + I interface{} + } + + // A pointer in a slice of interface{} is set. + s := []interface{}{p} + set(&s, r.Array(r.Float(1))) + if s[0] != p { + t.Errorf("%s: pointers not identical", prefix) + } + if *p != 1 { + t.Errorf("%s: got %f, want 1", prefix, *p) + } + // Setting a null will set the pointer to nil. + set(&s, r.Array(r.Null())) + if got := s[0]; got != nil { + t.Errorf("%s: got %v, want null", prefix, got) + } + + // It doesn't matter how deep the pointers nest. + p = new(float64) + p2 := &p + p3 := &p2 + s = []interface{}{p3} + set(&s, r.Array(r.Float(1))) + if s[0] != p3 { + t.Errorf("%s: pointers not identical", prefix) + } + if *p != 1 { + t.Errorf("%s: got %f, want 1", prefix, *p) + } + + // A pointer in an interface{} field is set. + p = new(float64) + st.I = p + set(&st, r.Map("i", r.Float(1))) + if st.I != p { + t.Errorf("%s: pointers not identical", prefix) + } + if *p != 1 { + t.Errorf("%s: got %f, want 1", prefix, *p) + } + // Setting a null will set the pointer to nil. + set(&st, r.Map("i", r.Null())) + if got := st.I; got != nil { + t.Errorf("%s: got %v, want null", prefix, got) + } + + // A pointer to a slice (instead of to float64) is set. + psi := &[]float64{7, 8, 9} + st.I = psi + set(&st, r.Map("i", r.Array(r.Float(1)))) + if st.I != psi { + t.Errorf("%s: pointers not identical", prefix) + } + // The slice itself should be truncated and filled, not replaced. + if got, want := cap(*psi), 3; got != want { + t.Errorf("cap: got %d, want %d", got, want) + } + if want := &[]float64{1}; !testEqual(st.I, want) { + t.Errorf("got %+v, want %+v", st.I, want) + } + + // A pointer to a map is set. + pmf := &map[string]float64{"a": 7, "b": 8} + st.I = pmf + set(&st, r.Map("i", r.Map("a", r.Float(1)))) + if st.I != pmf { + t.Errorf("%s: pointers not identical", prefix) + } + if want := map[string]float64{"a": 1, "b": 8}; !testEqual(*pmf, want) { + t.Errorf("%s: got %+v, want %+v", prefix, *pmf, want) + } + + // Maps are different: since the map values aren't addressable, they + // are always discarded, even if the map element type is not interface{}. + + // A map's values are discarded if the value type is a pointer type. + p = new(float64) + m := map[string]*float64{"i": p} + set(&m, r.Map("i", r.Float(1))) + if m["i"] == p { + t.Errorf("%s: pointers are identical", prefix) + } + if got, want := *m["i"], 1.0; got != want { + t.Errorf("%s: got %v, want %v", prefix, got, want) + } + // A map's values are discarded if the value type is interface{}. + p = new(float64) + m2 := map[string]interface{}{"i": p} + set(&m2, r.Map("i", r.Float(1))) + if m2["i"] == p { + t.Errorf("%s: pointers are identical", prefix) + } + if got, want := m2["i"].(float64), 1.0; got != want { + t.Errorf("%s: got %f, want %f", prefix, got, want) + } +} + +// An interface for setting and building values, to facilitate comparing firestore deserialization +// with encoding/json. +type tester interface { + Set(x, val interface{}) error + Null() interface{} + Int(int) interface{} + Float(float64) interface{} + Bool(bool) interface{} + Array(...interface{}) interface{} + Map(keysvals ...interface{}) interface{} +} + +type protoTester struct { + c *Client +} + +func (p protoTester) Set(x, val interface{}) error { return setFromProtoValue(x, val.(*pb.Value), p.c) } +func (protoTester) Null() interface{} { return nullValue } +func (protoTester) Int(i int) interface{} { return intval(i) } +func (protoTester) Float(f float64) interface{} { return floatval(f) } +func (protoTester) Bool(b bool) interface{} { return boolval(b) } + +func (protoTester) Array(els ...interface{}) interface{} { + var s []*pb.Value + for _, el := range els { + s = append(s, el.(*pb.Value)) + } + return arrayval(s...) +} + +func (protoTester) Map(keysvals ...interface{}) interface{} { + m := map[string]*pb.Value{} + for i := 0; i < len(keysvals); i += 2 { + m[keysvals[i].(string)] = keysvals[i+1].(*pb.Value) + } + return mapval(m) +} + +type jsonTester struct{} + +func (jsonTester) Set(x, val interface{}) error { return json.Unmarshal([]byte(val.(string)), x) } +func (jsonTester) Null() interface{} { return "null" } +func (jsonTester) Int(i int) interface{} { return fmt.Sprint(i) } +func (jsonTester) Float(f float64) interface{} { return fmt.Sprint(f) } + +func (jsonTester) Bool(b bool) interface{} { + if b { + return "true" + } + return "false" +} + +func (jsonTester) Array(els ...interface{}) interface{} { + var s []string + for _, el := range els { + s = append(s, el.(string)) + } + return "[" + strings.Join(s, ", ") + "]" +} + +func (jsonTester) Map(keysvals ...interface{}) interface{} { + var s []string + for i := 0; i < len(keysvals); i += 2 { + s = append(s, fmt.Sprintf("%q: %v", keysvals[i], keysvals[i+1])) + } + return "{" + strings.Join(s, ", ") + "}" +} + +func newfloat(f float64) *float64 { + p := new(float64) + *p = f + return p +} + +func TestParseDocumentPath(t *testing.T) { + for _, test := range []struct { + in string + pid, dbid string + dpath []string + }{ + {"projects/foo-bar/databases/db2/documents/c1/d1", + "foo-bar", "db2", []string{"c1", "d1"}}, + {"projects/P/databases/D/documents/c1/d1/c2/d2", + "P", "D", []string{"c1", "d1", "c2", "d2"}}, + } { + gotPid, gotDbid, gotDpath, err := parseDocumentPath(test.in) + if err != nil { + t.Fatal(err) + } + if got, want := gotPid, test.pid; got != want { + t.Errorf("project ID: got %q, want %q", got, want) + } + if got, want := gotDbid, test.dbid; got != want { + t.Errorf("db ID: got %q, want %q", got, want) + } + if got, want := gotDpath, test.dpath; !testEqual(got, want) { + t.Errorf("doc path: got %q, want %q", got, want) + } + } +} + +func TestParseDocumentPathErrors(t *testing.T) { + for _, badPath := range []string{ + "projects/P/databases/D/documents/c", // collection path + "/projects/P/databases/D/documents/c/d", // initial slash + "projects/P/databases/D/c/d", // missing "documents" + "project/P/database/D/document/c/d", + } { + // Every prefix of a bad path is also bad. + for i := 0; i <= len(badPath); i++ { + in := badPath[:i] + _, _, _, err := parseDocumentPath(in) + if err == nil { + t.Errorf("%q: got nil, want error", in) + } + } + } +} + +func TestPathToDoc(t *testing.T) { + c := &Client{} + path := "projects/P/databases/D/documents/c1/d1/c2/d2" + got, err := pathToDoc(path, c) + if err != nil { + t.Fatal(err) + } + want := &DocumentRef{ + ID: "d2", + Path: "projects/P/databases/D/documents/c1/d1/c2/d2", + Parent: &CollectionRef{ + ID: "c2", + parentPath: "projects/P/databases/D/documents/c1/d1", + Path: "projects/P/databases/D/documents/c1/d1/c2", + c: c, + Query: Query{c: c, collectionID: "c2", parentPath: "projects/P/databases/D/documents/c1/d1"}, + Parent: &DocumentRef{ + ID: "d1", + Path: "projects/P/databases/D/documents/c1/d1", + Parent: &CollectionRef{ + ID: "c1", + c: c, + parentPath: "projects/P/databases/D", + Path: "projects/P/databases/D/documents/c1", + Parent: nil, + Query: Query{c: c, collectionID: "c1", parentPath: "projects/P/databases/D"}, + }, + }, + }, + } + if !testEqual(got, want) { + t.Errorf("\ngot %+v\nwant %+v", got, want) + } +} + +func TestTypeString(t *testing.T) { + for _, test := range []struct { + in *pb.Value + want string + }{ + {nullValue, "null"}, + {intval(1), "int"}, + {floatval(1), "float"}, + {boolval(true), "bool"}, + {strval(""), "string"}, + {tsval(tm), "timestamp"}, + {geoval(ll), "GeoPoint"}, + {bytesval(nil), "bytes"}, + {refval(""), "reference"}, + {arrayval(nil), "array"}, + {mapval(nil), "map"}, + } { + got := typeString(test.in) + if got != test.want { + t.Errorf("%+v: got %q, want %q", test.in, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/firestore/genproto/test.pb.go b/vendor/cloud.google.com/go/firestore/genproto/test.pb.go new file mode 100644 index 000000000..1c8cb4ad9 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/genproto/test.pb.go @@ -0,0 +1,1853 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: test.proto + +package tests + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import timestamp "github.com/golang/protobuf/ptypes/timestamp" +import v1beta1 "google.golang.org/genproto/googleapis/firestore/v1beta1" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type DocChange_Kind int32 + +const ( + DocChange_KIND_UNSPECIFIED DocChange_Kind = 0 + DocChange_ADDED DocChange_Kind = 1 + DocChange_REMOVED DocChange_Kind = 2 + DocChange_MODIFIED DocChange_Kind = 3 +) + +var DocChange_Kind_name = map[int32]string{ + 0: "KIND_UNSPECIFIED", + 1: "ADDED", + 2: "REMOVED", + 3: "MODIFIED", +} +var DocChange_Kind_value = map[string]int32{ + "KIND_UNSPECIFIED": 0, + "ADDED": 1, + "REMOVED": 2, + "MODIFIED": 3, +} + +func (x DocChange_Kind) String() string { + return proto.EnumName(DocChange_Kind_name, int32(x)) +} +func (DocChange_Kind) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{19, 0} +} + +// A collection of tests. +type TestSuite struct { + Tests []*Test `protobuf:"bytes,1,rep,name=tests,proto3" json:"tests,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TestSuite) Reset() { *m = TestSuite{} } +func (m *TestSuite) String() string { return proto.CompactTextString(m) } +func (*TestSuite) ProtoMessage() {} +func (*TestSuite) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{0} +} +func (m *TestSuite) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TestSuite.Unmarshal(m, b) +} +func (m *TestSuite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TestSuite.Marshal(b, m, deterministic) +} +func (dst *TestSuite) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestSuite.Merge(dst, src) +} +func (m *TestSuite) XXX_Size() int { + return xxx_messageInfo_TestSuite.Size(m) +} +func (m *TestSuite) XXX_DiscardUnknown() { + xxx_messageInfo_TestSuite.DiscardUnknown(m) +} + +var xxx_messageInfo_TestSuite proto.InternalMessageInfo + +func (m *TestSuite) GetTests() []*Test { + if m != nil { + return m.Tests + } + return nil +} + +// A Test describes a single client method call and its expected result. +type Test struct { + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + // Types that are valid to be assigned to Test: + // *Test_Get + // *Test_Create + // *Test_Set + // *Test_Update + // *Test_UpdatePaths + // *Test_Delete + // *Test_Query + // *Test_Listen + Test isTest_Test `protobuf_oneof:"test"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Test) Reset() { *m = Test{} } +func (m *Test) String() string { return proto.CompactTextString(m) } +func (*Test) ProtoMessage() {} +func (*Test) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{1} +} +func (m *Test) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Test.Unmarshal(m, b) +} +func (m *Test) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Test.Marshal(b, m, deterministic) +} +func (dst *Test) XXX_Merge(src proto.Message) { + xxx_messageInfo_Test.Merge(dst, src) +} +func (m *Test) XXX_Size() int { + return xxx_messageInfo_Test.Size(m) +} +func (m *Test) XXX_DiscardUnknown() { + xxx_messageInfo_Test.DiscardUnknown(m) +} + +var xxx_messageInfo_Test proto.InternalMessageInfo + +type isTest_Test interface { + isTest_Test() +} + +type Test_Get struct { + Get *GetTest `protobuf:"bytes,2,opt,name=get,proto3,oneof"` +} +type Test_Create struct { + Create *CreateTest `protobuf:"bytes,3,opt,name=create,proto3,oneof"` +} +type Test_Set struct { + Set *SetTest `protobuf:"bytes,4,opt,name=set,proto3,oneof"` +} +type Test_Update struct { + Update *UpdateTest `protobuf:"bytes,5,opt,name=update,proto3,oneof"` +} +type Test_UpdatePaths struct { + UpdatePaths *UpdatePathsTest `protobuf:"bytes,6,opt,name=update_paths,json=updatePaths,proto3,oneof"` +} +type Test_Delete struct { + Delete *DeleteTest `protobuf:"bytes,7,opt,name=delete,proto3,oneof"` +} +type Test_Query struct { + Query *QueryTest `protobuf:"bytes,8,opt,name=query,proto3,oneof"` +} +type Test_Listen struct { + Listen *ListenTest `protobuf:"bytes,9,opt,name=listen,proto3,oneof"` +} + +func (*Test_Get) isTest_Test() {} +func (*Test_Create) isTest_Test() {} +func (*Test_Set) isTest_Test() {} +func (*Test_Update) isTest_Test() {} +func (*Test_UpdatePaths) isTest_Test() {} +func (*Test_Delete) isTest_Test() {} +func (*Test_Query) isTest_Test() {} +func (*Test_Listen) isTest_Test() {} + +func (m *Test) GetTest() isTest_Test { + if m != nil { + return m.Test + } + return nil +} + +func (m *Test) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Test) GetGet() *GetTest { + if x, ok := m.GetTest().(*Test_Get); ok { + return x.Get + } + return nil +} + +func (m *Test) GetCreate() *CreateTest { + if x, ok := m.GetTest().(*Test_Create); ok { + return x.Create + } + return nil +} + +func (m *Test) GetSet() *SetTest { + if x, ok := m.GetTest().(*Test_Set); ok { + return x.Set + } + return nil +} + +func (m *Test) GetUpdate() *UpdateTest { + if x, ok := m.GetTest().(*Test_Update); ok { + return x.Update + } + return nil +} + +func (m *Test) GetUpdatePaths() *UpdatePathsTest { + if x, ok := m.GetTest().(*Test_UpdatePaths); ok { + return x.UpdatePaths + } + return nil +} + +func (m *Test) GetDelete() *DeleteTest { + if x, ok := m.GetTest().(*Test_Delete); ok { + return x.Delete + } + return nil +} + +func (m *Test) GetQuery() *QueryTest { + if x, ok := m.GetTest().(*Test_Query); ok { + return x.Query + } + return nil +} + +func (m *Test) GetListen() *ListenTest { + if x, ok := m.GetTest().(*Test_Listen); ok { + return x.Listen + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Test) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Test_OneofMarshaler, _Test_OneofUnmarshaler, _Test_OneofSizer, []interface{}{ + (*Test_Get)(nil), + (*Test_Create)(nil), + (*Test_Set)(nil), + (*Test_Update)(nil), + (*Test_UpdatePaths)(nil), + (*Test_Delete)(nil), + (*Test_Query)(nil), + (*Test_Listen)(nil), + } +} + +func _Test_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Test) + // test + switch x := m.Test.(type) { + case *Test_Get: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Get); err != nil { + return err + } + case *Test_Create: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Create); err != nil { + return err + } + case *Test_Set: + b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Set); err != nil { + return err + } + case *Test_Update: + b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Update); err != nil { + return err + } + case *Test_UpdatePaths: + b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.UpdatePaths); err != nil { + return err + } + case *Test_Delete: + b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Delete); err != nil { + return err + } + case *Test_Query: + b.EncodeVarint(8<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Query); err != nil { + return err + } + case *Test_Listen: + b.EncodeVarint(9<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Listen); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Test.Test has unexpected type %T", x) + } + return nil +} + +func _Test_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Test) + switch tag { + case 2: // test.get + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(GetTest) + err := b.DecodeMessage(msg) + m.Test = &Test_Get{msg} + return true, err + case 3: // test.create + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(CreateTest) + err := b.DecodeMessage(msg) + m.Test = &Test_Create{msg} + return true, err + case 4: // test.set + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(SetTest) + err := b.DecodeMessage(msg) + m.Test = &Test_Set{msg} + return true, err + case 5: // test.update + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(UpdateTest) + err := b.DecodeMessage(msg) + m.Test = &Test_Update{msg} + return true, err + case 6: // test.update_paths + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(UpdatePathsTest) + err := b.DecodeMessage(msg) + m.Test = &Test_UpdatePaths{msg} + return true, err + case 7: // test.delete + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(DeleteTest) + err := b.DecodeMessage(msg) + m.Test = &Test_Delete{msg} + return true, err + case 8: // test.query + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(QueryTest) + err := b.DecodeMessage(msg) + m.Test = &Test_Query{msg} + return true, err + case 9: // test.listen + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ListenTest) + err := b.DecodeMessage(msg) + m.Test = &Test_Listen{msg} + return true, err + default: + return false, nil + } +} + +func _Test_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Test) + // test + switch x := m.Test.(type) { + case *Test_Get: + s := proto.Size(x.Get) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Test_Create: + s := proto.Size(x.Create) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Test_Set: + s := proto.Size(x.Set) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Test_Update: + s := proto.Size(x.Update) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Test_UpdatePaths: + s := proto.Size(x.UpdatePaths) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Test_Delete: + s := proto.Size(x.Delete) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Test_Query: + s := proto.Size(x.Query) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Test_Listen: + s := proto.Size(x.Listen) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Call to the DocumentRef.Get method. +type GetTest struct { + // The path of the doc, e.g. "projects/projectID/databases/(default)/documents/C/d" + DocRefPath string `protobuf:"bytes,1,opt,name=doc_ref_path,json=docRefPath,proto3" json:"doc_ref_path,omitempty"` + // The request that the call should send to the Firestore service. + Request *v1beta1.GetDocumentRequest `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetTest) Reset() { *m = GetTest{} } +func (m *GetTest) String() string { return proto.CompactTextString(m) } +func (*GetTest) ProtoMessage() {} +func (*GetTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{2} +} +func (m *GetTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetTest.Unmarshal(m, b) +} +func (m *GetTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetTest.Marshal(b, m, deterministic) +} +func (dst *GetTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTest.Merge(dst, src) +} +func (m *GetTest) XXX_Size() int { + return xxx_messageInfo_GetTest.Size(m) +} +func (m *GetTest) XXX_DiscardUnknown() { + xxx_messageInfo_GetTest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTest proto.InternalMessageInfo + +func (m *GetTest) GetDocRefPath() string { + if m != nil { + return m.DocRefPath + } + return "" +} + +func (m *GetTest) GetRequest() *v1beta1.GetDocumentRequest { + if m != nil { + return m.Request + } + return nil +} + +// Call to DocumentRef.Create. +type CreateTest struct { + // The path of the doc, e.g. "projects/projectID/databases/(default)/documents/C/d" + DocRefPath string `protobuf:"bytes,1,opt,name=doc_ref_path,json=docRefPath,proto3" json:"doc_ref_path,omitempty"` + // The data passed to Create, as JSON. The strings "Delete" and "ServerTimestamp" + // denote the two special sentinel values. Values that could be interpreted as integers + // (i.e. digit strings) should be treated as integers. + JsonData string `protobuf:"bytes,2,opt,name=json_data,json=jsonData,proto3" json:"json_data,omitempty"` + // The request that the call should generate. + Request *v1beta1.CommitRequest `protobuf:"bytes,3,opt,name=request,proto3" json:"request,omitempty"` + // If true, the call should result in an error without generating a request. + // If this is true, request should not be set. + IsError bool `protobuf:"varint,4,opt,name=is_error,json=isError,proto3" json:"is_error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateTest) Reset() { *m = CreateTest{} } +func (m *CreateTest) String() string { return proto.CompactTextString(m) } +func (*CreateTest) ProtoMessage() {} +func (*CreateTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{3} +} +func (m *CreateTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateTest.Unmarshal(m, b) +} +func (m *CreateTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateTest.Marshal(b, m, deterministic) +} +func (dst *CreateTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateTest.Merge(dst, src) +} +func (m *CreateTest) XXX_Size() int { + return xxx_messageInfo_CreateTest.Size(m) +} +func (m *CreateTest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateTest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateTest proto.InternalMessageInfo + +func (m *CreateTest) GetDocRefPath() string { + if m != nil { + return m.DocRefPath + } + return "" +} + +func (m *CreateTest) GetJsonData() string { + if m != nil { + return m.JsonData + } + return "" +} + +func (m *CreateTest) GetRequest() *v1beta1.CommitRequest { + if m != nil { + return m.Request + } + return nil +} + +func (m *CreateTest) GetIsError() bool { + if m != nil { + return m.IsError + } + return false +} + +// A call to DocumentRef.Set. +type SetTest struct { + DocRefPath string `protobuf:"bytes,1,opt,name=doc_ref_path,json=docRefPath,proto3" json:"doc_ref_path,omitempty"` + Option *SetOption `protobuf:"bytes,2,opt,name=option,proto3" json:"option,omitempty"` + JsonData string `protobuf:"bytes,3,opt,name=json_data,json=jsonData,proto3" json:"json_data,omitempty"` + Request *v1beta1.CommitRequest `protobuf:"bytes,4,opt,name=request,proto3" json:"request,omitempty"` + IsError bool `protobuf:"varint,5,opt,name=is_error,json=isError,proto3" json:"is_error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetTest) Reset() { *m = SetTest{} } +func (m *SetTest) String() string { return proto.CompactTextString(m) } +func (*SetTest) ProtoMessage() {} +func (*SetTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{4} +} +func (m *SetTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetTest.Unmarshal(m, b) +} +func (m *SetTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetTest.Marshal(b, m, deterministic) +} +func (dst *SetTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetTest.Merge(dst, src) +} +func (m *SetTest) XXX_Size() int { + return xxx_messageInfo_SetTest.Size(m) +} +func (m *SetTest) XXX_DiscardUnknown() { + xxx_messageInfo_SetTest.DiscardUnknown(m) +} + +var xxx_messageInfo_SetTest proto.InternalMessageInfo + +func (m *SetTest) GetDocRefPath() string { + if m != nil { + return m.DocRefPath + } + return "" +} + +func (m *SetTest) GetOption() *SetOption { + if m != nil { + return m.Option + } + return nil +} + +func (m *SetTest) GetJsonData() string { + if m != nil { + return m.JsonData + } + return "" +} + +func (m *SetTest) GetRequest() *v1beta1.CommitRequest { + if m != nil { + return m.Request + } + return nil +} + +func (m *SetTest) GetIsError() bool { + if m != nil { + return m.IsError + } + return false +} + +// A call to the form of DocumentRef.Update that represents the data as a map +// or dictionary. +type UpdateTest struct { + DocRefPath string `protobuf:"bytes,1,opt,name=doc_ref_path,json=docRefPath,proto3" json:"doc_ref_path,omitempty"` + Precondition *v1beta1.Precondition `protobuf:"bytes,2,opt,name=precondition,proto3" json:"precondition,omitempty"` + JsonData string `protobuf:"bytes,3,opt,name=json_data,json=jsonData,proto3" json:"json_data,omitempty"` + Request *v1beta1.CommitRequest `protobuf:"bytes,4,opt,name=request,proto3" json:"request,omitempty"` + IsError bool `protobuf:"varint,5,opt,name=is_error,json=isError,proto3" json:"is_error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdateTest) Reset() { *m = UpdateTest{} } +func (m *UpdateTest) String() string { return proto.CompactTextString(m) } +func (*UpdateTest) ProtoMessage() {} +func (*UpdateTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{5} +} +func (m *UpdateTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UpdateTest.Unmarshal(m, b) +} +func (m *UpdateTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UpdateTest.Marshal(b, m, deterministic) +} +func (dst *UpdateTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateTest.Merge(dst, src) +} +func (m *UpdateTest) XXX_Size() int { + return xxx_messageInfo_UpdateTest.Size(m) +} +func (m *UpdateTest) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateTest.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateTest proto.InternalMessageInfo + +func (m *UpdateTest) GetDocRefPath() string { + if m != nil { + return m.DocRefPath + } + return "" +} + +func (m *UpdateTest) GetPrecondition() *v1beta1.Precondition { + if m != nil { + return m.Precondition + } + return nil +} + +func (m *UpdateTest) GetJsonData() string { + if m != nil { + return m.JsonData + } + return "" +} + +func (m *UpdateTest) GetRequest() *v1beta1.CommitRequest { + if m != nil { + return m.Request + } + return nil +} + +func (m *UpdateTest) GetIsError() bool { + if m != nil { + return m.IsError + } + return false +} + +// A call to the form of DocumentRef.Update that represents the data as a list +// of field paths and their values. +type UpdatePathsTest struct { + DocRefPath string `protobuf:"bytes,1,opt,name=doc_ref_path,json=docRefPath,proto3" json:"doc_ref_path,omitempty"` + Precondition *v1beta1.Precondition `protobuf:"bytes,2,opt,name=precondition,proto3" json:"precondition,omitempty"` + // parallel sequences: field_paths[i] corresponds to json_values[i] + FieldPaths []*FieldPath `protobuf:"bytes,3,rep,name=field_paths,json=fieldPaths,proto3" json:"field_paths,omitempty"` + JsonValues []string `protobuf:"bytes,4,rep,name=json_values,json=jsonValues,proto3" json:"json_values,omitempty"` + Request *v1beta1.CommitRequest `protobuf:"bytes,5,opt,name=request,proto3" json:"request,omitempty"` + IsError bool `protobuf:"varint,6,opt,name=is_error,json=isError,proto3" json:"is_error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdatePathsTest) Reset() { *m = UpdatePathsTest{} } +func (m *UpdatePathsTest) String() string { return proto.CompactTextString(m) } +func (*UpdatePathsTest) ProtoMessage() {} +func (*UpdatePathsTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{6} +} +func (m *UpdatePathsTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UpdatePathsTest.Unmarshal(m, b) +} +func (m *UpdatePathsTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UpdatePathsTest.Marshal(b, m, deterministic) +} +func (dst *UpdatePathsTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdatePathsTest.Merge(dst, src) +} +func (m *UpdatePathsTest) XXX_Size() int { + return xxx_messageInfo_UpdatePathsTest.Size(m) +} +func (m *UpdatePathsTest) XXX_DiscardUnknown() { + xxx_messageInfo_UpdatePathsTest.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdatePathsTest proto.InternalMessageInfo + +func (m *UpdatePathsTest) GetDocRefPath() string { + if m != nil { + return m.DocRefPath + } + return "" +} + +func (m *UpdatePathsTest) GetPrecondition() *v1beta1.Precondition { + if m != nil { + return m.Precondition + } + return nil +} + +func (m *UpdatePathsTest) GetFieldPaths() []*FieldPath { + if m != nil { + return m.FieldPaths + } + return nil +} + +func (m *UpdatePathsTest) GetJsonValues() []string { + if m != nil { + return m.JsonValues + } + return nil +} + +func (m *UpdatePathsTest) GetRequest() *v1beta1.CommitRequest { + if m != nil { + return m.Request + } + return nil +} + +func (m *UpdatePathsTest) GetIsError() bool { + if m != nil { + return m.IsError + } + return false +} + +// A call to DocmentRef.Delete +type DeleteTest struct { + DocRefPath string `protobuf:"bytes,1,opt,name=doc_ref_path,json=docRefPath,proto3" json:"doc_ref_path,omitempty"` + Precondition *v1beta1.Precondition `protobuf:"bytes,2,opt,name=precondition,proto3" json:"precondition,omitempty"` + Request *v1beta1.CommitRequest `protobuf:"bytes,3,opt,name=request,proto3" json:"request,omitempty"` + IsError bool `protobuf:"varint,4,opt,name=is_error,json=isError,proto3" json:"is_error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteTest) Reset() { *m = DeleteTest{} } +func (m *DeleteTest) String() string { return proto.CompactTextString(m) } +func (*DeleteTest) ProtoMessage() {} +func (*DeleteTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{7} +} +func (m *DeleteTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteTest.Unmarshal(m, b) +} +func (m *DeleteTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteTest.Marshal(b, m, deterministic) +} +func (dst *DeleteTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteTest.Merge(dst, src) +} +func (m *DeleteTest) XXX_Size() int { + return xxx_messageInfo_DeleteTest.Size(m) +} +func (m *DeleteTest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteTest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteTest proto.InternalMessageInfo + +func (m *DeleteTest) GetDocRefPath() string { + if m != nil { + return m.DocRefPath + } + return "" +} + +func (m *DeleteTest) GetPrecondition() *v1beta1.Precondition { + if m != nil { + return m.Precondition + } + return nil +} + +func (m *DeleteTest) GetRequest() *v1beta1.CommitRequest { + if m != nil { + return m.Request + } + return nil +} + +func (m *DeleteTest) GetIsError() bool { + if m != nil { + return m.IsError + } + return false +} + +// An option to the DocumentRef.Set call. +type SetOption struct { + All bool `protobuf:"varint,1,opt,name=all,proto3" json:"all,omitempty"` + Fields []*FieldPath `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetOption) Reset() { *m = SetOption{} } +func (m *SetOption) String() string { return proto.CompactTextString(m) } +func (*SetOption) ProtoMessage() {} +func (*SetOption) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{8} +} +func (m *SetOption) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetOption.Unmarshal(m, b) +} +func (m *SetOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetOption.Marshal(b, m, deterministic) +} +func (dst *SetOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetOption.Merge(dst, src) +} +func (m *SetOption) XXX_Size() int { + return xxx_messageInfo_SetOption.Size(m) +} +func (m *SetOption) XXX_DiscardUnknown() { + xxx_messageInfo_SetOption.DiscardUnknown(m) +} + +var xxx_messageInfo_SetOption proto.InternalMessageInfo + +func (m *SetOption) GetAll() bool { + if m != nil { + return m.All + } + return false +} + +func (m *SetOption) GetFields() []*FieldPath { + if m != nil { + return m.Fields + } + return nil +} + +type QueryTest struct { + CollPath string `protobuf:"bytes,1,opt,name=coll_path,json=collPath,proto3" json:"coll_path,omitempty"` + Clauses []*Clause `protobuf:"bytes,2,rep,name=clauses,proto3" json:"clauses,omitempty"` + Query *v1beta1.StructuredQuery `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` + IsError bool `protobuf:"varint,4,opt,name=is_error,json=isError,proto3" json:"is_error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *QueryTest) Reset() { *m = QueryTest{} } +func (m *QueryTest) String() string { return proto.CompactTextString(m) } +func (*QueryTest) ProtoMessage() {} +func (*QueryTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{9} +} +func (m *QueryTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_QueryTest.Unmarshal(m, b) +} +func (m *QueryTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_QueryTest.Marshal(b, m, deterministic) +} +func (dst *QueryTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTest.Merge(dst, src) +} +func (m *QueryTest) XXX_Size() int { + return xxx_messageInfo_QueryTest.Size(m) +} +func (m *QueryTest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTest proto.InternalMessageInfo + +func (m *QueryTest) GetCollPath() string { + if m != nil { + return m.CollPath + } + return "" +} + +func (m *QueryTest) GetClauses() []*Clause { + if m != nil { + return m.Clauses + } + return nil +} + +func (m *QueryTest) GetQuery() *v1beta1.StructuredQuery { + if m != nil { + return m.Query + } + return nil +} + +func (m *QueryTest) GetIsError() bool { + if m != nil { + return m.IsError + } + return false +} + +type Clause struct { + // Types that are valid to be assigned to Clause: + // *Clause_Select + // *Clause_Where + // *Clause_OrderBy + // *Clause_Offset + // *Clause_Limit + // *Clause_StartAt + // *Clause_StartAfter + // *Clause_EndAt + // *Clause_EndBefore + Clause isClause_Clause `protobuf_oneof:"clause"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Clause) Reset() { *m = Clause{} } +func (m *Clause) String() string { return proto.CompactTextString(m) } +func (*Clause) ProtoMessage() {} +func (*Clause) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{10} +} +func (m *Clause) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Clause.Unmarshal(m, b) +} +func (m *Clause) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Clause.Marshal(b, m, deterministic) +} +func (dst *Clause) XXX_Merge(src proto.Message) { + xxx_messageInfo_Clause.Merge(dst, src) +} +func (m *Clause) XXX_Size() int { + return xxx_messageInfo_Clause.Size(m) +} +func (m *Clause) XXX_DiscardUnknown() { + xxx_messageInfo_Clause.DiscardUnknown(m) +} + +var xxx_messageInfo_Clause proto.InternalMessageInfo + +type isClause_Clause interface { + isClause_Clause() +} + +type Clause_Select struct { + Select *Select `protobuf:"bytes,1,opt,name=select,proto3,oneof"` +} +type Clause_Where struct { + Where *Where `protobuf:"bytes,2,opt,name=where,proto3,oneof"` +} +type Clause_OrderBy struct { + OrderBy *OrderBy `protobuf:"bytes,3,opt,name=order_by,json=orderBy,proto3,oneof"` +} +type Clause_Offset struct { + Offset int32 `protobuf:"varint,4,opt,name=offset,proto3,oneof"` +} +type Clause_Limit struct { + Limit int32 `protobuf:"varint,5,opt,name=limit,proto3,oneof"` +} +type Clause_StartAt struct { + StartAt *Cursor `protobuf:"bytes,6,opt,name=start_at,json=startAt,proto3,oneof"` +} +type Clause_StartAfter struct { + StartAfter *Cursor `protobuf:"bytes,7,opt,name=start_after,json=startAfter,proto3,oneof"` +} +type Clause_EndAt struct { + EndAt *Cursor `protobuf:"bytes,8,opt,name=end_at,json=endAt,proto3,oneof"` +} +type Clause_EndBefore struct { + EndBefore *Cursor `protobuf:"bytes,9,opt,name=end_before,json=endBefore,proto3,oneof"` +} + +func (*Clause_Select) isClause_Clause() {} +func (*Clause_Where) isClause_Clause() {} +func (*Clause_OrderBy) isClause_Clause() {} +func (*Clause_Offset) isClause_Clause() {} +func (*Clause_Limit) isClause_Clause() {} +func (*Clause_StartAt) isClause_Clause() {} +func (*Clause_StartAfter) isClause_Clause() {} +func (*Clause_EndAt) isClause_Clause() {} +func (*Clause_EndBefore) isClause_Clause() {} + +func (m *Clause) GetClause() isClause_Clause { + if m != nil { + return m.Clause + } + return nil +} + +func (m *Clause) GetSelect() *Select { + if x, ok := m.GetClause().(*Clause_Select); ok { + return x.Select + } + return nil +} + +func (m *Clause) GetWhere() *Where { + if x, ok := m.GetClause().(*Clause_Where); ok { + return x.Where + } + return nil +} + +func (m *Clause) GetOrderBy() *OrderBy { + if x, ok := m.GetClause().(*Clause_OrderBy); ok { + return x.OrderBy + } + return nil +} + +func (m *Clause) GetOffset() int32 { + if x, ok := m.GetClause().(*Clause_Offset); ok { + return x.Offset + } + return 0 +} + +func (m *Clause) GetLimit() int32 { + if x, ok := m.GetClause().(*Clause_Limit); ok { + return x.Limit + } + return 0 +} + +func (m *Clause) GetStartAt() *Cursor { + if x, ok := m.GetClause().(*Clause_StartAt); ok { + return x.StartAt + } + return nil +} + +func (m *Clause) GetStartAfter() *Cursor { + if x, ok := m.GetClause().(*Clause_StartAfter); ok { + return x.StartAfter + } + return nil +} + +func (m *Clause) GetEndAt() *Cursor { + if x, ok := m.GetClause().(*Clause_EndAt); ok { + return x.EndAt + } + return nil +} + +func (m *Clause) GetEndBefore() *Cursor { + if x, ok := m.GetClause().(*Clause_EndBefore); ok { + return x.EndBefore + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Clause) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Clause_OneofMarshaler, _Clause_OneofUnmarshaler, _Clause_OneofSizer, []interface{}{ + (*Clause_Select)(nil), + (*Clause_Where)(nil), + (*Clause_OrderBy)(nil), + (*Clause_Offset)(nil), + (*Clause_Limit)(nil), + (*Clause_StartAt)(nil), + (*Clause_StartAfter)(nil), + (*Clause_EndAt)(nil), + (*Clause_EndBefore)(nil), + } +} + +func _Clause_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Clause) + // clause + switch x := m.Clause.(type) { + case *Clause_Select: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Select); err != nil { + return err + } + case *Clause_Where: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Where); err != nil { + return err + } + case *Clause_OrderBy: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OrderBy); err != nil { + return err + } + case *Clause_Offset: + b.EncodeVarint(4<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.Offset)) + case *Clause_Limit: + b.EncodeVarint(5<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.Limit)) + case *Clause_StartAt: + b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.StartAt); err != nil { + return err + } + case *Clause_StartAfter: + b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.StartAfter); err != nil { + return err + } + case *Clause_EndAt: + b.EncodeVarint(8<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.EndAt); err != nil { + return err + } + case *Clause_EndBefore: + b.EncodeVarint(9<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.EndBefore); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Clause.Clause has unexpected type %T", x) + } + return nil +} + +func _Clause_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Clause) + switch tag { + case 1: // clause.select + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Select) + err := b.DecodeMessage(msg) + m.Clause = &Clause_Select{msg} + return true, err + case 2: // clause.where + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Where) + err := b.DecodeMessage(msg) + m.Clause = &Clause_Where{msg} + return true, err + case 3: // clause.order_by + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(OrderBy) + err := b.DecodeMessage(msg) + m.Clause = &Clause_OrderBy{msg} + return true, err + case 4: // clause.offset + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Clause = &Clause_Offset{int32(x)} + return true, err + case 5: // clause.limit + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Clause = &Clause_Limit{int32(x)} + return true, err + case 6: // clause.start_at + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Cursor) + err := b.DecodeMessage(msg) + m.Clause = &Clause_StartAt{msg} + return true, err + case 7: // clause.start_after + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Cursor) + err := b.DecodeMessage(msg) + m.Clause = &Clause_StartAfter{msg} + return true, err + case 8: // clause.end_at + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Cursor) + err := b.DecodeMessage(msg) + m.Clause = &Clause_EndAt{msg} + return true, err + case 9: // clause.end_before + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Cursor) + err := b.DecodeMessage(msg) + m.Clause = &Clause_EndBefore{msg} + return true, err + default: + return false, nil + } +} + +func _Clause_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Clause) + // clause + switch x := m.Clause.(type) { + case *Clause_Select: + s := proto.Size(x.Select) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Clause_Where: + s := proto.Size(x.Where) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Clause_OrderBy: + s := proto.Size(x.OrderBy) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Clause_Offset: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.Offset)) + case *Clause_Limit: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.Limit)) + case *Clause_StartAt: + s := proto.Size(x.StartAt) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Clause_StartAfter: + s := proto.Size(x.StartAfter) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Clause_EndAt: + s := proto.Size(x.EndAt) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *Clause_EndBefore: + s := proto.Size(x.EndBefore) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type Select struct { + Fields []*FieldPath `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Select) Reset() { *m = Select{} } +func (m *Select) String() string { return proto.CompactTextString(m) } +func (*Select) ProtoMessage() {} +func (*Select) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{11} +} +func (m *Select) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Select.Unmarshal(m, b) +} +func (m *Select) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Select.Marshal(b, m, deterministic) +} +func (dst *Select) XXX_Merge(src proto.Message) { + xxx_messageInfo_Select.Merge(dst, src) +} +func (m *Select) XXX_Size() int { + return xxx_messageInfo_Select.Size(m) +} +func (m *Select) XXX_DiscardUnknown() { + xxx_messageInfo_Select.DiscardUnknown(m) +} + +var xxx_messageInfo_Select proto.InternalMessageInfo + +func (m *Select) GetFields() []*FieldPath { + if m != nil { + return m.Fields + } + return nil +} + +type Where struct { + Path *FieldPath `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Op string `protobuf:"bytes,2,opt,name=op,proto3" json:"op,omitempty"` + JsonValue string `protobuf:"bytes,3,opt,name=json_value,json=jsonValue,proto3" json:"json_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Where) Reset() { *m = Where{} } +func (m *Where) String() string { return proto.CompactTextString(m) } +func (*Where) ProtoMessage() {} +func (*Where) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{12} +} +func (m *Where) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Where.Unmarshal(m, b) +} +func (m *Where) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Where.Marshal(b, m, deterministic) +} +func (dst *Where) XXX_Merge(src proto.Message) { + xxx_messageInfo_Where.Merge(dst, src) +} +func (m *Where) XXX_Size() int { + return xxx_messageInfo_Where.Size(m) +} +func (m *Where) XXX_DiscardUnknown() { + xxx_messageInfo_Where.DiscardUnknown(m) +} + +var xxx_messageInfo_Where proto.InternalMessageInfo + +func (m *Where) GetPath() *FieldPath { + if m != nil { + return m.Path + } + return nil +} + +func (m *Where) GetOp() string { + if m != nil { + return m.Op + } + return "" +} + +func (m *Where) GetJsonValue() string { + if m != nil { + return m.JsonValue + } + return "" +} + +type OrderBy struct { + Path *FieldPath `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Direction string `protobuf:"bytes,2,opt,name=direction,proto3" json:"direction,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OrderBy) Reset() { *m = OrderBy{} } +func (m *OrderBy) String() string { return proto.CompactTextString(m) } +func (*OrderBy) ProtoMessage() {} +func (*OrderBy) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{13} +} +func (m *OrderBy) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OrderBy.Unmarshal(m, b) +} +func (m *OrderBy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OrderBy.Marshal(b, m, deterministic) +} +func (dst *OrderBy) XXX_Merge(src proto.Message) { + xxx_messageInfo_OrderBy.Merge(dst, src) +} +func (m *OrderBy) XXX_Size() int { + return xxx_messageInfo_OrderBy.Size(m) +} +func (m *OrderBy) XXX_DiscardUnknown() { + xxx_messageInfo_OrderBy.DiscardUnknown(m) +} + +var xxx_messageInfo_OrderBy proto.InternalMessageInfo + +func (m *OrderBy) GetPath() *FieldPath { + if m != nil { + return m.Path + } + return nil +} + +func (m *OrderBy) GetDirection() string { + if m != nil { + return m.Direction + } + return "" +} + +type Cursor struct { + // one of: + DocSnapshot *DocSnapshot `protobuf:"bytes,1,opt,name=doc_snapshot,json=docSnapshot,proto3" json:"doc_snapshot,omitempty"` + JsonValues []string `protobuf:"bytes,2,rep,name=json_values,json=jsonValues,proto3" json:"json_values,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cursor) Reset() { *m = Cursor{} } +func (m *Cursor) String() string { return proto.CompactTextString(m) } +func (*Cursor) ProtoMessage() {} +func (*Cursor) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{14} +} +func (m *Cursor) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Cursor.Unmarshal(m, b) +} +func (m *Cursor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Cursor.Marshal(b, m, deterministic) +} +func (dst *Cursor) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cursor.Merge(dst, src) +} +func (m *Cursor) XXX_Size() int { + return xxx_messageInfo_Cursor.Size(m) +} +func (m *Cursor) XXX_DiscardUnknown() { + xxx_messageInfo_Cursor.DiscardUnknown(m) +} + +var xxx_messageInfo_Cursor proto.InternalMessageInfo + +func (m *Cursor) GetDocSnapshot() *DocSnapshot { + if m != nil { + return m.DocSnapshot + } + return nil +} + +func (m *Cursor) GetJsonValues() []string { + if m != nil { + return m.JsonValues + } + return nil +} + +type DocSnapshot struct { + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + JsonData string `protobuf:"bytes,2,opt,name=json_data,json=jsonData,proto3" json:"json_data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DocSnapshot) Reset() { *m = DocSnapshot{} } +func (m *DocSnapshot) String() string { return proto.CompactTextString(m) } +func (*DocSnapshot) ProtoMessage() {} +func (*DocSnapshot) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{15} +} +func (m *DocSnapshot) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DocSnapshot.Unmarshal(m, b) +} +func (m *DocSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DocSnapshot.Marshal(b, m, deterministic) +} +func (dst *DocSnapshot) XXX_Merge(src proto.Message) { + xxx_messageInfo_DocSnapshot.Merge(dst, src) +} +func (m *DocSnapshot) XXX_Size() int { + return xxx_messageInfo_DocSnapshot.Size(m) +} +func (m *DocSnapshot) XXX_DiscardUnknown() { + xxx_messageInfo_DocSnapshot.DiscardUnknown(m) +} + +var xxx_messageInfo_DocSnapshot proto.InternalMessageInfo + +func (m *DocSnapshot) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (m *DocSnapshot) GetJsonData() string { + if m != nil { + return m.JsonData + } + return "" +} + +type FieldPath struct { + Field []string `protobuf:"bytes,1,rep,name=field,proto3" json:"field,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldPath) Reset() { *m = FieldPath{} } +func (m *FieldPath) String() string { return proto.CompactTextString(m) } +func (*FieldPath) ProtoMessage() {} +func (*FieldPath) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{16} +} +func (m *FieldPath) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldPath.Unmarshal(m, b) +} +func (m *FieldPath) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldPath.Marshal(b, m, deterministic) +} +func (dst *FieldPath) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldPath.Merge(dst, src) +} +func (m *FieldPath) XXX_Size() int { + return xxx_messageInfo_FieldPath.Size(m) +} +func (m *FieldPath) XXX_DiscardUnknown() { + xxx_messageInfo_FieldPath.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldPath proto.InternalMessageInfo + +func (m *FieldPath) GetField() []string { + if m != nil { + return m.Field + } + return nil +} + +// A test of the Listen streaming RPC (a.k.a. FireStore watch). +// If the sequence of responses is provided to the implementation, +// it should produce the sequence of snapshots. +// If is_error is true, an error should occur after the snapshots. +// +// The tests assume that the query is +// Collection("projects/projectID/databases/(default)/documents/C").OrderBy("a", Ascending) +// +// The watch target ID used in these tests is 1. Test interpreters +// should either change their client's ID for testing, +// or change the ID in the tests before running them. +type ListenTest struct { + Responses []*v1beta1.ListenResponse `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"` + Snapshots []*Snapshot `protobuf:"bytes,2,rep,name=snapshots,proto3" json:"snapshots,omitempty"` + IsError bool `protobuf:"varint,3,opt,name=is_error,json=isError,proto3" json:"is_error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListenTest) Reset() { *m = ListenTest{} } +func (m *ListenTest) String() string { return proto.CompactTextString(m) } +func (*ListenTest) ProtoMessage() {} +func (*ListenTest) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{17} +} +func (m *ListenTest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListenTest.Unmarshal(m, b) +} +func (m *ListenTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListenTest.Marshal(b, m, deterministic) +} +func (dst *ListenTest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListenTest.Merge(dst, src) +} +func (m *ListenTest) XXX_Size() int { + return xxx_messageInfo_ListenTest.Size(m) +} +func (m *ListenTest) XXX_DiscardUnknown() { + xxx_messageInfo_ListenTest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListenTest proto.InternalMessageInfo + +func (m *ListenTest) GetResponses() []*v1beta1.ListenResponse { + if m != nil { + return m.Responses + } + return nil +} + +func (m *ListenTest) GetSnapshots() []*Snapshot { + if m != nil { + return m.Snapshots + } + return nil +} + +func (m *ListenTest) GetIsError() bool { + if m != nil { + return m.IsError + } + return false +} + +type Snapshot struct { + Docs []*v1beta1.Document `protobuf:"bytes,1,rep,name=docs,proto3" json:"docs,omitempty"` + Changes []*DocChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` + ReadTime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=read_time,json=readTime,proto3" json:"read_time,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Snapshot) Reset() { *m = Snapshot{} } +func (m *Snapshot) String() string { return proto.CompactTextString(m) } +func (*Snapshot) ProtoMessage() {} +func (*Snapshot) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{18} +} +func (m *Snapshot) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Snapshot.Unmarshal(m, b) +} +func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Snapshot.Marshal(b, m, deterministic) +} +func (dst *Snapshot) XXX_Merge(src proto.Message) { + xxx_messageInfo_Snapshot.Merge(dst, src) +} +func (m *Snapshot) XXX_Size() int { + return xxx_messageInfo_Snapshot.Size(m) +} +func (m *Snapshot) XXX_DiscardUnknown() { + xxx_messageInfo_Snapshot.DiscardUnknown(m) +} + +var xxx_messageInfo_Snapshot proto.InternalMessageInfo + +func (m *Snapshot) GetDocs() []*v1beta1.Document { + if m != nil { + return m.Docs + } + return nil +} + +func (m *Snapshot) GetChanges() []*DocChange { + if m != nil { + return m.Changes + } + return nil +} + +func (m *Snapshot) GetReadTime() *timestamp.Timestamp { + if m != nil { + return m.ReadTime + } + return nil +} + +type DocChange struct { + Kind DocChange_Kind `protobuf:"varint,1,opt,name=kind,proto3,enum=tests.DocChange_Kind" json:"kind,omitempty"` + Doc *v1beta1.Document `protobuf:"bytes,2,opt,name=doc,proto3" json:"doc,omitempty"` + OldIndex int32 `protobuf:"varint,3,opt,name=old_index,json=oldIndex,proto3" json:"old_index,omitempty"` + NewIndex int32 `protobuf:"varint,4,opt,name=new_index,json=newIndex,proto3" json:"new_index,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DocChange) Reset() { *m = DocChange{} } +func (m *DocChange) String() string { return proto.CompactTextString(m) } +func (*DocChange) ProtoMessage() {} +func (*DocChange) Descriptor() ([]byte, []int) { + return fileDescriptor_test_338de568ad9314f7, []int{19} +} +func (m *DocChange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DocChange.Unmarshal(m, b) +} +func (m *DocChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DocChange.Marshal(b, m, deterministic) +} +func (dst *DocChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DocChange.Merge(dst, src) +} +func (m *DocChange) XXX_Size() int { + return xxx_messageInfo_DocChange.Size(m) +} +func (m *DocChange) XXX_DiscardUnknown() { + xxx_messageInfo_DocChange.DiscardUnknown(m) +} + +var xxx_messageInfo_DocChange proto.InternalMessageInfo + +func (m *DocChange) GetKind() DocChange_Kind { + if m != nil { + return m.Kind + } + return DocChange_KIND_UNSPECIFIED +} + +func (m *DocChange) GetDoc() *v1beta1.Document { + if m != nil { + return m.Doc + } + return nil +} + +func (m *DocChange) GetOldIndex() int32 { + if m != nil { + return m.OldIndex + } + return 0 +} + +func (m *DocChange) GetNewIndex() int32 { + if m != nil { + return m.NewIndex + } + return 0 +} + +func init() { + proto.RegisterType((*TestSuite)(nil), "tests.TestSuite") + proto.RegisterType((*Test)(nil), "tests.Test") + proto.RegisterType((*GetTest)(nil), "tests.GetTest") + proto.RegisterType((*CreateTest)(nil), "tests.CreateTest") + proto.RegisterType((*SetTest)(nil), "tests.SetTest") + proto.RegisterType((*UpdateTest)(nil), "tests.UpdateTest") + proto.RegisterType((*UpdatePathsTest)(nil), "tests.UpdatePathsTest") + proto.RegisterType((*DeleteTest)(nil), "tests.DeleteTest") + proto.RegisterType((*SetOption)(nil), "tests.SetOption") + proto.RegisterType((*QueryTest)(nil), "tests.QueryTest") + proto.RegisterType((*Clause)(nil), "tests.Clause") + proto.RegisterType((*Select)(nil), "tests.Select") + proto.RegisterType((*Where)(nil), "tests.Where") + proto.RegisterType((*OrderBy)(nil), "tests.OrderBy") + proto.RegisterType((*Cursor)(nil), "tests.Cursor") + proto.RegisterType((*DocSnapshot)(nil), "tests.DocSnapshot") + proto.RegisterType((*FieldPath)(nil), "tests.FieldPath") + proto.RegisterType((*ListenTest)(nil), "tests.ListenTest") + proto.RegisterType((*Snapshot)(nil), "tests.Snapshot") + proto.RegisterType((*DocChange)(nil), "tests.DocChange") + proto.RegisterEnum("tests.DocChange_Kind", DocChange_Kind_name, DocChange_Kind_value) +} + +func init() { proto.RegisterFile("test.proto", fileDescriptor_test_338de568ad9314f7) } + +var fileDescriptor_test_338de568ad9314f7 = []byte{ + // 1292 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff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89, 0xae, 0x83, 0x4f, 0x19, 0x26, 0x6c, 0x7c, 0x68, 0x1d, 0xb7, 0x8f, 0xed, + 0x9e, 0x24, 0x6f, 0x3d, 0xbd, 0x75, 0x26, 0x6a, 0x53, 0x7d, 0x44, 0x5d, 0xf0, 0xe8, 0x64, 0x62, + 0xdf, 0x65, 0x57, 0x1a, 0xd3, 0x77, 0x74, 0x01, 0xdc, 0x2c, 0x9d, 0xa6, 0xba, 0xa1, 0x25, 0x43, + 0x5f, 0xd1, 0x35, 0xf0, 0xb9, 0x88, 0x99, 0x18, 0xc7, 0xc2, 0xbc, 0xb8, 0x65, 0xfa, 0x0a, 0xc6, + 0x29, 0x93, 0xda, 0x15, 0x60, 0x53, 0xa0, 0xf7, 0xa0, 0x63, 0xb0, 0x13, 0x41, 0x98, 0x79, 0x69, + 0x9f, 0x81, 0x83, 0x86, 0x4b, 0x08, 0xba, 0x02, 0x1e, 0xc9, 0xb1, 0xd4, 0xed, 0x3f, 0x1f, 0xec, + 0x92, 0x1c, 0x6f, 0x0a, 0xd4, 0x07, 0x90, 0xb8, 0x43, 0x32, 0xa1, 0x8c, 0x98, 0xb7, 0xf6, 0x19, + 0x6c, 0x40, 0x72, 0xbc, 0xa5, 0x10, 0x5b, 0x3e, 0x78, 0xba, 0xaa, 0xe1, 0x06, 0x78, 0x3a, 0xb1, + 0x73, 0xcd, 0xe5, 0xfc, 0x43, 0x73, 0x1d, 0x80, 0xab, 0x92, 0x8c, 0x2e, 0x43, 0xab, 0x6c, 0xa9, + 0xe7, 0x09, 0x28, 0x2e, 0x3a, 0x0b, 0x0d, 0x3a, 0x33, 0x4f, 0x64, 0x83, 0xce, 0xd0, 0x5b, 0x00, + 0xd5, 0xfa, 0x30, 0xfb, 0x36, 0x28, 0xb7, 0x47, 0x78, 0x07, 0xda, 0xa6, 0x32, 0xa7, 0xd4, 0xff, + 0x26, 0x04, 0x38, 0x65, 0x24, 0x29, 0x67, 0x3b, 0x88, 0x2a, 0x42, 0xf8,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e, 0x00, 0x00, +} diff --git a/vendor/cloud.google.com/go/firestore/integration_test.go b/vendor/cloud.google.com/go/firestore/integration_test.go new file mode 100644 index 000000000..bf9c9ffab --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/integration_test.go @@ -0,0 +1,1339 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "errors" + "flag" + "fmt" + "log" + "math" + "os" + "path/filepath" + "runtime" + "sort" + "testing" + "time" + + "cloud.google.com/go/internal/pretty" + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/internal/uid" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "google.golang.org/api/option" + "google.golang.org/genproto/googleapis/type/latlng" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +func TestMain(m *testing.M) { + initIntegrationTest() + status := m.Run() + cleanupIntegrationTest() + os.Exit(status) +} + +const ( + envProjID = "GCLOUD_TESTS_GOLANG_FIRESTORE_PROJECT_ID" + envPrivateKey = "GCLOUD_TESTS_GOLANG_FIRESTORE_KEY" +) + +var ( + iClient *Client + iColl *CollectionRef + collectionIDs = uid.NewSpace("go-integration-test", nil) +) + +func initIntegrationTest() { + flag.Parse() // needed for testing.Short() + if testing.Short() { + return + } + ctx := context.Background() + testProjectID := os.Getenv(envProjID) + if testProjectID == "" { + log.Println("Integration tests skipped. See CONTRIBUTING.md for details") + return + } + ts := testutil.TokenSourceEnv(ctx, envPrivateKey, + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore") + if ts == nil { + log.Fatal("The project key must be set. See CONTRIBUTING.md for details") + } + ti := &testInterceptor{dbPath: "projects/" + testProjectID + "/databases/(default)"} + c, err := NewClient(ctx, testProjectID, + option.WithTokenSource(ts), + option.WithGRPCDialOption(grpc.WithUnaryInterceptor(ti.interceptUnary)), + option.WithGRPCDialOption(grpc.WithStreamInterceptor(ti.interceptStream)), + ) + if err != nil { + log.Fatalf("NewClient: %v", err) + } + iClient = c + iColl = c.Collection(collectionIDs.New()) + refDoc := iColl.NewDoc() + integrationTestMap["ref"] = refDoc + wantIntegrationTestMap["ref"] = refDoc + integrationTestStruct.Ref = refDoc +} + +type testInterceptor struct { + dbPath string +} + +func (ti *testInterceptor) interceptUnary(ctx context.Context, method string, req, res interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + ti.checkMetadata(ctx, method) + return invoker(ctx, method, req, res, cc, opts...) +} + +func (ti *testInterceptor) interceptStream(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { + ti.checkMetadata(ctx, method) + return streamer(ctx, desc, cc, method, opts...) +} + +func (ti *testInterceptor) checkMetadata(ctx context.Context, method string) { + md, ok := metadata.FromOutgoingContext(ctx) + if !ok { + log.Fatalf("method %s: bad metadata", method) + } + for _, h := range []string{"google-cloud-resource-prefix", "x-goog-api-client"} { + v, ok := md[h] + if !ok { + log.Fatalf("method %s, header %s missing", method, h) + } + if len(v) != 1 { + log.Fatalf("method %s, header %s: bad value %v", method, h, v) + } + } + v := md["google-cloud-resource-prefix"][0] + if v != ti.dbPath { + log.Fatalf("method %s: bad resource prefix header: %q", method, v) + } +} + +func cleanupIntegrationTest() { + if iClient == nil { + return + } + // TODO(jba): delete everything in integrationColl. + iClient.Close() +} + +// integrationClient should be called by integration tests to get a valid client. It will never +// return nil. If integrationClient returns, an integration test can proceed without +// further checks. +func integrationClient(t *testing.T) *Client { + if testing.Short() { + t.Skip("Integration tests skipped in short mode") + } + if iClient == nil { + t.SkipNow() // log message printed in initIntegrationTest + } + return iClient +} + +func integrationColl(t *testing.T) *CollectionRef { + _ = integrationClient(t) + return iColl +} + +type integrationTestStructType struct { + Int int + Str string + Bool bool + Float float32 + Null interface{} + Bytes []byte + Time time.Time + Geo, NilGeo *latlng.LatLng + Ref *DocumentRef +} + +var ( + integrationTime = time.Date(2017, 3, 20, 1, 2, 3, 456789, time.UTC) + // Firestore times are accurate only to microseconds. + wantIntegrationTime = time.Date(2017, 3, 20, 1, 2, 3, 456000, time.UTC) + + integrationGeo = &latlng.LatLng{Latitude: 30, Longitude: 70} + + // Use this when writing a doc. + integrationTestMap = map[string]interface{}{ + "int": 1, + "str": "two", + "bool": true, + "float": 3.14, + "null": nil, + "bytes": []byte("bytes"), + "*": map[string]interface{}{"`": 4}, + "time": integrationTime, + "geo": integrationGeo, + "ref": nil, // populated by initIntegrationTest + } + + // The returned data is slightly different. + wantIntegrationTestMap = map[string]interface{}{ + "int": int64(1), + "str": "two", + "bool": true, + "float": 3.14, + "null": nil, + "bytes": []byte("bytes"), + "*": map[string]interface{}{"`": int64(4)}, + "time": wantIntegrationTime, + "geo": integrationGeo, + "ref": nil, // populated by initIntegrationTest + } + + integrationTestStruct = integrationTestStructType{ + Int: 1, + Str: "two", + Bool: true, + Float: 3.14, + Null: nil, + Bytes: []byte("bytes"), + Time: integrationTime, + Geo: integrationGeo, + NilGeo: nil, + Ref: nil, // populated by initIntegrationTest + } +) + +func TestIntegration_Create(t *testing.T) { + ctx := context.Background() + doc := integrationColl(t).NewDoc() + start := time.Now() + h := testHelper{t} + wr := h.mustCreate(doc, integrationTestMap) + end := time.Now() + checkTimeBetween(t, wr.UpdateTime, start, end) + _, err := doc.Create(ctx, integrationTestMap) + codeEq(t, "Create on a present doc", codes.AlreadyExists, err) + // OK to create an empty document. + _, err = integrationColl(t).NewDoc().Create(ctx, map[string]interface{}{}) + codeEq(t, "Create empty doc", codes.OK, err) +} + +func TestIntegration_Get(t *testing.T) { + ctx := context.Background() + doc := integrationColl(t).NewDoc() + h := testHelper{t} + h.mustCreate(doc, integrationTestMap) + ds := h.mustGet(doc) + if ds.CreateTime != ds.UpdateTime { + t.Errorf("create time %s != update time %s", ds.CreateTime, ds.UpdateTime) + } + got := ds.Data() + if want := wantIntegrationTestMap; !testEqual(got, want) { + t.Errorf("got\n%v\nwant\n%v", pretty.Value(got), pretty.Value(want)) + } + + doc = integrationColl(t).NewDoc() + empty := map[string]interface{}{} + h.mustCreate(doc, empty) + ds = h.mustGet(doc) + if ds.CreateTime != ds.UpdateTime { + t.Errorf("create time %s != update time %s", ds.CreateTime, ds.UpdateTime) + } + if got, want := ds.Data(), empty; !testEqual(got, want) { + t.Errorf("got\n%v\nwant\n%v", pretty.Value(got), pretty.Value(want)) + } + + ds, err := integrationColl(t).NewDoc().Get(ctx) + codeEq(t, "Get on a missing doc", codes.NotFound, err) + if ds == nil || ds.Exists() { + t.Fatal("got nil or existing doc snapshot, want !ds.Exists") + } + if ds.ReadTime.IsZero() { + t.Error("got zero read time") + } +} + +func TestIntegration_GetAll(t *testing.T) { + type getAll struct{ N int } + + h := testHelper{t} + coll := integrationColl(t) + ctx := context.Background() + var docRefs []*DocumentRef + for i := 0; i < 5; i++ { + doc := coll.NewDoc() + docRefs = append(docRefs, doc) + if i != 3 { + h.mustCreate(doc, getAll{N: i}) + } + } + docSnapshots, err := iClient.GetAll(ctx, docRefs) + if err != nil { + t.Fatal(err) + } + if got, want := len(docSnapshots), len(docRefs); got != want { + t.Fatalf("got %d snapshots, want %d", got, want) + } + for i, ds := range docSnapshots { + if i == 3 { + if ds == nil || ds.Exists() { + t.Fatal("got nil or existing doc snapshot, want !ds.Exists") + } + err := ds.DataTo(nil) + codeEq(t, "DataTo on a missing doc", codes.NotFound, err) + } else { + var got getAll + if err := ds.DataTo(&got); err != nil { + t.Fatal(err) + } + want := getAll{N: i} + if got != want { + t.Errorf("%d: got %+v, want %+v", i, got, want) + } + } + if ds.ReadTime.IsZero() { + t.Errorf("%d: got zero read time", i) + } + } +} + +func TestIntegration_Add(t *testing.T) { + start := time.Now() + _, wr, err := integrationColl(t).Add(context.Background(), integrationTestMap) + if err != nil { + t.Fatal(err) + } + end := time.Now() + checkTimeBetween(t, wr.UpdateTime, start, end) +} + +func TestIntegration_Set(t *testing.T) { + coll := integrationColl(t) + h := testHelper{t} + ctx := context.Background() + + // Set Should be able to create a new doc. + doc := coll.NewDoc() + wr1 := h.mustSet(doc, integrationTestMap) + // Calling Set on the doc completely replaces the contents. + // The update time should increase. + newData := map[string]interface{}{ + "str": "change", + "x": "1", + } + wr2 := h.mustSet(doc, newData) + if !wr1.UpdateTime.Before(wr2.UpdateTime) { + t.Errorf("update time did not increase: old=%s, new=%s", wr1.UpdateTime, wr2.UpdateTime) + } + ds := h.mustGet(doc) + if got := ds.Data(); !testEqual(got, newData) { + t.Errorf("got %v, want %v", got, newData) + } + + newData = map[string]interface{}{ + "str": "1", + "x": "2", + "y": "3", + } + // SetOptions: + // Only fields mentioned in the Merge option will be changed. + // In this case, "str" will not be changed to "1". + wr3, err := doc.Set(ctx, newData, Merge([]string{"x"}, []string{"y"})) + if err != nil { + t.Fatal(err) + } + ds = h.mustGet(doc) + want := map[string]interface{}{ + "str": "change", + "x": "2", + "y": "3", + } + if got := ds.Data(); !testEqual(got, want) { + t.Errorf("got %v, want %v", got, want) + } + if !wr2.UpdateTime.Before(wr3.UpdateTime) { + t.Errorf("update time did not increase: old=%s, new=%s", wr2.UpdateTime, wr3.UpdateTime) + } + + // Another way to change only x and y is to pass a map with only + // those keys, and use MergeAll. + wr4, err := doc.Set(ctx, map[string]interface{}{"x": "4", "y": "5"}, MergeAll) + if err != nil { + t.Fatal(err) + } + ds = h.mustGet(doc) + want = map[string]interface{}{ + "str": "change", + "x": "4", + "y": "5", + } + if got := ds.Data(); !testEqual(got, want) { + t.Errorf("got %v, want %v", got, want) + } + if !wr3.UpdateTime.Before(wr4.UpdateTime) { + t.Errorf("update time did not increase: old=%s, new=%s", wr3.UpdateTime, wr4.UpdateTime) + } + + // use firestore.Delete to delete a field. + // TODO(deklerk) We should be able to use mustSet, but then we get a test error. We should investigate this. + _, err = doc.Set(ctx, map[string]interface{}{"str": Delete}, MergeAll) + if err != nil { + t.Fatal(err) + } + ds = h.mustGet(doc) + want = map[string]interface{}{ + "x": "4", + "y": "5", + } + if got := ds.Data(); !testEqual(got, want) { + t.Errorf("got %v, want %v", got, want) + } + + // Writing an empty doc with MergeAll should create the doc. + doc2 := coll.NewDoc() + want = map[string]interface{}{} + h.mustSet(doc2, want, MergeAll) + ds = h.mustGet(doc2) + if got := ds.Data(); !testEqual(got, want) { + t.Errorf("got %v, want %v", got, want) + } +} + +func TestIntegration_Delete(t *testing.T) { + ctx := context.Background() + doc := integrationColl(t).NewDoc() + h := testHelper{t} + h.mustCreate(doc, integrationTestMap) + h.mustDelete(doc) + // Confirm that doc doesn't exist. + if _, err := doc.Get(ctx); grpc.Code(err) != codes.NotFound { + t.Fatalf("got error <%v>, want NotFound", err) + } + + er := func(_ *WriteResult, err error) error { return err } + + codeEq(t, "Delete on a missing doc", codes.OK, + er(doc.Delete(ctx))) + // TODO(jba): confirm that the server should return InvalidArgument instead of + // FailedPrecondition. + wr := h.mustCreate(doc, integrationTestMap) + codeEq(t, "Delete with wrong LastUpdateTime", codes.FailedPrecondition, + er(doc.Delete(ctx, LastUpdateTime(wr.UpdateTime.Add(-time.Millisecond))))) + codeEq(t, "Delete with right LastUpdateTime", codes.OK, + er(doc.Delete(ctx, LastUpdateTime(wr.UpdateTime)))) +} + +func TestIntegration_Update(t *testing.T) { + ctx := context.Background() + doc := integrationColl(t).NewDoc() + h := testHelper{t} + + h.mustCreate(doc, integrationTestMap) + fpus := []Update{ + {Path: "bool", Value: false}, + {Path: "time", Value: 17}, + {FieldPath: []string{"*", "`"}, Value: 18}, + {Path: "null", Value: Delete}, + {Path: "noSuchField", Value: Delete}, // deleting a non-existent field is a no-op + } + wr := h.mustUpdate(doc, fpus) + ds := h.mustGet(doc) + got := ds.Data() + want := copyMap(wantIntegrationTestMap) + want["bool"] = false + want["time"] = int64(17) + want["*"] = map[string]interface{}{"`": int64(18)} + delete(want, "null") + if !testEqual(got, want) { + t.Errorf("got\n%#v\nwant\n%#v", got, want) + } + + er := func(_ *WriteResult, err error) error { return err } + + codeEq(t, "Update on missing doc", codes.NotFound, + er(integrationColl(t).NewDoc().Update(ctx, fpus))) + codeEq(t, "Update with wrong LastUpdateTime", codes.FailedPrecondition, + er(doc.Update(ctx, fpus, LastUpdateTime(wr.UpdateTime.Add(-time.Millisecond))))) + codeEq(t, "Update with right LastUpdateTime", codes.OK, + er(doc.Update(ctx, fpus, LastUpdateTime(wr.UpdateTime)))) +} + +func TestIntegration_Collections(t *testing.T) { + ctx := context.Background() + c := integrationClient(t) + h := testHelper{t} + got, err := c.Collections(ctx).GetAll() + if err != nil { + t.Fatal(err) + } + // There should be at least one collection. + if len(got) == 0 { + t.Error("got 0 top-level collections, want at least one") + } + + doc := integrationColl(t).NewDoc() + got, err = doc.Collections(ctx).GetAll() + if err != nil { + t.Fatal(err) + } + if len(got) != 0 { + t.Errorf("got %d collections, want 0", len(got)) + } + var want []*CollectionRef + for i := 0; i < 3; i++ { + id := collectionIDs.New() + cr := doc.Collection(id) + want = append(want, cr) + h.mustCreate(cr.NewDoc(), integrationTestMap) + } + got, err = doc.Collections(ctx).GetAll() + if err != nil { + t.Fatal(err) + } + if !testEqual(got, want) { + t.Errorf("got\n%#v\nwant\n%#v", got, want) + } +} + +func TestIntegration_ServerTimestamp(t *testing.T) { + type S struct { + A int + B time.Time + C time.Time `firestore:"C.C,serverTimestamp"` + D map[string]interface{} + E time.Time `firestore:",omitempty,serverTimestamp"` + } + data := S{ + A: 1, + B: aTime, + // C is unset, so will get the server timestamp. + D: map[string]interface{}{"x": ServerTimestamp}, + // E is unset, so will get the server timestamp. + } + h := testHelper{t} + doc := integrationColl(t).NewDoc() + // Bound times of the RPC, with some slack for clock skew. + start := time.Now() + h.mustCreate(doc, data) + end := time.Now() + ds := h.mustGet(doc) + var got S + if err := ds.DataTo(&got); err != nil { + t.Fatal(err) + } + if !testEqual(got.B, aTime) { + t.Errorf("B: got %s, want %s", got.B, aTime) + } + checkTimeBetween(t, got.C, start, end) + if g, w := got.D["x"], got.C; !testEqual(g, w) { + t.Errorf(`D["x"] = %s, want equal to C (%s)`, g, w) + } + if g, w := got.E, got.C; !testEqual(g, w) { + t.Errorf(`E = %s, want equal to C (%s)`, g, w) + } +} + +func TestIntegration_MergeServerTimestamp(t *testing.T) { + doc := integrationColl(t).NewDoc() + h := testHelper{t} + + // Create a doc with an ordinary field "a" and a ServerTimestamp field "b". + h.mustSet(doc, map[string]interface{}{"a": 1, "b": ServerTimestamp}) + docSnap := h.mustGet(doc) + data1 := docSnap.Data() + // Merge with a document with a different value of "a". However, + // specify only "b" in the list of merge fields. + h.mustSet(doc, map[string]interface{}{"a": 2, "b": ServerTimestamp}, Merge([]string{"b"})) + // The result should leave "a" unchanged, while "b" is updated. + docSnap = h.mustGet(doc) + data2 := docSnap.Data() + if got, want := data2["a"], data1["a"]; got != want { + t.Errorf("got %v, want %v", got, want) + } + t1 := data1["b"].(time.Time) + t2 := data2["b"].(time.Time) + if !t1.Before(t2) { + t.Errorf("got t1=%s, t2=%s; want t1 before t2", t1, t2) + } +} + +func TestIntegration_MergeNestedServerTimestamp(t *testing.T) { + doc := integrationColl(t).NewDoc() + h := testHelper{t} + + // Create a doc with an ordinary field "a" a ServerTimestamp field "b", + // and a second ServerTimestamp field "c.d". + h.mustSet(doc, map[string]interface{}{ + "a": 1, + "b": ServerTimestamp, + "c": map[string]interface{}{"d": ServerTimestamp}, + }) + data1 := h.mustGet(doc).Data() + // Merge with a document with a different value of "a". However, + // specify only "c.d" in the list of merge fields. + h.mustSet(doc, map[string]interface{}{ + "a": 2, + "b": ServerTimestamp, + "c": map[string]interface{}{"d": ServerTimestamp}, + }, Merge([]string{"c", "d"})) + // The result should leave "a" and "b" unchanged, while "c.d" is updated. + data2 := h.mustGet(doc).Data() + if got, want := data2["a"], data1["a"]; got != want { + t.Errorf("a: got %v, want %v", got, want) + } + want := data1["b"].(time.Time) + got := data2["b"].(time.Time) + if !got.Equal(want) { + t.Errorf("b: got %s, want %s", got, want) + } + t1 := data1["c"].(map[string]interface{})["d"].(time.Time) + t2 := data2["c"].(map[string]interface{})["d"].(time.Time) + if !t1.Before(t2) { + t.Errorf("got t1=%s, t2=%s; want t1 before t2", t1, t2) + } +} + +func TestIntegration_WriteBatch(t *testing.T) { + ctx := context.Background() + b := integrationClient(t).Batch() + h := testHelper{t} + doc1 := iColl.NewDoc() + doc2 := iColl.NewDoc() + b.Create(doc1, integrationTestMap) + b.Set(doc2, integrationTestMap) + b.Update(doc1, []Update{{Path: "bool", Value: false}}) + b.Update(doc1, []Update{{Path: "str", Value: Delete}}) + + wrs, err := b.Commit(ctx) + if err != nil { + t.Fatal(err) + } + if got, want := len(wrs), 4; got != want { + t.Fatalf("got %d WriteResults, want %d", got, want) + } + got1 := h.mustGet(doc1).Data() + want := copyMap(wantIntegrationTestMap) + want["bool"] = false + delete(want, "str") + if !testEqual(got1, want) { + t.Errorf("got\n%#v\nwant\n%#v", got1, want) + } + got2 := h.mustGet(doc2).Data() + if !testEqual(got2, wantIntegrationTestMap) { + t.Errorf("got\n%#v\nwant\n%#v", got2, wantIntegrationTestMap) + } + // TODO(jba): test two updates to the same document when it is supported. + // TODO(jba): test verify when it is supported. +} + +func TestIntegration_Query(t *testing.T) { + ctx := context.Background() + coll := integrationColl(t) + h := testHelper{t} + var wants []map[string]interface{} + for i := 0; i < 3; i++ { + doc := coll.NewDoc() + // To support running this test in parallel with the others, use a field name + // that we don't use anywhere else. + h.mustCreate(doc, map[string]interface{}{"q": i, "x": 1}) + wants = append(wants, map[string]interface{}{"q": int64(i)}) + } + q := coll.Select("q").OrderBy("q", Asc) + for i, test := range []struct { + q Query + want []map[string]interface{} + }{ + {q, wants}, + {q.Where("q", ">", 1), wants[2:]}, + {q.WherePath([]string{"q"}, ">", 1), wants[2:]}, + {q.Offset(1).Limit(1), wants[1:2]}, + {q.StartAt(1), wants[1:]}, + {q.StartAfter(1), wants[2:]}, + {q.EndAt(1), wants[:2]}, + {q.EndBefore(1), wants[:1]}, + } { + gotDocs, err := test.q.Documents(ctx).GetAll() + if err != nil { + t.Errorf("#%d: %+v: %v", i, test.q, err) + continue + } + if len(gotDocs) != len(test.want) { + t.Errorf("#%d: %+v: got %d docs, want %d", i, test.q, len(gotDocs), len(test.want)) + continue + } + for j, g := range gotDocs { + if got, want := g.Data(), test.want[j]; !testEqual(got, want) { + t.Errorf("#%d: %+v, #%d: got\n%+v\nwant\n%+v", i, test.q, j, got, want) + } + } + } + _, err := coll.Select("q").Where("x", "==", 1).OrderBy("q", Asc).Documents(ctx).GetAll() + codeEq(t, "Where and OrderBy on different fields without an index", codes.FailedPrecondition, err) + + // Using the collection itself as the query should return the full documents. + allDocs, err := coll.Documents(ctx).GetAll() + if err != nil { + t.Fatal(err) + } + seen := map[int64]bool{} // "q" values we see + for _, d := range allDocs { + data := d.Data() + q, ok := data["q"] + if !ok { + // A document from another test. + continue + } + if seen[q.(int64)] { + t.Errorf("%v: duplicate doc", data) + } + seen[q.(int64)] = true + if data["x"] != int64(1) { + t.Errorf("%v: wrong or missing 'x'", data) + } + if len(data) != 2 { + t.Errorf("%v: want two keys", data) + } + } + if got, want := len(seen), len(wants); got != want { + t.Errorf("got %d docs with 'q', want %d", len(seen), len(wants)) + } +} + +// Test unary filters. +func TestIntegration_QueryUnary(t *testing.T) { + ctx := context.Background() + coll := integrationColl(t) + h := testHelper{t} + h.mustCreate(coll.NewDoc(), map[string]interface{}{"x": 2, "q": "a"}) + h.mustCreate(coll.NewDoc(), map[string]interface{}{"x": 2, "q": nil}) + h.mustCreate(coll.NewDoc(), map[string]interface{}{"x": 2, "q": math.NaN()}) + wantNull := map[string]interface{}{"q": nil} + wantNaN := map[string]interface{}{"q": math.NaN()} + + base := coll.Select("q").Where("x", "==", 2) + for _, test := range []struct { + q Query + want map[string]interface{} + }{ + {base.Where("q", "==", nil), wantNull}, + {base.Where("q", "==", math.NaN()), wantNaN}, + } { + got, err := test.q.Documents(ctx).GetAll() + if err != nil { + t.Fatal(err) + } + if len(got) != 1 { + t.Errorf("got %d responses, want 1", len(got)) + continue + } + if g, w := got[0].Data(), test.want; !testEqual(g, w) { + t.Errorf("%v: got %v, want %v", test.q, g, w) + } + } +} + +// Test the special DocumentID field in queries. +func TestIntegration_QueryName(t *testing.T) { + ctx := context.Background() + h := testHelper{t} + + checkIDs := func(q Query, wantIDs []string) { + gots, err := q.Documents(ctx).GetAll() + if err != nil { + t.Fatal(err) + } + if len(gots) != len(wantIDs) { + t.Fatalf("got %d, want %d", len(gots), len(wantIDs)) + } + for i, g := range gots { + if got, want := g.Ref.ID, wantIDs[i]; got != want { + t.Errorf("#%d: got %s, want %s", i, got, want) + } + } + } + + coll := integrationColl(t) + var wantIDs []string + for i := 0; i < 3; i++ { + doc := coll.NewDoc() + h.mustCreate(doc, map[string]interface{}{"nm": 1}) + wantIDs = append(wantIDs, doc.ID) + } + sort.Strings(wantIDs) + q := coll.Where("nm", "==", 1).OrderBy(DocumentID, Asc) + checkIDs(q, wantIDs) + + // Empty Select. + q = coll.Select().Where("nm", "==", 1).OrderBy(DocumentID, Asc) + checkIDs(q, wantIDs) + + // Test cursors with __name__. + checkIDs(q.StartAt(wantIDs[1]), wantIDs[1:]) + checkIDs(q.EndAt(wantIDs[1]), wantIDs[:2]) +} + +func TestIntegration_QueryNested(t *testing.T) { + ctx := context.Background() + h := testHelper{t} + coll1 := integrationColl(t) + doc1 := coll1.NewDoc() + coll2 := doc1.Collection(collectionIDs.New()) + doc2 := coll2.NewDoc() + wantData := map[string]interface{}{"x": int64(1)} + h.mustCreate(doc2, wantData) + q := coll2.Select("x") + got, err := q.Documents(ctx).GetAll() + if err != nil { + t.Fatal(err) + } + if len(got) != 1 { + t.Fatalf("got %d docs, want 1", len(got)) + } + if gotData := got[0].Data(); !testEqual(gotData, wantData) { + t.Errorf("got\n%+v\nwant\n%+v", gotData, wantData) + } +} + +func TestIntegration_RunTransaction(t *testing.T) { + ctx := context.Background() + h := testHelper{t} + + type Player struct { + Name string + Score int + Star bool `firestore:"*"` + } + + pat := Player{Name: "Pat", Score: 3, Star: false} + client := integrationClient(t) + patDoc := iColl.Doc("pat") + var anError error + incPat := func(_ context.Context, tx *Transaction) error { + doc, err := tx.Get(patDoc) + if err != nil { + return err + } + score, err := doc.DataAt("Score") + if err != nil { + return err + } + // Since the Star field is called "*", we must use DataAtPath to get it. + star, err := doc.DataAtPath([]string{"*"}) + if err != nil { + return err + } + err = tx.Update(patDoc, []Update{{Path: "Score", Value: int(score.(int64) + 7)}}) + if err != nil { + return err + } + // Since the Star field is called "*", we must use Update to change it. + err = tx.Update(patDoc, + []Update{{FieldPath: []string{"*"}, Value: !star.(bool)}}) + if err != nil { + return err + } + return anError + } + + h.mustCreate(patDoc, pat) + err := client.RunTransaction(ctx, incPat) + if err != nil { + t.Fatal(err) + } + ds := h.mustGet(patDoc) + var got Player + if err := ds.DataTo(&got); err != nil { + t.Fatal(err) + } + want := Player{Name: "Pat", Score: 10, Star: true} + if got != want { + t.Errorf("got %+v, want %+v", got, want) + } + + // Function returns error, so transaction is rolled back and no writes happen. + anError = errors.New("bad") + err = client.RunTransaction(ctx, incPat) + if err != anError { + t.Fatalf("got %v, want %v", err, anError) + } + if err := ds.DataTo(&got); err != nil { + t.Fatal(err) + } + // want is same as before. + if got != want { + t.Errorf("got %+v, want %+v", got, want) + } +} + +func TestIntegration_TransactionGetAll(t *testing.T) { + ctx := context.Background() + h := testHelper{t} + type Player struct { + Name string + Score int + } + lee := Player{Name: "Lee", Score: 3} + sam := Player{Name: "Sam", Score: 1} + client := integrationClient(t) + leeDoc := iColl.Doc("lee") + samDoc := iColl.Doc("sam") + h.mustCreate(leeDoc, lee) + h.mustCreate(samDoc, sam) + + err := client.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error { + docs, err := tx.GetAll([]*DocumentRef{samDoc, leeDoc}) + if err != nil { + return err + } + for i, want := range []Player{sam, lee} { + var got Player + if err := docs[i].DataTo(&got); err != nil { + return err + } + if !testutil.Equal(got, want) { + return fmt.Errorf("got %+v, want %+v", got, want) + } + } + return nil + }) + if err != nil { + t.Fatal(err) + } +} + +func TestIntegration_WatchDocument(t *testing.T) { + coll := integrationColl(t) + ctx := context.Background() + h := testHelper{t} + doc := coll.NewDoc() + it := doc.Snapshots(ctx) + defer it.Stop() + + next := func() *DocumentSnapshot { + snap, err := it.Next() + if err != nil { + t.Fatal(err) + } + return snap + } + + snap := next() + if snap.Exists() { + t.Fatal("snapshot exists; it should not") + } + want := map[string]interface{}{"a": int64(1), "b": "two"} + h.mustCreate(doc, want) + snap = next() + if got := snap.Data(); !testutil.Equal(got, want) { + t.Fatalf("got %v, want %v", got, want) + } + + h.mustUpdate(doc, []Update{{Path: "a", Value: int64(2)}}) + want["a"] = int64(2) + snap = next() + if got := snap.Data(); !testutil.Equal(got, want) { + t.Fatalf("got %v, want %v", got, want) + } + + h.mustDelete(doc) + snap = next() + if snap.Exists() { + t.Fatal("snapshot exists; it should not") + } + + h.mustCreate(doc, want) + snap = next() + if got := snap.Data(); !testutil.Equal(got, want) { + t.Fatalf("got %v, want %v", got, want) + } +} + +func TestIntegration_ArrayUnion_Create(t *testing.T) { + path := "somepath" + data := map[string]interface{}{ + path: ArrayUnion("a", "b"), + } + + doc := integrationColl(t).NewDoc() + h := testHelper{t} + h.mustCreate(doc, data) + ds := h.mustGet(doc) + var gotMap map[string][]string + if err := ds.DataTo(&gotMap); err != nil { + t.Fatal(err) + } + if _, ok := gotMap[path]; !ok { + t.Fatalf("expected a %v key in data, got %v", path, gotMap) + } + + want := []string{"a", "b"} + for i, v := range gotMap[path] { + if v != want[i] { + t.Fatalf("got\n%#v\nwant\n%#v", gotMap[path], want) + } + } +} + +func TestIntegration_ArrayUnion_Update(t *testing.T) { + doc := integrationColl(t).NewDoc() + h := testHelper{t} + path := "somepath" + + h.mustCreate(doc, map[string]interface{}{ + path: []string{"a", "b"}, + }) + fpus := []Update{ + { + Path: path, + Value: ArrayUnion("this should be added"), + }, + } + h.mustUpdate(doc, fpus) + ds := h.mustGet(doc) + var gotMap map[string][]string + err := ds.DataTo(&gotMap) + if err != nil { + t.Fatal(err) + } + if _, ok := gotMap[path]; !ok { + t.Fatalf("expected a %v key in data, got %v", path, gotMap) + } + + want := []string{"a", "b", "this should be added"} + for i, v := range gotMap[path] { + if v != want[i] { + t.Fatalf("got\n%#v\nwant\n%#v", gotMap[path], want) + } + } +} + +func TestIntegration_ArrayUnion_Set(t *testing.T) { + coll := integrationColl(t) + h := testHelper{t} + path := "somepath" + + doc := coll.NewDoc() + newData := map[string]interface{}{ + path: ArrayUnion("a", "b"), + } + h.mustSet(doc, newData) + ds := h.mustGet(doc) + var gotMap map[string][]string + if err := ds.DataTo(&gotMap); err != nil { + t.Fatal(err) + } + if _, ok := gotMap[path]; !ok { + t.Fatalf("expected a %v key in data, got %v", path, gotMap) + } + + want := []string{"a", "b"} + for i, v := range gotMap[path] { + if v != want[i] { + t.Fatalf("got\n%#v\nwant\n%#v", gotMap[path], want) + } + } +} + +func TestIntegration_ArrayRemove_Create(t *testing.T) { + doc := integrationColl(t).NewDoc() + h := testHelper{t} + path := "somepath" + + h.mustCreate(doc, map[string]interface{}{ + path: ArrayRemove("a", "b"), + }) + + ds := h.mustGet(doc) + var gotMap map[string][]string + err := ds.DataTo(&gotMap) + if err != nil { + t.Fatal(err) + } + if _, ok := gotMap[path]; !ok { + t.Fatalf("expected a %v key in data, got %v", path, gotMap) + } + + // A create with arrayRemove results in an empty array. + want := []string(nil) + if !testEqual(gotMap[path], want) { + t.Fatalf("got\n%#v\nwant\n%#v", gotMap[path], want) + } +} + +func TestIntegration_ArrayRemove_Update(t *testing.T) { + doc := integrationColl(t).NewDoc() + h := testHelper{t} + path := "somepath" + + h.mustCreate(doc, map[string]interface{}{ + path: []string{"a", "this should be removed", "c"}, + }) + fpus := []Update{ + { + Path: path, + Value: ArrayRemove("this should be removed"), + }, + } + h.mustUpdate(doc, fpus) + ds := h.mustGet(doc) + var gotMap map[string][]string + err := ds.DataTo(&gotMap) + if err != nil { + t.Fatal(err) + } + if _, ok := gotMap[path]; !ok { + t.Fatalf("expected a %v key in data, got %v", path, gotMap) + } + + want := []string{"a", "c"} + for i, v := range gotMap[path] { + if v != want[i] { + t.Fatalf("got\n%#v\nwant\n%#v", gotMap[path], want) + } + } +} + +func TestIntegration_ArrayRemove_Set(t *testing.T) { + coll := integrationColl(t) + h := testHelper{t} + path := "somepath" + + doc := coll.NewDoc() + newData := map[string]interface{}{ + path: ArrayRemove("a", "b"), + } + h.mustSet(doc, newData) + ds := h.mustGet(doc) + var gotMap map[string][]string + if err := ds.DataTo(&gotMap); err != nil { + t.Fatal(err) + } + if _, ok := gotMap[path]; !ok { + t.Fatalf("expected a %v key in data, got %v", path, gotMap) + } + + want := []string(nil) + if !testEqual(gotMap[path], want) { + t.Fatalf("got\n%#v\nwant\n%#v", gotMap[path], want) + } +} + +type imap map[string]interface{} + +func TestIntegration_WatchQuery(t *testing.T) { + ctx := context.Background() + coll := integrationColl(t) + h := testHelper{t} + + q := coll.Where("e", ">", 1).OrderBy("e", Asc) + it := q.Snapshots(ctx) + defer it.Stop() + + next := func() ([]*DocumentSnapshot, []DocumentChange) { + qsnap, err := it.Next() + if err != nil { + t.Fatal(err) + } + if qsnap.ReadTime.IsZero() { + t.Fatal("zero time") + } + ds, err := qsnap.Documents.GetAll() + if err != nil { + t.Fatal(err) + } + if qsnap.Size != len(ds) { + t.Fatalf("Size=%d but we have %d docs", qsnap.Size, len(ds)) + } + return ds, qsnap.Changes + } + + copts := append([]cmp.Option{cmpopts.IgnoreFields(DocumentSnapshot{}, "ReadTime")}, cmpOpts...) + check := func(msg string, wantd []*DocumentSnapshot, wantc []DocumentChange) { + gotd, gotc := next() + if diff := testutil.Diff(gotd, wantd, copts...); diff != "" { + t.Errorf("%s: %s", msg, diff) + } + if diff := testutil.Diff(gotc, wantc, copts...); diff != "" { + t.Errorf("%s: %s", msg, diff) + } + } + + check("initial", nil, nil) + doc1 := coll.NewDoc() + h.mustCreate(doc1, imap{"e": int64(2), "b": "two"}) + wds := h.mustGet(doc1) + check("one", + []*DocumentSnapshot{wds}, + []DocumentChange{{Kind: DocumentAdded, Doc: wds, OldIndex: -1, NewIndex: 0}}) + + // Add a doc that does not match. We won't see a snapshot for this. + doc2 := coll.NewDoc() + h.mustCreate(doc2, imap{"e": int64(1)}) + + // Update the first doc. We should see the change. We won't see doc2. + h.mustUpdate(doc1, []Update{{Path: "e", Value: int64(3)}}) + wds = h.mustGet(doc1) + check("update", + []*DocumentSnapshot{wds}, + []DocumentChange{{Kind: DocumentModified, Doc: wds, OldIndex: 0, NewIndex: 0}}) + + // Now update doc so that it is not in the query. We should see a snapshot with no docs. + h.mustUpdate(doc1, []Update{{Path: "e", Value: int64(0)}}) + check("update2", nil, []DocumentChange{{Kind: DocumentRemoved, Doc: wds, OldIndex: 0, NewIndex: -1}}) + + // Add two docs out of order. We should see them in order. + doc3 := coll.NewDoc() + doc4 := coll.NewDoc() + want3 := imap{"e": int64(5)} + want4 := imap{"e": int64(4)} + h.mustCreate(doc3, want3) + h.mustCreate(doc4, want4) + wds4 := h.mustGet(doc4) + wds3 := h.mustGet(doc3) + check("two#1", + []*DocumentSnapshot{wds3}, + []DocumentChange{{Kind: DocumentAdded, Doc: wds3, OldIndex: -1, NewIndex: 0}}) + check("two#2", + []*DocumentSnapshot{wds4, wds3}, + []DocumentChange{{Kind: DocumentAdded, Doc: wds4, OldIndex: -1, NewIndex: 0}}) + // Delete a doc. + h.mustDelete(doc4) + check("after del", []*DocumentSnapshot{wds3}, []DocumentChange{{Kind: DocumentRemoved, Doc: wds4, OldIndex: 0, NewIndex: -1}}) +} + +func TestIntegration_WatchQueryCancel(t *testing.T) { + ctx := context.Background() + coll := integrationColl(t) + + q := coll.Where("e", ">", 1).OrderBy("e", Asc) + ctx, cancel := context.WithCancel(ctx) + it := q.Snapshots(ctx) + defer it.Stop() + + // First call opens the stream. + _, err := it.Next() + if err != nil { + t.Fatal(err) + } + cancel() + _, err = it.Next() + codeEq(t, "after cancel", codes.Canceled, err) +} + +func TestIntegration_MissingDocs(t *testing.T) { + ctx := context.Background() + h := testHelper{t} + client := integrationClient(t) + coll := client.Collection(collectionIDs.New()) + dr1 := coll.NewDoc() + dr2 := coll.NewDoc() + dr3 := dr2.Collection("sub").NewDoc() + h.mustCreate(dr1, integrationTestMap) + defer h.mustDelete(dr1) + h.mustCreate(dr3, integrationTestMap) + defer h.mustDelete(dr3) + + // dr1 is a document in coll. dr2 was never created, but there are documents in + // its sub-collections. It is "missing". + // The Collection.DocumentRefs method includes missing document refs. + want := []string{dr1.Path, dr2.Path} + drs, err := coll.DocumentRefs(ctx).GetAll() + if err != nil { + t.Fatal(err) + } + var got []string + for _, dr := range drs { + got = append(got, dr.Path) + } + sort.Strings(want) + sort.Strings(got) + if !testutil.Equal(got, want) { + t.Errorf("got %v, want %v", got, want) + } +} + +func codeEq(t *testing.T, msg string, code codes.Code, err error) { + if grpc.Code(err) != code { + t.Fatalf("%s:\ngot <%v>\nwant code %s", msg, err, code) + } +} + +func loc() string { + _, file, line, ok := runtime.Caller(2) + if !ok { + return "???" + } + return fmt.Sprintf("%s:%d", filepath.Base(file), line) +} + +func copyMap(m map[string]interface{}) map[string]interface{} { + c := map[string]interface{}{} + for k, v := range m { + c[k] = v + } + return c +} + +func checkTimeBetween(t *testing.T, got, low, high time.Time) { + // Allow slack for clock skew. + const slack = 4 * time.Second + low = low.Add(-slack) + high = high.Add(slack) + if got.Before(low) || got.After(high) { + t.Fatalf("got %s, not in [%s, %s]", got, low, high) + } +} + +type testHelper struct { + t *testing.T +} + +func (h testHelper) mustCreate(doc *DocumentRef, data interface{}) *WriteResult { + wr, err := doc.Create(context.Background(), data) + if err != nil { + h.t.Fatalf("%s: creating: %v", loc(), err) + } + return wr +} + +func (h testHelper) mustUpdate(doc *DocumentRef, updates []Update) *WriteResult { + wr, err := doc.Update(context.Background(), updates) + if err != nil { + h.t.Fatalf("%s: updating: %v", loc(), err) + } + return wr +} + +func (h testHelper) mustGet(doc *DocumentRef) *DocumentSnapshot { + d, err := doc.Get(context.Background()) + if err != nil { + h.t.Fatalf("%s: getting: %v", loc(), err) + } + return d +} + +func (h testHelper) mustDelete(doc *DocumentRef) *WriteResult { + wr, err := doc.Delete(context.Background()) + if err != nil { + h.t.Fatalf("%s: updating: %v", loc(), err) + } + return wr +} + +func (h testHelper) mustSet(doc *DocumentRef, data interface{}, opts ...SetOption) *WriteResult { + wr, err := doc.Set(context.Background(), data, opts...) + if err != nil { + h.t.Fatalf("%s: updating: %v", loc(), err) + } + return wr +} diff --git a/vendor/cloud.google.com/go/firestore/internal/Makefile b/vendor/cloud.google.com/go/firestore/internal/Makefile new file mode 100644 index 000000000..6769cb36e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/internal/Makefile @@ -0,0 +1,16 @@ +# Build doc.go from template and snippets. + +SHELL=/bin/bash + +../doc.go: build doc-snippets.go doc.template snipdoc.awk + @tmp=$$(mktemp) && \ + awk -f snipdoc.awk doc-snippets.go doc.template > $$tmp && \ + chmod +w $@ && \ + mv $$tmp $@ && \ + chmod -w $@ + @echo "wrote $@" + +.PHONY: build + +build: + go build doc-snippets.go diff --git a/vendor/cloud.google.com/go/firestore/internal/doc-snippets.go b/vendor/cloud.google.com/go/firestore/internal/doc-snippets.go new file mode 100644 index 000000000..44a156874 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/internal/doc-snippets.go @@ -0,0 +1,161 @@ +// Copyright 2017 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 internal + +// TODO(deklerk) can this file and directory be deleted, or is it being used for documentation somewhere? + +import ( + "context" + "fmt" + + firestore "cloud.google.com/go/firestore" + "google.golang.org/api/iterator" +) + +// State represents a state. +//[ structDef +type State struct { + Capital string `firestore:"capital"` + Population float64 `firestore:"pop"` // in millions +} + +//] + +func f1() { + //[ NewClient + ctx := context.Background() + client, err := firestore.NewClient(ctx, "projectID") + if err != nil { + // TODO: Handle error. + } + //] + //[ refs + states := client.Collection("States") + ny := states.Doc("NewYork") + // Or, in a single call: + ny = client.Doc("States/NewYork") + //] + //[ docref.Get + docsnap, err := ny.Get(ctx) + if err != nil { + // TODO: Handle error. + } + dataMap := docsnap.Data() + fmt.Println(dataMap) + //] + //[ DataTo + var nyData State + if err := docsnap.DataTo(&nyData); err != nil { + // TODO: Handle error. + } + //] + //[ GetAll + docsnaps, err := client.GetAll(ctx, []*firestore.DocumentRef{ + states.Doc("Wisconsin"), states.Doc("Ohio"), + }) + if err != nil { + // TODO: Handle error. + } + for _, ds := range docsnaps { + _ = ds // TODO: Use ds. + } + //[ docref.Create + wr, err := ny.Create(ctx, State{ + Capital: "Albany", + Population: 19.8, + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(wr) + //] + //[ docref.Set + ca := states.Doc("California") + _, err = ca.Set(ctx, State{ + Capital: "Sacramento", + Population: 39.14, + }) + //] + + //[ docref.Update + _, err = ca.Update(ctx, []firestore.Update{{Path: "capital", Value: "Sacramento"}}) + //] + + //[ docref.Delete + _, err = ny.Delete(ctx) + //] + + //[ LUT-precond + docsnap, err = ca.Get(ctx) + if err != nil { + // TODO: Handle error. + } + _, err = ca.Update(ctx, + []firestore.Update{{Path: "capital", Value: "Sacramento"}}, + firestore.LastUpdateTime(docsnap.UpdateTime)) + //] + + //[ WriteBatch + writeResults, err := client.Batch(). + Create(ny, State{Capital: "Albany"}). + Update(ca, []firestore.Update{{Path: "capital", Value: "Sacramento"}}). + Delete(client.Doc("States/WestDakota")). + Commit(ctx) + //] + _ = writeResults + + //[ Query + q := states.Where("pop", ">", 10).OrderBy("pop", firestore.Desc) + //] + //[ Documents + iter := q.Documents(ctx) + for { + doc, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(doc.Data()) + } + //] + + //[ CollQuery + iter = client.Collection("States").Documents(ctx) + //] +} + +func txn() { + var ctx context.Context + var client *firestore.Client + //[ Transaction + ny := client.Doc("States/NewYork") + err := client.RunTransaction(ctx, func(ctx context.Context, tx *firestore.Transaction) error { + doc, err := tx.Get(ny) // tx.Get, NOT ny.Get! + if err != nil { + return err + } + pop, err := doc.DataAt("pop") + if err != nil { + return err + } + return tx.Update(ny, []firestore.Update{{Path: "pop", Value: pop.(float64) + 0.2}}) + }) + if err != nil { + // TODO: Handle error. + } + //] +} diff --git a/vendor/cloud.google.com/go/firestore/internal/doc.template b/vendor/cloud.google.com/go/firestore/internal/doc.template new file mode 100644 index 000000000..6d428235a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/internal/doc.template @@ -0,0 +1,145 @@ +// Copyright 2017 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. + +// DO NOT EDIT doc.go. Modify internal/doc.template, then run make -C internal. + +/* +Package firestore provides a client for reading and writing to a Cloud Firestore +database. + +See https://cloud.google.com/firestore/docs for an introduction +to Cloud Firestore and additional help on using the Firestore API. + +Note: you can't use both Cloud Firestore and Cloud Datastore in the same +project. + +Creating a Client + +To start working with this package, create a client with a project ID: + +[NewClient] + +CollectionRefs and DocumentRefs + +In Firestore, documents are sets of key-value pairs, and collections are groups of +documents. A Firestore database consists of a hierarchy of alternating collections +and documents, referred to by slash-separated paths like +"States/California/Cities/SanFrancisco". + +This client is built around references to collections and documents. CollectionRefs +and DocumentRefs are lightweight values that refer to the corresponding database +entities. Creating a ref does not involve any network traffic. + +[refs] + +Reading + +Use DocumentRef.Get to read a document. The result is a DocumentSnapshot. +Call its Data method to obtain the entire document contents as a map. + +[docref.Get] + +You can also obtain a single field with DataAt, or extract the data into a struct +with DataTo. With the type definition + +[structDef] + +we can extract the document's data into a value of type State: + +[DataTo] + +Note that this client supports struct tags beginning with "firestore:" that work like +the tags of the encoding/json package, letting you rename fields, ignore them, or +omit their values when empty. + +To retrieve multiple documents from their references in a single call, use +Client.GetAll. + +[GetAll] + +Writing + +For writing individual documents, use the methods on DocumentReference. +Create creates a new document. + +[docref.Create] + +The first return value is a WriteResult, which contains the time +at which the document was updated. + +Create fails if the document exists. Another method, Set, either replaces an existing +document or creates a new one. + +[docref.Set] + +To update some fields of an existing document, use Update. It takes a list of +paths to update and their corresponding values. + +[docref.Update] + +Use DocumentRef.Delete to delete a document. + +[docref.Delete] + +Preconditions + +You can condition Deletes or Updates on when a document was last changed. Specify +these preconditions as an option to a Delete or Update method. The check and the +write happen atomically with a single RPC. + +[LUT-precond] + +Here we update a doc only if it hasn't changed since we read it. +You could also do this with a transaction. + +To perform multiple writes at once, use a WriteBatch. Its methods chain +for convenience. + +WriteBatch.Commit sends the collected writes to the server, where they happen +atomically. + +[WriteBatch] + +Queries + +You can use SQL to select documents from a collection. Begin with the collection, and +build up a query using Select, Where and other methods of Query. + +[Query] + +Call the Query's Documents method to get an iterator, and use it like +the other Google Cloud Client iterators. + +[Documents] + +To get all the documents in a collection, you can use the collection itself +as a query. + +[CollQuery] + +Transactions + +Use a transaction to execute reads and writes atomically. All reads must happen +before any writes. Transaction creation, commit, rollback and retry are handled for +you by the Client.RunTransaction method; just provide a function and use the +read and write methods of the Transaction passed to it. + +[Transaction] + +Authentication + +See examples of authorization and authentication at +https://godoc.org/cloud.google.com/go#pkg-examples. +*/ +package firestore diff --git a/vendor/cloud.google.com/go/firestore/internal/snipdoc.awk b/vendor/cloud.google.com/go/firestore/internal/snipdoc.awk new file mode 100644 index 000000000..98e788ebd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/internal/snipdoc.awk @@ -0,0 +1,116 @@ +# Copyright 2017 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. + +# snipdoc merges code snippets from Go source files into a template to +# produce another go file (typically doc.go). +# +# Call with one or more .go files and a template file. +# +# awk -f snipmd.awk foo.go bar.go doc.template +# +# In the Go files, start a snippet with +# //[ NAME +# and end it with +# //] +# +# In the template, write +# [NAME] +# on a line by itself to insert the snippet NAME on that line. +# +# The following transformations are made to the Go code: +# - Trailing blank lines are removed. +# - `ELLIPSIS` and `_ = ELLIPSIS` are replaced by `...` + + +/^[ \t]*\/\/\[/ { # start snippet in Go file + if (inGo()) { + if ($2 == "") { + die("missing snippet name") + } + curSnip = $2 + next + } +} + +/^[ \t]*\/\/]/ { # end snippet in Go file + if (inGo()) { + if (curSnip != "") { + # Remove all trailing newlines. + gsub(/[\t\n]+$/, "", snips[curSnip]) + curSnip = "" + next + } else { + die("//] without corresponding //[") + } + } +} + +ENDFILE { + if (curSnip != "") { + die("unclosed snippet: " curSnip) + } +} + +/^\[.*\]$/ { # Snippet marker in template file. + if (inTemplate()) { + name = substr($1, 2, length($1)-2) + if (snips[name] == "") { + die("no snippet named " name) + } + printf("%s\n", snips[name]) + afterSnip = 1 + next + } +} + +# Matches every line. +{ + if (curSnip != "") { + # If the first line in the snip has no indent, add the indent. + if (snips[curSnip] == "") { + if (index($0, "\t") == 1) { + extraIndent = "" + } else { + extraIndent = "\t" + } + } + + line = $0 + # Replace ELLIPSIS. + gsub(/_ = ELLIPSIS/, "...", line) + gsub(/ELLIPSIS/, "...", line) + + snips[curSnip] = snips[curSnip] extraIndent line "\n" + } else if (inTemplate()) { + afterSnip = 0 + # Copy to output. + print + } +} + + + +function inTemplate() { + return match(FILENAME, /\.template$/) +} + +function inGo() { + return match(FILENAME, /\.go$/) +} + + +function die(msg) { + printf("%s:%d: %s\n", FILENAME, FNR, msg) > "/dev/stderr" + exit 1 +} diff --git a/vendor/cloud.google.com/go/firestore/list_documents.go b/vendor/cloud.google.com/go/firestore/list_documents.go new file mode 100644 index 000000000..f056d7797 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/list_documents.go @@ -0,0 +1,104 @@ +// 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. + +package firestore + +import ( + "context" + + vkit "cloud.google.com/go/firestore/apiv1beta1" + "google.golang.org/api/iterator" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +// DocumentRefIterator is an interator over DocumentRefs. +type DocumentRefIterator struct { + client *Client + it *vkit.DocumentIterator + pageInfo *iterator.PageInfo + nextFunc func() error + items []*DocumentRef + err error +} + +func newDocumentRefIterator(ctx context.Context, cr *CollectionRef, tid []byte) *DocumentRefIterator { + client := cr.c + req := &pb.ListDocumentsRequest{ + Parent: cr.parentPath, + CollectionId: cr.ID, + ShowMissing: true, + Mask: &pb.DocumentMask{}, // empty mask: we want only the ref + } + if tid != nil { + req.ConsistencySelector = &pb.ListDocumentsRequest_Transaction{tid} + } + it := &DocumentRefIterator{ + client: client, + it: client.c.ListDocuments(withResourceHeader(ctx, client.path()), req), + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *DocumentRefIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next result. Its second return value is iterator.Done if there +// are no more results. Once Next returns Done, all subsequent calls will return +// Done. +func (it *DocumentRefIterator) Next() (*DocumentRef, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *DocumentRefIterator) fetch(pageSize int, pageToken string) (string, error) { + if it.err != nil { + return "", it.err + } + return iterFetch(pageSize, pageToken, it.it.PageInfo(), func() error { + docProto, err := it.it.Next() + if err != nil { + return err + } + docRef, err := pathToDoc(docProto.Name, it.client) + if err != nil { + return err + } + it.items = append(it.items, docRef) + return nil + }) +} + +// GetAll returns all the DocumentRefs remaining from the iterator. +func (it *DocumentRefIterator) GetAll() ([]*DocumentRef, error) { + var drs []*DocumentRef + for { + dr, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + return nil, err + } + drs = append(drs, dr) + } + return drs, nil +} diff --git a/vendor/cloud.google.com/go/firestore/mock_test.go b/vendor/cloud.google.com/go/firestore/mock_test.go new file mode 100644 index 000000000..a482a6c55 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/mock_test.go @@ -0,0 +1,226 @@ +// Copyright 2017 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 firestore + +// A simple mock server. + +import ( + "context" + "fmt" + "sort" + "strings" + + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type mockServer struct { + pb.FirestoreServer + + Addr string + + reqItems []reqItem + resps []interface{} +} + +type reqItem struct { + wantReq proto.Message + adjust func(gotReq proto.Message) +} + +func newMockServer() (*mockServer, error) { + srv, err := testutil.NewServer() + if err != nil { + return nil, err + } + mock := &mockServer{Addr: srv.Addr} + pb.RegisterFirestoreServer(srv.Gsrv, mock) + srv.Start() + return mock, nil +} + +// addRPC adds a (request, response) pair to the server's list of expected +// interactions. The server will compare the incoming request with wantReq +// using proto.Equal. The response can be a message or an error. +// +// For the Listen RPC, resp should be a []interface{}, where each element +// is either ListenResponse or an error. +// +// Passing nil for wantReq disables the request check. +func (s *mockServer) addRPC(wantReq proto.Message, resp interface{}) { + s.addRPCAdjust(wantReq, resp, nil) +} + +// addRPCAdjust is like addRPC, but accepts a function that can be used +// to tweak the requests before comparison, for example to adjust for +// randomness. +func (s *mockServer) addRPCAdjust(wantReq proto.Message, resp interface{}, adjust func(proto.Message)) { + s.reqItems = append(s.reqItems, reqItem{wantReq, adjust}) + s.resps = append(s.resps, resp) +} + +// popRPC compares the request with the next expected (request, response) pair. +// It returns the response, or an error if the request doesn't match what +// was expected or there are no expected rpcs. +func (s *mockServer) popRPC(gotReq proto.Message) (interface{}, error) { + if len(s.reqItems) == 0 { + panic("out of RPCs") + } + ri := s.reqItems[0] + s.reqItems = s.reqItems[1:] + if ri.wantReq != nil { + if ri.adjust != nil { + ri.adjust(gotReq) + } + + // Sort FieldTransforms by FieldPath, since slice order is undefined and proto.Equal + // is strict about order. + switch gotReqTyped := gotReq.(type) { + case *pb.CommitRequest: + for _, w := range gotReqTyped.Writes { + switch opTyped := w.Operation.(type) { + case *pb.Write_Transform: + sort.Sort(ByFieldPath(opTyped.Transform.FieldTransforms)) + } + } + } + + if !proto.Equal(gotReq, ri.wantReq) { + return nil, fmt.Errorf("mockServer: bad request\ngot: %T\n%s\nwant: %T\n%s", + gotReq, proto.MarshalTextString(gotReq), + ri.wantReq, proto.MarshalTextString(ri.wantReq)) + } + } + resp := s.resps[0] + s.resps = s.resps[1:] + if err, ok := resp.(error); ok { + return nil, err + } + return resp, nil +} + +func (a ByFieldPath) Len() int { return len(a) } +func (a ByFieldPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a ByFieldPath) Less(i, j int) bool { return a[i].FieldPath < a[j].FieldPath } + +type ByFieldPath []*pb.DocumentTransform_FieldTransform + +func (s *mockServer) reset() { + s.reqItems = nil + s.resps = nil +} + +func (s *mockServer) GetDocument(_ context.Context, req *pb.GetDocumentRequest) (*pb.Document, error) { + res, err := s.popRPC(req) + if err != nil { + return nil, err + } + return res.(*pb.Document), nil +} + +func (s *mockServer) Commit(_ context.Context, req *pb.CommitRequest) (*pb.CommitResponse, error) { + res, err := s.popRPC(req) + if err != nil { + return nil, err + } + return res.(*pb.CommitResponse), nil +} + +func (s *mockServer) BatchGetDocuments(req *pb.BatchGetDocumentsRequest, bs pb.Firestore_BatchGetDocumentsServer) error { + res, err := s.popRPC(req) + if err != nil { + return err + } + responses := res.([]interface{}) + for _, res := range responses { + switch res := res.(type) { + case *pb.BatchGetDocumentsResponse: + if err := bs.Send(res); err != nil { + return err + } + case error: + return res + default: + panic(fmt.Sprintf("bad response type in BatchGetDocuments: %+v", res)) + } + } + return nil +} + +func (s *mockServer) RunQuery(req *pb.RunQueryRequest, qs pb.Firestore_RunQueryServer) error { + res, err := s.popRPC(req) + if err != nil { + return err + } + responses := res.([]interface{}) + for _, res := range responses { + switch res := res.(type) { + case *pb.RunQueryResponse: + if err := qs.Send(res); err != nil { + return err + } + case error: + return res + default: + panic(fmt.Sprintf("bad response type in RunQuery: %+v", res)) + } + } + return nil +} + +func (s *mockServer) BeginTransaction(_ context.Context, req *pb.BeginTransactionRequest) (*pb.BeginTransactionResponse, error) { + res, err := s.popRPC(req) + if err != nil { + return nil, err + } + return res.(*pb.BeginTransactionResponse), nil +} + +func (s *mockServer) Rollback(_ context.Context, req *pb.RollbackRequest) (*empty.Empty, error) { + res, err := s.popRPC(req) + if err != nil { + return nil, err + } + return res.(*empty.Empty), nil +} + +func (s *mockServer) Listen(stream pb.Firestore_ListenServer) error { + req, err := stream.Recv() + if err != nil { + return err + } + responses, err := s.popRPC(req) + if err != nil { + if status.Code(err) == codes.Unknown && strings.Contains(err.Error(), "mockServer") { + // The stream will retry on Unknown, but we don't want that to happen if + // the error comes from us. + panic(err) + } + return err + } + for _, res := range responses.([]interface{}) { + if err, ok := res.(error); ok { + return err + } + if err := stream.Send(res.(*pb.ListenResponse)); err != nil { + return err + } + } + return nil +} diff --git a/vendor/cloud.google.com/go/firestore/options.go b/vendor/cloud.google.com/go/firestore/options.go new file mode 100644 index 000000000..ec6a2ae83 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/options.go @@ -0,0 +1,175 @@ +// Copyright 2017 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 firestore + +import ( + "errors" + "fmt" + "time" + + "github.com/golang/protobuf/ptypes" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +// A Precondition modifies a Firestore update or delete operation. +type Precondition interface { + // Returns the corresponding Precondition proto. + preconditionProto() (*pb.Precondition, error) +} + +// Exists is a Precondition that checks for the existence of a resource before +// writing to it. If the check fails, the write does not occur. +var Exists Precondition + +func init() { + // Initialize here so godoc doesn't show the internal value. + Exists = exists(true) +} + +type exists bool + +func (e exists) preconditionProto() (*pb.Precondition, error) { + return &pb.Precondition{ + ConditionType: &pb.Precondition_Exists{bool(e)}, + }, nil +} + +func (e exists) String() string { + if e { + return "Exists" + } + return "DoesNotExist" +} + +// LastUpdateTime returns a Precondition that checks that a resource must exist and +// must have last been updated at the given time. If the check fails, the write +// does not occur. +func LastUpdateTime(t time.Time) Precondition { return lastUpdateTime(t) } + +type lastUpdateTime time.Time + +func (u lastUpdateTime) preconditionProto() (*pb.Precondition, error) { + ts, err := ptypes.TimestampProto(time.Time(u)) + if err != nil { + return nil, err + } + return &pb.Precondition{ + ConditionType: &pb.Precondition_UpdateTime{ts}, + }, nil +} + +func (u lastUpdateTime) String() string { return fmt.Sprintf("LastUpdateTime(%s)", time.Time(u)) } + +func processPreconditionsForDelete(preconds []Precondition) (*pb.Precondition, error) { + // At most one option permitted. + switch len(preconds) { + case 0: + return nil, nil + case 1: + return preconds[0].preconditionProto() + default: + return nil, fmt.Errorf("firestore: conflicting preconditions: %+v", preconds) + } +} + +func processPreconditionsForUpdate(preconds []Precondition) (*pb.Precondition, error) { + // At most one option permitted, and it cannot be Exists. + switch len(preconds) { + case 0: + // If the user doesn't provide any options, default to Exists(true). + return exists(true).preconditionProto() + case 1: + if _, ok := preconds[0].(exists); ok { + return nil, errors.New("Cannot use Exists with Update") + } + return preconds[0].preconditionProto() + default: + return nil, fmt.Errorf("firestore: conflicting preconditions: %+v", preconds) + } +} + +func processPreconditionsForVerify(preconds []Precondition) (*pb.Precondition, error) { + // At most one option permitted. + switch len(preconds) { + case 0: + return nil, nil + case 1: + return preconds[0].preconditionProto() + default: + return nil, fmt.Errorf("firestore: conflicting preconditions: %+v", preconds) + } +} + +// A SetOption modifies a Firestore set operation. +type SetOption interface { + fieldPaths() (fps []FieldPath, all bool, err error) +} + +// MergeAll is a SetOption that causes all the field paths given in the data argument +// to Set to be overwritten. It is not supported for struct data. +var MergeAll SetOption = merge{all: true} + +// Merge returns a SetOption that causes only the given field paths to be +// overwritten. Other fields on the existing document will be untouched. It is an +// error if a provided field path does not refer to a value in the data passed to +// Set. +func Merge(fps ...FieldPath) SetOption { + for _, fp := range fps { + if err := fp.validate(); err != nil { + return merge{err: err} + } + } + return merge{paths: fps} +} + +type merge struct { + all bool + paths []FieldPath + err error +} + +func (m merge) String() string { + if m.err != nil { + return fmt.Sprintf("", m.err) + } + if m.all { + return "MergeAll" + } + return fmt.Sprintf("Merge(%+v)", m.paths) +} + +func (m merge) fieldPaths() (fps []FieldPath, all bool, err error) { + if m.err != nil { + return nil, false, m.err + } + if err := checkNoDupOrPrefix(m.paths); err != nil { + return nil, false, err + } + if m.all { + return nil, true, nil + } + return m.paths, false, nil +} + +func processSetOptions(opts []SetOption) (fps []FieldPath, all bool, err error) { + switch len(opts) { + case 0: + return nil, false, nil + case 1: + return opts[0].fieldPaths() + default: + return nil, false, fmt.Errorf("conflicting options: %+v", opts) + } +} diff --git a/vendor/cloud.google.com/go/firestore/options_test.go b/vendor/cloud.google.com/go/firestore/options_test.go new file mode 100644 index 000000000..999a0a610 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/options_test.go @@ -0,0 +1,151 @@ +// Copyright 2017 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 firestore + +import ( + "testing" + + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +func TestProcessPreconditionsForVerify(t *testing.T) { + for _, test := range []struct { + in []Precondition + want *pb.Precondition + wantErr bool + }{ + { + in: nil, + want: nil, + }, + { + in: []Precondition{}, + want: nil, + }, + { + in: []Precondition{Exists}, + want: &pb.Precondition{ConditionType: &pb.Precondition_Exists{true}}, + }, + { + in: []Precondition{LastUpdateTime(aTime)}, + want: &pb.Precondition{ConditionType: &pb.Precondition_UpdateTime{aTimestamp}}, + }, + { + in: []Precondition{Exists, LastUpdateTime(aTime)}, + wantErr: true, + }, + { + in: []Precondition{Exists, Exists}, + wantErr: true, + }, + } { + got, err := processPreconditionsForVerify(test.in) + switch { + case test.wantErr && err == nil: + t.Errorf("%v: got nil, want error", test.in) + case !test.wantErr && err != nil: + t.Errorf("%v: got <%v>, want no error", test.in, err) + case !test.wantErr && err == nil && !testEqual(got, test.want): + t.Errorf("%v: got %+v, want %v", test.in, got, test.want) + } + } +} + +func TestProcessPreconditionsForDelete(t *testing.T) { + for _, test := range []struct { + in []Precondition + want *pb.Precondition + wantErr bool + }{ + { + in: nil, + want: nil, + }, + { + in: []Precondition{}, + want: nil, + }, + { + in: []Precondition{Exists}, + want: &pb.Precondition{ConditionType: &pb.Precondition_Exists{true}}, + }, + { + in: []Precondition{LastUpdateTime(aTime)}, + want: &pb.Precondition{ConditionType: &pb.Precondition_UpdateTime{aTimestamp}}, + }, + { + in: []Precondition{Exists, LastUpdateTime(aTime)}, + wantErr: true, + }, + { + in: []Precondition{Exists, Exists}, + wantErr: true, + }, + } { + got, err := processPreconditionsForDelete(test.in) + switch { + case test.wantErr && err == nil: + t.Errorf("%v: got nil, want error", test.in) + case !test.wantErr && err != nil: + t.Errorf("%v: got <%v>, want no error", test.in, err) + case !test.wantErr && err == nil && !testEqual(got, test.want): + t.Errorf("%v: got %+v, want %v", test.in, got, test.want) + } + } +} + +func TestProcessPreconditionsForUpdate(t *testing.T) { + for _, test := range []struct { + in []Precondition + want *pb.Precondition + wantErr bool + }{ + { + in: nil, + want: &pb.Precondition{ConditionType: &pb.Precondition_Exists{true}}, + }, + { + in: []Precondition{}, + want: &pb.Precondition{ConditionType: &pb.Precondition_Exists{true}}, + }, + + { + in: []Precondition{Exists}, + wantErr: true, + }, + { + in: []Precondition{LastUpdateTime(aTime)}, + want: &pb.Precondition{ConditionType: &pb.Precondition_UpdateTime{aTimestamp}}, + }, + { + in: []Precondition{Exists, LastUpdateTime(aTime)}, + wantErr: true, + }, + { + in: []Precondition{Exists, Exists}, + wantErr: true, + }, + } { + got, err := processPreconditionsForUpdate(test.in) + switch { + case test.wantErr && err == nil: + t.Errorf("%v: got nil, want error", test.in) + case !test.wantErr && err != nil: + t.Errorf("%v: got <%v>, want no error", test.in, err) + case !test.wantErr && err == nil && !testEqual(got, test.want): + t.Errorf("%v: got %+v, want %v", test.in, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/firestore/order.go b/vendor/cloud.google.com/go/firestore/order.go new file mode 100644 index 000000000..c3f59ce18 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/order.go @@ -0,0 +1,216 @@ +// 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. + +package firestore + +import ( + "bytes" + "fmt" + "math" + "sort" + "strings" + + tspb "github.com/golang/protobuf/ptypes/timestamp" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +// Returns a negative number, zero, or a positive number depending on whether a is +// less than, equal to, or greater than b according to Firestore's ordering of +// values. +func compareValues(a, b *pb.Value) int { + ta := typeOrder(a) + tb := typeOrder(b) + if ta != tb { + return compareInt64s(int64(ta), int64(tb)) + } + switch a := a.ValueType.(type) { + case *pb.Value_NullValue: + return 0 // nulls are equal + + case *pb.Value_BooleanValue: + av := a.BooleanValue + bv := b.GetBooleanValue() + switch { + case av && !bv: + return 1 + case bv && !av: + return -1 + default: + return 0 + } + + case *pb.Value_IntegerValue: + return compareNumbers(float64(a.IntegerValue), toFloat(b)) + + case *pb.Value_DoubleValue: + return compareNumbers(a.DoubleValue, toFloat(b)) + + case *pb.Value_TimestampValue: + return compareTimestamps(a.TimestampValue, b.GetTimestampValue()) + + case *pb.Value_StringValue: + return strings.Compare(a.StringValue, b.GetStringValue()) + + case *pb.Value_BytesValue: + return bytes.Compare(a.BytesValue, b.GetBytesValue()) + + case *pb.Value_ReferenceValue: + return compareReferences(a.ReferenceValue, b.GetReferenceValue()) + + case *pb.Value_GeoPointValue: + ag := a.GeoPointValue + bg := b.GetGeoPointValue() + if ag.Latitude != bg.Latitude { + return compareFloat64s(ag.Latitude, bg.Latitude) + } + return compareFloat64s(ag.Longitude, bg.Longitude) + + case *pb.Value_ArrayValue: + return compareArrays(a.ArrayValue.Values, b.GetArrayValue().Values) + + case *pb.Value_MapValue: + return compareMaps(a.MapValue.Fields, b.GetMapValue().Fields) + + default: + panic(fmt.Sprintf("bad value type: %v", a)) + } +} + +// Treats NaN as less than any non-NaN. +func compareNumbers(a, b float64) int { + switch { + case math.IsNaN(a): + if math.IsNaN(b) { + return 0 + } + return -1 + case math.IsNaN(b): + return 1 + default: + return compareFloat64s(a, b) + } +} + +// Return v as a float64, assuming it's an Integer or Double. +func toFloat(v *pb.Value) float64 { + if x, ok := v.ValueType.(*pb.Value_IntegerValue); ok { + return float64(x.IntegerValue) + } + return v.GetDoubleValue() +} + +func compareTimestamps(a, b *tspb.Timestamp) int { + if c := compareInt64s(a.Seconds, b.Seconds); c != 0 { + return c + } + return compareInt64s(int64(a.Nanos), int64(b.Nanos)) +} + +func compareReferences(a, b string) int { + // Compare path components lexicographically. + pa := strings.Split(a, "/") + pb := strings.Split(b, "/") + return compareSequences(len(pa), len(pb), func(i int) int { + return strings.Compare(pa[i], pb[i]) + }) +} + +func compareArrays(a, b []*pb.Value) int { + return compareSequences(len(a), len(b), func(i int) int { + return compareValues(a[i], b[i]) + }) +} + +func compareMaps(a, b map[string]*pb.Value) int { + sortedKeys := func(m map[string]*pb.Value) []string { + var ks []string + for k := range m { + ks = append(ks, k) + } + sort.Strings(ks) + return ks + } + + aks := sortedKeys(a) + bks := sortedKeys(b) + return compareSequences(len(aks), len(bks), func(i int) int { + if c := strings.Compare(aks[i], bks[i]); c != 0 { + return c + } + k := aks[i] + return compareValues(a[k], b[k]) + }) +} + +func compareSequences(len1, len2 int, compare func(int) int) int { + for i := 0; i < len1 && i < len2; i++ { + if c := compare(i); c != 0 { + return c + } + } + return compareInt64s(int64(len1), int64(len2)) +} + +func compareFloat64s(a, b float64) int { + switch { + case a < b: + return -1 + case a > b: + return 1 + default: + return 0 + } +} + +func compareInt64s(a, b int64) int { + switch { + case a < b: + return -1 + case a > b: + return 1 + default: + return 0 + } +} + +// Return an integer corresponding to the type of value stored in v, such that +// comparing the resulting integers gives the Firestore ordering for types. +func typeOrder(v *pb.Value) int { + switch v.ValueType.(type) { + case *pb.Value_NullValue: + return 0 + case *pb.Value_BooleanValue: + return 1 + case *pb.Value_IntegerValue: + return 2 + case *pb.Value_DoubleValue: + return 2 + case *pb.Value_TimestampValue: + return 3 + case *pb.Value_StringValue: + return 4 + case *pb.Value_BytesValue: + return 5 + case *pb.Value_ReferenceValue: + return 6 + case *pb.Value_GeoPointValue: + return 7 + case *pb.Value_ArrayValue: + return 8 + case *pb.Value_MapValue: + return 9 + default: + panic(fmt.Sprintf("bad value type: %v", v)) + } +} diff --git a/vendor/cloud.google.com/go/firestore/order_test.go b/vendor/cloud.google.com/go/firestore/order_test.go new file mode 100644 index 000000000..ac8e06e20 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/order_test.go @@ -0,0 +1,118 @@ +// 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. + +package firestore + +import ( + "math" + "testing" + "time" + + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/genproto/googleapis/type/latlng" +) + +func TestCompareValues(t *testing.T) { + // Ordered list of values. + vals := []*pb.Value{ + nullValue, + boolval(false), + boolval(true), + floatval(math.NaN()), + floatval(math.Inf(-1)), + floatval(-math.MaxFloat64), + int64val(math.MinInt64), + floatval(-1.1), + intval(-1), + intval(0), + floatval(math.SmallestNonzeroFloat64), + intval(1), + floatval(1.1), + intval(2), + int64val(math.MaxInt64), + floatval(math.MaxFloat64), + floatval(math.Inf(1)), + tsval(time.Date(2016, 5, 20, 10, 20, 0, 0, time.UTC)), + tsval(time.Date(2016, 10, 21, 15, 32, 0, 0, time.UTC)), + strval(""), + strval("\u0000\ud7ff\ue000\uffff"), + strval("(╯°□°)╯︵ ┻━┻"), + strval("a"), + strval("abc def"), + strval("e\u0301b"), + strval("æ"), + strval("\u00e9a"), + bytesval([]byte{}), + bytesval([]byte{0}), + bytesval([]byte{0, 1, 2, 3, 4}), + bytesval([]byte{0, 1, 2, 4, 3}), + bytesval([]byte{255}), + refval("projects/p1/databases/d1/documents/c1/doc1"), + refval("projects/p1/databases/d1/documents/c1/doc2"), + refval("projects/p1/databases/d1/documents/c1/doc2/c2/doc1"), + refval("projects/p1/databases/d1/documents/c1/doc2/c2/doc2"), + refval("projects/p1/databases/d1/documents/c10/doc1"), + refval("projects/p1/databases/dkkkkklkjnjkkk1/documents/c2/doc1"), + refval("projects/p2/databases/d2/documents/c1/doc1"), + refval("projects/p2/databases/d2/documents/c1-/doc1"), + geopoint(-90, -180), + geopoint(-90, 0), + geopoint(-90, 180), + geopoint(0, -180), + geopoint(0, 0), + geopoint(0, 180), + geopoint(1, -180), + geopoint(1, 0), + geopoint(1, 180), + geopoint(90, -180), + geopoint(90, 0), + geopoint(90, 180), + arrayval(), + arrayval(strval("bar")), + arrayval(strval("foo")), + arrayval(strval("foo"), intval(1)), + arrayval(strval("foo"), intval(2)), + arrayval(strval("foo"), strval("0")), + mapval(map[string]*pb.Value{"bar": intval(0)}), + mapval(map[string]*pb.Value{"bar": intval(0), "foo": intval(1)}), + mapval(map[string]*pb.Value{"foo": intval(1)}), + mapval(map[string]*pb.Value{"foo": intval(2)}), + mapval(map[string]*pb.Value{"foo": strval("0")}), + } + + for i, v1 := range vals { + if got := compareValues(v1, v1); got != 0 { + t.Errorf("compare(%v, %v) == %d, want 0", v1, v1, got) + } + for _, v2 := range vals[i+1:] { + if got := compareValues(v1, v2); got != -1 { + t.Errorf("compare(%v, %v) == %d, want -1", v1, v2, got) + } + if got := compareValues(v2, v1); got != 1 { + t.Errorf("compare(%v, %v) == %d, want 1", v1, v2, got) + } + } + } + + // Integers and Doubles order the same. + n1 := intval(17) + n2 := floatval(17) + if got := compareValues(n1, n2); got != 0 { + t.Errorf("compare(%v, %v) == %d, want 0", n1, n2, got) + } +} + +func geopoint(lat, lng float64) *pb.Value { + return geoval(&latlng.LatLng{Latitude: lat, Longitude: lng}) +} diff --git a/vendor/cloud.google.com/go/firestore/query.go b/vendor/cloud.google.com/go/firestore/query.go new file mode 100644 index 000000000..71b0b3b59 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/query.go @@ -0,0 +1,781 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "errors" + "fmt" + "io" + "math" + "reflect" + "time" + + "cloud.google.com/go/internal/btree" + "github.com/golang/protobuf/ptypes/wrappers" + "google.golang.org/api/iterator" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +// Query represents a Firestore query. +// +// Query values are immutable. Each Query method creates +// a new Query; it does not modify the old. +type Query struct { + c *Client + parentPath string // path of the collection's parent + collectionID string + selection []FieldPath + filters []filter + orders []order + offset int32 + limit *wrappers.Int32Value + startVals, endVals []interface{} + startDoc, endDoc *DocumentSnapshot + startBefore, endBefore bool + err error +} + +func (q *Query) collectionPath() string { + return q.parentPath + "/documents/" + q.collectionID +} + +// DocumentID is the special field name representing the ID of a document +// in queries. +const DocumentID = "__name__" + +// Select returns a new Query that specifies the paths +// to return from the result documents. +// Each path argument can be a single field or a dot-separated sequence of +// fields, and must not contain any of the runes "˜*/[]". +// +// An empty Select call will produce a query that returns only document IDs. +func (q Query) Select(paths ...string) Query { + var fps []FieldPath + for _, s := range paths { + fp, err := parseDotSeparatedString(s) + if err != nil { + q.err = err + return q + } + fps = append(fps, fp) + } + return q.SelectPaths(fps...) +} + +// SelectPaths returns a new Query that specifies the field paths +// to return from the result documents. +// +// An empty SelectPaths call will produce a query that returns only document IDs. +func (q Query) SelectPaths(fieldPaths ...FieldPath) Query { + if len(fieldPaths) == 0 { + q.selection = []FieldPath{{DocumentID}} + } else { + q.selection = fieldPaths + } + return q +} + +// Where returns a new Query that filters the set of results. +// A Query can have multiple filters. +// The path argument can be a single field or a dot-separated sequence of +// fields, and must not contain any of the runes "˜*/[]". +// The op argument must be one of "==", "<", "<=", ">" or ">=". +func (q Query) Where(path, op string, value interface{}) Query { + fp, err := parseDotSeparatedString(path) + if err != nil { + q.err = err + return q + } + q.filters = append(append([]filter(nil), q.filters...), filter{fp, op, value}) + return q +} + +// WherePath returns a new Query that filters the set of results. +// A Query can have multiple filters. +// The op argument must be one of "==", "<", "<=", ">" or ">=". +func (q Query) WherePath(fp FieldPath, op string, value interface{}) Query { + q.filters = append(append([]filter(nil), q.filters...), filter{fp, op, value}) + return q +} + +// Direction is the sort direction for result ordering. +type Direction int32 + +const ( + // Asc sorts results from smallest to largest. + Asc Direction = Direction(pb.StructuredQuery_ASCENDING) + + // Desc sorts results from largest to smallest. + Desc Direction = Direction(pb.StructuredQuery_DESCENDING) +) + +// OrderBy returns a new Query that specifies the order in which results are +// returned. A Query can have multiple OrderBy/OrderByPath specifications. OrderBy +// appends the specification to the list of existing ones. +// +// The path argument can be a single field or a dot-separated sequence of +// fields, and must not contain any of the runes "˜*/[]". +// +// To order by document name, use the special field path DocumentID. +func (q Query) OrderBy(path string, dir Direction) Query { + fp, err := parseDotSeparatedString(path) + if err != nil { + q.err = err + return q + } + q.orders = append(q.copyOrders(), order{fp, dir}) + return q +} + +// OrderByPath returns a new Query that specifies the order in which results are +// returned. A Query can have multiple OrderBy/OrderByPath specifications. +// OrderByPath appends the specification to the list of existing ones. +func (q Query) OrderByPath(fp FieldPath, dir Direction) Query { + q.orders = append(q.copyOrders(), order{fp, dir}) + return q +} + +func (q *Query) copyOrders() []order { + return append([]order(nil), q.orders...) +} + +// Offset returns a new Query that specifies the number of initial results to skip. +// It must not be negative. +func (q Query) Offset(n int) Query { + q.offset = trunc32(n) + return q +} + +// Limit returns a new Query that specifies the maximum number of results to return. +// It must not be negative. +func (q Query) Limit(n int) Query { + q.limit = &wrappers.Int32Value{Value: trunc32(n)} + return q +} + +// StartAt returns a new Query that specifies that results should start at +// the document with the given field values. +// +// If StartAt is called with a single DocumentSnapshot, its field values are used. +// The DocumentSnapshot must have all the fields mentioned in the OrderBy clauses. +// +// Otherwise, StartAt should be called with one field value for each OrderBy clause, +// in the order that they appear. For example, in +// q.OrderBy("X", Asc).OrderBy("Y", Desc).StartAt(1, 2) +// results will begin at the first document where X = 1 and Y = 2. +// +// If an OrderBy call uses the special DocumentID field path, the corresponding value +// should be the document ID relative to the query's collection. For example, to +// start at the document "NewYork" in the "States" collection, write +// +// client.Collection("States").OrderBy(DocumentID, firestore.Asc).StartAt("NewYork") +// +// Calling StartAt overrides a previous call to StartAt or StartAfter. +func (q Query) StartAt(docSnapshotOrFieldValues ...interface{}) Query { + q.startBefore = true + q.startVals, q.startDoc, q.err = q.processCursorArg("StartAt", docSnapshotOrFieldValues) + return q +} + +// StartAfter returns a new Query that specifies that results should start just after +// the document with the given field values. See Query.StartAt for more information. +// +// Calling StartAfter overrides a previous call to StartAt or StartAfter. +func (q Query) StartAfter(docSnapshotOrFieldValues ...interface{}) Query { + q.startBefore = false + q.startVals, q.startDoc, q.err = q.processCursorArg("StartAfter", docSnapshotOrFieldValues) + return q +} + +// EndAt returns a new Query that specifies that results should end at the +// document with the given field values. See Query.StartAt for more information. +// +// Calling EndAt overrides a previous call to EndAt or EndBefore. +func (q Query) EndAt(docSnapshotOrFieldValues ...interface{}) Query { + q.endBefore = false + q.endVals, q.endDoc, q.err = q.processCursorArg("EndAt", docSnapshotOrFieldValues) + return q +} + +// EndBefore returns a new Query that specifies that results should end just before +// the document with the given field values. See Query.StartAt for more information. +// +// Calling EndBefore overrides a previous call to EndAt or EndBefore. +func (q Query) EndBefore(docSnapshotOrFieldValues ...interface{}) Query { + q.endBefore = true + q.endVals, q.endDoc, q.err = q.processCursorArg("EndBefore", docSnapshotOrFieldValues) + return q +} + +func (q *Query) processCursorArg(name string, docSnapshotOrFieldValues []interface{}) ([]interface{}, *DocumentSnapshot, error) { + for _, e := range docSnapshotOrFieldValues { + if ds, ok := e.(*DocumentSnapshot); ok { + if len(docSnapshotOrFieldValues) == 1 { + return nil, ds, nil + } + return nil, nil, fmt.Errorf("firestore: a document snapshot must be the only argument to %s", name) + } + } + return docSnapshotOrFieldValues, nil, nil +} + +func (q Query) query() *Query { return &q } + +func (q Query) toProto() (*pb.StructuredQuery, error) { + if q.err != nil { + return nil, q.err + } + if q.collectionID == "" { + return nil, errors.New("firestore: query created without CollectionRef") + } + if q.startBefore { + if len(q.startVals) == 0 && q.startDoc == nil { + return nil, errors.New("firestore: StartAt/StartAfter must be called with at least one value") + } + } + if q.endBefore { + if len(q.endVals) == 0 && q.endDoc == nil { + return nil, errors.New("firestore: EndAt/EndBefore must be called with at least one value") + } + } + p := &pb.StructuredQuery{ + From: []*pb.StructuredQuery_CollectionSelector{{CollectionId: q.collectionID}}, + Offset: q.offset, + Limit: q.limit, + } + if len(q.selection) > 0 { + p.Select = &pb.StructuredQuery_Projection{} + for _, fp := range q.selection { + if err := fp.validate(); err != nil { + return nil, err + } + p.Select.Fields = append(p.Select.Fields, fref(fp)) + } + } + // If there is only filter, use it directly. Otherwise, construct + // a CompositeFilter. + if len(q.filters) == 1 { + pf, err := q.filters[0].toProto() + if err != nil { + return nil, err + } + p.Where = pf + } else if len(q.filters) > 1 { + cf := &pb.StructuredQuery_CompositeFilter{ + Op: pb.StructuredQuery_CompositeFilter_AND, + } + p.Where = &pb.StructuredQuery_Filter{ + FilterType: &pb.StructuredQuery_Filter_CompositeFilter{cf}, + } + for _, f := range q.filters { + pf, err := f.toProto() + if err != nil { + return nil, err + } + cf.Filters = append(cf.Filters, pf) + } + } + orders := q.orders + if q.startDoc != nil || q.endDoc != nil { + orders = q.adjustOrders() + } + for _, ord := range orders { + po, err := ord.toProto() + if err != nil { + return nil, err + } + p.OrderBy = append(p.OrderBy, po) + } + + cursor, err := q.toCursor(q.startVals, q.startDoc, q.startBefore, orders) + if err != nil { + return nil, err + } + p.StartAt = cursor + cursor, err = q.toCursor(q.endVals, q.endDoc, q.endBefore, orders) + if err != nil { + return nil, err + } + p.EndAt = cursor + return p, nil +} + +// If there is a start/end that uses a Document Snapshot, we may need to adjust the OrderBy +// clauses that the user provided: we add OrderBy(__name__) if it isn't already present, and +// we make sure we don't invalidate the original query by adding an OrderBy for inequality filters. +func (q *Query) adjustOrders() []order { + // If the user is already ordering by document ID, don't change anything. + for _, ord := range q.orders { + if ord.isDocumentID() { + return q.orders + } + } + // If there are OrderBy clauses, append an OrderBy(DocumentID), using the direction of the last OrderBy clause. + if len(q.orders) > 0 { + return append(q.copyOrders(), order{ + fieldPath: FieldPath{DocumentID}, + dir: q.orders[len(q.orders)-1].dir, + }) + } + // If there are no OrderBy clauses but there is an inequality, add an OrderBy clause + // for the field of the first inequality. + var orders []order + for _, f := range q.filters { + if f.op != "==" { + orders = []order{{fieldPath: f.fieldPath, dir: Asc}} + break + } + } + // Add an ascending OrderBy(DocumentID). + return append(orders, order{fieldPath: FieldPath{DocumentID}, dir: Asc}) +} + +func (q *Query) toCursor(fieldValues []interface{}, ds *DocumentSnapshot, before bool, orders []order) (*pb.Cursor, error) { + var vals []*pb.Value + var err error + if ds != nil { + vals, err = q.docSnapshotToCursorValues(ds, orders) + } else if len(fieldValues) != 0 { + vals, err = q.fieldValuesToCursorValues(fieldValues) + } else { + return nil, nil + } + if err != nil { + return nil, err + } + return &pb.Cursor{Values: vals, Before: before}, nil +} + +// toPositionValues converts the field values to protos. +func (q *Query) fieldValuesToCursorValues(fieldValues []interface{}) ([]*pb.Value, error) { + if len(fieldValues) != len(q.orders) { + return nil, errors.New("firestore: number of field values in StartAt/StartAfter/EndAt/EndBefore does not match number of OrderBy fields") + } + vals := make([]*pb.Value, len(fieldValues)) + var err error + for i, ord := range q.orders { + fval := fieldValues[i] + if ord.isDocumentID() { + // TODO(jba): support DocumentRefs as well as strings. + // TODO(jba): error if document ref does not belong to the right collection. + docID, ok := fval.(string) + if !ok { + return nil, fmt.Errorf("firestore: expected doc ID for DocumentID field, got %T", fval) + } + vals[i] = &pb.Value{ValueType: &pb.Value_ReferenceValue{q.collectionPath() + "/" + docID}} + } else { + var sawTransform bool + vals[i], sawTransform, err = toProtoValue(reflect.ValueOf(fval)) + if err != nil { + return nil, err + } + if sawTransform { + return nil, errors.New("firestore: transforms disallowed in query value") + } + } + } + return vals, nil +} + +func (q *Query) docSnapshotToCursorValues(ds *DocumentSnapshot, orders []order) ([]*pb.Value, error) { + // TODO(jba): error if doc snap does not belong to the right collection. + vals := make([]*pb.Value, len(orders)) + for i, ord := range orders { + if ord.isDocumentID() { + dp, qp := ds.Ref.Parent.Path, q.collectionPath() + if dp != qp { + return nil, fmt.Errorf("firestore: document snapshot for %s passed to query on %s", dp, qp) + } + vals[i] = &pb.Value{ValueType: &pb.Value_ReferenceValue{ds.Ref.Path}} + } else { + val, err := valueAtPath(ord.fieldPath, ds.proto.Fields) + if err != nil { + return nil, err + } + vals[i] = val + } + } + return vals, nil +} + +// Returns a function that compares DocumentSnapshots according to q's ordering. +func (q Query) compareFunc() func(d1, d2 *DocumentSnapshot) (int, error) { + // Add implicit sorting by name, using the last specified direction. + lastDir := Asc + if len(q.orders) > 0 { + lastDir = q.orders[len(q.orders)-1].dir + } + orders := append(q.copyOrders(), order{[]string{DocumentID}, lastDir}) + return func(d1, d2 *DocumentSnapshot) (int, error) { + for _, ord := range orders { + var cmp int + if len(ord.fieldPath) == 1 && ord.fieldPath[0] == DocumentID { + cmp = compareReferences(d1.Ref.Path, d2.Ref.Path) + } else { + v1, err := valueAtPath(ord.fieldPath, d1.proto.Fields) + if err != nil { + return 0, err + } + v2, err := valueAtPath(ord.fieldPath, d2.proto.Fields) + if err != nil { + return 0, err + } + cmp = compareValues(v1, v2) + } + if cmp != 0 { + if ord.dir == Desc { + cmp = -cmp + } + return cmp, nil + } + } + return 0, nil + } +} + +type filter struct { + fieldPath FieldPath + op string + value interface{} +} + +func (f filter) toProto() (*pb.StructuredQuery_Filter, error) { + if err := f.fieldPath.validate(); err != nil { + return nil, err + } + if uop, ok := unaryOpFor(f.value); ok { + if f.op != "==" { + return nil, fmt.Errorf("firestore: must use '==' when comparing %v", f.value) + } + return &pb.StructuredQuery_Filter{ + FilterType: &pb.StructuredQuery_Filter_UnaryFilter{ + UnaryFilter: &pb.StructuredQuery_UnaryFilter{ + OperandType: &pb.StructuredQuery_UnaryFilter_Field{ + Field: fref(f.fieldPath), + }, + Op: uop, + }, + }, + }, nil + } + var op pb.StructuredQuery_FieldFilter_Operator + switch f.op { + case "<": + op = pb.StructuredQuery_FieldFilter_LESS_THAN + case "<=": + op = pb.StructuredQuery_FieldFilter_LESS_THAN_OR_EQUAL + case ">": + op = pb.StructuredQuery_FieldFilter_GREATER_THAN + case ">=": + op = pb.StructuredQuery_FieldFilter_GREATER_THAN_OR_EQUAL + case "==": + op = pb.StructuredQuery_FieldFilter_EQUAL + case "array-contains": + op = pb.StructuredQuery_FieldFilter_ARRAY_CONTAINS + default: + return nil, fmt.Errorf("firestore: invalid operator %q", f.op) + } + val, sawTransform, err := toProtoValue(reflect.ValueOf(f.value)) + if err != nil { + return nil, err + } + if sawTransform { + return nil, errors.New("firestore: transforms disallowed in query value") + } + return &pb.StructuredQuery_Filter{ + FilterType: &pb.StructuredQuery_Filter_FieldFilter{ + FieldFilter: &pb.StructuredQuery_FieldFilter{ + Field: fref(f.fieldPath), + Op: op, + Value: val, + }, + }, + }, nil +} + +func unaryOpFor(value interface{}) (pb.StructuredQuery_UnaryFilter_Operator, bool) { + switch { + case value == nil: + return pb.StructuredQuery_UnaryFilter_IS_NULL, true + case isNaN(value): + return pb.StructuredQuery_UnaryFilter_IS_NAN, true + default: + return pb.StructuredQuery_UnaryFilter_OPERATOR_UNSPECIFIED, false + } +} + +func isNaN(x interface{}) bool { + switch x := x.(type) { + case float32: + return math.IsNaN(float64(x)) + case float64: + return math.IsNaN(x) + default: + return false + } +} + +type order struct { + fieldPath FieldPath + dir Direction +} + +func (r order) isDocumentID() bool { + return len(r.fieldPath) == 1 && r.fieldPath[0] == DocumentID +} + +func (r order) toProto() (*pb.StructuredQuery_Order, error) { + if err := r.fieldPath.validate(); err != nil { + return nil, err + } + return &pb.StructuredQuery_Order{ + Field: fref(r.fieldPath), + Direction: pb.StructuredQuery_Direction(r.dir), + }, nil +} + +func fref(fp FieldPath) *pb.StructuredQuery_FieldReference { + return &pb.StructuredQuery_FieldReference{FieldPath: fp.toServiceFieldPath()} +} + +func trunc32(i int) int32 { + if i > math.MaxInt32 { + i = math.MaxInt32 + } + return int32(i) +} + +// Documents returns an iterator over the query's resulting documents. +func (q Query) Documents(ctx context.Context) *DocumentIterator { + return &DocumentIterator{ + iter: newQueryDocumentIterator(withResourceHeader(ctx, q.c.path()), &q, nil), + err: checkTransaction(ctx), + } +} + +// DocumentIterator is an iterator over documents returned by a query. +type DocumentIterator struct { + iter docIterator + err error +} + +// Unexported interface so we can have two different kinds of DocumentIterator: one +// for straight queries, and one for query snapshots. We do it this way instead of +// making DocumentIterator an interface because in the client libraries, iterators are +// always concrete types, and the fact that this one has two different implementations +// is an internal detail. +type docIterator interface { + next() (*DocumentSnapshot, error) + stop() +} + +// Next returns the next result. Its second return value is iterator.Done if there +// are no more results. Once Next returns Done, all subsequent calls will return +// Done. +func (it *DocumentIterator) Next() (*DocumentSnapshot, error) { + if it.err != nil { + return nil, it.err + } + ds, err := it.iter.next() + if err != nil { + it.err = err + } + return ds, err +} + +// Stop stops the iterator, freeing its resources. +// Always call Stop when you are done with a DocumentIterator. +// It is not safe to call Stop concurrently with Next. +func (it *DocumentIterator) Stop() { + if it.iter != nil { // possible in error cases + it.iter.stop() + } + if it.err == nil { + it.err = iterator.Done + } +} + +// GetAll returns all the documents remaining from the iterator. +// It is not necessary to call Stop on the iterator after calling GetAll. +func (it *DocumentIterator) GetAll() ([]*DocumentSnapshot, error) { + defer it.Stop() + var docs []*DocumentSnapshot + for { + doc, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + return nil, err + } + docs = append(docs, doc) + } + return docs, nil +} + +type queryDocumentIterator struct { + ctx context.Context + cancel func() + q *Query + tid []byte // transaction ID, if any + streamClient pb.Firestore_RunQueryClient +} + +func newQueryDocumentIterator(ctx context.Context, q *Query, tid []byte) *queryDocumentIterator { + ctx, cancel := context.WithCancel(ctx) + return &queryDocumentIterator{ + ctx: ctx, + cancel: cancel, + q: q, + tid: tid, + } +} + +func (it *queryDocumentIterator) next() (*DocumentSnapshot, error) { + client := it.q.c + if it.streamClient == nil { + sq, err := it.q.toProto() + if err != nil { + return nil, err + } + req := &pb.RunQueryRequest{ + Parent: it.q.parentPath, + QueryType: &pb.RunQueryRequest_StructuredQuery{sq}, + } + if it.tid != nil { + req.ConsistencySelector = &pb.RunQueryRequest_Transaction{it.tid} + } + it.streamClient, err = client.c.RunQuery(it.ctx, req) + if err != nil { + return nil, err + } + } + var res *pb.RunQueryResponse + var err error + for { + res, err = it.streamClient.Recv() + if err == io.EOF { + return nil, iterator.Done + } + if err != nil { + return nil, err + } + if res.Document != nil { + break + } + // No document => partial progress; keep receiving. + } + docRef, err := pathToDoc(res.Document.Name, client) + if err != nil { + return nil, err + } + doc, err := newDocumentSnapshot(docRef, res.Document, client, res.ReadTime) + if err != nil { + return nil, err + } + return doc, nil +} + +func (it *queryDocumentIterator) stop() { + it.cancel() +} + +// Snapshots returns an iterator over snapshots of the query. Each time the query +// results change, a new snapshot will be generated. +func (q Query) Snapshots(ctx context.Context) *QuerySnapshotIterator { + ws, err := newWatchStreamForQuery(ctx, q) + if err != nil { + return &QuerySnapshotIterator{err: err} + } + return &QuerySnapshotIterator{ + Query: q, + ws: ws, + } +} + +// QuerySnapshotIterator is an iterator over snapshots of a query. +// Call Next on the iterator to get a snapshot of the query's results each time they change. +// Call Stop on the iterator when done. +// +// For an example, see Query.Snapshots. +type QuerySnapshotIterator struct { + // The Query used to construct this iterator. + Query Query + + ws *watchStream + err error +} + +// Next blocks until the query's results change, then returns a QuerySnapshot for +// the current results. +// +// Next never returns iterator.Done unless it is called after Stop. +func (it *QuerySnapshotIterator) Next() (*QuerySnapshot, error) { + if it.err != nil { + return nil, it.err + } + btree, changes, readTime, err := it.ws.nextSnapshot() + if err != nil { + if err == io.EOF { + err = iterator.Done + } + it.err = err + return nil, it.err + } + return &QuerySnapshot{ + Documents: &DocumentIterator{ + iter: (*btreeDocumentIterator)(btree.BeforeIndex(0)), + }, + Size: btree.Len(), + Changes: changes, + ReadTime: readTime, + }, nil +} + +// Stop stops receiving snapshots. You should always call Stop when you are done with +// a QuerySnapshotIterator, to free up resources. It is not safe to call Stop +// concurrently with Next. +func (it *QuerySnapshotIterator) Stop() { + it.ws.stop() +} + +// A QuerySnapshot is a snapshot of query results. It is returned by +// QuerySnapshotIterator.Next whenever the results of a query change. +type QuerySnapshot struct { + // An iterator over the query results. + // It is not necessary to call Stop on this iterator. + Documents *DocumentIterator + + // The number of results in this snapshot. + Size int + + // The changes since the previous snapshot. + Changes []DocumentChange + + // The time at which this snapshot was obtained from Firestore. + ReadTime time.Time +} + +type btreeDocumentIterator btree.Iterator + +func (it *btreeDocumentIterator) next() (*DocumentSnapshot, error) { + if !(*btree.Iterator)(it).Next() { + return nil, iterator.Done + } + return it.Key.(*DocumentSnapshot), nil +} + +func (*btreeDocumentIterator) stop() {} diff --git a/vendor/cloud.google.com/go/firestore/query_test.go b/vendor/cloud.google.com/go/firestore/query_test.go new file mode 100644 index 000000000..4c25d95ea --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/query_test.go @@ -0,0 +1,717 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "math" + "sort" + "testing" + + "cloud.google.com/go/internal/pretty" + tspb "github.com/golang/protobuf/ptypes/timestamp" + "github.com/golang/protobuf/ptypes/wrappers" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +func TestFilterToProto(t *testing.T) { + for _, test := range []struct { + in filter + want *pb.StructuredQuery_Filter + }{ + { + filter{[]string{"a"}, ">", 1}, + &pb.StructuredQuery_Filter{FilterType: &pb.StructuredQuery_Filter_FieldFilter{ + FieldFilter: &pb.StructuredQuery_FieldFilter{ + Field: &pb.StructuredQuery_FieldReference{FieldPath: "a"}, + Op: pb.StructuredQuery_FieldFilter_GREATER_THAN, + Value: intval(1), + }, + }}, + }, + { + filter{[]string{"a"}, "==", nil}, + &pb.StructuredQuery_Filter{FilterType: &pb.StructuredQuery_Filter_UnaryFilter{ + UnaryFilter: &pb.StructuredQuery_UnaryFilter{ + OperandType: &pb.StructuredQuery_UnaryFilter_Field{ + Field: &pb.StructuredQuery_FieldReference{FieldPath: "a"}, + }, + Op: pb.StructuredQuery_UnaryFilter_IS_NULL, + }, + }}, + }, + { + filter{[]string{"a"}, "==", math.NaN()}, + &pb.StructuredQuery_Filter{FilterType: &pb.StructuredQuery_Filter_UnaryFilter{ + UnaryFilter: &pb.StructuredQuery_UnaryFilter{ + OperandType: &pb.StructuredQuery_UnaryFilter_Field{ + Field: &pb.StructuredQuery_FieldReference{FieldPath: "a"}, + }, + Op: pb.StructuredQuery_UnaryFilter_IS_NAN, + }, + }}, + }, + } { + got, err := test.in.toProto() + if err != nil { + t.Fatal(err) + } + if !testEqual(got, test.want) { + t.Errorf("%+v:\ngot\n%v\nwant\n%v", test.in, pretty.Value(got), pretty.Value(test.want)) + } + } +} + +func TestQueryToProto(t *testing.T) { + filtr := func(path []string, op string, val interface{}) *pb.StructuredQuery_Filter { + f, err := filter{path, op, val}.toProto() + if err != nil { + t.Fatal(err) + } + return f + } + + c := &Client{projectID: "P", databaseID: "DB"} + coll := c.Collection("C") + q := coll.Query + docsnap := &DocumentSnapshot{ + Ref: coll.Doc("D"), + proto: &pb.Document{ + Fields: map[string]*pb.Value{"a": intval(7), "b": intval(8), "c": arrayval(intval(1), intval(2))}, + }, + } + for _, test := range []struct { + desc string + in Query + want *pb.StructuredQuery + }{ + { + desc: "q.Select()", + in: q.Select(), + want: &pb.StructuredQuery{ + Select: &pb.StructuredQuery_Projection{ + Fields: []*pb.StructuredQuery_FieldReference{fref1("__name__")}, + }, + }, + }, + { + desc: `q.Select("a", "b")`, + in: q.Select("a", "b"), + want: &pb.StructuredQuery{ + Select: &pb.StructuredQuery_Projection{ + Fields: []*pb.StructuredQuery_FieldReference{fref1("a"), fref1("b")}, + }, + }, + }, + { + desc: `q.Select("a", "b").Select("c")`, + in: q.Select("a", "b").Select("c"), // last wins + want: &pb.StructuredQuery{ + Select: &pb.StructuredQuery_Projection{ + Fields: []*pb.StructuredQuery_FieldReference{fref1("c")}, + }, + }, + }, + { + desc: `q.SelectPaths([]string{"*"}, []string{"/"})`, + in: q.SelectPaths([]string{"*"}, []string{"/"}), + want: &pb.StructuredQuery{ + Select: &pb.StructuredQuery_Projection{ + Fields: []*pb.StructuredQuery_FieldReference{fref1("*"), fref1("/")}, + }, + }, + }, + { + desc: `q.Where("a", ">", 5)`, + in: q.Where("a", ">", 5), + want: &pb.StructuredQuery{Where: filtr([]string{"a"}, ">", 5)}, + }, + { + desc: `q.Where("a", "==", NaN)`, + in: q.Where("a", "==", float32(math.NaN())), + want: &pb.StructuredQuery{Where: filtr([]string{"a"}, "==", math.NaN())}, + }, + { + desc: `q.Where("c", "array-contains", 1)`, + in: q.Where("c", "array-contains", 1), + want: &pb.StructuredQuery{Where: filtr([]string{"c"}, "array-contains", 1)}, + }, + { + desc: `q.Where("a", ">", 5).Where("b", "<", "foo")`, + in: q.Where("a", ">", 5).Where("b", "<", "foo"), + want: &pb.StructuredQuery{ + Where: &pb.StructuredQuery_Filter{ + FilterType: &pb.StructuredQuery_Filter_CompositeFilter{ + &pb.StructuredQuery_CompositeFilter{ + Op: pb.StructuredQuery_CompositeFilter_AND, + Filters: []*pb.StructuredQuery_Filter{ + filtr([]string{"a"}, ">", 5), filtr([]string{"b"}, "<", "foo"), + }, + }, + }, + }, + }, + }, + { + desc: ` q.WherePath([]string{"/", "*"}, ">", 5)`, + in: q.WherePath([]string{"/", "*"}, ">", 5), + want: &pb.StructuredQuery{Where: filtr([]string{"/", "*"}, ">", 5)}, + }, + { + desc: `q.OrderBy("b", Asc).OrderBy("a", Desc).OrderByPath([]string{"~"}, Asc)`, + in: q.OrderBy("b", Asc).OrderBy("a", Desc).OrderByPath([]string{"~"}, Asc), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("b"), Direction: pb.StructuredQuery_ASCENDING}, + {Field: fref1("a"), Direction: pb.StructuredQuery_DESCENDING}, + {Field: fref1("~"), Direction: pb.StructuredQuery_ASCENDING}, + }, + }, + }, + { + desc: `q.Offset(2).Limit(3)`, + in: q.Offset(2).Limit(3), + want: &pb.StructuredQuery{ + Offset: 2, + Limit: &wrappers.Int32Value{Value: 3}, + }, + }, + { + desc: `q.Offset(2).Limit(3).Limit(4).Offset(5)`, + in: q.Offset(2).Limit(3).Limit(4).Offset(5), // last wins + want: &pb.StructuredQuery{ + Offset: 5, + Limit: &wrappers.Int32Value{Value: 4}, + }, + }, + { + desc: `q.OrderBy("a", Asc).StartAt(7).EndBefore(9)`, + in: q.OrderBy("a", Asc).StartAt(7).EndBefore(9), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(7)}, + Before: true, + }, + EndAt: &pb.Cursor{ + Values: []*pb.Value{intval(9)}, + Before: true, + }, + }, + }, + { + desc: `q.OrderBy("a", Asc).StartAt(7).EndAt(9)`, + in: q.OrderBy("a", Asc).StartAt(7).EndAt(9), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(7)}, + Before: true, + }, + EndAt: &pb.Cursor{ + Values: []*pb.Value{intval(9)}, + Before: false, + }, + }, + }, + { + desc: `q.OrderBy("a", Asc).StartAfter(7).EndAt(9)`, + in: q.OrderBy("a", Asc).StartAfter(7).EndAt(9), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(7)}, + Before: false, + }, + EndAt: &pb.Cursor{ + Values: []*pb.Value{intval(9)}, + Before: false, + }, + }, + }, + { + desc: `q.OrderBy(DocumentID, Asc).StartAfter("foo").EndBefore("bar")`, + in: q.OrderBy(DocumentID, Asc).StartAfter("foo").EndBefore("bar"), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("__name__"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{refval(coll.parentPath + "/documents/C/foo")}, + Before: false, + }, + EndAt: &pb.Cursor{ + Values: []*pb.Value{refval(coll.parentPath + "/documents/C/bar")}, + Before: true, + }, + }, + }, + { + desc: `q.OrderBy("a", Asc).OrderBy("b", Desc).StartAfter(7, 8).EndAt(9, 10)`, + in: q.OrderBy("a", Asc).OrderBy("b", Desc).StartAfter(7, 8).EndAt(9, 10), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_ASCENDING}, + {Field: fref1("b"), Direction: pb.StructuredQuery_DESCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(7), intval(8)}, + Before: false, + }, + EndAt: &pb.Cursor{ + Values: []*pb.Value{intval(9), intval(10)}, + Before: false, + }, + }, + }, + { + // last of StartAt/After wins, same for End + desc: `q.OrderBy("a", Asc).StartAfter(1).StartAt(2).EndAt(3).EndBefore(4)`, + in: q.OrderBy("a", Asc). + StartAfter(1).StartAt(2). + EndAt(3).EndBefore(4), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(2)}, + Before: true, + }, + EndAt: &pb.Cursor{ + Values: []*pb.Value{intval(4)}, + Before: true, + }, + }, + }, + // Start/End with DocumentSnapshot + // These tests are from the "Document Snapshot Cursors" doc. + { + desc: `q.StartAt(docsnap)`, + in: q.StartAt(docsnap), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("__name__"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{refval(coll.parentPath + "/documents/C/D")}, + Before: true, + }, + }, + }, + { + desc: `q.OrderBy("a", Asc).StartAt(docsnap)`, + in: q.OrderBy("a", Asc).StartAt(docsnap), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_ASCENDING}, + {Field: fref1("__name__"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(7), refval(coll.parentPath + "/documents/C/D")}, + Before: true, + }, + }, + }, + + { + desc: `q.OrderBy("a", Desc).StartAt(docsnap)`, + in: q.OrderBy("a", Desc).StartAt(docsnap), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_DESCENDING}, + {Field: fref1("__name__"), Direction: pb.StructuredQuery_DESCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(7), refval(coll.parentPath + "/documents/C/D")}, + Before: true, + }, + }, + }, + { + desc: `q.OrderBy("a", Desc).OrderBy("b", Asc).StartAt(docsnap)`, + in: q.OrderBy("a", Desc).OrderBy("b", Asc).StartAt(docsnap), + want: &pb.StructuredQuery{ + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_DESCENDING}, + {Field: fref1("b"), Direction: pb.StructuredQuery_ASCENDING}, + {Field: fref1("__name__"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(7), intval(8), refval(coll.parentPath + "/documents/C/D")}, + Before: true, + }, + }, + }, + { + desc: `q.Where("a", "==", 3).StartAt(docsnap)`, + in: q.Where("a", "==", 3).StartAt(docsnap), + want: &pb.StructuredQuery{ + Where: filtr([]string{"a"}, "==", 3), + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("__name__"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{refval(coll.parentPath + "/documents/C/D")}, + Before: true, + }, + }, + }, + { + desc: `q.Where("a", "<", 3).StartAt(docsnap)`, + in: q.Where("a", "<", 3).StartAt(docsnap), + want: &pb.StructuredQuery{ + Where: filtr([]string{"a"}, "<", 3), + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_ASCENDING}, + {Field: fref1("__name__"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(7), refval(coll.parentPath + "/documents/C/D")}, + Before: true, + }, + }, + }, + { + desc: `q.Where("b", "==", 1).Where("a", "<", 3).StartAt(docsnap)`, + in: q.Where("b", "==", 1).Where("a", "<", 3).StartAt(docsnap), + want: &pb.StructuredQuery{ + Where: &pb.StructuredQuery_Filter{ + FilterType: &pb.StructuredQuery_Filter_CompositeFilter{ + &pb.StructuredQuery_CompositeFilter{ + Op: pb.StructuredQuery_CompositeFilter_AND, + Filters: []*pb.StructuredQuery_Filter{ + filtr([]string{"b"}, "==", 1), + filtr([]string{"a"}, "<", 3), + }, + }, + }, + }, + OrderBy: []*pb.StructuredQuery_Order{ + {Field: fref1("a"), Direction: pb.StructuredQuery_ASCENDING}, + {Field: fref1("__name__"), Direction: pb.StructuredQuery_ASCENDING}, + }, + StartAt: &pb.Cursor{ + Values: []*pb.Value{intval(7), refval(coll.parentPath + "/documents/C/D")}, + Before: true, + }, + }, + }, + } { + got, err := test.in.toProto() + if err != nil { + t.Errorf("%s: %v", test.desc, err) + continue + } + test.want.From = []*pb.StructuredQuery_CollectionSelector{{CollectionId: "C"}} + if !testEqual(got, test.want) { + t.Errorf("%s:\ngot\n%v\nwant\n%v", test.desc, pretty.Value(got), pretty.Value(test.want)) + } + } +} + +func fref1(s string) *pb.StructuredQuery_FieldReference { + return fref([]string{s}) +} + +func TestQueryToProtoErrors(t *testing.T) { + st := map[string]interface{}{"a": ServerTimestamp} + del := map[string]interface{}{"a": Delete} + c := &Client{projectID: "P", databaseID: "DB"} + coll := c.Collection("C") + docsnap := &DocumentSnapshot{ + Ref: coll.Doc("D"), + proto: &pb.Document{ + Fields: map[string]*pb.Value{"a": intval(7)}, + }, + } + q := coll.Query + for i, query := range []Query{ + {}, // no collection ID + q.Where("x", "!=", 1), // invalid operator + q.Where("~", ">", 1), // invalid path + q.WherePath([]string{"*", ""}, ">", 1), // invalid path + q.StartAt(1), // no OrderBy + q.StartAt(2).OrderBy("x", Asc).OrderBy("y", Desc), // wrong # OrderBy + q.Select("*"), // invalid path + q.SelectPaths([]string{"/", "", "~"}), // invalid path + q.OrderBy("[", Asc), // invalid path + q.OrderByPath([]string{""}, Desc), // invalid path + q.Where("x", "==", st), // ServerTimestamp in filter + q.OrderBy("a", Asc).StartAt(st), // ServerTimestamp in Start + q.OrderBy("a", Asc).EndAt(st), // ServerTimestamp in End + q.Where("x", "==", del), // Delete in filter + q.OrderBy("a", Asc).StartAt(del), // Delete in Start + q.OrderBy("a", Asc).EndAt(del), // Delete in End + q.OrderBy(DocumentID, Asc).StartAt(7), // wrong type for __name__ + q.OrderBy(DocumentID, Asc).EndAt(7), // wrong type for __name__ + q.OrderBy("b", Asc).StartAt(docsnap), // doc snapshot does not have order-by field + q.StartAt(docsnap).EndAt("x"), // mixed doc snapshot and fields + q.StartAfter("x").EndBefore(docsnap), // mixed doc snapshot and fields + } { + _, err := query.toProto() + if err == nil { + t.Errorf("query %d \"%+v\": got nil, want error", i, query) + } + } +} + +func TestQueryMethodsDoNotModifyReceiver(t *testing.T) { + var empty Query + + q := Query{} + _ = q.Select("a", "b") + if !testEqual(q, empty) { + t.Errorf("got %+v, want empty", q) + } + + q = Query{} + q1 := q.Where("a", ">", 3) + if !testEqual(q, empty) { + t.Errorf("got %+v, want empty", q) + } + // Extra check because Where appends to a slice. + q1before := q.Where("a", ">", 3) // same as q1 + _ = q1.Where("b", "<", "foo") + if !testEqual(q1, q1before) { + t.Errorf("got %+v, want %+v", q1, q1before) + } + + q = Query{} + q1 = q.OrderBy("a", Asc) + if !testEqual(q, empty) { + t.Errorf("got %+v, want empty", q) + } + // Extra check because Where appends to a slice. + q1before = q.OrderBy("a", Asc) // same as q1 + _ = q1.OrderBy("b", Desc) + if !testEqual(q1, q1before) { + t.Errorf("got %+v, want %+v", q1, q1before) + } + + q = Query{} + _ = q.Offset(5) + if !testEqual(q, empty) { + t.Errorf("got %+v, want empty", q) + } + + q = Query{} + _ = q.Limit(5) + if !testEqual(q, empty) { + t.Errorf("got %+v, want empty", q) + } + + q = Query{} + _ = q.StartAt(5) + if !testEqual(q, empty) { + t.Errorf("got %+v, want empty", q) + } + + q = Query{} + _ = q.StartAfter(5) + if !testEqual(q, empty) { + t.Errorf("got %+v, want empty", q) + } + + q = Query{} + _ = q.EndAt(5) + if !testEqual(q, empty) { + t.Errorf("got %+v, want empty", q) + } + + q = Query{} + _ = q.EndBefore(5) + if !testEqual(q, empty) { + t.Errorf("got %+v, want empty", q) + } +} + +func TestQueryFromCollectionRef(t *testing.T) { + c := &Client{} + coll := c.Collection("C") + got := coll.Select("x").Offset(8) + want := Query{ + c: c, + parentPath: c.path(), + collectionID: "C", + selection: []FieldPath{{"x"}}, + offset: 8, + } + if !testEqual(got, want) { + t.Fatalf("got %+v, want %+v", got, want) + } +} + +func TestQueryGetAll(t *testing.T) { + // This implicitly tests DocumentIterator as well. + const dbPath = "projects/projectID/databases/(default)" + ctx := context.Background() + c, srv := newMock(t) + docNames := []string{"C/a", "C/b"} + wantPBDocs := []*pb.Document{ + { + Name: dbPath + "/documents/" + docNames[0], + CreateTime: aTimestamp, + UpdateTime: aTimestamp, + Fields: map[string]*pb.Value{"f": intval(2)}, + }, + { + Name: dbPath + "/documents/" + docNames[1], + CreateTime: aTimestamp2, + UpdateTime: aTimestamp3, + Fields: map[string]*pb.Value{"f": intval(1)}, + }, + } + wantReadTimes := []*tspb.Timestamp{aTimestamp, aTimestamp2} + srv.addRPC(nil, []interface{}{ + &pb.RunQueryResponse{Document: wantPBDocs[0], ReadTime: aTimestamp}, + &pb.RunQueryResponse{Document: wantPBDocs[1], ReadTime: aTimestamp2}, + }) + gotDocs, err := c.Collection("C").Documents(ctx).GetAll() + if err != nil { + t.Fatal(err) + } + if got, want := len(gotDocs), len(wantPBDocs); got != want { + t.Errorf("got %d docs, wanted %d", got, want) + } + for i, got := range gotDocs { + want, err := newDocumentSnapshot(c.Doc(docNames[i]), wantPBDocs[i], c, wantReadTimes[i]) + if err != nil { + t.Fatal(err) + } + if !testEqual(got, want) { + // avoid writing a cycle + got.c = nil + want.c = nil + t.Errorf("#%d: got %+v, want %+v", i, pretty.Value(got), pretty.Value(want)) + } + } +} + +func TestQueryCompareFunc(t *testing.T) { + mv := func(fields ...interface{}) map[string]*pb.Value { + m := map[string]*pb.Value{} + for i := 0; i < len(fields); i += 2 { + m[fields[i].(string)] = fields[i+1].(*pb.Value) + } + return m + } + snap := func(ref *DocumentRef, fields map[string]*pb.Value) *DocumentSnapshot { + return &DocumentSnapshot{Ref: ref, proto: &pb.Document{Fields: fields}} + } + + c := &Client{} + coll := c.Collection("C") + doc1 := coll.Doc("doc1") + doc2 := coll.Doc("doc2") + doc3 := coll.Doc("doc3") + doc4 := coll.Doc("doc4") + for _, test := range []struct { + q Query + in []*DocumentSnapshot + want []*DocumentSnapshot + }{ + { + q: coll.OrderBy("foo", Asc), + in: []*DocumentSnapshot{ + snap(doc3, mv("foo", intval(2))), + snap(doc4, mv("foo", intval(1))), + snap(doc2, mv("foo", intval(2))), + }, + want: []*DocumentSnapshot{ + snap(doc4, mv("foo", intval(1))), + snap(doc2, mv("foo", intval(2))), + snap(doc3, mv("foo", intval(2))), + }, + }, + { + q: coll.OrderBy("foo", Desc), + in: []*DocumentSnapshot{ + snap(doc3, mv("foo", intval(2))), + snap(doc4, mv("foo", intval(1))), + snap(doc2, mv("foo", intval(2))), + }, + want: []*DocumentSnapshot{ + snap(doc3, mv("foo", intval(2))), + snap(doc2, mv("foo", intval(2))), + snap(doc4, mv("foo", intval(1))), + }, + }, + { + q: coll.OrderBy("foo.bar", Asc), + in: []*DocumentSnapshot{ + snap(doc1, mv("foo", mapval(mv("bar", intval(1))))), + snap(doc2, mv("foo", mapval(mv("bar", intval(2))))), + snap(doc3, mv("foo", mapval(mv("bar", intval(2))))), + }, + want: []*DocumentSnapshot{ + snap(doc1, mv("foo", mapval(mv("bar", intval(1))))), + snap(doc2, mv("foo", mapval(mv("bar", intval(2))))), + snap(doc3, mv("foo", mapval(mv("bar", intval(2))))), + }, + }, + { + q: coll.OrderBy("foo.bar", Desc), + in: []*DocumentSnapshot{ + snap(doc1, mv("foo", mapval(mv("bar", intval(1))))), + snap(doc2, mv("foo", mapval(mv("bar", intval(2))))), + snap(doc3, mv("foo", mapval(mv("bar", intval(2))))), + }, + want: []*DocumentSnapshot{ + snap(doc3, mv("foo", mapval(mv("bar", intval(2))))), + snap(doc2, mv("foo", mapval(mv("bar", intval(2))))), + snap(doc1, mv("foo", mapval(mv("bar", intval(1))))), + }, + }, + } { + got := append([]*DocumentSnapshot(nil), test.in...) + sort.Sort(byQuery{test.q.compareFunc(), got}) + if diff := testDiff(got, test.want); diff != "" { + t.Errorf("%+v: %s", test.q, diff) + } + } + + // Want error on missing field. + q := coll.OrderBy("bar", Asc) + if q.err != nil { + t.Fatalf("bad query: %v", q.err) + } + cf := q.compareFunc() + s := snap(doc1, mv("foo", intval(1))) + if _, err := cf(s, s); err == nil { + t.Error("got nil, want error") + } +} + +type byQuery struct { + compare func(d1, d2 *DocumentSnapshot) (int, error) + docs []*DocumentSnapshot +} + +func (b byQuery) Len() int { return len(b.docs) } +func (b byQuery) Swap(i, j int) { b.docs[i], b.docs[j] = b.docs[j], b.docs[i] } +func (b byQuery) Less(i, j int) bool { + c, err := b.compare(b.docs[i], b.docs[j]) + if err != nil { + panic(err) + } + return c < 0 +} diff --git a/vendor/cloud.google.com/go/firestore/testdata/VERSION b/vendor/cloud.google.com/go/firestore/testdata/VERSION new file mode 100644 index 000000000..124b00493 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/VERSION @@ -0,0 +1 @@ +SHA1(/usr/local/google/home/jba/go/src/github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/testdata/test-suite.binproto)= fe95bb92912502ec3122c93ef687906911651f21 diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-all-transforms.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-all-transforms.textproto new file mode 100644 index 000000000..bbdf19e4d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-all-transforms.textproto @@ -0,0 +1,64 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can be created with any amount of transforms. + +description: "create: all transforms in a single call" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": [\"ArrayUnion\", 1, 2, 3], \"d\": [\"ArrayRemove\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-multi.textproto new file mode 100644 index 000000000..f80d65b23 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-multi.textproto @@ -0,0 +1,61 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayRemove field. Since all the ArrayRemove +# fields are removed, the only field in the update is "a". + +description: "create: multiple ArrayRemove fields" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3], \"c\": {\"d\": [\"ArrayRemove\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-nested.textproto new file mode 100644 index 000000000..97756c306 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-nested.textproto @@ -0,0 +1,48 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayRemove value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "create: nested ArrayRemove field" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayRemove\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-noarray-nested.textproto new file mode 100644 index 000000000..4ec0cb3b9 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayRemove. Firestore transforms don't support array indexing. + +description: "create: ArrayRemove cannot be anywhere inside an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayRemove\", 1, 2, 3]}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-noarray.textproto new file mode 100644 index 000000000..969b8d9dd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "create: ArrayRemove cannot be in an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-with-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-with-st.textproto new file mode 100644 index 000000000..b6ea3224d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "create: The ServerTimestamp sentinel cannot be in an ArrayUnion" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayRemove\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove.textproto new file mode 100644 index 000000000..e8e4bb398 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayremove.textproto @@ -0,0 +1,47 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayRemove is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "create: ArrayRemove with data" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-multi.textproto new file mode 100644 index 000000000..ec3cb72f5 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-multi.textproto @@ -0,0 +1,61 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayUnion field. Since all the ArrayUnion +# fields are removed, the only field in the update is "a". + +description: "create: multiple ArrayUnion fields" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3], \"c\": {\"d\": [\"ArrayUnion\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + append_missing_elements: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-nested.textproto new file mode 100644 index 000000000..e6e81bc1d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-nested.textproto @@ -0,0 +1,48 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayUnion value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "create: nested ArrayUnion field" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayUnion\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-noarray-nested.textproto new file mode 100644 index 000000000..4c0afe443 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayUnion. Firestore transforms don't support array indexing. + +description: "create: ArrayUnion cannot be anywhere inside an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayUnion\", 1, 2, 3]}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-noarray.textproto new file mode 100644 index 000000000..7b791fa41 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "create: ArrayUnion cannot be in an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-with-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-with-st.textproto new file mode 100644 index 000000000..a1bf4a90d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "create: The ServerTimestamp sentinel cannot be in an ArrayUnion" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayUnion\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion.textproto new file mode 100644 index 000000000..98cb6ad8a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-arrayunion.textproto @@ -0,0 +1,47 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayUnion is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "create: ArrayUnion with data" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-basic.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-basic.textproto new file mode 100644 index 000000000..433ffda72 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-basic.textproto @@ -0,0 +1,27 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A simple call, resulting in a single update operation. + +description: "create: basic" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-complex.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-complex.textproto new file mode 100644 index 000000000..00a994e20 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-complex.textproto @@ -0,0 +1,61 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A call to a write method with complicated input data. + +description: "create: complex" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2.5], \"b\": {\"c\": [\"three\", {\"d\": true}]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + array_value: < + values: < + integer_value: 1 + > + values: < + double_value: 2.5 + > + > + > + > + fields: < + key: "b" + value: < + map_value: < + fields: < + key: "c" + value: < + array_value: < + values: < + string_value: "three" + > + values: < + map_value: < + fields: < + key: "d" + value: < + boolean_value: true + > + > + > + > + > + > + > + > + > + > + > + current_document: < + exists: false + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-del-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-del-noarray-nested.textproto new file mode 100644 index 000000000..60694e137 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-del-noarray-nested.textproto @@ -0,0 +1,13 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a field. Deletes are implemented by +# turning the path to the Delete sentinel into a FieldPath, and FieldPaths do not +# support array indexing. + +description: "create: Delete cannot be anywhere inside an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": \"Delete\"}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-del-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-del-noarray.textproto new file mode 100644 index 000000000..5731be1c7 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-del-noarray.textproto @@ -0,0 +1,13 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a field. Deletes are implemented by +# turning the path to the Delete sentinel into a FieldPath, and FieldPaths do not +# support array indexing. + +description: "create: Delete cannot be in an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, \"Delete\"]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-empty.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-empty.textproto new file mode 100644 index 000000000..2b6fec7ef --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-empty.textproto @@ -0,0 +1,20 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + + +description: "create: creating or setting an empty map" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + > + current_document: < + exists: false + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-nodel.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-nodel.textproto new file mode 100644 index 000000000..c878814b1 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-nodel.textproto @@ -0,0 +1,11 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel cannot be used in Create, or in Set without a Merge option. + +description: "create: Delete cannot appear in data" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"Delete\"}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-nosplit.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-nosplit.textproto new file mode 100644 index 000000000..e9e1ee275 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-nosplit.textproto @@ -0,0 +1,40 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Create and Set treat their map keys literally. They do not split on dots. + +description: "create: don\342\200\231t split on dots" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{ \"a.b\": { \"c.d\": 1 }, \"e\": 2 }" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a.b" + value: < + map_value: < + fields: < + key: "c.d" + value: < + integer_value: 1 + > + > + > + > + > + fields: < + key: "e" + value: < + integer_value: 2 + > + > + > + current_document: < + exists: false + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-special-chars.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-special-chars.textproto new file mode 100644 index 000000000..3a7acd307 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-special-chars.textproto @@ -0,0 +1,41 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Create and Set treat their map keys literally. They do not escape special +# characters. + +description: "create: non-alpha characters in map keys" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{ \"*\": { \".\": 1 }, \"~\": 2 }" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "*" + value: < + map_value: < + fields: < + key: "." + value: < + integer_value: 1 + > + > + > + > + > + fields: < + key: "~" + value: < + integer_value: 2 + > + > + > + current_document: < + exists: false + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-st-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-st-alone.textproto new file mode 100644 index 000000000..9803a676b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-st-alone.textproto @@ -0,0 +1,26 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ServerTimestamps, then no update operation +# should be produced. + +description: "create: ServerTimestamp alone" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + set_to_server_value: REQUEST_TIME + > + > + current_document: < + exists: false + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-st-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-st-multi.textproto new file mode 100644 index 000000000..cb3db4809 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-st-multi.textproto @@ -0,0 +1,41 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ServerTimestamp field. Since all the +# ServerTimestamp fields are removed, the only field in the update is "a". + +description: "create: multiple ServerTimestamp fields" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": {\"d\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c.d" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-st-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-st-nested.textproto new file mode 100644 index 000000000..6bc03e8e7 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-st-nested.textproto @@ -0,0 +1,38 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A ServerTimestamp value can occur at any depth. In this case, the transform +# applies to the field path "b.c". Since "c" is removed from the update, "b" +# becomes empty, so it is also removed from the update. + +description: "create: nested ServerTimestamp field" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-st-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-st-noarray-nested.textproto new file mode 100644 index 000000000..0cec0aebd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-st-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ServerTimestamp sentinel. Firestore transforms don't support array indexing. + +description: "create: ServerTimestamp cannot be anywhere inside an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": \"ServerTimestamp\"}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-st-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-st-noarray.textproto new file mode 100644 index 000000000..56d91c2cf --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-st-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. Firestore transforms +# don't support array indexing. + +description: "create: ServerTimestamp cannot be in an array value" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, \"ServerTimestamp\"]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-st-with-empty-map.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-st-with-empty-map.textproto new file mode 100644 index 000000000..37e7e074a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-st-with-empty-map.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a ServerTimestamp and a map both reside inside a map, the ServerTimestamp +# should be stripped out but the empty map should remain. + +description: "create: ServerTimestamp beside an empty map" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": {\"b\": {}, \"c\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + map_value: < + > + > + > + > + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/create-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/create-st.textproto new file mode 100644 index 000000000..ddfc6a177 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/create-st.textproto @@ -0,0 +1,39 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with the special ServerTimestamp sentinel is removed from the data in the +# update operation. Instead it appears in a separate Transform operation. Note +# that in these tests, the string "ServerTimestamp" should be replaced with the +# special ServerTimestamp value. + +description: "create: ServerTimestamp with data" +create: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + current_document: < + exists: false + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/delete-exists-precond.textproto b/vendor/cloud.google.com/go/firestore/testdata/delete-exists-precond.textproto new file mode 100644 index 000000000..c9cf2ddea --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/delete-exists-precond.textproto @@ -0,0 +1,21 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Delete supports an exists precondition. + +description: "delete: delete with exists precondition" +delete: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + precondition: < + exists: true + > + request: < + database: "projects/projectID/databases/(default)" + writes: < + delete: "projects/projectID/databases/(default)/documents/C/d" + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/delete-no-precond.textproto b/vendor/cloud.google.com/go/firestore/testdata/delete-no-precond.textproto new file mode 100644 index 000000000..a396cdb8c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/delete-no-precond.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ordinary Delete call. + +description: "delete: delete without precondition" +delete: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + request: < + database: "projects/projectID/databases/(default)" + writes: < + delete: "projects/projectID/databases/(default)/documents/C/d" + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/delete-time-precond.textproto b/vendor/cloud.google.com/go/firestore/testdata/delete-time-precond.textproto new file mode 100644 index 000000000..5798f5f3b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/delete-time-precond.textproto @@ -0,0 +1,25 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Delete supports a last-update-time precondition. + +description: "delete: delete with last-update-time precondition" +delete: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + precondition: < + update_time: < + seconds: 42 + > + > + request: < + database: "projects/projectID/databases/(default)" + writes: < + delete: "projects/projectID/databases/(default)/documents/C/d" + current_document: < + update_time: < + seconds: 42 + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/get-basic.textproto b/vendor/cloud.google.com/go/firestore/testdata/get-basic.textproto new file mode 100644 index 000000000..2a4481682 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/get-basic.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A call to DocumentRef.Get. + +description: "get: get a document" +get: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + request: < + name: "projects/projectID/databases/(default)/documents/C/d" + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-add-mod-del-add.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-add-mod-del-add.textproto new file mode 100644 index 000000000..1aa8dcbc3 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-add-mod-del-add.textproto @@ -0,0 +1,246 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Various changes to a single document. + +description: "listen: add a doc, modify it, delete it, then add it again" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + responses: < + document_delete: < + document: "projects/projectID/databases/(default)/documents/C/d1" + > + > + responses: < + target_change: < + read_time: < + seconds: 3 + > + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + read_time: < + seconds: 4 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + read_time: < + seconds: 1 + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + changes: < + kind: MODIFIED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + > + read_time: < + seconds: 2 + > + > + snapshots: < + changes: < + kind: REMOVED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + new_index: -1 + > + read_time: < + seconds: 3 + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + old_index: -1 + > + read_time: < + seconds: 4 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-add-one.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-add-one.textproto new file mode 100644 index 000000000..2ad1d8e97 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-add-one.textproto @@ -0,0 +1,79 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Snapshot with a single document. + +description: "listen: add a doc" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + read_time: < + seconds: 2 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-add-three.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-add-three.textproto new file mode 100644 index 000000000..ac846f762 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-add-three.textproto @@ -0,0 +1,190 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A snapshot with three documents. The documents are sorted first by the "a" +# field, then by their path. The changes are ordered the same way. + +description: "listen: add three documents" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 1 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 2 + > + read_time: < + seconds: 2 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-doc-remove.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-doc-remove.textproto new file mode 100644 index 000000000..975200f97 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-doc-remove.textproto @@ -0,0 +1,115 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The DocumentRemove response behaves exactly like DocumentDelete. + +description: "listen: DocumentRemove behaves like DocumentDelete" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + responses: < + document_remove: < + document: "projects/projectID/databases/(default)/documents/C/d1" + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + read_time: < + seconds: 1 + > + > + snapshots: < + changes: < + kind: REMOVED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + new_index: -1 + > + read_time: < + seconds: 2 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-empty.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-empty.textproto new file mode 100644 index 000000000..4d04b7909 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-empty.textproto @@ -0,0 +1,25 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There are no changes, so the snapshot should be empty. + +description: "listen: no changes; empty snapshot" +listen: < + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + snapshots: < + read_time: < + seconds: 1 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-filter-nop.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-filter-nop.textproto new file mode 100644 index 000000000..48fd72d3a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-filter-nop.textproto @@ -0,0 +1,247 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A Filter response whose count matches the size of the current state (docs in +# last snapshot + docs added - docs deleted) is a no-op. + +description: "listen: Filter response with same size is a no-op" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_delete: < + document: "projects/projectID/databases/(default)/documents/C/d1" + > + > + responses: < + filter: < + count: 2 + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 1 + > + read_time: < + seconds: 1 + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: REMOVED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: 1 + new_index: -1 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 1 + > + read_time: < + seconds: 2 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-multi-docs.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-multi-docs.textproto new file mode 100644 index 000000000..8778acc3d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-multi-docs.textproto @@ -0,0 +1,524 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Changes should be ordered with deletes first, then additions, then mods, each in +# query order. Old indices refer to the immediately previous state, not the +# previous snapshot + +description: "listen: multiple documents, added, deleted and updated" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d4" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d5" + fields: < + key: "a" + value: < + integer_value: 4 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_delete: < + document: "projects/projectID/databases/(default)/documents/C/d3" + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: -1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + target_ids: 1 + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d6" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_delete: < + document: "projects/projectID/databases/(default)/documents/C/d2" + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d4" + fields: < + key: "a" + value: < + integer_value: -2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + read_time: < + seconds: 4 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d4" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 1 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d4" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 2 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 3 + > + read_time: < + seconds: 2 + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d4" + fields: < + key: "a" + value: < + integer_value: -2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: -1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d6" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d5" + fields: < + key: "a" + value: < + integer_value: 4 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: REMOVED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + new_index: -1 + > + changes: < + kind: REMOVED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + new_index: -1 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d6" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 2 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d5" + fields: < + key: "a" + value: < + integer_value: 4 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 3 + > + changes: < + kind: MODIFIED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d4" + fields: < + key: "a" + value: < + integer_value: -2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + > + changes: < + kind: MODIFIED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: -1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + old_index: 1 + new_index: 1 + > + read_time: < + seconds: 4 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-nocurrent.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-nocurrent.textproto new file mode 100644 index 000000000..24239b645 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-nocurrent.textproto @@ -0,0 +1,141 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the watch state is not marked CURRENT, no snapshot is issued. + +description: "listen: no snapshot if we don't see CURRENT" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + old_index: -1 + new_index: 1 + > + read_time: < + seconds: 2 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-nomod.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-nomod.textproto new file mode 100644 index 000000000..2a99edc35 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-nomod.textproto @@ -0,0 +1,143 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Document updates are recognized by a change in the update time, not the data. +# This shouldn't actually happen. It is just a test of the update logic. + +description: "listen: add a doc, then change it but without changing its update time" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + responses: < + document_delete: < + document: "projects/projectID/databases/(default)/documents/C/d1" + > + > + responses: < + target_change: < + read_time: < + seconds: 3 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + read_time: < + seconds: 1 + > + > + snapshots: < + changes: < + kind: REMOVED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + new_index: -1 + > + read_time: < + seconds: 3 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-removed-target-ids.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-removed-target-ids.textproto new file mode 100644 index 000000000..1e8ead2d8 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-removed-target-ids.textproto @@ -0,0 +1,131 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A DocumentChange with the watch target ID in the removed_target_ids field is the +# same as deleting a document. + +description: "listen: DocumentChange with removed_target_id is like a delete." +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + removed_target_ids: 1 + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + read_time: < + seconds: 1 + > + > + snapshots: < + changes: < + kind: REMOVED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + new_index: -1 + > + read_time: < + seconds: 2 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-reset.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-reset.textproto new file mode 100644 index 000000000..89a75df27 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-reset.textproto @@ -0,0 +1,382 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A RESET message turns off the CURRENT state, and marks all documents as deleted. + +# If a document appeared on the stream but was never part of a snapshot ("d3" in +# this test), a reset will make it disappear completely. + +# For a snapshot to happen at a NO_CHANGE reponse, we need to have both seen a +# CURRENT response, and have a change from the previous snapshot. Here, after the +# reset, we see the same version of d2 again. That doesn't result in a snapshot. + +description: "listen: RESET turns off CURRENT" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: RESET + > + > + responses: < + target_change: < + read_time: < + seconds: 2 + > + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + read_time: < + seconds: 3 + > + > + > + responses: < + target_change: < + target_change_type: RESET + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + read_time: < + seconds: 4 + > + > + > + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + read_time: < + seconds: 5 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + old_index: -1 + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + new_index: 1 + > + read_time: < + seconds: 1 + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + changes: < + kind: REMOVED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 2 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: 1 + new_index: -1 + > + changes: < + kind: MODIFIED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + > + read_time: < + seconds: 3 + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d2" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 3 + > + > + docs: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d3" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 2 + > + > + old_index: -1 + new_index: 1 + > + read_time: < + seconds: 5 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-target-add-nop.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-target-add-nop.textproto new file mode 100644 index 000000000..3fa7cce56 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-target-add-nop.textproto @@ -0,0 +1,88 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A TargetChange_ADD response must have the same watch target ID. + +description: "listen: TargetChange_ADD is a no-op if it has the same target ID" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + target_change_type: ADD + target_ids: 1 + read_time: < + seconds: 2 + > + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + snapshots: < + docs: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + changes: < + kind: ADDED + doc: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + old_index: -1 + > + read_time: < + seconds: 1 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-target-add-wrong-id.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-target-add-wrong-id.textproto new file mode 100644 index 000000000..87544637b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-target-add-wrong-id.textproto @@ -0,0 +1,50 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A TargetChange_ADD response must have the same watch target ID. + +description: "listen: TargetChange_ADD is an error if it has a different target ID" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + target_change_type: ADD + target_ids: 2 + read_time: < + seconds: 2 + > + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/listen-target-remove.textproto b/vendor/cloud.google.com/go/firestore/testdata/listen-target-remove.textproto new file mode 100644 index 000000000..f34b0890c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/listen-target-remove.textproto @@ -0,0 +1,46 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A TargetChange_REMOVE response should never be sent. + +description: "listen: TargetChange_REMOVE should not appear" +listen: < + responses: < + document_change: < + document: < + name: "projects/projectID/databases/(default)/documents/C/d1" + fields: < + key: "a" + value: < + integer_value: 3 + > + > + create_time: < + seconds: 1 + > + update_time: < + seconds: 1 + > + > + target_ids: 1 + > + > + responses: < + target_change: < + target_change_type: CURRENT + > + > + responses: < + target_change: < + target_change_type: REMOVE + > + > + responses: < + target_change: < + read_time: < + seconds: 1 + > + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-arrayremove-cursor.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-arrayremove-cursor.textproto new file mode 100644 index 000000000..3c926da96 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-arrayremove-cursor.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove is not permitted in queries. + +description: "query: ArrayRemove in cursor method" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + end_before: < + json_values: "[\"ArrayRemove\", 1, 2, 3]" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-arrayremove-where.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-arrayremove-where.textproto new file mode 100644 index 000000000..000b76350 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-arrayremove-where.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove is not permitted in queries. + +description: "query: ArrayRemove in Where" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "==" + json_value: "[\"ArrayRemove\", 1, 2, 3]" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-arrayunion-cursor.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-arrayunion-cursor.textproto new file mode 100644 index 000000000..e8a61104d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-arrayunion-cursor.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion is not permitted in queries. + +description: "query: ArrayUnion in cursor method" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + end_before: < + json_values: "[\"ArrayUnion\", 1, 2, 3]" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-arrayunion-where.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-arrayunion-where.textproto new file mode 100644 index 000000000..94923134e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-arrayunion-where.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion is not permitted in queries. + +description: "query: ArrayUnion in Where" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "==" + json_value: "[\"ArrayUnion\", 1, 2, 3]" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-bad-NaN.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-bad-NaN.textproto new file mode 100644 index 000000000..6806dd04a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-bad-NaN.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# You can only compare NaN for equality. + +description: "query: where clause with non-== comparison with NaN" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "<" + json_value: "\"NaN\"" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-bad-null.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-bad-null.textproto new file mode 100644 index 000000000..7fdfb3f2b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-bad-null.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# You can only compare Null for equality. + +description: "query: where clause with non-== comparison with Null" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: ">" + json_value: "null" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-order.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-order.textproto new file mode 100644 index 000000000..bab8601e8 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-order.textproto @@ -0,0 +1,68 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a document snapshot is used, the client appends a __name__ order-by clause +# with the direction of the last order-by clause. + +description: "query: cursor methods with a document snapshot, existing orderBy" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + order_by: < + path: < + field: "b" + > + direction: "desc" + > + > + clauses: < + start_after: < + doc_snapshot: < + path: "projects/projectID/databases/(default)/documents/C/D" + json_data: "{\"a\": 7, \"b\": 8}" + > + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "a" + > + direction: ASCENDING + > + order_by: < + field: < + field_path: "b" + > + direction: DESCENDING + > + order_by: < + field: < + field_path: "__name__" + > + direction: DESCENDING + > + start_at: < + values: < + integer_value: 7 + > + values: < + integer_value: 8 + > + values: < + reference_value: "projects/projectID/databases/(default)/documents/C/D" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-orderby-name.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-orderby-name.textproto new file mode 100644 index 000000000..d0ce3df45 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-orderby-name.textproto @@ -0,0 +1,76 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If there is an existing orderBy clause on __name__, no changes are made to the +# list of orderBy clauses. + +description: "query: cursor method, doc snapshot, existing orderBy __name__" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "desc" + > + > + clauses: < + order_by: < + path: < + field: "__name__" + > + direction: "asc" + > + > + clauses: < + start_at: < + doc_snapshot: < + path: "projects/projectID/databases/(default)/documents/C/D" + json_data: "{\"a\": 7, \"b\": 8}" + > + > + > + clauses: < + end_at: < + doc_snapshot: < + path: "projects/projectID/databases/(default)/documents/C/D" + json_data: "{\"a\": 7, \"b\": 8}" + > + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "a" + > + direction: DESCENDING + > + order_by: < + field: < + field_path: "__name__" + > + direction: ASCENDING + > + start_at: < + values: < + integer_value: 7 + > + values: < + reference_value: "projects/projectID/databases/(default)/documents/C/D" + > + before: true + > + end_at: < + values: < + integer_value: 7 + > + values: < + reference_value: "projects/projectID/databases/(default)/documents/C/D" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-where-eq.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-where-eq.textproto new file mode 100644 index 000000000..8b1e217df --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-where-eq.textproto @@ -0,0 +1,53 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A Where clause using equality doesn't change the implicit orderBy clauses. + +description: "query: cursor methods with a document snapshot and an equality where clause" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "==" + json_value: "3" + > + > + clauses: < + end_at: < + doc_snapshot: < + path: "projects/projectID/databases/(default)/documents/C/D" + json_data: "{\"a\": 7, \"b\": 8}" + > + > + > + query: < + from: < + collection_id: "C" + > + where: < + field_filter: < + field: < + field_path: "a" + > + op: EQUAL + value: < + integer_value: 3 + > + > + > + order_by: < + field: < + field_path: "__name__" + > + direction: ASCENDING + > + end_at: < + values: < + reference_value: "projects/projectID/databases/(default)/documents/C/D" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-where-neq-orderby.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-where-neq-orderby.textproto new file mode 100644 index 000000000..a69edfc50 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-where-neq-orderby.textproto @@ -0,0 +1,72 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If there is an OrderBy clause, the inequality Where clause does not result in a +# new OrderBy clause. We still add a __name__ OrderBy clause + +description: "query: cursor method, doc snapshot, inequality where clause, and existing orderBy clause" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "desc" + > + > + clauses: < + where: < + path: < + field: "a" + > + op: "<" + json_value: "4" + > + > + clauses: < + start_at: < + doc_snapshot: < + path: "projects/projectID/databases/(default)/documents/C/D" + json_data: "{\"a\": 7, \"b\": 8}" + > + > + > + query: < + from: < + collection_id: "C" + > + where: < + field_filter: < + field: < + field_path: "a" + > + op: LESS_THAN + value: < + integer_value: 4 + > + > + > + order_by: < + field: < + field_path: "a" + > + direction: DESCENDING + > + order_by: < + field: < + field_path: "__name__" + > + direction: DESCENDING + > + start_at: < + values: < + integer_value: 7 + > + values: < + reference_value: "projects/projectID/databases/(default)/documents/C/D" + > + before: true + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-where-neq.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-where-neq.textproto new file mode 100644 index 000000000..871dd0ba3 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap-where-neq.textproto @@ -0,0 +1,64 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A Where clause with an inequality results in an OrderBy clause on that clause's +# path, if there are no other OrderBy clauses. + +description: "query: cursor method with a document snapshot and an inequality where clause" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "<=" + json_value: "3" + > + > + clauses: < + end_before: < + doc_snapshot: < + path: "projects/projectID/databases/(default)/documents/C/D" + json_data: "{\"a\": 7, \"b\": 8}" + > + > + > + query: < + from: < + collection_id: "C" + > + where: < + field_filter: < + field: < + field_path: "a" + > + op: LESS_THAN_OR_EQUAL + value: < + integer_value: 3 + > + > + > + order_by: < + field: < + field_path: "a" + > + direction: ASCENDING + > + order_by: < + field: < + field_path: "__name__" + > + direction: ASCENDING + > + end_at: < + values: < + integer_value: 7 + > + values: < + reference_value: "projects/projectID/databases/(default)/documents/C/D" + > + before: true + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap.textproto new file mode 100644 index 000000000..184bffc2d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-docsnap.textproto @@ -0,0 +1,34 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a document snapshot is used, the client appends a __name__ order-by clause. + +description: "query: cursor methods with a document snapshot" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + start_at: < + doc_snapshot: < + path: "projects/projectID/databases/(default)/documents/C/D" + json_data: "{\"a\": 7, \"b\": 8}" + > + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "__name__" + > + direction: ASCENDING + > + start_at: < + values: < + reference_value: "projects/projectID/databases/(default)/documents/C/D" + > + before: true + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-endbefore-empty-map.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-endbefore-empty-map.textproto new file mode 100644 index 000000000..c197d23af --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-endbefore-empty-map.textproto @@ -0,0 +1,41 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Cursor methods are allowed to use empty maps with EndBefore. It should result in +# an empty map in the query. + +description: "query: EndBefore with explicit empty map" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + end_before: < + json_values: "{}" + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "a" + > + direction: ASCENDING + > + end_at: < + values: < + map_value: < + > + > + before: true + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-endbefore-empty.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-endbefore-empty.textproto new file mode 100644 index 000000000..a41775abf --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-endbefore-empty.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Cursor methods are not allowed to use empty values with EndBefore. It should +# result in an error. + +description: "query: EndBefore with empty values" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + end_before: < + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-no-order.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-no-order.textproto new file mode 100644 index 000000000..fb999ddab --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-no-order.textproto @@ -0,0 +1,16 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If a cursor method with a list of values is provided, there must be at least as +# many explicit orderBy clauses as values. + +description: "query: cursor method without orderBy" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + start_at: < + json_values: "2" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-startat-empty-map.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-startat-empty-map.textproto new file mode 100644 index 000000000..557aca2c9 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-startat-empty-map.textproto @@ -0,0 +1,41 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Cursor methods are allowed to use empty maps with StartAt. It should result in +# an empty map in the query. + +description: "query: StartAt with explicit empty map" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + start_at: < + json_values: "{}" + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "a" + > + direction: ASCENDING + > + start_at: < + values: < + map_value: < + > + > + before: true + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-startat-empty.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-startat-empty.textproto new file mode 100644 index 000000000..e0c54d98a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-startat-empty.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Cursor methods are not allowed to use empty values with StartAt. It should +# result in an error. + +description: "query: StartAt with empty values" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + start_at: < + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-1a.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-1a.textproto new file mode 100644 index 000000000..bb08ab7d4 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-1a.textproto @@ -0,0 +1,50 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Cursor methods take the same number of values as there are OrderBy clauses. + +description: "query: StartAt/EndBefore with values" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + start_at: < + json_values: "7" + > + > + clauses: < + end_before: < + json_values: "9" + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "a" + > + direction: ASCENDING + > + start_at: < + values: < + integer_value: 7 + > + before: true + > + end_at: < + values: < + integer_value: 9 + > + before: true + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-1b.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-1b.textproto new file mode 100644 index 000000000..41e69e9e6 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-1b.textproto @@ -0,0 +1,48 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Cursor methods take the same number of values as there are OrderBy clauses. + +description: "query: StartAfter/EndAt with values" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + start_after: < + json_values: "7" + > + > + clauses: < + end_at: < + json_values: "9" + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "a" + > + direction: ASCENDING + > + start_at: < + values: < + integer_value: 7 + > + > + end_at: < + values: < + integer_value: 9 + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-2.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-2.textproto new file mode 100644 index 000000000..8e37ad003 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-2.textproto @@ -0,0 +1,71 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Cursor methods take the same number of values as there are OrderBy clauses. + +description: "query: Start/End with two values" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + order_by: < + path: < + field: "b" + > + direction: "desc" + > + > + clauses: < + start_at: < + json_values: "7" + json_values: "8" + > + > + clauses: < + end_at: < + json_values: "9" + json_values: "10" + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "a" + > + direction: ASCENDING + > + order_by: < + field: < + field_path: "b" + > + direction: DESCENDING + > + start_at: < + values: < + integer_value: 7 + > + values: < + integer_value: 8 + > + before: true + > + end_at: < + values: < + integer_value: 9 + > + values: < + integer_value: 10 + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-docid.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-docid.textproto new file mode 100644 index 000000000..91af3486c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-docid.textproto @@ -0,0 +1,50 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Cursor values corresponding to a __name__ field take the document path relative +# to the query's collection. + +description: "query: cursor methods with __name__" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "__name__" + > + direction: "asc" + > + > + clauses: < + start_after: < + json_values: "\"D1\"" + > + > + clauses: < + end_before: < + json_values: "\"D2\"" + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "__name__" + > + direction: ASCENDING + > + start_at: < + values: < + reference_value: "projects/projectID/databases/(default)/documents/C/D1" + > + > + end_at: < + values: < + reference_value: "projects/projectID/databases/(default)/documents/C/D2" + > + before: true + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-last-wins.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-last-wins.textproto new file mode 100644 index 000000000..9e8fbb19f --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-cursor-vals-last-wins.textproto @@ -0,0 +1,60 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When multiple Start* or End* calls occur, the values of the last one are used. + +description: "query: cursor methods, last one wins" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + start_after: < + json_values: "1" + > + > + clauses: < + start_at: < + json_values: "2" + > + > + clauses: < + end_at: < + json_values: "3" + > + > + clauses: < + end_before: < + json_values: "4" + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "a" + > + direction: ASCENDING + > + start_at: < + values: < + integer_value: 2 + > + before: true + > + end_at: < + values: < + integer_value: 4 + > + before: true + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-del-cursor.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-del-cursor.textproto new file mode 100644 index 000000000..c9d4adb7c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-del-cursor.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Sentinel values are not permitted in queries. + +description: "query: Delete in cursor method" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + end_before: < + json_values: "\"Delete\"" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-del-where.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-del-where.textproto new file mode 100644 index 000000000..8e9252949 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-del-where.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Sentinel values are not permitted in queries. + +description: "query: Delete in Where" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "==" + json_value: "\"Delete\"" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-invalid-operator.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-invalid-operator.textproto new file mode 100644 index 000000000..e580c64a7 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-invalid-operator.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The != operator is not supported. + +description: "query: invalid operator in Where clause" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "!=" + json_value: "4" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-invalid-path-order.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-invalid-path-order.textproto new file mode 100644 index 000000000..e0a720576 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-invalid-path-order.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The path has an empty component. + +description: "query: invalid path in OrderBy clause" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "*" + field: "" + > + direction: "asc" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-invalid-path-select.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-invalid-path-select.textproto new file mode 100644 index 000000000..944f984f7 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-invalid-path-select.textproto @@ -0,0 +1,18 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The path has an empty component. + +description: "query: invalid path in Where clause" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + select: < + fields: < + field: "*" + field: "" + > + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-invalid-path-where.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-invalid-path-where.textproto new file mode 100644 index 000000000..527923b09 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-invalid-path-where.textproto @@ -0,0 +1,20 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The path has an empty component. + +description: "query: invalid path in Where clause" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "*" + field: "" + > + op: "==" + json_value: "4" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-offset-limit-last-wins.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-offset-limit-last-wins.textproto new file mode 100644 index 000000000..dc301f439 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-offset-limit-last-wins.textproto @@ -0,0 +1,30 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# With multiple Offset or Limit clauses, the last one wins. + +description: "query: multiple Offset and Limit clauses" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + offset: 2 + > + clauses: < + limit: 3 + > + clauses: < + limit: 4 + > + clauses: < + offset: 5 + > + query: < + from: < + collection_id: "C" + > + offset: 5 + limit: < + value: 4 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-offset-limit.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-offset-limit.textproto new file mode 100644 index 000000000..136d9d46a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-offset-limit.textproto @@ -0,0 +1,24 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Offset and Limit clauses. + +description: "query: Offset and Limit clauses" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + offset: 2 + > + clauses: < + limit: 3 + > + query: < + from: < + collection_id: "C" + > + offset: 2 + limit: < + value: 3 + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-order.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-order.textproto new file mode 100644 index 000000000..7ed4c4ead --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-order.textproto @@ -0,0 +1,42 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Multiple OrderBy clauses combine. + +description: "query: basic OrderBy clauses" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "b" + > + direction: "asc" + > + > + clauses: < + order_by: < + path: < + field: "a" + > + direction: "desc" + > + > + query: < + from: < + collection_id: "C" + > + order_by: < + field: < + field_path: "b" + > + direction: ASCENDING + > + order_by: < + field: < + field_path: "a" + > + direction: DESCENDING + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-select-empty.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-select-empty.textproto new file mode 100644 index 000000000..def8b55ac --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-select-empty.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An empty Select clause selects just the document ID. + +description: "query: empty Select clause" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + select: < + > + > + query: < + select: < + fields: < + field_path: "__name__" + > + > + from: < + collection_id: "C" + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-select-last-wins.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-select-last-wins.textproto new file mode 100644 index 000000000..bd78d09eb --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-select-last-wins.textproto @@ -0,0 +1,36 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The last Select clause is the only one used. + +description: "query: two Select clauses" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + select: < + fields: < + field: "a" + > + fields: < + field: "b" + > + > + > + clauses: < + select: < + fields: < + field: "c" + > + > + > + query: < + select: < + fields: < + field_path: "c" + > + > + from: < + collection_id: "C" + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-select.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-select.textproto new file mode 100644 index 000000000..15e112497 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-select.textproto @@ -0,0 +1,32 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ordinary Select clause. + +description: "query: Select clause with some fields" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + select: < + fields: < + field: "a" + > + fields: < + field: "b" + > + > + > + query: < + select: < + fields: < + field_path: "a" + > + fields: < + field_path: "b" + > + > + from: < + collection_id: "C" + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-st-cursor.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-st-cursor.textproto new file mode 100644 index 000000000..66885d0dd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-st-cursor.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Sentinel values are not permitted in queries. + +description: "query: ServerTimestamp in cursor method" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + order_by: < + path: < + field: "a" + > + direction: "asc" + > + > + clauses: < + end_before: < + json_values: "\"ServerTimestamp\"" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-st-where.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-st-where.textproto new file mode 100644 index 000000000..05da28d54 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-st-where.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Sentinel values are not permitted in queries. + +description: "query: ServerTimestamp in Where" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "==" + json_value: "\"ServerTimestamp\"" + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-where-2.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-where-2.textproto new file mode 100644 index 000000000..103446307 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-where-2.textproto @@ -0,0 +1,59 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Multiple Where clauses are combined into a composite filter. + +description: "query: two Where clauses" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: ">=" + json_value: "5" + > + > + clauses: < + where: < + path: < + field: "b" + > + op: "<" + json_value: "\"foo\"" + > + > + query: < + from: < + collection_id: "C" + > + where: < + composite_filter: < + op: AND + filters: < + field_filter: < + field: < + field_path: "a" + > + op: GREATER_THAN_OR_EQUAL + value: < + integer_value: 5 + > + > + > + filters: < + field_filter: < + field: < + field_path: "b" + > + op: LESS_THAN + value: < + string_value: "foo" + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-where-NaN.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-where-NaN.textproto new file mode 100644 index 000000000..4a97ca7dd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-where-NaN.textproto @@ -0,0 +1,31 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A Where clause that tests for equality with NaN results in a unary filter. + +description: "query: a Where clause comparing to NaN" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "==" + json_value: "\"NaN\"" + > + > + query: < + from: < + collection_id: "C" + > + where: < + unary_filter: < + op: IS_NAN + field: < + field_path: "a" + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-where-null.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-where-null.textproto new file mode 100644 index 000000000..1869c60c7 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-where-null.textproto @@ -0,0 +1,31 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A Where clause that tests for equality with null results in a unary filter. + +description: "query: a Where clause comparing to null" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: "==" + json_value: "null" + > + > + query: < + from: < + collection_id: "C" + > + where: < + unary_filter: < + op: IS_NULL + field: < + field_path: "a" + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-where.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-where.textproto new file mode 100644 index 000000000..045c2befa --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-where.textproto @@ -0,0 +1,34 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A simple Where clause. + +description: "query: Where clause" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + where: < + path: < + field: "a" + > + op: ">" + json_value: "5" + > + > + query: < + from: < + collection_id: "C" + > + where: < + field_filter: < + field: < + field_path: "a" + > + op: GREATER_THAN + value: < + integer_value: 5 + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/query-wrong-collection.textproto b/vendor/cloud.google.com/go/firestore/testdata/query-wrong-collection.textproto new file mode 100644 index 000000000..ad6f353d5 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/query-wrong-collection.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If a document snapshot is passed to a Start*/End* method, it must be in the same +# collection as the query. + +description: "query: doc snapshot with wrong collection in cursor method" +query: < + coll_path: "projects/projectID/databases/(default)/documents/C" + clauses: < + end_before: < + doc_snapshot: < + path: "projects/projectID/databases/(default)/documents/C2/D" + json_data: "{\"a\": 7, \"b\": 8}" + > + > + > + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-all-transforms.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-all-transforms.textproto new file mode 100644 index 000000000..bf18f9a5b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-all-transforms.textproto @@ -0,0 +1,61 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can be created with any amount of transforms. + +description: "set: all transforms in a single call" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": [\"ArrayUnion\", 1, 2, 3], \"d\": [\"ArrayRemove\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-multi.textproto new file mode 100644 index 000000000..9b62fe191 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-multi.textproto @@ -0,0 +1,58 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayRemove field. Since all the ArrayRemove +# fields are removed, the only field in the update is "a". + +description: "set: multiple ArrayRemove fields" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3], \"c\": {\"d\": [\"ArrayRemove\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-nested.textproto new file mode 100644 index 000000000..617609c5a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-nested.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayRemove value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "set: nested ArrayRemove field" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayRemove\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-noarray-nested.textproto new file mode 100644 index 000000000..2efa34a59 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayRemove. Firestore transforms don't support array indexing. + +description: "set: ArrayRemove cannot be anywhere inside an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayRemove\", 1, 2, 3]}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-noarray.textproto new file mode 100644 index 000000000..e7aa209ea --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "set: ArrayRemove cannot be in an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-with-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-with-st.textproto new file mode 100644 index 000000000..353025b59 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "set: The ServerTimestamp sentinel cannot be in an ArrayUnion" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayRemove\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove.textproto new file mode 100644 index 000000000..8aa6b60d0 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayremove.textproto @@ -0,0 +1,44 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayRemove is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "set: ArrayRemove with data" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-multi.textproto new file mode 100644 index 000000000..e515bfa8d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-multi.textproto @@ -0,0 +1,58 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayUnion field. Since all the ArrayUnion +# fields are removed, the only field in the update is "a". + +description: "set: multiple ArrayUnion fields" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3], \"c\": {\"d\": [\"ArrayUnion\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + append_missing_elements: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-nested.textproto new file mode 100644 index 000000000..f8abeb0d0 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-nested.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayUnion value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "set: nested ArrayUnion field" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayUnion\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-noarray-nested.textproto new file mode 100644 index 000000000..2b4170f43 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayUnion. Firestore transforms don't support array indexing. + +description: "set: ArrayUnion cannot be anywhere inside an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayUnion\", 1, 2, 3]}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-noarray.textproto new file mode 100644 index 000000000..e08af3a07 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "set: ArrayUnion cannot be in an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-with-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-with-st.textproto new file mode 100644 index 000000000..37a7a132e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "set: The ServerTimestamp sentinel cannot be in an ArrayUnion" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayUnion\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion.textproto new file mode 100644 index 000000000..4751e0c0e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-arrayunion.textproto @@ -0,0 +1,44 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayUnion is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "set: ArrayUnion with data" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-basic.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-basic.textproto new file mode 100644 index 000000000..e9b292e3c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-basic.textproto @@ -0,0 +1,24 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A simple call, resulting in a single update operation. + +description: "set: basic" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-complex.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-complex.textproto new file mode 100644 index 000000000..6ec19500a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-complex.textproto @@ -0,0 +1,58 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A call to a write method with complicated input data. + +description: "set: complex" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2.5], \"b\": {\"c\": [\"three\", {\"d\": true}]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + array_value: < + values: < + integer_value: 1 + > + values: < + double_value: 2.5 + > + > + > + > + fields: < + key: "b" + value: < + map_value: < + fields: < + key: "c" + value: < + array_value: < + values: < + string_value: "three" + > + values: < + map_value: < + fields: < + key: "d" + value: < + boolean_value: true + > + > + > + > + > + > + > + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-del-merge-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-del-merge-alone.textproto new file mode 100644 index 000000000..811ab8dfe --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-del-merge-alone.textproto @@ -0,0 +1,28 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A Delete sentinel can appear with a merge option. If the delete paths are the +# only ones to be merged, then no document is sent, just an update mask. + +description: "set-merge: Delete with merge" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "b" + field: "c" + > + > + json_data: "{\"a\": 1, \"b\": {\"c\": \"Delete\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + > + update_mask: < + field_paths: "b.c" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-del-merge.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-del-merge.textproto new file mode 100644 index 000000000..b8d863105 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-del-merge.textproto @@ -0,0 +1,37 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A Delete sentinel can appear with a merge option. + +description: "set-merge: Delete with merge" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "a" + > + fields: < + field: "b" + field: "c" + > + > + json_data: "{\"a\": 1, \"b\": {\"c\": \"Delete\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b.c" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-del-mergeall.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-del-mergeall.textproto new file mode 100644 index 000000000..af1e84524 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-del-mergeall.textproto @@ -0,0 +1,31 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A Delete sentinel can appear with a mergeAll option. + +description: "set: Delete with MergeAll" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + all: true + > + json_data: "{\"a\": 1, \"b\": {\"c\": \"Delete\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b.c" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-del-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-del-noarray-nested.textproto new file mode 100644 index 000000000..bbf6a3d00 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-del-noarray-nested.textproto @@ -0,0 +1,13 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a field. Deletes are implemented by +# turning the path to the Delete sentinel into a FieldPath, and FieldPaths do not +# support array indexing. + +description: "set: Delete cannot be anywhere inside an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": \"Delete\"}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-del-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-del-noarray.textproto new file mode 100644 index 000000000..07fc6497d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-del-noarray.textproto @@ -0,0 +1,13 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a field. Deletes are implemented by +# turning the path to the Delete sentinel into a FieldPath, and FieldPaths do not +# support array indexing. + +description: "set: Delete cannot be in an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, \"Delete\"]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-del-nomerge.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-del-nomerge.textproto new file mode 100644 index 000000000..cb6ef4f85 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-del-nomerge.textproto @@ -0,0 +1,17 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The client signals an error if the Delete sentinel is in the input data, but not +# selected by a merge option, because this is most likely a programming bug. + +description: "set-merge: Delete cannot appear in an unmerged field" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "a" + > + > + json_data: "{\"a\": 1, \"b\": \"Delete\"}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-del-nonleaf.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-del-nonleaf.textproto new file mode 100644 index 000000000..54f22d95c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-del-nonleaf.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If a Delete is part of the value at a merge path, then the user is confused: +# their merge path says "replace this entire value" but their Delete says "delete +# this part of the value". This should be an error, just as if they specified +# Delete in a Set with no merge. + +description: "set-merge: Delete cannot appear as part of a merge path" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "h" + > + > + json_data: "{\"h\": {\"g\": \"Delete\"}}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-del-wo-merge.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-del-wo-merge.textproto new file mode 100644 index 000000000..29196628b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-del-wo-merge.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Without a merge option, Set replaces the document with the input data. A Delete +# sentinel in the data makes no sense in this case. + +description: "set: Delete cannot appear unless a merge option is specified" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"Delete\"}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-empty.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-empty.textproto new file mode 100644 index 000000000..c2b73d3ff --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-empty.textproto @@ -0,0 +1,17 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + + +description: "set: creating or setting an empty map" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-merge-fp.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-merge-fp.textproto new file mode 100644 index 000000000..68690f6f1 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-merge-fp.textproto @@ -0,0 +1,40 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A merge with fields that use special characters. + +description: "set-merge: Merge with FieldPaths" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "*" + field: "~" + > + > + json_data: "{\"*\": {\"~\": true}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "*" + value: < + map_value: < + fields: < + key: "~" + value: < + boolean_value: true + > + > + > + > + > + > + update_mask: < + field_paths: "`*`.`~`" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-merge-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-merge-nested.textproto new file mode 100644 index 000000000..0d1282818 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-merge-nested.textproto @@ -0,0 +1,41 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A merge option where the field is not at top level. Only fields mentioned in the +# option are present in the update operation. + +description: "set-merge: Merge with a nested field" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "h" + field: "g" + > + > + json_data: "{\"h\": {\"g\": 4, \"f\": 5}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "h" + value: < + map_value: < + fields: < + key: "g" + value: < + integer_value: 4 + > + > + > + > + > + > + update_mask: < + field_paths: "h.g" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-merge-nonleaf.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-merge-nonleaf.textproto new file mode 100644 index 000000000..ca41cb034 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-merge-nonleaf.textproto @@ -0,0 +1,46 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If a field path is in a merge option, the value at that path replaces the stored +# value. That is true even if the value is complex. + +description: "set-merge: Merge field is not a leaf" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "h" + > + > + json_data: "{\"h\": {\"f\": 5, \"g\": 6}, \"e\": 7}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "h" + value: < + map_value: < + fields: < + key: "f" + value: < + integer_value: 5 + > + > + fields: < + key: "g" + value: < + integer_value: 6 + > + > + > + > + > + > + update_mask: < + field_paths: "h" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-merge-prefix.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-merge-prefix.textproto new file mode 100644 index 000000000..1e2c2c502 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-merge-prefix.textproto @@ -0,0 +1,21 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The prefix would make the other path meaningless, so this is probably a +# programming error. + +description: "set-merge: One merge path cannot be the prefix of another" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "a" + > + fields: < + field: "a" + field: "b" + > + > + json_data: "{\"a\": {\"b\": 1}}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-merge-present.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-merge-present.textproto new file mode 100644 index 000000000..f6665de5c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-merge-present.textproto @@ -0,0 +1,20 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The client signals an error if a merge option mentions a path that is not in the +# input data. + +description: "set-merge: Merge fields must all be present in data" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "b" + > + fields: < + field: "a" + > + > + json_data: "{\"a\": 1}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-merge.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-merge.textproto new file mode 100644 index 000000000..279125253 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-merge.textproto @@ -0,0 +1,32 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Fields in the input data but not in a merge option are pruned. + +description: "set-merge: Merge with a field" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "a" + > + > + json_data: "{\"a\": 1, \"b\": 2}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-mergeall-empty.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-mergeall-empty.textproto new file mode 100644 index 000000000..16df8a22b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-mergeall-empty.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# This is a valid call that can be used to ensure a document exists. + +description: "set: MergeAll can be specified with empty data." +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + all: true + > + json_data: "{}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + > + update_mask: < + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-mergeall-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-mergeall-nested.textproto new file mode 100644 index 000000000..1fbc6973c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-mergeall-nested.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# MergeAll with nested fields results in an update mask that includes entries for +# all the leaf fields. + +description: "set: MergeAll with nested fields" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + all: true + > + json_data: "{\"h\": { \"g\": 3, \"f\": 4 }}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "h" + value: < + map_value: < + fields: < + key: "f" + value: < + integer_value: 4 + > + > + fields: < + key: "g" + value: < + integer_value: 3 + > + > + > + > + > + > + update_mask: < + field_paths: "h.f" + field_paths: "h.g" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-mergeall.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-mergeall.textproto new file mode 100644 index 000000000..cb2ebc52b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-mergeall.textproto @@ -0,0 +1,37 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The MergeAll option with a simple piece of data. + +description: "set: MergeAll" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + all: true + > + json_data: "{\"a\": 1, \"b\": 2}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + fields: < + key: "b" + value: < + integer_value: 2 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-nodel.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-nodel.textproto new file mode 100644 index 000000000..0fb887d46 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-nodel.textproto @@ -0,0 +1,11 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel cannot be used in Create, or in Set without a Merge option. + +description: "set: Delete cannot appear in data" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"Delete\"}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-nosplit.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-nosplit.textproto new file mode 100644 index 000000000..0ff3fadcf --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-nosplit.textproto @@ -0,0 +1,37 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Create and Set treat their map keys literally. They do not split on dots. + +description: "set: don\342\200\231t split on dots" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{ \"a.b\": { \"c.d\": 1 }, \"e\": 2 }" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a.b" + value: < + map_value: < + fields: < + key: "c.d" + value: < + integer_value: 1 + > + > + > + > + > + fields: < + key: "e" + value: < + integer_value: 2 + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-special-chars.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-special-chars.textproto new file mode 100644 index 000000000..f4122c9f0 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-special-chars.textproto @@ -0,0 +1,38 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Create and Set treat their map keys literally. They do not escape special +# characters. + +description: "set: non-alpha characters in map keys" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{ \"*\": { \".\": 1 }, \"~\": 2 }" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "*" + value: < + map_value: < + fields: < + key: "." + value: < + integer_value: 1 + > + > + > + > + > + fields: < + key: "~" + value: < + integer_value: 2 + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-alone-mergeall.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-alone-mergeall.textproto new file mode 100644 index 000000000..16ce4cfbd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-alone-mergeall.textproto @@ -0,0 +1,26 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ServerTimestamps, then no update operation +# should be produced. + +description: "set: ServerTimestamp alone with MergeAll" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + all: true + > + json_data: "{\"a\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-alone.textproto new file mode 100644 index 000000000..6ce46d7f1 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-alone.textproto @@ -0,0 +1,28 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ServerTimestamps, then an update operation +# with an empty map should be produced. + +description: "set: ServerTimestamp alone" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-both.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-both.textproto new file mode 100644 index 000000000..5cc7bbc9e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-both.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Just as when no merge option is specified, ServerTimestamp sentinel values are +# removed from the data in the update operation and become transforms. + +description: "set-merge: ServerTimestamp with Merge of both fields" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "a" + > + fields: < + field: "b" + > + > + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-nonleaf-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-nonleaf-alone.textproto new file mode 100644 index 000000000..f513b6c80 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-nonleaf-alone.textproto @@ -0,0 +1,37 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If a field path is in a merge option, the value at that path replaces the stored +# value. If the value has only ServerTimestamps, they become transforms and we +# clear the value by including the field path in the update mask. + +description: "set-merge: non-leaf merge field with ServerTimestamp alone" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "h" + > + > + json_data: "{\"h\": {\"g\": \"ServerTimestamp\"}, \"e\": 7}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + > + update_mask: < + field_paths: "h" + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "h.g" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-nonleaf.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-nonleaf.textproto new file mode 100644 index 000000000..e53e7e268 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-nonleaf.textproto @@ -0,0 +1,49 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If a field path is in a merge option, the value at that path replaces the stored +# value, and ServerTimestamps inside that value become transforms as usual. + +description: "set-merge: non-leaf merge field with ServerTimestamp" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "h" + > + > + json_data: "{\"h\": {\"f\": 5, \"g\": \"ServerTimestamp\"}, \"e\": 7}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "h" + value: < + map_value: < + fields: < + key: "f" + value: < + integer_value: 5 + > + > + > + > + > + > + update_mask: < + field_paths: "h" + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "h.g" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-nowrite.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-nowrite.textproto new file mode 100644 index 000000000..3222230dc --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-merge-nowrite.textproto @@ -0,0 +1,28 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If all the fields in the merge option have ServerTimestamp values, then no +# update operation is produced, only a transform. + +description: "set-merge: If no ordinary values in Merge, no write" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "b" + > + > + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-mergeall.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-mergeall.textproto new file mode 100644 index 000000000..b8c53a566 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-mergeall.textproto @@ -0,0 +1,40 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Just as when no merge option is specified, ServerTimestamp sentinel values are +# removed from the data in the update operation and become transforms. + +description: "set: ServerTimestamp with MergeAll" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + all: true + > + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-multi.textproto new file mode 100644 index 000000000..375ec18d6 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-multi.textproto @@ -0,0 +1,38 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ServerTimestamp field. Since all the +# ServerTimestamp fields are removed, the only field in the update is "a". + +description: "set: multiple ServerTimestamp fields" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": {\"d\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c.d" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-nested.textproto new file mode 100644 index 000000000..abfd2e8fd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-nested.textproto @@ -0,0 +1,35 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A ServerTimestamp value can occur at any depth. In this case, the transform +# applies to the field path "b.c". Since "c" is removed from the update, "b" +# becomes empty, so it is also removed from the update. + +description: "set: nested ServerTimestamp field" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-noarray-nested.textproto new file mode 100644 index 000000000..241d79151 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ServerTimestamp sentinel. Firestore transforms don't support array indexing. + +description: "set: ServerTimestamp cannot be anywhere inside an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": \"ServerTimestamp\"}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-noarray.textproto new file mode 100644 index 000000000..591fb0343 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. Firestore transforms +# don't support array indexing. + +description: "set: ServerTimestamp cannot be in an array value" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, \"ServerTimestamp\"]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-nomerge.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-nomerge.textproto new file mode 100644 index 000000000..20c0ae1fb --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-nomerge.textproto @@ -0,0 +1,33 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the ServerTimestamp value is not mentioned in a merge option, then it is +# pruned from the data but does not result in a transform. + +description: "set-merge: If is ServerTimestamp not in Merge, no transform" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + option: < + fields: < + field: "a" + > + > + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st-with-empty-map.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st-with-empty-map.textproto new file mode 100644 index 000000000..5e187983f --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st-with-empty-map.textproto @@ -0,0 +1,42 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a ServerTimestamp and a map both reside inside a map, the ServerTimestamp +# should be stripped out but the empty map should remain. + +description: "set: ServerTimestamp beside an empty map" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": {\"b\": {}, \"c\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + map_value: < + > + > + > + > + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/set-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/set-st.textproto new file mode 100644 index 000000000..8bceddcee --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/set-st.textproto @@ -0,0 +1,36 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with the special ServerTimestamp sentinel is removed from the data in the +# update operation. Instead it appears in a separate Transform operation. Note +# that in these tests, the string "ServerTimestamp" should be replaced with the +# special ServerTimestamp value. + +description: "set: ServerTimestamp with data" +set: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/test-suite.binproto b/vendor/cloud.google.com/go/firestore/testdata/test-suite.binproto new file mode 100644 index 000000000..6e3ce3973 Binary files /dev/null and b/vendor/cloud.google.com/go/firestore/testdata/test-suite.binproto differ diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-all-transforms.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-all-transforms.textproto new file mode 100644 index 000000000..225cc61e4 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-all-transforms.textproto @@ -0,0 +1,67 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can be created with any amount of transforms. + +description: "update: all transforms in a single call" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": [\"ArrayUnion\", 1, 2, 3], \"d\": [\"ArrayRemove\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-alone.textproto new file mode 100644 index 000000000..8c79a31d5 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-alone.textproto @@ -0,0 +1,36 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ArrayRemove, then no update operation should +# be produced. + +description: "update: ArrayRemove alone" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-multi.textproto new file mode 100644 index 000000000..2362b6e09 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-multi.textproto @@ -0,0 +1,69 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayRemove field. Since all the ArrayRemove +# fields are removed, the only field in the update is "a". + +# b is not in the mask because it will be set in the transform. c must be in the +# mask: it should be replaced entirely. The transform will set c.d to the +# timestamp, but the update will delete the rest of c. + +description: "update: multiple ArrayRemove fields" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3], \"c\": {\"d\": [\"ArrayRemove\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-nested.textproto new file mode 100644 index 000000000..143790179 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-nested.textproto @@ -0,0 +1,52 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayRemove value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "update: nested ArrayRemove field" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayRemove\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-noarray-nested.textproto new file mode 100644 index 000000000..04eca965c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayRemove. Firestore transforms don't support array indexing. + +description: "update: ArrayRemove cannot be anywhere inside an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayRemove\", 1, 2, 3]}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-noarray.textproto new file mode 100644 index 000000000..bbd27bf01 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "update: ArrayRemove cannot be in an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-with-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-with-st.textproto new file mode 100644 index 000000000..4888b44f1 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "update: The ServerTimestamp sentinel cannot be in an ArrayUnion" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayRemove\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove.textproto new file mode 100644 index 000000000..3b767cf48 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayremove.textproto @@ -0,0 +1,50 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayRemove is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "update: ArrayRemove with data" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-alone.textproto new file mode 100644 index 000000000..ec12818da --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-alone.textproto @@ -0,0 +1,36 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ArrayUnion, then no update operation should +# be produced. + +description: "update: ArrayUnion alone" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-multi.textproto new file mode 100644 index 000000000..8edf6a3af --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-multi.textproto @@ -0,0 +1,69 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayUnion field. Since all the ArrayUnion +# fields are removed, the only field in the update is "a". + +# b is not in the mask because it will be set in the transform. c must be in the +# mask: it should be replaced entirely. The transform will set c.d to the +# timestamp, but the update will delete the rest of c. + +description: "update: multiple ArrayUnion fields" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3], \"c\": {\"d\": [\"ArrayUnion\", 4, 5, 6]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + append_missing_elements: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-nested.textproto new file mode 100644 index 000000000..217e2e2ca --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-nested.textproto @@ -0,0 +1,52 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayUnion value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "update: nested ArrayUnion field" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayUnion\", 1, 2, 3]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-noarray-nested.textproto new file mode 100644 index 000000000..032678183 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayUnion. Firestore transforms don't support array indexing. + +description: "update: ArrayUnion cannot be anywhere inside an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": [\"ArrayUnion\", 1, 2, 3]}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-noarray.textproto new file mode 100644 index 000000000..c199f9f73 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "update: ArrayUnion cannot be in an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-with-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-with-st.textproto new file mode 100644 index 000000000..ee022f849 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion-with-st.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "update: The ServerTimestamp sentinel cannot be in an ArrayUnion" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [\"ArrayUnion\", 1, \"ServerTimestamp\", 3]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion.textproto new file mode 100644 index 000000000..81b240b89 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-arrayunion.textproto @@ -0,0 +1,50 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayUnion is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "update: ArrayUnion with data" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-badchar.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-badchar.textproto new file mode 100644 index 000000000..656ff53b6 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-badchar.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The keys of the data given to Update are interpreted, unlike those of Create and +# Set. They cannot contain special characters. + +description: "update: invalid character" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a~b\": 1}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-basic.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-basic.textproto new file mode 100644 index 000000000..9da316f58 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-basic.textproto @@ -0,0 +1,30 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A simple call, resulting in a single update operation. + +description: "update: basic" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-complex.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-complex.textproto new file mode 100644 index 000000000..1a6d9eff6 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-complex.textproto @@ -0,0 +1,65 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A call to a write method with complicated input data. + +description: "update: complex" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2.5], \"b\": {\"c\": [\"three\", {\"d\": true}]}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + array_value: < + values: < + integer_value: 1 + > + values: < + double_value: 2.5 + > + > + > + > + fields: < + key: "b" + value: < + map_value: < + fields: < + key: "c" + value: < + array_value: < + values: < + string_value: "three" + > + values: < + map_value: < + fields: < + key: "d" + value: < + boolean_value: true + > + > + > + > + > + > + > + > + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-del-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-del-alone.textproto new file mode 100644 index 000000000..8f558233f --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-del-alone.textproto @@ -0,0 +1,25 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the input data consists solely of Deletes, then the update operation has no +# map, just an update mask. + +description: "update: Delete alone" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": \"Delete\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-del-dot.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-del-dot.textproto new file mode 100644 index 000000000..c0ebdf61f --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-del-dot.textproto @@ -0,0 +1,46 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# After expanding top-level dotted fields, fields with Delete values are pruned +# from the output data, but appear in the update mask. + +description: "update: Delete with a dotted field" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b.c\": \"Delete\", \"b.d\": 2}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + fields: < + key: "b" + value: < + map_value: < + fields: < + key: "d" + value: < + integer_value: 2 + > + > + > + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b.c" + field_paths: "b.d" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-del-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-del-nested.textproto new file mode 100644 index 000000000..ed102697e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-del-nested.textproto @@ -0,0 +1,11 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a top-level key. + +description: "update: Delete cannot be nested" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": {\"b\": \"Delete\"}}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-del-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-del-noarray-nested.textproto new file mode 100644 index 000000000..a2eec4966 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-del-noarray-nested.textproto @@ -0,0 +1,13 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a field. Deletes are implemented by +# turning the path to the Delete sentinel into a FieldPath, and FieldPaths do not +# support array indexing. + +description: "update: Delete cannot be anywhere inside an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": \"Delete\"}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-del-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-del-noarray.textproto new file mode 100644 index 000000000..a7eea87ef --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-del-noarray.textproto @@ -0,0 +1,13 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a field. Deletes are implemented by +# turning the path to the Delete sentinel into a FieldPath, and FieldPaths do not +# support array indexing. + +description: "update: Delete cannot be in an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, \"Delete\"]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-del.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-del.textproto new file mode 100644 index 000000000..ec443e6c7 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-del.textproto @@ -0,0 +1,32 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If a field's value is the Delete sentinel, then it doesn't appear in the update +# data, but does in the mask. + +description: "update: Delete" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"Delete\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-exists-precond.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-exists-precond.textproto new file mode 100644 index 000000000..3c6fef4e2 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-exists-precond.textproto @@ -0,0 +1,14 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Update method does not support an explicit exists precondition. + +description: "update: Exists precondition is invalid" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + precondition: < + exists: true + > + json_data: "{\"a\": 1}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-fp-empty-component.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-fp-empty-component.textproto new file mode 100644 index 000000000..c3bceff3e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-fp-empty-component.textproto @@ -0,0 +1,11 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Empty fields are not allowed. + +description: "update: empty field path component" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a..b\": 1}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-no-paths.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-no-paths.textproto new file mode 100644 index 000000000..b524b7483 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-no-paths.textproto @@ -0,0 +1,11 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# It is a client-side error to call Update with empty data. + +description: "update: no paths" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-all-transforms.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-all-transforms.textproto new file mode 100644 index 000000000..8cfad4732 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-all-transforms.textproto @@ -0,0 +1,82 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can be created with any amount of transforms. + +description: "update-paths: all transforms in a single call" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "c" + > + field_paths: < + field: "d" + > + json_values: "1" + json_values: "\"ServerTimestamp\"" + json_values: "[\"ArrayUnion\", 1, 2, 3]" + json_values: "[\"ArrayRemove\", 4, 5, 6]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-alone.textproto new file mode 100644 index 000000000..68f0e147b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-alone.textproto @@ -0,0 +1,39 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ArrayRemove, then no update operation should +# be produced. + +description: "update-paths: ArrayRemove alone" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[\"ArrayRemove\", 1, 2, 3]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-multi.textproto new file mode 100644 index 000000000..b60c3f36a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-multi.textproto @@ -0,0 +1,76 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayRemove field. Since all the ArrayRemove +# fields are removed, the only field in the update is "a". + +description: "update-paths: multiple ArrayRemove fields" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "c" + > + json_values: "1" + json_values: "[\"ArrayRemove\", 1, 2, 3]" + json_values: "{\"d\": [\"ArrayRemove\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + remove_all_from_array: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-nested.textproto new file mode 100644 index 000000000..381be19d5 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-nested.textproto @@ -0,0 +1,59 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayRemove value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "update-paths: nested ArrayRemove field" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "{\"c\": [\"ArrayRemove\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-noarray-nested.textproto new file mode 100644 index 000000000..35f6c67b2 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-noarray-nested.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayRemove. Firestore transforms don't support array indexing. + +description: "update-paths: ArrayRemove cannot be anywhere inside an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, {\"b\": [\"ArrayRemove\", 1, 2, 3]}]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-noarray.textproto new file mode 100644 index 000000000..45cab48dd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-noarray.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayRemove must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "update-paths: ArrayRemove cannot be in an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, 2, [\"ArrayRemove\", 1, 2, 3]]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-with-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-with-st.textproto new file mode 100644 index 000000000..67b92a3ef --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove-with-st.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "update-paths: The ServerTimestamp sentinel cannot be in an ArrayUnion" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[\"ArrayRemove\", 1, \"ServerTimestamp\", 3]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove.textproto new file mode 100644 index 000000000..d3866676e --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayremove.textproto @@ -0,0 +1,57 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayRemove is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "update-paths: ArrayRemove with data" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "[\"ArrayRemove\", 1, 2, 3]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + remove_all_from_array: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-alone.textproto new file mode 100644 index 000000000..48100e0ab --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-alone.textproto @@ -0,0 +1,39 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ArrayUnion, then no update operation should +# be produced. + +description: "update-paths: ArrayUnion alone" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[\"ArrayUnion\", 1, 2, 3]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-multi.textproto new file mode 100644 index 000000000..03772e5dd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-multi.textproto @@ -0,0 +1,76 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ArrayUnion field. Since all the ArrayUnion +# fields are removed, the only field in the update is "a". + +description: "update-paths: multiple ArrayUnion fields" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "c" + > + json_values: "1" + json_values: "[\"ArrayUnion\", 1, 2, 3]" + json_values: "{\"d\": [\"ArrayUnion\", 4, 5, 6]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + field_transforms: < + field_path: "c.d" + append_missing_elements: < + values: < + integer_value: 4 + > + values: < + integer_value: 5 + > + values: < + integer_value: 6 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-nested.textproto new file mode 100644 index 000000000..1420e4e28 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-nested.textproto @@ -0,0 +1,59 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# An ArrayUnion value can occur at any depth. In this case, the transform applies +# to the field path "b.c". Since "c" is removed from the update, "b" becomes +# empty, so it is also removed from the update. + +description: "update-paths: nested ArrayUnion field" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "{\"c\": [\"ArrayUnion\", 1, 2, 3]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-noarray-nested.textproto new file mode 100644 index 000000000..ab75bf38a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-noarray-nested.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ArrayUnion. Firestore transforms don't support array indexing. + +description: "update-paths: ArrayUnion cannot be anywhere inside an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, {\"b\": [\"ArrayUnion\", 1, 2, 3]}]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-noarray.textproto new file mode 100644 index 000000000..fac72644f --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-noarray.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# ArrayUnion must be the value of a field. Firestore transforms don't support +# array indexing. + +description: "update-paths: ArrayUnion cannot be in an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, 2, [\"ArrayRemove\", 1, 2, 3]]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-with-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-with-st.textproto new file mode 100644 index 000000000..d194c09bd --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion-with-st.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. It may not appear in +# an ArrayUnion. + +description: "update-paths: The ServerTimestamp sentinel cannot be in an ArrayUnion" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[\"ArrayUnion\", 1, \"ServerTimestamp\", 3]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion.textproto new file mode 100644 index 000000000..fc56c1e29 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-arrayunion.textproto @@ -0,0 +1,57 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with ArrayUnion is removed from the data in the update operation. Instead +# it appears in a separate Transform operation. + +description: "update-paths: ArrayUnion with data" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "[\"ArrayUnion\", 1, 2, 3]" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + append_missing_elements: < + values: < + integer_value: 1 + > + values: < + integer_value: 2 + > + values: < + integer_value: 3 + > + > + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-basic.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-basic.textproto new file mode 100644 index 000000000..515f29d6a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-basic.textproto @@ -0,0 +1,33 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A simple call, resulting in a single update operation. + +description: "update-paths: basic" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "1" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-complex.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-complex.textproto new file mode 100644 index 000000000..38a832239 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-complex.textproto @@ -0,0 +1,72 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A call to a write method with complicated input data. + +description: "update-paths: complex" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "[1, 2.5]" + json_values: "{\"c\": [\"three\", {\"d\": true}]}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + array_value: < + values: < + integer_value: 1 + > + values: < + double_value: 2.5 + > + > + > + > + fields: < + key: "b" + value: < + map_value: < + fields: < + key: "c" + value: < + array_value: < + values: < + string_value: "three" + > + values: < + map_value: < + fields: < + key: "d" + value: < + boolean_value: true + > + > + > + > + > + > + > + > + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-alone.textproto new file mode 100644 index 000000000..5dbb787de --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-alone.textproto @@ -0,0 +1,28 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the input data consists solely of Deletes, then the update operation has no +# map, just an update mask. + +description: "update-paths: Delete alone" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "\"Delete\"" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-nested.textproto new file mode 100644 index 000000000..bdf65fb0a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-nested.textproto @@ -0,0 +1,14 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a top-level key. + +description: "update-paths: Delete cannot be nested" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "{\"b\": \"Delete\"}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-noarray-nested.textproto new file mode 100644 index 000000000..d3da15dda --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-noarray-nested.textproto @@ -0,0 +1,16 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a field. Deletes are implemented by +# turning the path to the Delete sentinel into a FieldPath, and FieldPaths do not +# support array indexing. + +description: "update-paths: Delete cannot be anywhere inside an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, {\"b\": \"Delete\"}]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-noarray.textproto new file mode 100644 index 000000000..9ebdd0945 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del-noarray.textproto @@ -0,0 +1,16 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Delete sentinel must be the value of a field. Deletes are implemented by +# turning the path to the Delete sentinel into a FieldPath, and FieldPaths do not +# support array indexing. + +description: "update-paths: Delete cannot be in an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, 2, \"Delete\"]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-del.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del.textproto new file mode 100644 index 000000000..5197a7848 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-del.textproto @@ -0,0 +1,39 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If a field's value is the Delete sentinel, then it doesn't appear in the update +# data, but does in the mask. + +description: "update-paths: Delete" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "\"Delete\"" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-exists-precond.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-exists-precond.textproto new file mode 100644 index 000000000..084e07726 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-exists-precond.textproto @@ -0,0 +1,17 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Update method does not support an explicit exists precondition. + +description: "update-paths: Exists precondition is invalid" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + precondition: < + exists: true + > + field_paths: < + field: "a" + > + json_values: "1" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-del.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-del.textproto new file mode 100644 index 000000000..5c92aeb8c --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-del.textproto @@ -0,0 +1,47 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If one nested field is deleted, and another isn't, preserve the second. + +description: "update-paths: field paths with delete" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "foo" + field: "bar" + > + field_paths: < + field: "foo" + field: "delete" + > + json_values: "1" + json_values: "\"Delete\"" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "foo" + value: < + map_value: < + fields: < + key: "bar" + value: < + integer_value: 1 + > + > + > + > + > + > + update_mask: < + field_paths: "foo.bar" + field_paths: "foo.delete" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-dup-transforms.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-dup-transforms.textproto new file mode 100644 index 000000000..a84725a8d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-dup-transforms.textproto @@ -0,0 +1,23 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The same field cannot occur more than once, even if all the operations are +# transforms. + +description: "update-paths: duplicate field path with only transforms" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "a" + > + json_values: "[\"ArrayUnion\", 1, 2, 3]" + json_values: "\"ServerTimestamp\"" + json_values: "[\"ArrayUnion\", 4, 5, 6]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-dup.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-dup.textproto new file mode 100644 index 000000000..fedbd3aab --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-dup.textproto @@ -0,0 +1,22 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The same field cannot occur more than once. + +description: "update-paths: duplicate field path" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "a" + > + json_values: "1" + json_values: "2" + json_values: "3" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-empty-component.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-empty-component.textproto new file mode 100644 index 000000000..7a5df25b7 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-empty-component.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Empty fields are not allowed. + +description: "update-paths: empty field path component" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "*" + field: "" + > + json_values: "1" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-empty.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-empty.textproto new file mode 100644 index 000000000..311e30932 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-empty.textproto @@ -0,0 +1,13 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A FieldPath of length zero is invalid. + +description: "update-paths: empty field path" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + > + json_values: "1" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-multi.textproto new file mode 100644 index 000000000..9ba41e398 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-multi.textproto @@ -0,0 +1,42 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The UpdatePaths or equivalent method takes a list of FieldPaths. Each FieldPath +# is a sequence of uninterpreted path components. + +description: "update-paths: multiple-element field path" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + field: "b" + > + json_values: "1" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + integer_value: 1 + > + > + > + > + > + > + update_mask: < + field_paths: "a.b" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-nosplit.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-nosplit.textproto new file mode 100644 index 000000000..516495266 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-fp-nosplit.textproto @@ -0,0 +1,48 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# FieldPath components are not split on dots. + +description: "update-paths: FieldPath elements are not split on dots" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a.b" + field: "f.g" + > + json_values: "{\"n.o\": 7}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a.b" + value: < + map_value: < + fields: < + key: "f.g" + value: < + map_value: < + fields: < + key: "n.o" + value: < + integer_value: 7 + > + > + > + > + > + > + > + > + > + update_mask: < + field_paths: "`a.b`.`f.g`" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-no-paths.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-no-paths.textproto new file mode 100644 index 000000000..d9939dc94 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-no-paths.textproto @@ -0,0 +1,10 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# It is a client-side error to call Update with empty data. + +description: "update-paths: no paths" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-prefix-1.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-prefix-1.textproto new file mode 100644 index 000000000..1710b9109 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-prefix-1.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# In the input data, one field cannot be a prefix of another. + +description: "update-paths: prefix #1" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + field: "b" + > + field_paths: < + field: "a" + > + json_values: "1" + json_values: "2" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-prefix-2.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-prefix-2.textproto new file mode 100644 index 000000000..be78ab58a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-prefix-2.textproto @@ -0,0 +1,19 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# In the input data, one field cannot be a prefix of another. + +description: "update-paths: prefix #2" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "a" + field: "b" + > + json_values: "1" + json_values: "2" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-prefix-3.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-prefix-3.textproto new file mode 100644 index 000000000..b8a84c9d1 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-prefix-3.textproto @@ -0,0 +1,20 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# In the input data, one field cannot be a prefix of another, even if the values +# could in principle be combined. + +description: "update-paths: prefix #3" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "a" + field: "d" + > + json_values: "{\"b\": 1}" + json_values: "2" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-special-chars.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-special-chars.textproto new file mode 100644 index 000000000..51cb33b31 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-special-chars.textproto @@ -0,0 +1,53 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# FieldPaths can contain special characters. + +description: "update-paths: special characters" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "*" + field: "~" + > + field_paths: < + field: "*" + field: "`" + > + json_values: "1" + json_values: "2" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "*" + value: < + map_value: < + fields: < + key: "`" + value: < + integer_value: 2 + > + > + fields: < + key: "~" + value: < + integer_value: 1 + > + > + > + > + > + > + update_mask: < + field_paths: "`*`.`\\``" + field_paths: "`*`.`~`" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-alone.textproto new file mode 100644 index 000000000..abc44f55b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-alone.textproto @@ -0,0 +1,29 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ServerTimestamps, then no update operation +# should be produced. + +description: "update-paths: ServerTimestamp alone" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "\"ServerTimestamp\"" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + set_to_server_value: REQUEST_TIME + > + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-multi.textproto new file mode 100644 index 000000000..b0b7df17d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-multi.textproto @@ -0,0 +1,56 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ServerTimestamp field. Since all the +# ServerTimestamp fields are removed, the only field in the update is "a". + +description: "update-paths: multiple ServerTimestamp fields" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + field_paths: < + field: "c" + > + json_values: "1" + json_values: "\"ServerTimestamp\"" + json_values: "{\"d\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c.d" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-nested.textproto new file mode 100644 index 000000000..307736831 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-nested.textproto @@ -0,0 +1,49 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A ServerTimestamp value can occur at any depth. In this case, the transform +# applies to the field path "b.c". Since "c" is removed from the update, "b" +# becomes empty, so it is also removed from the update. + +description: "update-paths: nested ServerTimestamp field" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "{\"c\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-noarray-nested.textproto new file mode 100644 index 000000000..2c2cb89b6 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-noarray-nested.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ServerTimestamp sentinel. Firestore transforms don't support array indexing. + +description: "update-paths: ServerTimestamp cannot be anywhere inside an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, {\"b\": \"ServerTimestamp\"}]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-noarray.textproto new file mode 100644 index 000000000..a2baa66f5 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-noarray.textproto @@ -0,0 +1,15 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. Firestore transforms +# don't support array indexing. + +description: "update-paths: ServerTimestamp cannot be in an array value" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "[1, 2, \"ServerTimestamp\"]" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-with-empty-map.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-with-empty-map.textproto new file mode 100644 index 000000000..a54a24156 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st-with-empty-map.textproto @@ -0,0 +1,51 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a ServerTimestamp and a map both reside inside a map, the ServerTimestamp +# should be stripped out but the empty map should remain. + +description: "update-paths: ServerTimestamp beside an empty map" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + json_values: "{\"b\": {}, \"c\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + map_value: < + > + > + > + > + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st.textproto new file mode 100644 index 000000000..40634c165 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-st.textproto @@ -0,0 +1,49 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with the special ServerTimestamp sentinel is removed from the data in the +# update operation. Instead it appears in a separate Transform operation. Note +# that in these tests, the string "ServerTimestamp" should be replaced with the +# special ServerTimestamp value. + +description: "update-paths: ServerTimestamp with data" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + field_paths: < + field: "a" + > + field_paths: < + field: "b" + > + json_values: "1" + json_values: "\"ServerTimestamp\"" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-paths-uptime.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-paths-uptime.textproto new file mode 100644 index 000000000..7a15874be --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-paths-uptime.textproto @@ -0,0 +1,40 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Update call supports a last-update-time precondition. + +description: "update-paths: last-update-time precondition" +update_paths: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + precondition: < + update_time: < + seconds: 42 + > + > + field_paths: < + field: "a" + > + json_values: "1" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + update_time: < + seconds: 42 + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-prefix-1.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-prefix-1.textproto new file mode 100644 index 000000000..e5c895e73 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-prefix-1.textproto @@ -0,0 +1,11 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# In the input data, one field cannot be a prefix of another. + +description: "update: prefix #1" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a.b\": 1, \"a\": 2}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-prefix-2.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-prefix-2.textproto new file mode 100644 index 000000000..487017618 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-prefix-2.textproto @@ -0,0 +1,11 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# In the input data, one field cannot be a prefix of another. + +description: "update: prefix #2" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"a.b\": 2}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-prefix-3.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-prefix-3.textproto new file mode 100644 index 000000000..0c03b0d6b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-prefix-3.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# In the input data, one field cannot be a prefix of another, even if the values +# could in principle be combined. + +description: "update: prefix #3" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": {\"b\": 1}, \"a.d\": 2}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-quoting.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-quoting.textproto new file mode 100644 index 000000000..20e530a76 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-quoting.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# In a field path, any component beginning with a non-letter or underscore is +# quoted. + +description: "update: non-letter starting chars are quoted, except underscore" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"_0.1.+2\": 1}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "_0" + value: < + map_value: < + fields: < + key: "1" + value: < + map_value: < + fields: < + key: "+2" + value: < + integer_value: 1 + > + > + > + > + > + > + > + > + > + update_mask: < + field_paths: "_0.`1`.`+2`" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-split-top-level.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-split-top-level.textproto new file mode 100644 index 000000000..d1b0ca0da --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-split-top-level.textproto @@ -0,0 +1,45 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Update method splits only top-level keys at dots. Keys at other levels are +# taken literally. + +description: "update: Split on dots for top-level keys only" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"h.g\": {\"j.k\": 6}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "h" + value: < + map_value: < + fields: < + key: "g" + value: < + map_value: < + fields: < + key: "j.k" + value: < + integer_value: 6 + > + > + > + > + > + > + > + > + > + update_mask: < + field_paths: "h.g" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-split.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-split.textproto new file mode 100644 index 000000000..b96fd6a4f --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-split.textproto @@ -0,0 +1,44 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Update method splits top-level keys at dots. + +description: "update: split on dots" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a.b.c\": 1}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + map_value: < + fields: < + key: "c" + value: < + integer_value: 1 + > + > + > + > + > + > + > + > + > + update_mask: < + field_paths: "a.b.c" + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-st-alone.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-st-alone.textproto new file mode 100644 index 000000000..0d5ab6e9f --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-st-alone.textproto @@ -0,0 +1,26 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# If the only values in the input are ServerTimestamps, then no update operation +# should be produced. + +description: "update: ServerTimestamp alone" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a" + set_to_server_value: REQUEST_TIME + > + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-st-dot.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-st-dot.textproto new file mode 100644 index 000000000..19d4d1843 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-st-dot.textproto @@ -0,0 +1,27 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# Like other uses of ServerTimestamp, the data is pruned and the field does not +# appear in the update mask, because it is in the transform. In this case An +# update operation is produced just to hold the precondition. + +description: "update: ServerTimestamp with dotted field" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a.b.c\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a.b.c" + set_to_server_value: REQUEST_TIME + > + > + current_document: < + exists: true + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-st-multi.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-st-multi.textproto new file mode 100644 index 000000000..0434cb59a --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-st-multi.textproto @@ -0,0 +1,49 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A document can have more than one ServerTimestamp field. Since all the +# ServerTimestamp fields are removed, the only field in the update is "a". + +# b is not in the mask because it will be set in the transform. c must be in the +# mask: it should be replaced entirely. The transform will set c.d to the +# timestamp, but the update will delete the rest of c. + +description: "update: multiple ServerTimestamp fields" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": {\"d\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "c" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + field_transforms: < + field_path: "c.d" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-st-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-st-nested.textproto new file mode 100644 index 000000000..f79d9c6a0 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-st-nested.textproto @@ -0,0 +1,42 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A ServerTimestamp value can occur at any depth. In this case, the transform +# applies to the field path "b.c". Since "c" is removed from the update, "b" +# becomes empty, so it is also removed from the update. + +description: "update: nested ServerTimestamp field" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": {\"c\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + field_paths: "b" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-st-noarray-nested.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-st-noarray-nested.textproto new file mode 100644 index 000000000..2939dd646 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-st-noarray-nested.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# There cannot be an array value anywhere on the path from the document root to +# the ServerTimestamp sentinel. Firestore transforms don't support array indexing. + +description: "update: ServerTimestamp cannot be anywhere inside an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, {\"b\": \"ServerTimestamp\"}]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-st-noarray.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-st-noarray.textproto new file mode 100644 index 000000000..f3879cdf2 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-st-noarray.textproto @@ -0,0 +1,12 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The ServerTimestamp sentinel must be the value of a field. Firestore transforms +# don't support array indexing. + +description: "update: ServerTimestamp cannot be in an array value" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": [1, 2, \"ServerTimestamp\"]}" + is_error: true +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-st-with-empty-map.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-st-with-empty-map.textproto new file mode 100644 index 000000000..1901de2a1 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-st-with-empty-map.textproto @@ -0,0 +1,48 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# When a ServerTimestamp and a map both reside inside a map, the ServerTimestamp +# should be stripped out but the empty map should remain. + +description: "update: ServerTimestamp beside an empty map" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": {\"b\": {}, \"c\": \"ServerTimestamp\"}}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + map_value: < + fields: < + key: "b" + value: < + map_value: < + > + > + > + > + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "a.c" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-st.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-st.textproto new file mode 100644 index 000000000..12045a922 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-st.textproto @@ -0,0 +1,42 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# A key with the special ServerTimestamp sentinel is removed from the data in the +# update operation. Instead it appears in a separate Transform operation. Note +# that in these tests, the string "ServerTimestamp" should be replaced with the +# special ServerTimestamp value. + +description: "update: ServerTimestamp with data" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\"}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + exists: true + > + > + writes: < + transform: < + document: "projects/projectID/databases/(default)/documents/C/d" + field_transforms: < + field_path: "b" + set_to_server_value: REQUEST_TIME + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/testdata/update-uptime.textproto b/vendor/cloud.google.com/go/firestore/testdata/update-uptime.textproto new file mode 100644 index 000000000..66119ac61 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/testdata/update-uptime.textproto @@ -0,0 +1,37 @@ +# DO NOT MODIFY. This file was generated by +# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. + +# The Update call supports a last-update-time precondition. + +description: "update: last-update-time precondition" +update: < + doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" + precondition: < + update_time: < + seconds: 42 + > + > + json_data: "{\"a\": 1}" + request: < + database: "projects/projectID/databases/(default)" + writes: < + update: < + name: "projects/projectID/databases/(default)/documents/C/d" + fields: < + key: "a" + value: < + integer_value: 1 + > + > + > + update_mask: < + field_paths: "a" + > + current_document: < + update_time: < + seconds: 42 + > + > + > + > +> diff --git a/vendor/cloud.google.com/go/firestore/to_value.go b/vendor/cloud.google.com/go/firestore/to_value.go new file mode 100644 index 000000000..03236b251 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/to_value.go @@ -0,0 +1,299 @@ +// Copyright 2017 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 firestore + +import ( + "errors" + "fmt" + "reflect" + "time" + + "cloud.google.com/go/internal/fields" + "github.com/golang/protobuf/ptypes" + ts "github.com/golang/protobuf/ptypes/timestamp" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/genproto/googleapis/type/latlng" +) + +var nullValue = &pb.Value{ValueType: &pb.Value_NullValue{}} + +var ( + typeOfByteSlice = reflect.TypeOf([]byte{}) + typeOfGoTime = reflect.TypeOf(time.Time{}) + typeOfLatLng = reflect.TypeOf((*latlng.LatLng)(nil)) + typeOfDocumentRef = reflect.TypeOf((*DocumentRef)(nil)) + typeOfProtoTimestamp = reflect.TypeOf((*ts.Timestamp)(nil)) +) + +// toProtoValue converts a Go value to a Firestore Value protobuf. +// Some corner cases: +// - All nils (nil interface, nil slice, nil map, nil pointer) are converted to +// a NullValue (not a nil *pb.Value). toProtoValue never returns (nil, false, nil). +// It returns (nil, true, nil) if everything in the value is ServerTimestamp. +// - An error is returned for uintptr, uint and uint64, because Firestore uses +// an int64 to represent integral values, and those types can't be properly +// represented in an int64. +// - An error is returned for the special Delete value. +// +// toProtoValue also reports whether it recursively encountered a transform. +func toProtoValue(v reflect.Value) (pbv *pb.Value, sawTransform bool, err error) { + if !v.IsValid() { + return nullValue, false, nil + } + vi := v.Interface() + if vi == Delete { + return nil, false, errors.New("firestore: cannot use Delete in value") + } + if vi == ServerTimestamp { + return nil, false, errors.New("firestore: must use ServerTimestamp as a map value") + } + switch x := vi.(type) { + case []byte: + return &pb.Value{ValueType: &pb.Value_BytesValue{x}}, false, nil + case time.Time: + ts, err := ptypes.TimestampProto(x) + if err != nil { + return nil, false, err + } + return &pb.Value{ValueType: &pb.Value_TimestampValue{ts}}, false, nil + case *ts.Timestamp: + if x == nil { + // gRPC doesn't like nil oneofs. Use NullValue. + return nullValue, false, nil + } + return &pb.Value{ValueType: &pb.Value_TimestampValue{x}}, false, nil + case *latlng.LatLng: + if x == nil { + // gRPC doesn't like nil oneofs. Use NullValue. + return nullValue, false, nil + } + return &pb.Value{ValueType: &pb.Value_GeoPointValue{x}}, false, nil + case *DocumentRef: + if x == nil { + // gRPC doesn't like nil oneofs. Use NullValue. + return nullValue, false, nil + } + return &pb.Value{ValueType: &pb.Value_ReferenceValue{x.Path}}, false, nil + // Do not add bool, string, int, etc. to this switch; leave them in the + // reflect-based switch below. Moving them here would drop support for + // types whose underlying types are those primitives. + // E.g. Given "type mybool bool", an ordinary type switch on bool will + // not catch a mybool, but the reflect.Kind of a mybool is reflect.Bool. + } + switch v.Kind() { + case reflect.Bool: + return &pb.Value{ValueType: &pb.Value_BooleanValue{v.Bool()}}, false, nil + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return &pb.Value{ValueType: &pb.Value_IntegerValue{v.Int()}}, false, nil + case reflect.Uint8, reflect.Uint16, reflect.Uint32: + return &pb.Value{ValueType: &pb.Value_IntegerValue{int64(v.Uint())}}, false, nil + case reflect.Float32, reflect.Float64: + return &pb.Value{ValueType: &pb.Value_DoubleValue{v.Float()}}, false, nil + case reflect.String: + return &pb.Value{ValueType: &pb.Value_StringValue{v.String()}}, false, nil + case reflect.Slice: + return sliceToProtoValue(v) + case reflect.Map: + return mapToProtoValue(v) + case reflect.Struct: + return structToProtoValue(v) + case reflect.Ptr: + if v.IsNil() { + return nullValue, false, nil + } + return toProtoValue(v.Elem()) + case reflect.Interface: + if v.NumMethod() == 0 { // empty interface: recurse on its contents + return toProtoValue(v.Elem()) + } + fallthrough // any other interface value is an error + + default: + return nil, false, fmt.Errorf("firestore: cannot convert type %s to value", v.Type()) + } +} + +// sliceToProtoValue converts a slice to a Firestore Value protobuf and reports +// whether a transform was encountered. +func sliceToProtoValue(v reflect.Value) (*pb.Value, bool, error) { + // A nil slice is converted to a null value. + if v.IsNil() { + return nullValue, false, nil + } + vals := make([]*pb.Value, v.Len()) + for i := 0; i < v.Len(); i++ { + val, sawTransform, err := toProtoValue(v.Index(i)) + if err != nil { + return nil, false, err + } + if sawTransform { + return nil, false, fmt.Errorf("firestore: transforms cannot occur in an array, but saw some in %v", v.Index(i)) + } + vals[i] = val + } + return &pb.Value{ValueType: &pb.Value_ArrayValue{&pb.ArrayValue{Values: vals}}}, false, nil +} + +// mapToProtoValue converts a map to a Firestore Value protobuf and reports whether +// a transform was encountered. +func mapToProtoValue(v reflect.Value) (*pb.Value, bool, error) { + if v.Type().Key().Kind() != reflect.String { + return nil, false, errors.New("firestore: map key type must be string") + } + // A nil map is converted to a null value. + if v.IsNil() { + return nullValue, false, nil + } + m := map[string]*pb.Value{} + sawTransform := false + for _, k := range v.MapKeys() { + mi := v.MapIndex(k) + if mi.Interface() == ServerTimestamp { + sawTransform = true + continue + } else if _, ok := mi.Interface().(arrayUnion); ok { + sawTransform = true + continue + } else if _, ok := mi.Interface().(arrayRemove); ok { + sawTransform = true + continue + } + val, sst, err := toProtoValue(mi) + if err != nil { + return nil, false, err + } + if sst { + sawTransform = true + } + if val == nil { // value was a map with all ServerTimestamp values + continue + } + m[k.String()] = val + } + var pv *pb.Value + if len(m) == 0 && sawTransform { + // The entire map consisted of transform values. + pv = nil + } else { + pv = &pb.Value{ValueType: &pb.Value_MapValue{&pb.MapValue{Fields: m}}} + } + return pv, sawTransform, nil +} + +// structToProtoValue converts a struct to a Firestore Value protobuf and reports +// whether a transform was encountered. +func structToProtoValue(v reflect.Value) (*pb.Value, bool, error) { + m := map[string]*pb.Value{} + fields, err := fieldCache.Fields(v.Type()) + if err != nil { + return nil, false, err + } + sawTransform := false + if _, ok := v.Interface().(arrayUnion); ok { + return nil, false, errors.New("firestore: ArrayUnion may not be used in structs") + } + if _, ok := v.Interface().(arrayRemove); ok { + return nil, false, errors.New("firestore: ArrayRemove may not be used in structs") + } + + for _, f := range fields { + fv := v.FieldByIndex(f.Index) + opts := f.ParsedTag.(tagOptions) + if opts.serverTimestamp { + // TODO(jba): should we return a non-zero time? + sawTransform = true + continue + } + if opts.omitEmpty && isEmptyValue(fv) { + continue + } + val, sst, err := toProtoValue(fv) + if err != nil { + return nil, false, err + } + if sst { + sawTransform = true + } + if val == nil { // value was a map with all ServerTimestamp values + continue + } + m[f.Name] = val + } + var pv *pb.Value + if len(m) == 0 && sawTransform { + // The entire struct consisted of ServerTimestamp or omitempty values. + pv = nil + } else { + pv = &pb.Value{ValueType: &pb.Value_MapValue{&pb.MapValue{Fields: m}}} + } + return pv, sawTransform, nil +} + +type tagOptions struct { + omitEmpty bool // do not marshal value if empty + serverTimestamp bool // set time.Time to server timestamp on write +} + +// parseTag interprets firestore struct field tags. +func parseTag(t reflect.StructTag) (name string, keep bool, other interface{}, err error) { + name, keep, opts, err := fields.ParseStandardTag("firestore", t) + if err != nil { + return "", false, nil, fmt.Errorf("firestore: %v", err) + } + tagOpts := tagOptions{} + for _, opt := range opts { + switch opt { + case "omitempty": + tagOpts.omitEmpty = true + case "serverTimestamp": + tagOpts.serverTimestamp = true + default: + return "", false, nil, fmt.Errorf("firestore: unknown tag option: %q", opt) + } + } + return name, keep, tagOpts, nil +} + +// isLeafType determines whether or not a type is a 'leaf type' +// and should not be recursed into, but considered one field. +func isLeafType(t reflect.Type) bool { + return t == typeOfGoTime || t == typeOfLatLng || t == typeOfProtoTimestamp +} + +var fieldCache = fields.NewCache(parseTag, nil, isLeafType) + +// isEmptyValue is taken from the encoding/json package in the +// standard library. +// TODO(jba): move to the fields package +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + } + if v.Type() == typeOfGoTime { + return v.Interface().(time.Time).IsZero() + } + return false +} diff --git a/vendor/cloud.google.com/go/firestore/to_value_test.go b/vendor/cloud.google.com/go/firestore/to_value_test.go new file mode 100644 index 000000000..246110224 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/to_value_test.go @@ -0,0 +1,307 @@ +// Copyright 2017 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 firestore + +import ( + "fmt" + "reflect" + "testing" + "time" + + ts "github.com/golang/protobuf/ptypes/timestamp" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/genproto/googleapis/type/latlng" +) + +type testStruct1 struct { + B bool + I int + U uint32 + F float64 + S string + Y []byte + T time.Time + Ts *ts.Timestamp + G *latlng.LatLng + L []int + M map[string]int + P *int +} + +var ( + p = new(int) + + testVal1 = testStruct1{ + B: true, + I: 1, + U: 2, + F: 3.0, + S: "four", + Y: []byte{5}, + T: tm, + Ts: ptm, + G: ll, + L: []int{6}, + M: map[string]int{"a": 7}, + P: p, + } + + mapVal1 = mapval(map[string]*pb.Value{ + "B": boolval(true), + "I": intval(1), + "U": intval(2), + "F": floatval(3), + "S": {ValueType: &pb.Value_StringValue{"four"}}, + "Y": bytesval([]byte{5}), + "T": tsval(tm), + "Ts": {ValueType: &pb.Value_TimestampValue{ptm}}, + "G": geoval(ll), + "L": arrayval(intval(6)), + "M": mapval(map[string]*pb.Value{"a": intval(7)}), + "P": intval(8), + }) +) + +func TestToProtoValue(t *testing.T) { + *p = 8 + for _, test := range []struct { + in interface{} + want *pb.Value + }{ + {nil, nullValue}, + {[]int(nil), nullValue}, + {map[string]int(nil), nullValue}, + {(*testStruct1)(nil), nullValue}, + {(*ts.Timestamp)(nil), nullValue}, + {(*latlng.LatLng)(nil), nullValue}, + {(*DocumentRef)(nil), nullValue}, + {true, boolval(true)}, + {3, intval(3)}, + {uint32(3), intval(3)}, + {1.5, floatval(1.5)}, + {"str", strval("str")}, + {[]byte{1, 2}, bytesval([]byte{1, 2})}, + {tm, tsval(tm)}, + {ptm, &pb.Value{ValueType: &pb.Value_TimestampValue{ptm}}}, + {ll, geoval(ll)}, + {[]int{1, 2}, arrayval(intval(1), intval(2))}, + {&[]int{1, 2}, arrayval(intval(1), intval(2))}, + {[]int{}, arrayval()}, + {map[string]int{"a": 1, "b": 2}, + mapval(map[string]*pb.Value{"a": intval(1), "b": intval(2)})}, + {map[string]int{}, mapval(map[string]*pb.Value{})}, + {p, intval(8)}, + {&p, intval(8)}, + {map[string]interface{}{"a": 1, "p": p, "s": "str"}, + mapval(map[string]*pb.Value{"a": intval(1), "p": intval(8), "s": strval("str")})}, + {map[string]fmt.Stringer{"a": tm}, + mapval(map[string]*pb.Value{"a": tsval(tm)})}, + {testVal1, mapVal1}, + { + &DocumentRef{ + ID: "d", + Path: "projects/P/databases/D/documents/c/d", + Parent: &CollectionRef{ + ID: "c", + parentPath: "projects/P/databases/D", + Path: "projects/P/databases/D/documents/c", + Query: Query{collectionID: "c", parentPath: "projects/P/databases/D"}, + }, + }, + refval("projects/P/databases/D/documents/c/d"), + }, + // ServerTimestamps are removed, possibly leaving nil. + {map[string]interface{}{"a": ServerTimestamp}, nil}, + { + map[string]interface{}{ + "a": map[string]interface{}{ + "b": map[string]interface{}{ + "c": ServerTimestamp, + }, + }, + }, + nil, + }, + { + map[string]interface{}{ + "a": map[string]interface{}{ + "b": map[string]interface{}{ + "c": ServerTimestamp, + "d": ServerTimestamp, + }, + }, + }, + nil, + }, + { + map[string]interface{}{ + "a": map[string]interface{}{ + "b": map[string]interface{}{ + "c": ServerTimestamp, + "d": ServerTimestamp, + "e": 1, + }, + }, + }, + mapval(map[string]*pb.Value{ + "a": mapval(map[string]*pb.Value{ + "b": mapval(map[string]*pb.Value{"e": intval(1)}), + }), + }), + }, + + // Transforms are allowed in maps, but won't show up in the returned proto. Instead, we rely + // on seeing sawTransforms=true and a call to extractTransforms. + {map[string]interface{}{"a": ServerTimestamp, "b": 5}, mapval(map[string]*pb.Value{"b": intval(5)})}, + {map[string]interface{}{"a": ArrayUnion(1, 2, 3), "b": 5}, mapval(map[string]*pb.Value{"b": intval(5)})}, + {map[string]interface{}{"a": ArrayRemove(1, 2, 3), "b": 5}, mapval(map[string]*pb.Value{"b": intval(5)})}, + } { + got, _, err := toProtoValue(reflect.ValueOf(test.in)) + if err != nil { + t.Errorf("%v (%T): %v", test.in, test.in, err) + continue + } + if !testEqual(got, test.want) { + t.Errorf("%+v (%T):\ngot\n%+v\nwant\n%+v", test.in, test.in, got, test.want) + } + } +} + +type stringy struct{} + +func (stringy) String() string { return "stringy" } + +func TestToProtoValueErrors(t *testing.T) { + for _, in := range []interface{}{ + uint64(0), // a bad fit for int64 + map[int]bool{}, // map key type is not string + make(chan int), // can't handle type + map[string]fmt.Stringer{"a": stringy{}}, // only empty interfaces + ServerTimestamp, // ServerTimestamp can only be a field value + struct{ A interface{} }{A: ServerTimestamp}, + map[string]interface{}{"a": []interface{}{ServerTimestamp}}, + map[string]interface{}{"a": []interface{}{ + map[string]interface{}{"b": ServerTimestamp}, + }}, + Delete, // Delete should never appear + []interface{}{Delete}, + map[string]interface{}{"a": Delete}, + map[string]interface{}{"a": []interface{}{Delete}}, + + // Transforms are not allowed to occur in an array. + []interface{}{ServerTimestamp}, + []interface{}{ArrayUnion(1, 2, 3)}, + []interface{}{ArrayRemove(1, 2, 3)}, + + // Transforms are not allowed to occur in a struct. + struct{ A interface{} }{A: ServerTimestamp}, + struct{ A interface{} }{A: ArrayUnion()}, + struct{ A interface{} }{A: ArrayRemove()}, + } { + _, _, err := toProtoValue(reflect.ValueOf(in)) + if err == nil { + t.Errorf("%v: got nil, want error", in) + } + } +} + +func TestToProtoValue_SawTransform(t *testing.T) { + for i, in := range []interface{}{ + map[string]interface{}{"a": ServerTimestamp}, + map[string]interface{}{"a": ArrayUnion()}, + map[string]interface{}{"a": ArrayRemove()}, + } { + _, sawTransform, err := toProtoValue(reflect.ValueOf(in)) + if err != nil { + t.Fatalf("%d %v: got err %v\nexpected nil", i, in, err) + } + if !sawTransform { + t.Errorf("%d %v: got sawTransform=false, expected sawTransform=true", i, in) + } + } +} + +type testStruct2 struct { + Ignore int `firestore:"-"` + Rename int `firestore:"a"` + OmitEmpty int `firestore:",omitempty"` + OmitEmptyTime time.Time `firestore:",omitempty"` +} + +func TestToProtoValueTags(t *testing.T) { + in := &testStruct2{ + Ignore: 1, + Rename: 2, + OmitEmpty: 3, + OmitEmptyTime: aTime, + } + got, _, err := toProtoValue(reflect.ValueOf(in)) + if err != nil { + t.Fatal(err) + } + want := mapval(map[string]*pb.Value{ + "a": intval(2), + "OmitEmpty": intval(3), + "OmitEmptyTime": tsval(aTime), + }) + if !testEqual(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } + + got, _, err = toProtoValue(reflect.ValueOf(testStruct2{})) + if err != nil { + t.Fatal(err) + } + want = mapval(map[string]*pb.Value{"a": intval(0)}) + if !testEqual(got, want) { + t.Errorf("got\n%+v\nwant\n%+v", got, want) + } +} + +func TestToProtoValueEmbedded(t *testing.T) { + // Embedded time.Time, LatLng, or Timestamp should behave like non-embedded. + type embed struct { + time.Time + *latlng.LatLng + *ts.Timestamp + } + + got, _, err := toProtoValue(reflect.ValueOf(embed{tm, ll, ptm})) + if err != nil { + t.Fatal(err) + } + want := mapval(map[string]*pb.Value{ + "Time": tsval(tm), + "LatLng": geoval(ll), + "Timestamp": {ValueType: &pb.Value_TimestampValue{ptm}}, + }) + if !testEqual(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } +} + +func TestIsEmpty(t *testing.T) { + for _, e := range []interface{}{int(0), float32(0), false, "", []int{}, []int(nil), (*int)(nil)} { + if !isEmptyValue(reflect.ValueOf(e)) { + t.Errorf("%v (%T): want true, got false", e, e) + } + } + i := 3 + for _, n := range []interface{}{int(1), float32(1), true, "x", []int{1}, &i} { + if isEmptyValue(reflect.ValueOf(n)) { + t.Errorf("%v (%T): want false, got true", n, n) + } + } +} diff --git a/vendor/cloud.google.com/go/firestore/transaction.go b/vendor/cloud.google.com/go/firestore/transaction.go new file mode 100644 index 000000000..5bfe3e78d --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/transaction.go @@ -0,0 +1,282 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "errors" + + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Transaction represents a Firestore transaction. +type Transaction struct { + c *Client + ctx context.Context + id []byte + writes []*pb.Write + maxAttempts int + readOnly bool + readAfterWrite bool +} + +// A TransactionOption is an option passed to Client.Transaction. +type TransactionOption interface { + config(t *Transaction) +} + +// MaxAttempts is a TransactionOption that configures the maximum number of times to +// try a transaction. In defaults to DefaultTransactionMaxAttempts. +func MaxAttempts(n int) maxAttempts { return maxAttempts(n) } + +type maxAttempts int + +func (m maxAttempts) config(t *Transaction) { t.maxAttempts = int(m) } + +// DefaultTransactionMaxAttempts is the default number of times to attempt a transaction. +const DefaultTransactionMaxAttempts = 5 + +// ReadOnly is a TransactionOption that makes the transaction read-only. Read-only +// transactions cannot issue write operations, but are more efficient. +var ReadOnly = ro{} + +type ro struct{} + +func (ro) config(t *Transaction) { t.readOnly = true } + +var ( + // Defined here for testing. + errReadAfterWrite = errors.New("firestore: read after write in transaction") + errWriteReadOnly = errors.New("firestore: write in read-only transaction") + errNonTransactionalOp = errors.New("firestore: non-transactional operation inside a transaction") + errNestedTransaction = errors.New("firestore: nested transaction") +) + +type transactionInProgressKey struct{} + +func checkTransaction(ctx context.Context) error { + if ctx.Value(transactionInProgressKey{}) != nil { + return errNonTransactionalOp + } + return nil +} + +// RunTransaction runs f in a transaction. f should use the transaction it is given +// for all Firestore operations. For any operation requiring a context, f should use +// the context it is passed, not the first argument to RunTransaction. +// +// f must not call Commit or Rollback on the provided Transaction. +// +// If f returns nil, RunTransaction commits the transaction. If the commit fails due +// to a conflicting transaction, RunTransaction retries f. It gives up and returns an +// error after a number of attempts that can be configured with the MaxAttempts +// option. If the commit succeeds, RunTransaction returns a nil error. +// +// If f returns non-nil, then the transaction will be rolled back and +// this method will return the same error. The function f is not retried. +// +// Note that when f returns, the transaction is not committed. Calling code +// must not assume that any of f's changes have been committed until +// RunTransaction returns nil. +// +// Since f may be called more than once, f should usually be idempotent – that is, it +// should have the same result when called multiple times. +func (c *Client) RunTransaction(ctx context.Context, f func(context.Context, *Transaction) error, opts ...TransactionOption) error { + if ctx.Value(transactionInProgressKey{}) != nil { + return errNestedTransaction + } + db := c.path() + t := &Transaction{ + c: c, + ctx: withResourceHeader(ctx, db), + maxAttempts: DefaultTransactionMaxAttempts, + } + for _, opt := range opts { + opt.config(t) + } + var txOpts *pb.TransactionOptions + if t.readOnly { + txOpts = &pb.TransactionOptions{ + Mode: &pb.TransactionOptions_ReadOnly_{&pb.TransactionOptions_ReadOnly{}}, + } + } + var backoff gax.Backoff + // TODO(jba): use other than the standard backoff parameters? + // TODO(jba): get backoff time from gRPC trailer metadata? See extractRetryDelay in https://code.googlesource.com/gocloud/+/master/spanner/retry.go. + var err error + for i := 0; i < t.maxAttempts; i++ { + var res *pb.BeginTransactionResponse + res, err = t.c.c.BeginTransaction(t.ctx, &pb.BeginTransactionRequest{ + Database: db, + Options: txOpts, + }) + if err != nil { + return err + } + t.id = res.Transaction + err = f(context.WithValue(ctx, transactionInProgressKey{}, 1), t) + // Read after write can only be checked client-side, so we make sure to check + // even if the user does not. + if err == nil && t.readAfterWrite { + err = errReadAfterWrite + } + if err != nil { + t.rollback() + // Prefer f's returned error to rollback error. + return err + } + _, err = t.c.c.Commit(t.ctx, &pb.CommitRequest{ + Database: t.c.path(), + Writes: t.writes, + Transaction: t.id, + }) + // If a read-write transaction returns Aborted, retry. + // On success or other failures, return here. + if t.readOnly || grpc.Code(err) != codes.Aborted { + // According to the Firestore team, we should not roll back here + // if err != nil. But spanner does. + // See https://code.googlesource.com/gocloud/+/master/spanner/transaction.go#740. + return err + } + + if txOpts == nil { + // txOpts can only be nil if is the first retry of a read-write transaction. + // (It is only set here and in the body of "if t.readOnly" above.) + // Mention the transaction ID in BeginTransaction so the service + // knows it is a retry. + txOpts = &pb.TransactionOptions{ + Mode: &pb.TransactionOptions_ReadWrite_{ + &pb.TransactionOptions_ReadWrite{RetryTransaction: t.id}, + }, + } + } + // Use exponential backoff to avoid contention with other running + // transactions. + if cerr := sleep(ctx, backoff.Pause()); cerr != nil { + err = cerr + break + } + } + // If we run out of retries, return the last error we saw (which should + // be the Aborted from Commit, or a context error). + if err != nil { + t.rollback() + } + return err +} + +func (t *Transaction) rollback() { + _ = t.c.c.Rollback(t.ctx, &pb.RollbackRequest{ + Database: t.c.path(), + Transaction: t.id, + }) + // Ignore the rollback error. + // TODO(jba): Log it? + // Note: Rollback is idempotent so it will be retried by the gapic layer. +} + +// Get gets the document in the context of the transaction. The transaction holds a +// pessimistic lock on the returned document. +func (t *Transaction) Get(dr *DocumentRef) (*DocumentSnapshot, error) { + docsnaps, err := t.GetAll([]*DocumentRef{dr}) + if err != nil { + return nil, err + } + ds := docsnaps[0] + if !ds.Exists() { + return ds, status.Errorf(codes.NotFound, "%q not found", dr.Path) + } + return ds, nil +} + +// GetAll retrieves multiple documents with a single call. The DocumentSnapshots are +// returned in the order of the given DocumentRefs. If a document is not present, the +// corresponding DocumentSnapshot's Exists method will return false. The transaction +// holds a pessimistic lock on all of the returned documents. +func (t *Transaction) GetAll(drs []*DocumentRef) ([]*DocumentSnapshot, error) { + if len(t.writes) > 0 { + t.readAfterWrite = true + return nil, errReadAfterWrite + } + return t.c.getAll(t.ctx, drs, t.id) +} + +// A Queryer is a Query or a CollectionRef. CollectionRefs act as queries whose +// results are all the documents in the collection. +type Queryer interface { + query() *Query +} + +// Documents returns a DocumentIterator based on given Query or CollectionRef. The +// results will be in the context of the transaction. +func (t *Transaction) Documents(q Queryer) *DocumentIterator { + if len(t.writes) > 0 { + t.readAfterWrite = true + return &DocumentIterator{err: errReadAfterWrite} + } + return &DocumentIterator{ + iter: newQueryDocumentIterator(t.ctx, q.query(), t.id), + } +} + +// DocumentRefs returns references to all the documents in the collection, including +// missing documents. A missing document is a document that does not exist but has +// sub-documents. +func (t *Transaction) DocumentRefs(cr *CollectionRef) *DocumentRefIterator { + if len(t.writes) > 0 { + t.readAfterWrite = true + return &DocumentRefIterator{err: errReadAfterWrite} + } + return newDocumentRefIterator(t.ctx, cr, t.id) +} + +// Create adds a Create operation to the Transaction. +// See DocumentRef.Create for details. +func (t *Transaction) Create(dr *DocumentRef, data interface{}) error { + return t.addWrites(dr.newCreateWrites(data)) +} + +// Set adds a Set operation to the Transaction. +// See DocumentRef.Set for details. +func (t *Transaction) Set(dr *DocumentRef, data interface{}, opts ...SetOption) error { + return t.addWrites(dr.newSetWrites(data, opts)) +} + +// Delete adds a Delete operation to the Transaction. +// See DocumentRef.Delete for details. +func (t *Transaction) Delete(dr *DocumentRef, opts ...Precondition) error { + return t.addWrites(dr.newDeleteWrites(opts)) +} + +// Update adds a new Update operation to the Transaction. +// See DocumentRef.Update for details. +func (t *Transaction) Update(dr *DocumentRef, data []Update, opts ...Precondition) error { + return t.addWrites(dr.newUpdatePathWrites(data, opts)) +} + +func (t *Transaction) addWrites(ws []*pb.Write, err error) error { + if t.readOnly { + return errWriteReadOnly + } + if err != nil { + return err + } + t.writes = append(t.writes, ws...) + return nil +} diff --git a/vendor/cloud.google.com/go/firestore/transaction_test.go b/vendor/cloud.google.com/go/firestore/transaction_test.go new file mode 100644 index 000000000..3955a1a31 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/transaction_test.go @@ -0,0 +1,394 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "testing" + + "github.com/golang/protobuf/ptypes/empty" + "google.golang.org/api/iterator" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestRunTransaction(t *testing.T) { + ctx := context.Background() + const db = "projects/projectID/databases/(default)" + tid := []byte{1} + c, srv := newMock(t) + beginReq := &pb.BeginTransactionRequest{Database: db} + beginRes := &pb.BeginTransactionResponse{Transaction: tid} + commitReq := &pb.CommitRequest{Database: db, Transaction: tid} + // Empty transaction. + srv.addRPC(beginReq, beginRes) + srv.addRPC(commitReq, &pb.CommitResponse{CommitTime: aTimestamp}) + err := c.RunTransaction(ctx, func(context.Context, *Transaction) error { return nil }) + if err != nil { + t.Fatal(err) + } + + // Transaction with read and write. + srv.reset() + srv.addRPC(beginReq, beginRes) + aDoc := &pb.Document{ + Name: db + "/documents/C/a", + CreateTime: aTimestamp, + UpdateTime: aTimestamp2, + Fields: map[string]*pb.Value{"count": intval(1)}, + } + srv.addRPC( + &pb.BatchGetDocumentsRequest{ + Database: c.path(), + Documents: []string{db + "/documents/C/a"}, + ConsistencySelector: &pb.BatchGetDocumentsRequest_Transaction{tid}, + }, []interface{}{ + &pb.BatchGetDocumentsResponse{ + Result: &pb.BatchGetDocumentsResponse_Found{aDoc}, + ReadTime: aTimestamp2, + }, + }) + aDoc2 := &pb.Document{ + Name: aDoc.Name, + Fields: map[string]*pb.Value{"count": intval(2)}, + } + srv.addRPC( + &pb.CommitRequest{ + Database: db, + Transaction: tid, + Writes: []*pb.Write{{ + Operation: &pb.Write_Update{aDoc2}, + UpdateMask: &pb.DocumentMask{FieldPaths: []string{"count"}}, + CurrentDocument: &pb.Precondition{ + ConditionType: &pb.Precondition_Exists{true}, + }, + }}, + }, + &pb.CommitResponse{CommitTime: aTimestamp3}, + ) + err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error { + docref := c.Collection("C").Doc("a") + doc, err := tx.Get(docref) + if err != nil { + return err + } + count, err := doc.DataAt("count") + if err != nil { + return err + } + return tx.Update(docref, []Update{{Path: "count", Value: count.(int64) + 1}}) + }) + if err != nil { + t.Fatal(err) + } + + // Query + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC( + &pb.RunQueryRequest{ + Parent: db, + QueryType: &pb.RunQueryRequest_StructuredQuery{ + &pb.StructuredQuery{ + From: []*pb.StructuredQuery_CollectionSelector{{CollectionId: "C"}}, + }, + }, + ConsistencySelector: &pb.RunQueryRequest_Transaction{tid}, + }, + []interface{}{}, + ) + srv.addRPC(commitReq, &pb.CommitResponse{CommitTime: aTimestamp3}) + err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error { + it := tx.Documents(c.Collection("C")) + defer it.Stop() + _, err := it.Next() + if err != iterator.Done { + return err + } + return nil + }) + if err != nil { + t.Fatal(err) + } + + // Retry entire transaction. + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(commitReq, status.Errorf(codes.Aborted, "")) + srv.addRPC( + &pb.BeginTransactionRequest{ + Database: db, + Options: &pb.TransactionOptions{ + Mode: &pb.TransactionOptions_ReadWrite_{ + &pb.TransactionOptions_ReadWrite{RetryTransaction: tid}, + }, + }, + }, + beginRes, + ) + srv.addRPC(commitReq, &pb.CommitResponse{CommitTime: aTimestamp}) + err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error { return nil }) + if err != nil { + t.Fatal(err) + } +} + +func TestTransactionErrors(t *testing.T) { + ctx := context.Background() + const db = "projects/projectID/databases/(default)" + c, srv := newMock(t) + var ( + tid = []byte{1} + internalErr = status.Errorf(codes.Internal, "so sad") + beginReq = &pb.BeginTransactionRequest{ + Database: db, + } + beginRes = &pb.BeginTransactionResponse{Transaction: tid} + getReq = &pb.BatchGetDocumentsRequest{ + Database: c.path(), + Documents: []string{db + "/documents/C/a"}, + ConsistencySelector: &pb.BatchGetDocumentsRequest_Transaction{tid}, + } + rollbackReq = &pb.RollbackRequest{Database: db, Transaction: tid} + commitReq = &pb.CommitRequest{Database: db, Transaction: tid} + ) + + // BeginTransaction has a permanent error. + srv.addRPC(beginReq, internalErr) + err := c.RunTransaction(ctx, func(context.Context, *Transaction) error { return nil }) + if grpc.Code(err) != codes.Internal { + t.Errorf("got <%v>, want Internal", err) + } + + // Get has a permanent error. + get := func(_ context.Context, tx *Transaction) error { + _, err := tx.Get(c.Doc("C/a")) + return err + } + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(getReq, internalErr) + srv.addRPC(rollbackReq, &empty.Empty{}) + err = c.RunTransaction(ctx, get) + if grpc.Code(err) != codes.Internal { + t.Errorf("got <%v>, want Internal", err) + } + + // Get has a permanent error, but the rollback fails. We still + // return Get's error. + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(getReq, internalErr) + srv.addRPC(rollbackReq, status.Errorf(codes.FailedPrecondition, "")) + err = c.RunTransaction(ctx, get) + if grpc.Code(err) != codes.Internal { + t.Errorf("got <%v>, want Internal", err) + } + + // Commit has a permanent error. + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(getReq, []interface{}{ + &pb.BatchGetDocumentsResponse{ + Result: &pb.BatchGetDocumentsResponse_Found{&pb.Document{ + Name: "projects/projectID/databases/(default)/documents/C/a", + CreateTime: aTimestamp, + UpdateTime: aTimestamp2, + }}, + ReadTime: aTimestamp2, + }, + }) + srv.addRPC(commitReq, internalErr) + err = c.RunTransaction(ctx, get) + if grpc.Code(err) != codes.Internal { + t.Errorf("got <%v>, want Internal", err) + } + + // Read after write. + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(rollbackReq, &empty.Empty{}) + err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error { + if err := tx.Delete(c.Doc("C/a")); err != nil { + return err + } + if _, err := tx.Get(c.Doc("C/a")); err != nil { + return err + } + return nil + }) + if err != errReadAfterWrite { + t.Errorf("got <%v>, want <%v>", err, errReadAfterWrite) + } + + // Read after write, with query. + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(rollbackReq, &empty.Empty{}) + err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error { + if err := tx.Delete(c.Doc("C/a")); err != nil { + return err + } + it := tx.Documents(c.Collection("C").Select("x")) + defer it.Stop() + if _, err := it.Next(); err != iterator.Done { + return err + } + return nil + }) + if err != errReadAfterWrite { + t.Errorf("got <%v>, want <%v>", err, errReadAfterWrite) + } + + // Read after write fails even if the user ignores the read's error. + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(rollbackReq, &empty.Empty{}) + err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error { + if err := tx.Delete(c.Doc("C/a")); err != nil { + return err + } + if _, err := tx.Get(c.Doc("C/a")); err != nil { + return err + } + return nil + }) + if err != errReadAfterWrite { + t.Errorf("got <%v>, want <%v>", err, errReadAfterWrite) + } + + // Write in read-only transaction. + srv.reset() + srv.addRPC( + &pb.BeginTransactionRequest{ + Database: db, + Options: &pb.TransactionOptions{ + Mode: &pb.TransactionOptions_ReadOnly_{&pb.TransactionOptions_ReadOnly{}}, + }, + }, + beginRes, + ) + srv.addRPC(rollbackReq, &empty.Empty{}) + err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error { + return tx.Delete(c.Doc("C/a")) + }, ReadOnly) + if err != errWriteReadOnly { + t.Errorf("got <%v>, want <%v>", err, errWriteReadOnly) + } + + // Too many retries. + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(commitReq, status.Errorf(codes.Aborted, "")) + srv.addRPC( + &pb.BeginTransactionRequest{ + Database: db, + Options: &pb.TransactionOptions{ + Mode: &pb.TransactionOptions_ReadWrite_{ + &pb.TransactionOptions_ReadWrite{RetryTransaction: tid}, + }, + }, + }, + beginRes, + ) + srv.addRPC(commitReq, status.Errorf(codes.Aborted, "")) + srv.addRPC(rollbackReq, &empty.Empty{}) + err = c.RunTransaction(ctx, func(context.Context, *Transaction) error { return nil }, + MaxAttempts(2)) + if grpc.Code(err) != codes.Aborted { + t.Errorf("got <%v>, want Aborted", err) + } + + // Nested transaction. + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(rollbackReq, &empty.Empty{}) + err = c.RunTransaction(ctx, func(ctx context.Context, tx *Transaction) error { + return c.RunTransaction(ctx, func(context.Context, *Transaction) error { return nil }) + }) + if got, want := err, errNestedTransaction; got != want { + t.Errorf("got <%v>, want <%v>", got, want) + } + + // Non-transactional operation. + dr := c.Doc("C/d") + + for i, op := range []func(ctx context.Context) error{ + func(ctx context.Context) error { _, err := c.GetAll(ctx, []*DocumentRef{dr}); return err }, + func(ctx context.Context) error { _, _, err := c.Collection("C").Add(ctx, testData); return err }, + func(ctx context.Context) error { _, err := dr.Get(ctx); return err }, + func(ctx context.Context) error { _, err := dr.Create(ctx, testData); return err }, + func(ctx context.Context) error { _, err := dr.Set(ctx, testData); return err }, + func(ctx context.Context) error { _, err := dr.Delete(ctx); return err }, + func(ctx context.Context) error { + _, err := dr.Update(ctx, []Update{{FieldPath: []string{"*"}, Value: 1}}) + return err + }, + func(ctx context.Context) error { it := c.Collections(ctx); _, err := it.Next(); return err }, + func(ctx context.Context) error { it := dr.Collections(ctx); _, err := it.Next(); return err }, + func(ctx context.Context) error { + _, err := c.Batch().Set(dr, testData).Commit(ctx) + return err + }, + func(ctx context.Context) error { + it := c.Collection("C").Documents(ctx) + defer it.Stop() + _, err := it.Next() + return err + }, + } { + srv.reset() + srv.addRPC(beginReq, beginRes) + srv.addRPC(rollbackReq, &empty.Empty{}) + err = c.RunTransaction(ctx, func(ctx context.Context, _ *Transaction) error { + return op(ctx) + }) + if got, want := err, errNonTransactionalOp; got != want { + t.Errorf("#%d: got <%v>, want <%v>", i, got, want) + } + } +} + +func TestTransactionGetAll(t *testing.T) { + c, srv := newMock(t) + defer c.Close() + const dbPath = "projects/projectID/databases/(default)" + tid := []byte{1} + beginReq := &pb.BeginTransactionRequest{Database: dbPath} + beginRes := &pb.BeginTransactionResponse{Transaction: tid} + srv.addRPC(beginReq, beginRes) + req := &pb.BatchGetDocumentsRequest{ + Database: dbPath, + Documents: []string{ + dbPath + "/documents/C/a", + dbPath + "/documents/C/b", + dbPath + "/documents/C/c", + }, + ConsistencySelector: &pb.BatchGetDocumentsRequest_Transaction{tid}, + } + err := c.RunTransaction(context.Background(), func(_ context.Context, tx *Transaction) error { + testGetAll(t, c, srv, dbPath, + func(drs []*DocumentRef) ([]*DocumentSnapshot, error) { return tx.GetAll(drs) }, + req) + commitReq := &pb.CommitRequest{Database: dbPath, Transaction: tid} + srv.addRPC(commitReq, &pb.CommitResponse{CommitTime: aTimestamp}) + return nil + }) + if err != nil { + t.Fatal(err) + } +} diff --git a/vendor/cloud.google.com/go/firestore/util_test.go b/vendor/cloud.google.com/go/firestore/util_test.go new file mode 100644 index 000000000..b655d3723 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/util_test.go @@ -0,0 +1,147 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "fmt" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/ptypes" + tspb "github.com/golang/protobuf/ptypes/timestamp" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "google.golang.org/api/option" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/genproto/googleapis/type/latlng" + "google.golang.org/grpc" +) + +var ( + aTime = time.Date(2017, 1, 26, 0, 0, 0, 0, time.UTC) + aTime2 = time.Date(2017, 2, 5, 0, 0, 0, 0, time.UTC) + aTime3 = time.Date(2017, 3, 20, 0, 0, 0, 0, time.UTC) + aTimestamp = mustTimestampProto(aTime) + aTimestamp2 = mustTimestampProto(aTime2) + aTimestamp3 = mustTimestampProto(aTime3) +) + +func mustTimestampProto(t time.Time) *tspb.Timestamp { + ts, err := ptypes.TimestampProto(t) + if err != nil { + panic(err) + } + return ts +} + +var cmpOpts = []cmp.Option{ + cmp.AllowUnexported(DocumentRef{}, CollectionRef{}, DocumentSnapshot{}, + Query{}, filter{}, order{}, fpv{}), + cmpopts.IgnoreTypes(Client{}, &Client{}), +} + +// testEqual implements equality for Firestore tests. +func testEqual(a, b interface{}) bool { + return testutil.Equal(a, b, cmpOpts...) +} + +func testDiff(a, b interface{}) string { + return testutil.Diff(a, b, cmpOpts...) +} + +func TestTestEqual(t *testing.T) { + for _, test := range []struct { + a, b interface{} + want bool + }{ + {nil, nil, true}, + {([]int)(nil), nil, false}, + {nil, ([]int)(nil), false}, + {([]int)(nil), ([]int)(nil), true}, + } { + if got := testEqual(test.a, test.b); got != test.want { + t.Errorf("testEqual(%#v, %#v) == %t, want %t", test.a, test.b, got, test.want) + } + } +} + +func newMock(t *testing.T) (*Client, *mockServer) { + srv, err := newMockServer() + if err != nil { + t.Fatal(err) + } + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure(), grpc.WithBlock()) + if err != nil { + t.Fatal(err) + } + client, err := NewClient(context.Background(), "projectID", option.WithGRPCConn(conn)) + if err != nil { + t.Fatal(err) + } + return client, srv +} + +func intval(i int) *pb.Value { + return int64val(int64(i)) +} + +func int64val(i int64) *pb.Value { + return &pb.Value{ValueType: &pb.Value_IntegerValue{i}} +} + +func boolval(b bool) *pb.Value { + return &pb.Value{ValueType: &pb.Value_BooleanValue{b}} +} + +func floatval(f float64) *pb.Value { + return &pb.Value{ValueType: &pb.Value_DoubleValue{f}} +} + +func strval(s string) *pb.Value { + return &pb.Value{ValueType: &pb.Value_StringValue{s}} +} + +func bytesval(b []byte) *pb.Value { + return &pb.Value{ValueType: &pb.Value_BytesValue{b}} +} + +func tsval(t time.Time) *pb.Value { + ts, err := ptypes.TimestampProto(t) + if err != nil { + panic(fmt.Sprintf("bad time %s in test: %v", t, err)) + } + return &pb.Value{ValueType: &pb.Value_TimestampValue{ts}} +} + +func geoval(ll *latlng.LatLng) *pb.Value { + return &pb.Value{ValueType: &pb.Value_GeoPointValue{ll}} +} + +func arrayval(s ...*pb.Value) *pb.Value { + if s == nil { + s = []*pb.Value{} + } + return &pb.Value{ValueType: &pb.Value_ArrayValue{&pb.ArrayValue{Values: s}}} +} + +func mapval(m map[string]*pb.Value) *pb.Value { + return &pb.Value{ValueType: &pb.Value_MapValue{&pb.MapValue{Fields: m}}} +} + +func refval(path string) *pb.Value { + return &pb.Value{ValueType: &pb.Value_ReferenceValue{path}} +} diff --git a/vendor/cloud.google.com/go/firestore/watch.go b/vendor/cloud.google.com/go/firestore/watch.go new file mode 100644 index 000000000..ec31d9833 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/watch.go @@ -0,0 +1,519 @@ +// 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. + +package firestore + +import ( + "context" + "errors" + "fmt" + "io" + "log" + "sort" + "time" + + "cloud.google.com/go/internal/btree" + "github.com/golang/protobuf/ptypes" + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// LogWatchStreams controls whether watch stream status changes are logged. +// This feature is EXPERIMENTAL and may disappear at any time. +var LogWatchStreams = false + +// DocumentChangeKind describes the kind of change to a document between +// query snapshots. +type DocumentChangeKind int + +const ( + // DocumentAdded indicates that the document was added for the first time. + DocumentAdded DocumentChangeKind = iota + // DocumentRemoved indicates that the document was removed. + DocumentRemoved + // DocumentModified indicates that the document was modified. + DocumentModified +) + +// A DocumentChange describes the change to a document from one query snapshot to the next. +type DocumentChange struct { + Kind DocumentChangeKind + Doc *DocumentSnapshot + // The zero-based index of the document in the sequence of query results prior to this change, + // or -1 if the document was not present. + OldIndex int + // The zero-based index of the document in the sequence of query results after this change, + // or -1 if the document is no longer present. + NewIndex int +} + +// Implementation of realtime updates (a.k.a. watch). +// This code is closely based on the Node.js implementation, +// https://github.com/googleapis/nodejs-firestore/blob/master/src/watch.js. + +// The sole target ID for all streams from this client. +// Variable for testing. +var watchTargetID int32 = 'g' + 'o' + +var defaultBackoff = gax.Backoff{ + // Values from https://github.com/googleapis/nodejs-firestore/blob/master/src/backoff.js. + Initial: 1 * time.Second, + Max: 60 * time.Second, + Multiplier: 1.5, +} + +// not goroutine-safe +type watchStream struct { + ctx context.Context + c *Client + lc pb.Firestore_ListenClient // the gRPC stream + target *pb.Target // document or query being watched + backoff gax.Backoff // for stream retries + err error // sticky permanent error + readTime time.Time // time of most recent snapshot + current bool // saw CURRENT, but not RESET; precondition for a snapshot + hasReturned bool // have we returned a snapshot yet? + compare func(a, b *DocumentSnapshot) (int, error) // compare documents according to query + + // An ordered tree where DocumentSnapshots are the keys. + docTree *btree.BTree + // Map of document name to DocumentSnapshot for the last returned snapshot. + docMap map[string]*DocumentSnapshot + // Map of document name to DocumentSnapshot for accumulated changes for the current snapshot. + // A nil value means the document was removed. + changeMap map[string]*DocumentSnapshot +} + +func newWatchStreamForDocument(ctx context.Context, dr *DocumentRef) *watchStream { + // A single document is always equal to itself. + compare := func(_, _ *DocumentSnapshot) (int, error) { return 0, nil } + return newWatchStream(ctx, dr.Parent.c, compare, &pb.Target{ + TargetType: &pb.Target_Documents{ + Documents: &pb.Target_DocumentsTarget{Documents: []string{dr.Path}}, + }, + TargetId: watchTargetID, + }) +} + +func newWatchStreamForQuery(ctx context.Context, q Query) (*watchStream, error) { + qp, err := q.toProto() + if err != nil { + return nil, err + } + target := &pb.Target{ + TargetType: &pb.Target_Query{ + Query: &pb.Target_QueryTarget{ + Parent: q.parentPath, + QueryType: &pb.Target_QueryTarget_StructuredQuery{qp}, + }, + }, + TargetId: watchTargetID, + } + return newWatchStream(ctx, q.c, q.compareFunc(), target), nil +} + +const btreeDegree = 4 + +func newWatchStream(ctx context.Context, c *Client, compare func(_, _ *DocumentSnapshot) (int, error), target *pb.Target) *watchStream { + w := &watchStream{ + ctx: ctx, + c: c, + compare: compare, + target: target, + backoff: defaultBackoff, + docMap: map[string]*DocumentSnapshot{}, + changeMap: map[string]*DocumentSnapshot{}, + } + w.docTree = btree.New(btreeDegree, func(a, b interface{}) bool { + return w.less(a.(*DocumentSnapshot), b.(*DocumentSnapshot)) + }) + return w +} + +func (s *watchStream) less(a, b *DocumentSnapshot) bool { + c, err := s.compare(a, b) + if err != nil { + s.err = err + return false + } + return c < 0 +} + +// Once nextSnapshot returns an error, it will always return the same error. +func (s *watchStream) nextSnapshot() (*btree.BTree, []DocumentChange, time.Time, error) { + if s.err != nil { + return nil, nil, time.Time{}, s.err + } + var changes []DocumentChange + for { + // Process messages until we are in a consistent state. + for !s.handleNextMessage() { + } + if s.err != nil { + _ = s.close() // ignore error + return nil, nil, time.Time{}, s.err + } + var newDocTree *btree.BTree + newDocTree, changes = s.computeSnapshot(s.docTree, s.docMap, s.changeMap, s.readTime) + if s.err != nil { + return nil, nil, time.Time{}, s.err + } + // Only return a snapshot if something has changed, or this is the first snapshot. + if !s.hasReturned || newDocTree != s.docTree { + s.docTree = newDocTree + break + } + } + s.changeMap = map[string]*DocumentSnapshot{} + s.hasReturned = true + return s.docTree, changes, s.readTime, nil +} + +// Read a message from the stream and handle it. Return true when +// we're in a consistent state, or there is a permanent error. +func (s *watchStream) handleNextMessage() bool { + res, err := s.recv() + if err != nil { + s.err = err + // Errors returned by recv are permanent. + return true + } + switch r := res.ResponseType.(type) { + case *pb.ListenResponse_TargetChange: + return s.handleTargetChange(r.TargetChange) + + case *pb.ListenResponse_DocumentChange: + name := r.DocumentChange.Document.Name + s.logf("DocumentChange %q", name) + if hasWatchTargetID(r.DocumentChange.TargetIds) { // document changed + ref, err := pathToDoc(name, s.c) + if err == nil { + s.changeMap[name], err = newDocumentSnapshot(ref, r.DocumentChange.Document, s.c, nil) + } + if err != nil { + s.err = err + return true + } + } else if hasWatchTargetID(r.DocumentChange.RemovedTargetIds) { // document removed + s.changeMap[name] = nil + } + + case *pb.ListenResponse_DocumentDelete: + s.logf("Delete %q", r.DocumentDelete.Document) + s.changeMap[r.DocumentDelete.Document] = nil + + case *pb.ListenResponse_DocumentRemove: + s.logf("Remove %q", r.DocumentRemove.Document) + s.changeMap[r.DocumentRemove.Document] = nil + + case *pb.ListenResponse_Filter: + s.logf("Filter %d", r.Filter.Count) + if int(r.Filter.Count) != s.currentSize() { + s.resetDocs() // Remove all the current results. + // The filter didn't match; close the stream so it will be re-opened on the next + // call to nextSnapshot. + _ = s.close() // ignore error + s.lc = nil + } + + default: + s.err = fmt.Errorf("unknown response type %T", r) + return true + } + return false +} + +// Return true iff in a consistent state, or there is a permanent error. +func (s *watchStream) handleTargetChange(tc *pb.TargetChange) bool { + switch tc.TargetChangeType { + case pb.TargetChange_NO_CHANGE: + s.logf("TargetNoChange %d %v", len(tc.TargetIds), tc.ReadTime) + if len(tc.TargetIds) == 0 && tc.ReadTime != nil && s.current { + // Everything is up-to-date, so we are ready to return a snapshot. + rt, err := ptypes.Timestamp(tc.ReadTime) + if err != nil { + s.err = err + return true + } + s.readTime = rt + s.target.ResumeType = &pb.Target_ResumeToken{tc.ResumeToken} + return true + } + + case pb.TargetChange_ADD: + s.logf("TargetAdd") + if tc.TargetIds[0] != watchTargetID { + s.err = errors.New("unexpected target ID sent by server") + return true + } + + case pb.TargetChange_REMOVE: + s.logf("TargetRemove") + // We should never see a remove. + if tc.Cause != nil { + s.err = status.Error(codes.Code(tc.Cause.Code), tc.Cause.Message) + } else { + s.err = status.Error(codes.Internal, "firestore: client saw REMOVE") + } + return true + + // The targets reflect all changes committed before the targets were added + // to the stream. + case pb.TargetChange_CURRENT: + s.logf("TargetCurrent") + s.current = true + + // The targets have been reset, and a new initial state for the targets will be + // returned in subsequent changes. Whatever changes have happened so far no + // longer matter. + case pb.TargetChange_RESET: + s.logf("TargetReset") + s.resetDocs() + + default: + s.err = fmt.Errorf("firestore: unknown TargetChange type %s", tc.TargetChangeType) + return true + } + // If we see a resume token and our watch ID is affected, we assume the stream + // is now healthy, so we reset our backoff time to the minimum. + if tc.ResumeToken != nil && (len(tc.TargetIds) == 0 || hasWatchTargetID(tc.TargetIds)) { + s.backoff = defaultBackoff + } + return false // not in a consistent state, keep receiving +} + +func (s *watchStream) resetDocs() { + s.target.ResumeType = nil // clear resume token + s.current = false + s.changeMap = map[string]*DocumentSnapshot{} + // Mark each document as deleted. If documents are not deleted, they + // will be send again by the server. + it := s.docTree.BeforeIndex(0) + for it.Next() { + s.changeMap[it.Key.(*DocumentSnapshot).Ref.Path] = nil + } +} + +func (s *watchStream) currentSize() int { + _, adds, deletes := extractChanges(s.docMap, s.changeMap) + return len(s.docMap) + len(adds) - len(deletes) +} + +// Return the changes that have occurred since the last snapshot. +func extractChanges(docMap, changeMap map[string]*DocumentSnapshot) (updates, adds []*DocumentSnapshot, deletes []string) { + for name, doc := range changeMap { + switch { + case doc == nil: + if _, ok := docMap[name]; ok { + deletes = append(deletes, name) + } + case docMap[name] != nil: + updates = append(updates, doc) + default: + adds = append(adds, doc) + } + } + return updates, adds, deletes +} + +// For development only. +// TODO(jba): remove. +func assert(b bool) { + if !b { + panic("assertion failed") + } +} + +// Applies the mutations in changeMap to both the document tree and the +// document lookup map. Modifies docMap in place and returns a new docTree. +// If there were no changes, returns docTree unmodified. +func (s *watchStream) computeSnapshot(docTree *btree.BTree, docMap, changeMap map[string]*DocumentSnapshot, readTime time.Time) (*btree.BTree, []DocumentChange) { + var changes []DocumentChange + updatedTree := docTree + assert(docTree.Len() == len(docMap)) + updates, adds, deletes := extractChanges(docMap, changeMap) + if len(adds) > 0 || len(deletes) > 0 { + updatedTree = docTree.Clone() + } + // Process the sorted changes in the order that is expected by our clients + // (removals, additions, and then modifications). We also need to sort the + // individual changes to assure that oldIndex/newIndex keep incrementing. + deldocs := make([]*DocumentSnapshot, len(deletes)) + for i, d := range deletes { + deldocs[i] = docMap[d] + } + sort.Sort(byLess{deldocs, s.less}) + for _, oldDoc := range deldocs { + assert(oldDoc != nil) + delete(docMap, oldDoc.Ref.Path) + _, oldi := updatedTree.GetWithIndex(oldDoc) + // TODO(jba): have btree.Delete return old index + _, found := updatedTree.Delete(oldDoc) + assert(found) + changes = append(changes, DocumentChange{ + Kind: DocumentRemoved, + Doc: oldDoc, + OldIndex: oldi, + NewIndex: -1, + }) + } + sort.Sort(byLess{adds, s.less}) + for _, newDoc := range adds { + name := newDoc.Ref.Path + assert(docMap[name] == nil) + newDoc.ReadTime = readTime + docMap[name] = newDoc + updatedTree.Set(newDoc, nil) + // TODO(jba): change btree so Set returns index as second value. + _, newi := updatedTree.GetWithIndex(newDoc) + changes = append(changes, DocumentChange{ + Kind: DocumentAdded, + Doc: newDoc, + OldIndex: -1, + NewIndex: newi, + }) + } + sort.Sort(byLess{updates, s.less}) + for _, newDoc := range updates { + name := newDoc.Ref.Path + oldDoc := docMap[name] + assert(oldDoc != nil) + if newDoc.UpdateTime.Equal(oldDoc.UpdateTime) { + continue + } + if updatedTree == docTree { + updatedTree = docTree.Clone() + } + newDoc.ReadTime = readTime + docMap[name] = newDoc + _, oldi := updatedTree.GetWithIndex(oldDoc) + updatedTree.Delete(oldDoc) + updatedTree.Set(newDoc, nil) + _, newi := updatedTree.GetWithIndex(newDoc) + changes = append(changes, DocumentChange{ + Kind: DocumentModified, + Doc: newDoc, + OldIndex: oldi, + NewIndex: newi, + }) + } + assert(updatedTree.Len() == len(docMap)) + return updatedTree, changes +} + +type byLess struct { + s []*DocumentSnapshot + less func(a, b *DocumentSnapshot) bool +} + +func (b byLess) Len() int { return len(b.s) } +func (b byLess) Swap(i, j int) { b.s[i], b.s[j] = b.s[j], b.s[i] } +func (b byLess) Less(i, j int) bool { return b.less(b.s[i], b.s[j]) } + +func hasWatchTargetID(ids []int32) bool { + for _, id := range ids { + if id == watchTargetID { + return true + } + } + return false +} + +func (s *watchStream) logf(format string, args ...interface{}) { + if LogWatchStreams { + log.Printf(format, args...) + } +} + +// Close the stream. From this point on, calls to nextSnapshot will return +// io.EOF, or the error from CloseSend. +func (s *watchStream) stop() { + err := s.close() + if s.err != nil { // don't change existing error + return + } + if err != nil { + s.err = err + } + s.err = io.EOF // normal shutdown +} + +func (s *watchStream) close() error { + if s.lc == nil { + return nil + } + return s.lc.CloseSend() +} + +// recv receives the next message from the stream. It also handles opening the stream +// initially, and reopening it on non-permanent errors. +// recv doesn't have to be goroutine-safe. +func (s *watchStream) recv() (*pb.ListenResponse, error) { + var err error + for { + if s.lc == nil { + s.lc, err = s.open() + if err != nil { + // Do not retry if open fails. + return nil, err + } + } + res, err := s.lc.Recv() + if err == nil || isPermanentWatchError(err) { + return res, err + } + // Non-permanent error. Sleep and retry. + s.changeMap = map[string]*DocumentSnapshot{} // clear changeMap + dur := s.backoff.Pause() + // If we're out of quota, wait a long time before retrying. + if status.Code(err) == codes.ResourceExhausted { + dur = s.backoff.Max + } + if err := sleep(s.ctx, dur); err != nil { + return nil, err + } + s.lc = nil + } +} + +func (s *watchStream) open() (pb.Firestore_ListenClient, error) { + dbPath := s.c.path() + lc, err := s.c.c.Listen(withResourceHeader(s.ctx, dbPath)) + if err == nil { + err = lc.Send(&pb.ListenRequest{ + Database: dbPath, + TargetChange: &pb.ListenRequest_AddTarget{AddTarget: s.target}, + }) + } + if err != nil { + return nil, err + } + return lc, nil +} + +func isPermanentWatchError(err error) bool { + if err == io.EOF { + // Retry on normal end-of-stream. + return false + } + switch status.Code(err) { + case codes.Unknown, codes.DeadlineExceeded, codes.ResourceExhausted, + codes.Internal, codes.Unavailable, codes.Unauthenticated: + return false + default: + return true + } +} diff --git a/vendor/cloud.google.com/go/firestore/watch_test.go b/vendor/cloud.google.com/go/firestore/watch_test.go new file mode 100644 index 000000000..c7f163f01 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/watch_test.go @@ -0,0 +1,224 @@ +// 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. + +package firestore + +import ( + "context" + "sort" + "testing" + "time" + + "cloud.google.com/go/internal/btree" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestWatchRecv(t *testing.T) { + ctx := context.Background() + c, srv := newMock(t) + db := defaultBackoff + defaultBackoff = gax.Backoff{Initial: 1, Max: 1, Multiplier: 1} + defer func() { defaultBackoff = db }() + + ws := newWatchStream(ctx, c, nil, &pb.Target{}) + request := &pb.ListenRequest{ + Database: "projects/projectID/databases/(default)", + TargetChange: &pb.ListenRequest_AddTarget{&pb.Target{}}, + } + response := &pb.ListenResponse{ResponseType: &pb.ListenResponse_DocumentChange{&pb.DocumentChange{}}} + // Stream should retry on non-permanent errors, returning only the responses. + srv.addRPC(request, []interface{}{response, status.Error(codes.Unknown, "")}) + srv.addRPC(request, []interface{}{response}) // stream will return io.EOF + srv.addRPC(request, []interface{}{response, status.Error(codes.DeadlineExceeded, "")}) + srv.addRPC(request, []interface{}{status.Error(codes.ResourceExhausted, "")}) + srv.addRPC(request, []interface{}{status.Error(codes.Internal, "")}) + srv.addRPC(request, []interface{}{status.Error(codes.Unavailable, "")}) + srv.addRPC(request, []interface{}{status.Error(codes.Unauthenticated, "")}) + srv.addRPC(request, []interface{}{response}) + for i := 0; i < 4; i++ { + res, err := ws.recv() + if err != nil { + t.Fatal(err) + } + if !proto.Equal(res, response) { + t.Fatalf("got %v, want %v", res, response) + } + } + + // Stream should not retry on a permanent error. + srv.addRPC(request, []interface{}{status.Error(codes.AlreadyExists, "")}) + _, err := ws.recv() + if got, want := status.Code(err), codes.AlreadyExists; got != want { + t.Fatalf("got %s, want %s", got, want) + } +} + +func TestComputeSnapshot(t *testing.T) { + c := &Client{ + projectID: "projID", + databaseID: "(database)", + } + ws := newWatchStream(context.Background(), c, nil, &pb.Target{}) + tm := time.Now() + i := 0 + doc := func(path, value string) *DocumentSnapshot { + i++ + return &DocumentSnapshot{ + Ref: c.Doc(path), + proto: &pb.Document{Fields: map[string]*pb.Value{"foo": strval(value)}}, + UpdateTime: tm.Add(time.Duration(i) * time.Second), // need unique time for updates + } + } + val := func(d *DocumentSnapshot) string { return d.proto.Fields["foo"].GetStringValue() } + less := func(a, b *DocumentSnapshot) bool { return val(a) < val(b) } + + type dmap map[string]*DocumentSnapshot + + ds1 := doc("C/d1", "a") + ds2 := doc("C/d2", "b") + ds2c := doc("C/d2", "c") + docTree := btree.New(4, func(a, b interface{}) bool { return less(a.(*DocumentSnapshot), b.(*DocumentSnapshot)) }) + var gotChanges []DocumentChange + docMap := dmap{} + // The following test cases are not independent; each builds on the output of the previous. + for _, test := range []struct { + desc string + changeMap dmap + wantDocs []*DocumentSnapshot + wantChanges []DocumentChange + }{ + { + "no changes", + nil, + nil, + nil, + }, + { + "add a doc", + dmap{ds1.Ref.Path: ds1}, + []*DocumentSnapshot{ds1}, + []DocumentChange{{Kind: DocumentAdded, Doc: ds1, OldIndex: -1, NewIndex: 0}}, + }, + { + "add, remove", + dmap{ds1.Ref.Path: nil, ds2.Ref.Path: ds2}, + []*DocumentSnapshot{ds2}, + []DocumentChange{ + {Kind: DocumentRemoved, Doc: ds1, OldIndex: 0, NewIndex: -1}, + {Kind: DocumentAdded, Doc: ds2, OldIndex: -1, NewIndex: 0}, + }, + }, + { + "add back, modify", + dmap{ds1.Ref.Path: ds1, ds2c.Ref.Path: ds2c}, + []*DocumentSnapshot{ds1, ds2c}, + []DocumentChange{ + {Kind: DocumentAdded, Doc: ds1, OldIndex: -1, NewIndex: 0}, + {Kind: DocumentModified, Doc: ds2c, OldIndex: 1, NewIndex: 1}, + }, + }, + } { + docTree, gotChanges = ws.computeSnapshot(docTree, docMap, test.changeMap, time.Time{}) + gotDocs := treeDocs(docTree) + if diff := testDiff(gotDocs, test.wantDocs); diff != "" { + t.Fatalf("%s: %s", test.desc, diff) + } + mgot := mapDocs(docMap, less) + if diff := testDiff(gotDocs, mgot); diff != "" { + t.Fatalf("%s: docTree and docMap disagree: %s", test.desc, diff) + } + if diff := testDiff(gotChanges, test.wantChanges); diff != "" { + t.Fatalf("%s: %s", test.desc, diff) + } + } + + // Verify that if there are no changes, the returned docTree is identical to the first arg. + // docTree already has ds2c. + got, _ := ws.computeSnapshot(docTree, docMap, dmap{ds2c.Ref.Path: ds2c}, time.Time{}) + if got != docTree { + t.Error("returned docTree != arg docTree") + } +} + +func treeDocs(bt *btree.BTree) []*DocumentSnapshot { + var ds []*DocumentSnapshot + it := bt.BeforeIndex(0) + for it.Next() { + ds = append(ds, it.Key.(*DocumentSnapshot)) + } + return ds +} + +func mapDocs(m map[string]*DocumentSnapshot, less func(a, b *DocumentSnapshot) bool) []*DocumentSnapshot { + var ds []*DocumentSnapshot + for _, d := range m { + ds = append(ds, d) + } + sort.Sort(byLess{ds, less}) + return ds +} + +func TestWatchCancel(t *testing.T) { + // Canceling the context of a watch should result in a codes.Canceled error from the next + // call to the iterator's Next method. + ctx := context.Background() + c, srv := newMock(t) + q := Query{c: c, collectionID: "x"} + + // Cancel before open. + ctx2, cancel := context.WithCancel(ctx) + ws, err := newWatchStreamForQuery(ctx2, q) + if err != nil { + t.Fatal(err) + } + cancel() + _, _, _, err = ws.nextSnapshot() + codeEq(t, "cancel before open", codes.Canceled, err) + + request := &pb.ListenRequest{ + Database: "projects/projectID/databases/(default)", + TargetChange: &pb.ListenRequest_AddTarget{ws.target}, + } + current := &pb.ListenResponse{ResponseType: &pb.ListenResponse_TargetChange{&pb.TargetChange{ + TargetChangeType: pb.TargetChange_CURRENT, + }}} + noChange := &pb.ListenResponse{ResponseType: &pb.ListenResponse_TargetChange{&pb.TargetChange{ + TargetChangeType: pb.TargetChange_NO_CHANGE, + ReadTime: aTimestamp, + }}} + + // Cancel from gax.Sleep. We should still see a gRPC error with codes.Canceled, not a + // context.Canceled error. + ctx2, cancel = context.WithCancel(ctx) + ws, err = newWatchStreamForQuery(ctx2, q) + if err != nil { + t.Fatal(err) + } + srv.addRPC(request, []interface{}{current, noChange}) + _, _, _, _ = ws.nextSnapshot() + cancel() + // Because of how the mock works, the following results in an EOF on the stream, which + // is a non-permanent error that causes a retry. That retry ends up in gax.Sleep, which + // finds that the context is done and returns ctx.Err(), which is context.Canceled. + // Verify that we transform that context.Canceled into a gRPC Status with code Canceled. + _, _, _, err = ws.nextSnapshot() + codeEq(t, "cancel from gax.Sleep", codes.Canceled, err) + + // TODO(jba): Test that we get codes.Canceled when canceling an RPC. + // We had a test for this in a21236af, but it was flaky for unclear reasons. +} diff --git a/vendor/cloud.google.com/go/firestore/writebatch.go b/vendor/cloud.google.com/go/firestore/writebatch.go new file mode 100644 index 000000000..5ed3429a7 --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/writebatch.go @@ -0,0 +1,81 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "errors" + + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +// A WriteBatch holds multiple database updates. Build a batch with the Create, Set, +// Update and Delete methods, then run it with the Commit method. Errors in Create, +// Set, Update or Delete are recorded instead of being returned immediately. The +// first such error is returned by Commit. +type WriteBatch struct { + c *Client + err error + writes []*pb.Write +} + +func (b *WriteBatch) add(ws []*pb.Write, err error) *WriteBatch { + if b.err != nil { + return b + } + if err != nil { + b.err = err + return b + } + b.writes = append(b.writes, ws...) + return b +} + +// Create adds a Create operation to the batch. +// See DocumentRef.Create for details. +func (b *WriteBatch) Create(dr *DocumentRef, data interface{}) *WriteBatch { + return b.add(dr.newCreateWrites(data)) +} + +// Set adds a Set operation to the batch. +// See DocumentRef.Set for details. +func (b *WriteBatch) Set(dr *DocumentRef, data interface{}, opts ...SetOption) *WriteBatch { + return b.add(dr.newSetWrites(data, opts)) +} + +// Delete adds a Delete operation to the batch. +// See DocumentRef.Delete for details. +func (b *WriteBatch) Delete(dr *DocumentRef, opts ...Precondition) *WriteBatch { + return b.add(dr.newDeleteWrites(opts)) +} + +// Update adds an Update operation to the batch. +// See DocumentRef.Update for details. +func (b *WriteBatch) Update(dr *DocumentRef, data []Update, opts ...Precondition) *WriteBatch { + return b.add(dr.newUpdatePathWrites(data, opts)) +} + +// Commit applies all the writes in the batch to the database atomically. Commit +// returns an error if there are no writes in the batch, if any errors occurred in +// constructing the writes, or if the Commmit operation fails. +func (b *WriteBatch) Commit(ctx context.Context) ([]*WriteResult, error) { + if b.err != nil { + return nil, b.err + } + if len(b.writes) == 0 { + return nil, errors.New("firestore: cannot commit empty WriteBatch") + } + return b.c.commit(ctx, b.writes) +} diff --git a/vendor/cloud.google.com/go/firestore/writebatch_test.go b/vendor/cloud.google.com/go/firestore/writebatch_test.go new file mode 100644 index 000000000..fa688c04b --- /dev/null +++ b/vendor/cloud.google.com/go/firestore/writebatch_test.go @@ -0,0 +1,118 @@ +// Copyright 2017 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 firestore + +import ( + "context" + "testing" + + pb "google.golang.org/genproto/googleapis/firestore/v1beta1" +) + +func TestWriteBatch(t *testing.T) { + type update struct{ A int } + + c, srv := newMock(t) + docPrefix := c.Collection("C").Path + "/" + srv.addRPC( + &pb.CommitRequest{ + Database: c.path(), + Writes: []*pb.Write{ + { // Create + Operation: &pb.Write_Update{ + Update: &pb.Document{ + Name: docPrefix + "a", + Fields: testFields, + }, + }, + CurrentDocument: &pb.Precondition{ + ConditionType: &pb.Precondition_Exists{false}, + }, + }, + { // Set + Operation: &pb.Write_Update{ + Update: &pb.Document{ + Name: docPrefix + "b", + Fields: testFields, + }, + }, + }, + { // Delete + Operation: &pb.Write_Delete{ + Delete: docPrefix + "c", + }, + }, + { // Update + Operation: &pb.Write_Update{ + Update: &pb.Document{ + Name: docPrefix + "f", + Fields: map[string]*pb.Value{"*": intval(3)}, + }, + }, + UpdateMask: &pb.DocumentMask{FieldPaths: []string{"`*`"}}, + CurrentDocument: &pb.Precondition{ + ConditionType: &pb.Precondition_Exists{true}, + }, + }, + }, + }, + &pb.CommitResponse{ + WriteResults: []*pb.WriteResult{ + {UpdateTime: aTimestamp}, + {UpdateTime: aTimestamp2}, + {UpdateTime: aTimestamp3}, + }, + }, + ) + gotWRs, err := c.Batch(). + Create(c.Doc("C/a"), testData). + Set(c.Doc("C/b"), testData). + Delete(c.Doc("C/c")). + Update(c.Doc("C/f"), []Update{{FieldPath: []string{"*"}, Value: 3}}). + Commit(context.Background()) + if err != nil { + t.Fatal(err) + } + wantWRs := []*WriteResult{{aTime}, {aTime2}, {aTime3}} + if !testEqual(gotWRs, wantWRs) { + t.Errorf("got %+v\nwant %+v", gotWRs, wantWRs) + } +} + +func TestWriteBatchErrors(t *testing.T) { + ctx := context.Background() + c, _ := newMock(t) + for _, test := range []struct { + desc string + batch *WriteBatch + }{ + { + "empty batch", + c.Batch(), + }, + { + "bad doc reference", + c.Batch().Create(c.Doc("a"), testData), + }, + { + "bad data", + c.Batch().Create(c.Doc("a/b"), 3), + }, + } { + if _, err := test.batch.Commit(ctx); err == nil { + t.Errorf("%s: got nil, want error", test.desc) + } + } +} diff --git a/vendor/cloud.google.com/go/functions/metadata/doc.go b/vendor/cloud.google.com/go/functions/metadata/doc.go new file mode 100644 index 000000000..8f5afef51 --- /dev/null +++ b/vendor/cloud.google.com/go/functions/metadata/doc.go @@ -0,0 +1,19 @@ +// 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. + +// Package metadata provides methods for creating and accessing context.Context +// objects with Google Cloud Functions metadata. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +package metadata // import "cloud.google.com/go/functions/metadata" diff --git a/vendor/cloud.google.com/go/functions/metadata/metadata.go b/vendor/cloud.google.com/go/functions/metadata/metadata.go new file mode 100644 index 000000000..26f443481 --- /dev/null +++ b/vendor/cloud.google.com/go/functions/metadata/metadata.go @@ -0,0 +1,98 @@ +// 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. + +package metadata + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "time" +) + +// Metadata holds Google Cloud Functions metadata. +type Metadata struct { + // EventID is a unique ID for the event. For example: "70172329041928". + EventID string `json:"eventId"` + // Timestamp is the date/time this event was created. + Timestamp time.Time `json:"timestamp"` + // EventType is the type of the event. For example: "google.pubsub.topic.publish". + EventType string `json:"eventType"` + // Resource is the resource that triggered the event. + // TODO(tbp): Make this a pointer. + Resource Resource `json:"resource"` +} + +// Resource holds Google Cloud Functions resource metadata. +// Resource values are dependent on the event type they're from. +type Resource struct { + // Service is the service that triggered the event. + Service string `json:"service"` + // Name is the name associated with the event. + Name string `json:"name"` + // Type is the type of event. + Type string `json:"type"` +} + +type contextKey string + +// GCFContextKey satisfies an interface to be able to use contextKey to read +// metadata from a Cloud Functions context.Context. +// +// Be careful making changes to this function. See FromContext. +func (k contextKey) GCFContextKey() string { + return string(k) +} + +const metadataContextKey = contextKey("metadata") + +// FromContext extracts the Metadata from the Context, if present. +func FromContext(ctx context.Context) (*Metadata, error) { + if ctx == nil { + return nil, errors.New("nil ctx") + } + // The original JSON is inserted by the Cloud Functions worker. So, the + // format must not change, or the message may fail to unmarshal. We use + // JSON as a common format between the worker and this package to ensure + // this package can be updated independently from the worker. The contextKey + // type and the metadataContextKey value use an interface to avoid using + // a built-in type as a context key (which is easy to have collisions with). + // If we need another value to be stored in the context, we can use a new + // key or interface and avoid needing to change this one. Similarly, if we + // need to change the format of the message, we should add an additional key + // to keep backward compatibility. + b, ok := ctx.Value(metadataContextKey).(json.RawMessage) + if !ok { + return nil, errors.New("unable to find metadata") + } + meta := &Metadata{} + if err := json.Unmarshal(b, meta); err != nil { + return nil, fmt.Errorf("json.Unmarshal: %v", err) + } + return meta, nil +} + +// NewContext returns a new Context carrying m. If m is nil, NewContext returns +// ctx. NewContext is only used for writing tests which rely on Metadata. +func NewContext(ctx context.Context, m *Metadata) context.Context { + if m == nil { + return ctx + } + b, err := json.Marshal(m) + if err != nil { + return ctx + } + return context.WithValue(ctx, metadataContextKey, json.RawMessage(b)) +} diff --git a/vendor/cloud.google.com/go/functions/metadata/metadata_test.go b/vendor/cloud.google.com/go/functions/metadata/metadata_test.go new file mode 100644 index 000000000..9f9d2e51c --- /dev/null +++ b/vendor/cloud.google.com/go/functions/metadata/metadata_test.go @@ -0,0 +1,53 @@ +// 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. + +package metadata + +import ( + "context" + "reflect" + "testing" +) + +func TestMetadata(t *testing.T) { + tests := []struct { + meta *Metadata + }{ + { + &Metadata{EventID: "test event ID"}, + }, + } + for _, test := range tests { + ctx := NewContext(context.Background(), test.meta) + got, err := FromContext(ctx) + if err != nil { + t.Fatalf("FromContext error: %v", err) + } + if !reflect.DeepEqual(got, test.meta) { + t.Fatalf("FromContext\nGot %v\nWant %v", got, test.meta) + } + } +} + +func TestMetadataError(t *testing.T) { + if _, err := FromContext(nil); err == nil { + t.Errorf("FromContext got no error, wanted an error") + } + if _, err := FromContext(context.Background()); err == nil { + t.Errorf("FromContext got no error, wanted an error") + } + if _, err := FromContext(NewContext(context.Background(), nil)); err == nil { + t.Errorf("FromContext got no error, wanted an error") + } +} diff --git a/vendor/cloud.google.com/go/httpreplay/cmd/httpr/README.md b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/README.md new file mode 100644 index 000000000..3e25adece --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/README.md @@ -0,0 +1,71 @@ +# httpr, a Record/Replay Proxy + +httpr is an HTTP proxy that records and replays traffic. It is designed +specifically for Google APIs that use HTTP exclusively. These include the Google +Cloud Storage and BigQuery clients, as well as the clients in the +`github.com/google/google-api-*-client` repos. + +If you are writing Go code, you should use the `cloud.google.com/go/httpreplay` package, which +is a simpler way to use the proxy. + +## Using a Record/Replay Proxy + +A record/replay proxy lets you run an "integration" test that accesses a +backend like a Google service and record the interaction. Subsequent runs of the +test can replay the server's responses without actually contacting the server, +turning the integration test into a fast and inexpensive unit test. + +## Usage + +First, obtain the `httpr` binary. If you have the Go toolchain, you can run `go +get -u cloud.google.com/go/httpreplay/cmd/httpr`. Otherwise, precompiled +binaries for various architectures and operating systems are available from [the +releases page](https://github.com/GoogleCloudPlatform/google-cloud-go/releases). + +### Recording + +1. Start `httpr` in record mode by passing it the `-record` flag with a filename: + ``` + httpr -record myclient.replay + ``` + By default, `httpr` will run on port 8080, and open a control port on 8181. + You can change these with the `-port` and `-control-port` flags. + You will want to run `httpr` in the background or in another window. +1. In order for `httpr` to record HTTPS traffic, your client must trust it. It + does so by installing a CA certificate created by `httpr` during the + recording session. To obtain the certificate in PEM form, GET the URL + `http://localhost:8181/authority.cer`. (If you changed the control port, use + it in place of 8181.) Consult your language to determine + how to install the certificate. Note that the certificate is different for each run + of `httpr`. +1. Arrange for your test program to use `httpr` as a proxy. This may be as + simple as setting the `HTTPS_PROXY` environment variable. +1. Run your test program, using whatever authentication for your Google API + clients that you wish. +1. Send `httpr` a SIGINT signal (`kill -2`). `httpr` will write + the replay file, then exit. + +### Replaying + +1. Start `httpr` in replay mode, in the background or another window: + ``` + httpr -replay myclient.replay + ``` +1. Install the CA certificate as described above. +1. Have your test program treat `httpr` as a proxy, as described above. +1. Run your test program. Your Google API clients should use no authentication. + +## Tips + +You must remove all randomness from your interaction while recording, +so that the replay is fully deterministic. + +Note that BigQuery clients choose random values for job IDs and insert ID if you +do not supply them. Either supply your own, or seed the client's random number +generator if possible. + +## Examples + +Examples of running `httpr` can be found in `examples` under this file's directory. + + diff --git a/vendor/cloud.google.com/go/httpreplay/cmd/httpr/examples/python/httpr-demo.py b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/examples/python/httpr-demo.py new file mode 100644 index 000000000..5f68498f0 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/examples/python/httpr-demo.py @@ -0,0 +1,26 @@ +from __future__ import print_function + +import sys +from google.auth.credentials import AnonymousCredentials +from google.cloud import storage + + +if len(sys.argv)-1 != 3: + print('args: PROJECT BUCKET record|replay') + sys.exit(1) +project = sys.argv[1] +bucket_name = sys.argv[2] +mode = sys.argv[3] + +if mode == 'record': + creds = None # use default creds for demo purposes; not recommended + client = storage.Client(project=project) +elif mode == 'replay': + creds = AnonymousCredentials() +else: + print('want record or replay') + sys.exit(1) + +client = storage.Client(project=project, credentials=creds) +bucket = client.get_bucket(bucket_name) +print('bucket %s created %s' %(bucket.id, bucket.time_created)) diff --git a/vendor/cloud.google.com/go/httpreplay/cmd/httpr/examples/python/httpr-demo.sh b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/examples/python/httpr-demo.sh new file mode 100755 index 000000000..aae45b877 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/examples/python/httpr-demo.sh @@ -0,0 +1,55 @@ +#!/bin/sh -e + +# This script and the accompanying program, httpr-demo.py, demonstrate how to use +# httpr with Python. +# +# Prerequisites: +# - httpr is on your path. +# - The google-cloud and google-auth Python packages have been installed: +# pip install --upgrade google-cloud +# pip install --upgrade google-auth + +# Execution: +# 1. Pick a project and a GCS bucket. +# 2. Invoke this script to record an interaction: +# http-demo.sh PROJECT BUCKET record +# 3. Invoke the script again to replay: +# http-demo.sh PROJECT BUCKET replay + +project=$1 +bucket=$2 +mode=$3 + +if [[ $mode != "record" && $mode != "replay" ]]; then + echo >&2 "usage: $0 PROJECT BUCKET record|replay" + exit 1 +fi + +if [[ $(which httpr) == "" ]]; then + echo >&2 "httpr is not on PATH" + exit 1 +fi + +# Start the proxy and wait for it to come up. +httpr -$mode /tmp/demo.replay & +proxy_pid=$! + +# Stop the proxy on exit. +# When the proxy is recording, this will cause it to write the replay file. +trap "kill -2 $proxy_pid" EXIT + +sleep 1 + +# Download the CA certificate from the proxy's control port +# and inform Python of the cert via an environment variable. +cert_file=/tmp/httpr.cer +curl -s localhost:8181/authority.cer > $cert_file +export REQUESTS_CA_BUNDLE=$cert_file + +# Tell Python to use the proxy. +# If you passed the -port argument to httpr, use that port here. +export HTTPS_PROXY=localhost:8080 + +# Run the program. +python httpr-demo.py $project $bucket $mode + diff --git a/vendor/cloud.google.com/go/httpreplay/cmd/httpr/httpr.go b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/httpr.go new file mode 100644 index 000000000..cc734c457 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/httpr.go @@ -0,0 +1,110 @@ +// 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. + +// httpr is a proxy that can record or replay HTTP requests. +// Start httpr with either the -record or -replay flags, providing a filename. +// Terminate the process with an interrupt (kill -2) to write the log file when recording. +// To get the CA certificate of the proxy, issue a GET to http://localhost:CP/authority.cer, where +// CP is the control port. + +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "log" + "net" + "net/http" + "os" + "os/signal" + + "cloud.google.com/go/httpreplay/internal/proxy" + "github.com/google/martian/martianhttp" +) + +var ( + port = flag.Int("port", 8080, "port of the proxy") + controlPort = flag.Int("control-port", 8181, "port for controlling the proxy") + record = flag.String("record", "", "record traffic and save to filename") + replay = flag.String("replay", "", "read filename and replay traffic") + debugHeaders = flag.Bool("debug-headers", false, "log header mismatches") +) + +func main() { + flag.Parse() + if *record == "" && *replay == "" { + log.Fatal("provide either -record or -replay") + } + if *record != "" && *replay != "" { + log.Fatal("provide only one of -record and -replay") + } + log.Printf("httpr: starting proxy on port %d and control on port %d", *port, *controlPort) + + var pr *proxy.Proxy + var err error + if *record != "" { + pr, err = proxy.ForRecording(*record, *port) + } else { + pr, err = proxy.ForReplaying(*replay, *port) + } + if err != nil { + log.Fatal(err) + } + proxy.DebugHeaders = *debugHeaders + + // Expose handlers on the control port. + mux := http.NewServeMux() + mux.Handle("/authority.cer", martianhttp.NewAuthorityHandler(pr.CACert)) + mux.HandleFunc("/initial", handleInitial(pr)) + lControl, err := net.Listen("tcp", fmt.Sprintf(":%d", *controlPort)) + if err != nil { + log.Fatal(err) + } + go http.Serve(lControl, mux) + + sigc := make(chan os.Signal, 1) + signal.Notify(sigc, os.Interrupt) + + <-sigc + + log.Println("httpr: shutting down") + if err := pr.Close(); err != nil { + log.Fatal(err) + } +} + +func handleInitial(pr *proxy.Proxy) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + switch req.Method { + case "GET": + if pr.Initial != nil { + w.Write(pr.Initial) + } + + case "POST": + bytes, err := ioutil.ReadAll(req.Body) + req.Body.Close() + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + fmt.Fprintf(w, "reading body: %v", err) + } + pr.Initial = bytes + + default: + w.WriteHeader(http.StatusBadRequest) + fmt.Fprint(w, "use GET to retrieve initial or POST to set it") + } + } +} diff --git a/vendor/cloud.google.com/go/httpreplay/cmd/httpr/integration_test.go b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/integration_test.go new file mode 100644 index 000000000..bce29e619 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/cmd/httpr/integration_test.go @@ -0,0 +1,228 @@ +// 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. + +package main_test + +import ( + "context" + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "io/ioutil" + "net" + "net/http" + "net/url" + "os" + "os/exec" + "strings" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/storage" + "golang.org/x/oauth2" + "google.golang.org/api/option" +) + +const initial = "initial state" + +func TestIntegration_HTTPR(t *testing.T) { + if testing.Short() { + t.Skip("Integration tests skipped in short mode") + } + if testutil.ProjID() == "" { + t.Fatal("set GCLOUD_TESTS_GOLANG_PROJECT_ID and GCLOUD_TESTS_GOLANG_KEY") + } + // Get a unique temporary filename. + f, err := ioutil.TempFile("", "httpreplay") + if err != nil { + t.Fatal(err) + } + replayFilename := f.Name() + if err := f.Close(); err != nil { + t.Fatal(err) + } + defer os.Remove(replayFilename) + + if err := exec.Command("go", "build").Run(); err != nil { + t.Fatalf("running 'go build': %v", err) + } + defer os.Remove("./httpr") + want := runRecord(t, replayFilename) + got := runReplay(t, replayFilename) + if got != want { + t.Fatalf("got %q, want %q", got, want) + } +} + +func runRecord(t *testing.T, filename string) string { + cmd, tr, cport, err := start("-record", filename) + if err != nil { + t.Fatal(err) + } + defer stop(t, cmd) + + ctx := context.Background() + hc := &http.Client{ + Transport: &oauth2.Transport{ + Base: tr, + Source: testutil.TokenSource(ctx, storage.ScopeFullControl), + }, + } + res, err := http.Post( + fmt.Sprintf("http://localhost:%s/initial", cport), + "text/plain", + strings.NewReader(initial)) + if err != nil { + t.Fatal(err) + } + if res.StatusCode != 200 { + t.Fatalf("from POST: %s", res.Status) + } + info, err := getBucketInfo(ctx, hc) + if err != nil { + t.Fatal(err) + } + return info +} + +func runReplay(t *testing.T, filename string) string { + cmd, tr, cport, err := start("-replay", filename) + if err != nil { + t.Fatal(err) + } + defer stop(t, cmd) + + hc := &http.Client{Transport: tr} + res, err := http.Get(fmt.Sprintf("http://localhost:%s/initial", cport)) + if err != nil { + t.Fatal(err) + } + if res.StatusCode != 200 { + t.Fatalf("from GET: %s", res.Status) + } + bytes, err := ioutil.ReadAll(res.Body) + res.Body.Close() + if err != nil { + t.Fatal(err) + } + if got, want := string(bytes), initial; got != want { + t.Errorf("initial: got %q, want %q", got, want) + } + info, err := getBucketInfo(context.Background(), hc) + if err != nil { + t.Fatal(err) + } + return info +} + +// Start the proxy binary and wait for it to come up. +// Return a transport that talks to the proxy, as well as the control port. +// modeFlag must be either "-record" or "-replay". +func start(modeFlag, filename string) (*exec.Cmd, *http.Transport, string, error) { + pport, err := pickPort() + if err != nil { + return nil, nil, "", err + } + cport, err := pickPort() + if err != nil { + return nil, nil, "", err + } + cmd := exec.Command("./httpr", "-port", pport, "-control-port", cport, modeFlag, filename, "-debug-headers") + if err := cmd.Start(); err != nil { + return nil, nil, "", err + } + // Wait for the server to come up. + serverUp := false + for i := 0; i < 10; i++ { + if conn, err := net.Dial("tcp", "localhost:"+cport); err == nil { + conn.Close() + serverUp = true + break + } + time.Sleep(time.Second) + } + if !serverUp { + return nil, nil, "", errors.New("server never came up") + } + tr, err := proxyTransport(pport, cport) + if err != nil { + return nil, nil, "", err + } + return cmd, tr, cport, nil +} + +func stop(t *testing.T, cmd *exec.Cmd) { + if err := cmd.Process.Signal(os.Interrupt); err != nil { + t.Fatal(err) + } +} + +// pickPort picks an unused port. +func pickPort() (string, error) { + l, err := net.Listen("tcp", ":0") + if err != nil { + return "", err + } + addr := l.Addr().String() + _, port, err := net.SplitHostPort(addr) + if err != nil { + return "", err + } + l.Close() + return port, nil +} + +func proxyTransport(pport, cport string) (*http.Transport, error) { + caCert, err := getBody(fmt.Sprintf("http://localhost:%s/authority.cer", cport)) + if err != nil { + return nil, err + } + caCertPool := x509.NewCertPool() + if !caCertPool.AppendCertsFromPEM([]byte(caCert)) { + return nil, errors.New("bad CA Cert") + } + return &http.Transport{ + Proxy: http.ProxyURL(&url.URL{Host: "localhost:" + pport}), + TLSClientConfig: &tls.Config{RootCAs: caCertPool}, + }, nil +} + +func getBucketInfo(ctx context.Context, hc *http.Client) (string, error) { + client, err := storage.NewClient(ctx, option.WithHTTPClient(hc)) + if err != nil { + return "", err + } + defer client.Close() + b := client.Bucket(testutil.ProjID()) + attrs, err := b.Attrs(ctx) + if err != nil { + return "", err + } + return fmt.Sprintf("name:%s reqpays:%v location:%s sclass:%s", + attrs.Name, attrs.RequesterPays, attrs.Location, attrs.StorageClass), nil +} + +func getBody(url string) ([]byte, error) { + res, err := http.Get(url) + if err != nil { + return nil, err + } + if res.StatusCode != 200 { + return nil, fmt.Errorf("response: %s", res.Status) + } + defer res.Body.Close() + return ioutil.ReadAll(res.Body) +} diff --git a/vendor/cloud.google.com/go/httpreplay/httpreplay.go b/vendor/cloud.google.com/go/httpreplay/httpreplay.go new file mode 100644 index 000000000..7c4e9e3d8 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/httpreplay.go @@ -0,0 +1,129 @@ +// 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. + +// Package httpreplay provides an API for recording and replaying traffic +// from HTTP-based Google API clients. +// +// To record: +// 1. Call NewRecorder to get a Recorder. +// 2. Use its Client method to obtain an HTTP client to use when making API calls. +// 3. Close the Recorder when you're done. That will save the +// log of interactions to the file you provided to NewRecorder. +// +// To replay: +// 1. Call NewReplayer with the same filename you used to record to get a Replayer. +// 2. Call its Client method and use the client to make the same API calls. +// You will get back the recorded responses. +// 3. Close the Replayer when you're done. +// +// This package is EXPERIMENTAL and is subject to change or removal without notice. +// It requires Go version 1.8 or higher. +package httpreplay + +// TODO(jba): add examples. + +import ( + "context" + "net/http" + + "cloud.google.com/go/httpreplay/internal/proxy" + "google.golang.org/api/option" + htransport "google.golang.org/api/transport/http" +) + +// A Recorder records HTTP interactions. +type Recorder struct { + filename string + proxy *proxy.Proxy +} + +// NewRecorder creates a recorder that writes to filename. The file will +// also store initial state that can be retrieved to configure replay. +// +// You must call Close on the Recorder to ensure that all data is written. +func NewRecorder(filename string, initial []byte) (*Recorder, error) { + p, err := proxy.ForRecording(filename, 0) + if err != nil { + return nil, err + } + p.Initial = initial + return &Recorder{proxy: p}, nil +} + +// Client returns an http.Client to be used for recording. Provide authentication options +// like option.WithTokenSource as you normally would, or omit them to use Application Default +// Credentials. +func (r *Recorder) Client(ctx context.Context, opts ...option.ClientOption) (*http.Client, error) { + return proxyClient(ctx, r.proxy, opts...) +} + +func proxyClient(ctx context.Context, p *proxy.Proxy, opts ...option.ClientOption) (*http.Client, error) { + trans, err := htransport.NewTransport(ctx, p.Transport(), opts...) + if err != nil { + return nil, err + } + return &http.Client{Transport: trans}, nil +} + +// Close closes the Recorder and saves the log file. +func (r *Recorder) Close() error { + return r.proxy.Close() +} + +// A Replayer replays previously recorded HTTP interactions. +type Replayer struct { + proxy *proxy.Proxy +} + +// NewReplayer creates a replayer that reads from filename. +func NewReplayer(filename string) (*Replayer, error) { + p, err := proxy.ForReplaying(filename, 0) + if err != nil { + return nil, err + } + return &Replayer{proxy: p}, nil +} + +// Client returns an HTTP client for replaying. The client does not need to be +// configured with credentials for authenticating to a server, since it never +// contacts a real backend. +func (r *Replayer) Client(ctx context.Context) (*http.Client, error) { + return proxyClient(ctx, r.proxy, option.WithoutAuthentication()) +} + +// Initial returns the initial state saved by the Recorder. +func (r *Replayer) Initial() []byte { + return r.proxy.Initial +} + +// IgnoreHeader will not use h when matching requests. +func (r *Replayer) IgnoreHeader(h string) { + r.proxy.IgnoreHeader(h) +} + +// Close closes the replayer. +func (r *Replayer) Close() error { + return r.proxy.Close() +} + +// DebugHeaders helps to determine whether a header should be ignored. +// When true, if requests have the same method, URL and body but differ +// in a header, the first mismatched header is logged. +func DebugHeaders() { + proxy.DebugHeaders = true +} + +// Supported reports whether httpreplay is supported in the current version of Go. +// For Go 1.8 and above, the answer is true. +func Supported() bool { return true } diff --git a/vendor/cloud.google.com/go/httpreplay/httpreplay_test.go b/vendor/cloud.google.com/go/httpreplay/httpreplay_test.go new file mode 100644 index 000000000..1fa0f24b4 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/httpreplay_test.go @@ -0,0 +1,266 @@ +// 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. + +package httpreplay_test + +import ( + "bytes" + "context" + "encoding/json" + "io/ioutil" + "net/http" + "os" + "testing" + "time" + + "cloud.google.com/go/httpreplay" + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/storage" + "google.golang.org/api/option" +) + +func TestIntegration_RecordAndReplay(t *testing.T) { + httpreplay.DebugHeaders() + if testing.Short() { + t.Skip("Integration tests skipped in short mode") + } + f, err := ioutil.TempFile("", "httpreplay") + if err != nil { + t.Fatal(err) + } + replayFilename := f.Name() + if err := f.Close(); err != nil { + t.Fatal(err) + } + defer os.Remove(replayFilename) + projectID := testutil.ProjID() + if projectID == "" { + t.Skip("Need project ID. See CONTRIBUTING.md for details.") + } + ctx := context.Background() + + // Record. + initial := time.Now() + ibytes, err := json.Marshal(initial) + if err != nil { + t.Fatal(err) + } + rec, err := httpreplay.NewRecorder(replayFilename, ibytes) + if err != nil { + t.Fatal(err) + } + hc, err := rec.Client(ctx, option.WithTokenSource( + testutil.TokenSource(ctx, storage.ScopeFullControl))) + if err != nil { + t.Fatal(err) + } + wanta, wantc := run(t, hc) + testReadCRC(t, hc, "recording") + if err := rec.Close(); err != nil { + t.Fatalf("rec.Close: %v", err) + } + + // Replay. + rep, err := httpreplay.NewReplayer(replayFilename) + if err != nil { + t.Fatal(err) + } + defer rep.Close() + hc, err = rep.Client(ctx) + if err != nil { + t.Fatal(err) + } + gota, gotc := run(t, hc) + testReadCRC(t, hc, "replaying") + + if diff := testutil.Diff(gota, wanta); diff != "" { + t.Error(diff) + } + if !bytes.Equal(gotc, wantc) { + t.Errorf("got %q, want %q", gotc, wantc) + } + var gotInitial time.Time + if err := json.Unmarshal(rep.Initial(), &gotInitial); err != nil { + t.Fatal(err) + } + if !gotInitial.Equal(initial) { + t.Errorf("initial: got %v, want %v", gotInitial, initial) + } +} + +// TODO(jba): test errors + +func run(t *testing.T, hc *http.Client) (*storage.BucketAttrs, []byte) { + ctx := context.Background() + client, err := storage.NewClient(ctx, option.WithHTTPClient(hc)) + if err != nil { + t.Fatal(err) + } + defer client.Close() + b := client.Bucket(testutil.ProjID()) + attrs, err := b.Attrs(ctx) + if err != nil { + t.Fatal(err) + } + obj := b.Object("replay-test") + w := obj.NewWriter(ctx) + data := []byte{150, 151, 152} + if _, err := w.Write(data); err != nil { + t.Fatal(err) + } + if err := w.Close(); err != nil { + t.Fatal(err) + } + + r, err := obj.NewReader(ctx) + if err != nil { + t.Fatal(err) + } + defer r.Close() + contents, err := ioutil.ReadAll(r) + if err != nil { + t.Fatal(err) + } + + return attrs, contents +} + +func testReadCRC(t *testing.T, hc *http.Client, mode string) { + const ( + // This is an uncompressed file. + // See https://cloud.google.com/storage/docs/public-datasets/landsat + uncompressedBucket = "gcp-public-data-landsat" + uncompressedObject = "LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt" + + gzippedBucket = "storage-library-test-bucket" + gzippedObject = "gzipped-text.txt" + gzippedContents = "hello world" // uncompressed contents of the file + ) + ctx := context.Background() + client, err := storage.NewClient(ctx, option.WithHTTPClient(hc)) + if err != nil { + t.Fatalf("%s: %v", mode, err) + } + defer client.Close() + + uncompressedObj := client.Bucket(uncompressedBucket).Object(uncompressedObject) + gzippedObj := client.Bucket(gzippedBucket).Object(gzippedObject) + + for _, test := range []struct { + desc string + obj *storage.ObjectHandle + offset, length int64 + readCompressed bool // don't decompress a gzipped file + + wantErr bool + wantLen int // length of contents + }{ + { + desc: "uncompressed, entire file", + obj: uncompressedObj, + offset: 0, + length: -1, + readCompressed: false, + wantLen: 7903, + }, + { + desc: "uncompressed, entire file, don't decompress", + obj: uncompressedObj, + offset: 0, + length: -1, + readCompressed: true, + wantLen: 7903, + }, + { + desc: "uncompressed, suffix", + obj: uncompressedObj, + offset: 3, + length: -1, + readCompressed: false, + wantLen: 7900, + }, + { + desc: "uncompressed, prefix", + obj: uncompressedObj, + offset: 0, + length: 18, + readCompressed: false, + wantLen: 18, + }, + { + // When a gzipped file is unzipped by GCS, we can't verify the checksum + // because it was computed against the zipped contents. There is no + // header that indicates that a gzipped file is being served unzipped. + // But our CRC check only happens if there is a Content-Length header, + // and that header is absent for this read. + desc: "compressed, entire file, server unzips", + obj: gzippedObj, + offset: 0, + length: -1, + readCompressed: false, + wantLen: 11, + }, + { + // When we read a gzipped file uncompressed, it's like reading a regular file: + // the served content and the CRC match. + desc: "compressed, entire file, read compressed", + obj: gzippedObj, + offset: 0, + length: -1, + readCompressed: true, + wantLen: 31, + }, + { + desc: "compressed, partial, read compressed", + obj: gzippedObj, + offset: 1, + length: 8, + readCompressed: true, + wantLen: 8, + }, + { + desc: "uncompressed, HEAD", + obj: uncompressedObj, + offset: 0, + length: 0, + wantLen: 0, + }, + { + desc: "compressed, HEAD", + obj: gzippedObj, + offset: 0, + length: 0, + wantLen: 0, + }, + } { + obj := test.obj.ReadCompressed(test.readCompressed) + r, err := obj.NewRangeReader(ctx, test.offset, test.length) + if err != nil { + if test.wantErr { + continue + } + t.Errorf("%s: %s: %v", mode, test.desc, err) + continue + } + data, err := ioutil.ReadAll(r) + _ = r.Close() + if err != nil { + t.Errorf("%s: %s: %v", mode, test.desc, err) + continue + } + if got, want := len(data), test.wantLen; got != want { + t.Errorf("%s: %s: len: got %d, want %d", mode, test.desc, got, want) + } + } +} diff --git a/vendor/cloud.google.com/go/httpreplay/internal/proxy/debug.go b/vendor/cloud.google.com/go/httpreplay/internal/proxy/debug.go new file mode 100644 index 000000000..caf199730 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/internal/proxy/debug.go @@ -0,0 +1,61 @@ +// 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. + +package proxy + +import ( + "bytes" + "fmt" + "log" + "net/http" +) + +// Useful things for when we need to figure out what's actually going on under the hood. + +type debugTransport struct { + prefix string + t *http.Transport +} + +func (d debugTransport) RoundTrip(req *http.Request) (*http.Response, error) { + log.Printf("proxy %s: %s %s", d.prefix, req.Method, req.URL) + logHeaders(req.Header) + res, err := d.t.RoundTrip(req) + if err != nil { + log.Printf("proxy %s: error %v", d.prefix, err) + } else { + log.Printf("proxy %s: %s", d.prefix, res.Status) + log.Printf("Uncompressed = %v", res.Uncompressed) + log.Printf("ContentLength = %d", res.ContentLength) + logHeaders(res.Header) + log.Printf("Trailers:") + logHeaders(res.Trailer) + } + return res, err +} + +func logHeaders(hs http.Header) { + for k, v := range hs { + log.Printf(" %s: %s", k, v) + } +} + +func (r *requestBody) String() string { + buf := &bytes.Buffer{} + fmt.Fprintf(buf, "media type: %q\n", r.mediaType) + for i, p := range r.parts { + fmt.Fprintf(buf, "part #%d: %q\n", i, string(p)) + } + return buf.String() +} diff --git a/vendor/cloud.google.com/go/httpreplay/internal/proxy/log.go b/vendor/cloud.google.com/go/httpreplay/internal/proxy/log.go new file mode 100644 index 000000000..d1759ce9e --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/internal/proxy/log.go @@ -0,0 +1,232 @@ +// 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. + +package proxy + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "net/http" + "strconv" + "sync" + + "github.com/google/martian" +) + +// Replacement for the HAR logging that comes with martian. HAR is not designed for +// replay. In particular, response bodies are interpreted (e.g. decompressed), and we +// just want them to be stored literally. This isn't something we can fix in martian: it +// is required in the HAR spec (http://www.softwareishard.com/blog/har-12-spec/#content). + +// LogVersion is the current version of the log format. It can be used to +// support changes to the format over time, so newer code can read older files. +const LogVersion = "0.1" + +// A Log is a record of HTTP interactions, suitable for replay. It can be serialized to JSON. +type Log struct { + Initial []byte // initial data for replay + Version string // version of this log format + Entries []*Entry +} + +// An Entry single request-response pair. +type Entry struct { + ID string // unique ID + Request *Request + Response *Response +} + +// A Request represents an http.Request in the log. +type Request struct { + Method string // http.Request.Method + URL string // http.Request.URL, as a string + Proto string // http.Request.Proto + Header http.Header // http.Request.Header + Body []byte // http.Request.Body, read to completion + Trailer http.Header `json:",omitempty"` // http.Request.Trailer +} + +// A Response represents an http.Response in the log. +type Response struct { + StatusCode int // http.Response.StatusCode + Proto string // http.Response.Proto + ProtoMajor int // http.Response.ProtoMajor + ProtoMinor int // http.Response.ProtoMinor + Header http.Header // http.Response.Header + Body []byte // http.Response.Body, read to completion + Trailer http.Header `json:",omitempty"` // http.Response.Trailer +} + +// A Logger maintains a request-response log. +type Logger struct { + mu sync.Mutex + entries map[string]*Entry // from ID + log *Log +} + +// NewLogger creates a new logger. +func NewLogger() *Logger { + return &Logger{ + log: &Log{Version: LogVersion}, + entries: map[string]*Entry{}, + } +} + +// ModifyRequest logs requests. +func (l *Logger) ModifyRequest(req *http.Request) error { + if req.Method == "CONNECT" { + return nil + } + ctx := martian.NewContext(req) + if ctx.SkippingLogging() { + return nil + } + lreq, err := fromHTTPRequest(req) + if err != nil { + return err + } + id := ctx.ID() + entry := &Entry{ID: id, Request: lreq} + + l.mu.Lock() + defer l.mu.Unlock() + + if _, ok := l.entries[id]; ok { + panic(fmt.Sprintf("proxy: duplicate request ID: %s", id)) + } + l.entries[id] = entry + l.log.Entries = append(l.log.Entries, entry) + return nil +} + +// ModifyResponse logs responses. +func (l *Logger) ModifyResponse(res *http.Response) error { + ctx := martian.NewContext(res.Request) + if ctx.SkippingLogging() { + return nil + } + id := ctx.ID() + lres, err := fromHTTPResponse(res) + if err != nil { + return err + } + + l.mu.Lock() + defer l.mu.Unlock() + + if e, ok := l.entries[id]; ok { + e.Response = lres + } + // Ignore the response if we haven't seen the request. + return nil +} + +// Extract returns the Log and removes it. The Logger is not usable +// after this call. +func (l *Logger) Extract() *Log { + l.mu.Lock() + defer l.mu.Unlock() + r := l.log + l.log = nil + l.entries = nil + return r +} + +func fromHTTPRequest(req *http.Request) (*Request, error) { + data, err := snapshotBody(&req.Body) + if err != nil { + return nil, err + } + return &Request{ + Method: req.Method, + URL: req.URL.String(), + Proto: req.Proto, + Header: redactHeaders(req.Header), + Body: data, + Trailer: req.Trailer, + }, nil +} + +func fromHTTPResponse(res *http.Response) (*Response, error) { + data, err := snapshotBody(&res.Body) + if err != nil { + return nil, err + } + return &Response{ + StatusCode: res.StatusCode, + Proto: res.Proto, + ProtoMajor: res.ProtoMajor, + ProtoMinor: res.ProtoMinor, + Header: res.Header, + Body: data, + Trailer: res.Trailer, + }, nil +} + +func toHTTPResponse(lr *Response, req *http.Request) *http.Response { + res := &http.Response{ + StatusCode: lr.StatusCode, + Proto: lr.Proto, + ProtoMajor: lr.ProtoMajor, + ProtoMinor: lr.ProtoMinor, + Header: lr.Header, + Body: ioutil.NopCloser(bytes.NewReader(lr.Body)), + ContentLength: int64(len(lr.Body)), + } + res.Request = req + // For HEAD, set ContentLength to the value of the Content-Length header, or -1 + // if there isn't one. + if req.Method == "HEAD" { + res.ContentLength = -1 + if c := res.Header["Content-Length"]; len(c) == 1 { + if c64, err := strconv.ParseInt(c[0], 10, 64); err == nil { + res.ContentLength = c64 + } + } + } + return res +} + +func snapshotBody(body *io.ReadCloser) ([]byte, error) { + data, err := ioutil.ReadAll(*body) + if err != nil { + return nil, err + } + (*body).Close() + *body = ioutil.NopCloser(bytes.NewReader(data)) + return data, nil +} + +// Headers that may contain sensitive data (auth tokens, keys). +var sensitiveHeaders = map[string]bool{ + "Authorization": true, + "Proxy-Authorization": true, + "X-Goog-Encryption-Key": true, // used by Cloud Storage for customer-supplied encryption + "X-Goog-Copy-Source-Encryption-Key": true, // ditto +} + +// Copy headers, redacting sensitive ones. +func redactHeaders(hs http.Header) http.Header { + rh := http.Header{} + for k, v := range hs { + if sensitiveHeaders[k] { + rh.Set(k, "REDACTED") + } else { + rh[k] = v + } + } + return rh +} diff --git a/vendor/cloud.google.com/go/httpreplay/internal/proxy/log_test.go b/vendor/cloud.google.com/go/httpreplay/internal/proxy/log_test.go new file mode 100644 index 000000000..327227c8b --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/internal/proxy/log_test.go @@ -0,0 +1,182 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package proxy + +import ( + "io/ioutil" + "net/http" + "net/url" + "strings" + "testing" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/google/martian" +) + +func TestRedactHeaders(t *testing.T) { + clone := func(h http.Header) http.Header { + h2 := http.Header{} + for k, v := range h { + h2[k] = v + } + return h2 + } + + in := http.Header{ + "Content-Type": {"text/plain"}, + "Authorization": {"oauth2-token"}, + "X-Goog-Encryption-Key": {"a-secret-key"}, + "X-Goog-Copy-Source-Encryption-Key": {"another-secret-key"}, + } + orig := clone(in) + got := redactHeaders(in) + // Logged headers should be redacted. + want := http.Header{ + "Content-Type": {"text/plain"}, + "Authorization": {"REDACTED"}, + "X-Goog-Encryption-Key": {"REDACTED"}, + "X-Goog-Copy-Source-Encryption-Key": {"REDACTED"}, + } + if !testutil.Equal(got, want) { + t.Errorf("got %+v\nwant %+v", got, want) + } + // The original headers should be the same. + if got, want := in, orig; !testutil.Equal(got, want) { + t.Errorf("got %+v\nwant %+v", got, want) + } +} + +func TestLogger(t *testing.T) { + req := &http.Request{ + Method: "POST", + URL: &url.URL{ + Scheme: "https", + Host: "example.com", + Path: "a/b/c", + }, + Header: http.Header{"H1": {"v1", "v2"}}, + Body: ioutil.NopCloser(strings.NewReader("hello")), + Trailer: http.Header{"T1": {"v3", "v4"}}, + } + res := &http.Response{ + Request: req, + StatusCode: 204, + Body: ioutil.NopCloser(strings.NewReader("goodbye")), + Header: http.Header{"H2": {"v5"}}, + Trailer: http.Header{"T2": {"v6", "v7"}}, + } + l := NewLogger() + _, remove, err := martian.TestContext(req, nil, nil) + if err != nil { + t.Fatal(err) + } + defer remove() + if err := l.ModifyRequest(req); err != nil { + t.Fatal(err) + } + if err := l.ModifyResponse(res); err != nil { + t.Fatal(err) + } + lg := l.Extract() + want := []*Entry{ + { + ID: lg.Entries[0].ID, + Request: &Request{ + Method: "POST", + URL: "https://example.com/a/b/c", + Header: http.Header{"H1": {"v1", "v2"}}, + Body: []byte("hello"), + Trailer: http.Header{"T1": {"v3", "v4"}}, + }, + Response: &Response{ + StatusCode: 204, + Body: []byte("goodbye"), + Header: http.Header{"H2": {"v5"}}, + Trailer: http.Header{"T2": {"v6", "v7"}}, + }, + }, + } + if diff := testutil.Diff(lg.Entries, want); diff != "" { + t.Error(diff) + } +} + +func TestToHTTPResponse(t *testing.T) { + for _, test := range []struct { + desc string + lr *Response + req *http.Request + want *http.Response + }{ + { + desc: "GET request", + lr: &Response{ + StatusCode: 201, + Proto: "1.1", + Header: http.Header{"h": {"v"}}, + Body: []byte("text"), + }, + req: &http.Request{Method: "GET"}, + want: &http.Response{ + Request: &http.Request{Method: "GET"}, + StatusCode: 201, + Proto: "1.1", + Header: http.Header{"h": {"v"}}, + ContentLength: 4, + }, + }, + { + desc: "HEAD request with no Content-Length header", + lr: &Response{ + StatusCode: 201, + Proto: "1.1", + Header: http.Header{"h": {"v"}}, + Body: []byte("text"), + }, + req: &http.Request{Method: "HEAD"}, + want: &http.Response{ + Request: &http.Request{Method: "HEAD"}, + StatusCode: 201, + Proto: "1.1", + Header: http.Header{"h": {"v"}}, + ContentLength: -1, + }, + }, + { + desc: "HEAD request with Content-Length header", + lr: &Response{ + StatusCode: 201, + Proto: "1.1", + Header: http.Header{"h": {"v"}, "Content-Length": {"17"}}, + Body: []byte("text"), + }, + req: &http.Request{Method: "HEAD"}, + want: &http.Response{ + Request: &http.Request{Method: "HEAD"}, + StatusCode: 201, + Proto: "1.1", + Header: http.Header{"h": {"v"}, "Content-Length": {"17"}}, + ContentLength: 17, + }, + }, + } { + got := toHTTPResponse(test.lr, test.req) + got.Body = nil + if diff := testutil.Diff(got, test.want, cmpopts.IgnoreUnexported(http.Request{})); diff != "" { + t.Errorf("%s: %s", test.desc, diff) + } + } +} diff --git a/vendor/cloud.google.com/go/httpreplay/internal/proxy/record.go b/vendor/cloud.google.com/go/httpreplay/internal/proxy/record.go new file mode 100644 index 000000000..57eacaf83 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/internal/proxy/record.go @@ -0,0 +1,188 @@ +// 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. + +// Package proxy provides a record/replay HTTP proxy. It is designed to support +// both an in-memory API (cloud.google.com/go/httpreplay) and a standalone server +// (cloud.google.com/go/httpreplay/cmd/httpr). +package proxy + +// See github.com/google/martian/cmd/proxy/main.go for the origin of much of this. + +import ( + "crypto/tls" + "crypto/x509" + "encoding/json" + "fmt" + "io/ioutil" + "net" + "net/http" + "net/url" + "strings" + "time" + + "github.com/google/martian" + "github.com/google/martian/fifo" + "github.com/google/martian/httpspec" + "github.com/google/martian/martianlog" + "github.com/google/martian/mitm" +) + +// A Proxy is an HTTP proxy that supports recording or replaying requests. +type Proxy struct { + // The certificate that the proxy uses to participate in TLS. + CACert *x509.Certificate + + // The URL of the proxy. + URL *url.URL + + // Initial state of the client. + Initial []byte + + mproxy *martian.Proxy + filename string // for log + logger *Logger // for recording only + ignoreHeaders map[string]bool // headers the user has asked to ignore +} + +// ForRecording returns a Proxy configured to record. +func ForRecording(filename string, port int) (*Proxy, error) { + p, err := newProxy(filename) + if err != nil { + return nil, err + } + + // Construct a group that performs the standard proxy stack of request/response + // modifications. + stack, _ := httpspec.NewStack("httpr") // second arg is an internal group that we don't need + p.mproxy.SetRequestModifier(stack) + p.mproxy.SetResponseModifier(stack) + + // Make a group for logging requests and responses. + logGroup := fifo.NewGroup() + skipAuth := skipLoggingByHost("accounts.google.com") + logGroup.AddRequestModifier(skipAuth) + logGroup.AddResponseModifier(skipAuth) + p.logger = NewLogger() + logGroup.AddRequestModifier(p.logger) + logGroup.AddResponseModifier(p.logger) + + stack.AddRequestModifier(logGroup) + stack.AddResponseModifier(logGroup) + + // Ordinary debug logging. + logger := martianlog.NewLogger() + logger.SetDecode(true) + stack.AddRequestModifier(logger) + stack.AddResponseModifier(logger) + + if err := p.start(port); err != nil { + return nil, err + } + return p, nil +} + +type hideTransport http.Transport + +func (t *hideTransport) RoundTrip(req *http.Request) (*http.Response, error) { + return (*http.Transport)(t).RoundTrip(req) +} + +func newProxy(filename string) (*Proxy, error) { + mproxy := martian.NewProxy() + // Set up a man-in-the-middle configuration with a CA certificate so the proxy can + // participate in TLS. + x509c, priv, err := mitm.NewAuthority("cloud.google.com/go/httpreplay", "HTTPReplay Authority", time.Hour) + if err != nil { + return nil, err + } + mc, err := mitm.NewConfig(x509c, priv) + if err != nil { + return nil, err + } + mc.SetValidity(time.Hour) + mc.SetOrganization("cloud.google.com/go/httpreplay") + mc.SkipTLSVerify(false) + if err != nil { + return nil, err + } + mproxy.SetMITM(mc) + ih := map[string]bool{} + for k, v := range ignoreHeaders { + ih[k] = v + } + return &Proxy{ + mproxy: mproxy, + CACert: x509c, + filename: filename, + ignoreHeaders: ih, + }, nil +} + +func (p *Proxy) start(port int) error { + l, err := net.Listen("tcp4", fmt.Sprintf(":%d", port)) + if err != nil { + return err + } + p.URL = &url.URL{Scheme: "http", Host: l.Addr().String()} + go p.mproxy.Serve(l) + return nil +} + +// Transport returns an http.Transport for clients who want to talk to the proxy. +func (p *Proxy) Transport() *http.Transport { + caCertPool := x509.NewCertPool() + caCertPool.AddCert(p.CACert) + return &http.Transport{ + TLSClientConfig: &tls.Config{RootCAs: caCertPool}, + Proxy: func(*http.Request) (*url.URL, error) { return p.URL, nil }, + } +} + +// IgnoreHeader will cause h to be ignored during matching on replay. +func (p *Proxy) IgnoreHeader(h string) { + p.ignoreHeaders[http.CanonicalHeaderKey(h)] = true +} + +// Close closes the proxy. If the proxy is recording, it also writes the log. +func (p *Proxy) Close() error { + p.mproxy.Close() + if p.logger != nil { + return p.writeLog() + } + return nil +} + +func (p *Proxy) writeLog() error { + lg := p.logger.Extract() + lg.Initial = p.Initial + bytes, err := json.MarshalIndent(lg, "", " ") + if err != nil { + return err + } + return ioutil.WriteFile(p.filename, bytes, 0600) // only accessible by owner +} + +// skipLoggingByHost disables logging for traffic to a particular host. +type skipLoggingByHost string + +func (s skipLoggingByHost) ModifyRequest(req *http.Request) error { + if strings.HasPrefix(req.Host, string(s)) { + martian.NewContext(req).SkipLogging() + } + return nil +} + +func (s skipLoggingByHost) ModifyResponse(res *http.Response) error { + return s.ModifyRequest(res.Request) +} diff --git a/vendor/cloud.google.com/go/httpreplay/internal/proxy/replay.go b/vendor/cloud.google.com/go/httpreplay/internal/proxy/replay.go new file mode 100644 index 000000000..e785c9ad6 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/internal/proxy/replay.go @@ -0,0 +1,313 @@ +// 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. + +package proxy + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "io/ioutil" + "log" + "mime" + "mime/multipart" + "net/http" + "reflect" + "strings" + "sync" + + "github.com/google/martian/martianlog" +) + +// ForReplaying returns a Proxy configured to replay. +func ForReplaying(filename string, port int) (*Proxy, error) { + p, err := newProxy(filename) + if err != nil { + return nil, err + } + calls, initial, err := readLog(filename) + if err != nil { + return nil, err + } + p.mproxy.SetRoundTripper(&replayRoundTripper{ + calls: calls, + ignoreHeaders: p.ignoreHeaders, + }) + p.Initial = initial + + // Debug logging. + // TODO(jba): factor out from here and ForRecording. + logger := martianlog.NewLogger() + logger.SetDecode(true) + p.mproxy.SetRequestModifier(logger) + p.mproxy.SetResponseModifier(logger) + + if err := p.start(port); err != nil { + return nil, err + } + return p, nil +} + +// A call is an HTTP request and its matching response. +type call struct { + req *Request + reqBody *requestBody // parsed request body + res *Response +} + +func readLog(filename string) ([]*call, []byte, error) { + bytes, err := ioutil.ReadFile(filename) + if err != nil { + return nil, nil, err + } + var lg Log + if err := json.Unmarshal(bytes, &lg); err != nil { + return nil, nil, fmt.Errorf("%s: %v", filename, err) + } + if lg.Version != LogVersion { + return nil, nil, fmt.Errorf("httpreplay proxy: read log version %s but current version is %s", + lg.Version, LogVersion) + } + ignoreIDs := map[string]bool{} // IDs of requests to ignore + callsByID := map[string]*call{} + var calls []*call + for _, e := range lg.Entries { + if ignoreIDs[e.ID] { + continue + } + c, ok := callsByID[e.ID] + switch { + case !ok: + if e.Request == nil { + return nil, nil, fmt.Errorf("first entry for ID %s does not have a request", e.ID) + } + if e.Request.Method == "CONNECT" { + // Ignore CONNECT methods. + ignoreIDs[e.ID] = true + } else { + reqBody, err := newRequestBodyFromLog(e.Request) + if err != nil { + return nil, nil, err + } + c := &call{e.Request, reqBody, e.Response} + calls = append(calls, c) + callsByID[e.ID] = c + } + case e.Request != nil: + if e.Response != nil { + return nil, nil, errors.New("HAR entry has both request and response") + } + c.req = e.Request + case e.Response != nil: + c.res = e.Response + default: + return nil, nil, errors.New("HAR entry has neither request nor response") + } + } + for _, c := range calls { + if c.req == nil || c.res == nil { + return nil, nil, fmt.Errorf("missing request or response: %+v", c) + } + } + return calls, lg.Initial, nil +} + +type replayRoundTripper struct { + mu sync.Mutex + calls []*call + ignoreHeaders map[string]bool +} + +func (r *replayRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + reqBody, err := newRequestBodyFromHTTP(req) + if err != nil { + return nil, err + } + r.mu.Lock() + defer r.mu.Unlock() + for i, call := range r.calls { + if call == nil { + continue + } + if requestsMatch(req, reqBody, call.req, call.reqBody, r.ignoreHeaders) { + r.calls[i] = nil // nil out this call so we don't reuse it + return toHTTPResponse(call.res, req), nil + } + } + return nil, fmt.Errorf("no matching request for %+v", req) +} + +// Headers that shouldn't be compared, because they may differ on different executions +// of the same code, or may not be present during record or replay. +var ignoreHeaders = map[string]bool{} + +func init() { + // Sensitive headers are redacted in the log, so they won't be equal to incoming values. + for h := range sensitiveHeaders { + ignoreHeaders[h] = true + } + for _, h := range []string{ + "Content-Type", // handled by requestBody + "Connection", + "Date", + "Host", + "Transfer-Encoding", + "Via", + "X-Forwarded-For", + "X-Forwarded-Host", + "X-Forwarded-Proto", + "X-Forwarded-Url", + "X-Cloud-Trace-Context", // OpenCensus traces have a random ID + "X-Goog-Api-Client", // can differ for, e.g., different Go versions + } { + ignoreHeaders[h] = true + } +} + +// Report whether the incoming request in matches the candidate request cand. +func requestsMatch(in *http.Request, inBody *requestBody, cand *Request, candBody *requestBody, ignoreHeaders map[string]bool) bool { + if in.Method != cand.Method { + return false + } + if in.URL.String() != cand.URL { + return false + } + if !inBody.equal(candBody) { + return false + } + // Check headers last. See DebugHeaders. + return headersMatch(in.Header, cand.Header, ignoreHeaders) +} + +// A requestBody represents the body of a request. If the content type is multipart, the +// body is split into parts. +// +// The replaying proxy needs to understand multipart bodies because the boundaries are +// generated randomly, so we can't just compare the entire bodies for equality. +type requestBody struct { + mediaType string // the media type part of the Content-Type header + parts [][]byte // the parts of the body, or just a single []byte if not multipart +} + +func newRequestBodyFromHTTP(req *http.Request) (*requestBody, error) { + defer req.Body.Close() + return newRequestBody(req.Header.Get("Content-Type"), req.Body) +} + +func newRequestBodyFromLog(req *Request) (*requestBody, error) { + if req.Body == nil { + return nil, nil + } + return newRequestBody(req.Header.Get("Content-Type"), bytes.NewReader(req.Body)) +} + +// newRequestBody parses the Content-Type header, reads the body, and splits it into +// parts if necessary. +func newRequestBody(contentType string, body io.Reader) (*requestBody, error) { + if contentType == "" { + // No content-type header. There should not be a body. + if _, err := body.Read(make([]byte, 1)); err != io.EOF { + return nil, errors.New("no Content-Type, but body") + } + return nil, nil + } + mediaType, params, err := mime.ParseMediaType(contentType) + if err != nil { + return nil, err + } + rb := &requestBody{mediaType: mediaType} + if strings.HasPrefix(mediaType, "multipart/") { + mr := multipart.NewReader(body, params["boundary"]) + for { + p, err := mr.NextPart() + if err == io.EOF { + break + } + if err != nil { + return nil, err + } + part, err := ioutil.ReadAll(p) + if err != nil { + return nil, err + } + // TODO(jba): care about part headers? + rb.parts = append(rb.parts, part) + } + } else { + bytes, err := ioutil.ReadAll(body) + if err != nil { + return nil, err + } + rb.parts = [][]byte{bytes} + } + return rb, nil +} + +func (r1 *requestBody) equal(r2 *requestBody) bool { + if r1 == nil || r2 == nil { + return r1 == r2 + } + if r1.mediaType != r2.mediaType { + return false + } + if len(r1.parts) != len(r2.parts) { + return false + } + for i, p1 := range r1.parts { + if !bytes.Equal(p1, r2.parts[i]) { + return false + } + } + return true +} + +// DebugHeaders helps to determine whether a header should be ignored. +// When true, if requests have the same method, URL and body but differ +// in a header, the first mismatched header is logged. +var DebugHeaders = false + +func headersMatch(in, cand http.Header, ignores map[string]bool) bool { + for k1, v1 := range in { + if ignores[k1] { + continue + } + v2 := cand[k1] + if v2 == nil { + if DebugHeaders { + log.Printf("header %s: present in incoming request but not candidate", k1) + } + return false + } + if !reflect.DeepEqual(v1, v2) { + if DebugHeaders { + log.Printf("header %s: incoming %v, candidate %v", k1, v1, v2) + } + return false + } + } + for k2 := range cand { + if ignores[k2] { + continue + } + if in[k2] == nil { + if DebugHeaders { + log.Printf("header %s: not in incoming request but present in candidate", k2) + } + return false + } + } + return true +} diff --git a/vendor/cloud.google.com/go/httpreplay/internal/proxy/replay_test.go b/vendor/cloud.google.com/go/httpreplay/internal/proxy/replay_test.go new file mode 100644 index 000000000..72ce58287 --- /dev/null +++ b/vendor/cloud.google.com/go/httpreplay/internal/proxy/replay_test.go @@ -0,0 +1,112 @@ +// 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. + +package proxy + +import ( + "io/ioutil" + "net/http" + "strings" + "testing" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" +) + +func TestRequestBody(t *testing.T) { + req1 := &http.Request{ + Header: http.Header{"Content-Type": {"multipart/mixed; boundary=foo"}}, + Body: ioutil.NopCloser(strings.NewReader( + "--foo\r\nFoo: one\r\n\r\nA section\r\n" + + "--foo\r\nFoo: two\r\n\r\nAnd another\r\n" + + "--foo--\r\n")), + } + rb1, err := newRequestBodyFromHTTP(req1) + if err != nil { + t.Fatal(err) + } + want := &requestBody{ + mediaType: "multipart/mixed", + parts: [][]byte{ + []byte("A section"), + []byte("And another"), + }, + } + if diff := testutil.Diff(rb1, want, cmp.AllowUnexported(requestBody{})); diff != "" { + t.Error(diff) + } + + // Same contents, different boundary. + req2 := &http.Request{ + Header: http.Header{"Content-Type": {"multipart/mixed; boundary=bar"}}, + Body: ioutil.NopCloser(strings.NewReader( + "--bar\r\nFoo: one\r\n\r\nA section\r\n" + + "--bar\r\nFoo: two\r\n\r\nAnd another\r\n" + + "--bar--\r\n")), + } + rb2, err := newRequestBodyFromHTTP(req2) + if err != nil { + t.Fatal(err) + } + if diff := testutil.Diff(rb1, want, cmp.AllowUnexported(requestBody{})); diff != "" { + t.Error(diff) + } + + if !rb1.equal(rb2) { + t.Error("equal returned false, want true") + } +} + +func TestHeadersMatch(t *testing.T) { + for _, test := range []struct { + h1, h2 http.Header + want bool + }{ + { + http.Header{"A": {"x"}, "B": {"y", "z"}}, + http.Header{"A": {"x"}, "B": {"y", "z"}}, + true, + }, + { + http.Header{"A": {"x"}, "B": {"y", "z"}}, + http.Header{"A": {"x"}, "B": {"w"}}, + false, + }, + { + http.Header{"A": {"x"}, "B": {"y", "z"}, "I": {"foo"}}, + http.Header{"A": {"x"}, "B": {"y", "z"}, "I": {"bar"}}, + true, + }, + { + http.Header{"A": {"x"}, "B": {"y", "z"}}, + http.Header{"A": {"x"}, "B": {"y", "z"}, "I": {"bar"}}, + true, + }, + { + http.Header{"A": {"x"}, "B": {"y", "z"}, "I": {"foo"}}, + http.Header{"A": {"x"}, "I": {"bar"}}, + false, + }, + { + http.Header{"A": {"x"}, "I": {"foo"}}, + http.Header{"A": {"x"}, "B": {"y", "z"}, "I": {"bar"}}, + false, + }, + } { + got := headersMatch(test.h1, test.h2, map[string]bool{"I": true}) + if got != test.want { + t.Errorf("%v, %v: got %t, want %t", test.h1, test.h2, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/iam/admin/apiv1/doc.go b/vendor/cloud.google.com/go/iam/admin/apiv1/doc.go new file mode 100644 index 000000000..3dea8ce83 --- /dev/null +++ b/vendor/cloud.google.com/go/iam/admin/apiv1/doc.go @@ -0,0 +1,92 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package admin is an auto-generated package for the +// Google Identity and Access Management (IAM) API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Manages identity and access control for Google Cloud Platform resources, +// including the creation of service accounts, which you can use to +// authenticate to Google and make API calls. +package admin // import "cloud.google.com/go/iam/admin/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/iam", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/iam/admin/apiv1/iam_client.go b/vendor/cloud.google.com/go/iam/admin/apiv1/iam_client.go new file mode 100644 index 000000000..68622f6de --- /dev/null +++ b/vendor/cloud.google.com/go/iam/admin/apiv1/iam_client.go @@ -0,0 +1,475 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package admin + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + adminpb "google.golang.org/genproto/googleapis/iam/admin/v1" + iampb "google.golang.org/genproto/googleapis/iam/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// IamCallOptions contains the retry settings for each method of IamClient. +type IamCallOptions struct { + ListServiceAccounts []gax.CallOption + GetServiceAccount []gax.CallOption + CreateServiceAccount []gax.CallOption + UpdateServiceAccount []gax.CallOption + DeleteServiceAccount []gax.CallOption + ListServiceAccountKeys []gax.CallOption + GetServiceAccountKey []gax.CallOption + CreateServiceAccountKey []gax.CallOption + DeleteServiceAccountKey []gax.CallOption + SignBlob []gax.CallOption + GetIamPolicy []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption + QueryGrantableRoles []gax.CallOption + SignJwt []gax.CallOption +} + +func defaultIamClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("iam.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultIamCallOptions() *IamCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &IamCallOptions{ + ListServiceAccounts: retry[[2]string{"default", "idempotent"}], + GetServiceAccount: retry[[2]string{"default", "idempotent"}], + CreateServiceAccount: retry[[2]string{"default", "non_idempotent"}], + UpdateServiceAccount: retry[[2]string{"default", "idempotent"}], + DeleteServiceAccount: retry[[2]string{"default", "idempotent"}], + ListServiceAccountKeys: retry[[2]string{"default", "idempotent"}], + GetServiceAccountKey: retry[[2]string{"default", "idempotent"}], + CreateServiceAccountKey: retry[[2]string{"default", "non_idempotent"}], + DeleteServiceAccountKey: retry[[2]string{"default", "idempotent"}], + SignBlob: retry[[2]string{"default", "non_idempotent"}], + GetIamPolicy: retry[[2]string{"default", "non_idempotent"}], + SetIamPolicy: retry[[2]string{"default", "non_idempotent"}], + TestIamPermissions: retry[[2]string{"default", "non_idempotent"}], + QueryGrantableRoles: retry[[2]string{"default", "non_idempotent"}], + SignJwt: retry[[2]string{"default", "non_idempotent"}], + } +} + +// IamClient is a client for interacting with Google Identity and Access Management (IAM) API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type IamClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + iamClient adminpb.IAMClient + + // The call options for this service. + CallOptions *IamCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewIamClient creates a new iam client. +// +// Creates and manages service account objects. +// +// Service account is an account that belongs to your project instead +// of to an individual end user. It is used to authenticate calls +// to a Google API. +// +// To create a service account, specify the project_id and account_id +// for the account. The account_id is unique within the project, and used +// to generate the service account email address and a stable +// unique_id. +// +// All other methods can identify accounts using the format +// projects/{PROJECT_ID}/serviceAccounts/{SERVICE_ACCOUNT_EMAIL}. +// Using - as a wildcard for the project will infer the project from +// the account. The account value can be the email address or the +// unique_id of the service account. +func NewIamClient(ctx context.Context, opts ...option.ClientOption) (*IamClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultIamClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &IamClient{ + conn: conn, + CallOptions: defaultIamCallOptions(), + + iamClient: adminpb.NewIAMClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *IamClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *IamClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *IamClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListServiceAccounts lists [ServiceAccounts][google.iam.admin.v1.ServiceAccount] for a project. +func (c *IamClient) ListServiceAccounts(ctx context.Context, req *adminpb.ListServiceAccountsRequest, opts ...gax.CallOption) *ServiceAccountIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListServiceAccounts[0:len(c.CallOptions.ListServiceAccounts):len(c.CallOptions.ListServiceAccounts)], opts...) + it := &ServiceAccountIterator{} + req = proto.Clone(req).(*adminpb.ListServiceAccountsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.ServiceAccount, string, error) { + var resp *adminpb.ListServiceAccountsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.ListServiceAccounts(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Accounts, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetServiceAccount gets a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. +func (c *IamClient) GetServiceAccount(ctx context.Context, req *adminpb.GetServiceAccountRequest, opts ...gax.CallOption) (*adminpb.ServiceAccount, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetServiceAccount[0:len(c.CallOptions.GetServiceAccount):len(c.CallOptions.GetServiceAccount)], opts...) + var resp *adminpb.ServiceAccount + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.GetServiceAccount(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateServiceAccount creates a [ServiceAccount][google.iam.admin.v1.ServiceAccount] +// and returns it. +func (c *IamClient) CreateServiceAccount(ctx context.Context, req *adminpb.CreateServiceAccountRequest, opts ...gax.CallOption) (*adminpb.ServiceAccount, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateServiceAccount[0:len(c.CallOptions.CreateServiceAccount):len(c.CallOptions.CreateServiceAccount)], opts...) + var resp *adminpb.ServiceAccount + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.CreateServiceAccount(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateServiceAccount updates a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. +// +// Currently, only the following fields are updatable: +// display_name . +// The etag is mandatory. +func (c *IamClient) UpdateServiceAccount(ctx context.Context, req *adminpb.ServiceAccount, opts ...gax.CallOption) (*adminpb.ServiceAccount, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateServiceAccount[0:len(c.CallOptions.UpdateServiceAccount):len(c.CallOptions.UpdateServiceAccount)], opts...) + var resp *adminpb.ServiceAccount + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.UpdateServiceAccount(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteServiceAccount deletes a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. +func (c *IamClient) DeleteServiceAccount(ctx context.Context, req *adminpb.DeleteServiceAccountRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteServiceAccount[0:len(c.CallOptions.DeleteServiceAccount):len(c.CallOptions.DeleteServiceAccount)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.iamClient.DeleteServiceAccount(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListServiceAccountKeys lists [ServiceAccountKeys][google.iam.admin.v1.ServiceAccountKey]. +func (c *IamClient) ListServiceAccountKeys(ctx context.Context, req *adminpb.ListServiceAccountKeysRequest, opts ...gax.CallOption) (*adminpb.ListServiceAccountKeysResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListServiceAccountKeys[0:len(c.CallOptions.ListServiceAccountKeys):len(c.CallOptions.ListServiceAccountKeys)], opts...) + var resp *adminpb.ListServiceAccountKeysResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.ListServiceAccountKeys(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetServiceAccountKey gets the [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] +// by key id. +func (c *IamClient) GetServiceAccountKey(ctx context.Context, req *adminpb.GetServiceAccountKeyRequest, opts ...gax.CallOption) (*adminpb.ServiceAccountKey, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetServiceAccountKey[0:len(c.CallOptions.GetServiceAccountKey):len(c.CallOptions.GetServiceAccountKey)], opts...) + var resp *adminpb.ServiceAccountKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.GetServiceAccountKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateServiceAccountKey creates a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] +// and returns it. +func (c *IamClient) CreateServiceAccountKey(ctx context.Context, req *adminpb.CreateServiceAccountKeyRequest, opts ...gax.CallOption) (*adminpb.ServiceAccountKey, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateServiceAccountKey[0:len(c.CallOptions.CreateServiceAccountKey):len(c.CallOptions.CreateServiceAccountKey)], opts...) + var resp *adminpb.ServiceAccountKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.CreateServiceAccountKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteServiceAccountKey deletes a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey]. +func (c *IamClient) DeleteServiceAccountKey(ctx context.Context, req *adminpb.DeleteServiceAccountKeyRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteServiceAccountKey[0:len(c.CallOptions.DeleteServiceAccountKey):len(c.CallOptions.DeleteServiceAccountKey)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.iamClient.DeleteServiceAccountKey(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// SignBlob signs a blob using a service account's system-managed private key. +func (c *IamClient) SignBlob(ctx context.Context, req *adminpb.SignBlobRequest, opts ...gax.CallOption) (*adminpb.SignBlobResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SignBlob[0:len(c.CallOptions.SignBlob):len(c.CallOptions.SignBlob)], opts...) + var resp *adminpb.SignBlobResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.SignBlob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// getIamPolicy returns the IAM access control policy for a +// [ServiceAccount][google.iam.admin.v1.ServiceAccount]. +func (c *IamClient) getIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetIamPolicy[0:len(c.CallOptions.GetIamPolicy):len(c.CallOptions.GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// setIamPolicy sets the IAM access control policy for a +// [ServiceAccount][google.iam.admin.v1.ServiceAccount]. +func (c *IamClient) setIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetIamPolicy[0:len(c.CallOptions.SetIamPolicy):len(c.CallOptions.SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// TestIamPermissions tests the specified permissions against the IAM access control policy +// for a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. +func (c *IamClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.TestIamPermissions[0:len(c.CallOptions.TestIamPermissions):len(c.CallOptions.TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// QueryGrantableRoles queries roles that can be granted on a particular resource. +// A role is grantable if it can be used as the role in a binding for a policy +// for that resource. +func (c *IamClient) QueryGrantableRoles(ctx context.Context, req *adminpb.QueryGrantableRolesRequest, opts ...gax.CallOption) (*adminpb.QueryGrantableRolesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.QueryGrantableRoles[0:len(c.CallOptions.QueryGrantableRoles):len(c.CallOptions.QueryGrantableRoles)], opts...) + var resp *adminpb.QueryGrantableRolesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.QueryGrantableRoles(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SignJwt signs a JWT using a service account's system-managed private key. +// +// If no expiry time (exp) is provided in the SignJwtRequest, IAM sets an +// an expiry time of one hour by default. If you request an expiry time of +// more than one hour, the request will fail. +func (c *IamClient) SignJwt(ctx context.Context, req *adminpb.SignJwtRequest, opts ...gax.CallOption) (*adminpb.SignJwtResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SignJwt[0:len(c.CallOptions.SignJwt):len(c.CallOptions.SignJwt)], opts...) + var resp *adminpb.SignJwtResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamClient.SignJwt(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ServiceAccountIterator manages a stream of *adminpb.ServiceAccount. +type ServiceAccountIterator struct { + items []*adminpb.ServiceAccount + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*adminpb.ServiceAccount, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ServiceAccountIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ServiceAccountIterator) Next() (*adminpb.ServiceAccount, error) { + var item *adminpb.ServiceAccount + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ServiceAccountIterator) bufLen() int { + return len(it.items) +} + +func (it *ServiceAccountIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/iam/admin/apiv1/iam_client_example_test.go b/vendor/cloud.google.com/go/iam/admin/apiv1/iam_client_example_test.go new file mode 100644 index 000000000..1caa8c3df --- /dev/null +++ b/vendor/cloud.google.com/go/iam/admin/apiv1/iam_client_example_test.go @@ -0,0 +1,272 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package admin_test + +import ( + "context" + + admin "cloud.google.com/go/iam/admin/apiv1" + "google.golang.org/api/iterator" + adminpb "google.golang.org/genproto/googleapis/iam/admin/v1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func ExampleNewIamClient() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleIamClient_ListServiceAccounts() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.ListServiceAccountsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListServiceAccounts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleIamClient_GetServiceAccount() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.GetServiceAccountRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetServiceAccount(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamClient_CreateServiceAccount() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.CreateServiceAccountRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateServiceAccount(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamClient_UpdateServiceAccount() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.ServiceAccount{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateServiceAccount(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamClient_DeleteServiceAccount() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.DeleteServiceAccountRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteServiceAccount(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleIamClient_ListServiceAccountKeys() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.ListServiceAccountKeysRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListServiceAccountKeys(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamClient_GetServiceAccountKey() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.GetServiceAccountKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetServiceAccountKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamClient_CreateServiceAccountKey() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.CreateServiceAccountKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateServiceAccountKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamClient_DeleteServiceAccountKey() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.DeleteServiceAccountKeyRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteServiceAccountKey(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleIamClient_SignBlob() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.SignBlobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SignBlob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamClient_TestIamPermissions() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamClient_QueryGrantableRoles() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.QueryGrantableRolesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.QueryGrantableRoles(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamClient_SignJwt() { + ctx := context.Background() + c, err := admin.NewIamClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &adminpb.SignJwtRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SignJwt(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/iam/admin/apiv1/mock_test.go b/vendor/cloud.google.com/go/iam/admin/apiv1/mock_test.go new file mode 100644 index 000000000..5851b1e7c --- /dev/null +++ b/vendor/cloud.google.com/go/iam/admin/apiv1/mock_test.go @@ -0,0 +1,1223 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package admin + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + adminpb "google.golang.org/genproto/googleapis/iam/admin/v1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockIamServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + adminpb.IAMServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockIamServer) ListServiceAccounts(ctx context.Context, req *adminpb.ListServiceAccountsRequest) (*adminpb.ListServiceAccountsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.ListServiceAccountsResponse), nil +} + +func (s *mockIamServer) GetServiceAccount(ctx context.Context, req *adminpb.GetServiceAccountRequest) (*adminpb.ServiceAccount, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.ServiceAccount), nil +} + +func (s *mockIamServer) CreateServiceAccount(ctx context.Context, req *adminpb.CreateServiceAccountRequest) (*adminpb.ServiceAccount, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.ServiceAccount), nil +} + +func (s *mockIamServer) UpdateServiceAccount(ctx context.Context, req *adminpb.ServiceAccount) (*adminpb.ServiceAccount, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.ServiceAccount), nil +} + +func (s *mockIamServer) DeleteServiceAccount(ctx context.Context, req *adminpb.DeleteServiceAccountRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockIamServer) ListServiceAccountKeys(ctx context.Context, req *adminpb.ListServiceAccountKeysRequest) (*adminpb.ListServiceAccountKeysResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.ListServiceAccountKeysResponse), nil +} + +func (s *mockIamServer) GetServiceAccountKey(ctx context.Context, req *adminpb.GetServiceAccountKeyRequest) (*adminpb.ServiceAccountKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.ServiceAccountKey), nil +} + +func (s *mockIamServer) CreateServiceAccountKey(ctx context.Context, req *adminpb.CreateServiceAccountKeyRequest) (*adminpb.ServiceAccountKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.ServiceAccountKey), nil +} + +func (s *mockIamServer) DeleteServiceAccountKey(ctx context.Context, req *adminpb.DeleteServiceAccountKeyRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockIamServer) SignBlob(ctx context.Context, req *adminpb.SignBlobRequest) (*adminpb.SignBlobResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.SignBlobResponse), nil +} + +func (s *mockIamServer) SignJwt(ctx context.Context, req *adminpb.SignJwtRequest) (*adminpb.SignJwtResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.SignJwtResponse), nil +} + +func (s *mockIamServer) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockIamServer) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockIamServer) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.TestIamPermissionsResponse), nil +} + +func (s *mockIamServer) QueryGrantableRoles(ctx context.Context, req *adminpb.QueryGrantableRolesRequest) (*adminpb.QueryGrantableRolesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*adminpb.QueryGrantableRolesResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockIam mockIamServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + adminpb.RegisterIAMServer(serv, &mockIam) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestIamListServiceAccounts(t *testing.T) { + var nextPageToken string = "" + var accountsElement *adminpb.ServiceAccount = &adminpb.ServiceAccount{} + var accounts = []*adminpb.ServiceAccount{accountsElement} + var expectedResponse = &adminpb.ListServiceAccountsResponse{ + NextPageToken: nextPageToken, + Accounts: accounts, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &adminpb.ListServiceAccountsRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListServiceAccounts(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Accounts[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamListServiceAccountsError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &adminpb.ListServiceAccountsRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListServiceAccounts(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamGetServiceAccount(t *testing.T) { + var name2 string = "name2-1052831874" + var projectId string = "projectId-1969970175" + var uniqueId string = "uniqueId-538310583" + var email string = "email96619420" + var displayName string = "displayName1615086568" + var etag []byte = []byte("21") + var oauth2ClientId string = "oauth2ClientId-1833466037" + var expectedResponse = &adminpb.ServiceAccount{ + Name: name2, + ProjectId: projectId, + UniqueId: uniqueId, + Email: email, + DisplayName: displayName, + Etag: etag, + Oauth2ClientId: oauth2ClientId, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &adminpb.GetServiceAccountRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetServiceAccount(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamGetServiceAccountError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &adminpb.GetServiceAccountRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetServiceAccount(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamCreateServiceAccount(t *testing.T) { + var name2 string = "name2-1052831874" + var projectId string = "projectId-1969970175" + var uniqueId string = "uniqueId-538310583" + var email string = "email96619420" + var displayName string = "displayName1615086568" + var etag []byte = []byte("21") + var oauth2ClientId string = "oauth2ClientId-1833466037" + var expectedResponse = &adminpb.ServiceAccount{ + Name: name2, + ProjectId: projectId, + UniqueId: uniqueId, + Email: email, + DisplayName: displayName, + Etag: etag, + Oauth2ClientId: oauth2ClientId, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var accountId string = "accountId-803333011" + var request = &adminpb.CreateServiceAccountRequest{ + Name: formattedName, + AccountId: accountId, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateServiceAccount(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamCreateServiceAccountError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var accountId string = "accountId-803333011" + var request = &adminpb.CreateServiceAccountRequest{ + Name: formattedName, + AccountId: accountId, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateServiceAccount(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamUpdateServiceAccount(t *testing.T) { + var name string = "name3373707" + var projectId string = "projectId-1969970175" + var uniqueId string = "uniqueId-538310583" + var email string = "email96619420" + var displayName string = "displayName1615086568" + var etag2 []byte = []byte("-120") + var oauth2ClientId string = "oauth2ClientId-1833466037" + var expectedResponse = &adminpb.ServiceAccount{ + Name: name, + ProjectId: projectId, + UniqueId: uniqueId, + Email: email, + DisplayName: displayName, + Etag: etag2, + Oauth2ClientId: oauth2ClientId, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var etag []byte = []byte("21") + var request = &adminpb.ServiceAccount{ + Etag: etag, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateServiceAccount(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamUpdateServiceAccountError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var etag []byte = []byte("21") + var request = &adminpb.ServiceAccount{ + Etag: etag, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateServiceAccount(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamDeleteServiceAccount(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &adminpb.DeleteServiceAccountRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteServiceAccount(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestIamDeleteServiceAccountError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &adminpb.DeleteServiceAccountRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteServiceAccount(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestIamListServiceAccountKeys(t *testing.T) { + var expectedResponse *adminpb.ListServiceAccountKeysResponse = &adminpb.ListServiceAccountKeysResponse{} + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &adminpb.ListServiceAccountKeysRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListServiceAccountKeys(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamListServiceAccountKeysError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &adminpb.ListServiceAccountKeysRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListServiceAccountKeys(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamGetServiceAccountKey(t *testing.T) { + var name2 string = "name2-1052831874" + var privateKeyData []byte = []byte("-58") + var publicKeyData []byte = []byte("-96") + var expectedResponse = &adminpb.ServiceAccountKey{ + Name: name2, + PrivateKeyData: privateKeyData, + PublicKeyData: publicKeyData, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s/keys/%s", "[PROJECT]", "[SERVICE_ACCOUNT]", "[KEY]") + var request = &adminpb.GetServiceAccountKeyRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetServiceAccountKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamGetServiceAccountKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s/keys/%s", "[PROJECT]", "[SERVICE_ACCOUNT]", "[KEY]") + var request = &adminpb.GetServiceAccountKeyRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetServiceAccountKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamCreateServiceAccountKey(t *testing.T) { + var name2 string = "name2-1052831874" + var privateKeyData []byte = []byte("-58") + var publicKeyData []byte = []byte("-96") + var expectedResponse = &adminpb.ServiceAccountKey{ + Name: name2, + PrivateKeyData: privateKeyData, + PublicKeyData: publicKeyData, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &adminpb.CreateServiceAccountKeyRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateServiceAccountKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamCreateServiceAccountKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &adminpb.CreateServiceAccountKeyRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateServiceAccountKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamDeleteServiceAccountKey(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s/keys/%s", "[PROJECT]", "[SERVICE_ACCOUNT]", "[KEY]") + var request = &adminpb.DeleteServiceAccountKeyRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteServiceAccountKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestIamDeleteServiceAccountKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s/keys/%s", "[PROJECT]", "[SERVICE_ACCOUNT]", "[KEY]") + var request = &adminpb.DeleteServiceAccountKeyRequest{ + Name: formattedName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteServiceAccountKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestIamSignBlob(t *testing.T) { + var keyId string = "keyId-1134673157" + var signature []byte = []byte("-72") + var expectedResponse = &adminpb.SignBlobResponse{ + KeyId: keyId, + Signature: signature, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var bytesToSign []byte = []byte("45") + var request = &adminpb.SignBlobRequest{ + Name: formattedName, + BytesToSign: bytesToSign, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SignBlob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamSignBlobError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var bytesToSign []byte = []byte("45") + var request = &adminpb.SignBlobRequest{ + Name: formattedName, + BytesToSign: bytesToSign, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SignBlob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamGetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.getIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamGetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.getIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamSetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.setIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamSetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.setIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamTestIamPermissions(t *testing.T) { + var expectedResponse *iampb.TestIamPermissionsResponse = &iampb.TestIamPermissionsResponse{} + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamTestIamPermissionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamQueryGrantableRoles(t *testing.T) { + var nextPageToken string = "nextPageToken-1530815211" + var expectedResponse = &adminpb.QueryGrantableRolesResponse{ + NextPageToken: nextPageToken, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var fullResourceName string = "fullResourceName1300993644" + var request = &adminpb.QueryGrantableRolesRequest{ + FullResourceName: fullResourceName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.QueryGrantableRoles(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamQueryGrantableRolesError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var fullResourceName string = "fullResourceName1300993644" + var request = &adminpb.QueryGrantableRolesRequest{ + FullResourceName: fullResourceName, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.QueryGrantableRoles(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamSignJwt(t *testing.T) { + var keyId string = "keyId-1134673157" + var signedJwt string = "signedJwt-979546844" + var expectedResponse = &adminpb.SignJwtResponse{ + KeyId: keyId, + SignedJwt: signedJwt, + } + + mockIam.err = nil + mockIam.reqs = nil + + mockIam.resps = append(mockIam.resps[:0], expectedResponse) + + var name string = "name3373707" + var payload string = "payload-786701938" + var request = &adminpb.SignJwtRequest{ + Name: name, + Payload: payload, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SignJwt(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIam.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamSignJwtError(t *testing.T) { + errCode := codes.PermissionDenied + mockIam.err = gstatus.Error(errCode, "test error") + + var name string = "name3373707" + var payload string = "payload-786701938" + var request = &adminpb.SignJwtRequest{ + Name: name, + Payload: payload, + } + + c, err := NewIamClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SignJwt(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/iam/admin/apiv1/path_funcs.go b/vendor/cloud.google.com/go/iam/admin/apiv1/path_funcs.go new file mode 100644 index 000000000..9818266ff --- /dev/null +++ b/vendor/cloud.google.com/go/iam/admin/apiv1/path_funcs.go @@ -0,0 +1,45 @@ +// 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. + +package admin + +// IamProjectPath returns the path for the project resource. +func IamProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// IamServiceAccountPath returns the path for the service account resource. +func IamServiceAccountPath(project, serviceAccount string) string { + return "" + + "projects/" + + project + + "/serviceAccounts/" + + serviceAccount + + "" +} + +// IamKeyPath returns the path for the key resource. +func IamKeyPath(project, serviceAccount, key string) string { + return "" + + "projects/" + + project + + "/serviceAccounts/" + + serviceAccount + + "/keys/" + + key + + "" +} diff --git a/vendor/cloud.google.com/go/iam/admin/apiv1/policy_methods.go b/vendor/cloud.google.com/go/iam/admin/apiv1/policy_methods.go new file mode 100644 index 000000000..d61abb745 --- /dev/null +++ b/vendor/cloud.google.com/go/iam/admin/apiv1/policy_methods.go @@ -0,0 +1,53 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This is handwritten code. These methods are implemented by hand so they can use +// the iam.Policy type. + +package admin + +import ( + "context" + + "cloud.google.com/go/iam" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +// GetIamPolicy returns the IAM access control policy for a ServiceAccount. +func (c *IamClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iam.Policy, error) { + policy, err := c.getIamPolicy(ctx, req) + if err != nil { + return nil, err + } + return &iam.Policy{InternalProto: policy}, nil +} + +// SetIamPolicyRequest is the request type for the SetIamPolicy method. +type SetIamPolicyRequest struct { + Resource string + Policy *iam.Policy +} + +// SetIamPolicy sets the IAM access control policy for a ServiceAccount. +func (c *IamClient) SetIamPolicy(ctx context.Context, req *SetIamPolicyRequest) (*iam.Policy, error) { + preq := &iampb.SetIamPolicyRequest{ + Resource: req.Resource, + Policy: req.Policy.InternalProto, + } + policy, err := c.setIamPolicy(ctx, preq) + if err != nil { + return nil, err + } + return &iam.Policy{InternalProto: policy}, nil +} diff --git a/vendor/cloud.google.com/go/iam/credentials/apiv1/doc.go b/vendor/cloud.google.com/go/iam/credentials/apiv1/doc.go new file mode 100644 index 000000000..718b2b4f5 --- /dev/null +++ b/vendor/cloud.google.com/go/iam/credentials/apiv1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package credentials is an auto-generated package for the +// IAM Service Account Credentials API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// IAM Service Account Credentials API +package credentials // import "cloud.google.com/go/iam/credentials/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/iam/credentials/apiv1/iam_credentials_client.go b/vendor/cloud.google.com/go/iam/credentials/apiv1/iam_credentials_client.go new file mode 100644 index 000000000..897d151e1 --- /dev/null +++ b/vendor/cloud.google.com/go/iam/credentials/apiv1/iam_credentials_client.go @@ -0,0 +1,214 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package credentials + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + credentialspb "google.golang.org/genproto/googleapis/iam/credentials/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// IamCredentialsCallOptions contains the retry settings for each method of IamCredentialsClient. +type IamCredentialsCallOptions struct { + GenerateAccessToken []gax.CallOption + GenerateIdToken []gax.CallOption + SignBlob []gax.CallOption + SignJwt []gax.CallOption + GenerateIdentityBindingAccessToken []gax.CallOption +} + +func defaultIamCredentialsClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("iamcredentials.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultIamCredentialsCallOptions() *IamCredentialsCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &IamCredentialsCallOptions{ + GenerateAccessToken: retry[[2]string{"default", "idempotent"}], + GenerateIdToken: retry[[2]string{"default", "idempotent"}], + SignBlob: retry[[2]string{"default", "idempotent"}], + SignJwt: retry[[2]string{"default", "idempotent"}], + GenerateIdentityBindingAccessToken: retry[[2]string{"default", "idempotent"}], + } +} + +// IamCredentialsClient is a client for interacting with IAM Service Account Credentials API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type IamCredentialsClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + iamCredentialsClient credentialspb.IAMCredentialsClient + + // The call options for this service. + CallOptions *IamCredentialsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewIamCredentialsClient creates a new iam credentials client. +// +// A service account is a special type of Google account that belongs to your +// application or a virtual machine (VM), instead of to an individual end user. +// Your application assumes the identity of the service account to call Google +// APIs, so that the users aren't directly involved. +// +// Service account credentials are used to temporarily assume the identity +// of the service account. Supported credential types include OAuth 2.0 access +// tokens, OpenID Connect ID tokens, self-signed JSON Web Tokens (JWTs), and +// more. +func NewIamCredentialsClient(ctx context.Context, opts ...option.ClientOption) (*IamCredentialsClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultIamCredentialsClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &IamCredentialsClient{ + conn: conn, + CallOptions: defaultIamCredentialsCallOptions(), + + iamCredentialsClient: credentialspb.NewIAMCredentialsClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *IamCredentialsClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *IamCredentialsClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *IamCredentialsClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// GenerateAccessToken generates an OAuth 2.0 access token for a service account. +func (c *IamCredentialsClient) GenerateAccessToken(ctx context.Context, req *credentialspb.GenerateAccessTokenRequest, opts ...gax.CallOption) (*credentialspb.GenerateAccessTokenResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GenerateAccessToken[0:len(c.CallOptions.GenerateAccessToken):len(c.CallOptions.GenerateAccessToken)], opts...) + var resp *credentialspb.GenerateAccessTokenResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamCredentialsClient.GenerateAccessToken(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GenerateIdToken generates an OpenID Connect ID token for a service account. +func (c *IamCredentialsClient) GenerateIdToken(ctx context.Context, req *credentialspb.GenerateIdTokenRequest, opts ...gax.CallOption) (*credentialspb.GenerateIdTokenResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GenerateIdToken[0:len(c.CallOptions.GenerateIdToken):len(c.CallOptions.GenerateIdToken)], opts...) + var resp *credentialspb.GenerateIdTokenResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamCredentialsClient.GenerateIdToken(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SignBlob signs a blob using a service account's system-managed private key. +func (c *IamCredentialsClient) SignBlob(ctx context.Context, req *credentialspb.SignBlobRequest, opts ...gax.CallOption) (*credentialspb.SignBlobResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SignBlob[0:len(c.CallOptions.SignBlob):len(c.CallOptions.SignBlob)], opts...) + var resp *credentialspb.SignBlobResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamCredentialsClient.SignBlob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SignJwt signs a JWT using a service account's system-managed private key. +func (c *IamCredentialsClient) SignJwt(ctx context.Context, req *credentialspb.SignJwtRequest, opts ...gax.CallOption) (*credentialspb.SignJwtResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SignJwt[0:len(c.CallOptions.SignJwt):len(c.CallOptions.SignJwt)], opts...) + var resp *credentialspb.SignJwtResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamCredentialsClient.SignJwt(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GenerateIdentityBindingAccessToken exchange a JWT signed by third party identity provider to an OAuth 2.0 +// access token +func (c *IamCredentialsClient) GenerateIdentityBindingAccessToken(ctx context.Context, req *credentialspb.GenerateIdentityBindingAccessTokenRequest, opts ...gax.CallOption) (*credentialspb.GenerateIdentityBindingAccessTokenResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GenerateIdentityBindingAccessToken[0:len(c.CallOptions.GenerateIdentityBindingAccessToken):len(c.CallOptions.GenerateIdentityBindingAccessToken)], opts...) + var resp *credentialspb.GenerateIdentityBindingAccessTokenResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.iamCredentialsClient.GenerateIdentityBindingAccessToken(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/iam/credentials/apiv1/iam_credentials_client_example_test.go b/vendor/cloud.google.com/go/iam/credentials/apiv1/iam_credentials_client_example_test.go new file mode 100644 index 000000000..0aed2668a --- /dev/null +++ b/vendor/cloud.google.com/go/iam/credentials/apiv1/iam_credentials_client_example_test.go @@ -0,0 +1,124 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package credentials_test + +import ( + "context" + + credentials "cloud.google.com/go/iam/credentials/apiv1" + credentialspb "google.golang.org/genproto/googleapis/iam/credentials/v1" +) + +func ExampleNewIamCredentialsClient() { + ctx := context.Background() + c, err := credentials.NewIamCredentialsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleIamCredentialsClient_GenerateAccessToken() { + ctx := context.Background() + c, err := credentials.NewIamCredentialsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &credentialspb.GenerateAccessTokenRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GenerateAccessToken(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamCredentialsClient_GenerateIdToken() { + ctx := context.Background() + c, err := credentials.NewIamCredentialsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &credentialspb.GenerateIdTokenRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GenerateIdToken(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamCredentialsClient_SignBlob() { + ctx := context.Background() + c, err := credentials.NewIamCredentialsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &credentialspb.SignBlobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SignBlob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamCredentialsClient_SignJwt() { + ctx := context.Background() + c, err := credentials.NewIamCredentialsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &credentialspb.SignJwtRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SignJwt(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleIamCredentialsClient_GenerateIdentityBindingAccessToken() { + ctx := context.Background() + c, err := credentials.NewIamCredentialsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &credentialspb.GenerateIdentityBindingAccessTokenRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GenerateIdentityBindingAccessToken(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/iam/credentials/apiv1/mock_test.go b/vendor/cloud.google.com/go/iam/credentials/apiv1/mock_test.go new file mode 100644 index 000000000..14d81ae31 --- /dev/null +++ b/vendor/cloud.google.com/go/iam/credentials/apiv1/mock_test.go @@ -0,0 +1,474 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package credentials + +import ( + credentialspb "google.golang.org/genproto/googleapis/iam/credentials/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockIamCredentialsServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + credentialspb.IAMCredentialsServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockIamCredentialsServer) GenerateAccessToken(ctx context.Context, req *credentialspb.GenerateAccessTokenRequest) (*credentialspb.GenerateAccessTokenResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*credentialspb.GenerateAccessTokenResponse), nil +} + +func (s *mockIamCredentialsServer) GenerateIdToken(ctx context.Context, req *credentialspb.GenerateIdTokenRequest) (*credentialspb.GenerateIdTokenResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*credentialspb.GenerateIdTokenResponse), nil +} + +func (s *mockIamCredentialsServer) SignBlob(ctx context.Context, req *credentialspb.SignBlobRequest) (*credentialspb.SignBlobResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*credentialspb.SignBlobResponse), nil +} + +func (s *mockIamCredentialsServer) SignJwt(ctx context.Context, req *credentialspb.SignJwtRequest) (*credentialspb.SignJwtResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*credentialspb.SignJwtResponse), nil +} + +func (s *mockIamCredentialsServer) GenerateIdentityBindingAccessToken(ctx context.Context, req *credentialspb.GenerateIdentityBindingAccessTokenRequest) (*credentialspb.GenerateIdentityBindingAccessTokenResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*credentialspb.GenerateIdentityBindingAccessTokenResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockIamCredentials mockIamCredentialsServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + credentialspb.RegisterIAMCredentialsServer(serv, &mockIamCredentials) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestIamCredentialsGenerateAccessToken(t *testing.T) { + var accessToken string = "accessToken-1938933922" + var expectedResponse = &credentialspb.GenerateAccessTokenResponse{ + AccessToken: accessToken, + } + + mockIamCredentials.err = nil + mockIamCredentials.reqs = nil + + mockIamCredentials.resps = append(mockIamCredentials.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var scope []string = nil + var request = &credentialspb.GenerateAccessTokenRequest{ + Name: formattedName, + Scope: scope, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GenerateAccessToken(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIamCredentials.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamCredentialsGenerateAccessTokenError(t *testing.T) { + errCode := codes.PermissionDenied + mockIamCredentials.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var scope []string = nil + var request = &credentialspb.GenerateAccessTokenRequest{ + Name: formattedName, + Scope: scope, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GenerateAccessToken(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamCredentialsGenerateIdToken(t *testing.T) { + var token string = "token110541305" + var expectedResponse = &credentialspb.GenerateIdTokenResponse{ + Token: token, + } + + mockIamCredentials.err = nil + mockIamCredentials.reqs = nil + + mockIamCredentials.resps = append(mockIamCredentials.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var audience string = "audience975628804" + var request = &credentialspb.GenerateIdTokenRequest{ + Name: formattedName, + Audience: audience, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GenerateIdToken(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIamCredentials.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamCredentialsGenerateIdTokenError(t *testing.T) { + errCode := codes.PermissionDenied + mockIamCredentials.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var audience string = "audience975628804" + var request = &credentialspb.GenerateIdTokenRequest{ + Name: formattedName, + Audience: audience, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GenerateIdToken(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamCredentialsSignBlob(t *testing.T) { + var keyId string = "keyId-1134673157" + var signedBlob []byte = []byte("-32") + var expectedResponse = &credentialspb.SignBlobResponse{ + KeyId: keyId, + SignedBlob: signedBlob, + } + + mockIamCredentials.err = nil + mockIamCredentials.reqs = nil + + mockIamCredentials.resps = append(mockIamCredentials.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var payload []byte = []byte("-114") + var request = &credentialspb.SignBlobRequest{ + Name: formattedName, + Payload: payload, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SignBlob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIamCredentials.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamCredentialsSignBlobError(t *testing.T) { + errCode := codes.PermissionDenied + mockIamCredentials.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var payload []byte = []byte("-114") + var request = &credentialspb.SignBlobRequest{ + Name: formattedName, + Payload: payload, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SignBlob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamCredentialsSignJwt(t *testing.T) { + var keyId string = "keyId-1134673157" + var signedJwt string = "signedJwt-979546844" + var expectedResponse = &credentialspb.SignJwtResponse{ + KeyId: keyId, + SignedJwt: signedJwt, + } + + mockIamCredentials.err = nil + mockIamCredentials.reqs = nil + + mockIamCredentials.resps = append(mockIamCredentials.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var payload string = "-114" + var request = &credentialspb.SignJwtRequest{ + Name: formattedName, + Payload: payload, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SignJwt(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIamCredentials.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamCredentialsSignJwtError(t *testing.T) { + errCode := codes.PermissionDenied + mockIamCredentials.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var payload string = "-114" + var request = &credentialspb.SignJwtRequest{ + Name: formattedName, + Payload: payload, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SignJwt(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestIamCredentialsGenerateIdentityBindingAccessToken(t *testing.T) { + var accessToken string = "accessToken-1938933922" + var expectedResponse = &credentialspb.GenerateIdentityBindingAccessTokenResponse{ + AccessToken: accessToken, + } + + mockIamCredentials.err = nil + mockIamCredentials.reqs = nil + + mockIamCredentials.resps = append(mockIamCredentials.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var scope []string = nil + var jwt string = "jwt105671" + var request = &credentialspb.GenerateIdentityBindingAccessTokenRequest{ + Name: formattedName, + Scope: scope, + Jwt: jwt, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GenerateIdentityBindingAccessToken(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockIamCredentials.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestIamCredentialsGenerateIdentityBindingAccessTokenError(t *testing.T) { + errCode := codes.PermissionDenied + mockIamCredentials.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/serviceAccounts/%s", "[PROJECT]", "[SERVICE_ACCOUNT]") + var scope []string = nil + var jwt string = "jwt105671" + var request = &credentialspb.GenerateIdentityBindingAccessTokenRequest{ + Name: formattedName, + Scope: scope, + Jwt: jwt, + } + + c, err := NewIamCredentialsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GenerateIdentityBindingAccessToken(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/iam/iam.go b/vendor/cloud.google.com/go/iam/iam.go new file mode 100644 index 000000000..76df63561 --- /dev/null +++ b/vendor/cloud.google.com/go/iam/iam.go @@ -0,0 +1,292 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package iam supports the resource-specific operations of Google Cloud +// IAM (Identity and Access Management) for the Google Cloud Libraries. +// See https://cloud.google.com/iam for more about IAM. +// +// Users of the Google Cloud Libraries will typically not use this package +// directly. Instead they will begin with some resource that supports IAM, like +// a pubsub topic, and call its IAM method to get a Handle for that resource. +package iam + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/iam/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +// client abstracts the IAMPolicy API to allow multiple implementations. +type client interface { + Get(ctx context.Context, resource string) (*pb.Policy, error) + Set(ctx context.Context, resource string, p *pb.Policy) error + Test(ctx context.Context, resource string, perms []string) ([]string, error) +} + +// grpcClient implements client for the standard gRPC-based IAMPolicy service. +type grpcClient struct { + c pb.IAMPolicyClient +} + +var withRetry = gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60 * time.Second, + Multiplier: 1.3, + }) +}) + +func (g *grpcClient) Get(ctx context.Context, resource string) (*pb.Policy, error) { + var proto *pb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, _ gax.CallSettings) error { + var err error + proto, err = g.c.GetIamPolicy(ctx, &pb.GetIamPolicyRequest{Resource: resource}) + return err + }, withRetry) + if err != nil { + return nil, err + } + return proto, nil +} + +func (g *grpcClient) Set(ctx context.Context, resource string, p *pb.Policy) error { + return gax.Invoke(ctx, func(ctx context.Context, _ gax.CallSettings) error { + _, err := g.c.SetIamPolicy(ctx, &pb.SetIamPolicyRequest{ + Resource: resource, + Policy: p, + }) + return err + }, withRetry) +} + +func (g *grpcClient) Test(ctx context.Context, resource string, perms []string) ([]string, error) { + var res *pb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, _ gax.CallSettings) error { + var err error + res, err = g.c.TestIamPermissions(ctx, &pb.TestIamPermissionsRequest{ + Resource: resource, + Permissions: perms, + }) + return err + }, withRetry) + if err != nil { + return nil, err + } + return res.Permissions, nil +} + +// A Handle provides IAM operations for a resource. +type Handle struct { + c client + resource string +} + +// InternalNewHandle is for use by the Google Cloud Libraries only. +// +// InternalNewHandle returns a Handle for resource. +// The conn parameter refers to a server that must support the IAMPolicy service. +func InternalNewHandle(conn *grpc.ClientConn, resource string) *Handle { + return InternalNewHandleGRPCClient(pb.NewIAMPolicyClient(conn), resource) +} + +// InternalNewHandleGRPCClient is for use by the Google Cloud Libraries only. +// +// InternalNewHandleClient returns a Handle for resource using the given +// grpc service that implements IAM as a mixin +func InternalNewHandleGRPCClient(c pb.IAMPolicyClient, resource string) *Handle { + return InternalNewHandleClient(&grpcClient{c: c}, resource) +} + +// InternalNewHandleClient is for use by the Google Cloud Libraries only. +// +// InternalNewHandleClient returns a Handle for resource using the given +// client implementation. +func InternalNewHandleClient(c client, resource string) *Handle { + return &Handle{ + c: c, + resource: resource, + } +} + +// Policy retrieves the IAM policy for the resource. +func (h *Handle) Policy(ctx context.Context) (*Policy, error) { + proto, err := h.c.Get(ctx, h.resource) + if err != nil { + return nil, err + } + return &Policy{InternalProto: proto}, nil +} + +// SetPolicy replaces the resource's current policy with the supplied Policy. +// +// If policy was created from a prior call to Get, then the modification will +// only succeed if the policy has not changed since the Get. +func (h *Handle) SetPolicy(ctx context.Context, policy *Policy) error { + return h.c.Set(ctx, h.resource, policy.InternalProto) +} + +// TestPermissions returns the subset of permissions that the caller has on the resource. +func (h *Handle) TestPermissions(ctx context.Context, permissions []string) ([]string, error) { + return h.c.Test(ctx, h.resource, permissions) +} + +// A RoleName is a name representing a collection of permissions. +type RoleName string + +// Common role names. +const ( + Owner RoleName = "roles/owner" + Editor RoleName = "roles/editor" + Viewer RoleName = "roles/viewer" +) + +const ( + // AllUsers is a special member that denotes all users, even unauthenticated ones. + AllUsers = "allUsers" + + // AllAuthenticatedUsers is a special member that denotes all authenticated users. + AllAuthenticatedUsers = "allAuthenticatedUsers" +) + +// A Policy is a list of Bindings representing roles +// granted to members. +// +// The zero Policy is a valid policy with no bindings. +type Policy struct { + // TODO(jba): when type aliases are available, put Policy into an internal package + // and provide an exported alias here. + + // This field is exported for use by the Google Cloud Libraries only. + // It may become unexported in a future release. + InternalProto *pb.Policy +} + +// Members returns the list of members with the supplied role. +// The return value should not be modified. Use Add and Remove +// to modify the members of a role. +func (p *Policy) Members(r RoleName) []string { + b := p.binding(r) + if b == nil { + return nil + } + return b.Members +} + +// HasRole reports whether member has role r. +func (p *Policy) HasRole(member string, r RoleName) bool { + return memberIndex(member, p.binding(r)) >= 0 +} + +// Add adds member member to role r if it is not already present. +// A new binding is created if there is no binding for the role. +func (p *Policy) Add(member string, r RoleName) { + b := p.binding(r) + if b == nil { + if p.InternalProto == nil { + p.InternalProto = &pb.Policy{} + } + p.InternalProto.Bindings = append(p.InternalProto.Bindings, &pb.Binding{ + Role: string(r), + Members: []string{member}, + }) + return + } + if memberIndex(member, b) < 0 { + b.Members = append(b.Members, member) + return + } +} + +// Remove removes member from role r if it is present. +func (p *Policy) Remove(member string, r RoleName) { + bi := p.bindingIndex(r) + if bi < 0 { + return + } + bindings := p.InternalProto.Bindings + b := bindings[bi] + mi := memberIndex(member, b) + if mi < 0 { + return + } + // Order doesn't matter for bindings or members, so to remove, move the last item + // into the removed spot and shrink the slice. + if len(b.Members) == 1 { + // Remove binding. + last := len(bindings) - 1 + bindings[bi] = bindings[last] + bindings[last] = nil + p.InternalProto.Bindings = bindings[:last] + return + } + // Remove member. + // TODO(jba): worry about multiple copies of m? + last := len(b.Members) - 1 + b.Members[mi] = b.Members[last] + b.Members[last] = "" + b.Members = b.Members[:last] +} + +// Roles returns the names of all the roles that appear in the Policy. +func (p *Policy) Roles() []RoleName { + if p.InternalProto == nil { + return nil + } + var rns []RoleName + for _, b := range p.InternalProto.Bindings { + rns = append(rns, RoleName(b.Role)) + } + return rns +} + +// binding returns the Binding for the suppied role, or nil if there isn't one. +func (p *Policy) binding(r RoleName) *pb.Binding { + i := p.bindingIndex(r) + if i < 0 { + return nil + } + return p.InternalProto.Bindings[i] +} + +func (p *Policy) bindingIndex(r RoleName) int { + if p.InternalProto == nil { + return -1 + } + for i, b := range p.InternalProto.Bindings { + if b.Role == string(r) { + return i + } + } + return -1 +} + +// memberIndex returns the index of m in b's Members, or -1 if not found. +func memberIndex(m string, b *pb.Binding) int { + if b == nil { + return -1 + } + for i, mm := range b.Members { + if mm == m { + return i + } + } + return -1 +} diff --git a/vendor/cloud.google.com/go/iam/iam_test.go b/vendor/cloud.google.com/go/iam/iam_test.go new file mode 100644 index 000000000..67a9f05c0 --- /dev/null +++ b/vendor/cloud.google.com/go/iam/iam_test.go @@ -0,0 +1,87 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package iam + +import ( + "fmt" + "sort" + "testing" + + "cloud.google.com/go/internal/testutil" +) + +func TestPolicy(t *testing.T) { + p := &Policy{} + + add := func(member string, role RoleName) { + p.Add(member, role) + } + remove := func(member string, role RoleName) { + p.Remove(member, role) + } + + if msg, ok := checkMembers(p, Owner, nil); !ok { + t.Fatal(msg) + } + add("m1", Owner) + if msg, ok := checkMembers(p, Owner, []string{"m1"}); !ok { + t.Fatal(msg) + } + add("m2", Owner) + if msg, ok := checkMembers(p, Owner, []string{"m1", "m2"}); !ok { + t.Fatal(msg) + } + add("m1", Owner) // duplicate adds ignored + if msg, ok := checkMembers(p, Owner, []string{"m1", "m2"}); !ok { + t.Fatal(msg) + } + // No other roles populated yet. + if msg, ok := checkMembers(p, Viewer, nil); !ok { + t.Fatal(msg) + } + remove("m1", Owner) + if msg, ok := checkMembers(p, Owner, []string{"m2"}); !ok { + t.Fatal(msg) + } + if msg, ok := checkMembers(p, Viewer, nil); !ok { + t.Fatal(msg) + } + remove("m3", Owner) // OK to remove non-existent member. + if msg, ok := checkMembers(p, Owner, []string{"m2"}); !ok { + t.Fatal(msg) + } + remove("m2", Owner) + if msg, ok := checkMembers(p, Owner, nil); !ok { + t.Fatal(msg) + } + if got, want := p.Roles(), []RoleName(nil); !testutil.Equal(got, want) { + t.Fatalf("roles: got %v, want %v", got, want) + } +} + +func checkMembers(p *Policy, role RoleName, wantMembers []string) (string, bool) { + gotMembers := p.Members(role) + sort.Strings(gotMembers) + sort.Strings(wantMembers) + if !testutil.Equal(gotMembers, wantMembers) { + return fmt.Sprintf("got %v, want %v", gotMembers, wantMembers), false + } + for _, m := range wantMembers { + if !p.HasRole(m, role) { + return fmt.Sprintf("member %q should have role %s but does not", m, role), false + } + } + return "", true +} diff --git a/vendor/cloud.google.com/go/internal/annotate.go b/vendor/cloud.google.com/go/internal/annotate.go new file mode 100644 index 000000000..6435695ba --- /dev/null +++ b/vendor/cloud.google.com/go/internal/annotate.go @@ -0,0 +1,54 @@ +// Copyright 2017 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 internal + +import ( + "fmt" + + "google.golang.org/api/googleapi" + "google.golang.org/grpc/status" +) + +// Annotate prepends msg to the error message in err, attempting +// to preserve other information in err, like an error code. +// +// Annotate panics if err is nil. +// +// Annotate knows about these error types: +// - "google.golang.org/grpc/status".Status +// - "google.golang.org/api/googleapi".Error +// If the error is not one of these types, Annotate behaves +// like +// fmt.Errorf("%s: %v", msg, err) +func Annotate(err error, msg string) error { + if err == nil { + panic("Annotate called with nil") + } + if s, ok := status.FromError(err); ok { + p := s.Proto() + p.Message = msg + ": " + p.Message + return status.ErrorProto(p) + } + if g, ok := err.(*googleapi.Error); ok { + g.Message = msg + ": " + g.Message + return g + } + return fmt.Errorf("%s: %v", msg, err) +} + +// Annotatef uses format and args to format a string, then calls Annotate. +func Annotatef(err error, format string, args ...interface{}) error { + return Annotate(err, fmt.Sprintf(format, args...)) +} diff --git a/vendor/cloud.google.com/go/internal/annotate_test.go b/vendor/cloud.google.com/go/internal/annotate_test.go new file mode 100644 index 000000000..7203f51a9 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/annotate_test.go @@ -0,0 +1,65 @@ +// Copyright 2017 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 internal + +import ( + "errors" + "testing" + + "google.golang.org/api/googleapi" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +const wantMessage = "prefix: msg" + +func TestAnnotateGRPC(t *testing.T) { + // grpc Status error + err := status.Error(codes.NotFound, "msg") + err = Annotate(err, "prefix") + got, ok := status.FromError(err) + if !ok { + t.Fatalf("got %T, wanted a status", got) + } + if g, w := got.Code(), codes.NotFound; g != w { + t.Errorf("got code %v, want %v", g, w) + } + if g, w := got.Message(), wantMessage; g != w { + t.Errorf("got message %q, want %q", g, w) + } +} + +func TestAnnotateGoogleapi(t *testing.T) { + // googleapi error + var err error = &googleapi.Error{Code: 403, Message: "msg"} + err = Annotate(err, "prefix") + got2, ok := err.(*googleapi.Error) + if !ok { + t.Fatalf("got %T, wanted a googleapi.Error", got2) + } + if g, w := got2.Code, 403; g != w { + t.Errorf("got code %d, want %d", g, w) + } + if g, w := got2.Message, wantMessage; g != w { + t.Errorf("got message %q, want %q", g, w) + } +} + +func TestAnnotateUnknownError(t *testing.T) { + err := Annotate(errors.New("msg"), "prefix") + if g, w := err.Error(), wantMessage; g != w { + t.Errorf("got message %q, want %q", g, w) + } +} diff --git a/vendor/cloud.google.com/go/internal/btree/README.md b/vendor/cloud.google.com/go/internal/btree/README.md new file mode 100644 index 000000000..601ff544a --- /dev/null +++ b/vendor/cloud.google.com/go/internal/btree/README.md @@ -0,0 +1,11 @@ +This package is a fork of github.com/jba/btree at commit +d4edd57f39b8425fc2c631047ff4dc6024d82a4f, which itself was a fork of +github.com/google/btree at 316fb6d3f031ae8f4d457c6c5186b9e3ded70435. + +This directory makes the following modifications: + +- Updated copyright notice. +- removed LICENSE (it is the same as the repo-wide license, Apache 2.0) +- Removed examples_test.go and .travis.yml. +- Added this file. + diff --git a/vendor/cloud.google.com/go/internal/btree/benchmarks_test.go b/vendor/cloud.google.com/go/internal/btree/benchmarks_test.go new file mode 100644 index 000000000..4910cab31 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/btree/benchmarks_test.go @@ -0,0 +1,266 @@ +// 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 btree + +import ( + "fmt" + "sort" + "testing" +) + +const benchmarkTreeSize = 10000 + +var degrees = []int{2, 8, 32, 64} + +func BenchmarkInsert(b *testing.B) { + insertP := perm(benchmarkTreeSize) + for _, d := range degrees { + b.Run(fmt.Sprintf("degree=%d", d), func(b *testing.B) { + i := 0 + for i < b.N { + tr := New(d, less) + for _, m := range insertP { + tr.Set(m.Key, m.Value) + i++ + if i >= b.N { + return + } + } + } + }) + } +} + +func BenchmarkDeleteInsert(b *testing.B) { + insertP := perm(benchmarkTreeSize) + for _, d := range degrees { + b.Run(fmt.Sprintf("degree=%d", d), func(b *testing.B) { + tr := New(d, less) + for _, m := range insertP { + tr.Set(m.Key, m.Value) + } + b.ResetTimer() + for i := 0; i < b.N; i++ { + m := insertP[i%benchmarkTreeSize] + tr.Delete(m.Key) + tr.Set(m.Key, m.Value) + } + }) + } +} + +func BenchmarkDeleteInsertCloneOnce(b *testing.B) { + insertP := perm(benchmarkTreeSize) + for _, d := range degrees { + b.Run(fmt.Sprintf("degree=%d", d), func(b *testing.B) { + tr := New(d, less) + for _, m := range insertP { + tr.Set(m.Key, m.Value) + } + tr = tr.Clone() + b.ResetTimer() + for i := 0; i < b.N; i++ { + m := insertP[i%benchmarkTreeSize] + tr.Delete(m.Key) + tr.Set(m.Key, m.Value) + } + }) + } +} + +func BenchmarkDeleteInsertCloneEachTime(b *testing.B) { + insertP := perm(benchmarkTreeSize) + for _, d := range degrees { + b.Run(fmt.Sprintf("degree=%d", d), func(b *testing.B) { + tr := New(d, less) + for _, m := range insertP { + tr.Set(m.Key, m.Value) + } + b.ResetTimer() + for i := 0; i < b.N; i++ { + tr = tr.Clone() + m := insertP[i%benchmarkTreeSize] + tr.Delete(m.Key) + tr.Set(m.Key, m.Value) + } + }) + } +} + +func BenchmarkDelete(b *testing.B) { + insertP := perm(benchmarkTreeSize) + removeP := perm(benchmarkTreeSize) + for _, d := range degrees { + b.Run(fmt.Sprintf("degree=%d", d), func(b *testing.B) { + i := 0 + for i < b.N { + b.StopTimer() + tr := New(d, less) + for _, v := range insertP { + tr.Set(v.Key, v.Value) + } + b.StartTimer() + for _, m := range removeP { + tr.Delete(m.Key) + i++ + if i >= b.N { + return + } + } + if tr.Len() > 0 { + panic(tr.Len()) + } + } + }) + } +} + +func BenchmarkGet(b *testing.B) { + insertP := perm(benchmarkTreeSize) + getP := perm(benchmarkTreeSize) + for _, d := range degrees { + b.Run(fmt.Sprintf("degree=%d", d), func(b *testing.B) { + i := 0 + for i < b.N { + b.StopTimer() + tr := New(d, less) + for _, v := range insertP { + tr.Set(v.Key, v.Value) + } + b.StartTimer() + for _, m := range getP { + tr.Get(m.Key) + i++ + if i >= b.N { + return + } + } + } + }) + } +} + +func BenchmarkGetWithIndex(b *testing.B) { + insertP := perm(benchmarkTreeSize) + getP := perm(benchmarkTreeSize) + for _, d := range degrees { + b.Run(fmt.Sprintf("degree=%d", d), func(b *testing.B) { + i := 0 + for i < b.N { + b.StopTimer() + tr := New(d, less) + for _, v := range insertP { + tr.Set(v.Key, v.Value) + } + b.StartTimer() + for _, m := range getP { + tr.GetWithIndex(m.Key) + i++ + if i >= b.N { + return + } + } + } + }) + } +} + +func BenchmarkGetCloneEachTime(b *testing.B) { + insertP := perm(benchmarkTreeSize) + getP := perm(benchmarkTreeSize) + for _, d := range degrees { + b.Run(fmt.Sprintf("degree=%d", d), func(b *testing.B) { + i := 0 + for i < b.N { + b.StopTimer() + tr := New(d, less) + for _, m := range insertP { + tr.Set(m.Key, m.Value) + } + b.StartTimer() + for _, m := range getP { + tr = tr.Clone() + tr.Get(m.Key) + i++ + if i >= b.N { + return + } + } + } + }) + } +} + +func BenchmarkFind(b *testing.B) { + for _, d := range degrees { + var items []item + for i := 0; i < 2*d; i++ { + items = append(items, item{i, i}) + } + b.Run(fmt.Sprintf("size=%d", len(items)), func(b *testing.B) { + for _, alg := range []struct { + name string + fun func(Key, []item) (int, bool) + }{ + {"binary", findBinary}, + {"linear", findLinear}, + } { + b.Run(alg.name, func(b *testing.B) { + for i := 0; i < b.N; i++ { + for j := 0; j < len(items); j++ { + alg.fun(items[j].key, items) + } + } + }) + } + }) + } +} + +func findBinary(k Key, s []item) (int, bool) { + i := sort.Search(len(s), func(i int) bool { return less(k, s[i].key) }) + // i is the smallest index of s for which key.Less(s[i].Key), or len(s). + if i > 0 && !less(s[i-1], k) { + return i - 1, true + } + return i, false +} + +func findLinear(k Key, s []item) (int, bool) { + var i int + for i = 0; i < len(s); i++ { + if less(k, s[i].key) { + break + } + } + if i > 0 && !less(s[i-1].key, k) { + return i - 1, true + } + return i, false +} + +type byInts []item + +func (a byInts) Len() int { + return len(a) +} + +func (a byInts) Less(i, j int) bool { + return a[i].key.(int) < a[j].key.(int) +} + +func (a byInts) Swap(i, j int) { + a[i], a[j] = a[j], a[i] +} diff --git a/vendor/cloud.google.com/go/internal/btree/btree.go b/vendor/cloud.google.com/go/internal/btree/btree.go new file mode 100644 index 000000000..60d419f5e --- /dev/null +++ b/vendor/cloud.google.com/go/internal/btree/btree.go @@ -0,0 +1,1021 @@ +// Copyright 2014 Google LLC +// Modified 2018 by Jonathan Amsterdam (jbamsterdam@gmail.com) +// +// 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 btree implements in-memory B-Trees of arbitrary degree. +// +// This implementation is based on google/btree (http://github.com/google/btree), and +// much of the code is taken from there. But the API has been changed significantly, +// particularly around iteration, and support for indexing by position has been +// added. +// +// btree implements an in-memory B-Tree for use as an ordered data structure. +// It is not meant for persistent storage solutions. +// +// It has a flatter structure than an equivalent red-black or other binary tree, +// which in some cases yields better memory usage and/or performance. +// See some discussion on the matter here: +// http://google-opensource.blogspot.com/2013/01/c-containers-that-save-memory-and-time.html +// Note, though, that this project is in no way related to the C++ B-Tree +// implementation written about there. +// +// Within this tree, each node contains a slice of items and a (possibly nil) +// slice of children. For basic numeric values or raw structs, this can cause +// efficiency differences when compared to equivalent C++ template code that +// stores values in arrays within the node: +// * Due to the overhead of storing values as interfaces (each +// value needs to be stored as the value itself, then 2 words for the +// interface pointing to that value and its type), resulting in higher +// memory use. +// * Since interfaces can point to values anywhere in memory, values are +// most likely not stored in contiguous blocks, resulting in a higher +// number of cache misses. +// These issues don't tend to matter, though, when working with strings or other +// heap-allocated structures, since C++-equivalent structures also must store +// pointers and also distribute their values across the heap. +package btree + +import ( + "fmt" + "sort" + "sync" +) + +// Key represents a key into the tree. +type Key interface{} + +// Value represents a value in the tree. +type Value interface{} + +// item is a key-value pair. +type item struct { + key Key + value Value +} + +type lessFunc func(interface{}, interface{}) bool + +// New creates a new B-Tree with the given degree and comparison function. +// +// New(2, less), for example, will create a 2-3-4 tree (each node contains 1-3 items +// and 2-4 children). +// +// The less function tests whether the current item is less than the given argument. +// It must provide a strict weak ordering. +// If !less(a, b) && !less(b, a), we treat this to mean a == b (i.e. the tree +// can hold only one of a or b). +func New(degree int, less func(interface{}, interface{}) bool) *BTree { + if degree <= 1 { + panic("bad degree") + } + return &BTree{ + degree: degree, + less: less, + cow: ©OnWriteContext{}, + } +} + +// items stores items in a node. +type items []item + +// insertAt inserts a value into the given index, pushing all subsequent values +// forward. +func (s *items) insertAt(index int, m item) { + *s = append(*s, item{}) + if index < len(*s) { + copy((*s)[index+1:], (*s)[index:]) + } + (*s)[index] = m +} + +// removeAt removes a value at a given index, pulling all subsequent values +// back. +func (s *items) removeAt(index int) item { + m := (*s)[index] + copy((*s)[index:], (*s)[index+1:]) + (*s)[len(*s)-1] = item{} + *s = (*s)[:len(*s)-1] + return m +} + +// pop removes and returns the last element in the list. +func (s *items) pop() item { + index := len(*s) - 1 + out := (*s)[index] + (*s)[index] = item{} + *s = (*s)[:index] + return out +} + +var nilItems = make(items, 16) + +// truncate truncates this instance at index so that it contains only the +// first index items. index must be less than or equal to length. +func (s *items) truncate(index int) { + var toClear items + *s, toClear = (*s)[:index], (*s)[index:] + for len(toClear) > 0 { + toClear = toClear[copy(toClear, nilItems):] + } +} + +// find returns the index where an item with key should be inserted into this +// list. 'found' is true if the item already exists in the list at the given +// index. +func (s items) find(k Key, less lessFunc) (index int, found bool) { + i := sort.Search(len(s), func(i int) bool { return less(k, s[i].key) }) + // i is the smallest index of s for which k.Less(s[i].Key), or len(s). + if i > 0 && !less(s[i-1].key, k) { + return i - 1, true + } + return i, false +} + +// children stores child nodes in a node. +type children []*node + +// insertAt inserts a value into the given index, pushing all subsequent values +// forward. +func (s *children) insertAt(index int, n *node) { + *s = append(*s, nil) + if index < len(*s) { + copy((*s)[index+1:], (*s)[index:]) + } + (*s)[index] = n +} + +// removeAt removes a value at a given index, pulling all subsequent values +// back. +func (s *children) removeAt(index int) *node { + n := (*s)[index] + copy((*s)[index:], (*s)[index+1:]) + (*s)[len(*s)-1] = nil + *s = (*s)[:len(*s)-1] + return n +} + +// pop removes and returns the last element in the list. +func (s *children) pop() (out *node) { + index := len(*s) - 1 + out = (*s)[index] + (*s)[index] = nil + *s = (*s)[:index] + return +} + +var nilChildren = make(children, 16) + +// truncate truncates this instance at index so that it contains only the +// first index children. index must be less than or equal to length. +func (s *children) truncate(index int) { + var toClear children + *s, toClear = (*s)[:index], (*s)[index:] + for len(toClear) > 0 { + toClear = toClear[copy(toClear, nilChildren):] + } +} + +// node is an internal node in a tree. +// +// It must at all times maintain the invariant that either +// * len(children) == 0, len(items) unconstrained +// * len(children) == len(items) + 1 +type node struct { + items items + children children + size int // number of items in the subtree: len(items) + sum over i of children[i].size + cow *copyOnWriteContext +} + +func (n *node) computeSize() int { + sz := len(n.items) + for _, c := range n.children { + sz += c.size + } + return sz +} + +func (n *node) checkSize() { + sz := n.computeSize() + if n.size != sz { + panic(fmt.Sprintf("n.size = %d, computed size = %d", n.size, sz)) + } +} + +func (n *node) mutableFor(cow *copyOnWriteContext) *node { + if n.cow == cow { + return n + } + out := cow.newNode() + if cap(out.items) >= len(n.items) { + out.items = out.items[:len(n.items)] + } else { + out.items = make(items, len(n.items), cap(n.items)) + } + copy(out.items, n.items) + // Copy children + if cap(out.children) >= len(n.children) { + out.children = out.children[:len(n.children)] + } else { + out.children = make(children, len(n.children), cap(n.children)) + } + copy(out.children, n.children) + out.size = n.size + return out +} + +func (n *node) mutableChild(i int) *node { + c := n.children[i].mutableFor(n.cow) + n.children[i] = c + return c +} + +// split splits the given node at the given index. The current node shrinks, +// and this function returns the item that existed at that index and a new node +// containing all items/children after it. +func (n *node) split(i int) (item, *node) { + item := n.items[i] + next := n.cow.newNode() + next.items = append(next.items, n.items[i+1:]...) + n.items.truncate(i) + if len(n.children) > 0 { + next.children = append(next.children, n.children[i+1:]...) + n.children.truncate(i + 1) + } + n.size = n.computeSize() + next.size = next.computeSize() + return item, next +} + +// maybeSplitChild checks if a child should be split, and if so splits it. +// Returns whether or not a split occurred. +func (n *node) maybeSplitChild(i, maxItems int) bool { + if len(n.children[i].items) < maxItems { + return false + } + first := n.mutableChild(i) + item, second := first.split(maxItems / 2) + n.items.insertAt(i, item) + n.children.insertAt(i+1, second) + // The size of n doesn't change. + return true +} + +// insert inserts an item into the subtree rooted at this node, making sure +// no nodes in the subtree exceed maxItems items. Should an equivalent item be +// be found/replaced by insert, its value will be returned. +// +// If computeIndex is true, the third return value is the index of the value with respect to n. +func (n *node) insert(m item, maxItems int, less lessFunc, computeIndex bool) (old Value, present bool, idx int) { + i, found := n.items.find(m.key, less) + if found { + out := n.items[i] + n.items[i] = m + if computeIndex { + idx = n.itemIndex(i) + } + return out.value, true, idx + } + if len(n.children) == 0 { + n.items.insertAt(i, m) + n.size++ + return old, false, i + } + if n.maybeSplitChild(i, maxItems) { + inTree := n.items[i] + switch { + case less(m.key, inTree.key): + // no change, we want first split node + case less(inTree.key, m.key): + i++ // we want second split node + default: + out := n.items[i] + n.items[i] = m + if computeIndex { + idx = n.itemIndex(i) + } + return out.value, true, idx + } + } + old, present, idx = n.mutableChild(i).insert(m, maxItems, less, computeIndex) + if !present { + n.size++ + } + if computeIndex { + idx += n.partialSize(i) + } + return old, present, idx +} + +// get finds the given key in the subtree and returns the corresponding item, along with a boolean reporting +// whether it was found. +// If computeIndex is true, it also returns the index of the key relative to the node's subtree. +func (n *node) get(k Key, computeIndex bool, less lessFunc) (item, bool, int) { + i, found := n.items.find(k, less) + if found { + return n.items[i], true, n.itemIndex(i) + } + if len(n.children) > 0 { + m, found, idx := n.children[i].get(k, computeIndex, less) + if computeIndex && found { + idx += n.partialSize(i) + } + return m, found, idx + } + return item{}, false, -1 +} + +// itemIndex returns the index w.r.t. n of the ith item in n. +func (n *node) itemIndex(i int) int { + if len(n.children) == 0 { + return i + } + // Get the size of the node up to but not including the child to the right of + // item i. Subtract 1 because the index is 0-based. + return n.partialSize(i+1) - 1 +} + +// Returns the size of the non-leaf node up to but not including child i. +func (n *node) partialSize(i int) int { + var sz int + for j, c := range n.children { + if j == i { + break + } + sz += c.size + 1 + } + return sz +} + +// cursorStackForKey returns a stack of cursors for the key, along with whether the key was found and the index. +func (n *node) cursorStackForKey(k Key, cs cursorStack, less lessFunc) (cursorStack, bool, int) { + i, found := n.items.find(k, less) + cs.push(cursor{n, i}) + idx := i + if found { + if len(n.children) > 0 { + idx = n.partialSize(i+1) - 1 + } + return cs, true, idx + } + if len(n.children) > 0 { + cs, found, idx := n.children[i].cursorStackForKey(k, cs, less) + return cs, found, idx + n.partialSize(i) + } + return cs, false, idx +} + +// at returns the item at the i'th position in the subtree rooted at n. +// It assumes i is in range. +func (n *node) at(i int) item { + if len(n.children) == 0 { + return n.items[i] + } + for j, c := range n.children { + if i < c.size { + return c.at(i) + } + i -= c.size + if i == 0 { + return n.items[j] + } + i-- + } + panic("impossible") +} + +// cursorStackForIndex returns a stack of cursors for the index. +// It assumes i is in range. +func (n *node) cursorStackForIndex(i int, cs cursorStack) cursorStack { + if len(n.children) == 0 { + return cs.push(cursor{n, i}) + } + for j, c := range n.children { + if i < c.size { + return c.cursorStackForIndex(i, cs.push(cursor{n, j})) + } + i -= c.size + if i == 0 { + return cs.push(cursor{n, j}) + } + i-- + } + panic("impossible") +} + +// toRemove details what item to remove in a node.remove call. +type toRemove int + +const ( + removeItem toRemove = iota // removes the given item + removeMin // removes smallest item in the subtree + removeMax // removes largest item in the subtree +) + +// remove removes an item from the subtree rooted at this node. +func (n *node) remove(key Key, minItems int, typ toRemove, less lessFunc) (item, bool) { + var i int + var found bool + switch typ { + case removeMax: + if len(n.children) == 0 { + n.size-- + return n.items.pop(), true + + } + i = len(n.items) + case removeMin: + if len(n.children) == 0 { + n.size-- + return n.items.removeAt(0), true + } + i = 0 + case removeItem: + i, found = n.items.find(key, less) + if len(n.children) == 0 { + if found { + n.size-- + return n.items.removeAt(i), true + } + return item{}, false + } + default: + panic("invalid type") + } + // If we get to here, we have children. + if len(n.children[i].items) <= minItems { + return n.growChildAndRemove(i, key, minItems, typ, less) + } + child := n.mutableChild(i) + // Either we had enough items to begin with, or we've done some + // merging/stealing, because we've got enough now and we're ready to return + // stuff. + if found { + // The item exists at index 'i', and the child we've selected can give us a + // predecessor, since if we've gotten here it's got > minItems items in it. + out := n.items[i] + // We use our special-case 'remove' call with typ=maxItem to pull the + // predecessor of item i (the rightmost leaf of our immediate left child) + // and set it into where we pulled the item from. + n.items[i], _ = child.remove(nil, minItems, removeMax, less) + n.size-- + return out, true + } + // Final recursive call. Once we're here, we know that the item isn't in this + // node and that the child is big enough to remove from. + m, removed := child.remove(key, minItems, typ, less) + if removed { + n.size-- + } + return m, removed +} + +// growChildAndRemove grows child 'i' to make sure it's possible to remove an +// item from it while keeping it at minItems, then calls remove to actually +// remove it. +// +// Most documentation says we have to do two sets of special casing: +// 1) item is in this node +// 2) item is in child +// In both cases, we need to handle the two subcases: +// A) node has enough values that it can spare one +// B) node doesn't have enough values +// For the latter, we have to check: +// a) left sibling has node to spare +// b) right sibling has node to spare +// c) we must merge +// To simplify our code here, we handle cases #1 and #2 the same: +// If a node doesn't have enough items, we make sure it does (using a,b,c). +// We then simply redo our remove call, and the second time (regardless of +// whether we're in case 1 or 2), we'll have enough items and can guarantee +// that we hit case A. +func (n *node) growChildAndRemove(i int, key Key, minItems int, typ toRemove, less lessFunc) (item, bool) { + if i > 0 && len(n.children[i-1].items) > minItems { + // Steal from left child + child := n.mutableChild(i) + stealFrom := n.mutableChild(i - 1) + stolenItem := stealFrom.items.pop() + stealFrom.size-- + child.items.insertAt(0, n.items[i-1]) + child.size++ + n.items[i-1] = stolenItem + if len(stealFrom.children) > 0 { + c := stealFrom.children.pop() + stealFrom.size -= c.size + child.children.insertAt(0, c) + child.size += c.size + } + } else if i < len(n.items) && len(n.children[i+1].items) > minItems { + // steal from right child + child := n.mutableChild(i) + stealFrom := n.mutableChild(i + 1) + stolenItem := stealFrom.items.removeAt(0) + stealFrom.size-- + child.items = append(child.items, n.items[i]) + child.size++ + n.items[i] = stolenItem + if len(stealFrom.children) > 0 { + c := stealFrom.children.removeAt(0) + stealFrom.size -= c.size + child.children = append(child.children, c) + child.size += c.size + } + } else { + if i >= len(n.items) { + i-- + } + child := n.mutableChild(i) + // merge with right child + mergeItem := n.items.removeAt(i) + mergeChild := n.children.removeAt(i + 1) + child.items = append(child.items, mergeItem) + child.items = append(child.items, mergeChild.items...) + child.children = append(child.children, mergeChild.children...) + child.size = child.computeSize() + n.cow.freeNode(mergeChild) + } + return n.remove(key, minItems, typ, less) +} + +// BTree is an implementation of a B-Tree. +// +// BTree stores item instances in an ordered structure, allowing easy insertion, +// removal, and iteration. +// +// Write operations are not safe for concurrent mutation by multiple +// goroutines, but Read operations are. +type BTree struct { + degree int + less lessFunc + root *node + cow *copyOnWriteContext +} + +// copyOnWriteContext pointers determine node ownership. A tree with a cow +// context equivalent to a node's cow context is allowed to modify that node. +// A tree whose write context does not match a node's is not allowed to modify +// it, and must create a new, writable copy (IE: it's a Clone). +// +// When doing any write operation, we maintain the invariant that the current +// node's context is equal to the context of the tree that requested the write. +// We do this by, before we descend into any node, creating a copy with the +// correct context if the contexts don't match. +// +// Since the node we're currently visiting on any write has the requesting +// tree's context, that node is modifiable in place. Children of that node may +// not share context, but before we descend into them, we'll make a mutable +// copy. +type copyOnWriteContext struct{ byte } // non-empty, because empty structs may have same addr + +// Clone clones the btree, lazily. Clone should not be called concurrently, +// but the original tree (t) and the new tree (t2) can be used concurrently +// once the Clone call completes. +// +// The internal tree structure of b is marked read-only and shared between t and +// t2. Writes to both t and t2 use copy-on-write logic, creating new nodes +// whenever one of b's original nodes would have been modified. Read operations +// should have no performance degredation. Write operations for both t and t2 +// will initially experience minor slow-downs caused by additional allocs and +// copies due to the aforementioned copy-on-write logic, but should converge to +// the original performance characteristics of the original tree. +func (t *BTree) Clone() *BTree { + // Create two entirely new copy-on-write contexts. + // This operation effectively creates three trees: + // the original, shared nodes (old b.cow) + // the new b.cow nodes + // the new out.cow nodes + cow1, cow2 := *t.cow, *t.cow + out := *t + t.cow = &cow1 + out.cow = &cow2 + return &out +} + +// maxItems returns the max number of items to allow per node. +func (t *BTree) maxItems() int { + return t.degree*2 - 1 +} + +// minItems returns the min number of items to allow per node (ignored for the +// root node). +func (t *BTree) minItems() int { + return t.degree - 1 +} + +var nodePool = sync.Pool{New: func() interface{} { return new(node) }} + +func (c *copyOnWriteContext) newNode() *node { + n := nodePool.Get().(*node) + n.cow = c + return n +} + +func (c *copyOnWriteContext) freeNode(n *node) { + if n.cow == c { + // clear to allow GC + n.items.truncate(0) + n.children.truncate(0) + n.cow = nil + nodePool.Put(n) + } +} + +// Set sets the given key to the given value in the tree. If the key is present in +// the tree, its value is changed and the old value is returned along with a second +// return value of true. If the key is not in the tree, it is added, and the second +// return value is false. +func (t *BTree) Set(k Key, v Value) (old Value, present bool) { + old, present, _ = t.set(k, v, false) + return old, present +} + +// SetWithIndex sets the given key to the given value in the tree, and returns the +// index at which it was inserted. +func (t *BTree) SetWithIndex(k Key, v Value) (old Value, present bool, index int) { + return t.set(k, v, true) +} + +func (t *BTree) set(k Key, v Value, computeIndex bool) (old Value, present bool, idx int) { + if t.root == nil { + t.root = t.cow.newNode() + t.root.items = append(t.root.items, item{k, v}) + t.root.size = 1 + return old, false, 0 + } + t.root = t.root.mutableFor(t.cow) + if len(t.root.items) >= t.maxItems() { + sz := t.root.size + item2, second := t.root.split(t.maxItems() / 2) + oldroot := t.root + t.root = t.cow.newNode() + t.root.items = append(t.root.items, item2) + t.root.children = append(t.root.children, oldroot, second) + t.root.size = sz + } + + return t.root.insert(item{k, v}, t.maxItems(), t.less, computeIndex) +} + +// Delete removes the item with the given key, returning its value. The second return value +// reports whether the key was found. +func (t *BTree) Delete(k Key) (Value, bool) { + m, removed := t.deleteItem(k, removeItem) + return m.value, removed +} + +// DeleteMin removes the smallest item in the tree and returns its key and value. +// If the tree is empty, it returns zero values. +func (t *BTree) DeleteMin() (Key, Value) { + item, _ := t.deleteItem(nil, removeMin) + return item.key, item.value +} + +// DeleteMax removes the largest item in the tree and returns its key and value. +// If the tree is empty, it returns zero values. +func (t *BTree) DeleteMax() (Key, Value) { + item, _ := t.deleteItem(nil, removeMax) + return item.key, item.value +} + +func (t *BTree) deleteItem(key Key, typ toRemove) (item, bool) { + if t.root == nil || len(t.root.items) == 0 { + return item{}, false + } + t.root = t.root.mutableFor(t.cow) + out, removed := t.root.remove(key, t.minItems(), typ, t.less) + if len(t.root.items) == 0 && len(t.root.children) > 0 { + oldroot := t.root + t.root = t.root.children[0] + t.cow.freeNode(oldroot) + } + return out, removed +} + +// Get returns the value for the given key in the tree, or the zero value if the +// key is not in the tree. +// +// To distinguish a zero value from a key that is not present, use GetWithIndex. +func (t *BTree) Get(k Key) Value { + var z Value + if t.root == nil { + return z + } + item, ok, _ := t.root.get(k, false, t.less) + if !ok { + return z + } + return item.value +} + +// GetWithIndex returns the value and index for the given key in the tree, or the +// zero value and -1 if the key is not in the tree. +func (t *BTree) GetWithIndex(k Key) (Value, int) { + var z Value + if t.root == nil { + return z, -1 + } + item, _, index := t.root.get(k, true, t.less) + return item.value, index +} + +// At returns the key and value at index i. The minimum item has index 0. +// If i is outside the range [0, t.Len()), At panics. +func (t *BTree) At(i int) (Key, Value) { + if i < 0 || i >= t.Len() { + panic("btree: index out of range") + } + item := t.root.at(i) + return item.key, item.value +} + +// Has reports whether the given key is in the tree. +func (t *BTree) Has(k Key) bool { + if t.root == nil { + return false + } + _, ok, _ := t.root.get(k, false, t.less) + return ok +} + +// Min returns the smallest key in the tree and its value. If the tree is empty, it +// returns zero values. +func (t *BTree) Min() (Key, Value) { + var k Key + var v Value + if t.root == nil { + return k, v + } + n := t.root + for len(n.children) > 0 { + n = n.children[0] + } + if len(n.items) == 0 { + return k, v + } + return n.items[0].key, n.items[0].value +} + +// Max returns the largest key in the tree and its value. If the tree is empty, both +// return values are zero values. +func (t *BTree) Max() (Key, Value) { + var k Key + var v Value + if t.root == nil { + return k, v + } + n := t.root + for len(n.children) > 0 { + n = n.children[len(n.children)-1] + } + if len(n.items) == 0 { + return k, v + } + m := n.items[len(n.items)-1] + return m.key, m.value +} + +// Len returns the number of items currently in the tree. +func (t *BTree) Len() int { + if t.root == nil { + return 0 + } + return t.root.size +} + +// Before returns an iterator positioned just before k. After the first call to Next, +// the Iterator will be at k, or at the key just greater than k if k is not in the tree. +// Subsequent calls to Next will traverse the tree's items in ascending order. +func (t *BTree) Before(k Key) *Iterator { + if t.root == nil { + return &Iterator{} + } + var cs cursorStack + cs, found, idx := t.root.cursorStackForKey(k, cs, t.less) + // If we found the key, the cursor stack is pointing to it. Since that is + // the first element we want, don't advance the iterator on the initial call to Next. + // If we haven't found the key, then the top of the cursor stack is either pointing at the + // item just after k, in which case we do not want to move the iterator; or the index + // is past the end of the items slice, in which case we do. + var stay bool + top := cs[len(cs)-1] + if found { + stay = true + } else if top.index < len(top.node.items) { + stay = true + } else { + idx-- + } + return &Iterator{ + cursors: cs, + stay: stay, + descending: false, + Index: idx, + } +} + +// After returns an iterator positioned just after k. After the first call to Next, +// the Iterator will be at k, or at the key just less than k if k is not in the tree. +// Subsequent calls to Next will traverse the tree's items in descending order. +func (t *BTree) After(k Key) *Iterator { + if t.root == nil { + return &Iterator{} + } + var cs cursorStack + cs, found, idx := t.root.cursorStackForKey(k, cs, t.less) + // If we found the key, the cursor stack is pointing to it. Since that is + // the first element we want, don't advance the iterator on the initial call to Next. + // If we haven't found the key, the cursor stack is pointing just after the first item, + // so we do want to advance. + return &Iterator{ + cursors: cs, + stay: found, + descending: true, + Index: idx, + } +} + +// BeforeIndex returns an iterator positioned just before the item with the given index. +// The iterator will traverse the tree's items in ascending order. +// If i is not in the range [0, tr.Len()], BeforeIndex panics. +// Note that it is not an error to provide an index of tr.Len(). +func (t *BTree) BeforeIndex(i int) *Iterator { + return t.indexIterator(i, false) +} + +// AfterIndex returns an iterator positioned just after the item with the given index. +// The iterator will traverse the tree's items in descending order. +// If i is not in the range [0, tr.Len()], AfterIndex panics. +// Note that it is not an error to provide an index of tr.Len(). +func (t *BTree) AfterIndex(i int) *Iterator { + return t.indexIterator(i, true) +} + +func (t *BTree) indexIterator(i int, descending bool) *Iterator { + if i < 0 || i > t.Len() { + panic("btree: index out of range") + } + if i == t.Len() { + return &Iterator{} + } + var cs cursorStack + return &Iterator{ + cursors: t.root.cursorStackForIndex(i, cs), + stay: true, + descending: descending, + Index: i, + } +} + +// An Iterator supports traversing the items in the tree. +type Iterator struct { + Key Key + Value Value + // Index is the position of the item in the tree viewed as a sequence. + // The minimum item has index zero. + Index int + + cursors cursorStack // stack of nodes with indices; last element is the top + stay bool // don't do anything on the first call to Next. + descending bool // traverse the items in descending order +} + +// Next advances the Iterator to the next item in the tree. If Next returns true, +// the Iterator's Key, Value and Index fields refer to the next item. If Next returns +// false, there are no more items and the values of Key, Value and Index are undefined. +// +// If the tree is modified during iteration, the behavior is undefined. +func (it *Iterator) Next() bool { + var more bool + switch { + case len(it.cursors) == 0: + more = false + case it.stay: + it.stay = false + more = true + case it.descending: + more = it.dec() + default: + more = it.inc() + } + if !more { + return false + } + top := it.cursors[len(it.cursors)-1] + item := top.node.items[top.index] + it.Key = item.key + it.Value = item.value + return true +} + +// When inc returns true, the top cursor on the stack refers to the new current item. +func (it *Iterator) inc() bool { + // Useful invariants for understanding this function: + // - Leaf nodes have zero children, and zero or more items. + // - Nonleaf nodes have one more child than item, and children[i] < items[i] < children[i+1]. + // - The current item in the iterator is top.node.items[top.index]. + + it.Index++ + // If we are at a non-leaf node, the current item is items[i], so + // now we want to continue with children[i+1], which must exist + // by the node invariant. We want the minimum item in that child's subtree. + top := it.cursors.incTop(1) + for len(top.node.children) > 0 { + top = cursor{top.node.children[top.index], 0} + it.cursors.push(top) + } + // Here, we are at a leaf node. top.index points to + // the new current item, if it's within the items slice. + for top.index >= len(top.node.items) { + // We've gone through everything in this node. Pop it off the stack. + it.cursors.pop() + // If the stack is now empty,we're past the last item in the tree. + if it.cursors.empty() { + return false + } + top = it.cursors.top() + // The new top's index points to a child, which we've just finished + // exploring. The next item is the one at the same index in the items slice. + } + // Here, the top cursor on the stack points to the new current item. + return true +} + +func (it *Iterator) dec() bool { + // See the invariants for inc, above. + it.Index-- + top := it.cursors.top() + // If we are at a non-leaf node, the current item is items[i], so + // now we want to continue with children[i]. We want the maximum item in that child's subtree. + for len(top.node.children) > 0 { + c := top.node.children[top.index] + top = cursor{c, len(c.items)} + it.cursors.push(top) + } + top = it.cursors.incTop(-1) + // Here, we are at a leaf node. top.index points to + // the new current item, if it's within the items slice. + for top.index < 0 { + // We've gone through everything in this node. Pop it off the stack. + it.cursors.pop() + // If the stack is now empty,we're past the last item in the tree. + if it.cursors.empty() { + return false + } + // The new top's index points to a child, which we've just finished + // exploring. That child is to the right of the item we want to advance to, + // so decrement the index. + top = it.cursors.incTop(-1) + } + return true +} + +// A cursor is effectively a pointer into a node. A stack of cursors identifies an item in the tree, +// and makes it possible to move to the next or previous item efficiently. +// +// If the cursor is on the top of the stack, its index points into the node's items slice, selecting +// the current item. Otherwise, the index points into the children slice and identifies the child +// that is next in the stack. +type cursor struct { + node *node + index int +} + +// A cursorStack is a stack of cursors, representing a path of nodes from the root of the tree. +type cursorStack []cursor + +func (s *cursorStack) push(c cursor) cursorStack { + *s = append(*s, c) + return *s +} + +func (s *cursorStack) pop() cursor { + last := len(*s) - 1 + t := (*s)[last] + *s = (*s)[:last] + return t +} + +func (s *cursorStack) top() cursor { + return (*s)[len(*s)-1] +} + +func (s *cursorStack) empty() bool { + return len(*s) == 0 +} + +// incTop increments top's index by n and returns it. +func (s *cursorStack) incTop(n int) cursor { + (*s)[len(*s)-1].index += n // Don't call top: modify the original, not a copy. + return s.top() +} diff --git a/vendor/cloud.google.com/go/internal/btree/btree_test.go b/vendor/cloud.google.com/go/internal/btree/btree_test.go new file mode 100644 index 000000000..4e550355a --- /dev/null +++ b/vendor/cloud.google.com/go/internal/btree/btree_test.go @@ -0,0 +1,422 @@ +// Copyright 2014 Google LLC +// Modified 2018 by Jonathan Amsterdam (jbamsterdam@gmail.com) +// +// 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 btree + +import ( + "flag" + "fmt" + "math/rand" + "os" + "sort" + "sync" + "testing" + "time" + + "github.com/google/go-cmp/cmp" +) + +func init() { + seed := time.Now().Unix() + fmt.Println(seed) + rand.Seed(seed) +} + +type itemWithIndex struct { + Key Key + Value Value + Index int +} + +// perm returns a random permutation of n Int items in the range [0, n). +func perm(n int) []itemWithIndex { + var out []itemWithIndex + for _, v := range rand.Perm(n) { + out = append(out, itemWithIndex{v, v, v}) + } + return out +} + +// rang returns an ordered list of Int items in the range [0, n). +func rang(n int) []itemWithIndex { + var out []itemWithIndex + for i := 0; i < n; i++ { + out = append(out, itemWithIndex{i, i, i}) + } + return out +} + +// all extracts all items from an iterator. +func all(it *Iterator) []itemWithIndex { + var out []itemWithIndex + for it.Next() { + out = append(out, itemWithIndex{it.Key, it.Value, it.Index}) + } + return out +} + +// rangerev returns a reversed ordered list of Int items in the range [0, n). +func rangrev(n int) []itemWithIndex { + var out []itemWithIndex + for i := n - 1; i >= 0; i-- { + out = append(out, itemWithIndex{i, i, i}) + } + return out +} + +func reverse(s []itemWithIndex) { + for i := 0; i < len(s)/2; i++ { + s[i], s[len(s)-i-1] = s[len(s)-i-1], s[i] + } +} + +var btreeDegree = flag.Int("degree", 32, "B-Tree degree") + +func TestBTree(t *testing.T) { + tr := New(*btreeDegree, less) + const treeSize = 10000 + for i := 0; i < 10; i++ { + if min, _ := tr.Min(); min != nil { + t.Fatalf("empty min, got %+v", min) + } + if max, _ := tr.Max(); max != nil { + t.Fatalf("empty max, got %+v", max) + } + for _, m := range perm(treeSize) { + if _, ok := tr.Set(m.Key, m.Value); ok { + t.Fatal("set found item", m) + } + } + for _, m := range perm(treeSize) { + _, ok, idx := tr.SetWithIndex(m.Key, m.Value) + if !ok { + t.Fatal("set didn't find item", m) + } + if idx != m.Index { + t.Fatalf("got index %d, want %d", idx, m.Index) + } + } + mink, minv := tr.Min() + if want := 0; mink != want || minv != want { + t.Fatalf("min: want %+v, got %+v, %+v", want, mink, minv) + } + maxk, maxv := tr.Max() + if want := treeSize - 1; maxk != want || maxv != want { + t.Fatalf("max: want %+v, got %+v, %+v", want, maxk, maxv) + } + got := all(tr.BeforeIndex(0)) + want := rang(treeSize) + if !cmp.Equal(got, want) { + t.Fatalf("mismatch:\n got: %v\nwant: %v", got, want) + } + + for _, m := range perm(treeSize) { + if _, removed := tr.Delete(m.Key); !removed { + t.Fatalf("didn't find %v", m) + } + } + if got = all(tr.BeforeIndex(0)); len(got) > 0 { + t.Fatalf("some left!: %v", got) + } + } +} + +func TestAt(t *testing.T) { + tr := New(*btreeDegree, less) + for _, m := range perm(100) { + tr.Set(m.Key, m.Value) + } + for i := 0; i < tr.Len(); i++ { + gotk, gotv := tr.At(i) + if want := i; gotk != want || gotv != want { + t.Fatalf("At(%d) = (%v, %v), want (%v, %v)", i, gotk, gotv, want, want) + } + } +} + +func TestGetWithIndex(t *testing.T) { + tr := New(*btreeDegree, less) + for _, m := range perm(100) { + tr.Set(m.Key, m.Value) + } + for i := 0; i < tr.Len(); i++ { + gotv, goti := tr.GetWithIndex(i) + wantv, wanti := i, i + if gotv != wantv || goti != wanti { + t.Errorf("GetWithIndex(%d) = (%v, %v), want (%v, %v)", + i, gotv, goti, wantv, wanti) + } + } + _, got := tr.GetWithIndex(100) + if want := -1; got != want { + t.Errorf("got %d, want %d", got, want) + } +} + +func TestSetWithIndex(t *testing.T) { + tr := New(4, less) // use a small degree to cover more cases + var contents []int + for _, m := range perm(100) { + _, _, idx := tr.SetWithIndex(m.Key, m.Value) + contents = append(contents, m.Index) + sort.Ints(contents) + want := -1 + for i, c := range contents { + if c == m.Index { + want = i + break + } + } + if idx != want { + t.Fatalf("got %d, want %d", idx, want) + } + } +} + +func TestDeleteMin(t *testing.T) { + tr := New(3, less) + for _, m := range perm(100) { + tr.Set(m.Key, m.Value) + } + var got []itemWithIndex + for i := 0; tr.Len() > 0; i++ { + k, v := tr.DeleteMin() + got = append(got, itemWithIndex{k, v, i}) + } + if want := rang(100); !cmp.Equal(got, want) { + t.Fatalf("got: %v\nwant: %v", got, want) + } +} + +func TestDeleteMax(t *testing.T) { + tr := New(3, less) + for _, m := range perm(100) { + tr.Set(m.Key, m.Value) + } + var got []itemWithIndex + for tr.Len() > 0 { + k, v := tr.DeleteMax() + got = append(got, itemWithIndex{k, v, tr.Len()}) + } + reverse(got) + if want := rang(100); !cmp.Equal(got, want) { + t.Fatalf("got: %v\nwant: %v", got, want) + } +} + +func TestIterator(t *testing.T) { + const size = 10 + + tr := New(2, less) + // Empty tree. + for i, it := range []*Iterator{ + tr.BeforeIndex(0), + tr.Before(3), + tr.After(3), + } { + if got, want := it.Next(), false; got != want { + t.Errorf("empty, #%d: got %t, want %t", i, got, want) + } + } + + // Root with zero children. + tr.Set(1, nil) + tr.Delete(1) + if !(tr.root != nil && len(tr.root.children) == 0 && len(tr.root.items) == 0) { + t.Fatal("wrong shape tree") + } + for i, it := range []*Iterator{ + tr.BeforeIndex(0), + tr.Before(3), + tr.After(3), + } { + if got, want := it.Next(), false; got != want { + t.Errorf("zero root, #%d: got %t, want %t", i, got, want) + } + } + + // Tree with size elements. + p := perm(size) + for _, v := range p { + tr.Set(v.Key, v.Value) + } + + it := tr.BeforeIndex(0) + got := all(it) + want := rang(size) + if !cmp.Equal(got, want) { + t.Fatalf("got %+v\nwant %+v\n", got, want) + } + + for i, w := range want { + it := tr.Before(w.Key) + got = all(it) + wn := want[w.Key.(int):] + if !cmp.Equal(got, wn) { + t.Fatalf("got %+v\nwant %+v\n", got, wn) + } + + it = tr.BeforeIndex(i) + got = all(it) + if !cmp.Equal(got, wn) { + t.Fatalf("got %+v\nwant %+v\n", got, wn) + } + + it = tr.After(w.Key) + got = all(it) + wn = append([]itemWithIndex(nil), want[:w.Key.(int)+1]...) + reverse(wn) + if !cmp.Equal(got, wn) { + t.Fatalf("got %+v\nwant %+v\n", got, wn) + } + + it = tr.AfterIndex(i) + got = all(it) + if !cmp.Equal(got, wn) { + t.Fatalf("got %+v\nwant %+v\n", got, wn) + } + } + + // Non-existent keys. + tr = New(2, less) + for _, v := range p { + tr.Set(v.Key.(int)*2, v.Value) + } + // tr has only even keys: 0, 2, 4, ... Iterate from odd keys. + for i := -1; i <= size+1; i += 2 { + it := tr.Before(i) + got := all(it) + var want []itemWithIndex + for j := (i + 1) / 2; j < size; j++ { + want = append(want, itemWithIndex{j * 2, j, j}) + } + if !cmp.Equal(got, want) { + tr.print(os.Stdout) + t.Fatalf("%d: got %+v\nwant %+v\n", i, got, want) + } + + it = tr.After(i) + got = all(it) + want = nil + for j := (i - 1) / 2; j >= 0; j-- { + want = append(want, itemWithIndex{j * 2, j, j}) + } + if !cmp.Equal(got, want) { + t.Fatalf("%d: got %+v\nwant %+v\n", i, got, want) + } + } +} + +func TestMixed(t *testing.T) { + // Test random, mixed insertions and deletions. + const maxSize = 1000 + tr := New(3, less) + has := map[int]bool{} + for i := 0; i < 10000; i++ { + r := rand.Intn(maxSize) + if r >= tr.Len() { + old, ok := tr.Set(r, r) + if has[r] != ok { + t.Fatalf("%d: has=%t, ok=%t", r, has[r], ok) + } + if ok && old.(int) != r { + t.Fatalf("%d: bad old", r) + } + has[r] = true + if got, want := tr.Get(r), r; got != want { + t.Fatalf("Get(%d) = %d, want %d", r, got, want) + } + } else { + // Expoit random map iteration order. + var d int + for d = range has { + break + } + old, removed := tr.Delete(d) + if !removed { + t.Fatalf("%d not found", d) + } + if old.(int) != d { + t.Fatalf("%d: bad old", d) + } + delete(has, d) + } + } +} + +const cloneTestSize = 10000 + +func cloneTest(t *testing.T, b *BTree, start int, p []itemWithIndex, wg *sync.WaitGroup, treec chan<- *BTree) { + treec <- b + for i := start; i < cloneTestSize; i++ { + b.Set(p[i].Key, p[i].Value) + if i%(cloneTestSize/5) == 0 { + wg.Add(1) + go cloneTest(t, b.Clone(), i+1, p, wg, treec) + } + } + wg.Done() +} + +func TestCloneConcurrentOperations(t *testing.T) { + b := New(*btreeDegree, less) + treec := make(chan *BTree) + p := perm(cloneTestSize) + var wg sync.WaitGroup + wg.Add(1) + go cloneTest(t, b, 0, p, &wg, treec) + var trees []*BTree + donec := make(chan struct{}) + go func() { + for t := range treec { + trees = append(trees, t) + } + close(donec) + }() + wg.Wait() + close(treec) + <-donec + want := rang(cloneTestSize) + for i, tree := range trees { + if !cmp.Equal(want, all(tree.BeforeIndex(0))) { + t.Errorf("tree %v mismatch", i) + } + } + toRemove := rang(cloneTestSize)[cloneTestSize/2:] + for i := 0; i < len(trees)/2; i++ { + tree := trees[i] + wg.Add(1) + go func() { + for _, m := range toRemove { + tree.Delete(m.Key) + } + wg.Done() + }() + } + wg.Wait() + for i, tree := range trees { + var wantpart []itemWithIndex + if i < len(trees)/2 { + wantpart = want[:cloneTestSize/2] + } else { + wantpart = want + } + if got := all(tree.BeforeIndex(0)); !cmp.Equal(wantpart, got) { + t.Errorf("tree %v mismatch, want %v got %v", i, len(want), len(got)) + } + } +} + +func less(a, b interface{}) bool { return a.(int) < b.(int) } diff --git a/vendor/cloud.google.com/go/internal/btree/debug.go b/vendor/cloud.google.com/go/internal/btree/debug.go new file mode 100644 index 000000000..e8a54df36 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/btree/debug.go @@ -0,0 +1,37 @@ +// 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 btree + +import ( + "fmt" + "io" + "strings" +) + +func (t *BTree) print(w io.Writer) { + t.root.print(w, 0) +} + +func (n *node) print(w io.Writer, level int) { + indent := strings.Repeat(" ", level) + if n == nil { + fmt.Fprintf(w, "%s\n", indent) + return + } + fmt.Fprintf(w, "%s%v\n", indent, n.items) + for _, c := range n.children { + c.print(w, level+1) + } +} diff --git a/vendor/cloud.google.com/go/internal/fields/fields.go b/vendor/cloud.google.com/go/internal/fields/fields.go new file mode 100644 index 000000000..05f95eabc --- /dev/null +++ b/vendor/cloud.google.com/go/internal/fields/fields.go @@ -0,0 +1,480 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package fields provides a view of the fields of a struct that follows the Go +// rules, amended to consider tags and case insensitivity. +// +// Usage +// +// First define a function that interprets tags: +// +// func parseTag(st reflect.StructTag) (name string, keep bool, other interface{}, err error) { ... } +// +// The function's return values describe whether to ignore the field +// completely or provide an alternate name, as well as other data from the +// parse that is stored to avoid re-parsing. +// +// Then define a function to validate the type: +// +// func validate(t reflect.Type) error { ... } +// +// Then, if necessary, define a function to specify leaf types - types +// which should be considered one field and not be recursed into: +// +// func isLeafType(t reflect.Type) bool { ... } +// +// eg: +// +// func isLeafType(t reflect.Type) bool { +// return t == reflect.TypeOf(time.Time{}) +// } +// +// Next, construct a Cache, passing your functions. As its name suggests, a +// Cache remembers validation and field information for a type, so subsequent +// calls with the same type are very fast. +// +// cache := fields.NewCache(parseTag, validate, isLeafType) +// +// To get the fields of a struct type as determined by the above rules, call +// the Fields method: +// +// fields, err := cache.Fields(reflect.TypeOf(MyStruct{})) +// +// The return value can be treated as a slice of Fields. +// +// Given a string, such as a key or column name obtained during unmarshalling, +// call Match on the list of fields to find a field whose name is the best +// match: +// +// field := fields.Match(name) +// +// Match looks for an exact match first, then falls back to a case-insensitive +// comparison. +package fields + +import ( + "bytes" + "errors" + "reflect" + "sort" + "strings" + "sync" +) + +// A Field records information about a struct field. +type Field struct { + Name string // effective field name + NameFromTag bool // did Name come from a tag? + Type reflect.Type // field type + Index []int // index sequence, for reflect.Value.FieldByIndex + ParsedTag interface{} // third return value of the parseTag function + + nameBytes []byte + equalFold func(s, t []byte) bool +} + +// ParseTagFunc is a function that accepts a struct tag and returns four values: an alternative name for the field +// extracted from the tag, a boolean saying whether to keep the field or ignore it, additional data that is stored +// with the field information to avoid having to parse the tag again, and an error. +type ParseTagFunc func(reflect.StructTag) (name string, keep bool, other interface{}, err error) + +// ValidateFunc is a function that accepts a reflect.Type and returns an error if the struct type is invalid in any +// way. +type ValidateFunc func(reflect.Type) error + +// LeafTypesFunc is a function that accepts a reflect.Type and returns true if the struct type a leaf, or false if not. +// TODO(deklerk) is this description accurate? +type LeafTypesFunc func(reflect.Type) bool + +// A Cache records information about the fields of struct types. +// +// A Cache is safe for use by multiple goroutines. +type Cache struct { + parseTag ParseTagFunc + validate ValidateFunc + leafTypes LeafTypesFunc + cache sync.Map // from reflect.Type to cacheValue +} + +// NewCache constructs a Cache. +// +// Its first argument should be a function that accepts +// a struct tag and returns four values: an alternative name for the field +// extracted from the tag, a boolean saying whether to keep the field or ignore +// it, additional data that is stored with the field information to avoid +// having to parse the tag again, and an error. +// +// Its second argument should be a function that accepts a reflect.Type and +// returns an error if the struct type is invalid in any way. For example, it +// may check that all of the struct field tags are valid, or that all fields +// are of an appropriate type. +func NewCache(parseTag ParseTagFunc, validate ValidateFunc, leafTypes LeafTypesFunc) *Cache { + if parseTag == nil { + parseTag = func(reflect.StructTag) (string, bool, interface{}, error) { + return "", true, nil, nil + } + } + if validate == nil { + validate = func(reflect.Type) error { + return nil + } + } + if leafTypes == nil { + leafTypes = func(reflect.Type) bool { + return false + } + } + + return &Cache{ + parseTag: parseTag, + validate: validate, + leafTypes: leafTypes, + } +} + +// A fieldScan represents an item on the fieldByNameFunc scan work list. +type fieldScan struct { + typ reflect.Type + index []int +} + +// Fields returns all the exported fields of t, which must be a struct type. It +// follows the standard Go rules for embedded fields, modified by the presence +// of tags. The result is sorted lexicographically by index. +// +// These rules apply in the absence of tags: +// Anonymous struct fields are treated as if their inner exported fields were +// fields in the outer struct (embedding). The result includes all fields that +// aren't shadowed by fields at higher level of embedding. If more than one +// field with the same name exists at the same level of embedding, it is +// excluded. An anonymous field that is not of struct type is treated as having +// its type as its name. +// +// Tags modify these rules as follows: +// A field's tag is used as its name. +// An anonymous struct field with a name given in its tag is treated as +// a field having that name, rather than an embedded struct (the struct's +// fields will not be returned). +// If more than one field with the same name exists at the same level of embedding, +// but exactly one of them is tagged, then the tagged field is reported and the others +// are ignored. +func (c *Cache) Fields(t reflect.Type) (List, error) { + if t.Kind() != reflect.Struct { + panic("fields: Fields of non-struct type") + } + return c.cachedTypeFields(t) +} + +// A List is a list of Fields. +type List []Field + +// Match returns the field in the list whose name best matches the supplied +// name, nor nil if no field does. If there is a field with the exact name, it +// is returned. Otherwise the first field (sorted by index) whose name matches +// case-insensitively is returned. +func (l List) Match(name string) *Field { + return l.MatchBytes([]byte(name)) +} + +// MatchBytes is identical to Match, except that the argument is a byte slice. +func (l List) MatchBytes(name []byte) *Field { + var f *Field + for i := range l { + ff := &l[i] + if bytes.Equal(ff.nameBytes, name) { + return ff + } + if f == nil && ff.equalFold(ff.nameBytes, name) { + f = ff + } + } + return f +} + +type cacheValue struct { + fields List + err error +} + +// cachedTypeFields is like typeFields but uses a cache to avoid repeated work. +// This code has been copied and modified from +// https://go.googlesource.com/go/+/go1.7.3/src/encoding/json/encode.go. +func (c *Cache) cachedTypeFields(t reflect.Type) (List, error) { + var cv cacheValue + x, ok := c.cache.Load(t) + if ok { + cv = x.(cacheValue) + } else { + if err := c.validate(t); err != nil { + cv = cacheValue{nil, err} + } else { + f, err := c.typeFields(t) + cv = cacheValue{List(f), err} + } + c.cache.Store(t, cv) + } + return cv.fields, cv.err +} + +func (c *Cache) typeFields(t reflect.Type) ([]Field, error) { + fields, err := c.listFields(t) + if err != nil { + return nil, err + } + sort.Sort(byName(fields)) + // Delete all fields that are hidden by the Go rules for embedded fields. + + // The fields are sorted in primary order of name, secondary order of field + // index length. So the first field with a given name is the dominant one. + var out []Field + for advance, i := 0, 0; i < len(fields); i += advance { + // One iteration per name. + // Find the sequence of fields with the name of this first field. + fi := fields[i] + name := fi.Name + for advance = 1; i+advance < len(fields); advance++ { + fj := fields[i+advance] + if fj.Name != name { + break + } + } + // Find the dominant field, if any, out of all fields that have the same name. + dominant, ok := dominantField(fields[i : i+advance]) + if ok { + out = append(out, dominant) + } + } + sort.Sort(byIndex(out)) + return out, nil +} + +func (c *Cache) listFields(t reflect.Type) ([]Field, error) { + // This uses the same condition that the Go language does: there must be a unique instance + // of the match at a given depth level. If there are multiple instances of a match at the + // same depth, they annihilate each other and inhibit any possible match at a lower level. + // The algorithm is breadth first search, one depth level at a time. + + // The current and next slices are work queues: + // current lists the fields to visit on this depth level, + // and next lists the fields on the next lower level. + current := []fieldScan{} + next := []fieldScan{{typ: t}} + + // nextCount records the number of times an embedded type has been + // encountered and considered for queueing in the 'next' slice. + // We only queue the first one, but we increment the count on each. + // If a struct type T can be reached more than once at a given depth level, + // then it annihilates itself and need not be considered at all when we + // process that next depth level. + var nextCount map[reflect.Type]int + + // visited records the structs that have been considered already. + // Embedded pointer fields can create cycles in the graph of + // reachable embedded types; visited avoids following those cycles. + // It also avoids duplicated effort: if we didn't find the field in an + // embedded type T at level 2, we won't find it in one at level 4 either. + visited := map[reflect.Type]bool{} + + var fields []Field // Fields found. + + for len(next) > 0 { + current, next = next, current[:0] + count := nextCount + nextCount = nil + + // Process all the fields at this depth, now listed in 'current'. + // The loop queues embedded fields found in 'next', for processing during the next + // iteration. The multiplicity of the 'current' field counts is recorded + // in 'count'; the multiplicity of the 'next' field counts is recorded in 'nextCount'. + for _, scan := range current { + t := scan.typ + if visited[t] { + // We've looked through this type before, at a higher level. + // That higher level would shadow the lower level we're now at, + // so this one can't be useful to us. Ignore it. + continue + } + visited[t] = true + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + + exported := (f.PkgPath == "") + + // If a named field is unexported, ignore it. An anonymous + // unexported field is processed, because it may contain + // exported fields, which are visible. + if !exported && !f.Anonymous { + continue + } + + // Examine the tag. + tagName, keep, other, err := c.parseTag(f.Tag) + if err != nil { + return nil, err + } + if !keep { + continue + } + if c.leafTypes(f.Type) { + fields = append(fields, newField(f, tagName, other, scan.index, i)) + continue + } + + var ntyp reflect.Type + if f.Anonymous { + // Anonymous field of type T or *T. + ntyp = f.Type + if ntyp.Kind() == reflect.Ptr { + ntyp = ntyp.Elem() + } + } + + // Record fields with a tag name, non-anonymous fields, or + // anonymous non-struct fields. + if tagName != "" || ntyp == nil || ntyp.Kind() != reflect.Struct { + if !exported { + continue + } + fields = append(fields, newField(f, tagName, other, scan.index, i)) + if count[t] > 1 { + // If there were multiple instances, add a second, + // so that the annihilation code will see a duplicate. + fields = append(fields, fields[len(fields)-1]) + } + continue + } + + // Queue embedded struct fields for processing with next level, + // but only if the embedded types haven't already been queued. + if nextCount[ntyp] > 0 { + nextCount[ntyp] = 2 // exact multiple doesn't matter + continue + } + if nextCount == nil { + nextCount = map[reflect.Type]int{} + } + nextCount[ntyp] = 1 + if count[t] > 1 { + nextCount[ntyp] = 2 // exact multiple doesn't matter + } + var index []int + index = append(index, scan.index...) + index = append(index, i) + next = append(next, fieldScan{ntyp, index}) + } + } + } + return fields, nil +} + +func newField(f reflect.StructField, tagName string, other interface{}, index []int, i int) Field { + name := tagName + if name == "" { + name = f.Name + } + sf := Field{ + Name: name, + NameFromTag: tagName != "", + Type: f.Type, + ParsedTag: other, + nameBytes: []byte(name), + } + sf.equalFold = foldFunc(sf.nameBytes) + sf.Index = append(sf.Index, index...) + sf.Index = append(sf.Index, i) + return sf +} + +// byName sorts fields using the following criteria, in order: +// 1. name +// 2. embedding depth +// 3. tag presence (preferring a tagged field) +// 4. index sequence. +type byName []Field + +func (x byName) Len() int { return len(x) } + +func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byName) Less(i, j int) bool { + if x[i].Name != x[j].Name { + return x[i].Name < x[j].Name + } + if len(x[i].Index) != len(x[j].Index) { + return len(x[i].Index) < len(x[j].Index) + } + if x[i].NameFromTag != x[j].NameFromTag { + return x[i].NameFromTag + } + return byIndex(x).Less(i, j) +} + +// byIndex sorts field by index sequence. +type byIndex []Field + +func (x byIndex) Len() int { return len(x) } + +func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byIndex) Less(i, j int) bool { + xi := x[i].Index + xj := x[j].Index + ln := len(xi) + if l := len(xj); l < ln { + ln = l + } + for k := 0; k < ln; k++ { + if xi[k] != xj[k] { + return xi[k] < xj[k] + } + } + return len(xi) < len(xj) +} + +// dominantField looks through the fields, all of which are known to have the +// same name, to find the single field that dominates the others using Go's +// embedding rules, modified by the presence of tags. If there are multiple +// top-level fields, the boolean will be false: This condition is an error in +// Go and we skip all the fields. +func dominantField(fs []Field) (Field, bool) { + // The fields are sorted in increasing index-length order, then by presence of tag. + // That means that the first field is the dominant one. We need only check + // for error cases: two fields at top level, either both tagged or neither tagged. + if len(fs) > 1 && len(fs[0].Index) == len(fs[1].Index) && fs[0].NameFromTag == fs[1].NameFromTag { + return Field{}, false + } + return fs[0], true +} + +// ParseStandardTag extracts the sub-tag named by key, then parses it using the +// de facto standard format introduced in encoding/json: +// "-" means "ignore this tag". It must occur by itself. (parseStandardTag returns an error +// in this case, whereas encoding/json accepts the "-" even if it is not alone.) +// "" provides an alternative name for the field +// ",opt1,opt2,..." specifies options after the name. +// The options are returned as a []string. +func ParseStandardTag(key string, t reflect.StructTag) (name string, keep bool, options []string, err error) { + s := t.Get(key) + parts := strings.Split(s, ",") + if parts[0] == "-" { + if len(parts) > 1 { + return "", false, nil, errors.New(`"-" field tag with options`) + } + return "", false, nil, nil + } + if len(parts) > 1 { + options = parts[1:] + } + return parts[0], true, options, nil +} diff --git a/vendor/cloud.google.com/go/internal/fields/fields_test.go b/vendor/cloud.google.com/go/internal/fields/fields_test.go new file mode 100644 index 000000000..6ef5a513d --- /dev/null +++ b/vendor/cloud.google.com/go/internal/fields/fields_test.go @@ -0,0 +1,562 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package fields + +import ( + "encoding/json" + "errors" + "fmt" + "reflect" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" +) + +type embed1 struct { + Em1 int + Dup int // annihilates with embed2.Dup + Shadow int + embed3 +} + +type embed2 struct { + Dup int + embed3 + embed4 +} + +type embed3 struct { + Em3 int // annihilated because embed3 is in both embed1 and embed2 + embed5 +} + +type embed4 struct { + Em4 int + Dup int // annihilation of Dup in embed1, embed2 hides this Dup + *embed1 // ignored because it occurs at a higher level +} + +type embed5 struct { + x int +} + +type Anonymous int + +type S1 struct { + Exported int + unexported int + Shadow int // shadows S1.Shadow + embed1 + *embed2 + Anonymous +} + +type Time struct { + time.Time +} + +var intType = reflect.TypeOf(int(0)) + +func field(name string, tval interface{}, index ...int) *Field { + return &Field{ + Name: name, + Type: reflect.TypeOf(tval), + Index: index, + ParsedTag: []string(nil), + } +} + +func tfield(name string, tval interface{}, index ...int) *Field { + return &Field{ + Name: name, + Type: reflect.TypeOf(tval), + Index: index, + NameFromTag: true, + ParsedTag: []string(nil), + } +} + +func TestFieldsNoTags(t *testing.T) { + c := NewCache(nil, nil, nil) + got, err := c.Fields(reflect.TypeOf(S1{})) + if err != nil { + t.Fatal(err) + } + want := []*Field{ + field("Exported", int(0), 0), + field("Shadow", int(0), 2), + field("Em1", int(0), 3, 0), + field("Em4", int(0), 4, 2, 0), + field("Anonymous", Anonymous(0), 5), + } + for _, f := range want { + f.ParsedTag = nil + } + if msg, ok := compareFields(got, want); !ok { + t.Error(msg) + } +} + +func TestAgainstJSONEncodingNoTags(t *testing.T) { + // Demonstrates that this package produces the same set of fields as encoding/json. + s1 := S1{ + Exported: 1, + unexported: 2, + Shadow: 3, + embed1: embed1{ + Em1: 4, + Dup: 5, + Shadow: 6, + embed3: embed3{ + Em3: 7, + embed5: embed5{x: 8}, + }, + }, + embed2: &embed2{ + Dup: 9, + embed3: embed3{ + Em3: 10, + embed5: embed5{x: 11}, + }, + embed4: embed4{ + Em4: 12, + Dup: 13, + embed1: &embed1{Em1: 14}, + }, + }, + Anonymous: Anonymous(15), + } + var want S1 + want.embed2 = &embed2{} // need this because reflection won't create it + jsonRoundTrip(t, s1, &want) + var got S1 + got.embed2 = &embed2{} + fields, err := NewCache(nil, nil, nil).Fields(reflect.TypeOf(got)) + if err != nil { + t.Fatal(err) + } + setFields(fields, &got, s1) + if !testutil.Equal(got, want, + cmp.AllowUnexported(S1{}, embed1{}, embed2{}, embed3{}, embed4{}, embed5{})) { + t.Errorf("got\n%+v\nwant\n%+v", got, want) + } +} + +// Tests use of LeafTypes parameter to NewCache +func TestAgainstJSONEncodingEmbeddedTime(t *testing.T) { + timeLeafFn := func(t reflect.Type) bool { + return t == reflect.TypeOf(time.Time{}) + } + // Demonstrates that this package can produce the same set of + // fields as encoding/json for a struct with an embedded time.Time. + now := time.Now().UTC() + myt := Time{ + now, + } + var want Time + jsonRoundTrip(t, myt, &want) + var got Time + fields, err := NewCache(nil, nil, timeLeafFn).Fields(reflect.TypeOf(got)) + if err != nil { + t.Fatal(err) + } + setFields(fields, &got, myt) + if !testutil.Equal(got, want) { + t.Errorf("got\n%+v\nwant\n%+v", got, want) + } +} + +type S2 struct { + NoTag int + XXX int `json:"tag"` // tag name takes precedence + Anonymous `json:"anon"` // anonymous non-structs also get their name from the tag + unexported int `json:"tag"` + Embed `json:"em"` // embedded structs with tags become fields + Tag int + YYY int `json:"Tag"` // tag takes precedence over untagged field of the same name + Empty int `json:""` // empty tag is noop + tEmbed1 + tEmbed2 +} + +type Embed struct { + Em int +} + +type tEmbed1 struct { + Dup int + X int `json:"Dup2"` +} + +type tEmbed2 struct { + Y int `json:"Dup"` // takes precedence over tEmbed1.Dup because it is tagged + Z int `json:"Dup2"` // same name as tEmbed1.X and both tagged, so ignored +} + +func jsonTagParser(t reflect.StructTag) (name string, keep bool, other interface{}, err error) { + return ParseStandardTag("json", t) +} + +func validateFunc(t reflect.Type) (err error) { + if t.Kind() != reflect.Struct { + return errors.New("non-struct type used") + } + + for i := 0; i < t.NumField(); i++ { + if t.Field(i).Type.Kind() == reflect.Slice { + return fmt.Errorf("slice field found at field %s on struct %s", t.Field(i).Name, t.Name()) + } + } + + return nil +} + +func TestFieldsWithTags(t *testing.T) { + got, err := NewCache(jsonTagParser, nil, nil).Fields(reflect.TypeOf(S2{})) + if err != nil { + t.Fatal(err) + } + want := []*Field{ + field("NoTag", int(0), 0), + tfield("tag", int(0), 1), + tfield("anon", Anonymous(0), 2), + tfield("em", Embed{}, 4), + tfield("Tag", int(0), 6), + field("Empty", int(0), 7), + tfield("Dup", int(0), 8, 0), + } + if msg, ok := compareFields(got, want); !ok { + t.Error(msg) + } +} + +func TestAgainstJSONEncodingWithTags(t *testing.T) { + // Demonstrates that this package produces the same set of fields as encoding/json. + s2 := S2{ + NoTag: 1, + XXX: 2, + Anonymous: 3, + Embed: Embed{ + Em: 4, + }, + tEmbed1: tEmbed1{ + Dup: 5, + X: 6, + }, + tEmbed2: tEmbed2{ + Y: 7, + Z: 8, + }, + } + var want S2 + jsonRoundTrip(t, s2, &want) + var got S2 + fields, err := NewCache(jsonTagParser, nil, nil).Fields(reflect.TypeOf(got)) + if err != nil { + t.Fatal(err) + } + setFields(fields, &got, s2) + if !testutil.Equal(got, want, cmp.AllowUnexported(S2{})) { + t.Errorf("got\n%+v\nwant\n%+v", got, want) + } +} + +func TestUnexportedAnonymousNonStruct(t *testing.T) { + // An unexported anonymous non-struct field should not be recorded. + // This is currently a bug in encoding/json. + // https://github.com/golang/go/issues/18009 + type ( + u int + v int + S struct { + u + v `json:"x"` + int + } + ) + + got, err := NewCache(jsonTagParser, nil, nil).Fields(reflect.TypeOf(S{})) + if err != nil { + t.Fatal(err) + } + if len(got) != 0 { + t.Errorf("got %d fields, want 0", len(got)) + } +} + +func TestUnexportedAnonymousStruct(t *testing.T) { + // An unexported anonymous struct with a tag is ignored. + // This is currently a bug in encoding/json. + // https://github.com/golang/go/issues/18009 + type ( + s1 struct{ X int } + S2 struct { + s1 `json:"Y"` + } + ) + got, err := NewCache(jsonTagParser, nil, nil).Fields(reflect.TypeOf(S2{})) + if err != nil { + t.Fatal(err) + } + if len(got) != 0 { + t.Errorf("got %d fields, want 0", len(got)) + } +} + +func TestDominantField(t *testing.T) { + // With fields sorted by index length and then by tag presence, + // the dominant field is always the first. Make sure all error + // cases are caught. + for _, test := range []struct { + fields []Field + wantOK bool + }{ + // A single field is OK. + {[]Field{{Index: []int{0}}}, true}, + {[]Field{{Index: []int{0}, NameFromTag: true}}, true}, + // A single field at top level is OK. + {[]Field{{Index: []int{0}}, {Index: []int{1, 0}}}, true}, + {[]Field{{Index: []int{0}}, {Index: []int{1, 0}, NameFromTag: true}}, true}, + {[]Field{{Index: []int{0}, NameFromTag: true}, {Index: []int{1, 0}, NameFromTag: true}}, true}, + // A single tagged field is OK. + {[]Field{{Index: []int{0}, NameFromTag: true}, {Index: []int{1}}}, true}, + // Two untagged fields at the same level is an error. + {[]Field{{Index: []int{0}}, {Index: []int{1}}}, false}, + // Two tagged fields at the same level is an error. + {[]Field{{Index: []int{0}, NameFromTag: true}, {Index: []int{1}, NameFromTag: true}}, false}, + } { + _, gotOK := dominantField(test.fields) + if gotOK != test.wantOK { + t.Errorf("%v: got %t, want %t", test.fields, gotOK, test.wantOK) + } + } +} + +func TestIgnore(t *testing.T) { + type S struct { + X int `json:"-"` + } + got, err := NewCache(jsonTagParser, nil, nil).Fields(reflect.TypeOf(S{})) + if err != nil { + t.Fatal(err) + } + if len(got) != 0 { + t.Errorf("got %d fields, want 0", len(got)) + } +} + +func TestParsedTag(t *testing.T) { + type S struct { + X int `json:"name,omitempty"` + } + got, err := NewCache(jsonTagParser, nil, nil).Fields(reflect.TypeOf(S{})) + if err != nil { + t.Fatal(err) + } + want := []*Field{ + {Name: "name", NameFromTag: true, Type: intType, + Index: []int{0}, ParsedTag: []string{"omitempty"}}, + } + if msg, ok := compareFields(got, want); !ok { + t.Error(msg) + } +} + +func TestValidateFunc(t *testing.T) { + type MyInvalidStruct struct { + A string + B []int + } + + _, err := NewCache(nil, validateFunc, nil).Fields(reflect.TypeOf(MyInvalidStruct{})) + if err == nil { + t.Fatal("expected error, got nil") + } + + type MyValidStruct struct { + A string + B int + } + _, err = NewCache(nil, validateFunc, nil).Fields(reflect.TypeOf(MyValidStruct{})) + if err != nil { + t.Fatalf("expected nil, got error: %s\n", err) + } +} + +func compareFields(got []Field, want []*Field) (msg string, ok bool) { + if len(got) != len(want) { + return fmt.Sprintf("got %d fields, want %d", len(got), len(want)), false + } + for i, g := range got { + w := *want[i] + if !fieldsEqual(&g, &w) { + return fmt.Sprintf("got\n%+v\nwant\n%+v", g, w), false + } + } + return "", true +} + +// Need this because Field contains a function, which cannot be compared even +// by testutil.Equal. +func fieldsEqual(f1, f2 *Field) bool { + if f1 == nil || f2 == nil { + return f1 == f2 + } + return f1.Name == f2.Name && + f1.NameFromTag == f2.NameFromTag && + f1.Type == f2.Type && + testutil.Equal(f1.ParsedTag, f2.ParsedTag) +} + +// Set the fields of dst from those of src. +// dst must be a pointer to a struct value. +// src must be a struct value. +func setFields(fields []Field, dst, src interface{}) { + vsrc := reflect.ValueOf(src) + vdst := reflect.ValueOf(dst).Elem() + for _, f := range fields { + fdst := vdst.FieldByIndex(f.Index) + fsrc := vsrc.FieldByIndex(f.Index) + fdst.Set(fsrc) + } +} + +func jsonRoundTrip(t *testing.T, in, out interface{}) { + bytes, err := json.Marshal(in) + if err != nil { + t.Fatal(err) + } + if err := json.Unmarshal(bytes, out); err != nil { + t.Fatal(err) + } +} + +type S3 struct { + S4 + Abc int + AbC int + Tag int + X int `json:"Tag"` + unexported int +} + +type S4 struct { + ABc int + Y int `json:"Abc"` // ignored because of top-level Abc +} + +func TestMatchingField(t *testing.T) { + fields, err := NewCache(jsonTagParser, nil, nil).Fields(reflect.TypeOf(S3{})) + if err != nil { + t.Fatal(err) + } + for _, test := range []struct { + name string + want *Field + }{ + // Exact match wins. + {"Abc", field("Abc", int(0), 1)}, + {"AbC", field("AbC", int(0), 2)}, + {"ABc", field("ABc", int(0), 0, 0)}, + // If there are multiple matches but no exact match or tag, + // the first field wins, lexicographically by index. + // Here, "ABc" is at a deeper embedding level, but since S4 appears + // first in S3, its index precedes the other fields of S3. + {"abc", field("ABc", int(0), 0, 0)}, + // Tag name takes precedence over untagged field of the same name. + {"Tag", tfield("Tag", int(0), 4)}, + // Unexported fields disappear. + {"unexported", nil}, + // Untagged embedded structs disappear. + {"S4", nil}, + } { + if got := fields.Match(test.name); !fieldsEqual(got, test.want) { + t.Errorf("match %q:\ngot %+v\nwant %+v", test.name, got, test.want) + } + } +} + +func TestAgainstJSONMatchingField(t *testing.T) { + s3 := S3{ + S4: S4{ABc: 1, Y: 2}, + Abc: 3, + AbC: 4, + Tag: 5, + X: 6, + unexported: 7, + } + var want S3 + jsonRoundTrip(t, s3, &want) + v := reflect.ValueOf(want) + fields, err := NewCache(jsonTagParser, nil, nil).Fields(reflect.TypeOf(S3{})) + if err != nil { + t.Fatal(err) + } + for _, test := range []struct { + name string + got int + }{ + {"Abc", 3}, + {"AbC", 4}, + {"ABc", 1}, + {"abc", 1}, + {"Tag", 6}, + } { + f := fields.Match(test.name) + if f == nil { + t.Fatalf("%s: no match", test.name) + } + w := v.FieldByIndex(f.Index).Interface() + if test.got != w { + t.Errorf("%s: got %d, want %d", test.name, test.got, w) + } + } +} + +func TestTagErrors(t *testing.T) { + called := false + c := NewCache(func(t reflect.StructTag) (string, bool, interface{}, error) { + called = true + s := t.Get("f") + if s == "bad" { + return "", false, nil, errors.New("error") + } + return s, true, nil, nil + }, nil, nil) + + type T struct { + X int `f:"ok"` + Y int `f:"bad"` + } + + _, err := c.Fields(reflect.TypeOf(T{})) + if !called { + t.Fatal("tag parser not called") + } + if err == nil { + t.Error("want error, got nil") + } + // Second time, we should cache the error. + called = false + _, err = c.Fields(reflect.TypeOf(T{})) + if called { + t.Fatal("tag parser called on second time") + } + if err == nil { + t.Error("want error, got nil") + } +} diff --git a/vendor/cloud.google.com/go/internal/fields/fold.go b/vendor/cloud.google.com/go/internal/fields/fold.go new file mode 100644 index 000000000..68e2588c4 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/fields/fold.go @@ -0,0 +1,156 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package fields + +// This file was copied from https://go.googlesource.com/go/+/go1.7.3/src/encoding/json/fold.go. +// Only the license and package were changed. + +import ( + "bytes" + "unicode/utf8" +) + +const ( + caseMask = ^byte(0x20) // Mask to ignore case in ASCII. + kelvin = '\u212a' + smallLongEss = '\u017f' +) + +// foldFunc returns one of four different case folding equivalence +// functions, from most general (and slow) to fastest: +// +// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8 +// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S') +// 3) asciiEqualFold, no special, but includes non-letters (including _) +// 4) simpleLetterEqualFold, no specials, no non-letters. +// +// The letters S and K are special because they map to 3 runes, not just 2: +// * S maps to s and to U+017F 'ſ' Latin small letter long s +// * k maps to K and to U+212A 'K' Kelvin sign +// See https://play.golang.org/p/tTxjOc0OGo +// +// The returned function is specialized for matching against s and +// should only be given s. It's not curried for performance reasons. +func foldFunc(s []byte) func(s, t []byte) bool { + nonLetter := false + special := false // special letter + for _, b := range s { + if b >= utf8.RuneSelf { + return bytes.EqualFold + } + upper := b & caseMask + if upper < 'A' || upper > 'Z' { + nonLetter = true + } else if upper == 'K' || upper == 'S' { + // See above for why these letters are special. + special = true + } + } + if special { + return equalFoldRight + } + if nonLetter { + return asciiEqualFold + } + return simpleLetterEqualFold +} + +// equalFoldRight is a specialization of bytes.EqualFold when s is +// known to be all ASCII (including punctuation), but contains an 's', +// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t. +// See comments on foldFunc. +func equalFoldRight(s, t []byte) bool { + for _, sb := range s { + if len(t) == 0 { + return false + } + tb := t[0] + if tb < utf8.RuneSelf { + if sb != tb { + sbUpper := sb & caseMask + if 'A' <= sbUpper && sbUpper <= 'Z' { + if sbUpper != tb&caseMask { + return false + } + } else { + return false + } + } + t = t[1:] + continue + } + // sb is ASCII and t is not. t must be either kelvin + // sign or long s; sb must be s, S, k, or K. + tr, size := utf8.DecodeRune(t) + switch sb { + case 's', 'S': + if tr != smallLongEss { + return false + } + case 'k', 'K': + if tr != kelvin { + return false + } + default: + return false + } + t = t[size:] + + } + if len(t) > 0 { + return false + } + return true +} + +// asciiEqualFold is a specialization of bytes.EqualFold for use when +// s is all ASCII (but may contain non-letters) and contains no +// special-folding letters. +// See comments on foldFunc. +func asciiEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, sb := range s { + tb := t[i] + if sb == tb { + continue + } + if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') { + if sb&caseMask != tb&caseMask { + return false + } + } else { + return false + } + } + return true +} + +// simpleLetterEqualFold is a specialization of bytes.EqualFold for +// use when s is all ASCII letters (no underscores, etc) and also +// doesn't contain 'k', 'K', 's', or 'S'. +// See comments on foldFunc. +func simpleLetterEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, b := range s { + if b&caseMask != t[i]&caseMask { + return false + } + } + return true +} diff --git a/vendor/cloud.google.com/go/internal/fields/fold_test.go b/vendor/cloud.google.com/go/internal/fields/fold_test.go new file mode 100644 index 000000000..77cb80ba0 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/fields/fold_test.go @@ -0,0 +1,129 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package fields + +// This file was copied from https://go.googlesource.com/go/+/go1.7.3/src/encoding/json/fold_test.go. +// Only the license and package were changed. + +import ( + "bytes" + "strings" + "testing" + "unicode/utf8" +) + +var foldTests = []struct { + fn func(s, t []byte) bool + s, t string + want bool +}{ + {equalFoldRight, "", "", true}, + {equalFoldRight, "a", "a", true}, + {equalFoldRight, "", "a", false}, + {equalFoldRight, "a", "", false}, + {equalFoldRight, "a", "A", true}, + {equalFoldRight, "AB", "ab", true}, + {equalFoldRight, "AB", "ac", false}, + {equalFoldRight, "sbkKc", "ſbKKc", true}, + {equalFoldRight, "SbKkc", "ſbKKc", true}, + {equalFoldRight, "SbKkc", "ſbKK", false}, + {equalFoldRight, "e", "é", false}, + {equalFoldRight, "s", "S", true}, + + {simpleLetterEqualFold, "", "", true}, + {simpleLetterEqualFold, "abc", "abc", true}, + {simpleLetterEqualFold, "abc", "ABC", true}, + {simpleLetterEqualFold, "abc", "ABCD", false}, + {simpleLetterEqualFold, "abc", "xxx", false}, + + {asciiEqualFold, "a_B", "A_b", true}, + {asciiEqualFold, "aa@", "aa`", false}, // verify 0x40 and 0x60 aren't case-equivalent +} + +func TestFold(t *testing.T) { + for i, tt := range foldTests { + if got := tt.fn([]byte(tt.s), []byte(tt.t)); got != tt.want { + t.Errorf("%d. %q, %q = %v; want %v", i, tt.s, tt.t, got, tt.want) + } + truth := strings.EqualFold(tt.s, tt.t) + if truth != tt.want { + t.Errorf("strings.EqualFold doesn't agree with case %d", i) + } + } +} + +func TestFoldAgainstUnicode(t *testing.T) { + const bufSize = 5 + buf1 := make([]byte, 0, bufSize) + buf2 := make([]byte, 0, bufSize) + var runes []rune + for i := 0x20; i <= 0x7f; i++ { + runes = append(runes, rune(i)) + } + runes = append(runes, kelvin, smallLongEss) + + funcs := []struct { + name string + fold func(s, t []byte) bool + letter bool // must be ASCII letter + simple bool // must be simple ASCII letter (not 'S' or 'K') + }{ + { + name: "equalFoldRight", + fold: equalFoldRight, + }, + { + name: "asciiEqualFold", + fold: asciiEqualFold, + simple: true, + }, + { + name: "simpleLetterEqualFold", + fold: simpleLetterEqualFold, + simple: true, + letter: true, + }, + } + + for _, ff := range funcs { + for _, r := range runes { + if r >= utf8.RuneSelf { + continue + } + if ff.letter && !isASCIILetter(byte(r)) { + continue + } + if ff.simple && (r == 's' || r == 'S' || r == 'k' || r == 'K') { + continue + } + for _, r2 := range runes { + buf1 := append(buf1[:0], 'x') + buf2 := append(buf2[:0], 'x') + buf1 = buf1[:1+utf8.EncodeRune(buf1[1:bufSize], r)] + buf2 = buf2[:1+utf8.EncodeRune(buf2[1:bufSize], r2)] + buf1 = append(buf1, 'x') + buf2 = append(buf2, 'x') + want := bytes.EqualFold(buf1, buf2) + if got := ff.fold(buf1, buf2); got != want { + t.Errorf("%s(%q, %q) = %v; want %v", ff.name, buf1, buf2, got, want) + } + } + } + } +} + +func isASCIILetter(b byte) bool { + return ('A' <= b && b <= 'Z') || ('a' <= b && b <= 'z') +} diff --git a/vendor/cloud.google.com/go/internal/kokoro/continuous.sh b/vendor/cloud.google.com/go/internal/kokoro/continuous.sh new file mode 100755 index 000000000..44f119bf1 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/kokoro/continuous.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +export GOOGLE_APPLICATION_CREDENTIALS=$KOKORO_KEYSTORE_DIR/72523_go_integration_service_account +export GCLOUD_TESTS_GOLANG_PROJECT_ID=dulcet-port-762 +export GCLOUD_TESTS_GOLANG_KEY=$GOOGLE_APPLICATION_CREDENTIALS +export GCLOUD_TESTS_GOLANG_FIRESTORE_PROJECT_ID=gcloud-golang-firestore-tests +export GCLOUD_TESTS_GOLANG_FIRESTORE_KEY=$KOKORO_KEYSTORE_DIR/72523_go_firestore_integration_service_account +export GCLOUD_TESTS_API_KEY=`cat $KOKORO_KEYSTORE_DIR/72523_go_gcloud_tests_api_key` +export GCLOUD_TESTS_GOLANG_KEYRING=projects/dulcet-port-762/locations/global/keyRings/go-integration-test + +# Fail on any error +set -eo pipefail + +# Display commands being run +set -x + +# cd to project dir on Kokoro instance +cd git/gocloud + +go version + +# Set $GOPATH +export GOPATH="$HOME/go" +export GOCLOUD_HOME=$GOPATH/src/cloud.google.com/go/ +export PATH="$GOPATH/bin:$PATH" +mkdir -p $GOCLOUD_HOME + +# Move code into $GOPATH and get dependencies +git clone . $GOCLOUD_HOME +cd $GOCLOUD_HOME + +try3() { eval "$*" || eval "$*" || eval "$*"; } +try3 go get -v -t ./... + +./internal/kokoro/vet.sh + +# Run tests and tee output to log file, to be pushed to GCS as artifact. +go test -race -v -timeout 15m ./... 2>&1 | tee $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt \ No newline at end of file diff --git a/vendor/cloud.google.com/go/internal/kokoro/presubmit.sh b/vendor/cloud.google.com/go/internal/kokoro/presubmit.sh new file mode 100755 index 000000000..d0dd965c8 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/kokoro/presubmit.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# TODO(deklerk) Add integration tests when it's secure to do so. b/64723143 + +# Fail on any error +set -eo pipefail + +# Display commands being run +set -x + +# cd to project dir on Kokoro instance +cd git/gocloud + +go version + +# Set $GOPATH +export GOPATH="$HOME/go" +export GOCLOUD_HOME=$GOPATH/src/cloud.google.com/go/ +export PATH="$GOPATH/bin:$PATH" +mkdir -p $GOCLOUD_HOME + +# Move code into $GOPATH and get dependencies +git clone . $GOCLOUD_HOME +cd $GOCLOUD_HOME + +try3() { eval "$*" || eval "$*" || eval "$*"; } +try3 go get -v -t ./... + +./internal/kokoro/vet.sh + +# Run tests and tee output to log file, to be pushed to GCS as artifact. +go test -race -v -timeout 15m -short ./... 2>&1 | tee $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt \ No newline at end of file diff --git a/vendor/cloud.google.com/go/internal/kokoro/trampoline.sh b/vendor/cloud.google.com/go/internal/kokoro/trampoline.sh new file mode 100644 index 000000000..ba17ce014 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/kokoro/trampoline.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copyright 2018 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. +set -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/vendor/cloud.google.com/go/internal/kokoro/vet.sh b/vendor/cloud.google.com/go/internal/kokoro/vet.sh new file mode 100755 index 000000000..f2381e0f6 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/kokoro/vet.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# Fail on any error +set -eo pipefail + +# Display commands being run +set -x + +# Only run the linter on go1.11, since it needs type aliases (and we only care about its output once). +# TODO(deklerk) We should pass an environment variable from kokoro to decide this logic instead. +if [[ `go version` != *"go1.11"* ]]; then + exit 0 +fi + +pwd + +try3() { eval "$*" || eval "$*" || eval "$*"; } + +try3 go get -u \ + golang.org/x/lint/golint \ + golang.org/x/tools/cmd/goimports \ + golang.org/x/lint/golint \ + honnef.co/go/tools/cmd/staticcheck + +# Look at all .go files (ignoring .pb.go files) and make sure they have a Copyright. Fail if any don't. +git ls-files "*[^.pb].go" | xargs grep -L "\(Copyright [0-9]\{4,\}\)" 2>&1 | tee /dev/stderr | (! read) +gofmt -s -d -l . 2>&1 | tee /dev/stderr | (! read) +goimports -l . 2>&1 | tee /dev/stderr | (! read) + +# Runs the linter. Regrettably the linter is very simple and does not provide the ability to exclude rules or files, +# so we rely on inverse grepping to do this for us. +# +# Piping a bunch of greps may be slower than `grep -vE (thing|otherthing|anotherthing|etc)`, but since we have a good +# amount of things we're excluding, it seems better to optimize for readability. +# +# Note: since we added the linter after-the-fact, some of the ignored errors here are because we can't change an +# existing interface. (as opposed to us not caring about the error) +golint ./... 2>&1 | ( \ + grep -vE "gen\.go" | \ + grep -vE "receiver name [a-zA-Z]+[0-9]* should be consistent with previous receiver name" | \ + grep -vE "exported const AllUsers|AllAuthenticatedUsers|RoleOwner|SSD|HDD|PRODUCTION|DEVELOPMENT should have comment" | \ + grep -v "exported func Value returns unexported type pretty.val, which can be annoying to use" | \ + grep -v "ExecuteStreamingSql" | \ + grep -v "ClusterId" | \ + grep -v "InstanceId" | \ + grep -v "firestore.arrayUnion" | \ + grep -v "firestore.arrayRemove" | \ + grep -v "maxAttempts" | \ + grep -v "UptimeCheckIpIterator" | \ + grep -vE "apiv[0-9]+" | \ + grep -v "ALL_CAPS" | \ + grep -v "go-cloud-debug-agent" | \ + grep -v "mock_test" | \ + grep -v "a blank import should be only in a main or test package" | \ + grep -vE "\.pb\.go:" || true) | tee /dev/stderr | (! read) + +# TODO(deklerk) It doesn't seem like it, but is it possible to glob both before +# and after the colon? Then we could do *go-cloud-debug-agent*:* +staticcheck -ignore ' +*:SA1019 +cloud.google.com/go/firestore/internal/doc-snippets.go:* +cloud.google.com/go/functions/metadata/metadata_test.go:SA1012 +cloud.google.com/go/cmd/go-cloud-debug-agent/internal/controller/client_test.go:* +cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/frame.go:* +cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/dwarf/typeunit.go:* +cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/elf/file.go:* +cloud.google.com/go/cmd/go-cloud-debug-agent/internal/debug/server/server.go:* +' ./... diff --git a/vendor/cloud.google.com/go/internal/leakcheck/leakcheck.go b/vendor/cloud.google.com/go/internal/leakcheck/leakcheck.go new file mode 100644 index 000000000..4184adc0e --- /dev/null +++ b/vendor/cloud.google.com/go/internal/leakcheck/leakcheck.go @@ -0,0 +1,119 @@ +// 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. + +// Package leakcheck contains functions to check leaked goroutines. +// +// Call "defer leakcheck.Check(t)" at the beginning of tests. +// +// This is very closely based on grpc-go's leakcheck. +package leakcheck + +import ( + "runtime" + "sort" + "strings" + "time" +) + +var goroutinesToIgnore = []string{ + "net/http/transport.go", + "net/http/h2_bundle.go", + "src/go.opencensus.io/stats/view/worker.go", + "testing.Main(", + "testing.tRunner(", + "testing.(*M).", + "runtime.goexit", + "created by runtime.gc", + "created by runtime/trace.Start", + "interestingGoroutines", + "runtime.MHeap_Scavenger", + "signal.signal_recv", + "sigterm.handler", + "runtime_mcall", + "(*loggingT).flushDaemon", + "goroutine in C code", +} + +// RegisterIgnoreGoroutine appends s into the ignore goroutine list. The +// goroutines whose stack trace contains s will not be identified as leaked +// goroutines. Not thread-safe, only call this function in init(). +func RegisterIgnoreGoroutine(s string) { + goroutinesToIgnore = append(goroutinesToIgnore, s) +} + +func ignore(g string) bool { + sl := strings.SplitN(g, "\n", 2) + if len(sl) != 2 { + return true + } + stack := strings.TrimSpace(sl[1]) + if strings.HasPrefix(stack, "testing.RunTests") { + return true + } + + if stack == "" { + return true + } + + for _, s := range goroutinesToIgnore { + if strings.Contains(stack, s) { + return true + } + } + + return false +} + +// interestingGoroutines returns all goroutines we care about for the purpose of +// leak checking. It excludes testing or runtime ones. +func interestingGoroutines() (gs []string) { + buf := make([]byte, 2<<20) + buf = buf[:runtime.Stack(buf, true)] + for _, g := range strings.Split(string(buf), "\n\n") { + if !ignore(g) { + gs = append(gs, g) + } + } + sort.Strings(gs) + return +} + +// Errorfer is the interface that wraps the Errorf method. It's a subset of +// testing.TB to make it easy to use Check. +type Errorfer interface { + Errorf(format string, args ...interface{}) +} + +func check(efer Errorfer, timeout time.Duration) { + // Loop, waiting for goroutines to shut down. + // Wait up to timeout, but finish as quickly as possible. + deadline := time.Now().Add(timeout) + var leaked []string + for time.Now().Before(deadline) { + if leaked = interestingGoroutines(); len(leaked) == 0 { + return + } + time.Sleep(50 * time.Millisecond) + } + for _, g := range leaked { + efer.Errorf("Leaked goroutine: %v", g) + } +} + +// Check looks at the currently-running goroutines and checks if there are any +// interestring (created by gRPC) goroutines leaked. It waits up to 10 seconds +// in the error cases. +func Check(efer Errorfer) { + check(efer, 10*time.Second) +} diff --git a/vendor/cloud.google.com/go/internal/leakcheck/leakcheck_test.go b/vendor/cloud.google.com/go/internal/leakcheck/leakcheck_test.go new file mode 100644 index 000000000..2a8f1e659 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/leakcheck/leakcheck_test.go @@ -0,0 +1,72 @@ +// 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. + +package leakcheck + +import ( + "fmt" + "strings" + "testing" + "time" +) + +type testErrorfer struct { + errorCount int + errors []string +} + +func (e *testErrorfer) Errorf(format string, args ...interface{}) { + e.errors = append(e.errors, fmt.Sprintf(format, args...)) + e.errorCount++ +} + +func TestCheck(t *testing.T) { + const leakCount = 3 + for i := 0; i < leakCount; i++ { + go func() { time.Sleep(2 * time.Second) }() + } + if ig := interestingGoroutines(); len(ig) == 0 { + t.Error("blah") + } + e := &testErrorfer{} + check(e, time.Second) + if e.errorCount != leakCount { + t.Errorf("check found %v leaks, want %v leaks", e.errorCount, leakCount) + t.Logf("leaked goroutines:\n%v", strings.Join(e.errors, "\n")) + } + check(t, 3*time.Second) +} + +func ignoredTestingLeak(d time.Duration) { + time.Sleep(d) +} + +func TestCheckRegisterIgnore(t *testing.T) { + RegisterIgnoreGoroutine("ignoredTestingLeak") + const leakCount = 3 + for i := 0; i < leakCount; i++ { + go func() { time.Sleep(2 * time.Second) }() + } + go func() { ignoredTestingLeak(3 * time.Second) }() + if ig := interestingGoroutines(); len(ig) == 0 { + t.Error("blah") + } + e := &testErrorfer{} + check(e, time.Second) + if e.errorCount != leakCount { + t.Errorf("check found %v leaks, want %v leaks", e.errorCount, leakCount) + t.Logf("leaked goroutines:\n%v", strings.Join(e.errors, "\n")) + } + check(t, 3*time.Second) +} diff --git a/vendor/cloud.google.com/go/internal/optional/optional.go b/vendor/cloud.google.com/go/internal/optional/optional.go new file mode 100644 index 000000000..72780f764 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/optional/optional.go @@ -0,0 +1,108 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package optional provides versions of primitive types that can +// be nil. These are useful in methods that update some of an API object's +// fields. +package optional + +import ( + "fmt" + "strings" + "time" +) + +type ( + // Bool is either a bool or nil. + Bool interface{} + + // String is either a string or nil. + String interface{} + + // Int is either an int or nil. + Int interface{} + + // Uint is either a uint or nil. + Uint interface{} + + // Float64 is either a float64 or nil. + Float64 interface{} + + // Duration is either a time.Duration or nil. + Duration interface{} +) + +// ToBool returns its argument as a bool. +// It panics if its argument is nil or not a bool. +func ToBool(v Bool) bool { + x, ok := v.(bool) + if !ok { + doPanic("Bool", v) + } + return x +} + +// ToString returns its argument as a string. +// It panics if its argument is nil or not a string. +func ToString(v String) string { + x, ok := v.(string) + if !ok { + doPanic("String", v) + } + return x +} + +// ToInt returns its argument as an int. +// It panics if its argument is nil or not an int. +func ToInt(v Int) int { + x, ok := v.(int) + if !ok { + doPanic("Int", v) + } + return x +} + +// ToUint returns its argument as a uint. +// It panics if its argument is nil or not a uint. +func ToUint(v Uint) uint { + x, ok := v.(uint) + if !ok { + doPanic("Uint", v) + } + return x +} + +// ToFloat64 returns its argument as a float64. +// It panics if its argument is nil or not a float64. +func ToFloat64(v Float64) float64 { + x, ok := v.(float64) + if !ok { + doPanic("Float64", v) + } + return x +} + +// ToDuration returns its argument as a time.Duration. +// It panics if its argument is nil or not a time.Duration. +func ToDuration(v Duration) time.Duration { + x, ok := v.(time.Duration) + if !ok { + doPanic("Duration", v) + } + return x +} + +func doPanic(capType string, v interface{}) { + panic(fmt.Sprintf("optional.%s value should be %s, got %T", capType, strings.ToLower(capType), v)) +} diff --git a/vendor/cloud.google.com/go/internal/optional/optional_test.go b/vendor/cloud.google.com/go/internal/optional/optional_test.go new file mode 100644 index 000000000..85b83aad2 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/optional/optional_test.go @@ -0,0 +1,64 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package optional + +import "testing" + +func TestConvertSuccess(t *testing.T) { + if got, want := ToBool(false), false; got != want { + t.Errorf("got %v, want %v", got, want) + } + if got, want := ToString(""), ""; got != want { + t.Errorf("got %v, want %v", got, want) + } + if got, want := ToInt(0), 0; got != want { + t.Errorf("got %v, want %v", got, want) + } + if got, want := ToUint(uint(0)), uint(0); got != want { + t.Errorf("got %v, want %v", got, want) + } + if got, want := ToFloat64(0.0), 0.0; got != want { + t.Errorf("got %v, want %v", got, want) + } +} + +func TestConvertFailure(t *testing.T) { + for _, f := range []func(){ + func() { ToBool(nil) }, + func() { ToBool(3) }, + func() { ToString(nil) }, + func() { ToString(3) }, + func() { ToInt(nil) }, + func() { ToInt("") }, + func() { ToUint(nil) }, + func() { ToUint("") }, + func() { ToFloat64(nil) }, + func() { ToFloat64("") }, + } { + if !panics(f) { + t.Error("got no panic, want panic") + } + } +} + +func panics(f func()) (b bool) { + defer func() { + if recover() != nil { + b = true + } + }() + f() + return false +} diff --git a/vendor/cloud.google.com/go/internal/pretty/diff.go b/vendor/cloud.google.com/go/internal/pretty/diff.go new file mode 100644 index 000000000..2edea743d --- /dev/null +++ b/vendor/cloud.google.com/go/internal/pretty/diff.go @@ -0,0 +1,78 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pretty + +import ( + "fmt" + "io/ioutil" + "os" + "os/exec" + "syscall" +) + +// Diff compares the pretty-printed representation of two values. The second +// return value reports whether the two values' representations are identical. +// If it is false, the first return value contains the diffs. +// +// The output labels the first value "want" and the second "got". +// +// Diff works by invoking the "diff" command. It will only succeed in +// environments where "diff" is on the shell path. +func Diff(want, got interface{}) (string, bool, error) { + fname1, err := writeToTemp(want) + if err != nil { + return "", false, err + } + defer os.Remove(fname1) + + fname2, err := writeToTemp(got) + if err != nil { + return "", false, err + } + defer os.Remove(fname2) + + cmd := exec.Command("diff", "-u", "--label=want", "--label=got", fname1, fname2) + out, err := cmd.Output() + if err == nil { + return string(out), true, nil + } + eerr, ok := err.(*exec.ExitError) + if !ok { + return "", false, err + } + ws, ok := eerr.Sys().(syscall.WaitStatus) + if !ok { + return "", false, err + } + if ws.ExitStatus() != 1 { + return "", false, err + } + // Exit status of 1 means no error, but diffs were found. + return string(out), false, nil +} + +func writeToTemp(v interface{}) (string, error) { + f, err := ioutil.TempFile("", "prettyDiff") + if err != nil { + return "", err + } + if _, err := fmt.Fprintf(f, "%+v\n", Value(v)); err != nil { + return "", err + } + if err := f.Close(); err != nil { + return "", err + } + return f.Name(), nil +} diff --git a/vendor/cloud.google.com/go/internal/pretty/diff_test.go b/vendor/cloud.google.com/go/internal/pretty/diff_test.go new file mode 100644 index 000000000..e6ef1790c --- /dev/null +++ b/vendor/cloud.google.com/go/internal/pretty/diff_test.go @@ -0,0 +1,50 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pretty + +import "testing" + +func TestDiff(t *testing.T) { + for _, test := range []struct { + v1, v2 interface{} + ok bool + want string + }{ + {5, 5, true, ""}, + {"foo", "foo", true, ""}, + {[]int{1, 2, 3}, []int{1, 0, 3}, false, `--- want ++++ got +@@ -1,5 +1,5 @@ + []int{ + 1, +- 2, ++ 0, + 3, + } +`}, + } { + got, ok, err := Diff(test.v1, test.v2) + if err != nil { + t.Errorf("%v vs. %v: %v", test.v1, test.v2, err) + continue + } + if ok != test.ok { + t.Errorf("%v vs. %v: got %t, want %t", test.v1, test.v2, ok, test.ok) + } + if got != test.want { + t.Errorf("%v vs. %v: got:\n%q\nwant:\n%q", test.v1, test.v2, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/internal/pretty/pretty.go b/vendor/cloud.google.com/go/internal/pretty/pretty.go new file mode 100644 index 000000000..df9810941 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/pretty/pretty.go @@ -0,0 +1,255 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package pretty implements a simple pretty-printer. It is intended for +// debugging the output of tests. +// +// It follows pointers and produces multi-line output for complex values like +// slices, maps and structs. +package pretty + +import ( + "fmt" + "io" + "reflect" + "sort" + "strings" + "time" +) + +// Indent is the string output at each level of indentation. +var Indent = " " + +// Value returns a value that will print prettily when used as an +// argument for the %v or %s format specifiers. +// With no flags, struct fields and map keys with default values are omitted. +// With the '+' or '#' flags, all values are displayed. +// +// This package does not detect cycles. Attempting to print a Value that +// contains cycles will result in unbounded recursion. +func Value(v interface{}) val { return val{v: v} } + +// val is a value. +type val struct{ v interface{} } + +// Format implements the fmt.Formatter interface. +func (v val) Format(s fmt.State, c rune) { + if c == 'v' || c == 's' { + fprint(s, reflect.ValueOf(v.v), state{ + defaults: s.Flag('+') || s.Flag('#'), + }) + } else { + fmt.Fprintf(s, "%%!%c(pretty.val)", c) + } +} + +type state struct { + level int + prefix, suffix string + defaults bool +} + +const maxLevel = 100 + +var typeOfTime = reflect.TypeOf(time.Time{}) + +func fprint(w io.Writer, v reflect.Value, s state) { + if s.level > maxLevel { + fmt.Fprintln(w, "pretty: max nested depth exceeded") + return + } + indent := strings.Repeat(Indent, s.level) + fmt.Fprintf(w, "%s%s", indent, s.prefix) + if isNil(v) { + fmt.Fprintf(w, "nil%s", s.suffix) + return + } + if v.Type().Kind() == reflect.Interface { + v = v.Elem() + } + if v.Type() == typeOfTime { + fmt.Fprintf(w, "%s%s", v.Interface(), s.suffix) + return + } + for v.Type().Kind() == reflect.Ptr { + fmt.Fprintf(w, "&") + v = v.Elem() + } + switch v.Type().Kind() { + default: + fmt.Fprintf(w, "%s%s", short(v), s.suffix) + + case reflect.Array: + fmt.Fprintf(w, "%s{\n", v.Type()) + for i := 0; i < v.Len(); i++ { + fprint(w, v.Index(i), state{ + level: s.level + 1, + prefix: "", + suffix: ",", + defaults: s.defaults, + }) + fmt.Fprintln(w) + } + fmt.Fprintf(w, "%s}", indent) + + case reflect.Slice: + fmt.Fprintf(w, "%s{", v.Type()) + if v.Len() > 0 { + fmt.Fprintln(w) + for i := 0; i < v.Len(); i++ { + fprint(w, v.Index(i), state{ + level: s.level + 1, + prefix: "", + suffix: ",", + defaults: s.defaults, + }) + fmt.Fprintln(w) + } + } + fmt.Fprintf(w, "%s}%s", indent, s.suffix) + + case reflect.Map: + fmt.Fprintf(w, "%s{", v.Type()) + if v.Len() > 0 { + fmt.Fprintln(w) + keys := v.MapKeys() + maybeSort(keys, v.Type().Key()) + for _, key := range keys { + val := v.MapIndex(key) + if s.defaults || !isDefault(val) { + fprint(w, val, state{ + level: s.level + 1, + prefix: short(key) + ": ", + suffix: ",", + defaults: s.defaults, + }) + fmt.Fprintln(w) + } + } + } + fmt.Fprintf(w, "%s}%s", indent, s.suffix) + + case reflect.Struct: + t := v.Type() + fmt.Fprintf(w, "%s{\n", t) + for i := 0; i < t.NumField(); i++ { + f := v.Field(i) + if s.defaults || !isDefault(f) { + fprint(w, f, state{ + level: s.level + 1, + prefix: t.Field(i).Name + ": ", + suffix: ",", + defaults: s.defaults, + }) + fmt.Fprintln(w) + } + } + fmt.Fprintf(w, "%s}%s", indent, s.suffix) + } +} + +func isNil(v reflect.Value) bool { + if !v.IsValid() { + return true + } + switch v.Type().Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return v.IsNil() + default: + return false + } +} + +func isDefault(v reflect.Value) bool { + if !v.IsValid() { + return true + } + t := v.Type() + switch t.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return v.IsNil() + default: + if !v.CanInterface() { + return false + } + return t.Comparable() && v.Interface() == reflect.Zero(t).Interface() + } +} + +// short returns a short, one-line string for v. +func short(v reflect.Value) string { + if !v.IsValid() { + return "nil" + } + if v.Type().Kind() == reflect.String { + return fmt.Sprintf("%q", v) + } + return fmt.Sprintf("%v", v) +} + +func indent(w io.Writer, level int) { + for i := 0; i < level; i++ { + io.WriteString(w, Indent) // ignore errors + } +} + +func maybeSort(vs []reflect.Value, t reflect.Type) { + if less := lessFunc(t); less != nil { + sort.Sort(&sorter{vs, less}) + } +} + +// lessFunc returns a function that implements the "<" operator +// for the given type, or nil if the type doesn't support "<" . +func lessFunc(t reflect.Type) func(v1, v2 interface{}) bool { + switch t.Kind() { + case reflect.String: + return func(v1, v2 interface{}) bool { return v1.(string) < v2.(string) } + case reflect.Int: + return func(v1, v2 interface{}) bool { return v1.(int) < v2.(int) } + case reflect.Int8: + return func(v1, v2 interface{}) bool { return v1.(int8) < v2.(int8) } + case reflect.Int16: + return func(v1, v2 interface{}) bool { return v1.(int16) < v2.(int16) } + case reflect.Int32: + return func(v1, v2 interface{}) bool { return v1.(int32) < v2.(int32) } + case reflect.Int64: + return func(v1, v2 interface{}) bool { return v1.(int64) < v2.(int64) } + case reflect.Uint: + return func(v1, v2 interface{}) bool { return v1.(uint) < v2.(uint) } + case reflect.Uint8: + return func(v1, v2 interface{}) bool { return v1.(uint8) < v2.(uint8) } + case reflect.Uint16: + return func(v1, v2 interface{}) bool { return v1.(uint16) < v2.(uint16) } + case reflect.Uint32: + return func(v1, v2 interface{}) bool { return v1.(uint32) < v2.(uint32) } + case reflect.Uint64: + return func(v1, v2 interface{}) bool { return v1.(uint64) < v2.(uint64) } + case reflect.Float32: + return func(v1, v2 interface{}) bool { return v1.(float32) < v2.(float32) } + case reflect.Float64: + return func(v1, v2 interface{}) bool { return v1.(float64) < v2.(float64) } + default: + return nil + } +} + +type sorter struct { + vs []reflect.Value + less func(v1, v2 interface{}) bool +} + +func (s *sorter) Len() int { return len(s.vs) } +func (s *sorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } +func (s *sorter) Less(i, j int) bool { return s.less(s.vs[i].Interface(), s.vs[j].Interface()) } diff --git a/vendor/cloud.google.com/go/internal/pretty/pretty_test.go b/vendor/cloud.google.com/go/internal/pretty/pretty_test.go new file mode 100644 index 000000000..50984f938 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/pretty/pretty_test.go @@ -0,0 +1,105 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pretty + +import ( + "fmt" + "strings" + "testing" +) + +type S struct { + X int + Y bool + z *string +} + +func TestSprint(t *testing.T) { + Indent = "~" + i := 17 + + for _, test := range []struct { + value interface{} + want string + }{ + // primitives and pointer + {nil, "nil"}, + {3, "3"}, + {9.8, "9.8"}, + {true, "true"}, + {"foo", `"foo"`}, + {&i, "&17"}, + // array and slice + {[3]int{1, 2, 3}, "[3]int{\n~1,\n~2,\n~3,\n}"}, + {[]int{1, 2, 3}, "[]int{\n~1,\n~2,\n~3,\n}"}, + {[]int{}, "[]int{}"}, + {[]string{"foo"}, "[]string{\n~\"foo\",\n}"}, + // map + {map[int]bool{}, "map[int]bool{}"}, + {map[int]bool{1: true, 2: false, 3: true}, + "map[int]bool{\n~1: true,\n~3: true,\n}"}, + // struct + {S{}, "pretty.S{\n}"}, + {S{3, true, ptr("foo")}, + "pretty.S{\n~X: 3,\n~Y: true,\n~z: &\"foo\",\n}"}, + // interface + {[]interface{}{&i}, "[]interface {}{\n~&17,\n}"}, + // nesting + {[]S{{1, false, ptr("a")}, {2, true, ptr("b")}}, + `[]pretty.S{ +~pretty.S{ +~~X: 1, +~~z: &"a", +~}, +~pretty.S{ +~~X: 2, +~~Y: true, +~~z: &"b", +~}, +}`}, + } { + got := fmt.Sprintf("%v", Value(test.value)) + if got != test.want { + t.Errorf("%v: got:\n%q\nwant:\n%q", test.value, got, test.want) + } + } +} + +func TestWithDefaults(t *testing.T) { + Indent = "~" + for _, test := range []struct { + value interface{} + want string + }{ + {map[int]bool{1: true, 2: false, 3: true}, + "map[int]bool{\n~1: true,\n~2: false,\n~3: true,\n}"}, + {S{}, "pretty.S{\n~X: 0,\n~Y: false,\n~z: nil,\n}"}, + } { + got := fmt.Sprintf("%+v", Value(test.value)) + if got != test.want { + t.Errorf("%v: got:\n%q\nwant:\n%q", test.value, got, test.want) + } + } +} + +func TestBadVerb(t *testing.T) { + got := fmt.Sprintf("%d", Value(8)) + want := "%!d(" + if !strings.HasPrefix(got, want) { + t.Errorf("got %q, want prefix %q", got, want) + } +} + +func ptr(s string) *string { return &s } diff --git a/vendor/cloud.google.com/go/internal/protostruct/protostruct.go b/vendor/cloud.google.com/go/internal/protostruct/protostruct.go new file mode 100644 index 000000000..3f8ebfb5a --- /dev/null +++ b/vendor/cloud.google.com/go/internal/protostruct/protostruct.go @@ -0,0 +1,56 @@ +// Copyright 2017 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 protostruct supports operations on the protocol buffer Struct message. +package protostruct + +import ( + pb "github.com/golang/protobuf/ptypes/struct" +) + +// DecodeToMap converts a pb.Struct to a map from strings to Go types. +// DecodeToMap panics if s is invalid. +func DecodeToMap(s *pb.Struct) map[string]interface{} { + if s == nil { + return nil + } + m := map[string]interface{}{} + for k, v := range s.Fields { + m[k] = decodeValue(v) + } + return m +} + +func decodeValue(v *pb.Value) interface{} { + switch k := v.Kind.(type) { + case *pb.Value_NullValue: + return nil + case *pb.Value_NumberValue: + return k.NumberValue + case *pb.Value_StringValue: + return k.StringValue + case *pb.Value_BoolValue: + return k.BoolValue + case *pb.Value_StructValue: + return DecodeToMap(k.StructValue) + case *pb.Value_ListValue: + s := make([]interface{}, len(k.ListValue.Values)) + for i, e := range k.ListValue.Values { + s[i] = decodeValue(e) + } + return s + default: + panic("protostruct: unknown kind") + } +} diff --git a/vendor/cloud.google.com/go/internal/protostruct/protostruct_test.go b/vendor/cloud.google.com/go/internal/protostruct/protostruct_test.go new file mode 100644 index 000000000..cec8876ca --- /dev/null +++ b/vendor/cloud.google.com/go/internal/protostruct/protostruct_test.go @@ -0,0 +1,58 @@ +// Copyright 2017 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 protostruct supports operations on the protocol buffer Struct message. +package protostruct + +import ( + "testing" + + "cloud.google.com/go/internal/testutil" + pb "github.com/golang/protobuf/ptypes/struct" +) + +func TestDecodeToMap(t *testing.T) { + if got := DecodeToMap(nil); !testutil.Equal(got, map[string]interface{}(nil)) { + t.Errorf("DecodeToMap(nil) = %v, want nil", got) + } + nullv := &pb.Value{Kind: &pb.Value_NullValue{}} + stringv := &pb.Value{Kind: &pb.Value_StringValue{"x"}} + boolv := &pb.Value{Kind: &pb.Value_BoolValue{true}} + numberv := &pb.Value{Kind: &pb.Value_NumberValue{2.7}} + in := &pb.Struct{Fields: map[string]*pb.Value{ + "n": nullv, + "s": stringv, + "b": boolv, + "f": numberv, + "l": {Kind: &pb.Value_ListValue{&pb.ListValue{ + Values: []*pb.Value{nullv, stringv, boolv, numberv}, + }}}, + "S": {Kind: &pb.Value_StructValue{&pb.Struct{Fields: map[string]*pb.Value{ + "n1": nullv, + "b1": boolv, + }}}}, + }} + want := map[string]interface{}{ + "n": nil, + "s": "x", + "b": true, + "f": 2.7, + "l": []interface{}{nil, "x", true, 2.7}, + "S": map[string]interface{}{"n1": nil, "b1": true}, + } + got := DecodeToMap(in) + if diff := testutil.Diff(got, want); diff != "" { + t.Error(diff) + } +} diff --git a/vendor/cloud.google.com/go/internal/retry.go b/vendor/cloud.google.com/go/internal/retry.go new file mode 100644 index 000000000..99093cc46 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/retry.go @@ -0,0 +1,54 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" +) + +// Retry calls the supplied function f repeatedly according to the provided +// backoff parameters. It returns when one of the following occurs: +// When f's first return value is true, Retry immediately returns with f's second +// return value. +// When the provided context is done, Retry returns with an error that +// includes both ctx.Error() and the last error returned by f. +func Retry(ctx context.Context, bo gax.Backoff, f func() (stop bool, err error)) error { + return retry(ctx, bo, f, gax.Sleep) +} + +func retry(ctx context.Context, bo gax.Backoff, f func() (stop bool, err error), + sleep func(context.Context, time.Duration) error) error { + var lastErr error + for { + stop, err := f() + if stop { + return err + } + // Remember the last "real" error from f. + if err != nil && err != context.Canceled && err != context.DeadlineExceeded { + lastErr = err + } + p := bo.Pause() + if cerr := sleep(ctx, p); cerr != nil { + if lastErr != nil { + return Annotatef(lastErr, "retry failed with %v; last error", cerr) + } + return cerr + } + } +} diff --git a/vendor/cloud.google.com/go/internal/retry_test.go b/vendor/cloud.google.com/go/internal/retry_test.go new file mode 100644 index 000000000..367f52c91 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/retry_test.go @@ -0,0 +1,89 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "context" + "errors" + "fmt" + "testing" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestRetry(t *testing.T) { + ctx := context.Background() + // Without a context deadline, retry will run until the function + // says not to retry any more. + n := 0 + endRetry := errors.New("end retry") + err := retry(ctx, gax.Backoff{}, + func() (bool, error) { + n++ + if n < 10 { + return false, nil + } + return true, endRetry + }, + func(context.Context, time.Duration) error { return nil }) + if got, want := err, endRetry; got != want { + t.Errorf("got %v, want %v", err, endRetry) + } + if n != 10 { + t.Errorf("n: got %d, want %d", n, 10) + } + + // If the context has a deadline, sleep will return an error + // and end the function. + n = 0 + err = retry(ctx, gax.Backoff{}, + func() (bool, error) { return false, nil }, + func(context.Context, time.Duration) error { + n++ + if n < 10 { + return nil + } + return context.DeadlineExceeded + }) + if err == nil { + t.Error("got nil, want error") + } +} + +func TestRetryPreserveError(t *testing.T) { + // Retry tries to preserve the type and other information from + // the last error returned by the function. + err := retry(context.Background(), gax.Backoff{}, + func() (bool, error) { + return false, status.Error(codes.NotFound, "not found") + }, + func(context.Context, time.Duration) error { + return context.DeadlineExceeded + }) + got, ok := status.FromError(err) + if !ok { + t.Fatalf("got %T, wanted a status", got) + } + if g, w := got.Code(), codes.NotFound; g != w { + t.Errorf("got code %v, want %v", g, w) + } + wantMessage := fmt.Sprintf("retry failed with %v; last error: not found", context.DeadlineExceeded) + if g, w := got.Message(), wantMessage; g != w { + t.Errorf("got message %q, want %q", g, w) + } +} diff --git a/vendor/cloud.google.com/go/internal/snipdoc/README.md b/vendor/cloud.google.com/go/internal/snipdoc/README.md new file mode 100644 index 000000000..5d284296f --- /dev/null +++ b/vendor/cloud.google.com/go/internal/snipdoc/README.md @@ -0,0 +1,29 @@ +# Snipdoc + +Snipdoc is a simple tool for maintaining package documentation that contains +code samples. + +1. Create a subdirectory of your package to hold the following files. "internal" + is a good name. + +2. Write a template file (for example, "doc.template") with the text of your package documentation. The file +should look exactly like you want your doc.go file to look, except for code +snippets. +Instead of embedding a code snippet, write a line consisting solely of + + [NAME] + + for your choice of NAME. + +3. Write a snippets file (for example, "doc-snippets.go") as a valid Go source + file. Begin each snippet you'd like to appear in your package docs with + `//[ NAME` and end it with `//]`. + +4. Construct your doc.go file with the command + ``` + awk -f snipdoc.awk doc-snippets.go doc.template + ``` + The file "sample-makefile" in this directory verifies that the + snippets file compiles and safely constructs a doc.go file. + + diff --git a/vendor/cloud.google.com/go/internal/snipdoc/sample-makefile b/vendor/cloud.google.com/go/internal/snipdoc/sample-makefile new file mode 100644 index 000000000..6769cb36e --- /dev/null +++ b/vendor/cloud.google.com/go/internal/snipdoc/sample-makefile @@ -0,0 +1,16 @@ +# Build doc.go from template and snippets. + +SHELL=/bin/bash + +../doc.go: build doc-snippets.go doc.template snipdoc.awk + @tmp=$$(mktemp) && \ + awk -f snipdoc.awk doc-snippets.go doc.template > $$tmp && \ + chmod +w $@ && \ + mv $$tmp $@ && \ + chmod -w $@ + @echo "wrote $@" + +.PHONY: build + +build: + go build doc-snippets.go diff --git a/vendor/cloud.google.com/go/internal/snipdoc/snipdoc.awk b/vendor/cloud.google.com/go/internal/snipdoc/snipdoc.awk new file mode 100644 index 000000000..98e788ebd --- /dev/null +++ b/vendor/cloud.google.com/go/internal/snipdoc/snipdoc.awk @@ -0,0 +1,116 @@ +# Copyright 2017 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. + +# snipdoc merges code snippets from Go source files into a template to +# produce another go file (typically doc.go). +# +# Call with one or more .go files and a template file. +# +# awk -f snipmd.awk foo.go bar.go doc.template +# +# In the Go files, start a snippet with +# //[ NAME +# and end it with +# //] +# +# In the template, write +# [NAME] +# on a line by itself to insert the snippet NAME on that line. +# +# The following transformations are made to the Go code: +# - Trailing blank lines are removed. +# - `ELLIPSIS` and `_ = ELLIPSIS` are replaced by `...` + + +/^[ \t]*\/\/\[/ { # start snippet in Go file + if (inGo()) { + if ($2 == "") { + die("missing snippet name") + } + curSnip = $2 + next + } +} + +/^[ \t]*\/\/]/ { # end snippet in Go file + if (inGo()) { + if (curSnip != "") { + # Remove all trailing newlines. + gsub(/[\t\n]+$/, "", snips[curSnip]) + curSnip = "" + next + } else { + die("//] without corresponding //[") + } + } +} + +ENDFILE { + if (curSnip != "") { + die("unclosed snippet: " curSnip) + } +} + +/^\[.*\]$/ { # Snippet marker in template file. + if (inTemplate()) { + name = substr($1, 2, length($1)-2) + if (snips[name] == "") { + die("no snippet named " name) + } + printf("%s\n", snips[name]) + afterSnip = 1 + next + } +} + +# Matches every line. +{ + if (curSnip != "") { + # If the first line in the snip has no indent, add the indent. + if (snips[curSnip] == "") { + if (index($0, "\t") == 1) { + extraIndent = "" + } else { + extraIndent = "\t" + } + } + + line = $0 + # Replace ELLIPSIS. + gsub(/_ = ELLIPSIS/, "...", line) + gsub(/ELLIPSIS/, "...", line) + + snips[curSnip] = snips[curSnip] extraIndent line "\n" + } else if (inTemplate()) { + afterSnip = 0 + # Copy to output. + print + } +} + + + +function inTemplate() { + return match(FILENAME, /\.template$/) +} + +function inGo() { + return match(FILENAME, /\.go$/) +} + + +function die(msg) { + printf("%s:%d: %s\n", FILENAME, FNR, msg) > "/dev/stderr" + exit 1 +} diff --git a/vendor/cloud.google.com/go/internal/testutil/cmp.go b/vendor/cloud.google.com/go/internal/testutil/cmp.go new file mode 100644 index 000000000..9dd3d9111 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/testutil/cmp.go @@ -0,0 +1,61 @@ +// Copyright 2017 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 testutil + +import ( + "math" + "math/big" + + "github.com/golang/protobuf/proto" + "github.com/google/go-cmp/cmp" +) + +var ( + alwaysEqual = cmp.Comparer(func(_, _ interface{}) bool { return true }) + + defaultCmpOptions = []cmp.Option{ + // Use proto.Equal for protobufs + cmp.Comparer(proto.Equal), + // Use big.Rat.Cmp for big.Rats + cmp.Comparer(func(x, y *big.Rat) bool { + if x == nil || y == nil { + return x == y + } + return x.Cmp(y) == 0 + }), + // NaNs compare equal + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, alwaysEqual), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, alwaysEqual), + } +) + +// Equal tests two values for equality. +func Equal(x, y interface{}, opts ...cmp.Option) bool { + // Put default options at the end. Order doesn't matter. + opts = append(opts[:len(opts):len(opts)], defaultCmpOptions...) + return cmp.Equal(x, y, opts...) +} + +// Diff reports the differences between two values. +// Diff(x, y) == "" iff Equal(x, y). +func Diff(x, y interface{}, opts ...cmp.Option) string { + // Put default options at the end. Order doesn't matter. + opts = append(opts[:len(opts):len(opts)], defaultCmpOptions...) + return cmp.Diff(x, y, opts...) +} diff --git a/vendor/cloud.google.com/go/internal/testutil/context.go b/vendor/cloud.google.com/go/internal/testutil/context.go new file mode 100644 index 000000000..93797fa42 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/testutil/context.go @@ -0,0 +1,106 @@ +// 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 testutil contains helper functions for writing tests. +package testutil + +import ( + "context" + "fmt" + "io/ioutil" + "log" + "os" + + "golang.org/x/oauth2" + "golang.org/x/oauth2/google" + "golang.org/x/oauth2/jwt" +) + +const ( + envProjID = "GCLOUD_TESTS_GOLANG_PROJECT_ID" + envPrivateKey = "GCLOUD_TESTS_GOLANG_KEY" +) + +// ProjID returns the project ID to use in integration tests, or the empty +// string if none is configured. +func ProjID() string { + return os.Getenv(envProjID) +} + +// TokenSource returns the OAuth2 token source to use in integration tests, +// or nil if none is configured. It uses the standard environment variable +// for tests in this repo. +func TokenSource(ctx context.Context, scopes ...string) oauth2.TokenSource { + return TokenSourceEnv(ctx, envPrivateKey, scopes...) +} + +// TokenSourceEnv returns the OAuth2 token source to use in integration tests. or nil +// if none is configured. It tries to get credentials from the filename in the +// environment variable envVar. If the environment variable is unset, TokenSourceEnv +// will try to find 'Application Default Credentials'. Else, TokenSourceEnv will +// return nil. TokenSourceEnv will log.Fatal if the token source is specified but +// missing or invalid. +func TokenSourceEnv(ctx context.Context, envVar string, scopes ...string) oauth2.TokenSource { + key := os.Getenv(envVar) + if key == "" { // Try for application default credentials. + ts, err := google.DefaultTokenSource(ctx, scopes...) + if err != nil { + log.Println("No 'Application Default Credentials' found.") + return nil + } + return ts + } + conf, err := jwtConfigFromFile(key, scopes) + if err != nil { + log.Fatal(err) + } + return conf.TokenSource(ctx) +} + +// JWTConfig reads the JSON private key file whose name is in the default +// environment variable, and returns the jwt.Config it contains. It ignores +// scopes. +// If the environment variable is empty, it returns (nil, nil). +func JWTConfig() (*jwt.Config, error) { + return jwtConfigFromFile(os.Getenv(envPrivateKey), nil) +} + +// jwtConfigFromFile reads the given JSON private key file, and returns the +// jwt.Config it contains. +// If the filename is empty, it returns (nil, nil). +func jwtConfigFromFile(filename string, scopes []string) (*jwt.Config, error) { + if filename == "" { + return nil, nil + } + jsonKey, err := ioutil.ReadFile(filename) + if err != nil { + return nil, fmt.Errorf("Cannot read the JSON key file, err: %v", err) + } + conf, err := google.JWTConfigFromJSON(jsonKey, scopes...) + if err != nil { + return nil, fmt.Errorf("google.JWTConfigFromJSON: %v", err) + } + return conf, nil +} + +// CanReplay reports whether an integration test can be run in replay mode. +// The replay file must exist, and the GCLOUD_TESTS_GOLANG_ENABLE_REPLAY +// environment variable must be non-empty. +func CanReplay(replayFilename string) bool { + if os.Getenv("GCLOUD_TESTS_GOLANG_ENABLE_REPLAY") == "" { + return false + } + _, err := os.Stat(replayFilename) + return err == nil +} diff --git a/vendor/cloud.google.com/go/internal/testutil/rand.go b/vendor/cloud.google.com/go/internal/testutil/rand.go new file mode 100644 index 000000000..57d6c1403 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/testutil/rand.go @@ -0,0 +1,44 @@ +// 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. + +package testutil + +import ( + "math/rand" + "sync" + "time" +) + +// NewRand creates a new *rand.Rand seeded with t. The return value is safe for use +// with multiple goroutines. +func NewRand(t time.Time) *rand.Rand { + s := &lockedSource{src: rand.NewSource(t.UnixNano())} + return rand.New(s) +} + +// lockedSource makes a rand.Source safe for use by multiple goroutines. +type lockedSource struct { + mu sync.Mutex + src rand.Source +} + +func (ls *lockedSource) Int63() int64 { + ls.mu.Lock() + defer ls.mu.Unlock() + return ls.src.Int63() +} + +func (ls *lockedSource) Seed(int64) { + panic("shouldn't be calling Seed") +} diff --git a/vendor/cloud.google.com/go/internal/testutil/server.go b/vendor/cloud.google.com/go/internal/testutil/server.go new file mode 100644 index 000000000..d8b8649e2 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/testutil/server.go @@ -0,0 +1,135 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package testutil + +import ( + "fmt" + "log" + "net" + "regexp" + "strconv" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// A Server is an in-process gRPC server, listening on a system-chosen port on +// the local loopback interface. Servers are for testing only and are not +// intended to be used in production code. +// +// To create a server, make a new Server, register your handlers, then call +// Start: +// +// srv, err := NewServer() +// ... +// mypb.RegisterMyServiceServer(srv.Gsrv, &myHandler) +// .... +// srv.Start() +// +// Clients should connect to the server with no security: +// +// conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure()) +// ... +type Server struct { + Addr string + Port int + l net.Listener + Gsrv *grpc.Server +} + +// NewServer creates a new Server. The Server will be listening for gRPC connections +// at the address named by the Addr field, without TLS. +func NewServer(opts ...grpc.ServerOption) (*Server, error) { + return NewServerWithPort(0, opts...) +} + +// NewServerWithPort creates a new Server at a specific port. The Server will be listening +// for gRPC connections at the address named by the Addr field, without TLS. +func NewServerWithPort(port int, opts ...grpc.ServerOption) (*Server, error) { + l, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port)) + if err != nil { + return nil, err + } + s := &Server{ + Addr: l.Addr().String(), + Port: parsePort(l.Addr().String()), + l: l, + Gsrv: grpc.NewServer(opts...), + } + return s, nil +} + +// Start causes the server to start accepting incoming connections. +// Call Start after registering handlers. +func (s *Server) Start() { + go func() { + if err := s.Gsrv.Serve(s.l); err != nil { + log.Printf("testutil.Server.Start: %v", err) + } + }() +} + +// Close shuts down the server. +func (s *Server) Close() { + s.Gsrv.Stop() + s.l.Close() +} + +// PageBounds converts an incoming page size and token from an RPC request into +// slice bounds and the outgoing next-page token. +// +// PageBounds assumes that the complete, unpaginated list of items exists as a +// single slice. In addition to the page size and token, PageBounds needs the +// length of that slice. +// +// PageBounds's first two return values should be used to construct a sub-slice of +// the complete, unpaginated slice. E.g. if the complete slice is s, then +// s[from:to] is the desired page. Its third return value should be set as the +// NextPageToken field of the RPC response. +func PageBounds(pageSize int, pageToken string, length int) (from, to int, nextPageToken string, err error) { + from, to = 0, length + if pageToken != "" { + from, err = strconv.Atoi(pageToken) + if err != nil { + return 0, 0, "", status.Errorf(codes.InvalidArgument, "bad page token: %v", err) + } + if from >= length { + return length, length, "", nil + } + } + if pageSize > 0 && from+pageSize < length { + to = from + pageSize + nextPageToken = strconv.Itoa(to) + } + return from, to, nextPageToken, nil +} + +var portParser = regexp.MustCompile(`:[0-9]+`) + +func parsePort(addr string) int { + res := portParser.FindAllString(addr, -1) + if len(res) == 0 { + panic(fmt.Errorf("parsePort: found no numbers in %s", addr)) + } + stringPort := res[0][1:] // strip the : + p, err := strconv.ParseInt(stringPort, 10, 32) + if err != nil { + panic(err) + } + return int(p) +} diff --git a/vendor/cloud.google.com/go/internal/testutil/server_test.go b/vendor/cloud.google.com/go/internal/testutil/server_test.go new file mode 100644 index 000000000..1bb4c2768 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/testutil/server_test.go @@ -0,0 +1,79 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package testutil + +import ( + "testing" + + grpc "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +func TestNewServer(t *testing.T) { + srv, err := NewServer() + if err != nil { + t.Fatal(err) + } + defer srv.Close() + srv.Start() + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure()) + if err != nil { + t.Fatal(err) + } + defer conn.Close() +} + +func TestPageBounds(t *testing.T) { + const length = 10 + for _, test := range []struct { + size int + tok string + wantFrom int + wantTo int + wantTok string + }{ + {5, "", + 0, 5, "5"}, + {11, "", + 0, 10, ""}, + {5, "2", + 2, 7, "7"}, + {5, "8", + 8, 10, ""}, + {11, "8", + 8, 10, ""}, + {1, "11", + 10, 10, ""}, + } { + gotFrom, gotTo, gotTok, err := PageBounds(test.size, test.tok, length) + if err != nil { + t.Fatal(err) + } + if got, want := gotFrom, test.wantFrom; got != want { + t.Errorf("%+v: from: got %d, want %d", test, got, want) + } + if got, want := gotTo, test.wantTo; got != want { + t.Errorf("%+v: to: got %d, want %d", test, got, want) + } + if got, want := gotTok, test.wantTok; got != want { + t.Errorf("%+v: got %q, want %q", test, got, want) + } + } + + _, _, _, err := PageBounds(4, "xyz", 5) + if grpc.Code(err) != codes.InvalidArgument { + t.Errorf("want invalid argument, got <%v>", err) + } +} diff --git a/vendor/cloud.google.com/go/internal/testutil/trace.go b/vendor/cloud.google.com/go/internal/testutil/trace.go new file mode 100644 index 000000000..b0a7b7755 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/testutil/trace.go @@ -0,0 +1,68 @@ +// 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. + +package testutil + +import ( + "log" + "time" + + "go.opencensus.io/plugin/ocgrpc" + "go.opencensus.io/stats/view" + "go.opencensus.io/trace" +) + +// TestExporter is a test utility exporter. It should be created with NewtestExporter. +type TestExporter struct { + Spans []*trace.SpanData + Stats chan *view.Data +} + +// NewTestExporter creates a TestExporter and registers it with OpenCensus. +func NewTestExporter() *TestExporter { + te := &TestExporter{Stats: make(chan *view.Data)} + + view.RegisterExporter(te) + view.SetReportingPeriod(time.Millisecond) + if err := view.Register(ocgrpc.DefaultClientViews...); err != nil { + log.Fatal(err) + } + + trace.RegisterExporter(te) + trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()}) + + return te +} + +// ExportSpan exports a span. +func (te *TestExporter) ExportSpan(s *trace.SpanData) { + te.Spans = append(te.Spans, s) +} + +// ExportView exports a view. +func (te *TestExporter) ExportView(vd *view.Data) { + if len(vd.Rows) > 0 { + select { + case te.Stats <- vd: + default: + } + } +} + +// Unregister unregisters the exporter from OpenCensus. +func (te *TestExporter) Unregister() { + view.UnregisterExporter(te) + trace.UnregisterExporter(te) + view.SetReportingPeriod(0) // reset to default value +} diff --git a/vendor/cloud.google.com/go/internal/trace/trace.go b/vendor/cloud.google.com/go/internal/trace/trace.go new file mode 100644 index 000000000..95c7821c2 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/trace/trace.go @@ -0,0 +1,84 @@ +// 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. + +package trace + +import ( + "context" + + "go.opencensus.io/trace" + "google.golang.org/api/googleapi" + "google.golang.org/genproto/googleapis/rpc/code" + "google.golang.org/grpc/status" +) + +// StartSpan adds a span to the trace with the given name. +func StartSpan(ctx context.Context, name string) context.Context { + ctx, _ = trace.StartSpan(ctx, name) + return ctx +} + +// EndSpan ends a span with the given error. +func EndSpan(ctx context.Context, err error) { + span := trace.FromContext(ctx) + if err != nil { + span.SetStatus(toStatus(err)) + } + span.End() +} + +// ToStatus interrogates an error and converts it to an appropriate +// OpenCensus status. +func toStatus(err error) trace.Status { + if err2, ok := err.(*googleapi.Error); ok { + return trace.Status{Code: httpStatusCodeToOCCode(err2.Code), Message: err2.Message} + } else if s, ok := status.FromError(err); ok { + return trace.Status{Code: int32(s.Code()), Message: s.Message()} + } else { + return trace.Status{Code: int32(code.Code_UNKNOWN), Message: err.Error()} + } +} + +// TODO (deklerk): switch to using OpenCensus function when it becomes available. +// Reference: https://github.com/googleapis/googleapis/blob/26b634d2724ac5dd30ae0b0cbfb01f07f2e4050e/google/rpc/code.proto +func httpStatusCodeToOCCode(httpStatusCode int) int32 { + switch httpStatusCode { + case 200: + return int32(code.Code_OK) + case 499: + return int32(code.Code_CANCELLED) + case 500: + return int32(code.Code_UNKNOWN) // Could also be Code_INTERNAL, Code_DATA_LOSS + case 400: + return int32(code.Code_INVALID_ARGUMENT) // Could also be Code_OUT_OF_RANGE + case 504: + return int32(code.Code_DEADLINE_EXCEEDED) + case 404: + return int32(code.Code_NOT_FOUND) + case 409: + return int32(code.Code_ALREADY_EXISTS) // Could also be Code_ABORTED + case 403: + return int32(code.Code_PERMISSION_DENIED) + case 401: + return int32(code.Code_UNAUTHENTICATED) + case 429: + return int32(code.Code_RESOURCE_EXHAUSTED) + case 501: + return int32(code.Code_UNIMPLEMENTED) + case 503: + return int32(code.Code_UNAVAILABLE) + default: + return int32(code.Code_UNKNOWN) + } +} diff --git a/vendor/cloud.google.com/go/internal/trace/trace_test.go b/vendor/cloud.google.com/go/internal/trace/trace_test.go new file mode 100644 index 000000000..2af9fb8be --- /dev/null +++ b/vendor/cloud.google.com/go/internal/trace/trace_test.go @@ -0,0 +1,53 @@ +// 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. + +package trace + +import ( + "errors" + "net/http" + "testing" + + "cloud.google.com/go/internal/testutil" + octrace "go.opencensus.io/trace" + "google.golang.org/api/googleapi" + "google.golang.org/genproto/googleapis/rpc/code" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestToStatus(t *testing.T) { + for _, testcase := range []struct { + input error + want octrace.Status + }{ + { + errors.New("some random error"), + octrace.Status{Code: int32(code.Code_UNKNOWN), Message: "some random error"}, + }, + { + &googleapi.Error{Code: http.StatusConflict, Message: "some specific googleapi http error"}, + octrace.Status{Code: int32(code.Code_ALREADY_EXISTS), Message: "some specific googleapi http error"}, + }, + { + status.Error(codes.DataLoss, "some specific grpc error"), + octrace.Status{Code: int32(code.Code_DATA_LOSS), Message: "some specific grpc error"}, + }, + } { + got := toStatus(testcase.input) + if r := testutil.Diff(got, testcase.want); r != "" { + t.Errorf("got -, want +:\n%s", r) + } + } +} diff --git a/vendor/cloud.google.com/go/internal/tracecontext/tracecontext.go b/vendor/cloud.google.com/go/internal/tracecontext/tracecontext.go new file mode 100644 index 000000000..827ace2e0 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/tracecontext/tracecontext.go @@ -0,0 +1,83 @@ +// Copyright 2017 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 tracecontext provides encoders and decoders for Stackdriver Trace contexts. +package tracecontext + +import "encoding/binary" + +const ( + versionID = 0 + traceIDField = 0 + spanIDField = 1 + optsField = 2 + + traceIDLen = 16 + spanIDLen = 8 + optsLen = 1 + + // Len represents the length of trace context. + Len = 1 + 1 + traceIDLen + 1 + spanIDLen + 1 + optsLen +) + +// Encode encodes trace ID, span ID and options into dst. The number of bytes +// written will be returned. If len(dst) isn't big enough to fit the trace context, +// a negative number is returned. +func Encode(dst []byte, traceID []byte, spanID uint64, opts byte) (n int) { + if len(dst) < Len { + return -1 + } + var offset = 0 + putByte := func(b byte) { dst[offset] = b; offset++ } + putUint64 := func(u uint64) { binary.LittleEndian.PutUint64(dst[offset:], u); offset += 8 } + + putByte(versionID) + putByte(traceIDField) + for _, b := range traceID { + putByte(b) + } + putByte(spanIDField) + putUint64(spanID) + putByte(optsField) + putByte(opts) + + return offset +} + +// Decode decodes the src into a trace ID, span ID and options. If src doesn't +// contain a valid trace context, ok = false is returned. +func Decode(src []byte) (traceID []byte, spanID uint64, opts byte, ok bool) { + if len(src) < Len { + return traceID, spanID, 0, false + } + var offset = 0 + readByte := func() byte { b := src[offset]; offset++; return b } + readUint64 := func() uint64 { v := binary.LittleEndian.Uint64(src[offset:]); offset += 8; return v } + + if readByte() != versionID { + return traceID, spanID, 0, false + } + for offset < len(src) { + switch readByte() { + case traceIDField: + traceID = src[offset : offset+traceIDLen] + offset += traceIDLen + case spanIDField: + spanID = readUint64() + case optsField: + opts = readByte() + } + } + return traceID, spanID, opts, true +} diff --git a/vendor/cloud.google.com/go/internal/tracecontext/tracecontext_test.go b/vendor/cloud.google.com/go/internal/tracecontext/tracecontext_test.go new file mode 100644 index 000000000..60c27b554 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/tracecontext/tracecontext_test.go @@ -0,0 +1,136 @@ +// 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 tracecontext + +import ( + "testing" + + "cloud.google.com/go/internal/testutil" +) + +var validData = []byte{0, 0, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 1, 97, 98, 99, 100, 101, 102, 103, 104, 2, 1} + +func TestDecode(t *testing.T) { + tests := []struct { + name string + data []byte + wantTraceID []byte + wantSpanID uint64 + wantOpts byte + wantOk bool + }{ + { + name: "nil data", + data: nil, + wantTraceID: nil, + wantSpanID: 0, + wantOpts: 0, + wantOk: false, + }, + { + name: "short data", + data: []byte{0, 0, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77}, + wantTraceID: nil, + wantSpanID: 0, + wantOpts: 0, + wantOk: false, + }, + { + name: "wrong field number", + data: []byte{0, 1, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77}, + wantTraceID: nil, + wantSpanID: 0, + wantOpts: 0, + wantOk: false, + }, + { + name: "valid data", + data: validData, + wantTraceID: []byte{64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79}, + wantSpanID: 0x6867666564636261, + wantOpts: 1, + wantOk: true, + }, + } + for _, tt := range tests { + gotTraceID, gotSpanID, gotOpts, gotOk := Decode(tt.data) + if !testutil.Equal(gotTraceID, tt.wantTraceID) { + t.Errorf("%s: Decode() gotTraceID = %v, want %v", tt.name, gotTraceID, tt.wantTraceID) + } + if gotSpanID != tt.wantSpanID { + t.Errorf("%s: Decode() gotSpanID = %v, want %v", tt.name, gotSpanID, tt.wantSpanID) + } + if gotOpts != tt.wantOpts { + t.Errorf("%s: Decode() gotOpts = %v, want %v", tt.name, gotOpts, tt.wantOpts) + } + if gotOk != tt.wantOk { + t.Errorf("%s: Decode() gotOk = %v, want %v", tt.name, gotOk, tt.wantOk) + } + } +} + +func TestEncode(t *testing.T) { + tests := []struct { + name string + dst []byte + traceID []byte + spanID uint64 + opts byte + wantN int + wantData []byte + }{ + { + name: "short data", + dst: make([]byte, 0), + traceID: []byte("00112233445566"), + spanID: 0x6867666564636261, + opts: 1, + wantN: -1, + wantData: make([]byte, 0), + }, + { + name: "valid data", + dst: make([]byte, Len), + traceID: []byte{64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79}, + spanID: 0x6867666564636261, + opts: 1, + wantN: Len, + wantData: validData, + }, + } + for _, tt := range tests { + gotN := Encode(tt.dst, tt.traceID, tt.spanID, tt.opts) + if gotN != tt.wantN { + t.Errorf("%s: n = %v, want %v", tt.name, gotN, tt.wantN) + } + if gotData := tt.dst; !testutil.Equal(gotData, tt.wantData) { + t.Errorf("%s: dst = %v, want %v", tt.name, gotData, tt.wantData) + } + } +} + +func BenchmarkDecode(b *testing.B) { + for i := 0; i < b.N; i++ { + Decode(validData) + } +} + +func BenchmarkEncode(b *testing.B) { + for i := 0; i < b.N; i++ { + traceID := make([]byte, 16) + var opts byte + Encode(validData, traceID, 0, opts) + } +} diff --git a/vendor/cloud.google.com/go/internal/uid/uid.go b/vendor/cloud.google.com/go/internal/uid/uid.go new file mode 100644 index 000000000..2f229d647 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/uid/uid.go @@ -0,0 +1,149 @@ +// Copyright 2017 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 uid supports generating unique IDs. Its chief purpose is to prevent +// multiple test executions from interfering with each other, and to facilitate +// cleanup of old entities that may remain if tests exit early. +package uid + +import ( + "fmt" + "regexp" + "strconv" + "sync/atomic" + "time" +) + +// A Space manages a set of unique IDs distinguished by a prefix. +type Space struct { + Prefix string // Prefix of UIDs. Read-only. + Sep rune // Separates UID parts. Read-only. + Time time.Time // Timestamp for UIDs. Read-only. + re *regexp.Regexp + count int32 // atomic + short bool +} + +// Options are optional values for a Space. +type Options struct { + Sep rune // Separates parts of the UID. Defaults to '-'. + Time time.Time // Timestamp for all UIDs made with this space. Defaults to current time. + + // Short, if true, makes the result of space.New shorter by 6 characters. + // This can be useful for character restricted IDs. It will use a shorter + // but less readable time representation, and will only use two characters + // for the count suffix instead of four. + // + // e.x. normal: gotest-20181030-59751273685000-0001 + // e.x. short: gotest-1540917351273685000-01 + Short bool +} + +// NewSpace creates a new UID space. A UID Space is used to generate unique IDs. +func NewSpace(prefix string, opts *Options) *Space { + var short bool + sep := '-' + tm := time.Now().UTC() + if opts != nil { + short = opts.Short + if opts.Sep != 0 { + sep = opts.Sep + } + if !opts.Time.IsZero() { + tm = opts.Time + } + } + var re string + + if short { + re = fmt.Sprintf(`^%s%[2]c(\d+)%[2]c\d+$`, regexp.QuoteMeta(prefix), sep) + } else { + re = fmt.Sprintf(`^%s%[2]c(\d{4})(\d{2})(\d{2})%[2]c(\d+)%[2]c\d+$`, + regexp.QuoteMeta(prefix), sep) + } + + return &Space{ + Prefix: prefix, + Sep: sep, + Time: tm, + re: regexp.MustCompile(re), + short: short, + } +} + +// New generates a new unique ID. The ID consists of the Space's prefix, a +// timestamp, and a counter value. All unique IDs generated in the same test +// execution will have the same timestamp. +// +// Aside from the characters in the prefix, IDs contain only letters, numbers +// and sep. +func (s *Space) New() string { + c := atomic.AddInt32(&s.count, 1) + + if s.short && c > 99 { + // Short spaces only have space for 99 IDs. (two characters) + panic("Short space called New more than 99 times. Ran out of IDs.") + } else if c > 9999 { + // Spaces only have space for 9999 IDs. (four characters) + panic("New called more than 9999 times. Ran out of IDs.") + } + + if s.short { + return fmt.Sprintf("%s%c%d%c%02d", s.Prefix, s.Sep, s.Time.UnixNano(), s.Sep, c) + } + + // Write the time as a date followed by nanoseconds from midnight of that date. + // That makes it easier to see the approximate time of the ID when it is displayed. + y, m, d := s.Time.Date() + ns := s.Time.Sub(time.Date(y, m, d, 0, 0, 0, 0, time.UTC)) + // Zero-pad the counter for lexical sort order for IDs with the same timestamp. + return fmt.Sprintf("%s%c%04d%02d%02d%c%d%c%04d", + s.Prefix, s.Sep, y, m, d, s.Sep, ns, s.Sep, c) +} + +// Timestamp extracts the timestamp of uid, which must have been generated by +// s. The second return value is true on success, false if there was a problem. +func (s *Space) Timestamp(uid string) (time.Time, bool) { + subs := s.re.FindStringSubmatch(uid) + if subs == nil { + return time.Time{}, false + } + + if s.short { + ns, err := strconv.ParseInt(subs[1], 10, 64) + if err != nil { + return time.Time{}, false + } + return time.Unix(ns/1e9, ns%1e9), true + } + + y, err1 := strconv.Atoi(subs[1]) + m, err2 := strconv.Atoi(subs[2]) + d, err3 := strconv.Atoi(subs[3]) + ns, err4 := strconv.Atoi(subs[4]) + if err1 != nil || err2 != nil || err3 != nil || err4 != nil { + return time.Time{}, false + } + return time.Date(y, time.Month(m), d, 0, 0, 0, ns, time.UTC), true +} + +// Older reports whether uid was created by m and has a timestamp older than +// the current time by at least d. +func (s *Space) Older(uid string, d time.Duration) bool { + ts, ok := s.Timestamp(uid) + if !ok { + return false + } + return time.Since(ts) > d +} diff --git a/vendor/cloud.google.com/go/internal/uid/uid_test.go b/vendor/cloud.google.com/go/internal/uid/uid_test.go new file mode 100644 index 000000000..5a4a85a58 --- /dev/null +++ b/vendor/cloud.google.com/go/internal/uid/uid_test.go @@ -0,0 +1,88 @@ +// Copyright 2017 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 uid + +import ( + "fmt" + "testing" + "time" +) + +func TestNew(t *testing.T) { + tm := time.Date(2017, 1, 6, 0, 0, 0, 21, time.UTC) + s := NewSpace("prefix", &Options{Time: tm}) + got := s.New() + want := "prefix-20170106-21-0001" + if got != want { + t.Errorf("got %q, want %q", got, want) + } + + s2 := NewSpace("prefix2", &Options{Sep: '_', Time: tm}) + got = s2.New() + want = "prefix2_20170106_21_0001" + if got != want { + t.Errorf("got %q, want %q", got, want) + } +} + +func TestTimestamp(t *testing.T) { + s := NewSpace("unique-ID", nil) + startTime := s.Time + uid := s.New() + got, ok := s.Timestamp(uid) + if !ok { + t.Fatal("got ok = false, want true") + } + if !startTime.Equal(got) { + t.Errorf("got %s, want %s", got, startTime) + } + + got, ok = s.Timestamp("unique-ID-20160308-123-8") + if !ok { + t.Fatal("got false, want true") + } + if want := time.Date(2016, 3, 8, 0, 0, 0, 123, time.UTC); !want.Equal(got) { + t.Errorf("got %s, want %s", got, want) + } + if _, ok = s.Timestamp("invalid-time-1234"); ok { + t.Error("got true, want false") + } +} + +func TestOlder(t *testing.T) { + s := NewSpace("uid", nil) + // A non-matching ID returns false. + id2 := NewSpace("different-prefix", nil).New() + if got, want := s.Older(id2, time.Second), false; got != want { + t.Errorf("got %t, want %t", got, want) + } +} + +func TestShorter(t *testing.T) { + now := time.Now() + shortSpace := NewSpace("uid", &Options{Short: true, Time: now}) + shortUID := shortSpace.New() + + want := fmt.Sprintf("uid-%d-01", now.UnixNano()) + if shortUID != want { + t.Fatalf("expected %s, got %s", want, shortUID) + } + + if got, ok := shortSpace.Timestamp(shortUID); !ok { + t.Fatal("expected to be able to parse timestamp from short space, but was unable to") + } else if got.UnixNano() != now.UnixNano() { + t.Fatalf("expected to get %v, got %v", now, got) + } +} diff --git a/vendor/cloud.google.com/go/internal/version/update_version.sh b/vendor/cloud.google.com/go/internal/version/update_version.sh new file mode 100755 index 000000000..fecf1f03f --- /dev/null +++ b/vendor/cloud.google.com/go/internal/version/update_version.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +today=$(date +%Y%m%d) + +sed -i -r -e 's/const Repo = "([0-9]{8})"/const Repo = "'$today'"/' $GOFILE + diff --git a/vendor/cloud.google.com/go/internal/version/version.go b/vendor/cloud.google.com/go/internal/version/version.go new file mode 100644 index 000000000..220f02c1e --- /dev/null +++ b/vendor/cloud.google.com/go/internal/version/version.go @@ -0,0 +1,71 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:generate ./update_version.sh + +// Package version contains version information for Google Cloud Client +// Libraries for Go, as reported in request headers. +package version + +import ( + "runtime" + "strings" + "unicode" +) + +// Repo is the current version of the client libraries in this +// repo. It should be a date in YYYYMMDD format. +const Repo = "20180226" + +// Go returns the Go runtime version. The returned string +// has no whitespace. +func Go() string { + return goVersion +} + +var goVersion = goVer(runtime.Version()) + +const develPrefix = "devel +" + +func goVer(s string) string { + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "" +} + +func notSemverRune(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 +} diff --git a/vendor/cloud.google.com/go/internal/version/version_test.go b/vendor/cloud.google.com/go/internal/version/version_test.go new file mode 100644 index 000000000..6253db8fc --- /dev/null +++ b/vendor/cloud.google.com/go/internal/version/version_test.go @@ -0,0 +1,35 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version + +import "testing" + +func TestGoVer(t *testing.T) { + for _, tst := range []struct { + in, want string + }{ + {"go1.8", "1.8.0"}, + {"go1.7.3", "1.7.3"}, + {"go1.8.typealias", "1.8.0-typealias"}, + {"go1.8beta1", "1.8.0-beta1"}, + {"go1.8rc2", "1.8.0-rc2"}, + {"devel +824f981dd4b7 Tue Apr 29 21:41:54 2014 -0400", "824f981dd4b7"}, + {"foo bar zipzap", ""}, + } { + if got := goVer(tst.in); got != tst.want { + t.Errorf("goVer(%q) = %q, want %q", tst.in, got, tst.want) + } + } +} 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 000000000..e2ccef3e7 --- /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/keys.tar.enc b/vendor/cloud.google.com/go/keys.tar.enc new file mode 100644 index 000000000..c54408c93 Binary files /dev/null and b/vendor/cloud.google.com/go/keys.tar.enc differ diff --git a/vendor/cloud.google.com/go/kms/apiv1/doc.go b/vendor/cloud.google.com/go/kms/apiv1/doc.go new file mode 100644 index 000000000..2769e7f5d --- /dev/null +++ b/vendor/cloud.google.com/go/kms/apiv1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package kms is an auto-generated package for the +// Cloud Key Management Service (KMS) API. + +// +// Manages keys and performs cryptographic operations in a central cloud +// service, for direct use by other cloud resources and applications. +package kms // import "cloud.google.com/go/kms/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/kms/apiv1/iam.go b/vendor/cloud.google.com/go/kms/apiv1/iam.go new file mode 100644 index 000000000..8c572a98e --- /dev/null +++ b/vendor/cloud.google.com/go/kms/apiv1/iam.go @@ -0,0 +1,30 @@ +// 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 +// +// https://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 kms + +import ( + "cloud.google.com/go/iam" + kmspb "google.golang.org/genproto/googleapis/cloud/kms/v1" +) + +// KeyRingIAM returns a handle to inspect and change permissions of a KeyRing. +func (c *KeyManagementClient) KeyRingIAM(keyRing *kmspb.KeyRing) *iam.Handle { + return iam.InternalNewHandle(c.Connection(), keyRing.Name) +} + +// CryptoKeyIAM returns a handle to inspect and change permissions of a CryptoKey. +func (c *KeyManagementClient) CryptoKeyIAM(cryptoKey *kmspb.CryptoKey) *iam.Handle { + return iam.InternalNewHandle(c.Connection(), cryptoKey.Name) +} diff --git a/vendor/cloud.google.com/go/kms/apiv1/key_management_client.go b/vendor/cloud.google.com/go/kms/apiv1/key_management_client.go new file mode 100644 index 000000000..a7a8b9e83 --- /dev/null +++ b/vendor/cloud.google.com/go/kms/apiv1/key_management_client.go @@ -0,0 +1,725 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package kms + +import ( + "context" + "fmt" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + kmspb "google.golang.org/genproto/googleapis/cloud/kms/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// KeyManagementCallOptions contains the retry settings for each method of KeyManagementClient. +type KeyManagementCallOptions struct { + ListKeyRings []gax.CallOption + ListCryptoKeys []gax.CallOption + ListCryptoKeyVersions []gax.CallOption + GetKeyRing []gax.CallOption + GetCryptoKey []gax.CallOption + GetCryptoKeyVersion []gax.CallOption + CreateKeyRing []gax.CallOption + CreateCryptoKey []gax.CallOption + CreateCryptoKeyVersion []gax.CallOption + UpdateCryptoKey []gax.CallOption + UpdateCryptoKeyVersion []gax.CallOption + Encrypt []gax.CallOption + Decrypt []gax.CallOption + UpdateCryptoKeyPrimaryVersion []gax.CallOption + DestroyCryptoKeyVersion []gax.CallOption + RestoreCryptoKeyVersion []gax.CallOption + GetPublicKey []gax.CallOption + AsymmetricDecrypt []gax.CallOption + AsymmetricSign []gax.CallOption +} + +func defaultKeyManagementClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cloudkms.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultKeyManagementCallOptions() *KeyManagementCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &KeyManagementCallOptions{ + ListKeyRings: retry[[2]string{"default", "idempotent"}], + ListCryptoKeys: retry[[2]string{"default", "idempotent"}], + ListCryptoKeyVersions: retry[[2]string{"default", "idempotent"}], + GetKeyRing: retry[[2]string{"default", "idempotent"}], + GetCryptoKey: retry[[2]string{"default", "idempotent"}], + GetCryptoKeyVersion: retry[[2]string{"default", "idempotent"}], + CreateKeyRing: retry[[2]string{"default", "non_idempotent"}], + CreateCryptoKey: retry[[2]string{"default", "non_idempotent"}], + CreateCryptoKeyVersion: retry[[2]string{"default", "non_idempotent"}], + UpdateCryptoKey: retry[[2]string{"default", "non_idempotent"}], + UpdateCryptoKeyVersion: retry[[2]string{"default", "non_idempotent"}], + Encrypt: retry[[2]string{"default", "non_idempotent"}], + Decrypt: retry[[2]string{"default", "non_idempotent"}], + UpdateCryptoKeyPrimaryVersion: retry[[2]string{"default", "non_idempotent"}], + DestroyCryptoKeyVersion: retry[[2]string{"default", "non_idempotent"}], + RestoreCryptoKeyVersion: retry[[2]string{"default", "non_idempotent"}], + GetPublicKey: retry[[2]string{"default", "idempotent"}], + AsymmetricDecrypt: retry[[2]string{"default", "non_idempotent"}], + AsymmetricSign: retry[[2]string{"default", "non_idempotent"}], + } +} + +// KeyManagementClient is a client for interacting with Cloud Key Management Service (KMS) API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type KeyManagementClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + keyManagementClient kmspb.KeyManagementServiceClient + + // The call options for this service. + CallOptions *KeyManagementCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewKeyManagementClient creates a new key management service client. +// +// Google Cloud Key Management Service +// +// Manages cryptographic keys and operations using those keys. Implements a REST +// model with the following objects: +// +// [KeyRing][google.cloud.kms.v1.KeyRing] +// +// [CryptoKey][google.cloud.kms.v1.CryptoKey] +// +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] +// +// If you are using manual gRPC libraries, see +// Using gRPC with Cloud KMS (at https://cloud.google.com/kms/docs/grpc). +func NewKeyManagementClient(ctx context.Context, opts ...option.ClientOption) (*KeyManagementClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultKeyManagementClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &KeyManagementClient{ + conn: conn, + CallOptions: defaultKeyManagementCallOptions(), + + keyManagementClient: kmspb.NewKeyManagementServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *KeyManagementClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *KeyManagementClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *KeyManagementClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListKeyRings lists [KeyRings][google.cloud.kms.v1.KeyRing]. +func (c *KeyManagementClient) ListKeyRings(ctx context.Context, req *kmspb.ListKeyRingsRequest, opts ...gax.CallOption) *KeyRingIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListKeyRings[0:len(c.CallOptions.ListKeyRings):len(c.CallOptions.ListKeyRings)], opts...) + it := &KeyRingIterator{} + req = proto.Clone(req).(*kmspb.ListKeyRingsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*kmspb.KeyRing, string, error) { + var resp *kmspb.ListKeyRingsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.ListKeyRings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.KeyRings, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListCryptoKeys lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. +func (c *KeyManagementClient) ListCryptoKeys(ctx context.Context, req *kmspb.ListCryptoKeysRequest, opts ...gax.CallOption) *CryptoKeyIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListCryptoKeys[0:len(c.CallOptions.ListCryptoKeys):len(c.CallOptions.ListCryptoKeys)], opts...) + it := &CryptoKeyIterator{} + req = proto.Clone(req).(*kmspb.ListCryptoKeysRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*kmspb.CryptoKey, string, error) { + var resp *kmspb.ListCryptoKeysResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.ListCryptoKeys(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.CryptoKeys, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListCryptoKeyVersions lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. +func (c *KeyManagementClient) ListCryptoKeyVersions(ctx context.Context, req *kmspb.ListCryptoKeyVersionsRequest, opts ...gax.CallOption) *CryptoKeyVersionIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListCryptoKeyVersions[0:len(c.CallOptions.ListCryptoKeyVersions):len(c.CallOptions.ListCryptoKeyVersions)], opts...) + it := &CryptoKeyVersionIterator{} + req = proto.Clone(req).(*kmspb.ListCryptoKeyVersionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*kmspb.CryptoKeyVersion, string, error) { + var resp *kmspb.ListCryptoKeyVersionsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.ListCryptoKeyVersions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.CryptoKeyVersions, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetKeyRing returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. +func (c *KeyManagementClient) GetKeyRing(ctx context.Context, req *kmspb.GetKeyRingRequest, opts ...gax.CallOption) (*kmspb.KeyRing, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetKeyRing[0:len(c.CallOptions.GetKeyRing):len(c.CallOptions.GetKeyRing)], opts...) + var resp *kmspb.KeyRing + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.GetKeyRing(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetCryptoKey returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its +// [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. +func (c *KeyManagementClient) GetCryptoKey(ctx context.Context, req *kmspb.GetCryptoKeyRequest, opts ...gax.CallOption) (*kmspb.CryptoKey, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetCryptoKey[0:len(c.CallOptions.GetCryptoKey):len(c.CallOptions.GetCryptoKey)], opts...) + var resp *kmspb.CryptoKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.GetCryptoKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetCryptoKeyVersion returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. +func (c *KeyManagementClient) GetCryptoKeyVersion(ctx context.Context, req *kmspb.GetCryptoKeyVersionRequest, opts ...gax.CallOption) (*kmspb.CryptoKeyVersion, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetCryptoKeyVersion[0:len(c.CallOptions.GetCryptoKeyVersion):len(c.CallOptions.GetCryptoKeyVersion)], opts...) + var resp *kmspb.CryptoKeyVersion + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.GetCryptoKeyVersion(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateKeyRing create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. +func (c *KeyManagementClient) CreateKeyRing(ctx context.Context, req *kmspb.CreateKeyRingRequest, opts ...gax.CallOption) (*kmspb.KeyRing, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateKeyRing[0:len(c.CallOptions.CreateKeyRing):len(c.CallOptions.CreateKeyRing)], opts...) + var resp *kmspb.KeyRing + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.CreateKeyRing(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateCryptoKey create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing]. +// +// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and +// [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] +// are required. +func (c *KeyManagementClient) CreateCryptoKey(ctx context.Context, req *kmspb.CreateCryptoKeyRequest, opts ...gax.CallOption) (*kmspb.CryptoKey, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateCryptoKey[0:len(c.CallOptions.CreateCryptoKey):len(c.CallOptions.CreateCryptoKey)], opts...) + var resp *kmspb.CryptoKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.CreateCryptoKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateCryptoKeyVersion create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey]. +// +// The server will assign the next sequential id. If unset, +// [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to +// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. +func (c *KeyManagementClient) CreateCryptoKeyVersion(ctx context.Context, req *kmspb.CreateCryptoKeyVersionRequest, opts ...gax.CallOption) (*kmspb.CryptoKeyVersion, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", req.GetParent())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateCryptoKeyVersion[0:len(c.CallOptions.CreateCryptoKeyVersion):len(c.CallOptions.CreateCryptoKeyVersion)], opts...) + var resp *kmspb.CryptoKeyVersion + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.CreateCryptoKeyVersion(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateCryptoKey update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. +func (c *KeyManagementClient) UpdateCryptoKey(ctx context.Context, req *kmspb.UpdateCryptoKeyRequest, opts ...gax.CallOption) (*kmspb.CryptoKey, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "crypto_key.name", req.GetCryptoKey().GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateCryptoKey[0:len(c.CallOptions.UpdateCryptoKey):len(c.CallOptions.UpdateCryptoKey)], opts...) + var resp *kmspb.CryptoKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.UpdateCryptoKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateCryptoKeyVersion update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. +// +// [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between +// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and +// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this +// method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to +// move between other states. +func (c *KeyManagementClient) UpdateCryptoKeyVersion(ctx context.Context, req *kmspb.UpdateCryptoKeyVersionRequest, opts ...gax.CallOption) (*kmspb.CryptoKeyVersion, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "crypto_key_version.name", req.GetCryptoKeyVersion().GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateCryptoKeyVersion[0:len(c.CallOptions.UpdateCryptoKeyVersion):len(c.CallOptions.UpdateCryptoKeyVersion)], opts...) + var resp *kmspb.CryptoKeyVersion + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.UpdateCryptoKeyVersion(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Encrypt encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. +// The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be +// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. +func (c *KeyManagementClient) Encrypt(ctx context.Context, req *kmspb.EncryptRequest, opts ...gax.CallOption) (*kmspb.EncryptResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.Encrypt[0:len(c.CallOptions.Encrypt):len(c.CallOptions.Encrypt)], opts...) + var resp *kmspb.EncryptResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.Encrypt(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Decrypt decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] +// must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. +func (c *KeyManagementClient) Decrypt(ctx context.Context, req *kmspb.DecryptRequest, opts ...gax.CallOption) (*kmspb.DecryptResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.Decrypt[0:len(c.CallOptions.Decrypt):len(c.CallOptions.Decrypt)], opts...) + var resp *kmspb.DecryptResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.Decrypt(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateCryptoKeyPrimaryVersion update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. +// +// Returns an error if called on an asymmetric key. +func (c *KeyManagementClient) UpdateCryptoKeyPrimaryVersion(ctx context.Context, req *kmspb.UpdateCryptoKeyPrimaryVersionRequest, opts ...gax.CallOption) (*kmspb.CryptoKey, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateCryptoKeyPrimaryVersion[0:len(c.CallOptions.UpdateCryptoKeyPrimaryVersion):len(c.CallOptions.UpdateCryptoKeyPrimaryVersion)], opts...) + var resp *kmspb.CryptoKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.UpdateCryptoKeyPrimaryVersion(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DestroyCryptoKeyVersion schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. +// +// Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to +// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] +// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 +// hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] +// will be changed to +// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key +// material will be irrevocably destroyed. +// +// Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, +// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process. +func (c *KeyManagementClient) DestroyCryptoKeyVersion(ctx context.Context, req *kmspb.DestroyCryptoKeyVersionRequest, opts ...gax.CallOption) (*kmspb.CryptoKeyVersion, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DestroyCryptoKeyVersion[0:len(c.CallOptions.DestroyCryptoKeyVersion):len(c.CallOptions.DestroyCryptoKeyVersion)], opts...) + var resp *kmspb.CryptoKeyVersion + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.DestroyCryptoKeyVersion(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// RestoreCryptoKeyVersion restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the +// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] +// state. +// +// Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] +// will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], +// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared. +func (c *KeyManagementClient) RestoreCryptoKeyVersion(ctx context.Context, req *kmspb.RestoreCryptoKeyVersionRequest, opts ...gax.CallOption) (*kmspb.CryptoKeyVersion, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.RestoreCryptoKeyVersion[0:len(c.CallOptions.RestoreCryptoKeyVersion):len(c.CallOptions.RestoreCryptoKeyVersion)], opts...) + var resp *kmspb.CryptoKeyVersion + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.RestoreCryptoKeyVersion(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetPublicKey returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The +// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be +// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or +// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. +func (c *KeyManagementClient) GetPublicKey(ctx context.Context, req *kmspb.GetPublicKeyRequest, opts ...gax.CallOption) (*kmspb.PublicKey, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetPublicKey[0:len(c.CallOptions.GetPublicKey):len(c.CallOptions.GetPublicKey)], opts...) + var resp *kmspb.PublicKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.GetPublicKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AsymmetricDecrypt decrypts data that was encrypted with a public key retrieved from +// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with +// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT. +func (c *KeyManagementClient) AsymmetricDecrypt(ctx context.Context, req *kmspb.AsymmetricDecryptRequest, opts ...gax.CallOption) (*kmspb.AsymmetricDecryptResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.AsymmetricDecrypt[0:len(c.CallOptions.AsymmetricDecrypt):len(c.CallOptions.AsymmetricDecrypt)], opts...) + var resp *kmspb.AsymmetricDecryptResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.AsymmetricDecrypt(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AsymmetricSign signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] +// ASYMMETRIC_SIGN, producing a signature that can be verified with the public +// key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. +func (c *KeyManagementClient) AsymmetricSign(ctx context.Context, req *kmspb.AsymmetricSignRequest, opts ...gax.CallOption) (*kmspb.AsymmetricSignResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", req.GetName())) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.AsymmetricSign[0:len(c.CallOptions.AsymmetricSign):len(c.CallOptions.AsymmetricSign)], opts...) + var resp *kmspb.AsymmetricSignResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.keyManagementClient.AsymmetricSign(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CryptoKeyIterator manages a stream of *kmspb.CryptoKey. +type CryptoKeyIterator struct { + items []*kmspb.CryptoKey + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*kmspb.CryptoKey, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *CryptoKeyIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *CryptoKeyIterator) Next() (*kmspb.CryptoKey, error) { + var item *kmspb.CryptoKey + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *CryptoKeyIterator) bufLen() int { + return len(it.items) +} + +func (it *CryptoKeyIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// CryptoKeyVersionIterator manages a stream of *kmspb.CryptoKeyVersion. +type CryptoKeyVersionIterator struct { + items []*kmspb.CryptoKeyVersion + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*kmspb.CryptoKeyVersion, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *CryptoKeyVersionIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *CryptoKeyVersionIterator) Next() (*kmspb.CryptoKeyVersion, error) { + var item *kmspb.CryptoKeyVersion + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *CryptoKeyVersionIterator) bufLen() int { + return len(it.items) +} + +func (it *CryptoKeyVersionIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// KeyRingIterator manages a stream of *kmspb.KeyRing. +type KeyRingIterator struct { + items []*kmspb.KeyRing + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*kmspb.KeyRing, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *KeyRingIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *KeyRingIterator) Next() (*kmspb.KeyRing, error) { + var item *kmspb.KeyRing + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *KeyRingIterator) bufLen() int { + return len(it.items) +} + +func (it *KeyRingIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/kms/apiv1/key_management_client_example_test.go b/vendor/cloud.google.com/go/kms/apiv1/key_management_client_example_test.go new file mode 100644 index 000000000..77a9002b2 --- /dev/null +++ b/vendor/cloud.google.com/go/kms/apiv1/key_management_client_example_test.go @@ -0,0 +1,395 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package kms_test + +import ( + "context" + + kms "cloud.google.com/go/kms/apiv1" + "google.golang.org/api/iterator" + kmspb "google.golang.org/genproto/googleapis/cloud/kms/v1" +) + +func ExampleNewKeyManagementClient() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleKeyManagementClient_ListKeyRings() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.ListKeyRingsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListKeyRings(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleKeyManagementClient_ListCryptoKeys() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.ListCryptoKeysRequest{ + // TODO: Fill request struct fields. + } + it := c.ListCryptoKeys(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleKeyManagementClient_ListCryptoKeyVersions() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.ListCryptoKeyVersionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListCryptoKeyVersions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleKeyManagementClient_GetKeyRing() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.GetKeyRingRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetKeyRing(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_GetCryptoKey() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.GetCryptoKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetCryptoKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_GetCryptoKeyVersion() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.GetCryptoKeyVersionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetCryptoKeyVersion(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_CreateKeyRing() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.CreateKeyRingRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateKeyRing(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_CreateCryptoKey() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.CreateCryptoKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateCryptoKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_CreateCryptoKeyVersion() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.CreateCryptoKeyVersionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateCryptoKeyVersion(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_UpdateCryptoKey() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.UpdateCryptoKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateCryptoKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_UpdateCryptoKeyVersion() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.UpdateCryptoKeyVersionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateCryptoKeyVersion(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_Encrypt() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.EncryptRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Encrypt(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_Decrypt() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.DecryptRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Decrypt(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_UpdateCryptoKeyPrimaryVersion() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.UpdateCryptoKeyPrimaryVersionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateCryptoKeyPrimaryVersion(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_DestroyCryptoKeyVersion() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.DestroyCryptoKeyVersionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.DestroyCryptoKeyVersion(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_RestoreCryptoKeyVersion() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.RestoreCryptoKeyVersionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RestoreCryptoKeyVersion(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_GetPublicKey() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.GetPublicKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_AsymmetricDecrypt() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.AsymmetricDecryptRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AsymmetricDecrypt(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleKeyManagementClient_AsymmetricSign() { + ctx := context.Background() + c, err := kms.NewKeyManagementClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &kmspb.AsymmetricSignRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AsymmetricSign(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/kms/apiv1/mock_test.go b/vendor/cloud.google.com/go/kms/apiv1/mock_test.go new file mode 100644 index 000000000..6fd798812 --- /dev/null +++ b/vendor/cloud.google.com/go/kms/apiv1/mock_test.go @@ -0,0 +1,1622 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package kms + +import ( + durationpb "github.com/golang/protobuf/ptypes/duration" + timestamppb "github.com/golang/protobuf/ptypes/timestamp" + kmspb "google.golang.org/genproto/googleapis/cloud/kms/v1" + iampb "google.golang.org/genproto/googleapis/iam/v1" + field_maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockKeyManagementServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + kmspb.KeyManagementServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockKeyManagementServer) ListKeyRings(ctx context.Context, req *kmspb.ListKeyRingsRequest) (*kmspb.ListKeyRingsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.ListKeyRingsResponse), nil +} + +func (s *mockKeyManagementServer) ListCryptoKeys(ctx context.Context, req *kmspb.ListCryptoKeysRequest) (*kmspb.ListCryptoKeysResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.ListCryptoKeysResponse), nil +} + +func (s *mockKeyManagementServer) ListCryptoKeyVersions(ctx context.Context, req *kmspb.ListCryptoKeyVersionsRequest) (*kmspb.ListCryptoKeyVersionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.ListCryptoKeyVersionsResponse), nil +} + +func (s *mockKeyManagementServer) GetKeyRing(ctx context.Context, req *kmspb.GetKeyRingRequest) (*kmspb.KeyRing, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.KeyRing), nil +} + +func (s *mockKeyManagementServer) GetCryptoKey(ctx context.Context, req *kmspb.GetCryptoKeyRequest) (*kmspb.CryptoKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.CryptoKey), nil +} + +func (s *mockKeyManagementServer) GetCryptoKeyVersion(ctx context.Context, req *kmspb.GetCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.CryptoKeyVersion), nil +} + +func (s *mockKeyManagementServer) GetPublicKey(ctx context.Context, req *kmspb.GetPublicKeyRequest) (*kmspb.PublicKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.PublicKey), nil +} + +func (s *mockKeyManagementServer) CreateKeyRing(ctx context.Context, req *kmspb.CreateKeyRingRequest) (*kmspb.KeyRing, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.KeyRing), nil +} + +func (s *mockKeyManagementServer) CreateCryptoKey(ctx context.Context, req *kmspb.CreateCryptoKeyRequest) (*kmspb.CryptoKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.CryptoKey), nil +} + +func (s *mockKeyManagementServer) CreateCryptoKeyVersion(ctx context.Context, req *kmspb.CreateCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.CryptoKeyVersion), nil +} + +func (s *mockKeyManagementServer) UpdateCryptoKey(ctx context.Context, req *kmspb.UpdateCryptoKeyRequest) (*kmspb.CryptoKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.CryptoKey), nil +} + +func (s *mockKeyManagementServer) UpdateCryptoKeyVersion(ctx context.Context, req *kmspb.UpdateCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.CryptoKeyVersion), nil +} + +func (s *mockKeyManagementServer) Encrypt(ctx context.Context, req *kmspb.EncryptRequest) (*kmspb.EncryptResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.EncryptResponse), nil +} + +func (s *mockKeyManagementServer) Decrypt(ctx context.Context, req *kmspb.DecryptRequest) (*kmspb.DecryptResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.DecryptResponse), nil +} + +func (s *mockKeyManagementServer) AsymmetricSign(ctx context.Context, req *kmspb.AsymmetricSignRequest) (*kmspb.AsymmetricSignResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.AsymmetricSignResponse), nil +} + +func (s *mockKeyManagementServer) AsymmetricDecrypt(ctx context.Context, req *kmspb.AsymmetricDecryptRequest) (*kmspb.AsymmetricDecryptResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.AsymmetricDecryptResponse), nil +} + +func (s *mockKeyManagementServer) UpdateCryptoKeyPrimaryVersion(ctx context.Context, req *kmspb.UpdateCryptoKeyPrimaryVersionRequest) (*kmspb.CryptoKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.CryptoKey), nil +} + +func (s *mockKeyManagementServer) DestroyCryptoKeyVersion(ctx context.Context, req *kmspb.DestroyCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.CryptoKeyVersion), nil +} + +func (s *mockKeyManagementServer) RestoreCryptoKeyVersion(ctx context.Context, req *kmspb.RestoreCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*kmspb.CryptoKeyVersion), nil +} + +type mockIamPolicyServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + iampb.IAMPolicyServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockIamPolicyServer) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockIamPolicyServer) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockIamPolicyServer) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.TestIamPermissionsResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockKeyManagement mockKeyManagementServer + mockIamPolicy mockIamPolicyServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + kmspb.RegisterKeyManagementServiceServer(serv, &mockKeyManagement) + iampb.RegisterIAMPolicyServer(serv, &mockIamPolicy) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestKeyManagementServiceListKeyRings(t *testing.T) { + var nextPageToken string = "" + var totalSize int32 = 705419236 + var keyRingsElement *kmspb.KeyRing = &kmspb.KeyRing{} + var keyRings = []*kmspb.KeyRing{keyRingsElement} + var expectedResponse = &kmspb.ListKeyRingsResponse{ + NextPageToken: nextPageToken, + TotalSize: totalSize, + KeyRings: keyRings, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &kmspb.ListKeyRingsRequest{ + Parent: formattedParent, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListKeyRings(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.KeyRings[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceListKeyRingsError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &kmspb.ListKeyRingsRequest{ + Parent: formattedParent, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListKeyRings(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceListCryptoKeys(t *testing.T) { + var nextPageToken string = "" + var totalSize int32 = 705419236 + var cryptoKeysElement *kmspb.CryptoKey = &kmspb.CryptoKey{} + var cryptoKeys = []*kmspb.CryptoKey{cryptoKeysElement} + var expectedResponse = &kmspb.ListCryptoKeysResponse{ + NextPageToken: nextPageToken, + TotalSize: totalSize, + CryptoKeys: cryptoKeys, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]") + var request = &kmspb.ListCryptoKeysRequest{ + Parent: formattedParent, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListCryptoKeys(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.CryptoKeys[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceListCryptoKeysError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]") + var request = &kmspb.ListCryptoKeysRequest{ + Parent: formattedParent, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListCryptoKeys(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceListCryptoKeyVersions(t *testing.T) { + var nextPageToken string = "" + var totalSize int32 = 705419236 + var cryptoKeyVersionsElement *kmspb.CryptoKeyVersion = &kmspb.CryptoKeyVersion{} + var cryptoKeyVersions = []*kmspb.CryptoKeyVersion{cryptoKeyVersionsElement} + var expectedResponse = &kmspb.ListCryptoKeyVersionsResponse{ + NextPageToken: nextPageToken, + TotalSize: totalSize, + CryptoKeyVersions: cryptoKeyVersions, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var request = &kmspb.ListCryptoKeyVersionsRequest{ + Parent: formattedParent, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListCryptoKeyVersions(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.CryptoKeyVersions[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceListCryptoKeyVersionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var request = &kmspb.ListCryptoKeyVersionsRequest{ + Parent: formattedParent, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListCryptoKeyVersions(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceGetKeyRing(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &kmspb.KeyRing{ + Name: name2, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]") + var request = &kmspb.GetKeyRingRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetKeyRing(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceGetKeyRingError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]") + var request = &kmspb.GetKeyRingRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetKeyRing(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceGetCryptoKey(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &kmspb.CryptoKey{ + Name: name2, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var request = &kmspb.GetCryptoKeyRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCryptoKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceGetCryptoKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var request = &kmspb.GetCryptoKeyRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCryptoKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceGetCryptoKeyVersion(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &kmspb.CryptoKeyVersion{ + Name: name2, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var request = &kmspb.GetCryptoKeyVersionRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCryptoKeyVersion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceGetCryptoKeyVersionError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var request = &kmspb.GetCryptoKeyVersionRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetCryptoKeyVersion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceCreateKeyRing(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &kmspb.KeyRing{ + Name: name, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var keyRingId string = "keyRingId-2056646742" + var keyRing *kmspb.KeyRing = &kmspb.KeyRing{} + var request = &kmspb.CreateKeyRingRequest{ + Parent: formattedParent, + KeyRingId: keyRingId, + KeyRing: keyRing, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateKeyRing(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceCreateKeyRingError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var keyRingId string = "keyRingId-2056646742" + var keyRing *kmspb.KeyRing = &kmspb.KeyRing{} + var request = &kmspb.CreateKeyRingRequest{ + Parent: formattedParent, + KeyRingId: keyRingId, + KeyRing: keyRing, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateKeyRing(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceCreateCryptoKey(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &kmspb.CryptoKey{ + Name: name, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]") + var cryptoKeyId string = "my-app-key" + var purpose kmspb.CryptoKey_CryptoKeyPurpose = kmspb.CryptoKey_ENCRYPT_DECRYPT + var seconds int64 = 2147483647 + var nextRotationTime = ×tamppb.Timestamp{ + Seconds: seconds, + } + var seconds2 int64 = 604800 + var rotationPeriod = &durationpb.Duration{ + Seconds: seconds2, + } + var cryptoKey = &kmspb.CryptoKey{ + Purpose: purpose, + NextRotationTime: nextRotationTime, + RotationSchedule: &kmspb.CryptoKey_RotationPeriod{ + RotationPeriod: rotationPeriod, + }, + } + var request = &kmspb.CreateCryptoKeyRequest{ + Parent: formattedParent, + CryptoKeyId: cryptoKeyId, + CryptoKey: cryptoKey, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateCryptoKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceCreateCryptoKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]") + var cryptoKeyId string = "my-app-key" + var purpose kmspb.CryptoKey_CryptoKeyPurpose = kmspb.CryptoKey_ENCRYPT_DECRYPT + var seconds int64 = 2147483647 + var nextRotationTime = ×tamppb.Timestamp{ + Seconds: seconds, + } + var seconds2 int64 = 604800 + var rotationPeriod = &durationpb.Duration{ + Seconds: seconds2, + } + var cryptoKey = &kmspb.CryptoKey{ + Purpose: purpose, + NextRotationTime: nextRotationTime, + RotationSchedule: &kmspb.CryptoKey_RotationPeriod{ + RotationPeriod: rotationPeriod, + }, + } + var request = &kmspb.CreateCryptoKeyRequest{ + Parent: formattedParent, + CryptoKeyId: cryptoKeyId, + CryptoKey: cryptoKey, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateCryptoKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceCreateCryptoKeyVersion(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &kmspb.CryptoKeyVersion{ + Name: name, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var cryptoKeyVersion *kmspb.CryptoKeyVersion = &kmspb.CryptoKeyVersion{} + var request = &kmspb.CreateCryptoKeyVersionRequest{ + Parent: formattedParent, + CryptoKeyVersion: cryptoKeyVersion, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateCryptoKeyVersion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceCreateCryptoKeyVersionError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var cryptoKeyVersion *kmspb.CryptoKeyVersion = &kmspb.CryptoKeyVersion{} + var request = &kmspb.CreateCryptoKeyVersionRequest{ + Parent: formattedParent, + CryptoKeyVersion: cryptoKeyVersion, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateCryptoKeyVersion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceUpdateCryptoKey(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &kmspb.CryptoKey{ + Name: name, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var cryptoKey *kmspb.CryptoKey = &kmspb.CryptoKey{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &kmspb.UpdateCryptoKeyRequest{ + CryptoKey: cryptoKey, + UpdateMask: updateMask, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateCryptoKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceUpdateCryptoKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var cryptoKey *kmspb.CryptoKey = &kmspb.CryptoKey{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &kmspb.UpdateCryptoKeyRequest{ + CryptoKey: cryptoKey, + UpdateMask: updateMask, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateCryptoKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceUpdateCryptoKeyVersion(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &kmspb.CryptoKeyVersion{ + Name: name, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var cryptoKeyVersion *kmspb.CryptoKeyVersion = &kmspb.CryptoKeyVersion{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &kmspb.UpdateCryptoKeyVersionRequest{ + CryptoKeyVersion: cryptoKeyVersion, + UpdateMask: updateMask, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateCryptoKeyVersion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceUpdateCryptoKeyVersionError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var cryptoKeyVersion *kmspb.CryptoKeyVersion = &kmspb.CryptoKeyVersion{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &kmspb.UpdateCryptoKeyVersionRequest{ + CryptoKeyVersion: cryptoKeyVersion, + UpdateMask: updateMask, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateCryptoKeyVersion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceEncrypt(t *testing.T) { + var name2 string = "name2-1052831874" + var ciphertext []byte = []byte("-72") + var expectedResponse = &kmspb.EncryptResponse{ + Name: name2, + Ciphertext: ciphertext, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY_PATH]") + var plaintext []byte = []byte("-9") + var request = &kmspb.EncryptRequest{ + Name: formattedName, + Plaintext: plaintext, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Encrypt(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceEncryptError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY_PATH]") + var plaintext []byte = []byte("-9") + var request = &kmspb.EncryptRequest{ + Name: formattedName, + Plaintext: plaintext, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Encrypt(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceDecrypt(t *testing.T) { + var plaintext []byte = []byte("-9") + var expectedResponse = &kmspb.DecryptResponse{ + Plaintext: plaintext, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var ciphertext []byte = []byte("-72") + var request = &kmspb.DecryptRequest{ + Name: formattedName, + Ciphertext: ciphertext, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Decrypt(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceDecryptError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var ciphertext []byte = []byte("-72") + var request = &kmspb.DecryptRequest{ + Name: formattedName, + Ciphertext: ciphertext, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Decrypt(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceUpdateCryptoKeyPrimaryVersion(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &kmspb.CryptoKey{ + Name: name2, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var cryptoKeyVersionId string = "cryptoKeyVersionId729489152" + var request = &kmspb.UpdateCryptoKeyPrimaryVersionRequest{ + Name: formattedName, + CryptoKeyVersionId: cryptoKeyVersionId, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateCryptoKeyPrimaryVersion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceUpdateCryptoKeyPrimaryVersionError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]") + var cryptoKeyVersionId string = "cryptoKeyVersionId729489152" + var request = &kmspb.UpdateCryptoKeyPrimaryVersionRequest{ + Name: formattedName, + CryptoKeyVersionId: cryptoKeyVersionId, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateCryptoKeyPrimaryVersion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceDestroyCryptoKeyVersion(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &kmspb.CryptoKeyVersion{ + Name: name2, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var request = &kmspb.DestroyCryptoKeyVersionRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DestroyCryptoKeyVersion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceDestroyCryptoKeyVersionError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var request = &kmspb.DestroyCryptoKeyVersionRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.DestroyCryptoKeyVersion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceRestoreCryptoKeyVersion(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &kmspb.CryptoKeyVersion{ + Name: name2, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var request = &kmspb.RestoreCryptoKeyVersionRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RestoreCryptoKeyVersion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceRestoreCryptoKeyVersionError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var request = &kmspb.RestoreCryptoKeyVersionRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RestoreCryptoKeyVersion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceGetPublicKey(t *testing.T) { + var pem string = "pem110872" + var expectedResponse = &kmspb.PublicKey{ + Pem: pem, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var request = &kmspb.GetPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetPublicKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceGetPublicKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var request = &kmspb.GetPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetPublicKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceAsymmetricDecrypt(t *testing.T) { + var plaintext []byte = []byte("-9") + var expectedResponse = &kmspb.AsymmetricDecryptResponse{ + Plaintext: plaintext, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var ciphertext []byte = []byte("-72") + var request = &kmspb.AsymmetricDecryptRequest{ + Name: formattedName, + Ciphertext: ciphertext, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AsymmetricDecrypt(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceAsymmetricDecryptError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var ciphertext []byte = []byte("-72") + var request = &kmspb.AsymmetricDecryptRequest{ + Name: formattedName, + Ciphertext: ciphertext, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AsymmetricDecrypt(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestKeyManagementServiceAsymmetricSign(t *testing.T) { + var signature []byte = []byte("106") + var expectedResponse = &kmspb.AsymmetricSignResponse{ + Signature: signature, + } + + mockKeyManagement.err = nil + mockKeyManagement.reqs = nil + + mockKeyManagement.resps = append(mockKeyManagement.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var digest *kmspb.Digest = &kmspb.Digest{} + var request = &kmspb.AsymmetricSignRequest{ + Name: formattedName, + Digest: digest, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AsymmetricSign(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockKeyManagement.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestKeyManagementServiceAsymmetricSignError(t *testing.T) { + errCode := codes.PermissionDenied + mockKeyManagement.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s", "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]") + var digest *kmspb.Digest = &kmspb.Digest{} + var request = &kmspb.AsymmetricSignRequest{ + Name: formattedName, + Digest: digest, + } + + c, err := NewKeyManagementClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AsymmetricSign(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/language/apiv1/AnalyzeSentiment_smoke_test.go b/vendor/cloud.google.com/go/language/apiv1/AnalyzeSentiment_smoke_test.go new file mode 100644 index 000000000..9a57ee948 --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1/AnalyzeSentiment_smoke_test.go @@ -0,0 +1,73 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package language + +import ( + languagepb "google.golang.org/genproto/googleapis/cloud/language/v1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestLanguageServiceSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var content string = "Hello, world!" + var type_ languagepb.Document_Type = languagepb.Document_PLAIN_TEXT + var document = &languagepb.Document{ + Source: &languagepb.Document_Content{ + Content: content, + }, + Type: type_, + } + var request = &languagepb.AnalyzeSentimentRequest{ + Document: document, + } + + if _, err := c.AnalyzeSentiment(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/language/apiv1/doc.go b/vendor/cloud.google.com/go/language/apiv1/doc.go new file mode 100644 index 000000000..01bfeacfb --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1/doc.go @@ -0,0 +1,90 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package language is an auto-generated package for the +// Google Cloud Natural Language API. + +// +// Google Cloud Natural Language API provides natural language understanding +// technologies to developers. Examples include sentiment analysis, entity +// recognition, and text annotations. +package language // import "cloud.google.com/go/language/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/language/apiv1/language_client.go b/vendor/cloud.google.com/go/language/apiv1/language_client.go new file mode 100644 index 000000000..51627d9ff --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1/language_client.go @@ -0,0 +1,230 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package language + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + languagepb "google.golang.org/genproto/googleapis/cloud/language/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + AnalyzeSentiment []gax.CallOption + AnalyzeEntities []gax.CallOption + AnalyzeEntitySentiment []gax.CallOption + AnalyzeSyntax []gax.CallOption + ClassifyText []gax.CallOption + AnnotateText []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("language.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + AnalyzeSentiment: retry[[2]string{"default", "idempotent"}], + AnalyzeEntities: retry[[2]string{"default", "idempotent"}], + AnalyzeEntitySentiment: retry[[2]string{"default", "idempotent"}], + AnalyzeSyntax: retry[[2]string{"default", "idempotent"}], + ClassifyText: retry[[2]string{"default", "idempotent"}], + AnnotateText: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Google Cloud Natural Language API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client languagepb.LanguageServiceClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new language service client. +// +// Provides text analysis operations such as sentiment analysis and entity +// recognition. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: languagepb.NewLanguageServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// AnalyzeSentiment analyzes the sentiment of the provided text. +func (c *Client) AnalyzeSentiment(ctx context.Context, req *languagepb.AnalyzeSentimentRequest, opts ...gax.CallOption) (*languagepb.AnalyzeSentimentResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnalyzeSentiment[0:len(c.CallOptions.AnalyzeSentiment):len(c.CallOptions.AnalyzeSentiment)], opts...) + var resp *languagepb.AnalyzeSentimentResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnalyzeSentiment(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnalyzeEntities finds named entities (currently proper names and common nouns) in the text +// along with entity types, salience, mentions for each entity, and +// other properties. +func (c *Client) AnalyzeEntities(ctx context.Context, req *languagepb.AnalyzeEntitiesRequest, opts ...gax.CallOption) (*languagepb.AnalyzeEntitiesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnalyzeEntities[0:len(c.CallOptions.AnalyzeEntities):len(c.CallOptions.AnalyzeEntities)], opts...) + var resp *languagepb.AnalyzeEntitiesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnalyzeEntities(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnalyzeEntitySentiment finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes +// sentiment associated with each entity and its mentions. +func (c *Client) AnalyzeEntitySentiment(ctx context.Context, req *languagepb.AnalyzeEntitySentimentRequest, opts ...gax.CallOption) (*languagepb.AnalyzeEntitySentimentResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnalyzeEntitySentiment[0:len(c.CallOptions.AnalyzeEntitySentiment):len(c.CallOptions.AnalyzeEntitySentiment)], opts...) + var resp *languagepb.AnalyzeEntitySentimentResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnalyzeEntitySentiment(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnalyzeSyntax analyzes the syntax of the text and provides sentence boundaries and +// tokenization along with part of speech tags, dependency trees, and other +// properties. +func (c *Client) AnalyzeSyntax(ctx context.Context, req *languagepb.AnalyzeSyntaxRequest, opts ...gax.CallOption) (*languagepb.AnalyzeSyntaxResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnalyzeSyntax[0:len(c.CallOptions.AnalyzeSyntax):len(c.CallOptions.AnalyzeSyntax)], opts...) + var resp *languagepb.AnalyzeSyntaxResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnalyzeSyntax(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ClassifyText classifies a document into categories. +func (c *Client) ClassifyText(ctx context.Context, req *languagepb.ClassifyTextRequest, opts ...gax.CallOption) (*languagepb.ClassifyTextResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ClassifyText[0:len(c.CallOptions.ClassifyText):len(c.CallOptions.ClassifyText)], opts...) + var resp *languagepb.ClassifyTextResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ClassifyText(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnnotateText a convenience method that provides all the features that analyzeSentiment, +// analyzeEntities, and analyzeSyntax provide in one call. +func (c *Client) AnnotateText(ctx context.Context, req *languagepb.AnnotateTextRequest, opts ...gax.CallOption) (*languagepb.AnnotateTextResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnnotateText[0:len(c.CallOptions.AnnotateText):len(c.CallOptions.AnnotateText)], opts...) + var resp *languagepb.AnnotateTextResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnnotateText(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/language/apiv1/language_client_example_test.go b/vendor/cloud.google.com/go/language/apiv1/language_client_example_test.go new file mode 100644 index 000000000..df8c6e443 --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1/language_client_example_test.go @@ -0,0 +1,142 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package language_test + +import ( + "context" + + language "cloud.google.com/go/language/apiv1" + languagepb "google.golang.org/genproto/googleapis/cloud/language/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_AnalyzeSentiment() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnalyzeSentimentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnalyzeSentiment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_AnalyzeEntities() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnalyzeEntitiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnalyzeEntities(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_AnalyzeEntitySentiment() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnalyzeEntitySentimentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnalyzeEntitySentiment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_AnalyzeSyntax() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnalyzeSyntaxRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnalyzeSyntax(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ClassifyText() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.ClassifyTextRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ClassifyText(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_AnnotateText() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnnotateTextRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnnotateText(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/language/apiv1/mock_test.go b/vendor/cloud.google.com/go/language/apiv1/mock_test.go new file mode 100644 index 000000000..eaeb0c392 --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1/mock_test.go @@ -0,0 +1,518 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package language + +import ( + languagepb "google.golang.org/genproto/googleapis/cloud/language/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockLanguageServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + languagepb.LanguageServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockLanguageServer) AnalyzeSentiment(ctx context.Context, req *languagepb.AnalyzeSentimentRequest) (*languagepb.AnalyzeSentimentResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnalyzeSentimentResponse), nil +} + +func (s *mockLanguageServer) AnalyzeEntities(ctx context.Context, req *languagepb.AnalyzeEntitiesRequest) (*languagepb.AnalyzeEntitiesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnalyzeEntitiesResponse), nil +} + +func (s *mockLanguageServer) AnalyzeEntitySentiment(ctx context.Context, req *languagepb.AnalyzeEntitySentimentRequest) (*languagepb.AnalyzeEntitySentimentResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnalyzeEntitySentimentResponse), nil +} + +func (s *mockLanguageServer) AnalyzeSyntax(ctx context.Context, req *languagepb.AnalyzeSyntaxRequest) (*languagepb.AnalyzeSyntaxResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnalyzeSyntaxResponse), nil +} + +func (s *mockLanguageServer) ClassifyText(ctx context.Context, req *languagepb.ClassifyTextRequest) (*languagepb.ClassifyTextResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.ClassifyTextResponse), nil +} + +func (s *mockLanguageServer) AnnotateText(ctx context.Context, req *languagepb.AnnotateTextRequest) (*languagepb.AnnotateTextResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnnotateTextResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockLanguage mockLanguageServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + languagepb.RegisterLanguageServiceServer(serv, &mockLanguage) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestLanguageServiceAnalyzeSentiment(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnalyzeSentimentResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeSentimentRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeSentiment(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnalyzeSentimentError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeSentimentRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeSentiment(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceAnalyzeEntities(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnalyzeEntitiesResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeEntitiesRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeEntities(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnalyzeEntitiesError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeEntitiesRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeEntities(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceAnalyzeEntitySentiment(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnalyzeEntitySentimentResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeEntitySentimentRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeEntitySentiment(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnalyzeEntitySentimentError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeEntitySentimentRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeEntitySentiment(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceAnalyzeSyntax(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnalyzeSyntaxResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeSyntaxRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeSyntax(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnalyzeSyntaxError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeSyntaxRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeSyntax(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceClassifyText(t *testing.T) { + var expectedResponse *languagepb.ClassifyTextResponse = &languagepb.ClassifyTextResponse{} + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.ClassifyTextRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ClassifyText(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceClassifyTextError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.ClassifyTextRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ClassifyText(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceAnnotateText(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnnotateTextResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var features *languagepb.AnnotateTextRequest_Features = &languagepb.AnnotateTextRequest_Features{} + var request = &languagepb.AnnotateTextRequest{ + Document: document, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnnotateText(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnnotateTextError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var features *languagepb.AnnotateTextRequest_Features = &languagepb.AnnotateTextRequest_Features{} + var request = &languagepb.AnnotateTextRequest{ + Document: document, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnnotateText(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/language/apiv1beta2/AnalyzeSentiment_smoke_test.go b/vendor/cloud.google.com/go/language/apiv1beta2/AnalyzeSentiment_smoke_test.go new file mode 100644 index 000000000..c0db4ce1b --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1beta2/AnalyzeSentiment_smoke_test.go @@ -0,0 +1,73 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package language + +import ( + languagepb "google.golang.org/genproto/googleapis/cloud/language/v1beta2" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestLanguageServiceSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var content string = "Hello, world!" + var type_ languagepb.Document_Type = languagepb.Document_PLAIN_TEXT + var document = &languagepb.Document{ + Source: &languagepb.Document_Content{ + Content: content, + }, + Type: type_, + } + var request = &languagepb.AnalyzeSentimentRequest{ + Document: document, + } + + if _, err := c.AnalyzeSentiment(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/language/apiv1beta2/doc.go b/vendor/cloud.google.com/go/language/apiv1beta2/doc.go new file mode 100644 index 000000000..5c7ee0309 --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1beta2/doc.go @@ -0,0 +1,91 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package language is an auto-generated package for the +// Google Cloud Natural Language API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Google Cloud Natural Language API provides natural language understanding +// technologies to developers. Examples include sentiment analysis, entity +// recognition, and text annotations. +package language // import "cloud.google.com/go/language/apiv1beta2" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/language/apiv1beta2/language_client.go b/vendor/cloud.google.com/go/language/apiv1beta2/language_client.go new file mode 100644 index 000000000..19eeae3df --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1beta2/language_client.go @@ -0,0 +1,230 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package language + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + languagepb "google.golang.org/genproto/googleapis/cloud/language/v1beta2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + AnalyzeSentiment []gax.CallOption + AnalyzeEntities []gax.CallOption + AnalyzeEntitySentiment []gax.CallOption + AnalyzeSyntax []gax.CallOption + ClassifyText []gax.CallOption + AnnotateText []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("language.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + AnalyzeSentiment: retry[[2]string{"default", "idempotent"}], + AnalyzeEntities: retry[[2]string{"default", "idempotent"}], + AnalyzeEntitySentiment: retry[[2]string{"default", "idempotent"}], + AnalyzeSyntax: retry[[2]string{"default", "idempotent"}], + ClassifyText: retry[[2]string{"default", "idempotent"}], + AnnotateText: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Google Cloud Natural Language API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client languagepb.LanguageServiceClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new language service client. +// +// Provides text analysis operations such as sentiment analysis and entity +// recognition. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: languagepb.NewLanguageServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// AnalyzeSentiment analyzes the sentiment of the provided text. +func (c *Client) AnalyzeSentiment(ctx context.Context, req *languagepb.AnalyzeSentimentRequest, opts ...gax.CallOption) (*languagepb.AnalyzeSentimentResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnalyzeSentiment[0:len(c.CallOptions.AnalyzeSentiment):len(c.CallOptions.AnalyzeSentiment)], opts...) + var resp *languagepb.AnalyzeSentimentResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnalyzeSentiment(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnalyzeEntities finds named entities (currently proper names and common nouns) in the text +// along with entity types, salience, mentions for each entity, and +// other properties. +func (c *Client) AnalyzeEntities(ctx context.Context, req *languagepb.AnalyzeEntitiesRequest, opts ...gax.CallOption) (*languagepb.AnalyzeEntitiesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnalyzeEntities[0:len(c.CallOptions.AnalyzeEntities):len(c.CallOptions.AnalyzeEntities)], opts...) + var resp *languagepb.AnalyzeEntitiesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnalyzeEntities(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnalyzeEntitySentiment finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes +// sentiment associated with each entity and its mentions. +func (c *Client) AnalyzeEntitySentiment(ctx context.Context, req *languagepb.AnalyzeEntitySentimentRequest, opts ...gax.CallOption) (*languagepb.AnalyzeEntitySentimentResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnalyzeEntitySentiment[0:len(c.CallOptions.AnalyzeEntitySentiment):len(c.CallOptions.AnalyzeEntitySentiment)], opts...) + var resp *languagepb.AnalyzeEntitySentimentResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnalyzeEntitySentiment(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnalyzeSyntax analyzes the syntax of the text and provides sentence boundaries and +// tokenization along with part of speech tags, dependency trees, and other +// properties. +func (c *Client) AnalyzeSyntax(ctx context.Context, req *languagepb.AnalyzeSyntaxRequest, opts ...gax.CallOption) (*languagepb.AnalyzeSyntaxResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnalyzeSyntax[0:len(c.CallOptions.AnalyzeSyntax):len(c.CallOptions.AnalyzeSyntax)], opts...) + var resp *languagepb.AnalyzeSyntaxResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnalyzeSyntax(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ClassifyText classifies a document into categories. +func (c *Client) ClassifyText(ctx context.Context, req *languagepb.ClassifyTextRequest, opts ...gax.CallOption) (*languagepb.ClassifyTextResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ClassifyText[0:len(c.CallOptions.ClassifyText):len(c.CallOptions.ClassifyText)], opts...) + var resp *languagepb.ClassifyTextResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ClassifyText(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AnnotateText a convenience method that provides all syntax, sentiment, entity, and +// classification features in one call. +func (c *Client) AnnotateText(ctx context.Context, req *languagepb.AnnotateTextRequest, opts ...gax.CallOption) (*languagepb.AnnotateTextResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnnotateText[0:len(c.CallOptions.AnnotateText):len(c.CallOptions.AnnotateText)], opts...) + var resp *languagepb.AnnotateTextResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnnotateText(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/language/apiv1beta2/language_client_example_test.go b/vendor/cloud.google.com/go/language/apiv1beta2/language_client_example_test.go new file mode 100644 index 000000000..2d4c0cf3b --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1beta2/language_client_example_test.go @@ -0,0 +1,142 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package language_test + +import ( + "context" + + language "cloud.google.com/go/language/apiv1beta2" + languagepb "google.golang.org/genproto/googleapis/cloud/language/v1beta2" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_AnalyzeSentiment() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnalyzeSentimentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnalyzeSentiment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_AnalyzeEntities() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnalyzeEntitiesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnalyzeEntities(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_AnalyzeEntitySentiment() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnalyzeEntitySentimentRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnalyzeEntitySentiment(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_AnalyzeSyntax() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnalyzeSyntaxRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnalyzeSyntax(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ClassifyText() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.ClassifyTextRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ClassifyText(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_AnnotateText() { + ctx := context.Background() + c, err := language.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &languagepb.AnnotateTextRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.AnnotateText(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/language/apiv1beta2/mock_test.go b/vendor/cloud.google.com/go/language/apiv1beta2/mock_test.go new file mode 100644 index 000000000..20ae2123b --- /dev/null +++ b/vendor/cloud.google.com/go/language/apiv1beta2/mock_test.go @@ -0,0 +1,518 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package language + +import ( + languagepb "google.golang.org/genproto/googleapis/cloud/language/v1beta2" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockLanguageServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + languagepb.LanguageServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockLanguageServer) AnalyzeSentiment(ctx context.Context, req *languagepb.AnalyzeSentimentRequest) (*languagepb.AnalyzeSentimentResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnalyzeSentimentResponse), nil +} + +func (s *mockLanguageServer) AnalyzeEntities(ctx context.Context, req *languagepb.AnalyzeEntitiesRequest) (*languagepb.AnalyzeEntitiesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnalyzeEntitiesResponse), nil +} + +func (s *mockLanguageServer) AnalyzeEntitySentiment(ctx context.Context, req *languagepb.AnalyzeEntitySentimentRequest) (*languagepb.AnalyzeEntitySentimentResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnalyzeEntitySentimentResponse), nil +} + +func (s *mockLanguageServer) AnalyzeSyntax(ctx context.Context, req *languagepb.AnalyzeSyntaxRequest) (*languagepb.AnalyzeSyntaxResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnalyzeSyntaxResponse), nil +} + +func (s *mockLanguageServer) ClassifyText(ctx context.Context, req *languagepb.ClassifyTextRequest) (*languagepb.ClassifyTextResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.ClassifyTextResponse), nil +} + +func (s *mockLanguageServer) AnnotateText(ctx context.Context, req *languagepb.AnnotateTextRequest) (*languagepb.AnnotateTextResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*languagepb.AnnotateTextResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockLanguage mockLanguageServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + languagepb.RegisterLanguageServiceServer(serv, &mockLanguage) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestLanguageServiceAnalyzeSentiment(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnalyzeSentimentResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeSentimentRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeSentiment(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnalyzeSentimentError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeSentimentRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeSentiment(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceAnalyzeEntities(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnalyzeEntitiesResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeEntitiesRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeEntities(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnalyzeEntitiesError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeEntitiesRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeEntities(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceAnalyzeEntitySentiment(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnalyzeEntitySentimentResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeEntitySentimentRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeEntitySentiment(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnalyzeEntitySentimentError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeEntitySentimentRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeEntitySentiment(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceAnalyzeSyntax(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnalyzeSyntaxResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeSyntaxRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeSyntax(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnalyzeSyntaxError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.AnalyzeSyntaxRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnalyzeSyntax(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceClassifyText(t *testing.T) { + var expectedResponse *languagepb.ClassifyTextResponse = &languagepb.ClassifyTextResponse{} + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.ClassifyTextRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ClassifyText(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceClassifyTextError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var request = &languagepb.ClassifyTextRequest{ + Document: document, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ClassifyText(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLanguageServiceAnnotateText(t *testing.T) { + var language string = "language-1613589672" + var expectedResponse = &languagepb.AnnotateTextResponse{ + Language: language, + } + + mockLanguage.err = nil + mockLanguage.reqs = nil + + mockLanguage.resps = append(mockLanguage.resps[:0], expectedResponse) + + var document *languagepb.Document = &languagepb.Document{} + var features *languagepb.AnnotateTextRequest_Features = &languagepb.AnnotateTextRequest_Features{} + var request = &languagepb.AnnotateTextRequest{ + Document: document, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnnotateText(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLanguage.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLanguageServiceAnnotateTextError(t *testing.T) { + errCode := codes.PermissionDenied + mockLanguage.err = gstatus.Error(errCode, "test error") + + var document *languagepb.Document = &languagepb.Document{} + var features *languagepb.AnnotateTextRequest_Features = &languagepb.AnnotateTextRequest_Features{} + var request = &languagepb.AnnotateTextRequest{ + Document: document, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.AnnotateText(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/license_test.go b/vendor/cloud.google.com/go/license_test.go new file mode 100644 index 000000000..a30cad199 --- /dev/null +++ b/vendor/cloud.google.com/go/license_test.go @@ -0,0 +1,74 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cloud + +import ( + "bytes" + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" +) + +var sentinels = []string{ + "Copyright", + "Google", + `Licensed under the Apache License, Version 2.0 (the "License");`, +} + +func TestLicense(t *testing.T) { + t.Parallel() + err := filepath.Walk(".", func(path string, fi os.FileInfo, err error) error { + if err != nil { + return err + } + + if ext := filepath.Ext(path); ext != ".go" && ext != ".proto" { + return nil + } + if strings.HasSuffix(path, ".pb.go") { + // .pb.go files are generated from the proto files. + // .proto files must have license headers. + return nil + } + if path == "bigtable/cmd/cbt/cbtdoc.go" { + // Automatically generated. + return nil + } + if path == "cmd/go-cloud-debug-agent/internal/debug/elf/elf.go" { + // BSD license, which is compatible, is embedded in the file. + return nil + } + src, err := ioutil.ReadFile(path) + if err != nil { + return nil + } + src = src[:300] // Ensure all of the sentinel values are at the top of the file. + + // Find license + for _, sentinel := range sentinels { + if !bytes.Contains(src, []byte(sentinel)) { + t.Errorf("%v: license header not present. want %q", path, sentinel) + return nil + } + } + + return nil + }) + if err != nil { + t.Fatal(err) + } +} diff --git a/vendor/cloud.google.com/go/logging/apiv2/README.md b/vendor/cloud.google.com/go/logging/apiv2/README.md new file mode 100644 index 000000000..d2d9a176e --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/README.md @@ -0,0 +1,11 @@ +Auto-generated logging v2 clients +================================= + +This package includes auto-generated clients for the logging v2 API. + +Use the handwritten logging client (in the parent directory, +cloud.google.com/go/logging) in preference to this. + +This code is EXPERIMENTAL and subject to CHANGE AT ANY TIME. + + diff --git a/vendor/cloud.google.com/go/logging/apiv2/WriteLogEntries_smoke_test.go b/vendor/cloud.google.com/go/logging/apiv2/WriteLogEntries_smoke_test.go new file mode 100644 index 000000000..ed8d1d022 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/WriteLogEntries_smoke_test.go @@ -0,0 +1,68 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package logging + +import ( + loggingpb "google.golang.org/genproto/googleapis/logging/v2" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestLoggingServiceV2Smoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var entries []*loggingpb.LogEntry = nil + var formattedLogName string = fmt.Sprintf("projects/%s/logs/%s", projectId, "test-"+strconv.FormatInt(time.Now().UnixNano(), 10)+"") + var request = &loggingpb.WriteLogEntriesRequest{ + Entries: entries, + LogName: formattedLogName, + } + + if _, err := c.WriteLogEntries(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/logging/apiv2/config_client.go b/vendor/cloud.google.com/go/logging/apiv2/config_client.go new file mode 100644 index 000000000..b711c0aa3 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/config_client.go @@ -0,0 +1,427 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package logging + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ConfigCallOptions contains the retry settings for each method of ConfigClient. +type ConfigCallOptions struct { + ListSinks []gax.CallOption + GetSink []gax.CallOption + CreateSink []gax.CallOption + UpdateSink []gax.CallOption + DeleteSink []gax.CallOption + ListExclusions []gax.CallOption + GetExclusion []gax.CallOption + CreateExclusion []gax.CallOption + UpdateExclusion []gax.CallOption + DeleteExclusion []gax.CallOption +} + +func defaultConfigClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("logging.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultConfigCallOptions() *ConfigCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ConfigCallOptions{ + ListSinks: retry[[2]string{"default", "idempotent"}], + GetSink: retry[[2]string{"default", "idempotent"}], + CreateSink: retry[[2]string{"default", "non_idempotent"}], + UpdateSink: retry[[2]string{"default", "idempotent"}], + DeleteSink: retry[[2]string{"default", "idempotent"}], + ListExclusions: retry[[2]string{"default", "idempotent"}], + GetExclusion: retry[[2]string{"default", "idempotent"}], + CreateExclusion: retry[[2]string{"default", "non_idempotent"}], + UpdateExclusion: retry[[2]string{"default", "non_idempotent"}], + DeleteExclusion: retry[[2]string{"default", "idempotent"}], + } +} + +// ConfigClient is a client for interacting with Stackdriver Logging API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ConfigClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + configClient loggingpb.ConfigServiceV2Client + + // The call options for this service. + CallOptions *ConfigCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewConfigClient creates a new config service v2 client. +// +// Service for configuring sinks used to export log entries out of +// Logging. +func NewConfigClient(ctx context.Context, opts ...option.ClientOption) (*ConfigClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultConfigClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ConfigClient{ + conn: conn, + CallOptions: defaultConfigCallOptions(), + + configClient: loggingpb.NewConfigServiceV2Client(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ConfigClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ConfigClient) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ConfigClient) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListSinks lists sinks. +func (c *ConfigClient) ListSinks(ctx context.Context, req *loggingpb.ListSinksRequest, opts ...gax.CallOption) *LogSinkIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListSinks[0:len(c.CallOptions.ListSinks):len(c.CallOptions.ListSinks)], opts...) + it := &LogSinkIterator{} + req = proto.Clone(req).(*loggingpb.ListSinksRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogSink, string, error) { + var resp *loggingpb.ListSinksResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.ListSinks(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Sinks, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetSink gets a sink. +func (c *ConfigClient) GetSink(ctx context.Context, req *loggingpb.GetSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetSink[0:len(c.CallOptions.GetSink):len(c.CallOptions.GetSink)], opts...) + var resp *loggingpb.LogSink + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.GetSink(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateSink creates a sink that exports specified log entries to a destination. The +// export of newly-ingested log entries begins immediately, unless the sink's +// writer_identity is not permitted to write to the destination. A sink can +// export log entries only from the resource owning the sink. +func (c *ConfigClient) CreateSink(ctx context.Context, req *loggingpb.CreateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateSink[0:len(c.CallOptions.CreateSink):len(c.CallOptions.CreateSink)], opts...) + var resp *loggingpb.LogSink + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.CreateSink(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateSink updates a sink. This method replaces the following fields in the existing +// sink with values from the new sink: destination, and filter. +// The updated sink might also have a new writer_identity; see the +// unique_writer_identity field. +func (c *ConfigClient) UpdateSink(ctx context.Context, req *loggingpb.UpdateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateSink[0:len(c.CallOptions.UpdateSink):len(c.CallOptions.UpdateSink)], opts...) + var resp *loggingpb.LogSink + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.UpdateSink(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteSink deletes a sink. If the sink has a unique writer_identity, then that +// service account is also deleted. +func (c *ConfigClient) DeleteSink(ctx context.Context, req *loggingpb.DeleteSinkRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteSink[0:len(c.CallOptions.DeleteSink):len(c.CallOptions.DeleteSink)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.configClient.DeleteSink(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListExclusions lists all the exclusions in a parent resource. +func (c *ConfigClient) ListExclusions(ctx context.Context, req *loggingpb.ListExclusionsRequest, opts ...gax.CallOption) *LogExclusionIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListExclusions[0:len(c.CallOptions.ListExclusions):len(c.CallOptions.ListExclusions)], opts...) + it := &LogExclusionIterator{} + req = proto.Clone(req).(*loggingpb.ListExclusionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogExclusion, string, error) { + var resp *loggingpb.ListExclusionsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.ListExclusions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Exclusions, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetExclusion gets the description of an exclusion. +func (c *ConfigClient) GetExclusion(ctx context.Context, req *loggingpb.GetExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetExclusion[0:len(c.CallOptions.GetExclusion):len(c.CallOptions.GetExclusion)], opts...) + var resp *loggingpb.LogExclusion + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.GetExclusion(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateExclusion creates a new exclusion in a specified parent resource. +// Only log entries belonging to that resource can be excluded. +// You can have up to 10 exclusions in a resource. +func (c *ConfigClient) CreateExclusion(ctx context.Context, req *loggingpb.CreateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateExclusion[0:len(c.CallOptions.CreateExclusion):len(c.CallOptions.CreateExclusion)], opts...) + var resp *loggingpb.LogExclusion + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.CreateExclusion(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateExclusion changes one or more properties of an existing exclusion. +func (c *ConfigClient) UpdateExclusion(ctx context.Context, req *loggingpb.UpdateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateExclusion[0:len(c.CallOptions.UpdateExclusion):len(c.CallOptions.UpdateExclusion)], opts...) + var resp *loggingpb.LogExclusion + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.configClient.UpdateExclusion(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteExclusion deletes an exclusion. +func (c *ConfigClient) DeleteExclusion(ctx context.Context, req *loggingpb.DeleteExclusionRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteExclusion[0:len(c.CallOptions.DeleteExclusion):len(c.CallOptions.DeleteExclusion)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.configClient.DeleteExclusion(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// LogExclusionIterator manages a stream of *loggingpb.LogExclusion. +type LogExclusionIterator struct { + items []*loggingpb.LogExclusion + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogExclusion, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *LogExclusionIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *LogExclusionIterator) Next() (*loggingpb.LogExclusion, error) { + var item *loggingpb.LogExclusion + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *LogExclusionIterator) bufLen() int { + return len(it.items) +} + +func (it *LogExclusionIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// LogSinkIterator manages a stream of *loggingpb.LogSink. +type LogSinkIterator struct { + items []*loggingpb.LogSink + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogSink, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *LogSinkIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *LogSinkIterator) Next() (*loggingpb.LogSink, error) { + var item *loggingpb.LogSink + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *LogSinkIterator) bufLen() int { + return len(it.items) +} + +func (it *LogSinkIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/logging/apiv2/config_client_example_test.go b/vendor/cloud.google.com/go/logging/apiv2/config_client_example_test.go new file mode 100644 index 000000000..5462d5892 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/config_client_example_test.go @@ -0,0 +1,223 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package logging_test + +import ( + "context" + + logging "cloud.google.com/go/logging/apiv2" + "google.golang.org/api/iterator" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" +) + +func ExampleNewConfigClient() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleConfigClient_ListSinks() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.ListSinksRequest{ + // TODO: Fill request struct fields. + } + it := c.ListSinks(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleConfigClient_GetSink() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.GetSinkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSink(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConfigClient_CreateSink() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.CreateSinkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateSink(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConfigClient_UpdateSink() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.UpdateSinkRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateSink(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConfigClient_DeleteSink() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.DeleteSinkRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteSink(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleConfigClient_ListExclusions() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.ListExclusionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListExclusions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleConfigClient_GetExclusion() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.GetExclusionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetExclusion(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConfigClient_CreateExclusion() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.CreateExclusionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateExclusion(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConfigClient_UpdateExclusion() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.UpdateExclusionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateExclusion(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleConfigClient_DeleteExclusion() { + ctx := context.Background() + c, err := logging.NewConfigClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.DeleteExclusionRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteExclusion(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/logging/apiv2/doc.go b/vendor/cloud.google.com/go/logging/apiv2/doc.go new file mode 100644 index 000000000..6ee4c618a --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/doc.go @@ -0,0 +1,95 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package logging is an auto-generated package for the +// Stackdriver Logging API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Writes log entries and manages your Logging configuration. +// +// Use the client at cloud.google.com/go/logging in preference to this. +package logging // import "cloud.google.com/go/logging/apiv2" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/logging.admin", + "https://www.googleapis.com/auth/logging.read", + "https://www.googleapis.com/auth/logging.write", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/logging/apiv2/logging_client.go b/vendor/cloud.google.com/go/logging/apiv2/logging_client.go new file mode 100644 index 000000000..39588c7ce --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/logging_client.go @@ -0,0 +1,407 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package logging + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + DeleteLog []gax.CallOption + WriteLogEntries []gax.CallOption + ListLogEntries []gax.CallOption + ListMonitoredResourceDescriptors []gax.CallOption + ListLogs []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("logging.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + DeleteLog: retry[[2]string{"default", "idempotent"}], + WriteLogEntries: retry[[2]string{"default", "non_idempotent"}], + ListLogEntries: retry[[2]string{"default", "idempotent"}], + ListMonitoredResourceDescriptors: retry[[2]string{"default", "idempotent"}], + ListLogs: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Stackdriver Logging API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client loggingpb.LoggingServiceV2Client + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new logging service v2 client. +// +// Service for ingesting and querying logs. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: loggingpb.NewLoggingServiceV2Client(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// DeleteLog deletes all the log entries in a log. +// The log reappears if it receives new entries. +// Log entries written shortly before the delete operation might not be +// deleted. +func (c *Client) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteLog[0:len(c.CallOptions.DeleteLog):len(c.CallOptions.DeleteLog)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteLog(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// WriteLogEntries writes log entries to Logging. This API method is the +// only way to send log entries to Logging. This method +// is used, directly or indirectly, by the Logging agent +// (fluentd) and all logging libraries configured to use Logging. +// A single request may contain log entries for a maximum of 1000 +// different resources (projects, organizations, billing accounts or +// folders) +func (c *Client) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEntriesRequest, opts ...gax.CallOption) (*loggingpb.WriteLogEntriesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.WriteLogEntries[0:len(c.CallOptions.WriteLogEntries):len(c.CallOptions.WriteLogEntries)], opts...) + var resp *loggingpb.WriteLogEntriesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.WriteLogEntries(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListLogEntries lists log entries. Use this method to retrieve log entries from +// Logging. For ways to export log entries, see +// Exporting Logs (at /logging/docs/export). +func (c *Client) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntriesRequest, opts ...gax.CallOption) *LogEntryIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListLogEntries[0:len(c.CallOptions.ListLogEntries):len(c.CallOptions.ListLogEntries)], opts...) + it := &LogEntryIterator{} + req = proto.Clone(req).(*loggingpb.ListLogEntriesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogEntry, string, error) { + var resp *loggingpb.ListLogEntriesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListLogEntries(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Entries, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListMonitoredResourceDescriptors lists the descriptors for monitored resource types used by Logging. +func (c *Client) ListMonitoredResourceDescriptors(ctx context.Context, req *loggingpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListMonitoredResourceDescriptors[0:len(c.CallOptions.ListMonitoredResourceDescriptors):len(c.CallOptions.ListMonitoredResourceDescriptors)], opts...) + it := &MonitoredResourceDescriptorIterator{} + req = proto.Clone(req).(*loggingpb.ListMonitoredResourceDescriptorsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoredrespb.MonitoredResourceDescriptor, string, error) { + var resp *loggingpb.ListMonitoredResourceDescriptorsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListMonitoredResourceDescriptors(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.ResourceDescriptors, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListLogs lists the logs in projects, organizations, folders, or billing accounts. +// Only logs that have entries are listed. +func (c *Client) ListLogs(ctx context.Context, req *loggingpb.ListLogsRequest, opts ...gax.CallOption) *StringIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListLogs[0:len(c.CallOptions.ListLogs):len(c.CallOptions.ListLogs)], opts...) + it := &StringIterator{} + req = proto.Clone(req).(*loggingpb.ListLogsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]string, string, error) { + var resp *loggingpb.ListLogsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListLogs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.LogNames, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// LogEntryIterator manages a stream of *loggingpb.LogEntry. +type LogEntryIterator struct { + items []*loggingpb.LogEntry + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogEntry, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *LogEntryIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *LogEntryIterator) Next() (*loggingpb.LogEntry, error) { + var item *loggingpb.LogEntry + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *LogEntryIterator) bufLen() int { + return len(it.items) +} + +func (it *LogEntryIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// MonitoredResourceDescriptorIterator manages a stream of *monitoredrespb.MonitoredResourceDescriptor. +type MonitoredResourceDescriptorIterator struct { + items []*monitoredrespb.MonitoredResourceDescriptor + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoredrespb.MonitoredResourceDescriptor, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *MonitoredResourceDescriptorIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *MonitoredResourceDescriptorIterator) Next() (*monitoredrespb.MonitoredResourceDescriptor, error) { + var item *monitoredrespb.MonitoredResourceDescriptor + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *MonitoredResourceDescriptorIterator) bufLen() int { + return len(it.items) +} + +func (it *MonitoredResourceDescriptorIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// StringIterator manages a stream of string. +type StringIterator struct { + items []string + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []string, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *StringIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *StringIterator) Next() (string, error) { + var item string + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *StringIterator) bufLen() int { + return len(it.items) +} + +func (it *StringIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/logging/apiv2/logging_client_example_test.go b/vendor/cloud.google.com/go/logging/apiv2/logging_client_example_test.go new file mode 100644 index 000000000..edaad8f3a --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/logging_client_example_test.go @@ -0,0 +1,141 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package logging_test + +import ( + "context" + + logging "cloud.google.com/go/logging/apiv2" + "google.golang.org/api/iterator" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := logging.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_DeleteLog() { + ctx := context.Background() + c, err := logging.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.DeleteLogRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteLog(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_WriteLogEntries() { + ctx := context.Background() + c, err := logging.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.WriteLogEntriesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.WriteLogEntries(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListLogEntries() { + ctx := context.Background() + c, err := logging.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.ListLogEntriesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListLogEntries(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_ListMonitoredResourceDescriptors() { + ctx := context.Background() + c, err := logging.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.ListMonitoredResourceDescriptorsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListMonitoredResourceDescriptors(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_ListLogs() { + ctx := context.Background() + c, err := logging.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.ListLogsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListLogs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go b/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go new file mode 100644 index 000000000..7e53526c6 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go @@ -0,0 +1,268 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package logging + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// MetricsCallOptions contains the retry settings for each method of MetricsClient. +type MetricsCallOptions struct { + ListLogMetrics []gax.CallOption + GetLogMetric []gax.CallOption + CreateLogMetric []gax.CallOption + UpdateLogMetric []gax.CallOption + DeleteLogMetric []gax.CallOption +} + +func defaultMetricsClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("logging.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultMetricsCallOptions() *MetricsCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &MetricsCallOptions{ + ListLogMetrics: retry[[2]string{"default", "idempotent"}], + GetLogMetric: retry[[2]string{"default", "idempotent"}], + CreateLogMetric: retry[[2]string{"default", "non_idempotent"}], + UpdateLogMetric: retry[[2]string{"default", "idempotent"}], + DeleteLogMetric: retry[[2]string{"default", "idempotent"}], + } +} + +// MetricsClient is a client for interacting with Stackdriver Logging API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type MetricsClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + metricsClient loggingpb.MetricsServiceV2Client + + // The call options for this service. + CallOptions *MetricsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewMetricsClient creates a new metrics service v2 client. +// +// Service for configuring logs-based metrics. +func NewMetricsClient(ctx context.Context, opts ...option.ClientOption) (*MetricsClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultMetricsClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &MetricsClient{ + conn: conn, + CallOptions: defaultMetricsCallOptions(), + + metricsClient: loggingpb.NewMetricsServiceV2Client(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *MetricsClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *MetricsClient) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *MetricsClient) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListLogMetrics lists logs-based metrics. +func (c *MetricsClient) ListLogMetrics(ctx context.Context, req *loggingpb.ListLogMetricsRequest, opts ...gax.CallOption) *LogMetricIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListLogMetrics[0:len(c.CallOptions.ListLogMetrics):len(c.CallOptions.ListLogMetrics)], opts...) + it := &LogMetricIterator{} + req = proto.Clone(req).(*loggingpb.ListLogMetricsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogMetric, string, error) { + var resp *loggingpb.ListLogMetricsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricsClient.ListLogMetrics(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Metrics, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetLogMetric gets a logs-based metric. +func (c *MetricsClient) GetLogMetric(ctx context.Context, req *loggingpb.GetLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetLogMetric[0:len(c.CallOptions.GetLogMetric):len(c.CallOptions.GetLogMetric)], opts...) + var resp *loggingpb.LogMetric + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricsClient.GetLogMetric(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateLogMetric creates a logs-based metric. +func (c *MetricsClient) CreateLogMetric(ctx context.Context, req *loggingpb.CreateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateLogMetric[0:len(c.CallOptions.CreateLogMetric):len(c.CallOptions.CreateLogMetric)], opts...) + var resp *loggingpb.LogMetric + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricsClient.CreateLogMetric(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateLogMetric creates or updates a logs-based metric. +func (c *MetricsClient) UpdateLogMetric(ctx context.Context, req *loggingpb.UpdateLogMetricRequest, opts ...gax.CallOption) (*loggingpb.LogMetric, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateLogMetric[0:len(c.CallOptions.UpdateLogMetric):len(c.CallOptions.UpdateLogMetric)], opts...) + var resp *loggingpb.LogMetric + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricsClient.UpdateLogMetric(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteLogMetric deletes a logs-based metric. +func (c *MetricsClient) DeleteLogMetric(ctx context.Context, req *loggingpb.DeleteLogMetricRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteLogMetric[0:len(c.CallOptions.DeleteLogMetric):len(c.CallOptions.DeleteLogMetric)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.metricsClient.DeleteLogMetric(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// LogMetricIterator manages a stream of *loggingpb.LogMetric. +type LogMetricIterator struct { + items []*loggingpb.LogMetric + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*loggingpb.LogMetric, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *LogMetricIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *LogMetricIterator) Next() (*loggingpb.LogMetric, error) { + var item *loggingpb.LogMetric + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *LogMetricIterator) bufLen() int { + return len(it.items) +} + +func (it *LogMetricIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/logging/apiv2/metrics_client_example_test.go b/vendor/cloud.google.com/go/logging/apiv2/metrics_client_example_test.go new file mode 100644 index 000000000..404aea7ea --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/metrics_client_example_test.go @@ -0,0 +1,129 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package logging_test + +import ( + "context" + + logging "cloud.google.com/go/logging/apiv2" + "google.golang.org/api/iterator" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" +) + +func ExampleNewMetricsClient() { + ctx := context.Background() + c, err := logging.NewMetricsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleMetricsClient_ListLogMetrics() { + ctx := context.Background() + c, err := logging.NewMetricsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.ListLogMetricsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListLogMetrics(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetricsClient_GetLogMetric() { + ctx := context.Background() + c, err := logging.NewMetricsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.GetLogMetricRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetLogMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetricsClient_CreateLogMetric() { + ctx := context.Background() + c, err := logging.NewMetricsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.CreateLogMetricRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateLogMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetricsClient_UpdateLogMetric() { + ctx := context.Background() + c, err := logging.NewMetricsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.UpdateLogMetricRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateLogMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetricsClient_DeleteLogMetric() { + ctx := context.Background() + c, err := logging.NewMetricsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &loggingpb.DeleteLogMetricRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteLogMetric(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/logging/apiv2/mock_test.go b/vendor/cloud.google.com/go/logging/apiv2/mock_test.go new file mode 100644 index 000000000..aaaece4e0 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/mock_test.go @@ -0,0 +1,1677 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package logging + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres" + loggingpb "google.golang.org/genproto/googleapis/logging/v2" + field_maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockLoggingServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + loggingpb.LoggingServiceV2Server + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockLoggingServer) DeleteLog(ctx context.Context, req *loggingpb.DeleteLogRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockLoggingServer) WriteLogEntries(ctx context.Context, req *loggingpb.WriteLogEntriesRequest) (*loggingpb.WriteLogEntriesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.WriteLogEntriesResponse), nil +} + +func (s *mockLoggingServer) ListLogEntries(ctx context.Context, req *loggingpb.ListLogEntriesRequest) (*loggingpb.ListLogEntriesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.ListLogEntriesResponse), nil +} + +func (s *mockLoggingServer) ListMonitoredResourceDescriptors(ctx context.Context, req *loggingpb.ListMonitoredResourceDescriptorsRequest) (*loggingpb.ListMonitoredResourceDescriptorsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.ListMonitoredResourceDescriptorsResponse), nil +} + +func (s *mockLoggingServer) ListLogs(ctx context.Context, req *loggingpb.ListLogsRequest) (*loggingpb.ListLogsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.ListLogsResponse), nil +} + +type mockConfigServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + loggingpb.ConfigServiceV2Server + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockConfigServer) ListSinks(ctx context.Context, req *loggingpb.ListSinksRequest) (*loggingpb.ListSinksResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.ListSinksResponse), nil +} + +func (s *mockConfigServer) GetSink(ctx context.Context, req *loggingpb.GetSinkRequest) (*loggingpb.LogSink, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.LogSink), nil +} + +func (s *mockConfigServer) CreateSink(ctx context.Context, req *loggingpb.CreateSinkRequest) (*loggingpb.LogSink, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.LogSink), nil +} + +func (s *mockConfigServer) UpdateSink(ctx context.Context, req *loggingpb.UpdateSinkRequest) (*loggingpb.LogSink, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.LogSink), nil +} + +func (s *mockConfigServer) DeleteSink(ctx context.Context, req *loggingpb.DeleteSinkRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockConfigServer) ListExclusions(ctx context.Context, req *loggingpb.ListExclusionsRequest) (*loggingpb.ListExclusionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.ListExclusionsResponse), nil +} + +func (s *mockConfigServer) GetExclusion(ctx context.Context, req *loggingpb.GetExclusionRequest) (*loggingpb.LogExclusion, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.LogExclusion), nil +} + +func (s *mockConfigServer) CreateExclusion(ctx context.Context, req *loggingpb.CreateExclusionRequest) (*loggingpb.LogExclusion, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.LogExclusion), nil +} + +func (s *mockConfigServer) UpdateExclusion(ctx context.Context, req *loggingpb.UpdateExclusionRequest) (*loggingpb.LogExclusion, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.LogExclusion), nil +} + +func (s *mockConfigServer) DeleteExclusion(ctx context.Context, req *loggingpb.DeleteExclusionRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +type mockMetricsServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + loggingpb.MetricsServiceV2Server + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockMetricsServer) ListLogMetrics(ctx context.Context, req *loggingpb.ListLogMetricsRequest) (*loggingpb.ListLogMetricsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.ListLogMetricsResponse), nil +} + +func (s *mockMetricsServer) GetLogMetric(ctx context.Context, req *loggingpb.GetLogMetricRequest) (*loggingpb.LogMetric, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.LogMetric), nil +} + +func (s *mockMetricsServer) CreateLogMetric(ctx context.Context, req *loggingpb.CreateLogMetricRequest) (*loggingpb.LogMetric, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.LogMetric), nil +} + +func (s *mockMetricsServer) UpdateLogMetric(ctx context.Context, req *loggingpb.UpdateLogMetricRequest) (*loggingpb.LogMetric, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*loggingpb.LogMetric), nil +} + +func (s *mockMetricsServer) DeleteLogMetric(ctx context.Context, req *loggingpb.DeleteLogMetricRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockLogging mockLoggingServer + mockConfig mockConfigServer + mockMetrics mockMetricsServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + loggingpb.RegisterLoggingServiceV2Server(serv, &mockLogging) + loggingpb.RegisterConfigServiceV2Server(serv, &mockConfig) + loggingpb.RegisterMetricsServiceV2Server(serv, &mockMetrics) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestLoggingServiceV2DeleteLog(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockLogging.err = nil + mockLogging.reqs = nil + + mockLogging.resps = append(mockLogging.resps[:0], expectedResponse) + + var formattedLogName string = fmt.Sprintf("projects/%s/logs/%s", "[PROJECT]", "[LOG]") + var request = &loggingpb.DeleteLogRequest{ + LogName: formattedLogName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteLog(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLogging.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestLoggingServiceV2DeleteLogError(t *testing.T) { + errCode := codes.PermissionDenied + mockLogging.err = gstatus.Error(errCode, "test error") + + var formattedLogName string = fmt.Sprintf("projects/%s/logs/%s", "[PROJECT]", "[LOG]") + var request = &loggingpb.DeleteLogRequest{ + LogName: formattedLogName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteLog(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestLoggingServiceV2WriteLogEntries(t *testing.T) { + var expectedResponse *loggingpb.WriteLogEntriesResponse = &loggingpb.WriteLogEntriesResponse{} + + mockLogging.err = nil + mockLogging.reqs = nil + + mockLogging.resps = append(mockLogging.resps[:0], expectedResponse) + + var entries []*loggingpb.LogEntry = nil + var request = &loggingpb.WriteLogEntriesRequest{ + Entries: entries, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.WriteLogEntries(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLogging.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLoggingServiceV2WriteLogEntriesError(t *testing.T) { + errCode := codes.PermissionDenied + mockLogging.err = gstatus.Error(errCode, "test error") + + var entries []*loggingpb.LogEntry = nil + var request = &loggingpb.WriteLogEntriesRequest{ + Entries: entries, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.WriteLogEntries(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLoggingServiceV2ListLogEntries(t *testing.T) { + var nextPageToken string = "" + var entriesElement *loggingpb.LogEntry = &loggingpb.LogEntry{} + var entries = []*loggingpb.LogEntry{entriesElement} + var expectedResponse = &loggingpb.ListLogEntriesResponse{ + NextPageToken: nextPageToken, + Entries: entries, + } + + mockLogging.err = nil + mockLogging.reqs = nil + + mockLogging.resps = append(mockLogging.resps[:0], expectedResponse) + + var formattedResourceNames []string = nil + var request = &loggingpb.ListLogEntriesRequest{ + ResourceNames: formattedResourceNames, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListLogEntries(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLogging.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Entries[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLoggingServiceV2ListLogEntriesError(t *testing.T) { + errCode := codes.PermissionDenied + mockLogging.err = gstatus.Error(errCode, "test error") + + var formattedResourceNames []string = nil + var request = &loggingpb.ListLogEntriesRequest{ + ResourceNames: formattedResourceNames, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListLogEntries(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLoggingServiceV2ListMonitoredResourceDescriptors(t *testing.T) { + var nextPageToken string = "" + var resourceDescriptorsElement *monitoredrespb.MonitoredResourceDescriptor = &monitoredrespb.MonitoredResourceDescriptor{} + var resourceDescriptors = []*monitoredrespb.MonitoredResourceDescriptor{resourceDescriptorsElement} + var expectedResponse = &loggingpb.ListMonitoredResourceDescriptorsResponse{ + NextPageToken: nextPageToken, + ResourceDescriptors: resourceDescriptors, + } + + mockLogging.err = nil + mockLogging.reqs = nil + + mockLogging.resps = append(mockLogging.resps[:0], expectedResponse) + + var request *loggingpb.ListMonitoredResourceDescriptorsRequest = &loggingpb.ListMonitoredResourceDescriptorsRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListMonitoredResourceDescriptors(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLogging.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.ResourceDescriptors[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLoggingServiceV2ListMonitoredResourceDescriptorsError(t *testing.T) { + errCode := codes.PermissionDenied + mockLogging.err = gstatus.Error(errCode, "test error") + + var request *loggingpb.ListMonitoredResourceDescriptorsRequest = &loggingpb.ListMonitoredResourceDescriptorsRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListMonitoredResourceDescriptors(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestLoggingServiceV2ListLogs(t *testing.T) { + var nextPageToken string = "" + var logNamesElement string = "logNamesElement-1079688374" + var logNames = []string{logNamesElement} + var expectedResponse = &loggingpb.ListLogsResponse{ + NextPageToken: nextPageToken, + LogNames: logNames, + } + + mockLogging.err = nil + mockLogging.reqs = nil + + mockLogging.resps = append(mockLogging.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &loggingpb.ListLogsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListLogs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockLogging.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.LogNames[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestLoggingServiceV2ListLogsError(t *testing.T) { + errCode := codes.PermissionDenied + mockLogging.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &loggingpb.ListLogsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListLogs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConfigServiceV2ListSinks(t *testing.T) { + var nextPageToken string = "" + var sinksElement *loggingpb.LogSink = &loggingpb.LogSink{} + var sinks = []*loggingpb.LogSink{sinksElement} + var expectedResponse = &loggingpb.ListSinksResponse{ + NextPageToken: nextPageToken, + Sinks: sinks, + } + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &loggingpb.ListSinksRequest{ + Parent: formattedParent, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSinks(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Sinks[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConfigServiceV2ListSinksError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &loggingpb.ListSinksRequest{ + Parent: formattedParent, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSinks(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConfigServiceV2GetSink(t *testing.T) { + var name string = "name3373707" + var destination string = "destination-1429847026" + var filter string = "filter-1274492040" + var writerIdentity string = "writerIdentity775638794" + var includeChildren bool = true + var expectedResponse = &loggingpb.LogSink{ + Name: name, + Destination: destination, + Filter: filter, + WriterIdentity: writerIdentity, + IncludeChildren: includeChildren, + } + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedSinkName string = fmt.Sprintf("projects/%s/sinks/%s", "[PROJECT]", "[SINK]") + var request = &loggingpb.GetSinkRequest{ + SinkName: formattedSinkName, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSink(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConfigServiceV2GetSinkError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedSinkName string = fmt.Sprintf("projects/%s/sinks/%s", "[PROJECT]", "[SINK]") + var request = &loggingpb.GetSinkRequest{ + SinkName: formattedSinkName, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSink(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConfigServiceV2CreateSink(t *testing.T) { + var name string = "name3373707" + var destination string = "destination-1429847026" + var filter string = "filter-1274492040" + var writerIdentity string = "writerIdentity775638794" + var includeChildren bool = true + var expectedResponse = &loggingpb.LogSink{ + Name: name, + Destination: destination, + Filter: filter, + WriterIdentity: writerIdentity, + IncludeChildren: includeChildren, + } + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var sink *loggingpb.LogSink = &loggingpb.LogSink{} + var request = &loggingpb.CreateSinkRequest{ + Parent: formattedParent, + Sink: sink, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSink(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConfigServiceV2CreateSinkError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var sink *loggingpb.LogSink = &loggingpb.LogSink{} + var request = &loggingpb.CreateSinkRequest{ + Parent: formattedParent, + Sink: sink, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSink(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConfigServiceV2UpdateSink(t *testing.T) { + var name string = "name3373707" + var destination string = "destination-1429847026" + var filter string = "filter-1274492040" + var writerIdentity string = "writerIdentity775638794" + var includeChildren bool = true + var expectedResponse = &loggingpb.LogSink{ + Name: name, + Destination: destination, + Filter: filter, + WriterIdentity: writerIdentity, + IncludeChildren: includeChildren, + } + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedSinkName string = fmt.Sprintf("projects/%s/sinks/%s", "[PROJECT]", "[SINK]") + var sink *loggingpb.LogSink = &loggingpb.LogSink{} + var request = &loggingpb.UpdateSinkRequest{ + SinkName: formattedSinkName, + Sink: sink, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSink(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConfigServiceV2UpdateSinkError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedSinkName string = fmt.Sprintf("projects/%s/sinks/%s", "[PROJECT]", "[SINK]") + var sink *loggingpb.LogSink = &loggingpb.LogSink{} + var request = &loggingpb.UpdateSinkRequest{ + SinkName: formattedSinkName, + Sink: sink, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSink(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConfigServiceV2DeleteSink(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedSinkName string = fmt.Sprintf("projects/%s/sinks/%s", "[PROJECT]", "[SINK]") + var request = &loggingpb.DeleteSinkRequest{ + SinkName: formattedSinkName, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSink(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestConfigServiceV2DeleteSinkError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedSinkName string = fmt.Sprintf("projects/%s/sinks/%s", "[PROJECT]", "[SINK]") + var request = &loggingpb.DeleteSinkRequest{ + SinkName: formattedSinkName, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSink(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestConfigServiceV2ListExclusions(t *testing.T) { + var nextPageToken string = "" + var exclusionsElement *loggingpb.LogExclusion = &loggingpb.LogExclusion{} + var exclusions = []*loggingpb.LogExclusion{exclusionsElement} + var expectedResponse = &loggingpb.ListExclusionsResponse{ + NextPageToken: nextPageToken, + Exclusions: exclusions, + } + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &loggingpb.ListExclusionsRequest{ + Parent: formattedParent, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListExclusions(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Exclusions[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConfigServiceV2ListExclusionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &loggingpb.ListExclusionsRequest{ + Parent: formattedParent, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListExclusions(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConfigServiceV2GetExclusion(t *testing.T) { + var name2 string = "name2-1052831874" + var description string = "description-1724546052" + var filter string = "filter-1274492040" + var disabled bool = true + var expectedResponse = &loggingpb.LogExclusion{ + Name: name2, + Description: description, + Filter: filter, + Disabled: disabled, + } + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/exclusions/%s", "[PROJECT]", "[EXCLUSION]") + var request = &loggingpb.GetExclusionRequest{ + Name: formattedName, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetExclusion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConfigServiceV2GetExclusionError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/exclusions/%s", "[PROJECT]", "[EXCLUSION]") + var request = &loggingpb.GetExclusionRequest{ + Name: formattedName, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetExclusion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConfigServiceV2CreateExclusion(t *testing.T) { + var name string = "name3373707" + var description string = "description-1724546052" + var filter string = "filter-1274492040" + var disabled bool = true + var expectedResponse = &loggingpb.LogExclusion{ + Name: name, + Description: description, + Filter: filter, + Disabled: disabled, + } + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var exclusion *loggingpb.LogExclusion = &loggingpb.LogExclusion{} + var request = &loggingpb.CreateExclusionRequest{ + Parent: formattedParent, + Exclusion: exclusion, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateExclusion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConfigServiceV2CreateExclusionError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var exclusion *loggingpb.LogExclusion = &loggingpb.LogExclusion{} + var request = &loggingpb.CreateExclusionRequest{ + Parent: formattedParent, + Exclusion: exclusion, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateExclusion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConfigServiceV2UpdateExclusion(t *testing.T) { + var name2 string = "name2-1052831874" + var description string = "description-1724546052" + var filter string = "filter-1274492040" + var disabled bool = true + var expectedResponse = &loggingpb.LogExclusion{ + Name: name2, + Description: description, + Filter: filter, + Disabled: disabled, + } + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/exclusions/%s", "[PROJECT]", "[EXCLUSION]") + var exclusion *loggingpb.LogExclusion = &loggingpb.LogExclusion{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &loggingpb.UpdateExclusionRequest{ + Name: formattedName, + Exclusion: exclusion, + UpdateMask: updateMask, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateExclusion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestConfigServiceV2UpdateExclusionError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/exclusions/%s", "[PROJECT]", "[EXCLUSION]") + var exclusion *loggingpb.LogExclusion = &loggingpb.LogExclusion{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &loggingpb.UpdateExclusionRequest{ + Name: formattedName, + Exclusion: exclusion, + UpdateMask: updateMask, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateExclusion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestConfigServiceV2DeleteExclusion(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockConfig.err = nil + mockConfig.reqs = nil + + mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/exclusions/%s", "[PROJECT]", "[EXCLUSION]") + var request = &loggingpb.DeleteExclusionRequest{ + Name: formattedName, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteExclusion(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestConfigServiceV2DeleteExclusionError(t *testing.T) { + errCode := codes.PermissionDenied + mockConfig.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/exclusions/%s", "[PROJECT]", "[EXCLUSION]") + var request = &loggingpb.DeleteExclusionRequest{ + Name: formattedName, + } + + c, err := NewConfigClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteExclusion(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestMetricsServiceV2ListLogMetrics(t *testing.T) { + var nextPageToken string = "" + var metricsElement *loggingpb.LogMetric = &loggingpb.LogMetric{} + var metrics = []*loggingpb.LogMetric{metricsElement} + var expectedResponse = &loggingpb.ListLogMetricsResponse{ + NextPageToken: nextPageToken, + Metrics: metrics, + } + + mockMetrics.err = nil + mockMetrics.reqs = nil + + mockMetrics.resps = append(mockMetrics.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &loggingpb.ListLogMetricsRequest{ + Parent: formattedParent, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListLogMetrics(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetrics.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Metrics[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricsServiceV2ListLogMetricsError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetrics.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &loggingpb.ListLogMetricsRequest{ + Parent: formattedParent, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListLogMetrics(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricsServiceV2GetLogMetric(t *testing.T) { + var name string = "name3373707" + var description string = "description-1724546052" + var filter string = "filter-1274492040" + var valueExtractor string = "valueExtractor2047672534" + var expectedResponse = &loggingpb.LogMetric{ + Name: name, + Description: description, + Filter: filter, + ValueExtractor: valueExtractor, + } + + mockMetrics.err = nil + mockMetrics.reqs = nil + + mockMetrics.resps = append(mockMetrics.resps[:0], expectedResponse) + + var formattedMetricName string = fmt.Sprintf("projects/%s/metrics/%s", "[PROJECT]", "[METRIC]") + var request = &loggingpb.GetLogMetricRequest{ + MetricName: formattedMetricName, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetLogMetric(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetrics.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricsServiceV2GetLogMetricError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetrics.err = gstatus.Error(errCode, "test error") + + var formattedMetricName string = fmt.Sprintf("projects/%s/metrics/%s", "[PROJECT]", "[METRIC]") + var request = &loggingpb.GetLogMetricRequest{ + MetricName: formattedMetricName, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetLogMetric(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricsServiceV2CreateLogMetric(t *testing.T) { + var name string = "name3373707" + var description string = "description-1724546052" + var filter string = "filter-1274492040" + var valueExtractor string = "valueExtractor2047672534" + var expectedResponse = &loggingpb.LogMetric{ + Name: name, + Description: description, + Filter: filter, + ValueExtractor: valueExtractor, + } + + mockMetrics.err = nil + mockMetrics.reqs = nil + + mockMetrics.resps = append(mockMetrics.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var metric *loggingpb.LogMetric = &loggingpb.LogMetric{} + var request = &loggingpb.CreateLogMetricRequest{ + Parent: formattedParent, + Metric: metric, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateLogMetric(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetrics.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricsServiceV2CreateLogMetricError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetrics.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var metric *loggingpb.LogMetric = &loggingpb.LogMetric{} + var request = &loggingpb.CreateLogMetricRequest{ + Parent: formattedParent, + Metric: metric, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateLogMetric(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricsServiceV2UpdateLogMetric(t *testing.T) { + var name string = "name3373707" + var description string = "description-1724546052" + var filter string = "filter-1274492040" + var valueExtractor string = "valueExtractor2047672534" + var expectedResponse = &loggingpb.LogMetric{ + Name: name, + Description: description, + Filter: filter, + ValueExtractor: valueExtractor, + } + + mockMetrics.err = nil + mockMetrics.reqs = nil + + mockMetrics.resps = append(mockMetrics.resps[:0], expectedResponse) + + var formattedMetricName string = fmt.Sprintf("projects/%s/metrics/%s", "[PROJECT]", "[METRIC]") + var metric *loggingpb.LogMetric = &loggingpb.LogMetric{} + var request = &loggingpb.UpdateLogMetricRequest{ + MetricName: formattedMetricName, + Metric: metric, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateLogMetric(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetrics.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricsServiceV2UpdateLogMetricError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetrics.err = gstatus.Error(errCode, "test error") + + var formattedMetricName string = fmt.Sprintf("projects/%s/metrics/%s", "[PROJECT]", "[METRIC]") + var metric *loggingpb.LogMetric = &loggingpb.LogMetric{} + var request = &loggingpb.UpdateLogMetricRequest{ + MetricName: formattedMetricName, + Metric: metric, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateLogMetric(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricsServiceV2DeleteLogMetric(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockMetrics.err = nil + mockMetrics.reqs = nil + + mockMetrics.resps = append(mockMetrics.resps[:0], expectedResponse) + + var formattedMetricName string = fmt.Sprintf("projects/%s/metrics/%s", "[PROJECT]", "[METRIC]") + var request = &loggingpb.DeleteLogMetricRequest{ + MetricName: formattedMetricName, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteLogMetric(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetrics.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestMetricsServiceV2DeleteLogMetricError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetrics.err = gstatus.Error(errCode, "test error") + + var formattedMetricName string = fmt.Sprintf("projects/%s/metrics/%s", "[PROJECT]", "[METRIC]") + var request = &loggingpb.DeleteLogMetricRequest{ + MetricName: formattedMetricName, + } + + c, err := NewMetricsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteLogMetric(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} diff --git a/vendor/cloud.google.com/go/logging/apiv2/path_funcs.go b/vendor/cloud.google.com/go/logging/apiv2/path_funcs.go new file mode 100644 index 000000000..37bbe9d4f --- /dev/null +++ b/vendor/cloud.google.com/go/logging/apiv2/path_funcs.go @@ -0,0 +1,107 @@ +// 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 +// +// https://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 logging + +// ConfigProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func ConfigProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// ConfigSinkPath returns the path for the sink resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/sinks/%s", project, sink) +// instead. +func ConfigSinkPath(project, sink string) string { + return "" + + "projects/" + + project + + "/sinks/" + + sink + + "" +} + +// ConfigExclusionPath returns the path for the exclusion resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/exclusions/%s", project, exclusion) +// instead. +func ConfigExclusionPath(project, exclusion string) string { + return "" + + "projects/" + + project + + "/exclusions/" + + exclusion + + "" +} + +// ProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func ProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// LogPath returns the path for the log resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/logs/%s", project, log) +// instead. +func LogPath(project, log string) string { + return "" + + "projects/" + + project + + "/logs/" + + log + + "" +} + +// MetricsProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func MetricsProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// MetricsMetricPath returns the path for the metric resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/metrics/%s", project, metric) +// instead. +func MetricsMetricPath(project, metric string) string { + return "" + + "projects/" + + project + + "/metrics/" + + metric + + "" +} diff --git a/vendor/cloud.google.com/go/logging/doc.go b/vendor/cloud.google.com/go/logging/doc.go new file mode 100644 index 000000000..2f3c1815d --- /dev/null +++ b/vendor/cloud.google.com/go/logging/doc.go @@ -0,0 +1,134 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package logging contains a Stackdriver Logging client suitable for writing logs. +For reading logs, and working with sinks, metrics and monitored resources, +see package cloud.google.com/go/logging/logadmin. + +This client uses Logging API v2. +See https://cloud.google.com/logging/docs/api/v2/ for an introduction to the API. + + +Note: This package is in beta. Some backwards-incompatible changes may occur. + + +Creating a Client + +Use a Client to interact with the Stackdriver Logging API. + + // Create a Client + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + + +Basic Usage + +For most use cases, you'll want to add log entries to a buffer to be periodically +flushed (automatically and asynchronously) to the Stackdriver Logging service. + + // Initialize a logger + lg := client.Logger("my-log") + + // Add entry to log buffer + lg.Log(logging.Entry{Payload: "something happened!"}) + + +Closing your Client + +You should call Client.Close before your program exits to flush any buffered log entries to the Stackdriver Logging service. + + // Close the client when finished. + err = client.Close() + if err != nil { + // TODO: Handle error. + } + + +Synchronous Logging + +For critical errors, you may want to send your log entries immediately. +LogSync is slow and will block until the log entry has been sent, so it is +not recommended for normal use. + + lg.LogSync(ctx, logging.Entry{Payload: "ALERT! Something critical happened!"}) + + +Payloads + +An entry payload can be a string, as in the examples above. It can also be any value +that can be marshaled to a JSON object, like a map[string]interface{} or a struct: + + type MyEntry struct { + Name string + Count int + } + lg.Log(logging.Entry{Payload: MyEntry{Name: "Bob", Count: 3}}) + +If you have a []byte of JSON, wrap it in json.RawMessage: + + j := []byte(`{"Name": "Bob", "Count": 3}`) + lg.Log(logging.Entry{Payload: json.RawMessage(j)}) + + +The Standard Logger Interface + +You may want use a standard log.Logger in your program. + + // stdlg implements log.Logger + stdlg := lg.StandardLogger(logging.Info) + stdlg.Println("some info") + + +Log Levels + +An Entry may have one of a number of severity levels associated with it. + + logging.Entry{ + Payload: "something terrible happened!", + Severity: logging.Critical, + } + + +Viewing Logs + +You can view Stackdriver logs for projects at +https://console.cloud.google.com/logs/viewer. Use the dropdown at the top left. When +running from a Google Cloud Platform VM, select "GCE VM Instance". Otherwise, select +"Google Project" and then the project ID. Logs for organizations, folders and billing +accounts can be viewed on the command line with the "gcloud logging read" command. + + +Grouping Logs by Request + +To group all the log entries written during a single HTTP request, create two +Loggers, a "parent" and a "child," with different log IDs. Both should be in the same +project, and have the same MonitoredResouce type and labels. + +- Parent entries must have HTTPRequest.Request populated. (Strictly speaking, only the URL is necessary.) + +- A child entry's timestamp must be within the time interval covered by the parent request (i.e., older +than parent.Timestamp, and newer than parent.Timestamp - parent.HTTPRequest.Latency, assuming the +parent timestamp marks the end of the request. + +- The trace field must be populated in all of the entries and match exactly. + +You should observe the child log entries grouped under the parent on the console. The +parent entry will not inherit the severity of its children; you must update the +parent severity yourself. +*/ +package logging // import "cloud.google.com/go/logging" diff --git a/vendor/cloud.google.com/go/logging/examples_test.go b/vendor/cloud.google.com/go/logging/examples_test.go new file mode 100644 index 000000000..b9623eea8 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/examples_test.go @@ -0,0 +1,183 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logging_test + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "cloud.google.com/go/logging" + "go.opencensus.io/trace" +) + +func ExampleNewClient() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + // Use client to manage logs, metrics and sinks. + // Close the client when finished. + if err := client.Close(); err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_Ping() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + if err := client.Ping(ctx); err != nil { + // TODO: Handle error. + } +} + +// Although Logger.Flush and Client.Close both return errors, they don't tell you +// whether the errors were frequent or significant. For most programs, it doesn't +// matter if there were a few errors while writing logs, although if those few errors +// indicated a bug in your program, you might want to know about them. The best way +// to handle errors is by setting the OnError function. If it runs quickly, it will +// see every error generated during logging. +func ExampleNewClient_errorFunc() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + // Print all errors to stdout, and count them. Multiple calls to the OnError + // function never happen concurrently, so there is no need for locking nErrs, + // provided you don't read it until after the logging client is closed. + var nErrs int + client.OnError = func(e error) { + fmt.Fprintf(os.Stdout, "logging: %v", e) + nErrs++ + } + // Use client to manage logs, metrics and sinks. + // Close the client when finished. + if err := client.Close(); err != nil { + // TODO: Handle error. + } + fmt.Printf("saw %d errors\n", nErrs) +} + +func ExampleClient_Logger() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + lg := client.Logger("my-log") + _ = lg // TODO: use the Logger. +} + +func ExampleLogger_LogSync() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + lg := client.Logger("my-log") + err = lg.LogSync(ctx, logging.Entry{Payload: "red alert"}) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleLogger_Log() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + lg := client.Logger("my-log") + lg.Log(logging.Entry{Payload: "something happened"}) +} + +// An Entry payload can be anything that marshals to a +// JSON object, like a struct. +func ExampleLogger_Log_struct() { + type MyEntry struct { + Name string + Count int + } + + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + lg := client.Logger("my-log") + lg.Log(logging.Entry{Payload: MyEntry{Name: "Bob", Count: 3}}) +} + +// To log a JSON value, wrap it in json.RawMessage. +func ExampleLogger_Log_json() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + lg := client.Logger("my-log") + j := []byte(`{"Name": "Bob", "Count": 3}`) + lg.Log(logging.Entry{Payload: json.RawMessage(j)}) +} + +func ExampleLogger_Flush() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + lg := client.Logger("my-log") + lg.Log(logging.Entry{Payload: "something happened"}) + lg.Flush() +} + +func ExampleLogger_StandardLogger() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + lg := client.Logger("my-log") + slg := lg.StandardLogger(logging.Info) + slg.Println("an informative message") +} + +func ExampleParseSeverity() { + sev := logging.ParseSeverity("ALERT") + fmt.Println(sev) + // Output: Alert +} + +// This example shows how to create a Logger that disables OpenCensus tracing of the +// WriteLogEntries RPC. +func ExampleContextFunc() { + ctx := context.Background() + client, err := logging.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + lg := client.Logger("logID", logging.ContextFunc(func() (context.Context, func()) { + ctx, span := trace.StartSpan(context.Background(), "this span will not be exported", + trace.WithSampler(trace.NeverSample())) + return ctx, span.End + })) + _ = lg // TODO: Use lg +} diff --git a/vendor/cloud.google.com/go/logging/internal/common.go b/vendor/cloud.google.com/go/logging/internal/common.go new file mode 100644 index 000000000..c5788feb0 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/internal/common.go @@ -0,0 +1,41 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "fmt" + "strings" +) + +const ( + // ProdAddr is the production address. + ProdAddr = "logging.googleapis.com:443" +) + +// LogPath creates a formatted path from a parent and a logID. +func LogPath(parent, logID string) string { + logID = strings.Replace(logID, "/", "%2F", -1) + return fmt.Sprintf("%s/logs/%s", parent, logID) +} + +// LogIDFromPath parses and returns the ID from a log path. +func LogIDFromPath(parent, path string) string { + start := len(parent) + len("/logs/") + if len(path) < start { + return "" + } + logID := path[start:] + return strings.Replace(logID, "%2F", "/", -1) +} diff --git a/vendor/cloud.google.com/go/logging/internal/testing/equal.go b/vendor/cloud.google.com/go/logging/internal/testing/equal.go new file mode 100644 index 000000000..f87caf3a3 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/internal/testing/equal.go @@ -0,0 +1,41 @@ +/* +Copyright 2017 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 testing + +import ( + "fmt" + + "github.com/golang/protobuf/proto" +) + +// PayloadEqual compares two payloads, assuming they are both proto.Messages or both strings. +func PayloadEqual(a, b interface{}) bool { + if a == nil && b == nil { + return true + } + if a == nil || b == nil { + return false + } + switch a := a.(type) { + case proto.Message: + return proto.Equal(a, b.(proto.Message)) + case string: + return a == b.(string) + default: + panic(fmt.Sprintf("payloadEqual: unexpected type %T", a)) + } +} diff --git a/vendor/cloud.google.com/go/logging/internal/testing/fake.go b/vendor/cloud.google.com/go/logging/internal/testing/fake.go new file mode 100644 index 000000000..ecec835d5 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/internal/testing/fake.go @@ -0,0 +1,438 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package testing provides support for testing the logging client. +package testing + +import ( + "context" + "errors" + "fmt" + "regexp" + "sort" + "strings" + "sync" + "time" + + "cloud.google.com/go/internal/testutil" + emptypb "github.com/golang/protobuf/ptypes/empty" + tspb "github.com/golang/protobuf/ptypes/timestamp" + lpb "google.golang.org/genproto/googleapis/api/label" + mrpb "google.golang.org/genproto/googleapis/api/monitoredres" + logpb "google.golang.org/genproto/googleapis/logging/v2" +) + +type loggingHandler struct { + logpb.LoggingServiceV2Server + + mu sync.Mutex + logs map[string][]*logpb.LogEntry // indexed by log name +} + +type configHandler struct { + logpb.ConfigServiceV2Server + + mu sync.Mutex + sinks map[string]*logpb.LogSink // indexed by (full) sink name +} + +type metricHandler struct { + logpb.MetricsServiceV2Server + + mu sync.Mutex + metrics map[string]*logpb.LogMetric // indexed by (full) metric name +} + +// NewServer creates a new in-memory fake server implementing the logging service. +// It returns the address of the server. +func NewServer() (string, error) { + srv, err := testutil.NewServer() + if err != nil { + return "", err + } + logpb.RegisterLoggingServiceV2Server(srv.Gsrv, &loggingHandler{ + logs: make(map[string][]*logpb.LogEntry), + }) + logpb.RegisterConfigServiceV2Server(srv.Gsrv, &configHandler{ + sinks: make(map[string]*logpb.LogSink), + }) + logpb.RegisterMetricsServiceV2Server(srv.Gsrv, &metricHandler{ + metrics: make(map[string]*logpb.LogMetric), + }) + srv.Start() + return srv.Addr, nil +} + +// DeleteLog deletes a log and all its log entries. The log will reappear if it +// receives new entries. +func (h *loggingHandler) DeleteLog(_ context.Context, req *logpb.DeleteLogRequest) (*emptypb.Empty, error) { + // TODO(jba): return NotFound if log isn't there? + h.mu.Lock() + defer h.mu.Unlock() + delete(h.logs, req.LogName) + return &emptypb.Empty{}, nil +} + +// The only IDs that WriteLogEntries will accept. +// Important for testing Ping. +const ( + ValidProjectID = "PROJECT_ID" + ValidOrgID = "433637338589" + + SharedServiceAccount = "serviceAccount:cloud-logs@system.gserviceaccount.com" +) + +// WriteLogEntries writes log entries to Stackdriver Logging. All log entries in +// Stackdriver Logging are written by this method. +func (h *loggingHandler) WriteLogEntries(_ context.Context, req *logpb.WriteLogEntriesRequest) (*logpb.WriteLogEntriesResponse, error) { + if !strings.HasPrefix(req.LogName, "projects/"+ValidProjectID+"/") && !strings.HasPrefix(req.LogName, "organizations/"+ValidOrgID+"/") { + return nil, fmt.Errorf("bad LogName: %q", req.LogName) + } + // TODO(jba): support insertId? + h.mu.Lock() + defer h.mu.Unlock() + for _, e := range req.Entries { + // Assign timestamp if missing. + if e.Timestamp == nil { + e.Timestamp = &tspb.Timestamp{Seconds: time.Now().Unix(), Nanos: 0} + } + // Fill from common fields in request. + if e.LogName == "" { + e.LogName = req.LogName + } + if e.Resource == nil { + // TODO(jba): use a global one if nil? + e.Resource = req.Resource + } + for k, v := range req.Labels { + if _, ok := e.Labels[k]; !ok { + e.Labels[k] = v + } + } + + // Store by log name. + h.logs[e.LogName] = append(h.logs[e.LogName], e) + } + return &logpb.WriteLogEntriesResponse{}, nil +} + +// ListLogEntries lists log entries. Use this method to retrieve log entries +// from Stackdriver Logging. +// +// This fake implementation ignores project IDs. It does not support full filtering, only +// expressions of the form "logName = NAME". +func (h *loggingHandler) ListLogEntries(_ context.Context, req *logpb.ListLogEntriesRequest) (*logpb.ListLogEntriesResponse, error) { + h.mu.Lock() + defer h.mu.Unlock() + entries, err := h.filterEntries(req.Filter) + if err != nil { + return nil, err + } + if err = sortEntries(entries, req.OrderBy); err != nil { + return nil, err + } + + from, to, nextPageToken, err := testutil.PageBounds(int(req.PageSize), req.PageToken, len(entries)) + if err != nil { + return nil, err + } + return &logpb.ListLogEntriesResponse{ + Entries: entries[from:to], + NextPageToken: nextPageToken, + }, nil +} + +func (h *loggingHandler) filterEntries(filter string) ([]*logpb.LogEntry, error) { + logName, err := parseFilter(filter) + if err != nil { + return nil, err + } + if logName != "" { + return h.logs[logName], nil + } + var entries []*logpb.LogEntry + for _, es := range h.logs { + entries = append(entries, es...) + } + return entries, nil +} + +var filterRegexp = regexp.MustCompile(`^logName\s*=\s*"?([-_/.%\w]+)"?`) + +// returns the log name, or "" for the empty filter +func parseFilter(filter string) (string, error) { + if filter == "" { + return "", nil + } + subs := filterRegexp.FindStringSubmatch(filter) + if subs == nil { + return "", invalidArgument(fmt.Sprintf("fake.go: failed to parse filter %s", filter)) + } + return subs[1], nil // cannot panic by construction of regexp +} + +func sortEntries(entries []*logpb.LogEntry, orderBy string) error { + switch orderBy { + case "", "timestamp asc": + sort.Sort(byTimestamp(entries)) + return nil + + case "timestamp desc": + sort.Sort(sort.Reverse(byTimestamp(entries))) + return nil + + default: + return invalidArgument("bad order_by") + } +} + +type byTimestamp []*logpb.LogEntry + +func (s byTimestamp) Len() int { return len(s) } +func (s byTimestamp) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s byTimestamp) Less(i, j int) bool { + c := compareTimestamps(s[i].Timestamp, s[j].Timestamp) + switch { + case c < 0: + return true + case c > 0: + return false + default: + return s[i].InsertId < s[j].InsertId + } +} + +func compareTimestamps(ts1, ts2 *tspb.Timestamp) int64 { + if ts1.Seconds != ts2.Seconds { + return ts1.Seconds - ts2.Seconds + } + return int64(ts1.Nanos - ts2.Nanos) +} + +// Lists monitored resource descriptors that are used by Stackdriver Logging. +func (h *loggingHandler) ListMonitoredResourceDescriptors(context.Context, *logpb.ListMonitoredResourceDescriptorsRequest) (*logpb.ListMonitoredResourceDescriptorsResponse, error) { + return &logpb.ListMonitoredResourceDescriptorsResponse{ + ResourceDescriptors: []*mrpb.MonitoredResourceDescriptor{ + { + Type: "global", + DisplayName: "Global", + Description: "... a log is not associated with any specific resource.", + Labels: []*lpb.LabelDescriptor{ + {Key: "project_id", Description: "The identifier of the GCP project..."}, + }, + }, + }, + }, nil +} + +// Lists logs. +func (h *loggingHandler) ListLogs(_ context.Context, req *logpb.ListLogsRequest) (*logpb.ListLogsResponse, error) { + // Return fixed, fake response. + logNames := []string{"a", "b", "c"} + from, to, npt, err := testutil.PageBounds(int(req.PageSize), req.PageToken, len(logNames)) + if err != nil { + return nil, err + } + var lns []string + for _, ln := range logNames[from:to] { + lns = append(lns, req.Parent+"/logs/"+ln) + } + return &logpb.ListLogsResponse{ + LogNames: lns, + NextPageToken: npt, + }, nil +} + +// Gets a sink. +func (h *configHandler) GetSink(_ context.Context, req *logpb.GetSinkRequest) (*logpb.LogSink, error) { + h.mu.Lock() + defer h.mu.Unlock() + if s, ok := h.sinks[req.SinkName]; ok { + return s, nil + } + // TODO(jba): use error codes + return nil, fmt.Errorf("sink %q not found", req.SinkName) +} + +// Creates a sink. +func (h *configHandler) CreateSink(_ context.Context, req *logpb.CreateSinkRequest) (*logpb.LogSink, error) { + h.mu.Lock() + defer h.mu.Unlock() + fullName := fmt.Sprintf("%s/sinks/%s", req.Parent, req.Sink.Name) + if _, ok := h.sinks[fullName]; ok { + return nil, fmt.Errorf("sink with name %q already exists", fullName) + } + h.setSink(fullName, req.Sink, req.UniqueWriterIdentity) + return req.Sink, nil +} + +func (h *configHandler) setSink(name string, s *logpb.LogSink, uniqueWriterIdentity bool) { + if uniqueWriterIdentity { + s.WriterIdentity = "serviceAccount:" + name + "@gmail.com" + } else { + s.WriterIdentity = SharedServiceAccount + } + h.sinks[name] = s +} + +// Creates or updates a sink. +func (h *configHandler) UpdateSink(_ context.Context, req *logpb.UpdateSinkRequest) (*logpb.LogSink, error) { + h.mu.Lock() + defer h.mu.Unlock() + sink := h.sinks[req.SinkName] + // Update of a non-existent sink will create it. + if sink == nil { + h.setSink(req.SinkName, req.Sink, req.UniqueWriterIdentity) + sink = req.Sink + } else { + // sink is the existing sink named req.SinkName. + // Update all and only the fields of sink that are specified in the update mask. + paths := req.UpdateMask.GetPaths() + if len(paths) == 0 { + // An empty update mask is considered to have these fields by default. + paths = []string{"destination", "filter", "include_children"} + } + for _, p := range paths { + switch p { + case "destination": + sink.Destination = req.Sink.Destination + case "filter": + sink.Filter = req.Sink.Filter + case "include_children": + sink.IncludeChildren = req.Sink.IncludeChildren + case "output_version_format": + // noop + default: + return nil, fmt.Errorf("unknown path in mask: %q", p) + } + } + if req.UniqueWriterIdentity { + if sink.WriterIdentity != SharedServiceAccount { + return nil, invalidArgument("cannot change unique writer identity") + } + sink.WriterIdentity = "serviceAccount:" + req.SinkName + "@gmail.com" + } + } + return sink, nil + +} + +// Deletes a sink. +func (h *configHandler) DeleteSink(_ context.Context, req *logpb.DeleteSinkRequest) (*emptypb.Empty, error) { + h.mu.Lock() + defer h.mu.Unlock() + delete(h.sinks, req.SinkName) + return &emptypb.Empty{}, nil +} + +// Lists sinks. This fake implementation ignores the Parent field of +// ListSinksRequest. All sinks are listed, regardless of their project. +func (h *configHandler) ListSinks(_ context.Context, req *logpb.ListSinksRequest) (*logpb.ListSinksResponse, error) { + h.mu.Lock() + var sinks []*logpb.LogSink + for _, s := range h.sinks { + sinks = append(sinks, s) + } + h.mu.Unlock() // safe because no *logpb.LogSink is ever modified + // Since map iteration varies, sort the sinks. + sort.Sort(sinksByName(sinks)) + from, to, nextPageToken, err := testutil.PageBounds(int(req.PageSize), req.PageToken, len(sinks)) + if err != nil { + return nil, err + } + return &logpb.ListSinksResponse{ + Sinks: sinks[from:to], + NextPageToken: nextPageToken, + }, nil +} + +type sinksByName []*logpb.LogSink + +func (s sinksByName) Len() int { return len(s) } +func (s sinksByName) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s sinksByName) Less(i, j int) bool { return s[i].Name < s[j].Name } + +// Gets a metric. +func (h *metricHandler) GetLogMetric(_ context.Context, req *logpb.GetLogMetricRequest) (*logpb.LogMetric, error) { + h.mu.Lock() + defer h.mu.Unlock() + if s, ok := h.metrics[req.MetricName]; ok { + return s, nil + } + // TODO(jba): use error codes + return nil, fmt.Errorf("metric %q not found", req.MetricName) +} + +// Creates a metric. +func (h *metricHandler) CreateLogMetric(_ context.Context, req *logpb.CreateLogMetricRequest) (*logpb.LogMetric, error) { + h.mu.Lock() + defer h.mu.Unlock() + fullName := fmt.Sprintf("%s/metrics/%s", req.Parent, req.Metric.Name) + if _, ok := h.metrics[fullName]; ok { + return nil, fmt.Errorf("metric with name %q already exists", fullName) + } + h.metrics[fullName] = req.Metric + return req.Metric, nil +} + +// Creates or updates a metric. +func (h *metricHandler) UpdateLogMetric(_ context.Context, req *logpb.UpdateLogMetricRequest) (*logpb.LogMetric, error) { + h.mu.Lock() + defer h.mu.Unlock() + // Update of a non-existent metric will create it. + h.metrics[req.MetricName] = req.Metric + return req.Metric, nil +} + +// Deletes a metric. +func (h *metricHandler) DeleteLogMetric(_ context.Context, req *logpb.DeleteLogMetricRequest) (*emptypb.Empty, error) { + h.mu.Lock() + defer h.mu.Unlock() + delete(h.metrics, req.MetricName) + return &emptypb.Empty{}, nil +} + +// Lists metrics. This fake implementation ignores the Parent field of +// ListMetricsRequest. All metrics are listed, regardless of their project. +func (h *metricHandler) ListLogMetrics(_ context.Context, req *logpb.ListLogMetricsRequest) (*logpb.ListLogMetricsResponse, error) { + h.mu.Lock() + var metrics []*logpb.LogMetric + for _, s := range h.metrics { + metrics = append(metrics, s) + } + h.mu.Unlock() // safe because no *logpb.LogMetric is ever modified + // Since map iteration varies, sort the metrics. + sort.Sort(metricsByName(metrics)) + from, to, nextPageToken, err := testutil.PageBounds(int(req.PageSize), req.PageToken, len(metrics)) + if err != nil { + return nil, err + } + return &logpb.ListLogMetricsResponse{ + Metrics: metrics[from:to], + NextPageToken: nextPageToken, + }, nil +} + +type metricsByName []*logpb.LogMetric + +func (s metricsByName) Len() int { return len(s) } +func (s metricsByName) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s metricsByName) Less(i, j int) bool { return s[i].Name < s[j].Name } + +func invalidArgument(msg string) error { + // TODO(jba): status codes + return errors.New(msg) +} diff --git a/vendor/cloud.google.com/go/logging/internal/testing/fake_test.go b/vendor/cloud.google.com/go/logging/internal/testing/fake_test.go new file mode 100644 index 000000000..1ef9cf12a --- /dev/null +++ b/vendor/cloud.google.com/go/logging/internal/testing/fake_test.go @@ -0,0 +1,122 @@ +/* +Copyright 2016 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file contains only basic checks. The fake is effectively tested by the +// logging client unit tests. + +package testing + +import ( + "testing" + "time" + + "github.com/golang/protobuf/proto" + tspb "github.com/golang/protobuf/ptypes/timestamp" + logpb "google.golang.org/genproto/googleapis/logging/v2" + grpc "google.golang.org/grpc" +) + +func TestNewServer(t *testing.T) { + // Confirm that we can create and use a working gRPC server. + addr, err := NewServer() + if err != nil { + t.Fatal(err) + } + conn, err := grpc.Dial(addr, grpc.WithInsecure()) + if err != nil { + t.Fatal(err) + } + // Avoid "connection is closing; please retry" message from gRPC. + time.Sleep(300 * time.Millisecond) + conn.Close() +} + +func TestParseFilter(t *testing.T) { + for _, test := range []struct { + filter string + want string + wantErr bool + }{ + {"", "", false}, + {"logName = syslog", "syslog", false}, + {"logname = syslog", "", true}, + {"logName = 'syslog'", "", true}, + {"logName == syslog", "", true}, + } { + got, err := parseFilter(test.filter) + if err != nil { + if !test.wantErr { + t.Errorf("%q: got %v, want no error", test.filter, err) + } + continue + } + if test.wantErr { + t.Errorf("%q: got no error, want one", test.filter) + continue + } + if got != test.want { + t.Errorf("%q: got %q, want %q", test.filter, got, test.want) + } + } +} + +func TestSortEntries(t *testing.T) { + entries := []*logpb.LogEntry{ + /* 0 */ {Timestamp: &tspb.Timestamp{Seconds: 30}}, + /* 1 */ {Timestamp: &tspb.Timestamp{Seconds: 10}}, + /* 2 */ {Timestamp: &tspb.Timestamp{Seconds: 20}, InsertId: "b"}, + /* 3 */ {Timestamp: &tspb.Timestamp{Seconds: 20}, InsertId: "a"}, + /* 4 */ {Timestamp: &tspb.Timestamp{Seconds: 20}, InsertId: "c"}, + } + for _, test := range []struct { + orderBy string + want []int // slice of index into entries; nil == error + }{ + {"", []int{1, 3, 2, 4, 0}}, + {"timestamp asc", []int{1, 3, 2, 4, 0}}, + {"timestamp desc", []int{0, 4, 2, 3, 1}}, + {"something else", nil}, + } { + got := make([]*logpb.LogEntry, len(entries)) + copy(got, entries) + err := sortEntries(got, test.orderBy) + if err != nil { + if test.want != nil { + t.Errorf("%q: got %v, want nil error", test.orderBy, err) + } + continue + } + want := make([]*logpb.LogEntry, len(entries)) + for i, j := range test.want { + want[i] = entries[j] + } + if !logEntriesEqual(got, want) { + t.Errorf("%q: got %v, want %v", test.orderBy, got, want) + } + } +} + +func logEntriesEqual(a, b []*logpb.LogEntry) bool { + if len(a) != len(b) { + return false + } + for i, aa := range a { + if !proto.Equal(aa, b[i]) { + return false + } + } + return true +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/example_entry_iterator_test.go b/vendor/cloud.google.com/go/logging/logadmin/example_entry_iterator_test.go new file mode 100644 index 000000000..f0fe138e3 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/example_entry_iterator_test.go @@ -0,0 +1,66 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin_test + +import ( + "context" + "fmt" + "time" + + "cloud.google.com/go/logging/logadmin" + "google.golang.org/api/iterator" +) + +func ExampleClient_Entries() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + it := client.Entries(ctx, logadmin.Filter(`logName = "projects/my-project/logs/my-log"`)) + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleFilter_timestamp() { + // This example demonstrates how to list the last 24 hours of log entries. + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + oneDayAgo := time.Now().Add(-24 * time.Hour) + t := oneDayAgo.Format(time.RFC3339) // Logging API wants timestamps in RFC 3339 format. + it := client.Entries(ctx, logadmin.Filter(fmt.Sprintf(`timestamp > "%s"`, t))) + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleEntryIterator_Next() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + it := client.Entries(ctx) + for { + entry, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(entry) + } +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/example_metric_iterator_test.go b/vendor/cloud.google.com/go/logging/logadmin/example_metric_iterator_test.go new file mode 100644 index 000000000..91d1d00af --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/example_metric_iterator_test.go @@ -0,0 +1,52 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin_test + +import ( + "context" + "fmt" + + "cloud.google.com/go/logging/logadmin" + "google.golang.org/api/iterator" +) + +func ExampleClient_Metrics() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + it := client.Metrics(ctx) + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleMetricIterator_Next() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + it := client.Metrics(ctx) + for { + metric, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(metric) + } +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/example_paging_test.go b/vendor/cloud.google.com/go/logging/logadmin/example_paging_test.go new file mode 100644 index 000000000..4f71f492d --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/example_paging_test.go @@ -0,0 +1,92 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin_test + +import ( + "bytes" + "context" + "flag" + "fmt" + "html/template" + "log" + "net/http" + + "cloud.google.com/go/logging" + "cloud.google.com/go/logging/logadmin" + "google.golang.org/api/iterator" +) + +var ( + client *logadmin.Client + projectID = flag.String("project-id", "", "ID of the project to use") +) + +func ExampleClient_Entries_pagination() { + // This example demonstrates how to iterate through items a page at a time + // even if each successive page is fetched by a different process. It is a + // complete web server that displays pages of log entries. To run it as a + // standalone program, rename both the package and this function to "main". + ctx := context.Background() + flag.Parse() + if *projectID == "" { + log.Fatal("-project-id missing") + } + var err error + client, err = logadmin.NewClient(ctx, *projectID) + if err != nil { + log.Fatalf("creating logging client: %v", err) + } + + http.HandleFunc("/entries", handleEntries) + log.Print("listening on 8080") + log.Fatal(http.ListenAndServe(":8080", nil)) +} + +var pageTemplate = template.Must(template.New("").Parse(` +
+ {{range .Entries}} + + {{end}} +
{{.}}
+{{if .Next}} + Next Page +{{end}} +`)) + +func handleEntries(w http.ResponseWriter, r *http.Request) { + ctx := context.Background() + filter := fmt.Sprintf(`logName = "projects/%s/logs/testlog"`, *projectID) + it := client.Entries(ctx, logadmin.Filter(filter)) + var entries []*logging.Entry + nextTok, err := iterator.NewPager(it, 5, r.URL.Query().Get("pageToken")).NextPage(&entries) + if err != nil { + http.Error(w, fmt.Sprintf("problem getting the next page: %v", err), http.StatusInternalServerError) + return + } + data := struct { + Entries []*logging.Entry + Next string + }{ + entries, + nextTok, + } + var buf bytes.Buffer + if err := pageTemplate.Execute(&buf, data); err != nil { + http.Error(w, fmt.Sprintf("problem executing page template: %v", err), http.StatusInternalServerError) + } + if _, err := buf.WriteTo(w); err != nil { + log.Printf("writing response: %v", err) + } +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/example_resource_iterator_test.go b/vendor/cloud.google.com/go/logging/logadmin/example_resource_iterator_test.go new file mode 100644 index 000000000..208f95f4f --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/example_resource_iterator_test.go @@ -0,0 +1,52 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin_test + +import ( + "context" + "fmt" + + "cloud.google.com/go/logging/logadmin" + "google.golang.org/api/iterator" +) + +func ExampleClient_ResourceDescriptors() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + it := client.ResourceDescriptors(ctx) + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleResourceDescriptorIterator_Next() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + it := client.ResourceDescriptors(ctx) + for { + rdesc, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(rdesc) + } +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/example_sink_iterator_test.go b/vendor/cloud.google.com/go/logging/logadmin/example_sink_iterator_test.go new file mode 100644 index 000000000..0cf333dd6 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/example_sink_iterator_test.go @@ -0,0 +1,52 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin_test + +import ( + "context" + "fmt" + + "cloud.google.com/go/logging/logadmin" + "google.golang.org/api/iterator" +) + +func ExampleClient_Sinks() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + it := client.Sinks(ctx) + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleSinkIterator_Next() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + it := client.Sinks(ctx) + for { + sink, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(sink) + } +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/examples_test.go b/vendor/cloud.google.com/go/logging/logadmin/examples_test.go new file mode 100644 index 000000000..e950fe457 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/examples_test.go @@ -0,0 +1,161 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin_test + +import ( + "context" + "fmt" + + "cloud.google.com/go/logging/logadmin" +) + +func ExampleNewClient() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + // Use client to manage logs, metrics and sinks. + // Close the client when finished. + if err := client.Close(); err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_DeleteLog() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + err = client.DeleteLog(ctx, "my-log") + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_CreateMetric() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + err = client.CreateMetric(ctx, &logadmin.Metric{ + ID: "severe-errors", + Description: "entries at ERROR or higher severities", + Filter: "severity >= ERROR", + }) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_DeleteMetric() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + if err := client.DeleteMetric(ctx, "severe-errors"); err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_Metric() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + m, err := client.Metric(ctx, "severe-errors") + if err != nil { + // TODO: Handle error. + } + fmt.Println(m) +} + +func ExampleClient_UpdateMetric() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + err = client.UpdateMetric(ctx, &logadmin.Metric{ + ID: "severe-errors", + Description: "entries at high severities", + Filter: "severity > ERROR", + }) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_CreateSink() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + sink, err := client.CreateSink(ctx, &logadmin.Sink{ + ID: "severe-errors-to-gcs", + Destination: "storage.googleapis.com/my-bucket", + Filter: "severity >= ERROR", + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(sink) +} + +func ExampleClient_DeleteSink() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + if err := client.DeleteSink(ctx, "severe-errors-to-gcs"); err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_Sink() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + s, err := client.Sink(ctx, "severe-errors-to-gcs") + if err != nil { + // TODO: Handle error. + } + fmt.Println(s) +} + +func ExampleClient_UpdateSink() { + ctx := context.Background() + client, err := logadmin.NewClient(ctx, "my-project") + if err != nil { + // TODO: Handle error. + } + sink, err := client.UpdateSink(ctx, &logadmin.Sink{ + ID: "severe-errors-to-gcs", + Destination: "storage.googleapis.com/my-other-bucket", + Filter: "severity >= ERROR", + }) + if err != nil { + // TODO: Handle error. + } + fmt.Println(sink) +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/logadmin.go b/vendor/cloud.google.com/go/logging/logadmin/logadmin.go new file mode 100644 index 000000000..d50f5e04c --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/logadmin.go @@ -0,0 +1,405 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// These features are missing now, but will likely be added: +// - There is no way to specify CallOptions. + +// Package logadmin contains a Stackdriver Logging client that can be used +// for reading logs and working with sinks, metrics and monitored resources. +// For a client that can write logs, see package cloud.google.com/go/logging. +// +// The client uses Logging API v2. +// See https://cloud.google.com/logging/docs/api/v2/ for an introduction to the API. +// +// Note: This package is in beta. Some backwards-incompatible changes may occur. +package logadmin // import "cloud.google.com/go/logging/logadmin" + +import ( + "context" + "fmt" + "math" + "net/http" + "net/url" + "strings" + "time" + + "cloud.google.com/go/internal/version" + "cloud.google.com/go/logging" + vkit "cloud.google.com/go/logging/apiv2" + "cloud.google.com/go/logging/internal" + "github.com/golang/protobuf/ptypes" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + _ "google.golang.org/genproto/googleapis/appengine/logging/v1" // Import the following so EntryIterator can unmarshal log protos. + _ "google.golang.org/genproto/googleapis/cloud/audit" + logtypepb "google.golang.org/genproto/googleapis/logging/type" + logpb "google.golang.org/genproto/googleapis/logging/v2" + "google.golang.org/grpc/codes" +) + +// Client is a Logging client. A Client is associated with a single Cloud project. +type Client struct { + lClient *vkit.Client // logging client + sClient *vkit.ConfigClient // sink client + mClient *vkit.MetricsClient // metric client + parent string + closed bool +} + +// NewClient returns a new logging client associated with the provided project ID. +// +// By default NewClient uses AdminScope. To use a different scope, call +// NewClient using a WithScopes option (see https://godoc.org/google.golang.org/api/option#WithScopes). +func NewClient(ctx context.Context, parent string, opts ...option.ClientOption) (*Client, error) { + if !strings.ContainsRune(parent, '/') { + parent = "projects/" + parent + } + opts = append([]option.ClientOption{ + option.WithEndpoint(internal.ProdAddr), + option.WithScopes(logging.AdminScope), + }, opts...) + lc, err := vkit.NewClient(ctx, opts...) + if err != nil { + return nil, err + } + // TODO(jba): pass along any client options that should be provided to all clients. + sc, err := vkit.NewConfigClient(ctx, option.WithGRPCConn(lc.Connection())) + if err != nil { + return nil, err + } + mc, err := vkit.NewMetricsClient(ctx, option.WithGRPCConn(lc.Connection())) + if err != nil { + return nil, err + } + // Retry some non-idempotent methods on INTERNAL, because it happens sometimes + // and in all observed cases the operation did not complete. + retryerOnInternal := func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Internal, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 1000 * time.Millisecond, + Multiplier: 1.2, + }) + } + mc.CallOptions.CreateLogMetric = []gax.CallOption{gax.WithRetry(retryerOnInternal)} + mc.CallOptions.UpdateLogMetric = []gax.CallOption{gax.WithRetry(retryerOnInternal)} + + lc.SetGoogleClientInfo("gccl", version.Repo) + sc.SetGoogleClientInfo("gccl", version.Repo) + mc.SetGoogleClientInfo("gccl", version.Repo) + client := &Client{ + lClient: lc, + sClient: sc, + mClient: mc, + parent: parent, + } + return client, nil +} + +// Close closes the client. +func (c *Client) Close() error { + if c.closed { + return nil + } + // Return only the first error. Since all clients share an underlying connection, + // Closes after the first always report a "connection is closing" error. + err := c.lClient.Close() + _ = c.sClient.Close() + _ = c.mClient.Close() + c.closed = true + return err +} + +// DeleteLog deletes a log and all its log entries. The log will reappear if it receives new entries. +// logID identifies the log within the project. An example log ID is "syslog". Requires AdminScope. +func (c *Client) DeleteLog(ctx context.Context, logID string) error { + return c.lClient.DeleteLog(ctx, &logpb.DeleteLogRequest{ + LogName: internal.LogPath(c.parent, logID), + }) +} + +func toHTTPRequest(p *logtypepb.HttpRequest) (*logging.HTTPRequest, error) { + if p == nil { + return nil, nil + } + u, err := url.Parse(p.RequestUrl) + if err != nil { + return nil, err + } + var dur time.Duration + if p.Latency != nil { + dur, err = ptypes.Duration(p.Latency) + if err != nil { + return nil, err + } + } + hr := &http.Request{ + Method: p.RequestMethod, + URL: u, + Header: map[string][]string{}, + } + if p.UserAgent != "" { + hr.Header.Set("User-Agent", p.UserAgent) + } + if p.Referer != "" { + hr.Header.Set("Referer", p.Referer) + } + return &logging.HTTPRequest{ + Request: hr, + RequestSize: p.RequestSize, + Status: int(p.Status), + ResponseSize: p.ResponseSize, + Latency: dur, + RemoteIP: p.RemoteIp, + CacheHit: p.CacheHit, + CacheValidatedWithOriginServer: p.CacheValidatedWithOriginServer, + }, nil +} + +// An EntriesOption is an option for listing log entries. +type EntriesOption interface { + set(*logpb.ListLogEntriesRequest) +} + +// ProjectIDs sets the project IDs or project numbers from which to retrieve +// log entries. Examples of a project ID: "my-project-1A", "1234567890". +func ProjectIDs(pids []string) EntriesOption { return projectIDs(pids) } + +type projectIDs []string + +func (p projectIDs) set(r *logpb.ListLogEntriesRequest) { + r.ResourceNames = make([]string, len(p)) + for i, v := range p { + r.ResourceNames[i] = fmt.Sprintf("projects/%s", v) + } +} + +// ResourceNames sets the resource names from which to retrieve +// log entries. Examples: "projects/my-project-1A", "organizations/my-org". +func ResourceNames(rns []string) EntriesOption { return resourceNames(rns) } + +type resourceNames []string + +func (rn resourceNames) set(r *logpb.ListLogEntriesRequest) { + r.ResourceNames = append([]string(nil), rn...) +} + +// Filter sets an advanced logs filter for listing log entries (see +// https://cloud.google.com/logging/docs/view/advanced_filters). The filter is +// compared against all log entries in the projects specified by ProjectIDs. +// Only entries that match the filter are retrieved. An empty filter (the +// default) matches all log entries. +// +// In the filter string, log names must be written in their full form, as +// "projects/PROJECT-ID/logs/LOG-ID". Forward slashes in LOG-ID must be +// replaced by %2F before calling Filter. +// +// Timestamps in the filter string must be written in RFC 3339 format. See the +// timestamp example. +func Filter(f string) EntriesOption { return filter(f) } + +type filter string + +func (f filter) set(r *logpb.ListLogEntriesRequest) { r.Filter = string(f) } + +// NewestFirst causes log entries to be listed from most recent (newest) to +// least recent (oldest). By default, they are listed from oldest to newest. +func NewestFirst() EntriesOption { return newestFirst{} } + +type newestFirst struct{} + +func (newestFirst) set(r *logpb.ListLogEntriesRequest) { r.OrderBy = "timestamp desc" } + +// Entries returns an EntryIterator for iterating over log entries. By default, +// the log entries will be restricted to those from the project passed to +// NewClient. This may be overridden by passing a ProjectIDs option. Requires ReadScope or AdminScope. +func (c *Client) Entries(ctx context.Context, opts ...EntriesOption) *EntryIterator { + it := &EntryIterator{ + it: c.lClient.ListLogEntries(ctx, listLogEntriesRequest(c.parent, opts)), + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +func listLogEntriesRequest(parent string, opts []EntriesOption) *logpb.ListLogEntriesRequest { + req := &logpb.ListLogEntriesRequest{ + ResourceNames: []string{parent}, + } + for _, opt := range opts { + opt.set(req) + } + return req +} + +// An EntryIterator iterates over log entries. +type EntryIterator struct { + it *vkit.LogEntryIterator + pageInfo *iterator.PageInfo + nextFunc func() error + items []*logging.Entry +} + +// PageInfo supports pagination. See https://godoc.org/google.golang.org/api/iterator package for details. +func (it *EntryIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next result. Its second return value is iterator.Done +// (https://godoc.org/google.golang.org/api/iterator) if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *EntryIterator) Next() (*logging.Entry, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *EntryIterator) fetch(pageSize int, pageToken string) (string, error) { + return iterFetch(pageSize, pageToken, it.it.PageInfo(), func() error { + item, err := it.it.Next() + if err != nil { + return err + } + e, err := fromLogEntry(item) + if err != nil { + return err + } + it.items = append(it.items, e) + return nil + }) +} + +func trunc32(i int) int32 { + if i > math.MaxInt32 { + i = math.MaxInt32 + } + return int32(i) +} + +var slashUnescaper = strings.NewReplacer("%2F", "/", "%2f", "/") + +func fromLogEntry(le *logpb.LogEntry) (*logging.Entry, error) { + time, err := ptypes.Timestamp(le.Timestamp) + if err != nil { + return nil, err + } + var payload interface{} + switch x := le.Payload.(type) { + case *logpb.LogEntry_TextPayload: + payload = x.TextPayload + + case *logpb.LogEntry_ProtoPayload: + var d ptypes.DynamicAny + if err := ptypes.UnmarshalAny(x.ProtoPayload, &d); err != nil { + return nil, fmt.Errorf("logging: unmarshalling proto payload: %v", err) + } + payload = d.Message + + case *logpb.LogEntry_JsonPayload: + // Leave this as a Struct. + // TODO(jba): convert to map[string]interface{}? + payload = x.JsonPayload + + default: + return nil, fmt.Errorf("logging: unknown payload type: %T", le.Payload) + } + hr, err := toHTTPRequest(le.HttpRequest) + if err != nil { + return nil, err + } + return &logging.Entry{ + Timestamp: time, + Severity: logging.Severity(le.Severity), + Payload: payload, + Labels: le.Labels, + InsertID: le.InsertId, + HTTPRequest: hr, + Operation: le.Operation, + LogName: slashUnescaper.Replace(le.LogName), + Resource: le.Resource, + Trace: le.Trace, + SourceLocation: le.SourceLocation, + }, nil +} + +// Logs lists the logs owned by the parent resource of the client. +func (c *Client) Logs(ctx context.Context) *LogIterator { + it := &LogIterator{ + parentResource: c.parent, + it: c.lClient.ListLogs(ctx, &logpb.ListLogsRequest{Parent: c.parent}), + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +// A LogIterator iterates over logs. +type LogIterator struct { + parentResource string + it *vkit.StringIterator + pageInfo *iterator.PageInfo + nextFunc func() error + items []string +} + +// PageInfo supports pagination. See https://godoc.org/google.golang.org/api/iterator package for details. +func (it *LogIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next result. Its second return value is iterator.Done +// (https://godoc.org/google.golang.org/api/iterator) if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *LogIterator) Next() (string, error) { + if err := it.nextFunc(); err != nil { + return "", err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *LogIterator) fetch(pageSize int, pageToken string) (string, error) { + return iterFetch(pageSize, pageToken, it.it.PageInfo(), func() error { + logPath, err := it.it.Next() + if err != nil { + return err + } + logID := internal.LogIDFromPath(it.parentResource, logPath) + it.items = append(it.items, logID) + return nil + }) +} + +// Common fetch code for iterators that are backed by vkit iterators. +func iterFetch(pageSize int, pageToken string, pi *iterator.PageInfo, next func() error) (string, error) { + pi.MaxSize = pageSize + pi.Token = pageToken + // Get one item, which will fill the buffer. + if err := next(); err != nil { + return "", err + } + // Collect the rest of the buffer. + for pi.Remaining() > 0 { + if err := next(); err != nil { + return "", err + } + } + return pi.Token, nil +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/logadmin_test.go b/vendor/cloud.google.com/go/logging/logadmin/logadmin_test.go new file mode 100644 index 000000000..f493b68eb --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/logadmin_test.go @@ -0,0 +1,277 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// TODO(jba): test that OnError is getting called appropriately. + +package logadmin + +import ( + "context" + "flag" + "log" + "net/http" + "net/url" + "os" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/logging" + ltesting "cloud.google.com/go/logging/internal/testing" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + durpb "github.com/golang/protobuf/ptypes/duration" + structpb "github.com/golang/protobuf/ptypes/struct" + "github.com/google/go-cmp/cmp/cmpopts" + "google.golang.org/api/option" + mrpb "google.golang.org/genproto/googleapis/api/monitoredres" + audit "google.golang.org/genproto/googleapis/cloud/audit" + logtypepb "google.golang.org/genproto/googleapis/logging/type" + logpb "google.golang.org/genproto/googleapis/logging/v2" + "google.golang.org/grpc" +) + +var ( + client *Client + testProjectID string +) + +var ( + // If true, this test is using the production service, not a fake. + integrationTest bool + + newClient func(ctx context.Context, projectID string) *Client +) + +func TestMain(m *testing.M) { + flag.Parse() // needed for testing.Short() + ctx := context.Background() + testProjectID = testutil.ProjID() + if testProjectID == "" || testing.Short() { + integrationTest = false + if testProjectID != "" { + log.Print("Integration tests skipped in short mode (using fake instead)") + } + testProjectID = "PROJECT_ID" + addr, err := ltesting.NewServer() + if err != nil { + log.Fatalf("creating fake server: %v", err) + } + newClient = func(ctx context.Context, projectID string) *Client { + conn, err := grpc.Dial(addr, grpc.WithInsecure(), grpc.WithBlock()) + if err != nil { + log.Fatalf("dialing %q: %v", addr, err) + } + c, err := NewClient(ctx, projectID, option.WithGRPCConn(conn)) + if err != nil { + log.Fatalf("creating client for fake at %q: %v", addr, err) + } + return c + } + } else { + integrationTest = true + ts := testutil.TokenSource(ctx, logging.AdminScope) + if ts == nil { + log.Fatal("The project key must be set. See CONTRIBUTING.md for details") + } + log.Printf("running integration tests with project %s", testProjectID) + newClient = func(ctx context.Context, projectID string) *Client { + c, err := NewClient(ctx, projectID, option.WithTokenSource(ts), + option.WithGRPCDialOption(grpc.WithBlock())) + if err != nil { + log.Fatalf("creating prod client: %v", err) + } + return c + } + } + client = newClient(ctx, testProjectID) + initMetrics(ctx) + cleanup := initSinks(ctx) + exit := m.Run() + cleanup() + client.Close() + os.Exit(exit) +} + +// EntryIterator and DeleteLog are tested in the logging package. + +func TestClientClose(t *testing.T) { + c := newClient(context.Background(), testProjectID) + if err := c.Close(); err != nil { + t.Errorf("want got %v, want nil", err) + } +} + +func TestFromLogEntry(t *testing.T) { + now := time.Now() + res := &mrpb.MonitoredResource{Type: "global"} + ts, err := ptypes.TimestampProto(now) + if err != nil { + t.Fatal(err) + } + logEntry := logpb.LogEntry{ + LogName: "projects/PROJECT_ID/logs/LOG_ID", + Resource: res, + Payload: &logpb.LogEntry_TextPayload{TextPayload: "hello"}, + Timestamp: ts, + Severity: logtypepb.LogSeverity_INFO, + InsertId: "123", + HttpRequest: &logtypepb.HttpRequest{ + RequestMethod: "GET", + RequestUrl: "http:://example.com/path?q=1", + RequestSize: 100, + Status: 200, + ResponseSize: 25, + Latency: &durpb.Duration{Seconds: 100}, + UserAgent: "user-agent", + RemoteIp: "127.0.0.1", + Referer: "referer", + CacheHit: true, + CacheValidatedWithOriginServer: true, + }, + Labels: map[string]string{ + "a": "1", + "b": "two", + "c": "true", + }, + SourceLocation: &logpb.LogEntrySourceLocation{ + File: "some_file.go", + Line: 1, + Function: "someFunction", + }, + } + u, err := url.Parse("http:://example.com/path?q=1") + if err != nil { + t.Fatal(err) + } + want := &logging.Entry{ + LogName: "projects/PROJECT_ID/logs/LOG_ID", + Resource: res, + Timestamp: now.In(time.UTC), + Severity: logging.Info, + Payload: "hello", + Labels: map[string]string{ + "a": "1", + "b": "two", + "c": "true", + }, + InsertID: "123", + HTTPRequest: &logging.HTTPRequest{ + Request: &http.Request{ + Method: "GET", + URL: u, + Header: map[string][]string{ + "User-Agent": {"user-agent"}, + "Referer": {"referer"}, + }, + }, + RequestSize: 100, + Status: 200, + ResponseSize: 25, + Latency: 100 * time.Second, + RemoteIP: "127.0.0.1", + CacheHit: true, + CacheValidatedWithOriginServer: true, + }, + SourceLocation: &logpb.LogEntrySourceLocation{ + File: "some_file.go", + Line: 1, + Function: "someFunction", + }, + } + got, err := fromLogEntry(&logEntry) + if err != nil { + t.Fatal(err) + } + if diff := testutil.Diff(got, want, cmpopts.IgnoreUnexported(http.Request{})); diff != "" { + t.Errorf("FullEntry:\n%s", diff) + } + + // Proto payload. + alog := &audit.AuditLog{ + ServiceName: "svc", + MethodName: "method", + ResourceName: "shelves/S/books/B", + } + any, err := ptypes.MarshalAny(alog) + if err != nil { + t.Fatal(err) + } + logEntry = logpb.LogEntry{ + LogName: "projects/PROJECT_ID/logs/LOG_ID", + Resource: res, + Timestamp: ts, + Payload: &logpb.LogEntry_ProtoPayload{ProtoPayload: any}, + } + got, err = fromLogEntry(&logEntry) + if err != nil { + t.Fatal(err) + } + if !ltesting.PayloadEqual(got.Payload, alog) { + t.Errorf("got %+v, want %+v", got.Payload, alog) + } + + // JSON payload. + jstruct := &structpb.Struct{Fields: map[string]*structpb.Value{ + "f": {Kind: &structpb.Value_NumberValue{NumberValue: 3.1}}, + }} + logEntry = logpb.LogEntry{ + LogName: "projects/PROJECT_ID/logs/LOG_ID", + Resource: res, + Timestamp: ts, + Payload: &logpb.LogEntry_JsonPayload{JsonPayload: jstruct}, + } + got, err = fromLogEntry(&logEntry) + if err != nil { + t.Fatal(err) + } + if !ltesting.PayloadEqual(got.Payload, jstruct) { + t.Errorf("got %+v, want %+v", got.Payload, jstruct) + } +} + +func TestListLogEntriesRequest(t *testing.T) { + for _, test := range []struct { + opts []EntriesOption + resourceNames []string + filter string + orderBy string + }{ + // Default is client's project ID, empty filter and orderBy. + {nil, []string{"projects/PROJECT_ID"}, "", ""}, + {[]EntriesOption{NewestFirst(), Filter("f")}, + []string{"projects/PROJECT_ID"}, "f", "timestamp desc"}, + {[]EntriesOption{ProjectIDs([]string{"foo"})}, + []string{"projects/foo"}, "", ""}, + {[]EntriesOption{ResourceNames([]string{"folders/F", "organizations/O"})}, + []string{"folders/F", "organizations/O"}, "", ""}, + {[]EntriesOption{NewestFirst(), Filter("f"), ProjectIDs([]string{"foo"})}, + []string{"projects/foo"}, "f", "timestamp desc"}, + {[]EntriesOption{NewestFirst(), Filter("f"), ProjectIDs([]string{"foo"})}, + []string{"projects/foo"}, "f", "timestamp desc"}, + // If there are repeats, last one wins. + {[]EntriesOption{NewestFirst(), Filter("no"), ProjectIDs([]string{"foo"}), Filter("f")}, + []string{"projects/foo"}, "f", "timestamp desc"}, + } { + got := listLogEntriesRequest("projects/PROJECT_ID", test.opts) + want := &logpb.ListLogEntriesRequest{ + ResourceNames: test.resourceNames, + Filter: test.filter, + OrderBy: test.orderBy, + } + if !proto.Equal(got, want) { + t.Errorf("%v:\ngot %v\nwant %v", test.opts, got, want) + } + } +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/metrics.go b/vendor/cloud.google.com/go/logging/logadmin/metrics.go new file mode 100644 index 000000000..2f673b64b --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/metrics.go @@ -0,0 +1,154 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin + +import ( + "context" + "fmt" + + vkit "cloud.google.com/go/logging/apiv2" + "google.golang.org/api/iterator" + logpb "google.golang.org/genproto/googleapis/logging/v2" +) + +// Metric describes a logs-based metric. The value of the metric is the +// number of log entries that match a logs filter. +// +// Metrics are a feature of Stackdriver Monitoring. +// See https://cloud.google.com/monitoring/api/v3/metrics for more about them. +type Metric struct { + // ID is a client-assigned metric identifier. Example: + // "severe_errors". Metric identifiers are limited to 1000 + // characters and can include only the following characters: A-Z, + // a-z, 0-9, and the special characters _-.,+!*',()%/\. The + // forward-slash character (/) denotes a hierarchy of name pieces, + // and it cannot be the first character of the name. + ID string + + // Description describes this metric. It is used in documentation. + Description string + + // Filter is an advanced logs filter (see + // https://cloud.google.com/logging/docs/view/advanced_filters). + // Example: "logName:syslog AND severity>=ERROR". + Filter string +} + +// CreateMetric creates a logs-based metric. +func (c *Client) CreateMetric(ctx context.Context, m *Metric) error { + _, err := c.mClient.CreateLogMetric(ctx, &logpb.CreateLogMetricRequest{ + Parent: c.parent, + Metric: toLogMetric(m), + }) + return err +} + +// DeleteMetric deletes a log-based metric. +// The provided metric ID is the metric identifier. For example, "severe_errors". +func (c *Client) DeleteMetric(ctx context.Context, metricID string) error { + return c.mClient.DeleteLogMetric(ctx, &logpb.DeleteLogMetricRequest{ + MetricName: c.metricPath(metricID), + }) +} + +// Metric gets a logs-based metric. +// The provided metric ID is the metric identifier. For example, "severe_errors". +// Requires ReadScope or AdminScope. +func (c *Client) Metric(ctx context.Context, metricID string) (*Metric, error) { + lm, err := c.mClient.GetLogMetric(ctx, &logpb.GetLogMetricRequest{ + MetricName: c.metricPath(metricID), + }) + if err != nil { + return nil, err + } + return fromLogMetric(lm), nil +} + +// UpdateMetric creates a logs-based metric if it does not exist, or updates an +// existing one. +func (c *Client) UpdateMetric(ctx context.Context, m *Metric) error { + _, err := c.mClient.UpdateLogMetric(ctx, &logpb.UpdateLogMetricRequest{ + MetricName: c.metricPath(m.ID), + Metric: toLogMetric(m), + }) + return err +} + +func (c *Client) metricPath(metricID string) string { + return fmt.Sprintf("%s/metrics/%s", c.parent, metricID) +} + +// Metrics returns a MetricIterator for iterating over all Metrics in the Client's project. +// Requires ReadScope or AdminScope. +func (c *Client) Metrics(ctx context.Context) *MetricIterator { + it := &MetricIterator{ + it: c.mClient.ListLogMetrics(ctx, &logpb.ListLogMetricsRequest{Parent: c.parent}), + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +// A MetricIterator iterates over Metrics. +type MetricIterator struct { + it *vkit.LogMetricIterator + pageInfo *iterator.PageInfo + nextFunc func() error + items []*Metric +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *MetricIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next result. Its second return value is Done if there are +// no more results. Once Next returns Done, all subsequent calls will return +// Done. +func (it *MetricIterator) Next() (*Metric, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *MetricIterator) fetch(pageSize int, pageToken string) (string, error) { + return iterFetch(pageSize, pageToken, it.it.PageInfo(), func() error { + item, err := it.it.Next() + if err != nil { + return err + } + it.items = append(it.items, fromLogMetric(item)) + return nil + }) +} + +func toLogMetric(m *Metric) *logpb.LogMetric { + return &logpb.LogMetric{ + Name: m.ID, + Description: m.Description, + Filter: m.Filter, + } +} + +func fromLogMetric(lm *logpb.LogMetric) *Metric { + return &Metric{ + ID: lm.Name, + Description: lm.Description, + Filter: lm.Filter, + } +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/metrics_test.go b/vendor/cloud.google.com/go/logging/logadmin/metrics_test.go new file mode 100644 index 000000000..afcbe794e --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/metrics_test.go @@ -0,0 +1,155 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin + +import ( + "context" + "log" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/internal/uid" + "google.golang.org/api/iterator" +) + +var metricIDs = uid.NewSpace("GO-CLIENT-TEST-METRIC", nil) + +// Initializes the tests before they run. +func initMetrics(ctx context.Context) { + // Clean up from aborted tests. + it := client.Metrics(ctx) +loop: + for { + m, err := it.Next() + switch err { + case nil: + if metricIDs.Older(m.ID, 24*time.Hour) { + client.DeleteMetric(ctx, m.ID) + } + case iterator.Done: + break loop + default: + log.Printf("cleanupMetrics: %v", err) + return + } + } +} + +func TestCreateDeleteMetric(t *testing.T) { + ctx := context.Background() + metric := &Metric{ + ID: metricIDs.New(), + Description: "DESC", + Filter: "FILTER", + } + if err := client.CreateMetric(ctx, metric); err != nil { + t.Fatal(err) + } + defer client.DeleteMetric(ctx, metric.ID) + + got, err := client.Metric(ctx, metric.ID) + if err != nil { + t.Fatal(err) + } + if want := metric; !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } + + if err := client.DeleteMetric(ctx, metric.ID); err != nil { + t.Fatal(err) + } + + if _, err := client.Metric(ctx, metric.ID); err == nil { + t.Fatal("got no error, expected one") + } +} + +func TestUpdateMetric(t *testing.T) { + ctx := context.Background() + metric := &Metric{ + ID: metricIDs.New(), + Description: "DESC", + Filter: "FILTER", + } + + // Updating a non-existent metric creates a new one. + if err := client.UpdateMetric(ctx, metric); err != nil { + t.Fatal(err) + } + defer client.DeleteMetric(ctx, metric.ID) + got, err := client.Metric(ctx, metric.ID) + if err != nil { + t.Fatal(err) + } + if want := metric; !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } + + // Updating an existing metric changes it. + metric.Description = "CHANGED" + if err := client.UpdateMetric(ctx, metric); err != nil { + t.Fatal(err) + } + got, err = client.Metric(ctx, metric.ID) + if err != nil { + t.Fatal(err) + } + if want := metric; !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } +} + +func TestListMetrics(t *testing.T) { + ctx := context.Background() + + var metrics []*Metric + want := map[string]*Metric{} + for i := 0; i < 10; i++ { + m := &Metric{ + ID: metricIDs.New(), + Description: "DESC", + Filter: "FILTER", + } + metrics = append(metrics, m) + want[m.ID] = m + } + for _, m := range metrics { + if err := client.CreateMetric(ctx, m); err != nil { + t.Fatalf("Create(%q): %v", m.ID, err) + } + defer client.DeleteMetric(ctx, m.ID) + } + + got := map[string]*Metric{} + it := client.Metrics(ctx) + for { + m, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + t.Fatal(err) + } + // If tests run simultaneously, we may have more metrics than we + // created. So only check for our own. + if _, ok := want[m.ID]; ok { + got[m.ID] = m + } + } + if !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/resources.go b/vendor/cloud.google.com/go/logging/logadmin/resources.go new file mode 100644 index 000000000..924dee1ad --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/resources.go @@ -0,0 +1,75 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin + +import ( + "context" + + vkit "cloud.google.com/go/logging/apiv2" + "google.golang.org/api/iterator" + mrpb "google.golang.org/genproto/googleapis/api/monitoredres" + logpb "google.golang.org/genproto/googleapis/logging/v2" +) + +// ResourceDescriptors returns a ResourceDescriptorIterator +// for iterating over MonitoredResourceDescriptors. Requires ReadScope or AdminScope. +// See https://cloud.google.com/logging/docs/api/v2/#monitored-resources for an explanation of +// monitored resources. +// See https://cloud.google.com/logging/docs/api/v2/resource-list for a list of monitored resources. +func (c *Client) ResourceDescriptors(ctx context.Context) *ResourceDescriptorIterator { + it := &ResourceDescriptorIterator{ + it: c.lClient.ListMonitoredResourceDescriptors(ctx, + &logpb.ListMonitoredResourceDescriptorsRequest{}), + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +// ResourceDescriptorIterator is an iterator over MonitoredResourceDescriptors. +type ResourceDescriptorIterator struct { + it *vkit.MonitoredResourceDescriptorIterator + pageInfo *iterator.PageInfo + nextFunc func() error + items []*mrpb.MonitoredResourceDescriptor +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ResourceDescriptorIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next result. Its second return value is Done if there are +// no more results. Once Next returns Done, all subsequent calls will return +// Done. +func (it *ResourceDescriptorIterator) Next() (*mrpb.MonitoredResourceDescriptor, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ResourceDescriptorIterator) fetch(pageSize int, pageToken string) (string, error) { + return iterFetch(pageSize, pageToken, it.it.PageInfo(), func() error { + item, err := it.it.Next() + if err != nil { + return err + } + it.items = append(it.items, item) + return nil + }) +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/resources_test.go b/vendor/cloud.google.com/go/logging/logadmin/resources_test.go new file mode 100644 index 000000000..a1f1e87e1 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/resources_test.go @@ -0,0 +1,46 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin + +import ( + "context" + "testing" + + "google.golang.org/api/iterator" +) + +func TestMonitoredResourceDescriptors(t *testing.T) { + // We can't create MonitoredResourceDescriptors, and there is no guarantee + // about what the service will return. So we just check that the result is + // non-empty. + it := client.ResourceDescriptors(context.Background()) + n := 0 +loop: + for { + _, err := it.Next() + switch err { + case nil: + n++ + case iterator.Done: + break loop + default: + t.Fatal(err) + } + } + if n == 0 { + t.Fatal("Next: got no MetricResourceDescriptors, expected at least one") + } + // TODO(jba) test pagination. +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/sinks.go b/vendor/cloud.google.com/go/logging/logadmin/sinks.go new file mode 100644 index 000000000..2b54fe862 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/sinks.go @@ -0,0 +1,256 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logadmin + +import ( + "context" + "errors" + "fmt" + + vkit "cloud.google.com/go/logging/apiv2" + "google.golang.org/api/iterator" + logpb "google.golang.org/genproto/googleapis/logging/v2" + maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +// Sink describes a sink used to export log entries outside Stackdriver +// Logging. Incoming log entries matching a filter are exported to a +// destination (a Cloud Storage bucket, BigQuery dataset or Cloud Pub/Sub +// topic). +// +// For more information, see https://cloud.google.com/logging/docs/export/using_exported_logs. +// (The Sinks in this package are what the documentation refers to as "project sinks".) +type Sink struct { + // ID is a client-assigned sink identifier. Example: + // "my-severe-errors-to-pubsub". + // Sink identifiers are limited to 1000 characters + // and can include only the following characters: A-Z, a-z, + // 0-9, and the special characters "_-.". + ID string + + // Destination is the export destination. See + // https://cloud.google.com/logging/docs/api/tasks/exporting-logs. + // Examples: "storage.googleapis.com/a-bucket", + // "bigquery.googleapis.com/projects/a-project-id/datasets/a-dataset". + Destination string + + // Filter optionally specifies an advanced logs filter (see + // https://cloud.google.com/logging/docs/view/advanced_filters) that + // defines the log entries to be exported. Example: "logName:syslog AND + // severity>=ERROR". If omitted, all entries are returned. + Filter string + + // WriterIdentity must be a service account name. When exporting logs, Logging + // adopts this identity for authorization. The export destination's owner must + // give this service account permission to write to the export destination. + WriterIdentity string + + // IncludeChildren, when set to true, allows the sink to export log entries from + // the organization or folder, plus (recursively) from any contained folders, billing + // accounts, or projects. IncludeChildren is false by default. You can use the sink's + // filter to choose log entries from specific projects, specific resource types, or + // specific named logs. + // + // Caution: If you enable this feature, your aggregated export sink might export + // a very large number of log entries. To avoid exporting too many log entries, + // design your aggregated export sink filter carefully, as described on + // https://cloud.google.com/logging/docs/export/aggregated_exports. + IncludeChildren bool +} + +// CreateSink creates a Sink. It returns an error if the Sink already exists. +// Requires AdminScope. +func (c *Client) CreateSink(ctx context.Context, sink *Sink) (*Sink, error) { + return c.CreateSinkOpt(ctx, sink, SinkOptions{}) +} + +// CreateSinkOpt creates a Sink using the provided options. It returns an +// error if the Sink already exists. Requires AdminScope. +func (c *Client) CreateSinkOpt(ctx context.Context, sink *Sink, opts SinkOptions) (*Sink, error) { + ls, err := c.sClient.CreateSink(ctx, &logpb.CreateSinkRequest{ + Parent: c.parent, + Sink: toLogSink(sink), + UniqueWriterIdentity: opts.UniqueWriterIdentity, + }) + if err != nil { + return nil, err + } + return fromLogSink(ls), nil +} + +// SinkOptions define options to be used when creating or updating a sink. +type SinkOptions struct { + // Determines the kind of IAM identity returned as WriterIdentity in the new + // sink. If this value is omitted or set to false, and if the sink's parent is a + // project, then the value returned as WriterIdentity is the same group or + // service account used by Stackdriver Logging before the addition of writer + // identities to the API. The sink's destination must be in the same project as + // the sink itself. + // + // If this field is set to true, or if the sink is owned by a non-project + // resource such as an organization, then the value of WriterIdentity will + // be a unique service account used only for exports from the new sink. + UniqueWriterIdentity bool + + // These fields apply only to UpdateSinkOpt calls. The corresponding sink field + // is updated if and only if the Update field is true. + UpdateDestination bool + UpdateFilter bool + UpdateIncludeChildren bool +} + +// DeleteSink deletes a sink. The provided sinkID is the sink's identifier, such as +// "my-severe-errors-to-pubsub". +// Requires AdminScope. +func (c *Client) DeleteSink(ctx context.Context, sinkID string) error { + return c.sClient.DeleteSink(ctx, &logpb.DeleteSinkRequest{ + SinkName: c.sinkPath(sinkID), + }) +} + +// Sink gets a sink. The provided sinkID is the sink's identifier, such as +// "my-severe-errors-to-pubsub". +// Requires ReadScope or AdminScope. +func (c *Client) Sink(ctx context.Context, sinkID string) (*Sink, error) { + ls, err := c.sClient.GetSink(ctx, &logpb.GetSinkRequest{ + SinkName: c.sinkPath(sinkID), + }) + if err != nil { + return nil, err + } + return fromLogSink(ls), nil +} + +// UpdateSink updates an existing Sink. Requires AdminScope. +// +// WARNING: UpdateSink will always update the Destination, Filter and IncludeChildren +// fields of the sink, even if they have their zero values. Use UpdateSinkOpt +// for more control over which fields to update. +func (c *Client) UpdateSink(ctx context.Context, sink *Sink) (*Sink, error) { + return c.UpdateSinkOpt(ctx, sink, SinkOptions{ + UpdateDestination: true, + UpdateFilter: true, + UpdateIncludeChildren: true, + }) +} + +// UpdateSinkOpt updates an existing Sink, using the provided options. Requires AdminScope. +// +// To change a sink's writer identity to a service account unique to the sink, set +// opts.UniqueWriterIdentity to true. It is not possible to change a sink's writer identity +// from a unique service account to a non-unique writer identity. +func (c *Client) UpdateSinkOpt(ctx context.Context, sink *Sink, opts SinkOptions) (*Sink, error) { + mask := &maskpb.FieldMask{} + if opts.UpdateDestination { + mask.Paths = append(mask.Paths, "destination") + } + if opts.UpdateFilter { + mask.Paths = append(mask.Paths, "filter") + } + if opts.UpdateIncludeChildren { + mask.Paths = append(mask.Paths, "include_children") + } + if opts.UniqueWriterIdentity && len(mask.Paths) == 0 { + // Hack: specify a deprecated, unchangeable field so that we have a non-empty + // field mask. (An empty field mask would cause the destination, filter and include_children + // fields to be changed.) + mask.Paths = append(mask.Paths, "output_version_format") + } + if len(mask.Paths) == 0 { + return nil, errors.New("logadmin: UpdateSinkOpt: nothing to update") + } + ls, err := c.sClient.UpdateSink(ctx, &logpb.UpdateSinkRequest{ + SinkName: c.sinkPath(sink.ID), + Sink: toLogSink(sink), + UniqueWriterIdentity: opts.UniqueWriterIdentity, + UpdateMask: mask, + }) + if err != nil { + return nil, err + } + return fromLogSink(ls), err +} + +func (c *Client) sinkPath(sinkID string) string { + return fmt.Sprintf("%s/sinks/%s", c.parent, sinkID) +} + +// Sinks returns a SinkIterator for iterating over all Sinks in the Client's project. +// Requires ReadScope or AdminScope. +func (c *Client) Sinks(ctx context.Context) *SinkIterator { + it := &SinkIterator{ + it: c.sClient.ListSinks(ctx, &logpb.ListSinksRequest{Parent: c.parent}), + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + return it +} + +// A SinkIterator iterates over Sinks. +type SinkIterator struct { + it *vkit.LogSinkIterator + pageInfo *iterator.PageInfo + nextFunc func() error + items []*Sink +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *SinkIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next result. Its second return value is Done if there are +// no more results. Once Next returns Done, all subsequent calls will return +// Done. +func (it *SinkIterator) Next() (*Sink, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *SinkIterator) fetch(pageSize int, pageToken string) (string, error) { + return iterFetch(pageSize, pageToken, it.it.PageInfo(), func() error { + item, err := it.it.Next() + if err != nil { + return err + } + it.items = append(it.items, fromLogSink(item)) + return nil + }) +} + +func toLogSink(s *Sink) *logpb.LogSink { + return &logpb.LogSink{ + Name: s.ID, + Destination: s.Destination, + Filter: s.Filter, + IncludeChildren: s.IncludeChildren, + OutputVersionFormat: logpb.LogSink_V2, + // omit WriterIdentity because it is output-only. + } +} + +func fromLogSink(ls *logpb.LogSink) *Sink { + return &Sink{ + ID: ls.Name, + Destination: ls.Destination, + Filter: ls.Filter, + WriterIdentity: ls.WriterIdentity, + IncludeChildren: ls.IncludeChildren, + } +} diff --git a/vendor/cloud.google.com/go/logging/logadmin/sinks_test.go b/vendor/cloud.google.com/go/logging/logadmin/sinks_test.go new file mode 100644 index 000000000..1762a6c1e --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logadmin/sinks_test.go @@ -0,0 +1,284 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// TODO(jba): document in CONTRIBUTING.md that service account must be given "Logs Configuration Writer" IAM role for sink tests to pass. +// TODO(jba): [cont] (1) From top left menu, go to IAM & Admin. (2) In Roles dropdown for acct, select Logging > Logs Configuration Writer. (3) Save. +// TODO(jba): Also, cloud-logs@google.com must have Owner permission on the GCS bucket named for the test project. + +package logadmin + +import ( + "context" + "log" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/internal/uid" + ltest "cloud.google.com/go/logging/internal/testing" + "cloud.google.com/go/storage" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var sinkIDs = uid.NewSpace("GO-CLIENT-TEST-SINK", nil) + +const testFilter = "" + +var testSinkDestination string + +// Called just before TestMain calls m.Run. +// Returns a cleanup function to be called after the tests finish. +func initSinks(ctx context.Context) func() { + // Create a unique GCS bucket so concurrent tests don't interfere with each other. + bucketIDs := uid.NewSpace(testProjectID+"-log-sink", nil) + testBucket := bucketIDs.New() + testSinkDestination = "storage.googleapis.com/" + testBucket + var storageClient *storage.Client + if integrationTest { + // Create a unique bucket as a sink destination, and give the cloud logging account + // owner right. + ts := testutil.TokenSource(ctx, storage.ScopeFullControl) + var err error + storageClient, err = storage.NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + log.Fatalf("new storage client: %v", err) + } + bucket := storageClient.Bucket(testBucket) + if err := bucket.Create(ctx, testProjectID, nil); err != nil { + log.Fatalf("creating storage bucket %q: %v", testBucket, err) + } + log.Printf("successfully created bucket %s", testBucket) + if err := bucket.ACL().Set(ctx, "group-cloud-logs@google.com", storage.RoleOwner); err != nil { + log.Fatalf("setting owner role: %v", err) + } + } + // Clean up from aborted tests. + it := client.Sinks(ctx) + for { + s, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + log.Printf("listing sinks: %v", err) + break + } + if sinkIDs.Older(s.ID, time.Hour) { + client.DeleteSink(ctx, s.ID) // ignore error + } + } + if integrationTest { + for _, bn := range bucketNames(ctx, storageClient) { + if bucketIDs.Older(bn, 24*time.Hour) { + storageClient.Bucket(bn).Delete(ctx) // ignore error + } + } + return func() { + storageClient.Close() + } + } + return func() {} +} + +// Collect the name of all buckets for the test project. +func bucketNames(ctx context.Context, client *storage.Client) []string { + var names []string + it := client.Buckets(ctx, testProjectID) +loop: + for { + b, err := it.Next() + switch err { + case nil: + names = append(names, b.Name) + case iterator.Done: + break loop + default: + log.Printf("listing buckets: %v", err) + break loop + } + } + return names +} + +func TestCreateSink(t *testing.T) { + ctx := context.Background() + sink := &Sink{ + ID: sinkIDs.New(), + Destination: testSinkDestination, + Filter: testFilter, + IncludeChildren: true, + } + got, err := client.CreateSink(ctx, sink) + if err != nil { + t.Fatal(err) + } + sink.WriterIdentity = ltest.SharedServiceAccount + if want := sink; !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } + got, err = client.Sink(ctx, sink.ID) + if err != nil { + t.Fatal(err) + } + if want := sink; !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } + + // UniqueWriterIdentity + sink.ID = sinkIDs.New() + got, err = client.CreateSinkOpt(ctx, sink, SinkOptions{UniqueWriterIdentity: true}) + if err != nil { + t.Fatal(err) + } + // The WriterIdentity should be different. + if got.WriterIdentity == sink.WriterIdentity { + t.Errorf("got %s, want something different", got.WriterIdentity) + } +} + +func TestUpdateSink(t *testing.T) { + ctx := context.Background() + sink := &Sink{ + ID: sinkIDs.New(), + Destination: testSinkDestination, + Filter: testFilter, + IncludeChildren: true, + WriterIdentity: ltest.SharedServiceAccount, + } + + if _, err := client.CreateSink(ctx, sink); err != nil { + t.Fatal(err) + } + got, err := client.UpdateSink(ctx, sink) + if err != nil { + t.Fatal(err) + } + if want := sink; !testutil.Equal(got, want) { + t.Errorf("got\n%+v\nwant\n%+v", got, want) + } + got, err = client.Sink(ctx, sink.ID) + if err != nil { + t.Fatal(err) + } + if want := sink; !testutil.Equal(got, want) { + t.Errorf("got\n%+v\nwant\n%+v", got, want) + } + + // Updating an existing sink changes it. + sink.Filter = "" + sink.IncludeChildren = false + if _, err := client.UpdateSink(ctx, sink); err != nil { + t.Fatal(err) + } + got, err = client.Sink(ctx, sink.ID) + if err != nil { + t.Fatal(err) + } + if want := sink; !testutil.Equal(got, want) { + t.Errorf("got\n%+v\nwant\n%+v", got, want) + } +} + +func TestUpdateSinkOpt(t *testing.T) { + ctx := context.Background() + id := sinkIDs.New() + origSink := &Sink{ + ID: id, + Destination: testSinkDestination, + Filter: testFilter, + IncludeChildren: true, + WriterIdentity: ltest.SharedServiceAccount, + } + + if _, err := client.CreateSink(ctx, origSink); err != nil { + t.Fatal(err) + } + + // Updating with empty options is an error. + _, err := client.UpdateSinkOpt(ctx, &Sink{ID: id, Destination: testSinkDestination}, SinkOptions{}) + if err == nil { + t.Errorf("got %v, want nil", err) + } + + // Update selected fields. + got, err := client.UpdateSinkOpt(ctx, &Sink{ID: id}, SinkOptions{ + UpdateFilter: true, + UpdateIncludeChildren: true, + }) + if err != nil { + t.Fatal(err) + } + want := *origSink + want.Filter = "" + want.IncludeChildren = false + if !testutil.Equal(got, &want) { + t.Errorf("got\n%+v\nwant\n%+v", got, want) + } + + // Update writer identity. + got, err = client.UpdateSinkOpt(ctx, &Sink{ID: id, Filter: "foo"}, + SinkOptions{UniqueWriterIdentity: true}) + if err != nil { + t.Fatal(err) + } + if got.WriterIdentity == want.WriterIdentity { + t.Errorf("got %s, want something different", got.WriterIdentity) + } + want.WriterIdentity = got.WriterIdentity + if !testutil.Equal(got, &want) { + t.Errorf("got\n%+v\nwant\n%+v", got, want) + } +} + +func TestListSinks(t *testing.T) { + ctx := context.Background() + var sinks []*Sink + want := map[string]*Sink{} + for i := 0; i < 4; i++ { + s := &Sink{ + ID: sinkIDs.New(), + Destination: testSinkDestination, + Filter: testFilter, + WriterIdentity: "serviceAccount:cloud-logs@system.gserviceaccount.com", + } + sinks = append(sinks, s) + want[s.ID] = s + } + for _, s := range sinks { + if _, err := client.CreateSink(ctx, s); err != nil { + t.Fatalf("Create(%q): %v", s.ID, err) + } + } + + got := map[string]*Sink{} + it := client.Sinks(ctx) + for { + s, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + t.Fatal(err) + } + // If tests run simultaneously, we may have more sinks than we + // created. So only check for our own. + if _, ok := want[s.ID]; ok { + got[s.ID] = s + } + } + if !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } +} diff --git a/vendor/cloud.google.com/go/logging/logging.go b/vendor/cloud.google.com/go/logging/logging.go new file mode 100644 index 000000000..6cc3ebb5f --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logging.go @@ -0,0 +1,842 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// API/gRPC features intentionally missing from this client: +// - You cannot have the server pick the time of the entry. This client +// always sends a time. +// - There is no way to provide a protocol buffer payload. +// - No support for the "partial success" feature when writing log entries. + +// TODO(jba): test whether forward-slash characters in the log ID must be URL-encoded. +// These features are missing now, but will likely be added: +// - There is no way to specify CallOptions. + +package logging + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "log" + "net/http" + "strconv" + "strings" + "sync" + "time" + + "cloud.google.com/go/compute/metadata" + "cloud.google.com/go/internal/version" + vkit "cloud.google.com/go/logging/apiv2" + "cloud.google.com/go/logging/internal" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + structpb "github.com/golang/protobuf/ptypes/struct" + tspb "github.com/golang/protobuf/ptypes/timestamp" + "google.golang.org/api/option" + "google.golang.org/api/support/bundler" + mrpb "google.golang.org/genproto/googleapis/api/monitoredres" + logtypepb "google.golang.org/genproto/googleapis/logging/type" + logpb "google.golang.org/genproto/googleapis/logging/v2" +) + +const ( + // ReadScope is the scope for reading from the logging service. + ReadScope = "https://www.googleapis.com/auth/logging.read" + + // WriteScope is the scope for writing to the logging service. + WriteScope = "https://www.googleapis.com/auth/logging.write" + + // AdminScope is the scope for administrative actions on the logging service. + AdminScope = "https://www.googleapis.com/auth/logging.admin" +) + +const ( + // defaultErrorCapacity is the capacity of the channel used to deliver + // errors to the OnError function. + defaultErrorCapacity = 10 + + // DefaultDelayThreshold is the default value for the DelayThreshold LoggerOption. + DefaultDelayThreshold = time.Second + + // DefaultEntryCountThreshold is the default value for the EntryCountThreshold LoggerOption. + DefaultEntryCountThreshold = 1000 + + // DefaultEntryByteThreshold is the default value for the EntryByteThreshold LoggerOption. + DefaultEntryByteThreshold = 1 << 20 // 1MiB + + // DefaultBufferedByteLimit is the default value for the BufferedByteLimit LoggerOption. + DefaultBufferedByteLimit = 1 << 30 // 1GiB + + // defaultWriteTimeout is the timeout for the underlying write API calls. As + // write API calls are not idempotent, they are not retried on timeout. This + // timeout is to allow clients to degrade gracefully if underlying logging + // service is temporarily impaired for some reason. + defaultWriteTimeout = 10 * time.Minute +) + +// For testing: +var now = time.Now + +// ErrOverflow signals that the number of buffered entries for a Logger +// exceeds its BufferLimit. +var ErrOverflow = bundler.ErrOverflow + +// ErrOversizedEntry signals that an entry's size exceeds the maximum number of +// bytes that will be sent in a single call to the logging service. +var ErrOversizedEntry = bundler.ErrOversizedItem + +// Client is a Logging client. A Client is associated with a single Cloud project. +type Client struct { + client *vkit.Client // client for the logging service + parent string // e.g. "projects/proj-id" + errc chan error // should be buffered to minimize dropped errors + donec chan struct{} // closed on Client.Close to close Logger bundlers + loggers sync.WaitGroup // so we can wait for loggers to close + closed bool + + mu sync.Mutex + nErrs int // number of errors we saw + lastErr error // last error we saw + + // OnError is called when an error occurs in a call to Log or Flush. The + // error may be due to an invalid Entry, an overflow because BufferLimit + // was reached (in which case the error will be ErrOverflow) or an error + // communicating with the logging service. OnError is called with errors + // from all Loggers. It is never called concurrently. OnError is expected + // to return quickly; if errors occur while OnError is running, some may + // not be reported. The default behavior is to call log.Printf. + // + // This field should be set only once, before any method of Client is called. + OnError func(err error) +} + +// NewClient returns a new logging client associated with the provided parent. +// A parent can take any of the following forms: +// projects/PROJECT_ID +// folders/FOLDER_ID +// billingAccounts/ACCOUNT_ID +// organizations/ORG_ID +// for backwards compatibility, a string with no '/' is also allowed and is interpreted +// as a project ID. +// +// By default NewClient uses WriteScope. To use a different scope, call +// NewClient using a WithScopes option (see https://godoc.org/google.golang.org/api/option#WithScopes). +func NewClient(ctx context.Context, parent string, opts ...option.ClientOption) (*Client, error) { + if !strings.ContainsRune(parent, '/') { + parent = "projects/" + parent + } + opts = append([]option.ClientOption{ + option.WithEndpoint(internal.ProdAddr), + option.WithScopes(WriteScope), + }, opts...) + c, err := vkit.NewClient(ctx, opts...) + if err != nil { + return nil, err + } + c.SetGoogleClientInfo("gccl", version.Repo) + client := &Client{ + client: c, + parent: parent, + errc: make(chan error, defaultErrorCapacity), // create a small buffer for errors + donec: make(chan struct{}), + OnError: func(e error) { log.Printf("logging client: %v", e) }, + } + // Call the user's function synchronously, to make life easier for them. + go func() { + for err := range client.errc { + // This reference to OnError is memory-safe if the user sets OnError before + // calling any client methods. The reference happens before the first read from + // client.errc, which happens before the first write to client.errc, which + // happens before any call, which happens before the user sets OnError. + if fn := client.OnError; fn != nil { + fn(err) + } else { + log.Printf("logging (parent %q): %v", parent, err) + } + } + }() + return client, nil +} + +var unixZeroTimestamp *tspb.Timestamp + +func init() { + var err error + unixZeroTimestamp, err = ptypes.TimestampProto(time.Unix(0, 0)) + if err != nil { + panic(err) + } +} + +// Ping reports whether the client's connection to the logging service and the +// authentication configuration are valid. To accomplish this, Ping writes a +// log entry "ping" to a log named "ping". +func (c *Client) Ping(ctx context.Context) error { + ent := &logpb.LogEntry{ + Payload: &logpb.LogEntry_TextPayload{TextPayload: "ping"}, + Timestamp: unixZeroTimestamp, // Identical timestamps and insert IDs are both + InsertId: "ping", // necessary for the service to dedup these entries. + } + _, err := c.client.WriteLogEntries(ctx, &logpb.WriteLogEntriesRequest{ + LogName: internal.LogPath(c.parent, "ping"), + Resource: monitoredResource(c.parent), + Entries: []*logpb.LogEntry{ent}, + }) + return err +} + +// error puts the error on the client's error channel +// without blocking, and records summary error info. +func (c *Client) error(err error) { + select { + case c.errc <- err: + default: + } + c.mu.Lock() + c.lastErr = err + c.nErrs++ + c.mu.Unlock() +} + +func (c *Client) extractErrorInfo() error { + var err error + c.mu.Lock() + if c.lastErr != nil { + err = fmt.Errorf("saw %d errors; last: %v", c.nErrs, c.lastErr) + c.nErrs = 0 + c.lastErr = nil + } + c.mu.Unlock() + return err +} + +// A Logger is used to write log messages to a single log. It can be configured +// with a log ID, common monitored resource, and a set of common labels. +type Logger struct { + client *Client + logName string // "projects/{projectID}/logs/{logID}" + stdLoggers map[Severity]*log.Logger + bundler *bundler.Bundler + + // Options + commonResource *mrpb.MonitoredResource + commonLabels map[string]string + writeTimeout time.Duration + ctxFunc func() (context.Context, func()) +} + +// A LoggerOption is a configuration option for a Logger. +type LoggerOption interface { + set(*Logger) +} + +// CommonResource sets the monitored resource associated with all log entries +// written from a Logger. If not provided, the resource is automatically +// detected based on the running environment. This value can be overridden +// per-entry by setting an Entry's Resource field. +func CommonResource(r *mrpb.MonitoredResource) LoggerOption { return commonResource{r} } + +type commonResource struct{ *mrpb.MonitoredResource } + +func (r commonResource) set(l *Logger) { l.commonResource = r.MonitoredResource } + +var detectedResource struct { + pb *mrpb.MonitoredResource + once sync.Once +} + +func detectResource() *mrpb.MonitoredResource { + detectedResource.once.Do(func() { + if !metadata.OnGCE() { + return + } + projectID, err := metadata.ProjectID() + if err != nil { + return + } + id, err := metadata.InstanceID() + if err != nil { + return + } + zone, err := metadata.Zone() + if err != nil { + return + } + detectedResource.pb = &mrpb.MonitoredResource{ + Type: "gce_instance", + Labels: map[string]string{ + "project_id": projectID, + "instance_id": id, + "zone": zone, + }, + } + }) + return detectedResource.pb +} + +var resourceInfo = map[string]struct{ rtype, label string }{ + "organizations": {"organization", "organization_id"}, + "folders": {"folder", "folder_id"}, + "projects": {"project", "project_id"}, + "billingAccounts": {"billing_account", "account_id"}, +} + +func monitoredResource(parent string) *mrpb.MonitoredResource { + parts := strings.SplitN(parent, "/", 2) + if len(parts) != 2 { + return globalResource(parent) + } + info, ok := resourceInfo[parts[0]] + if !ok { + return globalResource(parts[1]) + } + return &mrpb.MonitoredResource{ + Type: info.rtype, + Labels: map[string]string{info.label: parts[1]}, + } +} + +func globalResource(projectID string) *mrpb.MonitoredResource { + return &mrpb.MonitoredResource{ + Type: "global", + Labels: map[string]string{ + "project_id": projectID, + }, + } +} + +// CommonLabels are labels that apply to all log entries written from a Logger, +// so that you don't have to repeat them in each log entry's Labels field. If +// any of the log entries contains a (key, value) with the same key that is in +// CommonLabels, then the entry's (key, value) overrides the one in +// CommonLabels. +func CommonLabels(m map[string]string) LoggerOption { return commonLabels(m) } + +type commonLabels map[string]string + +func (c commonLabels) set(l *Logger) { l.commonLabels = c } + +// ConcurrentWriteLimit determines how many goroutines will send log entries to the +// underlying service. The default is 1. Set ConcurrentWriteLimit to a higher value to +// increase throughput. +func ConcurrentWriteLimit(n int) LoggerOption { return concurrentWriteLimit(n) } + +type concurrentWriteLimit int + +func (c concurrentWriteLimit) set(l *Logger) { l.bundler.HandlerLimit = int(c) } + +// DelayThreshold is the maximum amount of time that an entry should remain +// buffered in memory before a call to the logging service is triggered. Larger +// values of DelayThreshold will generally result in fewer calls to the logging +// service, while increasing the risk that log entries will be lost if the +// process crashes. +// The default is DefaultDelayThreshold. +func DelayThreshold(d time.Duration) LoggerOption { return delayThreshold(d) } + +type delayThreshold time.Duration + +func (d delayThreshold) set(l *Logger) { l.bundler.DelayThreshold = time.Duration(d) } + +// EntryCountThreshold is the maximum number of entries that will be buffered +// in memory before a call to the logging service is triggered. Larger values +// will generally result in fewer calls to the logging service, while +// increasing both memory consumption and the risk that log entries will be +// lost if the process crashes. +// The default is DefaultEntryCountThreshold. +func EntryCountThreshold(n int) LoggerOption { return entryCountThreshold(n) } + +type entryCountThreshold int + +func (e entryCountThreshold) set(l *Logger) { l.bundler.BundleCountThreshold = int(e) } + +// EntryByteThreshold is the maximum number of bytes of entries that will be +// buffered in memory before a call to the logging service is triggered. See +// EntryCountThreshold for a discussion of the tradeoffs involved in setting +// this option. +// The default is DefaultEntryByteThreshold. +func EntryByteThreshold(n int) LoggerOption { return entryByteThreshold(n) } + +type entryByteThreshold int + +func (e entryByteThreshold) set(l *Logger) { l.bundler.BundleByteThreshold = int(e) } + +// EntryByteLimit is the maximum number of bytes of entries that will be sent +// in a single call to the logging service. ErrOversizedEntry is returned if an +// entry exceeds EntryByteLimit. This option limits the size of a single RPC +// payload, to account for network or service issues with large RPCs. If +// EntryByteLimit is smaller than EntryByteThreshold, the latter has no effect. +// The default is zero, meaning there is no limit. +func EntryByteLimit(n int) LoggerOption { return entryByteLimit(n) } + +type entryByteLimit int + +func (e entryByteLimit) set(l *Logger) { l.bundler.BundleByteLimit = int(e) } + +// BufferedByteLimit is the maximum number of bytes that the Logger will keep +// in memory before returning ErrOverflow. This option limits the total memory +// consumption of the Logger (but note that each Logger has its own, separate +// limit). It is possible to reach BufferedByteLimit even if it is larger than +// EntryByteThreshold or EntryByteLimit, because calls triggered by the latter +// two options may be enqueued (and hence occupying memory) while new log +// entries are being added. +// The default is DefaultBufferedByteLimit. +func BufferedByteLimit(n int) LoggerOption { return bufferedByteLimit(n) } + +type bufferedByteLimit int + +func (b bufferedByteLimit) set(l *Logger) { l.bundler.BufferedByteLimit = int(b) } + +// ContextFunc is a function that will be called to obtain a context.Context for the +// WriteLogEntries RPC executed in the background for calls to Logger.Log. The +// default is a function that always returns context.Background. The second return +// value of the function is a function to call after the RPC completes. +// +// The function is not used for calls to Logger.LogSync, since the caller can pass +// in the context directly. +// +// This option is EXPERIMENTAL. It may be changed or removed. +func ContextFunc(f func() (ctx context.Context, afterCall func())) LoggerOption { + return contextFunc(f) +} + +type contextFunc func() (ctx context.Context, afterCall func()) + +func (c contextFunc) set(l *Logger) { l.ctxFunc = c } + +// Logger returns a Logger that will write entries with the given log ID, such as +// "syslog". A log ID must be less than 512 characters long and can only +// include the following characters: upper and lower case alphanumeric +// characters: [A-Za-z0-9]; and punctuation characters: forward-slash, +// underscore, hyphen, and period. +func (c *Client) Logger(logID string, opts ...LoggerOption) *Logger { + r := detectResource() + if r == nil { + r = monitoredResource(c.parent) + } + l := &Logger{ + client: c, + logName: internal.LogPath(c.parent, logID), + commonResource: r, + ctxFunc: func() (context.Context, func()) { return context.Background(), nil }, + } + l.bundler = bundler.NewBundler(&logpb.LogEntry{}, func(entries interface{}) { + l.writeLogEntries(entries.([]*logpb.LogEntry)) + }) + l.bundler.DelayThreshold = DefaultDelayThreshold + l.bundler.BundleCountThreshold = DefaultEntryCountThreshold + l.bundler.BundleByteThreshold = DefaultEntryByteThreshold + l.bundler.BufferedByteLimit = DefaultBufferedByteLimit + for _, opt := range opts { + opt.set(l) + } + l.stdLoggers = map[Severity]*log.Logger{} + for s := range severityName { + l.stdLoggers[s] = log.New(severityWriter{l, s}, "", 0) + } + + c.loggers.Add(1) + // Start a goroutine that cleans up the bundler, its channel + // and the writer goroutines when the client is closed. + go func() { + defer c.loggers.Done() + <-c.donec + l.bundler.Flush() + }() + return l +} + +type severityWriter struct { + l *Logger + s Severity +} + +func (w severityWriter) Write(p []byte) (n int, err error) { + w.l.Log(Entry{ + Severity: w.s, + Payload: string(p), + }) + return len(p), nil +} + +// Close waits for all opened loggers to be flushed and closes the client. +func (c *Client) Close() error { + if c.closed { + return nil + } + close(c.donec) // close Logger bundlers + c.loggers.Wait() // wait for all bundlers to flush and close + // Now there can be no more errors. + close(c.errc) // terminate error goroutine + // Prefer errors arising from logging to the error returned from Close. + err := c.extractErrorInfo() + err2 := c.client.Close() + if err == nil { + err = err2 + } + c.closed = true + return err +} + +// Severity is the severity of the event described in a log entry. These +// guideline severity levels are ordered, with numerically smaller levels +// treated as less severe than numerically larger levels. +type Severity int + +const ( + // Default means the log entry has no assigned severity level. + Default = Severity(logtypepb.LogSeverity_DEFAULT) + // Debug means debug or trace information. + Debug = Severity(logtypepb.LogSeverity_DEBUG) + // Info means routine information, such as ongoing status or performance. + Info = Severity(logtypepb.LogSeverity_INFO) + // Notice means normal but significant events, such as start up, shut down, or configuration. + Notice = Severity(logtypepb.LogSeverity_NOTICE) + // Warning means events that might cause problems. + Warning = Severity(logtypepb.LogSeverity_WARNING) + // Error means events that are likely to cause problems. + Error = Severity(logtypepb.LogSeverity_ERROR) + // Critical means events that cause more severe problems or brief outages. + Critical = Severity(logtypepb.LogSeverity_CRITICAL) + // Alert means a person must take an action immediately. + Alert = Severity(logtypepb.LogSeverity_ALERT) + // Emergency means one or more systems are unusable. + Emergency = Severity(logtypepb.LogSeverity_EMERGENCY) +) + +var severityName = map[Severity]string{ + Default: "Default", + Debug: "Debug", + Info: "Info", + Notice: "Notice", + Warning: "Warning", + Error: "Error", + Critical: "Critical", + Alert: "Alert", + Emergency: "Emergency", +} + +// String converts a severity level to a string. +func (v Severity) String() string { + // same as proto.EnumName + s, ok := severityName[v] + if ok { + return s + } + return strconv.Itoa(int(v)) +} + +// ParseSeverity returns the Severity whose name equals s, ignoring case. It +// returns Default if no Severity matches. +func ParseSeverity(s string) Severity { + sl := strings.ToLower(s) + for sev, name := range severityName { + if strings.ToLower(name) == sl { + return sev + } + } + return Default +} + +// Entry is a log entry. +// See https://cloud.google.com/logging/docs/view/logs_index for more about entries. +type Entry struct { + // Timestamp is the time of the entry. If zero, the current time is used. + Timestamp time.Time + + // Severity is the entry's severity level. + // The zero value is Default. + Severity Severity + + // Payload must be either a string, or something that marshals via the + // encoding/json package to a JSON object (and not any other type of JSON value). + Payload interface{} + + // Labels optionally specifies key/value labels for the log entry. + // The Logger.Log method takes ownership of this map. See Logger.CommonLabels + // for more about labels. + Labels map[string]string + + // InsertID is a unique ID for the log entry. If you provide this field, + // the logging service considers other log entries in the same log with the + // same ID as duplicates which can be removed. If omitted, the logging + // service will generate a unique ID for this log entry. Note that because + // this client retries RPCs automatically, it is possible (though unlikely) + // that an Entry without an InsertID will be written more than once. + InsertID string + + // HTTPRequest optionally specifies metadata about the HTTP request + // associated with this log entry, if applicable. It is optional. + HTTPRequest *HTTPRequest + + // Operation optionally provides information about an operation associated + // with the log entry, if applicable. + Operation *logpb.LogEntryOperation + + // LogName is the full log name, in the form + // "projects/{ProjectID}/logs/{LogID}". It is set by the client when + // reading entries. It is an error to set it when writing entries. + LogName string + + // Resource is the monitored resource associated with the entry. + Resource *mrpb.MonitoredResource + + // Trace is the resource name of the trace associated with the log entry, + // if any. If it contains a relative resource name, the name is assumed to + // be relative to //tracing.googleapis.com. + Trace string + + // Optional. Source code location information associated with the log entry, + // if any. + SourceLocation *logpb.LogEntrySourceLocation +} + +// HTTPRequest contains an http.Request as well as additional +// information about the request and its response. +type HTTPRequest struct { + // Request is the http.Request passed to the handler. + Request *http.Request + + // RequestSize is the size of the HTTP request message in bytes, including + // the request headers and the request body. + RequestSize int64 + + // Status is the response code indicating the status of the response. + // Examples: 200, 404. + Status int + + // ResponseSize is the size of the HTTP response message sent back to the client, in bytes, + // including the response headers and the response body. + ResponseSize int64 + + // Latency is the request processing latency on the server, from the time the request was + // received until the response was sent. + Latency time.Duration + + // LocalIP is the IP address (IPv4 or IPv6) of the origin server that the request + // was sent to. + LocalIP string + + // RemoteIP is the IP address (IPv4 or IPv6) of the client that issued the + // HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329". + RemoteIP string + + // CacheHit reports whether an entity was served from cache (with or without + // validation). + CacheHit bool + + // CacheValidatedWithOriginServer reports whether the response was + // validated with the origin server before being served from cache. This + // field is only meaningful if CacheHit is true. + CacheValidatedWithOriginServer bool +} + +func fromHTTPRequest(r *HTTPRequest) *logtypepb.HttpRequest { + if r == nil { + return nil + } + if r.Request == nil { + panic("HTTPRequest must have a non-nil Request") + } + u := *r.Request.URL + u.Fragment = "" + pb := &logtypepb.HttpRequest{ + RequestMethod: r.Request.Method, + RequestUrl: u.String(), + RequestSize: r.RequestSize, + Status: int32(r.Status), + ResponseSize: r.ResponseSize, + UserAgent: r.Request.UserAgent(), + ServerIp: r.LocalIP, + RemoteIp: r.RemoteIP, // TODO(jba): attempt to parse http.Request.RemoteAddr? + Referer: r.Request.Referer(), + CacheHit: r.CacheHit, + CacheValidatedWithOriginServer: r.CacheValidatedWithOriginServer, + } + if r.Latency != 0 { + pb.Latency = ptypes.DurationProto(r.Latency) + } + return pb +} + +// toProtoStruct converts v, which must marshal into a JSON object, +// into a Google Struct proto. +func toProtoStruct(v interface{}) (*structpb.Struct, error) { + // Fast path: if v is already a *structpb.Struct, nothing to do. + if s, ok := v.(*structpb.Struct); ok { + return s, nil + } + // v is a Go value that supports JSON marshalling. We want a Struct + // protobuf. Some day we may have a more direct way to get there, but right + // now the only way is to marshal the Go value to JSON, unmarshal into a + // map, and then build the Struct proto from the map. + var jb []byte + var err error + if raw, ok := v.(json.RawMessage); ok { // needed for Go 1.7 and below + jb = []byte(raw) + } else { + jb, err = json.Marshal(v) + if err != nil { + return nil, fmt.Errorf("logging: json.Marshal: %v", err) + } + } + var m map[string]interface{} + err = json.Unmarshal(jb, &m) + if err != nil { + return nil, fmt.Errorf("logging: json.Unmarshal: %v", err) + } + return jsonMapToProtoStruct(m), nil +} + +func jsonMapToProtoStruct(m map[string]interface{}) *structpb.Struct { + fields := map[string]*structpb.Value{} + for k, v := range m { + fields[k] = jsonValueToStructValue(v) + } + return &structpb.Struct{Fields: fields} +} + +func jsonValueToStructValue(v interface{}) *structpb.Value { + switch x := v.(type) { + case bool: + return &structpb.Value{Kind: &structpb.Value_BoolValue{BoolValue: x}} + case float64: + return &structpb.Value{Kind: &structpb.Value_NumberValue{NumberValue: x}} + case string: + return &structpb.Value{Kind: &structpb.Value_StringValue{StringValue: x}} + case nil: + return &structpb.Value{Kind: &structpb.Value_NullValue{}} + case map[string]interface{}: + return &structpb.Value{Kind: &structpb.Value_StructValue{StructValue: jsonMapToProtoStruct(x)}} + case []interface{}: + var vals []*structpb.Value + for _, e := range x { + vals = append(vals, jsonValueToStructValue(e)) + } + return &structpb.Value{Kind: &structpb.Value_ListValue{ListValue: &structpb.ListValue{Values: vals}}} + default: + panic(fmt.Sprintf("bad type %T for JSON value", v)) + } +} + +// LogSync logs the Entry synchronously without any buffering. Because LogSync is slow +// and will block, it is intended primarily for debugging or critical errors. +// Prefer Log for most uses. +// TODO(jba): come up with a better name (LogNow?) or eliminate. +func (l *Logger) LogSync(ctx context.Context, e Entry) error { + ent, err := l.toLogEntry(e) + if err != nil { + return err + } + _, err = l.client.client.WriteLogEntries(ctx, &logpb.WriteLogEntriesRequest{ + LogName: l.logName, + Resource: l.commonResource, + Labels: l.commonLabels, + Entries: []*logpb.LogEntry{ent}, + }) + return err +} + +// Log buffers the Entry for output to the logging service. It never blocks. +func (l *Logger) Log(e Entry) { + ent, err := l.toLogEntry(e) + if err != nil { + l.client.error(err) + return + } + if err := l.bundler.Add(ent, proto.Size(ent)); err != nil { + l.client.error(err) + } +} + +// Flush blocks until all currently buffered log entries are sent. +// +// If any errors occurred since the last call to Flush from any Logger, or the +// creation of the client if this is the first call, then Flush returns a non-nil +// error with summary information about the errors. This information is unlikely to +// be actionable. For more accurate error reporting, set Client.OnError. +func (l *Logger) Flush() error { + l.bundler.Flush() + return l.client.extractErrorInfo() +} + +func (l *Logger) writeLogEntries(entries []*logpb.LogEntry) { + req := &logpb.WriteLogEntriesRequest{ + LogName: l.logName, + Resource: l.commonResource, + Labels: l.commonLabels, + Entries: entries, + } + ctx, afterCall := l.ctxFunc() + ctx, cancel := context.WithTimeout(ctx, defaultWriteTimeout) + defer cancel() + _, err := l.client.client.WriteLogEntries(ctx, req) + if err != nil { + l.client.error(err) + } + if afterCall != nil { + afterCall() + } +} + +// StandardLogger returns a *log.Logger for the provided severity. +// +// This method is cheap. A single log.Logger is pre-allocated for each +// severity level in each Logger. Callers may mutate the returned log.Logger +// (for example by calling SetFlags or SetPrefix). +func (l *Logger) StandardLogger(s Severity) *log.Logger { return l.stdLoggers[s] } + +func (l *Logger) toLogEntry(e Entry) (*logpb.LogEntry, error) { + if e.LogName != "" { + return nil, errors.New("logging: Entry.LogName should be not be set when writing") + } + t := e.Timestamp + if t.IsZero() { + t = now() + } + ts, err := ptypes.TimestampProto(t) + if err != nil { + return nil, err + } + if e.Trace == "" && e.HTTPRequest != nil && e.HTTPRequest.Request != nil { + traceHeader := e.HTTPRequest.Request.Header.Get("X-Cloud-Trace-Context") + if traceHeader != "" { + // Set to a relative resource name, as described at + // https://cloud.google.com/appengine/docs/flexible/go/writing-application-logs. + e.Trace = fmt.Sprintf("%s/traces/%s", l.client.parent, traceHeader) + } + } + ent := &logpb.LogEntry{ + Timestamp: ts, + Severity: logtypepb.LogSeverity(e.Severity), + InsertId: e.InsertID, + HttpRequest: fromHTTPRequest(e.HTTPRequest), + Operation: e.Operation, + Labels: e.Labels, + Trace: e.Trace, + Resource: e.Resource, + SourceLocation: e.SourceLocation, + } + switch p := e.Payload.(type) { + case string: + ent.Payload = &logpb.LogEntry_TextPayload{TextPayload: p} + default: + s, err := toProtoStruct(p) + if err != nil { + return nil, err + } + ent.Payload = &logpb.LogEntry_JsonPayload{JsonPayload: s} + } + return ent, nil +} diff --git a/vendor/cloud.google.com/go/logging/logging_test.go b/vendor/cloud.google.com/go/logging/logging_test.go new file mode 100644 index 000000000..bea566b07 --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logging_test.go @@ -0,0 +1,631 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// TODO(jba): test that OnError is getting called appropriately. + +package logging_test + +import ( + "context" + "flag" + "fmt" + "log" + "math/rand" + "os" + "strings" + "sync" + "sync/atomic" + "testing" + "time" + + cinternal "cloud.google.com/go/internal" + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/internal/uid" + "cloud.google.com/go/logging" + ltesting "cloud.google.com/go/logging/internal/testing" + "cloud.google.com/go/logging/logadmin" + gax "github.com/googleapis/gax-go" + "golang.org/x/oauth2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + mrpb "google.golang.org/genproto/googleapis/api/monitoredres" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +const testLogIDPrefix = "GO-LOGGING-CLIENT/TEST-LOG" + +var ( + client *logging.Client + aclient *logadmin.Client + testProjectID string + testLogID string + testFilter string + errorc chan error + ctx context.Context + + // Adjust the fields of a FullEntry received from the production service + // before comparing it with the expected result. We can't correctly + // compare certain fields, like times or server-generated IDs. + clean func(*logging.Entry) + + // Create a new client with the given project ID. + newClients func(ctx context.Context, projectID string) (*logging.Client, *logadmin.Client) + + uids = uid.NewSpace(testLogIDPrefix, nil) + + // If true, this test is using the production service, not a fake. + integrationTest bool +) + +func testNow() time.Time { + return time.Unix(1000, 0) +} + +func TestMain(m *testing.M) { + flag.Parse() // needed for testing.Short() + ctx = context.Background() + testProjectID = testutil.ProjID() + errorc = make(chan error, 100) + if testProjectID == "" || testing.Short() { + integrationTest = false + if testProjectID != "" { + log.Print("Integration tests skipped in short mode (using fake instead)") + } + testProjectID = ltesting.ValidProjectID + clean = func(e *logging.Entry) { + // Remove the insert ID for consistency with the integration test. + e.InsertID = "" + } + + addr, err := ltesting.NewServer() + if err != nil { + log.Fatalf("creating fake server: %v", err) + } + logging.SetNow(testNow) + + newClients = func(ctx context.Context, parent string) (*logging.Client, *logadmin.Client) { + conn, err := grpc.Dial(addr, grpc.WithInsecure()) + if err != nil { + log.Fatalf("dialing %q: %v", addr, err) + } + c, err := logging.NewClient(ctx, parent, option.WithGRPCConn(conn)) + if err != nil { + log.Fatalf("creating client for fake at %q: %v", addr, err) + } + ac, err := logadmin.NewClient(ctx, parent, option.WithGRPCConn(conn)) + if err != nil { + log.Fatalf("creating client for fake at %q: %v", addr, err) + } + return c, ac + } + + } else { + integrationTest = true + clean = func(e *logging.Entry) { + // We cannot compare timestamps, so set them to the test time. + // Also, remove the insert ID added by the service. + e.Timestamp = testNow().UTC() + e.InsertID = "" + } + ts := testutil.TokenSource(ctx, logging.AdminScope) + if ts == nil { + log.Fatal("The project key must be set. See CONTRIBUTING.md for details") + } + log.Printf("running integration tests with project %s", testProjectID) + newClients = func(ctx context.Context, parent string) (*logging.Client, *logadmin.Client) { + c, err := logging.NewClient(ctx, parent, option.WithTokenSource(ts)) + if err != nil { + log.Fatalf("creating prod client: %v", err) + } + ac, err := logadmin.NewClient(ctx, parent, option.WithTokenSource(ts)) + if err != nil { + log.Fatalf("creating prod client: %v", err) + } + return c, ac + } + + } + client, aclient = newClients(ctx, testProjectID) + client.OnError = func(e error) { errorc <- e } + + exit := m.Run() + os.Exit(exit) +} + +func initLogs() { + testLogID = uids.New() + hourAgo := time.Now().Add(-1 * time.Hour).UTC() + testFilter = fmt.Sprintf(`logName = "projects/%s/logs/%s" AND +timestamp >= "%s"`, + testProjectID, strings.Replace(testLogID, "/", "%2F", -1), hourAgo.Format(time.RFC3339)) +} + +func TestLogSync(t *testing.T) { + // TODO(deklerk) Un-flake and re-enable + t.Skip("Inherently flaky") + + initLogs() // Generate new testLogID + ctx := context.Background() + lg := client.Logger(testLogID) + err := lg.LogSync(ctx, logging.Entry{Payload: "hello"}) + if err != nil { + t.Fatal(err) + } + err = lg.LogSync(ctx, logging.Entry{Payload: "goodbye"}) + if err != nil { + t.Fatal(err) + } + // Allow overriding the MonitoredResource. + err = lg.LogSync(ctx, logging.Entry{Payload: "mr", Resource: &mrpb.MonitoredResource{Type: "global"}}) + if err != nil { + t.Fatal(err) + } + + want := []*logging.Entry{ + entryForTesting("hello"), + entryForTesting("goodbye"), + entryForTesting("mr"), + } + var got []*logging.Entry + ok := waitFor(func() bool { + got, err = allTestLogEntries(ctx) + if err != nil { + t.Log("fetching log entries: ", err) + return false + } + return len(got) == len(want) + }) + if !ok { + t.Fatalf("timed out; got: %d, want: %d\n", len(got), len(want)) + } + if msg, ok := compareEntries(got, want); !ok { + t.Error(msg) + } +} + +func TestLogAndEntries(t *testing.T) { + // TODO(deklerk) Un-flake and re-enable + t.Skip("Inherently flaky") + + initLogs() // Generate new testLogID + ctx := context.Background() + payloads := []string{"p1", "p2", "p3", "p4", "p5"} + lg := client.Logger(testLogID) + for _, p := range payloads { + // Use the insert ID to guarantee iteration order. + lg.Log(logging.Entry{Payload: p, InsertID: p}) + } + if err := lg.Flush(); err != nil { + t.Fatal(err) + } + var want []*logging.Entry + for _, p := range payloads { + want = append(want, entryForTesting(p)) + } + var got []*logging.Entry + ok := waitFor(func() bool { + var err error + got, err = allTestLogEntries(ctx) + if err != nil { + t.Log("fetching log entries: ", err) + return false + } + return len(got) == len(want) + }) + if !ok { + t.Fatalf("timed out; got: %d, want: %d\n", len(got), len(want)) + } + if msg, ok := compareEntries(got, want); !ok { + t.Error(msg) + } +} + +func TestContextFunc(t *testing.T) { + initLogs() + var contextFuncCalls, cleanupCalls int32 //atomic + + lg := client.Logger(testLogID, logging.ContextFunc(func() (context.Context, func()) { + atomic.AddInt32(&contextFuncCalls, 1) + return context.Background(), func() { atomic.AddInt32(&cleanupCalls, 1) } + })) + lg.Log(logging.Entry{Payload: "p"}) + if err := lg.Flush(); err != nil { + t.Fatal(err) + } + got1 := atomic.LoadInt32(&contextFuncCalls) + got2 := atomic.LoadInt32(&cleanupCalls) + if got1 != 1 || got1 != got2 { + t.Errorf("got %d calls to context func, %d calls to cleanup func; want 1, 1", got1, got2) + } +} + +// compareEntries compares most fields list of Entries against expected. compareEntries does not compare: +// - HTTPRequest +// - Operation +// - Resource +// - SourceLocation +func compareEntries(got, want []*logging.Entry) (string, bool) { + if len(got) != len(want) { + return fmt.Sprintf("got %d entries, want %d", len(got), len(want)), false + } + for i := range got { + if !compareEntry(got[i], want[i]) { + return fmt.Sprintf("#%d:\ngot %+v\nwant %+v", i, got[i], want[i]), false + } + } + return "", true +} + +func compareEntry(got, want *logging.Entry) bool { + if got.Timestamp.Unix() != want.Timestamp.Unix() { + return false + } + + if got.Severity != want.Severity { + return false + } + + if !ltesting.PayloadEqual(got.Payload, want.Payload) { + return false + } + if !testutil.Equal(got.Labels, want.Labels) { + return false + } + + if got.InsertID != want.InsertID { + return false + } + + if got.LogName != want.LogName { + return false + } + + return true +} + +func entryForTesting(payload interface{}) *logging.Entry { + return &logging.Entry{ + Timestamp: testNow().UTC(), + Payload: payload, + LogName: "projects/" + testProjectID + "/logs/" + testLogID, + Resource: &mrpb.MonitoredResource{Type: "global", Labels: map[string]string{"project_id": testProjectID}}, + } +} + +func allTestLogEntries(ctx context.Context) ([]*logging.Entry, error) { + return allEntries(ctx, aclient, testFilter) +} + +func allEntries(ctx context.Context, aclient *logadmin.Client, filter string) ([]*logging.Entry, error) { + var es []*logging.Entry + it := aclient.Entries(ctx, logadmin.Filter(filter)) + for { + e, err := cleanNext(it) + switch err { + case nil: + es = append(es, e) + case iterator.Done: + return es, nil + default: + return nil, err + } + } +} + +func cleanNext(it *logadmin.EntryIterator) (*logging.Entry, error) { + e, err := it.Next() + if err != nil { + return nil, err + } + clean(e) + return e, nil +} + +func TestStandardLogger(t *testing.T) { + // TODO(deklerk) Un-flake and re-enable + t.Skip("Inherently flaky") + + initLogs() // Generate new testLogID + ctx := context.Background() + lg := client.Logger(testLogID) + slg := lg.StandardLogger(logging.Info) + + if slg != lg.StandardLogger(logging.Info) { + t.Error("There should be only one standard logger at each severity.") + } + if slg == lg.StandardLogger(logging.Debug) { + t.Error("There should be a different standard logger for each severity.") + } + + slg.Print("info") + if err := lg.Flush(); err != nil { + t.Fatal(err) + } + var got []*logging.Entry + ok := waitFor(func() bool { + var err error + got, err = allTestLogEntries(ctx) + if err != nil { + t.Log("fetching log entries: ", err) + return false + } + return len(got) == 1 + }) + if !ok { + t.Fatalf("timed out; got: %d, want: %d\n", len(got), 1) + } + if len(got) != 1 { + t.Fatalf("expected non-nil request with one entry; got:\n%+v", got) + } + if got, want := got[0].Payload.(string), "info\n"; got != want { + t.Errorf("payload: got %q, want %q", got, want) + } + if got, want := logging.Severity(got[0].Severity), logging.Info; got != want { + t.Errorf("severity: got %s, want %s", got, want) + } +} + +func TestSeverity(t *testing.T) { + if got, want := logging.Info.String(), "Info"; got != want { + t.Errorf("got %q, want %q", got, want) + } + if got, want := logging.Severity(-99).String(), "-99"; got != want { + t.Errorf("got %q, want %q", got, want) + } +} + +func TestParseSeverity(t *testing.T) { + for _, test := range []struct { + in string + want logging.Severity + }{ + {"", logging.Default}, + {"whatever", logging.Default}, + {"Default", logging.Default}, + {"ERROR", logging.Error}, + {"Error", logging.Error}, + {"error", logging.Error}, + } { + got := logging.ParseSeverity(test.in) + if got != test.want { + t.Errorf("%q: got %s, want %s\n", test.in, got, test.want) + } + } +} + +func TestErrors(t *testing.T) { + initLogs() // Generate new testLogID + // Drain errors already seen. +loop: + for { + select { + case <-errorc: + default: + break loop + } + } + // Try to log something that can't be JSON-marshalled. + lg := client.Logger(testLogID) + lg.Log(logging.Entry{Payload: func() {}}) + // Expect an error from Flush. + err := lg.Flush() + if err == nil { + t.Fatal("expected error, got nil") + } +} + +type badTokenSource struct{} + +func (badTokenSource) Token() (*oauth2.Token, error) { + return &oauth2.Token{}, nil +} + +func TestPing(t *testing.T) { + // Ping twice, in case the service's InsertID logic messes with the error code. + ctx := context.Background() + // The global client should be valid. + if err := client.Ping(ctx); err != nil { + t.Errorf("project %s: got %v, expected nil", testProjectID, err) + } + if err := client.Ping(ctx); err != nil { + t.Errorf("project %s, #2: got %v, expected nil", testProjectID, err) + } + // nonexistent project + c, a := newClients(ctx, testProjectID+"-BAD") + defer c.Close() + defer a.Close() + if err := c.Ping(ctx); err == nil { + t.Errorf("nonexistent project: want error pinging logging api, got nil") + } + if err := c.Ping(ctx); err == nil { + t.Errorf("nonexistent project, #2: want error pinging logging api, got nil") + } + + // Bad creds. We cannot test this with the fake, since it doesn't do auth. + if integrationTest { + c, err := logging.NewClient(ctx, testProjectID, option.WithTokenSource(badTokenSource{})) + if err != nil { + t.Fatal(err) + } + if err := c.Ping(ctx); err == nil { + t.Errorf("bad creds: want error pinging logging api, got nil") + } + if err := c.Ping(ctx); err == nil { + t.Errorf("bad creds, #2: want error pinging logging api, got nil") + } + if err := c.Close(); err != nil { + t.Fatalf("error closing client: %v", err) + } + } +} + +func TestLogsAndDelete(t *testing.T) { + // This function tests both the Logs and DeleteLog methods. We only try to + // delete those logs that we can observe and that were generated by this + // test. This may not include the logs generated from the current test run, + // because the logging service is only eventually consistent. It's + // therefore possible that on some runs, this test will do nothing. + ctx := context.Background() + it := aclient.Logs(ctx) + nDeleted := 0 + for { + logID, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + t.Fatal(err) + } + if strings.HasPrefix(logID, testLogIDPrefix) { + if err := aclient.DeleteLog(ctx, logID); err != nil { + // Ignore NotFound. Sometimes, amazingly, DeleteLog cannot find + // a log that is returned by Logs. + if status.Code(err) != codes.NotFound { + t.Fatalf("deleting %q: %v", logID, err) + } + } else { + nDeleted++ + } + } + } + t.Logf("deleted %d logs", nDeleted) +} + +func TestNonProjectParent(t *testing.T) { + ctx := context.Background() + initLogs() + parent := "organizations/" + ltesting.ValidOrgID + c, a := newClients(ctx, parent) + defer c.Close() + defer a.Close() + lg := c.Logger(testLogID) + err := lg.LogSync(ctx, logging.Entry{Payload: "hello"}) + if integrationTest { + // We don't have permission to log to the organization. + if got, want := status.Code(err), codes.PermissionDenied; got != want { + t.Errorf("got code %s, want %s", got, want) + } + return + } + // Continue test against fake. + if err != nil { + t.Fatal(err) + } + want := []*logging.Entry{{ + Timestamp: testNow().UTC(), + Payload: "hello", + LogName: parent + "/logs/" + testLogID, + Resource: &mrpb.MonitoredResource{ + Type: "organization", + Labels: map[string]string{"organization_id": ltesting.ValidOrgID}, + }, + }} + var got []*logging.Entry + ok := waitFor(func() bool { + got, err = allEntries(ctx, a, fmt.Sprintf(`logName = "%s/logs/%s"`, parent, + strings.Replace(testLogID, "/", "%2F", -1))) + if err != nil { + t.Log("fetching log entries: ", err) + return false + } + return len(got) == len(want) + }) + if !ok { + t.Fatalf("timed out; got: %d, want: %d\n", len(got), len(want)) + } + if msg, ok := compareEntries(got, want); !ok { + t.Error(msg) + } +} + +// waitFor calls f repeatedly with exponential backoff, blocking until it returns true. +// It returns false after a while (if it times out). +func waitFor(f func() bool) bool { + // TODO(shadams): Find a better way to deflake these tests. + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) + defer cancel() + err := cinternal.Retry(ctx, + gax.Backoff{Initial: time.Second, Multiplier: 2, Max: 30 * time.Second}, + func() (bool, error) { return f(), nil }) + return err == nil +} + +// Interleave a lot of Log and Flush calls, to induce race conditions. +// Run this test with: +// go test -run LogFlushRace -race -count 100 +func TestLogFlushRace(t *testing.T) { + initLogs() // Generate new testLogID + lg := client.Logger(testLogID, + logging.ConcurrentWriteLimit(5), // up to 5 concurrent log writes + logging.EntryCountThreshold(100)) // small bundle size to increase interleaving + var wgf, wgl sync.WaitGroup + donec := make(chan struct{}) + for i := 0; i < 10; i++ { + wgl.Add(1) + go func() { + defer wgl.Done() + for j := 0; j < 1e4; j++ { + lg.Log(logging.Entry{Payload: "the payload"}) + } + }() + } + for i := 0; i < 5; i++ { + wgf.Add(1) + go func() { + defer wgf.Done() + for { + select { + case <-donec: + return + case <-time.After(time.Duration(rand.Intn(5)) * time.Millisecond): + if err := lg.Flush(); err != nil { + t.Error(err) + } + } + } + }() + } + wgl.Wait() + close(donec) + wgf.Wait() +} + +// Test the throughput of concurrent writers. +func BenchmarkConcurrentWrites(b *testing.B) { + if !integrationTest { + b.Skip("only makes sense when running against production service") + } + for n := 1; n <= 32; n *= 2 { + b.Run(fmt.Sprint(n), func(b *testing.B) { + b.StopTimer() + lg := client.Logger(testLogID, logging.ConcurrentWriteLimit(n), logging.EntryCountThreshold(1000)) + const ( + nEntries = 1e5 + payload = "the quick brown fox jumps over the lazy dog" + ) + b.SetBytes(int64(nEntries * len(payload))) + b.StartTimer() + for i := 0; i < b.N; i++ { + for j := 0; j < nEntries; j++ { + lg.Log(logging.Entry{Payload: payload}) + } + if err := lg.Flush(); err != nil { + b.Fatal(err) + } + } + }) + } +} diff --git a/vendor/cloud.google.com/go/logging/logging_unexported_test.go b/vendor/cloud.google.com/go/logging/logging_unexported_test.go new file mode 100644 index 000000000..265e59dfc --- /dev/null +++ b/vendor/cloud.google.com/go/logging/logging_unexported_test.go @@ -0,0 +1,386 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Tests that require access to unexported names of the logging package. + +package logging + +import ( + "encoding/json" + "net/http" + "net/url" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/proto" + durpb "github.com/golang/protobuf/ptypes/duration" + structpb "github.com/golang/protobuf/ptypes/struct" + "google.golang.org/api/support/bundler" + mrpb "google.golang.org/genproto/googleapis/api/monitoredres" + logtypepb "google.golang.org/genproto/googleapis/logging/type" +) + +func TestLoggerCreation(t *testing.T) { + const logID = "testing" + c := &Client{parent: "projects/PROJECT_ID"} + customResource := &mrpb.MonitoredResource{ + Type: "global", + Labels: map[string]string{ + "project_id": "ANOTHER_PROJECT", + }, + } + defaultBundler := &bundler.Bundler{ + DelayThreshold: DefaultDelayThreshold, + BundleCountThreshold: DefaultEntryCountThreshold, + BundleByteThreshold: DefaultEntryByteThreshold, + BundleByteLimit: 0, + BufferedByteLimit: DefaultBufferedByteLimit, + } + for _, test := range []struct { + options []LoggerOption + wantLogger *Logger + defaultResource bool + wantBundler *bundler.Bundler + }{ + { + options: nil, + wantLogger: &Logger{}, + defaultResource: true, + wantBundler: defaultBundler, + }, + { + options: []LoggerOption{ + CommonResource(nil), + CommonLabels(map[string]string{"a": "1"}), + }, + wantLogger: &Logger{ + commonResource: nil, + commonLabels: map[string]string{"a": "1"}, + }, + wantBundler: defaultBundler, + }, + { + options: []LoggerOption{CommonResource(customResource)}, + wantLogger: &Logger{commonResource: customResource}, + wantBundler: defaultBundler, + }, + { + options: []LoggerOption{ + DelayThreshold(time.Minute), + EntryCountThreshold(99), + EntryByteThreshold(17), + EntryByteLimit(18), + BufferedByteLimit(19), + }, + wantLogger: &Logger{}, + defaultResource: true, + wantBundler: &bundler.Bundler{ + DelayThreshold: time.Minute, + BundleCountThreshold: 99, + BundleByteThreshold: 17, + BundleByteLimit: 18, + BufferedByteLimit: 19, + }, + }, + } { + gotLogger := c.Logger(logID, test.options...) + if got, want := gotLogger.commonResource, test.wantLogger.commonResource; !test.defaultResource && !proto.Equal(got, want) { + t.Errorf("%v: resource: got %v, want %v", test.options, got, want) + } + if got, want := gotLogger.commonLabels, test.wantLogger.commonLabels; !testutil.Equal(got, want) { + t.Errorf("%v: commonLabels: got %v, want %v", test.options, got, want) + } + if got, want := gotLogger.bundler.DelayThreshold, test.wantBundler.DelayThreshold; got != want { + t.Errorf("%v: DelayThreshold: got %v, want %v", test.options, got, want) + } + if got, want := gotLogger.bundler.BundleCountThreshold, test.wantBundler.BundleCountThreshold; got != want { + t.Errorf("%v: BundleCountThreshold: got %v, want %v", test.options, got, want) + } + if got, want := gotLogger.bundler.BundleByteThreshold, test.wantBundler.BundleByteThreshold; got != want { + t.Errorf("%v: BundleByteThreshold: got %v, want %v", test.options, got, want) + } + if got, want := gotLogger.bundler.BundleByteLimit, test.wantBundler.BundleByteLimit; got != want { + t.Errorf("%v: BundleByteLimit: got %v, want %v", test.options, got, want) + } + if got, want := gotLogger.bundler.BufferedByteLimit, test.wantBundler.BufferedByteLimit; got != want { + t.Errorf("%v: BufferedByteLimit: got %v, want %v", test.options, got, want) + } + } +} + +func TestToProtoStruct(t *testing.T) { + v := struct { + Foo string `json:"foo"` + Bar int `json:"bar,omitempty"` + Baz []float64 `json:"baz"` + Moo map[string]interface{} `json:"moo"` + }{ + Foo: "foovalue", + Baz: []float64{1.1}, + Moo: map[string]interface{}{ + "a": 1, + "b": "two", + "c": true, + }, + } + + got, err := toProtoStruct(v) + if err != nil { + t.Fatal(err) + } + want := &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "foo": {Kind: &structpb.Value_StringValue{StringValue: v.Foo}}, + "baz": {Kind: &structpb.Value_ListValue{ListValue: &structpb.ListValue{Values: []*structpb.Value{ + {Kind: &structpb.Value_NumberValue{NumberValue: 1.1}}, + }}}}, + "moo": {Kind: &structpb.Value_StructValue{ + StructValue: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "a": {Kind: &structpb.Value_NumberValue{NumberValue: 1}}, + "b": {Kind: &structpb.Value_StringValue{StringValue: "two"}}, + "c": {Kind: &structpb.Value_BoolValue{BoolValue: true}}, + }, + }, + }}, + }, + } + if !proto.Equal(got, want) { + t.Errorf("got %+v\nwant %+v", got, want) + } + + // Non-structs should fail to convert. + for v := range []interface{}{3, "foo", []int{1, 2, 3}} { + _, err := toProtoStruct(v) + if err == nil { + t.Errorf("%v: got nil, want error", v) + } + } + + // Test fast path. + got, err = toProtoStruct(want) + if err != nil { + t.Fatal(err) + } + if got != want { + t.Error("got and want should be identical, but are not") + } +} + +func TestToLogEntryPayload(t *testing.T) { + var logger Logger + for _, test := range []struct { + in interface{} + wantText string + wantStruct *structpb.Struct + }{ + { + in: "string", + wantText: "string", + }, + { + in: map[string]interface{}{"a": 1, "b": true}, + wantStruct: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "a": {Kind: &structpb.Value_NumberValue{NumberValue: 1}}, + "b": {Kind: &structpb.Value_BoolValue{BoolValue: true}}, + }, + }, + }, + { + in: json.RawMessage([]byte(`{"a": 1, "b": true}`)), + wantStruct: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "a": {Kind: &structpb.Value_NumberValue{NumberValue: 1}}, + "b": {Kind: &structpb.Value_BoolValue{BoolValue: true}}, + }, + }, + }, + } { + e, err := logger.toLogEntry(Entry{Payload: test.in}) + if err != nil { + t.Fatalf("%+v: %v", test.in, err) + } + if test.wantStruct != nil { + got := e.GetJsonPayload() + if !proto.Equal(got, test.wantStruct) { + t.Errorf("%+v: got %s, want %s", test.in, got, test.wantStruct) + } + } else { + got := e.GetTextPayload() + if got != test.wantText { + t.Errorf("%+v: got %s, want %s", test.in, got, test.wantText) + } + } + } +} + +func TestToLogEntryTrace(t *testing.T) { + logger := &Logger{client: &Client{parent: "projects/P"}} + // Verify that we get the trace from the HTTP request if it isn't + // provided by the caller. + u := &url.URL{Scheme: "http"} + for _, test := range []struct { + in Entry + want string + }{ + {Entry{}, ""}, + {Entry{Trace: "t1"}, "t1"}, + { + Entry{ + HTTPRequest: &HTTPRequest{ + Request: &http.Request{URL: u, Header: http.Header{"foo": {"bar"}}}, + }, + }, + "", + }, + { + Entry{ + HTTPRequest: &HTTPRequest{ + Request: &http.Request{ + URL: u, + Header: http.Header{"X-Cloud-Trace-Context": {"t2"}}, + }, + }, + }, + "projects/P/traces/t2", + }, + { + Entry{ + HTTPRequest: &HTTPRequest{ + Request: &http.Request{ + URL: u, + Header: http.Header{"X-Cloud-Trace-Context": {"t3"}}, + }, + }, + Trace: "t4", + }, + "t4", + }, + } { + e, err := logger.toLogEntry(test.in) + if err != nil { + t.Fatalf("%+v: %v", test.in, err) + } + if got := e.Trace; got != test.want { + t.Errorf("%+v: got %q, want %q", test.in, got, test.want) + } + } +} + +func TestFromHTTPRequest(t *testing.T) { + const testURL = "http:://example.com/path?q=1" + u, err := url.Parse(testURL) + if err != nil { + t.Fatal(err) + } + req := &HTTPRequest{ + Request: &http.Request{ + Method: "GET", + URL: u, + Header: map[string][]string{ + "User-Agent": {"user-agent"}, + "Referer": {"referer"}, + }, + }, + RequestSize: 100, + Status: 200, + ResponseSize: 25, + Latency: 100 * time.Second, + LocalIP: "127.0.0.1", + RemoteIP: "10.0.1.1", + CacheHit: true, + CacheValidatedWithOriginServer: true, + } + got := fromHTTPRequest(req) + want := &logtypepb.HttpRequest{ + RequestMethod: "GET", + RequestUrl: testURL, + RequestSize: 100, + Status: 200, + ResponseSize: 25, + Latency: &durpb.Duration{Seconds: 100}, + UserAgent: "user-agent", + ServerIp: "127.0.0.1", + RemoteIp: "10.0.1.1", + Referer: "referer", + CacheHit: true, + CacheValidatedWithOriginServer: true, + } + if !proto.Equal(got, want) { + t.Errorf("got %+v\nwant %+v", got, want) + } +} + +func TestMonitoredResource(t *testing.T) { + for _, test := range []struct { + parent string + want *mrpb.MonitoredResource + }{ + { + "projects/P", + &mrpb.MonitoredResource{ + Type: "project", + Labels: map[string]string{"project_id": "P"}, + }, + }, + + { + "folders/F", + &mrpb.MonitoredResource{ + Type: "folder", + Labels: map[string]string{"folder_id": "F"}, + }, + }, + { + "billingAccounts/B", + &mrpb.MonitoredResource{ + Type: "billing_account", + Labels: map[string]string{"account_id": "B"}, + }, + }, + { + "organizations/123", + &mrpb.MonitoredResource{ + Type: "organization", + Labels: map[string]string{"organization_id": "123"}, + }, + }, + { + "unknown/X", + &mrpb.MonitoredResource{ + Type: "global", + Labels: map[string]string{"project_id": "X"}, + }, + }, + { + "whatever", + &mrpb.MonitoredResource{ + Type: "global", + Labels: map[string]string{"project_id": "whatever"}, + }, + }, + } { + got := monitoredResource(test.parent) + if !testutil.Equal(got, test.want) { + t.Errorf("%q: got %+v, want %+v", test.parent, got, test.want) + } + } +} + +// Used by the tests in logging_test. +func SetNow(f func() time.Time) { + now = f +} diff --git a/vendor/cloud.google.com/go/longrunning/autogen/doc.go b/vendor/cloud.google.com/go/longrunning/autogen/doc.go new file mode 100644 index 000000000..c5849a9cf --- /dev/null +++ b/vendor/cloud.google.com/go/longrunning/autogen/doc.go @@ -0,0 +1,88 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package longrunning is an auto-generated package for the +// Google Long Running Operations API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// +// Use the client at cloud.google.com/go/longrunning in preference to this. +package longrunning // import "cloud.google.com/go/longrunning/autogen" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{} +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/longrunning/autogen/from_conn.go b/vendor/cloud.google.com/go/longrunning/autogen/from_conn.go new file mode 100644 index 000000000..9082b0a43 --- /dev/null +++ b/vendor/cloud.google.com/go/longrunning/autogen/from_conn.go @@ -0,0 +1,34 @@ +// Copyright 2017, 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 longrunning + +import ( + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" +) + +// InternalFromConn is for use by the google Cloud Libraries only. +// +// InternalFromConn creates OperationsClient from available connection. +func InternalFromConn(conn *grpc.ClientConn) *OperationsClient { + c := &OperationsClient{ + conn: conn, + CallOptions: defaultOperationsCallOptions(), + + operationsClient: longrunningpb.NewOperationsClient(conn), + } + c.SetGoogleClientInfo() + return c +} diff --git a/vendor/cloud.google.com/go/longrunning/autogen/mock_test.go b/vendor/cloud.google.com/go/longrunning/autogen/mock_test.go new file mode 100644 index 000000000..705048abd --- /dev/null +++ b/vendor/cloud.google.com/go/longrunning/autogen/mock_test.go @@ -0,0 +1,381 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package longrunning + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockOperationsServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + longrunningpb.OperationsServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockOperationsServer) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest) (*longrunningpb.ListOperationsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.ListOperationsResponse), nil +} + +func (s *mockOperationsServer) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockOperationsServer) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockOperationsServer) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockOperations mockOperationsServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + longrunningpb.RegisterOperationsServer(serv, &mockOperations) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestOperationsGetOperation(t *testing.T) { + var name2 string = "name2-1052831874" + var done bool = true + var expectedResponse = &longrunningpb.Operation{ + Name: name2, + Done: done, + } + + mockOperations.err = nil + mockOperations.reqs = nil + + mockOperations.resps = append(mockOperations.resps[:0], expectedResponse) + + var name string = "name3373707" + var request = &longrunningpb.GetOperationRequest{ + Name: name, + } + + c, err := NewOperationsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOperation(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOperations.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOperationsGetOperationError(t *testing.T) { + errCode := codes.PermissionDenied + mockOperations.err = gstatus.Error(errCode, "test error") + + var name string = "name3373707" + var request = &longrunningpb.GetOperationRequest{ + Name: name, + } + + c, err := NewOperationsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOperation(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestOperationsListOperations(t *testing.T) { + var nextPageToken string = "" + var operationsElement *longrunningpb.Operation = &longrunningpb.Operation{} + var operations = []*longrunningpb.Operation{operationsElement} + var expectedResponse = &longrunningpb.ListOperationsResponse{ + NextPageToken: nextPageToken, + Operations: operations, + } + + mockOperations.err = nil + mockOperations.reqs = nil + + mockOperations.resps = append(mockOperations.resps[:0], expectedResponse) + + var name string = "name3373707" + var filter string = "filter-1274492040" + var request = &longrunningpb.ListOperationsRequest{ + Name: name, + Filter: filter, + } + + c, err := NewOperationsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListOperations(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOperations.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Operations[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOperationsListOperationsError(t *testing.T) { + errCode := codes.PermissionDenied + mockOperations.err = gstatus.Error(errCode, "test error") + + var name string = "name3373707" + var filter string = "filter-1274492040" + var request = &longrunningpb.ListOperationsRequest{ + Name: name, + Filter: filter, + } + + c, err := NewOperationsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListOperations(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestOperationsCancelOperation(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockOperations.err = nil + mockOperations.reqs = nil + + mockOperations.resps = append(mockOperations.resps[:0], expectedResponse) + + var name string = "name3373707" + var request = &longrunningpb.CancelOperationRequest{ + Name: name, + } + + c, err := NewOperationsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.CancelOperation(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOperations.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestOperationsCancelOperationError(t *testing.T) { + errCode := codes.PermissionDenied + mockOperations.err = gstatus.Error(errCode, "test error") + + var name string = "name3373707" + var request = &longrunningpb.CancelOperationRequest{ + Name: name, + } + + c, err := NewOperationsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.CancelOperation(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestOperationsDeleteOperation(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockOperations.err = nil + mockOperations.reqs = nil + + mockOperations.resps = append(mockOperations.resps[:0], expectedResponse) + + var name string = "name3373707" + var request = &longrunningpb.DeleteOperationRequest{ + Name: name, + } + + c, err := NewOperationsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteOperation(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOperations.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestOperationsDeleteOperationError(t *testing.T) { + errCode := codes.PermissionDenied + mockOperations.err = gstatus.Error(errCode, "test error") + + var name string = "name3373707" + var request = &longrunningpb.DeleteOperationRequest{ + Name: name, + } + + c, err := NewOperationsClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteOperation(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} diff --git a/vendor/cloud.google.com/go/longrunning/autogen/operations_client.go b/vendor/cloud.google.com/go/longrunning/autogen/operations_client.go new file mode 100644 index 000000000..ebdf6f9f1 --- /dev/null +++ b/vendor/cloud.google.com/go/longrunning/autogen/operations_client.go @@ -0,0 +1,271 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package longrunning + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// OperationsCallOptions contains the retry settings for each method of OperationsClient. +type OperationsCallOptions struct { + GetOperation []gax.CallOption + ListOperations []gax.CallOption + CancelOperation []gax.CallOption + DeleteOperation []gax.CallOption +} + +func defaultOperationsClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("longrunning.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultOperationsCallOptions() *OperationsCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &OperationsCallOptions{ + GetOperation: retry[[2]string{"default", "idempotent"}], + ListOperations: retry[[2]string{"default", "idempotent"}], + CancelOperation: retry[[2]string{"default", "idempotent"}], + DeleteOperation: retry[[2]string{"default", "idempotent"}], + } +} + +// OperationsClient is a client for interacting with Google Long Running Operations API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type OperationsClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + operationsClient longrunningpb.OperationsClient + + // The call options for this service. + CallOptions *OperationsCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewOperationsClient creates a new operations client. +// +// Manages long-running operations with an API service. +// +// When an API method normally takes long time to complete, it can be designed +// to return [Operation][google.longrunning.Operation] to the client, and the client can use this +// interface to receive the real response asynchronously by polling the +// operation resource, or pass the operation resource to another API (such as +// Google Cloud Pub/Sub API) to receive the response. Any API service that +// returns long-running operations should implement the Operations interface +// so developers can have a consistent client experience. +func NewOperationsClient(ctx context.Context, opts ...option.ClientOption) (*OperationsClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultOperationsClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &OperationsClient{ + conn: conn, + CallOptions: defaultOperationsCallOptions(), + + operationsClient: longrunningpb.NewOperationsClient(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *OperationsClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *OperationsClient) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *OperationsClient) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// GetOperation gets the latest state of a long-running operation. Clients can use this +// method to poll the operation result at intervals as recommended by the API +// service. +func (c *OperationsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetOperation[0:len(c.CallOptions.GetOperation):len(c.CallOptions.GetOperation)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.operationsClient.GetOperation(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListOperations lists operations that match the specified filter in the request. If the +// server doesn't support this method, it returns UNIMPLEMENTED. +// +// NOTE: the name binding below allows API services to override the binding +// to use different resource name schemes, such as users/*/operations. +func (c *OperationsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListOperations[0:len(c.CallOptions.ListOperations):len(c.CallOptions.ListOperations)], opts...) + it := &OperationIterator{} + req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { + var resp *longrunningpb.ListOperationsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.operationsClient.ListOperations(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Operations, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// CancelOperation starts asynchronous cancellation on a long-running operation. The server +// makes a best effort to cancel the operation, but success is not +// guaranteed. If the server doesn't support this method, it returns +// google.rpc.Code.UNIMPLEMENTED. Clients can use +// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or +// other methods to check whether the cancellation succeeded or whether the +// operation completed despite cancellation. On successful cancellation, +// the operation is not deleted; instead, it becomes an operation with +// an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, +// corresponding to Code.CANCELLED. +func (c *OperationsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CancelOperation[0:len(c.CallOptions.CancelOperation):len(c.CallOptions.CancelOperation)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.operationsClient.CancelOperation(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// DeleteOperation deletes a long-running operation. This method indicates that the client is +// no longer interested in the operation result. It does not cancel the +// operation. If the server doesn't support this method, it returns +// google.rpc.Code.UNIMPLEMENTED. +func (c *OperationsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteOperation[0:len(c.CallOptions.DeleteOperation):len(c.CallOptions.DeleteOperation)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.operationsClient.DeleteOperation(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// OperationIterator manages a stream of *longrunningpb.Operation. +type OperationIterator struct { + items []*longrunningpb.Operation + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *OperationIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *OperationIterator) Next() (*longrunningpb.Operation, error) { + var item *longrunningpb.Operation + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *OperationIterator) bufLen() int { + return len(it.items) +} + +func (it *OperationIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/longrunning/autogen/operations_client_example_test.go b/vendor/cloud.google.com/go/longrunning/autogen/operations_client_example_test.go new file mode 100644 index 000000000..a080e5579 --- /dev/null +++ b/vendor/cloud.google.com/go/longrunning/autogen/operations_client_example_test.go @@ -0,0 +1,109 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package longrunning_test + +import ( + "context" + + longrunning "cloud.google.com/go/longrunning/autogen" + "google.golang.org/api/iterator" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +func ExampleNewOperationsClient() { + ctx := context.Background() + c, err := longrunning.NewOperationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleOperationsClient_GetOperation() { + ctx := context.Background() + c, err := longrunning.NewOperationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &longrunningpb.GetOperationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetOperation(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleOperationsClient_ListOperations() { + ctx := context.Background() + c, err := longrunning.NewOperationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &longrunningpb.ListOperationsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListOperations(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleOperationsClient_CancelOperation() { + ctx := context.Background() + c, err := longrunning.NewOperationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &longrunningpb.CancelOperationRequest{ + // TODO: Fill request struct fields. + } + err = c.CancelOperation(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleOperationsClient_DeleteOperation() { + ctx := context.Background() + c, err := longrunning.NewOperationsClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &longrunningpb.DeleteOperationRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteOperation(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/longrunning/example_test.go b/vendor/cloud.google.com/go/longrunning/example_test.go new file mode 100644 index 000000000..c88c2e8c3 --- /dev/null +++ b/vendor/cloud.google.com/go/longrunning/example_test.go @@ -0,0 +1,116 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package longrunning + +import ( + "context" + "fmt" + "time" + + "github.com/golang/protobuf/ptypes" + "github.com/golang/protobuf/ptypes/duration" + "github.com/golang/protobuf/ptypes/timestamp" + pb "google.golang.org/genproto/googleapis/longrunning" +) + +func bestMomentInHistory() (*Operation, error) { + t, err := time.Parse("2006-01-02 15:04:05.999999999 -0700 MST", "2009-11-10 23:00:00 +0000 UTC") + if err != nil { + return nil, err + } + resp, err := ptypes.TimestampProto(t) + if err != nil { + return nil, err + } + respAny, err := ptypes.MarshalAny(resp) + if err != nil { + return nil, err + } + metaAny, err := ptypes.MarshalAny(ptypes.DurationProto(1 * time.Hour)) + return &Operation{ + proto: &pb.Operation{ + Name: "best-moment", + Done: true, + Metadata: metaAny, + Result: &pb.Operation_Response{ + Response: respAny, + }, + }, + }, err +} + +func ExampleOperation_Wait() { + // Complex computation, might take a long time. + op, err := bestMomentInHistory() + if err != nil { + // TODO: Handle err. + } + var ts timestamp.Timestamp + err = op.Wait(context.TODO(), &ts) + if err != nil && !op.Done() { + fmt.Println("failed to fetch operation status", err) + } else if err != nil && op.Done() { + fmt.Println("operation completed with error", err) + } else { + fmt.Println(ptypes.TimestampString(&ts)) + } + // Output: + // 2009-11-10T23:00:00Z +} + +func ExampleOperation_Metadata() { + op, err := bestMomentInHistory() + if err != nil { + // TODO: Handle err. + } + + // The operation might contain metadata. + // In this example, the metadata contains the estimated length of time + // the operation might take to complete. + var meta duration.Duration + if err := op.Metadata(&meta); err != nil { + // TODO: Handle err. + } + d, err := ptypes.Duration(&meta) + if err == ErrNoMetadata { + fmt.Println("no metadata") + } else if err != nil { + // TODO: Handle err. + } else { + fmt.Println(d) + } + // Output: + // 1h0m0s +} + +func ExampleOperation_Cancel() { + op, err := bestMomentInHistory() + if err != nil { + // TODO: Handle err. + } + if err := op.Cancel(context.Background()); err != nil { + // TODO: Handle err. + } +} + +func ExampleOperation_Delete() { + op, err := bestMomentInHistory() + if err != nil { + // TODO: Handle err. + } + if err := op.Delete(context.Background()); err != nil { + // TODO: Handle err. + } +} diff --git a/vendor/cloud.google.com/go/longrunning/longrunning.go b/vendor/cloud.google.com/go/longrunning/longrunning.go new file mode 100644 index 000000000..639482afc --- /dev/null +++ b/vendor/cloud.google.com/go/longrunning/longrunning.go @@ -0,0 +1,179 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package longrunning supports Long Running Operations for the Google Cloud Libraries. +// See google.golang.org/genproto/googleapis/longrunning for its service definition. +// +// Users of the Google Cloud Libraries will typically not use this package directly. +// Instead they will call functions returning Operations and call their methods. +// +// This package is still experimental and subject to change. +package longrunning // import "cloud.google.com/go/longrunning" + +import ( + "context" + "errors" + "fmt" + "time" + + autogen "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// ErrNoMetadata is the error returned by Metadata if the operation contains no metadata. +var ErrNoMetadata = errors.New("operation contains no metadata") + +// Operation represents the result of an API call that may not be ready yet. +type Operation struct { + c operationsClient + proto *pb.Operation +} + +type operationsClient interface { + GetOperation(context.Context, *pb.GetOperationRequest, ...gax.CallOption) (*pb.Operation, error) + CancelOperation(context.Context, *pb.CancelOperationRequest, ...gax.CallOption) error + DeleteOperation(context.Context, *pb.DeleteOperationRequest, ...gax.CallOption) error +} + +// InternalNewOperation is for use by the google Cloud Libraries only. +// +// InternalNewOperation returns an long-running operation, abstracting the raw pb.Operation. +// The conn parameter refers to a server that proto was received from. +func InternalNewOperation(inner *autogen.OperationsClient, proto *pb.Operation) *Operation { + return &Operation{ + c: inner, + proto: proto, + } +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service +// from which the operation is created. +func (op *Operation) Name() string { + return op.proto.Name +} + +// Done reports whether the long-running operation has completed. +func (op *Operation) Done() bool { + return op.proto.Done +} + +// Metadata unmarshals op's metadata into meta. +// If op does not contain any metadata, Metadata returns ErrNoMetadata and meta is unmodified. +func (op *Operation) Metadata(meta proto.Message) error { + if m := op.proto.Metadata; m != nil { + return ptypes.UnmarshalAny(m, meta) + } + return ErrNoMetadata +} + +// Poll fetches the latest state of a long-running operation. +// +// If Poll fails, the error is returned and op is unmodified. +// If Poll succeeds and the operation has completed with failure, +// the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true; if resp != nil, the response of the operation +// is stored in resp. +func (op *Operation) Poll(ctx context.Context, resp proto.Message, opts ...gax.CallOption) error { + if !op.Done() { + p, err := op.c.GetOperation(ctx, &pb.GetOperationRequest{Name: op.Name()}, opts...) + if err != nil { + return err + } + op.proto = p + } + if !op.Done() { + return nil + } + + switch r := op.proto.Result.(type) { + case *pb.Operation_Error: + // TODO (pongad): r.Details may contain further information + return status.Errorf(codes.Code(r.Error.Code), "%s", r.Error.Message) + case *pb.Operation_Response: + if resp == nil { + return nil + } + return ptypes.UnmarshalAny(r.Response, resp) + default: + return fmt.Errorf("unsupported result type %[1]T: %[1]v", r) + } +} + +// DefaultWaitInterval is the polling interval used by Operation.Wait. +const DefaultWaitInterval = 60 * time.Second + +// Wait is equivalent to WaitWithInterval using DefaultWaitInterval. +func (op *Operation) Wait(ctx context.Context, resp proto.Message, opts ...gax.CallOption) error { + return op.WaitWithInterval(ctx, resp, DefaultWaitInterval, opts...) +} + +// WaitWithInterval blocks until the operation is completed. +// If resp != nil, Wait stores the response in resp. +// WaitWithInterval polls every interval, except initially +// when it polls using exponential backoff. +// +// See documentation of Poll for error-handling information. +func (op *Operation) WaitWithInterval(ctx context.Context, resp proto.Message, interval time.Duration, opts ...gax.CallOption) error { + bo := gax.Backoff{ + Initial: 1 * time.Second, + Max: interval, + } + if bo.Max < bo.Initial { + bo.Max = bo.Initial + } + return op.wait(ctx, resp, &bo, gax.Sleep, opts...) +} + +type sleeper func(context.Context, time.Duration) error + +// wait implements Wait, taking exponentialBackoff and sleeper arguments for testing. +func (op *Operation) wait(ctx context.Context, resp proto.Message, bo *gax.Backoff, sl sleeper, opts ...gax.CallOption) error { + for { + if err := op.Poll(ctx, resp, opts...); err != nil { + return err + } + if op.Done() { + return nil + } + if err := sl(ctx, bo.Pause()); err != nil { + return err + } + } +} + +// Cancel starts asynchronous cancellation on a long-running operation. The server +// makes a best effort to cancel the operation, but success is not +// guaranteed. If the server doesn't support this method, it returns +// grpc.Code(error) == codes.Unimplemented. Clients can use +// Poll or other methods to check whether the cancellation succeeded or whether the +// operation completed despite cancellation. On successful cancellation, +// the operation is not deleted; instead, op.Poll returns an error +// with code Canceled. +func (op *Operation) Cancel(ctx context.Context, opts ...gax.CallOption) error { + return op.c.CancelOperation(ctx, &pb.CancelOperationRequest{Name: op.Name()}, opts...) +} + +// Delete deletes a long-running operation. This method indicates that the client is +// no longer interested in the operation result. It does not cancel the +// operation. If the server doesn't support this method, grpc.Code(error) == codes.Unimplemented. +func (op *Operation) Delete(ctx context.Context, opts ...gax.CallOption) error { + return op.c.DeleteOperation(ctx, &pb.DeleteOperationRequest{Name: op.Name()}, opts...) +} diff --git a/vendor/cloud.google.com/go/longrunning/longrunning_test.go b/vendor/cloud.google.com/go/longrunning/longrunning_test.go new file mode 100644 index 000000000..7c07dd5c2 --- /dev/null +++ b/vendor/cloud.google.com/go/longrunning/longrunning_test.go @@ -0,0 +1,213 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package lro supports Long Running Operations for the Google Cloud Libraries. +// +// This package is still experimental and subject to change. +package longrunning + +import ( + "context" + "errors" + "testing" + "time" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "github.com/golang/protobuf/ptypes/duration" + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/longrunning" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +type getterService struct { + operationsClient + + // clock represents the fake current time of the service. + // It is the running sum of the of the duration we have slept. + clock time.Duration + + // getTimes records the times at which GetOperation is called. + getTimes []time.Duration + + // results are the fake results that GetOperation should return. + results []*pb.Operation +} + +func (s *getterService) GetOperation(context.Context, *pb.GetOperationRequest, ...gax.CallOption) (*pb.Operation, error) { + i := len(s.getTimes) + s.getTimes = append(s.getTimes, s.clock) + if i >= len(s.results) { + return nil, errors.New("unexpected call") + } + return s.results[i], nil +} + +func (s *getterService) sleeper() sleeper { + return func(_ context.Context, d time.Duration) error { + s.clock += d + return nil + } +} + +func TestWait(t *testing.T) { + responseDur := ptypes.DurationProto(42 * time.Second) + responseAny, err := ptypes.MarshalAny(responseDur) + if err != nil { + t.Fatal(err) + } + + s := &getterService{ + results: []*pb.Operation{ + {Name: "foo"}, + {Name: "foo"}, + {Name: "foo"}, + {Name: "foo"}, + {Name: "foo"}, + { + Name: "foo", + Done: true, + Result: &pb.Operation_Response{ + Response: responseAny, + }, + }, + }, + } + op := &Operation{ + c: s, + proto: &pb.Operation{Name: "foo"}, + } + if op.Done() { + t.Fatal("operation should not have completed yet") + } + + var resp duration.Duration + bo := gax.Backoff{ + Initial: 1 * time.Second, + Max: 3 * time.Second, + } + if err := op.wait(context.Background(), &resp, &bo, s.sleeper()); err != nil { + t.Fatal(err) + } + if !proto.Equal(&resp, responseDur) { + t.Errorf("response, got %v, want %v", resp, responseDur) + } + if !op.Done() { + t.Errorf("operation should have completed") + } + + maxWait := []time.Duration{ + 1 * time.Second, + 2 * time.Second, + 3 * time.Second, + 3 * time.Second, + 3 * time.Second, + } + for i := 0; i < len(s.getTimes)-1; i++ { + w := s.getTimes[i+1] - s.getTimes[i] + if mw := maxWait[i]; w > mw { + t.Errorf("backoff, waited %s, max %s", w, mw) + } + } +} + +func TestPollRequestError(t *testing.T) { + const opName = "foo" + + // All calls error. + s := &getterService{} + op := &Operation{ + c: s, + proto: &pb.Operation{Name: opName}, + } + if err := op.Poll(context.Background(), nil); err == nil { + t.Fatalf("Poll should error") + } + if n := op.Name(); n != opName { + t.Errorf("operation name, got %q, want %q", n, opName) + } + if op.Done() { + t.Errorf("operation should not have completed; we failed to fetch state") + } +} + +func TestPollErrorResult(t *testing.T) { + const ( + errCode = codes.NotFound + errMsg = "my error" + ) + op := &Operation{ + proto: &pb.Operation{ + Name: "foo", + Done: true, + Result: &pb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: errMsg, + }, + }, + }, + } + err := op.Poll(context.Background(), nil) + if got := grpc.Code(err); got != errCode { + t.Errorf("error code, want %s, got %s", errCode, got) + } + if got := grpc.ErrorDesc(err); got != errMsg { + t.Errorf("error code, want %s, got %s", errMsg, got) + } + if !op.Done() { + t.Errorf("operation should have completed") + } +} + +type errService struct { + operationsClient + errCancel, errDelete error +} + +func (s *errService) CancelOperation(context.Context, *pb.CancelOperationRequest, ...gax.CallOption) error { + return s.errCancel +} + +func (s *errService) DeleteOperation(context.Context, *pb.DeleteOperationRequest, ...gax.CallOption) error { + return s.errDelete +} + +func TestCancelReturnsError(t *testing.T) { + s := &errService{ + errCancel: errors.New("cancel error"), + } + op := &Operation{ + c: s, + proto: &pb.Operation{Name: "foo"}, + } + if got, want := op.Cancel(context.Background()), s.errCancel; got != want { + t.Errorf("cancel, got error %s, want %s", got, want) + } +} + +func TestDeleteReturnsError(t *testing.T) { + s := &errService{ + errDelete: errors.New("delete error"), + } + op := &Operation{ + c: s, + proto: &pb.Operation{Name: "foo"}, + } + if got, want := op.Delete(context.Background()), s.errDelete; got != want { + t.Errorf("cancel, got error %s, want %s", got, want) + } +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/ListMonitoredResourceDescriptors_smoke_test.go b/vendor/cloud.google.com/go/monitoring/apiv3/ListMonitoredResourceDescriptors_smoke_test.go new file mode 100644 index 000000000..7a8e1b4d2 --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/ListMonitoredResourceDescriptors_smoke_test.go @@ -0,0 +1,67 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring + +import ( + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestMetricServiceSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewMetricClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var formattedName string = fmt.Sprintf("projects/%s", projectId) + var request = &monitoringpb.ListMonitoredResourceDescriptorsRequest{ + Name: formattedName, + } + + iter := c.ListMonitoredResourceDescriptors(ctx, request) + if _, err := iter.Next(); err != nil && err != iterator.Done { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/alert_policy_client.go b/vendor/cloud.google.com/go/monitoring/apiv3/alert_policy_client.go new file mode 100644 index 000000000..e3338793b --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/alert_policy_client.go @@ -0,0 +1,278 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// AlertPolicyCallOptions contains the retry settings for each method of AlertPolicyClient. +type AlertPolicyCallOptions struct { + ListAlertPolicies []gax.CallOption + GetAlertPolicy []gax.CallOption + CreateAlertPolicy []gax.CallOption + DeleteAlertPolicy []gax.CallOption + UpdateAlertPolicy []gax.CallOption +} + +func defaultAlertPolicyClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("monitoring.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultAlertPolicyCallOptions() *AlertPolicyCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &AlertPolicyCallOptions{ + ListAlertPolicies: retry[[2]string{"default", "idempotent"}], + GetAlertPolicy: retry[[2]string{"default", "idempotent"}], + CreateAlertPolicy: retry[[2]string{"default", "non_idempotent"}], + DeleteAlertPolicy: retry[[2]string{"default", "idempotent"}], + UpdateAlertPolicy: retry[[2]string{"default", "non_idempotent"}], + } +} + +// AlertPolicyClient is a client for interacting with Stackdriver Monitoring API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type AlertPolicyClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + alertPolicyClient monitoringpb.AlertPolicyServiceClient + + // The call options for this service. + CallOptions *AlertPolicyCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewAlertPolicyClient creates a new alert policy service client. +// +// The AlertPolicyService API is used to manage (list, create, delete, +// edit) alert policies in Stackdriver Monitoring. An alerting policy is +// a description of the conditions under which some aspect of your +// system is considered to be "unhealthy" and the ways to notify +// people or services about this state. In addition to using this API, alert +// policies can also be managed through +// Stackdriver Monitoring (at https://cloud.google.com/monitoring/docs/), +// which can be reached by clicking the "Monitoring" tab in +// Cloud Console (at https://console.cloud.google.com/). +func NewAlertPolicyClient(ctx context.Context, opts ...option.ClientOption) (*AlertPolicyClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultAlertPolicyClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &AlertPolicyClient{ + conn: conn, + CallOptions: defaultAlertPolicyCallOptions(), + + alertPolicyClient: monitoringpb.NewAlertPolicyServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *AlertPolicyClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *AlertPolicyClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *AlertPolicyClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListAlertPolicies lists the existing alerting policies for the project. +func (c *AlertPolicyClient) ListAlertPolicies(ctx context.Context, req *monitoringpb.ListAlertPoliciesRequest, opts ...gax.CallOption) *AlertPolicyIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListAlertPolicies[0:len(c.CallOptions.ListAlertPolicies):len(c.CallOptions.ListAlertPolicies)], opts...) + it := &AlertPolicyIterator{} + req = proto.Clone(req).(*monitoringpb.ListAlertPoliciesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.AlertPolicy, string, error) { + var resp *monitoringpb.ListAlertPoliciesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.alertPolicyClient.ListAlertPolicies(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.AlertPolicies, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetAlertPolicy gets a single alerting policy. +func (c *AlertPolicyClient) GetAlertPolicy(ctx context.Context, req *monitoringpb.GetAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetAlertPolicy[0:len(c.CallOptions.GetAlertPolicy):len(c.CallOptions.GetAlertPolicy)], opts...) + var resp *monitoringpb.AlertPolicy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.alertPolicyClient.GetAlertPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateAlertPolicy creates a new alerting policy. +func (c *AlertPolicyClient) CreateAlertPolicy(ctx context.Context, req *monitoringpb.CreateAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateAlertPolicy[0:len(c.CallOptions.CreateAlertPolicy):len(c.CallOptions.CreateAlertPolicy)], opts...) + var resp *monitoringpb.AlertPolicy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.alertPolicyClient.CreateAlertPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteAlertPolicy deletes an alerting policy. +func (c *AlertPolicyClient) DeleteAlertPolicy(ctx context.Context, req *monitoringpb.DeleteAlertPolicyRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteAlertPolicy[0:len(c.CallOptions.DeleteAlertPolicy):len(c.CallOptions.DeleteAlertPolicy)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.alertPolicyClient.DeleteAlertPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// UpdateAlertPolicy updates an alerting policy. You can either replace the entire policy with +// a new one or replace only certain fields in the current alerting policy by +// specifying the fields to be updated via updateMask. Returns the +// updated alerting policy. +func (c *AlertPolicyClient) UpdateAlertPolicy(ctx context.Context, req *monitoringpb.UpdateAlertPolicyRequest, opts ...gax.CallOption) (*monitoringpb.AlertPolicy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateAlertPolicy[0:len(c.CallOptions.UpdateAlertPolicy):len(c.CallOptions.UpdateAlertPolicy)], opts...) + var resp *monitoringpb.AlertPolicy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.alertPolicyClient.UpdateAlertPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AlertPolicyIterator manages a stream of *monitoringpb.AlertPolicy. +type AlertPolicyIterator struct { + items []*monitoringpb.AlertPolicy + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoringpb.AlertPolicy, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *AlertPolicyIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *AlertPolicyIterator) Next() (*monitoringpb.AlertPolicy, error) { + var item *monitoringpb.AlertPolicy + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *AlertPolicyIterator) bufLen() int { + return len(it.items) +} + +func (it *AlertPolicyIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/alert_policy_client_example_test.go b/vendor/cloud.google.com/go/monitoring/apiv3/alert_policy_client_example_test.go new file mode 100644 index 000000000..90c1420b8 --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/alert_policy_client_example_test.go @@ -0,0 +1,129 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring_test + +import ( + "context" + + monitoring "cloud.google.com/go/monitoring/apiv3" + "google.golang.org/api/iterator" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" +) + +func ExampleNewAlertPolicyClient() { + ctx := context.Background() + c, err := monitoring.NewAlertPolicyClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleAlertPolicyClient_ListAlertPolicies() { + ctx := context.Background() + c, err := monitoring.NewAlertPolicyClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListAlertPoliciesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListAlertPolicies(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleAlertPolicyClient_GetAlertPolicy() { + ctx := context.Background() + c, err := monitoring.NewAlertPolicyClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.GetAlertPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetAlertPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAlertPolicyClient_CreateAlertPolicy() { + ctx := context.Background() + c, err := monitoring.NewAlertPolicyClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.CreateAlertPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateAlertPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleAlertPolicyClient_DeleteAlertPolicy() { + ctx := context.Background() + c, err := monitoring.NewAlertPolicyClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.DeleteAlertPolicyRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteAlertPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleAlertPolicyClient_UpdateAlertPolicy() { + ctx := context.Background() + c, err := monitoring.NewAlertPolicyClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.UpdateAlertPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateAlertPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/doc.go b/vendor/cloud.google.com/go/monitoring/apiv3/doc.go new file mode 100644 index 000000000..eb9ef7f53 --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/doc.go @@ -0,0 +1,94 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package monitoring is an auto-generated package for the +// Stackdriver Monitoring API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Manages your Stackdriver Monitoring data and configurations. Most projects +// must be associated with a Stackdriver account, with a few exceptions as +// noted on the individual method pages. +package monitoring // import "cloud.google.com/go/monitoring/apiv3" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.read", + "https://www.googleapis.com/auth/monitoring.write", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/group_client.go b/vendor/cloud.google.com/go/monitoring/apiv3/group_client.go new file mode 100644 index 000000000..2e37d23ad --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/group_client.go @@ -0,0 +1,361 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// GroupCallOptions contains the retry settings for each method of GroupClient. +type GroupCallOptions struct { + ListGroups []gax.CallOption + GetGroup []gax.CallOption + CreateGroup []gax.CallOption + UpdateGroup []gax.CallOption + DeleteGroup []gax.CallOption + ListGroupMembers []gax.CallOption +} + +func defaultGroupClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("monitoring.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultGroupCallOptions() *GroupCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &GroupCallOptions{ + ListGroups: retry[[2]string{"default", "idempotent"}], + GetGroup: retry[[2]string{"default", "idempotent"}], + CreateGroup: retry[[2]string{"default", "non_idempotent"}], + UpdateGroup: retry[[2]string{"default", "idempotent"}], + DeleteGroup: retry[[2]string{"default", "idempotent"}], + ListGroupMembers: retry[[2]string{"default", "idempotent"}], + } +} + +// GroupClient is a client for interacting with Stackdriver Monitoring API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type GroupClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + groupClient monitoringpb.GroupServiceClient + + // The call options for this service. + CallOptions *GroupCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewGroupClient creates a new group service client. +// +// The Group API lets you inspect and manage your +// groups (at #google.monitoring.v3.Group). +// +// A group is a named filter that is used to identify +// a collection of monitored resources. Groups are typically used to +// mirror the physical and/or logical topology of the environment. +// Because group membership is computed dynamically, monitored +// resources that are started in the future are automatically placed +// in matching groups. By using a group to name monitored resources in, +// for example, an alert policy, the target of that alert policy is +// updated automatically as monitored resources are added and removed +// from the infrastructure. +func NewGroupClient(ctx context.Context, opts ...option.ClientOption) (*GroupClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultGroupClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &GroupClient{ + conn: conn, + CallOptions: defaultGroupCallOptions(), + + groupClient: monitoringpb.NewGroupServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *GroupClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *GroupClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *GroupClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListGroups lists the existing groups. +func (c *GroupClient) ListGroups(ctx context.Context, req *monitoringpb.ListGroupsRequest, opts ...gax.CallOption) *GroupIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListGroups[0:len(c.CallOptions.ListGroups):len(c.CallOptions.ListGroups)], opts...) + it := &GroupIterator{} + req = proto.Clone(req).(*monitoringpb.ListGroupsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.Group, string, error) { + var resp *monitoringpb.ListGroupsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.groupClient.ListGroups(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Group, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetGroup gets a single group. +func (c *GroupClient) GetGroup(ctx context.Context, req *monitoringpb.GetGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetGroup[0:len(c.CallOptions.GetGroup):len(c.CallOptions.GetGroup)], opts...) + var resp *monitoringpb.Group + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.groupClient.GetGroup(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateGroup creates a new group. +func (c *GroupClient) CreateGroup(ctx context.Context, req *monitoringpb.CreateGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateGroup[0:len(c.CallOptions.CreateGroup):len(c.CallOptions.CreateGroup)], opts...) + var resp *monitoringpb.Group + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.groupClient.CreateGroup(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateGroup updates an existing group. +// You can change any group attributes except name. +func (c *GroupClient) UpdateGroup(ctx context.Context, req *monitoringpb.UpdateGroupRequest, opts ...gax.CallOption) (*monitoringpb.Group, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateGroup[0:len(c.CallOptions.UpdateGroup):len(c.CallOptions.UpdateGroup)], opts...) + var resp *monitoringpb.Group + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.groupClient.UpdateGroup(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteGroup deletes an existing group. +func (c *GroupClient) DeleteGroup(ctx context.Context, req *monitoringpb.DeleteGroupRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteGroup[0:len(c.CallOptions.DeleteGroup):len(c.CallOptions.DeleteGroup)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.groupClient.DeleteGroup(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListGroupMembers lists the monitored resources that are members of a group. +func (c *GroupClient) ListGroupMembers(ctx context.Context, req *monitoringpb.ListGroupMembersRequest, opts ...gax.CallOption) *MonitoredResourceIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListGroupMembers[0:len(c.CallOptions.ListGroupMembers):len(c.CallOptions.ListGroupMembers)], opts...) + it := &MonitoredResourceIterator{} + req = proto.Clone(req).(*monitoringpb.ListGroupMembersRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoredrespb.MonitoredResource, string, error) { + var resp *monitoringpb.ListGroupMembersResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.groupClient.ListGroupMembers(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Members, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GroupIterator manages a stream of *monitoringpb.Group. +type GroupIterator struct { + items []*monitoringpb.Group + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoringpb.Group, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *GroupIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *GroupIterator) Next() (*monitoringpb.Group, error) { + var item *monitoringpb.Group + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *GroupIterator) bufLen() int { + return len(it.items) +} + +func (it *GroupIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// MonitoredResourceIterator manages a stream of *monitoredrespb.MonitoredResource. +type MonitoredResourceIterator struct { + items []*monitoredrespb.MonitoredResource + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoredrespb.MonitoredResource, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *MonitoredResourceIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *MonitoredResourceIterator) Next() (*monitoredrespb.MonitoredResource, error) { + var item *monitoredrespb.MonitoredResource + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *MonitoredResourceIterator) bufLen() int { + return len(it.items) +} + +func (it *MonitoredResourceIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/group_client_example_test.go b/vendor/cloud.google.com/go/monitoring/apiv3/group_client_example_test.go new file mode 100644 index 000000000..7667acd6b --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/group_client_example_test.go @@ -0,0 +1,153 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring_test + +import ( + "context" + + monitoring "cloud.google.com/go/monitoring/apiv3" + "google.golang.org/api/iterator" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" +) + +func ExampleNewGroupClient() { + ctx := context.Background() + c, err := monitoring.NewGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleGroupClient_ListGroups() { + ctx := context.Background() + c, err := monitoring.NewGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListGroupsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListGroups(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleGroupClient_GetGroup() { + ctx := context.Background() + c, err := monitoring.NewGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.GetGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetGroup(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGroupClient_CreateGroup() { + ctx := context.Background() + c, err := monitoring.NewGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.CreateGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateGroup(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGroupClient_UpdateGroup() { + ctx := context.Background() + c, err := monitoring.NewGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.UpdateGroupRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateGroup(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleGroupClient_DeleteGroup() { + ctx := context.Background() + c, err := monitoring.NewGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.DeleteGroupRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteGroup(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleGroupClient_ListGroupMembers() { + ctx := context.Background() + c, err := monitoring.NewGroupClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListGroupMembersRequest{ + // TODO: Fill request struct fields. + } + it := c.ListGroupMembers(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/metric_client.go b/vendor/cloud.google.com/go/monitoring/apiv3/metric_client.go new file mode 100644 index 000000000..029e073f7 --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/metric_client.go @@ -0,0 +1,452 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + metricpb "google.golang.org/genproto/googleapis/api/metric" + monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// MetricCallOptions contains the retry settings for each method of MetricClient. +type MetricCallOptions struct { + ListMonitoredResourceDescriptors []gax.CallOption + GetMonitoredResourceDescriptor []gax.CallOption + ListMetricDescriptors []gax.CallOption + GetMetricDescriptor []gax.CallOption + CreateMetricDescriptor []gax.CallOption + DeleteMetricDescriptor []gax.CallOption + ListTimeSeries []gax.CallOption + CreateTimeSeries []gax.CallOption +} + +func defaultMetricClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("monitoring.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultMetricCallOptions() *MetricCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &MetricCallOptions{ + ListMonitoredResourceDescriptors: retry[[2]string{"default", "idempotent"}], + GetMonitoredResourceDescriptor: retry[[2]string{"default", "idempotent"}], + ListMetricDescriptors: retry[[2]string{"default", "idempotent"}], + GetMetricDescriptor: retry[[2]string{"default", "idempotent"}], + CreateMetricDescriptor: retry[[2]string{"default", "non_idempotent"}], + DeleteMetricDescriptor: retry[[2]string{"default", "idempotent"}], + ListTimeSeries: retry[[2]string{"default", "idempotent"}], + CreateTimeSeries: retry[[2]string{"default", "non_idempotent"}], + } +} + +// MetricClient is a client for interacting with Stackdriver Monitoring API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type MetricClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + metricClient monitoringpb.MetricServiceClient + + // The call options for this service. + CallOptions *MetricCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewMetricClient creates a new metric service client. +// +// Manages metric descriptors, monitored resource descriptors, and +// time series data. +func NewMetricClient(ctx context.Context, opts ...option.ClientOption) (*MetricClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultMetricClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &MetricClient{ + conn: conn, + CallOptions: defaultMetricCallOptions(), + + metricClient: monitoringpb.NewMetricServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *MetricClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *MetricClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *MetricClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListMonitoredResourceDescriptors lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account. +func (c *MetricClient) ListMonitoredResourceDescriptors(ctx context.Context, req *monitoringpb.ListMonitoredResourceDescriptorsRequest, opts ...gax.CallOption) *MonitoredResourceDescriptorIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListMonitoredResourceDescriptors[0:len(c.CallOptions.ListMonitoredResourceDescriptors):len(c.CallOptions.ListMonitoredResourceDescriptors)], opts...) + it := &MonitoredResourceDescriptorIterator{} + req = proto.Clone(req).(*monitoringpb.ListMonitoredResourceDescriptorsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoredrespb.MonitoredResourceDescriptor, string, error) { + var resp *monitoringpb.ListMonitoredResourceDescriptorsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricClient.ListMonitoredResourceDescriptors(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.ResourceDescriptors, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetMonitoredResourceDescriptor gets a single monitored resource descriptor. This method does not require a Stackdriver account. +func (c *MetricClient) GetMonitoredResourceDescriptor(ctx context.Context, req *monitoringpb.GetMonitoredResourceDescriptorRequest, opts ...gax.CallOption) (*monitoredrespb.MonitoredResourceDescriptor, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetMonitoredResourceDescriptor[0:len(c.CallOptions.GetMonitoredResourceDescriptor):len(c.CallOptions.GetMonitoredResourceDescriptor)], opts...) + var resp *monitoredrespb.MonitoredResourceDescriptor + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricClient.GetMonitoredResourceDescriptor(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListMetricDescriptors lists metric descriptors that match a filter. This method does not require a Stackdriver account. +func (c *MetricClient) ListMetricDescriptors(ctx context.Context, req *monitoringpb.ListMetricDescriptorsRequest, opts ...gax.CallOption) *MetricDescriptorIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListMetricDescriptors[0:len(c.CallOptions.ListMetricDescriptors):len(c.CallOptions.ListMetricDescriptors)], opts...) + it := &MetricDescriptorIterator{} + req = proto.Clone(req).(*monitoringpb.ListMetricDescriptorsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*metricpb.MetricDescriptor, string, error) { + var resp *monitoringpb.ListMetricDescriptorsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricClient.ListMetricDescriptors(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.MetricDescriptors, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetMetricDescriptor gets a single metric descriptor. This method does not require a Stackdriver account. +func (c *MetricClient) GetMetricDescriptor(ctx context.Context, req *monitoringpb.GetMetricDescriptorRequest, opts ...gax.CallOption) (*metricpb.MetricDescriptor, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetMetricDescriptor[0:len(c.CallOptions.GetMetricDescriptor):len(c.CallOptions.GetMetricDescriptor)], opts...) + var resp *metricpb.MetricDescriptor + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricClient.GetMetricDescriptor(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateMetricDescriptor creates a new metric descriptor. +// User-created metric descriptors define +// custom metrics (at /monitoring/custom-metrics). +func (c *MetricClient) CreateMetricDescriptor(ctx context.Context, req *monitoringpb.CreateMetricDescriptorRequest, opts ...gax.CallOption) (*metricpb.MetricDescriptor, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateMetricDescriptor[0:len(c.CallOptions.CreateMetricDescriptor):len(c.CallOptions.CreateMetricDescriptor)], opts...) + var resp *metricpb.MetricDescriptor + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricClient.CreateMetricDescriptor(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteMetricDescriptor deletes a metric descriptor. Only user-created +// custom metrics (at /monitoring/custom-metrics) can be deleted. +func (c *MetricClient) DeleteMetricDescriptor(ctx context.Context, req *monitoringpb.DeleteMetricDescriptorRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteMetricDescriptor[0:len(c.CallOptions.DeleteMetricDescriptor):len(c.CallOptions.DeleteMetricDescriptor)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.metricClient.DeleteMetricDescriptor(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListTimeSeries lists time series that match a filter. This method does not require a Stackdriver account. +func (c *MetricClient) ListTimeSeries(ctx context.Context, req *monitoringpb.ListTimeSeriesRequest, opts ...gax.CallOption) *TimeSeriesIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListTimeSeries[0:len(c.CallOptions.ListTimeSeries):len(c.CallOptions.ListTimeSeries)], opts...) + it := &TimeSeriesIterator{} + req = proto.Clone(req).(*monitoringpb.ListTimeSeriesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.TimeSeries, string, error) { + var resp *monitoringpb.ListTimeSeriesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.metricClient.ListTimeSeries(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.TimeSeries, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// CreateTimeSeries creates or adds data to one or more time series. +// The response is empty if all time series in the request were written. +// If any time series could not be written, a corresponding failure message is +// included in the error response. +func (c *MetricClient) CreateTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateTimeSeries[0:len(c.CallOptions.CreateTimeSeries):len(c.CallOptions.CreateTimeSeries)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.metricClient.CreateTimeSeries(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// MetricDescriptorIterator manages a stream of *metricpb.MetricDescriptor. +type MetricDescriptorIterator struct { + items []*metricpb.MetricDescriptor + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*metricpb.MetricDescriptor, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *MetricDescriptorIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *MetricDescriptorIterator) Next() (*metricpb.MetricDescriptor, error) { + var item *metricpb.MetricDescriptor + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *MetricDescriptorIterator) bufLen() int { + return len(it.items) +} + +func (it *MetricDescriptorIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// MonitoredResourceDescriptorIterator manages a stream of *monitoredrespb.MonitoredResourceDescriptor. +type MonitoredResourceDescriptorIterator struct { + items []*monitoredrespb.MonitoredResourceDescriptor + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoredrespb.MonitoredResourceDescriptor, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *MonitoredResourceDescriptorIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *MonitoredResourceDescriptorIterator) Next() (*monitoredrespb.MonitoredResourceDescriptor, error) { + var item *monitoredrespb.MonitoredResourceDescriptor + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *MonitoredResourceDescriptorIterator) bufLen() int { + return len(it.items) +} + +func (it *MonitoredResourceDescriptorIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// TimeSeriesIterator manages a stream of *monitoringpb.TimeSeries. +type TimeSeriesIterator struct { + items []*monitoringpb.TimeSeries + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoringpb.TimeSeries, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TimeSeriesIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *TimeSeriesIterator) Next() (*monitoringpb.TimeSeries, error) { + var item *monitoringpb.TimeSeries + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TimeSeriesIterator) bufLen() int { + return len(it.items) +} + +func (it *TimeSeriesIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/metric_client_example_test.go b/vendor/cloud.google.com/go/monitoring/apiv3/metric_client_example_test.go new file mode 100644 index 000000000..4333792ce --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/metric_client_example_test.go @@ -0,0 +1,193 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring_test + +import ( + "context" + + monitoring "cloud.google.com/go/monitoring/apiv3" + "google.golang.org/api/iterator" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" +) + +func ExampleNewMetricClient() { + ctx := context.Background() + c, err := monitoring.NewMetricClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleMetricClient_ListMonitoredResourceDescriptors() { + ctx := context.Background() + c, err := monitoring.NewMetricClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListMonitoredResourceDescriptorsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListMonitoredResourceDescriptors(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetricClient_GetMonitoredResourceDescriptor() { + ctx := context.Background() + c, err := monitoring.NewMetricClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.GetMonitoredResourceDescriptorRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetMonitoredResourceDescriptor(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetricClient_ListMetricDescriptors() { + ctx := context.Background() + c, err := monitoring.NewMetricClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListMetricDescriptorsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListMetricDescriptors(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetricClient_GetMetricDescriptor() { + ctx := context.Background() + c, err := monitoring.NewMetricClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.GetMetricDescriptorRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetMetricDescriptor(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetricClient_CreateMetricDescriptor() { + ctx := context.Background() + c, err := monitoring.NewMetricClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.CreateMetricDescriptorRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateMetricDescriptor(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleMetricClient_DeleteMetricDescriptor() { + ctx := context.Background() + c, err := monitoring.NewMetricClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.DeleteMetricDescriptorRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteMetricDescriptor(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleMetricClient_ListTimeSeries() { + ctx := context.Background() + c, err := monitoring.NewMetricClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListTimeSeriesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTimeSeries(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleMetricClient_CreateTimeSeries() { + ctx := context.Background() + c, err := monitoring.NewMetricClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.CreateTimeSeriesRequest{ + // TODO: Fill request struct fields. + } + err = c.CreateTimeSeries(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/mock_test.go b/vendor/cloud.google.com/go/monitoring/apiv3/mock_test.go new file mode 100644 index 000000000..f49397523 --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/mock_test.go @@ -0,0 +1,2644 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + metricpb "google.golang.org/genproto/googleapis/api/metric" + monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockAlertPolicyServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + monitoringpb.AlertPolicyServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockAlertPolicyServer) ListAlertPolicies(ctx context.Context, req *monitoringpb.ListAlertPoliciesRequest) (*monitoringpb.ListAlertPoliciesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListAlertPoliciesResponse), nil +} + +func (s *mockAlertPolicyServer) GetAlertPolicy(ctx context.Context, req *monitoringpb.GetAlertPolicyRequest) (*monitoringpb.AlertPolicy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.AlertPolicy), nil +} + +func (s *mockAlertPolicyServer) CreateAlertPolicy(ctx context.Context, req *monitoringpb.CreateAlertPolicyRequest) (*monitoringpb.AlertPolicy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.AlertPolicy), nil +} + +func (s *mockAlertPolicyServer) DeleteAlertPolicy(ctx context.Context, req *monitoringpb.DeleteAlertPolicyRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockAlertPolicyServer) UpdateAlertPolicy(ctx context.Context, req *monitoringpb.UpdateAlertPolicyRequest) (*monitoringpb.AlertPolicy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.AlertPolicy), nil +} + +type mockGroupServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + monitoringpb.GroupServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockGroupServer) ListGroups(ctx context.Context, req *monitoringpb.ListGroupsRequest) (*monitoringpb.ListGroupsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListGroupsResponse), nil +} + +func (s *mockGroupServer) GetGroup(ctx context.Context, req *monitoringpb.GetGroupRequest) (*monitoringpb.Group, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.Group), nil +} + +func (s *mockGroupServer) CreateGroup(ctx context.Context, req *monitoringpb.CreateGroupRequest) (*monitoringpb.Group, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.Group), nil +} + +func (s *mockGroupServer) UpdateGroup(ctx context.Context, req *monitoringpb.UpdateGroupRequest) (*monitoringpb.Group, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.Group), nil +} + +func (s *mockGroupServer) DeleteGroup(ctx context.Context, req *monitoringpb.DeleteGroupRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockGroupServer) ListGroupMembers(ctx context.Context, req *monitoringpb.ListGroupMembersRequest) (*monitoringpb.ListGroupMembersResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListGroupMembersResponse), nil +} + +type mockMetricServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + monitoringpb.MetricServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockMetricServer) ListMonitoredResourceDescriptors(ctx context.Context, req *monitoringpb.ListMonitoredResourceDescriptorsRequest) (*monitoringpb.ListMonitoredResourceDescriptorsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListMonitoredResourceDescriptorsResponse), nil +} + +func (s *mockMetricServer) GetMonitoredResourceDescriptor(ctx context.Context, req *monitoringpb.GetMonitoredResourceDescriptorRequest) (*monitoredrespb.MonitoredResourceDescriptor, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoredrespb.MonitoredResourceDescriptor), nil +} + +func (s *mockMetricServer) ListMetricDescriptors(ctx context.Context, req *monitoringpb.ListMetricDescriptorsRequest) (*monitoringpb.ListMetricDescriptorsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListMetricDescriptorsResponse), nil +} + +func (s *mockMetricServer) GetMetricDescriptor(ctx context.Context, req *monitoringpb.GetMetricDescriptorRequest) (*metricpb.MetricDescriptor, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*metricpb.MetricDescriptor), nil +} + +func (s *mockMetricServer) CreateMetricDescriptor(ctx context.Context, req *monitoringpb.CreateMetricDescriptorRequest) (*metricpb.MetricDescriptor, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*metricpb.MetricDescriptor), nil +} + +func (s *mockMetricServer) DeleteMetricDescriptor(ctx context.Context, req *monitoringpb.DeleteMetricDescriptorRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockMetricServer) ListTimeSeries(ctx context.Context, req *monitoringpb.ListTimeSeriesRequest) (*monitoringpb.ListTimeSeriesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListTimeSeriesResponse), nil +} + +func (s *mockMetricServer) CreateTimeSeries(ctx context.Context, req *monitoringpb.CreateTimeSeriesRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +type mockNotificationChannelServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + monitoringpb.NotificationChannelServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockNotificationChannelServer) ListNotificationChannelDescriptors(ctx context.Context, req *monitoringpb.ListNotificationChannelDescriptorsRequest) (*monitoringpb.ListNotificationChannelDescriptorsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListNotificationChannelDescriptorsResponse), nil +} + +func (s *mockNotificationChannelServer) GetNotificationChannelDescriptor(ctx context.Context, req *monitoringpb.GetNotificationChannelDescriptorRequest) (*monitoringpb.NotificationChannelDescriptor, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.NotificationChannelDescriptor), nil +} + +func (s *mockNotificationChannelServer) ListNotificationChannels(ctx context.Context, req *monitoringpb.ListNotificationChannelsRequest) (*monitoringpb.ListNotificationChannelsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListNotificationChannelsResponse), nil +} + +func (s *mockNotificationChannelServer) GetNotificationChannel(ctx context.Context, req *monitoringpb.GetNotificationChannelRequest) (*monitoringpb.NotificationChannel, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.NotificationChannel), nil +} + +func (s *mockNotificationChannelServer) CreateNotificationChannel(ctx context.Context, req *monitoringpb.CreateNotificationChannelRequest) (*monitoringpb.NotificationChannel, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.NotificationChannel), nil +} + +func (s *mockNotificationChannelServer) UpdateNotificationChannel(ctx context.Context, req *monitoringpb.UpdateNotificationChannelRequest) (*monitoringpb.NotificationChannel, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.NotificationChannel), nil +} + +func (s *mockNotificationChannelServer) DeleteNotificationChannel(ctx context.Context, req *monitoringpb.DeleteNotificationChannelRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +type mockUptimeCheckServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + monitoringpb.UptimeCheckServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockUptimeCheckServer) ListUptimeCheckConfigs(ctx context.Context, req *monitoringpb.ListUptimeCheckConfigsRequest) (*monitoringpb.ListUptimeCheckConfigsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListUptimeCheckConfigsResponse), nil +} + +func (s *mockUptimeCheckServer) GetUptimeCheckConfig(ctx context.Context, req *monitoringpb.GetUptimeCheckConfigRequest) (*monitoringpb.UptimeCheckConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.UptimeCheckConfig), nil +} + +func (s *mockUptimeCheckServer) CreateUptimeCheckConfig(ctx context.Context, req *monitoringpb.CreateUptimeCheckConfigRequest) (*monitoringpb.UptimeCheckConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.UptimeCheckConfig), nil +} + +func (s *mockUptimeCheckServer) UpdateUptimeCheckConfig(ctx context.Context, req *monitoringpb.UpdateUptimeCheckConfigRequest) (*monitoringpb.UptimeCheckConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.UptimeCheckConfig), nil +} + +func (s *mockUptimeCheckServer) DeleteUptimeCheckConfig(ctx context.Context, req *monitoringpb.DeleteUptimeCheckConfigRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockUptimeCheckServer) ListUptimeCheckIps(ctx context.Context, req *monitoringpb.ListUptimeCheckIpsRequest) (*monitoringpb.ListUptimeCheckIpsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*monitoringpb.ListUptimeCheckIpsResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockAlertPolicy mockAlertPolicyServer + mockGroup mockGroupServer + mockMetric mockMetricServer + mockNotificationChannel mockNotificationChannelServer + mockUptimeCheck mockUptimeCheckServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + monitoringpb.RegisterAlertPolicyServiceServer(serv, &mockAlertPolicy) + monitoringpb.RegisterGroupServiceServer(serv, &mockGroup) + monitoringpb.RegisterMetricServiceServer(serv, &mockMetric) + monitoringpb.RegisterNotificationChannelServiceServer(serv, &mockNotificationChannel) + monitoringpb.RegisterUptimeCheckServiceServer(serv, &mockUptimeCheck) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestAlertPolicyServiceListAlertPolicies(t *testing.T) { + var nextPageToken string = "" + var alertPoliciesElement *monitoringpb.AlertPolicy = &monitoringpb.AlertPolicy{} + var alertPolicies = []*monitoringpb.AlertPolicy{alertPoliciesElement} + var expectedResponse = &monitoringpb.ListAlertPoliciesResponse{ + NextPageToken: nextPageToken, + AlertPolicies: alertPolicies, + } + + mockAlertPolicy.err = nil + mockAlertPolicy.reqs = nil + + mockAlertPolicy.resps = append(mockAlertPolicy.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListAlertPoliciesRequest{ + Name: formattedName, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListAlertPolicies(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAlertPolicy.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.AlertPolicies[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAlertPolicyServiceListAlertPoliciesError(t *testing.T) { + errCode := codes.PermissionDenied + mockAlertPolicy.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListAlertPoliciesRequest{ + Name: formattedName, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListAlertPolicies(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestAlertPolicyServiceGetAlertPolicy(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var expectedResponse = &monitoringpb.AlertPolicy{ + Name: name2, + DisplayName: displayName, + } + + mockAlertPolicy.err = nil + mockAlertPolicy.reqs = nil + + mockAlertPolicy.resps = append(mockAlertPolicy.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/alertPolicies/%s", "[PROJECT]", "[ALERT_POLICY]") + var request = &monitoringpb.GetAlertPolicyRequest{ + Name: formattedName, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetAlertPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAlertPolicy.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAlertPolicyServiceGetAlertPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockAlertPolicy.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/alertPolicies/%s", "[PROJECT]", "[ALERT_POLICY]") + var request = &monitoringpb.GetAlertPolicyRequest{ + Name: formattedName, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetAlertPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestAlertPolicyServiceCreateAlertPolicy(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var expectedResponse = &monitoringpb.AlertPolicy{ + Name: name2, + DisplayName: displayName, + } + + mockAlertPolicy.err = nil + mockAlertPolicy.reqs = nil + + mockAlertPolicy.resps = append(mockAlertPolicy.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var alertPolicy *monitoringpb.AlertPolicy = &monitoringpb.AlertPolicy{} + var request = &monitoringpb.CreateAlertPolicyRequest{ + Name: formattedName, + AlertPolicy: alertPolicy, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateAlertPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAlertPolicy.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAlertPolicyServiceCreateAlertPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockAlertPolicy.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var alertPolicy *monitoringpb.AlertPolicy = &monitoringpb.AlertPolicy{} + var request = &monitoringpb.CreateAlertPolicyRequest{ + Name: formattedName, + AlertPolicy: alertPolicy, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateAlertPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestAlertPolicyServiceDeleteAlertPolicy(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockAlertPolicy.err = nil + mockAlertPolicy.reqs = nil + + mockAlertPolicy.resps = append(mockAlertPolicy.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/alertPolicies/%s", "[PROJECT]", "[ALERT_POLICY]") + var request = &monitoringpb.DeleteAlertPolicyRequest{ + Name: formattedName, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteAlertPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAlertPolicy.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestAlertPolicyServiceDeleteAlertPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockAlertPolicy.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/alertPolicies/%s", "[PROJECT]", "[ALERT_POLICY]") + var request = &monitoringpb.DeleteAlertPolicyRequest{ + Name: formattedName, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteAlertPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestAlertPolicyServiceUpdateAlertPolicy(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var expectedResponse = &monitoringpb.AlertPolicy{ + Name: name, + DisplayName: displayName, + } + + mockAlertPolicy.err = nil + mockAlertPolicy.reqs = nil + + mockAlertPolicy.resps = append(mockAlertPolicy.resps[:0], expectedResponse) + + var alertPolicy *monitoringpb.AlertPolicy = &monitoringpb.AlertPolicy{} + var request = &monitoringpb.UpdateAlertPolicyRequest{ + AlertPolicy: alertPolicy, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateAlertPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockAlertPolicy.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestAlertPolicyServiceUpdateAlertPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockAlertPolicy.err = gstatus.Error(errCode, "test error") + + var alertPolicy *monitoringpb.AlertPolicy = &monitoringpb.AlertPolicy{} + var request = &monitoringpb.UpdateAlertPolicyRequest{ + AlertPolicy: alertPolicy, + } + + c, err := NewAlertPolicyClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateAlertPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGroupServiceListGroups(t *testing.T) { + var nextPageToken string = "" + var groupElement *monitoringpb.Group = &monitoringpb.Group{} + var group = []*monitoringpb.Group{groupElement} + var expectedResponse = &monitoringpb.ListGroupsResponse{ + NextPageToken: nextPageToken, + Group: group, + } + + mockGroup.err = nil + mockGroup.reqs = nil + + mockGroup.resps = append(mockGroup.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListGroupsRequest{ + Name: formattedName, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListGroups(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGroup.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Group[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGroupServiceListGroupsError(t *testing.T) { + errCode := codes.PermissionDenied + mockGroup.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListGroupsRequest{ + Name: formattedName, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListGroups(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGroupServiceGetGroup(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var parentName string = "parentName1015022848" + var filter string = "filter-1274492040" + var isCluster bool = false + var expectedResponse = &monitoringpb.Group{ + Name: name2, + DisplayName: displayName, + ParentName: parentName, + Filter: filter, + IsCluster: isCluster, + } + + mockGroup.err = nil + mockGroup.reqs = nil + + mockGroup.resps = append(mockGroup.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]") + var request = &monitoringpb.GetGroupRequest{ + Name: formattedName, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetGroup(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGroup.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGroupServiceGetGroupError(t *testing.T) { + errCode := codes.PermissionDenied + mockGroup.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]") + var request = &monitoringpb.GetGroupRequest{ + Name: formattedName, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetGroup(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGroupServiceCreateGroup(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var parentName string = "parentName1015022848" + var filter string = "filter-1274492040" + var isCluster bool = false + var expectedResponse = &monitoringpb.Group{ + Name: name2, + DisplayName: displayName, + ParentName: parentName, + Filter: filter, + IsCluster: isCluster, + } + + mockGroup.err = nil + mockGroup.reqs = nil + + mockGroup.resps = append(mockGroup.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var group *monitoringpb.Group = &monitoringpb.Group{} + var request = &monitoringpb.CreateGroupRequest{ + Name: formattedName, + Group: group, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateGroup(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGroup.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGroupServiceCreateGroupError(t *testing.T) { + errCode := codes.PermissionDenied + mockGroup.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var group *monitoringpb.Group = &monitoringpb.Group{} + var request = &monitoringpb.CreateGroupRequest{ + Name: formattedName, + Group: group, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateGroup(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGroupServiceUpdateGroup(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var parentName string = "parentName1015022848" + var filter string = "filter-1274492040" + var isCluster bool = false + var expectedResponse = &monitoringpb.Group{ + Name: name, + DisplayName: displayName, + ParentName: parentName, + Filter: filter, + IsCluster: isCluster, + } + + mockGroup.err = nil + mockGroup.reqs = nil + + mockGroup.resps = append(mockGroup.resps[:0], expectedResponse) + + var group *monitoringpb.Group = &monitoringpb.Group{} + var request = &monitoringpb.UpdateGroupRequest{ + Group: group, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateGroup(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGroup.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGroupServiceUpdateGroupError(t *testing.T) { + errCode := codes.PermissionDenied + mockGroup.err = gstatus.Error(errCode, "test error") + + var group *monitoringpb.Group = &monitoringpb.Group{} + var request = &monitoringpb.UpdateGroupRequest{ + Group: group, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateGroup(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestGroupServiceDeleteGroup(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockGroup.err = nil + mockGroup.reqs = nil + + mockGroup.resps = append(mockGroup.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]") + var request = &monitoringpb.DeleteGroupRequest{ + Name: formattedName, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteGroup(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGroup.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestGroupServiceDeleteGroupError(t *testing.T) { + errCode := codes.PermissionDenied + mockGroup.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]") + var request = &monitoringpb.DeleteGroupRequest{ + Name: formattedName, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteGroup(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestGroupServiceListGroupMembers(t *testing.T) { + var nextPageToken string = "" + var totalSize int32 = 705419236 + var membersElement *monitoredrespb.MonitoredResource = &monitoredrespb.MonitoredResource{} + var members = []*monitoredrespb.MonitoredResource{membersElement} + var expectedResponse = &monitoringpb.ListGroupMembersResponse{ + NextPageToken: nextPageToken, + TotalSize: totalSize, + Members: members, + } + + mockGroup.err = nil + mockGroup.reqs = nil + + mockGroup.resps = append(mockGroup.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]") + var request = &monitoringpb.ListGroupMembersRequest{ + Name: formattedName, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListGroupMembers(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockGroup.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Members[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestGroupServiceListGroupMembersError(t *testing.T) { + errCode := codes.PermissionDenied + mockGroup.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/groups/%s", "[PROJECT]", "[GROUP]") + var request = &monitoringpb.ListGroupMembersRequest{ + Name: formattedName, + } + + c, err := NewGroupClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListGroupMembers(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricServiceListMonitoredResourceDescriptors(t *testing.T) { + var nextPageToken string = "" + var resourceDescriptorsElement *monitoredrespb.MonitoredResourceDescriptor = &monitoredrespb.MonitoredResourceDescriptor{} + var resourceDescriptors = []*monitoredrespb.MonitoredResourceDescriptor{resourceDescriptorsElement} + var expectedResponse = &monitoringpb.ListMonitoredResourceDescriptorsResponse{ + NextPageToken: nextPageToken, + ResourceDescriptors: resourceDescriptors, + } + + mockMetric.err = nil + mockMetric.reqs = nil + + mockMetric.resps = append(mockMetric.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListMonitoredResourceDescriptorsRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListMonitoredResourceDescriptors(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetric.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.ResourceDescriptors[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricServiceListMonitoredResourceDescriptorsError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetric.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListMonitoredResourceDescriptorsRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListMonitoredResourceDescriptors(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricServiceGetMonitoredResourceDescriptor(t *testing.T) { + var name2 string = "name2-1052831874" + var type_ string = "type3575610" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &monitoredrespb.MonitoredResourceDescriptor{ + Name: name2, + Type: type_, + DisplayName: displayName, + Description: description, + } + + mockMetric.err = nil + mockMetric.reqs = nil + + mockMetric.resps = append(mockMetric.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/monitoredResourceDescriptors/%s", "[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]") + var request = &monitoringpb.GetMonitoredResourceDescriptorRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetMonitoredResourceDescriptor(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetric.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricServiceGetMonitoredResourceDescriptorError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetric.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/monitoredResourceDescriptors/%s", "[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]") + var request = &monitoringpb.GetMonitoredResourceDescriptorRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetMonitoredResourceDescriptor(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricServiceListMetricDescriptors(t *testing.T) { + var nextPageToken string = "" + var metricDescriptorsElement *metricpb.MetricDescriptor = &metricpb.MetricDescriptor{} + var metricDescriptors = []*metricpb.MetricDescriptor{metricDescriptorsElement} + var expectedResponse = &monitoringpb.ListMetricDescriptorsResponse{ + NextPageToken: nextPageToken, + MetricDescriptors: metricDescriptors, + } + + mockMetric.err = nil + mockMetric.reqs = nil + + mockMetric.resps = append(mockMetric.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListMetricDescriptorsRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListMetricDescriptors(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetric.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.MetricDescriptors[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricServiceListMetricDescriptorsError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetric.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListMetricDescriptorsRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListMetricDescriptors(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricServiceGetMetricDescriptor(t *testing.T) { + var name2 string = "name2-1052831874" + var type_ string = "type3575610" + var unit string = "unit3594628" + var description string = "description-1724546052" + var displayName string = "displayName1615086568" + var expectedResponse = &metricpb.MetricDescriptor{ + Name: name2, + Type: type_, + Unit: unit, + Description: description, + DisplayName: displayName, + } + + mockMetric.err = nil + mockMetric.reqs = nil + + mockMetric.resps = append(mockMetric.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/metricDescriptors/%s", "[PROJECT]", "[METRIC_DESCRIPTOR]") + var request = &monitoringpb.GetMetricDescriptorRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetMetricDescriptor(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetric.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricServiceGetMetricDescriptorError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetric.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/metricDescriptors/%s", "[PROJECT]", "[METRIC_DESCRIPTOR]") + var request = &monitoringpb.GetMetricDescriptorRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetMetricDescriptor(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricServiceCreateMetricDescriptor(t *testing.T) { + var name2 string = "name2-1052831874" + var type_ string = "type3575610" + var unit string = "unit3594628" + var description string = "description-1724546052" + var displayName string = "displayName1615086568" + var expectedResponse = &metricpb.MetricDescriptor{ + Name: name2, + Type: type_, + Unit: unit, + Description: description, + DisplayName: displayName, + } + + mockMetric.err = nil + mockMetric.reqs = nil + + mockMetric.resps = append(mockMetric.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var metricDescriptor *metricpb.MetricDescriptor = &metricpb.MetricDescriptor{} + var request = &monitoringpb.CreateMetricDescriptorRequest{ + Name: formattedName, + MetricDescriptor: metricDescriptor, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateMetricDescriptor(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetric.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricServiceCreateMetricDescriptorError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetric.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var metricDescriptor *metricpb.MetricDescriptor = &metricpb.MetricDescriptor{} + var request = &monitoringpb.CreateMetricDescriptorRequest{ + Name: formattedName, + MetricDescriptor: metricDescriptor, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateMetricDescriptor(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricServiceDeleteMetricDescriptor(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockMetric.err = nil + mockMetric.reqs = nil + + mockMetric.resps = append(mockMetric.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/metricDescriptors/%s", "[PROJECT]", "[METRIC_DESCRIPTOR]") + var request = &monitoringpb.DeleteMetricDescriptorRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteMetricDescriptor(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetric.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestMetricServiceDeleteMetricDescriptorError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetric.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/metricDescriptors/%s", "[PROJECT]", "[METRIC_DESCRIPTOR]") + var request = &monitoringpb.DeleteMetricDescriptorRequest{ + Name: formattedName, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteMetricDescriptor(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestMetricServiceListTimeSeries(t *testing.T) { + var nextPageToken string = "" + var timeSeriesElement *monitoringpb.TimeSeries = &monitoringpb.TimeSeries{} + var timeSeries = []*monitoringpb.TimeSeries{timeSeriesElement} + var expectedResponse = &monitoringpb.ListTimeSeriesResponse{ + NextPageToken: nextPageToken, + TimeSeries: timeSeries, + } + + mockMetric.err = nil + mockMetric.reqs = nil + + mockMetric.resps = append(mockMetric.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var filter string = "filter-1274492040" + var interval *monitoringpb.TimeInterval = &monitoringpb.TimeInterval{} + var view monitoringpb.ListTimeSeriesRequest_TimeSeriesView = monitoringpb.ListTimeSeriesRequest_FULL + var request = &monitoringpb.ListTimeSeriesRequest{ + Name: formattedName, + Filter: filter, + Interval: interval, + View: view, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTimeSeries(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetric.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.TimeSeries[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestMetricServiceListTimeSeriesError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetric.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var filter string = "filter-1274492040" + var interval *monitoringpb.TimeInterval = &monitoringpb.TimeInterval{} + var view monitoringpb.ListTimeSeriesRequest_TimeSeriesView = monitoringpb.ListTimeSeriesRequest_FULL + var request = &monitoringpb.ListTimeSeriesRequest{ + Name: formattedName, + Filter: filter, + Interval: interval, + View: view, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTimeSeries(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestMetricServiceCreateTimeSeries(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockMetric.err = nil + mockMetric.reqs = nil + + mockMetric.resps = append(mockMetric.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var timeSeries []*monitoringpb.TimeSeries = nil + var request = &monitoringpb.CreateTimeSeriesRequest{ + Name: formattedName, + TimeSeries: timeSeries, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.CreateTimeSeries(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockMetric.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestMetricServiceCreateTimeSeriesError(t *testing.T) { + errCode := codes.PermissionDenied + mockMetric.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var timeSeries []*monitoringpb.TimeSeries = nil + var request = &monitoringpb.CreateTimeSeriesRequest{ + Name: formattedName, + TimeSeries: timeSeries, + } + + c, err := NewMetricClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.CreateTimeSeries(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestNotificationChannelServiceListNotificationChannelDescriptors(t *testing.T) { + var nextPageToken string = "" + var channelDescriptorsElement *monitoringpb.NotificationChannelDescriptor = &monitoringpb.NotificationChannelDescriptor{} + var channelDescriptors = []*monitoringpb.NotificationChannelDescriptor{channelDescriptorsElement} + var expectedResponse = &monitoringpb.ListNotificationChannelDescriptorsResponse{ + NextPageToken: nextPageToken, + ChannelDescriptors: channelDescriptors, + } + + mockNotificationChannel.err = nil + mockNotificationChannel.reqs = nil + + mockNotificationChannel.resps = append(mockNotificationChannel.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListNotificationChannelDescriptorsRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNotificationChannelDescriptors(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockNotificationChannel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.ChannelDescriptors[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestNotificationChannelServiceListNotificationChannelDescriptorsError(t *testing.T) { + errCode := codes.PermissionDenied + mockNotificationChannel.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListNotificationChannelDescriptorsRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNotificationChannelDescriptors(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestNotificationChannelServiceGetNotificationChannelDescriptor(t *testing.T) { + var name2 string = "name2-1052831874" + var type_ string = "type3575610" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &monitoringpb.NotificationChannelDescriptor{ + Name: name2, + Type: type_, + DisplayName: displayName, + Description: description, + } + + mockNotificationChannel.err = nil + mockNotificationChannel.reqs = nil + + mockNotificationChannel.resps = append(mockNotificationChannel.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/notificationChannelDescriptors/%s", "[PROJECT]", "[CHANNEL_DESCRIPTOR]") + var request = &monitoringpb.GetNotificationChannelDescriptorRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetNotificationChannelDescriptor(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockNotificationChannel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestNotificationChannelServiceGetNotificationChannelDescriptorError(t *testing.T) { + errCode := codes.PermissionDenied + mockNotificationChannel.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/notificationChannelDescriptors/%s", "[PROJECT]", "[CHANNEL_DESCRIPTOR]") + var request = &monitoringpb.GetNotificationChannelDescriptorRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetNotificationChannelDescriptor(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestNotificationChannelServiceListNotificationChannels(t *testing.T) { + var nextPageToken string = "" + var notificationChannelsElement *monitoringpb.NotificationChannel = &monitoringpb.NotificationChannel{} + var notificationChannels = []*monitoringpb.NotificationChannel{notificationChannelsElement} + var expectedResponse = &monitoringpb.ListNotificationChannelsResponse{ + NextPageToken: nextPageToken, + NotificationChannels: notificationChannels, + } + + mockNotificationChannel.err = nil + mockNotificationChannel.reqs = nil + + mockNotificationChannel.resps = append(mockNotificationChannel.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListNotificationChannelsRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNotificationChannels(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockNotificationChannel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.NotificationChannels[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestNotificationChannelServiceListNotificationChannelsError(t *testing.T) { + errCode := codes.PermissionDenied + mockNotificationChannel.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListNotificationChannelsRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListNotificationChannels(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestNotificationChannelServiceGetNotificationChannel(t *testing.T) { + var type_ string = "type3575610" + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &monitoringpb.NotificationChannel{ + Type: type_, + Name: name2, + DisplayName: displayName, + Description: description, + } + + mockNotificationChannel.err = nil + mockNotificationChannel.reqs = nil + + mockNotificationChannel.resps = append(mockNotificationChannel.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/notificationChannels/%s", "[PROJECT]", "[NOTIFICATION_CHANNEL]") + var request = &monitoringpb.GetNotificationChannelRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetNotificationChannel(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockNotificationChannel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestNotificationChannelServiceGetNotificationChannelError(t *testing.T) { + errCode := codes.PermissionDenied + mockNotificationChannel.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/notificationChannels/%s", "[PROJECT]", "[NOTIFICATION_CHANNEL]") + var request = &monitoringpb.GetNotificationChannelRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetNotificationChannel(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestNotificationChannelServiceCreateNotificationChannel(t *testing.T) { + var type_ string = "type3575610" + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &monitoringpb.NotificationChannel{ + Type: type_, + Name: name2, + DisplayName: displayName, + Description: description, + } + + mockNotificationChannel.err = nil + mockNotificationChannel.reqs = nil + + mockNotificationChannel.resps = append(mockNotificationChannel.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var notificationChannel *monitoringpb.NotificationChannel = &monitoringpb.NotificationChannel{} + var request = &monitoringpb.CreateNotificationChannelRequest{ + Name: formattedName, + NotificationChannel: notificationChannel, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateNotificationChannel(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockNotificationChannel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestNotificationChannelServiceCreateNotificationChannelError(t *testing.T) { + errCode := codes.PermissionDenied + mockNotificationChannel.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var notificationChannel *monitoringpb.NotificationChannel = &monitoringpb.NotificationChannel{} + var request = &monitoringpb.CreateNotificationChannelRequest{ + Name: formattedName, + NotificationChannel: notificationChannel, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateNotificationChannel(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestNotificationChannelServiceUpdateNotificationChannel(t *testing.T) { + var type_ string = "type3575610" + var name string = "name3373707" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &monitoringpb.NotificationChannel{ + Type: type_, + Name: name, + DisplayName: displayName, + Description: description, + } + + mockNotificationChannel.err = nil + mockNotificationChannel.reqs = nil + + mockNotificationChannel.resps = append(mockNotificationChannel.resps[:0], expectedResponse) + + var notificationChannel *monitoringpb.NotificationChannel = &monitoringpb.NotificationChannel{} + var request = &monitoringpb.UpdateNotificationChannelRequest{ + NotificationChannel: notificationChannel, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateNotificationChannel(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockNotificationChannel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestNotificationChannelServiceUpdateNotificationChannelError(t *testing.T) { + errCode := codes.PermissionDenied + mockNotificationChannel.err = gstatus.Error(errCode, "test error") + + var notificationChannel *monitoringpb.NotificationChannel = &monitoringpb.NotificationChannel{} + var request = &monitoringpb.UpdateNotificationChannelRequest{ + NotificationChannel: notificationChannel, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateNotificationChannel(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestNotificationChannelServiceDeleteNotificationChannel(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockNotificationChannel.err = nil + mockNotificationChannel.reqs = nil + + mockNotificationChannel.resps = append(mockNotificationChannel.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/notificationChannels/%s", "[PROJECT]", "[NOTIFICATION_CHANNEL]") + var request = &monitoringpb.DeleteNotificationChannelRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteNotificationChannel(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockNotificationChannel.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestNotificationChannelServiceDeleteNotificationChannelError(t *testing.T) { + errCode := codes.PermissionDenied + mockNotificationChannel.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/notificationChannels/%s", "[PROJECT]", "[NOTIFICATION_CHANNEL]") + var request = &monitoringpb.DeleteNotificationChannelRequest{ + Name: formattedName, + } + + c, err := NewNotificationChannelClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteNotificationChannel(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestUptimeCheckServiceListUptimeCheckConfigs(t *testing.T) { + var nextPageToken string = "" + var totalSize int32 = 705419236 + var uptimeCheckConfigsElement *monitoringpb.UptimeCheckConfig = &monitoringpb.UptimeCheckConfig{} + var uptimeCheckConfigs = []*monitoringpb.UptimeCheckConfig{uptimeCheckConfigsElement} + var expectedResponse = &monitoringpb.ListUptimeCheckConfigsResponse{ + NextPageToken: nextPageToken, + TotalSize: totalSize, + UptimeCheckConfigs: uptimeCheckConfigs, + } + + mockUptimeCheck.err = nil + mockUptimeCheck.reqs = nil + + mockUptimeCheck.resps = append(mockUptimeCheck.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListUptimeCheckConfigsRequest{ + Parent: formattedParent, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListUptimeCheckConfigs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockUptimeCheck.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.UptimeCheckConfigs[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestUptimeCheckServiceListUptimeCheckConfigsError(t *testing.T) { + errCode := codes.PermissionDenied + mockUptimeCheck.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &monitoringpb.ListUptimeCheckConfigsRequest{ + Parent: formattedParent, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListUptimeCheckConfigs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestUptimeCheckServiceGetUptimeCheckConfig(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var isInternal bool = true + var expectedResponse = &monitoringpb.UptimeCheckConfig{ + Name: name2, + DisplayName: displayName, + IsInternal: isInternal, + } + + mockUptimeCheck.err = nil + mockUptimeCheck.reqs = nil + + mockUptimeCheck.resps = append(mockUptimeCheck.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/uptimeCheckConfigs/%s", "[PROJECT]", "[UPTIME_CHECK_CONFIG]") + var request = &monitoringpb.GetUptimeCheckConfigRequest{ + Name: formattedName, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetUptimeCheckConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockUptimeCheck.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestUptimeCheckServiceGetUptimeCheckConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockUptimeCheck.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/uptimeCheckConfigs/%s", "[PROJECT]", "[UPTIME_CHECK_CONFIG]") + var request = &monitoringpb.GetUptimeCheckConfigRequest{ + Name: formattedName, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetUptimeCheckConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestUptimeCheckServiceCreateUptimeCheckConfig(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var isInternal bool = true + var expectedResponse = &monitoringpb.UptimeCheckConfig{ + Name: name, + DisplayName: displayName, + IsInternal: isInternal, + } + + mockUptimeCheck.err = nil + mockUptimeCheck.reqs = nil + + mockUptimeCheck.resps = append(mockUptimeCheck.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var uptimeCheckConfig *monitoringpb.UptimeCheckConfig = &monitoringpb.UptimeCheckConfig{} + var request = &monitoringpb.CreateUptimeCheckConfigRequest{ + Parent: formattedParent, + UptimeCheckConfig: uptimeCheckConfig, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateUptimeCheckConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockUptimeCheck.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestUptimeCheckServiceCreateUptimeCheckConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockUptimeCheck.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var uptimeCheckConfig *monitoringpb.UptimeCheckConfig = &monitoringpb.UptimeCheckConfig{} + var request = &monitoringpb.CreateUptimeCheckConfigRequest{ + Parent: formattedParent, + UptimeCheckConfig: uptimeCheckConfig, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateUptimeCheckConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestUptimeCheckServiceUpdateUptimeCheckConfig(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var isInternal bool = true + var expectedResponse = &monitoringpb.UptimeCheckConfig{ + Name: name, + DisplayName: displayName, + IsInternal: isInternal, + } + + mockUptimeCheck.err = nil + mockUptimeCheck.reqs = nil + + mockUptimeCheck.resps = append(mockUptimeCheck.resps[:0], expectedResponse) + + var uptimeCheckConfig *monitoringpb.UptimeCheckConfig = &monitoringpb.UptimeCheckConfig{} + var request = &monitoringpb.UpdateUptimeCheckConfigRequest{ + UptimeCheckConfig: uptimeCheckConfig, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateUptimeCheckConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockUptimeCheck.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestUptimeCheckServiceUpdateUptimeCheckConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockUptimeCheck.err = gstatus.Error(errCode, "test error") + + var uptimeCheckConfig *monitoringpb.UptimeCheckConfig = &monitoringpb.UptimeCheckConfig{} + var request = &monitoringpb.UpdateUptimeCheckConfigRequest{ + UptimeCheckConfig: uptimeCheckConfig, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateUptimeCheckConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestUptimeCheckServiceDeleteUptimeCheckConfig(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockUptimeCheck.err = nil + mockUptimeCheck.reqs = nil + + mockUptimeCheck.resps = append(mockUptimeCheck.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/uptimeCheckConfigs/%s", "[PROJECT]", "[UPTIME_CHECK_CONFIG]") + var request = &monitoringpb.DeleteUptimeCheckConfigRequest{ + Name: formattedName, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteUptimeCheckConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockUptimeCheck.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestUptimeCheckServiceDeleteUptimeCheckConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockUptimeCheck.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/uptimeCheckConfigs/%s", "[PROJECT]", "[UPTIME_CHECK_CONFIG]") + var request = &monitoringpb.DeleteUptimeCheckConfigRequest{ + Name: formattedName, + } + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteUptimeCheckConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestUptimeCheckServiceListUptimeCheckIps(t *testing.T) { + var nextPageToken string = "" + var uptimeCheckIpsElement *monitoringpb.UptimeCheckIp = &monitoringpb.UptimeCheckIp{} + var uptimeCheckIps = []*monitoringpb.UptimeCheckIp{uptimeCheckIpsElement} + var expectedResponse = &monitoringpb.ListUptimeCheckIpsResponse{ + NextPageToken: nextPageToken, + UptimeCheckIps: uptimeCheckIps, + } + + mockUptimeCheck.err = nil + mockUptimeCheck.reqs = nil + + mockUptimeCheck.resps = append(mockUptimeCheck.resps[:0], expectedResponse) + + var request *monitoringpb.ListUptimeCheckIpsRequest = &monitoringpb.ListUptimeCheckIpsRequest{} + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListUptimeCheckIps(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockUptimeCheck.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.UptimeCheckIps[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestUptimeCheckServiceListUptimeCheckIpsError(t *testing.T) { + errCode := codes.PermissionDenied + mockUptimeCheck.err = gstatus.Error(errCode, "test error") + + var request *monitoringpb.ListUptimeCheckIpsRequest = &monitoringpb.ListUptimeCheckIpsRequest{} + + c, err := NewUptimeCheckClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListUptimeCheckIps(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/notification_channel_client.go b/vendor/cloud.google.com/go/monitoring/apiv3/notification_channel_client.go new file mode 100644 index 000000000..eb82cc7bc --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/notification_channel_client.go @@ -0,0 +1,375 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// NotificationChannelCallOptions contains the retry settings for each method of NotificationChannelClient. +type NotificationChannelCallOptions struct { + ListNotificationChannelDescriptors []gax.CallOption + GetNotificationChannelDescriptor []gax.CallOption + ListNotificationChannels []gax.CallOption + GetNotificationChannel []gax.CallOption + CreateNotificationChannel []gax.CallOption + UpdateNotificationChannel []gax.CallOption + DeleteNotificationChannel []gax.CallOption +} + +func defaultNotificationChannelClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("monitoring.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultNotificationChannelCallOptions() *NotificationChannelCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &NotificationChannelCallOptions{ + ListNotificationChannelDescriptors: retry[[2]string{"default", "idempotent"}], + GetNotificationChannelDescriptor: retry[[2]string{"default", "idempotent"}], + ListNotificationChannels: retry[[2]string{"default", "idempotent"}], + GetNotificationChannel: retry[[2]string{"default", "idempotent"}], + CreateNotificationChannel: retry[[2]string{"default", "non_idempotent"}], + UpdateNotificationChannel: retry[[2]string{"default", "non_idempotent"}], + DeleteNotificationChannel: retry[[2]string{"default", "idempotent"}], + } +} + +// NotificationChannelClient is a client for interacting with Stackdriver Monitoring API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type NotificationChannelClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + notificationChannelClient monitoringpb.NotificationChannelServiceClient + + // The call options for this service. + CallOptions *NotificationChannelCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewNotificationChannelClient creates a new notification channel service client. +// +// The Notification Channel API provides access to configuration that +// controls how messages related to incidents are sent. +func NewNotificationChannelClient(ctx context.Context, opts ...option.ClientOption) (*NotificationChannelClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultNotificationChannelClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &NotificationChannelClient{ + conn: conn, + CallOptions: defaultNotificationChannelCallOptions(), + + notificationChannelClient: monitoringpb.NewNotificationChannelServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *NotificationChannelClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *NotificationChannelClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *NotificationChannelClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListNotificationChannelDescriptors lists the descriptors for supported channel types. The use of descriptors +// makes it possible for new channel types to be dynamically added. +func (c *NotificationChannelClient) ListNotificationChannelDescriptors(ctx context.Context, req *monitoringpb.ListNotificationChannelDescriptorsRequest, opts ...gax.CallOption) *NotificationChannelDescriptorIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListNotificationChannelDescriptors[0:len(c.CallOptions.ListNotificationChannelDescriptors):len(c.CallOptions.ListNotificationChannelDescriptors)], opts...) + it := &NotificationChannelDescriptorIterator{} + req = proto.Clone(req).(*monitoringpb.ListNotificationChannelDescriptorsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.NotificationChannelDescriptor, string, error) { + var resp *monitoringpb.ListNotificationChannelDescriptorsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.notificationChannelClient.ListNotificationChannelDescriptors(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.ChannelDescriptors, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetNotificationChannelDescriptor gets a single channel descriptor. The descriptor indicates which fields +// are expected / permitted for a notification channel of the given type. +func (c *NotificationChannelClient) GetNotificationChannelDescriptor(ctx context.Context, req *monitoringpb.GetNotificationChannelDescriptorRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannelDescriptor, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetNotificationChannelDescriptor[0:len(c.CallOptions.GetNotificationChannelDescriptor):len(c.CallOptions.GetNotificationChannelDescriptor)], opts...) + var resp *monitoringpb.NotificationChannelDescriptor + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.notificationChannelClient.GetNotificationChannelDescriptor(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListNotificationChannels lists the notification channels that have been created for the project. +func (c *NotificationChannelClient) ListNotificationChannels(ctx context.Context, req *monitoringpb.ListNotificationChannelsRequest, opts ...gax.CallOption) *NotificationChannelIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListNotificationChannels[0:len(c.CallOptions.ListNotificationChannels):len(c.CallOptions.ListNotificationChannels)], opts...) + it := &NotificationChannelIterator{} + req = proto.Clone(req).(*monitoringpb.ListNotificationChannelsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.NotificationChannel, string, error) { + var resp *monitoringpb.ListNotificationChannelsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.notificationChannelClient.ListNotificationChannels(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.NotificationChannels, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetNotificationChannel gets a single notification channel. The channel includes the relevant +// configuration details with which the channel was created. However, the +// response may truncate or omit passwords, API keys, or other private key +// matter and thus the response may not be 100% identical to the information +// that was supplied in the call to the create method. +func (c *NotificationChannelClient) GetNotificationChannel(ctx context.Context, req *monitoringpb.GetNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetNotificationChannel[0:len(c.CallOptions.GetNotificationChannel):len(c.CallOptions.GetNotificationChannel)], opts...) + var resp *monitoringpb.NotificationChannel + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.notificationChannelClient.GetNotificationChannel(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateNotificationChannel creates a new notification channel, representing a single notification +// endpoint such as an email address, SMS number, or PagerDuty service. +func (c *NotificationChannelClient) CreateNotificationChannel(ctx context.Context, req *monitoringpb.CreateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateNotificationChannel[0:len(c.CallOptions.CreateNotificationChannel):len(c.CallOptions.CreateNotificationChannel)], opts...) + var resp *monitoringpb.NotificationChannel + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.notificationChannelClient.CreateNotificationChannel(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateNotificationChannel updates a notification channel. Fields not specified in the field mask +// remain unchanged. +func (c *NotificationChannelClient) UpdateNotificationChannel(ctx context.Context, req *monitoringpb.UpdateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateNotificationChannel[0:len(c.CallOptions.UpdateNotificationChannel):len(c.CallOptions.UpdateNotificationChannel)], opts...) + var resp *monitoringpb.NotificationChannel + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.notificationChannelClient.UpdateNotificationChannel(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteNotificationChannel deletes a notification channel. +func (c *NotificationChannelClient) DeleteNotificationChannel(ctx context.Context, req *monitoringpb.DeleteNotificationChannelRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteNotificationChannel[0:len(c.CallOptions.DeleteNotificationChannel):len(c.CallOptions.DeleteNotificationChannel)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.notificationChannelClient.DeleteNotificationChannel(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// NotificationChannelDescriptorIterator manages a stream of *monitoringpb.NotificationChannelDescriptor. +type NotificationChannelDescriptorIterator struct { + items []*monitoringpb.NotificationChannelDescriptor + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoringpb.NotificationChannelDescriptor, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *NotificationChannelDescriptorIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *NotificationChannelDescriptorIterator) Next() (*monitoringpb.NotificationChannelDescriptor, error) { + var item *monitoringpb.NotificationChannelDescriptor + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *NotificationChannelDescriptorIterator) bufLen() int { + return len(it.items) +} + +func (it *NotificationChannelDescriptorIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// NotificationChannelIterator manages a stream of *monitoringpb.NotificationChannel. +type NotificationChannelIterator struct { + items []*monitoringpb.NotificationChannel + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoringpb.NotificationChannel, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *NotificationChannelIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *NotificationChannelIterator) Next() (*monitoringpb.NotificationChannel, error) { + var item *monitoringpb.NotificationChannel + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *NotificationChannelIterator) bufLen() int { + return len(it.items) +} + +func (it *NotificationChannelIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/notification_channel_client_example_test.go b/vendor/cloud.google.com/go/monitoring/apiv3/notification_channel_client_example_test.go new file mode 100644 index 000000000..e1915edc5 --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/notification_channel_client_example_test.go @@ -0,0 +1,171 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring_test + +import ( + "context" + + monitoring "cloud.google.com/go/monitoring/apiv3" + "google.golang.org/api/iterator" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" +) + +func ExampleNewNotificationChannelClient() { + ctx := context.Background() + c, err := monitoring.NewNotificationChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleNotificationChannelClient_ListNotificationChannelDescriptors() { + ctx := context.Background() + c, err := monitoring.NewNotificationChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListNotificationChannelDescriptorsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListNotificationChannelDescriptors(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleNotificationChannelClient_GetNotificationChannelDescriptor() { + ctx := context.Background() + c, err := monitoring.NewNotificationChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.GetNotificationChannelDescriptorRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetNotificationChannelDescriptor(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNotificationChannelClient_ListNotificationChannels() { + ctx := context.Background() + c, err := monitoring.NewNotificationChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListNotificationChannelsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListNotificationChannels(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleNotificationChannelClient_GetNotificationChannel() { + ctx := context.Background() + c, err := monitoring.NewNotificationChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.GetNotificationChannelRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetNotificationChannel(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNotificationChannelClient_CreateNotificationChannel() { + ctx := context.Background() + c, err := monitoring.NewNotificationChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.CreateNotificationChannelRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateNotificationChannel(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNotificationChannelClient_UpdateNotificationChannel() { + ctx := context.Background() + c, err := monitoring.NewNotificationChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.UpdateNotificationChannelRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateNotificationChannel(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleNotificationChannelClient_DeleteNotificationChannel() { + ctx := context.Background() + c, err := monitoring.NewNotificationChannelClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.DeleteNotificationChannelRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteNotificationChannel(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/path_funcs.go b/vendor/cloud.google.com/go/monitoring/apiv3/path_funcs.go new file mode 100644 index 000000000..b2b514ba5 --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/path_funcs.go @@ -0,0 +1,107 @@ +// 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 +// +// https://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 monitoring + +// GroupProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func GroupProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// GroupGroupPath returns the path for the group resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/groups/%s", project, group) +// instead. +func GroupGroupPath(project, group string) string { + return "" + + "projects/" + + project + + "/groups/" + + group + + "" +} + +// MetricProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func MetricProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// MetricMetricDescriptorPath returns the path for the metric descriptor resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/metricDescriptors/%s", project, metricDescriptor) +// instead. +func MetricMetricDescriptorPath(project, metricDescriptor string) string { + return "" + + "projects/" + + project + + "/metricDescriptors/" + + metricDescriptor + + "" +} + +// MetricMonitoredResourceDescriptorPath returns the path for the monitored resource descriptor resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/monitoredResourceDescriptors/%s", project, monitoredResourceDescriptor) +// instead. +func MetricMonitoredResourceDescriptorPath(project, monitoredResourceDescriptor string) string { + return "" + + "projects/" + + project + + "/monitoredResourceDescriptors/" + + monitoredResourceDescriptor + + "" +} + +// UptimeCheckProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func UptimeCheckProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// UptimeCheckUptimeCheckConfigPath returns the path for the uptime check config resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/uptimeCheckConfigs/%s", project, uptimeCheckConfig) +// instead. +func UptimeCheckUptimeCheckConfigPath(project, uptimeCheckConfig string) string { + return "" + + "projects/" + + project + + "/uptimeCheckConfigs/" + + uptimeCheckConfig + + "" +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/uptime_check_client.go b/vendor/cloud.google.com/go/monitoring/apiv3/uptime_check_client.go new file mode 100644 index 000000000..07a7ab813 --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/uptime_check_client.go @@ -0,0 +1,361 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// UptimeCheckCallOptions contains the retry settings for each method of UptimeCheckClient. +type UptimeCheckCallOptions struct { + ListUptimeCheckConfigs []gax.CallOption + GetUptimeCheckConfig []gax.CallOption + CreateUptimeCheckConfig []gax.CallOption + UpdateUptimeCheckConfig []gax.CallOption + DeleteUptimeCheckConfig []gax.CallOption + ListUptimeCheckIps []gax.CallOption +} + +func defaultUptimeCheckClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("monitoring.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultUptimeCheckCallOptions() *UptimeCheckCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &UptimeCheckCallOptions{ + ListUptimeCheckConfigs: retry[[2]string{"default", "idempotent"}], + GetUptimeCheckConfig: retry[[2]string{"default", "idempotent"}], + CreateUptimeCheckConfig: retry[[2]string{"default", "non_idempotent"}], + UpdateUptimeCheckConfig: retry[[2]string{"default", "non_idempotent"}], + DeleteUptimeCheckConfig: retry[[2]string{"default", "idempotent"}], + ListUptimeCheckIps: retry[[2]string{"default", "idempotent"}], + } +} + +// UptimeCheckClient is a client for interacting with Stackdriver Monitoring API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type UptimeCheckClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + uptimeCheckClient monitoringpb.UptimeCheckServiceClient + + // The call options for this service. + CallOptions *UptimeCheckCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewUptimeCheckClient creates a new uptime check service client. +// +// The UptimeCheckService API is used to manage (list, create, delete, edit) +// uptime check configurations in the Stackdriver Monitoring product. An uptime +// check is a piece of configuration that determines which resources and +// services to monitor for availability. These configurations can also be +// configured interactively by navigating to the [Cloud Console] +// (http://console.cloud.google.com), selecting the appropriate project, +// clicking on "Monitoring" on the left-hand side to navigate to Stackdriver, +// and then clicking on "Uptime". +func NewUptimeCheckClient(ctx context.Context, opts ...option.ClientOption) (*UptimeCheckClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultUptimeCheckClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &UptimeCheckClient{ + conn: conn, + CallOptions: defaultUptimeCheckCallOptions(), + + uptimeCheckClient: monitoringpb.NewUptimeCheckServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *UptimeCheckClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *UptimeCheckClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *UptimeCheckClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListUptimeCheckConfigs lists the existing valid uptime check configurations for the project, +// leaving out any invalid configurations. +func (c *UptimeCheckClient) ListUptimeCheckConfigs(ctx context.Context, req *monitoringpb.ListUptimeCheckConfigsRequest, opts ...gax.CallOption) *UptimeCheckConfigIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListUptimeCheckConfigs[0:len(c.CallOptions.ListUptimeCheckConfigs):len(c.CallOptions.ListUptimeCheckConfigs)], opts...) + it := &UptimeCheckConfigIterator{} + req = proto.Clone(req).(*monitoringpb.ListUptimeCheckConfigsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.UptimeCheckConfig, string, error) { + var resp *monitoringpb.ListUptimeCheckConfigsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.uptimeCheckClient.ListUptimeCheckConfigs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.UptimeCheckConfigs, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetUptimeCheckConfig gets a single uptime check configuration. +func (c *UptimeCheckClient) GetUptimeCheckConfig(ctx context.Context, req *monitoringpb.GetUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetUptimeCheckConfig[0:len(c.CallOptions.GetUptimeCheckConfig):len(c.CallOptions.GetUptimeCheckConfig)], opts...) + var resp *monitoringpb.UptimeCheckConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.uptimeCheckClient.GetUptimeCheckConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateUptimeCheckConfig creates a new uptime check configuration. +func (c *UptimeCheckClient) CreateUptimeCheckConfig(ctx context.Context, req *monitoringpb.CreateUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateUptimeCheckConfig[0:len(c.CallOptions.CreateUptimeCheckConfig):len(c.CallOptions.CreateUptimeCheckConfig)], opts...) + var resp *monitoringpb.UptimeCheckConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.uptimeCheckClient.CreateUptimeCheckConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateUptimeCheckConfig updates an uptime check configuration. You can either replace the entire +// configuration with a new one or replace only certain fields in the current +// configuration by specifying the fields to be updated via "updateMask". +// Returns the updated configuration. +func (c *UptimeCheckClient) UpdateUptimeCheckConfig(ctx context.Context, req *monitoringpb.UpdateUptimeCheckConfigRequest, opts ...gax.CallOption) (*monitoringpb.UptimeCheckConfig, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateUptimeCheckConfig[0:len(c.CallOptions.UpdateUptimeCheckConfig):len(c.CallOptions.UpdateUptimeCheckConfig)], opts...) + var resp *monitoringpb.UptimeCheckConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.uptimeCheckClient.UpdateUptimeCheckConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteUptimeCheckConfig deletes an uptime check configuration. Note that this method will fail +// if the uptime check configuration is referenced by an alert policy or +// other dependent configs that would be rendered invalid by the deletion. +func (c *UptimeCheckClient) DeleteUptimeCheckConfig(ctx context.Context, req *monitoringpb.DeleteUptimeCheckConfigRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteUptimeCheckConfig[0:len(c.CallOptions.DeleteUptimeCheckConfig):len(c.CallOptions.DeleteUptimeCheckConfig)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.uptimeCheckClient.DeleteUptimeCheckConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListUptimeCheckIps returns the list of IPs that checkers run from +func (c *UptimeCheckClient) ListUptimeCheckIps(ctx context.Context, req *monitoringpb.ListUptimeCheckIpsRequest, opts ...gax.CallOption) *UptimeCheckIpIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListUptimeCheckIps[0:len(c.CallOptions.ListUptimeCheckIps):len(c.CallOptions.ListUptimeCheckIps)], opts...) + it := &UptimeCheckIpIterator{} + req = proto.Clone(req).(*monitoringpb.ListUptimeCheckIpsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.UptimeCheckIp, string, error) { + var resp *monitoringpb.ListUptimeCheckIpsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.uptimeCheckClient.ListUptimeCheckIps(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.UptimeCheckIps, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// UptimeCheckConfigIterator manages a stream of *monitoringpb.UptimeCheckConfig. +type UptimeCheckConfigIterator struct { + items []*monitoringpb.UptimeCheckConfig + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoringpb.UptimeCheckConfig, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *UptimeCheckConfigIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *UptimeCheckConfigIterator) Next() (*monitoringpb.UptimeCheckConfig, error) { + var item *monitoringpb.UptimeCheckConfig + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *UptimeCheckConfigIterator) bufLen() int { + return len(it.items) +} + +func (it *UptimeCheckConfigIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// UptimeCheckIpIterator manages a stream of *monitoringpb.UptimeCheckIp. +type UptimeCheckIpIterator struct { + items []*monitoringpb.UptimeCheckIp + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*monitoringpb.UptimeCheckIp, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *UptimeCheckIpIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *UptimeCheckIpIterator) Next() (*monitoringpb.UptimeCheckIp, error) { + var item *monitoringpb.UptimeCheckIp + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *UptimeCheckIpIterator) bufLen() int { + return len(it.items) +} + +func (it *UptimeCheckIpIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/monitoring/apiv3/uptime_check_client_example_test.go b/vendor/cloud.google.com/go/monitoring/apiv3/uptime_check_client_example_test.go new file mode 100644 index 000000000..f04a3585a --- /dev/null +++ b/vendor/cloud.google.com/go/monitoring/apiv3/uptime_check_client_example_test.go @@ -0,0 +1,153 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package monitoring_test + +import ( + "context" + + monitoring "cloud.google.com/go/monitoring/apiv3" + "google.golang.org/api/iterator" + monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3" +) + +func ExampleNewUptimeCheckClient() { + ctx := context.Background() + c, err := monitoring.NewUptimeCheckClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleUptimeCheckClient_ListUptimeCheckConfigs() { + ctx := context.Background() + c, err := monitoring.NewUptimeCheckClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListUptimeCheckConfigsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListUptimeCheckConfigs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleUptimeCheckClient_GetUptimeCheckConfig() { + ctx := context.Background() + c, err := monitoring.NewUptimeCheckClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.GetUptimeCheckConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetUptimeCheckConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUptimeCheckClient_CreateUptimeCheckConfig() { + ctx := context.Background() + c, err := monitoring.NewUptimeCheckClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.CreateUptimeCheckConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateUptimeCheckConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUptimeCheckClient_UpdateUptimeCheckConfig() { + ctx := context.Background() + c, err := monitoring.NewUptimeCheckClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.UpdateUptimeCheckConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateUptimeCheckConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleUptimeCheckClient_DeleteUptimeCheckConfig() { + ctx := context.Background() + c, err := monitoring.NewUptimeCheckClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.DeleteUptimeCheckConfigRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteUptimeCheckConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleUptimeCheckClient_ListUptimeCheckIps() { + ctx := context.Background() + c, err := monitoring.NewUptimeCheckClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &monitoringpb.ListUptimeCheckIpsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListUptimeCheckIps(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/vendor/cloud.google.com/go/old-news.md b/vendor/cloud.google.com/go/old-news.md new file mode 100644 index 000000000..6a8b84d7f --- /dev/null +++ b/vendor/cloud.google.com/go/old-news.md @@ -0,0 +1,698 @@ +_February 26, 2018_ + +*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. + + +_January 18, 2018_ + +*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). + + +_December 11, 2017_ + +*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". + + +_October 30, 2017_ + +*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. + + +_October 3, 2017_ + +*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. + + +_September 28, 2017_ + +*v0.14.0* + +- bigquery BREAKING CHANGES: + - Standard SQL is the default for queries and views. + - `Table.Create` takes `TableMetadata` as a second argument, instead of + options. + - `Dataset.Create` takes `DatasetMetadata` as a second argument. + - `DatasetMetadata` field `ID` renamed to `FullID` + - `TableMetadata` field `ID` renamed to `FullID` + +- Other bigquery changes: + - The client will append a random suffix to a provided job ID if you set + `AddJobIDSuffix` to true in a job config. + - Listing jobs is supported. + - Better retry logic. + +- vision, language, speech: clients are now stable + +- monitoring: client is now beta + +- profiler: + - Rename InstanceName to Instance, ZoneName to Zone + - Auto-detect service name and version on AppEngine. + +_September 8, 2017_ + +*v0.13.0* + +- bigquery: UseLegacySQL options for CreateTable and QueryConfig. Use these + options to continue using Legacy SQL after the client switches its default + to Standard SQL. + +- bigquery: Support for updating dataset labels. + +- bigquery: Set DatasetIterator.ProjectID to list datasets in a project other + than the client's. DatasetsInProject is no longer needed and is deprecated. + +- bigtable: Fail ListInstances when any zones fail. + +- spanner: support decoding of slices of basic types (e.g. []string, []int64, + etc.) + +- logging/logadmin: UpdateSink no longer creates a sink if it is missing + (actually a change to the underlying service, not the client) + +- profiler: Service and ServiceVersion replace Target in Config. + +_August 22, 2017_ + +*v0.12.0* + +- pubsub: Subscription.Receive now uses streaming pull. + +- pubsub: add Client.TopicInProject to access topics in a different project + than the client. + +- errors: renamed errorreporting. The errors package will be removed shortly. + +- datastore: improved retry behavior. + +- bigquery: support updates to dataset metadata, with etags. + +- bigquery: add etag support to Table.Update (BREAKING: etag argument added). + +- bigquery: generate all job IDs on the client. + +- storage: support bucket lifecycle configurations. + + +_July 31, 2017_ + +*v0.11.0* + +- Clients for spanner, pubsub and video are now in beta. + +- New client for DLP. + +- spanner: performance and testing improvements. + +- storage: requester-pays buckets are supported. + +- storage, profiler, bigtable, bigquery: bug fixes and other minor improvements. + +- pubsub: bug fixes and other minor improvements + +_June 17, 2017_ + + +*v0.10.0* + +- pubsub: Subscription.ModifyPushConfig replaced with Subscription.Update. + +- pubsub: Subscription.Receive now runs concurrently for higher throughput. + +- vision: cloud.google.com/go/vision is deprecated. Use +cloud.google.com/go/vision/apiv1 instead. + +- translation: now stable. + +- trace: several changes to the surface. See the link below. + +[Code changes required from v0.9.0.](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/MIGRATION.md) + + +_March 17, 2017_ + +Breaking Pubsub changes. +* Publish is now asynchronous +([announcement](https://groups.google.com/d/topic/google-api-go-announce/aaqRDIQ3rvU/discussion)). +* Subscription.Pull replaced by Subscription.Receive, which takes a callback ([announcement](https://groups.google.com/d/topic/google-api-go-announce/8pt6oetAdKc/discussion)). +* Message.Done replaced with Message.Ack and Message.Nack. + +_February 14, 2017_ + +Release of a client library for Spanner. See +the +[blog post](https://cloudplatform.googleblog.com/2017/02/introducing-Cloud-Spanner-a-global-database-service-for-mission-critical-applications.html). + +Note that although the Spanner service is beta, the Go client library is alpha. + +_December 12, 2016_ + +Beta release of BigQuery, DataStore, Logging and Storage. See the +[blog post](https://cloudplatform.googleblog.com/2016/12/announcing-new-google-cloud-client.html). + +Also, BigQuery now supports structs. Read a row directly into a struct with +`RowIterator.Next`, and upload a row directly from a struct with `Uploader.Put`. +You can also use field tags. See the [package documentation][cloud-bigquery-ref] +for details. + +_December 5, 2016_ + +More changes to BigQuery: + +* The `ValueList` type was removed. It is no longer necessary. Instead of + ```go + var v ValueList + ... it.Next(&v) .. + ``` + use + + ```go + var v []Value + ... it.Next(&v) ... + ``` + +* Previously, repeatedly calling `RowIterator.Next` on the same `[]Value` or + `ValueList` would append to the slice. Now each call resets the size to zero first. + +* Schema inference will infer the SQL type BYTES for a struct field of + type []byte. Previously it inferred STRING. + +* The types `uint`, `uint64` and `uintptr` are no longer supported in schema + inference. BigQuery's integer type is INT64, and those types may hold values + that are not correctly represented in a 64-bit signed integer. + +* The SQL types DATE, TIME and DATETIME are now supported. They correspond to + the `Date`, `Time` and `DateTime` types in the new `cloud.google.com/go/civil` + package. + +_November 17, 2016_ + +Change to BigQuery: values from INTEGER columns will now be returned as int64, +not int. This will avoid errors arising from large values on 32-bit systems. + +_November 8, 2016_ + +New datastore feature: datastore now encodes your nested Go structs as Entity values, +instead of a flattened list of the embedded struct's fields. +This means that you may now have twice-nested slices, eg. +```go +type State struct { + Cities []struct{ + Populations []int + } +} +``` + +See [the announcement](https://groups.google.com/forum/#!topic/google-api-go-announce/79jtrdeuJAg) for +more details. + +_November 8, 2016_ + +Breaking changes to datastore: contexts no longer hold namespaces; instead you +must set a key's namespace explicitly. Also, key functions have been changed +and renamed. + +* The WithNamespace function has been removed. To specify a namespace in a Query, use the Query.Namespace method: + ```go + q := datastore.NewQuery("Kind").Namespace("ns") + ``` + +* All the fields of Key are exported. That means you can construct any Key with a struct literal: + ```go + k := &Key{Kind: "Kind", ID: 37, Namespace: "ns"} + ``` + +* As a result of the above, the Key methods Kind, ID, d.Name, Parent, SetParent and Namespace have been removed. + +* `NewIncompleteKey` has been removed, replaced by `IncompleteKey`. Replace + ```go + NewIncompleteKey(ctx, kind, parent) + ``` + with + ```go + IncompleteKey(kind, parent) + ``` + and if you do use namespaces, make sure you set the namespace on the returned key. + +* `NewKey` has been removed, replaced by `NameKey` and `IDKey`. Replace + ```go + NewKey(ctx, kind, name, 0, parent) + NewKey(ctx, kind, "", id, parent) + ``` + with + ```go + NameKey(kind, name, parent) + IDKey(kind, id, parent) + ``` + and if you do use namespaces, make sure you set the namespace on the returned key. + +* The `Done` variable has been removed. Replace `datastore.Done` with `iterator.Done`, from the package `google.golang.org/api/iterator`. + +* The `Client.Close` method will have a return type of error. It will return the result of closing the underlying gRPC connection. + +See [the announcement](https://groups.google.com/forum/#!topic/google-api-go-announce/hqXtM_4Ix-0) for +more details. + +_October 27, 2016_ + +Breaking change to bigquery: `NewGCSReference` is now a function, +not a method on `Client`. + +New bigquery feature: `Table.LoaderFrom` now accepts a `ReaderSource`, enabling +loading data into a table from a file or any `io.Reader`. + +_October 21, 2016_ + +Breaking change to pubsub: removed `pubsub.Done`. + +Use `iterator.Done` instead, where `iterator` is the package +`google.golang.org/api/iterator`. + +_October 19, 2016_ + +Breaking changes to cloud.google.com/go/bigquery: + +* Client.Table and Client.OpenTable have been removed. + Replace + ```go + client.OpenTable("project", "dataset", "table") + ``` + with + ```go + client.DatasetInProject("project", "dataset").Table("table") + ``` + +* Client.CreateTable has been removed. + Replace + ```go + client.CreateTable(ctx, "project", "dataset", "table") + ``` + with + ```go + client.DatasetInProject("project", "dataset").Table("table").Create(ctx) + ``` + +* Dataset.ListTables have been replaced with Dataset.Tables. + Replace + ```go + tables, err := ds.ListTables(ctx) + ``` + with + ```go + it := ds.Tables(ctx) + for { + table, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: use table. + } + ``` + +* Client.Read has been replaced with Job.Read, Table.Read and Query.Read. + Replace + ```go + it, err := client.Read(ctx, job) + ``` + with + ```go + it, err := job.Read(ctx) + ``` + and similarly for reading from tables or queries. + +* The iterator returned from the Read methods is now named RowIterator. Its + behavior is closer to the other iterators in these libraries. It no longer + supports the Schema method; see the next item. + Replace + ```go + for it.Next(ctx) { + var vals ValueList + if err := it.Get(&vals); err != nil { + // TODO: Handle error. + } + // TODO: use vals. + } + if err := it.Err(); err != nil { + // TODO: Handle error. + } + ``` + with + ``` + for { + var vals ValueList + err := it.Next(&vals) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: use vals. + } + ``` + Instead of the `RecordsPerRequest(n)` option, write + ```go + it.PageInfo().MaxSize = n + ``` + Instead of the `StartIndex(i)` option, write + ```go + it.StartIndex = i + ``` + +* ValueLoader.Load now takes a Schema in addition to a slice of Values. + Replace + ```go + func (vl *myValueLoader) Load(v []bigquery.Value) + ``` + with + ```go + func (vl *myValueLoader) Load(v []bigquery.Value, s bigquery.Schema) + ``` + + +* Table.Patch is replace by Table.Update. + Replace + ```go + p := table.Patch() + p.Description("new description") + metadata, err := p.Apply(ctx) + ``` + with + ```go + metadata, err := table.Update(ctx, bigquery.TableMetadataToUpdate{ + Description: "new description", + }) + ``` + +* Client.Copy is replaced by separate methods for each of its four functions. + All options have been replaced by struct fields. + + * To load data from Google Cloud Storage into a table, use Table.LoaderFrom. + + Replace + ```go + client.Copy(ctx, table, gcsRef) + ``` + with + ```go + table.LoaderFrom(gcsRef).Run(ctx) + ``` + Instead of passing options to Copy, set fields on the Loader: + ```go + loader := table.LoaderFrom(gcsRef) + loader.WriteDisposition = bigquery.WriteTruncate + ``` + + * To extract data from a table into Google Cloud Storage, use + Table.ExtractorTo. Set fields on the returned Extractor instead of + passing options. + + Replace + ```go + client.Copy(ctx, gcsRef, table) + ``` + with + ```go + table.ExtractorTo(gcsRef).Run(ctx) + ``` + + * To copy data into a table from one or more other tables, use + Table.CopierFrom. Set fields on the returned Copier instead of passing options. + + Replace + ```go + client.Copy(ctx, dstTable, srcTable) + ``` + with + ```go + dst.Table.CopierFrom(srcTable).Run(ctx) + ``` + + * To start a query job, create a Query and call its Run method. Set fields + on the query instead of passing options. + + Replace + ```go + client.Copy(ctx, table, query) + ``` + with + ```go + query.Run(ctx) + ``` + +* Table.NewUploader has been renamed to Table.Uploader. Instead of options, + configure an Uploader by setting its fields. + Replace + ```go + u := table.NewUploader(bigquery.UploadIgnoreUnknownValues()) + ``` + with + ```go + u := table.NewUploader(bigquery.UploadIgnoreUnknownValues()) + u.IgnoreUnknownValues = true + ``` + +_October 10, 2016_ + +Breaking changes to cloud.google.com/go/storage: + +* AdminClient replaced by methods on Client. + Replace + ```go + adminClient.CreateBucket(ctx, bucketName, attrs) + ``` + with + ```go + client.Bucket(bucketName).Create(ctx, projectID, attrs) + ``` + +* BucketHandle.List replaced by BucketHandle.Objects. + Replace + ```go + for query != nil { + objs, err := bucket.List(d.ctx, query) + if err != nil { ... } + query = objs.Next + for _, obj := range objs.Results { + fmt.Println(obj) + } + } + ``` + with + ```go + iter := bucket.Objects(d.ctx, query) + for { + obj, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { ... } + fmt.Println(obj) + } + ``` + (The `iterator` package is at `google.golang.org/api/iterator`.) + + Replace `Query.Cursor` with `ObjectIterator.PageInfo().Token`. + + Replace `Query.MaxResults` with `ObjectIterator.PageInfo().MaxSize`. + + +* ObjectHandle.CopyTo replaced by ObjectHandle.CopierFrom. + Replace + ```go + attrs, err := src.CopyTo(ctx, dst, nil) + ``` + with + ```go + attrs, err := dst.CopierFrom(src).Run(ctx) + ``` + + Replace + ```go + attrs, err := src.CopyTo(ctx, dst, &storage.ObjectAttrs{ContextType: "text/html"}) + ``` + with + ```go + c := dst.CopierFrom(src) + c.ContextType = "text/html" + attrs, err := c.Run(ctx) + ``` + +* ObjectHandle.ComposeFrom replaced by ObjectHandle.ComposerFrom. + Replace + ```go + attrs, err := dst.ComposeFrom(ctx, []*storage.ObjectHandle{src1, src2}, nil) + ``` + with + ```go + attrs, err := dst.ComposerFrom(src1, src2).Run(ctx) + ``` + +* ObjectHandle.Update's ObjectAttrs argument replaced by ObjectAttrsToUpdate. + Replace + ```go + attrs, err := obj.Update(ctx, &storage.ObjectAttrs{ContextType: "text/html"}) + ``` + with + ```go + attrs, err := obj.Update(ctx, storage.ObjectAttrsToUpdate{ContextType: "text/html"}) + ``` + +* ObjectHandle.WithConditions replaced by ObjectHandle.If. + Replace + ```go + obj.WithConditions(storage.Generation(gen), storage.IfMetaGenerationMatch(mgen)) + ``` + with + ```go + obj.Generation(gen).If(storage.Conditions{MetagenerationMatch: mgen}) + ``` + + Replace + ```go + obj.WithConditions(storage.IfGenerationMatch(0)) + ``` + with + ```go + obj.If(storage.Conditions{DoesNotExist: true}) + ``` + +* `storage.Done` replaced by `iterator.Done` (from package `google.golang.org/api/iterator`). + +_October 6, 2016_ + +Package preview/logging deleted. Use logging instead. + +_September 27, 2016_ + +Logging client replaced with preview version (see below). + +_September 8, 2016_ + +* New clients for some of Google's Machine Learning APIs: Vision, Speech, and +Natural Language. + +* Preview version of a new [Stackdriver Logging][cloud-logging] client in +[`cloud.google.com/go/preview/logging`](https://godoc.org/cloud.google.com/go/preview/logging). +This client uses gRPC as its transport layer, and supports log reading, sinks +and metrics. It will replace the current client at `cloud.google.com/go/logging` shortly. + diff --git a/vendor/cloud.google.com/go/oslogin/apiv1/doc.go b/vendor/cloud.google.com/go/oslogin/apiv1/doc.go new file mode 100644 index 000000000..0e4e2f9a5 --- /dev/null +++ b/vendor/cloud.google.com/go/oslogin/apiv1/doc.go @@ -0,0 +1,92 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package oslogin is an auto-generated package for the +// Google Cloud OS Login API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Manages OS login configuration for Google account users. +package oslogin // import "cloud.google.com/go/oslogin/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/oslogin/apiv1/mock_test.go b/vendor/cloud.google.com/go/oslogin/apiv1/mock_test.go new file mode 100644 index 000000000..705fa48e4 --- /dev/null +++ b/vendor/cloud.google.com/go/oslogin/apiv1/mock_test.go @@ -0,0 +1,520 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package oslogin + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + commonpb "google.golang.org/genproto/googleapis/cloud/oslogin/common" + osloginpb "google.golang.org/genproto/googleapis/cloud/oslogin/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockOsLoginServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + osloginpb.OsLoginServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockOsLoginServer) DeletePosixAccount(ctx context.Context, req *osloginpb.DeletePosixAccountRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockOsLoginServer) DeleteSshPublicKey(ctx context.Context, req *osloginpb.DeleteSshPublicKeyRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockOsLoginServer) GetLoginProfile(ctx context.Context, req *osloginpb.GetLoginProfileRequest) (*osloginpb.LoginProfile, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*osloginpb.LoginProfile), nil +} + +func (s *mockOsLoginServer) GetSshPublicKey(ctx context.Context, req *osloginpb.GetSshPublicKeyRequest) (*commonpb.SshPublicKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*commonpb.SshPublicKey), nil +} + +func (s *mockOsLoginServer) ImportSshPublicKey(ctx context.Context, req *osloginpb.ImportSshPublicKeyRequest) (*osloginpb.ImportSshPublicKeyResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*osloginpb.ImportSshPublicKeyResponse), nil +} + +func (s *mockOsLoginServer) UpdateSshPublicKey(ctx context.Context, req *osloginpb.UpdateSshPublicKeyRequest) (*commonpb.SshPublicKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*commonpb.SshPublicKey), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockOsLogin mockOsLoginServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + osloginpb.RegisterOsLoginServiceServer(serv, &mockOsLogin) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestOsLoginServiceDeletePosixAccount(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s/projects/%s", "[USER]", "[PROJECT]") + var request = &osloginpb.DeletePosixAccountRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeletePosixAccount(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestOsLoginServiceDeletePosixAccountError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s/projects/%s", "[USER]", "[PROJECT]") + var request = &osloginpb.DeletePosixAccountRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeletePosixAccount(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestOsLoginServiceDeleteSshPublicKey(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var request = &osloginpb.DeleteSshPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSshPublicKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestOsLoginServiceDeleteSshPublicKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var request = &osloginpb.DeleteSshPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSshPublicKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestOsLoginServiceGetLoginProfile(t *testing.T) { + var name2 string = "name2-1052831874" + var suspended bool = false + var expectedResponse = &osloginpb.LoginProfile{ + Name: name2, + Suspended: suspended, + } + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s", "[USER]") + var request = &osloginpb.GetLoginProfileRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetLoginProfile(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOsLoginServiceGetLoginProfileError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s", "[USER]") + var request = &osloginpb.GetLoginProfileRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetLoginProfile(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestOsLoginServiceGetSshPublicKey(t *testing.T) { + var key string = "key106079" + var expirationTimeUsec int64 = 2058878882 + var fingerprint string = "fingerprint-1375934236" + var expectedResponse = &commonpb.SshPublicKey{ + Key: key, + ExpirationTimeUsec: expirationTimeUsec, + Fingerprint: fingerprint, + } + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var request = &osloginpb.GetSshPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSshPublicKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOsLoginServiceGetSshPublicKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var request = &osloginpb.GetSshPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSshPublicKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestOsLoginServiceImportSshPublicKey(t *testing.T) { + var expectedResponse *osloginpb.ImportSshPublicKeyResponse = &osloginpb.ImportSshPublicKeyResponse{} + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("users/%s", "[USER]") + var sshPublicKey *commonpb.SshPublicKey = &commonpb.SshPublicKey{} + var request = &osloginpb.ImportSshPublicKeyRequest{ + Parent: formattedParent, + SshPublicKey: sshPublicKey, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ImportSshPublicKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOsLoginServiceImportSshPublicKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("users/%s", "[USER]") + var sshPublicKey *commonpb.SshPublicKey = &commonpb.SshPublicKey{} + var request = &osloginpb.ImportSshPublicKeyRequest{ + Parent: formattedParent, + SshPublicKey: sshPublicKey, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ImportSshPublicKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestOsLoginServiceUpdateSshPublicKey(t *testing.T) { + var key string = "key106079" + var expirationTimeUsec int64 = 2058878882 + var fingerprint string = "fingerprint-1375934236" + var expectedResponse = &commonpb.SshPublicKey{ + Key: key, + ExpirationTimeUsec: expirationTimeUsec, + Fingerprint: fingerprint, + } + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var sshPublicKey *commonpb.SshPublicKey = &commonpb.SshPublicKey{} + var request = &osloginpb.UpdateSshPublicKeyRequest{ + Name: formattedName, + SshPublicKey: sshPublicKey, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSshPublicKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOsLoginServiceUpdateSshPublicKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var sshPublicKey *commonpb.SshPublicKey = &commonpb.SshPublicKey{} + var request = &osloginpb.UpdateSshPublicKeyRequest{ + Name: formattedName, + SshPublicKey: sshPublicKey, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSshPublicKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/oslogin/apiv1/os_login_client.go b/vendor/cloud.google.com/go/oslogin/apiv1/os_login_client.go new file mode 100644 index 000000000..ee0a09c24 --- /dev/null +++ b/vendor/cloud.google.com/go/oslogin/apiv1/os_login_client.go @@ -0,0 +1,223 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package oslogin + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + commonpb "google.golang.org/genproto/googleapis/cloud/oslogin/common" + osloginpb "google.golang.org/genproto/googleapis/cloud/oslogin/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + DeletePosixAccount []gax.CallOption + DeleteSshPublicKey []gax.CallOption + GetLoginProfile []gax.CallOption + GetSshPublicKey []gax.CallOption + ImportSshPublicKey []gax.CallOption + UpdateSshPublicKey []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("oslogin.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + DeletePosixAccount: retry[[2]string{"default", "idempotent"}], + DeleteSshPublicKey: retry[[2]string{"default", "idempotent"}], + GetLoginProfile: retry[[2]string{"default", "idempotent"}], + GetSshPublicKey: retry[[2]string{"default", "idempotent"}], + ImportSshPublicKey: retry[[2]string{"default", "idempotent"}], + UpdateSshPublicKey: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Google Cloud OS Login API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client osloginpb.OsLoginServiceClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new os login service client. +// +// Cloud OS Login API +// +// The Cloud OS Login API allows you to manage users and their associated SSH +// public keys for logging into virtual machines on Google Cloud Platform. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: osloginpb.NewOsLoginServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// DeletePosixAccount deletes a POSIX account. +func (c *Client) DeletePosixAccount(ctx context.Context, req *osloginpb.DeletePosixAccountRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeletePosixAccount[0:len(c.CallOptions.DeletePosixAccount):len(c.CallOptions.DeletePosixAccount)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeletePosixAccount(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// DeleteSshPublicKey deletes an SSH public key. +func (c *Client) DeleteSshPublicKey(ctx context.Context, req *osloginpb.DeleteSshPublicKeyRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteSshPublicKey[0:len(c.CallOptions.DeleteSshPublicKey):len(c.CallOptions.DeleteSshPublicKey)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteSshPublicKey(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// GetLoginProfile retrieves the profile information used for logging in to a virtual machine +// on Google Compute Engine. +func (c *Client) GetLoginProfile(ctx context.Context, req *osloginpb.GetLoginProfileRequest, opts ...gax.CallOption) (*osloginpb.LoginProfile, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetLoginProfile[0:len(c.CallOptions.GetLoginProfile):len(c.CallOptions.GetLoginProfile)], opts...) + var resp *osloginpb.LoginProfile + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetLoginProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetSshPublicKey retrieves an SSH public key. +func (c *Client) GetSshPublicKey(ctx context.Context, req *osloginpb.GetSshPublicKeyRequest, opts ...gax.CallOption) (*commonpb.SshPublicKey, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetSshPublicKey[0:len(c.CallOptions.GetSshPublicKey):len(c.CallOptions.GetSshPublicKey)], opts...) + var resp *commonpb.SshPublicKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetSshPublicKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ImportSshPublicKey adds an SSH public key and returns the profile information. Default POSIX +// account information is set when no username and UID exist as part of the +// login profile. +func (c *Client) ImportSshPublicKey(ctx context.Context, req *osloginpb.ImportSshPublicKeyRequest, opts ...gax.CallOption) (*osloginpb.ImportSshPublicKeyResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ImportSshPublicKey[0:len(c.CallOptions.ImportSshPublicKey):len(c.CallOptions.ImportSshPublicKey)], opts...) + var resp *osloginpb.ImportSshPublicKeyResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ImportSshPublicKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateSshPublicKey updates an SSH public key and returns the profile information. This method +// supports patch semantics. +func (c *Client) UpdateSshPublicKey(ctx context.Context, req *osloginpb.UpdateSshPublicKeyRequest, opts ...gax.CallOption) (*commonpb.SshPublicKey, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateSshPublicKey[0:len(c.CallOptions.UpdateSshPublicKey):len(c.CallOptions.UpdateSshPublicKey)], opts...) + var resp *commonpb.SshPublicKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateSshPublicKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/oslogin/apiv1/os_login_client_example_test.go b/vendor/cloud.google.com/go/oslogin/apiv1/os_login_client_example_test.go new file mode 100644 index 000000000..86da7f115 --- /dev/null +++ b/vendor/cloud.google.com/go/oslogin/apiv1/os_login_client_example_test.go @@ -0,0 +1,138 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package oslogin_test + +import ( + "context" + + oslogin "cloud.google.com/go/oslogin/apiv1" + osloginpb "google.golang.org/genproto/googleapis/cloud/oslogin/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_DeletePosixAccount() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.DeletePosixAccountRequest{ + // TODO: Fill request struct fields. + } + err = c.DeletePosixAccount(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_DeleteSshPublicKey() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.DeleteSshPublicKeyRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteSshPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_GetLoginProfile() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.GetLoginProfileRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetLoginProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetSshPublicKey() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.GetSshPublicKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSshPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ImportSshPublicKey() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.ImportSshPublicKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ImportSshPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateSshPublicKey() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.UpdateSshPublicKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateSshPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/oslogin/apiv1beta/doc.go b/vendor/cloud.google.com/go/oslogin/apiv1beta/doc.go new file mode 100644 index 000000000..fa88aff37 --- /dev/null +++ b/vendor/cloud.google.com/go/oslogin/apiv1beta/doc.go @@ -0,0 +1,92 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package oslogin is an auto-generated package for the +// Google Cloud OS Login API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Manages OS login configuration for Google account users. +package oslogin // import "cloud.google.com/go/oslogin/apiv1beta" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/compute", + "https://www.googleapis.com/auth/compute.readonly", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/oslogin/apiv1beta/mock_test.go b/vendor/cloud.google.com/go/oslogin/apiv1beta/mock_test.go new file mode 100644 index 000000000..e3719293a --- /dev/null +++ b/vendor/cloud.google.com/go/oslogin/apiv1beta/mock_test.go @@ -0,0 +1,520 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package oslogin + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + commonpb "google.golang.org/genproto/googleapis/cloud/oslogin/common" + osloginpb "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockOsLoginServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + osloginpb.OsLoginServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockOsLoginServer) DeletePosixAccount(ctx context.Context, req *osloginpb.DeletePosixAccountRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockOsLoginServer) DeleteSshPublicKey(ctx context.Context, req *osloginpb.DeleteSshPublicKeyRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockOsLoginServer) GetLoginProfile(ctx context.Context, req *osloginpb.GetLoginProfileRequest) (*osloginpb.LoginProfile, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*osloginpb.LoginProfile), nil +} + +func (s *mockOsLoginServer) GetSshPublicKey(ctx context.Context, req *osloginpb.GetSshPublicKeyRequest) (*commonpb.SshPublicKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*commonpb.SshPublicKey), nil +} + +func (s *mockOsLoginServer) ImportSshPublicKey(ctx context.Context, req *osloginpb.ImportSshPublicKeyRequest) (*osloginpb.ImportSshPublicKeyResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*osloginpb.ImportSshPublicKeyResponse), nil +} + +func (s *mockOsLoginServer) UpdateSshPublicKey(ctx context.Context, req *osloginpb.UpdateSshPublicKeyRequest) (*commonpb.SshPublicKey, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*commonpb.SshPublicKey), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockOsLogin mockOsLoginServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + osloginpb.RegisterOsLoginServiceServer(serv, &mockOsLogin) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestOsLoginServiceDeletePosixAccount(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s/projects/%s", "[USER]", "[PROJECT]") + var request = &osloginpb.DeletePosixAccountRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeletePosixAccount(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestOsLoginServiceDeletePosixAccountError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s/projects/%s", "[USER]", "[PROJECT]") + var request = &osloginpb.DeletePosixAccountRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeletePosixAccount(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestOsLoginServiceDeleteSshPublicKey(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var request = &osloginpb.DeleteSshPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSshPublicKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestOsLoginServiceDeleteSshPublicKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var request = &osloginpb.DeleteSshPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSshPublicKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestOsLoginServiceGetLoginProfile(t *testing.T) { + var name2 string = "name2-1052831874" + var suspended bool = false + var expectedResponse = &osloginpb.LoginProfile{ + Name: name2, + Suspended: suspended, + } + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s", "[USER]") + var request = &osloginpb.GetLoginProfileRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetLoginProfile(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOsLoginServiceGetLoginProfileError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s", "[USER]") + var request = &osloginpb.GetLoginProfileRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetLoginProfile(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestOsLoginServiceGetSshPublicKey(t *testing.T) { + var key string = "key106079" + var expirationTimeUsec int64 = 2058878882 + var fingerprint string = "fingerprint-1375934236" + var expectedResponse = &commonpb.SshPublicKey{ + Key: key, + ExpirationTimeUsec: expirationTimeUsec, + Fingerprint: fingerprint, + } + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var request = &osloginpb.GetSshPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSshPublicKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOsLoginServiceGetSshPublicKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var request = &osloginpb.GetSshPublicKeyRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSshPublicKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestOsLoginServiceImportSshPublicKey(t *testing.T) { + var expectedResponse *osloginpb.ImportSshPublicKeyResponse = &osloginpb.ImportSshPublicKeyResponse{} + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("users/%s", "[USER]") + var sshPublicKey *commonpb.SshPublicKey = &commonpb.SshPublicKey{} + var request = &osloginpb.ImportSshPublicKeyRequest{ + Parent: formattedParent, + SshPublicKey: sshPublicKey, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ImportSshPublicKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOsLoginServiceImportSshPublicKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("users/%s", "[USER]") + var sshPublicKey *commonpb.SshPublicKey = &commonpb.SshPublicKey{} + var request = &osloginpb.ImportSshPublicKeyRequest{ + Parent: formattedParent, + SshPublicKey: sshPublicKey, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ImportSshPublicKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestOsLoginServiceUpdateSshPublicKey(t *testing.T) { + var key string = "key106079" + var expirationTimeUsec int64 = 2058878882 + var fingerprint string = "fingerprint-1375934236" + var expectedResponse = &commonpb.SshPublicKey{ + Key: key, + ExpirationTimeUsec: expirationTimeUsec, + Fingerprint: fingerprint, + } + + mockOsLogin.err = nil + mockOsLogin.reqs = nil + + mockOsLogin.resps = append(mockOsLogin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var sshPublicKey *commonpb.SshPublicKey = &commonpb.SshPublicKey{} + var request = &osloginpb.UpdateSshPublicKeyRequest{ + Name: formattedName, + SshPublicKey: sshPublicKey, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSshPublicKey(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockOsLogin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestOsLoginServiceUpdateSshPublicKeyError(t *testing.T) { + errCode := codes.PermissionDenied + mockOsLogin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("users/%s/sshPublicKeys/%s", "[USER]", "[FINGERPRINT]") + var sshPublicKey *commonpb.SshPublicKey = &commonpb.SshPublicKey{} + var request = &osloginpb.UpdateSshPublicKeyRequest{ + Name: formattedName, + SshPublicKey: sshPublicKey, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSshPublicKey(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/oslogin/apiv1beta/os_login_client.go b/vendor/cloud.google.com/go/oslogin/apiv1beta/os_login_client.go new file mode 100644 index 000000000..78a7be00d --- /dev/null +++ b/vendor/cloud.google.com/go/oslogin/apiv1beta/os_login_client.go @@ -0,0 +1,223 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package oslogin + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + commonpb "google.golang.org/genproto/googleapis/cloud/oslogin/common" + osloginpb "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + DeletePosixAccount []gax.CallOption + DeleteSshPublicKey []gax.CallOption + GetLoginProfile []gax.CallOption + GetSshPublicKey []gax.CallOption + ImportSshPublicKey []gax.CallOption + UpdateSshPublicKey []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("oslogin.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + DeletePosixAccount: retry[[2]string{"default", "idempotent"}], + DeleteSshPublicKey: retry[[2]string{"default", "idempotent"}], + GetLoginProfile: retry[[2]string{"default", "idempotent"}], + GetSshPublicKey: retry[[2]string{"default", "idempotent"}], + ImportSshPublicKey: retry[[2]string{"default", "idempotent"}], + UpdateSshPublicKey: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Google Cloud OS Login API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client osloginpb.OsLoginServiceClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new os login service client. +// +// Cloud OS Login API +// +// The Cloud OS Login API allows you to manage users and their associated SSH +// public keys for logging into virtual machines on Google Cloud Platform. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: osloginpb.NewOsLoginServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// DeletePosixAccount deletes a POSIX account. +func (c *Client) DeletePosixAccount(ctx context.Context, req *osloginpb.DeletePosixAccountRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeletePosixAccount[0:len(c.CallOptions.DeletePosixAccount):len(c.CallOptions.DeletePosixAccount)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeletePosixAccount(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// DeleteSshPublicKey deletes an SSH public key. +func (c *Client) DeleteSshPublicKey(ctx context.Context, req *osloginpb.DeleteSshPublicKeyRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteSshPublicKey[0:len(c.CallOptions.DeleteSshPublicKey):len(c.CallOptions.DeleteSshPublicKey)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteSshPublicKey(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// GetLoginProfile retrieves the profile information used for logging in to a virtual machine +// on Google Compute Engine. +func (c *Client) GetLoginProfile(ctx context.Context, req *osloginpb.GetLoginProfileRequest, opts ...gax.CallOption) (*osloginpb.LoginProfile, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetLoginProfile[0:len(c.CallOptions.GetLoginProfile):len(c.CallOptions.GetLoginProfile)], opts...) + var resp *osloginpb.LoginProfile + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetLoginProfile(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetSshPublicKey retrieves an SSH public key. +func (c *Client) GetSshPublicKey(ctx context.Context, req *osloginpb.GetSshPublicKeyRequest, opts ...gax.CallOption) (*commonpb.SshPublicKey, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetSshPublicKey[0:len(c.CallOptions.GetSshPublicKey):len(c.CallOptions.GetSshPublicKey)], opts...) + var resp *commonpb.SshPublicKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetSshPublicKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ImportSshPublicKey adds an SSH public key and returns the profile information. Default POSIX +// account information is set when no username and UID exist as part of the +// login profile. +func (c *Client) ImportSshPublicKey(ctx context.Context, req *osloginpb.ImportSshPublicKeyRequest, opts ...gax.CallOption) (*osloginpb.ImportSshPublicKeyResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ImportSshPublicKey[0:len(c.CallOptions.ImportSshPublicKey):len(c.CallOptions.ImportSshPublicKey)], opts...) + var resp *osloginpb.ImportSshPublicKeyResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ImportSshPublicKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateSshPublicKey updates an SSH public key and returns the profile information. This method +// supports patch semantics. +func (c *Client) UpdateSshPublicKey(ctx context.Context, req *osloginpb.UpdateSshPublicKeyRequest, opts ...gax.CallOption) (*commonpb.SshPublicKey, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateSshPublicKey[0:len(c.CallOptions.UpdateSshPublicKey):len(c.CallOptions.UpdateSshPublicKey)], opts...) + var resp *commonpb.SshPublicKey + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateSshPublicKey(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/oslogin/apiv1beta/os_login_client_example_test.go b/vendor/cloud.google.com/go/oslogin/apiv1beta/os_login_client_example_test.go new file mode 100644 index 000000000..d4851fb68 --- /dev/null +++ b/vendor/cloud.google.com/go/oslogin/apiv1beta/os_login_client_example_test.go @@ -0,0 +1,138 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package oslogin_test + +import ( + "context" + + oslogin "cloud.google.com/go/oslogin/apiv1beta" + osloginpb "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_DeletePosixAccount() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.DeletePosixAccountRequest{ + // TODO: Fill request struct fields. + } + err = c.DeletePosixAccount(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_DeleteSshPublicKey() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.DeleteSshPublicKeyRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteSshPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_GetLoginProfile() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.GetLoginProfileRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetLoginProfile(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetSshPublicKey() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.GetSshPublicKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSshPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ImportSshPublicKey() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.ImportSshPublicKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ImportSshPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateSshPublicKey() { + ctx := context.Background() + c, err := oslogin.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &osloginpb.UpdateSshPublicKeyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateSshPublicKey(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/profiler/busybench/busybench.go b/vendor/cloud.google.com/go/profiler/busybench/busybench.go new file mode 100644 index 000000000..d99e6f5c4 --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/busybench/busybench.go @@ -0,0 +1,101 @@ +// Copyright 2017 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. + +// Busybench is a tool that runs a benchmark with the profiler enabled. +package main + +import ( + "bytes" + "compress/gzip" + "flag" + "log" + "math/rand" + "sync" + "time" + + "cloud.google.com/go/profiler" +) + +var ( + service = flag.String("service", "", "service name") + mutexProfiling = flag.Bool("mutex_profiling", false, "enable mutex profiling") + duration = flag.Int("duration", 600, "duration of the benchmark in seconds") + apiAddr = flag.String("api_address", "", "API address of the profiler (e.g. 'cloudprofiler.googleapis.com:443')") + projectID = flag.String("project_id", "", "cloud project ID") +) + +// busywork continuously generates 1MiB of random data and compresses it +// throwing away the result. +func busywork(mu *sync.Mutex) { + ticker := time.NewTicker(time.Duration(*duration) * time.Second) + defer ticker.Stop() + for { + select { + case <-ticker.C: + return + default: + mu.Lock() + busyworkOnce() + mu.Unlock() + } + } +} + +func busyworkOnce() { + data := make([]byte, 1024*1024) + rand.Read(data) + + var b bytes.Buffer + gz := gzip.NewWriter(&b) + if _, err := gz.Write(data); err != nil { + log.Printf("Failed to write to gzip stream: %v", err) + return + } + if err := gz.Flush(); err != nil { + log.Printf("Failed to flush to gzip stream: %v", err) + return + } + if err := gz.Close(); err != nil { + log.Printf("Failed to close gzip stream: %v", err) + } + // Throw away the result. +} + +func main() { + flag.Parse() + defer log.Printf("busybench finished profiling.") + + if *service == "" { + log.Print("Service name must be configured using --service flag.") + return + } + if err := profiler.Start(profiler.Config{Service: *service, + MutexProfiling: *mutexProfiling, + DebugLogging: true, + APIAddr: *apiAddr, + ProjectID: *projectID}); err != nil { + log.Printf("Failed to start the profiler: %v", err) + return + } + mu := new(sync.Mutex) + var wg sync.WaitGroup + wg.Add(5) + for i := 0; i < 5; i++ { + go func() { + defer wg.Done() + busywork(mu) + }() + } + wg.Wait() +} diff --git a/vendor/cloud.google.com/go/profiler/heap.go b/vendor/cloud.google.com/go/profiler/heap.go new file mode 100644 index 000000000..704e72e1e --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/heap.go @@ -0,0 +1,116 @@ +// 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. + +package profiler + +import ( + "bytes" + "context" + "fmt" + "runtime" + "time" + + "github.com/google/pprof/profile" +) + +// heapProfile collects an in-use heap profile. The heap profiles returned by +// the runtime also include the heap allocation metrics. We zero those out +// since all allocations since program start are recorded, so these make the +// profile large and there is a separate alloc profile type which shows +// allocations from a set duration. +func heapProfile(prof *bytes.Buffer) error { + p, err := goHeapProfile() + if err != nil { + return err + } + for _, s := range p.Sample { + s.Value[0] = 0 + s.Value[1] = 0 + } + + // Merge profile with itself to remove samples with only zero values and + // reduce profile size. + p, err = profile.Merge([]*profile.Profile{p}) + if err != nil { + return err + } + return p.Write(prof) +} + +// deltaAllocProfile collects an allocation profile by gathering a heap profile, +// sleeping for the specified duration, gathering another heap profile and +// subtracting the initial one from that. It then drops the in-use metrics from +// the profile. If requested, it forces the GC before taking each of the heap +// profiles, which improves the profile accuracy (see docs in +// https://golang.org/src/runtime/mprof.go on why). +func deltaAllocProfile(ctx context.Context, duration time.Duration, forceGC bool, prof *bytes.Buffer) error { + p1, err := allocProfile(forceGC) + if err != nil { + return err + } + + sleep(ctx, duration) + + p2, err := allocProfile(forceGC) + if err != nil { + return err + } + + p1.Scale(-1) + p, err := profile.Merge([]*profile.Profile{p1, p2}) + if err != nil { + return err + } + p.DurationNanos = duration.Nanoseconds() + return p.Write(prof) +} + +// allocProfile collects a single heap profile, and removes all metrics but +// allocation metrics. +func allocProfile(forceGC bool) (*profile.Profile, error) { + if forceGC { + runtime.GC() + } + p, err := goHeapProfile() + if err != nil { + return nil, err + } + p.SampleType = p.SampleType[:2] + for _, s := range p.Sample { + s.Value = s.Value[:2] + } + return p, nil +} + +// goHeapProfile collects a heap profile. It returns an error if the metrics +// in the collected heap profile do not match the expected metrics. +func goHeapProfile() (*profile.Profile, error) { + var prof bytes.Buffer + if err := writeHeapProfile(&prof); err != nil { + return nil, fmt.Errorf("failed to write heap profile: %v", err) + } + p, err := profile.Parse(&prof) + if err != nil { + return nil, err + } + if got := len(p.SampleType); got != 4 { + return nil, fmt.Errorf("invalid heap profile: got %d sample types, want 4", got) + } + for i, want := range []string{"alloc_objects", "alloc_space", "inuse_objects", "inuse_space"} { + if got := p.SampleType[i].Type; got != want { + return nil, fmt.Errorf("invalid heap profile: got %q sample type at index %d, want %q", got, i, want) + } + } + return p, nil +} diff --git a/vendor/cloud.google.com/go/profiler/heap_test.go b/vendor/cloud.google.com/go/profiler/heap_test.go new file mode 100644 index 000000000..e6db51ef7 --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/heap_test.go @@ -0,0 +1,79 @@ +// 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. + +package profiler + +import ( + "bytes" + "io" + "testing" + + "cloud.google.com/go/profiler/testdata" + "github.com/google/pprof/profile" +) + +func TestGoHeapProfile(t *testing.T) { + oldStartCPUProfile, oldStopCPUProfile, oldWriteHeapProfile, oldSleep := startCPUProfile, stopCPUProfile, writeHeapProfile, sleep + defer func() { + startCPUProfile, stopCPUProfile, writeHeapProfile, sleep = oldStartCPUProfile, oldStopCPUProfile, oldWriteHeapProfile, oldSleep + }() + + tests := []struct { + name string + profile *profile.Profile + wantErr bool + }{ + { + name: "valid heap profile", + profile: testdata.HeapProfileCollected1, + }, + { + name: "profile with too few sample types", + profile: testdata.AllocProfileUploaded, + wantErr: true, + }, + { + name: "profile with incorrect sample types", + profile: &profile.Profile{ + DurationNanos: 10e9, + SampleType: []*profile.ValueType{ + {Type: "objects", Unit: "count"}, + {Type: "alloc_space", Unit: "bytes"}, + {Type: "inuse_objects", Unit: "count"}, + {Type: "inuse_space", Unit: "bytes"}, + }, + }, + wantErr: true, + }, + } + + for _, tc := range tests { + var profileBytes bytes.Buffer + tc.profile.Write(&profileBytes) + writeHeapProfile = func(w io.Writer) error { + w.Write(profileBytes.Bytes()) + return nil + } + _, err := goHeapProfile() + if tc.wantErr { + if err == nil { + t.Errorf("%s: goHeapProfile() got no error, want error", tc.name) + } + continue + } + if err != nil { + t.Errorf("%s: goHeapProfile() got %q, want no error", tc.name, err) + } + } +} diff --git a/vendor/cloud.google.com/go/profiler/integration-test.sh b/vendor/cloud.google.com/go/profiler/integration-test.sh new file mode 100644 index 000000000..bb29f111a --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/integration-test.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +retry() { + for i in {1..3}; do + "${@}" && return 0 + done + return 1 +} + +# Fail on any error. +set -eo pipefail + +# Display commands being run. +set -x + +cd git/gocloud +COMMIT=$(git rev-parse HEAD) + +# Set $GOPATH +export GOPATH="$HOME/go" +GOCLOUD_HOME=$GOPATH/src/cloud.google.com/go +mkdir -p $GOCLOUD_HOME + +# Move code into $GOPATH and get dependencies +cp -R ./* $GOCLOUD_HOME +cd $GOCLOUD_HOME/internal/kokoro +# Don't print out encryption keys, etc +set +x +key=$(cat "$KOKORO_ARTIFACTS_DIR/keystore/72523_encrypted_ba2d6f7723ed_key") +iv=$(cat "$KOKORO_ARTIFACTS_DIR/keystore/72523_encrypted_ba2d6f7723ed_iv") +pass=$(cat "$KOKORO_ARTIFACTS_DIR/keystore/72523_encrypted_ba2d6f7723ed_pass") + +openssl aes-256-cbc -K $key -iv $iv -pass pass:$pass -in kokoro-key.json.enc -out key.json -d +set -x + +export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/key.json" +export GCLOUD_TESTS_GOLANG_PROJECT_ID="dulcet-port-762" +export GCLOUD_TESTS_GOLANG_ZONE="us-west1-b" +export GCLOUD_TESTS_GOLANG_BUCKET="dulcet-port-762-go-cloud-profiler-test" + +cd $GOCLOUD_HOME/profiler +retry go get -t -tags=integration . +go test -timeout=60m -tags=integration -run TestAgentIntegration -commit="$COMMIT" diff --git a/vendor/cloud.google.com/go/profiler/integration_test.go b/vendor/cloud.google.com/go/profiler/integration_test.go new file mode 100644 index 000000000..8f1ea35fb --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/integration_test.go @@ -0,0 +1,294 @@ +// Copyright 2017 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. + +// +build integration,go1.7 + +package profiler + +import ( + "bytes" + "context" + "flag" + "fmt" + "os" + "runtime" + "strings" + "testing" + "text/template" + "time" + + "cloud.google.com/go/profiler/proftest" + "golang.org/x/oauth2/google" + compute "google.golang.org/api/compute/v1" +) + +var ( + commit = flag.String("commit", "", "git commit to test") + runID = strings.Replace(time.Now().Format("2006-01-02-15-04-05.000000-0700"), ".", "-", -1) +) + +const ( + cloudScope = "https://www.googleapis.com/auth/cloud-platform" + benchFinishString = "busybench finished profiling" + errorString = "failed to set up or run the benchmark" +) + +const startupTemplate = ` +#! /bin/bash + +# Signal any unexpected error. +trap 'echo "{{.ErrorString}}"' ERR + +( +# Shut down the VM in 5 minutes after this script exits +# to stop accounting the VM for billing and cores quota. +trap "sleep 300 && poweroff" EXIT + +retry() { + for i in {1..3}; do + "${@}" && return 0 + done + return 1 +} + +# Fail on any error. +set -eo pipefail + +# Display commands being run. +set -x + +# Install git +retry apt-get update >/dev/null +retry apt-get -y -q install git >/dev/null + +# Install desired Go version +mkdir -p /tmp/bin +retry curl -sL -o /tmp/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme +chmod +x /tmp/bin/gimme +export PATH=$PATH:/tmp/bin + +retry eval "$(gimme {{.GoVersion}})" + +# Set $GOPATH +export GOPATH="$HOME/go" + +export GOCLOUD_HOME=$GOPATH/src/cloud.google.com/go +mkdir -p $GOCLOUD_HOME + +# Install agent +retry git clone https://code.googlesource.com/gocloud $GOCLOUD_HOME >/dev/null + +cd $GOCLOUD_HOME/profiler/busybench +git reset --hard {{.Commit}} +retry go get >/dev/null + +# Run benchmark with agent +go run busybench.go --service="{{.Service}}" --mutex_profiling="{{.MutexProfiling}}" + +# Write output to serial port 2 with timestamp. +) 2>&1 | while read line; do echo "$(date): ${line}"; done >/dev/ttyS1 +` + +const dockerfileFmt = `FROM golang +RUN git clone https://code.googlesource.com/gocloud /go/src/cloud.google.com/go \ + && cd /go/src/cloud.google.com/go/profiler/busybench && git reset --hard %s \ + && go get && go install +CMD ["busybench", "--service", "%s"] + ` + +type goGCETestCase struct { + proftest.InstanceConfig + name string + goVersion string + mutexProfiling bool + wantProfileTypes []string +} + +func (tc *goGCETestCase) initializeStartupScript(template *template.Template) error { + var buf bytes.Buffer + err := template.Execute(&buf, + struct { + Service string + GoVersion string + Commit string + ErrorString string + MutexProfiling bool + }{ + Service: tc.name, + GoVersion: tc.goVersion, + Commit: *commit, + ErrorString: errorString, + MutexProfiling: tc.mutexProfiling, + }) + if err != nil { + return fmt.Errorf("failed to render startup script for %s: %v", tc.name, err) + } + tc.StartupScript = buf.String() + return nil +} + +func TestAgentIntegration(t *testing.T) { + projectID := os.Getenv("GCLOUD_TESTS_GOLANG_PROJECT_ID") + if projectID == "" { + t.Fatalf("Getenv(GCLOUD_TESTS_GOLANG_PROJECT_ID) got empty string") + } + + zone := os.Getenv("GCLOUD_TESTS_GOLANG_ZONE") + if zone == "" { + t.Fatalf("Getenv(GCLOUD_TESTS_GOLANG_ZONE) got empty string") + } + + if *commit == "" { + t.Fatal("commit flag is not set") + } + + ctx := context.Background() + + client, err := google.DefaultClient(ctx, cloudScope) + if err != nil { + t.Fatalf("failed to get default client: %v", err) + } + + computeService, err := compute.New(client) + if err != nil { + t.Fatalf("failed to initialize compute service: %v", err) + } + + template, err := template.New("startupScript").Parse(startupTemplate) + if err != nil { + t.Fatalf("failed to parse startup script template: %v", err) + } + + tr := proftest.TestRunner{ + Client: client, + } + + gceTr := proftest.GCETestRunner{ + TestRunner: tr, + ComputeService: computeService, + } + + testcases := []goGCETestCase{ + { + InstanceConfig: proftest.InstanceConfig{ + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-go111-%s", runID), + MachineType: "n1-standard-1", + }, + name: fmt.Sprintf("profiler-test-go111-%s-gce", runID), + wantProfileTypes: []string{"CPU", "HEAP", "THREADS", "CONTENTION", "HEAP_ALLOC"}, + goVersion: "1.11", + mutexProfiling: true, + }, + { + InstanceConfig: proftest.InstanceConfig{ + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-go110-%s", runID), + MachineType: "n1-standard-1", + }, + name: fmt.Sprintf("profiler-test-go110-%s-gce", runID), + wantProfileTypes: []string{"CPU", "HEAP", "THREADS", "CONTENTION", "HEAP_ALLOC"}, + goVersion: "1.10", + mutexProfiling: true, + }, + { + InstanceConfig: proftest.InstanceConfig{ + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-go19-%s", runID), + MachineType: "n1-standard-1", + }, + name: fmt.Sprintf("profiler-test-go19-%s-gce", runID), + wantProfileTypes: []string{"CPU", "HEAP", "THREADS", "CONTENTION", "HEAP_ALLOC"}, + goVersion: "1.9", + mutexProfiling: true, + }, + { + InstanceConfig: proftest.InstanceConfig{ + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-go18-%s", runID), + MachineType: "n1-standard-1", + }, + name: fmt.Sprintf("profiler-test-go18-%s-gce", runID), + wantProfileTypes: []string{"CPU", "HEAP", "THREADS", "CONTENTION", "HEAP_ALLOC"}, + goVersion: "1.8", + mutexProfiling: true, + }, + { + InstanceConfig: proftest.InstanceConfig{ + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-go17-%s", runID), + MachineType: "n1-standard-1", + }, + name: fmt.Sprintf("profiler-test-go17-%s-gce", runID), + wantProfileTypes: []string{"CPU", "HEAP", "THREADS", "HEAP_ALLOC"}, + goVersion: "1.7", + }, + { + InstanceConfig: proftest.InstanceConfig{ + ProjectID: projectID, + Zone: zone, + Name: fmt.Sprintf("profiler-test-go16-%s", runID), + MachineType: "n1-standard-1", + }, + name: fmt.Sprintf("profiler-test-go16-%s-gce", runID), + wantProfileTypes: []string{"CPU", "HEAP", "THREADS", "HEAP_ALLOC"}, + goVersion: "1.6", + }, + } + // The number of tests run in parallel is the current value of GOMAXPROCS. + runtime.GOMAXPROCS(len(testcases)) + for _, tc := range testcases { + tc := tc // capture range variable + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + if err := tc.initializeStartupScript(template); err != nil { + t.Fatalf("failed to initialize startup script") + } + + if err := gceTr.StartInstance(ctx, &tc.InstanceConfig); err != nil { + t.Fatal(err) + } + defer func() { + if gceTr.DeleteInstance(ctx, &tc.InstanceConfig); err != nil { + t.Fatal(err) + } + }() + + timeoutCtx, cancel := context.WithTimeout(ctx, time.Minute*25) + defer cancel() + if err := gceTr.PollForSerialOutput(timeoutCtx, &tc.InstanceConfig, benchFinishString, errorString); err != nil { + t.Fatalf("PollForSerialOutput() got error: %v", err) + } + + timeNow := time.Now() + endTime := timeNow.Format(time.RFC3339) + startTime := timeNow.Add(-1 * time.Hour).Format(time.RFC3339) + for _, pType := range tc.wantProfileTypes { + pr, err := tr.QueryProfiles(tc.ProjectID, tc.name, startTime, endTime, pType) + if err != nil { + t.Errorf("QueryProfiles(%s, %s, %s, %s, %s) got error: %v", tc.ProjectID, tc.name, startTime, endTime, pType, err) + continue + } + if err := pr.HasFunction("busywork"); err != nil { + t.Error(err) + } + } + }) + } +} diff --git a/vendor/cloud.google.com/go/profiler/mocks/README.md b/vendor/cloud.google.com/go/profiler/mocks/README.md new file mode 100644 index 000000000..50cdd78a3 --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/mocks/README.md @@ -0,0 +1,14 @@ +This directory contains auto-generated mocks for the ProfilerService interface. + +To regenerate the mocks, install https://github.com/golang/mock tool and run +the command below while in the `mocks` directory. + +``` +mockgen -package mocks google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2 \ + ProfilerServiceClient \ + > mock_profiler_client.go +``` + +Then re-add the copyright header in the file. You also need to either run the +commands above using Golang 1.6 or manually change the "context" import to +"context" to ensure the compatibility with Go 1.6. diff --git a/vendor/cloud.google.com/go/profiler/mocks/mock_profiler_client.go b/vendor/cloud.google.com/go/profiler/mocks/mock_profiler_client.go new file mode 100644 index 000000000..7a8ecf3ef --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/mocks/mock_profiler_client.go @@ -0,0 +1,105 @@ +// Copyright 2017 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. + +// Code generated by MockGen. DO NOT EDIT. +// Source: google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2 (interfaces: ProfilerServiceClient) + +// Package mocks is a generated GoMock package. +package mocks + +import ( + "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + v2 "google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2" + grpc "google.golang.org/grpc" +) + +// MockProfilerServiceClient is a mock of ProfilerServiceClient interface +type MockProfilerServiceClient struct { + ctrl *gomock.Controller + recorder *MockProfilerServiceClientMockRecorder +} + +// MockProfilerServiceClientMockRecorder is the mock recorder for MockProfilerServiceClient +type MockProfilerServiceClientMockRecorder struct { + mock *MockProfilerServiceClient +} + +// NewMockProfilerServiceClient creates a new mock instance +func NewMockProfilerServiceClient(ctrl *gomock.Controller) *MockProfilerServiceClient { + mock := &MockProfilerServiceClient{ctrl: ctrl} + mock.recorder = &MockProfilerServiceClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockProfilerServiceClient) EXPECT() *MockProfilerServiceClientMockRecorder { + return m.recorder +} + +// CreateOfflineProfile mocks base method +func (m *MockProfilerServiceClient) CreateOfflineProfile(arg0 context.Context, arg1 *v2.CreateOfflineProfileRequest, arg2 ...grpc.CallOption) (*v2.Profile, error) { + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateOfflineProfile", varargs...) + ret0, _ := ret[0].(*v2.Profile) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOfflineProfile indicates an expected call of CreateOfflineProfile +func (mr *MockProfilerServiceClientMockRecorder) CreateOfflineProfile(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOfflineProfile", reflect.TypeOf((*MockProfilerServiceClient)(nil).CreateOfflineProfile), varargs...) +} + +// CreateProfile mocks base method +func (m *MockProfilerServiceClient) CreateProfile(arg0 context.Context, arg1 *v2.CreateProfileRequest, arg2 ...grpc.CallOption) (*v2.Profile, error) { + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateProfile", varargs...) + ret0, _ := ret[0].(*v2.Profile) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateProfile indicates an expected call of CreateProfile +func (mr *MockProfilerServiceClientMockRecorder) CreateProfile(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateProfile", reflect.TypeOf((*MockProfilerServiceClient)(nil).CreateProfile), varargs...) +} + +// UpdateProfile mocks base method +func (m *MockProfilerServiceClient) UpdateProfile(arg0 context.Context, arg1 *v2.UpdateProfileRequest, arg2 ...grpc.CallOption) (*v2.Profile, error) { + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateProfile", varargs...) + ret0, _ := ret[0].(*v2.Profile) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateProfile indicates an expected call of UpdateProfile +func (mr *MockProfilerServiceClientMockRecorder) UpdateProfile(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateProfile", reflect.TypeOf((*MockProfilerServiceClient)(nil).UpdateProfile), varargs...) +} diff --git a/vendor/cloud.google.com/go/profiler/mutex.go b/vendor/cloud.google.com/go/profiler/mutex.go new file mode 100644 index 000000000..c432adb20 --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/mutex.go @@ -0,0 +1,23 @@ +// Copyright 2017 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 profiler + +import "runtime" + +func enableMutexProfiling() bool { + // One percent of mutex contention events are profiled. + runtime.SetMutexProfileFraction(100) + return true +} diff --git a/vendor/cloud.google.com/go/profiler/profiler.go b/vendor/cloud.google.com/go/profiler/profiler.go new file mode 100644 index 000000000..401160610 --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/profiler.go @@ -0,0 +1,529 @@ +// Copyright 2017 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 profiler is a client for the Stackdriver Profiler service. +// +// This package is still experimental and subject to change. +// +// Usage example: +// +// import "cloud.google.com/go/profiler" +// ... +// if err := profiler.Start(profiler.Config{Service: "my-service"}); err != nil { +// // TODO: Handle error. +// } +// +// Calling Start will start a goroutine to collect profiles and upload to +// the profiler server, at the rhythm specified by the server. +// +// The caller must provide the service string in the config, and may provide +// other information as well. See Config for details. +// +// Profiler has CPU, heap and goroutine profiling enabled by default. Mutex +// profiling can be enabled in the config. Note that goroutine and mutex +// profiles are shown as "threads" and "contention" profiles in the profiler +// UI. +package profiler + +import ( + "bytes" + "context" + "errors" + "fmt" + "log" + "os" + "regexp" + "runtime" + "runtime/pprof" + "sync" + "time" + + gcemd "cloud.google.com/go/compute/metadata" + "cloud.google.com/go/internal/version" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "github.com/google/pprof/profile" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + gtransport "google.golang.org/api/transport/grpc" + pb "google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2" + edpb "google.golang.org/genproto/googleapis/rpc/errdetails" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + grpcmd "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +var ( + config Config + startOnce sync.Once + mutexEnabled bool + // The functions below are stubbed to be overrideable for testing. + getProjectID = gcemd.ProjectID + getInstanceName = gcemd.InstanceName + getZone = gcemd.Zone + startCPUProfile = pprof.StartCPUProfile + stopCPUProfile = pprof.StopCPUProfile + writeHeapProfile = pprof.WriteHeapProfile + sleep = gax.Sleep + dialGRPC = gtransport.Dial + onGCE = gcemd.OnGCE + serviceRegexp = regexp.MustCompile(`^[a-z]([-a-z0-9_.]{0,253}[a-z0-9])?$`) +) + +const ( + apiAddress = "cloudprofiler.googleapis.com:443" + xGoogAPIMetadata = "x-goog-api-client" + zoneNameLabel = "zone" + versionLabel = "version" + languageLabel = "language" + instanceLabel = "instance" + scope = "https://www.googleapis.com/auth/monitoring.write" + + initialBackoff = time.Minute + // Ensure the agent will recover within 1 hour. + maxBackoff = time.Hour + backoffMultiplier = 1.3 // Backoff envelope increases by this factor on each retry. + retryInfoMetadata = "google.rpc.retryinfo-bin" +) + +// Config is the profiler configuration. +type Config struct { + // Service must be provided to start the profiler. It specifies the name of + // the service under which the profiled data will be recorded and exposed at + // the Profiler UI for the project. You can specify an arbitrary string, but + // see Deployment.target at + // https://github.com/googleapis/googleapis/blob/master/google/devtools/cloudprofiler/v2/profiler.proto + // for restrictions. If the parameter is not set, the agent will probe + // GAE_SERVICE environment variable which is present in Google App Engine + // environment. + // NOTE: The string should be the same across different replicas of + // your service so that the globally constant profiling rate is + // maintained. Do not put things like PID or unique pod ID in the name. + Service string + + // ServiceVersion is an optional field specifying the version of the + // service. It can be an arbitrary string. Profiler profiles + // once per minute for each version of each service in each zone. + // ServiceVersion defaults to GAE_VERSION environment variable if that is + // set, or to empty string otherwise. + ServiceVersion string + + // DebugLogging enables detailed debug logging from profiler. It + // defaults to false. + DebugLogging bool + + // MutexProfiling enables mutex profiling. It defaults to false. + // Note that mutex profiling is not supported by Go versions older + // than Go 1.8. + MutexProfiling bool + + // When true, collecting the allocation profiles is disabled. + NoAllocProfiling bool + + // AllocForceGC forces garbage collection before the collection of each heap + // profile collected to produce the allocation profile. This increases the + // accuracy of allocation profiling. It defaults to false. + AllocForceGC bool + + // When true, collecting the heap profiles is disabled. + NoHeapProfiling bool + + // When true, collecting the goroutine profiles is disabled. + NoGoroutineProfiling bool + + // ProjectID is the Cloud Console project ID to use instead of the one set by + // GOOGLE_CLOUD_PROJECT environment variable or read from the VM metadata + // server. + // + // Set this if you are running the agent in your local environment + // or anywhere else outside of Google Cloud Platform. + ProjectID string + + // APIAddr is the HTTP endpoint to use to connect to the profiler + // agent API. Defaults to the production environment, overridable + // for testing. + APIAddr string + + instance string + zone string +} + +// startError represents the error occurred during the +// initializating and starting of the agent. +var startError error + +// Start starts a goroutine to collect and upload profiles. The +// caller must provide the service string in the config. See +// Config for details. Start should only be called once. Any +// additional calls will be ignored. +func Start(cfg Config, options ...option.ClientOption) error { + startOnce.Do(func() { + startError = start(cfg, options...) + }) + return startError +} + +func start(cfg Config, options ...option.ClientOption) error { + if err := initializeConfig(cfg); err != nil { + debugLog("failed to initialize config: %v", err) + return err + } + if config.MutexProfiling { + if mutexEnabled = enableMutexProfiling(); !mutexEnabled { + return fmt.Errorf("mutex profiling is not supported by %s, requires Go 1.8 or later", runtime.Version()) + } + } + + ctx := context.Background() + + opts := []option.ClientOption{ + option.WithEndpoint(config.APIAddr), + option.WithScopes(scope), + } + opts = append(opts, options...) + + conn, err := dialGRPC(ctx, opts...) + if err != nil { + debugLog("failed to dial GRPC: %v", err) + return err + } + + a := initializeAgent(pb.NewProfilerServiceClient(conn)) + go pollProfilerService(withXGoogHeader(ctx), a) + return nil +} + +func debugLog(format string, e ...interface{}) { + if config.DebugLogging { + log.Printf(format, e...) + } +} + +// agent polls the profiler server for instructions on behalf of a task, +// and collects and uploads profiles as requested. +type agent struct { + client pb.ProfilerServiceClient + deployment *pb.Deployment + profileLabels map[string]string + profileTypes []pb.ProfileType +} + +// abortedBackoffDuration retrieves the retry duration from gRPC trailing +// metadata, which is set by the profiler server. +func abortedBackoffDuration(md grpcmd.MD) (time.Duration, error) { + elem := md[retryInfoMetadata] + if len(elem) <= 0 { + return 0, errors.New("no retry info") + } + + var retryInfo edpb.RetryInfo + if err := proto.Unmarshal([]byte(elem[0]), &retryInfo); err != nil { + return 0, err + } else if time, err := ptypes.Duration(retryInfo.RetryDelay); err != nil { + return 0, err + } else { + if time < 0 { + return 0, errors.New("negative retry duration") + } + return time, nil + } +} + +type retryer struct { + backoff gax.Backoff + md grpcmd.MD +} + +func (r *retryer) Retry(err error) (time.Duration, bool) { + st, _ := status.FromError(err) + if st != nil && st.Code() == codes.Aborted { + dur, err := abortedBackoffDuration(r.md) + if err == nil { + return dur, true + } + debugLog("failed to get backoff duration: %v", err) + } + return r.backoff.Pause(), true +} + +// createProfile talks to the profiler server to create profile. In +// case of error, the goroutine will sleep and retry. Sleep duration may +// be specified by the server. Otherwise it will be an exponentially +// increasing value, bounded by maxBackoff. +func (a *agent) createProfile(ctx context.Context) *pb.Profile { + req := pb.CreateProfileRequest{ + Deployment: a.deployment, + ProfileType: a.profileTypes, + } + + var p *pb.Profile + md := grpcmd.New(map[string]string{}) + + gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + p, err = a.client.CreateProfile(ctx, &req, grpc.Trailer(&md)) + if err != nil { + debugLog("failed to create a profile, will retry: %v", err) + } + return err + }, gax.WithRetry(func() gax.Retryer { + return &retryer{ + backoff: gax.Backoff{ + Initial: initialBackoff, + Max: maxBackoff, + Multiplier: backoffMultiplier, + }, + md: md, + } + })) + + debugLog("successfully created profile %v", p.GetProfileType()) + return p +} + +func (a *agent) profileAndUpload(ctx context.Context, p *pb.Profile) { + var prof bytes.Buffer + pt := p.GetProfileType() + + switch pt { + case pb.ProfileType_CPU: + duration, err := ptypes.Duration(p.Duration) + if err != nil { + debugLog("failed to get profile duration for CPU profile: %v", err) + return + } + if err := startCPUProfile(&prof); err != nil { + debugLog("failed to start CPU profile: %v", err) + return + } + sleep(ctx, duration) + stopCPUProfile() + case pb.ProfileType_HEAP: + if err := heapProfile(&prof); err != nil { + debugLog("failed to write heap profile: %v", err) + return + } + case pb.ProfileType_HEAP_ALLOC: + duration, err := ptypes.Duration(p.Duration) + if err != nil { + debugLog("failed to get profile duration for allocation profile: %v", err) + return + } + if err := deltaAllocProfile(ctx, duration, config.AllocForceGC, &prof); err != nil { + debugLog("failed to collect allocation profile: %v", err) + return + } + case pb.ProfileType_THREADS: + if err := pprof.Lookup("goroutine").WriteTo(&prof, 0); err != nil { + debugLog("failed to collect goroutine profile: %v", err) + return + } + case pb.ProfileType_CONTENTION: + duration, err := ptypes.Duration(p.Duration) + if err != nil { + debugLog("failed to get profile duration: %v", err) + return + } + if err := deltaMutexProfile(ctx, duration, &prof); err != nil { + debugLog("failed to collect mutex profile: %v", err) + return + } + default: + debugLog("unexpected profile type: %v", pt) + return + } + + // Starting Go 1.9 the profiles are symbolized by runtime/pprof. + // TODO(jianqiaoli): Remove the symbolization code when we decide to + // stop supporting Go 1.8. + if !shouldAssumeSymbolized && pt != pb.ProfileType_CONTENTION { + if err := parseAndSymbolize(&prof); err != nil { + debugLog("failed to symbolize profile: %v", err) + } + } + + p.ProfileBytes = prof.Bytes() + p.Labels = a.profileLabels + req := pb.UpdateProfileRequest{Profile: p} + + // Upload profile, discard profile in case of error. + debugLog("start uploading profile") + if _, err := a.client.UpdateProfile(ctx, &req); err != nil { + debugLog("failed to upload profile: %v", err) + } +} + +// deltaMutexProfile writes mutex profile changes over a time period specified +// with 'duration' to 'prof'. +func deltaMutexProfile(ctx context.Context, duration time.Duration, prof *bytes.Buffer) error { + if !mutexEnabled { + return errors.New("mutex profiling is not enabled") + } + p0, err := mutexProfile() + if err != nil { + return err + } + sleep(ctx, duration) + p, err := mutexProfile() + if err != nil { + return err + } + + p0.Scale(-1) + p, err = profile.Merge([]*profile.Profile{p0, p}) + if err != nil { + return err + } + + // The mutex profile is not symbolized by runtime.pprof until + // golang.org/issue/21474 is fixed in go1.10. + symbolize(p) + return p.Write(prof) +} + +func mutexProfile() (*profile.Profile, error) { + p := pprof.Lookup("mutex") + if p == nil { + return nil, errors.New("mutex profiling is not supported") + } + var buf bytes.Buffer + if err := p.WriteTo(&buf, 0); err != nil { + return nil, err + } + return profile.Parse(&buf) +} + +// withXGoogHeader sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func withXGoogHeader(ctx context.Context, keyval ...string) context.Context { + kv := append([]string{"gl-go", version.Go(), "gccl", version.Repo}, keyval...) + kv = append(kv, "gax", gax.Version, "grpc", grpc.Version) + + md, _ := grpcmd.FromOutgoingContext(ctx) + md = md.Copy() + md[xGoogAPIMetadata] = []string{gax.XGoogHeader(kv...)} + return grpcmd.NewOutgoingContext(ctx, md) +} + +func initializeAgent(c pb.ProfilerServiceClient) *agent { + labels := map[string]string{languageLabel: "go"} + if config.zone != "" { + labels[zoneNameLabel] = config.zone + } + if config.ServiceVersion != "" { + labels[versionLabel] = config.ServiceVersion + } + d := &pb.Deployment{ + ProjectId: config.ProjectID, + Target: config.Service, + Labels: labels, + } + + profileLabels := map[string]string{} + + if config.instance != "" { + profileLabels[instanceLabel] = config.instance + } + + profileTypes := []pb.ProfileType{pb.ProfileType_CPU} + if !config.NoHeapProfiling { + profileTypes = append(profileTypes, pb.ProfileType_HEAP) + } + if !config.NoGoroutineProfiling { + profileTypes = append(profileTypes, pb.ProfileType_THREADS) + } + if !config.NoAllocProfiling { + profileTypes = append(profileTypes, pb.ProfileType_HEAP_ALLOC) + } + if mutexEnabled { + profileTypes = append(profileTypes, pb.ProfileType_CONTENTION) + } + + return &agent{ + client: c, + deployment: d, + profileLabels: profileLabels, + profileTypes: profileTypes, + } +} + +func initializeConfig(cfg Config) error { + config = cfg + + if config.Service == "" { + config.Service = os.Getenv("GAE_SERVICE") + } + if config.Service == "" { + return errors.New("service name must be configured") + } + if !serviceRegexp.MatchString(config.Service) { + return fmt.Errorf("service name %q does not match regular expression %v", config.Service, serviceRegexp) + } + + if config.ServiceVersion == "" { + config.ServiceVersion = os.Getenv("GAE_VERSION") + } + + if projectID := os.Getenv("GOOGLE_CLOUD_PROJECT"); config.ProjectID == "" && projectID != "" { + // Cloud Shell and App Engine set this environment variable to the project + // ID, so use it if present. In case of App Engine the project ID is also + // available from the GCE metadata server, but by using the environment + // variable saves one request to the metadata server. The environment + // project ID is only used if no project ID is provided in the + // configuration. + config.ProjectID = projectID + } + if onGCE() { + var err error + if config.ProjectID == "" { + if config.ProjectID, err = getProjectID(); err != nil { + return fmt.Errorf("failed to get the project ID from Compute Engine metadata: %v", err) + } + } + + if config.zone, err = getZone(); err != nil { + return fmt.Errorf("failed to get zone from Compute Engine metadata: %v", err) + } + + if config.instance, err = getInstanceName(); err != nil { + if _, ok := err.(gcemd.NotDefinedError); !ok { + return fmt.Errorf("failed to get instance name from Compute Engine metadata: %v", err) + } + debugLog("failed to get instance name from Compute Engine metadata, will use empty name: %v", err) + } + + } else { + if config.ProjectID == "" { + return fmt.Errorf("project ID must be specified in the configuration if running outside of GCP") + } + } + + if config.APIAddr == "" { + config.APIAddr = apiAddress + } + return nil +} + +// pollProfilerService starts an endless loop to poll the profiler +// server for instructions, and collects and uploads profiles as +// requested. +func pollProfilerService(ctx context.Context, a *agent) { + debugLog("profiler has started") + for { + p := a.createProfile(ctx) + a.profileAndUpload(ctx, p) + } +} diff --git a/vendor/cloud.google.com/go/profiler/profiler_example_test.go b/vendor/cloud.google.com/go/profiler/profiler_example_test.go new file mode 100644 index 000000000..c56f1a575 --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/profiler_example_test.go @@ -0,0 +1,25 @@ +// Copyright 2017 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 profiler_test + +import ( + "cloud.google.com/go/profiler" +) + +func ExampleStart() { + if err := profiler.Start(profiler.Config{Service: "my-service", ServiceVersion: "v1"}); err != nil { + //TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/profiler/profiler_test.go b/vendor/cloud.google.com/go/profiler/profiler_test.go new file mode 100644 index 000000000..6fdad03cb --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/profiler_test.go @@ -0,0 +1,883 @@ +// Copyright 2017 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 profiler + +import ( + "bytes" + "compress/gzip" + "context" + "errors" + "fmt" + "io" + "log" + "math/rand" + "os" + "runtime" + "strings" + "sync" + "testing" + "time" + + gcemd "cloud.google.com/go/compute/metadata" + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/profiler/mocks" + "cloud.google.com/go/profiler/testdata" + "github.com/golang/mock/gomock" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "github.com/google/pprof/profile" + gax "github.com/googleapis/gax-go" + gtransport "google.golang.org/api/transport/grpc" + pb "google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2" + edpb "google.golang.org/genproto/googleapis/rpc/errdetails" + "google.golang.org/grpc/codes" + grpcmd "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +const ( + testProjectID = "test-project-ID" + testInstance = "test-instance" + testZone = "test-zone" + testService = "test-service" + testSvcVersion = "test-service-version" + testProfileDuration = time.Second * 10 + testServerTimeout = time.Second * 15 +) + +func createTestDeployment() *pb.Deployment { + labels := map[string]string{ + zoneNameLabel: testZone, + versionLabel: testSvcVersion, + } + return &pb.Deployment{ + ProjectId: testProjectID, + Target: testService, + Labels: labels, + } +} + +func createTestAgent(psc pb.ProfilerServiceClient) *agent { + return &agent{ + client: psc, + deployment: createTestDeployment(), + profileLabels: map[string]string{instanceLabel: testInstance}, + profileTypes: []pb.ProfileType{pb.ProfileType_CPU, pb.ProfileType_HEAP, pb.ProfileType_THREADS}, + } +} + +func createTrailers(dur time.Duration) map[string]string { + b, _ := proto.Marshal(&edpb.RetryInfo{ + RetryDelay: ptypes.DurationProto(dur), + }) + return map[string]string{ + retryInfoMetadata: string(b), + } +} + +func TestCreateProfile(t *testing.T) { + ctx := context.Background() + ctrl := gomock.NewController(t) + defer ctrl.Finish() + mpc := mocks.NewMockProfilerServiceClient(ctrl) + a := createTestAgent(mpc) + p := &pb.Profile{Name: "test_profile"} + wantRequest := pb.CreateProfileRequest{ + Deployment: a.deployment, + ProfileType: a.profileTypes, + } + + mpc.EXPECT().CreateProfile(ctx, gomock.Eq(&wantRequest), gomock.Any()).Times(1).Return(p, nil) + + gotP := a.createProfile(ctx) + + if !testutil.Equal(gotP, p) { + t.Errorf("CreateProfile() got wrong profile, got %v, want %v", gotP, p) + } +} + +func TestProfileAndUpload(t *testing.T) { + oldStartCPUProfile, oldStopCPUProfile, oldWriteHeapProfile, oldSleep := startCPUProfile, stopCPUProfile, writeHeapProfile, sleep + defer func() { + startCPUProfile, stopCPUProfile, writeHeapProfile, sleep = oldStartCPUProfile, oldStopCPUProfile, oldWriteHeapProfile, oldSleep + }() + + ctx := context.Background() + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + var heapCollected1, heapCollected2, heapUploaded, allocUploaded bytes.Buffer + testdata.HeapProfileCollected1.Write(&heapCollected1) + testdata.HeapProfileCollected2.Write(&heapCollected2) + testdata.HeapProfileUploaded.Write(&heapUploaded) + testdata.AllocProfileUploaded.Write(&allocUploaded) + callCount := 0 + writeTwoHeapFunc := func(w io.Writer) error { + callCount++ + if callCount%2 == 1 { + w.Write(heapCollected1.Bytes()) + return nil + } + w.Write(heapCollected2.Bytes()) + return nil + } + + errFunc := func(io.Writer) error { return errors.New("") } + testDuration := time.Second * 5 + tests := []struct { + profileType pb.ProfileType + duration *time.Duration + startCPUProfileFunc func(io.Writer) error + writeHeapProfileFunc func(io.Writer) error + wantBytes []byte + }{ + { + profileType: pb.ProfileType_CPU, + duration: &testDuration, + startCPUProfileFunc: func(w io.Writer) error { + w.Write([]byte{1}) + return nil + }, + writeHeapProfileFunc: errFunc, + wantBytes: []byte{1}, + }, + { + profileType: pb.ProfileType_CPU, + startCPUProfileFunc: errFunc, + writeHeapProfileFunc: errFunc, + }, + { + profileType: pb.ProfileType_CPU, + duration: &testDuration, + startCPUProfileFunc: func(w io.Writer) error { + w.Write([]byte{2}) + return nil + }, + writeHeapProfileFunc: func(w io.Writer) error { + w.Write([]byte{3}) + return nil + }, + wantBytes: []byte{2}, + }, + { + profileType: pb.ProfileType_HEAP, + startCPUProfileFunc: errFunc, + writeHeapProfileFunc: func(w io.Writer) error { + w.Write(heapCollected1.Bytes()) + return nil + }, + wantBytes: heapUploaded.Bytes(), + }, + { + profileType: pb.ProfileType_HEAP_ALLOC, + startCPUProfileFunc: errFunc, + writeHeapProfileFunc: writeTwoHeapFunc, + duration: &testDuration, + wantBytes: allocUploaded.Bytes(), + }, + { + profileType: pb.ProfileType_HEAP, + startCPUProfileFunc: errFunc, + writeHeapProfileFunc: errFunc, + }, + { + profileType: pb.ProfileType_HEAP, + startCPUProfileFunc: func(w io.Writer) error { + w.Write([]byte{5}) + return nil + }, + writeHeapProfileFunc: func(w io.Writer) error { + w.Write(heapCollected1.Bytes()) + return nil + }, + wantBytes: heapUploaded.Bytes(), + }, + { + profileType: pb.ProfileType_PROFILE_TYPE_UNSPECIFIED, + startCPUProfileFunc: func(w io.Writer) error { + w.Write([]byte{7}) + return nil + }, + writeHeapProfileFunc: func(w io.Writer) error { + w.Write(heapCollected1.Bytes()) + return nil + }, + }, + } + + for _, tt := range tests { + mpc := mocks.NewMockProfilerServiceClient(ctrl) + a := createTestAgent(mpc) + startCPUProfile = tt.startCPUProfileFunc + stopCPUProfile = func() {} + writeHeapProfile = tt.writeHeapProfileFunc + var gotSleep *time.Duration + sleep = func(ctx context.Context, d time.Duration) error { + gotSleep = &d + return nil + } + p := &pb.Profile{ProfileType: tt.profileType} + if tt.duration != nil { + p.Duration = ptypes.DurationProto(*tt.duration) + } + if tt.wantBytes != nil { + wantProfile := &pb.Profile{ + ProfileType: p.ProfileType, + Duration: p.Duration, + ProfileBytes: tt.wantBytes, + Labels: a.profileLabels, + } + wantRequest := pb.UpdateProfileRequest{ + Profile: wantProfile, + } + mpc.EXPECT().UpdateProfile(ctx, gomock.Eq(&wantRequest)).Times(1) + } else { + mpc.EXPECT().UpdateProfile(gomock.Any(), gomock.Any()).MaxTimes(0) + } + + a.profileAndUpload(ctx, p) + + if tt.duration == nil { + if gotSleep != nil { + t.Errorf("profileAndUpload(%v) slept for: %v, want no sleep", p, gotSleep) + } + } else { + if gotSleep == nil { + t.Errorf("profileAndUpload(%v) didn't sleep, want sleep for: %v", p, tt.duration) + } else if *gotSleep != *tt.duration { + t.Errorf("profileAndUpload(%v) slept for wrong duration, got: %v, want: %v", p, gotSleep, tt.duration) + } + } + } +} + +func TestRetry(t *testing.T) { + normalDuration := time.Second * 3 + negativeDuration := time.Second * -3 + + tests := []struct { + trailers map[string]string + wantPause *time.Duration + }{ + { + createTrailers(normalDuration), + &normalDuration, + }, + { + createTrailers(negativeDuration), + nil, + }, + { + map[string]string{retryInfoMetadata: "wrong format"}, + nil, + }, + { + map[string]string{}, + nil, + }, + } + + for _, tt := range tests { + md := grpcmd.New(tt.trailers) + r := &retryer{ + backoff: gax.Backoff{ + Initial: initialBackoff, + Max: maxBackoff, + Multiplier: backoffMultiplier, + }, + md: md, + } + + pause, shouldRetry := r.Retry(status.Error(codes.Aborted, "")) + + if !shouldRetry { + t.Error("retryer.Retry() returned shouldRetry false, want true") + } + + if tt.wantPause != nil { + if pause != *tt.wantPause { + t.Errorf("retryer.Retry() returned wrong pause, got: %v, want: %v", pause, tt.wantPause) + } + } else { + if pause > initialBackoff { + t.Errorf("retryer.Retry() returned wrong pause, got: %v, want: < %v", pause, initialBackoff) + } + } + } + + md := grpcmd.New(map[string]string{}) + + r := &retryer{ + backoff: gax.Backoff{ + Initial: initialBackoff, + Max: maxBackoff, + Multiplier: backoffMultiplier, + }, + md: md, + } + for i := 0; i < 100; i++ { + pause, shouldRetry := r.Retry(errors.New("")) + if !shouldRetry { + t.Errorf("retryer.Retry() called %v times, returned shouldRetry false, want true", i) + } + if pause > maxBackoff { + t.Errorf("retryer.Retry() called %v times, returned wrong pause, got: %v, want: < %v", i, pause, maxBackoff) + } + } +} + +func TestWithXGoogHeader(t *testing.T) { + ctx := withXGoogHeader(context.Background()) + md, _ := grpcmd.FromOutgoingContext(ctx) + + if xg := md[xGoogAPIMetadata]; len(xg) == 0 { + t.Errorf("withXGoogHeader() sets empty xGoogHeader") + } else { + if !strings.Contains(xg[0], "gl-go/") { + t.Errorf("withXGoogHeader() got: %v, want gl-go key", xg[0]) + } + if !strings.Contains(xg[0], "gccl/") { + t.Errorf("withXGoogHeader() got: %v, want gccl key", xg[0]) + } + if !strings.Contains(xg[0], "gax/") { + t.Errorf("withXGoogHeader() got: %v, want gax key", xg[0]) + } + if !strings.Contains(xg[0], "grpc/") { + t.Errorf("withXGoogHeader() got: %v, want grpc key", xg[0]) + } + } +} + +func TestInitializeAgent(t *testing.T) { + oldConfig, oldMutexEnabled := config, mutexEnabled + defer func() { + config, mutexEnabled = oldConfig, oldMutexEnabled + }() + + for _, tt := range []struct { + config Config + enableMutex bool + wantProfileTypes []pb.ProfileType + wantDeploymentLabels map[string]string + wantProfileLabels map[string]string + }{ + { + config: Config{ServiceVersion: testSvcVersion, zone: testZone}, + wantProfileTypes: []pb.ProfileType{pb.ProfileType_CPU, pb.ProfileType_HEAP, pb.ProfileType_THREADS, pb.ProfileType_HEAP_ALLOC}, + wantDeploymentLabels: map[string]string{zoneNameLabel: testZone, versionLabel: testSvcVersion, languageLabel: "go"}, + wantProfileLabels: map[string]string{}, + }, + { + config: Config{zone: testZone}, + wantProfileTypes: []pb.ProfileType{pb.ProfileType_CPU, pb.ProfileType_HEAP, pb.ProfileType_THREADS, pb.ProfileType_HEAP_ALLOC}, + wantDeploymentLabels: map[string]string{zoneNameLabel: testZone, languageLabel: "go"}, + wantProfileLabels: map[string]string{}, + }, + { + config: Config{ServiceVersion: testSvcVersion}, + wantProfileTypes: []pb.ProfileType{pb.ProfileType_CPU, pb.ProfileType_HEAP, pb.ProfileType_THREADS, pb.ProfileType_HEAP_ALLOC}, + wantDeploymentLabels: map[string]string{versionLabel: testSvcVersion, languageLabel: "go"}, + wantProfileLabels: map[string]string{}, + }, + { + config: Config{instance: testInstance}, + wantProfileTypes: []pb.ProfileType{pb.ProfileType_CPU, pb.ProfileType_HEAP, pb.ProfileType_THREADS, pb.ProfileType_HEAP_ALLOC}, + wantDeploymentLabels: map[string]string{languageLabel: "go"}, + wantProfileLabels: map[string]string{instanceLabel: testInstance}, + }, + { + config: Config{instance: testInstance}, + enableMutex: true, + wantProfileTypes: []pb.ProfileType{pb.ProfileType_CPU, pb.ProfileType_HEAP, pb.ProfileType_THREADS, pb.ProfileType_HEAP_ALLOC, pb.ProfileType_CONTENTION}, + wantDeploymentLabels: map[string]string{languageLabel: "go"}, + wantProfileLabels: map[string]string{instanceLabel: testInstance}, + }, + { + config: Config{NoHeapProfiling: true}, + wantProfileTypes: []pb.ProfileType{pb.ProfileType_CPU, pb.ProfileType_THREADS, pb.ProfileType_HEAP_ALLOC}, + wantDeploymentLabels: map[string]string{languageLabel: "go"}, + wantProfileLabels: map[string]string{}, + }, + { + config: Config{NoHeapProfiling: true, NoGoroutineProfiling: true, NoAllocProfiling: true}, + wantProfileTypes: []pb.ProfileType{pb.ProfileType_CPU}, + wantDeploymentLabels: map[string]string{languageLabel: "go"}, + wantProfileLabels: map[string]string{}, + }, + } { + + config = tt.config + config.ProjectID = testProjectID + config.Service = testService + mutexEnabled = tt.enableMutex + a := initializeAgent(nil) + + wantDeployment := &pb.Deployment{ + ProjectId: testProjectID, + Target: testService, + Labels: tt.wantDeploymentLabels, + } + if !testutil.Equal(a.deployment, wantDeployment) { + t.Errorf("initializeAgent() got deployment: %v, want %v", a.deployment, wantDeployment) + } + if !testutil.Equal(a.profileLabels, tt.wantProfileLabels) { + t.Errorf("initializeAgent() got profile labels: %v, want %v", a.profileLabels, tt.wantProfileLabels) + } + if !testutil.Equal(a.profileTypes, tt.wantProfileTypes) { + t.Errorf("initializeAgent() got profile types: %v, want %v", a.profileTypes, tt.wantProfileTypes) + } + } +} + +func TestInitializeConfig(t *testing.T) { + oldConfig, oldService, oldVersion, oldEnvProjectID, oldGetProjectID, oldGetInstanceName, oldGetZone, oldOnGCE := config, os.Getenv("GAE_SERVICE"), os.Getenv("GAE_VERSION"), os.Getenv("GOOGLE_CLOUD_PROJECT"), getProjectID, getInstanceName, getZone, onGCE + defer func() { + config, getProjectID, getInstanceName, getZone, onGCE = oldConfig, oldGetProjectID, oldGetInstanceName, oldGetZone, oldOnGCE + if err := os.Setenv("GAE_SERVICE", oldService); err != nil { + t.Fatal(err) + } + if err := os.Setenv("GAE_VERSION", oldVersion); err != nil { + t.Fatal(err) + } + if err := os.Setenv("GOOGLE_CLOUD_PROJECT", oldEnvProjectID); err != nil { + t.Fatal(err) + } + }() + const ( + testGAEService = "test-gae-service" + testGAEVersion = "test-gae-version" + testGCEProjectID = "test-gce-project-id" + testEnvProjectID = "test-env-project-id" + ) + for _, tt := range []struct { + desc string + config Config + wantConfig Config + wantErrorString string + onGAE bool + onGCE bool + envProjectID bool + }{ + { + "accepts service name", + Config{Service: testService}, + Config{Service: testService, ProjectID: testGCEProjectID, zone: testZone, instance: testInstance}, + "", + false, + true, + false, + }, + { + "env project overrides GCE project", + Config{Service: testService}, + Config{Service: testService, ProjectID: testEnvProjectID, zone: testZone, instance: testInstance}, + "", + false, + true, + true, + }, + { + "requires service name", + Config{}, + Config{}, + "service name must be configured", + false, + true, + false, + }, + { + "requires valid service name", + Config{Service: "Service"}, + Config{Service: "Service"}, + "service name \"Service\" does not match regular expression ^[a-z]([-a-z0-9_.]{0,253}[a-z0-9])?$", + false, + true, + false, + }, + { + "accepts service name from config and service version from GAE", + Config{Service: testService}, + Config{Service: testService, ServiceVersion: testGAEVersion, ProjectID: testGCEProjectID, zone: testZone, instance: testInstance}, + "", + true, + true, + false, + }, + { + "reads both service name and version from GAE env vars", + Config{}, + Config{Service: testGAEService, ServiceVersion: testGAEVersion, ProjectID: testGCEProjectID, zone: testZone, instance: testInstance}, + "", + true, + true, + false, + }, + { + "accepts service version from config", + Config{Service: testService, ServiceVersion: testSvcVersion}, + Config{Service: testService, ServiceVersion: testSvcVersion, ProjectID: testGCEProjectID, zone: testZone, instance: testInstance}, + "", + false, + true, + false, + }, + { + "configured version has priority over GAE-provided version", + Config{Service: testService, ServiceVersion: testSvcVersion}, + Config{Service: testService, ServiceVersion: testSvcVersion, ProjectID: testGCEProjectID, zone: testZone, instance: testInstance}, + "", + true, + true, + false, + }, + { + "configured project ID has priority over metadata-provided project ID", + Config{Service: testService, ProjectID: testProjectID}, + Config{Service: testService, ProjectID: testProjectID, zone: testZone, instance: testInstance}, + "", + false, + true, + false, + }, + { + "configured project ID has priority over environment project ID", + Config{Service: testService, ProjectID: testProjectID}, + Config{Service: testService, ProjectID: testProjectID}, + "", + false, + false, + true, + }, + { + "requires project ID if not on GCE", + Config{Service: testService}, + Config{Service: testService}, + "project ID must be specified in the configuration if running outside of GCP", + false, + false, + false, + }, + } { + t.Logf("Running test: %s", tt.desc) + envService, envVersion := "", "" + if tt.onGAE { + envService, envVersion = testGAEService, testGAEVersion + } + if err := os.Setenv("GAE_SERVICE", envService); err != nil { + t.Fatal(err) + } + if err := os.Setenv("GAE_VERSION", envVersion); err != nil { + t.Fatal(err) + } + if tt.onGCE { + onGCE = func() bool { return true } + getProjectID = func() (string, error) { return testGCEProjectID, nil } + getZone = func() (string, error) { return testZone, nil } + getInstanceName = func() (string, error) { return testInstance, nil } + } else { + onGCE = func() bool { return false } + getProjectID = func() (string, error) { return "", fmt.Errorf("test get project id error") } + getZone = func() (string, error) { return "", fmt.Errorf("test get zone error") } + getInstanceName = func() (string, error) { return "", fmt.Errorf("test get instance error") } + } + envProjectID := "" + if tt.envProjectID { + envProjectID = testEnvProjectID + } + if err := os.Setenv("GOOGLE_CLOUD_PROJECT", envProjectID); err != nil { + t.Fatal(err) + } + + errorString := "" + if err := initializeConfig(tt.config); err != nil { + errorString = err.Error() + } + + if !strings.Contains(errorString, tt.wantErrorString) { + t.Errorf("initializeConfig(%v) got error: %v, want contain %v", tt.config, errorString, tt.wantErrorString) + } + if tt.wantErrorString == "" { + tt.wantConfig.APIAddr = apiAddress + } + if config != tt.wantConfig { + t.Errorf("initializeConfig(%v) got: %v, want %v", tt.config, config, tt.wantConfig) + } + } + + for _, tt := range []struct { + desc string + wantErr bool + getProjectIDError error + getZoneError error + getInstanceError error + }{ + { + desc: "metadata returns error for project ID", + wantErr: true, + getProjectIDError: errors.New("fake get project ID error"), + }, + { + desc: "metadata returns error for zone", + wantErr: true, + getZoneError: errors.New("fake get zone error"), + }, + { + desc: "metadata returns error for instance", + wantErr: true, + getInstanceError: errors.New("fake get instance error"), + }, + { + desc: "metadata returns NotDefinedError for instance", + getInstanceError: gcemd.NotDefinedError("fake GCE metadata NotDefinedError error"), + }, + } { + onGCE = func() bool { return true } + getProjectID = func() (string, error) { return testGCEProjectID, tt.getProjectIDError } + getZone = func() (string, error) { return testZone, tt.getZoneError } + getInstanceName = func() (string, error) { return testInstance, tt.getInstanceError } + + if err := initializeConfig(Config{Service: testService}); (err != nil) != tt.wantErr { + t.Errorf("%s: initializeConfig() got error: %v, want error %t", tt.desc, err, tt.wantErr) + } + } +} + +type fakeProfilerServer struct { + count int + gotProfiles map[string][]byte + done chan bool +} + +func (fs *fakeProfilerServer) CreateProfile(ctx context.Context, in *pb.CreateProfileRequest) (*pb.Profile, error) { + fs.count++ + switch fs.count { + case 1: + return &pb.Profile{Name: "testCPU", ProfileType: pb.ProfileType_CPU, Duration: ptypes.DurationProto(testProfileDuration)}, nil + case 2: + return &pb.Profile{Name: "testHeap", ProfileType: pb.ProfileType_HEAP}, nil + default: + select {} + } +} + +func (fs *fakeProfilerServer) UpdateProfile(ctx context.Context, in *pb.UpdateProfileRequest) (*pb.Profile, error) { + switch in.Profile.ProfileType { + case pb.ProfileType_CPU: + fs.gotProfiles["CPU"] = in.Profile.ProfileBytes + case pb.ProfileType_HEAP: + fs.gotProfiles["HEAP"] = in.Profile.ProfileBytes + fs.done <- true + } + + return in.Profile, nil +} + +func (fs *fakeProfilerServer) CreateOfflineProfile(_ context.Context, _ *pb.CreateOfflineProfileRequest) (*pb.Profile, error) { + return nil, status.Error(codes.Unimplemented, "") +} + +func profileeLoop(quit chan bool) { + for { + select { + case <-quit: + return + default: + profileeWork() + } + } +} + +func profileeWork() { + data := make([]byte, 1024*1024) + rand.Read(data) + + var b bytes.Buffer + gz := gzip.NewWriter(&b) + if _, err := gz.Write(data); err != nil { + log.Println("failed to write to gzip stream", err) + return + } + if err := gz.Flush(); err != nil { + log.Println("failed to flush to gzip stream", err) + return + } + if err := gz.Close(); err != nil { + log.Println("failed to close gzip stream", err) + } +} + +func validateProfile(rawData []byte, wantFunctionName string) error { + p, err := profile.ParseData(rawData) + if err != nil { + return fmt.Errorf("ParseData failed: %v", err) + } + + if len(p.Sample) == 0 { + return fmt.Errorf("profile contains zero samples: %v", p) + } + + if len(p.Location) == 0 { + return fmt.Errorf("profile contains zero locations: %v", p) + } + + if len(p.Function) == 0 { + return fmt.Errorf("profile contains zero functions: %v", p) + } + + for _, l := range p.Location { + if len(l.Line) > 0 && l.Line[0].Function != nil && strings.Contains(l.Line[0].Function.Name, wantFunctionName) { + return nil + } + } + return fmt.Errorf("wanted function name %s not found in the profile", wantFunctionName) +} + +func TestDeltaMutexProfile(t *testing.T) { + oldMutexEnabled, oldMaxProcs := mutexEnabled, runtime.GOMAXPROCS(10) + defer func() { + mutexEnabled = oldMutexEnabled + runtime.GOMAXPROCS(oldMaxProcs) + }() + if mutexEnabled = enableMutexProfiling(); !mutexEnabled { + t.Skip("Go too old - mutex profiling not supported.") + } + + hog(time.Second, mutexHog) + go func() { + hog(2*time.Second, backgroundHog) + }() + + var prof bytes.Buffer + if err := deltaMutexProfile(context.Background(), time.Second, &prof); err != nil { + t.Fatalf("deltaMutexProfile() got error: %v", err) + } + p, err := profile.Parse(&prof) + if err != nil { + t.Fatalf("profile.Parse() got error: %v", err) + } + + if s := sum(p, "mutexHog"); s != 0 { + t.Errorf("mutexHog found in the delta mutex profile (sum=%d):\n%s", s, p) + } + if s := sum(p, "backgroundHog"); s <= 0 { + t.Errorf("backgroundHog not in the delta mutex profile (sum=%d):\n%s", s, p) + } +} + +// sum returns the sum of all mutex counts from the samples whose +// stacks include the specified function name. +func sum(p *profile.Profile, fname string) int64 { + locIDs := map[*profile.Location]bool{} + for _, loc := range p.Location { + for _, l := range loc.Line { + if strings.Contains(l.Function.Name, fname) { + locIDs[loc] = true + break + } + } + } + var s int64 + for _, sample := range p.Sample { + for _, loc := range sample.Location { + if locIDs[loc] { + s += sample.Value[0] + break + } + } + } + return s +} + +func mutexHog(mu1, mu2 *sync.Mutex, start time.Time, dt time.Duration) { + for time.Since(start) < dt { + mu1.Lock() + runtime.Gosched() + mu2.Lock() + mu1.Unlock() + mu2.Unlock() + } +} + +// backgroundHog is identical to mutexHog. We keep them separate +// in order to distinguish them with function names in the stack trace. +func backgroundHog(mu1, mu2 *sync.Mutex, start time.Time, dt time.Duration) { + for time.Since(start) < dt { + mu1.Lock() + runtime.Gosched() + mu2.Lock() + mu1.Unlock() + mu2.Unlock() + } +} + +func hog(dt time.Duration, hogger func(mu1, mu2 *sync.Mutex, start time.Time, dt time.Duration)) { + start := time.Now() + mu1 := new(sync.Mutex) + mu2 := new(sync.Mutex) + var wg sync.WaitGroup + wg.Add(10) + for i := 0; i < 10; i++ { + go func() { + defer wg.Done() + hogger(mu1, mu2, start, dt) + }() + } + wg.Wait() +} + +func TestAgentWithServer(t *testing.T) { + oldDialGRPC, oldConfig := dialGRPC, config + defer func() { + dialGRPC, config = oldDialGRPC, oldConfig + }() + + srv, err := testutil.NewServer() + if err != nil { + t.Fatalf("testutil.NewServer(): %v", err) + } + fakeServer := &fakeProfilerServer{gotProfiles: map[string][]byte{}, done: make(chan bool)} + pb.RegisterProfilerServiceServer(srv.Gsrv, fakeServer) + + srv.Start() + + dialGRPC = gtransport.DialInsecure + if err := Start(Config{ + Service: testService, + ProjectID: testProjectID, + APIAddr: srv.Addr, + instance: testInstance, + zone: testZone, + }); err != nil { + t.Fatalf("Start(): %v", err) + } + + quitProfilee := make(chan bool) + go profileeLoop(quitProfilee) + + select { + case <-fakeServer.done: + case <-time.After(testServerTimeout): + t.Errorf("got timeout after %v, want fake server done", testServerTimeout) + } + quitProfilee <- true + + for _, pType := range []string{"CPU", "HEAP"} { + if profile, ok := fakeServer.gotProfiles[pType]; !ok { + t.Errorf("fakeServer.gotProfiles[%s] got no profile, want profile", pType) + } else if err := validateProfile(profile, "profilee"); err != nil { + t.Errorf("validateProfile(%s) got error: %v", pType, err) + } + } +} diff --git a/vendor/cloud.google.com/go/profiler/proftest/proftest.go b/vendor/cloud.google.com/go/profiler/proftest/proftest.go new file mode 100644 index 000000000..b103dd5a7 --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/proftest/proftest.go @@ -0,0 +1,556 @@ +// 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. +// +// Package proftest contains test helpers for profiler agent integration tests. +// This package is experimental. + +package proftest + +import ( + "archive/zip" + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "log" + "net/http" + "strings" + "time" + + "cloud.google.com/go/storage" + gax "github.com/googleapis/gax-go" + "golang.org/x/build/kubernetes" + k8sapi "golang.org/x/build/kubernetes/api" + "golang.org/x/build/kubernetes/gke" + cloudbuild "google.golang.org/api/cloudbuild/v1" + compute "google.golang.org/api/compute/v1" + container "google.golang.org/api/container/v1" + "google.golang.org/api/googleapi" +) + +const ( + monitorWriteScope = "https://www.googleapis.com/auth/monitoring.write" + storageReadScope = "https://www.googleapis.com/auth/devstorage.read_only" +) + +// TestRunner has common elements used for testing profiling agents on a range +// of environments. +type TestRunner struct { + Client *http.Client +} + +// GCETestRunner supports testing a profiling agent on GCE. +type GCETestRunner struct { + TestRunner + ComputeService *compute.Service +} + +// GKETestRunner supports testing a profiling agent on GKE. +type GKETestRunner struct { + TestRunner + ContainerService *container.Service + StorageClient *storage.Client + Dockerfile string +} + +// ProfileResponse contains the response produced when querying profile server. +type ProfileResponse struct { + Profile ProfileData `json:"profile"` + NumProfiles int32 `json:"numProfiles"` + Deployments []interface{} `json:"deployments"` +} + +// ProfileData has data of a single profile. +type ProfileData struct { + Samples []int32 `json:"samples"` + SampleMetrics interface{} `json:"sampleMetrics"` + DefaultMetricType string `json:"defaultMetricType"` + TreeNodes interface{} `json:"treeNodes"` + Functions functionArray `json:"functions"` + SourceFiles interface{} `json:"sourceFiles"` +} + +type functionArray struct { + Name []string `json:"name"` + Sourcefile []int32 `json:"sourceFile"` +} + +// InstanceConfig is configuration for starting single GCE instance for +// profiling agent test case. +type InstanceConfig struct { + ProjectID string + Zone string + Name string + StartupScript string + MachineType string +} + +// ClusterConfig is configuration for starting single GKE cluster for profiling +// agent test case. +type ClusterConfig struct { + ProjectID string + Zone string + ClusterName string + PodName string + ImageSourceName string + ImageName string + Bucket string + Dockerfile string +} + +// HasFunction returns nil if the function is present, or, if the function is +// not present, and error providing more details why the function is not +// present. +func (pr *ProfileResponse) HasFunction(functionName string) error { + if pr.NumProfiles == 0 { + return fmt.Errorf("failed to find function name %s in profile: profile response contains zero profiles: %v", functionName, pr) + } + if len(pr.Deployments) == 0 { + return fmt.Errorf("failed to find function name %s in profile: profile response contains zero deployments: %v", functionName, pr) + } + if len(pr.Profile.Functions.Name) == 0 { + return fmt.Errorf("failed to find function name %s in profile: profile does not have function data", functionName) + } + + for _, name := range pr.Profile.Functions.Name { + if strings.Contains(name, functionName) { + return nil + } + } + return fmt.Errorf("failed to find function name %s in profile", functionName) +} + +// StartInstance starts a GCE Instance with name, zone, and projectId specified +// by the inst, and which runs the startup script specified in inst. +func (tr *GCETestRunner) StartInstance(ctx context.Context, inst *InstanceConfig) error { + img, err := tr.ComputeService.Images.GetFromFamily("debian-cloud", "debian-9").Context(ctx).Do() + if err != nil { + return err + } + + op, err := tr.ComputeService.Instances.Insert(inst.ProjectID, inst.Zone, &compute.Instance{ + MachineType: fmt.Sprintf("zones/%s/machineTypes/%s", inst.Zone, inst.MachineType), + Name: inst.Name, + Disks: []*compute.AttachedDisk{{ + AutoDelete: true, // delete the disk when the VM is deleted. + Boot: true, + Type: "PERSISTENT", + Mode: "READ_WRITE", + InitializeParams: &compute.AttachedDiskInitializeParams{ + SourceImage: img.SelfLink, + DiskType: fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/zones/%s/diskTypes/pd-standard", inst.ProjectID, inst.Zone), + }, + }}, + NetworkInterfaces: []*compute.NetworkInterface{{ + Network: fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/networks/default", inst.ProjectID), + AccessConfigs: []*compute.AccessConfig{{ + Name: "External NAT", + }}, + }}, + Metadata: &compute.Metadata{ + Items: []*compute.MetadataItems{{ + Key: "startup-script", + Value: googleapi.String(inst.StartupScript), + }}, + }, + ServiceAccounts: []*compute.ServiceAccount{{ + Email: "default", + Scopes: []string{ + monitorWriteScope, + }, + }}, + }).Do() + + if err != nil { + return fmt.Errorf("failed to create instance: %v", err) + } + + // Poll status of the operation to create the instance. + getOpCall := tr.ComputeService.ZoneOperations.Get(inst.ProjectID, inst.Zone, op.Name) + for { + if err := checkOpErrors(op); err != nil { + return fmt.Errorf("failed to create instance: %v", err) + } + if op.Status == "DONE" { + return nil + } + + if err := gax.Sleep(ctx, 5*time.Second); err != nil { + return err + } + + op, err = getOpCall.Do() + if err != nil { + return fmt.Errorf("failed to get operation: %v", err) + } + } +} + +// checkOpErrors returns nil if the operation does not have any errors and an +// error summarizing all errors encountered if the operation has errored. +func checkOpErrors(op *compute.Operation) error { + if op.Error == nil || len(op.Error.Errors) == 0 { + return nil + } + + var errs []string + for _, e := range op.Error.Errors { + if e.Message != "" { + errs = append(errs, e.Message) + } else { + errs = append(errs, e.Code) + } + } + return errors.New(strings.Join(errs, ",")) +} + +// DeleteInstance deletes an instance with project id, name, and zone matched +// by inst. +func (tr *GCETestRunner) DeleteInstance(ctx context.Context, inst *InstanceConfig) error { + if _, err := tr.ComputeService.Instances.Delete(inst.ProjectID, inst.Zone, inst.Name).Context(ctx).Do(); err != nil { + return fmt.Errorf("Instances.Delete(%s) got error: %v", inst.Name, err) + } + return nil +} + +// PollForSerialOutput polls serial port 2 of the GCE instance specified by +// inst and returns when the finishString appears in the serial output +// of the instance, or when the context times out. +func (tr *GCETestRunner) PollForSerialOutput(ctx context.Context, inst *InstanceConfig, finishString, errorString string) error { + var output string + defer func() { + log.Printf("Serial port output for %s:\n%s", inst.Name, output) + }() + + for { + select { + case <-ctx.Done(): + return ctx.Err() + case <-time.After(20 * time.Second): + resp, err := tr.ComputeService.Instances.GetSerialPortOutput(inst.ProjectID, inst.Zone, inst.Name).Port(2).Context(ctx).Do() + if err != nil { + // Transient failure. + log.Printf("Transient error getting serial port output from instance %s (will retry): %v", inst.Name, err) + continue + } + if resp.Contents == "" { + log.Printf("Ignoring empty serial port output from instance %s (will retry)", inst.Name) + continue + } + if output = resp.Contents; strings.Contains(output, finishString) { + return nil + } + if strings.Contains(output, errorString) { + return fmt.Errorf("failed to execute the prober benchmark script") + } + } + } +} + +// QueryProfiles retrieves profiles of a specific type, from a specific time +// range, associated with a particular service and project. +func (tr *TestRunner) QueryProfiles(projectID, service, startTime, endTime, profileType string) (ProfileResponse, error) { + queryURL := fmt.Sprintf("https://cloudprofiler.googleapis.com/v2/projects/%s/profiles:query", projectID) + const queryJSONFmt = `{"endTime": "%s", "profileType": "%s","startTime": "%s", "target": "%s"}` + + queryRequest := fmt.Sprintf(queryJSONFmt, endTime, profileType, startTime, service) + + resp, err := tr.Client.Post(queryURL, "application/json", strings.NewReader(queryRequest)) + if err != nil { + return ProfileResponse{}, fmt.Errorf("failed to query API: %v", err) + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return ProfileResponse{}, fmt.Errorf("failed to read response body: %v", err) + } + + if resp.StatusCode != 200 { + return ProfileResponse{}, fmt.Errorf("failed to query API: status: %s, response body: %s", resp.Status, string(body)) + } + + var pr ProfileResponse + if err := json.Unmarshal(body, &pr); err != nil { + return ProfileResponse{}, err + } + + return pr, nil +} + +// createAndPublishDockerImage creates a docker image from source code in a GCS +// bucket and pushes the image to Google Container Registry. +func (tr *GKETestRunner) createAndPublishDockerImage(ctx context.Context, projectID, sourceBucket, sourceObject, ImageName string) error { + cloudbuildService, err := cloudbuild.New(tr.Client) + if err != nil { + return err + } + + build := &cloudbuild.Build{ + Source: &cloudbuild.Source{ + StorageSource: &cloudbuild.StorageSource{ + Bucket: sourceBucket, + Object: sourceObject, + }, + }, + Steps: []*cloudbuild.BuildStep{ + { + Name: "gcr.io/cloud-builders/docker", + Args: []string{"build", "-t", ImageName, "."}, + }, + }, + Images: []string{ImageName}, + } + + op, err := cloudbuildService.Projects.Builds.Create(projectID, build).Context(ctx).Do() + if err != nil { + return fmt.Errorf("failed to create image: %v", err) + } + opID := op.Name + + // Wait for creating image. + for { + select { + case <-ctx.Done(): + return fmt.Errorf("timed out waiting creating image") + + case <-time.After(10 * time.Second): + op, err := cloudbuildService.Operations.Get(opID).Context(ctx).Do() + if err != nil { + log.Printf("Transient error getting operation (will retry): %v", err) + break + } + if op.Done == true { + log.Printf("Published image %s to Google Container Registry.", ImageName) + return nil + } + } + } +} + +type imageResponse struct { + Manifest map[string]interface{} `json:"manifest"` + Name string `json:"name"` + Tags []string `json:"tags"` +} + +// deleteDockerImage deletes a docker image from Google Container Registry. +func (tr *GKETestRunner) deleteDockerImage(ctx context.Context, ImageName string) []error { + queryImageURL := fmt.Sprintf("https://gcr.io/v2/%s/tags/list", ImageName) + resp, err := tr.Client.Get(queryImageURL) + if err != nil { + return []error{fmt.Errorf("failed to list tags: %v", err)} + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return []error{err} + } + var ir imageResponse + if err := json.Unmarshal(body, &ir); err != nil { + return []error{err} + } + + const deleteImageURLFmt = "https://gcr.io/v2/%s/manifests/%s" + var errs []error + for _, tag := range ir.Tags { + if err := deleteDockerImageResource(tr.Client, fmt.Sprintf(deleteImageURLFmt, ImageName, tag)); err != nil { + errs = append(errs, fmt.Errorf("failed to delete tag %s: %v", tag, err)) + } + } + + for manifest := range ir.Manifest { + if err := deleteDockerImageResource(tr.Client, fmt.Sprintf(deleteImageURLFmt, ImageName, manifest)); err != nil { + errs = append(errs, fmt.Errorf("failed to delete manifest %s: %v", manifest, err)) + } + } + return errs +} + +func deleteDockerImageResource(client *http.Client, url string) error { + req, err := http.NewRequest("DELETE", url, nil) + if err != nil { + return fmt.Errorf("failed to get request: %v", err) + } + resp, err := client.Do(req) + if err != nil { + return fmt.Errorf("failed to delete resource: %v", err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusAccepted { + return fmt.Errorf("failed to delete resource: status code = %d", resp.StatusCode) + } + return nil +} + +func (tr *GKETestRunner) createCluster(ctx context.Context, client *http.Client, projectID, zone, ClusterName string) error { + request := &container.CreateClusterRequest{Cluster: &container.Cluster{ + Name: ClusterName, + InitialNodeCount: 3, + NodeConfig: &container.NodeConfig{ + OauthScopes: []string{ + storageReadScope, + }, + }, + }} + op, err := tr.ContainerService.Projects.Zones.Clusters.Create(projectID, zone, request).Context(ctx).Do() + if err != nil { + return fmt.Errorf("failed to create cluster %s: %v", ClusterName, err) + } + opID := op.Name + + // Wait for creating cluster. + for { + select { + case <-ctx.Done(): + return fmt.Errorf("timed out waiting creating cluster") + + case <-time.After(10 * time.Second): + op, err := tr.ContainerService.Projects.Zones.Operations.Get(projectID, zone, opID).Context(ctx).Do() + if err != nil { + log.Printf("Transient error getting operation (will retry): %v", err) + break + } + if op.Status == "DONE" { + log.Printf("Created cluster %s.", ClusterName) + return nil + } + if op.Status == "ABORTING" { + return fmt.Errorf("create cluster operation is aborted") + } + } + } +} + +func (tr *GKETestRunner) deployContainer(ctx context.Context, kubernetesClient *kubernetes.Client, podName, ImageName string) error { + // TODO: Pod restart policy defaults to "Always". Previous logs will disappear + // after restarting. Always restart causes the test not be able to see the + // finish signal. Should probably set the restart policy to "OnFailure" when + // we get the GKE workflow working and testable. + pod := &k8sapi.Pod{ + ObjectMeta: k8sapi.ObjectMeta{ + Name: podName, + }, + Spec: k8sapi.PodSpec{ + Containers: []k8sapi.Container{ + { + Name: "profiler-test", + Image: fmt.Sprintf("gcr.io/%s:latest", ImageName), + }, + }, + }, + } + if _, err := kubernetesClient.RunLongLivedPod(ctx, pod); err != nil { + return fmt.Errorf("failed to run pod %s: %v", podName, err) + } + return nil +} + +// PollPodLog polls the log of the kubernetes client and returns when the +// finishString appears in the log, or when the context times out. +func (tr *GKETestRunner) PollPodLog(ctx context.Context, kubernetesClient *kubernetes.Client, podName, finishString string) error { + var output string + defer func() { + log.Printf("Log for pod %s:\n%s", podName, output) + }() + + for { + select { + case <-ctx.Done(): + return fmt.Errorf("timed out waiting profiling finishing on container") + + case <-time.After(20 * time.Second): + var err error + output, err = kubernetesClient.PodLog(ctx, podName) + if err != nil { + // Transient failure. + log.Printf("Transient error getting log (will retry): %v", err) + continue + } + if strings.Contains(output, finishString) { + return nil + } + } + } +} + +// DeleteClusterAndImage deletes cluster and images used to create cluster. +func (tr *GKETestRunner) DeleteClusterAndImage(ctx context.Context, cfg *ClusterConfig) []error { + var errs []error + if err := tr.StorageClient.Bucket(cfg.Bucket).Object(cfg.ImageSourceName).Delete(ctx); err != nil { + errs = append(errs, fmt.Errorf("failed to delete storage client: %v", err)) + } + for _, err := range tr.deleteDockerImage(ctx, cfg.ImageName) { + errs = append(errs, fmt.Errorf("failed to delete docker image: %v", err)) + } + if _, err := tr.ContainerService.Projects.Zones.Clusters.Delete(cfg.ProjectID, cfg.Zone, cfg.ClusterName).Context(ctx).Do(); err != nil { + errs = append(errs, fmt.Errorf("failed to delete cluster %s: %v", cfg.ClusterName, err)) + } + + return errs +} + +// StartAndDeployCluster creates image needed for cluster, then starts and +// deploys to cluster. +func (tr *GKETestRunner) StartAndDeployCluster(ctx context.Context, cfg *ClusterConfig) error { + if err := tr.uploadImageSource(ctx, cfg.Bucket, cfg.ImageSourceName, cfg.Dockerfile); err != nil { + return fmt.Errorf("failed to upload image source: %v", err) + } + + createImageCtx, cancel := context.WithTimeout(ctx, 5*time.Minute) + defer cancel() + if err := tr.createAndPublishDockerImage(createImageCtx, cfg.ProjectID, cfg.Bucket, cfg.ImageSourceName, fmt.Sprintf("gcr.io/%s", cfg.ImageName)); err != nil { + return fmt.Errorf("failed to create and publish docker image %s: %v", cfg.ImageName, err) + } + + kubernetesClient, err := gke.NewClient(ctx, cfg.ClusterName, gke.OptZone(cfg.Zone), gke.OptProject(cfg.ProjectID)) + if err != nil { + return fmt.Errorf("failed to create new GKE client: %v", err) + } + + deployContainerCtx, cancel := context.WithTimeout(ctx, 5*time.Minute) + defer cancel() + if err := tr.deployContainer(deployContainerCtx, kubernetesClient, cfg.PodName, cfg.ImageName); err != nil { + return fmt.Errorf("failed to deploy image %q to pod %q: %v", cfg.PodName, cfg.ImageName, err) + } + return nil +} + +// uploadImageSource uploads source code for building docker image to GCS. +func (tr *GKETestRunner) uploadImageSource(ctx context.Context, bucket, objectName, dockerfile string) error { + zipBuf := new(bytes.Buffer) + z := zip.NewWriter(zipBuf) + f, err := z.Create("Dockerfile") + if err != nil { + return err + } + + if _, err := f.Write([]byte(dockerfile)); err != nil { + return err + } + + if err := z.Close(); err != nil { + return err + } + wc := tr.StorageClient.Bucket(bucket).Object(objectName).NewWriter(ctx) + wc.ContentType = "application/zip" + wc.ACL = []storage.ACLRule{{Entity: storage.AllUsers, Role: storage.RoleReader}} + if _, err := wc.Write(zipBuf.Bytes()); err != nil { + return err + } + return wc.Close() +} diff --git a/vendor/cloud.google.com/go/profiler/symbolizer.go b/vendor/cloud.google.com/go/profiler/symbolizer.go new file mode 100644 index 000000000..4d3d52204 --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/symbolizer.go @@ -0,0 +1,140 @@ +// Copyright 2017 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 profiler + +import ( + "bytes" + "regexp" + "runtime" + "strings" + + "github.com/google/pprof/profile" +) + +var shouldAssumeSymbolized = isSymbolizedGoVersion(runtime.Version()) + +type function interface { + Name() string + FileLine(pc uintptr) (string, int) +} + +// funcForPC is a wrapper for runtime.FuncForPC. Defined as var for testing. +var funcForPC = func(pc uintptr) function { + return runtime.FuncForPC(pc) +} + +// parseAndSymbolize parses a profile from a buffer, symbolizes it +// if it's not yet symbolized, and writes the profile back as a +// gzip-compressed marshaled protobuf. +func parseAndSymbolize(data *bytes.Buffer) error { + p, err := profile.ParseData(data.Bytes()) + if err != nil { + return err + } + + // Do nothing if the profile is already symbolized. + if symbolized(p) { + return nil + } + // Clear the profile functions to avoid creating duplicates. + p.Function = nil + symbolize(p) + data.Reset() + return p.Write(data) +} + +// isSymbolizedGoVersion returns true if Go version equals to or is +// higher than Go 1.9. Starting Go 1.9 the profiles are symbolized +// by runtime/pprof. +func isSymbolizedGoVersion(goVersion string) bool { + r, err := regexp.Compile(`go(1\.9|1\.[1-9][0-9]|[2-9]).*`) + if err == nil && r.MatchString(goVersion) { + return true + } + return false +} + +// symbolized checks if all locations have symbolized function +// information. +func symbolized(p *profile.Profile) bool { + for _, l := range p.Location { + if len(l.Line) == 0 || l.Line[0].Function == nil { + return false + } + } + return true +} + +func symbolize(p *profile.Profile) { + fns := profileFunctionMap{} + for _, l := range p.Location { + pc := uintptr(l.Address) + f := funcForPC(pc) + if f == nil { + continue + } + file, lineno := f.FileLine(pc) + l.Line = []profile.Line{ + { + Function: fns.findOrAddFunction(f.Name(), file, p), + Line: int64(lineno), + }, + } + } + // Trim runtime functions. Always hide runtime.goexit. Other runtime + // functions are only hidden for heap profile when they appear at the beginning. + isHeapProfile := p.PeriodType != nil && p.PeriodType.Type == "space" + for _, s := range p.Sample { + show := !isHeapProfile + var i int + for _, l := range s.Location { + if len(l.Line) > 0 && l.Line[0].Function != nil { + name := l.Line[0].Function.Name + if name == "runtime.goexit" || !show && strings.HasPrefix(name, "runtime.") { + continue + } + } + show = true + s.Location[i] = l + i++ + } + // If all locations of a sample are trimmed, keep the root location. + if i == 0 && len(s.Location) > 0 { + s.Location[0] = s.Location[len(s.Location)-1] + i = 1 + } + s.Location = s.Location[:i] + } +} + +type profileFunctionMap map[profile.Function]*profile.Function + +func (fns profileFunctionMap) findOrAddFunction(name, filename string, p *profile.Profile) *profile.Function { + f := profile.Function{ + Name: name, + SystemName: name, + Filename: filename, + } + if fp := fns[f]; fp != nil { + return fp + } + fp := new(profile.Function) + fns[f] = fp + + *fp = f + fp.ID = uint64(len(p.Function) + 1) + p.Function = append(p.Function, fp) + return fp +} diff --git a/vendor/cloud.google.com/go/profiler/symbolizer_test.go b/vendor/cloud.google.com/go/profiler/symbolizer_test.go new file mode 100644 index 000000000..bdcf808c2 --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/symbolizer_test.go @@ -0,0 +1,229 @@ +// Copyright 2017 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 profiler + +import ( + "bytes" + "testing" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/google/pprof/profile" +) + +type fakeFunc struct { + name string + file string + lineno int +} + +func (f *fakeFunc) Name() string { + return f.name +} +func (f *fakeFunc) FileLine(_ uintptr) (string, int) { + return f.file, f.lineno +} + +var cmpOpt = cmpopts.IgnoreUnexported(profile.Profile{}, profile.Function{}, + profile.Line{}, profile.Location{}, profile.Sample{}, profile.ValueType{}) + +// TestRuntimeFunctionTrimming tests if symbolize trims runtime functions as intended. +func TestRuntimeFunctionTrimming(t *testing.T) { + fakeFuncMap := map[uintptr]*fakeFunc{ + 0x10: {"runtime.goexit", "runtime.go", 10}, + 0x20: {"runtime.other", "runtime.go", 20}, + 0x30: {"foo", "foo.go", 30}, + 0x40: {"bar", "bar.go", 40}, + } + backupFuncForPC := funcForPC + funcForPC = func(pc uintptr) function { + return fakeFuncMap[pc] + } + defer func() { + funcForPC = backupFuncForPC + }() + testLoc := []*profile.Location{ + {ID: 1, Address: 0x10}, + {ID: 2, Address: 0x20}, + {ID: 3, Address: 0x30}, + {ID: 4, Address: 0x40}, + } + testProfile := &profile.Profile{ + Sample: []*profile.Sample{ + {Location: []*profile.Location{testLoc[0], testLoc[1], testLoc[3], testLoc[2]}}, + {Location: []*profile.Location{testLoc[1], testLoc[3], testLoc[2]}}, + {Location: []*profile.Location{testLoc[3], testLoc[2], testLoc[1]}}, + {Location: []*profile.Location{testLoc[3], testLoc[2], testLoc[0]}}, + {Location: []*profile.Location{testLoc[0], testLoc[1], testLoc[3], testLoc[0]}}, + {Location: []*profile.Location{testLoc[1], testLoc[0]}}, + }, + Location: testLoc, + } + testProfiles := make([]*profile.Profile, 2) + testProfiles[0] = testProfile.Copy() + testProfiles[1] = testProfile.Copy() + // Test case for CPU profile. + testProfiles[0].PeriodType = &profile.ValueType{Type: "cpu", Unit: "nanoseconds"} + // Test case for heap profile. + testProfiles[1].PeriodType = &profile.ValueType{Type: "space", Unit: "bytes"} + wantFunc := []*profile.Function{ + {ID: 1, Name: "runtime.goexit", SystemName: "runtime.goexit", Filename: "runtime.go"}, + {ID: 2, Name: "runtime.other", SystemName: "runtime.other", Filename: "runtime.go"}, + {ID: 3, Name: "foo", SystemName: "foo", Filename: "foo.go"}, + {ID: 4, Name: "bar", SystemName: "bar", Filename: "bar.go"}, + } + wantLoc := []*profile.Location{ + {ID: 1, Address: 0x10, Line: []profile.Line{{Function: wantFunc[0], Line: 10}}}, + {ID: 2, Address: 0x20, Line: []profile.Line{{Function: wantFunc[1], Line: 20}}}, + {ID: 3, Address: 0x30, Line: []profile.Line{{Function: wantFunc[2], Line: 30}}}, + {ID: 4, Address: 0x40, Line: []profile.Line{{Function: wantFunc[3], Line: 40}}}, + } + wantProfiles := []*profile.Profile{ + { + PeriodType: &profile.ValueType{Type: "cpu", Unit: "nanoseconds"}, + Sample: []*profile.Sample{ + {Location: []*profile.Location{wantLoc[1], wantLoc[3], wantLoc[2]}}, + {Location: []*profile.Location{wantLoc[1], wantLoc[3], wantLoc[2]}}, + {Location: []*profile.Location{wantLoc[3], wantLoc[2], wantLoc[1]}}, + {Location: []*profile.Location{wantLoc[3], wantLoc[2]}}, + {Location: []*profile.Location{wantLoc[1], wantLoc[3]}}, + {Location: []*profile.Location{wantLoc[1]}}, + }, + Location: wantLoc, + Function: wantFunc, + }, + { + PeriodType: &profile.ValueType{Type: "space", Unit: "bytes"}, + Sample: []*profile.Sample{ + {Location: []*profile.Location{wantLoc[3], wantLoc[2]}}, + {Location: []*profile.Location{wantLoc[3], wantLoc[2]}}, + {Location: []*profile.Location{wantLoc[3], wantLoc[2], wantLoc[1]}}, + {Location: []*profile.Location{wantLoc[3], wantLoc[2]}}, + {Location: []*profile.Location{wantLoc[3]}}, + {Location: []*profile.Location{wantLoc[0]}}, + }, + Location: wantLoc, + Function: wantFunc, + }, + } + for i := 0; i < 2; i++ { + symbolize(testProfiles[i]) + if !testutil.Equal(testProfiles[i], wantProfiles[i], cmpOpt) { + t.Errorf("incorrect trimming (testcase = %d): got {%v}, want {%v}", i, testProfiles[i], wantProfiles[i]) + } + } +} + +// TestParseAndSymbolize tests if parseAndSymbolize parses and symbolizes +// profiles as intended. +func TestParseAndSymbolize(t *testing.T) { + fakeFuncMap := map[uintptr]*fakeFunc{ + 0x10: {"foo", "foo.go", 10}, + 0x20: {"bar", "bar.go", 20}, + } + backupFuncForPC := funcForPC + funcForPC = func(pc uintptr) function { + return fakeFuncMap[pc] + } + defer func() { + funcForPC = backupFuncForPC + }() + + testLoc := []*profile.Location{ + {ID: 1, Address: 0x10}, + {ID: 2, Address: 0x20}, + } + testProfile := &profile.Profile{ + SampleType: []*profile.ValueType{ + {Type: "cpu", Unit: "nanoseconds"}, + }, + PeriodType: &profile.ValueType{Type: "cpu", Unit: "nanoseconds"}, + Sample: []*profile.Sample{ + {Location: []*profile.Location{testLoc[0], testLoc[1]}, Value: []int64{1}}, + {Location: []*profile.Location{testLoc[1]}, Value: []int64{1}}, + }, + Location: testLoc, + } + testProfiles := make([]*profile.Profile, 2) + testProfiles[0] = testProfile.Copy() + testProfiles[1] = testProfile.Copy() + + wantFunc := []*profile.Function{ + {ID: 1, Name: "foo", SystemName: "foo", Filename: "foo.go"}, + {ID: 2, Name: "bar", SystemName: "bar", Filename: "bar.go"}, + } + wantLoc := []*profile.Location{ + {ID: 1, Address: 0x10, Line: []profile.Line{{Function: wantFunc[0], Line: 10}}}, + {ID: 2, Address: 0x20, Line: []profile.Line{{Function: wantFunc[1], Line: 20}}}, + } + wantProfile := &profile.Profile{ + SampleType: []*profile.ValueType{ + {Type: "cpu", Unit: "nanoseconds"}, + }, + PeriodType: &profile.ValueType{Type: "cpu", Unit: "nanoseconds"}, + Sample: []*profile.Sample{ + {Location: []*profile.Location{wantLoc[0], wantLoc[1]}, Value: []int64{1}}, + {Location: []*profile.Location{wantLoc[1]}, Value: []int64{1}}, + }, + Location: wantLoc, + Function: wantFunc, + } + + // Profile already symbolized. + testProfiles[1].Location = []*profile.Location{ + {ID: 1, Address: 0x10, Line: []profile.Line{{Function: wantFunc[0], Line: 10}}}, + {ID: 2, Address: 0x20, Line: []profile.Line{{Function: wantFunc[1], Line: 20}}}, + } + testProfiles[1].Function = []*profile.Function{ + {ID: 1, Name: "foo", SystemName: "foo", Filename: "foo.go"}, + {ID: 2, Name: "bar", SystemName: "bar", Filename: "bar.go"}, + } + for i := 0; i < 2; i++ { + var prof bytes.Buffer + testProfiles[i].Write(&prof) + + parseAndSymbolize(&prof) + gotProfile, err := profile.ParseData(prof.Bytes()) + if err != nil { + t.Errorf("parsing symbolized profile (testcase = %d) got err: %v, want no error", i, err) + } + if !testutil.Equal(gotProfile, wantProfile, cmpOpt) { + t.Errorf("incorrect symbolization (testcase = %d): got {%v}, want {%v}", i, gotProfile, wantProfile) + } + } +} + +func TestIsSymbolizedGoVersion(t *testing.T) { + for _, tc := range []struct { + input string + want bool + }{ + {"go1.9beta2", true}, + {"go1.9", true}, + {"go1.9.1", true}, + {"go1.10", true}, + {"go1.10.1", true}, + {"go2.0", true}, + {"go3.1", true}, + {"go1.8", false}, + {"go1.8.1", false}, + {"go1.7", false}, + {"devel ", false}, + } { + if got := isSymbolizedGoVersion(tc.input); got != tc.want { + t.Errorf("isSymbolizedGoVersion(%v) got %v, want %v", tc.input, got, tc.want) + } + } +} diff --git a/vendor/cloud.google.com/go/profiler/testdata/testdata.go b/vendor/cloud.google.com/go/profiler/testdata/testdata.go new file mode 100644 index 000000000..defa7deeb --- /dev/null +++ b/vendor/cloud.google.com/go/profiler/testdata/testdata.go @@ -0,0 +1,126 @@ +// 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. + +// Package testdata provides some useful data sets for testing purposes. +package testdata + +import ( + "github.com/google/pprof/profile" +) + +var functions = []*profile.Function{ + {ID: 1, Name: "main", SystemName: "main", Filename: "main.go"}, + {ID: 2, Name: "foo", SystemName: "foo", Filename: "foo.go"}, + {ID: 3, Name: "foo_caller", SystemName: "foo_caller", Filename: "foo.go"}, +} + +const mainBinary = "/bin/main" + +var mappings = []*profile.Mapping{ + { + ID: 1, + Start: 0x10000, + Limit: 0x40000, + File: mainBinary, + HasFunctions: true, + HasFilenames: true, + HasLineNumbers: true, + HasInlineFrames: true, + }, + { + ID: 2, + Start: 0x1000, + Limit: 0x4000, + File: "/lib/lib.so", + HasFunctions: true, + HasFilenames: true, + HasLineNumbers: true, + HasInlineFrames: true, + }, +} + +var locations = []*profile.Location{ + { + ID: 1, + Mapping: mappings[1], + Address: 0x1000, + Line: []profile.Line{ + {Function: functions[0], Line: 1}, + }, + }, + { + ID: 2, + Mapping: mappings[0], + Address: 0x2000, + Line: []profile.Line{ + {Function: functions[1], Line: 2}, + {Function: functions[2], Line: 1}, + }, + }, +} + +// HeapProfileCollected1 represents a heap profile which could be collected using +// pprof.WriteHeapProfile(). +var HeapProfileCollected1 = &profile.Profile{ + DurationNanos: 10e9, + SampleType: []*profile.ValueType{ + {Type: "alloc_objects", Unit: "count"}, + {Type: "alloc_space", Unit: "bytes"}, + {Type: "inuse_objects", Unit: "count"}, + {Type: "inuse_space", Unit: "bytes"}, + }, + Sample: []*profile.Sample{{ + Location: []*profile.Location{locations[0], locations[1]}, + Value: []int64{10, 160, 10, 160}, + NumLabel: map[string][]int64{ + "bytes": {16}, + }, + NumUnit: map[string][]string{ + "bytes": {"bytes"}, + }, + }}, + Location: locations, + Function: functions, + Mapping: mappings, +} + +// HeapProfileUploaded represents the heap profile bytes we would expect to +// be uploaded if HeapProfileCollected1 were returned when profiling. +var HeapProfileUploaded = func() *profile.Profile { + p := HeapProfileCollected1.Copy() + p.Sample[0].Value = []int64{0, 0, 10, 160} + return p +}() + +// HeapProfileCollected2 represents a heap profile which could be collected using +// pprof.WriteHeapProfile(). +var HeapProfileCollected2 = func() *profile.Profile { + p := HeapProfileCollected1.Copy() + p.Sample[0].Value = []int64{11, 176, 11, 176} + return p +}() + +// AllocProfileUploaded represents the allocation profile bytes we would expect +// to be uploaded if HeapProfileCollected1 was returned when first profiling +// and HeapProfileCollect2 was return when profiling the second time. +var AllocProfileUploaded = func() *profile.Profile { + p := HeapProfileCollected1.Copy() + p.DurationNanos = 5e9 + p.SampleType = []*profile.ValueType{ + {Type: "alloc_objects", Unit: "count"}, + {Type: "alloc_space", Unit: "bytes"}, + } + p.Sample[0].Value = []int64{1, 16} + return p +}() diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/ListTopics_smoke_test.go b/vendor/cloud.google.com/go/pubsub/apiv1/ListTopics_smoke_test.go new file mode 100644 index 000000000..991d0a94c --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/ListTopics_smoke_test.go @@ -0,0 +1,67 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package pubsub + +import ( + pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestPublisherSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewPublisherClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var formattedProject string = fmt.Sprintf("projects/%s", projectId) + var request = &pubsubpb.ListTopicsRequest{ + Project: formattedProject, + } + + iter := c.ListTopics(ctx, request) + if _, err := iter.Next(); err != nil && err != iterator.Done { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/README.md b/vendor/cloud.google.com/go/pubsub/apiv1/README.md new file mode 100644 index 000000000..b5967ab9c --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/README.md @@ -0,0 +1,9 @@ +Auto-generated pubsub v1 clients +================================= + +This package includes auto-generated clients for the pubsub v1 API. + +Use the handwritten client (in the parent directory, +cloud.google.com/go/pubsub) in preference to this. + +This code is EXPERIMENTAL and subject to CHANGE AT ANY TIME. diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/doc.go b/vendor/cloud.google.com/go/pubsub/apiv1/doc.go new file mode 100644 index 000000000..5081693ff --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/doc.go @@ -0,0 +1,93 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package pubsub is an auto-generated package for the +// Google Cloud Pub/Sub API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Provides reliable, many-to-many, asynchronous messaging between +// applications. +// +// Use the client at cloud.google.com/go/pubsub in preference to this. +package pubsub // import "cloud.google.com/go/pubsub/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/pubsub", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/iam.go b/vendor/cloud.google.com/go/pubsub/apiv1/iam.go new file mode 100644 index 000000000..4a0c231d7 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/iam.go @@ -0,0 +1,36 @@ +// 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 +// +// https://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 pubsub + +import ( + "cloud.google.com/go/iam" + pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" +) + +func (c *PublisherClient) SubscriptionIAM(subscription *pubsubpb.Subscription) *iam.Handle { + return iam.InternalNewHandle(c.Connection(), subscription.Name) +} + +func (c *PublisherClient) TopicIAM(topic *pubsubpb.Topic) *iam.Handle { + return iam.InternalNewHandle(c.Connection(), topic.Name) +} + +func (c *SubscriberClient) SubscriptionIAM(subscription *pubsubpb.Subscription) *iam.Handle { + return iam.InternalNewHandle(c.Connection(), subscription.Name) +} + +func (c *SubscriberClient) TopicIAM(topic *pubsubpb.Topic) *iam.Handle { + return iam.InternalNewHandle(c.Connection(), topic.Name) +} diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/mock_test.go b/vendor/cloud.google.com/go/pubsub/apiv1/mock_test.go new file mode 100644 index 000000000..6dee0d812 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/mock_test.go @@ -0,0 +1,1878 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package pubsub + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + timestamppb "github.com/golang/protobuf/ptypes/timestamp" + iampb "google.golang.org/genproto/googleapis/iam/v1" + pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" + field_maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockPublisherServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + pubsubpb.PublisherServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockPublisherServer) CreateTopic(ctx context.Context, req *pubsubpb.Topic) (*pubsubpb.Topic, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.Topic), nil +} + +func (s *mockPublisherServer) UpdateTopic(ctx context.Context, req *pubsubpb.UpdateTopicRequest) (*pubsubpb.Topic, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.Topic), nil +} + +func (s *mockPublisherServer) Publish(ctx context.Context, req *pubsubpb.PublishRequest) (*pubsubpb.PublishResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.PublishResponse), nil +} + +func (s *mockPublisherServer) GetTopic(ctx context.Context, req *pubsubpb.GetTopicRequest) (*pubsubpb.Topic, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.Topic), nil +} + +func (s *mockPublisherServer) ListTopics(ctx context.Context, req *pubsubpb.ListTopicsRequest) (*pubsubpb.ListTopicsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.ListTopicsResponse), nil +} + +func (s *mockPublisherServer) ListTopicSubscriptions(ctx context.Context, req *pubsubpb.ListTopicSubscriptionsRequest) (*pubsubpb.ListTopicSubscriptionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.ListTopicSubscriptionsResponse), nil +} + +func (s *mockPublisherServer) DeleteTopic(ctx context.Context, req *pubsubpb.DeleteTopicRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +type mockIamPolicyServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + iampb.IAMPolicyServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockIamPolicyServer) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockIamPolicyServer) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockIamPolicyServer) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.TestIamPermissionsResponse), nil +} + +type mockSubscriberServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + pubsubpb.SubscriberServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockSubscriberServer) CreateSubscription(ctx context.Context, req *pubsubpb.Subscription) (*pubsubpb.Subscription, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.Subscription), nil +} + +func (s *mockSubscriberServer) GetSubscription(ctx context.Context, req *pubsubpb.GetSubscriptionRequest) (*pubsubpb.Subscription, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.Subscription), nil +} + +func (s *mockSubscriberServer) UpdateSubscription(ctx context.Context, req *pubsubpb.UpdateSubscriptionRequest) (*pubsubpb.Subscription, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.Subscription), nil +} + +func (s *mockSubscriberServer) ListSubscriptions(ctx context.Context, req *pubsubpb.ListSubscriptionsRequest) (*pubsubpb.ListSubscriptionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.ListSubscriptionsResponse), nil +} + +func (s *mockSubscriberServer) DeleteSubscription(ctx context.Context, req *pubsubpb.DeleteSubscriptionRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockSubscriberServer) ModifyAckDeadline(ctx context.Context, req *pubsubpb.ModifyAckDeadlineRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockSubscriberServer) Acknowledge(ctx context.Context, req *pubsubpb.AcknowledgeRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockSubscriberServer) Pull(ctx context.Context, req *pubsubpb.PullRequest) (*pubsubpb.PullResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.PullResponse), nil +} + +func (s *mockSubscriberServer) StreamingPull(stream pubsubpb.Subscriber_StreamingPullServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + for { + if req, err := stream.Recv(); err == io.EOF { + break + } else if err != nil { + return err + } else { + s.reqs = append(s.reqs, req) + } + } + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*pubsubpb.StreamingPullResponse)); err != nil { + return err + } + } + return nil +} + +func (s *mockSubscriberServer) ModifyPushConfig(ctx context.Context, req *pubsubpb.ModifyPushConfigRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockSubscriberServer) ListSnapshots(ctx context.Context, req *pubsubpb.ListSnapshotsRequest) (*pubsubpb.ListSnapshotsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.ListSnapshotsResponse), nil +} + +func (s *mockSubscriberServer) CreateSnapshot(ctx context.Context, req *pubsubpb.CreateSnapshotRequest) (*pubsubpb.Snapshot, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.Snapshot), nil +} + +func (s *mockSubscriberServer) UpdateSnapshot(ctx context.Context, req *pubsubpb.UpdateSnapshotRequest) (*pubsubpb.Snapshot, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.Snapshot), nil +} + +func (s *mockSubscriberServer) DeleteSnapshot(ctx context.Context, req *pubsubpb.DeleteSnapshotRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockSubscriberServer) Seek(ctx context.Context, req *pubsubpb.SeekRequest) (*pubsubpb.SeekResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*pubsubpb.SeekResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockPublisher mockPublisherServer + mockIamPolicy mockIamPolicyServer + mockSubscriber mockSubscriberServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + pubsubpb.RegisterPublisherServer(serv, &mockPublisher) + iampb.RegisterIAMPolicyServer(serv, &mockIamPolicy) + pubsubpb.RegisterSubscriberServer(serv, &mockSubscriber) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestPublisherCreateTopic(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &pubsubpb.Topic{ + Name: name2, + } + + mockPublisher.err = nil + mockPublisher.reqs = nil + + mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.Topic{ + Name: formattedName, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateTopic(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockPublisher.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestPublisherCreateTopicError(t *testing.T) { + errCode := codes.PermissionDenied + mockPublisher.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.Topic{ + Name: formattedName, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateTopic(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestPublisherUpdateTopic(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &pubsubpb.Topic{ + Name: name, + } + + mockPublisher.err = nil + mockPublisher.reqs = nil + + mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse) + + var topic *pubsubpb.Topic = &pubsubpb.Topic{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &pubsubpb.UpdateTopicRequest{ + Topic: topic, + UpdateMask: updateMask, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateTopic(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockPublisher.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestPublisherUpdateTopicError(t *testing.T) { + errCode := codes.PermissionDenied + mockPublisher.err = gstatus.Error(errCode, "test error") + + var topic *pubsubpb.Topic = &pubsubpb.Topic{} + var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &pubsubpb.UpdateTopicRequest{ + Topic: topic, + UpdateMask: updateMask, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateTopic(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestPublisherPublish(t *testing.T) { + var messageIdsElement string = "messageIdsElement-744837059" + var messageIds = []string{messageIdsElement} + var expectedResponse = &pubsubpb.PublishResponse{ + MessageIds: messageIds, + } + + mockPublisher.err = nil + mockPublisher.reqs = nil + + mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse) + + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var data []byte = []byte("-86") + var messagesElement = &pubsubpb.PubsubMessage{ + Data: data, + } + var messages = []*pubsubpb.PubsubMessage{messagesElement} + var request = &pubsubpb.PublishRequest{ + Topic: formattedTopic, + Messages: messages, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Publish(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockPublisher.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestPublisherPublishError(t *testing.T) { + errCode := codes.PermissionDenied + mockPublisher.err = gstatus.Error(errCode, "test error") + + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var data []byte = []byte("-86") + var messagesElement = &pubsubpb.PubsubMessage{ + Data: data, + } + var messages = []*pubsubpb.PubsubMessage{messagesElement} + var request = &pubsubpb.PublishRequest{ + Topic: formattedTopic, + Messages: messages, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Publish(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestPublisherGetTopic(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &pubsubpb.Topic{ + Name: name, + } + + mockPublisher.err = nil + mockPublisher.reqs = nil + + mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse) + + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.GetTopicRequest{ + Topic: formattedTopic, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTopic(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockPublisher.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestPublisherGetTopicError(t *testing.T) { + errCode := codes.PermissionDenied + mockPublisher.err = gstatus.Error(errCode, "test error") + + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.GetTopicRequest{ + Topic: formattedTopic, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTopic(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestPublisherListTopics(t *testing.T) { + var nextPageToken string = "" + var topicsElement *pubsubpb.Topic = &pubsubpb.Topic{} + var topics = []*pubsubpb.Topic{topicsElement} + var expectedResponse = &pubsubpb.ListTopicsResponse{ + NextPageToken: nextPageToken, + Topics: topics, + } + + mockPublisher.err = nil + mockPublisher.reqs = nil + + mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse) + + var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &pubsubpb.ListTopicsRequest{ + Project: formattedProject, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTopics(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockPublisher.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Topics[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestPublisherListTopicsError(t *testing.T) { + errCode := codes.PermissionDenied + mockPublisher.err = gstatus.Error(errCode, "test error") + + var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &pubsubpb.ListTopicsRequest{ + Project: formattedProject, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTopics(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestPublisherListTopicSubscriptions(t *testing.T) { + var nextPageToken string = "" + var subscriptionsElement string = "subscriptionsElement1698708147" + var subscriptions = []string{subscriptionsElement} + var expectedResponse = &pubsubpb.ListTopicSubscriptionsResponse{ + NextPageToken: nextPageToken, + Subscriptions: subscriptions, + } + + mockPublisher.err = nil + mockPublisher.reqs = nil + + mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse) + + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.ListTopicSubscriptionsRequest{ + Topic: formattedTopic, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTopicSubscriptions(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockPublisher.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Subscriptions[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestPublisherListTopicSubscriptionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockPublisher.err = gstatus.Error(errCode, "test error") + + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.ListTopicSubscriptionsRequest{ + Topic: formattedTopic, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTopicSubscriptions(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestPublisherDeleteTopic(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockPublisher.err = nil + mockPublisher.reqs = nil + + mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse) + + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.DeleteTopicRequest{ + Topic: formattedTopic, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTopic(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockPublisher.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestPublisherDeleteTopicError(t *testing.T) { + errCode := codes.PermissionDenied + mockPublisher.err = gstatus.Error(errCode, "test error") + + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.DeleteTopicRequest{ + Topic: formattedTopic, + } + + c, err := NewPublisherClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteTopic(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSubscriberCreateSubscription(t *testing.T) { + var name2 string = "name2-1052831874" + var topic2 string = "topic2-1139259102" + var ackDeadlineSeconds int32 = 2135351438 + var retainAckedMessages bool = false + var expectedResponse = &pubsubpb.Subscription{ + Name: name2, + Topic: topic2, + AckDeadlineSeconds: ackDeadlineSeconds, + RetainAckedMessages: retainAckedMessages, + } + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.Subscription{ + Name: formattedName, + Topic: formattedTopic, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSubscription(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberCreateSubscriptionError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]") + var request = &pubsubpb.Subscription{ + Name: formattedName, + Topic: formattedTopic, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSubscription(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSubscriberGetSubscription(t *testing.T) { + var name string = "name3373707" + var topic string = "topic110546223" + var ackDeadlineSeconds int32 = 2135351438 + var retainAckedMessages bool = false + var expectedResponse = &pubsubpb.Subscription{ + Name: name, + Topic: topic, + AckDeadlineSeconds: ackDeadlineSeconds, + RetainAckedMessages: retainAckedMessages, + } + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var request = &pubsubpb.GetSubscriptionRequest{ + Subscription: formattedSubscription, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSubscription(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberGetSubscriptionError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var request = &pubsubpb.GetSubscriptionRequest{ + Subscription: formattedSubscription, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSubscription(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSubscriberUpdateSubscription(t *testing.T) { + var name string = "name3373707" + var topic string = "topic110546223" + var ackDeadlineSeconds2 int32 = 921632575 + var retainAckedMessages bool = false + var expectedResponse = &pubsubpb.Subscription{ + Name: name, + Topic: topic, + AckDeadlineSeconds: ackDeadlineSeconds2, + RetainAckedMessages: retainAckedMessages, + } + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var ackDeadlineSeconds int32 = 42 + var subscription = &pubsubpb.Subscription{ + AckDeadlineSeconds: ackDeadlineSeconds, + } + var pathsElement string = "ack_deadline_seconds" + var paths = []string{pathsElement} + var updateMask = &field_maskpb.FieldMask{ + Paths: paths, + } + var request = &pubsubpb.UpdateSubscriptionRequest{ + Subscription: subscription, + UpdateMask: updateMask, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSubscription(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberUpdateSubscriptionError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var ackDeadlineSeconds int32 = 42 + var subscription = &pubsubpb.Subscription{ + AckDeadlineSeconds: ackDeadlineSeconds, + } + var pathsElement string = "ack_deadline_seconds" + var paths = []string{pathsElement} + var updateMask = &field_maskpb.FieldMask{ + Paths: paths, + } + var request = &pubsubpb.UpdateSubscriptionRequest{ + Subscription: subscription, + UpdateMask: updateMask, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSubscription(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSubscriberListSubscriptions(t *testing.T) { + var nextPageToken string = "" + var subscriptionsElement *pubsubpb.Subscription = &pubsubpb.Subscription{} + var subscriptions = []*pubsubpb.Subscription{subscriptionsElement} + var expectedResponse = &pubsubpb.ListSubscriptionsResponse{ + NextPageToken: nextPageToken, + Subscriptions: subscriptions, + } + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &pubsubpb.ListSubscriptionsRequest{ + Project: formattedProject, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSubscriptions(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Subscriptions[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberListSubscriptionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &pubsubpb.ListSubscriptionsRequest{ + Project: formattedProject, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSubscriptions(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSubscriberDeleteSubscription(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var request = &pubsubpb.DeleteSubscriptionRequest{ + Subscription: formattedSubscription, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSubscription(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestSubscriberDeleteSubscriptionError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var request = &pubsubpb.DeleteSubscriptionRequest{ + Subscription: formattedSubscription, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSubscription(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSubscriberModifyAckDeadline(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var ackIds []string = nil + var ackDeadlineSeconds int32 = 2135351438 + var request = &pubsubpb.ModifyAckDeadlineRequest{ + Subscription: formattedSubscription, + AckIds: ackIds, + AckDeadlineSeconds: ackDeadlineSeconds, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.ModifyAckDeadline(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestSubscriberModifyAckDeadlineError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var ackIds []string = nil + var ackDeadlineSeconds int32 = 2135351438 + var request = &pubsubpb.ModifyAckDeadlineRequest{ + Subscription: formattedSubscription, + AckIds: ackIds, + AckDeadlineSeconds: ackDeadlineSeconds, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.ModifyAckDeadline(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSubscriberAcknowledge(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var ackIds []string = nil + var request = &pubsubpb.AcknowledgeRequest{ + Subscription: formattedSubscription, + AckIds: ackIds, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.Acknowledge(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestSubscriberAcknowledgeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var ackIds []string = nil + var request = &pubsubpb.AcknowledgeRequest{ + Subscription: formattedSubscription, + AckIds: ackIds, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.Acknowledge(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSubscriberPull(t *testing.T) { + var expectedResponse *pubsubpb.PullResponse = &pubsubpb.PullResponse{} + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var maxMessages int32 = 496131527 + var request = &pubsubpb.PullRequest{ + Subscription: formattedSubscription, + MaxMessages: maxMessages, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Pull(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberPullError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var maxMessages int32 = 496131527 + var request = &pubsubpb.PullRequest{ + Subscription: formattedSubscription, + MaxMessages: maxMessages, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Pull(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSubscriberStreamingPull(t *testing.T) { + var receivedMessagesElement *pubsubpb.ReceivedMessage = &pubsubpb.ReceivedMessage{} + var receivedMessages = []*pubsubpb.ReceivedMessage{receivedMessagesElement} + var expectedResponse = &pubsubpb.StreamingPullResponse{ + ReceivedMessages: receivedMessages, + } + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var streamAckDeadlineSeconds int32 = 1875467245 + var request = &pubsubpb.StreamingPullRequest{ + Subscription: formattedSubscription, + StreamAckDeadlineSeconds: streamAckDeadlineSeconds, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingPull(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberStreamingPullError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var streamAckDeadlineSeconds int32 = 1875467245 + var request = &pubsubpb.StreamingPullRequest{ + Subscription: formattedSubscription, + StreamAckDeadlineSeconds: streamAckDeadlineSeconds, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingPull(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSubscriberModifyPushConfig(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var pushConfig *pubsubpb.PushConfig = &pubsubpb.PushConfig{} + var request = &pubsubpb.ModifyPushConfigRequest{ + Subscription: formattedSubscription, + PushConfig: pushConfig, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.ModifyPushConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestSubscriberModifyPushConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var pushConfig *pubsubpb.PushConfig = &pubsubpb.PushConfig{} + var request = &pubsubpb.ModifyPushConfigRequest{ + Subscription: formattedSubscription, + PushConfig: pushConfig, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.ModifyPushConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSubscriberListSnapshots(t *testing.T) { + var nextPageToken string = "" + var snapshotsElement *pubsubpb.Snapshot = &pubsubpb.Snapshot{} + var snapshots = []*pubsubpb.Snapshot{snapshotsElement} + var expectedResponse = &pubsubpb.ListSnapshotsResponse{ + NextPageToken: nextPageToken, + Snapshots: snapshots, + } + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &pubsubpb.ListSnapshotsRequest{ + Project: formattedProject, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSnapshots(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Snapshots[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberListSnapshotsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &pubsubpb.ListSnapshotsRequest{ + Project: formattedProject, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSnapshots(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSubscriberCreateSnapshot(t *testing.T) { + var name2 string = "name2-1052831874" + var topic string = "topic110546223" + var expectedResponse = &pubsubpb.Snapshot{ + Name: name2, + Topic: topic, + } + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/snapshots/%s", "[PROJECT]", "[SNAPSHOT]") + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var request = &pubsubpb.CreateSnapshotRequest{ + Name: formattedName, + Subscription: formattedSubscription, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSnapshot(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberCreateSnapshotError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/snapshots/%s", "[PROJECT]", "[SNAPSHOT]") + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var request = &pubsubpb.CreateSnapshotRequest{ + Name: formattedName, + Subscription: formattedSubscription, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSnapshot(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSubscriberUpdateSnapshot(t *testing.T) { + var name string = "name3373707" + var topic string = "topic110546223" + var expectedResponse = &pubsubpb.Snapshot{ + Name: name, + Topic: topic, + } + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var seconds int64 = 123456 + var expireTime = ×tamppb.Timestamp{ + Seconds: seconds, + } + var snapshot = &pubsubpb.Snapshot{ + ExpireTime: expireTime, + } + var pathsElement string = "expire_time" + var paths = []string{pathsElement} + var updateMask = &field_maskpb.FieldMask{ + Paths: paths, + } + var request = &pubsubpb.UpdateSnapshotRequest{ + Snapshot: snapshot, + UpdateMask: updateMask, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSnapshot(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberUpdateSnapshotError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var seconds int64 = 123456 + var expireTime = ×tamppb.Timestamp{ + Seconds: seconds, + } + var snapshot = &pubsubpb.Snapshot{ + ExpireTime: expireTime, + } + var pathsElement string = "expire_time" + var paths = []string{pathsElement} + var updateMask = &field_maskpb.FieldMask{ + Paths: paths, + } + var request = &pubsubpb.UpdateSnapshotRequest{ + Snapshot: snapshot, + UpdateMask: updateMask, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSnapshot(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSubscriberDeleteSnapshot(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedSnapshot string = fmt.Sprintf("projects/%s/snapshots/%s", "[PROJECT]", "[SNAPSHOT]") + var request = &pubsubpb.DeleteSnapshotRequest{ + Snapshot: formattedSnapshot, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSnapshot(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestSubscriberDeleteSnapshotError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedSnapshot string = fmt.Sprintf("projects/%s/snapshots/%s", "[PROJECT]", "[SNAPSHOT]") + var request = &pubsubpb.DeleteSnapshotRequest{ + Snapshot: formattedSnapshot, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSnapshot(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSubscriberSeek(t *testing.T) { + var expectedResponse *pubsubpb.SeekResponse = &pubsubpb.SeekResponse{} + + mockSubscriber.err = nil + mockSubscriber.reqs = nil + + mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse) + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var request = &pubsubpb.SeekRequest{ + Subscription: formattedSubscription, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Seek(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSubscriber.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSubscriberSeekError(t *testing.T) { + errCode := codes.PermissionDenied + mockSubscriber.err = gstatus.Error(errCode, "test error") + + var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]") + var request = &pubsubpb.SeekRequest{ + Subscription: formattedSubscription, + } + + c, err := NewSubscriberClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Seek(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/path_funcs.go b/vendor/cloud.google.com/go/pubsub/apiv1/path_funcs.go new file mode 100644 index 000000000..b9ab4848d --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/path_funcs.go @@ -0,0 +1,95 @@ +// 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 +// +// https://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 pubsub + +// PublisherProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func PublisherProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// PublisherTopicPath returns the path for the topic resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/topics/%s", project, topic) +// instead. +func PublisherTopicPath(project, topic string) string { + return "" + + "projects/" + + project + + "/topics/" + + topic + + "" +} + +// SubscriberProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func SubscriberProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// SubscriberSnapshotPath returns the path for the snapshot resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/snapshots/%s", project, snapshot) +// instead. +func SubscriberSnapshotPath(project, snapshot string) string { + return "" + + "projects/" + + project + + "/snapshots/" + + snapshot + + "" +} + +// SubscriberSubscriptionPath returns the path for the subscription resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/subscriptions/%s", project, subscription) +// instead. +func SubscriberSubscriptionPath(project, subscription string) string { + return "" + + "projects/" + + project + + "/subscriptions/" + + subscription + + "" +} + +// SubscriberTopicPath returns the path for the topic resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/topics/%s", project, topic) +// instead. +func SubscriberTopicPath(project, topic string) string { + return "" + + "projects/" + + project + + "/topics/" + + topic + + "" +} diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/publisher_client.go b/vendor/cloud.google.com/go/pubsub/apiv1/publisher_client.go new file mode 100644 index 000000000..c33566e6a --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/publisher_client.go @@ -0,0 +1,391 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package pubsub + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// PublisherCallOptions contains the retry settings for each method of PublisherClient. +type PublisherCallOptions struct { + CreateTopic []gax.CallOption + UpdateTopic []gax.CallOption + Publish []gax.CallOption + GetTopic []gax.CallOption + ListTopics []gax.CallOption + ListTopicSubscriptions []gax.CallOption + DeleteTopic []gax.CallOption +} + +func defaultPublisherClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("pubsub.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultPublisherCallOptions() *PublisherCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"messaging", "one_plus_delivery"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Aborted, + codes.Canceled, + codes.DeadlineExceeded, + codes.Internal, + codes.ResourceExhausted, + codes.Unavailable, + codes.Unknown, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &PublisherCallOptions{ + CreateTopic: retry[[2]string{"default", "idempotent"}], + UpdateTopic: retry[[2]string{"default", "idempotent"}], + Publish: retry[[2]string{"messaging", "one_plus_delivery"}], + GetTopic: retry[[2]string{"default", "idempotent"}], + ListTopics: retry[[2]string{"default", "idempotent"}], + ListTopicSubscriptions: retry[[2]string{"default", "idempotent"}], + DeleteTopic: retry[[2]string{"default", "idempotent"}], + } +} + +// PublisherClient is a client for interacting with Google Cloud Pub/Sub API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type PublisherClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + publisherClient pubsubpb.PublisherClient + + // The call options for this service. + CallOptions *PublisherCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewPublisherClient creates a new publisher client. +// +// The service that an application uses to manipulate topics, and to send +// messages to a topic. +func NewPublisherClient(ctx context.Context, opts ...option.ClientOption) (*PublisherClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultPublisherClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &PublisherClient{ + conn: conn, + CallOptions: defaultPublisherCallOptions(), + + publisherClient: pubsubpb.NewPublisherClient(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *PublisherClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *PublisherClient) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *PublisherClient) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// CreateTopic creates the given topic with the given name. See the +// resource name rules. +func (c *PublisherClient) CreateTopic(ctx context.Context, req *pubsubpb.Topic, opts ...gax.CallOption) (*pubsubpb.Topic, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateTopic[0:len(c.CallOptions.CreateTopic):len(c.CallOptions.CreateTopic)], opts...) + var resp *pubsubpb.Topic + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.publisherClient.CreateTopic(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateTopic updates an existing topic. Note that certain properties of a +// topic are not modifiable. +func (c *PublisherClient) UpdateTopic(ctx context.Context, req *pubsubpb.UpdateTopicRequest, opts ...gax.CallOption) (*pubsubpb.Topic, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateTopic[0:len(c.CallOptions.UpdateTopic):len(c.CallOptions.UpdateTopic)], opts...) + var resp *pubsubpb.Topic + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.publisherClient.UpdateTopic(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Publish adds one or more messages to the topic. Returns NOT_FOUND if the topic +// does not exist. +func (c *PublisherClient) Publish(ctx context.Context, req *pubsubpb.PublishRequest, opts ...gax.CallOption) (*pubsubpb.PublishResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Publish[0:len(c.CallOptions.Publish):len(c.CallOptions.Publish)], opts...) + var resp *pubsubpb.PublishResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.publisherClient.Publish(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetTopic gets the configuration of a topic. +func (c *PublisherClient) GetTopic(ctx context.Context, req *pubsubpb.GetTopicRequest, opts ...gax.CallOption) (*pubsubpb.Topic, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetTopic[0:len(c.CallOptions.GetTopic):len(c.CallOptions.GetTopic)], opts...) + var resp *pubsubpb.Topic + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.publisherClient.GetTopic(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListTopics lists matching topics. +func (c *PublisherClient) ListTopics(ctx context.Context, req *pubsubpb.ListTopicsRequest, opts ...gax.CallOption) *TopicIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListTopics[0:len(c.CallOptions.ListTopics):len(c.CallOptions.ListTopics)], opts...) + it := &TopicIterator{} + req = proto.Clone(req).(*pubsubpb.ListTopicsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*pubsubpb.Topic, string, error) { + var resp *pubsubpb.ListTopicsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.publisherClient.ListTopics(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Topics, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListTopicSubscriptions lists the names of the subscriptions on this topic. +func (c *PublisherClient) ListTopicSubscriptions(ctx context.Context, req *pubsubpb.ListTopicSubscriptionsRequest, opts ...gax.CallOption) *StringIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListTopicSubscriptions[0:len(c.CallOptions.ListTopicSubscriptions):len(c.CallOptions.ListTopicSubscriptions)], opts...) + it := &StringIterator{} + req = proto.Clone(req).(*pubsubpb.ListTopicSubscriptionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]string, string, error) { + var resp *pubsubpb.ListTopicSubscriptionsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.publisherClient.ListTopicSubscriptions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Subscriptions, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteTopic deletes the topic with the given name. Returns NOT_FOUND if the topic +// does not exist. After a topic is deleted, a new topic may be created with +// the same name; this is an entirely new topic with none of the old +// configuration or subscriptions. Existing subscriptions to this topic are +// not deleted, but their topic field is set to _deleted-topic_. +func (c *PublisherClient) DeleteTopic(ctx context.Context, req *pubsubpb.DeleteTopicRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteTopic[0:len(c.CallOptions.DeleteTopic):len(c.CallOptions.DeleteTopic)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.publisherClient.DeleteTopic(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// StringIterator manages a stream of string. +type StringIterator struct { + items []string + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []string, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *StringIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *StringIterator) Next() (string, error) { + var item string + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *StringIterator) bufLen() int { + return len(it.items) +} + +func (it *StringIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// TopicIterator manages a stream of *pubsubpb.Topic. +type TopicIterator struct { + items []*pubsubpb.Topic + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Topic, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TopicIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *TopicIterator) Next() (*pubsubpb.Topic, error) { + var item *pubsubpb.Topic + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TopicIterator) bufLen() int { + return len(it.items) +} + +func (it *TopicIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/publisher_client_example_test.go b/vendor/cloud.google.com/go/pubsub/apiv1/publisher_client_example_test.go new file mode 100644 index 000000000..560623ad2 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/publisher_client_example_test.go @@ -0,0 +1,171 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package pubsub_test + +import ( + "context" + + pubsub "cloud.google.com/go/pubsub/apiv1" + "google.golang.org/api/iterator" + pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" +) + +func ExampleNewPublisherClient() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExamplePublisherClient_CreateTopic() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.Topic{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateTopic(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublisherClient_UpdateTopic() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.UpdateTopicRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateTopic(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublisherClient_Publish() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.PublishRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Publish(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublisherClient_GetTopic() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.GetTopicRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTopic(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExamplePublisherClient_ListTopics() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.ListTopicsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTopics(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExamplePublisherClient_ListTopicSubscriptions() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.ListTopicSubscriptionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTopicSubscriptions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExamplePublisherClient_DeleteTopic() { + ctx := context.Background() + c, err := pubsub.NewPublisherClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.DeleteTopicRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteTopic(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/pubsub_pull_example_test.go b/vendor/cloud.google.com/go/pubsub/apiv1/pubsub_pull_example_test.go new file mode 100644 index 000000000..c44a473ac --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/pubsub_pull_example_test.go @@ -0,0 +1,106 @@ +// 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 +// +// https://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 pubsub_test + +import ( + "context" + "fmt" + "log" + "time" + + pubsub "cloud.google.com/go/pubsub/apiv1" + pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" +) + +func ExampleSubscriberClient_Pull_lengthyClientProcessing() { + projectID := "some-project" + subscriptionID := "some-subscription" + + ctx := context.Background() + client, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + log.Fatal(err) + } + defer client.Close() + + sub := fmt.Sprintf("projects/%s/subscriptions/%s", projectID, subscriptionID) + // Be sure to tune the MaxMessages parameter per your project's needs, and accordingly + // adjust the ack behavior below to batch acknowledgements. + req := pubsubpb.PullRequest{ + Subscription: sub, + MaxMessages: 1, + } + + fmt.Println("Listening..") + + for { + res, err := client.Pull(ctx, &req) + if err != nil { + log.Fatal(err) + } + + // client.Pull returns an empty list if there are no messages available in the + // backlog. We should skip processing steps when that happens. + if len(res.ReceivedMessages) == 0 { + continue + } + + var recvdAckIDs []string + for _, m := range res.ReceivedMessages { + recvdAckIDs = append(recvdAckIDs, m.AckId) + } + + var done = make(chan struct{}) + var delay = 0 * time.Second // Tick immediately upon reception + var ackDeadline = 10 * time.Second + + // Continuously notify the server that processing is still happening on this batch. + go func() { + for { + select { + case <-ctx.Done(): + return + case <-done: + return + case <-time.After(delay): + err := client.ModifyAckDeadline(ctx, &pubsubpb.ModifyAckDeadlineRequest{ + Subscription: sub, + AckIds: recvdAckIDs, + AckDeadlineSeconds: int32(ackDeadline.Seconds()), + }) + if err != nil { + log.Fatal(err) + } + delay = ackDeadline - 5*time.Second // 5 seconds grace period. + } + } + }() + + for _, m := range res.ReceivedMessages { + // Process the message here, possibly in a goroutine. + log.Printf("Got message: %s", string(m.Message.Data)) + + err := client.Acknowledge(ctx, &pubsubpb.AcknowledgeRequest{ + Subscription: sub, + AckIds: []string{m.AckId}, + }) + if err != nil { + log.Fatal(err) + } + } + + close(done) + } +} diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/subscriber_client.go b/vendor/cloud.google.com/go/pubsub/apiv1/subscriber_client.go new file mode 100644 index 000000000..dd644894f --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/subscriber_client.go @@ -0,0 +1,606 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package pubsub + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// SubscriberCallOptions contains the retry settings for each method of SubscriberClient. +type SubscriberCallOptions struct { + CreateSubscription []gax.CallOption + GetSubscription []gax.CallOption + UpdateSubscription []gax.CallOption + ListSubscriptions []gax.CallOption + DeleteSubscription []gax.CallOption + ModifyAckDeadline []gax.CallOption + Acknowledge []gax.CallOption + Pull []gax.CallOption + StreamingPull []gax.CallOption + ModifyPushConfig []gax.CallOption + ListSnapshots []gax.CallOption + CreateSnapshot []gax.CallOption + UpdateSnapshot []gax.CallOption + DeleteSnapshot []gax.CallOption + Seek []gax.CallOption +} + +func defaultSubscriberClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("pubsub.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultSubscriberCallOptions() *SubscriberCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"messaging", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"messaging", "pull"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.ResourceExhausted, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"streaming_messaging", "pull"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Internal, + codes.ResourceExhausted, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &SubscriberCallOptions{ + CreateSubscription: retry[[2]string{"default", "idempotent"}], + GetSubscription: retry[[2]string{"default", "idempotent"}], + UpdateSubscription: retry[[2]string{"default", "idempotent"}], + ListSubscriptions: retry[[2]string{"default", "idempotent"}], + DeleteSubscription: retry[[2]string{"default", "idempotent"}], + ModifyAckDeadline: retry[[2]string{"default", "non_idempotent"}], + Acknowledge: retry[[2]string{"messaging", "idempotent"}], + Pull: retry[[2]string{"messaging", "pull"}], + StreamingPull: retry[[2]string{"streaming_messaging", "pull"}], + ModifyPushConfig: retry[[2]string{"default", "non_idempotent"}], + ListSnapshots: retry[[2]string{"default", "idempotent"}], + CreateSnapshot: retry[[2]string{"default", "idempotent"}], + UpdateSnapshot: retry[[2]string{"default", "idempotent"}], + DeleteSnapshot: retry[[2]string{"default", "idempotent"}], + Seek: retry[[2]string{"default", "non_idempotent"}], + } +} + +// SubscriberClient is a client for interacting with Google Cloud Pub/Sub API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type SubscriberClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + subscriberClient pubsubpb.SubscriberClient + + // The call options for this service. + CallOptions *SubscriberCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewSubscriberClient creates a new subscriber client. +// +// The service that an application uses to manipulate subscriptions and to +// consume messages from a subscription via the Pull method or by +// establishing a bi-directional stream using the StreamingPull method. +func NewSubscriberClient(ctx context.Context, opts ...option.ClientOption) (*SubscriberClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultSubscriberClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &SubscriberClient{ + conn: conn, + CallOptions: defaultSubscriberCallOptions(), + + subscriberClient: pubsubpb.NewSubscriberClient(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *SubscriberClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *SubscriberClient) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *SubscriberClient) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// CreateSubscription creates a subscription to a given topic. See the +// resource name rules. +// If the subscription already exists, returns ALREADY_EXISTS. +// If the corresponding topic doesn't exist, returns NOT_FOUND. +// +// If the name is not provided in the request, the server will assign a random +// name for this subscription on the same project as the topic, conforming +// to the +// resource name format (at https://cloud.google.com/pubsub/docs/overview#names). +// The generated name is populated in the returned Subscription object. +// Note that for REST API requests, you must specify a name in the request. +func (c *SubscriberClient) CreateSubscription(ctx context.Context, req *pubsubpb.Subscription, opts ...gax.CallOption) (*pubsubpb.Subscription, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateSubscription[0:len(c.CallOptions.CreateSubscription):len(c.CallOptions.CreateSubscription)], opts...) + var resp *pubsubpb.Subscription + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.CreateSubscription(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetSubscription gets the configuration details of a subscription. +func (c *SubscriberClient) GetSubscription(ctx context.Context, req *pubsubpb.GetSubscriptionRequest, opts ...gax.CallOption) (*pubsubpb.Subscription, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetSubscription[0:len(c.CallOptions.GetSubscription):len(c.CallOptions.GetSubscription)], opts...) + var resp *pubsubpb.Subscription + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.GetSubscription(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateSubscription updates an existing subscription. Note that certain properties of a +// subscription, such as its topic, are not modifiable. +func (c *SubscriberClient) UpdateSubscription(ctx context.Context, req *pubsubpb.UpdateSubscriptionRequest, opts ...gax.CallOption) (*pubsubpb.Subscription, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateSubscription[0:len(c.CallOptions.UpdateSubscription):len(c.CallOptions.UpdateSubscription)], opts...) + var resp *pubsubpb.Subscription + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.UpdateSubscription(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListSubscriptions lists matching subscriptions. +func (c *SubscriberClient) ListSubscriptions(ctx context.Context, req *pubsubpb.ListSubscriptionsRequest, opts ...gax.CallOption) *SubscriptionIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListSubscriptions[0:len(c.CallOptions.ListSubscriptions):len(c.CallOptions.ListSubscriptions)], opts...) + it := &SubscriptionIterator{} + req = proto.Clone(req).(*pubsubpb.ListSubscriptionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*pubsubpb.Subscription, string, error) { + var resp *pubsubpb.ListSubscriptionsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.ListSubscriptions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Subscriptions, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteSubscription deletes an existing subscription. All messages retained in the subscription +// are immediately dropped. Calls to Pull after deletion will return +// NOT_FOUND. After a subscription is deleted, a new one may be created with +// the same name, but the new one has no association with the old +// subscription or its topic unless the same topic is specified. +func (c *SubscriberClient) DeleteSubscription(ctx context.Context, req *pubsubpb.DeleteSubscriptionRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteSubscription[0:len(c.CallOptions.DeleteSubscription):len(c.CallOptions.DeleteSubscription)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.subscriberClient.DeleteSubscription(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ModifyAckDeadline modifies the ack deadline for a specific message. This method is useful +// to indicate that more time is needed to process a message by the +// subscriber, or to make the message available for redelivery if the +// processing was interrupted. Note that this does not modify the +// subscription-level ackDeadlineSeconds used for subsequent messages. +func (c *SubscriberClient) ModifyAckDeadline(ctx context.Context, req *pubsubpb.ModifyAckDeadlineRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ModifyAckDeadline[0:len(c.CallOptions.ModifyAckDeadline):len(c.CallOptions.ModifyAckDeadline)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.subscriberClient.ModifyAckDeadline(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// Acknowledge acknowledges the messages associated with the ack_ids in the +// AcknowledgeRequest. The Pub/Sub system can remove the relevant messages +// from the subscription. +// +// Acknowledging a message whose ack deadline has expired may succeed, +// but such a message may be redelivered later. Acknowledging a message more +// than once will not result in an error. +func (c *SubscriberClient) Acknowledge(ctx context.Context, req *pubsubpb.AcknowledgeRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Acknowledge[0:len(c.CallOptions.Acknowledge):len(c.CallOptions.Acknowledge)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.subscriberClient.Acknowledge(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// Pull pulls messages from the server. The server may return UNAVAILABLE if +// there are too many concurrent pull requests pending for the given +// subscription. +func (c *SubscriberClient) Pull(ctx context.Context, req *pubsubpb.PullRequest, opts ...gax.CallOption) (*pubsubpb.PullResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Pull[0:len(c.CallOptions.Pull):len(c.CallOptions.Pull)], opts...) + var resp *pubsubpb.PullResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.Pull(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// StreamingPull establishes a stream with the server, which sends messages down to the +// client. The client streams acknowledgements and ack deadline modifications +// back to the server. The server will close the stream and return the status +// on any error. The server may close the stream with status UNAVAILABLE to +// reassign server-side resources, in which case, the client should +// re-establish the stream. Flow control can be achieved by configuring the +// underlying RPC channel. +func (c *SubscriberClient) StreamingPull(ctx context.Context, opts ...gax.CallOption) (pubsubpb.Subscriber_StreamingPullClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.StreamingPull[0:len(c.CallOptions.StreamingPull):len(c.CallOptions.StreamingPull)], opts...) + var resp pubsubpb.Subscriber_StreamingPullClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.StreamingPull(ctx, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ModifyPushConfig modifies the PushConfig for a specified subscription. +// +// This may be used to change a push subscription to a pull one (signified by +// an empty PushConfig) or vice versa, or change the endpoint URL and other +// attributes of a push subscription. Messages will accumulate for delivery +// continuously through the call regardless of changes to the PushConfig. +func (c *SubscriberClient) ModifyPushConfig(ctx context.Context, req *pubsubpb.ModifyPushConfigRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ModifyPushConfig[0:len(c.CallOptions.ModifyPushConfig):len(c.CallOptions.ModifyPushConfig)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.subscriberClient.ModifyPushConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListSnapshots lists the existing snapshots.

+// ALPHA: This feature is part of an alpha release. This API might be +// changed in backward-incompatible ways and is not recommended for production +// use. It is not subject to any SLA or deprecation policy. +func (c *SubscriberClient) ListSnapshots(ctx context.Context, req *pubsubpb.ListSnapshotsRequest, opts ...gax.CallOption) *SnapshotIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListSnapshots[0:len(c.CallOptions.ListSnapshots):len(c.CallOptions.ListSnapshots)], opts...) + it := &SnapshotIterator{} + req = proto.Clone(req).(*pubsubpb.ListSnapshotsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*pubsubpb.Snapshot, string, error) { + var resp *pubsubpb.ListSnapshotsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.ListSnapshots(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Snapshots, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// CreateSnapshot creates a snapshot from the requested subscription.

+// ALPHA: This feature is part of an alpha release. This API might be +// changed in backward-incompatible ways and is not recommended for production +// use. It is not subject to any SLA or deprecation policy.

+// If the snapshot already exists, returns ALREADY_EXISTS. +// If the requested subscription doesn't exist, returns NOT_FOUND. +// If the backlog in the subscription is too old -- and the resulting snapshot +// would expire in less than 1 hour -- then FAILED_PRECONDITION is returned. +// See also the Snapshot.expire_time field. If the name is not provided in +// the request, the server will assign a random +// name for this snapshot on the same project as the subscription, conforming +// to the resource name format (at https://cloud.google.com/pubsub/docs/overview#names). +// The generated +// name is populated in the returned Snapshot object. Note that for REST API +// requests, you must specify a name in the request. +func (c *SubscriberClient) CreateSnapshot(ctx context.Context, req *pubsubpb.CreateSnapshotRequest, opts ...gax.CallOption) (*pubsubpb.Snapshot, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateSnapshot[0:len(c.CallOptions.CreateSnapshot):len(c.CallOptions.CreateSnapshot)], opts...) + var resp *pubsubpb.Snapshot + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.CreateSnapshot(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateSnapshot updates an existing snapshot.

+// ALPHA: This feature is part of an alpha release. This API might be +// changed in backward-incompatible ways and is not recommended for production +// use. It is not subject to any SLA or deprecation policy. +// Note that certain properties of a snapshot are not modifiable. +func (c *SubscriberClient) UpdateSnapshot(ctx context.Context, req *pubsubpb.UpdateSnapshotRequest, opts ...gax.CallOption) (*pubsubpb.Snapshot, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateSnapshot[0:len(c.CallOptions.UpdateSnapshot):len(c.CallOptions.UpdateSnapshot)], opts...) + var resp *pubsubpb.Snapshot + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.UpdateSnapshot(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteSnapshot removes an existing snapshot.

+// ALPHA: This feature is part of an alpha release. This API might be +// changed in backward-incompatible ways and is not recommended for production +// use. It is not subject to any SLA or deprecation policy. +// When the snapshot is deleted, all messages retained in the snapshot +// are immediately dropped. After a snapshot is deleted, a new one may be +// created with the same name, but the new one has no association with the old +// snapshot or its subscription, unless the same subscription is specified. +func (c *SubscriberClient) DeleteSnapshot(ctx context.Context, req *pubsubpb.DeleteSnapshotRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteSnapshot[0:len(c.CallOptions.DeleteSnapshot):len(c.CallOptions.DeleteSnapshot)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.subscriberClient.DeleteSnapshot(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// Seek seeks an existing subscription to a point in time or to a given snapshot, +// whichever is provided in the request.

+// ALPHA: This feature is part of an alpha release. This API might be +// changed in backward-incompatible ways and is not recommended for production +// use. It is not subject to any SLA or deprecation policy. +func (c *SubscriberClient) Seek(ctx context.Context, req *pubsubpb.SeekRequest, opts ...gax.CallOption) (*pubsubpb.SeekResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Seek[0:len(c.CallOptions.Seek):len(c.CallOptions.Seek)], opts...) + var resp *pubsubpb.SeekResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.subscriberClient.Seek(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SnapshotIterator manages a stream of *pubsubpb.Snapshot. +type SnapshotIterator struct { + items []*pubsubpb.Snapshot + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Snapshot, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *SnapshotIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *SnapshotIterator) Next() (*pubsubpb.Snapshot, error) { + var item *pubsubpb.Snapshot + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *SnapshotIterator) bufLen() int { + return len(it.items) +} + +func (it *SnapshotIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// SubscriptionIterator manages a stream of *pubsubpb.Subscription. +type SubscriptionIterator struct { + items []*pubsubpb.Subscription + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*pubsubpb.Subscription, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *SubscriptionIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *SubscriptionIterator) Next() (*pubsubpb.Subscription, error) { + var item *pubsubpb.Subscription + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *SubscriptionIterator) bufLen() int { + return len(it.items) +} + +func (it *SubscriptionIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/pubsub/apiv1/subscriber_client_example_test.go b/vendor/cloud.google.com/go/pubsub/apiv1/subscriber_client_example_test.go new file mode 100644 index 000000000..cd12f01e4 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/apiv1/subscriber_client_example_test.go @@ -0,0 +1,324 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package pubsub_test + +import ( + "context" + "io" + + pubsub "cloud.google.com/go/pubsub/apiv1" + "google.golang.org/api/iterator" + pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" +) + +func ExampleNewSubscriberClient() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleSubscriberClient_CreateSubscription() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.Subscription{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateSubscription(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubscriberClient_GetSubscription() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.GetSubscriptionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSubscription(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubscriberClient_UpdateSubscription() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.UpdateSubscriptionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateSubscription(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubscriberClient_ListSubscriptions() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.ListSubscriptionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListSubscriptions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleSubscriberClient_DeleteSubscription() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.DeleteSubscriptionRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteSubscription(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleSubscriberClient_ModifyAckDeadline() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.ModifyAckDeadlineRequest{ + // TODO: Fill request struct fields. + } + err = c.ModifyAckDeadline(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleSubscriberClient_Acknowledge() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.AcknowledgeRequest{ + // TODO: Fill request struct fields. + } + err = c.Acknowledge(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleSubscriberClient_Pull() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.PullRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Pull(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubscriberClient_StreamingPull() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + stream, err := c.StreamingPull(ctx) + if err != nil { + // TODO: Handle error. + } + go func() { + reqs := []*pubsubpb.StreamingPullRequest{ + // TODO: Create requests. + } + for _, req := range reqs { + if err := stream.Send(req); err != nil { + // TODO: Handle error. + } + } + stream.CloseSend() + }() + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleSubscriberClient_ModifyPushConfig() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.ModifyPushConfigRequest{ + // TODO: Fill request struct fields. + } + err = c.ModifyPushConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleSubscriberClient_ListSnapshots() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.ListSnapshotsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListSnapshots(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleSubscriberClient_CreateSnapshot() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.CreateSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateSnapshot(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubscriberClient_UpdateSnapshot() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.UpdateSnapshotRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateSnapshot(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleSubscriberClient_DeleteSnapshot() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.DeleteSnapshotRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteSnapshot(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleSubscriberClient_Seek() { + ctx := context.Background() + c, err := pubsub.NewSubscriberClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &pubsubpb.SeekRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Seek(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/pubsub/debug.go b/vendor/cloud.google.com/go/pubsub/debug.go new file mode 100644 index 000000000..977ae577f --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/debug.go @@ -0,0 +1,72 @@ +// 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. + +// +build psdebug + +package pubsub + +import ( + "sync" + "time" +) + +var ( + dmu sync.Mutex + msgTraces = map[string][]Event{} + ackIDToMsgID = map[string]string{} +) + +type Event struct { + Desc string + At time.Time +} + +func MessageEvents(msgID string) []Event { + dmu.Lock() + defer dmu.Unlock() + return msgTraces[msgID] +} + +func addRecv(msgID, ackID string, t time.Time) { + dmu.Lock() + defer dmu.Unlock() + ackIDToMsgID[ackID] = msgID + addEvent(msgID, "recv", t) +} + +func addAcks(ackIDs []string) { + dmu.Lock() + defer dmu.Unlock() + now := time.Now() + for _, id := range ackIDs { + addEvent(ackIDToMsgID[id], "ack", now) + } +} + +func addModAcks(ackIDs []string, deadlineSecs int32) { + dmu.Lock() + defer dmu.Unlock() + desc := "modack" + if deadlineSecs == 0 { + desc = "nack" + } + now := time.Now() + for _, id := range ackIDs { + addEvent(ackIDToMsgID[id], desc, now) + } +} + +func addEvent(msgID, desc string, t time.Time) { + msgTraces[msgID] = append(msgTraces[msgID], Event{desc, t}) +} diff --git a/vendor/cloud.google.com/go/pubsub/doc.go b/vendor/cloud.google.com/go/pubsub/doc.go new file mode 100644 index 000000000..eb2c90688 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/doc.go @@ -0,0 +1,137 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package pubsub provides an easy way to publish and receive Google Cloud Pub/Sub +messages, hiding the details of the underlying server RPCs. Google Cloud +Pub/Sub is a many-to-many, asynchronous messaging system that decouples senders +and receivers. + +More information about Google Cloud Pub/Sub is available at +https://cloud.google.com/pubsub/docs + +See https://godoc.org/cloud.google.com/go for authentication, timeouts, +connection pooling and similar aspects of this package. + + +Publishing + +Google Cloud Pub/Sub messages are published to topics. Topics may be created +using the pubsub package like so: + + topic, err := pubsubClient.CreateTopic(context.Background(), "topic-name") + +Messages may then be published to a topic: + + res := topic.Publish(ctx, &pubsub.Message{Data: []byte("payload")}) + +Publish queues the message for publishing and returns immediately. When enough +messages have accumulated, or enough time has elapsed, the batch of messages is +sent to the Pub/Sub service. + +Publish returns a PublishResult, which behaves like a future: its Get method +blocks until the message has been sent to the service. + +The first time you call Publish on a topic, goroutines are started in the +background. To clean up these goroutines, call Stop: + + topic.Stop() + +Receiving + +To receive messages published to a topic, clients create subscriptions +to the topic. There may be more than one subscription per topic; each message +that is published to the topic will be delivered to all of its subscriptions. + +Subsciptions may be created like so: + + sub, err := pubsubClient.CreateSubscription(context.Background(), "sub-name", + pubsub.SubscriptionConfig{Topic: topic}) + +Messages are then consumed from a subscription via callback. + + err := sub.Receive(context.Background(), func(ctx context.Context, m *Message) { + log.Printf("Got message: %s", m.Data) + m.Ack() + }) + if err != nil { + // Handle error. + } + +The callback is invoked concurrently by multiple goroutines, maximizing +throughput. To terminate a call to Receive, cancel its context. + +Once client code has processed the message, it must call Message.Ack, otherwise +the message will eventually be redelivered. As an optimization, if the client +cannot or doesn't want to process the message, it can call Message.Nack to +speed redelivery. For more information and configuration options, see +"Deadlines" below. + +Note: It is possible for Messages to be redelivered, even if Message.Ack has +been called. Client code must be robust to multiple deliveries of messages. + +Note: This uses pubsub's streaming pull feature. This feature properties that +may be surprising. Please take a look at https://cloud.google.com/pubsub/docs/pull#streamingpull +for more details on how streaming pull behaves compared to the synchronous +pull method. + +Deadlines + +The default pubsub deadlines are suitable for most use cases, but may be +overridden. This section describes the tradeoffs that should be considered +when overriding the defaults. + +Behind the scenes, each message returned by the Pub/Sub server has an +associated lease, known as an "ACK deadline". Unless a message is +acknowledged within the ACK deadline, or the client requests that +the ACK deadline be extended, the message will become eligible for redelivery. + +As a convenience, the pubsub client will automatically extend deadlines until +either: + * Message.Ack or Message.Nack is called, or + * The "MaxExtension" period elapses from the time the message is fetched from the server. + +ACK deadlines are extended periodically by the client. The initial ACK +deadline given to messages is 10s. The period between extensions, as well as the +length of the extension, automatically adjust depending on the time it takes to ack +messages, up to 10m. This has the effect that subscribers that process messages +quickly have their message ack deadlines extended for a short amount, whereas +subscribers that process message slowly have their message ack deadlines extended +for a large amount. The net effect is fewer RPCs sent from the client library. + +For example, consider a subscriber that takes 3 minutes to process each message. +Since the library has already recorded several 3 minute "time to ack"s in a +percentile distribution, future message extensions are sent with a value of 3 +minutes, every 3 minutes. Suppose the application crashes 5 seconds after the +library sends such an extension: the Pub/Sub server would wait the remaining +2m55s before re-sending the messages out to other subscribers. + +Please note that the client library does not use the subscription's AckDeadline +by default. To enforce the subscription AckDeadline, set MaxExtension to the +subscription's AckDeadline: + + cfg, err := sub.Config(ctx) + if err != nil { + // TODO handle err + } + + sub.ReceiveSettings.MaxExtension = cfg.AckDeadline + +Slow Message Processing + +For use cases where message processing exceeds 30 minutes, we recommend using +the base client in a pull model, since long-lived streams are periodically killed +by firewalls. See the example at https://godoc.org/cloud.google.com/go/pubsub/apiv1#example-SubscriberClient-Pull-LengthyClientProcessing +*/ +package pubsub // import "cloud.google.com/go/pubsub" diff --git a/vendor/cloud.google.com/go/pubsub/endtoend_test.go b/vendor/cloud.google.com/go/pubsub/endtoend_test.go new file mode 100644 index 000000000..d522f368b --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/endtoend_test.go @@ -0,0 +1,230 @@ +// 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 pubsub + +import ( + "bytes" + "context" + "fmt" + "log" + "math/rand" + "os" + "sync" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/option" +) + +const ( + timeout = time.Minute * 10 + ackDeadline = time.Second * 10 + nMessages = 1e4 + acceptableDupPercentage = 1 + numAcceptableDups = int(nMessages * acceptableDupPercentage / 100) +) + +// Buffer log messages to debug failures. +var logBuf bytes.Buffer + +// The end-to-end pumps many messages into a topic and tests that they are all +// delivered to each subscription for the topic. It also tests that messages +// are not unexpectedly redelivered. +func TestIntegration_EndToEnd(t *testing.T) { + if testing.Short() { + t.Skip("Integration tests skipped in short mode") + } + log.SetOutput(&logBuf) + ctx := context.Background() + ts := testutil.TokenSource(ctx, ScopePubSub, ScopeCloudPlatform) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + now := time.Now() + topicName := fmt.Sprintf("endtoend-%d", now.UnixNano()) + subPrefix := fmt.Sprintf("endtoend-%d", now.UnixNano()) + + client, err := NewClient(ctx, testutil.ProjID(), option.WithTokenSource(ts)) + if err != nil { + t.Fatalf("Creating client error: %v", err) + } + + var topic *Topic + if topic, err = client.CreateTopic(ctx, topicName); err != nil { + t.Fatalf("CreateTopic error: %v", err) + } + defer topic.Delete(ctx) + + // Two subscriptions to the same topic. + var subs [2]*Subscription + for i := 0; i < len(subs); i++ { + subs[i], err = client.CreateSubscription(ctx, fmt.Sprintf("%s-%d", subPrefix, i), SubscriptionConfig{ + Topic: topic, + AckDeadline: ackDeadline, + }) + if err != nil { + t.Fatalf("CreateSub error: %v", err) + } + defer subs[i].Delete(ctx) + } + + err = publish(ctx, topic, nMessages) + topic.Stop() + if err != nil { + t.Fatalf("publish: %v", err) + } + + // recv provides an indication that messages are still arriving. + recv := make(chan struct{}) + // We have two subscriptions to our topic. + // Each subscription will get a copy of each published message. + var wg sync.WaitGroup + cctx, cancel := context.WithTimeout(ctx, timeout) + defer cancel() + + consumers := []*consumer{ + {counts: make(map[string]int), recv: recv, durations: []time.Duration{time.Hour}}, + {counts: make(map[string]int), recv: recv, + durations: []time.Duration{ackDeadline, ackDeadline, ackDeadline / 2, ackDeadline / 2, time.Hour}}, + } + for i, con := range consumers { + con := con + sub := subs[i] + wg.Add(1) + go func() { + defer wg.Done() + con.consume(cctx, t, sub) + }() + } + // Wait for a while after the last message before declaring quiescence. + // We wait a multiple of the ack deadline, for two reasons: + // 1. To detect if messages are redelivered after having their ack + // deadline extended. + // 2. To wait for redelivery of messages that were en route when a Receive + // is canceled. This can take considerably longer than the ack deadline. + quiescenceDur := ackDeadline * 6 + quiescenceTimer := time.NewTimer(quiescenceDur) + +loop: + for { + select { + case <-recv: + // Reset timer so we wait quiescenceDur after the last message. + // See https://godoc.org/time#Timer.Reset for why the Stop + // and channel drain are necessary. + if !quiescenceTimer.Stop() { + <-quiescenceTimer.C + } + quiescenceTimer.Reset(quiescenceDur) + + case <-quiescenceTimer.C: + cancel() + log.Println("quiesced") + break loop + + case <-cctx.Done(): + t.Fatal("timed out") + } + } + wg.Wait() + ok := true + for i, con := range consumers { + var numDups int + var zeroes int + for _, v := range con.counts { + if v == 0 { + zeroes++ + } + numDups += v - 1 + } + + if zeroes > 0 { + t.Errorf("Consumer %d: %d messages never arrived", i, zeroes) + ok = false + } else if numDups > numAcceptableDups { + t.Errorf("Consumer %d: Willing to accept %d dups (%v duplicated of %d messages), but got %d", i, numAcceptableDups, acceptableDupPercentage, int(nMessages), numDups) + ok = false + } + } + if !ok { + logBuf.WriteTo(os.Stdout) + } +} + +// publish publishes n messages to topic. +func publish(ctx context.Context, topic *Topic, n int) error { + var rs []*PublishResult + for i := 0; i < n; i++ { + m := &Message{Data: []byte(fmt.Sprintf("msg %d", i))} + rs = append(rs, topic.Publish(ctx, m)) + } + for _, r := range rs { + _, err := r.Get(ctx) + if err != nil { + return err + } + } + return nil +} + +// consumer consumes messages according to its configuration. +type consumer struct { + durations []time.Duration + + // A value is sent to recv each time Inc is called. + recv chan struct{} + + mu sync.Mutex + counts map[string]int + total int +} + +// consume reads messages from a subscription, and keeps track of what it receives in mc. +// After consume returns, the caller should wait on wg to ensure that no more updates to mc will be made. +func (c *consumer) consume(ctx context.Context, t *testing.T, sub *Subscription) { + for _, dur := range c.durations { + ctx2, cancel := context.WithTimeout(ctx, dur) + defer cancel() + id := sub.name[len(sub.name)-1:] + log.Printf("%s: start receive", id) + prev := c.total + err := sub.Receive(ctx2, c.process) + log.Printf("%s: end receive; read %d", id, c.total-prev) + if err != nil { + t.Errorf("error from Receive: %v", err) + return + } + select { + case <-ctx.Done(): + return + default: + } + } +} + +// process handles a message and records it in mc. +func (c *consumer) process(_ context.Context, m *Message) { + c.mu.Lock() + c.counts[m.ID]++ + c.total++ + c.mu.Unlock() + c.recv <- struct{}{} + // Simulate time taken to process m, while continuing to process more messages. + // Some messages will need to have their ack deadline extended due to this delay. + delay := rand.Intn(int(ackDeadline * 3)) + time.AfterFunc(time.Duration(delay), m.Ack) +} diff --git a/vendor/cloud.google.com/go/pubsub/example_subscription_iterator_test.go b/vendor/cloud.google.com/go/pubsub/example_subscription_iterator_test.go new file mode 100644 index 000000000..edf7a7ac1 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/example_subscription_iterator_test.go @@ -0,0 +1,54 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pubsub_test + +import ( + "context" + "fmt" + + "cloud.google.com/go/pubsub" + "google.golang.org/api/iterator" +) + +func ExampleClient_Subscriptions() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + // List all subscriptions of the project. + it := client.Subscriptions(ctx) + _ = it // TODO: iterate using Next. +} + +func ExampleSubscriptionIterator_Next() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + // List all subscriptions of the project. + it := client.Subscriptions(ctx) + for { + sub, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(sub) + } +} diff --git a/vendor/cloud.google.com/go/pubsub/example_test.go b/vendor/cloud.google.com/go/pubsub/example_test.go new file mode 100644 index 000000000..f77c957f6 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/example_test.go @@ -0,0 +1,369 @@ +// 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 pubsub_test + +import ( + "context" + "fmt" + "time" + + "cloud.google.com/go/pubsub" + "google.golang.org/api/iterator" +) + +func ExampleNewClient() { + ctx := context.Background() + _, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + // See the other examples to learn how to use the Client. +} + +func ExampleClient_CreateTopic() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + // Create a new topic with the given name. + topic, err := client.CreateTopic(ctx, "topicName") + if err != nil { + // TODO: Handle error. + } + + _ = topic // TODO: use the topic. +} + +// Use TopicInProject to refer to a topic that is not in the client's project, such +// as a public topic. +func ExampleClient_TopicInProject() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + topic := client.TopicInProject("topicName", "another-project-id") + _ = topic // TODO: use the topic. +} + +func ExampleClient_CreateSubscription() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + // Create a new topic with the given name. + topic, err := client.CreateTopic(ctx, "topicName") + if err != nil { + // TODO: Handle error. + } + + // Create a new subscription to the previously created topic + // with the given name. + sub, err := client.CreateSubscription(ctx, "subName", pubsub.SubscriptionConfig{ + Topic: topic, + AckDeadline: 10 * time.Second, + }) + if err != nil { + // TODO: Handle error. + } + + _ = sub // TODO: use the subscription. +} + +func ExampleTopic_Delete() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + topic := client.Topic("topicName") + if err := topic.Delete(ctx); err != nil { + // TODO: Handle error. + } +} + +func ExampleTopic_Exists() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + topic := client.Topic("topicName") + ok, err := topic.Exists(ctx) + if err != nil { + // TODO: Handle error. + } + if !ok { + // Topic doesn't exist. + } +} + +func ExampleTopic_Publish() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + topic := client.Topic("topicName") + defer topic.Stop() + var results []*pubsub.PublishResult + r := topic.Publish(ctx, &pubsub.Message{ + Data: []byte("hello world"), + }) + results = append(results, r) + // Do other work ... + for _, r := range results { + id, err := r.Get(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Printf("Published a message with a message ID: %s\n", id) + } +} + +func ExampleTopic_Subscriptions() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + topic := client.Topic("topic-name") + // List all subscriptions of the topic (maybe of multiple projects). + for subs := topic.Subscriptions(ctx); ; { + sub, err := subs.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + _ = sub // TODO: use the subscription. + } +} + +func ExampleSubscription_Delete() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + sub := client.Subscription("subName") + if err := sub.Delete(ctx); err != nil { + // TODO: Handle error. + } +} + +func ExampleSubscription_Exists() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + sub := client.Subscription("subName") + ok, err := sub.Exists(ctx) + if err != nil { + // TODO: Handle error. + } + if !ok { + // Subscription doesn't exist. + } +} + +func ExampleSubscription_Config() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + sub := client.Subscription("subName") + config, err := sub.Config(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Println(config) +} + +func ExampleSubscription_Receive() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + sub := client.Subscription("subName") + err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) { + // TODO: Handle message. + // NOTE: May be called concurrently; synchronize access to shared memory. + m.Ack() + }) + if err != context.Canceled { + // TODO: Handle error. + } +} + +// This example shows how to configure keepalive so that unacknoweldged messages +// expire quickly, allowing other subscribers to take them. +func ExampleSubscription_Receive_maxExtension() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + sub := client.Subscription("subName") + // This program is expected to process and acknowledge messages in 30 seconds. If + // not, the Pub/Sub API will assume the message is not acknowledged. + sub.ReceiveSettings.MaxExtension = 30 * time.Second + err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) { + // TODO: Handle message. + m.Ack() + }) + if err != context.Canceled { + // TODO: Handle error. + } +} + +// This example shows how to throttle Subscription.Receive, which aims for high +// throughput by default. By limiting the number of messages and/or bytes being +// processed at once, you can bound your program's resource consumption. +func ExampleSubscription_Receive_maxOutstanding() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + sub := client.Subscription("subName") + sub.ReceiveSettings.MaxOutstandingMessages = 5 + sub.ReceiveSettings.MaxOutstandingBytes = 10e6 + err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) { + // TODO: Handle message. + m.Ack() + }) + if err != context.Canceled { + // TODO: Handle error. + } +} + +func ExampleSubscription_Update() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + sub := client.Subscription("subName") + subConfig, err := sub.Update(ctx, pubsub.SubscriptionConfigToUpdate{ + PushConfig: &pubsub.PushConfig{Endpoint: "https://example.com/push"}, + }) + if err != nil { + // TODO: Handle error. + } + _ = subConfig // TODO: Use SubscriptionConfig. +} + +func ExampleSubscription_CreateSnapshot() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + sub := client.Subscription("subName") + snapConfig, err := sub.CreateSnapshot(ctx, "snapshotName") + if err != nil { + // TODO: Handle error. + } + _ = snapConfig // TODO: Use SnapshotConfig. +} + +func ExampleSubscription_SeekToSnapshot() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + sub := client.Subscription("subName") + snap := client.Snapshot("snapshotName") + if err := sub.SeekToSnapshot(ctx, snap); err != nil { + // TODO: Handle error. + } +} + +func ExampleSubscription_SeekToTime() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + sub := client.Subscription("subName") + if err := sub.SeekToTime(ctx, time.Now().Add(-time.Hour)); err != nil { + // TODO: Handle error. + } +} + +func ExampleSnapshot_Delete() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + + snap := client.Snapshot("snapshotName") + if err := snap.Delete(ctx); err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_Snapshots() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + // List all snapshots for the project. + iter := client.Snapshots(ctx) + _ = iter // TODO: iterate using Next. +} + +func ExampleSnapshotConfigIterator_Next() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + // List all snapshots for the project. + iter := client.Snapshots(ctx) + for { + snapConfig, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + _ = snapConfig // TODO: use the SnapshotConfig. + } +} + +// TODO(jba): write an example for PublishResult.Ready +// TODO(jba): write an example for Subscription.IAM +// TODO(jba): write an example for Topic.IAM +// TODO(jba): write an example for Topic.Stop diff --git a/vendor/cloud.google.com/go/pubsub/example_topic_iterator_test.go b/vendor/cloud.google.com/go/pubsub/example_topic_iterator_test.go new file mode 100644 index 000000000..e480d0e31 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/example_topic_iterator_test.go @@ -0,0 +1,53 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pubsub_test + +import ( + "context" + "fmt" + + "cloud.google.com/go/pubsub" + "google.golang.org/api/iterator" +) + +func ExampleClient_Topics() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + it := client.Topics(ctx) + _ = it // TODO: iterate using Next. +} + +func ExampleTopicIterator_Next() { + ctx := context.Background() + client, err := pubsub.NewClient(ctx, "project-id") + if err != nil { + // TODO: Handle error. + } + // List all topics. + it := client.Topics(ctx) + for { + t, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(t) + } +} diff --git a/vendor/cloud.google.com/go/pubsub/flow_controller.go b/vendor/cloud.google.com/go/pubsub/flow_controller.go new file mode 100644 index 000000000..3f165a0ac --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/flow_controller.go @@ -0,0 +1,122 @@ +// Copyright 2017 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 pubsub + +import ( + "context" + "sync/atomic" + + "golang.org/x/sync/semaphore" +) + +// flowController implements flow control for Subscription.Receive. +type flowController struct { + maxCount int + maxSize int // max total size of messages + semCount, semSize *semaphore.Weighted // enforces max number and size of messages + // Number of calls to acquire - number of calls to release. This can go + // negative if semCount == nil and a large acquire is followed by multiple + // small releases. + // Atomic. + countRemaining int64 +} + +// newFlowController creates a new flowController that ensures no more than +// maxCount messages or maxSize bytes are outstanding at once. If maxCount or +// maxSize is < 1, then an unlimited number of messages or bytes is permitted, +// respectively. +func newFlowController(maxCount, maxSize int) *flowController { + fc := &flowController{ + maxCount: maxCount, + maxSize: maxSize, + semCount: nil, + semSize: nil, + } + if maxCount > 0 { + fc.semCount = semaphore.NewWeighted(int64(maxCount)) + } + if maxSize > 0 { + fc.semSize = semaphore.NewWeighted(int64(maxSize)) + } + return fc +} + +// acquire blocks until one message of size bytes can proceed or ctx is done. +// It returns nil in the first case, or ctx.Err() in the second. +// +// acquire allows large messages to proceed by treating a size greater than maxSize +// as if it were equal to maxSize. +func (f *flowController) acquire(ctx context.Context, size int) error { + if f.semCount != nil { + if err := f.semCount.Acquire(ctx, 1); err != nil { + return err + } + } + if f.semSize != nil { + if err := f.semSize.Acquire(ctx, f.bound(size)); err != nil { + if f.semCount != nil { + f.semCount.Release(1) + } + return err + } + } + atomic.AddInt64(&f.countRemaining, 1) + return nil +} + +// tryAcquire returns false if acquire would block. Otherwise, it behaves like +// acquire and returns true. +// +// tryAcquire allows large messages to proceed by treating a size greater than +// maxSize as if it were equal to maxSize. +func (f *flowController) tryAcquire(size int) bool { + if f.semCount != nil { + if !f.semCount.TryAcquire(1) { + return false + } + } + if f.semSize != nil { + if !f.semSize.TryAcquire(f.bound(size)) { + if f.semCount != nil { + f.semCount.Release(1) + } + return false + } + } + atomic.AddInt64(&f.countRemaining, 1) + return true +} + +// release notes that one message of size bytes is no longer outstanding. +func (f *flowController) release(size int) { + atomic.AddInt64(&f.countRemaining, -1) + if f.semCount != nil { + f.semCount.Release(1) + } + if f.semSize != nil { + f.semSize.Release(f.bound(size)) + } +} + +func (f *flowController) bound(size int) int64 { + if size > f.maxSize { + return int64(f.maxSize) + } + return int64(size) +} + +func (f *flowController) count() int { + return int(atomic.LoadInt64(&f.countRemaining)) +} diff --git a/vendor/cloud.google.com/go/pubsub/flow_controller_test.go b/vendor/cloud.google.com/go/pubsub/flow_controller_test.go new file mode 100644 index 000000000..71c41cbf1 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/flow_controller_test.go @@ -0,0 +1,255 @@ +// Copyright 2017 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 pubsub + +import ( + "context" + "errors" + "fmt" + "sync/atomic" + "testing" + "time" + + "golang.org/x/sync/errgroup" +) + +func TestFlowControllerCancel(t *testing.T) { + // Test canceling a flow controller's context. + t.Parallel() + fc := newFlowController(3, 10) + if err := fc.acquire(context.Background(), 5); err != nil { + t.Fatal(err) + } + // Experiment: a context that times out should always return an error. + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Millisecond) + defer cancel() + if err := fc.acquire(ctx, 6); err != context.DeadlineExceeded { + t.Fatalf("got %v, expected DeadlineExceeded", err) + } + // Control: a context that is not done should always return nil. + go func() { + time.Sleep(5 * time.Millisecond) + fc.release(5) + }() + if err := fc.acquire(context.Background(), 6); err != nil { + t.Errorf("got %v, expected nil", err) + } +} + +func TestFlowControllerLargeRequest(t *testing.T) { + // Large requests succeed, consuming the entire allotment. + t.Parallel() + fc := newFlowController(3, 10) + err := fc.acquire(context.Background(), 11) + if err != nil { + t.Fatal(err) + } +} + +func TestFlowControllerNoStarve(t *testing.T) { + // A large request won't starve, because the flowController is + // (best-effort) FIFO. + t.Parallel() + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + fc := newFlowController(10, 10) + first := make(chan int) + for i := 0; i < 20; i++ { + go func() { + for { + if err := fc.acquire(ctx, 1); err != nil { + if err != context.Canceled { + t.Error(err) + } + return + } + select { + case first <- 1: + default: + } + fc.release(1) + } + }() + } + <-first // Wait until the flowController's state is non-zero. + if err := fc.acquire(ctx, 11); err != nil { + t.Errorf("got %v, want nil", err) + } +} + +func TestFlowControllerSaturation(t *testing.T) { + t.Parallel() + const ( + maxCount = 6 + maxSize = 10 + ) + for _, test := range []struct { + acquireSize int + wantCount, wantSize int64 + }{ + { + // Many small acquires cause the flow controller to reach its max count. + acquireSize: 1, + wantCount: 6, + wantSize: 6, + }, + { + // Five acquires of size 2 will cause the flow controller to reach its max size, + // but not its max count. + acquireSize: 2, + wantCount: 5, + wantSize: 10, + }, + { + // If the requests are the right size (relatively prime to maxSize), + // the flow controller will not saturate on size. (In this case, not on count either.) + acquireSize: 3, + wantCount: 3, + wantSize: 9, + }, + } { + fc := newFlowController(maxCount, maxSize) + // Atomically track flow controller state. + // The flowController itself tracks count. + var curSize int64 + success := errors.New("") + // Time out if wantSize or wantCount is never reached. + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + g, ctx := errgroup.WithContext(ctx) + for i := 0; i < 10; i++ { + g.Go(func() error { + var hitCount, hitSize bool + // Run at least until we hit the expected values, and at least + // for enough iterations to exceed them if the flow controller + // is broken. + for i := 0; i < 100 || !hitCount || !hitSize; i++ { + select { + case <-ctx.Done(): + return ctx.Err() + default: + } + if err := fc.acquire(ctx, test.acquireSize); err != nil { + return err + } + c := int64(fc.count()) + if c > test.wantCount { + return fmt.Errorf("count %d exceeds want %d", c, test.wantCount) + } + if c == test.wantCount { + hitCount = true + } + s := atomic.AddInt64(&curSize, int64(test.acquireSize)) + if s > test.wantSize { + return fmt.Errorf("size %d exceeds want %d", s, test.wantSize) + } + if s == test.wantSize { + hitSize = true + } + time.Sleep(5 * time.Millisecond) // Let other goroutines make progress. + if atomic.AddInt64(&curSize, -int64(test.acquireSize)) < 0 { + return errors.New("negative size") + } + fc.release(test.acquireSize) + } + return success + }) + } + if err := g.Wait(); err != success { + t.Errorf("%+v: %v", test, err) + continue + } + } +} + +func TestFlowControllerTryAcquire(t *testing.T) { + t.Parallel() + fc := newFlowController(3, 10) + + // Successfully tryAcquire 4 bytes. + if !fc.tryAcquire(4) { + t.Error("got false, wanted true") + } + + // Fail to tryAcquire 7 bytes. + if fc.tryAcquire(7) { + t.Error("got true, wanted false") + } + + // Successfully tryAcquire 6 byte. + if !fc.tryAcquire(6) { + t.Error("got false, wanted true") + } +} + +func TestFlowControllerUnboundedCount(t *testing.T) { + t.Parallel() + ctx := context.Background() + fc := newFlowController(0, 10) + + // Successfully acquire 4 bytes. + if err := fc.acquire(ctx, 4); err != nil { + t.Errorf("got %v, wanted no error", err) + } + + // Successfully tryAcquire 4 bytes. + if !fc.tryAcquire(4) { + t.Error("got false, wanted true") + } + + // Fail to tryAcquire 3 bytes. + if fc.tryAcquire(3) { + t.Error("got true, wanted false") + } +} + +func TestFlowControllerUnboundedCount2(t *testing.T) { + t.Parallel() + ctx := context.Background() + fc := newFlowController(0, 0) + // Successfully acquire 4 bytes. + if err := fc.acquire(ctx, 4); err != nil { + t.Errorf("got %v, wanted no error", err) + } + fc.release(1) + fc.release(1) + fc.release(1) + wantCount := int64(-2) + c := int64(fc.count()) + if c != wantCount { + t.Fatalf("got count %d, want %d", c, wantCount) + } +} + +func TestFlowControllerUnboundedBytes(t *testing.T) { + t.Parallel() + ctx := context.Background() + fc := newFlowController(2, 0) + + // Successfully acquire 4GB. + if err := fc.acquire(ctx, 4e9); err != nil { + t.Errorf("got %v, wanted no error", err) + } + + // Successfully tryAcquire 4GB bytes. + if !fc.tryAcquire(4e9) { + t.Error("got false, wanted true") + } + + // Fail to tryAcquire a third message. + if fc.tryAcquire(3) { + t.Error("got true, wanted false") + } +} diff --git a/vendor/cloud.google.com/go/pubsub/integration_test.go b/vendor/cloud.google.com/go/pubsub/integration_test.go new file mode 100644 index 000000000..5880c633f --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/integration_test.go @@ -0,0 +1,627 @@ +// 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 pubsub + +import ( + "context" + "fmt" + "testing" + "time" + + "cloud.google.com/go/iam" + "cloud.google.com/go/internal" + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/internal/uid" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var ( + topicIDs = uid.NewSpace("topic", nil) + subIDs = uid.NewSpace("sub", nil) +) + +// messageData is used to hold the contents of a message so that it can be compared against the contents +// of another message without regard to irrelevant fields. +type messageData struct { + ID string + Data []byte + Attributes map[string]string +} + +func extractMessageData(m *Message) *messageData { + return &messageData{ + ID: m.ID, + Data: m.Data, + Attributes: m.Attributes, + } +} + +func integrationTestClient(ctx context.Context, t *testing.T) *Client { + if testing.Short() { + t.Skip("Integration tests skipped in short mode") + } + projID := testutil.ProjID() + if projID == "" { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + ts := testutil.TokenSource(ctx, ScopePubSub, ScopeCloudPlatform) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + client, err := NewClient(ctx, projID, option.WithTokenSource(ts)) + if err != nil { + t.Fatalf("Creating client error: %v", err) + } + return client +} + +func TestIntegration_All(t *testing.T) { + t.Parallel() + ctx := context.Background() + client := integrationTestClient(ctx, t) + defer client.Close() + + topic, err := client.CreateTopic(ctx, topicIDs.New()) + if err != nil { + t.Errorf("CreateTopic error: %v", err) + } + defer topic.Stop() + exists, err := topic.Exists(ctx) + if err != nil { + t.Fatalf("TopicExists error: %v", err) + } + if !exists { + t.Errorf("topic %v should exist, but it doesn't", topic) + } + + var sub *Subscription + if sub, err = client.CreateSubscription(ctx, subIDs.New(), SubscriptionConfig{Topic: topic}); err != nil { + t.Errorf("CreateSub error: %v", err) + } + exists, err = sub.Exists(ctx) + if err != nil { + t.Fatalf("SubExists error: %v", err) + } + if !exists { + t.Errorf("subscription %s should exist, but it doesn't", sub.ID()) + } + + for _, sync := range []bool{false, true} { + for _, maxMsgs := range []int{0, 3, -1} { // MaxOutstandingMessages = default, 3, unlimited + testPublishAndReceive(t, topic, sub, maxMsgs, sync) + } + } + if msg, ok := testIAM(ctx, topic.IAM(), "pubsub.topics.get"); !ok { + t.Errorf("topic IAM: %s", msg) + } + if msg, ok := testIAM(ctx, sub.IAM(), "pubsub.subscriptions.get"); !ok { + t.Errorf("sub IAM: %s", msg) + } + + snap, err := sub.CreateSnapshot(ctx, "") + if err != nil { + t.Fatalf("CreateSnapshot error: %v", err) + } + + timeoutCtx, cancel := context.WithTimeout(ctx, time.Minute) + defer cancel() + err = internal.Retry(timeoutCtx, gax.Backoff{}, func() (bool, error) { + snapIt := client.Snapshots(timeoutCtx) + for { + s, err := snapIt.Next() + if err == nil && s.name == snap.name { + return true, nil + } + if err == iterator.Done { + return false, fmt.Errorf("cannot find snapshot: %q", snap.name) + } + if err != nil { + return false, err + } + } + }) + if err != nil { + t.Error(err) + } + + err = internal.Retry(timeoutCtx, gax.Backoff{}, func() (bool, error) { + err := sub.SeekToSnapshot(timeoutCtx, snap.Snapshot) + return err == nil, err + }) + if err != nil { + t.Error(err) + } + + err = internal.Retry(timeoutCtx, gax.Backoff{}, func() (bool, error) { + err := sub.SeekToTime(timeoutCtx, time.Now()) + return err == nil, err + }) + if err != nil { + t.Error(err) + } + + err = internal.Retry(timeoutCtx, gax.Backoff{}, func() (bool, error) { + snapHandle := client.Snapshot(snap.ID()) + err := snapHandle.Delete(timeoutCtx) + return err == nil, err + }) + if err != nil { + t.Error(err) + } + + if err := sub.Delete(ctx); err != nil { + t.Errorf("DeleteSub error: %v", err) + } + + if err := topic.Delete(ctx); err != nil { + t.Errorf("DeleteTopic error: %v", err) + } +} + +func testPublishAndReceive(t *testing.T, topic *Topic, sub *Subscription, maxMsgs int, synchronous bool) { + ctx := context.Background() + var msgs []*Message + for i := 0; i < 10; i++ { + text := fmt.Sprintf("a message with an index %d", i) + attrs := make(map[string]string) + attrs["foo"] = "bar" + msgs = append(msgs, &Message{ + Data: []byte(text), + Attributes: attrs, + }) + } + + // Publish some messages. + type pubResult struct { + m *Message + r *PublishResult + } + var rs []pubResult + for _, m := range msgs { + r := topic.Publish(ctx, m) + rs = append(rs, pubResult{m, r}) + } + want := make(map[string]*messageData) + for _, res := range rs { + id, err := res.r.Get(ctx) + if err != nil { + t.Fatal(err) + } + md := extractMessageData(res.m) + md.ID = id + want[md.ID] = md + } + + sub.ReceiveSettings.MaxOutstandingMessages = maxMsgs + sub.ReceiveSettings.Synchronous = synchronous + + // Use a timeout to ensure that Pull does not block indefinitely if there are + // unexpectedly few messages available. + now := time.Now() + timeoutCtx, _ := context.WithTimeout(ctx, time.Minute) + gotMsgs, err := pullN(timeoutCtx, sub, len(want), func(ctx context.Context, m *Message) { + m.Ack() + }) + if err != nil { + if c := status.Convert(err); c.Code() == codes.Canceled { + if time.Now().Sub(now) >= time.Minute { + t.Fatal("pullN took too long") + } + } else { + t.Fatalf("Pull: %v", err) + } + } + got := make(map[string]*messageData) + for _, m := range gotMsgs { + md := extractMessageData(m) + got[md.ID] = md + } + if !testutil.Equal(got, want) { + t.Fatalf("MaxOutstandingMessages=%d, Synchronous=%t, messages got: %v, messages want: %v", + maxMsgs, synchronous, got, want) + } +} + +// IAM tests. +// NOTE: for these to succeed, the test runner identity must have the Pub/Sub Admin or Owner roles. +// To set, visit https://console.developers.google.com, select "IAM & Admin" from the top-left +// menu, choose the account, click the Roles dropdown, and select "Pub/Sub > Pub/Sub Admin". +// TODO(jba): move this to a testing package within cloud.google.com/iam, so we can re-use it. +func testIAM(ctx context.Context, h *iam.Handle, permission string) (msg string, ok bool) { + // Attempting to add an non-existent identity (e.g. "alice@example.com") causes the service + // to return an internal error, so use a real identity. + const member = "domain:google.com" + + var policy *iam.Policy + var err error + + if policy, err = h.Policy(ctx); err != nil { + return fmt.Sprintf("Policy: %v", err), false + } + // The resource is new, so the policy should be empty. + if got := policy.Roles(); len(got) > 0 { + return fmt.Sprintf("initially: got roles %v, want none", got), false + } + // Add a member, set the policy, then check that the member is present. + policy.Add(member, iam.Viewer) + if err := h.SetPolicy(ctx, policy); err != nil { + return fmt.Sprintf("SetPolicy: %v", err), false + } + if policy, err = h.Policy(ctx); err != nil { + return fmt.Sprintf("Policy: %v", err), false + } + if got, want := policy.Members(iam.Viewer), []string{member}; !testutil.Equal(got, want) { + return fmt.Sprintf("after Add: got %v, want %v", got, want), false + } + // Now remove that member, set the policy, and check that it's empty again. + policy.Remove(member, iam.Viewer) + if err := h.SetPolicy(ctx, policy); err != nil { + return fmt.Sprintf("SetPolicy: %v", err), false + } + if policy, err = h.Policy(ctx); err != nil { + return fmt.Sprintf("Policy: %v", err), false + } + if got := policy.Roles(); len(got) > 0 { + return fmt.Sprintf("after Remove: got roles %v, want none", got), false + } + // Call TestPermissions. + // Because this user is an admin, it has all the permissions on the + // resource type. Note: the service fails if we ask for inapplicable + // permissions (e.g. a subscription permission on a topic, or a topic + // create permission on a topic rather than its parent). + wantPerms := []string{permission} + gotPerms, err := h.TestPermissions(ctx, wantPerms) + if err != nil { + return fmt.Sprintf("TestPermissions: %v", err), false + } + if !testutil.Equal(gotPerms, wantPerms) { + return fmt.Sprintf("TestPermissions: got %v, want %v", gotPerms, wantPerms), false + } + return "", true +} + +func TestIntegration_CancelReceive(t *testing.T) { + t.Parallel() + ctx, cancel := context.WithCancel(context.Background()) + client := integrationTestClient(ctx, t) + defer client.Close() + + topic, err := client.CreateTopic(ctx, topicIDs.New()) + if err != nil { + t.Fatal(err) + } + defer topic.Delete(ctx) + defer topic.Stop() + + var sub *Subscription + if sub, err = client.CreateSubscription(ctx, subIDs.New(), SubscriptionConfig{Topic: topic}); err != nil { + t.Fatal(err) + } + defer sub.Delete(ctx) + + sub.ReceiveSettings.MaxOutstandingMessages = -1 + sub.ReceiveSettings.MaxOutstandingBytes = -1 + sub.ReceiveSettings.NumGoroutines = 1 + + doneReceiving := make(chan struct{}) + + // Publish the messages. + go func() { + for { + select { + case <-doneReceiving: + return + default: + topic.Publish(ctx, &Message{Data: []byte("some msg")}) + time.Sleep(time.Second) + } + } + }() + + go func() { + defer close(doneReceiving) + err = sub.Receive(ctx, func(_ context.Context, msg *Message) { + cancel() + time.AfterFunc(5*time.Second, msg.Ack) + }) + if err != nil { + t.Error(err) + } + }() + + select { + case <-time.After(60 * time.Second): + t.Fatalf("Waited 60 seconds for Receive to finish, should have finished sooner") + case <-doneReceiving: + } +} + +func TestIntegration_UpdateSubscription(t *testing.T) { + t.Parallel() + ctx := context.Background() + client := integrationTestClient(ctx, t) + defer client.Close() + + topic, err := client.CreateTopic(ctx, topicIDs.New()) + if err != nil { + t.Fatalf("CreateTopic error: %v", err) + } + defer topic.Stop() + defer topic.Delete(ctx) + + var sub *Subscription + if sub, err = client.CreateSubscription(ctx, subIDs.New(), SubscriptionConfig{Topic: topic}); err != nil { + t.Fatalf("CreateSub error: %v", err) + } + defer sub.Delete(ctx) + + got, err := sub.Config(ctx) + if err != nil { + t.Fatal(err) + } + want := SubscriptionConfig{ + Topic: topic, + AckDeadline: 10 * time.Second, + RetainAckedMessages: false, + RetentionDuration: defaultRetentionDuration, + } + if !testutil.Equal(got, want) { + t.Fatalf("\ngot %+v\nwant %+v", got, want) + } + // Add a PushConfig and change other fields. + projID := testutil.ProjID() + pc := PushConfig{ + Endpoint: "https://" + projID + ".appspot.com/_ah/push-handlers/push", + Attributes: map[string]string{"x-goog-version": "v1"}, + } + got, err = sub.Update(ctx, SubscriptionConfigToUpdate{ + PushConfig: &pc, + AckDeadline: 2 * time.Minute, + RetainAckedMessages: true, + RetentionDuration: 2 * time.Hour, + Labels: map[string]string{"label": "value"}, + }) + if err != nil { + t.Fatal(err) + } + want = SubscriptionConfig{ + Topic: topic, + PushConfig: pc, + AckDeadline: 2 * time.Minute, + RetainAckedMessages: true, + RetentionDuration: 2 * time.Hour, + Labels: map[string]string{"label": "value"}, + } + + if !testutil.Equal(got, want) { + t.Fatalf("\ngot %+v\nwant %+v", got, want) + } + + // Remove the PushConfig, turning the subscription back into pull mode. + // Change AckDeadline, remove labels. + pc = PushConfig{} + got, err = sub.Update(ctx, SubscriptionConfigToUpdate{ + PushConfig: &pc, + AckDeadline: 30 * time.Second, + Labels: map[string]string{}, + }) + if err != nil { + t.Fatal(err) + } + want.PushConfig = pc + want.AckDeadline = 30 * time.Second + want.Labels = nil + // service issue: PushConfig attributes are not removed. + // TODO(jba): remove when issue resolved. + want.PushConfig.Attributes = map[string]string{"x-goog-version": "v1"} + if !testutil.Equal(got, want) { + t.Fatalf("\ngot %+v\nwant %+v", got, want) + } + // If nothing changes, our client returns an error. + _, err = sub.Update(ctx, SubscriptionConfigToUpdate{}) + if err == nil { + t.Fatal("got nil, wanted error") + } +} + +// NOTE: This test should be skipped by open source contributors. It requires +// whitelisting, a (gsuite) organization project, and specific permissions. +func TestIntegration_UpdateTopic(t *testing.T) { + t.Parallel() + ctx := context.Background() + client := integrationTestClient(ctx, t) + defer client.Close() + + compareConfig := func(got TopicConfig, wantLabels map[string]string) bool { + if !testutil.Equal(got.Labels, wantLabels) { + return false + } + // For MessageStoragePolicy, we don't want to check for an exact set of regions. + // That set may change at any time. Instead, just make sure that the set isn't empty. + if len(got.MessageStoragePolicy.AllowedPersistenceRegions) == 0 { + return false + } + return true + } + + topic, err := client.CreateTopic(ctx, topicIDs.New()) + if err != nil { + t.Fatalf("CreateTopic error: %v", err) + } + defer topic.Stop() + defer topic.Delete(ctx) + + got, err := topic.Config(ctx) + if err != nil { + t.Fatal(err) + } + if !compareConfig(got, nil) { + t.Fatalf("\ngot %+v\nwant no labels", got) + } + + labels := map[string]string{"label": "value"} + got, err = topic.Update(ctx, TopicConfigToUpdate{Labels: labels}) + if err != nil { + t.Fatal(err) + } + if !compareConfig(got, labels) { + t.Fatalf("\ngot %+v\nwant labels %+v", got, labels) + } + // Remove all labels. + got, err = topic.Update(ctx, TopicConfigToUpdate{Labels: map[string]string{}}) + if err != nil { + t.Fatal(err) + } + if !compareConfig(got, nil) { + t.Fatalf("\ngot %+v\nwant no labels", got) + } +} + +func TestIntegration_PublicTopic(t *testing.T) { + t.Parallel() + ctx := context.Background() + client := integrationTestClient(ctx, t) + defer client.Close() + + sub, err := client.CreateSubscription(ctx, subIDs.New(), SubscriptionConfig{ + Topic: client.TopicInProject("taxirides-realtime", "pubsub-public-data"), + }) + if err != nil { + t.Fatal(err) + } + defer sub.Delete(ctx) + // Confirm that Receive works. It doesn't matter if we actually get any + // messages. + ctxt, cancel := context.WithTimeout(ctx, 5*time.Second) + err = sub.Receive(ctxt, func(_ context.Context, msg *Message) { + msg.Ack() + cancel() + }) + if err != nil { + t.Fatal(err) + } +} + +func TestIntegration_Errors(t *testing.T) { + // Test various edge conditions. + t.Parallel() + ctx := context.Background() + client := integrationTestClient(ctx, t) + defer client.Close() + + topic, err := client.CreateTopic(ctx, topicIDs.New()) + if err != nil { + t.Fatalf("CreateTopic error: %v", err) + } + defer topic.Stop() + defer topic.Delete(ctx) + + // Out-of-range retention duration. + sub, err := client.CreateSubscription(ctx, subIDs.New(), SubscriptionConfig{ + Topic: topic, + RetentionDuration: 1 * time.Second, + }) + if want := codes.InvalidArgument; grpc.Code(err) != want { + t.Errorf("got <%v>, want %s", err, want) + } + if err == nil { + sub.Delete(ctx) + } + + // Ack deadline less than minimum. + sub, err = client.CreateSubscription(ctx, subIDs.New(), SubscriptionConfig{ + Topic: topic, + AckDeadline: 5 * time.Second, + }) + if want := codes.Unknown; grpc.Code(err) != want { + t.Errorf("got <%v>, want %s", err, want) + } + if err == nil { + sub.Delete(ctx) + } + + // Updating a non-existent subscription. + sub = client.Subscription(subIDs.New()) + _, err = sub.Update(ctx, SubscriptionConfigToUpdate{AckDeadline: 20 * time.Second}) + if want := codes.NotFound; grpc.Code(err) != want { + t.Errorf("got <%v>, want %s", err, want) + } + // Deleting a non-existent subscription. + err = sub.Delete(ctx) + if want := codes.NotFound; grpc.Code(err) != want { + t.Errorf("got <%v>, want %s", err, want) + } + + // Updating out-of-range retention duration. + sub, err = client.CreateSubscription(ctx, subIDs.New(), SubscriptionConfig{Topic: topic}) + if err != nil { + t.Fatal(err) + } + defer sub.Delete(ctx) + _, err = sub.Update(ctx, SubscriptionConfigToUpdate{RetentionDuration: 1000 * time.Hour}) + if want := codes.InvalidArgument; grpc.Code(err) != want { + t.Errorf("got <%v>, want %s", err, want) + } +} + +// NOTE: This test should be skipped by open source contributors. It requires +// whitelisting, a (gsuite) organization project, and specific permissions. +// +// Googlers, see internal bug 77920644. Furthermore, be sure to add your +// service account as an owner of ps-geofencing-test. +func TestIntegration_MessageStoragePolicy(t *testing.T) { + // Verify that the message storage policy is populated. + if testing.Short() { + t.Skip("Integration tests skipped in short mode") + } + ctx := context.Background() + // The message storage policy depends on the Resource Location Restriction org policy. + // The usual testing project is in the google.com org, which has no resource location restrictions, + // so we will always see an empty MessageStoragePolicy. Use a project in another org that does + // have a restriction set ("us-east1"). + projID := "ps-geofencing-test" + // We can use the same creds as always because the service account of the default testing project + // has permission to use the above project. This test will fail if a different service account + // is used for testing. + ts := testutil.TokenSource(ctx, ScopePubSub, ScopeCloudPlatform) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + client, err := NewClient(ctx, projID, option.WithTokenSource(ts)) + if err != nil { + t.Fatalf("Creating client error: %v", err) + } + topic, err := client.CreateTopic(ctx, topicIDs.New()) + if err != nil { + t.Fatalf("CreateTopic error: %v", err) + } + defer topic.Stop() + defer topic.Delete(ctx) + + config, err := topic.Config(ctx) + if err != nil { + t.Fatal(err) + } + got := config.MessageStoragePolicy.AllowedPersistenceRegions + want := []string{"us-east1"} + if !testutil.Equal(got, want) { + t.Errorf("got %v, want %v", got, want) + } +} diff --git a/vendor/cloud.google.com/go/pubsub/internal/distribution/distribution.go b/vendor/cloud.google.com/go/pubsub/internal/distribution/distribution.go new file mode 100644 index 000000000..6571c90ac --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/internal/distribution/distribution.go @@ -0,0 +1,69 @@ +// Copyright 2017 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 distribution + +import ( + "log" + "math" + "sort" + "sync/atomic" +) + +// D is a distribution. Methods of D can be called concurrently by multiple +// goroutines. +type D struct { + buckets []uint64 +} + +// New creates a new distribution capable of holding values from 0 to n-1. +func New(n int) *D { + return &D{ + buckets: make([]uint64, n), + } +} + +// Record records value v to the distribution. +// To help with distributions with long tails, if v is larger than the maximum value, +// Record records the maximum value instead. +// If v is negative, Record panics. +func (d *D) Record(v int) { + if v < 0 { + log.Panicf("Record: value out of range: %d", v) + } else if v >= len(d.buckets) { + v = len(d.buckets) - 1 + } + atomic.AddUint64(&d.buckets[v], 1) +} + +// Percentile computes the p-th percentile of the distribution where +// p is between 0 and 1. This method is thread-safe. +func (d *D) Percentile(p float64) int { + // NOTE: This implementation uses the nearest-rank method. + // https://en.wikipedia.org/wiki/Percentile#The_nearest-rank_method + + if p < 0 || p > 1 { + log.Panicf("Percentile: percentile out of range: %f", p) + } + + sums := make([]uint64, len(d.buckets)) + var sum uint64 + for i := range sums { + sum += atomic.LoadUint64(&d.buckets[i]) + sums[i] = sum + } + + target := uint64(math.Ceil(float64(sum) * p)) + return sort.Search(len(sums), func(i int) bool { return sums[i] >= target }) +} diff --git a/vendor/cloud.google.com/go/pubsub/internal/distribution/distribution_test.go b/vendor/cloud.google.com/go/pubsub/internal/distribution/distribution_test.go new file mode 100644 index 000000000..5e9296d27 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/internal/distribution/distribution_test.go @@ -0,0 +1,94 @@ +// Copyright 2017 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 distribution + +import ( + "sync" + "testing" +) + +func TestDistribution(t *testing.T) { + // These tests come from examples in https://en.wikipedia.org/wiki/Percentile#The_nearest-rank_method + tests := []struct { + // values in distribution + vals []int + + // percentiles and expected percentile values + pp []float64 + vv []int + }{ + { + vals: []int{15, 20, 35, 40, 50}, + pp: []float64{0.05, 0.3, 0.4, 0.5, 1}, + vv: []int{15, 20, 20, 35, 50}, + }, + { + vals: []int{3, 6, 7, 8, 8, 10, 13, 15, 16, 20}, + pp: []float64{0.25, 0.5, 0.75, 1}, + vv: []int{7, 8, 15, 20}, + }, + { + vals: []int{3, 6, 7, 8, 8, 9, 10, 13, 15, 16, 20}, + pp: []float64{0.25, 0.5, 0.75, 1}, + vv: []int{7, 9, 15, 20}, + }, + } + + maxVal := 0 + for _, tst := range tests { + for _, v := range tst.vals { + if maxVal < v { + maxVal = v + } + } + } + + for _, tst := range tests { + d := New(maxVal + 1) + for _, v := range tst.vals { + d.Record(v) + } + for i, p := range tst.pp { + got, want := d.Percentile(p), tst.vv[i] + if got != want { + t.Errorf("d=%v, d.Percentile(%f)=%d, want %d", d, p, got, want) + } + } + } +} + +func TestRace(t *testing.T) { + const N int = 1e3 + const parallel = 2 + + d := New(N) + + var wg sync.WaitGroup + wg.Add(parallel) + for i := 0; i < parallel; i++ { + go func() { + for i := 0; i < N; i++ { + d.Record(i) + } + wg.Done() + }() + } + + for i := 0; i < N; i++ { + if p := d.Percentile(0.5); p > N { + t.Fatalf("d.Percentile(0.5)=%d, expected to be at most %d", p, N) + } + } +} diff --git a/vendor/cloud.google.com/go/pubsub/iterator.go b/vendor/cloud.google.com/go/pubsub/iterator.go new file mode 100644 index 000000000..5b3415e42 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/iterator.go @@ -0,0 +1,498 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pubsub + +import ( + "context" + "io" + "sync" + "time" + + vkit "cloud.google.com/go/pubsub/apiv1" + "cloud.google.com/go/pubsub/internal/distribution" + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Between message receipt and ack (that is, the time spent processing a message) we want to extend the message +// deadline by way of modack. However, we don't want to extend the deadline right as soon as the deadline expires; +// instead, we'd want to extend the deadline a little bit of time ahead. gracePeriod is that amount of time ahead +// of the actual deadline. +const gracePeriod = 5 * time.Second + +type messageIterator struct { + ctx context.Context + cancel func() // the function that will cancel ctx; called in stop + po *pullOptions + ps *pullStream + subc *vkit.SubscriberClient + subName string + kaTick <-chan time.Time // keep-alive (deadline extensions) + ackTicker *time.Ticker // message acks + nackTicker *time.Ticker // message nacks (more frequent than acks) + pingTicker *time.Ticker // sends to the stream to keep it open + failed chan struct{} // closed on stream error + drained chan struct{} // closed when stopped && no more pending messages + wg sync.WaitGroup + + mu sync.Mutex + ackTimeDist *distribution.D // dist uses seconds + + // keepAliveDeadlines is a map of id to expiration time. This map is used in conjunction with + // subscription.ReceiveSettings.MaxExtension to record the maximum amount of time (the + // deadline, more specifically) we're willing to extend a message's ack deadline. As each + // message arrives, we'll record now+MaxExtension in this table; whenever we have a chance + // to update ack deadlines (via modack), we'll consult this table and only include IDs + // that are not beyond their deadline. + keepAliveDeadlines map[string]time.Time + pendingAcks map[string]bool + pendingNacks map[string]bool + pendingModAcks map[string]bool // ack IDs whose ack deadline is to be modified + err error // error from stream failure + + minAckDeadline time.Duration +} + +// newMessageIterator starts and returns a new messageIterator. +// subName is the full name of the subscription to pull messages from. +// Stop must be called on the messageIterator when it is no longer needed. +// The iterator always uses the background context for acking messages and extending message deadlines. +func newMessageIterator(subc *vkit.SubscriberClient, subName string, po *pullOptions) *messageIterator { + var ps *pullStream + if !po.synchronous { + ps = newPullStream(context.Background(), subc.StreamingPull, subName) + } + // The period will update each tick based on the distribution of acks. We'll start by arbitrarily sending + // the first keepAlive halfway towards the minimum ack deadline. + keepAlivePeriod := minAckDeadline / 2 + + // Ack promptly so users don't lose work if client crashes. + ackTicker := time.NewTicker(100 * time.Millisecond) + nackTicker := time.NewTicker(100 * time.Millisecond) + pingTicker := time.NewTicker(30 * time.Second) + cctx, cancel := context.WithCancel(context.Background()) + it := &messageIterator{ + ctx: cctx, + cancel: cancel, + ps: ps, + po: po, + subc: subc, + subName: subName, + kaTick: time.After(keepAlivePeriod), + ackTicker: ackTicker, + nackTicker: nackTicker, + pingTicker: pingTicker, + failed: make(chan struct{}), + drained: make(chan struct{}), + ackTimeDist: distribution.New(int(maxAckDeadline/time.Second) + 1), + keepAliveDeadlines: map[string]time.Time{}, + pendingAcks: map[string]bool{}, + pendingNacks: map[string]bool{}, + pendingModAcks: map[string]bool{}, + } + it.wg.Add(1) + go it.sender() + return it +} + +// Subscription.receive will call stop on its messageIterator when finished with it. +// Stop will block until Done has been called on all Messages that have been +// returned by Next, or until the context with which the messageIterator was created +// is cancelled or exceeds its deadline. +func (it *messageIterator) stop() { + it.cancel() + it.mu.Lock() + it.checkDrained() + it.mu.Unlock() + it.wg.Wait() +} + +// checkDrained closes the drained channel if the iterator has been stopped and all +// pending messages have either been n/acked or expired. +// +// Called with the lock held. +func (it *messageIterator) checkDrained() { + select { + case <-it.drained: + return + default: + } + select { + case <-it.ctx.Done(): + if len(it.keepAliveDeadlines) == 0 { + close(it.drained) + } + default: + } +} + +// Called when a message is acked/nacked. +func (it *messageIterator) done(ackID string, ack bool, receiveTime time.Time) { + it.ackTimeDist.Record(int(time.Since(receiveTime) / time.Second)) + it.mu.Lock() + defer it.mu.Unlock() + delete(it.keepAliveDeadlines, ackID) + if ack { + it.pendingAcks[ackID] = true + } else { + it.pendingNacks[ackID] = true + } + it.checkDrained() +} + +// fail is called when a stream method returns a permanent error. +// fail returns it.err. This may be err, or it may be the error +// set by an earlier call to fail. +func (it *messageIterator) fail(err error) error { + it.mu.Lock() + defer it.mu.Unlock() + if it.err == nil { + it.err = err + close(it.failed) + } + return it.err +} + +// receive makes a call to the stream's Recv method, or the Pull RPC, and returns +// its messages. +// maxToPull is the maximum number of messages for the Pull RPC. +func (it *messageIterator) receive(maxToPull int32) ([]*Message, error) { + it.mu.Lock() + ierr := it.err + it.mu.Unlock() + if ierr != nil { + return nil, ierr + } + + // Stop retrieving messages if the iterator's Stop method was called. + select { + case <-it.ctx.Done(): + it.wg.Wait() + return nil, io.EOF + default: + } + + var rmsgs []*pb.ReceivedMessage + var err error + if it.po.synchronous { + rmsgs, err = it.pullMessages(maxToPull) + } else { + rmsgs, err = it.recvMessages() + } + // Any error here is fatal. + if err != nil { + return nil, it.fail(err) + } + msgs, err := convertMessages(rmsgs) + if err != nil { + return nil, it.fail(err) + } + // We received some messages. Remember them so we can keep them alive. Also, + // do a receipt mod-ack when streaming. + maxExt := time.Now().Add(it.po.maxExtension) + ackIDs := map[string]bool{} + it.mu.Lock() + now := time.Now() + for _, m := range msgs { + m.receiveTime = now + addRecv(m.ID, m.ackID, now) + m.doneFunc = it.done + it.keepAliveDeadlines[m.ackID] = maxExt + // Don't change the mod-ack if the message is going to be nacked. This is + // possible if there are retries. + if !it.pendingNacks[m.ackID] && !it.po.synchronous { + ackIDs[m.ackID] = true + } + } + deadline := it.ackDeadline() + it.mu.Unlock() + if len(ackIDs) > 0 { + if !it.sendModAck(ackIDs, deadline) { + return nil, it.err + } + } + return msgs, nil +} + +// Get messages using the Pull RPC. +// This may block indefinitely. It may also return zero messages, after some time waiting. +func (it *messageIterator) pullMessages(maxToPull int32) ([]*pb.ReceivedMessage, error) { + // Use it.ctx as the RPC context, so that if the iterator is stopped, the call + // will return immediately. + res, err := it.subc.Pull(it.ctx, &pb.PullRequest{ + Subscription: it.subName, + MaxMessages: maxToPull, + }) + switch { + case err == context.Canceled: + return nil, nil + case err != nil: + return nil, err + default: + return res.ReceivedMessages, nil + } +} + +func (it *messageIterator) recvMessages() ([]*pb.ReceivedMessage, error) { + res, err := it.ps.Recv() + if err != nil { + return nil, err + } + return res.ReceivedMessages, nil +} + +// sender runs in a goroutine and handles all sends to the stream. +func (it *messageIterator) sender() { + defer it.wg.Done() + defer it.ackTicker.Stop() + defer it.nackTicker.Stop() + defer it.pingTicker.Stop() + defer func() { + if it.ps != nil { + it.ps.CloseSend() + } + }() + + done := false + for !done { + sendAcks := false + sendNacks := false + sendModAcks := false + sendPing := false + + dl := it.ackDeadline() + + select { + case <-it.failed: + // Stream failed: nothing to do, so stop immediately. + return + + case <-it.drained: + // All outstanding messages have been marked done: + // nothing left to do except make the final calls. + it.mu.Lock() + sendAcks = (len(it.pendingAcks) > 0) + sendNacks = (len(it.pendingNacks) > 0) + // No point in sending modacks. + done = true + + case <-it.kaTick: + it.mu.Lock() + it.handleKeepAlives() + sendModAcks = (len(it.pendingModAcks) > 0) + + nextTick := dl - gracePeriod + if nextTick <= 0 { + // If the deadline is <= gracePeriod, let's tick again halfway to + // the deadline. + nextTick = dl / 2 + } + it.kaTick = time.After(nextTick) + + case <-it.nackTicker.C: + it.mu.Lock() + sendNacks = (len(it.pendingNacks) > 0) + + case <-it.ackTicker.C: + it.mu.Lock() + sendAcks = (len(it.pendingAcks) > 0) + + case <-it.pingTicker.C: + it.mu.Lock() + // Ping only if we are processing messages via streaming. + sendPing = !it.po.synchronous && (len(it.keepAliveDeadlines) > 0) + } + // Lock is held here. + var acks, nacks, modAcks map[string]bool + if sendAcks { + acks = it.pendingAcks + it.pendingAcks = map[string]bool{} + } + if sendNacks { + nacks = it.pendingNacks + it.pendingNacks = map[string]bool{} + } + if sendModAcks { + modAcks = it.pendingModAcks + it.pendingModAcks = map[string]bool{} + } + it.mu.Unlock() + // Make Ack and ModAck RPCs. + if sendAcks { + if !it.sendAck(acks) { + return + } + } + if sendNacks { + // Nack indicated by modifying the deadline to zero. + if !it.sendModAck(nacks, 0) { + return + } + } + if sendModAcks { + if !it.sendModAck(modAcks, dl) { + return + } + } + if sendPing { + it.pingStream() + } + } +} + +// handleKeepAlives modifies the pending request to include deadline extensions +// for live messages. It also purges expired messages. +// +// Called with the lock held. +func (it *messageIterator) handleKeepAlives() { + now := time.Now() + for id, expiry := range it.keepAliveDeadlines { + if expiry.Before(now) { + // This delete will not result in skipping any map items, as implied by + // the spec at https://golang.org/ref/spec#For_statements, "For + // statements with range clause", note 3, and stated explicitly at + // https://groups.google.com/forum/#!msg/golang-nuts/UciASUb03Js/pzSq5iVFAQAJ. + delete(it.keepAliveDeadlines, id) + } else { + // This will not conflict with a nack, because nacking removes the ID from keepAliveDeadlines. + it.pendingModAcks[id] = true + } + } + it.checkDrained() +} + +func (it *messageIterator) sendAck(m map[string]bool) bool { + return it.sendAckIDRPC(m, func(ids []string) error { + recordStat(it.ctx, AckCount, int64(len(ids))) + addAcks(ids) + // Use context.Background() as the call's context, not it.ctx. We don't + // want to cancel this RPC when the iterator is stopped. + return it.subc.Acknowledge(context.Background(), &pb.AcknowledgeRequest{ + Subscription: it.subName, + AckIds: ids, + }) + }) +} + +// The receipt mod-ack amount is derived from a percentile distribution based +// on the time it takes to process messages. The percentile chosen is the 99%th +// percentile in order to capture the highest amount of time necessary without +// considering 1% outliers. +func (it *messageIterator) sendModAck(m map[string]bool, deadline time.Duration) bool { + return it.sendAckIDRPC(m, func(ids []string) error { + if deadline == 0 { + recordStat(it.ctx, NackCount, int64(len(ids))) + } else { + recordStat(it.ctx, ModAckCount, int64(len(ids))) + } + addModAcks(ids, int32(deadline/time.Second)) + // Retry this RPC on Unavailable for a short amount of time, then give up + // without returning a fatal error. The utility of this RPC is by nature + // transient (since the deadline is relative to the current time) and it + // isn't crucial for correctness (since expired messages will just be + // resent). + cctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + bo := gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: time.Second, + Multiplier: 2, + } + for { + err := it.subc.ModifyAckDeadline(cctx, &pb.ModifyAckDeadlineRequest{ + Subscription: it.subName, + AckDeadlineSeconds: int32(deadline / time.Second), + AckIds: ids, + }) + switch status.Code(err) { + case codes.Unavailable: + if err := gax.Sleep(cctx, bo.Pause()); err == nil { + continue + } + // Treat sleep timeout like RPC timeout. + fallthrough + case codes.DeadlineExceeded: + // Timeout. Not a fatal error, but note that it happened. + recordStat(it.ctx, ModAckTimeoutCount, 1) + return nil + default: + // Any other error is fatal. + return err + } + } + }) +} + +func (it *messageIterator) sendAckIDRPC(ackIDSet map[string]bool, call func([]string) error) bool { + ackIDs := make([]string, 0, len(ackIDSet)) + for k := range ackIDSet { + ackIDs = append(ackIDs, k) + } + var toSend []string + for len(ackIDs) > 0 { + toSend, ackIDs = splitRequestIDs(ackIDs, maxPayload) + if err := call(toSend); err != nil { + // The underlying client handles retries, so any error is fatal to the + // iterator. + it.fail(err) + return false + } + } + return true +} + +// Send a message to the stream to keep it open. The stream will close if there's no +// traffic on it for a while. By keeping it open, we delay the start of the +// expiration timer on messages that are buffered by gRPC or elsewhere in the +// network. This matters if it takes a long time to process messages relative to the +// default ack deadline, and if the messages are small enough so that many can fit +// into the buffer. +func (it *messageIterator) pingStream() { + // Ignore error; if the stream is broken, this doesn't matter anyway. + _ = it.ps.Send(&pb.StreamingPullRequest{}) +} + +func splitRequestIDs(ids []string, maxSize int) (prefix, remainder []string) { + size := reqFixedOverhead + i := 0 + for size < maxSize && i < len(ids) { + size += overheadPerID + len(ids[i]) + i++ + } + if size > maxSize { + i-- + } + return ids[:i], ids[i:] +} + +// The deadline to ack is derived from a percentile distribution based +// on the time it takes to process messages. The percentile chosen is the 99%th +// percentile - that is, processing times up to the 99%th longest processing +// times should be safe. The highest 1% may expire. This number was chosen +// as a way to cover most users' usecases without losing the value of +// expiration. +func (it *messageIterator) ackDeadline() time.Duration { + pt := time.Duration(it.ackTimeDist.Percentile(.99)) * time.Second + + if pt > maxAckDeadline { + return maxAckDeadline + } + if pt < minAckDeadline { + return minAckDeadline + } + return pt +} diff --git a/vendor/cloud.google.com/go/pubsub/iterator_test.go b/vendor/cloud.google.com/go/pubsub/iterator_test.go new file mode 100644 index 000000000..6ed4fb645 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/iterator_test.go @@ -0,0 +1,297 @@ +// Copyright 2017 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 pubsub + +import ( + "context" + "errors" + "fmt" + "reflect" + "sync" + "sync/atomic" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/pubsub/pstest" + "google.golang.org/api/option" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var ( + projName = "some-project" + topicName = "some-topic" + fullyQualifiedTopicName = fmt.Sprintf("projects/%s/topics/%s", projName, topicName) +) + +func TestSplitRequestIDs(t *testing.T) { + t.Parallel() + ids := []string{"aaaa", "bbbb", "cccc", "dddd", "eeee"} + for _, test := range []struct { + ids []string + splitIndex int + }{ + {[]string{}, 0}, + {ids, 2}, + {ids[:2], 2}, + } { + got1, got2 := splitRequestIDs(test.ids, reqFixedOverhead+20) + want1, want2 := test.ids[:test.splitIndex], test.ids[test.splitIndex:] + if !testutil.Equal(got1, want1) { + t.Errorf("%v, 1: got %v, want %v", test, got1, want1) + } + if !testutil.Equal(got2, want2) { + t.Errorf("%v, 2: got %v, want %v", test, got2, want2) + } + } +} + +func TestAckDistribution(t *testing.T) { + if testing.Short() { + t.SkipNow() + } + t.Skip("broken") + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + minAckDeadline = 1 * time.Second + pstest.SetMinAckDeadline(minAckDeadline) + srv := pstest.NewServer() + defer srv.Close() + defer pstest.ResetMinAckDeadline() + + // Create the topic via a Publish. It's convenient to do it here as opposed to client.CreateTopic because the client + // has not been established yet, and also because we want to create the topic once whereas the client is established + // below twice. + srv.Publish(fullyQualifiedTopicName, []byte("creating a topic"), nil) + + queuedMsgs := make(chan int32, 1024) + go continuouslySend(ctx, srv, queuedMsgs) + + for _, testcase := range []struct { + initialProcessSecs int32 + finalProcessSecs int32 + }{ + {initialProcessSecs: 3, finalProcessSecs: 5}, // Process time goes up + {initialProcessSecs: 5, finalProcessSecs: 3}, // Process time goes down + } { + t.Logf("Testing %d -> %d", testcase.initialProcessSecs, testcase.finalProcessSecs) + + // processTimeSecs is used by the sender to coordinate with the receiver how long the receiver should + // pretend to process for. e.g. if we test 3s -> 5s, processTimeSecs will start at 3, causing receiver + // to process messages received for 3s while sender sends the first batch. Then, as sender begins to + // send the next batch, sender will swap processTimeSeconds to 5s and begin sending, and receiver will + // process each message for 5s. In this way we simulate a client whose time-to-ack (process time) changes. + processTimeSecs := testcase.initialProcessSecs + + s, client, err := initConn(ctx, srv.Addr) + if err != nil { + t.Fatal(err) + } + + // recvdWg increments for each message sent, and decrements for each message received. + recvdWg := &sync.WaitGroup{} + + go startReceiving(ctx, t, s, recvdWg, &processTimeSecs) + startSending(t, queuedMsgs, &processTimeSecs, testcase.initialProcessSecs, testcase.finalProcessSecs, recvdWg) + + recvdWg.Wait() + time.Sleep(100 * time.Millisecond) // Wait a bit more for resources to clean up + err = client.Close() + if err != nil { + t.Fatal(err) + } + + modacks := modacksByTime(srv.Messages()) + u := modackDeadlines(modacks) + initialDL := int32(minAckDeadline / time.Second) + if !setsAreEqual(u, []int32{initialDL, testcase.initialProcessSecs, testcase.finalProcessSecs}) { + t.Fatalf("Expected modack deadlines to contain (exactly, and only) %ds, %ds, %ds. Instead, got %v", + initialDL, testcase.initialProcessSecs, testcase.finalProcessSecs, toSet(u)) + } + } +} + +// modacksByTime buckets modacks by time. +func modacksByTime(msgs []*pstest.Message) map[time.Time][]pstest.Modack { + modacks := map[time.Time][]pstest.Modack{} + + for _, msg := range msgs { + for _, m := range msg.Modacks { + modacks[m.ReceivedAt] = append(modacks[m.ReceivedAt], m) + } + } + return modacks +} + +// setsAreEqual reports whether a and b contain the same values, ignoring duplicates. +func setsAreEqual(haystack, needles []int32) bool { + hMap := map[int32]bool{} + nMap := map[int32]bool{} + + for _, n := range needles { + nMap[n] = true + } + + for _, n := range haystack { + hMap[n] = true + } + + return reflect.DeepEqual(nMap, hMap) +} + +// startReceiving pretends to be a client. It calls s.Receive and acks messages after some random delay. It also +// looks out for dupes - any message that arrives twice will cause a failure. +func startReceiving(ctx context.Context, t *testing.T, s *Subscription, recvdWg *sync.WaitGroup, processTimeSecs *int32) { + t.Log("Receiving..") + + var recvdMu sync.Mutex + recvd := map[string]bool{} + + err := s.Receive(ctx, func(ctx context.Context, msg *Message) { + msgData := string(msg.Data) + recvdMu.Lock() + _, ok := recvd[msgData] + if ok { + recvdMu.Unlock() + t.Fatalf("already saw \"%s\"\n", msgData) + return + } + recvd[msgData] = true + recvdMu.Unlock() + + select { + case <-ctx.Done(): + msg.Nack() + recvdWg.Done() + case <-time.After(time.Duration(atomic.LoadInt32(processTimeSecs)) * time.Second): + msg.Ack() + recvdWg.Done() + } + }) + if err != nil { + if status.Code(err) != codes.Canceled { + t.Error(err) + } + } +} + +// startSending sends four batches of messages broken up by minDeadline, initialProcessSecs, and finalProcessSecs. +func startSending(t *testing.T, queuedMsgs chan int32, processTimeSecs *int32, initialProcessSecs int32, finalProcessSecs int32, recvdWg *sync.WaitGroup) { + var msg int32 + + // We must send this block to force the receiver to send its initially-configured modack time. The time that + // gets sent should be ignorant of the distribution, since there haven't been enough (any, actually) messages + // to create a distribution yet. + t.Log("minAckDeadlineSecsSending an initial message") + recvdWg.Add(1) + msg++ + queuedMsgs <- msg + <-time.After(minAckDeadline) + + t.Logf("Sending some messages to update distribution to %d. This new distribution will be used "+ + "when the next batch of messages go out.", initialProcessSecs) + for i := 0; i < 10; i++ { + recvdWg.Add(1) + msg++ + queuedMsgs <- msg + } + atomic.SwapInt32(processTimeSecs, finalProcessSecs) + <-time.After(time.Duration(initialProcessSecs) * time.Second) + + t.Logf("Sending many messages to update distribution to %d. This new distribution will be used "+ + "when the next batch of messages go out.", finalProcessSecs) + for i := 0; i < 100; i++ { + recvdWg.Add(1) + msg++ + queuedMsgs <- msg // Send many messages to drastically change distribution + } + <-time.After(time.Duration(finalProcessSecs) * time.Second) + + t.Logf("Last message going out, whose deadline should be %d.", finalProcessSecs) + recvdWg.Add(1) + msg++ + queuedMsgs <- msg +} + +// continuouslySend continuously sends messages that exist on the queuedMsgs chan. +func continuouslySend(ctx context.Context, srv *pstest.Server, queuedMsgs chan int32) { + for { + select { + case <-ctx.Done(): + return + case m := <-queuedMsgs: + srv.Publish(fullyQualifiedTopicName, []byte(fmt.Sprintf("message %d", m)), nil) + } + } +} + +func toSet(arr []int32) []int32 { + var s []int32 + m := map[int32]bool{} + + for _, v := range arr { + _, ok := m[v] + if !ok { + s = append(s, v) + m[v] = true + } + } + + return s + +} + +func initConn(ctx context.Context, addr string) (*Subscription, *Client, error) { + conn, err := grpc.Dial(addr, grpc.WithInsecure()) + if err != nil { + return nil, nil, err + } + client, err := NewClient(ctx, projName, option.WithGRPCConn(conn)) + if err != nil { + return nil, nil, err + } + + topic := client.Topic(topicName) + s, err := client.CreateSubscription(ctx, fmt.Sprintf("sub-%d", time.Now().UnixNano()), SubscriptionConfig{Topic: topic}) + if err != nil { + return nil, nil, err + } + + exists, err := s.Exists(ctx) + if !exists { + return nil, nil, errors.New("Subscription does not exist") + } + if err != nil { + return nil, nil, err + } + + return s, client, nil +} + +// modackDeadlines takes a map of time => Modack, gathers all the Modack.AckDeadlines, +// and returns them as a slice +func modackDeadlines(m map[time.Time][]pstest.Modack) []int32 { + var u []int32 + for _, vv := range m { + for _, v := range vv { + u = append(u, v.AckDeadline) + } + } + return u +} diff --git a/vendor/cloud.google.com/go/pubsub/loadtest/benchmark_test.go b/vendor/cloud.google.com/go/pubsub/loadtest/benchmark_test.go new file mode 100644 index 000000000..885caa2d5 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/loadtest/benchmark_test.go @@ -0,0 +1,175 @@ +// Copyright 2017 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 loadtest + +// Performance benchmarks for pubsub. +// Run with +// go test -bench . -cpu 1 + +import ( + "context" + "log" + "sync" + "sync/atomic" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/pubsub" + "google.golang.org/api/option" + gtransport "google.golang.org/api/transport/grpc" + pb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc" +) + +// These constants are designed to match the "throughput" test in +// https://github.com/GoogleCloudPlatform/pubsub/blob/master/load-test-framework/run.py +// and +// https://github.com/GoogleCloudPlatform/pubsub/blob/master/load-test-framework/src/main/java/com/google/pubsub/clients/experimental/CPSPublisherTask.java + +const ( + nMessages = 1e5 + messageSize = 10000 // size of msg data in bytes + batchSize = 10 + batchDuration = 50 * time.Millisecond + serverDelay = 200 * time.Millisecond + maxOutstandingPublishes = 1600 // max_outstanding_messages in run.py +) + +func BenchmarkPublishThroughput(b *testing.B) { + b.SetBytes(nMessages * messageSize) + client := perfClient(serverDelay, 1, b) + + lts := &PubServer{ID: "xxx"} + lts.init(client, "t", messageSize, batchSize, batchDuration) + b.ResetTimer() + for i := 0; i < b.N; i++ { + runOnce(lts) + } +} + +func runOnce(lts *PubServer) { + nRequests := int64(nMessages / batchSize) + var nPublished int64 + var wg sync.WaitGroup + // The Java loadtest framework is rate-limited to 1 billion Execute calls a + // second (each Execute call corresponding to a publishBatch call here), + // but we can ignore this because of the following. + // The framework runs 10,000 threads, each calling Execute in a loop, but + // we can ignore this too. + // The framework caps the number of outstanding calls to Execute at + // maxOutstandingPublishes. That is what we simulate here. + for i := 0; i < maxOutstandingPublishes; i++ { + wg.Add(1) + go func() { + defer wg.Done() + for atomic.AddInt64(&nRequests, -1) >= 0 { + latencies, err := lts.publishBatch() + if err != nil { + log.Fatalf("publishBatch: %v", err) + } + atomic.AddInt64(&nPublished, int64(len(latencies))) + } + }() + } + wg.Wait() + sent := atomic.LoadInt64(&nPublished) + if sent != nMessages { + log.Fatalf("sent %d messages, expected %d", sent, int(nMessages)) + } +} + +func perfClient(pubDelay time.Duration, nConns int, f interface { + Fatal(...interface{}) +}) *pubsub.Client { + ctx := context.Background() + srv, err := newPerfServer(pubDelay) + if err != nil { + f.Fatal(err) + } + conn, err := gtransport.DialInsecure(ctx, + option.WithEndpoint(srv.Addr), + option.WithGRPCConnectionPool(nConns), + + // TODO(grpc/grpc-go#1388) using connection pool without WithBlock + // can cause RPCs to fail randomly. We can delete this after the issue is fixed. + option.WithGRPCDialOption(grpc.WithBlock())) + if err != nil { + f.Fatal(err) + } + client, err := pubsub.NewClient(ctx, "projectID", option.WithGRPCConn(conn)) + if err != nil { + f.Fatal(err) + } + return client +} + +type perfServer struct { + pb.PublisherServer + pb.SubscriberServer + + Addr string + pubDelay time.Duration + + mu sync.Mutex + activePubs int + maxActivePubs int +} + +func newPerfServer(pubDelay time.Duration) (*perfServer, error) { + srv, err := testutil.NewServer(grpc.MaxMsgSize(pubsub.MaxPublishRequestBytes)) + if err != nil { + return nil, err + } + perf := &perfServer{Addr: srv.Addr, pubDelay: pubDelay} + pb.RegisterPublisherServer(srv.Gsrv, perf) + pb.RegisterSubscriberServer(srv.Gsrv, perf) + srv.Start() + return perf, nil +} + +var doLog = false + +func (p *perfServer) incActivePubs(n int) (int, bool) { + p.mu.Lock() + defer p.mu.Unlock() + p.activePubs += n + newMax := false + if p.activePubs > p.maxActivePubs { + p.maxActivePubs = p.activePubs + newMax = true + } + return p.activePubs, newMax +} + +func (p *perfServer) Publish(ctx context.Context, req *pb.PublishRequest) (*pb.PublishResponse, error) { + a, newMax := p.incActivePubs(1) + defer p.incActivePubs(-1) + if newMax && doLog { + log.Printf("max %d active publish calls", a) + } + if doLog { + log.Printf("%p -> Publish %d", p, len(req.Messages)) + } + res := &pb.PublishResponse{MessageIds: make([]string, len(req.Messages))} + for i := range res.MessageIds { + res.MessageIds[i] = "x" + } + time.Sleep(p.pubDelay) + if doLog { + log.Printf("%p <- Publish %d", p, len(req.Messages)) + } + return res, nil +} diff --git a/vendor/cloud.google.com/go/pubsub/loadtest/cmd/loadtest.go b/vendor/cloud.google.com/go/pubsub/loadtest/cmd/loadtest.go new file mode 100644 index 000000000..6451959db --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/loadtest/cmd/loadtest.go @@ -0,0 +1,53 @@ +// Copyright 2017 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 main + +import ( + "flag" + "fmt" + "log" + "math/rand" + "net" + "strconv" + + "cloud.google.com/go/pubsub/loadtest" + pb "cloud.google.com/go/pubsub/loadtest/pb" + "google.golang.org/grpc" +) + +func main() { + port := flag.Uint("worker_port", 6000, "port to bind worker to") + role := flag.String("r", "", "role: pub/sub") + flag.Parse() + + var lts pb.LoadtestWorkerServer + switch *role { + case "pub": + lts = &loadtest.PubServer{ID: strconv.Itoa(rand.Int())} + case "sub": + lts = &loadtest.SubServer{} + default: + log.Fatalf("unknown role: %q", *role) + } + + serv := grpc.NewServer() + pb.RegisterLoadtestWorkerServer(serv, lts) + + lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port)) + if err != nil { + log.Fatalf("failed to listen: %v", err) + } + serv.Serve(lis) +} diff --git a/vendor/cloud.google.com/go/pubsub/loadtest/loadtest.go b/vendor/cloud.google.com/go/pubsub/loadtest/loadtest.go new file mode 100644 index 000000000..1daa21e15 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/loadtest/loadtest.go @@ -0,0 +1,220 @@ +// Copyright 2017 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 loadtest implements load testing for pubsub, +// following the interface defined in https://github.com/GoogleCloudPlatform/pubsub/tree/master/load-test-framework/ . +// +// This package is experimental. +package loadtest + +import ( + "bytes" + "context" + "errors" + "log" + "runtime" + "strconv" + "sync" + "sync/atomic" + "time" + + "cloud.google.com/go/pubsub" + pb "cloud.google.com/go/pubsub/loadtest/pb" + "github.com/golang/protobuf/ptypes" + "golang.org/x/time/rate" +) + +type pubServerConfig struct { + topic *pubsub.Topic + msgData []byte + batchSize int32 +} + +// PubServer is a dummy Pub/Sub server for load testing. +type PubServer struct { + ID string + + cfg atomic.Value + seqNum int32 +} + +// Start starts the server. +func (l *PubServer) Start(ctx context.Context, req *pb.StartRequest) (*pb.StartResponse, error) { + log.Println("received start") + c, err := pubsub.NewClient(ctx, req.Project) + if err != nil { + return nil, err + } + dur, err := ptypes.Duration(req.PublishBatchDuration) + if err != nil { + return nil, err + } + l.init(c, req.Topic, req.MessageSize, req.PublishBatchSize, dur) + log.Println("started") + return &pb.StartResponse{}, nil +} + +func (l *PubServer) init(c *pubsub.Client, topicName string, msgSize, batchSize int32, batchDur time.Duration) { + topic := c.Topic(topicName) + topic.PublishSettings = pubsub.PublishSettings{ + DelayThreshold: batchDur, + CountThreshold: 950, + ByteThreshold: 9500000, + } + + l.cfg.Store(pubServerConfig{ + topic: topic, + msgData: bytes.Repeat([]byte{'A'}, int(msgSize)), + batchSize: batchSize, + }) +} + +// Execute executes a request. +func (l *PubServer) Execute(ctx context.Context, _ *pb.ExecuteRequest) (*pb.ExecuteResponse, error) { + latencies, err := l.publishBatch() + if err != nil { + log.Printf("error: %v", err) + return nil, err + } + return &pb.ExecuteResponse{Latencies: latencies}, nil +} + +func (l *PubServer) publishBatch() ([]int64, error) { + var cfg pubServerConfig + if c, ok := l.cfg.Load().(pubServerConfig); ok { + cfg = c + } else { + return nil, errors.New("config not loaded") + } + + start := time.Now() + latencies := make([]int64, cfg.batchSize) + startStr := strconv.FormatInt(start.UnixNano()/1e6, 10) + seqNum := atomic.AddInt32(&l.seqNum, cfg.batchSize) - cfg.batchSize + + rs := make([]*pubsub.PublishResult, cfg.batchSize) + for i := int32(0); i < cfg.batchSize; i++ { + rs[i] = cfg.topic.Publish(context.TODO(), &pubsub.Message{ + Data: cfg.msgData, + Attributes: map[string]string{ + "sendTime": startStr, + "clientId": l.ID, + "sequenceNumber": strconv.Itoa(int(seqNum + i)), + }, + }) + } + for i, r := range rs { + _, err := r.Get(context.Background()) + if err != nil { + return nil, err + } + // TODO(jba,pongad): fix latencies + // Later values will be skewed by earlier ones, since we wait for the + // results in order. (On the other hand, it may not matter much, since + // messages are added to bundles in order and bundles get sent more or + // less in order.) If we want more accurate values, we can either start + // a goroutine for each result (similar to the original code using a + // callback), or call reflect.Select with the Ready channels of the + // results. + latencies[i] = time.Since(start).Nanoseconds() / 1e6 + } + return latencies, nil +} + +// SubServer is a dummy Pub/Sub server for load testing. +type SubServer struct { + // TODO(deklerk) what is this actually for? + lim *rate.Limiter + + mu sync.Mutex + idents []*pb.MessageIdentifier + latencies []int64 +} + +// Start starts the server. +func (s *SubServer) Start(ctx context.Context, req *pb.StartRequest) (*pb.StartResponse, error) { + log.Println("received start") + s.lim = rate.NewLimiter(rate.Every(time.Second), 1) + + c, err := pubsub.NewClient(ctx, req.Project) + if err != nil { + return nil, err + } + + // Load test API doesn't define any way to stop right now. + go func() { + sub := c.Subscription(req.GetPubsubOptions().Subscription) + sub.ReceiveSettings.NumGoroutines = 10 * runtime.GOMAXPROCS(0) + err := sub.Receive(context.Background(), s.callback) + log.Fatal(err) + }() + + log.Println("started") + return &pb.StartResponse{}, nil +} + +func (s *SubServer) callback(_ context.Context, m *pubsub.Message) { + id, err := strconv.ParseInt(m.Attributes["clientId"], 10, 64) + if err != nil { + log.Println(err) + m.Nack() + return + } + + seqNum, err := strconv.ParseInt(m.Attributes["sequenceNumber"], 10, 32) + if err != nil { + log.Println(err) + m.Nack() + return + } + + sendTimeMillis, err := strconv.ParseInt(m.Attributes["sendTime"], 10, 64) + if err != nil { + log.Println(err) + m.Nack() + return + } + + latency := time.Now().UnixNano()/1e6 - sendTimeMillis + ident := &pb.MessageIdentifier{ + PublisherClientId: id, + SequenceNumber: int32(seqNum), + } + + s.mu.Lock() + s.idents = append(s.idents, ident) + s.latencies = append(s.latencies, latency) + s.mu.Unlock() + m.Ack() +} + +// Execute executes the request. +func (s *SubServer) Execute(ctx context.Context, _ *pb.ExecuteRequest) (*pb.ExecuteResponse, error) { + // Throttle so the load tester doesn't spam us and consume all our CPU. + if err := s.lim.Wait(ctx); err != nil { + return nil, err + } + + s.mu.Lock() + idents := s.idents + s.idents = nil + latencies := s.latencies + s.latencies = nil + s.mu.Unlock() + + return &pb.ExecuteResponse{ + Latencies: latencies, + ReceivedMessages: idents, + }, nil +} diff --git a/vendor/cloud.google.com/go/pubsub/loadtest/pb/loadtest.pb.go b/vendor/cloud.google.com/go/pubsub/loadtest/pb/loadtest.pb.go new file mode 100644 index 000000000..055db4553 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/loadtest/pb/loadtest.pb.go @@ -0,0 +1,793 @@ +// Code generated by protoc-gen-go. +// source: loadtest.proto +// DO NOT EDIT! + +/* +Package google_pubsub_loadtest is a generated protocol buffer package. + +It is generated from these files: + loadtest.proto + +It has these top-level messages: + StartRequest + StartResponse + PubsubOptions + KafkaOptions + MessageIdentifier + CheckRequest + CheckResponse + ExecuteRequest + ExecuteResponse +*/ +package google_pubsub_loadtest + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf "github.com/golang/protobuf/ptypes/duration" +import google_protobuf1 "github.com/golang/protobuf/ptypes/timestamp" + +import ( + "context" + + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type StartRequest struct { + // The GCP project. This must be set even for Kafka, as we use it to export metrics. + Project string `protobuf:"bytes,1,opt,name=project" json:"project,omitempty"` + // The Pub/Sub or Kafka topic name. + Topic string `protobuf:"bytes,2,opt,name=topic" json:"topic,omitempty"` + // The number of requests that can be made, each second, per client. + RequestRate int32 `protobuf:"varint,3,opt,name=request_rate,json=requestRate" json:"request_rate,omitempty"` + // The size of each user message to publish + MessageSize int32 `protobuf:"varint,4,opt,name=message_size,json=messageSize" json:"message_size,omitempty"` + // The maximum outstanding requests, per client. + MaxOutstandingRequests int32 `protobuf:"varint,5,opt,name=max_outstanding_requests,json=maxOutstandingRequests" json:"max_outstanding_requests,omitempty"` + // The time at which the load test should start. If this is less than the current time, we start immediately. + StartTime *google_protobuf1.Timestamp `protobuf:"bytes,6,opt,name=start_time,json=startTime" json:"start_time,omitempty"` + // The burn-in duration, before which results should not be reported. + BurnInDuration *google_protobuf.Duration `protobuf:"bytes,12,opt,name=burn_in_duration,json=burnInDuration" json:"burn_in_duration,omitempty"` + // The number of user messages of size message_size to publish together. + PublishBatchSize int32 `protobuf:"varint,11,opt,name=publish_batch_size,json=publishBatchSize" json:"publish_batch_size,omitempty"` + // The max duration for coalescing a batch of published messages. + PublishBatchDuration *google_protobuf.Duration `protobuf:"bytes,13,opt,name=publish_batch_duration,json=publishBatchDuration" json:"publish_batch_duration,omitempty"` + // Types that are valid to be assigned to StopConditions: + // *StartRequest_TestDuration + // *StartRequest_NumberOfMessages + StopConditions isStartRequest_StopConditions `protobuf_oneof:"stop_conditions"` + // Types that are valid to be assigned to Options: + // *StartRequest_PubsubOptions + // *StartRequest_KafkaOptions + Options isStartRequest_Options `protobuf_oneof:"options"` +} + +func (m *StartRequest) Reset() { *m = StartRequest{} } +func (m *StartRequest) String() string { return proto.CompactTextString(m) } +func (*StartRequest) ProtoMessage() {} +func (*StartRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type isStartRequest_StopConditions interface { + isStartRequest_StopConditions() +} +type isStartRequest_Options interface { + isStartRequest_Options() +} + +type StartRequest_TestDuration struct { + TestDuration *google_protobuf.Duration `protobuf:"bytes,7,opt,name=test_duration,json=testDuration,oneof"` +} +type StartRequest_NumberOfMessages struct { + NumberOfMessages int32 `protobuf:"varint,8,opt,name=number_of_messages,json=numberOfMessages,oneof"` +} +type StartRequest_PubsubOptions struct { + PubsubOptions *PubsubOptions `protobuf:"bytes,9,opt,name=pubsub_options,json=pubsubOptions,oneof"` +} +type StartRequest_KafkaOptions struct { + KafkaOptions *KafkaOptions `protobuf:"bytes,10,opt,name=kafka_options,json=kafkaOptions,oneof"` +} + +func (*StartRequest_TestDuration) isStartRequest_StopConditions() {} +func (*StartRequest_NumberOfMessages) isStartRequest_StopConditions() {} +func (*StartRequest_PubsubOptions) isStartRequest_Options() {} +func (*StartRequest_KafkaOptions) isStartRequest_Options() {} + +func (m *StartRequest) GetStopConditions() isStartRequest_StopConditions { + if m != nil { + return m.StopConditions + } + return nil +} +func (m *StartRequest) GetOptions() isStartRequest_Options { + if m != nil { + return m.Options + } + return nil +} + +func (m *StartRequest) GetProject() string { + if m != nil { + return m.Project + } + return "" +} + +func (m *StartRequest) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *StartRequest) GetRequestRate() int32 { + if m != nil { + return m.RequestRate + } + return 0 +} + +func (m *StartRequest) GetMessageSize() int32 { + if m != nil { + return m.MessageSize + } + return 0 +} + +func (m *StartRequest) GetMaxOutstandingRequests() int32 { + if m != nil { + return m.MaxOutstandingRequests + } + return 0 +} + +func (m *StartRequest) GetStartTime() *google_protobuf1.Timestamp { + if m != nil { + return m.StartTime + } + return nil +} + +func (m *StartRequest) GetBurnInDuration() *google_protobuf.Duration { + if m != nil { + return m.BurnInDuration + } + return nil +} + +func (m *StartRequest) GetPublishBatchSize() int32 { + if m != nil { + return m.PublishBatchSize + } + return 0 +} + +func (m *StartRequest) GetPublishBatchDuration() *google_protobuf.Duration { + if m != nil { + return m.PublishBatchDuration + } + return nil +} + +func (m *StartRequest) GetTestDuration() *google_protobuf.Duration { + if x, ok := m.GetStopConditions().(*StartRequest_TestDuration); ok { + return x.TestDuration + } + return nil +} + +func (m *StartRequest) GetNumberOfMessages() int32 { + if x, ok := m.GetStopConditions().(*StartRequest_NumberOfMessages); ok { + return x.NumberOfMessages + } + return 0 +} + +func (m *StartRequest) GetPubsubOptions() *PubsubOptions { + if x, ok := m.GetOptions().(*StartRequest_PubsubOptions); ok { + return x.PubsubOptions + } + return nil +} + +func (m *StartRequest) GetKafkaOptions() *KafkaOptions { + if x, ok := m.GetOptions().(*StartRequest_KafkaOptions); ok { + return x.KafkaOptions + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*StartRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _StartRequest_OneofMarshaler, _StartRequest_OneofUnmarshaler, _StartRequest_OneofSizer, []interface{}{ + (*StartRequest_TestDuration)(nil), + (*StartRequest_NumberOfMessages)(nil), + (*StartRequest_PubsubOptions)(nil), + (*StartRequest_KafkaOptions)(nil), + } +} + +func _StartRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*StartRequest) + // stop_conditions + switch x := m.StopConditions.(type) { + case *StartRequest_TestDuration: + b.EncodeVarint(7<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.TestDuration); err != nil { + return err + } + case *StartRequest_NumberOfMessages: + b.EncodeVarint(8<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.NumberOfMessages)) + case nil: + default: + return fmt.Errorf("StartRequest.StopConditions has unexpected type %T", x) + } + // options + switch x := m.Options.(type) { + case *StartRequest_PubsubOptions: + b.EncodeVarint(9<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.PubsubOptions); err != nil { + return err + } + case *StartRequest_KafkaOptions: + b.EncodeVarint(10<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.KafkaOptions); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("StartRequest.Options has unexpected type %T", x) + } + return nil +} + +func _StartRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*StartRequest) + switch tag { + case 7: // stop_conditions.test_duration + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(google_protobuf.Duration) + err := b.DecodeMessage(msg) + m.StopConditions = &StartRequest_TestDuration{msg} + return true, err + case 8: // stop_conditions.number_of_messages + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.StopConditions = &StartRequest_NumberOfMessages{int32(x)} + return true, err + case 9: // options.pubsub_options + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(PubsubOptions) + err := b.DecodeMessage(msg) + m.Options = &StartRequest_PubsubOptions{msg} + return true, err + case 10: // options.kafka_options + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(KafkaOptions) + err := b.DecodeMessage(msg) + m.Options = &StartRequest_KafkaOptions{msg} + return true, err + default: + return false, nil + } +} + +func _StartRequest_OneofSizer(msg proto.Message) (n int) { + m := msg.(*StartRequest) + // stop_conditions + switch x := m.StopConditions.(type) { + case *StartRequest_TestDuration: + s := proto.Size(x.TestDuration) + n += proto.SizeVarint(7<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *StartRequest_NumberOfMessages: + n += proto.SizeVarint(8<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.NumberOfMessages)) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + // options + switch x := m.Options.(type) { + case *StartRequest_PubsubOptions: + s := proto.Size(x.PubsubOptions) + n += proto.SizeVarint(9<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *StartRequest_KafkaOptions: + s := proto.Size(x.KafkaOptions) + n += proto.SizeVarint(10<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type StartResponse struct { +} + +func (m *StartResponse) Reset() { *m = StartResponse{} } +func (m *StartResponse) String() string { return proto.CompactTextString(m) } +func (*StartResponse) ProtoMessage() {} +func (*StartResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +type PubsubOptions struct { + // The Cloud Pub/Sub subscription name + Subscription string `protobuf:"bytes,1,opt,name=subscription" json:"subscription,omitempty"` + // The maximum number of messages to pull which each request. + MaxMessagesPerPull int32 `protobuf:"varint,2,opt,name=max_messages_per_pull,json=maxMessagesPerPull" json:"max_messages_per_pull,omitempty"` +} + +func (m *PubsubOptions) Reset() { *m = PubsubOptions{} } +func (m *PubsubOptions) String() string { return proto.CompactTextString(m) } +func (*PubsubOptions) ProtoMessage() {} +func (*PubsubOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *PubsubOptions) GetSubscription() string { + if m != nil { + return m.Subscription + } + return "" +} + +func (m *PubsubOptions) GetMaxMessagesPerPull() int32 { + if m != nil { + return m.MaxMessagesPerPull + } + return 0 +} + +type KafkaOptions struct { + // The network address of the Kafka broker. + Broker string `protobuf:"bytes,1,opt,name=broker" json:"broker,omitempty"` + // The length of time to poll for. + PollDuration *google_protobuf.Duration `protobuf:"bytes,2,opt,name=poll_duration,json=pollDuration" json:"poll_duration,omitempty"` +} + +func (m *KafkaOptions) Reset() { *m = KafkaOptions{} } +func (m *KafkaOptions) String() string { return proto.CompactTextString(m) } +func (*KafkaOptions) ProtoMessage() {} +func (*KafkaOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *KafkaOptions) GetBroker() string { + if m != nil { + return m.Broker + } + return "" +} + +func (m *KafkaOptions) GetPollDuration() *google_protobuf.Duration { + if m != nil { + return m.PollDuration + } + return nil +} + +type MessageIdentifier struct { + // The unique id of the client that published the message. + PublisherClientId int64 `protobuf:"varint,1,opt,name=publisher_client_id,json=publisherClientId" json:"publisher_client_id,omitempty"` + // Sequence number of the published message with the given publish_client_id. + SequenceNumber int32 `protobuf:"varint,2,opt,name=sequence_number,json=sequenceNumber" json:"sequence_number,omitempty"` +} + +func (m *MessageIdentifier) Reset() { *m = MessageIdentifier{} } +func (m *MessageIdentifier) String() string { return proto.CompactTextString(m) } +func (*MessageIdentifier) ProtoMessage() {} +func (*MessageIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *MessageIdentifier) GetPublisherClientId() int64 { + if m != nil { + return m.PublisherClientId + } + return 0 +} + +func (m *MessageIdentifier) GetSequenceNumber() int32 { + if m != nil { + return m.SequenceNumber + } + return 0 +} + +type CheckRequest struct { + // Duplicate messages that should not be reported for throughput and latency. + Duplicates []*MessageIdentifier `protobuf:"bytes,1,rep,name=duplicates" json:"duplicates,omitempty"` +} + +func (m *CheckRequest) Reset() { *m = CheckRequest{} } +func (m *CheckRequest) String() string { return proto.CompactTextString(m) } +func (*CheckRequest) ProtoMessage() {} +func (*CheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *CheckRequest) GetDuplicates() []*MessageIdentifier { + if m != nil { + return m.Duplicates + } + return nil +} + +type CheckResponse struct { + // Histogram of latencies, each one a delta from the previous CheckResponse sent. + BucketValues []int64 `protobuf:"varint,1,rep,packed,name=bucket_values,json=bucketValues" json:"bucket_values,omitempty"` + // The duration from the start of the loadtest to its completion or now if is_finished is false. + RunningDuration *google_protobuf.Duration `protobuf:"bytes,2,opt,name=running_duration,json=runningDuration" json:"running_duration,omitempty"` + // True if the load test has finished running. + IsFinished bool `protobuf:"varint,3,opt,name=is_finished,json=isFinished" json:"is_finished,omitempty"` + // MessageIdentifiers of all received messages since the last Check + ReceivedMessages []*MessageIdentifier `protobuf:"bytes,4,rep,name=received_messages,json=receivedMessages" json:"received_messages,omitempty"` +} + +func (m *CheckResponse) Reset() { *m = CheckResponse{} } +func (m *CheckResponse) String() string { return proto.CompactTextString(m) } +func (*CheckResponse) ProtoMessage() {} +func (*CheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *CheckResponse) GetBucketValues() []int64 { + if m != nil { + return m.BucketValues + } + return nil +} + +func (m *CheckResponse) GetRunningDuration() *google_protobuf.Duration { + if m != nil { + return m.RunningDuration + } + return nil +} + +func (m *CheckResponse) GetIsFinished() bool { + if m != nil { + return m.IsFinished + } + return false +} + +func (m *CheckResponse) GetReceivedMessages() []*MessageIdentifier { + if m != nil { + return m.ReceivedMessages + } + return nil +} + +type ExecuteRequest struct { +} + +func (m *ExecuteRequest) Reset() { *m = ExecuteRequest{} } +func (m *ExecuteRequest) String() string { return proto.CompactTextString(m) } +func (*ExecuteRequest) ProtoMessage() {} +func (*ExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +type ExecuteResponse struct { + // Latencies of the completed operations + Latencies []int64 `protobuf:"varint,1,rep,packed,name=latencies" json:"latencies,omitempty"` + // MessageIdentifiers of all received messages since the last Execute + ReceivedMessages []*MessageIdentifier `protobuf:"bytes,2,rep,name=received_messages,json=receivedMessages" json:"received_messages,omitempty"` +} + +func (m *ExecuteResponse) Reset() { *m = ExecuteResponse{} } +func (m *ExecuteResponse) String() string { return proto.CompactTextString(m) } +func (*ExecuteResponse) ProtoMessage() {} +func (*ExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *ExecuteResponse) GetLatencies() []int64 { + if m != nil { + return m.Latencies + } + return nil +} + +func (m *ExecuteResponse) GetReceivedMessages() []*MessageIdentifier { + if m != nil { + return m.ReceivedMessages + } + return nil +} + +func init() { + proto.RegisterType((*StartRequest)(nil), "google.pubsub.loadtest.StartRequest") + proto.RegisterType((*StartResponse)(nil), "google.pubsub.loadtest.StartResponse") + proto.RegisterType((*PubsubOptions)(nil), "google.pubsub.loadtest.PubsubOptions") + proto.RegisterType((*KafkaOptions)(nil), "google.pubsub.loadtest.KafkaOptions") + proto.RegisterType((*MessageIdentifier)(nil), "google.pubsub.loadtest.MessageIdentifier") + proto.RegisterType((*CheckRequest)(nil), "google.pubsub.loadtest.CheckRequest") + proto.RegisterType((*CheckResponse)(nil), "google.pubsub.loadtest.CheckResponse") + proto.RegisterType((*ExecuteRequest)(nil), "google.pubsub.loadtest.ExecuteRequest") + proto.RegisterType((*ExecuteResponse)(nil), "google.pubsub.loadtest.ExecuteResponse") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Loadtest service + +type LoadtestClient interface { + // Starts a load test + Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) + // Checks the status of a load test + Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) +} + +type loadtestClient struct { + cc *grpc.ClientConn +} + +func NewLoadtestClient(cc *grpc.ClientConn) LoadtestClient { + return &loadtestClient{cc} +} + +func (c *loadtestClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) { + out := new(StartResponse) + err := grpc.Invoke(ctx, "/google.pubsub.loadtest.Loadtest/Start", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *loadtestClient) Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) { + out := new(CheckResponse) + err := grpc.Invoke(ctx, "/google.pubsub.loadtest.Loadtest/Check", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Loadtest service + +type LoadtestServer interface { + // Starts a load test + Start(context.Context, *StartRequest) (*StartResponse, error) + // Checks the status of a load test + Check(context.Context, *CheckRequest) (*CheckResponse, error) +} + +func RegisterLoadtestServer(s *grpc.Server, srv LoadtestServer) { + s.RegisterService(&_Loadtest_serviceDesc, srv) +} + +func _Loadtest_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LoadtestServer).Start(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.pubsub.loadtest.Loadtest/Start", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LoadtestServer).Start(ctx, req.(*StartRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Loadtest_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LoadtestServer).Check(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.pubsub.loadtest.Loadtest/Check", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LoadtestServer).Check(ctx, req.(*CheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Loadtest_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.pubsub.loadtest.Loadtest", + HandlerType: (*LoadtestServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Start", + Handler: _Loadtest_Start_Handler, + }, + { + MethodName: "Check", + Handler: _Loadtest_Check_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "loadtest.proto", +} + +// Client API for LoadtestWorker service + +type LoadtestWorkerClient interface { + // Starts a worker + Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) + // Executes a command on the worker, returning the latencies of the operations. Since some + // commands consist of multiple operations (i.e. pulls contain many received messages with + // different end to end latencies) a single command can have multiple latencies returned. + Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) +} + +type loadtestWorkerClient struct { + cc *grpc.ClientConn +} + +func NewLoadtestWorkerClient(cc *grpc.ClientConn) LoadtestWorkerClient { + return &loadtestWorkerClient{cc} +} + +func (c *loadtestWorkerClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) { + out := new(StartResponse) + err := grpc.Invoke(ctx, "/google.pubsub.loadtest.LoadtestWorker/Start", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *loadtestWorkerClient) Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) { + out := new(ExecuteResponse) + err := grpc.Invoke(ctx, "/google.pubsub.loadtest.LoadtestWorker/Execute", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for LoadtestWorker service + +type LoadtestWorkerServer interface { + // Starts a worker + Start(context.Context, *StartRequest) (*StartResponse, error) + // Executes a command on the worker, returning the latencies of the operations. Since some + // commands consist of multiple operations (i.e. pulls contain many received messages with + // different end to end latencies) a single command can have multiple latencies returned. + Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error) +} + +func RegisterLoadtestWorkerServer(s *grpc.Server, srv LoadtestWorkerServer) { + s.RegisterService(&_LoadtestWorker_serviceDesc, srv) +} + +func _LoadtestWorker_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LoadtestWorkerServer).Start(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.pubsub.loadtest.LoadtestWorker/Start", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LoadtestWorkerServer).Start(ctx, req.(*StartRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LoadtestWorker_Execute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExecuteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LoadtestWorkerServer).Execute(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.pubsub.loadtest.LoadtestWorker/Execute", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LoadtestWorkerServer).Execute(ctx, req.(*ExecuteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _LoadtestWorker_serviceDesc = grpc.ServiceDesc{ + ServiceName: "google.pubsub.loadtest.LoadtestWorker", + HandlerType: (*LoadtestWorkerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Start", + Handler: _LoadtestWorker_Start_Handler, + }, + { + MethodName: "Execute", + Handler: _LoadtestWorker_Execute_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "loadtest.proto", +} + +func init() { proto.RegisterFile("loadtest.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 847 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xdd, 0x6e, 0xdc, 0x44, + 0x14, 0xae, 0x93, 0x6e, 0x92, 0x3d, 0x6b, 0xef, 0x6e, 0x86, 0x12, 0x99, 0x15, 0xd0, 0x60, 0x28, + 0x0d, 0x12, 0x72, 0x45, 0xb8, 0x81, 0x1b, 0x84, 0x92, 0x82, 0x12, 0x15, 0x9a, 0xc8, 0x8d, 0x8a, + 0xe0, 0x66, 0x34, 0xb6, 0x67, 0x93, 0x61, 0xed, 0x19, 0x33, 0x3f, 0x55, 0xd4, 0x17, 0xe0, 0x8d, + 0x78, 0x00, 0x1e, 0x87, 0x5b, 0x5e, 0x00, 0xcd, 0x78, 0xbc, 0x3f, 0x6d, 0x57, 0x0b, 0x42, 0xbd, + 0x3c, 0xdf, 0xf9, 0xce, 0x37, 0xe7, 0xd7, 0x86, 0x61, 0x25, 0x48, 0xa9, 0xa9, 0xd2, 0x69, 0x23, + 0x85, 0x16, 0xe8, 0xe0, 0x5a, 0x88, 0xeb, 0x8a, 0xa6, 0x8d, 0xc9, 0x95, 0xc9, 0xd3, 0xce, 0x3b, + 0xf9, 0xb0, 0xc5, 0x1f, 0x39, 0x56, 0x6e, 0xa6, 0x8f, 0x4a, 0x23, 0x89, 0x66, 0x82, 0xb7, 0x71, + 0x93, 0xfb, 0xaf, 0xfa, 0x35, 0xab, 0xa9, 0xd2, 0xa4, 0x6e, 0x5a, 0x42, 0xf2, 0x57, 0x0f, 0xc2, + 0x67, 0x9a, 0x48, 0x9d, 0xd1, 0xdf, 0x0c, 0x55, 0x1a, 0xc5, 0xb0, 0xdb, 0x48, 0xf1, 0x2b, 0x2d, + 0x74, 0x1c, 0x1c, 0x06, 0x47, 0xfd, 0xac, 0x33, 0xd1, 0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x7b, 0x00, 0xa3, 0x39, 0xe4, 0x3b, 0xf1, + 0x3e, 0xf4, 0x2b, 0xa2, 0x29, 0x2f, 0xd8, 0xbc, 0x0b, 0x0b, 0xe0, 0xcd, 0xb9, 0x6d, 0xfd, 0xef, + 0xdc, 0x8e, 0xff, 0x08, 0x60, 0xef, 0x07, 0x1f, 0x80, 0xae, 0xa0, 0xe7, 0x0e, 0x09, 0xad, 0xbd, + 0xd2, 0xe5, 0x7f, 0xca, 0xe4, 0xc1, 0x06, 0x96, 0x2f, 0xec, 0x0a, 0x7a, 0x6e, 0xe6, 0xeb, 0x55, + 0x97, 0xd7, 0x6d, 0xbd, 0xea, 0xca, 0xe2, 0x1c, 0xff, 0x19, 0xc0, 0xb0, 0x4b, 0xfc, 0x27, 0x21, + 0xed, 0x99, 0xbd, 0x9d, 0xf4, 0x7f, 0x81, 0x5d, 0x3f, 0x2a, 0xf4, 0xe9, 0xba, 0x88, 0xd5, 0xf1, + 0x4e, 0x1e, 0x6e, 0xe4, 0xb5, 0xda, 0x27, 0x29, 0x7c, 0x50, 0x88, 0xfa, 0x15, 0xf6, 0xb4, 0x62, + 0x45, 0x5a, 0x88, 0xba, 0x16, 0xfc, 0x24, 0xea, 0x4a, 0xbc, 0x74, 0xfb, 0xbd, 0xe3, 0xd6, 0xfc, + 0xcb, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xfc, 0xdc, 0x27, 0x48, 0x08, 0x00, 0x00, +} diff --git a/vendor/cloud.google.com/go/pubsub/message.go b/vendor/cloud.google.com/go/pubsub/message.go new file mode 100644 index 000000000..c4b16e95f --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/message.go @@ -0,0 +1,100 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pubsub + +import ( + "time" + + "github.com/golang/protobuf/ptypes" + pb "google.golang.org/genproto/googleapis/pubsub/v1" +) + +// Message represents a Pub/Sub message. +type Message struct { + // ID identifies this message. + // This ID is assigned by the server and is populated for Messages obtained from a subscription. + // This field is read-only. + ID string + + // Data is the actual data in the message. + Data []byte + + // Attributes represents the key-value pairs the current message + // is labelled with. + Attributes map[string]string + + // ackID is the identifier to acknowledge this message. + ackID string + + // The time at which the message was published. + // This is populated by the server for Messages obtained from a subscription. + // This field is read-only. + PublishTime time.Time + + // receiveTime is the time the message was received by the client. + receiveTime time.Time + + // size is the approximate size of the message's data and attributes. + size int + + calledDone bool + + // The done method of the iterator that created this Message. + doneFunc func(string, bool, time.Time) +} + +func toMessage(resp *pb.ReceivedMessage) (*Message, error) { + if resp.Message == nil { + return &Message{ackID: resp.AckId}, nil + } + + pubTime, err := ptypes.Timestamp(resp.Message.PublishTime) + if err != nil { + return nil, err + } + return &Message{ + ackID: resp.AckId, + Data: resp.Message.Data, + Attributes: resp.Message.Attributes, + ID: resp.Message.MessageId, + PublishTime: pubTime, + }, nil +} + +// Ack indicates successful processing of a Message passed to the Subscriber.Receive callback. +// It should not be called on any other Message value. +// If message acknowledgement fails, the Message will be redelivered. +// Client code must call Ack or Nack when finished for each received Message. +// Calls to Ack or Nack have no effect after the first call. +func (m *Message) Ack() { + m.done(true) +} + +// Nack indicates that the client will not or cannot process a Message passed to the Subscriber.Receive callback. +// It should not be called on any other Message value. +// Nack will result in the Message being redelivered more quickly than if it were allowed to expire. +// Client code must call Ack or Nack when finished for each received Message. +// Calls to Ack or Nack have no effect after the first call. +func (m *Message) Nack() { + m.done(false) +} + +func (m *Message) done(ack bool) { + if m.calledDone { + return + } + m.calledDone = true + m.doneFunc(m.ackID, ack, m.receiveTime) +} diff --git a/vendor/cloud.google.com/go/pubsub/mock_test.go b/vendor/cloud.google.com/go/pubsub/mock_test.go new file mode 100644 index 000000000..52da17407 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/mock_test.go @@ -0,0 +1,200 @@ +// Copyright 2017 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 pubsub + +// This file provides a mock in-memory pubsub server for streaming pull testing. + +import ( + "context" + "io" + "sync" + "time" + + "cloud.google.com/go/internal/testutil" + emptypb "github.com/golang/protobuf/ptypes/empty" + pb "google.golang.org/genproto/googleapis/pubsub/v1" +) + +type mockServer struct { + srv *testutil.Server + + pb.SubscriberServer + + Addr string + + mu sync.Mutex + Acked map[string]bool // acked message IDs + Deadlines map[string]int32 // deadlines by message ID + pullResponses []*pullResponse + ackErrs []error + modAckErrs []error + wg sync.WaitGroup + sub *pb.Subscription +} + +type pullResponse struct { + msgs []*pb.ReceivedMessage + err error +} + +func newMockServer(port int) (*mockServer, error) { + srv, err := testutil.NewServerWithPort(port) + if err != nil { + return nil, err + } + mock := &mockServer{ + srv: srv, + Addr: srv.Addr, + Acked: map[string]bool{}, + Deadlines: map[string]int32{}, + sub: &pb.Subscription{ + AckDeadlineSeconds: 10, + PushConfig: &pb.PushConfig{}, + }, + } + pb.RegisterSubscriberServer(srv.Gsrv, mock) + srv.Start() + return mock, nil +} + +// Each call to addStreamingPullMessages results in one StreamingPullResponse. +func (s *mockServer) addStreamingPullMessages(msgs []*pb.ReceivedMessage) { + s.mu.Lock() + s.pullResponses = append(s.pullResponses, &pullResponse{msgs, nil}) + s.mu.Unlock() +} + +func (s *mockServer) addStreamingPullError(err error) { + s.mu.Lock() + s.pullResponses = append(s.pullResponses, &pullResponse{nil, err}) + s.mu.Unlock() +} + +func (s *mockServer) addAckResponse(err error) { + s.mu.Lock() + s.ackErrs = append(s.ackErrs, err) + s.mu.Unlock() +} + +func (s *mockServer) addModAckResponse(err error) { + s.mu.Lock() + s.modAckErrs = append(s.modAckErrs, err) + s.mu.Unlock() +} + +func (s *mockServer) wait() { + s.wg.Wait() +} + +func (s *mockServer) StreamingPull(stream pb.Subscriber_StreamingPullServer) error { + s.wg.Add(1) + defer s.wg.Done() + errc := make(chan error, 1) + s.wg.Add(1) + go func() { + defer s.wg.Done() + for { + req, err := stream.Recv() + if err != nil { + errc <- err + return + } + s.mu.Lock() + for _, id := range req.AckIds { + s.Acked[id] = true + } + for i, id := range req.ModifyDeadlineAckIds { + s.Deadlines[id] = req.ModifyDeadlineSeconds[i] + } + s.mu.Unlock() + } + }() + // Send responses. + for { + s.mu.Lock() + if len(s.pullResponses) == 0 { + s.mu.Unlock() + // Nothing to send, so wait for the client to shut down the stream. + err := <-errc // a real error, or at least EOF + if err == io.EOF { + return nil + } + return err + } + pr := s.pullResponses[0] + s.pullResponses = s.pullResponses[1:] + s.mu.Unlock() + if pr.err != nil { + // Add a slight delay to ensure the server receives any + // messages en route from the client before shutting down the stream. + // This reduces flakiness of tests involving retry. + time.Sleep(200 * time.Millisecond) + } + if pr.err == io.EOF { + return nil + } + if pr.err != nil { + return pr.err + } + // Return any error from Recv. + select { + case err := <-errc: + return err + default: + } + res := &pb.StreamingPullResponse{ReceivedMessages: pr.msgs} + if err := stream.Send(res); err != nil { + return err + } + } +} + +func (s *mockServer) Acknowledge(ctx context.Context, req *pb.AcknowledgeRequest) (*emptypb.Empty, error) { + var err error + s.mu.Lock() + if len(s.ackErrs) > 0 { + err = s.ackErrs[0] + s.ackErrs = s.ackErrs[1:] + } + s.mu.Unlock() + if err != nil { + return nil, err + } + for _, id := range req.AckIds { + s.Acked[id] = true + } + return &emptypb.Empty{}, nil +} + +func (s *mockServer) ModifyAckDeadline(ctx context.Context, req *pb.ModifyAckDeadlineRequest) (*emptypb.Empty, error) { + var err error + s.mu.Lock() + if len(s.modAckErrs) > 0 { + err = s.modAckErrs[0] + s.modAckErrs = s.modAckErrs[1:] + } + s.mu.Unlock() + if err != nil { + return nil, err + } + for _, id := range req.AckIds { + s.Deadlines[id] = req.AckDeadlineSeconds + } + return &emptypb.Empty{}, nil +} + +func (s *mockServer) GetSubscription(ctx context.Context, req *pb.GetSubscriptionRequest) (*pb.Subscription, error) { + return s.sub, nil +} diff --git a/vendor/cloud.google.com/go/pubsub/nodebug.go b/vendor/cloud.google.com/go/pubsub/nodebug.go new file mode 100644 index 000000000..774a74a58 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/nodebug.go @@ -0,0 +1,25 @@ +// 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. + +// +build !psdebug + +package pubsub + +import "time" + +func addRecv(string, string, time.Time) {} + +func addAcks([]string) {} + +func addModAcks([]string, int32) {} diff --git a/vendor/cloud.google.com/go/pubsub/pstest/examples_test.go b/vendor/cloud.google.com/go/pubsub/pstest/examples_test.go new file mode 100644 index 000000000..56a30c124 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/pstest/examples_test.go @@ -0,0 +1,44 @@ +// 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. + +package pstest_test + +import ( + "context" + + "cloud.google.com/go/pubsub" + "cloud.google.com/go/pubsub/pstest" + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +func ExampleNewServer() { + ctx := context.Background() + // Start a fake server running locally. + srv := pstest.NewServer() + defer srv.Close() + // Connect to the server without using TLS. + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure()) + if err != nil { + // TODO: Handle error. + } + defer conn.Close() + // Use the connection when creating a pubsub client. + client, err := pubsub.NewClient(ctx, "project", option.WithGRPCConn(conn)) + if err != nil { + // TODO: Handle error. + } + defer client.Close() + _ = client // TODO: Use the client. +} diff --git a/vendor/cloud.google.com/go/pubsub/pstest/fake.go b/vendor/cloud.google.com/go/pubsub/pstest/fake.go new file mode 100644 index 000000000..448c4c932 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/pstest/fake.go @@ -0,0 +1,996 @@ +// Copyright 2017 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 pstest provides a fake Cloud PubSub service for testing. It implements a +// simplified form of the service, suitable for unit tests. It may behave +// differently from the actual service in ways in which the service is +// non-deterministic or unspecified: timing, delivery order, etc. +// +// This package is EXPERIMENTAL and is subject to change without notice. +// +// See the example for usage. +package pstest + +import ( + "context" + "fmt" + "io" + "path" + "sort" + "strings" + "sync" + "sync/atomic" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/ptypes" + durpb "github.com/golang/protobuf/ptypes/duration" + emptypb "github.com/golang/protobuf/ptypes/empty" + pb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// For testing. Note that even though changes to the now variable are atomic, a call +// to the stored function can race with a change to that function. This could be a +// problem if tests are run in parallel, or even if concurrent parts of the same test +// change the value of the variable. +var now atomic.Value + +func init() { + now.Store(time.Now) + ResetMinAckDeadline() +} + +func timeNow() time.Time { + return now.Load().(func() time.Time)() +} + +// Server is a fake Pub/Sub server. +type Server struct { + srv *testutil.Server + Addr string // The address that the server is listening on. + gServer gServer +} + +type gServer struct { + pb.PublisherServer + pb.SubscriberServer + + mu sync.Mutex + topics map[string]*topic + subs map[string]*subscription + msgs []*Message // all messages ever published + msgsByID map[string]*Message + wg sync.WaitGroup + nextID int + streamTimeout time.Duration +} + +// NewServer creates a new fake server running in the current process. +func NewServer() *Server { + srv, err := testutil.NewServer() + if err != nil { + panic(fmt.Sprintf("pstest.NewServer: %v", err)) + } + s := &Server{ + srv: srv, + Addr: srv.Addr, + gServer: gServer{ + topics: map[string]*topic{}, + subs: map[string]*subscription{}, + msgsByID: map[string]*Message{}, + }, + } + pb.RegisterPublisherServer(srv.Gsrv, &s.gServer) + pb.RegisterSubscriberServer(srv.Gsrv, &s.gServer) + srv.Start() + return s +} + +// Publish behaves as if the Publish RPC was called with a message with the given +// data and attrs. It returns the ID of the message. +// The topic will be created if it doesn't exist. +// +// Publish panics if there is an error, which is appropriate for testing. +func (s *Server) Publish(topic string, data []byte, attrs map[string]string) string { + const topicPattern = "projects/*/topics/*" + ok, err := path.Match(topicPattern, topic) + if err != nil { + panic(err) + } + if !ok { + panic(fmt.Sprintf("topic name must be of the form %q", topicPattern)) + } + _, _ = s.gServer.CreateTopic(context.TODO(), &pb.Topic{Name: topic}) + req := &pb.PublishRequest{ + Topic: topic, + Messages: []*pb.PubsubMessage{{Data: data, Attributes: attrs}}, + } + res, err := s.gServer.Publish(context.TODO(), req) + if err != nil { + panic(fmt.Sprintf("pstest.Server.Publish: %v", err)) + } + return res.MessageIds[0] +} + +// SetStreamTimeout sets the amount of time a stream will be active before it shuts +// itself down. This mimics the real service's behavior of closing streams after 30 +// minutes. If SetStreamTimeout is never called or is passed zero, streams never shut +// down. +func (s *Server) SetStreamTimeout(d time.Duration) { + s.gServer.mu.Lock() + defer s.gServer.mu.Unlock() + s.gServer.streamTimeout = d +} + +// A Message is a message that was published to the server. +type Message struct { + ID string + Data []byte + Attributes map[string]string + PublishTime time.Time + Deliveries int // number of times delivery of the message was attempted + Acks int // number of acks received from clients + + // protected by server mutex + deliveries int + acks int + Modacks []Modack // modacks received by server for this message + +} + +// Modack represents a modack sent to the server. +type Modack struct { + AckID string + AckDeadline int32 + ReceivedAt time.Time +} + +// Messages returns information about all messages ever published. +func (s *Server) Messages() []*Message { + s.gServer.mu.Lock() + defer s.gServer.mu.Unlock() + + var msgs []*Message + for _, m := range s.gServer.msgs { + m.Deliveries = m.deliveries + m.Acks = m.acks + msgs = append(msgs, m) + } + return msgs +} + +// Message returns the message with the given ID, or nil if no message +// with that ID was published. +func (s *Server) Message(id string) *Message { + s.gServer.mu.Lock() + defer s.gServer.mu.Unlock() + + m := s.gServer.msgsByID[id] + if m != nil { + m.Deliveries = m.deliveries + m.Acks = m.acks + } + return m +} + +// Wait blocks until all server activity has completed. +func (s *Server) Wait() { + s.gServer.wg.Wait() +} + +// Close shuts down the server and releases all resources. +func (s *Server) Close() error { + s.srv.Close() + s.gServer.mu.Lock() + defer s.gServer.mu.Unlock() + for _, sub := range s.gServer.subs { + sub.stop() + } + return nil +} + +func (s *gServer) CreateTopic(_ context.Context, t *pb.Topic) (*pb.Topic, error) { + s.mu.Lock() + defer s.mu.Unlock() + + if s.topics[t.Name] != nil { + return nil, status.Errorf(codes.AlreadyExists, "topic %q", t.Name) + } + top := newTopic(t) + s.topics[t.Name] = top + return top.proto, nil +} + +func (s *gServer) GetTopic(_ context.Context, req *pb.GetTopicRequest) (*pb.Topic, error) { + s.mu.Lock() + defer s.mu.Unlock() + + if t := s.topics[req.Topic]; t != nil { + return t.proto, nil + } + return nil, status.Errorf(codes.NotFound, "topic %q", req.Topic) +} + +func (s *gServer) UpdateTopic(_ context.Context, req *pb.UpdateTopicRequest) (*pb.Topic, error) { + s.mu.Lock() + defer s.mu.Unlock() + + t := s.topics[req.Topic.Name] + if t == nil { + return nil, status.Errorf(codes.NotFound, "topic %q", req.Topic.Name) + } + for _, path := range req.UpdateMask.Paths { + switch path { + case "labels": + t.proto.Labels = req.Topic.Labels + case "message_storage_policy": // "fetch" the policy + t.proto.MessageStoragePolicy = &pb.MessageStoragePolicy{AllowedPersistenceRegions: []string{"US"}} + default: + return nil, status.Errorf(codes.InvalidArgument, "unknown field name %q", path) + } + } + return t.proto, nil +} + +func (s *gServer) ListTopics(_ context.Context, req *pb.ListTopicsRequest) (*pb.ListTopicsResponse, error) { + s.mu.Lock() + defer s.mu.Unlock() + + var names []string + for n := range s.topics { + if strings.HasPrefix(n, req.Project) { + names = append(names, n) + } + } + sort.Strings(names) + from, to, nextToken, err := testutil.PageBounds(int(req.PageSize), req.PageToken, len(names)) + if err != nil { + return nil, err + } + res := &pb.ListTopicsResponse{NextPageToken: nextToken} + for i := from; i < to; i++ { + res.Topics = append(res.Topics, s.topics[names[i]].proto) + } + return res, nil +} + +func (s *gServer) ListTopicSubscriptions(_ context.Context, req *pb.ListTopicSubscriptionsRequest) (*pb.ListTopicSubscriptionsResponse, error) { + s.mu.Lock() + defer s.mu.Unlock() + + var names []string + for name, sub := range s.subs { + if sub.topic.proto.Name == req.Topic { + names = append(names, name) + } + } + sort.Strings(names) + from, to, nextToken, err := testutil.PageBounds(int(req.PageSize), req.PageToken, len(names)) + if err != nil { + return nil, err + } + return &pb.ListTopicSubscriptionsResponse{ + Subscriptions: names[from:to], + NextPageToken: nextToken, + }, nil +} + +func (s *gServer) DeleteTopic(_ context.Context, req *pb.DeleteTopicRequest) (*emptypb.Empty, error) { + s.mu.Lock() + defer s.mu.Unlock() + + t := s.topics[req.Topic] + if t == nil { + return nil, status.Errorf(codes.NotFound, "topic %q", req.Topic) + } + t.stop() + delete(s.topics, req.Topic) + return &emptypb.Empty{}, nil +} + +func (s *gServer) CreateSubscription(_ context.Context, ps *pb.Subscription) (*pb.Subscription, error) { + s.mu.Lock() + defer s.mu.Unlock() + + if ps.Name == "" { + return nil, status.Errorf(codes.InvalidArgument, "missing name") + } + if s.subs[ps.Name] != nil { + return nil, status.Errorf(codes.AlreadyExists, "subscription %q", ps.Name) + } + if ps.Topic == "" { + return nil, status.Errorf(codes.InvalidArgument, "missing topic") + } + top := s.topics[ps.Topic] + if top == nil { + return nil, status.Errorf(codes.NotFound, "topic %q", ps.Topic) + } + if err := checkAckDeadline(ps.AckDeadlineSeconds); err != nil { + return nil, err + } + if ps.MessageRetentionDuration == nil { + ps.MessageRetentionDuration = defaultMessageRetentionDuration + } + if err := checkMRD(ps.MessageRetentionDuration); err != nil { + return nil, err + } + if ps.PushConfig == nil { + ps.PushConfig = &pb.PushConfig{} + } + + sub := newSubscription(top, &s.mu, ps) + top.subs[ps.Name] = sub + s.subs[ps.Name] = sub + sub.start(&s.wg) + return ps, nil +} + +// Can be set for testing. +var minAckDeadlineSecs int32 + +// SetMinAckDeadline changes the minack deadline to n. Must be +// greater than or equal to 1 second. Remember to reset this value +// to the default after your test changes it. Example usage: +// pstest.SetMinAckDeadlineSecs(1) +// defer pstest.ResetMinAckDeadlineSecs() +func SetMinAckDeadline(n time.Duration) { + if n < time.Second { + panic("SetMinAckDeadline expects a value greater than 1 second") + } + + minAckDeadlineSecs = int32(n / time.Second) +} + +// ResetMinAckDeadline resets the minack deadline to the default. +func ResetMinAckDeadline() { + minAckDeadlineSecs = 10 +} + +func checkAckDeadline(ads int32) error { + if ads < minAckDeadlineSecs || ads > 600 { + // PubSub service returns Unknown. + return status.Errorf(codes.Unknown, "bad ack_deadline_seconds: %d", ads) + } + return nil +} + +const ( + minMessageRetentionDuration = 10 * time.Minute + maxMessageRetentionDuration = 168 * time.Hour +) + +var defaultMessageRetentionDuration = ptypes.DurationProto(maxMessageRetentionDuration) + +func checkMRD(pmrd *durpb.Duration) error { + mrd, err := ptypes.Duration(pmrd) + if err != nil || mrd < minMessageRetentionDuration || mrd > maxMessageRetentionDuration { + return status.Errorf(codes.InvalidArgument, "bad message_retention_duration %+v", pmrd) + } + return nil +} + +func (s *gServer) GetSubscription(_ context.Context, req *pb.GetSubscriptionRequest) (*pb.Subscription, error) { + s.mu.Lock() + defer s.mu.Unlock() + sub, err := s.findSubscription(req.Subscription) + if err != nil { + return nil, err + } + return sub.proto, nil +} + +func (s *gServer) UpdateSubscription(_ context.Context, req *pb.UpdateSubscriptionRequest) (*pb.Subscription, error) { + if req.Subscription == nil { + return nil, status.Errorf(codes.InvalidArgument, "missing subscription") + } + s.mu.Lock() + defer s.mu.Unlock() + sub, err := s.findSubscription(req.Subscription.Name) + if err != nil { + return nil, err + } + for _, path := range req.UpdateMask.Paths { + switch path { + case "push_config": + sub.proto.PushConfig = req.Subscription.PushConfig + + case "ack_deadline_seconds": + a := req.Subscription.AckDeadlineSeconds + if err := checkAckDeadline(a); err != nil { + return nil, err + } + sub.proto.AckDeadlineSeconds = a + + case "retain_acked_messages": + sub.proto.RetainAckedMessages = req.Subscription.RetainAckedMessages + + case "message_retention_duration": + if err := checkMRD(req.Subscription.MessageRetentionDuration); err != nil { + return nil, err + } + sub.proto.MessageRetentionDuration = req.Subscription.MessageRetentionDuration + + case "labels": + sub.proto.Labels = req.Subscription.Labels + + default: + return nil, status.Errorf(codes.InvalidArgument, "unknown field name %q", path) + } + } + return sub.proto, nil +} + +func (s *gServer) ListSubscriptions(_ context.Context, req *pb.ListSubscriptionsRequest) (*pb.ListSubscriptionsResponse, error) { + s.mu.Lock() + defer s.mu.Unlock() + + var names []string + for name := range s.subs { + if strings.HasPrefix(name, req.Project) { + names = append(names, name) + } + } + sort.Strings(names) + from, to, nextToken, err := testutil.PageBounds(int(req.PageSize), req.PageToken, len(names)) + if err != nil { + return nil, err + } + res := &pb.ListSubscriptionsResponse{NextPageToken: nextToken} + for i := from; i < to; i++ { + res.Subscriptions = append(res.Subscriptions, s.subs[names[i]].proto) + } + return res, nil +} + +func (s *gServer) DeleteSubscription(_ context.Context, req *pb.DeleteSubscriptionRequest) (*emptypb.Empty, error) { + s.mu.Lock() + defer s.mu.Unlock() + sub, err := s.findSubscription(req.Subscription) + if err != nil { + return nil, err + } + sub.stop() + delete(s.subs, req.Subscription) + sub.topic.deleteSub(sub) + return &emptypb.Empty{}, nil +} + +func (s *gServer) Publish(_ context.Context, req *pb.PublishRequest) (*pb.PublishResponse, error) { + s.mu.Lock() + defer s.mu.Unlock() + + if req.Topic == "" { + return nil, status.Errorf(codes.InvalidArgument, "missing topic") + } + top := s.topics[req.Topic] + if top == nil { + return nil, status.Errorf(codes.NotFound, "topic %q", req.Topic) + } + var ids []string + for _, pm := range req.Messages { + id := fmt.Sprintf("m%d", s.nextID) + s.nextID++ + pm.MessageId = id + pubTime := timeNow() + tsPubTime, err := ptypes.TimestampProto(pubTime) + if err != nil { + return nil, status.Errorf(codes.Internal, err.Error()) + } + pm.PublishTime = tsPubTime + m := &Message{ + ID: id, + Data: pm.Data, + Attributes: pm.Attributes, + PublishTime: pubTime, + } + top.publish(pm, m) + ids = append(ids, id) + s.msgs = append(s.msgs, m) + s.msgsByID[id] = m + } + return &pb.PublishResponse{MessageIds: ids}, nil +} + +type topic struct { + proto *pb.Topic + subs map[string]*subscription +} + +func newTopic(pt *pb.Topic) *topic { + return &topic{ + proto: pt, + subs: map[string]*subscription{}, + } +} + +func (t *topic) stop() { + for _, sub := range t.subs { + sub.proto.Topic = "_deleted-topic_" + sub.stop() + } +} + +func (t *topic) deleteSub(sub *subscription) { + delete(t.subs, sub.proto.Name) +} + +func (t *topic) publish(pm *pb.PubsubMessage, m *Message) { + for _, s := range t.subs { + s.msgs[pm.MessageId] = &message{ + publishTime: m.PublishTime, + proto: &pb.ReceivedMessage{ + AckId: pm.MessageId, + Message: pm, + }, + deliveries: &m.deliveries, + acks: &m.acks, + streamIndex: -1, + } + } +} + +type subscription struct { + topic *topic + mu *sync.Mutex // the server mutex, here for convenience + proto *pb.Subscription + ackTimeout time.Duration + msgs map[string]*message // unacked messages by message ID + streams []*stream + done chan struct{} +} + +func newSubscription(t *topic, mu *sync.Mutex, ps *pb.Subscription) *subscription { + at := time.Duration(ps.AckDeadlineSeconds) * time.Second + if at == 0 { + at = 10 * time.Second + } + return &subscription{ + topic: t, + mu: mu, + proto: ps, + ackTimeout: at, + msgs: map[string]*message{}, + done: make(chan struct{}), + } +} + +func (s *subscription) start(wg *sync.WaitGroup) { + wg.Add(1) + go func() { + defer wg.Done() + for { + select { + case <-s.done: + return + case <-time.After(10 * time.Millisecond): + s.deliver() + } + } + }() +} + +func (s *subscription) stop() { + close(s.done) +} + +func (s *gServer) Acknowledge(_ context.Context, req *pb.AcknowledgeRequest) (*emptypb.Empty, error) { + s.mu.Lock() + defer s.mu.Unlock() + + sub, err := s.findSubscription(req.Subscription) + if err != nil { + return nil, err + } + for _, id := range req.AckIds { + sub.ack(id) + } + return &emptypb.Empty{}, nil +} + +func (s *gServer) ModifyAckDeadline(_ context.Context, req *pb.ModifyAckDeadlineRequest) (*emptypb.Empty, error) { + s.mu.Lock() + defer s.mu.Unlock() + sub, err := s.findSubscription(req.Subscription) + if err != nil { + return nil, err + } + now := time.Now() + for _, id := range req.AckIds { + s.msgsByID[id].Modacks = append(s.msgsByID[id].Modacks, Modack{AckID: id, AckDeadline: req.AckDeadlineSeconds, ReceivedAt: now}) + } + dur := secsToDur(req.AckDeadlineSeconds) + for _, id := range req.AckIds { + sub.modifyAckDeadline(id, dur) + } + return &emptypb.Empty{}, nil +} + +func (s *gServer) Pull(ctx context.Context, req *pb.PullRequest) (*pb.PullResponse, error) { + s.mu.Lock() + sub, err := s.findSubscription(req.Subscription) + if err != nil { + s.mu.Unlock() + return nil, err + } + max := int(req.MaxMessages) + if max < 0 { + s.mu.Unlock() + return nil, status.Error(codes.InvalidArgument, "MaxMessages cannot be negative") + } + if max == 0 { // MaxMessages not specified; use a default. + max = 1000 + } + msgs := sub.pull(max) + s.mu.Unlock() + // Implement the spec from the pubsub proto: + // "If ReturnImmediately set to true, the system will respond immediately even if + // it there are no messages available to return in the `Pull` response. + // Otherwise, the system may wait (for a bounded amount of time) until at + // least one message is available, rather than returning no messages." + if len(msgs) == 0 && !req.ReturnImmediately { + // Wait for a short amount of time for a message. + // TODO: signal when a message arrives, so we don't wait the whole time. + select { + case <-ctx.Done(): + return nil, ctx.Err() + case <-time.After(500 * time.Millisecond): + s.mu.Lock() + msgs = sub.pull(max) + s.mu.Unlock() + } + } + return &pb.PullResponse{ReceivedMessages: msgs}, nil +} + +func (s *gServer) StreamingPull(sps pb.Subscriber_StreamingPullServer) error { + // Receive initial message configuring the pull. + req, err := sps.Recv() + if err != nil { + return err + } + s.mu.Lock() + sub, err := s.findSubscription(req.Subscription) + s.mu.Unlock() + if err != nil { + return err + } + // Create a new stream to handle the pull. + st := sub.newStream(sps, s.streamTimeout) + err = st.pull(&s.wg) + sub.deleteStream(st) + return err +} + +func (s *gServer) Seek(ctx context.Context, req *pb.SeekRequest) (*pb.SeekResponse, error) { + // Only handle time-based seeking for now. + // This fake doesn't deal with snapshots. + var target time.Time + switch v := req.Target.(type) { + case nil: + return nil, status.Errorf(codes.InvalidArgument, "missing Seek target type") + case *pb.SeekRequest_Time: + var err error + target, err = ptypes.Timestamp(v.Time) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "bad Time target: %v", err) + } + default: + return nil, status.Errorf(codes.Unimplemented, "unhandled Seek target type %T", v) + } + + // The entire server must be locked while doing the work below, + // because the messages don't have any other synchronization. + s.mu.Lock() + defer s.mu.Unlock() + sub, err := s.findSubscription(req.Subscription) + if err != nil { + return nil, err + } + // Drop all messages from sub that were published before the target time. + for id, m := range sub.msgs { + if m.publishTime.Before(target) { + delete(sub.msgs, id) + (*m.acks)++ + } + } + // Un-ack any already-acked messages after this time; + // redelivering them to the subscription is the closest analogue here. + for _, m := range s.msgs { + if m.PublishTime.Before(target) { + continue + } + sub.msgs[m.ID] = &message{ + publishTime: m.PublishTime, + proto: &pb.ReceivedMessage{ + AckId: m.ID, + // This was not preserved! + //Message: pm, + }, + deliveries: &m.deliveries, + acks: &m.acks, + streamIndex: -1, + } + } + return &pb.SeekResponse{}, nil +} + +// Gets a subscription that must exist. +// Must be called with the lock held. +func (s *gServer) findSubscription(name string) (*subscription, error) { + if name == "" { + return nil, status.Errorf(codes.InvalidArgument, "missing subscription") + } + sub := s.subs[name] + if sub == nil { + return nil, status.Errorf(codes.NotFound, "subscription %s", name) + } + return sub, nil +} + +// Must be called with the lock held. +func (s *subscription) pull(max int) []*pb.ReceivedMessage { + now := timeNow() + s.maintainMessages(now) + var msgs []*pb.ReceivedMessage + for _, m := range s.msgs { + if m.outstanding() { + continue + } + (*m.deliveries)++ + m.ackDeadline = now.Add(s.ackTimeout) + msgs = append(msgs, m.proto) + if len(msgs) >= max { + break + } + } + return msgs +} + +func (s *subscription) deliver() { + s.mu.Lock() + defer s.mu.Unlock() + + now := timeNow() + s.maintainMessages(now) + // Try to deliver each remaining message. + curIndex := 0 + for _, m := range s.msgs { + if m.outstanding() { + continue + } + // If the message was never delivered before, start with the stream at + // curIndex. If it was delivered before, start with the stream after the one + // that owned it. + if m.streamIndex < 0 { + delIndex, ok := s.tryDeliverMessage(m, curIndex, now) + if !ok { + break + } + curIndex = delIndex + 1 + m.streamIndex = curIndex + } else { + delIndex, ok := s.tryDeliverMessage(m, m.streamIndex, now) + if !ok { + break + } + m.streamIndex = delIndex + } + } +} + +// tryDeliverMessage attempts to deliver m to the stream at index i. If it can't, it +// tries streams i+1, i+2, ..., wrapping around. Once it's tried all streams, it +// exits. +// +// It returns the index of the stream it delivered the message to, or 0, false if +// it didn't deliver the message. +// +// Must be called with the lock held. +func (s *subscription) tryDeliverMessage(m *message, start int, now time.Time) (int, bool) { + for i := 0; i < len(s.streams); i++ { + idx := (i + start) % len(s.streams) + + st := s.streams[idx] + select { + case <-st.done: + s.streams = deleteStreamAt(s.streams, idx) + i-- + + case st.msgc <- m.proto: + (*m.deliveries)++ + m.ackDeadline = now.Add(st.ackTimeout) + return idx, true + + default: + } + } + return 0, false +} + +var retentionDuration = 10 * time.Minute + +// Must be called with the lock held. +func (s *subscription) maintainMessages(now time.Time) { + for id, m := range s.msgs { + // Mark a message as re-deliverable if its ack deadline has expired. + if m.outstanding() && now.After(m.ackDeadline) { + m.makeAvailable() + } + pubTime, err := ptypes.Timestamp(m.proto.Message.PublishTime) + if err != nil { + panic(err) + } + // Remove messages that have been undelivered for a long time. + if !m.outstanding() && now.Sub(pubTime) > retentionDuration { + delete(s.msgs, id) + } + } +} + +func (s *subscription) newStream(gs pb.Subscriber_StreamingPullServer, timeout time.Duration) *stream { + st := &stream{ + sub: s, + done: make(chan struct{}), + msgc: make(chan *pb.ReceivedMessage), + gstream: gs, + ackTimeout: s.ackTimeout, + timeout: timeout, + } + s.mu.Lock() + s.streams = append(s.streams, st) + s.mu.Unlock() + return st +} + +func (s *subscription) deleteStream(st *stream) { + s.mu.Lock() + defer s.mu.Unlock() + var i int + for i = 0; i < len(s.streams); i++ { + if s.streams[i] == st { + break + } + } + if i < len(s.streams) { + s.streams = deleteStreamAt(s.streams, i) + } +} +func deleteStreamAt(s []*stream, i int) []*stream { + // Preserve order for round-robin delivery. + return append(s[:i], s[i+1:]...) +} + +type message struct { + proto *pb.ReceivedMessage + publishTime time.Time + ackDeadline time.Time + deliveries *int + acks *int + streamIndex int // index of stream that currently owns msg, for round-robin delivery +} + +// A message is outstanding if it is owned by some stream. +func (m *message) outstanding() bool { + return !m.ackDeadline.IsZero() +} + +func (m *message) makeAvailable() { + m.ackDeadline = time.Time{} +} + +type stream struct { + sub *subscription + done chan struct{} // closed when the stream is finished + msgc chan *pb.ReceivedMessage + gstream pb.Subscriber_StreamingPullServer + ackTimeout time.Duration + timeout time.Duration +} + +// pull manages the StreamingPull interaction for the life of the stream. +func (st *stream) pull(wg *sync.WaitGroup) error { + errc := make(chan error, 2) + wg.Add(2) + go func() { + defer wg.Done() + errc <- st.sendLoop() + }() + go func() { + defer wg.Done() + errc <- st.recvLoop() + }() + var tchan <-chan time.Time + if st.timeout > 0 { + tchan = time.After(st.timeout) + } + // Wait until one of the goroutines returns an error, or we time out. + var err error + select { + case err = <-errc: + if err == io.EOF { + err = nil + } + case <-tchan: + } + close(st.done) // stop the other goroutine + return err +} + +func (st *stream) sendLoop() error { + for { + select { + case <-st.done: + return nil + case rm := <-st.msgc: + res := &pb.StreamingPullResponse{ReceivedMessages: []*pb.ReceivedMessage{rm}} + if err := st.gstream.Send(res); err != nil { + return err + } + } + } +} + +func (st *stream) recvLoop() error { + for { + req, err := st.gstream.Recv() + if err != nil { + return err + } + st.sub.handleStreamingPullRequest(st, req) + } +} + +func (s *subscription) handleStreamingPullRequest(st *stream, req *pb.StreamingPullRequest) { + // Lock the entire server. + s.mu.Lock() + defer s.mu.Unlock() + + for _, ackID := range req.AckIds { + s.ack(ackID) + } + for i, id := range req.ModifyDeadlineAckIds { + s.modifyAckDeadline(id, secsToDur(req.ModifyDeadlineSeconds[i])) + } + if req.StreamAckDeadlineSeconds > 0 { + st.ackTimeout = secsToDur(req.StreamAckDeadlineSeconds) + } +} + +// Must be called with the lock held. +func (s *subscription) ack(id string) { + m := s.msgs[id] + if m != nil { + (*m.acks)++ + delete(s.msgs, id) + } +} + +// Must be called with the lock held. +func (s *subscription) modifyAckDeadline(id string, d time.Duration) { + m := s.msgs[id] + if m == nil { // already acked: ignore. + return + } + if d == 0 { // nack + m.makeAvailable() + } else { // extend the deadline by d + m.ackDeadline = timeNow().Add(d) + } +} + +func secsToDur(secs int32) time.Duration { + return time.Duration(secs) * time.Second +} diff --git a/vendor/cloud.google.com/go/pubsub/pstest/fake_test.go b/vendor/cloud.google.com/go/pubsub/pstest/fake_test.go new file mode 100644 index 000000000..b1c99bca4 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/pstest/fake_test.go @@ -0,0 +1,715 @@ +// Copyright 2017 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 pstest + +import ( + "context" + "fmt" + "io" + "sync" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/golang/protobuf/ptypes" + pb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestTopics(t *testing.T) { + pclient, _, server, cleanup := newFake(context.TODO(), t) + defer cleanup() + + ctx := context.Background() + var topics []*pb.Topic + for i := 1; i < 3; i++ { + topics = append(topics, mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{ + Name: fmt.Sprintf("projects/P/topics/T%d", i), + Labels: map[string]string{"num": fmt.Sprintf("%d", i)}, + })) + } + if got, want := len(server.gServer.topics), len(topics); got != want { + t.Fatalf("got %d topics, want %d", got, want) + } + for _, top := range topics { + got, err := pclient.GetTopic(ctx, &pb.GetTopicRequest{Topic: top.Name}) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, top) { + t.Errorf("\ngot %+v\nwant %+v", got, top) + } + } + + res, err := pclient.ListTopics(ctx, &pb.ListTopicsRequest{Project: "projects/P"}) + if err != nil { + t.Fatal(err) + } + if got, want := res.Topics, topics; !testutil.Equal(got, want) { + t.Errorf("\ngot %+v\nwant %+v", got, want) + } + + for _, top := range topics { + if _, err := pclient.DeleteTopic(ctx, &pb.DeleteTopicRequest{Topic: top.Name}); err != nil { + t.Fatal(err) + } + } + if got, want := len(server.gServer.topics), 0; got != want { + t.Fatalf("got %d topics, want %d", got, want) + } +} + +func TestSubscriptions(t *testing.T) { + pclient, sclient, server, cleanup := newFake(context.TODO(), t) + defer cleanup() + + ctx := context.Background() + topic := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + var subs []*pb.Subscription + for i := 0; i < 3; i++ { + subs = append(subs, mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: fmt.Sprintf("projects/P/subscriptions/S%d", i), + Topic: topic.Name, + AckDeadlineSeconds: int32(10 * (i + 1)), + })) + } + + if got, want := len(server.gServer.subs), len(subs); got != want { + t.Fatalf("got %d subscriptions, want %d", got, want) + } + for _, s := range subs { + got, err := sclient.GetSubscription(ctx, &pb.GetSubscriptionRequest{Subscription: s.Name}) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, s) { + t.Errorf("\ngot %+v\nwant %+v", got, s) + } + } + + res, err := sclient.ListSubscriptions(ctx, &pb.ListSubscriptionsRequest{Project: "projects/P"}) + if err != nil { + t.Fatal(err) + } + if got, want := res.Subscriptions, subs; !testutil.Equal(got, want) { + t.Errorf("\ngot %+v\nwant %+v", got, want) + } + + res2, err := pclient.ListTopicSubscriptions(ctx, &pb.ListTopicSubscriptionsRequest{Topic: topic.Name}) + if err != nil { + t.Fatal(err) + } + if got, want := len(res2.Subscriptions), len(subs); got != want { + t.Fatalf("got %d subs, want %d", got, want) + } + for i, got := range res2.Subscriptions { + want := subs[i].Name + if !testutil.Equal(got, want) { + t.Errorf("\ngot %+v\nwant %+v", got, want) + } + } + + for _, s := range subs { + if _, err := sclient.DeleteSubscription(ctx, &pb.DeleteSubscriptionRequest{Subscription: s.Name}); err != nil { + t.Fatal(err) + } + } + if got, want := len(server.gServer.subs), 0; got != want { + t.Fatalf("got %d subscriptions, want %d", got, want) + } +} + +func TestSubscriptionErrors(t *testing.T) { + _, sclient, _, cleanup := newFake(context.TODO(), t) + defer cleanup() + + ctx := context.Background() + + checkCode := func(err error, want codes.Code) { + t.Helper() + if status.Code(err) != want { + t.Errorf("got %v, want code %s", err, want) + } + } + + _, err := sclient.GetSubscription(ctx, &pb.GetSubscriptionRequest{}) + checkCode(err, codes.InvalidArgument) + _, err = sclient.GetSubscription(ctx, &pb.GetSubscriptionRequest{Subscription: "s"}) + checkCode(err, codes.NotFound) + _, err = sclient.UpdateSubscription(ctx, &pb.UpdateSubscriptionRequest{}) + checkCode(err, codes.InvalidArgument) + _, err = sclient.UpdateSubscription(ctx, &pb.UpdateSubscriptionRequest{Subscription: &pb.Subscription{}}) + checkCode(err, codes.InvalidArgument) + _, err = sclient.UpdateSubscription(ctx, &pb.UpdateSubscriptionRequest{Subscription: &pb.Subscription{Name: "s"}}) + checkCode(err, codes.NotFound) + _, err = sclient.DeleteSubscription(ctx, &pb.DeleteSubscriptionRequest{}) + checkCode(err, codes.InvalidArgument) + _, err = sclient.DeleteSubscription(ctx, &pb.DeleteSubscriptionRequest{Subscription: "s"}) + checkCode(err, codes.NotFound) + _, err = sclient.Acknowledge(ctx, &pb.AcknowledgeRequest{}) + checkCode(err, codes.InvalidArgument) + _, err = sclient.Acknowledge(ctx, &pb.AcknowledgeRequest{Subscription: "s"}) + checkCode(err, codes.NotFound) + _, err = sclient.ModifyAckDeadline(ctx, &pb.ModifyAckDeadlineRequest{}) + checkCode(err, codes.InvalidArgument) + _, err = sclient.ModifyAckDeadline(ctx, &pb.ModifyAckDeadlineRequest{Subscription: "s"}) + checkCode(err, codes.NotFound) + _, err = sclient.Pull(ctx, &pb.PullRequest{}) + checkCode(err, codes.InvalidArgument) + _, err = sclient.Pull(ctx, &pb.PullRequest{Subscription: "s"}) + checkCode(err, codes.NotFound) + _, err = sclient.Seek(ctx, &pb.SeekRequest{}) + checkCode(err, codes.InvalidArgument) + srt := &pb.SeekRequest_Time{Time: ptypes.TimestampNow()} + _, err = sclient.Seek(ctx, &pb.SeekRequest{Target: srt}) + checkCode(err, codes.InvalidArgument) + _, err = sclient.Seek(ctx, &pb.SeekRequest{Target: srt, Subscription: "s"}) + checkCode(err, codes.NotFound) +} + +func TestPublish(t *testing.T) { + s := NewServer() + defer s.Close() + + var ids []string + for i := 0; i < 3; i++ { + ids = append(ids, s.Publish("projects/p/topics/t", []byte("hello"), nil)) + } + s.Wait() + ms := s.Messages() + if got, want := len(ms), len(ids); got != want { + t.Errorf("got %d messages, want %d", got, want) + } + for i, id := range ids { + if got, want := ms[i].ID, id; got != want { + t.Errorf("got %s, want %s", got, want) + } + } + + m := s.Message(ids[1]) + if m == nil { + t.Error("got nil, want a message") + } +} + +// Note: this sets the fake's "now" time, so it is sensitive to concurrent changes to "now". +func publish(t *testing.T, pclient pb.PublisherClient, topic *pb.Topic, messages []*pb.PubsubMessage) map[string]*pb.PubsubMessage { + pubTime := time.Now() + now.Store(func() time.Time { return pubTime }) + defer func() { now.Store(time.Now) }() + + res, err := pclient.Publish(context.Background(), &pb.PublishRequest{ + Topic: topic.Name, + Messages: messages, + }) + if err != nil { + t.Fatal(err) + } + tsPubTime, err := ptypes.TimestampProto(pubTime) + if err != nil { + t.Fatal(err) + } + want := map[string]*pb.PubsubMessage{} + for i, id := range res.MessageIds { + want[id] = &pb.PubsubMessage{ + Data: messages[i].Data, + Attributes: messages[i].Attributes, + MessageId: id, + PublishTime: tsPubTime, + } + } + return want +} + +func TestPull(t *testing.T) { + pclient, sclient, _, cleanup := newFake(context.TODO(), t) + defer cleanup() + + top := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S", + Topic: top.Name, + AckDeadlineSeconds: 10, + }) + + want := publish(t, pclient, top, []*pb.PubsubMessage{ + {Data: []byte("d1")}, + {Data: []byte("d2")}, + {Data: []byte("d3")}, + }) + got := pubsubMessages(pullN(context.TODO(), t, len(want), sclient, sub)) + if diff := testutil.Diff(got, want); diff != "" { + t.Error(diff) + } + + res, err := sclient.Pull(context.Background(), &pb.PullRequest{Subscription: sub.Name}) + if err != nil { + t.Fatal(err) + } + if len(res.ReceivedMessages) != 0 { + t.Errorf("got %d messages, want zero", len(res.ReceivedMessages)) + } +} + +func TestStreamingPull(t *testing.T) { + // A simple test of streaming pull. + pclient, sclient, _, cleanup := newFake(context.TODO(), t) + defer cleanup() + + top := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S", + Topic: top.Name, + AckDeadlineSeconds: 10, + }) + + want := publish(t, pclient, top, []*pb.PubsubMessage{ + {Data: []byte("d1")}, + {Data: []byte("d2")}, + {Data: []byte("d3")}, + }) + got := pubsubMessages(streamingPullN(context.TODO(), t, len(want), sclient, sub)) + if diff := testutil.Diff(got, want); diff != "" { + t.Error(diff) + } +} + +// This test acks each message as it arrives and makes sure we don't see dups. +func TestStreamingPullAck(t *testing.T) { + minAckDeadlineSecs = 1 + pclient, sclient, _, cleanup := newFake(context.TODO(), t) + defer cleanup() + + top := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S", + Topic: top.Name, + AckDeadlineSeconds: 1, + }) + + _ = publish(t, pclient, top, []*pb.PubsubMessage{ + {Data: []byte("d1")}, + {Data: []byte("d2")}, + {Data: []byte("d3")}, + }) + + got := map[string]bool{} + ctx, cancel := context.WithCancel(context.Background()) + spc := mustStartStreamingPull(ctx, t, sclient, sub) + time.AfterFunc(time.Duration(2*minAckDeadlineSecs)*time.Second, cancel) + + for i := 0; i < 4; i++ { + res, err := spc.Recv() + if err == io.EOF { + break + } + if err != nil { + if status.Code(err) == codes.Canceled { + break + } + t.Fatal(err) + } + if i == 3 { + t.Fatal("expected to only see 3 messages, got 4") + } + req := &pb.StreamingPullRequest{} + for _, m := range res.ReceivedMessages { + if got[m.Message.MessageId] { + t.Fatal("duplicate message") + } + got[m.Message.MessageId] = true + req.AckIds = append(req.AckIds, m.AckId) + } + if err := spc.Send(req); err != nil { + t.Fatal(err) + } + } +} + +func TestAcknowledge(t *testing.T) { + ctx := context.Background() + pclient, sclient, srv, cleanup := newFake(context.TODO(), t) + defer cleanup() + + top := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S", + Topic: top.Name, + AckDeadlineSeconds: 10, + }) + + publish(t, pclient, top, []*pb.PubsubMessage{ + {Data: []byte("d1")}, + {Data: []byte("d2")}, + {Data: []byte("d3")}, + }) + msgs := streamingPullN(context.TODO(), t, 3, sclient, sub) + var ackIDs []string + for _, m := range msgs { + ackIDs = append(ackIDs, m.AckId) + } + if _, err := sclient.Acknowledge(ctx, &pb.AcknowledgeRequest{ + Subscription: sub.Name, + AckIds: ackIDs, + }); err != nil { + t.Fatal(err) + } + smsgs := srv.Messages() + if got, want := len(smsgs), 3; got != want { + t.Fatalf("got %d messages, want %d", got, want) + } + for _, sm := range smsgs { + if sm.Acks != 1 { + t.Errorf("message %s: got %d acks, want 1", sm.ID, sm.Acks) + } + } +} + +func TestModAck(t *testing.T) { + ctx := context.Background() + pclient, sclient, _, cleanup := newFake(context.TODO(), t) + defer cleanup() + + top := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S", + Topic: top.Name, + AckDeadlineSeconds: 10, + }) + + publish(t, pclient, top, []*pb.PubsubMessage{ + {Data: []byte("d1")}, + {Data: []byte("d2")}, + {Data: []byte("d3")}, + }) + msgs := streamingPullN(context.TODO(), t, 3, sclient, sub) + var ackIDs []string + for _, m := range msgs { + ackIDs = append(ackIDs, m.AckId) + } + if _, err := sclient.ModifyAckDeadline(ctx, &pb.ModifyAckDeadlineRequest{ + Subscription: sub.Name, + AckIds: ackIDs, + AckDeadlineSeconds: 0, + }); err != nil { + t.Fatal(err) + } + // Having nacked all three messages, we should see them again. + msgs = streamingPullN(context.TODO(), t, 3, sclient, sub) + if got, want := len(msgs), 3; got != want { + t.Errorf("got %d messages, want %d", got, want) + } +} + +func TestAckDeadline(t *testing.T) { + // Messages should be resent after they expire. + pclient, sclient, _, cleanup := newFake(context.TODO(), t) + defer cleanup() + + minAckDeadlineSecs = 2 + top := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S", + Topic: top.Name, + AckDeadlineSeconds: minAckDeadlineSecs, + }) + + _ = publish(t, pclient, top, []*pb.PubsubMessage{ + {Data: []byte("d1")}, + {Data: []byte("d2")}, + {Data: []byte("d3")}, + }) + + got := map[string]int{} + spc := mustStartStreamingPull(context.TODO(), t, sclient, sub) + // In 5 seconds the ack deadline will expire twice, so we should see each message + // exactly three times. + time.AfterFunc(5*time.Second, func() { + if err := spc.CloseSend(); err != nil { + t.Errorf("CloseSend: %v", err) + } + }) + for { + res, err := spc.Recv() + if err == io.EOF { + break + } + if err != nil { + t.Fatal(err) + } + for _, m := range res.ReceivedMessages { + got[m.Message.MessageId]++ + } + } + for id, n := range got { + if n != 3 { + t.Errorf("message %s: saw %d times, want 3", id, n) + } + } +} + +func TestMultiSubs(t *testing.T) { + // Each subscription gets every message. + pclient, sclient, _, cleanup := newFake(context.TODO(), t) + defer cleanup() + + top := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub1 := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S1", + Topic: top.Name, + AckDeadlineSeconds: 10, + }) + sub2 := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S2", + Topic: top.Name, + AckDeadlineSeconds: 10, + }) + + want := publish(t, pclient, top, []*pb.PubsubMessage{ + {Data: []byte("d1")}, + {Data: []byte("d2")}, + {Data: []byte("d3")}, + }) + got1 := pubsubMessages(streamingPullN(context.TODO(), t, len(want), sclient, sub1)) + got2 := pubsubMessages(streamingPullN(context.TODO(), t, len(want), sclient, sub2)) + if diff := testutil.Diff(got1, want); diff != "" { + t.Error(diff) + } + if diff := testutil.Diff(got2, want); diff != "" { + t.Error(diff) + } +} + +// Messages are handed out to all streams of a subscription in a best-effort +// round-robin behavior. The fake server prefers to fail-fast onto another +// stream when one stream is already busy, though, so we're unable to test +// strict round robin behavior. +func TestMultiStreams(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + pclient, sclient, _, cleanup := newFake(ctx, t) + defer cleanup() + + top := mustCreateTopic(ctx, t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub := mustCreateSubscription(ctx, t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S", + Topic: top.Name, + AckDeadlineSeconds: 10, + }) + st1 := mustStartStreamingPull(ctx, t, sclient, sub) + defer st1.CloseSend() + st1Received := make(chan struct{}) + go func() { + _, err := st1.Recv() + if err != nil { + t.Error(err) + } + close(st1Received) + }() + + st2 := mustStartStreamingPull(ctx, t, sclient, sub) + defer st2.CloseSend() + st2Received := make(chan struct{}) + go func() { + _, err := st2.Recv() + if err != nil { + t.Error(err) + } + close(st2Received) + }() + + publish(t, pclient, top, []*pb.PubsubMessage{ + {Data: []byte("d1")}, + {Data: []byte("d2")}, + }) + + timeout := time.After(5 * time.Second) + select { + case <-timeout: + t.Fatal("timed out waiting for stream 1 to receive any message") + case <-st1Received: + } + select { + case <-timeout: + t.Fatal("timed out waiting for stream 1 to receive any message") + case <-st2Received: + } +} + +func TestStreamingPullTimeout(t *testing.T) { + pclient, sclient, srv, cleanup := newFake(context.TODO(), t) + defer cleanup() + + timeout := 200 * time.Millisecond + srv.SetStreamTimeout(timeout) + top := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S", + Topic: top.Name, + AckDeadlineSeconds: 10, + }) + stream := mustStartStreamingPull(context.TODO(), t, sclient, sub) + time.Sleep(2 * timeout) + _, err := stream.Recv() + if err != io.EOF { + t.Errorf("got %v, want io.EOF", err) + } +} + +func TestSeek(t *testing.T) { + pclient, sclient, _, cleanup := newFake(context.TODO(), t) + defer cleanup() + + top := mustCreateTopic(context.TODO(), t, pclient, &pb.Topic{Name: "projects/P/topics/T"}) + sub := mustCreateSubscription(context.TODO(), t, sclient, &pb.Subscription{ + Name: "projects/P/subscriptions/S", + Topic: top.Name, + AckDeadlineSeconds: 10, + }) + ts := ptypes.TimestampNow() + _, err := sclient.Seek(context.Background(), &pb.SeekRequest{ + Subscription: sub.Name, + Target: &pb.SeekRequest_Time{Time: ts}, + }) + if err != nil { + t.Errorf("Seeking: %v", err) + } +} + +func TestTryDeliverMessage(t *testing.T) { + for _, test := range []struct { + desc string + availStreamIdx int + expectedOutIdx int + }{ + {availStreamIdx: 0, expectedOutIdx: 0}, + // Stream 1 will always be marked for deletion. + {availStreamIdx: 2, expectedOutIdx: 1}, // s0, s1 (deleted), s2, s3 becomes s0, s2, s3. So we expect outIdx=1. + {availStreamIdx: 3, expectedOutIdx: 2}, // s0, s1 (deleted), s2, s3 becomes s0, s2, s3. So we expect outIdx=2. + } { + top := newTopic(&pb.Topic{Name: "some-topic"}) + sub := newSubscription(top, &sync.Mutex{}, &pb.Subscription{Name: "some-sub", Topic: "some-topic"}) + + done := make(chan struct{}, 1) + done <- struct{}{} + sub.streams = []*stream{{}, {done: done}, {}, {}} + + msgc := make(chan *pb.ReceivedMessage, 1) + sub.streams[test.availStreamIdx].msgc = msgc + + var d int + idx, ok := sub.tryDeliverMessage(&message{deliveries: &d}, 0, time.Now()) + if !ok { + t.Fatalf("[avail=%d]: expected msg to be put on stream %d's channel, but it was not", test.availStreamIdx, test.expectedOutIdx) + } + if idx != test.expectedOutIdx { + t.Fatalf("[avail=%d]: expected msg to be put on stream %d, but it was put on %d", test.availStreamIdx, test.expectedOutIdx, idx) + } + select { + case <-msgc: + default: + t.Fatalf("[avail=%d]: expected msg to be put on stream %d's channel, but it was not", test.availStreamIdx, idx) + } + } +} + +func mustStartStreamingPull(ctx context.Context, t *testing.T, sc pb.SubscriberClient, sub *pb.Subscription) pb.Subscriber_StreamingPullClient { + spc, err := sc.StreamingPull(ctx) + if err != nil { + t.Fatal(err) + } + if err := spc.Send(&pb.StreamingPullRequest{Subscription: sub.Name}); err != nil { + t.Fatal(err) + } + return spc +} + +func pullN(ctx context.Context, t *testing.T, n int, sc pb.SubscriberClient, sub *pb.Subscription) map[string]*pb.ReceivedMessage { + got := map[string]*pb.ReceivedMessage{} + for i := 0; len(got) < n; i++ { + res, err := sc.Pull(ctx, &pb.PullRequest{Subscription: sub.Name, MaxMessages: int32(n - len(got))}) + if err != nil { + t.Fatal(err) + } + for _, m := range res.ReceivedMessages { + got[m.Message.MessageId] = m + } + } + return got +} + +func streamingPullN(ctx context.Context, t *testing.T, n int, sc pb.SubscriberClient, sub *pb.Subscription) map[string]*pb.ReceivedMessage { + spc := mustStartStreamingPull(ctx, t, sc, sub) + got := map[string]*pb.ReceivedMessage{} + for i := 0; i < n; i++ { + res, err := spc.Recv() + if err != nil { + t.Fatal(err) + } + for _, m := range res.ReceivedMessages { + got[m.Message.MessageId] = m + } + } + if err := spc.CloseSend(); err != nil { + t.Fatal(err) + } + res, err := spc.Recv() + if err != io.EOF { + t.Fatalf("Recv returned <%v> instead of EOF; res = %v", err, res) + } + return got +} + +func pubsubMessages(rms map[string]*pb.ReceivedMessage) map[string]*pb.PubsubMessage { + ms := map[string]*pb.PubsubMessage{} + for k, rm := range rms { + ms[k] = rm.Message + } + return ms +} + +func mustCreateTopic(ctx context.Context, t *testing.T, pc pb.PublisherClient, topic *pb.Topic) *pb.Topic { + top, err := pc.CreateTopic(ctx, topic) + if err != nil { + t.Fatal(err) + } + return top +} + +func mustCreateSubscription(ctx context.Context, t *testing.T, sc pb.SubscriberClient, sub *pb.Subscription) *pb.Subscription { + sub, err := sc.CreateSubscription(ctx, sub) + if err != nil { + t.Fatal(err) + } + return sub +} + +// newFake creates a new fake server along with a publisher and subscriber +// client. Its final return is a cleanup function. +// +// Note: be sure to call cleanup! +func newFake(ctx context.Context, t *testing.T) (pb.PublisherClient, pb.SubscriberClient, *Server, func()) { + srv := NewServer() + conn, err := grpc.DialContext(ctx, srv.Addr, grpc.WithInsecure()) + if err != nil { + t.Fatal(err) + } + return pb.NewPublisherClient(conn), pb.NewSubscriberClient(conn), srv, func() { + srv.Close() + conn.Close() + } +} diff --git a/vendor/cloud.google.com/go/pubsub/pstest_test.go b/vendor/cloud.google.com/go/pubsub/pstest_test.go new file mode 100644 index 000000000..0a1e4c376 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/pstest_test.go @@ -0,0 +1,78 @@ +// 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. + +package pubsub_test + +import ( + "context" + "strconv" + "sync" + "testing" + + "cloud.google.com/go/pubsub" + "cloud.google.com/go/pubsub/pstest" + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +func TestPSTest(t *testing.T) { + t.Parallel() + ctx := context.Background() + srv := pstest.NewServer() + defer srv.Close() + + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure()) + if err != nil { + panic(err) + } + defer conn.Close() + + client, err := pubsub.NewClient(ctx, "some-project", option.WithGRPCConn(conn)) + if err != nil { + panic(err) + } + defer client.Close() + + topic, err := client.CreateTopic(ctx, "test-topic") + if err != nil { + panic(err) + } + + sub, err := client.CreateSubscription(ctx, "sub-name", pubsub.SubscriptionConfig{Topic: topic}) + if err != nil { + panic(err) + } + + go func() { + for i := 0; i < 10; i++ { + srv.Publish("projects/some-project/topics/test-topic", []byte(strconv.Itoa(i)), nil) + } + }() + + ctx, cancel := context.WithCancel(ctx) + var mu sync.Mutex + count := 0 + err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) { + mu.Lock() + count++ + if count >= 10 { + cancel() + } + mu.Unlock() + m.Ack() + }) + if err != nil { + panic(err) + } +} diff --git a/vendor/cloud.google.com/go/pubsub/pubsub.go b/vendor/cloud.google.com/go/pubsub/pubsub.go new file mode 100644 index 000000000..83f6731d1 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/pubsub.go @@ -0,0 +1,111 @@ +// 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 pubsub // import "cloud.google.com/go/pubsub" + +import ( + "context" + "fmt" + "os" + "runtime" + "time" + + "cloud.google.com/go/internal/version" + vkit "cloud.google.com/go/pubsub/apiv1" + "google.golang.org/api/option" + "google.golang.org/grpc" + "google.golang.org/grpc/keepalive" +) + +const ( + // ScopePubSub grants permissions to view and manage Pub/Sub + // topics and subscriptions. + ScopePubSub = "https://www.googleapis.com/auth/pubsub" + + // ScopeCloudPlatform grants permissions to view and manage your data + // across Google Cloud Platform services. + ScopeCloudPlatform = "https://www.googleapis.com/auth/cloud-platform" + + prodAddr = "https://pubsub.googleapis.com/" + + maxAckDeadline = 10 * time.Minute +) + +// Client is a Google Pub/Sub client scoped to a single project. +// +// Clients should be reused rather than being created as needed. +// A Client may be shared by multiple goroutines. +type Client struct { + projectID string + pubc *vkit.PublisherClient + subc *vkit.SubscriberClient +} + +// NewClient creates a new PubSub client. +func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (c *Client, err error) { + var o []option.ClientOption + // Environment variables for gcloud emulator: + // https://cloud.google.com/sdk/gcloud/reference/beta/emulators/pubsub/ + if addr := os.Getenv("PUBSUB_EMULATOR_HOST"); addr != "" { + conn, err := grpc.Dial(addr, grpc.WithInsecure()) + if err != nil { + return nil, fmt.Errorf("grpc.Dial: %v", err) + } + o = []option.ClientOption{option.WithGRPCConn(conn)} + } else { + o = []option.ClientOption{ + // Create multiple connections to increase throughput. + option.WithGRPCConnectionPool(runtime.GOMAXPROCS(0)), + option.WithGRPCDialOption(grpc.WithKeepaliveParams(keepalive.ClientParameters{ + Time: 5 * time.Minute, + })), + } + o = append(o, openCensusOptions()...) + } + o = append(o, opts...) + pubc, err := vkit.NewPublisherClient(ctx, o...) + if err != nil { + return nil, fmt.Errorf("pubsub: %v", err) + } + subc, err := vkit.NewSubscriberClient(ctx, option.WithGRPCConn(pubc.Connection())) + if err != nil { + // Should never happen, since we are passing in the connection. + // If it does, we cannot close, because the user may have passed in their + // own connection originally. + return nil, fmt.Errorf("pubsub: %v", err) + } + pubc.SetGoogleClientInfo("gccl", version.Repo) + subc.SetGoogleClientInfo("gccl", version.Repo) + return &Client{ + projectID: projectID, + pubc: pubc, + subc: subc, + }, nil +} + +// Close releases any resources held by the client, +// such as memory and goroutines. +// +// If the client is available for the lifetime of the program, then Close need not be +// called at exit. +func (c *Client) Close() error { + // Return the first error, because the first call closes the connection. + err := c.pubc.Close() + _ = c.subc.Close() + return err +} + +func (c *Client) fullyQualifiedProjectName() string { + return fmt.Sprintf("projects/%s", c.projectID) +} diff --git a/vendor/cloud.google.com/go/pubsub/pullstream.go b/vendor/cloud.google.com/go/pubsub/pullstream.go new file mode 100644 index 000000000..5a50ff99f --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/pullstream.go @@ -0,0 +1,182 @@ +// 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. + +package pubsub + +import ( + "context" + "io" + "sync" + "time" + + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc" +) + +// A pullStream supports the methods of a StreamingPullClient, but re-opens +// the stream on a retryable error. +type pullStream struct { + ctx context.Context + open func() (pb.Subscriber_StreamingPullClient, error) + + mu sync.Mutex + spc *pb.Subscriber_StreamingPullClient + err error // permanent error +} + +// for testing +type streamingPullFunc func(context.Context, ...gax.CallOption) (pb.Subscriber_StreamingPullClient, error) + +func newPullStream(ctx context.Context, streamingPull streamingPullFunc, subName string) *pullStream { + ctx = withSubscriptionKey(ctx, subName) + return &pullStream{ + ctx: ctx, + open: func() (pb.Subscriber_StreamingPullClient, error) { + spc, err := streamingPull(ctx, gax.WithGRPCOptions(grpc.MaxCallRecvMsgSize(maxSendRecvBytes))) + if err == nil { + recordStat(ctx, StreamRequestCount, 1) + err = spc.Send(&pb.StreamingPullRequest{ + Subscription: subName, + // We modack messages when we receive them, so this value doesn't matter too much. + StreamAckDeadlineSeconds: 60, + }) + } + if err != nil { + return nil, err + } + return spc, nil + }, + } +} + +// get returns either a valid *StreamingPullClient (SPC), or a permanent error. +// If the argument is nil, this is the first call for an RPC, and the current +// SPC will be returned (or a new one will be opened). Otherwise, this call is a +// request to re-open the stream because of a retryable error, and the argument +// is a pointer to the SPC that returned the error. +func (s *pullStream) get(spc *pb.Subscriber_StreamingPullClient) (*pb.Subscriber_StreamingPullClient, error) { + s.mu.Lock() + defer s.mu.Unlock() + // A stored error is permanent. + if s.err != nil { + return nil, s.err + } + // If the context is done, so are we. + s.err = s.ctx.Err() + if s.err != nil { + return nil, s.err + } + + // If the current and argument SPCs differ, return the current one. This subsumes two cases: + // 1. We have an SPC and the caller is getting the stream for the first time. + // 2. The caller wants to retry, but they have an older SPC; we've already retried. + if spc != s.spc { + return s.spc, nil + } + // Either this is the very first call on this stream (s.spc == nil), or we have a valid + // retry request. Either way, open a new stream. + // The lock is held here for a long time, but it doesn't matter because no callers could get + // anything done anyway. + s.spc = new(pb.Subscriber_StreamingPullClient) + *s.spc, s.err = s.openWithRetry() // Any error from openWithRetry is permanent. + return s.spc, s.err +} + +func (s *pullStream) openWithRetry() (pb.Subscriber_StreamingPullClient, error) { + var bo gax.Backoff + for { + recordStat(s.ctx, StreamOpenCount, 1) + spc, err := s.open() + if err != nil && isRetryable(err) { + recordStat(s.ctx, StreamRetryCount, 1) + if err := gax.Sleep(s.ctx, bo.Pause()); err != nil { + return nil, err + } + continue + } + return spc, err + } +} + +func (s *pullStream) call(f func(pb.Subscriber_StreamingPullClient) error) error { + var ( + spc *pb.Subscriber_StreamingPullClient + err error + bo gax.Backoff + ) + for { + spc, err = s.get(spc) + if err != nil { + return err + } + start := time.Now() + err = f(*spc) + if err != nil { + if isRetryable(err) { + recordStat(s.ctx, StreamRetryCount, 1) + if time.Since(start) < 30*time.Second { // don't sleep if we've been blocked for a while + if err := gax.Sleep(s.ctx, bo.Pause()); err != nil { + return err + } + } + continue + } + s.mu.Lock() + s.err = err + s.mu.Unlock() + } + return err + } +} + +func (s *pullStream) Send(req *pb.StreamingPullRequest) error { + return s.call(func(spc pb.Subscriber_StreamingPullClient) error { + recordStat(s.ctx, AckCount, int64(len(req.AckIds))) + zeroes := 0 + for _, mds := range req.ModifyDeadlineSeconds { + if mds == 0 { + zeroes++ + } + } + recordStat(s.ctx, NackCount, int64(zeroes)) + recordStat(s.ctx, ModAckCount, int64(len(req.ModifyDeadlineSeconds)-zeroes)) + recordStat(s.ctx, StreamRequestCount, 1) + return spc.Send(req) + }) +} + +func (s *pullStream) Recv() (*pb.StreamingPullResponse, error) { + var res *pb.StreamingPullResponse + err := s.call(func(spc pb.Subscriber_StreamingPullClient) error { + var err error + recordStat(s.ctx, StreamResponseCount, 1) + res, err = spc.Recv() + if err == nil { + recordStat(s.ctx, PullCount, int64(len(res.ReceivedMessages))) + } + return err + }) + return res, err +} + +func (s *pullStream) CloseSend() error { + err := s.call(func(spc pb.Subscriber_StreamingPullClient) error { + return spc.CloseSend() + }) + s.mu.Lock() + s.err = io.EOF // should not be retried + s.mu.Unlock() + return err +} diff --git a/vendor/cloud.google.com/go/pubsub/pullstream_test.go b/vendor/cloud.google.com/go/pubsub/pullstream_test.go new file mode 100644 index 000000000..059480844 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/pullstream_test.go @@ -0,0 +1,78 @@ +// 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. + +package pubsub + +import ( + "context" + "testing" + + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestPullStreamGet(t *testing.T) { + // Test that we retry on the initial Send call from pullstream.get. We don't do this + // test with the server in fake_test.go because there's no clear way to get Send + // to fail from the server. + t.Parallel() + for _, test := range []struct { + desc string + errors []error + wantCode codes.Code + }{ + { + desc: "nil error", + errors: []error{nil}, + wantCode: codes.OK, + }, + { + desc: "non-retryable error", + errors: []error{status.Errorf(codes.InvalidArgument, "")}, + wantCode: codes.InvalidArgument, + }, + { + desc: "retryable errors", + errors: []error{ + status.Errorf(codes.Unavailable, "first"), + status.Errorf(codes.Unavailable, "second"), + nil, + }, + wantCode: codes.OK, + }, + } { + streamingPull := func(context.Context, ...gax.CallOption) (pb.Subscriber_StreamingPullClient, error) { + if len(test.errors) == 0 { + panic("out of errors") + } + err := test.errors[0] + test.errors = test.errors[1:] + return &testStreamingPullClient{sendError: err}, nil + } + ps := newPullStream(context.Background(), streamingPull, "") + _, err := ps.get(nil) + if got := status.Code(err); got != test.wantCode { + t.Errorf("%s: got %s, want %s", test.desc, got, test.wantCode) + } + } +} + +type testStreamingPullClient struct { + pb.Subscriber_StreamingPullClient + sendError error +} + +func (c *testStreamingPullClient) Send(*pb.StreamingPullRequest) error { return c.sendError } diff --git a/vendor/cloud.google.com/go/pubsub/service.go b/vendor/cloud.google.com/go/pubsub/service.go new file mode 100644 index 000000000..63d4aa4ed --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/service.go @@ -0,0 +1,78 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pubsub + +import ( + "fmt" + "math" + "strings" + + pb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// maxPayload is the maximum number of bytes to devote to actual ids in +// acknowledgement or modifyAckDeadline requests. A serialized +// AcknowledgeRequest proto has a small constant overhead, plus the size of the +// subscription name, plus 3 bytes per ID (a tag byte and two size bytes). A +// ModifyAckDeadlineRequest has an additional few bytes for the deadline. We +// don't know the subscription name here, so we just assume the size exclusive +// of ids is 100 bytes. +// +// With gRPC there is no way for the client to know the server's max message size (it is +// configurable on the server). We know from experience that it +// it 512K. +const ( + maxPayload = 512 * 1024 + reqFixedOverhead = 100 + overheadPerID = 3 + maxSendRecvBytes = 20 * 1024 * 1024 // 20M +) + +func convertMessages(rms []*pb.ReceivedMessage) ([]*Message, error) { + msgs := make([]*Message, 0, len(rms)) + for i, m := range rms { + msg, err := toMessage(m) + if err != nil { + return nil, fmt.Errorf("pubsub: cannot decode the retrieved message at index: %d, message: %+v", i, m) + } + msgs = append(msgs, msg) + } + return msgs, nil +} + +func trunc32(i int64) int32 { + if i > math.MaxInt32 { + i = math.MaxInt32 + } + return int32(i) +} + +// Logic from https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StatusUtil.java +func isRetryable(err error) bool { + s, ok := status.FromError(err) + if !ok { // includes io.EOF, normal stream close, which causes us to reopen + return true + } + switch s.Code() { + case codes.DeadlineExceeded, codes.Internal, codes.ResourceExhausted: + return true + case codes.Unavailable: + return !strings.Contains(s.Message(), "Server shutdownNow invoked") + default: + return false + } +} diff --git a/vendor/cloud.google.com/go/pubsub/snapshot.go b/vendor/cloud.google.com/go/pubsub/snapshot.go new file mode 100644 index 000000000..d662f0d20 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/snapshot.go @@ -0,0 +1,160 @@ +// Copyright 2017 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 pubsub + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/golang/protobuf/ptypes" + pb "google.golang.org/genproto/googleapis/pubsub/v1" +) + +// Snapshot is a reference to a PubSub snapshot. +type Snapshot struct { + c *Client + + // The fully qualified identifier for the snapshot, in the format "projects//snapshots/" + name string +} + +// ID returns the unique identifier of the snapshot within its project. +func (s *Snapshot) ID() string { + slash := strings.LastIndex(s.name, "/") + if slash == -1 { + // name is not a fully-qualified name. + panic("bad snapshot name") + } + return s.name[slash+1:] +} + +// SnapshotConfig contains the details of a Snapshot. +type SnapshotConfig struct { + *Snapshot + Topic *Topic + Expiration time.Time +} + +// Snapshot creates a reference to a snapshot. +func (c *Client) Snapshot(id string) *Snapshot { + return &Snapshot{ + c: c, + name: fmt.Sprintf("projects/%s/snapshots/%s", c.projectID, id), + } +} + +// Snapshots returns an iterator which returns snapshots for this project. +func (c *Client) Snapshots(ctx context.Context) *SnapshotConfigIterator { + it := c.subc.ListSnapshots(ctx, &pb.ListSnapshotsRequest{ + Project: c.fullyQualifiedProjectName(), + }) + next := func() (*SnapshotConfig, error) { + snap, err := it.Next() + if err != nil { + return nil, err + } + return toSnapshotConfig(snap, c) + } + return &SnapshotConfigIterator{next: next} +} + +// SnapshotConfigIterator is an iterator that returns a series of snapshots. +type SnapshotConfigIterator struct { + next func() (*SnapshotConfig, error) +} + +// Next returns the next SnapshotConfig. Its second return value is iterator.Done if there are no more results. +// Once Next returns iterator.Done, all subsequent calls will return iterator.Done. +func (snaps *SnapshotConfigIterator) Next() (*SnapshotConfig, error) { + return snaps.next() +} + +// Delete deletes a snapshot. +func (s *Snapshot) Delete(ctx context.Context) error { + return s.c.subc.DeleteSnapshot(ctx, &pb.DeleteSnapshotRequest{Snapshot: s.name}) +} + +// SeekToTime seeks the subscription to a point in time. +// +// Messages retained in the subscription that were published before this +// time are marked as acknowledged, and messages retained in the +// subscription that were published after this time are marked as +// unacknowledged. Note that this operation affects only those messages +// retained in the subscription (configured by SnapshotConfig). For example, +// if `time` corresponds to a point before the message retention +// window (or to a point before the system's notion of the subscription +// creation time), only retained messages will be marked as unacknowledged, +// and already-expunged messages will not be restored. +func (s *Subscription) SeekToTime(ctx context.Context, t time.Time) error { + ts, err := ptypes.TimestampProto(t) + if err != nil { + return err + } + _, err = s.c.subc.Seek(ctx, &pb.SeekRequest{ + Subscription: s.name, + Target: &pb.SeekRequest_Time{ts}, + }) + return err +} + +// CreateSnapshot creates a new snapshot from this subscription. +// The snapshot will be for the topic this subscription is subscribed to. +// If the name is empty string, a unique name is assigned. +// +// The created snapshot is guaranteed to retain: +// (a) The existing backlog on the subscription. More precisely, this is +// defined as the messages in the subscription's backlog that are +// unacknowledged when Snapshot returns without error. +// (b) Any messages published to the subscription's topic following +// Snapshot returning without error. +func (s *Subscription) CreateSnapshot(ctx context.Context, name string) (*SnapshotConfig, error) { + if name != "" { + name = fmt.Sprintf("projects/%s/snapshots/%s", strings.Split(s.name, "/")[1], name) + } + snap, err := s.c.subc.CreateSnapshot(ctx, &pb.CreateSnapshotRequest{ + Name: name, + Subscription: s.name, + }) + if err != nil { + return nil, err + } + return toSnapshotConfig(snap, s.c) +} + +// SeekToSnapshot seeks the subscription to a snapshot. +// +// The snapshot need not be created from this subscription, +// but it must be for the topic this subscription is subscribed to. +func (s *Subscription) SeekToSnapshot(ctx context.Context, snap *Snapshot) error { + _, err := s.c.subc.Seek(ctx, &pb.SeekRequest{ + Subscription: s.name, + Target: &pb.SeekRequest_Snapshot{snap.name}, + }) + return err +} + +func toSnapshotConfig(snap *pb.Snapshot, c *Client) (*SnapshotConfig, error) { + exp, err := ptypes.Timestamp(snap.ExpireTime) + if err != nil { + return nil, err + } + return &SnapshotConfig{ + Snapshot: &Snapshot{c: c, name: snap.Name}, + Topic: newTopic(c, snap.Topic), + Expiration: exp, + }, nil +} diff --git a/vendor/cloud.google.com/go/pubsub/streaming_pull_test.go b/vendor/cloud.google.com/go/pubsub/streaming_pull_test.go new file mode 100644 index 000000000..ab382e76e --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/streaming_pull_test.go @@ -0,0 +1,462 @@ +// Copyright 2017 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 pubsub + +// TODO(jba): test keepalive +// TODO(jba): test that expired messages are not kept alive +// TODO(jba): test that when all messages expire, Stop returns. + +import ( + "context" + "io" + "strconv" + "sync" + "sync/atomic" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + tspb "github.com/golang/protobuf/ptypes/timestamp" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "google.golang.org/api/option" + pb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var ( + timestamp = &tspb.Timestamp{} + testMessages = []*pb.ReceivedMessage{ + {AckId: "0", Message: &pb.PubsubMessage{Data: []byte{1}, PublishTime: timestamp}}, + {AckId: "1", Message: &pb.PubsubMessage{Data: []byte{2}, PublishTime: timestamp}}, + {AckId: "2", Message: &pb.PubsubMessage{Data: []byte{3}, PublishTime: timestamp}}, + } +) + +func TestStreamingPullBasic(t *testing.T) { + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + server.addStreamingPullMessages(testMessages) + testStreamingPullIteration(t, client, server, testMessages) +} + +func TestStreamingPullMultipleFetches(t *testing.T) { + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + server.addStreamingPullMessages(testMessages[:1]) + server.addStreamingPullMessages(testMessages[1:]) + testStreamingPullIteration(t, client, server, testMessages) +} + +func testStreamingPullIteration(t *testing.T, client *Client, server *mockServer, msgs []*pb.ReceivedMessage) { + sub := client.Subscription("S") + gotMsgs, err := pullN(context.Background(), sub, len(msgs), func(_ context.Context, m *Message) { + id, err := strconv.Atoi(m.ackID) + if err != nil { + panic(err) + } + // ack evens, nack odds + if id%2 == 0 { + m.Ack() + } else { + m.Nack() + } + }) + if c := status.Convert(err); err != nil && c.Code() != codes.Canceled { + t.Fatalf("Pull: %v", err) + } + gotMap := map[string]*Message{} + for _, m := range gotMsgs { + gotMap[m.ackID] = m + } + for i, msg := range msgs { + want, err := toMessage(msg) + if err != nil { + t.Fatal(err) + } + want.calledDone = true + got := gotMap[want.ackID] + if got == nil { + t.Errorf("%d: no message for ackID %q", i, want.ackID) + continue + } + if !testutil.Equal(got, want, cmp.AllowUnexported(Message{}), cmpopts.IgnoreTypes(time.Time{}, func(string, bool, time.Time) {})) { + t.Errorf("%d: got\n%#v\nwant\n%#v", i, got, want) + } + } + server.wait() + for i := 0; i < len(msgs); i++ { + id := msgs[i].AckId + if i%2 == 0 { + if !server.Acked[id] { + t.Errorf("msg %q should have been acked but wasn't", id) + } + } else { + if dl, ok := server.Deadlines[id]; !ok || dl != 0 { + t.Errorf("msg %q should have been nacked but wasn't", id) + } + } + } +} + +func TestStreamingPullError(t *testing.T) { + // If an RPC to the service returns a non-retryable error, Pull should + // return after all callbacks return, without waiting for messages to be + // acked. + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + server.addStreamingPullMessages(testMessages[:1]) + server.addStreamingPullError(status.Errorf(codes.Unknown, "")) + sub := client.Subscription("S") + // Use only one goroutine, since the fake server is configured to + // return only one error. + sub.ReceiveSettings.NumGoroutines = 1 + callbackDone := make(chan struct{}) + ctx, _ := context.WithTimeout(context.Background(), time.Second) + err := sub.Receive(ctx, func(ctx context.Context, m *Message) { + defer close(callbackDone) + select { + case <-ctx.Done(): + return + } + }) + select { + case <-callbackDone: + default: + t.Fatal("Receive returned but callback was not done") + } + if want := codes.Unknown; grpc.Code(err) != want { + t.Fatalf("got <%v>, want code %v", err, want) + } +} + +func TestStreamingPullCancel(t *testing.T) { + // If Receive's context is canceled, it should return after all callbacks + // return and all messages have been acked. + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + server.addStreamingPullMessages(testMessages) + sub := client.Subscription("S") + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + var n int32 + err := sub.Receive(ctx, func(ctx2 context.Context, m *Message) { + atomic.AddInt32(&n, 1) + defer atomic.AddInt32(&n, -1) + cancel() + m.Ack() + }) + if got := atomic.LoadInt32(&n); got != 0 { + t.Errorf("Receive returned with %d callbacks still running", got) + } + if err != nil { + t.Fatalf("Receive got <%v>, want nil", err) + } +} + +func TestStreamingPullRetry(t *testing.T) { + // Check that we retry on io.EOF or Unavailable. + t.Parallel() + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + server.addStreamingPullMessages(testMessages[:1]) + server.addStreamingPullError(io.EOF) + server.addStreamingPullError(io.EOF) + server.addStreamingPullMessages(testMessages[1:2]) + server.addStreamingPullError(status.Errorf(codes.Unavailable, "")) + server.addStreamingPullError(status.Errorf(codes.Unavailable, "")) + server.addStreamingPullMessages(testMessages[2:]) + + testStreamingPullIteration(t, client, server, testMessages) +} + +func TestStreamingPullOneActive(t *testing.T) { + // Only one call to Pull can be active at a time. + client, srv := newMock(t) + defer client.Close() + defer srv.srv.Close() + srv.addStreamingPullMessages(testMessages[:1]) + sub := client.Subscription("S") + ctx, cancel := context.WithCancel(context.Background()) + err := sub.Receive(ctx, func(ctx context.Context, m *Message) { + m.Ack() + err := sub.Receive(ctx, func(context.Context, *Message) {}) + if err != errReceiveInProgress { + t.Errorf("got <%v>, want <%v>", err, errReceiveInProgress) + } + cancel() + }) + if err != nil { + t.Fatalf("got <%v>, want nil", err) + } +} + +func TestStreamingPullConcurrent(t *testing.T) { + newMsg := func(i int) *pb.ReceivedMessage { + return &pb.ReceivedMessage{ + AckId: strconv.Itoa(i), + Message: &pb.PubsubMessage{Data: []byte{byte(i)}, PublishTime: timestamp}, + } + } + + // Multiple goroutines should be able to read from the same iterator. + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + // Add a lot of messages, a few at a time, to make sure both threads get a chance. + nMessages := 100 + for i := 0; i < nMessages; i += 2 { + server.addStreamingPullMessages([]*pb.ReceivedMessage{newMsg(i), newMsg(i + 1)}) + } + sub := client.Subscription("S") + ctx, _ := context.WithTimeout(context.Background(), time.Second) + gotMsgs, err := pullN(ctx, sub, nMessages, func(ctx context.Context, m *Message) { + m.Ack() + }) + if c := status.Convert(err); err != nil && c.Code() != codes.Canceled { + t.Fatalf("Pull: %v", err) + } + seen := map[string]bool{} + for _, gm := range gotMsgs { + if seen[gm.ackID] { + t.Fatalf("duplicate ID %q", gm.ackID) + } + seen[gm.ackID] = true + } + if len(seen) != nMessages { + t.Fatalf("got %d messages, want %d", len(seen), nMessages) + } +} + +func TestStreamingPullFlowControl(t *testing.T) { + // Callback invocations should not occur if flow control limits are exceeded. + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + server.addStreamingPullMessages(testMessages) + sub := client.Subscription("S") + sub.ReceiveSettings.MaxOutstandingMessages = 2 + ctx, cancel := context.WithCancel(context.Background()) + activec := make(chan int) + waitc := make(chan int) + errc := make(chan error) + go func() { + errc <- sub.Receive(ctx, func(_ context.Context, m *Message) { + activec <- 1 + <-waitc + m.Ack() + }) + }() + // Here, two callbacks are active. Receive should be blocked in the flow + // control acquire method on the third message. + <-activec + <-activec + select { + case <-activec: + t.Fatal("third callback in progress") + case <-time.After(100 * time.Millisecond): + } + cancel() + // Receive still has not returned, because both callbacks are still blocked on waitc. + select { + case err := <-errc: + t.Fatalf("Receive returned early with error %v", err) + case <-time.After(100 * time.Millisecond): + } + // Let both callbacks proceed. + waitc <- 1 + waitc <- 1 + // The third callback will never run, because acquire returned a non-nil + // error, causing Receive to return. So now Receive should end. + if err := <-errc; err != nil { + t.Fatalf("got %v from Receive, want nil", err) + } +} + +func TestStreamingPull_ClosedClient(t *testing.T) { + ctx := context.Background() + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + server.addStreamingPullMessages(testMessages) + sub := client.Subscription("S") + sub.ReceiveSettings.MaxOutstandingBytes = 1 + recvFinished := make(chan error) + + go func() { + err := sub.Receive(ctx, func(_ context.Context, m *Message) { + m.Ack() + }) + recvFinished <- err + }() + + // wait for receives to happen + time.Sleep(100 * time.Millisecond) + + err := client.Close() + if err != nil { + t.Fatal(err) + } + + // wait for things to close + time.Sleep(100 * time.Millisecond) + + select { + case recvErr := <-recvFinished: + s, ok := status.FromError(recvErr) + if !ok { + t.Fatalf("Expected a gRPC failure, got %v", err) + } + if s.Code() != codes.Canceled { + t.Fatalf("Expected canceled, got %v", s.Code()) + } + case <-time.After(time.Second): + t.Fatal("Receive should have exited immediately after the client was closed, but it did not") + } +} + +func TestStreamingPull_RetriesAfterUnavailable(t *testing.T) { + ctx := context.Background() + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + + unavail := status.Error(codes.Unavailable, "There is no connection available") + server.addStreamingPullMessages(testMessages) + server.addStreamingPullError(unavail) + server.addAckResponse(unavail) + server.addModAckResponse(unavail) + server.addStreamingPullMessages(testMessages) + server.addStreamingPullError(unavail) + + sub := client.Subscription("S") + sub.ReceiveSettings.MaxOutstandingBytes = 1 + recvErr := make(chan error, 1) + recvdMsgs := make(chan *Message, len(testMessages)*2) + + go func() { + recvErr <- sub.Receive(ctx, func(_ context.Context, m *Message) { + m.Ack() + recvdMsgs <- m + }) + }() + + // wait for receive to happen + var n int + for { + select { + case <-time.After(10 * time.Second): + t.Fatalf("timed out waiting for all message to arrive. got %d messages total", n) + case err := <-recvErr: + t.Fatal(err) + case <-recvdMsgs: + n++ + if n == len(testMessages)*2 { + return + } + } + } +} + +func TestStreamingPull_ReconnectsAfterServerDies(t *testing.T) { + ctx := context.Background() + client, server := newMock(t) + defer server.srv.Close() + defer client.Close() + server.addStreamingPullMessages(testMessages) + sub := client.Subscription("S") + sub.ReceiveSettings.MaxOutstandingBytes = 1 + recvErr := make(chan error, 1) + recvdMsgs := make(chan interface{}, len(testMessages)*2) + + go func() { + recvErr <- sub.Receive(ctx, func(_ context.Context, m *Message) { + m.Ack() + recvdMsgs <- struct{}{} + }) + }() + + // wait for receive to happen + var n int + for { + select { + case <-time.After(5 * time.Second): + t.Fatalf("timed out waiting for all message to arrive. got %d messages total", n) + case err := <-recvErr: + t.Fatal(err) + case <-recvdMsgs: + n++ + if n == len(testMessages) { + // Restart the server + server.srv.Close() + server2, err := newMockServer(server.srv.Port) + if err != nil { + t.Fatal(err) + } + defer server2.srv.Close() + server2.addStreamingPullMessages(testMessages) + } + + if n == len(testMessages)*2 { + return + } + } + } +} + +func newMock(t *testing.T) (*Client, *mockServer) { + srv, err := newMockServer(0) + if err != nil { + t.Fatal(err) + } + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure()) + if err != nil { + t.Fatal(err) + } + client, err := NewClient(context.Background(), "P", option.WithGRPCConn(conn)) + if err != nil { + t.Fatal(err) + } + return client, srv +} + +// pullN calls sub.Receive until at least n messages are received. +func pullN(ctx context.Context, sub *Subscription, n int, f func(context.Context, *Message)) ([]*Message, error) { + var ( + mu sync.Mutex + msgs []*Message + ) + cctx, cancel := context.WithCancel(ctx) + err := sub.Receive(cctx, func(ctx context.Context, m *Message) { + mu.Lock() + msgs = append(msgs, m) + nSeen := len(msgs) + mu.Unlock() + f(ctx, m) + if nSeen >= n { + cancel() + } + }) + if err != nil { + return msgs, err + } + return msgs, nil +} diff --git a/vendor/cloud.google.com/go/pubsub/subscription.go b/vendor/cloud.google.com/go/pubsub/subscription.go new file mode 100644 index 000000000..09f9dbc49 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/subscription.go @@ -0,0 +1,587 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pubsub + +import ( + "context" + "errors" + "fmt" + "io" + "strings" + "sync" + "time" + + "cloud.google.com/go/iam" + "cloud.google.com/go/internal/optional" + "github.com/golang/protobuf/ptypes" + durpb "github.com/golang/protobuf/ptypes/duration" + gax "github.com/googleapis/gax-go" + "golang.org/x/sync/errgroup" + pb "google.golang.org/genproto/googleapis/pubsub/v1" + fmpb "google.golang.org/genproto/protobuf/field_mask" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +// Subscription is a reference to a PubSub subscription. +type Subscription struct { + c *Client + + // The fully qualified identifier for the subscription, in the format "projects//subscriptions/" + name string + + // Settings for pulling messages. Configure these before calling Receive. + ReceiveSettings ReceiveSettings + + mu sync.Mutex + receiveActive bool +} + +// Subscription creates a reference to a subscription. +func (c *Client) Subscription(id string) *Subscription { + return c.SubscriptionInProject(id, c.projectID) +} + +// SubscriptionInProject creates a reference to a subscription in a given project. +func (c *Client) SubscriptionInProject(id, projectID string) *Subscription { + return &Subscription{ + c: c, + name: fmt.Sprintf("projects/%s/subscriptions/%s", projectID, id), + } +} + +// String returns the globally unique printable name of the subscription. +func (s *Subscription) String() string { + return s.name +} + +// ID returns the unique identifier of the subscription within its project. +func (s *Subscription) ID() string { + slash := strings.LastIndex(s.name, "/") + if slash == -1 { + // name is not a fully-qualified name. + panic("bad subscription name") + } + return s.name[slash+1:] +} + +// Subscriptions returns an iterator which returns all of the subscriptions for the client's project. +func (c *Client) Subscriptions(ctx context.Context) *SubscriptionIterator { + it := c.subc.ListSubscriptions(ctx, &pb.ListSubscriptionsRequest{ + Project: c.fullyQualifiedProjectName(), + }) + return &SubscriptionIterator{ + c: c, + next: func() (string, error) { + sub, err := it.Next() + if err != nil { + return "", err + } + return sub.Name, nil + }, + } +} + +// SubscriptionIterator is an iterator that returns a series of subscriptions. +type SubscriptionIterator struct { + c *Client + next func() (string, error) +} + +// Next returns the next subscription. If there are no more subscriptions, iterator.Done will be returned. +func (subs *SubscriptionIterator) Next() (*Subscription, error) { + subName, err := subs.next() + if err != nil { + return nil, err + } + return &Subscription{c: subs.c, name: subName}, nil +} + +// PushConfig contains configuration for subscriptions that operate in push mode. +type PushConfig struct { + // A URL locating the endpoint to which messages should be pushed. + Endpoint string + + // Endpoint configuration attributes. See https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions#pushconfig for more details. + Attributes map[string]string +} + +func (pc *PushConfig) toProto() *pb.PushConfig { + return &pb.PushConfig{ + Attributes: pc.Attributes, + PushEndpoint: pc.Endpoint, + } +} + +// SubscriptionConfig describes the configuration of a subscription. +type SubscriptionConfig struct { + Topic *Topic + PushConfig PushConfig + + // The default maximum time after a subscriber receives a message before + // the subscriber should acknowledge the message. Note: messages which are + // obtained via Subscription.Receive need not be acknowledged within this + // deadline, as the deadline will be automatically extended. + AckDeadline time.Duration + + // Whether to retain acknowledged messages. If true, acknowledged messages + // will not be expunged until they fall out of the RetentionDuration window. + RetainAckedMessages bool + + // How long to retain messages in backlog, from the time of publish. If + // RetainAckedMessages is true, this duration affects the retention of + // acknowledged messages, otherwise only unacknowledged messages are retained. + // Defaults to 7 days. Cannot be longer than 7 days or shorter than 10 minutes. + RetentionDuration time.Duration + + // The set of labels for the subscription. + Labels map[string]string +} + +func (cfg *SubscriptionConfig) toProto(name string) *pb.Subscription { + var pbPushConfig *pb.PushConfig + if cfg.PushConfig.Endpoint != "" || len(cfg.PushConfig.Attributes) != 0 { + pbPushConfig = &pb.PushConfig{ + Attributes: cfg.PushConfig.Attributes, + PushEndpoint: cfg.PushConfig.Endpoint, + } + } + var retentionDuration *durpb.Duration + if cfg.RetentionDuration != 0 { + retentionDuration = ptypes.DurationProto(cfg.RetentionDuration) + } + return &pb.Subscription{ + Name: name, + Topic: cfg.Topic.name, + PushConfig: pbPushConfig, + AckDeadlineSeconds: trunc32(int64(cfg.AckDeadline.Seconds())), + RetainAckedMessages: cfg.RetainAckedMessages, + MessageRetentionDuration: retentionDuration, + Labels: cfg.Labels, + } +} + +func protoToSubscriptionConfig(pbSub *pb.Subscription, c *Client) (SubscriptionConfig, error) { + rd := time.Hour * 24 * 7 + var err error + if pbSub.MessageRetentionDuration != nil { + rd, err = ptypes.Duration(pbSub.MessageRetentionDuration) + if err != nil { + return SubscriptionConfig{}, err + } + } + return SubscriptionConfig{ + Topic: newTopic(c, pbSub.Topic), + AckDeadline: time.Second * time.Duration(pbSub.AckDeadlineSeconds), + PushConfig: PushConfig{ + Endpoint: pbSub.PushConfig.PushEndpoint, + Attributes: pbSub.PushConfig.Attributes, + }, + RetainAckedMessages: pbSub.RetainAckedMessages, + RetentionDuration: rd, + Labels: pbSub.Labels, + }, nil +} + +// ReceiveSettings configure the Receive method. +// A zero ReceiveSettings will result in values equivalent to DefaultReceiveSettings. +type ReceiveSettings struct { + // MaxExtension is the maximum period for which the Subscription should + // automatically extend the ack deadline for each message. + // + // The Subscription will automatically extend the ack deadline of all + // fetched Messages up to the duration specified. Automatic deadline + // extension beyond the initial receipt may be disabled by specifying a + // duration less than 0. + MaxExtension time.Duration + + // MaxOutstandingMessages is the maximum number of unprocessed messages + // (unacknowledged but not yet expired). If MaxOutstandingMessages is 0, it + // will be treated as if it were DefaultReceiveSettings.MaxOutstandingMessages. + // If the value is negative, then there will be no limit on the number of + // unprocessed messages. + MaxOutstandingMessages int + + // MaxOutstandingBytes is the maximum size of unprocessed messages + // (unacknowledged but not yet expired). If MaxOutstandingBytes is 0, it will + // be treated as if it were DefaultReceiveSettings.MaxOutstandingBytes. If + // the value is negative, then there will be no limit on the number of bytes + // for unprocessed messages. + MaxOutstandingBytes int + + // NumGoroutines is the number of goroutines Receive will spawn to pull + // messages concurrently. If NumGoroutines is less than 1, it will be treated + // as if it were DefaultReceiveSettings.NumGoroutines. + // + // NumGoroutines does not limit the number of messages that can be processed + // concurrently. Even with one goroutine, many messages might be processed at + // once, because that goroutine may continually receive messages and invoke the + // function passed to Receive on them. To limit the number of messages being + // processed concurrently, set MaxOutstandingMessages. + NumGoroutines int + + // If Synchronous is true, then no more than MaxOutstandingMessages will be in + // memory at one time. (In contrast, when Synchronous is false, more than + // MaxOutstandingMessages may have been received from the service and in memory + // before being processed.) MaxOutstandingBytes still refers to the total bytes + // processed, rather than in memory. NumGoroutines is ignored. + // The default is false. + Synchronous bool +} + +// For synchronous receive, the time to wait if we are already processing +// MaxOutstandingMessages. There is no point calling Pull and asking for zero +// messages, so we pause to allow some message-processing callbacks to finish. +// +// The wait time is large enough to avoid consuming significant CPU, but +// small enough to provide decent throughput. Users who want better +// throughput should not be using synchronous mode. +// +// Waiting might seem like polling, so it's natural to think we could do better by +// noticing when a callback is finished and immediately calling Pull. But if +// callbacks finish in quick succession, this will result in frequent Pull RPCs that +// request a single message, which wastes network bandwidth. Better to wait for a few +// callbacks to finish, so we make fewer RPCs fetching more messages. +// +// This value is unexported so the user doesn't have another knob to think about. Note that +// it is the same value as the one used for nackTicker, so it matches this client's +// idea of a duration that is short, but not so short that we perform excessive RPCs. +const synchronousWaitTime = 100 * time.Millisecond + +// This is a var so that tests can change it. +var minAckDeadline = 10 * time.Second + +// DefaultReceiveSettings holds the default values for ReceiveSettings. +var DefaultReceiveSettings = ReceiveSettings{ + MaxExtension: 10 * time.Minute, + MaxOutstandingMessages: 1000, + MaxOutstandingBytes: 1e9, // 1G + NumGoroutines: 1, +} + +// Delete deletes the subscription. +func (s *Subscription) Delete(ctx context.Context) error { + return s.c.subc.DeleteSubscription(ctx, &pb.DeleteSubscriptionRequest{Subscription: s.name}) +} + +// Exists reports whether the subscription exists on the server. +func (s *Subscription) Exists(ctx context.Context) (bool, error) { + _, err := s.c.subc.GetSubscription(ctx, &pb.GetSubscriptionRequest{Subscription: s.name}) + if err == nil { + return true, nil + } + if grpc.Code(err) == codes.NotFound { + return false, nil + } + return false, err +} + +// Config fetches the current configuration for the subscription. +func (s *Subscription) Config(ctx context.Context) (SubscriptionConfig, error) { + pbSub, err := s.c.subc.GetSubscription(ctx, &pb.GetSubscriptionRequest{Subscription: s.name}) + if err != nil { + return SubscriptionConfig{}, err + } + cfg, err := protoToSubscriptionConfig(pbSub, s.c) + if err != nil { + return SubscriptionConfig{}, err + } + return cfg, nil +} + +// SubscriptionConfigToUpdate describes how to update a subscription. +type SubscriptionConfigToUpdate struct { + // If non-nil, the push config is changed. + PushConfig *PushConfig + + // If non-zero, the ack deadline is changed. + AckDeadline time.Duration + + // If set, RetainAckedMessages is changed. + RetainAckedMessages optional.Bool + + // If non-zero, RetentionDuration is changed. + RetentionDuration time.Duration + + // If non-nil, the current set of labels is completely + // replaced by the new set. + // This field has beta status. It is not subject to the stability guarantee + // and may change. + Labels map[string]string +} + +// Update changes an existing subscription according to the fields set in cfg. +// It returns the new SubscriptionConfig. +// +// Update returns an error if no fields were modified. +func (s *Subscription) Update(ctx context.Context, cfg SubscriptionConfigToUpdate) (SubscriptionConfig, error) { + req := s.updateRequest(&cfg) + if len(req.UpdateMask.Paths) == 0 { + return SubscriptionConfig{}, errors.New("pubsub: UpdateSubscription call with nothing to update") + } + rpsub, err := s.c.subc.UpdateSubscription(ctx, req) + if err != nil { + return SubscriptionConfig{}, err + } + return protoToSubscriptionConfig(rpsub, s.c) +} + +func (s *Subscription) updateRequest(cfg *SubscriptionConfigToUpdate) *pb.UpdateSubscriptionRequest { + psub := &pb.Subscription{Name: s.name} + var paths []string + if cfg.PushConfig != nil { + psub.PushConfig = cfg.PushConfig.toProto() + paths = append(paths, "push_config") + } + if cfg.AckDeadline != 0 { + psub.AckDeadlineSeconds = trunc32(int64(cfg.AckDeadline.Seconds())) + paths = append(paths, "ack_deadline_seconds") + } + if cfg.RetainAckedMessages != nil { + psub.RetainAckedMessages = optional.ToBool(cfg.RetainAckedMessages) + paths = append(paths, "retain_acked_messages") + } + if cfg.RetentionDuration != 0 { + psub.MessageRetentionDuration = ptypes.DurationProto(cfg.RetentionDuration) + paths = append(paths, "message_retention_duration") + } + if cfg.Labels != nil { + psub.Labels = cfg.Labels + paths = append(paths, "labels") + } + return &pb.UpdateSubscriptionRequest{ + Subscription: psub, + UpdateMask: &fmpb.FieldMask{Paths: paths}, + } +} + +// IAM returns the subscription's IAM handle. +func (s *Subscription) IAM() *iam.Handle { + return iam.InternalNewHandle(s.c.subc.Connection(), s.name) +} + +// CreateSubscription creates a new subscription on a topic. +// +// id is the name of the subscription to create. It must start with a letter, +// and contain only letters ([A-Za-z]), numbers ([0-9]), dashes (-), +// underscores (_), periods (.), tildes (~), plus (+) or percent signs (%). It +// must be between 3 and 255 characters in length, and must not start with +// "goog". +// +// cfg.Topic is the topic from which the subscription should receive messages. It +// need not belong to the same project as the subscription. This field is required. +// +// cfg.AckDeadline is the maximum time after a subscriber receives a message before +// the subscriber should acknowledge the message. It must be between 10 and 600 +// seconds (inclusive), and is rounded down to the nearest second. If the +// provided ackDeadline is 0, then the default value of 10 seconds is used. +// Note: messages which are obtained via Subscription.Receive need not be +// acknowledged within this deadline, as the deadline will be automatically +// extended. +// +// cfg.PushConfig may be set to configure this subscription for push delivery. +// +// If the subscription already exists an error will be returned. +func (c *Client) CreateSubscription(ctx context.Context, id string, cfg SubscriptionConfig) (*Subscription, error) { + if cfg.Topic == nil { + return nil, errors.New("pubsub: require non-nil Topic") + } + if cfg.AckDeadline == 0 { + cfg.AckDeadline = 10 * time.Second + } + if d := cfg.AckDeadline; d < 10*time.Second || d > 600*time.Second { + return nil, fmt.Errorf("ack deadline must be between 10 and 600 seconds; got: %v", d) + } + + sub := c.Subscription(id) + _, err := c.subc.CreateSubscription(ctx, cfg.toProto(sub.name)) + if err != nil { + return nil, err + } + return sub, nil +} + +var errReceiveInProgress = errors.New("pubsub: Receive already in progress for this subscription") + +// Receive calls f with the outstanding messages from the subscription. +// It blocks until ctx is done, or the service returns a non-retryable error. +// +// The standard way to terminate a Receive is to cancel its context: +// +// cctx, cancel := context.WithCancel(ctx) +// err := sub.Receive(cctx, callback) +// // Call cancel from callback, or another goroutine. +// +// If the service returns a non-retryable error, Receive returns that error after +// all of the outstanding calls to f have returned. If ctx is done, Receive +// returns nil after all of the outstanding calls to f have returned and +// all messages have been acknowledged or have expired. +// +// Receive calls f concurrently from multiple goroutines. It is encouraged to +// process messages synchronously in f, even if that processing is relatively +// time-consuming; Receive will spawn new goroutines for incoming messages, +// limited by MaxOutstandingMessages and MaxOutstandingBytes in ReceiveSettings. +// +// The context passed to f will be canceled when ctx is Done or there is a +// fatal service error. +// +// Receive will send an ack deadline extension on message receipt, then +// automatically extend the ack deadline of all fetched Messages up to the +// period specified by s.ReceiveSettings.MaxExtension. +// +// Each Subscription may have only one invocation of Receive active at a time. +func (s *Subscription) Receive(ctx context.Context, f func(context.Context, *Message)) error { + s.mu.Lock() + if s.receiveActive { + s.mu.Unlock() + return errReceiveInProgress + } + s.receiveActive = true + s.mu.Unlock() + defer func() { s.mu.Lock(); s.receiveActive = false; s.mu.Unlock() }() + + maxCount := s.ReceiveSettings.MaxOutstandingMessages + if maxCount == 0 { + maxCount = DefaultReceiveSettings.MaxOutstandingMessages + } + maxBytes := s.ReceiveSettings.MaxOutstandingBytes + if maxBytes == 0 { + maxBytes = DefaultReceiveSettings.MaxOutstandingBytes + } + maxExt := s.ReceiveSettings.MaxExtension + if maxExt == 0 { + maxExt = DefaultReceiveSettings.MaxExtension + } else if maxExt < 0 { + // If MaxExtension is negative, disable automatic extension. + maxExt = 0 + } + var numGoroutines int + switch { + case s.ReceiveSettings.Synchronous: + numGoroutines = 1 + case s.ReceiveSettings.NumGoroutines >= 1: + numGoroutines = s.ReceiveSettings.NumGoroutines + default: + numGoroutines = DefaultReceiveSettings.NumGoroutines + } + // TODO(jba): add tests that verify that ReceiveSettings are correctly processed. + po := &pullOptions{ + maxExtension: maxExt, + maxPrefetch: trunc32(int64(maxCount)), + synchronous: s.ReceiveSettings.Synchronous, + } + fc := newFlowController(maxCount, maxBytes) + + // Wait for all goroutines started by Receive to return, so instead of an + // obscure goroutine leak we have an obvious blocked call to Receive. + group, gctx := errgroup.WithContext(ctx) + for i := 0; i < numGoroutines; i++ { + group.Go(func() error { + return s.receive(gctx, po, fc, f) + }) + } + return group.Wait() +} + +func (s *Subscription) receive(ctx context.Context, po *pullOptions, fc *flowController, f func(context.Context, *Message)) error { + // Cancel a sub-context when we return, to kick the context-aware callbacks + // and the goroutine below. + ctx2, cancel := context.WithCancel(ctx) + // The iterator does not use the context passed to Receive. If it did, canceling + // that context would immediately stop the iterator without waiting for unacked + // messages. + iter := newMessageIterator(s.c.subc, s.name, po) + + // We cannot use errgroup from Receive here. Receive might already be calling group.Wait, + // and group.Wait cannot be called concurrently with group.Go. We give each receive() its + // own WaitGroup instead. + // Since wg.Add is only called from the main goroutine, wg.Wait is guaranteed + // to be called after all Adds. + var wg sync.WaitGroup + wg.Add(1) + go func() { + <-ctx2.Done() + // Call stop when Receive's context is done. + // Stop will block until all outstanding messages have been acknowledged + // or there was a fatal service error. + iter.stop() + wg.Done() + }() + defer wg.Wait() + + defer cancel() + for { + var maxToPull int32 // maximum number of messages to pull + if po.synchronous { + if po.maxPrefetch < 0 { + // If there is no limit on the number of messages to pull, use a reasonable default. + maxToPull = 1000 + } else { + // Limit the number of messages in memory to MaxOutstandingMessages + // (here, po.maxPrefetch). For each message currently in memory, we have + // called fc.acquire but not fc.release: this is fc.count(). The next + // call to Pull should fetch no more than the difference between these + // values. + maxToPull = po.maxPrefetch - int32(fc.count()) + if maxToPull <= 0 { + // Wait for some callbacks to finish. + if err := gax.Sleep(ctx, synchronousWaitTime); err != nil { + // Return nil if the context is done, not err. + return nil + } + continue + } + } + } + msgs, err := iter.receive(maxToPull) + if err == io.EOF { + return nil + } + if err != nil { + return err + } + for i, msg := range msgs { + msg := msg + // TODO(jba): call acquire closer to when the message is allocated. + if err := fc.acquire(ctx, len(msg.Data)); err != nil { + // TODO(jba): test that these "orphaned" messages are nacked immediately when ctx is done. + for _, m := range msgs[i:] { + m.Nack() + } + // Return nil if the context is done, not err. + return nil + } + old := msg.doneFunc + msgLen := len(msg.Data) + msg.doneFunc = func(ackID string, ack bool, receiveTime time.Time) { + defer fc.release(msgLen) + old(ackID, ack, receiveTime) + } + wg.Add(1) + go func() { + defer wg.Done() + f(ctx2, msg) + }() + } + } +} + +type pullOptions struct { + maxExtension time.Duration + maxPrefetch int32 + // If true, use unary Pull instead of StreamingPull, and never pull more + // than maxPrefetch messages. + synchronous bool +} diff --git a/vendor/cloud.google.com/go/pubsub/subscription_test.go b/vendor/cloud.google.com/go/pubsub/subscription_test.go new file mode 100644 index 000000000..4ff5426ac --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/subscription_test.go @@ -0,0 +1,245 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pubsub + +import ( + "context" + "fmt" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/pubsub/pstest" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// All returns the remaining subscriptions from this iterator. +func slurpSubs(it *SubscriptionIterator) ([]*Subscription, error) { + var subs []*Subscription + for { + switch sub, err := it.Next(); err { + case nil: + subs = append(subs, sub) + case iterator.Done: + return subs, nil + default: + return nil, err + } + } +} + +func TestSubscriptionID(t *testing.T) { + const id = "id" + c := &Client{projectID: "projid"} + s := c.Subscription(id) + if got, want := s.ID(), id; got != want { + t.Errorf("Subscription.ID() = %q; want %q", got, want) + } +} + +func TestListProjectSubscriptions(t *testing.T) { + ctx := context.Background() + c, srv := newFake(t) + defer c.Close() + defer srv.Close() + + topic := mustCreateTopic(t, c, "t") + var want []string + for i := 1; i <= 2; i++ { + id := fmt.Sprintf("s%d", i) + want = append(want, id) + _, err := c.CreateSubscription(ctx, id, SubscriptionConfig{Topic: topic}) + if err != nil { + t.Fatal(err) + } + } + subs, err := slurpSubs(c.Subscriptions(ctx)) + if err != nil { + t.Fatal(err) + } + + got := getSubIDs(subs) + if !testutil.Equal(got, want) { + t.Errorf("got %v, want %v", got, want) + } +} + +func getSubIDs(subs []*Subscription) []string { + var names []string + for _, sub := range subs { + names = append(names, sub.ID()) + } + return names +} + +func TestListTopicSubscriptions(t *testing.T) { + ctx := context.Background() + c, srv := newFake(t) + defer c.Close() + defer srv.Close() + + topics := []*Topic{ + mustCreateTopic(t, c, "t0"), + mustCreateTopic(t, c, "t1"), + } + wants := make([][]string, 2) + for i := 0; i < 5; i++ { + id := fmt.Sprintf("s%d", i) + sub, err := c.CreateSubscription(ctx, id, SubscriptionConfig{Topic: topics[i%2]}) + if err != nil { + t.Fatal(err) + } + wants[i%2] = append(wants[i%2], sub.ID()) + } + + for i, topic := range topics { + subs, err := slurpSubs(topic.Subscriptions(ctx)) + if err != nil { + t.Fatal(err) + } + got := getSubIDs(subs) + if !testutil.Equal(got, wants[i]) { + t.Errorf("#%d: got %v, want %v", i, got, wants[i]) + } + } +} + +const defaultRetentionDuration = 168 * time.Hour + +func TestUpdateSubscription(t *testing.T) { + ctx := context.Background() + client, srv := newFake(t) + defer client.Close() + defer srv.Close() + + topic := mustCreateTopic(t, client, "t") + sub, err := client.CreateSubscription(ctx, "s", SubscriptionConfig{Topic: topic}) + if err != nil { + t.Fatal(err) + } + cfg, err := sub.Config(ctx) + if err != nil { + t.Fatal(err) + } + want := SubscriptionConfig{ + Topic: topic, + AckDeadline: 10 * time.Second, + RetainAckedMessages: false, + RetentionDuration: defaultRetentionDuration, + } + if !testutil.Equal(cfg, want) { + t.Fatalf("\ngot %+v\nwant %+v", cfg, want) + } + + got, err := sub.Update(ctx, SubscriptionConfigToUpdate{ + AckDeadline: 20 * time.Second, + RetainAckedMessages: true, + Labels: map[string]string{"label": "value"}, + }) + if err != nil { + t.Fatal(err) + } + want = SubscriptionConfig{ + Topic: topic, + AckDeadline: 20 * time.Second, + RetainAckedMessages: true, + RetentionDuration: defaultRetentionDuration, + Labels: map[string]string{"label": "value"}, + } + if !testutil.Equal(got, want) { + t.Fatalf("\ngot %+v\nwant %+v", got, want) + } + + got, err = sub.Update(ctx, SubscriptionConfigToUpdate{ + RetentionDuration: 2 * time.Hour, + Labels: map[string]string{}, + }) + if err != nil { + t.Fatal(err) + } + want.RetentionDuration = 2 * time.Hour + want.Labels = nil + if !testutil.Equal(got, want) { + t.Fatalf("\ngot %+v\nwant %+v", got, want) + } + + _, err = sub.Update(ctx, SubscriptionConfigToUpdate{}) + if err == nil { + t.Fatal("got nil, want error") + } +} + +func TestReceive(t *testing.T) { + testReceive(t, true) + testReceive(t, false) +} + +func testReceive(t *testing.T, synchronous bool) { + ctx := context.Background() + client, srv := newFake(t) + defer client.Close() + defer srv.Close() + + topic := mustCreateTopic(t, client, "t") + sub, err := client.CreateSubscription(ctx, "s", SubscriptionConfig{Topic: topic}) + if err != nil { + t.Fatal(err) + } + for i := 0; i < 256; i++ { + srv.Publish(topic.name, []byte{byte(i)}, nil) + } + sub.ReceiveSettings.Synchronous = synchronous + msgs, err := pullN(ctx, sub, 256, func(_ context.Context, m *Message) { m.Ack() }) + if c := status.Convert(err); err != nil && c.Code() != codes.Canceled { + t.Fatalf("Pull: %v", err) + } + var seen [256]bool + for _, m := range msgs { + seen[m.Data[0]] = true + } + for i, saw := range seen { + if !saw { + t.Errorf("sync=%t: did not see message #%d", synchronous, i) + } + } +} + +func (t1 *Topic) Equal(t2 *Topic) bool { + if t1 == nil && t2 == nil { + return true + } + if t1 == nil || t2 == nil { + return false + } + return t1.c == t2.c && t1.name == t2.name +} + +// Note: be sure to close client and server! +func newFake(t *testing.T) (*Client, *pstest.Server) { + ctx := context.Background() + srv := pstest.NewServer() + client, err := NewClient(ctx, "P", + option.WithEndpoint(srv.Addr), + option.WithoutAuthentication(), + option.WithGRPCDialOption(grpc.WithInsecure())) + if err != nil { + t.Fatal(err) + } + return client, srv +} diff --git a/vendor/cloud.google.com/go/pubsub/timeout_test.go b/vendor/cloud.google.com/go/pubsub/timeout_test.go new file mode 100644 index 000000000..3418011d6 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/timeout_test.go @@ -0,0 +1,93 @@ +// 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. + +package pubsub + +import ( + "context" + "log" + "sync/atomic" + "testing" + "time" + + "cloud.google.com/go/pubsub/pstest" + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +// Using the fake PubSub server in the pstest package, verify that streaming +// pull resumes if the server stream times out. +func TestStreamTimeout(t *testing.T) { + t.Parallel() + log.SetFlags(log.Lmicroseconds) + ctx := context.Background() + srv := pstest.NewServer() + defer srv.Close() + + srv.SetStreamTimeout(2 * time.Second) + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure()) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + + client, err := NewClient(ctx, "P", option.WithGRPCConn(conn)) + if err != nil { + t.Fatal(err) + } + defer client.Close() + + topic, err := client.CreateTopic(ctx, "T") + if err != nil { + t.Fatal(err) + } + sub, err := client.CreateSubscription(ctx, "sub", SubscriptionConfig{Topic: topic, AckDeadline: 10 * time.Second}) + if err != nil { + t.Fatal(err) + } + const nPublish = 8 + rctx, cancel := context.WithTimeout(ctx, 30*time.Second) + defer cancel() + errc := make(chan error) + var nSeen int64 + go func() { + errc <- sub.Receive(rctx, func(ctx context.Context, m *Message) { + m.Ack() + n := atomic.AddInt64(&nSeen, 1) + if n >= nPublish { + cancel() + } + }) + }() + + for i := 0; i < nPublish; i++ { + pr := topic.Publish(ctx, &Message{Data: []byte("msg")}) + _, err := pr.Get(ctx) + if err != nil { + t.Fatal(err) + } + time.Sleep(250 * time.Millisecond) + } + + if err := <-errc; err != nil { + t.Fatal(err) + } + if err := sub.Delete(ctx); err != nil { + t.Fatal(err) + } + n := atomic.LoadInt64(&nSeen) + if n < nPublish { + t.Errorf("got %d messages, want %d", n, nPublish) + } +} diff --git a/vendor/cloud.google.com/go/pubsub/topic.go b/vendor/cloud.google.com/go/pubsub/topic.go new file mode 100644 index 000000000..a9dc97e21 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/topic.go @@ -0,0 +1,463 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pubsub + +import ( + "context" + "errors" + "fmt" + "runtime" + "strings" + "sync" + "time" + + "cloud.google.com/go/iam" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/support/bundler" + pb "google.golang.org/genproto/googleapis/pubsub/v1" + fmpb "google.golang.org/genproto/protobuf/field_mask" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +const ( + // MaxPublishRequestCount is the maximum number of messages that can be in a single publish request, as + // defined by the PubSub service. + MaxPublishRequestCount = 1000 + + // MaxPublishRequestBytes is the maximum size of a single publish request in bytes, as defined by the PubSub + // service. + MaxPublishRequestBytes = 1e7 + + maxInt = int(^uint(0) >> 1) +) + +// ErrOversizedMessage indicates that a message's size exceeds MaxPublishRequestBytes. +var ErrOversizedMessage = bundler.ErrOversizedItem + +// Topic is a reference to a PubSub topic. +// +// The methods of Topic are safe for use by multiple goroutines. +type Topic struct { + c *Client + // The fully qualified identifier for the topic, in the format "projects//topics/" + name string + + // Settings for publishing messages. All changes must be made before the + // first call to Publish. The default is DefaultPublishSettings. + PublishSettings PublishSettings + + mu sync.RWMutex + stopped bool + bundler *bundler.Bundler + + wg sync.WaitGroup +} + +// PublishSettings control the bundling of published messages. +type PublishSettings struct { + + // Publish a non-empty batch after this delay has passed. + DelayThreshold time.Duration + + // Publish a batch when it has this many messages. The maximum is + // MaxPublishRequestCount. + CountThreshold int + + // Publish a batch when its size in bytes reaches this value. + ByteThreshold int + + // The number of goroutines that invoke the Publish RPC concurrently. + // Defaults to a multiple of GOMAXPROCS. + NumGoroutines int + + // The maximum time that the client will attempt to publish a bundle of messages. + Timeout time.Duration +} + +// DefaultPublishSettings holds the default values for topics' PublishSettings. +var DefaultPublishSettings = PublishSettings{ + DelayThreshold: 1 * time.Millisecond, + CountThreshold: 100, + ByteThreshold: 1e6, + Timeout: 60 * time.Second, +} + +// CreateTopic creates a new topic. +// The specified topic ID must start with a letter, and contain only letters +// ([A-Za-z]), numbers ([0-9]), dashes (-), underscores (_), periods (.), +// tildes (~), plus (+) or percent signs (%). It must be between 3 and 255 +// characters in length, and must not start with "goog". +// If the topic already exists an error will be returned. +func (c *Client) CreateTopic(ctx context.Context, id string) (*Topic, error) { + t := c.Topic(id) + _, err := c.pubc.CreateTopic(ctx, &pb.Topic{Name: t.name}) + if err != nil { + return nil, err + } + return t, nil +} + +// Topic creates a reference to a topic in the client's project. +// +// If a Topic's Publish method is called, it has background goroutines +// associated with it. Clean them up by calling Topic.Stop. +// +// Avoid creating many Topic instances if you use them to publish. +func (c *Client) Topic(id string) *Topic { + return c.TopicInProject(id, c.projectID) +} + +// TopicInProject creates a reference to a topic in the given project. +// +// If a Topic's Publish method is called, it has background goroutines +// associated with it. Clean them up by calling Topic.Stop. +// +// Avoid creating many Topic instances if you use them to publish. +func (c *Client) TopicInProject(id, projectID string) *Topic { + return newTopic(c, fmt.Sprintf("projects/%s/topics/%s", projectID, id)) +} + +func newTopic(c *Client, name string) *Topic { + return &Topic{ + c: c, + name: name, + PublishSettings: DefaultPublishSettings, + } +} + +// TopicConfig describes the configuration of a topic. +type TopicConfig struct { + // The set of labels for the topic. + Labels map[string]string + // The topic's message storage policy. + MessageStoragePolicy MessageStoragePolicy +} + +// TopicConfigToUpdate describes how to update a topic. +type TopicConfigToUpdate struct { + // If non-nil, the current set of labels is completely + // replaced by the new set. + // This field has beta status. It is not subject to the stability guarantee + // and may change. + Labels map[string]string +} + +func protoToTopicConfig(pbt *pb.Topic) TopicConfig { + return TopicConfig{ + Labels: pbt.Labels, + MessageStoragePolicy: protoToMessageStoragePolicy(pbt.MessageStoragePolicy), + } +} + +// MessageStoragePolicy constrains how messages published to the topic may be stored. It +// is determined when the topic is created based on the policy configured at +// the project level. +type MessageStoragePolicy struct { + // The list of GCP regions where messages that are published to the topic may + // be persisted in storage. Messages published by publishers running in + // non-allowed GCP regions (or running outside of GCP altogether) will be + // routed for storage in one of the allowed regions. An empty list indicates a + // misconfiguration at the project or organization level, which will result in + // all Publish operations failing. + AllowedPersistenceRegions []string +} + +func protoToMessageStoragePolicy(msp *pb.MessageStoragePolicy) MessageStoragePolicy { + if msp == nil { + return MessageStoragePolicy{} + } + return MessageStoragePolicy{AllowedPersistenceRegions: msp.AllowedPersistenceRegions} +} + +// Config returns the TopicConfig for the topic. +func (t *Topic) Config(ctx context.Context) (TopicConfig, error) { + pbt, err := t.c.pubc.GetTopic(ctx, &pb.GetTopicRequest{Topic: t.name}) + if err != nil { + return TopicConfig{}, err + } + return protoToTopicConfig(pbt), nil +} + +// Update changes an existing topic according to the fields set in cfg. It returns +// the new TopicConfig. +// +// Any call to Update (even with an empty TopicConfigToUpdate) will update the +// MessageStoragePolicy for the topic from the organization's settings. +func (t *Topic) Update(ctx context.Context, cfg TopicConfigToUpdate) (TopicConfig, error) { + req := t.updateRequest(cfg) + if len(req.UpdateMask.Paths) == 0 { + return TopicConfig{}, errors.New("pubsub: UpdateTopic call with nothing to update") + } + rpt, err := t.c.pubc.UpdateTopic(ctx, req) + if err != nil { + return TopicConfig{}, err + } + return protoToTopicConfig(rpt), nil +} + +func (t *Topic) updateRequest(cfg TopicConfigToUpdate) *pb.UpdateTopicRequest { + pt := &pb.Topic{Name: t.name} + paths := []string{"message_storage_policy"} // always fetch + if cfg.Labels != nil { + pt.Labels = cfg.Labels + paths = append(paths, "labels") + } + return &pb.UpdateTopicRequest{ + Topic: pt, + UpdateMask: &fmpb.FieldMask{Paths: paths}, + } +} + +// Topics returns an iterator which returns all of the topics for the client's project. +func (c *Client) Topics(ctx context.Context) *TopicIterator { + it := c.pubc.ListTopics(ctx, &pb.ListTopicsRequest{Project: c.fullyQualifiedProjectName()}) + return &TopicIterator{ + c: c, + next: func() (string, error) { + topic, err := it.Next() + if err != nil { + return "", err + } + return topic.Name, nil + }, + } +} + +// TopicIterator is an iterator that returns a series of topics. +type TopicIterator struct { + c *Client + next func() (string, error) +} + +// Next returns the next topic. If there are no more topics, iterator.Done will be returned. +func (tps *TopicIterator) Next() (*Topic, error) { + topicName, err := tps.next() + if err != nil { + return nil, err + } + return newTopic(tps.c, topicName), nil +} + +// ID returns the unique identifier of the topic within its project. +func (t *Topic) ID() string { + slash := strings.LastIndex(t.name, "/") + if slash == -1 { + // name is not a fully-qualified name. + panic("bad topic name") + } + return t.name[slash+1:] +} + +// String returns the printable globally unique name for the topic. +func (t *Topic) String() string { + return t.name +} + +// Delete deletes the topic. +func (t *Topic) Delete(ctx context.Context) error { + return t.c.pubc.DeleteTopic(ctx, &pb.DeleteTopicRequest{Topic: t.name}) +} + +// Exists reports whether the topic exists on the server. +func (t *Topic) Exists(ctx context.Context) (bool, error) { + if t.name == "_deleted-topic_" { + return false, nil + } + _, err := t.c.pubc.GetTopic(ctx, &pb.GetTopicRequest{Topic: t.name}) + if err == nil { + return true, nil + } + if grpc.Code(err) == codes.NotFound { + return false, nil + } + return false, err +} + +// IAM returns the topic's IAM handle. +func (t *Topic) IAM() *iam.Handle { + return iam.InternalNewHandle(t.c.pubc.Connection(), t.name) +} + +// Subscriptions returns an iterator which returns the subscriptions for this topic. +// +// Some of the returned subscriptions may belong to a project other than t. +func (t *Topic) Subscriptions(ctx context.Context) *SubscriptionIterator { + it := t.c.pubc.ListTopicSubscriptions(ctx, &pb.ListTopicSubscriptionsRequest{ + Topic: t.name, + }) + return &SubscriptionIterator{ + c: t.c, + next: it.Next, + } +} + +var errTopicStopped = errors.New("pubsub: Stop has been called for this topic") + +// Publish publishes msg to the topic asynchronously. Messages are batched and +// sent according to the topic's PublishSettings. Publish never blocks. +// +// Publish returns a non-nil PublishResult which will be ready when the +// message has been sent (or has failed to be sent) to the server. +// +// Publish creates goroutines for batching and sending messages. These goroutines +// need to be stopped by calling t.Stop(). Once stopped, future calls to Publish +// will immediately return a PublishResult with an error. +func (t *Topic) Publish(ctx context.Context, msg *Message) *PublishResult { + // TODO(jba): if this turns out to take significant time, try to approximate it. + // Or, convert the messages to protos in Publish, instead of in the service. + msg.size = proto.Size(&pb.PubsubMessage{ + Data: msg.Data, + Attributes: msg.Attributes, + }) + r := &PublishResult{ready: make(chan struct{})} + t.initBundler() + t.mu.RLock() + defer t.mu.RUnlock() + // TODO(aboulhosn) [from bcmills] consider changing the semantics of bundler to perform this logic so we don't have to do it here + if t.stopped { + r.set("", errTopicStopped) + return r + } + + // TODO(jba) [from bcmills] consider using a shared channel per bundle + // (requires Bundler API changes; would reduce allocations) + // The call to Add should never return an error because the bundler's + // BufferedByteLimit is set to maxInt; we do not perform any flow + // control in the client. + err := t.bundler.Add(&bundledMessage{msg, r}, msg.size) + if err != nil { + r.set("", err) + } + return r +} + +// Stop sends all remaining published messages and stop goroutines created for handling +// publishing. Returns once all outstanding messages have been sent or have +// failed to be sent. +func (t *Topic) Stop() { + t.mu.Lock() + noop := t.stopped || t.bundler == nil + t.stopped = true + t.mu.Unlock() + if noop { + return + } + t.bundler.Flush() +} + +// A PublishResult holds the result from a call to Publish. +type PublishResult struct { + ready chan struct{} + serverID string + err error +} + +// Ready returns a channel that is closed when the result is ready. +// When the Ready channel is closed, Get is guaranteed not to block. +func (r *PublishResult) Ready() <-chan struct{} { return r.ready } + +// Get returns the server-generated message ID and/or error result of a Publish call. +// Get blocks until the Publish call completes or the context is done. +func (r *PublishResult) Get(ctx context.Context) (serverID string, err error) { + // If the result is already ready, return it even if the context is done. + select { + case <-r.Ready(): + return r.serverID, r.err + default: + } + select { + case <-ctx.Done(): + return "", ctx.Err() + case <-r.Ready(): + return r.serverID, r.err + } +} + +func (r *PublishResult) set(sid string, err error) { + r.serverID = sid + r.err = err + close(r.ready) +} + +type bundledMessage struct { + msg *Message + res *PublishResult +} + +func (t *Topic) initBundler() { + t.mu.RLock() + noop := t.stopped || t.bundler != nil + t.mu.RUnlock() + if noop { + return + } + t.mu.Lock() + defer t.mu.Unlock() + // Must re-check, since we released the lock. + if t.stopped || t.bundler != nil { + return + } + + timeout := t.PublishSettings.Timeout + t.bundler = bundler.NewBundler(&bundledMessage{}, func(items interface{}) { + // TODO(jba): use a context detached from the one passed to NewClient. + ctx := context.TODO() + if timeout != 0 { + var cancel func() + ctx, cancel = context.WithTimeout(ctx, timeout) + defer cancel() + } + t.publishMessageBundle(ctx, items.([]*bundledMessage)) + }) + t.bundler.DelayThreshold = t.PublishSettings.DelayThreshold + t.bundler.BundleCountThreshold = t.PublishSettings.CountThreshold + if t.bundler.BundleCountThreshold > MaxPublishRequestCount { + t.bundler.BundleCountThreshold = MaxPublishRequestCount + } + t.bundler.BundleByteThreshold = t.PublishSettings.ByteThreshold + t.bundler.BufferedByteLimit = maxInt + t.bundler.BundleByteLimit = MaxPublishRequestBytes + // Unless overridden, allow many goroutines per CPU to call the Publish RPC concurrently. + // The default value was determined via extensive load testing (see the loadtest subdirectory). + if t.PublishSettings.NumGoroutines > 0 { + t.bundler.HandlerLimit = t.PublishSettings.NumGoroutines + } else { + t.bundler.HandlerLimit = 25 * runtime.GOMAXPROCS(0) + } +} + +func (t *Topic) publishMessageBundle(ctx context.Context, bms []*bundledMessage) { + pbMsgs := make([]*pb.PubsubMessage, len(bms)) + for i, bm := range bms { + pbMsgs[i] = &pb.PubsubMessage{ + Data: bm.msg.Data, + Attributes: bm.msg.Attributes, + } + bm.msg = nil // release bm.msg for GC + } + res, err := t.c.pubc.Publish(ctx, &pb.PublishRequest{ + Topic: t.name, + Messages: pbMsgs, + }, gax.WithGRPCOptions(grpc.MaxCallSendMsgSize(maxSendRecvBytes))) + for i, bm := range bms { + if err != nil { + bm.res.set("", err) + } else { + bm.res.set(res.MessageIds[i], nil) + } + } +} diff --git a/vendor/cloud.google.com/go/pubsub/topic_test.go b/vendor/cloud.google.com/go/pubsub/topic_test.go new file mode 100644 index 000000000..d6cd0ecf4 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/topic_test.go @@ -0,0 +1,195 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pubsub + +import ( + "context" + "fmt" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func checkTopicListing(t *testing.T, c *Client, want []string) { + topics, err := slurpTopics(c.Topics(context.Background())) + if err != nil { + t.Fatalf("error listing topics: %v", err) + } + var got []string + for _, topic := range topics { + got = append(got, topic.ID()) + } + if !testutil.Equal(got, want) { + t.Errorf("topic list: got: %v, want: %v", got, want) + } +} + +// All returns the remaining topics from this iterator. +func slurpTopics(it *TopicIterator) ([]*Topic, error) { + var topics []*Topic + for { + switch topic, err := it.Next(); err { + case nil: + topics = append(topics, topic) + case iterator.Done: + return topics, nil + default: + return nil, err + } + } +} + +func TestTopicID(t *testing.T) { + const id = "id" + c, srv := newFake(t) + defer c.Close() + defer srv.Close() + + s := c.Topic(id) + if got, want := s.ID(), id; got != want { + t.Errorf("Token.ID() = %q; want %q", got, want) + } +} + +func TestListTopics(t *testing.T) { + c, srv := newFake(t) + defer c.Close() + defer srv.Close() + + var ids []string + for i := 1; i <= 4; i++ { + id := fmt.Sprintf("t%d", i) + ids = append(ids, id) + mustCreateTopic(t, c, id) + } + checkTopicListing(t, c, ids) +} + +func TestListCompletelyEmptyTopics(t *testing.T) { + c, srv := newFake(t) + defer c.Close() + defer srv.Close() + + checkTopicListing(t, c, nil) +} + +func TestStopPublishOrder(t *testing.T) { + // Check that Stop doesn't panic if called before Publish. + // Also that Publish after Stop returns the right error. + ctx := context.Background() + c := &Client{projectID: "projid"} + topic := c.Topic("t") + topic.Stop() + r := topic.Publish(ctx, &Message{}) + _, err := r.Get(ctx) + if err != errTopicStopped { + t.Errorf("got %v, want errTopicStopped", err) + } +} + +func TestPublishTimeout(t *testing.T) { + ctx := context.Background() + serv, err := testutil.NewServer() + if err != nil { + t.Fatal(err) + } + pubsubpb.RegisterPublisherServer(serv.Gsrv, &alwaysFailPublish{}) + conn, err := grpc.Dial(serv.Addr, grpc.WithInsecure()) + if err != nil { + t.Fatal(err) + } + c, err := NewClient(ctx, "projectID", option.WithGRPCConn(conn)) + if err != nil { + t.Fatal(err) + } + topic := c.Topic("t") + topic.PublishSettings.Timeout = 3 * time.Second + r := topic.Publish(ctx, &Message{}) + defer topic.Stop() + select { + case <-r.Ready(): + _, err = r.Get(ctx) + if err != context.DeadlineExceeded { + t.Fatalf("got %v, want context.DeadlineExceeded", err) + } + case <-time.After(2 * topic.PublishSettings.Timeout): + t.Fatal("timed out") + } +} + +func TestUpdateTopic(t *testing.T) { + ctx := context.Background() + client, srv := newFake(t) + defer client.Close() + defer srv.Close() + + topic := mustCreateTopic(t, client, "T") + config, err := topic.Config(ctx) + if err != nil { + t.Fatal(err) + } + want := TopicConfig{} + if !testutil.Equal(config, want) { + t.Errorf("got %+v, want %+v", config, want) + } + + // replace labels + labels := map[string]string{"label": "value"} + config2, err := topic.Update(ctx, TopicConfigToUpdate{Labels: labels}) + if err != nil { + t.Fatal(err) + } + want = TopicConfig{ + Labels: labels, + MessageStoragePolicy: MessageStoragePolicy{[]string{"US"}}, + } + if !testutil.Equal(config2, want) { + t.Errorf("got %+v, want %+v", config2, want) + } + + // delete all labels + labels = map[string]string{} + config3, err := topic.Update(ctx, TopicConfigToUpdate{Labels: labels}) + if err != nil { + t.Fatal(err) + } + want.Labels = nil + if !testutil.Equal(config3, want) { + t.Errorf("got %+v, want %+v", config3, want) + } +} + +type alwaysFailPublish struct { + pubsubpb.PublisherServer +} + +func (s *alwaysFailPublish) Publish(ctx context.Context, req *pubsubpb.PublishRequest) (*pubsubpb.PublishResponse, error) { + return nil, status.Errorf(codes.Unavailable, "try again") +} + +func mustCreateTopic(t *testing.T, c *Client, id string) *Topic { + topic, err := c.CreateTopic(context.Background(), id) + if err != nil { + t.Fatal(err) + } + return topic +} diff --git a/vendor/cloud.google.com/go/pubsub/trace.go b/vendor/cloud.google.com/go/pubsub/trace.go new file mode 100644 index 000000000..06965c2a2 --- /dev/null +++ b/vendor/cloud.google.com/go/pubsub/trace.go @@ -0,0 +1,157 @@ +// 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. + +package pubsub + +import ( + "context" + "log" + "sync" + + "go.opencensus.io/plugin/ocgrpc" + "go.opencensus.io/stats" + "go.opencensus.io/stats/view" + "go.opencensus.io/tag" + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +func openCensusOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithGRPCDialOption(grpc.WithStatsHandler(&ocgrpc.ClientHandler{})), + } +} + +var subscriptionKey tag.Key + +func init() { + var err error + if subscriptionKey, err = tag.NewKey("subscription"); err != nil { + log.Fatal("cannot create 'subscription' key") + } +} + +const statsPrefix = "cloud.google.com/go/pubsub/" + +var ( + // PullCount is a measure of the number of messages pulled. + // It is EXPERIMENTAL and subject to change or removal without notice. + PullCount = stats.Int64(statsPrefix+"pull_count", "Number of PubSub messages pulled", stats.UnitDimensionless) + + // AckCount is a measure of the number of messages acked. + // It is EXPERIMENTAL and subject to change or removal without notice. + AckCount = stats.Int64(statsPrefix+"ack_count", "Number of PubSub messages acked", stats.UnitDimensionless) + + // NackCount is a measure of the number of messages nacked. + // It is EXPERIMENTAL and subject to change or removal without notice. + NackCount = stats.Int64(statsPrefix+"nack_count", "Number of PubSub messages nacked", stats.UnitDimensionless) + + // ModAckCount is a measure of the number of messages whose ack-deadline was modified. + // It is EXPERIMENTAL and subject to change or removal without notice. + ModAckCount = stats.Int64(statsPrefix+"mod_ack_count", "Number of ack-deadlines modified", stats.UnitDimensionless) + + // ModAckTimeoutCount is a measure of the number ModifyAckDeadline RPCs that timed out. + // It is EXPERIMENTAL and subject to change or removal without notice. + ModAckTimeoutCount = stats.Int64(statsPrefix+"mod_ack_timeout_count", "Number of ModifyAckDeadline RPCs that timed out", stats.UnitDimensionless) + + // StreamOpenCount is a measure of the number of times a streaming-pull stream was opened. + // It is EXPERIMENTAL and subject to change or removal without notice. + StreamOpenCount = stats.Int64(statsPrefix+"stream_open_count", "Number of calls opening a new streaming pull", stats.UnitDimensionless) + + // StreamRetryCount is a measure of the number of times a streaming-pull operation was retried. + // It is EXPERIMENTAL and subject to change or removal without notice. + StreamRetryCount = stats.Int64(statsPrefix+"stream_retry_count", "Number of retries of a stream send or receive", stats.UnitDimensionless) + + // StreamRequestCount is a measure of the number of requests sent on a streaming-pull stream. + // It is EXPERIMENTAL and subject to change or removal without notice. + StreamRequestCount = stats.Int64(statsPrefix+"stream_request_count", "Number gRPC StreamingPull request messages sent", stats.UnitDimensionless) + + // StreamResponseCount is a measure of the number of responses received on a streaming-pull stream. + // It is EXPERIMENTAL and subject to change or removal without notice. + StreamResponseCount = stats.Int64(statsPrefix+"stream_response_count", "Number of gRPC StreamingPull response messages received", stats.UnitDimensionless) + + // PullCountView is a cumulative sum of PullCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + PullCountView *view.View + + // AckCountView is a cumulative sum of AckCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + AckCountView *view.View + + // NackCountView is a cumulative sum of NackCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + NackCountView *view.View + + // ModAckCountView is a cumulative sum of ModAckCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + ModAckCountView *view.View + + // ModAckTimeoutCountView is a cumulative sum of ModAckTimeoutCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + ModAckTimeoutCountView *view.View + + // StreamOpenCountView is a cumulative sum of StreamOpenCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + StreamOpenCountView *view.View + + // StreamRetryCountView is a cumulative sum of StreamRetryCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + StreamRetryCountView *view.View + + // StreamRequestCountView is a cumulative sum of StreamRequestCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + StreamRequestCountView *view.View + + // StreamResponseCountView is a cumulative sum of StreamResponseCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + StreamResponseCountView *view.View +) + +func init() { + PullCountView = countView(PullCount) + AckCountView = countView(AckCount) + NackCountView = countView(NackCount) + ModAckCountView = countView(ModAckCount) + ModAckTimeoutCountView = countView(ModAckTimeoutCount) + StreamOpenCountView = countView(StreamOpenCount) + StreamRetryCountView = countView(StreamRetryCount) + StreamRequestCountView = countView(StreamRequestCount) + StreamResponseCountView = countView(StreamResponseCount) +} + +func countView(m *stats.Int64Measure) *view.View { + return &view.View{ + Name: m.Name(), + Description: m.Description(), + TagKeys: []tag.Key{subscriptionKey}, + Measure: m, + Aggregation: view.Sum(), + } +} + +var logOnce sync.Once + +func withSubscriptionKey(ctx context.Context, subName string) context.Context { + ctx, err := tag.New(ctx, tag.Upsert(subscriptionKey, subName)) + if err != nil { + logOnce.Do(func() { + log.Printf("pubsub: error creating tag map: %v", err) + }) + } + return ctx +} + +func recordStat(ctx context.Context, m *stats.Int64Measure, n int64) { + stats.Record(ctx, m.M(n)) +} diff --git a/vendor/cloud.google.com/go/redis/apiv1/cloud_redis_client.go b/vendor/cloud.google.com/go/redis/apiv1/cloud_redis_client.go new file mode 100644 index 000000000..e7d421cb6 --- /dev/null +++ b/vendor/cloud.google.com/go/redis/apiv1/cloud_redis_client.go @@ -0,0 +1,519 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package redis + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + redispb "google.golang.org/genproto/googleapis/cloud/redis/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +// CloudRedisCallOptions contains the retry settings for each method of CloudRedisClient. +type CloudRedisCallOptions struct { + ListInstances []gax.CallOption + GetInstance []gax.CallOption + CreateInstance []gax.CallOption + UpdateInstance []gax.CallOption + DeleteInstance []gax.CallOption +} + +func defaultCloudRedisClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("redis.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCloudRedisCallOptions() *CloudRedisCallOptions { + retry := map[[2]string][]gax.CallOption{} + return &CloudRedisCallOptions{ + ListInstances: retry[[2]string{"default", "non_idempotent"}], + GetInstance: retry[[2]string{"default", "non_idempotent"}], + CreateInstance: retry[[2]string{"default", "non_idempotent"}], + UpdateInstance: retry[[2]string{"default", "non_idempotent"}], + DeleteInstance: retry[[2]string{"default", "non_idempotent"}], + } +} + +// CloudRedisClient is a client for interacting with Google Cloud Memorystore for Redis API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type CloudRedisClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + cloudRedisClient redispb.CloudRedisClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CloudRedisCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewCloudRedisClient creates a new cloud redis client. +// +// Configures and manages Cloud Memorystore for Redis instances +// +// Google Cloud Memorystore for Redis v1 +// +// The redis.googleapis.com service implements the Google Cloud Memorystore +// for Redis API and defines the following resource model for managing Redis +// instances: +// +// The service works with a collection of cloud projects, named: /projects/* +// +// Each project has a collection of available locations, named: /locations/* +// +// Each location has a collection of Redis instances, named: /instances/* +// +// As such, Redis instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// +// Note that location_id must be refering to a GCP region; for example: +// +// projects/redpepper-1290/locations/us-central1/instances/my-redis +func NewCloudRedisClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultCloudRedisClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &CloudRedisClient{ + conn: conn, + CallOptions: defaultCloudRedisCallOptions(), + + cloudRedisClient: redispb.NewCloudRedisClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *CloudRedisClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *CloudRedisClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *CloudRedisClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListInstances lists all Redis instances owned by a project in either the specified +// location (region) or all locations. +// +// The location should have the following format: +// +// projects/{project_id}/locations/{location_id} +// +// If location_id is specified as - (wildcard), then all regions +// available to the project are queried, and the results are aggregated. +func (c *CloudRedisClient) ListInstances(ctx context.Context, req *redispb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListInstances[0:len(c.CallOptions.ListInstances):len(c.CallOptions.ListInstances)], opts...) + it := &InstanceIterator{} + req = proto.Clone(req).(*redispb.ListInstancesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*redispb.Instance, string, error) { + var resp *redispb.ListInstancesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.ListInstances(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Instances, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetInstance gets the details of a specific Redis instance. +func (c *CloudRedisClient) GetInstance(ctx context.Context, req *redispb.GetInstanceRequest, opts ...gax.CallOption) (*redispb.Instance, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetInstance[0:len(c.CallOptions.GetInstance):len(c.CallOptions.GetInstance)], opts...) + var resp *redispb.Instance + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.GetInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateInstance creates a Redis instance based on the specified tier and memory size. +// +// By default, the instance is accessible from the project's +// default network (at /compute/docs/networks-and-firewalls#networks). +// +// The creation is executed asynchronously and callers may check the returned +// operation to track its progress. Once the operation is completed the Redis +// instance will be fully functional. Completed longrunning.Operation will +// contain the new instance object in the response field. +// +// The returned operation is automatically deleted after a few hours, so there +// is no need to call DeleteOperation. +func (c *CloudRedisClient) CreateInstance(ctx context.Context, req *redispb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateInstance[0:len(c.CallOptions.CreateInstance):len(c.CallOptions.CreateInstance)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.CreateInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// UpdateInstance updates the metadata and configuration of a specific Redis instance. +// +// Completed longrunning.Operation will contain the new instance object +// in the response field. The returned operation is automatically deleted +// after a few hours, so there is no need to call DeleteOperation. +func (c *CloudRedisClient) UpdateInstance(ctx context.Context, req *redispb.UpdateInstanceRequest, opts ...gax.CallOption) (*UpdateInstanceOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateInstance[0:len(c.CallOptions.UpdateInstance):len(c.CallOptions.UpdateInstance)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.UpdateInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DeleteInstance deletes a specific Redis instance. Instance stops serving and data is +// deleted. +func (c *CloudRedisClient) DeleteInstance(ctx context.Context, req *redispb.DeleteInstanceRequest, opts ...gax.CallOption) (*DeleteInstanceOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteInstance[0:len(c.CallOptions.DeleteInstance):len(c.CallOptions.DeleteInstance)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.DeleteInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// InstanceIterator manages a stream of *redispb.Instance. +type InstanceIterator struct { + items []*redispb.Instance + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*redispb.Instance, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *InstanceIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *InstanceIterator) Next() (*redispb.Instance, error) { + var item *redispb.Instance + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *InstanceIterator) bufLen() int { + return len(it.items) +} + +func (it *InstanceIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// CreateInstanceOperation manages a long-running operation from CreateInstance. +type CreateInstanceOperation struct { + lro *longrunning.Operation +} + +// CreateInstanceOperation returns a new CreateInstanceOperation from a given name. +// The name must be that of a previously created CreateInstanceOperation, possibly from a different process. +func (c *CloudRedisClient) CreateInstanceOperation(name string) *CreateInstanceOperation { + return &CreateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + if err := op.lro.WaitWithInterval(ctx, &resp, 360000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateInstanceOperation) Metadata() (*redispb.OperationMetadata, error) { + var meta redispb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateInstanceOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateInstanceOperation) Name() string { + return op.lro.Name() +} + +// DeleteInstanceOperation manages a long-running operation from DeleteInstance. +type DeleteInstanceOperation struct { + lro *longrunning.Operation +} + +// DeleteInstanceOperation returns a new DeleteInstanceOperation from a given name. +// The name must be that of a previously created DeleteInstanceOperation, possibly from a different process. +func (c *CloudRedisClient) DeleteInstanceOperation(name string) *DeleteInstanceOperation { + return &DeleteInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeleteInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 360000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *DeleteInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteInstanceOperation) Metadata() (*redispb.OperationMetadata, error) { + var meta redispb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeleteInstanceOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeleteInstanceOperation) Name() string { + return op.lro.Name() +} + +// UpdateInstanceOperation manages a long-running operation from UpdateInstance. +type UpdateInstanceOperation struct { + lro *longrunning.Operation +} + +// UpdateInstanceOperation returns a new UpdateInstanceOperation from a given name. +// The name must be that of a previously created UpdateInstanceOperation, possibly from a different process. +func (c *CloudRedisClient) UpdateInstanceOperation(name string) *UpdateInstanceOperation { + return &UpdateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + if err := op.lro.WaitWithInterval(ctx, &resp, 360000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *UpdateInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateInstanceOperation) Metadata() (*redispb.OperationMetadata, error) { + var meta redispb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateInstanceOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateInstanceOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/redis/apiv1/cloud_redis_client_example_test.go b/vendor/cloud.google.com/go/redis/apiv1/cloud_redis_client_example_test.go new file mode 100644 index 000000000..182ea80a8 --- /dev/null +++ b/vendor/cloud.google.com/go/redis/apiv1/cloud_redis_client_example_test.go @@ -0,0 +1,142 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package redis_test + +import ( + "context" + + redis "cloud.google.com/go/redis/apiv1" + "google.golang.org/api/iterator" + redispb "google.golang.org/genproto/googleapis/cloud/redis/v1" +) + +func ExampleNewCloudRedisClient() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleCloudRedisClient_ListInstances() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.ListInstancesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListInstances(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleCloudRedisClient_GetInstance() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.GetInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudRedisClient_CreateInstance() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.CreateInstanceRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudRedisClient_UpdateInstance() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.UpdateInstanceRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudRedisClient_DeleteInstance() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.DeleteInstanceRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} diff --git a/vendor/cloud.google.com/go/redis/apiv1/doc.go b/vendor/cloud.google.com/go/redis/apiv1/doc.go new file mode 100644 index 000000000..641394b6a --- /dev/null +++ b/vendor/cloud.google.com/go/redis/apiv1/doc.go @@ -0,0 +1,90 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package redis is an auto-generated package for the +// Google Cloud Memorystore for Redis API. + +// +// The Google Cloud Memorystore for Redis API is used for creating and +// managing +// Redis instances on the Google Cloud Platform. +package redis // import "cloud.google.com/go/redis/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/redis/apiv1/mock_test.go b/vendor/cloud.google.com/go/redis/apiv1/mock_test.go new file mode 100644 index 000000000..a900e79ec --- /dev/null +++ b/vendor/cloud.google.com/go/redis/apiv1/mock_test.go @@ -0,0 +1,641 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package redis + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + redispb "google.golang.org/genproto/googleapis/cloud/redis/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + field_maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockCloudRedisServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + redispb.CloudRedisServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockCloudRedisServer) ListInstances(ctx context.Context, req *redispb.ListInstancesRequest) (*redispb.ListInstancesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*redispb.ListInstancesResponse), nil +} + +func (s *mockCloudRedisServer) GetInstance(ctx context.Context, req *redispb.GetInstanceRequest) (*redispb.Instance, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*redispb.Instance), nil +} + +func (s *mockCloudRedisServer) CreateInstance(ctx context.Context, req *redispb.CreateInstanceRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockCloudRedisServer) UpdateInstance(ctx context.Context, req *redispb.UpdateInstanceRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockCloudRedisServer) DeleteInstance(ctx context.Context, req *redispb.DeleteInstanceRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockCloudRedis mockCloudRedisServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + redispb.RegisterCloudRedisServer(serv, &mockCloudRedis) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestCloudRedisListInstances(t *testing.T) { + var nextPageToken string = "" + var instancesElement *redispb.Instance = &redispb.Instance{} + var instances = []*redispb.Instance{instancesElement} + var expectedResponse = &redispb.ListInstancesResponse{ + NextPageToken: nextPageToken, + Instances: instances, + } + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &redispb.ListInstancesRequest{ + Parent: formattedParent, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInstances(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Instances[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudRedisListInstancesError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &redispb.ListInstancesRequest{ + Parent: formattedParent, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInstances(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudRedisGetInstance(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var locationId string = "locationId552319461" + var alternativeLocationId string = "alternativeLocationId-718920621" + var redisVersion string = "redisVersion-685310444" + var reservedIpRange string = "reservedIpRange-1082940580" + var host string = "host3208616" + var port int32 = 3446913 + var currentLocationId string = "currentLocationId1312712735" + var statusMessage string = "statusMessage-239442758" + var memorySizeGb int32 = 34199707 + var authorizedNetwork string = "authorizedNetwork-1733809270" + var expectedResponse = &redispb.Instance{ + Name: name2, + DisplayName: displayName, + LocationId: locationId, + AlternativeLocationId: alternativeLocationId, + RedisVersion: redisVersion, + ReservedIpRange: reservedIpRange, + Host: host, + Port: port, + CurrentLocationId: currentLocationId, + StatusMessage: statusMessage, + MemorySizeGb: memorySizeGb, + AuthorizedNetwork: authorizedNetwork, + } + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]") + var request = &redispb.GetInstanceRequest{ + Name: formattedName, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInstance(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudRedisGetInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]") + var request = &redispb.GetInstanceRequest{ + Name: formattedName, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInstance(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudRedisCreateInstance(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var locationId string = "locationId552319461" + var alternativeLocationId string = "alternativeLocationId-718920621" + var redisVersion string = "redisVersion-685310444" + var reservedIpRange string = "reservedIpRange-1082940580" + var host string = "host3208616" + var port int32 = 3446913 + var currentLocationId string = "currentLocationId1312712735" + var statusMessage string = "statusMessage-239442758" + var memorySizeGb2 int32 = 1493816946 + var authorizedNetwork string = "authorizedNetwork-1733809270" + var expectedResponse = &redispb.Instance{ + Name: name, + DisplayName: displayName, + LocationId: locationId, + AlternativeLocationId: alternativeLocationId, + RedisVersion: redisVersion, + ReservedIpRange: reservedIpRange, + Host: host, + Port: port, + CurrentLocationId: currentLocationId, + StatusMessage: statusMessage, + MemorySizeGb: memorySizeGb2, + AuthorizedNetwork: authorizedNetwork, + } + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var instanceId string = "test_instance" + var tier redispb.Instance_Tier = redispb.Instance_BASIC + var memorySizeGb int32 = 1 + var instance = &redispb.Instance{ + Tier: tier, + MemorySizeGb: memorySizeGb, + } + var request = &redispb.CreateInstanceRequest{ + Parent: formattedParent, + InstanceId: instanceId, + Instance: instance, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudRedisCreateInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = nil + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var instanceId string = "test_instance" + var tier redispb.Instance_Tier = redispb.Instance_BASIC + var memorySizeGb int32 = 1 + var instance = &redispb.Instance{ + Tier: tier, + MemorySizeGb: memorySizeGb, + } + var request = &redispb.CreateInstanceRequest{ + Parent: formattedParent, + InstanceId: instanceId, + Instance: instance, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudRedisUpdateInstance(t *testing.T) { + var name string = "name3373707" + var displayName2 string = "displayName21615000987" + var locationId string = "locationId552319461" + var alternativeLocationId string = "alternativeLocationId-718920621" + var redisVersion string = "redisVersion-685310444" + var reservedIpRange string = "reservedIpRange-1082940580" + var host string = "host3208616" + var port int32 = 3446913 + var currentLocationId string = "currentLocationId1312712735" + var statusMessage string = "statusMessage-239442758" + var memorySizeGb2 int32 = 1493816946 + var authorizedNetwork string = "authorizedNetwork-1733809270" + var expectedResponse = &redispb.Instance{ + Name: name, + DisplayName: displayName2, + LocationId: locationId, + AlternativeLocationId: alternativeLocationId, + RedisVersion: redisVersion, + ReservedIpRange: reservedIpRange, + Host: host, + Port: port, + CurrentLocationId: currentLocationId, + StatusMessage: statusMessage, + MemorySizeGb: memorySizeGb2, + AuthorizedNetwork: authorizedNetwork, + } + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var pathsElement string = "display_name" + var pathsElement2 string = "memory_size_gb" + var paths = []string{pathsElement, pathsElement2} + var updateMask = &field_maskpb.FieldMask{ + Paths: paths, + } + var displayName string = "UpdatedDisplayName" + var memorySizeGb int32 = 4 + var instance = &redispb.Instance{ + DisplayName: displayName, + MemorySizeGb: memorySizeGb, + } + var request = &redispb.UpdateInstanceRequest{ + UpdateMask: updateMask, + Instance: instance, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudRedisUpdateInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = nil + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var pathsElement string = "display_name" + var pathsElement2 string = "memory_size_gb" + var paths = []string{pathsElement, pathsElement2} + var updateMask = &field_maskpb.FieldMask{ + Paths: paths, + } + var displayName string = "UpdatedDisplayName" + var memorySizeGb int32 = 4 + var instance = &redispb.Instance{ + DisplayName: displayName, + MemorySizeGb: memorySizeGb, + } + var request = &redispb.UpdateInstanceRequest{ + UpdateMask: updateMask, + Instance: instance, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudRedisDeleteInstance(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]") + var request = &redispb.DeleteInstanceRequest{ + Name: formattedName, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DeleteInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestCloudRedisDeleteInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = nil + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]") + var request = &redispb.DeleteInstanceRequest{ + Name: formattedName, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DeleteInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} diff --git a/vendor/cloud.google.com/go/redis/apiv1beta1/cloud_redis_client.go b/vendor/cloud.google.com/go/redis/apiv1beta1/cloud_redis_client.go new file mode 100644 index 000000000..a3d4ff0f8 --- /dev/null +++ b/vendor/cloud.google.com/go/redis/apiv1beta1/cloud_redis_client.go @@ -0,0 +1,520 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package redis + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + anypb "github.com/golang/protobuf/ptypes/any" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + redispb "google.golang.org/genproto/googleapis/cloud/redis/v1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +// CloudRedisCallOptions contains the retry settings for each method of CloudRedisClient. +type CloudRedisCallOptions struct { + ListInstances []gax.CallOption + GetInstance []gax.CallOption + CreateInstance []gax.CallOption + UpdateInstance []gax.CallOption + DeleteInstance []gax.CallOption +} + +func defaultCloudRedisClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("redis.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCloudRedisCallOptions() *CloudRedisCallOptions { + retry := map[[2]string][]gax.CallOption{} + return &CloudRedisCallOptions{ + ListInstances: retry[[2]string{"default", "non_idempotent"}], + GetInstance: retry[[2]string{"default", "non_idempotent"}], + CreateInstance: retry[[2]string{"default", "non_idempotent"}], + UpdateInstance: retry[[2]string{"default", "non_idempotent"}], + DeleteInstance: retry[[2]string{"default", "non_idempotent"}], + } +} + +// CloudRedisClient is a client for interacting with Google Cloud Memorystore for Redis API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type CloudRedisClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + cloudRedisClient redispb.CloudRedisClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CloudRedisCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewCloudRedisClient creates a new cloud redis client. +// +// Configures and manages Cloud Memorystore for Redis instances +// +// Google Cloud Memorystore for Redis v1beta1 +// +// The redis.googleapis.com service implements the Google Cloud Memorystore +// for Redis API and defines the following resource model for managing Redis +// instances: +// +// The service works with a collection of cloud projects, named: /projects/* +// +// Each project has a collection of available locations, named: /locations/* +// +// Each location has a collection of Redis instances, named: /instances/* +// +// As such, Redis instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// +// Note that location_id must be refering to a GCP region; for example: +// +// projects/redpepper-1290/locations/us-central1/instances/my-redis +func NewCloudRedisClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultCloudRedisClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &CloudRedisClient{ + conn: conn, + CallOptions: defaultCloudRedisCallOptions(), + + cloudRedisClient: redispb.NewCloudRedisClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *CloudRedisClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *CloudRedisClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *CloudRedisClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListInstances lists all Redis instances owned by a project in either the specified +// location (region) or all locations. +// +// The location should have the following format: +// +// projects/{project_id}/locations/{location_id} +// +// If location_id is specified as - (wildcard), then all regions +// available to the project are queried, and the results are aggregated. +func (c *CloudRedisClient) ListInstances(ctx context.Context, req *redispb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListInstances[0:len(c.CallOptions.ListInstances):len(c.CallOptions.ListInstances)], opts...) + it := &InstanceIterator{} + req = proto.Clone(req).(*redispb.ListInstancesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*redispb.Instance, string, error) { + var resp *redispb.ListInstancesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.ListInstances(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Instances, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetInstance gets the details of a specific Redis instance. +func (c *CloudRedisClient) GetInstance(ctx context.Context, req *redispb.GetInstanceRequest, opts ...gax.CallOption) (*redispb.Instance, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetInstance[0:len(c.CallOptions.GetInstance):len(c.CallOptions.GetInstance)], opts...) + var resp *redispb.Instance + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.GetInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateInstance creates a Redis instance based on the specified tier and memory size. +// +// By default, the instance is peered to the project's +// default network (at /compute/docs/networks-and-firewalls#networks). +// +// The creation is executed asynchronously and callers may check the returned +// operation to track its progress. Once the operation is completed the Redis +// instance will be fully functional. Completed longrunning.Operation will +// contain the new instance object in the response field. +// +// The returned operation is automatically deleted after a few hours, so there +// is no need to call DeleteOperation. +func (c *CloudRedisClient) CreateInstance(ctx context.Context, req *redispb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateInstance[0:len(c.CallOptions.CreateInstance):len(c.CallOptions.CreateInstance)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.CreateInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// UpdateInstance updates the metadata and configuration of a specific Redis instance. +// +// Completed longrunning.Operation will contain the new instance object +// in the response field. The returned operation is automatically deleted +// after a few hours, so there is no need to call DeleteOperation. +func (c *CloudRedisClient) UpdateInstance(ctx context.Context, req *redispb.UpdateInstanceRequest, opts ...gax.CallOption) (*UpdateInstanceOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateInstance[0:len(c.CallOptions.UpdateInstance):len(c.CallOptions.UpdateInstance)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.UpdateInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DeleteInstance deletes a specific Redis instance. Instance stops serving and data is +// deleted. +func (c *CloudRedisClient) DeleteInstance(ctx context.Context, req *redispb.DeleteInstanceRequest, opts ...gax.CallOption) (*DeleteInstanceOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteInstance[0:len(c.CallOptions.DeleteInstance):len(c.CallOptions.DeleteInstance)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudRedisClient.DeleteInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// InstanceIterator manages a stream of *redispb.Instance. +type InstanceIterator struct { + items []*redispb.Instance + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*redispb.Instance, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *InstanceIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *InstanceIterator) Next() (*redispb.Instance, error) { + var item *redispb.Instance + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *InstanceIterator) bufLen() int { + return len(it.items) +} + +func (it *InstanceIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// CreateInstanceOperation manages a long-running operation from CreateInstance. +type CreateInstanceOperation struct { + lro *longrunning.Operation +} + +// CreateInstanceOperation returns a new CreateInstanceOperation from a given name. +// The name must be that of a previously created CreateInstanceOperation, possibly from a different process. +func (c *CloudRedisClient) CreateInstanceOperation(name string) *CreateInstanceOperation { + return &CreateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + if err := op.lro.WaitWithInterval(ctx, &resp, 360000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateInstanceOperation) Metadata() (*anypb.Any, error) { + var meta anypb.Any + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateInstanceOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateInstanceOperation) Name() string { + return op.lro.Name() +} + +// DeleteInstanceOperation manages a long-running operation from DeleteInstance. +type DeleteInstanceOperation struct { + lro *longrunning.Operation +} + +// DeleteInstanceOperation returns a new DeleteInstanceOperation from a given name. +// The name must be that of a previously created DeleteInstanceOperation, possibly from a different process. +func (c *CloudRedisClient) DeleteInstanceOperation(name string) *DeleteInstanceOperation { + return &DeleteInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeleteInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 360000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *DeleteInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteInstanceOperation) Metadata() (*anypb.Any, error) { + var meta anypb.Any + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeleteInstanceOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeleteInstanceOperation) Name() string { + return op.lro.Name() +} + +// UpdateInstanceOperation manages a long-running operation from UpdateInstance. +type UpdateInstanceOperation struct { + lro *longrunning.Operation +} + +// UpdateInstanceOperation returns a new UpdateInstanceOperation from a given name. +// The name must be that of a previously created UpdateInstanceOperation, possibly from a different process. +func (c *CloudRedisClient) UpdateInstanceOperation(name string) *UpdateInstanceOperation { + return &UpdateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + if err := op.lro.WaitWithInterval(ctx, &resp, 360000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *UpdateInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*redispb.Instance, error) { + var resp redispb.Instance + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateInstanceOperation) Metadata() (*anypb.Any, error) { + var meta anypb.Any + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateInstanceOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateInstanceOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/redis/apiv1beta1/cloud_redis_client_example_test.go b/vendor/cloud.google.com/go/redis/apiv1beta1/cloud_redis_client_example_test.go new file mode 100644 index 000000000..074126772 --- /dev/null +++ b/vendor/cloud.google.com/go/redis/apiv1beta1/cloud_redis_client_example_test.go @@ -0,0 +1,142 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package redis_test + +import ( + "context" + + redis "cloud.google.com/go/redis/apiv1beta1" + "google.golang.org/api/iterator" + redispb "google.golang.org/genproto/googleapis/cloud/redis/v1beta1" +) + +func ExampleNewCloudRedisClient() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleCloudRedisClient_ListInstances() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.ListInstancesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListInstances(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleCloudRedisClient_GetInstance() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.GetInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudRedisClient_CreateInstance() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.CreateInstanceRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudRedisClient_UpdateInstance() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.UpdateInstanceRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudRedisClient_DeleteInstance() { + ctx := context.Background() + c, err := redis.NewCloudRedisClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &redispb.DeleteInstanceRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} diff --git a/vendor/cloud.google.com/go/redis/apiv1beta1/doc.go b/vendor/cloud.google.com/go/redis/apiv1beta1/doc.go new file mode 100644 index 000000000..951cfb5c2 --- /dev/null +++ b/vendor/cloud.google.com/go/redis/apiv1beta1/doc.go @@ -0,0 +1,91 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package redis is an auto-generated package for the +// Google Cloud Memorystore for Redis API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// The Google Cloud Memorystore for Redis API is used for creating and +// managing +// Redis instances on the Google Cloud Platform. +package redis // import "cloud.google.com/go/redis/apiv1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/redis/apiv1beta1/mock_test.go b/vendor/cloud.google.com/go/redis/apiv1beta1/mock_test.go new file mode 100644 index 000000000..3c93d3420 --- /dev/null +++ b/vendor/cloud.google.com/go/redis/apiv1beta1/mock_test.go @@ -0,0 +1,641 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package redis + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + redispb "google.golang.org/genproto/googleapis/cloud/redis/v1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + field_maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockCloudRedisServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + redispb.CloudRedisServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockCloudRedisServer) ListInstances(ctx context.Context, req *redispb.ListInstancesRequest) (*redispb.ListInstancesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*redispb.ListInstancesResponse), nil +} + +func (s *mockCloudRedisServer) GetInstance(ctx context.Context, req *redispb.GetInstanceRequest) (*redispb.Instance, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*redispb.Instance), nil +} + +func (s *mockCloudRedisServer) CreateInstance(ctx context.Context, req *redispb.CreateInstanceRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockCloudRedisServer) UpdateInstance(ctx context.Context, req *redispb.UpdateInstanceRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockCloudRedisServer) DeleteInstance(ctx context.Context, req *redispb.DeleteInstanceRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockCloudRedis mockCloudRedisServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + redispb.RegisterCloudRedisServer(serv, &mockCloudRedis) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestCloudRedisListInstances(t *testing.T) { + var nextPageToken string = "" + var instancesElement *redispb.Instance = &redispb.Instance{} + var instances = []*redispb.Instance{instancesElement} + var expectedResponse = &redispb.ListInstancesResponse{ + NextPageToken: nextPageToken, + Instances: instances, + } + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &redispb.ListInstancesRequest{ + Parent: formattedParent, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInstances(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Instances[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudRedisListInstancesError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &redispb.ListInstancesRequest{ + Parent: formattedParent, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInstances(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudRedisGetInstance(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var locationId string = "locationId552319461" + var alternativeLocationId string = "alternativeLocationId-718920621" + var redisVersion string = "redisVersion-685310444" + var reservedIpRange string = "reservedIpRange-1082940580" + var host string = "host3208616" + var port int32 = 3446913 + var currentLocationId string = "currentLocationId1312712735" + var statusMessage string = "statusMessage-239442758" + var memorySizeGb int32 = 34199707 + var authorizedNetwork string = "authorizedNetwork-1733809270" + var expectedResponse = &redispb.Instance{ + Name: name2, + DisplayName: displayName, + LocationId: locationId, + AlternativeLocationId: alternativeLocationId, + RedisVersion: redisVersion, + ReservedIpRange: reservedIpRange, + Host: host, + Port: port, + CurrentLocationId: currentLocationId, + StatusMessage: statusMessage, + MemorySizeGb: memorySizeGb, + AuthorizedNetwork: authorizedNetwork, + } + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]") + var request = &redispb.GetInstanceRequest{ + Name: formattedName, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInstance(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudRedisGetInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]") + var request = &redispb.GetInstanceRequest{ + Name: formattedName, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInstance(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudRedisCreateInstance(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var locationId string = "locationId552319461" + var alternativeLocationId string = "alternativeLocationId-718920621" + var redisVersion string = "redisVersion-685310444" + var reservedIpRange string = "reservedIpRange-1082940580" + var host string = "host3208616" + var port int32 = 3446913 + var currentLocationId string = "currentLocationId1312712735" + var statusMessage string = "statusMessage-239442758" + var memorySizeGb2 int32 = 1493816946 + var authorizedNetwork string = "authorizedNetwork-1733809270" + var expectedResponse = &redispb.Instance{ + Name: name, + DisplayName: displayName, + LocationId: locationId, + AlternativeLocationId: alternativeLocationId, + RedisVersion: redisVersion, + ReservedIpRange: reservedIpRange, + Host: host, + Port: port, + CurrentLocationId: currentLocationId, + StatusMessage: statusMessage, + MemorySizeGb: memorySizeGb2, + AuthorizedNetwork: authorizedNetwork, + } + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var instanceId string = "test_instance" + var tier redispb.Instance_Tier = redispb.Instance_BASIC + var memorySizeGb int32 = 1 + var instance = &redispb.Instance{ + Tier: tier, + MemorySizeGb: memorySizeGb, + } + var request = &redispb.CreateInstanceRequest{ + Parent: formattedParent, + InstanceId: instanceId, + Instance: instance, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudRedisCreateInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = nil + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var instanceId string = "test_instance" + var tier redispb.Instance_Tier = redispb.Instance_BASIC + var memorySizeGb int32 = 1 + var instance = &redispb.Instance{ + Tier: tier, + MemorySizeGb: memorySizeGb, + } + var request = &redispb.CreateInstanceRequest{ + Parent: formattedParent, + InstanceId: instanceId, + Instance: instance, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudRedisUpdateInstance(t *testing.T) { + var name string = "name3373707" + var displayName2 string = "displayName21615000987" + var locationId string = "locationId552319461" + var alternativeLocationId string = "alternativeLocationId-718920621" + var redisVersion string = "redisVersion-685310444" + var reservedIpRange string = "reservedIpRange-1082940580" + var host string = "host3208616" + var port int32 = 3446913 + var currentLocationId string = "currentLocationId1312712735" + var statusMessage string = "statusMessage-239442758" + var memorySizeGb2 int32 = 1493816946 + var authorizedNetwork string = "authorizedNetwork-1733809270" + var expectedResponse = &redispb.Instance{ + Name: name, + DisplayName: displayName2, + LocationId: locationId, + AlternativeLocationId: alternativeLocationId, + RedisVersion: redisVersion, + ReservedIpRange: reservedIpRange, + Host: host, + Port: port, + CurrentLocationId: currentLocationId, + StatusMessage: statusMessage, + MemorySizeGb: memorySizeGb2, + AuthorizedNetwork: authorizedNetwork, + } + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var pathsElement string = "display_name" + var pathsElement2 string = "memory_size_gb" + var paths = []string{pathsElement, pathsElement2} + var updateMask = &field_maskpb.FieldMask{ + Paths: paths, + } + var displayName string = "UpdatedDisplayName" + var memorySizeGb int32 = 4 + var instance = &redispb.Instance{ + DisplayName: displayName, + MemorySizeGb: memorySizeGb, + } + var request = &redispb.UpdateInstanceRequest{ + UpdateMask: updateMask, + Instance: instance, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudRedisUpdateInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = nil + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var pathsElement string = "display_name" + var pathsElement2 string = "memory_size_gb" + var paths = []string{pathsElement, pathsElement2} + var updateMask = &field_maskpb.FieldMask{ + Paths: paths, + } + var displayName string = "UpdatedDisplayName" + var memorySizeGb int32 = 4 + var instance = &redispb.Instance{ + DisplayName: displayName, + MemorySizeGb: memorySizeGb, + } + var request = &redispb.UpdateInstanceRequest{ + UpdateMask: updateMask, + Instance: instance, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudRedisDeleteInstance(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockCloudRedis.err = nil + mockCloudRedis.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]") + var request = &redispb.DeleteInstanceRequest{ + Name: formattedName, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DeleteInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudRedis.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestCloudRedisDeleteInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudRedis.err = nil + mockCloudRedis.resps = append(mockCloudRedis.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/instances/%s", "[PROJECT]", "[LOCATION]", "[INSTANCE]") + var request = &redispb.DeleteInstanceRequest{ + Name: formattedName, + } + + c, err := NewCloudRedisClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.DeleteInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} diff --git a/vendor/cloud.google.com/go/regen-gapic.sh b/vendor/cloud.google.com/go/regen-gapic.sh new file mode 100755 index 000000000..252c9be0d --- /dev/null +++ b/vendor/cloud.google.com/go/regen-gapic.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +# 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/iam/credentials/artman_iamcredentials_v1.yaml +google/cloud/bigquery/datatransfer/artman_bigquerydatatransfer.yaml +google/cloud/dataproc/artman_dataproc_v1.yaml +google/cloud/dataproc/artman_dataproc_v1beta2.yaml +google/cloud/dialogflow/artman_dialogflow_v2.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/redis/artman_redis_v1beta1.yaml +google/cloud/redis/artman_redis_v1.yaml +google/cloud/scheduler/artman_cloudscheduler_v1beta1.yaml +google/cloud/securitycenter/artman_securitycenter_v1beta1.yaml +google/cloud/speech/artman_speech_v1.yaml +google/cloud/speech/artman_speech_v1p1beta1.yaml +google/cloud/tasks/artman_cloudtasks_v2beta2.yaml +google/cloud/tasks/artman_cloudtasks_v2beta3.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/devtools/artman_clouddebugger.yaml +google/devtools/clouderrorreporting/artman_errorreporting.yaml +google/devtools/cloudtrace/artman_cloudtrace_v1.yaml +google/devtools/cloudtrace/artman_cloudtrace_v2.yaml +google/devtools/containeranalysis/artman_containeranalysis_v1beta1.yaml +google/firestore/artman_firestore.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 + +# 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) +find $GOPATH/src/cloud.google.com/go/ -name '*.go' -exec sed -i.backup -e "s/^const versionClient.*/const versionClient = \"$ver\"/" '{}' + +find $GOPATH/src/cloud.google.com/go/ -name '*.backup' -delete + +#go list cloud.google.com/go/... | grep apiv | xargs go test + +#go test -short cloud.google.com/go/... + +#echo "googleapis version: $(git rev-parse HEAD)" diff --git a/vendor/cloud.google.com/go/rpcreplay/Makefile b/vendor/cloud.google.com/go/rpcreplay/Makefile new file mode 100644 index 000000000..cb05a7b71 --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/Makefile @@ -0,0 +1,32 @@ +# Copyright 2017 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. + +# Makefile for building Go files from protos. + +# Change these to match your environment. +PROTOC=$(HOME)/bin/protoc +PROTOC_GO_PLUGIN_DIR=$(GOPATH)/bin +PROTOBUF_REPO=$(HOME)/git-repos/protobuf + +gen-protos: sync-protobuf + for d in proto/*; do \ + PATH=$(PATH):$(PROTOC_GO_PLUGIN_DIR) \ + $(PROTOC) --go_out=plugins=grpc:$$d \ + -I $$d -I $(PROTOBUF_REPO)/src $$d/*.proto; \ + done + + +sync-protobuf: + cd $(PROTOBUF_REPO); git pull + diff --git a/vendor/cloud.google.com/go/rpcreplay/doc.go b/vendor/cloud.google.com/go/rpcreplay/doc.go new file mode 100644 index 000000000..90455555f --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/doc.go @@ -0,0 +1,145 @@ +// Copyright 2017 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 rpcreplay supports the capture and replay of gRPC calls. Its main goal is +to improve testing. Once you capture the calls of a test that runs against a real +service, you have an "automatic mock" that can be replayed against the same test, +yielding a unit test that is fast and flake-free. + +This package is EXPERIMENTAL and subject to change without notice. + + +Recording + +To record a sequence of gRPC calls to a file, create a Recorder and pass its +DialOptions to grpc.Dial: + + rec, err := rpcreplay.NewRecorder("service.replay", nil) + if err != nil { ... } + defer func() { + if err := rec.Close(); err != nil { ... } + }() + conn, err := grpc.Dial(serverAddress, rec.DialOptions()...) + +It is essential to close the Recorder when the interaction is finished. + +There is also a NewRecorderWriter function for capturing to an arbitrary +io.Writer. + + +Replaying + +Replaying a captured file looks almost identical: create a Replayer and use +its DialOptions. (Since we're reading the file and not writing it, we don't +have to be as careful about the error returned from Close). + + rep, err := rpcreplay.NewReplayer("service.replay") + if err != nil { ... } + defer rep.Close() + conn, err := grpc.Dial(serverAddress, rep.DialOptions()...) + + +Initial State + +A test might use random or time-sensitive values, for instance to create unique +resources for isolation from other tests. The test therefore has initial values, such +as the current time, or a random seed, that differ from run to run. You must record +this initial state and re-establish it on replay. + +To record the initial state, serialize it into a []byte and pass it as the second +argument to NewRecorder: + + timeNow := time.Now() + b, err := timeNow.MarshalBinary() + if err != nil { ... } + rec, err := rpcreplay.NewRecorder("service.replay", b) + +On replay, get the bytes from Replayer.Initial: + + rep, err := rpcreplay.NewReplayer("service.replay") + if err != nil { ... } + defer rep.Close() + err = timeNow.UnmarshalBinary(rep.Initial()) + if err != nil { ... } + + +Callbacks that modify what is saved and matched from the replay file + +Recorders and replayers have support for running callbacks before messages are written/read +from the replay file. A Recorder has a BeforeFunc that can modify a request or response +before it is written to the replay file. The actual RPCs sent to the service during recording +remain unaltered; only what is saved in the replay file can be changed.A Replayer has a +BeforeFunc that can modify a request before it is sent for matching. + +Example uses for these callbacks include customized logging, or scrubbing data +before RPCs are written to the replay file. If requests are modified by the callbacks during recording, +it is important to perform the same modifications to the requests when replaying, or RPC +matching on replay will fail. + +A common way to analyze and modify the various messages is to use a type switch. + + // Assume these types implement proto.Message. + type Greeting struct { + line string + } + + type Farewell struct { + line string + } + + func sayings(method string, msg proto.Message) error { + switch m := msg.(type) { + case Greeting: + msg.line = "Hi!" + return nil + case Farewell: + msg.line = "Bye bye!" + return nil + default: + return fmt.Errorf("unknown message type") + } + } + +Nondeterminism + +A nondeterministic program may invoke RPCs in a different order each time +it is run. The order in which RPCs are called during recording may differ +from the order during replay. + +The replayer matches incoming to recorded requests by method name and request +contents, so nondeterminism is only a concern for identical requests that result +in different responses. A nondeterministic program whose behavior differs +depending on the order of such RPCs probably has a race condition: since both the +recorded sequence of RPCs and the sequence during replay are valid orderings, the +program should behave the same under both. + + +Other Replayer Differences + +Besides the differences in replay mentioned above, other differences may cause issues +for some programs. We list them here. + +The Replayer delivers a response to an RPC immediately, without waiting for other +incoming RPCs. This can violate causality. For example, in a Pub/Sub program where +one goroutine publishes and another subscribes, during replay the Subscribe call may +finish before the Publish call begins. + +For streaming RPCs, the Replayer delivers the result of Send and Recv calls in +the order they were recorded. No attempt is made to match message contents. + +At present, this package does not record or replay stream headers and trailers, or +the result of the CloseSend method. +*/ +package rpcreplay // import "cloud.google.com/go/rpcreplay" diff --git a/vendor/cloud.google.com/go/rpcreplay/example_test.go b/vendor/cloud.google.com/go/rpcreplay/example_test.go new file mode 100644 index 000000000..912db2065 --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/example_test.go @@ -0,0 +1,47 @@ +// Copyright 2017 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 rpcreplay_test + +var serverAddress string + +// func Example_NewRecorder() { +// rec, err := rpcreplay.NewRecorder("service.replay", nil) +// if err != nil { +// // TODO: Handle error. +// } +// defer func() { +// if err := rec.Close(); err != nil { +// // TODO: Handle error. +// } +// }() +// conn, err := grpc.Dial(serverAddress, rec.DialOptions()...) +// if err != nil { +// // TODO: Handle error. +// } +// _ = conn // TODO: use connection +// } + +// func Example_NewReplayer() { +// rep, err := rpcreplay.NewReplayer("service.replay") +// if err != nil { +// // TODO: Handle error. +// } +// defer rep.Close() +// conn, err := grpc.Dial(serverAddress, rep.DialOptions()...) +// if err != nil { +// // TODO: Handle error. +// } +// _ = conn // TODO: use connection +// } diff --git a/vendor/cloud.google.com/go/rpcreplay/fake_test.go b/vendor/cloud.google.com/go/rpcreplay/fake_test.go new file mode 100644 index 000000000..837ab3d65 --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/fake_test.go @@ -0,0 +1,121 @@ +// Copyright 2017 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 rpcreplay + +import ( + "context" + "io" + "log" + "net" + + pb "cloud.google.com/go/rpcreplay/proto/intstore" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// intStoreServer is an in-memory implementation of IntStore. +type intStoreServer struct { + pb.IntStoreServer + + Addr string + l net.Listener + gsrv *grpc.Server + + items map[string]int32 +} + +func newIntStoreServer() *intStoreServer { + l, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + log.Fatal(err) + } + s := &intStoreServer{ + Addr: l.Addr().String(), + l: l, + gsrv: grpc.NewServer(), + } + pb.RegisterIntStoreServer(s.gsrv, s) + go s.gsrv.Serve(s.l) + return s +} + +func (s *intStoreServer) stop() { + s.gsrv.Stop() + s.l.Close() +} + +func (s *intStoreServer) Set(_ context.Context, item *pb.Item) (*pb.SetResponse, error) { + old := s.setItem(item) + return &pb.SetResponse{PrevValue: old}, nil +} + +func (s *intStoreServer) setItem(item *pb.Item) int32 { + if s.items == nil { + s.items = map[string]int32{} + } + old := s.items[item.Name] + s.items[item.Name] = item.Value + return old +} + +func (s *intStoreServer) Get(_ context.Context, req *pb.GetRequest) (*pb.Item, error) { + val, ok := s.items[req.Name] + if !ok { + return nil, status.Errorf(codes.NotFound, "%q", req.Name) + } + return &pb.Item{Name: req.Name, Value: val}, nil +} + +func (s *intStoreServer) ListItems(_ *pb.ListItemsRequest, ss pb.IntStore_ListItemsServer) error { + for name, val := range s.items { + if err := ss.Send(&pb.Item{Name: name, Value: val}); err != nil { + return err + } + } + return nil +} + +func (s *intStoreServer) SetStream(ss pb.IntStore_SetStreamServer) error { + n := 0 + for { + item, err := ss.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + s.setItem(item) + n++ + } + return ss.SendAndClose(&pb.Summary{Count: int32(n)}) +} + +func (s *intStoreServer) StreamChat(ss pb.IntStore_StreamChatServer) error { + for { + item, err := ss.Recv() + if err == io.EOF { + break + } + if err != nil { + return err + } + if err := ss.Send(item); err != nil { + return err + } + } + return nil +} diff --git a/vendor/cloud.google.com/go/rpcreplay/proto/intstore/intstore.pb.go b/vendor/cloud.google.com/go/rpcreplay/proto/intstore/intstore.pb.go new file mode 100644 index 000000000..cac660781 --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/proto/intstore/intstore.pb.go @@ -0,0 +1,455 @@ +// Code generated by protoc-gen-go. +// source: intstore.proto +// DO NOT EDIT! + +/* +Package intstore is a generated protocol buffer package. + +It is generated from these files: + intstore.proto + +It has these top-level messages: + Item + SetResponse + GetRequest + Summary + ListItemsRequest +*/ +package intstore + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + "context" + + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Item struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Value int32 `protobuf:"varint,2,opt,name=value" json:"value,omitempty"` +} + +func (m *Item) Reset() { *m = Item{} } +func (m *Item) String() string { return proto.CompactTextString(m) } +func (*Item) ProtoMessage() {} +func (*Item) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Item) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Item) GetValue() int32 { + if m != nil { + return m.Value + } + return 0 +} + +type SetResponse struct { + PrevValue int32 `protobuf:"varint,1,opt,name=prev_value,json=prevValue" json:"prev_value,omitempty"` +} + +func (m *SetResponse) Reset() { *m = SetResponse{} } +func (m *SetResponse) String() string { return proto.CompactTextString(m) } +func (*SetResponse) ProtoMessage() {} +func (*SetResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *SetResponse) GetPrevValue() int32 { + if m != nil { + return m.PrevValue + } + return 0 +} + +type GetRequest struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *GetRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type Summary struct { + Count int32 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"` +} + +func (m *Summary) Reset() { *m = Summary{} } +func (m *Summary) String() string { return proto.CompactTextString(m) } +func (*Summary) ProtoMessage() {} +func (*Summary) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *Summary) GetCount() int32 { + if m != nil { + return m.Count + } + return 0 +} + +type ListItemsRequest struct { +} + +func (m *ListItemsRequest) Reset() { *m = ListItemsRequest{} } +func (m *ListItemsRequest) String() string { return proto.CompactTextString(m) } +func (*ListItemsRequest) ProtoMessage() {} +func (*ListItemsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func init() { + proto.RegisterType((*Item)(nil), "intstore.Item") + proto.RegisterType((*SetResponse)(nil), "intstore.SetResponse") + proto.RegisterType((*GetRequest)(nil), "intstore.GetRequest") + proto.RegisterType((*Summary)(nil), "intstore.Summary") + proto.RegisterType((*ListItemsRequest)(nil), "intstore.ListItemsRequest") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for IntStore service + +type IntStoreClient interface { + Set(ctx context.Context, in *Item, opts ...grpc.CallOption) (*SetResponse, error) + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Item, error) + // A server-to-client streaming RPC. + ListItems(ctx context.Context, in *ListItemsRequest, opts ...grpc.CallOption) (IntStore_ListItemsClient, error) + // A client-to-server streaming RPC. + SetStream(ctx context.Context, opts ...grpc.CallOption) (IntStore_SetStreamClient, error) + // A Bidirectional streaming RPC. + StreamChat(ctx context.Context, opts ...grpc.CallOption) (IntStore_StreamChatClient, error) +} + +type intStoreClient struct { + cc *grpc.ClientConn +} + +func NewIntStoreClient(cc *grpc.ClientConn) IntStoreClient { + return &intStoreClient{cc} +} + +func (c *intStoreClient) Set(ctx context.Context, in *Item, opts ...grpc.CallOption) (*SetResponse, error) { + out := new(SetResponse) + err := grpc.Invoke(ctx, "/intstore.IntStore/Set", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *intStoreClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Item, error) { + out := new(Item) + err := grpc.Invoke(ctx, "/intstore.IntStore/Get", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *intStoreClient) ListItems(ctx context.Context, in *ListItemsRequest, opts ...grpc.CallOption) (IntStore_ListItemsClient, error) { + stream, err := grpc.NewClientStream(ctx, &_IntStore_serviceDesc.Streams[0], c.cc, "/intstore.IntStore/ListItems", opts...) + if err != nil { + return nil, err + } + x := &intStoreListItemsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type IntStore_ListItemsClient interface { + Recv() (*Item, error) + grpc.ClientStream +} + +type intStoreListItemsClient struct { + grpc.ClientStream +} + +func (x *intStoreListItemsClient) Recv() (*Item, error) { + m := new(Item) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *intStoreClient) SetStream(ctx context.Context, opts ...grpc.CallOption) (IntStore_SetStreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_IntStore_serviceDesc.Streams[1], c.cc, "/intstore.IntStore/SetStream", opts...) + if err != nil { + return nil, err + } + x := &intStoreSetStreamClient{stream} + return x, nil +} + +type IntStore_SetStreamClient interface { + Send(*Item) error + CloseAndRecv() (*Summary, error) + grpc.ClientStream +} + +type intStoreSetStreamClient struct { + grpc.ClientStream +} + +func (x *intStoreSetStreamClient) Send(m *Item) error { + return x.ClientStream.SendMsg(m) +} + +func (x *intStoreSetStreamClient) CloseAndRecv() (*Summary, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(Summary) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *intStoreClient) StreamChat(ctx context.Context, opts ...grpc.CallOption) (IntStore_StreamChatClient, error) { + stream, err := grpc.NewClientStream(ctx, &_IntStore_serviceDesc.Streams[2], c.cc, "/intstore.IntStore/StreamChat", opts...) + if err != nil { + return nil, err + } + x := &intStoreStreamChatClient{stream} + return x, nil +} + +type IntStore_StreamChatClient interface { + Send(*Item) error + Recv() (*Item, error) + grpc.ClientStream +} + +type intStoreStreamChatClient struct { + grpc.ClientStream +} + +func (x *intStoreStreamChatClient) Send(m *Item) error { + return x.ClientStream.SendMsg(m) +} + +func (x *intStoreStreamChatClient) Recv() (*Item, error) { + m := new(Item) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for IntStore service + +type IntStoreServer interface { + Set(context.Context, *Item) (*SetResponse, error) + Get(context.Context, *GetRequest) (*Item, error) + // A server-to-client streaming RPC. + ListItems(*ListItemsRequest, IntStore_ListItemsServer) error + // A client-to-server streaming RPC. + SetStream(IntStore_SetStreamServer) error + // A Bidirectional streaming RPC. + StreamChat(IntStore_StreamChatServer) error +} + +func RegisterIntStoreServer(s *grpc.Server, srv IntStoreServer) { + s.RegisterService(&_IntStore_serviceDesc, srv) +} + +func _IntStore_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Item) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IntStoreServer).Set(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/intstore.IntStore/Set", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IntStoreServer).Set(ctx, req.(*Item)) + } + return interceptor(ctx, in, info, handler) +} + +func _IntStore_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IntStoreServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/intstore.IntStore/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IntStoreServer).Get(ctx, req.(*GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IntStore_ListItems_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListItemsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(IntStoreServer).ListItems(m, &intStoreListItemsServer{stream}) +} + +type IntStore_ListItemsServer interface { + Send(*Item) error + grpc.ServerStream +} + +type intStoreListItemsServer struct { + grpc.ServerStream +} + +func (x *intStoreListItemsServer) Send(m *Item) error { + return x.ServerStream.SendMsg(m) +} + +func _IntStore_SetStream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(IntStoreServer).SetStream(&intStoreSetStreamServer{stream}) +} + +type IntStore_SetStreamServer interface { + SendAndClose(*Summary) error + Recv() (*Item, error) + grpc.ServerStream +} + +type intStoreSetStreamServer struct { + grpc.ServerStream +} + +func (x *intStoreSetStreamServer) SendAndClose(m *Summary) error { + return x.ServerStream.SendMsg(m) +} + +func (x *intStoreSetStreamServer) Recv() (*Item, error) { + m := new(Item) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _IntStore_StreamChat_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(IntStoreServer).StreamChat(&intStoreStreamChatServer{stream}) +} + +type IntStore_StreamChatServer interface { + Send(*Item) error + Recv() (*Item, error) + grpc.ServerStream +} + +type intStoreStreamChatServer struct { + grpc.ServerStream +} + +func (x *intStoreStreamChatServer) Send(m *Item) error { + return x.ServerStream.SendMsg(m) +} + +func (x *intStoreStreamChatServer) Recv() (*Item, error) { + m := new(Item) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _IntStore_serviceDesc = grpc.ServiceDesc{ + ServiceName: "intstore.IntStore", + HandlerType: (*IntStoreServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Set", + Handler: _IntStore_Set_Handler, + }, + { + MethodName: "Get", + Handler: _IntStore_Get_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListItems", + Handler: _IntStore_ListItems_Handler, + ServerStreams: true, + }, + { + StreamName: "SetStream", + Handler: _IntStore_SetStream_Handler, + ClientStreams: true, + }, + { + StreamName: "StreamChat", + Handler: _IntStore_StreamChat_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "intstore.proto", +} + +func init() { proto.RegisterFile("intstore.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 273 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x91, 0x4f, 0x4b, 0xc3, 0x40, + 0x10, 0xc5, 0xb3, 0xfd, 0xa3, 0xcd, 0x08, 0x45, 0x87, 0x0a, 0x25, 0x20, 0x86, 0x3d, 0xe5, 0xa0, + 0x21, 0xd4, 0xa3, 0x47, 0x0f, 0xa5, 0xe0, 0x29, 0x0b, 0x5e, 0x25, 0xca, 0x80, 0x05, 0xb3, 0x1b, + 0x77, 0x27, 0x05, 0xbf, 0x84, 0x9f, 0x59, 0x36, 0x5b, 0x9b, 0xd2, 0x78, 0xdb, 0xb7, 0xf3, 0x66, + 0xde, 0x6f, 0x76, 0x61, 0xbe, 0xd5, 0xec, 0xd8, 0x58, 0xca, 0x1b, 0x6b, 0xd8, 0xe0, 0xec, 0x4f, + 0xcb, 0x02, 0x26, 0x1b, 0xa6, 0x1a, 0x11, 0x26, 0xba, 0xaa, 0x69, 0x29, 0x52, 0x91, 0xc5, 0x65, + 0x77, 0xc6, 0x05, 0x4c, 0x77, 0xd5, 0x67, 0x4b, 0xcb, 0x51, 0x2a, 0xb2, 0x69, 0x19, 0x84, 0xbc, + 0x83, 0x0b, 0x45, 0x5c, 0x92, 0x6b, 0x8c, 0x76, 0x84, 0x37, 0x00, 0x8d, 0xa5, 0xdd, 0x6b, 0x70, + 0x8a, 0xce, 0x19, 0xfb, 0x9b, 0x97, 0xce, 0x9d, 0x02, 0xac, 0xbd, 0xfb, 0xab, 0x25, 0xc7, 0xff, + 0xa5, 0xc8, 0x5b, 0x38, 0x57, 0x6d, 0x5d, 0x57, 0xf6, 0xdb, 0x07, 0xbe, 0x9b, 0x56, 0xf3, 0x7e, + 0x4c, 0x10, 0x12, 0xe1, 0xf2, 0x79, 0xeb, 0xd8, 0x63, 0xba, 0xfd, 0xa0, 0xd5, 0xcf, 0x08, 0x66, + 0x1b, 0xcd, 0xca, 0xef, 0x80, 0x39, 0x8c, 0x15, 0x31, 0xce, 0xf3, 0xc3, 0x96, 0xde, 0x9b, 0x5c, + 0xf7, 0xfa, 0x08, 0x58, 0x46, 0x78, 0x0f, 0xe3, 0x35, 0x31, 0x2e, 0xfa, 0x7a, 0x8f, 0x98, 0x9c, + 0x4c, 0x91, 0x11, 0x3e, 0x42, 0x7c, 0xc8, 0xc7, 0xa4, 0x2f, 0x9f, 0x42, 0x0d, 0x5b, 0x0b, 0x81, + 0x2b, 0x88, 0x15, 0xb1, 0x62, 0x4b, 0x55, 0x3d, 0x20, 0xbc, 0x3a, 0x22, 0x0c, 0x4f, 0x20, 0xa3, + 0xcc, 0xf7, 0x40, 0x68, 0x78, 0xfa, 0xa8, 0x86, 0x6b, 0x0d, 0x52, 0x32, 0x51, 0x88, 0xb7, 0xb3, + 0xee, 0x63, 0x1f, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0x22, 0x28, 0xa0, 0x49, 0xea, 0x01, 0x00, + 0x00, +} diff --git a/vendor/cloud.google.com/go/rpcreplay/proto/intstore/intstore.proto b/vendor/cloud.google.com/go/rpcreplay/proto/intstore/intstore.proto new file mode 100644 index 000000000..b3f664319 --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/proto/intstore/intstore.proto @@ -0,0 +1,54 @@ +// Copyright 2017 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. + +// IntStore is a service for testing the rpcreplay package. +// It is a simple key-value store for integers. + +syntax = "proto3"; + +package intstore; + +service IntStore { + rpc Set(Item) returns (SetResponse) {} + + rpc Get(GetRequest) returns (Item) {} + + // A server-to-client streaming RPC. + rpc ListItems(ListItemsRequest) returns (stream Item) {} + + // A client-to-server streaming RPC. + rpc SetStream(stream Item) returns (Summary) {} + + // A Bidirectional streaming RPC. + rpc StreamChat(stream Item) returns (stream Item) {} +} + +message Item { + string name = 1; + int32 value = 2; +} + +message SetResponse { + int32 prev_value = 1; +} + +message GetRequest { + string name = 1; +} + +message Summary { + int32 count = 1; +} + +message ListItemsRequest {} diff --git a/vendor/cloud.google.com/go/rpcreplay/proto/rpcreplay/rpcreplay.pb.go b/vendor/cloud.google.com/go/rpcreplay/proto/rpcreplay/rpcreplay.pb.go new file mode 100644 index 000000000..8e76a3951 --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/proto/rpcreplay/rpcreplay.pb.go @@ -0,0 +1,170 @@ +// Code generated by protoc-gen-go. +// source: rpcreplay.proto +// DO NOT EDIT! + +/* +Package rpcreplay is a generated protocol buffer package. + +It is generated from these files: + rpcreplay.proto + +It has these top-level messages: + Entry +*/ +package rpcreplay + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf "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 + +type Entry_Kind int32 + +const ( + Entry_TYPE_UNSPECIFIED Entry_Kind = 0 + // A unary request. + // method: the full name of the method + // message: the request proto + // is_error: false + // ref_index: 0 + Entry_REQUEST Entry_Kind = 1 + // A unary response. + // method: the full name of the method + // message: + // if is_error: a google.rpc.Status proto + // else: the response proto + // ref_index: index in the sequence of Entries of matching request (1-based) + Entry_RESPONSE Entry_Kind = 2 + // A method that creates a stream. + // method: the full name of the method + // message: + // if is_error: a google.rpc.Status proto + // else: nil + // ref_index: 0 + Entry_CREATE_STREAM Entry_Kind = 3 + // A call to Send on the client returned by a stream-creating method. + // method: unset + // message: the proto being sent + // is_error: false + // ref_index: index of matching CREATE_STREAM entry (1-based) + Entry_SEND Entry_Kind = 4 + // A call to Recv on the client returned by a stream-creating method. + // method: unset + // message: + // if is_error: a google.rpc.Status proto, or nil on EOF + // else: the received message + // ref_index: index of matching CREATE_STREAM entry + Entry_RECV Entry_Kind = 5 +) + +var Entry_Kind_name = map[int32]string{ + 0: "TYPE_UNSPECIFIED", + 1: "REQUEST", + 2: "RESPONSE", + 3: "CREATE_STREAM", + 4: "SEND", + 5: "RECV", +} +var Entry_Kind_value = map[string]int32{ + "TYPE_UNSPECIFIED": 0, + "REQUEST": 1, + "RESPONSE": 2, + "CREATE_STREAM": 3, + "SEND": 4, + "RECV": 5, +} + +func (x Entry_Kind) String() string { + return proto.EnumName(Entry_Kind_name, int32(x)) +} +func (Entry_Kind) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } + +// An Entry represents a single RPC activity, typically a request or response. +type Entry struct { + Kind Entry_Kind `protobuf:"varint,1,opt,name=kind,enum=rpcreplay.Entry_Kind" json:"kind,omitempty"` + Method string `protobuf:"bytes,2,opt,name=method" json:"method,omitempty"` + Message *google_protobuf.Any `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` + IsError bool `protobuf:"varint,4,opt,name=is_error,json=isError" json:"is_error,omitempty"` + RefIndex int32 `protobuf:"varint,5,opt,name=ref_index,json=refIndex" json:"ref_index,omitempty"` +} + +func (m *Entry) Reset() { *m = Entry{} } +func (m *Entry) String() string { return proto.CompactTextString(m) } +func (*Entry) ProtoMessage() {} +func (*Entry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Entry) GetKind() Entry_Kind { + if m != nil { + return m.Kind + } + return Entry_TYPE_UNSPECIFIED +} + +func (m *Entry) GetMethod() string { + if m != nil { + return m.Method + } + return "" +} + +func (m *Entry) GetMessage() *google_protobuf.Any { + if m != nil { + return m.Message + } + return nil +} + +func (m *Entry) GetIsError() bool { + if m != nil { + return m.IsError + } + return false +} + +func (m *Entry) GetRefIndex() int32 { + if m != nil { + return m.RefIndex + } + return 0 +} + +func init() { + proto.RegisterType((*Entry)(nil), "rpcreplay.Entry") + proto.RegisterEnum("rpcreplay.Entry_Kind", Entry_Kind_name, Entry_Kind_value) +} + +func init() { proto.RegisterFile("rpcreplay.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 289 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x44, 0x8e, 0xdf, 0x4e, 0xc2, 0x30, + 0x14, 0xc6, 0x2d, 0x6c, 0x30, 0x0e, 0xfe, 0xa9, 0x0d, 0x9a, 0xa1, 0x37, 0x0b, 0x57, 0xf3, 0xa6, + 0x24, 0xf8, 0x04, 0x04, 0x8e, 0x09, 0x31, 0x22, 0xb6, 0xc3, 0xc4, 0x1b, 0x17, 0x70, 0x05, 0x17, + 0xa1, 0x25, 0xdd, 0x4c, 0xdc, 0x6b, 0xf8, 0xc4, 0x66, 0x13, 0xf4, 0xae, 0xbf, 0x7e, 0xbf, 0x9c, + 0xef, 0x83, 0x33, 0xbb, 0x7b, 0xb3, 0x6a, 0xb7, 0x59, 0x14, 0x7c, 0x67, 0x4d, 0x6e, 0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 0x63, 0xea, 0x94, 0x2f, 0x81, 0xa3, 0x67, 0xea, 0x2e, 0x1b, + 0xd5, 0xdc, 0xdb, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x9b, 0x9d, 0x4f, 0x54, 0x01, 0x00, + 0x00, +} diff --git a/vendor/cloud.google.com/go/rpcreplay/proto/rpcreplay/rpcreplay.proto b/vendor/cloud.google.com/go/rpcreplay/proto/rpcreplay/rpcreplay.proto new file mode 100644 index 000000000..8abbff92f --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/proto/rpcreplay/rpcreplay.proto @@ -0,0 +1,71 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package rpcreplay; + +import "google/protobuf/any.proto"; + +// An Entry represents a single RPC activity, typically a request or response. +message Entry { + enum Kind { + TYPE_UNSPECIFIED = 0; + + // A unary request. + // method: the full name of the method + // message: the request proto + // is_error: false + // ref_index: 0 + REQUEST = 1; + + // A unary response. + // method: the full name of the method + // message: + // if is_error: a google.rpc.Status proto + // else: the response proto + // ref_index: index in the sequence of Entries of matching request (1-based) + RESPONSE = 2; + + // A method that creates a stream. + // method: the full name of the method + // message: + // if is_error: a google.rpc.Status proto + // else: nil + // ref_index: 0 + CREATE_STREAM = 3; + + // A call to Send on the client returned by a stream-creating method. + // method: unset + // message: the proto being sent + // is_error: false + // ref_index: index of matching CREATE_STREAM entry (1-based) + SEND = 4; // message sent on stream + + // A call to Recv on the client returned by a stream-creating method. + // method: unset + // message: + // if is_error: a google.rpc.Status proto, or nil on EOF + // else: the received message + // ref_index: index of matching CREATE_STREAM entry + RECV = 5; // message received from stream + } + + Kind kind = 1; + string method = 2; // method name + google.protobuf.Any message = 3; // request, response or error status + bool is_error = 4; // was response an error? + int32 ref_index = 5; // for RESPONSE, index of matching request; + // for SEND/RECV, index of CREATE_STREAM +} diff --git a/vendor/cloud.google.com/go/rpcreplay/rpcreplay.go b/vendor/cloud.google.com/go/rpcreplay/rpcreplay.go new file mode 100644 index 000000000..215b9686f --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/rpcreplay.go @@ -0,0 +1,716 @@ +// Copyright 2017 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 rpcreplay + +import ( + "bufio" + "context" + "encoding/binary" + "errors" + "fmt" + "io" + "log" + "os" + "sync" + + pb "cloud.google.com/go/rpcreplay/proto/rpcreplay" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "github.com/golang/protobuf/ptypes/any" + spb "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// A Recorder records RPCs for later playback. +type Recorder struct { + mu sync.Mutex + w *bufio.Writer + f *os.File + next int + err error + // BeforeFunc defines a function that can inspect and modify requests and responses + // written to the replay file. It does not modify messages sent to the service. + // It is run once before a request is written to the replay file, and once before a response + // is written to the replay file. + // The function is called with the method name and the message that triggered the callback. + // If the function returns an error, the error will be returned to the client. + // This is only executed for unary RPCs; streaming RPCs are not supported. + BeforeFunc func(string, proto.Message) error +} + +// NewRecorder creates a recorder that writes to filename. The file will +// also store the initial bytes for retrieval during replay. +// +// You must call Close on the Recorder to ensure that all data is written. +func NewRecorder(filename string, initial []byte) (*Recorder, error) { + f, err := os.Create(filename) + if err != nil { + return nil, err + } + rec, err := NewRecorderWriter(f, initial) + if err != nil { + _ = f.Close() + return nil, err + } + rec.f = f + return rec, nil +} + +// NewRecorderWriter creates a recorder that writes to w. The initial +// bytes will also be written to w for retrieval during replay. +// +// You must call Close on the Recorder to ensure that all data is written. +func NewRecorderWriter(w io.Writer, initial []byte) (*Recorder, error) { + bw := bufio.NewWriter(w) + if err := writeHeader(bw, initial); err != nil { + return nil, err + } + return &Recorder{w: bw, next: 1}, nil +} + +// DialOptions returns the options that must be passed to grpc.Dial +// to enable recording. +func (r *Recorder) DialOptions() []grpc.DialOption { + return []grpc.DialOption{ + grpc.WithUnaryInterceptor(r.interceptUnary), + grpc.WithStreamInterceptor(r.interceptStream), + } +} + +// Close saves any unwritten information. +func (r *Recorder) Close() error { + r.mu.Lock() + defer r.mu.Unlock() + if r.err != nil { + return r.err + } + err := r.w.Flush() + if r.f != nil { + if err2 := r.f.Close(); err == nil { + err = err2 + } + } + return err +} + +// Intercepts all unary (non-stream) RPCs. +func (r *Recorder) interceptUnary(ctx context.Context, method string, req, res interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + ereq := &entry{ + kind: pb.Entry_REQUEST, + method: method, + msg: message{msg: proto.Clone(req.(proto.Message))}, + } + + if r.BeforeFunc != nil { + if err := r.BeforeFunc(method, ereq.msg.msg); err != nil { + return err + } + } + refIndex, err := r.writeEntry(ereq) + if err != nil { + return err + } + ierr := invoker(ctx, method, req, res, cc, opts...) + eres := &entry{ + kind: pb.Entry_RESPONSE, + refIndex: refIndex, + } + // If the error is not a gRPC status, then something more + // serious is wrong. More significantly, we have no way + // of serializing an arbitrary error. So just return it + // without recording the response. + if _, ok := status.FromError(ierr); !ok { + r.mu.Lock() + r.err = fmt.Errorf("saw non-status error in %s response: %v (%T)", method, ierr, ierr) + r.mu.Unlock() + return ierr + } + eres.msg.set(proto.Clone(res.(proto.Message)), ierr) + if r.BeforeFunc != nil { + if err := r.BeforeFunc(method, eres.msg.msg); err != nil { + return err + } + } + if _, err := r.writeEntry(eres); err != nil { + return err + } + return ierr +} + +func (r *Recorder) writeEntry(e *entry) (int, error) { + r.mu.Lock() + defer r.mu.Unlock() + if r.err != nil { + return 0, r.err + } + err := writeEntry(r.w, e) + if err != nil { + r.err = err + return 0, err + } + n := r.next + r.next++ + return n, nil +} + +func (r *Recorder) interceptStream(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { + cstream, serr := streamer(ctx, desc, cc, method, opts...) + e := &entry{ + kind: pb.Entry_CREATE_STREAM, + method: method, + } + e.msg.set(nil, serr) + refIndex, err := r.writeEntry(e) + if err != nil { + return nil, err + } + return &recClientStream{ + ctx: ctx, + rec: r, + cstream: cstream, + refIndex: refIndex, + }, serr +} + +// A recClientStream implements the gprc.ClientStream interface. +// It behaves exactly like the default ClientStream, but also +// records all messages sent and received. +type recClientStream struct { + ctx context.Context + rec *Recorder + cstream grpc.ClientStream + refIndex int +} + +func (rcs *recClientStream) Context() context.Context { return rcs.ctx } + +func (rcs *recClientStream) SendMsg(m interface{}) error { + serr := rcs.cstream.SendMsg(m) + e := &entry{ + kind: pb.Entry_SEND, + refIndex: rcs.refIndex, + } + e.msg.set(m, serr) + if _, err := rcs.rec.writeEntry(e); err != nil { + return err + } + return serr +} + +func (rcs *recClientStream) RecvMsg(m interface{}) error { + serr := rcs.cstream.RecvMsg(m) + e := &entry{ + kind: pb.Entry_RECV, + refIndex: rcs.refIndex, + } + e.msg.set(m, serr) + if _, err := rcs.rec.writeEntry(e); err != nil { + return err + } + return serr +} + +func (rcs *recClientStream) Header() (metadata.MD, error) { + // TODO(jba): record. + return rcs.cstream.Header() +} + +func (rcs *recClientStream) Trailer() metadata.MD { + // TODO(jba): record. + return rcs.cstream.Trailer() +} + +func (rcs *recClientStream) CloseSend() error { + // TODO(jba): record. + return rcs.cstream.CloseSend() +} + +// A Replayer replays a set of RPCs saved by a Recorder. +type Replayer struct { + initial []byte // initial state + log func(format string, v ...interface{}) // for debugging + + mu sync.Mutex + calls []*call + streams []*stream + // BeforeFunc defines a function that can inspect and modify requests before they + // are matched for responses from the replay file. + // The function is called with the method name and the message that triggered the callback. + // If the function returns an error, the error will be returned to the client. + // This is only executed for unary RPCs; streaming RPCs are not supported. + BeforeFunc func(string, proto.Message) error +} + +// A call represents a unary RPC, with a request and response (or error). +type call struct { + method string + request proto.Message + response message +} + +// A stream represents a gRPC stream, with an initial create-stream call, followed by +// zero or more sends and/or receives. +type stream struct { + method string + createIndex int + createErr error // error from create call + sends []message + recvs []message +} + +// NewReplayer creates a Replayer that reads from filename. +func NewReplayer(filename string) (*Replayer, error) { + f, err := os.Open(filename) + if err != nil { + return nil, err + } + defer f.Close() + return NewReplayerReader(f) +} + +// NewReplayerReader creates a Replayer that reads from r. +func NewReplayerReader(r io.Reader) (*Replayer, error) { + rep := &Replayer{ + log: func(string, ...interface{}) {}, + } + if err := rep.read(r); err != nil { + return nil, err + } + return rep, nil +} + +// read reads the stream of recorded entries. +// It matches requests with responses, with each pair grouped +// into a call struct. +func (rep *Replayer) read(r io.Reader) error { + r = bufio.NewReader(r) + bytes, err := readHeader(r) + if err != nil { + return err + } + rep.initial = bytes + + callsByIndex := map[int]*call{} + streamsByIndex := map[int]*stream{} + for i := 1; ; i++ { + e, err := readEntry(r) + if err != nil { + return err + } + if e == nil { + break + } + switch e.kind { + case pb.Entry_REQUEST: + callsByIndex[i] = &call{ + method: e.method, + request: e.msg.msg, + } + + case pb.Entry_RESPONSE: + call := callsByIndex[e.refIndex] + if call == nil { + return fmt.Errorf("replayer: no request for response #%d", i) + } + delete(callsByIndex, e.refIndex) + call.response = e.msg + rep.calls = append(rep.calls, call) + + case pb.Entry_CREATE_STREAM: + s := &stream{method: e.method, createIndex: i} + s.createErr = e.msg.err + streamsByIndex[i] = s + rep.streams = append(rep.streams, s) + + case pb.Entry_SEND: + s := streamsByIndex[e.refIndex] + if s == nil { + return fmt.Errorf("replayer: no stream for send #%d", i) + } + s.sends = append(s.sends, e.msg) + + case pb.Entry_RECV: + s := streamsByIndex[e.refIndex] + if s == nil { + return fmt.Errorf("replayer: no stream for recv #%d", i) + } + s.recvs = append(s.recvs, e.msg) + + default: + return fmt.Errorf("replayer: unknown kind %s", e.kind) + } + } + if len(callsByIndex) > 0 { + return fmt.Errorf("replayer: %d unmatched requests", len(callsByIndex)) + } + return nil +} + +// DialOptions returns the options that must be passed to grpc.Dial +// to enable replaying. +func (rep *Replayer) DialOptions() []grpc.DialOption { + return []grpc.DialOption{ + // On replay, we make no RPCs, which means the connection may be closed + // before the normally async Dial completes. Making the Dial synchronous + // fixes that. + grpc.WithBlock(), + grpc.WithUnaryInterceptor(rep.interceptUnary), + grpc.WithStreamInterceptor(rep.interceptStream), + } +} + +// Initial returns the initial state saved by the Recorder. +func (rep *Replayer) Initial() []byte { return rep.initial } + +// SetLogFunc sets a function to be used for debug logging. The function +// should be safe to be called from multiple goroutines. +func (rep *Replayer) SetLogFunc(f func(format string, v ...interface{})) { + rep.log = f +} + +// Close closes the Replayer. +func (rep *Replayer) Close() error { + return nil +} + +func (rep *Replayer) interceptUnary(_ context.Context, method string, req, res interface{}, _ *grpc.ClientConn, _ grpc.UnaryInvoker, _ ...grpc.CallOption) error { + mreq := req.(proto.Message) + if rep.BeforeFunc != nil { + if err := rep.BeforeFunc(method, mreq); err != nil { + return err + } + } + rep.log("request %s (%s)", method, req) + call := rep.extractCall(method, mreq) + if call == nil { + return fmt.Errorf("replayer: request not found: %s", mreq) + } + rep.log("returning %v", call.response) + if call.response.err != nil { + return call.response.err + } + proto.Merge(res.(proto.Message), call.response.msg) // copy msg into res + return nil +} + +func (rep *Replayer) interceptStream(ctx context.Context, _ *grpc.StreamDesc, _ *grpc.ClientConn, method string, _ grpc.Streamer, _ ...grpc.CallOption) (grpc.ClientStream, error) { + rep.log("create-stream %s", method) + str := rep.extractStream(method) + if str == nil { + return nil, fmt.Errorf("replayer: stream not found for method %s", method) + } + if str.createErr != nil { + return nil, str.createErr + } + return &repClientStream{ctx: ctx, str: str}, nil +} + +type repClientStream struct { + ctx context.Context + str *stream +} + +func (rcs *repClientStream) Context() context.Context { return rcs.ctx } + +func (rcs *repClientStream) SendMsg(m interface{}) error { + if len(rcs.str.sends) == 0 { + return fmt.Errorf("replayer: no more sends for stream %s, created at index %d", + rcs.str.method, rcs.str.createIndex) + } + // TODO(jba): Do not assume that the sends happen in the same order on replay. + msg := rcs.str.sends[0] + rcs.str.sends = rcs.str.sends[1:] + return msg.err +} + +func (rcs *repClientStream) RecvMsg(m interface{}) error { + if len(rcs.str.recvs) == 0 { + return fmt.Errorf("replayer: no more receives for stream %s, created at index %d", + rcs.str.method, rcs.str.createIndex) + } + msg := rcs.str.recvs[0] + rcs.str.recvs = rcs.str.recvs[1:] + if msg.err != nil { + return msg.err + } + proto.Merge(m.(proto.Message), msg.msg) // copy msg into m + return nil +} + +func (rcs *repClientStream) Header() (metadata.MD, error) { + log.Printf("replay: stream metadata not supported") + return nil, nil +} + +func (rcs *repClientStream) Trailer() metadata.MD { + log.Printf("replay: stream metadata not supported") + return nil +} + +func (rcs *repClientStream) CloseSend() error { + return nil +} + +// extractCall finds the first call in the list with the same method +// and request. It returns nil if it can't find such a call. +func (rep *Replayer) extractCall(method string, req proto.Message) *call { + rep.mu.Lock() + defer rep.mu.Unlock() + for i, call := range rep.calls { + if call == nil { + continue + } + if method == call.method && proto.Equal(req, call.request) { + rep.calls[i] = nil // nil out this call so we don't reuse it + return call + } + } + return nil +} + +func (rep *Replayer) extractStream(method string) *stream { + rep.mu.Lock() + defer rep.mu.Unlock() + for i, stream := range rep.streams { + if stream == nil { + continue + } + if method == stream.method { + rep.streams[i] = nil + return stream + } + } + return nil +} + +// Fprint reads the entries from filename and writes them to w in human-readable form. +// It is intended for debugging. +func Fprint(w io.Writer, filename string) error { + f, err := os.Open(filename) + if err != nil { + return err + } + defer f.Close() + return FprintReader(w, f) +} + +// FprintReader reads the entries from r and writes them to w in human-readable form. +// It is intended for debugging. +func FprintReader(w io.Writer, r io.Reader) error { + initial, err := readHeader(r) + if err != nil { + return err + } + fmt.Fprintf(w, "initial state: %q\n", string(initial)) + for i := 1; ; i++ { + e, err := readEntry(r) + if err != nil { + return err + } + if e == nil { + return nil + } + + s := "message" + if e.msg.err != nil { + s = "error" + } + fmt.Fprintf(w, "#%d: kind: %s, method: %s, ref index: %d, %s:\n", + i, e.kind, e.method, e.refIndex, s) + if e.msg.err == nil { + if err := proto.MarshalText(w, e.msg.msg); err != nil { + return err + } + } else { + fmt.Fprintf(w, "%v\n", e.msg.err) + } + } +} + +// An entry holds one gRPC action (request, response, etc.). +type entry struct { + kind pb.Entry_Kind + method string + msg message + refIndex int // index of corresponding request or create-stream +} + +func (e1 *entry) equal(e2 *entry) bool { + if e1 == nil && e2 == nil { + return true + } + if e1 == nil || e2 == nil { + return false + } + return e1.kind == e2.kind && + e1.method == e2.method && + proto.Equal(e1.msg.msg, e2.msg.msg) && + errEqual(e1.msg.err, e2.msg.err) && + e1.refIndex == e2.refIndex +} + +func errEqual(e1, e2 error) bool { + if e1 == e2 { + return true + } + s1, ok1 := status.FromError(e1) + s2, ok2 := status.FromError(e2) + if !ok1 || !ok2 { + return false + } + return proto.Equal(s1.Proto(), s2.Proto()) +} + +// message holds either a single proto.Message or an error. +type message struct { + msg proto.Message + err error +} + +func (m *message) set(msg interface{}, err error) { + m.err = err + if err != io.EOF && msg != nil { + m.msg = msg.(proto.Message) + } +} + +// File format: +// header +// sequence of Entry protos +// +// Header format: +// magic string +// a record containing the bytes of the initial state + +const magic = "RPCReplay" + +func writeHeader(w io.Writer, initial []byte) error { + if _, err := io.WriteString(w, magic); err != nil { + return err + } + return writeRecord(w, initial) +} + +func readHeader(r io.Reader) ([]byte, error) { + var buf [len(magic)]byte + if _, err := io.ReadFull(r, buf[:]); err != nil { + if err == io.EOF { + err = errors.New("rpcreplay: empty replay file") + } + return nil, err + } + if string(buf[:]) != magic { + return nil, errors.New("rpcreplay: not a replay file (does not begin with magic string)") + } + bytes, err := readRecord(r) + if err == io.EOF { + err = errors.New("rpcreplay: missing initial state") + } + return bytes, err +} + +func writeEntry(w io.Writer, e *entry) error { + var m proto.Message + if e.msg.err != nil && e.msg.err != io.EOF { + s, ok := status.FromError(e.msg.err) + if !ok { + return fmt.Errorf("rpcreplay: error %v is not a Status", e.msg.err) + } + m = s.Proto() + } else { + m = e.msg.msg + } + var a *any.Any + var err error + if m != nil { + a, err = ptypes.MarshalAny(m) + if err != nil { + return err + } + } + pe := &pb.Entry{ + Kind: e.kind, + Method: e.method, + Message: a, + IsError: e.msg.err != nil, + RefIndex: int32(e.refIndex), + } + bytes, err := proto.Marshal(pe) + if err != nil { + return err + } + return writeRecord(w, bytes) +} + +func readEntry(r io.Reader) (*entry, error) { + buf, err := readRecord(r) + if err == io.EOF { + return nil, nil + } + if err != nil { + return nil, err + } + var pe pb.Entry + if err := proto.Unmarshal(buf, &pe); err != nil { + return nil, err + } + var msg message + if pe.Message != nil { + var any ptypes.DynamicAny + if err := ptypes.UnmarshalAny(pe.Message, &any); err != nil { + return nil, err + } + if pe.IsError { + msg.err = status.ErrorProto(any.Message.(*spb.Status)) + } else { + msg.msg = any.Message + } + } else if pe.IsError { + msg.err = io.EOF + } else if pe.Kind != pb.Entry_CREATE_STREAM { + return nil, errors.New("rpcreplay: entry with nil message and false is_error") + } + return &entry{ + kind: pe.Kind, + method: pe.Method, + msg: msg, + refIndex: int(pe.RefIndex), + }, nil +} + +// A record consists of an unsigned 32-bit little-endian length L followed by L +// bytes. + +func writeRecord(w io.Writer, data []byte) error { + if err := binary.Write(w, binary.LittleEndian, uint32(len(data))); err != nil { + return err + } + _, err := w.Write(data) + return err +} + +func readRecord(r io.Reader) ([]byte, error) { + var size uint32 + if err := binary.Read(r, binary.LittleEndian, &size); err != nil { + return nil, err + } + buf := make([]byte, size) + if _, err := io.ReadFull(r, buf); err != nil { + return nil, err + } + return buf, nil +} diff --git a/vendor/cloud.google.com/go/rpcreplay/rpcreplay_test.go b/vendor/cloud.google.com/go/rpcreplay/rpcreplay_test.go new file mode 100644 index 000000000..64616c40b --- /dev/null +++ b/vendor/cloud.google.com/go/rpcreplay/rpcreplay_test.go @@ -0,0 +1,564 @@ +// Copyright 2017 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 rpcreplay + +import ( + "bytes" + "context" + "errors" + "io" + "strings" + "testing" + + "cloud.google.com/go/internal/testutil" + ipb "cloud.google.com/go/rpcreplay/proto/intstore" + rpb "cloud.google.com/go/rpcreplay/proto/rpcreplay" + "github.com/golang/protobuf/proto" + "github.com/google/go-cmp/cmp" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestRecordIO(t *testing.T) { + buf := &bytes.Buffer{} + want := []byte{1, 2, 3} + if err := writeRecord(buf, want); err != nil { + t.Fatal(err) + } + got, err := readRecord(buf) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(got, want) { + t.Errorf("got %v, want %v", got, want) + } +} + +func TestHeaderIO(t *testing.T) { + buf := &bytes.Buffer{} + want := []byte{1, 2, 3} + if err := writeHeader(buf, want); err != nil { + t.Fatal(err) + } + got, err := readHeader(buf) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(got, want) { + t.Errorf("got %v, want %v", got, want) + } + + // readHeader errors + for _, contents := range []string{"", "badmagic", "gRPCReplay"} { + if _, err := readHeader(bytes.NewBufferString(contents)); err == nil { + t.Errorf("%q: got nil, want error", contents) + } + } +} + +func TestEntryIO(t *testing.T) { + for i, want := range []*entry{ + { + kind: rpb.Entry_REQUEST, + method: "method", + msg: message{msg: &rpb.Entry{}}, + refIndex: 7, + }, + { + kind: rpb.Entry_RESPONSE, + method: "method", + msg: message{err: status.Error(codes.NotFound, "not found")}, + refIndex: 8, + }, + { + kind: rpb.Entry_RECV, + method: "method", + msg: message{err: io.EOF}, + refIndex: 3, + }, + } { + buf := &bytes.Buffer{} + if err := writeEntry(buf, want); err != nil { + t.Fatal(err) + } + got, err := readEntry(buf) + if err != nil { + t.Fatal(err) + } + if !got.equal(want) { + t.Errorf("#%d: got %v, want %v", i, got, want) + } + } +} + +var initialState = []byte{1, 2, 3} + +func TestRecord(t *testing.T) { + srv := newIntStoreServer() + defer srv.stop() + buf := record(t, srv) + + gotIstate, err := readHeader(buf) + if err != nil { + t.Fatal(err) + } + if !testutil.Equal(gotIstate, initialState) { + t.Fatalf("got %v, want %v", gotIstate, initialState) + } + item := &ipb.Item{Name: "a", Value: 1} + wantEntries := []*entry{ + // Set + { + kind: rpb.Entry_REQUEST, + method: "/intstore.IntStore/Set", + msg: message{msg: item}, + }, + { + kind: rpb.Entry_RESPONSE, + msg: message{msg: &ipb.SetResponse{PrevValue: 0}}, + refIndex: 1, + }, + // Get + { + kind: rpb.Entry_REQUEST, + method: "/intstore.IntStore/Get", + msg: message{msg: &ipb.GetRequest{Name: "a"}}, + }, + { + kind: rpb.Entry_RESPONSE, + msg: message{msg: item}, + refIndex: 3, + }, + { + kind: rpb.Entry_REQUEST, + method: "/intstore.IntStore/Get", + msg: message{msg: &ipb.GetRequest{Name: "x"}}, + }, + { + kind: rpb.Entry_RESPONSE, + msg: message{err: status.Error(codes.NotFound, `"x"`)}, + refIndex: 5, + }, + // ListItems + { // entry #7 + kind: rpb.Entry_CREATE_STREAM, + method: "/intstore.IntStore/ListItems", + }, + { + kind: rpb.Entry_SEND, + msg: message{msg: &ipb.ListItemsRequest{}}, + refIndex: 7, + }, + { + kind: rpb.Entry_RECV, + msg: message{msg: item}, + refIndex: 7, + }, + { + kind: rpb.Entry_RECV, + msg: message{err: io.EOF}, + refIndex: 7, + }, + // SetStream + { // entry #11 + kind: rpb.Entry_CREATE_STREAM, + method: "/intstore.IntStore/SetStream", + }, + { + kind: rpb.Entry_SEND, + msg: message{msg: &ipb.Item{Name: "b", Value: 2}}, + refIndex: 11, + }, + { + kind: rpb.Entry_SEND, + msg: message{msg: &ipb.Item{Name: "c", Value: 3}}, + refIndex: 11, + }, + { + kind: rpb.Entry_RECV, + msg: message{msg: &ipb.Summary{Count: 2}}, + refIndex: 11, + }, + + // StreamChat + { // entry #15 + kind: rpb.Entry_CREATE_STREAM, + method: "/intstore.IntStore/StreamChat", + }, + { + kind: rpb.Entry_SEND, + msg: message{msg: &ipb.Item{Name: "d", Value: 4}}, + refIndex: 15, + }, + { + kind: rpb.Entry_RECV, + msg: message{msg: &ipb.Item{Name: "d", Value: 4}}, + refIndex: 15, + }, + { + kind: rpb.Entry_SEND, + msg: message{msg: &ipb.Item{Name: "e", Value: 5}}, + refIndex: 15, + }, + { + kind: rpb.Entry_RECV, + msg: message{msg: &ipb.Item{Name: "e", Value: 5}}, + refIndex: 15, + }, + { + kind: rpb.Entry_RECV, + msg: message{err: io.EOF}, + refIndex: 15, + }, + } + for i, w := range wantEntries { + g, err := readEntry(buf) + if err != nil { + t.Fatalf("#%d: %v", i+1, err) + } + if !g.equal(w) { + t.Errorf("#%d:\ngot %+v\nwant %+v", i+1, g, w) + } + } + g, err := readEntry(buf) + if err != nil { + t.Fatal(err) + } + if g != nil { + t.Errorf("\ngot %+v\nwant nil", g) + } +} + +func TestReplay(t *testing.T) { + srv := newIntStoreServer() + defer srv.stop() + + buf := record(t, srv) + rep, err := NewReplayerReader(buf) + if err != nil { + t.Fatal(err) + } + if got, want := rep.Initial(), initialState; !testutil.Equal(got, want) { + t.Fatalf("got %v, want %v", got, want) + } + // Replay the test. + testService(t, srv.Addr, rep.DialOptions()) +} + +func record(t *testing.T, srv *intStoreServer) *bytes.Buffer { + buf := &bytes.Buffer{} + rec, err := NewRecorderWriter(buf, initialState) + if err != nil { + t.Fatal(err) + } + testService(t, srv.Addr, rec.DialOptions()) + if err := rec.Close(); err != nil { + t.Fatal(err) + } + return buf +} + +func testService(t *testing.T, addr string, opts []grpc.DialOption) { + conn, err := grpc.Dial(addr, + append([]grpc.DialOption{grpc.WithInsecure()}, opts...)...) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + client := ipb.NewIntStoreClient(conn) + ctx := context.Background() + item := &ipb.Item{Name: "a", Value: 1} + res, err := client.Set(ctx, item) + if err != nil { + t.Fatal(err) + } + if res.PrevValue != 0 { + t.Errorf("got %d, want 0", res.PrevValue) + } + got, err := client.Get(ctx, &ipb.GetRequest{Name: "a"}) + if err != nil { + t.Fatal(err) + } + if !proto.Equal(got, item) { + t.Errorf("got %v, want %v", got, item) + } + _, err = client.Get(ctx, &ipb.GetRequest{Name: "x"}) + if err == nil { + t.Fatal("got nil, want error") + } + if _, ok := status.FromError(err); !ok { + t.Errorf("got error type %T, want a grpc/status.Status", err) + } + + wantItems := []*ipb.Item{item} + lic, err := client.ListItems(ctx, &ipb.ListItemsRequest{}) + if err != nil { + t.Fatal(err) + } + for i := 0; ; i++ { + item, err := lic.Recv() + if err == io.EOF { + break + } + if err != nil { + t.Fatal(err) + } + if i >= len(wantItems) || !proto.Equal(item, wantItems[i]) { + t.Fatalf("%d: bad item", i) + } + } + + ssc, err := client.SetStream(ctx) + if err != nil { + t.Fatal(err) + } + + must := func(err error) { + if err != nil { + t.Fatal(err) + } + } + + for i, name := range []string{"b", "c"} { + must(ssc.Send(&ipb.Item{Name: name, Value: int32(i + 2)})) + } + summary, err := ssc.CloseAndRecv() + if err != nil { + t.Fatal(err) + } + if got, want := summary.Count, int32(2); got != want { + t.Fatalf("got %d, want %d", got, want) + } + + chatc, err := client.StreamChat(ctx) + if err != nil { + t.Fatal(err) + } + for i, name := range []string{"d", "e"} { + item := &ipb.Item{Name: name, Value: int32(i + 4)} + must(chatc.Send(item)) + got, err := chatc.Recv() + if err != nil { + t.Fatal(err) + } + if !proto.Equal(got, item) { + t.Errorf("got %v, want %v", got, item) + } + } + must(chatc.CloseSend()) + if _, err := chatc.Recv(); err != io.EOF { + t.Fatalf("got %v, want EOF", err) + } +} + +func TestRecorderBeforeFunc(t *testing.T) { + var tests = []struct { + name string + msg, wantRespMsg, wantEntryMsg *ipb.Item + f func(string, proto.Message) error + wantErr bool + }{ + { + name: "BeforeFunc should modify messages saved, but not alter what is sent/received to/from services", + msg: &ipb.Item{Name: "foo", Value: 1}, + wantEntryMsg: &ipb.Item{Name: "bar", Value: 2}, + wantRespMsg: &ipb.Item{Name: "foo", Value: 1}, + f: func(method string, m proto.Message) error { + // This callback only runs when Set is called. + if !strings.HasSuffix(method, "Set") { + return nil + } + if _, ok := m.(*ipb.Item); !ok { + return nil + } + + item := m.(*ipb.Item) + item.Name = "bar" + item.Value = 2 + return nil + }, + }, + { + name: "BeforeFunc should not be able to alter returned responses", + msg: &ipb.Item{Name: "foo", Value: 1}, + wantRespMsg: &ipb.Item{Name: "foo", Value: 1}, + f: func(method string, m proto.Message) error { + // This callback only runs when Get is called. + if !strings.HasSuffix(method, "Get") { + return nil + } + if _, ok := m.(*ipb.Item); !ok { + return nil + } + + item := m.(*ipb.Item) + item.Value = 2 + return nil + }, + }, + { + name: "Errors should cause the RPC send to fail", + msg: &ipb.Item{}, + f: func(_ string, _ proto.Message) error { + return errors.New("err") + }, + wantErr: true, + }, + } + + for _, tc := range tests { + // Wrap test cases in a func so defers execute correctly. + func() { + srv := newIntStoreServer() + defer srv.stop() + + var b bytes.Buffer + r, err := NewRecorderWriter(&b, nil) + if err != nil { + t.Error(err) + return + } + r.BeforeFunc = tc.f + ctx := context.Background() + conn, err := grpc.DialContext(ctx, srv.Addr, append([]grpc.DialOption{grpc.WithInsecure()}, r.DialOptions()...)...) + if err != nil { + t.Error(err) + return + } + defer conn.Close() + + client := ipb.NewIntStoreClient(conn) + _, err = client.Set(ctx, tc.msg) + switch { + case err != nil && !tc.wantErr: + t.Error(err) + return + case err == nil && tc.wantErr: + t.Errorf("got nil; want error") + return + case err != nil: + // Error found as expected, don't check Get(). + return + } + + if tc.wantRespMsg != nil { + got, err := client.Get(ctx, &ipb.GetRequest{Name: tc.msg.GetName()}) + if err != nil { + t.Error(err) + return + } + if !cmp.Equal(got, tc.wantRespMsg) { + t.Errorf("got %+v; want %+v", got, tc.wantRespMsg) + } + } + + r.Close() + + if tc.wantEntryMsg != nil { + _, _ = readHeader(&b) + e, err := readEntry(&b) + if err != nil { + t.Error(err) + return + } + got := e.msg.msg.(*ipb.Item) + if !cmp.Equal(got, tc.wantEntryMsg) { + t.Errorf("got %v; want %v", got, tc.wantEntryMsg) + } + } + }() + } +} + +func TestReplayerBeforeFunc(t *testing.T) { + var tests = []struct { + name string + msg, reqMsg *ipb.Item + f func(string, proto.Message) error + wantErr bool + }{ + { + name: "BeforeFunc should modify messages sent before they are passed to the replayer", + msg: &ipb.Item{Name: "foo", Value: 1}, + reqMsg: &ipb.Item{Name: "bar", Value: 1}, + f: func(method string, m proto.Message) error { + item := m.(*ipb.Item) + item.Name = "foo" + return nil + }, + }, + { + name: "Errors should cause the RPC send to fail", + msg: &ipb.Item{}, + f: func(_ string, _ proto.Message) error { + return errors.New("err") + }, + wantErr: true, + }, + } + + for _, tc := range tests { + // Wrap test cases in a func so defers execute correctly. + func() { + srv := newIntStoreServer() + defer srv.stop() + + var b bytes.Buffer + rec, err := NewRecorderWriter(&b, nil) + if err != nil { + t.Error(err) + return + } + ctx := context.Background() + conn, err := grpc.DialContext(ctx, srv.Addr, append([]grpc.DialOption{grpc.WithInsecure()}, rec.DialOptions()...)...) + if err != nil { + t.Error(err) + return + } + defer conn.Close() + + client := ipb.NewIntStoreClient(conn) + _, err = client.Set(ctx, tc.msg) + if err != nil { + t.Error(err) + return + } + rec.Close() + + rep, err := NewReplayerReader(&b) + if err != nil { + t.Error(err) + return + } + rep.BeforeFunc = tc.f + conn, err = grpc.DialContext(ctx, srv.Addr, append([]grpc.DialOption{grpc.WithInsecure()}, rep.DialOptions()...)...) + if err != nil { + t.Error(err) + return + } + defer conn.Close() + + client = ipb.NewIntStoreClient(conn) + _, err = client.Set(ctx, tc.reqMsg) + switch { + case err != nil && !tc.wantErr: + t.Error(err) + case err == nil && tc.wantErr: + t.Errorf("got nil; want error") + } + }() + } +} diff --git a/vendor/cloud.google.com/go/run-tests.sh b/vendor/cloud.google.com/go/run-tests.sh new file mode 100755 index 000000000..a643e61c4 --- /dev/null +++ b/vendor/cloud.google.com/go/run-tests.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +# Selectively run tests for this repo, based on what has changed +# in a commit. Runs short tests for the whole repo, and full tests +# for changed directories. + +set -e + +prefix=cloud.google.com/go + +dryrun=false +if [[ $1 == "-n" ]]; then + dryrun=true + shift +fi + +if [[ $1 == "" ]]; then + echo >&2 "usage: $0 [-n] COMMIT" + exit 1 +fi + +# Files or directories that cause all tests to run if modified. +declare -A run_all +run_all=([.travis.yml]=1 [run-tests.sh]=1) + +function run { + if $dryrun; then + echo $* + else + (set -x; $*) + fi +} + + +# Find all the packages that have changed in this commit. +declare -A changed_packages + +for f in $(git diff-tree --no-commit-id --name-only -r $1); do + if [[ ${run_all[$f]} == 1 ]]; then + # This change requires a full test. Do it and exit. + run go test -race -v $prefix/... + exit + fi + # Map, e.g., "spanner/client.go" to "$prefix/spanner". + d=$(dirname $f) + if [[ $d == "." ]]; then + pkg=$prefix + else + pkg=$prefix/$d + fi + changed_packages[$pkg]=1 +done + +echo "changed packages: ${!changed_packages[*]}" + + +# Reports whether its argument, a package name, depends (recursively) +# on a changed package. +function depends_on_changed_package { + # According to go list, a package does not depend on itself, so + # we test that separately. + if [[ ${changed_packages[$1]} == 1 ]]; then + return 0 + fi + for dep in $(go list -f '{{range .Deps}}{{.}} {{end}}' $1); do + if [[ ${changed_packages[$dep]} == 1 ]]; then + return 0 + fi + done + return 1 +} + +# Collect the packages into two separate lists. (It is faster to call "go test" on a +# list of packages than to individually "go test" each one.) + +shorts= +fulls= +for pkg in $(go list $prefix/...); do # for each package in the repo + if depends_on_changed_package $pkg; then # if it depends on a changed package + fulls="$fulls $pkg" # run the full test + else # otherwise + shorts="$shorts $pkg" # run the short test + fi +done +run go test -race -v -short $shorts +if [[ $fulls != "" ]]; then + run go test -race -v $fulls +fi diff --git a/vendor/cloud.google.com/go/scheduler/apiv1beta1/cloud_scheduler_client.go b/vendor/cloud.google.com/go/scheduler/apiv1beta1/cloud_scheduler_client.go new file mode 100644 index 000000000..c14c48c47 --- /dev/null +++ b/vendor/cloud.google.com/go/scheduler/apiv1beta1/cloud_scheduler_client.go @@ -0,0 +1,344 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package scheduler + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CloudSchedulerCallOptions contains the retry settings for each method of CloudSchedulerClient. +type CloudSchedulerCallOptions struct { + ListJobs []gax.CallOption + GetJob []gax.CallOption + CreateJob []gax.CallOption + UpdateJob []gax.CallOption + DeleteJob []gax.CallOption + PauseJob []gax.CallOption + ResumeJob []gax.CallOption + RunJob []gax.CallOption +} + +func defaultCloudSchedulerClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cloudscheduler.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCloudSchedulerCallOptions() *CloudSchedulerCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CloudSchedulerCallOptions{ + ListJobs: retry[[2]string{"default", "idempotent"}], + GetJob: retry[[2]string{"default", "idempotent"}], + CreateJob: retry[[2]string{"default", "non_idempotent"}], + UpdateJob: retry[[2]string{"default", "non_idempotent"}], + DeleteJob: retry[[2]string{"default", "idempotent"}], + PauseJob: retry[[2]string{"default", "idempotent"}], + ResumeJob: retry[[2]string{"default", "idempotent"}], + RunJob: retry[[2]string{"default", "non_idempotent"}], + } +} + +// CloudSchedulerClient is a client for interacting with Cloud Scheduler API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type CloudSchedulerClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + cloudSchedulerClient schedulerpb.CloudSchedulerClient + + // The call options for this service. + CallOptions *CloudSchedulerCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewCloudSchedulerClient creates a new cloud scheduler client. +// +// The Cloud Scheduler API allows external entities to reliably +// schedule asynchronous jobs. +func NewCloudSchedulerClient(ctx context.Context, opts ...option.ClientOption) (*CloudSchedulerClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultCloudSchedulerClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &CloudSchedulerClient{ + conn: conn, + CallOptions: defaultCloudSchedulerCallOptions(), + + cloudSchedulerClient: schedulerpb.NewCloudSchedulerClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *CloudSchedulerClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *CloudSchedulerClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *CloudSchedulerClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListJobs lists jobs. +func (c *CloudSchedulerClient) ListJobs(ctx context.Context, req *schedulerpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListJobs[0:len(c.CallOptions.ListJobs):len(c.CallOptions.ListJobs)], opts...) + it := &JobIterator{} + req = proto.Clone(req).(*schedulerpb.ListJobsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*schedulerpb.Job, string, error) { + var resp *schedulerpb.ListJobsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudSchedulerClient.ListJobs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Jobs, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetJob gets a job. +func (c *CloudSchedulerClient) GetJob(ctx context.Context, req *schedulerpb.GetJobRequest, opts ...gax.CallOption) (*schedulerpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetJob[0:len(c.CallOptions.GetJob):len(c.CallOptions.GetJob)], opts...) + var resp *schedulerpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudSchedulerClient.GetJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateJob creates a job. +func (c *CloudSchedulerClient) CreateJob(ctx context.Context, req *schedulerpb.CreateJobRequest, opts ...gax.CallOption) (*schedulerpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateJob[0:len(c.CallOptions.CreateJob):len(c.CallOptions.CreateJob)], opts...) + var resp *schedulerpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudSchedulerClient.CreateJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateJob updates a job. +// +// If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is returned. If the job does +// not exist, NOT_FOUND is returned. +// +// If UpdateJob does not successfully return, it is possible for the +// job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED] state. A job in this state may +// not be executed. If this happens, retry the UpdateJob request +// until a successful response is received. +func (c *CloudSchedulerClient) UpdateJob(ctx context.Context, req *schedulerpb.UpdateJobRequest, opts ...gax.CallOption) (*schedulerpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateJob[0:len(c.CallOptions.UpdateJob):len(c.CallOptions.UpdateJob)], opts...) + var resp *schedulerpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudSchedulerClient.UpdateJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteJob deletes a job. +func (c *CloudSchedulerClient) DeleteJob(ctx context.Context, req *schedulerpb.DeleteJobRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteJob[0:len(c.CallOptions.DeleteJob):len(c.CallOptions.DeleteJob)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.cloudSchedulerClient.DeleteJob(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// PauseJob pauses a job. +// +// If a job is paused then the system will stop executing the job +// until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. The +// state of the job is stored in [state][google.cloud.scheduler.v1beta1.Job.state]; if paused it +// will be set to [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED] +// to be paused. +func (c *CloudSchedulerClient) PauseJob(ctx context.Context, req *schedulerpb.PauseJobRequest, opts ...gax.CallOption) (*schedulerpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.PauseJob[0:len(c.CallOptions.PauseJob):len(c.CallOptions.PauseJob)], opts...) + var resp *schedulerpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudSchedulerClient.PauseJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ResumeJob resume a job. +// +// This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. The +// state of a job is stored in [Job.state][google.cloud.scheduler.v1beta1.Job.state]; after calling this method it +// will be set to [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED]. A job must be in +// [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED] to be resumed. +func (c *CloudSchedulerClient) ResumeJob(ctx context.Context, req *schedulerpb.ResumeJobRequest, opts ...gax.CallOption) (*schedulerpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ResumeJob[0:len(c.CallOptions.ResumeJob):len(c.CallOptions.ResumeJob)], opts...) + var resp *schedulerpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudSchedulerClient.ResumeJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// RunJob forces a job to run now. +// +// When this method is called, Cloud Scheduler will dispatch the job, even +// if the job is already running. +func (c *CloudSchedulerClient) RunJob(ctx context.Context, req *schedulerpb.RunJobRequest, opts ...gax.CallOption) (*schedulerpb.Job, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.RunJob[0:len(c.CallOptions.RunJob):len(c.CallOptions.RunJob)], opts...) + var resp *schedulerpb.Job + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.cloudSchedulerClient.RunJob(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// JobIterator manages a stream of *schedulerpb.Job. +type JobIterator struct { + items []*schedulerpb.Job + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*schedulerpb.Job, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *JobIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *JobIterator) Next() (*schedulerpb.Job, error) { + var item *schedulerpb.Job + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *JobIterator) bufLen() int { + return len(it.items) +} + +func (it *JobIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/scheduler/apiv1beta1/cloud_scheduler_client_example_test.go b/vendor/cloud.google.com/go/scheduler/apiv1beta1/cloud_scheduler_client_example_test.go new file mode 100644 index 000000000..f748ba05b --- /dev/null +++ b/vendor/cloud.google.com/go/scheduler/apiv1beta1/cloud_scheduler_client_example_test.go @@ -0,0 +1,183 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package scheduler_test + +import ( + "context" + + scheduler "cloud.google.com/go/scheduler/apiv1beta1" + "google.golang.org/api/iterator" + schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" +) + +func ExampleNewCloudSchedulerClient() { + ctx := context.Background() + c, err := scheduler.NewCloudSchedulerClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleCloudSchedulerClient_ListJobs() { + ctx := context.Background() + c, err := scheduler.NewCloudSchedulerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &schedulerpb.ListJobsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListJobs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleCloudSchedulerClient_GetJob() { + ctx := context.Background() + c, err := scheduler.NewCloudSchedulerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &schedulerpb.GetJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudSchedulerClient_CreateJob() { + ctx := context.Background() + c, err := scheduler.NewCloudSchedulerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &schedulerpb.CreateJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudSchedulerClient_UpdateJob() { + ctx := context.Background() + c, err := scheduler.NewCloudSchedulerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &schedulerpb.UpdateJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudSchedulerClient_DeleteJob() { + ctx := context.Background() + c, err := scheduler.NewCloudSchedulerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &schedulerpb.DeleteJobRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteJob(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleCloudSchedulerClient_PauseJob() { + ctx := context.Background() + c, err := scheduler.NewCloudSchedulerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &schedulerpb.PauseJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PauseJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudSchedulerClient_ResumeJob() { + ctx := context.Background() + c, err := scheduler.NewCloudSchedulerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &schedulerpb.ResumeJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ResumeJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleCloudSchedulerClient_RunJob() { + ctx := context.Background() + c, err := scheduler.NewCloudSchedulerClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &schedulerpb.RunJobRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RunJob(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/scheduler/apiv1beta1/doc.go b/vendor/cloud.google.com/go/scheduler/apiv1beta1/doc.go new file mode 100644 index 000000000..1fbb60a8f --- /dev/null +++ b/vendor/cloud.google.com/go/scheduler/apiv1beta1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package scheduler is an auto-generated package for the +// Cloud Scheduler API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Creates and manages jobs run on a regular recurring schedule. +package scheduler // import "cloud.google.com/go/scheduler/apiv1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/scheduler/apiv1beta1/mock_test.go b/vendor/cloud.google.com/go/scheduler/apiv1beta1/mock_test.go new file mode 100644 index 000000000..19fd1f9c8 --- /dev/null +++ b/vendor/cloud.google.com/go/scheduler/apiv1beta1/mock_test.go @@ -0,0 +1,706 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package scheduler + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockCloudSchedulerServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + schedulerpb.CloudSchedulerServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockCloudSchedulerServer) ListJobs(ctx context.Context, req *schedulerpb.ListJobsRequest) (*schedulerpb.ListJobsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*schedulerpb.ListJobsResponse), nil +} + +func (s *mockCloudSchedulerServer) GetJob(ctx context.Context, req *schedulerpb.GetJobRequest) (*schedulerpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*schedulerpb.Job), nil +} + +func (s *mockCloudSchedulerServer) CreateJob(ctx context.Context, req *schedulerpb.CreateJobRequest) (*schedulerpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*schedulerpb.Job), nil +} + +func (s *mockCloudSchedulerServer) UpdateJob(ctx context.Context, req *schedulerpb.UpdateJobRequest) (*schedulerpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*schedulerpb.Job), nil +} + +func (s *mockCloudSchedulerServer) DeleteJob(ctx context.Context, req *schedulerpb.DeleteJobRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockCloudSchedulerServer) PauseJob(ctx context.Context, req *schedulerpb.PauseJobRequest) (*schedulerpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*schedulerpb.Job), nil +} + +func (s *mockCloudSchedulerServer) ResumeJob(ctx context.Context, req *schedulerpb.ResumeJobRequest) (*schedulerpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*schedulerpb.Job), nil +} + +func (s *mockCloudSchedulerServer) RunJob(ctx context.Context, req *schedulerpb.RunJobRequest) (*schedulerpb.Job, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*schedulerpb.Job), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockCloudScheduler mockCloudSchedulerServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + schedulerpb.RegisterCloudSchedulerServer(serv, &mockCloudScheduler) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestCloudSchedulerListJobs(t *testing.T) { + var nextPageToken string = "" + var jobsElement *schedulerpb.Job = &schedulerpb.Job{} + var jobs = []*schedulerpb.Job{jobsElement} + var expectedResponse = &schedulerpb.ListJobsResponse{ + NextPageToken: nextPageToken, + Jobs: jobs, + } + + mockCloudScheduler.err = nil + mockCloudScheduler.reqs = nil + + mockCloudScheduler.resps = append(mockCloudScheduler.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &schedulerpb.ListJobsRequest{ + Parent: formattedParent, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListJobs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudScheduler.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Jobs[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudSchedulerListJobsError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudScheduler.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &schedulerpb.ListJobsRequest{ + Parent: formattedParent, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListJobs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudSchedulerGetJob(t *testing.T) { + var name2 string = "name2-1052831874" + var description string = "description-1724546052" + var schedule string = "schedule-697920873" + var timeZone string = "timeZone36848094" + var expectedResponse = &schedulerpb.Job{ + Name: name2, + Description: description, + Schedule: schedule, + TimeZone: timeZone, + } + + mockCloudScheduler.err = nil + mockCloudScheduler.reqs = nil + + mockCloudScheduler.resps = append(mockCloudScheduler.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.GetJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudScheduler.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudSchedulerGetJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudScheduler.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.GetJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudSchedulerCreateJob(t *testing.T) { + var name string = "name3373707" + var description string = "description-1724546052" + var schedule string = "schedule-697920873" + var timeZone string = "timeZone36848094" + var expectedResponse = &schedulerpb.Job{ + Name: name, + Description: description, + Schedule: schedule, + TimeZone: timeZone, + } + + mockCloudScheduler.err = nil + mockCloudScheduler.reqs = nil + + mockCloudScheduler.resps = append(mockCloudScheduler.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var job *schedulerpb.Job = &schedulerpb.Job{} + var request = &schedulerpb.CreateJobRequest{ + Parent: formattedParent, + Job: job, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudScheduler.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudSchedulerCreateJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudScheduler.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var job *schedulerpb.Job = &schedulerpb.Job{} + var request = &schedulerpb.CreateJobRequest{ + Parent: formattedParent, + Job: job, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudSchedulerUpdateJob(t *testing.T) { + var name string = "name3373707" + var description string = "description-1724546052" + var schedule string = "schedule-697920873" + var timeZone string = "timeZone36848094" + var expectedResponse = &schedulerpb.Job{ + Name: name, + Description: description, + Schedule: schedule, + TimeZone: timeZone, + } + + mockCloudScheduler.err = nil + mockCloudScheduler.reqs = nil + + mockCloudScheduler.resps = append(mockCloudScheduler.resps[:0], expectedResponse) + + var job *schedulerpb.Job = &schedulerpb.Job{} + var request = &schedulerpb.UpdateJobRequest{ + Job: job, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudScheduler.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudSchedulerUpdateJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudScheduler.err = gstatus.Error(errCode, "test error") + + var job *schedulerpb.Job = &schedulerpb.Job{} + var request = &schedulerpb.UpdateJobRequest{ + Job: job, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudSchedulerDeleteJob(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockCloudScheduler.err = nil + mockCloudScheduler.reqs = nil + + mockCloudScheduler.resps = append(mockCloudScheduler.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.DeleteJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudScheduler.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestCloudSchedulerDeleteJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudScheduler.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.DeleteJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestCloudSchedulerPauseJob(t *testing.T) { + var name2 string = "name2-1052831874" + var description string = "description-1724546052" + var schedule string = "schedule-697920873" + var timeZone string = "timeZone36848094" + var expectedResponse = &schedulerpb.Job{ + Name: name2, + Description: description, + Schedule: schedule, + TimeZone: timeZone, + } + + mockCloudScheduler.err = nil + mockCloudScheduler.reqs = nil + + mockCloudScheduler.resps = append(mockCloudScheduler.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.PauseJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PauseJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudScheduler.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudSchedulerPauseJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudScheduler.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.PauseJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PauseJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudSchedulerResumeJob(t *testing.T) { + var name2 string = "name2-1052831874" + var description string = "description-1724546052" + var schedule string = "schedule-697920873" + var timeZone string = "timeZone36848094" + var expectedResponse = &schedulerpb.Job{ + Name: name2, + Description: description, + Schedule: schedule, + TimeZone: timeZone, + } + + mockCloudScheduler.err = nil + mockCloudScheduler.reqs = nil + + mockCloudScheduler.resps = append(mockCloudScheduler.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.ResumeJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ResumeJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudScheduler.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudSchedulerResumeJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudScheduler.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.ResumeJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ResumeJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestCloudSchedulerRunJob(t *testing.T) { + var name2 string = "name2-1052831874" + var description string = "description-1724546052" + var schedule string = "schedule-697920873" + var timeZone string = "timeZone36848094" + var expectedResponse = &schedulerpb.Job{ + Name: name2, + Description: description, + Schedule: schedule, + TimeZone: timeZone, + } + + mockCloudScheduler.err = nil + mockCloudScheduler.reqs = nil + + mockCloudScheduler.resps = append(mockCloudScheduler.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.RunJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RunJob(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockCloudScheduler.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestCloudSchedulerRunJobError(t *testing.T) { + errCode := codes.PermissionDenied + mockCloudScheduler.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/jobs/%s", "[PROJECT]", "[LOCATION]", "[JOB]") + var request = &schedulerpb.RunJobRequest{ + Name: formattedName, + } + + c, err := NewCloudSchedulerClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.RunJob(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/securitycenter/apiv1beta1/doc.go b/vendor/cloud.google.com/go/securitycenter/apiv1beta1/doc.go new file mode 100644 index 000000000..65c6e9956 --- /dev/null +++ b/vendor/cloud.google.com/go/securitycenter/apiv1beta1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package securitycenter is an auto-generated package for the +// Cloud Security Command Center API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// The public Cloud Security Command Center API. +package securitycenter // import "cloud.google.com/go/securitycenter/apiv1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/securitycenter/apiv1beta1/mock_test.go b/vendor/cloud.google.com/go/securitycenter/apiv1beta1/mock_test.go new file mode 100644 index 000000000..195c7103d --- /dev/null +++ b/vendor/cloud.google.com/go/securitycenter/apiv1beta1/mock_test.go @@ -0,0 +1,1538 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package securitycenter + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + timestamppb "github.com/golang/protobuf/ptypes/timestamp" + securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1" + iampb "google.golang.org/genproto/googleapis/iam/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockSecurityCenterServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + securitycenterpb.SecurityCenterServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockSecurityCenterServer) CreateSource(ctx context.Context, req *securitycenterpb.CreateSourceRequest) (*securitycenterpb.Source, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.Source), nil +} + +func (s *mockSecurityCenterServer) CreateFinding(ctx context.Context, req *securitycenterpb.CreateFindingRequest) (*securitycenterpb.Finding, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.Finding), nil +} + +func (s *mockSecurityCenterServer) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockSecurityCenterServer) GetOrganizationSettings(ctx context.Context, req *securitycenterpb.GetOrganizationSettingsRequest) (*securitycenterpb.OrganizationSettings, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.OrganizationSettings), nil +} + +func (s *mockSecurityCenterServer) GetSource(ctx context.Context, req *securitycenterpb.GetSourceRequest) (*securitycenterpb.Source, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.Source), nil +} + +func (s *mockSecurityCenterServer) GroupAssets(ctx context.Context, req *securitycenterpb.GroupAssetsRequest) (*securitycenterpb.GroupAssetsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.GroupAssetsResponse), nil +} + +func (s *mockSecurityCenterServer) GroupFindings(ctx context.Context, req *securitycenterpb.GroupFindingsRequest) (*securitycenterpb.GroupFindingsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.GroupFindingsResponse), nil +} + +func (s *mockSecurityCenterServer) ListAssets(ctx context.Context, req *securitycenterpb.ListAssetsRequest) (*securitycenterpb.ListAssetsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.ListAssetsResponse), nil +} + +func (s *mockSecurityCenterServer) ListFindings(ctx context.Context, req *securitycenterpb.ListFindingsRequest) (*securitycenterpb.ListFindingsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.ListFindingsResponse), nil +} + +func (s *mockSecurityCenterServer) ListSources(ctx context.Context, req *securitycenterpb.ListSourcesRequest) (*securitycenterpb.ListSourcesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.ListSourcesResponse), nil +} + +func (s *mockSecurityCenterServer) RunAssetDiscovery(ctx context.Context, req *securitycenterpb.RunAssetDiscoveryRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockSecurityCenterServer) SetFindingState(ctx context.Context, req *securitycenterpb.SetFindingStateRequest) (*securitycenterpb.Finding, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.Finding), nil +} + +func (s *mockSecurityCenterServer) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockSecurityCenterServer) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.TestIamPermissionsResponse), nil +} + +func (s *mockSecurityCenterServer) UpdateFinding(ctx context.Context, req *securitycenterpb.UpdateFindingRequest) (*securitycenterpb.Finding, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.Finding), nil +} + +func (s *mockSecurityCenterServer) UpdateOrganizationSettings(ctx context.Context, req *securitycenterpb.UpdateOrganizationSettingsRequest) (*securitycenterpb.OrganizationSettings, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.OrganizationSettings), nil +} + +func (s *mockSecurityCenterServer) UpdateSource(ctx context.Context, req *securitycenterpb.UpdateSourceRequest) (*securitycenterpb.Source, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.Source), nil +} + +func (s *mockSecurityCenterServer) UpdateSecurityMarks(ctx context.Context, req *securitycenterpb.UpdateSecurityMarksRequest) (*securitycenterpb.SecurityMarks, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*securitycenterpb.SecurityMarks), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockSecurityCenter mockSecurityCenterServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + securitycenterpb.RegisterSecurityCenterServer(serv, &mockSecurityCenter) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestSecurityCenterCreateSource(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &securitycenterpb.Source{ + Name: name, + DisplayName: displayName, + Description: description, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var source *securitycenterpb.Source = &securitycenterpb.Source{} + var request = &securitycenterpb.CreateSourceRequest{ + Parent: formattedParent, + Source: source, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSource(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterCreateSourceError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var source *securitycenterpb.Source = &securitycenterpb.Source{} + var request = &securitycenterpb.CreateSourceRequest{ + Parent: formattedParent, + Source: source, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSource(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterCreateFinding(t *testing.T) { + var name string = "name3373707" + var parent2 string = "parent21175163357" + var resourceName string = "resourceName979421212" + var category string = "category50511102" + var externalUri string = "externalUri-1385596168" + var expectedResponse = &securitycenterpb.Finding{ + Name: name, + Parent: parent2, + ResourceName: resourceName, + Category: category, + ExternalUri: externalUri, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var findingId string = "findingId728776081" + var finding *securitycenterpb.Finding = &securitycenterpb.Finding{} + var request = &securitycenterpb.CreateFindingRequest{ + Parent: formattedParent, + FindingId: findingId, + Finding: finding, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateFinding(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterCreateFindingError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var findingId string = "findingId728776081" + var finding *securitycenterpb.Finding = &securitycenterpb.Finding{} + var request = &securitycenterpb.CreateFindingRequest{ + Parent: formattedParent, + FindingId: findingId, + Finding: finding, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateFinding(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterGetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterGetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterGetOrganizationSettings(t *testing.T) { + var name2 string = "name2-1052831874" + var enableAssetDiscovery bool = false + var expectedResponse = &securitycenterpb.OrganizationSettings{ + Name: name2, + EnableAssetDiscovery: enableAssetDiscovery, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/organizationSettings", "[ORGANIZATION]") + var request = &securitycenterpb.GetOrganizationSettingsRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOrganizationSettings(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterGetOrganizationSettingsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/organizationSettings", "[ORGANIZATION]") + var request = &securitycenterpb.GetOrganizationSettingsRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetOrganizationSettings(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterGetSource(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &securitycenterpb.Source{ + Name: name2, + DisplayName: displayName, + Description: description, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var request = &securitycenterpb.GetSourceRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSource(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterGetSourceError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var request = &securitycenterpb.GetSourceRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSource(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterGroupAssets(t *testing.T) { + var nextPageToken string = "" + var groupByResultsElement *securitycenterpb.GroupResult = &securitycenterpb.GroupResult{} + var groupByResults = []*securitycenterpb.GroupResult{groupByResultsElement} + var expectedResponse = &securitycenterpb.GroupAssetsResponse{ + NextPageToken: nextPageToken, + GroupByResults: groupByResults, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var groupBy string = "groupBy506361367" + var request = &securitycenterpb.GroupAssetsRequest{ + Parent: formattedParent, + GroupBy: groupBy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GroupAssets(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.GroupByResults[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterGroupAssetsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var groupBy string = "groupBy506361367" + var request = &securitycenterpb.GroupAssetsRequest{ + Parent: formattedParent, + GroupBy: groupBy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GroupAssets(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterGroupFindings(t *testing.T) { + var nextPageToken string = "" + var groupByResultsElement *securitycenterpb.GroupResult = &securitycenterpb.GroupResult{} + var groupByResults = []*securitycenterpb.GroupResult{groupByResultsElement} + var expectedResponse = &securitycenterpb.GroupFindingsResponse{ + NextPageToken: nextPageToken, + GroupByResults: groupByResults, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var groupBy string = "groupBy506361367" + var request = &securitycenterpb.GroupFindingsRequest{ + Parent: formattedParent, + GroupBy: groupBy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GroupFindings(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.GroupByResults[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterGroupFindingsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var groupBy string = "groupBy506361367" + var request = &securitycenterpb.GroupFindingsRequest{ + Parent: formattedParent, + GroupBy: groupBy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GroupFindings(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterListAssets(t *testing.T) { + var nextPageToken string = "" + var totalSize int32 = 705419236 + var listAssetsResultsElement *securitycenterpb.ListAssetsResponse_ListAssetsResult = &securitycenterpb.ListAssetsResponse_ListAssetsResult{} + var listAssetsResults = []*securitycenterpb.ListAssetsResponse_ListAssetsResult{listAssetsResultsElement} + var expectedResponse = &securitycenterpb.ListAssetsResponse{ + NextPageToken: nextPageToken, + TotalSize: totalSize, + ListAssetsResults: listAssetsResults, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &securitycenterpb.ListAssetsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListAssets(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.ListAssetsResults[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterListAssetsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &securitycenterpb.ListAssetsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListAssets(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterListFindings(t *testing.T) { + var nextPageToken string = "" + var totalSize int32 = 705419236 + var findingsElement *securitycenterpb.Finding = &securitycenterpb.Finding{} + var findings = []*securitycenterpb.Finding{findingsElement} + var expectedResponse = &securitycenterpb.ListFindingsResponse{ + NextPageToken: nextPageToken, + TotalSize: totalSize, + Findings: findings, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var request = &securitycenterpb.ListFindingsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListFindings(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Findings[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterListFindingsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var request = &securitycenterpb.ListFindingsRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListFindings(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterListSources(t *testing.T) { + var nextPageToken string = "" + var sourcesElement *securitycenterpb.Source = &securitycenterpb.Source{} + var sources = []*securitycenterpb.Source{sourcesElement} + var expectedResponse = &securitycenterpb.ListSourcesResponse{ + NextPageToken: nextPageToken, + Sources: sources, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &securitycenterpb.ListSourcesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSources(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Sources[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterListSourcesError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &securitycenterpb.ListSourcesRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSources(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterRunAssetDiscovery(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &securitycenterpb.RunAssetDiscoveryRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.RunAssetDiscovery(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestSecurityCenterRunAssetDiscoveryError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = nil + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("organizations/%s", "[ORGANIZATION]") + var request = &securitycenterpb.RunAssetDiscoveryRequest{ + Parent: formattedParent, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.RunAssetDiscovery(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSecurityCenterSetFindingState(t *testing.T) { + var name2 string = "name2-1052831874" + var parent string = "parent-995424086" + var resourceName string = "resourceName979421212" + var category string = "category50511102" + var externalUri string = "externalUri-1385596168" + var expectedResponse = &securitycenterpb.Finding{ + Name: name2, + Parent: parent, + ResourceName: resourceName, + Category: category, + ExternalUri: externalUri, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("organizations/%s/sources/%s/findings/%s", "[ORGANIZATION]", "[SOURCE]", "[FINDING]") + var state securitycenterpb.Finding_State = securitycenterpb.Finding_STATE_UNSPECIFIED + var startTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &securitycenterpb.SetFindingStateRequest{ + Name: formattedName, + State: state, + StartTime: startTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetFindingState(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterSetFindingStateError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("organizations/%s/sources/%s/findings/%s", "[ORGANIZATION]", "[SOURCE]", "[FINDING]") + var state securitycenterpb.Finding_State = securitycenterpb.Finding_STATE_UNSPECIFIED + var startTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &securitycenterpb.SetFindingStateRequest{ + Name: formattedName, + State: state, + StartTime: startTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetFindingState(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterSetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterSetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterTestIamPermissions(t *testing.T) { + var expectedResponse *iampb.TestIamPermissionsResponse = &iampb.TestIamPermissionsResponse{} + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterTestIamPermissionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("organizations/%s/sources/%s", "[ORGANIZATION]", "[SOURCE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterUpdateFinding(t *testing.T) { + var name string = "name3373707" + var parent string = "parent-995424086" + var resourceName string = "resourceName979421212" + var category string = "category50511102" + var externalUri string = "externalUri-1385596168" + var expectedResponse = &securitycenterpb.Finding{ + Name: name, + Parent: parent, + ResourceName: resourceName, + Category: category, + ExternalUri: externalUri, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var finding *securitycenterpb.Finding = &securitycenterpb.Finding{} + var request = &securitycenterpb.UpdateFindingRequest{ + Finding: finding, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateFinding(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterUpdateFindingError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var finding *securitycenterpb.Finding = &securitycenterpb.Finding{} + var request = &securitycenterpb.UpdateFindingRequest{ + Finding: finding, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateFinding(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterUpdateOrganizationSettings(t *testing.T) { + var name string = "name3373707" + var enableAssetDiscovery bool = false + var expectedResponse = &securitycenterpb.OrganizationSettings{ + Name: name, + EnableAssetDiscovery: enableAssetDiscovery, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var organizationSettings *securitycenterpb.OrganizationSettings = &securitycenterpb.OrganizationSettings{} + var request = &securitycenterpb.UpdateOrganizationSettingsRequest{ + OrganizationSettings: organizationSettings, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateOrganizationSettings(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterUpdateOrganizationSettingsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var organizationSettings *securitycenterpb.OrganizationSettings = &securitycenterpb.OrganizationSettings{} + var request = &securitycenterpb.UpdateOrganizationSettingsRequest{ + OrganizationSettings: organizationSettings, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateOrganizationSettings(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterUpdateSource(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var expectedResponse = &securitycenterpb.Source{ + Name: name, + DisplayName: displayName, + Description: description, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var source *securitycenterpb.Source = &securitycenterpb.Source{} + var request = &securitycenterpb.UpdateSourceRequest{ + Source: source, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSource(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterUpdateSourceError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var source *securitycenterpb.Source = &securitycenterpb.Source{} + var request = &securitycenterpb.UpdateSourceRequest{ + Source: source, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSource(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSecurityCenterUpdateSecurityMarks(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &securitycenterpb.SecurityMarks{ + Name: name, + } + + mockSecurityCenter.err = nil + mockSecurityCenter.reqs = nil + + mockSecurityCenter.resps = append(mockSecurityCenter.resps[:0], expectedResponse) + + var securityMarks *securitycenterpb.SecurityMarks = &securitycenterpb.SecurityMarks{} + var request = &securitycenterpb.UpdateSecurityMarksRequest{ + SecurityMarks: securityMarks, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSecurityMarks(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSecurityCenter.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSecurityCenterUpdateSecurityMarksError(t *testing.T) { + errCode := codes.PermissionDenied + mockSecurityCenter.err = gstatus.Error(errCode, "test error") + + var securityMarks *securitycenterpb.SecurityMarks = &securitycenterpb.SecurityMarks{} + var request = &securitycenterpb.UpdateSecurityMarksRequest{ + SecurityMarks: securityMarks, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateSecurityMarks(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/securitycenter/apiv1beta1/security_center_client.go b/vendor/cloud.google.com/go/securitycenter/apiv1beta1/security_center_client.go new file mode 100644 index 000000000..4318fe8ef --- /dev/null +++ b/vendor/cloud.google.com/go/securitycenter/apiv1beta1/security_center_client.go @@ -0,0 +1,792 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package securitycenter + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1" + iampb "google.golang.org/genproto/googleapis/iam/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + CreateSource []gax.CallOption + CreateFinding []gax.CallOption + GetIamPolicy []gax.CallOption + GetOrganizationSettings []gax.CallOption + GetSource []gax.CallOption + GroupAssets []gax.CallOption + GroupFindings []gax.CallOption + ListAssets []gax.CallOption + ListFindings []gax.CallOption + ListSources []gax.CallOption + RunAssetDiscovery []gax.CallOption + SetFindingState []gax.CallOption + SetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption + UpdateFinding []gax.CallOption + UpdateOrganizationSettings []gax.CallOption + UpdateSource []gax.CallOption + UpdateSecurityMarks []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("securitycenter.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + CreateSource: retry[[2]string{"default", "non_idempotent"}], + CreateFinding: retry[[2]string{"default", "non_idempotent"}], + GetIamPolicy: retry[[2]string{"default", "idempotent"}], + GetOrganizationSettings: retry[[2]string{"default", "idempotent"}], + GetSource: retry[[2]string{"default", "idempotent"}], + GroupAssets: retry[[2]string{"default", "idempotent"}], + GroupFindings: retry[[2]string{"default", "idempotent"}], + ListAssets: retry[[2]string{"default", "idempotent"}], + ListFindings: retry[[2]string{"default", "idempotent"}], + ListSources: retry[[2]string{"default", "idempotent"}], + RunAssetDiscovery: retry[[2]string{"default", "non_idempotent"}], + SetFindingState: retry[[2]string{"default", "non_idempotent"}], + SetIamPolicy: retry[[2]string{"default", "non_idempotent"}], + TestIamPermissions: retry[[2]string{"default", "idempotent"}], + UpdateFinding: retry[[2]string{"default", "non_idempotent"}], + UpdateOrganizationSettings: retry[[2]string{"default", "non_idempotent"}], + UpdateSource: retry[[2]string{"default", "non_idempotent"}], + UpdateSecurityMarks: retry[[2]string{"default", "non_idempotent"}], + } +} + +// Client is a client for interacting with Cloud Security Command Center API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client securitycenterpb.SecurityCenterClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new security center client. +// +// V1 Beta APIs for Security Center service. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: securitycenterpb.NewSecurityCenterClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// CreateSource creates a source. +func (c *Client) CreateSource(ctx context.Context, req *securitycenterpb.CreateSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateSource[0:len(c.CallOptions.CreateSource):len(c.CallOptions.CreateSource)], opts...) + var resp *securitycenterpb.Source + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateSource(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateFinding creates a finding. The corresponding source must exist for finding creation +// to succeed. +func (c *Client) CreateFinding(ctx context.Context, req *securitycenterpb.CreateFindingRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateFinding[0:len(c.CallOptions.CreateFinding):len(c.CallOptions.CreateFinding)], opts...) + var resp *securitycenterpb.Finding + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateFinding(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetIamPolicy gets the access control policy on the specified Source. +func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetIamPolicy[0:len(c.CallOptions.GetIamPolicy):len(c.CallOptions.GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetOrganizationSettings gets the settings for an organization. +func (c *Client) GetOrganizationSettings(ctx context.Context, req *securitycenterpb.GetOrganizationSettingsRequest, opts ...gax.CallOption) (*securitycenterpb.OrganizationSettings, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetOrganizationSettings[0:len(c.CallOptions.GetOrganizationSettings):len(c.CallOptions.GetOrganizationSettings)], opts...) + var resp *securitycenterpb.OrganizationSettings + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetOrganizationSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetSource gets a source. +func (c *Client) GetSource(ctx context.Context, req *securitycenterpb.GetSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetSource[0:len(c.CallOptions.GetSource):len(c.CallOptions.GetSource)], opts...) + var resp *securitycenterpb.Source + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetSource(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GroupAssets filters an organization's assets and groups them by their specified +// properties. +func (c *Client) GroupAssets(ctx context.Context, req *securitycenterpb.GroupAssetsRequest, opts ...gax.CallOption) *GroupResultIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GroupAssets[0:len(c.CallOptions.GroupAssets):len(c.CallOptions.GroupAssets)], opts...) + it := &GroupResultIterator{} + req = proto.Clone(req).(*securitycenterpb.GroupAssetsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.GroupResult, string, error) { + var resp *securitycenterpb.GroupAssetsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GroupAssets(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.GroupByResults, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GroupFindings filters an organization or source's findings and groups them by their +// specified properties. +// +// To group across all sources provide a - as the source id. +// Example: /v1beta1/organizations/123/sources/-/findings +func (c *Client) GroupFindings(ctx context.Context, req *securitycenterpb.GroupFindingsRequest, opts ...gax.CallOption) *GroupResultIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GroupFindings[0:len(c.CallOptions.GroupFindings):len(c.CallOptions.GroupFindings)], opts...) + it := &GroupResultIterator{} + req = proto.Clone(req).(*securitycenterpb.GroupFindingsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.GroupResult, string, error) { + var resp *securitycenterpb.GroupFindingsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GroupFindings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.GroupByResults, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListAssets lists an organization's assets. +func (c *Client) ListAssets(ctx context.Context, req *securitycenterpb.ListAssetsRequest, opts ...gax.CallOption) *ListAssetsResponse_ListAssetsResultIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListAssets[0:len(c.CallOptions.ListAssets):len(c.CallOptions.ListAssets)], opts...) + it := &ListAssetsResponse_ListAssetsResultIterator{} + req = proto.Clone(req).(*securitycenterpb.ListAssetsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.ListAssetsResponse_ListAssetsResult, string, error) { + var resp *securitycenterpb.ListAssetsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListAssets(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.ListAssetsResults, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListFindings lists an organization or source's findings. +// +// To list across all sources provide a - as the source id. +// Example: /v1beta1/organizations/123/sources/-/findings +func (c *Client) ListFindings(ctx context.Context, req *securitycenterpb.ListFindingsRequest, opts ...gax.CallOption) *FindingIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListFindings[0:len(c.CallOptions.ListFindings):len(c.CallOptions.ListFindings)], opts...) + it := &FindingIterator{} + req = proto.Clone(req).(*securitycenterpb.ListFindingsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.Finding, string, error) { + var resp *securitycenterpb.ListFindingsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListFindings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Findings, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ListSources lists all sources belonging to an organization. +func (c *Client) ListSources(ctx context.Context, req *securitycenterpb.ListSourcesRequest, opts ...gax.CallOption) *SourceIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListSources[0:len(c.CallOptions.ListSources):len(c.CallOptions.ListSources)], opts...) + it := &SourceIterator{} + req = proto.Clone(req).(*securitycenterpb.ListSourcesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.Source, string, error) { + var resp *securitycenterpb.ListSourcesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListSources(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Sources, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// RunAssetDiscovery runs asset discovery. The discovery is tracked with a long-running +// operation. +// +// This API can only be called with limited frequency for an organization. If +// it is called too frequently the caller will receive a TOO_MANY_REQUESTS +// error. +func (c *Client) RunAssetDiscovery(ctx context.Context, req *securitycenterpb.RunAssetDiscoveryRequest, opts ...gax.CallOption) (*RunAssetDiscoveryOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.RunAssetDiscovery[0:len(c.CallOptions.RunAssetDiscovery):len(c.CallOptions.RunAssetDiscovery)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.RunAssetDiscovery(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &RunAssetDiscoveryOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// SetFindingState updates the state of a finding. +func (c *Client) SetFindingState(ctx context.Context, req *securitycenterpb.SetFindingStateRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetFindingState[0:len(c.CallOptions.SetFindingState):len(c.CallOptions.SetFindingState)], opts...) + var resp *securitycenterpb.Finding + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.SetFindingState(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetIamPolicy sets the access control policy on the specified Source. +func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetIamPolicy[0:len(c.CallOptions.SetIamPolicy):len(c.CallOptions.SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// TestIamPermissions returns the permissions that a caller has on the specified source. +func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.TestIamPermissions[0:len(c.CallOptions.TestIamPermissions):len(c.CallOptions.TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateFinding creates or updates a finding. The corresponding source must exist for a +// finding creation to succeed. +func (c *Client) UpdateFinding(ctx context.Context, req *securitycenterpb.UpdateFindingRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateFinding[0:len(c.CallOptions.UpdateFinding):len(c.CallOptions.UpdateFinding)], opts...) + var resp *securitycenterpb.Finding + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateFinding(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateOrganizationSettings updates an organization's settings. +func (c *Client) UpdateOrganizationSettings(ctx context.Context, req *securitycenterpb.UpdateOrganizationSettingsRequest, opts ...gax.CallOption) (*securitycenterpb.OrganizationSettings, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateOrganizationSettings[0:len(c.CallOptions.UpdateOrganizationSettings):len(c.CallOptions.UpdateOrganizationSettings)], opts...) + var resp *securitycenterpb.OrganizationSettings + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateOrganizationSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateSource updates a source. +func (c *Client) UpdateSource(ctx context.Context, req *securitycenterpb.UpdateSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateSource[0:len(c.CallOptions.UpdateSource):len(c.CallOptions.UpdateSource)], opts...) + var resp *securitycenterpb.Source + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateSource(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateSecurityMarks updates security marks. +func (c *Client) UpdateSecurityMarks(ctx context.Context, req *securitycenterpb.UpdateSecurityMarksRequest, opts ...gax.CallOption) (*securitycenterpb.SecurityMarks, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateSecurityMarks[0:len(c.CallOptions.UpdateSecurityMarks):len(c.CallOptions.UpdateSecurityMarks)], opts...) + var resp *securitycenterpb.SecurityMarks + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateSecurityMarks(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// FindingIterator manages a stream of *securitycenterpb.Finding. +type FindingIterator struct { + items []*securitycenterpb.Finding + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*securitycenterpb.Finding, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *FindingIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *FindingIterator) Next() (*securitycenterpb.Finding, error) { + var item *securitycenterpb.Finding + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *FindingIterator) bufLen() int { + return len(it.items) +} + +func (it *FindingIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// GroupResultIterator manages a stream of *securitycenterpb.GroupResult. +type GroupResultIterator struct { + items []*securitycenterpb.GroupResult + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*securitycenterpb.GroupResult, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *GroupResultIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *GroupResultIterator) Next() (*securitycenterpb.GroupResult, error) { + var item *securitycenterpb.GroupResult + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *GroupResultIterator) bufLen() int { + return len(it.items) +} + +func (it *GroupResultIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ListAssetsResponse_ListAssetsResultIterator manages a stream of *securitycenterpb.ListAssetsResponse_ListAssetsResult. +type ListAssetsResponse_ListAssetsResultIterator struct { + items []*securitycenterpb.ListAssetsResponse_ListAssetsResult + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*securitycenterpb.ListAssetsResponse_ListAssetsResult, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ListAssetsResponse_ListAssetsResultIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ListAssetsResponse_ListAssetsResultIterator) Next() (*securitycenterpb.ListAssetsResponse_ListAssetsResult, error) { + var item *securitycenterpb.ListAssetsResponse_ListAssetsResult + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ListAssetsResponse_ListAssetsResultIterator) bufLen() int { + return len(it.items) +} + +func (it *ListAssetsResponse_ListAssetsResultIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// SourceIterator manages a stream of *securitycenterpb.Source. +type SourceIterator struct { + items []*securitycenterpb.Source + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*securitycenterpb.Source, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *SourceIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *SourceIterator) Next() (*securitycenterpb.Source, error) { + var item *securitycenterpb.Source + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *SourceIterator) bufLen() int { + return len(it.items) +} + +func (it *SourceIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// RunAssetDiscoveryOperation manages a long-running operation from RunAssetDiscovery. +type RunAssetDiscoveryOperation struct { + lro *longrunning.Operation +} + +// RunAssetDiscoveryOperation returns a new RunAssetDiscoveryOperation from a given name. +// The name must be that of a previously created RunAssetDiscoveryOperation, possibly from a different process. +func (c *Client) RunAssetDiscoveryOperation(name string) *RunAssetDiscoveryOperation { + return &RunAssetDiscoveryOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *RunAssetDiscoveryOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 5000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *RunAssetDiscoveryOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Done reports whether the long-running operation has completed. +func (op *RunAssetDiscoveryOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *RunAssetDiscoveryOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/securitycenter/apiv1beta1/security_center_client_example_test.go b/vendor/cloud.google.com/go/securitycenter/apiv1beta1/security_center_client_example_test.go new file mode 100644 index 000000000..33209b644 --- /dev/null +++ b/vendor/cloud.google.com/go/securitycenter/apiv1beta1/security_center_client_example_test.go @@ -0,0 +1,391 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package securitycenter_test + +import ( + "context" + + securitycenter "cloud.google.com/go/securitycenter/apiv1beta1" + "google.golang.org/api/iterator" + securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_CreateSource() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.CreateSourceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateSource(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_CreateFinding() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.CreateFindingRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateFinding(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetIamPolicy() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetOrganizationSettings() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.GetOrganizationSettingsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetOrganizationSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetSource() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.GetSourceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSource(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GroupAssets() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.GroupAssetsRequest{ + // TODO: Fill request struct fields. + } + it := c.GroupAssets(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GroupFindings() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.GroupFindingsRequest{ + // TODO: Fill request struct fields. + } + it := c.GroupFindings(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_ListAssets() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.ListAssetsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListAssets(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_ListFindings() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.ListFindingsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListFindings(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_ListSources() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.ListSourcesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListSources(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_RunAssetDiscovery() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.RunAssetDiscoveryRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RunAssetDiscovery(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleClient_SetFindingState() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.SetFindingStateRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetFindingState(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_SetIamPolicy() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_TestIamPermissions() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateFinding() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.UpdateFindingRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateFinding(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateOrganizationSettings() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.UpdateOrganizationSettingsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateOrganizationSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateSource() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.UpdateSourceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateSource(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateSecurityMarks() { + ctx := context.Background() + c, err := securitycenter.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &securitycenterpb.UpdateSecurityMarksRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateSecurityMarks(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/spanner/admin/database/apiv1/database_admin_client.go b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/database_admin_client.go new file mode 100644 index 000000000..a75dfebdf --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/database_admin_client.go @@ -0,0 +1,520 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package database + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + iampb "google.golang.org/genproto/googleapis/iam/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + databasepb "google.golang.org/genproto/googleapis/spanner/admin/database/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// DatabaseAdminCallOptions contains the retry settings for each method of DatabaseAdminClient. +type DatabaseAdminCallOptions struct { + ListDatabases []gax.CallOption + CreateDatabase []gax.CallOption + GetDatabase []gax.CallOption + UpdateDatabaseDdl []gax.CallOption + DropDatabase []gax.CallOption + GetDatabaseDdl []gax.CallOption + SetIamPolicy []gax.CallOption + GetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +func defaultDatabaseAdminClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("spanner.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultDatabaseAdminCallOptions() *DatabaseAdminCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 32000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &DatabaseAdminCallOptions{ + ListDatabases: retry[[2]string{"default", "idempotent"}], + CreateDatabase: retry[[2]string{"default", "non_idempotent"}], + GetDatabase: retry[[2]string{"default", "idempotent"}], + UpdateDatabaseDdl: retry[[2]string{"default", "idempotent"}], + DropDatabase: retry[[2]string{"default", "idempotent"}], + GetDatabaseDdl: retry[[2]string{"default", "idempotent"}], + SetIamPolicy: retry[[2]string{"default", "non_idempotent"}], + GetIamPolicy: retry[[2]string{"default", "idempotent"}], + TestIamPermissions: retry[[2]string{"default", "non_idempotent"}], + } +} + +// DatabaseAdminClient is a client for interacting with Cloud Spanner Database Admin API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type DatabaseAdminClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + databaseAdminClient databasepb.DatabaseAdminClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *DatabaseAdminCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewDatabaseAdminClient creates a new database admin client. +// +// Cloud Spanner Database Admin API +// +// The Cloud Spanner Database Admin API can be used to create, drop, and +// list databases. It also enables updating the schema of pre-existing +// databases. +func NewDatabaseAdminClient(ctx context.Context, opts ...option.ClientOption) (*DatabaseAdminClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultDatabaseAdminClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &DatabaseAdminClient{ + conn: conn, + CallOptions: defaultDatabaseAdminCallOptions(), + + databaseAdminClient: databasepb.NewDatabaseAdminClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *DatabaseAdminClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *DatabaseAdminClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *DatabaseAdminClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListDatabases lists Cloud Spanner databases. +func (c *DatabaseAdminClient) ListDatabases(ctx context.Context, req *databasepb.ListDatabasesRequest, opts ...gax.CallOption) *DatabaseIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListDatabases[0:len(c.CallOptions.ListDatabases):len(c.CallOptions.ListDatabases)], opts...) + it := &DatabaseIterator{} + req = proto.Clone(req).(*databasepb.ListDatabasesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*databasepb.Database, string, error) { + var resp *databasepb.ListDatabasesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.databaseAdminClient.ListDatabases(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Databases, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// CreateDatabase creates a new Cloud Spanner database and starts to prepare it for serving. +// The returned [long-running operation][google.longrunning.Operation] will +// have a name of the format /operations/ and +// can be used to track preparation of the database. The +// [metadata][google.longrunning.Operation.metadata] field type is +// [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The +// [response][google.longrunning.Operation.response] field type is +// [Database][google.spanner.admin.database.v1.Database], if successful. +func (c *DatabaseAdminClient) CreateDatabase(ctx context.Context, req *databasepb.CreateDatabaseRequest, opts ...gax.CallOption) (*CreateDatabaseOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateDatabase[0:len(c.CallOptions.CreateDatabase):len(c.CallOptions.CreateDatabase)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.databaseAdminClient.CreateDatabase(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateDatabaseOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// GetDatabase gets the state of a Cloud Spanner database. +func (c *DatabaseAdminClient) GetDatabase(ctx context.Context, req *databasepb.GetDatabaseRequest, opts ...gax.CallOption) (*databasepb.Database, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetDatabase[0:len(c.CallOptions.GetDatabase):len(c.CallOptions.GetDatabase)], opts...) + var resp *databasepb.Database + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.databaseAdminClient.GetDatabase(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateDatabaseDdl updates the schema of a Cloud Spanner database by +// creating/altering/dropping tables, columns, indexes, etc. The returned +// [long-running operation][google.longrunning.Operation] will have a name of +// the format /operations/ and can be used to +// track execution of the schema change(s). The +// [metadata][google.longrunning.Operation.metadata] field type is +// [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The operation has no response. +func (c *DatabaseAdminClient) UpdateDatabaseDdl(ctx context.Context, req *databasepb.UpdateDatabaseDdlRequest, opts ...gax.CallOption) (*UpdateDatabaseDdlOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateDatabaseDdl[0:len(c.CallOptions.UpdateDatabaseDdl):len(c.CallOptions.UpdateDatabaseDdl)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.databaseAdminClient.UpdateDatabaseDdl(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateDatabaseDdlOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DropDatabase drops (aka deletes) a Cloud Spanner database. +func (c *DatabaseAdminClient) DropDatabase(ctx context.Context, req *databasepb.DropDatabaseRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DropDatabase[0:len(c.CallOptions.DropDatabase):len(c.CallOptions.DropDatabase)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.databaseAdminClient.DropDatabase(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// GetDatabaseDdl returns the schema of a Cloud Spanner database as a list of formatted +// DDL statements. This method does not show pending schema updates, those may +// be queried using the [Operations][google.longrunning.Operations] API. +func (c *DatabaseAdminClient) GetDatabaseDdl(ctx context.Context, req *databasepb.GetDatabaseDdlRequest, opts ...gax.CallOption) (*databasepb.GetDatabaseDdlResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetDatabaseDdl[0:len(c.CallOptions.GetDatabaseDdl):len(c.CallOptions.GetDatabaseDdl)], opts...) + var resp *databasepb.GetDatabaseDdlResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.databaseAdminClient.GetDatabaseDdl(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SetIamPolicy sets the access control policy on a database resource. Replaces any +// existing policy. +// +// Authorization requires spanner.databases.setIamPolicy permission on +// [resource][google.iam.v1.SetIamPolicyRequest.resource]. +func (c *DatabaseAdminClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetIamPolicy[0:len(c.CallOptions.SetIamPolicy):len(c.CallOptions.SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.databaseAdminClient.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetIamPolicy gets the access control policy for a database resource. Returns an empty +// policy if a database exists but does not have a policy set. +// +// Authorization requires spanner.databases.getIamPolicy permission on +// [resource][google.iam.v1.GetIamPolicyRequest.resource]. +func (c *DatabaseAdminClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetIamPolicy[0:len(c.CallOptions.GetIamPolicy):len(c.CallOptions.GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.databaseAdminClient.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// TestIamPermissions returns permissions that the caller has on the specified database resource. +// +// Attempting this RPC on a non-existent Cloud Spanner database will result in +// a NOT_FOUND error if the user has spanner.databases.list permission on +// the containing Cloud Spanner instance. Otherwise returns an empty set of +// permissions. +func (c *DatabaseAdminClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.TestIamPermissions[0:len(c.CallOptions.TestIamPermissions):len(c.CallOptions.TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.databaseAdminClient.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DatabaseIterator manages a stream of *databasepb.Database. +type DatabaseIterator struct { + items []*databasepb.Database + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*databasepb.Database, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *DatabaseIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *DatabaseIterator) Next() (*databasepb.Database, error) { + var item *databasepb.Database + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *DatabaseIterator) bufLen() int { + return len(it.items) +} + +func (it *DatabaseIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// CreateDatabaseOperation manages a long-running operation from CreateDatabase. +type CreateDatabaseOperation struct { + lro *longrunning.Operation +} + +// CreateDatabaseOperation returns a new CreateDatabaseOperation from a given name. +// The name must be that of a previously created CreateDatabaseOperation, possibly from a different process. +func (c *DatabaseAdminClient) CreateDatabaseOperation(name string) *CreateDatabaseOperation { + return &CreateDatabaseOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*databasepb.Database, error) { + var resp databasepb.Database + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*databasepb.Database, error) { + var resp databasepb.Database + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateDatabaseOperation) Metadata() (*databasepb.CreateDatabaseMetadata, error) { + var meta databasepb.CreateDatabaseMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateDatabaseOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateDatabaseOperation) Name() string { + return op.lro.Name() +} + +// UpdateDatabaseDdlOperation manages a long-running operation from UpdateDatabaseDdl. +type UpdateDatabaseDdlOperation struct { + lro *longrunning.Operation +} + +// UpdateDatabaseDdlOperation returns a new UpdateDatabaseDdlOperation from a given name. +// The name must be that of a previously created UpdateDatabaseDdlOperation, possibly from a different process. +func (c *DatabaseAdminClient) UpdateDatabaseDdlOperation(name string) *UpdateDatabaseDdlOperation { + return &UpdateDatabaseDdlOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning any error encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateDatabaseDdlOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, 45000*time.Millisecond, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, op.Done will return true. +func (op *UpdateDatabaseDdlOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateDatabaseDdlOperation) Metadata() (*databasepb.UpdateDatabaseDdlMetadata, error) { + var meta databasepb.UpdateDatabaseDdlMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateDatabaseDdlOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateDatabaseDdlOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/spanner/admin/database/apiv1/database_admin_client_example_test.go b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/database_admin_client_example_test.go new file mode 100644 index 000000000..6fdb9d331 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/database_admin_client_example_test.go @@ -0,0 +1,208 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package database_test + +import ( + "context" + + database "cloud.google.com/go/spanner/admin/database/apiv1" + "google.golang.org/api/iterator" + iampb "google.golang.org/genproto/googleapis/iam/v1" + databasepb "google.golang.org/genproto/googleapis/spanner/admin/database/v1" +) + +func ExampleNewDatabaseAdminClient() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleDatabaseAdminClient_ListDatabases() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &databasepb.ListDatabasesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListDatabases(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleDatabaseAdminClient_CreateDatabase() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &databasepb.CreateDatabaseRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateDatabase(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDatabaseAdminClient_GetDatabase() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &databasepb.GetDatabaseRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDatabase(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDatabaseAdminClient_UpdateDatabaseDdl() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &databasepb.UpdateDatabaseDdlRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateDatabaseDdl(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + // TODO: Handle error. +} + +func ExampleDatabaseAdminClient_DropDatabase() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &databasepb.DropDatabaseRequest{ + // TODO: Fill request struct fields. + } + err = c.DropDatabase(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleDatabaseAdminClient_GetDatabaseDdl() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &databasepb.GetDatabaseDdlRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetDatabaseDdl(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDatabaseAdminClient_SetIamPolicy() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDatabaseAdminClient_GetIamPolicy() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleDatabaseAdminClient_TestIamPermissions() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/spanner/admin/database/apiv1/doc.go b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/doc.go new file mode 100644 index 000000000..55fbf1e07 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package database is an auto-generated package for the +// Cloud Spanner Database Admin API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +package database // import "cloud.google.com/go/spanner/admin/database/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/spanner.admin", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/spanner/admin/database/apiv1/mock_test.go b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/mock_test.go new file mode 100644 index 000000000..63ba16ba1 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/mock_test.go @@ -0,0 +1,798 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package database + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + iampb "google.golang.org/genproto/googleapis/iam/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + databasepb "google.golang.org/genproto/googleapis/spanner/admin/database/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockDatabaseAdminServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + databasepb.DatabaseAdminServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockDatabaseAdminServer) ListDatabases(ctx context.Context, req *databasepb.ListDatabasesRequest) (*databasepb.ListDatabasesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*databasepb.ListDatabasesResponse), nil +} + +func (s *mockDatabaseAdminServer) CreateDatabase(ctx context.Context, req *databasepb.CreateDatabaseRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockDatabaseAdminServer) GetDatabase(ctx context.Context, req *databasepb.GetDatabaseRequest) (*databasepb.Database, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*databasepb.Database), nil +} + +func (s *mockDatabaseAdminServer) UpdateDatabaseDdl(ctx context.Context, req *databasepb.UpdateDatabaseDdlRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockDatabaseAdminServer) DropDatabase(ctx context.Context, req *databasepb.DropDatabaseRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockDatabaseAdminServer) GetDatabaseDdl(ctx context.Context, req *databasepb.GetDatabaseDdlRequest) (*databasepb.GetDatabaseDdlResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*databasepb.GetDatabaseDdlResponse), nil +} + +func (s *mockDatabaseAdminServer) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockDatabaseAdminServer) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockDatabaseAdminServer) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.TestIamPermissionsResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockDatabaseAdmin mockDatabaseAdminServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + databasepb.RegisterDatabaseAdminServer(serv, &mockDatabaseAdmin) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestDatabaseAdminListDatabases(t *testing.T) { + var nextPageToken string = "" + var databasesElement *databasepb.Database = &databasepb.Database{} + var databases = []*databasepb.Database{databasesElement} + var expectedResponse = &databasepb.ListDatabasesResponse{ + NextPageToken: nextPageToken, + Databases: databases, + } + + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.reqs = nil + + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var request = &databasepb.ListDatabasesRequest{ + Parent: formattedParent, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDatabases(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDatabaseAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Databases[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDatabaseAdminListDatabasesError(t *testing.T) { + errCode := codes.PermissionDenied + mockDatabaseAdmin.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var request = &databasepb.ListDatabasesRequest{ + Parent: formattedParent, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListDatabases(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDatabaseAdminCreateDatabase(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &databasepb.Database{ + Name: name, + } + + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var createStatement string = "createStatement552974828" + var request = &databasepb.CreateDatabaseRequest{ + Parent: formattedParent, + CreateStatement: createStatement, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateDatabase(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDatabaseAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDatabaseAdminCreateDatabaseError(t *testing.T) { + errCode := codes.PermissionDenied + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var createStatement string = "createStatement552974828" + var request = &databasepb.CreateDatabaseRequest{ + Parent: formattedParent, + CreateStatement: createStatement, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateDatabase(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDatabaseAdminGetDatabase(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &databasepb.Database{ + Name: name2, + } + + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.reqs = nil + + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &databasepb.GetDatabaseRequest{ + Name: formattedName, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDatabase(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDatabaseAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDatabaseAdminGetDatabaseError(t *testing.T) { + errCode := codes.PermissionDenied + mockDatabaseAdmin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &databasepb.GetDatabaseRequest{ + Name: formattedName, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDatabase(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDatabaseAdminUpdateDatabaseDdl(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var statements []string = nil + var request = &databasepb.UpdateDatabaseDdlRequest{ + Database: formattedDatabase, + Statements: statements, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateDatabaseDdl(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDatabaseAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDatabaseAdminUpdateDatabaseDdlError(t *testing.T) { + errCode := codes.PermissionDenied + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var statements []string = nil + var request = &databasepb.UpdateDatabaseDdlRequest{ + Database: formattedDatabase, + Statements: statements, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateDatabaseDdl(context.Background(), request) + if err != nil { + t.Fatal(err) + } + err = respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDatabaseAdminDropDatabase(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.reqs = nil + + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &databasepb.DropDatabaseRequest{ + Database: formattedDatabase, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DropDatabase(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDatabaseAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestDatabaseAdminDropDatabaseError(t *testing.T) { + errCode := codes.PermissionDenied + mockDatabaseAdmin.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &databasepb.DropDatabaseRequest{ + Database: formattedDatabase, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DropDatabase(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestDatabaseAdminGetDatabaseDdl(t *testing.T) { + var expectedResponse *databasepb.GetDatabaseDdlResponse = &databasepb.GetDatabaseDdlResponse{} + + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.reqs = nil + + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &databasepb.GetDatabaseDdlRequest{ + Database: formattedDatabase, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDatabaseDdl(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDatabaseAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDatabaseAdminGetDatabaseDdlError(t *testing.T) { + errCode := codes.PermissionDenied + mockDatabaseAdmin.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &databasepb.GetDatabaseDdlRequest{ + Database: formattedDatabase, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetDatabaseDdl(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDatabaseAdminSetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.reqs = nil + + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDatabaseAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDatabaseAdminSetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockDatabaseAdmin.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDatabaseAdminGetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.reqs = nil + + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDatabaseAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDatabaseAdminGetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockDatabaseAdmin.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestDatabaseAdminTestIamPermissions(t *testing.T) { + var expectedResponse *iampb.TestIamPermissionsResponse = &iampb.TestIamPermissionsResponse{} + + mockDatabaseAdmin.err = nil + mockDatabaseAdmin.reqs = nil + + mockDatabaseAdmin.resps = append(mockDatabaseAdmin.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockDatabaseAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestDatabaseAdminTestIamPermissionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockDatabaseAdmin.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewDatabaseAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/spanner/admin/database/apiv1/path_funcs.go b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/path_funcs.go new file mode 100644 index 000000000..5490f57c4 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/database/apiv1/path_funcs.go @@ -0,0 +1,45 @@ +// 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 +// +// https://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 database + +// DatabaseAdminInstancePath returns the path for the instance resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/instances/%s", project, instance) +// instead. +func DatabaseAdminInstancePath(project, instance string) string { + return "" + + "projects/" + + project + + "/instances/" + + instance + + "" +} + +// DatabaseAdminDatabasePath returns the path for the database resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/instances/%s/databases/%s", project, instance, database) +// instead. +func DatabaseAdminDatabasePath(project, instance, database string) string { + return "" + + "projects/" + + project + + "/instances/" + + instance + + "/databases/" + + database + + "" +} diff --git a/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/doc.go b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/doc.go new file mode 100644 index 000000000..49cda55b0 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package instance is an auto-generated package for the +// Cloud Spanner Instance Admin API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +package instance // import "cloud.google.com/go/spanner/admin/instance/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/spanner.admin", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/instance_admin_client.go b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/instance_admin_client.go new file mode 100644 index 000000000..1a7df8fce --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/instance_admin_client.go @@ -0,0 +1,706 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package instance + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + iampb "google.golang.org/genproto/googleapis/iam/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + instancepb "google.golang.org/genproto/googleapis/spanner/admin/instance/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// InstanceAdminCallOptions contains the retry settings for each method of InstanceAdminClient. +type InstanceAdminCallOptions struct { + ListInstanceConfigs []gax.CallOption + GetInstanceConfig []gax.CallOption + ListInstances []gax.CallOption + GetInstance []gax.CallOption + CreateInstance []gax.CallOption + UpdateInstance []gax.CallOption + DeleteInstance []gax.CallOption + SetIamPolicy []gax.CallOption + GetIamPolicy []gax.CallOption + TestIamPermissions []gax.CallOption +} + +func defaultInstanceAdminClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("spanner.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultInstanceAdminCallOptions() *InstanceAdminCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 32000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &InstanceAdminCallOptions{ + ListInstanceConfigs: retry[[2]string{"default", "idempotent"}], + GetInstanceConfig: retry[[2]string{"default", "idempotent"}], + ListInstances: retry[[2]string{"default", "idempotent"}], + GetInstance: retry[[2]string{"default", "idempotent"}], + CreateInstance: retry[[2]string{"default", "non_idempotent"}], + UpdateInstance: retry[[2]string{"default", "non_idempotent"}], + DeleteInstance: retry[[2]string{"default", "idempotent"}], + SetIamPolicy: retry[[2]string{"default", "non_idempotent"}], + GetIamPolicy: retry[[2]string{"default", "idempotent"}], + TestIamPermissions: retry[[2]string{"default", "non_idempotent"}], + } +} + +// InstanceAdminClient is a client for interacting with Cloud Spanner Instance Admin API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type InstanceAdminClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + instanceAdminClient instancepb.InstanceAdminClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *InstanceAdminCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewInstanceAdminClient creates a new instance admin client. +// +// Cloud Spanner Instance Admin API +// +// The Cloud Spanner Instance Admin API can be used to create, delete, +// modify and list instances. Instances are dedicated Cloud Spanner serving +// and storage resources to be used by Cloud Spanner databases. +// +// Each instance has a "configuration", which dictates where the +// serving resources for the Cloud Spanner instance are located (e.g., +// US-central, Europe). Configurations are created by Google based on +// resource availability. +// +// Cloud Spanner billing is based on the instances that exist and their +// sizes. After an instance exists, there are no additional +// per-database or per-operation charges for use of the instance +// (though there may be additional network bandwidth charges). +// Instances offer isolation: problems with databases in one instance +// will not affect other instances. However, within an instance +// databases can affect each other. For example, if one database in an +// instance receives a lot of requests and consumes most of the +// instance resources, fewer resources are available for other +// databases in that instance, and their performance may suffer. +func NewInstanceAdminClient(ctx context.Context, opts ...option.ClientOption) (*InstanceAdminClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultInstanceAdminClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &InstanceAdminClient{ + conn: conn, + CallOptions: defaultInstanceAdminCallOptions(), + + instanceAdminClient: instancepb.NewInstanceAdminClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *InstanceAdminClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *InstanceAdminClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *InstanceAdminClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListInstanceConfigs lists the supported instance configurations for a given project. +func (c *InstanceAdminClient) ListInstanceConfigs(ctx context.Context, req *instancepb.ListInstanceConfigsRequest, opts ...gax.CallOption) *InstanceConfigIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListInstanceConfigs[0:len(c.CallOptions.ListInstanceConfigs):len(c.CallOptions.ListInstanceConfigs)], opts...) + it := &InstanceConfigIterator{} + req = proto.Clone(req).(*instancepb.ListInstanceConfigsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*instancepb.InstanceConfig, string, error) { + var resp *instancepb.ListInstanceConfigsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.instanceAdminClient.ListInstanceConfigs(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.InstanceConfigs, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetInstanceConfig gets information about a particular instance configuration. +func (c *InstanceAdminClient) GetInstanceConfig(ctx context.Context, req *instancepb.GetInstanceConfigRequest, opts ...gax.CallOption) (*instancepb.InstanceConfig, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetInstanceConfig[0:len(c.CallOptions.GetInstanceConfig):len(c.CallOptions.GetInstanceConfig)], opts...) + var resp *instancepb.InstanceConfig + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.instanceAdminClient.GetInstanceConfig(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListInstances lists all instances in the given project. +func (c *InstanceAdminClient) ListInstances(ctx context.Context, req *instancepb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListInstances[0:len(c.CallOptions.ListInstances):len(c.CallOptions.ListInstances)], opts...) + it := &InstanceIterator{} + req = proto.Clone(req).(*instancepb.ListInstancesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*instancepb.Instance, string, error) { + var resp *instancepb.ListInstancesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.instanceAdminClient.ListInstances(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Instances, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetInstance gets information about a particular instance. +func (c *InstanceAdminClient) GetInstance(ctx context.Context, req *instancepb.GetInstanceRequest, opts ...gax.CallOption) (*instancepb.Instance, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetInstance[0:len(c.CallOptions.GetInstance):len(c.CallOptions.GetInstance)], opts...) + var resp *instancepb.Instance + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.instanceAdminClient.GetInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateInstance creates an instance and begins preparing it to begin serving. The +// returned [long-running operation][google.longrunning.Operation] +// can be used to track the progress of preparing the new +// instance. The instance name is assigned by the caller. If the +// named instance already exists, CreateInstance returns +// ALREADY_EXISTS. +// +// Immediately upon completion of this request: +// +// The instance is readable via the API, with all requested attributes +// but no allocated resources. Its state is CREATING. +// +// Until completion of the returned operation: +// +// Cancelling the operation renders the instance immediately unreadable +// via the API. +// +// The instance can be deleted. +// +// All other attempts to modify the instance are rejected. +// +// Upon completion of the returned operation: +// +// Billing for all successfully-allocated resources begins (some types +// may have lower than the requested levels). +// +// Databases can be created in the instance. +// +// The instance's allocated resource levels are readable via the API. +// +// The instance's state becomes READY. +// +// The returned [long-running operation][google.longrunning.Operation] will +// have a name of the format /operations/ and +// can be used to track creation of the instance. The +// [metadata][google.longrunning.Operation.metadata] field type is +// [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. +// The [response][google.longrunning.Operation.response] field type is +// [Instance][google.spanner.admin.instance.v1.Instance], if successful. +func (c *InstanceAdminClient) CreateInstance(ctx context.Context, req *instancepb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateInstance[0:len(c.CallOptions.CreateInstance):len(c.CallOptions.CreateInstance)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.instanceAdminClient.CreateInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CreateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// UpdateInstance updates an instance, and begins allocating or releasing resources +// as requested. The returned [long-running +// operation][google.longrunning.Operation] can be used to track the +// progress of updating the instance. If the named instance does not +// exist, returns NOT_FOUND. +// +// Immediately upon completion of this request: +// +// For resource types for which a decrease in the instance's allocation +// has been requested, billing is based on the newly-requested level. +// +// Until completion of the returned operation: +// +// Cancelling the operation sets its metadata's +// [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], and begins +// restoring resources to their pre-request values. The operation +// is guaranteed to succeed at undoing all resource changes, +// after which point it terminates with a CANCELLED status. +// +// All other attempts to modify the instance are rejected. +// +// Reading the instance via the API continues to give the pre-request +// resource levels. +// +// Upon completion of the returned operation: +// +// Billing begins for all successfully-allocated resources (some types +// may have lower than the requested levels). +// +// All newly-reserved resources are available for serving the instance's +// tables. +// +// The instance's new resource levels are readable via the API. +// +// The returned [long-running operation][google.longrunning.Operation] will +// have a name of the format /operations/ and +// can be used to track the instance modification. The +// [metadata][google.longrunning.Operation.metadata] field type is +// [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. +// The [response][google.longrunning.Operation.response] field type is +// [Instance][google.spanner.admin.instance.v1.Instance], if successful. +// +// Authorization requires spanner.instances.update permission on +// resource [name][google.spanner.admin.instance.v1.Instance.name]. +func (c *InstanceAdminClient) UpdateInstance(ctx context.Context, req *instancepb.UpdateInstanceRequest, opts ...gax.CallOption) (*UpdateInstanceOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateInstance[0:len(c.CallOptions.UpdateInstance):len(c.CallOptions.UpdateInstance)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.instanceAdminClient.UpdateInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DeleteInstance deletes an instance. +// +// Immediately upon completion of the request: +// +// Billing ceases for all of the instance's reserved resources. +// +// Soon afterward: +// +// The instance and all of its databases immediately and +// irrevocably disappear from the API. All data in the databases +// is permanently deleted. +func (c *InstanceAdminClient) DeleteInstance(ctx context.Context, req *instancepb.DeleteInstanceRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteInstance[0:len(c.CallOptions.DeleteInstance):len(c.CallOptions.DeleteInstance)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.instanceAdminClient.DeleteInstance(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// SetIamPolicy sets the access control policy on an instance resource. Replaces any +// existing policy. +// +// Authorization requires spanner.instances.setIamPolicy on +// [resource][google.iam.v1.SetIamPolicyRequest.resource]. +func (c *InstanceAdminClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SetIamPolicy[0:len(c.CallOptions.SetIamPolicy):len(c.CallOptions.SetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.instanceAdminClient.SetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetIamPolicy gets the access control policy for an instance resource. Returns an empty +// policy if an instance exists but does not have a policy set. +// +// Authorization requires spanner.instances.getIamPolicy on +// [resource][google.iam.v1.GetIamPolicyRequest.resource]. +func (c *InstanceAdminClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetIamPolicy[0:len(c.CallOptions.GetIamPolicy):len(c.CallOptions.GetIamPolicy)], opts...) + var resp *iampb.Policy + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.instanceAdminClient.GetIamPolicy(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// TestIamPermissions returns permissions that the caller has on the specified instance resource. +// +// Attempting this RPC on a non-existent Cloud Spanner instance resource will +// result in a NOT_FOUND error if the user has spanner.instances.list +// permission on the containing Google Cloud Project. Otherwise returns an +// empty set of permissions. +func (c *InstanceAdminClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.TestIamPermissions[0:len(c.CallOptions.TestIamPermissions):len(c.CallOptions.TestIamPermissions)], opts...) + var resp *iampb.TestIamPermissionsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.instanceAdminClient.TestIamPermissions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// InstanceConfigIterator manages a stream of *instancepb.InstanceConfig. +type InstanceConfigIterator struct { + items []*instancepb.InstanceConfig + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*instancepb.InstanceConfig, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *InstanceConfigIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *InstanceConfigIterator) Next() (*instancepb.InstanceConfig, error) { + var item *instancepb.InstanceConfig + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *InstanceConfigIterator) bufLen() int { + return len(it.items) +} + +func (it *InstanceConfigIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// InstanceIterator manages a stream of *instancepb.Instance. +type InstanceIterator struct { + items []*instancepb.Instance + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*instancepb.Instance, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *InstanceIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *InstanceIterator) Next() (*instancepb.Instance, error) { + var item *instancepb.Instance + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *InstanceIterator) bufLen() int { + return len(it.items) +} + +func (it *InstanceIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// CreateInstanceOperation manages a long-running operation from CreateInstance. +type CreateInstanceOperation struct { + lro *longrunning.Operation +} + +// CreateInstanceOperation returns a new CreateInstanceOperation from a given name. +// The name must be that of a previously created CreateInstanceOperation, possibly from a different process. +func (c *InstanceAdminClient) CreateInstanceOperation(name string) *CreateInstanceOperation { + return &CreateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CreateInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*instancepb.Instance, error) { + var resp instancepb.Instance + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CreateInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*instancepb.Instance, error) { + var resp instancepb.Instance + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CreateInstanceOperation) Metadata() (*instancepb.CreateInstanceMetadata, error) { + var meta instancepb.CreateInstanceMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CreateInstanceOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CreateInstanceOperation) Name() string { + return op.lro.Name() +} + +// UpdateInstanceOperation manages a long-running operation from UpdateInstance. +type UpdateInstanceOperation struct { + lro *longrunning.Operation +} + +// UpdateInstanceOperation returns a new UpdateInstanceOperation from a given name. +// The name must be that of a previously created UpdateInstanceOperation, possibly from a different process. +func (c *InstanceAdminClient) UpdateInstanceOperation(name string) *UpdateInstanceOperation { + return &UpdateInstanceOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateInstanceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*instancepb.Instance, error) { + var resp instancepb.Instance + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *UpdateInstanceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*instancepb.Instance, error) { + var resp instancepb.Instance + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateInstanceOperation) Metadata() (*instancepb.UpdateInstanceMetadata, error) { + var meta instancepb.UpdateInstanceMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateInstanceOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateInstanceOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/instance_admin_client_example_test.go b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/instance_admin_client_example_test.go new file mode 100644 index 000000000..3e6576dd0 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/instance_admin_client_example_test.go @@ -0,0 +1,236 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package instance_test + +import ( + "context" + + instance "cloud.google.com/go/spanner/admin/instance/apiv1" + "google.golang.org/api/iterator" + iampb "google.golang.org/genproto/googleapis/iam/v1" + instancepb "google.golang.org/genproto/googleapis/spanner/admin/instance/v1" +) + +func ExampleNewInstanceAdminClient() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleInstanceAdminClient_ListInstanceConfigs() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &instancepb.ListInstanceConfigsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListInstanceConfigs(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleInstanceAdminClient_GetInstanceConfig() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &instancepb.GetInstanceConfigRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetInstanceConfig(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceAdminClient_ListInstances() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &instancepb.ListInstancesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListInstances(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleInstanceAdminClient_GetInstance() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &instancepb.GetInstanceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceAdminClient_CreateInstance() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &instancepb.CreateInstanceRequest{ + // TODO: Fill request struct fields. + } + op, err := c.CreateInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceAdminClient_UpdateInstance() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &instancepb.UpdateInstanceRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceAdminClient_DeleteInstance() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &instancepb.DeleteInstanceRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteInstance(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleInstanceAdminClient_SetIamPolicy() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.SetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceAdminClient_GetIamPolicy() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.GetIamPolicyRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetIamPolicy(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleInstanceAdminClient_TestIamPermissions() { + ctx := context.Background() + c, err := instance.NewInstanceAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &iampb.TestIamPermissionsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.TestIamPermissions(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/mock_test.go b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/mock_test.go new file mode 100644 index 000000000..696e78b33 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/mock_test.go @@ -0,0 +1,917 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package instance + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + iampb "google.golang.org/genproto/googleapis/iam/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + instancepb "google.golang.org/genproto/googleapis/spanner/admin/instance/v1" + field_maskpb "google.golang.org/genproto/protobuf/field_mask" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockInstanceAdminServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + instancepb.InstanceAdminServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockInstanceAdminServer) ListInstanceConfigs(ctx context.Context, req *instancepb.ListInstanceConfigsRequest) (*instancepb.ListInstanceConfigsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*instancepb.ListInstanceConfigsResponse), nil +} + +func (s *mockInstanceAdminServer) GetInstanceConfig(ctx context.Context, req *instancepb.GetInstanceConfigRequest) (*instancepb.InstanceConfig, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*instancepb.InstanceConfig), nil +} + +func (s *mockInstanceAdminServer) ListInstances(ctx context.Context, req *instancepb.ListInstancesRequest) (*instancepb.ListInstancesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*instancepb.ListInstancesResponse), nil +} + +func (s *mockInstanceAdminServer) GetInstance(ctx context.Context, req *instancepb.GetInstanceRequest) (*instancepb.Instance, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*instancepb.Instance), nil +} + +func (s *mockInstanceAdminServer) CreateInstance(ctx context.Context, req *instancepb.CreateInstanceRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockInstanceAdminServer) UpdateInstance(ctx context.Context, req *instancepb.UpdateInstanceRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockInstanceAdminServer) DeleteInstance(ctx context.Context, req *instancepb.DeleteInstanceRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockInstanceAdminServer) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockInstanceAdminServer) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest) (*iampb.Policy, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.Policy), nil +} + +func (s *mockInstanceAdminServer) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest) (*iampb.TestIamPermissionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*iampb.TestIamPermissionsResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockInstanceAdmin mockInstanceAdminServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + instancepb.RegisterInstanceAdminServer(serv, &mockInstanceAdmin) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestInstanceAdminListInstanceConfigs(t *testing.T) { + var nextPageToken string = "" + var instanceConfigsElement *instancepb.InstanceConfig = &instancepb.InstanceConfig{} + var instanceConfigs = []*instancepb.InstanceConfig{instanceConfigsElement} + var expectedResponse = &instancepb.ListInstanceConfigsResponse{ + NextPageToken: nextPageToken, + InstanceConfigs: instanceConfigs, + } + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &instancepb.ListInstanceConfigsRequest{ + Parent: formattedParent, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInstanceConfigs(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.InstanceConfigs[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestInstanceAdminListInstanceConfigsError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &instancepb.ListInstanceConfigsRequest{ + Parent: formattedParent, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInstanceConfigs(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestInstanceAdminGetInstanceConfig(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var expectedResponse = &instancepb.InstanceConfig{ + Name: name2, + DisplayName: displayName, + } + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/instanceConfigs/%s", "[PROJECT]", "[INSTANCE_CONFIG]") + var request = &instancepb.GetInstanceConfigRequest{ + Name: formattedName, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInstanceConfig(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestInstanceAdminGetInstanceConfigError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/instanceConfigs/%s", "[PROJECT]", "[INSTANCE_CONFIG]") + var request = &instancepb.GetInstanceConfigRequest{ + Name: formattedName, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInstanceConfig(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestInstanceAdminListInstances(t *testing.T) { + var nextPageToken string = "" + var instancesElement *instancepb.Instance = &instancepb.Instance{} + var instances = []*instancepb.Instance{instancesElement} + var expectedResponse = &instancepb.ListInstancesResponse{ + NextPageToken: nextPageToken, + Instances: instances, + } + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &instancepb.ListInstancesRequest{ + Parent: formattedParent, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInstances(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Instances[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestInstanceAdminListInstancesError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var request = &instancepb.ListInstancesRequest{ + Parent: formattedParent, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListInstances(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestInstanceAdminGetInstance(t *testing.T) { + var name2 string = "name2-1052831874" + var config string = "config-1354792126" + var displayName string = "displayName1615086568" + var nodeCount int32 = 1539922066 + var expectedResponse = &instancepb.Instance{ + Name: name2, + Config: config, + DisplayName: displayName, + NodeCount: nodeCount, + } + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var request = &instancepb.GetInstanceRequest{ + Name: formattedName, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInstance(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestInstanceAdminGetInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var request = &instancepb.GetInstanceRequest{ + Name: formattedName, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetInstance(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestInstanceAdminCreateInstance(t *testing.T) { + var name string = "name3373707" + var config string = "config-1354792126" + var displayName string = "displayName1615086568" + var nodeCount int32 = 1539922066 + var expectedResponse = &instancepb.Instance{ + Name: name, + Config: config, + DisplayName: displayName, + NodeCount: nodeCount, + } + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var instanceId string = "instanceId-2101995259" + var instance *instancepb.Instance = &instancepb.Instance{} + var request = &instancepb.CreateInstanceRequest{ + Parent: formattedParent, + InstanceId: instanceId, + Instance: instance, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestInstanceAdminCreateInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = nil + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s", "[PROJECT]") + var instanceId string = "instanceId-2101995259" + var instance *instancepb.Instance = &instancepb.Instance{} + var request = &instancepb.CreateInstanceRequest{ + Parent: formattedParent, + InstanceId: instanceId, + Instance: instance, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.CreateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestInstanceAdminUpdateInstance(t *testing.T) { + var name string = "name3373707" + var config string = "config-1354792126" + var displayName string = "displayName1615086568" + var nodeCount int32 = 1539922066 + var expectedResponse = &instancepb.Instance{ + Name: name, + Config: config, + DisplayName: displayName, + NodeCount: nodeCount, + } + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var instance *instancepb.Instance = &instancepb.Instance{} + var fieldMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &instancepb.UpdateInstanceRequest{ + Instance: instance, + FieldMask: fieldMask, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestInstanceAdminUpdateInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = nil + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var instance *instancepb.Instance = &instancepb.Instance{} + var fieldMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{} + var request = &instancepb.UpdateInstanceRequest{ + Instance: instance, + FieldMask: fieldMask, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.UpdateInstance(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestInstanceAdminDeleteInstance(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var request = &instancepb.DeleteInstanceRequest{ + Name: formattedName, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteInstance(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestInstanceAdminDeleteInstanceError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var request = &instancepb.DeleteInstanceRequest{ + Name: formattedName, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteInstance(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestInstanceAdminSetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestInstanceAdminSetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var policy *iampb.Policy = &iampb.Policy{} + var request = &iampb.SetIamPolicyRequest{ + Resource: formattedResource, + Policy: policy, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestInstanceAdminGetIamPolicy(t *testing.T) { + var version int32 = 351608024 + var etag []byte = []byte("21") + var expectedResponse = &iampb.Policy{ + Version: version, + Etag: etag, + } + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestInstanceAdminGetIamPolicyError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var request = &iampb.GetIamPolicyRequest{ + Resource: formattedResource, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetIamPolicy(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestInstanceAdminTestIamPermissions(t *testing.T) { + var expectedResponse *iampb.TestIamPermissionsResponse = &iampb.TestIamPermissionsResponse{} + + mockInstanceAdmin.err = nil + mockInstanceAdmin.reqs = nil + + mockInstanceAdmin.resps = append(mockInstanceAdmin.resps[:0], expectedResponse) + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockInstanceAdmin.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestInstanceAdminTestIamPermissionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockInstanceAdmin.err = gstatus.Error(errCode, "test error") + + var formattedResource string = fmt.Sprintf("projects/%s/instances/%s", "[PROJECT]", "[INSTANCE]") + var permissions []string = nil + var request = &iampb.TestIamPermissionsRequest{ + Resource: formattedResource, + Permissions: permissions, + } + + c, err := NewInstanceAdminClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.TestIamPermissions(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/path_funcs.go b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/path_funcs.go new file mode 100644 index 000000000..a2255805f --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/admin/instance/apiv1/path_funcs.go @@ -0,0 +1,55 @@ +// 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 +// +// https://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 instance + +// InstanceAdminProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func InstanceAdminProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// InstanceAdminInstanceConfigPath returns the path for the instance config resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/instanceConfigs/%s", project, instanceConfig) +// instead. +func InstanceAdminInstanceConfigPath(project, instanceConfig string) string { + return "" + + "projects/" + + project + + "/instanceConfigs/" + + instanceConfig + + "" +} + +// InstanceAdminInstancePath returns the path for the instance resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/instances/%s", project, instance) +// instead. +func InstanceAdminInstancePath(project, instance string) string { + return "" + + "projects/" + + project + + "/instances/" + + instance + + "" +} diff --git a/vendor/cloud.google.com/go/spanner/apiv1/doc.go b/vendor/cloud.google.com/go/spanner/apiv1/doc.go new file mode 100644 index 000000000..34fdd0bf4 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/apiv1/doc.go @@ -0,0 +1,93 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package spanner is an auto-generated package for the +// Cloud Spanner API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Cloud Spanner is a managed, mission-critical, globally consistent and +// scalable relational database service. +// +// Use the client at cloud.google.com/go/spanner in preference to this. +package spanner // import "cloud.google.com/go/spanner/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/spanner.data", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/spanner/apiv1/mock_test.go b/vendor/cloud.google.com/go/spanner/apiv1/mock_test.go new file mode 100644 index 000000000..e451c872e --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/apiv1/mock_test.go @@ -0,0 +1,1085 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package spanner + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + spannerpb "google.golang.org/genproto/googleapis/spanner/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockSpannerServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + spannerpb.SpannerServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockSpannerServer) CreateSession(ctx context.Context, req *spannerpb.CreateSessionRequest) (*spannerpb.Session, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*spannerpb.Session), nil +} + +func (s *mockSpannerServer) GetSession(ctx context.Context, req *spannerpb.GetSessionRequest) (*spannerpb.Session, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*spannerpb.Session), nil +} + +func (s *mockSpannerServer) ListSessions(ctx context.Context, req *spannerpb.ListSessionsRequest) (*spannerpb.ListSessionsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*spannerpb.ListSessionsResponse), nil +} + +func (s *mockSpannerServer) DeleteSession(ctx context.Context, req *spannerpb.DeleteSessionRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockSpannerServer) ExecuteSql(ctx context.Context, req *spannerpb.ExecuteSqlRequest) (*spannerpb.ResultSet, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*spannerpb.ResultSet), nil +} + +func (s *mockSpannerServer) ExecuteStreamingSql(req *spannerpb.ExecuteSqlRequest, stream spannerpb.Spanner_ExecuteStreamingSqlServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*spannerpb.PartialResultSet)); err != nil { + return err + } + } + return nil +} + +func (s *mockSpannerServer) Read(ctx context.Context, req *spannerpb.ReadRequest) (*spannerpb.ResultSet, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*spannerpb.ResultSet), nil +} + +func (s *mockSpannerServer) StreamingRead(req *spannerpb.ReadRequest, stream spannerpb.Spanner_StreamingReadServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*spannerpb.PartialResultSet)); err != nil { + return err + } + } + return nil +} + +func (s *mockSpannerServer) BeginTransaction(ctx context.Context, req *spannerpb.BeginTransactionRequest) (*spannerpb.Transaction, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*spannerpb.Transaction), nil +} + +func (s *mockSpannerServer) Commit(ctx context.Context, req *spannerpb.CommitRequest) (*spannerpb.CommitResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*spannerpb.CommitResponse), nil +} + +func (s *mockSpannerServer) Rollback(ctx context.Context, req *spannerpb.RollbackRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockSpannerServer) PartitionQuery(ctx context.Context, req *spannerpb.PartitionQueryRequest) (*spannerpb.PartitionResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*spannerpb.PartitionResponse), nil +} + +func (s *mockSpannerServer) PartitionRead(ctx context.Context, req *spannerpb.PartitionReadRequest) (*spannerpb.PartitionResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*spannerpb.PartitionResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockSpanner mockSpannerServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + spannerpb.RegisterSpannerServer(serv, &mockSpanner) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestSpannerCreateSession(t *testing.T) { + var name string = "name3373707" + var expectedResponse = &spannerpb.Session{ + Name: name, + } + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &spannerpb.CreateSessionRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSession(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerCreateSessionError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &spannerpb.CreateSessionRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSession(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerGetSession(t *testing.T) { + var name2 string = "name2-1052831874" + var expectedResponse = &spannerpb.Session{ + Name: name2, + } + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var request = &spannerpb.GetSessionRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSession(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerGetSessionError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var request = &spannerpb.GetSessionRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetSession(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerListSessions(t *testing.T) { + var nextPageToken string = "" + var sessionsElement *spannerpb.Session = &spannerpb.Session{} + var sessions = []*spannerpb.Session{sessionsElement} + var expectedResponse = &spannerpb.ListSessionsResponse{ + NextPageToken: nextPageToken, + Sessions: sessions, + } + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &spannerpb.ListSessionsRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSessions(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Sessions[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerListSessionsError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedDatabase string = fmt.Sprintf("projects/%s/instances/%s/databases/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]") + var request = &spannerpb.ListSessionsRequest{ + Database: formattedDatabase, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListSessions(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerDeleteSession(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var request = &spannerpb.DeleteSessionRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSession(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestSpannerDeleteSessionError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var request = &spannerpb.DeleteSessionRequest{ + Name: formattedName, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteSession(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSpannerExecuteSql(t *testing.T) { + var expectedResponse *spannerpb.ResultSet = &spannerpb.ResultSet{} + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var sql string = "sql114126" + var request = &spannerpb.ExecuteSqlRequest{ + Session: formattedSession, + Sql: sql, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ExecuteSql(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerExecuteSqlError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var sql string = "sql114126" + var request = &spannerpb.ExecuteSqlRequest{ + Session: formattedSession, + Sql: sql, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ExecuteSql(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerExecuteStreamingSql(t *testing.T) { + var chunkedValue bool = true + var resumeToken []byte = []byte("103") + var expectedResponse = &spannerpb.PartialResultSet{ + ChunkedValue: chunkedValue, + ResumeToken: resumeToken, + } + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var sql string = "sql114126" + var request = &spannerpb.ExecuteSqlRequest{ + Session: formattedSession, + Sql: sql, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.ExecuteStreamingSql(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerExecuteStreamingSqlError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var sql string = "sql114126" + var request = &spannerpb.ExecuteSqlRequest{ + Session: formattedSession, + Sql: sql, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.ExecuteStreamingSql(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerRead(t *testing.T) { + var expectedResponse *spannerpb.ResultSet = &spannerpb.ResultSet{} + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var table string = "table110115790" + var columns []string = nil + var keySet *spannerpb.KeySet = &spannerpb.KeySet{} + var request = &spannerpb.ReadRequest{ + Session: formattedSession, + Table: table, + Columns: columns, + KeySet: keySet, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Read(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerReadError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var table string = "table110115790" + var columns []string = nil + var keySet *spannerpb.KeySet = &spannerpb.KeySet{} + var request = &spannerpb.ReadRequest{ + Session: formattedSession, + Table: table, + Columns: columns, + KeySet: keySet, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Read(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerStreamingRead(t *testing.T) { + var chunkedValue bool = true + var resumeToken []byte = []byte("103") + var expectedResponse = &spannerpb.PartialResultSet{ + ChunkedValue: chunkedValue, + ResumeToken: resumeToken, + } + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var table string = "table110115790" + var columns []string = nil + var keySet *spannerpb.KeySet = &spannerpb.KeySet{} + var request = &spannerpb.ReadRequest{ + Session: formattedSession, + Table: table, + Columns: columns, + KeySet: keySet, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingRead(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerStreamingReadError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var table string = "table110115790" + var columns []string = nil + var keySet *spannerpb.KeySet = &spannerpb.KeySet{} + var request = &spannerpb.ReadRequest{ + Session: formattedSession, + Table: table, + Columns: columns, + KeySet: keySet, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingRead(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerBeginTransaction(t *testing.T) { + var id []byte = []byte("27") + var expectedResponse = &spannerpb.Transaction{ + Id: id, + } + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var options *spannerpb.TransactionOptions = &spannerpb.TransactionOptions{} + var request = &spannerpb.BeginTransactionRequest{ + Session: formattedSession, + Options: options, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BeginTransaction(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerBeginTransactionError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var options *spannerpb.TransactionOptions = &spannerpb.TransactionOptions{} + var request = &spannerpb.BeginTransactionRequest{ + Session: formattedSession, + Options: options, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BeginTransaction(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerCommit(t *testing.T) { + var expectedResponse *spannerpb.CommitResponse = &spannerpb.CommitResponse{} + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var mutations []*spannerpb.Mutation = nil + var request = &spannerpb.CommitRequest{ + Session: formattedSession, + Mutations: mutations, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Commit(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerCommitError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var mutations []*spannerpb.Mutation = nil + var request = &spannerpb.CommitRequest{ + Session: formattedSession, + Mutations: mutations, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Commit(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerRollback(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var transactionId []byte = []byte("28") + var request = &spannerpb.RollbackRequest{ + Session: formattedSession, + TransactionId: transactionId, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.Rollback(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestSpannerRollbackError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var transactionId []byte = []byte("28") + var request = &spannerpb.RollbackRequest{ + Session: formattedSession, + TransactionId: transactionId, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.Rollback(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestSpannerPartitionQuery(t *testing.T) { + var expectedResponse *spannerpb.PartitionResponse = &spannerpb.PartitionResponse{} + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var sql string = "sql114126" + var request = &spannerpb.PartitionQueryRequest{ + Session: formattedSession, + Sql: sql, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PartitionQuery(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerPartitionQueryError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var sql string = "sql114126" + var request = &spannerpb.PartitionQueryRequest{ + Session: formattedSession, + Sql: sql, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PartitionQuery(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpannerPartitionRead(t *testing.T) { + var expectedResponse *spannerpb.PartitionResponse = &spannerpb.PartitionResponse{} + + mockSpanner.err = nil + mockSpanner.reqs = nil + + mockSpanner.resps = append(mockSpanner.resps[:0], expectedResponse) + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var table string = "table110115790" + var keySet *spannerpb.KeySet = &spannerpb.KeySet{} + var request = &spannerpb.PartitionReadRequest{ + Session: formattedSession, + Table: table, + KeySet: keySet, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PartitionRead(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpanner.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpannerPartitionReadError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpanner.err = gstatus.Error(errCode, "test error") + + var formattedSession string = fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", "[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]") + var table string = "table110115790" + var keySet *spannerpb.KeySet = &spannerpb.KeySet{} + var request = &spannerpb.PartitionReadRequest{ + Session: formattedSession, + Table: table, + KeySet: keySet, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.PartitionRead(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/spanner/apiv1/path_funcs.go b/vendor/cloud.google.com/go/spanner/apiv1/path_funcs.go new file mode 100644 index 000000000..19f30adb3 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/apiv1/path_funcs.go @@ -0,0 +1,49 @@ +// 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 +// +// https://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 spanner + +// DatabasePath returns the path for the database resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/instances/%s/databases/%s", project, instance, database) +// instead. +func DatabasePath(project, instance, database string) string { + return "" + + "projects/" + + project + + "/instances/" + + instance + + "/databases/" + + database + + "" +} + +// SessionPath returns the path for the session resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", project, instance, database, session) +// instead. +func SessionPath(project, instance, database, session string) string { + return "" + + "projects/" + + project + + "/instances/" + + instance + + "/databases/" + + database + + "/sessions/" + + session + + "" +} diff --git a/vendor/cloud.google.com/go/spanner/apiv1/spanner_client.go b/vendor/cloud.google.com/go/spanner/apiv1/spanner_client.go new file mode 100644 index 000000000..8db16f2c5 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/apiv1/spanner_client.go @@ -0,0 +1,510 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package spanner + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + spannerpb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + CreateSession []gax.CallOption + GetSession []gax.CallOption + ListSessions []gax.CallOption + DeleteSession []gax.CallOption + ExecuteSql []gax.CallOption + ExecuteStreamingSql []gax.CallOption + Read []gax.CallOption + StreamingRead []gax.CallOption + BeginTransaction []gax.CallOption + Commit []gax.CallOption + Rollback []gax.CallOption + PartitionQuery []gax.CallOption + PartitionRead []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("spanner.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 32000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + {"long_running", "long_running"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 32000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + CreateSession: retry[[2]string{"default", "idempotent"}], + GetSession: retry[[2]string{"default", "idempotent"}], + ListSessions: retry[[2]string{"default", "idempotent"}], + DeleteSession: retry[[2]string{"default", "idempotent"}], + ExecuteSql: retry[[2]string{"default", "idempotent"}], + ExecuteStreamingSql: retry[[2]string{"streaming", "non_idempotent"}], + Read: retry[[2]string{"default", "idempotent"}], + StreamingRead: retry[[2]string{"streaming", "non_idempotent"}], + BeginTransaction: retry[[2]string{"default", "idempotent"}], + Commit: retry[[2]string{"long_running", "long_running"}], + Rollback: retry[[2]string{"default", "idempotent"}], + PartitionQuery: retry[[2]string{"default", "idempotent"}], + PartitionRead: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Cloud Spanner API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client spannerpb.SpannerClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new spanner client. +// +// Cloud Spanner API +// +// The Cloud Spanner API can be used to manage sessions and execute +// transactions on data stored in Cloud Spanner databases. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: spannerpb.NewSpannerClient(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// CreateSession creates a new session. A session can be used to perform +// transactions that read and/or modify data in a Cloud Spanner database. +// Sessions are meant to be reused for many consecutive +// transactions. +// +// Sessions can only execute one transaction at a time. To execute +// multiple concurrent read-write/write-only transactions, create +// multiple sessions. Note that standalone reads and queries use a +// transaction internally, and count toward the one transaction +// limit. +// +// Cloud Spanner limits the number of sessions that can exist at any given +// time; thus, it is a good idea to delete idle and/or unneeded sessions. +// Aside from explicit deletes, Cloud Spanner can delete sessions for which no +// operations are sent for more than an hour. If a session is deleted, +// requests to it return NOT_FOUND. +// +// Idle sessions can be kept alive by sending a trivial SQL query +// periodically, e.g., "SELECT 1". +func (c *Client) CreateSession(ctx context.Context, req *spannerpb.CreateSessionRequest, opts ...gax.CallOption) (*spannerpb.Session, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateSession[0:len(c.CallOptions.CreateSession):len(c.CallOptions.CreateSession)], opts...) + var resp *spannerpb.Session + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateSession(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// GetSession gets a session. Returns NOT_FOUND if the session does not exist. +// This is mainly useful for determining whether a session is still +// alive. +func (c *Client) GetSession(ctx context.Context, req *spannerpb.GetSessionRequest, opts ...gax.CallOption) (*spannerpb.Session, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetSession[0:len(c.CallOptions.GetSession):len(c.CallOptions.GetSession)], opts...) + var resp *spannerpb.Session + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetSession(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListSessions lists all sessions in a given database. +func (c *Client) ListSessions(ctx context.Context, req *spannerpb.ListSessionsRequest, opts ...gax.CallOption) *SessionIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListSessions[0:len(c.CallOptions.ListSessions):len(c.CallOptions.ListSessions)], opts...) + it := &SessionIterator{} + req = proto.Clone(req).(*spannerpb.ListSessionsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*spannerpb.Session, string, error) { + var resp *spannerpb.ListSessionsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListSessions(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Sessions, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// DeleteSession ends a session, releasing server resources associated with it. +func (c *Client) DeleteSession(ctx context.Context, req *spannerpb.DeleteSessionRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteSession[0:len(c.CallOptions.DeleteSession):len(c.CallOptions.DeleteSession)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteSession(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ExecuteSql executes an SQL statement, returning all results in a single reply. This +// method cannot be used to return a result set larger than 10 MiB; +// if the query yields more data than that, the query fails with +// a FAILED_PRECONDITION error. +// +// Operations inside read-write transactions might return ABORTED. If +// this occurs, the application should restart the transaction from +// the beginning. See [Transaction][google.spanner.v1.Transaction] for more details. +// +// Larger result sets can be fetched in streaming fashion by calling +// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] instead. +func (c *Client) ExecuteSql(ctx context.Context, req *spannerpb.ExecuteSqlRequest, opts ...gax.CallOption) (*spannerpb.ResultSet, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ExecuteSql[0:len(c.CallOptions.ExecuteSql):len(c.CallOptions.ExecuteSql)], opts...) + var resp *spannerpb.ResultSet + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ExecuteSql(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ExecuteStreamingSql like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the result +// set as a stream. Unlike [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there +// is no limit on the size of the returned result set. However, no +// individual row in the result set can exceed 100 MiB, and no +// column value can exceed 10 MiB. +func (c *Client) ExecuteStreamingSql(ctx context.Context, req *spannerpb.ExecuteSqlRequest, opts ...gax.CallOption) (spannerpb.Spanner_ExecuteStreamingSqlClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ExecuteStreamingSql[0:len(c.CallOptions.ExecuteStreamingSql):len(c.CallOptions.ExecuteStreamingSql)], opts...) + var resp spannerpb.Spanner_ExecuteStreamingSqlClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ExecuteStreamingSql(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Read reads rows from the database using key lookups and scans, as a +// simple key/value style alternative to +// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be used to +// return a result set larger than 10 MiB; if the read matches more +// data than that, the read fails with a FAILED_PRECONDITION +// error. +// +// Reads inside read-write transactions might return ABORTED. If +// this occurs, the application should restart the transaction from +// the beginning. See [Transaction][google.spanner.v1.Transaction] for more details. +// +// Larger result sets can be yielded in streaming fashion by calling +// [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. +func (c *Client) Read(ctx context.Context, req *spannerpb.ReadRequest, opts ...gax.CallOption) (*spannerpb.ResultSet, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Read[0:len(c.CallOptions.Read):len(c.CallOptions.Read)], opts...) + var resp *spannerpb.ResultSet + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.Read(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// StreamingRead like [Read][google.spanner.v1.Spanner.Read], except returns the result set as a +// stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no limit on the +// size of the returned result set. However, no individual row in +// the result set can exceed 100 MiB, and no column value can exceed +// 10 MiB. +func (c *Client) StreamingRead(ctx context.Context, req *spannerpb.ReadRequest, opts ...gax.CallOption) (spannerpb.Spanner_StreamingReadClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.StreamingRead[0:len(c.CallOptions.StreamingRead):len(c.CallOptions.StreamingRead)], opts...) + var resp spannerpb.Spanner_StreamingReadClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.StreamingRead(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// BeginTransaction begins a new transaction. This step can often be skipped: +// [Read][google.spanner.v1.Spanner.Read], [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and +// [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a +// side-effect. +func (c *Client) BeginTransaction(ctx context.Context, req *spannerpb.BeginTransactionRequest, opts ...gax.CallOption) (*spannerpb.Transaction, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BeginTransaction[0:len(c.CallOptions.BeginTransaction):len(c.CallOptions.BeginTransaction)], opts...) + var resp *spannerpb.Transaction + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.BeginTransaction(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Commit commits a transaction. The request includes the mutations to be +// applied to rows in the database. +// +// Commit might return an ABORTED error. This can occur at any time; +// commonly, the cause is conflicts with concurrent +// transactions. However, it can also happen for a variety of other +// reasons. If Commit returns ABORTED, the caller should re-attempt +// the transaction from the beginning, re-using the same session. +func (c *Client) Commit(ctx context.Context, req *spannerpb.CommitRequest, opts ...gax.CallOption) (*spannerpb.CommitResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Commit[0:len(c.CallOptions.Commit):len(c.CallOptions.Commit)], opts...) + var resp *spannerpb.CommitResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.Commit(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// Rollback rolls back a transaction, releasing any locks it holds. It is a good +// idea to call this for any transaction that includes one or more +// [Read][google.spanner.v1.Spanner.Read] or [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and +// ultimately decides not to commit. +// +// Rollback returns OK if it successfully aborts the transaction, the +// transaction was already aborted, or the transaction is not +// found. Rollback never returns ABORTED. +func (c *Client) Rollback(ctx context.Context, req *spannerpb.RollbackRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Rollback[0:len(c.CallOptions.Rollback):len(c.CallOptions.Rollback)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.Rollback(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// PartitionQuery creates a set of partition tokens that can be used to execute a query +// operation in parallel. Each of the returned partition tokens can be used +// by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to specify a subset +// of the query result to read. The same session and read-only transaction +// must be used by the PartitionQueryRequest used to create the +// partition tokens and the ExecuteSqlRequests that use the partition tokens. +// +// Partition tokens become invalid when the session used to create them +// is deleted, is idle for too long, begins a new transaction, or becomes too +// old. When any of these happen, it is not possible to resume the query, and +// the whole operation must be restarted from the beginning. +func (c *Client) PartitionQuery(ctx context.Context, req *spannerpb.PartitionQueryRequest, opts ...gax.CallOption) (*spannerpb.PartitionResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.PartitionQuery[0:len(c.CallOptions.PartitionQuery):len(c.CallOptions.PartitionQuery)], opts...) + var resp *spannerpb.PartitionResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.PartitionQuery(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// PartitionRead creates a set of partition tokens that can be used to execute a read +// operation in parallel. Each of the returned partition tokens can be used +// by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a subset of the read +// result to read. The same session and read-only transaction must be used by +// the PartitionReadRequest used to create the partition tokens and the +// ReadRequests that use the partition tokens. There are no ordering +// guarantees on rows returned among the returned partition tokens, or even +// within each individual StreamingRead call issued with a partition_token. +// +// Partition tokens become invalid when the session used to create them +// is deleted, is idle for too long, begins a new transaction, or becomes too +// old. When any of these happen, it is not possible to resume the read, and +// the whole operation must be restarted from the beginning. +func (c *Client) PartitionRead(ctx context.Context, req *spannerpb.PartitionReadRequest, opts ...gax.CallOption) (*spannerpb.PartitionResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.PartitionRead[0:len(c.CallOptions.PartitionRead):len(c.CallOptions.PartitionRead)], opts...) + var resp *spannerpb.PartitionResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.PartitionRead(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SessionIterator manages a stream of *spannerpb.Session. +type SessionIterator struct { + items []*spannerpb.Session + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*spannerpb.Session, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *SessionIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *SessionIterator) Next() (*spannerpb.Session, error) { + var item *spannerpb.Session + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *SessionIterator) bufLen() int { + return len(it.items) +} + +func (it *SessionIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/spanner/apiv1/spanner_client_example_test.go b/vendor/cloud.google.com/go/spanner/apiv1/spanner_client_example_test.go new file mode 100644 index 000000000..b4c2311d9 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/apiv1/spanner_client_example_test.go @@ -0,0 +1,290 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package spanner_test + +import ( + "context" + "io" + + spanner "cloud.google.com/go/spanner/apiv1" + "google.golang.org/api/iterator" + spannerpb "google.golang.org/genproto/googleapis/spanner/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_CreateSession() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.CreateSessionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateSession(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_GetSession() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.GetSessionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetSession(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListSessions() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.ListSessionsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListSessions(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_DeleteSession() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.DeleteSessionRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteSession(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_ExecuteSql() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.ExecuteSqlRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ExecuteSql(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ExecuteStreamingSql() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.ExecuteSqlRequest{ + // TODO: Fill request struct fields. + } + stream, err := c.ExecuteStreamingSql(ctx, req) + if err != nil { + // TODO: Handle error. + } + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_Read() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.ReadRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Read(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_StreamingRead() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.ReadRequest{ + // TODO: Fill request struct fields. + } + stream, err := c.StreamingRead(ctx, req) + if err != nil { + // TODO: Handle error. + } + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_BeginTransaction() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.BeginTransactionRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BeginTransaction(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_Commit() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.CommitRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Commit(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_Rollback() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.RollbackRequest{ + // TODO: Fill request struct fields. + } + err = c.Rollback(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_PartitionQuery() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.PartitionQueryRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PartitionQuery(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_PartitionRead() { + ctx := context.Background() + c, err := spanner.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &spannerpb.PartitionReadRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.PartitionRead(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/spanner/appengine.go b/vendor/cloud.google.com/go/spanner/appengine.go new file mode 100644 index 000000000..c7ce1b4df --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/appengine.go @@ -0,0 +1,20 @@ +// Copyright 2017 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. + +// +build appengine + +package spanner + +// numChannels is the default value for NumChannels of client +const numChannels = 1 diff --git a/vendor/cloud.google.com/go/spanner/backoff.go b/vendor/cloud.google.com/go/spanner/backoff.go new file mode 100644 index 000000000..b2e13e9e4 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/backoff.go @@ -0,0 +1,58 @@ +/* +Copyright 2017 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 spanner + +import ( + "math/rand" + "time" +) + +const ( + // minBackoff is the minimum backoff used by default. + minBackoff = 1 * time.Second + // maxBackoff is the maximum backoff used by default. + maxBackoff = 32 * time.Second + // jitter is the jitter factor. + jitter = 0.4 + // rate is the rate of exponential increase in the backoff. + rate = 1.3 +) + +var defaultBackoff = exponentialBackoff{minBackoff, maxBackoff} + +type exponentialBackoff struct { + min, max time.Duration +} + +// delay calculates the delay that should happen at n-th +// exponential backoff in a series. +func (b exponentialBackoff) delay(retries int) time.Duration { + min, max := float64(b.min), float64(b.max) + delay := min + for delay < max && retries > 0 { + delay *= rate + retries-- + } + if delay > max { + delay = max + } + delay -= delay * jitter * rand.Float64() + if delay < min { + delay = min + } + return time.Duration(delay) +} diff --git a/vendor/cloud.google.com/go/spanner/backoff_test.go b/vendor/cloud.google.com/go/spanner/backoff_test.go new file mode 100644 index 000000000..150af0ae5 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/backoff_test.go @@ -0,0 +1,61 @@ +/* +Copyright 2017 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 spanner + +import ( + "math" + "testing" + "time" +) + +// Test if exponential backoff helper can produce correct series of +// retry delays. +func TestBackoff(t *testing.T) { + b := exponentialBackoff{minBackoff, maxBackoff} + tests := []struct { + retries int + min time.Duration + max time.Duration + }{ + { + retries: 0, + min: minBackoff, + max: minBackoff, + }, + { + retries: 1, + min: minBackoff, + max: time.Duration(rate * float64(minBackoff)), + }, + { + retries: 3, + min: time.Duration(math.Pow(rate, 3) * (1 - jitter) * float64(minBackoff)), + max: time.Duration(math.Pow(rate, 3) * float64(minBackoff)), + }, + { + retries: 1000, + min: time.Duration((1 - jitter) * float64(maxBackoff)), + max: maxBackoff, + }, + } + for _, test := range tests { + got := b.delay(test.retries) + if float64(got) < float64(test.min) || float64(got) > float64(test.max) { + t.Errorf("delay(%v) = %v, want in range [%v, %v]", test.retries, got, test.min, test.max) + } + } +} diff --git a/vendor/cloud.google.com/go/spanner/batch.go b/vendor/cloud.google.com/go/spanner/batch.go new file mode 100644 index 000000000..eceaed0a0 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/batch.go @@ -0,0 +1,347 @@ +/* +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. +*/ + +package spanner + +import ( + "bytes" + "context" + "encoding/gob" + "log" + "time" + + "github.com/golang/protobuf/proto" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +// BatchReadOnlyTransaction is a ReadOnlyTransaction that allows for exporting +// arbitrarily large amounts of data from Cloud Spanner databases. +// BatchReadOnlyTransaction partitions a read/query request. Read/query request +// can then be executed independently over each partition while observing the +// same snapshot of the database. BatchReadOnlyTransaction can also be shared +// across multiple clients by passing around the BatchReadOnlyTransactionID and +// then recreating the transaction using Client.BatchReadOnlyTransactionFromID. +// +// Note: if a client is used only to run partitions, you can +// create it using a ClientConfig with both MinOpened and MaxIdle set to +// zero to avoid creating unnecessary sessions. You can also avoid excess +// gRPC channels by setting ClientConfig.NumChannels to the number of +// concurrently active BatchReadOnlyTransactions you expect to have. +type BatchReadOnlyTransaction struct { + ReadOnlyTransaction + ID BatchReadOnlyTransactionID +} + +// BatchReadOnlyTransactionID is a unique identifier for a +// BatchReadOnlyTransaction. It can be used to re-create a +// BatchReadOnlyTransaction on a different machine or process by calling +// Client.BatchReadOnlyTransactionFromID. +type BatchReadOnlyTransactionID struct { + // unique ID for the transaction. + tid transactionID + // sid is the id of the Cloud Spanner session used for this transaction. + sid string + // rts is the read timestamp of this transaction. + rts time.Time +} + +// Partition defines a segment of data to be read in a batch read or query. A +// partition can be serialized and processed across several different machines +// or processes. +type Partition struct { + pt []byte + qreq *sppb.ExecuteSqlRequest + rreq *sppb.ReadRequest +} + +// PartitionOptions specifies options for a PartitionQueryRequest and +// PartitionReadRequest. See +// https://godoc.org/google.golang.org/genproto/googleapis/spanner/v1#PartitionOptions +// for more details. +type PartitionOptions struct { + // The desired data size for each partition generated. + PartitionBytes int64 + // The desired maximum number of partitions to return. + MaxPartitions int64 +} + +// toProto converts a spanner.PartitionOptions into a sppb.PartitionOptions +func (opt PartitionOptions) toProto() *sppb.PartitionOptions { + return &sppb.PartitionOptions{ + PartitionSizeBytes: opt.PartitionBytes, + MaxPartitions: opt.MaxPartitions, + } +} + +// PartitionRead returns a list of Partitions that can be used to read rows from +// the database. These partitions can be executed across multiple processes, +// even across different machines. The partition size and count hints can be +// configured using PartitionOptions. +func (t *BatchReadOnlyTransaction) PartitionRead(ctx context.Context, table string, keys KeySet, columns []string, opt PartitionOptions) ([]*Partition, error) { + return t.PartitionReadUsingIndex(ctx, table, "", keys, columns, opt) +} + +// PartitionReadUsingIndex returns a list of Partitions that can be used to read +// rows from the database using an index. +func (t *BatchReadOnlyTransaction) PartitionReadUsingIndex(ctx context.Context, table, index string, keys KeySet, columns []string, opt PartitionOptions) ([]*Partition, error) { + sh, ts, err := t.acquire(ctx) + if err != nil { + return nil, err + } + sid, client := sh.getID(), sh.getClient() + var ( + kset *sppb.KeySet + resp *sppb.PartitionResponse + partitions []*Partition + ) + kset, err = keys.keySetProto() + // request Partitions + if err != nil { + return nil, err + } + resp, err = client.PartitionRead(ctx, &sppb.PartitionReadRequest{ + Session: sid, + Transaction: ts, + Table: table, + Index: index, + Columns: columns, + KeySet: kset, + PartitionOptions: opt.toProto(), + }) + // prepare ReadRequest + req := &sppb.ReadRequest{ + Session: sid, + Transaction: ts, + Table: table, + Index: index, + Columns: columns, + KeySet: kset, + } + // generate Partitions + for _, p := range resp.GetPartitions() { + partitions = append(partitions, &Partition{ + pt: p.PartitionToken, + rreq: req, + }) + } + return partitions, err +} + +// PartitionQuery returns a list of Partitions that can be used to execute a query against the database. +func (t *BatchReadOnlyTransaction) PartitionQuery(ctx context.Context, statement Statement, opt PartitionOptions) ([]*Partition, error) { + sh, ts, err := t.acquire(ctx) + if err != nil { + return nil, err + } + sid, client := sh.getID(), sh.getClient() + params, paramTypes, err := statement.convertParams() + if err != nil { + return nil, err + } + + // request Partitions + req := &sppb.PartitionQueryRequest{ + Session: sid, + Transaction: ts, + Sql: statement.SQL, + PartitionOptions: opt.toProto(), + Params: params, + ParamTypes: paramTypes, + } + resp, err := client.PartitionQuery(ctx, req) + + // prepare ExecuteSqlRequest + r := &sppb.ExecuteSqlRequest{ + Session: sid, + Transaction: ts, + Sql: statement.SQL, + Params: params, + ParamTypes: paramTypes, + } + + // generate Partitions + var partitions []*Partition + for _, p := range resp.GetPartitions() { + partitions = append(partitions, &Partition{ + pt: p.PartitionToken, + qreq: r, + }) + } + return partitions, err +} + +// release implements txReadEnv.release, noop. +func (t *BatchReadOnlyTransaction) release(err error) { +} + +// setTimestamp implements txReadEnv.setTimestamp, noop. +// read timestamp is ready on txn initialization, avoid contending writing to it with future partitions. +func (t *BatchReadOnlyTransaction) setTimestamp(ts time.Time) { +} + +// Close marks the txn as closed. +func (t *BatchReadOnlyTransaction) Close() { + t.mu.Lock() + defer t.mu.Unlock() + t.state = txClosed +} + +// Cleanup cleans up all the resources used by this transaction and makes +// it unusable. Once this method is invoked, the transaction is no longer +// usable anywhere, including other clients/processes with which this +// transaction was shared. +// +// Calling Cleanup is optional, but recommended. If Cleanup is not called, the +// transaction's resources will be freed when the session expires on the backend and +// is deleted. For more information about recycled sessions, see +// https://cloud.google.com/spanner/docs/sessions. +func (t *BatchReadOnlyTransaction) Cleanup(ctx context.Context) { + t.Close() + t.mu.Lock() + defer t.mu.Unlock() + sh := t.sh + if sh == nil { + return + } + t.sh = nil + sid, client := sh.getID(), sh.getClient() + err := runRetryable(ctx, func(ctx context.Context) error { + _, e := client.DeleteSession(ctx, &sppb.DeleteSessionRequest{Name: sid}) + return e + }) + if err != nil { + log.Printf("Failed to delete session %v. Error: %v", sid, err) + } +} + +// Execute runs a single Partition obtained from PartitionRead or PartitionQuery. +func (t *BatchReadOnlyTransaction) Execute(ctx context.Context, p *Partition) *RowIterator { + var ( + sh *sessionHandle + err error + rpc func(ct context.Context, resumeToken []byte) (streamingReceiver, error) + ) + if sh, _, err = t.acquire(ctx); err != nil { + return &RowIterator{err: err} + } + client := sh.getClient() + if client == nil { + // Might happen if transaction is closed in the middle of a API call. + return &RowIterator{err: errSessionClosed(sh)} + } + // read or query partition + if p.rreq != nil { + p.rreq.PartitionToken = p.pt + rpc = func(ctx context.Context, resumeToken []byte) (streamingReceiver, error) { + p.rreq.ResumeToken = resumeToken + return client.StreamingRead(ctx, p.rreq) + } + } else { + p.qreq.PartitionToken = p.pt + rpc = func(ctx context.Context, resumeToken []byte) (streamingReceiver, error) { + p.qreq.ResumeToken = resumeToken + return client.ExecuteStreamingSql(ctx, p.qreq) + } + } + return stream( + contextWithOutgoingMetadata(ctx, sh.getMetadata()), + rpc, + t.setTimestamp, + t.release) +} + +// MarshalBinary implements BinaryMarshaler. +func (tid BatchReadOnlyTransactionID) MarshalBinary() (data []byte, err error) { + var buf bytes.Buffer + enc := gob.NewEncoder(&buf) + if err := enc.Encode(tid.tid); err != nil { + return nil, err + } + if err := enc.Encode(tid.sid); err != nil { + return nil, err + } + if err := enc.Encode(tid.rts); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +// UnmarshalBinary implements BinaryUnmarshaler. +func (tid *BatchReadOnlyTransactionID) UnmarshalBinary(data []byte) error { + dec := gob.NewDecoder(bytes.NewReader(data)) + if err := dec.Decode(&tid.tid); err != nil { + return err + } + if err := dec.Decode(&tid.sid); err != nil { + return err + } + return dec.Decode(&tid.rts) +} + +// MarshalBinary implements BinaryMarshaler. +func (p Partition) MarshalBinary() (data []byte, err error) { + var buf bytes.Buffer + enc := gob.NewEncoder(&buf) + if err := enc.Encode(p.pt); err != nil { + return nil, err + } + var isReadPartition bool + var req proto.Message + if p.rreq != nil { + isReadPartition = true + req = p.rreq + } else { + isReadPartition = false + req = p.qreq + } + if err := enc.Encode(isReadPartition); err != nil { + return nil, err + } + if data, err = proto.Marshal(req); err != nil { + return nil, err + } + if err := enc.Encode(data); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +// UnmarshalBinary implements BinaryUnmarshaler. +func (p *Partition) UnmarshalBinary(data []byte) error { + var ( + isReadPartition bool + d []byte + err error + ) + dec := gob.NewDecoder(bytes.NewReader(data)) + if err := dec.Decode(&p.pt); err != nil { + return err + } + if err := dec.Decode(&isReadPartition); err != nil { + return err + } + if err := dec.Decode(&d); err != nil { + return err + } + if isReadPartition { + p.rreq = &sppb.ReadRequest{} + err = proto.Unmarshal(d, p.rreq) + } else { + p.qreq = &sppb.ExecuteSqlRequest{} + err = proto.Unmarshal(d, p.qreq) + } + return err +} diff --git a/vendor/cloud.google.com/go/spanner/batch_test.go b/vendor/cloud.google.com/go/spanner/batch_test.go new file mode 100644 index 000000000..fbae25cb8 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/batch_test.go @@ -0,0 +1,73 @@ +/* +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. +*/ + +package spanner + +import ( + "testing" + "time" + + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +func TestPartitionRoundTrip(t *testing.T) { + t.Parallel() + for i, want := range []Partition{ + {rreq: &sppb.ReadRequest{Table: "t"}}, + {qreq: &sppb.ExecuteSqlRequest{Sql: "sql"}}, + } { + got := serdesPartition(t, i, &want) + if !testEqual(got, want) { + t.Errorf("got: %#v\nwant:%#v", got, want) + } + } +} + +func TestBROTIDRoundTrip(t *testing.T) { + t.Parallel() + tm := time.Now() + want := BatchReadOnlyTransactionID{ + tid: []byte("tid"), + sid: "sid", + rts: tm, + } + data, err := want.MarshalBinary() + if err != nil { + t.Fatal(err) + } + var got BatchReadOnlyTransactionID + if err := got.UnmarshalBinary(data); err != nil { + t.Fatal(err) + } + if !testEqual(got, want) { + t.Errorf("got: %#v\nwant:%#v", got, want) + } +} + +// serdesPartition is a helper that serialize a Partition then deserialize it +func serdesPartition(t *testing.T, i int, p1 *Partition) (p2 Partition) { + var ( + data []byte + err error + ) + if data, err = p1.MarshalBinary(); err != nil { + t.Fatalf("#%d: encoding failed %v", i, err) + } + if err = p2.UnmarshalBinary(data); err != nil { + t.Fatalf("#%d: decoding failed %v", i, err) + } + return p2 +} diff --git a/vendor/cloud.google.com/go/spanner/big_pdml_test.go b/vendor/cloud.google.com/go/spanner/big_pdml_test.go new file mode 100644 index 000000000..262ededdc --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/big_pdml_test.go @@ -0,0 +1,60 @@ +// 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. + +// +build bigtest + +// An integration test for PDML using a relatively large database. + +package spanner + +import ( + "context" + "fmt" + "testing" +) + +func TestBigPDML(t *testing.T) { + const nRows int = 1e4 + + ctx := context.Background() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + columns := []string{"SingerId", "FirstName", "LastName"} + + // Populate the Singers table with random data. + const rowsPerApply = 1000 + for i := 0; i < nRows; i += rowsPerApply { + var muts []*Mutation + for j := 0; j < rowsPerApply; j++ { + id := i + j + row := []interface{}{id, fmt.Sprintf("FirstName%d", id), fmt.Sprintf("LastName%d", id)} + muts = append(muts, Insert("Singers", columns, row)) + } + if _, err := client.Apply(ctx, muts); err != nil { + t.Fatal(err) + } + } + + // Run a PDML statement. + count, err := client.PartitionedUpdate(ctx, Statement{ + SQL: `UPDATE Singers SET Singers.FirstName = "changed" WHERE Singers.SingerId != -1`, + }) + if err != nil { + t.Fatal(err) + } + if want := int64(nRows); count != want { + t.Errorf("got %d, want %d", count, want) + } +} diff --git a/vendor/cloud.google.com/go/spanner/client.go b/vendor/cloud.google.com/go/spanner/client.go new file mode 100644 index 000000000..44ffbac0d --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/client.go @@ -0,0 +1,443 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "fmt" + "regexp" + "sync/atomic" + "time" + + "cloud.google.com/go/internal/version" + "google.golang.org/api/option" + gtransport "google.golang.org/api/transport/grpc" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +const ( + endpoint = "spanner.googleapis.com:443" + + // resourcePrefixHeader is the name of the metadata header used to indicate + // the resource being operated on. + resourcePrefixHeader = "google-cloud-resource-prefix" + // xGoogHeaderKey is the name of the metadata header used to indicate client + // information. + xGoogHeaderKey = "x-goog-api-client" +) + +const ( + // Scope is the scope for Cloud Spanner Data API. + Scope = "https://www.googleapis.com/auth/spanner.data" + + // AdminScope is the scope for Cloud Spanner Admin APIs. + AdminScope = "https://www.googleapis.com/auth/spanner.admin" +) + +var ( + validDBPattern = regexp.MustCompile("^projects/[^/]+/instances/[^/]+/databases/[^/]+$") + xGoogHeaderVal = fmt.Sprintf("gl-go/%s gccl/%s grpc/%s", version.Go(), version.Repo, grpc.Version) +) + +func validDatabaseName(db string) error { + if matched := validDBPattern.MatchString(db); !matched { + return fmt.Errorf("database name %q should conform to pattern %q", + db, validDBPattern.String()) + } + return nil +} + +// Client is a client for reading and writing data to a Cloud Spanner database. A +// client is safe to use concurrently, except for its Close method. +type Client struct { + // rr must be accessed through atomic operations. + rr uint32 + // TODO(deklerk): we should not keep multiple ClientConns / SpannerClients. Instead, we should + // have a single ClientConn that has many connections: https://github.com/googleapis/google-api-go-client/blob/003c13302b3ea5ae44344459ba080364bd46155f/internal/pool.go + conns []*grpc.ClientConn + clients []sppb.SpannerClient + + database string + // Metadata to be sent with each request. + md metadata.MD + idleSessions *sessionPool + // sessionLabels for the sessions created by this client. + sessionLabels map[string]string +} + +// ClientConfig has configurations for the client. +type ClientConfig struct { + // NumChannels is the number of gRPC channels. + // If zero, a reasonable default is used based on the execution environment. + NumChannels int + co []option.ClientOption + // SessionPoolConfig is the configuration for session pool. + SessionPoolConfig + // SessionLabels for the sessions created by this client. + // See https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#session for more info. + SessionLabels map[string]string +} + +// errDial returns error for dialing to Cloud Spanner. +func errDial(ci int, err error) error { + e := toSpannerError(err).(*Error) + e.decorate(fmt.Sprintf("dialing fails for channel[%v]", ci)) + return e +} + +func contextWithOutgoingMetadata(ctx context.Context, md metadata.MD) context.Context { + existing, ok := metadata.FromOutgoingContext(ctx) + if ok { + md = metadata.Join(existing, md) + } + return metadata.NewOutgoingContext(ctx, md) +} + +// NewClient creates a client to a database. A valid database name has the +// form projects/PROJECT_ID/instances/INSTANCE_ID/databases/DATABASE_ID. It uses a default +// configuration. +func NewClient(ctx context.Context, database string, opts ...option.ClientOption) (*Client, error) { + return NewClientWithConfig(ctx, database, ClientConfig{}, opts...) +} + +// NewClientWithConfig creates a client to a database. A valid database name has the +// form projects/PROJECT_ID/instances/INSTANCE_ID/databases/DATABASE_ID. +func NewClientWithConfig(ctx context.Context, database string, config ClientConfig, opts ...option.ClientOption) (c *Client, err error) { + ctx = traceStartSpan(ctx, "cloud.google.com/go/spanner.NewClient") + defer func() { traceEndSpan(ctx, err) }() + + // Validate database path. + if err := validDatabaseName(database); err != nil { + return nil, err + } + c = &Client{ + database: database, + md: metadata.Pairs( + resourcePrefixHeader, database, + xGoogHeaderKey, xGoogHeaderVal), + } + // Make a copy of labels. + c.sessionLabels = make(map[string]string) + for k, v := range config.SessionLabels { + c.sessionLabels[k] = v + } + // gRPC options + allOpts := []option.ClientOption{ + option.WithEndpoint(endpoint), + option.WithScopes(Scope), + option.WithGRPCDialOption( + grpc.WithDefaultCallOptions( + grpc.MaxCallSendMsgSize(100<<20), + grpc.MaxCallRecvMsgSize(100<<20), + ), + ), + } + allOpts = append(allOpts, opts...) + // Prepare gRPC channels. + if config.NumChannels == 0 { + config.NumChannels = numChannels + } + // Default configs for session pool. + if config.MaxOpened == 0 { + config.MaxOpened = uint64(config.NumChannels * 100) + } + if config.MaxBurst == 0 { + config.MaxBurst = 10 + } + // TODO(deklerk) This should be replaced with a balancer with config.NumChannels + // connections, instead of config.NumChannels clientconns. + for i := 0; i < config.NumChannels; i++ { + conn, err := gtransport.Dial(ctx, allOpts...) + if err != nil { + return nil, errDial(i, err) + } + c.conns = append(c.conns, conn) + c.clients = append(c.clients, sppb.NewSpannerClient(conn)) + } + // Prepare session pool. + config.SessionPoolConfig.getRPCClient = func() (sppb.SpannerClient, error) { + // TODO: support more loadbalancing options. + return c.rrNext(), nil + } + config.SessionPoolConfig.sessionLabels = c.sessionLabels + sp, err := newSessionPool(database, config.SessionPoolConfig, c.md) + if err != nil { + c.Close() + return nil, err + } + c.idleSessions = sp + return c, nil +} + +// rrNext returns the next available Cloud Spanner RPC client in a round-robin manner. +func (c *Client) rrNext() sppb.SpannerClient { + return c.clients[atomic.AddUint32(&c.rr, 1)%uint32(len(c.clients))] +} + +// Close closes the client. +func (c *Client) Close() { + if c.idleSessions != nil { + c.idleSessions.close() + } + for _, conn := range c.conns { + conn.Close() + } +} + +// Single provides a read-only snapshot transaction optimized for the case +// where only a single read or query is needed. This is more efficient than +// using ReadOnlyTransaction() for a single read or query. +// +// Single will use a strong TimestampBound by default. Use +// ReadOnlyTransaction.WithTimestampBound to specify a different +// TimestampBound. A non-strong bound can be used to reduce latency, or +// "time-travel" to prior versions of the database, see the documentation of +// TimestampBound for details. +func (c *Client) Single() *ReadOnlyTransaction { + t := &ReadOnlyTransaction{singleUse: true, sp: c.idleSessions} + t.txReadOnly.txReadEnv = t + return t +} + +// ReadOnlyTransaction returns a ReadOnlyTransaction that can be used for +// multiple reads from the database. You must call Close() when the +// ReadOnlyTransaction is no longer needed to release resources on the server. +// +// ReadOnlyTransaction will use a strong TimestampBound by default. Use +// ReadOnlyTransaction.WithTimestampBound to specify a different +// TimestampBound. A non-strong bound can be used to reduce latency, or +// "time-travel" to prior versions of the database, see the documentation of +// TimestampBound for details. +func (c *Client) ReadOnlyTransaction() *ReadOnlyTransaction { + t := &ReadOnlyTransaction{ + singleUse: false, + sp: c.idleSessions, + txReadyOrClosed: make(chan struct{}), + } + t.txReadOnly.txReadEnv = t + return t +} + +// BatchReadOnlyTransaction returns a BatchReadOnlyTransaction that can be used +// for partitioned reads or queries from a snapshot of the database. This is +// useful in batch processing pipelines where one wants to divide the work of +// reading from the database across multiple machines. +// +// Note: This transaction does not use the underlying session pool but creates a +// new session each time, and the session is reused across clients. +// +// You should call Close() after the txn is no longer needed on local +// client, and call Cleanup() when the txn is finished for all clients, to free +// the session. +func (c *Client) BatchReadOnlyTransaction(ctx context.Context, tb TimestampBound) (*BatchReadOnlyTransaction, error) { + var ( + tx transactionID + rts time.Time + s *session + sh *sessionHandle + err error + ) + defer func() { + if err != nil && sh != nil { + s.delete(ctx) + } + }() + // create session + sc := c.rrNext() + s, err = createSession(ctx, sc, c.database, c.sessionLabels, c.md) + if err != nil { + return nil, err + } + sh = &sessionHandle{session: s} + // begin transaction + err = runRetryable(contextWithOutgoingMetadata(ctx, sh.getMetadata()), func(ctx context.Context) error { + res, e := sh.getClient().BeginTransaction(ctx, &sppb.BeginTransactionRequest{ + Session: sh.getID(), + Options: &sppb.TransactionOptions{ + Mode: &sppb.TransactionOptions_ReadOnly_{ + ReadOnly: buildTransactionOptionsReadOnly(tb, true), + }, + }, + }) + if e != nil { + return e + } + tx = res.Id + if res.ReadTimestamp != nil { + rts = time.Unix(res.ReadTimestamp.Seconds, int64(res.ReadTimestamp.Nanos)) + } + return nil + }) + if err != nil { + return nil, err + } + + t := &BatchReadOnlyTransaction{ + ReadOnlyTransaction: ReadOnlyTransaction{ + tx: tx, + txReadyOrClosed: make(chan struct{}), + state: txActive, + sh: sh, + rts: rts, + }, + ID: BatchReadOnlyTransactionID{ + tid: tx, + sid: sh.getID(), + rts: rts, + }, + } + t.txReadOnly.txReadEnv = t + return t, nil +} + +// BatchReadOnlyTransactionFromID reconstruct a BatchReadOnlyTransaction from BatchReadOnlyTransactionID +func (c *Client) BatchReadOnlyTransactionFromID(tid BatchReadOnlyTransactionID) *BatchReadOnlyTransaction { + sc := c.rrNext() + s := &session{valid: true, client: sc, id: tid.sid, createTime: time.Now(), md: c.md} + sh := &sessionHandle{session: s} + + t := &BatchReadOnlyTransaction{ + ReadOnlyTransaction: ReadOnlyTransaction{ + tx: tid.tid, + txReadyOrClosed: make(chan struct{}), + state: txActive, + sh: sh, + rts: tid.rts, + }, + ID: tid, + } + t.txReadOnly.txReadEnv = t + return t +} + +type transactionInProgressKey struct{} + +func checkNestedTxn(ctx context.Context) error { + if ctx.Value(transactionInProgressKey{}) != nil { + return spannerErrorf(codes.FailedPrecondition, "Cloud Spanner does not support nested transactions") + } + return nil +} + +// ReadWriteTransaction executes a read-write transaction, with retries as +// necessary. +// +// The function f will be called one or more times. It must not maintain +// any state between calls. +// +// If the transaction cannot be committed or if f returns an IsAborted error, +// ReadWriteTransaction will call f again. It will continue to call f until the +// transaction can be committed or the Context times out or is cancelled. If f +// returns an error other than IsAborted, ReadWriteTransaction will abort the +// transaction and return the error. +// +// To limit the number of retries, set a deadline on the Context rather than +// using a fixed limit on the number of attempts. ReadWriteTransaction will +// retry as needed until that deadline is met. +func (c *Client) ReadWriteTransaction(ctx context.Context, f func(context.Context, *ReadWriteTransaction) error) (commitTimestamp time.Time, err error) { + ctx = traceStartSpan(ctx, "cloud.google.com/go/spanner.ReadWriteTransaction") + defer func() { traceEndSpan(ctx, err) }() + if err := checkNestedTxn(ctx); err != nil { + return time.Time{}, err + } + var ( + ts time.Time + sh *sessionHandle + ) + err = runRetryableNoWrap(ctx, func(ctx context.Context) error { + var ( + err error + t *ReadWriteTransaction + ) + if sh == nil || sh.getID() == "" || sh.getClient() == nil { + // Session handle hasn't been allocated or has been destroyed. + sh, err = c.idleSessions.takeWriteSession(ctx) + if err != nil { + // If session retrieval fails, just fail the transaction. + return err + } + t = &ReadWriteTransaction{ + sh: sh, + tx: sh.getTransactionID(), + } + } else { + t = &ReadWriteTransaction{ + sh: sh, + } + } + t.txReadOnly.txReadEnv = t + tracePrintf(ctx, map[string]interface{}{"transactionID": string(sh.getTransactionID())}, + "Starting transaction attempt") + if err = t.begin(ctx); err != nil { + // Mask error from begin operation as retryable error. + return errRetry(err) + } + ts, err = t.runInTransaction(ctx, f) + return err + }) + if sh != nil { + sh.recycle() + } + return ts, err +} + +// applyOption controls the behavior of Client.Apply. +type applyOption struct { + // If atLeastOnce == true, Client.Apply will execute the mutations on Cloud Spanner at least once. + atLeastOnce bool +} + +// An ApplyOption is an optional argument to Apply. +type ApplyOption func(*applyOption) + +// ApplyAtLeastOnce returns an ApplyOption that removes replay protection. +// +// With this option, Apply may attempt to apply mutations more than once; if +// the mutations are not idempotent, this may lead to a failure being reported +// when the mutation was applied more than once. For example, an insert may +// fail with ALREADY_EXISTS even though the row did not exist before Apply was +// called. For this reason, most users of the library will prefer not to use +// this option. However, ApplyAtLeastOnce requires only a single RPC, whereas +// Apply's default replay protection may require an additional RPC. So this +// option may be appropriate for latency sensitive and/or high throughput blind +// writing. +func ApplyAtLeastOnce() ApplyOption { + return func(ao *applyOption) { + ao.atLeastOnce = true + } +} + +// Apply applies a list of mutations atomically to the database. +func (c *Client) Apply(ctx context.Context, ms []*Mutation, opts ...ApplyOption) (commitTimestamp time.Time, err error) { + ao := &applyOption{} + for _, opt := range opts { + opt(ao) + } + if !ao.atLeastOnce { + return c.ReadWriteTransaction(ctx, func(ctx context.Context, t *ReadWriteTransaction) error { + return t.BufferWrite(ms) + }) + } + + ctx = traceStartSpan(ctx, "cloud.google.com/go/spanner.Apply") + defer func() { traceEndSpan(ctx, err) }() + t := &writeOnlyTransaction{c.idleSessions} + return t.applyAtLeastOnce(ctx, ms...) +} diff --git a/vendor/cloud.google.com/go/spanner/client_test.go b/vendor/cloud.google.com/go/spanner/client_test.go new file mode 100644 index 000000000..54c52631f --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/client_test.go @@ -0,0 +1,50 @@ +/* +Copyright 2017 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 spanner + +import ( + "strings" + "testing" +) + +// Test validDatabaseName() +func TestValidDatabaseName(t *testing.T) { + validDbURI := "projects/spanner-cloud-test/instances/foo/databases/foodb" + invalidDbUris := []string{ + // Completely wrong DB URI. + "foobarDB", + // Project ID contains "/". + "projects/spanner-cloud/test/instances/foo/databases/foodb", + // No instance ID. + "projects/spanner-cloud-test/instances//databases/foodb", + } + if err := validDatabaseName(validDbURI); err != nil { + t.Errorf("validateDatabaseName(%q) = %v, want nil", validDbURI, err) + } + for _, d := range invalidDbUris { + if err, wantErr := validDatabaseName(d), "should conform to pattern"; !strings.Contains(err.Error(), wantErr) { + t.Errorf("validateDatabaseName(%q) = %q, want error pattern %q", validDbURI, err, wantErr) + } + } +} + +func TestReadOnlyTransactionClose(t *testing.T) { + // Closing a ReadOnlyTransaction shouldn't panic. + c := &Client{} + tx := c.ReadOnlyTransaction() + tx.Close() +} diff --git a/vendor/cloud.google.com/go/spanner/doc.go b/vendor/cloud.google.com/go/spanner/doc.go new file mode 100644 index 000000000..4954082e8 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/doc.go @@ -0,0 +1,328 @@ +/* +Copyright 2017 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 spanner provides a client for reading and writing to Cloud Spanner +databases. See the packages under admin for clients that operate on databases +and instances. + +Note: This package is in beta. Some backwards-incompatible changes may occur. + +See https://cloud.google.com/spanner/docs/getting-started/go/ for an introduction +to Cloud Spanner and additional help on using this API. + +See https://godoc.org/cloud.google.com/go for authentication, timeouts, +connection pooling and similar aspects of this package. + + +Creating a Client + +To start working with this package, create a client that refers to the database +of interest: + + ctx := context.Background() + client, err := spanner.NewClient(ctx, "projects/P/instances/I/databases/D") + if err != nil { + // TODO: Handle error. + } + defer client.Close() + +Remember to close the client after use to free up the sessions in the session +pool. + + +Simple Reads and Writes + +Two Client methods, Apply and Single, work well for simple reads and writes. As +a quick introduction, here we write a new row to the database and read it back: + + _, err := client.Apply(ctx, []*spanner.Mutation{ + spanner.Insert("Users", + []string{"name", "email"}, + []interface{}{"alice", "a@example.com"})}) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Users", + spanner.Key{"alice"}, []string{"email"}) + if err != nil { + // TODO: Handle error. + } + +All the methods used above are discussed in more detail below. + + +Keys + +Every Cloud Spanner row has a unique key, composed of one or more columns. +Construct keys with a literal of type Key: + + key1 := spanner.Key{"alice"} + + +KeyRanges + +The keys of a Cloud Spanner table are ordered. You can specify ranges of keys +using the KeyRange type: + + kr1 := spanner.KeyRange{Start: key1, End: key2} + +By default, a KeyRange includes its start key but not its end key. Use +the Kind field to specify other boundary conditions: + + // include both keys + kr2 := spanner.KeyRange{Start: key1, End: key2, Kind: spanner.ClosedClosed} + + +KeySets + +A KeySet represents a set of keys. A single Key or KeyRange can act as a KeySet. Use +the KeySets function to build the union of several KeySets: + + ks1 := spanner.KeySets(key1, key2, kr1, kr2) + +AllKeys returns a KeySet that refers to all the keys in a table: + + ks2 := spanner.AllKeys() + + +Transactions + +All Cloud Spanner reads and writes occur inside transactions. There are two +types of transactions, read-only and read-write. Read-only transactions cannot +change the database, do not acquire locks, and may access either the current +database state or states in the past. Read-write transactions can read the +database before writing to it, and always apply to the most recent database +state. + + +Single Reads + +The simplest and fastest transaction is a ReadOnlyTransaction that supports a +single read operation. Use Client.Single to create such a transaction. You can +chain the call to Single with a call to a Read method. + +When you only want one row whose key you know, use ReadRow. Provide the table +name, key, and the columns you want to read: + + row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) + +Read multiple rows with the Read method. It takes a table name, KeySet, and list +of columns: + + iter := client.Single().Read(ctx, "Accounts", keyset1, columns) + +Read returns a RowIterator. You can call the Do method on the iterator and pass +a callback: + + err := iter.Do(func(row *Row) error { + // TODO: use row + return nil + }) + +RowIterator also follows the standard pattern for the Google +Cloud Client Libraries: + + defer iter.Stop() + for { + row, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: use row + } + +Always call Stop when you finish using an iterator this way, whether or not you +iterate to the end. (Failing to call Stop could lead you to exhaust the +database's session quota.) + +To read rows with an index, use ReadUsingIndex. + +Statements + +The most general form of reading uses SQL statements. Construct a Statement +with NewStatement, setting any parameters using the Statement's Params map: + + stmt := spanner.NewStatement("SELECT First, Last FROM SINGERS WHERE Last >= @start") + stmt.Params["start"] = "Dylan" + +You can also construct a Statement directly with a struct literal, providing +your own map of parameters. + +Use the Query method to run the statement and obtain an iterator: + + iter := client.Single().Query(ctx, stmt) + + +Rows + +Once you have a Row, via an iterator or a call to ReadRow, you can extract +column values in several ways. Pass in a pointer to a Go variable of the +appropriate type when you extract a value. + +You can extract by column position or name: + + err := row.Column(0, &name) + err = row.ColumnByName("balance", &balance) + +You can extract all the columns at once: + + err = row.Columns(&name, &balance) + +Or you can define a Go struct that corresponds to your columns, and extract +into that: + + var s struct { Name string; Balance int64 } + err = row.ToStruct(&s) + + +For Cloud Spanner columns that may contain NULL, use one of the NullXXX types, +like NullString: + + var ns spanner.NullString + if err := row.Column(0, &ns); err != nil { + // TODO: Handle error. + } + if ns.Valid { + fmt.Println(ns.StringVal) + } else { + fmt.Println("column is NULL") + } + + +Multiple Reads + +To perform more than one read in a transaction, use ReadOnlyTransaction: + + txn := client.ReadOnlyTransaction() + defer txn.Close() + iter := txn.Query(ctx, stmt1) + // ... + iter = txn.Query(ctx, stmt2) + // ... + +You must call Close when you are done with the transaction. + + +Timestamps and Timestamp Bounds + +Cloud Spanner read-only transactions conceptually perform all their reads at a +single moment in time, called the transaction's read timestamp. Once a read has +started, you can call ReadOnlyTransaction's Timestamp method to obtain the read +timestamp. + +By default, a transaction will pick the most recent time (a time where all +previously committed transactions are visible) for its reads. This provides the +freshest data, but may involve some delay. You can often get a quicker response +if you are willing to tolerate "stale" data. You can control the read timestamp +selected by a transaction by calling the WithTimestampBound method on the +transaction before using it. For example, to perform a query on data that is at +most one minute stale, use + + client.Single(). + WithTimestampBound(spanner.MaxStaleness(1*time.Minute)). + Query(ctx, stmt) + +See the documentation of TimestampBound for more details. + + +Mutations + +To write values to a Cloud Spanner database, construct a Mutation. The spanner +package has functions for inserting, updating and deleting rows. Except for the +Delete methods, which take a Key or KeyRange, each mutation-building function +comes in three varieties. + +One takes lists of columns and values along with the table name: + + m1 := spanner.Insert("Users", + []string{"name", "email"}, + []interface{}{"alice", "a@example.com"}) + +One takes a map from column names to values: + + m2 := spanner.InsertMap("Users", map[string]interface{}{ + "name": "alice", + "email": "a@example.com", + }) + +And the third accepts a struct value, and determines the columns from the +struct field names: + + type User struct { Name, Email string } + u := User{Name: "alice", Email: "a@example.com"} + m3, err := spanner.InsertStruct("Users", u) + + +Writes + +To apply a list of mutations to the database, use Apply: + + _, err := client.Apply(ctx, []*spanner.Mutation{m1, m2, m3}) + +If you need to read before writing in a single transaction, use a +ReadWriteTransaction. ReadWriteTransactions may abort and need to be retried. +You pass in a function to ReadWriteTransaction, and the client will handle the +retries automatically. Use the transaction's BufferWrite method to buffer +mutations, which will all be executed at the end of the transaction: + + _, err := client.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error { + var balance int64 + row, err := txn.ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) + if err != nil { + // This function will be called again if this is an IsAborted error. + return err + } + if err := row.Column(0, &balance); err != nil { + return err + } + + if balance <= 10 { + return errors.New("insufficient funds in account") + } + balance -= 10 + m := spanner.Update("Accounts", []string{"user", "balance"}, []interface{}{"alice", balance}) + txn.BufferWrite([]*spanner.Mutation{m}) + + // The buffered mutation will be committed. If the commit + // fails with an IsAborted error, this function will be called + // again. + return nil + }) + + +DML and Partitioned DML + +Spanner supports DML statements like INSERT, UPDATE and DELETE. Use +ReadWriteTransaction.Update to run DML statements. It returns the number of rows +affected. (You can call use ReadWriteTransaction.Query with a DML statement. The first +call to Next on the resulting RowIterator will return iterator.Done, and the RowCount +field of the iterator will hold the number of affected rows.) + +For large databases, it may be more efficient to partition the DML statement. Use +client.PartitionedUpdate to run a DML statement in this way. Not all DML statements +can be partitioned. + +Tracing + +This client has been instrumented to use OpenCensus tracing (http://opencensus.io). +To enable tracing, see "Enabling Tracing for a Program" at +https://godoc.org/go.opencensus.io/trace. OpenCensus tracing requires Go 1.8 or higher. +*/ +package spanner // import "cloud.google.com/go/spanner" diff --git a/vendor/cloud.google.com/go/spanner/errors.go b/vendor/cloud.google.com/go/spanner/errors.go new file mode 100644 index 000000000..fb58ae081 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/errors.go @@ -0,0 +1,115 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "fmt" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// Error is the structured error returned by Cloud Spanner client. +type Error struct { + // Code is the canonical error code for describing the nature of a + // particular error. + Code codes.Code + // Desc explains more details of the error. + Desc string + // trailers are the trailers returned in the response, if any. + trailers metadata.MD +} + +// Error implements error.Error. +func (e *Error) Error() string { + if e == nil { + return fmt.Sprintf("spanner: OK") + } + return fmt.Sprintf("spanner: code = %q, desc = %q", e.Code, e.Desc) +} + +// decorate decorates an existing spanner.Error with more information. +func (e *Error) decorate(info string) { + e.Desc = fmt.Sprintf("%v, %v", info, e.Desc) +} + +// spannerErrorf generates a *spanner.Error with the given error code and +// description. +func spannerErrorf(ec codes.Code, format string, args ...interface{}) error { + return &Error{ + Code: ec, + Desc: fmt.Sprintf(format, args...), + } +} + +// toSpannerError converts general Go error to *spanner.Error. +func toSpannerError(err error) error { + return toSpannerErrorWithMetadata(err, nil) +} + +// toSpannerErrorWithMetadata converts general Go error and grpc trailers to *spanner.Error. +// Note: modifies original error if trailers aren't nil +func toSpannerErrorWithMetadata(err error, trailers metadata.MD) error { + if err == nil { + return nil + } + if se, ok := err.(*Error); ok { + if trailers != nil { + se.trailers = metadata.Join(se.trailers, trailers) + } + return se + } + switch { + case err == context.DeadlineExceeded: + return &Error{codes.DeadlineExceeded, err.Error(), trailers} + case err == context.Canceled: + return &Error{codes.Canceled, err.Error(), trailers} + case grpc.Code(err) == codes.Unknown: + return &Error{codes.Unknown, err.Error(), trailers} + default: + return &Error{grpc.Code(err), grpc.ErrorDesc(err), trailers} + } +} + +// ErrCode extracts the canonical error code from a Go error. +func ErrCode(err error) codes.Code { + se, ok := toSpannerError(err).(*Error) + if !ok { + return codes.Unknown + } + return se.Code +} + +// ErrDesc extracts the Cloud Spanner error description from a Go error. +func ErrDesc(err error) string { + se, ok := toSpannerError(err).(*Error) + if !ok { + return err.Error() + } + return se.Desc +} + +// errTrailers extracts the grpc trailers if present from a Go error. +func errTrailers(err error) metadata.MD { + se, ok := err.(*Error) + if !ok { + return nil + } + return se.trailers +} diff --git a/vendor/cloud.google.com/go/spanner/errors_test.go b/vendor/cloud.google.com/go/spanner/errors_test.go new file mode 100644 index 000000000..9dd7f7f01 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/errors_test.go @@ -0,0 +1,44 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "errors" + "testing" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestToSpannerError(t *testing.T) { + for _, test := range []struct { + err error + wantCode codes.Code + }{ + {errors.New("wha?"), codes.Unknown}, + {context.Canceled, codes.Canceled}, + {context.DeadlineExceeded, codes.DeadlineExceeded}, + {status.Errorf(codes.ResourceExhausted, "so tired"), codes.ResourceExhausted}, + {spannerErrorf(codes.InvalidArgument, "bad"), codes.InvalidArgument}, + } { + err := toSpannerError(test.err) + if got, want := err.(*Error).Code, test.wantCode; got != want { + t.Errorf("%v: got %s, want %s", test.err, got, want) + } + } +} diff --git a/vendor/cloud.google.com/go/spanner/examples_test.go b/vendor/cloud.google.com/go/spanner/examples_test.go new file mode 100644 index 000000000..e8bb1bb75 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/examples_test.go @@ -0,0 +1,668 @@ +/* +Copyright 2017 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 spanner_test + +import ( + "context" + "errors" + "fmt" + "sync" + "time" + + "cloud.google.com/go/spanner" + "google.golang.org/api/iterator" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + const myDB = "projects/my-project/instances/my-instance/database/my-db" + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + _ = client // TODO: Use client. +} + +const myDB = "projects/my-project/instances/my-instance/database/my-db" + +func ExampleNewClientWithConfig() { + ctx := context.Background() + const myDB = "projects/my-project/instances/my-instance/database/my-db" + client, err := spanner.NewClientWithConfig(ctx, myDB, spanner.ClientConfig{ + NumChannels: 10, + }) + if err != nil { + // TODO: Handle error. + } + _ = client // TODO: Use client. + client.Close() // Close client when done. +} + +func ExampleClient_Single() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + iter := client.Single().Query(ctx, spanner.NewStatement("SELECT FirstName FROM Singers")) + _ = iter // TODO: iterate using Next or Do. +} + +func ExampleClient_ReadOnlyTransaction() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + t := client.ReadOnlyTransaction() + defer t.Close() + // TODO: Read with t using Read, ReadRow, ReadUsingIndex, or Query. +} + +func ExampleClient_ReadWriteTransaction() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + _, err = client.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error { + var balance int64 + row, err := txn.ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) + if err != nil { + // This function will be called again if this is an + // IsAborted error. + return err + } + if err := row.Column(0, &balance); err != nil { + return err + } + + if balance <= 10 { + return errors.New("insufficient funds in account") + } + balance -= 10 + m := spanner.Update("Accounts", []string{"user", "balance"}, []interface{}{"alice", balance}) + return txn.BufferWrite([]*spanner.Mutation{m}) + // The buffered mutation will be committed. If the commit + // fails with an IsAborted error, this function will be called + // again. + }) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleUpdate() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + _, err = client.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error { + row, err := txn.ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) + if err != nil { + return err + } + var balance int64 + if err := row.Column(0, &balance); err != nil { + return err + } + return txn.BufferWrite([]*spanner.Mutation{ + spanner.Update("Accounts", []string{"user", "balance"}, []interface{}{"alice", balance + 10}), + }) + }) + if err != nil { + // TODO: Handle error. + } +} + +// This example is the same as the one for Update, except for the use of UpdateMap. +func ExampleUpdateMap() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + _, err = client.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error { + row, err := txn.ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) + if err != nil { + return err + } + var balance int64 + if err := row.Column(0, &balance); err != nil { + return err + } + return txn.BufferWrite([]*spanner.Mutation{ + spanner.UpdateMap("Accounts", map[string]interface{}{ + "user": "alice", + "balance": balance + 10, + }), + }) + }) + if err != nil { + // TODO: Handle error. + } +} + +// This example is the same as the one for Update, except for the use of UpdateStruct. +func ExampleUpdateStruct() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + type account struct { + User string `spanner:"user"` + Balance int64 `spanner:"balance"` + } + _, err = client.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error { + row, err := txn.ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) + if err != nil { + return err + } + var balance int64 + if err := row.Column(0, &balance); err != nil { + return err + } + m, err := spanner.UpdateStruct("Accounts", account{ + User: "alice", + Balance: balance + 10, + }) + if err != nil { + return err + } + return txn.BufferWrite([]*spanner.Mutation{m}) + }) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_Apply() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + m := spanner.Update("Users", []string{"name", "email"}, []interface{}{"alice", "a@example.com"}) + _, err = client.Apply(ctx, []*spanner.Mutation{m}) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleInsert() { + m := spanner.Insert("Users", []string{"name", "email"}, []interface{}{"alice", "a@example.com"}) + _ = m // TODO: use with Client.Apply or in a ReadWriteTransaction. +} + +func ExampleInsertMap() { + m := spanner.InsertMap("Users", map[string]interface{}{ + "name": "alice", + "email": "a@example.com", + }) + _ = m // TODO: use with Client.Apply or in a ReadWriteTransaction. +} + +func ExampleInsertStruct() { + type User struct { + Name, Email string + } + u := User{Name: "alice", Email: "a@example.com"} + m, err := spanner.InsertStruct("Users", u) + if err != nil { + // TODO: Handle error. + } + _ = m // TODO: use with Client.Apply or in a ReadWriteTransaction. +} + +func ExampleDelete() { + m := spanner.Delete("Users", spanner.Key{"alice"}) + _ = m // TODO: use with Client.Apply or in a ReadWriteTransaction. +} + +func ExampleDelete_keyRange() { + m := spanner.Delete("Users", spanner.KeyRange{ + Start: spanner.Key{"alice"}, + End: spanner.Key{"bob"}, + Kind: spanner.ClosedClosed, + }) + _ = m // TODO: use with Client.Apply or in a ReadWriteTransaction. +} + +func ExampleRowIterator_Next() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + iter := client.Single().Query(ctx, spanner.NewStatement("SELECT FirstName FROM Singers")) + defer iter.Stop() + for { + row, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + var firstName string + if err := row.Column(0, &firstName); err != nil { + // TODO: Handle error. + } + fmt.Println(firstName) + } +} + +func ExampleRowIterator_Do() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + iter := client.Single().Query(ctx, spanner.NewStatement("SELECT FirstName FROM Singers")) + err = iter.Do(func(r *spanner.Row) error { + var firstName string + if err := r.Column(0, &firstName); err != nil { + return err + } + fmt.Println(firstName) + return nil + }) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleRow_Size() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"name", "balance"}) + if err != nil { + // TODO: Handle error. + } + fmt.Println(row.Size()) // size is 2 +} + +func ExampleRow_ColumnName() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"name", "balance"}) + if err != nil { + // TODO: Handle error. + } + fmt.Println(row.ColumnName(1)) // prints "balance" +} + +func ExampleRow_ColumnIndex() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"name", "balance"}) + if err != nil { + // TODO: Handle error. + } + index, err := row.ColumnIndex("balance") + if err != nil { + // TODO: Handle error. + } + fmt.Println(index) +} + +func ExampleRow_ColumnNames() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"name", "balance"}) + if err != nil { + // TODO: Handle error. + } + fmt.Println(row.ColumnNames()) +} + +func ExampleRow_ColumnByName() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"name", "balance"}) + if err != nil { + // TODO: Handle error. + } + var balance int64 + if err := row.ColumnByName("balance", &balance); err != nil { + // TODO: Handle error. + } + fmt.Println(balance) +} + +func ExampleRow_Columns() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"name", "balance"}) + if err != nil { + // TODO: Handle error. + } + var name string + var balance int64 + if err := row.Columns(&name, &balance); err != nil { + // TODO: Handle error. + } + fmt.Println(name, balance) +} + +func ExampleRow_ToStruct() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"name", "balance"}) + if err != nil { + // TODO: Handle error. + } + + type Account struct { + Name string + Balance int64 + } + + var acct Account + if err := row.ToStruct(&acct); err != nil { + // TODO: Handle error. + } + fmt.Println(acct) +} + +func ExampleReadOnlyTransaction_Read() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + iter := client.Single().Read(ctx, "Users", + spanner.KeySets(spanner.Key{"alice"}, spanner.Key{"bob"}), + []string{"name", "email"}) + _ = iter // TODO: iterate using Next or Do. +} + +func ExampleReadOnlyTransaction_ReadUsingIndex() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + iter := client.Single().ReadUsingIndex(ctx, "Users", + "UsersByEmail", + spanner.KeySets(spanner.Key{"a@example.com"}, spanner.Key{"b@example.com"}), + []string{"name", "email"}) + _ = iter // TODO: iterate using Next or Do. +} + +func ExampleReadOnlyTransaction_ReadWithOptions() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + // Use an index, and limit to 100 rows at most. + iter := client.Single().ReadWithOptions(ctx, "Users", + spanner.KeySets(spanner.Key{"a@example.com"}, spanner.Key{"b@example.com"}), + []string{"name", "email"}, &spanner.ReadOptions{ + Index: "UsersByEmail", + Limit: 100, + }) + _ = iter // TODO: iterate using Next or Do. +} + +func ExampleReadOnlyTransaction_ReadRow() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Users", spanner.Key{"alice"}, + []string{"name", "email"}) + if err != nil { + // TODO: Handle error. + } + _ = row // TODO: use row +} + +func ExampleReadOnlyTransaction_Query() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + iter := client.Single().Query(ctx, spanner.NewStatement("SELECT FirstName FROM Singers")) + _ = iter // TODO: iterate using Next or Do. +} + +func ExampleNewStatement() { + stmt := spanner.NewStatement("SELECT FirstName, LastName FROM SINGERS WHERE LastName >= @start") + stmt.Params["start"] = "Dylan" + // TODO: Use stmt in Query. +} + +func ExampleNewStatement_structLiteral() { + stmt := spanner.Statement{ + SQL: `SELECT FirstName, LastName FROM SINGERS WHERE LastName = ("Lea", "Martin")`, + } + _ = stmt // TODO: Use stmt in Query. +} + +func ExampleStructParam() { + stmt := spanner.Statement{ + SQL: "SELECT * FROM SINGERS WHERE (FirstName, LastName) = @singerinfo", + Params: map[string]interface{}{ + "singerinfo": struct { + FirstName string + LastName string + }{"Bob", "Dylan"}, + }, + } + _ = stmt // TODO: Use stmt in Query. +} + +func ExampleArrayOfStructParam() { + stmt := spanner.Statement{ + SQL: "SELECT * FROM SINGERS WHERE (FirstName, LastName) IN UNNEST(@singerinfo)", + Params: map[string]interface{}{ + "singerinfo": []struct { + FirstName string + LastName string + }{ + {"Ringo", "Starr"}, + {"John", "Lennon"}, + }, + }, + } + _ = stmt // TODO: Use stmt in Query. +} + +func ExampleReadOnlyTransaction_Timestamp() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + txn := client.Single() + row, err := txn.ReadRow(ctx, "Users", spanner.Key{"alice"}, + []string{"name", "email"}) + if err != nil { + // TODO: Handle error. + } + readTimestamp, err := txn.Timestamp() + if err != nil { + // TODO: Handle error. + } + fmt.Println("read happened at", readTimestamp) + _ = row // TODO: use row +} + +func ExampleReadOnlyTransaction_WithTimestampBound() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + txn := client.Single().WithTimestampBound(spanner.MaxStaleness(30 * time.Second)) + row, err := txn.ReadRow(ctx, "Users", spanner.Key{"alice"}, []string{"name", "email"}) + if err != nil { + // TODO: Handle error. + } + _ = row // TODO: use row + readTimestamp, err := txn.Timestamp() + if err != nil { + // TODO: Handle error. + } + fmt.Println("read happened at", readTimestamp) +} + +func ExampleGenericColumnValue_Decode() { + // In real applications, rows can be retrieved by methods like client.Single().ReadRow(). + row, err := spanner.NewRow([]string{"intCol", "strCol"}, []interface{}{42, "my-text"}) + if err != nil { + // TODO: Handle error. + } + for i := 0; i < row.Size(); i++ { + var col spanner.GenericColumnValue + if err := row.Column(i, &col); err != nil { + // TODO: Handle error. + } + switch col.Type.Code { + case sppb.TypeCode_INT64: + var v int64 + if err := col.Decode(&v); err != nil { + // TODO: Handle error. + } + fmt.Println("int", v) + case sppb.TypeCode_STRING: + var v string + if err := col.Decode(&v); err != nil { + // TODO: Handle error. + } + fmt.Println("string", v) + } + } + // Output: + // int 42 + // string my-text +} + +func ExampleClient_BatchReadOnlyTransaction() { + ctx := context.Background() + var ( + client *spanner.Client + txn *spanner.BatchReadOnlyTransaction + err error + ) + if client, err = spanner.NewClient(ctx, myDB); err != nil { + // TODO: Handle error. + } + defer client.Close() + if txn, err = client.BatchReadOnlyTransaction(ctx, spanner.StrongRead()); err != nil { + // TODO: Handle error. + } + defer txn.Close() + + // Singer represents the elements in a row from the Singers table. + type Singer struct { + SingerID int64 + FirstName string + LastName string + SingerInfo []byte + } + stmt := spanner.Statement{SQL: "SELECT * FROM Singers;"} + partitions, err := txn.PartitionQuery(ctx, stmt, spanner.PartitionOptions{}) + if err != nil { + // TODO: Handle error. + } + // Note: here we use multiple goroutines, but you should use separate processes/machines. + wg := sync.WaitGroup{} + for i, p := range partitions { + wg.Add(1) + go func(i int, p *spanner.Partition) { + defer wg.Done() + iter := txn.Execute(ctx, p) + defer iter.Stop() + for { + row, err := iter.Next() + if err == iterator.Done { + break + } else if err != nil { + // TODO: Handle error. + } + var s Singer + if err := row.ToStruct(&s); err != nil { + // TODO: Handle error. + } + _ = s // TODO: Process the row. + } + }(i, p) + } + wg.Wait() +} + +func ExampleCommitTimestamp() { + ctx := context.Background() + client, err := spanner.NewClient(ctx, myDB) + if err != nil { + // TODO: Handle error. + } + + type account struct { + User string + Creation spanner.NullTime // time.Time can also be used if column is NOT NULL + } + + a := account{User: "Joe", Creation: spanner.NullTime{spanner.CommitTimestamp, true}} + m, err := spanner.InsertStruct("Accounts", a) + if err != nil { + // TODO: Handle error. + } + _, err = client.Apply(ctx, []*spanner.Mutation{m}, spanner.ApplyAtLeastOnce()) + if err != nil { + // TODO: Handle error. + } + + if r, e := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"Joe"}, []string{"User", "Creation"}); e != nil { + // TODO: Handle error. + } else { + var got account + if err := r.ToStruct(&got); err != nil { + // TODO: Handle error. + } + _ = got // TODO: Process row. + } +} diff --git a/vendor/cloud.google.com/go/spanner/integration_test.go b/vendor/cloud.google.com/go/spanner/integration_test.go new file mode 100644 index 000000000..694f9e0da --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/integration_test.go @@ -0,0 +1,2142 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "errors" + "flag" + "fmt" + "log" + "math" + "os" + "reflect" + "strings" + "sync" + "testing" + "time" + + "cloud.google.com/go/civil" + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/internal/uid" + database "cloud.google.com/go/spanner/admin/database/apiv1" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + adminpb "google.golang.org/genproto/googleapis/spanner/admin/database/v1" + "google.golang.org/grpc/codes" +) + +var ( + // testProjectID specifies the project used for testing. + // It can be changed by setting environment variable GCLOUD_TESTS_GOLANG_PROJECT_ID. + testProjectID = testutil.ProjID() + + dbNameSpace = uid.NewSpace("gotest", &uid.Options{Sep: '_', Short: true}) + + // TODO(deklerk) When we can programmatically create instances, we should use + // uid.New as the test instance name. + // testInstanceID specifies the Cloud Spanner instance used for testing. + testInstanceID = "go-integration-test" + + testTable = "TestTable" + testTableIndex = "TestTableByValue" + testTableColumns = []string{"Key", "StringValue"} + + // admin is a spanner.DatabaseAdminClient. + admin *database.DatabaseAdminClient + + singerDBStatements = []string{ + `CREATE TABLE Singers ( + SingerId INT64 NOT NULL, + FirstName STRING(1024), + LastName STRING(1024), + SingerInfo BYTES(MAX) + ) PRIMARY KEY (SingerId)`, + `CREATE INDEX SingerByName ON Singers(FirstName, LastName)`, + `CREATE TABLE Accounts ( + AccountId INT64 NOT NULL, + Nickname STRING(100), + Balance INT64 NOT NULL, + ) PRIMARY KEY (AccountId)`, + `CREATE INDEX AccountByNickname ON Accounts(Nickname) STORING (Balance)`, + `CREATE TABLE Types ( + RowID INT64 NOT NULL, + String STRING(MAX), + StringArray ARRAY, + Bytes BYTES(MAX), + BytesArray ARRAY, + Int64a INT64, + Int64Array ARRAY, + Bool BOOL, + BoolArray ARRAY, + Float64 FLOAT64, + Float64Array ARRAY, + Date DATE, + DateArray ARRAY, + Timestamp TIMESTAMP, + TimestampArray ARRAY, + ) PRIMARY KEY (RowID)`, + } + + readDBStatements = []string{ + `CREATE TABLE TestTable ( + Key STRING(MAX) NOT NULL, + StringValue STRING(MAX) + ) PRIMARY KEY (Key)`, + `CREATE INDEX TestTableByValue ON TestTable(StringValue)`, + `CREATE INDEX TestTableByValueDesc ON TestTable(StringValue DESC)`, + } + + simpleDBStatements = []string{ + `CREATE TABLE test ( + a STRING(1024), + b STRING(1024), + ) PRIMARY KEY (a)`, + } + simpleDBTableColumns = []string{"a", "b"} + + ctsDBStatements = []string{ + `CREATE TABLE TestTable ( + Key STRING(MAX) NOT NULL, + Ts TIMESTAMP OPTIONS (allow_commit_timestamp = true), + ) PRIMARY KEY (Key)`, + } +) + +const ( + str1 = "alice" + str2 = "a@example.com" +) + +func TestMain(m *testing.M) { + flag.Parse() // needed for testing.Short() + if testing.Short() { + log.Println("Integration tests skipped in -short mode.") + return + } + if testProjectID == "" { + log.Println("Integration tests skipped: GCLOUD_TESTS_GOLANG_PROJECT_ID is missing") + return + } + ctx := context.Background() + + ts := testutil.TokenSource(ctx, AdminScope, Scope) + if ts == nil { + log.Printf("Integration test skipped: cannot get service account credential from environment variable %v", "GCLOUD_TESTS_GOLANG_KEY") + return + } + var err error + + // Create Admin client and Data client. + admin, err = database.NewDatabaseAdminClient(ctx, option.WithTokenSource(ts), option.WithEndpoint(endpoint)) + if err != nil { + log.Fatalf("cannot create admin client: %v", err) + } + + res := m.Run() + cleanupDatabases() + os.Exit(res) +} + +// Test SingleUse transaction. +func TestSingleUse(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + // Set up testing environment. + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + writes := []struct { + row []interface{} + ts time.Time + }{ + {row: []interface{}{1, "Marc", "Foo"}}, + {row: []interface{}{2, "Tars", "Bar"}}, + {row: []interface{}{3, "Alpha", "Beta"}}, + {row: []interface{}{4, "Last", "End"}}, + } + // Try to write four rows through the Apply API. + for i, w := range writes { + var err error + m := InsertOrUpdate("Singers", + []string{"SingerId", "FirstName", "LastName"}, + w.row) + if writes[i].ts, err = client.Apply(ctx, []*Mutation{m}, ApplyAtLeastOnce()); err != nil { + t.Fatal(err) + } + } + + // For testing timestamp bound staleness. + <-time.After(time.Second) + + // Test reading rows with different timestamp bounds. + for i, test := range []struct { + want [][]interface{} + tb TimestampBound + checkTs func(time.Time) error + }{ + { + // strong + [][]interface{}{{int64(1), "Marc", "Foo"}, {int64(3), "Alpha", "Beta"}, {int64(4), "Last", "End"}}, + StrongRead(), + func(ts time.Time) error { + // writes[3] is the last write, all subsequent strong read should have a timestamp larger than that. + if ts.Before(writes[3].ts) { + return fmt.Errorf("read got timestamp %v, want it to be no later than %v", ts, writes[3].ts) + } + return nil + }, + }, + { + // min_read_timestamp + [][]interface{}{{int64(1), "Marc", "Foo"}, {int64(3), "Alpha", "Beta"}, {int64(4), "Last", "End"}}, + MinReadTimestamp(writes[3].ts), + func(ts time.Time) error { + if ts.Before(writes[3].ts) { + return fmt.Errorf("read got timestamp %v, want it to be no later than %v", ts, writes[3].ts) + } + return nil + }, + }, + { + // max_staleness + [][]interface{}{{int64(1), "Marc", "Foo"}, {int64(3), "Alpha", "Beta"}, {int64(4), "Last", "End"}}, + MaxStaleness(time.Second), + func(ts time.Time) error { + if ts.Before(writes[3].ts) { + return fmt.Errorf("read got timestamp %v, want it to be no later than %v", ts, writes[3].ts) + } + return nil + }, + }, + { + // read_timestamp + [][]interface{}{{int64(1), "Marc", "Foo"}, {int64(3), "Alpha", "Beta"}}, + ReadTimestamp(writes[2].ts), + func(ts time.Time) error { + if ts != writes[2].ts { + return fmt.Errorf("read got timestamp %v, want %v", ts, writes[2].ts) + } + return nil + }, + }, + { + // exact_staleness + nil, + // Specify a staleness which should be already before this test because + // context timeout is set to be 10s. + ExactStaleness(11 * time.Second), + func(ts time.Time) error { + if ts.After(writes[0].ts) { + return fmt.Errorf("read got timestamp %v, want it to be no earlier than %v", ts, writes[0].ts) + } + return nil + }, + }, + } { + // SingleUse.Query + su := client.Single().WithTimestampBound(test.tb) + got, err := readAll(su.Query( + ctx, + Statement{ + "SELECT SingerId, FirstName, LastName FROM Singers WHERE SingerId IN (@id1, @id3, @id4)", + map[string]interface{}{"id1": int64(1), "id3": int64(3), "id4": int64(4)}, + })) + if err != nil { + t.Errorf("%d: SingleUse.Query returns error %v, want nil", i, err) + } + if !testEqual(got, test.want) { + t.Errorf("%d: got unexpected result from SingleUse.Query: %v, want %v", i, got, test.want) + } + rts, err := su.Timestamp() + if err != nil { + t.Errorf("%d: SingleUse.Query doesn't return a timestamp, error: %v", i, err) + } + if err := test.checkTs(rts); err != nil { + t.Errorf("%d: SingleUse.Query doesn't return expected timestamp: %v", i, err) + } + // SingleUse.Read + su = client.Single().WithTimestampBound(test.tb) + got, err = readAll(su.Read(ctx, "Singers", KeySets(Key{1}, Key{3}, Key{4}), []string{"SingerId", "FirstName", "LastName"})) + if err != nil { + t.Errorf("%d: SingleUse.Read returns error %v, want nil", i, err) + } + if !testEqual(got, test.want) { + t.Errorf("%d: got unexpected result from SingleUse.Read: %v, want %v", i, got, test.want) + } + rts, err = su.Timestamp() + if err != nil { + t.Errorf("%d: SingleUse.Read doesn't return a timestamp, error: %v", i, err) + } + if err := test.checkTs(rts); err != nil { + t.Errorf("%d: SingleUse.Read doesn't return expected timestamp: %v", i, err) + } + // SingleUse.ReadRow + got = nil + for _, k := range []Key{{1}, {3}, {4}} { + su = client.Single().WithTimestampBound(test.tb) + r, err := su.ReadRow(ctx, "Singers", k, []string{"SingerId", "FirstName", "LastName"}) + if err != nil { + continue + } + v, err := rowToValues(r) + if err != nil { + continue + } + got = append(got, v) + rts, err = su.Timestamp() + if err != nil { + t.Errorf("%d: SingleUse.ReadRow(%v) doesn't return a timestamp, error: %v", i, k, err) + } + if err := test.checkTs(rts); err != nil { + t.Errorf("%d: SingleUse.ReadRow(%v) doesn't return expected timestamp: %v", i, k, err) + } + } + if !testEqual(got, test.want) { + t.Errorf("%d: got unexpected results from SingleUse.ReadRow: %v, want %v", i, got, test.want) + } + // SingleUse.ReadUsingIndex + su = client.Single().WithTimestampBound(test.tb) + got, err = readAll(su.ReadUsingIndex(ctx, "Singers", "SingerByName", KeySets(Key{"Marc", "Foo"}, Key{"Alpha", "Beta"}, Key{"Last", "End"}), []string{"SingerId", "FirstName", "LastName"})) + if err != nil { + t.Errorf("%d: SingleUse.ReadUsingIndex returns error %v, want nil", i, err) + } + // The results from ReadUsingIndex is sorted by the index rather than primary key. + if len(got) != len(test.want) { + t.Errorf("%d: got unexpected result from SingleUse.ReadUsingIndex: %v, want %v", i, got, test.want) + } + for j, g := range got { + if j > 0 { + prev := got[j-1][1].(string) + got[j-1][2].(string) + curr := got[j][1].(string) + got[j][2].(string) + if strings.Compare(prev, curr) > 0 { + t.Errorf("%d: SingleUse.ReadUsingIndex fails to order rows by index keys, %v should be after %v", i, got[j-1], got[j]) + } + } + found := false + for _, w := range test.want { + if testEqual(g, w) { + found = true + } + } + if !found { + t.Errorf("%d: got unexpected result from SingleUse.ReadUsingIndex: %v, want %v", i, got, test.want) + break + } + } + rts, err = su.Timestamp() + if err != nil { + t.Errorf("%d: SingleUse.ReadUsingIndex doesn't return a timestamp, error: %v", i, err) + } + if err := test.checkTs(rts); err != nil { + t.Errorf("%d: SingleUse.ReadUsingIndex doesn't return expected timestamp: %v", i, err) + } + } + + // Reading with limit. + su := client.Single() + const limit = 1 + gotRows, err := readAll(su.ReadWithOptions(ctx, "Singers", KeySets(Key{1}, Key{3}, Key{4}), + []string{"SingerId", "FirstName", "LastName"}, &ReadOptions{Limit: limit})) + if err != nil { + t.Errorf("SingleUse.ReadWithOptions returns error %v, want nil", err) + } + if got, want := len(gotRows), limit; got != want { + t.Errorf("got %d, want %d", got, want) + } + +} + +// Test ReadOnlyTransaction. The testsuite is mostly like SingleUse, except it +// also tests for a single timestamp across multiple reads. +func TestReadOnlyTransaction(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + // Set up testing environment. + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + writes := []struct { + row []interface{} + ts time.Time + }{ + {row: []interface{}{1, "Marc", "Foo"}}, + {row: []interface{}{2, "Tars", "Bar"}}, + {row: []interface{}{3, "Alpha", "Beta"}}, + {row: []interface{}{4, "Last", "End"}}, + } + // Try to write four rows through the Apply API. + for i, w := range writes { + var err error + m := InsertOrUpdate("Singers", + []string{"SingerId", "FirstName", "LastName"}, + w.row) + if writes[i].ts, err = client.Apply(ctx, []*Mutation{m}, ApplyAtLeastOnce()); err != nil { + t.Fatal(err) + } + } + + // For testing timestamp bound staleness. + <-time.After(time.Second) + + // Test reading rows with different timestamp bounds. + for i, test := range []struct { + want [][]interface{} + tb TimestampBound + checkTs func(time.Time) error + }{ + // Note: min_read_timestamp and max_staleness are not supported by ReadOnlyTransaction. See + // API document for more details. + { + // strong + [][]interface{}{{int64(1), "Marc", "Foo"}, {int64(3), "Alpha", "Beta"}, {int64(4), "Last", "End"}}, + StrongRead(), + func(ts time.Time) error { + if ts.Before(writes[3].ts) { + return fmt.Errorf("read got timestamp %v, want it to be no later than %v", ts, writes[3].ts) + } + return nil + }, + }, + { + // read_timestamp + [][]interface{}{{int64(1), "Marc", "Foo"}, {int64(3), "Alpha", "Beta"}}, + ReadTimestamp(writes[2].ts), + func(ts time.Time) error { + if ts != writes[2].ts { + return fmt.Errorf("read got timestamp %v, expect %v", ts, writes[2].ts) + } + return nil + }, + }, + { + // exact_staleness + nil, + // Specify a staleness which should be already before this test because + // context timeout is set to be 10s. + ExactStaleness(11 * time.Second), + func(ts time.Time) error { + if ts.After(writes[0].ts) { + return fmt.Errorf("read got timestamp %v, want it to be no earlier than %v", ts, writes[0].ts) + } + return nil + }, + }, + } { + // ReadOnlyTransaction.Query + ro := client.ReadOnlyTransaction().WithTimestampBound(test.tb) + got, err := readAll(ro.Query( + ctx, + Statement{ + "SELECT SingerId, FirstName, LastName FROM Singers WHERE SingerId IN (@id1, @id3, @id4)", + map[string]interface{}{"id1": int64(1), "id3": int64(3), "id4": int64(4)}, + })) + if err != nil { + t.Errorf("%d: ReadOnlyTransaction.Query returns error %v, want nil", i, err) + } + if !testEqual(got, test.want) { + t.Errorf("%d: got unexpected result from ReadOnlyTransaction.Query: %v, want %v", i, got, test.want) + } + rts, err := ro.Timestamp() + if err != nil { + t.Errorf("%d: ReadOnlyTransaction.Query doesn't return a timestamp, error: %v", i, err) + } + if err := test.checkTs(rts); err != nil { + t.Errorf("%d: ReadOnlyTransaction.Query doesn't return expected timestamp: %v", i, err) + } + roTs := rts + // ReadOnlyTransaction.Read + got, err = readAll(ro.Read(ctx, "Singers", KeySets(Key{1}, Key{3}, Key{4}), []string{"SingerId", "FirstName", "LastName"})) + if err != nil { + t.Errorf("%d: ReadOnlyTransaction.Read returns error %v, want nil", i, err) + } + if !testEqual(got, test.want) { + t.Errorf("%d: got unexpected result from ReadOnlyTransaction.Read: %v, want %v", i, got, test.want) + } + rts, err = ro.Timestamp() + if err != nil { + t.Errorf("%d: ReadOnlyTransaction.Read doesn't return a timestamp, error: %v", i, err) + } + if err := test.checkTs(rts); err != nil { + t.Errorf("%d: ReadOnlyTransaction.Read doesn't return expected timestamp: %v", i, err) + } + if roTs != rts { + t.Errorf("%d: got two read timestamps: %v, %v, want ReadOnlyTransaction to return always the same read timestamp", i, roTs, rts) + } + // ReadOnlyTransaction.ReadRow + got = nil + for _, k := range []Key{{1}, {3}, {4}} { + r, err := ro.ReadRow(ctx, "Singers", k, []string{"SingerId", "FirstName", "LastName"}) + if err != nil { + continue + } + v, err := rowToValues(r) + if err != nil { + continue + } + got = append(got, v) + rts, err = ro.Timestamp() + if err != nil { + t.Errorf("%d: ReadOnlyTransaction.ReadRow(%v) doesn't return a timestamp, error: %v", i, k, err) + } + if err := test.checkTs(rts); err != nil { + t.Errorf("%d: ReadOnlyTransaction.ReadRow(%v) doesn't return expected timestamp: %v", i, k, err) + } + if roTs != rts { + t.Errorf("%d: got two read timestamps: %v, %v, want ReadOnlyTransaction to return always the same read timestamp", i, roTs, rts) + } + } + if !testEqual(got, test.want) { + t.Errorf("%d: got unexpected results from ReadOnlyTransaction.ReadRow: %v, want %v", i, got, test.want) + } + // SingleUse.ReadUsingIndex + got, err = readAll(ro.ReadUsingIndex(ctx, "Singers", "SingerByName", KeySets(Key{"Marc", "Foo"}, Key{"Alpha", "Beta"}, Key{"Last", "End"}), []string{"SingerId", "FirstName", "LastName"})) + if err != nil { + t.Errorf("%d: ReadOnlyTransaction.ReadUsingIndex returns error %v, want nil", i, err) + } + // The results from ReadUsingIndex is sorted by the index rather than primary key. + if len(got) != len(test.want) { + t.Errorf("%d: got unexpected result from ReadOnlyTransaction.ReadUsingIndex: %v, want %v", i, got, test.want) + } + for j, g := range got { + if j > 0 { + prev := got[j-1][1].(string) + got[j-1][2].(string) + curr := got[j][1].(string) + got[j][2].(string) + if strings.Compare(prev, curr) > 0 { + t.Errorf("%d: ReadOnlyTransaction.ReadUsingIndex fails to order rows by index keys, %v should be after %v", i, got[j-1], got[j]) + } + } + found := false + for _, w := range test.want { + if testEqual(g, w) { + found = true + } + } + if !found { + t.Errorf("%d: got unexpected result from ReadOnlyTransaction.ReadUsingIndex: %v, want %v", i, got, test.want) + break + } + } + rts, err = ro.Timestamp() + if err != nil { + t.Errorf("%d: ReadOnlyTransaction.ReadUsingIndex doesn't return a timestamp, error: %v", i, err) + } + if err := test.checkTs(rts); err != nil { + t.Errorf("%d: ReadOnlyTransaction.ReadUsingIndex doesn't return expected timestamp: %v", i, err) + } + if roTs != rts { + t.Errorf("%d: got two read timestamps: %v, %v, want ReadOnlyTransaction to return always the same read timestamp", i, roTs, rts) + } + ro.Close() + } +} + +// Test ReadOnlyTransaction with different timestamp bound when there's an update at the same time. +func TestUpdateDuringRead(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + for i, tb := range []TimestampBound{ + StrongRead(), + ReadTimestamp(time.Now().Add(-time.Minute * 30)), // version GC is 1 hour + ExactStaleness(time.Minute * 30), + } { + ro := client.ReadOnlyTransaction().WithTimestampBound(tb) + _, err := ro.ReadRow(ctx, "Singers", Key{i}, []string{"SingerId"}) + if ErrCode(err) != codes.NotFound { + t.Errorf("%d: ReadOnlyTransaction.ReadRow before write returns error: %v, want NotFound", i, err) + } + + m := InsertOrUpdate("Singers", []string{"SingerId"}, []interface{}{i}) + if _, err := client.Apply(ctx, []*Mutation{m}, ApplyAtLeastOnce()); err != nil { + t.Fatal(err) + } + + _, err = ro.ReadRow(ctx, "Singers", Key{i}, []string{"SingerId"}) + if ErrCode(err) != codes.NotFound { + t.Errorf("%d: ReadOnlyTransaction.ReadRow after write returns error: %v, want NotFound", i, err) + } + } +} + +// Test ReadWriteTransaction. +func TestReadWriteTransaction(t *testing.T) { + // Give a longer deadline because of transaction backoffs. + ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) + defer cancel() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + // Set up two accounts + accounts := []*Mutation{ + Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(1), "Foo", int64(50)}), + Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(2), "Bar", int64(1)}), + } + if _, err := client.Apply(ctx, accounts, ApplyAtLeastOnce()); err != nil { + t.Fatal(err) + } + wg := sync.WaitGroup{} + + readBalance := func(iter *RowIterator) (int64, error) { + defer iter.Stop() + var bal int64 + for { + row, err := iter.Next() + if err == iterator.Done { + return bal, nil + } + if err != nil { + return 0, err + } + if err := row.Column(0, &bal); err != nil { + return 0, err + } + } + } + + for i := 0; i < 20; i++ { + wg.Add(1) + go func(iter int) { + defer wg.Done() + _, err := client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + // Query Foo's balance and Bar's balance. + bf, e := readBalance(tx.Query(ctx, + Statement{"SELECT Balance FROM Accounts WHERE AccountId = @id", map[string]interface{}{"id": int64(1)}})) + if e != nil { + return e + } + bb, e := readBalance(tx.Read(ctx, "Accounts", KeySets(Key{int64(2)}), []string{"Balance"})) + if e != nil { + return e + } + if bf <= 0 { + return nil + } + bf-- + bb++ + return tx.BufferWrite([]*Mutation{ + Update("Accounts", []string{"AccountId", "Balance"}, []interface{}{int64(1), bf}), + Update("Accounts", []string{"AccountId", "Balance"}, []interface{}{int64(2), bb}), + }) + }) + if err != nil { + t.Errorf("%d: failed to execute transaction: %v", iter, err) + } + }(i) + } + // Because of context timeout, all goroutines will eventually return. + wg.Wait() + _, err := client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + var bf, bb int64 + r, e := tx.ReadRow(ctx, "Accounts", Key{int64(1)}, []string{"Balance"}) + if e != nil { + return e + } + if ce := r.Column(0, &bf); ce != nil { + return ce + } + bb, e = readBalance(tx.ReadUsingIndex(ctx, "Accounts", "AccountByNickname", KeySets(Key{"Bar"}), []string{"Balance"})) + if e != nil { + return e + } + if bf != 30 || bb != 21 { + t.Errorf("Foo's balance is now %v and Bar's balance is now %v, want %v and %v", bf, bb, 30, 21) + } + return nil + }) + if err != nil { + t.Errorf("failed to check balances: %v", err) + } +} + +func TestReads(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + // Set up testing environment. + client, _, cleanup := prepare(ctx, t, readDBStatements) + defer cleanup() + + // Includes k0..k14. Strings sort lexically, eg "k1" < "k10" < "k2". + var ms []*Mutation + for i := 0; i < 15; i++ { + ms = append(ms, InsertOrUpdate(testTable, + testTableColumns, + []interface{}{fmt.Sprintf("k%d", i), fmt.Sprintf("v%d", i)})) + } + // Don't use ApplyAtLeastOnce, so we can test the other code path. + if _, err := client.Apply(ctx, ms); err != nil { + t.Fatal(err) + } + + // Empty read. + rows, err := readAllTestTable(client.Single().Read(ctx, testTable, + KeyRange{Start: Key{"k99"}, End: Key{"z"}}, testTableColumns)) + if err != nil { + t.Fatal(err) + } + if got, want := len(rows), 0; got != want { + t.Errorf("got %d, want %d", got, want) + } + + // Index empty read. + rows, err = readAllTestTable(client.Single().ReadUsingIndex(ctx, testTable, testTableIndex, + KeyRange{Start: Key{"v99"}, End: Key{"z"}}, testTableColumns)) + if err != nil { + t.Fatal(err) + } + if got, want := len(rows), 0; got != want { + t.Errorf("got %d, want %d", got, want) + } + + // Point read. + row, err := client.Single().ReadRow(ctx, testTable, Key{"k1"}, testTableColumns) + if err != nil { + t.Fatal(err) + } + var got testTableRow + if err := row.ToStruct(&got); err != nil { + t.Fatal(err) + } + if want := (testTableRow{"k1", "v1"}); got != want { + t.Errorf("got %v, want %v", got, want) + } + + // Point read not found. + _, err = client.Single().ReadRow(ctx, testTable, Key{"k999"}, testTableColumns) + if ErrCode(err) != codes.NotFound { + t.Fatalf("got %v, want NotFound", err) + } + + // No index point read not found, because Go does not have ReadRowUsingIndex. + + rangeReads(ctx, t, client) + indexRangeReads(ctx, t, client) +} + +func TestEarlyTimestamp(t *testing.T) { + // Test that we can get the timestamp from a read-only transaction as + // soon as we have read at least one row. + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + // Set up testing environment. + client, _, cleanup := prepare(ctx, t, readDBStatements) + defer cleanup() + + var ms []*Mutation + for i := 0; i < 3; i++ { + ms = append(ms, InsertOrUpdate(testTable, + testTableColumns, + []interface{}{fmt.Sprintf("k%d", i), fmt.Sprintf("v%d", i)})) + } + if _, err := client.Apply(ctx, ms, ApplyAtLeastOnce()); err != nil { + t.Fatal(err) + } + + txn := client.Single() + iter := txn.Read(ctx, testTable, AllKeys(), testTableColumns) + defer iter.Stop() + // In single-use transaction, we should get an error before reading anything. + if _, err := txn.Timestamp(); err == nil { + t.Error("wanted error, got nil") + } + // After reading one row, the timestamp should be available. + _, err := iter.Next() + if err != nil { + t.Fatal(err) + } + if _, err := txn.Timestamp(); err != nil { + t.Errorf("got %v, want nil", err) + } + + txn = client.ReadOnlyTransaction() + defer txn.Close() + iter = txn.Read(ctx, testTable, AllKeys(), testTableColumns) + defer iter.Stop() + // In an ordinary read-only transaction, the timestamp should be + // available immediately. + if _, err := txn.Timestamp(); err != nil { + t.Errorf("got %v, want nil", err) + } +} + +func TestNestedTransaction(t *testing.T) { + // You cannot use a transaction from inside a read-write transaction. + ctx := context.Background() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + _, err := client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + _, err := client.ReadWriteTransaction(ctx, + func(context.Context, *ReadWriteTransaction) error { return nil }) + if ErrCode(err) != codes.FailedPrecondition { + t.Fatalf("got %v, want FailedPrecondition", err) + } + _, err = client.Single().ReadRow(ctx, "Singers", Key{1}, []string{"SingerId"}) + if ErrCode(err) != codes.FailedPrecondition { + t.Fatalf("got %v, want FailedPrecondition", err) + } + rot := client.ReadOnlyTransaction() + defer rot.Close() + _, err = rot.ReadRow(ctx, "Singers", Key{1}, []string{"SingerId"}) + if ErrCode(err) != codes.FailedPrecondition { + t.Fatalf("got %v, want FailedPrecondition", err) + } + return nil + }) + if err != nil { + t.Fatal(err) + } +} + +// Test client recovery on database recreation. +func TestDbRemovalRecovery(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) + defer cancel() + client, dbPath, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + // Drop the testing database. + if err := admin.DropDatabase(ctx, &adminpb.DropDatabaseRequest{Database: dbPath}); err != nil { + t.Fatalf("failed to drop testing database %v: %v", dbPath, err) + } + + // Now, send the query. + iter := client.Single().Query(ctx, Statement{SQL: "SELECT SingerId FROM Singers"}) + defer iter.Stop() + if _, err := iter.Next(); err == nil { + t.Errorf("client sends query to removed database successfully, want it to fail") + } + + // Recreate database and table. + dbName := dbPath[strings.LastIndex(dbPath, "/")+1:] + op, err := admin.CreateDatabase(ctx, &adminpb.CreateDatabaseRequest{ + Parent: fmt.Sprintf("projects/%v/instances/%v", testProjectID, testInstanceID), + CreateStatement: "CREATE DATABASE " + dbName, + ExtraStatements: []string{ + `CREATE TABLE Singers ( + SingerId INT64 NOT NULL, + FirstName STRING(1024), + LastName STRING(1024), + SingerInfo BYTES(MAX) + ) PRIMARY KEY (SingerId)`, + }, + }) + if err != nil { + t.Fatalf("cannot recreate testing DB %v: %v", dbPath, err) + } + if _, err := op.Wait(ctx); err != nil { + t.Fatalf("cannot recreate testing DB %v: %v", dbPath, err) + } + + // Now, send the query again. + iter = client.Single().Query(ctx, Statement{SQL: "SELECT SingerId FROM Singers"}) + defer iter.Stop() + _, err = iter.Next() + if err != nil && err != iterator.Done { + t.Errorf("failed to send query to database %v: %v", dbPath, err) + } +} + +// Test encoding/decoding non-struct Cloud Spanner types. +func TestBasicTypes(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + t1, _ := time.Parse(time.RFC3339Nano, "2016-11-15T15:04:05.999999999Z") + // Boundaries + t2, _ := time.Parse(time.RFC3339Nano, "0001-01-01T00:00:00.000000000Z") + t3, _ := time.Parse(time.RFC3339Nano, "9999-12-31T23:59:59.999999999Z") + d1, _ := civil.ParseDate("2016-11-15") + // Boundaries + d2, _ := civil.ParseDate("0001-01-01") + d3, _ := civil.ParseDate("9999-12-31") + + tests := []struct { + col string + val interface{} + want interface{} + }{ + {col: "String", val: ""}, + {col: "String", val: "", want: NullString{"", true}}, + {col: "String", val: "foo"}, + {col: "String", val: "foo", want: NullString{"foo", true}}, + {col: "String", val: NullString{"bar", true}, want: "bar"}, + {col: "String", val: NullString{"bar", false}, want: NullString{"", false}}, + {col: "String", val: nil, want: NullString{}}, + {col: "StringArray", val: []string(nil), want: []NullString(nil)}, + {col: "StringArray", val: []string{}, want: []NullString{}}, + {col: "StringArray", val: []string{"foo", "bar"}, want: []NullString{{"foo", true}, {"bar", true}}}, + {col: "StringArray", val: []NullString(nil)}, + {col: "StringArray", val: []NullString{}}, + {col: "StringArray", val: []NullString{{"foo", true}, {}}}, + {col: "Bytes", val: []byte{}}, + {col: "Bytes", val: []byte{1, 2, 3}}, + {col: "Bytes", val: []byte(nil)}, + {col: "BytesArray", val: [][]byte(nil)}, + {col: "BytesArray", val: [][]byte{}}, + {col: "BytesArray", val: [][]byte{{1}, {2, 3}}}, + {col: "Int64a", val: 0, want: int64(0)}, + {col: "Int64a", val: -1, want: int64(-1)}, + {col: "Int64a", val: 2, want: int64(2)}, + {col: "Int64a", val: int64(3)}, + {col: "Int64a", val: 4, want: NullInt64{4, true}}, + {col: "Int64a", val: NullInt64{5, true}, want: int64(5)}, + {col: "Int64a", val: NullInt64{6, true}, want: int64(6)}, + {col: "Int64a", val: NullInt64{7, false}, want: NullInt64{0, false}}, + {col: "Int64a", val: nil, want: NullInt64{}}, + {col: "Int64Array", val: []int(nil), want: []NullInt64(nil)}, + {col: "Int64Array", val: []int{}, want: []NullInt64{}}, + {col: "Int64Array", val: []int{1, 2}, want: []NullInt64{{1, true}, {2, true}}}, + {col: "Int64Array", val: []int64(nil), want: []NullInt64(nil)}, + {col: "Int64Array", val: []int64{}, want: []NullInt64{}}, + {col: "Int64Array", val: []int64{1, 2}, want: []NullInt64{{1, true}, {2, true}}}, + {col: "Int64Array", val: []NullInt64(nil)}, + {col: "Int64Array", val: []NullInt64{}}, + {col: "Int64Array", val: []NullInt64{{1, true}, {}}}, + {col: "Bool", val: false}, + {col: "Bool", val: true}, + {col: "Bool", val: false, want: NullBool{false, true}}, + {col: "Bool", val: true, want: NullBool{true, true}}, + {col: "Bool", val: NullBool{true, true}}, + {col: "Bool", val: NullBool{false, false}}, + {col: "Bool", val: nil, want: NullBool{}}, + {col: "BoolArray", val: []bool(nil), want: []NullBool(nil)}, + {col: "BoolArray", val: []bool{}, want: []NullBool{}}, + {col: "BoolArray", val: []bool{true, false}, want: []NullBool{{true, true}, {false, true}}}, + {col: "BoolArray", val: []NullBool(nil)}, + {col: "BoolArray", val: []NullBool{}}, + {col: "BoolArray", val: []NullBool{{false, true}, {true, true}, {}}}, + {col: "Float64", val: 0.0}, + {col: "Float64", val: 3.14}, + {col: "Float64", val: math.NaN()}, + {col: "Float64", val: math.Inf(1)}, + {col: "Float64", val: math.Inf(-1)}, + {col: "Float64", val: 2.78, want: NullFloat64{2.78, true}}, + {col: "Float64", val: NullFloat64{2.71, true}, want: 2.71}, + {col: "Float64", val: NullFloat64{1.41, true}, want: NullFloat64{1.41, true}}, + {col: "Float64", val: NullFloat64{0, false}}, + {col: "Float64", val: nil, want: NullFloat64{}}, + {col: "Float64Array", val: []float64(nil), want: []NullFloat64(nil)}, + {col: "Float64Array", val: []float64{}, want: []NullFloat64{}}, + {col: "Float64Array", val: []float64{2.72, 3.14, math.Inf(1)}, want: []NullFloat64{{2.72, true}, {3.14, true}, {math.Inf(1), true}}}, + {col: "Float64Array", val: []NullFloat64(nil)}, + {col: "Float64Array", val: []NullFloat64{}}, + {col: "Float64Array", val: []NullFloat64{{2.72, true}, {math.Inf(1), true}, {}}}, + {col: "Date", val: d1}, + {col: "Date", val: d1, want: NullDate{d1, true}}, + {col: "Date", val: NullDate{d1, true}}, + {col: "Date", val: NullDate{d1, true}, want: d1}, + {col: "Date", val: NullDate{civil.Date{}, false}}, + {col: "DateArray", val: []civil.Date(nil), want: []NullDate(nil)}, + {col: "DateArray", val: []civil.Date{}, want: []NullDate{}}, + {col: "DateArray", val: []civil.Date{d1, d2, d3}, want: []NullDate{{d1, true}, {d2, true}, {d3, true}}}, + {col: "Timestamp", val: t1}, + {col: "Timestamp", val: t1, want: NullTime{t1, true}}, + {col: "Timestamp", val: NullTime{t1, true}}, + {col: "Timestamp", val: NullTime{t1, true}, want: t1}, + {col: "Timestamp", val: NullTime{}}, + {col: "Timestamp", val: nil, want: NullTime{}}, + {col: "TimestampArray", val: []time.Time(nil), want: []NullTime(nil)}, + {col: "TimestampArray", val: []time.Time{}, want: []NullTime{}}, + {col: "TimestampArray", val: []time.Time{t1, t2, t3}, want: []NullTime{{t1, true}, {t2, true}, {t3, true}}}, + } + + // Write rows into table first. + var muts []*Mutation + for i, test := range tests { + muts = append(muts, InsertOrUpdate("Types", []string{"RowID", test.col}, []interface{}{i, test.val})) + } + if _, err := client.Apply(ctx, muts, ApplyAtLeastOnce()); err != nil { + t.Fatal(err) + } + + for i, test := range tests { + row, err := client.Single().ReadRow(ctx, "Types", []interface{}{i}, []string{test.col}) + if err != nil { + t.Fatalf("Unable to fetch row %v: %v", i, err) + } + // Create new instance of type of test.want. + want := test.want + if want == nil { + want = test.val + } + gotp := reflect.New(reflect.TypeOf(want)) + if err := row.Column(0, gotp.Interface()); err != nil { + t.Errorf("%d: col:%v val:%#v, %v", i, test.col, test.val, err) + continue + } + got := reflect.Indirect(gotp).Interface() + + // One of the test cases is checking NaN handling. Given + // NaN!=NaN, we can't use reflect to test for it. + if isNaN(got) && isNaN(want) { + continue + } + + // Check non-NaN cases. + if !testEqual(got, want) { + t.Errorf("%d: col:%v val:%#v, got %#v, want %#v", i, test.col, test.val, got, want) + continue + } + } +} + +// Test decoding Cloud Spanner STRUCT type. +func TestStructTypes(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + tests := []struct { + q Statement + want func(r *Row) error + }{ + { + q: Statement{SQL: `SELECT ARRAY(SELECT STRUCT(1, 2))`}, + want: func(r *Row) error { + // Test STRUCT ARRAY decoding to []NullRow. + var rows []NullRow + if err := r.Column(0, &rows); err != nil { + return err + } + if len(rows) != 1 { + return fmt.Errorf("len(rows) = %d; want 1", len(rows)) + } + if !rows[0].Valid { + return fmt.Errorf("rows[0] is NULL") + } + var i, j int64 + if err := rows[0].Row.Columns(&i, &j); err != nil { + return err + } + if i != 1 || j != 2 { + return fmt.Errorf("got (%d,%d), want (1,2)", i, j) + } + return nil + }, + }, + { + q: Statement{SQL: `SELECT ARRAY(SELECT STRUCT(1 as foo, 2 as bar)) as col1`}, + want: func(r *Row) error { + // Test Row.ToStruct. + s := struct { + Col1 []*struct { + Foo int64 `spanner:"foo"` + Bar int64 `spanner:"bar"` + } `spanner:"col1"` + }{} + if err := r.ToStruct(&s); err != nil { + return err + } + want := struct { + Col1 []*struct { + Foo int64 `spanner:"foo"` + Bar int64 `spanner:"bar"` + } `spanner:"col1"` + }{ + Col1: []*struct { + Foo int64 `spanner:"foo"` + Bar int64 `spanner:"bar"` + }{ + { + Foo: 1, + Bar: 2, + }, + }, + } + if !testEqual(want, s) { + return fmt.Errorf("unexpected decoding result: %v, want %v", s, want) + } + return nil + }, + }, + } + for i, test := range tests { + iter := client.Single().Query(ctx, test.q) + defer iter.Stop() + row, err := iter.Next() + if err != nil { + t.Errorf("%d: %v", i, err) + continue + } + if err := test.want(row); err != nil { + t.Errorf("%d: %v", i, err) + continue + } + } +} + +func TestStructParametersUnsupported(t *testing.T) { + ctx := context.Background() + client, _, cleanup := prepare(ctx, t, nil) + defer cleanup() + + for _, test := range []struct { + param interface{} + wantCode codes.Code + wantMsgPart string + }{ + { + struct { + Field int + }{10}, + codes.Unimplemented, + "Unsupported query shape: " + + "A struct value cannot be returned as a column value. " + + "Rewrite the query to flatten the struct fields in the result.", + }, + { + []struct { + Field int + }{{10}, {20}}, + codes.Unimplemented, + "Unsupported query shape: " + + "This query can return a null-valued array of struct, " + + "which is not supported by Spanner.", + }, + } { + iter := client.Single().Query(ctx, Statement{ + SQL: "SELECT @p", + Params: map[string]interface{}{"p": test.param}, + }) + _, err := iter.Next() + iter.Stop() + if msg, ok := matchError(err, test.wantCode, test.wantMsgPart); !ok { + t.Fatal(msg) + } + } +} + +// Test queries of the form "SELECT expr". +func TestQueryExpressions(t *testing.T) { + ctx := context.Background() + client, _, cleanup := prepare(ctx, t, nil) + defer cleanup() + + newRow := func(vals []interface{}) *Row { + row, err := NewRow(make([]string, len(vals)), vals) + if err != nil { + t.Fatal(err) + } + return row + } + + tests := []struct { + expr string + want interface{} + }{ + {"1", int64(1)}, + {"[1, 2, 3]", []NullInt64{{1, true}, {2, true}, {3, true}}}, + {"[1, NULL, 3]", []NullInt64{{1, true}, {0, false}, {3, true}}}, + {"IEEE_DIVIDE(1, 0)", math.Inf(1)}, + {"IEEE_DIVIDE(-1, 0)", math.Inf(-1)}, + {"IEEE_DIVIDE(0, 0)", math.NaN()}, + // TODO(jba): add IEEE_DIVIDE(0, 0) to the following array when we have a better equality predicate. + {"[IEEE_DIVIDE(1, 0), IEEE_DIVIDE(-1, 0)]", []NullFloat64{{math.Inf(1), true}, {math.Inf(-1), true}}}, + {"ARRAY(SELECT AS STRUCT * FROM (SELECT 'a', 1) WHERE 0 = 1)", []NullRow{}}, + {"ARRAY(SELECT STRUCT(1, 2))", []NullRow{{Row: *newRow([]interface{}{1, 2}), Valid: true}}}, + } + for _, test := range tests { + iter := client.Single().Query(ctx, Statement{SQL: "SELECT " + test.expr}) + defer iter.Stop() + row, err := iter.Next() + if err != nil { + t.Errorf("%q: %v", test.expr, err) + continue + } + // Create new instance of type of test.want. + gotp := reflect.New(reflect.TypeOf(test.want)) + if err := row.Column(0, gotp.Interface()); err != nil { + t.Errorf("%q: Column returned error %v", test.expr, err) + continue + } + got := reflect.Indirect(gotp).Interface() + // TODO(jba): remove isNaN special case when we have a better equality predicate. + if isNaN(got) && isNaN(test.want) { + continue + } + if !testEqual(got, test.want) { + t.Errorf("%q\n got %#v\nwant %#v", test.expr, got, test.want) + } + } +} + +func TestQueryStats(t *testing.T) { + ctx := context.Background() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + accounts := []*Mutation{ + Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(1), "Foo", int64(50)}), + Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(2), "Bar", int64(1)}), + } + if _, err := client.Apply(ctx, accounts, ApplyAtLeastOnce()); err != nil { + t.Fatal(err) + } + const sql = "SELECT Balance FROM Accounts" + + qp, err := client.Single().AnalyzeQuery(ctx, Statement{sql, nil}) + if err != nil { + t.Fatal(err) + } + if len(qp.PlanNodes) == 0 { + t.Error("got zero plan nodes, expected at least one") + } + + iter := client.Single().QueryWithStats(ctx, Statement{sql, nil}) + defer iter.Stop() + for { + _, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + t.Fatal(err) + } + } + if iter.QueryPlan == nil { + t.Error("got nil QueryPlan, expected one") + } + if iter.QueryStats == nil { + t.Error("got nil QueryStats, expected some") + } +} + +func TestInvalidDatabase(t *testing.T) { + if testProjectID == "" { + t.Skip("Integration tests skipped: GCLOUD_TESTS_GOLANG_PROJECT_ID is missing") + } + ctx := context.Background() + dbPath := fmt.Sprintf("projects/%v/instances/%v/databases/invalid", testProjectID, testInstanceID) + c, err := createClient(ctx, dbPath) + // Client creation should succeed even if the database is invalid. + if err != nil { + t.Fatal(err) + } + _, err = c.Single().ReadRow(ctx, "TestTable", Key{1}, []string{"col1"}) + if msg, ok := matchError(err, codes.NotFound, ""); !ok { + t.Fatal(msg) + } +} + +func TestReadErrors(t *testing.T) { + ctx := context.Background() + client, _, cleanup := prepare(ctx, t, readDBStatements) + defer cleanup() + + // Read over invalid table fails + _, err := client.Single().ReadRow(ctx, "badTable", Key{1}, []string{"StringValue"}) + if msg, ok := matchError(err, codes.NotFound, "badTable"); !ok { + t.Error(msg) + } + // Read over invalid column fails + _, err = client.Single().ReadRow(ctx, "TestTable", Key{1}, []string{"badcol"}) + if msg, ok := matchError(err, codes.NotFound, "badcol"); !ok { + t.Error(msg) + } + + // Invalid query fails + iter := client.Single().Query(ctx, Statement{SQL: "SELECT Apples AND Oranges"}) + defer iter.Stop() + _, err = iter.Next() + if msg, ok := matchError(err, codes.InvalidArgument, "unrecognized name"); !ok { + t.Error(msg) + } + + // Read should fail on cancellation. + cctx, cancel := context.WithCancel(ctx) + cancel() + _, err = client.Single().ReadRow(cctx, "TestTable", Key{1}, []string{"StringValue"}) + if msg, ok := matchError(err, codes.Canceled, ""); !ok { + t.Error(msg) + } + // Read should fail if deadline exceeded. + dctx, cancel := context.WithTimeout(ctx, time.Nanosecond) + defer cancel() + <-dctx.Done() + _, err = client.Single().ReadRow(dctx, "TestTable", Key{1}, []string{"StringValue"}) + if msg, ok := matchError(err, codes.DeadlineExceeded, ""); !ok { + t.Error(msg) + } +} + +// Test TransactionRunner. Test that transactions are aborted and retried as expected. +func TestTransactionRunner(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + // Test 1: User error should abort the transaction. + _, _ = client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + tx.BufferWrite([]*Mutation{ + Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(1), "Foo", int64(50)})}) + return errors.New("user error") + }) + // Empty read. + rows, err := readAllTestTable(client.Single().Read(ctx, "Accounts", Key{1}, []string{"AccountId", "Nickname", "Balance"})) + if err != nil { + t.Fatal(err) + } + if got, want := len(rows), 0; got != want { + t.Errorf("Empty read, got %d, want %d.", got, want) + } + + // Test 2: Expect abort and retry. + // We run two ReadWriteTransactions concurrently and make txn1 abort txn2 by committing writes to the column txn2 have read, + // and expect the following read to abort and txn2 retries. + + // Set up two accounts + accounts := []*Mutation{ + Insert("Accounts", []string{"AccountId", "Balance"}, []interface{}{int64(1), int64(0)}), + Insert("Accounts", []string{"AccountId", "Balance"}, []interface{}{int64(2), int64(1)}), + } + if _, err := client.Apply(ctx, accounts, ApplyAtLeastOnce()); err != nil { + t.Fatal(err) + } + + var ( + cTxn1Start = make(chan struct{}) + cTxn1Commit = make(chan struct{}) + cTxn2Start = make(chan struct{}) + wg sync.WaitGroup + ) + + // read balance, check error if we don't expect abort. + readBalance := func(tx interface { + ReadRow(ctx context.Context, table string, key Key, columns []string) (*Row, error) + }, key int64, expectAbort bool) (int64, error) { + var b int64 + r, e := tx.ReadRow(ctx, "Accounts", Key{int64(key)}, []string{"Balance"}) + if e != nil { + if expectAbort && !isAbortErr(e) { + t.Errorf("ReadRow got %v, want Abort error.", e) + } + return b, e + } + if ce := r.Column(0, &b); ce != nil { + return b, ce + } + return b, nil + } + + wg.Add(2) + // Txn 1 + go func() { + defer wg.Done() + var once sync.Once + _, e := client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + b, e := readBalance(tx, 1, false) + if e != nil { + return e + } + // txn 1 can abort, in that case we skip closing the channel on retry. + once.Do(func() { close(cTxn1Start) }) + e = tx.BufferWrite([]*Mutation{ + Update("Accounts", []string{"AccountId", "Balance"}, []interface{}{int64(1), int64(b + 1)})}) + if e != nil { + return e + } + // Wait for second transaction. + <-cTxn2Start + return nil + }) + close(cTxn1Commit) + if e != nil { + t.Errorf("Transaction 1 commit, got %v, want nil.", e) + } + }() + // Txn 2 + go func() { + // Wait until txn 1 starts. + <-cTxn1Start + defer wg.Done() + var ( + once sync.Once + b1 int64 + b2 int64 + e error + ) + _, e = client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + if b1, e = readBalance(tx, 1, false); e != nil { + return e + } + // Skip closing channel on retry. + once.Do(func() { close(cTxn2Start) }) + // Wait until txn 1 successfully commits. + <-cTxn1Commit + // Txn1 has committed and written a balance to the account. + // Now this transaction (txn2) reads and re-writes the balance. + // The first time through, it will abort because it overlaps with txn1. + // Then it will retry after txn1 commits, and succeed. + if b2, e = readBalance(tx, 2, true); e != nil { + return e + } + return tx.BufferWrite([]*Mutation{ + Update("Accounts", []string{"AccountId", "Balance"}, []interface{}{int64(2), int64(b1 + b2)})}) + }) + if e != nil { + t.Errorf("Transaction 2 commit, got %v, want nil.", e) + } + }() + wg.Wait() + // Check that both transactions' effects are visible. + for i := int64(1); i <= int64(2); i++ { + if b, e := readBalance(client.Single(), i, false); e != nil { + t.Fatalf("ReadBalance for key %d error %v.", i, e) + } else if b != i { + t.Errorf("Balance for key %d, got %d, want %d.", i, b, i) + } + } +} + +// Test PartitionQuery of BatchReadOnlyTransaction, create partitions then +// serialize and deserialize both transaction and partition to be used in +// execution on another client, and compare results. +func TestBatchQuery(t *testing.T) { + // Set up testing environment. + var ( + client2 *Client + err error + ) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, dbPath, cleanup := prepare(ctx, t, simpleDBStatements) + defer cleanup() + + if err = populate(ctx, client); err != nil { + t.Fatal(err) + } + if client2, err = createClient(ctx, dbPath); err != nil { + t.Fatal(err) + } + defer client2.Close() + + // PartitionQuery + var ( + txn *BatchReadOnlyTransaction + partitions []*Partition + stmt = Statement{SQL: "SELECT * FROM test;"} + ) + + if txn, err = client.BatchReadOnlyTransaction(ctx, StrongRead()); err != nil { + t.Fatal(err) + } + defer txn.Cleanup(ctx) + if partitions, err = txn.PartitionQuery(ctx, stmt, PartitionOptions{0, 3}); err != nil { + t.Fatal(err) + } + + // Reconstruct BatchReadOnlyTransactionID and execute partitions + var ( + tid2 BatchReadOnlyTransactionID + data []byte + gotResult bool // if we get matching result from two separate txns + ) + if data, err = txn.ID.MarshalBinary(); err != nil { + t.Fatalf("encoding failed %v", err) + } + if err = tid2.UnmarshalBinary(data); err != nil { + t.Fatalf("decoding failed %v", err) + } + txn2 := client2.BatchReadOnlyTransactionFromID(tid2) + + // Execute Partitions and compare results + for i, p := range partitions { + iter := txn.Execute(ctx, p) + defer iter.Stop() + p2 := serdesPartition(t, i, p) + iter2 := txn2.Execute(ctx, &p2) + defer iter2.Stop() + + row1, err1 := iter.Next() + row2, err2 := iter2.Next() + if err1 != err2 { + t.Fatalf("execution failed for different reasons: %v, %v", err1, err2) + continue + } + if !testEqual(row1, row2) { + t.Fatalf("execution returned different values: %v, %v", row1, row2) + continue + } + if row1 == nil { + continue + } + var a, b string + if err = row1.Columns(&a, &b); err != nil { + t.Fatalf("failed to parse row %v", err) + continue + } + if a == str1 && b == str2 { + gotResult = true + } + } + if !gotResult { + t.Fatalf("execution didn't return expected values") + } +} + +// Test PartitionRead of BatchReadOnlyTransaction, similar to TestBatchQuery +func TestBatchRead(t *testing.T) { + // Set up testing environment. + var ( + client2 *Client + err error + ) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, dbPath, cleanup := prepare(ctx, t, simpleDBStatements) + defer cleanup() + + if err = populate(ctx, client); err != nil { + t.Fatal(err) + } + if client2, err = createClient(ctx, dbPath); err != nil { + t.Fatal(err) + } + defer client2.Close() + + // PartitionRead + var ( + txn *BatchReadOnlyTransaction + partitions []*Partition + ) + + if txn, err = client.BatchReadOnlyTransaction(ctx, StrongRead()); err != nil { + t.Fatal(err) + } + defer txn.Cleanup(ctx) + if partitions, err = txn.PartitionRead(ctx, "test", AllKeys(), simpleDBTableColumns, PartitionOptions{0, 3}); err != nil { + t.Fatal(err) + } + + // Reconstruct BatchReadOnlyTransactionID and execute partitions + var ( + tid2 BatchReadOnlyTransactionID + data []byte + gotResult bool // if we get matching result from two separate txns + ) + if data, err = txn.ID.MarshalBinary(); err != nil { + t.Fatalf("encoding failed %v", err) + } + if err = tid2.UnmarshalBinary(data); err != nil { + t.Fatalf("decoding failed %v", err) + } + txn2 := client2.BatchReadOnlyTransactionFromID(tid2) + + // Execute Partitions and compare results + for i, p := range partitions { + iter := txn.Execute(ctx, p) + defer iter.Stop() + p2 := serdesPartition(t, i, p) + iter2 := txn2.Execute(ctx, &p2) + defer iter2.Stop() + + row1, err1 := iter.Next() + row2, err2 := iter2.Next() + if err1 != err2 { + t.Fatalf("execution failed for different reasons: %v, %v", err1, err2) + continue + } + if !testEqual(row1, row2) { + t.Fatalf("execution returned different values: %v, %v", row1, row2) + continue + } + if row1 == nil { + continue + } + var a, b string + if err = row1.Columns(&a, &b); err != nil { + t.Fatalf("failed to parse row %v", err) + continue + } + if a == str1 && b == str2 { + gotResult = true + } + } + if !gotResult { + t.Fatalf("execution didn't return expected values") + } +} + +// Test normal txReadEnv method on BatchReadOnlyTransaction. +func TestBROTNormal(t *testing.T) { + // Set up testing environment and create txn. + var ( + txn *BatchReadOnlyTransaction + err error + row *Row + i int64 + ) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, _, cleanup := prepare(ctx, t, simpleDBStatements) + defer cleanup() + + if txn, err = client.BatchReadOnlyTransaction(ctx, StrongRead()); err != nil { + t.Fatal(err) + } + defer txn.Cleanup(ctx) + if _, err := txn.PartitionRead(ctx, "test", AllKeys(), simpleDBTableColumns, PartitionOptions{0, 3}); err != nil { + t.Fatal(err) + } + // Normal query should work with BatchReadOnlyTransaction + stmt2 := Statement{SQL: "SELECT 1"} + iter := txn.Query(ctx, stmt2) + defer iter.Stop() + + row, err = iter.Next() + if err != nil { + t.Errorf("query failed with %v", err) + } + if err = row.Columns(&i); err != nil { + t.Errorf("failed to parse row %v", err) + } +} + +func TestCommitTimestamp(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, _, cleanup := prepare(ctx, t, ctsDBStatements) + defer cleanup() + + type testTableRow struct { + Key string + Ts NullTime + } + + var ( + cts1, cts2, ts1, ts2 time.Time + err error + ) + + // Apply mutation in sequence, expect to see commit timestamp in good order, check also the commit timestamp returned + for _, it := range []struct { + k string + t *time.Time + }{ + {"a", &cts1}, + {"b", &cts2}, + } { + tt := testTableRow{Key: it.k, Ts: NullTime{CommitTimestamp, true}} + m, err := InsertStruct("TestTable", tt) + if err != nil { + t.Fatal(err) + } + *it.t, err = client.Apply(ctx, []*Mutation{m}, ApplyAtLeastOnce()) + if err != nil { + t.Fatal(err) + } + } + + txn := client.ReadOnlyTransaction() + for _, it := range []struct { + k string + t *time.Time + }{ + {"a", &ts1}, + {"b", &ts2}, + } { + if r, e := txn.ReadRow(ctx, "TestTable", Key{it.k}, []string{"Ts"}); e != nil { + t.Fatal(err) + } else { + var got testTableRow + if err := r.ToStruct(&got); err != nil { + t.Fatal(err) + } + *it.t = got.Ts.Time + } + } + if !cts1.Equal(ts1) { + t.Errorf("Expect commit timestamp returned and read to match for txn1, got %v and %v.", cts1, ts1) + } + if !cts2.Equal(ts2) { + t.Errorf("Expect commit timestamp returned and read to match for txn2, got %v and %v.", cts2, ts2) + } + + // Try writing a timestamp in the future to commit timestamp, expect error + _, err = client.Apply(ctx, []*Mutation{InsertOrUpdate("TestTable", []string{"Key", "Ts"}, []interface{}{"a", time.Now().Add(time.Hour)})}, ApplyAtLeastOnce()) + if msg, ok := matchError(err, codes.FailedPrecondition, "Cannot write timestamps in the future"); !ok { + t.Error(msg) + } +} + +func TestDML(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + // Function that reads a single row's first name from within a transaction. + readFirstName := func(tx *ReadWriteTransaction, key int) (string, error) { + row, err := tx.ReadRow(ctx, "Singers", Key{key}, []string{"FirstName"}) + if err != nil { + return "", err + } + var fn string + if err := row.Column(0, &fn); err != nil { + return "", err + } + return fn, nil + } + + // Function that reads multiple rows' first names from outside a read/write transaction. + readFirstNames := func(keys ...int) []string { + var ks []KeySet + for _, k := range keys { + ks = append(ks, Key{k}) + } + iter := client.Single().Read(ctx, "Singers", KeySets(ks...), []string{"FirstName"}) + var got []string + var fn string + err := iter.Do(func(row *Row) error { + if err := row.Column(0, &fn); err != nil { + return err + } + got = append(got, fn) + return nil + }) + if err != nil { + t.Fatalf("readFirstNames(%v): %v", keys, err) + } + return got + } + + // Use ReadWriteTransaction.Query to execute a DML statement. + _, err := client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + iter := tx.Query(ctx, Statement{ + SQL: `INSERT INTO Singers (SingerId, FirstName, LastName) VALUES (1, "Umm", "Kulthum")`, + }) + defer iter.Stop() + if row, err := iter.Next(); err != iterator.Done { + t.Fatalf("got results from iterator, want none: %#v, err = %v\n", row, err) + } + if iter.RowCount != 1 { + t.Errorf("row count: got %d, want 1", iter.RowCount) + } + // The results of the DML statement should be visible to the transaction. + got, err := readFirstName(tx, 1) + if err != nil { + return err + } + if want := "Umm"; got != want { + t.Errorf("got %q, want %q", got, want) + } + return nil + }) + if err != nil { + t.Fatal(err) + } + + // Use ReadWriteTransaction.Update to execute a DML statement. + _, err = client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + count, err := tx.Update(ctx, Statement{ + SQL: `Insert INTO Singers (SingerId, FirstName, LastName) VALUES (2, "Eduard", "Khil")`, + }) + if err != nil { + t.Fatal(err) + } + if count != 1 { + t.Errorf("row count: got %d, want 1", count) + } + got, err := readFirstName(tx, 2) + if err != nil { + return err + } + if want := "Eduard"; got != want { + t.Errorf("got %q, want %q", got, want) + } + return nil + + }) + if err != nil { + t.Fatal(err) + } + + // Roll back a DML statement and confirm that it didn't happen. + var fail = errors.New("fail") + _, err = client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + _, err := tx.Update(ctx, Statement{ + SQL: `INSERT INTO Singers (SingerId, FirstName, LastName) VALUES (3, "Audra", "McDonald")`, + }) + if err != nil { + return err + } + return fail + }) + if err != fail { + t.Fatalf("rolling back: got error %v, want the error 'fail'", err) + } + _, err = client.Single().ReadRow(ctx, "Singers", Key{3}, []string{"FirstName"}) + if got, want := ErrCode(err), codes.NotFound; got != want { + t.Errorf("got %s, want %s", got, want) + } + + // Run two DML statements in the same transaction. + _, err = client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + _, err := tx.Update(ctx, Statement{SQL: `UPDATE Singers SET FirstName = "Oum" WHERE SingerId = 1`}) + if err != nil { + return err + } + _, err = tx.Update(ctx, Statement{SQL: `UPDATE Singers SET FirstName = "Eddie" WHERE SingerId = 2`}) + if err != nil { + return err + } + return nil + }) + if err != nil { + t.Fatal(err) + } + got := readFirstNames(1, 2) + want := []string{"Oum", "Eddie"} + if !testEqual(got, want) { + t.Errorf("got %v, want %v", got, want) + } + + // Run a DML statement and an ordinary mutation in the same transaction. + _, err = client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + _, err := tx.Update(ctx, Statement{ + SQL: `INSERT INTO Singers (SingerId, FirstName, LastName) VALUES (3, "Audra", "McDonald")`, + }) + if err != nil { + return err + } + tx.BufferWrite([]*Mutation{ + Insert("Singers", []string{"SingerId", "FirstName", "LastName"}, + []interface{}{4, "Andy", "Irvine"}), + }) + return nil + }) + if err != nil { + t.Fatal(err) + } + got = readFirstNames(3, 4) + want = []string{"Audra", "Andy"} + if !testEqual(got, want) { + t.Errorf("got %v, want %v", got, want) + } + + // Attempt to run a query using update. + _, err = client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error { + _, err := tx.Update(ctx, Statement{SQL: `SELECT FirstName from Singers`}) + return err + }) + if got, want := ErrCode(err), codes.InvalidArgument; got != want { + t.Errorf("got %s, want %s", got, want) + } +} + +func TestPDML(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + client, _, cleanup := prepare(ctx, t, singerDBStatements) + defer cleanup() + + columns := []string{"SingerId", "FirstName", "LastName"} + + // Populate the Singers table. + var muts []*Mutation + for _, row := range [][]interface{}{ + {1, "Umm", "Kulthum"}, + {2, "Eduard", "Khil"}, + {3, "Audra", "McDonald"}, + } { + muts = append(muts, Insert("Singers", columns, row)) + } + if _, err := client.Apply(ctx, muts); err != nil { + t.Fatal(err) + } + // Identifiers in PDML statements must be fully qualified. + // TODO(jba): revisit the above. + count, err := client.PartitionedUpdate(ctx, Statement{ + SQL: `UPDATE Singers SET Singers.FirstName = "changed" WHERE Singers.SingerId >= 1 AND Singers.SingerId <= 3`, + }) + if err != nil { + t.Fatal(err) + } + if want := int64(3); count != want { + t.Errorf("got %d, want %d", count, want) + } + got, err := readAll(client.Single().Read(ctx, "Singers", AllKeys(), columns)) + if err != nil { + t.Fatal(err) + } + want := [][]interface{}{ + {int64(1), "changed", "Kulthum"}, + {int64(2), "changed", "Khil"}, + {int64(3), "changed", "McDonald"}, + } + if !testEqual(got, want) { + t.Errorf("\ngot %v\nwant%v", got, want) + } +} + +// Prepare initializes Cloud Spanner testing DB and clients. +func prepare(ctx context.Context, t *testing.T, statements []string) (*Client, string, func()) { + if admin == nil { + t.Skip("Integration tests skipped") + } + // Construct a unique test DB name. + dbName := dbNameSpace.New() + + dbPath := fmt.Sprintf("projects/%v/instances/%v/databases/%v", testProjectID, testInstanceID, dbName) + // Create database and tables. + op, err := admin.CreateDatabase(ctx, &adminpb.CreateDatabaseRequest{ + Parent: fmt.Sprintf("projects/%v/instances/%v", testProjectID, testInstanceID), + CreateStatement: "CREATE DATABASE " + dbName, + ExtraStatements: statements, + }) + if err != nil { + t.Fatalf("cannot create testing DB %v: %v", dbPath, err) + } + if _, err := op.Wait(ctx); err != nil { + t.Fatalf("cannot create testing DB %v: %v", dbPath, err) + } + client, err := createClient(ctx, dbPath) + if err != nil { + t.Fatalf("cannot create data client on DB %v: %v", dbPath, err) + } + return client, dbPath, func() { + client.Close() + if err := admin.DropDatabase(ctx, &adminpb.DropDatabaseRequest{Database: dbPath}); err != nil { + t.Logf("failed to drop database %s (error %v), might need a manual removal", + dbPath, err) + } + } +} + +func cleanupDatabases() { + if admin == nil { + // Integration tests skipped. + return + } + + ctx := context.Background() + dbsParent := fmt.Sprintf("projects/%v/instances/%v", testProjectID, testInstanceID) + dbsIter := admin.ListDatabases(ctx, &adminpb.ListDatabasesRequest{Parent: dbsParent}) + expireAge := 24 * time.Hour + + for { + db, err := dbsIter.Next() + if err == iterator.Done { + break + } + if err != nil { + panic(err) + } + // TODO(deklerk) When we have the ability to programmatically create + // instances, we can create an instance with uid.New and delete all + // tables in it. For now, we rely on matching prefixes. + if dbNameSpace.Older(db.Name, expireAge) { + log.Printf("Dropping database %s", db.Name) + + if err := admin.DropDatabase(ctx, &adminpb.DropDatabaseRequest{Database: db.Name}); err != nil { + log.Printf("failed to drop database %s (error %v), might need a manual removal", + db.Name, err) + } + } + } +} + +func rangeReads(ctx context.Context, t *testing.T, client *Client) { + checkRange := func(ks KeySet, wantNums ...int) { + if msg, ok := compareRows(client.Single().Read(ctx, testTable, ks, testTableColumns), wantNums); !ok { + t.Errorf("key set %+v: %s", ks, msg) + } + } + + checkRange(Key{"k1"}, 1) + checkRange(KeyRange{Key{"k3"}, Key{"k5"}, ClosedOpen}, 3, 4) + checkRange(KeyRange{Key{"k3"}, Key{"k5"}, ClosedClosed}, 3, 4, 5) + checkRange(KeyRange{Key{"k3"}, Key{"k5"}, OpenClosed}, 4, 5) + checkRange(KeyRange{Key{"k3"}, Key{"k5"}, OpenOpen}, 4) + + // Partial key specification. + checkRange(KeyRange{Key{"k7"}, Key{}, ClosedClosed}, 7, 8, 9) + checkRange(KeyRange{Key{"k7"}, Key{}, OpenClosed}, 8, 9) + checkRange(KeyRange{Key{}, Key{"k11"}, ClosedOpen}, 0, 1, 10) + checkRange(KeyRange{Key{}, Key{"k11"}, ClosedClosed}, 0, 1, 10, 11) + + // The following produce empty ranges. + // TODO(jba): Consider a multi-part key to illustrate partial key behavior. + // checkRange(KeyRange{Key{"k7"}, Key{}, ClosedOpen}) + // checkRange(KeyRange{Key{"k7"}, Key{}, OpenOpen}) + // checkRange(KeyRange{Key{}, Key{"k11"}, OpenOpen}) + // checkRange(KeyRange{Key{}, Key{"k11"}, OpenClosed}) + + // Prefix is component-wise, not string prefix. + checkRange(Key{"k1"}.AsPrefix(), 1) + checkRange(KeyRange{Key{"k1"}, Key{"k2"}, ClosedOpen}, 1, 10, 11, 12, 13, 14) + + checkRange(AllKeys(), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) +} + +func indexRangeReads(ctx context.Context, t *testing.T, client *Client) { + checkRange := func(ks KeySet, wantNums ...int) { + if msg, ok := compareRows(client.Single().ReadUsingIndex(ctx, testTable, testTableIndex, ks, testTableColumns), + wantNums); !ok { + t.Errorf("key set %+v: %s", ks, msg) + } + } + + checkRange(Key{"v1"}, 1) + checkRange(KeyRange{Key{"v3"}, Key{"v5"}, ClosedOpen}, 3, 4) + checkRange(KeyRange{Key{"v3"}, Key{"v5"}, ClosedClosed}, 3, 4, 5) + checkRange(KeyRange{Key{"v3"}, Key{"v5"}, OpenClosed}, 4, 5) + checkRange(KeyRange{Key{"v3"}, Key{"v5"}, OpenOpen}, 4) + + // // Partial key specification. + checkRange(KeyRange{Key{"v7"}, Key{}, ClosedClosed}, 7, 8, 9) + checkRange(KeyRange{Key{"v7"}, Key{}, OpenClosed}, 8, 9) + checkRange(KeyRange{Key{}, Key{"v11"}, ClosedOpen}, 0, 1, 10) + checkRange(KeyRange{Key{}, Key{"v11"}, ClosedClosed}, 0, 1, 10, 11) + + // // The following produce empty ranges. + // checkRange(KeyRange{Key{"v7"}, Key{}, ClosedOpen}) + // checkRange(KeyRange{Key{"v7"}, Key{}, OpenOpen}) + // checkRange(KeyRange{Key{}, Key{"v11"}, OpenOpen}) + // checkRange(KeyRange{Key{}, Key{"v11"}, OpenClosed}) + + // // Prefix is component-wise, not string prefix. + checkRange(Key{"v1"}.AsPrefix(), 1) + checkRange(KeyRange{Key{"v1"}, Key{"v2"}, ClosedOpen}, 1, 10, 11, 12, 13, 14) + checkRange(AllKeys(), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) + + // Read from an index with DESC ordering. + wantNums := []int{14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0} + if msg, ok := compareRows(client.Single().ReadUsingIndex(ctx, testTable, "TestTableByValueDesc", AllKeys(), testTableColumns), + wantNums); !ok { + t.Errorf("desc: %s", msg) + } +} + +type testTableRow struct{ Key, StringValue string } + +func compareRows(iter *RowIterator, wantNums []int) (string, bool) { + rows, err := readAllTestTable(iter) + if err != nil { + return err.Error(), false + } + want := map[string]string{} + for _, n := range wantNums { + want[fmt.Sprintf("k%d", n)] = fmt.Sprintf("v%d", n) + } + got := map[string]string{} + for _, r := range rows { + got[r.Key] = r.StringValue + } + if !testEqual(got, want) { + return fmt.Sprintf("got %v, want %v", got, want), false + } + return "", true +} + +func isNaN(x interface{}) bool { + f, ok := x.(float64) + if !ok { + return false + } + return math.IsNaN(f) +} + +// createClient creates Cloud Spanner data client. +func createClient(ctx context.Context, dbPath string) (client *Client, err error) { + client, err = NewClientWithConfig(ctx, dbPath, ClientConfig{ + SessionPoolConfig: SessionPoolConfig{WriteSessions: 0.2}, + }, option.WithTokenSource(testutil.TokenSource(ctx, Scope)), option.WithEndpoint(endpoint)) + if err != nil { + return nil, fmt.Errorf("cannot create data client on DB %v: %v", dbPath, err) + } + return client, nil +} + +// populate prepares the database with some data. +func populate(ctx context.Context, client *Client) error { + // Populate data + var err error + m := InsertMap("test", map[string]interface{}{ + "a": str1, + "b": str2, + }) + _, err = client.Apply(ctx, []*Mutation{m}) + return err +} + +func matchError(got error, wantCode codes.Code, wantMsgPart string) (string, bool) { + if ErrCode(got) != wantCode || !strings.Contains(strings.ToLower(ErrDesc(got)), strings.ToLower(wantMsgPart)) { + return fmt.Sprintf("got error <%v>\n"+`want `, got, wantCode, wantMsgPart), false + } + return "", true +} + +func rowToValues(r *Row) ([]interface{}, error) { + var x int64 + var y, z string + if err := r.Column(0, &x); err != nil { + return nil, err + } + if err := r.Column(1, &y); err != nil { + return nil, err + } + if err := r.Column(2, &z); err != nil { + return nil, err + } + return []interface{}{x, y, z}, nil +} + +func readAll(iter *RowIterator) ([][]interface{}, error) { + defer iter.Stop() + var vals [][]interface{} + for { + row, err := iter.Next() + if err == iterator.Done { + return vals, nil + } + if err != nil { + return nil, err + } + v, err := rowToValues(row) + if err != nil { + return nil, err + } + vals = append(vals, v) + } +} + +func readAllTestTable(iter *RowIterator) ([]testTableRow, error) { + defer iter.Stop() + var vals []testTableRow + for { + row, err := iter.Next() + if err == iterator.Done { + return vals, nil + } + if err != nil { + return nil, err + } + var ttr testTableRow + if err := row.ToStruct(&ttr); err != nil { + return nil, err + } + vals = append(vals, ttr) + } +} diff --git a/vendor/cloud.google.com/go/spanner/internal/testutil/mockclient.go b/vendor/cloud.google.com/go/spanner/internal/testutil/mockclient.go new file mode 100644 index 000000000..c2d498afc --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/internal/testutil/mockclient.go @@ -0,0 +1,381 @@ +/* +Copyright 2017 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 testutil + +import ( + "context" + "errors" + "fmt" + "sync" + "testing" + "time" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/empty" + proto3 "github.com/golang/protobuf/ptypes/struct" + pbt "github.com/golang/protobuf/ptypes/timestamp" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Action is a mocked RPC activity that MockCloudSpannerClient will take. +type Action struct { + Method string + Err error +} + +// MockCloudSpannerClient is a mock implementation of sppb.SpannerClient. +type MockCloudSpannerClient struct { + sppb.SpannerClient + + mu sync.Mutex + t *testing.T + // Live sessions on the client. + sessions map[string]bool + // Expected set of actions that will be executed by the client. + actions []Action + // Session ping history. + pings []string + // Injected error, will be returned by all APIs. + injErr map[string]error + // Client will not fail on any request. + nice bool + // Client will stall on any requests. + freezed chan struct{} +} + +// NewMockCloudSpannerClient creates new MockCloudSpannerClient instance. +func NewMockCloudSpannerClient(t *testing.T, acts ...Action) *MockCloudSpannerClient { + mc := &MockCloudSpannerClient{t: t, sessions: map[string]bool{}, injErr: map[string]error{}} + mc.SetActions(acts...) + // Produce a closed channel, so the default action of ready is to not block. + mc.Freeze() + mc.Unfreeze() + return mc +} + +// MakeNice makes this a nice mock which will not fail on any request. +func (m *MockCloudSpannerClient) MakeNice() { + m.mu.Lock() + defer m.mu.Unlock() + m.nice = true +} + +// MakeStrict makes this a strict mock which will fail on any unexpected request. +func (m *MockCloudSpannerClient) MakeStrict() { + m.mu.Lock() + defer m.mu.Unlock() + m.nice = false +} + +// InjectError injects a global error that will be returned by all calls to method +// regardless of the actions array. +func (m *MockCloudSpannerClient) InjectError(method string, err error) { + m.mu.Lock() + defer m.mu.Unlock() + m.injErr[method] = err +} + +// SetActions sets the new set of expected actions to MockCloudSpannerClient. +func (m *MockCloudSpannerClient) SetActions(acts ...Action) { + m.mu.Lock() + defer m.mu.Unlock() + m.actions = nil + for _, act := range acts { + m.actions = append(m.actions, act) + } +} + +// DumpPings dumps the ping history. +func (m *MockCloudSpannerClient) DumpPings() []string { + m.mu.Lock() + defer m.mu.Unlock() + return append([]string(nil), m.pings...) +} + +// DumpSessions dumps the internal session table. +func (m *MockCloudSpannerClient) DumpSessions() map[string]bool { + m.mu.Lock() + defer m.mu.Unlock() + st := map[string]bool{} + for s, v := range m.sessions { + st[s] = v + } + return st +} + +// CreateSession is a placeholder for SpannerClient.CreateSession. +func (m *MockCloudSpannerClient) CreateSession(c context.Context, r *sppb.CreateSessionRequest, opts ...grpc.CallOption) (*sppb.Session, error) { + m.ready() + m.mu.Lock() + defer m.mu.Unlock() + if err := m.injErr["CreateSession"]; err != nil { + return nil, err + } + s := &sppb.Session{} + if r.Database != "mockdb" { + // Reject other databases + return s, status.Errorf(codes.NotFound, fmt.Sprintf("database not found: %v", r.Database)) + } + // Generate & record session name. + s.Name = fmt.Sprintf("mockdb-%v", time.Now().UnixNano()) + m.sessions[s.Name] = true + return s, nil +} + +// GetSession is a placeholder for SpannerClient.GetSession. +func (m *MockCloudSpannerClient) GetSession(c context.Context, r *sppb.GetSessionRequest, opts ...grpc.CallOption) (*sppb.Session, error) { + m.ready() + m.mu.Lock() + defer m.mu.Unlock() + if err := m.injErr["GetSession"]; err != nil { + return nil, err + } + m.pings = append(m.pings, r.Name) + if _, ok := m.sessions[r.Name]; !ok { + return nil, status.Errorf(codes.NotFound, fmt.Sprintf("Session not found: %v", r.Name)) + } + return &sppb.Session{Name: r.Name}, nil +} + +// DeleteSession is a placeholder for SpannerClient.DeleteSession. +func (m *MockCloudSpannerClient) DeleteSession(c context.Context, r *sppb.DeleteSessionRequest, opts ...grpc.CallOption) (*empty.Empty, error) { + m.ready() + m.mu.Lock() + defer m.mu.Unlock() + if err := m.injErr["DeleteSession"]; err != nil { + return nil, err + } + if _, ok := m.sessions[r.Name]; !ok { + // Session not found. + return &empty.Empty{}, status.Errorf(codes.NotFound, fmt.Sprintf("Session not found: %v", r.Name)) + } + // Delete session from in-memory table. + delete(m.sessions, r.Name) + return &empty.Empty{}, nil +} + +// ExecuteStreamingSql is a mock implementation of SpannerClient.ExecuteStreamingSql. +func (m *MockCloudSpannerClient) ExecuteStreamingSql(c context.Context, r *sppb.ExecuteSqlRequest, opts ...grpc.CallOption) (sppb.Spanner_ExecuteStreamingSqlClient, error) { + m.ready() + m.mu.Lock() + defer m.mu.Unlock() + act, err := m.expectAction("ExecuteStreamingSql") + if err != nil { + return nil, err + } + wantReq := &sppb.ExecuteSqlRequest{ + Session: "mocksession", + Transaction: &sppb.TransactionSelector{ + Selector: &sppb.TransactionSelector_SingleUse{ + SingleUse: &sppb.TransactionOptions{ + Mode: &sppb.TransactionOptions_ReadOnly_{ + ReadOnly: &sppb.TransactionOptions_ReadOnly{ + TimestampBound: &sppb.TransactionOptions_ReadOnly_Strong{ + Strong: true, + }, + ReturnReadTimestamp: false, + }, + }, + }, + }, + }, + Sql: "mockquery", + Params: &proto3.Struct{ + Fields: map[string]*proto3.Value{"var1": {Kind: &proto3.Value_StringValue{StringValue: "abc"}}}, + }, + ParamTypes: map[string]*sppb.Type{"var1": {Code: sppb.TypeCode_STRING}}, + } + if !proto.Equal(r, wantReq) { + return nil, fmt.Errorf("got query request: %v, want: %v", r, wantReq) + } + if act.Err != nil { + return nil, act.Err + } + return nil, errors.New("query never succeeds on mock client") +} + +// StreamingRead is a placeholder for SpannerClient.StreamingRead. +func (m *MockCloudSpannerClient) StreamingRead(c context.Context, r *sppb.ReadRequest, opts ...grpc.CallOption) (sppb.Spanner_StreamingReadClient, error) { + m.ready() + m.mu.Lock() + defer m.mu.Unlock() + act, err := m.expectAction("StreamingRead", "StreamingReadIndex") + if err != nil { + return nil, err + } + wantReq := &sppb.ReadRequest{ + Session: "mocksession", + Transaction: &sppb.TransactionSelector{ + Selector: &sppb.TransactionSelector_SingleUse{ + SingleUse: &sppb.TransactionOptions{ + Mode: &sppb.TransactionOptions_ReadOnly_{ + ReadOnly: &sppb.TransactionOptions_ReadOnly{ + TimestampBound: &sppb.TransactionOptions_ReadOnly_Strong{ + Strong: true, + }, + ReturnReadTimestamp: false, + }, + }, + }, + }, + }, + Table: "t_mock", + Columns: []string{"col1", "col2"}, + KeySet: &sppb.KeySet{ + Keys: []*proto3.ListValue{ + { + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "foo"}}, + }, + }, + }, + Ranges: []*sppb.KeyRange{}, + All: false, + }, + } + if act.Method == "StreamingIndexRead" { + wantReq.Index = "idx1" + } + if !proto.Equal(r, wantReq) { + return nil, fmt.Errorf("got query request: %v, want: %v", r, wantReq) + } + if act.Err != nil { + return nil, act.Err + } + return nil, errors.New("read never succeeds on mock client") +} + +// BeginTransaction is a placeholder for SpannerClient.BeginTransaction. +func (m *MockCloudSpannerClient) BeginTransaction(c context.Context, r *sppb.BeginTransactionRequest, opts ...grpc.CallOption) (*sppb.Transaction, error) { + m.ready() + m.mu.Lock() + defer m.mu.Unlock() + if !m.nice { + act, err := m.expectAction("BeginTransaction") + if err != nil { + return nil, err + } + if act.Err != nil { + return nil, act.Err + } + } + resp := &sppb.Transaction{Id: []byte("transaction-1")} + if _, ok := r.Options.Mode.(*sppb.TransactionOptions_ReadOnly_); ok { + resp.ReadTimestamp = &pbt.Timestamp{Seconds: 3, Nanos: 4} + } + return resp, nil +} + +// Commit is a placeholder for SpannerClient.Commit. +func (m *MockCloudSpannerClient) Commit(c context.Context, r *sppb.CommitRequest, opts ...grpc.CallOption) (*sppb.CommitResponse, error) { + m.ready() + m.mu.Lock() + defer m.mu.Unlock() + if !m.nice { + act, err := m.expectAction("Commit") + if err != nil { + return nil, err + } + if act.Err != nil { + return nil, act.Err + } + } + return &sppb.CommitResponse{CommitTimestamp: &pbt.Timestamp{Seconds: 1, Nanos: 2}}, nil +} + +// Rollback is a placeholder for SpannerClient.Rollback. +func (m *MockCloudSpannerClient) Rollback(c context.Context, r *sppb.RollbackRequest, opts ...grpc.CallOption) (*empty.Empty, error) { + m.ready() + m.mu.Lock() + defer m.mu.Unlock() + if !m.nice { + act, err := m.expectAction("Rollback") + if err != nil { + return nil, err + } + if act.Err != nil { + return nil, act.Err + } + } + return nil, nil +} + +// PartitionQuery is a placeholder for SpannerServer.PartitionQuery. +func (m *MockCloudSpannerClient) PartitionQuery(ctx context.Context, r *sppb.PartitionQueryRequest, opts ...grpc.CallOption) (*sppb.PartitionResponse, error) { + m.ready() + return nil, errors.New("Unimplemented") +} + +// PartitionRead is a placeholder for SpannerServer.PartitionRead. +func (m *MockCloudSpannerClient) PartitionRead(ctx context.Context, r *sppb.PartitionReadRequest, opts ...grpc.CallOption) (*sppb.PartitionResponse, error) { + m.ready() + return nil, errors.New("Unimplemented") +} + +func (m *MockCloudSpannerClient) expectAction(methods ...string) (Action, error) { + for _, me := range methods { + if err := m.injErr[me]; err != nil { + return Action{}, err + } + } + if len(m.actions) == 0 { + m.t.Fatalf("unexpected %v executed", methods) + } + act := m.actions[0] + m.actions = m.actions[1:] + for _, me := range methods { + if me == act.Method { + return act, nil + } + } + m.t.Fatalf("unexpected call of one of %v, want method %s", methods, act.Method) + return Action{}, nil +} + +// Freeze stalls all requests. +func (m *MockCloudSpannerClient) Freeze() { + m.mu.Lock() + defer m.mu.Unlock() + m.freezed = make(chan struct{}) +} + +// Unfreeze restores processing requests. +func (m *MockCloudSpannerClient) Unfreeze() { + m.mu.Lock() + defer m.mu.Unlock() + close(m.freezed) +} + +// CheckActionsConsumed checks that all actions have been consumed. +func (m *MockCloudSpannerClient) CheckActionsConsumed() { + if len(m.actions) != 0 { + m.t.Fatalf("unconsumed mock client actions: %v", m.actions) + } +} + +// ready checks conditions before executing requests +// TODO: add checks for injected errors, actions +func (m *MockCloudSpannerClient) ready() { + m.mu.Lock() + freezed := m.freezed + m.mu.Unlock() + // check if client should be freezed + <-freezed +} diff --git a/vendor/cloud.google.com/go/spanner/internal/testutil/mockserver.go b/vendor/cloud.google.com/go/spanner/internal/testutil/mockserver.go new file mode 100644 index 000000000..b5a6f5e50 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/internal/testutil/mockserver.go @@ -0,0 +1,265 @@ +/* +Copyright 2017 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 testutil + +import ( + "context" + "encoding/binary" + "fmt" + "io" + "net" + "sync" + "testing" + "time" + + "github.com/golang/protobuf/ptypes/empty" + proto3 "github.com/golang/protobuf/ptypes/struct" + pbt "github.com/golang/protobuf/ptypes/timestamp" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var ( + // KvMeta is the Metadata for mocked KV table. + KvMeta = sppb.ResultSetMetadata{ + RowType: &sppb.StructType{ + Fields: []*sppb.StructType_Field{ + { + Name: "Key", + Type: &sppb.Type{Code: sppb.TypeCode_STRING}, + }, + { + Name: "Value", + Type: &sppb.Type{Code: sppb.TypeCode_STRING}, + }, + }, + }, + } +) + +// MockCtlMsg encapsulates PartialResultSet/error that might be sent to +// client +type MockCtlMsg struct { + // If ResumeToken == true, mock server will generate a row with + // resume token. + ResumeToken bool + // If Err != nil, mock server will return error in RPC response. + Err error +} + +// MockCloudSpanner is a mock implementation of SpannerServer interface. +// TODO: make MockCloudSpanner a full-fleged Cloud Spanner implementation. +type MockCloudSpanner struct { + sppb.SpannerServer + + s *grpc.Server + t *testing.T + addr string + msgs chan MockCtlMsg + readTs time.Time + + mu sync.Mutex + next int + nextSession int + sessions map[string]*sppb.Session +} + +// Addr returns the listening address of mock server. +func (m *MockCloudSpanner) Addr() string { + return m.addr +} + +// AddMsg generates a new mocked row which can be received by client. +func (m *MockCloudSpanner) AddMsg(err error, resumeToken bool) { + msg := MockCtlMsg{ + ResumeToken: resumeToken, + Err: err, + } + if err == io.EOF { + close(m.msgs) + } else { + m.msgs <- msg + } +} + +// Done signals an end to a mocked stream. +func (m *MockCloudSpanner) Done() { + close(m.msgs) +} + +// CreateSession is a placeholder for SpannerServer.CreateSession. +func (m *MockCloudSpanner) CreateSession(c context.Context, r *sppb.CreateSessionRequest) (*sppb.Session, error) { + m.mu.Lock() + defer m.mu.Unlock() + name := fmt.Sprintf("session-%d", m.nextSession) + m.nextSession++ + s := &sppb.Session{Name: name} + m.sessions[name] = s + return s, nil +} + +// GetSession is a placeholder for SpannerServer.GetSession. +func (m *MockCloudSpanner) GetSession(c context.Context, r *sppb.GetSessionRequest) (*sppb.Session, error) { + m.mu.Lock() + defer m.mu.Unlock() + if s, ok := m.sessions[r.Name]; ok { + return s, nil + } + return nil, status.Errorf(codes.NotFound, "not found") +} + +// DeleteSession is a placeholder for SpannerServer.DeleteSession. +func (m *MockCloudSpanner) DeleteSession(c context.Context, r *sppb.DeleteSessionRequest) (*empty.Empty, error) { + m.mu.Lock() + defer m.mu.Unlock() + delete(m.sessions, r.Name) + return &empty.Empty{}, nil +} + +// EncodeResumeToken return mock resume token encoding for an uint64 integer. +func EncodeResumeToken(t uint64) []byte { + rt := make([]byte, 16) + binary.PutUvarint(rt, t) + return rt +} + +// DecodeResumeToken decodes a mock resume token into an uint64 integer. +func DecodeResumeToken(t []byte) (uint64, error) { + s, n := binary.Uvarint(t) + if n <= 0 { + return 0, fmt.Errorf("invalid resume token: %v", t) + } + return s, nil +} + +// ExecuteStreamingSql is a mock implementation of SpannerServer.ExecuteStreamingSql. +func (m *MockCloudSpanner) ExecuteStreamingSql(r *sppb.ExecuteSqlRequest, s sppb.Spanner_ExecuteStreamingSqlServer) error { + switch r.Sql { + case "SELECT * from t_unavailable": + return status.Errorf(codes.Unavailable, "mock table unavailable") + + case "UPDATE t SET x = 2 WHERE x = 1": + err := s.Send(&sppb.PartialResultSet{ + Stats: &sppb.ResultSetStats{RowCount: &sppb.ResultSetStats_RowCountLowerBound{3}}, + }) + if err != nil { + panic(err) + } + return nil + + case "SELECT t.key key, t.value value FROM t_mock t": + if r.ResumeToken != nil { + s, err := DecodeResumeToken(r.ResumeToken) + if err != nil { + return err + } + m.mu.Lock() + m.next = int(s) + 1 + m.mu.Unlock() + } + for { + msg, more := <-m.msgs + if !more { + break + } + if msg.Err == nil { + var rt []byte + if msg.ResumeToken { + m.mu.Lock() + rt = EncodeResumeToken(uint64(m.next)) + m.mu.Unlock() + } + meta := KvMeta + meta.Transaction = &sppb.Transaction{ + ReadTimestamp: &pbt.Timestamp{ + Seconds: m.readTs.Unix(), + Nanos: int32(m.readTs.Nanosecond()), + }, + } + m.mu.Lock() + next := m.next + m.next++ + m.mu.Unlock() + err := s.Send(&sppb.PartialResultSet{ + Metadata: &meta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: fmt.Sprintf("foo-%02d", next)}}, + {Kind: &proto3.Value_StringValue{StringValue: fmt.Sprintf("bar-%02d", next)}}, + }, + ResumeToken: rt, + }) + if err != nil { + return err + } + continue + } + return msg.Err + } + return nil + default: + return fmt.Errorf("unsupported SQL: %v", r.Sql) + } +} + +// StreamingRead is a placeholder for SpannerServer.StreamingRead. +func (m *MockCloudSpanner) StreamingRead(r *sppb.ReadRequest, s sppb.Spanner_StreamingReadServer) error { + return s.Send(&sppb.PartialResultSet{}) +} + +// Serve runs a MockCloudSpanner listening on a random localhost address. +func (m *MockCloudSpanner) Serve() { + m.s = grpc.NewServer() + if m.addr == "" { + m.addr = "localhost:0" + } + lis, err := net.Listen("tcp", m.addr) + if err != nil { + m.t.Fatalf("Failed to listen: %v", err) + } + _, port, err := net.SplitHostPort(lis.Addr().String()) + if err != nil { + m.t.Fatalf("Failed to parse listener address: %v", err) + } + sppb.RegisterSpannerServer(m.s, m) + m.addr = "localhost:" + port + go m.s.Serve(lis) +} + +// BeginTransaction is a placeholder for SpannerServer.BeginTransaction. +func (m *MockCloudSpanner) BeginTransaction(_ context.Context, r *sppb.BeginTransactionRequest) (*sppb.Transaction, error) { + m.mu.Lock() + defer m.mu.Unlock() + return &sppb.Transaction{}, nil +} + +// Stop terminates MockCloudSpanner and closes the serving port. +func (m *MockCloudSpanner) Stop() { + m.s.Stop() +} + +// NewMockCloudSpanner creates a new MockCloudSpanner instance. +func NewMockCloudSpanner(t *testing.T, ts time.Time) *MockCloudSpanner { + mcs := &MockCloudSpanner{ + t: t, + msgs: make(chan MockCtlMsg, 1000), + readTs: ts, + sessions: map[string]*sppb.Session{}, + } + return mcs +} diff --git a/vendor/cloud.google.com/go/spanner/key.go b/vendor/cloud.google.com/go/spanner/key.go new file mode 100644 index 000000000..60344e75a --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/key.go @@ -0,0 +1,397 @@ +/* +Copyright 2017 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 spanner + +import ( + "bytes" + "fmt" + "time" + + "cloud.google.com/go/civil" + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" +) + +// A Key can be either a Cloud Spanner row's primary key or a secondary index key. +// It is essentially an interface{} array, which represents a set of Cloud Spanner +// columns. A Key can be used as: +// +// - A primary key which uniquely identifies a Cloud Spanner row. +// - A secondary index key which maps to a set of Cloud Spanner rows indexed under it. +// - An endpoint of primary key/secondary index ranges; see the KeyRange type. +// +// Rows that are identified by the Key type are outputs of read operation or targets of +// delete operation in a mutation. Note that for Insert/Update/InsertOrUpdate/Update +// mutation types, although they don't require a primary key explicitly, the column list +// provided must contain enough columns that can comprise a primary key. +// +// Keys are easy to construct. For example, suppose you have a table with a +// primary key of username and product ID. To make a key for this table: +// +// key := spanner.Key{"john", 16} +// +// See the description of Row and Mutation types for how Go types are +// mapped to Cloud Spanner types. For convenience, Key type supports a wide range +// of Go types: +// - int, int8, int16, int32, int64, and NullInt64 are mapped to Cloud Spanner's INT64 type. +// - uint8, uint16 and uint32 are also mapped to Cloud Spanner's INT64 type. +// - float32, float64, NullFloat64 are mapped to Cloud Spanner's FLOAT64 type. +// - bool and NullBool are mapped to Cloud Spanner's BOOL type. +// - []byte is mapped to Cloud Spanner's BYTES type. +// - string and NullString are mapped to Cloud Spanner's STRING type. +// - time.Time and NullTime are mapped to Cloud Spanner's TIMESTAMP type. +// - civil.Date and NullDate are mapped to Cloud Spanner's DATE type. +type Key []interface{} + +// errInvdKeyPartType returns error for unsupported key part type. +func errInvdKeyPartType(part interface{}) error { + return spannerErrorf(codes.InvalidArgument, "key part has unsupported type %T", part) +} + +// keyPartValue converts a part of the Key (which is a valid Cloud Spanner type) +// into a proto3.Value. Used for encoding Key type into protobuf. +func keyPartValue(part interface{}) (pb *proto3.Value, err error) { + switch v := part.(type) { + case int: + pb, _, err = encodeValue(int64(v)) + case int8: + pb, _, err = encodeValue(int64(v)) + case int16: + pb, _, err = encodeValue(int64(v)) + case int32: + pb, _, err = encodeValue(int64(v)) + case uint8: + pb, _, err = encodeValue(int64(v)) + case uint16: + pb, _, err = encodeValue(int64(v)) + case uint32: + pb, _, err = encodeValue(int64(v)) + case float32: + pb, _, err = encodeValue(float64(v)) + case int64, float64, NullInt64, NullFloat64, bool, NullBool, []byte, string, NullString, time.Time, civil.Date, NullTime, NullDate: + pb, _, err = encodeValue(v) + default: + return nil, errInvdKeyPartType(v) + } + return pb, err +} + +// proto converts a spanner.Key into a proto3.ListValue. +func (key Key) proto() (*proto3.ListValue, error) { + lv := &proto3.ListValue{} + lv.Values = make([]*proto3.Value, 0, len(key)) + for _, part := range key { + v, err := keyPartValue(part) + if err != nil { + return nil, err + } + lv.Values = append(lv.Values, v) + } + return lv, nil +} + +// keySetProto lets a single Key act as a KeySet. +func (key Key) keySetProto() (*sppb.KeySet, error) { + kp, err := key.proto() + if err != nil { + return nil, err + } + return &sppb.KeySet{Keys: []*proto3.ListValue{kp}}, nil +} + +// String implements fmt.Stringer for Key. For string, []byte and NullString, it +// prints the uninterpreted bytes of their contents, leaving caller with the +// opportunity to escape the output. +func (key Key) String() string { + b := &bytes.Buffer{} + fmt.Fprint(b, "(") + for i, part := range []interface{}(key) { + if i != 0 { + fmt.Fprint(b, ",") + } + switch v := part.(type) { + case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, float32, float64, bool: + // Use %v to print numeric types and bool. + fmt.Fprintf(b, "%v", v) + case string: + fmt.Fprintf(b, "%q", v) + case []byte: + if v != nil { + fmt.Fprintf(b, "%q", v) + } else { + fmt.Fprint(b, "") + } + case NullInt64, NullFloat64, NullBool, NullString, NullTime, NullDate: + // The above types implement fmt.Stringer. + fmt.Fprintf(b, "%s", v) + case civil.Date: + fmt.Fprintf(b, "%q", v) + case time.Time: + fmt.Fprintf(b, "%q", v.Format(time.RFC3339Nano)) + default: + fmt.Fprintf(b, "%v", v) + } + } + fmt.Fprint(b, ")") + return b.String() +} + +// AsPrefix returns a KeyRange for all keys where k is the prefix. +func (key Key) AsPrefix() KeyRange { + return KeyRange{ + Start: key, + End: key, + Kind: ClosedClosed, + } +} + +// KeyRangeKind describes the kind of interval represented by a KeyRange: +// whether it is open or closed on the left and right. +type KeyRangeKind int + +const ( + // ClosedOpen is closed on the left and open on the right: the Start + // key is included, the End key is excluded. + ClosedOpen KeyRangeKind = iota + + // ClosedClosed is closed on the left and the right: both keys are included. + ClosedClosed + + // OpenClosed is open on the left and closed on the right: the Start + // key is excluded, the End key is included. + OpenClosed + + // OpenOpen is open on the left and the right: neither key is included. + OpenOpen +) + +// A KeyRange represents a range of rows in a table or index. +// +// A range has a Start key and an End key. IncludeStart and IncludeEnd +// indicate whether the Start and End keys are included in the range. +// +// For example, consider the following table definition: +// +// CREATE TABLE UserEvents ( +// UserName STRING(MAX), +// EventDate STRING(10), +// ) PRIMARY KEY(UserName, EventDate); +// +// The following keys name rows in this table: +// +// spanner.Key{"Bob", "2014-09-23"} +// spanner.Key{"Alfred", "2015-06-12"} +// +// Since the UserEvents table's PRIMARY KEY clause names two columns, each +// UserEvents key has two elements; the first is the UserName, and the second +// is the EventDate. +// +// Key ranges with multiple components are interpreted lexicographically by +// component using the table or index key's declared sort order. For example, +// the following range returns all events for user "Bob" that occurred in the +// year 2015: +// +// spanner.KeyRange{ +// Start: spanner.Key{"Bob", "2015-01-01"}, +// End: spanner.Key{"Bob", "2015-12-31"}, +// Kind: ClosedClosed, +// } +// +// Start and end keys can omit trailing key components. This affects the +// inclusion and exclusion of rows that exactly match the provided key +// components: if IncludeStart is true, then rows that exactly match the +// provided components of the Start key are included; if IncludeStart is false +// then rows that exactly match are not included. IncludeEnd and End key +// behave in the same fashion. +// +// For example, the following range includes all events for "Bob" that occurred +// during and after the year 2000: +// +// spanner.KeyRange{ +// Start: spanner.Key{"Bob", "2000-01-01"}, +// End: spanner.Key{"Bob"}, +// Kind: ClosedClosed, +// } +// +// The next example retrieves all events for "Bob": +// +// spanner.Key{"Bob"}.AsPrefix() +// +// To retrieve events before the year 2000: +// +// spanner.KeyRange{ +// Start: spanner.Key{"Bob"}, +// End: spanner.Key{"Bob", "2000-01-01"}, +// Kind: ClosedOpen, +// } +// +// Although we specified a Kind for this KeyRange, we didn't need to, because +// the default is ClosedOpen. In later examples we'll omit Kind if it is +// ClosedOpen. +// +// The following range includes all rows in a table or under a +// index: +// +// spanner.AllKeys() +// +// This range returns all users whose UserName begins with any +// character from A to C: +// +// spanner.KeyRange{ +// Start: spanner.Key{"A"}, +// End: spanner.Key{"D"}, +// } +// +// This range returns all users whose UserName begins with B: +// +// spanner.KeyRange{ +// Start: spanner.Key{"B"}, +// End: spanner.Key{"C"}, +// } +// +// Key ranges honor column sort order. For example, suppose a table is defined +// as follows: +// +// CREATE TABLE DescendingSortedTable { +// Key INT64, +// ... +// ) PRIMARY KEY(Key DESC); +// +// The following range retrieves all rows with key values between 1 and 100 +// inclusive: +// +// spanner.KeyRange{ +// Start: spanner.Key{100}, +// End: spanner.Key{1}, +// Kind: ClosedClosed, +// } +// +// Note that 100 is passed as the start, and 1 is passed as the end, because +// Key is a descending column in the schema. +type KeyRange struct { + // Start specifies the left boundary of the key range; End specifies + // the right boundary of the key range. + Start, End Key + + // Kind describes whether the boundaries of the key range include + // their keys. + Kind KeyRangeKind +} + +// String implements fmt.Stringer for KeyRange type. +func (r KeyRange) String() string { + var left, right string + switch r.Kind { + case ClosedClosed: + left, right = "[", "]" + case ClosedOpen: + left, right = "[", ")" + case OpenClosed: + left, right = "(", "]" + case OpenOpen: + left, right = "(", ")" + default: + left, right = "?", "?" + } + return fmt.Sprintf("%s%s,%s%s", left, r.Start, r.End, right) +} + +// proto converts KeyRange into sppb.KeyRange. +func (r KeyRange) proto() (*sppb.KeyRange, error) { + var err error + var start, end *proto3.ListValue + pb := &sppb.KeyRange{} + if start, err = r.Start.proto(); err != nil { + return nil, err + } + if end, err = r.End.proto(); err != nil { + return nil, err + } + if r.Kind == ClosedClosed || r.Kind == ClosedOpen { + pb.StartKeyType = &sppb.KeyRange_StartClosed{StartClosed: start} + } else { + pb.StartKeyType = &sppb.KeyRange_StartOpen{StartOpen: start} + } + if r.Kind == ClosedClosed || r.Kind == OpenClosed { + pb.EndKeyType = &sppb.KeyRange_EndClosed{EndClosed: end} + } else { + pb.EndKeyType = &sppb.KeyRange_EndOpen{EndOpen: end} + } + return pb, nil +} + +// keySetProto lets a KeyRange act as a KeySet. +func (r KeyRange) keySetProto() (*sppb.KeySet, error) { + rp, err := r.proto() + if err != nil { + return nil, err + } + return &sppb.KeySet{Ranges: []*sppb.KeyRange{rp}}, nil +} + +// A KeySet defines a collection of Cloud Spanner keys and/or key ranges. All the +// keys are expected to be in the same table or index. The keys need not be sorted in +// any particular way. +// +// An individual Key can act as a KeySet, as can a KeyRange. Use the KeySets function +// to create a KeySet consisting of multiple Keys and KeyRanges. To obtain an empty +// KeySet, call KeySets with no arguments. +// +// If the same key is specified multiple times in the set (for example if two +// ranges, two keys, or a key and a range overlap), the Cloud Spanner backend behaves +// as if the key were only specified once. +type KeySet interface { + keySetProto() (*sppb.KeySet, error) +} + +// AllKeys returns a KeySet that represents all Keys of a table or a index. +func AllKeys() KeySet { + return all{} +} + +type all struct{} + +func (all) keySetProto() (*sppb.KeySet, error) { + return &sppb.KeySet{All: true}, nil +} + +// KeySets returns the union of the KeySets. If any of the KeySets is AllKeys, then +// the resulting KeySet will be equivalent to AllKeys. +func KeySets(keySets ...KeySet) KeySet { + u := make(union, len(keySets)) + copy(u, keySets) + return u +} + +type union []KeySet + +func (u union) keySetProto() (*sppb.KeySet, error) { + upb := &sppb.KeySet{} + for _, ks := range u { + pb, err := ks.keySetProto() + if err != nil { + return nil, err + } + if pb.All { + return pb, nil + } + upb.Keys = append(upb.Keys, pb.Keys...) + upb.Ranges = append(upb.Ranges, pb.Ranges...) + } + return upb, nil +} diff --git a/vendor/cloud.google.com/go/spanner/key_test.go b/vendor/cloud.google.com/go/spanner/key_test.go new file mode 100644 index 000000000..32b67b454 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/key_test.go @@ -0,0 +1,372 @@ +/* +Copyright 2017 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 spanner + +import ( + "testing" + "time" + + "cloud.google.com/go/civil" + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +// Test Key.String() and Key.proto(). +func TestKey(t *testing.T) { + tm, _ := time.Parse(time.RFC3339Nano, "2016-11-15T15:04:05.999999999Z") + dt, _ := civil.ParseDate("2016-11-15") + for _, test := range []struct { + k Key + wantProto *proto3.ListValue + wantStr string + }{ + { + k: Key{int(1)}, + wantProto: listValueProto(stringProto("1")), + wantStr: "(1)", + }, + { + k: Key{int8(1)}, + wantProto: listValueProto(stringProto("1")), + wantStr: "(1)", + }, + { + k: Key{int16(1)}, + wantProto: listValueProto(stringProto("1")), + wantStr: "(1)", + }, + { + k: Key{int32(1)}, + wantProto: listValueProto(stringProto("1")), + wantStr: "(1)", + }, + { + k: Key{int64(1)}, + wantProto: listValueProto(stringProto("1")), + wantStr: "(1)", + }, + { + k: Key{uint8(1)}, + wantProto: listValueProto(stringProto("1")), + wantStr: "(1)", + }, + { + k: Key{uint16(1)}, + wantProto: listValueProto(stringProto("1")), + wantStr: "(1)", + }, + { + k: Key{uint32(1)}, + wantProto: listValueProto(stringProto("1")), + wantStr: "(1)", + }, + { + k: Key{true}, + wantProto: listValueProto(boolProto(true)), + wantStr: "(true)", + }, + { + k: Key{float32(1.5)}, + wantProto: listValueProto(floatProto(1.5)), + wantStr: "(1.5)", + }, + { + k: Key{float64(1.5)}, + wantProto: listValueProto(floatProto(1.5)), + wantStr: "(1.5)", + }, + { + k: Key{"value"}, + wantProto: listValueProto(stringProto("value")), + wantStr: `("value")`, + }, + { + k: Key{[]byte(nil)}, + wantProto: listValueProto(nullProto()), + wantStr: "()", + }, + { + k: Key{[]byte{}}, + wantProto: listValueProto(stringProto("")), + wantStr: `("")`, + }, + { + k: Key{tm}, + wantProto: listValueProto(stringProto("2016-11-15T15:04:05.999999999Z")), + wantStr: `("2016-11-15T15:04:05.999999999Z")`, + }, + {k: Key{dt}, + wantProto: listValueProto(stringProto("2016-11-15")), + wantStr: `("2016-11-15")`, + }, + { + k: Key{[]byte("value")}, + wantProto: listValueProto(bytesProto([]byte("value"))), + wantStr: `("value")`, + }, + { + k: Key{NullInt64{1, true}}, + wantProto: listValueProto(stringProto("1")), + wantStr: "(1)", + }, + { + k: Key{NullInt64{2, false}}, + wantProto: listValueProto(nullProto()), + wantStr: "()", + }, + { + k: Key{NullFloat64{1.5, true}}, + wantProto: listValueProto(floatProto(1.5)), + wantStr: "(1.5)", + }, + { + k: Key{NullFloat64{2.0, false}}, + wantProto: listValueProto(nullProto()), + wantStr: "()", + }, + { + k: Key{NullBool{true, true}}, + wantProto: listValueProto(boolProto(true)), + wantStr: "(true)", + }, + { + k: Key{NullBool{true, false}}, + wantProto: listValueProto(nullProto()), + wantStr: "()", + }, + { + k: Key{NullString{"value", true}}, + wantProto: listValueProto(stringProto("value")), + wantStr: `("value")`, + }, + { + k: Key{NullString{"value", false}}, + wantProto: listValueProto(nullProto()), + wantStr: "()", + }, + { + k: Key{NullTime{tm, true}}, + wantProto: listValueProto(timeProto(tm)), + wantStr: `("2016-11-15T15:04:05.999999999Z")`, + }, + + { + k: Key{NullTime{time.Now(), false}}, + wantProto: listValueProto(nullProto()), + wantStr: "()", + }, + { + k: Key{NullDate{dt, true}}, + wantProto: listValueProto(dateProto(dt)), + wantStr: `("2016-11-15")`, + }, + { + k: Key{NullDate{civil.Date{}, false}}, + wantProto: listValueProto(nullProto()), + wantStr: "()", + }, + { + k: Key{int(1), NullString{"value", false}, "value", 1.5, true}, + wantProto: listValueProto(stringProto("1"), nullProto(), stringProto("value"), floatProto(1.5), boolProto(true)), + wantStr: `(1,,"value",1.5,true)`, + }, + } { + if got := test.k.String(); got != test.wantStr { + t.Errorf("%v.String() = %v, want %v", test.k, got, test.wantStr) + } + gotProto, err := test.k.proto() + if err != nil { + t.Errorf("%v.proto() returns error %v; want nil error", test.k, err) + } + if !testEqual(gotProto, test.wantProto) { + t.Errorf("%v.proto() = \n%v\nwant:\n%v", test.k, gotProto, test.wantProto) + } + } +} + +// Test KeyRange.String() and KeyRange.proto(). +func TestKeyRange(t *testing.T) { + for _, test := range []struct { + kr KeyRange + wantProto *sppb.KeyRange + wantStr string + }{ + { + kr: KeyRange{Key{"A"}, Key{"D"}, OpenOpen}, + wantProto: &sppb.KeyRange{ + StartKeyType: &sppb.KeyRange_StartOpen{StartOpen: listValueProto(stringProto("A"))}, + EndKeyType: &sppb.KeyRange_EndOpen{EndOpen: listValueProto(stringProto("D"))}, + }, + wantStr: `(("A"),("D"))`, + }, + { + kr: KeyRange{Key{1}, Key{10}, OpenClosed}, + wantProto: &sppb.KeyRange{ + StartKeyType: &sppb.KeyRange_StartOpen{StartOpen: listValueProto(stringProto("1"))}, + EndKeyType: &sppb.KeyRange_EndClosed{EndClosed: listValueProto(stringProto("10"))}, + }, + wantStr: "((1),(10)]", + }, + { + kr: KeyRange{Key{1.5, 2.1, 0.2}, Key{1.9, 0.7}, ClosedOpen}, + wantProto: &sppb.KeyRange{ + StartKeyType: &sppb.KeyRange_StartClosed{StartClosed: listValueProto(floatProto(1.5), floatProto(2.1), floatProto(0.2))}, + EndKeyType: &sppb.KeyRange_EndOpen{EndOpen: listValueProto(floatProto(1.9), floatProto(0.7))}, + }, + wantStr: "[(1.5,2.1,0.2),(1.9,0.7))", + }, + { + kr: KeyRange{Key{NullInt64{1, true}}, Key{10}, ClosedClosed}, + wantProto: &sppb.KeyRange{ + StartKeyType: &sppb.KeyRange_StartClosed{StartClosed: listValueProto(stringProto("1"))}, + EndKeyType: &sppb.KeyRange_EndClosed{EndClosed: listValueProto(stringProto("10"))}, + }, + wantStr: "[(1),(10)]", + }, + } { + if got := test.kr.String(); got != test.wantStr { + t.Errorf("%v.String() = %v, want %v", test.kr, got, test.wantStr) + } + gotProto, err := test.kr.proto() + if err != nil { + t.Errorf("%v.proto() returns error %v; want nil error", test.kr, err) + } + if !testEqual(gotProto, test.wantProto) { + t.Errorf("%v.proto() = \n%v\nwant:\n%v", test.kr, gotProto.String(), test.wantProto.String()) + } + } +} + +func TestPrefixRange(t *testing.T) { + got := Key{1}.AsPrefix() + want := KeyRange{Start: Key{1}, End: Key{1}, Kind: ClosedClosed} + if !testEqual(got, want) { + t.Errorf("got %v, want %v", got, want) + } +} + +func TestKeySets(t *testing.T) { + int1 := intProto(1) + int2 := intProto(2) + int3 := intProto(3) + int4 := intProto(4) + for i, test := range []struct { + ks KeySet + wantProto *sppb.KeySet + }{ + { + KeySets(), + &sppb.KeySet{}, + }, + { + Key{4}, + &sppb.KeySet{ + Keys: []*proto3.ListValue{listValueProto(int4)}, + }, + }, + { + AllKeys(), + &sppb.KeySet{All: true}, + }, + { + KeySets(Key{1, 2}, Key{3, 4}), + &sppb.KeySet{ + Keys: []*proto3.ListValue{ + listValueProto(int1, int2), + listValueProto(int3, int4), + }, + }, + }, + { + KeyRange{Key{1}, Key{2}, ClosedOpen}, + &sppb.KeySet{Ranges: []*sppb.KeyRange{ + { + StartKeyType: &sppb.KeyRange_StartClosed{StartClosed: listValueProto(int1)}, + EndKeyType: &sppb.KeyRange_EndOpen{EndOpen: listValueProto(int2)}, + }, + }}, + }, + { + Key{2}.AsPrefix(), + &sppb.KeySet{Ranges: []*sppb.KeyRange{ + { + StartKeyType: &sppb.KeyRange_StartClosed{StartClosed: listValueProto(int2)}, + EndKeyType: &sppb.KeyRange_EndClosed{EndClosed: listValueProto(int2)}, + }, + }}, + }, + { + KeySets( + KeyRange{Key{1}, Key{2}, ClosedClosed}, + KeyRange{Key{3}, Key{4}, OpenClosed}, + ), + &sppb.KeySet{ + Ranges: []*sppb.KeyRange{ + { + StartKeyType: &sppb.KeyRange_StartClosed{StartClosed: listValueProto(int1)}, + EndKeyType: &sppb.KeyRange_EndClosed{EndClosed: listValueProto(int2)}, + }, + { + StartKeyType: &sppb.KeyRange_StartOpen{StartOpen: listValueProto(int3)}, + EndKeyType: &sppb.KeyRange_EndClosed{EndClosed: listValueProto(int4)}, + }, + }, + }, + }, + { + KeySets( + Key{1}, + KeyRange{Key{2}, Key{3}, ClosedClosed}, + KeyRange{Key{4}, Key{5}, OpenClosed}, + KeySets(), + Key{6}), + &sppb.KeySet{ + Keys: []*proto3.ListValue{ + listValueProto(int1), + listValueProto(intProto(6)), + }, + Ranges: []*sppb.KeyRange{ + { + StartKeyType: &sppb.KeyRange_StartClosed{StartClosed: listValueProto(int2)}, + EndKeyType: &sppb.KeyRange_EndClosed{EndClosed: listValueProto(int3)}, + }, + { + StartKeyType: &sppb.KeyRange_StartOpen{StartOpen: listValueProto(int4)}, + EndKeyType: &sppb.KeyRange_EndClosed{EndClosed: listValueProto(intProto(5))}, + }, + }, + }, + }, + { + KeySets( + Key{1}, + KeyRange{Key{2}, Key{3}, ClosedClosed}, + AllKeys(), + KeyRange{Key{4}, Key{5}, OpenClosed}, + Key{6}), + &sppb.KeySet{All: true}, + }, + } { + gotProto, err := test.ks.keySetProto() + if err != nil { + t.Errorf("#%d: %v.proto() returns error %v; want nil error", i, test.ks, err) + } + if !testEqual(gotProto, test.wantProto) { + t.Errorf("#%d: %v.proto() = \n%v\nwant:\n%v", i, test.ks, gotProto.String(), test.wantProto.String()) + } + } +} diff --git a/vendor/cloud.google.com/go/spanner/mutation.go b/vendor/cloud.google.com/go/spanner/mutation.go new file mode 100644 index 000000000..b2dbaf566 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/mutation.go @@ -0,0 +1,430 @@ +/* +Copyright 2017 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 spanner + +import ( + "reflect" + + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" +) + +// op is the mutation operation. +type op int + +const ( + // opDelete removes a row from a table. Succeeds whether or not the + // key was present. + opDelete op = iota + // opInsert inserts a row into a table. If the row already exists, the + // write or transaction fails. + opInsert + // opInsertOrUpdate inserts a row into a table. If the row already + // exists, it updates it instead. Any column values not explicitly + // written are preserved. + opInsertOrUpdate + // opReplace inserts a row into a table, deleting any existing row. + // Unlike InsertOrUpdate, this means any values not explicitly written + // become NULL. + opReplace + // opUpdate updates a row in a table. If the row does not already + // exist, the write or transaction fails. + opUpdate +) + +// A Mutation describes a modification to one or more Cloud Spanner rows. The +// mutation represents an insert, update, delete, etc on a table. +// +// Many mutations can be applied in a single atomic commit. For purposes of +// constraint checking (such as foreign key constraints), the operations can be +// viewed as applying in the same order as the mutations are provided (so that, e.g., +// a row and its logical "child" can be inserted in the same commit). +// +// The Apply function applies series of mutations. For example, +// +// m := spanner.Insert("User", +// []string{"user_id", "profile"}, +// []interface{}{UserID, profile}) +// _, err := client.Apply(ctx, []*spanner.Mutation{m}) +// +// inserts a new row into the User table. The primary key +// for the new row is UserID (presuming that "user_id" has been declared as the +// primary key of the "User" table). +// +// To apply a series of mutations as part of an atomic read-modify-write operation, +// use ReadWriteTransaction. +// +// Updating a row +// +// Changing the values of columns in an existing row is very similar to +// inserting a new row: +// +// m := spanner.Update("User", +// []string{"user_id", "profile"}, +// []interface{}{UserID, profile}) +// _, err := client.Apply(ctx, []*spanner.Mutation{m}) +// +// Deleting a row +// +// To delete a row, use spanner.Delete: +// +// m := spanner.Delete("User", spanner.Key{UserId}) +// _, err := client.Apply(ctx, []*spanner.Mutation{m}) +// +// spanner.Delete accepts a KeySet, so you can also pass in a KeyRange, or use the +// spanner.KeySets function to build any combination of Keys and KeyRanges. +// +// Note that deleting a row in a table may also delete rows from other tables +// if cascading deletes are specified in those tables' schemas. Delete does +// nothing if the named row does not exist (does not yield an error). +// +// Deleting a field +// +// To delete/clear a field within a row, use spanner.Update with the value nil: +// +// m := spanner.Update("User", +// []string{"user_id", "profile"}, +// []interface{}{UserID, nil}) +// _, err := client.Apply(ctx, []*spanner.Mutation{m}) +// +// The valid Go types and their corresponding Cloud Spanner types that can be +// used in the Insert/Update/InsertOrUpdate functions are: +// +// string, NullString - STRING +// []string, []NullString - STRING ARRAY +// []byte - BYTES +// [][]byte - BYTES ARRAY +// int, int64, NullInt64 - INT64 +// []int, []int64, []NullInt64 - INT64 ARRAY +// bool, NullBool - BOOL +// []bool, []NullBool - BOOL ARRAY +// float64, NullFloat64 - FLOAT64 +// []float64, []NullFloat64 - FLOAT64 ARRAY +// time.Time, NullTime - TIMESTAMP +// []time.Time, []NullTime - TIMESTAMP ARRAY +// Date, NullDate - DATE +// []Date, []NullDate - DATE ARRAY +// +// To compare two Mutations for testing purposes, use reflect.DeepEqual. +type Mutation struct { + // op is the operation type of the mutation. + // See documentation for spanner.op for more details. + op op + // Table is the name of the target table to be modified. + table string + // keySet is a set of primary keys that names the rows + // in a delete operation. + keySet KeySet + // columns names the set of columns that are going to be + // modified by Insert, InsertOrUpdate, Replace or Update + // operations. + columns []string + // values specifies the new values for the target columns + // named by Columns. + values []interface{} +} + +// mapToMutationParams converts Go map into mutation parameters. +func mapToMutationParams(in map[string]interface{}) ([]string, []interface{}) { + cols := []string{} + vals := []interface{}{} + for k, v := range in { + cols = append(cols, k) + vals = append(vals, v) + } + return cols, vals +} + +// errNotStruct returns error for not getting a go struct type. +func errNotStruct(in interface{}) error { + return spannerErrorf(codes.InvalidArgument, "%T is not a go struct type", in) +} + +// structToMutationParams converts Go struct into mutation parameters. +// If the input is not a valid Go struct type, structToMutationParams +// returns error. +func structToMutationParams(in interface{}) ([]string, []interface{}, error) { + if in == nil { + return nil, nil, errNotStruct(in) + } + v := reflect.ValueOf(in) + t := v.Type() + if t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Struct { + // t is a pointer to a struct. + if v.IsNil() { + // Return empty results. + return nil, nil, nil + } + // Get the struct value that in points to. + v = v.Elem() + t = t.Elem() + } + if t.Kind() != reflect.Struct { + return nil, nil, errNotStruct(in) + } + fields, err := fieldCache.Fields(t) + if err != nil { + return nil, nil, toSpannerError(err) + } + var cols []string + var vals []interface{} + for _, f := range fields { + cols = append(cols, f.Name) + vals = append(vals, v.FieldByIndex(f.Index).Interface()) + } + return cols, vals, nil +} + +// Insert returns a Mutation to insert a row into a table. If the row already +// exists, the write or transaction fails. +func Insert(table string, cols []string, vals []interface{}) *Mutation { + return &Mutation{ + op: opInsert, + table: table, + columns: cols, + values: vals, + } +} + +// InsertMap returns a Mutation to insert a row into a table, specified by +// a map of column name to value. If the row already exists, the write or +// transaction fails. +func InsertMap(table string, in map[string]interface{}) *Mutation { + cols, vals := mapToMutationParams(in) + return Insert(table, cols, vals) +} + +// InsertStruct returns a Mutation to insert a row into a table, specified by +// a Go struct. If the row already exists, the write or transaction fails. +// +// The in argument must be a struct or a pointer to a struct. Its exported +// fields specify the column names and values. Use a field tag like "spanner:name" +// to provide an alternative column name, or use "spanner:-" to ignore the field. +func InsertStruct(table string, in interface{}) (*Mutation, error) { + cols, vals, err := structToMutationParams(in) + if err != nil { + return nil, err + } + return Insert(table, cols, vals), nil +} + +// Update returns a Mutation to update a row in a table. If the row does not +// already exist, the write or transaction fails. +func Update(table string, cols []string, vals []interface{}) *Mutation { + return &Mutation{ + op: opUpdate, + table: table, + columns: cols, + values: vals, + } +} + +// UpdateMap returns a Mutation to update a row in a table, specified by +// a map of column to value. If the row does not already exist, the write or +// transaction fails. +func UpdateMap(table string, in map[string]interface{}) *Mutation { + cols, vals := mapToMutationParams(in) + return Update(table, cols, vals) +} + +// UpdateStruct returns a Mutation to update a row in a table, specified by a Go +// struct. If the row does not already exist, the write or transaction fails. +func UpdateStruct(table string, in interface{}) (*Mutation, error) { + cols, vals, err := structToMutationParams(in) + if err != nil { + return nil, err + } + return Update(table, cols, vals), nil +} + +// InsertOrUpdate returns a Mutation to insert a row into a table. If the row +// already exists, it updates it instead. Any column values not explicitly +// written are preserved. +// +// For a similar example, See Update. +func InsertOrUpdate(table string, cols []string, vals []interface{}) *Mutation { + return &Mutation{ + op: opInsertOrUpdate, + table: table, + columns: cols, + values: vals, + } +} + +// InsertOrUpdateMap returns a Mutation to insert a row into a table, +// specified by a map of column to value. If the row already exists, it +// updates it instead. Any column values not explicitly written are preserved. +// +// For a similar example, See UpdateMap. +func InsertOrUpdateMap(table string, in map[string]interface{}) *Mutation { + cols, vals := mapToMutationParams(in) + return InsertOrUpdate(table, cols, vals) +} + +// InsertOrUpdateStruct returns a Mutation to insert a row into a table, +// specified by a Go struct. If the row already exists, it updates it instead. +// Any column values not explicitly written are preserved. +// +// The in argument must be a struct or a pointer to a struct. Its exported +// fields specify the column names and values. Use a field tag like "spanner:name" +// to provide an alternative column name, or use "spanner:-" to ignore the field. +// +// For a similar example, See UpdateStruct. +func InsertOrUpdateStruct(table string, in interface{}) (*Mutation, error) { + cols, vals, err := structToMutationParams(in) + if err != nil { + return nil, err + } + return InsertOrUpdate(table, cols, vals), nil +} + +// Replace returns a Mutation to insert a row into a table, deleting any +// existing row. Unlike InsertOrUpdate, this means any values not explicitly +// written become NULL. +// +// For a similar example, See Update. +func Replace(table string, cols []string, vals []interface{}) *Mutation { + return &Mutation{ + op: opReplace, + table: table, + columns: cols, + values: vals, + } +} + +// ReplaceMap returns a Mutation to insert a row into a table, deleting any +// existing row. Unlike InsertOrUpdateMap, this means any values not explicitly +// written become NULL. The row is specified by a map of column to value. +// +// For a similar example, See UpdateMap. +func ReplaceMap(table string, in map[string]interface{}) *Mutation { + cols, vals := mapToMutationParams(in) + return Replace(table, cols, vals) +} + +// ReplaceStruct returns a Mutation to insert a row into a table, deleting any +// existing row. Unlike InsertOrUpdateMap, this means any values not explicitly +// written become NULL. The row is specified by a Go struct. +// +// The in argument must be a struct or a pointer to a struct. Its exported +// fields specify the column names and values. Use a field tag like "spanner:name" +// to provide an alternative column name, or use "spanner:-" to ignore the field. +// +// For a similar example, See UpdateStruct. +func ReplaceStruct(table string, in interface{}) (*Mutation, error) { + cols, vals, err := structToMutationParams(in) + if err != nil { + return nil, err + } + return Replace(table, cols, vals), nil +} + +// Delete removes the rows described by the KeySet from the table. It succeeds +// whether or not the keys were present. +func Delete(table string, ks KeySet) *Mutation { + return &Mutation{ + op: opDelete, + table: table, + keySet: ks, + } +} + +// prepareWrite generates sppb.Mutation_Write from table name, column names +// and new column values. +func prepareWrite(table string, columns []string, vals []interface{}) (*sppb.Mutation_Write, error) { + v, err := encodeValueArray(vals) + if err != nil { + return nil, err + } + return &sppb.Mutation_Write{ + Table: table, + Columns: columns, + Values: []*proto3.ListValue{v}, + }, nil +} + +// errInvdMutationOp returns error for unrecognized mutation operation. +func errInvdMutationOp(m Mutation) error { + return spannerErrorf(codes.InvalidArgument, "Unknown op type: %d", m.op) +} + +// proto converts spanner.Mutation to sppb.Mutation, in preparation to send +// RPCs. +func (m Mutation) proto() (*sppb.Mutation, error) { + var pb *sppb.Mutation + switch m.op { + case opDelete: + var kp *sppb.KeySet + if m.keySet != nil { + var err error + kp, err = m.keySet.keySetProto() + if err != nil { + return nil, err + } + } + pb = &sppb.Mutation{ + Operation: &sppb.Mutation_Delete_{ + Delete: &sppb.Mutation_Delete{ + Table: m.table, + KeySet: kp, + }, + }, + } + case opInsert: + w, err := prepareWrite(m.table, m.columns, m.values) + if err != nil { + return nil, err + } + pb = &sppb.Mutation{Operation: &sppb.Mutation_Insert{Insert: w}} + case opInsertOrUpdate: + w, err := prepareWrite(m.table, m.columns, m.values) + if err != nil { + return nil, err + } + pb = &sppb.Mutation{Operation: &sppb.Mutation_InsertOrUpdate{InsertOrUpdate: w}} + case opReplace: + w, err := prepareWrite(m.table, m.columns, m.values) + if err != nil { + return nil, err + } + pb = &sppb.Mutation{Operation: &sppb.Mutation_Replace{Replace: w}} + case opUpdate: + w, err := prepareWrite(m.table, m.columns, m.values) + if err != nil { + return nil, err + } + pb = &sppb.Mutation{Operation: &sppb.Mutation_Update{Update: w}} + default: + return nil, errInvdMutationOp(m) + } + return pb, nil +} + +// mutationsProto turns a spanner.Mutation array into a sppb.Mutation array, +// it is convenient for sending batch mutations to Cloud Spanner. +func mutationsProto(ms []*Mutation) ([]*sppb.Mutation, error) { + l := make([]*sppb.Mutation, 0, len(ms)) + for _, m := range ms { + pb, err := m.proto() + if err != nil { + return nil, err + } + l = append(l, pb) + } + return l, nil +} diff --git a/vendor/cloud.google.com/go/spanner/mutation_test.go b/vendor/cloud.google.com/go/spanner/mutation_test.go new file mode 100644 index 000000000..afbcb326f --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/mutation_test.go @@ -0,0 +1,570 @@ +/* +Copyright 2017 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 spanner + +import ( + "sort" + "strings" + "testing" + + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +// keysetProto returns protobuf encoding of valid spanner.KeySet. +func keysetProto(t *testing.T, ks KeySet) *sppb.KeySet { + k, err := ks.keySetProto() + if err != nil { + t.Fatalf("cannot convert keyset %v to protobuf: %v", ks, err) + } + return k +} + +// Test encoding from spanner.Mutation to protobuf. +func TestMutationToProto(t *testing.T) { + for i, test := range []struct { + m *Mutation + want *sppb.Mutation + }{ + // Delete Mutation + { + &Mutation{opDelete, "t_foo", Key{"foo"}, nil, nil}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Delete_{ + Delete: &sppb.Mutation_Delete{ + Table: "t_foo", + KeySet: keysetProto(t, Key{"foo"}), + }, + }, + }, + }, + // Insert Mutation + { + &Mutation{opInsert, "t_foo", KeySets(), []string{"col1", "col2"}, []interface{}{int64(1), int64(2)}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Insert{ + Insert: &sppb.Mutation_Write{ + Table: "t_foo", + Columns: []string{"col1", "col2"}, + Values: []*proto3.ListValue{ + { + Values: []*proto3.Value{intProto(1), intProto(2)}, + }, + }, + }, + }, + }, + }, + // InsertOrUpdate Mutation + { + &Mutation{opInsertOrUpdate, "t_foo", KeySets(), []string{"col1", "col2"}, []interface{}{1.0, 2.0}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_InsertOrUpdate{ + InsertOrUpdate: &sppb.Mutation_Write{ + Table: "t_foo", + Columns: []string{"col1", "col2"}, + Values: []*proto3.ListValue{ + { + Values: []*proto3.Value{floatProto(1.0), floatProto(2.0)}, + }, + }, + }, + }, + }, + }, + // Replace Mutation + { + &Mutation{opReplace, "t_foo", KeySets(), []string{"col1", "col2"}, []interface{}{"one", 2.0}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Replace{ + Replace: &sppb.Mutation_Write{ + Table: "t_foo", + Columns: []string{"col1", "col2"}, + Values: []*proto3.ListValue{ + { + Values: []*proto3.Value{stringProto("one"), floatProto(2.0)}, + }, + }, + }, + }, + }, + }, + // Update Mutation + { + &Mutation{opUpdate, "t_foo", KeySets(), []string{"col1", "col2"}, []interface{}{"one", []byte(nil)}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Update{ + Update: &sppb.Mutation_Write{ + Table: "t_foo", + Columns: []string{"col1", "col2"}, + Values: []*proto3.ListValue{ + { + Values: []*proto3.Value{stringProto("one"), nullProto()}, + }, + }, + }, + }, + }, + }, + } { + if got, err := test.m.proto(); err != nil || !testEqual(got, test.want) { + t.Errorf("%d: (%#v).proto() = (%v, %v), want (%v, nil)", i, test.m, got, err, test.want) + } + } +} + +// mutationColumnSorter implements sort.Interface for sorting column-value pairs in a Mutation by column names. +type mutationColumnSorter struct { + Mutation +} + +// newMutationColumnSorter creates new instance of mutationColumnSorter by duplicating the input Mutation so that +// sorting won't change the input Mutation. +func newMutationColumnSorter(m *Mutation) *mutationColumnSorter { + return &mutationColumnSorter{ + Mutation{ + m.op, + m.table, + m.keySet, + append([]string(nil), m.columns...), + append([]interface{}(nil), m.values...), + }, + } +} + +// Len implements sort.Interface.Len. +func (ms *mutationColumnSorter) Len() int { + return len(ms.columns) +} + +// Swap implements sort.Interface.Swap. +func (ms *mutationColumnSorter) Swap(i, j int) { + ms.columns[i], ms.columns[j] = ms.columns[j], ms.columns[i] + ms.values[i], ms.values[j] = ms.values[j], ms.values[i] +} + +// Less implements sort.Interface.Less. +func (ms *mutationColumnSorter) Less(i, j int) bool { + return strings.Compare(ms.columns[i], ms.columns[j]) < 0 +} + +// mutationEqual returns true if two mutations in question are equal +// to each other. +func mutationEqual(t *testing.T, m1, m2 Mutation) bool { + // Two mutations are considered to be equal even if their column values have different + // orders. + ms1 := newMutationColumnSorter(&m1) + ms2 := newMutationColumnSorter(&m2) + sort.Sort(ms1) + sort.Sort(ms2) + return testEqual(ms1, ms2) +} + +// Test helper functions which help to generate spanner.Mutation. +func TestMutationHelpers(t *testing.T) { + for _, test := range []struct { + m string + got *Mutation + want *Mutation + }{ + { + "Insert", + Insert("t_foo", []string{"col1", "col2"}, []interface{}{int64(1), int64(2)}), + &Mutation{opInsert, "t_foo", nil, []string{"col1", "col2"}, []interface{}{int64(1), int64(2)}}, + }, + { + "InsertMap", + InsertMap("t_foo", map[string]interface{}{"col1": int64(1), "col2": int64(2)}), + &Mutation{opInsert, "t_foo", nil, []string{"col1", "col2"}, []interface{}{int64(1), int64(2)}}, + }, + { + "InsertStruct", + func() *Mutation { + m, err := InsertStruct( + "t_foo", + struct { + notCol bool + Col1 int64 `spanner:"col1"` + Col2 int64 `spanner:"col2"` + }{false, int64(1), int64(2)}, + ) + if err != nil { + t.Errorf("cannot convert struct into mutation: %v", err) + } + return m + }(), + &Mutation{opInsert, "t_foo", nil, []string{"col1", "col2"}, []interface{}{int64(1), int64(2)}}, + }, + { + "Update", + Update("t_foo", []string{"col1", "col2"}, []interface{}{"one", []byte(nil)}), + &Mutation{opUpdate, "t_foo", nil, []string{"col1", "col2"}, []interface{}{"one", []byte(nil)}}, + }, + { + "UpdateMap", + UpdateMap("t_foo", map[string]interface{}{"col1": "one", "col2": []byte(nil)}), + &Mutation{opUpdate, "t_foo", nil, []string{"col1", "col2"}, []interface{}{"one", []byte(nil)}}, + }, + { + "UpdateStruct", + func() *Mutation { + m, err := UpdateStruct( + "t_foo", + struct { + Col1 string `spanner:"col1"` + notCol int + Col2 []byte `spanner:"col2"` + }{"one", 1, nil}, + ) + if err != nil { + t.Errorf("cannot convert struct into mutation: %v", err) + } + return m + }(), + &Mutation{opUpdate, "t_foo", nil, []string{"col1", "col2"}, []interface{}{"one", []byte(nil)}}, + }, + { + "InsertOrUpdate", + InsertOrUpdate("t_foo", []string{"col1", "col2"}, []interface{}{1.0, 2.0}), + &Mutation{opInsertOrUpdate, "t_foo", nil, []string{"col1", "col2"}, []interface{}{1.0, 2.0}}, + }, + { + "InsertOrUpdateMap", + InsertOrUpdateMap("t_foo", map[string]interface{}{"col1": 1.0, "col2": 2.0}), + &Mutation{opInsertOrUpdate, "t_foo", nil, []string{"col1", "col2"}, []interface{}{1.0, 2.0}}, + }, + { + "InsertOrUpdateStruct", + func() *Mutation { + m, err := InsertOrUpdateStruct( + "t_foo", + struct { + Col1 float64 `spanner:"col1"` + Col2 float64 `spanner:"col2"` + notCol float64 + }{1.0, 2.0, 3.0}, + ) + if err != nil { + t.Errorf("cannot convert struct into mutation: %v", err) + } + return m + }(), + &Mutation{opInsertOrUpdate, "t_foo", nil, []string{"col1", "col2"}, []interface{}{1.0, 2.0}}, + }, + { + "Replace", + Replace("t_foo", []string{"col1", "col2"}, []interface{}{"one", 2.0}), + &Mutation{opReplace, "t_foo", nil, []string{"col1", "col2"}, []interface{}{"one", 2.0}}, + }, + { + "ReplaceMap", + ReplaceMap("t_foo", map[string]interface{}{"col1": "one", "col2": 2.0}), + &Mutation{opReplace, "t_foo", nil, []string{"col1", "col2"}, []interface{}{"one", 2.0}}, + }, + { + "ReplaceStruct", + func() *Mutation { + m, err := ReplaceStruct( + "t_foo", + struct { + Col1 string `spanner:"col1"` + Col2 float64 `spanner:"col2"` + notCol string + }{"one", 2.0, "foo"}, + ) + if err != nil { + t.Errorf("cannot convert struct into mutation: %v", err) + } + return m + }(), + &Mutation{opReplace, "t_foo", nil, []string{"col1", "col2"}, []interface{}{"one", 2.0}}, + }, + { + "Delete", + Delete("t_foo", Key{"foo"}), + &Mutation{opDelete, "t_foo", Key{"foo"}, nil, nil}, + }, + { + "DeleteRange", + Delete("t_foo", KeyRange{Key{"bar"}, Key{"foo"}, ClosedClosed}), + &Mutation{opDelete, "t_foo", KeyRange{Key{"bar"}, Key{"foo"}, ClosedClosed}, nil, nil}, + }, + } { + if !mutationEqual(t, *test.got, *test.want) { + t.Errorf("%v: got Mutation %v, want %v", test.m, test.got, test.want) + } + } +} + +// Test encoding non-struct types by using *Struct helpers. +func TestBadStructs(t *testing.T) { + val := "i_am_not_a_struct" + wantErr := errNotStruct(val) + if _, gotErr := InsertStruct("t_test", val); !testEqual(gotErr, wantErr) { + t.Errorf("InsertStruct(%q) returns error %v, want %v", val, gotErr, wantErr) + } + if _, gotErr := InsertOrUpdateStruct("t_test", val); !testEqual(gotErr, wantErr) { + t.Errorf("InsertOrUpdateStruct(%q) returns error %v, want %v", val, gotErr, wantErr) + } + if _, gotErr := UpdateStruct("t_test", val); !testEqual(gotErr, wantErr) { + t.Errorf("UpdateStruct(%q) returns error %v, want %v", val, gotErr, wantErr) + } + if _, gotErr := ReplaceStruct("t_test", val); !testEqual(gotErr, wantErr) { + t.Errorf("ReplaceStruct(%q) returns error %v, want %v", val, gotErr, wantErr) + } +} + +func TestStructToMutationParams(t *testing.T) { + // Tests cases not covered elsewhere. + type S struct{ F interface{} } + + for _, test := range []struct { + in interface{} + wantCols []string + wantVals []interface{} + wantErr error + }{ + {nil, nil, nil, errNotStruct(nil)}, + {3, nil, nil, errNotStruct(3)}, + {(*S)(nil), nil, nil, nil}, + {&S{F: 1}, []string{"F"}, []interface{}{1}, nil}, + {&S{F: CommitTimestamp}, []string{"F"}, []interface{}{CommitTimestamp}, nil}, + } { + gotCols, gotVals, gotErr := structToMutationParams(test.in) + if !testEqual(gotCols, test.wantCols) { + t.Errorf("%#v: got cols %v, want %v", test.in, gotCols, test.wantCols) + } + if !testEqual(gotVals, test.wantVals) { + t.Errorf("%#v: got vals %v, want %v", test.in, gotVals, test.wantVals) + } + if !testEqual(gotErr, test.wantErr) { + t.Errorf("%#v: got err %v, want %v", test.in, gotErr, test.wantErr) + } + } +} + +// Test encoding Mutation into proto. +func TestEncodeMutation(t *testing.T) { + for _, test := range []struct { + name string + mutation Mutation + wantProto *sppb.Mutation + wantErr error + }{ + { + "OpDelete", + Mutation{opDelete, "t_test", Key{1}, nil, nil}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Delete_{ + Delete: &sppb.Mutation_Delete{ + Table: "t_test", + KeySet: &sppb.KeySet{ + Keys: []*proto3.ListValue{listValueProto(intProto(1))}, + }, + }, + }, + }, + nil, + }, + { + "OpDelete - Key error", + Mutation{opDelete, "t_test", Key{struct{}{}}, nil, nil}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Delete_{ + Delete: &sppb.Mutation_Delete{ + Table: "t_test", + KeySet: &sppb.KeySet{}, + }, + }, + }, + errInvdKeyPartType(struct{}{}), + }, + { + "OpInsert", + Mutation{opInsert, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Insert{ + Insert: &sppb.Mutation_Write{ + Table: "t_test", + Columns: []string{"key", "val"}, + Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))}, + }, + }, + }, + nil, + }, + { + "OpInsert - Value Type Error", + Mutation{opInsert, "t_test", nil, []string{"key", "val"}, []interface{}{struct{}{}, 1}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Insert{ + Insert: &sppb.Mutation_Write{}, + }, + }, + errEncoderUnsupportedType(struct{}{}), + }, + { + "OpInsertOrUpdate", + Mutation{opInsertOrUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_InsertOrUpdate{ + InsertOrUpdate: &sppb.Mutation_Write{ + Table: "t_test", + Columns: []string{"key", "val"}, + Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))}, + }, + }, + }, + nil, + }, + { + "OpInsertOrUpdate - Value Type Error", + Mutation{opInsertOrUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{struct{}{}, 1}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_InsertOrUpdate{ + InsertOrUpdate: &sppb.Mutation_Write{}, + }, + }, + errEncoderUnsupportedType(struct{}{}), + }, + { + "OpReplace", + Mutation{opReplace, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Replace{ + Replace: &sppb.Mutation_Write{ + Table: "t_test", + Columns: []string{"key", "val"}, + Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))}, + }, + }, + }, + nil, + }, + { + "OpReplace - Value Type Error", + Mutation{opReplace, "t_test", nil, []string{"key", "val"}, []interface{}{struct{}{}, 1}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Replace{ + Replace: &sppb.Mutation_Write{}, + }, + }, + errEncoderUnsupportedType(struct{}{}), + }, + { + "OpUpdate", + Mutation{opUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Update{ + Update: &sppb.Mutation_Write{ + Table: "t_test", + Columns: []string{"key", "val"}, + Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))}, + }, + }, + }, + nil, + }, + { + "OpUpdate - Value Type Error", + Mutation{opUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{struct{}{}, 1}}, + &sppb.Mutation{ + Operation: &sppb.Mutation_Update{ + Update: &sppb.Mutation_Write{}, + }, + }, + errEncoderUnsupportedType(struct{}{}), + }, + { + "OpKnown - Unknown Mutation Operation Code", + Mutation{op(100), "t_test", nil, nil, nil}, + &sppb.Mutation{}, + errInvdMutationOp(Mutation{op(100), "t_test", nil, nil, nil}), + }, + } { + gotProto, gotErr := test.mutation.proto() + if gotErr != nil { + if !testEqual(gotErr, test.wantErr) { + t.Errorf("%s: %v.proto() returns error %v, want %v", test.name, test.mutation, gotErr, test.wantErr) + } + continue + } + if !testEqual(gotProto, test.wantProto) { + t.Errorf("%s: %v.proto() = (%v, nil), want (%v, nil)", test.name, test.mutation, gotProto, test.wantProto) + } + } +} + +// Test Encoding an array of mutations. +func TestEncodeMutationArray(t *testing.T) { + for _, test := range []struct { + name string + ms []*Mutation + want []*sppb.Mutation + wantErr error + }{ + { + "Multiple Mutations", + []*Mutation{ + {opDelete, "t_test", Key{"bar"}, nil, nil}, + {opInsertOrUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}}, + }, + []*sppb.Mutation{ + { + Operation: &sppb.Mutation_Delete_{ + Delete: &sppb.Mutation_Delete{ + Table: "t_test", + KeySet: &sppb.KeySet{ + Keys: []*proto3.ListValue{listValueProto(stringProto("bar"))}, + }, + }, + }, + }, + { + Operation: &sppb.Mutation_InsertOrUpdate{ + InsertOrUpdate: &sppb.Mutation_Write{ + Table: "t_test", + Columns: []string{"key", "val"}, + Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))}, + }, + }, + }, + }, + nil, + }, + { + "Multiple Mutations - Bad Mutation", + []*Mutation{ + {opDelete, "t_test", Key{"bar"}, nil, nil}, + {opInsertOrUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", struct{}{}}}, + }, + []*sppb.Mutation{}, + errEncoderUnsupportedType(struct{}{}), + }, + } { + gotProto, gotErr := mutationsProto(test.ms) + if gotErr != nil { + if !testEqual(gotErr, test.wantErr) { + t.Errorf("%v: mutationsProto(%v) returns error %v, want %v", test.name, test.ms, gotErr, test.wantErr) + } + continue + } + if !testEqual(gotProto, test.want) { + t.Errorf("%v: mutationsProto(%v) = (%v, nil), want (%v, nil)", test.name, test.ms, gotProto, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/spanner/not_appengine.go b/vendor/cloud.google.com/go/spanner/not_appengine.go new file mode 100644 index 000000000..687e43354 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/not_appengine.go @@ -0,0 +1,20 @@ +// Copyright 2017 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. + +// +build !appengine + +package spanner + +// numChannels is the default value for NumChannels of client +const numChannels = 4 diff --git a/vendor/cloud.google.com/go/spanner/oc_test.go b/vendor/cloud.google.com/go/spanner/oc_test.go new file mode 100644 index 000000000..7e957139e --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/oc_test.go @@ -0,0 +1,52 @@ +// 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. + +package spanner + +import ( + "context" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + stestutil "cloud.google.com/go/spanner/internal/testutil" + "google.golang.org/api/option" + "google.golang.org/grpc" +) + +// Check that stats are being exported. +func TestOCStats(t *testing.T) { + te := testutil.NewTestExporter() + defer te.Unregister() + + ms := stestutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + ctx := context.Background() + c, err := NewClient(ctx, "projects/P/instances/I/databases/D", + option.WithEndpoint(ms.Addr()), + option.WithGRPCDialOption(grpc.WithInsecure()), + option.WithoutAuthentication()) + if err != nil { + t.Fatal(err) + } + defer c.Close() + + c.Single().ReadRow(ctx, "Users", Key{"alice"}, []string{"email"}) + // Wait until we see data from the view. + select { + case <-te.Stats: + case <-time.After(1 * time.Second): + t.Fatal("no stats were exported before timeout") + } +} diff --git a/vendor/cloud.google.com/go/spanner/pdml.go b/vendor/cloud.google.com/go/spanner/pdml.go new file mode 100644 index 000000000..4beb7913f --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/pdml.go @@ -0,0 +1,101 @@ +// 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. + +package spanner + +import ( + "context" + "time" + + "google.golang.org/api/iterator" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" +) + +// PartitionedUpdate executes a DML statement in parallel across the database, using +// separate, internal transactions that commit independently. The DML statement must +// be fully partitionable: it must be expressible as the union of many statements +// each of which accesses only a single row of the table. The statement should also be +// idempotent, because it may be applied more than once. +// +// PartitionedUpdate returns an estimated count of the number of rows affected. The actual +// number of affected rows may be greater than the estimate. +func (c *Client) PartitionedUpdate(ctx context.Context, statement Statement) (count int64, err error) { + ctx = traceStartSpan(ctx, "cloud.google.com/go/spanner.PartitionedUpdate") + defer func() { traceEndSpan(ctx, err) }() + if err := checkNestedTxn(ctx); err != nil { + return 0, err + } + + var ( + tx transactionID + s *session + sh *sessionHandle + ) + // create session + sc := c.rrNext() + s, err = createSession(ctx, sc, c.database, c.sessionLabels, c.md) + if err != nil { + return 0, toSpannerError(err) + } + defer s.delete(ctx) + sh = &sessionHandle{session: s} + // begin transaction + err = runRetryable(contextWithOutgoingMetadata(ctx, sh.getMetadata()), func(ctx context.Context) error { + res, e := sc.BeginTransaction(ctx, &sppb.BeginTransactionRequest{ + Session: sh.getID(), + Options: &sppb.TransactionOptions{ + Mode: &sppb.TransactionOptions_PartitionedDml_{PartitionedDml: &sppb.TransactionOptions_PartitionedDml{}}, + }, + }) + if e != nil { + return e + } + tx = res.Id + return nil + }) + if err != nil { + return 0, toSpannerError(err) + } + req := &sppb.ExecuteSqlRequest{ + Session: sh.getID(), + Transaction: &sppb.TransactionSelector{ + Selector: &sppb.TransactionSelector_Id{Id: tx}, + }, + Sql: statement.SQL, + } + rpc := func(ctx context.Context, resumeToken []byte) (streamingReceiver, error) { + req.ResumeToken = resumeToken + return sc.ExecuteStreamingSql(ctx, req) + } + iter := stream(contextWithOutgoingMetadata(ctx, sh.getMetadata()), + rpc, func(time.Time) {}, func(error) {}) + // TODO(jba): factor out the following code from here and ReadWriteTransaction.Update. + defer iter.Stop() + for { + _, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + return 0, toSpannerError(err) + } + time.Sleep(time.Second) + } + + if !iter.sawStats { + return 0, spannerErrorf(codes.InvalidArgument, "query passed to Update: %q", statement.SQL) + } + return iter.RowCount, nil +} diff --git a/vendor/cloud.google.com/go/spanner/pdml_test.go b/vendor/cloud.google.com/go/spanner/pdml_test.go new file mode 100644 index 000000000..4c5a743ef --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/pdml_test.go @@ -0,0 +1,61 @@ +// 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. + +package spanner + +import ( + "context" + "io" + "testing" + + "cloud.google.com/go/spanner/internal/testutil" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" +) + +func TestMockPartitionedUpdate(t *testing.T) { + t.Parallel() + ctx := context.Background() + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + mc := sppb.NewSpannerClient(dialMock(t, ms)) + client := &Client{database: "mockdb"} + client.clients = append(client.clients, mc) + stmt := NewStatement("UPDATE t SET x = 2 WHERE x = 1") + rowCount, err := client.PartitionedUpdate(ctx, stmt) + if err != nil { + t.Fatal(err) + } + want := int64(3) + if rowCount != want { + t.Errorf("got %d, want %d", rowCount, want) + } +} + +func TestMockPartitionedUpdateWithQuery(t *testing.T) { + t.Parallel() + ctx := context.Background() + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.AddMsg(io.EOF, true) + ms.Serve() + mc := sppb.NewSpannerClient(dialMock(t, ms)) + client := &Client{database: "mockdb"} + client.clients = append(client.clients, mc) + stmt := NewStatement("SELECT t.key key, t.value value FROM t_mock t") + _, err := client.PartitionedUpdate(ctx, stmt) + wantCode := codes.InvalidArgument + if serr, ok := err.(*Error); !ok || serr.Code != wantCode { + t.Errorf("got error %v, want code %s", err, wantCode) + } +} diff --git a/vendor/cloud.google.com/go/spanner/protoutils.go b/vendor/cloud.google.com/go/spanner/protoutils.go new file mode 100644 index 000000000..3797980ab --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/protoutils.go @@ -0,0 +1,113 @@ +/* +Copyright 2017 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 spanner + +import ( + "encoding/base64" + "strconv" + "time" + + "cloud.google.com/go/civil" + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +// Helpers to generate protobuf values and Cloud Spanner types. + +func stringProto(s string) *proto3.Value { + return &proto3.Value{Kind: stringKind(s)} +} + +func stringKind(s string) *proto3.Value_StringValue { + return &proto3.Value_StringValue{StringValue: s} +} + +func stringType() *sppb.Type { + return &sppb.Type{Code: sppb.TypeCode_STRING} +} + +func boolProto(b bool) *proto3.Value { + return &proto3.Value{Kind: &proto3.Value_BoolValue{BoolValue: b}} +} + +func boolType() *sppb.Type { + return &sppb.Type{Code: sppb.TypeCode_BOOL} +} + +func intProto(n int64) *proto3.Value { + return &proto3.Value{Kind: &proto3.Value_StringValue{StringValue: strconv.FormatInt(n, 10)}} +} + +func intType() *sppb.Type { + return &sppb.Type{Code: sppb.TypeCode_INT64} +} + +func floatProto(n float64) *proto3.Value { + return &proto3.Value{Kind: &proto3.Value_NumberValue{NumberValue: n}} +} + +func floatType() *sppb.Type { + return &sppb.Type{Code: sppb.TypeCode_FLOAT64} +} + +func bytesProto(b []byte) *proto3.Value { + return &proto3.Value{Kind: &proto3.Value_StringValue{StringValue: base64.StdEncoding.EncodeToString(b)}} +} + +func bytesType() *sppb.Type { + return &sppb.Type{Code: sppb.TypeCode_BYTES} +} + +func timeProto(t time.Time) *proto3.Value { + return stringProto(t.UTC().Format(time.RFC3339Nano)) +} + +func timeType() *sppb.Type { + return &sppb.Type{Code: sppb.TypeCode_TIMESTAMP} +} + +func dateProto(d civil.Date) *proto3.Value { + return stringProto(d.String()) +} + +func dateType() *sppb.Type { + return &sppb.Type{Code: sppb.TypeCode_DATE} +} + +func listProto(p ...*proto3.Value) *proto3.Value { + return &proto3.Value{Kind: &proto3.Value_ListValue{ListValue: &proto3.ListValue{Values: p}}} +} + +func listValueProto(p ...*proto3.Value) *proto3.ListValue { + return &proto3.ListValue{Values: p} +} + +func listType(t *sppb.Type) *sppb.Type { + return &sppb.Type{Code: sppb.TypeCode_ARRAY, ArrayElementType: t} +} + +func mkField(n string, t *sppb.Type) *sppb.StructType_Field { + return &sppb.StructType_Field{Name: n, Type: t} +} + +func structType(fields ...*sppb.StructType_Field) *sppb.Type { + return &sppb.Type{Code: sppb.TypeCode_STRUCT, StructType: &sppb.StructType{Fields: fields}} +} + +func nullProto() *proto3.Value { + return &proto3.Value{Kind: &proto3.Value_NullValue{NullValue: proto3.NullValue_NULL_VALUE}} +} diff --git a/vendor/cloud.google.com/go/spanner/read.go b/vendor/cloud.google.com/go/spanner/read.go new file mode 100644 index 000000000..8d23892e8 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/read.go @@ -0,0 +1,731 @@ +/* +Copyright 2017 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 spanner + +import ( + "bytes" + "context" + "io" + "log" + "sync/atomic" + "time" + + "cloud.google.com/go/internal/protostruct" + proto "github.com/golang/protobuf/proto" + proto3 "github.com/golang/protobuf/ptypes/struct" + "google.golang.org/api/iterator" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" +) + +// streamingReceiver is the interface for receiving data from a client side +// stream. +type streamingReceiver interface { + Recv() (*sppb.PartialResultSet, error) +} + +// errEarlyReadEnd returns error for read finishes when gRPC stream is still active. +func errEarlyReadEnd() error { + return spannerErrorf(codes.FailedPrecondition, "read completed with active stream") +} + +// stream is the internal fault tolerant method for streaming data from +// Cloud Spanner. +func stream(ctx context.Context, rpc func(ct context.Context, resumeToken []byte) (streamingReceiver, error), setTimestamp func(time.Time), release func(error)) *RowIterator { + ctx, cancel := context.WithCancel(ctx) + ctx = traceStartSpan(ctx, "cloud.google.com/go/spanner.RowIterator") + return &RowIterator{ + streamd: newResumableStreamDecoder(ctx, rpc), + rowd: &partialResultSetDecoder{}, + setTimestamp: setTimestamp, + release: release, + cancel: cancel, + } +} + +// RowIterator is an iterator over Rows. +type RowIterator struct { + // The plan for the query. Available after RowIterator.Next returns iterator.Done + // if QueryWithStats was called. + QueryPlan *sppb.QueryPlan + + // Execution statistics for the query. Available after RowIterator.Next returns iterator.Done + // if QueryWithStats was called. + QueryStats map[string]interface{} + + // For a DML statement, the number of rows affected. For PDML, this is a lower bound. + // Available for DML statements after RowIterator.Next returns iterator.Done. + RowCount int64 + + streamd *resumableStreamDecoder + rowd *partialResultSetDecoder + setTimestamp func(time.Time) + release func(error) + cancel func() + err error + rows []*Row + sawStats bool +} + +// Next returns the next result. Its second return value is iterator.Done if +// there are no more results. Once Next returns Done, all subsequent calls +// will return Done. +func (r *RowIterator) Next() (*Row, error) { + if r.err != nil { + return nil, r.err + } + for len(r.rows) == 0 && r.streamd.next() { + prs := r.streamd.get() + if prs.Stats != nil { + r.sawStats = true + r.QueryPlan = prs.Stats.QueryPlan + r.QueryStats = protostruct.DecodeToMap(prs.Stats.QueryStats) + if prs.Stats.RowCount != nil { + rc, err := extractRowCount(prs.Stats) + if err != nil { + return nil, err + } + r.RowCount = rc + } + } + r.rows, r.err = r.rowd.add(prs) + if r.err != nil { + return nil, r.err + } + if !r.rowd.ts.IsZero() && r.setTimestamp != nil { + r.setTimestamp(r.rowd.ts) + r.setTimestamp = nil + } + } + if len(r.rows) > 0 { + row := r.rows[0] + r.rows = r.rows[1:] + return row, nil + } + if err := r.streamd.lastErr(); err != nil { + r.err = toSpannerError(err) + } else if !r.rowd.done() { + r.err = errEarlyReadEnd() + } else { + r.err = iterator.Done + } + return nil, r.err +} + +func extractRowCount(stats *sppb.ResultSetStats) (int64, error) { + if stats.RowCount == nil { + return 0, spannerErrorf(codes.Internal, "missing RowCount") + } + switch rc := stats.RowCount.(type) { + case *sppb.ResultSetStats_RowCountExact: + return rc.RowCountExact, nil + case *sppb.ResultSetStats_RowCountLowerBound: + return rc.RowCountLowerBound, nil + default: + return 0, spannerErrorf(codes.Internal, "unknown RowCount type %T", stats.RowCount) + } +} + +// Do calls the provided function once in sequence for each row in the iteration. If the +// function returns a non-nil error, Do immediately returns that error. +// +// If there are no rows in the iterator, Do will return nil without calling the +// provided function. +// +// Do always calls Stop on the iterator. +func (r *RowIterator) Do(f func(r *Row) error) error { + defer r.Stop() + for { + row, err := r.Next() + switch err { + case iterator.Done: + return nil + case nil: + if err = f(row); err != nil { + return err + } + default: + return err + } + } +} + +// Stop terminates the iteration. It should be called after you finish using the iterator. +func (r *RowIterator) Stop() { + if r.streamd != nil { + defer traceEndSpan(r.streamd.ctx, r.err) + } + if r.cancel != nil { + r.cancel() + } + if r.release != nil { + r.release(r.err) + if r.err == nil { + r.err = spannerErrorf(codes.FailedPrecondition, "Next called after Stop") + } + r.release = nil + + } +} + +// partialResultQueue implements a simple FIFO queue. The zero value is a +// valid queue. +type partialResultQueue struct { + q []*sppb.PartialResultSet + first int + last int + n int // number of elements in queue +} + +// empty returns if the partialResultQueue is empty. +func (q *partialResultQueue) empty() bool { + return q.n == 0 +} + +// errEmptyQueue returns error for dequeuing an empty queue. +func errEmptyQueue() error { + return spannerErrorf(codes.OutOfRange, "empty partialResultQueue") +} + +// peekLast returns the last item in partialResultQueue; if the queue +// is empty, it returns error. +func (q *partialResultQueue) peekLast() (*sppb.PartialResultSet, error) { + if q.empty() { + return nil, errEmptyQueue() + } + return q.q[(q.last+cap(q.q)-1)%cap(q.q)], nil +} + +// push adds an item to the tail of partialResultQueue. +func (q *partialResultQueue) push(r *sppb.PartialResultSet) { + if q.q == nil { + q.q = make([]*sppb.PartialResultSet, 8 /* arbitrary */) + } + if q.n == cap(q.q) { + buf := make([]*sppb.PartialResultSet, cap(q.q)*2) + for i := 0; i < q.n; i++ { + buf[i] = q.q[(q.first+i)%cap(q.q)] + } + q.q = buf + q.first = 0 + q.last = q.n + } + q.q[q.last] = r + q.last = (q.last + 1) % cap(q.q) + q.n++ +} + +// pop removes an item from the head of partialResultQueue and returns +// it. +func (q *partialResultQueue) pop() *sppb.PartialResultSet { + if q.n == 0 { + return nil + } + r := q.q[q.first] + q.q[q.first] = nil + q.first = (q.first + 1) % cap(q.q) + q.n-- + return r +} + +// clear empties partialResultQueue. +func (q *partialResultQueue) clear() { + *q = partialResultQueue{} +} + +// dump retrieves all items from partialResultQueue and return them in a slice. +// It is used only in tests. +func (q *partialResultQueue) dump() []*sppb.PartialResultSet { + var dq []*sppb.PartialResultSet + for i := q.first; len(dq) < q.n; i = (i + 1) % cap(q.q) { + dq = append(dq, q.q[i]) + } + return dq +} + +// resumableStreamDecoderState encodes resumableStreamDecoder's status. +// See also the comments for resumableStreamDecoder.Next. +type resumableStreamDecoderState int + +const ( + unConnected resumableStreamDecoderState = iota // 0 + queueingRetryable // 1 + queueingUnretryable // 2 + aborted // 3 + finished // 4 +) + +// resumableStreamDecoder provides a resumable interface for receiving +// sppb.PartialResultSet(s) from a given query wrapped by +// resumableStreamDecoder.rpc(). +type resumableStreamDecoder struct { + // state is the current status of resumableStreamDecoder, see also + // the comments for resumableStreamDecoder.Next. + state resumableStreamDecoderState + // stateWitness when non-nil is called to observe state change, + // used for testing. + stateWitness func(resumableStreamDecoderState) + // ctx is the caller's context, used for cancel/timeout Next(). + ctx context.Context + // rpc is a factory of streamingReceiver, which might resume + // a previous stream from the point encoded in restartToken. + // rpc is always a wrapper of a Cloud Spanner query which is + // resumable. + rpc func(ctx context.Context, restartToken []byte) (streamingReceiver, error) + // stream is the current RPC streaming receiver. + stream streamingReceiver + // q buffers received yet undecoded partial results. + q partialResultQueue + // bytesBetweenResumeTokens is the proxy of the byte size of PartialResultSets being queued + // between two resume tokens. Once bytesBetweenResumeTokens is greater than + // maxBytesBetweenResumeTokens, resumableStreamDecoder goes into queueingUnretryable state. + bytesBetweenResumeTokens int32 + // maxBytesBetweenResumeTokens is the max number of bytes that can be buffered + // between two resume tokens. It is always copied from the global maxBytesBetweenResumeTokens + // atomically. + maxBytesBetweenResumeTokens int32 + // np is the next sppb.PartialResultSet ready to be returned + // to caller of resumableStreamDecoder.Get(). + np *sppb.PartialResultSet + // resumeToken stores the resume token that resumableStreamDecoder has + // last revealed to caller. + resumeToken []byte + // retryCount is the number of retries that have been carried out so far + retryCount int + // err is the last error resumableStreamDecoder has encountered so far. + err error + // backoff to compute delays between retries. + backoff exponentialBackoff +} + +// newResumableStreamDecoder creates a new resumeableStreamDecoder instance. +// Parameter rpc should be a function that creates a new stream +// beginning at the restartToken if non-nil. +func newResumableStreamDecoder(ctx context.Context, rpc func(ct context.Context, restartToken []byte) (streamingReceiver, error)) *resumableStreamDecoder { + return &resumableStreamDecoder{ + ctx: ctx, + rpc: rpc, + maxBytesBetweenResumeTokens: atomic.LoadInt32(&maxBytesBetweenResumeTokens), + backoff: defaultBackoff, + } +} + +// changeState fulfills state transition for resumableStateDecoder. +func (d *resumableStreamDecoder) changeState(target resumableStreamDecoderState) { + if d.state == queueingRetryable && d.state != target { + // Reset bytesBetweenResumeTokens because it is only meaningful/changed under + // queueingRetryable state. + d.bytesBetweenResumeTokens = 0 + } + d.state = target + if d.stateWitness != nil { + d.stateWitness(target) + } +} + +// isNewResumeToken returns if the observed resume token is different from +// the one returned from server last time. +func (d *resumableStreamDecoder) isNewResumeToken(rt []byte) bool { + if rt == nil { + return false + } + if bytes.Compare(rt, d.resumeToken) == 0 { + return false + } + return true +} + +// Next advances to the next available partial result set. If error or no +// more, returns false, call Err to determine if an error was encountered. +// The following diagram illustrates the state machine of resumableStreamDecoder +// that Next() implements. Note that state transition can be only triggered by +// RPC activities. +/* + rpc() fails retryable + +---------+ + | | rpc() fails unretryable/ctx timeouts or cancelled + | | +------------------------------------------------+ + | | | | + | v | v + | +---+---+---+ +--------+ +------+--+ + +-----+unConnected| |finished| | aborted |<----+ + | | ++-----+-+ +------+--+ | + +---+----+--+ ^ ^ ^ | + | ^ | | | | + | | | | recv() fails | + | | | | | | + | |recv() fails retryable | | | | + | |with valid ctx | | | | + | | | | | | + rpc() succeeds | +-----------------------+ | | | + | | | recv EOF recv EOF | | + | | | | | | + v | | Queue size exceeds | | | + +---+----+---+----+threshold +-------+-----------+ | | ++---------->+ +--------------->+ +-+ | +| |queueingRetryable| |queueingUnretryable| | +| | +<---------------+ | | +| +---+----------+--+ pop() returns +--+----+-----------+ | +| | | resume token | ^ | +| | | | | | +| | | | | | ++---------------+ | | | | + recv() succeeds | +----+ | + | recv() succeeds | + | | + | | + | | + | | + | | + +--------------------------------------------------+ + recv() fails unretryable + +*/ +var ( + // maxBytesBetweenResumeTokens is the maximum amount of bytes that resumableStreamDecoder + // in queueingRetryable state can use to queue PartialResultSets before getting + // into queueingUnretryable state. + maxBytesBetweenResumeTokens = int32(128 * 1024 * 1024) +) + +func (d *resumableStreamDecoder) next() bool { + for { + select { + case <-d.ctx.Done(): + // Do context check here so that even gRPC failed to do + // so, resumableStreamDecoder can still break the loop + // as expected. + d.err = errContextCanceled(d.ctx, d.err) + d.changeState(aborted) + default: + } + switch d.state { + case unConnected: + // If no gRPC stream is available, try to initiate one. + if d.stream, d.err = d.rpc(d.ctx, d.resumeToken); d.err != nil { + if isRetryable(d.err) { + d.doBackOff() + // Be explicit about state transition, although the + // state doesn't actually change. State transition + // will be triggered only by RPC activity, regardless of + // whether there is an actual state change or not. + d.changeState(unConnected) + continue + } + d.changeState(aborted) + continue + } + d.resetBackOff() + d.changeState(queueingRetryable) + continue + case queueingRetryable: + fallthrough + case queueingUnretryable: + // Receiving queue is not empty. + last, err := d.q.peekLast() + if err != nil { + // Only the case that receiving queue is empty could cause peekLast to + // return error and in such case, we should try to receive from stream. + d.tryRecv() + continue + } + if d.isNewResumeToken(last.ResumeToken) { + // Got new resume token, return buffered sppb.PartialResultSets to caller. + d.np = d.q.pop() + if d.q.empty() { + d.bytesBetweenResumeTokens = 0 + // The new resume token was just popped out from queue, record it. + d.resumeToken = d.np.ResumeToken + d.changeState(queueingRetryable) + } + return true + } + if d.bytesBetweenResumeTokens >= d.maxBytesBetweenResumeTokens && d.state == queueingRetryable { + d.changeState(queueingUnretryable) + continue + } + if d.state == queueingUnretryable { + // When there is no resume token observed, + // only yield sppb.PartialResultSets to caller under + // queueingUnretryable state. + d.np = d.q.pop() + return true + } + // Needs to receive more from gRPC stream till a new resume token + // is observed. + d.tryRecv() + continue + case aborted: + // Discard all pending items because none of them + // should be yield to caller. + d.q.clear() + return false + case finished: + // If query has finished, check if there are still buffered messages. + if d.q.empty() { + // No buffered PartialResultSet. + return false + } + // Although query has finished, there are still buffered PartialResultSets. + d.np = d.q.pop() + return true + + default: + log.Printf("Unexpected resumableStreamDecoder.state: %v", d.state) + return false + } + } +} + +// tryRecv attempts to receive a PartialResultSet from gRPC stream. +func (d *resumableStreamDecoder) tryRecv() { + var res *sppb.PartialResultSet + if res, d.err = d.stream.Recv(); d.err != nil { + if d.err == io.EOF { + d.err = nil + d.changeState(finished) + return + } + if isRetryable(d.err) && d.state == queueingRetryable { + d.err = nil + // Discard all queue items (none have resume tokens). + d.q.clear() + d.stream = nil + d.changeState(unConnected) + d.doBackOff() + return + } + d.changeState(aborted) + return + } + d.q.push(res) + if d.state == queueingRetryable && !d.isNewResumeToken(res.ResumeToken) { + // adjusting d.bytesBetweenResumeTokens + d.bytesBetweenResumeTokens += int32(proto.Size(res)) + } + d.resetBackOff() + d.changeState(d.state) +} + +// resetBackOff clears the internal retry counter of +// resumableStreamDecoder so that the next exponential +// backoff will start at a fresh state. +func (d *resumableStreamDecoder) resetBackOff() { + d.retryCount = 0 +} + +// doBackoff does an exponential backoff sleep. +func (d *resumableStreamDecoder) doBackOff() { + delay := d.backoff.delay(d.retryCount) + tracePrintf(d.ctx, nil, "Backing off stream read for %s", delay) + ticker := time.NewTicker(delay) + defer ticker.Stop() + d.retryCount++ + select { + case <-d.ctx.Done(): + case <-ticker.C: + } +} + +// get returns the most recent PartialResultSet generated by a call to next. +func (d *resumableStreamDecoder) get() *sppb.PartialResultSet { + return d.np +} + +// lastErr returns the last non-EOF error encountered. +func (d *resumableStreamDecoder) lastErr() error { + return d.err +} + +// partialResultSetDecoder assembles PartialResultSet(s) into Cloud Spanner +// Rows. +type partialResultSetDecoder struct { + row Row + tx *sppb.Transaction + chunked bool // if true, next value should be merged with last values entry. + ts time.Time // read timestamp +} + +// yield checks we have a complete row, and if so returns it. A row is not +// complete if it doesn't have enough columns, or if this is a chunked response +// and there are no further values to process. +func (p *partialResultSetDecoder) yield(chunked, last bool) *Row { + if len(p.row.vals) == len(p.row.fields) && (!chunked || !last) { + // When partialResultSetDecoder gets enough number of + // Column values, There are two cases that a new Row + // should be yield: + // 1. The incoming PartialResultSet is not chunked; + // 2. The incoming PartialResultSet is chunked, but the + // proto3.Value being merged is not the last one in + // the PartialResultSet. + // + // Use a fresh Row to simplify clients that want to use yielded results + // after the next row is retrieved. Note that fields is never changed + // so it doesn't need to be copied. + fresh := Row{ + fields: p.row.fields, + vals: make([]*proto3.Value, len(p.row.vals)), + } + copy(fresh.vals, p.row.vals) + p.row.vals = p.row.vals[:0] // empty and reuse slice + return &fresh + } + return nil +} + +// yieldTx returns transaction information via caller supplied callback. +func errChunkedEmptyRow() error { + return spannerErrorf(codes.FailedPrecondition, "got invalid chunked PartialResultSet with empty Row") +} + +// add tries to merge a new PartialResultSet into buffered Row. It returns +// any rows that have been completed as a result. +func (p *partialResultSetDecoder) add(r *sppb.PartialResultSet) ([]*Row, error) { + var rows []*Row + if r.Metadata != nil { + // Metadata should only be returned in the first result. + if p.row.fields == nil { + p.row.fields = r.Metadata.RowType.Fields + } + if p.tx == nil && r.Metadata.Transaction != nil { + p.tx = r.Metadata.Transaction + if p.tx.ReadTimestamp != nil { + p.ts = time.Unix(p.tx.ReadTimestamp.Seconds, int64(p.tx.ReadTimestamp.Nanos)) + } + } + } + if len(r.Values) == 0 { + return nil, nil + } + if p.chunked { + p.chunked = false + // Try to merge first value in r.Values into + // uncompleted row. + last := len(p.row.vals) - 1 + if last < 0 { // sanity check + return nil, errChunkedEmptyRow() + } + var err error + // If p is chunked, then we should always try to merge p.last with r.first. + if p.row.vals[last], err = p.merge(p.row.vals[last], r.Values[0]); err != nil { + return nil, err + } + r.Values = r.Values[1:] + // Merge is done, try to yield a complete Row. + if row := p.yield(r.ChunkedValue, len(r.Values) == 0); row != nil { + rows = append(rows, row) + } + } + for i, v := range r.Values { + // The rest values in r can be appened into p directly. + p.row.vals = append(p.row.vals, v) + // Again, check to see if a complete Row can be yielded because of + // the newly added value. + if row := p.yield(r.ChunkedValue, i == len(r.Values)-1); row != nil { + rows = append(rows, row) + } + } + if r.ChunkedValue { + // After dealing with all values in r, if r is chunked then p must + // be also chunked. + p.chunked = true + } + return rows, nil +} + +// isMergeable returns if a protobuf Value can be potentially merged with +// other protobuf Values. +func (p *partialResultSetDecoder) isMergeable(a *proto3.Value) bool { + switch a.Kind.(type) { + case *proto3.Value_StringValue: + return true + case *proto3.Value_ListValue: + return true + default: + return false + } +} + +// errIncompatibleMergeTypes returns error for incompatible protobuf types +// that cannot be merged by partialResultSetDecoder. +func errIncompatibleMergeTypes(a, b *proto3.Value) error { + return spannerErrorf(codes.FailedPrecondition, "incompatible type in chunked PartialResultSet. expected (%T), got (%T)", a.Kind, b.Kind) +} + +// errUnsupportedMergeType returns error for protobuf type that cannot be +// merged to other protobufs. +func errUnsupportedMergeType(a *proto3.Value) error { + return spannerErrorf(codes.FailedPrecondition, "unsupported type merge (%T)", a.Kind) +} + +// merge tries to combine two protobuf Values if possible. +func (p *partialResultSetDecoder) merge(a, b *proto3.Value) (*proto3.Value, error) { + var err error + typeErr := errIncompatibleMergeTypes(a, b) + switch t := a.Kind.(type) { + case *proto3.Value_StringValue: + s, ok := b.Kind.(*proto3.Value_StringValue) + if !ok { + return nil, typeErr + } + return &proto3.Value{ + Kind: &proto3.Value_StringValue{StringValue: t.StringValue + s.StringValue}, + }, nil + case *proto3.Value_ListValue: + l, ok := b.Kind.(*proto3.Value_ListValue) + if !ok { + return nil, typeErr + } + if l.ListValue == nil || len(l.ListValue.Values) <= 0 { + // b is an empty list, just return a. + return a, nil + } + if t.ListValue == nil || len(t.ListValue.Values) <= 0 { + // a is an empty list, just return b. + return b, nil + } + if la := len(t.ListValue.Values) - 1; p.isMergeable(t.ListValue.Values[la]) { + // When the last item in a is of type String, + // List or Struct(encoded into List by Cloud Spanner), + // try to Merge last item in a and first item in b. + t.ListValue.Values[la], err = p.merge(t.ListValue.Values[la], l.ListValue.Values[0]) + if err != nil { + return nil, err + } + l.ListValue.Values = l.ListValue.Values[1:] + } + return &proto3.Value{ + Kind: &proto3.Value_ListValue{ + ListValue: &proto3.ListValue{ + Values: append(t.ListValue.Values, l.ListValue.Values...), + }, + }, + }, nil + default: + return nil, errUnsupportedMergeType(a) + } + +} + +// Done returns if partialResultSetDecoder has already done with all buffered +// values. +func (p *partialResultSetDecoder) done() bool { + // There is no explicit end of stream marker, but ending part way + // through a row is obviously bad, or ending with the last column still + // awaiting completion. + return len(p.row.vals) == 0 && !p.chunked +} diff --git a/vendor/cloud.google.com/go/spanner/read_test.go b/vendor/cloud.google.com/go/spanner/read_test.go new file mode 100644 index 000000000..2c661b372 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/read_test.go @@ -0,0 +1,1732 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "errors" + "fmt" + "io" + "sync/atomic" + "testing" + "time" + + "cloud.google.com/go/spanner/internal/testutil" + "github.com/golang/protobuf/proto" + proto3 "github.com/golang/protobuf/ptypes/struct" + "google.golang.org/api/iterator" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +var ( + // Mocked transaction timestamp. + trxTs = time.Unix(1, 2) + // Metadata for mocked KV table, its rows are returned by SingleUse transactions. + kvMeta = func() *sppb.ResultSetMetadata { + meta := testutil.KvMeta + meta.Transaction = &sppb.Transaction{ + ReadTimestamp: timestampProto(trxTs), + } + return &meta + }() + // Metadata for mocked ListKV table, which uses List for its key and value. + // Its rows are returned by snapshot readonly transactions, as indicated in the transaction metadata. + kvListMeta = &sppb.ResultSetMetadata{ + RowType: &sppb.StructType{ + Fields: []*sppb.StructType_Field{ + { + Name: "Key", + Type: &sppb.Type{ + Code: sppb.TypeCode_ARRAY, + ArrayElementType: &sppb.Type{ + Code: sppb.TypeCode_STRING, + }, + }, + }, + { + Name: "Value", + Type: &sppb.Type{ + Code: sppb.TypeCode_ARRAY, + ArrayElementType: &sppb.Type{ + Code: sppb.TypeCode_STRING, + }, + }, + }, + }, + }, + Transaction: &sppb.Transaction{ + Id: transactionID{5, 6, 7, 8, 9}, + ReadTimestamp: timestampProto(trxTs), + }, + } + // Metadata for mocked schema of a query result set, which has two struct + // columns named "Col1" and "Col2", the struct's schema is like the + // following: + // + // STRUCT { + // INT + // LIST + // } + // + // Its rows are returned in readwrite transaction, as indicated in the transaction metadata. + kvObjectMeta = &sppb.ResultSetMetadata{ + RowType: &sppb.StructType{ + Fields: []*sppb.StructType_Field{ + { + Name: "Col1", + Type: &sppb.Type{ + Code: sppb.TypeCode_STRUCT, + StructType: &sppb.StructType{ + Fields: []*sppb.StructType_Field{ + { + Name: "foo-f1", + Type: &sppb.Type{ + Code: sppb.TypeCode_INT64, + }, + }, + { + Name: "foo-f2", + Type: &sppb.Type{ + Code: sppb.TypeCode_ARRAY, + ArrayElementType: &sppb.Type{ + Code: sppb.TypeCode_STRING, + }, + }, + }, + }, + }, + }, + }, + { + Name: "Col2", + Type: &sppb.Type{ + Code: sppb.TypeCode_STRUCT, + StructType: &sppb.StructType{ + Fields: []*sppb.StructType_Field{ + { + Name: "bar-f1", + Type: &sppb.Type{ + Code: sppb.TypeCode_INT64, + }, + }, + { + Name: "bar-f2", + Type: &sppb.Type{ + Code: sppb.TypeCode_ARRAY, + ArrayElementType: &sppb.Type{ + Code: sppb.TypeCode_STRING, + }, + }, + }, + }, + }, + }, + }, + }, + }, + Transaction: &sppb.Transaction{ + Id: transactionID{1, 2, 3, 4, 5}, + }, + } +) + +// String implements fmt.stringer. +func (r *Row) String() string { + return fmt.Sprintf("{fields: %s, val: %s}", r.fields, r.vals) +} + +func describeRows(l []*Row) string { + // generate a nice test failure description + var s = "[" + for i, r := range l { + if i != 0 { + s += ",\n " + } + s += fmt.Sprint(r) + } + s += "]" + return s +} + +// Helper for generating proto3 Value_ListValue instances, making +// test code shorter and readable. +func genProtoListValue(v ...string) *proto3.Value_ListValue { + r := &proto3.Value_ListValue{ + ListValue: &proto3.ListValue{ + Values: []*proto3.Value{}, + }, + } + for _, e := range v { + r.ListValue.Values = append( + r.ListValue.Values, + &proto3.Value{ + Kind: &proto3.Value_StringValue{StringValue: e}, + }, + ) + } + return r +} + +// Test Row generation logics of partialResultSetDecoder. +func TestPartialResultSetDecoder(t *testing.T) { + restore := setMaxBytesBetweenResumeTokens() + defer restore() + var tests = []struct { + input []*sppb.PartialResultSet + wantF []*Row + wantTxID transactionID + wantTs time.Time + wantD bool + }{ + { + // Empty input. + wantD: true, + }, + // String merging examples. + { + // Single KV result. + input: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "foo"}}, + {Kind: &proto3.Value_StringValue{StringValue: "bar"}}, + }, + }, + }, + wantF: []*Row{ + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "foo"}}, + {Kind: &proto3.Value_StringValue{StringValue: "bar"}}, + }, + }, + }, + wantTs: trxTs, + wantD: true, + }, + { + // Incomplete partial result. + input: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "foo"}}, + }, + }, + }, + wantTs: trxTs, + wantD: false, + }, + { + // Complete splitted result. + input: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "foo"}}, + }, + }, + { + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "bar"}}, + }, + }, + }, + wantF: []*Row{ + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "foo"}}, + {Kind: &proto3.Value_StringValue{StringValue: "bar"}}, + }, + }, + }, + wantTs: trxTs, + wantD: true, + }, + { + // Multi-row example with splitted row in the middle. + input: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "foo"}}, + {Kind: &proto3.Value_StringValue{StringValue: "bar"}}, + {Kind: &proto3.Value_StringValue{StringValue: "A"}}, + }, + }, + { + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "1"}}, + {Kind: &proto3.Value_StringValue{StringValue: "B"}}, + {Kind: &proto3.Value_StringValue{StringValue: "2"}}, + }, + }, + }, + wantF: []*Row{ + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "foo"}}, + {Kind: &proto3.Value_StringValue{StringValue: "bar"}}, + }, + }, + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "A"}}, + {Kind: &proto3.Value_StringValue{StringValue: "1"}}, + }, + }, + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "B"}}, + {Kind: &proto3.Value_StringValue{StringValue: "2"}}, + }, + }, + }, + wantTs: trxTs, + wantD: true, + }, + { + // Merging example in result_set.proto. + input: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "Hello"}}, + {Kind: &proto3.Value_StringValue{StringValue: "W"}}, + }, + ChunkedValue: true, + }, + { + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "orl"}}, + }, + ChunkedValue: true, + }, + { + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "d"}}, + }, + }, + }, + wantF: []*Row{ + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "Hello"}}, + {Kind: &proto3.Value_StringValue{StringValue: "World"}}, + }, + }, + }, + wantTs: trxTs, + wantD: true, + }, + { + // More complex example showing completing a merge and + // starting a new merge in the same partialResultSet. + input: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "Hello"}}, + {Kind: &proto3.Value_StringValue{StringValue: "W"}}, // start split in value + }, + ChunkedValue: true, + }, + { + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "orld"}}, // complete value + {Kind: &proto3.Value_StringValue{StringValue: "i"}}, // start split in key + }, + ChunkedValue: true, + }, + { + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "s"}}, // complete key + {Kind: &proto3.Value_StringValue{StringValue: "not"}}, + {Kind: &proto3.Value_StringValue{StringValue: "a"}}, + {Kind: &proto3.Value_StringValue{StringValue: "qu"}}, // split in value + }, + ChunkedValue: true, + }, + { + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "estion"}}, // complete value + }, + }, + }, + wantF: []*Row{ + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "Hello"}}, + {Kind: &proto3.Value_StringValue{StringValue: "World"}}, + }, + }, + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "is"}}, + {Kind: &proto3.Value_StringValue{StringValue: "not"}}, + }, + }, + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: "a"}}, + {Kind: &proto3.Value_StringValue{StringValue: "question"}}, + }, + }, + }, + wantTs: trxTs, + wantD: true, + }, + // List merging examples. + { + // Non-splitting Lists. + input: []*sppb.PartialResultSet{ + { + Metadata: kvListMeta, + Values: []*proto3.Value{ + { + Kind: genProtoListValue("foo-1", "foo-2"), + }, + }, + }, + { + Values: []*proto3.Value{ + { + Kind: genProtoListValue("bar-1", "bar-2"), + }, + }, + }, + }, + wantF: []*Row{ + { + fields: kvListMeta.RowType.Fields, + vals: []*proto3.Value{ + { + Kind: genProtoListValue("foo-1", "foo-2"), + }, + { + Kind: genProtoListValue("bar-1", "bar-2"), + }, + }, + }, + }, + wantTxID: transactionID{5, 6, 7, 8, 9}, + wantTs: trxTs, + wantD: true, + }, + { + // Simple List merge case: splitted string element. + input: []*sppb.PartialResultSet{ + { + Metadata: kvListMeta, + Values: []*proto3.Value{ + { + Kind: genProtoListValue("foo-1", "foo-"), + }, + }, + ChunkedValue: true, + }, + { + Values: []*proto3.Value{ + { + Kind: genProtoListValue("2"), + }, + }, + }, + { + Values: []*proto3.Value{ + { + Kind: genProtoListValue("bar-1", "bar-2"), + }, + }, + }, + }, + wantF: []*Row{ + { + fields: kvListMeta.RowType.Fields, + vals: []*proto3.Value{ + { + Kind: genProtoListValue("foo-1", "foo-2"), + }, + { + Kind: genProtoListValue("bar-1", "bar-2"), + }, + }, + }, + }, + wantTxID: transactionID{5, 6, 7, 8, 9}, + wantTs: trxTs, + wantD: true, + }, + { + // Struct merging is also implemented by List merging. Note that + // Cloud Spanner uses proto.ListValue to encode Structs as well. + input: []*sppb.PartialResultSet{ + { + Metadata: kvObjectMeta, + Values: []*proto3.Value{ + { + Kind: &proto3.Value_ListValue{ + ListValue: &proto3.ListValue{ + Values: []*proto3.Value{ + {Kind: &proto3.Value_NumberValue{NumberValue: 23}}, + {Kind: genProtoListValue("foo-1", "fo")}, + }, + }, + }, + }, + }, + ChunkedValue: true, + }, + { + Values: []*proto3.Value{ + { + Kind: &proto3.Value_ListValue{ + ListValue: &proto3.ListValue{ + Values: []*proto3.Value{ + {Kind: genProtoListValue("o-2", "f")}, + }, + }, + }, + }, + }, + ChunkedValue: true, + }, + { + Values: []*proto3.Value{ + { + Kind: &proto3.Value_ListValue{ + ListValue: &proto3.ListValue{ + Values: []*proto3.Value{ + {Kind: genProtoListValue("oo-3")}, + }, + }, + }, + }, + { + Kind: &proto3.Value_ListValue{ + ListValue: &proto3.ListValue{ + Values: []*proto3.Value{ + {Kind: &proto3.Value_NumberValue{NumberValue: 45}}, + {Kind: genProtoListValue("bar-1")}, + }, + }, + }, + }, + }, + }, + }, + wantF: []*Row{ + { + fields: kvObjectMeta.RowType.Fields, + vals: []*proto3.Value{ + { + Kind: &proto3.Value_ListValue{ + ListValue: &proto3.ListValue{ + Values: []*proto3.Value{ + {Kind: &proto3.Value_NumberValue{NumberValue: 23}}, + {Kind: genProtoListValue("foo-1", "foo-2", "foo-3")}, + }, + }, + }, + }, + { + Kind: &proto3.Value_ListValue{ + ListValue: &proto3.ListValue{ + Values: []*proto3.Value{ + {Kind: &proto3.Value_NumberValue{NumberValue: 45}}, + {Kind: genProtoListValue("bar-1")}, + }, + }, + }, + }, + }, + }, + }, + wantTxID: transactionID{1, 2, 3, 4, 5}, + wantD: true, + }, + } + +nextTest: + for i, test := range tests { + var rows []*Row + p := &partialResultSetDecoder{} + for j, v := range test.input { + rs, err := p.add(v) + if err != nil { + t.Errorf("test %d.%d: partialResultSetDecoder.add(%v) = %v; want nil", i, j, v, err) + continue nextTest + } + rows = append(rows, rs...) + } + if !testEqual(p.ts, test.wantTs) { + t.Errorf("got transaction(%v), want %v", p.ts, test.wantTs) + } + if !testEqual(rows, test.wantF) { + t.Errorf("test %d: rows=\n%v\n; want\n%v\n; p.row:\n%v\n", i, describeRows(rows), describeRows(test.wantF), p.row) + } + if got := p.done(); got != test.wantD { + t.Errorf("test %d: partialResultSetDecoder.done() = %v", i, got) + } + } +} + +const ( + maxBuffers = 16 // max number of PartialResultSets that will be buffered in tests. +) + +// setMaxBytesBetweenResumeTokens sets the global maxBytesBetweenResumeTokens to a smaller +// value more suitable for tests. It returns a function which should be called to restore +// the maxBytesBetweenResumeTokens to its old value +func setMaxBytesBetweenResumeTokens() func() { + o := atomic.LoadInt32(&maxBytesBetweenResumeTokens) + atomic.StoreInt32(&maxBytesBetweenResumeTokens, int32(maxBuffers*proto.Size(&sppb.PartialResultSet{ + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(0)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(0)}}, + }, + }))) + return func() { + atomic.StoreInt32(&maxBytesBetweenResumeTokens, o) + } +} + +// keyStr generates key string for kvMeta schema. +func keyStr(i int) string { + return fmt.Sprintf("foo-%02d", i) +} + +// valStr generates value string for kvMeta schema. +func valStr(i int) string { + return fmt.Sprintf("bar-%02d", i) +} + +// Test state transitions of resumableStreamDecoder where state machine +// ends up to a non-blocking state(resumableStreamDecoder.Next returns +// on non-blocking state). +func TestRsdNonblockingStates(t *testing.T) { + restore := setMaxBytesBetweenResumeTokens() + defer restore() + tests := []struct { + name string + msgs []testutil.MockCtlMsg + rpc func(ct context.Context, resumeToken []byte) (streamingReceiver, error) + sql string + // Expected values + want []*sppb.PartialResultSet // PartialResultSets that should be returned to caller + queue []*sppb.PartialResultSet // PartialResultSets that should be buffered + resumeToken []byte // Resume token that is maintained by resumableStreamDecoder + stateHistory []resumableStreamDecoderState // State transition history of resumableStreamDecoder + wantErr error + }{ + { + // unConnected->queueingRetryable->finished + name: "unConnected->queueingRetryable->finished", + msgs: []testutil.MockCtlMsg{ + {}, + {}, + {Err: io.EOF, ResumeToken: false}, + }, + sql: "SELECT t.key key, t.value value FROM t_mock t", + want: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(0)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(0)}}, + }, + }, + }, + queue: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(1)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(1)}}, + }, + }, + }, + stateHistory: []resumableStreamDecoderState{ + queueingRetryable, // do RPC + queueingRetryable, // got foo-00 + queueingRetryable, // got foo-01 + finished, // got EOF + }, + }, + { + // unConnected->queueingRetryable->aborted + name: "unConnected->queueingRetryable->aborted", + msgs: []testutil.MockCtlMsg{ + {}, + {Err: nil, ResumeToken: true}, + {}, + {Err: errors.New("I quit"), ResumeToken: false}, + }, + sql: "SELECT t.key key, t.value value FROM t_mock t", + want: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(0)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(0)}}, + }, + }, + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(1)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(1)}}, + }, + ResumeToken: testutil.EncodeResumeToken(1), + }, + }, + stateHistory: []resumableStreamDecoderState{ + queueingRetryable, // do RPC + queueingRetryable, // got foo-00 + queueingRetryable, // got foo-01 + queueingRetryable, // foo-01, resume token + queueingRetryable, // got foo-02 + aborted, // got error + }, + wantErr: status.Errorf(codes.Unknown, "I quit"), + }, + { + // unConnected->queueingRetryable->queueingUnretryable->queueingUnretryable + name: "unConnected->queueingRetryable->queueingUnretryable->queueingUnretryable", + msgs: func() (m []testutil.MockCtlMsg) { + for i := 0; i < maxBuffers+1; i++ { + m = append(m, testutil.MockCtlMsg{}) + } + return m + }(), + sql: "SELECT t.key key, t.value value FROM t_mock t", + want: func() (s []*sppb.PartialResultSet) { + for i := 0; i < maxBuffers+1; i++ { + s = append(s, &sppb.PartialResultSet{ + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(i)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(i)}}, + }, + }) + } + return s + }(), + stateHistory: func() (s []resumableStreamDecoderState) { + s = append(s, queueingRetryable) // RPC + for i := 0; i < maxBuffers; i++ { + s = append(s, queueingRetryable) // the internal queue of resumableStreamDecoder fills up + } + // the first item fills up the queue and triggers state transition; + // the second item is received under queueingUnretryable state. + s = append(s, queueingUnretryable) + s = append(s, queueingUnretryable) + return s + }(), + }, + { + // unConnected->queueingRetryable->queueingUnretryable->aborted + name: "unConnected->queueingRetryable->queueingUnretryable->aborted", + msgs: func() (m []testutil.MockCtlMsg) { + for i := 0; i < maxBuffers; i++ { + m = append(m, testutil.MockCtlMsg{}) + } + m = append(m, testutil.MockCtlMsg{Err: errors.New("Just Abort It"), ResumeToken: false}) + return m + }(), + sql: "SELECT t.key key, t.value value FROM t_mock t", + want: func() (s []*sppb.PartialResultSet) { + for i := 0; i < maxBuffers; i++ { + s = append(s, &sppb.PartialResultSet{ + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(i)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(i)}}, + }, + }) + } + return s + }(), + stateHistory: func() (s []resumableStreamDecoderState) { + s = append(s, queueingRetryable) // RPC + for i := 0; i < maxBuffers; i++ { + s = append(s, queueingRetryable) // internal queue of resumableStreamDecoder fills up + } + s = append(s, queueingUnretryable) // the last row triggers state change + s = append(s, aborted) // Error happens + return s + }(), + wantErr: status.Errorf(codes.Unknown, "Just Abort It"), + }, + } +nextTest: + for _, test := range tests { + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + mc := sppb.NewSpannerClient(dialMock(t, ms)) + if test.rpc == nil { + test.rpc = func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + return mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: test.sql, + ResumeToken: resumeToken, + }) + } + } + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + r := newResumableStreamDecoder( + ctx, + test.rpc, + ) + st := []resumableStreamDecoderState{} + var lastErr error + // Once the expected number of state transitions are observed, + // send a signal by setting stateDone = true. + stateDone := false + // Set stateWitness to listen to state changes. + hl := len(test.stateHistory) // To avoid data race on test. + r.stateWitness = func(rs resumableStreamDecoderState) { + if !stateDone { + // Record state transitions. + st = append(st, rs) + if len(st) == hl { + lastErr = r.lastErr() + stateDone = true + } + } + } + // Let mock server stream given messages to resumableStreamDecoder. + for _, m := range test.msgs { + ms.AddMsg(m.Err, m.ResumeToken) + } + var rs []*sppb.PartialResultSet + for { + select { + case <-ctx.Done(): + t.Errorf("context cancelled or timeout during test") + continue nextTest + default: + } + if stateDone { + // Check if resumableStreamDecoder carried out expected + // state transitions. + if !testEqual(st, test.stateHistory) { + t.Errorf("%v: observed state transitions: \n%v\n, want \n%v\n", + test.name, st, test.stateHistory) + } + // Check if resumableStreamDecoder returns expected array of + // PartialResultSets. + if !testEqual(rs, test.want) { + t.Errorf("%v: received PartialResultSets: \n%v\n, want \n%v\n", test.name, rs, test.want) + } + // Verify that resumableStreamDecoder's internal buffering is also correct. + var q []*sppb.PartialResultSet + for { + item := r.q.pop() + if item == nil { + break + } + q = append(q, item) + } + if !testEqual(q, test.queue) { + t.Errorf("%v: PartialResultSets still queued: \n%v\n, want \n%v\n", test.name, q, test.queue) + } + // Verify resume token. + if test.resumeToken != nil && !testEqual(r.resumeToken, test.resumeToken) { + t.Errorf("%v: Resume token is %v, want %v\n", test.name, r.resumeToken, test.resumeToken) + } + // Verify error message. + if !testEqual(lastErr, test.wantErr) { + t.Errorf("%v: got error %v, want %v", test.name, lastErr, test.wantErr) + } + // Proceed to next test + continue nextTest + } + // Receive next decoded item. + if r.next() { + rs = append(rs, r.get()) + } + } + } +} + +// Test state transitions of resumableStreamDecoder where state machine +// ends up to a blocking state(resumableStreamDecoder.Next blocks +// on blocking state). +func TestRsdBlockingStates(t *testing.T) { + restore := setMaxBytesBetweenResumeTokens() + defer restore() + tests := []struct { + name string + msgs []testutil.MockCtlMsg + rpc func(ct context.Context, resumeToken []byte) (streamingReceiver, error) + sql string + // Expected values + want []*sppb.PartialResultSet // PartialResultSets that should be returned to caller + queue []*sppb.PartialResultSet // PartialResultSets that should be buffered + resumeToken []byte // Resume token that is maintained by resumableStreamDecoder + stateHistory []resumableStreamDecoderState // State transition history of resumableStreamDecoder + wantErr error + }{ + { + // unConnected -> unConnected + name: "unConnected -> unConnected", + rpc: func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + return nil, status.Errorf(codes.Unavailable, "trust me: server is unavailable") + }, + sql: "SELECT * from t_whatever", + stateHistory: []resumableStreamDecoderState{unConnected, unConnected, unConnected}, + wantErr: status.Errorf(codes.Unavailable, "trust me: server is unavailable"), + }, + { + // unConnected -> queueingRetryable + name: "unConnected -> queueingRetryable", + sql: "SELECT t.key key, t.value value FROM t_mock t", + stateHistory: []resumableStreamDecoderState{queueingRetryable}, + }, + { + // unConnected->queueingRetryable->queueingRetryable + name: "unConnected->queueingRetryable->queueingRetryable", + msgs: []testutil.MockCtlMsg{ + {}, + {Err: nil, ResumeToken: true}, + {Err: nil, ResumeToken: true}, + {}, + }, + sql: "SELECT t.key key, t.value value FROM t_mock t", + want: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(0)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(0)}}, + }, + }, + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(1)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(1)}}, + }, + ResumeToken: testutil.EncodeResumeToken(1), + }, + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(2)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(2)}}, + }, + ResumeToken: testutil.EncodeResumeToken(2), + }, + }, + queue: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(3)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(3)}}, + }, + }, + }, + resumeToken: testutil.EncodeResumeToken(2), + stateHistory: []resumableStreamDecoderState{ + queueingRetryable, // do RPC + queueingRetryable, // got foo-00 + queueingRetryable, // got foo-01 + queueingRetryable, // foo-01, resume token + queueingRetryable, // got foo-02 + queueingRetryable, // foo-02, resume token + queueingRetryable, // got foo-03 + }, + }, + { + // unConnected->queueingRetryable->queueingUnretryable->queueingRetryable->queueingRetryable + name: "unConnected->queueingRetryable->queueingUnretryable->queueingRetryable->queueingRetryable", + msgs: func() (m []testutil.MockCtlMsg) { + for i := 0; i < maxBuffers+1; i++ { + m = append(m, testutil.MockCtlMsg{}) + } + m = append(m, testutil.MockCtlMsg{Err: nil, ResumeToken: true}) + m = append(m, testutil.MockCtlMsg{}) + return m + }(), + sql: "SELECT t.key key, t.value value FROM t_mock t", + want: func() (s []*sppb.PartialResultSet) { + for i := 0; i < maxBuffers+2; i++ { + s = append(s, &sppb.PartialResultSet{ + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(i)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(i)}}, + }, + }) + } + s[maxBuffers+1].ResumeToken = testutil.EncodeResumeToken(maxBuffers + 1) + return s + }(), + resumeToken: testutil.EncodeResumeToken(maxBuffers + 1), + queue: []*sppb.PartialResultSet{ + { + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(maxBuffers + 2)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(maxBuffers + 2)}}, + }, + }, + }, + stateHistory: func() (s []resumableStreamDecoderState) { + s = append(s, queueingRetryable) // RPC + for i := 0; i < maxBuffers; i++ { + s = append(s, queueingRetryable) // internal queue of resumableStreamDecoder filles up + } + for i := maxBuffers - 1; i < maxBuffers+1; i++ { + // the first item fills up the queue and triggers state change; + // the second item is received under queueingUnretryable state. + s = append(s, queueingUnretryable) + } + s = append(s, queueingUnretryable) // got (maxBuffers+1)th row under Unretryable state + s = append(s, queueingRetryable) // (maxBuffers+1)th row has resume token + s = append(s, queueingRetryable) // (maxBuffers+2)th row has no resume token + return s + }(), + }, + { + // unConnected->queueingRetryable->queueingUnretryable->finished + name: "unConnected->queueingRetryable->queueingUnretryable->finished", + msgs: func() (m []testutil.MockCtlMsg) { + for i := 0; i < maxBuffers; i++ { + m = append(m, testutil.MockCtlMsg{}) + } + m = append(m, testutil.MockCtlMsg{Err: io.EOF, ResumeToken: false}) + return m + }(), + sql: "SELECT t.key key, t.value value FROM t_mock t", + want: func() (s []*sppb.PartialResultSet) { + for i := 0; i < maxBuffers; i++ { + s = append(s, &sppb.PartialResultSet{ + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(i)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(i)}}, + }, + }) + } + return s + }(), + stateHistory: func() (s []resumableStreamDecoderState) { + s = append(s, queueingRetryable) // RPC + for i := 0; i < maxBuffers; i++ { + s = append(s, queueingRetryable) // internal queue of resumableStreamDecoder fills up + } + s = append(s, queueingUnretryable) // last row triggers state change + s = append(s, finished) // query finishes + return s + }(), + }, + } + for _, test := range tests { + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + cc := dialMock(t, ms) + mc := sppb.NewSpannerClient(cc) + if test.rpc == nil { + // Avoid using test.sql directly in closure because for loop changes test. + sql := test.sql + test.rpc = func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + return mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: sql, + ResumeToken: resumeToken, + }) + } + } + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + r := newResumableStreamDecoder( + ctx, + test.rpc, + ) + // Override backoff to make the test run faster. + r.backoff = exponentialBackoff{1 * time.Nanosecond, 1 * time.Nanosecond} + // st is the set of observed state transitions. + st := []resumableStreamDecoderState{} + // q is the content of the decoder's partial result queue when expected number of state transitions are done. + q := []*sppb.PartialResultSet{} + var lastErr error + // Once the expected number of state transitions are observed, + // send a signal to channel stateDone. + stateDone := make(chan int) + // Set stateWitness to listen to state changes. + hl := len(test.stateHistory) // To avoid data race on test. + r.stateWitness = func(rs resumableStreamDecoderState) { + select { + case <-stateDone: + // Noop after expected number of state transitions + default: + // Record state transitions. + st = append(st, rs) + if len(st) == hl { + lastErr = r.lastErr() + q = r.q.dump() + close(stateDone) + } + } + } + // Let mock server stream given messages to resumableStreamDecoder. + for _, m := range test.msgs { + ms.AddMsg(m.Err, m.ResumeToken) + } + var rs []*sppb.PartialResultSet + go func() { + for { + if !r.next() { + // Note that r.Next also exits on context cancel/timeout. + return + } + rs = append(rs, r.get()) + } + }() + // Verify that resumableStreamDecoder reaches expected state. + select { + case <-stateDone: // Note that at this point, receiver is still blocking on r.next(). + // Check if resumableStreamDecoder carried out expected + // state transitions. + if !testEqual(st, test.stateHistory) { + t.Errorf("%v: observed state transitions: \n%v\n, want \n%v\n", + test.name, st, test.stateHistory) + } + // Check if resumableStreamDecoder returns expected array of + // PartialResultSets. + if !testEqual(rs, test.want) { + t.Errorf("%v: received PartialResultSets: \n%v\n, want \n%v\n", test.name, rs, test.want) + } + // Verify that resumableStreamDecoder's internal buffering is also correct. + if !testEqual(q, test.queue) { + t.Errorf("%v: PartialResultSets still queued: \n%v\n, want \n%v\n", test.name, q, test.queue) + } + // Verify resume token. + if test.resumeToken != nil && !testEqual(r.resumeToken, test.resumeToken) { + t.Errorf("%v: Resume token is %v, want %v\n", test.name, r.resumeToken, test.resumeToken) + } + // Verify error message. + if !testEqual(lastErr, test.wantErr) { + t.Errorf("%v: got error %v, want %v", test.name, lastErr, test.wantErr) + } + case <-time.After(1 * time.Second): + t.Errorf("%v: Timeout in waiting for state change", test.name) + } + ms.Stop() + cc.Close() + } +} + +// sReceiver signals every receiving attempt through a channel, +// used by TestResumeToken to determine if the receiving of a certain +// PartialResultSet will be attempted next. +type sReceiver struct { + c chan int + rpcReceiver sppb.Spanner_ExecuteStreamingSqlClient +} + +// Recv() implements streamingReceiver.Recv for sReceiver. +func (sr *sReceiver) Recv() (*sppb.PartialResultSet, error) { + sr.c <- 1 + return sr.rpcReceiver.Recv() +} + +// waitn waits for nth receiving attempt from now on, until +// the signal for nth Recv() attempts is received or timeout. +// Note that because the way stream() works, the signal for the +// nth Recv() means that the previous n - 1 PartialResultSets +// has already been returned to caller or queued, if no error happened. +func (sr *sReceiver) waitn(n int) error { + for i := 0; i < n; i++ { + select { + case <-sr.c: + case <-time.After(10 * time.Second): + return fmt.Errorf("timeout in waiting for %v-th Recv()", i+1) + } + } + return nil +} + +// Test the handling of resumableStreamDecoder.bytesBetweenResumeTokens. +func TestQueueBytes(t *testing.T) { + restore := setMaxBytesBetweenResumeTokens() + defer restore() + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + defer ms.Stop() + cc := dialMock(t, ms) + defer cc.Close() + mc := sppb.NewSpannerClient(cc) + sr := &sReceiver{ + c: make(chan int, 1000), // will never block in this test + } + wantQueueBytes := 0 + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + r := newResumableStreamDecoder( + ctx, + func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + r, err := mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: "SELECT t.key key, t.value value FROM t_mock t", + ResumeToken: resumeToken, + }) + sr.rpcReceiver = r + return sr, err + }, + ) + go func() { + for r.next() { + } + }() + // Let server send maxBuffers / 2 rows. + for i := 0; i < maxBuffers/2; i++ { + wantQueueBytes += proto.Size(&sppb.PartialResultSet{ + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(i)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(i)}}, + }, + }) + ms.AddMsg(nil, false) + } + if err := sr.waitn(maxBuffers/2 + 1); err != nil { + t.Fatalf("failed to wait for the first %v recv() calls: %v", maxBuffers, err) + } + if int32(wantQueueBytes) != r.bytesBetweenResumeTokens { + t.Errorf("r.bytesBetweenResumeTokens = %v, want %v", r.bytesBetweenResumeTokens, wantQueueBytes) + } + // Now send a resume token to drain the queue. + ms.AddMsg(nil, true) + // Wait for all rows to be processes. + if err := sr.waitn(1); err != nil { + t.Fatalf("failed to wait for rows to be processed: %v", err) + } + if r.bytesBetweenResumeTokens != 0 { + t.Errorf("r.bytesBetweenResumeTokens = %v, want 0", r.bytesBetweenResumeTokens) + } + // Let server send maxBuffers - 1 rows. + wantQueueBytes = 0 + for i := 0; i < maxBuffers-1; i++ { + wantQueueBytes += proto.Size(&sppb.PartialResultSet{ + Metadata: kvMeta, + Values: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(i)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(i)}}, + }, + }) + ms.AddMsg(nil, false) + } + if err := sr.waitn(maxBuffers - 1); err != nil { + t.Fatalf("failed to wait for %v rows to be processed: %v", maxBuffers-1, err) + } + if int32(wantQueueBytes) != r.bytesBetweenResumeTokens { + t.Errorf("r.bytesBetweenResumeTokens = %v, want 0", r.bytesBetweenResumeTokens) + } + // Trigger a state transition: queueingRetryable -> queueingUnretryable. + ms.AddMsg(nil, false) + if err := sr.waitn(1); err != nil { + t.Fatalf("failed to wait for state transition: %v", err) + } + if r.bytesBetweenResumeTokens != 0 { + t.Errorf("r.bytesBetweenResumeTokens = %v, want 0", r.bytesBetweenResumeTokens) + } +} + +// Verify that client can deal with resume token correctly +func TestResumeToken(t *testing.T) { + restore := setMaxBytesBetweenResumeTokens() + defer restore() + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + defer ms.Stop() + cc := dialMock(t, ms) + defer cc.Close() + mc := sppb.NewSpannerClient(cc) + sr := &sReceiver{ + c: make(chan int, 1000), // will never block in this test + } + rows := []*Row{} + done := make(chan error) + streaming := func() { + // Establish a stream to mock cloud spanner server. + iter := stream(context.Background(), + func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + r, err := mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: "SELECT t.key key, t.value value FROM t_mock t", + ResumeToken: resumeToken, + }) + sr.rpcReceiver = r + return sr, err + }, + nil, + func(error) {}) + defer iter.Stop() + var err error + for { + var row *Row + row, err = iter.Next() + if err == iterator.Done { + err = nil + break + } + if err != nil { + break + } + rows = append(rows, row) + } + done <- err + } + go streaming() + // Server streaming row 0 - 2, only row 1 has resume token. + // Client will receive row 0 - 2, so it will try receiving for + // 4 times (the last recv will block), and only row 0 - 1 will + // be yielded. + for i := 0; i < 3; i++ { + if i == 1 { + ms.AddMsg(nil, true) + } else { + ms.AddMsg(nil, false) + } + } + // Wait for 4 receive attempts, as explained above. + if err := sr.waitn(4); err != nil { + t.Fatalf("failed to wait for row 0 - 2: %v", err) + } + want := []*Row{ + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(0)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(0)}}, + }, + }, + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(1)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(1)}}, + }, + }, + } + if !testEqual(rows, want) { + t.Errorf("received rows: \n%v\n; but want\n%v\n", rows, want) + } + // Inject resumable failure. + ms.AddMsg( + status.Errorf(codes.Unavailable, "mock server unavailable"), + false, + ) + // Test if client detects the resumable failure and retries. + if err := sr.waitn(1); err != nil { + t.Fatalf("failed to wait for client to retry: %v", err) + } + // Client has resumed the query, now server resend row 2. + ms.AddMsg(nil, true) + if err := sr.waitn(1); err != nil { + t.Fatalf("failed to wait for resending row 2: %v", err) + } + // Now client should have received row 0 - 2. + want = append(want, &Row{ + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(2)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(2)}}, + }, + }) + if !testEqual(rows, want) { + t.Errorf("received rows: \n%v\n, want\n%v\n", rows, want) + } + // Sending 3rd - (maxBuffers+1)th rows without resume tokens, client should buffer them. + for i := 3; i < maxBuffers+2; i++ { + ms.AddMsg(nil, false) + } + if err := sr.waitn(maxBuffers - 1); err != nil { + t.Fatalf("failed to wait for row 3-%v: %v", maxBuffers+1, err) + } + // Received rows should be unchanged. + if !testEqual(rows, want) { + t.Errorf("receive rows: \n%v\n, want\n%v\n", rows, want) + } + // Send (maxBuffers+2)th row to trigger state change of resumableStreamDecoder: + // queueingRetryable -> queueingUnretryable + ms.AddMsg(nil, false) + if err := sr.waitn(1); err != nil { + t.Fatalf("failed to wait for row %v: %v", maxBuffers+2, err) + } + // Client should yield row 3rd - (maxBuffers+2)th to application. Therefore, application should + // see row 0 - (maxBuffers+2)th so far. + for i := 3; i < maxBuffers+3; i++ { + want = append(want, &Row{ + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(i)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(i)}}, + }, + }) + } + if !testEqual(rows, want) { + t.Errorf("received rows: \n%v\n; want\n%v\n", rows, want) + } + // Inject resumable error, but since resumableStreamDecoder is already at queueingUnretryable + // state, query will just fail. + ms.AddMsg( + status.Errorf(codes.Unavailable, "mock server wants some sleep"), + false, + ) + var gotErr error + select { + case gotErr = <-done: + case <-time.After(10 * time.Second): + t.Fatalf("timeout in waiting for failed query to return.") + } + if wantErr := toSpannerError(status.Errorf(codes.Unavailable, "mock server wants some sleep")); !testEqual(gotErr, wantErr) { + t.Fatalf("stream() returns error: %v, but want error: %v", gotErr, wantErr) + } + + // Reconnect to mock Cloud Spanner. + rows = []*Row{} + go streaming() + // Let server send two rows without resume token. + for i := maxBuffers + 3; i < maxBuffers+5; i++ { + ms.AddMsg(nil, false) + } + if err := sr.waitn(3); err != nil { + t.Fatalf("failed to wait for row %v - %v: %v", maxBuffers+3, maxBuffers+5, err) + } + if len(rows) > 0 { + t.Errorf("client received some rows unexpectedly: %v, want nothing", rows) + } + // Let server end the query. + ms.AddMsg(io.EOF, false) + select { + case gotErr = <-done: + case <-time.After(10 * time.Second): + t.Fatalf("timeout in waiting for failed query to return") + } + if gotErr != nil { + t.Fatalf("stream() returns unexpected error: %v, but want no error", gotErr) + } + // Verify if a normal server side EOF flushes all queued rows. + want = []*Row{ + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(maxBuffers + 3)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(maxBuffers + 3)}}, + }, + }, + { + fields: kvMeta.RowType.Fields, + vals: []*proto3.Value{ + {Kind: &proto3.Value_StringValue{StringValue: keyStr(maxBuffers + 4)}}, + {Kind: &proto3.Value_StringValue{StringValue: valStr(maxBuffers + 4)}}, + }, + }, + } + if !testEqual(rows, want) { + t.Errorf("received rows: \n%v\n; but want\n%v\n", rows, want) + } +} + +// Verify that streaming query get retried upon real gRPC server transport failures. +func TestGrpcReconnect(t *testing.T) { + restore := setMaxBytesBetweenResumeTokens() + defer restore() + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + defer ms.Stop() + cc := dialMock(t, ms) + defer cc.Close() + mc := sppb.NewSpannerClient(cc) + retry := make(chan int) + row := make(chan int) + var err error + go func() { + r := 0 + // Establish a stream to mock cloud spanner server. + iter := stream(context.Background(), + func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + if r > 0 { + // This RPC attempt is a retry, signal it. + retry <- r + } + r++ + return mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: "SELECT t.key key, t.value value FROM t_mock t", + ResumeToken: resumeToken, + }) + + }, + nil, + func(error) {}) + defer iter.Stop() + for { + _, err = iter.Next() + if err == iterator.Done { + err = nil + break + } + if err != nil { + break + } + row <- 0 + } + }() + // Add a message and wait for the receipt. + ms.AddMsg(nil, true) + select { + case <-row: + case <-time.After(10 * time.Second): + t.Fatalf("expect stream to be established within 10 seconds, but it didn't") + } + // Error injection: force server to close all connections. + ms.Stop() + // Test to see if client respond to the real RPC failure correctly by + // retrying RPC. + select { + case r, ok := <-retry: + if ok && r == 1 { + break + } + t.Errorf("retry count = %v, want 1", r) + case <-time.After(10 * time.Second): + t.Errorf("client library failed to respond after 10 seconds, aborting") + return + } +} + +// Test cancel/timeout for client operations. +func TestCancelTimeout(t *testing.T) { + restore := setMaxBytesBetweenResumeTokens() + defer restore() + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + defer ms.Stop() + cc := dialMock(t, ms) + defer cc.Close() + mc := sppb.NewSpannerClient(cc) + done := make(chan int) + go func() { + for { + ms.AddMsg(nil, true) + } + }() + // Test cancelling query. + ctx, cancel := context.WithCancel(context.Background()) + var err error + go func() { + // Establish a stream to mock cloud spanner server. + iter := stream(ctx, + func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + return mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: "SELECT t.key key, t.value value FROM t_mock t", + ResumeToken: resumeToken, + }) + }, + nil, + func(error) {}) + defer iter.Stop() + for { + _, err = iter.Next() + if err == iterator.Done { + break + } + if err != nil { + done <- 0 + break + } + } + }() + cancel() + select { + case <-done: + if ErrCode(err) != codes.Canceled { + t.Errorf("streaming query is canceled and returns error %v, want error code %v", err, codes.Canceled) + } + case <-time.After(1 * time.Second): + t.Errorf("query doesn't exit timely after being cancelled") + } + // Test query timeout. + ctx, cancel = context.WithTimeout(context.Background(), 1*time.Second) + defer cancel() + go func() { + // Establish a stream to mock cloud spanner server. + iter := stream(ctx, + func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + return mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: "SELECT t.key key, t.value value FROM t_mock t", + ResumeToken: resumeToken, + }) + }, + nil, + func(error) {}) + defer iter.Stop() + for { + _, err = iter.Next() + if err == iterator.Done { + err = nil + break + } + if err != nil { + break + } + } + done <- 0 + }() + select { + case <-done: + if wantErr := codes.DeadlineExceeded; ErrCode(err) != wantErr { + t.Errorf("streaming query timeout returns error %v, want error code %v", err, wantErr) + } + case <-time.After(2 * time.Second): + t.Errorf("query doesn't timeout as expected") + } +} + +func TestRowIteratorDo(t *testing.T) { + restore := setMaxBytesBetweenResumeTokens() + defer restore() + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + defer ms.Stop() + cc := dialMock(t, ms) + defer cc.Close() + mc := sppb.NewSpannerClient(cc) + + for i := 0; i < 3; i++ { + ms.AddMsg(nil, false) + } + ms.AddMsg(io.EOF, true) + nRows := 0 + iter := stream(context.Background(), + func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + return mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: "SELECT t.key key, t.value value FROM t_mock t", + ResumeToken: resumeToken, + }) + }, + nil, + func(error) {}) + err := iter.Do(func(r *Row) error { nRows++; return nil }) + if err != nil { + t.Errorf("Using Do: %v", err) + } + if nRows != 3 { + t.Errorf("got %d rows, want 3", nRows) + } +} + +func TestRowIteratorDoWithError(t *testing.T) { + restore := setMaxBytesBetweenResumeTokens() + defer restore() + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + defer ms.Stop() + cc := dialMock(t, ms) + defer cc.Close() + mc := sppb.NewSpannerClient(cc) + + for i := 0; i < 3; i++ { + ms.AddMsg(nil, false) + } + ms.AddMsg(io.EOF, true) + iter := stream(context.Background(), + func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + return mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: "SELECT t.key key, t.value value FROM t_mock t", + ResumeToken: resumeToken, + }) + }, + nil, + func(error) {}) + injected := errors.New("Failed iterator") + err := iter.Do(func(r *Row) error { return injected }) + if err != injected { + t.Errorf("got <%v>, want <%v>", err, injected) + } +} + +func TestIteratorStopEarly(t *testing.T) { + ctx := context.Background() + restore := setMaxBytesBetweenResumeTokens() + defer restore() + ms := testutil.NewMockCloudSpanner(t, trxTs) + ms.Serve() + defer ms.Stop() + cc := dialMock(t, ms) + defer cc.Close() + mc := sppb.NewSpannerClient(cc) + + ms.AddMsg(nil, false) + ms.AddMsg(nil, false) + ms.AddMsg(io.EOF, true) + + iter := stream(ctx, + func(ct context.Context, resumeToken []byte) (streamingReceiver, error) { + return mc.ExecuteStreamingSql(ct, &sppb.ExecuteSqlRequest{ + Sql: "SELECT t.key key, t.value value FROM t_mock t", + ResumeToken: resumeToken, + }) + }, + nil, + func(error) {}) + _, err := iter.Next() + if err != nil { + t.Fatalf("before Stop: %v", err) + } + iter.Stop() + // Stop sets r.err to the FailedPrecondition error "Next called after Stop". + // Override that here so this test can observe the Canceled error from the stream. + iter.err = nil + iter.Next() + if ErrCode(iter.streamd.lastErr()) != codes.Canceled { + t.Errorf("after Stop: got %v, wanted Canceled", err) + } +} + +func TestIteratorWithError(t *testing.T) { + injected := errors.New("Failed iterator") + iter := RowIterator{err: injected} + defer iter.Stop() + if _, err := iter.Next(); err != injected { + t.Fatalf("Expected error: %v, got %v", injected, err) + } +} + +func dialMock(t *testing.T, ms *testutil.MockCloudSpanner) *grpc.ClientConn { + cc, err := grpc.Dial(ms.Addr(), grpc.WithInsecure(), grpc.WithBlock()) + if err != nil { + t.Fatalf("Dial(%q) = %v", ms.Addr(), err) + } + return cc +} diff --git a/vendor/cloud.google.com/go/spanner/retry.go b/vendor/cloud.google.com/go/spanner/retry.go new file mode 100644 index 000000000..08ae920db --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/retry.go @@ -0,0 +1,199 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + edpb "google.golang.org/genproto/googleapis/rpc/errdetails" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +const ( + retryInfoKey = "google.rpc.retryinfo-bin" +) + +// errRetry returns an unavailable error under error namespace EsOther. It is a +// generic retryable error that is used to mask and recover unretryable errors +// in a retry loop. +func errRetry(err error) error { + if se, ok := err.(*Error); ok { + return &Error{codes.Unavailable, fmt.Sprintf("generic Cloud Spanner retryable error: { %v }", se.Error()), se.trailers} + } + return spannerErrorf(codes.Unavailable, "generic Cloud Spanner retryable error: { %v }", err.Error()) +} + +// isErrorClosing reports whether the error is generated by gRPC layer talking to a closed server. +func isErrorClosing(err error) bool { + if err == nil { + return false + } + if ErrCode(err) == codes.Internal && strings.Contains(ErrDesc(err), "transport is closing") { + // Handle the case when connection is closed unexpectedly. + // TODO: once gRPC is able to categorize + // this as retryable error, we should stop parsing the + // error message here. + return true + } + return false +} + +// isErrorRST reports whether the error is generated by gRPC client receiving a RST frame from server. +func isErrorRST(err error) bool { + if err == nil { + return false + } + if ErrCode(err) == codes.Internal && strings.Contains(ErrDesc(err), "stream terminated by RST_STREAM") { + // TODO: once gRPC is able to categorize this error as "go away" or "retryable", + // we should stop parsing the error message. + return true + } + return false +} + +// isErrorUnexpectedEOF returns true if error is generated by gRPC layer receiving io.EOF unexpectedly. +func isErrorUnexpectedEOF(err error) bool { + if err == nil { + return false + } + // Unexpected EOF is a transport layer issue that could be recovered by + // retries. The most likely scenario is a flaky RecvMsg() call due to + // network issues. + // For grpc version >= 1.14.0, the error code is Internal. + // (https://github.com/grpc/grpc-go/releases/tag/v1.14.0) + if ErrCode(err) == codes.Internal && strings.Contains(ErrDesc(err), "unexpected EOF") { + return true + } + // For grpc version < 1.14.0, the error code in Unknown. + if ErrCode(err) == codes.Unknown && strings.Contains(ErrDesc(err), "unexpected EOF") { + return true + } + return false +} + +// isErrorUnavailable returns true if the error is about server being unavailable. +func isErrorUnavailable(err error) bool { + if err == nil { + return false + } + if ErrCode(err) == codes.Unavailable { + return true + } + return false +} + +// isRetryable returns true if the Cloud Spanner error being checked is a retryable error. +func isRetryable(err error) bool { + if isErrorClosing(err) { + return true + } + if isErrorUnexpectedEOF(err) { + return true + } + if isErrorRST(err) { + return true + } + if isErrorUnavailable(err) { + return true + } + return false +} + +// errContextCanceled returns *spanner.Error for canceled context. +func errContextCanceled(ctx context.Context, lastErr error) error { + if ctx.Err() == context.DeadlineExceeded { + return spannerErrorf(codes.DeadlineExceeded, "%v, lastErr is <%v>", ctx.Err(), lastErr) + } + return spannerErrorf(codes.Canceled, "%v, lastErr is <%v>", ctx.Err(), lastErr) +} + +// extractRetryDelay extracts retry backoff if present. +func extractRetryDelay(err error) (time.Duration, bool) { + trailers := errTrailers(err) + if trailers == nil { + return 0, false + } + elem, ok := trailers[retryInfoKey] + if !ok || len(elem) <= 0 { + return 0, false + } + _, b, err := metadata.DecodeKeyValue(retryInfoKey, elem[0]) + if err != nil { + return 0, false + } + var retryInfo edpb.RetryInfo + if proto.Unmarshal([]byte(b), &retryInfo) != nil { + return 0, false + } + delay, err := ptypes.Duration(retryInfo.RetryDelay) + if err != nil { + return 0, false + } + return delay, true +} + +// runRetryable keeps attempting to run f until one of the following happens: +// 1) f returns nil error or an unretryable error; +// 2) context is cancelled or timeout. +// TODO: consider using https://github.com/googleapis/gax-go once it +// becomes available internally. +func runRetryable(ctx context.Context, f func(context.Context) error) error { + return toSpannerError(runRetryableNoWrap(ctx, f)) +} + +// Like runRetryable, but doesn't wrap the returned error in a spanner.Error. +func runRetryableNoWrap(ctx context.Context, f func(context.Context) error) error { + var funcErr error + retryCount := 0 + for { + select { + case <-ctx.Done(): + // Do context check here so that even f() failed to do + // so (for example, gRPC implementation bug), the loop + // can still have a chance to exit as expected. + return errContextCanceled(ctx, funcErr) + default: + } + funcErr = f(ctx) + if funcErr == nil { + return nil + } + if isRetryable(funcErr) { + // Error is retryable, do exponential backoff and continue. + b, ok := extractRetryDelay(funcErr) + if !ok { + b = defaultBackoff.delay(retryCount) + } + tracePrintf(ctx, nil, "Backing off for %s, then retrying", b) + select { + case <-ctx.Done(): + return errContextCanceled(ctx, funcErr) + case <-time.After(b): + } + retryCount++ + continue + } + // Error isn't retryable / no error, return immediately. + return funcErr + } +} diff --git a/vendor/cloud.google.com/go/spanner/retry_test.go b/vendor/cloud.google.com/go/spanner/retry_test.go new file mode 100644 index 000000000..737bc8475 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/retry_test.go @@ -0,0 +1,108 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "errors" + "fmt" + "testing" + "time" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + edpb "google.golang.org/genproto/googleapis/rpc/errdetails" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Test if runRetryable loop deals with various errors correctly. +func TestRetry(t *testing.T) { + if testing.Short() { + t.SkipNow() + } + responses := []error{ + status.Errorf(codes.Internal, "transport is closing"), + status.Errorf(codes.Unknown, "unexpected EOF"), + status.Errorf(codes.Internal, "unexpected EOF"), + status.Errorf(codes.Internal, "stream terminated by RST_STREAM with error code: 2"), + status.Errorf(codes.Unavailable, "service is currently unavailable"), + errRetry(fmt.Errorf("just retry it")), + } + err := runRetryable(context.Background(), func(ct context.Context) error { + var r error + if len(responses) > 0 { + r = responses[0] + responses = responses[1:] + } + return r + }) + if err != nil { + t.Errorf("runRetryable should be able to survive all retryable errors, but it returns %v", err) + } + // Unretryable errors + injErr := errors.New("this is unretryable") + err = runRetryable(context.Background(), func(ct context.Context) error { + return injErr + }) + if wantErr := toSpannerError(injErr); !testEqual(err, wantErr) { + t.Errorf("runRetryable returns error %v, want %v", err, wantErr) + } + // Timeout + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + retryErr := errRetry(fmt.Errorf("still retrying")) + err = runRetryable(ctx, func(ct context.Context) error { + // Expect to trigger timeout in retryable runner after 10 executions. + <-time.After(100 * time.Millisecond) + // Let retryable runner to retry so that timeout will eventually happen. + return retryErr + }) + // Check error code and error message + if wantErrCode, wantErr := codes.DeadlineExceeded, errContextCanceled(ctx, retryErr); ErrCode(err) != wantErrCode || !testEqual(err, wantErr) { + t.Errorf("=\n<%v, %v>, want:\n<%v, %v>", ErrCode(err), err, wantErrCode, wantErr) + } + // Cancellation + ctx, cancel = context.WithCancel(context.Background()) + retries := 3 + retryErr = errRetry(fmt.Errorf("retry before cancel")) + err = runRetryable(ctx, func(ct context.Context) error { + retries-- + if retries == 0 { + cancel() + } + return retryErr + }) + // Check error code, error message, retry count + if wantErrCode, wantErr := codes.Canceled, errContextCanceled(ctx, retryErr); ErrCode(err) != wantErrCode || !testEqual(err, wantErr) || retries != 0 { + t.Errorf("=\n<%v, %v, %v>, want:\n<%v, %v, %v>", ErrCode(err), err, retries, wantErrCode, wantErr, 0) + } +} + +func TestRetryInfo(t *testing.T) { + b, _ := proto.Marshal(&edpb.RetryInfo{ + RetryDelay: ptypes.DurationProto(time.Second), + }) + trailers := map[string]string{ + retryInfoKey: string(b), + } + gotDelay, ok := extractRetryDelay(errRetry(toSpannerErrorWithMetadata(status.Errorf(codes.Aborted, ""), metadata.New(trailers)))) + if !ok || !testEqual(time.Second, gotDelay) { + t.Errorf(" = <%t, %v>, want ", ok, gotDelay, time.Second) + } +} diff --git a/vendor/cloud.google.com/go/spanner/row.go b/vendor/cloud.google.com/go/spanner/row.go new file mode 100644 index 000000000..0c2337d08 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/row.go @@ -0,0 +1,308 @@ +/* +Copyright 2017 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 spanner + +import ( + "fmt" + "reflect" + + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" +) + +// A Row is a view of a row of data returned by a Cloud Spanner read. +// It consists of a number of columns; the number depends on the columns +// used to construct the read. +// +// The column values can be accessed by index. For instance, if the read specified +// []string{"photo_id", "caption"}, then each row will contain two +// columns: "photo_id" with index 0, and "caption" with index 1. +// +// Column values are decoded by using one of the Column, ColumnByName, or +// Columns methods. The valid values passed to these methods depend on the +// column type. For example: +// +// var photoID int64 +// err := row.Column(0, &photoID) // Decode column 0 as an integer. +// +// var caption string +// err := row.Column(1, &caption) // Decode column 1 as a string. +// +// // Decode all the columns. +// err := row.Columns(&photoID, &caption) +// +// Supported types and their corresponding Cloud Spanner column type(s) are: +// +// *string(not NULL), *NullString - STRING +// *[]string, *[]NullString - STRING ARRAY +// *[]byte - BYTES +// *[][]byte - BYTES ARRAY +// *int64(not NULL), *NullInt64 - INT64 +// *[]int64, *[]NullInt64 - INT64 ARRAY +// *bool(not NULL), *NullBool - BOOL +// *[]bool, *[]NullBool - BOOL ARRAY +// *float64(not NULL), *NullFloat64 - FLOAT64 +// *[]float64, *[]NullFloat64 - FLOAT64 ARRAY +// *time.Time(not NULL), *NullTime - TIMESTAMP +// *[]time.Time, *[]NullTime - TIMESTAMP ARRAY +// *Date(not NULL), *NullDate - DATE +// *[]civil.Date, *[]NullDate - DATE ARRAY +// *[]*some_go_struct, *[]NullRow - STRUCT ARRAY +// *GenericColumnValue - any Cloud Spanner type +// +// For TIMESTAMP columns, the returned time.Time object will be in UTC. +// +// To fetch an array of BYTES, pass a *[][]byte. To fetch an array of (sub)rows, pass +// a *[]spanner.NullRow or a *[]*some_go_struct where some_go_struct holds all +// information of the subrow, see spanner.Row.ToStruct for the mapping between a +// Cloud Spanner row and a Go struct. To fetch an array of other types, pass a +// *[]spanner.NullXXX type of the appropriate type. Use GenericColumnValue when you +// don't know in advance what column type to expect. +// +// Row decodes the row contents lazily; as a result, each call to a getter has +// a chance of returning an error. +// +// A column value may be NULL if the corresponding value is not present in +// Cloud Spanner. The spanner.NullXXX types (spanner.NullInt64 et al.) allow fetching +// values that may be null. A NULL BYTES can be fetched into a *[]byte as nil. +// It is an error to fetch a NULL value into any other type. +type Row struct { + fields []*sppb.StructType_Field + vals []*proto3.Value // keep decoded for now +} + +// errNamesValuesMismatch returns error for when columnNames count is not equal +// to columnValues count. +func errNamesValuesMismatch(columnNames []string, columnValues []interface{}) error { + return spannerErrorf(codes.FailedPrecondition, + "different number of names(%v) and values(%v)", len(columnNames), len(columnValues)) +} + +// NewRow returns a Row containing the supplied data. This can be useful for +// mocking Cloud Spanner Read and Query responses for unit testing. +func NewRow(columnNames []string, columnValues []interface{}) (*Row, error) { + if len(columnValues) != len(columnNames) { + return nil, errNamesValuesMismatch(columnNames, columnValues) + } + r := Row{ + fields: make([]*sppb.StructType_Field, len(columnValues)), + vals: make([]*proto3.Value, len(columnValues)), + } + for i := range columnValues { + val, typ, err := encodeValue(columnValues[i]) + if err != nil { + return nil, err + } + r.fields[i] = &sppb.StructType_Field{ + Name: columnNames[i], + Type: typ, + } + r.vals[i] = val + } + return &r, nil +} + +// Size is the number of columns in the row. +func (r *Row) Size() int { + return len(r.fields) +} + +// ColumnName returns the name of column i, or empty string for invalid column. +func (r *Row) ColumnName(i int) string { + if i < 0 || i >= len(r.fields) { + return "" + } + return r.fields[i].Name +} + +// ColumnIndex returns the index of the column with the given name. The +// comparison is case-sensitive. +func (r *Row) ColumnIndex(name string) (int, error) { + found := false + var index int + if len(r.vals) != len(r.fields) { + return 0, errFieldsMismatchVals(r) + } + for i, f := range r.fields { + if f == nil { + return 0, errNilColType(i) + } + if name == f.Name { + if found { + return 0, errDupColName(name) + } + found = true + index = i + } + } + if !found { + return 0, errColNotFound(name) + } + return index, nil +} + +// ColumnNames returns all column names of the row. +func (r *Row) ColumnNames() []string { + var n []string + for _, c := range r.fields { + n = append(n, c.Name) + } + return n +} + +// errColIdxOutOfRange returns error for requested column index is out of the +// range of the target Row's columns. +func errColIdxOutOfRange(i int, r *Row) error { + return spannerErrorf(codes.OutOfRange, "column index %d out of range [0,%d)", i, len(r.vals)) +} + +// errDecodeColumn returns error for not being able to decode a indexed column. +func errDecodeColumn(i int, err error) error { + if err == nil { + return nil + } + se, ok := toSpannerError(err).(*Error) + if !ok { + return spannerErrorf(codes.InvalidArgument, "failed to decode column %v, error = <%v>", i, err) + } + se.decorate(fmt.Sprintf("failed to decode column %v", i)) + return se +} + +// errFieldsMismatchVals returns error for field count isn't equal to value count in a Row. +func errFieldsMismatchVals(r *Row) error { + return spannerErrorf(codes.FailedPrecondition, "row has different number of fields(%v) and values(%v)", + len(r.fields), len(r.vals)) +} + +// errNilColType returns error for column type for column i being nil in the row. +func errNilColType(i int) error { + return spannerErrorf(codes.FailedPrecondition, "column(%v)'s type is nil", i) +} + +// Column fetches the value from the ith column, decoding it into ptr. +// See the Row documentation for the list of acceptable argument types. +// see Client.ReadWriteTransaction for an example. +func (r *Row) Column(i int, ptr interface{}) error { + if len(r.vals) != len(r.fields) { + return errFieldsMismatchVals(r) + } + if i < 0 || i >= len(r.fields) { + return errColIdxOutOfRange(i, r) + } + if r.fields[i] == nil { + return errNilColType(i) + } + if err := decodeValue(r.vals[i], r.fields[i].Type, ptr); err != nil { + return errDecodeColumn(i, err) + } + return nil +} + +// errDupColName returns error for duplicated column name in the same row. +func errDupColName(n string) error { + return spannerErrorf(codes.FailedPrecondition, "ambiguous column name %q", n) +} + +// errColNotFound returns error for not being able to find a named column. +func errColNotFound(n string) error { + return spannerErrorf(codes.NotFound, "column %q not found", n) +} + +// ColumnByName fetches the value from the named column, decoding it into ptr. +// See the Row documentation for the list of acceptable argument types. +func (r *Row) ColumnByName(name string, ptr interface{}) error { + index, err := r.ColumnIndex(name) + if err != nil { + return err + } + return r.Column(index, ptr) +} + +// errNumOfColValue returns error for providing wrong number of values to Columns. +func errNumOfColValue(n int, r *Row) error { + return spannerErrorf(codes.InvalidArgument, + "Columns(): number of arguments (%d) does not match row size (%d)", n, len(r.vals)) +} + +// Columns fetches all the columns in the row at once. +// +// The value of the kth column will be decoded into the kth argument to Columns. See +// Row for the list of acceptable argument types. The number of arguments must be +// equal to the number of columns. Pass nil to specify that a column should be +// ignored. +func (r *Row) Columns(ptrs ...interface{}) error { + if len(ptrs) != len(r.vals) { + return errNumOfColValue(len(ptrs), r) + } + if len(r.vals) != len(r.fields) { + return errFieldsMismatchVals(r) + } + for i, p := range ptrs { + if p == nil { + continue + } + if err := r.Column(i, p); err != nil { + return err + } + } + return nil +} + +// errToStructArgType returns error for p not having the correct data type(pointer to Go struct) to +// be the argument of Row.ToStruct. +func errToStructArgType(p interface{}) error { + return spannerErrorf(codes.InvalidArgument, "ToStruct(): type %T is not a valid pointer to Go struct", p) +} + +// ToStruct fetches the columns in a row into the fields of a struct. +// The rules for mapping a row's columns into a struct's exported fields +// are: +// +// 1. If a field has a `spanner: "column_name"` tag, then decode column +// 'column_name' into the field. A special case is the `spanner: "-"` +// tag, which instructs ToStruct to ignore the field during decoding. +// +// 2. Otherwise, if the name of a field matches the name of a column (ignoring case), +// decode the column into the field. +// +// The fields of the destination struct can be of any type that is acceptable +// to spanner.Row.Column. +// +// Slice and pointer fields will be set to nil if the source column is NULL, and a +// non-nil value if the column is not NULL. To decode NULL values of other types, use +// one of the spanner.NullXXX types as the type of the destination field. +// +// If ToStruct returns an error, the contents of p are undefined. Some fields may +// have been successfully populated, while others were not; you should not use any of +// the fields. +func (r *Row) ToStruct(p interface{}) error { + // Check if p is a pointer to a struct + if t := reflect.TypeOf(p); t == nil || t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct { + return errToStructArgType(p) + } + if len(r.vals) != len(r.fields) { + return errFieldsMismatchVals(r) + } + // Call decodeStruct directly to decode the row as a typed proto.ListValue. + return decodeStruct( + &sppb.StructType{Fields: r.fields}, + &proto3.ListValue{Values: r.vals}, + p, + ) +} diff --git a/vendor/cloud.google.com/go/spanner/row_test.go b/vendor/cloud.google.com/go/spanner/row_test.go new file mode 100644 index 000000000..2a3ab8fd4 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/row_test.go @@ -0,0 +1,1636 @@ +/* +Copyright 2017 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 spanner + +import ( + "encoding/base64" + "reflect" + "strconv" + "strings" + "testing" + "time" + + "cloud.google.com/go/civil" + proto "github.com/golang/protobuf/proto" + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +var ( + tm = time.Date(2016, 11, 15, 0, 0, 0, 0, time.UTC) + dt, _ = civil.ParseDate("2016-11-15") + // row contains a column for each unique Cloud Spanner type. + row = Row{ + []*sppb.StructType_Field{ + // STRING / STRING ARRAY + {Name: "STRING", Type: stringType()}, + {Name: "NULL_STRING", Type: stringType()}, + {Name: "STRING_ARRAY", Type: listType(stringType())}, + {Name: "NULL_STRING_ARRAY", Type: listType(stringType())}, + // BYTES / BYTES ARRAY + {Name: "BYTES", Type: bytesType()}, + {Name: "NULL_BYTES", Type: bytesType()}, + {Name: "BYTES_ARRAY", Type: listType(bytesType())}, + {Name: "NULL_BYTES_ARRAY", Type: listType(bytesType())}, + // INT64 / INT64 ARRAY + {Name: "INT64", Type: intType()}, + {Name: "NULL_INT64", Type: intType()}, + {Name: "INT64_ARRAY", Type: listType(intType())}, + {Name: "NULL_INT64_ARRAY", Type: listType(intType())}, + // BOOL / BOOL ARRAY + {Name: "BOOL", Type: boolType()}, + {Name: "NULL_BOOL", Type: boolType()}, + {Name: "BOOL_ARRAY", Type: listType(boolType())}, + {Name: "NULL_BOOL_ARRAY", Type: listType(boolType())}, + // FLOAT64 / FLOAT64 ARRAY + {Name: "FLOAT64", Type: floatType()}, + {Name: "NULL_FLOAT64", Type: floatType()}, + {Name: "FLOAT64_ARRAY", Type: listType(floatType())}, + {Name: "NULL_FLOAT64_ARRAY", Type: listType(floatType())}, + // TIMESTAMP / TIMESTAMP ARRAY + {Name: "TIMESTAMP", Type: timeType()}, + {Name: "NULL_TIMESTAMP", Type: timeType()}, + {Name: "TIMESTAMP_ARRAY", Type: listType(timeType())}, + {Name: "NULL_TIMESTAMP_ARRAY", Type: listType(timeType())}, + // DATE / DATE ARRAY + {Name: "DATE", Type: dateType()}, + {Name: "NULL_DATE", Type: dateType()}, + {Name: "DATE_ARRAY", Type: listType(dateType())}, + {Name: "NULL_DATE_ARRAY", Type: listType(dateType())}, + + // STRUCT ARRAY + { + Name: "STRUCT_ARRAY", + Type: listType( + structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + ), + ), + }, + { + Name: "NULL_STRUCT_ARRAY", + Type: listType( + structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + ), + ), + }, + }, + []*proto3.Value{ + // STRING / STRING ARRAY + stringProto("value"), + nullProto(), + listProto(stringProto("value1"), nullProto(), stringProto("value3")), + nullProto(), + // BYTES / BYTES ARRAY + bytesProto([]byte("value")), + nullProto(), + listProto(bytesProto([]byte("value1")), nullProto(), bytesProto([]byte("value3"))), + nullProto(), + // INT64 / INT64 ARRAY + intProto(17), + nullProto(), + listProto(intProto(1), intProto(2), nullProto()), + nullProto(), + // BOOL / BOOL ARRAY + boolProto(true), + nullProto(), + listProto(nullProto(), boolProto(true), boolProto(false)), + nullProto(), + // FLOAT64 / FLOAT64 ARRAY + floatProto(1.7), + nullProto(), + listProto(nullProto(), nullProto(), floatProto(1.7)), + nullProto(), + // TIMESTAMP / TIMESTAMP ARRAY + timeProto(tm), + nullProto(), + listProto(nullProto(), timeProto(tm)), + nullProto(), + // DATE / DATE ARRAY + dateProto(dt), + nullProto(), + listProto(nullProto(), dateProto(dt)), + nullProto(), + // STRUCT ARRAY + listProto( + nullProto(), + listProto(intProto(3), floatProto(33.3), stringProto("three")), + nullProto(), + ), + nullProto(), + }, + } +) + +// Test helpers for getting column values. +func TestColumnValues(t *testing.T) { + vals := []interface{}{} + wantVals := []interface{}{} + // Test getting column values. + for i, wants := range [][]interface{}{ + // STRING / STRING ARRAY + {"value", NullString{"value", true}}, + {NullString{}}, + {[]NullString{{"value1", true}, {}, {"value3", true}}}, + {[]NullString(nil)}, + // BYTES / BYTES ARRAY + {[]byte("value")}, + {[]byte(nil)}, + {[][]byte{[]byte("value1"), nil, []byte("value3")}}, + {[][]byte(nil)}, + // INT64 / INT64 ARRAY + {int64(17), NullInt64{17, true}}, + {NullInt64{}}, + {[]NullInt64{{1, true}, {2, true}, {}}}, + {[]NullInt64(nil)}, + // BOOL / BOOL ARRAY + {true, NullBool{true, true}}, + {NullBool{}}, + {[]NullBool{{}, {true, true}, {false, true}}}, + {[]NullBool(nil)}, + // FLOAT64 / FLOAT64 ARRAY + {1.7, NullFloat64{1.7, true}}, + {NullFloat64{}}, + {[]NullFloat64{{}, {}, {1.7, true}}}, + {[]NullFloat64(nil)}, + // TIMESTAMP / TIMESTAMP ARRAY + {tm, NullTime{tm, true}}, + {NullTime{}}, + {[]NullTime{{}, {tm, true}}}, + {[]NullTime(nil)}, + // DATE / DATE ARRAY + {dt, NullDate{dt, true}}, + {NullDate{}}, + {[]NullDate{{}, {dt, true}}}, + {[]NullDate(nil)}, + // STRUCT ARRAY + { + []*struct { + Col1 NullInt64 + Col2 NullFloat64 + Col3 string + }{ + nil, + + { + NullInt64{3, true}, + NullFloat64{33.3, true}, + "three", + }, + nil, + }, + []NullRow{ + {}, + { + Row: Row{ + fields: []*sppb.StructType_Field{ + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + }, + vals: []*proto3.Value{ + intProto(3), + floatProto(33.3), + stringProto("three"), + }, + }, + Valid: true, + }, + {}, + }, + }, + { + []*struct { + Col1 NullInt64 + Col2 NullFloat64 + Col3 string + }(nil), + []NullRow(nil), + }, + } { + for j, want := range wants { + // Prepare Value vector to test Row.Columns. + if j == 0 { + vals = append(vals, reflect.New(reflect.TypeOf(want)).Interface()) + wantVals = append(wantVals, want) + } + // Column + gotp := reflect.New(reflect.TypeOf(want)) + err := row.Column(i, gotp.Interface()) + if err != nil { + t.Errorf("\t row.Column(%v, %T) returns error: %v, want nil", i, gotp.Interface(), err) + } + if got := reflect.Indirect(gotp).Interface(); !testEqual(got, want) { + t.Errorf("\t row.Column(%v, %T) retrives %v, want %v", i, gotp.Interface(), got, want) + } + // ColumnByName + gotp = reflect.New(reflect.TypeOf(want)) + err = row.ColumnByName(row.fields[i].Name, gotp.Interface()) + if err != nil { + t.Errorf("\t row.ColumnByName(%v, %T) returns error: %v, want nil", row.fields[i].Name, gotp.Interface(), err) + } + if got := reflect.Indirect(gotp).Interface(); !testEqual(got, want) { + t.Errorf("\t row.ColumnByName(%v, %T) retrives %v, want %v", row.fields[i].Name, gotp.Interface(), got, want) + } + } + } + // Test Row.Columns. + if err := row.Columns(vals...); err != nil { + t.Errorf("row.Columns() returns error: %v, want nil", err) + } + for i, want := range wantVals { + if got := reflect.Indirect(reflect.ValueOf(vals[i])).Interface(); !testEqual(got, want) { + t.Errorf("\t got %v(%T) for column[%v], want %v(%T)", got, got, row.fields[i].Name, want, want) + } + } +} + +// Test decoding into nil destination. +func TestNilDst(t *testing.T) { + for i, test := range []struct { + r *Row + dst interface{} + wantErr error + structDst interface{} + wantToStructErr error + }{ + { + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: stringType()}, + }, + []*proto3.Value{stringProto("value")}, + }, + nil, + errDecodeColumn(0, errNilDst(nil)), + nil, + errToStructArgType(nil), + }, + { + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: stringType()}, + }, + []*proto3.Value{stringProto("value")}, + }, + (*string)(nil), + errDecodeColumn(0, errNilDst((*string)(nil))), + (*struct{ STRING string })(nil), + errNilDst((*struct{ STRING string })(nil)), + }, + { + &Row{ + []*sppb.StructType_Field{ + { + Name: "Col0", + Type: listType( + structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + ), + ), + }, + }, + []*proto3.Value{listProto( + listProto(intProto(3), floatProto(33.3)), + )}, + }, + (*[]*struct { + Col1 int + Col2 float64 + })(nil), + errDecodeColumn(0, errNilDst((*[]*struct { + Col1 int + Col2 float64 + })(nil))), + (*struct { + StructArray []*struct { + Col1 int + Col2 float64 + } `spanner:"STRUCT_ARRAY"` + })(nil), + errNilDst((*struct { + StructArray []*struct { + Col1 int + Col2 float64 + } `spanner:"STRUCT_ARRAY"` + })(nil)), + }, + } { + if gotErr := test.r.Column(0, test.dst); !testEqual(gotErr, test.wantErr) { + t.Errorf("%v: test.r.Column() returns error %v, want %v", i, gotErr, test.wantErr) + } + if gotErr := test.r.ColumnByName("Col0", test.dst); !testEqual(gotErr, test.wantErr) { + t.Errorf("%v: test.r.ColumnByName() returns error %v, want %v", i, gotErr, test.wantErr) + } + // Row.Columns(T) should return nil on T == nil, otherwise, it should return test.wantErr. + wantColumnsErr := test.wantErr + if test.dst == nil { + wantColumnsErr = nil + } + if gotErr := test.r.Columns(test.dst); !testEqual(gotErr, wantColumnsErr) { + t.Errorf("%v: test.r.Columns() returns error %v, want %v", i, gotErr, wantColumnsErr) + } + if gotErr := test.r.ToStruct(test.structDst); !testEqual(gotErr, test.wantToStructErr) { + t.Errorf("%v: test.r.ToStruct() returns error %v, want %v", i, gotErr, test.wantToStructErr) + } + } +} + +// Test decoding NULL columns using Go types that don't support NULL. +func TestNullTypeErr(t *testing.T) { + var tm time.Time + ntoi := func(n string) int { + for i, f := range row.fields { + if f.Name == n { + return i + } + } + t.Errorf("cannot find column name %q in row", n) + return 0 + } + for _, test := range []struct { + colName string + dst interface{} + }{ + { + "NULL_STRING", + proto.String(""), + }, + { + "NULL_INT64", + proto.Int64(0), + }, + { + "NULL_BOOL", + proto.Bool(false), + }, + { + "NULL_FLOAT64", + proto.Float64(0.0), + }, + { + "NULL_TIMESTAMP", + &tm, + }, + { + "NULL_DATE", + &dt, + }, + } { + wantErr := errDecodeColumn(ntoi(test.colName), errDstNotForNull(test.dst)) + if gotErr := row.ColumnByName(test.colName, test.dst); !testEqual(gotErr, wantErr) { + t.Errorf("row.ColumnByName(%v) returns error %v, want %v", test.colName, gotErr, wantErr) + } + } +} + +// Test using wrong destination type in column decoders. +func TestColumnTypeErr(t *testing.T) { + // badDst cannot hold any of the column values. + badDst := &struct{}{} + for i, f := range row.fields { // For each of the columns, try to decode it into badDst. + tc := f.Type.Code + var etc sppb.TypeCode + if strings.Contains(f.Name, "ARRAY") { + etc = f.Type.ArrayElementType.Code + } + wantErr := errDecodeColumn(i, errTypeMismatch(tc, etc, badDst)) + if gotErr := row.Column(i, badDst); !testEqual(gotErr, wantErr) { + t.Errorf("Column(%v): decoding into destination with wrong type %T returns error %v, want %v", + i, badDst, gotErr, wantErr) + } + if gotErr := row.ColumnByName(f.Name, badDst); !testEqual(gotErr, wantErr) { + t.Errorf("ColumnByName(%v): decoding into destination with wrong type %T returns error %v, want %v", + f.Name, badDst, gotErr, wantErr) + } + } + wantErr := errDecodeColumn(1, errTypeMismatch(sppb.TypeCode_STRING, sppb.TypeCode_TYPE_CODE_UNSPECIFIED, badDst)) + // badDst is used to receive column 1. + vals := []interface{}{nil, badDst} // Row.Column() is expected to fail at column 1. + // Skip decoding the rest columns by providing nils as the destinations. + for i := 2; i < len(row.fields); i++ { + vals = append(vals, nil) + } + if gotErr := row.Columns(vals...); !testEqual(gotErr, wantErr) { + t.Errorf("Columns(): decoding column 1 with wrong type %T returns error %v, want %v", + badDst, gotErr, wantErr) + } +} + +// Test the handling of invalid column decoding requests which cannot be mapped to correct column(s). +func TestInvalidColumnRequest(t *testing.T) { + for _, test := range []struct { + desc string + f func() error + wantErr error + }{ + { + "Request column index is out of range", + func() error { + return row.Column(10000, &struct{}{}) + }, + errColIdxOutOfRange(10000, &row), + }, + { + "Cannot find the named column", + func() error { + return row.ColumnByName("string", &struct{}{}) + }, + errColNotFound("string"), + }, + { + "Not enough arguments to call row.Columns()", + func() error { + return row.Columns(nil, nil) + }, + errNumOfColValue(2, &row), + }, + { + "Call ColumnByName on row with duplicated column names", + func() error { + var s string + r := &Row{ + []*sppb.StructType_Field{ + {Name: "Val", Type: stringType()}, + {Name: "Val", Type: stringType()}, + }, + []*proto3.Value{stringProto("value1"), stringProto("value2")}, + } + return r.ColumnByName("Val", &s) + }, + errDupColName("Val"), + }, + { + "Call ToStruct on row with duplicated column names", + func() error { + s := &struct { + Val string + }{} + r := &Row{ + []*sppb.StructType_Field{ + {Name: "Val", Type: stringType()}, + {Name: "Val", Type: stringType()}, + }, + []*proto3.Value{stringProto("value1"), stringProto("value2")}, + } + return r.ToStruct(s) + }, + errDupSpannerField("Val", &sppb.StructType{ + Fields: []*sppb.StructType_Field{ + {Name: "Val", Type: stringType()}, + {Name: "Val", Type: stringType()}, + }, + }), + }, + { + "Call ToStruct on a row with unnamed field", + func() error { + s := &struct { + Val string + }{} + r := &Row{ + []*sppb.StructType_Field{ + {Name: "", Type: stringType()}, + }, + []*proto3.Value{stringProto("value1")}, + } + return r.ToStruct(s) + }, + errUnnamedField(&sppb.StructType{Fields: []*sppb.StructType_Field{ + {Name: "", Type: stringType()}, + }}, 0), + }, + } { + if gotErr := test.f(); !testEqual(gotErr, test.wantErr) { + t.Errorf("%v: test.f() returns error %v, want %v", test.desc, gotErr, test.wantErr) + } + } +} + +// Test decoding the row with row.ToStruct into an invalid destination. +func TestToStructInvalidDst(t *testing.T) { + for _, test := range []struct { + desc string + dst interface{} + wantErr error + }{ + { + "Decode row as STRUCT into int32", + proto.Int(1), + errToStructArgType(proto.Int(1)), + }, + { + "Decode row as STRUCT to nil Go struct", + (*struct{})(nil), + errNilDst((*struct{})(nil)), + }, + { + "Decode row as STRUCT to Go struct with duplicated fields for the PK column", + &struct { + PK1 string `spanner:"STRING"` + PK2 string `spanner:"STRING"` + }{}, + errNoOrDupGoField(&struct { + PK1 string `spanner:"STRING"` + PK2 string `spanner:"STRING"` + }{}, "STRING"), + }, + { + "Decode row as STRUCT to Go struct with no field for the PK column", + &struct { + PK1 string `spanner:"_STRING"` + }{}, + errNoOrDupGoField(&struct { + PK1 string `spanner:"_STRING"` + }{}, "STRING"), + }, + { + "Decode row as STRUCT to Go struct with wrong type for the PK column", + &struct { + PK1 int64 `spanner:"STRING"` + }{}, + errDecodeStructField(&sppb.StructType{Fields: row.fields}, "STRING", + errTypeMismatch(sppb.TypeCode_STRING, sppb.TypeCode_TYPE_CODE_UNSPECIFIED, proto.Int64(0))), + }, + } { + if gotErr := row.ToStruct(test.dst); !testEqual(gotErr, test.wantErr) { + t.Errorf("%v: decoding:\ngot %v\nwant %v", test.desc, gotErr, test.wantErr) + } + } +} + +// Test decoding a broken row. +func TestBrokenRow(t *testing.T) { + for i, test := range []struct { + row *Row + dst interface{} + wantErr error + }{ + { + // A row with no field. + &Row{ + []*sppb.StructType_Field{}, + []*proto3.Value{stringProto("value")}, + }, + &NullString{"value", true}, + errFieldsMismatchVals(&Row{ + []*sppb.StructType_Field{}, + []*proto3.Value{stringProto("value")}, + }), + }, + { + // A row with nil field. + &Row{ + []*sppb.StructType_Field{nil}, + []*proto3.Value{stringProto("value")}, + }, + &NullString{"value", true}, + errNilColType(0), + }, + { + // Field is not nil, but its type is nil. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: nil}, + }, + []*proto3.Value{listProto(stringProto("value1"), stringProto("value2"))}, + }, + &[]NullString{}, + errDecodeColumn(0, errNilSpannerType()), + }, + { + // Field is not nil, field type is not nil, but it is an array and its array element type is nil. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: &sppb.Type{Code: sppb.TypeCode_ARRAY}}, + }, + []*proto3.Value{listProto(stringProto("value1"), stringProto("value2"))}, + }, + &[]NullString{}, + errDecodeColumn(0, errNilArrElemType(&sppb.Type{Code: sppb.TypeCode_ARRAY})), + }, + { + // Field specifies valid type, value is nil. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: intType()}, + }, + []*proto3.Value{nil}, + }, + &NullInt64{1, true}, + errDecodeColumn(0, errNilSrc()), + }, + { + // Field specifies INT64 type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: intType()}, + }, + []*proto3.Value{{Kind: (*proto3.Value_StringValue)(nil)}}, + }, + &NullInt64{1, true}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_StringValue)(nil)}, "String")), + }, + { + // Field specifies INT64 type, but value is for Number type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: intType()}, + }, + []*proto3.Value{floatProto(1.0)}, + }, + &NullInt64{1, true}, + errDecodeColumn(0, errSrcVal(floatProto(1.0), "String")), + }, + { + // Field specifies INT64 type, but value is wrongly encoded. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: intType()}, + }, + []*proto3.Value{stringProto("&1")}, + }, + proto.Int64(0), + errDecodeColumn(0, errBadEncoding(stringProto("&1"), func() error { + _, err := strconv.ParseInt("&1", 10, 64) + return err + }())), + }, + { + // Field specifies INT64 type, but value is wrongly encoded. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: intType()}, + }, + []*proto3.Value{stringProto("&1")}, + }, + &NullInt64{}, + errDecodeColumn(0, errBadEncoding(stringProto("&1"), func() error { + _, err := strconv.ParseInt("&1", 10, 64) + return err + }())), + }, + { + // Field specifies STRING type, but value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: stringType()}, + }, + []*proto3.Value{{Kind: (*proto3.Value_StringValue)(nil)}}, + }, + &NullString{"value", true}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_StringValue)(nil)}, "String")), + }, + { + // Field specifies STRING type, but value is for ARRAY type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: stringType()}, + }, + []*proto3.Value{listProto(stringProto("value"))}, + }, + &NullString{"value", true}, + errDecodeColumn(0, errSrcVal(listProto(stringProto("value")), "String")), + }, + { + // Field specifies FLOAT64 type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: floatType()}, + }, + []*proto3.Value{{Kind: (*proto3.Value_NumberValue)(nil)}}, + }, + &NullFloat64{1.0, true}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_NumberValue)(nil)}, "Number")), + }, + { + // Field specifies FLOAT64 type, but value is for BOOL type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: floatType()}, + }, + []*proto3.Value{boolProto(true)}, + }, + &NullFloat64{1.0, true}, + errDecodeColumn(0, errSrcVal(boolProto(true), "Number")), + }, + { + // Field specifies FLOAT64 type, but value is wrongly encoded. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: floatType()}, + }, + []*proto3.Value{stringProto("nan")}, + }, + &NullFloat64{}, + errDecodeColumn(0, errUnexpectedNumStr("nan")), + }, + { + // Field specifies FLOAT64 type, but value is wrongly encoded. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: floatType()}, + }, + []*proto3.Value{stringProto("nan")}, + }, + proto.Float64(0), + errDecodeColumn(0, errUnexpectedNumStr("nan")), + }, + { + // Field specifies BYTES type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: bytesType()}, + }, + []*proto3.Value{{Kind: (*proto3.Value_StringValue)(nil)}}, + }, + &[]byte{}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_StringValue)(nil)}, "String")), + }, + { + // Field specifies BYTES type, but value is for BOOL type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: bytesType()}, + }, + []*proto3.Value{boolProto(false)}, + }, + &[]byte{}, + errDecodeColumn(0, errSrcVal(boolProto(false), "String")), + }, + { + // Field specifies BYTES type, but value is wrongly encoded. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: bytesType()}, + }, + []*proto3.Value{stringProto("&&")}, + }, + &[]byte{}, + errDecodeColumn(0, errBadEncoding(stringProto("&&"), func() error { + _, err := base64.StdEncoding.DecodeString("&&") + return err + }())), + }, + { + // Field specifies BOOL type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: boolType()}, + }, + []*proto3.Value{{Kind: (*proto3.Value_BoolValue)(nil)}}, + }, + &NullBool{false, true}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_BoolValue)(nil)}, "Bool")), + }, + { + // Field specifies BOOL type, but value is for STRING type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: boolType()}, + }, + []*proto3.Value{stringProto("false")}, + }, + &NullBool{false, true}, + errDecodeColumn(0, errSrcVal(stringProto("false"), "Bool")), + }, + { + // Field specifies TIMESTAMP type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: timeType()}, + }, + []*proto3.Value{{Kind: (*proto3.Value_StringValue)(nil)}}, + }, + &NullTime{time.Now(), true}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_StringValue)(nil)}, "String")), + }, + { + // Field specifies TIMESTAMP type, but value is for BOOL type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: timeType()}, + }, + []*proto3.Value{boolProto(false)}, + }, + &NullTime{time.Now(), true}, + errDecodeColumn(0, errSrcVal(boolProto(false), "String")), + }, + { + // Field specifies TIMESTAMP type, but value is invalid timestamp. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: timeType()}, + }, + []*proto3.Value{stringProto("junk")}, + }, + &NullTime{time.Now(), true}, + errDecodeColumn(0, errBadEncoding(stringProto("junk"), func() error { + _, err := time.Parse(time.RFC3339Nano, "junk") + return err + }())), + }, + { + // Field specifies DATE type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: dateType()}, + }, + []*proto3.Value{{Kind: (*proto3.Value_StringValue)(nil)}}, + }, + &NullDate{civil.Date{}, true}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_StringValue)(nil)}, "String")), + }, + { + // Field specifies DATE type, but value is for BOOL type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: dateType()}, + }, + []*proto3.Value{boolProto(false)}, + }, + &NullDate{civil.Date{}, true}, + errDecodeColumn(0, errSrcVal(boolProto(false), "String")), + }, + { + // Field specifies DATE type, but value is invalid timestamp. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: dateType()}, + }, + []*proto3.Value{stringProto("junk")}, + }, + &NullDate{civil.Date{}, true}, + errDecodeColumn(0, errBadEncoding(stringProto("junk"), func() error { + _, err := civil.ParseDate("junk") + return err + }())), + }, + + { + // Field specifies ARRAY type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(intType())}, + }, + []*proto3.Value{{Kind: (*proto3.Value_ListValue)(nil)}}, + }, + &[]NullInt64{}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_ListValue)(nil)}, "List")), + }, + { + // Field specifies ARRAY type, value is having a nil ListValue. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(intType())}, + }, + []*proto3.Value{{Kind: &proto3.Value_ListValue{}}}, + }, + &[]NullInt64{}, + errDecodeColumn(0, errNilListValue("INT64")), + }, + { + // Field specifies ARRAY type, but value is for BYTES type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(intType())}, + }, + []*proto3.Value{bytesProto([]byte("value"))}, + }, + &[]NullInt64{}, + errDecodeColumn(0, errSrcVal(bytesProto([]byte("value")), "List")), + }, + { + // Field specifies ARRAY type, but value is for ARRAY type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(intType())}, + }, + []*proto3.Value{listProto(boolProto(true))}, + }, + &[]NullInt64{}, + errDecodeColumn(0, errDecodeArrayElement(0, boolProto(true), + "INT64", errSrcVal(boolProto(true), "String"))), + }, + { + // Field specifies ARRAY type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(stringType())}, + }, + []*proto3.Value{{Kind: (*proto3.Value_ListValue)(nil)}}, + }, + &[]NullString{}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_ListValue)(nil)}, "List")), + }, + { + // Field specifies ARRAY type, value is having a nil ListValue. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(stringType())}, + }, + []*proto3.Value{{Kind: &proto3.Value_ListValue{}}}, + }, + &[]NullString{}, + errDecodeColumn(0, errNilListValue("STRING")), + }, + { + // Field specifies ARRAY type, but value is for BOOL type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(stringType())}, + }, + []*proto3.Value{boolProto(true)}, + }, + &[]NullString{}, + errDecodeColumn(0, errSrcVal(boolProto(true), "List")), + }, + { + // Field specifies ARRAY type, but value is for ARRAY type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(stringType())}, + }, + []*proto3.Value{listProto(boolProto(true))}, + }, + &[]NullString{}, + errDecodeColumn(0, errDecodeArrayElement(0, boolProto(true), + "STRING", errSrcVal(boolProto(true), "String"))), + }, + { + // Field specifies ARRAY type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(floatType())}, + }, + []*proto3.Value{{Kind: (*proto3.Value_ListValue)(nil)}}, + }, + &[]NullFloat64{}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_ListValue)(nil)}, "List")), + }, + { + // Field specifies ARRAY type, value is having a nil ListValue. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(floatType())}, + }, + []*proto3.Value{{Kind: &proto3.Value_ListValue{}}}, + }, + &[]NullFloat64{}, + errDecodeColumn(0, errNilListValue("FLOAT64")), + }, + { + // Field specifies ARRAY type, but value is for STRING type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(floatType())}, + }, + []*proto3.Value{stringProto("value")}, + }, + &[]NullFloat64{}, + errDecodeColumn(0, errSrcVal(stringProto("value"), "List")), + }, + { + // Field specifies ARRAY type, but value is for ARRAY type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(floatType())}, + }, + []*proto3.Value{listProto(boolProto(true))}, + }, + &[]NullFloat64{}, + errDecodeColumn(0, errDecodeArrayElement(0, boolProto(true), + "FLOAT64", errSrcVal(boolProto(true), "Number"))), + }, + { + // Field specifies ARRAY type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(bytesType())}, + }, + []*proto3.Value{{Kind: (*proto3.Value_ListValue)(nil)}}, + }, + &[][]byte{}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_ListValue)(nil)}, "List")), + }, + { + // Field specifies ARRAY type, value is having a nil ListValue. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(bytesType())}, + }, + []*proto3.Value{{Kind: &proto3.Value_ListValue{}}}, + }, + &[][]byte{}, + errDecodeColumn(0, errNilListValue("BYTES")), + }, + { + // Field specifies ARRAY type, but value is for FLOAT64 type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(bytesType())}, + }, + []*proto3.Value{floatProto(1.0)}, + }, + &[][]byte{}, + errDecodeColumn(0, errSrcVal(floatProto(1.0), "List")), + }, + { + // Field specifies ARRAY type, but value is for ARRAY type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(bytesType())}, + }, + []*proto3.Value{listProto(floatProto(1.0))}, + }, + &[][]byte{}, + errDecodeColumn(0, errDecodeArrayElement(0, floatProto(1.0), + "BYTES", errSrcVal(floatProto(1.0), "String"))), + }, + { + // Field specifies ARRAY type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(boolType())}, + }, + []*proto3.Value{{Kind: (*proto3.Value_ListValue)(nil)}}, + }, + &[]NullBool{}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_ListValue)(nil)}, "List")), + }, + { + // Field specifies ARRAY type, value is having a nil ListValue. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(boolType())}, + }, + []*proto3.Value{{Kind: &proto3.Value_ListValue{}}}, + }, + &[]NullBool{}, + errDecodeColumn(0, errNilListValue("BOOL")), + }, + { + // Field specifies ARRAY type, but value is for FLOAT64 type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(boolType())}, + }, + []*proto3.Value{floatProto(1.0)}, + }, + &[]NullBool{}, + errDecodeColumn(0, errSrcVal(floatProto(1.0), "List")), + }, + { + // Field specifies ARRAY type, but value is for ARRAY type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(boolType())}, + }, + []*proto3.Value{listProto(floatProto(1.0))}, + }, + &[]NullBool{}, + errDecodeColumn(0, errDecodeArrayElement(0, floatProto(1.0), + "BOOL", errSrcVal(floatProto(1.0), "Bool"))), + }, + { + // Field specifies ARRAY type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(timeType())}, + }, + []*proto3.Value{{Kind: (*proto3.Value_ListValue)(nil)}}, + }, + &[]NullTime{}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_ListValue)(nil)}, "List")), + }, + { + // Field specifies ARRAY type, value is having a nil ListValue. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(timeType())}, + }, + []*proto3.Value{{Kind: &proto3.Value_ListValue{}}}, + }, + &[]NullTime{}, + errDecodeColumn(0, errNilListValue("TIMESTAMP")), + }, + { + // Field specifies ARRAY type, but value is for FLOAT64 type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(timeType())}, + }, + []*proto3.Value{floatProto(1.0)}, + }, + &[]NullTime{}, + errDecodeColumn(0, errSrcVal(floatProto(1.0), "List")), + }, + { + // Field specifies ARRAY type, but value is for ARRAY type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(timeType())}, + }, + []*proto3.Value{listProto(floatProto(1.0))}, + }, + &[]NullTime{}, + errDecodeColumn(0, errDecodeArrayElement(0, floatProto(1.0), + "TIMESTAMP", errSrcVal(floatProto(1.0), "String"))), + }, + { + // Field specifies ARRAY type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(dateType())}, + }, + []*proto3.Value{{Kind: (*proto3.Value_ListValue)(nil)}}, + }, + &[]NullDate{}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_ListValue)(nil)}, "List")), + }, + { + // Field specifies ARRAY type, value is having a nil ListValue. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(dateType())}, + }, + []*proto3.Value{{Kind: &proto3.Value_ListValue{}}}, + }, + &[]NullDate{}, + errDecodeColumn(0, errNilListValue("DATE")), + }, + { + // Field specifies ARRAY type, but value is for FLOAT64 type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(dateType())}, + }, + []*proto3.Value{floatProto(1.0)}, + }, + &[]NullDate{}, + errDecodeColumn(0, errSrcVal(floatProto(1.0), "List")), + }, + { + // Field specifies ARRAY type, but value is for ARRAY type. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(dateType())}, + }, + []*proto3.Value{listProto(floatProto(1.0))}, + }, + &[]NullDate{}, + errDecodeColumn(0, errDecodeArrayElement(0, floatProto(1.0), + "DATE", errSrcVal(floatProto(1.0), "String"))), + }, + { + // Field specifies ARRAY type, value is having a nil Kind. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + ))}, + }, + []*proto3.Value{{Kind: (*proto3.Value_ListValue)(nil)}}, + }, + &[]*struct { + Col1 int64 + Col2 float64 + Col3 string + }{}, + errDecodeColumn(0, errSrcVal(&proto3.Value{Kind: (*proto3.Value_ListValue)(nil)}, "List")), + }, + { + // Field specifies ARRAY type, value is having a nil ListValue. + &Row{ + []*sppb.StructType_Field{ + {Name: "Col0", Type: listType(structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + ))}, + }, + []*proto3.Value{{Kind: &proto3.Value_ListValue{}}}, + }, + &[]*struct { + Col1 int64 + Col2 float64 + Col3 string + }{}, + errDecodeColumn(0, errNilListValue("STRUCT")), + }, + { + // Field specifies ARRAY type, value is having a nil ListValue. + &Row{ + []*sppb.StructType_Field{ + { + Name: "Col0", + Type: listType( + structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + ), + ), + }, + }, + []*proto3.Value{{Kind: &proto3.Value_ListValue{}}}, + }, + &[]NullRow{}, + errDecodeColumn(0, errNilListValue("STRUCT")), + }, + { + // Field specifies ARRAY type, value is for BYTES type. + &Row{ + []*sppb.StructType_Field{ + { + Name: "Col0", + Type: listType( + structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + ), + ), + }, + }, + []*proto3.Value{bytesProto([]byte("value"))}, + }, + &[]*struct { + Col1 int64 + Col2 float64 + Col3 string + }{}, + errDecodeColumn(0, errSrcVal(bytesProto([]byte("value")), "List")), + }, + { + // Field specifies ARRAY type, value is for BYTES type. + &Row{ + []*sppb.StructType_Field{ + { + Name: "Col0", + Type: listType( + structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + ), + ), + }, + }, + []*proto3.Value{listProto(bytesProto([]byte("value")))}, + }, + &[]NullRow{}, + errDecodeColumn(0, errNotStructElement(0, bytesProto([]byte("value")))), + }, + { + // Field specifies ARRAY type, value is for ARRAY type. + &Row{ + []*sppb.StructType_Field{ + { + Name: "Col0", + Type: listType( + structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + ), + ), + }, + }, + []*proto3.Value{listProto(bytesProto([]byte("value")))}, + }, + &[]*struct { + Col1 int64 + Col2 float64 + Col3 string + }{}, + errDecodeColumn(0, errDecodeArrayElement(0, bytesProto([]byte("value")), + "STRUCT", errSrcVal(bytesProto([]byte("value")), "List"))), + }, + { + // Field specifies ARRAY, but is having nil StructType. + &Row{ + []*sppb.StructType_Field{ + { + Name: "Col0", Type: listType(&sppb.Type{Code: sppb.TypeCode_STRUCT}), + }, + }, + []*proto3.Value{listProto(listProto(intProto(1), floatProto(2.0), stringProto("3")))}, + }, + &[]*struct { + Col1 int64 + Col2 float64 + Col3 string + }{}, + errDecodeColumn(0, errDecodeArrayElement(0, listProto(intProto(1), floatProto(2.0), stringProto("3")), + "STRUCT", errNilSpannerStructType())), + }, + { + // Field specifies ARRAY, but the second struct value is for BOOL type instead of FLOAT64. + &Row{ + []*sppb.StructType_Field{ + { + Name: "Col0", + Type: listType( + structType( + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + ), + ), + }, + }, + []*proto3.Value{listProto(listProto(intProto(1), boolProto(true), stringProto("3")))}, + }, + &[]*struct { + Col1 int64 + Col2 float64 + Col3 string + }{}, + errDecodeColumn( + 0, + errDecodeArrayElement( + 0, listProto(intProto(1), boolProto(true), stringProto("3")), "STRUCT", + errDecodeStructField( + &sppb.StructType{ + Fields: []*sppb.StructType_Field{ + mkField("Col1", intType()), + mkField("Col2", floatType()), + mkField("Col3", stringType()), + }, + }, + "Col2", + errSrcVal(boolProto(true), "Number"), + ), + ), + ), + }, + } { + if gotErr := test.row.Column(0, test.dst); !testEqual(gotErr, test.wantErr) { + t.Errorf("%v: test.row.Column(0) got error %v, want %v", i, gotErr, test.wantErr) + } + if gotErr := test.row.ColumnByName("Col0", test.dst); !testEqual(gotErr, test.wantErr) { + t.Errorf("%v: test.row.ColumnByName(%q) got error %v, want %v", i, "Col0", gotErr, test.wantErr) + } + if gotErr := test.row.Columns(test.dst); !testEqual(gotErr, test.wantErr) { + t.Errorf("%v: test.row.Columns(%T) got error %v, want %v", i, test.dst, gotErr, test.wantErr) + } + } +} + +// Test Row.ToStruct(). +func TestToStruct(t *testing.T) { + s := []struct { + // STRING / STRING ARRAY + PrimaryKey string `spanner:"STRING"` + NullString NullString `spanner:"NULL_STRING"` + StringArray []NullString `spanner:"STRING_ARRAY"` + NullStringArray []NullString `spanner:"NULL_STRING_ARRAY"` + // BYTES / BYTES ARRAY + Bytes []byte `spanner:"BYTES"` + NullBytes []byte `spanner:"NULL_BYTES"` + BytesArray [][]byte `spanner:"BYTES_ARRAY"` + NullBytesArray [][]byte `spanner:"NULL_BYTES_ARRAY"` + // INT64 / INT64 ARRAY + Int64 int64 `spanner:"INT64"` + NullInt64 NullInt64 `spanner:"NULL_INT64"` + Int64Array []NullInt64 `spanner:"INT64_ARRAY"` + NullInt64Array []NullInt64 `spanner:"NULL_INT64_ARRAY"` + // BOOL / BOOL ARRAY + Bool bool `spanner:"BOOL"` + NullBool NullBool `spanner:"NULL_BOOL"` + BoolArray []NullBool `spanner:"BOOL_ARRAY"` + NullBoolArray []NullBool `spanner:"NULL_BOOL_ARRAY"` + // FLOAT64 / FLOAT64 ARRAY + Float64 float64 `spanner:"FLOAT64"` + NullFloat64 NullFloat64 `spanner:"NULL_FLOAT64"` + Float64Array []NullFloat64 `spanner:"FLOAT64_ARRAY"` + NullFloat64Array []NullFloat64 `spanner:"NULL_FLOAT64_ARRAY"` + // TIMESTAMP / TIMESTAMP ARRAY + Timestamp time.Time `spanner:"TIMESTAMP"` + NullTimestamp NullTime `spanner:"NULL_TIMESTAMP"` + TimestampArray []NullTime `spanner:"TIMESTAMP_ARRAY"` + NullTimestampArray []NullTime `spanner:"NULL_TIMESTAMP_ARRAY"` + // DATE / DATE ARRAY + Date civil.Date `spanner:"DATE"` + NullDate NullDate `spanner:"NULL_DATE"` + DateArray []NullDate `spanner:"DATE_ARRAY"` + NullDateArray []NullDate `spanner:"NULL_DATE_ARRAY"` + + // STRUCT ARRAY + StructArray []*struct { + Col1 int64 + Col2 float64 + Col3 string + } `spanner:"STRUCT_ARRAY"` + NullStructArray []*struct { + Col1 int64 + Col2 float64 + Col3 string + } `spanner:"NULL_STRUCT_ARRAY"` + }{ + {}, // got + { + // STRING / STRING ARRAY + "value", + NullString{}, + []NullString{{"value1", true}, {}, {"value3", true}}, + []NullString(nil), + // BYTES / BYTES ARRAY + []byte("value"), + []byte(nil), + [][]byte{[]byte("value1"), nil, []byte("value3")}, + [][]byte(nil), + // INT64 / INT64 ARRAY + int64(17), + NullInt64{}, + []NullInt64{{int64(1), true}, {int64(2), true}, {}}, + []NullInt64(nil), + // BOOL / BOOL ARRAY + true, + NullBool{}, + []NullBool{{}, {true, true}, {false, true}}, + []NullBool(nil), + // FLOAT64 / FLOAT64 ARRAY + 1.7, + NullFloat64{}, + []NullFloat64{{}, {}, {1.7, true}}, + []NullFloat64(nil), + // TIMESTAMP / TIMESTAMP ARRAY + tm, + NullTime{}, + []NullTime{{}, {tm, true}}, + []NullTime(nil), + // DATE / DATE ARRAY + dt, + NullDate{}, + []NullDate{{}, {dt, true}}, + []NullDate(nil), + // STRUCT ARRAY + []*struct { + Col1 int64 + Col2 float64 + Col3 string + }{ + nil, + + {3, 33.3, "three"}, + nil, + }, + []*struct { + Col1 int64 + Col2 float64 + Col3 string + }(nil), + }, // want + } + err := row.ToStruct(&s[0]) + if err != nil { + t.Errorf("row.ToStruct() returns error: %v, want nil", err) + } else if !testEqual(s[0], s[1]) { + t.Errorf("row.ToStruct() fetches struct %v, want %v", s[0], s[1]) + } +} + +func TestToStructEmbedded(t *testing.T) { + type ( + S1 struct{ F1 string } + S2 struct { + S1 + F2 string + } + ) + r := Row{ + []*sppb.StructType_Field{ + {Name: "F1", Type: stringType()}, + {Name: "F2", Type: stringType()}, + }, + []*proto3.Value{ + stringProto("v1"), + stringProto("v2"), + }, + } + var got S2 + if err := r.ToStruct(&got); err != nil { + t.Fatal(err) + } + want := S2{S1: S1{F1: "v1"}, F2: "v2"} + if !testEqual(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } +} + +// Test helpers for getting column names. +func TestColumnNameAndIndex(t *testing.T) { + // Test Row.Size(). + if rs := row.Size(); rs != len(row.fields) { + t.Errorf("row.Size() returns %v, want %v", rs, len(row.fields)) + } + // Test Row.Size() on empty Row. + if rs := (&Row{}).Size(); rs != 0 { + t.Errorf("empty_row.Size() returns %v, want %v", rs, 0) + } + // Test Row.ColumnName() + for i, col := range row.fields { + if cn := row.ColumnName(i); cn != col.Name { + t.Errorf("row.ColumnName(%v) returns %q, want %q", i, cn, col.Name) + } + goti, err := row.ColumnIndex(col.Name) + if err != nil { + t.Errorf("ColumnIndex(%q) error %v", col.Name, err) + continue + } + if goti != i { + t.Errorf("ColumnIndex(%q) = %d, want %d", col.Name, goti, i) + } + } + // Test Row.ColumnName on empty Row. + if cn := (&Row{}).ColumnName(0); cn != "" { + t.Errorf("empty_row.ColumnName(%v) returns %q, want %q", 0, cn, "") + } + // Test Row.ColumnIndex on empty Row. + if _, err := (&Row{}).ColumnIndex(""); err == nil { + t.Error("empty_row.ColumnIndex returns nil, want error") + } +} + +func TestNewRow(t *testing.T) { + for _, test := range []struct { + names []string + values []interface{} + want *Row + wantErr error + }{ + { + want: &Row{fields: []*sppb.StructType_Field{}, vals: []*proto3.Value{}}, + }, + { + names: []string{}, + values: []interface{}{}, + want: &Row{fields: []*sppb.StructType_Field{}, vals: []*proto3.Value{}}, + }, + { + names: []string{"a", "b"}, + values: []interface{}{}, + want: nil, + wantErr: errNamesValuesMismatch([]string{"a", "b"}, []interface{}{}), + }, + { + names: []string{"a", "b", "c"}, + values: []interface{}{5, "abc", GenericColumnValue{listType(intType()), listProto(intProto(91), nullProto(), intProto(87))}}, + want: &Row{ + []*sppb.StructType_Field{ + {Name: "a", Type: intType()}, + {Name: "b", Type: stringType()}, + {Name: "c", Type: listType(intType())}, + }, + []*proto3.Value{ + intProto(5), + stringProto("abc"), + listProto(intProto(91), nullProto(), intProto(87)), + }, + }, + }, + } { + got, err := NewRow(test.names, test.values) + if !testEqual(err, test.wantErr) { + t.Errorf("NewRow(%v,%v).err = %s, want %s", test.names, test.values, err, test.wantErr) + continue + } + if !testEqual(got, test.want) { + t.Errorf("NewRow(%v,%v) = %s, want %s", test.names, test.values, got, test.want) + continue + } + } +} + +func BenchmarkColumn(b *testing.B) { + var s string + for i := 0; i < b.N; i++ { + if err := row.Column(0, &s); err != nil { + b.Fatal(err) + } + } +} diff --git a/vendor/cloud.google.com/go/spanner/session.go b/vendor/cloud.google.com/go/spanner/session.go new file mode 100644 index 000000000..d058e57b2 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/session.go @@ -0,0 +1,1093 @@ +/* +Copyright 2017 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 spanner + +import ( + "container/heap" + "container/list" + "context" + "fmt" + "log" + "math/rand" + "strings" + "sync" + "time" + + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// sessionHandle is an interface for transactions to access Cloud Spanner sessions safely. It is generated by sessionPool.take(). +type sessionHandle struct { + // mu guarantees that the inner session object is returned / destroyed only once. + mu sync.Mutex + // session is a pointer to a session object. Transactions never need to access it directly. + session *session +} + +// recycle gives the inner session object back to its home session pool. It is safe to call recycle multiple times but only the first one would take effect. +func (sh *sessionHandle) recycle() { + sh.mu.Lock() + defer sh.mu.Unlock() + if sh.session == nil { + // sessionHandle has already been recycled. + return + } + sh.session.recycle() + sh.session = nil +} + +// getID gets the Cloud Spanner session ID from the internal session object. getID returns empty string if the sessionHandle is nil or the inner session +// object has been released by recycle / destroy. +func (sh *sessionHandle) getID() string { + sh.mu.Lock() + defer sh.mu.Unlock() + if sh.session == nil { + // sessionHandle has already been recycled/destroyed. + return "" + } + return sh.session.getID() +} + +// getClient gets the Cloud Spanner RPC client associated with the session ID in sessionHandle. +func (sh *sessionHandle) getClient() sppb.SpannerClient { + sh.mu.Lock() + defer sh.mu.Unlock() + if sh.session == nil { + return nil + } + return sh.session.client +} + +// getMetadata returns the metadata associated with the session in sessionHandle. +func (sh *sessionHandle) getMetadata() metadata.MD { + sh.mu.Lock() + defer sh.mu.Unlock() + if sh.session == nil { + return nil + } + return sh.session.md +} + +// getTransactionID returns the transaction id in the session if available. +func (sh *sessionHandle) getTransactionID() transactionID { + sh.mu.Lock() + defer sh.mu.Unlock() + if sh.session == nil { + return nil + } + return sh.session.tx +} + +// destroy destroys the inner session object. It is safe to call destroy multiple times and only the first call would attempt to +// destroy the inner session object. +func (sh *sessionHandle) destroy() { + sh.mu.Lock() + s := sh.session + sh.session = nil + sh.mu.Unlock() + if s == nil { + // sessionHandle has already been destroyed. + return + } + s.destroy(false) +} + +// session wraps a Cloud Spanner session ID through which transactions are created and executed. +type session struct { + // client is the RPC channel to Cloud Spanner. It is set only once during session's creation. + client sppb.SpannerClient + // id is the unique id of the session in Cloud Spanner. It is set only once during session's creation. + id string + // pool is the session's home session pool where it was created. It is set only once during session's creation. + pool *sessionPool + // createTime is the timestamp of the session's creation. It is set only once during session's creation. + createTime time.Time + + // mu protects the following fields from concurrent access: both healthcheck workers and transactions can modify them. + mu sync.Mutex + // valid marks the validity of a session. + valid bool + // hcIndex is the index of the session inside the global healthcheck queue. If hcIndex < 0, session has been unregistered from the queue. + hcIndex int + // idleList is the linkedlist node which links the session to its home session pool's idle list. If idleList == nil, the + // session is not in idle list. + idleList *list.Element + // nextCheck is the timestamp of next scheduled healthcheck of the session. It is maintained by the global health checker. + nextCheck time.Time + // checkingHelath is true if currently this session is being processed by health checker. Must be modified under health checker lock. + checkingHealth bool + // md is the Metadata to be sent with each request. + md metadata.MD + // tx contains the transaction id if the session has been prepared for write. + tx transactionID +} + +// isValid returns true if the session is still valid for use. +func (s *session) isValid() bool { + s.mu.Lock() + defer s.mu.Unlock() + return s.valid +} + +// isWritePrepared returns true if the session is prepared for write. +func (s *session) isWritePrepared() bool { + s.mu.Lock() + defer s.mu.Unlock() + return s.tx != nil +} + +// String implements fmt.Stringer for session. +func (s *session) String() string { + s.mu.Lock() + defer s.mu.Unlock() + return fmt.Sprintf("", + s.id, s.hcIndex, s.idleList, s.valid, s.createTime, s.nextCheck) +} + +// ping verifies if the session is still alive in Cloud Spanner. +func (s *session) ping() error { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + return runRetryable(ctx, func(ctx context.Context) error { + _, err := s.client.GetSession(contextWithOutgoingMetadata(ctx, s.pool.md), &sppb.GetSessionRequest{Name: s.getID()}) // s.getID is safe even when s is invalid. + return err + }) +} + +// setHcIndex atomically sets the session's index in the healthcheck queue and returns the old index. +func (s *session) setHcIndex(i int) int { + s.mu.Lock() + defer s.mu.Unlock() + oi := s.hcIndex + s.hcIndex = i + return oi +} + +// setIdleList atomically sets the session's idle list link and returns the old link. +func (s *session) setIdleList(le *list.Element) *list.Element { + s.mu.Lock() + defer s.mu.Unlock() + old := s.idleList + s.idleList = le + return old +} + +// invalidate marks a session as invalid and returns the old validity. +func (s *session) invalidate() bool { + s.mu.Lock() + defer s.mu.Unlock() + ov := s.valid + s.valid = false + return ov +} + +// setNextCheck sets the timestamp for next healthcheck on the session. +func (s *session) setNextCheck(t time.Time) { + s.mu.Lock() + defer s.mu.Unlock() + s.nextCheck = t +} + +// setTransactionID sets the transaction id in the session +func (s *session) setTransactionID(tx transactionID) { + s.mu.Lock() + defer s.mu.Unlock() + s.tx = tx +} + +// getID returns the session ID which uniquely identifies the session in Cloud Spanner. +func (s *session) getID() string { + s.mu.Lock() + defer s.mu.Unlock() + return s.id +} + +// getHcIndex returns the session's index into the global healthcheck priority queue. +func (s *session) getHcIndex() int { + s.mu.Lock() + defer s.mu.Unlock() + return s.hcIndex +} + +// getIdleList returns the session's link in its home session pool's idle list. +func (s *session) getIdleList() *list.Element { + s.mu.Lock() + defer s.mu.Unlock() + return s.idleList +} + +// getNextCheck returns the timestamp for next healthcheck on the session. +func (s *session) getNextCheck() time.Time { + s.mu.Lock() + defer s.mu.Unlock() + return s.nextCheck +} + +// recycle turns the session back to its home session pool. +func (s *session) recycle() { + s.setTransactionID(nil) + if !s.pool.recycle(s) { + // s is rejected by its home session pool because it expired and the session pool currently has enough open sessions. + s.destroy(false) + } +} + +// destroy removes the session from its home session pool, healthcheck queue and Cloud Spanner service. +func (s *session) destroy(isExpire bool) bool { + // Remove s from session pool. + if !s.pool.remove(s, isExpire) { + return false + } + // Unregister s from healthcheck queue. + s.pool.hc.unregister(s) + // Remove s from Cloud Spanner service. + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + s.delete(ctx) + return true +} + +func (s *session) delete(ctx context.Context) { + // Ignore the error returned by runRetryable because even if we fail to explicitly destroy the session, + // it will be eventually garbage collected by Cloud Spanner. + err := runRetryable(ctx, func(ctx context.Context) error { + _, e := s.client.DeleteSession(ctx, &sppb.DeleteSessionRequest{Name: s.getID()}) + return e + }) + if err != nil { + log.Printf("Failed to delete session %v. Error: %v", s.getID(), err) + } +} + +// prepareForWrite prepares the session for write if it is not already in that state. +func (s *session) prepareForWrite(ctx context.Context) error { + if s.isWritePrepared() { + return nil + } + tx, err := beginTransaction(ctx, s.getID(), s.client) + if err != nil { + return err + } + s.setTransactionID(tx) + return nil +} + +// SessionPoolConfig stores configurations of a session pool. +type SessionPoolConfig struct { + // getRPCClient is the caller supplied method for getting a gRPC client to Cloud Spanner, this makes session pool able to use client pooling. + getRPCClient func() (sppb.SpannerClient, error) + // MaxOpened is the maximum number of opened sessions allowed by the session + // pool. Defaults to NumChannels * 100. If the client tries to open a session and + // there are already MaxOpened sessions, it will block until one becomes + // available or the context passed to the client method is canceled or times out. + MaxOpened uint64 + // MinOpened is the minimum number of opened sessions that the session pool + // tries to maintain. Session pool won't continue to expire sessions if number + // of opened connections drops below MinOpened. However, if a session is found + // to be broken, it will still be evicted from the session pool, therefore it is + // posssible that the number of opened sessions drops below MinOpened. + MinOpened uint64 + // MaxIdle is the maximum number of idle sessions, pool is allowed to keep. Defaults to 0. + MaxIdle uint64 + // MaxBurst is the maximum number of concurrent session creation requests. Defaults to 10. + MaxBurst uint64 + // WriteSessions is the fraction of sessions we try to keep prepared for write. + WriteSessions float64 + // HealthCheckWorkers is number of workers used by health checker for this pool. + HealthCheckWorkers int + // HealthCheckInterval is how often the health checker pings a session. Defaults to 5 min. + HealthCheckInterval time.Duration + // healthCheckSampleInterval is how often the health checker samples live session (for use in maintaining session pool size). Defaults to 1 min. + healthCheckSampleInterval time.Duration + // sessionLabels for the sessions created in the session pool. + sessionLabels map[string]string +} + +// errNoRPCGetter returns error for SessionPoolConfig missing getRPCClient method. +func errNoRPCGetter() error { + return spannerErrorf(codes.InvalidArgument, "require SessionPoolConfig.getRPCClient != nil, got nil") +} + +// errMinOpenedGTMapOpened returns error for SessionPoolConfig.MaxOpened < SessionPoolConfig.MinOpened when SessionPoolConfig.MaxOpened is set. +func errMinOpenedGTMaxOpened(maxOpened, minOpened uint64) error { + return spannerErrorf(codes.InvalidArgument, + "require SessionPoolConfig.MaxOpened >= SessionPoolConfig.MinOpened, got %v and %v", maxOpened, minOpened) +} + +// validate verifies that the SessionPoolConfig is good for use. +func (spc *SessionPoolConfig) validate() error { + if spc.getRPCClient == nil { + return errNoRPCGetter() + } + if spc.MinOpened > spc.MaxOpened && spc.MaxOpened > 0 { + return errMinOpenedGTMaxOpened(spc.MaxOpened, spc.MinOpened) + } + return nil +} + +// sessionPool creates and caches Cloud Spanner sessions. +type sessionPool struct { + // mu protects sessionPool from concurrent access. + mu sync.Mutex + // valid marks the validity of the session pool. + valid bool + // db is the database name that all sessions in the pool are associated with. + db string + // idleList caches idle session IDs. Session IDs in this list can be allocated for use. + idleList list.List + // idleWriteList caches idle sessions which have been prepared for write. + idleWriteList list.List + // mayGetSession is for broadcasting that session retrival/creation may proceed. + mayGetSession chan struct{} + // numOpened is the total number of open sessions from the session pool. + numOpened uint64 + // createReqs is the number of ongoing session creation requests. + createReqs uint64 + // prepareReqs is the number of ongoing session preparation request. + prepareReqs uint64 + // configuration of the session pool. + SessionPoolConfig + // Metadata to be sent with each request + md metadata.MD + // hc is the health checker + hc *healthChecker +} + +// newSessionPool creates a new session pool. +func newSessionPool(db string, config SessionPoolConfig, md metadata.MD) (*sessionPool, error) { + if err := config.validate(); err != nil { + return nil, err + } + pool := &sessionPool{ + db: db, + valid: true, + mayGetSession: make(chan struct{}), + SessionPoolConfig: config, + md: md, + } + if config.HealthCheckWorkers == 0 { + // With 10 workers and assuming average latency of 5 ms for BeginTransaction, we will be able to + // prepare 2000 tx/sec in advance. If the rate of takeWriteSession is more than that, it will + // degrade to doing BeginTransaction inline. + // TODO: consider resizing the worker pool dynamically according to the load. + config.HealthCheckWorkers = 10 + } + if config.HealthCheckInterval == 0 { + config.HealthCheckInterval = 5 * time.Minute + } + if config.healthCheckSampleInterval == 0 { + config.healthCheckSampleInterval = time.Minute + } + // On GCE VM, within the same region an healthcheck ping takes on average 10ms to finish, given a 5 minutes interval and + // 10 healthcheck workers, a healthChecker can effectively mantain 100 checks_per_worker/sec * 10 workers * 300 seconds = 300K sessions. + pool.hc = newHealthChecker(config.HealthCheckInterval, config.HealthCheckWorkers, config.healthCheckSampleInterval, pool) + close(pool.hc.ready) + return pool, nil +} + +// isValid checks if the session pool is still valid. +func (p *sessionPool) isValid() bool { + if p == nil { + return false + } + p.mu.Lock() + defer p.mu.Unlock() + return p.valid +} + +// close marks the session pool as closed. +func (p *sessionPool) close() { + if p == nil { + return + } + p.mu.Lock() + if !p.valid { + p.mu.Unlock() + return + } + p.valid = false + p.mu.Unlock() + p.hc.close() + // destroy all the sessions + p.hc.mu.Lock() + allSessions := make([]*session, len(p.hc.queue.sessions)) + copy(allSessions, p.hc.queue.sessions) + p.hc.mu.Unlock() + for _, s := range allSessions { + s.destroy(false) + } +} + +// errInvalidSessionPool returns error for using an invalid session pool. +func errInvalidSessionPool() error { + return spannerErrorf(codes.InvalidArgument, "invalid session pool") +} + +// errGetSessionTimeout returns error for context timeout during sessionPool.take(). +func errGetSessionTimeout() error { + return spannerErrorf(codes.Canceled, "timeout / context canceled during getting session") +} + +// shouldPrepareWrite returns true if we should prepare more sessions for write. +func (p *sessionPool) shouldPrepareWrite() bool { + return float64(p.numOpened)*p.WriteSessions > float64(p.idleWriteList.Len()+int(p.prepareReqs)) +} + +func (p *sessionPool) createSession(ctx context.Context) (*session, error) { + tracePrintf(ctx, nil, "Creating a new session") + doneCreate := func(done bool) { + p.mu.Lock() + if !done { + // Session creation failed, give budget back. + p.numOpened-- + recordStat(ctx, OpenSessionCount, int64(p.numOpened)) + } + p.createReqs-- + // Notify other waiters blocking on session creation. + close(p.mayGetSession) + p.mayGetSession = make(chan struct{}) + p.mu.Unlock() + } + sc, err := p.getRPCClient() + if err != nil { + doneCreate(false) + return nil, err + } + s, err := createSession(ctx, sc, p.db, p.sessionLabels, p.md) + if err != nil { + doneCreate(false) + // Should return error directly because of the previous retries on CreateSession RPC. + return nil, err + } + s.pool = p + p.hc.register(s) + doneCreate(true) + return s, nil +} + +func createSession(ctx context.Context, sc sppb.SpannerClient, db string, labels map[string]string, md metadata.MD) (*session, error) { + var s *session + err := runRetryable(ctx, func(ctx context.Context) error { + sid, e := sc.CreateSession(ctx, &sppb.CreateSessionRequest{ + Database: db, + Session: &sppb.Session{Labels: labels}, + }) + if e != nil { + return e + } + // If no error, construct the new session. + s = &session{valid: true, client: sc, id: sid.Name, createTime: time.Now(), md: md} + return nil + }) + if err != nil { + return nil, err + } + return s, nil +} + +func (p *sessionPool) isHealthy(s *session) bool { + if s.getNextCheck().Add(2 * p.hc.getInterval()).Before(time.Now()) { + // TODO: figure out if we need to schedule a new healthcheck worker here. + if err := s.ping(); shouldDropSession(err) { + // The session is already bad, continue to fetch/create a new one. + s.destroy(false) + return false + } + p.hc.scheduledHC(s) + } + return true +} + +// take returns a cached session if there are available ones; if there isn't any, it tries to allocate a new one. +// Session returned by take should be used for read operations. +func (p *sessionPool) take(ctx context.Context) (*sessionHandle, error) { + tracePrintf(ctx, nil, "Acquiring a read-only session") + ctx = contextWithOutgoingMetadata(ctx, p.md) + for { + var ( + s *session + err error + ) + + p.mu.Lock() + if !p.valid { + p.mu.Unlock() + return nil, errInvalidSessionPool() + } + if p.idleList.Len() > 0 { + // Idle sessions are available, get one from the top of the idle list. + s = p.idleList.Remove(p.idleList.Front()).(*session) + tracePrintf(ctx, map[string]interface{}{"sessionID": s.getID()}, + "Acquired read-only session") + } else if p.idleWriteList.Len() > 0 { + s = p.idleWriteList.Remove(p.idleWriteList.Front()).(*session) + tracePrintf(ctx, map[string]interface{}{"sessionID": s.getID()}, + "Acquired read-write session") + } + if s != nil { + s.setIdleList(nil) + p.mu.Unlock() + // From here, session is no longer in idle list, so healthcheck workers won't destroy it. + // If healthcheck workers failed to schedule healthcheck for the session timely, do the check here. + // Because session check is still much cheaper than session creation, they should be reused as much as possible. + if !p.isHealthy(s) { + continue + } + return &sessionHandle{session: s}, nil + } + // Idle list is empty, block if session pool has reached max session creation concurrency or max number of open sessions. + if (p.MaxOpened > 0 && p.numOpened >= p.MaxOpened) || (p.MaxBurst > 0 && p.createReqs >= p.MaxBurst) { + mayGetSession := p.mayGetSession + p.mu.Unlock() + tracePrintf(ctx, nil, "Waiting for read-only session to become available") + select { + case <-ctx.Done(): + tracePrintf(ctx, nil, "Context done waiting for session") + return nil, errGetSessionTimeout() + case <-mayGetSession: + } + continue + } + // Take budget before the actual session creation. + p.numOpened++ + recordStat(ctx, OpenSessionCount, int64(p.numOpened)) + p.createReqs++ + p.mu.Unlock() + if s, err = p.createSession(ctx); err != nil { + tracePrintf(ctx, nil, "Error creating session: %v", err) + return nil, toSpannerError(err) + } + tracePrintf(ctx, map[string]interface{}{"sessionID": s.getID()}, + "Created session") + return &sessionHandle{session: s}, nil + } +} + +// takeWriteSession returns a write prepared cached session if there are available ones; if there isn't any, it tries to allocate a new one. +// Session returned should be used for read write transactions. +func (p *sessionPool) takeWriteSession(ctx context.Context) (*sessionHandle, error) { + tracePrintf(ctx, nil, "Acquiring a read-write session") + ctx = contextWithOutgoingMetadata(ctx, p.md) + for { + var ( + s *session + err error + ) + + p.mu.Lock() + if !p.valid { + p.mu.Unlock() + return nil, errInvalidSessionPool() + } + if p.idleWriteList.Len() > 0 { + // Idle sessions are available, get one from the top of the idle list. + s = p.idleWriteList.Remove(p.idleWriteList.Front()).(*session) + tracePrintf(ctx, map[string]interface{}{"sessionID": s.getID()}, "Acquired read-write session") + } else if p.idleList.Len() > 0 { + s = p.idleList.Remove(p.idleList.Front()).(*session) + tracePrintf(ctx, map[string]interface{}{"sessionID": s.getID()}, "Acquired read-only session") + } + if s != nil { + s.setIdleList(nil) + p.mu.Unlock() + // From here, session is no longer in idle list, so healthcheck workers won't destroy it. + // If healthcheck workers failed to schedule healthcheck for the session timely, do the check here. + // Because session check is still much cheaper than session creation, they should be reused as much as possible. + if !p.isHealthy(s) { + continue + } + } else { + // Idle list is empty, block if session pool has reached max session creation concurrency or max number of open sessions. + if (p.MaxOpened > 0 && p.numOpened >= p.MaxOpened) || (p.MaxBurst > 0 && p.createReqs >= p.MaxBurst) { + mayGetSession := p.mayGetSession + p.mu.Unlock() + tracePrintf(ctx, nil, "Waiting for read-write session to become available") + select { + case <-ctx.Done(): + tracePrintf(ctx, nil, "Context done waiting for session") + return nil, errGetSessionTimeout() + case <-mayGetSession: + } + continue + } + + // Take budget before the actual session creation. + p.numOpened++ + recordStat(ctx, OpenSessionCount, int64(p.numOpened)) + p.createReqs++ + p.mu.Unlock() + if s, err = p.createSession(ctx); err != nil { + tracePrintf(ctx, nil, "Error creating session: %v", err) + return nil, toSpannerError(err) + } + tracePrintf(ctx, map[string]interface{}{"sessionID": s.getID()}, + "Created session") + } + if !s.isWritePrepared() { + if err = s.prepareForWrite(ctx); err != nil { + s.recycle() + tracePrintf(ctx, map[string]interface{}{"sessionID": s.getID()}, + "Error preparing session for write") + return nil, toSpannerError(err) + } + } + return &sessionHandle{session: s}, nil + } +} + +// recycle puts session s back to the session pool's idle list, it returns true if the session pool successfully recycles session s. +func (p *sessionPool) recycle(s *session) bool { + p.mu.Lock() + defer p.mu.Unlock() + if !s.isValid() || !p.valid { + // Reject the session if session is invalid or pool itself is invalid. + return false + } + // Put session at the back of the list to round robin for load balancing across channels. + if s.isWritePrepared() { + s.setIdleList(p.idleWriteList.PushBack(s)) + } else { + s.setIdleList(p.idleList.PushBack(s)) + } + // Broadcast that a session has been returned to idle list. + close(p.mayGetSession) + p.mayGetSession = make(chan struct{}) + return true +} + +// remove atomically removes session s from the session pool and invalidates s. +// If isExpire == true, the removal is triggered by session expiration and in such cases, only idle sessions can be removed. +func (p *sessionPool) remove(s *session, isExpire bool) bool { + p.mu.Lock() + defer p.mu.Unlock() + if isExpire && (p.numOpened <= p.MinOpened || s.getIdleList() == nil) { + // Don't expire session if the session is not in idle list (in use), or if number of open sessions is going below p.MinOpened. + return false + } + ol := s.setIdleList(nil) + // If the session is in the idlelist, remove it. + if ol != nil { + // Remove from whichever list it is in. + p.idleList.Remove(ol) + p.idleWriteList.Remove(ol) + } + if s.invalidate() { + // Decrease the number of opened sessions. + p.numOpened-- + recordStat(context.Background(), OpenSessionCount, int64(p.numOpened)) + // Broadcast that a session has been destroyed. + close(p.mayGetSession) + p.mayGetSession = make(chan struct{}) + return true + } + return false +} + +// hcHeap implements heap.Interface. It is used to create the priority queue for session healthchecks. +type hcHeap struct { + sessions []*session +} + +// Len impelemnts heap.Interface.Len. +func (h hcHeap) Len() int { + return len(h.sessions) +} + +// Less implements heap.Interface.Less. +func (h hcHeap) Less(i, j int) bool { + return h.sessions[i].getNextCheck().Before(h.sessions[j].getNextCheck()) +} + +// Swap implements heap.Interface.Swap. +func (h hcHeap) Swap(i, j int) { + h.sessions[i], h.sessions[j] = h.sessions[j], h.sessions[i] + h.sessions[i].setHcIndex(i) + h.sessions[j].setHcIndex(j) +} + +// Push implements heap.Interface.Push. +func (h *hcHeap) Push(s interface{}) { + ns := s.(*session) + ns.setHcIndex(len(h.sessions)) + h.sessions = append(h.sessions, ns) +} + +// Pop implements heap.Interface.Pop. +func (h *hcHeap) Pop() interface{} { + old := h.sessions + n := len(old) + s := old[n-1] + h.sessions = old[:n-1] + s.setHcIndex(-1) + return s +} + +// healthChecker performs periodical healthchecks on registered sessions. +type healthChecker struct { + // mu protects concurrent access to hcQueue. + mu sync.Mutex + // queue is the priority queue for session healthchecks. Sessions with lower nextCheck rank higher in the queue. + queue hcHeap + // interval is the average interval between two healthchecks on a session. + interval time.Duration + // workers is the number of concurrent healthcheck workers. + workers int + // waitWorkers waits for all healthcheck workers to exit + waitWorkers sync.WaitGroup + // pool is the underlying session pool. + pool *sessionPool + // sampleInterval is the interval of sampling by the maintainer. + sampleInterval time.Duration + // ready is used to signal that maintainer can start running. + ready chan struct{} + // done is used to signal that health checker should be closed. + done chan struct{} + // once is used for closing channel done only once. + once sync.Once +} + +// newHealthChecker initializes new instance of healthChecker. +func newHealthChecker(interval time.Duration, workers int, sampleInterval time.Duration, pool *sessionPool) *healthChecker { + if workers <= 0 { + workers = 1 + } + hc := &healthChecker{ + interval: interval, + workers: workers, + pool: pool, + sampleInterval: sampleInterval, + ready: make(chan struct{}), + done: make(chan struct{}), + } + hc.waitWorkers.Add(1) + go hc.maintainer() + for i := 1; i <= hc.workers; i++ { + hc.waitWorkers.Add(1) + go hc.worker(i) + } + return hc +} + +// close closes the healthChecker and waits for all healthcheck workers to exit. +func (hc *healthChecker) close() { + hc.once.Do(func() { close(hc.done) }) + hc.waitWorkers.Wait() +} + +// isClosing checks if a healthChecker is already closing. +func (hc *healthChecker) isClosing() bool { + select { + case <-hc.done: + return true + default: + return false + } +} + +// getInterval gets the healthcheck interval. +func (hc *healthChecker) getInterval() time.Duration { + hc.mu.Lock() + defer hc.mu.Unlock() + return hc.interval +} + +// scheduledHCLocked schedules next healthcheck on session s with the assumption that hc.mu is being held. +func (hc *healthChecker) scheduledHCLocked(s *session) { + // The next healthcheck will be scheduled after [interval*0.5, interval*1.5) nanoseconds. + nsFromNow := rand.Int63n(int64(hc.interval)) + int64(hc.interval)/2 + s.setNextCheck(time.Now().Add(time.Duration(nsFromNow))) + if hi := s.getHcIndex(); hi != -1 { + // Session is still being tracked by healthcheck workers. + heap.Fix(&hc.queue, hi) + } +} + +// scheduledHC schedules next healthcheck on session s. It is safe to be called concurrently. +func (hc *healthChecker) scheduledHC(s *session) { + hc.mu.Lock() + defer hc.mu.Unlock() + hc.scheduledHCLocked(s) +} + +// register registers a session with healthChecker for periodical healthcheck. +func (hc *healthChecker) register(s *session) { + hc.mu.Lock() + defer hc.mu.Unlock() + hc.scheduledHCLocked(s) + heap.Push(&hc.queue, s) +} + +// unregister unregisters a session from healthcheck queue. +func (hc *healthChecker) unregister(s *session) { + hc.mu.Lock() + defer hc.mu.Unlock() + oi := s.setHcIndex(-1) + if oi >= 0 { + heap.Remove(&hc.queue, oi) + } +} + +// markDone marks that health check for session has been performed. +func (hc *healthChecker) markDone(s *session) { + hc.mu.Lock() + defer hc.mu.Unlock() + s.checkingHealth = false +} + +// healthCheck checks the health of the session and pings it if needed. +func (hc *healthChecker) healthCheck(s *session) { + defer hc.markDone(s) + if !s.pool.isValid() { + // Session pool is closed, perform a garbage collection. + s.destroy(false) + return + } + if err := s.ping(); shouldDropSession(err) { + // Ping failed, destroy the session. + s.destroy(false) + } +} + +// worker performs the healthcheck on sessions in healthChecker's priority queue. +func (hc *healthChecker) worker(i int) { + // Returns a session which we should ping to keep it alive. + getNextForPing := func() *session { + hc.pool.mu.Lock() + defer hc.pool.mu.Unlock() + hc.mu.Lock() + defer hc.mu.Unlock() + if hc.queue.Len() <= 0 { + // Queue is empty. + return nil + } + s := hc.queue.sessions[0] + if s.getNextCheck().After(time.Now()) && hc.pool.valid { + // All sessions have been checked recently. + return nil + } + hc.scheduledHCLocked(s) + if !s.checkingHealth { + s.checkingHealth = true + return s + } + return nil + } + + // Returns a session which we should prepare for write. + getNextForTx := func() *session { + hc.pool.mu.Lock() + defer hc.pool.mu.Unlock() + if hc.pool.shouldPrepareWrite() { + if hc.pool.idleList.Len() > 0 && hc.pool.valid { + hc.mu.Lock() + defer hc.mu.Unlock() + if hc.pool.idleList.Front().Value.(*session).checkingHealth { + return nil + } + session := hc.pool.idleList.Remove(hc.pool.idleList.Front()).(*session) + session.checkingHealth = true + hc.pool.prepareReqs++ + return session + } + } + return nil + } + + for { + if hc.isClosing() { + // Exit when the pool has been closed and all sessions have been destroyed + // or when health checker has been closed. + hc.waitWorkers.Done() + return + } + ws := getNextForTx() + if ws != nil { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + err := ws.prepareForWrite(contextWithOutgoingMetadata(ctx, hc.pool.md)) + cancel() + if err != nil { + // Skip handling prepare error, session can be prepared in next cycle + log.Printf("Failed to prepare session, error: %v", toSpannerError(err)) + } + hc.pool.recycle(ws) + hc.pool.mu.Lock() + hc.pool.prepareReqs-- + hc.pool.mu.Unlock() + hc.markDone(ws) + } + rs := getNextForPing() + if rs == nil { + if ws == nil { + // No work to be done so sleep to avoid burning cpu + pause := int64(100 * time.Millisecond) + if pause > int64(hc.interval) { + pause = int64(hc.interval) + } + select { + case <-time.After(time.Duration(rand.Int63n(pause) + pause/2)): + case <-hc.done: + } + + } + continue + } + hc.healthCheck(rs) + } +} + +// maintainer maintains the maxSessionsInUse by a window of kWindowSize * sampleInterval. +// Based on this information, health checker will try to maintain the number of sessions by hc.. +func (hc *healthChecker) maintainer() { + // Wait so that pool is ready. + <-hc.ready + + var ( + windowSize uint64 = 10 + iteration uint64 + timeout <-chan time.Time + ) + + // replenishPool is run if numOpened is less than sessionsToKeep, timeouts on sampleInterval. + replenishPool := func(sessionsToKeep uint64) { + ctx, _ := context.WithTimeout(context.Background(), hc.sampleInterval) + for { + select { + case <-timeout: + return + default: + } + + p := hc.pool + p.mu.Lock() + // Take budget before the actual session creation. + if sessionsToKeep <= p.numOpened { + p.mu.Unlock() + break + } + p.numOpened++ + recordStat(ctx, OpenSessionCount, int64(p.numOpened)) + p.createReqs++ + shouldPrepareWrite := p.shouldPrepareWrite() + p.mu.Unlock() + var ( + s *session + err error + ) + if s, err = p.createSession(ctx); err != nil { + log.Printf("Failed to create session, error: %v", toSpannerError(err)) + continue + } + if shouldPrepareWrite { + if err = s.prepareForWrite(ctx); err != nil { + p.recycle(s) + log.Printf("Failed to prepare session, error: %v", toSpannerError(err)) + continue + } + } + p.recycle(s) + } + } + + // shrinkPool, scales down the session pool. + shrinkPool := func(sessionsToKeep uint64) { + for { + select { + case <-timeout: + return + default: + } + + p := hc.pool + p.mu.Lock() + + if sessionsToKeep >= p.numOpened { + p.mu.Unlock() + break + } + + var s *session + if p.idleList.Len() > 0 { + s = p.idleList.Front().Value.(*session) + } else if p.idleWriteList.Len() > 0 { + s = p.idleWriteList.Front().Value.(*session) + } + p.mu.Unlock() + if s != nil { + // destroy session as expire. + s.destroy(true) + } else { + break + } + } + } + + for { + if hc.isClosing() { + hc.waitWorkers.Done() + return + } + + // maxSessionsInUse is the maximum number of sessions in use concurrently over a period of time. + var maxSessionsInUse uint64 + + // Updates metrics. + hc.pool.mu.Lock() + currSessionsInUse := hc.pool.numOpened - uint64(hc.pool.idleList.Len()) - uint64(hc.pool.idleWriteList.Len()) + currSessionsOpened := hc.pool.numOpened + hc.pool.mu.Unlock() + + hc.mu.Lock() + if iteration%windowSize == 0 || maxSessionsInUse < currSessionsInUse { + maxSessionsInUse = currSessionsInUse + } + sessionsToKeep := maxUint64(hc.pool.MinOpened, + minUint64(currSessionsOpened, hc.pool.MaxIdle+maxSessionsInUse)) + hc.mu.Unlock() + + timeout = time.After(hc.sampleInterval) + // Replenish or Shrink pool if needed. + // Note: we don't need to worry about pending create session requests, we only need to sample the current sessions in use. + // the routines will not try to create extra / delete creating sessions. + if sessionsToKeep > currSessionsOpened { + replenishPool(sessionsToKeep) + } else { + shrinkPool(sessionsToKeep) + } + + select { + case <-timeout: + case <-hc.done: + } + iteration++ + } +} + +// shouldDropSession returns true if a particular error leads to the removal of a session +func shouldDropSession(err error) bool { + if err == nil { + return false + } + // If a Cloud Spanner can no longer locate the session (for example, if session is garbage collected), then caller + // should not try to return the session back into the session pool. + // TODO: once gRPC can return auxiliary error information, stop parsing the error message. + if ErrCode(err) == codes.NotFound && strings.Contains(ErrDesc(err), "Session not found:") { + return true + } + return false +} diff --git a/vendor/cloud.google.com/go/spanner/session_test.go b/vendor/cloud.google.com/go/spanner/session_test.go new file mode 100644 index 000000000..932d635d2 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/session_test.go @@ -0,0 +1,963 @@ +/* +Copyright 2017 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 spanner + +import ( + "bytes" + "container/heap" + "context" + "fmt" + "math/rand" + "sync" + "testing" + "time" + + "cloud.google.com/go/spanner/internal/testutil" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// setup prepares test environment for regular session pool tests. +// +// Note: be sure to call cleanup! +func setup(t *testing.T, spc SessionPoolConfig) (sp *sessionPool, sc *testutil.MockCloudSpannerClient, cleanup func()) { + sc = testutil.NewMockCloudSpannerClient(t) + spc.getRPCClient = func() (sppb.SpannerClient, error) { + return sc, nil + } + if spc.HealthCheckInterval == 0 { + spc.HealthCheckInterval = 50 * time.Millisecond + } + if spc.healthCheckSampleInterval == 0 { + spc.healthCheckSampleInterval = 10 * time.Millisecond + } + sp, err := newSessionPool("mockdb", spc, nil) + if err != nil { + t.Fatalf("cannot create session pool: %v", err) + } + cleanup = func() { + sp.hc.close() + sp.close() + } + return +} + +// TestSessionPoolConfigValidation tests session pool config validation. +func TestSessionPoolConfigValidation(t *testing.T) { + t.Parallel() + sc := testutil.NewMockCloudSpannerClient(t) + for _, test := range []struct { + spc SessionPoolConfig + err error + }{ + { + SessionPoolConfig{}, + errNoRPCGetter(), + }, + { + SessionPoolConfig{ + getRPCClient: func() (sppb.SpannerClient, error) { + return sc, nil + }, + MinOpened: 10, + MaxOpened: 5, + }, + errMinOpenedGTMaxOpened(5, 10), + }, + } { + if _, err := newSessionPool("mockdb", test.spc, nil); !testEqual(err, test.err) { + t.Errorf("want %v, got %v", test.err, err) + } + } +} + +// TestSessionCreation tests session creation during sessionPool.Take(). +func TestSessionCreation(t *testing.T) { + t.Parallel() + + sp, sc, cleanup := setup(t, SessionPoolConfig{}) + defer cleanup() + + // Take three sessions from session pool, this should trigger session pool to create three new sessions. + shs := make([]*sessionHandle, 3) + // gotDs holds the unique sessions taken from session pool. + gotDs := map[string]bool{} + for i := 0; i < len(shs); i++ { + var err error + shs[i], err = sp.take(context.Background()) + if err != nil { + t.Errorf("failed to get session(%v): %v", i, err) + } + gotDs[shs[i].getID()] = true + } + if len(gotDs) != len(shs) { + t.Errorf("session pool created %v sessions, want %v", len(gotDs), len(shs)) + } + if wantDs := sc.DumpSessions(); !testEqual(gotDs, wantDs) { + t.Errorf("session pool creates sessions %v, want %v", gotDs, wantDs) + } + // Verify that created sessions are recorded correctly in session pool. + sp.mu.Lock() + if int(sp.numOpened) != len(shs) { + t.Errorf("session pool reports %v open sessions, want %v", sp.numOpened, len(shs)) + } + if sp.createReqs != 0 { + t.Errorf("session pool reports %v session create requests, want 0", int(sp.createReqs)) + } + sp.mu.Unlock() + // Verify that created sessions are tracked correctly by healthcheck queue. + hc := sp.hc + hc.mu.Lock() + if hc.queue.Len() != len(shs) { + t.Errorf("healthcheck queue length = %v, want %v", hc.queue.Len(), len(shs)) + } + for _, s := range hc.queue.sessions { + if !gotDs[s.getID()] { + t.Errorf("session %v is in healthcheck queue, but it is not created by session pool", s.getID()) + } + } + hc.mu.Unlock() +} + +// TestTakeFromIdleList tests taking sessions from session pool's idle list. +func TestTakeFromIdleList(t *testing.T) { + t.Parallel() + + sp, sc, cleanup := setup(t, SessionPoolConfig{MaxIdle: 10}) // make sure maintainer keeps the idle sessions + defer cleanup() + + // Take ten sessions from session pool and recycle them. + shs := make([]*sessionHandle, 10) + for i := 0; i < len(shs); i++ { + var err error + shs[i], err = sp.take(context.Background()) + if err != nil { + t.Errorf("failed to get session(%v): %v", i, err) + } + } + // Make sure it's sampled once before recycling, otherwise it will be cleaned up. + <-time.After(sp.SessionPoolConfig.healthCheckSampleInterval) + for i := 0; i < len(shs); i++ { + shs[i].recycle() + } + // Further session requests from session pool won't cause mockclient to create more sessions. + wantSessions := sc.DumpSessions() + // Take ten sessions from session pool again, this time all sessions should come from idle list. + gotSessions := map[string]bool{} + for i := 0; i < len(shs); i++ { + sh, err := sp.take(context.Background()) + if err != nil { + t.Errorf("cannot take session from session pool: %v", err) + } + gotSessions[sh.getID()] = true + } + if len(gotSessions) != 10 { + t.Errorf("got %v unique sessions, want 10", len(gotSessions)) + } + if !testEqual(gotSessions, wantSessions) { + t.Errorf("got sessions: %v, want %v", gotSessions, wantSessions) + } +} + +// TesttakeWriteSessionFromIdleList tests taking write sessions from session pool's idle list. +func TestTakeWriteSessionFromIdleList(t *testing.T) { + t.Parallel() + + sp, sc, cleanup := setup(t, SessionPoolConfig{MaxIdle: 20}) // make sure maintainer keeps the idle sessions + defer cleanup() + + acts := make([]testutil.Action, 20) + for i := 0; i < len(acts); i++ { + acts[i] = testutil.Action{"BeginTransaction", nil} + } + sc.SetActions(acts...) + // Take ten sessions from session pool and recycle them. + shs := make([]*sessionHandle, 10) + for i := 0; i < len(shs); i++ { + var err error + shs[i], err = sp.takeWriteSession(context.Background()) + if err != nil { + t.Errorf("failed to get session(%v): %v", i, err) + } + } + // Make sure it's sampled once before recycling, otherwise it will be cleaned up. + <-time.After(sp.SessionPoolConfig.healthCheckSampleInterval) + for i := 0; i < len(shs); i++ { + shs[i].recycle() + } + // Further session requests from session pool won't cause mockclient to create more sessions. + wantSessions := sc.DumpSessions() + // Take ten sessions from session pool again, this time all sessions should come from idle list. + gotSessions := map[string]bool{} + for i := 0; i < len(shs); i++ { + sh, err := sp.takeWriteSession(context.Background()) + if err != nil { + t.Errorf("cannot take session from session pool: %v", err) + } + gotSessions[sh.getID()] = true + } + if len(gotSessions) != 10 { + t.Errorf("got %v unique sessions, want 10", len(gotSessions)) + } + if !testEqual(gotSessions, wantSessions) { + t.Errorf("got sessions: %v, want %v", gotSessions, wantSessions) + } +} + +// TestTakeFromIdleListChecked tests taking sessions from session pool's idle list, but with a extra ping check. +func TestTakeFromIdleListChecked(t *testing.T) { + t.Parallel() + if testing.Short() { + t.SkipNow() + } + + sp, sc, cleanup := setup(t, SessionPoolConfig{MaxIdle: 1}) // make sure maintainer keeps the idle sessions + defer cleanup() + + // Stop healthcheck workers to simulate slow pings. + sp.hc.close() + // Create a session and recycle it. + sh, err := sp.take(context.Background()) + if err != nil { + t.Errorf("failed to get session: %v", err) + } + // Make sure it's sampled once before recycling, otherwise it will be cleaned up. + <-time.After(sp.SessionPoolConfig.healthCheckSampleInterval) + wantSid := sh.getID() + sh.recycle() + <-time.After(time.Second) + // Two back-to-back session requests, both of them should return the same session created before and + // none of them should trigger a session ping. + for i := 0; i < 2; i++ { + // Take the session from the idle list and recycle it. + sh, err = sp.take(context.Background()) + if err != nil { + t.Errorf("%v - failed to get session: %v", i, err) + } + if gotSid := sh.getID(); gotSid != wantSid { + t.Errorf("%v - got session id: %v, want %v", i, gotSid, wantSid) + } + // The two back-to-back session requests shouldn't trigger any session pings because sessionPool.Take + // reschedules the next healthcheck. + if got, want := sc.DumpPings(), ([]string{wantSid}); !testEqual(got, want) { + t.Errorf("%v - got ping session requests: %v, want %v", i, got, want) + } + sh.recycle() + } + // Inject session error to mockclient, and take the session from the session pool, the old session should be destroyed and + // the session pool will create a new session. + sc.InjectError("GetSession", status.Errorf(codes.NotFound, "Session not found:")) + // Delay to trigger sessionPool.Take to ping the session. + <-time.After(time.Second) + sh, err = sp.take(context.Background()) + if err != nil { + t.Errorf("failed to get session: %v", err) + } + ds := sc.DumpSessions() + if len(ds) != 1 { + t.Errorf("dumped sessions from mockclient: %v, want %v", ds, sh.getID()) + } + if sh.getID() == wantSid { + t.Errorf("sessionPool.Take still returns the same session %v, want it to create a new one", wantSid) + } +} + +// TestTakeFromIdleWriteListChecked tests taking sessions from session pool's idle list, but with a extra ping check. +func TestTakeFromIdleWriteListChecked(t *testing.T) { + t.Parallel() + if testing.Short() { + t.SkipNow() + } + + sp, sc, cleanup := setup(t, SessionPoolConfig{MaxIdle: 1}) // make sure maintainer keeps the idle sessions + defer cleanup() + + sc.MakeNice() + // Stop healthcheck workers to simulate slow pings. + sp.hc.close() + // Create a session and recycle it. + sh, err := sp.takeWriteSession(context.Background()) + if err != nil { + t.Errorf("failed to get session: %v", err) + } + wantSid := sh.getID() + // Make sure it's sampled once before recycling, otherwise it will be cleaned up. + <-time.After(sp.SessionPoolConfig.healthCheckSampleInterval) + sh.recycle() + <-time.After(time.Second) + // Two back-to-back session requests, both of them should return the same session created before and + // none of them should trigger a session ping. + for i := 0; i < 2; i++ { + // Take the session from the idle list and recycle it. + sh, err = sp.takeWriteSession(context.Background()) + if err != nil { + t.Errorf("%v - failed to get session: %v", i, err) + } + if gotSid := sh.getID(); gotSid != wantSid { + t.Errorf("%v - got session id: %v, want %v", i, gotSid, wantSid) + } + // The two back-to-back session requests shouldn't trigger any session pings because sessionPool.Take + // reschedules the next healthcheck. + if got, want := sc.DumpPings(), ([]string{wantSid}); !testEqual(got, want) { + t.Errorf("%v - got ping session requests: %v, want %v", i, got, want) + } + sh.recycle() + } + // Inject session error to mockclient, and take the session from the session pool, the old session should be destroyed and + // the session pool will create a new session. + sc.InjectError("GetSession", status.Errorf(codes.NotFound, "Session not found:")) + // Delay to trigger sessionPool.Take to ping the session. + <-time.After(time.Second) + sh, err = sp.takeWriteSession(context.Background()) + if err != nil { + t.Errorf("failed to get session: %v", err) + } + ds := sc.DumpSessions() + if len(ds) != 1 { + t.Errorf("dumped sessions from mockclient: %v, want %v", ds, sh.getID()) + } + if sh.getID() == wantSid { + t.Errorf("sessionPool.Take still returns the same session %v, want it to create a new one", wantSid) + } +} + +// TestMaxOpenedSessions tests max open sessions constraint. +func TestMaxOpenedSessions(t *testing.T) { + t.Parallel() + if testing.Short() { + t.SkipNow() + } + + sp, _, cleanup := setup(t, SessionPoolConfig{MaxOpened: 1}) + defer cleanup() + + sh1, err := sp.take(context.Background()) + if err != nil { + t.Errorf("cannot take session from session pool: %v", err) + } + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + // Session request will timeout due to the max open sessions constraint. + _, gotErr := sp.take(ctx) + if wantErr := errGetSessionTimeout(); !testEqual(gotErr, wantErr) { + t.Errorf("the second session retrival returns error %v, want %v", gotErr, wantErr) + } + go func() { + <-time.After(time.Second) + // destroy the first session to allow the next session request to proceed. + sh1.destroy() + }() + // Now session request can be processed because the first session will be destroyed. + sh2, err := sp.take(context.Background()) + if err != nil { + t.Errorf("after the first session is destroyed, session retrival still returns error %v, want nil", err) + } + if !sh2.session.isValid() || sh2.getID() == "" { + t.Errorf("got invalid session: %v", sh2.session) + } +} + +// TestMinOpenedSessions tests min open session constraint. +func TestMinOpenedSessions(t *testing.T) { + sp, _, cleanup := setup(t, SessionPoolConfig{MinOpened: 1}) + defer cleanup() + + // Take ten sessions from session pool and recycle them. + var ss []*session + var shs []*sessionHandle + for i := 0; i < 10; i++ { + sh, err := sp.take(context.Background()) + if err != nil { + t.Errorf("failed to get session(%v): %v", i, err) + } + ss = append(ss, sh.session) + shs = append(shs, sh) + sh.recycle() + } + for _, sh := range shs { + sh.recycle() + } + // Simulate session expiration. + for _, s := range ss { + s.destroy(true) + } + sp.mu.Lock() + defer sp.mu.Unlock() + // There should be still one session left in idle list due to the min open sessions constraint. + if sp.idleList.Len() != 1 { + t.Errorf("got %v sessions in idle list, want 1 %d", sp.idleList.Len(), sp.numOpened) + } +} + +// TestMaxBurst tests max burst constraint. +func TestMaxBurst(t *testing.T) { + t.Parallel() + if testing.Short() { + t.SkipNow() + } + + sp, sc, cleanup := setup(t, SessionPoolConfig{MaxBurst: 1}) + defer cleanup() + + // Will cause session creation RPC to be retried forever. + sc.InjectError("CreateSession", status.Errorf(codes.Unavailable, "try later")) + // This session request will never finish until the injected error is cleared. + go sp.take(context.Background()) + // Poll for the execution of the first session request. + for { + sp.mu.Lock() + cr := sp.createReqs + sp.mu.Unlock() + if cr == 0 { + <-time.After(time.Second) + continue + } + // The first session request is being executed. + break + } + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + _, gotErr := sp.take(ctx) + // Since MaxBurst == 1, the second session request should block. + if wantErr := errGetSessionTimeout(); !testEqual(gotErr, wantErr) { + t.Errorf("session retrival returns error %v, want %v", gotErr, wantErr) + } + // Let the first session request succeed. + sc.InjectError("CreateSession", nil) + // Now new session request can proceed because the first session request will eventually succeed. + sh, err := sp.take(context.Background()) + if err != nil { + t.Errorf("session retrival returns error %v, want nil", err) + } + if !sh.session.isValid() || sh.getID() == "" { + t.Errorf("got invalid session: %v", sh.session) + } +} + +// TestSessionrecycle tests recycling sessions. +func TestSessionRecycle(t *testing.T) { + t.Parallel() + if testing.Short() { + t.SkipNow() + } + + // Set MaxIdle to ensure shs[0] is not destroyed from scale down. + sp, _, cleanup := setup(t, SessionPoolConfig{MinOpened: 1, MaxIdle: 2}) + defer cleanup() + + // Test session is correctly recycled and reused. + for i := 0; i < 20; i++ { + s, err := sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get the session %v: %v", i, err) + } + s.recycle() + } + if sp.numOpened != 1 { + t.Errorf("Expect session pool size %d, got %d", 1, sp.numOpened) + } +} + +// TODO(deklerk) Investigate why s.destroy(true) is flakey. +// TestSessionDestroy tests destroying sessions. +func TestSessionDestroy(t *testing.T) { + t.Skip("s.destroy(true) is flakey") + t.Parallel() + + sp, _, cleanup := setup(t, SessionPoolConfig{MinOpened: 1}) + defer cleanup() + + <-time.After(10 * time.Millisecond) // maintainer will create one session, we wait for it create session to avoid flakiness in test + sh, err := sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + s := sh.session + sh.recycle() + if d := s.destroy(true); d || !s.isValid() { + // Session should be remaining because of min open sessions constraint. + t.Errorf("session %s invalid, want it to stay alive. (destroy in expiration mode, success: %v)", s.id, d) + } + if d := s.destroy(false); !d || s.isValid() { + // Session should be destroyed. + t.Errorf("failed to destroy session %s. (destroy in default mode, success: %v)", s.id, d) + } +} + +// TestHcHeap tests heap operation on top of hcHeap. +func TestHcHeap(t *testing.T) { + in := []*session{ + {nextCheck: time.Unix(10, 0)}, + {nextCheck: time.Unix(0, 5)}, + {nextCheck: time.Unix(1, 8)}, + {nextCheck: time.Unix(11, 7)}, + {nextCheck: time.Unix(6, 3)}, + } + want := []*session{ + {nextCheck: time.Unix(1, 8), hcIndex: 0}, + {nextCheck: time.Unix(6, 3), hcIndex: 1}, + {nextCheck: time.Unix(8, 2), hcIndex: 2}, + {nextCheck: time.Unix(10, 0), hcIndex: 3}, + {nextCheck: time.Unix(11, 7), hcIndex: 4}, + } + hh := hcHeap{} + for _, s := range in { + heap.Push(&hh, s) + } + // Change top of the heap and do a adjustment. + hh.sessions[0].nextCheck = time.Unix(8, 2) + heap.Fix(&hh, 0) + for idx := 0; hh.Len() > 0; idx++ { + got := heap.Pop(&hh).(*session) + want[idx].hcIndex = -1 + if !testEqual(got, want[idx]) { + t.Errorf("%v: heap.Pop returns %v, want %v", idx, got, want[idx]) + } + } +} + +// TestHealthCheckScheduler tests if healthcheck workers can schedule and +// perform healthchecks properly. +func TestHealthCheckScheduler(t *testing.T) { + t.Parallel() + if testing.Short() { + t.SkipNow() + } + + sp, sc, cleanup := setup(t, SessionPoolConfig{}) + defer cleanup() + + // Create 50 sessions. + ss := []string{} + for i := 0; i < 50; i++ { + sh, err := sp.take(context.Background()) + if err != nil { + t.Fatalf("cannot get session from session pool: %v", err) + } + ss = append(ss, sh.getID()) + } + + // Wait for 10-30 pings per session. + waitFor(t, func() error { + dp := sc.DumpPings() + gotPings := map[string]int64{} + for _, p := range dp { + gotPings[p]++ + } + for _, s := range ss { + want := int64(20) + if got := gotPings[s]; got < want/2 || got > want+want/2 { + // This is an unnacceptable amount of pings. + return fmt.Errorf("got %v healthchecks on session %v, want it between (%v, %v)", got, s, want/2, want+want/2) + } + } + return nil + }) +} + +// Tests that a fractions of sessions are prepared for write by health checker. +func TestWriteSessionsPrepared(t *testing.T) { + if testing.Short() { + t.SkipNow() + } + + sp, sc, cleanup := setup(t, SessionPoolConfig{WriteSessions: 0.5, MaxIdle: 20}) + defer cleanup() + + sc.MakeNice() + shs := make([]*sessionHandle, 10) + var err error + for i := 0; i < 10; i++ { + shs[i], err = sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + } + // Now there are 10 sessions in the pool. Release them. + for _, sh := range shs { + sh.recycle() + } + // Sleep for 1s, allowing healthcheck workers to invoke begin transaction. + <-time.After(time.Second) + wshs := make([]*sessionHandle, 5) + for i := 0; i < 5; i++ { + wshs[i], err = sp.takeWriteSession(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + if wshs[i].getTransactionID() == nil { + t.Errorf("got nil transaction id from session pool") + } + } + for _, sh := range wshs { + sh.recycle() + } + <-time.After(time.Second) + // Now force creation of 10 more sessions. + shs = make([]*sessionHandle, 20) + for i := 0; i < 20; i++ { + shs[i], err = sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + } + // Now there are 20 sessions in the pool. Release them. + for _, sh := range shs { + sh.recycle() + } + <-time.After(time.Second) + if sp.idleWriteList.Len() != 10 { + t.Errorf("Expect 10 write prepared session, got: %d", sp.idleWriteList.Len()) + } +} + +// TestTakeFromWriteQueue tests that sessionPool.take() returns write prepared sessions as well. +func TestTakeFromWriteQueue(t *testing.T) { + t.Parallel() + if testing.Short() { + t.SkipNow() + } + + sp, sc, cleanup := setup(t, SessionPoolConfig{MaxOpened: 1, WriteSessions: 1.0, MaxIdle: 1}) + defer cleanup() + + sc.MakeNice() + sh, err := sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + sh.recycle() + <-time.After(time.Second) + // The session should now be in write queue but take should also return it. + if sp.idleWriteList.Len() == 0 { + t.Errorf("write queue unexpectedly empty") + } + if sp.idleList.Len() != 0 { + t.Errorf("read queue not empty") + } + sh, err = sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + sh.recycle() +} + +// TestSessionHealthCheck tests healthchecking cases. +func TestSessionHealthCheck(t *testing.T) { + t.Parallel() + if testing.Short() { + t.SkipNow() + } + + sp, sc, cleanup := setup(t, SessionPoolConfig{}) + defer cleanup() + + // Test pinging sessions. + sh, err := sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + // Wait for healthchecker to send pings to session. + waitFor(t, func() error { + pings := sc.DumpPings() + if len(pings) == 0 || pings[0] != sh.getID() { + return fmt.Errorf("healthchecker didn't send any ping to session %v", sh.getID()) + } + return nil + }) + // Test broken session detection. + sh, err = sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + sc.InjectError("GetSession", status.Errorf(codes.NotFound, "Session not found:")) + // Wait for healthcheck workers to find the broken session and tear it down. + <-time.After(1 * time.Second) + s := sh.session + if sh.session.isValid() { + t.Errorf("session(%v) is still alive, want it to be dropped by healthcheck workers", s) + } + sc.InjectError("GetSession", nil) + // Test garbage collection. + sh, err = sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + sp.close() + if sh.session.isValid() { + t.Errorf("session(%v) is still alive, want it to be garbage collected", s) + } +} + +// TestStressSessionPool does stress test on session pool by the following concurrent operations: +// 1) Test worker gets a session from the pool. +// 2) Test worker turns a session back into the pool. +// 3) Test worker destroys a session got from the pool. +// 4) Healthcheck destroys a broken session (because a worker has already destroyed it). +// 5) Test worker closes the session pool. +// +// During the test, the session pool maintainer maintains the number of sessions, +// and it is expected that all sessions that are taken from session pool remains valid. +// When all test workers and healthcheck workers exit, mockclient, session pool +// and healthchecker should be in consistent state. + +func TestStressSessionPool(t *testing.T) { + t.Parallel() + // Use concurrent workers to test different session pool built from different configurations. + if testing.Short() { + t.SkipNow() + } + for ti, cfg := range []SessionPoolConfig{ + {}, + {MinOpened: 10, MaxOpened: 100}, + {MaxBurst: 50}, + {MinOpened: 10, MaxOpened: 200, MaxBurst: 5}, + {MinOpened: 10, MaxOpened: 200, MaxBurst: 5, WriteSessions: 0.2}, + } { + var wg sync.WaitGroup + // Create a more aggressive session healthchecker to increase test concurrency. + cfg.HealthCheckInterval = 50 * time.Millisecond + cfg.healthCheckSampleInterval = 10 * time.Millisecond + cfg.HealthCheckWorkers = 50 + sc := testutil.NewMockCloudSpannerClient(t) + sc.MakeNice() + cfg.getRPCClient = func() (sppb.SpannerClient, error) { + return sc, nil + } + sp, _ := newSessionPool("mockdb", cfg, nil) + defer sp.hc.close() + defer sp.close() + + for i := 0; i < 100; i++ { + wg.Add(1) + // Schedule a test worker. + go func(idx int, pool *sessionPool, client sppb.SpannerClient) { + defer wg.Done() + // Test worker iterates 1K times and tries different session / session pool operations. + for j := 0; j < 1000; j++ { + if idx%10 == 0 && j >= 900 { + // Close the pool in selected set of workers during the middle of the test. + pool.close() + } + // Take a write sessions ~ 20% of the times. + takeWrite := rand.Intn(5) == 4 + var ( + sh *sessionHandle + gotErr error + ) + if takeWrite { + sh, gotErr = pool.takeWriteSession(context.Background()) + } else { + sh, gotErr = pool.take(context.Background()) + } + if gotErr != nil { + if pool.isValid() { + t.Errorf("%v.%v: pool.take returns error when pool is still valid: %v", ti, idx, gotErr) + } + if wantErr := errInvalidSessionPool(); !testEqual(gotErr, wantErr) { + t.Errorf("%v.%v: got error when pool is closed: %v, want %v", ti, idx, gotErr, wantErr) + } + continue + } + // Verify if session is valid when session pool is valid. Note that if session pool is invalid after sh is taken, + // then sh might be invalidated by healthcheck workers. + if (sh.getID() == "" || sh.session == nil || !sh.session.isValid()) && pool.isValid() { + t.Errorf("%v.%v.%v: pool.take returns invalid session %v", ti, idx, takeWrite, sh.session) + } + if takeWrite && sh.getTransactionID() == nil { + t.Errorf("%v.%v: pool.takeWriteSession returns session %v without transaction", ti, idx, sh.session) + } + if rand.Intn(100) < idx { + // Random sleep before destroying/recycling the session, to give healthcheck worker a chance to step in. + <-time.After(time.Duration(rand.Int63n(int64(cfg.HealthCheckInterval)))) + } + if rand.Intn(100) < idx { + // destroy the session. + sh.destroy() + continue + } + // recycle the session. + sh.recycle() + } + }(i, sp, sc) + } + wg.Wait() + sp.hc.close() + // Here the states of healthchecker, session pool and mockclient are stable. + idleSessions := map[string]bool{} + hcSessions := map[string]bool{} + mockSessions := sc.DumpSessions() + // Dump session pool's idle list. + for sl := sp.idleList.Front(); sl != nil; sl = sl.Next() { + s := sl.Value.(*session) + if idleSessions[s.getID()] { + t.Errorf("%v: found duplicated session in idle list: %v", ti, s.getID()) + } + idleSessions[s.getID()] = true + } + for sl := sp.idleWriteList.Front(); sl != nil; sl = sl.Next() { + s := sl.Value.(*session) + if idleSessions[s.getID()] { + t.Errorf("%v: found duplicated session in idle write list: %v", ti, s.getID()) + } + idleSessions[s.getID()] = true + } + sp.mu.Lock() + if int(sp.numOpened) != len(idleSessions) { + t.Errorf("%v: number of opened sessions (%v) != number of idle sessions (%v)", ti, sp.numOpened, len(idleSessions)) + } + if sp.createReqs != 0 { + t.Errorf("%v: number of pending session creations = %v, want 0", ti, sp.createReqs) + } + // Dump healthcheck queue. + for _, s := range sp.hc.queue.sessions { + if hcSessions[s.getID()] { + t.Errorf("%v: found duplicated session in healthcheck queue: %v", ti, s.getID()) + } + hcSessions[s.getID()] = true + } + sp.mu.Unlock() + + // Verify that idleSessions == hcSessions == mockSessions. + if !testEqual(idleSessions, hcSessions) { + t.Errorf("%v: sessions in idle list (%v) != sessions in healthcheck queue (%v)", ti, idleSessions, hcSessions) + } + if !testEqual(hcSessions, mockSessions) { + t.Errorf("%v: sessions in healthcheck queue (%v) != sessions in mockclient (%v)", ti, hcSessions, mockSessions) + } + sp.close() + mockSessions = sc.DumpSessions() + if len(mockSessions) != 0 { + t.Errorf("Found live sessions: %v", mockSessions) + } + } +} + +// TODO(deklerk) Investigate why this test is flakey, even with waitFor. Example +// flakey failure: session_test.go:946: after 15s waiting, got Scale down. Expect 5 open, got 6 +// +// TestMaintainer checks the session pool maintainer maintains the number of sessions in the following cases +// 1. On initialization of session pool, replenish session pool to meet MinOpened or MaxIdle. +// 2. On increased session usage, provision extra MaxIdle sessions. +// 3. After the surge passes, scale down the session pool accordingly. +func TestMaintainer(t *testing.T) { + t.Skip("asserting session state seems flakey") + t.Parallel() + if testing.Short() { + t.SkipNow() + } + var ( + minOpened uint64 = 5 + maxIdle uint64 = 4 + ) + + sp, _, cleanup := setup(t, SessionPoolConfig{MinOpened: minOpened, MaxIdle: maxIdle}) + defer cleanup() + + sampleInterval := sp.SessionPoolConfig.healthCheckSampleInterval + + waitFor(t, func() error { + sp.mu.Lock() + defer sp.mu.Unlock() + if sp.numOpened != 5 { + return fmt.Errorf("Replenish. Expect %d open, got %d", sp.MinOpened, sp.numOpened) + } + return nil + }) + + // To save test time, we are not creating many sessions, because the time + // to create sessions will have impact on the decision on sessionsToKeep. + // We also parallelize the take and recycle process. + shs := make([]*sessionHandle, 10) + for i := 0; i < len(shs); i++ { + var err error + shs[i], err = sp.take(context.Background()) + if err != nil { + t.Errorf("cannot get session from session pool: %v", err) + } + } + sp.mu.Lock() + if sp.numOpened != 10 { + t.Errorf("Scale out from normal use. Expect %d open, got %d", 10, sp.numOpened) + } + sp.mu.Unlock() + + <-time.After(sampleInterval) + for _, sh := range shs[:7] { + sh.recycle() + } + + waitFor(t, func() error { + sp.mu.Lock() + defer sp.mu.Unlock() + if sp.numOpened != 7 { + return fmt.Errorf("Keep extra MaxIdle sessions. Expect %d open, got %d", 7, sp.numOpened) + } + return nil + }) + + for _, sh := range shs[7:] { + sh.recycle() + } + waitFor(t, func() error { + sp.mu.Lock() + defer sp.mu.Unlock() + if sp.numOpened != minOpened { + return fmt.Errorf("Scale down. Expect %d open, got %d", minOpened, sp.numOpened) + } + return nil + }) +} + +func (s1 *session) Equal(s2 *session) bool { + return s1.client == s2.client && + s1.id == s2.id && + s1.pool == s2.pool && + s1.createTime == s2.createTime && + s1.valid == s2.valid && + s1.hcIndex == s2.hcIndex && + s1.idleList == s2.idleList && + s1.nextCheck.Equal(s2.nextCheck) && + s1.checkingHealth == s2.checkingHealth && + testEqual(s1.md, s2.md) && + bytes.Equal(s1.tx, s2.tx) +} + +func waitFor(t *testing.T, assert func() error) { + timeout := 15 * time.Second + ta := time.After(timeout) + + for { + select { + case <-ta: + if err := assert(); err != nil { + t.Fatalf("after %v waiting, got %v", timeout, err) + } + return + default: + } + + if err := assert(); err != nil { + // Fail. Let's pause and retry. + time.Sleep(10 * time.Millisecond) + continue + } + + return + } +} diff --git a/vendor/cloud.google.com/go/spanner/statement.go b/vendor/cloud.google.com/go/spanner/statement.go new file mode 100644 index 000000000..9b5a61188 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/statement.go @@ -0,0 +1,92 @@ +/* +Copyright 2017 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 spanner + +import ( + "errors" + "fmt" + + proto3 "github.com/golang/protobuf/ptypes/struct" + structpb "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" +) + +// A Statement is a SQL query with named parameters. +// +// A parameter placeholder consists of '@' followed by the parameter name. +// Parameter names consist of any combination of letters, numbers, and +// underscores. Names may be entirely numeric (e.g., "WHERE m.id = @5"). +// Parameters may appear anywhere that a literal value is expected. The same +// parameter name may be used more than once. It is an error to execute a +// statement with unbound parameters. On the other hand, it is allowable to +// bind parameter names that are not used. +// +// See the documentation of the Row type for how Go types are mapped to Cloud +// Spanner types. +type Statement struct { + SQL string + Params map[string]interface{} +} + +// NewStatement returns a Statement with the given SQL and an empty Params map. +func NewStatement(sql string) Statement { + return Statement{SQL: sql, Params: map[string]interface{}{}} +} + +var ( + errNilParam = errors.New("use T(nil), not nil") + errNoType = errors.New("no type information") +) + +// convertParams converts a statement's parameters into proto Param and +// ParamTypes. +func (s *Statement) convertParams() (*structpb.Struct, map[string]*sppb.Type, error) { + params := &proto3.Struct{ + Fields: map[string]*proto3.Value{}, + } + paramTypes := map[string]*sppb.Type{} + for k, v := range s.Params { + if v == nil { + return nil, nil, errBindParam(k, v, errNilParam) + } + val, t, err := encodeValue(v) + if err != nil { + return nil, nil, errBindParam(k, v, err) + } + if t == nil { // should not happen, because of nil check above + return nil, nil, errBindParam(k, v, errNoType) + } + params.Fields[k] = val + paramTypes[k] = t + } + + return params, paramTypes, nil +} + +// errBindParam returns error for not being able to bind parameter to query request. +func errBindParam(k string, v interface{}, err error) error { + if err == nil { + return nil + } + se, ok := toSpannerError(err).(*Error) + if !ok { + return spannerErrorf(codes.InvalidArgument, "failed to bind query parameter(name: %q, value: %v), error = <%v>", k, v, err) + } + se.decorate(fmt.Sprintf("failed to bind query parameter(name: %q, value: %v)", k, v)) + return se +} diff --git a/vendor/cloud.google.com/go/spanner/statement_test.go b/vendor/cloud.google.com/go/spanner/statement_test.go new file mode 100644 index 000000000..2cadb9744 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/statement_test.go @@ -0,0 +1,196 @@ +/* +Copyright 2017 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 spanner + +import ( + "math" + "testing" + "time" + + "cloud.google.com/go/civil" + "github.com/golang/protobuf/proto" + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +func TestConvertParams(t *testing.T) { + st := Statement{ + SQL: "SELECT id from t_foo WHERE col = @var", + Params: map[string]interface{}{"var": nil}, + } + var ( + t1, _ = time.Parse(time.RFC3339Nano, "2016-11-15T15:04:05.999999999Z") + // Boundaries + t2, _ = time.Parse(time.RFC3339Nano, "0001-01-01T00:00:00.000000000Z") + t3, _ = time.Parse(time.RFC3339Nano, "9999-12-31T23:59:59.999999999Z") + d1, _ = civil.ParseDate("2016-11-15") + // Boundaries + d2, _ = civil.ParseDate("0001-01-01") + d3, _ = civil.ParseDate("9999-12-31") + ) + + type staticStruct struct { + Field int `spanner:"field"` + } + + var ( + s1 = staticStruct{10} + s2 = staticStruct{20} + ) + + for _, test := range []struct { + val interface{} + wantField *proto3.Value + wantType *sppb.Type + }{ + // bool + {true, boolProto(true), boolType()}, + {NullBool{true, true}, boolProto(true), boolType()}, + {NullBool{true, false}, nullProto(), boolType()}, + {[]bool(nil), nullProto(), listType(boolType())}, + {[]bool{}, listProto(), listType(boolType())}, + {[]bool{true, false}, listProto(boolProto(true), boolProto(false)), listType(boolType())}, + {[]NullBool(nil), nullProto(), listType(boolType())}, + {[]NullBool{}, listProto(), listType(boolType())}, + {[]NullBool{{true, true}, {}}, listProto(boolProto(true), nullProto()), listType(boolType())}, + // int + {int(1), intProto(1), intType()}, + {[]int(nil), nullProto(), listType(intType())}, + {[]int{}, listProto(), listType(intType())}, + {[]int{1, 2}, listProto(intProto(1), intProto(2)), listType(intType())}, + // int64 + {int64(1), intProto(1), intType()}, + {NullInt64{5, true}, intProto(5), intType()}, + {NullInt64{5, false}, nullProto(), intType()}, + {[]int64(nil), nullProto(), listType(intType())}, + {[]int64{}, listProto(), listType(intType())}, + {[]int64{1, 2}, listProto(intProto(1), intProto(2)), listType(intType())}, + {[]NullInt64(nil), nullProto(), listType(intType())}, + {[]NullInt64{}, listProto(), listType(intType())}, + {[]NullInt64{{1, true}, {}}, listProto(intProto(1), nullProto()), listType(intType())}, + // float64 + {0.0, floatProto(0.0), floatType()}, + {math.Inf(1), floatProto(math.Inf(1)), floatType()}, + {math.Inf(-1), floatProto(math.Inf(-1)), floatType()}, + {math.NaN(), floatProto(math.NaN()), floatType()}, + {NullFloat64{2.71, true}, floatProto(2.71), floatType()}, + {NullFloat64{1.41, false}, nullProto(), floatType()}, + {[]float64(nil), nullProto(), listType(floatType())}, + {[]float64{}, listProto(), listType(floatType())}, + {[]float64{2.72, math.Inf(1)}, listProto(floatProto(2.72), floatProto(math.Inf(1))), listType(floatType())}, + {[]NullFloat64(nil), nullProto(), listType(floatType())}, + {[]NullFloat64{}, listProto(), listType(floatType())}, + {[]NullFloat64{{2.72, true}, {}}, listProto(floatProto(2.72), nullProto()), listType(floatType())}, + // string + {"", stringProto(""), stringType()}, + {"foo", stringProto("foo"), stringType()}, + {NullString{"bar", true}, stringProto("bar"), stringType()}, + {NullString{"bar", false}, nullProto(), stringType()}, + {[]string(nil), nullProto(), listType(stringType())}, + {[]string{}, listProto(), listType(stringType())}, + {[]string{"foo", "bar"}, listProto(stringProto("foo"), stringProto("bar")), listType(stringType())}, + {[]NullString(nil), nullProto(), listType(stringType())}, + {[]NullString{}, listProto(), listType(stringType())}, + {[]NullString{{"foo", true}, {}}, listProto(stringProto("foo"), nullProto()), listType(stringType())}, + // bytes + {[]byte{}, bytesProto([]byte{}), bytesType()}, + {[]byte{1, 2, 3}, bytesProto([]byte{1, 2, 3}), bytesType()}, + {[]byte(nil), nullProto(), bytesType()}, + {[][]byte(nil), nullProto(), listType(bytesType())}, + {[][]byte{}, listProto(), listType(bytesType())}, + {[][]byte{{1}, []byte(nil)}, listProto(bytesProto([]byte{1}), nullProto()), listType(bytesType())}, + // date + {d1, dateProto(d1), dateType()}, + {NullDate{civil.Date{}, false}, nullProto(), dateType()}, + {[]civil.Date(nil), nullProto(), listType(dateType())}, + {[]civil.Date{}, listProto(), listType(dateType())}, + {[]civil.Date{d1, d2, d3}, listProto(dateProto(d1), dateProto(d2), dateProto(d3)), listType(dateType())}, + {[]NullDate{{d2, true}, {}}, listProto(dateProto(d2), nullProto()), listType(dateType())}, + // timestamp + {t1, timeProto(t1), timeType()}, + {NullTime{}, nullProto(), timeType()}, + {[]time.Time(nil), nullProto(), listType(timeType())}, + {[]time.Time{}, listProto(), listType(timeType())}, + {[]time.Time{t1, t2, t3}, listProto(timeProto(t1), timeProto(t2), timeProto(t3)), listType(timeType())}, + {[]NullTime{{t2, true}, {}}, listProto(timeProto(t2), nullProto()), listType(timeType())}, + // Struct + { + s1, + listProto(intProto(10)), + structType(mkField("field", intType())), + }, + { + (*struct { + F1 civil.Date `spanner:""` + F2 bool + })(nil), + nullProto(), + structType( + mkField("", dateType()), + mkField("F2", boolType())), + }, + // Array-of-struct + { + []staticStruct{s1, s2}, + listProto(listProto(intProto(10)), listProto(intProto(20))), + listType(structType(mkField("field", intType()))), + }, + } { + st.Params["var"] = test.val + gotParams, gotParamTypes, gotErr := st.convertParams() + if gotErr != nil { + t.Error(gotErr) + continue + } + gotParamField := gotParams.Fields["var"] + if !proto.Equal(gotParamField, test.wantField) { + // handle NaN + if test.wantType.Code == floatType().Code && proto.MarshalTextString(gotParamField) == proto.MarshalTextString(test.wantField) { + continue + } + t.Errorf("%#v: got %v, want %v\n", test.val, gotParamField, test.wantField) + } + gotParamType := gotParamTypes["var"] + if !proto.Equal(gotParamType, test.wantType) { + t.Errorf("%#v: got %v, want %v\n", test.val, gotParamType, test.wantField) + } + } + + // Verify type error reporting. + for _, test := range []struct { + val interface{} + wantErr error + }{ + { + nil, + errBindParam("var", nil, errNilParam), + }, + } { + st.Params["var"] = test.val + _, _, gotErr := st.convertParams() + if !testEqual(gotErr, test.wantErr) { + t.Errorf("value %#v:\ngot: %v\nwant: %v", test.val, gotErr, test.wantErr) + } + } +} + +func TestNewStatement(t *testing.T) { + s := NewStatement("query") + if got, want := s.SQL, "query"; got != want { + t.Errorf("got %q, want %q", got, want) + } +} diff --git a/vendor/cloud.google.com/go/spanner/timestampbound.go b/vendor/cloud.google.com/go/spanner/timestampbound.go new file mode 100644 index 000000000..064e110dc --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/timestampbound.go @@ -0,0 +1,240 @@ +/* +Copyright 2017 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 spanner + +import ( + "fmt" + "time" + + pbd "github.com/golang/protobuf/ptypes/duration" + pbt "github.com/golang/protobuf/ptypes/timestamp" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +// timestampBoundType specifies the timestamp bound mode. +type timestampBoundType int + +const ( + strong timestampBoundType = iota // strong reads + exactStaleness // read with exact staleness + maxStaleness // read with max staleness + minReadTimestamp // read with min freshness + readTimestamp // read data at exact timestamp +) + +// TimestampBound defines how Cloud Spanner will choose a timestamp for a single +// read/query or read-only transaction. +// +// There are three types of timestamp bound: strong, bounded staleness and exact +// staleness. Strong is the default. +// +// If the Cloud Spanner database to be read is geographically distributed, stale +// read-only transactions can execute more quickly than strong or read-write +// transactions, because they are able to execute far from the leader replica. +// +// Each type of timestamp bound is discussed in detail below. A TimestampBound +// can be specified when creating transactions, see the documentation of +// spanner.Client for an example. +// +// Strong reads +// +// Strong reads are guaranteed to see the effects of all transactions that have +// committed before the start of the read. Furthermore, all rows yielded by a +// single read are consistent with each other: if any part of the read +// observes a transaction, all parts of the read see the transaction. +// +// Strong reads are not repeatable: two consecutive strong read-only +// transactions might return inconsistent results if there are concurrent +// writes. If consistency across reads is required, the reads should be +// executed within a transaction or at an exact read timestamp. +// +// Use StrongRead to create a bound of this type. +// +// Exact staleness +// +// An exact staleness timestamp bound executes reads at a user-specified timestamp. +// Reads at a timestamp are guaranteed to see a consistent prefix of the global +// transaction history: they observe modifications done by all transactions with a +// commit timestamp less than or equal to the read timestamp, and observe none of the +// modifications done by transactions with a larger commit timestamp. They will block +// until all conflicting transactions that may be assigned commit timestamps less +// than or equal to the read timestamp have finished. +// +// The timestamp can either be expressed as an absolute Cloud Spanner commit +// timestamp or a staleness relative to the current time. +// +// These modes do not require a "negotiation phase" to pick a timestamp. As a +// result, they execute slightly faster than the equivalent boundedly stale +// concurrency modes. On the other hand, boundedly stale reads usually return +// fresher results. +// +// Use ReadTimestamp and ExactStaleness to create a bound of this type. +// +// Bounded staleness +// +// Bounded staleness modes allow Cloud Spanner to pick the read timestamp, subject to +// a user-provided staleness bound. Cloud Spanner chooses the newest timestamp within +// the staleness bound that allows execution of the reads at the closest +// available replica without blocking. +// +// All rows yielded are consistent with each other: if any part of the read +// observes a transaction, all parts of the read see the transaction. Boundedly +// stale reads are not repeatable: two stale reads, even if they use the same +// staleness bound, can execute at different timestamps and thus return +// inconsistent results. +// +// Boundedly stale reads execute in two phases. The first phase negotiates a +// timestamp among all replicas needed to serve the read. In the second phase, +// reads are executed at the negotiated timestamp. +// +// As a result of this two-phase execution, bounded staleness reads are usually +// a little slower than comparable exact staleness reads. However, they are +// typically able to return fresher results, and are more likely to execute at +// the closest replica. +// +// Because the timestamp negotiation requires up-front knowledge of which rows +// will be read, it can only be used with single-use reads and single-use +// read-only transactions. +// +// Use MinReadTimestamp and MaxStaleness to create a bound of this type. +// +// Old read timestamps and garbage collection +// +// Cloud Spanner continuously garbage collects deleted and overwritten data in the +// background to reclaim storage space. This process is known as "version +// GC". By default, version GC reclaims versions after they are four hours +// old. Because of this, Cloud Spanner cannot perform reads at read timestamps more +// than four hours in the past. This restriction also applies to in-progress +// reads and/or SQL queries whose timestamps become too old while +// executing. Reads and SQL queries with too-old read timestamps fail with the +// error ErrorCode.FAILED_PRECONDITION. +type TimestampBound struct { + mode timestampBoundType + d time.Duration + t time.Time +} + +// StrongRead returns a TimestampBound that will perform reads and queries at a +// timestamp where all previously committed transactions are visible. +func StrongRead() TimestampBound { + return TimestampBound{mode: strong} +} + +// ExactStaleness returns a TimestampBound that will perform reads and queries +// at an exact staleness. +func ExactStaleness(d time.Duration) TimestampBound { + return TimestampBound{ + mode: exactStaleness, + d: d, + } +} + +// MaxStaleness returns a TimestampBound that will perform reads and queries at +// a time chosen to be at most "d" stale. +func MaxStaleness(d time.Duration) TimestampBound { + return TimestampBound{ + mode: maxStaleness, + d: d, + } +} + +// MinReadTimestamp returns a TimestampBound that bound that will perform reads +// and queries at a time chosen to be at least "t". +func MinReadTimestamp(t time.Time) TimestampBound { + return TimestampBound{ + mode: minReadTimestamp, + t: t, + } +} + +// ReadTimestamp returns a TimestampBound that will peform reads and queries at +// the given time. +func ReadTimestamp(t time.Time) TimestampBound { + return TimestampBound{ + mode: readTimestamp, + t: t, + } +} + +func (tb TimestampBound) String() string { + switch tb.mode { + case strong: + return fmt.Sprintf("(strong)") + case exactStaleness: + return fmt.Sprintf("(exactStaleness: %s)", tb.d) + case maxStaleness: + return fmt.Sprintf("(maxStaleness: %s)", tb.d) + case minReadTimestamp: + return fmt.Sprintf("(minReadTimestamp: %s)", tb.t) + case readTimestamp: + return fmt.Sprintf("(readTimestamp: %s)", tb.t) + default: + return fmt.Sprintf("{mode=%v, d=%v, t=%v}", tb.mode, tb.d, tb.t) + } +} + +// durationProto takes a time.Duration and converts it into pdb.Duration for +// calling gRPC APIs. +func durationProto(d time.Duration) *pbd.Duration { + n := d.Nanoseconds() + return &pbd.Duration{ + Seconds: n / int64(time.Second), + Nanos: int32(n % int64(time.Second)), + } +} + +// timestampProto takes a time.Time and converts it into pbt.Timestamp for calling +// gRPC APIs. +func timestampProto(t time.Time) *pbt.Timestamp { + return &pbt.Timestamp{ + Seconds: t.Unix(), + Nanos: int32(t.Nanosecond()), + } +} + +// buildTransactionOptionsReadOnly converts a spanner.TimestampBound into a sppb.TransactionOptions_ReadOnly +// transaction option, which is then used in transactional reads. +func buildTransactionOptionsReadOnly(tb TimestampBound, returnReadTimestamp bool) *sppb.TransactionOptions_ReadOnly { + pb := &sppb.TransactionOptions_ReadOnly{ + ReturnReadTimestamp: returnReadTimestamp, + } + switch tb.mode { + case strong: + pb.TimestampBound = &sppb.TransactionOptions_ReadOnly_Strong{ + Strong: true, + } + case exactStaleness: + pb.TimestampBound = &sppb.TransactionOptions_ReadOnly_ExactStaleness{ + ExactStaleness: durationProto(tb.d), + } + case maxStaleness: + pb.TimestampBound = &sppb.TransactionOptions_ReadOnly_MaxStaleness{ + MaxStaleness: durationProto(tb.d), + } + case minReadTimestamp: + pb.TimestampBound = &sppb.TransactionOptions_ReadOnly_MinReadTimestamp{ + MinReadTimestamp: timestampProto(tb.t), + } + case readTimestamp: + pb.TimestampBound = &sppb.TransactionOptions_ReadOnly_ReadTimestamp{ + ReadTimestamp: timestampProto(tb.t), + } + default: + panic(fmt.Sprintf("buildTransactionOptionsReadOnly(%v,%v)", tb, returnReadTimestamp)) + } + return pb +} diff --git a/vendor/cloud.google.com/go/spanner/timestampbound_test.go b/vendor/cloud.google.com/go/spanner/timestampbound_test.go new file mode 100644 index 000000000..7cfe364d1 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/timestampbound_test.go @@ -0,0 +1,206 @@ +/* +Copyright 2017 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 spanner + +import ( + "testing" + "time" + + pbd "github.com/golang/protobuf/ptypes/duration" + pbt "github.com/golang/protobuf/ptypes/timestamp" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +// Test generating TimestampBound for strong reads. +func TestStrong(t *testing.T) { + got := StrongRead() + want := TimestampBound{mode: strong} + if !testEqual(got, want) { + t.Errorf("Strong() = %v; want %v", got, want) + } +} + +// Test generating TimestampBound for reads with exact staleness. +func TestExactStaleness(t *testing.T) { + got := ExactStaleness(10 * time.Second) + want := TimestampBound{mode: exactStaleness, d: 10 * time.Second} + if !testEqual(got, want) { + t.Errorf("ExactStaleness(10*time.Second) = %v; want %v", got, want) + } +} + +// Test generating TimestampBound for reads with max staleness. +func TestMaxStaleness(t *testing.T) { + got := MaxStaleness(10 * time.Second) + want := TimestampBound{mode: maxStaleness, d: 10 * time.Second} + if !testEqual(got, want) { + t.Errorf("MaxStaleness(10*time.Second) = %v; want %v", got, want) + } +} + +// Test generating TimestampBound for reads with minimum freshness requirement. +func TestMinReadTimestamp(t *testing.T) { + ts := time.Now() + got := MinReadTimestamp(ts) + want := TimestampBound{mode: minReadTimestamp, t: ts} + if !testEqual(got, want) { + t.Errorf("MinReadTimestamp(%v) = %v; want %v", ts, got, want) + } +} + +// Test generating TimestampBound for reads requesting data at a exact timestamp. +func TestReadTimestamp(t *testing.T) { + ts := time.Now() + got := ReadTimestamp(ts) + want := TimestampBound{mode: readTimestamp, t: ts} + if !testEqual(got, want) { + t.Errorf("ReadTimestamp(%v) = %v; want %v", ts, got, want) + } +} + +// Test TimestampBound.String. +func TestTimestampBoundString(t *testing.T) { + ts := time.Unix(1136239445, 0).UTC() + var tests = []struct { + tb TimestampBound + want string + }{ + { + tb: TimestampBound{mode: strong}, + want: "(strong)", + }, + { + tb: TimestampBound{mode: exactStaleness, d: 10 * time.Second}, + want: "(exactStaleness: 10s)", + }, + { + tb: TimestampBound{mode: maxStaleness, d: 10 * time.Second}, + want: "(maxStaleness: 10s)", + }, + { + tb: TimestampBound{mode: minReadTimestamp, t: ts}, + want: "(minReadTimestamp: 2006-01-02 22:04:05 +0000 UTC)", + }, + { + tb: TimestampBound{mode: readTimestamp, t: ts}, + want: "(readTimestamp: 2006-01-02 22:04:05 +0000 UTC)", + }, + } + for _, test := range tests { + got := test.tb.String() + if got != test.want { + t.Errorf("%#v.String():\ngot %q\nwant %q", test.tb, got, test.want) + } + } +} + +// Test time.Duration to pdb.Duration conversion. +func TestDurationProto(t *testing.T) { + var tests = []struct { + d time.Duration + want pbd.Duration + }{ + {time.Duration(0), pbd.Duration{Seconds: 0, Nanos: 0}}, + {time.Second, pbd.Duration{Seconds: 1, Nanos: 0}}, + {time.Millisecond, pbd.Duration{Seconds: 0, Nanos: 1e6}}, + {15 * time.Nanosecond, pbd.Duration{Seconds: 0, Nanos: 15}}, + {42 * time.Hour, pbd.Duration{Seconds: 151200}}, + {-(1*time.Hour + 4*time.Millisecond), pbd.Duration{Seconds: -3600, Nanos: -4e6}}, + } + for _, test := range tests { + got := durationProto(test.d) + if !testEqual(got, &test.want) { + t.Errorf("durationProto(%v) = %v; want %v", test.d, got, test.want) + } + } +} + +// Test time.Time to pbt.Timestamp conversion. +func TestTimeProto(t *testing.T) { + var tests = []struct { + t time.Time + want pbt.Timestamp + }{ + {time.Unix(0, 0), pbt.Timestamp{}}, + {time.Unix(1136239445, 12345), pbt.Timestamp{Seconds: 1136239445, Nanos: 12345}}, + {time.Unix(-1000, 12345), pbt.Timestamp{Seconds: -1000, Nanos: 12345}}, + } + for _, test := range tests { + got := timestampProto(test.t) + if !testEqual(got, &test.want) { + t.Errorf("timestampProto(%v) = %v; want %v", test.t, got, test.want) + } + } +} + +// Test readonly transaction option builder. +func TestBuildTransactionOptionsReadOnly(t *testing.T) { + ts := time.Unix(1136239445, 12345) + var tests = []struct { + tb TimestampBound + ts bool + want sppb.TransactionOptions_ReadOnly + }{ + { + StrongRead(), false, + sppb.TransactionOptions_ReadOnly{ + TimestampBound: &sppb.TransactionOptions_ReadOnly_Strong{ + Strong: true}, + ReturnReadTimestamp: false, + }, + }, + { + ExactStaleness(10 * time.Second), true, + sppb.TransactionOptions_ReadOnly{ + TimestampBound: &sppb.TransactionOptions_ReadOnly_ExactStaleness{ + ExactStaleness: &pbd.Duration{Seconds: 10}}, + ReturnReadTimestamp: true, + }, + }, + { + MaxStaleness(10 * time.Second), true, + sppb.TransactionOptions_ReadOnly{ + TimestampBound: &sppb.TransactionOptions_ReadOnly_MaxStaleness{ + MaxStaleness: &pbd.Duration{Seconds: 10}}, + ReturnReadTimestamp: true, + }, + }, + + { + MinReadTimestamp(ts), true, + sppb.TransactionOptions_ReadOnly{ + TimestampBound: &sppb.TransactionOptions_ReadOnly_MinReadTimestamp{ + MinReadTimestamp: &pbt.Timestamp{Seconds: 1136239445, Nanos: 12345}}, + ReturnReadTimestamp: true, + }, + }, + { + ReadTimestamp(ts), true, + sppb.TransactionOptions_ReadOnly{ + TimestampBound: &sppb.TransactionOptions_ReadOnly_ReadTimestamp{ + ReadTimestamp: &pbt.Timestamp{Seconds: 1136239445, Nanos: 12345}}, + ReturnReadTimestamp: true, + }, + }, + } + for _, test := range tests { + got := buildTransactionOptionsReadOnly(test.tb, test.ts) + if !testEqual(got, &test.want) { + t.Errorf("buildTransactionOptionsReadOnly(%v,%v) = %v; want %v", test.tb, test.ts, got, test.want) + } + } +} diff --git a/vendor/cloud.google.com/go/spanner/trace.go b/vendor/cloud.google.com/go/spanner/trace.go new file mode 100644 index 000000000..6fdbae415 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/trace.go @@ -0,0 +1,81 @@ +// Copyright 2017 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 spanner + +import ( + "context" + "fmt" + + "go.opencensus.io/stats" + "go.opencensus.io/stats/view" + "go.opencensus.io/trace" +) + +func traceStartSpan(ctx context.Context, name string) context.Context { + ctx, _ = trace.StartSpan(ctx, name) + return ctx +} + +func traceEndSpan(ctx context.Context, err error) { + span := trace.FromContext(ctx) + if err != nil { + // TODO(jba): Add error code to the status. + span.SetStatus(trace.Status{Message: err.Error()}) + } + span.End() +} + +func tracePrintf(ctx context.Context, attrMap map[string]interface{}, format string, args ...interface{}) { + var attrs []trace.Attribute + for k, v := range attrMap { + var a trace.Attribute + switch v := v.(type) { + case string: + a = trace.StringAttribute(k, v) + case bool: + a = trace.BoolAttribute(k, v) + case int: + a = trace.Int64Attribute(k, int64(v)) + case int64: + a = trace.Int64Attribute(k, v) + default: + a = trace.StringAttribute(k, fmt.Sprintf("%#v", v)) + } + attrs = append(attrs, a) + } + trace.FromContext(ctx).Annotatef(attrs, format, args...) +} + +const statsPrefix = "cloud.google.com/go/spanner/" + +func recordStat(ctx context.Context, m *stats.Int64Measure, n int64) { + stats.Record(ctx, m.M(n)) +} + +var ( + // OpenSessionCount is a measure of the number of sessions currently opened. + // It is EXPERIMENTAL and subject to change or removal without notice. + OpenSessionCount = stats.Int64(statsPrefix+"open_session_count", "Number of sessions currently opened", + stats.UnitDimensionless) + + // OpenSessionCountView is a view of the last value of OpenSessionCount. + // It is EXPERIMENTAL and subject to change or removal without notice. + OpenSessionCountView = &view.View{ + Name: OpenSessionCount.Name(), + Description: OpenSessionCount.Description(), + Measure: OpenSessionCount, + Aggregation: view.LastValue(), + } +) diff --git a/vendor/cloud.google.com/go/spanner/transaction.go b/vendor/cloud.google.com/go/spanner/transaction.go new file mode 100644 index 000000000..a77f452d4 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/transaction.go @@ -0,0 +1,913 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "sync" + "sync/atomic" + "time" + + "google.golang.org/api/iterator" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// transactionID stores a transaction ID which uniquely identifies a transaction in Cloud Spanner. +type transactionID []byte + +// txReadEnv manages a read-transaction environment consisting of a session handle and a transaction selector. +type txReadEnv interface { + // acquire returns a read-transaction environment that can be used to perform a transactional read. + acquire(ctx context.Context) (*sessionHandle, *sppb.TransactionSelector, error) + // sets the transaction's read timestamp + setTimestamp(time.Time) + // release should be called at the end of every transactional read to deal with session recycling. + release(error) +} + +// txReadOnly contains methods for doing transactional reads. +type txReadOnly struct { + // read-transaction environment for performing transactional read operations. + txReadEnv + + sequenceNumber int64 // Atomic. Only needed for DML statements, but used for all. +} + +// errSessionClosed returns error for using a recycled/destroyed session +func errSessionClosed(sh *sessionHandle) error { + return spannerErrorf(codes.FailedPrecondition, + "session is already recycled / destroyed: session_id = %q, rpc_client = %v", sh.getID(), sh.getClient()) +} + +// Read returns a RowIterator for reading multiple rows from the database. +func (t *txReadOnly) Read(ctx context.Context, table string, keys KeySet, columns []string) *RowIterator { + return t.ReadWithOptions(ctx, table, keys, columns, nil) +} + +// ReadUsingIndex calls ReadWithOptions with ReadOptions{Index: index}. +func (t *txReadOnly) ReadUsingIndex(ctx context.Context, table, index string, keys KeySet, columns []string) (ri *RowIterator) { + return t.ReadWithOptions(ctx, table, keys, columns, &ReadOptions{Index: index}) +} + +// ReadOptions provides options for reading rows from a database. +type ReadOptions struct { + // The index to use for reading. If non-empty, you can only read columns that are + // part of the index key, part of the primary key, or stored in the index due to + // a STORING clause in the index definition. + Index string + + // The maximum number of rows to read. A limit value less than 1 means no limit. + Limit int +} + +// ReadWithOptions returns a RowIterator for reading multiple rows from the database. +// Pass a ReadOptions to modify the read operation. +func (t *txReadOnly) ReadWithOptions(ctx context.Context, table string, keys KeySet, columns []string, opts *ReadOptions) (ri *RowIterator) { + ctx = traceStartSpan(ctx, "cloud.google.com/go/spanner.Read") + defer func() { traceEndSpan(ctx, ri.err) }() + var ( + sh *sessionHandle + ts *sppb.TransactionSelector + err error + ) + kset, err := keys.keySetProto() + if err != nil { + return &RowIterator{err: err} + } + if sh, ts, err = t.acquire(ctx); err != nil { + return &RowIterator{err: err} + } + // Cloud Spanner will return "Session not found" on bad sessions. + sid, client := sh.getID(), sh.getClient() + if sid == "" || client == nil { + // Might happen if transaction is closed in the middle of a API call. + return &RowIterator{err: errSessionClosed(sh)} + } + index := "" + limit := 0 + if opts != nil { + index = opts.Index + if opts.Limit > 0 { + limit = opts.Limit + } + } + return stream( + contextWithOutgoingMetadata(ctx, sh.getMetadata()), + func(ctx context.Context, resumeToken []byte) (streamingReceiver, error) { + return client.StreamingRead(ctx, + &sppb.ReadRequest{ + Session: sid, + Transaction: ts, + Table: table, + Index: index, + Columns: columns, + KeySet: kset, + ResumeToken: resumeToken, + Limit: int64(limit), + }) + }, + t.setTimestamp, + t.release, + ) +} + +// errRowNotFound returns error for not being able to read the row identified by key. +func errRowNotFound(table string, key Key) error { + return spannerErrorf(codes.NotFound, "row not found(Table: %v, PrimaryKey: %v)", table, key) +} + +// ReadRow reads a single row from the database. +// +// If no row is present with the given key, then ReadRow returns an error where +// spanner.ErrCode(err) is codes.NotFound. +func (t *txReadOnly) ReadRow(ctx context.Context, table string, key Key, columns []string) (*Row, error) { + iter := t.Read(ctx, table, key, columns) + defer iter.Stop() + row, err := iter.Next() + switch err { + case iterator.Done: + return nil, errRowNotFound(table, key) + case nil: + return row, nil + default: + return nil, err + } +} + +// Query executes a query against the database. It returns a RowIterator +// for retrieving the resulting rows. +// +// Query returns only row data, without a query plan or execution statistics. +// Use QueryWithStats to get rows along with the plan and statistics. +// Use AnalyzeQuery to get just the plan. +func (t *txReadOnly) Query(ctx context.Context, statement Statement) *RowIterator { + return t.query(ctx, statement, sppb.ExecuteSqlRequest_NORMAL) +} + +// Query executes a SQL statement against the database. It returns a RowIterator +// for retrieving the resulting rows. The RowIterator will also be populated +// with a query plan and execution statistics. +func (t *txReadOnly) QueryWithStats(ctx context.Context, statement Statement) *RowIterator { + return t.query(ctx, statement, sppb.ExecuteSqlRequest_PROFILE) +} + +// AnalyzeQuery returns the query plan for statement. +func (t *txReadOnly) AnalyzeQuery(ctx context.Context, statement Statement) (*sppb.QueryPlan, error) { + iter := t.query(ctx, statement, sppb.ExecuteSqlRequest_PLAN) + defer iter.Stop() + for { + _, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + return nil, err + } + } + if iter.QueryPlan == nil { + return nil, spannerErrorf(codes.Internal, "query plan unavailable") + } + return iter.QueryPlan, nil +} + +func (t *txReadOnly) query(ctx context.Context, statement Statement, mode sppb.ExecuteSqlRequest_QueryMode) (ri *RowIterator) { + ctx = traceStartSpan(ctx, "cloud.google.com/go/spanner.Query") + defer func() { traceEndSpan(ctx, ri.err) }() + req, sh, err := t.prepareExecuteSQL(ctx, statement, mode) + if err != nil { + return &RowIterator{err: err} + } + client := sh.getClient() + return stream( + contextWithOutgoingMetadata(ctx, sh.getMetadata()), + func(ctx context.Context, resumeToken []byte) (streamingReceiver, error) { + req.ResumeToken = resumeToken + return client.ExecuteStreamingSql(ctx, req) + }, + t.setTimestamp, + t.release) +} + +func (t *txReadOnly) prepareExecuteSQL(ctx context.Context, stmt Statement, mode sppb.ExecuteSqlRequest_QueryMode) ( + *sppb.ExecuteSqlRequest, *sessionHandle, error) { + sh, ts, err := t.acquire(ctx) + if err != nil { + return nil, nil, err + } + // Cloud Spanner will return "Session not found" on bad sessions. + sid := sh.getID() + if sid == "" { + // Might happen if transaction is closed in the middle of a API call. + return nil, nil, errSessionClosed(sh) + } + params, paramTypes, err := stmt.convertParams() + if err != nil { + return nil, nil, err + } + req := &sppb.ExecuteSqlRequest{ + Session: sid, + Transaction: ts, + Sql: stmt.SQL, + QueryMode: mode, + Seqno: atomic.AddInt64(&t.sequenceNumber, 1), + Params: params, + ParamTypes: paramTypes, + } + return req, sh, nil +} + +// txState is the status of a transaction. +type txState int + +const ( + // transaction is new, waiting to be initialized. + txNew txState = iota + // transaction is being initialized. + txInit + // transaction is active and can perform read/write. + txActive + // transaction is closed, cannot be used anymore. + txClosed +) + +// errRtsUnavailable returns error for read transaction's read timestamp being unavailable. +func errRtsUnavailable() error { + return spannerErrorf(codes.Internal, "read timestamp is unavailable") +} + +// errTxNotInitialized returns error for using an uninitialized transaction. +func errTxNotInitialized() error { + return spannerErrorf(codes.InvalidArgument, "cannot use a uninitialized transaction") +} + +// errTxClosed returns error for using a closed transaction. +func errTxClosed() error { + return spannerErrorf(codes.InvalidArgument, "cannot use a closed transaction") +} + +// errUnexpectedTxState returns error for transaction enters an unexpected state. +func errUnexpectedTxState(ts txState) error { + return spannerErrorf(codes.FailedPrecondition, "unexpected transaction state: %v", ts) +} + +// ReadOnlyTransaction provides a snapshot transaction with guaranteed +// consistency across reads, but does not allow writes. Read-only +// transactions can be configured to read at timestamps in the past. +// +// Read-only transactions do not take locks. Instead, they work by choosing a +// Cloud Spanner timestamp, then executing all reads at that timestamp. Since they do +// not acquire locks, they do not block concurrent read-write transactions. +// +// Unlike locking read-write transactions, read-only transactions never +// abort. They can fail if the chosen read timestamp is garbage collected; +// however, the default garbage collection policy is generous enough that most +// applications do not need to worry about this in practice. See the +// documentation of TimestampBound for more details. +// +// A ReadOnlyTransaction consumes resources on the server until Close is +// called. +type ReadOnlyTransaction struct { + // txReadOnly contains methods for performing transactional reads. + txReadOnly + + // singleUse indicates that the transaction can be used for only one read. + singleUse bool + + // sp is the session pool for allocating a session to execute the read-only transaction. It is set only once during initialization of the ReadOnlyTransaction. + sp *sessionPool + // mu protects concurrent access to the internal states of ReadOnlyTransaction. + mu sync.Mutex + // tx is the transaction ID in Cloud Spanner that uniquely identifies the ReadOnlyTransaction. + tx transactionID + // txReadyOrClosed is for broadcasting that transaction ID has been returned by Cloud Spanner or that transaction is closed. + txReadyOrClosed chan struct{} + // state is the current transaction status of the ReadOnly transaction. + state txState + // sh is the sessionHandle allocated from sp. + sh *sessionHandle + // rts is the read timestamp returned by transactional reads. + rts time.Time + // tb is the read staleness bound specification for transactional reads. + tb TimestampBound +} + +// errTxInitTimeout returns error for timeout in waiting for initialization of the transaction. +func errTxInitTimeout() error { + return spannerErrorf(codes.Canceled, "timeout/context canceled in waiting for transaction's initialization") +} + +// getTimestampBound returns the read staleness bound specified for the ReadOnlyTransaction. +func (t *ReadOnlyTransaction) getTimestampBound() TimestampBound { + t.mu.Lock() + defer t.mu.Unlock() + return t.tb +} + +// begin starts a snapshot read-only Transaction on Cloud Spanner. +func (t *ReadOnlyTransaction) begin(ctx context.Context) error { + var ( + locked bool + tx transactionID + rts time.Time + sh *sessionHandle + err error + ) + defer func() { + if !locked { + t.mu.Lock() + // Not necessary, just to make it clear that t.mu is being held when locked == true. + locked = true + } + if t.state != txClosed { + // Signal other initialization routines. + close(t.txReadyOrClosed) + t.txReadyOrClosed = make(chan struct{}) + } + t.mu.Unlock() + if err != nil && sh != nil { + // Got a valid session handle, but failed to initialize transaction on Cloud Spanner. + if shouldDropSession(err) { + sh.destroy() + } + // If sh.destroy was already executed, this becomes a noop. + sh.recycle() + } + }() + sh, err = t.sp.take(ctx) + if err != nil { + return err + } + err = runRetryable(contextWithOutgoingMetadata(ctx, sh.getMetadata()), func(ctx context.Context) error { + res, e := sh.getClient().BeginTransaction(ctx, &sppb.BeginTransactionRequest{ + Session: sh.getID(), + Options: &sppb.TransactionOptions{ + Mode: &sppb.TransactionOptions_ReadOnly_{ + ReadOnly: buildTransactionOptionsReadOnly(t.getTimestampBound(), true), + }, + }, + }) + if e != nil { + return e + } + tx = res.Id + if res.ReadTimestamp != nil { + rts = time.Unix(res.ReadTimestamp.Seconds, int64(res.ReadTimestamp.Nanos)) + } + return nil + }) + t.mu.Lock() + locked = true // defer function will be executed with t.mu being held. + if t.state == txClosed { // During the execution of t.begin(), t.Close() was invoked. + return errSessionClosed(sh) + } + // If begin() fails, this allows other queries to take over the initialization. + t.tx = nil + if err == nil { + t.tx = tx + t.rts = rts + t.sh = sh + // State transite to txActive. + t.state = txActive + } + return err +} + +// acquire implements txReadEnv.acquire. +func (t *ReadOnlyTransaction) acquire(ctx context.Context) (*sessionHandle, *sppb.TransactionSelector, error) { + if err := checkNestedTxn(ctx); err != nil { + return nil, nil, err + } + if t.singleUse { + return t.acquireSingleUse(ctx) + } + return t.acquireMultiUse(ctx) +} + +func (t *ReadOnlyTransaction) acquireSingleUse(ctx context.Context) (*sessionHandle, *sppb.TransactionSelector, error) { + t.mu.Lock() + defer t.mu.Unlock() + switch t.state { + case txClosed: + // A closed single-use transaction can never be reused. + return nil, nil, errTxClosed() + case txNew: + t.state = txClosed + ts := &sppb.TransactionSelector{ + Selector: &sppb.TransactionSelector_SingleUse{ + SingleUse: &sppb.TransactionOptions{ + Mode: &sppb.TransactionOptions_ReadOnly_{ + ReadOnly: buildTransactionOptionsReadOnly(t.tb, true), + }, + }, + }, + } + sh, err := t.sp.take(ctx) + if err != nil { + return nil, nil, err + } + // Install session handle into t, which can be used for readonly operations later. + t.sh = sh + return sh, ts, nil + } + us := t.state + // SingleUse transaction should only be in either txNew state or txClosed state. + return nil, nil, errUnexpectedTxState(us) +} + +func (t *ReadOnlyTransaction) acquireMultiUse(ctx context.Context) (*sessionHandle, *sppb.TransactionSelector, error) { + for { + t.mu.Lock() + switch t.state { + case txClosed: + t.mu.Unlock() + return nil, nil, errTxClosed() + case txNew: + // State transit to txInit so that no further TimestampBound change is accepted. + t.state = txInit + t.mu.Unlock() + continue + case txInit: + if t.tx != nil { + // Wait for a transaction ID to become ready. + txReadyOrClosed := t.txReadyOrClosed + t.mu.Unlock() + select { + case <-txReadyOrClosed: + // Need to check transaction state again. + continue + case <-ctx.Done(): + // The waiting for initialization is timeout, return error directly. + return nil, nil, errTxInitTimeout() + } + } + // Take the ownership of initializing the transaction. + t.tx = transactionID{} + t.mu.Unlock() + // Begin a read-only transaction. + // TODO: consider adding a transaction option which allow queries to initiate transactions by themselves. Note that this option might not be + // always good because the ID of the new transaction won't be ready till the query returns some data or completes. + if err := t.begin(ctx); err != nil { + return nil, nil, err + } + // If t.begin() succeeded, t.state should have been changed to txActive, so we can just continue here. + continue + case txActive: + sh := t.sh + ts := &sppb.TransactionSelector{ + Selector: &sppb.TransactionSelector_Id{ + Id: t.tx, + }, + } + t.mu.Unlock() + return sh, ts, nil + } + state := t.state + t.mu.Unlock() + return nil, nil, errUnexpectedTxState(state) + } +} + +func (t *ReadOnlyTransaction) setTimestamp(ts time.Time) { + t.mu.Lock() + defer t.mu.Unlock() + if t.rts.IsZero() { + t.rts = ts + } +} + +// release implements txReadEnv.release. +func (t *ReadOnlyTransaction) release(err error) { + t.mu.Lock() + sh := t.sh + t.mu.Unlock() + if sh != nil { // sh could be nil if t.acquire() fails. + if shouldDropSession(err) { + sh.destroy() + } + if t.singleUse { + // If session handle is already destroyed, this becomes a noop. + sh.recycle() + } + } +} + +// Close closes a ReadOnlyTransaction, the transaction cannot perform any reads after being closed. +func (t *ReadOnlyTransaction) Close() { + if t.singleUse { + return + } + t.mu.Lock() + if t.state != txClosed { + t.state = txClosed + close(t.txReadyOrClosed) + } + sh := t.sh + t.mu.Unlock() + if sh == nil { + return + } + // If session handle is already destroyed, this becomes a noop. + // If there are still active queries and if the recycled session is reused before they complete, Cloud Spanner will cancel them + // on behalf of the new transaction on the session. + if sh != nil { + sh.recycle() + } +} + +// Timestamp returns the timestamp chosen to perform reads and +// queries in this transaction. The value can only be read after some +// read or query has either returned some data or completed without +// returning any data. +func (t *ReadOnlyTransaction) Timestamp() (time.Time, error) { + t.mu.Lock() + defer t.mu.Unlock() + if t.rts.IsZero() { + return t.rts, errRtsUnavailable() + } + return t.rts, nil +} + +// WithTimestampBound specifies the TimestampBound to use for read or query. +// This can only be used before the first read or query is invoked. Note: +// bounded staleness is not available with general ReadOnlyTransactions; use a +// single-use ReadOnlyTransaction instead. +// +// The returned value is the ReadOnlyTransaction so calls can be chained. +func (t *ReadOnlyTransaction) WithTimestampBound(tb TimestampBound) *ReadOnlyTransaction { + t.mu.Lock() + defer t.mu.Unlock() + if t.state == txNew { + // Only allow to set TimestampBound before the first query. + t.tb = tb + } + return t +} + +// ReadWriteTransaction provides a locking read-write transaction. +// +// This type of transaction is the only way to write data into Cloud Spanner; +// (*Client).Apply and (*Client).ApplyAtLeastOnce use transactions +// internally. These transactions rely on pessimistic locking and, if +// necessary, two-phase commit. Locking read-write transactions may abort, +// requiring the application to retry. However, the interface exposed by +// (*Client).ReadWriteTransaction eliminates the need for applications to write +// retry loops explicitly. +// +// Locking transactions may be used to atomically read-modify-write data +// anywhere in a database. This type of transaction is externally consistent. +// +// Clients should attempt to minimize the amount of time a transaction is +// active. Faster transactions commit with higher probability and cause less +// contention. Cloud Spanner attempts to keep read locks active as long as the +// transaction continues to do reads. Long periods of inactivity at the client +// may cause Cloud Spanner to release a transaction's locks and abort it. +// +// Reads performed within a transaction acquire locks on the data being +// read. Writes can only be done at commit time, after all reads have been +// completed. Conceptually, a read-write transaction consists of zero or more +// reads or SQL queries followed by a commit. +// +// See (*Client).ReadWriteTransaction for an example. +// +// Semantics +// +// Cloud Spanner can commit the transaction if all read locks it acquired are still +// valid at commit time, and it is able to acquire write locks for all +// writes. Cloud Spanner can abort the transaction for any reason. If a commit +// attempt returns ABORTED, Cloud Spanner guarantees that the transaction has not +// modified any user data in Cloud Spanner. +// +// Unless the transaction commits, Cloud Spanner makes no guarantees about how long +// the transaction's locks were held for. It is an error to use Cloud Spanner locks +// for any sort of mutual exclusion other than between Cloud Spanner transactions +// themselves. +// +// Aborted transactions +// +// Application code does not need to retry explicitly; RunInTransaction will +// automatically retry a transaction if an attempt results in an abort. The +// lock priority of a transaction increases after each prior aborted +// transaction, meaning that the next attempt has a slightly better chance of +// success than before. +// +// Under some circumstances (e.g., many transactions attempting to modify the +// same row(s)), a transaction can abort many times in a short period before +// successfully committing. Thus, it is not a good idea to cap the number of +// retries a transaction can attempt; instead, it is better to limit the total +// amount of wall time spent retrying. +// +// Idle transactions +// +// A transaction is considered idle if it has no outstanding reads or SQL +// queries and has not started a read or SQL query within the last 10 +// seconds. Idle transactions can be aborted by Cloud Spanner so that they don't hold +// on to locks indefinitely. In that case, the commit will fail with error +// ABORTED. +// +// If this behavior is undesirable, periodically executing a simple SQL query +// in the transaction (e.g., SELECT 1) prevents the transaction from becoming +// idle. +type ReadWriteTransaction struct { + // txReadOnly contains methods for performing transactional reads. + txReadOnly + // sh is the sessionHandle allocated from sp. It is set only once during the initialization of ReadWriteTransaction. + sh *sessionHandle + // tx is the transaction ID in Cloud Spanner that uniquely identifies the ReadWriteTransaction. + // It is set only once in ReadWriteTransaction.begin() during the initialization of ReadWriteTransaction. + tx transactionID + // mu protects concurrent access to the internal states of ReadWriteTransaction. + mu sync.Mutex + // state is the current transaction status of the read-write transaction. + state txState + // wb is the set of buffered mutations waiting to be committed. + wb []*Mutation +} + +// BufferWrite adds a list of mutations to the set of updates that will be +// applied when the transaction is committed. It does not actually apply the +// write until the transaction is committed, so the operation does not +// block. The effects of the write won't be visible to any reads (including +// reads done in the same transaction) until the transaction commits. +// +// See the example for Client.ReadWriteTransaction. +func (t *ReadWriteTransaction) BufferWrite(ms []*Mutation) error { + t.mu.Lock() + defer t.mu.Unlock() + if t.state == txClosed { + return errTxClosed() + } + if t.state != txActive { + return errUnexpectedTxState(t.state) + } + t.wb = append(t.wb, ms...) + return nil +} + +// Update executes a DML statement against the database. It returns the number of +// affected rows. +// Update returns an error if the statement is a query. However, the +// query is executed, and any data read will be validated upon commit. +func (t *ReadWriteTransaction) Update(ctx context.Context, stmt Statement) (rowCount int64, err error) { + ctx = traceStartSpan(ctx, "cloud.google.com/go/spanner.Update") + defer func() { traceEndSpan(ctx, err) }() + req, sh, err := t.prepareExecuteSQL(ctx, stmt, sppb.ExecuteSqlRequest_NORMAL) + if err != nil { + return 0, err + } + resultSet, err := sh.getClient().ExecuteSql(ctx, req) + if err != nil { + return 0, err + } + if resultSet.Stats == nil { + return 0, spannerErrorf(codes.InvalidArgument, "query passed to Update: %q", stmt.SQL) + } + return extractRowCount(resultSet.Stats) +} + +// acquire implements txReadEnv.acquire. +func (t *ReadWriteTransaction) acquire(ctx context.Context) (*sessionHandle, *sppb.TransactionSelector, error) { + ts := &sppb.TransactionSelector{ + Selector: &sppb.TransactionSelector_Id{ + Id: t.tx, + }, + } + t.mu.Lock() + defer t.mu.Unlock() + switch t.state { + case txClosed: + return nil, nil, errTxClosed() + case txActive: + return t.sh, ts, nil + } + return nil, nil, errUnexpectedTxState(t.state) +} + +// release implements txReadEnv.release. +func (t *ReadWriteTransaction) release(err error) { + t.mu.Lock() + sh := t.sh + t.mu.Unlock() + if sh != nil && shouldDropSession(err) { + sh.destroy() + } +} + +func beginTransaction(ctx context.Context, sid string, client sppb.SpannerClient) (transactionID, error) { + var tx transactionID + err := runRetryable(ctx, func(ctx context.Context) error { + res, e := client.BeginTransaction(ctx, &sppb.BeginTransactionRequest{ + Session: sid, + Options: &sppb.TransactionOptions{ + Mode: &sppb.TransactionOptions_ReadWrite_{ + ReadWrite: &sppb.TransactionOptions_ReadWrite{}, + }, + }, + }) + if e != nil { + return e + } + tx = res.Id + return nil + }) + if err != nil { + return nil, err + } + return tx, nil +} + +// begin starts a read-write transacton on Cloud Spanner, it is always called before any of the public APIs. +func (t *ReadWriteTransaction) begin(ctx context.Context) error { + if t.tx != nil { + t.state = txActive + return nil + } + tx, err := beginTransaction(contextWithOutgoingMetadata(ctx, t.sh.getMetadata()), t.sh.getID(), t.sh.getClient()) + if err == nil { + t.tx = tx + t.state = txActive + return nil + } + if shouldDropSession(err) { + t.sh.destroy() + } + return err +} + +// commit tries to commit a readwrite transaction to Cloud Spanner. It also returns the commit timestamp for the transactions. +func (t *ReadWriteTransaction) commit(ctx context.Context) (time.Time, error) { + var ts time.Time + t.mu.Lock() + t.state = txClosed // No further operations after commit. + mPb, err := mutationsProto(t.wb) + t.mu.Unlock() + if err != nil { + return ts, err + } + // In case that sessionHandle was destroyed but transaction body fails to report it. + sid, client := t.sh.getID(), t.sh.getClient() + if sid == "" || client == nil { + return ts, errSessionClosed(t.sh) + } + err = runRetryable(contextWithOutgoingMetadata(ctx, t.sh.getMetadata()), func(ctx context.Context) error { + var trailer metadata.MD + res, e := client.Commit(ctx, &sppb.CommitRequest{ + Session: sid, + Transaction: &sppb.CommitRequest_TransactionId{ + TransactionId: t.tx, + }, + Mutations: mPb, + }, grpc.Trailer(&trailer)) + if e != nil { + return toSpannerErrorWithMetadata(e, trailer) + } + if tstamp := res.GetCommitTimestamp(); tstamp != nil { + ts = time.Unix(tstamp.Seconds, int64(tstamp.Nanos)) + } + return nil + }) + if shouldDropSession(err) { + t.sh.destroy() + } + return ts, err +} + +// rollback is called when a commit is aborted or the transaction body runs into error. +func (t *ReadWriteTransaction) rollback(ctx context.Context) { + t.mu.Lock() + // Forbid further operations on rollbacked transaction. + t.state = txClosed + t.mu.Unlock() + // In case that sessionHandle was destroyed but transaction body fails to report it. + sid, client := t.sh.getID(), t.sh.getClient() + if sid == "" || client == nil { + return + } + err := runRetryable(contextWithOutgoingMetadata(ctx, t.sh.getMetadata()), func(ctx context.Context) error { + _, e := client.Rollback(ctx, &sppb.RollbackRequest{ + Session: sid, + TransactionId: t.tx, + }) + return e + }) + if shouldDropSession(err) { + t.sh.destroy() + } + return +} + +// runInTransaction executes f under a read-write transaction context. +func (t *ReadWriteTransaction) runInTransaction(ctx context.Context, f func(context.Context, *ReadWriteTransaction) error) (time.Time, error) { + var ( + ts time.Time + err error + ) + if err = f(context.WithValue(ctx, transactionInProgressKey{}, 1), t); err == nil { + // Try to commit if transaction body returns no error. + ts, err = t.commit(ctx) + } + if err != nil { + if isAbortErr(err) { + // Retry the transaction using the same session on ABORT error. + // Cloud Spanner will create the new transaction with the previous one's wound-wait priority. + err = errRetry(err) + return ts, err + } + // Not going to commit, according to API spec, should rollback the transaction. + t.rollback(ctx) + return ts, err + } + // err == nil, return commit timestamp. + return ts, nil +} + +// writeOnlyTransaction provides the most efficient way of doing write-only transactions. It essentially does blind writes to Cloud Spanner. +type writeOnlyTransaction struct { + // sp is the session pool which writeOnlyTransaction uses to get Cloud Spanner sessions for blind writes. + sp *sessionPool +} + +// applyAtLeastOnce commits a list of mutations to Cloud Spanner at least once, unless one of the following happens: +// 1) Context times out. +// 2) An unretryable error (e.g. database not found) occurs. +// 3) There is a malformed Mutation object. +func (t *writeOnlyTransaction) applyAtLeastOnce(ctx context.Context, ms ...*Mutation) (time.Time, error) { + var ( + ts time.Time + sh *sessionHandle + ) + mPb, err := mutationsProto(ms) + if err != nil { + // Malformed mutation found, just return the error. + return ts, err + } + err = runRetryable(ctx, func(ct context.Context) error { + var e error + var trailers metadata.MD + if sh == nil || sh.getID() == "" || sh.getClient() == nil { + // No usable session for doing the commit, take one from pool. + sh, e = t.sp.take(ctx) + if e != nil { + // sessionPool.Take already retries for session creations/retrivals. + return e + } + } + res, e := sh.getClient().Commit(contextWithOutgoingMetadata(ctx, sh.getMetadata()), &sppb.CommitRequest{ + Session: sh.getID(), + Transaction: &sppb.CommitRequest_SingleUseTransaction{ + SingleUseTransaction: &sppb.TransactionOptions{ + Mode: &sppb.TransactionOptions_ReadWrite_{ + ReadWrite: &sppb.TransactionOptions_ReadWrite{}, + }, + }, + }, + Mutations: mPb, + }, grpc.Trailer(&trailers)) + if e != nil { + if isAbortErr(e) { + // Mask ABORT error as retryable, because aborted transactions are allowed to be retried. + return errRetry(toSpannerErrorWithMetadata(e, trailers)) + } + if shouldDropSession(e) { + // Discard the bad session. + sh.destroy() + } + return e + } + if tstamp := res.GetCommitTimestamp(); tstamp != nil { + ts = time.Unix(tstamp.Seconds, int64(tstamp.Nanos)) + } + return nil + }) + if sh != nil { + sh.recycle() + } + return ts, err +} + +// isAbortedErr returns true if the error indicates that an gRPC call is aborted on the server side. +func isAbortErr(err error) bool { + if err == nil { + return false + } + if ErrCode(err) == codes.Aborted { + return true + } + return false +} diff --git a/vendor/cloud.google.com/go/spanner/transaction_test.go b/vendor/cloud.google.com/go/spanner/transaction_test.go new file mode 100644 index 000000000..9ac6c7668 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/transaction_test.go @@ -0,0 +1,221 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "errors" + "sync" + "testing" + "time" + + "cloud.google.com/go/spanner/internal/testutil" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" +) + +var ( + errAbrt = spannerErrorf(codes.Aborted, "") + errUsr = errors.New("error") +) + +// setup sets up a Client using mockclient +func mockClient(t *testing.T) (*sessionPool, *testutil.MockCloudSpannerClient, *Client) { + var ( + mc = testutil.NewMockCloudSpannerClient(t) + spc = SessionPoolConfig{} + database = "mockdb" + ) + spc.getRPCClient = func() (sppb.SpannerClient, error) { + return mc, nil + } + sp, err := newSessionPool(database, spc, nil) + if err != nil { + t.Fatalf("cannot create session pool: %v", err) + } + return sp, mc, &Client{ + database: database, + idleSessions: sp, + } +} + +// TestReadOnlyAcquire tests acquire for ReadOnlyTransaction. +func TestReadOnlyAcquire(t *testing.T) { + t.Parallel() + _, mc, client := mockClient(t) + defer client.Close() + mc.SetActions( + testutil.Action{"BeginTransaction", errUsr}, + testutil.Action{"BeginTransaction", nil}, + testutil.Action{"BeginTransaction", nil}, + ) + + // Singleuse should only be used once. + txn := client.Single() + defer txn.Close() + _, _, e := txn.acquire(context.Background()) + if e != nil { + t.Errorf("Acquire for single use, got %v, want nil.", e) + } + _, _, e = txn.acquire(context.Background()) + if wantErr := errTxClosed(); !testEqual(e, wantErr) { + t.Errorf("Second acquire for single use, got %v, want %v.", e, wantErr) + } + // Multiuse can recover from acquire failure. + txn = client.ReadOnlyTransaction() + _, _, e = txn.acquire(context.Background()) + if wantErr := toSpannerError(errUsr); !testEqual(e, wantErr) { + t.Errorf("Acquire for multi use, got %v, want %v.", e, wantErr) + } + _, _, e = txn.acquire(context.Background()) + if e != nil { + t.Errorf("Acquire for multi use, got %v, want nil.", e) + } + txn.Close() + // Multiuse can not be used after close. + _, _, e = txn.acquire(context.Background()) + if wantErr := errTxClosed(); !testEqual(e, wantErr) { + t.Errorf("Second acquire for multi use, got %v, want %v.", e, wantErr) + } + // Multiuse can be acquired concurrently. + txn = client.ReadOnlyTransaction() + defer txn.Close() + mc.Freeze() + var ( + sh1 *sessionHandle + sh2 *sessionHandle + ts1 *sppb.TransactionSelector + ts2 *sppb.TransactionSelector + wg = sync.WaitGroup{} + ) + acquire := func(sh **sessionHandle, ts **sppb.TransactionSelector) { + defer wg.Done() + var e error + *sh, *ts, e = txn.acquire(context.Background()) + if e != nil { + t.Errorf("Concurrent acquire for multiuse, got %v, expect nil.", e) + } + } + wg.Add(2) + go acquire(&sh1, &ts1) + go acquire(&sh2, &ts2) + <-time.After(100 * time.Millisecond) + mc.Unfreeze() + wg.Wait() + if !testEqual(sh1.session, sh2.session) { + t.Errorf("Expect acquire to get same session handle, got %v and %v.", sh1, sh2) + } + if !testEqual(ts1, ts2) { + t.Errorf("Expect acquire to get same transaction selector, got %v and %v.", ts1, ts2) + } +} + +// TestRetryOnAbort tests transaction retries on abort. +func TestRetryOnAbort(t *testing.T) { + t.Parallel() + _, mc, client := mockClient(t) + defer client.Close() + // commit in writeOnlyTransaction + mc.SetActions( + testutil.Action{"Commit", errAbrt}, // abort on first commit + testutil.Action{"Commit", nil}, + ) + + ms := []*Mutation{ + Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(1), "Foo", int64(50)}), + Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(2), "Bar", int64(1)}), + } + if _, e := client.Apply(context.Background(), ms, ApplyAtLeastOnce()); e != nil { + t.Errorf("applyAtLeastOnce retry on abort, got %v, want nil.", e) + } + // begin and commit in ReadWriteTransaction + mc.SetActions( + testutil.Action{"BeginTransaction", nil}, // let takeWriteSession succeed and get a session handle + testutil.Action{"Commit", errAbrt}, // let first commit fail and retry will begin new transaction + testutil.Action{"BeginTransaction", errAbrt}, // this time we can fail the begin attempt + testutil.Action{"BeginTransaction", nil}, + testutil.Action{"Commit", nil}, + ) + + if _, e := client.Apply(context.Background(), ms); e != nil { + t.Errorf("ReadWriteTransaction retry on abort, got %v, want nil.", e) + } +} + +// TestBadSession tests bad session (session not found error). +// TODO: session closed from transaction close +func TestBadSession(t *testing.T) { + t.Parallel() + ctx := context.Background() + sp, mc, client := mockClient(t) + defer client.Close() + var sid string + // Prepare a session, get the session id for use in testing. + if s, e := sp.take(ctx); e != nil { + t.Fatal("Prepare session failed.") + } else { + sid = s.getID() + s.recycle() + } + + wantErr := spannerErrorf(codes.NotFound, "Session not found: %v", sid) + // ReadOnlyTransaction + mc.SetActions( + testutil.Action{"BeginTransaction", wantErr}, + testutil.Action{"BeginTransaction", wantErr}, + testutil.Action{"BeginTransaction", wantErr}, + ) + txn := client.ReadOnlyTransaction() + defer txn.Close() + if _, _, got := txn.acquire(ctx); !testEqual(wantErr, got) { + t.Errorf("Expect acquire to fail, got %v, want %v.", got, wantErr) + } + // The failure should recycle the session, we expect it to be used in following requests. + if got := txn.Query(ctx, NewStatement("SELECT 1")); !testEqual(wantErr, got.err) { + t.Errorf("Expect Query to fail, got %v, want %v.", got.err, wantErr) + } + if got := txn.Read(ctx, "Users", KeySets(Key{"alice"}, Key{"bob"}), []string{"name", "email"}); !testEqual(wantErr, got.err) { + t.Errorf("Expect Read to fail, got %v, want %v.", got.err, wantErr) + } + // writeOnlyTransaction + ms := []*Mutation{ + Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(1), "Foo", int64(50)}), + Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(2), "Bar", int64(1)}), + } + mc.SetActions(testutil.Action{"Commit", wantErr}) + if _, got := client.Apply(context.Background(), ms, ApplyAtLeastOnce()); !testEqual(wantErr, got) { + t.Errorf("Expect applyAtLeastOnce to fail, got %v, want %v.", got, wantErr) + } +} + +func TestFunctionErrorReturned(t *testing.T) { + t.Parallel() + _, mc, client := mockClient(t) + defer client.Close() + mc.SetActions( + testutil.Action{"BeginTransaction", nil}, + testutil.Action{"Rollback", nil}, + ) + + want := errors.New("an error") + _, got := client.ReadWriteTransaction(context.Background(), + func(context.Context, *ReadWriteTransaction) error { return want }) + if got != want { + t.Errorf("got <%v>, want <%v>", got, want) + } + mc.CheckActionsConsumed() +} diff --git a/vendor/cloud.google.com/go/spanner/util.go b/vendor/cloud.google.com/go/spanner/util.go new file mode 100644 index 000000000..f4f2b25bd --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/util.go @@ -0,0 +1,33 @@ +/* +Copyright 2017 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 spanner + +// maxUint64 returns the maximum of two uint64 +func maxUint64(a, b uint64) uint64 { + if a > b { + return a + } + return b +} + +// minUint64 returns the minimum of two uint64 +func minUint64(a, b uint64) uint64 { + if a > b { + return b + } + return a +} diff --git a/vendor/cloud.google.com/go/spanner/util_test.go b/vendor/cloud.google.com/go/spanner/util_test.go new file mode 100644 index 000000000..270d2ae26 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/util_test.go @@ -0,0 +1,28 @@ +/* +Copyright 2017 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 spanner + +import ( + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" +) + +func testEqual(a, b interface{}) bool { + return testutil.Equal(a, b, + cmp.AllowUnexported(TimestampBound{}, Error{}, Mutation{}, Row{}, + Partition{}, BatchReadOnlyTransactionID{})) +} diff --git a/vendor/cloud.google.com/go/spanner/value.go b/vendor/cloud.google.com/go/spanner/value.go new file mode 100644 index 000000000..8e049d373 --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/value.go @@ -0,0 +1,1608 @@ +/* +Copyright 2017 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 spanner + +import ( + "encoding/base64" + "fmt" + "math" + "reflect" + "strconv" + "time" + + "cloud.google.com/go/civil" + "cloud.google.com/go/internal/fields" + proto "github.com/golang/protobuf/proto" + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" + "google.golang.org/grpc/codes" +) + +const commitTimestampPlaceholderString = "spanner.commit_timestamp()" + +var ( + // CommitTimestamp is a special value used to tell Cloud Spanner + // to insert the commit timestamp of the transaction into a column. + // It can be used in a Mutation, or directly used in + // InsertStruct or InsertMap. See ExampleCommitTimestamp. + // This is just a placeholder and the actual value stored in this + // variable has no meaning. + CommitTimestamp = commitTimestamp + commitTimestamp = time.Unix(0, 0).In(time.FixedZone("CommitTimestamp placeholder", 0xDB)) +) + +// NullInt64 represents a Cloud Spanner INT64 that may be NULL. +type NullInt64 struct { + Int64 int64 + Valid bool // Valid is true if Int64 is not NULL. +} + +// String implements Stringer.String for NullInt64 +func (n NullInt64) String() string { + if !n.Valid { + return fmt.Sprintf("%v", "") + } + return fmt.Sprintf("%v", n.Int64) +} + +// NullString represents a Cloud Spanner STRING that may be NULL. +type NullString struct { + StringVal string + Valid bool // Valid is true if StringVal is not NULL. +} + +// String implements Stringer.String for NullString +func (n NullString) String() string { + if !n.Valid { + return fmt.Sprintf("%v", "") + } + return fmt.Sprintf("%q", n.StringVal) +} + +// NullFloat64 represents a Cloud Spanner FLOAT64 that may be NULL. +type NullFloat64 struct { + Float64 float64 + Valid bool // Valid is true if Float64 is not NULL. +} + +// Cloud Spanner STRUCT (aka STRUCT) values (https://cloud.google.com/spanner/docs/data-types#struct-type) +// can be represented by a Go struct value. +// The spanner.StructType of such values is built from the field types and field tag information +// of the Go struct. If a field in the struct type definition has a "spanner:" tag, +// then the value of the "spanner" key in the tag is used as the name for that field in the +// built spanner.StructType, otherwise the field name in the struct definition is used. To specify a +// field with an empty field name in a Cloud Spanner STRUCT type, use the `spanner:""` tag +// annotation against the corresponding field in the Go struct's type definition. +// +// A STRUCT value can contain STRUCT-typed and Array-of-STRUCT typed fields and these can be +// specified using named struct-typed and []struct-typed fields inside a Go struct. However, +// embedded struct fields are not allowed. Unexported struct fields are ignored. +// +// NULL STRUCT values in Cloud Spanner are typed. A nil pointer to a Go struct value can be used to +// specify a NULL STRUCT value of the corresponding spanner.StructType. Nil and empty slices of a +// Go STRUCT type can be used to specify NULL and empty array values respectively of the +// corresponding spanner.StructType. A slice of pointers to a Go struct type can be used to specify +// an array of NULL-able STRUCT values. + +// String implements Stringer.String for NullFloat64 +func (n NullFloat64) String() string { + if !n.Valid { + return fmt.Sprintf("%v", "") + } + return fmt.Sprintf("%v", n.Float64) +} + +// NullBool represents a Cloud Spanner BOOL that may be NULL. +type NullBool struct { + Bool bool + Valid bool // Valid is true if Bool is not NULL. +} + +// String implements Stringer.String for NullBool +func (n NullBool) String() string { + if !n.Valid { + return fmt.Sprintf("%v", "") + } + return fmt.Sprintf("%v", n.Bool) +} + +// NullTime represents a Cloud Spanner TIMESTAMP that may be null. +type NullTime struct { + Time time.Time + Valid bool // Valid is true if Time is not NULL. +} + +// String implements Stringer.String for NullTime +func (n NullTime) String() string { + if !n.Valid { + return fmt.Sprintf("%s", "") + } + return fmt.Sprintf("%q", n.Time.Format(time.RFC3339Nano)) +} + +// NullDate represents a Cloud Spanner DATE that may be null. +type NullDate struct { + Date civil.Date + Valid bool // Valid is true if Date is not NULL. +} + +// String implements Stringer.String for NullDate +func (n NullDate) String() string { + if !n.Valid { + return fmt.Sprintf("%s", "") + } + return fmt.Sprintf("%q", n.Date) +} + +// NullRow represents a Cloud Spanner STRUCT that may be NULL. +// See also the document for Row. +// Note that NullRow is not a valid Cloud Spanner column Type. +type NullRow struct { + Row Row + Valid bool // Valid is true if Row is not NULL. +} + +// GenericColumnValue represents the generic encoded value and type of the +// column. See google.spanner.v1.ResultSet proto for details. This can be +// useful for proxying query results when the result types are not known in +// advance. +// +// If you populate a GenericColumnValue from a row using Row.Column or related +// methods, do not modify the contents of Type and Value. +type GenericColumnValue struct { + Type *sppb.Type + Value *proto3.Value +} + +// Decode decodes a GenericColumnValue. The ptr argument should be a pointer +// to a Go value that can accept v. +func (v GenericColumnValue) Decode(ptr interface{}) error { + return decodeValue(v.Value, v.Type, ptr) +} + +// NewGenericColumnValue creates a GenericColumnValue from Go value that is +// valid for Cloud Spanner. +func newGenericColumnValue(v interface{}) (*GenericColumnValue, error) { + value, typ, err := encodeValue(v) + if err != nil { + return nil, err + } + return &GenericColumnValue{Value: value, Type: typ}, nil +} + +// errTypeMismatch returns error for destination not having a compatible type +// with source Cloud Spanner type. +func errTypeMismatch(srcCode, elCode sppb.TypeCode, dst interface{}) error { + s := srcCode.String() + if srcCode == sppb.TypeCode_ARRAY { + s = fmt.Sprintf("%v[%v]", srcCode, elCode) + } + return spannerErrorf(codes.InvalidArgument, "type %T cannot be used for decoding %s", dst, s) +} + +// errNilSpannerType returns error for nil Cloud Spanner type in decoding. +func errNilSpannerType() error { + return spannerErrorf(codes.FailedPrecondition, "unexpected nil Cloud Spanner data type in decoding") +} + +// errNilSrc returns error for decoding from nil proto value. +func errNilSrc() error { + return spannerErrorf(codes.FailedPrecondition, "unexpected nil Cloud Spanner value in decoding") +} + +// errNilDst returns error for decoding into nil interface{}. +func errNilDst(dst interface{}) error { + return spannerErrorf(codes.InvalidArgument, "cannot decode into nil type %T", dst) +} + +// errNilArrElemType returns error for input Cloud Spanner data type being a array but without a +// non-nil array element type. +func errNilArrElemType(t *sppb.Type) error { + return spannerErrorf(codes.FailedPrecondition, "array type %v is with nil array element type", t) +} + +func errUnsupportedEmbeddedStructFields(fname string) error { + return spannerErrorf(codes.InvalidArgument, "Embedded field: %s. Embedded and anonymous fields are not allowed "+ + "when converting Go structs to Cloud Spanner STRUCT values. To create a STRUCT value with an "+ + "unnamed field, use a `spanner:\"\"` field tag.", fname) +} + +// errDstNotForNull returns error for decoding a SQL NULL value into a destination which doesn't +// support NULL values. +func errDstNotForNull(dst interface{}) error { + return spannerErrorf(codes.InvalidArgument, "destination %T cannot support NULL SQL values", dst) +} + +// errBadEncoding returns error for decoding wrongly encoded types. +func errBadEncoding(v *proto3.Value, err error) error { + return spannerErrorf(codes.FailedPrecondition, "%v wasn't correctly encoded: <%v>", v, err) +} + +func parseNullTime(v *proto3.Value, p *NullTime, code sppb.TypeCode, isNull bool) error { + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_TIMESTAMP { + return errTypeMismatch(code, sppb.TypeCode_TYPE_CODE_UNSPECIFIED, p) + } + if isNull { + *p = NullTime{} + return nil + } + x, err := getStringValue(v) + if err != nil { + return err + } + y, err := time.Parse(time.RFC3339Nano, x) + if err != nil { + return errBadEncoding(v, err) + } + p.Valid = true + p.Time = y + return nil +} + +// decodeValue decodes a protobuf Value into a pointer to a Go value, as +// specified by sppb.Type. +func decodeValue(v *proto3.Value, t *sppb.Type, ptr interface{}) error { + if v == nil { + return errNilSrc() + } + if t == nil { + return errNilSpannerType() + } + code := t.Code + acode := sppb.TypeCode_TYPE_CODE_UNSPECIFIED + if code == sppb.TypeCode_ARRAY { + if t.ArrayElementType == nil { + return errNilArrElemType(t) + } + acode = t.ArrayElementType.Code + } + _, isNull := v.Kind.(*proto3.Value_NullValue) + + // Do the decoding based on the type of ptr. + switch p := ptr.(type) { + case nil: + return errNilDst(nil) + case *string: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_STRING { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + return errDstNotForNull(ptr) + } + x, err := getStringValue(v) + if err != nil { + return err + } + *p = x + case *NullString: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_STRING { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = NullString{} + break + } + x, err := getStringValue(v) + if err != nil { + return err + } + p.Valid = true + p.StringVal = x + case *[]NullString: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_STRING { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeNullStringArray(x) + if err != nil { + return err + } + *p = y + case *[]string: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_STRING { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeStringArray(x) + if err != nil { + return err + } + *p = y + case *[]byte: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_BYTES { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getStringValue(v) + if err != nil { + return err + } + y, err := base64.StdEncoding.DecodeString(x) + if err != nil { + return errBadEncoding(v, err) + } + *p = y + case *[][]byte: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_BYTES { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeByteArray(x) + if err != nil { + return err + } + *p = y + case *int64: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_INT64 { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + return errDstNotForNull(ptr) + } + x, err := getStringValue(v) + if err != nil { + return err + } + y, err := strconv.ParseInt(x, 10, 64) + if err != nil { + return errBadEncoding(v, err) + } + *p = y + case *NullInt64: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_INT64 { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = NullInt64{} + break + } + x, err := getStringValue(v) + if err != nil { + return err + } + y, err := strconv.ParseInt(x, 10, 64) + if err != nil { + return errBadEncoding(v, err) + } + p.Valid = true + p.Int64 = y + case *[]NullInt64: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_INT64 { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeNullInt64Array(x) + if err != nil { + return err + } + *p = y + case *[]int64: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_INT64 { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeInt64Array(x) + if err != nil { + return err + } + *p = y + case *bool: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_BOOL { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + return errDstNotForNull(ptr) + } + x, err := getBoolValue(v) + if err != nil { + return err + } + *p = x + case *NullBool: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_BOOL { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = NullBool{} + break + } + x, err := getBoolValue(v) + if err != nil { + return err + } + p.Valid = true + p.Bool = x + case *[]NullBool: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_BOOL { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeNullBoolArray(x) + if err != nil { + return err + } + *p = y + case *[]bool: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_BOOL { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeBoolArray(x) + if err != nil { + return err + } + *p = y + case *float64: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_FLOAT64 { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + return errDstNotForNull(ptr) + } + x, err := getFloat64Value(v) + if err != nil { + return err + } + *p = x + case *NullFloat64: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_FLOAT64 { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = NullFloat64{} + break + } + x, err := getFloat64Value(v) + if err != nil { + return err + } + p.Valid = true + p.Float64 = x + case *[]NullFloat64: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_FLOAT64 { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeNullFloat64Array(x) + if err != nil { + return err + } + *p = y + case *[]float64: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_FLOAT64 { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeFloat64Array(x) + if err != nil { + return err + } + *p = y + case *time.Time: + var nt NullTime + if isNull { + return errDstNotForNull(ptr) + } + err := parseNullTime(v, &nt, code, isNull) + if err != nil { + return nil + } + *p = nt.Time + case *NullTime: + err := parseNullTime(v, p, code, isNull) + if err != nil { + return err + } + case *[]NullTime: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_TIMESTAMP { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeNullTimeArray(x) + if err != nil { + return err + } + *p = y + case *[]time.Time: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_TIMESTAMP { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeTimeArray(x) + if err != nil { + return err + } + *p = y + case *civil.Date: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_DATE { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + return errDstNotForNull(ptr) + } + x, err := getStringValue(v) + if err != nil { + return err + } + y, err := civil.ParseDate(x) + if err != nil { + return errBadEncoding(v, err) + } + *p = y + case *NullDate: + if p == nil { + return errNilDst(p) + } + if code != sppb.TypeCode_DATE { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = NullDate{} + break + } + x, err := getStringValue(v) + if err != nil { + return err + } + y, err := civil.ParseDate(x) + if err != nil { + return errBadEncoding(v, err) + } + p.Valid = true + p.Date = y + case *[]NullDate: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_DATE { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeNullDateArray(x) + if err != nil { + return err + } + *p = y + case *[]civil.Date: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_DATE { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeDateArray(x) + if err != nil { + return err + } + *p = y + case *[]NullRow: + if p == nil { + return errNilDst(p) + } + if acode != sppb.TypeCode_STRUCT { + return errTypeMismatch(code, acode, ptr) + } + if isNull { + *p = nil + break + } + x, err := getListValue(v) + if err != nil { + return err + } + y, err := decodeRowArray(t.ArrayElementType.StructType, x) + if err != nil { + return err + } + *p = y + case *GenericColumnValue: + *p = GenericColumnValue{Type: t, Value: v} + default: + // Check if the proto encoding is for an array of structs. + if !(code == sppb.TypeCode_ARRAY && acode == sppb.TypeCode_STRUCT) { + return errTypeMismatch(code, acode, ptr) + } + vp := reflect.ValueOf(p) + if !vp.IsValid() { + return errNilDst(p) + } + if !isPtrStructPtrSlice(vp.Type()) { + // The container is not a pointer to a struct pointer slice. + return errTypeMismatch(code, acode, ptr) + } + // Only use reflection for nil detection on slow path. + // Also, IsNil panics on many types, so check it after the type check. + if vp.IsNil() { + return errNilDst(p) + } + if isNull { + // The proto Value is encoding NULL, set the pointer to struct + // slice to nil as well. + vp.Elem().Set(reflect.Zero(vp.Elem().Type())) + break + } + x, err := getListValue(v) + if err != nil { + return err + } + if err = decodeStructArray(t.ArrayElementType.StructType, x, p); err != nil { + return err + } + } + return nil +} + +// errSrvVal returns an error for getting a wrong source protobuf value in decoding. +func errSrcVal(v *proto3.Value, want string) error { + return spannerErrorf(codes.FailedPrecondition, "cannot use %v(Kind: %T) as %s Value", + v, v.GetKind(), want) +} + +// getStringValue returns the string value encoded in proto3.Value v whose +// kind is proto3.Value_StringValue. +func getStringValue(v *proto3.Value) (string, error) { + if x, ok := v.GetKind().(*proto3.Value_StringValue); ok && x != nil { + return x.StringValue, nil + } + return "", errSrcVal(v, "String") +} + +// getBoolValue returns the bool value encoded in proto3.Value v whose +// kind is proto3.Value_BoolValue. +func getBoolValue(v *proto3.Value) (bool, error) { + if x, ok := v.GetKind().(*proto3.Value_BoolValue); ok && x != nil { + return x.BoolValue, nil + } + return false, errSrcVal(v, "Bool") +} + +// getListValue returns the proto3.ListValue contained in proto3.Value v whose +// kind is proto3.Value_ListValue. +func getListValue(v *proto3.Value) (*proto3.ListValue, error) { + if x, ok := v.GetKind().(*proto3.Value_ListValue); ok && x != nil { + return x.ListValue, nil + } + return nil, errSrcVal(v, "List") +} + +// errUnexpectedNumStr returns error for decoder getting a unexpected string for +// representing special float values. +func errUnexpectedNumStr(s string) error { + return spannerErrorf(codes.FailedPrecondition, "unexpected string value %q for number", s) +} + +// getFloat64Value returns the float64 value encoded in proto3.Value v whose +// kind is proto3.Value_NumberValue / proto3.Value_StringValue. +// Cloud Spanner uses string to encode NaN, Infinity and -Infinity. +func getFloat64Value(v *proto3.Value) (float64, error) { + switch x := v.GetKind().(type) { + case *proto3.Value_NumberValue: + if x == nil { + break + } + return x.NumberValue, nil + case *proto3.Value_StringValue: + if x == nil { + break + } + switch x.StringValue { + case "NaN": + return math.NaN(), nil + case "Infinity": + return math.Inf(1), nil + case "-Infinity": + return math.Inf(-1), nil + default: + return 0, errUnexpectedNumStr(x.StringValue) + } + } + return 0, errSrcVal(v, "Number") +} + +// errNilListValue returns error for unexpected nil ListValue in decoding Cloud Spanner ARRAYs. +func errNilListValue(sqlType string) error { + return spannerErrorf(codes.FailedPrecondition, "unexpected nil ListValue in decoding %v array", sqlType) +} + +// errDecodeArrayElement returns error for failure in decoding single array element. +func errDecodeArrayElement(i int, v proto.Message, sqlType string, err error) error { + se, ok := toSpannerError(err).(*Error) + if !ok { + return spannerErrorf(codes.Unknown, + "cannot decode %v(array element %v) as %v, error = <%v>", v, i, sqlType, err) + } + se.decorate(fmt.Sprintf("cannot decode %v(array element %v) as %v", v, i, sqlType)) + return se +} + +// decodeNullStringArray decodes proto3.ListValue pb into a NullString slice. +func decodeNullStringArray(pb *proto3.ListValue) ([]NullString, error) { + if pb == nil { + return nil, errNilListValue("STRING") + } + a := make([]NullString, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, stringType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "STRING", err) + } + } + return a, nil +} + +// decodeStringArray decodes proto3.ListValue pb into a string slice. +func decodeStringArray(pb *proto3.ListValue) ([]string, error) { + if pb == nil { + return nil, errNilListValue("STRING") + } + a := make([]string, len(pb.Values)) + st := stringType() + for i, v := range pb.Values { + if err := decodeValue(v, st, &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "STRING", err) + } + } + return a, nil +} + +// decodeNullInt64Array decodes proto3.ListValue pb into a NullInt64 slice. +func decodeNullInt64Array(pb *proto3.ListValue) ([]NullInt64, error) { + if pb == nil { + return nil, errNilListValue("INT64") + } + a := make([]NullInt64, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, intType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "INT64", err) + } + } + return a, nil +} + +// decodeInt64Array decodes proto3.ListValue pb into a int64 slice. +func decodeInt64Array(pb *proto3.ListValue) ([]int64, error) { + if pb == nil { + return nil, errNilListValue("INT64") + } + a := make([]int64, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, intType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "INT64", err) + } + } + return a, nil +} + +// decodeNullBoolArray decodes proto3.ListValue pb into a NullBool slice. +func decodeNullBoolArray(pb *proto3.ListValue) ([]NullBool, error) { + if pb == nil { + return nil, errNilListValue("BOOL") + } + a := make([]NullBool, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, boolType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "BOOL", err) + } + } + return a, nil +} + +// decodeBoolArray decodes proto3.ListValue pb into a bool slice. +func decodeBoolArray(pb *proto3.ListValue) ([]bool, error) { + if pb == nil { + return nil, errNilListValue("BOOL") + } + a := make([]bool, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, boolType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "BOOL", err) + } + } + return a, nil +} + +// decodeNullFloat64Array decodes proto3.ListValue pb into a NullFloat64 slice. +func decodeNullFloat64Array(pb *proto3.ListValue) ([]NullFloat64, error) { + if pb == nil { + return nil, errNilListValue("FLOAT64") + } + a := make([]NullFloat64, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, floatType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "FLOAT64", err) + } + } + return a, nil +} + +// decodeFloat64Array decodes proto3.ListValue pb into a float64 slice. +func decodeFloat64Array(pb *proto3.ListValue) ([]float64, error) { + if pb == nil { + return nil, errNilListValue("FLOAT64") + } + a := make([]float64, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, floatType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "FLOAT64", err) + } + } + return a, nil +} + +// decodeByteArray decodes proto3.ListValue pb into a slice of byte slice. +func decodeByteArray(pb *proto3.ListValue) ([][]byte, error) { + if pb == nil { + return nil, errNilListValue("BYTES") + } + a := make([][]byte, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, bytesType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "BYTES", err) + } + } + return a, nil +} + +// decodeNullTimeArray decodes proto3.ListValue pb into a NullTime slice. +func decodeNullTimeArray(pb *proto3.ListValue) ([]NullTime, error) { + if pb == nil { + return nil, errNilListValue("TIMESTAMP") + } + a := make([]NullTime, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, timeType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "TIMESTAMP", err) + } + } + return a, nil +} + +// decodeTimeArray decodes proto3.ListValue pb into a time.Time slice. +func decodeTimeArray(pb *proto3.ListValue) ([]time.Time, error) { + if pb == nil { + return nil, errNilListValue("TIMESTAMP") + } + a := make([]time.Time, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, timeType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "TIMESTAMP", err) + } + } + return a, nil +} + +// decodeNullDateArray decodes proto3.ListValue pb into a NullDate slice. +func decodeNullDateArray(pb *proto3.ListValue) ([]NullDate, error) { + if pb == nil { + return nil, errNilListValue("DATE") + } + a := make([]NullDate, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, dateType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "DATE", err) + } + } + return a, nil +} + +// decodeDateArray decodes proto3.ListValue pb into a civil.Date slice. +func decodeDateArray(pb *proto3.ListValue) ([]civil.Date, error) { + if pb == nil { + return nil, errNilListValue("DATE") + } + a := make([]civil.Date, len(pb.Values)) + for i, v := range pb.Values { + if err := decodeValue(v, dateType(), &a[i]); err != nil { + return nil, errDecodeArrayElement(i, v, "DATE", err) + } + } + return a, nil +} + +func errNotStructElement(i int, v *proto3.Value) error { + return errDecodeArrayElement(i, v, "STRUCT", + spannerErrorf(codes.FailedPrecondition, "%v(type: %T) doesn't encode Cloud Spanner STRUCT", v, v)) +} + +// decodeRowArray decodes proto3.ListValue pb into a NullRow slice according to +// the structural information given in sppb.StructType ty. +func decodeRowArray(ty *sppb.StructType, pb *proto3.ListValue) ([]NullRow, error) { + if pb == nil { + return nil, errNilListValue("STRUCT") + } + a := make([]NullRow, len(pb.Values)) + for i := range pb.Values { + switch v := pb.Values[i].GetKind().(type) { + case *proto3.Value_ListValue: + a[i] = NullRow{ + Row: Row{ + fields: ty.Fields, + vals: v.ListValue.Values, + }, + Valid: true, + } + // Null elements not currently supported by the server, see + // https://cloud.google.com/spanner/docs/query-syntax#using-structs-with-select + case *proto3.Value_NullValue: + // no-op, a[i] is NullRow{} already + default: + return nil, errNotStructElement(i, pb.Values[i]) + } + } + return a, nil +} + +// errNilSpannerStructType returns error for unexpected nil Cloud Spanner STRUCT schema type in decoding. +func errNilSpannerStructType() error { + return spannerErrorf(codes.FailedPrecondition, "unexpected nil StructType in decoding Cloud Spanner STRUCT") +} + +// errUnnamedField returns error for decoding a Cloud Spanner STRUCT with unnamed field into a Go struct. +func errUnnamedField(ty *sppb.StructType, i int) error { + return spannerErrorf(codes.InvalidArgument, "unnamed field %v in Cloud Spanner STRUCT %+v", i, ty) +} + +// errNoOrDupGoField returns error for decoding a Cloud Spanner +// STRUCT into a Go struct which is either missing a field, or has duplicate fields. +func errNoOrDupGoField(s interface{}, f string) error { + return spannerErrorf(codes.InvalidArgument, "Go struct %+v(type %T) has no or duplicate fields for Cloud Spanner STRUCT field %v", s, s, f) +} + +// errDupColNames returns error for duplicated Cloud Spanner STRUCT field names found in decoding a Cloud Spanner STRUCT into a Go struct. +func errDupSpannerField(f string, ty *sppb.StructType) error { + return spannerErrorf(codes.InvalidArgument, "duplicated field name %q in Cloud Spanner STRUCT %+v", f, ty) +} + +// errDecodeStructField returns error for failure in decoding a single field of a Cloud Spanner STRUCT. +func errDecodeStructField(ty *sppb.StructType, f string, err error) error { + se, ok := toSpannerError(err).(*Error) + if !ok { + return spannerErrorf(codes.Unknown, + "cannot decode field %v of Cloud Spanner STRUCT %+v, error = <%v>", f, ty, err) + } + se.decorate(fmt.Sprintf("cannot decode field %v of Cloud Spanner STRUCT %+v", f, ty)) + return se +} + +// decodeStruct decodes proto3.ListValue pb into struct referenced by pointer ptr, according to +// the structural information given in sppb.StructType ty. +func decodeStruct(ty *sppb.StructType, pb *proto3.ListValue, ptr interface{}) error { + if reflect.ValueOf(ptr).IsNil() { + return errNilDst(ptr) + } + if ty == nil { + return errNilSpannerStructType() + } + // t holds the structural information of ptr. + t := reflect.TypeOf(ptr).Elem() + // v is the actual value that ptr points to. + v := reflect.ValueOf(ptr).Elem() + + fields, err := fieldCache.Fields(t) + if err != nil { + return toSpannerError(err) + } + seen := map[string]bool{} + for i, f := range ty.Fields { + if f.Name == "" { + return errUnnamedField(ty, i) + } + sf := fields.Match(f.Name) + if sf == nil { + return errNoOrDupGoField(ptr, f.Name) + } + if seen[f.Name] { + // We don't allow duplicated field name. + return errDupSpannerField(f.Name, ty) + } + // Try to decode a single field. + if err := decodeValue(pb.Values[i], f.Type, v.FieldByIndex(sf.Index).Addr().Interface()); err != nil { + return errDecodeStructField(ty, f.Name, err) + } + // Mark field f.Name as processed. + seen[f.Name] = true + } + return nil +} + +// isPtrStructPtrSlice returns true if ptr is a pointer to a slice of struct pointers. +func isPtrStructPtrSlice(t reflect.Type) bool { + if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Slice { + // t is not a pointer to a slice. + return false + } + if t = t.Elem(); t.Elem().Kind() != reflect.Ptr || t.Elem().Elem().Kind() != reflect.Struct { + // the slice that t points to is not a slice of struct pointers. + return false + } + return true +} + +// decodeStructArray decodes proto3.ListValue pb into struct slice referenced by pointer ptr, according to the +// structural information given in a sppb.StructType. +func decodeStructArray(ty *sppb.StructType, pb *proto3.ListValue, ptr interface{}) error { + if pb == nil { + return errNilListValue("STRUCT") + } + // Type of the struct pointers stored in the slice that ptr points to. + ts := reflect.TypeOf(ptr).Elem().Elem() + // The slice that ptr points to, might be nil at this point. + v := reflect.ValueOf(ptr).Elem() + // Allocate empty slice. + v.Set(reflect.MakeSlice(v.Type(), 0, len(pb.Values))) + // Decode every struct in pb.Values. + for i, pv := range pb.Values { + // Check if pv is a NULL value. + if _, isNull := pv.Kind.(*proto3.Value_NullValue); isNull { + // Append a nil pointer to the slice. + v.Set(reflect.Append(v, reflect.New(ts).Elem())) + continue + } + // Allocate empty struct. + s := reflect.New(ts.Elem()) + // Get proto3.ListValue l from proto3.Value pv. + l, err := getListValue(pv) + if err != nil { + return errDecodeArrayElement(i, pv, "STRUCT", err) + } + // Decode proto3.ListValue l into struct referenced by s.Interface(). + if err = decodeStruct(ty, l, s.Interface()); err != nil { + return errDecodeArrayElement(i, pv, "STRUCT", err) + } + // Append the decoded struct back into the slice. + v.Set(reflect.Append(v, s)) + } + return nil +} + +// errEncoderUnsupportedType returns error for not being able to encode a value of +// certain type. +func errEncoderUnsupportedType(v interface{}) error { + return spannerErrorf(codes.InvalidArgument, "client doesn't support type %T", v) +} + +// encodeValue encodes a Go native type into a proto3.Value. +func encodeValue(v interface{}) (*proto3.Value, *sppb.Type, error) { + pb := &proto3.Value{ + Kind: &proto3.Value_NullValue{NullValue: proto3.NullValue_NULL_VALUE}, + } + var pt *sppb.Type + var err error + switch v := v.(type) { + case nil: + case string: + pb.Kind = stringKind(v) + pt = stringType() + case NullString: + if v.Valid { + return encodeValue(v.StringVal) + } + pt = stringType() + case []string: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(stringType()) + case []NullString: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(stringType()) + case []byte: + if v != nil { + pb.Kind = stringKind(base64.StdEncoding.EncodeToString(v)) + } + pt = bytesType() + case [][]byte: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(bytesType()) + case int: + pb.Kind = stringKind(strconv.FormatInt(int64(v), 10)) + pt = intType() + case []int: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(intType()) + case int64: + pb.Kind = stringKind(strconv.FormatInt(v, 10)) + pt = intType() + case []int64: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(intType()) + case NullInt64: + if v.Valid { + return encodeValue(v.Int64) + } + pt = intType() + case []NullInt64: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(intType()) + case bool: + pb.Kind = &proto3.Value_BoolValue{BoolValue: v} + pt = boolType() + case []bool: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(boolType()) + case NullBool: + if v.Valid { + return encodeValue(v.Bool) + } + pt = boolType() + case []NullBool: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(boolType()) + case float64: + pb.Kind = &proto3.Value_NumberValue{NumberValue: v} + pt = floatType() + case []float64: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(floatType()) + case NullFloat64: + if v.Valid { + return encodeValue(v.Float64) + } + pt = floatType() + case []NullFloat64: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(floatType()) + case time.Time: + if v == commitTimestamp { + pb.Kind = stringKind(commitTimestampPlaceholderString) + } else { + pb.Kind = stringKind(v.UTC().Format(time.RFC3339Nano)) + } + pt = timeType() + case []time.Time: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(timeType()) + case NullTime: + if v.Valid { + return encodeValue(v.Time) + } + pt = timeType() + case []NullTime: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(timeType()) + case civil.Date: + pb.Kind = stringKind(v.String()) + pt = dateType() + case []civil.Date: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(dateType()) + case NullDate: + if v.Valid { + return encodeValue(v.Date) + } + pt = dateType() + case []NullDate: + if v != nil { + pb, err = encodeArray(len(v), func(i int) interface{} { return v[i] }) + if err != nil { + return nil, nil, err + } + } + pt = listType(dateType()) + case GenericColumnValue: + // Deep clone to ensure subsequent changes to v before + // transmission don't affect our encoded value. + pb = proto.Clone(v.Value).(*proto3.Value) + pt = proto.Clone(v.Type).(*sppb.Type) + case []GenericColumnValue: + return nil, nil, errEncoderUnsupportedType(v) + default: + if !isStructOrArrayOfStructValue(v) { + return nil, nil, errEncoderUnsupportedType(v) + } + typ := reflect.TypeOf(v) + + // Value is a Go struct value/ptr. + if (typ.Kind() == reflect.Struct) || + (typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct) { + return encodeStruct(v) + } + + // Value is a slice of Go struct values/ptrs. + if typ.Kind() == reflect.Slice { + return encodeStructArray(v) + } + } + return pb, pt, nil +} + +// Encodes a Go struct value/ptr in v to the spanner Value and Type protos. v itself must +// be non-nil. +func encodeStruct(v interface{}) (*proto3.Value, *sppb.Type, error) { + typ := reflect.TypeOf(v) + val := reflect.ValueOf(v) + + // Pointer to struct. + if typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct { + typ = typ.Elem() + if val.IsNil() { + // nil pointer to struct, representing a NULL STRUCT value. Use a dummy value to + // get the type. + _, st, err := encodeStruct(reflect.Zero(typ).Interface()) + if err != nil { + return nil, nil, err + } + return nullProto(), st, nil + } + val = val.Elem() + } + + if typ.Kind() != reflect.Struct { + return nil, nil, errEncoderUnsupportedType(v) + } + + stf := make([]*sppb.StructType_Field, 0, typ.NumField()) + stv := make([]*proto3.Value, 0, typ.NumField()) + + for i := 0; i < typ.NumField(); i++ { + // If the field has a 'spanner' tag, use the value of that tag as the field name. + // This is used to build STRUCT types with unnamed/duplicate fields. + sf := typ.Field(i) + fval := val.Field(i) + + // Embedded fields are not allowed. + if sf.Anonymous { + return nil, nil, errUnsupportedEmbeddedStructFields(sf.Name) + } + + // Unexported fields are ignored. + if !fval.CanInterface() { + continue + } + + fname, ok := sf.Tag.Lookup("spanner") + if !ok { + fname = sf.Name + } + + eval, etype, err := encodeValue(fval.Interface()) + if err != nil { + return nil, nil, err + } + + stf = append(stf, mkField(fname, etype)) + stv = append(stv, eval) + } + + return listProto(stv...), structType(stf...), nil +} + +// Encodes a slice of Go struct values/ptrs in v to the spanner Value and Type protos. v itself +// must be non-nil. +func encodeStructArray(v interface{}) (*proto3.Value, *sppb.Type, error) { + etyp := reflect.TypeOf(v).Elem() + sliceval := reflect.ValueOf(v) + + // Slice of pointers to structs. + if etyp.Kind() == reflect.Ptr { + etyp = etyp.Elem() + } + + // Use a dummy struct value to get the element type + _, elemTyp, err := encodeStruct(reflect.Zero(etyp).Interface()) + if err != nil { + return nil, nil, err + } + + // nil slice represents a NULL array-of-struct. + if sliceval.IsNil() { + return nullProto(), listType(elemTyp), nil + } + + values := make([]*proto3.Value, 0, sliceval.Len()) + + for i := 0; i < sliceval.Len(); i++ { + ev, _, err := encodeStruct(sliceval.Index(i).Interface()) + if err != nil { + return nil, nil, err + } + values = append(values, ev) + } + return listProto(values...), listType(elemTyp), nil +} + +func isStructOrArrayOfStructValue(v interface{}) bool { + typ := reflect.TypeOf(v) + if typ.Kind() == reflect.Slice { + typ = typ.Elem() + } + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } + return typ.Kind() == reflect.Struct +} + +func isSupportedMutationType(v interface{}) bool { + switch v.(type) { + case nil, string, NullString, []string, []NullString, + []byte, [][]byte, + int, []int, int64, []int64, NullInt64, []NullInt64, + bool, []bool, NullBool, []NullBool, + float64, []float64, NullFloat64, []NullFloat64, + time.Time, []time.Time, NullTime, []NullTime, + civil.Date, []civil.Date, NullDate, []NullDate, + GenericColumnValue: + return true + default: + return false + } +} + +// encodeValueArray encodes a Value array into a proto3.ListValue. +func encodeValueArray(vs []interface{}) (*proto3.ListValue, error) { + lv := &proto3.ListValue{} + lv.Values = make([]*proto3.Value, 0, len(vs)) + for _, v := range vs { + if !isSupportedMutationType(v) { + return nil, errEncoderUnsupportedType(v) + } + pb, _, err := encodeValue(v) + if err != nil { + return nil, err + } + lv.Values = append(lv.Values, pb) + } + return lv, nil +} + +// encodeArray assumes that all values of the array element type encode without error. +func encodeArray(len int, at func(int) interface{}) (*proto3.Value, error) { + vs := make([]*proto3.Value, len) + var err error + for i := 0; i < len; i++ { + vs[i], _, err = encodeValue(at(i)) + if err != nil { + return nil, err + } + } + return listProto(vs...), nil +} + +func spannerTagParser(t reflect.StructTag) (name string, keep bool, other interface{}, err error) { + if s := t.Get("spanner"); s != "" { + if s == "-" { + return "", false, nil, nil + } + return s, true, nil, nil + } + return "", true, nil, nil +} + +var fieldCache = fields.NewCache(spannerTagParser, nil, nil) diff --git a/vendor/cloud.google.com/go/spanner/value_benchmarks_test.go b/vendor/cloud.google.com/go/spanner/value_benchmarks_test.go new file mode 100644 index 000000000..32ea2d7de --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/value_benchmarks_test.go @@ -0,0 +1,211 @@ +// Copyright 2017 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 spanner + +import ( + "reflect" + "strconv" + "testing" + + "cloud.google.com/go/civil" + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +func BenchmarkEncodeIntArray(b *testing.B) { + for _, s := range []struct { + name string + f func(a []int) (*proto3.Value, *sppb.Type, error) + }{ + {"Orig", encodeIntArrayOrig}, + {"Func", encodeIntArrayFunc}, + {"Reflect", encodeIntArrayReflect}, + } { + b.Run(s.name, func(b *testing.B) { + for _, size := range []int{1, 10, 100, 1000} { + a := make([]int, size) + b.Run(strconv.Itoa(size), func(b *testing.B) { + for i := 0; i < b.N; i++ { + s.f(a) + } + }) + } + }) + } +} + +func encodeIntArrayOrig(a []int) (*proto3.Value, *sppb.Type, error) { + vs := make([]*proto3.Value, len(a)) + var err error + for i := range a { + vs[i], _, err = encodeValue(a[i]) + if err != nil { + return nil, nil, err + } + } + return listProto(vs...), listType(intType()), nil +} + +func encodeIntArrayFunc(a []int) (*proto3.Value, *sppb.Type, error) { + v, err := encodeArray(len(a), func(i int) interface{} { return a[i] }) + if err != nil { + return nil, nil, err + } + return v, listType(intType()), nil +} + +func encodeIntArrayReflect(a []int) (*proto3.Value, *sppb.Type, error) { + v, err := encodeArrayReflect(a) + if err != nil { + return nil, nil, err + } + return v, listType(intType()), nil +} + +func encodeArrayReflect(a interface{}) (*proto3.Value, error) { + va := reflect.ValueOf(a) + len := va.Len() + vs := make([]*proto3.Value, len) + var err error + for i := 0; i < len; i++ { + vs[i], _, err = encodeValue(va.Index(i).Interface()) + if err != nil { + return nil, err + } + } + return listProto(vs...), nil +} + +func BenchmarkDecodeGeneric(b *testing.B) { + v := stringProto("test") + t := stringType() + var g GenericColumnValue + b.ResetTimer() + for i := 0; i < b.N; i++ { + decodeValue(v, t, &g) + } +} + +func BenchmarkDecodeArray(b *testing.B) { + for _, size := range []int{1, 10, 100, 1000} { + vals := make([]*proto3.Value, size) + for i := 0; i < size; i++ { + vals[i] = dateProto(d1) + } + lv := &proto3.ListValue{Values: vals} + b.Run(strconv.Itoa(size), func(b *testing.B) { + for _, s := range []struct { + name string + decode func(*proto3.ListValue) + }{ + {"DateDirect", decodeArrayDateDirect}, + {"DateFunc", decodeArrayDateFunc}, + {"DateReflect", decodeArrayDateReflect}, + {"StringDecodeStringArray", decodeStringArrayWrap}, + {"StringDirect", decodeArrayStringDirect}, + {"StringFunc", decodeArrayStringFunc}, + {"StringReflect", decodeArrayStringReflect}, + } { + b.Run(s.name, func(b *testing.B) { + for i := 0; i < b.N; i++ { + s.decode(lv) + } + }) + } + }) + + } +} + +func decodeArrayDateDirect(pb *proto3.ListValue) { + a := make([]civil.Date, len(pb.Values)) + t := dateType() + for i, v := range pb.Values { + if err := decodeValue(v, t, &a[i]); err != nil { + panic(err) + } + } +} + +func decodeArrayDateFunc(pb *proto3.ListValue) { + a := make([]civil.Date, len(pb.Values)) + if err := decodeArrayFunc(pb, "DATE", dateType(), func(i int) interface{} { return &a[i] }); err != nil { + panic(err) + } +} + +func decodeArrayDateReflect(pb *proto3.ListValue) { + var a []civil.Date + if err := decodeArrayReflect(pb, "DATE", dateType(), &a); err != nil { + panic(err) + } +} + +func decodeStringArrayWrap(pb *proto3.ListValue) { + if _, err := decodeStringArray(pb); err != nil { + panic(err) + } +} + +func decodeArrayStringDirect(pb *proto3.ListValue) { + a := make([]string, len(pb.Values)) + t := stringType() + for i, v := range pb.Values { + if err := decodeValue(v, t, &a[i]); err != nil { + panic(err) + } + } +} + +func decodeArrayStringFunc(pb *proto3.ListValue) { + a := make([]string, len(pb.Values)) + if err := decodeArrayFunc(pb, "STRING", stringType(), func(i int) interface{} { return &a[i] }); err != nil { + panic(err) + } +} + +func decodeArrayStringReflect(pb *proto3.ListValue) { + var a []string + if err := decodeArrayReflect(pb, "STRING", stringType(), &a); err != nil { + panic(err) + } +} + +func decodeArrayFunc(pb *proto3.ListValue, name string, typ *sppb.Type, elptr func(int) interface{}) error { + if pb == nil { + return errNilListValue(name) + } + for i, v := range pb.Values { + if err := decodeValue(v, typ, elptr(i)); err != nil { + return errDecodeArrayElement(i, v, name, err) + } + } + return nil +} + +func decodeArrayReflect(pb *proto3.ListValue, name string, typ *sppb.Type, aptr interface{}) error { + if pb == nil { + return errNilListValue(name) + } + av := reflect.ValueOf(aptr).Elem() + av.Set(reflect.MakeSlice(av.Type(), len(pb.Values), len(pb.Values))) + for i, v := range pb.Values { + if err := decodeValue(v, typ, av.Index(i).Addr().Interface()); err != nil { + av.Set(reflect.Zero(av.Type())) // reset slice to nil + return errDecodeArrayElement(i, v, name, err) + } + } + return nil +} diff --git a/vendor/cloud.google.com/go/spanner/value_test.go b/vendor/cloud.google.com/go/spanner/value_test.go new file mode 100644 index 000000000..4e114220d --- /dev/null +++ b/vendor/cloud.google.com/go/spanner/value_test.go @@ -0,0 +1,1564 @@ +/* +Copyright 2017 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 spanner + +import ( + "context" + "math" + "reflect" + "testing" + "time" + + "cloud.google.com/go/civil" + proto "github.com/golang/protobuf/proto" + proto3 "github.com/golang/protobuf/ptypes/struct" + sppb "google.golang.org/genproto/googleapis/spanner/v1" +) + +var ( + t1 = mustParseTime("2016-11-15T15:04:05.999999999Z") + // Boundaries + t2 = mustParseTime("0000-01-01T00:00:00.000000000Z") + t3 = mustParseTime("9999-12-31T23:59:59.999999999Z") + // Local timezone + t4 = time.Now() + d1 = mustParseDate("2016-11-15") + d2 = mustParseDate("1678-01-01") +) + +func mustParseTime(s string) time.Time { + t, err := time.Parse(time.RFC3339Nano, s) + if err != nil { + panic(err) + } + return t +} + +func mustParseDate(s string) civil.Date { + d, err := civil.ParseDate(s) + if err != nil { + panic(err) + } + return d +} + +// Test encoding Values. +func TestEncodeValue(t *testing.T) { + var ( + tString = stringType() + tInt = intType() + tBool = boolType() + tFloat = floatType() + tBytes = bytesType() + tTime = timeType() + tDate = dateType() + ) + for i, test := range []struct { + in interface{} + want *proto3.Value + wantType *sppb.Type + }{ + // STRING / STRING ARRAY + {"abc", stringProto("abc"), tString}, + {NullString{"abc", true}, stringProto("abc"), tString}, + {NullString{"abc", false}, nullProto(), tString}, + {[]string(nil), nullProto(), listType(tString)}, + {[]string{"abc", "bcd"}, listProto(stringProto("abc"), stringProto("bcd")), listType(tString)}, + {[]NullString{{"abcd", true}, {"xyz", false}}, listProto(stringProto("abcd"), nullProto()), listType(tString)}, + // BYTES / BYTES ARRAY + {[]byte("foo"), bytesProto([]byte("foo")), tBytes}, + {[]byte(nil), nullProto(), tBytes}, + {[][]byte{nil, []byte("ab")}, listProto(nullProto(), bytesProto([]byte("ab"))), listType(tBytes)}, + {[][]byte(nil), nullProto(), listType(tBytes)}, + // INT64 / INT64 ARRAY + {7, intProto(7), tInt}, + {[]int(nil), nullProto(), listType(tInt)}, + {[]int{31, 127}, listProto(intProto(31), intProto(127)), listType(tInt)}, + {int64(81), intProto(81), tInt}, + {[]int64(nil), nullProto(), listType(tInt)}, + {[]int64{33, 129}, listProto(intProto(33), intProto(129)), listType(tInt)}, + {NullInt64{11, true}, intProto(11), tInt}, + {NullInt64{11, false}, nullProto(), tInt}, + {[]NullInt64{{35, true}, {131, false}}, listProto(intProto(35), nullProto()), listType(tInt)}, + // BOOL / BOOL ARRAY + {true, boolProto(true), tBool}, + {NullBool{true, true}, boolProto(true), tBool}, + {NullBool{true, false}, nullProto(), tBool}, + {[]bool{true, false}, listProto(boolProto(true), boolProto(false)), listType(tBool)}, + {[]NullBool{{true, true}, {true, false}}, listProto(boolProto(true), nullProto()), listType(tBool)}, + // FLOAT64 / FLOAT64 ARRAY + {3.14, floatProto(3.14), tFloat}, + {NullFloat64{3.1415, true}, floatProto(3.1415), tFloat}, + {NullFloat64{math.Inf(1), true}, floatProto(math.Inf(1)), tFloat}, + {NullFloat64{3.14159, false}, nullProto(), tFloat}, + {[]float64(nil), nullProto(), listType(tFloat)}, + {[]float64{3.141, 0.618, math.Inf(-1)}, listProto(floatProto(3.141), floatProto(0.618), floatProto(math.Inf(-1))), listType(tFloat)}, + {[]NullFloat64{{3.141, true}, {0.618, false}}, listProto(floatProto(3.141), nullProto()), listType(tFloat)}, + // TIMESTAMP / TIMESTAMP ARRAY + {t1, timeProto(t1), tTime}, + {NullTime{t1, true}, timeProto(t1), tTime}, + {NullTime{t1, false}, nullProto(), tTime}, + {[]time.Time(nil), nullProto(), listType(tTime)}, + {[]time.Time{t1, t2, t3, t4}, listProto(timeProto(t1), timeProto(t2), timeProto(t3), timeProto(t4)), listType(tTime)}, + {[]NullTime{{t1, true}, {t1, false}}, listProto(timeProto(t1), nullProto()), listType(tTime)}, + // DATE / DATE ARRAY + {d1, dateProto(d1), tDate}, + {NullDate{d1, true}, dateProto(d1), tDate}, + {NullDate{civil.Date{}, false}, nullProto(), tDate}, + {[]civil.Date(nil), nullProto(), listType(tDate)}, + {[]civil.Date{d1, d2}, listProto(dateProto(d1), dateProto(d2)), listType(tDate)}, + {[]NullDate{{d1, true}, {civil.Date{}, false}}, listProto(dateProto(d1), nullProto()), listType(tDate)}, + // GenericColumnValue + {GenericColumnValue{tString, stringProto("abc")}, stringProto("abc"), tString}, + {GenericColumnValue{tString, nullProto()}, nullProto(), tString}, + // not actually valid (stringProto inside int list), but demonstrates pass-through. + { + GenericColumnValue{ + Type: listType(tInt), + Value: listProto(intProto(5), nullProto(), stringProto("bcd")), + }, + listProto(intProto(5), nullProto(), stringProto("bcd")), + listType(tInt), + }, + // placeholder + {CommitTimestamp, stringProto(commitTimestampPlaceholderString), tTime}, + } { + got, gotType, err := encodeValue(test.in) + if err != nil { + t.Fatalf("#%d: got error during encoding: %v, want nil", i, err) + } + if !testEqual(got, test.want) { + t.Errorf("#%d: got encode result: %v, want %v", i, got, test.want) + } + if !testEqual(gotType, test.wantType) { + t.Errorf("#%d: got encode type: %v, want %v", i, gotType, test.wantType) + } + } +} + +type encodeTest struct { + desc string + in interface{} + want *proto3.Value + wantType *sppb.Type +} + +func checkStructEncoding(desc string, got *proto3.Value, gotType *sppb.Type, + want *proto3.Value, wantType *sppb.Type, t *testing.T) { + if !testEqual(got, want) { + t.Errorf("Test %s: got encode result: %v, want %v", desc, got, want) + } + if !testEqual(gotType, wantType) { + t.Errorf("Test %s: got encode type: %v, want %v", desc, gotType, wantType) + } +} + +// Testcase code +func encodeStructValue(test encodeTest, t *testing.T) { + got, gotType, err := encodeValue(test.in) + if err != nil { + t.Fatalf("Test %s: got error during encoding: %v, want nil", test.desc, err) + } + checkStructEncoding(test.desc, got, gotType, test.want, test.wantType, t) +} + +func TestEncodeStructValuePointers(t *testing.T) { + type structf struct { + F int `spanner:"ff2"` + } + nestedStructProto := structType(mkField("ff2", intType())) + + type testType struct { + Stringf string + Structf *structf + ArrStructf []*structf + } + testTypeProto := structType( + mkField("Stringf", stringType()), + mkField("Structf", nestedStructProto), + mkField("ArrStructf", listType(nestedStructProto))) + + for _, test := range []encodeTest{ + { + "Pointer to Go struct with pointers-to-(array)-struct fields.", + &testType{"hello", &structf{50}, []*structf{{30}, {40}}}, + listProto( + stringProto("hello"), + listProto(intProto(50)), + listProto( + listProto(intProto(30)), + listProto(intProto(40)))), + testTypeProto, + }, + { + "Nil pointer to Go struct representing a NULL struct value.", + (*testType)(nil), + nullProto(), + testTypeProto, + }, + { + "Slice of pointers to Go structs with NULL and non-NULL elements.", + []*testType{ + (*testType)(nil), + {"hello", nil, []*structf{nil, {40}}}, + {"world", &structf{70}, nil}, + }, + listProto( + nullProto(), + listProto( + stringProto("hello"), + nullProto(), + listProto(nullProto(), listProto(intProto(40)))), + listProto( + stringProto("world"), + listProto(intProto(70)), + nullProto())), + listType(testTypeProto), + }, + { + "Nil slice of pointers to structs representing a NULL array of structs.", + []*testType(nil), + nullProto(), + listType(testTypeProto), + }, + { + "Empty slice of pointers to structs representing an empty array of structs.", + []*testType{}, + listProto(), + listType(testTypeProto), + }, + } { + encodeStructValue(test, t) + } +} + +func TestEncodeStructValueErrors(t *testing.T) { + type Embedded struct { + A int + } + type embedded struct { + B bool + } + x := 0 + + for _, test := range []struct { + desc string + in interface{} + wantErr error + }{ + { + "Unsupported embedded fields.", + struct{ Embedded }{Embedded{10}}, + errUnsupportedEmbeddedStructFields("Embedded"), + }, + { + "Unsupported pointer to embedded fields.", + struct{ *Embedded }{&Embedded{10}}, + errUnsupportedEmbeddedStructFields("Embedded"), + }, + { + "Unsupported embedded + unexported fields.", + struct { + int + *bool + embedded + }{10, nil, embedded{false}}, + errUnsupportedEmbeddedStructFields("int"), + }, + { + "Unsupported type.", + (**struct{})(nil), + errEncoderUnsupportedType((**struct{})(nil)), + }, + { + "Unsupported type.", + 3, + errEncoderUnsupportedType(3), + }, + { + "Unsupported type.", + &x, + errEncoderUnsupportedType(&x), + }, + } { + _, _, got := encodeStruct(test.in) + if got == nil || !testEqual(test.wantErr, got) { + t.Errorf("Test: %s, expected error %v during decoding, got %v", test.desc, test.wantErr, got) + } + } +} + +func TestEncodeStructValueArrayStructFields(t *testing.T) { + type structf struct { + Intff int + } + + structfType := structType(mkField("Intff", intType())) + for _, test := range []encodeTest{ + { + "Unnamed array-of-struct-typed field.", + struct { + Intf int + ArrStructf []structf `spanner:""` + }{10, []structf{{1}, {2}}}, + listProto( + intProto(10), + listProto( + listProto(intProto(1)), + listProto(intProto(2)))), + structType( + mkField("Intf", intType()), + mkField("", listType(structfType))), + }, + { + "Null array-of-struct-typed field.", + struct { + Intf int + ArrStructf []structf + }{10, []structf(nil)}, + listProto(intProto(10), nullProto()), + structType( + mkField("Intf", intType()), + mkField("ArrStructf", listType(structfType))), + }, + { + "Array-of-struct-typed field representing empty array.", + struct { + Intf int + ArrStructf []structf + }{10, []structf{}}, + listProto(intProto(10), listProto([]*proto3.Value{}...)), + structType( + mkField("Intf", intType()), + mkField("ArrStructf", listType(structfType))), + }, + { + "Array-of-struct-typed field with nullable struct elements.", + struct { + Intf int + ArrStructf []*structf + }{ + 10, + []*structf{(*structf)(nil), {1}}, + }, + listProto( + intProto(10), + listProto( + nullProto(), + listProto(intProto(1)))), + structType( + mkField("Intf", intType()), + mkField("ArrStructf", listType(structfType))), + }, + } { + encodeStructValue(test, t) + } +} + +func TestEncodeStructValueStructFields(t *testing.T) { + type structf struct { + Intff int + } + structfType := structType(mkField("Intff", intType())) + for _, test := range []encodeTest{ + { + "Named struct-type field.", + struct { + Intf int + Structf structf + }{10, structf{10}}, + listProto(intProto(10), listProto(intProto(10))), + structType( + mkField("Intf", intType()), + mkField("Structf", structfType)), + }, + { + "Unnamed struct-type field.", + struct { + Intf int + Structf structf `spanner:""` + }{10, structf{10}}, + listProto(intProto(10), listProto(intProto(10))), + structType( + mkField("Intf", intType()), + mkField("", structfType)), + }, + { + "Duplicate struct-typed field.", + struct { + Structf1 structf `spanner:""` + Structf2 structf `spanner:""` + }{structf{10}, structf{20}}, + listProto(listProto(intProto(10)), listProto(intProto(20))), + structType( + mkField("", structfType), + mkField("", structfType)), + }, + { + "Null struct-typed field.", + struct { + Intf int + Structf *structf + }{10, nil}, + listProto(intProto(10), nullProto()), + structType( + mkField("Intf", intType()), + mkField("Structf", structfType)), + }, + { + "Empty struct-typed field.", + struct { + Intf int + Structf struct{} + }{10, struct{}{}}, + listProto(intProto(10), listProto([]*proto3.Value{}...)), + structType( + mkField("Intf", intType()), + mkField("Structf", structType([]*sppb.StructType_Field{}...))), + }, + } { + encodeStructValue(test, t) + } +} + +func TestEncodeStructValueFieldNames(t *testing.T) { + type embedded struct { + B bool + } + + for _, test := range []encodeTest{ + { + "Duplicate fields.", + struct { + Field1 int `spanner:"field"` + DupField1 int `spanner:"field"` + }{10, 20}, + listProto(intProto(10), intProto(20)), + structType( + mkField("field", intType()), + mkField("field", intType())), + }, + { + "Duplicate Fields (different types).", + struct { + IntField int `spanner:"field"` + StringField string `spanner:"field"` + }{10, "abc"}, + listProto(intProto(10), stringProto("abc")), + structType( + mkField("field", intType()), + mkField("field", stringType())), + }, + { + "Duplicate unnamed fields.", + struct { + Dup int `spanner:""` + Dup1 int `spanner:""` + }{10, 20}, + listProto(intProto(10), intProto(20)), + structType( + mkField("", intType()), + mkField("", intType())), + }, + { + "Named and unnamed fields.", + struct { + Field string + Field1 int `spanner:""` + Field2 string `spanner:"field"` + }{"abc", 10, "def"}, + listProto(stringProto("abc"), intProto(10), stringProto("def")), + structType( + mkField("Field", stringType()), + mkField("", intType()), + mkField("field", stringType())), + }, + { + "Ignored unexported fields.", + struct { + Field int + field bool + Field1 string `spanner:"field"` + }{10, false, "abc"}, + listProto(intProto(10), stringProto("abc")), + structType( + mkField("Field", intType()), + mkField("field", stringType())), + }, + { + "Ignored unexported struct/slice fields.", + struct { + a []*embedded + b []embedded + c embedded + d *embedded + Field1 string `spanner:"field"` + }{nil, nil, embedded{}, nil, "def"}, + listProto(stringProto("def")), + structType( + mkField("field", stringType())), + }, + } { + encodeStructValue(test, t) + } +} + +func TestEncodeStructValueBasicFields(t *testing.T) { + StructTypeProto := structType( + mkField("Stringf", stringType()), + mkField("Intf", intType()), + mkField("Boolf", boolType()), + mkField("Floatf", floatType()), + mkField("Bytef", bytesType()), + mkField("Timef", timeType()), + mkField("Datef", dateType())) + + for _, test := range []encodeTest{ + { + "Basic types.", + struct { + Stringf string + Intf int + Boolf bool + Floatf float64 + Bytef []byte + Timef time.Time + Datef civil.Date + }{"abc", 300, false, 3.45, []byte("foo"), t1, d1}, + listProto( + stringProto("abc"), + intProto(300), + boolProto(false), + floatProto(3.45), + bytesProto([]byte("foo")), + timeProto(t1), + dateProto(d1)), + StructTypeProto, + }, + { + "Basic types null values.", + struct { + Stringf NullString + Intf NullInt64 + Boolf NullBool + Floatf NullFloat64 + Bytef []byte + Timef NullTime + Datef NullDate + }{ + NullString{"abc", false}, + NullInt64{4, false}, + NullBool{false, false}, + NullFloat64{5.6, false}, + nil, + NullTime{t1, false}, + NullDate{d1, false}, + }, + listProto( + nullProto(), + nullProto(), + nullProto(), + nullProto(), + nullProto(), + nullProto(), + nullProto()), + StructTypeProto, + }, + } { + encodeStructValue(test, t) + } +} + +func TestEncodeStructValueArrayFields(t *testing.T) { + StructTypeProto := structType( + mkField("Stringf", listType(stringType())), + mkField("Intf", listType(intType())), + mkField("Int64f", listType(intType())), + mkField("Boolf", listType(boolType())), + mkField("Floatf", listType(floatType())), + mkField("Bytef", listType(bytesType())), + mkField("Timef", listType(timeType())), + mkField("Datef", listType(dateType()))) + + for _, test := range []encodeTest{ + { + "Arrays of basic types with non-nullable elements", + struct { + Stringf []string + Intf []int + Int64f []int64 + Boolf []bool + Floatf []float64 + Bytef [][]byte + Timef []time.Time + Datef []civil.Date + }{ + []string{"abc", "def"}, + []int{4, 67}, + []int64{5, 68}, + []bool{false, true}, + []float64{3.45, 0.93}, + [][]byte{[]byte("foo"), nil}, + []time.Time{t1, t2}, + []civil.Date{d1, d2}, + }, + listProto( + listProto(stringProto("abc"), stringProto("def")), + listProto(intProto(4), intProto(67)), + listProto(intProto(5), intProto(68)), + listProto(boolProto(false), boolProto(true)), + listProto(floatProto(3.45), floatProto(0.93)), + listProto(bytesProto([]byte("foo")), nullProto()), + listProto(timeProto(t1), timeProto(t2)), + listProto(dateProto(d1), dateProto(d2))), + StructTypeProto, + }, + { + "Arrays of basic types with nullable elements.", + struct { + Stringf []NullString + Intf []NullInt64 + Int64f []NullInt64 + Boolf []NullBool + Floatf []NullFloat64 + Bytef [][]byte + Timef []NullTime + Datef []NullDate + }{ + []NullString{{"abc", false}, {"def", true}}, + []NullInt64{{4, false}, {67, true}}, + []NullInt64{{5, false}, {68, true}}, + []NullBool{{true, false}, {false, true}}, + []NullFloat64{{3.45, false}, {0.93, true}}, + [][]byte{[]byte("foo"), nil}, + []NullTime{{t1, false}, {t2, true}}, + []NullDate{{d1, false}, {d2, true}}, + }, + listProto( + listProto(nullProto(), stringProto("def")), + listProto(nullProto(), intProto(67)), + listProto(nullProto(), intProto(68)), + listProto(nullProto(), boolProto(false)), + listProto(nullProto(), floatProto(0.93)), + listProto(bytesProto([]byte("foo")), nullProto()), + listProto(nullProto(), timeProto(t2)), + listProto(nullProto(), dateProto(d2))), + StructTypeProto, + }, + { + "Null arrays of basic types.", + struct { + Stringf []NullString + Intf []NullInt64 + Int64f []NullInt64 + Boolf []NullBool + Floatf []NullFloat64 + Bytef [][]byte + Timef []NullTime + Datef []NullDate + }{ + nil, + nil, + nil, + nil, + nil, + nil, + nil, + nil, + }, + listProto( + nullProto(), + nullProto(), + nullProto(), + nullProto(), + nullProto(), + nullProto(), + nullProto(), + nullProto()), + StructTypeProto, + }, + } { + encodeStructValue(test, t) + } +} + +// Test decoding Values. +func TestDecodeValue(t *testing.T) { + for i, test := range []struct { + in *proto3.Value + t *sppb.Type + want interface{} + fail bool + }{ + // STRING + {stringProto("abc"), stringType(), "abc", false}, + {nullProto(), stringType(), "abc", true}, + {stringProto("abc"), stringType(), NullString{"abc", true}, false}, + {nullProto(), stringType(), NullString{}, false}, + // STRING ARRAY with []NullString + { + listProto(stringProto("abc"), nullProto(), stringProto("bcd")), + listType(stringType()), + []NullString{{"abc", true}, {}, {"bcd", true}}, + false, + }, + {nullProto(), listType(stringType()), []NullString(nil), false}, + // STRING ARRAY with []string + { + listProto(stringProto("abc"), stringProto("bcd")), + listType(stringType()), + []string{"abc", "bcd"}, + false, + }, + // BYTES + {bytesProto([]byte("ab")), bytesType(), []byte("ab"), false}, + {nullProto(), bytesType(), []byte(nil), false}, + // BYTES ARRAY + {listProto(bytesProto([]byte("ab")), nullProto()), listType(bytesType()), [][]byte{[]byte("ab"), nil}, false}, + {nullProto(), listType(bytesType()), [][]byte(nil), false}, + //INT64 + {intProto(15), intType(), int64(15), false}, + {nullProto(), intType(), int64(0), true}, + {intProto(15), intType(), NullInt64{15, true}, false}, + {nullProto(), intType(), NullInt64{}, false}, + // INT64 ARRAY with []NullInt64 + {listProto(intProto(91), nullProto(), intProto(87)), listType(intType()), []NullInt64{{91, true}, {}, {87, true}}, false}, + {nullProto(), listType(intType()), []NullInt64(nil), false}, + // INT64 ARRAY with []int64 + {listProto(intProto(91), intProto(87)), listType(intType()), []int64{91, 87}, false}, + // BOOL + {boolProto(true), boolType(), true, false}, + {nullProto(), boolType(), true, true}, + {boolProto(true), boolType(), NullBool{true, true}, false}, + {nullProto(), boolType(), NullBool{}, false}, + // BOOL ARRAY with []NullBool + {listProto(boolProto(true), boolProto(false), nullProto()), listType(boolType()), []NullBool{{true, true}, {false, true}, {}}, false}, + {nullProto(), listType(boolType()), []NullBool(nil), false}, + // BOOL ARRAY with []bool + {listProto(boolProto(true), boolProto(false)), listType(boolType()), []bool{true, false}, false}, + // FLOAT64 + {floatProto(3.14), floatType(), 3.14, false}, + {nullProto(), floatType(), 0.00, true}, + {floatProto(3.14), floatType(), NullFloat64{3.14, true}, false}, + {nullProto(), floatType(), NullFloat64{}, false}, + // FLOAT64 ARRAY with []NullFloat64 + { + listProto(floatProto(math.Inf(1)), floatProto(math.Inf(-1)), nullProto(), floatProto(3.1)), + listType(floatType()), + []NullFloat64{{math.Inf(1), true}, {math.Inf(-1), true}, {}, {3.1, true}}, + false, + }, + {nullProto(), listType(floatType()), []NullFloat64(nil), false}, + // FLOAT64 ARRAY with []float64 + { + listProto(floatProto(math.Inf(1)), floatProto(math.Inf(-1)), floatProto(3.1)), + listType(floatType()), + []float64{math.Inf(1), math.Inf(-1), 3.1}, + false, + }, + // TIMESTAMP + {timeProto(t1), timeType(), t1, false}, + {timeProto(t1), timeType(), NullTime{t1, true}, false}, + {nullProto(), timeType(), NullTime{}, false}, + // TIMESTAMP ARRAY with []NullTime + {listProto(timeProto(t1), timeProto(t2), timeProto(t3), nullProto()), listType(timeType()), []NullTime{{t1, true}, {t2, true}, {t3, true}, {}}, false}, + {nullProto(), listType(timeType()), []NullTime(nil), false}, + // TIMESTAMP ARRAY with []time.Time + {listProto(timeProto(t1), timeProto(t2), timeProto(t3)), listType(timeType()), []time.Time{t1, t2, t3}, false}, + // DATE + {dateProto(d1), dateType(), d1, false}, + {dateProto(d1), dateType(), NullDate{d1, true}, false}, + {nullProto(), dateType(), NullDate{}, false}, + // DATE ARRAY with []NullDate + {listProto(dateProto(d1), dateProto(d2), nullProto()), listType(dateType()), []NullDate{{d1, true}, {d2, true}, {}}, false}, + {nullProto(), listType(dateType()), []NullDate(nil), false}, + // DATE ARRAY with []civil.Date + {listProto(dateProto(d1), dateProto(d2)), listType(dateType()), []civil.Date{d1, d2}, false}, + // STRUCT ARRAY + // STRUCT schema is equal to the following Go struct: + // type s struct { + // Col1 NullInt64 + // Col2 []struct { + // SubCol1 float64 + // SubCol2 string + // } + // } + { + in: listProto( + listProto( + intProto(3), + listProto( + listProto(floatProto(3.14), stringProto("this")), + listProto(floatProto(0.57), stringProto("siht")), + ), + ), + listProto( + nullProto(), + nullProto(), + ), + nullProto(), + ), + t: listType( + structType( + mkField("Col1", intType()), + mkField( + "Col2", + listType( + structType( + mkField("SubCol1", floatType()), + mkField("SubCol2", stringType()), + ), + ), + ), + ), + ), + want: []NullRow{ + { + Row: Row{ + fields: []*sppb.StructType_Field{ + mkField("Col1", intType()), + mkField( + "Col2", + listType( + structType( + mkField("SubCol1", floatType()), + mkField("SubCol2", stringType()), + ), + ), + ), + }, + vals: []*proto3.Value{ + intProto(3), + listProto( + listProto(floatProto(3.14), stringProto("this")), + listProto(floatProto(0.57), stringProto("siht")), + ), + }, + }, + Valid: true, + }, + { + Row: Row{ + fields: []*sppb.StructType_Field{ + mkField("Col1", intType()), + mkField( + "Col2", + listType( + structType( + mkField("SubCol1", floatType()), + mkField("SubCol2", stringType()), + ), + ), + ), + }, + vals: []*proto3.Value{ + nullProto(), + nullProto(), + }, + }, + Valid: true, + }, + {}, + }, + fail: false, + }, + { + in: listProto( + listProto( + intProto(3), + listProto( + listProto(floatProto(3.14), stringProto("this")), + listProto(floatProto(0.57), stringProto("siht")), + ), + ), + listProto( + nullProto(), + nullProto(), + ), + nullProto(), + ), + t: listType( + structType( + mkField("Col1", intType()), + mkField( + "Col2", + listType( + structType( + mkField("SubCol1", floatType()), + mkField("SubCol2", stringType()), + ), + ), + ), + ), + ), + want: []*struct { + Col1 NullInt64 + StructCol []*struct { + SubCol1 NullFloat64 + SubCol2 string + } `spanner:"Col2"` + }{ + { + Col1: NullInt64{3, true}, + StructCol: []*struct { + SubCol1 NullFloat64 + SubCol2 string + }{ + { + SubCol1: NullFloat64{3.14, true}, + SubCol2: "this", + }, + { + SubCol1: NullFloat64{0.57, true}, + SubCol2: "siht", + }, + }, + }, + { + Col1: NullInt64{}, + StructCol: []*struct { + SubCol1 NullFloat64 + SubCol2 string + }(nil), + }, + nil, + }, + fail: false, + }, + // GenericColumnValue + {stringProto("abc"), stringType(), GenericColumnValue{stringType(), stringProto("abc")}, false}, + {nullProto(), stringType(), GenericColumnValue{stringType(), nullProto()}, false}, + // not actually valid (stringProto inside int list), but demonstrates pass-through. + { + in: listProto(intProto(5), nullProto(), stringProto("bcd")), + t: listType(intType()), + want: GenericColumnValue{ + Type: listType(intType()), + Value: listProto(intProto(5), nullProto(), stringProto("bcd")), + }, + fail: false, + }, + } { + gotp := reflect.New(reflect.TypeOf(test.want)) + if err := decodeValue(test.in, test.t, gotp.Interface()); err != nil { + if !test.fail { + t.Errorf("%d: cannot decode %v(%v): %v", i, test.in, test.t, err) + } + continue + } + if test.fail { + t.Errorf("%d: decoding %v(%v) succeeds unexpectedly, want error", i, test.in, test.t) + continue + } + got := reflect.Indirect(gotp).Interface() + if !testEqual(got, test.want) { + t.Errorf("%d: unexpected decoding result - got %v, want %v", i, got, test.want) + continue + } + } +} + +// Test error cases for decodeValue. +func TestDecodeValueErrors(t *testing.T) { + var s string + for i, test := range []struct { + in *proto3.Value + t *sppb.Type + v interface{} + }{ + {nullProto(), stringType(), nil}, + {nullProto(), stringType(), 1}, + {timeProto(t1), timeType(), &s}, + } { + err := decodeValue(test.in, test.t, test.v) + if err == nil { + t.Errorf("#%d: want error, got nil", i) + } + } +} + +// Test NaN encoding/decoding. +func TestNaN(t *testing.T) { + // Decode NaN value. + f := 0.0 + nf := NullFloat64{} + // To float64 + if err := decodeValue(floatProto(math.NaN()), floatType(), &f); err != nil { + t.Errorf("decodeValue returns %q for %v, want nil", err, floatProto(math.NaN())) + } + if !math.IsNaN(f) { + t.Errorf("f = %v, want %v", f, math.NaN()) + } + // To NullFloat64 + if err := decodeValue(floatProto(math.NaN()), floatType(), &nf); err != nil { + t.Errorf("decodeValue returns %q for %v, want nil", err, floatProto(math.NaN())) + } + if !math.IsNaN(nf.Float64) || !nf.Valid { + t.Errorf("f = %v, want %v", f, NullFloat64{math.NaN(), true}) + } + // Encode NaN value + // From float64 + v, _, err := encodeValue(math.NaN()) + if err != nil { + t.Errorf("encodeValue returns %q for NaN, want nil", err) + } + x, ok := v.GetKind().(*proto3.Value_NumberValue) + if !ok { + t.Errorf("incorrect type for v.GetKind(): %T, want *proto3.Value_NumberValue", v.GetKind()) + } + if !math.IsNaN(x.NumberValue) { + t.Errorf("x.NumberValue = %v, want %v", x.NumberValue, math.NaN()) + } + // From NullFloat64 + v, _, err = encodeValue(NullFloat64{math.NaN(), true}) + if err != nil { + t.Errorf("encodeValue returns %q for NaN, want nil", err) + } + x, ok = v.GetKind().(*proto3.Value_NumberValue) + if !ok { + t.Errorf("incorrect type for v.GetKind(): %T, want *proto3.Value_NumberValue", v.GetKind()) + } + if !math.IsNaN(x.NumberValue) { + t.Errorf("x.NumberValue = %v, want %v", x.NumberValue, math.NaN()) + } +} + +func TestGenericColumnValue(t *testing.T) { + for _, test := range []struct { + in GenericColumnValue + want interface{} + fail bool + }{ + {GenericColumnValue{stringType(), stringProto("abc")}, "abc", false}, + {GenericColumnValue{stringType(), stringProto("abc")}, 5, true}, + {GenericColumnValue{listType(intType()), listProto(intProto(91), nullProto(), intProto(87))}, []NullInt64{{91, true}, {}, {87, true}}, false}, + {GenericColumnValue{intType(), intProto(42)}, GenericColumnValue{intType(), intProto(42)}, false}, // trippy! :-) + } { + gotp := reflect.New(reflect.TypeOf(test.want)) + if err := test.in.Decode(gotp.Interface()); err != nil { + if !test.fail { + t.Errorf("cannot decode %v to %v: %v", test.in, test.want, err) + } + continue + } + if test.fail { + t.Errorf("decoding %v to %v succeeds unexpectedly", test.in, test.want) + } + + // Test we can go backwards as well. + v, err := newGenericColumnValue(test.want) + if err != nil { + t.Errorf("NewGenericColumnValue failed: %v", err) + continue + } + if !testEqual(*v, test.in) { + t.Errorf("unexpected encode result - got %v, want %v", v, test.in) + } + } +} + +func TestDecodeStruct(t *testing.T) { + stype := &sppb.StructType{Fields: []*sppb.StructType_Field{ + {Name: "Id", Type: stringType()}, + {Name: "Time", Type: timeType()}, + }} + lv := listValueProto(stringProto("id"), timeProto(t1)) + + type ( + S1 struct { + ID string + Time time.Time + } + S2 struct { + ID string + Time string + } + ) + var ( + s1 S1 + s2 S2 + ) + + for i, test := range []struct { + ptr interface{} + want interface{} + fail bool + }{ + { + ptr: &s1, + want: &S1{ID: "id", Time: t1}, + }, + { + ptr: &s2, + fail: true, + }, + } { + err := decodeStruct(stype, lv, test.ptr) + if (err != nil) != test.fail { + t.Errorf("#%d: got error %v, wanted fail: %v", i, err, test.fail) + } + if err == nil && !testEqual(test.ptr, test.want) { + t.Errorf("#%d: got %+v, want %+v", i, test.ptr, test.want) + } + } +} + +func TestEncodeStructValueDynamicStructs(t *testing.T) { + dynStructType := reflect.StructOf([]reflect.StructField{ + {Name: "A", Type: reflect.TypeOf(0), Tag: `spanner:"a"`}, + {Name: "B", Type: reflect.TypeOf(""), Tag: `spanner:"b"`}, + }) + dynNullableStructType := reflect.PtrTo(dynStructType) + dynStructArrType := reflect.SliceOf(dynStructType) + dynNullableStructArrType := reflect.SliceOf(dynNullableStructType) + + dynStructValue := reflect.New(dynStructType) + dynStructValue.Elem().Field(0).SetInt(10) + dynStructValue.Elem().Field(1).SetString("abc") + + dynStructArrValue := reflect.MakeSlice(dynNullableStructArrType, 2, 2) + dynStructArrValue.Index(0).Set(reflect.Zero(dynNullableStructType)) + dynStructArrValue.Index(1).Set(dynStructValue) + + structProtoType := structType( + mkField("a", intType()), + mkField("b", stringType())) + + arrProtoType := listType(structProtoType) + + for _, test := range []encodeTest{ + { + "Dynanic non-NULL struct value.", + dynStructValue.Elem().Interface(), + listProto(intProto(10), stringProto("abc")), + structProtoType, + }, + { + "Dynanic NULL struct value.", + reflect.Zero(dynNullableStructType).Interface(), + nullProto(), + structProtoType, + }, + { + "Empty array of dynamic structs.", + reflect.MakeSlice(dynStructArrType, 0, 0).Interface(), + listProto([]*proto3.Value{}...), + arrProtoType, + }, + { + "NULL array of non-NULL-able dynamic structs.", + reflect.Zero(dynStructArrType).Interface(), + nullProto(), + arrProtoType, + }, + { + "NULL array of NULL-able(nil) dynamic structs.", + reflect.Zero(dynNullableStructArrType).Interface(), + nullProto(), + arrProtoType, + }, + { + "Array containing NULL(nil) dynamic-typed struct elements.", + dynStructArrValue.Interface(), + listProto( + nullProto(), + listProto(intProto(10), stringProto("abc"))), + arrProtoType, + }, + } { + encodeStructValue(test, t) + } +} + +func TestEncodeStructValueEmptyStruct(t *testing.T) { + emptyListValue := listProto([]*proto3.Value{}...) + emptyStructType := structType([]*sppb.StructType_Field{}...) + emptyStruct := struct{}{} + nullEmptyStruct := (*struct{})(nil) + + dynamicEmptyStructType := reflect.StructOf(make([]reflect.StructField, 0, 0)) + dynamicStructArrType := reflect.SliceOf(reflect.PtrTo((dynamicEmptyStructType))) + + dynamicEmptyStruct := reflect.New(dynamicEmptyStructType) + dynamicNullEmptyStruct := reflect.Zero(reflect.PtrTo(dynamicEmptyStructType)) + + dynamicStructArrValue := reflect.MakeSlice(dynamicStructArrType, 2, 2) + dynamicStructArrValue.Index(0).Set(dynamicNullEmptyStruct) + dynamicStructArrValue.Index(1).Set(dynamicEmptyStruct) + + for _, test := range []encodeTest{ + { + "Go empty struct.", + emptyStruct, + emptyListValue, + emptyStructType, + }, + { + "Dynamic empty struct.", + dynamicEmptyStruct.Interface(), + emptyListValue, + emptyStructType, + }, + { + "Go NULL empty struct.", + nullEmptyStruct, + nullProto(), + emptyStructType, + }, + { + "Dynamic NULL empty struct.", + dynamicNullEmptyStruct.Interface(), + nullProto(), + emptyStructType, + }, + { + "Non-empty array of dynamic NULL and non-NULL empty structs.", + dynamicStructArrValue.Interface(), + listProto(nullProto(), emptyListValue), + listType(emptyStructType), + }, + { + "Non-empty array of nullable empty structs.", + []*struct{}{nullEmptyStruct, &emptyStruct}, + listProto(nullProto(), emptyListValue), + listType(emptyStructType), + }, + { + "Empty array of empty struct.", + []struct{}{}, + emptyListValue, + listType(emptyStructType), + }, + { + "Null array of empty structs.", + []struct{}(nil), + nullProto(), + listType(emptyStructType), + }, + } { + encodeStructValue(test, t) + } +} + +func TestEncodeStructValueMixedStructTypes(t *testing.T) { + type staticStruct struct { + F int `spanner:"fStatic"` + } + s1 := staticStruct{10} + s2 := (*staticStruct)(nil) + + var f float64 + dynStructType := reflect.StructOf([]reflect.StructField{ + {Name: "A", Type: reflect.TypeOf(f), Tag: `spanner:"fDynamic"`}, + }) + s3 := reflect.New(dynStructType) + s3.Elem().Field(0).SetFloat(3.14) + + for _, test := range []encodeTest{ + { + "'struct' with static and dynamic *struct, []*struct, []struct fields", + struct { + A []staticStruct + B []*staticStruct + C interface{} + }{ + []staticStruct{s1, s1}, + []*staticStruct{&s1, s2}, + s3.Interface(), + }, + listProto( + listProto(listProto(intProto(10)), listProto(intProto(10))), + listProto(listProto(intProto(10)), nullProto()), + listProto(floatProto(3.14))), + structType( + mkField("A", listType(structType(mkField("fStatic", intType())))), + mkField("B", listType(structType(mkField("fStatic", intType())))), + mkField("C", structType(mkField("fDynamic", floatType())))), + }, + } { + encodeStructValue(test, t) + } +} + +func TestBindParamsDynamic(t *testing.T) { + // Verify Statement.bindParams generates correct values and types. + st := Statement{ + SQL: "SELECT id from t_foo WHERE col = @var", + Params: map[string]interface{}{"var": nil}, + } + want := &sppb.ExecuteSqlRequest{ + Params: &proto3.Struct{ + Fields: map[string]*proto3.Value{"var": nil}, + }, + ParamTypes: map[string]*sppb.Type{"var": nil}, + } + var ( + t1, _ = time.Parse(time.RFC3339Nano, "2016-11-15T15:04:05.999999999Z") + // Boundaries + t2, _ = time.Parse(time.RFC3339Nano, "0001-01-01T00:00:00.000000000Z") + ) + dynamicStructType := reflect.StructOf([]reflect.StructField{ + {Name: "A", Type: reflect.TypeOf(t1), Tag: `spanner:"field"`}, + {Name: "B", Type: reflect.TypeOf(3.14), Tag: `spanner:""`}, + }) + dynamicStructArrType := reflect.SliceOf(reflect.PtrTo(dynamicStructType)) + dynamicEmptyStructType := reflect.StructOf(make([]reflect.StructField, 0, 0)) + + dynamicStructTypeProto := structType( + mkField("field", timeType()), + mkField("", floatType())) + + s3 := reflect.New(dynamicStructType) + s3.Elem().Field(0).Set(reflect.ValueOf(t1)) + s3.Elem().Field(1).SetFloat(1.4) + + s4 := reflect.New(dynamicStructType) + s4.Elem().Field(0).Set(reflect.ValueOf(t2)) + s4.Elem().Field(1).SetFloat(-13.3) + + dynamicStructArrayVal := reflect.MakeSlice(dynamicStructArrType, 2, 2) + dynamicStructArrayVal.Index(0).Set(s3) + dynamicStructArrayVal.Index(1).Set(s4) + + for _, test := range []struct { + val interface{} + wantField *proto3.Value + wantType *sppb.Type + }{ + { + s3.Interface(), + listProto(timeProto(t1), floatProto(1.4)), + structType( + mkField("field", timeType()), + mkField("", floatType())), + }, + { + reflect.Zero(reflect.PtrTo(dynamicEmptyStructType)).Interface(), + nullProto(), + structType([]*sppb.StructType_Field{}...), + }, + { + dynamicStructArrayVal.Interface(), + listProto( + listProto(timeProto(t1), floatProto(1.4)), + listProto(timeProto(t2), floatProto(-13.3))), + listType(dynamicStructTypeProto), + }, + { + []*struct { + F1 time.Time `spanner:"field"` + F2 float64 `spanner:""` + }{ + nil, + {t1, 1.4}, + }, + listProto( + nullProto(), + listProto(timeProto(t1), floatProto(1.4))), + listType(dynamicStructTypeProto), + }, + } { + st.Params["var"] = test.val + want.Params.Fields["var"] = test.wantField + want.ParamTypes["var"] = test.wantType + gotParams, gotParamTypes, gotErr := st.convertParams() + if gotErr != nil { + t.Error(gotErr) + continue + } + gotParamField := gotParams.Fields["var"] + if !proto.Equal(gotParamField, test.wantField) { + // handle NaN + if test.wantType.Code == floatType().Code && proto.MarshalTextString(gotParamField) == proto.MarshalTextString(test.wantField) { + continue + } + t.Errorf("%#v: got %v, want %v\n", test.val, gotParamField, test.wantField) + } + gotParamType := gotParamTypes["var"] + if !proto.Equal(gotParamType, test.wantType) { + t.Errorf("%#v: got %v, want %v\n", test.val, gotParamType, test.wantField) + } + } +} + +func TestStructParametersBind(t *testing.T) { + t.Parallel() + ctx := context.Background() + client, _, cleanup := prepare(ctx, t, nil) + defer cleanup() + + type tRow []interface{} + type tRows []struct{ trow tRow } + + type allFields struct { + Stringf string + Intf int + Boolf bool + Floatf float64 + Bytef []byte + Timef time.Time + Datef civil.Date + } + allColumns := []string{ + "Stringf", + "Intf", + "Boolf", + "Floatf", + "Bytef", + "Timef", + "Datef", + } + s1 := allFields{"abc", 300, false, 3.45, []byte("foo"), t1, d1} + s2 := allFields{"def", -300, false, -3.45, []byte("bar"), t2, d2} + + dynamicStructType := reflect.StructOf([]reflect.StructField{ + {Name: "A", Type: reflect.TypeOf(t1), Tag: `spanner:"ff1"`}, + }) + s3 := reflect.New(dynamicStructType) + s3.Elem().Field(0).Set(reflect.ValueOf(t1)) + + for i, test := range []struct { + param interface{} + sql string + cols []string + trows tRows + }{ + // Struct value. + { + s1, + "SELECT" + + " @p.Stringf," + + " @p.Intf," + + " @p.Boolf," + + " @p.Floatf," + + " @p.Bytef," + + " @p.Timef," + + " @p.Datef", + allColumns, + tRows{ + {tRow{"abc", 300, false, 3.45, []byte("foo"), t1, d1}}, + }, + }, + // Array of struct value. + { + []allFields{s1, s2}, + "SELECT * FROM UNNEST(@p)", + allColumns, + tRows{ + {tRow{"abc", 300, false, 3.45, []byte("foo"), t1, d1}}, + {tRow{"def", -300, false, -3.45, []byte("bar"), t2, d2}}, + }, + }, + // Null struct. + { + (*allFields)(nil), + "SELECT @p IS NULL", + []string{""}, + tRows{ + {tRow{true}}, + }, + }, + // Null Array of struct. + { + []allFields(nil), + "SELECT @p IS NULL", + []string{""}, + tRows{ + {tRow{true}}, + }, + }, + // Empty struct. + { + struct{}{}, + "SELECT @p IS NULL ", + []string{""}, + tRows{ + {tRow{false}}, + }, + }, + // Empty array of struct. + { + []allFields{}, + "SELECT * FROM UNNEST(@p) ", + allColumns, + tRows{}, + }, + // Struct with duplicate fields. + { + struct { + A int `spanner:"field"` + B int `spanner:"field"` + }{10, 20}, + "SELECT * FROM UNNEST([@p]) ", + []string{"field", "field"}, + tRows{ + {tRow{10, 20}}, + }, + }, + // Struct with unnamed fields. + { + struct { + A string `spanner:""` + }{"hello"}, + "SELECT * FROM UNNEST([@p]) ", + []string{""}, + tRows{ + {tRow{"hello"}}, + }, + }, + // Mixed struct. + { + struct { + DynamicStructField interface{} `spanner:"f1"` + ArrayStructField []*allFields `spanner:"f2"` + }{ + DynamicStructField: s3.Interface(), + ArrayStructField: []*allFields{nil}, + }, + "SELECT @p.f1.ff1, ARRAY_LENGTH(@p.f2), @p.f2[OFFSET(0)] IS NULL ", + []string{"ff1", "", ""}, + tRows{ + {tRow{t1, 1, true}}, + }, + }, + } { + iter := client.Single().Query(ctx, Statement{ + SQL: test.sql, + Params: map[string]interface{}{"p": test.param}, + }) + var gotRows []*Row + err := iter.Do(func(r *Row) error { + gotRows = append(gotRows, r) + return nil + }) + if err != nil { + t.Errorf("Failed to execute test case %d, error: %v", i, err) + } + + var wantRows []*Row + for j, row := range test.trows { + r, err := NewRow(test.cols, row.trow) + if err != nil { + t.Errorf("Invalid row %d in test case %d", j, i) + } + wantRows = append(wantRows, r) + } + if !testEqual(gotRows, wantRows) { + t.Errorf("%d: Want result %v, got result %v", i, wantRows, gotRows) + } + } +} diff --git a/vendor/cloud.google.com/go/speech/apiv1/Recognize_smoke_test.go b/vendor/cloud.google.com/go/speech/apiv1/Recognize_smoke_test.go new file mode 100644 index 000000000..292be9ece --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1/Recognize_smoke_test.go @@ -0,0 +1,80 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package speech + +import ( + speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestSpeechSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var languageCode string = "en-US" + var sampleRateHertz int32 = 44100 + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var config = &speechpb.RecognitionConfig{ + LanguageCode: languageCode, + SampleRateHertz: sampleRateHertz, + Encoding: encoding, + } + var uri string = "gs://gapic-toolkit/hello.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.RecognizeRequest{ + Config: config, + Audio: audio, + } + + if _, err := c.Recognize(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/speech/apiv1/doc.go b/vendor/cloud.google.com/go/speech/apiv1/doc.go new file mode 100644 index 000000000..550d3bff0 --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1/doc.go @@ -0,0 +1,88 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package speech is an auto-generated package for the +// Cloud Speech API. + +// +// Converts audio to text by applying powerful neural network models. +package speech // import "cloud.google.com/go/speech/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/speech/apiv1/mock_test.go b/vendor/cloud.google.com/go/speech/apiv1/mock_test.go new file mode 100644 index 000000000..9e32b7c1e --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1/mock_test.go @@ -0,0 +1,405 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package speech + +import ( + speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockSpeechServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + speechpb.SpeechServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockSpeechServer) Recognize(ctx context.Context, req *speechpb.RecognizeRequest) (*speechpb.RecognizeResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*speechpb.RecognizeResponse), nil +} + +func (s *mockSpeechServer) LongRunningRecognize(ctx context.Context, req *speechpb.LongRunningRecognizeRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockSpeechServer) StreamingRecognize(stream speechpb.Speech_StreamingRecognizeServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + for { + if req, err := stream.Recv(); err == io.EOF { + break + } else if err != nil { + return err + } else { + s.reqs = append(s.reqs, req) + } + } + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*speechpb.StreamingRecognizeResponse)); err != nil { + return err + } + } + return nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockSpeech mockSpeechServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + speechpb.RegisterSpeechServer(serv, &mockSpeech) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestSpeechRecognize(t *testing.T) { + var expectedResponse *speechpb.RecognizeResponse = &speechpb.RecognizeResponse{} + + mockSpeech.err = nil + mockSpeech.reqs = nil + + mockSpeech.resps = append(mockSpeech.resps[:0], expectedResponse) + + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var sampleRateHertz int32 = 44100 + var languageCode string = "en-US" + var config = &speechpb.RecognitionConfig{ + Encoding: encoding, + SampleRateHertz: sampleRateHertz, + LanguageCode: languageCode, + } + var uri string = "gs://bucket_name/file_name.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.RecognizeRequest{ + Config: config, + Audio: audio, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Recognize(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpeech.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpeechRecognizeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpeech.err = gstatus.Error(errCode, "test error") + + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var sampleRateHertz int32 = 44100 + var languageCode string = "en-US" + var config = &speechpb.RecognitionConfig{ + Encoding: encoding, + SampleRateHertz: sampleRateHertz, + LanguageCode: languageCode, + } + var uri string = "gs://bucket_name/file_name.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.RecognizeRequest{ + Config: config, + Audio: audio, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Recognize(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpeechLongRunningRecognize(t *testing.T) { + var expectedResponse *speechpb.LongRunningRecognizeResponse = &speechpb.LongRunningRecognizeResponse{} + + mockSpeech.err = nil + mockSpeech.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockSpeech.resps = append(mockSpeech.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var sampleRateHertz int32 = 44100 + var languageCode string = "en-US" + var config = &speechpb.RecognitionConfig{ + Encoding: encoding, + SampleRateHertz: sampleRateHertz, + LanguageCode: languageCode, + } + var uri string = "gs://bucket_name/file_name.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.LongRunningRecognizeRequest{ + Config: config, + Audio: audio, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.LongRunningRecognize(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpeech.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpeechLongRunningRecognizeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpeech.err = nil + mockSpeech.resps = append(mockSpeech.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var sampleRateHertz int32 = 44100 + var languageCode string = "en-US" + var config = &speechpb.RecognitionConfig{ + Encoding: encoding, + SampleRateHertz: sampleRateHertz, + LanguageCode: languageCode, + } + var uri string = "gs://bucket_name/file_name.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.LongRunningRecognizeRequest{ + Config: config, + Audio: audio, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.LongRunningRecognize(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpeechStreamingRecognize(t *testing.T) { + var expectedResponse *speechpb.StreamingRecognizeResponse = &speechpb.StreamingRecognizeResponse{} + + mockSpeech.err = nil + mockSpeech.reqs = nil + + mockSpeech.resps = append(mockSpeech.resps[:0], expectedResponse) + + var request *speechpb.StreamingRecognizeRequest = &speechpb.StreamingRecognizeRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingRecognize(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpeech.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpeechStreamingRecognizeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpeech.err = gstatus.Error(errCode, "test error") + + var request *speechpb.StreamingRecognizeRequest = &speechpb.StreamingRecognizeRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingRecognize(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/speech/apiv1/speech_client.go b/vendor/cloud.google.com/go/speech/apiv1/speech_client.go new file mode 100644 index 000000000..0ea5deabc --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1/speech_client.go @@ -0,0 +1,264 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package speech + +import ( + "context" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + Recognize []gax.CallOption + LongRunningRecognize []gax.CallOption + StreamingRecognize []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("speech.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + Recognize: retry[[2]string{"default", "idempotent"}], + LongRunningRecognize: retry[[2]string{"default", "non_idempotent"}], + StreamingRecognize: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Cloud Speech API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client speechpb.SpeechClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new speech client. +// +// Service that implements Google Cloud Speech API. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: speechpb.NewSpeechClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Recognize performs synchronous speech recognition: receive results after all audio +// has been sent and processed. +func (c *Client) Recognize(ctx context.Context, req *speechpb.RecognizeRequest, opts ...gax.CallOption) (*speechpb.RecognizeResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Recognize[0:len(c.CallOptions.Recognize):len(c.CallOptions.Recognize)], opts...) + var resp *speechpb.RecognizeResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.Recognize(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// LongRunningRecognize performs asynchronous speech recognition: receive results via the +// google.longrunning.Operations interface. Returns either an +// Operation.error or an Operation.response which contains +// a LongRunningRecognizeResponse message. +func (c *Client) LongRunningRecognize(ctx context.Context, req *speechpb.LongRunningRecognizeRequest, opts ...gax.CallOption) (*LongRunningRecognizeOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.LongRunningRecognize[0:len(c.CallOptions.LongRunningRecognize):len(c.CallOptions.LongRunningRecognize)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.LongRunningRecognize(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &LongRunningRecognizeOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// StreamingRecognize performs bidirectional streaming speech recognition: receive results while +// sending audio. This method is only available via the gRPC API (not REST). +func (c *Client) StreamingRecognize(ctx context.Context, opts ...gax.CallOption) (speechpb.Speech_StreamingRecognizeClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.StreamingRecognize[0:len(c.CallOptions.StreamingRecognize):len(c.CallOptions.StreamingRecognize)], opts...) + var resp speechpb.Speech_StreamingRecognizeClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.StreamingRecognize(ctx, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// LongRunningRecognizeOperation manages a long-running operation from LongRunningRecognize. +type LongRunningRecognizeOperation struct { + lro *longrunning.Operation +} + +// LongRunningRecognizeOperation returns a new LongRunningRecognizeOperation from a given name. +// The name must be that of a previously created LongRunningRecognizeOperation, possibly from a different process. +func (c *Client) LongRunningRecognizeOperation(name string) *LongRunningRecognizeOperation { + return &LongRunningRecognizeOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *LongRunningRecognizeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*speechpb.LongRunningRecognizeResponse, error) { + var resp speechpb.LongRunningRecognizeResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *LongRunningRecognizeOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*speechpb.LongRunningRecognizeResponse, error) { + var resp speechpb.LongRunningRecognizeResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *LongRunningRecognizeOperation) Metadata() (*speechpb.LongRunningRecognizeMetadata, error) { + var meta speechpb.LongRunningRecognizeMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *LongRunningRecognizeOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *LongRunningRecognizeOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/speech/apiv1/speech_client_example_test.go b/vendor/cloud.google.com/go/speech/apiv1/speech_client_example_test.go new file mode 100644 index 000000000..db8ddc11c --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1/speech_client_example_test.go @@ -0,0 +1,110 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package speech_test + +import ( + "context" + "io" + + speech "cloud.google.com/go/speech/apiv1" + speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := speech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_Recognize() { + ctx := context.Background() + c, err := speech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &speechpb.RecognizeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Recognize(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_LongRunningRecognize() { + ctx := context.Background() + c, err := speech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &speechpb.LongRunningRecognizeRequest{ + // TODO: Fill request struct fields. + } + op, err := c.LongRunningRecognize(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_StreamingRecognize() { + ctx := context.Background() + c, err := speech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + stream, err := c.StreamingRecognize(ctx) + if err != nil { + // TODO: Handle error. + } + go func() { + reqs := []*speechpb.StreamingRecognizeRequest{ + // TODO: Create requests. + } + for _, req := range reqs { + if err := stream.Send(req); err != nil { + // TODO: Handle error. + } + } + stream.CloseSend() + }() + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/vendor/cloud.google.com/go/speech/apiv1p1beta1/Recognize_smoke_test.go b/vendor/cloud.google.com/go/speech/apiv1p1beta1/Recognize_smoke_test.go new file mode 100644 index 000000000..874b6c2e1 --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1p1beta1/Recognize_smoke_test.go @@ -0,0 +1,80 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package speech + +import ( + speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestSpeechSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var languageCode string = "en-US" + var sampleRateHertz int32 = 44100 + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var config = &speechpb.RecognitionConfig{ + LanguageCode: languageCode, + SampleRateHertz: sampleRateHertz, + Encoding: encoding, + } + var uri string = "gs://gapic-toolkit/hello.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.RecognizeRequest{ + Config: config, + Audio: audio, + } + + if _, err := c.Recognize(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/speech/apiv1p1beta1/doc.go b/vendor/cloud.google.com/go/speech/apiv1p1beta1/doc.go new file mode 100644 index 000000000..58edeae3f --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1p1beta1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package speech is an auto-generated package for the +// Cloud Speech API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Converts audio to text by applying powerful neural network models. +package speech // import "cloud.google.com/go/speech/apiv1p1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/speech/apiv1p1beta1/mock_test.go b/vendor/cloud.google.com/go/speech/apiv1p1beta1/mock_test.go new file mode 100644 index 000000000..4852fa875 --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1p1beta1/mock_test.go @@ -0,0 +1,405 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package speech + +import ( + speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockSpeechServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + speechpb.SpeechServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockSpeechServer) Recognize(ctx context.Context, req *speechpb.RecognizeRequest) (*speechpb.RecognizeResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*speechpb.RecognizeResponse), nil +} + +func (s *mockSpeechServer) LongRunningRecognize(ctx context.Context, req *speechpb.LongRunningRecognizeRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +func (s *mockSpeechServer) StreamingRecognize(stream speechpb.Speech_StreamingRecognizeServer) error { + md, _ := metadata.FromIncomingContext(stream.Context()) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + for { + if req, err := stream.Recv(); err == io.EOF { + break + } else if err != nil { + return err + } else { + s.reqs = append(s.reqs, req) + } + } + if s.err != nil { + return s.err + } + for _, v := range s.resps { + if err := stream.Send(v.(*speechpb.StreamingRecognizeResponse)); err != nil { + return err + } + } + return nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockSpeech mockSpeechServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + speechpb.RegisterSpeechServer(serv, &mockSpeech) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestSpeechRecognize(t *testing.T) { + var expectedResponse *speechpb.RecognizeResponse = &speechpb.RecognizeResponse{} + + mockSpeech.err = nil + mockSpeech.reqs = nil + + mockSpeech.resps = append(mockSpeech.resps[:0], expectedResponse) + + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var sampleRateHertz int32 = 44100 + var languageCode string = "en-US" + var config = &speechpb.RecognitionConfig{ + Encoding: encoding, + SampleRateHertz: sampleRateHertz, + LanguageCode: languageCode, + } + var uri string = "gs://bucket_name/file_name.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.RecognizeRequest{ + Config: config, + Audio: audio, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Recognize(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpeech.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpeechRecognizeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpeech.err = gstatus.Error(errCode, "test error") + + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var sampleRateHertz int32 = 44100 + var languageCode string = "en-US" + var config = &speechpb.RecognitionConfig{ + Encoding: encoding, + SampleRateHertz: sampleRateHertz, + LanguageCode: languageCode, + } + var uri string = "gs://bucket_name/file_name.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.RecognizeRequest{ + Config: config, + Audio: audio, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.Recognize(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpeechLongRunningRecognize(t *testing.T) { + var expectedResponse *speechpb.LongRunningRecognizeResponse = &speechpb.LongRunningRecognizeResponse{} + + mockSpeech.err = nil + mockSpeech.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockSpeech.resps = append(mockSpeech.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var sampleRateHertz int32 = 44100 + var languageCode string = "en-US" + var config = &speechpb.RecognitionConfig{ + Encoding: encoding, + SampleRateHertz: sampleRateHertz, + LanguageCode: languageCode, + } + var uri string = "gs://bucket_name/file_name.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.LongRunningRecognizeRequest{ + Config: config, + Audio: audio, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.LongRunningRecognize(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpeech.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpeechLongRunningRecognizeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpeech.err = nil + mockSpeech.resps = append(mockSpeech.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var encoding speechpb.RecognitionConfig_AudioEncoding = speechpb.RecognitionConfig_FLAC + var sampleRateHertz int32 = 44100 + var languageCode string = "en-US" + var config = &speechpb.RecognitionConfig{ + Encoding: encoding, + SampleRateHertz: sampleRateHertz, + LanguageCode: languageCode, + } + var uri string = "gs://bucket_name/file_name.flac" + var audio = &speechpb.RecognitionAudio{ + AudioSource: &speechpb.RecognitionAudio_Uri{ + Uri: uri, + }, + } + var request = &speechpb.LongRunningRecognizeRequest{ + Config: config, + Audio: audio, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.LongRunningRecognize(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestSpeechStreamingRecognize(t *testing.T) { + var expectedResponse *speechpb.StreamingRecognizeResponse = &speechpb.StreamingRecognizeResponse{} + + mockSpeech.err = nil + mockSpeech.reqs = nil + + mockSpeech.resps = append(mockSpeech.resps[:0], expectedResponse) + + var request *speechpb.StreamingRecognizeRequest = &speechpb.StreamingRecognizeRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingRecognize(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockSpeech.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestSpeechStreamingRecognizeError(t *testing.T) { + errCode := codes.PermissionDenied + mockSpeech.err = gstatus.Error(errCode, "test error") + + var request *speechpb.StreamingRecognizeRequest = &speechpb.StreamingRecognizeRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + stream, err := c.StreamingRecognize(context.Background()) + if err != nil { + t.Fatal(err) + } + if err := stream.Send(request); err != nil { + t.Fatal(err) + } + if err := stream.CloseSend(); err != nil { + t.Fatal(err) + } + resp, err := stream.Recv() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/speech/apiv1p1beta1/speech_client.go b/vendor/cloud.google.com/go/speech/apiv1p1beta1/speech_client.go new file mode 100644 index 000000000..15e7b0520 --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1p1beta1/speech_client.go @@ -0,0 +1,264 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package speech + +import ( + "context" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + Recognize []gax.CallOption + LongRunningRecognize []gax.CallOption + StreamingRecognize []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("speech.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + Recognize: retry[[2]string{"default", "idempotent"}], + LongRunningRecognize: retry[[2]string{"default", "non_idempotent"}], + StreamingRecognize: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Cloud Speech API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client speechpb.SpeechClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new speech client. +// +// Service that implements Google Cloud Speech API. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: speechpb.NewSpeechClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// Recognize performs synchronous speech recognition: receive results after all audio +// has been sent and processed. +func (c *Client) Recognize(ctx context.Context, req *speechpb.RecognizeRequest, opts ...gax.CallOption) (*speechpb.RecognizeResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.Recognize[0:len(c.CallOptions.Recognize):len(c.CallOptions.Recognize)], opts...) + var resp *speechpb.RecognizeResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.Recognize(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// LongRunningRecognize performs asynchronous speech recognition: receive results via the +// google.longrunning.Operations interface. Returns either an +// Operation.error or an Operation.response which contains +// a LongRunningRecognizeResponse message. +func (c *Client) LongRunningRecognize(ctx context.Context, req *speechpb.LongRunningRecognizeRequest, opts ...gax.CallOption) (*LongRunningRecognizeOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.LongRunningRecognize[0:len(c.CallOptions.LongRunningRecognize):len(c.CallOptions.LongRunningRecognize)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.LongRunningRecognize(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &LongRunningRecognizeOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// StreamingRecognize performs bidirectional streaming speech recognition: receive results while +// sending audio. This method is only available via the gRPC API (not REST). +func (c *Client) StreamingRecognize(ctx context.Context, opts ...gax.CallOption) (speechpb.Speech_StreamingRecognizeClient, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.StreamingRecognize[0:len(c.CallOptions.StreamingRecognize):len(c.CallOptions.StreamingRecognize)], opts...) + var resp speechpb.Speech_StreamingRecognizeClient + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.StreamingRecognize(ctx, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// LongRunningRecognizeOperation manages a long-running operation from LongRunningRecognize. +type LongRunningRecognizeOperation struct { + lro *longrunning.Operation +} + +// LongRunningRecognizeOperation returns a new LongRunningRecognizeOperation from a given name. +// The name must be that of a previously created LongRunningRecognizeOperation, possibly from a different process. +func (c *Client) LongRunningRecognizeOperation(name string) *LongRunningRecognizeOperation { + return &LongRunningRecognizeOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *LongRunningRecognizeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*speechpb.LongRunningRecognizeResponse, error) { + var resp speechpb.LongRunningRecognizeResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *LongRunningRecognizeOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*speechpb.LongRunningRecognizeResponse, error) { + var resp speechpb.LongRunningRecognizeResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *LongRunningRecognizeOperation) Metadata() (*speechpb.LongRunningRecognizeMetadata, error) { + var meta speechpb.LongRunningRecognizeMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *LongRunningRecognizeOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *LongRunningRecognizeOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/speech/apiv1p1beta1/speech_client_example_test.go b/vendor/cloud.google.com/go/speech/apiv1p1beta1/speech_client_example_test.go new file mode 100644 index 000000000..d44ab5ddc --- /dev/null +++ b/vendor/cloud.google.com/go/speech/apiv1p1beta1/speech_client_example_test.go @@ -0,0 +1,110 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package speech_test + +import ( + "context" + "io" + + speech "cloud.google.com/go/speech/apiv1p1beta1" + speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := speech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_Recognize() { + ctx := context.Background() + c, err := speech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &speechpb.RecognizeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.Recognize(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_LongRunningRecognize() { + ctx := context.Background() + c, err := speech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &speechpb.LongRunningRecognizeRequest{ + // TODO: Fill request struct fields. + } + op, err := c.LongRunningRecognize(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_StreamingRecognize() { + ctx := context.Background() + c, err := speech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + stream, err := c.StreamingRecognize(ctx) + if err != nil { + // TODO: Handle error. + } + go func() { + reqs := []*speechpb.StreamingRecognizeRequest{ + // TODO: Create requests. + } + for _, req := range reqs { + if err := stream.Send(req); err != nil { + // TODO: Handle error. + } + } + stream.CloseSend() + }() + for { + resp, err := stream.Recv() + if err == io.EOF { + break + } + if err != nil { + // TODO: handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/vendor/cloud.google.com/go/storage/acl.go b/vendor/cloud.google.com/go/storage/acl.go new file mode 100644 index 000000000..7855d110a --- /dev/null +++ b/vendor/cloud.google.com/go/storage/acl.go @@ -0,0 +1,335 @@ +// 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 storage + +import ( + "context" + "net/http" + "reflect" + + "cloud.google.com/go/internal/trace" + "google.golang.org/api/googleapi" + raw "google.golang.org/api/storage/v1" +) + +// ACLRole is the level of access to grant. +type ACLRole string + +const ( + RoleOwner ACLRole = "OWNER" + RoleReader ACLRole = "READER" + RoleWriter ACLRole = "WRITER" +) + +// ACLEntity refers to a user or group. +// They are sometimes referred to as grantees. +// +// It could be in the form of: +// "user-", "user-", "group-", "group-", +// "domain-" and "project-team-". +// +// Or one of the predefined constants: AllUsers, AllAuthenticatedUsers. +type ACLEntity string + +const ( + AllUsers ACLEntity = "allUsers" + AllAuthenticatedUsers ACLEntity = "allAuthenticatedUsers" +) + +// ACLRule represents a grant for a role to an entity (user, group or team) for a +// Google Cloud Storage object or bucket. +type ACLRule struct { + Entity ACLEntity + EntityID string + Role ACLRole + Domain string + Email string + ProjectTeam *ProjectTeam +} + +// ProjectTeam is the project team associated with the entity, if any. +type ProjectTeam struct { + ProjectNumber string + Team string +} + +// ACLHandle provides operations on an access control list for a Google Cloud Storage bucket or object. +type ACLHandle struct { + c *Client + bucket string + object string + isDefault bool + userProject string // for requester-pays buckets +} + +// Delete permanently deletes the ACL entry for the given entity. +func (a *ACLHandle) Delete(ctx context.Context, entity ACLEntity) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.ACL.Delete") + defer func() { trace.EndSpan(ctx, err) }() + + if a.object != "" { + return a.objectDelete(ctx, entity) + } + if a.isDefault { + return a.bucketDefaultDelete(ctx, entity) + } + return a.bucketDelete(ctx, entity) +} + +// Set sets the role for the given entity. +func (a *ACLHandle) Set(ctx context.Context, entity ACLEntity, role ACLRole) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.ACL.Set") + defer func() { trace.EndSpan(ctx, err) }() + + if a.object != "" { + return a.objectSet(ctx, entity, role, false) + } + if a.isDefault { + return a.objectSet(ctx, entity, role, true) + } + return a.bucketSet(ctx, entity, role) +} + +// List retrieves ACL entries. +func (a *ACLHandle) List(ctx context.Context) (rules []ACLRule, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.ACL.List") + defer func() { trace.EndSpan(ctx, err) }() + + if a.object != "" { + return a.objectList(ctx) + } + if a.isDefault { + return a.bucketDefaultList(ctx) + } + return a.bucketList(ctx) +} + +func (a *ACLHandle) bucketDefaultList(ctx context.Context) ([]ACLRule, error) { + var acls *raw.ObjectAccessControls + var err error + err = runWithRetry(ctx, func() error { + req := a.c.raw.DefaultObjectAccessControls.List(a.bucket) + a.configureCall(ctx, req) + acls, err = req.Do() + return err + }) + if err != nil { + return nil, err + } + return toObjectACLRules(acls.Items), nil +} + +func (a *ACLHandle) bucketDefaultDelete(ctx context.Context, entity ACLEntity) error { + return runWithRetry(ctx, func() error { + req := a.c.raw.DefaultObjectAccessControls.Delete(a.bucket, string(entity)) + a.configureCall(ctx, req) + return req.Do() + }) +} + +func (a *ACLHandle) bucketList(ctx context.Context) ([]ACLRule, error) { + var acls *raw.BucketAccessControls + var err error + err = runWithRetry(ctx, func() error { + req := a.c.raw.BucketAccessControls.List(a.bucket) + a.configureCall(ctx, req) + acls, err = req.Do() + return err + }) + if err != nil { + return nil, err + } + return toBucketACLRules(acls.Items), nil +} + +func (a *ACLHandle) bucketSet(ctx context.Context, entity ACLEntity, role ACLRole) error { + acl := &raw.BucketAccessControl{ + Bucket: a.bucket, + Entity: string(entity), + Role: string(role), + } + err := runWithRetry(ctx, func() error { + req := a.c.raw.BucketAccessControls.Update(a.bucket, string(entity), acl) + a.configureCall(ctx, req) + _, err := req.Do() + return err + }) + if err != nil { + return err + } + return nil +} + +func (a *ACLHandle) bucketDelete(ctx context.Context, entity ACLEntity) error { + return runWithRetry(ctx, func() error { + req := a.c.raw.BucketAccessControls.Delete(a.bucket, string(entity)) + a.configureCall(ctx, req) + return req.Do() + }) +} + +func (a *ACLHandle) objectList(ctx context.Context) ([]ACLRule, error) { + var acls *raw.ObjectAccessControls + var err error + err = runWithRetry(ctx, func() error { + req := a.c.raw.ObjectAccessControls.List(a.bucket, a.object) + a.configureCall(ctx, req) + acls, err = req.Do() + return err + }) + if err != nil { + return nil, err + } + return toObjectACLRules(acls.Items), nil +} + +func (a *ACLHandle) objectSet(ctx context.Context, entity ACLEntity, role ACLRole, isBucketDefault bool) error { + type setRequest interface { + Do(opts ...googleapi.CallOption) (*raw.ObjectAccessControl, error) + Header() http.Header + } + + acl := &raw.ObjectAccessControl{ + Bucket: a.bucket, + Entity: string(entity), + Role: string(role), + } + var req setRequest + if isBucketDefault { + req = a.c.raw.DefaultObjectAccessControls.Update(a.bucket, string(entity), acl) + } else { + req = a.c.raw.ObjectAccessControls.Update(a.bucket, a.object, string(entity), acl) + } + a.configureCall(ctx, req) + return runWithRetry(ctx, func() error { + _, err := req.Do() + return err + }) +} + +func (a *ACLHandle) objectDelete(ctx context.Context, entity ACLEntity) error { + return runWithRetry(ctx, func() error { + req := a.c.raw.ObjectAccessControls.Delete(a.bucket, a.object, string(entity)) + a.configureCall(ctx, req) + return req.Do() + }) +} + +func (a *ACLHandle) configureCall(ctx context.Context, call interface{ Header() http.Header }) { + vc := reflect.ValueOf(call) + vc.MethodByName("Context").Call([]reflect.Value{reflect.ValueOf(ctx)}) + if a.userProject != "" { + vc.MethodByName("UserProject").Call([]reflect.Value{reflect.ValueOf(a.userProject)}) + } + setClientHeader(call.Header()) +} + +func toObjectACLRules(items []*raw.ObjectAccessControl) []ACLRule { + var rs []ACLRule + for _, item := range items { + rs = append(rs, toObjectACLRule(item)) + } + return rs +} + +func toBucketACLRules(items []*raw.BucketAccessControl) []ACLRule { + var rs []ACLRule + for _, item := range items { + rs = append(rs, toBucketACLRule(item)) + } + return rs +} + +func toObjectACLRule(a *raw.ObjectAccessControl) ACLRule { + return ACLRule{ + Entity: ACLEntity(a.Entity), + EntityID: a.EntityId, + Role: ACLRole(a.Role), + Domain: a.Domain, + Email: a.Email, + ProjectTeam: toObjectProjectTeam(a.ProjectTeam), + } +} + +func toBucketACLRule(a *raw.BucketAccessControl) ACLRule { + return ACLRule{ + Entity: ACLEntity(a.Entity), + EntityID: a.EntityId, + Role: ACLRole(a.Role), + Domain: a.Domain, + Email: a.Email, + ProjectTeam: toBucketProjectTeam(a.ProjectTeam), + } +} + +func toRawObjectACL(rules []ACLRule) []*raw.ObjectAccessControl { + if len(rules) == 0 { + return nil + } + r := make([]*raw.ObjectAccessControl, 0, len(rules)) + for _, rule := range rules { + r = append(r, rule.toRawObjectAccessControl("")) // bucket name unnecessary + } + return r +} + +func toRawBucketACL(rules []ACLRule) []*raw.BucketAccessControl { + if len(rules) == 0 { + return nil + } + r := make([]*raw.BucketAccessControl, 0, len(rules)) + for _, rule := range rules { + r = append(r, rule.toRawBucketAccessControl("")) // bucket name unnecessary + } + return r +} + +func (r ACLRule) toRawBucketAccessControl(bucket string) *raw.BucketAccessControl { + return &raw.BucketAccessControl{ + Bucket: bucket, + Entity: string(r.Entity), + Role: string(r.Role), + // The other fields are not settable. + } +} + +func (r ACLRule) toRawObjectAccessControl(bucket string) *raw.ObjectAccessControl { + return &raw.ObjectAccessControl{ + Bucket: bucket, + Entity: string(r.Entity), + Role: string(r.Role), + // The other fields are not settable. + } +} + +func toBucketProjectTeam(p *raw.BucketAccessControlProjectTeam) *ProjectTeam { + if p == nil { + return nil + } + return &ProjectTeam{ + ProjectNumber: p.ProjectNumber, + Team: p.Team, + } +} + +func toObjectProjectTeam(p *raw.ObjectAccessControlProjectTeam) *ProjectTeam { + if p == nil { + return nil + } + return &ProjectTeam{ + ProjectNumber: p.ProjectNumber, + Team: p.Team, + } +} diff --git a/vendor/cloud.google.com/go/storage/acl_test.go b/vendor/cloud.google.com/go/storage/acl_test.go new file mode 100644 index 000000000..9b725127f --- /dev/null +++ b/vendor/cloud.google.com/go/storage/acl_test.go @@ -0,0 +1,65 @@ +// 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 storage + +import ( + "context" + "net/http" + "testing" + + "cloud.google.com/go/internal/testutil" +) + +func TestSetACL(t *testing.T) { + ctx := context.Background() + mt := &mockTransport{} + client := mockClient(t, mt) + bh := &ACLHandle{c: client, bucket: "B"} + oh := &ACLHandle{c: client, bucket: "B", object: "O"} + for _, test := range []struct { + desc string + f func() error + want map[string]interface{} + }{ + { + desc: "bucket Set", + f: func() error { return bh.Set(ctx, AllUsers, RoleReader) }, + want: map[string]interface{}{ + "bucket": "B", + "entity": "allUsers", + "role": "READER", + }, + }, + + { + desc: "object Set", + f: func() error { return oh.Set(ctx, ACLEntity("e"), RoleWriter) }, + want: map[string]interface{}{ + "bucket": "B", + "entity": "e", + "role": "WRITER", + }, + }} { + + mt.addResult(&http.Response{StatusCode: 200, Body: bodyReader("{}")}, nil) + if err := test.f(); err != nil { + t.Fatal(err) + } + got := mt.gotJSONBody() + if diff := testutil.Diff(got, test.want); diff != "" { + t.Errorf("%s: %s", test.desc, diff) + } + } +} diff --git a/vendor/cloud.google.com/go/storage/bucket.go b/vendor/cloud.google.com/go/storage/bucket.go new file mode 100644 index 000000000..3b0018aff --- /dev/null +++ b/vendor/cloud.google.com/go/storage/bucket.go @@ -0,0 +1,1129 @@ +// 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 storage + +import ( + "context" + "fmt" + "net/http" + "reflect" + "time" + + "cloud.google.com/go/internal/optional" + "cloud.google.com/go/internal/trace" + "google.golang.org/api/googleapi" + "google.golang.org/api/iterator" + raw "google.golang.org/api/storage/v1" +) + +// BucketHandle provides operations on a Google Cloud Storage bucket. +// Use Client.Bucket to get a handle. +type BucketHandle struct { + c *Client + name string + acl ACLHandle + defaultObjectACL ACLHandle + conds *BucketConditions + userProject string // project for Requester Pays buckets +} + +// Bucket returns a BucketHandle, which provides operations on the named bucket. +// This call does not perform any network operations. +// +// The supplied name must contain only lowercase letters, numbers, dashes, +// underscores, and dots. The full specification for valid bucket names can be +// found at: +// https://cloud.google.com/storage/docs/bucket-naming +func (c *Client) Bucket(name string) *BucketHandle { + return &BucketHandle{ + c: c, + name: name, + acl: ACLHandle{ + c: c, + bucket: name, + }, + defaultObjectACL: ACLHandle{ + c: c, + bucket: name, + isDefault: true, + }, + } +} + +// Create creates the Bucket in the project. +// If attrs is nil the API defaults will be used. +func (b *BucketHandle) Create(ctx context.Context, projectID string, attrs *BucketAttrs) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Bucket.Create") + defer func() { trace.EndSpan(ctx, err) }() + + var bkt *raw.Bucket + if attrs != nil { + bkt = attrs.toRawBucket() + } else { + bkt = &raw.Bucket{} + } + bkt.Name = b.name + // If there is lifecycle information but no location, explicitly set + // the location. This is a GCS quirk/bug. + if bkt.Location == "" && bkt.Lifecycle != nil { + bkt.Location = "US" + } + req := b.c.raw.Buckets.Insert(projectID, bkt) + setClientHeader(req.Header()) + if attrs != nil && attrs.PredefinedACL != "" { + req.PredefinedAcl(attrs.PredefinedACL) + } + if attrs != nil && attrs.PredefinedDefaultObjectACL != "" { + req.PredefinedDefaultObjectAcl(attrs.PredefinedDefaultObjectACL) + } + return runWithRetry(ctx, func() error { _, err := req.Context(ctx).Do(); return err }) +} + +// Delete deletes the Bucket. +func (b *BucketHandle) Delete(ctx context.Context) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Bucket.Delete") + defer func() { trace.EndSpan(ctx, err) }() + + req, err := b.newDeleteCall() + if err != nil { + return err + } + return runWithRetry(ctx, func() error { return req.Context(ctx).Do() }) +} + +func (b *BucketHandle) newDeleteCall() (*raw.BucketsDeleteCall, error) { + req := b.c.raw.Buckets.Delete(b.name) + setClientHeader(req.Header()) + if err := applyBucketConds("BucketHandle.Delete", b.conds, req); err != nil { + return nil, err + } + if b.userProject != "" { + req.UserProject(b.userProject) + } + return req, nil +} + +// ACL returns an ACLHandle, which provides access to the bucket's access control list. +// This controls who can list, create or overwrite the objects in a bucket. +// This call does not perform any network operations. +func (b *BucketHandle) ACL() *ACLHandle { + return &b.acl +} + +// DefaultObjectACL returns an ACLHandle, which provides access to the bucket's default object ACLs. +// These ACLs are applied to newly created objects in this bucket that do not have a defined ACL. +// This call does not perform any network operations. +func (b *BucketHandle) DefaultObjectACL() *ACLHandle { + return &b.defaultObjectACL +} + +// Object returns an ObjectHandle, which provides operations on the named object. +// This call does not perform any network operations. +// +// name must consist entirely of valid UTF-8-encoded runes. The full specification +// for valid object names can be found at: +// https://cloud.google.com/storage/docs/bucket-naming +func (b *BucketHandle) Object(name string) *ObjectHandle { + return &ObjectHandle{ + c: b.c, + bucket: b.name, + object: name, + acl: ACLHandle{ + c: b.c, + bucket: b.name, + object: name, + userProject: b.userProject, + }, + gen: -1, + userProject: b.userProject, + } +} + +// Attrs returns the metadata for the bucket. +func (b *BucketHandle) Attrs(ctx context.Context) (attrs *BucketAttrs, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Bucket.Attrs") + defer func() { trace.EndSpan(ctx, err) }() + + req, err := b.newGetCall() + if err != nil { + return nil, err + } + var resp *raw.Bucket + err = runWithRetry(ctx, func() error { + resp, err = req.Context(ctx).Do() + return err + }) + if e, ok := err.(*googleapi.Error); ok && e.Code == http.StatusNotFound { + return nil, ErrBucketNotExist + } + if err != nil { + return nil, err + } + return newBucket(resp) +} + +func (b *BucketHandle) newGetCall() (*raw.BucketsGetCall, error) { + req := b.c.raw.Buckets.Get(b.name).Projection("full") + setClientHeader(req.Header()) + if err := applyBucketConds("BucketHandle.Attrs", b.conds, req); err != nil { + return nil, err + } + if b.userProject != "" { + req.UserProject(b.userProject) + } + return req, nil +} + +// Update updates a bucket's attributes. +func (b *BucketHandle) Update(ctx context.Context, uattrs BucketAttrsToUpdate) (attrs *BucketAttrs, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Bucket.Create") + defer func() { trace.EndSpan(ctx, err) }() + + req, err := b.newPatchCall(&uattrs) + if err != nil { + return nil, err + } + if uattrs.PredefinedACL != "" { + req.PredefinedAcl(uattrs.PredefinedACL) + } + if uattrs.PredefinedDefaultObjectACL != "" { + req.PredefinedDefaultObjectAcl(uattrs.PredefinedDefaultObjectACL) + } + // TODO(jba): retry iff metagen is set? + rb, err := req.Context(ctx).Do() + if err != nil { + return nil, err + } + return newBucket(rb) +} + +func (b *BucketHandle) newPatchCall(uattrs *BucketAttrsToUpdate) (*raw.BucketsPatchCall, error) { + rb := uattrs.toRawBucket() + req := b.c.raw.Buckets.Patch(b.name, rb).Projection("full") + setClientHeader(req.Header()) + if err := applyBucketConds("BucketHandle.Update", b.conds, req); err != nil { + return nil, err + } + if b.userProject != "" { + req.UserProject(b.userProject) + } + return req, nil +} + +// BucketAttrs represents the metadata for a Google Cloud Storage bucket. +// Read-only fields are ignored by BucketHandle.Create. +type BucketAttrs struct { + // Name is the name of the bucket. + // This field is read-only. + Name string + + // ACL is the list of access control rules on the bucket. + ACL []ACLRule + + // DefaultObjectACL is the list of access controls to + // apply to new objects when no object ACL is provided. + DefaultObjectACL []ACLRule + + // DefaultEventBasedHold is the default value for event-based hold on + // newly created objects in this bucket. It defaults to false. + DefaultEventBasedHold bool + + // If not empty, applies a predefined set of access controls. It should be set + // only when creating a bucket. + // It is always empty for BucketAttrs returned from the service. + // See https://cloud.google.com/storage/docs/json_api/v1/buckets/insert + // for valid values. + PredefinedACL string + + // If not empty, applies a predefined set of default object access controls. + // It should be set only when creating a bucket. + // It is always empty for BucketAttrs returned from the service. + // See https://cloud.google.com/storage/docs/json_api/v1/buckets/insert + // for valid values. + PredefinedDefaultObjectACL string + + // Location is the location of the bucket. It defaults to "US". + Location string + + // MetaGeneration is the metadata generation of the bucket. + // This field is read-only. + MetaGeneration int64 + + // 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. + StorageClass string + + // Created is the creation time of the bucket. + // This field is read-only. + Created time.Time + + // VersioningEnabled reports whether this bucket has versioning enabled. + VersioningEnabled bool + + // Labels are the bucket's labels. + Labels map[string]string + + // RequesterPays reports whether the bucket is a Requester Pays bucket. + // Clients performing operations on Requester Pays buckets must provide + // a user project (see BucketHandle.UserProject), which will be billed + // for the operations. + RequesterPays bool + + // Lifecycle is the lifecycle configuration for objects in the bucket. + Lifecycle Lifecycle + + // Retention policy enforces a minimum retention time for all objects + // contained in the bucket. A RetentionPolicy of nil implies the bucket + // has no minimum data retention. + // + // This feature is in private alpha release. It is not currently available to + // most customers. It might be changed in backwards-incompatible ways and is not + // subject to any SLA or deprecation policy. + RetentionPolicy *RetentionPolicy + + // The bucket's Cross-Origin Resource Sharing (CORS) configuration. + CORS []CORS + + // The encryption configuration used by default for newly inserted objects. + Encryption *BucketEncryption + + // The logging configuration. + Logging *BucketLogging + + // The website configuration. + Website *BucketWebsite +} + +// Lifecycle is the lifecycle configuration for objects in the bucket. +type Lifecycle struct { + Rules []LifecycleRule +} + +// RetentionPolicy enforces a minimum retention time for all objects +// contained in the bucket. +// +// Any attempt to overwrite or delete objects younger than the retention +// period will result in an error. An unlocked retention policy can be +// modified or removed from the bucket via the Update method. A +// locked retention policy cannot be removed or shortened in duration +// for the lifetime of the bucket. +// +// This feature is in private alpha release. It is not currently available to +// most customers. It might be changed in backwards-incompatible ways and is not +// subject to any SLA or deprecation policy. +type RetentionPolicy struct { + // RetentionPeriod specifies the duration that objects need to be + // retained. Retention duration must be greater than zero and less than + // 100 years. Note that enforcement of retention periods less than a day + // is not guaranteed. Such periods should only be used for testing + // purposes. + RetentionPeriod time.Duration + + // EffectiveTime is the time from which the policy was enforced and + // effective. This field is read-only. + EffectiveTime time.Time + + // IsLocked describes whether the bucket is locked. Once locked, an + // object retention policy cannot be modified. + // This field is read-only. + IsLocked bool +} + +const ( + // RFC3339 date with only the date segment, used for CreatedBefore in LifecycleRule. + rfc3339Date = "2006-01-02" + + // DeleteAction is a lifecycle action that deletes a live and/or archived + // objects. Takes precedence over SetStorageClass actions. + DeleteAction = "Delete" + + // SetStorageClassAction changes the storage class of live and/or archived + // objects. + SetStorageClassAction = "SetStorageClass" +) + +// LifecycleRule is a lifecycle configuration rule. +// +// When all the configured conditions are met by an object in the bucket, the +// configured action will automatically be taken on that object. +type LifecycleRule struct { + // Action is the action to take when all of the associated conditions are + // met. + Action LifecycleAction + + // Condition is the set of conditions that must be met for the associated + // action to be taken. + Condition LifecycleCondition +} + +// LifecycleAction is a lifecycle configuration action. +type LifecycleAction struct { + // Type is the type of action to take on matching objects. + // + // Acceptable values are "Delete" to delete matching objects and + // "SetStorageClass" to set the storage class defined in StorageClass on + // matching objects. + Type string + + // StorageClass is the storage class to set on matching objects if the Action + // is "SetStorageClass". + StorageClass string +} + +// Liveness specifies whether the object is live or not. +type Liveness int + +const ( + // LiveAndArchived includes both live and archived objects. + LiveAndArchived Liveness = iota + // Live specifies that the object is still live. + Live + // Archived specifies that the object is archived. + Archived +) + +// LifecycleCondition is a set of conditions used to match objects and take an +// action automatically. +// +// All configured conditions must be met for the associated action to be taken. +type LifecycleCondition struct { + // AgeInDays is the age of the object in days. + AgeInDays int64 + + // CreatedBefore is the time the object was created. + // + // This condition is satisfied when an object is created before midnight of + // the specified date in UTC. + CreatedBefore time.Time + + // Liveness specifies the object's liveness. Relevant only for versioned objects + Liveness Liveness + + // MatchesStorageClasses is the condition matching the object's storage + // class. + // + // Values include "MULTI_REGIONAL", "REGIONAL", "NEARLINE", "COLDLINE", + // "STANDARD", and "DURABLE_REDUCED_AVAILABILITY". + MatchesStorageClasses []string + + // NumNewerVersions is the condition matching objects with a number of newer versions. + // + // If the value is N, this condition is satisfied when there are at least N + // versions (including the live version) newer than this version of the + // object. + NumNewerVersions int64 +} + +// BucketLogging holds the bucket's logging configuration, which defines the +// destination bucket and optional name prefix for the current bucket's +// logs. +type BucketLogging struct { + // The destination bucket where the current bucket's logs + // should be placed. + LogBucket string + + // A prefix for log object names. + LogObjectPrefix string +} + +// BucketWebsite holds the bucket's website configuration, controlling how the +// service behaves when accessing bucket contents as a web site. See +// https://cloud.google.com/storage/docs/static-website for more information. +type BucketWebsite struct { + // If the requested object path is missing, the service will ensure the path has + // a trailing '/', append this suffix, and attempt to retrieve the resulting + // object. This allows the creation of index.html objects to represent directory + // pages. + MainPageSuffix string + + // If the requested object path is missing, and any mainPageSuffix object is + // missing, if applicable, the service will return the named object from this + // bucket as the content for a 404 Not Found result. + NotFoundPage string +} + +func newBucket(b *raw.Bucket) (*BucketAttrs, error) { + if b == nil { + return nil, nil + } + rp, err := toRetentionPolicy(b.RetentionPolicy) + if err != nil { + return nil, err + } + return &BucketAttrs{ + Name: b.Name, + Location: b.Location, + MetaGeneration: b.Metageneration, + DefaultEventBasedHold: b.DefaultEventBasedHold, + StorageClass: b.StorageClass, + Created: convertTime(b.TimeCreated), + VersioningEnabled: b.Versioning != nil && b.Versioning.Enabled, + ACL: toBucketACLRules(b.Acl), + DefaultObjectACL: toObjectACLRules(b.DefaultObjectAcl), + Labels: b.Labels, + RequesterPays: b.Billing != nil && b.Billing.RequesterPays, + Lifecycle: toLifecycle(b.Lifecycle), + RetentionPolicy: rp, + CORS: toCORS(b.Cors), + Encryption: toBucketEncryption(b.Encryption), + Logging: toBucketLogging(b.Logging), + Website: toBucketWebsite(b.Website), + }, nil +} + +// toRawBucket copies the editable attribute from b to the raw library's Bucket type. +func (b *BucketAttrs) toRawBucket() *raw.Bucket { + // Copy label map. + var labels map[string]string + if len(b.Labels) > 0 { + labels = make(map[string]string, len(b.Labels)) + for k, v := range b.Labels { + labels[k] = v + } + } + // Ignore VersioningEnabled if it is false. This is OK because + // we only call this method when creating a bucket, and by default + // new buckets have versioning off. + var v *raw.BucketVersioning + if b.VersioningEnabled { + v = &raw.BucketVersioning{Enabled: true} + } + var bb *raw.BucketBilling + if b.RequesterPays { + bb = &raw.BucketBilling{RequesterPays: true} + } + return &raw.Bucket{ + Name: b.Name, + Location: b.Location, + StorageClass: b.StorageClass, + Acl: toRawBucketACL(b.ACL), + DefaultObjectAcl: toRawObjectACL(b.DefaultObjectACL), + Versioning: v, + Labels: labels, + Billing: bb, + Lifecycle: toRawLifecycle(b.Lifecycle), + RetentionPolicy: b.RetentionPolicy.toRawRetentionPolicy(), + Cors: toRawCORS(b.CORS), + Encryption: b.Encryption.toRawBucketEncryption(), + Logging: b.Logging.toRawBucketLogging(), + Website: b.Website.toRawBucketWebsite(), + } +} + +// CORS is the bucket's Cross-Origin Resource Sharing (CORS) configuration. +type CORS struct { + // MaxAge is the value to return in the Access-Control-Max-Age + // header used in preflight responses. + MaxAge time.Duration + + // Methods is the list of HTTP methods on which to include CORS response + // headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list + // of methods, and means "any method". + Methods []string + + // Origins is the list of Origins eligible to receive CORS response + // headers. Note: "*" is permitted in the list of origins, and means + // "any Origin". + Origins []string + + // ResponseHeaders is the list of HTTP headers other than the simple + // response headers to give permission for the user-agent to share + // across domains. + ResponseHeaders []string +} + +// BucketEncryption is a bucket's encryption configuration. +type BucketEncryption struct { + // A Cloud KMS key name, in the form + // projects/P/locations/L/keyRings/R/cryptoKeys/K, that will be used to encrypt + // objects inserted into this bucket, if no encryption method is specified. + // The key's location must be the same as the bucket's. + DefaultKMSKeyName string +} + +// BucketAttrsToUpdate define the attributes to update during an Update call. +type BucketAttrsToUpdate struct { + // If set, updates whether the bucket uses versioning. + VersioningEnabled optional.Bool + + // If set, updates whether the bucket is a Requester Pays bucket. + RequesterPays optional.Bool + + // DefaultEventBasedHold is the default value for event-based hold on + // newly created objects in this bucket. + DefaultEventBasedHold optional.Bool + + // If set, updates the retention policy of the bucket. Using + // RetentionPolicy.RetentionPeriod = 0 will delete the existing policy. + // + // This feature is in private alpha release. It is not currently available to + // most customers. It might be changed in backwards-incompatible ways and is not + // subject to any SLA or deprecation policy. + RetentionPolicy *RetentionPolicy + + // If set, replaces the CORS configuration with a new configuration. + // An empty (rather than nil) slice causes all CORS policies to be removed. + CORS []CORS + + // If set, replaces the encryption configuration of the bucket. Using + // BucketEncryption.DefaultKMSKeyName = "" will delete the existing + // configuration. + Encryption *BucketEncryption + + // If set, replaces the lifecycle configuration of the bucket. + Lifecycle *Lifecycle + + // If set, replaces the logging configuration of the bucket. + Logging *BucketLogging + + // If set, replaces the website configuration of the bucket. + Website *BucketWebsite + + // If not empty, applies a predefined set of access controls. + // See https://cloud.google.com/storage/docs/json_api/v1/buckets/patch. + PredefinedACL string + + // If not empty, applies a predefined set of default object access controls. + // See https://cloud.google.com/storage/docs/json_api/v1/buckets/patch. + PredefinedDefaultObjectACL string + + setLabels map[string]string + deleteLabels map[string]bool +} + +// SetLabel causes a label to be added or modified when ua is used +// in a call to Bucket.Update. +func (ua *BucketAttrsToUpdate) SetLabel(name, value string) { + if ua.setLabels == nil { + ua.setLabels = map[string]string{} + } + ua.setLabels[name] = value +} + +// DeleteLabel causes a label to be deleted when ua is used in a +// call to Bucket.Update. +func (ua *BucketAttrsToUpdate) DeleteLabel(name string) { + if ua.deleteLabels == nil { + ua.deleteLabels = map[string]bool{} + } + ua.deleteLabels[name] = true +} + +func (ua *BucketAttrsToUpdate) toRawBucket() *raw.Bucket { + rb := &raw.Bucket{} + if ua.CORS != nil { + rb.Cors = toRawCORS(ua.CORS) + rb.ForceSendFields = append(rb.ForceSendFields, "Cors") + } + if ua.DefaultEventBasedHold != nil { + rb.DefaultEventBasedHold = optional.ToBool(ua.DefaultEventBasedHold) + rb.ForceSendFields = append(rb.ForceSendFields, "DefaultEventBasedHold") + } + if ua.RetentionPolicy != nil { + if ua.RetentionPolicy.RetentionPeriod == 0 { + rb.NullFields = append(rb.NullFields, "RetentionPolicy") + rb.RetentionPolicy = nil + } else { + rb.RetentionPolicy = ua.RetentionPolicy.toRawRetentionPolicy() + } + } + if ua.VersioningEnabled != nil { + rb.Versioning = &raw.BucketVersioning{ + Enabled: optional.ToBool(ua.VersioningEnabled), + ForceSendFields: []string{"Enabled"}, + } + } + if ua.RequesterPays != nil { + rb.Billing = &raw.BucketBilling{ + RequesterPays: optional.ToBool(ua.RequesterPays), + ForceSendFields: []string{"RequesterPays"}, + } + } + if ua.Encryption != nil { + if ua.Encryption.DefaultKMSKeyName == "" { + rb.NullFields = append(rb.NullFields, "Encryption") + rb.Encryption = nil + } else { + rb.Encryption = ua.Encryption.toRawBucketEncryption() + } + } + if ua.Lifecycle != nil { + rb.Lifecycle = toRawLifecycle(*ua.Lifecycle) + } + if ua.Logging != nil { + if *ua.Logging == (BucketLogging{}) { + rb.NullFields = append(rb.NullFields, "Logging") + rb.Logging = nil + } else { + rb.Logging = ua.Logging.toRawBucketLogging() + } + } + if ua.Website != nil { + if *ua.Website == (BucketWebsite{}) { + rb.NullFields = append(rb.NullFields, "Website") + rb.Website = nil + } else { + rb.Website = ua.Website.toRawBucketWebsite() + } + } + if ua.PredefinedACL != "" { + // Clear ACL or the call will fail. + rb.Acl = nil + rb.ForceSendFields = append(rb.ForceSendFields, "Acl") + } + if ua.PredefinedDefaultObjectACL != "" { + // Clear ACLs or the call will fail. + rb.DefaultObjectAcl = nil + rb.ForceSendFields = append(rb.ForceSendFields, "DefaultObjectAcl") + } + if ua.setLabels != nil || ua.deleteLabels != nil { + rb.Labels = map[string]string{} + for k, v := range ua.setLabels { + rb.Labels[k] = v + } + if len(rb.Labels) == 0 && len(ua.deleteLabels) > 0 { + rb.ForceSendFields = append(rb.ForceSendFields, "Labels") + } + for l := range ua.deleteLabels { + rb.NullFields = append(rb.NullFields, "Labels."+l) + } + } + return rb +} + +// If returns a new BucketHandle that applies a set of preconditions. +// Preconditions already set on the BucketHandle are ignored. +// Operations on the new handle will return an error if the preconditions are not +// satisfied. The only valid preconditions for buckets are MetagenerationMatch +// and MetagenerationNotMatch. +func (b *BucketHandle) If(conds BucketConditions) *BucketHandle { + b2 := *b + b2.conds = &conds + return &b2 +} + +// BucketConditions constrain bucket methods to act on specific metagenerations. +// +// The zero value is an empty set of constraints. +type BucketConditions struct { + // MetagenerationMatch specifies that the bucket must have the given + // metageneration for the operation to occur. + // If MetagenerationMatch is zero, it has no effect. + MetagenerationMatch int64 + + // MetagenerationNotMatch specifies that the bucket must not have the given + // metageneration for the operation to occur. + // If MetagenerationNotMatch is zero, it has no effect. + MetagenerationNotMatch int64 +} + +func (c *BucketConditions) validate(method string) error { + if *c == (BucketConditions{}) { + return fmt.Errorf("storage: %s: empty conditions", method) + } + if c.MetagenerationMatch != 0 && c.MetagenerationNotMatch != 0 { + return fmt.Errorf("storage: %s: multiple conditions specified for metageneration", method) + } + return nil +} + +// UserProject returns a new BucketHandle that passes the project ID as the user +// project for all subsequent calls. Calls with a user project will be billed to that +// project rather than to the bucket's owning project. +// +// A user project is required for all operations on Requester Pays buckets. +func (b *BucketHandle) UserProject(projectID string) *BucketHandle { + b2 := *b + b2.userProject = projectID + b2.acl.userProject = projectID + b2.defaultObjectACL.userProject = projectID + return &b2 +} + +// LockRetentionPolicy locks a bucket's retention policy until a previously-configured +// RetentionPeriod past the EffectiveTime. Note that if RetentionPeriod is set to less +// than a day, the retention policy is treated as a development configuration and locking +// will have no effect. The BucketHandle must have a metageneration condition that +// matches the bucket's metageneration. See BucketHandle.If. +// +// This feature is in private alpha release. It is not currently available to +// most customers. It might be changed in backwards-incompatible ways and is not +// subject to any SLA or deprecation policy. +func (b *BucketHandle) LockRetentionPolicy(ctx context.Context) error { + var metageneration int64 + if b.conds != nil { + metageneration = b.conds.MetagenerationMatch + } + req := b.c.raw.Buckets.LockRetentionPolicy(b.name, metageneration) + _, err := req.Context(ctx).Do() + return err +} + +// applyBucketConds modifies the provided call using the conditions in conds. +// call is something that quacks like a *raw.WhateverCall. +func applyBucketConds(method string, conds *BucketConditions, call interface{}) error { + if conds == nil { + return nil + } + if err := conds.validate(method); err != nil { + return err + } + cval := reflect.ValueOf(call) + switch { + case conds.MetagenerationMatch != 0: + if !setConditionField(cval, "IfMetagenerationMatch", conds.MetagenerationMatch) { + return fmt.Errorf("storage: %s: ifMetagenerationMatch not supported", method) + } + case conds.MetagenerationNotMatch != 0: + if !setConditionField(cval, "IfMetagenerationNotMatch", conds.MetagenerationNotMatch) { + return fmt.Errorf("storage: %s: ifMetagenerationNotMatch not supported", method) + } + } + return nil +} + +func (rp *RetentionPolicy) toRawRetentionPolicy() *raw.BucketRetentionPolicy { + if rp == nil { + return nil + } + return &raw.BucketRetentionPolicy{ + RetentionPeriod: int64(rp.RetentionPeriod / time.Second), + } +} + +func toRetentionPolicy(rp *raw.BucketRetentionPolicy) (*RetentionPolicy, error) { + if rp == nil { + return nil, nil + } + t, err := time.Parse(time.RFC3339, rp.EffectiveTime) + if err != nil { + return nil, err + } + return &RetentionPolicy{ + RetentionPeriod: time.Duration(rp.RetentionPeriod) * time.Second, + EffectiveTime: t, + IsLocked: rp.IsLocked, + }, nil +} + +func toRawCORS(c []CORS) []*raw.BucketCors { + var out []*raw.BucketCors + for _, v := range c { + out = append(out, &raw.BucketCors{ + MaxAgeSeconds: int64(v.MaxAge / time.Second), + Method: v.Methods, + Origin: v.Origins, + ResponseHeader: v.ResponseHeaders, + }) + } + return out +} + +func toCORS(rc []*raw.BucketCors) []CORS { + var out []CORS + for _, v := range rc { + out = append(out, CORS{ + MaxAge: time.Duration(v.MaxAgeSeconds) * time.Second, + Methods: v.Method, + Origins: v.Origin, + ResponseHeaders: v.ResponseHeader, + }) + } + return out +} + +func toRawLifecycle(l Lifecycle) *raw.BucketLifecycle { + var rl raw.BucketLifecycle + if len(l.Rules) == 0 { + return nil + } + for _, r := range l.Rules { + rr := &raw.BucketLifecycleRule{ + Action: &raw.BucketLifecycleRuleAction{ + Type: r.Action.Type, + StorageClass: r.Action.StorageClass, + }, + Condition: &raw.BucketLifecycleRuleCondition{ + Age: r.Condition.AgeInDays, + MatchesStorageClass: r.Condition.MatchesStorageClasses, + NumNewerVersions: r.Condition.NumNewerVersions, + }, + } + + switch r.Condition.Liveness { + case LiveAndArchived: + rr.Condition.IsLive = nil + case Live: + rr.Condition.IsLive = googleapi.Bool(true) + case Archived: + rr.Condition.IsLive = googleapi.Bool(false) + } + + if !r.Condition.CreatedBefore.IsZero() { + rr.Condition.CreatedBefore = r.Condition.CreatedBefore.Format(rfc3339Date) + } + rl.Rule = append(rl.Rule, rr) + } + return &rl +} + +func toLifecycle(rl *raw.BucketLifecycle) Lifecycle { + var l Lifecycle + if rl == nil { + return l + } + for _, rr := range rl.Rule { + r := LifecycleRule{ + Action: LifecycleAction{ + Type: rr.Action.Type, + StorageClass: rr.Action.StorageClass, + }, + Condition: LifecycleCondition{ + AgeInDays: rr.Condition.Age, + MatchesStorageClasses: rr.Condition.MatchesStorageClass, + NumNewerVersions: rr.Condition.NumNewerVersions, + }, + } + + switch { + case rr.Condition.IsLive == nil: + r.Condition.Liveness = LiveAndArchived + case *rr.Condition.IsLive == true: + r.Condition.Liveness = Live + case *rr.Condition.IsLive == false: + r.Condition.Liveness = Archived + } + + if rr.Condition.CreatedBefore != "" { + r.Condition.CreatedBefore, _ = time.Parse(rfc3339Date, rr.Condition.CreatedBefore) + } + l.Rules = append(l.Rules, r) + } + return l +} + +func (e *BucketEncryption) toRawBucketEncryption() *raw.BucketEncryption { + if e == nil { + return nil + } + return &raw.BucketEncryption{ + DefaultKmsKeyName: e.DefaultKMSKeyName, + } +} + +func toBucketEncryption(e *raw.BucketEncryption) *BucketEncryption { + if e == nil { + return nil + } + return &BucketEncryption{DefaultKMSKeyName: e.DefaultKmsKeyName} +} + +func (b *BucketLogging) toRawBucketLogging() *raw.BucketLogging { + if b == nil { + return nil + } + return &raw.BucketLogging{ + LogBucket: b.LogBucket, + LogObjectPrefix: b.LogObjectPrefix, + } +} + +func toBucketLogging(b *raw.BucketLogging) *BucketLogging { + if b == nil { + return nil + } + return &BucketLogging{ + LogBucket: b.LogBucket, + LogObjectPrefix: b.LogObjectPrefix, + } +} + +func (w *BucketWebsite) toRawBucketWebsite() *raw.BucketWebsite { + if w == nil { + return nil + } + return &raw.BucketWebsite{ + MainPageSuffix: w.MainPageSuffix, + NotFoundPage: w.NotFoundPage, + } +} + +func toBucketWebsite(w *raw.BucketWebsite) *BucketWebsite { + if w == nil { + return nil + } + return &BucketWebsite{ + MainPageSuffix: w.MainPageSuffix, + NotFoundPage: w.NotFoundPage, + } +} + +// Objects returns an iterator over the objects in the bucket that match the Query q. +// If q is nil, no filtering is done. +func (b *BucketHandle) Objects(ctx context.Context, q *Query) *ObjectIterator { + it := &ObjectIterator{ + ctx: ctx, + bucket: b, + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.items) }, + func() interface{} { b := it.items; it.items = nil; return b }) + if q != nil { + it.query = *q + } + return it +} + +// An ObjectIterator is an iterator over ObjectAttrs. +type ObjectIterator struct { + ctx context.Context + bucket *BucketHandle + query Query + pageInfo *iterator.PageInfo + nextFunc func() error + items []*ObjectAttrs +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ObjectIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +// Next returns the next result. Its second return value is iterator.Done if +// there are no more results. Once Next returns iterator.Done, all subsequent +// calls will return iterator.Done. +// +// If Query.Delimiter is non-empty, some of the ObjectAttrs returned by Next will +// have a non-empty Prefix field, and a zero value for all other fields. These +// represent prefixes. +func (it *ObjectIterator) Next() (*ObjectAttrs, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + item := it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ObjectIterator) fetch(pageSize int, pageToken string) (string, error) { + req := it.bucket.c.raw.Objects.List(it.bucket.name) + setClientHeader(req.Header()) + req.Projection("full") + req.Delimiter(it.query.Delimiter) + req.Prefix(it.query.Prefix) + req.Versions(it.query.Versions) + req.PageToken(pageToken) + if it.bucket.userProject != "" { + req.UserProject(it.bucket.userProject) + } + if pageSize > 0 { + req.MaxResults(int64(pageSize)) + } + var resp *raw.Objects + var err error + err = runWithRetry(it.ctx, func() error { + resp, err = req.Context(it.ctx).Do() + return err + }) + if err != nil { + if e, ok := err.(*googleapi.Error); ok && e.Code == http.StatusNotFound { + err = ErrBucketNotExist + } + return "", err + } + for _, item := range resp.Items { + it.items = append(it.items, newObject(item)) + } + for _, prefix := range resp.Prefixes { + it.items = append(it.items, &ObjectAttrs{Prefix: prefix}) + } + return resp.NextPageToken, nil +} + +// Buckets returns an iterator over the buckets in the project. You may +// optionally set the iterator's Prefix field to restrict the list to buckets +// whose names begin with the prefix. By default, all buckets in the project +// are returned. +func (c *Client) Buckets(ctx context.Context, projectID string) *BucketIterator { + it := &BucketIterator{ + ctx: ctx, + client: c, + projectID: projectID, + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( + it.fetch, + func() int { return len(it.buckets) }, + func() interface{} { b := it.buckets; it.buckets = nil; return b }) + return it +} + +// A BucketIterator is an iterator over BucketAttrs. +type BucketIterator struct { + // Prefix restricts the iterator to buckets whose names begin with it. + Prefix string + + ctx context.Context + client *Client + projectID string + buckets []*BucketAttrs + pageInfo *iterator.PageInfo + nextFunc func() error +} + +// Next returns the next result. Its second return value is iterator.Done if +// there are no more results. Once Next returns iterator.Done, all subsequent +// calls will return iterator.Done. +func (it *BucketIterator) Next() (*BucketAttrs, error) { + if err := it.nextFunc(); err != nil { + return nil, err + } + b := it.buckets[0] + it.buckets = it.buckets[1:] + return b, nil +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *BucketIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } + +func (it *BucketIterator) fetch(pageSize int, pageToken string) (token string, err error) { + req := it.client.raw.Buckets.List(it.projectID) + setClientHeader(req.Header()) + req.Projection("full") + req.Prefix(it.Prefix) + req.PageToken(pageToken) + if pageSize > 0 { + req.MaxResults(int64(pageSize)) + } + var resp *raw.Buckets + err = runWithRetry(it.ctx, func() error { + resp, err = req.Context(it.ctx).Do() + return err + }) + if err != nil { + return "", err + } + for _, item := range resp.Items { + b, err := newBucket(item) + if err != nil { + return "", err + } + it.buckets = append(it.buckets, b) + } + return resp.NextPageToken, nil +} diff --git a/vendor/cloud.google.com/go/storage/bucket_test.go b/vendor/cloud.google.com/go/storage/bucket_test.go new file mode 100644 index 000000000..9df3ead1c --- /dev/null +++ b/vendor/cloud.google.com/go/storage/bucket_test.go @@ -0,0 +1,441 @@ +// Copyright 2017 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 storage + +import ( + "net/http" + "reflect" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "google.golang.org/api/googleapi" + raw "google.golang.org/api/storage/v1" +) + +func TestBucketAttrsToRawBucket(t *testing.T) { + t.Parallel() + attrs := &BucketAttrs{ + Name: "name", + ACL: []ACLRule{{Entity: "bob@example.com", Role: RoleOwner, Domain: "d", Email: "e"}}, + DefaultObjectACL: []ACLRule{{Entity: AllUsers, Role: RoleReader, EntityID: "eid", + ProjectTeam: &ProjectTeam{ProjectNumber: "17", Team: "t"}}}, + Location: "loc", + StorageClass: "class", + RetentionPolicy: &RetentionPolicy{ + RetentionPeriod: 3 * time.Second, + }, + VersioningEnabled: false, + // should be ignored: + MetaGeneration: 39, + Created: time.Now(), + Labels: map[string]string{"label": "value"}, + CORS: []CORS{ + { + MaxAge: time.Hour, + Methods: []string{"GET", "POST"}, + Origins: []string{"*"}, + ResponseHeaders: []string{"FOO"}, + }, + }, + Encryption: &BucketEncryption{DefaultKMSKeyName: "key"}, + Logging: &BucketLogging{LogBucket: "lb", LogObjectPrefix: "p"}, + Website: &BucketWebsite{MainPageSuffix: "mps", NotFoundPage: "404"}, + Lifecycle: Lifecycle{ + Rules: []LifecycleRule{{ + Action: LifecycleAction{ + Type: SetStorageClassAction, + StorageClass: "NEARLINE", + }, + Condition: LifecycleCondition{ + AgeInDays: 10, + Liveness: Live, + CreatedBefore: time.Date(2017, 1, 2, 3, 4, 5, 6, time.UTC), + MatchesStorageClasses: []string{"MULTI_REGIONAL", "REGIONAL", "STANDARD"}, + NumNewerVersions: 3, + }, + }, { + Action: LifecycleAction{ + Type: DeleteAction, + }, + Condition: LifecycleCondition{ + AgeInDays: 30, + Liveness: Live, + CreatedBefore: time.Date(2017, 1, 2, 3, 4, 5, 6, time.UTC), + MatchesStorageClasses: []string{"NEARLINE"}, + NumNewerVersions: 10, + }, + }, { + Action: LifecycleAction{ + Type: DeleteAction, + }, + Condition: LifecycleCondition{ + Liveness: Archived, + }, + }}, + }, + } + got := attrs.toRawBucket() + want := &raw.Bucket{ + Name: "name", + Acl: []*raw.BucketAccessControl{ + {Entity: "bob@example.com", Role: "OWNER"}, // other fields ignored on create/update + }, + DefaultObjectAcl: []*raw.ObjectAccessControl{ + {Entity: "allUsers", Role: "READER"}, // other fields ignored on create/update + }, + Location: "loc", + StorageClass: "class", + RetentionPolicy: &raw.BucketRetentionPolicy{ + RetentionPeriod: 3, + }, + Versioning: nil, // ignore VersioningEnabled if false + Labels: map[string]string{"label": "value"}, + Cors: []*raw.BucketCors{ + { + MaxAgeSeconds: 3600, + Method: []string{"GET", "POST"}, + Origin: []string{"*"}, + ResponseHeader: []string{"FOO"}, + }, + }, + Encryption: &raw.BucketEncryption{DefaultKmsKeyName: "key"}, + Logging: &raw.BucketLogging{LogBucket: "lb", LogObjectPrefix: "p"}, + Website: &raw.BucketWebsite{MainPageSuffix: "mps", NotFoundPage: "404"}, + Lifecycle: &raw.BucketLifecycle{ + Rule: []*raw.BucketLifecycleRule{{ + Action: &raw.BucketLifecycleRuleAction{ + Type: SetStorageClassAction, + StorageClass: "NEARLINE", + }, + Condition: &raw.BucketLifecycleRuleCondition{ + Age: 10, + IsLive: googleapi.Bool(true), + CreatedBefore: "2017-01-02", + MatchesStorageClass: []string{"MULTI_REGIONAL", "REGIONAL", "STANDARD"}, + NumNewerVersions: 3, + }, + }, { + Action: &raw.BucketLifecycleRuleAction{ + Type: DeleteAction, + }, + Condition: &raw.BucketLifecycleRuleCondition{ + Age: 30, + IsLive: googleapi.Bool(true), + CreatedBefore: "2017-01-02", + MatchesStorageClass: []string{"NEARLINE"}, + NumNewerVersions: 10, + }, + }, { + Action: &raw.BucketLifecycleRuleAction{ + Type: DeleteAction, + }, + Condition: &raw.BucketLifecycleRuleCondition{ + IsLive: googleapi.Bool(false), + }, + }}, + }, + } + if msg := testutil.Diff(got, want); msg != "" { + t.Error(msg) + } + + attrs.VersioningEnabled = true + attrs.RequesterPays = true + got = attrs.toRawBucket() + want.Versioning = &raw.BucketVersioning{Enabled: true} + want.Billing = &raw.BucketBilling{RequesterPays: true} + if msg := testutil.Diff(got, want); msg != "" { + t.Error(msg) + } +} + +func TestBucketAttrsToUpdateToRawBucket(t *testing.T) { + t.Parallel() + au := &BucketAttrsToUpdate{ + VersioningEnabled: false, + RequesterPays: false, + DefaultEventBasedHold: false, + RetentionPolicy: &RetentionPolicy{RetentionPeriod: time.Hour}, + Encryption: &BucketEncryption{DefaultKMSKeyName: "key2"}, + Lifecycle: &Lifecycle{ + Rules: []LifecycleRule{ + { + Action: LifecycleAction{Type: "Delete"}, + Condition: LifecycleCondition{AgeInDays: 30}, + }, + }, + }, + Logging: &BucketLogging{LogBucket: "lb", LogObjectPrefix: "p"}, + Website: &BucketWebsite{MainPageSuffix: "mps", NotFoundPage: "404"}, + } + au.SetLabel("a", "foo") + au.DeleteLabel("b") + au.SetLabel("c", "") + got := au.toRawBucket() + want := &raw.Bucket{ + Versioning: &raw.BucketVersioning{ + Enabled: false, + ForceSendFields: []string{"Enabled"}, + }, + Labels: map[string]string{ + "a": "foo", + "c": "", + }, + Billing: &raw.BucketBilling{ + RequesterPays: false, + ForceSendFields: []string{"RequesterPays"}, + }, + DefaultEventBasedHold: false, + RetentionPolicy: &raw.BucketRetentionPolicy{RetentionPeriod: 3600}, + Encryption: &raw.BucketEncryption{DefaultKmsKeyName: "key2"}, + NullFields: []string{"Labels.b"}, + Lifecycle: &raw.BucketLifecycle{ + Rule: []*raw.BucketLifecycleRule{ + { + Action: &raw.BucketLifecycleRuleAction{Type: "Delete"}, + Condition: &raw.BucketLifecycleRuleCondition{Age: 30}, + }, + }, + }, + Logging: &raw.BucketLogging{LogBucket: "lb", LogObjectPrefix: "p"}, + Website: &raw.BucketWebsite{MainPageSuffix: "mps", NotFoundPage: "404"}, + ForceSendFields: []string{"DefaultEventBasedHold"}, + } + if msg := testutil.Diff(got, want); msg != "" { + t.Error(msg) + } + + var au2 BucketAttrsToUpdate + au2.DeleteLabel("b") + got = au2.toRawBucket() + want = &raw.Bucket{ + Labels: map[string]string{}, + ForceSendFields: []string{"Labels"}, + NullFields: []string{"Labels.b"}, + } + if msg := testutil.Diff(got, want); msg != "" { + t.Error(msg) + } + + // Test nulls. + au3 := &BucketAttrsToUpdate{ + RetentionPolicy: &RetentionPolicy{}, + Encryption: &BucketEncryption{}, + Logging: &BucketLogging{}, + Website: &BucketWebsite{}, + } + got = au3.toRawBucket() + want = &raw.Bucket{ + NullFields: []string{"RetentionPolicy", "Encryption", "Logging", "Website"}, + } + if msg := testutil.Diff(got, want); msg != "" { + t.Error(msg) + } +} + +func TestCallBuilders(t *testing.T) { + rc, err := raw.New(&http.Client{}) + if err != nil { + t.Fatal(err) + } + c := &Client{raw: rc} + const metagen = 17 + + b := c.Bucket("name") + bm := b.If(BucketConditions{MetagenerationMatch: metagen}).UserProject("p") + + equal := func(x, y interface{}) bool { + return testutil.Equal(x, y, + cmp.AllowUnexported( + raw.BucketsGetCall{}, + raw.BucketsDeleteCall{}, + raw.BucketsPatchCall{}, + ), + cmp.FilterPath(func(p cmp.Path) bool { + return p[len(p)-1].Type() == reflect.TypeOf(&raw.Service{}) + }, cmp.Ignore()), + ) + } + + for i, test := range []struct { + callFunc func(*BucketHandle) (interface{}, error) + want interface { + Header() http.Header + } + metagenFunc func(interface{}) + }{ + { + func(b *BucketHandle) (interface{}, error) { return b.newGetCall() }, + rc.Buckets.Get("name").Projection("full"), + func(req interface{}) { req.(*raw.BucketsGetCall).IfMetagenerationMatch(metagen).UserProject("p") }, + }, + { + func(b *BucketHandle) (interface{}, error) { return b.newDeleteCall() }, + rc.Buckets.Delete("name"), + func(req interface{}) { req.(*raw.BucketsDeleteCall).IfMetagenerationMatch(metagen).UserProject("p") }, + }, + { + func(b *BucketHandle) (interface{}, error) { + return b.newPatchCall(&BucketAttrsToUpdate{ + VersioningEnabled: false, + RequesterPays: false, + }) + }, + rc.Buckets.Patch("name", &raw.Bucket{ + Versioning: &raw.BucketVersioning{ + Enabled: false, + ForceSendFields: []string{"Enabled"}, + }, + Billing: &raw.BucketBilling{ + RequesterPays: false, + ForceSendFields: []string{"RequesterPays"}, + }, + }).Projection("full"), + func(req interface{}) { req.(*raw.BucketsPatchCall).IfMetagenerationMatch(metagen).UserProject("p") }, + }, + } { + got, err := test.callFunc(b) + if err != nil { + t.Fatal(err) + } + setClientHeader(test.want.Header()) + if !equal(got, test.want) { + t.Errorf("#%d: got %#v, want %#v", i, got, test.want) + } + got, err = test.callFunc(bm) + if err != nil { + t.Fatal(err) + } + test.metagenFunc(test.want) + if !equal(got, test.want) { + t.Errorf("#%d:\ngot %#v\nwant %#v", i, got, test.want) + } + } + + // Error. + bm = b.If(BucketConditions{MetagenerationMatch: 1, MetagenerationNotMatch: 2}) + if _, err := bm.newGetCall(); err == nil { + t.Errorf("got nil, want error") + } + if _, err := bm.newDeleteCall(); err == nil { + t.Errorf("got nil, want error") + } + if _, err := bm.newPatchCall(&BucketAttrsToUpdate{}); err == nil { + t.Errorf("got nil, want error") + } +} + +func TestNewBucket(t *testing.T) { + labels := map[string]string{"a": "b"} + matchClasses := []string{"MULTI_REGIONAL", "REGIONAL", "STANDARD"} + rb := &raw.Bucket{ + Name: "name", + Location: "loc", + DefaultEventBasedHold: true, + Metageneration: 3, + StorageClass: "sc", + TimeCreated: "2017-10-23T04:05:06Z", + Versioning: &raw.BucketVersioning{Enabled: true}, + Labels: labels, + Billing: &raw.BucketBilling{RequesterPays: true}, + Lifecycle: &raw.BucketLifecycle{ + Rule: []*raw.BucketLifecycleRule{{ + Action: &raw.BucketLifecycleRuleAction{ + Type: "SetStorageClass", + StorageClass: "NEARLINE", + }, + Condition: &raw.BucketLifecycleRuleCondition{ + Age: 10, + IsLive: googleapi.Bool(true), + CreatedBefore: "2017-01-02", + MatchesStorageClass: matchClasses, + NumNewerVersions: 3, + }, + }}, + }, + RetentionPolicy: &raw.BucketRetentionPolicy{ + RetentionPeriod: 3, + EffectiveTime: time.Now().Format(time.RFC3339), + }, + Cors: []*raw.BucketCors{ + { + MaxAgeSeconds: 3600, + Method: []string{"GET", "POST"}, + Origin: []string{"*"}, + ResponseHeader: []string{"FOO"}, + }, + }, + Acl: []*raw.BucketAccessControl{ + {Bucket: "name", Role: "READER", Email: "joe@example.com", Entity: "allUsers"}, + }, + Encryption: &raw.BucketEncryption{DefaultKmsKeyName: "key"}, + Logging: &raw.BucketLogging{LogBucket: "lb", LogObjectPrefix: "p"}, + Website: &raw.BucketWebsite{MainPageSuffix: "mps", NotFoundPage: "404"}, + } + want := &BucketAttrs{ + Name: "name", + Location: "loc", + DefaultEventBasedHold: true, + MetaGeneration: 3, + StorageClass: "sc", + Created: time.Date(2017, 10, 23, 4, 5, 6, 0, time.UTC), + VersioningEnabled: true, + Labels: labels, + RequesterPays: true, + Lifecycle: Lifecycle{ + Rules: []LifecycleRule{ + { + Action: LifecycleAction{ + Type: SetStorageClassAction, + StorageClass: "NEARLINE", + }, + Condition: LifecycleCondition{ + AgeInDays: 10, + Liveness: Live, + CreatedBefore: time.Date(2017, 1, 2, 0, 0, 0, 0, time.UTC), + MatchesStorageClasses: matchClasses, + NumNewerVersions: 3, + }, + }, + }, + }, + RetentionPolicy: &RetentionPolicy{ + RetentionPeriod: 3 * time.Second, + }, + CORS: []CORS{ + { + MaxAge: time.Hour, + Methods: []string{"GET", "POST"}, + Origins: []string{"*"}, + ResponseHeaders: []string{"FOO"}, + }, + }, + Encryption: &BucketEncryption{DefaultKMSKeyName: "key"}, + Logging: &BucketLogging{LogBucket: "lb", LogObjectPrefix: "p"}, + Website: &BucketWebsite{MainPageSuffix: "mps", NotFoundPage: "404"}, + ACL: []ACLRule{{Entity: "allUsers", Role: RoleReader, Email: "joe@example.com"}}, + DefaultObjectACL: nil, + } + got, err := newBucket(rb) + if err != nil { + t.Fatal(err) + } + if diff := testutil.Diff(got, want, cmpopts.IgnoreTypes(time.Time{})); diff != "" { + t.Errorf("got=-, want=+:\n%s", diff) + } +} diff --git a/vendor/cloud.google.com/go/storage/copy.go b/vendor/cloud.google.com/go/storage/copy.go new file mode 100644 index 000000000..52162e72d --- /dev/null +++ b/vendor/cloud.google.com/go/storage/copy.go @@ -0,0 +1,228 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + "errors" + "fmt" + + "cloud.google.com/go/internal/trace" + raw "google.golang.org/api/storage/v1" +) + +// CopierFrom creates a Copier that can copy src to dst. +// You can immediately call Run on the returned Copier, or +// you can configure it first. +// +// For Requester Pays buckets, the user project of dst is billed, unless it is empty, +// in which case the user project of src is billed. +func (dst *ObjectHandle) CopierFrom(src *ObjectHandle) *Copier { + return &Copier{dst: dst, src: src} +} + +// A Copier copies a source object to a destination. +type Copier struct { + // ObjectAttrs are optional attributes to set on the destination object. + // Any attributes must be initialized before any calls on the Copier. Nil + // or zero-valued attributes are ignored. + ObjectAttrs + + // RewriteToken can be set before calling Run to resume a copy + // operation. After Run returns a non-nil error, RewriteToken will + // have been updated to contain the value needed to resume the copy. + RewriteToken string + + // ProgressFunc can be used to monitor the progress of a multi-RPC copy + // operation. If ProgressFunc is not nil and copying requires multiple + // calls to the underlying service (see + // https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite), then + // ProgressFunc will be invoked after each call with the number of bytes of + // content copied so far and the total size in bytes of the source object. + // + // ProgressFunc is intended to make upload progress available to the + // application. For example, the implementation of ProgressFunc may update + // a progress bar in the application's UI, or log the result of + // float64(copiedBytes)/float64(totalBytes). + // + // ProgressFunc should return quickly without blocking. + ProgressFunc func(copiedBytes, totalBytes uint64) + + // The Cloud KMS key, in the form projects/P/locations/L/keyRings/R/cryptoKeys/K, + // that will be used to encrypt the object. Overrides the object's KMSKeyName, if + // any. + // + // Providing both a DestinationKMSKeyName and a customer-supplied encryption key + // (via ObjectHandle.Key) on the destination object will result in an error when + // Run is called. + DestinationKMSKeyName string + + dst, src *ObjectHandle +} + +// Run performs the copy. +func (c *Copier) Run(ctx context.Context) (attrs *ObjectAttrs, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Copier.Run") + defer func() { trace.EndSpan(ctx, err) }() + + if err := c.src.validate(); err != nil { + return nil, err + } + if err := c.dst.validate(); err != nil { + return nil, err + } + if c.DestinationKMSKeyName != "" && c.dst.encryptionKey != nil { + return nil, errors.New("storage: cannot use DestinationKMSKeyName with a customer-supplied encryption key") + } + // Convert destination attributes to raw form, omitting the bucket. + // If the bucket is included but name or content-type aren't, the service + // returns a 400 with "Required" as the only message. Omitting the bucket + // does not cause any problems. + rawObject := c.ObjectAttrs.toRawObject("") + for { + res, err := c.callRewrite(ctx, rawObject) + if err != nil { + return nil, err + } + if c.ProgressFunc != nil { + c.ProgressFunc(uint64(res.TotalBytesRewritten), uint64(res.ObjectSize)) + } + if res.Done { // Finished successfully. + return newObject(res.Resource), nil + } + } +} + +func (c *Copier) callRewrite(ctx context.Context, rawObj *raw.Object) (*raw.RewriteResponse, error) { + call := c.dst.c.raw.Objects.Rewrite(c.src.bucket, c.src.object, c.dst.bucket, c.dst.object, rawObj) + + call.Context(ctx).Projection("full") + if c.RewriteToken != "" { + call.RewriteToken(c.RewriteToken) + } + if c.DestinationKMSKeyName != "" { + call.DestinationKmsKeyName(c.DestinationKMSKeyName) + } + if c.PredefinedACL != "" { + call.DestinationPredefinedAcl(c.PredefinedACL) + } + if err := applyConds("Copy destination", c.dst.gen, c.dst.conds, call); err != nil { + return nil, err + } + if c.dst.userProject != "" { + call.UserProject(c.dst.userProject) + } else if c.src.userProject != "" { + call.UserProject(c.src.userProject) + } + if err := applySourceConds(c.src.gen, c.src.conds, call); err != nil { + return nil, err + } + if err := setEncryptionHeaders(call.Header(), c.dst.encryptionKey, false); err != nil { + return nil, err + } + if err := setEncryptionHeaders(call.Header(), c.src.encryptionKey, true); err != nil { + return nil, err + } + var res *raw.RewriteResponse + var err error + setClientHeader(call.Header()) + err = runWithRetry(ctx, func() error { res, err = call.Do(); return err }) + if err != nil { + return nil, err + } + c.RewriteToken = res.RewriteToken + return res, nil +} + +// ComposerFrom creates a Composer that can compose srcs into dst. +// You can immediately call Run on the returned Composer, or you can +// configure it first. +// +// The encryption key for the destination object will be used to decrypt all +// source objects and encrypt the destination object. It is an error +// to specify an encryption key for any of the source objects. +func (dst *ObjectHandle) ComposerFrom(srcs ...*ObjectHandle) *Composer { + return &Composer{dst: dst, srcs: srcs} +} + +// A Composer composes source objects into a destination object. +// +// For Requester Pays buckets, the user project of dst is billed. +type Composer struct { + // ObjectAttrs are optional attributes to set on the destination object. + // Any attributes must be initialized before any calls on the Composer. Nil + // or zero-valued attributes are ignored. + ObjectAttrs + + dst *ObjectHandle + srcs []*ObjectHandle +} + +// Run performs the compose operation. +func (c *Composer) Run(ctx context.Context) (attrs *ObjectAttrs, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Composer.Run") + defer func() { trace.EndSpan(ctx, err) }() + + if err := c.dst.validate(); err != nil { + return nil, err + } + if len(c.srcs) == 0 { + return nil, errors.New("storage: at least one source object must be specified") + } + + req := &raw.ComposeRequest{} + // Compose requires a non-empty Destination, so we always set it, + // even if the caller-provided ObjectAttrs is the zero value. + req.Destination = c.ObjectAttrs.toRawObject(c.dst.bucket) + for _, src := range c.srcs { + if err := src.validate(); err != nil { + return nil, err + } + if src.bucket != c.dst.bucket { + return nil, fmt.Errorf("storage: all source objects must be in bucket %q, found %q", c.dst.bucket, src.bucket) + } + if src.encryptionKey != nil { + return nil, fmt.Errorf("storage: compose source %s.%s must not have encryption key", src.bucket, src.object) + } + srcObj := &raw.ComposeRequestSourceObjects{ + Name: src.object, + } + if err := applyConds("ComposeFrom source", src.gen, src.conds, composeSourceObj{srcObj}); err != nil { + return nil, err + } + req.SourceObjects = append(req.SourceObjects, srcObj) + } + + call := c.dst.c.raw.Objects.Compose(c.dst.bucket, c.dst.object, req).Context(ctx) + if err := applyConds("ComposeFrom destination", c.dst.gen, c.dst.conds, call); err != nil { + return nil, err + } + if c.dst.userProject != "" { + call.UserProject(c.dst.userProject) + } + if c.PredefinedACL != "" { + call.DestinationPredefinedAcl(c.PredefinedACL) + } + if err := setEncryptionHeaders(call.Header(), c.dst.encryptionKey, false); err != nil { + return nil, err + } + var obj *raw.Object + setClientHeader(call.Header()) + err = runWithRetry(ctx, func() error { obj, err = call.Do(); return err }) + if err != nil { + return nil, err + } + return newObject(obj), nil +} diff --git a/vendor/cloud.google.com/go/storage/copy_test.go b/vendor/cloud.google.com/go/storage/copy_test.go new file mode 100644 index 000000000..5f1515646 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/copy_test.go @@ -0,0 +1,71 @@ +// 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. + +package storage + +import ( + "context" + "strings" + "testing" +) + +func TestCopyMissingFields(t *testing.T) { + // Verify that copying checks for missing fields.a + t.Parallel() + var tests = []struct { + srcBucket, srcName, destBucket, destName string + errMsg string + }{ + { + "mybucket", "", "mybucket", "destname", + "name is empty", + }, + { + "mybucket", "srcname", "mybucket", "", + "name is empty", + }, + { + "", "srcfile", "mybucket", "destname", + "name is empty", + }, + { + "mybucket", "srcfile", "", "destname", + "name is empty", + }, + } + ctx := context.Background() + client := mockClient(t, &mockTransport{}) + for i, test := range tests { + src := client.Bucket(test.srcBucket).Object(test.srcName) + dst := client.Bucket(test.destBucket).Object(test.destName) + _, err := dst.CopierFrom(src).Run(ctx) + if !strings.Contains(err.Error(), test.errMsg) { + t.Errorf("CopyTo test #%v:\ngot err %q\nwant err %q", i, err, test.errMsg) + } + } +} + +func TestCopyBothEncryptionKeys(t *testing.T) { + // Test that using both a customer-supplied key and a KMS key is an error. + ctx := context.Background() + client := mockClient(t, &mockTransport{}) + dest := client.Bucket("b").Object("d").Key(testEncryptionKey) + c := dest.CopierFrom(client.Bucket("b").Object("s")) + c.DestinationKMSKeyName = "key" + if _, err := c.Run(ctx); err == nil { + t.Error("got nil, want error") + } else if !strings.Contains(err.Error(), "KMS") { + t.Errorf(`got %q, want it to contain "KMS"`, err) + } +} diff --git a/vendor/cloud.google.com/go/storage/doc.go b/vendor/cloud.google.com/go/storage/doc.go new file mode 100644 index 000000000..e277f1d95 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/doc.go @@ -0,0 +1,176 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package storage provides an easy way to work with Google Cloud Storage. +Google Cloud Storage stores data in named objects, which are grouped into buckets. + +More information about Google Cloud Storage is available at +https://cloud.google.com/storage/docs. + +See https://godoc.org/cloud.google.com/go for authentication, timeouts, +connection pooling and similar aspects of this package. + +All of the methods of this package use exponential backoff to retry calls that fail +with certain errors, as described in +https://cloud.google.com/storage/docs/exponential-backoff. Retrying continues +indefinitely unless the controlling context is canceled or the client is closed. See +context.WithTimeout and context.WithCancel. + + +Creating a Client + +To start working with this package, create a client: + + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + +The client will use your default application credentials. + +If you only wish to access public data, you can create +an unauthenticated client with + + client, err := storage.NewClient(ctx, option.WithoutAuthentication()) + +Buckets + +A Google Cloud Storage bucket is a collection of objects. To work with a +bucket, make a bucket handle: + + bkt := client.Bucket(bucketName) + +A handle is a reference to a bucket. You can have a handle even if the +bucket doesn't exist yet. To create a bucket in Google Cloud Storage, +call Create on the handle: + + if err := bkt.Create(ctx, projectID, nil); err != nil { + // TODO: Handle error. + } + +Note that although buckets are associated with projects, bucket names are +global across all projects. + +Each bucket has associated metadata, represented in this package by +BucketAttrs. The third argument to BucketHandle.Create allows you to set +the initial BucketAttrs of a bucket. To retrieve a bucket's attributes, use +Attrs: + + attrs, err := bkt.Attrs(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Printf("bucket %s, created at %s, is located in %s with storage class %s\n", + attrs.Name, attrs.Created, attrs.Location, attrs.StorageClass) + +Objects + +An object holds arbitrary data as a sequence of bytes, like a file. You +refer to objects using a handle, just as with buckets, but unlike buckets +you don't explicitly create an object. Instead, the first time you write +to an object it will be created. You can use the standard Go io.Reader +and io.Writer interfaces to read and write object data: + + obj := bkt.Object("data") + // Write something to obj. + // w implements io.Writer. + w := obj.NewWriter(ctx) + // Write some text to obj. This will either create the object or overwrite whatever is there already. + if _, err := fmt.Fprintf(w, "This object contains text.\n"); err != nil { + // TODO: Handle error. + } + // Close, just like writing a file. + if err := w.Close(); err != nil { + // TODO: Handle error. + } + + // Read it back. + r, err := obj.NewReader(ctx) + if err != nil { + // TODO: Handle error. + } + defer r.Close() + if _, err := io.Copy(os.Stdout, r); err != nil { + // TODO: Handle error. + } + // Prints "This object contains text." + +Objects also have attributes, which you can fetch with Attrs: + + objAttrs, err := obj.Attrs(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Printf("object %s has size %d and can be read using %s\n", + objAttrs.Name, objAttrs.Size, objAttrs.MediaLink) + +ACLs + +Both objects and buckets have ACLs (Access Control Lists). An ACL is a list of +ACLRules, each of which specifies the role of a user, group or project. ACLs +are suitable for fine-grained control, but you may prefer using IAM to control +access at the project level (see +https://cloud.google.com/storage/docs/access-control/iam). + +To list the ACLs of a bucket or object, obtain an ACLHandle and call its List method: + + acls, err := obj.ACL().List(ctx) + if err != nil { + // TODO: Handle error. + } + for _, rule := range acls { + fmt.Printf("%s has role %s\n", rule.Entity, rule.Role) + } + +You can also set and delete ACLs. + +Conditions + +Every object has a generation and a metageneration. The generation changes +whenever the content changes, and the metageneration changes whenever the +metadata changes. Conditions let you check these values before an operation; +the operation only executes if the conditions match. You can use conditions to +prevent race conditions in read-modify-write operations. + +For example, say you've read an object's metadata into objAttrs. Now +you want to write to that object, but only if its contents haven't changed +since you read it. Here is how to express that: + + w = obj.If(storage.Conditions{GenerationMatch: objAttrs.Generation}).NewWriter(ctx) + // Proceed with writing as above. + +Signed URLs + +You can obtain a URL that lets anyone read or write an object for a limited time. +You don't need to create a client to do this. See the documentation of +SignedURL for details. + + url, err := storage.SignedURL(bucketName, "shared-object", opts) + if err != nil { + // TODO: Handle error. + } + fmt.Println(url) + +Errors + +Errors returned by this client are often of the type [`googleapi.Error`](https://godoc.org/google.golang.org/api/googleapi#Error). +These errors can be introspected for more information by type asserting to the richer `googleapi.Error` type. For example: + + if e, ok := err.(*googleapi.Error); ok { + if e.Code = 409 { ... } + } +*/ +package storage // import "cloud.google.com/go/storage" diff --git a/vendor/cloud.google.com/go/storage/example_test.go b/vendor/cloud.google.com/go/storage/example_test.go new file mode 100644 index 000000000..5162f95c0 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/example_test.go @@ -0,0 +1,665 @@ +// 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 storage_test + +import ( + "context" + "fmt" + "hash/crc32" + "io" + "io/ioutil" + "log" + "os" + "time" + + "cloud.google.com/go/storage" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +func ExampleNewClient() { + ctx := context.Background() + // Use Google Application Default Credentials to authorize and authenticate the client. + // More information about Application Default Credentials and how to enable is at + // https://developers.google.com/identity/protocols/application-default-credentials. + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // Use the client. + + // Close the client when finished. + if err := client.Close(); err != nil { + // TODO: handle error. + } +} + +// This example shows how to create an unauthenticated client, which +// can be used to access public data. +func ExampleNewClient_unauthenticated() { + ctx := context.Background() + client, err := storage.NewClient(ctx, option.WithoutAuthentication()) + if err != nil { + // TODO: handle error. + } + // Use the client. + + // Close the client when finished. + if err := client.Close(); err != nil { + // TODO: handle error. + } +} + +func ExampleBucketHandle_Create() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + if err := client.Bucket("my-bucket").Create(ctx, "my-project", nil); err != nil { + // TODO: handle error. + } +} + +func ExampleBucketHandle_Delete() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + if err := client.Bucket("my-bucket").Delete(ctx); err != nil { + // TODO: handle error. + } +} + +func ExampleBucketHandle_Attrs() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + attrs, err := client.Bucket("my-bucket").Attrs(ctx) + if err != nil { + // TODO: handle error. + } + fmt.Println(attrs) +} + +func ExampleBucketHandle_Update() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // Enable versioning in the bucket, regardless of its previous value. + attrs, err := client.Bucket("my-bucket").Update(ctx, + storage.BucketAttrsToUpdate{VersioningEnabled: true}) + if err != nil { + // TODO: handle error. + } + fmt.Println(attrs) +} + +// If your update is based on the bucket's previous attributes, match the +// metageneration number to make sure the bucket hasn't changed since you read it. +func ExampleBucketHandle_Update_readModifyWrite() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + b := client.Bucket("my-bucket") + attrs, err := b.Attrs(ctx) + if err != nil { + // TODO: handle error. + } + var au storage.BucketAttrsToUpdate + au.SetLabel("lab", attrs.Labels["lab"]+"-more") + if attrs.Labels["delete-me"] == "yes" { + au.DeleteLabel("delete-me") + } + attrs, err = b. + If(storage.BucketConditions{MetagenerationMatch: attrs.MetaGeneration}). + Update(ctx, au) + if err != nil { + // TODO: handle error. + } + fmt.Println(attrs) +} + +func ExampleClient_Buckets() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + it := client.Buckets(ctx, "my-bucket") + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleBucketIterator_Next() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + it := client.Buckets(ctx, "my-project") + for { + bucketAttrs, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(bucketAttrs) + } +} + +func ExampleBucketHandle_Objects() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + it := client.Bucket("my-bucket").Objects(ctx, nil) + _ = it // TODO: iterate using Next or iterator.Pager. +} + +func ExampleBucketHandle_AddNotification() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + b := client.Bucket("my-bucket") + n, err := b.AddNotification(ctx, &storage.Notification{ + TopicProjectID: "my-project", + TopicID: "my-topic", + PayloadFormat: storage.JSONPayload, + }) + if err != nil { + // TODO: handle error. + } + fmt.Println(n.ID) +} + +func ExampleBucketHandle_LockRetentionPolicy() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + b := client.Bucket("my-bucket") + attrs, err := b.Attrs(ctx) + if err != nil { + // TODO: handle error. + } + // Note that locking the bucket without first attaching a RetentionPolicy + // that's at least 1 day is a no-op + err = b.If(storage.BucketConditions{MetagenerationMatch: attrs.MetaGeneration}).LockRetentionPolicy(ctx) + if err != nil { + // TODO: handle err + } +} + +func ExampleBucketHandle_Notifications() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + b := client.Bucket("my-bucket") + ns, err := b.Notifications(ctx) + if err != nil { + // TODO: handle error. + } + for id, n := range ns { + fmt.Printf("%s: %+v\n", id, n) + } +} + +var notificationID string + +func ExampleBucketHandle_DeleteNotification() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + b := client.Bucket("my-bucket") + // TODO: Obtain notificationID from BucketHandle.AddNotification + // or BucketHandle.Notifications. + err = b.DeleteNotification(ctx, notificationID) + if err != nil { + // TODO: handle error. + } +} + +func ExampleObjectIterator_Next() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + it := client.Bucket("my-bucket").Objects(ctx, nil) + for { + objAttrs, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(objAttrs) + } +} + +func ExampleSignedURL() { + pkey, err := ioutil.ReadFile("my-private-key.pem") + if err != nil { + // TODO: handle error. + } + url, err := storage.SignedURL("my-bucket", "my-object", &storage.SignedURLOptions{ + GoogleAccessID: "xxx@developer.gserviceaccount.com", + PrivateKey: pkey, + Method: "GET", + Expires: time.Now().Add(48 * time.Hour), + }) + if err != nil { + // TODO: handle error. + } + fmt.Println(url) +} + +func ExampleObjectHandle_Attrs() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + objAttrs, err := client.Bucket("my-bucket").Object("my-object").Attrs(ctx) + if err != nil { + // TODO: handle error. + } + fmt.Println(objAttrs) +} + +func ExampleObjectHandle_Attrs_withConditions() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + obj := client.Bucket("my-bucket").Object("my-object") + // Read the object. + objAttrs1, err := obj.Attrs(ctx) + if err != nil { + // TODO: handle error. + } + // Do something else for a while. + time.Sleep(5 * time.Minute) + // Now read the same contents, even if the object has been written since the last read. + objAttrs2, err := obj.Generation(objAttrs1.Generation).Attrs(ctx) + if err != nil { + // TODO: handle error. + } + fmt.Println(objAttrs1, objAttrs2) +} + +func ExampleObjectHandle_Update() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // Change only the content type of the object. + objAttrs, err := client.Bucket("my-bucket").Object("my-object").Update(ctx, storage.ObjectAttrsToUpdate{ + ContentType: "text/html", + ContentDisposition: "", // delete ContentDisposition + }) + if err != nil { + // TODO: handle error. + } + fmt.Println(objAttrs) +} + +func ExampleObjectHandle_NewReader() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + rc, err := client.Bucket("my-bucket").Object("my-object").NewReader(ctx) + if err != nil { + // TODO: handle error. + } + slurp, err := ioutil.ReadAll(rc) + rc.Close() + if err != nil { + // TODO: handle error. + } + fmt.Println("file contents:", slurp) +} + +func ExampleObjectHandle_NewRangeReader() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // Read only the first 64K. + rc, err := client.Bucket("bucketname").Object("filename1").NewRangeReader(ctx, 0, 64*1024) + if err != nil { + // TODO: handle error. + } + slurp, err := ioutil.ReadAll(rc) + rc.Close() + if err != nil { + // TODO: handle error. + } + fmt.Println("first 64K of file contents:", slurp) +} + +func ExampleObjectHandle_NewWriter() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + wc := client.Bucket("bucketname").Object("filename1").NewWriter(ctx) + _ = wc // TODO: Use the Writer. +} + +func ExampleWriter_Write() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + wc := client.Bucket("bucketname").Object("filename1").NewWriter(ctx) + wc.ContentType = "text/plain" + wc.ACL = []storage.ACLRule{{Entity: storage.AllUsers, Role: storage.RoleReader}} + if _, err := wc.Write([]byte("hello world")); err != nil { + // TODO: handle error. + // Note that Write may return nil in some error situations, + // so always check the error from Close. + } + if err := wc.Close(); err != nil { + // TODO: handle error. + } + fmt.Println("updated object:", wc.Attrs()) +} + +// To limit the time to write an object (or do anything else +// that takes a context), use context.WithTimeout. +func ExampleWriter_Write_timeout() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + tctx, cancel := context.WithTimeout(ctx, 30*time.Second) + defer cancel() // Cancel when done, whether we time out or not. + wc := client.Bucket("bucketname").Object("filename1").NewWriter(tctx) + wc.ContentType = "text/plain" + wc.ACL = []storage.ACLRule{{Entity: storage.AllUsers, Role: storage.RoleReader}} + if _, err := wc.Write([]byte("hello world")); err != nil { + // TODO: handle error. + // Note that Write may return nil in some error situations, + // so always check the error from Close. + } + if err := wc.Close(); err != nil { + // TODO: handle error. + } + fmt.Println("updated object:", wc.Attrs()) +} + +// To make sure the data you write is uncorrupted, use an MD5 or CRC32c +// checksum. This example illustrates CRC32c. +func ExampleWriter_Write_checksum() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + data := []byte("verify me") + wc := client.Bucket("bucketname").Object("filename1").NewWriter(ctx) + wc.CRC32C = crc32.Checksum(data, crc32.MakeTable(crc32.Castagnoli)) + wc.SendCRC32C = true + if _, err := wc.Write([]byte("hello world")); err != nil { + // TODO: handle error. + // Note that Write may return nil in some error situations, + // so always check the error from Close. + } + if err := wc.Close(); err != nil { + // TODO: handle error. + } + fmt.Println("updated object:", wc.Attrs()) +} + +func ExampleObjectHandle_Delete() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // To delete multiple objects in a bucket, list them with an + // ObjectIterator, then Delete them. + + // If you are using this package on the App Engine Flex runtime, + // you can init a bucket client with your app's default bucket name. + // See http://godoc.org/google.golang.org/appengine/file#DefaultBucketName. + bucket := client.Bucket("my-bucket") + it := bucket.Objects(ctx, nil) + for { + objAttrs, err := it.Next() + if err != nil && err != iterator.Done { + // TODO: Handle error. + } + if err == iterator.Done { + break + } + if err := bucket.Object(objAttrs.Name).Delete(ctx); err != nil { + // TODO: Handle error. + } + } + fmt.Println("deleted all object items in the bucket specified.") +} + +func ExampleACLHandle_Delete() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // No longer grant access to the bucket to everyone on the Internet. + if err := client.Bucket("my-bucket").ACL().Delete(ctx, storage.AllUsers); err != nil { + // TODO: handle error. + } +} + +func ExampleACLHandle_Set() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // Let any authenticated user read my-bucket/my-object. + obj := client.Bucket("my-bucket").Object("my-object") + if err := obj.ACL().Set(ctx, storage.AllAuthenticatedUsers, storage.RoleReader); err != nil { + // TODO: handle error. + } +} + +func ExampleACLHandle_List() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // List the default object ACLs for my-bucket. + aclRules, err := client.Bucket("my-bucket").DefaultObjectACL().List(ctx) + if err != nil { + // TODO: handle error. + } + fmt.Println(aclRules) +} + +func ExampleCopier_Run() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + src := client.Bucket("bucketname").Object("file1") + dst := client.Bucket("another-bucketname").Object("file2") + + // Copy content and modify metadata. + copier := dst.CopierFrom(src) + copier.ContentType = "text/plain" + attrs, err := copier.Run(ctx) + if err != nil { + // TODO: Handle error, possibly resuming with copier.RewriteToken. + } + fmt.Println(attrs) + + // Just copy content. + attrs, err = dst.CopierFrom(src).Run(ctx) + if err != nil { + // TODO: Handle error. No way to resume. + } + fmt.Println(attrs) +} + +func ExampleCopier_Run_progress() { + // Display progress across multiple rewrite RPCs. + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + src := client.Bucket("bucketname").Object("file1") + dst := client.Bucket("another-bucketname").Object("file2") + + copier := dst.CopierFrom(src) + copier.ProgressFunc = func(copiedBytes, totalBytes uint64) { + log.Printf("copy %.1f%% done", float64(copiedBytes)/float64(totalBytes)*100) + } + if _, err := copier.Run(ctx); err != nil { + // TODO: handle error. + } +} + +var key1, key2 []byte + +func ExampleObjectHandle_CopierFrom_rotateEncryptionKeys() { + // To rotate the encryption key on an object, copy it onto itself. + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + obj := client.Bucket("bucketname").Object("obj") + // Assume obj is encrypted with key1, and we want to change to key2. + _, err = obj.Key(key2).CopierFrom(obj.Key(key1)).Run(ctx) + if err != nil { + // TODO: handle error. + } +} + +func ExampleComposer_Run() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + bkt := client.Bucket("bucketname") + src1 := bkt.Object("o1") + src2 := bkt.Object("o2") + dst := bkt.Object("o3") + // Compose and modify metadata. + c := dst.ComposerFrom(src1, src2) + c.ContentType = "text/plain" + attrs, err := c.Run(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Println(attrs) + // Just compose. + attrs, err = dst.ComposerFrom(src1, src2).Run(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Println(attrs) +} + +var gen int64 + +func ExampleObjectHandle_Generation() { + // Read an object's contents from generation gen, regardless of the + // current generation of the object. + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + obj := client.Bucket("my-bucket").Object("my-object") + rc, err := obj.Generation(gen).NewReader(ctx) + if err != nil { + // TODO: handle error. + } + defer rc.Close() + if _, err := io.Copy(os.Stdout, rc); err != nil { + // TODO: handle error. + } +} + +func ExampleObjectHandle_If() { + // Read from an object only if the current generation is gen. + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + obj := client.Bucket("my-bucket").Object("my-object") + rc, err := obj.If(storage.Conditions{GenerationMatch: gen}).NewReader(ctx) + if err != nil { + // TODO: handle error. + } + defer rc.Close() + if _, err := io.Copy(os.Stdout, rc); err != nil { + // TODO: handle error. + } +} + +var secretKey []byte + +func ExampleObjectHandle_Key() { + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + obj := client.Bucket("my-bucket").Object("my-object") + // Encrypt the object's contents. + w := obj.Key(secretKey).NewWriter(ctx) + if _, err := w.Write([]byte("top secret")); err != nil { + // TODO: handle error. + } + if err := w.Close(); err != nil { + // TODO: handle error. + } +} diff --git a/vendor/cloud.google.com/go/storage/go110.go b/vendor/cloud.google.com/go/storage/go110.go new file mode 100644 index 000000000..206813f0c --- /dev/null +++ b/vendor/cloud.google.com/go/storage/go110.go @@ -0,0 +1,32 @@ +// Copyright 2017 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. + +// +build go1.10 + +package storage + +import "google.golang.org/api/googleapi" + +func shouldRetry(err error) bool { + switch e := err.(type) { + case *googleapi.Error: + // Retry on 429 and 5xx, according to + // https://cloud.google.com/storage/docs/exponential-backoff. + return e.Code == 429 || (e.Code >= 500 && e.Code < 600) + case interface{ Temporary() bool }: + return e.Temporary() + default: + return false + } +} diff --git a/vendor/cloud.google.com/go/storage/iam.go b/vendor/cloud.google.com/go/storage/iam.go new file mode 100644 index 000000000..9d9360671 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/iam.go @@ -0,0 +1,130 @@ +// Copyright 2017 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 storage + +import ( + "context" + + "cloud.google.com/go/iam" + "cloud.google.com/go/internal/trace" + raw "google.golang.org/api/storage/v1" + iampb "google.golang.org/genproto/googleapis/iam/v1" +) + +// IAM provides access to IAM access control for the bucket. +func (b *BucketHandle) IAM() *iam.Handle { + return iam.InternalNewHandleClient(&iamClient{ + raw: b.c.raw, + userProject: b.userProject, + }, b.name) +} + +// iamClient implements the iam.client interface. +type iamClient struct { + raw *raw.Service + userProject string +} + +func (c *iamClient) Get(ctx context.Context, resource string) (p *iampb.Policy, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.IAM.Get") + defer func() { trace.EndSpan(ctx, err) }() + + call := c.raw.Buckets.GetIamPolicy(resource) + setClientHeader(call.Header()) + if c.userProject != "" { + call.UserProject(c.userProject) + } + var rp *raw.Policy + err = runWithRetry(ctx, func() error { + rp, err = call.Context(ctx).Do() + return err + }) + if err != nil { + return nil, err + } + return iamFromStoragePolicy(rp), nil +} + +func (c *iamClient) Set(ctx context.Context, resource string, p *iampb.Policy) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.IAM.Set") + defer func() { trace.EndSpan(ctx, err) }() + + rp := iamToStoragePolicy(p) + call := c.raw.Buckets.SetIamPolicy(resource, rp) + setClientHeader(call.Header()) + if c.userProject != "" { + call.UserProject(c.userProject) + } + return runWithRetry(ctx, func() error { + _, err := call.Context(ctx).Do() + return err + }) +} + +func (c *iamClient) Test(ctx context.Context, resource string, perms []string) (permissions []string, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.IAM.Test") + defer func() { trace.EndSpan(ctx, err) }() + + call := c.raw.Buckets.TestIamPermissions(resource, perms) + setClientHeader(call.Header()) + if c.userProject != "" { + call.UserProject(c.userProject) + } + var res *raw.TestIamPermissionsResponse + err = runWithRetry(ctx, func() error { + res, err = call.Context(ctx).Do() + return err + }) + if err != nil { + return nil, err + } + return res.Permissions, nil +} + +func iamToStoragePolicy(ip *iampb.Policy) *raw.Policy { + return &raw.Policy{ + Bindings: iamToStorageBindings(ip.Bindings), + Etag: string(ip.Etag), + } +} + +func iamToStorageBindings(ibs []*iampb.Binding) []*raw.PolicyBindings { + var rbs []*raw.PolicyBindings + for _, ib := range ibs { + rbs = append(rbs, &raw.PolicyBindings{ + Role: ib.Role, + Members: ib.Members, + }) + } + return rbs +} + +func iamFromStoragePolicy(rp *raw.Policy) *iampb.Policy { + return &iampb.Policy{ + Bindings: iamFromStorageBindings(rp.Bindings), + Etag: []byte(rp.Etag), + } +} + +func iamFromStorageBindings(rbs []*raw.PolicyBindings) []*iampb.Binding { + var ibs []*iampb.Binding + for _, rb := range rbs { + ibs = append(ibs, &iampb.Binding{ + Role: rb.Role, + Members: rb.Members, + }) + } + return ibs +} diff --git a/vendor/cloud.google.com/go/storage/integration_test.go b/vendor/cloud.google.com/go/storage/integration_test.go new file mode 100644 index 000000000..c7de8cdfd --- /dev/null +++ b/vendor/cloud.google.com/go/storage/integration_test.go @@ -0,0 +1,2704 @@ +// 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 storage + +import ( + "bytes" + "compress/gzip" + "context" + "crypto/md5" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "flag" + "fmt" + "hash/crc32" + "io" + "io/ioutil" + "log" + "math/rand" + "net/http" + "os" + "path/filepath" + "runtime" + "sort" + "strconv" + "strings" + "testing" + "time" + + "cloud.google.com/go/httpreplay" + "cloud.google.com/go/iam" + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/internal/uid" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "google.golang.org/api/googleapi" + "google.golang.org/api/iterator" + itesting "google.golang.org/api/iterator/testing" + "google.golang.org/api/option" +) + +const ( + testPrefix = "go-integration-test" + replayFilename = "storage.replay" +) + +var ( + record = flag.Bool("record", false, "record RPCs") + + uidSpace *uid.Space + bucketName string + // Use our own random number generator to isolate the sequence of random numbers from + // other packages. This makes it possible to use HTTP replay and draw the same sequence + // of numbers as during recording. + rng *rand.Rand + newTestClient func(ctx context.Context, opts ...option.ClientOption) (*Client, error) + replaying bool + testTime time.Time +) + +func TestMain(m *testing.M) { + cleanup := initIntegrationTest() + exit := m.Run() + if err := cleanup(); err != nil { + // Don't fail the test if cleanup fails. + log.Printf("Post-test cleanup failed: %v", err) + } + os.Exit(exit) +} + +// If integration tests will be run, create a unique bucket for them. +// Also, set newTestClient to handle record/replay. +// Return a cleanup function. +func initIntegrationTest() func() error { + flag.Parse() // needed for testing.Short() + switch { + case testing.Short() && *record: + log.Fatal("cannot combine -short and -record") + return nil + + case testing.Short() && httpreplay.Supported() && testutil.CanReplay(replayFilename) && testutil.ProjID() != "": + // go test -short with a replay file will replay the integration tests, if + // the appropriate environment variables have been set. + replaying = true + httpreplay.DebugHeaders() + replayer, err := httpreplay.NewReplayer(replayFilename) + if err != nil { + log.Fatal(err) + } + var t time.Time + if err := json.Unmarshal(replayer.Initial(), &t); err != nil { + log.Fatal(err) + } + initUIDsAndRand(t) + newTestClient = func(ctx context.Context, _ ...option.ClientOption) (*Client, error) { + hc, err := replayer.Client(ctx) // no creds needed + if err != nil { + return nil, err + } + return NewClient(ctx, option.WithHTTPClient(hc)) + } + log.Printf("replaying from %s", replayFilename) + return func() error { return replayer.Close() } + + case testing.Short(): + // go test -short without a replay file skips the integration tests. + if testutil.CanReplay(replayFilename) && testutil.ProjID() != "" { + log.Print("replay not supported for Go versions before 1.8") + } + newTestClient = nil + return func() error { return nil } + + default: // Run integration tests against a real backend. + now := time.Now().UTC() + initUIDsAndRand(now) + var cleanup func() error + if *record && httpreplay.Supported() { + // Remember the time for replay. + nowBytes, err := json.Marshal(now) + if err != nil { + log.Fatal(err) + } + recorder, err := httpreplay.NewRecorder(replayFilename, nowBytes) + if err != nil { + log.Fatalf("could not record: %v", err) + } + newTestClient = func(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + hc, err := recorder.Client(ctx, opts...) + if err != nil { + return nil, err + } + return NewClient(ctx, option.WithHTTPClient(hc)) + } + cleanup = func() error { + err1 := cleanupBuckets() + err2 := recorder.Close() + if err1 != nil { + return err1 + } + return err2 + } + log.Printf("recording to %s", replayFilename) + } else { + if *record { + log.Print("record not supported for Go versions before 1.8") + } + newTestClient = NewClient + cleanup = cleanupBuckets + } + ctx := context.Background() + client := config(ctx) + if client == nil { + return func() error { return nil } + } + defer client.Close() + if err := client.Bucket(bucketName).Create(ctx, testutil.ProjID(), nil); err != nil { + log.Fatalf("creating bucket %q: %v", bucketName, err) + } + return cleanup + } +} + +func initUIDsAndRand(t time.Time) { + uidSpace = uid.NewSpace(testPrefix, &uid.Options{Time: t}) + bucketName = uidSpace.New() + // Use our own random source, to avoid other parts of the program taking + // random numbers from the global source and putting record and replay + // out of sync. + rng = testutil.NewRand(t) + testTime = t +} + +// testConfig returns the Client used to access GCS. testConfig skips +// the current test if credentials are not available or when being run +// in Short mode. +func testConfig(ctx context.Context, t *testing.T) *Client { + if testing.Short() && !replaying { + t.Skip("Integration tests skipped in short mode") + } + client := config(ctx) + if client == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + return client +} + +// config is like testConfig, but it doesn't need a *testing.T. +func config(ctx context.Context) *Client { + ts := testutil.TokenSource(ctx, ScopeFullControl) + if ts == nil { + return nil + } + client, err := newTestClient(ctx, option.WithTokenSource(ts)) + if err != nil { + log.Fatalf("NewClient: %v", err) + } + return client +} + +func TestIntegration_BucketMethods(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + projectID := testutil.ProjID() + newBucketName := uidSpace.New() + b := client.Bucket(newBucketName) + // Test Create and Delete. + h.mustCreate(b, projectID, nil) + attrs := h.mustBucketAttrs(b) + if got, want := attrs.MetaGeneration, int64(1); got != want { + t.Errorf("got metagen %d, want %d", got, want) + } + if got, want := attrs.StorageClass, "STANDARD"; got != want { + t.Errorf("got storage class %q, want %q", got, want) + } + if attrs.VersioningEnabled { + t.Error("got versioning enabled, wanted it disabled") + } + h.mustDeleteBucket(b) + + // Test Create and Delete with attributes. + labels := map[string]string{ + "l1": "v1", + "empty": "", + } + attrs = &BucketAttrs{ + StorageClass: "NEARLINE", + VersioningEnabled: true, + Labels: labels, + Lifecycle: Lifecycle{ + Rules: []LifecycleRule{{ + Action: LifecycleAction{ + Type: SetStorageClassAction, + StorageClass: "NEARLINE", + }, + Condition: LifecycleCondition{ + AgeInDays: 10, + Liveness: Archived, + CreatedBefore: time.Date(2017, 1, 1, 0, 0, 0, 0, time.UTC), + MatchesStorageClasses: []string{"MULTI_REGIONAL", "STANDARD"}, + NumNewerVersions: 3, + }, + }, { + Action: LifecycleAction{ + Type: DeleteAction, + }, + Condition: LifecycleCondition{ + AgeInDays: 30, + Liveness: Live, + CreatedBefore: time.Date(2017, 1, 1, 0, 0, 0, 0, time.UTC), + MatchesStorageClasses: []string{"NEARLINE"}, + NumNewerVersions: 10, + }, + }}, + }, + } + h.mustCreate(b, projectID, attrs) + attrs = h.mustBucketAttrs(b) + if got, want := attrs.MetaGeneration, int64(1); got != want { + t.Errorf("got metagen %d, want %d", got, want) + } + if got, want := attrs.StorageClass, "NEARLINE"; got != want { + t.Errorf("got storage class %q, want %q", got, want) + } + if !attrs.VersioningEnabled { + t.Error("got versioning disabled, wanted it enabled") + } + if got, want := attrs.Labels, labels; !testutil.Equal(got, want) { + t.Errorf("labels: got %v, want %v", got, want) + } + h.mustDeleteBucket(b) +} + +func TestIntegration_BucketUpdate(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + b := client.Bucket(bucketName) + attrs := h.mustBucketAttrs(b) + if attrs.VersioningEnabled { + t.Fatal("bucket should not have versioning by default") + } + if len(attrs.Labels) > 0 { + t.Fatal("bucket should not have labels initially") + } + + // Using empty BucketAttrsToUpdate should be a no-nop. + attrs = h.mustUpdateBucket(b, BucketAttrsToUpdate{}) + if attrs.VersioningEnabled { + t.Fatal("should not have versioning") + } + if len(attrs.Labels) > 0 { + t.Fatal("should not have labels") + } + + // Turn on versioning, add some labels. + ua := BucketAttrsToUpdate{VersioningEnabled: true} + ua.SetLabel("l1", "v1") + ua.SetLabel("empty", "") + attrs = h.mustUpdateBucket(b, ua) + if !attrs.VersioningEnabled { + t.Fatal("should have versioning now") + } + wantLabels := map[string]string{ + "l1": "v1", + "empty": "", + } + if !testutil.Equal(attrs.Labels, wantLabels) { + t.Fatalf("got %v, want %v", attrs.Labels, wantLabels) + } + + // Turn off versioning again; add and remove some more labels. + ua = BucketAttrsToUpdate{VersioningEnabled: false} + ua.SetLabel("l1", "v2") // update + ua.SetLabel("new", "new") // create + ua.DeleteLabel("empty") // delete + ua.DeleteLabel("absent") // delete non-existent + attrs = h.mustUpdateBucket(b, ua) + if attrs.VersioningEnabled { + t.Fatal("should have versioning off") + } + wantLabels = map[string]string{ + "l1": "v2", + "new": "new", + } + if !testutil.Equal(attrs.Labels, wantLabels) { + t.Fatalf("got %v, want %v", attrs.Labels, wantLabels) + } + + // Configure a lifecycle + wantLifecycle := Lifecycle{ + Rules: []LifecycleRule{ + { + Action: LifecycleAction{Type: "Delete"}, + Condition: LifecycleCondition{AgeInDays: 30}, + }, + }, + } + ua = BucketAttrsToUpdate{Lifecycle: &wantLifecycle} + attrs = h.mustUpdateBucket(b, ua) + if !testutil.Equal(attrs.Lifecycle, wantLifecycle) { + t.Fatalf("got %v, want %v", attrs.Lifecycle, wantLifecycle) + } +} + +func TestIntegration_ConditionalDelete(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + o := client.Bucket(bucketName).Object("conddel") + + wc := o.NewWriter(ctx) + wc.ContentType = "text/plain" + h.mustWrite(wc, []byte("foo")) + + gen := wc.Attrs().Generation + metaGen := wc.Attrs().Metageneration + + if err := o.Generation(gen - 1).Delete(ctx); err == nil { + t.Fatalf("Unexpected successful delete with Generation") + } + if err := o.If(Conditions{MetagenerationMatch: metaGen + 1}).Delete(ctx); err == nil { + t.Fatalf("Unexpected successful delete with IfMetaGenerationMatch") + } + if err := o.If(Conditions{MetagenerationNotMatch: metaGen}).Delete(ctx); err == nil { + t.Fatalf("Unexpected successful delete with IfMetaGenerationNotMatch") + } + if err := o.Generation(gen).Delete(ctx); err != nil { + t.Fatalf("final delete failed: %v", err) + } +} + +func TestIntegration_Objects(t *testing.T) { + // TODO(jba): Use subtests (Go 1.7). + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + bkt := client.Bucket(bucketName) + + const defaultType = "text/plain" + + // Populate object names and make a map for their contents. + objects := []string{ + "obj1", + "obj2", + "obj/with/slashes", + } + contents := make(map[string][]byte) + + // Test Writer. + for _, obj := range objects { + c := randomContents() + if err := writeObject(ctx, bkt.Object(obj), defaultType, c); err != nil { + t.Errorf("Write for %v failed with %v", obj, err) + } + contents[obj] = c + } + + testObjectIterator(t, bkt, objects) + + // Test Reader. + for _, obj := range objects { + rc, err := bkt.Object(obj).NewReader(ctx) + if err != nil { + t.Errorf("Can't create a reader for %v, errored with %v", obj, err) + continue + } + if !rc.checkCRC { + t.Errorf("%v: not checking CRC", obj) + } + slurp, err := ioutil.ReadAll(rc) + if err != nil { + t.Errorf("Can't ReadAll object %v, errored with %v", obj, err) + } + if got, want := slurp, contents[obj]; !bytes.Equal(got, want) { + t.Errorf("Contents (%q) = %q; want %q", obj, got, want) + } + if got, want := rc.Size(), len(contents[obj]); got != int64(want) { + t.Errorf("Size (%q) = %d; want %d", obj, got, want) + } + if got, want := rc.ContentType(), "text/plain"; got != want { + t.Errorf("ContentType (%q) = %q; want %q", obj, got, want) + } + if got, want := rc.CacheControl(), "public, max-age=60"; got != want { + t.Errorf("CacheControl (%q) = %q; want %q", obj, got, want) + } + // We just wrote these objects, so they should have a recent last-modified time. + lm, err := rc.LastModified() + // Accept a time within +/- of the test time, to account for natural + // variation and the fact that testTime is set at the start of the test run. + expectedVariance := 5 * time.Minute + if err != nil { + t.Errorf("LastModified (%q): got error %v", obj, err) + } else if lm.Before(testTime.Add(-expectedVariance)) || lm.After(testTime.Add(expectedVariance)) { + t.Errorf("LastModified (%q): got %s, which not the %v from now (%v)", obj, lm, expectedVariance, testTime) + } + rc.Close() + + // Check early close. + buf := make([]byte, 1) + rc, err = bkt.Object(obj).NewReader(ctx) + if err != nil { + t.Fatalf("%v: %v", obj, err) + } + _, err = rc.Read(buf) + if err != nil { + t.Fatalf("%v: %v", obj, err) + } + if got, want := buf, contents[obj][:1]; !bytes.Equal(got, want) { + t.Errorf("Contents[0] (%q) = %q; want %q", obj, got, want) + } + if err := rc.Close(); err != nil { + t.Errorf("%v Close: %v", obj, err) + } + } + + obj := objects[0] + objlen := int64(len(contents[obj])) + // Test Range Reader. + for i, r := range []struct { + offset, length, want int64 + }{ + {0, objlen, objlen}, + {0, objlen / 2, objlen / 2}, + {objlen / 2, objlen, objlen / 2}, + {0, 0, 0}, + {objlen / 2, 0, 0}, + {objlen / 2, -1, objlen / 2}, + {0, objlen * 2, objlen}, + } { + rc, err := bkt.Object(obj).NewRangeReader(ctx, r.offset, r.length) + if err != nil { + t.Errorf("%+v: Can't create a range reader for %v, errored with %v", i, obj, err) + continue + } + if rc.Size() != objlen { + t.Errorf("%+v: Reader has a content-size of %d, want %d", i, rc.Size(), objlen) + } + if rc.Remain() != r.want { + t.Errorf("%+v: Reader's available bytes reported as %d, want %d", i, rc.Remain(), r.want) + } + slurp, err := ioutil.ReadAll(rc) + if err != nil { + t.Errorf("%+v: can't ReadAll object %v, errored with %v", r, obj, err) + continue + } + if len(slurp) != int(r.want) { + t.Errorf("%+v: RangeReader (%d, %d): Read %d bytes, wanted %d bytes", i, r.offset, r.length, len(slurp), r.want) + continue + } + if got, want := slurp, contents[obj][r.offset:r.offset+r.want]; !bytes.Equal(got, want) { + t.Errorf("RangeReader (%d, %d) = %q; want %q", r.offset, r.length, got, want) + } + rc.Close() + } + + objName := objects[0] + + // Test NewReader googleapi.Error. + // Since a 429 or 5xx is hard to cause, we trigger a 416. + realLen := len(contents[objName]) + _, err := bkt.Object(objName).NewRangeReader(ctx, int64(realLen*2), 10) + if err, ok := err.(*googleapi.Error); !ok { + t.Error("NewRangeReader did not return a googleapi.Error") + } else { + if err.Code != 416 { + t.Errorf("Code = %d; want %d", err.Code, 416) + } + if len(err.Header) == 0 { + t.Error("Missing googleapi.Error.Header") + } + if len(err.Body) == 0 { + t.Error("Missing googleapi.Error.Body") + } + } + + // Test StatObject. + o := h.mustObjectAttrs(bkt.Object(objName)) + if got, want := o.Name, objName; got != want { + t.Errorf("Name (%v) = %q; want %q", objName, got, want) + } + if got, want := o.ContentType, defaultType; got != want { + t.Errorf("ContentType (%v) = %q; want %q", objName, got, want) + } + created := o.Created + // Check that the object is newer than its containing bucket. + bAttrs := h.mustBucketAttrs(bkt) + if o.Created.Before(bAttrs.Created) { + t.Errorf("Object %v is older than its containing bucket, %v", o, bAttrs) + } + + // Test object copy. + copyName := "copy-" + objName + copyObj, err := bkt.Object(copyName).CopierFrom(bkt.Object(objName)).Run(ctx) + if err != nil { + t.Errorf("Copier.Run failed with %v", err) + } else if !namesEqual(copyObj, bucketName, copyName) { + t.Errorf("Copy object bucket, name: got %q.%q, want %q.%q", + copyObj.Bucket, copyObj.Name, bucketName, copyName) + } + + // Copying with attributes. + const contentEncoding = "identity" + copier := bkt.Object(copyName).CopierFrom(bkt.Object(objName)) + copier.ContentEncoding = contentEncoding + copyObj, err = copier.Run(ctx) + if err != nil { + t.Errorf("Copier.Run failed with %v", err) + } else { + if !namesEqual(copyObj, bucketName, copyName) { + t.Errorf("Copy object bucket, name: got %q.%q, want %q.%q", + copyObj.Bucket, copyObj.Name, bucketName, copyName) + } + if copyObj.ContentEncoding != contentEncoding { + t.Errorf("Copy ContentEncoding: got %q, want %q", copyObj.ContentEncoding, contentEncoding) + } + } + + // Test UpdateAttrs. + metadata := map[string]string{"key": "value"} + updated := h.mustUpdateObject(bkt.Object(objName), ObjectAttrsToUpdate{ + ContentType: "text/html", + ContentLanguage: "en", + Metadata: metadata, + ACL: []ACLRule{{Entity: "domain-google.com", Role: RoleReader}}, + }) + if got, want := updated.ContentType, "text/html"; got != want { + t.Errorf("updated.ContentType == %q; want %q", got, want) + } + if got, want := updated.ContentLanguage, "en"; got != want { + t.Errorf("updated.ContentLanguage == %q; want %q", updated.ContentLanguage, want) + } + if got, want := updated.Metadata, metadata; !testutil.Equal(got, want) { + t.Errorf("updated.Metadata == %+v; want %+v", updated.Metadata, want) + } + if got, want := updated.Created, created; got != want { + t.Errorf("updated.Created == %q; want %q", got, want) + } + if !updated.Created.Before(updated.Updated) { + t.Errorf("updated.Updated should be newer than update.Created") + } + + // Delete ContentType and ContentLanguage. + updated = h.mustUpdateObject(bkt.Object(objName), ObjectAttrsToUpdate{ + ContentType: "", + ContentLanguage: "", + Metadata: map[string]string{}, + }) + if got, want := updated.ContentType, ""; got != want { + t.Errorf("updated.ContentType == %q; want %q", got, want) + } + if got, want := updated.ContentLanguage, ""; got != want { + t.Errorf("updated.ContentLanguage == %q; want %q", updated.ContentLanguage, want) + } + if updated.Metadata != nil { + t.Errorf("updated.Metadata == %+v; want nil", updated.Metadata) + } + if got, want := updated.Created, created; got != want { + t.Errorf("updated.Created == %q; want %q", got, want) + } + if !updated.Created.Before(updated.Updated) { + t.Errorf("updated.Updated should be newer than update.Created") + } + + // Test checksums. + checksumCases := []struct { + name string + contents [][]byte + size int64 + md5 string + crc32c uint32 + }{ + { + name: "checksum-object", + contents: [][]byte{[]byte("hello"), []byte("world")}, + size: 10, + md5: "fc5e038d38a57032085441e7fe7010b0", + crc32c: 1456190592, + }, + { + name: "zero-object", + contents: [][]byte{}, + size: 0, + md5: "d41d8cd98f00b204e9800998ecf8427e", + crc32c: 0, + }, + } + for _, c := range checksumCases { + wc := bkt.Object(c.name).NewWriter(ctx) + for _, data := range c.contents { + if _, err := wc.Write(data); err != nil { + t.Errorf("Write(%q) failed with %q", data, err) + } + } + if err = wc.Close(); err != nil { + t.Errorf("%q: close failed with %q", c.name, err) + } + obj := wc.Attrs() + if got, want := obj.Size, c.size; got != want { + t.Errorf("Object (%q) Size = %v; want %v", c.name, got, want) + } + if got, want := fmt.Sprintf("%x", obj.MD5), c.md5; got != want { + t.Errorf("Object (%q) MD5 = %q; want %q", c.name, got, want) + } + if got, want := obj.CRC32C, c.crc32c; got != want { + t.Errorf("Object (%q) CRC32C = %v; want %v", c.name, got, want) + } + } + + // Test public ACL. + publicObj := objects[0] + if err = bkt.Object(publicObj).ACL().Set(ctx, AllUsers, RoleReader); err != nil { + t.Errorf("PutACLEntry failed with %v", err) + } + publicClient, err := newTestClient(ctx, option.WithoutAuthentication()) + if err != nil { + t.Fatal(err) + } + + slurp := h.mustRead(publicClient.Bucket(bucketName).Object(publicObj)) + if !bytes.Equal(slurp, contents[publicObj]) { + t.Errorf("Public object's content: got %q, want %q", slurp, contents[publicObj]) + } + + // Test writer error handling. + wc := publicClient.Bucket(bucketName).Object(publicObj).NewWriter(ctx) + if _, err := wc.Write([]byte("hello")); err != nil { + t.Errorf("Write unexpectedly failed with %v", err) + } + if err = wc.Close(); err == nil { + t.Error("Close expected an error, found none") + } + + // Test deleting the copy object. + h.mustDeleteObject(bkt.Object(copyName)) + // Deleting it a second time should return ErrObjectNotExist. + if err := bkt.Object(copyName).Delete(ctx); err != ErrObjectNotExist { + t.Errorf("second deletion of %v = %v; want ErrObjectNotExist", copyName, err) + } + _, err = bkt.Object(copyName).Attrs(ctx) + if err != ErrObjectNotExist { + t.Errorf("Copy is expected to be deleted, stat errored with %v", err) + } + + // Test object composition. + var compSrcs []*ObjectHandle + var wantContents []byte + for _, obj := range objects { + compSrcs = append(compSrcs, bkt.Object(obj)) + wantContents = append(wantContents, contents[obj]...) + } + checkCompose := func(obj *ObjectHandle, wantContentType string) { + rc := h.mustNewReader(obj) + slurp, err = ioutil.ReadAll(rc) + if err != nil { + t.Fatalf("ioutil.ReadAll: %v", err) + } + defer rc.Close() + if !bytes.Equal(slurp, wantContents) { + t.Errorf("Composed object contents\ngot: %q\nwant: %q", slurp, wantContents) + } + if got := rc.ContentType(); got != wantContentType { + t.Errorf("Composed object content-type = %q, want %q", got, wantContentType) + } + } + + // Compose should work even if the user sets no destination attributes. + compDst := bkt.Object("composed1") + c := compDst.ComposerFrom(compSrcs...) + if _, err := c.Run(ctx); err != nil { + t.Fatalf("ComposeFrom error: %v", err) + } + checkCompose(compDst, "application/octet-stream") + + // It should also work if we do. + compDst = bkt.Object("composed2") + c = compDst.ComposerFrom(compSrcs...) + c.ContentType = "text/json" + if _, err := c.Run(ctx); err != nil { + t.Fatalf("ComposeFrom error: %v", err) + } + checkCompose(compDst, "text/json") +} + +func TestIntegration_Encoding(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + bkt := client.Bucket(bucketName) + + // Test content encoding + const zeroCount = 20 << 1 // TODO: should be 20 << 20 + obj := bkt.Object("gzip-test") + w := obj.NewWriter(ctx) + w.ContentEncoding = "gzip" + gw := gzip.NewWriter(w) + if _, err := io.Copy(gw, io.LimitReader(zeros{}, zeroCount)); err != nil { + t.Fatalf("io.Copy, upload: %v", err) + } + if err := gw.Close(); err != nil { + t.Errorf("gzip.Close(): %v", err) + } + if err := w.Close(); err != nil { + t.Errorf("w.Close(): %v", err) + } + r, err := obj.NewReader(ctx) + if err != nil { + t.Fatalf("NewReader(gzip-test): %v", err) + } + n, err := io.Copy(ioutil.Discard, r) + if err != nil { + t.Errorf("io.Copy, download: %v", err) + } + if n != zeroCount { + t.Errorf("downloaded bad data: got %d bytes, want %d", n, zeroCount) + } + + // Test NotFound. + _, err = bkt.Object("obj-not-exists").NewReader(ctx) + if err != ErrObjectNotExist { + t.Errorf("Object should not exist, err found to be %v", err) + } +} + +func namesEqual(obj *ObjectAttrs, bucketName, objectName string) bool { + return obj.Bucket == bucketName && obj.Name == objectName +} + +func testObjectIterator(t *testing.T, bkt *BucketHandle, objects []string) { + ctx := context.Background() + h := testHelper{t} + // Collect the list of items we expect: ObjectAttrs in lexical order by name. + names := make([]string, len(objects)) + copy(names, objects) + sort.Strings(names) + var attrs []*ObjectAttrs + for _, name := range names { + attrs = append(attrs, h.mustObjectAttrs(bkt.Object(name))) + } + msg, ok := itesting.TestIterator(attrs, + func() interface{} { return bkt.Objects(ctx, &Query{Prefix: "obj"}) }, + func(it interface{}) (interface{}, error) { return it.(*ObjectIterator).Next() }) + if !ok { + t.Errorf("ObjectIterator.Next: %s", msg) + } + // TODO(jba): test query.Delimiter != "" +} + +func TestIntegration_SignedURL(t *testing.T) { + if testing.Short() { // do not test during replay + t.Skip("Integration tests skipped in short mode") + } + // To test SignedURL, we need a real user email and private key. Extract them + // from the JSON key file. + jwtConf, err := testutil.JWTConfig() + if err != nil { + t.Fatal(err) + } + if jwtConf == nil { + t.Skip("JSON key file is not present") + } + + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + + bkt := client.Bucket(bucketName) + obj := "signedURL" + contents := []byte("This is a test of SignedURL.\n") + md5 := "Jyxvgwm9n2MsrGTMPbMeYA==" // base64-encoded MD5 of contents + if err := writeObject(ctx, bkt.Object(obj), "text/plain", contents); err != nil { + t.Fatalf("writing: %v", err) + } + for _, test := range []struct { + desc string + opts SignedURLOptions + headers map[string][]string + fail bool + }{ + { + desc: "basic", + }, + { + desc: "MD5 sent and matches", + opts: SignedURLOptions{MD5: md5}, + headers: map[string][]string{"Content-MD5": {md5}}, + }, + { + desc: "MD5 not sent", + opts: SignedURLOptions{MD5: md5}, + fail: true, + }, + { + desc: "Content-Type sent and matches", + opts: SignedURLOptions{ContentType: "text/plain"}, + headers: map[string][]string{"Content-Type": {"text/plain"}}, + }, + { + desc: "Content-Type sent but does not match", + opts: SignedURLOptions{ContentType: "text/plain"}, + headers: map[string][]string{"Content-Type": {"application/json"}}, + fail: true, + }, + { + desc: "Canonical headers sent and match", + opts: SignedURLOptions{Headers: []string{ + " X-Goog-Foo: Bar baz ", + "X-Goog-Novalue", // ignored: no value + "X-Google-Foo", // ignored: wrong prefix + }}, + headers: map[string][]string{"X-Goog-foo": {"Bar baz "}}, + }, + { + desc: "Canonical headers sent but don't match", + opts: SignedURLOptions{Headers: []string{" X-Goog-Foo: Bar baz"}}, + headers: map[string][]string{"X-Goog-Foo": {"bar baz"}}, + fail: true, + }, + } { + opts := test.opts + opts.GoogleAccessID = jwtConf.Email + opts.PrivateKey = jwtConf.PrivateKey + opts.Method = "GET" + opts.Expires = time.Now().Add(time.Hour) + u, err := SignedURL(bucketName, obj, &opts) + if err != nil { + t.Errorf("%s: SignedURL: %v", test.desc, err) + continue + } + got, err := getURL(u, test.headers) + if err != nil && !test.fail { + t.Errorf("%s: getURL %q: %v", test.desc, u, err) + } else if err == nil && !bytes.Equal(got, contents) { + t.Errorf("%s: got %q, want %q", test.desc, got, contents) + } + } +} + +// Make a GET request to a URL using an unauthenticated client, and return its contents. +func getURL(url string, headers map[string][]string) ([]byte, error) { + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return nil, err + } + req.Header = headers + res, err := http.DefaultClient.Do(req) + if err != nil { + return nil, err + } + defer res.Body.Close() + bytes, err := ioutil.ReadAll(res.Body) + if err != nil { + return nil, err + } + if res.StatusCode != 200 { + return nil, fmt.Errorf("code=%d, body=%s", res.StatusCode, string(bytes)) + } + return bytes, nil +} + +func TestIntegration_ACL(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + + bkt := client.Bucket(bucketName) + + entity := ACLEntity("domain-google.com") + rule := ACLRule{Entity: entity, Role: RoleReader, Domain: "google.com"} + if err := bkt.DefaultObjectACL().Set(ctx, entity, RoleReader); err != nil { + t.Errorf("Can't put default ACL rule for the bucket, errored with %v", err) + } + + acl, err := bkt.DefaultObjectACL().List(ctx) + if err != nil { + t.Errorf("DefaultObjectACL.List for bucket %q: %v", bucketName, err) + } else if !hasRule(acl, rule) { + t.Errorf("default ACL missing %#v", rule) + } + aclObjects := []string{"acl1", "acl2"} + for _, obj := range aclObjects { + c := randomContents() + if err := writeObject(ctx, bkt.Object(obj), "", c); err != nil { + t.Errorf("Write for %v failed with %v", obj, err) + } + } + name := aclObjects[0] + o := bkt.Object(name) + acl, err = o.ACL().List(ctx) + if err != nil { + t.Errorf("Can't retrieve ACL of %v", name) + } else if !hasRule(acl, rule) { + t.Errorf("object ACL missing %+v", rule) + } + if err := o.ACL().Delete(ctx, entity); err != nil { + t.Errorf("object ACL: could not delete entity %s", entity) + } + // Delete the default ACL rule. We can't move this code earlier in the + // test, because the test depends on the fact that the object ACL inherits + // it. + if err := bkt.DefaultObjectACL().Delete(ctx, entity); err != nil { + t.Errorf("default ACL: could not delete entity %s", entity) + } + + entity2 := ACLEntity("user-jbd@google.com") + rule2 := ACLRule{Entity: entity2, Role: RoleReader, Email: "jbd@google.com"} + if err := bkt.ACL().Set(ctx, entity2, RoleReader); err != nil { + t.Errorf("Error while putting bucket ACL rule: %v", err) + } + bACL, err := bkt.ACL().List(ctx) + if err != nil { + t.Errorf("Error while getting the ACL of the bucket: %v", err) + } else if !hasRule(bACL, rule2) { + t.Errorf("bucket ACL missing %+v", rule2) + } + if err := bkt.ACL().Delete(ctx, entity2); err != nil { + t.Errorf("Error while deleting bucket ACL rule: %v", err) + } + +} + +func hasRule(acl []ACLRule, rule ACLRule) bool { + for _, r := range acl { + if cmp.Equal(r, rule) { + return true + } + } + return false +} + +func TestIntegration_ValidObjectNames(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + + bkt := client.Bucket(bucketName) + + validNames := []string{ + "gopher", + "Гоферови", + "a", + strings.Repeat("a", 1024), + } + for _, name := range validNames { + if err := writeObject(ctx, bkt.Object(name), "", []byte("data")); err != nil { + t.Errorf("Object %q write failed: %v. Want success", name, err) + continue + } + defer bkt.Object(name).Delete(ctx) + } + + invalidNames := []string{ + "", // Too short. + strings.Repeat("a", 1025), // Too long. + "new\nlines", + "bad\xffunicode", + } + for _, name := range invalidNames { + // Invalid object names will either cause failure during Write or Close. + if err := writeObject(ctx, bkt.Object(name), "", []byte("data")); err != nil { + continue + } + defer bkt.Object(name).Delete(ctx) + t.Errorf("%q should have failed. Didn't", name) + } +} + +func TestIntegration_WriterContentType(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + + obj := client.Bucket(bucketName).Object("content") + testCases := []struct { + content string + setType, wantType string + }{ + { + content: "It was the best of times, it was the worst of times.", + wantType: "text/plain; charset=utf-8", + }, + { + content: "My first page", + wantType: "text/html; charset=utf-8", + }, + { + content: "My first page", + setType: "text/html", + wantType: "text/html", + }, + { + content: "My first page", + setType: "image/jpeg", + wantType: "image/jpeg", + }, + } + for i, tt := range testCases { + if err := writeObject(ctx, obj, tt.setType, []byte(tt.content)); err != nil { + t.Errorf("writing #%d: %v", i, err) + } + attrs, err := obj.Attrs(ctx) + if err != nil { + t.Errorf("obj.Attrs: %v", err) + continue + } + if got := attrs.ContentType; got != tt.wantType { + t.Errorf("Content-Type = %q; want %q\nContent: %q\nSet Content-Type: %q", got, tt.wantType, tt.content, tt.setType) + } + } +} + +func TestIntegration_ZeroSizedObject(t *testing.T) { + t.Parallel() + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + obj := client.Bucket(bucketName).Object("zero") + + // Check writing it works as expected. + w := obj.NewWriter(ctx) + if err := w.Close(); err != nil { + t.Fatalf("Writer.Close: %v", err) + } + defer obj.Delete(ctx) + + // Check we can read it too. + body := h.mustRead(obj) + if len(body) != 0 { + t.Errorf("Body is %v, want empty []byte{}", body) + } +} + +func TestIntegration_Encryption(t *testing.T) { + // This function tests customer-supplied encryption keys for all operations + // involving objects. Bucket and ACL operations aren't tested because they + // aren't affected by customer encryption. Neither is deletion. + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + obj := client.Bucket(bucketName).Object("customer-encryption") + key := []byte("my-secret-AES-256-encryption-key") + keyHash := sha256.Sum256(key) + keyHashB64 := base64.StdEncoding.EncodeToString(keyHash[:]) + key2 := []byte("My-Secret-AES-256-Encryption-Key") + contents := "top secret." + + checkMetadataCall := func(msg string, f func(o *ObjectHandle) (*ObjectAttrs, error)) { + // Performing a metadata operation without the key should succeed. + attrs, err := f(obj) + if err != nil { + t.Fatalf("%s: %v", msg, err) + } + // The key hash should match... + if got, want := attrs.CustomerKeySHA256, keyHashB64; got != want { + t.Errorf("%s: key hash: got %q, want %q", msg, got, want) + } + // ...but CRC and MD5 should not be present. + if attrs.CRC32C != 0 { + t.Errorf("%s: CRC: got %v, want 0", msg, attrs.CRC32C) + } + if len(attrs.MD5) > 0 { + t.Errorf("%s: MD5: got %v, want len == 0", msg, attrs.MD5) + } + + // Performing a metadata operation with the key should succeed. + attrs, err = f(obj.Key(key)) + if err != nil { + t.Fatalf("%s: %v", msg, err) + } + // Check the key and content hashes. + if got, want := attrs.CustomerKeySHA256, keyHashB64; got != want { + t.Errorf("%s: key hash: got %q, want %q", msg, got, want) + } + if attrs.CRC32C == 0 { + t.Errorf("%s: CRC: got 0, want non-zero", msg) + } + if len(attrs.MD5) == 0 { + t.Errorf("%s: MD5: got len == 0, want len > 0", msg) + } + } + + checkRead := func(msg string, o *ObjectHandle, k []byte, wantContents string) { + // Reading the object without the key should fail. + if _, err := readObject(ctx, o); err == nil { + t.Errorf("%s: reading without key: want error, got nil", msg) + } + // Reading the object with the key should succeed. + got := h.mustRead(o.Key(k)) + gotContents := string(got) + // And the contents should match what we wrote. + if gotContents != wantContents { + t.Errorf("%s: contents: got %q, want %q", msg, gotContents, wantContents) + } + } + + checkReadUnencrypted := func(msg string, obj *ObjectHandle, wantContents string) { + got := h.mustRead(obj) + gotContents := string(got) + if gotContents != wantContents { + t.Errorf("%s: got %q, want %q", msg, gotContents, wantContents) + } + } + + // Write to obj using our own encryption key, which is a valid 32-byte + // AES-256 key. + h.mustWrite(obj.Key(key).NewWriter(ctx), []byte(contents)) + + checkMetadataCall("Attrs", func(o *ObjectHandle) (*ObjectAttrs, error) { + return o.Attrs(ctx) + }) + + checkMetadataCall("Update", func(o *ObjectHandle) (*ObjectAttrs, error) { + return o.Update(ctx, ObjectAttrsToUpdate{ContentLanguage: "en"}) + }) + + checkRead("first object", obj, key, contents) + + obj2 := client.Bucket(bucketName).Object("customer-encryption-2") + // Copying an object without the key should fail. + if _, err := obj2.CopierFrom(obj).Run(ctx); err == nil { + t.Fatal("want error, got nil") + } + // Copying an object with the key should succeed. + if _, err := obj2.CopierFrom(obj.Key(key)).Run(ctx); err != nil { + t.Fatal(err) + } + // The destination object is not encrypted; we can read it without a key. + checkReadUnencrypted("copy dest", obj2, contents) + + // Providing a key on the destination but not the source should fail, + // since the source is encrypted. + if _, err := obj2.Key(key2).CopierFrom(obj).Run(ctx); err == nil { + t.Fatal("want error, got nil") + } + + // But copying with keys for both source and destination should succeed. + if _, err := obj2.Key(key2).CopierFrom(obj.Key(key)).Run(ctx); err != nil { + t.Fatal(err) + } + // And the destination should be encrypted, meaning we can only read it + // with a key. + checkRead("copy destination", obj2, key2, contents) + + // Change obj2's key to prepare for compose, where all objects must have + // the same key. Also illustrates key rotation: copy an object to itself + // with a different key. + if _, err := obj2.Key(key).CopierFrom(obj2.Key(key2)).Run(ctx); err != nil { + t.Fatal(err) + } + obj3 := client.Bucket(bucketName).Object("customer-encryption-3") + // Composing without keys should fail. + if _, err := obj3.ComposerFrom(obj, obj2).Run(ctx); err == nil { + t.Fatal("want error, got nil") + } + // Keys on the source objects result in an error. + if _, err := obj3.ComposerFrom(obj.Key(key), obj2).Run(ctx); err == nil { + t.Fatal("want error, got nil") + } + // A key on the destination object both decrypts the source objects + // and encrypts the destination. + if _, err := obj3.Key(key).ComposerFrom(obj, obj2).Run(ctx); err != nil { + t.Fatalf("got %v, want nil", err) + } + // Check that the destination in encrypted. + checkRead("compose destination", obj3, key, contents+contents) + + // You can't compose one or more unencrypted source objects into an + // encrypted destination object. + _, err := obj2.CopierFrom(obj2.Key(key)).Run(ctx) // unencrypt obj2 + if err != nil { + t.Fatal(err) + } + if _, err := obj3.Key(key).ComposerFrom(obj2).Run(ctx); err == nil { + t.Fatal("got nil, want error") + } +} + +func TestIntegration_NonexistentBucket(t *testing.T) { + t.Parallel() + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + + bkt := client.Bucket(uidSpace.New()) + if _, err := bkt.Attrs(ctx); err != ErrBucketNotExist { + t.Errorf("Attrs: got %v, want ErrBucketNotExist", err) + } + it := bkt.Objects(ctx, nil) + if _, err := it.Next(); err != ErrBucketNotExist { + t.Errorf("Objects: got %v, want ErrBucketNotExist", err) + } +} + +func TestIntegration_PerObjectStorageClass(t *testing.T) { + const ( + defaultStorageClass = "STANDARD" + newStorageClass = "MULTI_REGIONAL" + ) + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(bucketName) + + // The bucket should have the default storage class. + battrs := h.mustBucketAttrs(bkt) + if battrs.StorageClass != defaultStorageClass { + t.Fatalf("bucket storage class: got %q, want %q", + battrs.StorageClass, defaultStorageClass) + } + // Write an object; it should start with the bucket's storage class. + obj := bkt.Object("posc") + h.mustWrite(obj.NewWriter(ctx), []byte("foo")) + oattrs, err := obj.Attrs(ctx) + if err != nil { + t.Fatal(err) + } + if oattrs.StorageClass != defaultStorageClass { + t.Fatalf("object storage class: got %q, want %q", + oattrs.StorageClass, defaultStorageClass) + } + // Now use Copy to change the storage class. + copier := obj.CopierFrom(obj) + copier.StorageClass = newStorageClass + oattrs2, err := copier.Run(ctx) + if err != nil { + log.Fatal(err) + } + if oattrs2.StorageClass != newStorageClass { + t.Fatalf("new object storage class: got %q, want %q", + oattrs2.StorageClass, newStorageClass) + } + + // We can also write a new object using a non-default storage class. + obj2 := bkt.Object("posc2") + w := obj2.NewWriter(ctx) + w.StorageClass = newStorageClass + h.mustWrite(w, []byte("xxx")) + if w.Attrs().StorageClass != newStorageClass { + t.Fatalf("new object storage class: got %q, want %q", + w.Attrs().StorageClass, newStorageClass) + } +} + +func TestIntegration_BucketInCopyAttrs(t *testing.T) { + // Confirm that if bucket is included in the object attributes of a rewrite + // call, but object name and content-type aren't, then we get an error. See + // the comment in Copier.Run. + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(bucketName) + obj := bkt.Object("bucketInCopyAttrs") + h.mustWrite(obj.NewWriter(ctx), []byte("foo")) + copier := obj.CopierFrom(obj) + rawObject := copier.ObjectAttrs.toRawObject(bucketName) + _, err := copier.callRewrite(ctx, rawObject) + if err == nil { + t.Errorf("got nil, want error") + } +} + +func TestIntegration_NoUnicodeNormalization(t *testing.T) { + t.Parallel() + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + bkt := client.Bucket("storage-library-test-bucket") + h := testHelper{t} + + for _, tst := range []struct { + nameQuoted, content string + }{ + {`"Caf\u00e9"`, "Normalization Form C"}, + {`"Cafe\u0301"`, "Normalization Form D"}, + } { + name, err := strconv.Unquote(tst.nameQuoted) + if err != nil { + t.Fatalf("invalid name: %s: %v", tst.nameQuoted, err) + } + if got := string(h.mustRead(bkt.Object(name))); got != tst.content { + t.Errorf("content of %s is %q, want %q", tst.nameQuoted, got, tst.content) + } + } +} + +func TestIntegration_HashesOnUpload(t *testing.T) { + // Check that the user can provide hashes on upload, and that these are checked. + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + obj := client.Bucket(bucketName).Object("hashesOnUpload-1") + data := []byte("I can't wait to be verified") + + write := func(w *Writer) error { + if _, err := w.Write(data); err != nil { + _ = w.Close() + return err + } + return w.Close() + } + + crc32c := crc32.Checksum(data, crc32cTable) + // The correct CRC should succeed. + w := obj.NewWriter(ctx) + w.CRC32C = crc32c + w.SendCRC32C = true + if err := write(w); err != nil { + t.Fatal(err) + } + + // If we change the CRC, validation should fail. + w = obj.NewWriter(ctx) + w.CRC32C = crc32c + 1 + w.SendCRC32C = true + if err := write(w); err == nil { + t.Fatal("write with bad CRC32c: want error, got nil") + } + + // If we have the wrong CRC but forget to send it, we succeed. + w = obj.NewWriter(ctx) + w.CRC32C = crc32c + 1 + if err := write(w); err != nil { + t.Fatal(err) + } + + // MD5 + md5 := md5.Sum(data) + // The correct MD5 should succeed. + w = obj.NewWriter(ctx) + w.MD5 = md5[:] + if err := write(w); err != nil { + t.Fatal(err) + } + + // If we change the MD5, validation should fail. + w = obj.NewWriter(ctx) + w.MD5 = append([]byte(nil), md5[:]...) + w.MD5[0]++ + if err := write(w); err == nil { + t.Fatal("write with bad MD5: want error, got nil") + } +} + +func TestIntegration_BucketIAM(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + + bkt := client.Bucket(bucketName) + + // This bucket is unique to this test run. So we don't have + // to worry about other runs interfering with our IAM policy + // changes. + + member := "projectViewer:" + testutil.ProjID() + role := iam.RoleName("roles/storage.objectViewer") + // Get the bucket's IAM policy. + policy, err := bkt.IAM().Policy(ctx) + if err != nil { + t.Fatalf("Getting policy: %v", err) + } + // The member should not have the role. + if policy.HasRole(member, role) { + t.Errorf("member %q has role %q", member, role) + } + // Change the policy. + policy.Add(member, role) + if err := bkt.IAM().SetPolicy(ctx, policy); err != nil { + t.Fatalf("SetPolicy: %v", err) + } + // Confirm that the binding was added. + policy, err = bkt.IAM().Policy(ctx) + if err != nil { + t.Fatalf("Getting policy: %v", err) + } + if !policy.HasRole(member, role) { + t.Errorf("member %q does not have role %q", member, role) + } + + // Check TestPermissions. + // This client should have all these permissions (and more). + perms := []string{"storage.buckets.get", "storage.buckets.delete"} + got, err := bkt.IAM().TestPermissions(ctx, perms) + if err != nil { + t.Fatalf("TestPermissions: %v", err) + } + sort.Strings(perms) + sort.Strings(got) + if !testutil.Equal(got, perms) { + t.Errorf("got %v, want %v", got, perms) + } +} + +func TestIntegration_RequesterPays(t *testing.T) { + // This test needs a second project and user (token source) to test + // all possibilities. Since we need these things for Firestore already, + // we use them here. + // + // There are up to three entities involved in a requester-pays call: + // + // 1. The user making the request. Here, we use + // a. The account used to create the token source used for all our + // integration tests (see testutil.TokenSource). + // b. The account used for the Firestore tests. + // 2. The project that owns the requester-pays bucket. Here, that + // is the test project ID (see testutil.ProjID). + // 3. The project provided as the userProject parameter of the request; + // the project to be billed. This test uses: + // a. The project that owns the requester-pays bucket (same as (2)) + // b. Another project (the Firestore project). + // + // The following must hold for this test to work: + // - (1a) must have resourcemanager.projects.createBillingAssignment permission + // (Owner role) on (2) (the project, not the bucket). + // - (1b) must NOT have that permission on (2). + // - (1b) must have serviceusage.services.use permission (Editor role) on (3b). + // - (1b) must NOT have that permission on (3a). + // - (1a) must NOT have that permission on (3b). + const wantErrorCode = 400 + + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bucketName2 := uidSpace.New() + b1 := client.Bucket(bucketName2) + projID := testutil.ProjID() + // Use Firestore project as a project that does not contain the bucket. + otherProjID := os.Getenv(envFirestoreProjID) + if otherProjID == "" { + t.Fatalf("need a second project (env var %s)", envFirestoreProjID) + } + ts := testutil.TokenSourceEnv(ctx, envFirestorePrivateKey, ScopeFullControl) + if ts == nil { + t.Fatalf("need a second account (env var %s)", envFirestorePrivateKey) + } + otherClient, err := newTestClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + defer otherClient.Close() + b2 := otherClient.Bucket(bucketName2) + user, err := keyFileEmail(os.Getenv("GCLOUD_TESTS_GOLANG_KEY")) + if err != nil { + t.Fatal(err) + } + otherUser, err := keyFileEmail(os.Getenv(envFirestorePrivateKey)) + if err != nil { + t.Fatal(err) + } + + // Create a requester-pays bucket. The bucket is contained in the project projID. + h.mustCreate(b1, projID, &BucketAttrs{RequesterPays: true}) + if err := b1.ACL().Set(ctx, ACLEntity("user-"+otherUser), RoleOwner); err != nil { + t.Fatal(err) + } + + // Extract the error code from err if it's a googleapi.Error. + errCode := func(err error) int { + if err == nil { + return 0 + } + if err, ok := err.(*googleapi.Error); ok { + return err.Code + } + return -1 + } + + // Call f under various conditions. + // Here b and ob refer to the same bucket, but b is bound to client, + // while ob is bound to otherClient. The clients differ in their credentials, + // i.e. the identity of the user making the RPC: b's user is an Owner on the + // bucket's containing project, ob's is not. + call := func(msg string, f func(*BucketHandle) error) { + // user: an Owner on the containing project + // userProject: absent + // result: success, by the rule permitting access by owners of the containing bucket. + if err := f(b1); err != nil { + t.Errorf("%s: %v, want nil\n"+ + "confirm that %s is an Owner on %s", + msg, err, user, projID) + } + // user: an Owner on the containing project + // userProject: containing project + // result: success, by the same rule as above; userProject is unnecessary but allowed. + if err := f(b1.UserProject(projID)); err != nil { + t.Errorf("%s: got %v, want nil", msg, err) + } + // user: not an Owner on the containing project + // userProject: absent + // result: failure, by the standard requester-pays rule + err := f(b2) + if got, want := errCode(err), wantErrorCode; got != want { + t.Errorf("%s: got error %v with code %d, want code %d\n"+ + "confirm that %s is NOT an Owner on %s", + msg, err, got, want, otherUser, projID) + } + // user: not an Owner on the containing project + // userProject: not the containing one, but user has Editor role on it + // result: success, by the standard requester-pays rule + if err := f(b2.UserProject(otherProjID)); err != nil { + t.Errorf("%s: got %v, want nil\n"+ + "confirm that %s is an Editor on %s and that that project has billing enabled", + msg, err, otherUser, otherProjID) + } + // user: not an Owner on the containing project + // userProject: the containing one, on which the user does NOT have Editor permission. + // result: failure + err = f(b2.UserProject("veener-jba")) + if got, want := errCode(err), 403; got != want { + t.Errorf("%s: got error %v, want code %d\n"+ + "confirm that %s is NOT an Editor on %s", + msg, err, want, otherUser, "veener-jba") + } + } + + // Getting its attributes requires a user project. + var attrs *BucketAttrs + call("Bucket attrs", func(b *BucketHandle) error { + a, err := b.Attrs(ctx) + if a != nil { + attrs = a + } + return err + }) + if attrs != nil { + if got, want := attrs.RequesterPays, true; got != want { + t.Fatalf("attr.RequesterPays = %t, want %t", got, want) + } + } + // Object operations. + call("write object", func(b *BucketHandle) error { + return writeObject(ctx, b.Object("foo"), "text/plain", []byte("hello")) + }) + call("read object", func(b *BucketHandle) error { + _, err := readObject(ctx, b.Object("foo")) + return err + }) + call("object attrs", func(b *BucketHandle) error { + _, err := b.Object("foo").Attrs(ctx) + return err + }) + call("update object", func(b *BucketHandle) error { + _, err := b.Object("foo").Update(ctx, ObjectAttrsToUpdate{ContentLanguage: "en"}) + return err + }) + + // ACL operations. + entity := ACLEntity("domain-google.com") + call("bucket acl set", func(b *BucketHandle) error { + return b.ACL().Set(ctx, entity, RoleReader) + }) + call("bucket acl list", func(b *BucketHandle) error { + _, err := b.ACL().List(ctx) + return err + }) + call("bucket acl delete", func(b *BucketHandle) error { + err := b.ACL().Delete(ctx, entity) + if errCode(err) == 404 { + // Since we call the function multiple times, it will + // fail with NotFound for all but the first. + return nil + } + return err + }) + call("default object acl set", func(b *BucketHandle) error { + return b.DefaultObjectACL().Set(ctx, entity, RoleReader) + }) + call("default object acl list", func(b *BucketHandle) error { + _, err := b.DefaultObjectACL().List(ctx) + return err + }) + call("default object acl delete", func(b *BucketHandle) error { + err := b.DefaultObjectACL().Delete(ctx, entity) + if errCode(err) == 404 { + return nil + } + return err + }) + call("object acl set", func(b *BucketHandle) error { + return b.Object("foo").ACL().Set(ctx, entity, RoleReader) + }) + call("object acl list", func(b *BucketHandle) error { + _, err := b.Object("foo").ACL().List(ctx) + return err + }) + call("object acl delete", func(b *BucketHandle) error { + err := b.Object("foo").ACL().Delete(ctx, entity) + if errCode(err) == 404 { + return nil + } + return err + }) + + // Copy and compose. + call("copy", func(b *BucketHandle) error { + _, err := b.Object("copy").CopierFrom(b.Object("foo")).Run(ctx) + return err + }) + call("compose", func(b *BucketHandle) error { + _, err := b.Object("compose").ComposerFrom(b.Object("foo"), b.Object("copy")).Run(ctx) + return err + }) + call("delete object", func(b *BucketHandle) error { + // Make sure the object exists, so we don't get confused by ErrObjectNotExist. + // The storage service may perform validation in any order (perhaps in parallel), + // so if we delete an object that doesn't exist and for which we lack permission, + // we could see either of those two errors. (See Google-internal bug 78341001.) + h.mustWrite(b1.Object("foo").NewWriter(ctx), []byte("hello")) // note: b1, not b. + return b.Object("foo").Delete(ctx) + }) + b1.Object("foo").Delete(ctx) // Make sure object is deleted. + for _, obj := range []string{"copy", "compose"} { + if err := b1.UserProject(projID).Object(obj).Delete(ctx); err != nil { + t.Fatalf("could not delete %q: %v", obj, err) + } + } + + h.mustDeleteBucket(b1) +} + +// TODO(jba): move to testutil, factor out from firestore/integration_test.go. +const ( + envFirestoreProjID = "GCLOUD_TESTS_GOLANG_FIRESTORE_PROJECT_ID" + envFirestorePrivateKey = "GCLOUD_TESTS_GOLANG_FIRESTORE_KEY" +) + +func keyFileEmail(filename string) (string, error) { + bytes, err := ioutil.ReadFile(filename) + if err != nil { + return "", err + } + var v struct { + ClientEmail string `json:"client_email"` + } + if err := json.Unmarshal(bytes, &v); err != nil { + return "", err + } + return v.ClientEmail, nil +} + +func TestIntegration_Notifications(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + bkt := client.Bucket(bucketName) + + checkNotifications := func(msg string, want map[string]*Notification) { + got, err := bkt.Notifications(ctx) + if err != nil { + t.Fatal(err) + } + if diff := testutil.Diff(got, want); diff != "" { + t.Errorf("%s: got=-, want=+:\n%s", msg, diff) + } + } + checkNotifications("initial", map[string]*Notification{}) + + nArg := &Notification{ + TopicProjectID: testutil.ProjID(), + TopicID: "go-storage-notification-test", + PayloadFormat: NoPayload, + } + n, err := bkt.AddNotification(ctx, nArg) + if err != nil { + t.Fatal(err) + } + nArg.ID = n.ID + if !testutil.Equal(n, nArg) { + t.Errorf("got %+v, want %+v", n, nArg) + } + checkNotifications("after add", map[string]*Notification{n.ID: n}) + + if err := bkt.DeleteNotification(ctx, n.ID); err != nil { + t.Fatal(err) + } + checkNotifications("after delete", map[string]*Notification{}) +} + +func TestIntegration_PublicBucket(t *testing.T) { + // Confirm that an unauthenticated client can access a public bucket. + // See https://cloud.google.com/storage/docs/public-datasets/landsat + if testing.Short() && !replaying { + t.Skip("Integration tests skipped in short mode") + } + + const landsatBucket = "gcp-public-data-landsat" + const landsatPrefix = "LC08/PRE/044/034/LC80440342016259LGN00/" + const landsatObject = landsatPrefix + "LC80440342016259LGN00_MTL.txt" + + // Create an unauthenticated client. + ctx := context.Background() + client, err := newTestClient(ctx, option.WithoutAuthentication()) + if err != nil { + t.Fatal(err) + } + defer client.Close() + h := testHelper{t} + bkt := client.Bucket(landsatBucket) + obj := bkt.Object(landsatObject) + + // Read a public object. + bytes := h.mustRead(obj) + if got, want := len(bytes), 7903; got != want { + t.Errorf("len(bytes) = %d, want %d", got, want) + } + + // List objects in a public bucket. + iter := bkt.Objects(ctx, &Query{Prefix: landsatPrefix}) + gotCount := 0 + for { + _, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + t.Fatal(err) + } + gotCount++ + } + if wantCount := 13; gotCount != wantCount { + t.Errorf("object count: got %d, want %d", gotCount, wantCount) + } + + errCode := func(err error) int { + err2, ok := err.(*googleapi.Error) + if !ok { + return -1 + } + return err2.Code + } + + // Reading from or writing to a non-public bucket fails. + c := testConfig(ctx, t) + defer c.Close() + nonPublicObj := client.Bucket(bucketName).Object("noauth") + // Oddly, reading returns 403 but writing returns 401. + _, err = readObject(ctx, nonPublicObj) + if got, want := errCode(err), 403; got != want { + t.Errorf("got code %d; want %d\nerror: %v", got, want, err) + } + err = writeObject(ctx, nonPublicObj, "text/plain", []byte("b")) + if got, want := errCode(err), 401; got != want { + t.Errorf("got code %d; want %d\nerror: %v", got, want, err) + } +} + +func TestIntegration_ReadCRC(t *testing.T) { + // Test that the checksum is handled correctly when reading files. + // For gzipped files, see https://github.com/GoogleCloudPlatform/google-cloud-dotnet/issues/1641. + if testing.Short() && !replaying { + t.Skip("Integration tests skipped in short mode") + } + + const ( + // This is an uncompressed file. + // See https://cloud.google.com/storage/docs/public-datasets/landsat + uncompressedBucket = "gcp-public-data-landsat" + uncompressedObject = "LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt" + + gzippedBucket = "storage-library-test-bucket" + gzippedObject = "gzipped-text.txt" + gzippedContents = "hello world" // uncompressed contents of the file + ) + ctx := context.Background() + client, err := newTestClient(ctx, option.WithoutAuthentication()) + if err != nil { + t.Fatal(err) + } + defer client.Close() + + for _, test := range []struct { + desc string + obj *ObjectHandle + offset, length int64 + readCompressed bool // don't decompress a gzipped file + + wantErr bool + wantCheck bool // Should Reader try to check the CRC? + }{ + { + desc: "uncompressed, entire file", + obj: client.Bucket(uncompressedBucket).Object(uncompressedObject), + offset: 0, + length: -1, + readCompressed: false, + wantCheck: true, + }, + { + desc: "uncompressed, entire file, don't decompress", + obj: client.Bucket(uncompressedBucket).Object(uncompressedObject), + offset: 0, + length: -1, + readCompressed: true, + wantCheck: true, + }, + { + desc: "uncompressed, suffix", + obj: client.Bucket(uncompressedBucket).Object(uncompressedObject), + offset: 1, + length: -1, + readCompressed: false, + wantCheck: false, + }, + { + desc: "uncompressed, prefix", + obj: client.Bucket(uncompressedBucket).Object(uncompressedObject), + offset: 0, + length: 18, + readCompressed: false, + wantCheck: false, + }, + { + // When a gzipped file is unzipped on read, we can't verify the checksum + // because it was computed against the zipped contents. We can detect + // this case using http.Response.Uncompressed. + desc: "compressed, entire file, unzipped", + obj: client.Bucket(gzippedBucket).Object(gzippedObject), + offset: 0, + length: -1, + readCompressed: false, + wantCheck: false, + }, + { + // When we read a gzipped file uncompressed, it's like reading a regular file: + // the served content and the CRC match. + desc: "compressed, entire file, read compressed", + obj: client.Bucket(gzippedBucket).Object(gzippedObject), + offset: 0, + length: -1, + readCompressed: true, + wantCheck: true, + }, + { + desc: "compressed, partial, server unzips", + obj: client.Bucket(gzippedBucket).Object(gzippedObject), + offset: 1, + length: 8, + readCompressed: false, + wantErr: true, // GCS can't serve part of a gzipped object + wantCheck: false, + }, + { + desc: "compressed, partial, read compressed", + obj: client.Bucket(gzippedBucket).Object(gzippedObject), + offset: 1, + length: 8, + readCompressed: true, + wantCheck: false, + }, + } { + obj := test.obj.ReadCompressed(test.readCompressed) + r, err := obj.NewRangeReader(ctx, test.offset, test.length) + if err != nil { + if test.wantErr { + continue + } + t.Fatalf("%s: %v", test.desc, err) + } + if got, want := r.checkCRC, test.wantCheck; got != want { + t.Errorf("%s, checkCRC: got %t, want %t", test.desc, got, want) + } + _, err = ioutil.ReadAll(r) + _ = r.Close() + if err != nil { + t.Fatalf("%s: %v", test.desc, err) + } + } +} + +func TestIntegration_CancelWrite(t *testing.T) { + // Verify that canceling the writer's context immediately stops uploading an object. + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + bkt := client.Bucket(bucketName) + + cctx, cancel := context.WithCancel(ctx) + defer cancel() + obj := bkt.Object("cancel-write") + w := obj.NewWriter(cctx) + w.ChunkSize = googleapi.MinUploadChunkSize + buf := make([]byte, w.ChunkSize) + // Write the first chunk. This is read in its entirety before sending the request + // (see google.golang.org/api/gensupport.PrepareUpload), so we expect it to return + // without error. + _, err := w.Write(buf) + if err != nil { + t.Fatal(err) + } + // Now cancel the context. + cancel() + // The next Write should return context.Canceled. + _, err = w.Write(buf) + if err != context.Canceled { + t.Fatalf("got %v, wanted context.Canceled", err) + } + // The Close should too. + err = w.Close() + if err != context.Canceled { + t.Fatalf("got %v, wanted context.Canceled", err) + } +} + +func TestIntegration_UpdateCORS(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + initialSettings := []CORS{ + { + MaxAge: time.Hour, + Methods: []string{"POST"}, + Origins: []string{"some-origin.com"}, + ResponseHeaders: []string{"foo-bar"}, + }, + } + + for _, test := range []struct { + input []CORS + want []CORS + }{ + { + input: []CORS{ + { + MaxAge: time.Hour, + Methods: []string{"GET"}, + Origins: []string{"*"}, + ResponseHeaders: []string{"some-header"}, + }, + }, + want: []CORS{ + { + MaxAge: time.Hour, + Methods: []string{"GET"}, + Origins: []string{"*"}, + ResponseHeaders: []string{"some-header"}, + }, + }, + }, + { + input: []CORS{}, + want: nil, + }, + { + input: nil, + want: []CORS{ + { + MaxAge: time.Hour, + Methods: []string{"POST"}, + Origins: []string{"some-origin.com"}, + ResponseHeaders: []string{"foo-bar"}, + }, + }, + }, + } { + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{CORS: initialSettings}) + defer h.mustDeleteBucket(bkt) + h.mustUpdateBucket(bkt, BucketAttrsToUpdate{CORS: test.input}) + attrs := h.mustBucketAttrs(bkt) + if diff := testutil.Diff(attrs.CORS, test.want); diff != "" { + t.Errorf("input: %v\ngot=-, want=+:\n%s", test.input, diff) + } + } +} + +func TestIntegration_UpdateDefaultEventBasedHold(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{}) + defer h.mustDeleteBucket(bkt) + attrs := h.mustBucketAttrs(bkt) + if attrs.DefaultEventBasedHold != false { + t.Errorf("got=%v, want=%v", attrs.DefaultEventBasedHold, false) + } + + h.mustUpdateBucket(bkt, BucketAttrsToUpdate{DefaultEventBasedHold: true}) + attrs = h.mustBucketAttrs(bkt) + if attrs.DefaultEventBasedHold != true { + t.Errorf("got=%v, want=%v", attrs.DefaultEventBasedHold, true) + } + + // Omitting it should leave the value unchanged. + h.mustUpdateBucket(bkt, BucketAttrsToUpdate{RequesterPays: true}) + attrs = h.mustBucketAttrs(bkt) + if attrs.DefaultEventBasedHold != true { + t.Errorf("got=%v, want=%v", attrs.DefaultEventBasedHold, true) + } +} + +func TestIntegration_UpdateEventBasedHold(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{}) + obj := bkt.Object("some-obj") + h.mustWrite(obj.NewWriter(ctx), randomContents()) + + defer func() { + h.mustUpdateObject(obj, ObjectAttrsToUpdate{EventBasedHold: false}) + h.mustDeleteObject(obj) + h.mustDeleteBucket(bkt) + }() + + attrs := h.mustObjectAttrs(obj) + if attrs.EventBasedHold != false { + t.Fatalf("got=%v, want=%v", attrs.EventBasedHold, false) + } + + h.mustUpdateObject(obj, ObjectAttrsToUpdate{EventBasedHold: true}) + attrs = h.mustObjectAttrs(obj) + if attrs.EventBasedHold != true { + t.Fatalf("got=%v, want=%v", attrs.EventBasedHold, true) + } + + // Omitting it should leave the value unchanged. + h.mustUpdateObject(obj, ObjectAttrsToUpdate{ContentType: "foo"}) + attrs = h.mustObjectAttrs(obj) + if attrs.EventBasedHold != true { + t.Fatalf("got=%v, want=%v", attrs.EventBasedHold, true) + } +} + +func TestIntegration_UpdateTemporaryHold(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{}) + obj := bkt.Object("some-obj") + h.mustWrite(obj.NewWriter(ctx), randomContents()) + + defer func() { + h.mustUpdateObject(obj, ObjectAttrsToUpdate{TemporaryHold: false}) + h.mustDeleteObject(obj) + h.mustDeleteBucket(bkt) + }() + + attrs := h.mustObjectAttrs(obj) + if attrs.TemporaryHold != false { + t.Fatalf("got=%v, want=%v", attrs.TemporaryHold, false) + } + + h.mustUpdateObject(obj, ObjectAttrsToUpdate{TemporaryHold: true}) + attrs = h.mustObjectAttrs(obj) + if attrs.TemporaryHold != true { + t.Fatalf("got=%v, want=%v", attrs.TemporaryHold, true) + } + + // Omitting it should leave the value unchanged. + h.mustUpdateObject(obj, ObjectAttrsToUpdate{ContentType: "foo"}) + attrs = h.mustObjectAttrs(obj) + if attrs.TemporaryHold != true { + t.Fatalf("got=%v, want=%v", attrs.TemporaryHold, true) + } +} + +func TestIntegration_UpdateRetentionExpirationTime(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{RetentionPolicy: &RetentionPolicy{RetentionPeriod: time.Hour}}) + obj := bkt.Object("some-obj") + h.mustWrite(obj.NewWriter(ctx), randomContents()) + + defer func() { + h.mustUpdateBucket(bkt, BucketAttrsToUpdate{RetentionPolicy: &RetentionPolicy{RetentionPeriod: 0}}) + h.mustDeleteObject(obj) + h.mustDeleteBucket(bkt) + }() + + attrs := h.mustObjectAttrs(obj) + if attrs.RetentionExpirationTime == (time.Time{}) { + t.Fatalf("got=%v, wanted a non-zero value", attrs.RetentionExpirationTime) + } +} + +func TestIntegration_UpdateRetentionPolicy(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + initial := &RetentionPolicy{RetentionPeriod: time.Minute} + + for _, test := range []struct { + input *RetentionPolicy + want *RetentionPolicy + }{ + { // Update + input: &RetentionPolicy{RetentionPeriod: time.Hour}, + want: &RetentionPolicy{RetentionPeriod: time.Hour}, + }, + { // Update even with timestamp (EffectiveTime should be ignored) + input: &RetentionPolicy{RetentionPeriod: time.Hour, EffectiveTime: time.Now()}, + want: &RetentionPolicy{RetentionPeriod: time.Hour}, + }, + { // Remove + input: &RetentionPolicy{}, + want: nil, + }, + { // Remove even with timestamp (EffectiveTime should be ignored) + input: &RetentionPolicy{EffectiveTime: time.Now()}, + want: nil, + }, + { // Ignore + input: nil, + want: initial, + }, + } { + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{RetentionPolicy: initial}) + defer h.mustDeleteBucket(bkt) + h.mustUpdateBucket(bkt, BucketAttrsToUpdate{RetentionPolicy: test.input}) + attrs := h.mustBucketAttrs(bkt) + if attrs.RetentionPolicy != nil && attrs.RetentionPolicy.EffectiveTime.Unix() == 0 { + // Should be set by the server and parsed by the client + t.Fatal("EffectiveTime should be set, but it was not") + } + if diff := testutil.Diff(attrs.RetentionPolicy, test.want, cmpopts.IgnoreTypes(time.Time{})); diff != "" { + t.Errorf("input: %v\ngot=-, want=+:\n%s", test.input, diff) + } + } +} + +func TestIntegration_DeleteObjectInBucketWithRetentionPolicy(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{RetentionPolicy: &RetentionPolicy{RetentionPeriod: 25 * time.Hour}}) + + oh := bkt.Object("some-object") + if err := writeObject(ctx, oh, "text/plain", []byte("hello world")); err != nil { + t.Fatal(err) + } + + if err := oh.Delete(ctx); err == nil { + t.Fatal("expected to err deleting an object in a bucket with retention period, but got nil") + } + + // Remove the retention period + h.mustUpdateBucket(bkt, BucketAttrsToUpdate{RetentionPolicy: &RetentionPolicy{RetentionPeriod: 0}}) + h.mustDeleteObject(oh) + h.mustDeleteBucket(bkt) +} + +func TestIntegration_LockBucket(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{RetentionPolicy: &RetentionPolicy{RetentionPeriod: time.Hour * 25}}) + attrs := h.mustBucketAttrs(bkt) + if attrs.RetentionPolicy.IsLocked { + t.Fatal("Expected bucket to begin unlocked, but it was not") + } + err := bkt.If(BucketConditions{MetagenerationMatch: attrs.MetaGeneration}).LockRetentionPolicy(ctx) + if err != nil { + t.Fatal("could not lock", err) + } + + attrs = h.mustBucketAttrs(bkt) + if !attrs.RetentionPolicy.IsLocked { + t.Fatal("Expected bucket to be locked, but it was not") + } + + _, err = bkt.Update(ctx, BucketAttrsToUpdate{RetentionPolicy: &RetentionPolicy{RetentionPeriod: time.Hour}}) + if err == nil { + t.Fatal("Expected error updating locked bucket, got nil") + } +} + +func TestIntegration_LockBucket_MetagenerationRequired(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{ + RetentionPolicy: &RetentionPolicy{RetentionPeriod: time.Hour * 25}, + }) + err := bkt.LockRetentionPolicy(ctx) + if err == nil { + t.Fatal("expected error locking bucket without metageneration condition, got nil") + } +} + +func TestIntegration_KMS(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + keyRingName := os.Getenv("GCLOUD_TESTS_GOLANG_KEYRING") + if keyRingName == "" { + t.Fatal("GCLOUD_TESTS_GOLANG_KEYRING must be set. See CONTRIBUTING.md for details") + } + keyName1 := keyRingName + "/cryptoKeys/key1" + keyName2 := keyRingName + "/cryptoKeys/key2" + contents := []byte("my secret") + + write := func(obj *ObjectHandle, setKey bool) { + w := obj.NewWriter(ctx) + if setKey { + w.KMSKeyName = keyName1 + } + h.mustWrite(w, contents) + } + + checkRead := func(obj *ObjectHandle) { + got := h.mustRead(obj) + if !bytes.Equal(got, contents) { + t.Errorf("got %v, want %v", got, contents) + } + attrs := h.mustObjectAttrs(obj) + if len(attrs.KMSKeyName) < len(keyName1) || attrs.KMSKeyName[:len(keyName1)] != keyName1 { + t.Errorf("got %q, want %q", attrs.KMSKeyName, keyName1) + } + } + + // Write an object with a key, then read it to verify its contents and the presence of the key name. + bkt := client.Bucket(bucketName) + obj := bkt.Object("kms") + write(obj, true) + checkRead(obj) + h.mustDeleteObject(obj) + + // Encrypt an object with a CSEK, then copy it using a CMEK. + src := bkt.Object("csek").Key(testEncryptionKey) + if err := writeObject(ctx, src, "text/plain", contents); err != nil { + t.Fatal(err) + } + dest := bkt.Object("cmek") + c := dest.CopierFrom(src) + c.DestinationKMSKeyName = keyName1 + if _, err := c.Run(ctx); err != nil { + t.Fatal(err) + } + checkRead(dest) + src.Delete(ctx) + dest.Delete(ctx) + + // Create a bucket with a default key, then write and read an object. + bkt = client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{ + Location: "US", + Encryption: &BucketEncryption{DefaultKMSKeyName: keyName1}, + }) + defer h.mustDeleteBucket(bkt) + + attrs := h.mustBucketAttrs(bkt) + if got, want := attrs.Encryption.DefaultKMSKeyName, keyName1; got != want { + t.Fatalf("got %q, want %q", got, want) + } + obj = bkt.Object("kms") + write(obj, false) + checkRead(obj) + h.mustDeleteObject(obj) + + // Update the bucket's default key to a different name. + // (This key doesn't have to exist.) + attrs = h.mustUpdateBucket(bkt, BucketAttrsToUpdate{Encryption: &BucketEncryption{DefaultKMSKeyName: keyName2}}) + if got, want := attrs.Encryption.DefaultKMSKeyName, keyName2; got != want { + t.Fatalf("got %q, want %q", got, want) + } + attrs = h.mustBucketAttrs(bkt) + if got, want := attrs.Encryption.DefaultKMSKeyName, keyName2; got != want { + t.Fatalf("got %q, want %q", got, want) + } + + // Remove the default KMS key. + attrs = h.mustUpdateBucket(bkt, BucketAttrsToUpdate{Encryption: &BucketEncryption{DefaultKMSKeyName: ""}}) + if attrs.Encryption != nil { + t.Fatalf("got %#v, want nil", attrs.Encryption) + } +} + +func TestIntegration_PredefinedACLs(t *testing.T) { + check := func(msg string, rs []ACLRule, i int, wantEntity ACLEntity, wantRole ACLRole) { + if i >= len(rs) { + t.Errorf("%s: no rule at index %d", msg, i) + return + } + got := rs[i] + if got.Entity != wantEntity || got.Role != wantRole { + t.Errorf("%s[%d]: got %+v, want Entity %s and Role %s", + msg, i, got, wantEntity, wantRole) + } + } + checkPrefix := func(msg string, rs []ACLRule, i int, wantPrefix string, wantRole ACLRole) { + if i >= len(rs) { + t.Errorf("%s: no rule at index %d", msg, i) + return + } + got := rs[i] + if !strings.HasPrefix(string(got.Entity), wantPrefix) || got.Role != wantRole { + t.Errorf("%s[%d]: got %+v, want Entity %s... and Role %s", + msg, i, got, wantPrefix, wantRole) + } + } + + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + h := testHelper{t} + + bkt := client.Bucket(uidSpace.New()) + h.mustCreate(bkt, testutil.ProjID(), &BucketAttrs{ + PredefinedACL: "authenticatedRead", + PredefinedDefaultObjectACL: "publicRead", + }) + defer h.mustDeleteBucket(bkt) + attrs := h.mustBucketAttrs(bkt) + checkPrefix("Bucket.ACL", attrs.ACL, 0, "project-owners", RoleOwner) + check("Bucket.ACL", attrs.ACL, 1, AllAuthenticatedUsers, RoleReader) + check("DefaultObjectACL", attrs.DefaultObjectACL, 0, AllUsers, RoleReader) + + // Bucket update + attrs = h.mustUpdateBucket(bkt, BucketAttrsToUpdate{ + PredefinedACL: "private", + PredefinedDefaultObjectACL: "authenticatedRead", + }) + checkPrefix("Bucket.ACL update", attrs.ACL, 0, "project-owners", RoleOwner) + check("DefaultObjectACL update", attrs.DefaultObjectACL, 0, AllAuthenticatedUsers, RoleReader) + + // Object creation + obj := bkt.Object("private") + w := obj.NewWriter(ctx) + w.PredefinedACL = "authenticatedRead" + h.mustWrite(w, []byte("hello")) + defer h.mustDeleteObject(obj) + checkPrefix("Object.ACL", w.Attrs().ACL, 0, "user", RoleOwner) + check("Object.ACL", w.Attrs().ACL, 1, AllAuthenticatedUsers, RoleReader) + + // Object update + oattrs := h.mustUpdateObject(obj, ObjectAttrsToUpdate{PredefinedACL: "private"}) + checkPrefix("Object.ACL update", oattrs.ACL, 0, "user", RoleOwner) + if got := len(oattrs.ACL); got != 1 { + t.Errorf("got %d ACLs, want 1", got) + } + + // Copy + dst := bkt.Object("dst") + copier := dst.CopierFrom(obj) + copier.PredefinedACL = "publicRead" + oattrs, err := copier.Run(ctx) + if err != nil { + t.Fatal(err) + } + defer h.mustDeleteObject(dst) + // The copied object still retains the "private" ACL of the source object. + checkPrefix("Copy dest", oattrs.ACL, 0, "user", RoleOwner) + check("Copy dest", oattrs.ACL, 1, AllUsers, RoleReader) + + // Compose + comp := bkt.Object("comp") + composer := comp.ComposerFrom(obj, dst) + composer.PredefinedACL = "authenticatedRead" + oattrs, err = composer.Run(ctx) + if err != nil { + t.Fatal(err) + } + defer h.mustDeleteObject(comp) + // The composed object still retains the "private" ACL. + checkPrefix("Copy dest", oattrs.ACL, 0, "user", RoleOwner) + check("Copy dest", oattrs.ACL, 1, AllAuthenticatedUsers, RoleReader) +} + +func TestIntegration_ServiceAccount(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + + s, err := client.ServiceAccount(ctx, testutil.ProjID()) + if err != nil { + t.Fatal(err) + } + want := "@gs-project-accounts.iam.gserviceaccount.com" + if !strings.Contains(s, want) { + t.Fatalf("got %v, want to contain %v", s, want) + } +} + +func TestIntegration_ReaderAttrs(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + bkt := client.Bucket(bucketName) + + const defaultType = "text/plain" + obj := "some-object" + c := randomContents() + if err := writeObject(ctx, bkt.Object(obj), defaultType, c); err != nil { + t.Errorf("Write for %v failed with %v", obj, err) + } + oh := bkt.Object(obj) + + rc, err := oh.NewReader(ctx) + if err != nil { + t.Fatal(err) + } + + attrs, err := oh.Attrs(ctx) + if err != nil { + t.Fatal(err) + } + + got := rc.Attrs + want := ReaderObjectAttrs{ + Size: attrs.Size, + ContentType: attrs.ContentType, + ContentEncoding: attrs.ContentEncoding, + CacheControl: attrs.CacheControl, + LastModified: got.LastModified, // ignored, tested separately + Generation: attrs.Generation, + Metageneration: attrs.Metageneration, + } + if got != want { + t.Fatalf("got %v, wanted %v", got, want) + } + + if got.LastModified.IsZero() { + t.Fatal("LastModified is 0, should be >0") + } +} + +type testHelper struct { + t *testing.T +} + +func (h testHelper) mustCreate(b *BucketHandle, projID string, attrs *BucketAttrs) { + if err := b.Create(context.Background(), projID, attrs); err != nil { + h.t.Fatalf("%s: bucket create: %v", loc(), err) + } +} + +func (h testHelper) mustDeleteBucket(b *BucketHandle) { + if err := b.Delete(context.Background()); err != nil { + h.t.Fatalf("%s: bucket delete: %v", loc(), err) + } +} + +func (h testHelper) mustBucketAttrs(b *BucketHandle) *BucketAttrs { + attrs, err := b.Attrs(context.Background()) + if err != nil { + h.t.Fatalf("%s: bucket attrs: %v", loc(), err) + } + return attrs +} + +func (h testHelper) mustUpdateBucket(b *BucketHandle, ua BucketAttrsToUpdate) *BucketAttrs { + attrs, err := b.Update(context.Background(), ua) + if err != nil { + h.t.Fatalf("%s: update: %v", loc(), err) + } + return attrs +} + +func (h testHelper) mustObjectAttrs(o *ObjectHandle) *ObjectAttrs { + attrs, err := o.Attrs(context.Background()) + if err != nil { + h.t.Fatalf("%s: object attrs: %v", loc(), err) + } + return attrs +} + +func (h testHelper) mustDeleteObject(o *ObjectHandle) { + if err := o.Delete(context.Background()); err != nil { + h.t.Fatalf("%s: object delete: %v", loc(), err) + } +} + +func (h testHelper) mustUpdateObject(o *ObjectHandle, ua ObjectAttrsToUpdate) *ObjectAttrs { + attrs, err := o.Update(context.Background(), ua) + if err != nil { + h.t.Fatalf("%s: update: %v", loc(), err) + } + return attrs +} + +func (h testHelper) mustWrite(w *Writer, data []byte) { + if _, err := w.Write(data); err != nil { + w.Close() + h.t.Fatalf("%s: write: %v", loc(), err) + } + if err := w.Close(); err != nil { + h.t.Fatalf("%s: close write: %v", loc(), err) + } +} + +func (h testHelper) mustRead(obj *ObjectHandle) []byte { + data, err := readObject(context.Background(), obj) + if err != nil { + h.t.Fatalf("%s: read: %v", loc(), err) + } + return data +} + +func (h testHelper) mustNewReader(obj *ObjectHandle) *Reader { + r, err := obj.NewReader(context.Background()) + if err != nil { + h.t.Fatalf("%s: new reader: %v", loc(), err) + } + return r +} + +func writeObject(ctx context.Context, obj *ObjectHandle, contentType string, contents []byte) error { + w := obj.NewWriter(ctx) + w.ContentType = contentType + w.CacheControl = "public, max-age=60" + if contents != nil { + if _, err := w.Write(contents); err != nil { + _ = w.Close() + return err + } + } + return w.Close() +} + +// loc returns a string describing the file and line of its caller's call site. In +// other words, if a test function calls a helper, and the helper calls loc, then the +// string will refer to the line on which the test function called the helper. +// TODO(jba): use t.Helper once we drop go 1.6. +func loc() string { + _, file, line, ok := runtime.Caller(2) + if !ok { + return "???" + } + return fmt.Sprintf("%s:%d", filepath.Base(file), line) +} + +func readObject(ctx context.Context, obj *ObjectHandle) ([]byte, error) { + r, err := obj.NewReader(ctx) + if err != nil { + return nil, err + } + defer r.Close() + return ioutil.ReadAll(r) +} + +// cleanupBuckets deletes the bucket used for testing, as well as old +// testing buckets that weren't cleaned previously. +func cleanupBuckets() error { + if testing.Short() { + return nil // Don't clean up in short mode. + } + ctx := context.Background() + client := config(ctx) + if client == nil { + return nil // Don't cleanup if we're not configured correctly. + } + defer client.Close() + if err := killBucket(ctx, client, bucketName); err != nil { + return err + } + + // Delete buckets whose name begins with our test prefix, and which were + // created a while ago. (Unfortunately GCS doesn't provide last-modified + // time, which would be a better way to check for staleness.) + const expireAge = 24 * time.Hour + projectID := testutil.ProjID() + it := client.Buckets(ctx, projectID) + it.Prefix = testPrefix + for { + bktAttrs, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + return err + } + if time.Since(bktAttrs.Created) > expireAge { + log.Printf("deleting bucket %q, which is more than %s old", bktAttrs.Name, expireAge) + if err := killBucket(ctx, client, bktAttrs.Name); err != nil { + return err + } + } + } + return nil +} + +// killBucket deletes a bucket and all its objects. +func killBucket(ctx context.Context, client *Client, bucketName string) error { + bkt := client.Bucket(bucketName) + // Bucket must be empty to delete. + it := bkt.Objects(ctx, nil) + for { + objAttrs, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + return err + } + if err := bkt.Object(objAttrs.Name).Delete(ctx); err != nil { + return fmt.Errorf("deleting %q: %v", bucketName+"/"+objAttrs.Name, err) + } + } + // GCS is eventually consistent, so this delete may fail because the + // replica still sees an object in the bucket. We log the error and expect + // a later test run to delete the bucket. + if err := bkt.Delete(ctx); err != nil { + log.Printf("deleting %q: %v", bucketName, err) + } + return nil +} + +func randomContents() []byte { + h := md5.New() + io.WriteString(h, fmt.Sprintf("hello world%d", rng.Intn(100000))) + return h.Sum(nil) +} + +type zeros struct{} + +func (zeros) Read(p []byte) (int, error) { return len(p), nil } diff --git a/vendor/cloud.google.com/go/storage/invoke.go b/vendor/cloud.google.com/go/storage/invoke.go new file mode 100644 index 000000000..0a03f1101 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/invoke.go @@ -0,0 +1,37 @@ +// 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 storage + +import ( + "context" + + "cloud.google.com/go/internal" + gax "github.com/googleapis/gax-go" +) + +// runWithRetry calls the function until it returns nil or a non-retryable error, or +// the context is done. +func runWithRetry(ctx context.Context, call func() error) error { + return internal.Retry(ctx, gax.Backoff{}, func() (stop bool, err error) { + err = call() + if err == nil { + return true, nil + } + if shouldRetry(err) { + return false, nil + } + return true, err + }) +} diff --git a/vendor/cloud.google.com/go/storage/invoke_test.go b/vendor/cloud.google.com/go/storage/invoke_test.go new file mode 100644 index 000000000..c24e10ffc --- /dev/null +++ b/vendor/cloud.google.com/go/storage/invoke_test.go @@ -0,0 +1,56 @@ +// 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 storage + +import ( + "context" + "errors" + "testing" + + "google.golang.org/api/googleapi" +) + +func TestInvoke(t *testing.T) { + t.Parallel() + ctx := context.Background() + // Time-based tests are flaky. We just make sure that invoke eventually + // returns with the right error. + + for _, test := range []struct { + count int // number of times to return retryable error + retryCode int // error code for retryable error + err error // error to return after count returns of retryCode + }{ + {0, 0, nil}, + {0, 0, errors.New("foo")}, + {1, 429, nil}, + {1, 429, errors.New("bar")}, + {2, 518, nil}, + {2, 599, &googleapi.Error{Code: 428}}, + } { + counter := 0 + call := func() error { + counter++ + if counter <= test.count { + return &googleapi.Error{Code: test.retryCode} + } + return test.err + } + got := runWithRetry(ctx, call) + if got != test.err { + t.Errorf("%v: got %v, want %v", test, got, test.err) + } + } +} diff --git a/vendor/cloud.google.com/go/storage/mock_test.go b/vendor/cloud.google.com/go/storage/mock_test.go new file mode 100644 index 000000000..af5714305 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/mock_test.go @@ -0,0 +1,81 @@ +// 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. + +package storage + +import ( + "context" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "strings" + "testing" + + "google.golang.org/api/option" +) + +type mockTransport struct { + gotReq *http.Request + gotBody []byte + results []transportResult +} + +type transportResult struct { + res *http.Response + err error +} + +func (t *mockTransport) addResult(res *http.Response, err error) { + t.results = append(t.results, transportResult{res, err}) +} + +func (t *mockTransport) RoundTrip(req *http.Request) (*http.Response, error) { + t.gotReq = req + t.gotBody = nil + if req.Body != nil { + bytes, err := ioutil.ReadAll(req.Body) + if err != nil { + return nil, err + } + t.gotBody = bytes + } + if len(t.results) == 0 { + return nil, fmt.Errorf("error handling request") + } + result := t.results[0] + t.results = t.results[1:] + return result.res, result.err +} + +func (t *mockTransport) gotJSONBody() map[string]interface{} { + m := map[string]interface{}{} + if err := json.Unmarshal(t.gotBody, &m); err != nil { + panic(err) + } + return m +} + +func mockClient(t *testing.T, m *mockTransport) *Client { + client, err := NewClient(context.Background(), option.WithHTTPClient(&http.Client{Transport: m})) + if err != nil { + t.Fatal(err) + } + return client +} + +func bodyReader(s string) io.ReadCloser { + return ioutil.NopCloser(strings.NewReader(s)) +} diff --git a/vendor/cloud.google.com/go/storage/not_go110.go b/vendor/cloud.google.com/go/storage/not_go110.go new file mode 100644 index 000000000..66fa45bea --- /dev/null +++ b/vendor/cloud.google.com/go/storage/not_go110.go @@ -0,0 +1,42 @@ +// Copyright 2017 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. + +// +build !go1.10 + +package storage + +import ( + "net/url" + "strings" + + "google.golang.org/api/googleapi" +) + +func shouldRetry(err error) bool { + switch e := err.(type) { + case *googleapi.Error: + // Retry on 429 and 5xx, according to + // https://cloud.google.com/storage/docs/exponential-backoff. + return e.Code == 429 || (e.Code >= 500 && e.Code < 600) + case *url.Error: + // Retry on REFUSED_STREAM. + // Unfortunately the error type is unexported, so we resort to string + // matching. + return strings.Contains(e.Error(), "REFUSED_STREAM") + case interface{ Temporary() bool }: + return e.Temporary() + default: + return false + } +} diff --git a/vendor/cloud.google.com/go/storage/notifications.go b/vendor/cloud.google.com/go/storage/notifications.go new file mode 100644 index 000000000..84619b6d5 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/notifications.go @@ -0,0 +1,188 @@ +// Copyright 2017 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 storage + +import ( + "context" + "errors" + "fmt" + "regexp" + + "cloud.google.com/go/internal/trace" + raw "google.golang.org/api/storage/v1" +) + +// A Notification describes how to send Cloud PubSub messages when certain +// events occur in a bucket. +type Notification struct { + //The ID of the notification. + ID string + + // The ID of the topic to which this subscription publishes. + TopicID string + + // The ID of the project to which the topic belongs. + TopicProjectID string + + // Only send notifications about listed event types. If empty, send notifications + // for all event types. + // See https://cloud.google.com/storage/docs/pubsub-notifications#events. + EventTypes []string + + // If present, only apply this notification configuration to object names that + // begin with this prefix. + ObjectNamePrefix string + + // An optional list of additional attributes to attach to each Cloud PubSub + // message published for this notification subscription. + CustomAttributes map[string]string + + // The contents of the message payload. + // See https://cloud.google.com/storage/docs/pubsub-notifications#payload. + PayloadFormat string +} + +// Values for Notification.PayloadFormat. +const ( + // Send no payload with notification messages. + NoPayload = "NONE" + + // Send object metadata as JSON with notification messages. + JSONPayload = "JSON_API_V1" +) + +// Values for Notification.EventTypes. +const ( + // Event that occurs when an object is successfully created. + ObjectFinalizeEvent = "OBJECT_FINALIZE" + + // Event that occurs when the metadata of an existing object changes. + ObjectMetadataUpdateEvent = "OBJECT_METADATA_UPDATE" + + // Event that occurs when an object is permanently deleted. + ObjectDeleteEvent = "OBJECT_DELETE" + + // Event that occurs when the live version of an object becomes an + // archived version. + ObjectArchiveEvent = "OBJECT_ARCHIVE" +) + +func toNotification(rn *raw.Notification) *Notification { + n := &Notification{ + ID: rn.Id, + EventTypes: rn.EventTypes, + ObjectNamePrefix: rn.ObjectNamePrefix, + CustomAttributes: rn.CustomAttributes, + PayloadFormat: rn.PayloadFormat, + } + n.TopicProjectID, n.TopicID = parseNotificationTopic(rn.Topic) + return n +} + +var topicRE = regexp.MustCompile("^//pubsub.googleapis.com/projects/([^/]+)/topics/([^/]+)") + +// parseNotificationTopic extracts the project and topic IDs from from the full +// resource name returned by the service. If the name is malformed, it returns +// "?" for both IDs. +func parseNotificationTopic(nt string) (projectID, topicID string) { + matches := topicRE.FindStringSubmatch(nt) + if matches == nil { + return "?", "?" + } + return matches[1], matches[2] +} + +func toRawNotification(n *Notification) *raw.Notification { + return &raw.Notification{ + Id: n.ID, + Topic: fmt.Sprintf("//pubsub.googleapis.com/projects/%s/topics/%s", + n.TopicProjectID, n.TopicID), + EventTypes: n.EventTypes, + ObjectNamePrefix: n.ObjectNamePrefix, + CustomAttributes: n.CustomAttributes, + PayloadFormat: string(n.PayloadFormat), + } +} + +// AddNotification adds a notification to b. You must set n's TopicProjectID, TopicID +// and PayloadFormat, and must not set its ID. The other fields are all optional. The +// returned Notification's ID can be used to refer to it. +func (b *BucketHandle) AddNotification(ctx context.Context, n *Notification) (ret *Notification, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Bucket.AddNotification") + defer func() { trace.EndSpan(ctx, err) }() + + if n.ID != "" { + return nil, errors.New("storage: AddNotification: ID must not be set") + } + if n.TopicProjectID == "" { + return nil, errors.New("storage: AddNotification: missing TopicProjectID") + } + if n.TopicID == "" { + return nil, errors.New("storage: AddNotification: missing TopicID") + } + call := b.c.raw.Notifications.Insert(b.name, toRawNotification(n)) + setClientHeader(call.Header()) + if b.userProject != "" { + call.UserProject(b.userProject) + } + rn, err := call.Context(ctx).Do() + if err != nil { + return nil, err + } + return toNotification(rn), nil +} + +// Notifications returns all the Notifications configured for this bucket, as a map +// indexed by notification ID. +func (b *BucketHandle) Notifications(ctx context.Context) (n map[string]*Notification, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Bucket.Notifications") + defer func() { trace.EndSpan(ctx, err) }() + + call := b.c.raw.Notifications.List(b.name) + setClientHeader(call.Header()) + if b.userProject != "" { + call.UserProject(b.userProject) + } + var res *raw.Notifications + err = runWithRetry(ctx, func() error { + res, err = call.Context(ctx).Do() + return err + }) + if err != nil { + return nil, err + } + return notificationsToMap(res.Items), nil +} + +func notificationsToMap(rns []*raw.Notification) map[string]*Notification { + m := map[string]*Notification{} + for _, rn := range rns { + m[rn.Id] = toNotification(rn) + } + return m +} + +// DeleteNotification deletes the notification with the given ID. +func (b *BucketHandle) DeleteNotification(ctx context.Context, id string) (err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Bucket.DeleteNotification") + defer func() { trace.EndSpan(ctx, err) }() + + call := b.c.raw.Notifications.Delete(b.name, id) + setClientHeader(call.Header()) + if b.userProject != "" { + call.UserProject(b.userProject) + } + return call.Context(ctx).Do() +} diff --git a/vendor/cloud.google.com/go/storage/notifications_test.go b/vendor/cloud.google.com/go/storage/notifications_test.go new file mode 100644 index 000000000..e96ff4fde --- /dev/null +++ b/vendor/cloud.google.com/go/storage/notifications_test.go @@ -0,0 +1,98 @@ +// Copyright 2017 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 storage + +import ( + "context" + "testing" + + "cloud.google.com/go/internal/testutil" + raw "google.golang.org/api/storage/v1" +) + +func TestParseNotificationTopic(t *testing.T) { + for _, test := range []struct { + in string + wantProjectID string + wantTopicID string + }{ + {"", "?", "?"}, + {"foobar", "?", "?"}, + {"//pubsub.googleapis.com/projects/foo", "?", "?"}, + {"//pubsub.googleapis.com/projects/my-project/topics/my-topic", + "my-project", "my-topic"}, + } { + gotProjectID, gotTopicID := parseNotificationTopic(test.in) + if gotProjectID != test.wantProjectID || gotTopicID != test.wantTopicID { + t.Errorf("%q: got (%q, %q), want (%q, %q)", + test.in, gotProjectID, gotTopicID, test.wantProjectID, test.wantTopicID) + } + } + +} + +func TestConvertNotification(t *testing.T) { + want := &Notification{ + ID: "id", + TopicProjectID: "my-project", + TopicID: "my-topic", + EventTypes: []string{ObjectFinalizeEvent}, + ObjectNamePrefix: "prefix", + CustomAttributes: map[string]string{"a": "b"}, + PayloadFormat: JSONPayload, + } + got := toNotification(toRawNotification(want)) + if diff := testutil.Diff(got, want); diff != "" { + t.Errorf("got=-, want=+:\n%s", diff) + } +} + +func TestNotificationsToMap(t *testing.T) { + got := notificationsToMap(nil) + want := map[string]*Notification{} + if !testutil.Equal(got, want) { + t.Errorf("got %+v, want %+v", got, want) + } + + in := []*raw.Notification{ + {Id: "a", Topic: "//pubsub.googleapis.com/projects/P1/topics/T1"}, + {Id: "b", Topic: "//pubsub.googleapis.com/projects/P2/topics/T2"}, + {Id: "c", Topic: "//pubsub.googleapis.com/projects/P3/topics/T3"}, + } + got = notificationsToMap(in) + want = map[string]*Notification{ + "a": {ID: "a", TopicProjectID: "P1", TopicID: "T1"}, + "b": {ID: "b", TopicProjectID: "P2", TopicID: "T2"}, + "c": {ID: "c", TopicProjectID: "P3", TopicID: "T3"}, + } + if diff := testutil.Diff(got, want); diff != "" { + t.Errorf("got=-, want=+:\n%s", diff) + } +} + +func TestAddNotificationsErrors(t *testing.T) { + c := &Client{} + b := c.Bucket("b") + for _, n := range []*Notification{ + {ID: "foo", TopicProjectID: "p", TopicID: "t"}, // has ID + {TopicProjectID: "p"}, // missing TopicID + {TopicID: "t"}, // missing TopicProjectID + } { + _, err := b.AddNotification(context.Background(), n) + if err == nil { + t.Errorf("%+v: got nil, want error", n) + } + } +} diff --git a/vendor/cloud.google.com/go/storage/oc_test.go b/vendor/cloud.google.com/go/storage/oc_test.go new file mode 100644 index 000000000..21433969d --- /dev/null +++ b/vendor/cloud.google.com/go/storage/oc_test.go @@ -0,0 +1,38 @@ +// 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. + +package storage + +import ( + "context" + "testing" + + "cloud.google.com/go/internal/testutil" +) + +func TestIntegration_OCTracing(t *testing.T) { + ctx := context.Background() + client := testConfig(ctx, t) + defer client.Close() + + te := testutil.NewTestExporter() + defer te.Unregister() + + bkt := client.Bucket(bucketName) + bkt.Attrs(ctx) + + if len(te.Spans) == 0 { + t.Fatalf("Expected some spans to be created, but got %d", 0) + } +} diff --git a/vendor/cloud.google.com/go/storage/reader.go b/vendor/cloud.google.com/go/storage/reader.go new file mode 100644 index 000000000..50f381f91 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/reader.go @@ -0,0 +1,385 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package storage + +import ( + "context" + "errors" + "fmt" + "hash/crc32" + "io" + "io/ioutil" + "net/http" + "net/url" + "reflect" + "strconv" + "strings" + "time" + + "cloud.google.com/go/internal/trace" + "google.golang.org/api/googleapi" +) + +var crc32cTable = crc32.MakeTable(crc32.Castagnoli) + +// ReaderObjectAttrs are attributes about the object being read. These are populated +// during the New call. This struct only holds a subset of object attributes: to +// get the full set of attributes, use ObjectHandle.Attrs. +// +// Each field is read-only. +type ReaderObjectAttrs struct { + // Size is the length of the object's content. + Size int64 + + // ContentType is the MIME type of the object's content. + ContentType string + + // ContentEncoding is the encoding of the object's content. + ContentEncoding string + + // CacheControl specifies whether and for how long browser and Internet + // caches are allowed to cache your objects. + CacheControl string + + // LastModified is the time that the object was last modified. + LastModified time.Time + + // Generation is the generation number of the object's content. + Generation int64 + + // Metageneration is the version of the metadata for this object at + // this generation. This field is used for preconditions and for + // detecting changes in metadata. A metageneration number is only + // meaningful in the context of a particular generation of a + // particular object. + Metageneration int64 +} + +// NewReader creates a new Reader to read the contents of the +// object. +// ErrObjectNotExist will be returned if the object is not found. +// +// The caller must call Close on the returned Reader when done reading. +func (o *ObjectHandle) NewReader(ctx context.Context) (*Reader, error) { + return o.NewRangeReader(ctx, 0, -1) +} + +// 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. +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) }() + + if err := o.validate(); err != nil { + return nil, err + } + if offset < 0 { + return nil, fmt.Errorf("storage: invalid offset %d < 0", offset) + } + if o.conds != nil { + if err := o.conds.validate("NewRangeReader"); err != nil { + return nil, err + } + } + u := &url.URL{ + Scheme: "https", + Host: "storage.googleapis.com", + Path: fmt.Sprintf("/%s/%s", o.bucket, o.object), + } + verb := "GET" + if length == 0 { + verb = "HEAD" + } + req, err := http.NewRequest(verb, u.String(), nil) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if o.userProject != "" { + req.Header.Set("X-Goog-User-Project", o.userProject) + } + if o.readCompressed { + req.Header.Set("Accept-Encoding", "gzip") + } + if err := setEncryptionHeaders(req.Header, o.encryptionKey, false); err != nil { + return nil, err + } + + gen := o.gen + + // Define a function that initiates a Read with offset and length, assuming we + // have already read seen bytes. + reopen := func(seen int64) (*http.Response, error) { + start := offset + seen + 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. + req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", start, offset+length-1)) + } + // We wait to assign conditions here because the generation number can change in between reopen() runs. + req.URL.RawQuery = conditionsQuery(gen, o.conds) + var res *http.Response + err = runWithRetry(ctx, func() error { + res, err = o.c.hc.Do(req) + if err != nil { + return err + } + if res.StatusCode == http.StatusNotFound { + res.Body.Close() + return ErrObjectNotExist + } + if res.StatusCode < 200 || res.StatusCode > 299 { + body, _ := ioutil.ReadAll(res.Body) + res.Body.Close() + return &googleapi.Error{ + Code: res.StatusCode, + Header: res.Header, + Body: string(body), + } + } + if start > 0 && length != 0 && res.StatusCode != http.StatusPartialContent { + res.Body.Close() + return errors.New("storage: partial request not satisfied") + } + // If a generation hasn't been specified, and this is the first response we get, let's record the + // generation. In future requests we'll use this generation as a precondition to avoid data races. + if gen < 0 && res.Header.Get("X-Goog-Generation") != "" { + gen64, err := strconv.ParseInt(res.Header.Get("X-Goog-Generation"), 10, 64) + if err != nil { + return err + } + gen = gen64 + } + return nil + }) + if err != nil { + return nil, err + } + return res, nil + } + + res, err := reopen(0) + if err != nil { + return nil, err + } + var ( + size int64 // total size of object, even if a range was requested. + checkCRC bool + crc uint32 + ) + 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) + } + } else { + size = res.ContentLength + // Check the CRC iff all of the following hold: + // - We asked for content (length != 0). + // - We got all the content (status != PartialContent). + // - The server sent a CRC header. + // - The Go http stack did not uncompress the file. + // - We were not served compressed data that was uncompressed on download. + // The problem with the last two cases is that the CRC will not match -- GCS + // computes it on the compressed contents, but we compute it on the + // uncompressed contents. + if length != 0 && !res.Uncompressed && !uncompressedByServer(res) { + crc, checkCRC = parseCRC32c(res) + } + } + + remain := res.ContentLength + body := res.Body + if length == 0 { + remain = 0 + body.Close() + body = emptyBody + } + var metaGen int64 + if res.Header.Get("X-Goog-Generation") != "" { + metaGen, err = strconv.ParseInt(res.Header.Get("X-Goog-Metageneration"), 10, 64) + if err != nil { + return nil, err + } + } + + var lm time.Time + if res.Header.Get("Last-Modified") != "" { + lm, err = http.ParseTime(res.Header.Get("Last-Modified")) + if err != nil { + return nil, err + } + } + + attrs := ReaderObjectAttrs{ + Size: size, + ContentType: res.Header.Get("Content-Type"), + ContentEncoding: res.Header.Get("Content-Encoding"), + CacheControl: res.Header.Get("Cache-Control"), + LastModified: lm, + Generation: gen, + Metageneration: metaGen, + } + return &Reader{ + Attrs: attrs, + body: body, + size: size, + remain: remain, + wantCRC: crc, + checkCRC: checkCRC, + reopen: reopen, + }, nil +} + +func uncompressedByServer(res *http.Response) bool { + // If the data is stored as gzip but is not encoded as gzip, then it + // was uncompressed by the server. + return res.Header.Get("X-Goog-Stored-Content-Encoding") == "gzip" && + res.Header.Get("Content-Encoding") != "gzip" +} + +func parseCRC32c(res *http.Response) (uint32, bool) { + const prefix = "crc32c=" + for _, spec := range res.Header["X-Goog-Hash"] { + if strings.HasPrefix(spec, prefix) { + c, err := decodeUint32(spec[len(prefix):]) + if err == nil { + return c, true + } + } + } + return 0, false +} + +var emptyBody = ioutil.NopCloser(strings.NewReader("")) + +// Reader reads a Cloud Storage object. +// It implements io.Reader. +// +// Typically, a Reader computes the CRC of the downloaded content and compares it to +// the stored CRC, returning an error from Read if there is a mismatch. This integrity check +// is skipped if transcoding occurs. See https://cloud.google.com/storage/docs/transcoding. +type Reader struct { + Attrs ReaderObjectAttrs + body io.ReadCloser + seen, remain, size int64 + checkCRC bool // should we check the CRC? + wantCRC uint32 // the CRC32c value the server sent in the header + gotCRC uint32 // running crc + reopen func(seen int64) (*http.Response, error) +} + +// Close closes the Reader. It must be called when done reading. +func (r *Reader) Close() error { + return r.body.Close() +} + +func (r *Reader) Read(p []byte) (int, error) { + n, err := r.readWithRetry(p) + if r.remain != -1 { + r.remain -= int64(n) + } + if r.checkCRC { + r.gotCRC = crc32.Update(r.gotCRC, crc32cTable, p[:n]) + // Check CRC here. It would be natural to check it in Close, but + // everybody defers Close on the assumption that it doesn't return + // anything worth looking at. + if err == io.EOF { + if r.gotCRC != r.wantCRC { + return n, fmt.Errorf("storage: bad CRC on read: got %d, want %d", + r.gotCRC, r.wantCRC) + } + } + } + return n, err +} + +func (r *Reader) readWithRetry(p []byte) (int, error) { + n := 0 + for len(p[n:]) > 0 { + m, err := r.body.Read(p[n:]) + n += m + r.seen += int64(m) + if !shouldRetryRead(err) { + return n, err + } + // Read failed, but we will try again. Send a ranged read request that takes + // into account the number of bytes we've already seen. + res, err := r.reopen(r.seen) + if err != nil { + // reopen already retries + return n, err + } + r.body.Close() + r.body = res.Body + } + return n, nil +} + +func shouldRetryRead(err error) bool { + if err == nil { + return false + } + return strings.HasSuffix(err.Error(), "INTERNAL_ERROR") && strings.Contains(reflect.TypeOf(err).String(), "http2") +} + +// Size returns the size of the object in bytes. +// The returned value is always the same and is not affected by +// calls to Read or Close. +// +// Deprecated: use Reader.Attrs.Size. +func (r *Reader) Size() int64 { + return r.Attrs.Size +} + +// Remain returns the number of bytes left to read, or -1 if unknown. +func (r *Reader) Remain() int64 { + return r.remain +} + +// ContentType returns the content type of the object. +// +// Deprecated: use Reader.Attrs.ContentType. +func (r *Reader) ContentType() string { + return r.Attrs.ContentType +} + +// ContentEncoding returns the content encoding of the object. +// +// Deprecated: use Reader.Attrs.ContentEncoding. +func (r *Reader) ContentEncoding() string { + return r.Attrs.ContentEncoding +} + +// CacheControl returns the cache control of the object. +// +// Deprecated: use Reader.Attrs.CacheControl. +func (r *Reader) CacheControl() string { + return r.Attrs.CacheControl +} + +// LastModified returns the value of the Last-Modified header. +// +// Deprecated: use Reader.Attrs.LastModified. +func (r *Reader) LastModified() (time.Time, error) { + return r.Attrs.LastModified, nil +} diff --git a/vendor/cloud.google.com/go/storage/reader_test.go b/vendor/cloud.google.com/go/storage/reader_test.go new file mode 100644 index 000000000..47dbf014d --- /dev/null +++ b/vendor/cloud.google.com/go/storage/reader_test.go @@ -0,0 +1,297 @@ +// 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. + +package storage + +import ( + "context" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "strconv" + "strings" + "testing" + + "google.golang.org/api/option" +) + +const readData = "0123456789" + +func TestRangeReader(t *testing.T) { + hc, close := newTestServer(handleRangeRead) + defer close() + ctx := context.Background() + c, err := NewClient(ctx, option.WithHTTPClient(hc)) + if err != nil { + t.Fatal(err) + } + obj := c.Bucket("b").Object("o") + for _, test := range []struct { + offset, length int64 + want string + }{ + {0, -1, readData}, + {0, 10, readData}, + {0, 5, readData[:5]}, + {1, 3, readData[1:4]}, + {6, -1, readData[6:]}, + {4, 20, readData[4:]}, + } { + r, err := obj.NewRangeReader(ctx, test.offset, test.length) + if err != nil { + t.Errorf("%d/%d: %v", test.offset, test.length, err) + continue + } + gotb, err := ioutil.ReadAll(r) + if err != nil { + t.Errorf("%d/%d: %v", test.offset, test.length, err) + continue + } + if got := string(gotb); got != test.want { + t.Errorf("%d/%d: got %q, want %q", test.offset, test.length, got, test.want) + } + } +} + +func handleRangeRead(w http.ResponseWriter, r *http.Request) { + rh := strings.TrimSpace(r.Header.Get("Range")) + data := readData + var from, to int + if rh == "" { + from = 0 + to = len(data) + } else { + // assume "bytes=N-" or "bytes=N-M" + var err error + i := strings.IndexRune(rh, '=') + j := strings.IndexRune(rh, '-') + from, err = strconv.Atoi(rh[i+1 : j]) + if err != nil { + w.WriteHeader(500) + return + } + to = len(data) + if j+1 < len(rh) { + to, err = strconv.Atoi(rh[j+1:]) + if err != nil { + w.WriteHeader(500) + return + } + to++ // Range header is inclusive, Go slice is exclusive + } + if from >= len(data) && to != from { + w.WriteHeader(416) + return + } + if from > len(data) { + from = len(data) + } + if to > len(data) { + to = len(data) + } + } + data = data[from:to] + if data != readData { + w.Header().Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", from, to-1, len(readData))) + w.WriteHeader(http.StatusPartialContent) + } + if _, err := w.Write([]byte(data)); err != nil { + panic(err) + } +} + +type http2Error string + +func (h http2Error) Error() string { + return string(h) +} + +func TestRangeReaderRetry(t *testing.T) { + retryErr := http2Error("blah blah INTERNAL_ERROR") + readBytes := []byte(readData) + hc, close := newTestServer(handleRangeRead) + defer close() + ctx := context.Background() + c, err := NewClient(ctx, option.WithHTTPClient(hc)) + if err != nil { + t.Fatal(err) + } + + obj := c.Bucket("b").Object("o") + for i, test := range []struct { + offset, length int64 + bodies []fakeReadCloser + want string + }{ + { + offset: 0, + length: -1, + bodies: []fakeReadCloser{ + {data: readBytes, counts: []int{10}, err: io.EOF}, + }, + want: readData, + }, + { + offset: 0, + length: -1, + bodies: []fakeReadCloser{ + {data: readBytes, counts: []int{3}, err: retryErr}, + {data: readBytes[3:], counts: []int{5, 2}, err: io.EOF}, + }, + want: readData, + }, + { + offset: 0, + length: -1, + bodies: []fakeReadCloser{ + {data: readBytes, counts: []int{5}, err: retryErr}, + {data: readBytes[5:], counts: []int{1, 3}, err: retryErr}, + {data: readBytes[9:], counts: []int{1}, err: io.EOF}, + }, + want: readData, + }, + { + offset: 0, + length: 5, + bodies: []fakeReadCloser{ + {data: readBytes, counts: []int{3}, err: retryErr}, + {data: readBytes[3:], counts: []int{2}, err: io.EOF}, + }, + want: readData[:5], + }, + { + offset: 1, + length: 5, + bodies: []fakeReadCloser{ + {data: readBytes, counts: []int{3}, err: retryErr}, + {data: readBytes[3:], counts: []int{2}, err: io.EOF}, + }, + want: readData[:5], + }, + { + offset: 1, + length: 3, + bodies: []fakeReadCloser{ + {data: readBytes[1:], counts: []int{1}, err: retryErr}, + {data: readBytes[2:], counts: []int{2}, err: io.EOF}, + }, + want: readData[1:4], + }, + { + offset: 4, + length: -1, + bodies: []fakeReadCloser{ + {data: readBytes[4:], counts: []int{1}, err: retryErr}, + {data: readBytes[5:], counts: []int{4}, err: retryErr}, + {data: readBytes[9:], counts: []int{1}, err: io.EOF}, + }, + want: readData[4:], + }, + } { + r, err := obj.NewRangeReader(ctx, test.offset, test.length) + if err != nil { + t.Errorf("#%d: %v", i, err) + continue + } + r.body = &test.bodies[0] + b := 0 + r.reopen = func(int64) (*http.Response, error) { + b++ + return &http.Response{Body: &test.bodies[b]}, nil + } + buf := make([]byte, len(readData)/2) + var gotb []byte + for { + n, err := r.Read(buf) + gotb = append(gotb, buf[:n]...) + if err == io.EOF { + break + } + if err != nil { + t.Fatalf("#%d: %v", i, err) + } + } + if err != nil { + t.Errorf("#%d: %v", i, err) + continue + } + if got := string(gotb); got != test.want { + t.Errorf("#%d: got %q, want %q", i, got, test.want) + } + } +} + +type fakeReadCloser struct { + data []byte + counts []int // how much of data to deliver on each read + err error // error to return with last count + + d int // current position in data + c int // current position in counts +} + +func (f *fakeReadCloser) Close() error { + return nil +} + +func (f *fakeReadCloser) Read(buf []byte) (int, error) { + i := f.c + n := 0 + if i < len(f.counts) { + n = f.counts[i] + } + var err error + if i >= len(f.counts)-1 { + err = f.err + } + copy(buf, f.data[f.d:f.d+n]) + if len(buf) < n { + n = len(buf) + f.counts[i] -= n + err = nil + } else { + f.c++ + } + f.d += n + return n, err +} + +func TestFakeReadCloser(t *testing.T) { + e := errors.New("") + f := &fakeReadCloser{ + data: []byte(readData), + counts: []int{1, 2, 3}, + err: e, + } + wants := []string{"0", "12", "345"} + buf := make([]byte, 10) + for i := 0; i < 3; i++ { + n, err := f.Read(buf) + if got, want := n, f.counts[i]; got != want { + t.Fatalf("i=%d: got %d, want %d", i, got, want) + } + var wantErr error + if i == 2 { + wantErr = e + } + if err != wantErr { + t.Fatalf("i=%d: got error %v, want %v", i, err, wantErr) + } + if got, want := string(buf[:n]), wants[i]; got != want { + t.Fatalf("i=%d: got %q, want %q", i, got, want) + } + } +} diff --git a/vendor/cloud.google.com/go/storage/storage.go b/vendor/cloud.google.com/go/storage/storage.go new file mode 100644 index 000000000..6c62e3e1d --- /dev/null +++ b/vendor/cloud.google.com/go/storage/storage.go @@ -0,0 +1,1123 @@ +// 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 storage + +import ( + "bytes" + "context" + "crypto" + "crypto/rand" + "crypto/rsa" + "crypto/sha256" + "crypto/x509" + "encoding/base64" + "encoding/pem" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "time" + "unicode/utf8" + + "cloud.google.com/go/internal/optional" + "cloud.google.com/go/internal/trace" + "cloud.google.com/go/internal/version" + "google.golang.org/api/googleapi" + "google.golang.org/api/option" + raw "google.golang.org/api/storage/v1" + htransport "google.golang.org/api/transport/http" +) + +var ( + // ErrBucketNotExist indicates that the bucket does not exist. + ErrBucketNotExist = errors.New("storage: bucket doesn't exist") + // ErrObjectNotExist indicates that the object does not exist. + ErrObjectNotExist = errors.New("storage: object doesn't exist") +) + +const userAgent = "gcloud-golang-storage/20151204" + +const ( + // ScopeFullControl grants permissions to manage your + // data and permissions in Google Cloud Storage. + ScopeFullControl = raw.DevstorageFullControlScope + + // ScopeReadOnly grants permissions to + // view your data in Google Cloud Storage. + ScopeReadOnly = raw.DevstorageReadOnlyScope + + // ScopeReadWrite grants permissions to manage your + // data in Google Cloud Storage. + ScopeReadWrite = raw.DevstorageReadWriteScope +) + +var xGoogHeader = fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), version.Repo) + +func setClientHeader(headers http.Header) { + headers.Set("x-goog-api-client", xGoogHeader) +} + +// Client is a client for interacting with Google Cloud Storage. +// +// Clients should be reused instead of created as needed. +// The methods of Client are safe for concurrent use by multiple goroutines. +type Client struct { + hc *http.Client + raw *raw.Service +} + +// NewClient creates a new Google Cloud Storage client. +// The default scope is ScopeFullControl. To use a different scope, like ScopeReadOnly, use option.WithScopes. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + o := []option.ClientOption{ + option.WithScopes(ScopeFullControl), + option.WithUserAgent(userAgent), + } + opts = append(o, opts...) + hc, ep, err := htransport.NewClient(ctx, opts...) + if err != nil { + return nil, fmt.Errorf("dialing: %v", err) + } + rawService, err := raw.New(hc) + if err != nil { + return nil, fmt.Errorf("storage client: %v", err) + } + if ep != "" { + rawService.BasePath = ep + } + return &Client{ + hc: hc, + raw: rawService, + }, nil +} + +// Close closes the Client. +// +// Close need not be called at program exit. +func (c *Client) Close() error { + // Set fields to nil so that subsequent uses will panic. + c.hc = nil + c.raw = nil + return nil +} + +// SignedURLOptions allows you to restrict the access to the signed URL. +type SignedURLOptions struct { + // GoogleAccessID represents the authorizer of the signed URL generation. + // It is typically the Google service account client email address from + // the Google Developers Console in the form of "xxx@developer.gserviceaccount.com". + // Required. + GoogleAccessID string + + // PrivateKey is the Google service account private key. It is obtainable + // from the Google Developers Console. + // At https://console.developers.google.com/project//apiui/credential, + // create a service account client ID or reuse one of your existing service account + // credentials. Click on the "Generate new P12 key" to generate and download + // a new private key. Once you download the P12 file, use the following command + // to convert it into a PEM file. + // + // $ openssl pkcs12 -in key.p12 -passin pass:notasecret -out key.pem -nodes + // + // Provide the contents of the PEM file as a byte slice. + // Exactly one of PrivateKey or SignBytes must be non-nil. + PrivateKey []byte + + // SignBytes is a function for implementing custom signing. + // If your application is running on Google App Engine, you can use appengine's internal signing function: + // ctx := appengine.NewContext(request) + // acc, _ := appengine.ServiceAccount(ctx) + // url, err := SignedURL("bucket", "object", &SignedURLOptions{ + // GoogleAccessID: acc, + // SignBytes: func(b []byte) ([]byte, error) { + // _, signedBytes, err := appengine.SignBytes(ctx, b) + // return signedBytes, err + // }, + // // etc. + // }) + // + // Exactly one of PrivateKey or SignBytes must be non-nil. + SignBytes func([]byte) ([]byte, error) + + // Method is the HTTP method to be used with the signed URL. + // Signed URLs can be used with GET, HEAD, PUT, and DELETE requests. + // Required. + Method string + + // Expires is the expiration time on the signed URL. It must be + // a datetime in the future. + // Required. + Expires time.Time + + // ContentType is the content type header the client must provide + // to use the generated signed URL. + // Optional. + ContentType string + + // Headers is a list of extension headers the client must provide + // in order to use the generated signed URL. + // Optional. + Headers []string + + // MD5 is the base64 encoded MD5 checksum of the file. + // If provided, the client should provide the exact value on the request + // header in order to use the signed URL. + // Optional. + MD5 string +} + +var ( + canonicalHeaderRegexp = regexp.MustCompile(`(?i)^(x-goog-[^:]+):(.*)?$`) + excludedCanonicalHeaders = map[string]bool{ + "x-goog-encryption-key": true, + "x-goog-encryption-key-sha256": true, + } +) + +// sanitizeHeaders applies the specifications for canonical extension headers at +// https://cloud.google.com/storage/docs/access-control/signed-urls#about-canonical-extension-headers. +func sanitizeHeaders(hdrs []string) []string { + headerMap := map[string][]string{} + for _, hdr := range hdrs { + // No leading or trailing whitespaces. + sanitizedHeader := strings.TrimSpace(hdr) + + // Only keep canonical headers, discard any others. + headerMatches := canonicalHeaderRegexp.FindStringSubmatch(sanitizedHeader) + if len(headerMatches) == 0 { + continue + } + + header := strings.ToLower(strings.TrimSpace(headerMatches[1])) + if excludedCanonicalHeaders[headerMatches[1]] { + // Do not keep any deliberately excluded canonical headers when signing. + continue + } + value := strings.TrimSpace(headerMatches[2]) + if len(value) > 0 { + // Remove duplicate headers by appending the values of duplicates + // in their order of appearance. + headerMap[header] = append(headerMap[header], value) + } + } + + var sanitizedHeaders []string + for header, values := range headerMap { + // There should be no spaces around the colon separating the + // header name from the header value or around the values + // themselves. The values should be separated by commas. + // NOTE: The semantics for headers without a value are not clear. + // However from specifications these should be edge-cases + // anyway and we should assume that there will be no + // canonical headers using empty values. Any such headers + // are discarded at the regexp stage above. + sanitizedHeaders = append( + sanitizedHeaders, + fmt.Sprintf("%s:%s", header, strings.Join(values, ",")), + ) + } + sort.Strings(sanitizedHeaders) + return sanitizedHeaders +} + +// SignedURL returns a URL for the specified object. Signed URLs allow +// the users access to a restricted resource for a limited time without having a +// Google account or signing in. For more information about the signed +// URLs, see https://cloud.google.com/storage/docs/accesscontrol#Signed-URLs. +func SignedURL(bucket, name string, opts *SignedURLOptions) (string, error) { + if opts == nil { + return "", errors.New("storage: missing required SignedURLOptions") + } + if opts.GoogleAccessID == "" { + return "", errors.New("storage: missing required GoogleAccessID") + } + if (opts.PrivateKey == nil) == (opts.SignBytes == nil) { + return "", errors.New("storage: exactly one of PrivateKey or SignedBytes must be set") + } + if opts.Method == "" { + return "", errors.New("storage: missing required method option") + } + if opts.Expires.IsZero() { + return "", errors.New("storage: missing required expires option") + } + if opts.MD5 != "" { + md5, err := base64.StdEncoding.DecodeString(opts.MD5) + if err != nil || len(md5) != 16 { + return "", errors.New("storage: invalid MD5 checksum") + } + } + opts.Headers = sanitizeHeaders(opts.Headers) + + signBytes := opts.SignBytes + if opts.PrivateKey != nil { + key, err := parseKey(opts.PrivateKey) + if err != nil { + return "", err + } + signBytes = func(b []byte) ([]byte, error) { + sum := sha256.Sum256(b) + return rsa.SignPKCS1v15( + rand.Reader, + key, + crypto.SHA256, + sum[:], + ) + } + } + + u := &url.URL{ + Path: fmt.Sprintf("/%s/%s", bucket, name), + } + + buf := &bytes.Buffer{} + fmt.Fprintf(buf, "%s\n", opts.Method) + fmt.Fprintf(buf, "%s\n", opts.MD5) + fmt.Fprintf(buf, "%s\n", opts.ContentType) + fmt.Fprintf(buf, "%d\n", opts.Expires.Unix()) + if len(opts.Headers) > 0 { + fmt.Fprintf(buf, "%s\n", strings.Join(opts.Headers, "\n")) + } + fmt.Fprintf(buf, "%s", u.String()) + + b, err := signBytes(buf.Bytes()) + if err != nil { + return "", err + } + encoded := base64.StdEncoding.EncodeToString(b) + u.Scheme = "https" + u.Host = "storage.googleapis.com" + q := u.Query() + q.Set("GoogleAccessId", opts.GoogleAccessID) + q.Set("Expires", fmt.Sprintf("%d", opts.Expires.Unix())) + q.Set("Signature", string(encoded)) + u.RawQuery = q.Encode() + return u.String(), nil +} + +// ObjectHandle provides operations on an object in a Google Cloud Storage bucket. +// Use BucketHandle.Object to get a handle. +type ObjectHandle struct { + c *Client + bucket string + object string + acl ACLHandle + gen int64 // a negative value indicates latest + conds *Conditions + encryptionKey []byte // AES-256 key + userProject string // for requester-pays buckets + readCompressed bool // Accept-Encoding: gzip +} + +// ACL provides access to the object's access control list. +// This controls who can read and write this object. +// This call does not perform any network operations. +func (o *ObjectHandle) ACL() *ACLHandle { + return &o.acl +} + +// Generation returns a new ObjectHandle that operates on a specific generation +// of the object. +// By default, the handle operates on the latest generation. Not +// all operations work when given a specific generation; check the API +// endpoints at https://cloud.google.com/storage/docs/json_api/ for details. +func (o *ObjectHandle) Generation(gen int64) *ObjectHandle { + o2 := *o + o2.gen = gen + return &o2 +} + +// If returns a new ObjectHandle that applies a set of preconditions. +// Preconditions already set on the ObjectHandle are ignored. +// Operations on the new handle will return an error if the preconditions are not +// satisfied. See https://cloud.google.com/storage/docs/generations-preconditions +// for more details. +func (o *ObjectHandle) If(conds Conditions) *ObjectHandle { + o2 := *o + o2.conds = &conds + return &o2 +} + +// Key returns a new ObjectHandle that uses the supplied encryption +// key to encrypt and decrypt the object's contents. +// +// Encryption key must be a 32-byte AES-256 key. +// See https://cloud.google.com/storage/docs/encryption for details. +func (o *ObjectHandle) Key(encryptionKey []byte) *ObjectHandle { + o2 := *o + o2.encryptionKey = encryptionKey + return &o2 +} + +// Attrs returns meta information about the object. +// ErrObjectNotExist will be returned if the object is not found. +func (o *ObjectHandle) Attrs(ctx context.Context) (attrs *ObjectAttrs, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Object.Attrs") + defer func() { trace.EndSpan(ctx, err) }() + + if err := o.validate(); err != nil { + return nil, err + } + call := o.c.raw.Objects.Get(o.bucket, o.object).Projection("full").Context(ctx) + if err := applyConds("Attrs", o.gen, o.conds, call); err != nil { + return nil, err + } + if o.userProject != "" { + call.UserProject(o.userProject) + } + if err := setEncryptionHeaders(call.Header(), o.encryptionKey, false); err != nil { + return nil, err + } + var obj *raw.Object + setClientHeader(call.Header()) + err = runWithRetry(ctx, func() error { obj, err = call.Do(); return err }) + if e, ok := err.(*googleapi.Error); ok && e.Code == http.StatusNotFound { + return nil, ErrObjectNotExist + } + if err != nil { + return nil, err + } + return newObject(obj), nil +} + +// Update updates an object with the provided attributes. +// All zero-value attributes are ignored. +// ErrObjectNotExist will be returned if the object is not found. +func (o *ObjectHandle) Update(ctx context.Context, uattrs ObjectAttrsToUpdate) (oa *ObjectAttrs, err error) { + ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Object.Update") + defer func() { trace.EndSpan(ctx, err) }() + + if err := o.validate(); err != nil { + return nil, err + } + var attrs ObjectAttrs + // Lists of fields to send, and set to null, in the JSON. + var forceSendFields, nullFields []string + if uattrs.ContentType != nil { + attrs.ContentType = optional.ToString(uattrs.ContentType) + // For ContentType, sending the empty string is a no-op. + // Instead we send a null. + if attrs.ContentType == "" { + nullFields = append(nullFields, "ContentType") + } else { + forceSendFields = append(forceSendFields, "ContentType") + } + } + if uattrs.ContentLanguage != nil { + attrs.ContentLanguage = optional.ToString(uattrs.ContentLanguage) + // For ContentLanguage it's an error to send the empty string. + // Instead we send a null. + if attrs.ContentLanguage == "" { + nullFields = append(nullFields, "ContentLanguage") + } else { + forceSendFields = append(forceSendFields, "ContentLanguage") + } + } + if uattrs.ContentEncoding != nil { + attrs.ContentEncoding = optional.ToString(uattrs.ContentEncoding) + forceSendFields = append(forceSendFields, "ContentEncoding") + } + if uattrs.ContentDisposition != nil { + attrs.ContentDisposition = optional.ToString(uattrs.ContentDisposition) + forceSendFields = append(forceSendFields, "ContentDisposition") + } + if uattrs.CacheControl != nil { + attrs.CacheControl = optional.ToString(uattrs.CacheControl) + forceSendFields = append(forceSendFields, "CacheControl") + } + if uattrs.EventBasedHold != nil { + attrs.EventBasedHold = optional.ToBool(uattrs.EventBasedHold) + forceSendFields = append(forceSendFields, "EventBasedHold") + } + if uattrs.TemporaryHold != nil { + attrs.TemporaryHold = optional.ToBool(uattrs.TemporaryHold) + forceSendFields = append(forceSendFields, "TemporaryHold") + } + if uattrs.Metadata != nil { + attrs.Metadata = uattrs.Metadata + if len(attrs.Metadata) == 0 { + // Sending the empty map is a no-op. We send null instead. + nullFields = append(nullFields, "Metadata") + } else { + forceSendFields = append(forceSendFields, "Metadata") + } + } + if uattrs.ACL != nil { + attrs.ACL = uattrs.ACL + // It's an error to attempt to delete the ACL, so + // we don't append to nullFields here. + forceSendFields = append(forceSendFields, "Acl") + } + rawObj := attrs.toRawObject(o.bucket) + rawObj.ForceSendFields = forceSendFields + rawObj.NullFields = nullFields + call := o.c.raw.Objects.Patch(o.bucket, o.object, rawObj).Projection("full").Context(ctx) + if err := applyConds("Update", o.gen, o.conds, call); err != nil { + return nil, err + } + if o.userProject != "" { + call.UserProject(o.userProject) + } + if uattrs.PredefinedACL != "" { + call.PredefinedAcl(uattrs.PredefinedACL) + } + if err := setEncryptionHeaders(call.Header(), o.encryptionKey, false); err != nil { + return nil, err + } + var obj *raw.Object + setClientHeader(call.Header()) + err = runWithRetry(ctx, func() error { obj, err = call.Do(); return err }) + if e, ok := err.(*googleapi.Error); ok && e.Code == http.StatusNotFound { + return nil, ErrObjectNotExist + } + if err != nil { + return nil, err + } + return newObject(obj), nil +} + +// BucketName returns the name of the bucket. +func (o *ObjectHandle) BucketName() string { + return o.bucket +} + +// ObjectName returns the name of the object. +func (o *ObjectHandle) ObjectName() string { + return o.object +} + +// ObjectAttrsToUpdate is used to update the attributes of an object. +// Only fields set to non-nil values will be updated. +// Set a field to its zero value to delete it. +// +// For example, to change ContentType and delete ContentEncoding and +// Metadata, use +// ObjectAttrsToUpdate{ +// ContentType: "text/html", +// ContentEncoding: "", +// Metadata: map[string]string{}, +// } +type ObjectAttrsToUpdate struct { + EventBasedHold optional.Bool + TemporaryHold optional.Bool + ContentType optional.String + ContentLanguage optional.String + ContentEncoding optional.String + ContentDisposition optional.String + CacheControl optional.String + Metadata map[string]string // set to map[string]string{} to delete + ACL []ACLRule + + // If not empty, applies a predefined set of access controls. ACL must be nil. + // See https://cloud.google.com/storage/docs/json_api/v1/objects/patch. + PredefinedACL string +} + +// Delete deletes the single specified object. +func (o *ObjectHandle) Delete(ctx context.Context) error { + if err := o.validate(); err != nil { + return err + } + call := o.c.raw.Objects.Delete(o.bucket, o.object).Context(ctx) + if err := applyConds("Delete", o.gen, o.conds, call); err != nil { + return err + } + if o.userProject != "" { + call.UserProject(o.userProject) + } + // Encryption doesn't apply to Delete. + setClientHeader(call.Header()) + err := runWithRetry(ctx, func() error { return call.Do() }) + switch e := err.(type) { + case nil: + return nil + case *googleapi.Error: + if e.Code == http.StatusNotFound { + return ErrObjectNotExist + } + } + return err +} + +// ReadCompressed when true causes the read to happen without decompressing. +func (o *ObjectHandle) ReadCompressed(compressed bool) *ObjectHandle { + o2 := *o + o2.readCompressed = compressed + return &o2 +} + +// NewWriter returns a storage Writer that writes to the GCS object +// associated with this ObjectHandle. +// +// A new object will be created unless an object with this name already exists. +// Otherwise any previous object with the same name will be replaced. +// The object will not be available (and any previous object will remain) +// until Close has been called. +// +// Attributes can be set on the object by modifying the returned Writer's +// ObjectAttrs field before the first call to Write. If no ContentType +// attribute is specified, the content type will be automatically sniffed +// using net/http.DetectContentType. +// +// It is the caller's responsibility to call Close when writing is done. To +// stop writing without saving the data, cancel the context. +func (o *ObjectHandle) NewWriter(ctx context.Context) *Writer { + return &Writer{ + ctx: ctx, + o: o, + donec: make(chan struct{}), + ObjectAttrs: ObjectAttrs{Name: o.object}, + ChunkSize: googleapi.DefaultUploadChunkSize, + } +} + +func (o *ObjectHandle) validate() error { + if o.bucket == "" { + return errors.New("storage: bucket name is empty") + } + if o.object == "" { + return errors.New("storage: object name is empty") + } + if !utf8.ValidString(o.object) { + return fmt.Errorf("storage: object name %q is not valid UTF-8", o.object) + } + return nil +} + +// parseKey converts the binary contents of a private key file to an +// *rsa.PrivateKey. It detects whether the private key is in a PEM container or +// not. If so, it extracts the private key from PEM container before +// conversion. It only supports PEM containers with no passphrase. +func parseKey(key []byte) (*rsa.PrivateKey, error) { + if block, _ := pem.Decode(key); block != nil { + key = block.Bytes + } + parsedKey, err := x509.ParsePKCS8PrivateKey(key) + if err != nil { + parsedKey, err = x509.ParsePKCS1PrivateKey(key) + if err != nil { + return nil, err + } + } + parsed, ok := parsedKey.(*rsa.PrivateKey) + if !ok { + return nil, errors.New("oauth2: private key is invalid") + } + return parsed, nil +} + +// toRawObject copies the editable attributes from o to the raw library's Object type. +func (o *ObjectAttrs) toRawObject(bucket string) *raw.Object { + var ret string + if !o.RetentionExpirationTime.IsZero() { + ret = o.RetentionExpirationTime.Format(time.RFC3339) + } + return &raw.Object{ + Bucket: bucket, + Name: o.Name, + EventBasedHold: o.EventBasedHold, + TemporaryHold: o.TemporaryHold, + RetentionExpirationTime: ret, + ContentType: o.ContentType, + ContentEncoding: o.ContentEncoding, + ContentLanguage: o.ContentLanguage, + CacheControl: o.CacheControl, + ContentDisposition: o.ContentDisposition, + StorageClass: o.StorageClass, + Acl: toRawObjectACL(o.ACL), + Metadata: o.Metadata, + } +} + +// ObjectAttrs represents the metadata for a Google Cloud Storage (GCS) object. +type ObjectAttrs struct { + // Bucket is the name of the bucket containing this GCS object. + // This field is read-only. + Bucket string + + // Name is the name of the object within the bucket. + // This field is read-only. + Name string + + // ContentType is the MIME type of the object's content. + ContentType string + + // ContentLanguage is the content language of the object's content. + ContentLanguage string + + // CacheControl is the Cache-Control header to be sent in the response + // headers when serving the object data. + CacheControl string + + // EventBasedHold specifies whether an object is under event-based hold. New + // objects created in a bucket whose DefaultEventBasedHold is set will + // default to that value. + EventBasedHold bool + + // TemporaryHold specifies whether an object is under temporary hold. While + // this flag is set to true, the object is protected against deletion and + // overwrites. + TemporaryHold bool + + // RetentionExpirationTime is a server-determined value that specifies the + // earliest time that the object's retention period expires. + // This is a read-only field. + RetentionExpirationTime time.Time + + // ACL is the list of access control rules for the object. + ACL []ACLRule + + // If not empty, applies a predefined set of access controls. It should be set + // only when writing, copying or composing an object. When copying or composing, + // it acts as the destinationPredefinedAcl parameter. + // PredefinedACL is always empty for ObjectAttrs returned from the service. + // See https://cloud.google.com/storage/docs/json_api/v1/objects/insert + // for valid values. + PredefinedACL string + + // Owner is the owner of the object. This field is read-only. + // + // If non-zero, it is in the form of "user-". + Owner string + + // Size is the length of the object's content. This field is read-only. + Size int64 + + // ContentEncoding is the encoding of the object's content. + ContentEncoding string + + // ContentDisposition is the optional Content-Disposition header of the object + // sent in the response headers. + ContentDisposition string + + // MD5 is the MD5 hash of the object's content. This field is read-only, + // except when used from a Writer. If set on a Writer, the uploaded + // data is rejected if its MD5 hash does not match this field. + MD5 []byte + + // CRC32C is the CRC32 checksum of the object's content using + // the Castagnoli93 polynomial. This field is read-only, except when + // used from a Writer. If set on a Writer and Writer.SendCRC32C + // is true, the uploaded data is rejected if its CRC32c hash does not + // match this field. + CRC32C uint32 + + // MediaLink is an URL to the object's content. This field is read-only. + MediaLink string + + // Metadata represents user-provided metadata, in key/value pairs. + // It can be nil if no metadata is provided. + Metadata map[string]string + + // Generation is the generation number of the object's content. + // This field is read-only. + Generation int64 + + // Metageneration is the version of the metadata for this + // object at this generation. This field is used for preconditions + // and for detecting changes in metadata. A metageneration number + // is only meaningful in the context of a particular generation + // of a particular object. This field is read-only. + Metageneration int64 + + // 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. + StorageClass string + + // Created is the time the object was created. This field is read-only. + Created time.Time + + // Deleted is the time the object was deleted. + // If not deleted, it is the zero value. This field is read-only. + Deleted time.Time + + // Updated is the creation or modification time of the object. + // For buckets with versioning enabled, changing an object's + // metadata does not change this property. This field is read-only. + Updated time.Time + + // CustomerKeySHA256 is the base64-encoded SHA-256 hash of the + // customer-supplied encryption key for the object. It is empty if there is + // no customer-supplied encryption key. + // See // https://cloud.google.com/storage/docs/encryption for more about + // encryption in Google Cloud Storage. + CustomerKeySHA256 string + + // Cloud KMS key name, in the form + // projects/P/locations/L/keyRings/R/cryptoKeys/K, used to encrypt this object, + // if the object is encrypted by such a key. + // + // Providing both a KMSKeyName and a customer-supplied encryption key (via + // ObjectHandle.Key) will result in an error when writing an object. + KMSKeyName string + + // Prefix is set only for ObjectAttrs which represent synthetic "directory + // entries" when iterating over buckets using Query.Delimiter. See + // ObjectIterator.Next. When set, no other fields in ObjectAttrs will be + // populated. + Prefix string +} + +// convertTime converts a time in RFC3339 format to time.Time. +// If any error occurs in parsing, the zero-value time.Time is silently returned. +func convertTime(t string) time.Time { + var r time.Time + if t != "" { + r, _ = time.Parse(time.RFC3339, t) + } + return r +} + +func newObject(o *raw.Object) *ObjectAttrs { + if o == nil { + return nil + } + owner := "" + if o.Owner != nil { + owner = o.Owner.Entity + } + md5, _ := base64.StdEncoding.DecodeString(o.Md5Hash) + crc32c, _ := decodeUint32(o.Crc32c) + var sha256 string + if o.CustomerEncryption != nil { + sha256 = o.CustomerEncryption.KeySha256 + } + return &ObjectAttrs{ + Bucket: o.Bucket, + Name: o.Name, + ContentType: o.ContentType, + ContentLanguage: o.ContentLanguage, + CacheControl: o.CacheControl, + EventBasedHold: o.EventBasedHold, + TemporaryHold: o.TemporaryHold, + RetentionExpirationTime: convertTime(o.RetentionExpirationTime), + ACL: toObjectACLRules(o.Acl), + Owner: owner, + ContentEncoding: o.ContentEncoding, + ContentDisposition: o.ContentDisposition, + Size: int64(o.Size), + MD5: md5, + CRC32C: crc32c, + MediaLink: o.MediaLink, + Metadata: o.Metadata, + Generation: o.Generation, + Metageneration: o.Metageneration, + StorageClass: o.StorageClass, + CustomerKeySHA256: sha256, + KMSKeyName: o.KmsKeyName, + Created: convertTime(o.TimeCreated), + Deleted: convertTime(o.TimeDeleted), + Updated: convertTime(o.Updated), + } +} + +// Decode a uint32 encoded in Base64 in big-endian byte order. +func decodeUint32(b64 string) (uint32, error) { + d, err := base64.StdEncoding.DecodeString(b64) + if err != nil { + return 0, err + } + if len(d) != 4 { + return 0, fmt.Errorf("storage: %q does not encode a 32-bit value", d) + } + return uint32(d[0])<<24 + uint32(d[1])<<16 + uint32(d[2])<<8 + uint32(d[3]), nil +} + +// Encode a uint32 as Base64 in big-endian byte order. +func encodeUint32(u uint32) string { + b := []byte{byte(u >> 24), byte(u >> 16), byte(u >> 8), byte(u)} + return base64.StdEncoding.EncodeToString(b) +} + +// Query represents a query to filter objects from a bucket. +type Query struct { + // Delimiter returns results in a directory-like fashion. + // Results will contain only objects whose names, aside from the + // prefix, do not contain delimiter. Objects whose names, + // aside from the prefix, contain delimiter will have their name, + // truncated after the delimiter, returned in prefixes. + // Duplicate prefixes are omitted. + // Optional. + Delimiter string + + // Prefix is the prefix filter to query objects + // whose names begin with this prefix. + // Optional. + Prefix string + + // Versions indicates whether multiple versions of the same + // object will be included in the results. + Versions bool +} + +// contentTyper implements ContentTyper to enable an +// io.ReadCloser to specify its MIME type. +type contentTyper struct { + io.Reader + t string +} + +func (c *contentTyper) ContentType() string { + return c.t +} + +// Conditions constrain methods to act on specific generations of +// objects. +// +// The zero value is an empty set of constraints. Not all conditions or +// combinations of conditions are applicable to all methods. +// See https://cloud.google.com/storage/docs/generations-preconditions +// for details on how these operate. +type Conditions struct { + // Generation constraints. + // At most one of the following can be set to a non-zero value. + + // GenerationMatch specifies that the object must have the given generation + // for the operation to occur. + // If GenerationMatch is zero, it has no effect. + // Use DoesNotExist to specify that the object does not exist in the bucket. + GenerationMatch int64 + + // GenerationNotMatch specifies that the object must not have the given + // generation for the operation to occur. + // If GenerationNotMatch is zero, it has no effect. + GenerationNotMatch int64 + + // DoesNotExist specifies that the object must not exist in the bucket for + // the operation to occur. + // If DoesNotExist is false, it has no effect. + DoesNotExist bool + + // Metadata generation constraints. + // At most one of the following can be set to a non-zero value. + + // MetagenerationMatch specifies that the object must have the given + // metageneration for the operation to occur. + // If MetagenerationMatch is zero, it has no effect. + MetagenerationMatch int64 + + // MetagenerationNotMatch specifies that the object must not have the given + // metageneration for the operation to occur. + // If MetagenerationNotMatch is zero, it has no effect. + MetagenerationNotMatch int64 +} + +func (c *Conditions) validate(method string) error { + if *c == (Conditions{}) { + return fmt.Errorf("storage: %s: empty conditions", method) + } + if !c.isGenerationValid() { + return fmt.Errorf("storage: %s: multiple conditions specified for generation", method) + } + if !c.isMetagenerationValid() { + return fmt.Errorf("storage: %s: multiple conditions specified for metageneration", method) + } + return nil +} + +func (c *Conditions) isGenerationValid() bool { + n := 0 + if c.GenerationMatch != 0 { + n++ + } + if c.GenerationNotMatch != 0 { + n++ + } + if c.DoesNotExist { + n++ + } + return n <= 1 +} + +func (c *Conditions) isMetagenerationValid() bool { + return c.MetagenerationMatch == 0 || c.MetagenerationNotMatch == 0 +} + +// applyConds modifies the provided call using the conditions in conds. +// call is something that quacks like a *raw.WhateverCall. +func applyConds(method string, gen int64, conds *Conditions, call interface{}) error { + cval := reflect.ValueOf(call) + if gen >= 0 { + if !setConditionField(cval, "Generation", gen) { + return fmt.Errorf("storage: %s: generation not supported", method) + } + } + if conds == nil { + return nil + } + if err := conds.validate(method); err != nil { + return err + } + switch { + case conds.GenerationMatch != 0: + if !setConditionField(cval, "IfGenerationMatch", conds.GenerationMatch) { + return fmt.Errorf("storage: %s: ifGenerationMatch not supported", method) + } + case conds.GenerationNotMatch != 0: + if !setConditionField(cval, "IfGenerationNotMatch", conds.GenerationNotMatch) { + return fmt.Errorf("storage: %s: ifGenerationNotMatch not supported", method) + } + case conds.DoesNotExist: + if !setConditionField(cval, "IfGenerationMatch", int64(0)) { + return fmt.Errorf("storage: %s: DoesNotExist not supported", method) + } + } + switch { + case conds.MetagenerationMatch != 0: + if !setConditionField(cval, "IfMetagenerationMatch", conds.MetagenerationMatch) { + return fmt.Errorf("storage: %s: ifMetagenerationMatch not supported", method) + } + case conds.MetagenerationNotMatch != 0: + if !setConditionField(cval, "IfMetagenerationNotMatch", conds.MetagenerationNotMatch) { + return fmt.Errorf("storage: %s: ifMetagenerationNotMatch not supported", method) + } + } + return nil +} + +func applySourceConds(gen int64, conds *Conditions, call *raw.ObjectsRewriteCall) error { + if gen >= 0 { + call.SourceGeneration(gen) + } + if conds == nil { + return nil + } + if err := conds.validate("CopyTo source"); err != nil { + return err + } + switch { + case conds.GenerationMatch != 0: + call.IfSourceGenerationMatch(conds.GenerationMatch) + case conds.GenerationNotMatch != 0: + call.IfSourceGenerationNotMatch(conds.GenerationNotMatch) + case conds.DoesNotExist: + call.IfSourceGenerationMatch(0) + } + switch { + case conds.MetagenerationMatch != 0: + call.IfSourceMetagenerationMatch(conds.MetagenerationMatch) + case conds.MetagenerationNotMatch != 0: + call.IfSourceMetagenerationNotMatch(conds.MetagenerationNotMatch) + } + return nil +} + +// setConditionField sets a field on a *raw.WhateverCall. +// We can't use anonymous interfaces because the return type is +// different, since the field setters are builders. +func setConditionField(call reflect.Value, name string, value interface{}) bool { + m := call.MethodByName(name) + if !m.IsValid() { + return false + } + m.Call([]reflect.Value{reflect.ValueOf(value)}) + return true +} + +// conditionsQuery returns the generation and conditions as a URL query +// string suitable for URL.RawQuery. It assumes that the conditions +// have been validated. +func conditionsQuery(gen int64, conds *Conditions) string { + // URL escapes are elided because integer strings are URL-safe. + var buf []byte + + appendParam := func(s string, n int64) { + if len(buf) > 0 { + buf = append(buf, '&') + } + buf = append(buf, s...) + buf = strconv.AppendInt(buf, n, 10) + } + + if gen >= 0 { + appendParam("generation=", gen) + } + if conds == nil { + return string(buf) + } + switch { + case conds.GenerationMatch != 0: + appendParam("ifGenerationMatch=", conds.GenerationMatch) + case conds.GenerationNotMatch != 0: + appendParam("ifGenerationNotMatch=", conds.GenerationNotMatch) + case conds.DoesNotExist: + appendParam("ifGenerationMatch=", 0) + } + switch { + case conds.MetagenerationMatch != 0: + appendParam("ifMetagenerationMatch=", conds.MetagenerationMatch) + case conds.MetagenerationNotMatch != 0: + appendParam("ifMetagenerationNotMatch=", conds.MetagenerationNotMatch) + } + return string(buf) +} + +// composeSourceObj wraps a *raw.ComposeRequestSourceObjects, but adds the methods +// that modifyCall searches for by name. +type composeSourceObj struct { + src *raw.ComposeRequestSourceObjects +} + +func (c composeSourceObj) Generation(gen int64) { + c.src.Generation = gen +} + +func (c composeSourceObj) IfGenerationMatch(gen int64) { + // It's safe to overwrite ObjectPreconditions, since its only field is + // IfGenerationMatch. + c.src.ObjectPreconditions = &raw.ComposeRequestSourceObjectsObjectPreconditions{ + IfGenerationMatch: gen, + } +} + +func setEncryptionHeaders(headers http.Header, key []byte, copySource bool) error { + if key == nil { + return nil + } + // TODO(jbd): Ask the API team to return a more user-friendly error + // and avoid doing this check at the client level. + if len(key) != 32 { + return errors.New("storage: not a 32-byte AES-256 key") + } + var cs string + if copySource { + cs = "copy-source-" + } + headers.Set("x-goog-"+cs+"encryption-algorithm", "AES256") + headers.Set("x-goog-"+cs+"encryption-key", base64.StdEncoding.EncodeToString(key)) + keyHash := sha256.Sum256(key) + headers.Set("x-goog-"+cs+"encryption-key-sha256", base64.StdEncoding.EncodeToString(keyHash[:])) + return nil +} + +// ServiceAccount fetches the email address of the given project's Google Cloud Storage service account. +func (c *Client) ServiceAccount(ctx context.Context, projectID string) (string, error) { + r := c.raw.Projects.ServiceAccount.Get(projectID) + res, err := r.Context(ctx).Do() + if err != nil { + return "", err + } + return res.EmailAddress, nil +} diff --git a/vendor/cloud.google.com/go/storage/storage.replay b/vendor/cloud.google.com/go/storage/storage.replay new file mode 100644 index 000000000..079b162e0 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/storage.replay @@ -0,0 +1,53540 @@ +{ + "Initial": "IjIwMTgtMDktMjdUMTI6MjM6NTAuOTExODYzNjRaIg==", + "Version": "0.1", + "Entries": [ + { + "ID": "4a867507b0f3dbee", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "60" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "324cf8b8639b6b4631e5c4cafd0e2c16/986732864287226636;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxIn0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "426" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:52 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051331000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdk3:4341,/bns/yr/borg/yr/bns/blobstore2/bitpusher/44.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=18usW9v6OMTvkAPC4IGgCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/44.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/44:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWUNKdzJzd0Q5dnlBOGFHdHN2YzZ3MzJpem1SRXNRUWZaZl94RkpWbU84VFRyeEJfc2ZaRkZsdjBhUlRLZC1zLWtJc2pLcWd6ZGVJejkwZGMtUFlSVFZQVTdrTkNJbHllUmVhSlRldU9sb1YyWl94aFdFQkoxNGN2VHhyZDl4Uk03RFViN0tra09hd1NlVkdqLWU0V2FZU0ZOTW16U1dDS3NSZUtDTUhaRDFEc1g3djM3RmZGMmw1RXcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpcHZthlQWJ5OdoRGpk5Js3AAogojVNWvlmo_v3oIqaVxRiH0Y5STeX-fVrzNltY06kjYMaSo3O9iTiJWw3AvtVVLy8UA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjM6NTIuMzU1WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjIzOjUyLjM1NVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "ba85864b53e935df", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "60" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "cbd945887a7e22a66506ae96bde01c15/4926593637547890840;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAyIn0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "426" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:53 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051332000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrc82:4164,/bns/yw/borg/yw/bns/blobstore2/bitpusher/49.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=2MusW73YLMOwhgT23rH4CQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/49.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/49:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYkFaSE11YVZ6S2lnNDcyVW5lcUNPRzBMMmlCekJVY0NGaTB1c3o4ekE0Uk5kQ1A5aW1wbE1vcTcyVlQzLUJlVlhUaU9Mb0F0VURYRHpwb0lYZkpMMjVTZzFYTk9KZ1dJbV9QNHlaV0pGY1hHNFMxeGxnbDlmMkpXRkRUbjFfLTdweHFYNGJudndGM0JXTzZ5Y1ROdWtqX3NqS29kanRJMW9HQTBnbmVTM0RaMF9HX1B0bWpmSFlYanMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoGCVnjOfC9cVkP546g8csLoUI7KRTsrnTDPV2wpbnLpOKwP6qKGpLkqkFg0Vp1ez-KuxdvHzgxloaoqFZ3GjWVzOYtZA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDIiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjM6NTMuMTYyWiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjIzOjUzLjE2MloiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "486bc9edab67455b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0002?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "336221695c86fb5324eaf6a7d4e2082c/6516722971421670967;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0002?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:53 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:23:53 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051333000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqe25:4313,/bns/yr/borg/yr/bns/blobstore2/bitpusher/9.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=2cusW4yhGLLm4QS0iZ9I" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/9.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/9:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYkFaSE11YVZ6S2lnNDcyVW5lcUNPRzBMMmlCekJVY0NGaTB1c3o4ekE0Uk5kQ1A5aW1wbE1vcTcyVlQzLUJlVlhUaU9Mb0F0VURYRHpwb0lYZkpMMjVTZzFYTk9KZ1dJbV9QNHlaV0pGY1hHNFMxeGxnbDlmMkpXRkRUbjFfLTdweHFYNGJudndGM0JXTzZ5Y1ROdWtqX3NqS29kanRJMW9HQTBnbmVTM0RaMF9HX1B0bWpmSFlYanMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqvlMRQ1xVQ4ay63D5G54td8G9spIJDhN4kzGHZvTEW8sdjRs4_h5P6FVP_xUKNsLv38Rt6frdE6DohTYKJzwvZ78xSdQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDIiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjM6NTMuMTYyWiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjIzOjUzLjE2MloiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMi9wcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMi9hY2wvcHJvam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zk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBRT0ifQ==" + } + }, + { + "ID": "18c04b894e7914ca", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0002?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "99cc7479d127b305fe0a7955f514551c/8107134871193920470;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0002?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:54 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051332000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjm12:4359,/bns/yv/borg/yv/bns/blobstore2/bitpusher/250.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=2cusW_-dM9X8gQS2j5UY" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/250.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/250:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYkFaSE11YVZ6S2lnNDcyVW5lcUNPRzBMMmlCekJVY0NGaTB1c3o4ekE0Uk5kQ1A5aW1wbE1vcTcyVlQzLUJlVlhUaU9Mb0F0VURYRHpwb0lYZkpMMjVTZzFYTk9KZ1dJbV9QNHlaV0pGY1hHNFMxeGxnbDlmMkpXRkRUbjFfLTdweHFYNGJudndGM0JXTzZ5Y1ROdWtqX3NqS29kanRJMW9HQTBnbmVTM0RaMF9HX1B0bWpmSFlYanMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upwbe_KfHSmvQWFmYWTIHi1QxfU6aaP320Hi2YakvoHiu9eV6n6yebxLDKyLyKL6GKAaXGv1GJpYo-cx8S2qNo8kqpI0Q" + ] + }, + "Body": "" + } + }, + { + "ID": "3f65476279d8f2a4", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "543" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "811fa6ca0d68c12f4f50698dff145469/9697546775244360052;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJsYWJlbHMiOnsiZW1wdHkiOiIiLCJsMSI6InYxIn0sImxpZmVjeWNsZSI6eyJydWxlIjpbeyJhY3Rpb24iOnsic3RvcmFnZUNsYXNzIjoiTkVBUkxJTkUiLCJ0eXBlIjoiU2V0U3RvcmFnZUNsYXNzIn0sImNvbmRpdGlvbiI6eyJhZ2UiOjEwLCJjcmVhdGVkQmVmb3JlIjoiMjAxNy0wMS0wMSIsImlzTGl2ZSI6ZmFsc2UsIm1hdGNoZXNTdG9yYWdlQ2xhc3MiOlsiTVVMVElfUkVHSU9OQUwiLCJTVEFOREFSRCJdLCJudW1OZXdlclZlcnNpb25zIjozfX0seyJhY3Rpb24iOnsidHlwZSI6IkRlbGV0ZSJ9LCJjb25kaXRpb24iOnsiYWdlIjozMCwiY3JlYXRlZEJlZm9yZSI6IjIwMTctMDEtMDEiLCJpc0xpdmUiOnRydWUsIm1hdGNoZXNTdG9yYWdlQ2xhc3MiOlsiTkVBUkxJTkUiXSwibnVtTmV3ZXJWZXJzaW9ucyI6MTB9fV19LCJsb2NhdGlvbiI6IlVTIiwibmFtZSI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMiIsInN0b3JhZ2VDbGFzcyI6Ik5FQVJMSU5FIiwidmVyc2lvbmluZyI6eyJlbmFibGVkIjp0cnVlfX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "867" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:54 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051332000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrak11:4291,/bns/yw/borg/yw/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=2susW6jMDsHAhATs75PIDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/50:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYkFaSE11YVZ6S2lnNDcyVW5lcUNPRzBMMmlCekJVY0NGaTB1c3o4ekE0Uk5kQ1A5aW1wbE1vcTcyVlQzLUJlVlhUaU9Mb0F0VURYRHpwb0lYZkpMMjVTZzFYTk9KZ1dJbV9QNHlaV0pGY1hHNFMxeGxnbDlmMkpXRkRUbjFfLTdweHFYNGJudndGM0JXTzZ5Y1ROdWtqX3NqS29kanRJMW9HQTBnbmVTM0RaMF9HX1B0bWpmSFlYanMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrCe3wG3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MS0wMSIsImlzTGl2ZSI6dHJ1ZSwibWF0Y2hlc1N0b3JhZ2VDbGFzcyI6WyJORUFSTElORSJdLCJudW1OZXdlclZlcnNpb25zIjoxMH19XX0sImxhYmVscyI6eyJsMSI6InYxIiwiZW1wdHkiOiIifSwic3RvcmFnZUNsYXNzIjoiTkVBUkxJTkUiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "959d26ad1031b8fe", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0002?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "591e17a835f0e96a9eefadf22d09a1ee/11287958679311511059;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0002?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2794" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:55 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:23:55 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051334000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnss7:4006,/bns/yx/borg/yx/bns/blobstore2/bitpusher/121.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=2susW6OUNMuRzgLBuZuAAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/121.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/121:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYkFaSE11YVZ6S2lnNDcyVW5lcUNPRzBMMmlCekJVY0NGaTB1c3o4ekE0Uk5kQ1A5aW1wbE1vcTcyVlQzLUJlVlhUaU9Mb0F0VURYRHpwb0lYZkpMMjVTZzFYTk9KZ1dJbV9QNHlaV0pGY1hHNFMxeGxnbDlmMkpXRkRUbjFfLTdweHFYNGJudndGM0JXTzZ5Y1ROdWtqX3NqS29kanRJMW9HQTBnbmVTM0RaMF9HX1B0bWpmSFlYanMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpesIKnG6nWNHsdZuWGkdrt7L_1eeDmsUHLIRTQMb_9EX567zcXF2uU50jLaVK4WZtH0ZO0rG2RWY-20o1Y3aJCImfm_w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDIiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjM6NTQuNjY2WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjIzOjU0LjY2NloiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMi9wcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGV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GUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInZlcnNpb25pbmciOnsiZW5hYmxlZCI6dHJ1ZX0sImxpZmVjeWNsZSI6eyJydWxlIjpbeyJhY3Rpb24iOnsidHlwZSI6IlNldFN0b3JhZ2VDbGFzcyIsInN0b3JhZ2VDbGFzcyI6Ik5FQVJMSU5FIn0sImNvbmRpdGlvbiI6eyJhZ2UiOjEwLCJjcmVhdGVkQmVmb3JlIjoiMjAxNy0wMS0wMSIsImlzTGl2ZSI6ZmFsc2UsIm1hdGNoZXNTdG9yYWdlQ2xhc3MiOlsiTVVMVElfUkVHSU9OQUwiLCJTVEFOREFSRCJdLCJudW1OZXdlclZlcnNpb25zIjozfX0seyJhY3Rpb24iOnsidHlwZSI6IkRlbGV0ZSJ9LCJjb25kaXRpb24iOnsiYWdlIjozMCwiY3JlYXRlZEJlZm9yZSI6IjIwMTctMDEtMDEiLCJpc0xpdmUiOnRydWUsIm1hdGNoZXNTdG9yYWdlQ2xhc3MiOlsiTkVBUkxJTkUiXSwibnVtTmV3ZXJWZXJzaW9ucyI6MTB9fV19LCJsYWJlbHMiOnsibDEiOiJ2MSIsImVtcHR5IjoiIn0sInN0b3JhZ2VDbGFzcyI6Ik5FQVJMSU5FIiwiZXRhZyI6IkNBRT0ifQ==" + } + }, + { + "ID": "5c5a9394a6df293c", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0002?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5fc569e90e1807b37ae8b7e2261abfd9/12878089108385240242;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0002?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:55 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051332000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrgg80:4282,/bns/yr/borg/yr/bns/blobstore2/bitpusher/65.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=28usW7GPB4SGkASB5ob4BQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/65.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/65:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYkFaSE11YVZ6S2lnNDcyVW5lcUNPRzBMMmlCekJVY0NGaTB1c3o4ekE0Uk5kQ1A5aW1wbE1vcTcyVlQzLUJlVlhUaU9Mb0F0VURYRHpwb0lYZkpMMjVTZzFYTk9KZ1dJbV9QNHlaV0pGY1hHNFMxeGxnbDlmMkpXRkRUbjFfLTdweHFYNGJudndGM0JXTzZ5Y1ROdWtqX3NqS29kanRJMW9HQTBnbmVTM0RaMF9HX1B0bWpmSFlYanMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpCJff1tEGhyDbHTx3PppR8ezK_fjgJCuPocttNzHKB98UqFv38y6-CrTard9dk51CY0fizSV9S8XaEMBMpevmhBShQSQ" + ] + }, + "Body": "" + } + }, + { + "ID": "e4ab887b5dddc69b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8715d6d92b86b13e7fba448ddf7d3604/14468499912957606224;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:55 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:23:55 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051335000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrv189:4445,/bns/yv/borg/yv/bns/blobstore2/bitpusher/374.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=28usW47vJY3yggSq27_4CQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/374.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/374:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYkJ1dHF6dE1zd2lVYzFqbFhQblk4Zk1vWTU0dzJzYmZicXh1bEFiRjdFVkZTVWFCY3liY3hyY1RmRXFuX0tCOTYxZ2pONXJrYzFseHJtUGV1YnZMY2JQUVlrYjA4bnFVOGN5UVE0VDlGdy1UdTNSV2dhbWdnVDU3bl80YnpwWDU3ZjZycDJ0ejcyWXgxQnc5c2ppQmtOWlJIcGhMbEpuRHFKRC1IaXF4RllzUWpld3Ewc3RiWDRzQ2MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upt9LBuQWdif5NPssRtVxoi9j0KQELZ1rCKjIN56roTgjIH7mZ0A1ZHDuPB6c4XdqIgoZprVYGMT7pFQEGD08luMOkKlw" + ] + }, + "Body": "e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://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ebc497d92bd029c51a5c96b957211d37/16058911817007980527;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:57 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051336000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbq123:4158,/bns/yw/borg/yw/bns/blobstore2/bitpusher/161.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=28usW7OEOI-2N_7Un8gF" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/161.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/161:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYkJ1dHF6dE1zd2lVYzFqbFhQblk4Zk1vWTU0dzJzYmZicXh1bEFiRjdFVkZTVWFCY3liY3hyY1RmRXFuX0tCOTYxZ2pONXJrYzFseHJtUGV1YnZMY2JQUVlrYjA4bnFVOGN5UVE0VDlGdy1UdTNSV2dhbWdnVDU3bl80YnpwWDU3ZjZycDJ0ejcyWXgxQnc5c2ppQmtOWlJIcGhMbEpuRHFKRC1IaXF4RllzUWpld3Ewc3RiWDRzQ2MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqOH7YWz4uHeB7Zu_HYqn6JkWYP_j5bSoYFs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yI6IkNBST0ifQ==" + } + }, + { + "ID": "44db27d29c1e0abe", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "64" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8c93187dec5f14a9c6a2260dfd519d5d/17649323716780229774;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJsYWJlbHMiOnsiZW1wdHkiOiIiLCJsMSI6InYxIn0sInZlcnNpb25pbmciOnsiZW5hYmxlZCI6dHJ1ZX19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2415" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:23:58 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051336000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrmm26:4177,/bns/yv/borg/yv/bns/blobstore2/bitpusher/211.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=3cusW9DxJsfWgwSThbvoBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/211.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/211:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYkJ1dHF6dE1zd2lVYzFqbFhQblk4Zk1vWTU0dzJzYmZicXh1bEFiRjdFVkZTVWFCY3liY3hyY1RmRXFuX0tCOTYxZ2pONXJrYzFseHJtUGV1YnZMY2JQUVlrYjA4bnFVOGN5UVE0VDlGdy1UdTNSV2dhbWdnVDU3bl80YnpwWDU3ZjZycDJ0ejcyWXgxQnc5c2ppQmtOWlJIcGhMbEpuRHFKRC1IaXF4RllzUWpld3Ewc3RiWDRzQ2MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upvu77QBhzvRw1piNR-X93WTmdCSybBSWbAm_HIAco5vSyg0E3M69iewocziGyHJBL7GVmnNIcGAeyxETWYUuRlS2z5TQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjM6NTIuMzU1WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjIzOjU4LjcyM1oiLCJtZXRhZ2VuZXJhdGlvbiI6IjMiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9wcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9hY2wvcHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUi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yJ9LCJldGFnIjoiQ0FNPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInZlcnNpb25pbmciOnsiZW5hYmxlZCI6dHJ1ZX0sImxhYmVscyI6eyJlbXB0eSI6IiIsImwxIjoidjEifSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FNPSJ9" + } + }, + { + "ID": "f51861aaca48496f", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "93" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "06ae89cc69c52d58c7caa6672fbf6225/720935056889784876;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJsYWJlbHMiOnsiYWJzZW50IjpudWxsLCJlbXB0eSI6bnVsbCwibDEiOiJ2MiIsIm5ldyI6Im5ldyJ9LCJ2ZXJzaW9uaW5nIjp7ImVuYWJsZWQiOmZhbHNlfX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2417" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:00 GMT" + ], + "Etag": [ + "CAQ=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051336000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrpw19:4348,/bns/yw/borg/yw/bns/blobstore2/bitpusher/40.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=3susW7z_OIvFhgSUoLf4Ag" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/40.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/40:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYkJ1dHF6dE1zd2lVYzFqbFhQblk4Zk1vWTU0dzJzYmZicXh1bEFiRjdFVkZTVWFCY3liY3hyY1RmRXFuX0tCOTYxZ2pONXJrYzFseHJtUGV1YnZMY2JQUVlrYjA4bnFVOGN5UVE0VDlGdy1UdTNSV2dhbWdnVDU3bl80YnpwWDU3ZjZycDJ0ejcyWXgxQnc5c2ppQmtOWlJIcGhMbEpuRHFKRC1IaXF4RllzUWpld3Ewc3RiWDRzQ2MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqjrhFVd9uFgXPlY_Y-sPlqWx_zSWqwKmIwnXnWUQ02LsnvtCgpyuv71-now-QWBq_fdOf_GVkWzaBEje5_8W2gQliO-Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjM6NTIuMzU1WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjAwLjMyMloiLCJtZXRhZ2VuZXJhdGlvbiI6IjQiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6Imd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IjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FRPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FRPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInZlcnNpb25pbmciOnsiZW5hYmxlZCI6ZmFsc2V9LCJsYWJlbHMiOnsibDEiOiJ2MiIsIm5ldyI6Im5ldyJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQVE9In0=" + } + }, + { + "ID": "b64b55060955d79c", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "77" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "303b222cd26f932b6132314f2ae7055e/2311346960956936139;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJsaWZlY3ljbGUiOnsicnVsZSI6W3siYWN0aW9uIjp7InR5cGUiOiJEZWxldGUifSwiY29uZGl0aW9uIjp7ImFnZSI6MzB9fV19fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2492" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:02 GMT" + ], + "Etag": [ + "CAU=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051336000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjp9:4258,/bns/yv/borg/yv/bns/blobstore2/bitpusher/58.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=4MusW77VIJOOgQTGxbr4Cg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/58.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/58:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYkJ1dHF6dE1zd2lVYzFqbFhQblk4Zk1vWTU0dzJzYmZicXh1bEFiRjdFVkZTVWFCY3liY3hyY1RmRXFuX0tCOTYxZ2pONXJrYzFseHJtUGV1YnZMY2JQUVlrYjA4bnFVOGN5UVE0VDlGdy1UdTNSV2dhbWdnVDU3bl80YnpwWDU3ZjZycDJ0ejcyWXgxQnc5c2ppQmtOWlJIcGhMbEpuRHFKRC1IaXF4RllzUWpld3Ewc3RiWDRzQ2MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo-IbtKMtWZK12VIWm36H83fcYySjH7jSBOoH02cdECp8fasNymRIEHTBg4xzPYF2DtVWoKVAzpHVWxLGUvyVf3imyL8QGR-cuBgIoN4s32gE6AgY0" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3Jhd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IsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBVT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FVPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FVPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInZlcnNpb25pbmciOnsiZW5hYmxlZCI6ZmFsc2V9LCJsaWZlY3ljbGUiOnsicnVsZSI6W3siYWN0aW9uIjp7InR5cGUiOiJEZWxldGUifSwiY29uZGl0aW9uIjp7ImFnZSI6MzB9fV19LCJsYWJlbHMiOnsibDEiOiJ2MiIsIm5ldyI6Im5ldyJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQVU9In0=" + } + }, + { + "ID": "214ff250647b9b45", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=ddc31edea4b16a31d614ee7de096bb732d74bb8c75462aad8a02b6dd0098" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c63fd227fd0ef1001c1768b1dee0d0f7/3142440424904434202;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1kZGMzMWVkZWE0YjE2YTMxZDYxNGVlN2RlMDk2YmI3MzJkNzRiYjhjNzU0NjJhYWQ4YTAyYjZkZDAwOTgNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJjb25kZGVsIn0KDQotLWRkYzMxZWRlYTRiMTZhMzFkNjE0ZWU3ZGUwOTZiYjczMmQ3NGJiOGM3NTQ2MmFhZDhhMDJiNmRkMDA5OA0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluDQoNCmZvbw0KLS1kZGMzMWVkZWE0YjE2YTMxZDYxNGVlN2RlMDk2YmI3MzJkNzRiYjhjNzU0NjJhYWQ4YTAyYjZkZDAwOTgtLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3254" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:02 GMT" + ], + "Etag": [ + "CICps9CW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051342000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlh82:4312,/bns/yv/borg/yv/bns/blobstore2/bitpusher/384.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=4susW5GSGtiiggSxqYa4Dw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/384.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/384:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXY2MTJyUVRiNE1ZWEtqdTZPQnktbmItdVBNRDJaTWRzU01HMFpSR3hiSUNwbUhWbXVFRlVEYjNkTURQUjc1OFJLMUtDNmEtZllTQWE5RWNYMXNaSlY3M0xWLXRnRmNOZFphckJMak9JSWRJRG5vSG4ySzcwTHpLdXhZNzBBSWU1TlFzU0F3WWIwLWU1WHlKZDk4WFlQLXBBT2tTVzBraFdXblVlZnpmYzExdWZUeHZnN2llS0hTWGswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqfAXKlaBbrgYFw53CCPGs3Fc_7Oyg0ltyrmvfu-XsEw3WBnui0YnKufuulHx-futBxiHniFMJLM6i2SHoPuvKFI2mmOQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb25kZGVsLzE1MzgwNTEwNDI3NTk4MDgiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jb25kZGVsIiwibmFtZSI6ImNvbmRkZWwiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0Mjc1OTgwOCIsIm1ldGFnZW5lcmF0aW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vYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxIiwib2JqZWN0IjoiY29uZGRlbCIsImdlbmVyYXRpb24iOiIxNTM4MDUxMDQyNzU5ODA4IiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ0lDcHM5Q1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJ6OFN1SFE9PSIsImV0YWciOiJDSUNwczlDVzI5MENFQUU9In0=" + } + }, + { + "ID": "6dbba13fcd47d71f", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/conddel?alt=json\u0026generation=1538051042759807\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3b8bffeb25986a949f398d3644170d39/3901757765529302121;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/conddel?alt=json\u0026generation=1538051042759807\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12141" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:02 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:02 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051342000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrcf20:4198,/bns/yr/borg/yr/bns/blobstore2/bitpusher/0.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=4susW6KXNsSxkATZ74bIAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/0.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/0:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXY2MTJyUVRiNE1ZWEtqdTZPQnktbmItdVBNRDJaTWRzU01HMFpSR3hiSUNwbUhWbXVFRlVEYjNkTURQUjc1OFJLMUtDNmEtZllTQWE5RWNYMXNaSlY3M0xWLXRnRmNOZFphckJMak9JSWRJRG5vSG4ySzcwTHpLdXhZNzBBSWU1TlFzU0F3WWIwLWU1WHlKZDk4WFlQLXBBT2tTVzBraFdXblVlZnpmYzExdWZUeHZnN2llS0hTWGswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqwKNtC0lvvXvOJjHGNLri9TO3nTa-DXd6rZS0MXi720b899Swzs8NBB5krLGaiWnNU-xfLgFxZkpEx1KGeC5pOwR2jhg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vIHN1Y2ggb2JqZWN0OiBnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvY29uZGRlbCIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZ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g0Nilcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZSQxLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NjIpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5DdXJyZW50Q29udGV4dC5ydW5JbkNvbnRleHQoQ3VycmVudENvbnRleHQuamF2YTozMjApXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHROb1VucmVmKFRyYWNlQ29udGV4dC5qYXZhOjMyMSlcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dChUcmFjZUNvbnRleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDA0LCJtZXNzYWdlIjoiTm8gc3VjaCBvYmplY3Q6IGdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb25kZGVsIn19" + } + }, + { + "ID": "dc490fa6bbb48c34", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/conddel?alt=json\u0026ifMetagenerationMatch=2\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0e0594c6a559ad76638088af4a82573c/4732851225181833145;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/conddel?alt=json\u0026ifMetagenerationMatch=2\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 412, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "11943" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:03 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:03 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051342000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlh82:4312,/bns/yw/borg/yw/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=4susW6SoPI-jhQTSyrfwDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/115:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXY2MTJyUVRiNE1ZWEtqdTZPQnktbmItdVBNRDJaTWRzU01HMFpSR3hiSUNwbUhWbXVFRlVEYjNkTURQUjc1OFJLMUtDNmEtZllTQWE5RWNYMXNaSlY3M0xWLXRnRmNOZFphckJMak9JSWRJRG5vSG4ySzcwTHpLdXhZNzBBSWU1TlFzU0F3WWIwLWU1WHlKZDk4WFlQLXBBT2tTVzBraFdXblVlZnpmYzExdWZUeHZnN2llS0hTWGswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpW9PNlTnX1_YvdYKwOuxuOLQ-G9xx8dVMlb7UazrnA4HBJpJsWjEmrvJ67r6x6o2wfh82shQUEuCJjClvBiQayN7R-Tg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbi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bmdFeGVjdXRvclNlcnZpY2UkMS5ydW5JbkNvbnRleHQoQ29tbW9uTW9kdWxlLmphdmE6ODQ2KVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlJDEucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ2Milcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLkN1cnJlbnRDb250ZXh0LnJ1bkluQ29udGV4dChDdXJyZW50Q29udGV4dC5qYXZhOjMyMClcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dE5vVW5yZWYoVHJhY2VDb250ZXh0LmphdmE6MzIxKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MTIsIm1lc3NhZ2UiOiJQcmVjb25kaXRpb24gRmFpbGVkIn19" + } + }, + { + "ID": "7b4d64f669c0333c", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/conddel?alt=json\u0026ifMetagenerationNotMatch=1\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1f52dac0b93933518d0bdbf98d760edf/5491888194603031048;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/conddel?alt=json\u0026ifMetagenerationNotMatch=1\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 304, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:03 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:03 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051342000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrhr16:4228,/bns/yw/borg/yw/bns/blobstore2/bitpusher/147.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=48usW-HOEMnxhQTc04vYDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/147.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/147:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXY2MTJyUVRiNE1ZWEtqdTZPQnktbmItdVBNRDJaTWRzU01HMFpSR3hiSUNwbUhWbXVFRlVEYjNkTURQUjc1OFJLMUtDNmEtZllTQWE5RWNYMXNaSlY3M0xWLXRnRmNOZFphckJMak9JSWRJRG5vSG4ySzcwTHpLdXhZNzBBSWU1TlFzU0F3WWIwLWU1WHlKZDk4WFlQLXBBT2tTVzBraFdXblVlZnpmYzExdWZUeHZnN2llS0hTWGswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqXbCw-65-mGU7N9rqCcQdeR9L7gyLR3middMRmDYhL4PflAyi-fWZKa2_Hn6fC_MmZNwUUJhhbQiptY53-x322rayLLA" + ] + }, + "Body": "" + } + }, + { + "ID": "3a3d4e799b1d4ff1", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/conddel?alt=json\u0026generation=1538051042759808\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3614b8bee4c582fd5d488e1e6b9c6a83/6323263129232272727;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/conddel?alt=json\u0026generation=1538051042759808\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:03 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051342000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrih14:4363,/bns/yw/borg/yw/bns/blobstore2/bitpusher/63.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=48usW5qOI4fuN9ytj-AL" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/63.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/63:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXY2MTJyUVRiNE1ZWEtqdTZPQnktbmItdVBNRDJaTWRzU01HMFpSR3hiSUNwbUhWbXVFRlVEYjNkTURQUjc1OFJLMUtDNmEtZllTQWE5RWNYMXNaSlY3M0xWLXRnRmNOZFphckJMak9JSWRJRG5vSG4ySzcwTHpLdXhZNzBBSWU1TlFzU0F3WWIwLWU1WHlKZDk4WFlQLXBBT2tTVzBraFdXblVlZnpmYzExdWZUeHZnN2llS0hTWGswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoJHiQpNZ-qEzatUz59hED1GW-yo-BCmNHyDwotCZGRLIkp6_KPIVZkVrtmVVKlKI-NqP7C1VOZCKWq1JSFxSk32uIAcw" + ] + }, + "Body": "" + } + }, + { + "ID": "a09383dd9bc5920c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=7834c061d4a46c74dc809f40f72ea21bc28430ca21d42af796b7c56f7090" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "29f22ce3f51c65ee421feee1bd46b233/7082300098670182311;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS03ODM0YzA2MWQ0YTQ2Yzc0ZGM4MDlmNDBmNzJlYTIxYmMyODQzMGNhMjFkNDJhZjc5NmI3YzU2ZjcwOTANCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJvYmoxIn0KDQotLTc4MzRjMDYxZDRhNDZjNzRkYzgwOWY0MGY3MmVhMjFiYzI4NDMwY2EyMWQ0MmFmNzk2YjdjNTZmNzA5MA0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluDQoNChu2BO3eJ9HctT16IRSaVJ8NCi0tNzgzNGMwNjFkNGE0NmM3NGRjODA5ZjQwZjcyZWEyMWJjMjg0MzBjYTIxZDQyYWY3OTZiN2M1NmY3MDkwLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3243" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Etag": [ + "CI7Bn9GW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051344000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjm12:4359,/bns/yv/borg/yv/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=5MusW-JakcuzBviUvZAD" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/50:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqZK45KDcXNpqKxs7RM4nR3KIPATeLgKgB8XtPJRm8ykneziFgQBwXknvRchuyv76v14eoyX1QNT6vGNYl16Tcg_5AEWw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vYmoxLzE1MzgwNTEwNDQ1MzIzNjYiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmd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WtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vb2JqMS9hY2wvdXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Im9iajEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NDUzMjM2NiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJN0JuOUdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiKzdSMTFnPT0iLCJldGFnIjoiQ0k3Qm45R1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "415cbbb4c411d828", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=51ce82224b1617abfd90683ffa66b3773319b1a8364c2f78256a0cfc75c1" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "73bdb84b0db761fac19f7226ea21ad8b/7913393562617680630;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS01MWNlODIyMjRiMTYxN2FiZmQ5MDY4M2ZmYTY2YjM3NzMzMTliMWE4MzY0YzJmNzgyNTZhMGNmYzc1YzENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJvYmoyIn0KDQotLTUxY2U4MjIyNGIxNjE3YWJmZDkwNjgzZmZhNjZiMzc3MzMxOWIxYTgzNjRjMmY3ODI1NmEwY2ZjNzVjMQ0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluDQoNCsPZcNJccaSrouZ5qGqfKcMNCi0tNTFjZTgyMjI0YjE2MTdhYmZkOTA2ODNmZmE2NmIzNzczMzE5YjFhODM2NGMyZjc4MjU2YTBjZmM3NWMxLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3243" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:05 GMT" + ], + "Etag": [ + "CNeSxNGW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051344000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnna19:4148,/bns/yx/borg/yx/bns/blobstore2/bitpusher/15.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=5MusW8WsL8bPzwLJ_o3YCA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/15.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/15:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up2wgYdgpOZhxiQEfC9zZYmEfyDtJdlztDtjrpklLhwzZZlQFaOHUULevuaKs257Y9xrXUNEZ1BHjxOk8Dt_vUcduWQpA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vYmoyLzE1MzgwNTEwNDUxMzI2MzEiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9vYmoyIiwibmFtZSI6Im9iajIiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTg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AxL28vb2JqMi9hY2wvdXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Im9iajIiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NTEzMjYzMSIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNOZVN4TkdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiM0RLRHFnPT0iLCJldGFnIjoiQ05lU3hOR1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "f67034946dd9c5a8", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=090845640f43d87c92783246d30b6758c9a71a1c48bf1fa3f421832a1a1d" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "35e219d1230ad747c0ffbd9bacfec0b6/8672712002720621893;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0wOTA4NDU2NDBmNDNkODdjOTI3ODMyNDZkMzBiNjc1OGM5YTcxYTFjNDhiZjFmYTNmNDIxODMyYTFhMWQNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJvYmovd2l0aC9zbGFzaGVzIn0KDQotLTA5MDg0NTY0MGY0M2Q4N2M5Mjc4MzI0NmQzMGI2NzU4YzlhNzFhMWM0OGJmMWZhM2Y0MjE4MzJhMWExZA0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluDQoNClj7FIqgnZiH3EyVHy/zHpENCi0tMDkwODQ1NjQwZjQzZDg3YzkyNzgzMjQ2ZDMwYjY3NThjOWE3MWExYzQ4YmYxZmEzZjQyMTgzMmExYTFkLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3459" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:05 GMT" + ], + "Etag": [ + "CL6q4tGW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051344000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vril72:4228,/bns/yr/borg/yr/bns/blobstore2/bitpusher/35.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=5cusW6rBFpDv4QSx-464CQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/35.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/35:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqAi9M8gXtYgNBppM0_5Qy48gHgCeBJ2rQNhX_bVIUqNMThN5aQcO9mO1s4tsGd860po8SPIq6U8i8Tp2c-QFHY0S36-Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vYmovd2l0aC9zbGFzaGVzLzE1MzgwNTEwNDU2MjcxOTgiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9vYmolMkZ3aXRoJTJGc2xhc2hlcyIsIm5hbWUiOiJvYmovd2l0aC9zbGFzaGVzIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNDU2MjcxOTgiLCJtZXRhZ2VuZXJhdGlvbiI6IjEi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mdzZXJ2aWNlYWNjb3VudC5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9vYmolMkZ3aXRoJTJGc2xhc2hlcy9hY2wvdXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Im9iai93aXRoL3NsYXNoZXMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NTYyNzE5OCIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNMNnE0dEdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoia1NzV1FnPT0iLCJldGFnIjoiQ0w2cTR0R1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "db2ba221d4332295", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj%2Fwith%2Fslashes?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "55f8bad62f3127c0ef5fccc806d398c4/10263123902492871396;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj%2Fwith%2Fslashes?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3459" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:05 GMT" + ], + "Etag": [ + "CL6q4tGW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnob6:4175,/bns/yx/borg/yx/bns/blobstore2/bitpusher/60.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=5cusW472MoG_zALtjKnABA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/60.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/60:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrrNXgt6uywwej2qFhVm9mxQCs98f0CyuSuOI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ItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNMNnE0dEdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoia1NzV1FnPT0iLCJldGFnIjoiQ0w2cTR0R1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "dc21ca1708a6ecef", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "959f74f11da0fe031209c5ee56fc9a65/11853253236366651523;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3243" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:06 GMT" + ], + "Etag": [ + "CI7Bn9GW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrat7:4174,/bns/yv/borg/yv/bns/blobstore2/bitpusher/349.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=5cusW4DVOdPXgATL46nICA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/349.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/349:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqglj1Cm20uhsQlokYmNGcuPEqqziisZ8SNgl_7G8Wsygq5_8LpH3AzZgZGyMjI3ollcwmB_Fu3jr2EmRVk1Nr0sEPg5A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vYmoxLzE1MzgwNTEwNDQ1MzIzNjYiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9vYmoxIiwibmFtZSI6Im9iajEiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NDUzMjM2NiIsIm1ldGF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ZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Im9iajEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NDUzMjM2NiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJN0JuOUdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiKzdSMTFnPT0iLCJldGFnIjoiQ0k3Qm45R1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "fd29f689761e4b31", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj2?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5ef1744d10c7648379162c035275d3ce/13443665140433868065;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj2?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3243" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:06 GMT" + ], + "Etag": [ + "CNeSxNGW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjd27:4293,/bns/yw/borg/yw/bns/blobstore2/bitpusher/199.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=5susW-XiAsi7N6meoOAN" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/199.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/199:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqgmMt-wtS-BgBfPzVeYLqOCQ0Qmx2zZ1U1FHnzAkejIWwPi4nApt9w5rDFHnWQ1IcBGrR-SRfChmDHctco-1F1ILIAKQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vYmoyLzE1MzgwNTEwNDUxMzI2MzEiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIw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RwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vb2JqMi9hY2wvdXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Im9iajIiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NTEzMjYzMSIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNOZVN4TkdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiM0RLRHFnPT0iLCJldGFnIjoiQ05lU3hOR1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "3a99a037e206464a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "a25e5213318efa4ed40e3e176bf3f0a8/14202702109855000689;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "9984" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:06 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:06 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnfg189:4335,/bns/yx/borg/yx/bns/blobstore2/bitpusher/126.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=5susW4qoB4yRzgKW0YXoBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/126.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/126:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq8-aSvhpGNPv1tZlVtCWggTQXXV-f_thkZHH9rzlZP4_417Hx7jMyrGCez1n-6RObqAxU6Ykn6e93l54fIxaqB2KyWNg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYm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iwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNDUxMzI2MzEiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDTmVTeE5HVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IjNES0RxZz09IiwiZXRhZyI6IkNOZVN4TkdXMjkwQ0VBRT0ifV19" + } + }, + { + "ID": "87bd688d342c7b80", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ac7c5ab79ebed4a783e660562aa2bb30/15034077040189340608;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "3539" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:06 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:06 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vref6:4304,/bns/yr/borg/yr/bns/blobstore2/bitpusher/7.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=5susW9n6H6WLkAT2zYCwBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/7.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/7:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UodVTmI8-rEEYuBuGV3NiJB5_ZJMdLVpSon2_dvC4U7PFLgToJlhr6reTs3-Fy_euNgshBmySmDhaywOqXEM45PX4Pj4Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwibmV4dFBhZ2VUb2tlbiI6IkNoQnZZbW92ZDJsMGFDOXpiR0Z6YUdWeiIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vYmovd2l0aC9zbGFzaGVzLzE1MzgwNTEwNDU2MjcxOTgiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3Jhd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ItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoia1NzV1FnPT0iLCJldGFnIjoiQ0w2cTR0R1cyOTBDRUFFPSJ9XX0=" + } + }, + { + "ID": "7b63dd3875d7c28c", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=ChBvYmovd2l0aC9zbGFzaGVz\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "937f7093bd739fcc09bb93cd0d47a9da/15793114009610538511;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=ChBvYmovd2l0aC9zbGFzaGVz\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "3307" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:07 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:07 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrmt5:4328,/bns/yv/borg/yv/bns/blobstore2/bitpusher/272.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=5susW5u9OIWYNtLmguAE" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/272.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/272:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrviMDK5gl_QwiDaGX3mzHAHBar0t6nLEe_ZgxZFdBvPDPwZoNEb0G5YHcmXZ3oxTt2tZcg58WXTi5sLL3cdKn52R-rww" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwibmV4dFBhZ2VUb2tlbiI6IkNnUnZZbW94IiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL29iajEvMTUzODA1MTA0NDUzMjM2NiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL29iajEiLCJuYW1lIjoib2JqMSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImdlbmVyYXRpb24iOiIxNTM4MDUxMDQ0NTMyMzY2IiwibWV0YWdlbmVyYXRpb24iOiIxIiwiY29udGVudFR5cGUiOiJ0ZXh0L3BsYWluIiwidGltZUNyZWF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjA0LjUzMloiLCJ1cGRhdGVkIjoiMjAxOC0wOS0yN1QxMjoy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Iiwib2JqZWN0Ijoib2JqMSIsImdlbmVyYXRpb24iOiIxNTM4MDUxMDQ0NTMyMzY2IiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ0k3Qm45R1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiIrN1IxMWc9PSIsImV0YWciOiJDSTdCbjlHVzI5MENFQUU9In1dfQ==" + } + }, + { + "ID": "59779a32ce3325d0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=CgRvYmox\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d06f76647120968faf6801e7f847bcc2/16624207473574748255;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=CgRvYmox\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "3280" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:07 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:07 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdz80:4263,/bns/yr/borg/yr/bns/blobstore2/bitpusher/117.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=58usW6y2E8KnkASClZioBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/117.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/117:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq40wlm8PHg-66CKFvxN1syf6zO6TMU7Xj-aJ7JDRDW9tYTHZL1z-WYOQaoHQzcI9BoMQyck1-Q3_V0qsPeeOAqdja9DA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL29iajIvMTUzODA1MTA0NTEzMjYzMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM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Oi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9vYmoyL2FjbC91c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxIiwib2JqZWN0Ijoib2JqMiIsImdlbmVyYXRpb24iOiIxNTM4MDUxMDQ1MTMyNjMxIiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ05lU3hOR1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiIzREtEcWc9PSIsImV0YWciOiJDTmVTeE5HVzI5MENFQUU9In1dfQ==" + } + }, + { + "ID": "46a89f8b19abcfdf", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ce942d957abe25aa51aff8c6a8902b6b/17383525913677689774;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "3539" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:07 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:07 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbs9:4050,/bns/yw/borg/yw/bns/blobstore2/bitpusher/189.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=58usW4OzH9X4hASTgpuYBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/189.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/189:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpQMRp8raCulwW2LTGhYSz7tHVHxIJbJ2q8npzOrKBD6muvVlF2UE51EYCDu_VrFVYkI0Vif55kF4HrCCcrG1sIMrNAqA" + ] + }, + "Body": "ey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ODA1MTA0NTYyNzE5OCIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNMNnE0dEdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoia1NzV1FnPT0iLCJldGFnIjoiQ0w2cTR0R1cyOTBDRUFFPSJ9XX0=" + } + }, + { + "ID": "4af251bb107b46bd", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=ChBvYmovd2l0aC9zbGFzaGVz\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "61ba81076b6b0450edaa3960a50b144b/18214619377625188093;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=ChBvYmovd2l0aC9zbGFzaGVz\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "3307" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:08 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:08 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnbn6:4287,/bns/yx/borg/yx/bns/blobstore2/bitpusher/64.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=58usW8eJOMeMzQK1zJDgDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/64.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/64:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uoi7JdVKHjUAAoH_OUZ1lBy-m08Ahe2SVpkEcrEN8fXfs2-GztOUpsnFM0j4d2DWAVN_wpcAi2bZB8SZ9gaEORasVy2Bw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwibmV4dFBhZ2VUb2tlbiI6IkNnUnZZbW94IiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL29iajEvMTUzODA1MTA0NDUzMjM2NiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3Q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3VudC5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9vYmoxL2FjbC91c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxIiwib2JqZWN0Ijoib2JqMSIsImdlbmVyYXRpb24iOiIxNTM4MDUxMDQ0NTMyMzY2IiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ0k3Qm45R1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiIrN1IxMWc9PSIsImV0YWciOiJDSTdCbjlHVzI5MENFQUU9In1dfQ==" + } + }, + { + "ID": "60d1026a4e479c3a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=CgRvYmox\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "efd38d87265a668abdf5e34ef236c3d7/527475218995222861;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=1\u0026pageToken=CgRvYmox\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "3280" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:08 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:08 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbp63:4132,/bns/yr/borg/yr/bns/blobstore2/bitpusher/1.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=6MusW4fdE4eTkATnw5OYAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/1.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/1:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UooQI_nQGXwTtfxZywLyy4MI3ZXK3zGGOxqVcN34fwGrkHZvYi96r1Wo-XB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E0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiIzREtEcWc9PSIsImV0YWciOiJDTmVTeE5HVzI5MENFQUU9In1dfQ==" + } + }, + { + "ID": "d8d0c6f8532afe45", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=2\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "23aa59ef8b1a656a7a57764481f249e3/1358567583464647580;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=2\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "6767" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:09 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:09 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrd1:4212,/bns/yv/borg/yv/bns/blobstore2/bitpusher/270.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=6MusW6ytLIykNvW7uMAB" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/270.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/270:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqHH0Mn1RwMLRxs4f-RMGTZOM5qbCkUl9e7I3Lom4_LvmRJYFMuxPiPCLqx21QFNhAu6O32MjvHzGYk-Oce_hQ1ILQzoQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwibmV4dFBhZ2VUb2tlbiI6IkNnUnZZbW94IiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL29iai93aXRoL3NsYXNoZXMvMTUzODA1MTA0NTYyNzE5OCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL29iaiUyRndpdGglMkZzbGFzaGVzIiwibmFtZSI6Im9iai93aXRoL3NsYXNoZXMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NTYyNzE5OCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDowNS42MjdaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6MDUuNj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vZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vb2JqMS9hY2wvdXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Im9iajEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NDUzMjM2NiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJN0JuOUdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiKzdSMTFnPT0iLCJldGFnIjoiQ0k3Qm45R1cyOTBDRUFFPSJ9XX0=" + } + }, + { + "ID": "f3574d5c0c1dda72", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=2\u0026pageToken=CgRvYmox\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "bb79afa8303a06e95456399e4c28d835/2117604548590943979;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=2\u0026pageToken=CgRvYmox\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "3280" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:09 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:09 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrub8:4298,/bns/yv/borg/yv/bns/blobstore2/bitpusher/178.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=6cusW_K_B8TIggSEmZeoDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/178.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/178:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrOkBdaiMksr3Jzhg2qzo2Y0Z8zDuc8pB6dc1y4WcrURwCdoy16OrCLApc-xnSLoDqbIb6Qo3DspgAOuKPTwweB3uT-iQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3Rz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NvdW50LmNvbSJ9LCJjcmMzMmMiOiIzREtEcWc9PSIsImV0YWciOiJDTmVTeE5HVzI5MENFQUU9In1dfQ==" + } + }, + { + "ID": "f2f711bb69faeb45", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=2\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9f42f8b63cd1e8a51789f59550f90a39/2948979483220119867;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=2\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "6767" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:09 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:09 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbp63:4132,/bns/yv/borg/yv/bns/blobstore2/bitpusher/140.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=6cusW_faH5KCgwS2iqKgDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/140.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/140:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpR3T9vRuVsBcJqCxFkxMS1393TLzXnM1FmvP76TVSQezRyyfupQfblGucwkpaj_g19hxNbevh1tp8ZTfn1r2Bc4_fikA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwibmV4dFBhZ2VUb2tlbiI6IkNnUnZZbW94IiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL29iai93aXRoL3NsYXNoZXMvMTUzODA1MTA0NTYyNzE5OCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL29iaiUyRndpdGglMkZzbGFzaGVzIiwibmFtZSI6Im9iai93aXRoL3NsYXNoZXMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NTYyNzE5OCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDowNS42MjdaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6MDUuNjI3WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4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0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Im9iajEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NDUzMjM2NiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJN0JuOUdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiKzdSMTFnPT0iLCJldGFnIjoiQ0k3Qm45R1cyOTBDRUFFPSJ9XX0=" + } + }, + { + "ID": "8808fafb9637c238", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=2\u0026pageToken=CgRvYmox\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "a783f696c9821dde0fd569cacc970f59/3708016452658094986;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=2\u0026pageToken=CgRvYmox\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "3280" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:10 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:10 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlh9:4090,/bns/yr/borg/yr/bns/blobstore2/bitpusher/84.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=6cusW6PyOczukAPMwpbQAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/84.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/84:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoiYRTaEq7pO9cBg2viegrNBjlBrmXfkEMJiWvA6FcAMx4uUrVvCmUdM93Uhqx9YmCu6E3EXlUUzXOssXx0WjUTvGIrtQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDk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"ID": "177ae0685adc2ee1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=3\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5f216de33683069c9803469708b404e9/4539109916605593305;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=3\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "9984" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:10 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:10 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vreb18:4023,/bns/yr/borg/yr/bns/blobstore2/bitpusher/12.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=6susW8W5E9COkATL9oqABA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/12.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/12:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-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5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJvYmplY3QiOiJvYmoyIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNDUxMzI2MzEiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDTmVTeE5HVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IjNES0RxZz09IiwiZXRhZyI6IkNOZVN4TkdXMjkwQ0VBRT0ifV19" + } + }, + { + "ID": "4c5d5ec2f5ac82a1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=3\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "290553f278ed99d3bfaaa4e200ee8a41/5298428356708469033;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=3\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "9984" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:11 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:11 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrvu4:4011,/bns/yw/borg/yw/bns/blobstore2/bitpusher/68.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=6susW9aYLIHrhATap5foAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/68.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/68:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqqTZWUEdY633nBYemRmInVkovwfiLLhIYWVskV7mfCjnjlUvTl5hlDPCd2sCOQGKvDPLnR0g6w_Kak_vUGtjET-5a5WA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0w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WtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDTmVTeE5HVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IjNES0RxZz09IiwiZXRhZyI6IkNOZVN4TkdXMjkwQ0VBRT0ifV19" + } + }, + { + "ID": "dbf2b3beca4073fe", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=13\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d4daed5dc66c10342d5068cd5717a2ab/6057465326129667192;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=13\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "9984" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:11 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:11 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnb2:4089,/bns/yv/borg/yv/bns/blobstore2/bitpusher/59.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=68usW_LfB8jAggTmnbjABA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/59.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/59:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpVhzCQ4FNrnsz83C_F7ZJW_zkPRALyju0_LUrPz4dA0kD5-W_YcNRRB5ipUN8YDQ2ZOVdJeF9f5Ead7ZrYd-yS_oOJrw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL29iai93aXRoL3NsYXNoZXMvMTUzODA1MTA0NTYyNzE5OCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL29iaiUyRndpdGglMkZzbGFzaGVzIiwibmFtZSI6Im9iai93aXRoL3NsYXNoZXMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOT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Ymh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IjNES0RxZz09IiwiZXRhZyI6IkNOZVN4TkdXMjkwQ0VBRT0ifV19" + } + }, + { + "ID": "e8813cef66890896", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=13\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "62aa9d0cab4f9a0da9ef03336c517f21/6888558790093942471;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026maxResults=13\u0026pageToken=\u0026prefix=obj\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "9984" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:11 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:11 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnlz21:4176,/bns/yx/borg/yx/bns/blobstore2/bitpusher/98.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=68usW_HzH5C5zwK1qK7ABg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/98.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/98:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrkNNiEw_PwZc-Zf2lHJ96tTZm1AUqfzqSG48wX2_Lyzi-K-RPTcM4QEfUyXYjSKbb_SWOe1xSTGRQBMnW95mGmeG8pAQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL29iai93aXRoL3NsYXNoZXMvMTUzODA1MTA0NTYyNzE5OCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL29iaiUyRndpdGglMkZzbGFzaGVzIiwibmFtZSI6Im9iai93aXRoL3NsYXNoZXMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NTYyNzE5OCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDowNS42MjdaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6MDUuNjI3WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA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vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL29iajIvYWNsL3VzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJvYmplY3QiOiJvYmoyIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNDUxMzI2MzEiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDTmVTeE5HVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IjNES0RxZz09IiwiZXRhZyI6IkNOZVN4TkdXMjkwQ0VBRT0ifV19" + } + }, + { + "ID": "d8438a79406c3ee7", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e34a37eefc5f30bda40070484796f0c8/8478970689849414758;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/36,/bns/xh/borg/xh/bns/blobstore2/bitpusher/67.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=68usW-PjO8atswaMgIygCQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/67.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/67:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoN20jwQv6iqBStn8N8_-tHO-IskyynbFbYmE1mHi1U9xJb6Y2n3w85qIy_ia8QkIr7pFOugsjvxJjlyeGqhAvDrPmvpQ" + ] + }, + "Body": "G7YE7d4n0dy1PXohFJpUnw==" + } + }, + { + "ID": "fd51799008bfea12", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b351f3135416bf5a89a34b654a1b3303/10069381494421780740;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/25,/bns/xh/borg/xh/bns/blobstore2/bitpusher/80.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW9CDCs6kswbMy5uwDQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/80.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/80:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo5sFr6jrRtig10NXjMHaOuCabFiHZyrLqEZXpEdYTzqQD2zOhEp6iVt_78e54QX32MpRWEinlwSQbwTIdqrl9IOW_eUQ" + ] + }, + "Body": "G7YE7d4n0dy1PXohFJpUnw==" + } + }, + { + "ID": "6c56bc3a2067d53c", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj2", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fbdec27742a732b75803ee6a32401901/11659793398472155043;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj2" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"87ae2662a2763b9e23af118e24dc86c5\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:05 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:05 GMT" + ], + "X-Goog-Generation": [ + "1538051045132631" + ], + "X-Goog-Hash": [ + "crc32c=3DKDqg==", + "md5=h64mYqJ2O54jrxGOJNyGxQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/8,/bns/xh/borg/xh/bns/blobstore2/bitpusher/28.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW4aSDYuhswbl1qKYBg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/28.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/28:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpfFy79R8hO4AoIDRUlP96iSXUSqB11GvlDhxq4NcGDXbTVxdErTejn5DnMjFhugLOAuP-p9uQDPyFy4be5vpakmpIg0w" + ] + }, + "Body": "w9lw0lxxpKui5nmoap8pww==" + } + }, + { + "ID": "e68e0aa406a7ace6", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj2", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "436c06c3631f6877cb6b0adeb4d42c30/13249923827562660930;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj2" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"87ae2662a2763b9e23af118e24dc86c5\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:05 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:05 GMT" + ], + "X-Goog-Generation": [ + "1538051045132631" + ], + "X-Goog-Hash": [ + "crc32c=3DKDqg==", + "md5=h64mYqJ2O54jrxGOJNyGxQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/10,/bns/xh/borg/xh/bns/blobstore2/bitpusher/86.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW7OVE-6oswaP1oK4DA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/86.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/86:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrkIt55pMPwjOM5myY8ijTv9lEmVrnGGv9NO_S-cG3qqvbRihzY7EKU2bhQVR1P9es7xJ7zsET3Av7yqTQ05O7kSs8vHA" + ] + }, + "Body": "w9lw0lxxpKui5nmoap8pww==" + } + }, + { + "ID": "0908749e71e23161", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj/with/slashes", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "46b71c05144a5810a4f56acc0f1e1817/14840335731613100768;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj/with/slashes" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"fbb9959fa2d3c039d5ded83fa42ae2a3\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:05 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:05 GMT" + ], + "X-Goog-Generation": [ + "1538051045627198" + ], + "X-Goog-Hash": [ + "crc32c=kSsWQg==", + "md5=+7mVn6LTwDnV3tg/pCriow==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/34,/bns/xh/borg/xh/bns/blobstore2/bitpusher/64.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW5yxFsKmswayqIGIDg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/64.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/64:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo7UsAfQNdMNAdb2cU08Ktr6iNP4KbzoyHv46mQTZhM3d4zXlwFI8AcTFAPnQBWXJ_AUMDTKPS3LKGs617c7Shqv8l-rg" + ] + }, + "Body": "WPsUiqCdmIfcTJUfL/MekQ==" + } + }, + { + "ID": "3a6945ba8c54d3d0", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj/with/slashes", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e18289f7643f0221c20d31d88e440330/16358691141153951615;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj/with/slashes" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"fbb9959fa2d3c039d5ded83fa42ae2a3\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:05 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:05 GMT" + ], + "X-Goog-Generation": [ + "1538051045627198" + ], + "X-Goog-Hash": [ + "crc32c=kSsWQg==", + "md5=+7mVn6LTwDnV3tg/pCriow==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/10,/bns/xh/borg/xh/bns/blobstore2/bitpusher/62.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW9KVHMSmswaLopWwDA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/62.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/62:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq1_6wNvDu73BRMfGjIe95yVvDDKtlIqWWmlfUxcAWUAI5ZYPk8bBJS5SzvrFzdt-g5gRdnfa1S1wWBolex4S0h4SuWRQ" + ] + }, + "Body": "WPsUiqCdmIfcTJUfL/MekQ==" + } + }, + { + "ID": "55395569801967d3", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Authorization": [ + "REDACTED" + ], + "Range": [ + "bytes=0-15" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "835d9af2500c84822019536da352936f/17948820470732829982;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/6,/bns/xh/borg/xh/bns/blobstore2/bitpusher/52.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW6XiH7Cqswa-pIPADw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/52.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/52:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur7qd9oilYQm2rBqGKum--l_-DYiYr2wxV2HJ9nTGE4RjGaDoqeOfB5G5nmQkUR3Tq5M6AzVrwD5yKlNjiyN4-R2MFMNA" + ] + }, + "Body": "G7YE7d4n0dy1PXohFJpUnw==" + } + }, + { + "ID": "d869b9305381b8dc", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Authorization": [ + "REDACTED" + ], + "Range": [ + "bytes=0-7" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4402daf1c2931122ca6c23a4457c8567/1092769776067205820;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 206, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "8" + ], + "Content-Range": [ + "bytes 0-7/16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/15,/bns/xh/borg/xh/bns/blobstore2/bitpusher/39.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW5uYIouoswbSkZD4Bg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/39.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/39:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur7al2tIDOVB8w1OYnq2HBh8-8N1uPecM3R2P83XNw62Pj2fwUZJ5gH9hLQ6Jcyl8MA_3jTwOes2TDZayRnvMI8GTe6ng" + ] + }, + "Body": "G7YE7d4n0dw=" + } + }, + { + "ID": "0a535e86355c12ac", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Authorization": [ + "REDACTED" + ], + "Range": [ + "bytes=8-23" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b0441aa4a7eab03a43e60c8b286ebd0f/2683181680117579867;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 206, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "8" + ], + "Content-Range": [ + "bytes 8-15/16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/3,/bns/xh/borg/xh/bns/blobstore2/bitpusher/55.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW-L2JO2kswaT64GQDQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/55.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/55:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrmRn0K293XJuaEyQYPoTS5Bbd-uKT12V8mzmrOYMj5aMCOa6ndse3iLY_TY5wzWyI4I38vJ3A0G6T7MTHHfrIxetCXaw" + ] + }, + "Body": "tT16IRSaVJ8=" + } + }, + { + "ID": "ad1c8f3bf07175cb", + "Request": { + "Method": "HEAD", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d6872a13ef19e6aded259a214ad6449e/4273593584184731130;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/35,/bns/xh/borg/xh/bns/blobstore2/bitpusher/59.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW-XcJ4OhswbwjYa4Bw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/59.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/59:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrOJk9tHBq0OUCi9A8y0xXe7IslqrVOVGYdH5Mbp-7Snhb8xEW8qc8GIb9lIWnFCETqHRZh7ONRc1Xzf5HG9W0jws0QSA" + ] + }, + "Body": "" + } + }, + { + "ID": "3c4f9ce008c97f86", + "Request": { + "Method": "HEAD", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "72e113b79d3ca5d01ad7071131993c6b/5863724013258525592;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/21,/bns/xh/borg/xh/bns/blobstore2/bitpusher/2.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW9GTKo6kswbkhYKoAQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/2.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/2:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ura7_vBiJ9u_QXx62sETf4NCB8WaOdF-C-fdKE7JvfU4jceQVdFuFPknKkVLmlPbkF6-w60s3MPUSr_WZEW6hi7welwbg" + ] + }, + "Body": "" + } + }, + { + "ID": "649ec0e8258f8230", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Authorization": [ + "REDACTED" + ], + "Range": [ + "bytes=8-" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "312d714b782e4823e2766239e9764a82/7454134817830826039;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 206, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "8" + ], + "Content-Range": [ + "bytes 8-15/16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/24,/bns/xh/borg/xh/bns/blobstore2/bitpusher/26.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW8nZLOusswbax6LwDA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/26.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/26:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpK-jwiYqScQfGxJj6D6ewVKGX-nZjT0EmiiH4Tfi66bSPjtZh5-kVGuI6Ckly3VoTzW_sJD6d_YuMNo3fLYyALhrBNyA" + ] + }, + "Body": "tT16IRSaVJ8=" + } + }, + { + "ID": "be676a0036e215e9", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Authorization": [ + "REDACTED" + ], + "Range": [ + "bytes=0-31" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f92a4564cfdb1f40093f36bf14fcf5ab/9044546721881200342;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/9,/bns/xh/borg/xh/bns/blobstore2/bitpusher/21.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW4m5L8msswb5q6WgAg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/21.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/21:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UppB6wgT197zLhkNdO97CZkj9y76ysWm6rz4qIrigBJOHEncPQvnSZDWNtkK6WWA1RmDPZuTTbqvJNssVtWwNLVMAAUxA" + ] + }, + "Body": "G7YE7d4n0dy1PXohFJpUnw==" + } + }, + { + "ID": "563f2298ed35180b", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Authorization": [ + "REDACTED" + ], + "Range": [ + "bytes=32-41" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2cf3892a10fb83adcb8a69720664c6a0/10634958621653515124;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 416, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "167" + ], + "Content-Type": [ + "application/xml; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/34,/bns/xh/borg/xh/bns/blobstore2/bitpusher/56.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW5XDMoqlswbzlYawCw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/56.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/56:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoID9l6tyltcSHgLV69E97wXKAD-WE81yY0iXvNFvdpm015fzIqnhV2V7ZMBUN7MDdQrniSPTv19biVJsQbMFKmQuXGeA" + ] + }, + "Body": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48RXJyb3I+PENvZGU+SW52YWxpZFJhbmdlPC9Db2RlPjxNZXNzYWdlPlRoZSByZXF1ZXN0ZWQgcmFuZ2UgY2Fubm90IGJlIHNhdGlzZmllZC48L01lc3NhZ2U+PERldGFpbHM+Ynl0ZXM9MzItNDE8L0RldGFpbHM+PC9FcnJvcj4=" + } + }, + { + "ID": "5f4b31aaff5df0cc", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "21c5e6e73109926f023bb79cdaafcc44/12225089055022145811;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3243" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:12 GMT" + ], + "Etag": [ + "CI7Bn9GW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbq123:4158,/bns/yr/borg/yr/bns/blobstore2/bitpusher/55.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW6y8Ncir4QTO6IXwDg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/55.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/55:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrAONkHQISdEo7cEP4cm1vetvXWVS9a80QVkqu9SZg59_a9lpik1K4gnAkyp_eO4UAV121zCztwRsueq59YHW-EBBWI4w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXR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": "e47f597968365398", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3076aa16329e4789b551e820d99ef754/13815500959089297074;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2492" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:13 GMT" + ], + "Etag": [ + "CAU=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:13 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbo6:4135,/bns/yv/borg/yv/bns/blobstore2/bitpusher/181.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7MusW6jMOcfugwS5tIzoDQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/181.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/181:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up1-8QHizF8BXIhjqF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hYmxlZCI6ZmFsc2V9LCJsaWZlY3ljbGUiOnsicnVsZSI6W3siYWN0aW9uIjp7InR5cGUiOiJEZWxldGUifSwiY29uZGl0aW9uIjp7ImFnZSI6MzB9fV19LCJsYWJlbHMiOnsibDEiOiJ2MiIsIm5ldyI6Im5ldyJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQVU9In0=" + } + }, + { + "ID": "40317a730e582890", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "808117ec5164e049873a57f9d75f176c/15405911759349984336;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3426" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:13 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051353000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrwe17:4005,/bns/yr/borg/yr/bns/blobstore2/bitpusher/112.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7cusW7_8DoiVkASQyLSgCw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/112.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/112:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoUNvhhQ0zd70YwDbOepu-hwK9grkIt_2RiEejT3Rj3AMn9HDTHdDZ-5r6mOw20lJBouR5jU8fLFoy7vo9bNAnCUOQGTQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNyZXdyaXRlUmVzcG9uc2UiLCJ0b3RhbEJ5dGVzUmV3cml0dGVuIjoiMTYiLCJvYmplY3RTaXplIjoiMTYiLCJkb25lIjp0cnVlLCJyZXNvdXJjZSI6eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb3B5LW9iajEvMTUzODA1MTA1MzcyNjgyOCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL2NvcHktb2JqMSIsIm5hbWUiOiJjb3B5LW9iajEiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA1MzcyNjgyOCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFp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MTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6ImNvcHktb2JqMSIsImdlbmVyYXRpb24iOiIxNTM4MDUxMDUzNzI2ODI4IiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ096WTBOV1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiIrN1IxMWc9PSIsImV0YWciOiJDT3pZME5XVzI5MENFQUU9In19" + } + }, + { + "ID": "7c3fbfa4c28e7623", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "31" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1efea7e671407b24046cb68f9467a222/16996042192735392239;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJjb250ZW50RW5jb2RpbmciOiJpZGVudGl0eSJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3392" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:14 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051353000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnv70:4268,/bns/yw/borg/yw/bns/blobstore2/bitpusher/172.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7cusW9PCO4GQhwSdyY-ADQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/172.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/172:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up33epgf_s87PSifY-y8vQLl43RsrHASyr8ALFMlZw8YfpoG2NAwQES9MZmUZyba-yAq30TyHZ99rRIenUr9Dc1ui9rsw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNyZXdyaXRlUmVzcG9uc2UiLCJ0b3RhbEJ5dGVzUmV3cml0dGVuIjoiMTYiLCJvYmplY3R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LTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Iis3UjExZz09IiwiZXRhZyI6IkNON0QrOVdXMjkwQ0VBRT0ifX0=" + } + }, + { + "ID": "1784d4812eaeaade", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "193" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "818f5c53c45ebea5a3d0031cb5bfdc65/139991498052990861;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJhY2wiOlt7ImVudGl0eSI6ImRvbWFpbi1nb29nbGUuY29tIiwicm9sZSI6IlJFQURFUiJ9XSwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxIiwiY29udGVudExhbmd1YWdlIjoiZW4iLCJjb250ZW50VHlwZSI6InRleHQvaHRtbCIsIm1ldGFkYXRhIjp7ImtleSI6InZhbHVlIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2151" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:14 GMT" + ], + "Etag": [ + "CI7Bn9GW290CEAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051354000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrs186:4456,/bns/yw/borg/yw/bns/blobstore2/bitpusher/88.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7susW4HKIYHThATpoLP4DQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/88.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/88:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoYxKDkKtLtPDhSLnUQOcGlMYcLsZCmb_BMAWiEx4kPh-aSCKvKxmxQ2Pyx3GmtzGPQfEH1BDK7SXJINgP-EsUMPejF4g" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vYmoxLzE1MzgwNTEwNDQ1MzIzNjYiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9vYmoxIiwibmFtZSI6Im9iajEiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NDUzMjM2NiIsIm1ldGFnZW5lcmF0aW9uIjoiMiIsImNvbnRlbnRUeXBlIjoidGV4dC9odG1sIiwidGltZUNyZWF0ZWQiOiI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XRhZyI6IkNJN0JuOUdXMjkwQ0VBST0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiKzdSMTFnPT0iLCJldGFnIjoiQ0k3Qm45R1cyOTBDRUFJPSJ9" + } + }, + { + "ID": "ed8837066cd682d4", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "120" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e31962cb701aec17955519bbc8994ef5/1658346907593841708;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJjb250ZW50TGFuZ3VhZ2UiOm51bGwsImNvbnRlbnRUeXBlIjpudWxsLCJtZXRhZGF0YSI6bnVsbH0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2075" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:14 GMT" + ], + "Etag": [ + "CI7Bn9GW290CEAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051354000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnen196:4410,/bns/yx/borg/yx/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=7susW7KPMIigzALuzLGYBQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/115:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqbu1PynGWlbjSeyTQwegY8fK2Ywxed0wJDknj_zqpsVed8gDtlvoWg8oM4ZKcNajzVapPj-mNAsDPj42T-Uc4lmxcHFg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vYmoxLzE1MzgwNTEwNDQ1MzIzNjYiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9vYmoxIiwibmFtZSI6Im9iajEiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA0NDUzMjM2NiIsIm1ldGFnZW5lcmF0aW9uIjoiMyIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDowNC41MzJaIiwidXBkYXRlZCI6IjIwMTgtMDktM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bG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiIrN1IxMWc9PSIsImV0YWciOiJDSTdCbjlHVzI5MENFQU09In0=" + } + }, + { + "ID": "2da4d03d65e44aff", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=29bfc48d421eb985742aa3c01fa02a8f4f07eb13a9df1f3a6d2ffbabd8c2" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4b38b821542f76a1d762740d02b631d9/2489440367246438267;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0yOWJmYzQ4ZDQyMWViOTg1NzQyYWEzYzAxZmEwMmE4ZjRmMDdlYjEzYTlkZjFmM2E2ZDJmZmJhYmQ4YzINCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJjaGVja3N1bS1vYmplY3QifQoNCi0tMjliZmM0OGQ0MjFlYjk4NTc0MmFhM2MwMWZhMDJhOGY0ZjA3ZWIxM2E5ZGYxZjNhNmQyZmZiYWJkOGMyDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KaGVsbG93b3JsZA0KLS0yOWJmYzQ4ZDQyMWViOTg1NzQyYWEzYzAxZmEwMmE4ZjRmMDdlYjEzYTlkZjFmM2E2ZDJmZmJhYmQ4YzItLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3398" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:15 GMT" + ], + "Etag": [ + "CK+As9aW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051344000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrp62:4379,/bns/yv/borg/yv/bns/blobstore2/bitpusher/111.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=78usW-1oz5yBBLWtmIgB" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/111.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/111:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UowJsm6E91bsGVBm6CM-mz8rDfoul1oIecNfHPOUKCznqaR9zK2zwL7-0GmZY0j80eiUDC7pO726ekxFHOv4yM7p6uzug" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jaGVja3N1bS1vYmplY3QvMTUzODA1MTA1NTMzNzUxOSIsInNlbGZMaW5rIjoiaHR0cHM6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XZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJWc3UwZ0E9PSIsImV0YWciOiJDSytBczlhVzI5MENFQUU9In0=" + } + }, + { + "ID": "7493d7564de97c32", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=83686c59a67e3a3090aacc06f8cc35bc689e1130c5abb2208114560bd462" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ade53e256843f2179ea331cc5e743445/3248758807366091211;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS04MzY4NmM1OWE2N2UzYTMwOTBhYWNjMDZmOGNjMzViYzY4OWUxMTMwYzVhYmIyMjA4MTE0NTYwYmQ0NjINCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJ6ZXJvLW9iamVjdCJ9Cg0KLS04MzY4NmM1OWE2N2UzYTMwOTBhYWNjMDZmOGNjMzViYzY4OWUxMTMwYzVhYmIyMjA4MTE0NTYwYmQ0NjINCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA0KDQoNCi0tODM2ODZjNTlhNjdlM2EzMDkwYWFjYzA2ZjhjYzM1YmM2ODllMTEzMGM1YWJiMjIwODExNDU2MGJkNDYyLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3333" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:16 GMT" + ], + "Etag": [ + "CPbJ19aW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051344000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrks2:4058,/bns/yv/borg/yv/bns/blobstore2/bitpusher/323.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=78usW4eCI5XYgQTfuLnICg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/323.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/323:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqhWY1Ab_R5DZveNFpWX2c-1hrdM8jXZdJRqFjpgtkI00Ya1DA0RgxrWCZI9zbGnWSoD1CFZn3oBDKQMDdbLLqOW3zihw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS96ZXJvLW9iamVjdC8xNTM4MDUxMDU1OTM2NzU4Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yY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7", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1/acl/allUsers?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "98" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "33f9664c55b05032698ecc2d6673d6bf/4838888141239936873;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1/acl/allUsers?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJlbnRpdHkiOiJhbGxVc2VycyIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "417" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:16 GMT" + ], + "Etag": [ + "CI7Bn9GW290CEAQ=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051354000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnbf187:4310,/bns/yx/borg/yx/bns/blobstore2/bitpusher/100.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8MusW4rgA8rpzgLno6zgCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/100.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/100:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrpvmIybpBCVebTDqqsidgrv6r5XJxfkgIb_b4OdZyS6TDxQJumscogNbWOP14ydRFDoIao0YBIztO_mFhZHqa_FtHANw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvb2JqMS8xNTM4MDUxMDQ0NTMyMzY2L2FsbFVzZXJzIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vb2JqMS9hY2wvYWxsVXNlcnMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJvYmplY3QiOiJvYmoxIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNDQ1MzIzNjYiLCJlbnRpdHkiOiJhbGxVc2VycyIsInJvbGUiOiJSRUFERVIiLCJldGFnIjoiQ0k3Qm45R1cyOTBDRUFRPSJ9" + } + }, + { + "ID": "3d0b287f3cb38a1a", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "690d0db937791a93fb309e862ad54704/6429300045307087880;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "application/octet-stream" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:16 GMT" + ], + "Etag": [ + "\"ef05051fc9830f01c562aa3ba25c5d3e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:16 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:04 GMT" + ], + "X-Goog-Generation": [ + "1538051044532366" + ], + "X-Goog-Hash": [ + "crc32c=+7R11g==", + "md5=7wUFH8mDDwHFYqo7olxdPg==" + ], + "X-Goog-Metageneration": [ + "4" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/36,/bns/xh/borg/xh/bns/blobstore2/bitpusher/14.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8MusW9aLFMKgswasv66gCg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/14.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/14:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UodxwoKYGU9MxqABteUDaXQqlKGdhkVHcajT7guddfpYQr1LRepGJXYbFR9Qs2gdcsSHWrgNx6HyMYR6YLY5M456Mko7w" + ] + }, + "Body": "G7YE7d4n0dy1PXohFJpUnw==" + } + }, + { + "ID": "cae829cdb9b34f3e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Content-Type": [ + "multipart/related; boundary=29bb3acea632c820a568e150cb4a4bf04415fd1bdf63309db1e96c525d7a" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8a62594ad456c247ec2bd76dc9e52f57/7260393509254586199;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0yOWJiM2FjZWE2MzJjODIwYTU2OGUxNTBjYjRhNGJmMDQ0MTVmZDFiZGY2MzMwOWRiMWU5NmM1MjVkN2ENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJvYmoxIn0KDQotLTI5YmIzYWNlYTYzMmM4MjBhNTY4ZTE1MGNiNGE0YmYwNDQxNWZkMWJkZjYzMzA5ZGIxZTk2YzUyNWQ3YQ0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCmhlbGxvDQotLTI5YmIzYWNlYTYzMmM4MjBhNTY4ZTE1MGNiNGE0YmYwNDQxNWZkMWJkZjYzMzA5ZGIxZTk2YzUyNWQ3YS0tDQo=" + }, + "Response": { + "StatusCode": 401, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "30139" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:16 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "Www-Authenticate": [ + "Bearer realm=\"https://accounts.google.com/\"" + ], + "X-Google-Backends": [ + "vrqp19:4117,/bns/yv/borg/yv/bns/blobstore2/bitpusher/203.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8MusW5PmF5C0ggSujK6wDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/203.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/203:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "GgIYBiAB" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqWr2rfS-bwg-Gq7do_pbFNKm2Y8I25oad-2ZZG3L56Sy5jUKoxRp1icBi27T5FiJu6D5V0nkc7qgcMqJALSN9rMHPscQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkFub255bW91cyBjYWxsZXIgZG9lcyBub3QgaGF2ZSBzdG9yYWdlLm9iamVjdHMuY3JlYXRlIGFjY2VzcyB0byBnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvb2JqMS4iLCJsb2NhdGlvblR5cGUiOiJoZWFkZXIiLCJsb2NhdGlvbiI6IkF1dGhvcml6YXRpb24iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6QUNDRVNTX0RFTklFRDogQW5vbnltb3VzIGNhbGxlciBkb2VzIG5vdCBoYXZlIHN0b3JhZ2Uub2JqZWN0cy5jcmVhdGUgYWNjZXNzIHRvIGdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5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758aed3ba16e613", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6afbb969fe0885a2b78dd5858f886be6/8019711945062560423;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:16 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051344000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdg20:4229,/bns/yw/borg/yw/bns/blobstore2/bitpusher/70.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8MusW6TyLMP_N8WAs9AK" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/70.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/70:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo_WB_TIzYXheVC2PJxwKX79DTZxYv5LtBQXsHamFWDNH7tEHd8DHlpDI9Jo2cqRV5n41EYgQ8qbNPMD5IQCnn-ClF1g5EMIraE8-GyrOhLPzDudG0" + ] + }, + "Body": "" + } + }, + { + "ID": "9b9733451f86c731", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4ed613e1f2dd59d68cc9f92a23ace1da/8850805409010058742;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12167" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:17 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:17 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051344000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnes8:4151,/bns/yx/borg/yx/bns/blobstore2/bitpusher/113.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8MusW96TO8P9zALA9KDoCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/113.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/113:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpQL7qcvVzjYBgZfUSe7_5liX8MrrghnugMlAYRFFtlEiR6qULOiIf42xoZ5ufqXErot0V89XuVLD6JnhdYSiKdu0Q3IQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vIHN1Y2ggb2JqZWN0OiBnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvY29weS1vYmoxIiwiZGVidWdJbmZvIjoiY29tLmdvb2dsZS5uZXQucnBjMy5ScGNFeGNlcHRpb246IGNsb3VkLmJpZ3N0b3JlLlJlc3BvbnNlQ29kZS5FcnJvckNvZGU6Ok9CSkVDVF9OT1RfRk9VTkQ6IE5vIHN1Y2ggb2JqZWN0OiBnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvY29weS1vYmoxXG5cdGF0IGNvbS5nb29nbGUuY2xvdWQuYmlnc3RvcmUuY29tbW9uLkJpZ3N0b3JlRXhjZXB0aW9uLnRvUnBjM0V4Y2VwdGlvbihCaWdzdG9yZUV4Y2VwdGlvbi5qYXZhOjEzNSlcblx0YXQgY29tLmdvb2dsZS5jbG91ZC5iaWdzdG9yZS5jb21tb24uQmlnc3RvcmVFeGNlcHRpb24udGhyb3dScGMzT25FcnJvcihCaWdzdG9yZUV4Y2VwdGlvbi5qYXZhOjMwMylcblx0YXQgY29tLmdvb2dsZS5jbG91ZC5iaWdzdG9yZS5hcGkuanNvbi5oYW5kbGVycy5vYmplY3RzLkRlbGV0ZU9iamVjdC5oYW5kbGVSZXF1ZXN0UmVjZWl2ZWQoRGVsZXRlT2JqZWN0LmphdmE6N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0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDA0LCJtZXNzYWdlIjoiTm8gc3VjaCBvYmplY3Q6IGdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb3B5LW9iajEifX0=" + } + }, + { + "ID": "d6873ffc79300971", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "08e7bf5864621c4b488ed652bb33efa8/10441217313077209749;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/copy-obj1?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12107" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:17 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:17 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051345000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnnl20:4294,/bns/yx/borg/yx/bns/blobstore2/bitpusher/86.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8cusW9T2AsK0zALEw4ygDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/86.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/86:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UokNGRr71RRY51b_oxACRzHO0T0SKYySfLa0FwXM-OtehDW-Ck9X2Q17U8IVWtiH3JL37eb5NYUCBv065INRRt6SnW2ZA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vIHN1Y2ggb2JqZWN0OiBnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvY29weS1vYmoxIiwiZGVidWdJbmZvIjoiY29tLmdvb2dsZS5uZXQucnBjMy5ScGNFeGNlcHRpb246IGNsb3VkLmJpZ3N0b3JlLlJlc3BvbnNlQ29kZS5FcnJvckNvZGU6Ok9CSkVDVF9OT1RfRk9VTkQ6IE5vIHN1Y2ggb2JqZWN0OiBnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvY29weS1vYmoxXG5cdGF0IGNvbS5nb29nbGUuY2xvdWQuYmlnc3RvcmUuY29tbW9uLkJpZ3N0b3JlRXhjZXB0aW9uLnRvUnBjM0V4Y2VwdGlvbihCaWdzdG9yZUV4Y2VwdGlvbi5qYXZhOjEzNSlcblx0YXQgY29tLmdvb2dsZS5jbG91ZC5iaWdzdG9yZS5jb21tb24uQmlnc3RvcmVFeGNlcHRp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NrLnJ1bkluSW5oZXJpdGVkQ29udGV4dChUcmFjZUNvbnRleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDA0LCJtZXNzYWdlIjoiTm8gc3VjaCBvYmplY3Q6IGdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb3B5LW9iajEifX0=" + } + }, + { + "ID": "6cc70dcba7bada17", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/composed1/compose?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "156" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9863e2969d42a229b723aedca5070485/12031628117632798771;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/composed1/compose?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6Im9iajEifSx7Im5hbWUiOiJvYmoyIn0seyJuYW1lIjoib2JqL3dpdGgvc2xhc2hlcyJ9XX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "750" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:17 GMT" + ], + "Etag": [ + "CPK8wteW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051353000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrmu6:4354,/bns/yr/borg/yr/bns/blobstore2/bitpusher/80.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8cusW4fEE9L6kAP667DgBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/80.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/80:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqVIeiy4Si_0YNKLwY3IG9GOLU0P0n1CkorBkpJAR_BfS1jk_56Sw6HKwDphzFjNssouMyenjo7arMSaMAmsUdvFlYB9w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb21wb3NlZDEvMTUzODA1MTA1NzY4ODE3OCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL2NvbXBvc2VkMSIsIm5hbWUiOiJjb21wb3NlZDEiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA1NzY4ODE3OCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDoxNy42ODhaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6MTcuNjg4WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjE3LjY4OFoiLCJzaXplIjoiNDgiLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vY29tcG9zZWQxP2dlbmVyYXRpb249MTUzODA1MTA1NzY4ODE3OCZhbHQ9bWVkaWEiLCJjcmMzMmMiOiJib0I4bXc9PSIsImNvbXBvbmVudENvdW50IjozLCJldGFnIjoiQ1BLOHd0ZVcyOTBDRUFFPSJ9" + } + }, + { + "ID": "50f8730f385d030c", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/composed1", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "760c277df2c97acc454ce434914ee9e8/13549702052197004754;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/composed1" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "48" + ], + "Content-Type": [ + "application/octet-stream" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:17 GMT" + ], + "Etag": [ + "\"-CPK8wteW290CEAE=\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:17 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:17 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Component-Count": [ + "3" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:17 GMT" + ], + "X-Goog-Generation": [ + "1538051057688178" + ], + "X-Goog-Hash": [ + "crc32c=boB8mw==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "48" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/18,/bns/xh/borg/xh/bns/blobstore2/bitpusher/34.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8cusW9ebMdCoswa6y4HoAw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/34.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/34:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoX-eaOWQ9wa_8D4JqhxXvp57Z8lKcw7mTxFIfWfaKu1KAUgjL9WuATvzG1v-OCqywESusNWkTDMqjoDaCDrd7JK3sf0A" + ] + }, + "Body": "G7YE7d4n0dy1PXohFJpUn8PZcNJccaSrouZ5qGqfKcNY+xSKoJ2Yh9xMlR8v8x6R" + } + }, + { + "ID": "4f10cc8a4c605e16", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/composed2/compose?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "182" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2a7e45e04c9b2ba8510787a4626e0409/15140113956247378801;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/composed2/compose?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJjb250ZW50VHlwZSI6InRleHQvanNvbiJ9LCJzb3VyY2VPYmplY3RzIjpbeyJuYW1lIjoib2JqMSJ9LHsibmFtZSI6Im9iajIifSx7Im5hbWUiOiJvYmovd2l0aC9zbGFzaGVzIn1dfQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "776" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:18 GMT" + ], + "Etag": [ + "CNnn7NeW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051353000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrfx72:4146,/bns/yv/borg/yv/bns/blobstore2/bitpusher/63.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8cusW5aPOMeCNruzofgP" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/63.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/63:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRYnFLZDRCTjBkdm9mZm9PZVZZS0p1VDRROFVJT3NhUTljbFFvbW42UElpcDBpenczVUc1ZHZUMVZlZE1OWGp3cHJDNUUyam9FUUZwbldFellKMWd5Tlp1T3o4dy16UUMxaXAtb3VNMjdkM0JqNGR4SmNfUDVYRXRjeHNYWVN3LXNuNXEtcXpLZ1NvM3BKMGx4Ym9YaGNlZHBiR2t6VGVSdlc5QnVxZDFESV9pbE84ZEFXSDVOLVJnNDQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrggIUXoQRGOBqCG_DLynaYwpyl_4lENPEOVra5582u9rZmF-icWSkCFTlLj14A0wP6_ZaqI_ZgXHPSrgXC2GkiLC3MWw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb21wb3NlZDIvMTUzODA1MTA1ODM4MTc4NSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL2NvbXBvc2VkMiIsIm5hbWUiOiJjb21wb3NlZDIiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA1ODM4MTc4NSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9qc29uIiwidGltZUNyZWF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjE4LjM3OVoiLCJ1cGRhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDoxOC4zNzlaIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJ0aW1lU3RvcmFnZUNsYXNzVXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6MTguMzc5WiIsInNpemUiOiI0OCIsIm1lZGlhTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL2Rvd25sb2FkL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jb21wb3NlZDI/Z2VuZXJhdGlvbj0xNTM4MDUxMDU4MzgxNzg1JmFsdD1tZWRpYSIsImNyYzMyYyI6ImJvQjhtdz09IiwiY29tcG9uZW50Q291bnQiOjMsImV0YWciOiJDTm5uN05lVzI5MENFQUU9In0=" + } + }, + { + "ID": "0139c847dd24ca22", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/composed2", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "43c359bcc9599df1fa41050f8c44953f/16730525860314595343;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/composed2" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "48" + ], + "Content-Type": [ + "text/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:18 GMT" + ], + "Etag": [ + "\"-CNnn7NeW290CEAE=\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:18 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:18 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Component-Count": [ + "3" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:18 GMT" + ], + "X-Goog-Generation": [ + "1538051058381785" + ], + "X-Goog-Hash": [ + "crc32c=boB8mw==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "48" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/27,/bns/xh/borg/xh/bns/blobstore2/bitpusher/1.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8susW7SaJfCoswa-l4W4Dw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/1.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/1:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpIx0vuK5NPFu7_CxRMZ61vPnJlQWjZ6ejYGdikaD8AawSgJJPLhcBGALUiFI3jv-gCL18r8Mig_JKoDCCxy0-LmuQ85A" + ] + }, + "Body": "G7YE7d4n0dy1PXohFJpUn8PZcNJccaSrouZ5qGqfKcNY+xSKoJ2Yh9xMlR8v8x6R" + } + }, + { + "ID": "8da163d5370e63a2", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=44415e54fcdbc755b78a8ae8f64c45c109d270e3315c08e5b5ab2a272972" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "bfc01e37d4ef5d0f121b282467264d29/17561619324262028127;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS00NDQxNWU1NGZjZGJjNzU1Yjc4YThhZThmNjRjNDVjMTA5ZDI3MGUzMzE1YzA4ZTViNWFiMmEyNzI5NzINCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNvbnRlbnRFbmNvZGluZyI6Imd6aXAiLCJuYW1lIjoiZ3ppcC10ZXN0In0KDQotLTQ0NDE1ZTU0ZmNkYmM3NTViNzhhOGFlOGY2NGM0NWMxMDlkMjcwZTMzMTVjMDhlNWI1YWIyYTI3Mjk3Mg0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi94LWd6aXANCg0KH4sIAAAAAAAA/2IgEgACAAD//7E97OkoAAAADQotLTQ0NDE1ZTU0ZmNkYmM3NTViNzhhOGFlOGY2NGM0NWMxMDlkMjcwZTMzMTVjMDhlNWI1YWIyYTI3Mjk3Mi0tDQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3320" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:19 GMT" + ], + "Etag": [ + "CND/mtiW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051358000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnb2:4089,/bns/yw/borg/yw/bns/blobstore2/bitpusher/224.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=8susW7LLL4-chASN_IugDw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/224.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/224:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYmxNeVZwMGdUN0o0YlgxVmMtQTlEaHc0eV9GbmdDSHlYYUt0U0VxRHJZV1RVWUxpYnBGRzJxTTlKYTdLNURwTk1hV0ZIaVFoc2tDN1pTaGhHSW53eHJWMHN2bnpGdGZnNmpMc2pjVFdLZU16eUs0c2RRNEo4S3pTMk9kSGxJYmZVVmZTd0pQQjVuRTRrYWxxVjRhbkF4eC1nRUxIU19pTU5nVFVGam5ZOFJTNlFwT2hGdHB6bHBGUG8wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoUbsWpAqL_JeVZbn_zAy2jD-kFzPJRAaxYSNgmnXwpw3SguayQhxx1ULy41CNY5eZP0vxXwt5U5vHHasuOQZLDq18GpA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9nemlwLXRlc3QvMTUzODA1MTA1OTEzODUxMiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL2d6aXAtdGVzdCIsIm5hbWUiOiJnemlwLXRlc3QiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA1OTEzODUxMiIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24veC1nemlwIiwidGltZUNyZWF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjE5LjEzOFoiLCJ1cGRhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDoxOS4xMzhaIiwic3RvcmFnZUNsYXNzIjoiU1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NDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Imd6aXAtdGVzdCIsImdlbmVyYXRpb24iOiIxNTM4MDUxMDU5MTM4NTEyIiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ05EL210aVcyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiI5RGh3QkE9PSIsImV0YWciOiJDTkQvbXRpVzI5MENFQUU9In0=" + } + }, + { + "ID": "3b90c911e5184c72", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/gzip-test", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8dcb355604083d45976f1b6230e58bae/705568625301502205;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/gzip-test" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "none" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Type": [ + "application/x-gzip" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:19 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:19 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:19 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Accept-Encoding" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:19 GMT" + ], + "X-Goog-Generation": [ + "1538051059138512" + ], + "X-Goog-Hash": [ + "crc32c=9DhwBA==", + "md5=OtCw+aRRIRqKGFAEOax+qw==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "gzip" + ], + "X-Goog-Stored-Content-Length": [ + "27" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/33,/bns/xh/borg/xh/bns/blobstore2/bitpusher/32.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=88usW9nbFseoswbavqfIAQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/32.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Body-Transformations": [ + "gunzipped,chunked" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/32:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrqJq-PaCwRos5X_sDmM2fxtLX2i9NL56DXNhSP4KJAtDQpYHyiYPTEtmGOC2Qwvj0qlphWquvmwpMQiznCoS7DuYCYKA" + ] + }, + "Body": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" + } + }, + { + "ID": "68d9c7cc86eac452", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj-not-exists", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "452523ae4fe3e75b632b9c7aca76ddab/2295979429857025692;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/obj-not-exists" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "225" + ], + "Content-Type": [ + "application/xml; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:19 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:19 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/43,/bns/xh/borg/xh/bns/blobstore2/bitpusher/20.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=88usW5S8HMesswbQ_qAo" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/20.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/20:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur0o8XTl6cwQYgCGmxXT4871JIv-OvohYl-kWfphF7WUjyN0lnJFPDbq3EcGXMmlMZAkD3NsbPQ5enswas8sWhAD_pw8Q" + ] + }, + "Body": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48RXJyb3I+PENvZGU+Tm9TdWNoS2V5PC9Db2RlPjxNZXNzYWdlPlRoZSBzcGVjaWZpZWQga2V5IGRvZXMgbm90IGV4aXN0LjwvTWVzc2FnZT48RGV0YWlscz5ObyBzdWNoIG9iamVjdDogZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL29iai1ub3QtZXhpc3RzPC9EZXRhaWxzPjwvRXJyb3I+" + } + }, + { + "ID": "3b10b1db50d2db0b", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=1442371c68bf0f93dba7b4d3265c434f493a6e71f9331861397c4d652891" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "148ee3c75f4f071e711419694ce354a8/3055016399295000811;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0xNDQyMzcxYzY4YmYwZjkzZGJhN2I0ZDMyNjVjNDM0ZjQ5M2E2ZTcxZjkzMzE4NjEzOTdjNGQ2NTI4OTENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJzaWduZWRVUkwifQoNCi0tMTQ0MjM3MWM2OGJmMGY5M2RiYTdiNGQzMjY1YzQzNGY0OTNhNmU3MWY5MzMxODYxMzk3YzRkNjUyODkxDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NCg0KVGhpcyBpcyBhIHRlc3Qgb2YgU2lnbmVkVVJMLgoNCi0tMTQ0MjM3MWM2OGJmMGY5M2RiYTdiNGQzMjY1YzQzNGY0OTNhNmU3MWY5MzMxODYxMzk3YzRkNjUyODkxLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3323" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:20 GMT" + ], + "Etag": [ + "CMS019iW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051359000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlh9:4090,/bns/yw/borg/yw/bns/blobstore2/bitpusher/202.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=88usW5ejMdjmhATG4KKIBA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/202.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/202:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYlVHbHo5aEdpZEl3eXlKS0N0RXMyRVBVdWRfaVJncG1hTkFvQmlGVmNzQ3B2dnNuRFZfTlc0aWF2YmtHTURVWW9QZHE5UThXRlNQbWZ5YzFlZUtmTnNmV3d2Q2J4R3RoS2FaWm5NUzdBMmdJM0FydU5tbHhTLXAwY2lOdzdwdTFXRkg3TnhSYmowUThZQ3FrcERoU0RIUkMyYllobWhoZXlKaEhEUk5GNkJyT2hHOFRaTm81QUlvbFUwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqjnuu0O7kv5rFkyxOHMrOB8DkSNtM4n6d1jpNnSmIIVL7XXmSRa78auaiUOyo4-qafkT3xdqmKEFjGLwSp8TgycKb0dw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9zaWduZWRVUkwvMTUzODA1MTA2MDEyODMyNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cu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U9In0=" + } + }, + { + "ID": "23beecdc4886db0d", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e45c86a08dfdca44f43e256839e02da6/4645428303345374858;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "119" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:22 GMT" + ], + "Etag": [ + "CAY=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051361000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjk75:4456,/bns/yv/borg/yv/bns/blobstore2/bitpusher/268.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=9cusW8i_BtKeggS9oqBY" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/268.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/268:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq3lv20s_T1WTNLRb4NTrmOZgRAwMwC72Ie5cc_1yk34PGxL_K-AylFLpjvdcIKkq9QNwiDcsKH9lrb8KnFfeYict3K5w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoiZG9tYWluLWdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZG9tYWluIjoiZ29vZ2xlLmNvbSIsImV0YWciOiJDQVk9In0=" + } + }, + { + "ID": "8087b8417cc402c5", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/defaultObjectAcl?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3e3d9d350b89e4de9e2dc4a451e4be0b/6235558732435946280;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/defaultObjectAcl?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "678" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:22 GMT" + ], + "Etag": [ + "CAY=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:22 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051361000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vryy5:4338,/bns/yv/borg/yv/bns/blobstore2/bitpusher/360.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=9susW6HtI5fJgASEx7egAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/360.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/360:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UozGaSoDn-YihIPaUMVTDXgWpSz9PKEcpp3TLb1cFU6g8v8A1cOtx7L8qLF1aB2Z15qRD89do749K8f9Sx22l_Pydij6Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoib3duZXJzIn0sImV0YWciOiJDQVk9In0seyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC1lZGl0b3JzLTM2NjM5OTMzMTQ1Iiwicm9sZSI6Ik9XTkVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6ImVkaXRvcnMifSwiZXRhZyI6IkNBWT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LXZpZXdlcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiUkVBREVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6InZpZXdlcnMifSwiZXRhZyI6IkNBWT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNBWT0ifV19" + } + }, + { + "ID": "634c2d25d926440d", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=3ddfe24a6384ff14089cd949180c2222a1402c31668eda555039fa69e9bf" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e2548d029256a26c6b18f6073fe21adf/6994877172538822264;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0zZGRmZTI0YTYzODRmZjE0MDg5Y2Q5NDkxODBjMjIyMmExNDAyYzMxNjY4ZWRhNTU1MDM5ZmE2OWU5YmYNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiJhY2wxIn0KDQotLTNkZGZlMjRhNjM4NGZmMTQwODljZDk0OTE4MGMyMjIyYTE0MDJjMzE2NjhlZGE1NTUwMzlmYTY5ZTliZg0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0NCg0KR8dXiQCBOn5esIR367SwUA0KLS0zZGRmZTI0YTYzODRmZjE0MDg5Y2Q5NDkxODBjMjIyMmExNDAyYzMxNjY4ZWRhNTU1MDM5ZmE2OWU5YmYtLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3724" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:23 GMT" + ], + "Etag": [ + "CNXmlNqW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051362000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbv14:4486,/bns/yv/borg/yv/bns/blobstore2/bitpusher/176.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=9susW6n9N4GjgATktYzACw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/176.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/176:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpxBKcmuCe-OuHfbZcZvw2Kdf8HCiIhoicR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TE4NjM2NDAtMDAwMS9vL2FjbDEvYWNsL3VzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJvYmplY3QiOiJhY2wxIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNjMyMzEzMTciLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDTlhtbE5xVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IjViL2ltZz09IiwiZXRhZyI6IkNOWG1sTnFXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "7d274cd0b9fb4e9e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=c110552d9287f2e64b941bf461feade0f6f61300ba49538ce5357cfffdb7" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "cf1e26c269814cea3ac75b3510540c63/7825970636486320583;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1jMTEwNTUyZDkyODdmMmU2NGI5NDFiZjQ2MWZlYWRlMGY2ZjYxMzAwYmE0OTUzOGNlNTM1N2NmZmZkYjcNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiJhY2wyIn0KDQotLWMxMTA1NTJkOTI4N2YyZTY0Yjk0MWJmNDYxZmVhZGUwZjZmNjEzMDBiYTQ5NTM4Y2U1MzU3Y2ZmZmRiNw0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0NCg0KYU6zehRNzcF55tSq9gS0EA0KLS1jMTEwNTUyZDkyODdmMmU2NGI5NDFiZjQ2MWZlYWRlMGY2ZjYxMzAwYmE0OTUzOGNlNTM1N2NmZmZkYjctLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3724" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:24 GMT" + ], + "Etag": [ + "CIvhwNqW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051363000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjo80:4463,/bns/yv/borg/yv/bns/blobstore2/bitpusher/227.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=98usW4bHHMTDswat-Z-oBg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/227.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/227:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up8vhQLTWrrLCJUmodPR52LzVY3pyY11BUbmWjHUWFWwG_PE_9vZUSZpSouGDBDWbFRxivAE0aMqb9hA38xDT0xE_6sSg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9hY2wyLzE1MzgwNTEwNjM5NTE0OTkiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9hY2wyIiwibmFtZSI6ImFjbDIiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA2Mzk1MTQ5OSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtIiwidGltZUN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25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Illkcmp4Zz09IiwiZXRhZyI6IkNJdmh3TnFXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "a7899fab4dae114e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/acl1/acl?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c8c8a1cb5d5b081bd731d3092162697c/9416381441058621030;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/acl1/acl?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2839" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:24 GMT" + ], + "Etag": [ + "CNXmlNqW290CEAE=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:24 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051364000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnlk21:4416,/bns/yx/borg/yx/bns/blobstore2/bitpusher/170.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=-MusW-KiC4TEzALh36GYDg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/170.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/170:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpFRiGkVMXwsRyEVHcvreKGdfu1e4GRGxDKzqQzqicudPyGfU1oNimPJublOVcvpSMPGbFW3PG3R_cChKGjcMDAka_o6-u5l8M_0QCRcCL5jrK7YPE" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvYWNsMS8xNTM4MDUxMDYzMjMxMzE3L3Byb2plY3Qtb3duZXJzLTM2NjM5OTMzMTQ1Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vYWNsMS9hY2wvcHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJvYmplY3QiOiJhY2wxIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNjMyMzEzMTciLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNOWG1sTnFXMjkwQ0VBRT0ifSx7ImtpbmQiOiJzdG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2MzA5MTE4NjM2NDAtMDAwMS9hY2wxLzE1MzgwNTEwNjMyMzEzMTcvdXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL2FjbDEvYWNsL3VzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJvYmplY3QiOiJhY2wxIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNjMyMzEzMTciLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDTlhtbE5xVzI5MENFQUU9In1dfQ==" + } + }, + { + "ID": "71bd060a33809794", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/acl1/acl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "40eb07e858b191346b807395316f863c/11006793340814158852;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/acl1/acl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:24 GMT" + ], + "Etag": [ + "CNXmlNqW290CEAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051361000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrkq2:4275,/bns/yv/borg/yv/bns/blobstore2/bitpusher/66.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=-MusW9feEYutgATw86vwBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/66.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/66:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpWcAHikAmqOg613kF4GLJiEtCXxxIqN3tffPAx8FWSaOAq_FpvPloU22Ug_XvB_KhhecqbFCXQB6pcuta5ItyeOmLNeg" + ] + }, + "Body": "" + } + }, + { + "ID": "c8ad252a6aa45862", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "be850e2dc6a30f10d7d84d57edf55b35/12596923774199566755;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:26 GMT" + ], + "Etag": [ + "CAc=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051361000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrub8:4298,/bns/yr/borg/yr/bns/blobstore2/bitpusher/74.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=-MusW-uRKtC64QSEt534Cw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/74.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/74:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpSjnNG8skCQpRLGO9ra7v9LGpcH7MJ7zZvV2z1z7mtvPZnVOI_c_4hoHzqBZK4BKOYIXZv29JlLxle7OIksM783IQ7xQ" + ] + }, + "Body": "" + } + }, + { + "ID": "ae6f08a80bb80c90", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/acl/user-jbd%40google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "109" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2c258adc583f7fd54fabdbd920701d4d/14187335678249940802;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/acl/user-jbd%40google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJlbnRpdHkiOiJ1c2VyLWpiZEBnb29nbGUuY29tIiwicm9sZSI6IlJFQURFUiJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "386" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:27 GMT" + ], + "Etag": [ + "CAg=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051364000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vneu135:4203,/bns/yx/borg/yx/bns/blobstore2/bitpusher/117.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=-susW9jWCsW4zALG9Lq4BQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/117.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/117:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqTGiHMpN75V5boQOPvlbb2tLzUDUklf0wZc3HxAlGV7OG9Ugvl6ubQcDvmN80QOLwaKd4b_iV8jP3oLXAQRaTr13Q-hA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvdXNlci1qYmRAZ29vZ2xlLmNvbSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9hY2wvdXNlci1qYmRAZ29vZ2xlLmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImVudGl0eSI6InVzZXItamJkQGdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZW1haWwiOiJqYmRAZ29vZ2xlLmNvbSIsImV0YWciOiJDQWc9In0=" + } + }, + { + "ID": "dc66ea5c887df293", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/acl?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7e111448e87fe73618a269734d491d61/15777747582317157600;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/acl?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "1777" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:27 GMT" + ], + "Etag": [ + "CAg=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:27 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051364000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnhp2:4092,/bns/yx/borg/yx/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=-8usW62lKI-IzgKe0Y_gAg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/50:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrflKaiPlva3DQV4NWxxnOa2hfduPuphSMtQD2OmKfWIDBhU1BPZpFeTcuNqMIOVwsC-M9G3R5XRryG0CapLuunYg3wng" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvcHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwa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d63252", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/acl/user-jbd%40google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7824d8a22901b6dc78f094369cee52a4/17295820417369735807;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/acl/user-jbd%40google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:29 GMT" + ], + "Etag": [ + "CAk=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051361000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlh82:4312,/bns/yv/borg/yv/bns/blobstore2/bitpusher/293.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=_MusW-ubAYrHggTf2qigAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/293.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/293:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWW5wTmtlLU9kVkRTVDlqMDhzYkVvZ2hLYjlqRzhpWDJuQm5JM01lY1Z4VHg3Nnl6Z3lXb3hkeTZQNk43bDc3WlFuNmVUUm5mcnpKX1VUNEpvV05pcmpXTGxCT2gteHBPQVFpMTQ3NnU5ak9IZEVNVElfSTVrQzJQV2tBcUxmWXpDVjIwN041aXgweGItdW1NQkJKN1ExUFdFSEtyNE1pS3JZTjhteWdELUVxRjVDS2w2eTl5NjFTZ0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq_n1FZwk3gYg6nAGXjBoIOUouelYbfFQqmodyBNo_ulBDapPpDibBCuyMxYoXTJP2tEN-TdzDpGLiZwNbDloq2veRMyg" + ] + }, + "Body": "" + } + }, + { + "ID": "eac7250806cf8014", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=c6748b629d4eae76c06554d06fdeedfb8a51d443f380a3b048fd306bb5f0" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fed836e58a3445cb457b56c538559402/18127195351998977486;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1jNjc0OGI2MjlkNGVhZTc2YzA2NTU0ZDA2ZmRlZWRmYjhhNTFkNDQzZjM4MGEzYjA0OGZkMzA2YmI1ZjANCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiJnb3BoZXIifQoNCi0tYzY3NDhiNjI5ZDRlYWU3NmMwNjU1NGQwNmZkZWVkZmI4YTUxZDQ0M2YzODBhM2IwNDhmZDMwNmJiNWYwDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KZGF0YQ0KLS1jNjc0OGI2MjlkNGVhZTc2YzA2NTU0ZDA2ZmRlZWRmYjhhNTFkNDQzZjM4MGEzYjA0OGZkMzA2YmI1ZjAtLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3289" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:29 GMT" + ], + "Etag": [ + "CMDsot2W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlh82:4312,/bns/yw/borg/yw/bns/blobstore2/bitpusher/85.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=_cusW8DTG8j0hQSdnoHgBg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/85.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/85:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uodf8xTcx7etvqc3f4RRRu3WMp7IuuKJts9MRsx9NWjdzStcROpLMOWPCAEtzxu7s5M0DASp3Ci_Oo8NlRpnqCFkPOtIQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9nb3BoZXIvMTUzODA1MTA2OTc1Mjg5NiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5j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googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=f04625b0d2c2814594fbfad64c8c764f2a0494d870f89d82505f7f18263e" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7196054bc52c5e48e243ecf0a0692ab4/439769722704045854;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1mMDQ2MjViMGQyYzI4MTQ1OTRmYmZhZDY0YzhjNzY0ZjJhMDQ5NGQ4NzBmODlkODI1MDVmN2YxODI2M2UNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiLQk9C+0YTQtdGA0L7QstC4In0KDQotLWYwNDYyNWIwZDJjMjgxNDU5NGZiZmFkNjRjOGM3NjRmMmEwNDk0ZDg3MGY4OWQ4MjUwNWY3ZjE4MjYzZQ0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCmRhdGENCi0tZjA0NjI1YjBkMmMyODE0NTk0ZmJmYWQ2NGM4Yzc2NGYyYTA0OTRkODcwZjg5ZDgyNTA1ZjdmMTgyNjNlLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3641" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:30 GMT" + ], + "Etag": [ + "CJWewd2W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbj128:4260,/bns/yv/borg/yv/bns/blobstore2/bitpusher/243.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=_cusW6G9OoGngASMt5uwAw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/243.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/243:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoymSoCfGxXc7APKQXbmtsRQ5lzh2kvwdBa2Vk-i19BsKrjJdAKre3OMjddfdx92y6qJM6ifd_otz5K-1VT5fbVgGVktA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS/Qk9C+0YTQtdGA0L7QstC4LzE1MzgwNTEwNzAyNTA3NzMiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLT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zk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ0pXZXdkMlcyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJydGg5MFE9PSIsImV0YWciOiJDSldld2QyVzI5MENFQUU9In0=" + } + }, + { + "ID": "9b6f1ab259dce928", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=5b1027ba28d1f511cf08fc457ba061ff4b2b59813cc7f9ec4cee9e9f594f" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9ab324a2eab6d04c2e87770ac63723b7/1270863186651544173;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS01YjEwMjdiYTI4ZDFmNTExY2YwOGZjNDU3YmEwNjFmZjRiMmI1OTgxM2NjN2Y5ZWM0Y2VlOWU5ZjU5NGYNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiJhIn0KDQotLTViMTAyN2JhMjhkMWY1MTFjZjA4ZmM0NTdiYTA2MWZmNGIyYjU5ODEzY2M3ZjllYzRjZWU5ZTlmNTk0Zg0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCmRhdGENCi0tNWIxMDI3YmEyOGQxZjUxMWNmMDhmYzQ1N2JhMDYxZmY0YjJiNTk4MTNjYzdmOWVjNGNlZTllOWY1OTRmLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3209" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:31 GMT" + ], + "Etag": [ + "CIDy6t2W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051370000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vncw67:4172,/bns/yx/borg/yx/bns/blobstore2/bitpusher/105.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=_susW5zyHYbjzAKq95zACQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/105.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/105:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo0atLVtSxYUq5rmg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rbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJydGg5MFE9PSIsImV0YWciOiJDSUR5NnQyVzI5MENFQUU9In0=" + } + }, + { + "ID": "56e95f3da4f5347b", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=0798d81003f7bb4b09cf4ac08a194cf5f0d0f6a9a00f2deda8bd5d67fbe5" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f590d185300c39d7a14ebc4e9eb2d352/2030181626754485692;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0wNzk4ZDgxMDAzZjdiYjRiMDljZjRhYzA4YTE5NGNmNWYwZDBmNmE5YTAwZjJkZWRhOGJkNWQ2N2ZiZTUNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiJhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF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hYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhIn0KDQotLTA3OThkODEwMDNmN2JiNGIwOWNmNGFjMDhhMTk0Y2Y1ZjBkMGY2YTlhMDBmMmRlZGE4YmQ1ZDY3ZmJlNQ0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCmRhdGENCi0tMDc5OGQ4MTAwM2Y3YmI0YjA5Y2Y0YWMwOGExOTRjZjVmMGQwZjZhOWEwMGYyZGVkYThiZDVkNjdmYmU1LS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "19577" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:31 GMT" + ], + "Etag": [ + "CKaqkN6W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrda18:4093,/bns/yv/borg/yv/bns/blobstore2/bitpusher/135.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=_8usW-OlBoiRNq7qqOgL" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/135.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/135:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqitVkCUeUSJ0G4bi61MMByLVbIbbL-Xbw8R9bTZw4DcXcbckZu_ElUFTC7Up_z7JML2BBtH7edDzXjDj6yKygUj3t_3w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9hYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh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WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYSIsImdlbmVyYXRpb24iOiIxNTM4MDUxMDcxNTQ2NjYyIiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ0thcWtONlcyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJydGg5MFE9PSIsImV0YWciOiJDS2Fxa042VzI5MENFQUU9In0=" + } + }, + { + "ID": "50a6fa719716e926", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=0f0345a33370001633096093c9ee25e720b209d560d3c5ec8e17c6144f51" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d767ee61a2940cecbb7f6b2d1bc29950/2861275086423793420;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0wZjAzNDVhMzMzNzAwMDE2MzMwOTYwOTNjOWVlMjVlNzIwYjIwOWQ1NjBkM2M1ZWM4ZTE3YzYxNDRmNTENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCJ9Cg0KLS0wZjAzNDVhMzMzNzAwMDE2MzMwOTYwOTNjOWVlMjVlNzIwYjIwOWQ1NjBkM2M1ZWM4ZTE3YzYxNDRmNTENCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA0KDQpkYXRhDQotLTBmMDM0NWEzMzM3MDAwMTYzMzA5NjA5M2M5ZWUyNWU3MjBiMjA5ZDU2MGQzYzVlYzhlMTdjNjE0NGY1MS0tDQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "2904" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:31 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrt3:4124,/bns/yr/borg/yr/bns/blobstore2/bitpusher/83.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=_8usW5bEKszg4QTBwYGIAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/83.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/83:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "agent_r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1bkluQ29udGV4dChDb21tb25Nb2R1bGUuamF2YTo4NDYpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUkMS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDYyKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuQ3VycmVudENvbnRleHQucnVuSW5Db250ZXh0KEN1cnJlbnRDb250ZXh0LmphdmE6MzIwKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwMCwibWVzc2FnZSI6IlJlcXVpcmVkIn19" + } + }, + { + "ID": "0ae9542b9ce49562", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=bcdca74de9a098617ef24a96ac27659fd795f59257d9d3c5216fc1ead110" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9cb312c9ed3dcb4d3eb2dfd968e32e2e/3620593526526734939;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1iY2RjYTc0ZGU5YTA5ODYxN2VmMjRhOTZhYzI3NjU5ZmQ3OTVmNTkyNTdkOWQzYzUyMTZmYzFlYWQxMTANCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiJhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW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YTc0ZGU5YTA5ODYxN2VmMjRhOTZhYzI3NjU5ZmQ3OTVmNTkyNTdkOWQzYzUyMTZmYzFlYWQxMTANCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA0KDQpkYXRhDQotLWJjZGNhNzRkZTlhMDk4NjE3ZWYyNGE5NmFjMjc2NTlmZDc5NWY1OTI1N2Q5ZDNjNTIxNmZjMWVhZDExMC0tDQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "4741" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:31 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrhl7:4484,/bns/yr/borg/yr/bns/blobstore2/bitpusher/103.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=_8usW6jXLcbo4QTkprCgCA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/103.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/103:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrwiJOmyTbYn2nlEF1jPhSu_VazrdoOwJr2lCIC0mrJbSxlG2HMan9jQZe_-TpkuFPxrsS_ZN7W54ZgE9cQNrDjgeESBw" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImludmFsaWQiLCJtZXNzYWdlIjoiVGhlIG1heGltdW0gb2JqZWN0IGxlbmd0aCBpcyAxMDI0IGNoYXJhY3RlcnMsIGJ1dCBnb3QgYSBuYW1lIHdpdGggMTAyNSBjaGFyYWN0ZXJzOiAnJ2FhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW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sZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dE5vVW5yZWYoVHJhY2VDb250ZXh0LmphdmE6MzIxKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJUaGUgbWF4aW11bSBvYmplY3QgbGVuZ3RoIGlzIDEwMjQgY2hhcmFjdGVycywgYnV0IGdvdCBhIG5hbWUgd2l0aCAxMDI1IGNoYXJhY3RlcnM6ICcnYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEuLi4nJyJ9fQ==" + } + }, + { + "ID": "1f03f6aec789f628", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=190e7ca1112dfae89a1cc94346bd93ebccf5adb1d3ed48a35941130b41ef" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1c95398a95c726e69ab68d3262faba63/4451686990474233258;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0xOTBlN2NhMTExMmRmYWU4OWExY2M5NDM0NmJkOTNlYmNjZjVhZGIxZDNlZDQ4YTM1OTQxMTMwYjQxZWYNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiJuZXdcbmxpbmVzIn0KDQotLTE5MGU3Y2ExMTEyZGZhZTg5YTFjYzk0MzQ2YmQ5M2ViY2NmNWFkYjFkM2VkNDhhMzU5NDExMzBiNDFlZg0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCmRhdGENCi0tMTkwZTdjYTExMTJkZmFlODlhMWNjOTQzNDZiZDkzZWJjY2Y1YWRiMWQzZWQ0OGEzNTk0MTEzMGI0MWVmLS0NCg==" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "3226" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:31 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrwe17:4005,/bns/yw/borg/yw/bns/blobstore2/bitpusher/148.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=_8usW5H7MIfzhASA9r_IDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/148.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/148:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoAw4fjAOMtenHDXGbbkruczcQ5b8dIlEWdgiUXDyk4sWlmuMwgGtMVolvIBmrtajzJFtIYHNLBbIUWsXruMmnk2Hlwpw" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImludmFsaWQiLCJtZXNzYWdlIjoiRGlzYWxsb3dlZCB1bmljb2RlIGNoYXJhY3RlcnMgcHJlc2VudCBpbiBvYmplY3QgbmFtZSAnJ25ld1xubGluZXMnJyIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUuYXBpLnNlcnZlci5jb3JlLkZhdWx0OiBJbW11dGFibGVFcnJvckRlZmluaXRpb257YmFzZT1JTlZBTElEX1ZBTFVFLCBjYXRlZ29yeT1VU0VSX0VSUk9SLCBjYXVzZT1udWxsLCBkZWJ1Z0luZm89bnVsbCwgZG9tYWluPWdsb2JhbCwgZXh0ZW5kZWRIZWxwPW51bGwsIGh0dHBIZWFkZXJzPXt9LCBodHRwU3RhdHVzPWJhZFJlcXVlc3QsIGludGVybmFsUmVhc29uPVJlYXNvbnthcmd1bWVudHM9e30sIGNhdXNlPW51bGwsIGNvZGU9Z2RhdGEuQ29yZUVycm9yRG9tYWluLklOVkFMSURfVkFMVUUsIGNyZWF0ZWRCeUJhY2tlbmQ9dHJ1ZSwgZGVidWdNZXNzYWdlPW51bGwsIGVycm9yUHJvdG9Db2R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RleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAwLCJtZXNzYWdlIjoiRGlzYWxsb3dlZCB1bmljb2RlIGNoYXJhY3RlcnMgcHJlc2VudCBpbiBvYmplY3QgbmFtZSAnJ25ld1xubGluZXMnJyJ9fQ==" + } + }, + { + "ID": "77888c98dd46c50f", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6a67c18da7762883b55d939f73d65794/5210723959895365882;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:32 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnx7:4114,/bns/yw/borg/yw/bns/blobstore2/bitpusher/219.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=_8usW97SM5LfhASR57fgCA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/219.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/219:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoMc9F9yE2HeDdmEyOjq_-pQVZkOPldnsVVz6TZ3F8Mzo0k_Pw5pjoQds9zzYbTnyrARRx-JKmlMCz2Ct6Zxuk-XTwiog" + ] + }, + "Body": "" + } + }, + { + "ID": "1e9c96c18d261238", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/a?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2ffd36f41fda2e22f7b334d1571d73db/6042098894541384265;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/a?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:32 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrgm187:4292,/bns/yr/borg/yr/bns/blobstore2/bitpusher/53.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AMysW97oE8X4kAOu3LKIDg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/53.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/53:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq_TALy4oWt6x7_UhdJcTrDd-XeBpQCTuE_VL6gZAVdlJrsyEVmfzEimkElArzI936P6aIYOGxvtUg1KAvmtRwrd1DkFA" + ] + }, + "Body": "" + } + }, + { + "ID": "ee39c82f0126f7df", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/%D0%93%D0%BE%D1%84%D0%B5%D1%80%D0%BE%D0%B2%D0%B8?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f17bd9206bec1c206ae08560a1123fc7/6801134764467731864;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/%D0%93%D0%BE%D1%84%D0%B5%D1%80%D0%BE%D0%B2%D0%B8?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:32 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrtj9:4196,/bns/yr/borg/yr/bns/blobstore2/bitpusher/71.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AMysW8PRJ4_k4QTxpY3ICg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/71.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/71:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpcuhQp3DVIylZVBiYUzlifqq6BCn60_Q9aODaQvOV57lTYDXmbWGOQWx6g7oXxCQSixgDxuXhWjEsD2NWOQrGVjiKbrA" + ] + }, + "Body": "" + } + }, + { + "ID": "7b050c6c970e744f", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/gopher?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4e3ba0b43bf75c16b32d162fa5dc35ff/7632228228415164648;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/gopher?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:33 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051369000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrvr22:4007,/bns/yr/borg/yr/bns/blobstore2/bitpusher/100.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AMysW43oOc3WkAPE_IHQBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/100.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/100:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYWpXSE1RZzgtWC1YcW42akZrMFVnT1pjQ2Rvc2J1RUtOdTFmNUpqa2xzSm0xUHllZVo1SEJlMG90M2RIanQ4V3RuaVVQNVNWR1JZOHd3eHhrUG5xV0ZOZkVnYl9YOWNNWUZuZ1R6bGhMQ05wZlZjM2ozYWZqQTgxM0VFSDVVeDlOdnRTalZyb1F4aFF0dW1SMTF5bVB0N0lLYjE3Q01LLVhtcVFtVVRlWWVkYTVsdkptOVR0R29RdjQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo8308ofp3thGvMbSzyEx7nd1KdasYsdKvP0E4v7TM_frJ4pKcQm6YU2wFVXsdXCn4X2Na4TrqZS-l9SB5jhAxZpl4c4A" + ] + }, + "Body": "" + } + }, + { + "ID": "f24404f9531c7e01", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=79457bd469f23815a10c54bd62cf8a97d11ef0e4f79358930776cd29e128" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c98f2d57e237dd67a4cceceb3b4423a9/8391546664223204151;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS03OTQ1N2JkNDY5ZjIzODE1YTEwYzU0YmQ2MmNmOGE5N2QxMWVmMGU0Zjc5MzU4OTMwNzc2Y2QyOWUxMjgNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiJjb250ZW50In0KDQotLTc5NDU3YmQ0NjlmMjM4MTVhMTBjNTRiZDYyY2Y4YTk3ZDExZWYwZTRmNzkzNTg5MzA3NzZjZDI5ZTEyOA0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCkl0IHdhcyB0aGUgYmVzdCBvZiB0aW1lcywgaXQgd2FzIHRoZSB3b3JzdCBvZiB0aW1lcy4NCi0tNzk0NTdiZDQ2OWYyMzgxNWExMGM1NGJkNjJjZjhhOTdkMTFlZjBlNGY3OTM1ODkzMDc3NmNkMjllMTI4LS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3306" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:33 GMT" + ], + "Etag": [ + "COOykd+W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051373000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrl7:4233,/bns/yr/borg/yr/bns/blobstore2/bitpusher/69.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AcysW7zkFMzx4QSiqbCQCw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/69.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/69:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWTdKaTNpQUtFYXBEb2hLZmRaV2FzVEpZLWRqMW43X1dRLUlwOGVYZ0cxOE93NE5IYkEwUHZlX0paQnd6b0pUNE9JRUYwcjVzM01Fa1ZQbHpvSnpXT1VOOUtsQV9OSENJcDl4QlRucmgtYU4wcDhuYkxwOTI2SHdRY0ZWRGQtMVBIclZQUVhZck9pQ3o1WUI1bkw4UjZpNWFJb3NHTUl4Qk4xV1ZUOWlCZW5malJ1TTF5SkUyQ2VTMDAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur4QwSCgclPX6trpMIhT0vdtpmHrRu46ea8c1Ic6bXrHSLHx81tT13NQ4Pp0hdYA8XatyZAwmgUb4WFY3qyapXMVLO_1w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb250ZW50LzE1MzgwNTEwNzM2NjEyODMiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jb250ZW50IiwibmFtZSI6ImNvbnRlbnQiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgw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50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vY29udGVudC9hY2wvdXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6ImNvbnRlbnQiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA3MzY2MTI4MyIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNPT3lrZCtXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiRmNYTThRPT0iLCJldGFnIjoiQ09PeWtkK1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "e9d49ef6cb2edd09", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3bff2347d8fb90f52b03b63484c816c2/9981677097608612054;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3306" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:33 GMT" + ], + "Etag": [ + "COOykd+W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051373000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrv5:4481,/bns/yv/borg/yv/bns/blobstore2/bitpusher/182.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AcysW4SxL9WFgQSM1K-oDQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/182.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/182:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWTdKaTNpQUtFYXBEb2hLZmRaV2FzVEpZLWRqMW43X1dRLUlwOGVYZ0cxOE93NE5IYkEwUHZlX0paQnd6b0pUNE9JRUYwcjVzM01Fa1ZQbHpvSnpXT1VOOUtsQV9OSENJcDl4QlRucmgtYU4wcDhuYkxwOTI2SHdRY0ZWRGQtMVBIclZQUVhZck9pQ3o1WUI1bkw4UjZpNWFJb3NHTUl4Qk4xV1ZUOWlCZW5malJ1TTF5SkUyQ2VTMDAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpKyKaISEWquueFV4lfr3BrKEbt91VU2X2w7V9LAq9yelzjZBmz-oC-cQzyVvn0C0eLYGwXBVxtpNEKR4av7BY4G2BRfZAfM10r9K-cVmNkKBG3gZo" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtM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oiRmNYTThRPT0iLCJldGFnIjoiQ09PeWtkK1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "151fc10cc5fad9fd", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=988437801ee1a9246232838eec36a9a90e52a9a42f54ffe7c8b6e41a5972" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fcd3d5168b79bde9c2fce272a552a779/10740995537711553317;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS05ODg0Mzc4MDFlZTFhOTI0NjIzMjgzOGVlYzM2YTlhOTBlNTJhOWE0MmY1NGZmZTdjOGI2ZTQxYTU5NzINCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsIm5hbWUiOiJjb250ZW50In0KDQotLTk4ODQzNzgwMWVlMWE5MjQ2MjMyODM4ZWVjMzZhOWE5MGU1MmE5YTQyZjU0ZmZlN2M4YjZlNDFhNTk3Mg0KQ29udGVudC1UeXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTgNCg0KPGh0bWw+PGhlYWQ+PHRpdGxlPk15IGZpcnN0IHBhZ2U8L3RpdGxlPjwvaGVhZD48L2h0bWw+DQotLTk4ODQzNzgwMWVlMWE5MjQ2MjMyODM4ZWVjMzZhOWE5MGU1MmE5YTQyZjU0ZmZlN2M4YjZlNDFhNTk3Mi0tDQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3305" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:34 GMT" + ], + "Etag": [ + "CLLBtN+W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051373000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vraw6:4495,/bns/yr/borg/yr/bns/blobstore2/bitpusher/99.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AcysW9foNYi44QT15L5A" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/99.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/99:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWTdKaTNpQUtFYXBEb2hLZmRaV2FzVEpZLWRqMW43X1dRLUlwOGVYZ0cxOE93NE5IYkEwUHZlX0paQnd6b0pUNE9JRUYwcjVzM01Fa1ZQbHpvSnpXT1VOOUtsQV9OSENJcDl4QlRucmgtYU4wcDhuYkxwOTI2SHdRY0ZWRGQtMVBIclZQUVhZck9pQ3o1WUI1bkw4UjZpNWFJb3NHTUl4Qk4xV1ZUOWlCZW5malJ1TTF5SkUyQ2VTMDAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq0AeI4jGor5HSsfQM95EEyapL69zFATtcCRzvjOwNAcDuFOz94hOPLrpRQzUqLAGqS4q8DOEzE-xnP5WD64o-UkoR5bg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb250ZW50LzE1MzgwNTEwN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7a91c5fbf00267a1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f27bc1c9491d357a63da36391e4159dd/12331407441778704580;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3305" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:34 GMT" + ], + "Etag": [ + "CLLBtN+W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051373000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrat7:4174,/bns/yv/borg/yv/bns/blobstore2/bitpusher/129.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AsysW5bFFdP-gASw_pngAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/129.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/129:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWTdKaTNpQUtFYXBEb2hLZmRaV2FzVEpZLWRqMW43X1dRLUlwOGVYZ0cxOE93NE5IYkEwUHZlX0paQnd6b0pUNE9JRUYwcjVzM01Fa1ZQbHpvSnpXT1VOOUtsQV9OSENJcDl4QlRucmgtYU4wcDhuYkxwOTI2SHdRY0ZWRGQtMVBIclZQUVhZck9pQ3o1WUI1bkw4UjZpNWFJb3NHTUl4Qk4xV1ZUOWlCZW5malJ1TTF5SkUyQ2VTMDAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [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5jb20iLCJldGFnIjoiQ0xMQnROK1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJHb1Vic1E9PSIsImV0YWciOiJDTExCdE4rVzI5MENFQUU9In0=" + } + }, + { + "ID": "4c7ff4fe8be88426", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=2bc3dd5645f4717661991904c39270871075913fb3be34dd4fb00e9fb533" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "37b1664652a23037c645c3f3dfac05d5/13162500905726202643;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0yYmMzZGQ1NjQ1ZjQ3MTc2NjE5OTE5MDRjMzkyNzA4NzEwNzU5MTNmYjNiZTM0ZGQ0ZmIwMGU5ZmI1MzMNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9odG1sIiwibmFtZSI6ImNvbnRlbnQifQoNCi0tMmJjM2RkNTY0NWY0NzE3NjYxOTkxOTA0YzM5MjcwODcxMDc1OTEzZmIzYmUzNGRkNGZiMDBlOWZiNTMzDQpDb250ZW50LVR5cGU6IHRleHQvaHRtbA0KDQo8aHRtbD48aGVhZD48dGl0bGU+TXkgZmlyc3QgcGFnZTwvdGl0bGU+PC9oZWFkPjwvaHRtbD4NCi0tMmJjM2RkNTY0NWY0NzE3NjYxOTkxOTA0YzM5MjcwODcxMDc1OTEzZmIzYmUzNGRkNGZiMDBlOWZiNTMzLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3290" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:34 GMT" + ], + "Etag": [ + "CKia1N+W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051374000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnau137:4408,/bns/yx/borg/yx/bns/blobstore2/bitpusher/84.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AsysW-vzGcO1zALTr7lY" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/84.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/84:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWTdKaTNpQUtFYXBEb2hLZmRaV2FzVEpZLWRqMW43X1dRLUlwOGVYZ0cxOE93NE5IYkEwUHZlX0paQnd6b0pUNE9JRUYwcjVzM01Fa1ZQbHpvSnpXT1VOOUtsQV9OSENJcDl4QlRucmgtYU4wcDhuYkxwOTI2SHdRY0ZWRGQtMVBIclZQUVhZck9pQ3o1WUI1bkw4UjZpNWFJb3NHTUl4Qk4xV1ZUOWlCZW5malJ1TTF5SkUyQ2VTMDAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoNJgqctgeYS02cdv67cIAhN4zbfhd5Igx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ci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJHb1Vic1E9PSIsImV0YWciOiJDS2lhMU4rVzI5MENFQUU9In0=" + } + }, + { + "ID": "b6e9d9ae9b9ab978", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2a9df9fee84fe18940299e1e19b963f3/14752911705986890161;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3290" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:34 GMT" + ], + "Etag": [ + "CKia1N+W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051373000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnb2:4089,/bns/yv/borg/yv/bns/blobstore2/bitpusher/259.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AsysW9TQNsmngASFkp7wAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/259.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/259:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWTdKaTNpQUtFYXBEb2hLZmRaV2FzVEpZLWRqMW43X1dRLUlwOGVYZ0cxOE93NE5IYkEwUHZlX0paQnd6b0pUNE9JRUYwcjVzM01Fa1ZQbHpvSnpXT1VOOUtsQV9OSENJcDl4QlRucmgtYU4wcDhuYkxwOTI2SHdRY0ZWRGQtMVBIclZQUVhZck9pQ3o1WUI1bkw4UjZpNWFJb3NHTUl4Qk4xV1ZUOWlCZW5malJ1TTF5SkUyQ2VTMDAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo2QCAedXJWZRu0_FYQQyJ9LFvRMq2tC7QKpClrN37a6mnhCEudZtWqGhevEpEYba9YwKYwez8KFNv0vso_czdyYI0IRQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb250ZW50LzE1MzgwNTEwNzQ3NTU4ODAiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jb250ZW50IiwibmFtZSI6ImNvbnRlbnQiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA3NDc1NTg4MCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9odG1sIiwidGltZUNyZWF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjM0Ljc1NVoiLCJ1cGRhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDozNC43NTVaIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJ0aW1lU3RvcmFnZUNsYXNzVXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6MzQuNzU1WiIsInNpemUiOiI1NCIsIm1kNUhhc2giO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JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ0tpYTFOK1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJHb1Vic1E9PSIsImV0YWciOiJDS2lhMU4rVzI5MENFQUU9In0=" + } + }, + { + "ID": "7d1ddfc4a79aed5c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=51b79aa9dfea162830fbd443aaeec47fe3d21d207f16c34b06ad6efaba79" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "994ad2d293093b6ed73587008f24a071/15511948675424799489;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS01MWI3OWFhOWRmZWExNjI4MzBmYmQ0NDNhYWVlYzQ3ZmUzZDIxZDIwN2YxNmMzNGIwNmFkNmVmYWJhNzkNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoiaW1hZ2UvanBlZyIsIm5hbWUiOiJjb250ZW50In0KDQotLTUxYjc5YWE5ZGZlYTE2MjgzMGZiZDQ0M2FhZWVjNDdmZTNkMjFkMjA3ZjE2YzM0YjA2YWQ2ZWZhYmE3OQ0KQ29udGVudC1UeXBlOiBpbWFnZS9qcGVnDQoNCjxodG1sPjxoZWFkPjx0aXRsZT5NeSBmaXJzdCBwYWdlPC90aXRsZT48L2hlYWQ+PC9odG1sPg0KLS01MWI3OWFhOWRmZWExNjI4MzBmYmQ0NDNhYWVlYzQ3ZmUzZDIxZDIwN2YxNmMzNGIwNmFkNmVmYWJhNzktLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3291" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:35 GMT" + ], + "Etag": [ + "CIGg99+W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051373000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrmk5:4135,/bns/yr/borg/yr/bns/blobstore2/bitpusher/58.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=AsysW4yKPKyRkAS0ioHgCQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/58.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/58:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWTdKaTNpQUtFYXBEb2hLZmRaV2FzVEpZLWRqMW43X1dRLUlwOGVYZ0cxOE93NE5IYkEwUHZlX0paQnd6b0pUNE9JRUYwcjVzM01Fa1ZQbHpvSnpXT1VOOUtsQV9OSENJcDl4QlRucmgtYU4wcDhuYkxwOTI2SHdRY0ZWRGQtMVBIclZQUVhZck9pQ3o1WUI1bkw4UjZpNWFJb3NHTUl4Qk4xV1ZUOWlCZW5malJ1TTF5SkUyQ2VTMDAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up2B0gN0Tp-hZeNdZzqXr32fqBuXEdF_UfypqatMEY_Z8FElRH7MLrj1Q-6Li1qrYCd5lWBQDs0wz5FpqsHjBN_hytJyQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb250ZW50LzE1MzgwNTEwNzUzMzAwNDkiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jb250ZW50IiwibmFtZSI6ImNvbnRlbnQiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA3NTMzMDA0OSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoiaW1hZ2UvanBlZyIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDozNS4zMjlaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6MzUuMzI5WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjM1LjMyOVoiLCJzaXplIjoiNTQiLCJtZDVIYXNoIjoiTjhwOC9zOUZ3ZEFBbmx2ci9sRUFqUT09IiwibWVkaWFMaW5rIj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WNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJR2c5OStXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiR29VYnNRPT0iLCJldGFnIjoiQ0lHZzk5K1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "9b9ff11a993b6af6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c0c6e81b82b832c7e7354ea55a133407/17102360579475239327;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3291" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:35 GMT" + ], + "Etag": [ + "CIGg99+W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051373000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrb20:4129,/bns/yv/borg/yv/bns/blobstore2/bitpusher/82.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=A8ysW4nMHYOlgASf-Jco" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/82.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/82:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWTdKaTNpQUtFYXBEb2hLZmRaV2FzVEpZLWRqMW43X1dRLUlwOGVYZ0cxOE93NE5IYkEwUHZlX0paQnd6b0pUNE9JRUYwcjVzM01Fa1ZQbHpvSnpXT1VOOUtsQV9OSENJcDl4QlRucmgtYU4wcDhuYkxwOTI2SHdRY0ZWRGQtMVBIclZQUVhZck9pQ3o1WUI1bkw4UjZpNWFJb3NHTUl4Qk4xV1ZUOWlCZW5malJ1TTF5SkUyQ2VTMDAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urvkgc7dWXoce48Vak9OxsOqstuo9yJWf7VkQKIC7EoQ9ElFapB3F4vwy8RWd6rYlRY_A0lHq2d09QlQyMfn83kYVuG3A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jb250ZW50LzE1MzgwNTEwNzUzMzAwNDkiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jb250ZW50IiwibmFtZSI6ImNvbnRlbnQiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA3NTMzMDA0OSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoiaW1hZ2UvanBlZyIsInRpbWVDcmVhdGVkIjoiMjAxOC0w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2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6ImNvbnRlbnQiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA3NTMzMDA0OSIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJR2c5OStXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiR29VYnNRPT0iLCJldGFnIjoiQ0lHZzk5K1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "7915606f6c21576d", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=48c8e7da3f6b7f4e8dcc258f6ef3c4c7de9547cf4235aa7c2ed097aeedd4" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b29b46c9f037a69e7b0959bc8004045b/17933454043422672111;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "LS00OGM4ZTdkYTNmNmI3ZjRlOGRjYzI1OGY2ZWYzYzRjN2RlOTU0N2NmNDIzNWFhN2MyZWQwOTdhZWVkZDQNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJjdXN0b21lci1lbmNyeXB0aW9uIn0KDQotLTQ4YzhlN2RhM2Y2YjdmNGU4ZGNjMjU4ZjZlZjNjNGM3ZGU5NTQ3Y2Y0MjM1YWE3YzJlZDA5N2FlZWRkNA0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCnRvcCBzZWNyZXQuDQotLTQ4YzhlN2RhM2Y2YjdmNGU4ZGNjMjU4ZjZlZjNjNGM3ZGU5NTQ3Y2Y0MjM1YWE3YzJlZDA5N2FlZWRkNC0tDQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3575" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:36 GMT" + ], + "Etag": [ + "CP+9neCW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051375000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdv17:4351,/bns/yv/borg/yv/bns/blobstore2/bitpusher/17.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=A8ysW4qiJ8XJswaz7rjgBA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/17.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/17:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqzvI3XEU4LsqPtTfuuCmlZUYL5YtpZotdBHPMzeBjObeeIK9wicxApkA1uLnmxXHG3wXe79KGzi_z0-7UOlOA8R7dfcQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jdXN0b21lci1lbmNyeXB0aW9uLzE1MzgwNTEwNzU5NTY0NzkiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jdXN0b21lci1lbmNyeXB0aW9uIiwibmFtZSI6ImN1c3RvbWVyLWVuY3J5cHRpb24iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA3NTk1NjQ3OSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbn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": "27279c404174cd0f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2541c367ad31712ca166ba1982148194/1077403344462145933;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3518" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:36 GMT" + ], + "Etag": [ + "CP+9neCW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051376000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrd2:4398,/bns/yv/borg/yv/bns/blobstore2/bitpusher/289.scotty,yxfg3-v6:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BMysW4rOC4b-gQTynLpY" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/289.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/289:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UobHr4iNFO6-9r3IkOShNUf7Rv82BaZMVlrnByS60R0XqB5gy7QwJuuI674ibIkITsLByBS3t5I3kadR6J7CZ03HgwNTQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jdXN0b21lci1lbmNyeXB0aW9uLzE1MzgwNTEwNzU5NTY0NzkiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jdXN0b21lci1lbmNyeXB0aW9uIiwibmFtZSI6ImN1c3RvbWVyLWVuY3J5cHRpb24iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA3NTk1NjQ3OSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDozNS45NTZaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6MzUuOTU2WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjM1Ljk1NloiLCJzaXplIjoiMTEiLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9zdG9yYWdlL3YxL2IvZ28taW50ZWdyY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ci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ1ArOW5lQ1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJldGFnIjoiQ1ArOW5lQ1cyOTBDRUFFPSIsImN1c3RvbWVyRW5jcnlwdGlvbiI6eyJlbmNyeXB0aW9uQWxnb3JpdGhtIjoiQUVTMjU2Iiwia2V5U2hhMjU2IjoiSCtMbW5YaFJvZUk2VE1XNWJzVjZIeVVrNnB5R2MySU1icVliQVhCY3BzMD0ifX0=" + } + }, + { + "ID": "9682ead127083c80", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2a7f95940036c65e3640342fae7c93c4/2595758754002996780;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3575" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:36 GMT" + ], + "Etag": [ + "CP+9neCW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051376000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlj28:4249,/bns/yv/borg/yv/bns/blobstore2/bitpusher/301.scotty,yxfg3-v6:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BMysW9z8D8aPgQTXw4nIBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/301.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/301:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urk5p961WUKAYqlreEga30c6yCAbsJOf9uK54oZVhHgQWkBTEaU0MOuITSi7FEkYeMOcd1opYywE1gTpHfv04nDNAA7bQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jdXN0b21lci1lbmNyeXB0aW9u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KzluZUNXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoicjBOR3JnPT0iLCJldGFnIjoiQ1ArOW5lQ1cyOTBDRUFFPSIsImN1c3RvbWVyRW5jcnlwdGlvbiI6eyJlbmNyeXB0aW9uQWxnb3JpdGhtIjoiQUVTMjU2Iiwia2V5U2hhMjU2IjoiSCtMbW5YaFJvZUk2VE1XNWJzVjZIeVVrNnB5R2MySU1icVliQVhCY3BzMD0ifX0=" + } + }, + { + "ID": "54252acc3c2342bf", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "85" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4952355c1972efdbeeb6168001442c8d/4185888087876777163;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJjb250ZW50TGFuZ3VhZ2UiOiJlbiJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3541" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:36 GMT" + ], + "Etag": [ + "CP+9neCW290CEAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051376000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlm74:4305,/bns/yw/borg/yw/bns/blobstore2/bitpusher/206.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BMysW7COFIzohASsnZDICw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/206.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/206:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UquZDDN58SJOlHG4q0ngzir-KWmWbmxlvTSDL3P_jtECyMoB_2ZDlcTEUZ7lVHBrykjtsUvSPWGdnlUnXukeMLh4jKHjw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jdXN0b21lci1lbmNyeXB0aW9uLzE1MzgwNTEwNzU5NTY0NzkiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jdXN0b21lci1lbmNyeXB0aW9uIiwibmFtZSI6ImN1c3RvbWVyLWVuY3J5cHRpb24iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLT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iJIK0xtblhoUm9lSTZUTVc1YnNWNkh5VWs2cHlHYzJJTWJxWWJBWEJjcHMwPSJ9fQ==" + } + }, + { + "ID": "1e4409ff71b6579d", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "85" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c5ac5a686caeb5faf7bf1484a2414f90/5776299987649091945;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJjb250ZW50TGFuZ3VhZ2UiOiJlbiJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3598" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:36 GMT" + ], + "Etag": [ + "CP+9neCW290CEAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051376000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vru68:4179,/bns/yv/borg/yv/bns/blobstore2/bitpusher/118.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BMysW67PH9-wggTBqo3gCg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/118.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/118:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrPSaT_6vjBr5ZzV4WDMHPA_SSvFO-ebrb6xmFNECjX9cUZ-ZoC56VvHY8gL7uwHfUHPqeOaXwM9qnMLA0MlGHobq1-gg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jdXN0b21lci1lbmNyeXB0aW9uLzE1MzgwNTEwNzU5NTY0NzkiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9jdXN0b21lci1lbmNyeXB0aW9uIiwibmFtZSI6ImN1c3RvbWVyLWVuY3J5cHRpb24iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA3NTk1NjQ3OSIsIm1ldGFnZW5lcmF0aW9uIjoiMyIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0w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.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "28f1c3700c8886948e9777b86c1da2a1/7366711891699465992;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "277" + ], + "Content-Type": [ + "application/xml; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:36 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:36 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/33,/bns/xh/borg/xh/bns/blobstore2/bitpusher/17.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BMysW6asNe6mswbty7iIBg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/17.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/17:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpnPufth4dWvXWf0zY7TjZqhN75O9EPTouUOvwS7Q06UHww3586YUbdsiY8VBWkFg3YoB1n7DK1n6Xf6hJ0zAnB_lajBA" + ] + }, + "Body": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48RXJyb3I+PENvZGU+UmVzb3VyY2VJc0VuY3J5cHRlZFdpdGhDdXN0b21lckVuY3J5cHRpb25LZXk8L0NvZGU+PE1lc3NhZ2U+VGhlIHJlc291cmNlIGlzIGVuY3J5cHRlZCB3aXRoIGEgY3VzdG9tZXIgZW5jcnlwdGlvbiBrZXkuPC9NZXNzYWdlPjxEZXRhaWxzPlRoZSByZXF1ZXN0ZWQgb2JqZWN0IGlzIGVuY3J5cHRlZCBieSBhIGN1c3RvbWVyLXN1cHBsaWVkIGVuY3J5cHRpb24ga2V5LjwvRGV0YWlscz48L0Vycm9yPg==" + } + }, + { + "ID": "93cabc57ce6ec56f", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "46b21c18c1b22de8bcb7c8e6cad0fed5/8956842325084873895;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Language": [ + "en" + ], + "Content-Length": [ + "11" + ], + "Content-Type": [ + "text/plain; charset=utf-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:36 GMT" + ], + "Etag": [ + "\"-CP+9neCW290CEAM=\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:35 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:35 GMT" + ], + "X-Goog-Generation": [ + "1538051075956479" + ], + "X-Goog-Hash": [ + "crc32c=r0NGrg==", + "md5=xwWNFa0VdXPmlAwrlcAJcg==" + ], + "X-Goog-Metageneration": [ + "3" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "11" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/45,/bns/xh/borg/xh/bns/blobstore2/bitpusher/15.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BMysW_qrOOShswbYw67IAw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/15.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/15:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upxs5C49MvrZj6aa9oojSto4f-3W7bgZwh4NhcGuxb2573bjz2bjoHbVnCmMJFeX12t4lCearSUmPPgKbZ5YlE7wCjeOQ" + ] + }, + "Body": "dG9wIHNlY3JldC4=" + } + }, + { + "ID": "61df6bb6e1b0ad73", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d4b09a52787ac8818e2cfd1ddf37a52d/10547254229135313477;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "14271" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:37 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051377000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vno63:4474,/bns/yx/borg/yx/bns/blobstore2/bitpusher/70.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BcysW6euAYTbzAKpmb-YBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/70.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/70:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqs1CpXLAmyRtjb9DQCQZQiZKmFmaJNTEtGuC4e4UDlMkZKcyFOc8R_Tee_amgXHR66SM_zYyIUaHvjAAdLWElZ3F7oyg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlc291cmNlSXNFbmNyeXB0ZWRXaXRoQ3VzdG9tZXJFbmNyeXB0aW9uS2V5IiwibWVzc2FnZSI6IlR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G5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHROb1VucmVmKFRyYWNlQ29udGV4dC5qYXZhOjMyMSlcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dChUcmFjZUNvbnRleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAwLCJtZXNzYWdlIjoiVGhlIHRhcmdldCBvYmplY3QgaXMgZW5jcnlwdGVkIGJ5IGEgY3VzdG9tZXItc3VwcGxpZWQgZW5jcnlwdGlvbiBrZXkuIn19" + } + }, + { + "ID": "ce84af2c6aa2d36d", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "bea423105d717ad175861ccbc2324689/12137665029412712420;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Copy-Source-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Copy-Source-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Copy-Source-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3620" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:38 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051377000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbc184:4336,/bns/yv/borg/yv/bns/blobstore2/bitpusher/20.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BcysW4-eE8nMgASG3IeoCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/20.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/20:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upxx3BvvnZJYIHgJTz9kSp10vjMWjJtn9_uAWAKe5an6Od-3BSGt6Q6RED4-Ibtc3RC0jJPGpi0Tw_Z-wkl16heHnuLAUEsBBV_adZ79hofU-Hx2Kc" + ]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xIiwib2JqZWN0IjoiY3VzdG9tZXItZW5jcnlwdGlvbi0yIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNzc4Mjc5ODEiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDSTNiaitHVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6InIwTkdyZz09IiwiZXRhZyI6IkNJM2JqK0dXMjkwQ0VBRT0ifX0=" + } + }, + { + "ID": "a999df3690b6e237", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-2", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1705b1e6484692b737affea080b35228/13728076933463086467;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-2" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Language": [ + "en" + ], + "Content-Length": [ + "11" + ], + "Content-Type": [ + "text/plain; charset=utf-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:38 GMT" + ], + "Etag": [ + "\"c7058d15ad157573e6940c2b95c00972\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:38 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:37 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:37 GMT" + ], + "X-Goog-Generation": [ + "1538051077827981" + ], + "X-Goog-Hash": [ + "crc32c=r0NGrg==", + "md5=xwWNFa0VdXPmlAwrlcAJcg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "11" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/28,/bns/xh/borg/xh/bns/blobstore2/bitpusher/8.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BsysW8LLA--pswargaYo" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/8.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/8:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq1CdxdvfAVgPz36drluRR3XOAVGxbcXHZLLuNRWrH_TRabeapqxPWBPlHbXA-EGVnBdA358uiErdYzW3U0Wz14YviqaA" + ] + }, + "Body": "dG9wIHNlY3JldC4=" + } + }, + { + "ID": "61481b2562659560", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c8dad96b48876570d28a024bb8a5820f/15318207366848559649;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "FnBvfQ1dDsyS8kHD+aB6HHIglDoQ5Im7WYDm3XYTGrQ=" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "14271" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:38 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051377000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrng11:4017,/bns/yr/borg/yr/bns/blobstore2/bitpusher/28.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BsysW-27CaiWkATJhbDgBQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/28.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/28:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqLzeVXHyiNFMW3buLUpS_VSAbJU_2CwoEyGNKNBA8qGutAt-VmjsPfYO7yYHUxzQBVn4BYg5g-gG5rKWvp_qn1-N_rlQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlc291cmNlSXNFbmNyeXB0ZWRXaXRoQ3VzdG9tZXJFbmNyeXB0aW9uS2V5IiwibWVzc2FnZSI6IlRoZSB0YXJnZXQgb2JqZWN0IGlzIGVuY3J5cHRlZCBieSBhIGN1c3RvbWVyLXN1cHBsaWVkIGVuY3J5cHRpb24ga2V5LiIsImV4dGVuZGVkSGVscCI6Imh0dHBzOi8vY2xvdWQuZ29vZ2xlLmNvbS9zdG9yYWdlL2RvY3MvZW5jcnlwdGlvbiNjdXN0b21lci1zdXBwbGllZF9lbmNyeXB0aW9uX2tleXMiLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY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XG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAwLCJtZXNzYWdlIjoiVGhlIHRhcmdldCBvYmplY3QgaXMgZW5jcnlwdGVkIGJ5IGEgY3VzdG9tZXItc3VwcGxpZWQgZW5jcnlwdGlvbiBrZXkuIn19" + } + }, + { + "ID": "b6ec99f6d81fabb4", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "902f8072774afaa43e582fad4756347f/16908619266604032192;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Copy-Source-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Copy-Source-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Copy-Source-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "FnBvfQ1dDsyS8kHD+aB6HHIglDoQ5Im7WYDm3XYTGrQ=" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3733" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:38 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051377000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vngu25:4297,/bns/yx/borg/yx/bns/blobstore2/bitpusher/103.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BsysW9atE8-SzAKwt734Bg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/103.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/103:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqAvNR3Fv4vliLe4057vGGJi3tYRwNVOtnOpX_n2kGwJVcvjq5HUkZ3ILlNbaiotOJX5pekim3kpy0YBBvTw1is7X9k1A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNyZXdyaXRlUmVzcG9uc2UiLCJ0b3RhbEJ5dGVzUmV3cml0dGVuIjoiMTEiLCJvYmplY3RTaXplIjoiMTEiLCJkb25lIjp0cnVlLCJyZXNvdXJjZSI6eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6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2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDUG5nek9HVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6InIwTkdyZz09IiwiZXRhZyI6IkNQbmd6T0dXMjkwQ0VBRT0iLCJjdXN0b21lckVuY3J5cHRpb24iOnsiZW5jcnlwdGlvbkFsZ29yaXRobSI6IkFFUzI1NiIsImtleVNoYTI1NiI6IkZuQnZmUTFkRHN5UzhrSEQrYUI2SEhJZ2xEb1E1SW03V1lEbTNYWVRHclE9In19fQ==" + } + }, + { + "ID": "af6300f23cc6c27c", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-2", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "34eb30af8a5d023668ef3bfebecd46df/52568571938342239;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-2" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "277" + ], + "Content-Type": [ + "application/xml; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:38 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:38 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/0,/bns/xh/borg/xh/bns/blobstore2/bitpusher/28.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=BsysW7-yOYuhswbl1qKYBg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/28.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/28:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrjoQiF7Wn9tm0yro8yG5Q_IlGNtcRWwGXNmf76WCfoPNtEjykhr4I2C2Z7IMJu69JC7Ug7VKK_eCSeLk-GpliSCYK52Q" + ] + }, + "Body": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48RXJyb3I+PENvZGU+UmVzb3VyY2VJc0VuY3J5cHRlZFdpdGhDdXN0b21lckVuY3J5cHRpb25LZXk8L0NvZGU+PE1lc3NhZ2U+VGhlIHJlc291cmNlIGlzIGVuY3J5cHRlZCB3aXRoIGEgY3VzdG9tZXIgZW5jcnlwdGlvbiBrZXkuPC9NZXNzYWdlPjxEZXRhaWxzPlRoZSByZXF1ZXN0ZWQgb2JqZWN0IGlzIGVuY3J5cHRlZCBieSBhIGN1c3RvbWVyLXN1cHBsaWVkIGVuY3J5cHRpb24ga2V5LjwvRGV0YWlscz48L0Vycm9yPg==" + } + }, + { + "ID": "13b7d249a22c3226", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-2", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6ec04258e9f0bf885bd0d408ba9d4a85/1642697905812188157;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-2" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "FnBvfQ1dDsyS8kHD+aB6HHIglDoQ5Im7WYDm3XYTGrQ=" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Language": [ + "en" + ], + "Content-Length": [ + "11" + ], + "Content-Type": [ + "text/plain; charset=utf-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:39 GMT" + ], + "Etag": [ + "\"-CPngzOGW290CEAE=\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:38 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key-Sha256": [ + "FnBvfQ1dDsyS8kHD+aB6HHIglDoQ5Im7WYDm3XYTGrQ=" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:38 GMT" + ], + "X-Goog-Generation": [ + "1538051078828153" + ], + "X-Goog-Hash": [ + "crc32c=r0NGrg==", + "md5=xwWNFa0VdXPmlAwrlcAJcg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "11" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/12,/bns/xh/borg/xh/bns/blobstore2/bitpusher/52.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=B8ysW6cIsKqzBr6kg8AP" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/52.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/52:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uogb9TrmaLESy0ok976HRo5Lcn2MEURdtotgODsMtPI9-W2lNDP6Xu951WGKM8lOEapQi_54VQ9XaY6faPuZz8_AUyXlw" + ] + }, + "Body": "dG9wIHNlY3JldC4=" + } + }, + { + "ID": "3f85e3abeccd12ee", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "790fd5e30e72862f5207a85bf97442a8/3233109805584437404;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Copy-Source-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Copy-Source-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Copy-Source-Encryption-Key-Sha256": [ + "FnBvfQ1dDsyS8kHD+aB6HHIglDoQ5Im7WYDm3XYTGrQ=" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3733" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:39 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051377000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrno9:4295,/bns/yv/borg/yv/bns/blobstore2/bitpusher/88.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=B8ysW5XXB8KZgQTw9ZIQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/88.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/88:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrXkelifrzmM_ZibiAKC7mLpFqUeNomFI8UJ8PFAqN8RD84AJ-A1I8E6RE4RzsKdJC9Gi5dMDbBKV8rVm5YLLWXXo1Caw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNyZXdyaXRlUmVzcG9uc2UiLCJ0b3RhbEJ5dGVzUmV3cml0dGVuIjoiMTEiLCJvYmplY3RTaXplIjoiMTEiLCJkb25lIjp0cnVlLCJyZXNvdXJjZSI6eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctND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9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDUFhZOXVHVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6InIwTkdyZz09IiwiZXRhZyI6IkNQWFk5dUdXMjkwQ0VBRT0iLCJjdXN0b21lckVuY3J5cHRpb24iOnsiZW5jcnlwdGlvbkFsZ29yaXRobSI6IkFFUzI1NiIsImtleVNoYTI1NiI6IkgrTG1uWGhSb2VJNlRNVzVic1Y2SHlVazZweUdjMklNYnFZYkFYQmNwczA9In19fQ==" + } + }, + { + "ID": "082a7091d1ed2007", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-3/compose?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "160" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "32ccef1e750b13cb8ebb9b1411568f72/4823521709634876986;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-3/compose?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6ImN1c3RvbWVyLWVuY3J5cHRpb24ifSx7Im5hbWUiOiJjdXN0b21lci1lbmNyeXB0aW9uLTIifV19Cg==" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13226" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:39 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051377000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrmi1:4383,/bns/yw/borg/yw/bns/blobstore2/bitpusher/2.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=B8ysW9fRJpbRhASP5ryIBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/2.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/2:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqnSH1S0DzV-Tzbn9uZFehFnzCR3q7Tu5p04nCaneV0wfauN_YQTYLZCyLntmuHEkFeYFM1lLgwVSKjBYfRf7ED95Goug" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlc291cmNlSXNFbmNyeXB0ZWRXaXRoQ3VzdG9tZXJFbmNyeXB0aW9uS2V5IiwibWVzc2FnZSI6IlRoZSB0YXJnZXQgb2JqZWN0IGlzIGVuY3J5cHRlZCBieSBhIGN1c3RvbWVyLXN1cHBsaWVkIGVuY3J5cHRpb24ga2V5LiIsImV4dGVuZGVkSGVscCI6Imh0dHBzOi8vY2xvdWQuZ29vZ2xlLmNvbS9zdG9yYWdlL2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NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJUaGUgdGFyZ2V0IG9iamVjdCBpcyBlbmNyeXB0ZWQgYnkgYSBjdXN0b21lci1zdXBwbGllZCBlbmNyeXB0aW9uIGtleS4ifX0=" + } + }, + { + "ID": "f38450f7b6994359", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-3/compose?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "160" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d80e51262f252122efbaf143063fec84/7172970583123226152;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-3/compose?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6ImN1c3RvbWVyLWVuY3J5cHRpb24ifSx7Im5hbWUiOiJjdXN0b21lci1lbmNyeXB0aW9uLTIifV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "911" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:40 GMT" + ], + "Etag": [ + "CPPmruKW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051377000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlb12:4251,/bns/yv/borg/yv/bns/blobstore2/bitpusher/43.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=B8ysW4izOIOegwTq3L2ADw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/43.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/43:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrylLVTdrDh4f0Vfz7f7uc-9JeMykJ4U6tLGFt1hxOEFQDcYOlrv4zBfNQWHFKEOybb0y9327li2CcTac2VQbWW2VVKsg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9jdXN0b21lci1lbmNyeXB0aW9uLTMvMTUzODA1MTA4MDQzNDU0NyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL2N1c3RvbWVyLWVuY3J5cHRpb24tMyIsIm5hbWUiOiJjdXN0b21lci1lbmNyeXB0aW9uLTMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4MDQzNDU0NyIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo0MC40MzRaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NDAuNDM0WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjQwLjQzNFoiLCJzaXplIjoiMjIiLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vY3VzdG9tZXItZW5jcnlwdGlvbi0zP2dlbmVyYXRpb249MTUzODA1MTA4MDQzNDU0NyZhbHQ9bWVkaWEiLCJjcmMzMmMiOiI1ajF5cGc9PSIsImNvbXBvbmVudENvdW50IjoyLCJldGFnIjoiQ1BQbXJ1S1cyOTBDRUFFPSIsImN1c3RvbWVyRW5jcnlwdGlvbiI6eyJlbmNyeXB0aW9uQWxnb3JpdGhtIjoiQUVTMjU2Iiwia2V5U2hhMjU2IjoiSCtMbW5YaFJvZUk2VE1XNWJzVjZIeVVrNnB5R2MySU1icVliQVhCY3BzMD0ifX0=" + } + }, + { + "ID": "9e7050ed002cb668", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-3", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "73a2be99b8acfc1dee817e64a6745ea9/8763382482895475655;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-3" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "277" + ], + "Content-Type": [ + "application/xml; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:40 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:40 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/47,/bns/xh/borg/xh/bns/blobstore2/bitpusher/60.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=CMysW4i9IsWhswa5mIuQAg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/60.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/60:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrCCK9bVrOWH7ud3eW9W3iMCeh8Qx_fEx62BWAY7Dz4jTrVQJP8pMyvE9WqwAMVLcsnZ4V2KTogN111cHGLj6rHRWoWLg" + ] + }, + "Body": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48RXJyb3I+PENvZGU+UmVzb3VyY2VJc0VuY3J5cHRlZFdpdGhDdXN0b21lckVuY3J5cHRpb25LZXk8L0NvZGU+PE1lc3NhZ2U+VGhlIHJlc291cmNlIGlzIGVuY3J5cHRlZCB3aXRoIGEgY3VzdG9tZXIgZW5jcnlwdGlvbiBrZXkuPC9NZXNzYWdlPjxEZXRhaWxzPlRoZSByZXF1ZXN0ZWQgb2JqZWN0IGlzIGVuY3J5cHRlZCBieSBhIGN1c3RvbWVyLXN1cHBsaWVkIGVuY3J5cHRpb24ga2V5LjwvRGV0YWlscz48L0Vycm9yPg==" + } + }, + { + "ID": "0fbb222f2534ff7a", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-3", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6331c1e1f7b03eb25a98f3fc46f36369/10353511816769255782;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/customer-encryption-3" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "22" + ], + "Content-Type": [ + "application/octet-stream" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:40 GMT" + ], + "Etag": [ + "\"-CPPmruKW290CEAE=\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:40 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Component-Count": [ + "2" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:24:40 GMT" + ], + "X-Goog-Generation": [ + "1538051080434547" + ], + "X-Goog-Hash": [ + "crc32c=5j1ypg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "22" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/34,/bns/xh/borg/xh/bns/blobstore2/bitpusher/86.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=CMysW-ycJe6oswaP1oK4DA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/86.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/86:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpuCcU3sd6d5b3_CAmlabI6q2Y6u8mNw58JWRfKayJ4R6dbktGbpQ-hZyXbWI9zCfwEr-ZA_-azw7Q8-WtMuO2xAI-8uA" + ] + }, + "Body": "dG9wIHNlY3JldC50b3Agc2VjcmV0Lg==" + } + }, + { + "ID": "2674faa2be795765", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "96c928b3b824c63fe7484440c436c936/11943923720836472324;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Copy-Source-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Copy-Source-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Copy-Source-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3620" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:41 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051377000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrae1:4130,/bns/yr/borg/yr/bns/blobstore2/bitpusher/72.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=CMysW4b8LM3ikAO8k6i4Cg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/72.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/72:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqiHnplkYoA54YhU9ArFoa4wXcCr0oXVB1HTdzE_nCqLyPj3048fN0-OX3_eM3xHOmxELgRjw88jTxkXPQW6kTqXoaZBA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNyZXdyaXRlUmVzcG9uc2UiLCJ0b3RhbEJ5dGVzUmV3cml0dGVuIjoiMTEiLCJvYmplY3RTaXplIjoiMTEiLCJkb25lIjp0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IxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDUGU4M3VLVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6InIwTkdyZz09IiwiZXRhZyI6IkNQZTgzdUtXMjkwQ0VBRT0ifX0=" + } + }, + { + "ID": "a69acbcb815e9a98", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-3/compose?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "129" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "a7cd921f95aff6168c1cdf2558bbb8c2/13534335624886846627;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-3/compose?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "H+LmnXhRoeI6TMW5bsV6HyUk6pyGc2IMbqYbAXBcps0=" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6ImN1c3RvbWVyLWVuY3J5cHRpb24tMiJ9XX0K" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13336" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:41 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051377000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vns194:4293,/bns/yx/borg/yx/bns/blobstore2/bitpusher/80.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=CcysW6u5FYTBzAKH6JOIAg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/80.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/80:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWUs4TEVnZzc0SE1jc2k2MENjN2doVUNwYXhuZlplOGJXWW1xSDdtR3h4UFFoVFo0OHVKNE9hSzBMbmltRms1bTFKRGNYOS1VS2FNNzlNaDNKNnRzb0JmVGt2MkxxTEJtM1RXMVJ2RGFiQTV6VlV1VHJUR2xMMTZlVjRNWG5oZGxDbEZMQmZtcWNvZU9CVzlDNkUwemVWVDUtTXFsU29OTUtsaG5iOGdlanREQW55QkZNWUVTb3pIa1kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrsewdwW9EJ0NcTaSD_uyyIskMhpsLlaImKZ_i0_-K6dCZQMXFB0P-8yHmIIOwuyNOq33P9ahzJ6_YlsOilZA0aRMlLDA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlc291cmNlTm90RW5jcnlwdGVkV2l0aEN1c3RvbWVyRW5jcnlwdGlvbktleSIsIm1lc3NhZ2UiOiJUaGUgdGFyZ2V0IG9iamVjdCBpcyBub3QgZW5jcnlwdGVkIGJ5IGEgY3VzdG9tZXItc3VwcGxpZWQgZW5jcnlwdGlvbiBrZXkuIiwiZXh0ZW5kZWRIZ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Y2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAwLCJtZXNzYWdlIjoiVGhlIHRhcmdldCBvYmplY3QgaXMgbm90IGVuY3J5cHRlZCBieSBhIGN1c3RvbWVyLXN1cHBsaWVkIGVuY3J5cHRpb24ga2V5LiJ9fQ==" + } + }, + { + "ID": "6f9c244b2d250c5e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "31eada18413479da75d3925cc7108f96/15124747524659095874;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2492" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:42 GMT" + ], + "Etag": [ + "CAk=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:42 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051381000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vngu25:4297,/bns/yx/borg/yx/bns/blobstore2/bitpusher/156.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=CcysW4nWKs6EzALbtZ-gDg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/156.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/156:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnBxTXlCbWNNWUVoeVpDak45TUl5alRkV2U4Tkd3bWM0RktJRUk1NGNIWmhyVTNrbmhKU0pwc1FISTJCQkVVSUdaV29YZ3FhajlBV2hIMEF2TVlYN3V6YVdPRkxfR0hTNnJrcEFrRFZRMzBUdF9uUWFEb1QybXVGRkxYRXBNdnYxOExuX2R1aFZnVnRkdHJlWm9hN21jU3JnMXEtejlocnV2SGxiTzFYbzVvTDRoRUExd3BFOFZ6R1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrZI72BrP6aXYwfG9Rnz_oveTk2w4RM4JsRUBErv5nhrD_CbfL-4BN_PU1l3IXj320SM9dp9j7Po-u9bTOr19l7NVQAQA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjM6NTIuMzU1WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjI5LjE0NVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjkiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2M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pdG9ycyJ9LCJldGFnIjoiQ0FrPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FrPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInZlcnNpb25pbmciOnsiZW5hYmxlZCI6ZmFsc2V9LCJsaWZlY3ljbGUiOnsicnVsZSI6W3siYWN0aW9uIjp7InR5cGUiOiJEZWxldGUifSwiY29uZGl0aW9uIjp7ImFnZSI6MzB9fV19LCJsYWJlbHMiOnsibmV3IjoibmV3IiwibDEiOiJ2MiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQWs9In0=" + } + }, + { + "ID": "9133d063a35c30e5", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=a11b044a99f2443cf5038003dedb8e668d7fe177eab13c4a0b90234adb2e" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1a85ca3ba39da04007da15869a2499c0/15883784494080294033;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1hMTFiMDQ0YTk5ZjI0NDNjZjUwMzgwMDNkZWRiOGU2NjhkN2ZlMTc3ZWFiMTNjNGEwYjkwMjM0YWRiMmUNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJwb3NjIn0KDQotLWExMWIwNDRhOTlmMjQ0M2NmNTAzODAwM2RlZGI4ZTY2OGQ3ZmUxNzdlYWIxM2M0YTBiOTAyMzRhZGIyZQ0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCmZvbw0KLS1hMTFiMDQ0YTk5ZjI0NDNjZjUwMzgwMDNkZWRiOGU2NjhkN2ZlMTc3ZWFiMTNjNGEwYjkwMjM0YWRiMmUtLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3221" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:42 GMT" + ], + "Etag": [ + "CPf3qOOW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051382000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrkm9:4009,/bns/yw/borg/yw/bns/blobstore2/bitpusher/139.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=CsysW5GnB9LfhAT69p74BQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/139.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/139:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYnBxTXlCbWNNWUVoeVpDak45TUl5alRkV2U4Tkd3bWM0RktJRUk1NGNIWmhyVTNrbmhKU0pwc1FISTJCQkVVSUdaV29YZ3FhajlBV2hIMEF2TVlYN3V6YVdPRkxfR0hTNnJrcEFrRFZRMzBUdF9uUWFEb1QybXVGRkxYRXBNdnYxOExuX2R1aFZnVnRkdHJlWm9hN21jU3JnMXEtejlocnV2SGxiTzFYbzVvTDRoRUExd3BFOFZ6R1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrjPZMs7lUyqu-BOU0UoEmJXSWt1nW1nznNnZyqbG7_XTwii-4DpkHyIRbgkfrZjwIom3uj1F31_r8i18UBQxWL7scHxg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9wb3NjLzE1MzgwNTEwODI0MzU1NzUiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9wb3NjIiwibmFtZSI6InBvc2MiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4MjQzNTU3NSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo0Mi40MzVaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NDIuNDM1WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjQyLjQzNVoiLCJzaXplIjoiMyIsIm1kNUhhc2giOiJyTDBZMjB6QytGenQ3MlZQek1TazJ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Axb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ1BmM3FPT1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJ6OFN1SFE9PSIsImV0YWciOiJDUGYzcU9PVzI5MENFQUU9In0=" + } + }, + { + "ID": "793ce49241ead072", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/posc?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "737703d157645287eed0cf2d581c1afe/17474195298652594480;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/posc?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3221" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:42 GMT" + ], + "Etag": [ + "CPf3qOOW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051382000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrmk10:4329,/bns/yr/borg/yr/bns/blobstore2/bitpusher/22.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=CsysW6T5KYfwkAOekpvQCA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/22.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/22:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYnBxTXlCbWNNWUVoeVpDak45TUl5alRkV2U4Tkd3bWM0RktJRUk1NGNIWmhyVTNrbmhKU0pwc1FISTJCQkVVSUdaV29YZ3FhajlBV2hIMEF2TVlYN3V6YVdPRkxfR0hTNnJrcEFrRFZRMzBUdF9uUWFEb1QybXVGRkxYRXBNdnYxOExuX2R1aFZnVnRkdHJlWm9hN21jU3JnMXEtejlocnV2SGxiTzFYbzVvTDRoRUExd3BFOFZ6R1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upl0M0TYF99JpqqHFMfFDcvOI3Kyy2zWEV_5XuTlzdzzvhSphgs--na7KgwhJnlBmAbPwkJ-kQjZ_S2KSNY1WeGO3jt8w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9wb3NjLzE1MzgwNTEwODI0MzU1NzUiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9wb3NjIiwibmFtZSI6InBvc2MiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4MjQzNTU3NSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo0Mi40MzVaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6N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iZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ1BmM3FPT1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJ6OFN1SFE9PSIsImV0YWciOiJDUGYzcU9PVzI5MENFQUU9In0=" + } + }, + { + "ID": "7c3235e94e5f1d49", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/posc/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/posc?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "34" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "045d3b6b50ecd5f20e668145d7067f65/617863128993548238;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/posc/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/posc?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJzdG9yYWdlQ2xhc3MiOiJNVUxUSV9SRUdJT05BTCJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3286" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:43 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051382000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrip90:4121,/bns/yr/borg/yr/bns/blobstore2/bitpusher/62.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=CsysW_zAL9Ge4QSorrjYCg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/62.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/62:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRYnBxTXlCbWNNWUVoeVpDak45TUl5alRkV2U4Tkd3bWM0RktJRUk1NGNIWmhyVTNrbmhKU0pwc1FISTJCQkVVSUdaV29YZ3FhajlBV2hIMEF2TVlYN3V6YVdPRkxfR0hTNnJrcEFrRFZRMzBUdF9uUWFEb1QybXVGRkxYRXBNdnYxOExuX2R1aFZnVnRkdHJlWm9hN21jU3JnMXEtejlocnV2SGxiTzFYbzVvTDRoRUExd3BFOFZ6R1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpBrEawAqmOFoyRSCwYrTqRiIMbZKnMzvTDTGGVXxV4EvhLJB06Pf06EFZdrIULrUqftTRnOu7rKWfe6FocLDponokX4A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNyZXdyaXRlUmVzcG9uc2UiLCJ0b3RhbEJ5dGVzUmV3cml0dGVuIjoiMyIsIm9iamVjdFNpemUiOiIzIiwiZG9uZSI6dHJ1ZSwicmVzb3VyY2UiOnsia2luZCI6InN0b3JhZ2Ujb2JqZWN0IiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvcG9zYy8xNTM4MDUxMDgzMjI3NTQ3Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNv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RwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vcG9zYy9hY2wvdXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6InBvc2MiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4MzIyNzU0NyIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNKdWoyZU9XMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiejhTdUhRPT0iLCJldGFnIjoiQ0p1ajJlT1cyOTBDRUFFPSJ9fQ==" + } + }, + { + "ID": "7f37efaaa4a10ba0", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=f7d76450fb503dd31762a093ee2938e9271649529336ad7573571e65208b" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5c75bb9317f75305458ad9b585bd658c/1377181569096423966;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1mN2Q3NjQ1MGZiNTAzZGQzMTc2MmEwOTNlZTI5MzhlOTI3MTY0OTUyOTMzNmFkNzU3MzU3MWU2NTIwOGINCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJwb3NjMiIsInN0b3JhZ2VDbGFzcyI6Ik1VTFRJX1JFR0lPTkFMIn0KDQotLWY3ZDc2NDUwZmI1MDNkZDMxNzYyYTA5M2VlMjkzOGU5MjcxNjQ5NTI5MzM2YWQ3NTczNTcxZTY1MjA4Yg0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCnh4eA0KLS1mN2Q3NjQ1MGZiNTAzZGQzMTc2MmEwOTNlZTI5MzhlOTI3MTY0OTUyOTMzNmFkNzU3MzU3MWU2NTIwOGItLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3243" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:43 GMT" + ], + "Etag": [ + "CMvl9+OW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051382000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrl7:4233,/bns/yv/borg/yv/bns/blobstore2/bitpusher/286.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=C8ysW9TdFsnNgASH64bQDA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/286.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/286:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYnBxTXlCbWNNWUVoeVpDak45TUl5alRkV2U4Tkd3bWM0RktJRUk1NGNIWmhyVTNrbmhKU0pwc1FISTJCQkVVSUdaV29YZ3FhajlBV2hIMEF2TVlYN3V6YVdPRkxfR0hTNnJrcEFrRFZRMzBUdF9uUWFEb1QybXVGRkxYRXBNdnYxOExuX2R1aFZnVnRkdHJlWm9hN21jU3JnMXEtejlocnV2SGxiTzFYbzVvTDRoRUExd3BFOFZ6R1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqQ8mwwlOeS-eMuzlQ-XHX2qnrG-A6DWwm5QKOhddYR2imhlwNxhnpDPJ6_5YhcFF03hm8mYxhq6GM87N4FasQmXuiPiA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9wb3NjMi8xNTM4MDUxMDgzNzI3NTYzIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vcG9zYzIiLCJuYW1lIjoicG9zYzIiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4MzcyNzU2MyIsIm1ldGFnZW5lcmF0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NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxIiwib2JqZWN0IjoicG9zYzIiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4MzcyNzU2MyIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNNdmw5K09XMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiMTdxQUJRPT0iLCJldGFnIjoiQ012bDkrT1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "b7982318c88f63e2", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=aa69c137381c6410b1a82a7f891a07638054c96a3999bbab84aa50e35e5e" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5aefb8960730d3277415ebd22c08f057/2208275033060699245;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1hYTY5YzEzNzM4MWM2NDEwYjFhODJhN2Y4OTFhMDc2MzgwNTRjOTZhMzk5OWJiYWI4NGFhNTBlMzVlNWUNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJidWNrZXRJbkNvcHlBdHRycyJ9Cg0KLS1hYTY5YzEzNzM4MWM2NDEwYjFhODJhN2Y4OTFhMDc2MzgwNTRjOTZhMzk5OWJiYWI4NGFhNTBlMzVlNWUNCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA0KDQpmb28NCi0tYWE2OWMxMzczODFjNjQxMGIxYTgyYTdmODkxYTA3NjM4MDU0Yzk2YTM5OTliYmFiODRhYTUwZTM1ZTVlLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3429" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:44 GMT" + ], + "Etag": [ + "CNiQluSW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051383000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnm19:4486,/bns/yr/borg/yr/bns/blobstore2/bitpusher/32.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=C8ysW9uROMH5kAPknaPwAQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/32.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/32:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWTViWV96Nk5YcmI0c3JCbmd1Z0dCRHZSeldidE5ERFcwb201SUtrUENMdWdqUXRtR3dvd1JHbzlCcGtob2NnVEV3dXRLUUpRYXo2UXdNcVpNVGd6UFVzSmpJY3h0OThDVXhQQXpMcGJsUEE4Q1I5ZkNhSmU5bWc3X2pSQ3BJTzRpNWpNbHRfN2w5RnBsbUhqcGl6LVdKSXZ0TDBta1duRVFRR2dmQkJjLXBhbEhleFpWNElHcVQ0YTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrYaPW-mVsy9yVtUYn-Xa4rHX25K84ldGpiSoDCXIKpmhvHpfE65GhDhdZtVnQnd91KAuaSxTJRfiUwx-4d0WkTWEuKDw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9idWNrZXRJbkNvcHlBdHRycy8xNTM4MDUxMDg0MjI0NjAwIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxL28vYnVja2V0SW5Db3B5QXR0cnMiLCJuYW1lIjoiYnVja2V0SW5Db3B5QXR0cnMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4NDIyNDYwMCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo0NC4yMjRaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NDQuMjI0WiIsIn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Z2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxIiwib2JqZWN0IjoiYnVja2V0SW5Db3B5QXR0cnMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4NDIyNDYwMCIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNOaVFsdVNXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiejhTdUhRPT0iLCJldGFnIjoiQ05pUWx1U1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "b63232023ceca5a0", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/bucketInCopyAttrs/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/bucketInCopyAttrs?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "62" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b359f31e9eda65b74dd2328cf1897da5/2967312002481897404;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/bucketInCopyAttrs/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/bucketInCopyAttrs?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEifQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "2928" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:44 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051384000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrhj8:4264,/bns/yv/borg/yv/bns/blobstore2/bitpusher/235.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=DMysW_maFYnuggSJ1Lr4CQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/235.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/235:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWTViWV96Nk5YcmI0c3JCbmd1Z0dCRHZSeldidE5ERFcwb201SUtrUENMdWdqUXRtR3dvd1JHbzlCcGtob2NnVEV3dXRLUUpRYXo2UXdNcVpNVGd6UFVzSmpJY3h0OThDVXhQQXpMcGJsUEE4Q1I5ZkNhSmU5bWc3X2pSQ3BJTzRpNWpNbHRfN2w5RnBsbUhqcGl6LVdKSXZ0TDBta1duRVFRR2dmQkJjLXBhbEhleFpWNElHcVQ0YTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoDa0ITv4m8GBWZHkTRpUkhju59P-najn0K-qoegCn7bEUdjhc_c1kkm7BxbRXNMyCnqbLk4SjpJ8HgfxmBi4jHK9s8RQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IlJlcXVpcmVkIiwiZGVidWdJ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zIwKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwMCwibWVzc2FnZSI6IlJlcXVpcmVkIn19" + } + }, + { + "ID": "f39634171d163619", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=9c11bb8c567eb4b2238e0f29baabdad7310c3407295239aab1f1ba158385" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "02e34d54248307bc8698501b08b37d8b/3798686937111073292;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS05YzExYmI4YzU2N2ViNGIyMjM4ZTBmMjliYWFiZGFkNzMxMGMzNDA3Mjk1MjM5YWFiMWYxYmExNTgzODUNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNyYzMyYyI6ImNIK0Erdz09IiwibmFtZSI6Imhhc2hlc09uVXBsb2FkLTEifQoNCi0tOWMxMWJiOGM1NjdlYjRiMjIzOGUwZjI5YmFhYmRhZDczMTBjMzQwNzI5NTIzOWFhYjFmMWJhMTU4Mzg1DQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KSSBjYW4ndCB3YWl0IHRvIGJlIHZlcmlmaWVkDQotLTljMTFiYjhjNTY3ZWI0YjIyMzhlMGYyOWJhYWJkYWQ3MzEwYzM0MDcyOTUyMzlhYWIxZjFiYTE1ODM4NS0tDQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3414" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:45 GMT" + ], + "Etag": [ + "CLmKweSW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051384000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrat7:4174,/bns/yv/borg/yv/bns/blobstore2/bitpusher/208.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=DMysW7TbHcvWgwSzu6-IBw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/208.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/208:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYXdSQ1M2WXgtYjJEdmpBazA2dXVSS2FmSHRBSDFRYVk3ZmNZa3VsaXNyU19rbDJRRjJNMU1oUG5UX0wwelFUa1cwbkNkQ282RXlfckF5Y2J4aFdVQzh6SXIwMFZTaXJWaElfSWgzWlljc3VRQXR6eXk3ZXdYUTlYemJ0VjM0Tm9yZzBlUFNmaWFJTjlOVWtXY0NUbWY3cXczRkNWZWhHSFZUaW1OY1hFOXhyV3ZYY0FMZzR4N2JXV3MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrPbPHpxg2xi0jHMzfoGOksYnVbrNPFBA79OwbWop7GQk-hQCVhdQHH2oJuWzqkHO0nR-jdQzk7DI2SD2lwslSB7r16lg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9oYXNoZXNPblVwbG9hZC0xLzE1MzgwNTEwODQ5MjgzMTMiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9oYXNoZXNPblVwbG9hZC0xIiwibmFtZSI6Imhhc2hlc09uVXBsb2FkLTEiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4NDkyODMxMyIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo0NC45MjhaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NDQuOTI4WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZ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tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Imhhc2hlc09uVXBsb2FkLTEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4NDkyODMxMyIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNMbUt3ZVNXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiY0grQSt3PT0iLCJldGFnIjoiQ0xtS3dlU1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "a769205b3700f7a4", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=24b4b20cd70ea2c753252870eee82bd68cf04ff437d12f5e2a35bf547a58" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d8ef1d10c2ba55e62a6a721e3236b56c/4557723906532271451;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0yNGI0YjIwY2Q3MGVhMmM3NTMyNTI4NzBlZWU4MmJkNjhjZjA0ZmY0MzdkMTJmNWUyYTM1YmY1NDdhNTgNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNyYzMyYyI6ImNIK0EvQT09IiwibmFtZSI6Imhhc2hlc09uVXBsb2FkLTEifQoNCi0tMjRiNGIyMGNkNzBlYTJjNzUzMjUyODcwZWVlODJiZDY4Y2YwNGZmNDM3ZDEyZjVlMmEzNWJmNTQ3YTU4DQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KSSBjYW4ndCB3YWl0IHRvIGJlIHZlcmlmaWVkDQotLTI0YjRiMjBjZDcwZWEyYzc1MzI1Mjg3MGVlZTgyYmQ2OGNmMDRmZjQzN2QxMmY1ZTJhMzViZjU0N2E1OC0tDQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "3257" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:45 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051384000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrgb22:4240,/bns/yv/borg/yv/bns/blobstore2/bitpusher/396.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=DcysW66WCpGegQT-37-ACg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/396.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/396:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYXdSQ1M2WXgtYjJEdmpBazA2dXVSS2FmSHRBSDFRYVk3ZmNZa3VsaXNyU19rbDJRRjJNMU1oUG5UX0wwelFUa1cwbkNkQ282RXlfckF5Y2J4aFdVQzh6SXIwMFZTaXJWaElfSWgzWlljc3VRQXR6eXk3ZXdYUTlYemJ0VjM0Tm9yZzBlUFNmaWFJTjlOVWtXY0NUbWY3cXczRkNWZWhHSFZUaW1OY1hFOXhyV3ZYY0FMZzR4N2JXV3MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upo2Hgvl8XFud5oC3c-w4GBCnJ2pRoOuEIWiuJzNB7V_G-pdPLCzNdA4b9hBDqGf0zxjHaI7YyjF1fa5PoVg6u0GtAvkA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImludmFsaWQiLCJtZXNzYWdlIjoiUHJvdmlkZWQgQ1JDMzJDIFwiY0grQS9BPT1cIiBkb2Vzbid0IG1hdGNoIGNhbGN1bGF0ZWQgQ1JDMzJDIFwiY0grQSt3PT1cIi4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLmFwaS5zZXJ2ZXIuY29yZS5GYXVsdDogSW1tdXRhYmxlRXJyb3JEZWZpbml0aW9ue2Jhc2U9SU5WQUxJRF9WQUxVRSwgY2F0ZWdvcnk9VVNFUl9FUlJPUiwgY2F1c2U9bnVsbCwgZGVidWdJbmZvPW51bGwsIGRvbWFpbj1nbG9iYWwsIGV4dGVuZGVkSGVscD1udWxsLCBodHRwSGVhZGVycz17fSwgaHR0cFN0YXR1cz1iYWRSZXF1ZXN0LCBpbnRlcm5hbFJlYXNvbj1SZWFzb257YXJndW1lbnRzPXt9LCBjYXVzZT1udWxsLCBjb2RlPWdkYXRhLkNvcmVFcnJvckRvbWFpbi5JTlZBTElEX1ZBTFVFLCBjcmVhdGVkQnlCYWNrZW5kPXRydWUsIGRlYnVnTWVzc2FnZT1udWxsLCBlcnJvclByb3RvQ29kZT1JTlZBTElEX1ZBTFVFLCBlcnJvclByb3RvRG9tYWluPWdkYXRhLkNvcmVFcnJvckRvbWFpbiwgZmlsdGVyZWRNZXNzYWdlPW51bG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UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAwLCJtZXNzYWdlIjoiUHJvdmlkZWQgQ1JDMzJDIFwiY0grQS9BPT1cIiBkb2Vzbid0IG1hdGNoIGNhbGN1bGF0ZWQgQ1JDMzJDIFwiY0grQSt3PT1cIi4ifX0=" + } + }, + { + "ID": "ef48f17d06d0157a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=810d5c6fdc019b24eacbdf8682c8627d6590a79b617cff6feb47a044a0b1" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "07d0fdae8f7007415ffc49d93dd59bb2/5389098841178290090;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS04MTBkNWM2ZmRjMDE5YjI0ZWFjYmRmODY4MmM4NjI3ZDY1OTBhNzliNjE3Y2ZmNmZlYjQ3YTA0NGEwYjENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJoYXNoZXNPblVwbG9hZC0xIn0KDQotLTgxMGQ1YzZmZGMwMTliMjRlYWNiZGY4NjgyYzg2MjdkNjU5MGE3OWI2MTdjZmY2ZmViNDdhMDQ0YTBiMQ0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCkkgY2FuJ3Qgd2FpdCB0byBiZSB2ZXJpZmllZA0KLS04MTBkNWM2ZmRjMDE5YjI0ZWFjYmRmODY4MmM4NjI3ZDY1OTBhNzliNjE3Y2ZmNmZlYjQ3YTA0NGEwYjEtLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3414" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:45 GMT" + ], + "Etag": [ + "CN6r5uSW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051384000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrkb18:4313,/bns/yr/borg/yr/bns/blobstore2/bitpusher/108.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=DcysW86fDYSf4QTOgaLYAg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/108.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/108:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYXdSQ1M2WXgtYjJEdmpBazA2dXVSS2FmSHRBSDFRYVk3ZmNZa3VsaXNyU19rbDJRRjJNMU1oUG5UX0wwelFUa1cwbkNkQ282RXlfckF5Y2J4aFdVQzh6SXIwMFZTaXJWaElfSWgzWlljc3VRQXR6eXk3ZXdYUTlYemJ0VjM0Tm9yZzBlUFNmaWFJTjlOVWtXY0NUbWY3cXczRkNWZWhHSFZUaW1OY1hFOXhyV3ZYY0FMZzR4N2JXV3MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-U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dzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNONnI1dVNXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiY0grQSt3PT0iLCJldGFnIjoiQ042cjV1U1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "aeb6be04bcc74ba0", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=ae418d65701db297ce527d2c120467ecb1ee80f563d94aee4866cbc0fd1b" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "25460195dd401365eac6bbd3a60d65a6/6148135806304520954;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1hZTQxOGQ2NTcwMWRiMjk3Y2U1MjdkMmMxMjA0NjdlY2IxZWU4MGY1NjNkOTRhZWU0ODY2Y2JjMGZkMWINCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm1kNUhhc2giOiJvZlpqR2xjWFBKaUdPQWZLRmJKbDFRPT0iLCJuYW1lIjoiaGFzaGVzT25VcGxvYWQtMSJ9Cg0KLS1hZTQxOGQ2NTcwMWRiMjk3Y2U1MjdkMmMxMjA0NjdlY2IxZWU4MGY1NjNkOTRhZWU0ODY2Y2JjMGZkMWINCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA0KDQpJIGNhbid0IHdhaXQgdG8gYmUgdmVyaWZpZWQNCi0tYWU0MThkNjU3MDFkYjI5N2NlNTI3ZDJjMTIwNDY3ZWNiMWVlODBmNTYzZDk0YWVlNDg2NmNiYzBmZDFiLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3414" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:46 GMT" + ], + "Etag": [ + "CP+iiuWW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051384000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrv5:4481,/bns/yv/borg/yv/bns/blobstore2/bitpusher/192.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=DcysW4P-L8HMggTy3YG4Bw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/192.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/192:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYXdSQ1M2WXgtYjJEdmpBazA2dXVSS2FmSHRBSDFRYVk3ZmNZa3VsaXNyU19rbDJRRjJNMU1oUG5UX0wwelFUa1cwbkNkQ282RXlfckF5Y2J4aFdVQzh6SXIwMFZTaXJWaElfSWgzWlljc3VRQXR6eXk3ZXdYUTlYemJ0VjM0Tm9yZzBlUFNmaWFJTjlOVWtXY0NUbWY3cXczRkNWZWhHSFZUaW1OY1hFOXhyV3ZYY0FMZzR4N2JXV3MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uri8JdVC7RYskcBM7EGhdtoW5uklcAnOgF98hGO545bvZD8IZyoFJ244dd5cMUw1-BPBoJPZvrk2B9_Lpki5xeRUxX_tw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9oYXNoZXNPblVwbG9hZC0xLzE1MzgwNTEwODYxMjc0ODciLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby9oYXNoZXNPblVwbG9hZC0xIiwibmFtZSI6Imhhc2hlc09uVXBsb2FkLTEiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA4NjEyNzQ4NyIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo0Ni4xMjdaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NDYuMTI3WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjQ2LjEyN1oiLCJzaXplIjoiMjciLCJtZDVIYXNoIjoib2ZaakdsY1hQSmlHT0FmS0ZiSmwxUT09IiwibWVkaWFMaW5rIjoiaHR0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NyIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNQK2lpdVdXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiY0grQSt3PT0iLCJldGFnIjoiQ1AraWl1V1cyOTBDRUFFPSJ9" + } + }, + { + "ID": "25cfb3bb34ff59eb", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=0624f19c3413a5672f41d77972dec9fc931b569bfd152be7463506856c40" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7b7d2972cae2d70e4f634e9d1c57cd4b/6979228170757168457;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0wNjI0ZjE5YzM0MTNhNTY3MmY0MWQ3Nzk3MmRlYzlmYzkzMWI1NjliZmQxNTJiZTc0NjM1MDY4NTZjNDANCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm1kNUhhc2giOiJvdlpqR2xjWFBKaUdPQWZLRmJKbDFRPT0iLCJuYW1lIjoiaGFzaGVzT25VcGxvYWQtMSJ9Cg0KLS0wNjI0ZjE5YzM0MTNhNTY3MmY0MWQ3Nzk3MmRlYzlmYzkzMWI1NjliZmQxNTJiZTc0NjM1MDY4NTZjNDANCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOA0KDQpJIGNhbid0IHdhaXQgdG8gYmUgdmVyaWZpZWQNCi0tMDYyNGYxOWMzNDEzYTU2NzJmNDFkNzc5NzJkZWM5ZmM5MzFiNTY5YmZkMTUyYmU3NDYzNTA2ODU2YzQwLS0NCg==" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "3471" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:46 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051384000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrmj23:4408,/bns/yv/borg/yv/bns/blobstore2/bitpusher/357.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=DsysW_WBD5CDgQS0t7uoDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/357.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/357:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYXdSQ1M2WXgtYjJEdmpBazA2dXVSS2FmSHRBSDFRYVk3ZmNZa3VsaXNyU19rbDJRRjJNMU1oUG5UX0wwelFUa1cwbkNkQ282RXlfckF5Y2J4aFdVQzh6SXIwMFZTaXJWaElfSWgzWlljc3VRQXR6eXk3ZXdYUTlYemJ0VjM0Tm9yZzBlUFNmaWFJTjlOVWtXY0NUbWY3cXczRkNWZWhHSFZUaW1OY1hFOXhyV3ZYY0FMZzR4N2JXV3MwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Gu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bGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwMCwibWVzc2FnZSI6IlByb3ZpZGVkIE1ENSBoYXNoIFwib3ZaakdsY1hQSmlHT0FmS0ZiSmwxUT09XCIgZG9lc24ndCBtYXRjaCBjYWxjdWxhdGVkIE1ENSBoYXNoIFwib2ZaakdsY1hQSmlHT0FmS0ZiSmwxUT09XCIuIn19" + } + }, + { + "ID": "a9c389a0eb73daac", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/iam?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "cdb1ae8a9c42469760476bfb84eddd22/8569640074824319720;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/iam?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "341" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:46 GMT" + ], + "Etag": [ + "CAk=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:46 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051386000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrae1:4130,/bns/yw/borg/yw/bns/blobstore2/bitpusher/82.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=DsysW_KeFtbyhQTW3Ls4" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/82.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/82:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYTRrVFBYeTRJSTVPN2VpalFwWjI0ZFpXMU1Ka1poUnI5WWRHUWg1V1NzZHAzWDh4M0RSZ2pvZ1pUVHJVa0M1ZzJGa2hNY1ZyNVFrTmRLaXdVWjg5UXY0T2hlaUhtR2d3RlU0ekY1djJWVFp3Unh5ZEs2Z1ZpVnRaRG1SZUp6VmkyYlhNVjVlQmdhcVQ1aGlDWEdLUl9VYmdJTDlXOVl5dWUteEpIVXNSR0JiRm0tSFhJN0VTWVhaSzgwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqBlHo09PoYV5xODCs727aMaz6gcs8xf5X07yZ7EjlXbKW2xwoDRGr4rew96LrtIrP7TfqFxvPETZbtq9gAiKDN8IReWA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNwb2xpY3kiLCJyZXNvdXJjZUlkIjoicHJvamVjdHMvXy9idWNrZXRzL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImJpbmRpbmdzIjpbeyJyb2xlIjoicm9sZXMvc3RvcmFnZS5sZWdhY3lCdWNrZXRPd25lciIsIm1lbWJlcnMiOlsicHJvamVjdEVkaXRvcjpkdWxjZXQtcG9ydC03NjIiLCJwcm9qZWN0T3duZXI6ZHVsY2V0LXBvcnQtNzYyIl19LHsicm9sZSI6InJvbGVzL3N0b3JhZ2UubGVnYWN5QnVja2V0UmVhZGVyIiwibWVtYmVycyI6WyJwcm9qZWN0Vmlld2VyOmR1bGNldC1wb3J0LTc2MiJdfV0sImV0YWciOiJDQWs9In0=" + } + }, + { + "ID": "a0c231629f1b0830", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/iam?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "317" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "45dd37de1332888471197c7ded953d2b/10160051978874759302;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/iam?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJiaW5kaW5ncyI6W3sibWVtYmVycyI6WyJwcm9qZWN0RWRpdG9yOmR1bGNldC1wb3J0LTc2MiIsInByb2plY3RPd25lcjpkdWxjZXQtcG9ydC03NjIiXSwicm9sZSI6InJvbGVzL3N0b3JhZ2UubGVnYWN5QnVja2V0T3duZXIifSx7Im1lbWJlcnMiOlsicHJvamVjdFZpZXdlcjpkdWxjZXQtcG9ydC03NjIiXSwicm9sZSI6InJvbGVzL3N0b3JhZ2UubGVnYWN5QnVja2V0UmVhZGVyIn0seyJtZW1iZXJzIjpbInByb2plY3RWaWV3ZXI6ZHVsY2V0LXBvcnQtNzYyIl0sInJvbGUiOiJyb2xlcy9zdG9yYWdlLm9iamVjdFZpZXdlciJ9XSwiZXRhZyI6IkNBaz0ifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "423" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:47 GMT" + ], + "Etag": [ + "CAo=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051386000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrsn11:4209,/bns/yv/borg/yv/bns/blobstore2/bitpusher/290.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=DsysW5mCJYvRgQTe5JKYDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/290.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/290:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYTRrVFBYeTRJSTVPN2VpalFwWjI0ZFpXMU1Ka1poUnI5WWRHUWg1V1NzZHAzWDh4M0RSZ2pvZ1pUVHJVa0M1ZzJGa2hNY1ZyNVFrTmRLaXdVWjg5UXY0T2hlaUhtR2d3RlU0ekY1djJWVFp3Unh5ZEs2Z1ZpVnRaRG1SZUp6VmkyYlhNVjVlQmdhcVQ1aGlDWEdLUl9VYmdJTDlXOVl5dWUteEpIVXNSR0JiRm0tSFhJN0VTWVhaSzgwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UouvH87NAtIZRYuefULe5I19LMPKuAlFjo8gRWzOW2m8ywZl8NHM6ym9LuvwbH0mpAukabVKwFOpi6wbATQSLR6HnJdBw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNwb2xpY3kiLCJyZXNvdXJjZUlkIjoicHJvamVjdHMvXy9idWNrZXRzL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImJpbmRpbmdzIjpbeyJyb2xlIjoicm9sZXMvc3RvcmFnZS5sZWdhY3lCdWNrZXRPd25lciIsIm1lbWJlcnMiOlsicHJvamVjdEVkaXRvcjpkdWxjZXQtcG9ydC03NjIiLCJwcm9qZWN0T3duZXI6ZHVsY2V0LXBvcnQtNzYyIl19LHsicm9sZSI6InJvbGVzL3N0b3JhZ2UubGVnYWN5QnVja2V0UmVhZGVyIiwibWVtYmVycyI6WyJwcm9qZWN0Vmlld2VyOmR1bGNldC1wb3J0LTc2MiJdfSx7InJvbGUiOiJyb2xlcy9zdG9yYWdlLm9iamVjdFZpZXdlciIsIm1lbWJlcnMiOlsicHJvamVjdFZpZXdlcjpkdWxjZXQtcG9ydC03NjIiXX1dLCJldGFnIjoiQ0FvPSJ9" + } + }, + { + "ID": "144b6da1d9241efb", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/iam?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b1e1650a9d8d34458c16d574cfc635f7/11678125913438965029;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/iam?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "423" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:47 GMT" + ], + "Etag": [ + "CAo=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:47 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051386000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrwa10:4354,/bns/yr/borg/yr/bns/blobstore2/bitpusher/24.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=D8ysW6bVKY-7kASf45LYDQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/24.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/24:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYTRrVFBYeTRJSTVPN2VpalFwWjI0ZFpXMU1Ka1poUnI5WWRHUWg1V1NzZHAzWDh4M0RSZ2pvZ1pUVHJVa0M1ZzJGa2hNY1ZyNVFrTmRLaXdVWjg5UXY0T2hlaUhtR2d3RlU0ekY1djJWVFp3Unh5ZEs2Z1ZpVnRaRG1SZUp6VmkyYlhNVjVlQmdhcVQ1aGlDWEdLUl9VYmdJTDlXOVl5dWUteEpIVXNSR0JiRm0tSFhJN0VTWVhaSzgwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrORn0AA37Z-krQlzExepj1CiRXgkBL-ohkvMSncFboI2PxjqFbfe-kAqtndNv8kCO8nVJdwF0QL9kTRQsw7Z1UWaou5g" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNwb2xpY3kiLCJyZXNvdXJjZUlkIjoicHJvamVjdHMvXy9idWNrZXRzL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImJpbmRpbmdzIjpbeyJyb2xlIjoicm9sZXMvc3RvcmFnZS5sZWdhY3lCdWNrZXRPd25lciIsIm1lbWJlcnMiOlsicHJvamVjdEVkaXRvcjpkdWxjZXQtcG9ydC03NjIiLCJwcm9qZWN0T3duZXI6ZHVsY2V0LXBvcnQtNzYyIl19LHsicm9sZSI6InJvbGVzL3N0b3JhZ2UubGVnYWN5QnVja2V0UmVhZGVyIiwibWVtYmVycyI6WyJwcm9qZWN0Vmlld2VyOmR1bGNldC1wb3J0LTc2MiJdfSx7InJvbGUiOiJyb2xlcy9zdG9yYWdlLm9iamVjdFZpZXdlciIsIm1lbWJlcnMiOlsicHJvamVjdFZpZXdlcjpkdWxjZXQtcG9ydC03NjIiXX1dLCJldGFnIjoiQ0FvPSJ9" + } + }, + { + "ID": "75ef487a8b257113", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/iam/testPermissions?alt=json\u0026permissions=storage.buckets.get\u0026permissions=storage.buckets.delete\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "08ca66e09b16381170a05dabd28c307f/13268537817489404867;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/iam/testPermissions?alt=json\u0026permissions=storage.buckets.get\u0026permissions=storage.buckets.delete\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:48 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:48 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051386000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrgb22:4240,/bns/yw/borg/yw/bns/blobstore2/bitpusher/167.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=D8ysW-TXPIPwhAT094D4Cw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/167.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/167:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYTRrVFBYeTRJSTVPN2VpalFwWjI0ZFpXMU1Ka1poUnI5WWRHUWg1V1NzZHAzWDh4M0RSZ2pvZ1pUVHJVa0M1ZzJGa2hNY1ZyNVFrTmRLaXdVWjg5UXY0T2hlaUhtR2d3RlU0ekY1djJWVFp3Unh5ZEs2Z1ZpVnRaRG1SZUp6VmkyYlhNVjVlQmdhcVQ1aGlDWEdLUl9VYmdJTDlXOVl5dWUteEpIVXNSR0JiRm0tSFhJN0VTWVhaSzgwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoC8Y01kEJQMNndrzzPlPKFhvQgzyA3VhI6oytWf7ncjE_esF2ymE5i-_dPkHhV9HepRXk9dgA1pri0GaTC3OIBTsv0UQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSN0ZXN0SWFtUGVybWlzc2lvbnNSZXNwb25zZSIsInBlcm1pc3Npb25zIjpbInN0b3JhZ2UuYnVja2V0cy5nZXQiLCJzdG9yYWdlLmJ1Y2tldHMuZGVsZXRlIl19" + } + }, + { + "ID": "8c636bdcc9eea5d0", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "93" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "651a6846b9563d5640c8d4c98b925186/14858948622061705314;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJiaWxsaW5nIjp7InJlcXVlc3RlclBheXMiOnRydWV9LCJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIn0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "459" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:49 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrt186:4143,/bns/yv/borg/yv/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=EMysW--5FJHLswb4lL2QAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/50:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpweAHP2xx7tNgquA6NRVU_gdpSeklRzOtSWuzv7KACvxgqSJo8lMglTq923iAXBathqwAmYY0AXW6tjE4Wv7T6G_TxHw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NDguODg2WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjQ4Ljg4NloiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJiaWxsaW5nIjp7InJlcXVlc3RlclBheXMiOnRydWV9LCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "db9e9aa20b3f272d", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/user-integration%40gcloud-golang-firestore-tests.iam.gserviceaccount.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "159" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ebbbe915bf015ecfc551f82528f67153/16449360526112079361;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/user-integration%40gcloud-golang-firestore-tests.iam.gserviceaccount.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJ1c2VyLWludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIn0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "589" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:51 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051389000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnnr1:4426,/bns/yx/borg/yx/bns/blobstore2/bitpusher/74.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=EcysW7CiCYO9zgLGiKCYAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/74.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/74:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpWAHw7IVeXEMZ_GnQKXv6PGvEtBLRnR7sTaAivOc7U2HSPZEMQycXnbcXRlp6kH8tsmEqyVTQ8rSia2NHJeoDFpZMwgQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvdXNlci1pbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9hY2wvdXNlci1pbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsImVudGl0eSI6InVzZXItaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6ImludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "9376ae75abf3dc2d", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "946e42b81d2942871e88dd356cd216c4/18039490955202651039;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2976" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:51 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:51 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051391000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbd63:4301,/bns/yr/borg/yr/bns/blobstore2/bitpusher/4.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=E8ysW8zbAY-AkATj4oWoBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/4.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/4:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqB_1uMwyjpyvhwCFL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JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtb3duZXJzLTM2NjM5OTMzMTQ1Iiwicm9sZSI6Ik9XTkVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6Im93bmVycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3QtZWRpdG9ycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJlZGl0b3JzIn0sImV0YWciOiJDQUk9In0seyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC12aWV3ZXJzLTM2NjM5OTMzMTQ1Iiwicm9sZSI6IlJFQURFUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJ2aWV3ZXJzIn0sImV0YWciOiJDQUk9In1dLCJvd25lciI6eyJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSJ9LCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJiaWxsaW5nIjp7InJlcXVlc3RlclBheXMiOnRydWV9LCJldGFnIjoiQ0FJPSJ9" + } + }, + { + "ID": "128bb0d838dfcf9f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "58f6f6f433a012e66ccd520abdf51915/1183440260520184126;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2976" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:51 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:51 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051391000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrtw20:4200,/bns/yv/borg/yv/bns/blobstore2/bitpusher/233.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=E8ysW6L4GYruggSr-I3oCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/233.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/233:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur0_BMChIpY89D5SIxg1IX7Mzvg9U-PsS9-1yP65Iz9rnXfhp367PanBonVPXZeldon4CD6ad3ZHvy-jDfGh2g2kjuDXQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA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im93bmVycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3QtZWRpdG9ycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJlZGl0b3JzIn0sImV0YWciOiJDQUk9In0seyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC12aWV3ZXJzLTM2NjM5OTMzMTQ1Iiwicm9sZSI6IlJFQURFUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJ2aWV3ZXJzIn0sImV0YWciOiJDQUk9In1dLCJvd25lciI6eyJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSJ9LCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJiaWxsaW5nIjp7InJlcXVlc3RlclBheXMiOnRydWV9LCJldGFnIjoiQ0FJPSJ9" + } + }, + { + "ID": "1d28c60b2c1aaa62", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "da28f10a14d9659d366cb18aa5d6d591/2773852164587335389;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12071" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:52 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:52 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051391000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vnba207:4324,/bns/yx/borg/yx/bns/blobstore2/bitpusher/135.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=E8ysW53eL8btzAKs_rD4CA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/135.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/135:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOIrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq7QZN5rGXMozsX4ASIM0yxatYCGxmDwDjDNFgy0g83ZPIvkJHrneIYGTsC9WssyRG14bT4ipnP5eCcYpLLXd1pLEJK0g" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6VVNFUl9QUk9KRUNUX01JU1NJTkc6IEJ1Y2tldCBpcyBSZXF1ZXN0ZXIgUGF5cyBidWNrZXQgYnV0IG5vIGJpbGxpbmcgcHJvamVjdCBpZCBwcm92aWRlZCBmb3Igbm9uLW93bmVyLlxuXHRhdCBjb20uZ29vZ2xlLmNsb3VkLmJpZ3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xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwMCwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4ifX0=" + } + }, + { + "ID": "5ac686ece3e25d68", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "bd4deb7c00fc6498c75a32d0d5bf5eef/4364262964848022651;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2976" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:52 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:52 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051392000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrcf25:4489,/bns/yr/borg/yr/bns/blobstore2/bitpusher/38.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FMysW6ObAq-NkAS0m4uIDQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/38.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/38:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOIrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrP1A6KQZYe1fSfdQklQD3Li6UV647Oa2MVILnNtCnDCjzZnmXniTW3emikNnz1oiPQBa6rlnhFSmeh_tUg3Xn7uMcNjw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NDguODg2WiIsIn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NjM5OTMzMTQ1Iiwicm9sZSI6IlJFQURFUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJ2aWV3ZXJzIn0sImV0YWciOiJDQUk9In1dLCJvd25lciI6eyJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSJ9LCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJiaWxsaW5nIjp7InJlcXVlc3RlclBheXMiOnRydWV9LCJldGFnIjoiQ0FJPSJ9" + } + }, + { + "ID": "01d97c7a0e0c6ad6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "951a587dc6dd7039ad69e1977096a8c0/5954393398233430298;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12927" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:52 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:52 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051392000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vray62:4018,/bns/yr/borg/yr/bns/blobstore2/bitpusher/49.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FMysW8m4B43q4QSDmZy4Ag" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/49.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/49:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOIrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpgFD6v6LBuWvl36FBHOwD0dgc-Iy4UFOJ0HZ_er9KgJJtoQwQP7EPy-gBByK6x9f-sOmzxQ_rg9ZJHf6RaVlrEUtRdwQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZS5SZXNwb25zZUNvZGUuRXJyb3JDb2RlOjpVU0VSX1BST0pFQ1RfQUNDRVNTX0RFTklFRDogaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20gZG9lcyBub3QgaGF2ZSBzZXJ2aWNldXNhZ2Uuc2VydmljZXMudXNlIGFjY2VzcyB0byBwcm9qZWN0IDY0MjA4MDkxODEwMS5cblx0YXQgY29tLmdvb2dsZS5jbG91ZC5iaWdzdG9yZS5jb21tb24uQmlnc3RvcmVFeGNlcHRpb24udG9ScGMzRXhjZXB0aW9uKEJpZ3N0b3JlRXhjZXB0aW9uLmphdmE6MTM1KVxuXHRhdCBjb20uZ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h0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwMywibWVzc2FnZSI6ImludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIGRvZXMgbm90IGhhdmUgc2VydmljZXVzYWdlLnNlcnZpY2VzLnVzZSBhY2Nlc3MgdG8gcHJvamVjdCA2NDIwODA5MTgxMDEuIn19" + } + }, + { + "ID": "f381b18f194a2f5c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=2a42e09cb0222d57d0cdbda1a68340bdb1fdca64a8c063a41cf471868a60" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "cdaf842a27589d153e2b9d276966c883/6713711838336371817;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0yYTQyZTA5Y2IwMjIyZDU3ZDBjZGJkYTFhNjgzNDBiZGIxZmRjYTY0YThjMDYzYTQxY2Y0NzE4NjhhNjANCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJmb28ifQoNCi0tMmE0MmUwOWNiMDIyMmQ1N2QwY2RiZGExYTY4MzQwYmRiMWZkY2E2NGE4YzA2M2E0MWNmNDcxODY4YTYwDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NCg0KaGVsbG8NCi0tMmE0MmUwOWNiMDIyMmQ1N2QwY2RiZGExYTY4MzQwYmRiMWZkY2E2NGE4YzA2M2E0MWNmNDcxODY4YTYwLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3226" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:52 GMT" + ], + "Etag": [ + "COSsl+iW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqm14:4229,/bns/yw/borg/yw/bns/blobstore2/bitpusher/203.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FMysW-C5FJW6N5Kzm8gE" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/203.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/203:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqkxLDMvcle5zEJBY34RLPtNVKJ1fnbATAahxz6t3qxFKd95_AEw1vsPKhIMG-xQA9v7eqd3F12o1YJnnGyCUclEv4f-A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTA5MjYzMzE4OCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9vL2ZvbyIsIm5hbWUiOiJmb28iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA5MjYzMzE4OCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo1Mi42MzNaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NTIuNjMzWiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjUyLjYzM1oiLCJzaXplIjoiNSIsIm1kNUhhc2giOiJYVUZBS3J4TEtuYTVjWjJSRUJmRmtnPT0iLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9z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aHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDT1NzbCtpVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Im1uRzdUQT09IiwiZXRhZyI6IkNPU3NsK2lXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "adbe5cfd07f61e80", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=7106bfacec7d6a09fd14fd37931b02367585ee2e8c64645316750dfde543" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "238f7c250ffab02d2bd5182bfd9cc71f/7544805302283804601;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS03MTA2YmZhY2VjN2Q2YTA5ZmQxNGZkMzc5MzFiMDIzNjc1ODVlZTJlOGM2NDY0NTMxNjc1MGRmZGU1NDMNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJmb28ifQoNCi0tNzEwNmJmYWNlYzdkNmEwOWZkMTRmZDM3OTMxYjAyMzY3NTg1ZWUyZThjNjQ2NDUzMTY3NTBkZmRlNTQzDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NCg0KaGVsbG8NCi0tNzEwNmJmYWNlYzdkNmEwOWZkMTRmZDM3OTMxYjAyMzY3NTg1ZWUyZThjNjQ2NDUzMTY3NTBkZmRlNTQzLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3226" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:53 GMT" + ], + "Etag": [ + "CMT2r+iW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbp5:4114,/bns/yr/borg/yr/bns/blobstore2/bitpusher/105.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FMysW-CJLpCMkATtpaSoDA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/105.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/105:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urq35CFb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1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Im1uRzdUQT09IiwiZXRhZyI6IkNNVDJyK2lXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "6974381989098ccd", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=237260ec54bf8dc245243faeb66dd61b18510d622730eeecd6b6a1afcc5d" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1aed5d989e814f60adeabf2f067063e6/8303842271721779464;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0yMzcyNjBlYzU0YmY4ZGMyNDUyNDNmYWViNjZkZDYxYjE4NTEwZDYyMjczMGVlZWNkNmI2YTFhZmNjNWQNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJmb28ifQoNCi0tMjM3MjYwZWM1NGJmOGRjMjQ1MjQzZmFlYjY2ZGQ2MWIxODUxMGQ2MjI3MzBlZWVjZDZiNmExYWZjYzVkDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NCg0KaGVsbG8NCi0tMjM3MjYwZWM1NGJmOGRjMjQ1MjQzZmFlYjY2ZGQ2MWIxODUxMGQ2MjI3MzBlZWVjZDZiNmExYWZjYzVkLS0NCg==" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "12135" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:53 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051393000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrow18:4419,/bns/yv/borg/yv/bns/blobstore2/bitpusher/140.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FcysW6OhCpKCgwS2iqKgDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/140.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/140:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOMrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq7BisLbYLLhOtKX-mgm0uHF_EpDdlc9SsVqVhxUDic-GBgzAoE7XUNzqShAPyuJo_tMYfFtXlNE0F8qnAFCl579XxCCw" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6VVNFUl9QUk9KRUNUX01JU1NJTkc6IEJ1Y2tldCBpcyBSZXF1ZXN0ZXIgUGF5cyBidWNrZXQgYnV0IG5vIGJpbGxpbmcgcH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Milcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLkN1cnJlbnRDb250ZXh0LnJ1bkluQ29udGV4dChDdXJyZW50Q29udGV4dC5qYXZhOjMyMClcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dE5vVW5yZWYoVHJhY2VDb250ZXh0LmphdmE6MzIxKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "2708a38f17248e4e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=21fc50710a2e85a9df16ae976a592eee89a3bf61d5a3cc00d589f4ea436b" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c835286d2a2f023e4587c8da313787d1/9135217202056119383;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0yMWZjNTA3MTBhMmU4NWE5ZGYxNmFlOTc2YTU5MmVlZTg5YTNiZjYxZDVhM2NjMDBkNTg5ZjRlYTQzNmINCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJmb28ifQoNCi0tMjFmYzUwNzEwYTJlODVhOWRmMTZhZTk3NmE1OTJlZWU4OWEzYmY2MWQ1YTNjYzAwZDU4OWY0ZWE0MzZiDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NCg0KaGVsbG8NCi0tMjFmYzUwNzEwYTJlODVhOWRmMTZhZTk3NmE1OTJlZWU4OWEzYmY2MWQ1YTNjYzAwZDU4OWY0ZWE0MzZiLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3181" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:53 GMT" + ], + "Etag": [ + "CISC0OiW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051393000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vnpb10:4017,/bns/yx/borg/yx/bns/blobstore2/bitpusher/49.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FcysW-mhGoqIzQKVwKT4Aw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/49.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/49:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOMrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoNEzfQSF71KAopZ_IPoXU_ysPiMxX66AcMFT8VzLfFCCP-ZNcVBHqt60lvdWZMihDQq4TALbx_UZJwzMoH7ZB-Y7tmfg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTA5MzU2MTYwNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9vL2ZvbyIsIm5hbWUiOiJmb28iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA5MzU2MTYwNCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo1My41NjFaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NTMuNTYxWiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbG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1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDSVNDME9pVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLWludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Im1uRzdUQT09IiwiZXRhZyI6IkNJU0MwT2lXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "3528b2e1f97481d7", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=1683011057ae3f3e81c417873b5bac49a2246cb943117ba7e6822fbe4dba" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "18ff62e9ecc16f2dd761505112b6b3f2/9894254171477252007;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0xNjgzMDExMDU3YWUzZjNlODFjNDE3ODczYjViYWM0OWEyMjQ2Y2I5NDMxMTdiYTdlNjgyMmZiZTRkYmENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJmb28ifQoNCi0tMTY4MzAxMTA1N2FlM2YzZTgxYzQxNzg3M2I1YmFjNDlhMjI0NmNiOTQzMTE3YmE3ZTY4MjJmYmU0ZGJhDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NCg0KaGVsbG8NCi0tMTY4MzAxMTA1N2FlM2YzZTgxYzQxNzg3M2I1YmFjNDlhMjI0NmNiOTQzMTE3YmE3ZTY4MjJmYmU0ZGJhLS0NCg==" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "12991" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:53 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051393000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vnbe67:4474,/bns/yx/borg/yx/bns/blobstore2/bitpusher/55.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FcysW9bbKcKPzALhvZOIDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/55.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/55:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOMrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UryciEENEv-7rhlVHwecRoi4eIpPLkD9snDJxBdIg21D_qc_UQsZpaChX7XUPxFv4qrYSgtLftJ_LWGxBvbvjJBToeaqg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2x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pY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "93dbfc48d4e0ae67", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b7f3940371552e2fe7340e3824bb07ef/11484666075544468549;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "5" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:53 GMT" + ], + "Etag": [ + "\"5d41402abc4b2a76b9719d911017c592\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:53 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1538051093561604" + ], + "X-Goog-Hash": [ + "crc32c=mnG7TA==", + "md5=XUFAKrxLKna5cZ2REBfFkg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "5" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/43,/bns/xh/borg/xh/bns/blobstore2/bitpusher/64.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FcysW_nbOMKmswayqIGIDg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/64.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/64:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UobYLQCVAXDkWBxGuaLG3DcCe_4MnWObiBBQ3HESP7N-QS5GnqnFP4_tMrgvjZ9QyyllwC0UGwfoeVUplyqoPXVM8af3w" + ] + }, + "Body": "aGVsbG8=" + } + }, + { + "ID": "ed6543d15a309ca2", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "74c8e0a2cd370f802a2c638fad744a1e/13074795409418248932;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo" + ], + "X-Goog-User-Project": [ + "dulcet-port-762" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "5" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:54 GMT" + ], + "Etag": [ + "\"5d41402abc4b2a76b9719d911017c592\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:53 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1538051093561604" + ], + "X-Goog-Hash": [ + "crc32c=mnG7TA==", + "md5=XUFAKrxLKna5cZ2REBfFkg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "5" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/12,/bns/xh/borg/xh/bns/blobstore2/bitpusher/28.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FsysW4mqAouhswbl1qKYBg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/28.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/28:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur7qo9qqOxLPqeOJg3_hC6Lw6aEFXRvIfjwfeJ60wJcvPZkkUlHiIGTpY9BY1Av4e8U2DJH2LL0G6dUQ9iYWAqlb0GiIA" + ] + }, + "Body": "aGVsbG8=" + } + }, + { + "ID": "e1568d1781fe6674", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "14d9ea9e4c04369d531fe44c64494f92/14665207309190498179;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "266" + ], + "Content-Type": [ + "application/xml; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:54 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:54 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/45,/bns/xh/borg/xh/bns/blobstore2/bitpusher/52.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FsysW-vABbCqswa-pIPADw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/52.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/52:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrhJXGAWNxkg2lwZ7HPMDSI-cZdGgnrHDLOt-Vn4GIt6Py6SXjBikyUW--bL8PD6_H-VDdhf90i-L0t6SMFjJvfOx4vaQ" + ] + }, + "Body": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48RXJyb3I+PENvZGU+VXNlclByb2plY3RNaXNzaW5nPC9Db2RlPjxNZXNzYWdlPkJ1Y2tldCBpcyBhIHJlcXVlc3RlciBwYXlzIGJ1Y2tldCBidXQgbm8gdXNlciBwcm9qZWN0IHByb3ZpZGVkLjwvTWVzc2FnZT48RGV0YWlscz5CdWNrZXQgaXMgUmVxdWVzdGVyIFBheXMgYnVja2V0IGJ1dCBubyBiaWxsaW5nIHByb2plY3QgaWQgcHJvdmlkZWQgZm9yIG5vbi1vd25lci48L0RldGFpbHM+PC9FcnJvcj4=" + } + }, + { + "ID": "6408084335935ff1", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e96ce5b68f60f903ab1b5198c8f9f580/16255619213240937761;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo" + ], + "X-Goog-User-Project": [ + "gcloud-golang-firestore-tests" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "5" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:54 GMT" + ], + "Etag": [ + "\"5d41402abc4b2a76b9719d911017c592\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:24:53 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1538051093561604" + ], + "X-Goog-Hash": [ + "crc32c=mnG7TA==", + "md5=XUFAKrxLKna5cZ2REBfFkg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "5" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/12,/bns/xh/borg/xh/bns/blobstore2/bitpusher/79.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FsysW7bnE-6jswbStIHACg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/79.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/79:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoVhfv-eFV4ZRHB30hin-A2fc9MasLv3xA4ppkx8fs1rqGq5kaqhAwHg2LHt1HBr-7TjnfZTbDFTpfyUBdCX42usFy41w" + ] + }, + "Body": "aGVsbG8=" + } + }, + { + "ID": "c5b24411d8fb2531", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9733323f0f15db56551241ac7d27e645/17846031117308089024;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0003/foo" + ], + "X-Goog-User-Project": [ + "veener-jba" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "342" + ], + "Content-Type": [ + "application/xml; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:54 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:54 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/47,/bns/xh/borg/xh/bns/blobstore2/bitpusher/62.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FsysW6CcF8SmswaLopWwDA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/62.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/62:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpUnfRLufy7QUE_x8D4JMhXS7A6KYYHAUkUJA-0_EiWVsKAOCcy6GDqTTNo_wExvSNqJq_MgNWUhaA1shGpfMMAXVCxsA" + ] + }, + "Body": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48RXJyb3I+PENvZGU+VXNlclByb2plY3RBY2Nlc3NEZW5pZWQ8L0NvZGU+PE1lc3NhZ2U+UmVxdWVzdGVyIGRvZXMgbm90IGhhdmUgc2VydmljZXVzYWdlLnNlcnZpY2VzLnVzZSBwZXJtaXNzaW9ucyBvbiB1c2VyIHByb2plY3QuPC9NZXNzYWdlPjxEZXRhaWxzPmludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIGRvZXMgbm90IGhhdmUgc2VydmljZXVzYWdlLnNlcnZpY2VzLnVzZSBhY2Nlc3MgdG8gcHJvamVjdCA2NDIwODA5MTgxMDEuPC9EZXRhaWxzPjwvRXJyb3I+" + } + }, + { + "ID": "8df5a8e8cb3018e1", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4ba0fb6a6b4f3829036eec3ca23cbeda/989698947649042526;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3181" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:54 GMT" + ], + "Etag": [ + "CISC0OiW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051394000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vncd130:4493,/bns/yx/borg/yx/bns/blobstore2/bitpusher/122.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FsysW5auJsGRzgLopLngBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/122.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/122:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upoxk0CnjyS_LCHnK0OHBf9KRPtZkRYgFF1U7mN-8kApCVZhY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iZXRhZyI6IkNJU0MwT2lXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "c9a00d099267754b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "12bc837e44bbea07fcd1c9cae382a949/2580109752221343229;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3181" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:54 GMT" + ], + "Etag": [ + "CISC0OiW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051391000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrti20:4165,/bns/yv/borg/yv/bns/blobstore2/bitpusher/243.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FsysW6vgK4GngASMt5uwAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/243.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/243:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur7tVi6j5IKT88SZhVKIWnUX_O-9IBWvMpw9b7nG_MsOiFfb_ZAEJ8WMbvtPnRCuooB3MuHPNjvgYUM7iqQNkeEK-O7hA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTA5MzU2MTYwNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9vL2ZvbyIsIm5hbWUiOiJmb28iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA5MzU2MTYwNCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo1My41NjFaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NTMuNTYxWiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjUzLjU2MVoiLCJzaXplIjoiNSIsIm1kNUhhc2giOiJYVUZBS3J4TEtuYTVjWjJSRUJmRmtnPT0iLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9zdG9yY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V0YWciOiJDSVNDME9pVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLWludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Im1uRzdUQT09IiwiZXRhZyI6IkNJU0MwT2lXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "9a3b957752d48171", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ecd1f92caab5532b924399a8f7e47269/4170521656271717276;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12075" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:55 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:55 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051392000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vraf24:4012,/bns/yv/borg/yv/bns/blobstore2/bitpusher/260.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=FsysW6_EMMSZggTQn4ToBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/260.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/260:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOIrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-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F1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "3bc47ee9c62df6c9", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "112b4515ed2175eacbd1552e9e0df785/5760933560338933818;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3181" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:55 GMT" + ], + "Etag": [ + "CISC0OiW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051392000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrpz1:4175,/bns/yr/borg/yr/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=F8ysW5LoAc_44QSlq4TwBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/50:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOIrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpBML43rDsc3BbW5t3GZgCV1N2yVVsV3lXOGGpwJ6pnuDNngAuI9haDrqdayPI4-QWT_n2MLiw9D7weWUPzXkOmFExouA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTA5MzU2MTYwNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9vL2ZvbyIsIm5hbWUiOiJmb28iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA5MzU2MTYwNCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo1My41NjFaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NTMuNTYxWiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjUzLjU2MVoiLCJzaXplIjoiNSIsIm1kNUhhc2giOiJYVUZBS3J4TEtuYTVjWjJSRUJmRmtnPT0iLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9zdG9yYWd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YWciOiJDSVNDME9pVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLWludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Im1uRzdUQT09IiwiZXRhZyI6IkNJU0MwT2lXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "f8fb7a2aa56abc06", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "744a7cbe721801da11024f6426d65bbf/7279007494886362841;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12931" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:55 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:55 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051392000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vran71:4007,/bns/yr/borg/yr/bns/blobstore2/bitpusher/10.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=F8ysW43DBtHnkAOQzqSwAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/10.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/10:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOIrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-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SW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDMsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "2b1325dbeea3872c", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "85" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "dc89e7f65b102435e4a85a2c6f3d0fe1/8869419398953513848;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJjb250ZW50TGFuZ3VhZ2UiOiJlbiJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3204" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:55 GMT" + ], + "Etag": [ + "CISC0OiW290CEAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051389000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnap189:4365,/bns/yx/borg/yx/bns/blobstore2/bitpusher/57.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=F8ysW5T4E4qJzAKRg7nIAg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/57.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/57:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up-47Gg-U0R8d-RLZoqr0iirAWrSZKYpf1bvmSFFRKVEL0OT2hoDOMTUj46Ame11lFsY3aGMuv14up8TGKyQKvdhnCqqQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTA5MzU2MTYwNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9vL2ZvbyIsIm5hbWUiOiJmb28iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA5MzU2MTYwNCIsIm1ldGFnZW5lcmF0aW9uIjoiMiIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVh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nRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJvYmplY3QiOiJmb28iLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA5MzU2MTYwNCIsImVudGl0eSI6InVzZXItaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6ImludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJU0MwT2lXMjkwQ0VBST0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibW5HN1RBPT0iLCJldGFnIjoiQ0lTQzBPaVcyOTBDRUFJPSJ9" + } + }, + { + "ID": "a519c18e9f0f3556", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "85" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "00762968e68ef9b348fedb6bec219c24/10459830203509102870;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJjb250ZW50TGFuZ3VhZ2UiOiJlbiJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3204" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:55 GMT" + ], + "Etag": [ + "CISC0OiW290CEAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrcf25:4489,/bns/yv/borg/yv/bns/blobstore2/bitpusher/358.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=F8ysW-WHIsSCgQTU6r3QDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/358.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/358:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq0-3_a-xcQuKPTmZwhCGyz98TpMddMzH9WhBX0BX6-pSaBjKeo6G2eV8LS7gmCZBLp0Rj2EXkBswc12Wecd0Ecw3Dv8Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTA5MzU2MTYwNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3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zdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvby9mb28vYWNsL3VzZXItaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJvYmplY3QiOiJmb28iLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA5MzU2MTYwNCIsImVudGl0eSI6InVzZXItaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6ImludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJU0MwT2lXMjkwQ0VBTT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibW5HN1RBPT0iLCJldGFnIjoiQ0lTQzBPaVcyOTBDRUFNPSJ9" + } + }, + { + "ID": "c3cce5ec7cc787d6", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "85" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9e18d8b893776dab3395aa50220c672a/12049960632599609013;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJjb250ZW50TGFuZ3VhZ2UiOiJlbiJ9Cg==" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "12267" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:56 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vraz3:4225,/bns/yw/borg/yw/bns/blobstore2/bitpusher/168.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=F8ysW6y0L4bShQS_rrGoAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/168.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/168:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqCww9J5OJXbjsyOgthOsXt3HmpChxjzf0o2zldcFmEHWWogW74ItLioX44a7LE8TOEIeVT5b5F8Woc-pDN1uqe3PXA__eDRxpoQtcr9JUpytjdAIo" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZ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VxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "752f44d89c504490", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "85" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fbf85c1c6cad40a2542fd31defb3775c/13640372536649983060;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJjb250ZW50TGFuZ3VhZ2UiOiJlbiJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3204" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:56 GMT" + ], + "Etag": [ + "CISC0OiW290CEAQ=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vral124:4458,/bns/yv/borg/yv/bns/blobstore2/bitpusher/270.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=GMysW77MAoykNvW7uMAB" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/270.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/270:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq5s8h_ClmvAT1wvmhEg6lcQZi4y5nQBDFtjp5Xc8aSPQ1d_Gzr4jPlw6R6Mh2t9Rmm2BQsim7mcgUzDhWSkberqA9QoA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTA5MzU2MTYwNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9vL2ZvbyIsIm5hbWUiOiJmb28iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTA5MzU2MTYwNCIsIm1ldGFnZW5lcmF0aW9uIjoiNCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNDo1My41NjFaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjQ6NTYuMTI2WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI0OjUzLjU2MVoiLCJzaXplIjoiNSIsIm1kNUhhc2giOiJYVUZBS3J4TEtuYTVjWjJSRUJmRmtnPT0iLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5n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lyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJU0MwT2lXMjkwQ0VBUT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibW5HN1RBPT0iLCJldGFnIjoiQ0lTQzBPaVcyOTBDRUFRPSJ9" + } + }, + { + "ID": "fdf00574ab80e155", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "85" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8d2a0740d223b423b497bc4917e09558/15230784440717199858;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJjb250ZW50TGFuZ3VhZ2UiOiJlbiJ9Cg==" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13123" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:56 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrbj128:4260,/bns/yv/borg/yv/bns/blobstore2/bitpusher/266.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=GMysW8aBD5CcNsOPmzA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/266.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/266:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqbgqQTG9YR1fSqJ3ZOa8nTDVoLdEfeP_eYQL1M9VymnALeOi2fekzhEIS0D2KbKg0S1c0AE1i0UoUcDhzaysqUcZcVaA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZS5SZXNwb25zZUNvZGUuRXJyb3JDb2RlOjpVU0VSX1BST0pFQ1RfQUNDRVNTX0RFTklFRDogaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20gZG9lcyBub3QgaGF2ZSBzZXJ2aWNldXNhZ2Uuc2VydmljZXMudXNlIGFjY2VzcyB0byBwcm9qZWN0IDY0MjA4MDkxODEwMS5cblx0YXQgY29tLmdvb2dsZS5jbG91ZC5iaWdzdG9yZS5jb21tb24uQmlnc3RvcmVFeGNlcHRpb24udG9ScGMzRXhjZXB0aW9uKEJpZ3N0b3JlRXhjZXB0aW9uLmphdmE6MTM1KVxuXHRhdCBjb20uZ29vZ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1bkluSW5oZXJpdGVkQ29udGV4dE5vVW5yZWYoVHJhY2VDb250ZXh0LmphdmE6MzIxKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDMsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "733f05aa99a1b338", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7439171b6a0e81d123cfb2ed26494232/16821196344784350865;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "377" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:57 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrm69:4161,/bns/yr/borg/yr/bns/blobstore2/bitpusher/88.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=GMysW6ewGpLM4QSw77fYDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/88.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/88:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoG9K7qu7HNcJwAGEehEQ7PUq-KVQmO_y1KTGmEbkmtpzFkaLuby68m1a_c81S2oFw1zwOVQ2XyO6zIEyfnUccAQNv2oA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvZG9tYWluLWdvb2dsZS5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvYWNsL2RvbWFpbi1nb29nbGUuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwiZW50aXR5IjoiZG9tYWluLWdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZG9tYWluIjoiZ29vZ2xlLmNvbSIsImV0YWciOiJDQU09In0=" + } + }, + { + "ID": "2a8d19324f3c9a1b", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1012d9e9a711e5d8ac2dfaae707d9658/18411325674363229232;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "377" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:58 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrhq15:4330,/bns/yr/borg/yr/bns/blobstore2/bitpusher/66.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=GsysW_uuAYj8kAPe152IBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/66.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/66:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UruXPkBA8n56dNnA2rFK5H30i18sXuEkReZ5SWOkW0lzsEVNDxsFREolod7ciOW26miWa0UTbY1kmC930gm5bLHNzxb-A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvZG9tYWluLWdvb2dsZS5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvYWNsL2RvbWFpbi1nb29nbGUuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwiZW50aXR5IjoiZG9tYWluLWdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZG9tYWluIjoiZ29vZ2xlLmNvbSIsImV0YWciOiJDQU09In0=" + } + }, + { + "ID": "a94b33412193c147", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3a2fbf6422f153a7d7cb3057fd94190d/1555274979697605070;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13131" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:58 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrru15:4107,/bns/yw/borg/yw/bns/blobstore2/bitpusher/57.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=GsysW8q9GZLLhATvipagBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/57.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/57:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "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IxKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "d84fb6a7fe4c8fad", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "81a103413c23ff6cf6de52c36bbf5f9a/3145686883747979117;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "377" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:58 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vru185:4374,/bns/yv/borg/yv/bns/blobstore2/bitpusher/273.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=GsysW8LPJ5CgNoeNtLgB" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/273.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/273:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpDBLUF8C0Y8OC3VIC_pa2-kudAgnEbLAaOCeCCraNcDIKCBS3elQhDKmQpnUPnIgJxUysgDOZc2NNdT2EYaUdRumPFig" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvZG9tYWluLWdvb2dsZS5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvYWNsL2RvbWFpbi1nb29nbGUuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwiZW50aXR5IjoiZG9tYWluLWdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZG9tYWluIjoiZ29vZ2xlLmNvbSIsImV0YWciOiJDQU09In0=" + } + }, + { + "ID": "223d5c2655c135ad", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "a2acc7d03c2bb940dcf519dcff4d5ef8/4735817312838485004;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13987" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:58 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vreu27:4180,/bns/yv/borg/yv/bns/blobstore2/bitpusher/323.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=GsysW8mRLZXYgQTfuLnICg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/323.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/323:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rej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xuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDMsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "fd2973ecddb39533", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "684a595153fa158043719a1da2804263/6326229216888924842;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2358" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:59 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:59 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrw127:4318,/bns/yv/borg/yv/bns/blobstore2/bitpusher/374.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=GsysW7bJOI3yggSq27_4CQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/374.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/374:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrQx-txpbMl8OqvGmdlxHHfAZg3zsAgfwVcRJG2cKduZ2fIHtPj9qC9G80sPT15MxGu97kkUtzdWLrv9KOcVWR-Q8LPGA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvcHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvYWNsL3Byb2plY3Qtb3duZXJzLTM2NjM5O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VIiLCJlbWFpbCI6ImludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNBTT0ifSx7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9kb21haW4tZ29vZ2xlLmNvbSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9hY2wvZG9tYWluLWdvb2dsZS5jb20iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNBTT0ifV19" + } + }, + { + "ID": "e12f623c305cecb4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4f93cb578b023a363759bb2cf52452d7/7916640021461225289;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2358" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:59 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:59 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrgm3:4392,/bns/yr/borg/yr/bns/blobstore2/bitpusher/68.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=G8ysW-GCD4-FkATrn62QAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/68.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/68:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqm3U3bqQ3x6UMYoVpEZxvM0-E1gmInWQXEj9VeCg4Bwv6SPEjSsnR1OCjqVhJoRCs3b_cghZ_Y7i8c_0ZsR-kcE4X_tjx1ucHO5cJrkZs9XL1xglo" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvcHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMT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Jlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6ImludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNBTT0ifSx7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9kb21haW4tZ29vZ2xlLmNvbSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9hY2wvZG9tYWluLWdvb2dsZS5jb20iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNBTT0ifV19" + } + }, + { + "ID": "ad0ba2871af45600", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c9dff7f46b3df0aa1bbccf636668360a/9507051921216763367;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13087" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:59 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:59 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrnc2:4232,/bns/yw/borg/yw/bns/blobstore2/bitpusher/132.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=G8ysW9WlIdXDhgSTua7ADg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/132.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/132:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpVPdoAQNx8mY5oiRnxgWk2nkKFdrVTTRq29jCQvw3554R8GGx0yM4GUdPkPYoKGeP3BSqNKhpYLO9kbLMih062cmL5fA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6VVNFUl9QUk9KRUNUX01JU1NJTkc6IEJ1Y2tldCBpcyBSZXF1ZXN0ZXIgUGF5cyBidWNrZXQgYnV0IG5vIGJpbGxpbmcgcHJvamVjdCBpZCBwcm92aWRlZCBmb3Igbm9uLW93bmVyLlxuXHRhdCBjb20uZ29vZ2xlLmNsb3VkLmJpZ3N0b3JlLmNvbW1vbi5CaWdzdG9y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udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZSQxLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NjIpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5DdXJyZW50Q29udGV4dC5ydW5JbkNvbnRleHQoQ3VycmVudENvbnRleHQuamF2YTozMjApXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHROb1VucmVmKFRyYWNlQ29udGV4dC5qYXZhOjMyMSlcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dChUcmFjZUNvbnRleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAwLCJtZXNzYWdlIjoiQnVja2V0IGlzIHJlcXVlc3RlciBwYXlzIGJ1Y2tldCBidXQgbm8gdXNlciBwcm9qZWN0IHByb3ZpZGVkLiJ9fQ==" + } + }, + { + "ID": "fbc79d3e312230b2", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6aa77ecbf8f3d32317e07bd499079dc0/11025125860075870854;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2358" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:24:59 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:24:59 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrbo128:4296,/bns/yv/borg/yv/bns/blobstore2/bitpusher/384.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=G8ysW73lLNiiggSxqYa4Dw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/384.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/384:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urb__NQ3g47uGEfOrLr43toLu4FlQw7kkLcnl-COQ--VPh4esMxEf4Sesu6sfGKnw5u8WTCQzQ0j3mgfoeReN5DW1PhlQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvcHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby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XRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6ImludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNBTT0ifSx7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9kb21haW4tZ29vZ2xlLmNvbSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9hY2wvZG9tYWluLWdvb2dsZS5jb20iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNBTT0ifV19" + } + }, + { + "ID": "8ff0e0d3db0c20a4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "bdc8a5e50646d0f066f3d3c96d71c25e/12615537764126244901;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13943" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:00 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:00 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrmm19:4379,/bns/yr/borg/yr/bns/blobstore2/bitpusher/52.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=G8ysW-XWMYT7kAOk1pngDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/52.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/52:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up4dLfyWyLDoGO56z8m9cKIZ3k2wRD5rnKGG7y--EG92D6uEWqzCq--42QVg9CHbcNtTAYUb4Qif8m7V5O-8s5jW9v63A" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZS5SZXNwb25zZUNvZGUuRXJyb3JDb2RlOjpVU0VSX1BST0pFQ1RfQUNDRVNTX0RFTklFRDog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Y29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZSQxLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NjIpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5DdXJyZW50Q29udGV4dC5ydW5JbkNvbnRleHQoQ3VycmVudENvbnRleHQuamF2YTozMjApXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHROb1VucmVmKFRyYWNlQ29udGV4dC5qYXZhOjMyMSlcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dChUcmFjZUNvbnRleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAzLCJtZXNzYWdlIjoiaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20gZG9lcyBub3QgaGF2ZSBzZXJ2aWNldXNhZ2Uuc2VydmljZXMudXNlIGFjY2VzcyB0byBwcm9qZWN0IDY0MjA4MDkxODEwMS4ifX0=" + } + }, + { + "ID": "a482ab45717781c9", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3e8fda45931e40ef507c08cfe5a4d675/14205949668193461699;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:01 GMT" + ], + "Etag": [ + "CAQ=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdv10:4196,/bns/yr/borg/yr/bns/blobstore2/bitpusher/13.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=HMysW7nnAc7xkAPuvp3IAg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/13.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/13:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqq7-AXWbJ0OfAwZWNX54cXmSHu9KZetg5qN7jzZYUwihM1Q9OZ-NssVvQwAjUhAUaOA2FZ2gFK919FB3RX8_XohAQlqA" + ] + }, + "Body": "" + } + }, + { + "ID": "8d610a271816662c", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8616123ddfd273b957e5fab502ff479b/15796360468454083426;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "2911" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:01 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:01 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051389000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vngv135:4098,/bns/yw/borg/yw/bns/blobstore2/bitpusher/222.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=HcysW7PZLIXohQTO7ZzgCw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/222.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/222:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoshQyC_SknxM5jDHjC2fHZEznd9i3BMQptowju6Ij-Nv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ZXh0UnVubmFibGUkMS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDYyKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuQ3VycmVudENvbnRleHQucnVuSW5Db250ZXh0KEN1cnJlbnRDb250ZXh0LmphdmE6MzIwKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwNCwibWVzc2FnZSI6Ik5vdCBGb3VuZCJ9fQ==" + } + }, + { + "ID": "da83794caa4cf088", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "16b54007f6478160a8f0ca7d0ea6dfb9/17386490901839491073;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13131" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:02 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:02 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrpa10:4240,/bns/yr/borg/yr/bns/blobstore2/bitpusher/102.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=HsysW8V0zfXhBJuDq9AG" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/102.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/102:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrqtMgL_uL-y75dcnPJSXmWL_i3QakTUsacyGhn2Jerx2hBwWeSxAvHsILqt9BUkmRDPBgnR-FgNxtaPpBH_4UIYWajlQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6VVNFUl9QUk9KRUNUX01JU1NJTkc6IEJ1Y2tldCBpcyBSZXF1ZXN0ZXIgUGF5cyBidWNrZXQgYnV0IG5vIGJpbGxpbmcgcHJvamVjdCBpZCBwcm92aWRlZCBmb3Igb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", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0885ca0712dc00c110d60f29bae6a524/530440207157089951;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "2911" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:02 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:02 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051402000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vns199:4031,/bns/yx/borg/yx/bns/blobstore2/bitpusher/12.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=HsysW-eWDsjSzwKA9KbAAg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/12.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/12:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq6oz_XgowJEUjm6QcOHJUWfE1d-fqMb-vVQ9PhPGZ45k5NfaDFpeb0lbznhh-rs-Xl114pu9dF2UJ-zMDkvp8HpggrgQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vdCBGb3VuZCIsIm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2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwNCwibWVzc2FnZSI6Ik5vdCBGb3VuZCJ9fQ==" + } + }, + { + "ID": "774de9a795d77c1a", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e3c01d1072ccb8ae60f233fe68026958/2120852106929339198;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13987" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:02 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:02 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051402000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vnay63:4225,/bns/yx/borg/yx/bns/blobstore2/bitpusher/71.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=HsysW63YF9KWzALm4bbIAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/71.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/71:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq2nRMSlpzIEyWLHepcu3uZTN0ze61Pgp76Y_QcFtaTBw6XipXJDnMwGvyMr2CctSdUs_T2O78pfbHqJWhG44EGgQQzSg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZS5SZXNwb25zZUNvZGUuRXJyb3JDb2RlOjpVU0VSX1BST0pFQ1RfQUNDRVNTX0RFTklFRDogaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20gZG9lcyBub3QgaGF2ZSBzZXJ2aWNldXNhZ2Uuc2Vyd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WNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlJDEucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ2Milcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLkN1cnJlbnRDb250ZXh0LnJ1bkluQ29udGV4dChDdXJyZW50Q29udGV4dC5qYXZhOjMyMClcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dE5vVW5yZWYoVHJhY2VDb250ZXh0LmphdmE6MzIxKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDMsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "ab058975d1817bd7", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "10c17f347603960c73c3c64e530e12f5/3710982540297970141;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "119" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:04 GMT" + ], + "Etag": [ + "CAU=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051389000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vngv21:4425,/bns/yx/borg/yx/bns/blobstore2/bitpusher/24.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=HsysW6CSJ5DkzgKJ5ryQBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/24.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/24:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoBF56ICh2ijLjfqU1iq3_fIrTTjexZ2BBn2PaVwVYeg4B5mIEJ7T0U2dnfeafp2dDc2KWpY2mnIvyGKqOYWZhbLoVymA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoiZG9tYWluLWdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZG9tYWluIjoiZ29vZ2xlLmNvbSIsImV0YWciOiJDQVU9In0=" + } + }, + { + "ID": "f1fcc196e93e6463", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "db1ff6db6ea98613c69f1676559359ef/5301393344870336123;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "119" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:04 GMT" + ], + "Etag": [ + "CAU=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrcw65:4312,/bns/yr/borg/yr/bns/blobstore2/bitpusher/59.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IMysW4eNFMuLkATz_I_4CQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/59.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/59:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up43Er14jJ287pQViDVRcpFGGZdP0AxcfJ5uR5znBju0lUN0PpfVd170bFXkNJtysbjPOiQ7ogsM9889HB7QTnl8S-ijg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoiZG9tYWluLWdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZG9tYWluIjoiZ29vZ2xlLmNvbSIsImV0YWciOiJDQVU9In0=" + } + }, + { + "ID": "e3ff4129f99086aa", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1a701ecf80451edb1613f5c17144086b/6891805244625808410;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13131" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:04 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrs123:4010,/bns/yr/borg/yr/bns/blobstore2/bitpusher/31.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IMysW7rFJci84QSQ-ZF4" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/31.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/31:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UppIr8QoNk9y3W_-3bxKLmujYEgzMdEaN4VVg5rK-gtx1kEwLnh4qW-opHhL80TrnuyGBMpA11rTr2vHaE97_4WXOZDKA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2Vwd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GNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "fd3d4b6eabba272c", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6d2983fb613e0d14f1016b3156d1f2c0/8482217148692959673;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "119" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:04 GMT" + ], + "Etag": [ + "CAU=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051402000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vnnl21:4346,/bns/yx/borg/yx/bns/blobstore2/bitpusher/166.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IMysW-rKMsHWzALm5oewDg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/166.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/166:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpaVesITKhatH2M-FF0nr35PGOmXxdEH2KkpMDZQSj-VyYNi7b4ZCw0_0iVK1Ss5Tk-1YLPbW-N87O94cay4CR2tc15ww" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoiZG9tYWluLWdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZG9tYWluIjoiZ29vZ2xlLmNvbSIsImV0YWciOiJDQVU9In0=" + } + }, + { + "ID": "6cef2d0fe616a1cb", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "41470592c6b358127c9e6adb19653c80/10072347582061655895;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13987" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:05 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051402000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vnss23:4187,/bns/yw/borg/yw/bns/blobstore2/bitpusher/119.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IMysW_vNOND4hASGt7eoDQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/119.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/119:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpJk7sPAiyUYXHIX3b7pUdx9Tbz4oUoggFEX6PGqfqD8OFLdIoKUyPLIjsSqkc_W8s7BaWLDxprHLNVZvlrdNRi8dL25Q" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZS5SZXNwb25zZUNvZGUuRXJyb3JDb2RlOjpVU0VSX1BST0pFQ1RfQUNDRVNTX0RFTklFRDogaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20gZG9lcyBub3QgaGF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.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8d13bbf15b8d9e35da61ec13ef0e93b3/11662759486128807158;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "678" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:05 GMT" + ], + "Etag": [ + "CAU=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:05 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrb20:4129,/bns/yw/borg/yw/bns/blobstore2/bitpusher/92.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IcysW9-gCI6ihgSxjr6wDQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/92.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/92:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrZmpWXIqiS9e6JgaqJiMGL30-HJaSgAUfANzdlVtP-GiI--njgNt8qDy-LT1yu47R5C_f0X4ArHWNC-OXuizlu2OoNHg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoib3duZXJzIn0sImV0YWciOiJDQVU9In0seyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC1lZGl0b3JzLTM2NjM5OTMzMTQ1Iiwicm9sZSI6Ik9XTkVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6ImVkaXRvcnMifSwiZXRhZyI6IkNBVT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LXZpZXdlcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiUkVBREVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6InZpZXdlcnMifSwiZXRhZyI6IkNBVT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNBVT0ifV19" + } + }, + { + "ID": "24b48182f16f05b6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3bf956ba1efb5a77c3b978c0abf5a331/13253170286389428885;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "678" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:05 GMT" + ], + "Etag": [ + "CAU=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:05 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051389000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnr74:4261,/bns/yx/borg/yx/bns/blobstore2/bitpusher/53.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IcysW6CoGYKLzgKstYqwBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/53.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/53:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UonBZeDWAS_5Xu3_JmgDldw4OBggGFhY08awH4tPbbcjtN2P0YNvAPPRM1Yx9HlZU8iEgUbR7QkE3xFzZaP3Yosb8LYPA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoib3duZXJzIn0sImV0YWciOiJDQVU9In0seyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC1lZGl0b3JzLTM2NjM5OTMzMTQ1Iiwicm9sZSI6Ik9XTkVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6ImVkaXRvcnMifSwiZXRhZyI6IkNBVT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LXZpZXdlcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiUkVBREVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6InZpZXdlcnMifSwiZXRhZyI6IkNBVT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNBVT0ifV19" + } + }, + { + "ID": "ce844c26f10c0e3b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d5c7b6eaaa27d2b42f81b33c9de5cedc/14843582190456645427;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13087" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:06 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:06 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrcb130:4200,/bns/yv/borg/yv/bns/blobstore2/bitpusher/26.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IcysW4DtMZPMgwTatbbQAg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/26.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/26:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UotQ-yZb_9zj9TYZYqpQNrytARZW-m2uHS9_ifyhpLIvSqktqIJboultvlXy8j4pdBnvnmfWDDNoyeewfOgLC9XJAOckg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6VVNFUl9QUk9KRUNUX01JU1NJTkc6IEJ1Y2tldCBpcyBS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LnNlcnZlci5Db21tb25Nb2R1bGUkQ29udGV4dENhcnJ5aW5nRXhlY3V0b3JTZXJ2aWNlJDEucnVuSW5Db250ZXh0KENvbW1vbk1vZHVsZS5qYXZhOjg0Nilcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZSQxLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NjIpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5DdXJyZW50Q29udGV4dC5ydW5JbkNvbnRleHQoQ3VycmVudENvbnRleHQuamF2YTozMjApXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHROb1VucmVmKFRyYWNlQ29udGV4dC5qYXZhOjMyMSlcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dChUcmFjZUNvbnRleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAwLCJtZXNzYWdlIjoiQnVja2V0IGlzIHJlcXVlc3RlciBwYXlzIGJ1Y2tldCBidXQgbm8gdXNlciBwcm9qZWN0IHByb3ZpZGVkLiJ9fQ==" + } + }, + { + "ID": "ff92114e4faebe3b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "06faed11abba0b027858e49c6ddf6a29/16361656129315753170;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "678" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:06 GMT" + ], + "Etag": [ + "CAU=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:06 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrbd63:4301,/bns/yr/borg/yr/bns/blobstore2/bitpusher/21.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IsysW5DQAc-M4QTB1K2YAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/21.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/21:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq9Kb4Jr0nsQHMgXynyXRsWFwmHcVDFVL1weQDJIiWnadnHl4wU7pIGAbTmZ7GL9YeHKX4nLJL8GPuTkz3DQSh-z9WXfw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoib3duZXJzIn0sImV0YWciOiJDQVU9In0seyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiZW50aXR5IjoicHJvamVjdC1lZGl0b3JzLTM2NjM5OTMzMTQ1Iiwicm9sZSI6Ik9XTkVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6ImVkaXRvcnMifSwiZXRhZyI6IkNBVT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LXZpZXdlcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiUkVBREVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6InZpZXdlcnMifSwiZXRhZyI6IkNBVT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNBVT0ifV19" + } + }, + { + "ID": "7f3358fa545fcd20", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4d8caf7f58e94fb261d8a3d56590928b/17952068029071290992;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13943" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:06 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:06 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrwa10:4354,/bns/yv/borg/yv/bns/blobstore2/bitpusher/182.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IsysW42tBtWFgQSM1K-oDQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/182.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/182:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrpCrljVA9hmFfcCUZ6ginYuMdaH-ak_I_6bNEq0ajgeC9v9yvTUmHRt5JF9futhNCB1d2AgmMOvfvjrT0q38ONS_dGhojwkaJq1TthxI2Q3GFSu_M" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC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0072677d6e9243", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1410259a9e5a5a3240d8b80567abc4dd/1096017334405601039;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:07 GMT" + ], + "Etag": [ + "CAY=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vris74:4141,/bns/yr/borg/yr/bns/blobstore2/bitpusher/87.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=IsysW_CqFMmu4QTjqoH4BQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/87.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/87:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqcfHghFeLYicAx1xZoOFYz9sF8hHTKLCp36QA9xhiJZ2VRR0CNnO0sZ9owfC8KLGPOVfAfuS8ZxhUTIwxoV96BHRwAcg" + ] + }, + "Body": "" + } + }, + { + "ID": "bdca30b60af963e6", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6227da00c3d57bbb80499c2419e84418/2686146668279381422;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "2911" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:08 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:08 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqv16:4123,/bns/yr/borg/yr/bns/blobstore2/bitpusher/16.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JMysW7ZCw_WQA6PVsMAN" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/16.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/16:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result":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G9yU2VydmljZSQxLnJ1bkluQ29udGV4dChDb21tb25Nb2R1bGUuamF2YTo4NDYpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUkMS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDYyKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuQ3VycmVudENvbnRleHQucnVuSW5Db250ZXh0KEN1cnJlbnRDb250ZXh0LmphdmE6MzIwKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwNCwibWVzc2FnZSI6Ik5vdCBGb3VuZCJ9fQ==" + } + }, + { + "ID": "9452e5677cd8763e", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "70a998644dfcd91da217e42b1d7b2d2e/4276558568051696204;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13131" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:08 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:08 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrls9:4235,/bns/yv/borg/yv/bns/blobstore2/bitpusher/272.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JMysW5CsE4WYNtLmguAE" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/272.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/272:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoS5A_Ur5pecY5WkXvVZ-WyFRTYSKqumzpHMDRUS9GQU_9lswTJztBB3jyIuq6dqAIGQlJi3ZvEGCcbumiiyxDu31QPAg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29k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OiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "69453ac394695e48", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "40295f9b87f0f18ad0e9ff0e6fb99330/5866970472102070507;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "2911" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:08 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:08 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrbh67:4361,/bns/yv/borg/yv/bns/blobstore2/bitpusher/259.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JMysW-aOIMmngASFkp7wAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/259.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/259:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoAIy7VG2gOhNoHOLq09jywLkL6GqJBFh12dcwNvIYHlc2RjT6csXgnyyOlgOpUEd0DmFu84oEVta-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ZXh0LmphdmE6NDYyKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuQ3VycmVudENvbnRleHQucnVuSW5Db250ZXh0KEN1cnJlbnRDb250ZXh0LmphdmE6MzIwKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwNCwibWVzc2FnZSI6Ik5vdCBGb3VuZCJ9fQ==" + } + }, + { + "ID": "4e81fa1d549dd7d1", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e7961ff53ec44511ed91686f7343d103/7457382376169221514;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/defaultObjectAcl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13987" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:08 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:08 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrng11:4017,/bns/yr/borg/yr/bns/blobstore2/bitpusher/34.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JMysW_6AJ8GlkATKoZr4CA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/34.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/34:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqqFd_29T2_H_95CurwBBNSdJkTcPsStuCJ-y30twVICigUMCZDDGuZQzqiDSF_N8EH0diT0_WkrCovZ_LDkaDH_YKmQg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZS5SZXNwb25zZUNvZGUuRXJyb3JDb2RlOjpVU0VSX1BST0pFQ1RfQU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y51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "7df91939b16a2c81", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b2716cf9b5aa6106b6d3d84e155dd3a6/9047512809537917736;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "463" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:09 GMT" + ], + "Etag": [ + "CISC0OiW290CEAU=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbr88:4353,/bns/yv/borg/yv/bns/blobstore2/bitpusher/193.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JMysW5r_ONOSgwS845_ACg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/193.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/193:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur9ztnAX_J_zFeQE4_hRnQ7btIzyA7VxKK0HAhiVm2EEWBKqUlImVx8tuF0RV3DtIeQ1c3_TZsw25NUDRWcGqPLxRIw4Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvZm9vLzE1MzgwNTEwOTM1NjE2MDQvZG9tYWluLWdvb2dsZS5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvby9mb28vYWNsL2RvbWFpbi1nb29nbGUuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwib2JqZWN0IjoiZm9vIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwOTM1NjE2MDQiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNJU0MwT2lXMjkwQ0VBVT0ifQ==" + } + }, + { + "ID": "7d4b183a11bce139", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ed4c07520b33a6edeccca7e43cbd2b59/10637923609815316679;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "463" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:09 GMT" + ], + "Etag": [ + "CISC0OiW290CEAU=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrta22:4161,/bns/yv/borg/yv/bns/blobstore2/bitpusher/372.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JcysW6yZDcflgQSplIvgBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/372.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/372:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpJrq84lbv5EUPgf6THcIVagDI8PK2rgrYCRntGvroWRZvZ3SfUfd2sHPmkck7SuQlCffNYbH0k97QCysZK0do7CzwK8A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvZm9vLzE1MzgwNTEwOTM1NjE2MDQvZG9tYWluLWdvb2dsZS5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvby9mb28vYWNsL2RvbWFpbi1nb29nbGUuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwib2JqZWN0IjoiZm9vIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwOTM1NjE2MDQiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNJU0MwT2lXMjkwQ0VBVT0ifQ==" + } + }, + { + "ID": "830be57d8d5b034e", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "47beea259ddd2b4ce2f3abd8d7dc99bc/12228335513865690726;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13131" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:09 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrti20:4165,/bns/yw/borg/yw/bns/blobstore2/bitpusher/44.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JcysW_mJEte8hgSCg6LoCA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/44.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/44:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpdIdGeWvzEPEhxanvKVaOS9s30-Ks08qtwPfKpcUgEvujPfnyww57z0FCERZ2_qwzT68OwihUV926Vyq4Kb4frc6nuCA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29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wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "a813a7a74b51212b", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e31f23b0bbd0536807020a4116896372/13818465947251163908;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "463" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:09 GMT" + ], + "Etag": [ + "CISC0OiW290CEAU=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrkx5:4004,/bns/yv/borg/yv/bns/blobstore2/bitpusher/210.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JcysW9OaIJLWgwSI4rWoBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/210.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/210:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UparWf6waxsZzPSiInxkNT-tYiY9T7YcRChH9lHB29YNw_LvBYyQN5RVNVa0PA3tEd31Har-YzV8SG9c216FVNesZYb7Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvZm9vLzE1MzgwNTEwOTM1NjE2MDQvZG9tYWluLWdvb2dsZS5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvby9mb28vYWNsL2RvbWFpbi1nb29nbGUuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwib2JqZWN0IjoiZm9vIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwOTM1NjE2MDQiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIiLCJkb21haW4iOiJnb29nbGUuY29tIiwiZXRhZyI6IkNJU0MwT2lXMjkwQ0VBVT0ifQ==" + } + }, + { + "ID": "876de65442e97d90", + "Request": { + "Method": "PUT", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "92b1d8b4d4646c948ae20f5d76daeddc/15408877847006636451;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJlbnRpdHkiOiJkb21haW4tZ29vZ2xlLmNvbSIsInJvbGUiOiJSRUFERVIifQo=" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13987" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:09 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrga66:4480,/bns/yw/borg/yw/bns/blobstore2/bitpusher/129.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JcysW7yZJcLYN-_yv-gJ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/129.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/129:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpzYeinxYvUcF89GNgxzHiwRGzRSiOPh8lXsF8Ui7yYuzaYzTYa1sdbSYFYW0mg6VMgQO1a8jcG50JRjKPSkwXB5S1zPg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlY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udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDMsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "e99d5454df27e734", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7f483e09cc86f574831ee0421c35e5fa/16999289751073787458;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2788" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:09 GMT" + ], + "Etag": [ + "CISC0OiW290CEAU=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:09 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051389000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnfw23:4201,/bns/yx/borg/yx/bns/blobstore2/bitpusher/9.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JcysW4XqM4aHzgLkspKIAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/9.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/9:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqFw4JZAQYCIoQGiC7YzARGdUVRclLSastcA-IAYPl1bPk7zoXPFij4lSO9h4-TbRz8X60Ra30Z25QAmogMkZrnIrI_3Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvZm9vLzE1MzgwNTEwOTM1NjE2MDQvcHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvby9mb28vYWNsL3Byb2plY3Qtb3duZXJzLTM2NjM5OTMzMTQ1IiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwib2JqZWN0IjoiZm9vIiwiZ2VuZXJhdGlvbiI6IjE1M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"GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "bd9b2393642462b5c8bdce455c561af9/143237956896535776;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2788" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Etag": [ + "CISC0OiW290CEAU=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnn4:4418,/bns/yr/borg/yr/bns/blobstore2/bitpusher/46.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JcysW9fdOcnF4QTguLLQCg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/46.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/46:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up-qKjKEvLs8mhoIBZjn644PJsEbock0wyZqP8NEPka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ZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzL2Zvby8xNTM4MDUxMDkzNTYxNjA0L2RvbWFpbi1nb29nbGUuY29tIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzL28vZm9vL2FjbC9kb21haW4tZ29vZ2xlLmNvbSIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsIm9iamVjdCI6ImZvbyIsImdlbmVyYXRpb24iOiIxNTM4MDUxMDkzNTYxNjA0IiwiZW50aXR5IjoiZG9tYWluLWdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZG9tYWluIjoiZ29vZ2xlLmNvbSIsImV0YWciOiJDSVNDME9pVzI5MENFQVU9In1dfQ==" + } + }, + { + "ID": "fb158f6c638e4fd6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "178ed4ffd76e625ae8bdeebf4cdf500c/1661311895755643263;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13087" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrsq4:4180,/bns/yr/borg/yr/bns/blobstore2/bitpusher/109.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JsysW4fJAc2TkATewpPoBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/109.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/109:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrLqMkF52b9YI5CWStirR3Vx8PSHOZLqsWPvlYejebN9HGI6BlPhip2U0WLxvWfEETUtnYyqKPjq5X8CxS83-22QWB9LA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6VVNFUl9QUk9KRUNUX01JU1NJTkc6IEJ1Y2tldCBpcyBSZXF1ZXN0ZXIgUGF5cyBidWNrZXQgYnV0IG5vIGJpbGxpbmcgcHJvamVjdCBpZCBwcm92aWRlZCBmb3Igbm9uLW93bmVyLlxuXHRhdCBjb20uZ29vZ2xlLmNsb3VkLmJpZ3N0b3JlLmNvbW1vbi5CaWdzdG9yZUV4Y2VwdGlvbi50b1JwYzNFeGNlcHRpb24oQmlnc3RvcmVFeGNlcHRpb24uamF2YToxMzUpXG5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G5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5DdXJyZW50Q29udGV4dC5ydW5JbkNvbnRleHQoQ3VycmVudENvbnRleHQuamF2YTozMjApXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHROb1VucmVmKFRyYWNlQ29udGV4dC5qYXZhOjMyMSlcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dChUcmFjZUNvbnRleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAwLCJtZXNzYWdlIjoiQnVja2V0IGlzIHJlcXVlc3RlciBwYXlzIGJ1Y2tldCBidXQgbm8gdXNlciBwcm9qZWN0IHByb3ZpZGVkLiJ9fQ==" + } + }, + { + "ID": "693609fc63a880a4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8b22dec014f63a2e09a65e7c874c6748/3251723795511181085;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2788" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Etag": [ + "CISC0OiW290CEAU=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051402000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vndz193:4319,/bns/yx/borg/yx/bns/blobstore2/bitpusher/140.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JsysW_aKD4aPzgLKg4SoDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/140.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/140:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrCrxz4Y9yMZaxH9kPNeKc4g8xHIDxwP8VRABr_owQG37mhGZmX6zaxL6F7NumpXRxx1PcDxTqpZOs883WeJaV6OOphiQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9scyIsIml0ZW1zIjpbeyJraW5kIjoic3RvcmFnZSNvYmplY3RBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvZm9vLzE1MzgwNTEwOTM1NjE2MDQvcHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMT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ImdlbmVyYXRpb24iOiIxNTM4MDUxMDkzNTYxNjA0IiwiZW50aXR5IjoiZG9tYWluLWdvb2dsZS5jb20iLCJyb2xlIjoiUkVBREVSIiwiZG9tYWluIjoiZ29vZ2xlLmNvbSIsImV0YWciOiJDSVNDME9pVzI5MENFQVU9In1dfQ==" + } + }, + { + "ID": "49029dea88229164", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3c62f541a3ae01cd6be129967cac3585/4842135699578332348;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13943" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrlj28:4249,/bns/yr/borg/yr/bns/blobstore2/bitpusher/9.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JsysW4HPE7Lm4QS0iZ9I" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/9.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/9:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpZ4wlQKc6jj-9k6xSk9TQKMTHvk4TESMFY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ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAzLCJtZXNzYWdlIjoiaW50ZWdyYXRpb25AZ2Nsb3VkLWdvbGFuZy1maXJlc3RvcmUtdGVzdHMuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20gZG9lcyBub3QgaGF2ZSBzZXJ2aWNldXNhZ2Uuc2VydmljZXMudXNlIGFjY2VzcyB0byBwcm9qZWN0IDY0MjA4MDkxODEwMS4ifX0=" + } + }, + { + "ID": "0bbffc509aa58e86", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9d5b4009a62181db92bb7fa0d649ded2/6432547603628706395;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Etag": [ + "CISC0OiW290CEAY=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrmt5:4328,/bns/yr/borg/yr/bns/blobstore2/bitpusher/18.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JsysW8_mH86x4QTpi5mYDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/18.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/18:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrkIesSXHaDQvjErkm-acBua1UtOmcpvV-fYBGu2-zEFeRu3-06b0Edan4rTIQdT4ALc5dtMnMvRz-wsO5y-DT2jHEHjQ" + ] + }, + "Body": "" + } + }, + { + "ID": "288d5c2ae22a0cf0", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "942e217b3d85e1854cbd33d54d01cda3/8022676933224427513;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "2911" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:10 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjy17:4329,/bns/yw/borg/yw/bns/blobstore2/bitpusher/67.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JsysW9mwM9jdhATbvJjQBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/67.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/67:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpwCfg1tfuHO6z9s2bgjLvSiNnbc_vMT2qmOOj1c4I0DhiJ46RI6sySBd8gte-AwJBFOhANbtvKXuz1Bq6S18z47aPrFA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vdCBGb3VuZCIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUuYXBpLnNlcnZlci5jb3JlLkZhdWx0OiBJbW11dGFibGVFcnJvckRlZmluaXRpb257YmFzZT1OT1RfRk9VTkQsIGNhdGVnb3J5PVVTRVJfRVJST1IsIGNhdXNlPW51bGwsIGRlYnVnSW5mbz1udWxsLCBkb21haW49Z2xvYmFsLCBleHRlbmRlZEhlbHA9bnVsbCwgaHR0cEhlYWRlcnM9e30sIGh0dHBTdGF0dXM9bm90Rm91bmQsIGludGVybmFsUmVhc29uPVJlYXNvbnthcmd1bWVudHM9e30sIGNhdXNlPW51bGwsIGNvZGU9Z2RhdGEuQ29y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4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwNCwibWVzc2FnZSI6Ik5vdCBGb3VuZCJ9fQ==" + } + }, + { + "ID": "096f174db397deb0", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1a6d483de945e889227f26e82c9b2130/9613088837274801560;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13131" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:11 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:11 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrjo80:4463,/bns/yv/borg/yv/bns/blobstore2/bitpusher/165.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=JsysW6auOo2MNtHGrBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/165.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/165:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uplo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b20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "9a6144618da834c7", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9b4ccb516b0ed7601e591296cf1453ba/11203500741341952567;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "2911" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:11 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:11 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051395000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrhq4:4312,/bns/yv/borg/yv/bns/blobstore2/bitpusher/111.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=J8ysW6HbB8-cgQS1rZiIAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/111.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/111:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpLOFQ92MklcwxjQqPryjDyxnQlsUd23ini1iIR7nX2UvjxF_jcqx_zsF7NG8QzDitrsVr_W2-wuJsTeHCRk6ZDMjBaDQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vdCBGb3VuZCIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUuYXBpLnNlcnZlci5jb3JlLkZhdWx0OiBJbW11dGFibGVFcnJvckRlZmluaXRpb257YmFzZT1OT1RfRk9VTkQsIGNhdGVnb3J5PVVTRVJfRVJST1IsIGNhdXNlPW51bGwsIGRlYnVnSW5mbz1udWxsLCBkb21haW49Z2xvYmFsLCBleHRlbmRlZEhlbHA9bnVsbCwgaHR0cEhlYWRlcnM9e30sIGh0dHBTdGF0dXM9bm90Rm91bmQsIGludGVybmFsUmVhc29uPVJlYXNvbnthcmd1bWVudHM9e30sIGNhdXNlPW51bGwsIGNvZGU9Z2RhdGEuQ29yZUVycm9yRG9tYWluLk5PVF9GT1VORCwgY3JlYXRlZEJ5QmFja2VuZD10cnVlLCBkZWJ1Z01lc3NhZ2U9bnVsbCwgZXJyb3JQcm90b0NvZGU9Tk9UX0ZPVU5ELCBlcnJvclByb3RvRG9tYWluPWdkYXRhLkNvcm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uamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwNCwibWVzc2FnZSI6Ik5vdCBGb3VuZCJ9fQ==" + } + }, + { + "ID": "c52b7f33ca3920d5", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f0700b25c7e12a6b9dec52fbd6091dee/12793631170432524245;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/acl/domain-google.com?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13987" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:11 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:11 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051402000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vnlu1:4025,/bns/yx/borg/yx/bns/blobstore2/bitpusher/90.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=J8ysW97FDMTnzAKpnrCABg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/90.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/90:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATo_ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrmFjyyAPppeAl4NIJZEu0UFkt54qMbRjRWm_O014wmEJVzEZVPqDwfNrVFaKI6Xx_ULf38vu9EUup85Ce8EcuZeMkDIQ" + ] + }, + "Body": "eyJ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Mylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDMsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "35caaa1961758473", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9d039fe48c3d6d31e978c142d65f7278/14384043074482898292;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3366" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051411000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnaz77:4273,/bns/yx/borg/yx/bns/blobstore2/bitpusher/128.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=J8ysW9jcGoGKzQKK-Yv4CQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/128.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/128:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoLVz1xVnB7DeGhm_uQ-fvJJcGqAvxf9eVPqr9nZ6F2T2v7hQViOoF6MMD9KhOv1w9uev9CbEiD5z80sBjc1OEbaTgsQA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNyZXdyaXRlUmVzcG9uc2UiLCJ0b3RhbEJ5dGVzUmV3cml0dGVuIjoiNSIsIm9iamVjdFNpemUiOiI1IiwiZG9uZSI6dHJ1ZSwicmVzb3VyY2UiOnsia2luZCI6InN0b3JhZ2Ujb2JqZWN0IiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvY29weS8xNTM4MDUxMTExOTM1MzgxIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0y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jb3VudC5jb20iLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvby9jb3B5L2FjbC91c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwib2JqZWN0IjoiY29weSIsImdlbmVyYXRpb24iOiIxNTM4MDUxMTExOTM1MzgxIiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ0pXN3NmR1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJtbkc3VEE9PSIsImV0YWciOiJDSlc3c2ZHVzI5MENFQUU9In19" + } + }, + { + "ID": "0fd88baa3033f493", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "09f1f12c42b7c8149240acb13b43935d/15974453879055198739;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3366" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051412000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vro189:4159,/bns/yr/borg/yr/bns/blobstore2/bitpusher/3.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=KMysW7WoBIPTkAOc94W4BQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/3.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/3:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq0ghIYIN0eHwuJHKVrD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zlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ09hSTF2R1cyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJtbkc3VEE9PSIsImV0YWciOiJDT2FJMXZHVzI5MENFQUU9In19" + } + }, + { + "ID": "53fbb33131b2c479", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "82868f26ec5b6e299b4474b2cfae6959/17564865783105638577;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13391" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:12 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051412000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrbd126:4463,/bns/yr/borg/yr/bns/blobstore2/bitpusher/6.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=KMysW8GPKITi4QTTsIOoBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/6.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/6:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpCChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur-3PRMrpJH_qpKJfXYAc9NIi9qSUo9fN7ClGHRFbFLuUxvgBIf6Igeo-jEzfIDVBbyTmScU7Q_P1pMxZCt9DvTQlxFng" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6VVNFUl9QUk9KRUNUX01JU1NJTkc6IEJ1Y2tldCBpcyBSZXF1ZXN0ZXIgUGF5cyBidWNrZXQgYnV0IG5vIGJpbGxpbmcgcHJvamVjdCBpZCBwcm92aWRlZCBmb3Igbm9uLW93bmVyLlxuXHRhdCBjb20uZ29vZ2xlLmNsb3VkLmJpZ3N0b3JlLmNvbW1vbi5CaWdzdG9yZUV4Y2VwdGlvbi50b1JwYzNFeGNlcHRpb24oQmlnc3RvcmVFeGNlcHRpb24uamF2YToxMzUpXG5cdGF0IGNvbS5nb29nbGUuY2xvdWQuYmlnc3RvcmUuYXBpLmpzb24uZnJhbWV3b3JrLlJlcXVlc3RIYW5kbGVyLmhhbmRsZShSZXF1ZXN0SGFuZGxlci5qYXZhOjMwMilcblx0YXQgY29tLmdvb2dsZS5jbG91ZC5iaWdzdG9yZS5hcGkuanNvbi5PYmplY3RzRGVsZWdhdG9yLnJld3JpdG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ENvbnRleHRDYXJyeWluZ0V4ZWN1dG9yU2VydmljZSQxLnJ1bkluQ29udGV4dChDb21tb25Nb2R1bGUuamF2YTo4NDYpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUkMS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDYyKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuQ3VycmVudENvbnRleHQucnVuSW5Db250ZXh0KEN1cnJlbnRDb250ZXh0LmphdmE6MzIwKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwMCwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4ifX0=" + } + }, + { + "ID": "f86365df7b93f43c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9ddfb31e3f881c845551040d149daa03/708533613463303504;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3321" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:13 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051412000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrlw11:4360,/bns/yv/borg/yv/bns/blobstore2/bitpusher/67.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=KMysW5WjMoqOgwTBuI7wDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/67.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/67:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpCChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrovVDo882mWpoavyshb6LknBxbQkL6Ya9AnN5uoVuTl1lfogtISVulQ2qAStL-GJMjMMnY3YCHK4yUm5jOG7JBH8Ub4A" + ] + }, + "Body": "eyJraW5k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3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJtbkc3VEE9PSIsImV0YWciOiJDTFB0N3ZHVzI5MENFQUU9In19" + } + }, + { + "ID": "5879616fb9645b35", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b83e165b179c0491707d79c900744d04/2298945517513677807;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo/rewriteTo/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026projection=full\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "14247" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:13 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051412000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrua10:4104,/bns/yv/borg/yv/bns/blobstore2/bitpusher/268.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=KcysW_rQA9KeggS9oqBY" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/268.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/268:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpCChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ],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2R1bGUuamF2YTo4NDYpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUkMS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDYyKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuQ3VycmVudENvbnRleHQucnVuSW5Db250ZXh0KEN1cnJlbnRDb250ZXh0LmphdmE6MzIwKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwMywibWVzc2FnZSI6ImludGVncmF0aW9uQGdjbG91ZC1nb2xhbmctZmlyZXN0b3JlLXRlc3RzLmlhbS5nc2VydmljZWFjY291bnQuY29tIGRvZXMgbm90IGhhdmUgc2VydmljZXVzYWdlLnNlcnZpY2VzLnVzZSBhY2Nlc3MgdG8gcHJvamVjdCA2NDIwODA5MTgxMDEuIn19" + } + }, + { + "ID": "d58b6d243a768de2", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "127" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "af35fdd27845b2cb356c7bc7026838b3/3889357421580894349;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6ImZvbyJ9LHsibmFtZSI6ImNvcHkifV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "742" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:13 GMT" + ], + "Etag": [ + "CJeim/KW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051412000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbf23:4359,/bns/yv/borg/yv/bns/blobstore2/bitpusher/164.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=KcysW5CYEJCAgwTX26HYCw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/164.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/164:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq0XH95_bvjP8WCkrA3pEAug5FEKD-6kMcOQN8UBPYQvggU93eZabBmIcjCp0AcvnZyHYRIt8a_d6oH8Y_Cdp1nTKhPvg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9jb21wb3NlLzE1MzgwNTExMTM2Njg4ODciLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvby9jb21wb3NlIiwibmFtZSI6ImNvbXBvc2UiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTExMzY2ODg4NyIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNToxMy42NjdaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MTMuNjY3WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjEzLjY2N1oiLCJzaXplIjoiMTAiLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzL28vY29tcG9zZT9nZW5lcmF0aW9uPTE1MzgwNTExMTM2Njg4ODcmYWx0PW1lZGlhIiwiY3JjMzJjIjoiL1JDT2dnPT0iLCJjb21wb25lbnRDb3VudCI6MiwiZXRhZyI6IkNKZWltL0tXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "82f9c7e73e26169f", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "127" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "88656daa72f3a44c8d1036302cce6ab8/5407430256633472556;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6ImZvbyJ9LHsibmFtZSI6ImNvcHkifV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "742" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:14 GMT" + ], + "Etag": [ + "CLjYwPKW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051412000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrt187:4251,/bns/yv/borg/yv/bns/blobstore2/bitpusher/82.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=KcysW9CAN4OlgASf-Jco" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/82.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/82:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoaT4viYqVfzBgidvfngr5I3dfnvBo_Q97aJ53xZZHVShVI9-ajQVC6y5nJ7D6UaetBaaqvIMuyyPtISMa-XjlL4Fk3qg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9jb21wb3NlLzE1MzgwNTExMTQyODIwNDAiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvby9jb21wb3NlIiwibmFtZSI6ImNvbXBvc2UiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTExNDI4MjA0MCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNToxNC4yODFaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MTQuMjgxWiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjE0LjI4MVoiLCJzaXplIjoiMTAiLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzL28vY29tcG9zZT9nZW5lcmF0aW9uPTE1MzgwNTExMTQyODIwNDAmYWx0PW1lZGlhIiwiY3JjMzJjIjoiL1JDT2dnPT0iLCJjb21wb25lbnRDb3VudCI6MiwiZXRhZyI6IkNMall3UEtXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "e6671b4e33cec5f9", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "127" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "57be10b174302620db439bb9e5bd529e/6997842160700623819;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6ImZvbyJ9LHsibmFtZSI6ImNvcHkifV19Cg==" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "12159" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:14 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051412000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrch124:4064,/bns/yv/borg/yv/bns/blobstore2/bitpusher/203.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=KsysW9-vGJC0ggSujK6wDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/203.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/203:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpCChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqACTq5n8sFNIiVA2h8aH3Vj_ZswPTuWjjESekvJFvdlKomAhXobltpqY4fsj2szRDB9frX-PjOv9hytKgpgnK0_P6CZg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6VVNFUl9QUk9KRUNUX01JU1NJTkc6IEJ1Y2tldCBpcyBSZXF1ZXN0ZXIgUGF5cyBidWNrZXQgYnV0IG5vIGJpbGxpbmcgcHJvamVjdCBpZCBwcm92aWRlZCBmb3Igbm9uLW93bmVyLlxuXHRhdCBjb20uZ29vZ2xlLmNsb3VkLmJpZ3N0b3JlLmNvbW1vbi5CaWdzdG9yZUV4Y2VwdGlvbi50b1JwYzNFeGNlcHRpb24oQmlnc3RvcmVFeGNlcH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S50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dE5vVW5yZWYoVHJhY2VDb250ZXh0LmphdmE6MzIxKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "d5dec65b14d1e564", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "127" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e3b2ca3ee9799fdbcd67edea72cb2b13/8588254064751063401;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6ImZvbyJ9LHsibmFtZSI6ImNvcHkifV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "742" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:14 GMT" + ], + "Etag": [ + "CPPa3fKW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051412000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vray3:4145,/bns/yr/borg/yr/bns/blobstore2/bitpusher/1.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=KsysW-D8JYeTkATnw5OYAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/1.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/1:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpCChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqw7poK3DL_KB2b-NGyg3S_etaxdZOQT8tM1CB3Njtjp5I5cTq4IkFxXrlPXslCK4wfycAl4MApkddYSmiVeRaX2IXCvQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9jb21wb3NlLzE1MzgwNTExMTQ3NTc0OTEiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMvby9jb21wb3NlIiwibmFtZSI6ImNvbXBvc2UiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTExNDc1NzQ5MSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNToxNC43NTdaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MTQuNzU3WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjE0Ljc1N1oiLCJzaXplIjoiMTAiLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzL28vY29tcG9zZT9nZW5lcmF0aW9uPTE1MzgwNTExMTQ3NTc0OTEmYWx0PW1lZGlhIiwiY3JjMzJjIjoiL1JDT2dnPT0iLCJjb21wb25lbnRDb3VudCI6MiwiZXRhZyI6IkNQUGEzZktXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "24c660b93668472d", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "127" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "be05ebeb28473769bdebf0265c356dd1/10178665964523312648;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose/compose?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6ImZvbyJ9LHsibmFtZSI6ImNvcHkifV19Cg==" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13015" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:15 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051412000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrmm26:4177,/bns/yv/borg/yv/bns/blobstore2/bitpusher/113.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=KsysW8vBNsLygwT0jIrYCA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/113.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/113:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpCChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoEj3IamdTcELhnX6VeqX7ghzI3eYDEPV8bpculXR797zpQlEOtsuXWVEwCdLTnbT5jN26sovoxVnQ3kVIP4zvetR60xg" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJpbnRlZ3JhdGlvbkBnY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIH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Y3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "8258f8e2dc12967c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=a689dc23618e3f3e66aa43d96c5419cf130f3b626c9fa0e4d4c51e49c721" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0df3a8a5e79adbc213ad94e8657ffc2f/11009759428470810967;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1hNjg5ZGMyMzYxOGUzZjNlNjZhYTQzZDk2YzU0MTljZjEzMGYzYjYyNmM5ZmEwZTRkNGM1MWU0OWM3MjENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsIm5hbWUiOiJmb28ifQoNCi0tYTY4OWRjMjM2MThlM2YzZTY2YWE0M2Q5NmM1NDE5Y2YxMzBmM2I2MjZjOWZhMGU0ZDRjNTFlNDljNzIxDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KaGVsbG8NCi0tYTY4OWRjMjM2MThlM2YzZTY2YWE0M2Q5NmM1NDE5Y2YxMzBmM2I2MjZjOWZhMGU0ZDRjNTFlNDljNzIxLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3205" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:15 GMT" + ], + "Etag": [ + "CKeVh/OW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnk23:4310,/bns/yr/borg/yr/bns/blobstore2/bitpusher/0.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=K8ysW_iHCMSxkATZ74bIAQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/0.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/0:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrK68i4wgUfs8FAKX_CTgQ_yQHjxuVG81WoqFKLDV_C_STun4Y3x3F7rBPIWnouByRLYZyIwwnJPGmZe5PDKq0vps65DA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTExNTQzNjcxMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MT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lL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzL28vZm9vL2FjbC91c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwib2JqZWN0IjoiZm9vIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTExMTU0MzY3MTEiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDS2VWaC9PVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Im1uRzdUQT09IiwiZXRhZyI6IkNLZVZoL09XMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "3610413c1a01c96c", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "51d5a9571886ff76af7257bedf96bf1b/11768796397892009126;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:15 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrhr16:4228,/bns/yv/borg/yv/bns/blobstore2/bitpusher/58.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=K8ysW-zxIZOOgQTGxbr4Cg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/58.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/58:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqE55aemrYjdFA8FkDCwW812jfM5D0wZd7golIxJUOE-xP3suwjn4V7dwR978-yKqkJ5Fjz2xxYKRTVPTq9qS8yfeB02OKDwOjsuNxmtVMKA-0A8KI" + ] + }, + "Body": "" + } + }, + { + "ID": "49aa8c8fefb3577a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=ab6dfb15520815f8119effd1b1d5f7dec91a7e7b8477b1ac4492c7f9a037" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5662dde3618e05ad28aa32d8645d4e42/12600170233043111670;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1hYjZkZmIxNTUyMDgxNWY4MTE5ZWZmZDFiMWQ1ZjdkZWM5MWE3ZTdiODQ3N2IxYWM0NDkyYzdmOWEwMzcNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsIm5hbWUiOiJmb28ifQoNCi0tYWI2ZGZiMTU1MjA4MTVmODExOWVmZmQxYjFkNWY3ZGVjOTFhN2U3Yjg0NzdiMWFjNDQ5MmM3ZjlhMDM3DQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KaGVsbG8NCi0tYWI2ZGZiMTU1MjA4MTVmODExOWVmZmQxYjFkNWY3ZGVjOTFhN2U3Yjg0NzdiMWFjNDQ5MmM3ZjlhMDM3LS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3205" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:16 GMT" + ], + "Etag": [ + "CJa+sfOW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vraz3:4225,/bns/yr/borg/yr/bns/blobstore2/bitpusher/37.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=K8ysW87ENNHD4QTY_bTQDA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/37.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/37:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqs6PH1tPVOygCthX3HcFpiXsTBPsOE0XUzHj3uRrIEmDTAKhT8TiGBcBSVXXv6lgRWAkfRmYxErnNfB7r5P_Rnx84vhQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTExNjEzMDA3MCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9vL2ZvbyIsIm5hbWUiOiJmb28iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW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5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAzIiwib2JqZWN0IjoiZm9vIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTExMTYxMzAwNzAiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDSmErc2ZPVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Im1uRzdUQT09IiwiZXRhZyI6IkNKYStzZk9XMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "07c8a1555393f910", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d007af7835e7bbb949a25b07284eca47/13359207202464309573;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:16 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vra74:4154,/bns/yv/borg/yv/bns/blobstore2/bitpusher/129.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LMysW_T0DtP-gASw_pngAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/129.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/129:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur-j16n2uzB3mZoBZM424vIBmsK2vOIC3mwutsAMtqFqwEa2_PgKKWN_ZBQzGq-8Yd6wNWnTQtGMgvom3GAi-BBhY1Q2w" + ] + }, + "Body": "" + } + }, + { + "ID": "2defffbcd8976267", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=75a80d9841f4290d47e65be40815577244a41e66a9a9cf3df47372ffb308" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f3b9c63bf79fa11cdaabdbb76d9a0bd2/14190300666411807892;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS03NWE4MGQ5ODQxZjQyOTBkNDdlNjViZTQwODE1NTc3MjQ0YTQxZTY2YTlhOWNmM2RmNDczNzJmZmIzMDgNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsIm5hbWUiOiJmb28ifQoNCi0tNzVhODBkOTg0MWY0MjkwZDQ3ZTY1YmU0MDgxNTU3NzI0NGE0MWU2NmE5YTljZjNkZjQ3MzcyZmZiMzA4DQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KaGVsbG8NCi0tNzVhODBkOTg0MWY0MjkwZDQ3ZTY1YmU0MDgxNTU3NzI0NGE0MWU2NmE5YTljZjNkZjQ3MzcyZmZiMzA4LS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3205" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:16 GMT" + ], + "Etag": [ + "CPqF3POW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrud24:4012,/bns/yr/borg/yr/bns/blobstore2/bitpusher/90.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LMysW_6rItCBkATK14bwDg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/90.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/90:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoIxj06L4-s3I6oVItW3TiAANXDlYSURjREeXxJ2GhVRJSrZsuU5X4YSySqZ-BrklVUdF0QIgUxqu4ng18fcrEHYKgsoA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTExNjgyNzM4NiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9vL2ZvbyIsIm5hbWUiOiJmb28iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTExNjgyNzM4NiIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjA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ib2JqZWN0IjoiZm9vIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTExMTY4MjczODYiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDUHFGM1BPVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Im1uRzdUQT09IiwiZXRhZyI6IkNQcUYzUE9XMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "a778a38a339a93e4", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "71d26a27642e73b3cd6be125433435a2/14949619106514683876;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 400, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12135" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:17 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:17 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051393000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrud24:4012,/bns/yv/borg/yv/bns/blobstore2/bitpusher/59.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LMysW5vuOcjAggTmnbjABA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/59.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/59:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOMrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoVnK5NfmwNaxGyeQ_rxmtw2pIfr-rNJNSvRUsZHttcvwhswcNcgXCauYsMiUo3GB2K8ydgQ0-KHfu05d22wU_DGlJTaQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6InJlcXVpcmVkIiwibWVzc2FnZSI6IkJ1Y2tldCBpcyByZXF1ZXN0ZXIgcGF5cyBidWNrZXQgYnV0IG5vIHVzZXIgcHJvamVjdCBwcm92aWRlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6VVNFUl9QUk9KRUNUX01JU1NJTkc6IEJ1Y2tldCBpcyBSZXF1ZXN0ZXIgUGF5cyBidWNrZXQgYnV0IG5vIGJpbGxpbmcgcHJvamVjdCBpZCBwcm92aWRlZCBmb3Igbm9uLW93bmVyLlxuXHRhdCBjb20uZ29vZ2xlLmNsb3VkLmJpZ3N0b3JlLmNvbW1vbi5CaWdzdG9yZUV4Y2VwdGlvbi50b1JwYzNFeGNlcHRpb24oQmlnc3RvcmVFeGNlcHRpb24uamF2YToxMzUpXG5cdGF0IGNv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iYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dE5vVW5yZWYoVHJhY2VDb250ZXh0LmphdmE6MzIxKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0KFRyYWNlQ29udGV4dC5qYXZhOjMxMylcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDU5KVxuXHRhdCBjb20uZ29vZ2xlLmdzZS5pbnRlcm5hbC5EaXNwYXRjaFF1ZXVlSW1wbCRXb3JrZXJUaHJlYWQucnVuKERpc3BhdGNoUXVldWVJbXBsLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDAsIm1lc3NhZ2UiOiJCdWNrZXQgaXMgcmVxdWVzdGVyIHBheXMgYnVja2V0IGJ1dCBubyB1c2VyIHByb2plY3QgcHJvdmlkZWQuIn19" + } + }, + { + "ID": "2a8fd68359cb1958", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=4f6e9b78f5a8b7e850386764f72a73c816d0f8dc26327ea4d10da74cc35d" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b7aa87d2a9c5480b8c28fa68dd906821/15708656071657756979;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS00ZjZlOWI3OGY1YThiN2U4NTAzODY3NjRmNzJhNzNjODE2ZDBmOGRjMjYzMjdlYTRkMTBkYTc0Y2MzNWQNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsIm5hbWUiOiJmb28ifQoNCi0tNGY2ZTliNzhmNWE4YjdlODUwMzg2NzY0ZjcyYTczYzgxNmQwZjhkYzI2MzI3ZWE0ZDEwZGE3NGNjMzVkDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KaGVsbG8NCi0tNGY2ZTliNzhmNWE4YjdlODUwMzg2NzY0ZjcyYTczYzgxNmQwZjhkYzI2MzI3ZWE0ZDEwZGE3NGNjMzVkLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3205" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:17 GMT" + ], + "Etag": [ + "CNGxgfSW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vreu27:4180,/bns/yv/borg/yv/bns/blobstore2/bitpusher/296.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LcysW5DkB8u0gASSk5bYAQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/296.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/296:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqupdeNHxKM38dADbCeH8nI7nmyi0vHoWSYlJ0PAgo11y3jQ1rPgq5MBoKWmfN2F_34QBdaOSTTs3SlTrlTGozCPBuYVA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9mb28vMTUzODA1MTExNzQzOTE4NSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMy9vL2ZvbyIsIm5hbWUiOiJmb28iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDMiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTExNzQzOTE4NSIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNToxNy40MzhaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MTcuNDM4WiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjE3LjQzOFoiLCJzaXplIjoiNSIsIm1kNUhhc2giOiJYVUZBS3J4TEtuYTVjW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FvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDTkd4Z2ZTVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6Im1uRzdUQT09IiwiZXRhZyI6IkNOR3hnZlNXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "9c087f5dea9ff46c", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fe3cb9d98b5c4a69974af372d060dcd6/16540031006286998658;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026userProject=gcloud-golang-firestore-tests" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:17 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051393000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrvp14:4177,/bns/yr/borg/yr/bns/blobstore2/bitpusher/47.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LcysW7eCIpGBkAS56Iz4BQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/47.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/47:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOMrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpKOP9rXNco4uzsEObaLaIwSS_pvKPoR_hIfr8ARW6YDpAg5SvCHTDLc9x0bBHmSQOdoBISIPL2ExjWg_f7idxUZICJAw" + ] + }, + "Body": "" + } + }, + { + "ID": "3939dd32424044e0", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=85973a0d1061499ceaef6ac4ba7dca168f9fea012e335225842463125991" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0b26e241919815ac6310bc678ab9ee93/17299067975708131282;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS04NTk3M2EwZDEwNjE0OTljZWFlZjZhYzRiYTdkY2ExNjhmOWZlYTAxMmUzMzUyMjU4NDI0NjMxMjU5OTENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMyIsIm5hbWUiOiJmb28ifQoNCi0tODU5NzNhMGQxMDYxNDk5Y2VhZWY2YWM0YmE3ZGNhMTY4ZjlmZWEwMTJlMzM1MjI1ODQyNDYzMTI1OTkxDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KaGVsbG8NCi0tODU5NzNhMGQxMDYxNDk5Y2VhZWY2YWM0YmE3ZGNhMTY4ZjlmZWEwMTJlMzM1MjI1ODQyNDYzMTI1OTkxLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3205" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:18 GMT" + ], + "Etag": [ + "CPDLpvSW290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrde80:4389,/bns/yv/borg/yv/bns/blobstore2/bitpusher/334.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LcysW7ShLpLsgQT85IbADw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/334.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/334:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqDXeA-_PCymYgmewqvC4l3Gbco2LCE5-vGB4Kb1wbr-7oBYEHShdOTDNW8t1PhNwvA0Z-Y1rO1b-A5vDAXffu1UKLqHg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NXMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "74c09e371d29ac29", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "a676d7c79d62a934a91a442e50088d50/18130161439655629345;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false\u0026userProject=veener-jba" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12991" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:18 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:18 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051393000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "471383502717" + ], + "X-Google-Backends": [ + "vrny26:4047,/bns/yr/borg/yr/bns/blobstore2/bitpusher/40.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LsysW7WDCo_s4QS_yY3QBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/40.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/40:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CP3elYXcDRoCGAYoATpFChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGM6ropHgHCIVMTE3MjM4MDU4ODYxOTM3NTE5MTQ0MOArMOErMOMrSp8BEoIBeWEyOS5jLkVsb2xCcldWbUZlX1AxVDdUOHVpTXdFMHBZUjdTc2NVMDBFdEZkc2tSenBQY0NLWkhUeEZaYXI0Q25tZmR6bXFRLTNVV0kzOF9wdEx5VTZ2Z1Q3dlRBeW42Z3g4dUcyd0szSHIzaTZrV1JBZkozc1pNMGQ1allkNHpWQTAEOhZOT1RfQV9QRVJTSVNURU5UX1RPS0VO" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrpZwGPce9nNsZPGsv95kJIkHK0LTBKS0xq9-VuVNdTJGloUo7xESD3m8qGC5o_TwJ73P4MLGzp2V-K8W2dO7pqIQkQyA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7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nY2xvdWQtZ29sYW5nLWZpcmVzdG9yZS10ZXN0cy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSBkb2VzIG5vdCBoYXZlIHNlcnZpY2V1c2FnZS5zZXJ2aWNlcy51c2UgYWNjZXNzIHRvIHByb2plY3QgNjQyMDgwOTE4MTAxLiJ9fQ==" + } + }, + { + "ID": "a0e8258aaf3c4072", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "68b50c9729fbc325a856f265c14e1399/443017281042506864;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/foo?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:18 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051418000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnme26:4110,/bns/yx/borg/yx/bns/blobstore2/bitpusher/111.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LsysW9-NFNXGzALmmI6YCg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/111.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/111:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upq5TGgZ6pXmvluXnywBJQS6092UwP-6DQjN7OPoqrkN2EtcixAs_aS9wo2eAwA5GO2eorSBVmZNdBvNZDnaR7FAXTqog" + ] + }, + "Body": "" + } + }, + { + "ID": "13d08364d3e115a4", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "042ea18a0bf0a95e4096fc95e538efa7/1274110744989939648;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/copy?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:18 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vras90:4259,/bns/yv/borg/yv/bns/blobstore2/bitpusher/20.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LsysW6-QJ8nMgASG3IeoCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/20.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/20:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpW2F7l42ObaHTrp9Vow9C8oBA8ztqz41L3FLxjdhBOflM_KB5TyMH4CmJuSt83v9PPhYLC3H8qMnXrt2vTF7AVKwFNbMy8HC4JGEIw45kwP5ZwA00" + ] + }, + "Body": "" + } + }, + { + "ID": "ff21a30a8097c589", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b90515bb73861fb4787571a44e507185/2033146614916286991;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003/o/compose?alt=json\u0026prettyPrint=false\u0026userProject=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:19 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbx80:4064,/bns/yw/borg/yw/bns/blobstore2/bitpusher/109.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=LsysW7emOYq-N6XaqtAB" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/109.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/109:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoqsotiuhmzO_3f-9ZFLFk8eV3K4K8QrlFJ-bJPr6u3w2s-12Xg44-XhDrluV1kKFGWvvDybBkaCVmbGH0leIcmJv44pg" + ] + }, + "Body": "" + } + }, + { + "ID": "de4b252e5c956234", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3209c3194428722334c6c8069b679a20/3623558514688536494;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0003?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:19 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051388000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrk2:4119,/bns/yv/borg/yv/bns/blobstore2/bitpusher/277.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=L8ysW9GjEcjogAThu5aQBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/277.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/277:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWVNNdC1OVDFNYTJvWXBrbG1qcDlJMlZaUFZ5bFl5Z2Q3Nk5tQXlXbWR3WVBoMm00dGI3ZmZjOUlzcTU4MmVFcFBhNzhNWGpNZmIzaE9WTE9xRHpNTUFfTG9NQXVJZkdkMGgzSWowZ1dxdW5DS1g3Qk1mQlJxM001TUtMMXBHOWNyU0ZBT29lVkZpTDhpWlBsUDI0VjE5THdzZ0d1ZnVrQTFtVzVJcTJUUkVXeWQyNjRKZC1lS2UxdTAwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrP-Q3OW_tl4K9YltEXTmq5_0_su8TykvlsV5YsalIA9InwpPJmCmdw0Cv2uroid62PFvdUiXZm6xlMQksd9UouJ8buBw" + ] + }, + "Body": "" + } + }, + { + "ID": "e3fcdc643d6a955f", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9cf6f621d3ad5b7a0129dfd00640fe3f/5213970418738976076;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "32" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:20 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:20 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051419000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vro66:4347,/bns/yv/borg/yv/bns/blobstore2/bitpusher/289.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=L8ysW5rnM4b-gQTynLpY" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/289.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/289:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWmMyX1YxcnlBTVZvR05vX19MeXBsclFqc1ZqRm5OZGFfaTNuekctMlgycHRhcERKcHluWjB0MWVWTzB4bWtOLXIwOE9ra3NCbUdkR3dxTEJjYmhMRXhqYzdwVVdDbGRWSjNoVW55ZEdfVE03b01kVnVNajhsU0xvMW9Bcm5EMVpEejJOeGhWeXRqSzc1OWNGc28yTGY5cE1LX3NGWUdtcGlxWVUwQXBPODNVMDJsVms4UHEwRlhWMzQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoDy81ffYtqpt9Im4ag9xtAsE3bkApK6xGw22mK0W4mKIahbq3sQHkR7qHzsIDLDTYzeiWuLYxnHM6ftzE_eI3avG7btw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNub3RpZmljYXRpb25zIn0=" + } + }, + { + "ID": "30df2ed678a1bc12", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "121" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0f92d17533d4f481259e5042dae0f8be/6804100852124383979;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJwYXlsb2FkX2Zvcm1hdCI6Ik5PTkUiLCJ0b3BpYyI6Ii8vcHVic3ViLmdvb2dsZWFwaXMuY29tL3Byb2plY3RzL2R1bGNldC1wb3J0LTc2Mi90b3BpY3MvZ28tc3RvcmFnZS1ub3RpZmljYXRpb24tdGVzdCJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "297" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:20 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051420000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrsq4:4180,/bns/yr/borg/yr/bns/blobstore2/bitpusher/12.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=MMysW6LQAtCOkATL9oqABA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/12.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/12:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWmMyX1YxcnlBTVZvR05vX19MeXBsclFqc1ZqRm5OZGFfaTNuekctMlgycHRhcERKcHluWjB0MWVWTzB4bWtOLXIwOE9ra3NCbUdkR3dxTEJjYmhMRXhqYzdwVVdDbGRWSjNoVW55ZEdfVE03b01kVnVNajhsU0xvMW9Bcm5EMVpEejJOeGhWeXRqSzc1OWNGc28yTGY5cE1LX3NGWUdtcGlxWVUwQXBPODNVMDJsVms4UHEwRlhWMzQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqZ0JCvZ3jCfAdQU0U4oQQTdO4SSYDOnWO1_zcfk84rmXsRwywDGCcL3QeFDLvrXQ1kx8U7Kalb86sIQ1JhGV1yRC7G4Q" + ] + }, + "Body": "eyJpZCI6IjEwIiwidG9waWMiOiIvL3B1YnN1Yi5nb29nbGVhcGlzLmNvbS9wcm9qZWN0cy9kdWxjZXQtcG9ydC03NjIvdG9waWNzL2dvLXN0b3JhZ2Utbm90aWZpY2F0aW9uLXRlc3QiLCJwYXlsb2FkX2Zvcm1hdCI6Ik5PTkUiLCJldGFnIjoiMTAiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvbm90aWZpY2F0aW9uQ29uZmlncy8xMCIsImtpbmQiOiJzdG9yYWdlI25vdGlmaWNhdGlvbiJ9" + } + }, + { + "ID": "1a20023489e65b39", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b707fc96aa6ecc8d21d239a9bf2ca897/8394512751879856266;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "340" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:21 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:21 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051419000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrp184:4188,/bns/yr/borg/yr/bns/blobstore2/bitpusher/91.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=MMysW9XCN8zn4QSk5KsQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/91.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/91:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWmMyX1YxcnlBTVZvR05vX19MeXBsclFqc1ZqRm5OZGFfaTNuekctMlgycHRhcERKcHluWjB0MWVWTzB4bWtOLXIwOE9ra3NCbUdkR3dxTEJjYmhMRXhqYzdwVVdDbGRWSjNoVW55ZEdfVE03b01kVnVNajhsU0xvMW9Bcm5EMVpEejJOeGhWeXRqSzc1OWNGc28yTGY5cE1LX3NGWUdtcGlxWVUwQXBPODNVMDJsVms4UHEwRlhWMzQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrZMY5eFlGX9fTrWRJIZeUIwwpdodFT4ZAfmEWr8ZhnCpaqyDq4XZ6tkLLfnutcc80V5OA2fVD7YkN9a3Ty65mVW9X88Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNub3RpZmljYXRpb25zIiwiaXRlbXMiOlt7ImlkIjoiMTAiLCJ0b3BpYyI6Ii8vcHVic3ViLmdvb2dsZWFwaXMuY29tL3Byb2plY3RzL2R1bGNldC1wb3J0LTc2Mi90b3BpY3MvZ28tc3RvcmFnZS1ub3RpZmljYXRpb24tdGVzdCIsInBheWxvYWRfZm9ybWF0IjoiTk9ORSIsImV0YWciOiIxMCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9ub3RpZmljYXRpb25Db25maWdzLzEwIiwia2luZCI6InN0b3JhZ2Ujbm90aWZpY2F0aW9uIn1dfQ==" + } + }, + { + "ID": "1a78aa71539ea1f2", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs/10?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fe55897f2f9774caed6c3609bac29dab/9984923556452222248;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs/10?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:21 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051421000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrns19:4209,/bns/yr/borg/yr/bns/blobstore2/bitpusher/7.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=McysW7rGCKWLkAT2zYCwBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/7.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/7:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWmMyX1YxcnlBTVZvR05vX19MeXBsclFqc1ZqRm5OZGFfaTNuekctMlgycHRhcERKcHluWjB0MWVWTzB4bWtOLXIwOE9ra3NCbUdkR3dxTEJjYmhMRXhqYzdwVVdDbGRWSjNoVW55ZEdfVE03b01kVnVNajhsU0xvMW9Bcm5EMVpEejJOeGhWeXRqSzc1OWNGc28yTGY5cE1LX3NGWUdtcGlxWVUwQXBPODNVMDJsVms4UHEwRlhWMzQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo63KcORunH_frqXvDI7JVgIHDXzKXeJIoPivdBBNwv00ZNga7njUlQ5sJF3SxO0qTklKAE0kPJr1AZGFQZ2Y50dATW_w" + ] + }, + "Body": "" + } + }, + { + "ID": "147eb7c7f24b19bf", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "54ed24aadb7c2ae57e8c970c5e6bb756/11575335460502596551;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/notificationConfigs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "32" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:22 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:22 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051421000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnbc62:4021,/bns/yx/borg/yx/bns/blobstore2/bitpusher/14.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=McysW42ZM8vnzgLItoTIAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/14.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/14:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWmMyX1YxcnlBTVZvR05vX19MeXBsclFqc1ZqRm5OZGFfaTNuekctMlgycHRhcERKcHluWjB0MWVWTzB4bWtOLXIwOE9ra3NCbUdkR3dxTEJjYmhMRXhqYzdwVVdDbGRWSjNoVW55ZEdfVE03b01kVnVNajhsU0xvMW9Bcm5EMVpEejJOeGhWeXRqSzc1OWNGc28yTGY5cE1LX3NGWUdtcGlxWVUwQXBPODNVMDJsVms4UHEwRlhWMzQwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoK37MBtKFjmQyT21pKKOfUeYJPKIc9VRKGvr-_P3kPVbGZ3u7KB6Xvh6XJ6LHjL-v9I8DWk2U9TfGo1XceVRalOdU1fQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNub3RpZmljYXRpb25zIn0=" + } + }, + { + "ID": "45d0a5288a60555b", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "dbb282b28e87168b0a46837000c32388/13165465889593102438;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Length": [ + "7903" + ], + "Content-Type": [ + "application/octet-stream" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:22 GMT" + ], + "Etag": [ + "\"7a5fd4743bd647485f88496fadb05c51\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:25:22 GMT" + ], + "Last-Modified": [ + "Tue, 04 Oct 2016 16:42:07 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1475599327662000" + ], + "X-Goog-Hash": [ + "crc32c=PWBt8g==", + "md5=el/UdDvWR0hfiElvrbBcUQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "7903" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/48,/bns/xh/borg/xh/bns/blobstore2/bitpusher/51.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=MsysW6OkAo6jswaw3ZvYCg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "570399209098" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/51.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/51:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up6rXgTbuekXkWVQ0gCgVQ02Dr2-EROq2XGin7Ib3JLF9JHP_es5VxOpiGKZkBg_YEIA3jtZa4qxBjcX7UdqHLs_PGzsw" + ] + }, + "Body": "R1JPVVAgPSBMMV9NRVRBREFUQV9GSUxFCiAgR1JPVVAgPSBNRVRBREFUQV9GSUxFX0lORk8KICAgIE9SSUdJTiA9ICJJbWFnZSBjb3VydGVzeSBvZiB0aGUgVS5TLiBHZW9sb2dpY2FsIFN1cnZleSIKICAgIFJFUVVFU1RfSUQgPSAiMDcwMTYwOTE5MT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MSA9IDEyMDEuMTQ0MgogIEVORF9HUk9VUCA9IFRJUlNfVEhFUk1BTF9DT05TVEFOVFMKICBHUk9VUCA9IFBST0pFQ1RJT05fUEFSQU1FVEVSUwogICAgTUFQX1BST0pFQ1RJT04gPSAiVVRNIgogICAgREFUVU0gPSAiV0dTODQiCiAgICBFTExJUFNPSUQgPSAiV0dTODQiCiAgICBVVE1fWk9ORSA9IDEwCiAgICBHUklEX0NFTExfU0laRV9QQU5DSFJPTUFUSUMgPSAxNS4wMAogICAgR1JJRF9DRUxMX1NJWkVfUkVGTEVDVElWRSA9IDMwLjAwCiAgICBHUklEX0NFTExfU0laRV9USEVSTUFMID0gMzAuMDAKICAgIE9SSUVOVEFUSU9OID0gIk5PUlRIX1VQIgogICAgUkVTQU1QTElOR19PUFRJT04gPSAiQ1VCSUNfQ09OVk9MVVRJT04iCiAgRU5EX0dST1VQID0gUFJPSkVDVElPTl9QQVJBTUVURVJTCkVORF9HUk9VUCA9IEwxX01FVEFEQVRBX0ZJTEUKRU5ECg==" + } + }, + { + "ID": "bae7504164fe4568", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/gcp-public-data-landsat/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=LC08%2FPRE%2F044%2F034%2FLC80440342016259LGN00%2F\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3371507263865add4d1078e8a59589e5/13924784329696043957;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/gcp-public-data-landsat/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=LC08%2FPRE%2F044%2F034%2FLC80440342016259LGN00%2F\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "12632" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:22 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:22 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Backends": [ + "vnns10:4437,/bns/yx/borg/yx/bns/blobstore2/bitpusher/171.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=MsysW7-rDoGczAK_vZWoDg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/171.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/171:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "GgIYBiAB" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoPpNMEoN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FuZHNhdC9vL0xDMDglMkZQUkUlMkYwNDQlMkYwMzQlMkZMQzgwNDQwMzQyMDE2MjU5TEdOMDAlMkZMQzgwNDQwMzQyMDE2MjU5TEdOMDBfTVRMLnR4dD9nZW5lcmF0aW9uPTE0NzU1OTkzMjc2NjIwMDAmYWx0PW1lZGlhIiwiY3JjMzJjIjoiUFdCdDhnPT0iLCJldGFnIjoiQ0xDZmh1N0x3YzhDRUFFPSJ9XX0=" + } + }, + { + "ID": "c7689e7bd54ed467", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/noauth", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0662fa93d955eeb17a6331e1cf6e0447/15514914763081451604;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/noauth" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "247" + ], + "Content-Type": [ + "application/xml; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:22 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:22 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/2,/bns/xh/borg/xh/bns/blobstore2/bitpusher/8.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=MsysW9eyIO-pswargaYo" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/8.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/8:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqSWX6bbSACxWtisyOqrB0FFhXZvIKKF-1cOgd0ZqNByKVEy5Q1lWj1qHMWRQt3MxzCYbUkOAR2SUmGHE5OR-FZX-WY6Q" + ] + }, + "Body": "PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48RXJyb3I+PENvZGU+QWNjZXNzRGVuaWVkPC9Db2RlPjxNZXNzYWdlPkFjY2VzcyBkZW5pZWQuPC9NZXNzYWdlPjxEZXRhaWxzPkFub255bW91cyBjYWxsZXIgZG9lcyBub3QgaGF2ZSBzdG9yYWdlLm9iamVjdHMuZ2V0IGFjY2VzcyB0byBnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvbm9hdXRoLjwvRGV0YWlscz48L0Vycm9yPg==" + } + }, + { + "ID": "96502a977c21b138", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Content-Type": [ + "multipart/related; boundary=00e007d7435d4eaf0875edb23883d9d4bbfaded1bae201e5f54a947851a5" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "38c6656bc98c27aef7b61563fb1e9022/16346289697710693283;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0wMGUwMDdkNzQzNWQ0ZWFmMDg3NWVkYjIzODgzZDlkNGJiZmFkZWQxYmFlMjAxZTVmNTRhOTQ3ODUxYTUNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJub2F1dGgifQoNCi0tMDBlMDA3ZDc0MzVkNGVhZjA4NzVlZGIyMzg4M2Q5ZDRiYmZhZGVkMWJhZTIwMWU1ZjU0YTk0Nzg1MWE1DQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NCg0KYg0KLS0wMGUwMDdkNzQzNWQ0ZWFmMDg3NWVkYjIzODgzZDlkNGJiZmFkZWQxYmFlMjAxZTVmNTRhOTQ3ODUxYTUtLQ0K" + }, + "Response": { + "StatusCode": 401, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "30201" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:23 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "Www-Authenticate": [ + "Bearer realm=\"https://accounts.google.com/\"" + ], + "X-Google-Backends": [ + "vrqn25:4154,/bns/yv/borg/yv/bns/blobstore2/bitpusher/382.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=MsysW8ieMteFggSMxJTIBQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/382.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/382:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "GgIYBiAB" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqp-fy5ql5YosFNoW2Ob6gd1EZdom7gCNISKx9v42hqbTrP0Q0Cry_pxzCAPHGXPMO8LuXmBEIylU3Z5u2Xcl57AYd52A" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlY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N5RXJyb3JDb252ZXJ0ZXIuamF2YTo2Nylcblx0YXQgY29tLmdvb2dsZS5hcGkuc2VydmVyLnJlc3QuYWRhcHRlci5yb3N5LlJvc3lIYW5kbGVyJDIuY2FsbChSb3N5SGFuZGxlci5qYXZhOjI1OClcblx0YXQgY29tLmdvb2dsZS5hcGkuc2VydmVyLnJlc3QuYWRhcHRlci5yb3N5LlJvc3lIYW5kbGVyJDIuY2FsbChSb3N5SGFuZGxlci5qYXZhOjIzOClcblx0YXQgY29tLmdvb2dsZS5hcGkuc2VydmVyLmNvcmUudXRpbC5DYWxsYWJsZUZ1dHVyZS5ydW4oQ2FsbGFibGVGdXR1cmUuamF2YTo2Milcblx0Li4uIDE5IG1vcmVcbiJ9XSwiY29kZSI6NDAxLCJtZXNzYWdlIjoiQW5vbnltb3VzIGNhbGxlciBkb2VzIG5vdCBoYXZlIHN0b3JhZ2Uub2JqZWN0cy5jcmVhdGUgYWNjZXNzIHRvIGdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9ub2F1dGguIn19" + } + }, + { + "ID": "8607aa9eb0964439", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d93163707f2d013836306547b4dbcd8e/17936700502266216770;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Length": [ + "7903" + ], + "Content-Type": [ + "application/octet-stream" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:23 GMT" + ], + "Etag": [ + "\"7a5fd4743bd647485f88496fadb05c51\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:25:23 GMT" + ], + "Last-Modified": [ + "Tue, 04 Oct 2016 16:42:07 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1475599327662000" + ], + "X-Goog-Hash": [ + "crc32c=PWBt8g==", + "md5=el/UdDvWR0hfiElvrbBcUQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "7903" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/46,/bns/xh/borg/xh/bns/blobstore2/bitpusher/15.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=M8ysW8T2B-ShswbYw67IAw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "570399209098" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/15.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/15:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo3fxL6bHvnU8nsWyoPO4uYF9iyasj5Qltu6jAK4p0aCtdJC8ETwmXOR7L7KeIRvEUUt8ty9hzcDNO535kFdMIU7RPaCg" + ] + }, + "Body": "R1JPVVAgPSBMMV9NRVRBREFUQV9GSUxFCiAgR1JPVVAgPSBNRVRBREFUQV9GSUxFX0lORk8KICAgIE9SSUdJTiA9ICJJbWFnZSBjb3VydGVzeSBvZiB0aGUgVS5TLiBHZW9sb2dpY2FsIFN1cnZleSIKICAgIFJFUVVFU1RfSUQgPSAiMDcwMTYwOTE5MTA1MV8wMDAwNCIKICAgIExBTkRTQVRfU0NFTkVfSUQgPSAiTEM4MDQ0MDM0MjAxNjI1OUxHTjAwIgogICAgRklMRV9EQVRFID0gMjAxNi0wOS0yMFQwMzoxMzowMloKICAgIFNUQVRJT05fSUQgPSAiTEdOIgogICAgUFJPQ0VTU0lOR19TT0ZUV0FSRV9WRVJTSU9OID0gIkxQR1NfMi42LjIiCiAgRU5EX0dST1VQID0gTUVUQURBVEFfRklMRV9JTkZPCiAgR1JPVVAgPSBQUk9EVUNUX01FVEFEQVRBCiAgICBEQVRBX1RZUEUgPSAiTDFUIgogICAgRUxFVkFUSU9OX1NPVVJDRSA9ICJHTFMyMDAwIgogICAgT1VUUFVUX0ZPUk1BVCA9ICJHRU9USUZGIgogICAgU1BBQ0VDUkFGVF9JRCA9ICJMQU5EU0FUXzgiCiAgICBTRU5TT1JfSUQgPSAiT0xJX1RJUlMiCiAgICBXUlNfUEFUSCA9IDQ0CiAgICBXUlNfUk9XID0gMzQKICAgIE5BRElSX09GRk5BRElSID0gIk5BRElSIgogICAgVEFSR0VUX1dSU19QQVRIID0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method": "GET", + "URL": "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "69db1d4acd1dab1a05e8020d75e69a96/1080368332623947488;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Length": [ + "7903" + ], + "Content-Type": [ + "application/octet-stream" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:23 GMT" + ], + "Etag": [ + "\"7a5fd4743bd647485f88496fadb05c51\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:25:23 GMT" + ], + "Last-Modified": [ + "Tue, 04 Oct 2016 16:42:07 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1475599327662000" + ], + "X-Goog-Hash": [ + "crc32c=PWBt8g==", + "md5=el/UdDvWR0hfiElvrbBcUQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "7903" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/38,/bns/xh/borg/xh/bns/blobstore2/bitpusher/68.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=M8ysW9CvC8GtswbB8IvgCQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "570399209098" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/68.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/68:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrHSEfW3gOHJga9kM0Pmg6J0nyVfHMmECSPbLUU9cgmDPy1u4tlWjQr1iWWGrmDplvE3AqXPnIH9B0qW2KILY169X1coQ" + ] + }, + "Body": "R1JPVVAgPSBMMV9NRVRBREFUQV9GSUxFCiAgR1JPVVAgPSBNRVRBREFUQV9GSUxFX0lORk8KICAgIE9SSUdJTiA9ICJJbWFnZSBjb3VydGVzeSBvZiB0aGUgVS5TLiBHZW9sb2dpY2FsIFN1cnZleSIKICAgIFJFUVVFU1RfSUQgPSAiMDcwMTYwOTE5MTA1MV8wMDAwNCIKICAgIExBTkRTQVRfU0NFTkVfSUQgPSAiTEM4MDQ0MDM0MjAxNjI1OUxHTjAwIgogICAgRklMRV9EQVRFID0gMjAxNi0wOS0yMFQwMzoxMzowMloKICAgIFNUQVRJT05fSUQgPSAiTEd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FUVU0gPSAiV0dTODQiCiAgICBFTExJUFNPSUQgPSAiV0dTODQiCiAgICBVVE1fWk9ORSA9IDEwCiAgICBHUklEX0NFTExfU0laRV9QQU5DSFJPTUFUSUMgPSAxNS4wMAogICAgR1JJRF9DRUxMX1NJWkVfUkVGTEVDVElWRSA9IDMwLjAwCiAgICBHUklEX0NFTExfU0laRV9USEVSTUFMID0gMzAuMDAKICAgIE9SSUVOVEFUSU9OID0gIk5PUlRIX1VQIgogICAgUkVTQU1QTElOR19PUFRJT04gPSAiQ1VCSUNfQ09OVk9MVVRJT04iCiAgRU5EX0dST1VQID0gUFJPSkVDVElPTl9QQVJBTUVURVJTCkVORF9HUk9VUCA9IEwxX01FVEFEQVRBX0ZJTEUKRU5ECg==" + } + }, + { + "ID": "29af8223e2f49bec", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt", + "Proto": "HTTP/1.1", + "Header": { + "Range": [ + "bytes=1-" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4db663877b8e7c5ce86381f47f69dc9b/2598723742148021375;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 206, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Length": [ + "7902" + ], + "Content-Range": [ + "bytes 1-7902/7903" + ], + "Content-Type": [ + "application/octet-stream" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:23 GMT" + ], + "Etag": [ + "\"7a5fd4743bd647485f88496fadb05c51\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:25:23 GMT" + ], + "Last-Modified": [ + "Tue, 04 Oct 2016 16:42:07 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1475599327662000" + ], + "X-Goog-Hash": [ + "crc32c=PWBt8g==", + "md5=el/UdDvWR0hfiElvrbBcUQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "7903" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/11,/bns/xh/borg/xh/bns/blobstore2/bitpusher/20.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=M8ysW_K3DsesswbQ_qAo" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "570399209098" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/20.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/20:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-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U5EXzkgPSAtMC4xMDAwMDAKICBFTkRfR1JPVVAgPSBSQURJT01FVFJJQ19SRVNDQUxJTkcKICBHUk9VUCA9IFRJUlNfVEhFUk1BTF9DT05TVEFOVFMKICAgIEsxX0NPTlNUQU5UX0JBTkRfMTAgPSA3NzQuODg1MwogICAgSzFfQ09OU1RBTlRfQkFORF8xMSA9IDQ4MC44ODgzCiAgICBLMl9DT05TVEFOVF9CQU5EXzEwID0gMTMyMS4wNzg5CiAgICBLMl9DT05TVEFOVF9CQU5EXzExID0gMTIwMS4xNDQyCiAgRU5EX0dST1VQID0gVElSU19USEVSTUFMX0NPTlNUQU5UUwogIEdST1VQID0gUFJPSkVDVElPTl9QQVJBTUVURVJTCiAgICBNQVBfUFJPSkVDVElPTiA9ICJVVE0iCiAgICBEQVRVTSA9ICJXR1M4NCIKICAgIEVMTElQU09JRCA9ICJXR1M4NCIKICAgIFVUTV9aT05FID0gMTAKICAgIEdSSURfQ0VMTF9TSVpFX1BBTkNIUk9NQVRJQyA9IDE1LjAwCiAgICBHUklEX0NFTExfU0laRV9SRUZMRUNUSVZFID0gMzAuMDAKICAgIEdSSURfQ0VMTF9TSVpFX1RIRVJNQUwgPSAzMC4wMAogICAgT1JJRU5UQVRJT04gPSAiTk9SVEhfVVAiCiAgICBSRVNBTVBMSU5HX09QVElPTiA9ICJDVUJJQ19DT05WT0xVVElPTiIKICBFTkRfR1JPVVAgPSBQUk9KRUNUSU9OX1BBUkFNRVRFUlMKRU5EX0dST1VQID0gTDFfTUVUQURBVEFfRklMRQpFTkQK" + } + }, + { + "ID": "a5cc268bb6d1901b", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt", + "Proto": "HTTP/1.1", + "Header": { + "Range": [ + "bytes=0-17" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "09ad91b6f03772df950fe8e60e38b515/4189135646215237917;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/gcp-public-data-landsat/LC08/PRE/044/034/LC80440342016259LGN00/LC80440342016259LGN00_MTL.txt" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 206, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Length": [ + "18" + ], + "Content-Range": [ + "bytes 0-17/7903" + ], + "Content-Type": [ + "application/octet-stream" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:23 GMT" + ], + "Etag": [ + "\"7a5fd4743bd647485f88496fadb05c51\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:25:23 GMT" + ], + "Last-Modified": [ + "Tue, 04 Oct 2016 16:42:07 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1475599327662000" + ], + "X-Goog-Hash": [ + "crc32c=PWBt8g==", + "md5=el/UdDvWR0hfiElvrbBcUQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "7903" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/9,/bns/xh/borg/xh/bns/blobstore2/bitpusher/84.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=M8ysW6m8Ee6iswap5okY" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "570399209098" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/84.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/84:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqkVgj_WF9UVLkpunOc4f5drxYHK8wCMGJ7_8XXUZHjlPkkeMgAoXxEItBA_PzaL4caKEF9IdpCYBJ3TGiRJVImw-TsSw" + ] + }, + "Body": "R1JPVVAgPSBMMV9NRVRBREFU" + } + }, + { + "ID": "574c045ea3cf3804", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/storage-library-test-bucket/gzipped-text.txt", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "da531b177a2f61995e226a1dbd8bddba/5779266075288967100;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/storage-library-test-bucket/gzipped-text.txt" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:23 GMT" + ], + "Etag": [ + "\"c6117833aa4d1510d09ef69144d56790\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:25:23 GMT" + ], + "Last-Modified": [ + "Tue, 14 Nov 2017 13:07:32 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Accept-Encoding" + ], + "X-Goog-Generation": [ + "1510664852486988" + ], + "X-Goog-Hash": [ + "crc32c=T1s5RQ==", + "md5=xhF4M6pNFRDQnvaRRNVnkA==" + ], + "X-Goog-Metageneration": [ + "2" + ], + "X-Goog-Storage-Class": [ + "MULTI_REGIONAL" + ], + "X-Goog-Stored-Content-Encoding": [ + "gzip" + ], + "X-Goog-Stored-Content-Length": [ + "31" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/34,/bns/xh/borg/xh/bns/blobstore2/bitpusher/70.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=M8ysW4fJE4-nswav84G4Aw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "149776848335" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/70.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Body-Transformations": [ + "chunked" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/70:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo9Aj65b1Br7RgKAI30zOrcX8vmaoramy1cI5Ecx8HOMYG4EgpcqnaTGYdlH3irWvCrEeseqO2eVWcLhXryI224usemaQ" + ] + }, + "Body": "H4sIAAAAAAAAC8tIzcnJVyjPL8pJAQCFEUoNCwAAAA==" + } + }, + { + "ID": "027b227c73085f2e", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/storage-library-test-bucket/gzipped-text.txt", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6e48de6be47e1726efca75ecf91cc67f/7369676879861267547;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/storage-library-test-bucket/gzipped-text.txt" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:23 GMT" + ], + "Etag": [ + "\"c6117833aa4d1510d09ef69144d56790\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:25:23 GMT" + ], + "Last-Modified": [ + "Tue, 14 Nov 2017 13:07:32 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Accept-Encoding" + ], + "X-Goog-Generation": [ + "1510664852486988" + ], + "X-Goog-Hash": [ + "crc32c=T1s5RQ==", + "md5=xhF4M6pNFRDQnvaRRNVnkA==" + ], + "X-Goog-Metageneration": [ + "2" + ], + "X-Goog-Storage-Class": [ + "MULTI_REGIONAL" + ], + "X-Goog-Stored-Content-Encoding": [ + "gzip" + ], + "X-Goog-Stored-Content-Length": [ + "31" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/10,/bns/xh/borg/xh/bns/blobstore2/bitpusher/29.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=M8ysW42-IqunswbA1YPwDQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "149776848335" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/29.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Body-Transformations": [ + "chunked" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/29:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqNTsfcXgqxyenoWbH8XJlTngFOKqu9awa6fdF9AQIuGB20Yt5aSpNaZW5_v89qJTm-X1F0f9wI_IuIjUYNTUmTc5uHYw" + ] + }, + "Body": "H4sIAAAAAAAAC8tIzcnJVyjPL8pJAQCFEUoNCwAAAA==" + } + }, + { + "ID": "65a7840a56398b21", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/storage-library-test-bucket/gzipped-text.txt", + "Proto": "HTTP/1.1", + "Header": { + "Range": [ + "bytes=1-8" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3766269e952d05c271145eb0fd87c8ee/8960088783911707385;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/storage-library-test-bucket/gzipped-text.txt" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:23 GMT" + ], + "Etag": [ + "W/\"c6117833aa4d1510d09ef69144d56790\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:25:23 GMT" + ], + "Last-Modified": [ + "Tue, 14 Nov 2017 13:07:32 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Accept-Encoding" + ], + "Warning": [ + "214 UploadServer gunzipped" + ], + "X-Goog-Generation": [ + "1510664852486988" + ], + "X-Goog-Hash": [ + "crc32c=T1s5RQ==", + "md5=xhF4M6pNFRDQnvaRRNVnkA==" + ], + "X-Goog-Metageneration": [ + "2" + ], + "X-Goog-Storage-Class": [ + "MULTI_REGIONAL" + ], + "X-Goog-Stored-Content-Encoding": [ + "gzip" + ], + "X-Goog-Stored-Content-Length": [ + "31" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/45,/bns/xh/borg/xh/bns/blobstore2/bitpusher/80.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=M8ysW57NJc6kswbMy5uwDQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "149776848335" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/80.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/80:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Response-Body-Transformations": [ + "gunzipped" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoCc2I6_fp7BwCazBRuRPMhs5e3Cb1CjNL8hf2WwiHrn7M9O2VYBnD8dGiXXE7OjpzmNwMs_p79POAwtNGqirsz6xeq_g" + ] + }, + "Body": "aGVsbG8gd29ybGQ=" + } + }, + { + "ID": "f4246d20764d26ad", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/storage-library-test-bucket/gzipped-text.txt", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Range": [ + "bytes=1-8" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e75f866fd5e45b56d113d16373ec968e/10550500683683956632;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/storage-library-test-bucket/gzipped-text.txt" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 206, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Encoding": [ + "gzip" + ], + "Content-Range": [ + "bytes 1-8/31" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:23 GMT" + ], + "Etag": [ + "\"c6117833aa4d1510d09ef69144d56790\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:25:23 GMT" + ], + "Last-Modified": [ + "Tue, 14 Nov 2017 13:07:32 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Accept-Encoding" + ], + "X-Goog-Generation": [ + "1510664852486988" + ], + "X-Goog-Hash": [ + "crc32c=T1s5RQ==", + "md5=xhF4M6pNFRDQnvaRRNVnkA==" + ], + "X-Goog-Metageneration": [ + "2" + ], + "X-Goog-Storage-Class": [ + "MULTI_REGIONAL" + ], + "X-Goog-Stored-Content-Encoding": [ + "gzip" + ], + "X-Goog-Stored-Content-Length": [ + "31" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/36,/bns/xh/borg/xh/bns/blobstore2/bitpusher/25.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=M8ysW7TbLsuiswbL5ISoCw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "149776848335" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/25.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Body-Transformations": [ + "chunked" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/25:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqAL855d-gxFgB7THGC-650cvXihw5lB59ggNnDFfjg6XIgDXyuFTpLW-pmFjXgB8CNqbblqfCMo_-TRThQ1RXYXnsZvA" + ] + }, + "Body": "iwgAAAAAAAA=" + } + }, + { + "ID": "a51b58139c178bc6", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "168" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e7e4e8d35d137df1fe1d2c0195b8596f/12899949557172305798;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJjb3JzIjpbeyJtYXhBZ2VTZWNvbmRzIjozNjAwLCJtZXRob2QiOlsiUE9TVCJdLCJvcmlnaW4iOlsic29tZS1vcmlnaW4uY29tIl0sInJlc3BvbnNlSGVhZGVyIjpbImZvby1iYXIiXX1dLCJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA0In0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "534" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:24 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051423000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vncf185:4324,/bns/yx/borg/yx/bns/blobstore2/bitpusher/43.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=M8ysW5ehOszUzwKklI3gBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/43.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/43:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up-M82G1RCRAc4_k2TYOnb54Ji0mbQimQSLP7qmP1TJf7ZRPv4LLs5J5r7Hq4Rdkww8v4v9YsGo_Un_5Pzb_4JhXoxKGg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNCIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDQiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MjQuNTg1WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjI0LjU4NVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwiY29ycyI6W3sib3JpZ2luIjpbInNvbWUtb3JpZ2luLmNvbSJdLCJtZXRob2QiOlsiUE9TVCJdLCJyZXNwb25zZUhlYWRlciI6WyJmb28tYmFyIl0sIm1heEFnZVNlY29uZHMiOjM2MDB9XSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "42f28f433400a58f", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0004?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "99" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3f718e5ff9b55972984cc82b6fbdcae7/14490079990540936485;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0004?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJjb3JzIjpbeyJtYXhBZ2VTZWNvbmRzIjozNjAwLCJtZXRob2QiOlsiR0VUIl0sIm9yaWdpbiI6WyIqIl0sInJlc3BvbnNlSGVhZGVyIjpbInNvbWUtaGVhZGVyIl19XX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2450" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:26 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051425000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnu199:4210,/bns/yx/borg/yx/bns/blobstore2/bitpusher/22.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=NMysW-G4MY3kzgKkyrfoBQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/22.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/22:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpCe8icExj8XMpYK1TObRcXWmSYabbYDaYeKKLNa4ElTNYmug1iz39xmlHlwvVla0d8DUorCDA1nCJfEmcy28KN9CoA-A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNCIsInByb2plY3ROdW1iZXIiOiIzNj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ycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsImNvcnMiOlt7Im9yaWdpbiI6WyIqIl0sIm1ldGhvZCI6WyJHRVQiXSwicmVzcG9uc2VIZWFkZXIiOlsic29tZS1oZWFkZXIiXSwibWF4QWdlU2Vjb25kcyI6MzYwMH1dLCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUk9In0=" + } + }, + { + "ID": "38e349c8d229e705", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0004?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "95faa0d1e208bca5ba1106e6ea570244/16080490790818400963;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0004?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2450" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:26 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:26 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051426000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrcb128:4027,/bns/yv/borg/yv/bns/blobstore2/bitpusher/190.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=NsysW8OWHoOxgAT7pqv4Bg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/190.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/190:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur_SZVOmSR3gw9aBQWrXPXpmAsXUZBMfCAN8ENQ_RN82GUM4ABJX22dwPm4swzz7-fMmky7rvfvKnYnl6_c6YJ9j07hrw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctND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{ + "ID": "201a3cf4195f61d8", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "168" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c3052cb0ee7da0aa57130dd12681b838/17670902694868775010;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJjb3JzIjpbeyJtYXhBZ2VTZWNvbmRzIjozNjAwLCJtZXRob2QiOlsiUE9TVCJdLCJvcmlnaW4iOlsic29tZS1vcmlnaW4uY29tIl0sInJlc3BvbnNlSGVhZGVyIjpbImZvby1iYXIiXX1dLCJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA1In0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "534" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:27 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051426000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnj6:4466,/bns/yr/borg/yr/bns/blobstore2/bitpusher/84.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=NsysW5DdN8zukAPMwpbQAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/84.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/84:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoG59nolJu6P0lapnCNLBjPlFcDG0CVkGRFPV3BFR1UfhJQCi9yzi6WMFaNAMnYw9Bb3a-9hRBOBzwpOb4uVLG_EE92Eg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDUiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MjcuMzU5WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjI3LjM1OVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwiY29ycyI6W3sib3JpZ2luIjpbInNvbWUtb3JpZ2luLmNvbSJdLCJtZXRob2QiOlsiUE9TVCJdLCJyZXNwb25zZUhlYWRlciI6WyJmb28tYmFyIl0sIm1heEFnZVNlY29uZHMiOjM2MDB9XSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "eb6d0b7663c27948", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0005?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "12" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b6ba08a729c3d3528af9897e48ea3fa4/814852000203085057;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0005?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJjb3JzIjpbXX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:29 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051428000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbj188:4240,/bns/yv/borg/yv/bns/blobstore2/bitpusher/68.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=N8ysW_irKov0ggTO1KqQAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/68.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/68:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-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Y2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "cdf00ab26a2eecdb", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0005?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1cea50076c2bab86b3ce930141093eab/2404982433571781535;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0005?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:29 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:29 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051426000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vryy20:4108,/bns/yv/borg/yv/bns/blobstore2/bitpusher/192.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=OcysW7DjFMHMggTy3YG4Bw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/192.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/192:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpyfPH9R-BUYTQzVBjOfEEm9o1nvg54Vz71KBk2t11KwyBI2oi6DYTIPU9Cup_5FPyy5kh-VfhAstvK1mjD1YQx-RPgkw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDUiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MjcuMzU5WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjI5LjEyNloiLCJtZXRhZ2VuZXJhdGlvbiI6IjIiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNS9wcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNS9hY2wvcHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUiLCJidWNrZX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IjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "f9c38c019794b168", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "168" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8295ef2a2a15de2124b88197b9465c54/3995394333344030782;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJjb3JzIjpbeyJtYXhBZ2VTZWNvbmRzIjozNjAwLCJtZXRob2QiOlsiUE9TVCJdLCJvcmlnaW4iOlsic29tZS1vcmlnaW4uY29tIl0sInJlc3BvbnNlSGVhZGVyIjpbImZvby1iYXIiXX1dLCJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA2In0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "534" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:30 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051426000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqe11:4421,/bns/yv/borg/yv/bns/blobstore2/bitpusher/396.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=OcysW86nJZGegQT-37-ACg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/396.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/396:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo_my9bAu29KvP4rzQoJzMdiiYYqWd8m1uzJtVPqV3kOjqBRbGx8OquWEnvo1F7y7f6PVuoXBgsm9NPw2yJ6o6aWH2PkA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDYiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MzAuMDczWiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjMwLjA3M1oiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwiY29ycyI6W3sib3JpZ2luIjpbInNvbWUtb3JpZ2luLmNvbSJdLCJtZXRob2QiOlsiUE9TVCJdLCJyZXNwb25zZUhlYWRlciI6WyJmb28tYmFyIl0sIm1heEFnZVNlY29uZHMiOjM2MDB9XSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "5d0109fed5cee25f", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0006?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4a0a65366ac125c025782d5fd149b821/5585805137899554525;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0006?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2461" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:31 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051425000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnqq187:4192,/bns/yx/borg/yx/bns/blobstore2/bitpusher/119.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=OsysW7_8EcTazALWu7ngBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/119.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/119:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoOkjse13ks1uQtqU-WbIvtpBa6yVJ6A5Qp1A2-N34QjdmA2cc9r6ndxNskGAEOHhNXZUOmh8jUb5P9eV9ZEMwkMiG7IQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDYiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MzAuMDczWiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjMxLjcxOVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjIiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNi9wcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA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0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsImNvcnMiOlt7Im9yaWdpbiI6WyJzb21lLW9yaWdpbi5jb20iXSwibWV0aG9kIjpbIlBPU1QiXSwicmVzcG9uc2VIZWFkZXIiOlsiZm9vLWJhciJdLCJtYXhBZ2VTZWNvbmRzIjozNjAwfV0sInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "483300c086bf9ae9", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0006?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "675dc0a89aa84ed882e3a11dfc3730f2/7175935571285027707;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0006?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2461" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:32 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:32 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051426000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnb2:4089,/bns/yr/borg/yr/bns/blobstore2/bitpusher/100.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=O8ysW7TNOM3WkAPE_IHQBA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/100.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/100:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpRsZHqvgZPQpv14ylowOLinJDJpespKmK-QjuUL3ZKrxs7YV-WnDO6S7a3PpiKRf66PPEkvVIGhKLNYbHcQlZS8oOq0Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDYiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MzAuMDczWiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjMxLjcxOVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjIiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZ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mVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsImNvcnMiOlt7Im9yaWdpbiI6WyJzb21lLW9yaWdpbi5jb20iXSwibWV0aG9kIjpbIlBPU1QiXSwicmVzcG9uc2VIZWFkZXIiOlsiZm9vLWJhciJdLCJtYXhBZ2VTZWNvbmRzIjozNjAwfV0sInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "0a993f21217a7c27", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0006?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e4ddf1ae658880bee0b64eeb36e42981/8766347471040499994;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0006?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:32 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051426000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrfn8:4395,/bns/yv/borg/yv/bns/blobstore2/bitpusher/181.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=PMysW_LpDMfugwS5tIzoDQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/181.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/181:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpYoiT9dFZEe3bYZpKBDdNo1qGJBj162YN_q2mfCF_Cu5UIhC_Ib0VD7PPM6Z1VcjdiHoVEw9wba5WuX-B3x5i3I9fm9Q" + ] + }, + "Body": "" + } + }, + { + "ID": "e8642f6985fa8167", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0005?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4a1637b431168dd8d2277b2854b6f278/10356759375107716792;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0005?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:33 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051426000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdm4:4150,/bns/yw/borg/yw/bns/blobstore2/bitpusher/164.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=PMysW9aXKc22hAS_5bvYCw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/164.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/164:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrlJunYzNiZ4k0A_LqRHm4z2KBn7d1n1oGjjxubNDFJyV2A-_4zxyOnt2gruJckXZXPqElJtv2294941mmIre0KfiIXrg" + ] + }, + "Body": "" + } + }, + { + "ID": "1311ecad1f217ee7", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0004?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "86e26ae2e91c98c6d858aa23da3cb616/11947171279174867799;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0004?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:33 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051426000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlj28:4249,/bns/yv/borg/yv/bns/blobstore2/bitpusher/28.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=PcysW_HtCaGeggTshbKAAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/28.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/28:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWXA3ZUxTdWNBTVN4aWpIaGJ4VldlcTlheV9Zb3I5dEQ4cFplQ0NNUklKLXJMQ29yX2JvaXdtdVhYRGNISTRfdURWYUtTRHVfVFhtWTl4dXBBOC1JUGZudFFaRnRLOTNlbTg3ZTNlbUFkYjFaUVA3cWo5Mjg0YmM3cllER3ZKRUFrZ0tVT1FiWUZJcmtReWs5WFZIZEpKOHd2NmJPX3FGNl9pZ2Uxcl8yX0pLb2dfenJSUHJlU2JnYUEwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqLJGRwcwdpiAlh0ePB0ISuYu9FlsEpZ3h5iTHzsEVGBUhR7u_OU3vT_S8kXM9NBplmomCJEJnrR4UEd6FnPhbPMtCG8A" + ] + }, + "Body": "" + } + }, + { + "ID": "f30064255790a2af", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "60" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3c8bd795d7c1a203f1bae8d0ab810313/13537300608753746422;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA3In0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "426" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:34 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051433000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrks2:4058,/bns/yv/borg/yv/bns/blobstore2/bitpusher/13.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=PcysW8CfJtCuggSokbuwAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/13.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/13:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYi1PQjdMLThUMnZyYTB2bmdDZG5Fcy1LcUZWSXdtNkVRelFHbGZaVklXSU5rZW13RTJrNFBMVXh1UWo0RFRtYVBCdWxseXRyRXpsT0lHU2xzN1dEemZKM19Ra01WNmpHamVLUGJ1Z1RvZlhMTGtwNjFocHVIMV9nQTBLb01jdUJ3V092OUdPaXo5Slk0Vzh4M09EVUhFa00tQjFYSGxHQXpzWlhkT0VOenZPOXBHWm1oRklaODBwaE0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrX9H1l8bHhu8BqnaOvrWr7wtB68Ft1FDeOFpqId9pv3vtPqFJjXeFBLQSvGYWFQ3ZN8EQsk7AnKRjU3u2iE9xhK5vykQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNyIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDciLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MzQuMDcyWiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjM0LjA3MloiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "59578f52a5f0077e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "bc0ab534806ff533a56aec2f744ee2b5/15127712512820962964;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:34 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:34 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051434000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrhq4:4312,/bns/yr/borg/yr/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=PsysW-KPHIvykAO0grpg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/115:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYi1PQjdMLThUMnZyYTB2bmdDZG5Fcy1LcUZWSXdtNkVRelFHbGZaVklXSU5rZW13RTJrNFBMVXh1UWo0RFRtYVBCdWxseXRyRXpsT0lHU2xzN1dEemZKM19Ra01WNmpHamVLUGJ1Z1RvZlhMTGtwNjFocHVIMV9nQTBLb01jdUJ3V092OUdPaXo5Slk0Vzh4M09EVUhFa00tQjFYSGxHQXpzWlhkT0VOenZPOXBHWm1oRklaODBwaE0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqwryHXSpXa_3TP9lnjG7MuIY4Q5mztKCJrgUSoYoDze9zLlxy1hZ2v9u1kRpBHROyDnBQ70gC3JhfY4GF-uMl6d51JLg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNyIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDciLCJ0aW1lQ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OiJvd25lcnMifSwiZXRhZyI6IkNBRT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FFPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBRT0ifQ==" + } + }, + { + "ID": "1fc47512e39433d9", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "31" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f56bd42d61719e5d5394eb0093b2999b/16646067922345036851;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZWZhdWx0RXZlbnRCYXNlZEhvbGQiOnRydWV9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2382" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:36 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051435000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlm74:4305,/bns/yv/borg/yv/bns/blobstore2/bitpusher/290.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=PsysW_XeLIvRgQTe5JKYDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/290.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/290:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYi1PQjdMLThUMnZyYTB2bmdDZG5Fcy1LcUZWSXdtNkVRelFHbGZaVklXSU5rZW13RTJrNFBMVXh1UWo0RFRtYVBCdWxseXRyRXpsT0lHU2xzN1dEemZKM19Ra01WNmpHamVLUGJ1Z1RvZlhMTGtwNjFocHVIMV9nQTBLb01jdUJ3V092OUdPaXo5Slk0Vzh4M09EVUhFa00tQjFYSGxHQXpzWlhkT0VOenZPOXBHWm1oRklaODBwaE0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoRKpiybYkviqDw7fneNk_UqWCvNv7c_YIwoSOkNKZy7vD8vPynoCS3vuKPgXgpTIRom4njyLpqFT2D7omgRPQqiv0PKw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNyIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkz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TkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsImRlZmF1bHRFdmVudEJhc2VkSG9sZCI6dHJ1ZSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FJPSJ9" + } + }, + { + "ID": "71f85ffea051d16c", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "09d86e943aa5cba8e06dd981791e0a0e/18236479826412188114;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2382" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:36 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:36 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051434000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrtg21:4099,/bns/yr/borg/yr/bns/blobstore2/bitpusher/29.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=QMysW_CjFISz4QT5n6jACQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/29.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/29:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYi1PQjdMLThUMnZyYTB2bmdDZG5Fcy1LcUZWSXdtNkVRelFHbGZaVklXSU5rZW13RTJrNFBMVXh1UWo0RFRtYVBCdWxseXRyRXpsT0lHU2xzN1dEemZKM19Ra01WNmpHamVLUGJ1Z1RvZlhMTGtwNjFocHVIMV9nQTBLb01jdUJ3V092OUdPaXo5Slk0Vzh4M09EVUhFa00tQjFYSGxHQXpzWlhkT0VOenZPOXBHWm1oRklaODBwaE0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UowVyCkB2mA474S_48RgPdZ2QPyUaTI8UwGuVPpNhCLh8yU9jJCxtTsTyFvI1pg5jtqGhx-TRklbSiIVcsU5MZbIDzc3A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwNyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0a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iOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsImRlZmF1bHRFdmVudEJhc2VkSG9sZCI6dHJ1ZSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FJPSJ9" + } + }, + { + "ID": "730e0f88fcfb808c", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "35" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ff1adbcb58c978e9ea27b7abbc181386/1380147656753141616;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJiaWxsaW5nIjp7InJlcXVlc3RlclBheXMiOnRydWV9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2415" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:38 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051435000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrw127:4318,/bns/yv/borg/yv/bns/blobstore2/bitpusher/178.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=QMysW_nCJcTIggSEmZeoDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/178.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/178:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYi1PQjdMLThUMnZyYTB2bmdDZG5Fcy1LcUZWSXdtNkVRelFHbGZaVklXSU5rZW13RTJrNFBMVXh1UWo0RFRtYVBCdWxseXRyRXpsT0lHU2xzN1dEemZKM19Ra01WNmpHamVLUGJ1Z1RvZlhMTGtwNjFocHVIMV9nQTBLb01jdUJ3V092OUdPaXo5Slk0Vzh4M09EVUhFa00tQjFYSGxHQXpzWlhkT0VOenZPOXBHWm1oRklaODBwaE0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq79m0pVSBsXB0mmUTWEnrP1CqxwCQzUZUOAZCkXG-y4JXjctCThCoxM8yjvmJfnanm-nZ-USf3cXWOpF0M6PSknqeVdg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW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request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "cf218679be1b3e915c329ce5ba4659e3/2970558461325442063;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2415" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:38 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:38 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051434000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrea4:4208,/bns/yv/borg/yv/bns/blobstore2/bitpusher/227.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=QsysW__5FMTDswat-Z-oBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/227.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/227:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYi1PQjdMLThUMnZyYTB2bmdDZG5Fcy1LcUZWSXdtNkVRelFHbGZaVklXSU5rZW13RTJrNFBMVXh1UWo0RFRtYVBCdWxseXRyRXpsT0lHU2xzN1dEemZKM19Ra01WNmpHamVLUGJ1Z1RvZlhMTGtwNjFocHVIMV9nQTBLb01jdUJ3V092OUdPaXo5Slk0Vzh4M09EVUhFa00tQjFYSGxHQXpzWlhkT0VOenZPOXBHWm1oRklaODBwaE0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqO7KixMVW5oE-Z7rTf-05a3MQ7VchJb6xK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mFnZUNsYXNzIjoiU1RBTkRBUkQiLCJiaWxsaW5nIjp7InJlcXVlc3RlclBheXMiOnRydWV9LCJldGFnIjoiQ0FNPSJ9" + } + }, + { + "ID": "e1a268e954e19280", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3b85dca22884f6881cd7a4358ea80207/4560970365375816366;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0007?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:39 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051433000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbv22:4137,/bns/yv/borg/yv/bns/blobstore2/bitpusher/243.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=QsysW5qeJYGngASMt5uwAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/243.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/243:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYi1PQjdMLThUMnZyYTB2bmdDZG5Fcy1LcUZWSXdtNkVRelFHbGZaVklXSU5rZW13RTJrNFBMVXh1UWo0RFRtYVBCdWxseXRyRXpsT0lHU2xzN1dEemZKM19Ra01WNmpHamVLUGJ1Z1RvZlhMTGtwNjFocHVIMV9nQTBLb01jdUJ3V092OUdPaXo5Slk0Vzh4M09EVUhFa00tQjFYSGxHQXpzWlhkT0VOenZPOXBHWm1oRklaODBwaE0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UozX15bN75-vGZh_C0BLNyjVXwQGxTMEvRMmqkwiAsFxzfvp3GD9EWWWWdhKj7q5B3eNGH5KXxPXIT29zNUZR0qwIvOAg" + ] + }, + "Body": "" + } + }, + { + "ID": "4dd057f60283835e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "60" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "bac2f7e7df855709cfa2912eec59313f/6151100794466387788;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA4In0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "426" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:39 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051439000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrm128:4106,/bns/yv/borg/yv/bns/blobstore2/bitpusher/286.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=Q8ysW8W1DMnNgASH64bQDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/286.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/286:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqPxwA-ixx9ZAr4xf2ZQ3g4Aeh9jaFfgwKTM_fr3eh-ik43c09moeWAUeoQvn9S9AhnDzxYTBfRwij5e4HFASVemXjsGg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOCIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDgiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6MzkuODAxWiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjM5LjgwMVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "37d7110f7cc94406", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=0a2912504a9ce020eae7958dfe430a523c7be1ecf30776eef91e989784f6" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fa2c5b7c49cfad80d49fbbf42d27145d/6982475729095563932;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0wYTI5MTI1MDRhOWNlMDIwZWFlNzk1OGRmZTQzMGE1MjNjN2JlMWVjZjMwNzc2ZWVmOTFlOTg5Nzg0ZjYNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOCIsIm5hbWUiOiJzb21lLW9iaiJ9Cg0KLS0wYTI5MTI1MDRhOWNlMDIwZWFlNzk1OGRmZTQzMGE1MjNjN2JlMWVjZjMwNzc2ZWVmOTFlOTg5Nzg0ZjYNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtDQoNCiHe8gVi7cUy1yj2YdH/SBwNCi0tMGEyOTEyNTA0YTljZTAyMGVhZTc5NThkZmU0MzBhNTIzYzdiZTFlY2YzMDc3NmVlZjkxZTk4OTc4NGY2LS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3285" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:40 GMT" + ], + "Etag": [ + "CIbX9/6W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051439000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbq123:4158,/bns/yv/borg/yv/bns/blobstore2/bitpusher/293.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=Q8ysW7iWPIrHggTf2qigAw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/293.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/293:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur6aYjGujjKgLW1Bhh-arBoYeTSpBZn1ncAgDZ3jqg5e4U9kuQhNPLKlfULMw23Tfheb7-2Csjg1cwUOBbywxBMKdpP-g" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOC9zb21lLW9iai8xNTM4MDUxMTQwMzQ4ODA2Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA4L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0L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dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOC9vL3NvbWUtb2JqL2FjbC91c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA4Iiwib2JqZWN0Ijoic29tZS1vYmoiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MDM0ODgwNiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJYlg5LzZXMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibU1SVG5nPT0iLCJldGFnIjoiQ0liWDkvNlcyOTBDRUFFPSJ9" + } + }, + { + "ID": "a5e7a973054cd9eb", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "72b674888ea6ba2e2000c02ed2425059/8572606162464260154;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3285" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:40 GMT" + ], + "Etag": [ + "CIbX9/6W290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051440000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnat135:4299,/bns/yx/borg/yx/bns/blobstore2/bitpusher/155.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=RMysW9yGHZGezQLUipSACw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/155.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/155:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpbUSEl8lVOXpkbanVm3TZbe3inmlKBD8z0dxTDy0Jmws3ee-ZbsIcCS3UCPp4UnOysMml-2tROHVKDfUhOzZRF1fW6DA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5M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nPT0iLCJldGFnIjoiQ0liWDkvNlcyOTBDRUFFPSJ9" + } + }, + { + "ID": "aaacb912d25964e2", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "84" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f36e3abdbbb5cd513afef505376b0b55/10090960472510260697;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDgiLCJldmVudEJhc2VkSG9sZCI6dHJ1ZX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3307" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:40 GMT" + ], + "Etag": [ + "CIbX9/6W290CEAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051440000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnm23:4163,/bns/yw/borg/yw/bns/blobstore2/bitpusher/33.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=RMysW8ezJJS8hgSYgLfICQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/33.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/33:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur79Q63MXhT1ocHhwJI-YRY2WVWTCXb82hlaPk7243LyKIdSCWWwKf2ACbFhLI_TKRmh94UJkNYheGo38lWBmG91M_Esw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOC9zb21lLW9iai8xNTM4MDUxMTQwMzQ4ODA2Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA4L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDgiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MDM0ODgwNiIsIm1ldGFnZW5lcmF0aW9uIjoiMiIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtIiwidGltZUNyZWF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjQwLjM0OFoiLCJ1cGRhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNTo0MC42ODlaIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJ0aW1lU3RvcmFnZUNsYXNzVXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NDAuMzQ4WiIsInNpemUiOiIxNiIsIm1kNUhhc2gi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iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJYlg5LzZXMjkwQ0VBST0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibU1SVG5nPT0iLCJldGFnIjoiQ0liWDkvNlcyOTBDRUFJPSIsImV2ZW50QmFzZWRIb2xkIjp0cnVlfQ==" + } + }, + { + "ID": "76fbc9f0b99b2f49", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "669db8763b6bd4dd603ecdcace4864c6/11681372372282509944;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3307" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:40 GMT" + ], + "Etag": [ + "CIbX9/6W290CEAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051440000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrrr16:4447,/bns/yv/borg/yv/bns/blobstore2/bitpusher/88.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=RMysW9iUMcKZgQTw9ZIQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/88.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/88:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpypyDzoPkWQvudGbMqnEjZPiWP2UshpaXFL0GnKW3XMLtJGzWDVn0M1Zgu2dMjPaY7fj86Y5MnB33QfPfPk7Ox1CLdfg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOC9zb21lLW9iai8xNTM4MDUxMTQwMzQ4ODA2Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA4L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDgiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MDM0ODgwNiIsIm1ldGFnZW5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OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA4Iiwib2JqZWN0Ijoic29tZS1vYmoiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MDM0ODgwNiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJYlg5LzZXMjkwQ0VBST0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibU1SVG5nPT0iLCJldGFnIjoiQ0liWDkvNlcyOTBDRUFJPSIsImV2ZW50QmFzZWRIb2xkIjp0cnVlfQ==" + } + }, + { + "ID": "78aae384aa961deb", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "82" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7d56df310958932c8e9f768c4f493f3f/13271784276332949526;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDgiLCJjb250ZW50VHlwZSI6ImZvbyJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3286" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:41 GMT" + ], + "Etag": [ + "CIbX9/6W290CEAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051440000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdv10:4196,/bns/yv/borg/yv/bns/blobstore2/bitpusher/21.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=RMysW4izN4quggSVlrrQAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/21.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/21:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpZzkXCMOe7dNiTX_3OFre5VukWstUkiWl2b0wgLfUBOd285bNQ2ztHV883ZEFh_lyekWInaXl0JH8CiJ40u4gen6707A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVnc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JldGFnIjoiQ0liWDkvNlcyOTBDRUFNPSIsImV2ZW50QmFzZWRIb2xkIjp0cnVlfQ==" + } + }, + { + "ID": "b6f9e84970bde86e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "69fd5e5c0a5397d780834aa8ca559a36/14861914709718357429;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3286" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:41 GMT" + ], + "Etag": [ + "CIbX9/6W290CEAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051440000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnpp189:4374,/bns/yx/borg/yx/bns/blobstore2/bitpusher/45.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=RcysW9ijBpKrzALq86GoBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/45.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/45:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urhrjx4L0FkFYcxk3TEaGXYaCAz_Iwa_R_TsU9fwVuFkO7FpYAB1LKwqWqO0TocvFMeGFwyd_7ke352CB7-cnX_Dsr04Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOC9zb21lLW9iai8xNTM4MDUxMTQwMzQ4ODA2Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA4L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDgiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MDM0ODgwNiIsIm1ldGFnZW5lcmF0aW9uIjoiMyIsImNvbnRlbnRUeXBlIjoiZm9vIiwidGltZUNyZWF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjQwLjM0OFoiLCJ1cGRhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNTo0MC45ODNaIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJ0aW1lU3RvcmFnZUNsYXNzVXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NDAuMzQ4WiIsInNpemUiOiIxNiIsIm1kNUhhc2giOiJZU0dkNy9lVm56cmFJM285MGorUDdBPT0iLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC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IxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJYlg5LzZXMjkwQ0VBTT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibU1SVG5nPT0iLCJldGFnIjoiQ0liWDkvNlcyOTBDRUFNPSIsImV2ZW50QmFzZWRIb2xkIjp0cnVlfQ==" + } + }, + { + "ID": "6e80bc4210ff38e8", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "85" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "908b325ceff7af773f3ae514b5d7fdeb/16452326609473895251;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDgiLCJldmVudEJhc2VkSG9sZCI6ZmFsc2V9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3287" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:41 GMT" + ], + "Etag": [ + "CIbX9/6W290CEAQ=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051440000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrhq15:4330,/bns/yv/borg/yv/bns/blobstore2/bitpusher/4.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=RcysW6q5C4OlggT477xY" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/4.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/4:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqR4YYdh9xEeNHy3xSzUablg3lgP_gFT4RbOP8RgJFz-sQ9ugVz8WuHUSLmtuItC_hyR_AvyhkZimBD005OZvEPPWGtNA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOC9zb21lLW9iai8xNTM4MDUxMTQwMzQ4ODA2Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA4L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDgiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MDM0ODgwNiIsIm1ldGFnZW5lcm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a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA4Iiwib2JqZWN0Ijoic29tZS1vYmoiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MDM0ODgwNiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNJYlg5LzZXMjkwQ0VBUT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibU1SVG5nPT0iLCJldGFnIjoiQ0liWDkvNlcyOTBDRUFRPSIsImV2ZW50QmFzZWRIb2xkIjpmYWxzZX0=" + } + }, + { + "ID": "97d438b968fe32c8", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2ae0c9abf22f8613130b760ed0f25db8/17283420073421328035;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008/o/some-obj?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:41 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051439000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlw11:4360,/bns/yv/borg/yv/bns/blobstore2/bitpusher/235.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=RcysW_r4FonuggSJ1Lr4CQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/235.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/235:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrdiEc0xjlqkDsbTeOVLT489iN9y6sLywT23V6xAxTn2LpfZSlYEcJpJ-9Gog_DBTNVFBs0pJkQJKJG0iykjVNOO2uyYw" + ] + }, + "Body": "" + } + }, + { + "ID": "f80d68a7124d0884", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "92467cd80ac62acc5f3fdfd1f0b095bc/427368279260853057;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0008?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:42 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051439000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vray3:4145,/bns/yv/borg/yv/bns/blobstore2/bitpusher/360.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=RcysW9PrLJfJgASEx7egAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/360.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/360:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYW8tTi1VN3BXbjFWaEhPYml5Z2FjMzBQSzdFQXpIUlJHYkl1WkdrUl9hNE9PM3dOeFk1bFdBWFB2WTFJQ2FuWDlxSXZqeHFXZ0VHcUtueDdUQ1dMMm5INkZTY0dITnM3ZTMxMjcyc3lrLUZVdEFlNWNyekNrN0l1OVdUZ3BSVHFPdDVMYjBrSTVHdF9LbWtQTnN2M2FBVFJ6Q1VvdlRaYWUxeFAwdUJZSjNud0VOcTllS3JCZ3ZZWk0wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoSGI76du_R-KAywyZHtMJCD98ezW_k2SyAXFJU1hNQs_4Gmef8a8PRhUnVR0vq4UtMsNRYTZvsueKQpnfFbkMsAYaeUA" + ] + }, + "Body": "" + } + }, + { + "ID": "16c9b99ace40675c", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "60" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3192e57753f54de047527a0f7c734937/1945723688784927200;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA5In0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "426" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:43 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051442000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrli74:4433,/bns/yv/borg/yv/bns/blobstore2/bitpusher/329.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=RsysW6nYEMHSggSJ44SQDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/329.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/329:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrNyakak05lR1Q2WId23z_m1L9zXqPQG42itWpjchRBWAuwh51w0ufLjK7GnNIdUwsmpT6kzUdtz66v9-_iZWp69aOP9w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDkiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NDIuOTAwWiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjQyLjkwMFoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "125a0f566fb957a2", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=28057963d603e97cd943670bb09dea0b37721dcbee4de7f44ddce95f66d3" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "23787329c84d271578a4b254783707aa/2776817152749202223;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0yODA1Nzk2M2Q2MDNlOTdjZDk0MzY3MGJiMDlkZWEwYjM3NzIxZGNiZWU0ZGU3ZjQ0ZGRjZTk1ZjY2ZDMNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOSIsIm5hbWUiOiJzb21lLW9iaiJ9Cg0KLS0yODA1Nzk2M2Q2MDNlOTdjZDk0MzY3MGJiMDlkZWEwYjM3NzIxZGNiZWU0ZGU3ZjQ0ZGRjZTk1ZjY2ZDMNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtDQoNCh3phU9nPeKTspnhdkB1G0oNCi0tMjgwNTc5NjNkNjAzZTk3Y2Q5NDM2NzBiYjA5ZGVhMGIzNzcyMWRjYmVlNGRlN2Y0NGRkY2U5NWY2NmQzLS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3285" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:43 GMT" + ], + "Etag": [ + "COLHs4CX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051442000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlv9:4242,/bns/yr/borg/yr/bns/blobstore2/bitpusher/112.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=R8ysW7yABYiVkASQyLSgCw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/112.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/112:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urul9azluGg9ubAfjVZBRTvxzf-9xDlfuKHaTDYFJmzn-4UQlkJt_LJyOU2Y-yfGMr-pdfjbTVxT0vujaoIVra1WyliEA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOS9zb21lLW9iai8xNTM4MDUxMTQzNDI3MDQyIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA5L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDkiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MzQyNzA0MiIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtIiwidGltZUNyZWF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjQzLjQyNloiLCJ1cGRhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNTo0My40MjZaIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJ0aW1lU3RvcmFn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0MzQyNzA0MiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNPTEhzNENYMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiVk5jdHBnPT0iLCJldGFnIjoiQ09MSHM0Q1gyOTBDRUFFPSJ9" + } + }, + { + "ID": "e83fd8d4a5d6afd3", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ef9e1f91badb126602160267cee85176/4367229052504674766;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3285" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:43 GMT" + ], + "Etag": [ + "COLHs4CX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051443000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrtj9:4196,/bns/yv/borg/yv/bns/blobstore2/bitpusher/208.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=R8ysW9isKMvWgwSzu6-IBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/208.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/208:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urbmysb5MvX3wH-2EyUwAeomINPZbRZpMP_aDaTJjYffjWZrxE-vaZ6QPh4MxX9nvgUSEyOBtJErQ-JZ3GXBaqR9Gatrw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOS9zb21lLW9iai8xNTM4MDUxMTQzNDI3MDQyIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA5L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDkiLCJnZW5lcmF0aW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AtMDAwOS9vL3NvbWUtb2JqL2FjbC91c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA5Iiwib2JqZWN0Ijoic29tZS1vYmoiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MzQyNzA0MiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNPTEhzNENYMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiVk5jdHBnPT0iLCJldGFnIjoiQ09MSHM0Q1gyOTBDRUFFPSJ9" + } + }, + { + "ID": "21a66e45cdb8667d", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "83" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "570f7ccbf052f85a5e3a8e354bfba434/5957640956571825773;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDkiLCJ0ZW1wb3JhcnlIb2xkIjp0cnVlfQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3306" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:43 GMT" + ], + "Etag": [ + "COLHs4CX290CEAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051443000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrsw14:4204,/bns/yv/borg/yv/bns/blobstore2/bitpusher/388.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=R8ysW_eLMJTOgASAo6ugAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/388.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/388:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoUSJsAp4AliWt6x8Y7V9BKhu6YRa_3kTlmIlHRBXeKe39DdevzD3oH8vIstiigiJkx0jLGaQUbBYRkZINHby4RAQqDUA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLC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WNjb3VudC5jb20ifSwiY3JjMzJjIjoiVk5jdHBnPT0iLCJldGFnIjoiQ09MSHM0Q1gyOTBDRUFJPSIsInRlbXBvcmFyeUhvbGQiOnRydWV9" + } + }, + { + "ID": "88e95beed2c0ec76", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "3bf057c037eafaa278687db43e4b09d9/7547770290445671435;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3306" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:44 GMT" + ], + "Etag": [ + "COLHs4CX290CEAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051443000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrda17:4188,/bns/yv/borg/yv/bns/blobstore2/bitpusher/118.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=SMysW78N37CCBMGqjeAK" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/118.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/118:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpGFZ1rGj8u2nmVl9wHkhlgWycEQUTNBfnjLfBazqJeL52WiB5_5_uT9vqKlddCeAULH0E0KsJBrsXr3k2iWlWstsGvUg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOS9zb21lLW9iai8xNTM4MDUxMTQzNDI3MDQyIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA5L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDkiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MzQyNzA0MiIsIm1ldGFnZW5lcmF0aW9uIjoiMiIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtIiwidGltZUNyZWF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjQzLjQyNloiLCJ1cGRhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNTo0My44NjVaIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJ0aW1lU3RvcmFnZUNsYXNzVXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NDMuNDI2WiIsInNpemUiOiIxNiIsIm1kNUhhc2giOiJVT2h5QmY1OHg2VElzaGNIS1FvNmpBPT0iLCJtZWRpYUxpbmsiO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yb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNPTEhzNENYMjkwQ0VBST0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiVk5jdHBnPT0iLCJldGFnIjoiQ09MSHM0Q1gyOTBDRUFJPSIsInRlbXBvcmFyeUhvbGQiOnRydWV9" + } + }, + { + "ID": "139aa9cf44ba2500", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "82" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2ed4cfa83cda4c4f833e638e5a3acab8/9138182190217920938;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDkiLCJjb250ZW50VHlwZSI6ImZvbyJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3285" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:44 GMT" + ], + "Etag": [ + "COLHs4CX290CEAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051443000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vruh3:4140,/bns/yv/borg/yv/bns/blobstore2/bitpusher/140.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=SMysW-qCBZKCgwS2iqKgDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/140.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/140:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upn6yFG5Mlqp-GofUkiY0KgjJBckaYdHghjSruHNtANQIY94tfqerEqXVz-Y18pWQtDuxkJEr09eJ26sjVyPp9llinNpw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOS9zb21lLW9iai8xNTM4MDUxMTQzNDI3MDQyIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA5L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDkiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0M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MTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA5Iiwib2JqZWN0Ijoic29tZS1vYmoiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MzQyNzA0MiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNPTEhzNENYMjkwQ0VBTT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiVk5jdHBnPT0iLCJldGFnIjoiQ09MSHM0Q1gyOTBDRUFNPSIsInRlbXBvcmFyeUhvbGQiOnRydWV9" + } + }, + { + "ID": "2bf008511cf7f3ca", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "a515f52484a43b168274b74481a46e8e/10728594094268294985;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3285" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:44 GMT" + ], + "Etag": [ + "COLHs4CX290CEAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051443000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqj25:4236,/bns/yr/borg/yr/bns/blobstore2/bitpusher/44.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=SMysW-PJEcTvkAPC4IGgCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/44.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/44:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UomllJXP0WL8d5rWkRPZE8tECJWI63BBawFctUcrI2eVu2DPtJf8AIWjJvmORIpDaq76cuFqfbfZ3yuuBFd9qoTYdafKw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOS9zb21lLW9iai8xNTM4MDUxMTQzNDI3MDQyIiwic2VsZkxpbmsiOiJodHRw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URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "84" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "736de9a2bdf5c8988d3d2b206d31dfe0/12319005998335511783;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDkiLCJ0ZW1wb3JhcnlIb2xkIjpmYWxzZX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3286" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:44 GMT" + ], + "Etag": [ + "COLHs4CX290CEAQ=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051443000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrk4:4182,/bns/yv/borg/yv/bns/blobstore2/bitpusher/349.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=SMysW5KeF9PXgATL46nICA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/349.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/349:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoKsb53RjbCrsBQdPjt_eu8_pnouQqM-A4nUtfknw5u5dzQXJ_Hsv8B0j-DTtjN9PDfqh-iKDNvh5QpFb54dc4oDg6t_g" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwOS9zb21lLW9iai8xNTM4MDUxMTQzNDI3MDQyIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDA5L28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDkiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0MzQyNzA0MiIsIm1ldGFnZW5lcmF0aW9uIjoiNCIsImNvbnRlbnRUeXBlIjoiZm9vIiwidGltZUNyZWF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjQzLjQyNloiLCJ1cGRhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNTo0NC40ODNaIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJ0aW1lU3RvcmFnZUNsYXNzVXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NDMuNDI2WiIsInNpemUiOiIxNiIsIm1kNUhhc2giOiJVT2h5QmY1OHg2VElzaGNIS1FvNmpBPT0iLCJtZWRpYUxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9kb3dubG9hZC9zdG9yYWdlL3YxL2IvZ28taW50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zZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNPTEhzNENYMjkwQ0VBUT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiVk5jdHBnPT0iLCJldGFnIjoiQ09MSHM0Q1gyOTBDRUFRPSIsInRlbXBvcmFyeUhvbGQiOmZhbHNlfQ==" + } + }, + { + "ID": "4d4bf3d6a690c4ad", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6196048cde2e4d6c53fd5cb570b00693/13078042967756644151;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009/o/some-obj?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:44 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051444000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnch65:4276,/bns/yx/borg/yx/bns/blobstore2/bitpusher/26.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=SMysW_zuJIqvzwLJp5_ABw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/26.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/26:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoT9Ov0jDXHY9uhhhBStlSHg2jyEeNKw2MCJCdrOoF3PgmfOTr2X1r0HPd9xSO4x_WgY6C_ydyWxG1PH9TG3ZZ-rT4sKw" + ] + }, + "Body": "" + } + }, + { + "ID": "8a63a72d8af7ceba", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "cb299b1ebb95e40d39867cbc9543231a/14668454867528959189;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0009?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:45 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051442000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdm189:4345,/bns/yr/borg/yr/bns/blobstore2/bitpusher/117.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=SMysW9-XOcKnkASClZioBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/117.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/117:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYm55eUhjUWpNWkU0aTFCOGpNWG9GOHRvNDlSNWRjTUJnOFRGMDJkT2lZdHhhZ3MzVklHZmVzXzByNTlISDRvNEtudW96RTBQa2FVZVIzNkRlelFXcnlfMXpKUjRScTRYcFdDYjJKUkl3NTFYUW8yc2hncy0td1duX1B3Vk9hSy1hWUVQLVN6Uk1zcmlUN0ZtaFZ2WUxRRHhSTy1nd29sRXlFNWJCWXhqQmJybkxfZ3pxTTNQREZFZ0kwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UruDTxj-5sNUNL5TgdK2N8Y5h_ubbWt_65r-y1dKu9-7GSNIld2Ii1hrFsyLY-by8sNpTzoshjKed_fvWtm_4qDcgA_Vg" + ] + }, + "Body": "" + } + }, + { + "ID": "6ed823f9572a2abb", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "105" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5d64adfcef1874b28e27c12b019bfbd9/16258584201402739316;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDEwIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjM2MDAifX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "514" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:46 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051445000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnll124:4447,/bns/yx/borg/yx/bns/blobstore2/bitpusher/118.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=ScysW_ynGdbQzAL6lov4DQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/118.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/118:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWWhLRWRJS21GUEgxdEtyUnZ6LTVHcEpFV2I3OTF6d2FCanpvT0REdnVuTmhHVVBINWJHX1BHc1ljQ2JIS0hpR1QtR1ZSOHdaTlZqMFJQdml6U2NZUnRQUWg3QkdWU1UzbXNkXzNJSERFRUFoQVVXU3ZQZHNMSmZocVBubWZlZUgtb3pCMEtxQ3hFRTBob2FQbTRqQmlvMXVidF9WSlVuZmVvcl9sZkhCLTMxWkpsNENCQ1dIRXVRQ1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uol_YBnpQvchvCCc4fF4UAzRDezAG-jZp1Q5dR-8d3_56yA5lZp2tYMVP9VBnPA8rc9-g99iXEA5muatm50TW0VfftSmQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMCIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTAiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NDUuODU3WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjQ1Ljg1N1oiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjM2MDAiLCJlZmZlY3RpdmVUaW1lIjoiMjAxOC0wOS0yN1QxMjoyNTo0NS44NTdaIn0sInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBRT0ifQ==" + } + }, + { + "ID": "07b5dd5807cb4e76", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0010/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=60f031f9c7f83e6753f9064062bf236631fe19faf4e9f2501b9a1cf4e8e8" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ba4c24b367d04339d0eb4e34c234e7e2/17017902641505680835;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0010/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS02MGYwMzFmOWM3ZjgzZTY3NTNmOTA2NDA2MmJmMjM2NjMxZmUxOWZhZjRlOWYyNTAxYjlhMWNmNGU4ZTgNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMCIsIm5hbWUiOiJzb21lLW9iaiJ9Cg0KLS02MGYwMzFmOWM3ZjgzZTY3NTNmOTA2NDA2MmJmMjM2NjMxZmUxOWZhZjRlOWYyNTAxYjlhMWNmNGU4ZTgNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtDQoNCku3Qm/7wRsR3az70rmpwPANCi0tNjBmMDMxZjljN2Y4M2U2NzUzZjkwNjQwNjJiZjIzNjYzMWZlMTlmYWY0ZTlmMjUwMWI5YTFjZjRlOGU4LS0NCg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3338" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:46 GMT" + ], + "Etag": [ + "CPq47IGX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051446000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdg20:4229,/bns/yr/borg/yr/bns/blobstore2/bitpusher/99.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=SsysW7SWB4i44QT15L5A" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/99.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/99:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWWhLRWRJS21GUEgxdEtyUnZ6LTVHcEpFV2I3OTF6d2FCanpvT0REdnVuTmhHVVBINWJHX1BHc1ljQ2JIS0hpR1QtR1ZSOHdaTlZqMFJQdml6U2NZUnRQUWg3QkdWU1UzbXNkXzNJSERFRUFoQVVXU3ZQZHNMSmZocVBubWZlZUgtb3pCMEtxQ3hFRTBob2FQbTRqQmlvMXVidF9WSlVuZmVvcl9sZkhCLTMxWkpsNENCQ1dIRXVRQ1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result":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NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNQcTQ3SUdYMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoid2VWZjBRPT0iLCJldGFnIjoiQ1BxNDdJR1gyOTBDRUFFPSIsInJldGVudGlvbkV4cGlyYXRpb25UaW1lIjoiMjAxOC0wOS0yN1QxMzoyNTo0Ni40NTRaIn0=" + } + }, + { + "ID": "6cd308150938c9ed", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b7b72476a97dc563ea515dd0419a2d50/161570476158247522;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010/o/some-obj?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3338" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:46 GMT" + ], + "Etag": [ + "CPq47IGX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051446000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vneg3:4091,/bns/yx/borg/yx/bns/blobstore2/bitpusher/152.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=SsysW9ykKoaJzgLa9JeAAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/152.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/152:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWWhLRWRJS21GUEgxdEtyUnZ6LTVHcEpFV2I3OTF6d2FCanpvT0REdnVuTmhHVVBINWJHX1BHc1ljQ2JIS0hpR1QtR1ZSOHdaTlZqMFJQdml6U2NZUnRQUWg3QkdWU1UzbXNkXzNJSERFRUFoQVVXU3ZQZHNMSmZocVBubWZlZUgtb3pCMEtxQ3hFRTBob2FQbTRqQmlvMXVidF9WSlVuZmVvcl9sZkhCLTMxWkpsNENCQ1dIRXVRQ1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upwz4yjfKZJQXT-HE1cBx9y61M5M7GcsWo_go1oLuR8khJs4XxiRj3nJg-ujAWf-tnN7hNKuXHv8p9abUc27DobK2BkcA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMC9zb21lLW9iai8xNTM4MDUxMTQ2NDU2MTg2Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDEwL28vc29tZS1vYmoiLCJuYW1lIjoic29tZS1vYmoiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTAiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0NjQ1NjE4NiIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtIiwidGltZUNyZWF0ZWQiOiIyMDE4LT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29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDEwIiwib2JqZWN0Ijoic29tZS1vYmoiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE0NjQ1NjE4NiIsImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJyb2xlIjoiT1dORVIiLCJlbWFpbCI6IjM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiZXRhZyI6IkNQcTQ3SUdYMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoid2VWZjBRPT0iLCJldGFnIjoiQ1BxNDdJR1gyOTBDRUFFPSIsInJldGVudGlvbkV4cGlyYXRpb25UaW1lIjoiMjAxOC0wOS0yN1QxMzoyNTo0Ni40NTRaIn0=" + } + }, + { + "ID": "f52f400fa7e43a90", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "25" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b86e7859e62fb9ea4a7c82cbf53f7e0b/1751982375913719809;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJyZXRlbnRpb25Qb2xpY3kiOm51bGx9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:48 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051447000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnaz64:4220,/bns/yx/borg/yx/bns/blobstore2/bitpusher/147.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=SsysW_bNL46YzQKvubuIDg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/147.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/147:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWWhLRWRJS21GUEgxdEtyUnZ6LTVHcEpFV2I3OTF6d2FCanpvT0REdnVuTmhHVVBINWJHX1BHc1ljQ2JIS0hpR1QtR1ZSOHdaTlZqMFJQdml6U2NZUnRQUWg3QkdWU1UzbXNkXzNJSERFRUFoQVVXU3ZQZHNMSmZocVBubWZlZUgtb3pCMEtxQ3hFRTBob2FQbTRqQmlvMXVidF9WSlVuZmVvcl9sZkhCLTMxWkpsNENCQ1dIRXVRQ1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpDMEyndQWEVKJnGEtbhRAyCqFEjYGH6cqgGiUAmmrf4CTeY9phBbXpQxFAl0RLmwwilggpY04j79eA0cxPBBnZCG3lIQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9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mQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "b2ec087cf2118f91", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010/o/some-obj?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d6b2b26a710f3d11142874553579d124/2583357310559738448;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010/o/some-obj?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:48 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051446000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdx87:4375,/bns/yv/borg/yv/bns/blobstore2/bitpusher/339.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=TMysW92LFMrqgwTa5YP4AQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/339.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/339:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWWhLRWRJS21GUEgxdEtyUnZ6LTVHcEpFV2I3OTF6d2FCanpvT0REdnVuTmhHVVBINWJHX1BHc1ljQ2JIS0hpR1QtR1ZSOHdaTlZqMFJQdml6U2NZUnRQUWg3QkdWU1UzbXNkXzNJSERFRUFoQVVXU3ZQZHNMSmZocVBubWZlZUgtb3pCMEtxQ3hFRTBob2FQbTRqQmlvMXVidF9WSlVuZmVvcl9sZkhCLTMxWkpsNENCQ1dIRXVRQ1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UodSFemSWw3f41ZGelIJMWcecf1K1IJI-BDg-FGF7JngeV5eeYZY1QJbmlh6M3HYaBxdOadLCvOH-CMy1xYTZflI3cPFA" + ] + }, + "Body": "" + } + }, + { + "ID": "350aa556ebfb5939", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0c824b79369ca5b0582093808bcfc251/4173487743928369391;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 429, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12085" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:48 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:48 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051446000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrl7:4233,/bns/yw/borg/yw/bns/blobstore2/bitpusher/117.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=TMysW5vmJsWThQT875SgCg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/117.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/117:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWWhLRWRJS21GUEgxdEtyUnZ6LTVHcEpFV2I3OTF6d2FCanpvT0REdnVuTmhHVVBINWJHX1BHc1ljQ2JIS0hpR1QtR1ZSOHdaTlZqMFJQdml6U2NZUnRQUWg3QkdWU1UzbXNkXzNJSERFRUFoQVVXU3ZQZHNMSmZocVBubWZlZUgtb3pCMEtxQ3hFRTBob2FQbTRqQmlvMXVidF9WSlVuZmVvcl9sZkhCLTMxWkpsNENCQ1dIRXVRQ1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo3ylDcXvoHItOtoj6RY5otQx8n7iP_-eEGL30SzZrQeFXj3J1cwR69rTGuf6rY9RzGK2sHqAPBdd-gQLsua2H81DOkFQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6InVzYWdlTGltaXRzIiwicmVhc29uIjoicmF0Z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lci5Db21tb25Nb2R1bGUkQ29udGV4dENhcnJ5aW5nRXhlY3V0b3JTZXJ2aWNlJDEucnVuSW5Db250ZXh0KENvbW1vbk1vZHVsZS5qYXZhOjg0Nilcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRUcmFjZUNvbnRleHRSdW5uYWJsZSQxLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NjIpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5DdXJyZW50Q29udGV4dC5ydW5JbkNvbnRleHQoQ3VycmVudENvbnRleHQuamF2YTozMjApXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHROb1VucmVmKFRyYWNlQ29udGV4dC5qYXZhOjMyMSlcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dChUcmFjZUNvbnRleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDI5LCJtZXNzYWdlIjoiVGhlIHByb2plY3QgZXhjZWVkZWQgdGhlIHJhdGUgbGltaXQgZm9yIGNyZWF0aW5nIGFuZCBkZWxldGluZyBidWNrZXRzLiJ9fQ==" + } + }, + { + "ID": "7aaeb5b6064014cf", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0c824b79369ca5b0582093808bcfc251/4932805084536460094;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 429, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12085" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:49 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:49 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051446000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrce189:4322,/bns/yr/borg/yr/bns/blobstore2/bitpusher/74.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=TcysW7VS0LrhBIS3nfgL" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/74.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/74:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWWhLRWRJS21GUEgxdEtyUnZ6LTVHcEpFV2I3OTF6d2FCanpvT0REdnVuTmhHVVBINWJHX1BHc1ljQ2JIS0hpR1QtR1ZSOHdaTlZqMFJQdml6U2NZUnRQUWg3QkdWU1UzbXNkXzNJSERFRUFoQVVXU3ZQZHNMSmZocVBubWZlZUgtb3pCMEtxQ3hFRTBob2FQbTRqQmlvMXVidF9WSlVuZmVvcl9sZkhCLTMxWkpsNENCQ1dIRXVRQ1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoHEannxoQgJHDWnyc3VdxrvGoBWcWYnpGbLyOcR9hKEOc4ujSkrKiQTv7WEwa595fMdZxHTDEZDX9WhbXdhMYvhS465w" + ] + }, + "Body": "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Q==" + } + }, + { + "ID": "2ebbcc95335f4f93", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0c824b79369ca5b0582093808bcfc251/5763898544205833613;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 429, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "12085" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:49 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:49 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051446000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrp62:4379,/bns/yv/borg/yv/bns/blobstore2/bitpusher/357.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=TcysW7_eK5CDgQS0t7uoDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/357.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/357:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWWhLRWRJS21GUEgxdEtyUnZ6LTVHcEpFV2I3OTF6d2FCanpvT0REdnVuTmhHVVBINWJHX1BHc1ljQ2JIS0hpR1QtR1ZSOHdaTlZqMFJQdml6U2NZUnRQUWg3QkdWU1UzbXNkXzNJSERFRUFoQVVXU3ZQZHNMSmZocVBubWZlZUgtb3pCMEtxQ3hFRTBob2FQbTRqQmlvMXVidF9WSlVuZmVvcl9sZkhCLTMxWkpsNENCQ1dIRXVRQ1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrregfVY1sg5Sp_yURvbA5_SFSGM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gZXhjZWVkZWQgdGhlIHJhdGUgbGltaXQgZm9yIGNyZWF0aW5nIGFuZCBkZWxldGluZyBidWNrZXRzLiJ9fQ==" + } + }, + { + "ID": "3edc73005530733b", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0c824b79369ca5b0582093808bcfc251/6522935513627031772;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0010?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:53 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051445000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vntt133:4318,/bns/yw/borg/yw/bns/blobstore2/bitpusher/157.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=UMysW7elKYLnN5zigqgK" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/157.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/157:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWWhLRWRJS21GUEgxdEtyUnZ6LTVHcEpFV2I3OTF6d2FCanpvT0REdnVuTmhHVVBINWJHX1BHc1ljQ2JIS0hpR1QtR1ZSOHdaTlZqMFJQdml6U2NZUnRQUWg3QkdWU1UzbXNkXzNJSERFRUFoQVVXU3ZQZHNMSmZocVBubWZlZUgtb3pCMEtxQ3hFRTBob2FQbTRqQmlvMXVidF9WSlVuZmVvcl9sZkhCLTMxWkpsNENCQ1dIRXVRQ1EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UocdzltEwu8I8TD_NoAYID4E9DjuZ0ms_uu-qjIUWzE5LhuXYKS0lxfzfKyBPrns-r3ZIMU10abKbPF0wAd25p04JqFXw" + ] + }, + "Body": "" + } + }, + { + "ID": "16fa5da19588dcb2", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "103" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f223250479f9326d3120a77d446cfcc0/8113347417694182779;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDExIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "512" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:53 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vri14:4058,/bns/yr/borg/yr/bns/blobstore2/bitpusher/56.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=UcysW8mmEIu-4QSu3Jz4Aw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/56.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/56:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrobIhiXco9A_-oMp2VoLDQLC5201S_4RyjRRZxpMTx2Zv8ZQIy5Nit2onYj9_d72nRNL9xdxtJRI-TI2FXlJEbhkAzwg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTEiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NTMuNzY5WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjUzLjc2OVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjU6NTMuNzY5WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUU9In0=" + } + }, + { + "ID": "fde3f1916684ed66", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0011?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "47" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0d879cc229c3bee2bb0b0a9783868213/9703759321744556826;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0011?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJyZXRlbnRpb25Qb2xpY3kiOnsicmV0ZW50aW9uUGVyaW9kIjoiMzYwMCJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2441" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:55 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051454000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnno9:4384,/bns/yw/borg/yw/bns/blobstore2/bitpusher/150.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=UcysW-6JOsPJhASY15bgDQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/150.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/150:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqgSqPtAP9ja5GplqzD5idak2DxVIHfikqXTwLl-RQfR82NbOjWTMMCHClKja8qnc59jKReVtM0g_SaSDptgLgpVxWGOg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTEiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NTMuNzY5WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjU1LjIzOVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjIiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMS9wcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMS9hY2wvcHJvamVjdC1vd25l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J0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInJldGVudGlvblBvbGljeSI6eyJyZXRlbnRpb25QZXJpb2QiOiIzNjAwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjU6NTMuNzY5WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUk9In0=" + } + }, + { + "ID": "8a91697bbe3e6511", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0011?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6db55bdaeee6d1b5348ac0cb62d8c887/11294171221516871864;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0011?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2441" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:55 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:55 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnz126:4460,/bns/yx/borg/yx/bns/blobstore2/bitpusher/39.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=U8ysW63uHMbUzwLGrZrQAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/39.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/39:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqjdbmLX5yJrLPaS36C6KBnXWtkd3J95Z_ftw6bzTcSkCNgUwj3IpOgLOOTh5eH2ltPmePXC_XyuZZsyce_xjfVTGXMmQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTEiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NTMuNzY5WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjU1LjIzOVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjIiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMS9wcm9qZWN0LW93bmVyc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N0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInJldGVudGlvblBvbGljeSI6eyJyZXRlbnRpb25QZXJpb2QiOiIzNjAwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjU6NTMuNzY5WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUk9In0=" + } + }, + { + "ID": "9bbed24b50a1eaa1", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "103" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "802d3dc20f903c593a444cdd814956c7/12884300555390651991;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDEyIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "512" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:56 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vruw21:4201,/bns/yv/borg/yv/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=U8ysW5q4MpHLswb4lL2QAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/50.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/50:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoXG9bPCZjg8Y-JYI_mKdqxDfcvxy1T1PEOnEOwqO3hTQsieNFGouIFTCWTs_WPwVLYtb44oe_VICNWurm3S0GPUXvizw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTIiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NTYuMzg0WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjU2LjM4NFoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjU6NTYuMzg0WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUU9In0=" + } + }, + { + "ID": "f1c21ab6b25294f4", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0012?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "47" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4048de951dc5ccf83e71e2ffdece3a3e/14474712459457803254;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0012?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJyZXRlbnRpb25Qb2xpY3kiOnsicmV0ZW50aW9uUGVyaW9kIjoiMzYwMCJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2441" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:58 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051454000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnlf2:4485,/bns/yx/borg/yx/bns/blobstore2/bitpusher/94.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=VMysW6uqJcngzgL4h4rADw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/94.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/94:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoMFwI7mcS4cWtpbLK42cpnqw0kSanMUXAFgllAzXYjMAP7pqhOjWKPzKeGP889Mcw9U3Y-M7fNZ0e7QNmm7i_4IaLWvQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTIiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NTYuMzg0WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjU4LjI1N1oiLCJtZXRhZ2VuZXJhdGlvbiI6IjIiLCJhY2w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DUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInJldGVudGlvblBvbGljeSI6eyJyZXRlbnRpb25QZXJpb2QiOiIzNjAwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjU6NTYuMzg0WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUk9In0=" + } + }, + { + "ID": "6f5d255f0d88f21b", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0012?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1c795c1024bc55ef42d27faffed977f3/16065124363508242836;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0012?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2441" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:58 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:25:58 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051458000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbq123:4158,/bns/yv/borg/yv/bns/blobstore2/bitpusher/295.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=VsysW6TRHIjeggTPoo6QAg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/295.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/295:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoPL5yIP9ZEqMYOFdRS_FrN6uAVgJDcH82ZdNWFTiRzrpzphlRzFY7M7_qfGxNAhJodJCRNpjkt0TmohT1V5v8okMD72A" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0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1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInJldGVudGlvblBvbGljeSI6eyJyZXRlbnRpb25QZXJpb2QiOiIzNjAwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjU6NTYuMzg0WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUk9In0=" + } + }, + { + "ID": "4b64fc29d8731a8f", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "103" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "64bbece284f2952cd259b93aee5a9e73/17583198298072448563;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDEzIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "512" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:25:59 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vryy20:4108,/bns/yv/borg/yv/bns/blobstore2/bitpusher/37.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=VsysW_SiNsz5gASdporABw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/37.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/37:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpqMbhbjEYwtx_QsZjoA3HbE40bhjEQzZU2TbptRTES7Bq3MHuojyXP0eKhY3Y9VCIhn8spjA4y4fSsdshX9umGMl1fe2uK8yNasoLTBPqcv6DyUuE" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMyIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTMiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjU6NTkuNTA4WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjU5LjUwOFoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjU6NTkuNTA4WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUU9In0=" + } + }, + { + "ID": "496195d1abcde418", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0013?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "25" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "697aa538323c65d1011f2f6844cd5763/727147603389981906;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0013?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJyZXRlbnRpb25Qb2xpY3kiOm51bGx9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:01 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051454000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnew15:4140,/bns/yx/borg/yx/bns/blobstore2/bitpusher/83.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=V8ysW8rRLsW1zALZhJywDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/83.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/83:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrbY7boJBe2XoPiqZsTc01Uxq6nqiB2OXZBh1o6oSng7jBQL9mpCi5qkBcck0oI_DAJTDbBjDuflfdVXyA2hLXAl70_FA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ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EFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "0b8bf573cd2107c4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0013?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d9d2b7dcaa66aaabfa2864d56c5d3a72/2317558407962347888;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0013?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:01 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:01 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnhu9:4289,/bns/yx/borg/yx/bns/blobstore2/bitpusher/102.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=WcysW4T4AszpzgLY0KnIDg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/102.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/102:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrbRCrtu0mTZRDhZrFXk7VrictqM0zKI1U8DoFpKO28cynd5QzxKB5J7XCMWYbXrJca3OalA-IIX45CGsetEVGp4qZISg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxMyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5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ifV0sImRlZmF1bHRPYmplY3RBY2wiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "a7c95422a2471394", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "103" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0e89c35a6de9f58ec66d48975c54b4f9/3907970307717820175;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDE0IiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "512" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:02 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdh9:4228,/bns/yv/borg/yv/bns/blobstore2/bitpusher/304.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=WcysW63cGcSqgQSHvaiACQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/304.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/304:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpP8VkKvEDcF-JqT0gT3fvzqoizXGbFNONJWx8R5oaqlSM0Q0uc5ken0aSOiix0NPrauvWu1QRiwbreckiadEfVgtHnVg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNCIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTQiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MDEuODgxWiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjAxLjg4MVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjY6MDEuODgxWiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUU9In0=" + } + }, + { + "ID": "325d0ff065c04d4e", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0014?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "25" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "51fd4d8c082df8e4d506278eb1ca823b/5498100741103228078;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0014?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJyZXRlbnRpb25Qb2xpY3kiOm51bGx9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:03 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051462000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrba123:4470,/bns/yv/borg/yv/bns/blobstore2/bitpusher/259.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=WsysW7KWC8mngASFkp7wAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/259.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/259:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqJUrTAXY29C_wmpxbjt01tQ4m9VTBeUypKlJzX15UwDuSJe5hsBBynDQsl5a16PpiVFdBz0u-Vf-X5ZRRt209TtmIHKw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc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lZmF1bHRPYmplY3RBY2wiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "cca326efdc436d37", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0014?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4ab7fb4514357f83b302152b924fb136/7088512645153667660;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0014?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:03 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:03 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051458000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrnn4:4418,/bns/yv/borg/yv/bns/blobstore2/bitpusher/270.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=W8ysW5i6LIykNvW7uMAB" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/270.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/270:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpbKUoJzMFO7uO-VveC3KwrCtOcCOHRDrLKCkq-DsuFXnTJrCWiiMgqfkbFYrmOP-ubGDpLSrMWmRKLmSXBxP8Gry44mA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNCIs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zMTQ1IiwidGVhbSI6InZpZXdlcnMifSwiZXRhZyI6IkNBST0ifV0sImRlZmF1bHRPYmplY3RBY2wiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "63c01600827f77b3", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "103" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c9bb61a9fd1b4ae9f5981ca5df957f93/8678924544925917163;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDE1IiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "512" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:04 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrud24:4012,/bns/yv/borg/yv/bns/blobstore2/bitpusher/387.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=XMysW89vy6KCBKOFl_AD" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/387.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/387:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrUsJUBq_XX9ztZulVTMu3salJ5JDRcpfmZ0mmdN70LnnzyOiN2Y8ICZBiw2LZ5ahaPBX2P3IaVz8keKoWCNgAX7TenNA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTUiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MDQuNDU0WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjA0LjQ1NFoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjYwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjY6MDQuNDU0WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUU9In0=" + } + }, + { + "ID": "768bc98442297830", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0015?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "71269e6dd6eb30c6c2d4b40e6b4d950f/10269053878799697290;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0015?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2439" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:06 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051462000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrni16:4226,/bns/yv/borg/yv/bns/blobstore2/bitpusher/221.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=XMysW-W9LM_kgwSjmoe4DQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/221.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/221:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uox4G0BhHPrZfc-b4hSe5pLsjUItbWWUixSn0GyQ5oUgO_Pp74soedZ0zi0uAJ23USfmwKxzzrdNmWS5mGPrSA7xMDoWg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93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MifSwiZXRhZyI6IkNBST0ifV0sImRlZmF1bHRPYmplY3RBY2wiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInJldGVudGlvblBvbGljeSI6eyJyZXRlbnRpb25QZXJpb2QiOiI2MCIsImVmZmVjdGl2ZVRpbWUiOiIyMDE4LTA5LTI3VDEyOjI2OjA0LjQ1NFoifSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FJPSJ9" + } + }, + { + "ID": "cdd3f2848c873bb4", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0015?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c16176bddcc21b2c6d2882ce5fd06ae1/11859465782866913832;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0015?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2439" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:06 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:06 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051458000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqs12:4337,/bns/yw/borg/yw/bns/blobstore2/bitpusher/196.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=XsysW8nRDtayN7DNhPAN" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/196.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/196:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uov7rSAsXMYIGR6Ss96xbFjQgp0NIncfsGrPyYJrNeooyiPImTTAN4_Bc7mxhhFQAajg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iIyMDE4LTA5LTI3VDEyOjI2OjA0LjQ1NFoifSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FJPSJ9" + } + }, + { + "ID": "186f1f73a6d920af", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0015?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "455235aa4f1ed37b4bb469c1d623fc80/13449877686917288135;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0015?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:07 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051466000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnf65:4298,/bns/yx/borg/yx/bns/blobstore2/bitpusher/73.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=XsysW8DKJce6zwLWnrjACQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/73.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/73:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrUvGh7bHpgmVxRKfm-xKQepbBeSGbWt50TgXOFRbNlv_XSDoVmBBQYQXpkmZw0TUnXHNvfkDQnr9mVvq1aWtZ4ug8lsA" + ] + }, + "Body": "" + } + }, + { + "ID": "dfd8fbe545d7bee6", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0014?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "07a05ef320720f3b509ec54f162283bb/15040289586689602917;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0014?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:07 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqi15:4037,/bns/yr/borg/yr/bns/blobstore2/bitpusher/28.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=X8ysW9iWBKiWkATJhbDgBQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/28.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/28:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UobaiYoUYiX5ZJvU-OYpl1FY5F9nfQiJXeWBYxdo-WvOnvz5aVbrblbXtwUnAzgH0UyM3mc2drAZddD0clThFqqJP61Gw" + ] + }, + "Body": "" + } + }, + { + "ID": "012e95579c6845fb", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0013?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "dbcd5340924fe39a15e8e32ab27745fe/16630420020058233604;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0013?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:07 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrfw24:4041,/bns/yr/borg/yr/bns/blobstore2/bitpusher/53.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=X8ysW4fcHcX4kAOu3LKIDg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/53.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/53:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoSbsEMlGkIsvaXr6x6MfACr66APL8lwZSivf3_cryiFk4Vt_8ap4MIFxSDS0CMex25ggALxCfJNIKispqIj9qd5FgM-A" + ] + }, + "Body": "" + } + }, + { + "ID": "62966b136cf0b529", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0012?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "07fa936444fbf30801717d2d264883c6/18220830824630534307;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0012?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:08 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrt3:4124,/bns/yr/borg/yr/bns/blobstore2/bitpusher/96.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=X8ysW__bOsihkATs_LGgCw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/96.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/96:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uqy0RkP5XEsHo3lOvqW35li0Pw0z3juzlb9FvypLY_302_58O6U-mg6Vjn-cJpHJSjkmbIjP8-g5V1n-2CZ9S3yvkbq_g" + ] + }, + "Body": "" + } + }, + { + "ID": "308931080dfea4b9", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0011?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "81a10a84360b6edf4533bd4f550bb0d0/1364780125653231169;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0011?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:08 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051453000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjl65:4261,/bns/yv/borg/yv/bns/blobstore2/bitpusher/211.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=YMysW_22G8fWgwSThbvoBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/211.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/211:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdVeUFHMkhLRHc5UlRMb3BORW9Rb2xrMjQ2NGItSkRZcnRkVjRCV21pUlNvVVY2Q2w3WTlJTk1FZWFKY2FnRlFZc0ZHcVpmbU84dUgxMG5aYl9IWnIzTkhKMFJOQjJEUWhEVnlMQ0JaaVNlQlJHZUhtWDlpRGN2OE9iaEppdVBmbG93Y3NEbWtObF9lSzRaVUNrVmd4Nm5QRmhJak1JSUtKYkpLbnBqN2pCMEkwcnE2TmxKRlAtWmswBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqIieaMhbydFRqWbKPS5MmBE4LNbvLVhM6e9eGRbbgl0_hso2ahTxY4gWLqyahE89LsT91qfndHkp9Fzq-5NPhltIEdrA" + ] + }, + "Body": "" + } + }, + { + "ID": "d1beb37dcd83aa6a", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "106" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "64af50f9fd3c73200370a81b5f0883c8/2883135535194082272;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDE2IiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjkwMDAwIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "515" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:09 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051468000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlq86:4154,/bns/yv/borg/yv/bns/blobstore2/bitpusher/301.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=YMysW5HAOMaPgQTXw4nIBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/301.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/301:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYTVGNmlfNzNkdVJhUVRFQXNzZUdCeEdGWld0bm9pVHl0TGhyNW1FY0hyQTF4eDJEXzNxS2cwUGxYVTJhZC1kOHl3dE9jMUVrNzZmVXdFU2J1TlpoVE9NWThoaEhzNlRjUTl1dHRwNHZZRmJBODdBX05uZ1BwNWIxRHdNR1NQUXV2XzdySWxFZjFtQTVRRUMyZThES1VqcHotcmFtNFJMc01MR2x0aVdrTFQzNlNXLVNZMFhjVlpFVG8wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urvb0freP0GJIhCc7eyV_aUlJDKx3W0kq2q99OI4-jWaBAzkU-aGnP6QsWrmOiP-EMxe0DtGBtgqrud-qgZepmxpx3PNw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTYiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MDkuNDg3WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjA5LjQ4N1oiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjkwMDAwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjY6MDkuNDg3WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUU9In0=" + } + }, + { + "ID": "5a146f91846e2f4b", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0016/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=4a385c57e7c68fe2d07ad9d19a8e1f50a9b104c1e57d1387629dc32ad0d9" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9c6200e4526c02cb8c8b5c77883e179c/3714228999141580335;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0016/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS00YTM4NWM1N2U3YzY4ZmUyZDA3YWQ5ZDE5YThlMWY1MGE5YjEwNGMxZTU3ZDEzODc2MjlkYzMyYWQwZDkNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNiIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJzb21lLW9iamVjdCJ9Cg0KLS00YTM4NWM1N2U3YzY4ZmUyZDA3YWQ5ZDE5YThlMWY1MGE5YjEwNGMxZTU3ZDEzODc2MjlkYzMyYWQwZDkNCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbg0KDQpoZWxsbyB3b3JsZA0KLS00YTM4NWM1N2U3YzY4ZmUyZDA3YWQ5ZDE5YThlMWY1MGE5YjEwNGMxZTU3ZDEzODc2MjlkYzMyYWQwZDktLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3408" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:10 GMT" + ], + "Etag": [ + "CLajk42X290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051468000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrt186:4143,/bns/yr/borg/yr/bns/blobstore2/bitpusher/63.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=YcysW47OMJKQkATCvaHwDg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/63.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/63:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYTVGNmlfNzNkdVJhUVRFQXNzZUdCeEdGWld0bm9pVHl0TGhyNW1FY0hyQTF4eDJEXzNxS2cwUGxYVTJhZC1kOHl3dE9jMUVrNzZmVXdFU2J1TlpoVE9NWThoaEhzNlRjUTl1dHRwNHZZRmJBODdBX05uZ1BwNWIxRHdNR1NQUXV2XzdySWxFZjFtQTVRRUMyZThES1VqcHotcmFtNFJMc01MR2x0aVdrTFQzNlNXLVNZMFhjVlpFVG8wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq0lNITSEEX9MB17Og399j1oxQXjkF757LQ9dGaEIJ--anuY0cz52Whpi7vpIyV9kVIH-zuGiEZgxw-UCK-JEjurFLsOQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNi9zb21lLW9iamVjdC8xNTM4MDUxMTcwMTYxMDc4Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDE2L28vc29tZS1vYmplY3QiLCJuYW1lIjoic29tZS1vYmplY3QiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTYiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE3MDE2MTA3OCIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNjoxMC4xNjBaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MTAuMTYwWiIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwidGltZVN0b3JhZ2VDbGFzc1VwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjEwLjE2MFoiLCJzaXplIjoiMTEiLCJtZDVIYXNoIjoiWHJZN3UrQWU3dENUeXlLN2oxck53dz09IiwibWVkaWFMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2x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1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDTGFqazQyWDI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6InlaUmxxZz09IiwiZXRhZyI6IkNMYWprNDJYMjkwQ0VBRT0iLCJyZXRlbnRpb25FeHBpcmF0aW9uVGltZSI6IjIwMTgtMDktMjhUMTM6MjY6MTAuMTYwWiJ9" + } + }, + { + "ID": "fc16f5c7b8a77052", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0016/o/some-object?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "6b5663749bf8ab9ea1692229808a7b22/4473265968562712959;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0016/o/some-object?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13776" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:10 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:10 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051468000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjd27:4293,/bns/yw/borg/yw/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=YsysW6CPGI-jhQTSyrfwDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/115:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYTVGNmlfNzNkdVJhUVRFQXNzZUdCeEdGWld0bm9pVHl0TGhyNW1FY0hyQTF4eDJEXzNxS2cwUGxYVTJhZC1kOHl3dE9jMUVrNzZmVXdFU2J1TlpoVE9NWThoaEhzNlRjUTl1dHRwNHZZRmJBODdBX05uZ1BwNWIxRHdNR1NQUXV2XzdySWxFZjFtQTVRRUMyZThES1VqcHotcmFtNFJMc01MR2x0aVdrTFQzNlNXLVNZMFhjVlpFVG8wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo_qg4-mUkzGfnA4DihWnTigVKTnnU-Rezw6vz2A3xHWZpDnrOUkw3-hDkcOOGydPq1y_TLcMAeYRtwAOGjU3FmE4YFig" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJPYmplY3QgJ2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNi9zb21lLW9iamVjdCcgaXMgc3ViamVjdCB0byBidWNrZXQncyByZXRlbnRpb24gcG9saWN5IGFuZCBjYW5ub3QgYmUgZGVsZXRlZCwgb3ZlcndyaXR0ZW4gb3IgYXJjaGl2ZWQgdW50aWwgMjAxOC0wOS0yOFQwNjoyNjoxMC4xNjA5Mjg0NDYtMDc6MDAiLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9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bnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHROb1VucmVmKFRyYWNlQ29udGV4dC5qYXZhOjMyMSlcblx0YXQgY29tLmdvb2dsZS50cmFjaW5nLlRyYWNlQ29udGV4dCRBYnN0cmFjdFRyYWNlQ29udGV4dENhbGxiYWNrLnJ1bkluSW5oZXJpdGVkQ29udGV4dChUcmFjZUNvbnRleHQuamF2YTozMTMpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUucnVuKFRyYWNlQ29udGV4dC5qYXZhOjQ1OSlcblx0YXQgY29tLmdvb2dsZS5nc2UuaW50ZXJuYWwuRGlzcGF0Y2hRdWV1ZUltcGwkV29ya2VyVGhyZWFkLnJ1bihEaXNwYXRjaFF1ZXVlSW1wbC5qYXZhOjQwMylcbiJ9XSwiY29kZSI6NDAzLCJtZXNzYWdlIjoiT2JqZWN0ICdnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTYvc29tZS1vYmplY3QnIGlzIHN1YmplY3QgdG8gYnVja2V0J3MgcmV0ZW50aW9uIHBvbGljeSBhbmQgY2Fubm90IGJlIGRlbGV0ZWQsIG92ZXJ3cml0dGVuIG9yIGFyY2hpdmVkIHVudGlsIDIwMTgtMDktMjhUMDY6MjY6MTAuMTYwOTI4NDQ2LTA3OjAwIn19" + } + }, + { + "ID": "605f8d1dd95809c7", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0016?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "25" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "45a524594262aa1f959d45c5f0261799/6063677872629929501;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0016?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJyZXRlbnRpb25Qb2xpY3kiOm51bGx9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:12 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051471000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjl65:4261,/bns/yw/borg/yw/bns/blobstore2/bitpusher/84.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=YsysW6jRKIXMhgTk56f4BQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/84.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/84:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYTVGNmlfNzNkdVJhUVRFQXNzZUdCeEdGWld0bm9pVHl0TGhyNW1FY0hyQTF4eDJEXzNxS2cwUGxYVTJhZC1kOHl3dE9jMUVrNzZmVXdFU2J1TlpoVE9NWThoaEhzNlRjUTl1dHRwNHZZRmJBODdBX05uZ1BwNWIxRHdNR1NQUXV2XzdySWxFZjFtQTVRRUMyZThES1VqcHotcmFtNFJMc01MR2x0aVdrTFQzNlNXLVNZMFhjVlpFVG8wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uoc4h8amQZalCX5R_TWKyE24jbt0D3VpYBvdcCaXM00UzRTu3Uk2OZ8JSITvj7Ihu8hWdeClLqSaL_ppYtUpu5tGHa0Dg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29v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ZyI6IkNBST0ifV0sImRlZmF1bHRPYmplY3RBY2wiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBST0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FJPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "47475e76832941e9", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0016/o/some-object?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ffa1323060cacbec2111b53f746f3400/6894771332282460525;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0016/o/some-object?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:12 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051468000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrhr16:4228,/bns/yv/borg/yv/bns/blobstore2/bitpusher/266.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=ZMysW5-wGpCcNsOPmzA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/266.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/266:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYTVGNmlfNzNkdVJhUVRFQXNzZUdCeEdGWld0bm9pVHl0TGhyNW1FY0hyQTF4eDJEXzNxS2cwUGxYVTJhZC1kOHl3dE9jMUVrNzZmVXdFU2J1TlpoVE9NWThoaEhzNlRjUTl1dHRwNHZZRmJBODdBX05uZ1BwNWIxRHdNR1NQUXV2XzdySWxFZjFtQTVRRUMyZThES1VqcHotcmFtNFJMc01MR2x0aVdrTFQzNlNXLVNZMFhjVlpFVG8wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpZOvNJJ_u3XkC7z73EahCGO3GCWFD-dAlxsw3J2U8j_6n3KGm4-dI8loxdemHGBCvsyaPf2VS5jesxH8IblmKbUB7dWQ" + ] + }, + "Body": "" + } + }, + { + "ID": "f15f5d67c9f184d5", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0016?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "800ead8e859d24c198485164290457c1/8485182136854826507;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0016?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:13 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051472000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnab126:4314,/bns/yx/borg/yx/bns/blobstore2/bitpusher/8.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=ZMysW8T8MsyAzQKYkrHgAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/8.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/8:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYTVGNmlfNzNkdVJhUVRFQXNzZUdCeEdGWld0bm9pVHl0TGhyNW1FY0hyQTF4eDJEXzNxS2cwUGxYVTJhZC1kOHl3dE9jMUVrNzZmVXdFU2J1TlpoVE9NWThoaEhzNlRjUTl1dHRwNHZZRmJBODdBX05uZ1BwNWIxRHdNR1NQUXV2XzdySWxFZjFtQTVRRUMyZThES1VqcHotcmFtNFJMc01MR2x0aVdrTFQzNlNXLVNZMFhjVlpFVG8wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrxN_lEa5gdh4ZryppZ3tgdyGfuXwgtkZUYTAJ28QIFZaJmgFdh7RTwJ2pzxdYDYVKrl1tX4Z8HjuMsKBnwyB7UDIUD8A" + ] + }, + "Body": "" + } + }, + { + "ID": "d1099de2d74ac1d9", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "106" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d073a04f3dfd6da876848e5ad6f763ca/10075594040905200810;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDE3IiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjkwMDAwIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "515" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:14 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051473000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnao18:4369,/bns/yx/borg/yx/bns/blobstore2/bitpusher/108.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=ZcysW4jUEYHGzALUubuoBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/108.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/108:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYkNVTHJoYzlVZGhJQ1l3YzNNQjVKQU8wRzBJZjBPb3FOYk5IMEpoZlphYzBaTkNzR2RCR1hCYV9LcDFYeEZ1aWlOSVo3WFhZM2I0azlnS1lSZWZscEtNNlpDclNKTGhad0RuLWxKR3pUNEFULVU0RV9xa01MQ1dRallrTDFUeTBSOTFJV2M3MzQtYWs5ZlhjdF9BbmtLMVlMbEFHRFFhMGgtRXdCM0VsOW1La29ibG1UZHZCZ0VKaXcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpPbyGbVtM7oj8m_VpH2LDSEgA3a9Y1xJv-Uyzm9pbwLkO2oGHAtjaP132v8oabe0lkhVZhbYCUYJwzfb2M46NBOJQU_Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNyIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTciLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MTMuODg3WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjEzLjg4N1oiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjkwMDAwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjY6MTMuODg3WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUU9In0=" + } + }, + { + "ID": "a939f9cc6dba5113", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0017?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9733eddf476bb62db1d4cd2544bb7770/11666005940677450057;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0017?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2442" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:14 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:14 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051474000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlb12:4251,/bns/yv/borg/yv/bns/blobstore2/bitpusher/43.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=ZsysW9jpBoOegwTq3L2ADw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/43.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/43:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYkNVTHJoYzlVZGhJQ1l3YzNNQjVKQU8wRzBJZjBPb3FOYk5IMEpoZlphYzBaTkNzR2RCR1hCYV9LcDFYeEZ1aWlOSVo3WFhZM2I0azlnS1lSZWZscEtNNlpDclNKTGhad0RuLWxKR3pUNEFULVU0RV9xa01MQ1dRallrTDFUeTBSOTFJV2M3MzQtYWs5ZlhjdF9BbmtLMVlMbEFHRFFhMGgtRXdCM0VsOW1La29ibG1UZHZCZ0VKaXcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrZ01-y1806-liZzg1Zc4EJgkrGX9gYB6aX_TDs2Zm-j1iUC6AD7poaLO05U5iAiWwcAUDxfQNuWV9Vcq6MDGim36ClVA" + ] + }, + "Body":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oifSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "7e76ac1d23c04912", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0017/lockRetentionPolicy?alt=json\u0026ifMetagenerationMatch=1\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "0" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "8fe2407fd7131d02df69a56f109f8645/12425042910098648216;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0017/lockRetentionPolicy?alt=json\u0026ifMetagenerationMatch=1\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "579" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:16 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051473000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnnk15:4485,/bns/yx/borg/yx/bns/blobstore2/bitpusher/113.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=ZsysW_6JGcP9zALA9KDoCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/113.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/113:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYkNVTHJoYzlVZGhJQ1l3YzNNQjVKQU8wRzBJZjBPb3FOYk5IMEpoZlphYzBaTkNzR2RCR1hCYV9LcDFYeEZ1aWlOSVo3WFhZM2I0azlnS1lSZWZscEtNNlpDclNKTGhad0RuLWxKR3pUNEFULVU0RV9xa01MQ1dRallrTDFUeTBSOTFJV2M3MzQtYWs5ZlhjdF9BbmtLMVlMbEFHRFFhMGgtRXdCM0VsOW1La29ibG1UZHZCZ0VKaXcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoMQSqHqmJkvz8xDacwxPwyaIVrIlIsEdjNKzPZAvOHXU4sJVbyiBesmbpc5gIpL9KBQYa4AMYhYCo5u-LFPQ0y_vAVZg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxNyIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTciLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MTMuODg3WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjE1LjkzNloiLCJtZXRhZ2VuZXJhdGlvbiI6IjIiLCJvd25lciI6eyJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSJ9LCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjkwMDAwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjY6MTMuODg3WiIsImlzTG9ja2VkIjp0cnVlfSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FJPSJ9" + } + }, + { + "ID": "8e8e90b1f311e0c0", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0017?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fe36332fb369320ee3dd205b0abd8788/14015454814165799223;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0017?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2458" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:16 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:16 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051474000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrtg25:4215,/bns/yr/borg/yr/bns/blobstore2/bitpusher/19.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=aMysW-GeCcXtkAPp7qJg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/19.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/19:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYkNVTHJoYzlVZGhJQ1l3YzNNQjVKQU8wRzBJZjBPb3FOYk5IMEpoZlphYzBaTkNzR2RCR1hCYV9LcDFYeEZ1aWlOSVo3WFhZM2I0azlnS1lSZWZscEtNNlpDclNKTGhad0RuLWxKR3pUNEFULVU0RV9xa01MQ1dRallrTDFUeTBSOTFJV2M3MzQtYWs5ZlhjdF9BbmtLMVlMbEFHRFFhMGgtRXdCM0VsOW1La29ibG1UZHZCZ0VKaXcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq8KJ3zwGSpR8HjTO4SFtb08TdIZrIEj9oG7XdimkQAiSDBWdUHlWYI1_2NgFVVXV67OFPEutBQarF5JHYd86SUCglkPA" + ] + }, + "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iLCJpc0xvY2tlZCI6dHJ1ZX0sInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "e070e3b1fc8b6e0b", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0017?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "47" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "83e4b5789f8577482f1a8df237d6382c/15605584148039645141;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0017?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJyZXRlbnRpb25Qb2xpY3kiOnsicmV0ZW50aW9uUGVyaW9kIjoiMzYwMCJ9fQo=" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "13262" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:17 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051476000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqe25:4313,/bns/yv/borg/yv/bns/blobstore2/bitpusher/358.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=aMysW7WpG8SCgQTU6r3QDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/358.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/358:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRYkNVTHJoYzlVZGhJQ1l3YzNNQjVKQU8wRzBJZjBPb3FOYk5IMEpoZlphYzBaTkNzR2RCR1hCYV9LcDFYeEZ1aWlOSVo3WFhZM2I0azlnS1lSZWZscEtNNlpDclNKTGhad0RuLWxKR3pUNEFULVU0RV9xa01MQ1dRallrTDFUeTBSOTFJV2M3MzQtYWs5ZlhjdF9BbmtLMVlMbEFHRFFhMGgtRXdCM0VsOW1La29ibG1UZHZCZ0VKaXcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" +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nJlbnRDb250ZXh0LmphdmE6MzIwKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwMywibWVzc2FnZSI6IkNhbm5vdCByZWR1Y2UgcmV0ZW50aW9uIGR1cmF0aW9uIG9mIGEgbG9ja2VkIFJldGVudGlvbiBQb2xpY3kgZm9yIGJ1Y2tldCAnZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDE3Jy4ifX0=" + } + }, + { + "ID": "e047cc4d51eb7a0b", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "106" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "659c9077010b672bd0c19fc8b2a97534/17195996047811894388;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDE4IiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjkwMDAwIn19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "515" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:18 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051477000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnel1:4152,/bns/yx/borg/yx/bns/blobstore2/bitpusher/100.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=acysW_7mMMrpzgLno6zgCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/100.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/100:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdjdEt2SlhWQm5yQUtJOTBLMVdES19JU2FRSFdleUZlcEpXeVdXLWpxZzQ0cHVUbEtVdzlsX1gwUHg4UzZEM3dsck9SNFZ1OW5GRkR3TlItd0xIdWRWSGU2b2VEVDZNdnhZdm5xV0VWQVN6djl1YW5lYVlacFZuSm9jZkV2TDV4R0NycEt5UGZLX2VQNTNvMlEyUlgwRGMxal8xRDQtSDlEMWNqTV8wTlRoZlFOYzRseEFKYnhRb0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UowgkIx9NAooO2nrcRcCMxbenJDY1cuQTBJ9cG6ivuhp_2AhgfZRoIGVOcXBlkej0lSskPz8aTvaEQk_l1S4S8SYVZ1bA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOCIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTgiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MTguMjU5WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjE4LjI1OVoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJsb2NhdGlvbiI6IlVTIiwicmV0ZW50aW9uUG9saWN5Ijp7InJldGVudGlvblBlcmlvZCI6IjkwMDAwIiwiZWZmZWN0aXZlVGltZSI6IjIwMTgtMDktMjdUMTI6MjY6MTguMjU5WiJ9LCJzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUU9In0=" + } + }, + { + "ID": "e1e8b0731cfcad02", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0018/lockRetentionPolicy?alt=json\u0026ifMetagenerationMatch=0\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "0" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "23661918021938212e5b727fa88cefdb/17955033017233092547;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0018/lockRetentionPolicy?alt=json\u0026ifMetagenerationMatch=0\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 412, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Content-Length": [ + "12047" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:19 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051478000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqn25:4154,/bns/yv/borg/yv/bns/blobstore2/bitpusher/374.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=asysW93pIY3yggSq27_4CQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/374.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/374:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWkdjdEt2SlhWQm5yQUtJOTBLMVdES19JU2FRSFdleUZlcEpXeVdXLWpxZzQ0cHVUbEtVdzlsX1gwUHg4UzZEM3dsck9SNFZ1OW5GRkR3TlItd0xIdWRWSGU2b2VEVDZNdnhZdm5xV0VWQVN6djl1YW5lYVlacFZuSm9jZkV2TDV4R0NycEt5UGZLX2VQNTNvMlEyUlgwRGMxal8xRDQtSDlEMWNqTV8wTlRoZlFOYzRseEFKYnhRb0EwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqER26joR5Zr10uFvGr04GcG4fwKz3reu5PWUfJhto9NHp7X0WIF6R6tqywEUrgQtORtgykSYov_L6b3N_o4QRDOAFBqA" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImNvbmRpdGlvbk5vdE1ldCIsIm1lc3NhZ2UiOiJQcmVjb25kaXRpb24gRmFpbGVkIiwibG9jYXRpb25UeXBlIjoiaGVhZGVyIiwibG9jYXRpb24iOiJJZi1NYXRjaCIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZS5SZXNwb25zZUNvZGUuRXJyb3JDb2RlOjpJTkNPUlJFQ1RfTUVUQV9HRU5FUkFUSU9OX1NQRUNJRklFRDog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nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkVHJhY2VDb250ZXh0UnVubmFibGUkMS5ydW4oVHJhY2VDb250ZXh0LmphdmE6NDYyKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuQ3VycmVudENvbnRleHQucnVuSW5Db250ZXh0KEN1cnJlbnRDb250ZXh0LmphdmE6MzIwKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JEFic3RyYWN0VHJhY2VDb250ZXh0Q2FsbGJhY2sucnVuSW5Jbmhlcml0ZWRDb250ZXh0Tm9VbnJlZihUcmFjZUNvbnRleHQuamF2YTozMjEpXG5cdGF0IGNvbS5nb29nbGUudHJhY2luZy5UcmFjZUNvbnRleHQkQWJzdHJhY3RUcmFjZUNvbnRleHRDYWxsYmFjay5ydW5JbkluaGVyaXRlZENvbnRleHQoVHJhY2VDb250ZXh0LmphdmE6MzEzKVxuXHRhdCBjb20uZ29vZ2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQxMiwibWVzc2FnZSI6IlByZWNvbmRpdGlvbiBGYWlsZWQifX0=" + } + }, + { + "ID": "26ad03b13cb9a440", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026kmsKeyName=projects%2Fdulcet-port-762%2Flocations%2Fus%2FkeyRings%2Fgo-integration-test%2FcryptoKeys%2Fkey1\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=0c3a1ebded0d74462865e396c868acafbb701f15d2e7922cd62ec5885fe3" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "2183dfe9a0824db0099ffe40c5204242/339945353129427475;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026kmsKeyName=projects%2Fdulcet-port-762%2Flocations%2Fus%2FkeyRings%2Fgo-integration-test%2FcryptoKeys%2Fkey1\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0wYzNhMWViZGVkMGQ3NDQ2Mjg2NWUzOTZjODY4YWNhZmJiNzAxZjE1ZDJlNzkyMmNkNjJlYzU4ODVmZTMNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJrbXMifQoNCi0tMGMzYTFlYmRlZDBkNzQ0NjI4NjVlMzk2Yzg2OGFjYWZiYjcwMWYxNWQyZTc5MjJjZDYyZWM1ODg1ZmUzDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KbXkgc2VjcmV0DQotLTBjM2ExZWJkZWQwZDc0NDYyODY1ZTM5NmM4NjhhY2FmYmI3MDFmMTVkMmU3OTIyY2Q2MmVjNTg4NWZlMy0tDQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3323" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:21 GMT" + ], + "Etag": [ + "CIHswZKX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051480000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnbu6:4207,/bns/yx/borg/yx/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=bMysW-i0A4igzALuzLGYBQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/115.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/115:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqwEUvAdhjjtCpa7cDpQOh4WraTFmvAU6477TEva-lYmRo41fu1ekaVjDSKM95VeLFE5gmOhJ-9s9IlFQMUgNT59m5Amw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9rbXMvMTUzODA1MTE4MTQwOTc5MyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9vL2ttcyIsIm5hbWUiOiJrbXMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1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mh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDAxIiwib2JqZWN0Ijoia21zIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTExODE0MDk3OTMiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDSUhzd1pLWDI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IlVJNzg1QT09IiwiZXRhZyI6IkNJSHN3WktYMjkwQ0VBRT0iLCJrbXNLZXlOYW1lIjoicHJvamVjdHMvZHVsY2V0LXBvcnQtNzYyL2xvY2F0aW9ucy91cy9rZXlSaW5ncy9nby1pbnRlZ3JhdGlvbi10ZXN0L2NyeXB0b0tleXMva2V5MS9jcnlwdG9LZXlWZXJzaW9ucy8xIn0=" + } + }, + { + "ID": "83ecf58d8ae08666", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/kms", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fb8cda3f34c8118f6c49a1fee026ffb5/1930075786514900913;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/kms" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "9" + ], + "Content-Type": [ + "text/plain; charset=utf-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:21 GMT" + ], + "Etag": [ + "\"-CIHswZKX290CEAE=\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:26:21 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Encryption-Kms-Key-Name": [ + "projects/dulcet-port-762/locations/us/keyRings/go-integration-test/cryptoKeys/key1/cryptoKeyVersions/1" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:26:21 GMT" + ], + "X-Goog-Generation": [ + "1538051181409793" + ], + "X-Goog-Hash": [ + "crc32c=UI785A==", + "md5=AAPQS46TrnMYnqiKAbagtQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "9" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/35,/bns/xh/borg/xh/bns/blobstore2/bitpusher/2.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=bcysW7fsII6kswbkhYKoAQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/2.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/2:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoP-scCUQfp-FabC2kCJED0zZhTBx6qp7seKgu7IvwEPJru7voz-I4aRKXb5ZENMkXDurafjLwyzJdkcT6YgXmAtL3Eiw" + ] + }, + "Body": "bXkgc2VjcmV0" + } + }, + { + "ID": "107c5ecc1982bc8a", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/kms?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "9ecd0d79a117a2848bed84654246265a/3520487690565274960;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/kms?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3323" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:22 GMT" + ], + "Etag": [ + "CIHswZKX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051481000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrp62:4379,/bns/yw/borg/yw/bns/blobstore2/bitpusher/191.scotty,yxfg3-v6:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=bcysW-GxNtW_hATnsKm4BA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/191.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/191:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpVIJ58Vc6OdRzCeCdWcfDPryC9SxGM8vlaBeyGyfjN8QT009BeR4KdR8ZxmXI_VCiiob9ZCk7DrgkQl5muzJ9PTDit8Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9rbXMvMTUzODA1MTE4MTQwOTc5MyIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlY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ID": "13fbc80fb1aa6b47", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/kms?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "97f99806cd482d3aed9f661961a2e0f0/4279806126373314719;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/kms?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:22 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051482000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrvj9:4122,/bns/yv/borg/yv/bns/blobstore2/bitpusher/296.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=bsysW-vuAcu0gASSk5bYAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/296.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/296:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpDftfZWHfmZJAilgwtUbtPOsOPMq-dwRcjfSZJEri1v0W1v-HfuBBevxJ6rYv06LgT2JjjUsb5K7ntra9HTFiz6ya_kQ" + ] + }, + "Body": "" + } + }, + { + "ID": "b8cb55f73f268a09", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=cd07c217ad1b4040d04177ecdd1c792ad8cf91b4aa87c7fa4f72f9042bb1" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "856c112fe406a0bd419f15f0ec95f1ca/5110898490842739438;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Encryption-Key-Sha256": [ + "Io4lnOPU+EThO0X0nq7mNEXB1rWxZsBI4L37pBmyfDc=" + ] + }, + "Body": "LS1jZDA3YzIxN2FkMWI0MDQwZDA0MTc3ZWNkZDFjNzkyYWQ4Y2Y5MWI0YWE4N2M3ZmE0ZjcyZjkwNDJiYjENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJjc2VrIn0KDQotLWNkMDdjMjE3YWQxYjQwNDBkMDQxNzdlY2RkMWM3OTJhZDhjZjkxYjRhYTg3YzdmYTRmNzJmOTA0MmJiMQ0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluDQoNCm15IHNlY3JldA0KLS1jZDA3YzIxN2FkMWI0MDQwZDA0MTc3ZWNkZDFjNzkyYWQ4Y2Y5MWI0YWE4N2M3ZmE0ZjcyZjkwNDJiYjEtLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3355" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:22 GMT" + ], + "Etag": [ + "CJD7+ZKX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051480000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnap189:4365,/bns/yx/borg/yx/bns/blobstore2/bitpusher/28.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=bsysW--PDpLlzAKvsrHYBA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/28.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/28:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur4Us7KxtRF9-lVKK2FUYH_EXFpHY-EaaO0VIwmldcOC2ISoEAfhjWxLUcaaaKqVyW2WeyswAJ3b1so1p7VHGutspR5jA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bSJ9LCJjcmMzMmMiOiJVSTc4NUE9PSIsImV0YWciOiJDSkQ3K1pLWDI5MENFQUU9IiwiY3VzdG9tZXJFbmNyeXB0aW9uIjp7ImVuY3J5cHRpb25BbGdvcml0aG0iOiJBRVMyNTYiLCJrZXlTaGEyNTYiOiJJbzRsbk9QVStFVGhPMFgwbnE3bU5FWEIxcld4WnNCSTRMMzdwQm15ZkRjPSJ9fQ==" + } + }, + { + "ID": "d3abeec5c28d5532", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/csek/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/cmek?alt=json\u0026destinationKmsKeyName=projects%2Fdulcet-port-762%2Flocations%2Fus%2FkeyRings%2Fgo-integration-test%2FcryptoKeys%2Fkey1\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "33a94b645ecf5e03ba14b10348949d2e/6701310394893113485;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/csek/rewriteTo/b/go-integration-test-20180927-44630911863640-0001/o/cmek?alt=json\u0026destinationKmsKeyName=projects%2Fdulcet-port-762%2Flocations%2Fus%2FkeyRings%2Fgo-integration-test%2FcryptoKeys%2Fkey1\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ], + "X-Goog-Copy-Source-Encryption-Algorithm": [ + "AES256" + ], + "X-Goog-Copy-Source-Encryption-Key": [ + "REDACTED" + ], + "X-Goog-Copy-Source-Encryption-Key-Sha256": [ + "Io4lnOPU+EThO0X0nq7mNEXB1rWxZsBI4L37pBmyfDc=" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3461" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:22 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051482000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdz77:4028,/bns/yv/borg/yv/bns/blobstore2/bitpusher/82.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=bsysW4aoIoOlgASf-Jco" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/82.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/82:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up-GIJ-hr4O1BXwGcOo0ufD5O5Cck3nZrSYqNqSDYS3I25lPDsq81Qdf83Kt3O7zYafFwVdpGLlHrPgdWFPsYxU-dQMWw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNyZXdyaXRlUmVzcG9uc2UiLCJ0b3RhbEJ5dGVzUmV3cml0dGVuIjoiOSIsIm9iamVjdFNpemUiOiI5IiwiZG9uZSI6dHJ1ZSwicmVzb3VyY2UiOnsia2luZCI6InN0b3JhZ2Ujb2JqZWN0IiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvY21lay8xNTM4MDUxMTgyODgwMjY2Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlz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VZlcnNpb25zLzEifX0=" + } + }, + { + "ID": "b97ea7cb09758872", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/cmek", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "dd30b0cbb65a6fc65281b1c38c359d6f/8219384333752220972;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/cmek" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "9" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:23 GMT" + ], + "Etag": [ + "\"-CIrMm5OX290CEAE=\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:26:22 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Encryption-Kms-Key-Name": [ + "projects/dulcet-port-762/locations/us/keyRings/go-integration-test/cryptoKeys/key1/cryptoKeyVersions/1" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:26:22 GMT" + ], + "X-Goog-Generation": [ + "1538051182880266" + ], + "X-Goog-Hash": [ + "crc32c=UI785A==", + "md5=AAPQS46TrnMYnqiKAbagtQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "9" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/37,/bns/xh/borg/xh/bns/blobstore2/bitpusher/64.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=b8ysW-0KwqazBrKogYgO" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/64.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/64:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpEYPjNylJw_x0HSlaYlHnG5ObFsMfVkmtpR5B5UuLAgVHHvkN1Mlj7d84jSdO5r9VR20TYFanxN-HpkmO08bEr5XYNbQ" + ] + }, + "Body": "bXkgc2VjcmV0" + } + }, + { + "ID": "7470c09fdaf73fca", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/cmek?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4412449cb3de7d4e1ea446fc09b69389/9809796233507759050;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/cmek?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3360" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:23 GMT" + ], + "Etag": [ + "CIrMm5OX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051481000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjl65:4261,/bns/yw/borg/yw/bns/blobstore2/bitpusher/195.scotty,yxfg3-v6:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=b8ysW9C1DtTDhgTjyLO4CA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/195.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/195:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrqAbn5AuAiZxxcaDtDRpw3gqz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XZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJVSTc4NUE9PSIsImV0YWciOiJDSXJNbTVPWDI5MENFQUU9Iiwia21zS2V5TmFtZSI6InByb2plY3RzL2R1bGNldC1wb3J0LTc2Mi9sb2NhdGlvbnMvdXMva2V5UmluZ3MvZ28taW50ZWdyYXRpb24tdGVzdC9jcnlwdG9LZXlzL2tleTEvY3J5cHRvS2V5VmVyc2lvbnMvMSJ9" + } + }, + { + "ID": "79abcb8c4c7c4a93", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/csek?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0551ce04083a90c2f936914acf102ade/10640889697471968538;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/csek?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:23 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051482000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrpa10:4240,/bns/yw/borg/yw/bns/blobstore2/bitpusher/26.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=b8ysW-XJFYrahQTRl7aoCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/26.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/26:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqxmCHZ6nG_fv9txvIgPWT-btTH3CklFSONa4gIntCV80jUBLdhvwLvPbL4S2_Wxe7VeI81G89Dv2wOLxd6nd6nfS9_vA" + ] + }, + "Body": "" + } + }, + { + "ID": "bfc9cf8ca6d60100", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/cmek?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "20625a94d307387d3dd25631634e914f/11400208137574910057;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/cmek?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:23 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051482000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrch186:4050,/bns/yv/borg/yv/bns/blobstore2/bitpusher/289.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=b8ysW7H-IIb-gQTynLpY" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/289.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/289:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpID_zLKj3Thx28dlgiIatppY3nHmPVtxZsDwGTNfapqMcGaQdejUos_3Y7IqGs0bgkSdqKF1By7cJITT6l3yIeFeTocQ" + ] + }, + "Body": "" + } + }, + { + "ID": "e95d94c243928a86", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "196" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "26eda56d11fa90f3369f3d16e097cb4a/12990618942130433544;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJlbmNyeXB0aW9uIjp7ImRlZmF1bHRLbXNLZXlOYW1lIjoicHJvamVjdHMvZHVsY2V0LXBvcnQtNzYyL2xvY2F0aW9ucy91cy9rZXlSaW5ncy9nby1pbnRlZ3JhdGlvbi10ZXN0L2NyeXB0b0tleXMva2V5MSJ9LCJsb2NhdGlvbiI6IlVTIiwibmFtZSI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSJ9Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "546" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:24 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051482000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrvs3:4021,/bns/yw/borg/yw/bns/blobstore2/bitpusher/192.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=b8ysW63yK4eqhQTHrbmIBw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/192.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/192:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UotNfKtVqKNn8cMC1eOIsB9ICtRV_iouKvDLT910PuKBmI8ITvotlxU93Y2PkHDOt8Q_U6jOmAWK-YWwvrmdto7Q7Bn1w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTkiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MjQuMTU2WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjI0LjE1NloiLCJtZXRhZ2VuZXJhdGlvbiI6IjEiLCJlbmNyeXB0aW9uIjp7ImRlZmF1bHRLbXNLZXlOYW1lIjoicHJvamVjdHMvZHVsY2V0LXBvcnQtNzYyL2xvY2F0aW9ucy91cy9rZXlSaW5ncy9nby1pbnRlZ3JhdGlvbi10ZXN0L2NyeXB0b0tleXMva2V5MSJ9LCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "20ba6d16efe589ea", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5788138dee7e452edf25cc2804838019/14580749371221005222;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2473" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:24 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:24 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051484000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vndt66:4404,/bns/yx/borg/yx/bns/blobstore2/bitpusher/131.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=cMysW--wF8a5zALhwpn4Ag" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/131.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/131:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoFlZwaiTWES3oc5jmTNwSMGBjBKeRObUKKMPiM0vcvToX1cVnGImNDiXBmo4xbYBE-yRM4_mBGxRl16aJv7ji_xVVoJg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTkiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MjQuMTU2WiIsInVwZGF0ZWQiOiIyMDE4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2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FFPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FFPSJ9XSwiZW5jcnlwdGlvbiI6eyJkZWZhdWx0S21zS2V5TmFtZSI6InByb2plY3RzL2R1bGNldC1wb3J0LTc2Mi9sb2NhdGlvbnMvdXMva2V5UmluZ3MvZ28taW50ZWdyYXRpb24tdGVzdC9jcnlwdG9LZXlzL2tleTEifSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBRT0ifQ==" + } + }, + { + "ID": "98d4d0396aa532db", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0019/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=0183510b9204e3050d5dc85bb81ef02775f84a265d260d4e05220590dcd1" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f1ca850acbb001abd943c3dc4b11d15c/15412124305850181366;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0019/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0wMTgzNTEwYjkyMDRlMzA1MGQ1ZGM4NWJiODFlZjAyNzc1Zjg0YTI2NWQyNjBkNGUwNTIyMDU5MGRjZDENCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSIsIm5hbWUiOiJrbXMifQoNCi0tMDE4MzUxMGI5MjA0ZTMwNTBkNWRjODViYjgxZWYwMjc3NWY4NGEyNjVkMjYwZDRlMDUyMjA1OTBkY2QxDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0KbXkgc2VjcmV0DQotLTAxODM1MTBiOTIwNGUzMDUwZDVkYzg1YmI4MWVmMDI3NzVmODRhMjY1ZDI2MGQ0ZTA1MjIwNTkwZGNkMS0tDQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3323" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:26 GMT" + ], + "Etag": [ + "CJyE6ZSX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051482000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrl7:4233,/bns/yr/borg/yr/bns/blobstore2/bitpusher/41.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=cMysW8CILMy9kASo-IzwBQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/41.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/41:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo6QGRGmaNNuOiWVDAgdtuLslGQeZy-98D7XTNvT-KZreR-QMUmyGGG3KX-ZiREC1U4y2-ieiHWGgOaBkdl4bOc6g9lxw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOS9rbXMvMTUzODA1MTE4NjI0NjE3MiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOS9vL2ttcyIsIm5hbWUiOiJrbXMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTkiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE4NjI0NjE3MiIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1QxMjoyNjoyNi4yNDVaIiwidXBkYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MjYuMjQ1WiIsInN0b3JhZ2VDbGF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jM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDSnlFNlpTWDI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IlVJNzg1QT09IiwiZXRhZyI6IkNKeUU2WlNYMjkwQ0VBRT0iLCJrbXNLZXlOYW1lIjoicHJvamVjdHMvZHVsY2V0LXBvcnQtNzYyL2xvY2F0aW9ucy91cy9rZXlSaW5ncy9nby1pbnRlZ3JhdGlvbi10ZXN0L2NyeXB0b0tleXMva2V5MS9jcnlwdG9LZXlWZXJzaW9ucy8xIn0=" + } + }, + { + "ID": "9f8cf00a4303c7e8", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0019/kms", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "84569a2d9db1db62fa4d579148c78171/17002254739235654548;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0019/kms" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "9" + ], + "Content-Type": [ + "text/plain; charset=utf-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:26 GMT" + ], + "Etag": [ + "\"-CJyE6ZSX290CEAE=\"" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:26:26 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Encryption-Kms-Key-Name": [ + "projects/dulcet-port-762/locations/us/keyRings/go-integration-test/cryptoKeys/key1/cryptoKeyVersions/1" + ], + "X-Goog-Generation": [ + "1538051186246172" + ], + "X-Goog-Hash": [ + "crc32c=UI785A==", + "md5=AAPQS46TrnMYnqiKAbagtQ==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "9" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/28,/bns/xh/borg/xh/bns/blobstore2/bitpusher/50.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=csysW9mnFoKiswbHo7-QAQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/50.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/50:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq1-XQ2yh2yq4HD7w8uf-OE1shhofPPQuAKmp-qC5da9s0m1AN7uTNKx0tIrF9-MyTIt7td30r9K5tTyLuqRzWNHMxFwQ" + ] + }, + "Body": "bXkgc2VjcmV0" + } + }, + { + "ID": "a485ba435ca28523", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019/o/kms?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7830534cfb711b081d08eba0b65cf2a9/74147550026887475;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019/o/kms?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3323" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:27 GMT" + ], + "Etag": [ + "CJyE6ZSX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051481000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrsw12:4100,/bns/yr/borg/yr/bns/blobstore2/bitpusher/77.scotty,yxfg3-v6:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=csysW_vKIo-ZkAT23pHoBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/77.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/77:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpT4qsGMeiKmm3SkoiWZwAbBHcGKtofVYo_STTBdjDahuf4BQEGdwFN6zz_j2-uhr3VZgULq_8JuBgsgZAQQPSwIK19OA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOS9rbXMvMTUzODA1MTE4NjI0NjE3MiIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOS9vL2ttcyIsIm5hbWUiOiJrbXMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTkiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTE4NjI0NjE3MiIsIm1ldGF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b3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDE5Iiwib2JqZWN0Ijoia21zIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTExODYyNDYxNzIiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDSnlFNlpTWDI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IlVJNzg1QT09IiwiZXRhZyI6IkNKeUU2WlNYMjkwQ0VBRT0iLCJrbXNLZXlOYW1lIjoicHJvamVjdHMvZHVsY2V0LXBvcnQtNzYyL2xvY2F0aW9ucy91cy9rZXlSaW5ncy9nby1pbnRlZ3JhdGlvbi10ZXN0L2NyeXB0b0tleXMva2V5MS9jcnlwdG9LZXlWZXJzaW9ucy8xIn0=" + } + }, + { + "ID": "7d9bd0c6e55e46e5", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019/o/kms?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d215618fb2f9dcd133d16a7384b7d353/905241013974385794;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019/o/kms?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:28 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051480000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnbd134:4063,/bns/yx/borg/yx/bns/blobstore2/bitpusher/105.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=c8ysW8HfNIbjzAKq95zACQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/105.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/105:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpAexQip8Gz7qHe9IjghL0m9p9kYsvUUOwykqCu4RqDkKXhu6scrgPhzVL1QmWWMZD5L8-ZEXNcUylqtd4on6SutBZ4RA" + ] + }, + "Body": "" + } + }, + { + "ID": "c47642fa5db3bd5e", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "122" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "fbfc712b5c1899fd4ca63ee52e6ab532/2495651814251784481;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJlbmNyeXB0aW9uIjp7ImRlZmF1bHRLbXNLZXlOYW1lIjoicHJvamVjdHMvZHVsY2V0LXBvcnQtNzYyL2xvY2F0aW9ucy91cy9rZXlSaW5ncy9nby1pbnRlZ3JhdGlvbi10ZXN0L2NyeXB0b0tleXMva2V5MiJ9fQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2473" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:29 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051488000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vncd127:4456,/bns/yx/borg/yx/bns/blobstore2/bitpusher/98.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=dMysW5vaC5C5zwK1qK7ABg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/98.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/98:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [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2R1bGNldC1wb3J0LTc2Mi9sb2NhdGlvbnMvdXMva2V5UmluZ3MvZ28taW50ZWdyYXRpb24tdGVzdC9jcnlwdG9LZXlzL2tleTIifSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "7f62069aba528822", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c002ca593e602630ded6a19c2b134689/4086063718302158784;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2473" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:29 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:29 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051481000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrlm79:4339,/bns/yv/borg/yv/bns/blobstore2/bitpusher/192.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=dcysW8jIJsHMggTy3YG4Bw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/192.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/192:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqkNX11AQYP3N2kiMuxoq73fzNO7Bi0pJMhX1c_mLQ42QXGDO_A43-c1RBddVMXKxeMwfQhiRGF86B-ooIMrZpXs1MmVw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTkiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MjQuMTU2WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjI5LjQyM1oiLCJtZXRhZ2VuZXJhdGlvbiI6IjIiLCJhY2wiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldEFjY2Vzc0NvbnRyb2wiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOS9wcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc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NjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FJPSJ9XSwiZW5jcnlwdGlvbiI6eyJkZWZhdWx0S21zS2V5TmFtZSI6InByb2plY3RzL2R1bGNldC1wb3J0LTc2Mi9sb2NhdGlvbnMvdXMva2V5UmluZ3MvZ28taW50ZWdyYXRpb24tdGVzdC9jcnlwdG9LZXlzL2tleTIifSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBST0ifQ==" + } + }, + { + "ID": "fa6f06c5ad8064e4", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "20" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "130a425fc5abcea3f3c5283a84daaac0/5676475622369375326;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJlbmNyeXB0aW9uIjpudWxsfQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2353" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:31 GMT" + ], + "Etag": [ + "CAM=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051490000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrv189:4445,/bns/yr/borg/yr/bns/blobstore2/bitpusher/106.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=dcysW-mJONHokAPIiaDwDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/106.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/106:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UojIFggaWZN6hEXoEkYo4ICef8Y8G2QPP99gaRwO_31pyKn2XSpn1KMBY5Ha9TGzntD2rjuSpxTPCpF9icPZ4U5RDR_2Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAxOSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMTkiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjY6MjQuMTU2WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI2OjMxLjE1OFoiLCJtZXRhZ2V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LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FNPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FNPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInN0b3JhZ2VDbGFzcyI6IlNUQU5EQVJEIiwiZXRhZyI6IkNBTT0ifQ==" + } + }, + { + "ID": "4cb5a8bb09514dcd", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "49bf774f40da9c6ccd6aaac6b1f8fb6d/7266606051459881469;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0019?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:31 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051482000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrhj86:4129,/bns/yv/borg/yv/bns/blobstore2/bitpusher/227.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=d8ysW_DxFsTDswat-Z-oBg" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/227.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/227:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWm1PRlpHcGk5RmhEek1fZDZaWW5nT2k1RTVURThhLXdxeDhkTnNrcVMyNVJkeURqQnQ0MVRlWnZtbjJLRHBEVm5yZUlsNTN0clJYXzFGNkpfMU5OS1ZRZlEzY0M5WTkwSHhZb1hGc09JbTgtUkRPYThhcUVFWnFrdkpjOGw2WmQyMzFhRmliVmwyQVVoeHFzQkdvOFJKTXZ2QTc1M29vT1BCanZJQTR0VEZ6bXVzbTEyU2lVU0xveWMwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up1rQ-BgoD09ndH8GWMMzS2Zhmn0QjIDIJukp6NieOesT9EvuTS0RwbBIPpMlVgQEhFAKxVMNUp4VJAYaWQ7swQezWs0A" + ] + }, + "Body": "" + } + }, + { + "ID": "891d7683ffefdda3", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026predefinedAcl=authenticatedRead\u0026predefinedDefaultObjectAcl=publicRead\u0026prettyPrint=false\u0026project=dulcet-port-762", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "60" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "cb6b62d23ca6eb2db0c7e01be1b9bb97/8857017955510321051;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026predefinedAcl=authenticatedRead\u0026predefinedDefaultObjectAcl=publicRead\u0026prettyPrint=false\u0026project=dulcet-port-762" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJuYW1lIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDIwIn0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "1404" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:32 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051491000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnam67:4028,/bns/yx/borg/yx/bns/blobstore2/bitpusher/78.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=d8ysW8yrPKSGzQLC47eoAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/78.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/78:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqMpuPJgLpZv1oExTs4Xg16mQfhfIKXonUO9BJXMHQsuGF4dTdsbigEov8h0t91zJU8pmxlW3jj0JTLD7rnnfatR3lPrg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMCIsInNlbGZMaW5rIjoia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A5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMC9hbGxBdXRoZW50aWNhdGVkVXNlcnMiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMjAvYWNsL2FsbEF1dGhlbnRpY2F0ZWRVc2VycyIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMCIsImVudGl0eSI6ImFsbEF1dGhlbnRpY2F0ZWRVc2VycyIsInJvbGUiOiJSRUFERVIiLCJldGFnIjoiQ0FFPSJ9XSwiZGVmYXVsdE9iamVjdEFjbCI6W3sia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6ImFsbFVzZXJzIiwicm9sZSI6IlJFQURFUiIsImV0YWciOiJDQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSJ9LCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "b49c1e9a0f83e151", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0d60ab1455023a58da860c5a8382cd3f/10447428760082621498;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "1404" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:33 GMT" + ], + "Etag": [ + "CAE=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:33 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051492000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrp184:4188,/bns/yr/borg/yr/bns/blobstore2/bitpusher/105.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=eMysW7aDLZCMkATtpaSoDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/105.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/105:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urqu3mcHdMmoSo-FZwYHnjUt-4JoFJC40fJlB6GgRNe3MJSsnCfflBb4Fn7MRFozkTM0lJVdby67cEnsWc_pzlvRBjCew" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMCIsInByb2plY3ROdW1iZXIiOiIzNjYz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Z3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMjAvYWNsL2FsbEF1dGhlbnRpY2F0ZWRVc2VycyIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMCIsImVudGl0eSI6ImFsbEF1dGhlbnRpY2F0ZWRVc2VycyIsInJvbGUiOiJSRUFERVIiLCJldGFnIjoiQ0FFPSJ9XSwiZGVmYXVsdE9iamVjdEFjbCI6W3sia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6ImFsbFVzZXJzIiwicm9sZSI6IlJFQURFUiIsImV0YWciOiJDQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSJ9LCJsb2NhdGlvbiI6IlVTIiwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9" + } + }, + { + "ID": "87a9188ffc1f950f", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020?alt=json\u0026predefinedAcl=private\u0026predefinedDefaultObjectAcl=authenticatedRead\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "33" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "949ae0c5485ef5fba888d9ee9e3ece82/11965502694630050521;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020?alt=json\u0026predefinedAcl=private\u0026predefinedDefaultObjectAcl=authenticatedRead\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJhY2wiOltdLCJkZWZhdWx0T2JqZWN0QWNsIjpbXX0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "1049" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:34 GMT" + ], + "Etag": [ + "CAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051493000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrna23:4440,/bns/yw/borg/yw/bns/blobstore2/bitpusher/181.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=ecysW7XYAdPkhATNoabIDw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/181.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/181:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpZpSJIhVMhoHzAya137K-3ICxB3mv_44utwUUjjgeN6udkUR5RE-QVvopzq8Es4nhaQ3ZLEx2u6y7TcbaBjwRy5LAqqQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMCIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMCIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSI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JzdG9yYWdlQ2xhc3MiOiJTVEFOREFSRCIsImV0YWciOiJDQUk9In0=" + } + }, + { + "ID": "e4a3dd503180735b", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o?alt=json\u0026predefinedAcl=authenticatedRead\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=beb0c8923f1906fc1d6a5d8d3bc17f536531b44ab40d3d9fc8efb9fb7f72" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "23efe85846102ea586924024a1100570/12796877629259291944;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o?alt=json\u0026predefinedAcl=authenticatedRead\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1iZWIwYzg5MjNmMTkwNmZjMWQ2YTVkOGQzYmMxN2Y1MzY1MzFiNDRhYjQwZDNkOWZjOGVmYjlmYjdmNzINCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMCIsIm5hbWUiOiJwcml2YXRlIn0KDQotLWJlYjBjODkyM2YxOTA2ZmMxZDZhNWQ4ZDNiYzE3ZjUzNjUzMWI0NGFiNDBkM2Q5ZmM4ZWZiOWZiN2Y3Mg0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCmhlbGxvDQotLWJlYjBjODkyM2YxOTA2ZmMxZDZhNWQ4ZDNiYzE3ZjUzNjUzMWI0NGFiNDBkM2Q5ZmM4ZWZiOWZiN2Y3Mi0tDQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2100" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:35 GMT" + ], + "Etag": [ + "COekh5mX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051494000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vryy5:4338,/bns/yw/borg/yw/bns/blobstore2/bitpusher/209.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=esysW57EMM2dhQTpyo-oDQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/209.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/209:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpCtq9CUGSgrynMd2mh8SOMhrLN0tJva6vaDC8MLugZf43ohkNU0tMfnT9LrjH9cN9nhdnM3SZuopEE2PwjqP0eRagjRg" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMC9wcml2YXRlLzE1MzgwNTExOTUxMzA0NzEiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY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by9wcml2YXRlL2FjbC9hbGxBdXRoZW50aWNhdGVkVXNlcnMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMjAiLCJvYmplY3QiOiJwcml2YXRlIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTExOTUxMzA0NzEiLCJlbnRpdHkiOiJhbGxBdXRoZW50aWNhdGVkVXNlcnMiLCJyb2xlIjoiUkVBREVSIiwiZXRhZyI6IkNPZWtoNW1YMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibW5HN1RBPT0iLCJldGFnIjoiQ09la2g1bVgyOTBDRUFFPSJ9" + } + }, + { + "ID": "58df35897052bee4", + "Request": { + "Method": "PATCH", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/private?alt=json\u0026predefinedAcl=private\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "62" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "24397f66feee409b62926787352017ec/14387289533326443207;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/private?alt=json\u0026predefinedAcl=private\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMjAifQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "1634" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:35 GMT" + ], + "Etag": [ + "COekh5mX290CEAI=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051493000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrjo80:4463,/bns/yv/borg/yv/bns/blobstore2/bitpusher/13.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=e8ysW4LvDtCuggSokbuwAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/13.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/13:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATpxChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4CtK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up9VN6AT4MFmZg0IARYnDCGfAGvkNhL2qzxtqOu4JFgUXJ_Q9kA4PKAlsvszTSqw4rljl00PRjory0QRWzbLupw8M06nA" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMC9wcml2YXRlLzE1MzgwNTExOTUxMzA0NzEiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMjAvby9wcml2YXRlIiwibmFtZSI6InByaXZhdGUiLCJidWNrZXQiOiJnby1pbnR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OTI3LTQ0NjMwOTExODYzNjQwLTAwMjAvby9wcml2YXRlL2FjbC91c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwiYnVja2V0IjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDIwIiwib2JqZWN0IjoicHJpdmF0ZSIsImdlbmVyYXRpb24iOiIxNTM4MDUxMTk1MTMwNDcxIiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ09la2g1bVgyOTBDRUFJPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJtbkc3VEE9PSIsImV0YWciOiJDT2VraDVtWDI5MENFQUk9In0=" + } + }, + { + "ID": "6c8b9234e260aec0", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/private/rewriteTo/b/go-integration-test-20180927-44630911863640-0020/o/dst?alt=json\u0026destinationPredefinedAcl=publicRead\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "3" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e84540708abd3927db61182f95c94954/15977419966695139429;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/private/rewriteTo/b/go-integration-test-20180927-44630911863640-0020/o/dst?alt=json\u0026destinationPredefinedAcl=publicRead\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "e30K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2122" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:35 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051495000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqv16:4123,/bns/yv/borg/yv/bns/blobstore2/bitpusher/135.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=e8ysW8aOG4iRNq7qqOgL" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/135.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/135:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoGz2UN6X_ehowCDfc4UzRfzOOABUIOku0QYLlq2xV_D-ZSoyXFGiI0r2Ze0jbdiZtGxNtE0ZDopU4i4_VfctaYdcfLUw" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNyZXdyaXR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28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDIwL2RzdC8xNTM4MDUxMTk1ODIwMDAzL2FsbFVzZXJzIiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDIwL28vZHN0L2FjbC9hbGxVc2VycyIsImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAyMCIsIm9iamVjdCI6ImRzdCIsImdlbmVyYXRpb24iOiIxNTM4MDUxMTk1ODIwMDAzIiwiZW50aXR5IjoiYWxsVXNlcnMiLCJyb2xlIjoiUkVBREVSIiwiZXRhZyI6IkNPT3ZzWm1YMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoibW5HN1RBPT0iLCJldGFnIjoiQ09PdnNabVgyOTBDRUFFPSJ9fQ==" + } + }, + { + "ID": "bdf3d7c64ba82e03", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/comp/compose?alt=json\u0026destinationPredefinedAcl=authenticatedRead\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Length": [ + "130" + ], + "Content-Type": [ + "application/json" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "55fba242302f069c8de08a55a63b312f/17567830766972538116;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/comp/compose?alt=json\u0026destinationPredefinedAcl=authenticatedRead\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "eyJkZXN0aW5hdGlvbiI6eyJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMjAifSwic291cmNlT2JqZWN0cyI6W3sibmFtZSI6InByaXZhdGUifSx7Im5hbWUiOiJkc3QifV19Cg==" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "2011" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:36 GMT" + ], + "Etag": [ + "CKiF2JmX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051495000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrbe87:4071,/bns/yv/borg/yv/bns/blobstore2/bitpusher/178.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=e8ysW6n9O8TIggSEmZeoDA" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/178.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/178:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp0ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4StK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoVcr8Vwk5n96yY0XwCEwzrkQvuCRGOYIkL4sTNjvaL0NlweMw8cCjbLfz-73ZEPbE8s7m5oNJ6KhRMMLKJ8eR_29Msng" + ] + }, + "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dGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMjAvby9jb21wL2FjbC9hbGxBdXRoZW50aWNhdGVkVXNlcnMiLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMjAiLCJvYmplY3QiOiJjb21wIiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTExOTY0NTM1NDQiLCJlbnRpdHkiOiJhbGxBdXRoZW50aWNhdGVkVXNlcnMiLCJyb2xlIjoiUkVBREVSIiwiZXRhZyI6IkNLaUYySm1YMjkwQ0VBRT0ifV0sIm93bmVyIjp7ImVudGl0eSI6InVzZXItMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20ifSwiY3JjMzJjIjoiL1JDT2dnPT0iLCJjb21wb25lbnRDb3VudCI6MiwiZXRhZyI6IkNLaUYySm1YMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "ee7bc5d7208c190c", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/comp?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4a2194905ad1cf3d334d917f83e28255/18326867736393736275;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/comp?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:37 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051496000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrvq22:4011,/bns/yr/borg/yr/bns/blobstore2/bitpusher/69.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=fMysW-3oJ8zx4QSiqbCQCw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/69.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/69:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpG9-TyHzYXAb1ytjOQjqEQ98fTCU_yZe5G-HK1SELnmk4DQ2EcgdFJoM4mSUTB1yro5RqktWxmw0pNnLiUyBC25Ba60g" + ] + }, + "Body": "" + } + }, + { + "ID": "ac3f89ec4e04e3c1", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/dst?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d86b6c05e8c204b9a0f81a62b0ff1215/711780072290071459;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/dst?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:37 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051496000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrud20:4007,/bns/yv/borg/yv/bns/blobstore2/bitpusher/259.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=fcysW8_OBsmngASFkp7wAw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/259.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/259:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqEiJiMnVBV_g1vn1HPeT4lJx2pAGupW_0ewE6RCPuEs6LX1kKVZPChhF6uNXfd6B-zq41gJBEXqWV3n_C2rVbwOdxQZA" + ] + }, + "Body": "" + } + }, + { + "ID": "624ebe45009cda5b", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/private?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "93b0a271a6a576c37c4b73fa976c4598/1470817041728046578;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020/o/private?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:37 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051491000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnep66:4228,/bns/yx/borg/yx/bns/blobstore2/bitpusher/121.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=fcysW-m_H8uRzgLBuZuAAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/121.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/121:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrMCxb5W9i5rriC3v0MUc9h8Xj4pD83_CNEbRKtAEPOBu0xByvZFQkU2cY3omAUSed_AUo69GRSfyfOfQWZvfpYx1dTYw" + ] + }, + "Body": "" + } + }, + { + "ID": "96fe3135b84e9748", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7be9885fc654f5342511b3e446928915/3061228945778420625;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0020?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:38 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051496000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdp9:4227,/bns/yr/borg/yr/bns/blobstore2/bitpusher/0.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=fcysW9y4OMSxkATZ74bIAQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yr/borg/yr/bns/blobstore2/bitpusher/0.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yr/borg/yr/bns/blobstore2/bitpusher/0:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWnhJX2MxZzUwRGhIUUYyaHZ3SXljdlJ1SEdtaEZZb3ZldVcwLVZDMUdOcjdRck83TTFuWXp0MklvWnJfaXBRTFlpNUplM1RyZ29mSUJJLXRFcnpkVlR2dzJsTGVlQWdJS1lmQ01WejJrT1pTWFo4Vk9FT3pzMHhVVExreDdiU2NtaWg3Ung5NXFVeEsxYjdwbkxQSGJ0RGhHOEhfTFZvUWhGT1pseWNwZ0E3NlZZODlSY3RiNHVLRGcwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Upkthb5ilb0PmvZb8U4V94kTAXT3MGBM_IgyGfzK-IJ6cNMLC5-5iXDx9bVq8L2RsI3oWQofGLNRTSEyGisE1QS9Od1uA" + ] + }, + "Body": "" + } + }, + { + "ID": "ef843a316e292cac", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/projects/dulcet-port-762/serviceAccount?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d7dda37113a0d839d93dfd3c96e9240d/3820265915199618784;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/projects/dulcet-port-762/serviceAccount?alt=json\u0026prettyPrint=false" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "115" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:38 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:38 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051498000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vraf24:4012,/bns/yv/borg/yv/bns/blobstore2/bitpusher/164.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=fsysW_33GJCAgwTX26HYCw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/164.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/164:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYjRBUXFsa3NIcFl6R0t5SlVsbnU0blE5Y0RGNkp6TDRMRmNFaFpMbTNYekFTUmhVUXQtQzgtN3FQcjhsMERLd0NWM09Mck1iR1lhZG0xZnFESVlSaFR3MzloN1Y0U1JocVZDdmM2eGJ2ZjZhVzcwSlhQU0JjdVVQRzVpMEJIMVdQcGZOR0NiakY1X19QcXBpb3lsWEJVaTFGa0l6TVRZWEk5bVk2N01kSG8wOENVOGN2N3hQenRsa1UwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur0HKrUa4R5Mq8Ygoy8TSuogTipVuQD81bwHIZhbVtOKm3ynxpsPT0CFMujvH7hOyRMdQOUJnJU12fFAqF8yrNatJVHFg" + ] + }, + "Body": "eyJlbWFpbF9hZGRyZXNzIjoic2VydmljZS0zNjYzOTkzMzE0NUBncy1wcm9qZWN0LWFjY291bnRzLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwia2luZCI6InN0b3JhZ2Ujc2VydmljZUFjY291bnQifQ==" + } + }, + { + "ID": "87b1562f89ba920e", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=127503253f4275a1da1367a0477ce4d95e90d1d7751cb3524fb96f55940e" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5c407b38ad9b734e406b6679785ea219/4651640845550735407;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS0xMjc1MDMyNTNmNDI3NWExZGExMzY3YTA0NzdjZTRkOTVlOTBkMWQ3NzUxY2IzNTI0ZmI5NmY1NTk0MGUNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsImNhY2hlQ29udHJvbCI6InB1YmxpYywgbWF4LWFnZT02MCIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbiIsIm5hbWUiOiJzb21lLW9iamVjdCJ9Cg0KLS0xMjc1MDMyNTNmNDI3NWExZGExMzY3YTA0NzdjZTRkOTVlOTBkMWQ3NzUxY2IzNTI0ZmI5NmY1NTk0MGUNCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbg0KDQpJco8tJMbRB9F7evlHCJTVDQotLTEyNzUwMzI1M2Y0Mjc1YTFkYTEzNjdhMDQ3N2NlNGQ5NWU5MGQxZDc3NTFjYjM1MjRmYjk2ZjU1OTQwZS0tDQo=" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3355" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Etag": [ + "CMXE9pqX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051498000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrqm23:4413,/bns/yv/borg/yv/bns/blobstore2/bitpusher/243.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=fsysW9qAOoGngASMt5uwAw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yv/borg/yv/bns/blobstore2/bitpusher/243.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yv/borg/yv/bns/blobstore2/bitpusher/243:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRYjRBUXFsa3NIcFl6R0t5SlVsbnU0blE5Y0RGNkp6TDRMRmNFaFpMbTNYekFTUmhVUXQtQzgtN3FQcjhsMERLd0NWM09Mck1iR1lhZG0xZnFESVlSaFR3MzloN1Y0U1JocVZDdmM2eGJ2ZjZhVzcwSlhQU0JjdVVQRzVpMEJIMVdQcGZOR0NiakY1X19QcXBpb3lsWEJVaTFGa0l6TVRZWEk5bVk2N01kSG8wOENVOGN2N3hQenRsa1UwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoZH9z6DQLmLB3hszbJhku2WP75wvFdtWB0fK58doI-vthHIkizLLlhv9R7fh6RktiLx1xK60xmYuZySlA3JW_n9MbA8Q" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS9zb21lLW9iamVjdC8xNTM4MDUxMTk5MDUwMzA5Iiwic2VsZkxpbmsiOiJ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YyI6IlNqenVxUT09IiwiZXRhZyI6IkNNWEU5cHFYMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "9ecb01da3bca46d8", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/some-object", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0cf8cc62e6088f206796f89f84a766d2/6241771278919366350;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/some-object" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=60" + ], + "Content-Length": [ + "16" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Etag": [ + "\"a84fac6ff9296b9b5685e6ee79fbc037\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:27:39 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:26:39 GMT" + ], + "X-Goog-Generation": [ + "1538051199050309" + ], + "X-Goog-Hash": [ + "crc32c=SjzuqQ==", + "md5=qE+sb/kpa5tWhebuefvANw==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "16" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/12,/bns/xh/borg/xh/bns/blobstore2/bitpusher/66.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=f8ysW4nqEcqtswbr-bqwBw" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/66.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/66:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Urw8zsXd0aII9-Dy-sOtg9P7YKZhi_9stUTywmNGoP55deaXNxwKNlKoSuPRmN7ABkk_PN3mBo56AbtnHHgMznZSZtzMQ" + ] + }, + "Body": "SXKPLSTG0QfRe3r5RwiU1Q==" + } + }, + { + "ID": "72b17314bb7de6e2", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/some-object?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "e27bc4849f7b3e65585a7b7f7eb80649/7832182083491666797;o=0" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/some-object?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3355" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Etag": [ + "CMXE9pqX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051498000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrdz77:4028,/bns/yw/borg/yw/bns/blobstore2/bitpusher/20.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=f8ysW7_lGIfjhASigr7ACQ" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/20.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/20:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRYjRBUXFsa3NIcFl6R0t5SlVsbnU0blE5Y0RGNkp6TDRMRmNFaFpMbTNYekFTUmhVUXQtQzgtN3FQcjhsMERLd0NWM09Mck1iR1lhZG0xZnFESVlSaFR3MzloN1Y0U1JocVZDdmM2eGJ2ZjZhVzcwSlhQU0JjdVVQRzVpMEJIMVdQcGZOR0NiakY1X19QcXBpb3lsWEJVaTFGa0l6TVRZWEk5bVk2N01kSG8wOENVOGN2N3hQenRsa1UwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uoa6lNJOwaCeO8CbNnMDeuNJhaMQUSmgIPPeM5txvHbfy-amN-3jbSuXejgrSadZ3_EKFxfGfJNssxhrZahoqwOU3msTQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYm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lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IlNqenVxUT09IiwiZXRhZyI6IkNNWEU5cHFYMjkwQ0VBRT0ifQ==" + } + }, + { + "ID": "e6fb407ff0ea1619", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1986dc56b619cf38e2e1dff7ba63e222/11772042856735554041;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "2493" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Etag": [ + "CAw=" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051499000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnbq5:4467,/bns/yx/borg/yx/bns/blobstore2/bitpusher/109.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=f8ysW6G1IsOSzALqioPQCw" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yx/borg/yx/bns/blobstore2/bitpusher/109.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yx/borg/yx/bns/blobstore2/bitpusher/109:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWWM5QnpDbzAwZl9ZcWt3RGJLV21iQWhrMXlzd1pUM0N2aVZrcjlNV2FJWWFTcDhXenE5WlVKR2wzVzVQTHNLSFgtRVdicUtncHF4ZzdPbDhpbWVQYXRXRHloVXgxVHhycVZ5R2xtNDNiaTlEZ3BrSGRKWlEtLUVVbndMVXZDSDFsQTIwcDMxMDVwZ3FhcEZhZG5RUFhGYklKTUtsVmRjVE5xaENqRG9UZmdXdXBYcFAyWjNRdlFpbjgwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Ur8lmXsqw9klo3KfTUQKj8SjhLcx5JNfMtlnIfw2b27a3bJzG3Ax2xD9Iqe5ZefCvdfTGStaoPjJlW1JwF-bcyRTqhLEQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXQiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInNlbGZMaW5rIjoiaHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vc3RvcmFnZS92MS9iL2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJ0aW1lQ3JlYXRlZCI6IjIwMTgtMDktMjdUMTI6MjM6NTIuMzU1WiIsInVwZGF0ZWQiOiIyMDE4LTA5LTI3VDEyOjI1OjIxLjYyNFoiLCJtZXRhZ2VuZXJhdGlvbiI6IjEyIiwiYWNsIjpbeyJraW5kIjoic3RvcmFnZSNidWNrZXRBY2Nlc3NDb250cm9sIiwiaWQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvcHJvamVjdC1lZGl0b3JzLTM2NjM5OTMzMTQ1Iiwic2VsZkxpbmsiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9zdG9yYWdlL3YxL2IvZ28taW50ZWdyYX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lIjoiUkVBREVSIiwicHJvamVjdFRlYW0iOnsicHJvamVjdE51bWJlciI6IjM2NjM5OTMzMTQ1IiwidGVhbSI6InZpZXdlcnMifSwiZXRhZyI6IkNBdz0ifV0sIm93bmVyIjp7ImVudGl0eSI6InByb2plY3Qtb3duZXJzLTM2NjM5OTMzMTQ1In0sImxvY2F0aW9uIjoiVVMiLCJ2ZXJzaW9uaW5nIjp7ImVuYWJsZWQiOmZhbHNlfSwibGlmZWN5Y2xlIjp7InJ1bGUiOlt7ImFjdGlvbiI6eyJ0eXBlIjoiRGVsZXRlIn0sImNvbmRpdGlvbiI6eyJhZ2UiOjMwfX1dfSwibGFiZWxzIjp7Im5ldyI6Im5ldyIsImwxIjoidjIifSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0F3PSJ9" + } + }, + { + "ID": "d9fdf9def0ae992e", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0021?alt=json\u0026prettyPrint=false\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4d4193baef0cea67da822685e135bc86/3998359321505832337;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0021?alt=json\u0026prettyPrint=false\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "11693" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051499000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrsp13:4212,/bns/yw/borg/yw/bns/blobstore2/bitpusher/30.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=f8ysW4GkMtWuN-TzuZgK" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/30.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/30:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWWM5QnpDbzAwZl9ZcWt3RGJLV21iQWhrMXlzd1pUM0N2aVZrcjlNV2FJWWFTcDhXenE5WlVKR2wzVzVQTHNLSFgtRVdicUtncHF4ZzdPbDhpbWVQYXRXRHloVXgxVHhycVZ5R2xtNDNiaTlEZ3BrSGRKWlEtLUVVbndMVXZDSDFsQTIwcDMxMDVwZ3FhcEZhZG5RUFhGYklKTUtsVmRjVE5xaENqRG9UZmdXdXBYcFAyWjNRdlFpbjgwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoYHqfe9AEz4PqkjcQ8M4PtgG-XYjPzfLqyI_Rwy4j7jrKbFuXHoq_Us0tLKDQaHkdo_OdAFahJfqPTmHZlLIyCWoTjJQ" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vdCBGb3VuZCIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZS5SZXNwb25zZUNvZGUuRXJyb3JDb2RlOjpCVUNLRVRfTk9UX0ZPVU5EOiBObyBzdWNoIGJ1Y2tldDogZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDIxXG5cdGF0IGNvbS5nb29nbGUuY2xvdWQuYmlnc3RvcmUuY29tbW9uLkJpZ3N0b3JlRXhjZXB0aW9uLnRvUnBjM0V4Y2VwdGlvbihCaWdzdG9yZUV4Y2VwdGlvbi5qYXZhOjEzNSlcblx0YXQgY29tLmdvb2dsZS5jbG91ZC5iaWdzdG9yZS5jb21t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sLmphdmE6NDAzKVxuIn1dLCJjb2RlIjo0MDQsIm1lc3NhZ2UiOiJOb3QgRm91bmQifX0=" + } + }, + { + "ID": "f2edea2e972018e1", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/storage-library-test-bucket/Caf%C3%A9", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "933e44fa78b6b0ed72a1c7d4bd460266/4757677761608773856;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/storage-library-test-bucket/Caf%C3%A9" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Length": [ + "20" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Etag": [ + "\"ade43306cb39336d630e101af5fb51b4\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:26:39 GMT" + ], + "Last-Modified": [ + "Fri, 24 Mar 2017 20:04:38 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1490385878535828" + ], + "X-Goog-Hash": [ + "crc32c=fN3yZg==", + "md5=reQzBss5M21jDhAa9ftRtA==" + ], + "X-Goog-Metageneration": [ + "2" + ], + "X-Goog-Storage-Class": [ + "MULTI_REGIONAL" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "20" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/37,/bns/xh/borg/xh/bns/blobstore2/bitpusher/49.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=f8ysW_rAMoSiswb5o6qIAQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "149776848335" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/49.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/49:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpJdKvPm3TxMimdp11GJCNz-S3qlr68hTz4f2s27QxYCMrVkbVDSRKeUhg-Btf2ddXmVwaNQ0sXdnkh6Vgfww7XD6j0ww" + ] + }, + "Body": "Tm9ybWFsaXphdGlvbiBGb3JtIEM=" + } + }, + { + "ID": "a29c391e37458245", + "Request": { + "Method": "POST", + "URL": "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "Content-Type": [ + "multipart/related; boundary=ae8294b34cb6487dfa4fea0f258df1ec078489b2ede5ab6f6bac3a2ac7f7" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "109c8ce598490c80bd07e57ab2feb0f2/5588771225556271919;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/upload/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026prettyPrint=false\u0026projection=full\u0026uploadType=multipart" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "LS1hZTgyOTRiMzRjYjY0ODdkZmE0ZmVhMGYyNThkZjFlYzA3ODQ4OWIyZWRlNWFiNmY2YmFjM2EyYWM3ZjcNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbg0KDQp7ImJ1Y2tldCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm5hbWUiOiJ6ZXJvIn0KDQotLWFlODI5NGIzNGNiNjQ4N2RmYTRmZWEwZjI1OGRmMWVjMDc4NDg5YjJlZGU1YWI2ZjZiYWMzYTJhYzdmNw0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PXV0Zi04DQoNCg0KLS1hZTgyOTRiMzRjYjY0ODdkZmE0ZmVhMGYyNThkZjFlYzA3ODQ4OWIyZWRlNWFiNmY2YmFjM2EyYWM3ZjctLQ0K" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "3221" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:40 GMT" + ], + "Etag": [ + "CPzzsJuX290CEAE=" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051499000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vrks2:4058,/bns/yw/borg/yw/bns/blobstore2/bitpusher/85.scotty,yxfg3-v6:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=f8ysW7vPN8j0hQSdnoHgBg" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "yxfg3-v6:443,/bns/yw/borg/yw/bns/blobstore2/bitpusher/85.scotty,yxfg3-v6:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yw/borg/yw/bns/blobstore2/bitpusher/85:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWWM5QnpDbzAwZl9ZcWt3RGJLV21iQWhrMXlzd1pUM0N2aVZrcjlNV2FJWWFTcDhXenE5WlVKR2wzVzVQTHNLSFgtRVdicUtncHF4ZzdPbDhpbWVQYXRXRHloVXgxVHhycVZ5R2xtNDNiaTlEZ3BrSGRKWlEtLUVVbndMVXZDSDFsQTIwcDMxMDVwZ3FhcEZhZG5RUFhGYklKTUtsVmRjVE5xaENqRG9UZmdXdXBYcFAyWjNRdlFpbjgwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_single_post_uploads" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UprL6_ZKFBbAa3bmTkv0s56mho6CPzO6zIAoHGZ_upPgJFAGrHfSXKPmjgB17shyHdAD2SvQz7t6nCfVMo65tybQC7OiQ" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3QiLCJpZCI6ImdvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMS96ZXJvLzE1MzgwNTEyMDAwMDY2NTIiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEvby96ZXJvIiwibmFtZSI6Inplcm8iLCJidWNrZXQiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTI3LTQ0NjMwOTExODYzNjQwLTAwMDEiLCJnZW5lcmF0aW9uIjoiMTUzODA1MTIwMDAwNjY1MiIsIm1ldGFnZW5lcmF0aW9uIjoiMSIsImNvbnRlbnRUeXBlIjoidGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIsInRpbWVDcmVhdGVkIjoiMjAxOC0wOS0yN1Q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0IjoiemVybyIsImdlbmVyYXRpb24iOiIxNTM4MDUxMjAwMDA2NjUyIiwiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsInJvbGUiOiJPV05FUiIsImVtYWlsIjoiMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHVAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJldGFnIjoiQ1B6enNKdVgyOTBDRUFFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoidXNlci0zNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSJ9LCJjcmMzMmMiOiJBQUFBQUE9PSIsImV0YWciOiJDUHp6c0p1WDI5MENFQUU9In0=" + } + }, + { + "ID": "ad8e1b5fa8d4abd6", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0021/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "72f5cb05d9cd5cf0128b6566bbb6b02f/6348089665675924863;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0021/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 404, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "11713" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:39 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051499000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlhm196:4223,/bns/yk/borg/yk/bns/blobstore2/bitpusher/511.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=f8ysW5aMONXuqQXr74ywDA" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/511.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/511:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWWM5QnpDbzAwZl9ZcWt3RGJLV21iQWhrMXlzd1pUM0N2aVZrcjlNV2FJWWFTcDhXenE5WlVKR2wzVzVQTHNLSFgtRVdicUtncHF4ZzdPbDhpbWVQYXRXRHloVXgxVHhycVZ5R2xtNDNiaTlEZ3BrSGRKWlEtLUVVbndMVXZDSDFsQTIwcDMxMDVwZ3FhcEZhZG5RUFhGYklKTUtsVmRjVE5xaENqRG9UZmdXdXBYcFAyWjNRdlFpbjgwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpkzYrUdFlxkZrW8EdgXtWWUKQvTAJuGymLHVTn4cPRfEREWNaVKuXwyYW4mF2y6_d3a1GoYDsx3b3TTuknUqSSfQEl_g" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6Im5vdEZvdW5kIiwibWVzc2FnZSI6Ik5vdCBGb3VuZCIsImRlYnVnSW5mbyI6ImNvbS5nb29nbGUubmV0LnJwYzMuUnBjRXhjZXB0aW9uOiBjbG91ZC5iaWdzdG9yZS5SZXNwb25zZUNvZGUuRXJyb3JDb2RlOjpCVUNLRVRfTk9UX0ZPVU5EOiBObyBzdWNoIGJ1Y2tldDogZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkyNy00NDYzMDkxMTg2MzY0MC0wMDIxXG5cdGF0IGNvbS5nb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2xlLnRyYWNpbmcuVHJhY2VDb250ZXh0JFRyYWNlQ29udGV4dFJ1bm5hYmxlLnJ1bihUcmFjZUNvbnRleHQuamF2YTo0NTkpXG5cdGF0IGNvbS5nb29nbGUuZ3NlLmludGVybmFsLkRpc3BhdGNoUXVldWVJbXBsJFdvcmtlclRocmVhZC5ydW4oRGlzcGF0Y2hRdWV1ZUltcGwuamF2YTo0MDMpXG4ifV0sImNvZGUiOjQwNCwibWVzc2FnZSI6Ik5vdCBGb3VuZCJ9fQ==" + } + }, + { + "ID": "66fe2a28fb424b1b", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/storage-library-test-bucket/Cafe%CC%81", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "c37f321207ea898411bcb64ce8a123d9/7938218995254868765;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/storage-library-test-bucket/Cafe%CC%81" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "public, max-age=3600" + ], + "Content-Length": [ + "20" + ], + "Content-Type": [ + "text/plain" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:40 GMT" + ], + "Etag": [ + "\"df597679bac7c6150429ad80a1a05680\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 13:26:40 GMT" + ], + "Last-Modified": [ + "Fri, 24 Mar 2017 20:04:37 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Generation": [ + "1490385877705600" + ], + "X-Goog-Hash": [ + "crc32c=qBeWjQ==", + "md5=31l2ebrHxhUEKa2AoaBWgA==" + ], + "X-Goog-Metageneration": [ + "2" + ], + "X-Goog-Storage-Class": [ + "MULTI_REGIONAL" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "20" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/41,/bns/xh/borg/xh/bns/blobstore2/bitpusher/31.scotty,aclgag19:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=gMysW-n0Au2iswb0w5eIAQ" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "149776848335" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/31.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/31:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoNn1YQ-BDeQ-KRYAa-HiVMAgNHohnsb2swJwhk8j-DIFUfIxwS-uSy-ewFIj6cekOhnlt8vVrHhxZkrgZ3kftYtB2g_A" + ] + }, + "Body": "Tm9ybWFsaXphdGlvbiBGb3JtIEQ=" + } + }, + { + "ID": "f235a22996dff1e9", + "Request": { + "Method": "GET", + "URL": "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/zero", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "Go-http-client/1.1" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "5235692a62da640b886a2be6092c3a8f/9528630899322020028;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "storage.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://storage.googleapis.com/go-integration-test-20180927-44630911863640-0001/zero" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Accept-Ranges": [ + "bytes" + ], + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "text/plain; charset=utf-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:40 GMT" + ], + "Etag": [ + "\"d41d8cd98f00b204e9800998ecf8427e\"" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:40 GMT" + ], + "Last-Modified": [ + "Thu, 27 Sep 2018 12:26:40 GMT" + ], + "Server": [ + "UploadServer" + ], + "X-Goog-Expiration": [ + "Sat, 27 Oct 2018 12:26:40 GMT" + ], + "X-Goog-Generation": [ + "1538051200006652" + ], + "X-Goog-Hash": [ + "crc32c=AAAAAA==", + "md5=1B2M2Y8AsgTpgAmY7PhCfg==" + ], + "X-Goog-Metageneration": [ + "1" + ], + "X-Goog-Storage-Class": [ + "STANDARD" + ], + "X-Goog-Stored-Content-Encoding": [ + "identity" + ], + "X-Goog-Stored-Content-Length": [ + "0" + ], + "X-Google-Backends": [ + "/bns/xh/borg/xh/bns/cloud-storage/prod-cloud-storage-frontend.frontend/31,/bns/xh/borg/xh/bns/blobstore2/bitpusher/54.scotty,aclgag19:443" + ], + "X-Google-Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=gMysW43ZCaagswbX74WoBA" + ], + "X-Google-Gfe-Cloud-Project-Number": [ + "36639933145" + ], + "X-Google-Gfe-Request-Trace": [ + "aclgag19:443,/bns/xh/borg/xh/bns/blobstore2/bitpusher/54.scotty,aclgag19:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-cloud-storage" + ], + "X-Google-Netmon-Label": [ + "/bns/xh/borg/xh/bns/blobstore2/bitpusher/54:caf3" + ], + "X-Google-Service": [ + "bitpusher-cloud-storage" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBJ" + ], + "X-Google-Storage-Location": [ + "US" + ], + "X-Guploader-Customer": [ + "cloud-storage" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpRIGEDgm48N7EzftkVrfZeWQdtHI4QTti5zdCFBt7gLd3XZDI6Ehi5VVtXA0DAnoDRx1CGBgC0W9CGOHt-JOsIkALP1g" + ] + }, + "Body": "" + } + }, + { + "ID": "7889cb6a06d14c21", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/zero?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f59da26d669545720dc31e2a55614433/10359724363269518091;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/zero?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:40 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051500000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnpp189:4374,/bns/yk/borg/yk/bns/blobstore2/bitpusher/765.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=gMysW5rFDtW4qQXQnLHQBQ" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/765.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/765:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWWM5QnpDbzAwZl9ZcWt3RGJLV21iQWhrMXlzd1pUM0N2aVZrcjlNV2FJWWFTcDhXenE5WlVKR2wzVzVQTHNLSFgtRVdicUtncHF4ZzdPbDhpbWVQYXRXRHloVXgxVHhycVZ5R2xtNDNiaTlEZ3BrSGRKWlEtLUVVbndMVXZDSDFsQTIwcDMxMDVwZ3FhcEZhZG5RUFhGYklKTUtsVmRjVE5xaENqRG9UZmdXdXBYcFAyWjNRdlFpbjgwBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqRhqqFiBwv6ALAvWPdy7FoMtfiJtc7AdZC3JrI92TgGvrnvK6IouIO2tkfGGKVxqq0SdCy6c-3RlAZqCL2DVyogJawrA" + ] + }, + "Body": "" + } + }, + { + "ID": "df180f9e03860f11", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "725cdf27d3143785c971c87035f61f1a/11119042803372394075;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "66618" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:44 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:44 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051503000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlep62:4200,/bns/yk/borg/yk/bns/blobstore2/bitpusher/689.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=g8ysW__dOdXZqAXus6PwCg" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/689.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/689:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoqUqo_U2y3joYDko_2gxf4WCSpFiddYyWfcbCD8QiyOD-5tvBtzIAB0JiYF9KQSIvI6DqW2XH7pa1qz4qgsuEplKIO-g" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNvYmplY3RzIiwiaXRlbXMiOlt7ImtpbmQiOiJz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3QtMjAxODA5MjctNDQ2MzA5MTE4NjM2NDAtMDAwMSIsIm9iamVjdCI6Inplcm8tb2JqZWN0IiwiZ2VuZXJhdGlvbiI6IjE1MzgwNTEwNTU5MzY3NTgiLCJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIiwicm9sZSI6Ik9XTkVSIiwiZW1haWwiOiIzNjYzOTkzMzE0NS1iMTh0MDFvbXQ5YTI3OWtjM2djZ2lxaHFrbDhib2JodUBkZXZlbG9wZXIuZ3NlcnZpY2VhY2NvdW50LmNvbSIsImV0YWciOiJDUGJKMTlhVzI5MENFQUU9In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6IkFBQUFBQT09IiwiZXRhZyI6IkNQYkoxOWFXMjkwQ0VBRT0ifV19" + } + }, + { + "ID": "08c4d10dd8332635", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/acl1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ef2d1528b634a8d513b51fceb3755dea/11950136267319892394;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/acl1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:44 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlfr201:4123,/bns/yk/borg/yk/bns/blobstore2/bitpusher/609.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hMysW_jTEYe3qwWuxrnABQ" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/609.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/609:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpnXVUzckGzeWmCJAkfLe_4VfTkxJKwgFhdiaJ84f8BaD2BDM47uUHfASQw4_Gwd8tn3PSepx1i50ZVi-d9RDB_WFs8CQ" + ] + }, + "Body": "" + } + }, + { + "ID": "012e6a47fa7c11ad", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/acl2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "aeab4ffc00ee146e9159e2cbc6697ce1/12709173232462965753;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/acl2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:44 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vng123:4144,/bns/yk/borg/yk/bns/blobstore2/bitpusher/207.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hMysW67MHsKSqQXUr52wAg" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/207.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/207:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqOT6HMXjKjXaR-65FBDE3UzG9tfq6NN2JjBBJuMvPQraW28CciOFm0f43SI6e59nQIaHqVrWusyu7mAQiVQQ9WMlc8sw" + ] + }, + "Body": "" + } + }, + { + "ID": "9d37776ab422369f", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/bucketInCopyAttrs?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b2f4772b497824d6fa08ec90d4b4ab2e/13540548167092207176;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/bucketInCopyAttrs?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:44 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlkj7:4437,/bns/yk/borg/yk/bns/blobstore2/bitpusher/265.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hMysW5nFL46LqgWQiJGICA" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/265.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/265:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqOqguDZoaoQuyhQZEqdT9gRvXfCOukU_s4IADMOeCthLyOz0ci8DeVKHiqdniCR2p0rFHU8lxtz2gq4GPJZakjC4cqig" + ] + }, + "Body": "" + } + }, + { + "ID": "f058e292b3ecbcdc", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/checksum-object?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1d4b9606de321abb0c58127db449aa56/14299585136513339800;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/checksum-object?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:45 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlgh81:4169,/bns/yk/borg/yk/bns/blobstore2/bitpusher/302.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hMysW5OOPIrCqgWgjKzoBg" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/302.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/302:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UptxT1bViawpoJzHTVTvKP4Xx1ZcSifkPhGPbzjvhW7hG9ugAgdOyI9uKaB4KOIMXAClmE6pHIqBaPUpEgvsppsHpWhzA" + ] + }, + "Body": "" + } + }, + { + "ID": "28115bbb2e191827", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/composed1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "325c4987a34e0f0960b4194b3230753a/15130958971647730919;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/composed1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:45 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlaw129:4170,/bns/yk/borg/yk/bns/blobstore2/bitpusher/77.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hcysW6GBIYTIqwWCqZ-YCg" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/77.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/77:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uq0IVEL0SX1tuKSBfKN5LKIj2zQZOeGRwK-vpSIa3Vz-jS_eaEWoR4kkvEpSHSwhkeASKZvvNxYij4YxB7TTQ7M0wU9Sg" + ] + }, + "Body": "" + } + }, + { + "ID": "b9135729814675aa", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/composed2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "478ff7b82b02acc614fbd7491cc26138/15889995941085705782;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/composed2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:45 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnfg189:4335,/bns/yk/borg/yk/bns/blobstore2/bitpusher/210.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hcysW9WbLImgqQW5iZ2IAw" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/210.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/210:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up-GoXthTSv9bQ8EW2L_8OW8tcawoqd1dzbe5qE803XVsaMvhysX7AEki0vYm_b_PUp4UQo6nAJty3tzw3sJKs-CkVqZg" + ] + }, + "Body": "" + } + }, + { + "ID": "a70f6efc7b66aebd", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "f2138a3bfdb3ca1270a29175c89434a9/16649032910506838406;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/content?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:46 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlfx126:4091,/bns/yk/borg/yk/bns/blobstore2/bitpusher/143.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hcysW5HGN9aaqQXtlL7gBw" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/143.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/143:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqLRuDWRCZeM1EVDaQWKPgK7oGyYAhiawyTnUmvHL8adw-5x6bDRd4BAtsgEdd6dwTjGcM31JC_PVuxFXk2Gbmi-LgZPg" + ] + }, + "Body": "" + } + }, + { + "ID": "8e3c63694062e50d", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0563889f56ec7e8a3d4ba57f5eff7ec8/17480407845136080085;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:46 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnfl3:4248,/bns/yk/borg/yk/bns/blobstore2/bitpusher/112.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hsysW6a5IMHIqgXnhp64Cg" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/112.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/112:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpQNMs15b2ZK6X_5MihXwZgEjLo6T05WbTr2n0z8XAU1_M6PFj_TGFOvcH2xA8v51X5rXwMMgOa8Zlnciiw5XoNA0wLzw" + ] + }, + "Body": "" + } + }, + { + "ID": "e77e746365ee07f6", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ce94342b388282a0f8a232cd262deb24/18239444810262376228;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:46 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnme21:4136,/bns/yk/borg/yk/bns/blobstore2/bitpusher/346.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hsysW6OaMYbdqQWr3LygCA" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/346.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/346:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up7RfFw6uxIJDsqLp2OQTL_fS4D5Cc7UeUw4mfGwhtlWhLKTB-dm5O4V4A2TwN9GDbHkUTbBK973X78OUzH-R3oGR63mw" + ] + }, + "Body": "" + } + }, + { + "ID": "031605bbb573c6df", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-3?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1f633c49c4dc1cf5e4c915a12098d132/624075675493745012;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/customer-encryption-3?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:47 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vngr8:4458,/bns/yk/borg/yk/bns/blobstore2/bitpusher/776.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=hsysW6vkPMWPqwWHh7rQCw" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/776.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/776:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoK6XiFtLYFGaYtU7nXDjnLYgspLnsp33G7h02rm5oxCRPiKztJAxnaptk1DdxcsgtRWFDpspDibInpfJSmyNate7NAdA" + ] + }, + "Body": "" + } + }, + { + "ID": "a439009eb3aa1c46", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/gzip-test?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "873200505d2f90a7a10b789742172930/1383394115596686531;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/gzip-test?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:47 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnfl3:4248,/bns/yk/borg/yk/bns/blobstore2/bitpusher/415.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=h8ysW-3XC4aaqgWynrWACA" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/415.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/415:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrAL3qpc0XLK8xxxACBMn1fQsJ6CVsY_8Nz09Yy-uCdBU96K6ItuF_EzyJaBR9VqVAxYzetcGXWdykqY22ex6Rd7t-WnA" + ] + }, + "Body": "" + } + }, + { + "ID": "442cd738948405a8", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/hashesOnUpload-1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b37363c18ed7c1f3a242d8100c37474d/2214487579544184594;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/hashesOnUpload-1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:47 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnbf187:4310,/bns/yk/borg/yk/bns/blobstore2/bitpusher/120.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=h8ysW7KrF8a9qQX1-5gQ" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/120.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/120:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UrnZGU805pyZDr-jWUChiJ7PauljYSRc1qu3luwzs4sK1YhEeNuc4z23xWBHQUdf9xnFLxlcYF8y9Mp1J-ZjbXLlE7Edg" + ] + }, + "Body": "" + } + }, + { + "ID": "0ab5c557adf4d210", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj%2Fwith%2Fslashes?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "bfa8c9bbc4fe4bcd2dd20e47d1292d25/2973524548982094178;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj%2Fwith%2Fslashes?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:47 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnaq187:4351,/bns/yk/borg/yk/bns/blobstore2/bitpusher/324.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=h8ysW7reIsHxqwXNrrqQBA" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/324.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/324:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uro06y0j7cAboYlh45nook9CsziqhW4GSDgzR0O41cP9mfrL9LCu-VXFQJN4j_ifc0VzCxPCC_pS8Xi1JsLbiGTQZ4kZw" + ] + }, + "Body": "" + } + }, + { + "ID": "5d15c1564955b248", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1dd3e26a809feaa655da53979de2232c/3804899483611335857;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj1?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:47 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnlw7:4165,/bns/yk/borg/yk/bns/blobstore2/bitpusher/613.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=h8ysW4WLLoOrqwXN27_QBg" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/613.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/613:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uog3n9HLH7oOSIA-N3pS-kf6I_aeZYEinxjeDg9glVhvv8Hn9ZUJk6oKyu1vLO3bDnjVJjdaVeyT_w5C9zqouTqbvFDQA" + ] + }, + "Body": "" + } + }, + { + "ID": "773d0d0e7c8de8d7", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "ae355ff20ff9094a11603f3171b80758/4563935353537683200;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/obj2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:48 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnbr125:4157,/bns/yk/borg/yk/bns/blobstore2/bitpusher/767.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=h8ysW8CeOY7HqwX96J_QBQ" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/767.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/767:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoEeadrUiIgvDLmHfsXIxGMbZwpdL5mrSCwSpoLJsFgNtv3HwESa9z6p58RBQEkI0ybLZtmCC4m5J7pliw5PcoJY-I9_w" + ] + }, + "Body": "" + } + }, + { + "ID": "7fbeaf8b3cf1b91c", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/posc?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "1d8302757f1cbbac298d60752aae572f/5395310283871957584;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/posc?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:48 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vngg82:4082,/bns/yk/borg/yk/bns/blobstore2/bitpusher/454.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=iMysW5mlB4n_qAXV4q7QBg" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/454.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/454:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UoY53cxU4F-dLTTWSvF_miS_w7rFCL6M3gLqmlhu57v_ZofFq1LhJsb7oj9A0OzWgKqL7LnByKllH5uDb02LVJYHZlTqQ" + ] + }, + "Body": "" + } + }, + { + "ID": "7a869ae16e04acab", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/posc2?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "0f17da0653514183f41837352b13cac1/6154347253309932703;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/posc2?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:48 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlfu144:4148,/bns/yk/borg/yk/bns/blobstore2/bitpusher/345.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=iMysW5rwEoLHqQXhy6ugCQ" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/345.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/345:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo6NddOzIil9_TPreOmibWWAp0uuzawHLKoTgLsR5TFz4BdvjhLEPqJWnyQlbvuGu64LRM69DdFAU46Kv4G3wPMi1cDFg" + ] + }, + "Body": "" + } + }, + { + "ID": "90d1290d9e8338e4", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/signedURL?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "56769fe6f7799f8cce8d412e696c8d0d/6985440717257431022;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/signedURL?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:48 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vly135:4474,/bns/yk/borg/yk/bns/blobstore2/bitpusher/735.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=iMysW-uFHsGsqQWeuYfgCA" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/735.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/735:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UqvbeFGjeDdPJCJQCgDngxkPzKNvOQ8FdU1SY7YNAwACJ1YgjQxl6ogh-FGD6uYGinljM1qCH4diAOJC3qSsqKj1ZtNrw" + ] + }, + "Body": "" + } + }, + { + "ID": "9c1feb92dadcfc24", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/some-object?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "da9b41949711014098fef2c91d0f75d3/7744759157360306750;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/some-object?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:48 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlba65:4352,/bns/yk/borg/yk/bns/blobstore2/bitpusher/169.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=iMysW_-jKYOPqQWX5o6wBA" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/169.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/169:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpXqAP9xLjQWdcgz7d8Q_Cbf4AnteqAh9Y73lfxN3Sf3RY2c88hpqs6As4zmkoi7IsdRwxSFQpbwjdWxFHktKceAVTcgg" + ] + }, + "Body": "" + } + }, + { + "ID": "32dbe6fe59803fdd", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/zero-object?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "b038092da7535a6b1a016b5969d43816/8503796126781504909;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001/o/zero-object?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:49 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vnll189:4029,/bns/yk/borg/yk/bns/blobstore2/bitpusher/96.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=iMysW56MNYWyqgWbr4X4Bw" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/96.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/96:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Uo3Gb0e8jwES-jB53Gxhy2Tmlp0VZUOMS4ml-qTNRDKPhFArOCBgKBoQ7ncCW6FqolC3nizW4el-fG3AzpD-xocDeXw4g" + ] + }, + "Body": "" + } + }, + { + "ID": "57411c02a06c30c2", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "7e48b2dfc255815f0f8966e31ae6a811/10094208030848655916;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180927-44630911863640-0001?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 204, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "no-cache, no-store, max-age=0, must-revalidate" + ], + "Content-Length": [ + "0" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:49 GMT" + ], + "Expires": [ + "Mon, 01 Jan 1990 00:00:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vngg200:4073,/bns/yk/borg/yk/bns/blobstore2/bitpusher/608.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=icysW43NBNPuqgXrl4aACg" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/608.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/608:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UolMTGCP9CHjJUePEKE4nRrZ1BxgPKXRv5wjE2rGWQ3hVauimcqefSaoRlr42ly3N6m8U8W3eKK42b_zjLI6lQmBK_ptA" + ] + }, + "Body": "" + } + }, + { + "ID": "94f77b6c25ff6aee", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b?alt=json\u0026pageToken=\u0026prefix=go-integration-test\u0026prettyPrint=false\u0026project=dulcet-port-762\u0026projection=full", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "4a5bbb92754558627e8dd36fe23e7902/10925301490501252475;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b?alt=json\u0026pageToken=\u0026prefix=go-integration-test\u0026prettyPrint=false\u0026project=dulcet-port-762\u0026projection=full" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "77624" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:49 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:49 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051503000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vldj144:4070,/bns/yk/borg/yk/bns/blobstore2/bitpusher/595.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=icysW7nUGNe2qwXao6yQDw" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/595.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/595:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2Up6TaL9Fk0PBYIR55LIqT8d93Peu8cpyc6QcENB7DInI2b12XEHdBbjY03_Ue-SY_V4i-E2t4QOnymAaoC9kwgvkpiB9w" + ] + }, + "Body": "eyJraW5kIjoic3RvcmFnZSNidWNrZXRzIiwiaXRlbXMiOlt7ImtpbmQiOiJzdG9yYWdlI2J1Y2tldCIsImlkIjoiZ28taW50ZWdyYXRpb24tdGVzdC0yMDE4MDkxOC00MTMxNzY3MzE4MDAwLTAwMDIiLCJzZWxmTGluayI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL3N0b3JhZ2UvdjEvYi9nby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTE4LTQxMzE3NjczMTgwMDAtMDAwMiIsInByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsIm5hbWUiOiJnby1pbnRlZ3JhdGlvbi10ZXN0LTIwMTgwOTE4LTQxMzE3N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2wiOlt7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LW93bmVycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJPV05FUiIsInByb2plY3RUZWFtIjp7InByb2plY3ROdW1iZXIiOiIzNjYzOTkzMzE0NSIsInRlYW0iOiJvd25lcnMifSwiZXRhZyI6IkNBRT0ifSx7ImtpbmQiOiJzdG9yYWdlI29iamVjdEFjY2Vzc0NvbnRyb2wiLCJlbnRpdHkiOiJwcm9qZWN0LWVkaXRvcnMtMzY2Mzk5MzMxNDUiLCJyb2xlIjoiT1dORVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoiZWRpdG9ycyJ9LCJldGFnIjoiQ0FFPSJ9LHsia2luZCI6InN0b3JhZ2Ujb2JqZWN0QWNjZXNzQ29udHJvbCIsImVudGl0eSI6InByb2plY3Qtdmlld2Vycy0zNjYzOTkzMzE0NSIsInJvbGUiOiJSRUFERVIiLCJwcm9qZWN0VGVhbSI6eyJwcm9qZWN0TnVtYmVyIjoiMzY2Mzk5MzMxNDUiLCJ0ZWFtIjoidmlld2VycyJ9LCJldGFnIjoiQ0FFPSJ9XSwib3duZXIiOnsiZW50aXR5IjoicHJvamVjdC1vd25lcnMtMzY2Mzk5MzMxNDUifSwibG9jYXRpb24iOiJVUyIsInJldGVudGlvblBvbGljeSI6eyJyZXRlbnRpb25QZXJpb2QiOiI5MDAwMCIsImVmZmVjdGl2ZVRpbWUiOiIyMDE4LTA5LTI3VDEyOjI2OjE4LjI1OVoifSwic3RvcmFnZUNsYXNzIjoiU1RBTkRBUkQiLCJldGFnIjoiQ0FFPSJ9XX0=" + } + }, + { + "ID": "a4e69be0e239962d", + "Request": { + "Method": "GET", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180918-4131767318000-0002/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=\u0026prettyPrint=false\u0026projection=full\u0026versions=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "882c02022466c15c2d708f6ccc043bea/11684338459922450634;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180918-4131767318000-0002/o?alt=json\u0026delimiter=\u0026pageToken=\u0026prefix=\u0026prettyPrint=false\u0026projection=full\u0026versions=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 200, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0, must-revalidate, no-transform" + ], + "Content-Length": [ + "3307" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:50 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:50 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051503000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.read_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlfx126:4091,/bns/yk/borg/yk/bns/blobstore2/bitpusher/559.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=icysW_ORN8GDqQW4zYjQAw" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/559.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/559:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4itK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "success" + ], + "X-Guploader-Upload-Result": [ + "success" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpwEgzCXs8iMGXWCPB6Hq6LFaljM5D8sntRbfhs9lY4TSkWGfDHHRzPddyJVjV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09In1dLCJvd25lciI6eyJlbnRpdHkiOiJ1c2VyLTM2NjM5OTMzMTQ1LWIxOHQwMW9tdDlhMjc5a2MzZ2NnaXFocWtsOGJvYmh1QGRldmVsb3Blci5nc2VydmljZWFjY291bnQuY29tIn0sImNyYzMyYyI6ImdTSjJJUT09IiwiZXRhZyI6IkNJdnYwUGV1dzkwQ0VBTT0iLCJldmVudEJhc2VkSG9sZCI6dHJ1ZX1dfQ==" + } + }, + { + "ID": "cf09ae4a1ba8491f", + "Request": { + "Method": "DELETE", + "URL": "https://www.googleapis.com/storage/v1/b/go-integration-test-20180918-4131767318000-0002/o/some-obj?alt=json\u0026prettyPrint=false", + "Proto": "HTTP/1.1", + "Header": { + "Accept-Encoding": [ + "gzip" + ], + "Authorization": [ + "REDACTED" + ], + "User-Agent": [ + "google-api-go-client/0.5" + ], + "Via": [ + "1.1 httpr-f4507be84cc405ed397a" + ], + "X-Cloud-Trace-Context": [ + "d45c92e9f8b203c29533eacb69213e0a/12515712295073552922;o=1" + ], + "X-Forwarded-For": [ + "127.0.0.1" + ], + "X-Forwarded-Host": [ + "www.googleapis.com" + ], + "X-Forwarded-Proto": [ + "https" + ], + "X-Forwarded-Url": [ + "https://www.googleapis.com/storage/v1/b/go-integration-test-20180918-4131767318000-0002/o/some-obj?alt=json\u0026prettyPrint=false" + ], + "X-Goog-Api-Client": [ + "gl-go/1.11.0-rc2 gccl/20180226" + ] + }, + "Body": "" + }, + "Response": { + "StatusCode": 403, + "Proto": "HTTP/1.1", + "ProtoMajor": 1, + "ProtoMinor": 1, + "Header": { + "Alt-Svc": [ + "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" + ], + "Cache-Control": [ + "private, max-age=0" + ], + "Content-Length": [ + "13398" + ], + "Content-Type": [ + "application/json; charset=UTF-8" + ], + "Date": [ + "Thu, 27 Sep 2018 12:26:50 GMT" + ], + "Expires": [ + "Thu, 27 Sep 2018 12:26:50 GMT" + ], + "Server": [ + "UploadServer" + ], + "Vary": [ + "Origin", + "X-Origin" + ], + "X-Google-Apiary-Auth-Expires": [ + "1538051504000" + ], + "X-Google-Apiary-Auth-Scopes": [ + "https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/devstorage.write_only" + ], + "X-Google-Apiary-Auth-User": [ + "998958384336" + ], + "X-Google-Backends": [ + "vlhl7:4477,/bns/yk/borg/yk/bns/blobstore2/bitpusher/202.scotty,acatlm7:443" + ], + "X-Google-Dos-Service-Trace": [ + "main:apps-upload-cloud-storage-unified" + ], + "X-Google-Gfe-Backend-Request-Info": [ + "eid=isysW_KtDZPlqAXbqbOADw" + ], + "X-Google-Gfe-Request-Trace": [ + "acatlm7:443,/bns/yk/borg/yk/bns/blobstore2/bitpusher/202.scotty,acatlm7:443" + ], + "X-Google-Gfe-Response-Code-Details-Trace": [ + "response_code_set_by_backend" + ], + "X-Google-Gfe-Service-Trace": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Netmon-Label": [ + "/bns/yk/borg/yk/bns/blobstore2/bitpusher/202:caf3" + ], + "X-Google-Service": [ + "bitpusher-gcs-apiary" + ], + "X-Google-Session-Info": [ + "CNCJvbSJHRoCGAYoATp3ChJjbG91ZC1zdG9yYWdlLXJvc3kSCGJpZ3N0b3JlGNmFpL-IASJHMzY2Mzk5MzMxNDUtYjE4dDAxb210OWEyNzlrYzNnY2dpcWhxa2w4Ym9iaHUuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20w4Csw4Ssw4ytK4wESxgF5YTI5LmMuRW93QkpRWU94SDhBWjdSeWVHSm16OFFSZV80RWc4RjdJOUFYemxhX1lqdU1TYkM3YkFFZ2hZY3JuVmR3ckppdUNMWlQyUXNhUWFlV01xeW1EbmRlY3EySHQ5b0ZjQmtGZDA5bk9yZTl4T3Q1Q081RXpHVkNNMGxQQjdneUR4Nm9iMWJFUlZqVTJ0QTJMX0tzMnhZZkRTaEU2cFhlTlpEMzR3Z3lJbUZXQjBUTVU0eDNvLTVFVG5Wa2VpSW9rR00wBDoWTk9UX0FfUEVSU0lTVEVOVF9UT0tFTg" + ], + "X-Google-Shellfish-Status": [ + "CA0gBEBG" + ], + "X-Guploader-Customer": [ + "apiary_cloudstorage_metadata" + ], + "X-Guploader-Request-Result": [ + "agent_rejected" + ], + "X-Guploader-Upload-Result": [ + "agent_rejected" + ], + "X-Guploader-Uploadid": [ + "AEnB2UpxwthGRvjv9oE6KLGMR2nM0RaOpyc3u06tE-6RseFdQnMw_wlaHX9a2iR7Z8UF6e5pAUkE-2-kKutOohrLN7o6-JFZgw" + ] + }, + "Body": "eyJlcnJvciI6eyJlcnJvcnMiOlt7ImRvbWFpbiI6Imdsb2JhbCIsInJlYXNvbiI6ImZvcmJpZGRlbiIsIm1lc3NhZ2UiOiJPYmplY3QgJ2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MTgtNDEzMTc2NzMxODAwMC0wMDAyL3NvbWUtb2JqJyBpcyB1bmRlciBhY3RpdmUgRXZlbnQtQmFzZWQgaG9sZCBhbmQgY2Fubm90IGJlIGRlbGV0ZWQsIG92ZXJ3cml0dGVuIG9yIGFyY2hpdmVkIHVudGlsIGhvbGQgaXMgcmVtb3ZlZC4iLCJkZWJ1Z0luZm8iOiJjb20uZ29vZ2xlLm5ldC5ycGMzLlJwY0V4Y2VwdGlvbjogY2xvdWQuYmlnc3RvcmUuUmVzcG9uc2VDb2RlLkVycm9yQ29kZTo6T0JKRUNUX0lTX1VOREVSX0FDVElWRV9IT0xEOiBPYmplY3QgJ2dvLWludGVncmF0aW9uLXRlc3QtMjAxODA5MTgtNDEzMTc2NzMxODAwMC0wMDAyL3NvbWUtb2JqJyBpcyB1bmRlciBhY3RpdmUgRXZlbnQtQmFzZWQgaG9sZCBhbmQgY2Fubm90IGJlIGRlbGV0ZWQsIG92ZXJ3cml0dGVuIG9yIGFyY2hpdmVkIHVudGlsIGhvbGQgaXMgcmVtb3ZlZC5cblx0YXQgY29tLmdvb2dsZS5jbG91ZC5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n19" + } + } + ] +} \ No newline at end of file diff --git a/vendor/cloud.google.com/go/storage/storage_test.go b/vendor/cloud.google.com/go/storage/storage_test.go new file mode 100644 index 000000000..6806472ec --- /dev/null +++ b/vendor/cloud.google.com/go/storage/storage_test.go @@ -0,0 +1,790 @@ +// 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 storage + +import ( + "context" + "crypto/tls" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "log" + "net" + "net/http" + "net/http/httptest" + "net/url" + "regexp" + "strings" + "testing" + "time" + + "cloud.google.com/go/iam" + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + raw "google.golang.org/api/storage/v1" +) + +func TestHeaderSanitization(t *testing.T) { + t.Parallel() + var tests = []struct { + desc string + in []string + want []string + }{ + { + desc: "already sanitized headers should not be modified", + in: []string{"x-goog-header1:true", "x-goog-header2:0"}, + want: []string{"x-goog-header1:true", "x-goog-header2:0"}, + }, + { + desc: "sanitized headers should be sorted", + in: []string{"x-goog-header2:0", "x-goog-header1:true"}, + want: []string{"x-goog-header1:true", "x-goog-header2:0"}, + }, + { + desc: "non-canonical headers should be removed", + in: []string{"x-goog-header1:true", "x-goog-no-value", "non-canonical-header:not-of-use"}, + want: []string{"x-goog-header1:true"}, + }, + { + desc: "excluded canonical headers should be removed", + in: []string{"x-goog-header1:true", "x-goog-encryption-key:my_key", "x-goog-encryption-key-sha256:my_sha256"}, + want: []string{"x-goog-header1:true"}, + }, + { + desc: "dirty headers should be formatted correctly", + in: []string{" x-goog-header1 : \textra-spaces ", "X-Goog-Header2:CamelCaseValue"}, + want: []string{"x-goog-header1:extra-spaces", "x-goog-header2:CamelCaseValue"}, + }, + { + desc: "duplicate headers should be merged", + in: []string{"x-goog-header1:value1", "X-Goog-Header1:value2"}, + want: []string{"x-goog-header1:value1,value2"}, + }, + } + for _, test := range tests { + got := sanitizeHeaders(test.in) + if !testutil.Equal(got, test.want) { + t.Errorf("%s: got %v, want %v", test.desc, got, test.want) + } + } +} + +func TestSignedURL(t *testing.T) { + t.Parallel() + expires, _ := time.Parse(time.RFC3339, "2002-10-02T10:00:00-05:00") + url, err := SignedURL("bucket-name", "object-name", &SignedURLOptions{ + GoogleAccessID: "xxx@clientid", + PrivateKey: dummyKey("rsa"), + Method: "GET", + MD5: "ICy5YqxZB1uWSwcVLSNLcA==", + Expires: expires, + ContentType: "application/json", + Headers: []string{"x-goog-header1:true", "x-goog-header2:false"}, + }) + if err != nil { + t.Error(err) + } + want := "https://storage.googleapis.com/bucket-name/object-name?" + + "Expires=1033570800&GoogleAccessId=xxx%40clientid&Signature=" + + "RfsHlPtbB2JUYjzCgNr2Mi%2BjggdEuL1V7E6N9o6aaqwVLBDuTv3I0%2B9" + + "x94E6rmmr%2FVgnmZigkIUxX%2Blfl7LgKf30uPGLt0mjKGH2p7r9ey1ONJ" + + "%2BhVec23FnTRcSgopglvHPuCMWU2oNJE%2F1y8EwWE27baHrG1RhRHbLVF" + + "bPpLZ9xTRFK20pluIkfHV00JGljB1imqQHXM%2B2XPWqBngLr%2FwqxLN7i" + + "FcUiqR8xQEOHF%2F2e7fbkTHPNq4TazaLZ8X0eZ3eFdJ55A5QmNi8atlN4W" + + "5q7Hvs0jcxElG3yqIbx439A995BkspLiAcA%2Fo4%2BxAwEMkGLICdbvakq" + + "3eEprNCojw%3D%3D" + if url != want { + t.Fatalf("Unexpected signed URL; found %v", url) + } +} + +func TestSignedURL_PEMPrivateKey(t *testing.T) { + t.Parallel() + expires, _ := time.Parse(time.RFC3339, "2002-10-02T10:00:00-05:00") + url, err := SignedURL("bucket-name", "object-name", &SignedURLOptions{ + GoogleAccessID: "xxx@clientid", + PrivateKey: dummyKey("pem"), + Method: "GET", + MD5: "ICy5YqxZB1uWSwcVLSNLcA==", + Expires: expires, + ContentType: "application/json", + Headers: []string{"x-goog-header1:true", "x-goog-header2:false"}, + }) + if err != nil { + t.Error(err) + } + want := "https://storage.googleapis.com/bucket-name/object-name?" + + "Expires=1033570800&GoogleAccessId=xxx%40clientid&Signature=" + + "TiyKD%2FgGb6Kh0kkb2iF%2FfF%2BnTx7L0J4YiZua8AcTmnidutePEGIU5" + + "NULYlrGl6l52gz4zqFb3VFfIRTcPXMdXnnFdMCDhz2QuJBUpsU1Ai9zlyTQ" + + "dkb6ShG03xz9%2BEXWAUQO4GBybJw%2FULASuv37xA00SwLdkqj8YdyS5II" + + "1lro%3D" + if url != want { + t.Fatalf("Unexpected signed URL; found %v", url) + } +} + +func TestSignedURL_SignBytes(t *testing.T) { + t.Parallel() + expires, _ := time.Parse(time.RFC3339, "2002-10-02T10:00:00-05:00") + url, err := SignedURL("bucket-name", "object-name", &SignedURLOptions{ + GoogleAccessID: "xxx@clientid", + SignBytes: func(b []byte) ([]byte, error) { + return []byte("signed"), nil + }, + Method: "GET", + MD5: "ICy5YqxZB1uWSwcVLSNLcA==", + Expires: expires, + ContentType: "application/json", + Headers: []string{"x-goog-header1:true", "x-goog-header2:false"}, + }) + if err != nil { + t.Error(err) + } + want := "https://storage.googleapis.com/bucket-name/object-name?" + + "Expires=1033570800&GoogleAccessId=xxx%40clientid&Signature=" + + "c2lnbmVk" // base64('signed') == 'c2lnbmVk' + if url != want { + t.Fatalf("Unexpected signed URL\ngot: %q\nwant: %q", url, want) + } +} + +func TestSignedURL_URLUnsafeObjectName(t *testing.T) { + t.Parallel() + expires, _ := time.Parse(time.RFC3339, "2002-10-02T10:00:00-05:00") + url, err := SignedURL("bucket-name", "object name界", &SignedURLOptions{ + GoogleAccessID: "xxx@clientid", + PrivateKey: dummyKey("pem"), + Method: "GET", + MD5: "ICy5YqxZB1uWSwcVLSNLcA==", + Expires: expires, + ContentType: "application/json", + Headers: []string{"x-goog-header1:true", "x-goog-header2:false"}, + }) + if err != nil { + t.Error(err) + } + want := "https://storage.googleapis.com/bucket-name/object%20name%E7%95%8C?" + + "Expires=1033570800&GoogleAccessId=xxx%40clientid&Signature=bxVH1%2Bl%2" + + "BSxpnj3XuqKz6mOFk6M94Y%2B4w85J6FCmJan%2FNhGSpndP6fAw1uLHlOn%2F8xUaY%2F" + + "SfZ5GzcQ%2BbxOL1WA37yIwZ7xgLYlO%2ByAi3GuqMUmHZiNCai28emODXQ8RtWHvgv6dE" + + "SQ%2F0KpDMIWW7rYCaUa63UkUyeSQsKhrVqkIA%3D" + if url != want { + t.Fatalf("Unexpected signed URL; found %v", url) + } +} + +func TestSignedURL_MissingOptions(t *testing.T) { + t.Parallel() + pk := dummyKey("rsa") + expires, _ := time.Parse(time.RFC3339, "2002-10-02T10:00:00-05:00") + var tests = []struct { + opts *SignedURLOptions + errMsg string + }{ + { + &SignedURLOptions{}, + "missing required GoogleAccessID", + }, + { + &SignedURLOptions{GoogleAccessID: "access_id"}, + "exactly one of PrivateKey or SignedBytes must be set", + }, + { + &SignedURLOptions{ + GoogleAccessID: "access_id", + SignBytes: func(b []byte) ([]byte, error) { return b, nil }, + PrivateKey: pk, + }, + "exactly one of PrivateKey or SignedBytes must be set", + }, + { + &SignedURLOptions{ + GoogleAccessID: "access_id", + PrivateKey: pk, + }, + "missing required method", + }, + { + &SignedURLOptions{ + GoogleAccessID: "access_id", + SignBytes: func(b []byte) ([]byte, error) { return b, nil }, + }, + "missing required method", + }, + { + &SignedURLOptions{ + GoogleAccessID: "access_id", + PrivateKey: pk, + Method: "PUT", + }, + "missing required expires", + }, + { + &SignedURLOptions{ + GoogleAccessID: "access_id", + PrivateKey: pk, + Method: "PUT", + Expires: expires, + MD5: "invalid", + }, + "invalid MD5 checksum", + }, + } + for _, test := range tests { + _, err := SignedURL("bucket", "name", test.opts) + if !strings.Contains(err.Error(), test.errMsg) { + t.Errorf("expected err: %v, found: %v", test.errMsg, err) + } + } +} + +func dummyKey(kind string) []byte { + slurp, err := ioutil.ReadFile(fmt.Sprintf("./testdata/dummy_%s", kind)) + if err != nil { + log.Fatal(err) + } + return slurp +} + +func TestObjectNames(t *testing.T) { + t.Parallel() + // Naming requirements: https://cloud.google.com/storage/docs/bucket-naming + const maxLegalLength = 1024 + + type testT struct { + name, want string + } + tests := []testT{ + // Embedded characters important in URLs. + {"foo % bar", "foo%20%25%20bar"}, + {"foo ? bar", "foo%20%3F%20bar"}, + {"foo / bar", "foo%20/%20bar"}, + {"foo %?/ bar", "foo%20%25%3F/%20bar"}, + + // Non-Roman scripts + {"타코", "%ED%83%80%EC%BD%94"}, + {"世界", "%E4%B8%96%E7%95%8C"}, + + // Longest legal name + {strings.Repeat("a", maxLegalLength), strings.Repeat("a", maxLegalLength)}, + + // Line terminators besides CR and LF: https://en.wikipedia.org/wiki/Newline#Unicode + {"foo \u000b bar", "foo%20%0B%20bar"}, + {"foo \u000c bar", "foo%20%0C%20bar"}, + {"foo \u0085 bar", "foo%20%C2%85%20bar"}, + {"foo \u2028 bar", "foo%20%E2%80%A8%20bar"}, + {"foo \u2029 bar", "foo%20%E2%80%A9%20bar"}, + + // Null byte. + {"foo \u0000 bar", "foo%20%00%20bar"}, + + // Non-control characters that are discouraged, but not forbidden, according to the documentation. + {"foo # bar", "foo%20%23%20bar"}, + {"foo []*? bar", "foo%20%5B%5D%2A%3F%20bar"}, + + // Angstrom symbol singleton and normalized forms: http://unicode.org/reports/tr15/ + {"foo \u212b bar", "foo%20%E2%84%AB%20bar"}, + {"foo \u0041\u030a bar", "foo%20A%CC%8A%20bar"}, + {"foo \u00c5 bar", "foo%20%C3%85%20bar"}, + + // Hangul separating jamo: http://www.unicode.org/versions/Unicode7.0.0/ch18.pdf (Table 18-10) + {"foo \u3131\u314f bar", "foo%20%E3%84%B1%E3%85%8F%20bar"}, + {"foo \u1100\u1161 bar", "foo%20%E1%84%80%E1%85%A1%20bar"}, + {"foo \uac00 bar", "foo%20%EA%B0%80%20bar"}, + } + + // C0 control characters not forbidden by the docs. + var runes []rune + for r := rune(0x01); r <= rune(0x1f); r++ { + if r != '\u000a' && r != '\u000d' { + runes = append(runes, r) + } + } + tests = append(tests, testT{fmt.Sprintf("foo %s bar", string(runes)), "foo%20%01%02%03%04%05%06%07%08%09%0B%0C%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20bar"}) + + // C1 control characters, plus DEL. + runes = nil + for r := rune(0x7f); r <= rune(0x9f); r++ { + runes = append(runes, r) + } + tests = append(tests, testT{fmt.Sprintf("foo %s bar", string(runes)), "foo%20%7F%C2%80%C2%81%C2%82%C2%83%C2%84%C2%85%C2%86%C2%87%C2%88%C2%89%C2%8A%C2%8B%C2%8C%C2%8D%C2%8E%C2%8F%C2%90%C2%91%C2%92%C2%93%C2%94%C2%95%C2%96%C2%97%C2%98%C2%99%C2%9A%C2%9B%C2%9C%C2%9D%C2%9E%C2%9F%20bar"}) + + opts := &SignedURLOptions{ + GoogleAccessID: "xxx@clientid", + PrivateKey: dummyKey("rsa"), + Method: "GET", + MD5: "ICy5YqxZB1uWSwcVLSNLcA==", + Expires: time.Date(2002, time.October, 2, 10, 0, 0, 0, time.UTC), + ContentType: "application/json", + Headers: []string{"x-goog-header1", "x-goog-header2"}, + } + + for _, test := range tests { + g, err := SignedURL("bucket-name", test.name, opts) + if err != nil { + t.Errorf("SignedURL(%q) err=%v, want nil", test.name, err) + } + if w := "/bucket-name/" + test.want; !strings.Contains(g, w) { + t.Errorf("SignedURL(%q)=%q, want substring %q", test.name, g, w) + } + } +} + +func TestCondition(t *testing.T) { + t.Parallel() + gotReq := make(chan *http.Request, 1) + hc, close := newTestServer(func(w http.ResponseWriter, r *http.Request) { + io.Copy(ioutil.Discard, r.Body) + gotReq <- r + w.WriteHeader(200) + }) + defer close() + ctx := context.Background() + c, err := NewClient(ctx, option.WithHTTPClient(hc)) + if err != nil { + t.Fatal(err) + } + + obj := c.Bucket("buck").Object("obj") + dst := c.Bucket("dstbuck").Object("dst") + tests := []struct { + fn func() + want string + }{ + { + func() { obj.Generation(1234).NewReader(ctx) }, + "GET /buck/obj?generation=1234", + }, + { + func() { obj.If(Conditions{GenerationMatch: 1234}).NewReader(ctx) }, + "GET /buck/obj?ifGenerationMatch=1234", + }, + { + func() { obj.If(Conditions{GenerationNotMatch: 1234}).NewReader(ctx) }, + "GET /buck/obj?ifGenerationNotMatch=1234", + }, + { + func() { obj.If(Conditions{MetagenerationMatch: 1234}).NewReader(ctx) }, + "GET /buck/obj?ifMetagenerationMatch=1234", + }, + { + func() { obj.If(Conditions{MetagenerationNotMatch: 1234}).NewReader(ctx) }, + "GET /buck/obj?ifMetagenerationNotMatch=1234", + }, + { + func() { obj.If(Conditions{MetagenerationNotMatch: 1234}).Attrs(ctx) }, + "GET /storage/v1/b/buck/o/obj?alt=json&ifMetagenerationNotMatch=1234&prettyPrint=false&projection=full", + }, + + { + func() { obj.If(Conditions{MetagenerationMatch: 1234}).Update(ctx, ObjectAttrsToUpdate{}) }, + "PATCH /storage/v1/b/buck/o/obj?alt=json&ifMetagenerationMatch=1234&prettyPrint=false&projection=full", + }, + { + func() { obj.Generation(1234).Delete(ctx) }, + "DELETE /storage/v1/b/buck/o/obj?alt=json&generation=1234&prettyPrint=false", + }, + { + func() { + w := obj.If(Conditions{GenerationMatch: 1234}).NewWriter(ctx) + w.ContentType = "text/plain" + w.Close() + }, + "POST /upload/storage/v1/b/buck/o?alt=json&ifGenerationMatch=1234&prettyPrint=false&projection=full&uploadType=multipart", + }, + { + func() { + w := obj.If(Conditions{DoesNotExist: true}).NewWriter(ctx) + w.ContentType = "text/plain" + w.Close() + }, + "POST /upload/storage/v1/b/buck/o?alt=json&ifGenerationMatch=0&prettyPrint=false&projection=full&uploadType=multipart", + }, + { + func() { + dst.If(Conditions{MetagenerationMatch: 5678}).CopierFrom(obj.If(Conditions{GenerationMatch: 1234})).Run(ctx) + }, + "POST /storage/v1/b/buck/o/obj/rewriteTo/b/dstbuck/o/dst?alt=json&ifMetagenerationMatch=5678&ifSourceGenerationMatch=1234&prettyPrint=false&projection=full", + }, + } + + for i, tt := range tests { + tt.fn() + select { + case r := <-gotReq: + got := r.Method + " " + r.RequestURI + if got != tt.want { + t.Errorf("%d. RequestURI = %q; want %q", i, got, tt.want) + } + case <-time.After(5 * time.Second): + t.Fatalf("%d. timeout", i) + } + if err != nil { + t.Fatal(err) + } + } + + // Test an error, too: + err = obj.Generation(1234).NewWriter(ctx).Close() + if err == nil || !strings.Contains(err.Error(), "NewWriter: generation not supported") { + t.Errorf("want error about unsupported generation; got %v", err) + } +} + +func TestConditionErrors(t *testing.T) { + t.Parallel() + for _, conds := range []Conditions{ + {GenerationMatch: 0}, + {DoesNotExist: false}, // same as above, actually + {GenerationMatch: 1, GenerationNotMatch: 2}, + {GenerationNotMatch: 2, DoesNotExist: true}, + {MetagenerationMatch: 1, MetagenerationNotMatch: 2}, + } { + if err := conds.validate(""); err == nil { + t.Errorf("%+v: got nil, want error", conds) + } + } +} + +// Test object compose. +func TestObjectCompose(t *testing.T) { + t.Parallel() + gotURL := make(chan string, 1) + gotBody := make(chan []byte, 1) + hc, close := newTestServer(func(w http.ResponseWriter, r *http.Request) { + body, _ := ioutil.ReadAll(r.Body) + gotURL <- r.URL.String() + gotBody <- body + w.Write([]byte("{}")) + }) + defer close() + ctx := context.Background() + c, err := NewClient(ctx, option.WithHTTPClient(hc)) + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + desc string + dst *ObjectHandle + srcs []*ObjectHandle + attrs *ObjectAttrs + wantReq raw.ComposeRequest + wantURL string + wantErr bool + }{ + { + desc: "basic case", + dst: c.Bucket("foo").Object("bar"), + srcs: []*ObjectHandle{ + c.Bucket("foo").Object("baz"), + c.Bucket("foo").Object("quux"), + }, + wantURL: "/storage/v1/b/foo/o/bar/compose?alt=json&prettyPrint=false", + wantReq: raw.ComposeRequest{ + Destination: &raw.Object{Bucket: "foo"}, + SourceObjects: []*raw.ComposeRequestSourceObjects{ + {Name: "baz"}, + {Name: "quux"}, + }, + }, + }, + { + desc: "with object attrs", + dst: c.Bucket("foo").Object("bar"), + srcs: []*ObjectHandle{ + c.Bucket("foo").Object("baz"), + c.Bucket("foo").Object("quux"), + }, + attrs: &ObjectAttrs{ + Name: "not-bar", + ContentType: "application/json", + }, + wantURL: "/storage/v1/b/foo/o/bar/compose?alt=json&prettyPrint=false", + wantReq: raw.ComposeRequest{ + Destination: &raw.Object{ + Bucket: "foo", + Name: "not-bar", + ContentType: "application/json", + }, + SourceObjects: []*raw.ComposeRequestSourceObjects{ + {Name: "baz"}, + {Name: "quux"}, + }, + }, + }, + { + desc: "with conditions", + dst: c.Bucket("foo").Object("bar").If(Conditions{ + GenerationMatch: 12, + MetagenerationMatch: 34, + }), + srcs: []*ObjectHandle{ + c.Bucket("foo").Object("baz").Generation(56), + c.Bucket("foo").Object("quux").If(Conditions{GenerationMatch: 78}), + }, + wantURL: "/storage/v1/b/foo/o/bar/compose?alt=json&ifGenerationMatch=12&ifMetagenerationMatch=34&prettyPrint=false", + wantReq: raw.ComposeRequest{ + Destination: &raw.Object{Bucket: "foo"}, + SourceObjects: []*raw.ComposeRequestSourceObjects{ + { + Name: "baz", + Generation: 56, + }, + { + Name: "quux", + ObjectPreconditions: &raw.ComposeRequestSourceObjectsObjectPreconditions{ + IfGenerationMatch: 78, + }, + }, + }, + }, + }, + { + desc: "no sources", + dst: c.Bucket("foo").Object("bar"), + wantErr: true, + }, + { + desc: "destination, no bucket", + dst: c.Bucket("").Object("bar"), + srcs: []*ObjectHandle{ + c.Bucket("foo").Object("baz"), + }, + wantErr: true, + }, + { + desc: "destination, no object", + dst: c.Bucket("foo").Object(""), + srcs: []*ObjectHandle{ + c.Bucket("foo").Object("baz"), + }, + wantErr: true, + }, + { + desc: "source, different bucket", + dst: c.Bucket("foo").Object("bar"), + srcs: []*ObjectHandle{ + c.Bucket("otherbucket").Object("baz"), + }, + wantErr: true, + }, + { + desc: "source, no object", + dst: c.Bucket("foo").Object("bar"), + srcs: []*ObjectHandle{ + c.Bucket("foo").Object(""), + }, + wantErr: true, + }, + { + desc: "destination, bad condition", + dst: c.Bucket("foo").Object("bar").Generation(12), + srcs: []*ObjectHandle{ + c.Bucket("foo").Object("baz"), + }, + wantErr: true, + }, + { + desc: "source, bad condition", + dst: c.Bucket("foo").Object("bar"), + srcs: []*ObjectHandle{ + c.Bucket("foo").Object("baz").If(Conditions{MetagenerationMatch: 12}), + }, + wantErr: true, + }, + } + + for _, tt := range testCases { + composer := tt.dst.ComposerFrom(tt.srcs...) + if tt.attrs != nil { + composer.ObjectAttrs = *tt.attrs + } + _, err := composer.Run(ctx) + if gotErr := err != nil; gotErr != tt.wantErr { + t.Errorf("%s: got error %v; want err %t", tt.desc, err, tt.wantErr) + continue + } + if tt.wantErr { + continue + } + url, body := <-gotURL, <-gotBody + if url != tt.wantURL { + t.Errorf("%s: request URL\ngot %q\nwant %q", tt.desc, url, tt.wantURL) + } + var req raw.ComposeRequest + if err := json.Unmarshal(body, &req); err != nil { + t.Errorf("%s: json.Unmarshal %v (body %s)", tt.desc, err, body) + } + if !testutil.Equal(req, tt.wantReq) { + // Print to JSON. + wantReq, _ := json.Marshal(tt.wantReq) + t.Errorf("%s: request body\ngot %s\nwant %s", tt.desc, body, wantReq) + } + } +} + +// Test that ObjectIterator's Next and NextPage methods correctly terminate +// if there is nothing to iterate over. +func TestEmptyObjectIterator(t *testing.T) { + t.Parallel() + hClient, close := newTestServer(func(w http.ResponseWriter, r *http.Request) { + io.Copy(ioutil.Discard, r.Body) + fmt.Fprintf(w, "{}") + }) + defer close() + ctx := context.Background() + client, err := NewClient(ctx, option.WithHTTPClient(hClient)) + if err != nil { + t.Fatal(err) + } + it := client.Bucket("b").Objects(ctx, nil) + _, err = it.Next() + if err != iterator.Done { + t.Errorf("got %v, want Done", err) + } +} + +// Test that BucketIterator's Next method correctly terminates if there is +// nothing to iterate over. +func TestEmptyBucketIterator(t *testing.T) { + t.Parallel() + hClient, close := newTestServer(func(w http.ResponseWriter, r *http.Request) { + io.Copy(ioutil.Discard, r.Body) + fmt.Fprintf(w, "{}") + }) + defer close() + ctx := context.Background() + client, err := NewClient(ctx, option.WithHTTPClient(hClient)) + if err != nil { + t.Fatal(err) + } + it := client.Buckets(ctx, "project") + _, err = it.Next() + if err != iterator.Done { + t.Errorf("got %v, want Done", err) + } + +} + +func TestCodecUint32(t *testing.T) { + t.Parallel() + for _, u := range []uint32{0, 1, 256, 0xFFFFFFFF} { + s := encodeUint32(u) + d, err := decodeUint32(s) + if err != nil { + t.Fatal(err) + } + if d != u { + t.Errorf("got %d, want input %d", d, u) + } + } +} + +func TestUserProject(t *testing.T) { + // Verify that the userProject query param is sent. + t.Parallel() + ctx := context.Background() + gotURL := make(chan *url.URL, 1) + hClient, close := newTestServer(func(w http.ResponseWriter, r *http.Request) { + io.Copy(ioutil.Discard, r.Body) + gotURL <- r.URL + if strings.Contains(r.URL.String(), "/rewriteTo/") { + res := &raw.RewriteResponse{Done: true} + bytes, err := res.MarshalJSON() + if err != nil { + t.Fatal(err) + } + w.Write(bytes) + } else { + fmt.Fprintf(w, "{}") + } + }) + defer close() + client, err := NewClient(ctx, option.WithHTTPClient(hClient)) + if err != nil { + t.Fatal(err) + } + + re := regexp.MustCompile(`\buserProject=p\b`) + b := client.Bucket("b").UserProject("p") + o := b.Object("o") + + check := func(msg string, f func()) { + f() + select { + case u := <-gotURL: + if !re.MatchString(u.RawQuery) { + t.Errorf("%s: query string %q does not contain userProject", msg, u.RawQuery) + } + case <-time.After(2 * time.Second): + t.Errorf("%s: timed out", msg) + } + } + + check("buckets.delete", func() { b.Delete(ctx) }) + check("buckets.get", func() { b.Attrs(ctx) }) + check("buckets.patch", func() { b.Update(ctx, BucketAttrsToUpdate{}) }) + check("storage.objects.compose", func() { o.ComposerFrom(b.Object("x")).Run(ctx) }) + check("storage.objects.delete", func() { o.Delete(ctx) }) + check("storage.objects.get", func() { o.Attrs(ctx) }) + check("storage.objects.insert", func() { o.NewWriter(ctx).Close() }) + check("storage.objects.list", func() { b.Objects(ctx, nil).Next() }) + check("storage.objects.patch", func() { o.Update(ctx, ObjectAttrsToUpdate{}) }) + check("storage.objects.rewrite", func() { o.CopierFrom(b.Object("x")).Run(ctx) }) + check("storage.objectAccessControls.list", func() { o.ACL().List(ctx) }) + check("storage.objectAccessControls.update", func() { o.ACL().Set(ctx, "", "") }) + check("storage.objectAccessControls.delete", func() { o.ACL().Delete(ctx, "") }) + check("storage.bucketAccessControls.list", func() { b.ACL().List(ctx) }) + check("storage.bucketAccessControls.update", func() { b.ACL().Set(ctx, "", "") }) + check("storage.bucketAccessControls.delete", func() { b.ACL().Delete(ctx, "") }) + check("storage.defaultObjectAccessControls.list", + func() { b.DefaultObjectACL().List(ctx) }) + check("storage.defaultObjectAccessControls.update", + func() { b.DefaultObjectACL().Set(ctx, "", "") }) + check("storage.defaultObjectAccessControls.delete", + func() { b.DefaultObjectACL().Delete(ctx, "") }) + check("buckets.getIamPolicy", func() { b.IAM().Policy(ctx) }) + check("buckets.setIamPolicy", func() { + p := &iam.Policy{} + p.Add("m", iam.Owner) + b.IAM().SetPolicy(ctx, p) + }) + check("buckets.testIamPermissions", func() { b.IAM().TestPermissions(ctx, nil) }) + check("storage.notifications.insert", func() { + b.AddNotification(ctx, &Notification{TopicProjectID: "p", TopicID: "t"}) + }) + check("storage.notifications.delete", func() { b.DeleteNotification(ctx, "n") }) + check("storage.notifications.list", func() { b.Notifications(ctx) }) +} + +func newTestServer(handler func(w http.ResponseWriter, r *http.Request)) (*http.Client, func()) { + ts := httptest.NewTLSServer(http.HandlerFunc(handler)) + tlsConf := &tls.Config{InsecureSkipVerify: true} + tr := &http.Transport{ + TLSClientConfig: tlsConf, + DialTLS: func(netw, addr string) (net.Conn, error) { + return tls.Dial("tcp", ts.Listener.Addr().String(), tlsConf) + }, + } + return &http.Client{Transport: tr}, func() { + tr.CloseIdleConnections() + ts.Close() + } +} diff --git a/vendor/cloud.google.com/go/storage/testdata/dummy_pem b/vendor/cloud.google.com/go/storage/testdata/dummy_pem new file mode 100644 index 000000000..3428d4497 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/testdata/dummy_pem @@ -0,0 +1,39 @@ +Bag Attributes + friendlyName: privatekey + localKeyID: 54 69 6D 65 20 31 34 31 36 38 35 32 30 30 34 37 37 32 +Key Attributes: +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQCtCWMoJ2Bok2QoGFyU7A6IlGprO9QfUTT0jNrLkIbM5OWNIuDx +64+PEaTS5g5m+2Hz/lmd5jJKanAH4dY9LZzsaYAPq1K17Gcmg1hEisYeKsgOcjYY +kwRkV+natCTsC+tfWmS0voRh0jA1rI1J4MikceoHtgWdEuoHrrptRVpWKwIDAQAB +AoGAKp3uQvx3vSnX+BwP6Um+RpsvHpwMoW3xue1bEdnVqW8SrlERz+NxZw40ZxDs +KSbuuBZD4iTI7BUM5JQVnNm4FQY1YrPlWZLyI73Bj8RKTXrPdJheM/0r7xjiIXbQ +7w4cUSM9rVugnI/rxF2kPIQTGYI+EG/6+P+k6VvgPmC0T/ECQQDUPskiS18WaY+i +Koalbrb3GakaBoHrC1b4ln4CAv7fq7H4WvFvqi/2rxLhHYq31iwxYy8s7J7Sba1+ +5vwJ2TxZAkEA0LVfs3Q2VWZ+cM3bv0aYTalMXg6wT+LoNvk9HnOb0zQYajF3qm4G +ZFdfEqvOkje0zQ4fcihARKyda/VY84UGIwJBAIZa0FvjNmgrnn7bSKzEbxHwrnkJ +EYjGfuGR8mY3mzvfpiM+/oLfSslvfhX+62cALq18yco4ZzlxsFgaxAU//NECQDcS +NN94YcHlGqYPW9W7/gI4EwOaoqFhwV6II71+SfbP/0U+KlJZV+xwNZEKrqZcdqPI +/zkzL8ovNha/laokRrsCQQCyoPHGcBWj+VFbNoyQnX4tghc6rOY7n4pmpgQvU825 +TAM9vnYtSkKK/V56kEDNBO5LwiRsir95IUNclqqMKR1C +-----END RSA PRIVATE KEY----- +Bag Attributes + friendlyName: privatekey + localKeyID: 54 69 6D 65 20 31 34 31 36 38 35 32 30 30 34 37 37 32 +subject=/CN=1079432350659-nvog0vmn9s6pqr3kr4v2avbc7nkhoa11.apps.googleusercontent.com +issuer=/CN=1079432350659-nvog0vmn9s6pqr3kr4v2avbc7nkhoa11.apps.googleusercontent.com +-----BEGIN CERTIFICATE----- +MIICXTCCAcagAwIBAgIIHxTMQUVJRZ0wDQYJKoZIhvcNAQEFBQAwVDFSMFAGA1UE +AxNJMTA3OTQzMjM1MDY1OS1udm9nMHZtbjlzNnBxcjNrcjR2MmF2YmM3bmtob2Ex +MS5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbTAeFw0xNDExMjQxODAwMDRaFw0y +NDExMjExODAwMDRaMFQxUjBQBgNVBAMTSTEwNzk0MzIzNTA2NTktbnZvZzB2bW45 +czZwcXIza3I0djJhdmJjN25raG9hMTEuYXBwcy5nb29nbGV1c2VyY29udGVudC5j +b20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAK0JYygnYGiTZCgYXJTsDoiU +ams71B9RNPSM2suQhszk5Y0i4PHrj48RpNLmDmb7YfP+WZ3mMkpqcAfh1j0tnOxp +gA+rUrXsZyaDWESKxh4qyA5yNhiTBGRX6dq0JOwL619aZLS+hGHSMDWsjUngyKRx +6ge2BZ0S6geuum1FWlYrAgMBAAGjODA2MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/ +BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEBBQUAA4GB +ACVvKkZkomHq3uffOQwdZ4VJYuxrvDGnZu/ExW9WngO2teEsjxABL41TNnRYHN5T +lMC19poFA2tR/DySDLJ2XNs/hSvyQUL6HHCncVdR4Srpie88j48peY1MZSMP51Jv +qagbbP5K5DSEu02/zZaV0kaCvLEN0KAtj/noDuOOnQU2 +-----END CERTIFICATE----- diff --git a/vendor/cloud.google.com/go/storage/testdata/dummy_rsa b/vendor/cloud.google.com/go/storage/testdata/dummy_rsa new file mode 100644 index 000000000..4ce6678db --- /dev/null +++ b/vendor/cloud.google.com/go/storage/testdata/dummy_rsa @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAx4fm7dngEmOULNmAs1IGZ9Apfzh+BkaQ1dzkmbUgpcoghucE +DZRnAGd2aPyB6skGMXUytWQvNYav0WTR00wFtX1ohWTfv68HGXJ8QXCpyoSKSSFY +fuP9X36wBSkSX9J5DVgiuzD5VBdzUISSmapjKm+DcbRALjz6OUIPEWi1Tjl6p5RK +1w41qdbmt7E5/kGhKLDuT7+M83g4VWhgIvaAXtnhklDAggilPPa8ZJ1IFe31lNlr +k4DRk38nc6sEutdf3RL7QoH7FBusI7uXV03DC6dwN1kP4GE7bjJhcRb/7jYt7CQ9 +/E9Exz3c0yAp0yrTg0Fwh+qxfH9dKwN52S7SBwIDAQABAoIBAQCaCs26K07WY5Jt +3a2Cw3y2gPrIgTCqX6hJs7O5ByEhXZ8nBwsWANBUe4vrGaajQHdLj5OKfsIDrOvn +2NI1MqflqeAbu/kR32q3tq8/Rl+PPiwUsW3E6Pcf1orGMSNCXxeducF2iySySzh3 +nSIhCG5uwJDWI7a4+9KiieFgK1pt/Iv30q1SQS8IEntTfXYwANQrfKUVMmVF9aIK +6/WZE2yd5+q3wVVIJ6jsmTzoDCX6QQkkJICIYwCkglmVy5AeTckOVwcXL0jqw5Kf +5/soZJQwLEyBoQq7Kbpa26QHq+CJONetPP8Ssy8MJJXBT+u/bSseMb3Zsr5cr43e +DJOhwsThAoGBAPY6rPKl2NT/K7XfRCGm1sbWjUQyDShscwuWJ5+kD0yudnT/ZEJ1 +M3+KS/iOOAoHDdEDi9crRvMl0UfNa8MAcDKHflzxg2jg/QI+fTBjPP5GOX0lkZ9g +z6VePoVoQw2gpPFVNPPTxKfk27tEzbaffvOLGBEih0Kb7HTINkW8rIlzAoGBAM9y +1yr+jvfS1cGFtNU+Gotoihw2eMKtIqR03Yn3n0PK1nVCDKqwdUqCypz4+ml6cxRK +J8+Pfdh7D+ZJd4LEG6Y4QRDLuv5OA700tUoSHxMSNn3q9As4+T3MUyYxWKvTeu3U +f2NWP9ePU0lV8ttk7YlpVRaPQmc1qwooBA/z/8AdAoGAW9x0HWqmRICWTBnpjyxx +QGlW9rQ9mHEtUotIaRSJ6K/F3cxSGUEkX1a3FRnp6kPLcckC6NlqdNgNBd6rb2rA +cPl/uSkZP42Als+9YMoFPU/xrrDPbUhu72EDrj3Bllnyb168jKLa4VBOccUvggxr +Dm08I1hgYgdN5huzs7y6GeUCgYEAj+AZJSOJ6o1aXS6rfV3mMRve9bQ9yt8jcKXw +5HhOCEmMtaSKfnOF1Ziih34Sxsb7O2428DiX0mV/YHtBnPsAJidL0SdLWIapBzeg +KHArByIRkwE6IvJvwpGMdaex1PIGhx5i/3VZL9qiq/ElT05PhIb+UXgoWMabCp84 +OgxDK20CgYAeaFo8BdQ7FmVX2+EEejF+8xSge6WVLtkaon8bqcn6P0O8lLypoOhd +mJAYH8WU+UAy9pecUnDZj14LAGNVmYcse8HFX71MoshnvCTFEPVo4rZxIAGwMpeJ +5jgQ3slYLpqrGlcbLgUXBUgzEO684Wk/UV9DFPlHALVqCfXQ9dpJPg== +-----END RSA PRIVATE KEY----- diff --git a/vendor/cloud.google.com/go/storage/writer.go b/vendor/cloud.google.com/go/storage/writer.go new file mode 100644 index 000000000..3a58c404e --- /dev/null +++ b/vendor/cloud.google.com/go/storage/writer.go @@ -0,0 +1,261 @@ +// 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 storage + +import ( + "context" + "encoding/base64" + "errors" + "fmt" + "io" + "sync" + "unicode/utf8" + + "google.golang.org/api/googleapi" + raw "google.golang.org/api/storage/v1" +) + +// A Writer writes a Cloud Storage object. +type Writer struct { + // ObjectAttrs are optional attributes to set on the object. Any attributes + // must be initialized before the first Write call. Nil or zero-valued + // attributes are ignored. + ObjectAttrs + + // SendCRC specifies whether to transmit a CRC32C field. It should be set + // to true in addition to setting the Writer's CRC32C field, because zero + // is a valid CRC and normally a zero would not be transmitted. + // If a CRC32C is sent, and the data written does not match the checksum, + // the write will be rejected. + SendCRC32C bool + + // ChunkSize controls the maximum number of bytes of the object that the + // Writer will attempt to send to the server in a single request. Objects + // smaller than the size will be sent in a single request, while larger + // objects will be split over multiple requests. The size will be rounded up + // to the nearest multiple of 256K. If zero, chunking will be disabled and + // the object will be uploaded in a single request. + // + // ChunkSize will default to a reasonable value. If you perform many concurrent + // writes of small objects, you may wish set ChunkSize to a value that matches + // your objects' sizes to avoid consuming large amounts of memory. + // + // ChunkSize must be set before the first Write call. + ChunkSize int + + // ProgressFunc can be used to monitor the progress of a large write. + // operation. If ProgressFunc is not nil and writing requires multiple + // calls to the underlying service (see + // https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload), + // then ProgressFunc will be invoked after each call with the number of bytes of + // content copied so far. + // + // ProgressFunc should return quickly without blocking. + ProgressFunc func(int64) + + ctx context.Context + o *ObjectHandle + + opened bool + pw *io.PipeWriter + + donec chan struct{} // closed after err and obj are set. + obj *ObjectAttrs + + mu sync.Mutex + err error +} + +func (w *Writer) open() error { + attrs := w.ObjectAttrs + // Check the developer didn't change the object Name (this is unfortunate, but + // we don't want to store an object under the wrong name). + if attrs.Name != w.o.object { + return fmt.Errorf("storage: Writer.Name %q does not match object name %q", attrs.Name, w.o.object) + } + if !utf8.ValidString(attrs.Name) { + return fmt.Errorf("storage: object name %q is not valid UTF-8", attrs.Name) + } + if attrs.KMSKeyName != "" && w.o.encryptionKey != nil { + return errors.New("storage: cannot use KMSKeyName with a customer-supplied encryption key") + } + pr, pw := io.Pipe() + w.pw = pw + w.opened = true + + go w.monitorCancel() + + if w.ChunkSize < 0 { + return errors.New("storage: Writer.ChunkSize must be non-negative") + } + mediaOpts := []googleapi.MediaOption{ + googleapi.ChunkSize(w.ChunkSize), + } + if c := attrs.ContentType; c != "" { + mediaOpts = append(mediaOpts, googleapi.ContentType(c)) + } + + go func() { + defer close(w.donec) + + rawObj := attrs.toRawObject(w.o.bucket) + if w.SendCRC32C { + rawObj.Crc32c = encodeUint32(attrs.CRC32C) + } + if w.MD5 != nil { + rawObj.Md5Hash = base64.StdEncoding.EncodeToString(w.MD5) + } + call := w.o.c.raw.Objects.Insert(w.o.bucket, rawObj). + Media(pr, mediaOpts...). + Projection("full"). + Context(w.ctx) + if w.ProgressFunc != nil { + call.ProgressUpdater(func(n, _ int64) { w.ProgressFunc(n) }) + } + if attrs.KMSKeyName != "" { + call.KmsKeyName(attrs.KMSKeyName) + } + if attrs.PredefinedACL != "" { + call.PredefinedAcl(attrs.PredefinedACL) + } + if err := setEncryptionHeaders(call.Header(), w.o.encryptionKey, false); err != nil { + w.mu.Lock() + w.err = err + w.mu.Unlock() + pr.CloseWithError(err) + return + } + var resp *raw.Object + err := applyConds("NewWriter", w.o.gen, w.o.conds, call) + if err == nil { + if w.o.userProject != "" { + 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 + }) + } + } + if err != nil { + w.mu.Lock() + w.err = err + w.mu.Unlock() + pr.CloseWithError(err) + return + } + w.obj = newObject(resp) + }() + return nil +} + +// Write appends to w. It implements the io.Writer interface. +// +// Since writes happen asynchronously, Write may return a nil +// error even though the write failed (or will fail). Always +// use the error returned from Writer.Close to determine if +// the upload was successful. +func (w *Writer) Write(p []byte) (n int, err error) { + w.mu.Lock() + werr := w.err + w.mu.Unlock() + if werr != nil { + return 0, werr + } + if !w.opened { + if err := w.open(); err != nil { + return 0, err + } + } + n, err = w.pw.Write(p) + if err != nil { + w.mu.Lock() + werr := w.err + w.mu.Unlock() + // Preserve existing functionality that when context is canceled, Write will return + // context.Canceled instead of "io: read/write on closed pipe". This hides the + // pipe implementation detail from users and makes Write seem as though it's an RPC. + if werr == context.Canceled || werr == context.DeadlineExceeded { + return n, werr + } + } + return n, err +} + +// Close completes the write operation and flushes any buffered data. +// If Close doesn't return an error, metadata about the written object +// can be retrieved by calling Attrs. +func (w *Writer) Close() error { + if !w.opened { + if err := w.open(); err != nil { + return err + } + } + + // Closing either the read or write causes the entire pipe to close. + if err := w.pw.Close(); err != nil { + return err + } + + <-w.donec + w.mu.Lock() + defer w.mu.Unlock() + return w.err +} + +// 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 +// closes things that do not take a context. +func (w *Writer) monitorCancel() { + select { + case <-w.ctx.Done(): + w.mu.Lock() + werr := w.ctx.Err() + w.err = werr + w.mu.Unlock() + + // Closing either the read or write causes the entire pipe to close. + w.CloseWithError(werr) + case <-w.donec: + } +} + +// CloseWithError aborts the write operation with the provided error. +// CloseWithError always returns nil. +// +// Deprecated: cancel the context passed to NewWriter instead. +func (w *Writer) CloseWithError(err error) error { + if !w.opened { + return nil + } + return w.pw.CloseWithError(err) +} + +// Attrs returns metadata about a successfully-written object. +// It's only valid to call it after Close returns nil. +func (w *Writer) Attrs() *ObjectAttrs { + return w.obj +} diff --git a/vendor/cloud.google.com/go/storage/writer_test.go b/vendor/cloud.google.com/go/storage/writer_test.go new file mode 100644 index 000000000..7ac9b7ef5 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/writer_test.go @@ -0,0 +1,177 @@ +// 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 storage + +import ( + "context" + "crypto/sha256" + "encoding/base64" + "net/http" + "strings" + "testing" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/googleapi" + "google.golang.org/api/option" +) + +var testEncryptionKey = []byte("secret-key-that-is-32-bytes-long") + +func TestErrorOnObjectsInsertCall(t *testing.T) { + t.Parallel() + ctx := context.Background() + const contents = "hello world" + + doWrite := func(mt *mockTransport) *Writer { + client := mockClient(t, mt) + wc := client.Bucket("bucketname").Object("filename1").NewWriter(ctx) + wc.ContentType = "text/plain" + + // We can't check that the Write fails, since it depends on the write to the + // underling mockTransport failing which is racy. + wc.Write([]byte(contents)) + return wc + } + + wc := doWrite(&mockTransport{}) + // Close must always return an error though since it waits for the transport to + // have closed. + if err := wc.Close(); err == nil { + t.Errorf("expected error on close, got nil") + } + + // Retry on 5xx + mt := &mockTransport{} + mt.addResult(&http.Response{StatusCode: 503, Body: bodyReader("")}, nil) + mt.addResult(&http.Response{StatusCode: 200, Body: bodyReader("{}")}, nil) + + wc = doWrite(mt) + if err := wc.Close(); err != nil { + t.Errorf("got %v, want nil", err) + } + got := string(mt.gotBody) + if !strings.Contains(got, contents) { + t.Errorf("got body %q, which does not contain %q", got, contents) + } +} + +func TestEncryption(t *testing.T) { + t.Parallel() + ctx := context.Background() + mt := &mockTransport{} + mt.addResult(&http.Response{StatusCode: 200, Body: bodyReader("{}")}, nil) + client := mockClient(t, mt) + obj := client.Bucket("bucketname").Object("filename1") + wc := obj.Key(testEncryptionKey).NewWriter(ctx) + if _, err := wc.Write([]byte("hello world")); err != nil { + t.Fatal(err) + } + if err := wc.Close(); err != nil { + t.Fatal(err) + } + if got, want := mt.gotReq.Header.Get("x-goog-encryption-algorithm"), "AES256"; got != want { + t.Errorf("algorithm: got %q, want %q", got, want) + } + gotKey, err := base64.StdEncoding.DecodeString(mt.gotReq.Header.Get("x-goog-encryption-key")) + if err != nil { + t.Fatalf("decoding key: %v", err) + } + if !testutil.Equal(gotKey, testEncryptionKey) { + t.Errorf("key: got %v, want %v", gotKey, testEncryptionKey) + } + wantHash := sha256.Sum256(testEncryptionKey) + gotHash, err := base64.StdEncoding.DecodeString(mt.gotReq.Header.Get("x-goog-encryption-key-sha256")) + if err != nil { + t.Fatalf("decoding hash: %v", err) + } + if !testutil.Equal(gotHash, wantHash[:]) { // wantHash is an array + t.Errorf("hash: got\n%v, want\n%v", gotHash, wantHash) + } + + // Using a customer-supplied encryption key and a KMS key together is an error. + checkKMSError := func(msg string, err error) { + if err == nil { + t.Errorf("%s: got nil, want error", msg) + } else if !strings.Contains(err.Error(), "KMS") { + t.Errorf(`%s: got %q, want it to contain "KMS"`, msg, err) + } + } + + wc = obj.Key(testEncryptionKey).NewWriter(ctx) + wc.KMSKeyName = "key" + _, err = wc.Write([]byte{}) + checkKMSError("Write", err) + checkKMSError("Close", wc.Close()) +} + +// This test demonstrates the data race on Writer.err that can happen when the +// Writer's context is cancelled. To see the race, comment out the w.mu.Lock/Unlock +// lines in writer.go and run this test with -race. +func TestRaceOnCancel(t *testing.T) { + client := mockClient(t, &mockTransport{}) + cctx, cancel := context.WithCancel(context.Background()) + w := client.Bucket("b").Object("o").NewWriter(cctx) + w.ChunkSize = googleapi.MinUploadChunkSize + buf := make([]byte, w.ChunkSize) + // This Write starts the goroutine in Writer.open. That reads the first chunk in its entirety + // before sending the request (see google.golang.org/api/gensupport.PrepareUpload), + // so to exhibit the race we must provide ChunkSize bytes. The goroutine then makes the RPC (L137). + w.Write(buf) + // Canceling the context causes the call to return context.Canceled, which makes the open goroutine + // write to w.err (L151). + cancel() + // This call to Write concurrently reads w.err (L169). + w.Write([]byte(nil)) +} + +func TestCancelDoesNotLeak(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + const contents = "hello world" + mt := mockTransport{} + + client, err := NewClient(ctx, option.WithHTTPClient(&http.Client{Transport: &mt})) + if err != nil { + t.Fatal(err) + } + + wc := client.Bucket("bucketname").Object("filename1").NewWriter(ctx) + wc.ContentType = "text/plain" + + // We can't check that the Write fails, since it depends on the write to the + // underling mockTransport failing which is racy. + wc.Write([]byte(contents)) + + cancel() +} + +func TestCloseDoesNotLeak(t *testing.T) { + ctx := context.Background() + const contents = "hello world" + mt := mockTransport{} + + client, err := NewClient(ctx, option.WithHTTPClient(&http.Client{Transport: &mt})) + if err != nil { + t.Fatal(err) + } + + wc := client.Bucket("bucketname").Object("filename1").NewWriter(ctx) + wc.ContentType = "text/plain" + + // We can't check that the Write fails, since it depends on the write to the + // underling mockTransport failing which is racy. + wc.Write([]byte(contents)) + + wc.Close() +} diff --git a/vendor/cloud.google.com/go/texttospeech/apiv1/doc.go b/vendor/cloud.google.com/go/texttospeech/apiv1/doc.go new file mode 100644 index 000000000..6eb537572 --- /dev/null +++ b/vendor/cloud.google.com/go/texttospeech/apiv1/doc.go @@ -0,0 +1,90 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package texttospeech is an auto-generated package for the +// Cloud Text-to-Speech API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Synthesizes natural-sounding speech by applying powerful neural network +// models. +package texttospeech // import "cloud.google.com/go/texttospeech/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/texttospeech/apiv1/mock_test.go b/vendor/cloud.google.com/go/texttospeech/apiv1/mock_test.go new file mode 100644 index 000000000..b844387d9 --- /dev/null +++ b/vendor/cloud.google.com/go/texttospeech/apiv1/mock_test.go @@ -0,0 +1,232 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package texttospeech + +import ( + texttospeechpb "google.golang.org/genproto/googleapis/cloud/texttospeech/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockTextToSpeechServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + texttospeechpb.TextToSpeechServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockTextToSpeechServer) ListVoices(ctx context.Context, req *texttospeechpb.ListVoicesRequest) (*texttospeechpb.ListVoicesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*texttospeechpb.ListVoicesResponse), nil +} + +func (s *mockTextToSpeechServer) SynthesizeSpeech(ctx context.Context, req *texttospeechpb.SynthesizeSpeechRequest) (*texttospeechpb.SynthesizeSpeechResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*texttospeechpb.SynthesizeSpeechResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockTextToSpeech mockTextToSpeechServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + texttospeechpb.RegisterTextToSpeechServer(serv, &mockTextToSpeech) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestTextToSpeechListVoices(t *testing.T) { + var expectedResponse *texttospeechpb.ListVoicesResponse = &texttospeechpb.ListVoicesResponse{} + + mockTextToSpeech.err = nil + mockTextToSpeech.reqs = nil + + mockTextToSpeech.resps = append(mockTextToSpeech.resps[:0], expectedResponse) + + var request *texttospeechpb.ListVoicesRequest = &texttospeechpb.ListVoicesRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListVoices(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockTextToSpeech.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestTextToSpeechListVoicesError(t *testing.T) { + errCode := codes.PermissionDenied + mockTextToSpeech.err = gstatus.Error(errCode, "test error") + + var request *texttospeechpb.ListVoicesRequest = &texttospeechpb.ListVoicesRequest{} + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListVoices(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestTextToSpeechSynthesizeSpeech(t *testing.T) { + var audioContent []byte = []byte("16") + var expectedResponse = &texttospeechpb.SynthesizeSpeechResponse{ + AudioContent: audioContent, + } + + mockTextToSpeech.err = nil + mockTextToSpeech.reqs = nil + + mockTextToSpeech.resps = append(mockTextToSpeech.resps[:0], expectedResponse) + + var input *texttospeechpb.SynthesisInput = &texttospeechpb.SynthesisInput{} + var voice *texttospeechpb.VoiceSelectionParams = &texttospeechpb.VoiceSelectionParams{} + var audioConfig *texttospeechpb.AudioConfig = &texttospeechpb.AudioConfig{} + var request = &texttospeechpb.SynthesizeSpeechRequest{ + Input: input, + Voice: voice, + AudioConfig: audioConfig, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SynthesizeSpeech(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockTextToSpeech.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestTextToSpeechSynthesizeSpeechError(t *testing.T) { + errCode := codes.PermissionDenied + mockTextToSpeech.err = gstatus.Error(errCode, "test error") + + var input *texttospeechpb.SynthesisInput = &texttospeechpb.SynthesisInput{} + var voice *texttospeechpb.VoiceSelectionParams = &texttospeechpb.VoiceSelectionParams{} + var audioConfig *texttospeechpb.AudioConfig = &texttospeechpb.AudioConfig{} + var request = &texttospeechpb.SynthesizeSpeechRequest{ + Input: input, + Voice: voice, + AudioConfig: audioConfig, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.SynthesizeSpeech(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/texttospeech/apiv1/text_to_speech_client.go b/vendor/cloud.google.com/go/texttospeech/apiv1/text_to_speech_client.go new file mode 100644 index 000000000..00a9dd613 --- /dev/null +++ b/vendor/cloud.google.com/go/texttospeech/apiv1/text_to_speech_client.go @@ -0,0 +1,153 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package texttospeech + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + texttospeechpb "google.golang.org/genproto/googleapis/cloud/texttospeech/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + ListVoices []gax.CallOption + SynthesizeSpeech []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("texttospeech.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &CallOptions{ + ListVoices: retry[[2]string{"default", "idempotent"}], + SynthesizeSpeech: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Cloud Text-to-Speech API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client texttospeechpb.TextToSpeechClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new text to speech client. +// +// Service that implements Google Cloud Text-to-Speech API. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: texttospeechpb.NewTextToSpeechClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// ListVoices returns a list of [Voice][google.cloud.texttospeech.v1.Voice] +// supported for synthesis. +func (c *Client) ListVoices(ctx context.Context, req *texttospeechpb.ListVoicesRequest, opts ...gax.CallOption) (*texttospeechpb.ListVoicesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListVoices[0:len(c.CallOptions.ListVoices):len(c.CallOptions.ListVoices)], opts...) + var resp *texttospeechpb.ListVoicesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListVoices(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// SynthesizeSpeech synthesizes speech synchronously: receive results after all text input +// has been processed. +func (c *Client) SynthesizeSpeech(ctx context.Context, req *texttospeechpb.SynthesizeSpeechRequest, opts ...gax.CallOption) (*texttospeechpb.SynthesizeSpeechResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.SynthesizeSpeech[0:len(c.CallOptions.SynthesizeSpeech):len(c.CallOptions.SynthesizeSpeech)], opts...) + var resp *texttospeechpb.SynthesizeSpeechResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.SynthesizeSpeech(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/texttospeech/apiv1/text_to_speech_client_example_test.go b/vendor/cloud.google.com/go/texttospeech/apiv1/text_to_speech_client_example_test.go new file mode 100644 index 000000000..cf07511db --- /dev/null +++ b/vendor/cloud.google.com/go/texttospeech/apiv1/text_to_speech_client_example_test.go @@ -0,0 +1,70 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package texttospeech_test + +import ( + "context" + + texttospeech "cloud.google.com/go/texttospeech/apiv1" + texttospeechpb "google.golang.org/genproto/googleapis/cloud/texttospeech/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := texttospeech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_ListVoices() { + ctx := context.Background() + c, err := texttospeech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &texttospeechpb.ListVoicesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ListVoices(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_SynthesizeSpeech() { + ctx := context.Background() + c, err := texttospeech.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &texttospeechpb.SynthesizeSpeechRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SynthesizeSpeech(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/trace/apiv1/ListTraces_smoke_test.go b/vendor/cloud.google.com/go/trace/apiv1/ListTraces_smoke_test.go new file mode 100644 index 000000000..76ed35801 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv1/ListTraces_smoke_test.go @@ -0,0 +1,67 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package trace + +import ( + cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestTraceServiceSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var projectId2 string = projectId + var request = &cloudtracepb.ListTracesRequest{ + ProjectId: projectId2, + } + + iter := c.ListTraces(ctx, request) + if _, err := iter.Next(); err != nil && err != iterator.Done { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/trace/apiv1/doc.go b/vendor/cloud.google.com/go/trace/apiv1/doc.go new file mode 100644 index 000000000..005df208a --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv1/doc.go @@ -0,0 +1,97 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package trace is an auto-generated package for the +// Stackdriver Trace API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Sends application trace data to Stackdriver Trace for viewing. Trace data +// is +// collected for all App Engine applications by default. Trace data from +// other +// applications can be provided using this API. +// +// Use the client at cloud.google.com/go/trace in preference to this. +package trace // import "cloud.google.com/go/trace/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/trace.append", + "https://www.googleapis.com/auth/trace.readonly", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/trace/apiv1/mock_test.go b/vendor/cloud.google.com/go/trace/apiv1/mock_test.go new file mode 100644 index 000000000..d42f75b51 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv1/mock_test.go @@ -0,0 +1,321 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package trace + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockTraceServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + cloudtracepb.TraceServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockTraceServer) ListTraces(ctx context.Context, req *cloudtracepb.ListTracesRequest) (*cloudtracepb.ListTracesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*cloudtracepb.ListTracesResponse), nil +} + +func (s *mockTraceServer) GetTrace(ctx context.Context, req *cloudtracepb.GetTraceRequest) (*cloudtracepb.Trace, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*cloudtracepb.Trace), nil +} + +func (s *mockTraceServer) PatchTraces(ctx context.Context, req *cloudtracepb.PatchTracesRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockTrace mockTraceServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + cloudtracepb.RegisterTraceServiceServer(serv, &mockTrace) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestTraceServicePatchTraces(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockTrace.err = nil + mockTrace.reqs = nil + + mockTrace.resps = append(mockTrace.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var traces *cloudtracepb.Traces = &cloudtracepb.Traces{} + var request = &cloudtracepb.PatchTracesRequest{ + ProjectId: projectId, + Traces: traces, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.PatchTraces(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockTrace.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestTraceServicePatchTracesError(t *testing.T) { + errCode := codes.PermissionDenied + mockTrace.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var traces *cloudtracepb.Traces = &cloudtracepb.Traces{} + var request = &cloudtracepb.PatchTracesRequest{ + ProjectId: projectId, + Traces: traces, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.PatchTraces(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestTraceServiceGetTrace(t *testing.T) { + var projectId2 string = "projectId2939242356" + var traceId2 string = "traceId2987826376" + var expectedResponse = &cloudtracepb.Trace{ + ProjectId: projectId2, + TraceId: traceId2, + } + + mockTrace.err = nil + mockTrace.reqs = nil + + mockTrace.resps = append(mockTrace.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var traceId string = "traceId1270300245" + var request = &cloudtracepb.GetTraceRequest{ + ProjectId: projectId, + TraceId: traceId, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTrace(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockTrace.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestTraceServiceGetTraceError(t *testing.T) { + errCode := codes.PermissionDenied + mockTrace.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var traceId string = "traceId1270300245" + var request = &cloudtracepb.GetTraceRequest{ + ProjectId: projectId, + TraceId: traceId, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetTrace(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestTraceServiceListTraces(t *testing.T) { + var nextPageToken string = "" + var tracesElement *cloudtracepb.Trace = &cloudtracepb.Trace{} + var traces = []*cloudtracepb.Trace{tracesElement} + var expectedResponse = &cloudtracepb.ListTracesResponse{ + NextPageToken: nextPageToken, + Traces: traces, + } + + mockTrace.err = nil + mockTrace.reqs = nil + + mockTrace.resps = append(mockTrace.resps[:0], expectedResponse) + + var projectId string = "projectId-1969970175" + var request = &cloudtracepb.ListTracesRequest{ + ProjectId: projectId, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTraces(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockTrace.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Traces[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestTraceServiceListTracesError(t *testing.T) { + errCode := codes.PermissionDenied + mockTrace.err = gstatus.Error(errCode, "test error") + + var projectId string = "projectId-1969970175" + var request = &cloudtracepb.ListTracesRequest{ + ProjectId: projectId, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListTraces(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/trace/apiv1/trace_client.go b/vendor/cloud.google.com/go/trace/apiv1/trace_client.go new file mode 100644 index 000000000..73d654eb2 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv1/trace_client.go @@ -0,0 +1,239 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package trace + +import ( + "context" + "math" + "time" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + PatchTraces []gax.CallOption + GetTrace []gax.CallOption + ListTraces []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cloudtrace.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 1000 * time.Millisecond, + Multiplier: 1.2, + }) + }), + }, + } + return &CallOptions{ + PatchTraces: retry[[2]string{"default", "idempotent"}], + GetTrace: retry[[2]string{"default", "idempotent"}], + ListTraces: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Stackdriver Trace API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client cloudtracepb.TraceServiceClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new trace service client. +// +// This file describes an API for collecting and viewing traces and spans +// within a trace. A Trace is a collection of spans corresponding to a single +// operation or set of operations for an application. A span is an individual +// timed event which forms a node of the trace tree. Spans for a single trace +// may span multiple services. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: cloudtracepb.NewTraceServiceClient(conn), + } + c.SetGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// SetGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) SetGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// PatchTraces sends new traces to Stackdriver Trace or updates existing traces. If the ID +// of a trace that you send matches that of an existing trace, any fields +// in the existing trace and its spans are overwritten by the provided values, +// and any new fields provided are merged with the existing trace data. If the +// ID does not match, a new trace is created. +func (c *Client) PatchTraces(ctx context.Context, req *cloudtracepb.PatchTracesRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.PatchTraces[0:len(c.CallOptions.PatchTraces):len(c.CallOptions.PatchTraces)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.PatchTraces(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// GetTrace gets a single trace by its ID. +func (c *Client) GetTrace(ctx context.Context, req *cloudtracepb.GetTraceRequest, opts ...gax.CallOption) (*cloudtracepb.Trace, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetTrace[0:len(c.CallOptions.GetTrace):len(c.CallOptions.GetTrace)], opts...) + var resp *cloudtracepb.Trace + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetTrace(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListTraces returns of a list of traces that match the specified filter conditions. +func (c *Client) ListTraces(ctx context.Context, req *cloudtracepb.ListTracesRequest, opts ...gax.CallOption) *TraceIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListTraces[0:len(c.CallOptions.ListTraces):len(c.CallOptions.ListTraces)], opts...) + it := &TraceIterator{} + req = proto.Clone(req).(*cloudtracepb.ListTracesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*cloudtracepb.Trace, string, error) { + var resp *cloudtracepb.ListTracesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListTraces(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Traces, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// TraceIterator manages a stream of *cloudtracepb.Trace. +type TraceIterator struct { + items []*cloudtracepb.Trace + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*cloudtracepb.Trace, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TraceIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *TraceIterator) Next() (*cloudtracepb.Trace, error) { + var item *cloudtracepb.Trace + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TraceIterator) bufLen() int { + return len(it.items) +} + +func (it *TraceIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/vendor/cloud.google.com/go/trace/apiv1/trace_client_example_test.go b/vendor/cloud.google.com/go/trace/apiv1/trace_client_example_test.go new file mode 100644 index 000000000..98b134c11 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv1/trace_client_example_test.go @@ -0,0 +1,93 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package trace_test + +import ( + "context" + + trace "cloud.google.com/go/trace/apiv1" + "google.golang.org/api/iterator" + cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := trace.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_PatchTraces() { + ctx := context.Background() + c, err := trace.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &cloudtracepb.PatchTracesRequest{ + // TODO: Fill request struct fields. + } + err = c.PatchTraces(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_GetTrace() { + ctx := context.Background() + c, err := trace.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &cloudtracepb.GetTraceRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTrace(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListTraces() { + ctx := context.Background() + c, err := trace.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &cloudtracepb.ListTracesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTraces(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} diff --git a/vendor/cloud.google.com/go/trace/apiv2/BatchWriteSpans_smoke_test.go b/vendor/cloud.google.com/go/trace/apiv2/BatchWriteSpans_smoke_test.go new file mode 100644 index 000000000..9c1438580 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv2/BatchWriteSpans_smoke_test.go @@ -0,0 +1,66 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package trace + +import ( + cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestTraceServiceSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var formattedName string = fmt.Sprintf("projects/%s", projectId) + var request = &cloudtracepb.BatchWriteSpansRequest{ + Name: formattedName, + } + + if err := c.BatchWriteSpans(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/trace/apiv2/doc.go b/vendor/cloud.google.com/go/trace/apiv2/doc.go new file mode 100644 index 000000000..553d9de74 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv2/doc.go @@ -0,0 +1,94 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package trace is an auto-generated package for the +// Stackdriver Trace API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Sends application trace data to Stackdriver Trace for viewing. Trace data +// is +// collected for all App Engine applications by default. Trace data from +// other +// applications can be provided using this API. +package trace // import "cloud.google.com/go/trace/apiv2" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/trace.append", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/trace/apiv2/mock_test.go b/vendor/cloud.google.com/go/trace/apiv2/mock_test.go new file mode 100644 index 000000000..b1e430dc4 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv2/mock_test.go @@ -0,0 +1,252 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package trace + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + timestamppb "github.com/golang/protobuf/ptypes/timestamp" + cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockTraceServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + cloudtracepb.TraceServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockTraceServer) BatchWriteSpans(ctx context.Context, req *cloudtracepb.BatchWriteSpansRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockTraceServer) CreateSpan(ctx context.Context, req *cloudtracepb.Span) (*cloudtracepb.Span, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*cloudtracepb.Span), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockTrace mockTraceServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + cloudtracepb.RegisterTraceServiceServer(serv, &mockTrace) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestTraceServiceBatchWriteSpans(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockTrace.err = nil + mockTrace.reqs = nil + + mockTrace.resps = append(mockTrace.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var spans []*cloudtracepb.Span = nil + var request = &cloudtracepb.BatchWriteSpansRequest{ + Name: formattedName, + Spans: spans, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.BatchWriteSpans(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockTrace.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestTraceServiceBatchWriteSpansError(t *testing.T) { + errCode := codes.PermissionDenied + mockTrace.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s", "[PROJECT]") + var spans []*cloudtracepb.Span = nil + var request = &cloudtracepb.BatchWriteSpansRequest{ + Name: formattedName, + Spans: spans, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.BatchWriteSpans(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestTraceServiceCreateSpan(t *testing.T) { + var name2 string = "name2-1052831874" + var spanId2 string = "spanId2-643891741" + var parentSpanId string = "parentSpanId-1757797477" + var expectedResponse = &cloudtracepb.Span{ + Name: name2, + SpanId: spanId2, + ParentSpanId: parentSpanId, + } + + mockTrace.err = nil + mockTrace.reqs = nil + + mockTrace.resps = append(mockTrace.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/traces/%s/spans/%s", "[PROJECT]", "[TRACE]", "[SPAN]") + var spanId string = "spanId-2011840976" + var displayName *cloudtracepb.TruncatableString = &cloudtracepb.TruncatableString{} + var startTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var endTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &cloudtracepb.Span{ + Name: formattedName, + SpanId: spanId, + DisplayName: displayName, + StartTime: startTime, + EndTime: endTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSpan(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockTrace.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestTraceServiceCreateSpanError(t *testing.T) { + errCode := codes.PermissionDenied + mockTrace.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/traces/%s/spans/%s", "[PROJECT]", "[TRACE]", "[SPAN]") + var spanId string = "spanId-2011840976" + var displayName *cloudtracepb.TruncatableString = &cloudtracepb.TruncatableString{} + var startTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var endTime *timestamppb.Timestamp = ×tamppb.Timestamp{} + var request = &cloudtracepb.Span{ + Name: formattedName, + SpanId: spanId, + DisplayName: displayName, + StartTime: startTime, + EndTime: endTime, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateSpan(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/trace/apiv2/path_funcs.go b/vendor/cloud.google.com/go/trace/apiv2/path_funcs.go new file mode 100644 index 000000000..80b8d40b5 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv2/path_funcs.go @@ -0,0 +1,43 @@ +// 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 +// +// https://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 trace + +// ProjectPath returns the path for the project resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s", project) +// instead. +func ProjectPath(project string) string { + return "" + + "projects/" + + project + + "" +} + +// SpanPath returns the path for the span resource. +// +// Deprecated: Use +// fmt.Sprintf("projects/%s/traces/%s/spans/%s", project, trace, span) +// instead. +func SpanPath(project, trace, span string) string { + return "" + + "projects/" + + project + + "/traces/" + + trace + + "/spans/" + + span + + "" +} diff --git a/vendor/cloud.google.com/go/trace/apiv2/trace_client.go b/vendor/cloud.google.com/go/trace/apiv2/trace_client.go new file mode 100644 index 000000000..1581d6721 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv2/trace_client.go @@ -0,0 +1,152 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package trace + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + BatchWriteSpans []gax.CallOption + CreateSpan []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("cloudtrace.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 1000 * time.Millisecond, + Multiplier: 1.2, + }) + }), + }, + } + return &CallOptions{ + BatchWriteSpans: retry[[2]string{"default", "non_idempotent"}], + CreateSpan: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Stackdriver Trace API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client cloudtracepb.TraceServiceClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new trace service client. +// +// This file describes an API for collecting and viewing traces and spans +// within a trace. A Trace is a collection of spans corresponding to a single +// operation or set of operations for an application. A span is an individual +// timed event which forms a node of the trace tree. A single trace may +// contain span(s) from multiple services. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: cloudtracepb.NewTraceServiceClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// BatchWriteSpans sends new spans to new or existing traces. You cannot update +// existing spans. +func (c *Client) BatchWriteSpans(ctx context.Context, req *cloudtracepb.BatchWriteSpansRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchWriteSpans[0:len(c.CallOptions.BatchWriteSpans):len(c.CallOptions.BatchWriteSpans)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.BatchWriteSpans(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// CreateSpan creates a new span. +func (c *Client) CreateSpan(ctx context.Context, req *cloudtracepb.Span, opts ...gax.CallOption) (*cloudtracepb.Span, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateSpan[0:len(c.CallOptions.CreateSpan):len(c.CallOptions.CreateSpan)], opts...) + var resp *cloudtracepb.Span + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateSpan(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/trace/apiv2/trace_client_example_test.go b/vendor/cloud.google.com/go/trace/apiv2/trace_client_example_test.go new file mode 100644 index 000000000..ae2413ec3 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/apiv2/trace_client_example_test.go @@ -0,0 +1,68 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package trace_test + +import ( + "context" + + trace "cloud.google.com/go/trace/apiv2" + cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := trace.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_BatchWriteSpans() { + ctx := context.Background() + c, err := trace.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &cloudtracepb.BatchWriteSpansRequest{ + // TODO: Fill request struct fields. + } + err = c.BatchWriteSpans(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_CreateSpan() { + ctx := context.Background() + c, err := trace.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &cloudtracepb.Span{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateSpan(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/trace/grpc.go b/vendor/cloud.google.com/go/trace/grpc.go new file mode 100644 index 000000000..e7c003106 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/grpc.go @@ -0,0 +1,111 @@ +// Copyright 2017 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 trace + +import ( + "context" + "encoding/hex" + "fmt" + + "cloud.google.com/go/internal/tracecontext" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +const grpcMetadataKey = "grpc-trace-bin" + +// GRPCClientInterceptor returns a grpc.UnaryClientInterceptor that traces all outgoing requests from a gRPC client. +// The calling context should already have a *trace.Span; a child span will be +// created for the outgoing gRPC call. If the calling context doesn't have a span, +// the call will not be traced. If the client is nil, then the interceptor just +// passes through the request. +// +// The functionality in gRPC that this feature relies on is currently experimental. +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (c *Client) GRPCClientInterceptor() grpc.UnaryClientInterceptor { + if c == nil { + return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + return invoker(ctx, method, req, reply, cc, opts...) + } + } + return grpc.UnaryClientInterceptor(c.grpcUnaryInterceptor) +} + +func (c *Client) grpcUnaryInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + // TODO: also intercept streams. + span := FromContext(ctx).NewChild(method) + if span == nil { + span = c.NewSpan(method) + } + defer span.Finish() + + traceContext := make([]byte, tracecontext.Len) + // traceID is a hex-encoded 128-bit value. + // TODO(jbd): Decode trace IDs upon arrival and + // represent trace IDs with 16 bytes internally. + tid, err := hex.DecodeString(span.trace.traceID) + if err != nil { + return invoker(ctx, method, req, reply, cc, opts...) + } + tracecontext.Encode(traceContext, tid, span.span.SpanId, byte(span.trace.globalOptions)) + md, ok := metadata.FromOutgoingContext(ctx) + if !ok { + md = metadata.Pairs(grpcMetadataKey, string(traceContext)) + } else { + md = md.Copy() // metadata is immutable, copy. + md[grpcMetadataKey] = []string{string(traceContext)} + } + ctx = metadata.NewOutgoingContext(ctx, md) + + err = invoker(ctx, method, req, reply, cc, opts...) + if err != nil { + // TODO: standardize gRPC label names? + span.SetLabel("error", err.Error()) + } + return err +} + +// GRPCServerInterceptor returns a grpc.UnaryServerInterceptor that enables the tracing of the incoming +// gRPC calls. Incoming call's context can be used to extract the span on servers that enabled this option: +// +// span := trace.FromContext(ctx) +// +// If the client is nil, then the interceptor just invokes the handler. +// +// The functionality in gRPC that this feature relies on is currently experimental. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (c *Client) GRPCServerInterceptor() grpc.UnaryServerInterceptor { + if c == nil { + return func(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { + return handler(ctx, req) + } + } + return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { + md, _ := metadata.FromIncomingContext(ctx) + var traceHeader string + if header, ok := md[grpcMetadataKey]; ok { + traceID, spanID, opts, ok := tracecontext.Decode([]byte(header[0])) + if ok { + // TODO(jbd): Generate a span directly from string(traceID), spanID and opts. + traceHeader = fmt.Sprintf("%x/%d;o=%d", traceID, spanID, opts) + } + } + span := c.SpanFromHeader(info.FullMethod, traceHeader) + defer span.Finish() + ctx = NewContext(ctx, span) + return handler(ctx, req) + } +} diff --git a/vendor/cloud.google.com/go/trace/grpc_test.go b/vendor/cloud.google.com/go/trace/grpc_test.go new file mode 100644 index 000000000..51ba2ed5d --- /dev/null +++ b/vendor/cloud.google.com/go/trace/grpc_test.go @@ -0,0 +1,180 @@ +// Copyright 2017 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 trace + +import ( + "context" + "io/ioutil" + "log" + "net" + "net/http" + "strings" + "testing" + + pb "cloud.google.com/go/trace/testdata/helloworld" + "google.golang.org/grpc" +) + +func TestGRPCInterceptors(t *testing.T) { + t.Skip("hangs forever for go < 1.9") + + tc := newTestClient(&noopTransport{}) + + // default sampling with global=1. + parent := tc.SpanFromHeader("parent", "7f27601f17b7a2873739efd18ff83872/123;o=1") + testGRPCInterceptor(t, tc, parent, func(t *testing.T, out, in *Span) { + if in == nil { + t.Fatalf("missing span in the incoming context") + } + if got, want := in.TraceID(), out.TraceID(); got != want { + t.Errorf("incoming call is not tracing the outgoing trace; TraceID = %q; want %q", got, want) + } + if !in.Traced() { + t.Errorf("incoming span is not traced; want traced") + } + }) + + // default sampling with global=0. + parent = tc.SpanFromHeader("parent", "7f27601f17b7a2873739efd18ff83872/123;o=0") + testGRPCInterceptor(t, tc, parent, func(t *testing.T, out, in *Span) { + if in == nil { + t.Fatalf("missing span in the incoming context") + } + if got, want := in.TraceID(), out.TraceID(); got != want { + t.Errorf("incoming call is not tracing the outgoing trace; TraceID = %q; want %q", got, want) + } + if in.Traced() { + t.Errorf("incoming span is traced; want not traced") + } + }) + + // sampling all with global=1. + all, _ := NewLimitedSampler(1.0, 1<<32) + tc.SetSamplingPolicy(all) + parent = tc.SpanFromHeader("parent", "7f27601f17b7a2873739efd18ff83872/123;o=1") + testGRPCInterceptor(t, tc, parent, func(t *testing.T, out, in *Span) { + if in == nil { + t.Fatalf("missing span in the incoming context") + } + if got, want := in.TraceID(), out.TraceID(); got != want { + t.Errorf("incoming call is not tracing the outgoing trace; TraceID = %q; want %q", got, want) + } + if !in.Traced() { + t.Errorf("incoming span is not traced; want traced") + } + }) + + // sampling none with global=1. + none, _ := NewLimitedSampler(0, 0) + tc.SetSamplingPolicy(none) + parent = tc.SpanFromHeader("parent", "7f27601f17b7a2873739efd18ff83872/123;o=1") + testGRPCInterceptor(t, tc, parent, func(t *testing.T, out, in *Span) { + if in == nil { + t.Fatalf("missing span in the incoming context") + } + if got, want := in.TraceID(), out.TraceID(); got != want { + t.Errorf("incoming call is not tracing the outgoing trace; TraceID = %q; want %q", got, want) + } + if in.Traced() { + t.Errorf("incoming span is traced; want not traced") + } + }) + + // sampling all with no parent span. + tc.SetSamplingPolicy(all) + testGRPCInterceptor(t, tc, nil, func(t *testing.T, out, in *Span) { + if in == nil { + t.Fatalf("missing span in the incoming context") + } + if in.TraceID() == "" { + t.Errorf("incoming call TraceID is empty") + } + if !in.Traced() { + t.Errorf("incoming span is not traced; want traced") + } + }) + + // sampling none with no parent span. + tc.SetSamplingPolicy(none) + testGRPCInterceptor(t, tc, nil, func(t *testing.T, out, in *Span) { + if in == nil { + t.Fatalf("missing span in the incoming context") + } + if in.TraceID() == "" { + t.Errorf("incoming call TraceID is empty") + } + if in.Traced() { + t.Errorf("incoming span is traced; want not traced") + } + }) +} + +func testGRPCInterceptor(t *testing.T, tc *Client, parent *Span, assert func(t *testing.T, out, in *Span)) { + incomingCh := make(chan *Span, 1) + addrCh := make(chan net.Addr, 1) + go func() { + lis, err := net.Listen("tcp", "") + if err != nil { + t.Errorf("Failed to listen: %v", err) + } + addrCh <- lis.Addr() + + s := grpc.NewServer(grpc.UnaryInterceptor(tc.GRPCServerInterceptor())) + pb.RegisterGreeterServer(s, &grpcServer{ + fn: func(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) { + incomingCh <- FromContext(ctx) + return &pb.HelloReply{}, nil + }, + }) + if err := s.Serve(lis); err != nil { + t.Errorf("Failed to serve: %v", err) + } + }() + + addr := <-addrCh + conn, err := grpc.Dial(addr.String(), grpc.WithInsecure(), grpc.WithBlock(), grpc.WithUnaryInterceptor(tc.GRPCClientInterceptor())) + if err != nil { + t.Fatalf("Did not connect: %v", err) + } + defer conn.Close() + c := pb.NewGreeterClient(conn) + + outgoingCtx := NewContext(context.Background(), parent) + _, err = c.SayHello(outgoingCtx, &pb.HelloRequest{}) + if err != nil { + log.Fatalf("Could not SayHello: %v", err) + } + + assert(t, parent, <-incomingCh) +} + +type noopTransport struct{} + +func (rt *noopTransport) RoundTrip(req *http.Request) (*http.Response, error) { + resp := &http.Response{ + Status: "200 OK", + StatusCode: 200, + Body: ioutil.NopCloser(strings.NewReader("{}")), + } + return resp, nil +} + +type grpcServer struct { + fn func(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) +} + +func (s *grpcServer) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) { + return s.fn(ctx, in) +} diff --git a/vendor/cloud.google.com/go/trace/http.go b/vendor/cloud.google.com/go/trace/http.go new file mode 100644 index 000000000..6a64465ab --- /dev/null +++ b/vendor/cloud.google.com/go/trace/http.go @@ -0,0 +1,114 @@ +// Copyright 2017 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 trace + +import ( + "net/http" +) + +// Transport is an http.RoundTripper that traces the outgoing requests. +// +// Transport is safe for concurrent usage. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +type Transport struct { + // Base is the base http.RoundTripper to be used to do the actual request. + // + // Optional. If nil, http.DefaultTransport is used. + Base http.RoundTripper +} + +// RoundTrip creates a trace.Span and inserts it into the outgoing request's headers. +// The created span can follow a parent span, if a parent is presented in +// the request's context. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (t Transport) RoundTrip(req *http.Request) (*http.Response, error) { + span := FromContext(req.Context()).NewRemoteChild(req) + resp, err := t.base().RoundTrip(req) + + // TODO(jbd): Is it possible to defer the span.Finish? + // In cases where RoundTrip panics, we still can finish the span. + span.Finish(WithResponse(resp)) + return resp, err +} + +// CancelRequest cancels an in-flight request by closing its connection. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (t Transport) CancelRequest(req *http.Request) { + type canceler interface { + CancelRequest(*http.Request) + } + if cr, ok := t.base().(canceler); ok { + cr.CancelRequest(req) + } +} + +func (t Transport) base() http.RoundTripper { + if t.Base != nil { + return t.Base + } + return http.DefaultTransport +} + +// HTTPHandler returns a http.Handler from the given handler +// that is aware of the incoming request's span. +// The span can be extracted from the incoming request in handler +// functions from incoming request's context: +// +// span := trace.FromContext(r.Context()) +// +// The span will be auto finished by the handler. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (c *Client) HTTPHandler(h http.Handler) http.Handler { + if c == nil { + return h + } + return &handler{traceClient: c, handler: h} +} + +type handler struct { + traceClient *Client + handler http.Handler +} + +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + traceID, parentSpanID, options, optionsOk, ok := traceInfoFromHeader(r.Header.Get(httpHeader)) + if !ok { + traceID = nextTraceID() + } + t := &trace{ + traceID: traceID, + client: h.traceClient, + globalOptions: options, + localOptions: options, + } + span := startNewChildWithRequest(r, t, parentSpanID) + span.span.Kind = spanKindServer + span.rootSpan = true + configureSpanFromPolicy(span, h.traceClient.policy, ok) + defer span.Finish() + + r = r.WithContext(NewContext(r.Context(), span)) + if ok && !optionsOk { + // Inject the trace context back to the response with the sampling options. + // TODO(jbd): Remove when there is a better way to report the client's sampling. + w.Header().Set(httpHeader, spanHeader(traceID, parentSpanID, span.trace.localOptions)) + } + h.handler.ServeHTTP(w, r) +} diff --git a/vendor/cloud.google.com/go/trace/http_test.go b/vendor/cloud.google.com/go/trace/http_test.go new file mode 100644 index 000000000..93cc1b096 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/http_test.go @@ -0,0 +1,149 @@ +// Copyright 2017 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 trace + +import ( + "io/ioutil" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +type recorderTransport struct { + ch chan *http.Request +} + +func (rt *recorderTransport) RoundTrip(req *http.Request) (*http.Response, error) { + rt.ch <- req + resp := &http.Response{ + Status: "200 OK", + StatusCode: 200, + Body: ioutil.NopCloser(strings.NewReader("{}")), + } + return resp, nil +} + +func TestNewHTTPClient(t *testing.T) { + rt := &recorderTransport{ + ch: make(chan *http.Request, 1), + } + + tc := newTestClient(&noopTransport{}) + client := &http.Client{ + Transport: &Transport{ + Base: rt, + }, + } + req, _ := http.NewRequest("GET", "http://example.com", nil) + + t.Run("NoTrace", func(t *testing.T) { + _, err := client.Do(req) + if err != nil { + t.Error(err) + } + outgoing := <-rt.ch + if got, want := outgoing.Header.Get(httpHeader), ""; want != got { + t.Errorf("got trace header = %q; want none", got) + } + }) + + t.Run("Trace", func(t *testing.T) { + span := tc.NewSpan("/foo") + + req = req.WithContext(NewContext(req.Context(), span)) + _, err := client.Do(req) + if err != nil { + t.Error(err) + } + outgoing := <-rt.ch + + s := tc.SpanFromHeader("/foo", outgoing.Header.Get(httpHeader)) + if got, want := s.TraceID(), span.TraceID(); got != want { + t.Errorf("trace ID = %q; want %q", got, want) + } + }) +} + +func TestHTTPHandlerNoTrace(t *testing.T) { + tc := newTestClient(&noopTransport{}) + client := &http.Client{ + Transport: &Transport{}, + } + handler := tc.HTTPHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + span := FromContext(r.Context()) + if span == nil { + t.Errorf("span is nil; want non-nil span") + } + })) + + ts := httptest.NewServer(handler) + defer ts.Close() + + req, _ := http.NewRequest("GET", ts.URL, nil) + _, err := client.Do(req) + if err != nil { + t.Fatal(err) + } +} + +func TestHTTPHandler_response(t *testing.T) { + tc := newTestClient(&noopTransport{}) + p, _ := NewLimitedSampler(1, 1<<32) // all + tc.SetSamplingPolicy(p) + handler := tc.HTTPHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) + ts := httptest.NewServer(handler) + defer ts.Close() + + tests := []struct { + name string + traceHeader string + wantTraceHeader string + }{ + { + name: "no global", + traceHeader: "0123456789ABCDEF0123456789ABCDEF/123", + wantTraceHeader: "0123456789ABCDEF0123456789ABCDEF/123;o=1", + }, + { + name: "global=1", + traceHeader: "0123456789ABCDEF0123456789ABCDEF/123;o=1", + wantTraceHeader: "", + }, + { + name: "global=0", + traceHeader: "0123456789ABCDEF0123456789ABCDEF/123;o=0", + wantTraceHeader: "", + }, + { + name: "no trace context", + traceHeader: "", + wantTraceHeader: "", + }, + } + + for _, tt := range tests { + req, _ := http.NewRequest("GET", ts.URL, nil) + req.Header.Set(httpHeader, tt.traceHeader) + + res, err := http.DefaultClient.Do(req) + if err != nil { + t.Errorf("failed to request: %v", err) + } + if got, want := res.Header.Get(httpHeader), tt.wantTraceHeader; got != want { + t.Errorf("%v: response context header = %q; want %q", tt.name, got, want) + } + } +} diff --git a/vendor/cloud.google.com/go/trace/httpexample_test.go b/vendor/cloud.google.com/go/trace/httpexample_test.go new file mode 100644 index 000000000..2af4ead66 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/httpexample_test.go @@ -0,0 +1,55 @@ +// Copyright 2017 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 trace_test + +import ( + "log" + "net/http" + + "cloud.google.com/go/trace" +) + +var traceClient *trace.Client + +func ExampleHTTPClient_Do() { + client := http.Client{ + Transport: &trace.Transport{}, + } + span := traceClient.NewSpan("/foo") // traceClient is a *trace.Client + + req, _ := http.NewRequest("GET", "https://metadata/users", nil) + req = req.WithContext(trace.NewContext(req.Context(), span)) + + if _, err := client.Do(req); err != nil { + log.Fatal(err) + } +} + +func ExampleClient_HTTPHandler() { + handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + client := http.Client{ + Transport: &trace.Transport{}, + } + + req, _ := http.NewRequest("GET", "https://metadata/users", nil) + req = req.WithContext(r.Context()) + + // The outgoing request will be traced with r's trace ID. + if _, err := client.Do(req); err != nil { + log.Fatal(err) + } + }) + http.Handle("/foo", traceClient.HTTPHandler(handler)) // traceClient is a *trace.Client +} diff --git a/vendor/cloud.google.com/go/trace/sampling.go b/vendor/cloud.google.com/go/trace/sampling.go new file mode 100644 index 000000000..802144b2b --- /dev/null +++ b/vendor/cloud.google.com/go/trace/sampling.go @@ -0,0 +1,127 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace + +import ( + crand "crypto/rand" + "encoding/binary" + "fmt" + "math/rand" + "sync" + "time" + + "golang.org/x/time/rate" +) + +// SamplingPolicy provides an interface for sampling. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +type SamplingPolicy interface { + // Sample returns a Decision. + // If Trace is false in the returned Decision, then the Decision should be + // the zero value. + Sample(p Parameters) Decision +} + +// Parameters contains the values passed to a SamplingPolicy's Sample method. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +type Parameters struct { + HasTraceHeader bool // whether the incoming request has a valid X-Cloud-Trace-Context header. +} + +// Decision is the value returned by a call to a SamplingPolicy's Sample method. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +type Decision struct { + Trace bool // Whether to trace the request. + Sample bool // Whether the trace is included in the random sample. + Policy string // Name of the sampling policy. + Weight float64 // Sample weight to be used in statistical calculations. +} + +type sampler struct { + fraction float64 + skipped float64 + *rate.Limiter + *rand.Rand + sync.Mutex +} + +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (s *sampler) Sample(p Parameters) Decision { + s.Lock() + x := s.Float64() + d := s.sample(p, time.Now(), x) + s.Unlock() + return d +} + +// sample contains the a deterministic, time-independent logic of Sample. +func (s *sampler) sample(p Parameters, now time.Time, x float64) (d Decision) { + d.Sample = x < s.fraction + d.Trace = p.HasTraceHeader || d.Sample + if !d.Trace { + // We have no reason to trace this request. + return Decision{} + } + // We test separately that the rate limit is not tiny before calling AllowN, + // because of overflow problems in x/time/rate. + if s.Limit() < 1e-9 || !s.AllowN(now, 1) { + // Rejected by the rate limit. + if d.Sample { + s.skipped++ + } + return Decision{} + } + if d.Sample { + d.Policy, d.Weight = "default", (1.0+s.skipped)/s.fraction + s.skipped = 0.0 + } + return +} + +// NewLimitedSampler returns a sampling policy that randomly samples a given +// fraction of requests. It also enforces a limit on the number of traces per +// second. It tries to trace every request with a trace header, but will not +// exceed the qps limit to do it. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func NewLimitedSampler(fraction, maxqps float64) (SamplingPolicy, error) { + if !(fraction >= 0) { + return nil, fmt.Errorf("invalid fraction %f", fraction) + } + if !(maxqps >= 0) { + return nil, fmt.Errorf("invalid maxqps %f", maxqps) + } + // Set a limit on the number of accumulated "tokens", to limit bursts of + // traced requests. Use one more than a second's worth of tokens, or 100, + // whichever is smaller. + // See https://godoc.org/golang.org/x/time/rate#NewLimiter. + maxTokens := 100 + if maxqps < 99.0 { + maxTokens = 1 + int(maxqps) + } + var seed int64 + if err := binary.Read(crand.Reader, binary.LittleEndian, &seed); err != nil { + seed = time.Now().UnixNano() + } + s := sampler{ + fraction: fraction, + Limiter: rate.NewLimiter(rate.Limit(maxqps), maxTokens), + Rand: rand.New(rand.NewSource(seed)), + } + return &s, nil +} diff --git a/vendor/cloud.google.com/go/trace/testdata/helloworld/helloworld.pb.go b/vendor/cloud.google.com/go/trace/testdata/helloworld/helloworld.pb.go new file mode 100644 index 000000000..2ece7a510 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/testdata/helloworld/helloworld.pb.go @@ -0,0 +1,162 @@ +// Copyright 2017 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 helloworld is a generated protocol buffer package. + +It is generated from these files: + helloworld.proto + +It has these top-level messages: + HelloRequest + HelloReply +*/ +package helloworld + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + "context" + + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// The request message containing the user's name. +type HelloRequest struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *HelloRequest) Reset() { *m = HelloRequest{} } +func (m *HelloRequest) String() string { return proto.CompactTextString(m) } +func (*HelloRequest) ProtoMessage() {} +func (*HelloRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +// The response message containing the greetings +type HelloReply struct { + Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` +} + +func (m *HelloReply) Reset() { *m = HelloReply{} } +func (m *HelloReply) String() string { return proto.CompactTextString(m) } +func (*HelloReply) ProtoMessage() {} +func (*HelloReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func init() { + proto.RegisterType((*HelloRequest)(nil), "helloworld.HelloRequest") + proto.RegisterType((*HelloReply)(nil), "helloworld.HelloReply") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Greeter service + +type GreeterClient interface { + // Sends a greeting + SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) +} + +type greeterClient struct { + cc *grpc.ClientConn +} + +func NewGreeterClient(cc *grpc.ClientConn) GreeterClient { + return &greeterClient{cc} +} + +func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) { + out := new(HelloReply) + err := grpc.Invoke(ctx, "/helloworld.Greeter/SayHello", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Greeter service + +type GreeterServer interface { + // Sends a greeting + SayHello(context.Context, *HelloRequest) (*HelloReply, error) +} + +func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) { + s.RegisterService(&_Greeter_serviceDesc, srv) +} + +func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HelloRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GreeterServer).SayHello(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/helloworld.Greeter/SayHello", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Greeter_serviceDesc = grpc.ServiceDesc{ + ServiceName: "helloworld.Greeter", + HandlerType: (*GreeterServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SayHello", + Handler: _Greeter_SayHello_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "helloworld.proto", +} + +func init() { proto.RegisterFile("helloworld.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 174 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x48, 0xcd, 0xc9, + 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88, + 0x28, 0x29, 0x71, 0xf1, 0x78, 0x80, 0x78, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, + 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0xb6, 0x92, + 0x1a, 0x17, 0x17, 0x54, 0x4d, 0x41, 0x4e, 0xa5, 0x90, 0x04, 0x17, 0x7b, 0x6e, 0x6a, 0x71, 0x71, + 0x62, 0x3a, 0x4c, 0x11, 0x8c, 0x6b, 0xe4, 0xc9, 0xc5, 0xee, 0x5e, 0x94, 0x9a, 0x5a, 0x92, 0x5a, + 0x24, 0x64, 0xc7, 0xc5, 0x11, 0x9c, 0x58, 0x09, 0xd6, 0x25, 0x24, 0xa1, 0x87, 0xe4, 0x02, 0x64, + 0xcb, 0xa4, 0xc4, 0xb0, 0xc8, 0x00, 0xad, 0x50, 0x62, 0x70, 0x32, 0xe0, 0x92, 0xce, 0xcc, 0xd7, + 0x4b, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0x46, 0x52, 0xeb, + 0xc4, 0x0f, 0x56, 0x1c, 0x0e, 0x62, 0x07, 0x80, 0xbc, 0x14, 0xc0, 0x98, 0xc4, 0x06, 0xf6, 0x9b, + 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xb7, 0xcd, 0xf2, 0xef, 0x00, 0x00, 0x00, +} diff --git a/vendor/cloud.google.com/go/trace/testdata/helloworld/helloworld.proto b/vendor/cloud.google.com/go/trace/testdata/helloworld/helloworld.proto new file mode 100644 index 000000000..bffe980e3 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/testdata/helloworld/helloworld.proto @@ -0,0 +1,37 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "io.grpc.examples.helloworld"; +option java_outer_classname = "HelloWorldProto"; + +package helloworld; + +// The greeting service definition. +service Greeter { + // Sends a greeting + rpc SayHello (HelloRequest) returns (HelloReply) {} +} + +// The request message containing the user's name. +message HelloRequest { + string name = 1; +} + +// The response message containing the greetings +message HelloReply { + string message = 1; +} diff --git a/vendor/cloud.google.com/go/trace/trace.go b/vendor/cloud.google.com/go/trace/trace.go new file mode 100644 index 000000000..7a11de952 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/trace.go @@ -0,0 +1,758 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package trace is OBSOLETE. See https://cloud.google.com/trace/docs/setup/go. +package trace // import "cloud.google.com/go/trace" + +import ( + "context" + "crypto/rand" + "encoding/binary" + "encoding/json" + "fmt" + "log" + "net/http" + "runtime" + "strconv" + "strings" + "sync" + "sync/atomic" + "time" + + api "google.golang.org/api/cloudtrace/v1" + "google.golang.org/api/gensupport" + "google.golang.org/api/option" + "google.golang.org/api/support/bundler" + htransport "google.golang.org/api/transport/http" +) + +const ( + httpHeader = `X-Cloud-Trace-Context` + userAgent = `gcloud-golang-trace/20160501` + cloudPlatformScope = `https://www.googleapis.com/auth/cloud-platform` + spanKindClient = `RPC_CLIENT` + spanKindServer = `RPC_SERVER` + spanKindUnspecified = `SPAN_KIND_UNSPECIFIED` + maxStackFrames = 20 + labelAgent = `trace.cloud.google.com/agent` +) + +// Stackdriver Trace API predefined labels. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +const ( + LabelComponent = `trace.cloud.google.com/component` + LabelErrorMessage = `trace.cloud.google.com/error/message` + LabelErrorName = `trace.cloud.google.com/error/name` + LabelHTTPClientCity = `trace.cloud.google.com/http/client_city` + LabelHTTPClientCountry = `trace.cloud.google.com/http/client_country` + LabelHTTPClientProtocol = `trace.cloud.google.com/http/client_protocol` + LabelHTTPClientRegion = `trace.cloud.google.com/http/client_region` + LabelHTTPHost = `trace.cloud.google.com/http/host` + LabelHTTPMethod = `trace.cloud.google.com/http/method` + LabelHTTPRedirectedURL = `trace.cloud.google.com/http/redirected_url` + LabelHTTPRequestSize = `trace.cloud.google.com/http/request/size` + LabelHTTPResponseSize = `trace.cloud.google.com/http/response/size` + LabelHTTPStatusCode = `trace.cloud.google.com/http/status_code` + LabelHTTPURL = `trace.cloud.google.com/http/url` + LabelHTTPUserAgent = `trace.cloud.google.com/http/user_agent` + LabelPID = `trace.cloud.google.com/pid` + LabelSamplingPolicy = `trace.cloud.google.com/sampling_policy` + LabelSamplingWeight = `trace.cloud.google.com/sampling_weight` + LabelStackTrace = `trace.cloud.google.com/stacktrace` + LabelTID = `trace.cloud.google.com/tid` +) + +const ( + // ScopeTraceAppend grants permissions to write trace data for a project. + // + // Deprecated: see https://cloud.google.com/trace/docs/setup/go. + ScopeTraceAppend = "https://www.googleapis.com/auth/trace.append" + + // ScopeCloudPlatform grants permissions to view and manage your data + // across Google Cloud Platform services. + // + // Deprecated: see https://cloud.google.com/trace/docs/setup/go. + ScopeCloudPlatform = "https://www.googleapis.com/auth/cloud-platform" +) + +type contextKey struct{} + +type stackLabelValue struct { + Frames []stackFrame `json:"stack_frame"` +} + +type stackFrame struct { + Class string `json:"class_name,omitempty"` + Method string `json:"method_name"` + Filename string `json:"file_name"` + Line int64 `json:"line_number"` +} + +var ( + spanIDCounter uint64 + spanIDIncrement uint64 +) + +func init() { + // Set spanIDCounter and spanIDIncrement to random values. nextSpanID will + // return an arithmetic progression using these values, skipping zero. We set + // the LSB of spanIDIncrement to 1, so that the cycle length is 2^64. + binary.Read(rand.Reader, binary.LittleEndian, &spanIDCounter) + binary.Read(rand.Reader, binary.LittleEndian, &spanIDIncrement) + spanIDIncrement |= 1 + // Attach hook for autogenerated Google API calls. This will automatically + // create trace spans for API calls if there is a trace in the context. + gensupport.RegisterHook(requestHook) +} + +func requestHook(ctx context.Context, req *http.Request) func(resp *http.Response) { + span := FromContext(ctx) + if span == nil || req == nil { + return nil + } + span = span.NewRemoteChild(req) + return func(resp *http.Response) { + if resp != nil { + span.Finish(WithResponse(resp)) + } else { + span.Finish() + } + } +} + +// nextSpanID returns a new span ID. It will never return zero. +func nextSpanID() uint64 { + var id uint64 + for id == 0 { + id = atomic.AddUint64(&spanIDCounter, spanIDIncrement) + } + return id +} + +// nextTraceID returns a new trace ID. +func nextTraceID() string { + id1 := nextSpanID() + id2 := nextSpanID() + return fmt.Sprintf("%016x%016x", id1, id2) +} + +// Client is a client for uploading traces to the Google Stackdriver Trace service. +// A nil Client will no-op for all of its methods. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +type Client struct { + service *api.Service + projectID string + policy SamplingPolicy + bundler *bundler.Bundler +} + +// NewClient creates a new Google Stackdriver Trace client. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) { + o := []option.ClientOption{ + option.WithScopes(cloudPlatformScope), + option.WithUserAgent(userAgent), + } + o = append(o, opts...) + hc, basePath, err := htransport.NewClient(ctx, o...) + if err != nil { + return nil, fmt.Errorf("creating HTTP client for Google Stackdriver Trace API: %v", err) + } + apiService, err := api.New(hc) + if err != nil { + return nil, fmt.Errorf("creating Google Stackdriver Trace API client: %v", err) + } + if basePath != "" { + // An option set a basepath, so override api.New's default. + apiService.BasePath = basePath + } + c := &Client{ + service: apiService, + projectID: projectID, + } + bundler := bundler.NewBundler((*api.Trace)(nil), func(bundle interface{}) { + traces := bundle.([]*api.Trace) + err := c.upload(traces) + if err != nil { + log.Printf("failed to upload %d traces to the Cloud Trace server: %v", len(traces), err) + } + }) + bundler.DelayThreshold = 2 * time.Second + bundler.BundleCountThreshold = 100 + // We're not measuring bytes here, we're counting traces and spans as one "byte" each. + bundler.BundleByteThreshold = 1000 + bundler.BundleByteLimit = 1000 + bundler.BufferedByteLimit = 10000 + c.bundler = bundler + return c, nil +} + +// SetSamplingPolicy sets the SamplingPolicy that determines how often traces +// are initiated by this client. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (c *Client) SetSamplingPolicy(p SamplingPolicy) { + if c != nil { + c.policy = p + } +} + +// SpanFromHeader returns a new trace span based on a provided request header +// value or nil iff the client is nil. +// +// The trace information and identifiers will be read from the header value. +// Otherwise, a new trace ID is made and the parent span ID is zero. +// For the exact format of the header value, see +// https://cloud.google.com/trace/docs/troubleshooting#force-trace +// +// The name of the new span is provided as an argument. +// +// If a non-nil sampling policy has been set in the client, it can override +// the options set in the header and choose whether to trace the request. +// +// If the header doesn't have existing tracing information, then a *Span is +// returned anyway, but it will not be uploaded to the server, just as when +// calling SpanFromRequest on an untraced request. +// +// Most users using HTTP should use SpanFromRequest, rather than +// SpanFromHeader, since it provides additional functionality for HTTP +// requests. In particular, it will set various pieces of request information +// as labels on the *Span, which is not available from the header alone. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (c *Client) SpanFromHeader(name string, header string) *Span { + if c == nil { + return nil + } + traceID, parentSpanID, options, _, ok := traceInfoFromHeader(header) + if !ok { + traceID = nextTraceID() + } + t := &trace{ + traceID: traceID, + client: c, + globalOptions: options, + localOptions: options, + } + span := startNewChild(name, t, parentSpanID) + span.span.Kind = spanKindServer + span.rootSpan = true + configureSpanFromPolicy(span, c.policy, ok) + return span +} + +// SpanFromRequest returns a new trace span for an HTTP request or nil +// iff the client is nil. +// +// If the incoming HTTP request contains a trace context header, the trace ID, +// parent span ID, and tracing options will be read from that header. +// Otherwise, a new trace ID is made and the parent span ID is zero. +// +// If a non-nil sampling policy has been set in the client, it can override the +// options set in the header and choose whether to trace the request. +// +// If the request is not being traced, then a *Span is returned anyway, but it +// will not be uploaded to the server -- it is only useful for propagating +// trace context to child requests and for getting the TraceID. All its +// methods can still be called -- the Finish, FinishWait, and SetLabel methods +// do nothing. NewChild does nothing, and returns the same *Span. TraceID +// works as usual. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (c *Client) SpanFromRequest(r *http.Request) *Span { + if c == nil { + return nil + } + traceID, parentSpanID, options, _, ok := traceInfoFromHeader(r.Header.Get(httpHeader)) + if !ok { + traceID = nextTraceID() + } + t := &trace{ + traceID: traceID, + client: c, + globalOptions: options, + localOptions: options, + } + span := startNewChildWithRequest(r, t, parentSpanID) + span.span.Kind = spanKindServer + span.rootSpan = true + configureSpanFromPolicy(span, c.policy, ok) + return span +} + +// NewSpan returns a new trace span with the given name or nil iff the +// client is nil. +// +// A new trace and span ID is generated to trace the span. +// Returned span need to be finished by calling Finish or FinishWait. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (c *Client) NewSpan(name string) *Span { + if c == nil { + return nil + } + t := &trace{ + traceID: nextTraceID(), + client: c, + localOptions: optionTrace, + globalOptions: optionTrace, + } + span := startNewChild(name, t, 0) + span.span.Kind = spanKindUnspecified + span.rootSpan = true + configureSpanFromPolicy(span, c.policy, false) + return span +} + +func configureSpanFromPolicy(s *Span, p SamplingPolicy, ok bool) { + if p == nil { + return + } + d := p.Sample(Parameters{HasTraceHeader: ok}) + if d.Trace { + // Turn on tracing locally, and in child requests. + s.trace.localOptions |= optionTrace + s.trace.globalOptions |= optionTrace + } else { + // Turn off tracing locally. + s.trace.localOptions = 0 + return + } + if d.Sample { + // This trace is in the random sample, so set the labels. + s.SetLabel(LabelSamplingPolicy, d.Policy) + s.SetLabel(LabelSamplingWeight, fmt.Sprint(d.Weight)) + } +} + +// NewContext returns a derived context containing the span. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func NewContext(ctx context.Context, s *Span) context.Context { + if s == nil { + return ctx + } + return context.WithValue(ctx, contextKey{}, s) +} + +// FromContext returns the span contained in the context, or nil. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func FromContext(ctx context.Context) *Span { + s, _ := ctx.Value(contextKey{}).(*Span) + return s +} + +func traceInfoFromHeader(h string) (traceID string, spanID uint64, options optionFlags, optionsOk bool, ok bool) { + // See https://cloud.google.com/trace/docs/faq for the header format. + // Return if the header is empty or missing, or if the header is unreasonably + // large, to avoid making unnecessary copies of a large string. + if h == "" || len(h) > 200 { + return "", 0, 0, false, false + + } + + // Parse the trace id field. + slash := strings.Index(h, `/`) + if slash == -1 { + return "", 0, 0, false, false + + } + traceID, h = h[:slash], h[slash+1:] + + // Parse the span id field. + spanstr := h + semicolon := strings.Index(h, `;`) + if semicolon != -1 { + spanstr, h = h[:semicolon], h[semicolon+1:] + } + spanID, err := strconv.ParseUint(spanstr, 10, 64) + if err != nil { + return "", 0, 0, false, false + + } + + // Parse the options field, options field is optional. + if !strings.HasPrefix(h, "o=") { + return traceID, spanID, 0, false, true + + } + o, err := strconv.ParseUint(h[2:], 10, 64) + if err != nil { + return "", 0, 0, false, false + + } + options = optionFlags(o) + return traceID, spanID, options, true, true +} + +type optionFlags uint32 + +const ( + optionTrace optionFlags = 1 << iota + optionStack +) + +type trace struct { + mu sync.Mutex + client *Client + traceID string + globalOptions optionFlags // options that will be passed to any child requests + localOptions optionFlags // options applied in this server + spans []*Span // finished spans for this trace. +} + +// finish appends s to t.spans. If s is the root span, uploads the trace to the +// server. +func (t *trace) finish(s *Span, wait bool, opts ...FinishOption) error { + for _, o := range opts { + o.modifySpan(s) + } + s.end = time.Now() + t.mu.Lock() + t.spans = append(t.spans, s) + spans := t.spans + t.mu.Unlock() + if s.rootSpan { + if wait { + return t.client.upload([]*api.Trace{t.constructTrace(spans)}) + } + go func() { + tr := t.constructTrace(spans) + err := t.client.bundler.Add(tr, 1+len(spans)) + if err == bundler.ErrOversizedItem { + err = t.client.upload([]*api.Trace{tr}) + } + if err != nil { + log.Println("error uploading trace:", err) + } + }() + } + return nil +} + +func (t *trace) constructTrace(spans []*Span) *api.Trace { + apiSpans := make([]*api.TraceSpan, len(spans)) + for i, sp := range spans { + sp.span.StartTime = sp.start.In(time.UTC).Format(time.RFC3339Nano) + sp.span.EndTime = sp.end.In(time.UTC).Format(time.RFC3339Nano) + if t.localOptions&optionStack != 0 { + sp.setStackLabel() + } + if sp.host != "" { + sp.SetLabel(LabelHTTPHost, sp.host) + } + if sp.url != "" { + sp.SetLabel(LabelHTTPURL, sp.url) + } + if sp.method != "" { + sp.SetLabel(LabelHTTPMethod, sp.method) + } + if sp.statusCode != 0 { + sp.SetLabel(LabelHTTPStatusCode, strconv.Itoa(sp.statusCode)) + } + sp.SetLabel(labelAgent, userAgent) + apiSpans[i] = &sp.span + } + + return &api.Trace{ + ProjectId: t.client.projectID, + TraceId: t.traceID, + Spans: apiSpans, + } +} + +func (c *Client) upload(traces []*api.Trace) error { + _, err := c.service.Projects.PatchTraces(c.projectID, &api.Traces{Traces: traces}).Do() + return err +} + +// Span contains information about one span of a trace. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +type Span struct { + trace *trace + + spanMu sync.Mutex // guards span.Labels + span api.TraceSpan + + start time.Time + end time.Time + rootSpan bool + stack [maxStackFrames]uintptr + host string + method string + url string + statusCode int +} + +// Traced reports whether the current span is sampled to be traced. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (s *Span) Traced() bool { + if s == nil { + return false + } + return s.trace.localOptions&optionTrace != 0 +} + +// NewChild creates a new span with the given name as a child of s. +// If s is nil, does nothing and returns nil. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (s *Span) NewChild(name string) *Span { + if s == nil { + return nil + } + if !s.Traced() { + // TODO(jbd): Document this behavior in godoc here and elsewhere. + return s + } + return startNewChild(name, s.trace, s.span.SpanId) +} + +// NewRemoteChild creates a new span as a child of s. +// +// Some labels in the span are set from the outgoing *http.Request r. +// +// A header is set in r so that the trace context is propagated to the +// destination. The parent span ID in that header is set as follows: +// - If the request is being traced, then the ID of s is used. +// - If the request is not being traced, but there was a trace context header +// in the incoming request for this trace (the request passed to +// SpanFromRequest), the parent span ID in that header is used. +// - Otherwise, the parent span ID is zero. +// The tracing bit in the options is set if tracing is enabled, or if it was +// set in the incoming request. +// +// If s is nil, does nothing and returns nil. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (s *Span) NewRemoteChild(r *http.Request) *Span { + if s == nil { + return nil + } + if !s.Traced() { + r.Header[httpHeader] = []string{spanHeader(s.trace.traceID, s.span.ParentSpanId, s.trace.globalOptions)} + return s + } + newSpan := startNewChildWithRequest(r, s.trace, s.span.SpanId) + r.Header[httpHeader] = []string{spanHeader(s.trace.traceID, newSpan.span.SpanId, s.trace.globalOptions)} + return newSpan +} + +// Header returns the value of the X-Cloud-Trace-Context header that +// should be used to propagate the span. This is the inverse of +// SpanFromHeader. +// +// Most users should use NewRemoteChild unless they have specific +// propagation needs or want to control the naming of their span. +// Header() does not create a new span. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (s *Span) Header() string { + if s == nil { + return "" + } + return spanHeader(s.trace.traceID, s.span.SpanId, s.trace.globalOptions) +} + +func startNewChildWithRequest(r *http.Request, trace *trace, parentSpanID uint64) *Span { + name := r.URL.Host + r.URL.Path // drop scheme and query params + newSpan := startNewChild(name, trace, parentSpanID) + if r.Host == "" { + newSpan.host = r.URL.Host + } else { + newSpan.host = r.Host + } + newSpan.method = r.Method + newSpan.url = r.URL.String() + return newSpan +} + +func startNewChild(name string, trace *trace, parentSpanID uint64) *Span { + spanID := nextSpanID() + for spanID == parentSpanID { + spanID = nextSpanID() + } + newSpan := &Span{ + trace: trace, + span: api.TraceSpan{ + Kind: spanKindClient, + Name: name, + ParentSpanId: parentSpanID, + SpanId: spanID, + }, + start: time.Now(), + } + if trace.localOptions&optionStack != 0 { + _ = runtime.Callers(1, newSpan.stack[:]) + } + return newSpan +} + +// TraceID returns the ID of the trace to which s belongs. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (s *Span) TraceID() string { + if s == nil { + return "" + } + return s.trace.traceID +} + +// SetLabel sets the label for the given key to the given value. +// If the value is empty, the label for that key is deleted. +// If a label is given a value automatically and by SetLabel, the +// automatically-set value is used. +// If s is nil, does nothing. +// +// SetLabel shouldn't be called after Finish or FinishWait. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (s *Span) SetLabel(key, value string) { + if s == nil { + return + } + if !s.Traced() { + return + } + s.spanMu.Lock() + defer s.spanMu.Unlock() + + if value == "" { + if s.span.Labels != nil { + delete(s.span.Labels, key) + } + return + } + if s.span.Labels == nil { + s.span.Labels = make(map[string]string) + } + s.span.Labels[key] = value +} + +// FinishOption allows users to specify span finalizers. +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +type FinishOption interface { + modifySpan(s *Span) +} + +type withResponse struct { + *http.Response +} + +// WithResponse returns an option that can be passed to Finish that indicates +// that some labels for the span should be set using the given *http.Response. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func WithResponse(resp *http.Response) FinishOption { + return withResponse{resp} +} + +func (u withResponse) modifySpan(s *Span) { + if u.Response != nil { + s.statusCode = u.StatusCode + } +} + +// Finish declares that the span has finished. +// +// If s is nil, Finish does nothing and returns nil. +// +// If the option trace.WithResponse(resp) is passed, then some labels are set +// for s using information in the given *http.Response. This is useful when the +// span is for an outgoing http request; s will typically have been created by +// NewRemoteChild in this case. +// +// If s is a root span (one created by SpanFromRequest) then s, and all its +// descendant spans that have finished, are uploaded to the Google Stackdriver +// Trace server asynchronously. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (s *Span) Finish(opts ...FinishOption) { + if s == nil { + return + } + if !s.Traced() { + return + } + s.trace.finish(s, false, opts...) +} + +// FinishWait is like Finish, but if s is a root span, it waits until uploading +// is finished, then returns an error if one occurred. +// +// Deprecated: see https://cloud.google.com/trace/docs/setup/go. +func (s *Span) FinishWait(opts ...FinishOption) error { + if s == nil { + return nil + } + if !s.Traced() { + return nil + } + return s.trace.finish(s, true, opts...) +} + +func spanHeader(traceID string, spanID uint64, options optionFlags) string { + // See https://cloud.google.com/trace/docs/faq for the header format. + return fmt.Sprintf("%s/%d;o=%d", traceID, spanID, options) +} + +func (s *Span) setStackLabel() { + var stack stackLabelValue + lastSigPanic, inTraceLibrary := false, true + for _, pc := range s.stack { + if pc == 0 { + break + } + if !lastSigPanic { + pc-- + } + fn := runtime.FuncForPC(pc) + file, line := fn.FileLine(pc) + // Name has one of the following forms: + // path/to/package.Foo + // path/to/package.(Type).Foo + // For the first form, we store the whole name in the Method field of the + // stack frame. For the second form, we set the Method field to "Foo" and + // the Class field to "path/to/package.(Type)". + name := fn.Name() + if inTraceLibrary && !strings.HasPrefix(name, "cloud.google.com/go/trace.") { + inTraceLibrary = false + } + var class string + if i := strings.Index(name, ")."); i != -1 { + class, name = name[:i+1], name[i+2:] + } + frame := stackFrame{ + Class: class, + Method: name, + Filename: file, + Line: int64(line), + } + if inTraceLibrary && len(stack.Frames) == 1 { + stack.Frames[0] = frame + } else { + stack.Frames = append(stack.Frames, frame) + } + lastSigPanic = fn.Name() == "runtime.sigpanic" + } + if label, err := json.Marshal(stack); err == nil { + s.SetLabel(LabelStackTrace, string(label)) + } +} diff --git a/vendor/cloud.google.com/go/trace/trace_test.go b/vendor/cloud.google.com/go/trace/trace_test.go new file mode 100644 index 000000000..4992533c3 --- /dev/null +++ b/vendor/cloud.google.com/go/trace/trace_test.go @@ -0,0 +1,967 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "math/rand" + "net/http" + "regexp" + "strings" + "sync" + "testing" + "time" + + "cloud.google.com/go/datastore" + "cloud.google.com/go/internal/testutil" + "cloud.google.com/go/storage" + api "google.golang.org/api/cloudtrace/v1" + compute "google.golang.org/api/compute/v1" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + dspb "google.golang.org/genproto/googleapis/datastore/v1" + "google.golang.org/grpc" +) + +const testProjectID = "testproject" + +type fakeRoundTripper struct { + reqc chan *http.Request +} + +func newFakeRoundTripper() *fakeRoundTripper { + return &fakeRoundTripper{reqc: make(chan *http.Request)} +} + +func (rt *fakeRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { + rt.reqc <- r + resp := &http.Response{ + Status: "200 OK", + StatusCode: 200, + Body: ioutil.NopCloser(strings.NewReader("{}")), + } + return resp, nil +} + +func newTestClient(rt http.RoundTripper) *Client { + t, err := NewClient(context.Background(), testProjectID, option.WithHTTPClient(&http.Client{Transport: rt})) + if err != nil { + panic(err) + } + return t +} + +type fakeDatastoreServer struct { + dspb.DatastoreServer + fail bool +} + +func (f *fakeDatastoreServer) Lookup(ctx context.Context, req *dspb.LookupRequest) (*dspb.LookupResponse, error) { + if f.fail { + return nil, errors.New("lookup failed") + } + return &dspb.LookupResponse{}, nil +} + +// makeRequests makes some requests. +// span is the root span. rt is the trace client's http client's transport. +// This is used to retrieve the trace uploaded by the client, if any. If +// expectTrace is true, we expect a trace will be uploaded. If synchronous is +// true, the call to Finish is expected not to return before the client has +// uploaded any traces. +func makeRequests(t *testing.T, span *Span, rt *fakeRoundTripper, synchronous bool, expectTrace bool) *http.Request { + ctx := NewContext(context.Background(), span) + tc := newTestClient(&noopTransport{}) + + // An HTTP request. + { + req2, err := http.NewRequest("GET", "http://example.com/bar", nil) + if err != nil { + t.Fatal(err) + } + resp := &http.Response{StatusCode: 200} + s := span.NewRemoteChild(req2) + s.Finish(WithResponse(resp)) + } + + // An autogenerated API call. + { + rt := &fakeRoundTripper{reqc: make(chan *http.Request, 1)} + hc := &http.Client{Transport: rt} + computeClient, err := compute.New(hc) + if err != nil { + t.Fatal(err) + } + _, err = computeClient.Zones.List(testProjectID).Context(ctx).Do() + if err != nil { + t.Fatal(err) + } + } + + // A cloud library call that uses the autogenerated API. + { + rt := &fakeRoundTripper{reqc: make(chan *http.Request, 1)} + hc := &http.Client{Transport: rt} + storageClient, err := storage.NewClient(context.Background(), option.WithHTTPClient(hc)) + if err != nil { + t.Fatal(err) + } + it := storageClient.Bucket("testbucket").Objects(ctx, nil) + for { + _, err := it.Next() + if err != nil && err != iterator.Done { + t.Fatal(err) + } + if err == iterator.Done { + break + } + } + } + + // A cloud library call that uses grpc internally. + for _, fail := range []bool{false, true} { + srv, err := testutil.NewServer() + if err != nil { + t.Fatalf("creating test datastore server: %v", err) + } + dspb.RegisterDatastoreServer(srv.Gsrv, &fakeDatastoreServer{fail: fail}) + srv.Start() + conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure(), grpc.WithUnaryInterceptor(tc.GRPCClientInterceptor())) + if err != nil { + t.Fatalf("connecting to test datastore server: %v", err) + } + datastoreClient, err := datastore.NewClient(ctx, testProjectID, option.WithGRPCConn(conn)) + if err != nil { + t.Fatalf("creating datastore client: %v", err) + } + k := datastore.NameKey("Entity", "stringID", nil) + e := new(datastore.Entity) + datastoreClient.Get(ctx, k, e) + } + + done := make(chan struct{}) + go func() { + if synchronous { + err := span.FinishWait() + if err != nil { + t.Errorf("Unexpected error from span.FinishWait: %v", err) + } + } else { + span.Finish() + } + done <- struct{}{} + }() + if !expectTrace { + <-done + select { + case <-rt.reqc: + t.Errorf("Got a trace, expected none.") + case <-time.After(5 * time.Millisecond): + } + return nil + } else if !synchronous { + <-done + return <-rt.reqc + } else { + select { + case <-done: + t.Errorf("Synchronous Finish didn't wait for trace upload.") + return <-rt.reqc + case <-time.After(5 * time.Millisecond): + r := <-rt.reqc + <-done + return r + } + } +} + +func TestHeader(t *testing.T) { + tests := []struct { + header string + wantTraceID string + wantSpanID uint64 + wantOpts optionFlags + wantOK bool + }{ + { + header: "0123456789ABCDEF0123456789ABCDEF/1;o=1", + wantTraceID: "0123456789ABCDEF0123456789ABCDEF", + wantSpanID: 1, + wantOpts: 1, + wantOK: true, + }, + { + header: "0123456789ABCDEF0123456789ABCDEF/1;o=0", + wantTraceID: "0123456789ABCDEF0123456789ABCDEF", + wantSpanID: 1, + wantOpts: 0, + wantOK: true, + }, + { + header: "0123456789ABCDEF0123456789ABCDEF/1", + wantTraceID: "0123456789ABCDEF0123456789ABCDEF", + wantSpanID: 1, + wantOpts: 0, + wantOK: true, + }, + { + header: "", + wantTraceID: "", + wantSpanID: 0, + wantOpts: 0, + wantOK: false, + }, + } + for _, tt := range tests { + traceID, parentSpanID, opts, _, ok := traceInfoFromHeader(tt.header) + if got, want := traceID, tt.wantTraceID; got != want { + t.Errorf("TraceID(%v) = %q; want %q", tt.header, got, want) + } + if got, want := parentSpanID, tt.wantSpanID; got != want { + t.Errorf("SpanID(%v) = %v; want %v", tt.header, got, want) + } + if got, want := opts, tt.wantOpts; got != want { + t.Errorf("Options(%v) = %v; want %v", tt.header, got, want) + } + if got, want := ok, tt.wantOK; got != want { + t.Errorf("Header exists (%v) = %v; want %v", tt.header, got, want) + } + } +} + +func TestOutgoingReqHeader(t *testing.T) { + all, _ := NewLimitedSampler(1, 1<<16) // trace every request + + tests := []struct { + desc string + traceHeader string + samplingPolicy SamplingPolicy + + wantHeaderRe *regexp.Regexp + }{ + { + desc: "Parent span without sampling options, client samples all", + traceHeader: "0123456789ABCDEF0123456789ABCDEF/1", + samplingPolicy: all, + wantHeaderRe: regexp.MustCompile("0123456789ABCDEF0123456789ABCDEF/\\d+;o=1"), + }, + { + desc: "Parent span without sampling options, without client sampling", + traceHeader: "0123456789ABCDEF0123456789ABCDEF/1", + samplingPolicy: nil, + wantHeaderRe: regexp.MustCompile("0123456789ABCDEF0123456789ABCDEF/\\d+;o=0"), + }, + { + desc: "Parent span with o=1, client samples none", + traceHeader: "0123456789ABCDEF0123456789ABCDEF/1;o=1", + samplingPolicy: nil, + wantHeaderRe: regexp.MustCompile("0123456789ABCDEF0123456789ABCDEF/\\d+;o=1"), + }, + { + desc: "Parent span with o=0, without client sampling", + traceHeader: "0123456789ABCDEF0123456789ABCDEF/1;o=0", + samplingPolicy: nil, + wantHeaderRe: regexp.MustCompile("0123456789ABCDEF0123456789ABCDEF/\\d+;o=0"), + }, + } + + tc := newTestClient(nil) + for _, tt := range tests { + tc.SetSamplingPolicy(tt.samplingPolicy) + span := tc.SpanFromHeader("/foo", tt.traceHeader) + + req, _ := http.NewRequest("GET", "http://localhost", nil) + span.NewRemoteChild(req) + + if got, re := req.Header.Get(httpHeader), tt.wantHeaderRe; !re.MatchString(got) { + t.Errorf("%v (parent=%q): got header %q; want in format %q", tt.desc, tt.traceHeader, got, re) + } + } +} + +func TestTrace(t *testing.T) { + t.Parallel() + testTrace(t, false, true) +} + +func TestTraceWithWait(t *testing.T) { + testTrace(t, true, true) +} + +func TestTraceFromHeader(t *testing.T) { + t.Parallel() + testTrace(t, false, false) +} + +func TestTraceFromHeaderWithWait(t *testing.T) { + testTrace(t, false, true) +} + +func TestNewSpan(t *testing.T) { + t.Skip("flaky") + const traceID = "0123456789ABCDEF0123456789ABCDEF" + + rt := newFakeRoundTripper() + traceClient := newTestClient(rt) + span := traceClient.NewSpan("/foo") + span.trace.traceID = traceID + + uploaded := makeRequests(t, span, rt, true, true) + + if uploaded == nil { + t.Fatalf("No trace uploaded, expected one.") + } + + expected := api.Traces{ + Traces: []*api.Trace{ + { + ProjectId: testProjectID, + Spans: []*api.TraceSpan{ + { + Kind: "RPC_CLIENT", + Labels: map[string]string{ + "trace.cloud.google.com/http/host": "example.com", + "trace.cloud.google.com/http/method": "GET", + "trace.cloud.google.com/http/status_code": "200", + "trace.cloud.google.com/http/url": "http://example.com/bar", + }, + Name: "example.com/bar", + }, + { + Kind: "RPC_CLIENT", + Labels: map[string]string{ + "trace.cloud.google.com/http/host": "www.googleapis.com", + "trace.cloud.google.com/http/method": "GET", + "trace.cloud.google.com/http/status_code": "200", + "trace.cloud.google.com/http/url": "https://www.googleapis.com/compute/v1/projects/testproject/zones", + }, + Name: "www.googleapis.com/compute/v1/projects/testproject/zones", + }, + { + Kind: "RPC_CLIENT", + Labels: map[string]string{ + "trace.cloud.google.com/http/host": "www.googleapis.com", + "trace.cloud.google.com/http/method": "GET", + "trace.cloud.google.com/http/status_code": "200", + "trace.cloud.google.com/http/url": "https://www.googleapis.com/storage/v1/b/testbucket/o", + }, + Name: "www.googleapis.com/storage/v1/b/testbucket/o", + }, + { + Kind: "RPC_CLIENT", + Labels: nil, + Name: "/google.datastore.v1.Datastore/Lookup", + }, + { + Kind: "RPC_CLIENT", + Labels: map[string]string{"error": "rpc error: code = Unknown desc = lookup failed"}, + Name: "/google.datastore.v1.Datastore/Lookup", + }, + { + Kind: "SPAN_KIND_UNSPECIFIED", + Labels: map[string]string{}, + Name: "/foo", + }, + }, + TraceId: traceID, + }, + }, + } + + body, err := ioutil.ReadAll(uploaded.Body) + if err != nil { + t.Fatal(err) + } + var patch api.Traces + err = json.Unmarshal(body, &patch) + if err != nil { + t.Fatal(err) + } + + checkTraces(t, patch, expected) + + n := len(patch.Traces[0].Spans) + rootSpan := patch.Traces[0].Spans[n-1] + for i, s := range patch.Traces[0].Spans { + if a, b := s.StartTime, s.EndTime; a > b { + t.Errorf("span %d start time is later than its end time (%q, %q)", i, a, b) + } + if a, b := rootSpan.StartTime, s.StartTime; a > b { + t.Errorf("trace start time is later than span %d start time (%q, %q)", i, a, b) + } + if a, b := s.EndTime, rootSpan.EndTime; a > b { + t.Errorf("span %d end time is later than trace end time (%q, %q)", i, a, b) + } + if i > 1 && i < n-1 { + if a, b := patch.Traces[0].Spans[i-1].EndTime, s.StartTime; a > b { + t.Errorf("span %d end time is later than span %d start time (%q, %q)", i-1, i, a, b) + } + } + } + + if x := rootSpan.ParentSpanId; x != 0 { + t.Errorf("Incorrect ParentSpanId: got %d want %d", x, 0) + } + for i, s := range patch.Traces[0].Spans { + if x, y := rootSpan.SpanId, s.ParentSpanId; i < n-1 && x != y { + t.Errorf("Incorrect ParentSpanId in span %d: got %d want %d", i, y, x) + } + } + for i, s := range patch.Traces[0].Spans { + s.EndTime = "" + labels := &expected.Traces[0].Spans[i].Labels + for key, value := range *labels { + if v, ok := s.Labels[key]; !ok { + t.Errorf("Span %d is missing Label %q:%q", i, key, value) + } else if key == "trace.cloud.google.com/http/url" { + if !strings.HasPrefix(v, value) { + t.Errorf("Span %d Label %q: got value %q want prefix %q", i, key, v, value) + } + } else if v != value { + t.Errorf("Span %d Label %q: got value %q want %q", i, key, v, value) + } + } + for key := range s.Labels { + if _, ok := (*labels)[key]; key != "trace.cloud.google.com/stacktrace" && !ok { + t.Errorf("Span %d: unexpected label %q", i, key) + } + } + *labels = nil + s.Labels = nil + s.ParentSpanId = 0 + if s.SpanId == 0 { + t.Errorf("Incorrect SpanId: got 0 want nonzero") + } + s.SpanId = 0 + s.StartTime = "" + } + if !testutil.Equal(patch, expected) { + got, _ := json.Marshal(patch) + want, _ := json.Marshal(expected) + t.Errorf("PatchTraces request: got %s want %s", got, want) + } +} + +func testTrace(t *testing.T, synchronous bool, fromRequest bool) { + t.Skip("flaky") + const header = `0123456789ABCDEF0123456789ABCDEF/42;o=3` + rt := newFakeRoundTripper() + traceClient := newTestClient(rt) + + span := traceClient.SpanFromHeader("/foo", header) + headerOrReqLabels := map[string]string{} + headerOrReqName := "/foo" + + if fromRequest { + req, err := http.NewRequest("GET", "http://example.com/foo", nil) + if err != nil { + t.Fatal(err) + } + req.Header.Set("X-Cloud-Trace-Context", header) + span = traceClient.SpanFromRequest(req) + headerOrReqLabels = map[string]string{ + "trace.cloud.google.com/http/host": "example.com", + "trace.cloud.google.com/http/method": "GET", + "trace.cloud.google.com/http/url": "http://example.com/foo", + } + headerOrReqName = "example.com/foo" + } + + uploaded := makeRequests(t, span, rt, synchronous, true) + if uploaded == nil { + t.Fatalf("No trace uploaded, expected one.") + } + + expected := api.Traces{ + Traces: []*api.Trace{ + { + ProjectId: testProjectID, + Spans: []*api.TraceSpan{ + { + Kind: "RPC_CLIENT", + Labels: map[string]string{ + "trace.cloud.google.com/http/host": "example.com", + "trace.cloud.google.com/http/method": "GET", + "trace.cloud.google.com/http/status_code": "200", + "trace.cloud.google.com/http/url": "http://example.com/bar", + }, + Name: "example.com/bar", + }, + { + Kind: "RPC_CLIENT", + Labels: map[string]string{ + "trace.cloud.google.com/http/host": "www.googleapis.com", + "trace.cloud.google.com/http/method": "GET", + "trace.cloud.google.com/http/status_code": "200", + "trace.cloud.google.com/http/url": "https://www.googleapis.com/compute/v1/projects/testproject/zones", + }, + Name: "www.googleapis.com/compute/v1/projects/testproject/zones", + }, + { + Kind: "RPC_CLIENT", + Labels: map[string]string{ + "trace.cloud.google.com/http/host": "www.googleapis.com", + "trace.cloud.google.com/http/method": "GET", + "trace.cloud.google.com/http/status_code": "200", + "trace.cloud.google.com/http/url": "https://www.googleapis.com/storage/v1/b/testbucket/o", + }, + Name: "www.googleapis.com/storage/v1/b/testbucket/o", + }, + { + Kind: "RPC_CLIENT", + Labels: nil, + Name: "/google.datastore.v1.Datastore/Lookup", + }, + { + Kind: "RPC_CLIENT", + Labels: map[string]string{"error": "rpc error: code = Unknown desc = lookup failed"}, + Name: "/google.datastore.v1.Datastore/Lookup", + }, + { + Kind: "RPC_SERVER", + Labels: headerOrReqLabels, + Name: headerOrReqName, + }, + }, + TraceId: "0123456789ABCDEF0123456789ABCDEF", + }, + }, + } + + body, err := ioutil.ReadAll(uploaded.Body) + if err != nil { + t.Fatal(err) + } + var patch api.Traces + err = json.Unmarshal(body, &patch) + if err != nil { + t.Fatal(err) + } + + checkTraces(t, patch, expected) + + n := len(patch.Traces[0].Spans) + rootSpan := patch.Traces[0].Spans[n-1] + for i, s := range patch.Traces[0].Spans { + if a, b := s.StartTime, s.EndTime; a > b { + t.Errorf("span %d start time is later than its end time (%q, %q)", i, a, b) + } + if a, b := rootSpan.StartTime, s.StartTime; a > b { + t.Errorf("trace start time is later than span %d start time (%q, %q)", i, a, b) + } + if a, b := s.EndTime, rootSpan.EndTime; a > b { + t.Errorf("span %d end time is later than trace end time (%q, %q)", i, a, b) + } + if i > 1 && i < n-1 { + if a, b := patch.Traces[0].Spans[i-1].EndTime, s.StartTime; a > b { + t.Errorf("span %d end time is later than span %d start time (%q, %q)", i-1, i, a, b) + } + } + } + + if x := rootSpan.ParentSpanId; x != 42 { + t.Errorf("Incorrect ParentSpanId: got %d want %d", x, 42) + } + for i, s := range patch.Traces[0].Spans { + if x, y := rootSpan.SpanId, s.ParentSpanId; i < n-1 && x != y { + t.Errorf("Incorrect ParentSpanId in span %d: got %d want %d", i, y, x) + } + } + for i, s := range patch.Traces[0].Spans { + s.EndTime = "" + labels := &expected.Traces[0].Spans[i].Labels + for key, value := range *labels { + if v, ok := s.Labels[key]; !ok { + t.Errorf("Span %d is missing Label %q:%q", i, key, value) + } else if key == "trace.cloud.google.com/http/url" { + if !strings.HasPrefix(v, value) { + t.Errorf("Span %d Label %q: got value %q want prefix %q", i, key, v, value) + } + } else if v != value { + t.Errorf("Span %d Label %q: got value %q want %q", i, key, v, value) + } + } + for key := range s.Labels { + if _, ok := (*labels)[key]; key != "trace.cloud.google.com/stacktrace" && !ok { + t.Errorf("Span %d: unexpected label %q", i, key) + } + } + *labels = nil + s.Labels = nil + s.ParentSpanId = 0 + if s.SpanId == 0 { + t.Errorf("Incorrect SpanId: got 0 want nonzero") + } + s.SpanId = 0 + s.StartTime = "" + } + if !testutil.Equal(patch, expected) { + got, _ := json.Marshal(patch) + want, _ := json.Marshal(expected) + t.Errorf("PatchTraces request: got %s \n\n want %s", got, want) + } +} + +func TestNoTrace(t *testing.T) { + testNoTrace(t, false, true) +} + +func TestNoTraceWithWait(t *testing.T) { + testNoTrace(t, true, true) +} + +func TestNoTraceFromHeader(t *testing.T) { + testNoTrace(t, false, false) +} + +func TestNoTraceFromHeaderWithWait(t *testing.T) { + testNoTrace(t, true, false) +} + +func testNoTrace(t *testing.T, synchronous bool, fromRequest bool) { + for _, header := range []string{ + `0123456789ABCDEF0123456789ABCDEF/42;o=2`, + `0123456789ABCDEF0123456789ABCDEF/42;o=0`, + `0123456789ABCDEF0123456789ABCDEF/42`, + `0123456789ABCDEF0123456789ABCDEF`, + ``, + } { + rt := newFakeRoundTripper() + traceClient := newTestClient(rt) + var span *Span + if fromRequest { + req, err := http.NewRequest("GET", "http://example.com/foo", nil) + if header != "" { + req.Header.Set("X-Cloud-Trace-Context", header) + } + if err != nil { + t.Fatal(err) + } + span = traceClient.SpanFromRequest(req) + } else { + span = traceClient.SpanFromHeader("/foo", header) + } + uploaded := makeRequests(t, span, rt, synchronous, false) + if uploaded != nil { + t.Errorf("Got a trace, expected none.") + } + } +} + +func TestSample(t *testing.T) { + // A deterministic test of the sampler logic. + type testCase struct { + rate float64 + maxqps float64 + want int + } + const delta = 25 * time.Millisecond + for _, test := range []testCase{ + // qps won't matter, so we will sample half of the 79 calls + {0.50, 100, 40}, + // with 1 qps and a burst of 2, we will sample twice in second #1, once in the partial second #2 + {0.50, 1, 3}, + } { + sp, err := NewLimitedSampler(test.rate, test.maxqps) + if err != nil { + t.Fatal(err) + } + s := sp.(*sampler) + sampled := 0 + tm := time.Now() + for i := 0; i < 80; i++ { + if s.sample(Parameters{}, tm, float64(i%2)).Sample { + sampled++ + } + tm = tm.Add(delta) + } + if sampled != test.want { + t.Errorf("rate=%f, maxqps=%f: got %d samples, want %d", test.rate, test.maxqps, sampled, test.want) + } + } +} + +func TestSampling(t *testing.T) { + t.Parallel() + // This scope tests sampling in a larger context, with real time and randomness. + wg := sync.WaitGroup{} + type testCase struct { + rate float64 + maxqps float64 + expectedRange [2]int + } + for _, test := range []testCase{ + {0, 5, [2]int{0, 0}}, + {5, 0, [2]int{0, 0}}, + {0.50, 100, [2]int{20, 60}}, + {0.50, 1, [2]int{3, 4}}, // Windows, with its less precise clock, sometimes gives 4. + } { + wg.Add(1) + go func(test testCase) { + rt := newFakeRoundTripper() + traceClient := newTestClient(rt) + traceClient.bundler.BundleByteLimit = 1 + p, err := NewLimitedSampler(test.rate, test.maxqps) + if err != nil { + t.Errorf("NewLimitedSampler: %v", err) + } + traceClient.SetSamplingPolicy(p) + ticker := time.NewTicker(25 * time.Millisecond) + sampled := 0 + for i := 0; i < 79; i++ { + req, err := http.NewRequest("GET", "http://example.com/foo", nil) + if err != nil { + t.Error(err) + } + span := traceClient.SpanFromRequest(req) + span.Finish() + select { + case <-rt.reqc: + <-ticker.C + sampled++ + case <-ticker.C: + } + } + ticker.Stop() + if test.expectedRange[0] > sampled || sampled > test.expectedRange[1] { + t.Errorf("rate=%f, maxqps=%f: got %d samples want ∈ %v", test.rate, test.maxqps, sampled, test.expectedRange) + } + wg.Done() + }(test) + } + wg.Wait() +} + +func TestBundling(t *testing.T) { + t.Parallel() + rt := newFakeRoundTripper() + traceClient := newTestClient(rt) + traceClient.bundler.DelayThreshold = time.Second / 2 + traceClient.bundler.BundleCountThreshold = 10 + p, err := NewLimitedSampler(1, 99) // sample every request. + if err != nil { + t.Fatalf("NewLimitedSampler: %v", err) + } + traceClient.SetSamplingPolicy(p) + + for i := 0; i < 35; i++ { + go func() { + req, err := http.NewRequest("GET", "http://example.com/foo", nil) + if err != nil { + t.Error(err) + } + span := traceClient.SpanFromRequest(req) + span.Finish() + }() + } + + // Read the first three bundles. + <-rt.reqc + <-rt.reqc + <-rt.reqc + + // Test that the fourth bundle isn't sent early. + select { + case <-rt.reqc: + t.Errorf("bundle sent too early") + case <-time.After(time.Second / 4): + <-rt.reqc + } + + // Test that there aren't extra bundles. + select { + case <-rt.reqc: + t.Errorf("too many bundles sent") + case <-time.After(time.Second): + } +} + +func TestWeights(t *testing.T) { + const ( + expectedNumTraced = 10100 + numTracedEpsilon = 100 + expectedTotalWeight = 50000 + totalWeightEpsilon = 5000 + ) + rng := rand.New(rand.NewSource(1)) + const delta = 2 * time.Millisecond + for _, headerRate := range []float64{0.0, 0.5, 1.0} { + // Simulate 10 seconds of requests arriving at 500qps. + // + // The sampling policy tries to sample 25% of them, but has a qps limit of + // 100, so it will not be able to. The returned weight should be higher + // for some sampled requests to compensate. + // + // headerRate is the fraction of incoming requests that have a trace header + // set. The qps limit should not be exceeded, even if headerRate is high. + sp, err := NewLimitedSampler(0.25, 100) + if err != nil { + t.Fatal(err) + } + s := sp.(*sampler) + tm := time.Now() + totalWeight := 0.0 + numTraced := 0 + seenLargeWeight := false + for i := 0; i < 50000; i++ { + d := s.sample(Parameters{HasTraceHeader: rng.Float64() < headerRate}, tm, rng.Float64()) + if d.Trace { + numTraced++ + } + if d.Sample { + totalWeight += d.Weight + if x := int(d.Weight) / 4; x <= 0 || x >= 100 || d.Weight != float64(x)*4.0 { + t.Errorf("weight: got %f, want a small positive multiple of 4", d.Weight) + } + if d.Weight > 4 { + seenLargeWeight = true + } + } + tm = tm.Add(delta) + } + if !seenLargeWeight { + t.Errorf("headerRate %f: never saw sample weight higher than 4.", headerRate) + } + if numTraced < expectedNumTraced-numTracedEpsilon || expectedNumTraced+numTracedEpsilon < numTraced { + t.Errorf("headerRate %f: got %d traced requests, want ∈ [%d, %d]", headerRate, numTraced, expectedNumTraced-numTracedEpsilon, expectedNumTraced+numTracedEpsilon) + } + if totalWeight < expectedTotalWeight-totalWeightEpsilon || expectedTotalWeight+totalWeightEpsilon < totalWeight { + t.Errorf("headerRate %f: got total weight %f want ∈ [%d, %d]", headerRate, totalWeight, expectedTotalWeight-totalWeightEpsilon, expectedTotalWeight+totalWeightEpsilon) + } + } +} + +type alwaysTrace struct{} + +func (a alwaysTrace) Sample(p Parameters) Decision { + return Decision{Trace: true} +} + +type neverTrace struct{} + +func (a neverTrace) Sample(p Parameters) Decision { + return Decision{Trace: false} +} + +func TestPropagation(t *testing.T) { + rt := newFakeRoundTripper() + traceClient := newTestClient(rt) + for _, header := range []string{ + `0123456789ABCDEF0123456789ABCDEF/42;o=0`, + `0123456789ABCDEF0123456789ABCDEF/42;o=1`, + `0123456789ABCDEF0123456789ABCDEF/42;o=2`, + `0123456789ABCDEF0123456789ABCDEF/42;o=3`, + `0123456789ABCDEF0123456789ABCDEF/0;o=0`, + `0123456789ABCDEF0123456789ABCDEF/0;o=1`, + `0123456789ABCDEF0123456789ABCDEF/0;o=2`, + `0123456789ABCDEF0123456789ABCDEF/0;o=3`, + ``, + } { + for _, policy := range []SamplingPolicy{ + nil, + alwaysTrace{}, + neverTrace{}, + } { + traceClient.SetSamplingPolicy(policy) + req, err := http.NewRequest("GET", "http://example.com/foo", nil) + if err != nil { + t.Fatal(err) + } + if header != "" { + req.Header.Set("X-Cloud-Trace-Context", header) + } + + span := traceClient.SpanFromRequest(req) + + req2, err := http.NewRequest("GET", "http://example.com/bar", nil) + if err != nil { + t.Fatal(err) + } + req3, err := http.NewRequest("GET", "http://example.com/baz", nil) + if err != nil { + t.Fatal(err) + } + span.NewRemoteChild(req2) + span.NewRemoteChild(req3) + + var ( + t1, t2, t3 string + s1, s2, s3 uint64 + o1, o2, o3 uint64 + ) + fmt.Sscanf(header, "%32s/%d;o=%d", &t1, &s1, &o1) + fmt.Sscanf(req2.Header.Get("X-Cloud-Trace-Context"), "%32s/%d;o=%d", &t2, &s2, &o2) + fmt.Sscanf(req3.Header.Get("X-Cloud-Trace-Context"), "%32s/%d;o=%d", &t3, &s3, &o3) + + if header == "" { + if t2 != t3 { + t.Errorf("expected the same trace ID in child requests, got %q %q", t2, t3) + } + } else { + if t2 != t1 || t3 != t1 { + t.Errorf("trace IDs should be passed to child requests") + } + } + trace := policy == alwaysTrace{} || policy == nil && (o1&1) != 0 + if header == "" { + if trace && (s2 == 0 || s3 == 0) { + t.Errorf("got span IDs %d %d in child requests, want nonzero", s2, s3) + } + if trace && s2 == s3 { + t.Errorf("got span IDs %d %d in child requests, should be different", s2, s3) + } + if !trace && (s2 != 0 || s3 != 0) { + t.Errorf("got span IDs %d %d in child requests, want zero", s2, s3) + } + } else { + if trace && (s2 == s1 || s3 == s1 || s2 == s3) { + t.Errorf("parent span IDs in input and outputs should be all different, got %d %d %d", s1, s2, s3) + } + if !trace && (s2 != s1 || s3 != s1) { + t.Errorf("parent span ID in input, %d, should have been equal to parent span IDs in output: %d %d", s1, s2, s3) + } + } + expectTraceOption := policy == alwaysTrace{} || (o1&1) != 0 + if expectTraceOption != ((o2&1) != 0) || expectTraceOption != ((o3&1) != 0) { + t.Errorf("tracing flag in child requests should be %t, got options %d %d", expectTraceOption, o2, o3) + } + } + } +} + +func BenchmarkSpanFromHeader(b *testing.B) { + const header = `0123456789ABCDEF0123456789ABCDEF/42;o=0` + const name = "/foo" + + rt := newFakeRoundTripper() + traceClient := newTestClient(rt) + for n := 0; n < b.N; n++ { + traceClient.SpanFromHeader(name, header) + } +} + +func checkTraces(t *testing.T, patch, expected api.Traces) { + if len(patch.Traces) != len(expected.Traces) || len(patch.Traces[0].Spans) != len(expected.Traces[0].Spans) { + diff := testutil.Diff(patch.Traces, expected.Traces) + t.Logf("diff:\n%s", diff) + got, _ := json.Marshal(patch) + want, _ := json.Marshal(expected) + t.Fatalf("PatchTraces request: got %s want %s", got, want) + } +} diff --git a/vendor/cloud.google.com/go/translate/examples_test.go b/vendor/cloud.google.com/go/translate/examples_test.go new file mode 100644 index 000000000..2e96b068e --- /dev/null +++ b/vendor/cloud.google.com/go/translate/examples_test.go @@ -0,0 +1,81 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package translate_test + +import ( + "context" + "fmt" + + "cloud.google.com/go/translate" + "golang.org/x/text/language" +) + +func Example_NewClient() { + ctx := context.Background() + client, err := translate.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // Use the client. + + // Close the client when finished. + if err := client.Close(); err != nil { + // TODO: handle error. + } +} + +func Example_Translate() { + ctx := context.Background() + client, err := translate.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + translations, err := client.Translate(ctx, + []string{"Le singe est sur la branche"}, language.English, + &translate.Options{ + Source: language.French, + Format: translate.Text, + }) + if err != nil { + // TODO: handle error. + } + fmt.Println(translations[0].Text) +} + +func Example_DetectLanguage() { + ctx := context.Background() + client, err := translate.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + ds, err := client.DetectLanguage(ctx, []string{"Today is Monday"}) + if err != nil { + // TODO: handle error. + } + fmt.Println(ds) +} + +func Example_SupportedLanguages() { + ctx := context.Background() + client, err := translate.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + langs, err := client.SupportedLanguages(ctx, language.English) + if err != nil { + // TODO: handle error. + } + fmt.Println(langs) +} diff --git a/vendor/cloud.google.com/go/translate/internal/translate/v2/README b/vendor/cloud.google.com/go/translate/internal/translate/v2/README new file mode 100644 index 000000000..a4f22c6f9 --- /dev/null +++ b/vendor/cloud.google.com/go/translate/internal/translate/v2/README @@ -0,0 +1,12 @@ +translate-nov2016-api.json is a hand-modified version of translate-api.json. +It correctly reflects the API as of 2016-11-15. + +Differences: + +- Change to base URL +- Addition of OAuth scopes + +To generate: + + + diff --git a/vendor/cloud.google.com/go/translate/internal/translate/v2/regen.sh b/vendor/cloud.google.com/go/translate/internal/translate/v2/regen.sh new file mode 100755 index 000000000..dc8fd9e10 --- /dev/null +++ b/vendor/cloud.google.com/go/translate/internal/translate/v2/regen.sh @@ -0,0 +1,29 @@ +#!/bin/bash -e + + +(cd $GOPATH/src/google.golang.org/api; make generator) + +$GOPATH/bin/google-api-go-generator \ + -api_json_file translate-nov2016-api.json \ + -api_pkg_base cloud.google.com/go/translate/internal \ + -output translate-nov2016-gen.nolicense + +cat - translate-nov2016-gen.nolicense > translate-nov2016-gen.go <" + s + "" + } + tr = translate(htmlify(test.input), test.target, nil) + if got, want := tr.Text, htmlify(test.output); got != want { + t.Errorf("html: got %q, want %q", got, want) + } + // Using the HTML format behaves the same. + tr = translate(htmlify(test.input), test.target, &Options{Format: HTML}) + if got, want := tr.Text, htmlify(test.output); got != want { + t.Errorf("html: got %q, want %q", got, want) + } + } +} + +// This tests the beta "nmt" model. +func TestTranslateModel(t *testing.T) { + ctx := context.Background() + c := initTest(ctx, t) + defer c.Close() + + trs, err := c.Translate(ctx, []string{"Hello"}, language.French, &Options{Model: "nmt"}) + if err != nil { + t.Fatal(err) + } + if len(trs) != 1 { + t.Fatalf("wanted one Translation, got %d", len(trs)) + } + tr := trs[0] + if got, want := tr.Text, "Bonjour"; got != want { + t.Errorf("text: got %q, want %q", got, want) + } + if got, want := tr.Model, "nmt"; got != want { + t.Errorf("model: got %q, want %q", got, want) + } +} + +func TestTranslateMultipleInputs(t *testing.T) { + ctx := context.Background() + c := initTest(ctx, t) + defer c.Close() + + inputs := []string{ + "When you're a Jet, you're a Jet all the way", + "From your first cigarette to your last dying day", + "When you're a Jet if the spit hits the fan", + "You got brothers around, you're a family man", + } + ts, err := c.Translate(ctx, inputs, language.French, nil) + if err != nil { + t.Fatal(err) + } + if got, want := len(ts), len(inputs); got != want { + t.Fatalf("got %d Translations, wanted %d", got, want) + } +} + +func TestTranslateErrors(t *testing.T) { + ctx := context.Background() + c := initTest(ctx, t) + defer c.Close() + + for _, test := range []struct { + ctx context.Context + target language.Tag + inputs []string + opts *Options + }{ + {ctx, language.English, nil, nil}, + {ctx, language.Und, []string{"input"}, nil}, + {ctx, language.English, []string{}, nil}, + {ctx, language.English, []string{"input"}, &Options{Format: "random"}}, + } { + _, err := c.Translate(test.ctx, test.inputs, test.target, test.opts) + if err == nil { + t.Errorf("%+v: got nil, want error", test) + } + } +} + +func TestDetectLanguage(t *testing.T) { + ctx := context.Background() + c := initTest(ctx, t) + defer c.Close() + ds, err := c.DetectLanguage(ctx, []string{ + "Today is Monday", + "Aujourd'hui est lundi", + }) + if err != nil { + t.Fatal(err) + } + if len(ds) != 2 { + t.Fatalf("got %d detection lists, want 2", len(ds)) + } + checkDetections(t, ds[0], language.English) + checkDetections(t, ds[1], language.French) +} + +func checkDetections(t *testing.T, ds []Detection, want language.Tag) { + for _, d := range ds { + if d.Language == want { + return + } + } + t.Errorf("%v: missing %s", ds, want) +} + +// A small subset of the supported languages. +var supportedLangs = []Language{ + {Name: "Danish", Tag: language.Danish}, + {Name: "English", Tag: language.English}, + {Name: "French", Tag: language.French}, + {Name: "German", Tag: language.German}, + {Name: "Greek", Tag: language.Greek}, + {Name: "Hindi", Tag: language.Hindi}, + {Name: "Hungarian", Tag: language.Hungarian}, + {Name: "Italian", Tag: language.Italian}, + {Name: "Russian", Tag: language.Russian}, + {Name: "Turkish", Tag: language.Turkish}, +} + +func TestSupportedLanguages(t *testing.T) { + ctx := context.Background() + c := initTest(ctx, t) + defer c.Close() + got, err := c.SupportedLanguages(ctx, language.English) + if err != nil { + t.Fatal(err) + } + want := map[language.Tag]Language{} + for _, sl := range supportedLangs { + want[sl.Tag] = sl + } + for _, g := range got { + w, ok := want[g.Tag] + if !ok { + continue + } + if g != w { + t.Errorf("got %+v, want %+v", g, w) + } + delete(want, g.Tag) + } + if len(want) > 0 { + t.Errorf("missing: %+v", want) + } +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1/AnnotateVideo_smoke_test.go b/vendor/cloud.google.com/go/videointelligence/apiv1/AnnotateVideo_smoke_test.go new file mode 100644 index 000000000..9f28854c7 --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1/AnnotateVideo_smoke_test.go @@ -0,0 +1,69 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence + +import ( + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestVideoIntelligenceServiceSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var inputUri string = "gs://demomaker/cat.mp4" + var featuresElement videointelligencepb.Feature = videointelligencepb.Feature_LABEL_DETECTION + var features = []videointelligencepb.Feature{featuresElement} + var request = &videointelligencepb.AnnotateVideoRequest{ + InputUri: inputUri, + Features: features, + } + + if _, err := c.AnnotateVideo(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1/doc.go b/vendor/cloud.google.com/go/videointelligence/apiv1/doc.go new file mode 100644 index 000000000..9c79b9a11 --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package videointelligence is an auto-generated package for the +// Cloud Video Intelligence API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Cloud Video Intelligence API. +package videointelligence // import "cloud.google.com/go/videointelligence/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1/mock_test.go b/vendor/cloud.google.com/go/videointelligence/apiv1/mock_test.go new file mode 100644 index 000000000..59919e0a6 --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1/mock_test.go @@ -0,0 +1,192 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence + +import ( + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockVideoIntelligenceServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + videointelligencepb.VideoIntelligenceServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockVideoIntelligenceServer) AnnotateVideo(ctx context.Context, req *videointelligencepb.AnnotateVideoRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockVideoIntelligence mockVideoIntelligenceServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + videointelligencepb.RegisterVideoIntelligenceServiceServer(serv, &mockVideoIntelligence) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestVideoIntelligenceServiceAnnotateVideo(t *testing.T) { + var expectedResponse *videointelligencepb.AnnotateVideoResponse = &videointelligencepb.AnnotateVideoResponse{} + + mockVideoIntelligence.err = nil + mockVideoIntelligence.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockVideoIntelligence.resps = append(mockVideoIntelligence.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var inputUri string = "gs://demomaker/cat.mp4" + var featuresElement videointelligencepb.Feature = videointelligencepb.Feature_LABEL_DETECTION + var features = []videointelligencepb.Feature{featuresElement} + var request = &videointelligencepb.AnnotateVideoRequest{ + InputUri: inputUri, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.AnnotateVideo(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockVideoIntelligence.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestVideoIntelligenceServiceAnnotateVideoError(t *testing.T) { + errCode := codes.PermissionDenied + mockVideoIntelligence.err = nil + mockVideoIntelligence.resps = append(mockVideoIntelligence.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var inputUri string = "gs://demomaker/cat.mp4" + var featuresElement videointelligencepb.Feature = videointelligencepb.Feature_LABEL_DETECTION + var features = []videointelligencepb.Feature{featuresElement} + var request = &videointelligencepb.AnnotateVideoRequest{ + InputUri: inputUri, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.AnnotateVideo(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1/video_intelligence_client.go b/vendor/cloud.google.com/go/videointelligence/apiv1/video_intelligence_client.go new file mode 100644 index 000000000..e16d1dd1d --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1/video_intelligence_client.go @@ -0,0 +1,226 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence + +import ( + "context" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + AnnotateVideo []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("videointelligence.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 120000 * time.Millisecond, + Multiplier: 2.5, + }) + }), + }, + } + return &CallOptions{ + AnnotateVideo: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Cloud Video Intelligence API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client videointelligencepb.VideoIntelligenceServiceClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new video intelligence service client. +// +// Service that implements Google Cloud Video Intelligence API. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: videointelligencepb.NewVideoIntelligenceServiceClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// AnnotateVideo performs asynchronous video annotation. Progress and results can be +// retrieved through the google.longrunning.Operations interface. +// Operation.metadata contains AnnotateVideoProgress (progress). +// Operation.response contains AnnotateVideoResponse (results). +func (c *Client) AnnotateVideo(ctx context.Context, req *videointelligencepb.AnnotateVideoRequest, opts ...gax.CallOption) (*AnnotateVideoOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnnotateVideo[0:len(c.CallOptions.AnnotateVideo):len(c.CallOptions.AnnotateVideo)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnnotateVideo(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &AnnotateVideoOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// AnnotateVideoOperation manages a long-running operation from AnnotateVideo. +type AnnotateVideoOperation struct { + lro *longrunning.Operation +} + +// AnnotateVideoOperation returns a new AnnotateVideoOperation from a given name. +// The name must be that of a previously created AnnotateVideoOperation, possibly from a different process. +func (c *Client) AnnotateVideoOperation(name string) *AnnotateVideoOperation { + return &AnnotateVideoOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *AnnotateVideoOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*videointelligencepb.AnnotateVideoResponse, error) { + var resp videointelligencepb.AnnotateVideoResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *AnnotateVideoOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*videointelligencepb.AnnotateVideoResponse, error) { + var resp videointelligencepb.AnnotateVideoResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *AnnotateVideoOperation) Metadata() (*videointelligencepb.AnnotateVideoProgress, error) { + var meta videointelligencepb.AnnotateVideoProgress + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *AnnotateVideoOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *AnnotateVideoOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1/video_intelligence_client_example_test.go b/vendor/cloud.google.com/go/videointelligence/apiv1/video_intelligence_client_example_test.go new file mode 100644 index 000000000..9586594a7 --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1/video_intelligence_client_example_test.go @@ -0,0 +1,57 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence_test + +import ( + "context" + + videointelligence "cloud.google.com/go/videointelligence/apiv1" + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := videointelligence.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_AnnotateVideo() { + ctx := context.Background() + c, err := videointelligence.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &videointelligencepb.AnnotateVideoRequest{ + // TODO: Fill request struct fields. + } + op, err := c.AnnotateVideo(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1beta1/doc.go b/vendor/cloud.google.com/go/videointelligence/apiv1beta1/doc.go new file mode 100644 index 000000000..00b740e35 --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1beta1/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package videointelligence is an auto-generated package for the +// Google Cloud Video Intelligence API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Google Cloud Video Intelligence API. +package videointelligence // import "cloud.google.com/go/videointelligence/apiv1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1beta1/mock_test.go b/vendor/cloud.google.com/go/videointelligence/apiv1beta1/mock_test.go new file mode 100644 index 000000000..bcf22f7ef --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1beta1/mock_test.go @@ -0,0 +1,192 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence + +import ( + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockVideoIntelligenceServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + videointelligencepb.VideoIntelligenceServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockVideoIntelligenceServer) AnnotateVideo(ctx context.Context, req *videointelligencepb.AnnotateVideoRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockVideoIntelligence mockVideoIntelligenceServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + videointelligencepb.RegisterVideoIntelligenceServiceServer(serv, &mockVideoIntelligence) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestVideoIntelligenceServiceAnnotateVideo(t *testing.T) { + var expectedResponse *videointelligencepb.AnnotateVideoResponse = &videointelligencepb.AnnotateVideoResponse{} + + mockVideoIntelligence.err = nil + mockVideoIntelligence.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockVideoIntelligence.resps = append(mockVideoIntelligence.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var inputUri string = "gs://demomaker/cat.mp4" + var featuresElement videointelligencepb.Feature = videointelligencepb.Feature_LABEL_DETECTION + var features = []videointelligencepb.Feature{featuresElement} + var request = &videointelligencepb.AnnotateVideoRequest{ + InputUri: inputUri, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.AnnotateVideo(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockVideoIntelligence.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestVideoIntelligenceServiceAnnotateVideoError(t *testing.T) { + errCode := codes.PermissionDenied + mockVideoIntelligence.err = nil + mockVideoIntelligence.resps = append(mockVideoIntelligence.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var inputUri string = "gs://demomaker/cat.mp4" + var featuresElement videointelligencepb.Feature = videointelligencepb.Feature_LABEL_DETECTION + var features = []videointelligencepb.Feature{featuresElement} + var request = &videointelligencepb.AnnotateVideoRequest{ + InputUri: inputUri, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.AnnotateVideo(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1beta1/video_intelligence_client.go b/vendor/cloud.google.com/go/videointelligence/apiv1beta1/video_intelligence_client.go new file mode 100644 index 000000000..f3003935a --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1beta1/video_intelligence_client.go @@ -0,0 +1,226 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence + +import ( + "context" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + AnnotateVideo []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("videointelligence.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 120000 * time.Millisecond, + Multiplier: 2.5, + }) + }), + }, + } + return &CallOptions{ + AnnotateVideo: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Google Cloud Video Intelligence API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client videointelligencepb.VideoIntelligenceServiceClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new video intelligence service client. +// +// Service that implements Google Cloud Video Intelligence API. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: videointelligencepb.NewVideoIntelligenceServiceClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// AnnotateVideo performs asynchronous video annotation. Progress and results can be +// retrieved through the google.longrunning.Operations interface. +// Operation.metadata contains AnnotateVideoProgress (progress). +// Operation.response contains AnnotateVideoResponse (results). +func (c *Client) AnnotateVideo(ctx context.Context, req *videointelligencepb.AnnotateVideoRequest, opts ...gax.CallOption) (*AnnotateVideoOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnnotateVideo[0:len(c.CallOptions.AnnotateVideo):len(c.CallOptions.AnnotateVideo)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnnotateVideo(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &AnnotateVideoOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// AnnotateVideoOperation manages a long-running operation from AnnotateVideo. +type AnnotateVideoOperation struct { + lro *longrunning.Operation +} + +// AnnotateVideoOperation returns a new AnnotateVideoOperation from a given name. +// The name must be that of a previously created AnnotateVideoOperation, possibly from a different process. +func (c *Client) AnnotateVideoOperation(name string) *AnnotateVideoOperation { + return &AnnotateVideoOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *AnnotateVideoOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*videointelligencepb.AnnotateVideoResponse, error) { + var resp videointelligencepb.AnnotateVideoResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *AnnotateVideoOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*videointelligencepb.AnnotateVideoResponse, error) { + var resp videointelligencepb.AnnotateVideoResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *AnnotateVideoOperation) Metadata() (*videointelligencepb.AnnotateVideoProgress, error) { + var meta videointelligencepb.AnnotateVideoProgress + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *AnnotateVideoOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *AnnotateVideoOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1beta1/video_intelligence_client_example_test.go b/vendor/cloud.google.com/go/videointelligence/apiv1beta1/video_intelligence_client_example_test.go new file mode 100644 index 000000000..6e4cd8118 --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1beta1/video_intelligence_client_example_test.go @@ -0,0 +1,57 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence_test + +import ( + "context" + + videointelligence "cloud.google.com/go/videointelligence/apiv1beta1" + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := videointelligence.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_AnnotateVideo() { + ctx := context.Background() + c, err := videointelligence.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &videointelligencepb.AnnotateVideoRequest{ + // TODO: Fill request struct fields. + } + op, err := c.AnnotateVideo(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1beta2/doc.go b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/doc.go new file mode 100644 index 000000000..3f72b902f --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/doc.go @@ -0,0 +1,89 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package videointelligence is an auto-generated package for the +// Google Cloud Video Intelligence API. +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// Google Cloud Video Intelligence API. +package videointelligence // import "cloud.google.com/go/videointelligence/apiv1beta2" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1beta2/mock_test.go b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/mock_test.go new file mode 100644 index 000000000..4214c26da --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/mock_test.go @@ -0,0 +1,192 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence + +import ( + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockVideoIntelligenceServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + videointelligencepb.VideoIntelligenceServiceServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockVideoIntelligenceServer) AnnotateVideo(ctx context.Context, req *videointelligencepb.AnnotateVideoRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockVideoIntelligence mockVideoIntelligenceServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + videointelligencepb.RegisterVideoIntelligenceServiceServer(serv, &mockVideoIntelligence) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestVideoIntelligenceServiceAnnotateVideo(t *testing.T) { + var expectedResponse *videointelligencepb.AnnotateVideoResponse = &videointelligencepb.AnnotateVideoResponse{} + + mockVideoIntelligence.err = nil + mockVideoIntelligence.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockVideoIntelligence.resps = append(mockVideoIntelligence.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var inputUri string = "gs://demomaker/cat.mp4" + var featuresElement videointelligencepb.Feature = videointelligencepb.Feature_LABEL_DETECTION + var features = []videointelligencepb.Feature{featuresElement} + var request = &videointelligencepb.AnnotateVideoRequest{ + InputUri: inputUri, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.AnnotateVideo(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockVideoIntelligence.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestVideoIntelligenceServiceAnnotateVideoError(t *testing.T) { + errCode := codes.PermissionDenied + mockVideoIntelligence.err = nil + mockVideoIntelligence.resps = append(mockVideoIntelligence.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var inputUri string = "gs://demomaker/cat.mp4" + var featuresElement videointelligencepb.Feature = videointelligencepb.Feature_LABEL_DETECTION + var features = []videointelligencepb.Feature{featuresElement} + var request = &videointelligencepb.AnnotateVideoRequest{ + InputUri: inputUri, + Features: features, + } + + c, err := NewClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.AnnotateVideo(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1beta2/video_intelligence_client.go b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/video_intelligence_client.go new file mode 100644 index 000000000..d662165e7 --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/video_intelligence_client.go @@ -0,0 +1,226 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence + +import ( + "context" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + AnnotateVideo []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("videointelligence.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultCallOptions() *CallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 1000 * time.Millisecond, + Max: 120000 * time.Millisecond, + Multiplier: 2.5, + }) + }), + }, + } + return &CallOptions{ + AnnotateVideo: retry[[2]string{"default", "idempotent"}], + } +} + +// Client is a client for interacting with Google Cloud Video Intelligence API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + client videointelligencepb.VideoIntelligenceServiceClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new video intelligence service client. +// +// Service that implements Google Cloud Video Intelligence API. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + conn: conn, + CallOptions: defaultCallOptions(), + + client: videointelligencepb.NewVideoIntelligenceServiceClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *Client) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// AnnotateVideo performs asynchronous video annotation. Progress and results can be +// retrieved through the google.longrunning.Operations interface. +// Operation.metadata contains AnnotateVideoProgress (progress). +// Operation.response contains AnnotateVideoResponse (results). +func (c *Client) AnnotateVideo(ctx context.Context, req *videointelligencepb.AnnotateVideoRequest, opts ...gax.CallOption) (*AnnotateVideoOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AnnotateVideo[0:len(c.CallOptions.AnnotateVideo):len(c.CallOptions.AnnotateVideo)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.AnnotateVideo(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &AnnotateVideoOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// AnnotateVideoOperation manages a long-running operation from AnnotateVideo. +type AnnotateVideoOperation struct { + lro *longrunning.Operation +} + +// AnnotateVideoOperation returns a new AnnotateVideoOperation from a given name. +// The name must be that of a previously created AnnotateVideoOperation, possibly from a different process. +func (c *Client) AnnotateVideoOperation(name string) *AnnotateVideoOperation { + return &AnnotateVideoOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *AnnotateVideoOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*videointelligencepb.AnnotateVideoResponse, error) { + var resp videointelligencepb.AnnotateVideoResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *AnnotateVideoOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*videointelligencepb.AnnotateVideoResponse, error) { + var resp videointelligencepb.AnnotateVideoResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *AnnotateVideoOperation) Metadata() (*videointelligencepb.AnnotateVideoProgress, error) { + var meta videointelligencepb.AnnotateVideoProgress + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *AnnotateVideoOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *AnnotateVideoOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1beta2/video_intelligence_client_example_test.go b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/video_intelligence_client_example_test.go new file mode 100644 index 000000000..e4a18f0c2 --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/video_intelligence_client_example_test.go @@ -0,0 +1,57 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package videointelligence_test + +import ( + "context" + + videointelligence "cloud.google.com/go/videointelligence/apiv1beta2" + videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := videointelligence.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_AnnotateVideo() { + ctx := context.Background() + c, err := videointelligence.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &videointelligencepb.AnnotateVideoRequest{ + // TODO: Fill request struct fields. + } + op, err := c.AnnotateVideo(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/videointelligence/apiv1beta2/whitelist.go b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/whitelist.go new file mode 100644 index 000000000..d0e057e70 --- /dev/null +++ b/vendor/cloud.google.com/go/videointelligence/apiv1beta2/whitelist.go @@ -0,0 +1,16 @@ +// Copyright 2017, Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// THIS API IS CURRENTLY UNDER WHITELIST. +package videointelligence diff --git a/vendor/cloud.google.com/go/vision/apiv1/BatchAnnotateImages_smoke_test.go b/vendor/cloud.google.com/go/vision/apiv1/BatchAnnotateImages_smoke_test.go new file mode 100644 index 000000000..a4d993883 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/BatchAnnotateImages_smoke_test.go @@ -0,0 +1,82 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision + +import ( + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestImageAnnotatorSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewImageAnnotatorClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var gcsImageUri string = "gs://gapic-toolkit/President_Barack_Obama.jpg" + var source = &visionpb.ImageSource{ + GcsImageUri: gcsImageUri, + } + var image = &visionpb.Image{ + Source: source, + } + var type_ visionpb.Feature_Type = visionpb.Feature_FACE_DETECTION + var featuresElement = &visionpb.Feature{ + Type: type_, + } + var features = []*visionpb.Feature{featuresElement} + var requestsElement = &visionpb.AnnotateImageRequest{ + Image: image, + Features: features, + } + var requests = []*visionpb.AnnotateImageRequest{requestsElement} + var request = &visionpb.BatchAnnotateImagesRequest{ + Requests: requests, + } + + if _, err := c.BatchAnnotateImages(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/README.md b/vendor/cloud.google.com/go/vision/apiv1/README.md new file mode 100644 index 000000000..bcfa08dd0 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/README.md @@ -0,0 +1,9 @@ +Auto-generated vision v1 clients +================================= + +This package includes auto-generated clients for the vision v1 API. + +Use the handwritten client (in the parent directory, +cloud.google.com/go/vision) in preference to this. + +This code is EXPERIMENTAL and subject to CHANGE AT ANY TIME. diff --git a/vendor/cloud.google.com/go/vision/apiv1/client.go b/vendor/cloud.google.com/go/vision/apiv1/client.go new file mode 100644 index 000000000..77ae33e0c --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/client.go @@ -0,0 +1,170 @@ +// Copyright 2017, 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 vision + +import ( + "context" + + gax "github.com/googleapis/gax-go" + pb "google.golang.org/genproto/googleapis/cloud/vision/v1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// AnnotateImage runs image detection and annotation for a single image. +func (c *ImageAnnotatorClient) AnnotateImage(ctx context.Context, req *pb.AnnotateImageRequest, opts ...gax.CallOption) (*pb.AnnotateImageResponse, error) { + res, err := c.BatchAnnotateImages(ctx, &pb.BatchAnnotateImagesRequest{ + Requests: []*pb.AnnotateImageRequest{req}, + }, opts...) + if err != nil { + return nil, err + } + return res.Responses[0], nil +} + +// Called for a single image and a single feature. +func (c *ImageAnnotatorClient) annotateOne(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, ftype pb.Feature_Type, maxResults int, opts []gax.CallOption) (*pb.AnnotateImageResponse, error) { + res, err := c.AnnotateImage(ctx, &pb.AnnotateImageRequest{ + Image: img, + ImageContext: ictx, + Features: []*pb.Feature{{Type: ftype, MaxResults: int32(maxResults)}}, + }, opts...) + if err != nil { + return nil, err + } + // When there is only one image and one feature, the response's Error field is + // unambiguously about that one detection, so we "promote" it to the error return + // value. + // res.Error is a google.rpc.Status. Convert to a Go error. Use a gRPC + // error because it preserves the code as a separate field. + // TODO(jba): preserve the details field. + if res.Error != nil { + return nil, status.Errorf(codes.Code(res.Error.Code), "%s", res.Error.Message) + } + return res, nil +} + +// DetectFaces performs face detection on the image. +// At most maxResults results are returned. +func (c *ImageAnnotatorClient) DetectFaces(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, maxResults int, opts ...gax.CallOption) ([]*pb.FaceAnnotation, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_FACE_DETECTION, maxResults, opts) + if err != nil { + return nil, err + } + return res.FaceAnnotations, nil +} + +// DetectLandmarks performs landmark detection on the image. +// At most maxResults results are returned. +func (c *ImageAnnotatorClient) DetectLandmarks(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, maxResults int, opts ...gax.CallOption) ([]*pb.EntityAnnotation, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_LANDMARK_DETECTION, maxResults, opts) + if err != nil { + return nil, err + } + return res.LandmarkAnnotations, nil +} + +// DetectLogos performs logo detection on the image. +// At most maxResults results are returned. +func (c *ImageAnnotatorClient) DetectLogos(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, maxResults int, opts ...gax.CallOption) ([]*pb.EntityAnnotation, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_LOGO_DETECTION, maxResults, opts) + if err != nil { + return nil, err + } + return res.LogoAnnotations, nil +} + +// DetectLabels performs label detection on the image. +// At most maxResults results are returned. +func (c *ImageAnnotatorClient) DetectLabels(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, maxResults int, opts ...gax.CallOption) ([]*pb.EntityAnnotation, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_LABEL_DETECTION, maxResults, opts) + if err != nil { + return nil, err + } + return res.LabelAnnotations, nil +} + +// DetectTexts performs text detection on the image. +// At most maxResults results are returned. +func (c *ImageAnnotatorClient) DetectTexts(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, maxResults int, opts ...gax.CallOption) ([]*pb.EntityAnnotation, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_TEXT_DETECTION, maxResults, opts) + if err != nil { + return nil, err + } + return res.TextAnnotations, nil +} + +// DetectDocumentText performs full text (OCR) detection on the image. +func (c *ImageAnnotatorClient) DetectDocumentText(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, opts ...gax.CallOption) (*pb.TextAnnotation, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_DOCUMENT_TEXT_DETECTION, 0, opts) + if err != nil { + return nil, err + } + return res.FullTextAnnotation, nil +} + +// DetectSafeSearch performs safe-search detection on the image. +func (c *ImageAnnotatorClient) DetectSafeSearch(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, opts ...gax.CallOption) (*pb.SafeSearchAnnotation, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_SAFE_SEARCH_DETECTION, 0, opts) + if err != nil { + return nil, err + } + return res.SafeSearchAnnotation, nil +} + +// DetectImageProperties computes properties of the image. +func (c *ImageAnnotatorClient) DetectImageProperties(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, opts ...gax.CallOption) (*pb.ImageProperties, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_IMAGE_PROPERTIES, 0, opts) + if err != nil { + return nil, err + } + return res.ImagePropertiesAnnotation, nil +} + +// DetectWeb computes a web annotation on the image. +func (c *ImageAnnotatorClient) DetectWeb(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, opts ...gax.CallOption) (*pb.WebDetection, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_WEB_DETECTION, 0, opts) + if err != nil { + return nil, err + } + return res.WebDetection, nil +} + +// CropHints computes crop hints for the image. +func (c *ImageAnnotatorClient) CropHints(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, opts ...gax.CallOption) (*pb.CropHintsAnnotation, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_CROP_HINTS, 0, opts) + if err != nil { + return nil, err + } + return res.CropHintsAnnotation, nil +} + +// LocalizeObject runs the localizer for object detection. +func (c *ImageAnnotatorClient) LocalizeObjects(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, opts ...gax.CallOption) ([]*pb.LocalizedObjectAnnotation, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_OBJECT_LOCALIZATION, 0, opts) + if err != nil { + return nil, err + } + return res.LocalizedObjectAnnotations, nil +} + +// ProductSearch searches the image for products. +func (c *ImageAnnotatorClient) ProductSearch(ctx context.Context, img *pb.Image, ictx *pb.ImageContext, opts ...gax.CallOption) (*pb.ProductSearchResults, error) { + res, err := c.annotateOne(ctx, img, ictx, pb.Feature_PRODUCT_SEARCH, 0, opts) + if err != nil { + return nil, err + } + return res.ProductSearchResults, nil +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/client_test.go b/vendor/cloud.google.com/go/vision/apiv1/client_test.go new file mode 100644 index 000000000..c997eaae7 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/client_test.go @@ -0,0 +1,210 @@ +// Copyright 2017, 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 vision + +import ( + "context" + "fmt" + "reflect" + "testing" + + "github.com/golang/protobuf/proto" + pb "google.golang.org/genproto/googleapis/cloud/vision/v1" + "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +var batchResponse = &pb.BatchAnnotateImagesResponse{ + Responses: []*pb.AnnotateImageResponse{{ + FaceAnnotations: []*pb.FaceAnnotation{ + {RollAngle: 1}, {RollAngle: 2}}, + LandmarkAnnotations: []*pb.EntityAnnotation{{Mid: "landmark"}}, + LogoAnnotations: []*pb.EntityAnnotation{{Mid: "logo"}}, + LabelAnnotations: []*pb.EntityAnnotation{{Mid: "label"}}, + TextAnnotations: []*pb.EntityAnnotation{{Mid: "text"}}, + FullTextAnnotation: &pb.TextAnnotation{Text: "full"}, + SafeSearchAnnotation: &pb.SafeSearchAnnotation{Spoof: pb.Likelihood_POSSIBLE}, + ImagePropertiesAnnotation: &pb.ImageProperties{DominantColors: &pb.DominantColorsAnnotation{}}, + CropHintsAnnotation: &pb.CropHintsAnnotation{CropHints: []*pb.CropHint{{Confidence: 0.5}}}, + WebDetection: &pb.WebDetection{WebEntities: []*pb.WebDetection_WebEntity{{EntityId: "web"}}}, + }}, +} + +// Verify that all the "shortcut" methods use the underlying +// BatchAnnotateImages RPC correctly. +func TestClientMethods(t *testing.T) { + ctx := context.Background() + c, err := NewImageAnnotatorClient(ctx, clientOpt) + if err != nil { + t.Fatal(err) + } + + mockImageAnnotator.resps = []proto.Message{batchResponse} + img := &pb.Image{Source: &pb.ImageSource{ImageUri: "http://foo.jpg"}} + ictx := &pb.ImageContext{LanguageHints: []string{"en", "fr"}} + req := &pb.AnnotateImageRequest{ + Image: img, + ImageContext: ictx, + Features: []*pb.Feature{ + {Type: pb.Feature_LABEL_DETECTION, MaxResults: 3}, + {Type: pb.Feature_FACE_DETECTION, MaxResults: 4}, + }, + } + + for i, test := range []struct { + call func() (interface{}, error) + wantFeatures []*pb.Feature + wantRes interface{} + }{ + { + func() (interface{}, error) { return c.AnnotateImage(ctx, req) }, + req.Features, batchResponse.Responses[0], + }, + { + func() (interface{}, error) { return c.DetectFaces(ctx, img, ictx, 2) }, + []*pb.Feature{{Type: pb.Feature_FACE_DETECTION, MaxResults: 2}}, + batchResponse.Responses[0].FaceAnnotations, + }, + { + func() (interface{}, error) { return c.DetectLandmarks(ctx, img, ictx, 2) }, + []*pb.Feature{{Type: pb.Feature_LANDMARK_DETECTION, MaxResults: 2}}, + batchResponse.Responses[0].LandmarkAnnotations, + }, + { + func() (interface{}, error) { return c.DetectLogos(ctx, img, ictx, 2) }, + []*pb.Feature{{Type: pb.Feature_LOGO_DETECTION, MaxResults: 2}}, + batchResponse.Responses[0].LogoAnnotations, + }, + { + func() (interface{}, error) { return c.DetectLabels(ctx, img, ictx, 2) }, + []*pb.Feature{{Type: pb.Feature_LABEL_DETECTION, MaxResults: 2}}, + batchResponse.Responses[0].LabelAnnotations, + }, + { + func() (interface{}, error) { return c.DetectTexts(ctx, img, ictx, 2) }, + []*pb.Feature{{Type: pb.Feature_TEXT_DETECTION, MaxResults: 2}}, + batchResponse.Responses[0].TextAnnotations, + }, + { + func() (interface{}, error) { return c.DetectDocumentText(ctx, img, ictx) }, + []*pb.Feature{{Type: pb.Feature_DOCUMENT_TEXT_DETECTION, MaxResults: 0}}, + batchResponse.Responses[0].FullTextAnnotation, + }, + { + func() (interface{}, error) { return c.DetectSafeSearch(ctx, img, ictx) }, + []*pb.Feature{{Type: pb.Feature_SAFE_SEARCH_DETECTION, MaxResults: 0}}, + batchResponse.Responses[0].SafeSearchAnnotation, + }, + { + func() (interface{}, error) { return c.DetectImageProperties(ctx, img, ictx) }, + []*pb.Feature{{Type: pb.Feature_IMAGE_PROPERTIES, MaxResults: 0}}, + batchResponse.Responses[0].ImagePropertiesAnnotation, + }, + { + func() (interface{}, error) { return c.DetectWeb(ctx, img, ictx) }, + []*pb.Feature{{Type: pb.Feature_WEB_DETECTION, MaxResults: 0}}, + batchResponse.Responses[0].WebDetection, + }, + { + func() (interface{}, error) { return c.CropHints(ctx, img, ictx) }, + []*pb.Feature{{Type: pb.Feature_CROP_HINTS, MaxResults: 0}}, + batchResponse.Responses[0].CropHintsAnnotation, + }, + { + func() (interface{}, error) { return c.LocalizeObjects(ctx, img, ictx) }, + []*pb.Feature{{Type: pb.Feature_OBJECT_LOCALIZATION, MaxResults: 0}}, + batchResponse.Responses[0].LocalizedObjectAnnotations, + }, + { + func() (interface{}, error) { return c.ProductSearch(ctx, img, ictx) }, + []*pb.Feature{{Type: pb.Feature_PRODUCT_SEARCH, MaxResults: 0}}, + batchResponse.Responses[0].ProductSearchResults, + }, + } { + mockImageAnnotator.reqs = nil + res, err := test.call() + if err != nil { + t.Fatal(err) + } + got := mockImageAnnotator.reqs[0] + want := &pb.BatchAnnotateImagesRequest{ + Requests: []*pb.AnnotateImageRequest{{ + Image: img, + ImageContext: ictx, + Features: test.wantFeatures, + }}, + } + if !testEqual(got, want) { + t.Errorf("#%d:\ngot %v\nwant %v", i, got, want) + } + if got, want := res, test.wantRes; !testEqual(got, want) { + t.Errorf("#%d:\ngot %v\nwant %v", i, got, want) + } + } + +} + +func testEqual(a, b interface{}) bool { + if a == nil && b == nil { + return true + } + if a == nil || b == nil { + return false + } + t := reflect.TypeOf(a) + if t != reflect.TypeOf(b) { + return false + } + if am, ok := a.(proto.Message); ok { + return proto.Equal(am, b.(proto.Message)) + } + if t.Kind() != reflect.Slice { + panic(fmt.Sprintf("testEqual can only handle proto.Message and slices, got %s", t)) + } + va := reflect.ValueOf(a) + vb := reflect.ValueOf(b) + if va.Len() != vb.Len() { + return false + } + for i := 0; i < va.Len(); i++ { + if !testEqual(va.Index(i).Interface(), vb.Index(i).Interface()) { + return false + } + } + return true +} + +func TestAnnotateOneError(t *testing.T) { + ctx := context.Background() + c, err := NewImageAnnotatorClient(ctx, clientOpt) + if err != nil { + t.Fatal(err) + } + mockImageAnnotator.resps = []proto.Message{ + &pb.BatchAnnotateImagesResponse{ + Responses: []*pb.AnnotateImageResponse{{ + Error: &status.Status{Code: int32(codes.NotFound), Message: "not found"}, + }}, + }, + } + + _, err = c.annotateOne(ctx, + &pb.Image{Source: &pb.ImageSource{ImageUri: "http://foo.jpg"}}, + nil, pb.Feature_LOGO_DETECTION, 1, nil) + if c := grpc.Code(err); c != codes.NotFound { + t.Errorf("got %v, want NotFound", c) + } +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/doc.go b/vendor/cloud.google.com/go/vision/apiv1/doc.go new file mode 100644 index 000000000..43445248e --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/doc.go @@ -0,0 +1,92 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package vision is an auto-generated package for the +// Cloud Vision API. + +// +// Integrates Google Vision features, including image labeling, face, logo, +// and +// landmark detection, optical character recognition (OCR), and detection of +// explicit content, into applications. +package vision // import "cloud.google.com/go/vision/apiv1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/vision/apiv1/examples_test.go b/vendor/cloud.google.com/go/vision/apiv1/examples_test.go new file mode 100644 index 000000000..94650c99e --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/examples_test.go @@ -0,0 +1,92 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vision_test + +import ( + "context" + "fmt" + "os" + + vision "cloud.google.com/go/vision/apiv1" + pb "google.golang.org/genproto/googleapis/cloud/vision/v1" +) + +func Example_NewImageFromReader() { + f, err := os.Open("path/to/image.jpg") + if err != nil { + // TODO: handle error. + } + img, err := vision.NewImageFromReader(f) + if err != nil { + // TODO: handle error. + } + fmt.Println(img) +} + +func Example_NewImageFromURI() { + img := vision.NewImageFromURI("gs://my-bucket/my-image.png") + fmt.Println(img) +} + +func ExampleImageAnnotatorClient_AnnotateImage() { + ctx := context.Background() + c, err := vision.NewImageAnnotatorClient(ctx) + if err != nil { + // TODO: Handle error. + } + res, err := c.AnnotateImage(ctx, &pb.AnnotateImageRequest{ + Image: vision.NewImageFromURI("gs://my-bucket/my-image.png"), + Features: []*pb.Feature{ + {Type: pb.Feature_LANDMARK_DETECTION, MaxResults: 5}, + {Type: pb.Feature_LABEL_DETECTION, MaxResults: 3}, + }, + }) + if err != nil { + // TODO: Handle error. + } + // TODO: Use res. + _ = res +} + +func Example_FaceFromLandmarks() { + ctx := context.Background() + c, err := vision.NewImageAnnotatorClient(ctx) + if err != nil { + // TODO: Handle error. + } + resp, err := c.BatchAnnotateImages(ctx, &pb.BatchAnnotateImagesRequest{ + Requests: []*pb.AnnotateImageRequest{ + { + Image: vision.NewImageFromURI("gs://bucket/image.jpg"), + Features: []*pb.Feature{{ + Type: pb.Feature_FACE_DETECTION, + MaxResults: 5, + }}, + }, + }, + }) + if err != nil { + // TODO: Handle error. + } + res := resp.Responses[0] + if res.Error != nil { + // TODO: Handle error. + } + for _, a := range res.FaceAnnotations { + face := vision.FaceFromLandmarks(a.Landmarks) + fmt.Println(face.Nose.Tip) + fmt.Println(face.Eyes.Left.Pupil) + } +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/face.go b/vendor/cloud.google.com/go/vision/apiv1/face.go new file mode 100644 index 000000000..6758121ba --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/face.go @@ -0,0 +1,153 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vision + +import ( + "log" + + pb "google.golang.org/genproto/googleapis/cloud/vision/v1" +) + +// FaceLandmarks contains the positions of facial features detected by the service. +type FaceLandmarks struct { + Eyebrows Eyebrows + Eyes Eyes + Ears Ears + Nose Nose + Mouth Mouth + Chin Chin + Forehead *pb.Position +} + +// Eyebrows represents a face's eyebrows. +type Eyebrows struct { + Left, Right Eyebrow +} + +// Eyebrow represents a face's eyebrow. +type Eyebrow struct { + Top, Left, Right *pb.Position +} + +// Eyes represents a face's eyes. +type Eyes struct { + Left, Right Eye +} + +// Eye represents a face's eye. +type Eye struct { + Left, Right, Top, Bottom, Center, Pupil *pb.Position +} + +// Ears represents a face's ears. +type Ears struct { + Left, Right *pb.Position +} + +// Nose represents a face's nose. +type Nose struct { + Left, Right, Top, Bottom, Tip *pb.Position +} + +// Mouth represents a face's mouth. +type Mouth struct { + Left, Center, Right, UpperLip, LowerLip *pb.Position +} + +// Chin represents a face's chin. +type Chin struct { + Left, Center, Right *pb.Position +} + +// FaceFromLandmarks converts the list of face landmarks returned by the service +// to a FaceLandmarks struct. +func FaceFromLandmarks(landmarks []*pb.FaceAnnotation_Landmark) *FaceLandmarks { + face := &FaceLandmarks{} + for _, lm := range landmarks { + switch lm.Type { + case pb.FaceAnnotation_Landmark_LEFT_OF_LEFT_EYEBROW: + face.Eyebrows.Left.Left = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_OF_LEFT_EYEBROW: + face.Eyebrows.Left.Right = lm.Position + case pb.FaceAnnotation_Landmark_LEFT_OF_RIGHT_EYEBROW: + face.Eyebrows.Right.Left = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_OF_RIGHT_EYEBROW: + face.Eyebrows.Right.Right = lm.Position + case pb.FaceAnnotation_Landmark_LEFT_EYEBROW_UPPER_MIDPOINT: + face.Eyebrows.Left.Top = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_EYEBROW_UPPER_MIDPOINT: + face.Eyebrows.Right.Top = lm.Position + case pb.FaceAnnotation_Landmark_MIDPOINT_BETWEEN_EYES: + face.Nose.Top = lm.Position + case pb.FaceAnnotation_Landmark_NOSE_TIP: + face.Nose.Tip = lm.Position + case pb.FaceAnnotation_Landmark_UPPER_LIP: + face.Mouth.UpperLip = lm.Position + case pb.FaceAnnotation_Landmark_LOWER_LIP: + face.Mouth.LowerLip = lm.Position + case pb.FaceAnnotation_Landmark_MOUTH_LEFT: + face.Mouth.Left = lm.Position + case pb.FaceAnnotation_Landmark_MOUTH_RIGHT: + face.Mouth.Right = lm.Position + case pb.FaceAnnotation_Landmark_MOUTH_CENTER: + face.Mouth.Center = lm.Position + case pb.FaceAnnotation_Landmark_NOSE_BOTTOM_RIGHT: + face.Nose.Right = lm.Position + case pb.FaceAnnotation_Landmark_NOSE_BOTTOM_LEFT: + face.Nose.Left = lm.Position + case pb.FaceAnnotation_Landmark_NOSE_BOTTOM_CENTER: + face.Nose.Bottom = lm.Position + case pb.FaceAnnotation_Landmark_LEFT_EYE: + face.Eyes.Left.Center = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_EYE: + face.Eyes.Right.Center = lm.Position + case pb.FaceAnnotation_Landmark_LEFT_EYE_TOP_BOUNDARY: + face.Eyes.Left.Top = lm.Position + case pb.FaceAnnotation_Landmark_LEFT_EYE_RIGHT_CORNER: + face.Eyes.Left.Right = lm.Position + case pb.FaceAnnotation_Landmark_LEFT_EYE_BOTTOM_BOUNDARY: + face.Eyes.Left.Bottom = lm.Position + case pb.FaceAnnotation_Landmark_LEFT_EYE_LEFT_CORNER: + face.Eyes.Left.Left = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_EYE_TOP_BOUNDARY: + face.Eyes.Right.Top = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_EYE_RIGHT_CORNER: + face.Eyes.Right.Right = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_EYE_BOTTOM_BOUNDARY: + face.Eyes.Right.Bottom = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_EYE_LEFT_CORNER: + face.Eyes.Right.Left = lm.Position + case pb.FaceAnnotation_Landmark_LEFT_EYE_PUPIL: + face.Eyes.Left.Pupil = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_EYE_PUPIL: + face.Eyes.Right.Pupil = lm.Position + case pb.FaceAnnotation_Landmark_LEFT_EAR_TRAGION: + face.Ears.Left = lm.Position + case pb.FaceAnnotation_Landmark_RIGHT_EAR_TRAGION: + face.Ears.Right = lm.Position + case pb.FaceAnnotation_Landmark_FOREHEAD_GLABELLA: + face.Forehead = lm.Position + case pb.FaceAnnotation_Landmark_CHIN_GNATHION: + face.Chin.Center = lm.Position + case pb.FaceAnnotation_Landmark_CHIN_LEFT_GONION: + face.Chin.Left = lm.Position + case pb.FaceAnnotation_Landmark_CHIN_RIGHT_GONION: + face.Chin.Right = lm.Position + default: + log.Printf("vision: ignoring unknown face annotation landmark %s", lm.Type) + } + } + return face +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/face_test.go b/vendor/cloud.google.com/go/vision/apiv1/face_test.go new file mode 100644 index 000000000..e5eef4c8f --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/face_test.go @@ -0,0 +1,224 @@ +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vision + +import ( + "testing" + + "cloud.google.com/go/internal/testutil" + pb "google.golang.org/genproto/googleapis/cloud/vision/v1" +) + +func TestFaceFromLandmarks(t *testing.T) { + landmarks := []*pb.FaceAnnotation_Landmark{ + { + Type: pb.FaceAnnotation_Landmark_LEFT_EYE, + Position: &pb.Position{X: 1192, Y: 575, Z: 0}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_EYE, + Position: &pb.Position{X: 1479, Y: 571, Z: -9}, + }, + { + Type: pb.FaceAnnotation_Landmark_LEFT_OF_LEFT_EYEBROW, + Position: &pb.Position{X: 1097, Y: 522, Z: 27}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_OF_LEFT_EYEBROW, + Position: &pb.Position{X: 1266, Y: 521, Z: -61}, + }, + { + Type: pb.FaceAnnotation_Landmark_LEFT_OF_RIGHT_EYEBROW, + Position: &pb.Position{X: 1402, Y: 520, Z: -66}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_OF_RIGHT_EYEBROW, + Position: &pb.Position{X: 1571, Y: 519, Z: 10}, + }, + { + Type: pb.FaceAnnotation_Landmark_MIDPOINT_BETWEEN_EYES, + Position: &pb.Position{X: 1331, Y: 566, Z: -66}, + }, + { + Type: pb.FaceAnnotation_Landmark_NOSE_TIP, + Position: &pb.Position{X: 1329, Y: 743, Z: -137}, + }, + { + Type: pb.FaceAnnotation_Landmark_UPPER_LIP, + Position: &pb.Position{X: 1330, Y: 836, Z: -66}, + }, + { + Type: pb.FaceAnnotation_Landmark_LOWER_LIP, + Position: &pb.Position{X: 1334, Y: 954, Z: -36}, + }, + { + Type: pb.FaceAnnotation_Landmark_MOUTH_LEFT, + Position: &pb.Position{X: 1186, Y: 867, Z: 27}, + }, + { + Type: pb.FaceAnnotation_Landmark_MOUTH_RIGHT, + Position: &pb.Position{X: 1484, Y: 857, Z: 19}, + }, + { + Type: pb.FaceAnnotation_Landmark_MOUTH_CENTER, + Position: &pb.Position{X: 1332, Y: 894, Z: -41}, + }, + { + Type: pb.FaceAnnotation_Landmark_NOSE_BOTTOM_RIGHT, + Position: &pb.Position{X: 1432, Y: 750, Z: -26}, + }, + { + Type: pb.FaceAnnotation_Landmark_NOSE_BOTTOM_LEFT, + Position: &pb.Position{X: 1236, Y: 755, Z: -20}, + }, + { + Type: pb.FaceAnnotation_Landmark_NOSE_BOTTOM_CENTER, + Position: &pb.Position{X: 1332, Y: 783, Z: -70}, + }, + { + Type: pb.FaceAnnotation_Landmark_LEFT_EYE_TOP_BOUNDARY, + Position: &pb.Position{X: 1193, Y: 561, Z: -20}, + }, + { + Type: pb.FaceAnnotation_Landmark_LEFT_EYE_RIGHT_CORNER, + Position: &pb.Position{X: 1252, Y: 581, Z: -1}, + }, + { + Type: pb.FaceAnnotation_Landmark_LEFT_EYE_BOTTOM_BOUNDARY, + Position: &pb.Position{X: 1190, Y: 593, Z: -1}, + }, + { + Type: pb.FaceAnnotation_Landmark_LEFT_EYE_LEFT_CORNER, + Position: &pb.Position{X: 1133, Y: 584, Z: 28}, + }, + { + Type: pb.FaceAnnotation_Landmark_LEFT_EYE_PUPIL, + Position: &pb.Position{X: 1189, Y: 580, Z: -8}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_EYE_TOP_BOUNDARY, + Position: &pb.Position{X: 1474, Y: 561, Z: -30}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_EYE_RIGHT_CORNER, + Position: &pb.Position{X: 1536, Y: 581, Z: 15}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_EYE_BOTTOM_BOUNDARY, + Position: &pb.Position{X: 1481, Y: 590, Z: -11}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_EYE_LEFT_CORNER, + Position: &pb.Position{X: 1424, Y: 579, Z: -6}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_EYE_PUPIL, + Position: &pb.Position{X: 1478, Y: 580, Z: -18}, + }, + { + Type: pb.FaceAnnotation_Landmark_LEFT_EYEBROW_UPPER_MIDPOINT, + Position: &pb.Position{X: 1181, Y: 482, Z: -40}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_EYEBROW_UPPER_MIDPOINT, + Position: &pb.Position{X: 1485, Y: 482, Z: -50}, + }, + { + Type: pb.FaceAnnotation_Landmark_LEFT_EAR_TRAGION, + Position: &pb.Position{X: 1027, Y: 696, Z: 361}, + }, + { + Type: pb.FaceAnnotation_Landmark_RIGHT_EAR_TRAGION, + Position: &pb.Position{X: 1666, Y: 695, Z: 339}, + }, + { + Type: pb.FaceAnnotation_Landmark_FOREHEAD_GLABELLA, + Position: &pb.Position{X: 1332, Y: 514, Z: -75}, + }, + { + Type: pb.FaceAnnotation_Landmark_CHIN_GNATHION, + Position: &pb.Position{X: 1335, Y: 1058, Z: 6}, + }, + { + Type: pb.FaceAnnotation_Landmark_CHIN_LEFT_GONION, + Position: &pb.Position{X: 1055, Y: 882, Z: 257}, + }, + { + Type: pb.FaceAnnotation_Landmark_CHIN_RIGHT_GONION, + Position: &pb.Position{X: 1631, Y: 881, Z: 238}, + }, + } + want := &FaceLandmarks{ + Eyebrows: Eyebrows{ + Left: Eyebrow{ + Top: &pb.Position{X: 1181, Y: 482, Z: -40}, + Left: &pb.Position{X: 1097, Y: 522, Z: 27}, + Right: &pb.Position{X: 1266, Y: 521, Z: -61}, + }, + Right: Eyebrow{ + Top: &pb.Position{X: 1485, Y: 482, Z: -50}, + Left: &pb.Position{X: 1402, Y: 520, Z: -66}, + Right: &pb.Position{X: 1571, Y: 519, Z: 10}, + }, + }, + Eyes: Eyes{ + Left: Eye{ + Left: &pb.Position{X: 1133, Y: 584, Z: 28}, + Right: &pb.Position{X: 1252, Y: 581, Z: -1}, + Top: &pb.Position{X: 1193, Y: 561, Z: -20}, + Bottom: &pb.Position{X: 1190, Y: 593, Z: -1}, + Center: &pb.Position{X: 1192, Y: 575, Z: 0}, + Pupil: &pb.Position{X: 1189, Y: 580, Z: -8}, + }, + Right: Eye{ + Left: &pb.Position{X: 1424, Y: 579, Z: -6}, + Right: &pb.Position{X: 1536, Y: 581, Z: 15}, + Top: &pb.Position{X: 1474, Y: 561, Z: -30}, + Bottom: &pb.Position{X: 1481, Y: 590, Z: -11}, + Center: &pb.Position{X: 1479, Y: 571, Z: -9}, + Pupil: &pb.Position{X: 1478, Y: 580, Z: -18}, + }, + }, + Ears: Ears{ + Left: &pb.Position{X: 1027, Y: 696, Z: 361}, + Right: &pb.Position{X: 1666, Y: 695, Z: 339}, + }, + Nose: Nose{ + Left: &pb.Position{X: 1236, Y: 755, Z: -20}, + Right: &pb.Position{X: 1432, Y: 750, Z: -26}, + Top: &pb.Position{X: 1331, Y: 566, Z: -66}, + Bottom: &pb.Position{X: 1332, Y: 783, Z: -70}, + Tip: &pb.Position{X: 1329, Y: 743, Z: -137}, + }, + Mouth: Mouth{ + Left: &pb.Position{X: 1186, Y: 867, Z: 27}, + Center: &pb.Position{X: 1332, Y: 894, Z: -41}, + Right: &pb.Position{X: 1484, Y: 857, Z: 19}, + UpperLip: &pb.Position{X: 1330, Y: 836, Z: -66}, + LowerLip: &pb.Position{X: 1334, Y: 954, Z: -36}, + }, + Chin: Chin{ + Left: &pb.Position{X: 1055, Y: 882, Z: 257}, + Center: &pb.Position{X: 1335, Y: 1058, Z: 6}, + Right: &pb.Position{X: 1631, Y: 881, Z: 238}, + }, + Forehead: &pb.Position{X: 1332, Y: 514, Z: -75}, + } + + got := FaceFromLandmarks(landmarks) + if diff := testutil.Diff(got, want); diff != "" { + t.Error(diff) + } +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/image.go b/vendor/cloud.google.com/go/vision/apiv1/image.go new file mode 100644 index 000000000..fd6d9a77b --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/image.go @@ -0,0 +1,37 @@ +// Copyright 2017, 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 vision + +import ( + "io" + "io/ioutil" + + pb "google.golang.org/genproto/googleapis/cloud/vision/v1" +) + +// NewImageFromReader reads the bytes of an image from r. +func NewImageFromReader(r io.Reader) (*pb.Image, error) { + bytes, err := ioutil.ReadAll(r) + if err != nil { + return nil, err + } + return &pb.Image{Content: bytes}, nil +} + +// NewImageFromURI returns an image that refers to an object in Google Cloud Storage +// (when the uri is of the form "gs://BUCKET/OBJECT") or at a public URL. +func NewImageFromURI(uri string) *pb.Image { + return &pb.Image{Source: &pb.ImageSource{ImageUri: uri}} +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/image_annotator_client.go b/vendor/cloud.google.com/go/vision/apiv1/image_annotator_client.go new file mode 100644 index 000000000..d82eedd55 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/image_annotator_client.go @@ -0,0 +1,248 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision + +import ( + "context" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ImageAnnotatorCallOptions contains the retry settings for each method of ImageAnnotatorClient. +type ImageAnnotatorCallOptions struct { + BatchAnnotateImages []gax.CallOption + AsyncBatchAnnotateFiles []gax.CallOption +} + +func defaultImageAnnotatorClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("vision.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultImageAnnotatorCallOptions() *ImageAnnotatorCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ImageAnnotatorCallOptions{ + BatchAnnotateImages: retry[[2]string{"default", "idempotent"}], + AsyncBatchAnnotateFiles: retry[[2]string{"default", "idempotent"}], + } +} + +// ImageAnnotatorClient is a client for interacting with Cloud Vision API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ImageAnnotatorClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + imageAnnotatorClient visionpb.ImageAnnotatorClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *ImageAnnotatorCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewImageAnnotatorClient creates a new image annotator client. +// +// Service that performs Google Cloud Vision API detection tasks over client +// images, such as face, landmark, logo, label, and text detection. The +// ImageAnnotator service returns detected entities from the images. +func NewImageAnnotatorClient(ctx context.Context, opts ...option.ClientOption) (*ImageAnnotatorClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultImageAnnotatorClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ImageAnnotatorClient{ + conn: conn, + CallOptions: defaultImageAnnotatorCallOptions(), + + imageAnnotatorClient: visionpb.NewImageAnnotatorClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ImageAnnotatorClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ImageAnnotatorClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ImageAnnotatorClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// BatchAnnotateImages run image detection and annotation for a batch of images. +func (c *ImageAnnotatorClient) BatchAnnotateImages(ctx context.Context, req *visionpb.BatchAnnotateImagesRequest, opts ...gax.CallOption) (*visionpb.BatchAnnotateImagesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchAnnotateImages[0:len(c.CallOptions.BatchAnnotateImages):len(c.CallOptions.BatchAnnotateImages)], opts...) + var resp *visionpb.BatchAnnotateImagesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.imageAnnotatorClient.BatchAnnotateImages(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// AsyncBatchAnnotateFiles run asynchronous image detection and annotation for a list of generic +// files, such as PDF files, which may contain multiple pages and multiple +// images per page. Progress and results can be retrieved through the +// google.longrunning.Operations interface. +// Operation.metadata contains OperationMetadata (metadata). +// Operation.response contains AsyncBatchAnnotateFilesResponse (results). +func (c *ImageAnnotatorClient) AsyncBatchAnnotateFiles(ctx context.Context, req *visionpb.AsyncBatchAnnotateFilesRequest, opts ...gax.CallOption) (*AsyncBatchAnnotateFilesOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AsyncBatchAnnotateFiles[0:len(c.CallOptions.AsyncBatchAnnotateFiles):len(c.CallOptions.AsyncBatchAnnotateFiles)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.imageAnnotatorClient.AsyncBatchAnnotateFiles(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &AsyncBatchAnnotateFilesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// AsyncBatchAnnotateFilesOperation manages a long-running operation from AsyncBatchAnnotateFiles. +type AsyncBatchAnnotateFilesOperation struct { + lro *longrunning.Operation +} + +// AsyncBatchAnnotateFilesOperation returns a new AsyncBatchAnnotateFilesOperation from a given name. +// The name must be that of a previously created AsyncBatchAnnotateFilesOperation, possibly from a different process. +func (c *ImageAnnotatorClient) AsyncBatchAnnotateFilesOperation(name string) *AsyncBatchAnnotateFilesOperation { + return &AsyncBatchAnnotateFilesOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *AsyncBatchAnnotateFilesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*visionpb.AsyncBatchAnnotateFilesResponse, error) { + var resp visionpb.AsyncBatchAnnotateFilesResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *AsyncBatchAnnotateFilesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*visionpb.AsyncBatchAnnotateFilesResponse, error) { + var resp visionpb.AsyncBatchAnnotateFilesResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *AsyncBatchAnnotateFilesOperation) Metadata() (*visionpb.OperationMetadata, error) { + var meta visionpb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *AsyncBatchAnnotateFilesOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *AsyncBatchAnnotateFilesOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/image_annotator_client_example_test.go b/vendor/cloud.google.com/go/vision/apiv1/image_annotator_client_example_test.go new file mode 100644 index 000000000..0f4ca1014 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/image_annotator_client_example_test.go @@ -0,0 +1,75 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision_test + +import ( + "context" + + vision "cloud.google.com/go/vision/apiv1" + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1" +) + +func ExampleNewImageAnnotatorClient() { + ctx := context.Background() + c, err := vision.NewImageAnnotatorClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleImageAnnotatorClient_BatchAnnotateImages() { + ctx := context.Background() + c, err := vision.NewImageAnnotatorClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.BatchAnnotateImagesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BatchAnnotateImages(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleImageAnnotatorClient_AsyncBatchAnnotateFiles() { + ctx := context.Background() + c, err := vision.NewImageAnnotatorClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.AsyncBatchAnnotateFilesRequest{ + // TODO: Fill request struct fields. + } + op, err := c.AsyncBatchAnnotateFiles(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/mock_test.go b/vendor/cloud.google.com/go/vision/apiv1/mock_test.go new file mode 100644 index 000000000..5a7cf2e74 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/mock_test.go @@ -0,0 +1,1644 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision + +import ( + emptypb "github.com/golang/protobuf/ptypes/empty" + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockProductSearchServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + visionpb.ProductSearchServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockProductSearchServer) CreateProductSet(ctx context.Context, req *visionpb.CreateProductSetRequest) (*visionpb.ProductSet, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.ProductSet), nil +} + +func (s *mockProductSearchServer) ListProductSets(ctx context.Context, req *visionpb.ListProductSetsRequest) (*visionpb.ListProductSetsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.ListProductSetsResponse), nil +} + +func (s *mockProductSearchServer) GetProductSet(ctx context.Context, req *visionpb.GetProductSetRequest) (*visionpb.ProductSet, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.ProductSet), nil +} + +func (s *mockProductSearchServer) UpdateProductSet(ctx context.Context, req *visionpb.UpdateProductSetRequest) (*visionpb.ProductSet, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.ProductSet), nil +} + +func (s *mockProductSearchServer) DeleteProductSet(ctx context.Context, req *visionpb.DeleteProductSetRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockProductSearchServer) CreateProduct(ctx context.Context, req *visionpb.CreateProductRequest) (*visionpb.Product, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.Product), nil +} + +func (s *mockProductSearchServer) ListProducts(ctx context.Context, req *visionpb.ListProductsRequest) (*visionpb.ListProductsResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.ListProductsResponse), nil +} + +func (s *mockProductSearchServer) GetProduct(ctx context.Context, req *visionpb.GetProductRequest) (*visionpb.Product, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.Product), nil +} + +func (s *mockProductSearchServer) UpdateProduct(ctx context.Context, req *visionpb.UpdateProductRequest) (*visionpb.Product, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.Product), nil +} + +func (s *mockProductSearchServer) DeleteProduct(ctx context.Context, req *visionpb.DeleteProductRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockProductSearchServer) CreateReferenceImage(ctx context.Context, req *visionpb.CreateReferenceImageRequest) (*visionpb.ReferenceImage, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.ReferenceImage), nil +} + +func (s *mockProductSearchServer) DeleteReferenceImage(ctx context.Context, req *visionpb.DeleteReferenceImageRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockProductSearchServer) ListReferenceImages(ctx context.Context, req *visionpb.ListReferenceImagesRequest) (*visionpb.ListReferenceImagesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.ListReferenceImagesResponse), nil +} + +func (s *mockProductSearchServer) GetReferenceImage(ctx context.Context, req *visionpb.GetReferenceImageRequest) (*visionpb.ReferenceImage, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.ReferenceImage), nil +} + +func (s *mockProductSearchServer) AddProductToProductSet(ctx context.Context, req *visionpb.AddProductToProductSetRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockProductSearchServer) RemoveProductFromProductSet(ctx context.Context, req *visionpb.RemoveProductFromProductSetRequest) (*emptypb.Empty, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*emptypb.Empty), nil +} + +func (s *mockProductSearchServer) ListProductsInProductSet(ctx context.Context, req *visionpb.ListProductsInProductSetRequest) (*visionpb.ListProductsInProductSetResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.ListProductsInProductSetResponse), nil +} + +func (s *mockProductSearchServer) ImportProductSets(ctx context.Context, req *visionpb.ImportProductSetsRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +type mockImageAnnotatorServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + visionpb.ImageAnnotatorServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockImageAnnotatorServer) BatchAnnotateImages(ctx context.Context, req *visionpb.BatchAnnotateImagesRequest) (*visionpb.BatchAnnotateImagesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.BatchAnnotateImagesResponse), nil +} + +func (s *mockImageAnnotatorServer) AsyncBatchAnnotateFiles(ctx context.Context, req *visionpb.AsyncBatchAnnotateFilesRequest) (*longrunningpb.Operation, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*longrunningpb.Operation), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockProductSearch mockProductSearchServer + mockImageAnnotator mockImageAnnotatorServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + visionpb.RegisterProductSearchServer(serv, &mockProductSearch) + visionpb.RegisterImageAnnotatorServer(serv, &mockImageAnnotator) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestProductSearchCreateProduct(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var productCategory string = "productCategory-1607451058" + var expectedResponse = &visionpb.Product{ + Name: name, + DisplayName: displayName, + Description: description, + ProductCategory: productCategory, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var product *visionpb.Product = &visionpb.Product{} + var request = &visionpb.CreateProductRequest{ + Parent: formattedParent, + Product: product, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateProduct(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchCreateProductError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var product *visionpb.Product = &visionpb.Product{} + var request = &visionpb.CreateProductRequest{ + Parent: formattedParent, + Product: product, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateProduct(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchListProducts(t *testing.T) { + var nextPageToken string = "" + var productsElement *visionpb.Product = &visionpb.Product{} + var products = []*visionpb.Product{productsElement} + var expectedResponse = &visionpb.ListProductsResponse{ + NextPageToken: nextPageToken, + Products: products, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &visionpb.ListProductsRequest{ + Parent: formattedParent, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListProducts(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Products[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchListProductsError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &visionpb.ListProductsRequest{ + Parent: formattedParent, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListProducts(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchGetProduct(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var productCategory string = "productCategory-1607451058" + var expectedResponse = &visionpb.Product{ + Name: name2, + DisplayName: displayName, + Description: description, + ProductCategory: productCategory, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]") + var request = &visionpb.GetProductRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetProduct(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchGetProductError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]") + var request = &visionpb.GetProductRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetProduct(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchUpdateProduct(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var description string = "description-1724546052" + var productCategory string = "productCategory-1607451058" + var expectedResponse = &visionpb.Product{ + Name: name, + DisplayName: displayName, + Description: description, + ProductCategory: productCategory, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var product *visionpb.Product = &visionpb.Product{} + var request = &visionpb.UpdateProductRequest{ + Product: product, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateProduct(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchUpdateProductError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var product *visionpb.Product = &visionpb.Product{} + var request = &visionpb.UpdateProductRequest{ + Product: product, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateProduct(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchDeleteProduct(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]") + var request = &visionpb.DeleteProductRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteProduct(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestProductSearchDeleteProductError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]") + var request = &visionpb.DeleteProductRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteProduct(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestProductSearchListReferenceImages(t *testing.T) { + var pageSize int32 = 883849137 + var nextPageToken string = "" + var referenceImagesElement *visionpb.ReferenceImage = &visionpb.ReferenceImage{} + var referenceImages = []*visionpb.ReferenceImage{referenceImagesElement} + var expectedResponse = &visionpb.ListReferenceImagesResponse{ + PageSize: pageSize, + NextPageToken: nextPageToken, + ReferenceImages: referenceImages, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/products/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]") + var request = &visionpb.ListReferenceImagesRequest{ + Parent: formattedParent, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListReferenceImages(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.ReferenceImages[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchListReferenceImagesError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/products/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]") + var request = &visionpb.ListReferenceImagesRequest{ + Parent: formattedParent, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListReferenceImages(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchGetReferenceImage(t *testing.T) { + var name2 string = "name2-1052831874" + var uri string = "uri116076" + var expectedResponse = &visionpb.ReferenceImage{ + Name: name2, + Uri: uri, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]") + var request = &visionpb.GetReferenceImageRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetReferenceImage(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchGetReferenceImageError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]") + var request = &visionpb.GetReferenceImageRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetReferenceImage(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchDeleteReferenceImage(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]") + var request = &visionpb.DeleteReferenceImageRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteReferenceImage(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestProductSearchDeleteReferenceImageError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/products/%s/referenceImages/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]") + var request = &visionpb.DeleteReferenceImageRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteReferenceImage(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestProductSearchCreateReferenceImage(t *testing.T) { + var name string = "name3373707" + var uri string = "uri116076" + var expectedResponse = &visionpb.ReferenceImage{ + Name: name, + Uri: uri, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/products/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]") + var referenceImage *visionpb.ReferenceImage = &visionpb.ReferenceImage{} + var request = &visionpb.CreateReferenceImageRequest{ + Parent: formattedParent, + ReferenceImage: referenceImage, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateReferenceImage(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchCreateReferenceImageError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/products/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT]") + var referenceImage *visionpb.ReferenceImage = &visionpb.ReferenceImage{} + var request = &visionpb.CreateReferenceImageRequest{ + Parent: formattedParent, + ReferenceImage: referenceImage, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateReferenceImage(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchCreateProductSet(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var expectedResponse = &visionpb.ProductSet{ + Name: name, + DisplayName: displayName, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var productSet *visionpb.ProductSet = &visionpb.ProductSet{} + var request = &visionpb.CreateProductSetRequest{ + Parent: formattedParent, + ProductSet: productSet, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateProductSet(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchCreateProductSetError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var productSet *visionpb.ProductSet = &visionpb.ProductSet{} + var request = &visionpb.CreateProductSetRequest{ + Parent: formattedParent, + ProductSet: productSet, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.CreateProductSet(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchListProductSets(t *testing.T) { + var nextPageToken string = "" + var productSetsElement *visionpb.ProductSet = &visionpb.ProductSet{} + var productSets = []*visionpb.ProductSet{productSetsElement} + var expectedResponse = &visionpb.ListProductSetsResponse{ + NextPageToken: nextPageToken, + ProductSets: productSets, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &visionpb.ListProductSetsRequest{ + Parent: formattedParent, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListProductSets(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.ProductSets[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchListProductSetsError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var request = &visionpb.ListProductSetsRequest{ + Parent: formattedParent, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListProductSets(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchGetProductSet(t *testing.T) { + var name2 string = "name2-1052831874" + var displayName string = "displayName1615086568" + var expectedResponse = &visionpb.ProductSet{ + Name: name2, + DisplayName: displayName, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var request = &visionpb.GetProductSetRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetProductSet(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchGetProductSetError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var request = &visionpb.GetProductSetRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.GetProductSet(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchUpdateProductSet(t *testing.T) { + var name string = "name3373707" + var displayName string = "displayName1615086568" + var expectedResponse = &visionpb.ProductSet{ + Name: name, + DisplayName: displayName, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var productSet *visionpb.ProductSet = &visionpb.ProductSet{} + var request = &visionpb.UpdateProductSetRequest{ + ProductSet: productSet, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateProductSet(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchUpdateProductSetError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var productSet *visionpb.ProductSet = &visionpb.ProductSet{} + var request = &visionpb.UpdateProductSetRequest{ + ProductSet: productSet, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.UpdateProductSet(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchDeleteProductSet(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var request = &visionpb.DeleteProductSetRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteProductSet(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestProductSearchDeleteProductSetError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var request = &visionpb.DeleteProductSetRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.DeleteProductSet(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestProductSearchAddProductToProductSet(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var product string = "product-309474065" + var request = &visionpb.AddProductToProductSetRequest{ + Name: formattedName, + Product: product, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.AddProductToProductSet(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestProductSearchAddProductToProductSetError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var product string = "product-309474065" + var request = &visionpb.AddProductToProductSetRequest{ + Name: formattedName, + Product: product, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.AddProductToProductSet(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestProductSearchRemoveProductFromProductSet(t *testing.T) { + var expectedResponse *emptypb.Empty = &emptypb.Empty{} + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var product string = "product-309474065" + var request = &visionpb.RemoveProductFromProductSetRequest{ + Name: formattedName, + Product: product, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.RemoveProductFromProductSet(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + +} + +func TestProductSearchRemoveProductFromProductSetError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var product string = "product-309474065" + var request = &visionpb.RemoveProductFromProductSetRequest{ + Name: formattedName, + Product: product, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + err = c.RemoveProductFromProductSet(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } +} +func TestProductSearchListProductsInProductSet(t *testing.T) { + var nextPageToken string = "" + var productsElement *visionpb.Product = &visionpb.Product{} + var products = []*visionpb.Product{productsElement} + var expectedResponse = &visionpb.ListProductsInProductSetResponse{ + NextPageToken: nextPageToken, + Products: products, + } + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + mockProductSearch.resps = append(mockProductSearch.resps[:0], expectedResponse) + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var request = &visionpb.ListProductsInProductSetRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListProductsInProductSet(context.Background(), request).Next() + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + want := (interface{})(expectedResponse.Products[0]) + got := (interface{})(resp) + var ok bool + + switch want := (want).(type) { + case proto.Message: + ok = proto.Equal(want, got.(proto.Message)) + default: + ok = want == got + } + if !ok { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchListProductsInProductSetError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = gstatus.Error(errCode, "test error") + + var formattedName string = fmt.Sprintf("projects/%s/locations/%s/productSets/%s", "[PROJECT]", "[LOCATION]", "[PRODUCT_SET]") + var request = &visionpb.ListProductsInProductSetRequest{ + Name: formattedName, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.ListProductsInProductSet(context.Background(), request).Next() + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestProductSearchImportProductSets(t *testing.T) { + var expectedResponse *visionpb.ImportProductSetsResponse = &visionpb.ImportProductSetsResponse{} + + mockProductSearch.err = nil + mockProductSearch.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockProductSearch.resps = append(mockProductSearch.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var inputConfig *visionpb.ImportProductSetsInputConfig = &visionpb.ImportProductSetsInputConfig{} + var request = &visionpb.ImportProductSetsRequest{ + Parent: formattedParent, + InputConfig: inputConfig, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ImportProductSets(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockProductSearch.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestProductSearchImportProductSetsError(t *testing.T) { + errCode := codes.PermissionDenied + mockProductSearch.err = nil + mockProductSearch.resps = append(mockProductSearch.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var formattedParent string = fmt.Sprintf("projects/%s/locations/%s", "[PROJECT]", "[LOCATION]") + var inputConfig *visionpb.ImportProductSetsInputConfig = &visionpb.ImportProductSetsInputConfig{} + var request = &visionpb.ImportProductSetsRequest{ + Parent: formattedParent, + InputConfig: inputConfig, + } + + c, err := NewProductSearchClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.ImportProductSets(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestImageAnnotatorBatchAnnotateImages(t *testing.T) { + var expectedResponse *visionpb.BatchAnnotateImagesResponse = &visionpb.BatchAnnotateImagesResponse{} + + mockImageAnnotator.err = nil + mockImageAnnotator.reqs = nil + + mockImageAnnotator.resps = append(mockImageAnnotator.resps[:0], expectedResponse) + + var requests []*visionpb.AnnotateImageRequest = nil + var request = &visionpb.BatchAnnotateImagesRequest{ + Requests: requests, + } + + c, err := NewImageAnnotatorClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchAnnotateImages(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockImageAnnotator.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestImageAnnotatorBatchAnnotateImagesError(t *testing.T) { + errCode := codes.PermissionDenied + mockImageAnnotator.err = gstatus.Error(errCode, "test error") + + var requests []*visionpb.AnnotateImageRequest = nil + var request = &visionpb.BatchAnnotateImagesRequest{ + Requests: requests, + } + + c, err := NewImageAnnotatorClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchAnnotateImages(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} +func TestImageAnnotatorAsyncBatchAnnotateFiles(t *testing.T) { + var expectedResponse *visionpb.AsyncBatchAnnotateFilesResponse = &visionpb.AsyncBatchAnnotateFilesResponse{} + + mockImageAnnotator.err = nil + mockImageAnnotator.reqs = nil + + any, err := ptypes.MarshalAny(expectedResponse) + if err != nil { + t.Fatal(err) + } + mockImageAnnotator.resps = append(mockImageAnnotator.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Response{Response: any}, + }) + + var requests []*visionpb.AsyncAnnotateFileRequest = nil + var request = &visionpb.AsyncBatchAnnotateFilesRequest{ + Requests: requests, + } + + c, err := NewImageAnnotatorClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.AsyncBatchAnnotateFiles(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockImageAnnotator.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestImageAnnotatorAsyncBatchAnnotateFilesError(t *testing.T) { + errCode := codes.PermissionDenied + mockImageAnnotator.err = nil + mockImageAnnotator.resps = append(mockImageAnnotator.resps[:0], &longrunningpb.Operation{ + Name: "longrunning-test", + Done: true, + Result: &longrunningpb.Operation_Error{ + Error: &status.Status{ + Code: int32(errCode), + Message: "test error", + }, + }, + }) + + var requests []*visionpb.AsyncAnnotateFileRequest = nil + var request = &visionpb.AsyncBatchAnnotateFilesRequest{ + Requests: requests, + } + + c, err := NewImageAnnotatorClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + respLRO, err := c.AsyncBatchAnnotateFiles(context.Background(), request) + if err != nil { + t.Fatal(err) + } + resp, err := respLRO.Wait(context.Background()) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/product_search_client.go b/vendor/cloud.google.com/go/vision/apiv1/product_search_client.go new file mode 100644 index 000000000..2a835abb8 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/product_search_client.go @@ -0,0 +1,875 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision + +import ( + "context" + "math" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/transport" + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ProductSearchCallOptions contains the retry settings for each method of ProductSearchClient. +type ProductSearchCallOptions struct { + CreateProduct []gax.CallOption + ListProducts []gax.CallOption + GetProduct []gax.CallOption + UpdateProduct []gax.CallOption + DeleteProduct []gax.CallOption + ListReferenceImages []gax.CallOption + GetReferenceImage []gax.CallOption + DeleteReferenceImage []gax.CallOption + CreateReferenceImage []gax.CallOption + CreateProductSet []gax.CallOption + ListProductSets []gax.CallOption + GetProductSet []gax.CallOption + UpdateProductSet []gax.CallOption + DeleteProductSet []gax.CallOption + AddProductToProductSet []gax.CallOption + RemoveProductFromProductSet []gax.CallOption + ListProductsInProductSet []gax.CallOption + ImportProductSets []gax.CallOption +} + +func defaultProductSearchClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("vision.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultProductSearchCallOptions() *ProductSearchCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ProductSearchCallOptions{ + CreateProduct: retry[[2]string{"default", "non_idempotent"}], + ListProducts: retry[[2]string{"default", "idempotent"}], + GetProduct: retry[[2]string{"default", "idempotent"}], + UpdateProduct: retry[[2]string{"default", "idempotent"}], + DeleteProduct: retry[[2]string{"default", "idempotent"}], + ListReferenceImages: retry[[2]string{"default", "idempotent"}], + GetReferenceImage: retry[[2]string{"default", "idempotent"}], + DeleteReferenceImage: retry[[2]string{"default", "idempotent"}], + CreateReferenceImage: retry[[2]string{"default", "non_idempotent"}], + CreateProductSet: retry[[2]string{"default", "non_idempotent"}], + ListProductSets: retry[[2]string{"default", "idempotent"}], + GetProductSet: retry[[2]string{"default", "idempotent"}], + UpdateProductSet: retry[[2]string{"default", "idempotent"}], + DeleteProductSet: retry[[2]string{"default", "idempotent"}], + AddProductToProductSet: retry[[2]string{"default", "idempotent"}], + RemoveProductFromProductSet: retry[[2]string{"default", "idempotent"}], + ListProductsInProductSet: retry[[2]string{"default", "idempotent"}], + ImportProductSets: retry[[2]string{"default", "non_idempotent"}], + } +} + +// ProductSearchClient is a client for interacting with Cloud Vision API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ProductSearchClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + productSearchClient visionpb.ProductSearchClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *ProductSearchCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewProductSearchClient creates a new product search client. +// +// Manages Products and ProductSets of reference images for use in product +// search. It uses the following resource model: +// +// The API has a collection of [ProductSet][google.cloud.vision.v1.ProductSet] resources, named +// projects/*/locations/*/productSets/*, which acts as a way to put different +// products into groups to limit identification. +// +// In parallel, +// +// The API has a collection of [Product][google.cloud.vision.v1.Product] resources, named +// projects/*/locations/*/products/* +// +// Each [Product][google.cloud.vision.v1.Product] has a collection of [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, named +// projects/*/locations/*/products/*/referenceImages/* +func NewProductSearchClient(ctx context.Context, opts ...option.ClientOption) (*ProductSearchClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultProductSearchClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ProductSearchClient{ + conn: conn, + CallOptions: defaultProductSearchCallOptions(), + + productSearchClient: visionpb.NewProductSearchClient(conn), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn)) + if err != nil { + // This error "should not happen", since we are just reusing old connection + // and never actually need to dial. + // If this does happen, we could leak conn. However, we cannot close conn: + // If the user invoked the function with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO(pongad): investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ProductSearchClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ProductSearchClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ProductSearchClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// CreateProduct creates and returns a new product resource. +// +// Possible errors: +// +// Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 +// characters. +// +// Returns INVALID_ARGUMENT if description is longer than 4096 characters. +// +// Returns INVALID_ARGUMENT if product_category is missing or invalid. +func (c *ProductSearchClient) CreateProduct(ctx context.Context, req *visionpb.CreateProductRequest, opts ...gax.CallOption) (*visionpb.Product, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateProduct[0:len(c.CallOptions.CreateProduct):len(c.CallOptions.CreateProduct)], opts...) + var resp *visionpb.Product + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.CreateProduct(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListProducts lists products in an unspecified order. +// +// Possible errors: +// +// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. +func (c *ProductSearchClient) ListProducts(ctx context.Context, req *visionpb.ListProductsRequest, opts ...gax.CallOption) *ProductIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListProducts[0:len(c.CallOptions.ListProducts):len(c.CallOptions.ListProducts)], opts...) + it := &ProductIterator{} + req = proto.Clone(req).(*visionpb.ListProductsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*visionpb.Product, string, error) { + var resp *visionpb.ListProductsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.ListProducts(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Products, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetProduct gets information associated with a Product. +// +// Possible errors: +// +// Returns NOT_FOUND if the Product does not exist. +func (c *ProductSearchClient) GetProduct(ctx context.Context, req *visionpb.GetProductRequest, opts ...gax.CallOption) (*visionpb.Product, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetProduct[0:len(c.CallOptions.GetProduct):len(c.CallOptions.GetProduct)], opts...) + var resp *visionpb.Product + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.GetProduct(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateProduct makes changes to a Product resource. +// Only the display_name, description, and labels fields can be updated +// right now. +// +// If labels are updated, the change will not be reflected in queries until +// the next index time. +// +// Possible errors: +// +// Returns NOT_FOUND if the Product does not exist. +// +// Returns INVALID_ARGUMENT if display_name is present in update_mask but is +// missing from the request or longer than 4096 characters. +// +// Returns INVALID_ARGUMENT if description is present in update_mask but is +// longer than 4096 characters. +// +// Returns INVALID_ARGUMENT if product_category is present in update_mask. +func (c *ProductSearchClient) UpdateProduct(ctx context.Context, req *visionpb.UpdateProductRequest, opts ...gax.CallOption) (*visionpb.Product, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateProduct[0:len(c.CallOptions.UpdateProduct):len(c.CallOptions.UpdateProduct)], opts...) + var resp *visionpb.Product + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.UpdateProduct(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteProduct permanently deletes a product and its reference images. +// +// Metadata of the product and all its images will be deleted right away, but +// search queries against ProductSets containing the product may still work +// until all related caches are refreshed. +// +// Possible errors: +// +// Returns NOT_FOUND if the product does not exist. +func (c *ProductSearchClient) DeleteProduct(ctx context.Context, req *visionpb.DeleteProductRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteProduct[0:len(c.CallOptions.DeleteProduct):len(c.CallOptions.DeleteProduct)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.productSearchClient.DeleteProduct(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListReferenceImages lists reference images. +// +// Possible errors: +// +// Returns NOT_FOUND if the parent product does not exist. +// +// Returns INVALID_ARGUMENT if the page_size is greater than 100, or less +// than 1. +func (c *ProductSearchClient) ListReferenceImages(ctx context.Context, req *visionpb.ListReferenceImagesRequest, opts ...gax.CallOption) *ReferenceImageIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListReferenceImages[0:len(c.CallOptions.ListReferenceImages):len(c.CallOptions.ListReferenceImages)], opts...) + it := &ReferenceImageIterator{} + req = proto.Clone(req).(*visionpb.ListReferenceImagesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*visionpb.ReferenceImage, string, error) { + var resp *visionpb.ListReferenceImagesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.ListReferenceImages(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.ReferenceImages, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetReferenceImage gets information associated with a ReferenceImage. +// +// Possible errors: +// +// Returns NOT_FOUND if the specified image does not exist. +func (c *ProductSearchClient) GetReferenceImage(ctx context.Context, req *visionpb.GetReferenceImageRequest, opts ...gax.CallOption) (*visionpb.ReferenceImage, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetReferenceImage[0:len(c.CallOptions.GetReferenceImage):len(c.CallOptions.GetReferenceImage)], opts...) + var resp *visionpb.ReferenceImage + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.GetReferenceImage(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteReferenceImage permanently deletes a reference image. +// +// The image metadata will be deleted right away, but search queries +// against ProductSets containing the image may still work until all related +// caches are refreshed. +// +// The actual image files are not deleted from Google Cloud Storage. +// +// Possible errors: +// +// Returns NOT_FOUND if the reference image does not exist. +func (c *ProductSearchClient) DeleteReferenceImage(ctx context.Context, req *visionpb.DeleteReferenceImageRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteReferenceImage[0:len(c.CallOptions.DeleteReferenceImage):len(c.CallOptions.DeleteReferenceImage)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.productSearchClient.DeleteReferenceImage(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// CreateReferenceImage creates and returns a new ReferenceImage resource. +// +// The bounding_poly field is optional. If bounding_poly is not specified, +// the system will try to detect regions of interest in the image that are +// compatible with the product_category on the parent product. If it is +// specified, detection is ALWAYS skipped. The system converts polygons into +// non-rotated rectangles. +// +// Note that the pipeline will resize the image if the image resolution is too +// large to process (above 50MP). +// +// Possible errors: +// +// Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 +// characters. +// +// Returns INVALID_ARGUMENT if the product does not exist. +// +// Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing +// compatible with the parent product's product_category is detected. +// +// Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. +func (c *ProductSearchClient) CreateReferenceImage(ctx context.Context, req *visionpb.CreateReferenceImageRequest, opts ...gax.CallOption) (*visionpb.ReferenceImage, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateReferenceImage[0:len(c.CallOptions.CreateReferenceImage):len(c.CallOptions.CreateReferenceImage)], opts...) + var resp *visionpb.ReferenceImage + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.CreateReferenceImage(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// CreateProductSet creates and returns a new ProductSet resource. +// +// Possible errors: +// +// Returns INVALID_ARGUMENT if display_name is missing, or is longer than +// 4096 characters. +func (c *ProductSearchClient) CreateProductSet(ctx context.Context, req *visionpb.CreateProductSetRequest, opts ...gax.CallOption) (*visionpb.ProductSet, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.CreateProductSet[0:len(c.CallOptions.CreateProductSet):len(c.CallOptions.CreateProductSet)], opts...) + var resp *visionpb.ProductSet + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.CreateProductSet(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListProductSets lists ProductSets in an unspecified order. +// +// Possible errors: +// +// Returns INVALID_ARGUMENT if page_size is greater than 100, or less +// than 1. +func (c *ProductSearchClient) ListProductSets(ctx context.Context, req *visionpb.ListProductSetsRequest, opts ...gax.CallOption) *ProductSetIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListProductSets[0:len(c.CallOptions.ListProductSets):len(c.CallOptions.ListProductSets)], opts...) + it := &ProductSetIterator{} + req = proto.Clone(req).(*visionpb.ListProductSetsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*visionpb.ProductSet, string, error) { + var resp *visionpb.ListProductSetsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.ListProductSets(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.ProductSets, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// GetProductSet gets information associated with a ProductSet. +// +// Possible errors: +// +// Returns NOT_FOUND if the ProductSet does not exist. +func (c *ProductSearchClient) GetProductSet(ctx context.Context, req *visionpb.GetProductSetRequest, opts ...gax.CallOption) (*visionpb.ProductSet, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.GetProductSet[0:len(c.CallOptions.GetProductSet):len(c.CallOptions.GetProductSet)], opts...) + var resp *visionpb.ProductSet + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.GetProductSet(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateProductSet makes changes to a ProductSet resource. +// Only display_name can be updated currently. +// +// Possible errors: +// +// Returns NOT_FOUND if the ProductSet does not exist. +// +// Returns INVALID_ARGUMENT if display_name is present in update_mask but +// missing from the request or longer than 4096 characters. +func (c *ProductSearchClient) UpdateProductSet(ctx context.Context, req *visionpb.UpdateProductSetRequest, opts ...gax.CallOption) (*visionpb.ProductSet, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.UpdateProductSet[0:len(c.CallOptions.UpdateProductSet):len(c.CallOptions.UpdateProductSet)], opts...) + var resp *visionpb.ProductSet + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.UpdateProductSet(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteProductSet permanently deletes a ProductSet. Products and ReferenceImages in the +// ProductSet are not deleted. +// +// The actual image files are not deleted from Google Cloud Storage. +// +// Possible errors: +// +// Returns NOT_FOUND if the ProductSet does not exist. +func (c *ProductSearchClient) DeleteProductSet(ctx context.Context, req *visionpb.DeleteProductSetRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.DeleteProductSet[0:len(c.CallOptions.DeleteProductSet):len(c.CallOptions.DeleteProductSet)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.productSearchClient.DeleteProductSet(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// AddProductToProductSet adds a Product to the specified ProductSet. If the Product is already +// present, no change is made. +// +// One Product can be added to at most 100 ProductSets. +// +// Possible errors: +// +// Returns NOT_FOUND if the Product or the ProductSet doesn't exist. +func (c *ProductSearchClient) AddProductToProductSet(ctx context.Context, req *visionpb.AddProductToProductSetRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.AddProductToProductSet[0:len(c.CallOptions.AddProductToProductSet):len(c.CallOptions.AddProductToProductSet)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.productSearchClient.AddProductToProductSet(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// RemoveProductFromProductSet removes a Product from the specified ProductSet. +// +// Possible errors: +// +// Returns NOT_FOUND If the Product is not found under the ProductSet. +func (c *ProductSearchClient) RemoveProductFromProductSet(ctx context.Context, req *visionpb.RemoveProductFromProductSetRequest, opts ...gax.CallOption) error { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.RemoveProductFromProductSet[0:len(c.CallOptions.RemoveProductFromProductSet):len(c.CallOptions.RemoveProductFromProductSet)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.productSearchClient.RemoveProductFromProductSet(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// ListProductsInProductSet lists the Products in a ProductSet, in an unspecified order. If the +// ProductSet does not exist, the products field of the response will be +// empty. +// +// Possible errors: +// +// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. +func (c *ProductSearchClient) ListProductsInProductSet(ctx context.Context, req *visionpb.ListProductsInProductSetRequest, opts ...gax.CallOption) *ProductIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListProductsInProductSet[0:len(c.CallOptions.ListProductsInProductSet):len(c.CallOptions.ListProductsInProductSet)], opts...) + it := &ProductIterator{} + req = proto.Clone(req).(*visionpb.ListProductsInProductSetRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*visionpb.Product, string, error) { + var resp *visionpb.ListProductsInProductSetResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.ListProductsInProductSet(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + return resp.Products, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + return it +} + +// ImportProductSets asynchronous API that imports a list of reference images to specified +// product sets based on a list of image information. +// +// The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the +// progress and results of the request. +// Operation.metadata contains BatchOperationMetadata. (progress) +// Operation.response contains ImportProductSetsResponse. (results) +// +// The input source of this method is a csv file on Google Cloud Storage. +// For the format of the csv file please see +// [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. +func (c *ProductSearchClient) ImportProductSets(ctx context.Context, req *visionpb.ImportProductSetsRequest, opts ...gax.CallOption) (*ImportProductSetsOperation, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ImportProductSets[0:len(c.CallOptions.ImportProductSets):len(c.CallOptions.ImportProductSets)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.productSearchClient.ImportProductSets(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ImportProductSetsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ProductIterator manages a stream of *visionpb.Product. +type ProductIterator struct { + items []*visionpb.Product + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*visionpb.Product, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ProductIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ProductIterator) Next() (*visionpb.Product, error) { + var item *visionpb.Product + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ProductIterator) bufLen() int { + return len(it.items) +} + +func (it *ProductIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ProductSetIterator manages a stream of *visionpb.ProductSet. +type ProductSetIterator struct { + items []*visionpb.ProductSet + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*visionpb.ProductSet, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ProductSetIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ProductSetIterator) Next() (*visionpb.ProductSet, error) { + var item *visionpb.ProductSet + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ProductSetIterator) bufLen() int { + return len(it.items) +} + +func (it *ProductSetIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ReferenceImageIterator manages a stream of *visionpb.ReferenceImage. +type ReferenceImageIterator struct { + items []*visionpb.ReferenceImage + pageInfo *iterator.PageInfo + nextFunc func() error + + // InternalFetch is for use by the Google Cloud Libraries only. + // It is not part of the stable interface of this package. + // + // InternalFetch returns results from a single call to the underlying RPC. + // The number of results is no greater than pageSize. + // If there are no more results, nextPageToken is empty and err is nil. + InternalFetch func(pageSize int, pageToken string) (results []*visionpb.ReferenceImage, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *ReferenceImageIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// Next returns the next result. Its second return value is iterator.Done if there are no more +// results. Once Next returns Done, all subsequent calls will return Done. +func (it *ReferenceImageIterator) Next() (*visionpb.ReferenceImage, error) { + var item *visionpb.ReferenceImage + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *ReferenceImageIterator) bufLen() int { + return len(it.items) +} + +func (it *ReferenceImageIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// ImportProductSetsOperation manages a long-running operation from ImportProductSets. +type ImportProductSetsOperation struct { + lro *longrunning.Operation +} + +// ImportProductSetsOperation returns a new ImportProductSetsOperation from a given name. +// The name must be that of a previously created ImportProductSetsOperation, possibly from a different process. +func (c *ProductSearchClient) ImportProductSetsOperation(name string) *ImportProductSetsOperation { + return &ImportProductSetsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *ImportProductSetsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*visionpb.ImportProductSetsResponse, error) { + var resp visionpb.ImportProductSetsResponse + if err := op.lro.WaitWithInterval(ctx, &resp, 45000*time.Millisecond, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *ImportProductSetsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*visionpb.ImportProductSetsResponse, error) { + var resp visionpb.ImportProductSetsResponse + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *ImportProductSetsOperation) Metadata() (*visionpb.BatchOperationMetadata, error) { + var meta visionpb.BatchOperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *ImportProductSetsOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *ImportProductSetsOperation) Name() string { + return op.lro.Name() +} diff --git a/vendor/cloud.google.com/go/vision/apiv1/product_search_client_example_test.go b/vendor/cloud.google.com/go/vision/apiv1/product_search_client_example_test.go new file mode 100644 index 000000000..116fd9647 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1/product_search_client_example_test.go @@ -0,0 +1,378 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision_test + +import ( + "context" + + vision "cloud.google.com/go/vision/apiv1" + "google.golang.org/api/iterator" + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1" +) + +func ExampleNewProductSearchClient() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleProductSearchClient_CreateProduct() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.CreateProductRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateProduct(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductSearchClient_ListProducts() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.ListProductsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListProducts(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleProductSearchClient_GetProduct() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.GetProductRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetProduct(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductSearchClient_UpdateProduct() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.UpdateProductRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateProduct(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductSearchClient_DeleteProduct() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.DeleteProductRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteProduct(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleProductSearchClient_ListReferenceImages() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.ListReferenceImagesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListReferenceImages(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleProductSearchClient_GetReferenceImage() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.GetReferenceImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetReferenceImage(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductSearchClient_DeleteReferenceImage() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.DeleteReferenceImageRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteReferenceImage(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleProductSearchClient_CreateReferenceImage() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.CreateReferenceImageRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateReferenceImage(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductSearchClient_CreateProductSet() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.CreateProductSetRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateProductSet(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductSearchClient_ListProductSets() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.ListProductSetsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListProductSets(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleProductSearchClient_GetProductSet() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.GetProductSetRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetProductSet(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductSearchClient_UpdateProductSet() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.UpdateProductSetRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateProductSet(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleProductSearchClient_DeleteProductSet() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.DeleteProductSetRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteProductSet(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleProductSearchClient_AddProductToProductSet() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.AddProductToProductSetRequest{ + // TODO: Fill request struct fields. + } + err = c.AddProductToProductSet(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleProductSearchClient_RemoveProductFromProductSet() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.RemoveProductFromProductSetRequest{ + // TODO: Fill request struct fields. + } + err = c.RemoveProductFromProductSet(ctx, req) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleProductSearchClient_ListProductsInProductSet() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.ListProductsInProductSetRequest{ + // TODO: Fill request struct fields. + } + it := c.ListProductsInProductSet(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleProductSearchClient_ImportProductSets() { + ctx := context.Background() + c, err := vision.NewProductSearchClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.ImportProductSetsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ImportProductSets(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/vision/apiv1p1beta1/BatchAnnotateImages_smoke_test.go b/vendor/cloud.google.com/go/vision/apiv1p1beta1/BatchAnnotateImages_smoke_test.go new file mode 100644 index 000000000..cea107b66 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1p1beta1/BatchAnnotateImages_smoke_test.go @@ -0,0 +1,82 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision + +import ( + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1" +) + +import ( + "context" + "fmt" + "strconv" + "testing" + "time" + + "cloud.google.com/go/internal/testutil" + "google.golang.org/api/iterator" + "google.golang.org/api/option" +) + +var _ = fmt.Sprintf +var _ = iterator.Done +var _ = strconv.FormatUint +var _ = time.Now + +func TestImageAnnotatorSmoke(t *testing.T) { + if testing.Short() { + t.Skip("skipping smoke test in short mode") + } + ctx := context.Background() + ts := testutil.TokenSource(ctx, DefaultAuthScopes()...) + if ts == nil { + t.Skip("Integration tests skipped. See CONTRIBUTING.md for details") + } + + projectId := testutil.ProjID() + _ = projectId + + c, err := NewImageAnnotatorClient(ctx, option.WithTokenSource(ts)) + if err != nil { + t.Fatal(err) + } + + var gcsImageUri string = "gs://gapic-toolkit/President_Barack_Obama.jpg" + var source = &visionpb.ImageSource{ + GcsImageUri: gcsImageUri, + } + var image = &visionpb.Image{ + Source: source, + } + var type_ visionpb.Feature_Type = visionpb.Feature_FACE_DETECTION + var featuresElement = &visionpb.Feature{ + Type: type_, + } + var features = []*visionpb.Feature{featuresElement} + var requestsElement = &visionpb.AnnotateImageRequest{ + Image: image, + Features: features, + } + var requests = []*visionpb.AnnotateImageRequest{requestsElement} + var request = &visionpb.BatchAnnotateImagesRequest{ + Requests: requests, + } + + if _, err := c.BatchAnnotateImages(ctx, request); err != nil { + t.Error(err) + } +} diff --git a/vendor/cloud.google.com/go/vision/apiv1p1beta1/doc.go b/vendor/cloud.google.com/go/vision/apiv1p1beta1/doc.go new file mode 100644 index 000000000..317f2f61b --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1p1beta1/doc.go @@ -0,0 +1,93 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +// Package vision is an auto-generated package for the +// Google Cloud Vision API. +// +// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// +// Integrates Google Vision features, including image labeling, face, logo, +// and +// landmark detection, optical character recognition (OCR), and detection of +// explicit content, into applications. +package vision // import "cloud.google.com/go/vision/apiv1p1beta1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/grpc/metadata" +) + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-vision", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return strings.IndexRune("0123456789.", r) < 0 + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} + +const versionClient = "20181129" diff --git a/vendor/cloud.google.com/go/vision/apiv1p1beta1/image_annotator_client.go b/vendor/cloud.google.com/go/vision/apiv1p1beta1/image_annotator_client.go new file mode 100644 index 000000000..d0a753753 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1p1beta1/image_annotator_client.go @@ -0,0 +1,135 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision + +import ( + "context" + "time" + + gax "github.com/googleapis/gax-go" + "google.golang.org/api/option" + "google.golang.org/api/transport" + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" +) + +// ImageAnnotatorCallOptions contains the retry settings for each method of ImageAnnotatorClient. +type ImageAnnotatorCallOptions struct { + BatchAnnotateImages []gax.CallOption +} + +func defaultImageAnnotatorClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("vision.googleapis.com:443"), + option.WithScopes(DefaultAuthScopes()...), + } +} + +func defaultImageAnnotatorCallOptions() *ImageAnnotatorCallOptions { + retry := map[[2]string][]gax.CallOption{ + {"default", "idempotent"}: { + gax.WithRetry(func() gax.Retryer { + return gax.OnCodes([]codes.Code{ + codes.DeadlineExceeded, + codes.Unavailable, + }, gax.Backoff{ + Initial: 100 * time.Millisecond, + Max: 60000 * time.Millisecond, + Multiplier: 1.3, + }) + }), + }, + } + return &ImageAnnotatorCallOptions{ + BatchAnnotateImages: retry[[2]string{"default", "idempotent"}], + } +} + +// ImageAnnotatorClient is a client for interacting with Google Cloud Vision API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type ImageAnnotatorClient struct { + // The connection to the service. + conn *grpc.ClientConn + + // The gRPC API client. + imageAnnotatorClient visionpb.ImageAnnotatorClient + + // The call options for this service. + CallOptions *ImageAnnotatorCallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewImageAnnotatorClient creates a new image annotator client. +// +// Service that performs Google Cloud Vision API detection tasks over client +// images, such as face, landmark, logo, label, and text detection. The +// ImageAnnotator service returns detected entities from the images. +func NewImageAnnotatorClient(ctx context.Context, opts ...option.ClientOption) (*ImageAnnotatorClient, error) { + conn, err := transport.DialGRPC(ctx, append(defaultImageAnnotatorClientOptions(), opts...)...) + if err != nil { + return nil, err + } + c := &ImageAnnotatorClient{ + conn: conn, + CallOptions: defaultImageAnnotatorCallOptions(), + + imageAnnotatorClient: visionpb.NewImageAnnotatorClient(conn), + } + c.setGoogleClientInfo() + return c, nil +} + +// Connection returns the client's connection to the API service. +func (c *ImageAnnotatorClient) Connection() *grpc.ClientConn { + return c.conn +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *ImageAnnotatorClient) Close() error { + return c.conn.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *ImageAnnotatorClient) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// BatchAnnotateImages run image detection and annotation for a batch of images. +func (c *ImageAnnotatorClient) BatchAnnotateImages(ctx context.Context, req *visionpb.BatchAnnotateImagesRequest, opts ...gax.CallOption) (*visionpb.BatchAnnotateImagesResponse, error) { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.BatchAnnotateImages[0:len(c.CallOptions.BatchAnnotateImages):len(c.CallOptions.BatchAnnotateImages)], opts...) + var resp *visionpb.BatchAnnotateImagesResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.imageAnnotatorClient.BatchAnnotateImages(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/vendor/cloud.google.com/go/vision/apiv1p1beta1/image_annotator_client_example_test.go b/vendor/cloud.google.com/go/vision/apiv1p1beta1/image_annotator_client_example_test.go new file mode 100644 index 000000000..cc99d230f --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1p1beta1/image_annotator_client_example_test.go @@ -0,0 +1,52 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision_test + +import ( + "context" + + vision "cloud.google.com/go/vision/apiv1p1beta1" + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1" +) + +func ExampleNewImageAnnotatorClient() { + ctx := context.Background() + c, err := vision.NewImageAnnotatorClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleImageAnnotatorClient_BatchAnnotateImages() { + ctx := context.Background() + c, err := vision.NewImageAnnotatorClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &visionpb.BatchAnnotateImagesRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BatchAnnotateImages(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/vendor/cloud.google.com/go/vision/apiv1p1beta1/mock_test.go b/vendor/cloud.google.com/go/vision/apiv1p1beta1/mock_test.go new file mode 100644 index 000000000..999a45373 --- /dev/null +++ b/vendor/cloud.google.com/go/vision/apiv1p1beta1/mock_test.go @@ -0,0 +1,159 @@ +// 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 +// +// https://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. + +// AUTO-GENERATED CODE. DO NOT EDIT. + +package vision + +import ( + visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1" +) + +import ( + "context" + "flag" + "fmt" + "io" + "log" + "net" + "os" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/api/option" + status "google.golang.org/genproto/googleapis/rpc/status" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + gstatus "google.golang.org/grpc/status" +) + +var _ = io.EOF +var _ = ptypes.MarshalAny +var _ status.Status + +type mockImageAnnotatorServer struct { + // Embed for forward compatibility. + // Tests will keep working if more methods are added + // in the future. + visionpb.ImageAnnotatorServer + + reqs []proto.Message + + // If set, all calls return this error. + err error + + // responses to return if err == nil + resps []proto.Message +} + +func (s *mockImageAnnotatorServer) BatchAnnotateImages(ctx context.Context, req *visionpb.BatchAnnotateImagesRequest) (*visionpb.BatchAnnotateImagesResponse, error) { + md, _ := metadata.FromIncomingContext(ctx) + if xg := md["x-goog-api-client"]; len(xg) == 0 || !strings.Contains(xg[0], "gl-go/") { + return nil, fmt.Errorf("x-goog-api-client = %v, expected gl-go key", xg) + } + s.reqs = append(s.reqs, req) + if s.err != nil { + return nil, s.err + } + return s.resps[0].(*visionpb.BatchAnnotateImagesResponse), nil +} + +// clientOpt is the option tests should use to connect to the test server. +// It is initialized by TestMain. +var clientOpt option.ClientOption + +var ( + mockImageAnnotator mockImageAnnotatorServer +) + +func TestMain(m *testing.M) { + flag.Parse() + + serv := grpc.NewServer() + visionpb.RegisterImageAnnotatorServer(serv, &mockImageAnnotator) + + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + log.Fatal(err) + } + go serv.Serve(lis) + + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + if err != nil { + log.Fatal(err) + } + clientOpt = option.WithGRPCConn(conn) + + os.Exit(m.Run()) +} + +func TestImageAnnotatorBatchAnnotateImages(t *testing.T) { + var expectedResponse *visionpb.BatchAnnotateImagesResponse = &visionpb.BatchAnnotateImagesResponse{} + + mockImageAnnotator.err = nil + mockImageAnnotator.reqs = nil + + mockImageAnnotator.resps = append(mockImageAnnotator.resps[:0], expectedResponse) + + var requests []*visionpb.AnnotateImageRequest = nil + var request = &visionpb.BatchAnnotateImagesRequest{ + Requests: requests, + } + + c, err := NewImageAnnotatorClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchAnnotateImages(context.Background(), request) + + if err != nil { + t.Fatal(err) + } + + if want, got := request, mockImageAnnotator.reqs[0]; !proto.Equal(want, got) { + t.Errorf("wrong request %q, want %q", got, want) + } + + if want, got := expectedResponse, resp; !proto.Equal(want, got) { + t.Errorf("wrong response %q, want %q)", got, want) + } +} + +func TestImageAnnotatorBatchAnnotateImagesError(t *testing.T) { + errCode := codes.PermissionDenied + mockImageAnnotator.err = gstatus.Error(errCode, "test error") + + var requests []*visionpb.AnnotateImageRequest = nil + var request = &visionpb.BatchAnnotateImagesRequest{ + Requests: requests, + } + + c, err := NewImageAnnotatorClient(context.Background(), clientOpt) + if err != nil { + t.Fatal(err) + } + + resp, err := c.BatchAnnotateImages(context.Background(), request) + + if st, ok := gstatus.FromError(err); !ok { + t.Errorf("got error %v, expected grpc error", err) + } else if c := st.Code(); c != errCode { + t.Errorf("got error code %q, want %q", c, errCode) + } + _ = resp +} diff --git a/vendor/github.com/beorn7/perks/.gitignore b/vendor/github.com/beorn7/perks/.gitignore deleted file mode 100644 index 1bd9209aa..000000000 --- a/vendor/github.com/beorn7/perks/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.test -*.prof diff --git a/vendor/github.com/beorn7/perks/LICENSE b/vendor/github.com/beorn7/perks/LICENSE deleted file mode 100644 index 339177be6..000000000 --- a/vendor/github.com/beorn7/perks/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2013 Blake Mizerany - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/beorn7/perks/README.md b/vendor/github.com/beorn7/perks/README.md deleted file mode 100644 index fc0577770..000000000 --- a/vendor/github.com/beorn7/perks/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Perks for Go (golang.org) - -Perks contains the Go package quantile that computes approximate quantiles over -an unbounded data stream within low memory and CPU bounds. - -For more information and examples, see: -http://godoc.org/github.com/bmizerany/perks - -A very special thank you and shout out to Graham Cormode (Rutgers University), -Flip Korn (AT&T Labs–Research), S. Muthukrishnan (Rutgers University), and -Divesh Srivastava (AT&T Labs–Research) for their research and publication of -[Effective Computation of Biased Quantiles over Data Streams](http://www.cs.rutgers.edu/~muthu/bquant.pdf) - -Thank you, also: -* Armon Dadgar (@armon) -* Andrew Gerrand (@nf) -* Brad Fitzpatrick (@bradfitz) -* Keith Rarick (@kr) - -FAQ: - -Q: Why not move the quantile package into the project root? -A: I want to add more packages to perks later. - -Copyright (C) 2013 Blake Mizerany - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/beorn7/perks/histogram/bench_test.go b/vendor/github.com/beorn7/perks/histogram/bench_test.go deleted file mode 100644 index 56c7e5516..000000000 --- a/vendor/github.com/beorn7/perks/histogram/bench_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package histogram - -import ( - "math/rand" - "testing" -) - -func BenchmarkInsert10Bins(b *testing.B) { - b.StopTimer() - h := New(10) - b.StartTimer() - for i := 0; i < b.N; i++ { - f := rand.ExpFloat64() - h.Insert(f) - } -} - -func BenchmarkInsert100Bins(b *testing.B) { - b.StopTimer() - h := New(100) - b.StartTimer() - for i := 0; i < b.N; i++ { - f := rand.ExpFloat64() - h.Insert(f) - } -} diff --git a/vendor/github.com/beorn7/perks/histogram/histogram.go b/vendor/github.com/beorn7/perks/histogram/histogram.go deleted file mode 100644 index bef05c70c..000000000 --- a/vendor/github.com/beorn7/perks/histogram/histogram.go +++ /dev/null @@ -1,108 +0,0 @@ -// Package histogram provides a Go implementation of BigML's histogram package -// for Clojure/Java. It is currently experimental. -package histogram - -import ( - "container/heap" - "math" - "sort" -) - -type Bin struct { - Count int - Sum float64 -} - -func (b *Bin) Update(x *Bin) { - b.Count += x.Count - b.Sum += x.Sum -} - -func (b *Bin) Mean() float64 { - return b.Sum / float64(b.Count) -} - -type Bins []*Bin - -func (bs Bins) Len() int { return len(bs) } -func (bs Bins) Less(i, j int) bool { return bs[i].Mean() < bs[j].Mean() } -func (bs Bins) Swap(i, j int) { bs[i], bs[j] = bs[j], bs[i] } - -func (bs *Bins) Push(x interface{}) { - *bs = append(*bs, x.(*Bin)) -} - -func (bs *Bins) Pop() interface{} { - return bs.remove(len(*bs) - 1) -} - -func (bs *Bins) remove(n int) *Bin { - if n < 0 || len(*bs) < n { - return nil - } - x := (*bs)[n] - *bs = append((*bs)[:n], (*bs)[n+1:]...) - return x -} - -type Histogram struct { - res *reservoir -} - -func New(maxBins int) *Histogram { - return &Histogram{res: newReservoir(maxBins)} -} - -func (h *Histogram) Insert(f float64) { - h.res.insert(&Bin{1, f}) - h.res.compress() -} - -func (h *Histogram) Bins() Bins { - return h.res.bins -} - -type reservoir struct { - n int - maxBins int - bins Bins -} - -func newReservoir(maxBins int) *reservoir { - return &reservoir{maxBins: maxBins} -} - -func (r *reservoir) insert(bin *Bin) { - r.n += bin.Count - i := sort.Search(len(r.bins), func(i int) bool { - return r.bins[i].Mean() >= bin.Mean() - }) - if i < 0 || i == r.bins.Len() { - // TODO(blake): Maybe use an .insert(i, bin) instead of - // performing the extra work of a heap.Push. - heap.Push(&r.bins, bin) - return - } - r.bins[i].Update(bin) -} - -func (r *reservoir) compress() { - for r.bins.Len() > r.maxBins { - minGapIndex := -1 - minGap := math.MaxFloat64 - for i := 0; i < r.bins.Len()-1; i++ { - gap := gapWeight(r.bins[i], r.bins[i+1]) - if minGap > gap { - minGap = gap - minGapIndex = i - } - } - prev := r.bins[minGapIndex] - next := r.bins.remove(minGapIndex + 1) - prev.Update(next) - } -} - -func gapWeight(prev, next *Bin) float64 { - return next.Mean() - prev.Mean() -} diff --git a/vendor/github.com/beorn7/perks/histogram/histogram_test.go b/vendor/github.com/beorn7/perks/histogram/histogram_test.go deleted file mode 100644 index 0575ebeee..000000000 --- a/vendor/github.com/beorn7/perks/histogram/histogram_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package histogram - -import ( - "math/rand" - "testing" -) - -func TestHistogram(t *testing.T) { - const numPoints = 1e6 - const maxBins = 3 - - h := New(maxBins) - for i := 0; i < numPoints; i++ { - f := rand.ExpFloat64() - h.Insert(f) - } - - bins := h.Bins() - if g := len(bins); g > maxBins { - t.Fatalf("got %d bins, wanted <= %d", g, maxBins) - } - - for _, b := range bins { - t.Logf("%+v", b) - } - - if g := count(h.Bins()); g != numPoints { - t.Fatalf("binned %d points, wanted %d", g, numPoints) - } -} - -func count(bins Bins) int { - binCounts := 0 - for _, b := range bins { - binCounts += b.Count - } - return binCounts -} diff --git a/vendor/github.com/beorn7/perks/quantile/bench_test.go b/vendor/github.com/beorn7/perks/quantile/bench_test.go deleted file mode 100644 index 0bd0e4e77..000000000 --- a/vendor/github.com/beorn7/perks/quantile/bench_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package quantile - -import ( - "testing" -) - -func BenchmarkInsertTargeted(b *testing.B) { - b.ReportAllocs() - - s := NewTargeted(Targets) - b.ResetTimer() - for i := float64(0); i < float64(b.N); i++ { - s.Insert(i) - } -} - -func BenchmarkInsertTargetedSmallEpsilon(b *testing.B) { - s := NewTargeted(TargetsSmallEpsilon) - b.ResetTimer() - for i := float64(0); i < float64(b.N); i++ { - s.Insert(i) - } -} - -func BenchmarkInsertBiased(b *testing.B) { - s := NewLowBiased(0.01) - b.ResetTimer() - for i := float64(0); i < float64(b.N); i++ { - s.Insert(i) - } -} - -func BenchmarkInsertBiasedSmallEpsilon(b *testing.B) { - s := NewLowBiased(0.0001) - b.ResetTimer() - for i := float64(0); i < float64(b.N); i++ { - s.Insert(i) - } -} - -func BenchmarkQuery(b *testing.B) { - s := NewTargeted(Targets) - for i := float64(0); i < 1e6; i++ { - s.Insert(i) - } - b.ResetTimer() - n := float64(b.N) - for i := float64(0); i < n; i++ { - s.Query(i / n) - } -} - -func BenchmarkQuerySmallEpsilon(b *testing.B) { - s := NewTargeted(TargetsSmallEpsilon) - for i := float64(0); i < 1e6; i++ { - s.Insert(i) - } - b.ResetTimer() - n := float64(b.N) - for i := float64(0); i < n; i++ { - s.Query(i / n) - } -} diff --git a/vendor/github.com/beorn7/perks/quantile/example_test.go b/vendor/github.com/beorn7/perks/quantile/example_test.go deleted file mode 100644 index ab3293aaf..000000000 --- a/vendor/github.com/beorn7/perks/quantile/example_test.go +++ /dev/null @@ -1,121 +0,0 @@ -// +build go1.1 - -package quantile_test - -import ( - "bufio" - "fmt" - "log" - "os" - "strconv" - "time" - - "github.com/beorn7/perks/quantile" -) - -func Example_simple() { - ch := make(chan float64) - go sendFloats(ch) - - // Compute the 50th, 90th, and 99th percentile. - q := quantile.NewTargeted(map[float64]float64{ - 0.50: 0.005, - 0.90: 0.001, - 0.99: 0.0001, - }) - for v := range ch { - q.Insert(v) - } - - fmt.Println("perc50:", q.Query(0.50)) - fmt.Println("perc90:", q.Query(0.90)) - fmt.Println("perc99:", q.Query(0.99)) - fmt.Println("count:", q.Count()) - // Output: - // perc50: 5 - // perc90: 16 - // perc99: 223 - // count: 2388 -} - -func Example_mergeMultipleStreams() { - // Scenario: - // We have multiple database shards. On each shard, there is a process - // collecting query response times from the database logs and inserting - // them into a Stream (created via NewTargeted(0.90)), much like the - // Simple example. These processes expose a network interface for us to - // ask them to serialize and send us the results of their - // Stream.Samples so we may Merge and Query them. - // - // NOTES: - // * These sample sets are small, allowing us to get them - // across the network much faster than sending the entire list of data - // points. - // - // * For this to work correctly, we must supply the same quantiles - // a priori the process collecting the samples supplied to NewTargeted, - // even if we do not plan to query them all here. - ch := make(chan quantile.Samples) - getDBQuerySamples(ch) - q := quantile.NewTargeted(map[float64]float64{0.90: 0.001}) - for samples := range ch { - q.Merge(samples) - } - fmt.Println("perc90:", q.Query(0.90)) -} - -func Example_window() { - // Scenario: We want the 90th, 95th, and 99th percentiles for each - // minute. - - ch := make(chan float64) - go sendStreamValues(ch) - - tick := time.NewTicker(1 * time.Minute) - q := quantile.NewTargeted(map[float64]float64{ - 0.90: 0.001, - 0.95: 0.0005, - 0.99: 0.0001, - }) - for { - select { - case t := <-tick.C: - flushToDB(t, q.Samples()) - q.Reset() - case v := <-ch: - q.Insert(v) - } - } -} - -func sendStreamValues(ch chan float64) { - // Use your imagination -} - -func flushToDB(t time.Time, samples quantile.Samples) { - // Use your imagination -} - -// This is a stub for the above example. In reality this would hit the remote -// servers via http or something like it. -func getDBQuerySamples(ch chan quantile.Samples) {} - -func sendFloats(ch chan<- float64) { - f, err := os.Open("exampledata.txt") - if err != nil { - log.Fatal(err) - } - sc := bufio.NewScanner(f) - for sc.Scan() { - b := sc.Bytes() - v, err := strconv.ParseFloat(string(b), 64) - if err != nil { - log.Fatal(err) - } - ch <- v - } - if sc.Err() != nil { - log.Fatal(sc.Err()) - } - close(ch) -} diff --git a/vendor/github.com/beorn7/perks/quantile/exampledata.txt b/vendor/github.com/beorn7/perks/quantile/exampledata.txt deleted file mode 100644 index 1602287d7..000000000 --- a/vendor/github.com/beorn7/perks/quantile/exampledata.txt +++ /dev/null @@ -1,2388 +0,0 @@ -8 -5 -26 -12 -5 -235 -13 -6 -28 -30 -3 -3 -3 -3 -5 -2 -33 -7 -2 -4 -7 -12 -14 -5 -8 -3 -10 -4 -5 -3 -6 -6 -209 -20 -3 -10 -14 -3 -4 -6 -8 -5 -11 -7 -3 -2 -3 -3 -212 -5 -222 -4 -10 -10 -5 -6 -3 -8 -3 -10 -254 -220 -2 -3 -5 -24 -5 -4 -222 -7 -3 -3 -223 -8 -15 -12 -14 -14 -3 -2 -2 -3 -13 -3 -11 -4 -4 -6 -5 -7 -13 -5 -3 -5 -2 -5 -3 -5 -2 -7 -15 -17 -14 -3 -6 -6 -3 -17 -5 -4 -7 -6 -4 -4 -8 -6 -8 -3 -9 -3 -6 -3 -4 -5 -3 -3 -660 -4 -6 -10 -3 -6 -3 -2 -5 -13 -2 -4 -4 -10 -4 -8 -4 -3 -7 -9 -9 -3 -10 -37 -3 -13 -4 -12 -3 -6 -10 -8 -5 -21 -2 -3 -8 -3 -2 -3 -3 -4 -12 -2 -4 -8 -8 -4 -3 -2 -20 -1 -6 -32 -2 -11 -6 -18 -3 -8 -11 -3 -212 -3 -4 -2 -6 -7 -12 -11 -3 -2 -16 -10 -6 -4 -6 -3 -2 -7 -3 -2 -2 -2 -2 -5 -6 -4 -3 -10 -3 -4 -6 -5 -3 -4 -4 -5 -6 -4 -3 -4 -4 -5 -7 -5 -5 -3 -2 -7 -2 -4 -12 -4 -5 -6 -2 -4 -4 -8 -4 -15 -13 -7 -16 -5 -3 -23 -5 -5 -7 -3 -2 -9 -8 -7 -5 -8 -11 -4 -10 -76 -4 -47 -4 -3 -2 -7 -4 -2 -3 -37 -10 -4 -2 -20 -5 -4 -4 -10 -10 -4 -3 -7 -23 -240 -7 -13 -5 -5 -3 -3 -2 -5 -4 -2 -8 -7 -19 -2 -23 -8 -7 -2 -5 -3 -8 -3 -8 -13 -5 -5 -5 -2 -3 -23 -4 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 -4 -3 -3 -3 -29 -2 -2 -4 -3 -3 -5 -4 -6 -3 -3 -2 -4 diff --git a/vendor/github.com/beorn7/perks/quantile/stream.go b/vendor/github.com/beorn7/perks/quantile/stream.go deleted file mode 100644 index d7d14f8eb..000000000 --- a/vendor/github.com/beorn7/perks/quantile/stream.go +++ /dev/null @@ -1,316 +0,0 @@ -// Package quantile computes approximate quantiles over an unbounded data -// stream within low memory and CPU bounds. -// -// A small amount of accuracy is traded to achieve the above properties. -// -// Multiple streams can be merged before calling Query to generate a single set -// of results. This is meaningful when the streams represent the same type of -// data. See Merge and Samples. -// -// For more detailed information about the algorithm used, see: -// -// Effective Computation of Biased Quantiles over Data Streams -// -// http://www.cs.rutgers.edu/~muthu/bquant.pdf -package quantile - -import ( - "math" - "sort" -) - -// Sample holds an observed value and meta information for compression. JSON -// tags have been added for convenience. -type Sample struct { - Value float64 `json:",string"` - Width float64 `json:",string"` - Delta float64 `json:",string"` -} - -// Samples represents a slice of samples. It implements sort.Interface. -type Samples []Sample - -func (a Samples) Len() int { return len(a) } -func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value } -func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] } - -type invariant func(s *stream, r float64) float64 - -// NewLowBiased returns an initialized Stream for low-biased quantiles -// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but -// error guarantees can still be given even for the lower ranks of the data -// distribution. -// -// The provided epsilon is a relative error, i.e. the true quantile of a value -// returned by a query is guaranteed to be within (1±Epsilon)*Quantile. -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error -// properties. -func NewLowBiased(epsilon float64) *Stream { - ƒ := func(s *stream, r float64) float64 { - return 2 * epsilon * r - } - return newStream(ƒ) -} - -// NewHighBiased returns an initialized Stream for high-biased quantiles -// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but -// error guarantees can still be given even for the higher ranks of the data -// distribution. -// -// The provided epsilon is a relative error, i.e. the true quantile of a value -// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile). -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error -// properties. -func NewHighBiased(epsilon float64) *Stream { - ƒ := func(s *stream, r float64) float64 { - return 2 * epsilon * (s.n - r) - } - return newStream(ƒ) -} - -// NewTargeted returns an initialized Stream concerned with a particular set of -// quantile values that are supplied a priori. Knowing these a priori reduces -// space and computation time. The targets map maps the desired quantiles to -// their absolute errors, i.e. the true quantile of a value returned by a query -// is guaranteed to be within (Quantile±Epsilon). -// -// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties. -func NewTargeted(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 _, t := range targets { - if t.quantile*s.n <= r { - f = (2 * t.epsilon * r) / t.quantile - } else { - f = (2 * t.epsilon * (s.n - r)) / (1 - t.quantile) - } - if f < m { - m = f - } - } - return m - } - 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 { - *stream - b Samples - sorted bool -} - -func newStream(ƒ invariant) *Stream { - x := &stream{ƒ: ƒ} - return &Stream{x, make(Samples, 0, 500), true} -} - -// Insert inserts v into the stream. -func (s *Stream) Insert(v float64) { - s.insert(Sample{Value: v, Width: 1}) -} - -func (s *Stream) insert(sample Sample) { - s.b = append(s.b, sample) - s.sorted = false - if len(s.b) == cap(s.b) { - s.flush() - } -} - -// Query returns the computed qth percentiles value. If s was created with -// NewTargeted, and q is not in the set of quantiles provided a priori, Query -// will return an unspecified result. -func (s *Stream) Query(q float64) float64 { - if !s.flushed() { - // Fast path when there hasn't been enough data for a flush; - // this also yields better accuracy for small sets of data. - l := len(s.b) - if l == 0 { - return 0 - } - i := int(math.Ceil(float64(l) * q)) - if i > 0 { - i -= 1 - } - s.maybeSort() - return s.b[i].Value - } - s.flush() - return s.stream.query(q) -} - -// Merge merges samples into the underlying streams samples. This is handy when -// merging multiple streams from separate threads, database shards, etc. -// -// ATTENTION: This method is broken and does not yield correct results. The -// underlying algorithm is not capable of merging streams correctly. -func (s *Stream) Merge(samples Samples) { - sort.Sort(samples) - s.stream.merge(samples) -} - -// Reset reinitializes and clears the list reusing the samples buffer memory. -func (s *Stream) Reset() { - s.stream.reset() - s.b = s.b[:0] -} - -// Samples returns stream samples held by s. -func (s *Stream) Samples() Samples { - if !s.flushed() { - return s.b - } - s.flush() - return s.stream.samples() -} - -// Count returns the total number of samples observed in the stream -// since initialization. -func (s *Stream) Count() int { - return len(s.b) + s.stream.count() -} - -func (s *Stream) flush() { - s.maybeSort() - s.stream.merge(s.b) - s.b = s.b[:0] -} - -func (s *Stream) maybeSort() { - if !s.sorted { - s.sorted = true - sort.Sort(s.b) - } -} - -func (s *Stream) flushed() bool { - return len(s.stream.l) > 0 -} - -type stream struct { - n float64 - l []Sample - ƒ invariant -} - -func (s *stream) reset() { - s.l = s.l[:0] - s.n = 0 -} - -func (s *stream) insert(v float64) { - s.merge(Samples{{v, 1, 0}}) -} - -func (s *stream) merge(samples Samples) { - // TODO(beorn7): This tries to merge not only individual samples, but - // whole summaries. The paper doesn't mention merging summaries at - // all. Unittests show that the merging is inaccurate. Find out how to - // do merges properly. - var r float64 - i := 0 - for _, sample := range samples { - for ; i < len(s.l); i++ { - c := s.l[i] - if c.Value > sample.Value { - // Insert at position i. - s.l = append(s.l, Sample{}) - copy(s.l[i+1:], s.l[i:]) - s.l[i] = Sample{ - sample.Value, - sample.Width, - math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1), - // TODO(beorn7): How to calculate delta correctly? - } - i++ - goto inserted - } - r += c.Width - } - s.l = append(s.l, Sample{sample.Value, sample.Width, 0}) - i++ - inserted: - s.n += sample.Width - r += sample.Width - } - s.compress() -} - -func (s *stream) count() int { - return int(s.n) -} - -func (s *stream) query(q float64) float64 { - t := math.Ceil(q * s.n) - t += math.Ceil(s.ƒ(s, t) / 2) - p := s.l[0] - var r float64 - for _, c := range s.l[1:] { - r += p.Width - if r+c.Width+c.Delta > t { - return p.Value - } - p = c - } - return p.Value -} - -func (s *stream) compress() { - if len(s.l) < 2 { - return - } - x := s.l[len(s.l)-1] - xi := len(s.l) - 1 - r := s.n - 1 - x.Width - - for i := len(s.l) - 2; i >= 0; i-- { - c := s.l[i] - if c.Width+x.Width+x.Delta <= s.ƒ(s, r) { - x.Width += c.Width - s.l[xi] = x - // Remove element at i. - copy(s.l[i:], s.l[i+1:]) - s.l = s.l[:len(s.l)-1] - xi -= 1 - } else { - x = c - xi = i - } - r -= c.Width - } -} - -func (s *stream) samples() Samples { - samples := make(Samples, len(s.l)) - copy(samples, s.l) - return samples -} diff --git a/vendor/github.com/beorn7/perks/quantile/stream_test.go b/vendor/github.com/beorn7/perks/quantile/stream_test.go deleted file mode 100644 index 855195097..000000000 --- a/vendor/github.com/beorn7/perks/quantile/stream_test.go +++ /dev/null @@ -1,215 +0,0 @@ -package quantile - -import ( - "math" - "math/rand" - "sort" - "testing" -) - -var ( - Targets = map[float64]float64{ - 0.01: 0.001, - 0.10: 0.01, - 0.50: 0.05, - 0.90: 0.01, - 0.99: 0.001, - } - TargetsSmallEpsilon = map[float64]float64{ - 0.01: 0.0001, - 0.10: 0.001, - 0.50: 0.005, - 0.90: 0.001, - 0.99: 0.0001, - } - LowQuantiles = []float64{0.01, 0.1, 0.5} - HighQuantiles = []float64{0.99, 0.9, 0.5} -) - -const RelativeEpsilon = 0.01 - -func verifyPercsWithAbsoluteEpsilon(t *testing.T, a []float64, s *Stream) { - sort.Float64s(a) - for quantile, epsilon := range Targets { - n := float64(len(a)) - k := int(quantile * n) - if k < 1 { - k = 1 - } - lower := int((quantile - epsilon) * n) - if lower < 1 { - lower = 1 - } - upper := int(math.Ceil((quantile + epsilon) * n)) - if upper > len(a) { - upper = len(a) - } - w, min, max := a[k-1], a[lower-1], a[upper-1] - if g := s.Query(quantile); g < min || g > max { - t.Errorf("q=%f: want %v [%f,%f], got %v", quantile, w, min, max, g) - } - } -} - -func verifyLowPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) { - sort.Float64s(a) - for _, qu := range LowQuantiles { - n := float64(len(a)) - k := int(qu * n) - - lowerRank := int((1 - RelativeEpsilon) * qu * n) - upperRank := int(math.Ceil((1 + RelativeEpsilon) * qu * n)) - w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1] - if g := s.Query(qu); g < min || g > max { - t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g) - } - } -} - -func verifyHighPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) { - sort.Float64s(a) - for _, qu := range HighQuantiles { - n := float64(len(a)) - k := int(qu * n) - - lowerRank := int((1 - (1+RelativeEpsilon)*(1-qu)) * n) - upperRank := int(math.Ceil((1 - (1-RelativeEpsilon)*(1-qu)) * n)) - w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1] - if g := s.Query(qu); g < min || g > max { - t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g) - } - } -} - -func populateStream(s *Stream) []float64 { - a := make([]float64, 0, 1e5+100) - for i := 0; i < cap(a); i++ { - v := rand.NormFloat64() - // Add 5% asymmetric outliers. - if i%20 == 0 { - v = v*v + 1 - } - s.Insert(v) - a = append(a, v) - } - return a -} - -func TestTargetedQuery(t *testing.T) { - rand.Seed(42) - s := NewTargeted(Targets) - a := populateStream(s) - verifyPercsWithAbsoluteEpsilon(t, a, s) -} - -func TestTargetedQuerySmallSampleSize(t *testing.T) { - rand.Seed(42) - s := NewTargeted(TargetsSmallEpsilon) - a := []float64{1, 2, 3, 4, 5} - for _, v := range a { - s.Insert(v) - } - verifyPercsWithAbsoluteEpsilon(t, a, s) - // If not yet flushed, results should be precise: - if !s.flushed() { - for φ, want := range map[float64]float64{ - 0.01: 1, - 0.10: 1, - 0.50: 3, - 0.90: 5, - 0.99: 5, - } { - if got := s.Query(φ); got != want { - t.Errorf("want %f for φ=%f, got %f", want, φ, got) - } - } - } -} - -func TestLowBiasedQuery(t *testing.T) { - rand.Seed(42) - s := NewLowBiased(RelativeEpsilon) - a := populateStream(s) - verifyLowPercsWithRelativeEpsilon(t, a, s) -} - -func TestHighBiasedQuery(t *testing.T) { - rand.Seed(42) - s := NewHighBiased(RelativeEpsilon) - a := populateStream(s) - verifyHighPercsWithRelativeEpsilon(t, a, s) -} - -// BrokenTestTargetedMerge is broken, see Merge doc comment. -func BrokenTestTargetedMerge(t *testing.T) { - rand.Seed(42) - s1 := NewTargeted(Targets) - s2 := NewTargeted(Targets) - a := populateStream(s1) - a = append(a, populateStream(s2)...) - s1.Merge(s2.Samples()) - verifyPercsWithAbsoluteEpsilon(t, a, s1) -} - -// BrokenTestLowBiasedMerge is broken, see Merge doc comment. -func BrokenTestLowBiasedMerge(t *testing.T) { - rand.Seed(42) - s1 := NewLowBiased(RelativeEpsilon) - s2 := NewLowBiased(RelativeEpsilon) - a := populateStream(s1) - a = append(a, populateStream(s2)...) - s1.Merge(s2.Samples()) - verifyLowPercsWithRelativeEpsilon(t, a, s2) -} - -// BrokenTestHighBiasedMerge is broken, see Merge doc comment. -func BrokenTestHighBiasedMerge(t *testing.T) { - rand.Seed(42) - s1 := NewHighBiased(RelativeEpsilon) - s2 := NewHighBiased(RelativeEpsilon) - a := populateStream(s1) - a = append(a, populateStream(s2)...) - s1.Merge(s2.Samples()) - verifyHighPercsWithRelativeEpsilon(t, a, s2) -} - -func TestUncompressed(t *testing.T) { - q := NewTargeted(Targets) - for i := 100; i > 0; i-- { - q.Insert(float64(i)) - } - if g := q.Count(); g != 100 { - t.Errorf("want count 100, got %d", g) - } - // Before compression, Query should have 100% accuracy. - for quantile := range Targets { - w := quantile * 100 - if g := q.Query(quantile); g != w { - t.Errorf("want %f, got %f", w, g) - } - } -} - -func TestUncompressedSamples(t *testing.T) { - q := NewTargeted(map[float64]float64{0.99: 0.001}) - for i := 1; i <= 100; i++ { - q.Insert(float64(i)) - } - if g := q.Samples().Len(); g != 100 { - t.Errorf("want count 100, got %d", g) - } -} - -func TestUncompressedOne(t *testing.T) { - q := NewTargeted(map[float64]float64{0.99: 0.01}) - q.Insert(3.14) - if g := q.Query(0.90); g != 3.14 { - t.Error("want PI, got", g) - } -} - -func TestDefaults(t *testing.T) { - if g := NewTargeted(map[float64]float64{0.99: 0.001}).Query(0.99); g != 0 { - t.Errorf("want 0, got %f", g) - } -} diff --git a/vendor/github.com/beorn7/perks/topk/topk.go b/vendor/github.com/beorn7/perks/topk/topk.go deleted file mode 100644 index 5ac3d9904..000000000 --- a/vendor/github.com/beorn7/perks/topk/topk.go +++ /dev/null @@ -1,90 +0,0 @@ -package topk - -import ( - "sort" -) - -// http://www.cs.ucsb.edu/research/tech_reports/reports/2005-23.pdf - -type Element struct { - Value string - Count int -} - -type Samples []*Element - -func (sm Samples) Len() int { - return len(sm) -} - -func (sm Samples) Less(i, j int) bool { - return sm[i].Count < sm[j].Count -} - -func (sm Samples) Swap(i, j int) { - sm[i], sm[j] = sm[j], sm[i] -} - -type Stream struct { - k int - mon map[string]*Element - - // the minimum Element - min *Element -} - -func New(k int) *Stream { - s := new(Stream) - s.k = k - s.mon = make(map[string]*Element) - s.min = &Element{} - - // Track k+1 so that less frequenet items contended for that spot, - // resulting in k being more accurate. - return s -} - -func (s *Stream) Insert(x string) { - s.insert(&Element{x, 1}) -} - -func (s *Stream) Merge(sm Samples) { - for _, e := range sm { - s.insert(e) - } -} - -func (s *Stream) insert(in *Element) { - e := s.mon[in.Value] - if e != nil { - e.Count++ - } else { - if len(s.mon) < s.k+1 { - e = &Element{in.Value, in.Count} - s.mon[in.Value] = e - } else { - e = s.min - delete(s.mon, e.Value) - e.Value = in.Value - e.Count += in.Count - s.min = e - } - } - if e.Count < s.min.Count { - s.min = e - } -} - -func (s *Stream) Query() Samples { - var sm Samples - for _, e := range s.mon { - sm = append(sm, e) - } - sort.Sort(sort.Reverse(sm)) - - if len(sm) < s.k { - return sm - } - - return sm[:s.k] -} diff --git a/vendor/github.com/beorn7/perks/topk/topk_test.go b/vendor/github.com/beorn7/perks/topk/topk_test.go deleted file mode 100644 index c24f0f727..000000000 --- a/vendor/github.com/beorn7/perks/topk/topk_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package topk - -import ( - "fmt" - "math/rand" - "sort" - "testing" -) - -func TestTopK(t *testing.T) { - stream := New(10) - ss := []*Stream{New(10), New(10), New(10)} - m := make(map[string]int) - for _, s := range ss { - for i := 0; i < 1e6; i++ { - v := fmt.Sprintf("%x", int8(rand.ExpFloat64())) - s.Insert(v) - m[v]++ - } - stream.Merge(s.Query()) - } - - var sm Samples - for x, s := range m { - sm = append(sm, &Element{x, s}) - } - sort.Sort(sort.Reverse(sm)) - - g := stream.Query() - if len(g) != 10 { - t.Fatalf("got %d, want 10", len(g)) - } - for i, e := range g { - if sm[i].Value != e.Value { - t.Errorf("at %d: want %q, got %q", i, sm[i].Value, e.Value) - } - } -} - -func TestQuery(t *testing.T) { - queryTests := []struct { - value string - expected int - }{ - {"a", 1}, - {"b", 2}, - {"c", 2}, - } - - stream := New(2) - for _, tt := range queryTests { - stream.Insert(tt.value) - if n := len(stream.Query()); n != tt.expected { - t.Errorf("want %d, got %d", tt.expected, n) - } - } -} diff --git a/vendor/github.com/coreos/prometheus-operator/CHANGELOG.md b/vendor/github.com/coreos/prometheus-operator/CHANGELOG.md index 4b14f0ad7..92f3b470c 100644 --- a/vendor/github.com/coreos/prometheus-operator/CHANGELOG.md +++ b/vendor/github.com/coreos/prometheus-operator/CHANGELOG.md @@ -1,3 +1,14 @@ +## 0.26.0 / 2018-11-30 + +* [CHANGE] Remove attempting to set "secure" security context (#2109). +* [CHANGE] Remove deprecated StorageSpec fields (#2132). +* [ENHANCEMENT] Better handling for pod/node labels from ServiceMonitors (#2089). +* [ENHANCEMENT] Update to Proemtheus v2.5.0 as default (#2101). +* [ENHANCEMENT] Update to Alertmanager v0.15.3 as default (#2128). +* [ENHANCEMENT] Increase CPU limits for small containers to not being throttled as much (#2144). +* [BUGFIX] Sanitize thanos secret volume mount name (#2159). +* [BUGFIX] Fix racy Kubernetes multi watch (#2177). + ## 0.25.0 / 2018-10-24 * [FEATURE] Allow passing additional alert relabel configs in Prometheus custom resource (#2022) diff --git a/vendor/github.com/coreos/prometheus-operator/Documentation/api.md b/vendor/github.com/coreos/prometheus-operator/Documentation/api.md index 0688b078b..f633cddf8 100644 --- a/vendor/github.com/coreos/prometheus-operator/Documentation/api.md +++ b/vendor/github.com/coreos/prometheus-operator/Documentation/api.md @@ -121,7 +121,7 @@ AlertmanagerSpec is a specification of the desired behavior of the Alertmanager | configMaps | ConfigMaps is a list of ConfigMaps in the same namespace as the Alertmanager object, which shall be mounted into the Alertmanager Pods. The ConfigMaps are mounted into /etc/alertmanager/configmaps/. | []string | false | | logLevel | Log level for Alertmanager to be configured with. | string | false | | replicas | Size is the expected size of the alertmanager cluster. The controller will eventually make the size of the running cluster equal to the expected size. | *int32 | false | -| retention | Time duration Alertmanager shall retain data for. Default is '120h', and must match the regular expression `[0-9]+(ms\|s\|m\|h\|d\|w\|y)` (milliseconds seconds minutes hours days weeks years). | string | false | +| retention | Time duration Alertmanager shall retain data for. Default is '120h', and must match the regular expression `[0-9]+(ms\|s\|m\|h)` (milliseconds seconds minutes hours). | string | false | | storage | Storage is the definition of how storage will be used by the Alertmanager instances. | *[StorageSpec](#storagespec) | false | | externalUrl | The external URL the Alertmanager instances will be available under. This is necessary to generate correct URLs. This is necessary if Alertmanager is not served from root of a DNS name. | string | false | | routePrefix | The route prefix Alertmanager registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`. | string | false | @@ -454,10 +454,7 @@ StorageSpec defines the configured storage for a group Prometheus servers. If ne | Field | Description | Scheme | Required | | ----- | ----------- | ------ | -------- | -| class | Name of the StorageClass to use when requesting storage provisioning. More info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses (DEPRECATED - instead use `volumeClaimTemplate.spec.storageClassName`) | string | false | | emptyDir | EmptyDirVolumeSource to be used by the Prometheus StatefulSets. If specified, used in place of any volumeClaimTemplate. More info: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir | *[v1.EmptyDirVolumeSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#emptydirvolumesource-v1-core) | false | -| selector | A label query over volumes to consider for binding. (DEPRECATED - instead use `volumeClaimTemplate.spec.selector`) | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#labelselector-v1-meta) | false | -| resources | Resources represents the minimum resources the volume should have. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#resources (DEPRECATED - instead use `volumeClaimTemplate.spec.resources`) | [v1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#resourcerequirements-v1-core) | false | | volumeClaimTemplate | A PVC spec to be used by the Prometheus StatefulSets. | [v1.PersistentVolumeClaim](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#persistentvolumeclaim-v1-core) | false | [Back to TOC](#table-of-contents) diff --git a/vendor/github.com/coreos/prometheus-operator/Documentation/compatibility.md b/vendor/github.com/coreos/prometheus-operator/Documentation/compatibility.md index 0756ffc42..43e6cc6f9 100644 --- a/vendor/github.com/coreos/prometheus-operator/Documentation/compatibility.md +++ b/vendor/github.com/coreos/prometheus-operator/Documentation/compatibility.md @@ -39,3 +39,4 @@ The versions of Prometheus compatible to be run with the Prometheus Operator are * v2.4.1 * v2.4.2 * v2.4.3 +* v2.5.0 diff --git a/vendor/github.com/coreos/prometheus-operator/Documentation/rbac-crd.md b/vendor/github.com/coreos/prometheus-operator/Documentation/rbac-crd.md index 990e2997f..071578de3 100644 --- a/vendor/github.com/coreos/prometheus-operator/Documentation/rbac-crd.md +++ b/vendor/github.com/coreos/prometheus-operator/Documentation/rbac-crd.md @@ -26,7 +26,7 @@ metadata: rbac.authorization.k8s.io/aggregate-to-view: "true" rules: - apiGroups: ["monitoring.coreos.com"] - resources: ["alertmanagers, prometheuses, prometheusrules, servicemonitors"] + resources: ["alertmanagers", "prometheuses", "prometheusrules", "servicemonitors"] verbs: ["get", "list", "watch"] --- kind: ClusterRole @@ -38,6 +38,6 @@ metadata: rbac.authorization.k8s.io/aggregate-to-admin: "true" rules: - apiGroups: ["monitoring.coreos.com"] - resources: ["alertmanagers, prometheuses, prometheusrules, servicemonitors"] + resources: ["alertmanagers", "prometheuses", "prometheusrules", "servicemonitors"] verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] ``` diff --git a/vendor/github.com/coreos/prometheus-operator/Documentation/thanos.md b/vendor/github.com/coreos/prometheus-operator/Documentation/thanos.md new file mode 100644 index 000000000..626359351 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/Documentation/thanos.md @@ -0,0 +1,82 @@ +# Thanos and the Prometheus Operator + +Thanos is a set of components that can be composed into a highly available +metric system with unlimited storage capacity. The Prometheus Operator provides +integration for allowing Prometheus to connect to Thanos. + +These Thanos components include the queriers and stores, which Thanos needs to +be fully functional, and should be deployed independently of the Prometheus +Operator and its Thanos configuration. The +[kube-prometheus](contrib/kube-prometheus/) project has some experimental +starting points as well as the [thanos +project](https://github.com/improbable-eng/thanos/tree/master/kube/manifests). +In the future there may also be jsonnet configurations for deploying these +additional components. + +In short, for the Thanos integration using the Prometheus Operator to work +correctly you will need to have these extra components installed and +configured. + +## Prometheus Operator + +The `Prometheus` CRD has support for adding a Thanos sidecar to the Prometheus +Pod. To enable the sidecar, reference the following examples. These examples +assume that the Thanos components have been configured to use the +`thanos-peers.monitoring.svc:10900` service for querier peers to connect to, +which is important for getting HA to work with Thanos. + +### No s3 storage (assumes Thanos querier has been deployed) + +This is the simplest configuration change that needs to be made to your +Prometheus Custom Resource, and is the only configuration needed to +provide HA benefits. + +``` +... +spec: + ... + thanos: + baseImage: improbable/thanos + peers: thanos-peers.monitoring.svc:10900 +... +``` + +### S3 compatible object storage (assumes Thanos store has been deployed) + +Adding the object storage configuration allows Thanos to effeciently store +metrics long term. + +``` +... +spec: + ... + thanos: + baseImage: improbable/thanos + peers: thanos-peers.monitoring.svc:10900 + s3: + accessKey: + key: access + name: prometheus-thanos-auth + bucket: bucket + endpoint: ams3.digitaloceanspaces.com + secretKey: + key: secret + name: prometheus-thanos-auth +... +``` + +Note: The `endpoint` key allows for non AWS based object storage to be used. In +the above example, we are using a Digital Ocean bucket in place of an S3 bucket. +If you use one of the linked deployments you will need to update it to reflect +the cloud provider you are using. + +### Extra + +Once the sidecars have been configured you will need to make sure to +update any monitoring frontends, e.g. Grafana to connect to the Thanos sidecar +querier, in place of Prometheus. + +There is an optional Thanos +[compactor](https://github.com/improbable-eng/thanos/blob/master/docs/components/compact.md) +component, which allows compaction of object storage. + diff --git a/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/cluster-monitoring.md b/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/cluster-monitoring.md index bb6f6b498..c81fc943d 100644 --- a/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/cluster-monitoring.md +++ b/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/cluster-monitoring.md @@ -61,8 +61,8 @@ spec: - --kubelet-service=kube-system/kubelet - --logtostderr=true - --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1 - - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.24.0 - image: quay.io/coreos/prometheus-operator:v0.24.0 + - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.25.0 + image: quay.io/coreos/prometheus-operator:v0.25.0 name: prometheus-operator ports: - containerPort: 8080 @@ -163,7 +163,7 @@ spec: spec: containers: - args: - - --web.listen-address=127.0.0.1:9101 + - --web.listen-address=127.0.0.1:9100 - --path.procfs=/host/proc - --path.sysfs=/host/sys - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+)($|/) @@ -172,7 +172,7 @@ spec: name: node-exporter resources: limits: - cpu: 102m + cpu: 250m memory: 180Mi requests: cpu: 102m @@ -189,9 +189,14 @@ spec: name: root readOnly: true - args: - - --secure-listen-address=:9100 - - --upstream=http://127.0.0.1:9101/ - image: quay.io/coreos/kube-rbac-proxy:v0.3.1 + - --secure-listen-address=$(IP):9100 + - --upstream=http://127.0.0.1:9100/ + env: + - name: IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: quay.io/coreos/kube-rbac-proxy:v0.4.0 name: kube-rbac-proxy ports: - containerPort: 9100 @@ -285,7 +290,7 @@ spec: - args: - --secure-listen-address=:8443 - --upstream=http://127.0.0.1:8081/ - image: quay.io/coreos/kube-rbac-proxy:v0.3.1 + image: quay.io/coreos/kube-rbac-proxy:v0.4.0 name: kube-rbac-proxy-main ports: - containerPort: 8443 @@ -300,7 +305,7 @@ spec: - args: - --secure-listen-address=:9443 - --upstream=http://127.0.0.1:8082/ - image: quay.io/coreos/kube-rbac-proxy:v0.3.1 + image: quay.io/coreos/kube-rbac-proxy:v0.4.0 name: kube-rbac-proxy-self ports: - containerPort: 9443 @@ -317,7 +322,7 @@ spec: - --port=8081 - --telemetry-host=127.0.0.1 - --telemetry-port=8082 - image: quay.io/coreos/kube-state-metrics:v1.3.1 + image: quay.io/coreos/kube-state-metrics:v1.4.0 name: kube-state-metrics resources: limits: @@ -350,7 +355,7 @@ spec: name: addon-resizer resources: limits: - cpu: 10m + cpu: 50m memory: 30Mi requests: cpu: 10m @@ -422,7 +427,7 @@ spec: serviceAccountName: prometheus-k8s serviceMonitorNamespaceSelector: {} serviceMonitorSelector: {} - version: v2.4.3 + version: v2.5.0 ``` > Make sure that the `ServiceAccount` called `prometheus-k8s` exists and if using RBAC, is bound to the correct role. Read more on [RBAC when using the Prometheus Operator](../rbac.md). @@ -617,7 +622,7 @@ spec: beta.kubernetes.io/os: linux replicas: 3 serviceAccountName: alertmanager-main - version: v0.15.2 + version: v0.15.3 ``` Read more in the [alerting guide](alerting.md) on how to configure the Alertmanager as it will not spin up unless it has a valid configuration mounted through a `Secret`. Note that the `Secret` has to be in the same namespace as the `Alertmanager` resource as well as have the name `alertmanager-` and the key of the configuration is `alertmanager.yaml`. diff --git a/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/getting-started.md b/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/getting-started.md index ee573b2e0..29ff9e4f7 100644 --- a/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/getting-started.md +++ b/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/getting-started.md @@ -118,8 +118,8 @@ spec: - --kubelet-service=kube-system/kubelet - --logtostderr=true - --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1 - - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.25.0 - image: quay.io/coreos/prometheus-operator:v0.25.0 + - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.26.0 + image: quay.io/coreos/prometheus-operator:v0.26.0 name: prometheus-operator ports: - containerPort: 8080 diff --git a/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/storage.md b/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/storage.md index 434131ba2..482810771 100644 --- a/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/storage.md +++ b/vendor/github.com/coreos/prometheus-operator/Documentation/user-guides/storage.md @@ -9,7 +9,7 @@ To maintain data across deployments and version upgrades, the data must be persi Kubernetes supports several kinds of storage volumes. The Prometheus Operator works with PersistentVolumeClaims, which support the underlying PersistentVolume to be provisioned when requested. -This document assumes a basic understanding of PersisentVolumes, PersisentVolumeClaims, and their [provisioning][pv-provisioning]. +This document assumes a basic understanding of PersistentVolumes, PersistentVolumeClaims, and their [provisioning][pv-provisioning]. ## Storage Provisioning on AWS @@ -101,7 +101,7 @@ spec: To manually provision volumes (as of Kubernetes 1.6.0), you may need to disable the default StorageClass that is automatically created for certain Cloud Providers. Default StorageClasses are pre-installed on Azure, AWS, GCE, OpenStack, and vSphere. -The default StorageClass behavior will override manual storage provisioning, preventing PerisistentVolumeClaims from automatically binding to manually created PersistentVolumes. +The default StorageClass behavior will override manual storage provisioning, preventing PersistentVolumeClaims from automatically binding to manually created PersistentVolumes. To override this behavior, you must explicitly create the same resource, but set it to *not* be default. (See the [changelog][volumes-changelog] for more information.) diff --git a/vendor/github.com/coreos/prometheus-operator/Gopkg.lock b/vendor/github.com/coreos/prometheus-operator/Gopkg.lock index 2e3d0574c..547cc564e 100644 --- a/vendor/github.com/coreos/prometheus-operator/Gopkg.lock +++ b/vendor/github.com/coreos/prometheus-operator/Gopkg.lock @@ -649,16 +649,19 @@ "pkg/util/framer", "pkg/util/intstr", "pkg/util/json", + "pkg/util/mergepatch", "pkg/util/naming", "pkg/util/net", "pkg/util/runtime", "pkg/util/sets", + "pkg/util/strategicpatch", "pkg/util/validation", "pkg/util/validation/field", "pkg/util/wait", "pkg/util/yaml", "pkg/version", "pkg/watch", + "third_party/forked/golang/json", "third_party/forked/golang/reflect", ] pruneopts = "" @@ -669,9 +672,8 @@ digest = "1:5d4153d12c3aed2c90a94262520d2498d5afa4d692554af55e65a7c5af0bc399" name = "k8s.io/client-go" packages = [ - "deprecated-dynamic", "discovery", - "dynamic", + "discovery/fake", "kubernetes", "kubernetes/scheme", "kubernetes/typed/admissionregistration/v1alpha1", @@ -712,6 +714,7 @@ "plugin/pkg/client/auth/exec", "rest", "rest/watch", + "testing", "tools/auth", "tools/cache", "tools/clientcmd", @@ -738,7 +741,10 @@ [[projects]] digest = "1:a2f78b8fd86be41f2aa77404245aed4f4f410ac3aabc5f3bd9bd1fcc09076c53" name = "k8s.io/kube-openapi" - packages = ["pkg/common"] + packages = [ + "pkg/common", + "pkg/util/proto", + ] pruneopts = "" revision = "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803" @@ -752,6 +758,7 @@ "github.com/go-kit/kit/log", "github.com/go-kit/kit/log/level", "github.com/go-openapi/spec", + "github.com/golang/protobuf/proto", "github.com/hashicorp/go-version", "github.com/improbable-eng/thanos/pkg/reloader", "github.com/kylelemons/godebug/pretty", @@ -774,24 +781,25 @@ "k8s.io/apimachinery/pkg/api/meta", "k8s.io/apimachinery/pkg/api/resource", "k8s.io/apimachinery/pkg/apis/meta/v1", - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "k8s.io/apimachinery/pkg/fields", "k8s.io/apimachinery/pkg/labels", "k8s.io/apimachinery/pkg/runtime", "k8s.io/apimachinery/pkg/runtime/schema", "k8s.io/apimachinery/pkg/runtime/serializer", + "k8s.io/apimachinery/pkg/types", "k8s.io/apimachinery/pkg/util/intstr", "k8s.io/apimachinery/pkg/util/runtime", "k8s.io/apimachinery/pkg/util/validation", "k8s.io/apimachinery/pkg/util/wait", "k8s.io/apimachinery/pkg/util/yaml", "k8s.io/apimachinery/pkg/watch", - "k8s.io/client-go/deprecated-dynamic", "k8s.io/client-go/discovery", + "k8s.io/client-go/discovery/fake", "k8s.io/client-go/kubernetes", "k8s.io/client-go/kubernetes/scheme", "k8s.io/client-go/kubernetes/typed/core/v1", "k8s.io/client-go/rest", + "k8s.io/client-go/testing", "k8s.io/client-go/tools/cache", "k8s.io/client-go/tools/clientcmd", "k8s.io/client-go/util/flowcontrol", diff --git a/vendor/github.com/coreos/prometheus-operator/Makefile b/vendor/github.com/coreos/prometheus-operator/Makefile index 89bc13d37..e7e724c97 100644 --- a/vendor/github.com/coreos/prometheus-operator/Makefile +++ b/vendor/github.com/coreos/prometheus-operator/Makefile @@ -1,21 +1,32 @@ SHELL=/bin/bash -o pipefail +GO_PKG=github.com/coreos/prometheus-operator REPO?=quay.io/coreos/prometheus-operator REPO_PROMETHEUS_CONFIG_RELOADER?=quay.io/coreos/prometheus-config-reloader TAG?=$(shell git rev-parse --short HEAD) -PO_CRDGEN_BINARY:=$(GOPATH)/bin/po-crdgen -OPENAPI_GEN_BINARY:=$(GOPATH)/bin/openapi-gen -DEEPCOPY_GEN_BINARY:=$(GOPATH)/bin/deepcopy-gen -GOJSONTOYAML_BINARY:=$(GOPATH)/bin/gojsontoyaml -JB_BINARY:=$(GOPATH)/bin/jb -PO_DOCGEN_BINARY:=$(GOPATH)/bin/po-docgen -EMBEDMD_BINARY:=$(GOPATH)/bin/embedmd +FIRST_GOPATH:=$(firstword $(subst :, ,$(shell go env GOPATH))) +PO_CRDGEN_BINARY:=$(FIRST_GOPATH)/bin/po-crdgen +OPENAPI_GEN_BINARY:=$(FIRST_GOPATH)/bin/openapi-gen +GOJSONTOYAML_BINARY:=$(FIRST_GOPATH)/bin/gojsontoyaml +JB_BINARY:=$(FIRST_GOPATH)/bin/jb +PO_DOCGEN_BINARY:=$(FIRST_GOPATH)/bin/po-docgen +EMBEDMD_BINARY:=$(FIRST_GOPATH)/bin/embedmd + +TYPES_V1_TARGET:=pkg/apis/monitoring/v1/types.go + +K8S_GEN_VERSION:=release-1.11 +K8S_GEN_BINARIES:=deepcopy-gen informer-gen lister-gen client-gen +K8S_GEN_ARGS:=--go-header-file $(FIRST_GOPATH)/src/$(GO_PKG)/.header --v=1 --logtostderr + +K8S_GEN_DEPS:=.header +K8S_GEN_DEPS+=$(TYPES_V1_TARGET) +K8S_GEN_DEPS+=$(foreach bin,$(K8S_GEN_BINARIES),$(FIRST_GOPATH)/bin/$(bin)) +K8S_GEN_DEPS+=$(OPENAPI_GEN_BINARY) GOLANG_FILES:=$(shell find . -name \*.go -print) pkgs = $(shell go list ./... | grep -v /vendor/ | grep -v /test/) - .PHONY: all all: format generate build test @@ -24,43 +35,72 @@ clean: # Remove all files and directories ignored by git. git clean -Xfd . - ############ # Building # ############ .PHONY: build -build: operator prometheus-config-reloader +build: operator prometheus-config-reloader k8s-gen +.PHONY: operator operator: $(GOLANG_FILES) - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \ - -ldflags "-X github.com/coreos/prometheus-operator/pkg/version.Version=$(shell cat VERSION)" \ + GOOS=linux CGO_ENABLED=0 go build \ + -ldflags "-X $(GO_PKG)/pkg/version.Version=$(shell cat VERSION)" \ -o $@ cmd/operator/main.go +.PHONY: prometheus-config-reloader prometheus-config-reloader: - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \ - -ldflags "-X github.com/coreos/prometheus-operator/pkg/version.Version=$(shell cat VERSION)" \ + GOOS=linux CGO_ENABLED=0 go build \ + -ldflags "-X $(GO_PKG)/pkg/version.Version=$(shell cat VERSION)" \ -o $@ cmd/$@/main.go -pkg/client/monitoring/v1/zz_generated.deepcopy.go: .header pkg/client/monitoring/v1/types.go $(DEEPCOPY_GEN_BINARY) +DEEPCOPY_TARGET := pkg/apis/monitoring/v1/zz_generated.deepcopy.go +$(DEEPCOPY_TARGET): $(K8S_GEN_DEPS) $(DEEPCOPY_GEN_BINARY) \ - -i github.com/coreos/prometheus-operator/pkg/client/monitoring/v1 \ - --go-header-file="$(GOPATH)/src/github.com/coreos/prometheus-operator/.header" \ - -v=4 \ - --logtostderr \ - --bounding-dirs "github.com/coreos/prometheus-operator/pkg/client" \ + $(K8S_GEN_ARGS) \ + --input-dirs "$(GO_PKG)/pkg/apis/monitoring/v1" \ + --bounding-dirs "$(GO_PKG)/pkg/apis/monitoring" \ --output-file-base zz_generated.deepcopy - go fmt pkg/client/monitoring/v1/zz_generated.deepcopy.go -pkg/client/monitoring/v1alpha1/zz_generated.deepcopy.go: $(DEEPCOPY_GEN_BINARY) - $(DEEPCOPY_GEN_BINARY) \ - -i github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1 \ - --go-header-file="$(GOPATH)/src/github.com/coreos/prometheus-operator/.header" \ - -v=4 \ - --logtostderr \ - --bounding-dirs "github.com/coreos/prometheus-operator/pkg/client" \ - --output-file-base zz_generated.deepcopy - go fmt pkg/client/monitoring/v1alpha1/zz_generated.deepcopy.go +CLIENT_TARGET := pkg/client/versioned/clientset.go +$(CLIENT_TARGET): $(K8S_GEN_DEPS) + $(CLIENT_GEN_BINARY) \ + $(K8S_GEN_ARGS) \ + --input-base "" \ + --clientset-name "versioned" \ + --input "$(GO_PKG)/pkg/apis/monitoring/v1" \ + --output-package "$(GO_PKG)/pkg/client" + +LISTER_TARGET := pkg/client/listers/monitoring/v1/prometheus.go +$(LISTER_TARGET): $(K8S_GEN_DEPS) + $(LISTER_GEN_BINARY) \ + $(K8S_GEN_ARGS) \ + --input-dirs "$(GO_PKG)/pkg/apis/monitoring/v1" \ + --output-package "$(GO_PKG)/pkg/client/listers" + +INFORMER_TARGET := pkg/client/informers/externalversions/monitoring/v1/prometheus.go +$(INFORMER_TARGET): $(K8S_GEN_DEPS) $(LISTER_TARGET) $(CLIENT_TARGET) + $(INFORMER_GEN_BINARY) \ + $(K8S_GEN_ARGS) \ + --versioned-clientset-package "$(GO_PKG)/pkg/client/versioned" \ + --listers-package "$(GO_PKG)/pkg/client/listers" \ + --input-dirs "$(GO_PKG)/pkg/apis/monitoring/v1" \ + --output-package "$(GO_PKG)/pkg/client/informers" + +OPENAPI_TARGET := pkg/apis/monitoring/v1/openapi_generated.go +$(OPENAPI_TARGET): $(K8S_GEN_DEPS) + $(OPENAPI_GEN_BINARY) \ + $(K8S_GEN_ARGS) \ + -i $(GO_PKG)/pkg/apis/monitoring/v1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/api/core/v1 \ + -p $(GO_PKG)/pkg/apis/monitoring/v1 + +.PHONY: k8s-gen +k8s-gen: \ + $(DEEPCOPY_TARGET) \ + $(CLIENT_TARGET) \ + $(LISTER_TARGET) \ + $(INFORMER_TARGET) \ + $(OPENAPI_TARGET) .PHONY: image image: hack/operator-image hack/prometheus-config-reloader-image @@ -85,7 +125,7 @@ hack/prometheus-config-reloader-image: cmd/prometheus-config-reloader/Dockerfile ############## .PHONY: generate -generate: pkg/client/monitoring/v1/zz_generated.deepcopy.go pkg/client/monitoring/v1/openapi_generated.go $(shell find jsonnet/prometheus-operator/*-crd.libsonnet -type f) bundle.yaml kube-prometheus $(shell find Documentation -type f) +generate: $(DEEPCOPY_TARGET) $(OPENAPI_TARGET) $(shell find jsonnet/prometheus-operator/*-crd.libsonnet -type f) bundle.yaml kube-prometheus $(shell find Documentation -type f) .PHONY: generate-in-docker generate-in-docker: hack/jsonnet-docker-image @@ -95,7 +135,7 @@ generate-in-docker: hack/jsonnet-docker-image kube-prometheus: cd contrib/kube-prometheus && $(MAKE) $(MFLAGS) generate -example/prometheus-operator-crd/**.crd.yaml: pkg/client/monitoring/v1/openapi_generated.go $(PO_CRDGEN_BINARY) +example/prometheus-operator-crd/**.crd.yaml: $(OPENAPI_TARGET) $(PO_CRDGEN_BINARY) po-crdgen prometheus > example/prometheus-operator-crd/prometheus.crd.yaml po-crdgen alertmanager > example/prometheus-operator-crd/alertmanager.crd.yaml po-crdgen servicemonitor > example/prometheus-operator-crd/servicemonitor.crd.yaml @@ -107,13 +147,6 @@ jsonnet/prometheus-operator/**-crd.libsonnet: $(shell find example/prometheus-op cat example/prometheus-operator-crd/servicemonitor.crd.yaml | gojsontoyaml -yamltojson > jsonnet/prometheus-operator/servicemonitor-crd.libsonnet cat example/prometheus-operator-crd/prometheusrule.crd.yaml | gojsontoyaml -yamltojson > jsonnet/prometheus-operator/prometheusrule-crd.libsonnet -pkg/client/monitoring/v1/openapi_generated.go: pkg/client/monitoring/v1/types.go $(OPENAPI_GEN_BINARY) - $(OPENAPI_GEN_BINARY) \ - -i github.com/coreos/prometheus-operator/pkg/client/monitoring/v1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/api/core/v1 \ - -p github.com/coreos/prometheus-operator/pkg/client/monitoring/v1 \ - --go-header-file="$(GOPATH)/src/github.com/coreos/prometheus-operator/.header" - go fmt pkg/client/monitoring/v1/openapi_generated.go - bundle.yaml: $(shell find example/rbac/prometheus-operator/*.yaml -type f) hack/generate-bundle.sh @@ -135,8 +168,8 @@ jsonnet/prometheus-operator/prometheus-operator.libsonnet: VERSION FULLY_GENERATED_DOCS = Documentation/api.md Documentation/compatibility.md TO_BE_EXTENDED_DOCS = $(filter-out $(FULLY_GENERATED_DOCS), $(wildcard Documentation/*.md)) -Documentation/api.md: $(PO_DOCGEN_BINARY) pkg/client/monitoring/v1/types.go - $(PO_DOCGEN_BINARY) api pkg/client/monitoring/v1/types.go > $@ +Documentation/api.md: $(PO_DOCGEN_BINARY) $(TYPES_V1_TARGET) + $(PO_DOCGEN_BINARY) api $(TYPES_V1_TARGET) > $@ Documentation/compatibility.md: $(PO_DOCGEN_BINARY) pkg/prometheus/statefulset.go $(PO_DOCGEN_BINARY) compatibility > $@ @@ -174,7 +207,7 @@ test: test-unit test-e2e .PHONY: test-unit test-unit: - @go test $(TEST_RUN_ARGS) -short $(pkgs) + @go test -race $(TEST_RUN_ARGS) -short $(pkgs) .PHONY: test-e2e test-e2e: KUBECONFIG?=$(HOME)/.kube/config @@ -204,32 +237,47 @@ helm-sync-s3: helm/hack/helm-package.sh kube-prometheus helm/hack/sync-repo.sh true - ############ # Binaries # ############ +# generate k8s generator variable and target, +# i.e. if $(1)=informer-gen: +# +# INFORMER_GEN_BINARY=/home/user/go/bin/informer-gen +# +# /home/user/go/bin/informer-gen: +# go get -u -d k8s.io/code-generator/cmd/informer-gen +# cd /home/user/go/src/k8s.io/code-generator; git checkout release-1.11 +# go install k8s.io/code-generator/cmd/informer-gen +# +define _K8S_GEN_VAR_TARGET_ +$(shell echo $(1) | tr '[:lower:]' '[:upper:]' | tr '-' '_')_BINARY:=$(FIRST_GOPATH)/bin/$(1) + +$(FIRST_GOPATH)/bin/$(1): + go get -u -d k8s.io/code-generator/cmd/$(1) + cd $(FIRST_GOPATH)/src/k8s.io/code-generator; git checkout $(K8S_GEN_VERSION) + go install k8s.io/code-generator/cmd/$(1) + +endef + +$(OPENAPI_GEN_BINARY): + go get -u -d k8s.io/kube-openapi/cmd/openapi-gen + go install k8s.io/kube-openapi/cmd/openapi-gen + +$(foreach binary,$(K8S_GEN_BINARIES),$(eval $(call _K8S_GEN_VAR_TARGET_,$(binary)))) + $(EMBEDMD_BINARY): @go get github.com/campoy/embedmd $(JB_BINARY): go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb -$(PO_CRDGEN_BINARY): cmd/po-crdgen/main.go pkg/client/monitoring/v1/openapi_generated.go - go install github.com/coreos/prometheus-operator/cmd/po-crdgen +$(PO_CRDGEN_BINARY): cmd/po-crdgen/main.go $(OPENAPI_TARGET) + go install $(GO_PKG)/cmd/po-crdgen -$(PO_DOCGEN_BINARY): $(shell find cmd/po-docgen -type f) pkg/client/monitoring/v1/types.go - go install github.com/coreos/prometheus-operator/cmd/po-docgen - -$(OPENAPI_GEN_BINARY): - go get -u -v -d k8s.io/code-generator/cmd/openapi-gen - cd $(GOPATH)/src/k8s.io/code-generator; git checkout release-1.11 - go install k8s.io/code-generator/cmd/openapi-gen - -$(DEEPCOPY_GEN_BINARY): - go get -u -v -d k8s.io/code-generator/cmd/deepcopy-gen - cd $(GOPATH)/src/k8s.io/code-generator; git checkout release-1.11 - go install k8s.io/code-generator/cmd/deepcopy-gen +$(PO_DOCGEN_BINARY): $(shell find cmd/po-docgen -type f) $(TYPES_V1_TARGET) + go install $(GO_PKG)/cmd/po-docgen $(GOJSONTOYAML_BINARY): go get -u github.com/brancz/gojsontoyaml diff --git a/vendor/github.com/coreos/prometheus-operator/README.md b/vendor/github.com/coreos/prometheus-operator/README.md index 87ca2c6aa..970afb6e2 100644 --- a/vendor/github.com/coreos/prometheus-operator/README.md +++ b/vendor/github.com/coreos/prometheus-operator/README.md @@ -61,15 +61,17 @@ The Operator acts on the following [custom resource definitions (CRDs)](https:// To learn more about the CRDs introduced by the Prometheus Operator have a look at the [design doc](Documentation/design.md). -## Installation +## Quickstart -Install the Operator inside a cluster by running the following command: +Note that this quickstart does not provision an entire monitoring stack; if that is what you are looking for see the [kube-prometheus](contrib/kube-prometheus) sub-project. If you want the whole stack, but have already applied the `bundle.yaml`, delete the bundle first (`kubectl delete -f bundle.yaml`). + +To quickly try out _just_ the Prometheus Operator inside a cluster, run the following command: ```sh kubectl apply -f bundle.yaml ``` -> Note: make sure to adapt the namespace in the ClusterRoleBinding if deploying in another namespace than the default namespace. +> Note: make sure to adapt the namespace in the ClusterRoleBinding if deploying in a namespace other than the default namespace. To run the Operator outside of a cluster: @@ -81,7 +83,7 @@ hack/run-external.sh ## Removal To remove the operator and Prometheus, first delete any custom resources you created in each namespace. The -operator will automatically shut down and remove Prometheus and Alertmanager pods, and associated configmaps. +operator will automatically shut down and remove Prometheus and Alertmanager pods, and associated ConfigMaps. ```sh for n in $(kubectl get namespaces -o jsonpath={..metadata.name}); do diff --git a/vendor/github.com/coreos/prometheus-operator/VERSION b/vendor/github.com/coreos/prometheus-operator/VERSION index d21d277be..4e8f395fa 100644 --- a/vendor/github.com/coreos/prometheus-operator/VERSION +++ b/vendor/github.com/coreos/prometheus-operator/VERSION @@ -1 +1 @@ -0.25.0 +0.26.0 diff --git a/vendor/github.com/coreos/prometheus-operator/bundle.yaml b/vendor/github.com/coreos/prometheus-operator/bundle.yaml index eba8a7b2f..5cc571b8d 100644 --- a/vendor/github.com/coreos/prometheus-operator/bundle.yaml +++ b/vendor/github.com/coreos/prometheus-operator/bundle.yaml @@ -100,8 +100,8 @@ spec: - --kubelet-service=kube-system/kubelet - --logtostderr=true - --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1 - - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.25.0 - image: quay.io/coreos/prometheus-operator:v0.25.0 + - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.26.0 + image: quay.io/coreos/prometheus-operator:v0.26.0 name: prometheus-operator ports: - containerPort: 8080 diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/operator/main.go b/vendor/github.com/coreos/prometheus-operator/cmd/operator/main.go index 0fc74a72e..a2e73d483 100644 --- a/vendor/github.com/coreos/prometheus-operator/cmd/operator/main.go +++ b/vendor/github.com/coreos/prometheus-operator/cmd/operator/main.go @@ -29,7 +29,8 @@ import ( alertmanagercontroller "github.com/coreos/prometheus-operator/pkg/alertmanager" "github.com/coreos/prometheus-operator/pkg/api" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" prometheuscontroller "github.com/coreos/prometheus-operator/pkg/prometheus" "github.com/coreos/prometheus-operator/pkg/version" @@ -125,10 +126,9 @@ func init() { flagset.StringVar(&cfg.ThanosDefaultBaseImage, "thanos-default-base-image", "improbable/thanos", "Thanos default base image") flagset.Var(ns, "namespaces", "Namespaces to scope the interaction of the Prometheus Operator and the apiserver.") flagset.Var(&cfg.Labels, "labels", "Labels to be add to all resources created by the operator") - flagset.StringVar(&cfg.CrdGroup, "crd-apigroup", monitoringv1.Group, "prometheus CRD API group name") + flagset.StringVar(&cfg.CrdGroup, "crd-apigroup", monitoring.GroupName, "prometheus CRD API group name") flagset.Var(&cfg.CrdKinds, "crd-kinds", " - EXPERIMENTAL (could be removed in future releases) - customize CRD kind names") flagset.BoolVar(&cfg.EnableValidation, "with-validation", true, "Include the validation spec in the CRD") - flagset.BoolVar(&cfg.DisableAutoUserGroup, "disable-auto-user-group", false, "Disables the Prometheus Operator setting the `runAsUser` and `fsGroup` fields in Pods.") flagset.StringVar(&cfg.LocalHost, "localhost", "localhost", "EXPERIMENTAL (could be removed in future releases) - Host used to communicate between local services on a pod. Fixes issues where localhost resolves incorrectly.") flagset.StringVar(&cfg.LogLevel, "log-level", logLevelInfo, fmt.Sprintf("Log level to use. Possible values: %s", strings.Join(availableLogLevels, ", "))) flagset.StringVar(&cfg.LogFormat, "log-format", logFormatLogfmt, fmt.Sprintf("Log format to use. Possible values: %s", strings.Join(availableLogFormats, ", "))) diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/po-crdgen/main.go b/vendor/github.com/coreos/prometheus-operator/cmd/po-crdgen/main.go index 7eb796a3e..747260b7b 100644 --- a/vendor/github.com/coreos/prometheus-operator/cmd/po-crdgen/main.go +++ b/vendor/github.com/coreos/prometheus-operator/cmd/po-crdgen/main.go @@ -19,9 +19,11 @@ import ( "fmt" "os" - crdutils "github.com/ant31/crd-validation/pkg" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" k8sutil "github.com/coreos/prometheus-operator/pkg/k8sutil" + + crdutils "github.com/ant31/crd-validation/pkg" extensionsobj "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" ) @@ -33,7 +35,7 @@ func initFlags(crdkind monitoringv1.CrdKind, flagset *flag.FlagSet) *flag.FlagSe flagset.Var(&cfg.Labels, "labels", "Labels") flagset.Var(&cfg.Annotations, "annotations", "Annotations") flagset.BoolVar(&cfg.EnableValidation, "with-validation", true, "Add CRD validation field, default: true") - flagset.StringVar(&cfg.Group, "apigroup", monitoringv1.Group, "CRD api group") + flagset.StringVar(&cfg.Group, "apigroup", monitoring.GroupName, "CRD api group") flagset.StringVar(&cfg.SpecDefinitionName, "spec-name", crdkind.SpecName, "CRD spec definition name") flagset.StringVar(&cfg.OutputFormat, "output", "yaml", "output format: json|yaml") flagset.StringVar(&cfg.Kind, "kind", crdkind.Kind, "CRD Kind") diff --git a/vendor/github.com/coreos/prometheus-operator/cmd/po-rule-migration/main.go b/vendor/github.com/coreos/prometheus-operator/cmd/po-rule-migration/main.go index 59b419cfa..10bcb66bc 100644 --- a/vendor/github.com/coreos/prometheus-operator/cmd/po-rule-migration/main.go +++ b/vendor/github.com/coreos/prometheus-operator/cmd/po-rule-migration/main.go @@ -23,7 +23,8 @@ import ( "path" "path/filepath" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -106,7 +107,7 @@ func CMToRule(cm *v1.ConfigMap) ([]monitoringv1.PrometheusRule, error) { rule := monitoringv1.PrometheusRule{ TypeMeta: metav1.TypeMeta{ Kind: monitoringv1.PrometheusRuleKind, - APIVersion: monitoringv1.Group + "/" + monitoringv1.Version, + APIVersion: monitoring.GroupName + "/" + monitoringv1.Version, }, ObjectMeta: metav1.ObjectMeta{ diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/README.md b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/README.md index 9d5cc8c15..b8f69a8b7 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/README.md +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/README.md @@ -35,6 +35,7 @@ This stack is meant for cluster monitoring, so it is pre-configured to collect m * [node-exporter DaemonSet namespace](#node-exporter-daemonset-namespace) * [Alertmanager configuration](#alertmanager-configuration) * [Static etcd configuration](#static-etcd-configuration) + * [Pod Anti-Affinity](#pod-anti-affinity) * [Customizing Prometheus alerting/recording rules and Grafana dashboards](#customizing-prometheus-alertingrecording-rules-and-grafana-dashboards) * [Exposing Prometheus/Alermanager/Grafana via Ingress](#exposing-prometheusalermanagergrafana-via-ingress) * [Minikube Example](#minikube-example) @@ -45,13 +46,16 @@ This stack is meant for cluster monitoring, so it is pre-configured to collect m ## Prerequisites -You will need a Kubernetes cluster, that's it! By default it is assumed, that the kubelet uses token authN and authZ, as otherwise Prometheus needs a client certificate, which gives it full access to the kubelet, rather than just the metrics. Token authN and authZ allows more fine grained and easier access control. +You will need a Kubernetes cluster, that's it! By default it is assumed, that the kubelet uses token authentication and authorization, as otherwise Prometheus needs a client certificate, which gives it full access to the kubelet, rather than just the metrics. Token authentication and authorization allows more fine grained and easier access control. This means the kubelet configuration must contain these flags: * `--authentication-token-webhook=true` This flag enables, that a `ServiceAccount` token can be used to authenticate against the kubelet(s). * `--authorization-mode=Webhook` This flag enables, that the kubelet will perform an RBAC request with the API to determine, whether the requesting entity (Prometheus in this case) is allow to access a resource, in specific for this project the `/metrics` endpoint. +This stack provides [resource metrics](https://github.com/kubernetes/metrics#resource-metrics-api) by deploying the [Prometheus Adapter](https://github.com/DirectXMan12/k8s-prometheus-adapter/). +This adapter is an Extension API Server and Kubernetes needs to be have this feature enabled, otherwise the adapter has no effect, but is still deployed. + ### minikube In order to just try out this stack, start minikube with the following command: @@ -155,6 +159,7 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + { { ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } + { ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } + { ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } + +{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } + { ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) } ``` @@ -184,6 +189,14 @@ jsonnet -J vendor -m manifests "${1-example.jsonnet}" | xargs -I{} sh -c 'cat {} This script runs the jsonnet code, then reads each key of the generated json and uses that as the file name, and writes the value of that key to that file, and converts each json manifest to yaml. +### Apply the kube-prometheus stack +The previous steps (compilation) has created a bunch of manifest files in the manifest/ folder. +Now simply use kubectl to install Prometheus and Grafana as per your configuration: + +`kubectl apply -f manifests/` + +Check the monitoring namespace (or the namespace you have specific in `namespace: `) and make sure the pods are running. Prometheus and Grafana should be up and running soon. + ### Containerized Installing and Compiling If you don't care to have `jb` nor `jsonnet` nor `gojsontoyaml` installed, then build the `po-jsonnet` Docker image (this is something you'll need a copy of this repository for). Do the following from this `kube-prometheus` directory: @@ -212,6 +225,26 @@ docker run \ po-jsonnet ./build.sh example.jsonnet ``` +## Update from upstream project +You may wish to fetch changes made on this project so they are available to you. + +### Update jb +jb may have been updated so it's a good idea to get the latest version of this binary + +``` +go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb +``` + +### Update kube-prometheus +The command below will sync with upstream project. +``` +jb update +``` + +### Compile the manifests and apply +Once updated, just follow the instructions under "Compiling" and "Apply the kube-prometheus stack" to apply the changes to your cluster. + + ## Configuration Jsonnet has the concept of hidden fields. These are fields, that are not going to be rendered in a result. This is used to configure the kube-prometheus components in jsonnet. In the example jsonnet code of the above [Usage section](#Usage), you can see an example of this, where the `namespace` is being configured to be `monitoring`. In order to not override the whole object, use the `+::` construct of jsonnet, to merge objects, this way you can override individual settings, but retain all other settings and defaults. @@ -223,7 +256,7 @@ These are the available fields with their respective default values: namespace: "default", versions+:: { - alertmanager: "v0.15.2", + alertmanager: "v0.15.3", nodeExporter: "v0.16.0", kubeStateMetrics: "v1.3.1", kubeRbacProxy: "v0.3.1", @@ -300,7 +333,7 @@ Jsonnet is a turing complete language, any logic can be reflected in it. It also ### Cluster Creation Tools -A common example is that not all Kubernetes clusters are created exactly the same way, meaning the configuration to monitor them may be slightly different. For [kubeadm](examples/jsonnet-snippets/kubeadm.jsonnet) and [bootkube](examples/jsonnet-snippets/bootkube.jsonnet) and [kops](examples/jsonnet-snippets/kops.jsonnet) clusters there are mixins available to easily configure these: +A common example is that not all Kubernetes clusters are created exactly the same way, meaning the configuration to monitor them may be slightly different. For [kubeadm](examples/jsonnet-snippets/kubeadm.jsonnet), [bootkube](examples/jsonnet-snippets/bootkube.jsonnet), [kops](examples/jsonnet-snippets/kops.jsonnet) and [kubespray](examples/jsonnet-snippets/kubespray.jsonnet) clusters there are mixins available to easily configure these: kubeadm: @@ -326,6 +359,22 @@ kops: (import 'kube-prometheus/kube-prometheus-kops.libsonnet') ``` +kubespray: + +[embedmd]:# (examples/jsonnet-snippets/kubespray.jsonnet) +```jsonnet +(import 'kube-prometheus/kube-prometheus.libsonnet') + +(import 'kube-prometheus/kube-prometheus-kubespray.libsonnet') +``` + +kube-aws: + +[embedmd]:# (examples/jsonnet-snippets/kube-aws.jsonnet) +```jsonnet +(import 'kube-prometheus/kube-prometheus.libsonnet') + +(import 'kube-prometheus/kube-prometheus-kube-aws.libsonnet') +``` + ### Internal Registry Some Kubernetes installations source all their images from an internal registry. kube-prometheus supports this use case and helps the user synchronize every image it uses to the internal registry and generate manifests pointing at the internal registry. @@ -337,9 +386,9 @@ $ jsonnet -J vendor -S --tla-str repository=internal-registry.com/organization s docker pull quay.io/coreos/addon-resizer:1.0 docker tag quay.io/coreos/addon-resizer:1.0 internal-registry.com/organization/addon-resizer:1.0 docker push internal-registry.com/organization/addon-resizer:1.0 -docker pull quay.io/prometheus/alertmanager:v0.15.2 -docker tag quay.io/prometheus/alertmanager:v0.15.2 internal-registry.com/organization/alertmanager:v0.15.2 -docker push internal-registry.com/organization/alertmanager:v0.15.2 +docker pull quay.io/prometheus/alertmanager:v0.15.3 +docker tag quay.io/prometheus/alertmanager:v0.15.3 internal-registry.com/organization/alertmanager:v0.15.3 +docker push internal-registry.com/organization/alertmanager:v0.15.3 ... ``` @@ -483,6 +532,16 @@ In order to configure a static etcd cluster to scrape there is a simple [kube-pr > Note that monitoring etcd in minikube is currently not possible because of how etcd is setup. (minikube's etcd binds to 127.0.0.1:2379 only, and within host networking namespace.) +### Pod Anti-Affinity + +To prevent `Prometheus` and `Alertmanager` instances from being deployed onto the same node when +possible, one can include the [kube-prometheus-anti-affinity.libsonnet](jsonnet/kube-prometheus/kube-prometheus-anti-affinity.libsonnet) mixin: + +```jsonnet +(import 'kube-prometheus/kube-prometheus.libsonnet') + +(import 'kube-prometheus/kube-prometheus-anti-affinity.libsonnet') +``` + ### Customizing Prometheus alerting/recording rules and Grafana dashboards See [developing Prometheus rules and Grafana dashboards](docs/developing-prometheus-rules-and-grafana-dashboards.md) guide. diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/developing-prometheus-rules-and-grafana-dashboards.md b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/developing-prometheus-rules-and-grafana-dashboards.md index 1eb4f15ad..72deb0e3e 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/developing-prometheus-rules-and-grafana-dashboards.md +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/developing-prometheus-rules-and-grafana-dashboards.md @@ -22,6 +22,7 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + { { ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } + { ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } + { ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } + +{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } + { ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) } ``` diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/exposing-prometheus-alertmanager-grafana-ingress.md b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/exposing-prometheus-alertmanager-grafana-ingress.md index 34213067f..7fb2d4f6a 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/exposing-prometheus-alertmanager-grafana-ingress.md +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/exposing-prometheus-alertmanager-grafana-ingress.md @@ -24,7 +24,8 @@ htpasswd -c auth In order to use this a secret needs to be created containing the name of the `htpasswd`, and with annotations on the Ingress object basic auth can be configured. -[embedmd]:# (../examples/ingress.jsonnet) +Also, the applications provide external links to themselves in alerts and various places. When an ingress is used in front of the applications these links need to be based on the external URL's. This can be configured for each application in jsonnet. + ```jsonnet local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; local secret = k.core.v1.secret; @@ -39,11 +40,18 @@ local kp = _config+:: { namespace: 'monitoring', }, + prometheus+:: { + prometheus+: { + spec+: { + externalUrl: 'http://prometheus.example.com', + }, + }, + }, ingress+:: { 'prometheus-k8s': ingress.new() + - ingress.mixin.metadata.withName('prometheus-k8s') + - ingress.mixin.metadata.withNamespace($._config.namespace) + + ingress.mixin.metadata.withName($.prometheus.prometheus.metadata.name) + + ingress.mixin.metadata.withNamespace($.prometheus.prometheus.metadata.namespace) + ingress.mixin.metadata.withAnnotations({ 'nginx.ingress.kubernetes.io/auth-type': 'basic', 'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth', @@ -54,7 +62,7 @@ local kp = ingressRule.withHost('prometheus.example.com') + ingressRule.mixin.http.withPaths( httpIngressPath.new() + - httpIngressPath.mixin.backend.withServiceName('prometheus-k8s') + + httpIngressPath.mixin.backend.withServiceName($.prometheus.service.metadata.name) + httpIngressPath.mixin.backend.withServicePort('web') ), ), @@ -73,7 +81,7 @@ k.core.v1.list.new([ ]) ``` -In order to expose Alertmanager and Grafana, simply create additional fields containing an ingress object, but simply pointing at the `alertmanager` or `grafana` instead of the `prometheus-k8s` Service. Make sure to also use the correct port respectively, for Alertmanager it is also `web`, for Grafana it is `http`. +In order to expose Alertmanager and Grafana, simply create additional fields containing an ingress object, but simply pointing at the `alertmanager` or `grafana` instead of the `prometheus-k8s` Service. Make sure to also use the correct port respectively, for Alertmanager it is also `web`, for Grafana it is `http`. Be sure to also specify the appropriate external URL. In order to render the ingress objects similar to the other objects use as demonstrated in the [main readme](../README.md#usage): @@ -89,3 +97,5 @@ In order to render the ingress objects similar to the other objects use as demon ``` Note, that in comparison only the last line was added, the rest is identical to the original. + +See [ingress.jsonnet](../examples/ingress.jsonnet) for an example implementation. diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/kube-prometheus-on-kubeadm.md b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/kube-prometheus-on-kubeadm.md index bef2e3cc4..d0101fea4 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/kube-prometheus-on-kubeadm.md +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/docs/kube-prometheus-on-kubeadm.md @@ -7,7 +7,7 @@ The [kubeadm](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/) tool is linked by Kubernetes as the offical way to deploy and manage self-hosted clusters. Kubeadm does a lot of heavy lifting by automatically configuring your Kubernetes cluster with some common options. This guide is intended to show you how to deploy Prometheus, Prometheus Operator and Kube Prometheus to get you started monitoring your cluster that was deployed with Kubeadm. -This guide assumes you have a basic understanding of how to use the functionality the Prometheus Operator implements. If you haven't yet, we recommend reading through the [getting started guide](getting-started.md) as well as the [alerting guide](../../../Documentation/user-guides/alerting.md). +This guide assumes you have a basic understanding of how to use the functionality the Prometheus Operator implements. If you haven't yet, we recommend reading through the [getting started guide](../../../Documentation/user-guides/getting-started.md) as well as the [alerting guide](../../../Documentation/user-guides/alerting.md). ## Kubeadm Pre-requisites diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/example.jsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/example.jsonnet index 1d36eb1fc..2a10509c1 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/example.jsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/example.jsonnet @@ -10,4 +10,5 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + { { ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } + { ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } + { ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } + +{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } + { ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) } diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/ingress.jsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/ingress.jsonnet index 149fea9f5..7b89094fb 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/ingress.jsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/ingress.jsonnet @@ -11,7 +11,68 @@ local kp = _config+:: { namespace: 'monitoring', }, + // Configure External URL's per application + alertmanager+:: { + alertmanager+: { + spec+: { + externalURL: 'http://alertmanager.example.com', + }, + }, + }, + grafana+:: { + config+: { + sections+: { + server+: { + root_url: 'http://grafana.example.com/', + }, + }, + }, + }, + prometheus+:: { + prometheus+: { + spec+: { + externalURL: 'http://prometheus.example.com', + }, + }, + }, + // Create ingress objects per application ingress+:: { + 'alertmanager-main': + ingress.new() + + ingress.mixin.metadata.withName('alertmanager-main') + + ingress.mixin.metadata.withNamespace($._config.namespace) + + ingress.mixin.metadata.withAnnotations({ + 'nginx.ingress.kubernetes.io/auth-type': 'basic', + 'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth', + 'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required', + }) + + ingress.mixin.spec.withRules( + ingressRule.new() + + ingressRule.withHost('alertmanager.example.com') + + ingressRule.mixin.http.withPaths( + httpIngressPath.new() + + httpIngressPath.mixin.backend.withServiceName('alertmanager-main') + + httpIngressPath.mixin.backend.withServicePort('web') + ), + ), + grafana: + ingress.new() + + ingress.mixin.metadata.withName('grafana') + + ingress.mixin.metadata.withNamespace($._config.namespace) + + ingress.mixin.metadata.withAnnotations({ + 'nginx.ingress.kubernetes.io/auth-type': 'basic', + 'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth', + 'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required', + }) + + ingress.mixin.spec.withRules( + ingressRule.new() + + ingressRule.withHost('grafana.example.com') + + ingressRule.mixin.http.withPaths( + httpIngressPath.new() + + httpIngressPath.mixin.backend.withServiceName('grafana') + + httpIngressPath.mixin.backend.withServicePort('http') + ), + ), 'prometheus-k8s': ingress.new() + ingress.mixin.metadata.withName('prometheus-k8s') + @@ -32,6 +93,7 @@ local kp = ), }, } + { + // Create basic auth secret - replace 'auth' file with your own ingress+:: { 'basic-auth-secret': secret.new('basic-auth', { auth: std.base64(importstr 'auth') }) + @@ -39,7 +101,4 @@ local kp = }, }; -k.core.v1.list.new([ - kp.ingress['prometheus-k8s'], - kp.ingress['basic-auth-secret'], -]) +{ [name + '-ingress']: kp.ingress[name] for name in std.objectFields(kp.ingress) } diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/jsonnet-snippets/kube-aws.jsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/jsonnet-snippets/kube-aws.jsonnet new file mode 100644 index 000000000..b0842eb24 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/jsonnet-snippets/kube-aws.jsonnet @@ -0,0 +1,2 @@ +(import 'kube-prometheus/kube-prometheus.libsonnet') + +(import 'kube-prometheus/kube-prometheus-kube-aws.libsonnet') diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/jsonnet-snippets/kubespray.jsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/jsonnet-snippets/kubespray.jsonnet new file mode 100644 index 000000000..1665cf728 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/jsonnet-snippets/kubespray.jsonnet @@ -0,0 +1,2 @@ +(import 'kube-prometheus/kube-prometheus.libsonnet') + +(import 'kube-prometheus/kube-prometheus-kubespray.libsonnet') diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/minikube.jsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/minikube.jsonnet index 850514fdc..3073612a4 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/minikube.jsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/minikube.jsonnet @@ -10,10 +10,10 @@ local kp = config: importstr 'alertmanager-config.yaml', }, grafana+:: { - config: { // http://docs.grafana.org/installation/configuration/ + config: { // http://docs.grafana.org/installation/configuration/ sections: { // Do not require grafana users to login/authenticate - "auth.anonymous": {enabled: true}, + 'auth.anonymous': { enabled: true }, }, }, }, @@ -27,13 +27,13 @@ local kp = // Reference info: https://coreos.com/operators/prometheus/docs/latest/api.html#prometheusspec spec+: { // An e.g. of the purpose of this is so the "Source" links on http:///#/alerts are valid. - externalUrl: "http://192.168.99.100:30900", + externalUrl: 'http://192.168.99.100:30900', // Reference info: "external_labels" on https://prometheus.io/docs/prometheus/latest/configuration/configuration/ externalLabels: { // This 'cluster' label will be included on every firing prometheus alert. (This is more useful // when running multiple clusters in a shared environment (e.g. AWS) with other users.) - cluster: "minikube-", + cluster: 'minikube-', }, }, }, @@ -42,9 +42,9 @@ local kp = alertmanager+: { // Reference info: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#alertmanagerspec spec+: { - externalUrl: "http://192.168.99.100:30903", + externalUrl: 'http://192.168.99.100:30903', - logLevel: "debug", // So firing alerts show up in log + logLevel: 'debug', // So firing alerts show up in log }, }, }, diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/prometheus-pvc.jsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/prometheus-pvc.jsonnet index 75b250fee..82716e0f5 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/prometheus-pvc.jsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/examples/prometheus-pvc.jsonnet @@ -1,10 +1,9 @@ - // Reference info: documentation for https://github.com/ksonnet/ksonnet-lib can be found at http://g.bryan.dev.hepti.center // -local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; // https://github.com/ksonnet/ksonnet-lib/blob/master/ksonnet.beta.3/k.libsonnet - imports k8s.libsonnet +local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; // https://github.com/ksonnet/ksonnet-lib/blob/master/ksonnet.beta.3/k.libsonnet - imports k8s.libsonnet // * https://github.com/ksonnet/ksonnet-lib/blob/master/ksonnet.beta.3/k8s.libsonnet defines things such as "persistentVolumeClaim:: {" // -local pvc = k.core.v1.persistentVolumeClaim; // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#persistentvolumeclaim-v1-core (defines variable named 'spec' of type 'PersistentVolumeClaimSpec') +local pvc = k.core.v1.persistentVolumeClaim; // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#persistentvolumeclaim-v1-core (defines variable named 'spec' of type 'PersistentVolumeClaimSpec') local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') + @@ -16,20 +15,20 @@ local kp = prometheus+:: { prometheus+: { - spec+: { // https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + spec+: { // https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec // If a value isn't specified for 'retention', then by default the '--storage.tsdb.retention=24h' arg will be passed to prometheus by prometheus-operator. // The possible values for a prometheus are: // * https://github.com/prometheus/common/blob/c7de230/model/time.go#L178 specifies "^([0-9]+)(y|w|d|h|m|s|ms)$" (years weeks days hours minutes seconds milliseconds) - retention: "30d", + retention: '30d', // Reference info: https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/storage.md // By default (if the following 'storage.volumeClaimTemplate' isn't created), prometheus will be created with an EmptyDir for the 'prometheus-k8s-db' volume (for the prom tsdb). // This 'storage.volumeClaimTemplate' causes the following to be automatically created (via dynamic provisioning) for each prometheus pod: // * PersistentVolumeClaim (and a corresponding PersistentVolume) // * the actual volume (per the StorageClassName specified below) - storage: { // https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#storagespec - volumeClaimTemplate: // (same link as above where the 'pvc' variable is defined) - pvc.new() + // http://g.bryan.dev.hepti.center/core/v1/persistentVolumeClaim/#core.v1.persistentVolumeClaim.new + storage: { // https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#storagespec + volumeClaimTemplate: // (same link as above where the 'pvc' variable is defined) + pvc.new() + // http://g.bryan.dev.hepti.center/core/v1/persistentVolumeClaim/#core.v1.persistentVolumeClaim.new pvc.mixin.spec.withAccessModes('ReadWriteOnce') + @@ -40,14 +39,14 @@ local kp = // A StorageClass of the following name (which can be seen via `kubectl get storageclass` from a node in the given K8s cluster) must exist prior to kube-prometheus being deployed. pvc.mixin.spec.withStorageClassName('ssd'), - // The following 'selector' is only needed if you're using manual storage provisioning (https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/storage.md#manual-storage-provisioning). - // And note that this is not supported/allowed by AWS - uncommenting the following 'selector' line (when deploying kube-prometheus to a K8s cluster in AWS) will cause the pvc to be stuck in the Pending status and have the following error: - // * 'Failed to provision volume with StorageClass "ssd": claim.Spec.Selector is not supported for dynamic provisioning on AWS' - //pvc.mixin.spec.selector.withMatchLabels({}), - }, // storage - }, // spec - }, // prometheus - }, // prometheus + // The following 'selector' is only needed if you're using manual storage provisioning (https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/storage.md#manual-storage-provisioning). + // And note that this is not supported/allowed by AWS - uncommenting the following 'selector' line (when deploying kube-prometheus to a K8s cluster in AWS) will cause the pvc to be stuck in the Pending status and have the following error: + // * 'Failed to provision volume with StorageClass "ssd": claim.Spec.Selector is not supported for dynamic provisioning on AWS' + //pvc.mixin.spec.selector.withMatchLabels({}), + }, // storage + }, // spec + }, // prometheus + }, // prometheus }; diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/README.md b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/README.md index 91375a429..c5c7102ce 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/README.md +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/README.md @@ -1,11 +1,21 @@ # Custom Metrics API -The custom metrics API allows the HPA v2 to scale on arbirary metrics. +The custom metrics API allows the HPA v2 to scale based on arbirary metrics. -This directory contains an example deployment of the custom metrics API adapter using Prometheus as the backing monitoring system. +This directory contains an example deployment which extends the Prometheus Adapter, deployed with kube-prometheus, serve the [Custom Metrics API](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/custom-metrics-api.md) by talking to Prometheus running inside the cluster. -In order to deploy the custom metrics adapter for Prometheus you need to generate TLS certficates used to serve the API. An example of how these could be generated can be found in `./gencerts.sh`, note that this is _not_ recommended to be used in production. You need to employ a secure PKI strategy, this is merely an example to get started and try it out quickly. +Make sure you have the Prometheus Adapter up and running in the `monitoring` namespace. -Once the generated `Secret` with the certificates is in place, you can deploy everything in the `monitoring` namespace using `./deploy.sh`. +You can deploy everything in the `monitoring` namespace using `./deploy.sh`. When you're done, you can teardown using the `./teardown.sh` script. + +### Sample App + +Additionally, this directory contains a sample app that uses the [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) to scale the Deployment's replicas of Pods up and down as needed. +Deploy this app by running `kubectl apply -f sample-app.yaml`. +Make the app accessible on your system, for example by using `kubectl -n monitoring port-forward svc/sample-app 8080`. Next you need to put some load on its http endpoints. + +A tool like [hey](https://github.com/rakyll/hey) is helpful for doing so: `hey -c 20 -n 100000000 http://localhost:8080/metrics` + +There is an even more detailed information on this sample app at [luxas/kubeadm-workshop](https://github.com/luxas/kubeadm-workshop#deploying-the-prometheus-operator-for-monitoring-services-in-the-cluster). diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-auth-delegator-cluster-role-binding.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-auth-delegator-cluster-role-binding.yaml deleted file mode 100644 index 8853bc1fe..000000000 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-auth-delegator-cluster-role-binding.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - name: custom-metrics:system:auth-delegator -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:auth-delegator -subjects: -- kind: ServiceAccount - name: custom-metrics-apiserver - namespace: monitoring diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-auth-reader-role-binding.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-auth-reader-role-binding.yaml deleted file mode 100644 index 682143cfa..000000000 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-auth-reader-role-binding.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: RoleBinding -metadata: - name: custom-metrics-auth-reader - namespace: kube-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: extension-apiserver-authentication-reader -subjects: -- kind: ServiceAccount - name: custom-metrics-apiserver - namespace: monitoring diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-deployment.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-deployment.yaml deleted file mode 100644 index e5b4beea7..000000000 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-deployment.yaml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: custom-metrics-apiserver - name: custom-metrics-apiserver -spec: - replicas: 1 - selector: - matchLabels: - app: custom-metrics-apiserver - template: - metadata: - labels: - app: custom-metrics-apiserver - name: custom-metrics-apiserver - spec: - serviceAccountName: custom-metrics-apiserver - containers: - - name: custom-metrics-apiserver - image: quay.io/coreos/k8s-prometheus-adapter-amd64:v0.2.0 - args: - - /adapter - - --secure-port=6443 - - --tls-cert-file=/var/run/serving-cert/serving.crt - - --tls-private-key-file=/var/run/serving-cert/serving.key - - --logtostderr=true - - --prometheus-url=http://prometheus-k8s.monitoring.svc:9090/ - - --metrics-relist-interval=30s - - --rate-interval=5m - - --v=10 - ports: - - containerPort: 6443 - volumeMounts: - - mountPath: /var/run/serving-cert - name: volume-serving-cert - readOnly: true - volumes: - - name: volume-serving-cert - secret: - secretName: cm-adapter-serving-certs diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml index 0335c1772..e2b1ca43e 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml @@ -1,12 +1,12 @@ apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: - name: custom-metrics-resource-reader + name: custom-metrics-server-resources roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: custom-metrics-resource-reader + name: custom-metrics-server-resources subjects: - kind: ServiceAccount - name: custom-metrics-apiserver + name: prometheus-adapter namespace: monitoring diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-service-account.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-service-account.yaml deleted file mode 100644 index 293594094..000000000 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-service-account.yaml +++ /dev/null @@ -1,4 +0,0 @@ -kind: ServiceAccount -apiVersion: v1 -metadata: - name: custom-metrics-apiserver diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-service.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-service.yaml deleted file mode 100644 index fb0addcbb..000000000 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiserver-service.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: custom-metrics-apiserver -spec: - ports: - - port: 443 - targetPort: 6443 - selector: - app: custom-metrics-apiserver diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiservice.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiservice.yaml index cfc2ee63a..98f874958 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiservice.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-apiservice.yaml @@ -4,7 +4,7 @@ metadata: name: v1beta1.custom.metrics.k8s.io spec: service: - name: custom-metrics-apiserver + name: prometheus-adapter namespace: monitoring group: custom.metrics.k8s.io version: v1beta1 diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-configmap.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-configmap.yaml new file mode 100644 index 000000000..2e209cc3c --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-configmap.yaml @@ -0,0 +1,98 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: adapter-config + namespace: monitoring +data: + config.yaml: | + rules: + - seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}' + seriesFilters: [] + resources: + overrides: + namespace: + resource: namespace + pod_name: + resource: pod + name: + matches: ^container_(.*)_seconds_total$ + as: "" + metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[1m])) by (<<.GroupBy>>) + - seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}' + seriesFilters: + - isNot: ^container_.*_seconds_total$ + resources: + overrides: + namespace: + resource: namespace + pod_name: + resource: pod + name: + matches: ^container_(.*)_total$ + as: "" + metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[1m])) by (<<.GroupBy>>) + - seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}' + seriesFilters: + - isNot: ^container_.*_total$ + resources: + overrides: + namespace: + resource: namespace + pod_name: + resource: pod + name: + matches: ^container_(.*)$ + as: "" + metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}) by (<<.GroupBy>>) + - seriesQuery: '{namespace!="",__name__!~"^container_.*"}' + seriesFilters: + - isNot: .*_total$ + resources: + template: <<.Resource>> + name: + matches: "" + as: "" + metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>}) by (<<.GroupBy>>) + - seriesQuery: '{namespace!="",__name__!~"^container_.*"}' + seriesFilters: + - isNot: .*_seconds_total + resources: + template: <<.Resource>> + name: + matches: ^(.*)_total$ + as: "" + metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>}[1m])) by (<<.GroupBy>>) + - seriesQuery: '{namespace!="",__name__!~"^container_.*"}' + seriesFilters: [] + resources: + template: <<.Resource>> + name: + matches: ^(.*)_seconds_total$ + as: "" + metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>}[1m])) by (<<.GroupBy>>) + resourceRules: + cpu: + containerQuery: sum(rate(container_cpu_usage_seconds_total{<<.LabelMatchers>>}[1m])) by (<<.GroupBy>>) + nodeQuery: sum(rate(container_cpu_usage_seconds_total{<<.LabelMatchers>>, id='/'}[1m])) by (<<.GroupBy>>) + resources: + overrides: + node: + resource: node + namespace: + resource: namespace + pod_name: + resource: pod + containerLabel: container_name + memory: + containerQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>}) by (<<.GroupBy>>) + nodeQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>,id='/'}) by (<<.GroupBy>>) + resources: + overrides: + node: + resource: node + namespace: + resource: namespace + pod_name: + resource: pod + containerLabel: container_name + window: 1m diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-resource-reader-cluster-role.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-resource-reader-cluster-role.yaml deleted file mode 100644 index a5ad76043..000000000 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/custom-metrics-resource-reader-cluster-role.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRole -metadata: - name: custom-metrics-resource-reader -rules: -- apiGroups: - - "" - resources: - - namespaces - - pods - - services - verbs: - - get - - list diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/deploy.sh b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/deploy.sh old mode 100755 new mode 100644 index 2255c7fda..1ac74878a --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/deploy.sh +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/deploy.sh @@ -1,13 +1,7 @@ #!/usr/bin/env bash -kubectl create -f custom-metrics-apiserver-auth-delegator-cluster-role-binding.yaml -kubectl create -f custom-metrics-apiserver-auth-reader-role-binding.yaml -kubectl -n monitoring create -f cm-adapter-serving-certs.yaml -kubectl -n monitoring create -f custom-metrics-apiserver-deployment.yaml -kubectl create -f custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml -kubectl -n monitoring create -f custom-metrics-apiserver-service-account.yaml -kubectl -n monitoring create -f custom-metrics-apiserver-service.yaml -kubectl create -f custom-metrics-apiservice.yaml -kubectl create -f custom-metrics-cluster-role.yaml -kubectl create -f custom-metrics-resource-reader-cluster-role.yaml -kubectl create -f hpa-custom-metrics-cluster-role-binding.yaml +kubectl apply -n monitoring custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml +kubectl apply -n monitoring custom-metrics-apiservice.yaml +kubectl apply -n monitoring custom-metrics-cluster-role.yaml +kubectl apply -n monitoring custom-metrics-configmap.yaml +kubectl apply -n monitoring hpa-custom-metrics-cluster-role-binding.yaml diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/gencerts.sh b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/gencerts.sh deleted file mode 100755 index a8f5539d9..000000000 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/gencerts.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -# exit immediately when a command fails -set -e -# only exit with zero if all commands of the pipeline exit successfully -set -o pipefail -# error on unset variables -set -u - -# Detect if we are on mac or should use GNU base64 options -case $(uname) in - Darwin) - b64_opts='-b=0' - ;; - *) - b64_opts='--wrap=0' -esac - -go get -v -u github.com/cloudflare/cfssl/cmd/... - -export PURPOSE=metrics -openssl req -x509 -sha256 -new -nodes -days 365 -newkey rsa:2048 -keyout ${PURPOSE}-ca.key -out ${PURPOSE}-ca.crt -subj "/CN=ca" -echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","'${PURPOSE}'"]}}}' > "${PURPOSE}-ca-config.json" - -export SERVICE_NAME=custom-metrics-apiserver -export ALT_NAMES='"custom-metrics-apiserver.monitoring","custom-metrics-apiserver.monitoring.svc"' -echo "{\"CN\":\"${SERVICE_NAME}\", \"hosts\": [${ALT_NAMES}], \"key\": {\"algo\": \"rsa\",\"size\": 2048}}" | \ - cfssl gencert -ca=metrics-ca.crt -ca-key=metrics-ca.key -config=metrics-ca-config.json - | cfssljson -bare apiserver - -cat <<-EOF > cm-adapter-serving-certs.yaml -apiVersion: v1 -kind: Secret -metadata: - name: cm-adapter-serving-certs -data: - serving.crt: $(base64 ${b64_opts} < apiserver.pem) - serving.key: $(base64 ${b64_opts} < apiserver-key.pem) -EOF diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/sample-app.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/sample-app.yaml new file mode 100644 index 000000000..470887c65 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/sample-app.yaml @@ -0,0 +1,67 @@ +kind: ServiceMonitor +apiVersion: monitoring.coreos.com/v1 +metadata: + name: sample-app + labels: + app: sample-app +spec: + selector: + matchLabels: + app: sample-app + endpoints: + - port: http + interval: 5s +--- +apiVersion: v1 +kind: Service +metadata: + name: sample-app + labels: + app: sample-app +spec: + ports: + - name: http + port: 8080 + targetPort: 8080 + selector: + app: sample-app +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sample-app + labels: + app: sample-app +spec: + replicas: 1 + selector: + matchLabels: + app: sample-app + template: + metadata: + labels: + app: sample-app + spec: + containers: + - image: luxas/autoscale-demo:v0.1.2 + name: metrics-provider + ports: + - name: http + containerPort: 8080 +--- +kind: HorizontalPodAutoscaler +apiVersion: autoscaling/v2beta1 +metadata: + name: sample-app +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: sample-app + minReplicas: 1 + maxReplicas: 10 + metrics: + - type: Pods + pods: + metricName: http_requests + targetAverageValue: 500m diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/teardown.sh b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/teardown.sh old mode 100755 new mode 100644 index 4797de1c7..a62f685ec --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/teardown.sh +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/experimental/custom-metrics-api/teardown.sh @@ -1,13 +1,7 @@ #!/usr/bin/env bash -kubectl delete -f custom-metrics-apiserver-auth-delegator-cluster-role-binding.yaml -kubectl delete -f custom-metrics-apiserver-auth-reader-role-binding.yaml -kubectl -n monitoring delete -f cm-adapter-serving-certs.yaml -kubectl -n monitoring delete -f custom-metrics-apiserver-deployment.yaml -kubectl delete -f custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml -kubectl -n monitoring delete -f custom-metrics-apiserver-service-account.yaml -kubectl -n monitoring delete -f custom-metrics-apiserver-service.yaml -kubectl delete -f custom-metrics-apiservice.yaml -kubectl delete -f custom-metrics-cluster-role.yaml -kubectl delete -f custom-metrics-resource-reader-cluster-role.yaml -kubectl delete -f hpa-custom-metrics-cluster-role-binding.yaml +kubectl delete -n monitoring custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml +kubectl delete -n monitoring custom-metrics-apiservice.yaml +kubectl delete -n monitoring custom-metrics-cluster-role.yaml +kubectl delete -n monitoring custom-metrics-configmap.yaml +kubectl delete -n monitoring hpa-custom-metrics-cluster-role-binding.yaml diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alertmanager/alertmanager.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alertmanager/alertmanager.libsonnet index a6d9e8e62..e109b0adf 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alertmanager/alertmanager.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alertmanager/alertmanager.libsonnet @@ -5,7 +5,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; namespace: 'default', versions+:: { - alertmanager: 'v0.15.2', + alertmanager: 'v0.15.3', }, imageRepos+:: { diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/alertmanager.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/alertmanager.libsonnet index c8aba879c..bf58862dd 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/alertmanager.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/alertmanager.libsonnet @@ -30,6 +30,21 @@ severity: 'warning', }, }, + { + alert:'AlertmanagerMembersInconsistent', + annotations:{ + message: 'Alertmanager has not found all other members of the cluster.', + }, + expr: ||| + alertmanager_cluster_members{%(alertmanagerSelector)s} + != on (service) GROUP_LEFT() + count by (service) (alertmanager_cluster_members{%(alertmanagerSelector)s}) + ||| % $._config, + 'for': '5m', + labels: { + severity: 'critical', + }, + }, ], }, ], diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/prometheus.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/prometheus.libsonnet index 99be08ffb..b188faa22 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/prometheus.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/prometheus.libsonnet @@ -8,7 +8,7 @@ alert: 'PrometheusConfigReloadFailed', annotations: { description: "Reloading Prometheus' configuration has failed for {{$labels.namespace}}/{{$labels.pod}}", - summary: "Reloading Promehteus' configuration failed", + summary: "Reloading Prometheus' configuration failed", }, expr: ||| prometheus_config_last_reload_successful{%(prometheusSelector)s} == 0 diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/tests.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/tests.yaml new file mode 100644 index 000000000..532bb8955 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/alerts/tests.yaml @@ -0,0 +1,157 @@ +# TODO(metalmatze): This file is temporarily saved here for later reference +# until we find out how to integrate the tests into our jsonnet stack. + +rule_files: + - rules.yaml + +evaluation_interval: 1m + +tests: + - interval: 1m + input_series: + - series: 'alertmanager_cluster_members{job="alertmanager-main",instance="10.10.10.0",namespace="monitoring",pod="alertmanager-main-0",service="alertmanager-main"}' + values: '3 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 0 0 0 0 0 0' + - series: 'alertmanager_cluster_members{job="alertmanager-main",instance="10.10.10.1",namespace="monitoring",pod="alertmanager-main-1",service="alertmanager-main"}' + values: '3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3' + - series: 'alertmanager_cluster_members{job="alertmanager-main",instance="10.10.10.2",namespace="monitoring",pod="alertmanager-main-2",service="alertmanager-main"}' + values: '3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3' + alert_rule_test: + - eval_time: 5m + alertname: AlertmanagerMembersInconsistent + - eval_time: 11m + alertname: AlertmanagerMembersInconsistent + exp_alerts: + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.0 + namespace: monitoring + pod: alertmanager-main-0 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - eval_time: 17m + alertname: AlertmanagerMembersInconsistent + exp_alerts: + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.0 + namespace: monitoring + pod: alertmanager-main-0 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - eval_time: 23m + alertname: AlertmanagerMembersInconsistent + exp_alerts: + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.0 + namespace: monitoring + pod: alertmanager-main-0 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - interval: 1m + input_series: + - series: 'alertmanager_cluster_members{job="alertmanager-main",instance="10.10.10.0",namespace="monitoring",pod="alertmanager-main-0",service="alertmanager-main"}' + values: '3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' + - series: 'alertmanager_cluster_members{job="alertmanager-main",instance="10.10.10.1",namespace="monitoring",pod="alertmanager-main-1",service="alertmanager-main"}' + values: '3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2' + - series: 'alertmanager_cluster_members{job="alertmanager-main",instance="10.10.10.2",namespace="monitoring",pod="alertmanager-main-2",service="alertmanager-main"}' + values: '3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2' + alert_rule_test: + - eval_time: 5m + alertname: AlertmanagerMembersInconsistent + - eval_time: 11m + alertname: AlertmanagerMembersInconsistent + exp_alerts: + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.0 + namespace: monitoring + pod: alertmanager-main-0 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.1 + namespace: monitoring + pod: alertmanager-main-1 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.2 + namespace: monitoring + pod: alertmanager-main-2 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - eval_time: 17m + alertname: AlertmanagerMembersInconsistent + exp_alerts: + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.0 + namespace: monitoring + pod: alertmanager-main-0 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.1 + namespace: monitoring + pod: alertmanager-main-1 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.2 + namespace: monitoring + pod: alertmanager-main-2 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - eval_time: 23m + alertname: AlertmanagerMembersInconsistent + exp_alerts: + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.0 + namespace: monitoring + pod: alertmanager-main-0 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.1 + namespace: monitoring + pod: alertmanager-main-1 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' + - exp_labels: + service: 'alertmanager-main' + severity: critical + job: 'alertmanager-main' + instance: 10.10.10.2 + namespace: monitoring + pod: alertmanager-main-2 + exp_annotations: + message: 'Alertmanager has not found all other members of the cluster.' diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/jsonnetfile.json b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/jsonnetfile.json index 96e1fe494..d42e422ab 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/jsonnetfile.json +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/jsonnetfile.json @@ -38,7 +38,7 @@ "subdir": "jsonnet/prometheus-operator" } }, - "version": "v0.24.0" + "version": "v0.25.0" }, { "name": "etcd-mixin", diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus-kube-aws.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus-kube-aws.libsonnet new file mode 100644 index 000000000..8a69d2156 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus-kube-aws.libsonnet @@ -0,0 +1,18 @@ +local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; +local service = k.core.v1.service; +local servicePort = k.core.v1.service.mixin.spec.portsType; + +{ + prometheus+: { + kubeControllerManagerPrometheusDiscoveryService: + service.new('kube-controller-manager-prometheus-discovery', { 'k8s-app': 'kube-controller-manager' }, servicePort.newNamed('http-metrics', 10252, 10252)) + + service.mixin.metadata.withNamespace('kube-system') + + service.mixin.metadata.withLabels({ 'k8s-app': 'kube-controller-manager' }) + + service.mixin.spec.withClusterIp('None'), + kubeSchedulerPrometheusDiscoveryService: + service.new('kube-scheduler-prometheus-discovery', { 'k8s-app': 'kube-scheduler' }, servicePort.newNamed('http-metrics', 10251, 10251)) + + service.mixin.metadata.withNamespace('kube-system') + + service.mixin.metadata.withLabels({ 'k8s-app': 'kube-scheduler' }) + + service.mixin.spec.withClusterIp('None'), + }, +} diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus-kubespray.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus-kubespray.libsonnet new file mode 100644 index 000000000..8a69d2156 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus-kubespray.libsonnet @@ -0,0 +1,18 @@ +local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; +local service = k.core.v1.service; +local servicePort = k.core.v1.service.mixin.spec.portsType; + +{ + prometheus+: { + kubeControllerManagerPrometheusDiscoveryService: + service.new('kube-controller-manager-prometheus-discovery', { 'k8s-app': 'kube-controller-manager' }, servicePort.newNamed('http-metrics', 10252, 10252)) + + service.mixin.metadata.withNamespace('kube-system') + + service.mixin.metadata.withLabels({ 'k8s-app': 'kube-controller-manager' }) + + service.mixin.spec.withClusterIp('None'), + kubeSchedulerPrometheusDiscoveryService: + service.new('kube-scheduler-prometheus-discovery', { 'k8s-app': 'kube-scheduler' }, servicePort.newNamed('http-metrics', 10251, 10251)) + + service.mixin.metadata.withNamespace('kube-system') + + service.mixin.metadata.withLabels({ 'k8s-app': 'kube-scheduler' }) + + service.mixin.spec.withClusterIp('None'), + }, +} diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus.libsonnet index 4402ca964..f59cc80f7 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-prometheus.libsonnet @@ -7,6 +7,7 @@ local configMapList = k.core.v1.configMapList; (import 'alertmanager/alertmanager.libsonnet') + (import 'prometheus-operator/prometheus-operator.libsonnet') + (import 'prometheus/prometheus.libsonnet') + +(import 'prometheus-adapter/prometheus-adapter.libsonnet') + (import 'kubernetes-mixin/mixin.libsonnet') + (import 'alerts/alerts.libsonnet') + (import 'rules/rules.libsonnet') + { @@ -28,6 +29,7 @@ local configMapList = k.core.v1.configMapList; kubeSchedulerSelector: 'job="kube-scheduler"', kubeControllerManagerSelector: 'job="kube-controller-manager"', kubeApiserverSelector: 'job="apiserver"', + coreDNSSelector: 'job="kube-dns"', podLabel: 'pod', alertmanagerSelector: 'job="alertmanager-main"', @@ -44,6 +46,7 @@ local configMapList = k.core.v1.configMapList; Alertmanager: $._config.alertmanagerSelector, Prometheus: $._config.prometheusSelector, PrometheusOperator: $._config.prometheusOperatorSelector, + CoreDNS: $._config.coreDNSSelector, }, prometheus+:: { diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet index 2152c65f2..a3bb0ec60 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet @@ -16,8 +16,8 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; }, versions+:: { - kubeStateMetrics: 'v1.3.1', - kubeRbacProxy: 'v0.3.1', + kubeStateMetrics: 'v1.4.0', + kubeRbacProxy: 'v0.4.0', addonResizer: '1.0', }, @@ -182,7 +182,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; }, ]) + container.mixin.resources.withRequests({ cpu: '10m', memory: '30Mi' }) + - container.mixin.resources.withLimits({ cpu: '10m', memory: '30Mi' }); + container.mixin.resources.withLimits({ cpu: '50m', memory: '30Mi' }); local c = [proxyClusterMetrics, proxySelfMetrics, kubeStateMetrics, addonResizer]; diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet index 7d8aadd89..c9e1faeb0 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet @@ -6,7 +6,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; versions+:: { nodeExporter: 'v0.16.0', - kubeRbacProxy: 'v0.3.1', + kubeRbacProxy: 'v0.4.0', }, imageRepos+:: { @@ -58,6 +58,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; local containerVolumeMount = container.volumeMountsType; local podSelector = daemonset.mixin.spec.template.spec.selectorType; local toleration = daemonset.mixin.spec.template.spec.tolerationsType; + local containerEnv = container.envType; local podLabels = { app: 'node-exporter' }; @@ -82,7 +83,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; local nodeExporter = container.new('node-exporter', $._config.imageRepos.nodeExporter + ':' + $._config.versions.nodeExporter) + container.withArgs([ - '--web.listen-address=127.0.0.1:9101', + '--web.listen-address=127.0.0.1:9100', '--path.procfs=/host/proc', '--path.sysfs=/host/sys', @@ -94,17 +95,27 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; ]) + container.withVolumeMounts([procVolumeMount, sysVolumeMount, rootVolumeMount]) + container.mixin.resources.withRequests({ cpu: '102m', memory: '180Mi' }) + - container.mixin.resources.withLimits({ cpu: '102m', memory: '180Mi' }); + container.mixin.resources.withLimits({ cpu: '250m', memory: '180Mi' }); + local ip = containerEnv.fromFieldPath('IP', 'status.podIP'); local proxy = container.new('kube-rbac-proxy', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) + container.withArgs([ - '--secure-listen-address=:9100', - '--upstream=http://127.0.0.1:9101/', + '--secure-listen-address=$(IP):9100', + '--upstream=http://127.0.0.1:9100/', ]) + + // Keep `hostPort` here, rather than in the node-exporter container + // because Kubernetes mandates that if you define a `hostPort` then + // `containerPort` must match. In our case, we are splitting the + // host port and container port between the two containers. + // We'll keep the port specification here so that the named port + // used by the service is tied to the proxy container. We *could* + // forgo declaring the host port, however it is important to declare + // it so that the scheduler can decide if the pod is schedulable. container.withPorts(containerPort.new(9100) + containerPort.withHostPort(9100) + containerPort.withName('https')) + container.mixin.resources.withRequests({ cpu: '10m', memory: '20Mi' }) + - container.mixin.resources.withLimits({ cpu: '20m', memory: '40Mi' }); + container.mixin.resources.withLimits({ cpu: '20m', memory: '40Mi' }) + + container.withEnv([ip]); local c = [nodeExporter, proxy]; diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/prometheus-adapter/prometheus-adapter.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/prometheus-adapter/prometheus-adapter.libsonnet new file mode 100644 index 000000000..ac6759317 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/prometheus-adapter/prometheus-adapter.libsonnet @@ -0,0 +1,200 @@ +local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; + +{ + _config+:: { + namespace: 'default', + + versions+:: { + prometheusAdapter: 'v0.3.0', + }, + + imageRepos+:: { + prometheusAdapter: 'quay.io/coreos/k8s-prometheus-adapter-amd64', + }, + + prometheusAdapter+:: { + name: 'prometheus-adapter', + labels: { name: $._config.prometheusAdapter.name }, + prometheusURL: 'http://prometheus-' + $._config.prometheus.name + '.' + $._config.namespace + '.svc:9090/', + config: ||| + resourceRules: + cpu: + containerQuery: sum(rate(container_cpu_usage_seconds_total{<<.LabelMatchers>>}[1m])) by (<<.GroupBy>>) + nodeQuery: sum(rate(container_cpu_usage_seconds_total{<<.LabelMatchers>>, id='/'}[1m])) by (<<.GroupBy>>) + resources: + overrides: + node: + resource: node + namespace: + resource: namespace + pod_name: + resource: pod + containerLabel: container_name + memory: + containerQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>}) by (<<.GroupBy>>) + nodeQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>,id='/'}) by (<<.GroupBy>>) + resources: + overrides: + node: + resource: node + namespace: + resource: namespace + pod_name: + resource: pod + containerLabel: container_name + window: 1m + |||, + }, + }, + + prometheusAdapter+:: { + apiService: + { + apiVersion: 'apiregistration.k8s.io/v1beta1', + kind: 'APIService', + metadata: { + name: 'v1beta1.metrics.k8s.io', + }, + spec: { + service: { + name: $.prometheusAdapter.service.metadata.name, + namespace: $._config.namespace, + }, + group: 'metrics.k8s.io', + version: 'v1beta1', + insecureSkipTLSVerify: true, + groupPriorityMinimum: 100, + versionPriority: 100, + }, + }, + + configMap: + local configmap = k.core.v1.configMap; + + configmap.new('adapter-config', { 'config.yaml': $._config.prometheusAdapter.config }) + + configmap.mixin.metadata.withNamespace($._config.namespace), + + service: + local service = k.core.v1.service; + local servicePort = k.core.v1.service.mixin.spec.portsType; + + service.new( + $._config.prometheusAdapter.name, + $._config.prometheusAdapter.labels, + servicePort.newNamed('https', 443, 6443), + ) + + service.mixin.metadata.withNamespace($._config.namespace) + + service.mixin.metadata.withLabels($._config.prometheusAdapter.labels), + + deployment: + local deployment = k.apps.v1beta2.deployment; + local volume = deployment.mixin.spec.template.spec.volumesType; + local container = deployment.mixin.spec.template.spec.containersType; + local containerVolumeMount = container.volumeMountsType; + + local c = + container.new($._config.prometheusAdapter.name, $._config.imageRepos.prometheusAdapter + ':' + $._config.versions.prometheusAdapter) + + container.withArgs([ + '--cert-dir=/var/run/serving-cert', + '--config=/etc/adapter/config.yaml', + '--logtostderr=true', + '--metrics-relist-interval=1m', + '--prometheus-url=' + $._config.prometheusAdapter.prometheusURL, + '--secure-port=6443', + ]) + + container.withPorts([{ containerPort: 6443 }]) + + container.withVolumeMounts([ + containerVolumeMount.new('tmpfs', '/tmp'), + containerVolumeMount.new('volume-serving-cert', '/var/run/serving-cert'), + containerVolumeMount.new('config', '/etc/adapter'), + ],); + + deployment.new($._config.prometheusAdapter.name, 1, c, $._config.prometheusAdapter.labels) + + deployment.mixin.metadata.withNamespace($._config.namespace) + + deployment.mixin.spec.selector.withMatchLabels($._config.prometheusAdapter.labels) + + deployment.mixin.spec.template.spec.withServiceAccountName($.prometheusAdapter.serviceAccount.metadata.name) + + deployment.mixin.spec.template.spec.withVolumes([ + volume.fromEmptyDir(name='tmpfs'), + volume.fromEmptyDir(name='volume-serving-cert'), + { name: 'config', configMap: { name: 'adapter-config' } }, + ]), + + serviceAccount: + local serviceAccount = k.core.v1.serviceAccount; + + serviceAccount.new($._config.prometheusAdapter.name) + + serviceAccount.mixin.metadata.withNamespace($._config.namespace), + + clusterRole: + local clusterRole = k.rbac.v1.clusterRole; + local policyRule = clusterRole.rulesType; + + local rules = + policyRule.new() + + policyRule.withApiGroups(['']) + + policyRule.withResources(['nodes', 'namespaces', 'pods', 'services']) + + policyRule.withVerbs(['get', 'list', 'watch']); + + clusterRole.new() + + clusterRole.mixin.metadata.withName($._config.prometheusAdapter.name) + + clusterRole.withRules(rules), + + clusterRoleBinding: + local clusterRoleBinding = k.rbac.v1.clusterRoleBinding; + + clusterRoleBinding.new() + + clusterRoleBinding.mixin.metadata.withName($._config.prometheusAdapter.name) + + clusterRoleBinding.mixin.metadata.withNamespace($._config.namespace) + + clusterRoleBinding.mixin.roleRef.withApiGroup('rbac.authorization.k8s.io') + + clusterRoleBinding.mixin.roleRef.withName($.prometheusAdapter.clusterRole.metadata.name) + + clusterRoleBinding.mixin.roleRef.mixinInstance({ kind: 'ClusterRole' }) + + clusterRoleBinding.withSubjects([{ + kind: 'ServiceAccount', + name: $.prometheusAdapter.serviceAccount.metadata.name, + namespace: $._config.namespace, + }]), + + clusterRoleBindingDelegator: + local clusterRoleBinding = k.rbac.v1.clusterRoleBinding; + + clusterRoleBinding.new() + + clusterRoleBinding.mixin.metadata.withName('resource-metrics:system:auth-delegator') + + clusterRoleBinding.mixin.roleRef.withApiGroup('rbac.authorization.k8s.io') + + clusterRoleBinding.mixin.roleRef.withName('system:auth-delegator') + + clusterRoleBinding.mixin.roleRef.mixinInstance({ kind: 'ClusterRole' }) + + clusterRoleBinding.withSubjects([{ + kind: 'ServiceAccount', + name: $.prometheusAdapter.serviceAccount.metadata.name, + namespace: $._config.namespace, + }]), + + clusterRoleServerResources: + local clusterRole = k.rbac.v1.clusterRole; + local policyRule = clusterRole.rulesType; + + local rules = + policyRule.new() + + policyRule.withApiGroups(['metrics.k8s.io']) + + policyRule.withResources(['*']) + + policyRule.withVerbs(['*']); + + clusterRole.new() + + clusterRole.mixin.metadata.withName('resource-metrics-server-resources') + + clusterRole.withRules(rules), + + roleBindingAuthReader: + local roleBinding = k.rbac.v1.roleBinding; + + roleBinding.new() + + roleBinding.mixin.metadata.withName('resource-metrics-auth-reader') + + roleBinding.mixin.metadata.withNamespace('kube-system') + + roleBinding.mixin.roleRef.withApiGroup('rbac.authorization.k8s.io') + + roleBinding.mixin.roleRef.withName('extension-apiserver-authentication-reader') + + roleBinding.mixin.roleRef.mixinInstance({ kind: 'Role' }) + + roleBinding.withSubjects([{ + kind: 'ServiceAccount', + name: $.prometheusAdapter.serviceAccount.metadata.name, + namespace: $._config.namespace, + }]), + }, +} diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet index d6cbc5fec..8d19c4563 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet @@ -5,7 +5,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; namespace: 'default', versions+:: { - prometheus: 'v2.4.3', + prometheus: 'v2.5.0', }, imageRepos+:: { @@ -40,7 +40,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; service.new('prometheus-' + $._config.prometheus.name, { app: 'prometheus', prometheus: $._config.prometheus.name }, prometheusPort) + service.mixin.metadata.withNamespace($._config.namespace) + service.mixin.metadata.withLabels({ prometheus: $._config.prometheus.name }), - rules: + [if $._config.prometheus.rules != null && $._config.prometheus.rules != {} then "rules"]: { apiVersion: 'monitoring.coreos.com/v1', kind: 'PrometheusRule', @@ -386,11 +386,9 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; }, }, spec: { - jobLabel: 'k8s-app', selector: { matchLabels: { - 'k8s-app': 'coredns', - component: 'metrics', + 'k8s-app': 'kube-dns', }, }, namespaceSelector: { @@ -400,7 +398,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; }, endpoints: [ { - port: 'http-metrics', + port: 'metrics', interval: '15s', bearerTokenFile: '/var/run/secrets/kubernetes.io/serviceaccount/token', }, diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/rules/node-exporter-v0.16.0-compatibility-rules.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/rules/node-exporter-v0.16.0-compatibility-rules.libsonnet deleted file mode 100644 index f8e5d6d5d..000000000 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/rules/node-exporter-v0.16.0-compatibility-rules.libsonnet +++ /dev/null @@ -1,406 +0,0 @@ -{ - prometheusRules+:: { - groups+: [ - { - name: 'node_exporter-16-bcache', - rules: [ - { - expr: 'node_bcache_cache_read_races', - record: 'node_bcache_cache_read_races_total', - }, - ], - }, - { - name: 'node_exporter-16-buddyinfo', - rules: [ - { - expr: 'node_buddyinfo_blocks', - record: 'node_buddyinfo_count', - }, - ], - }, - { - name: 'node_exporter-16-stat', - rules: [ - { - expr: 'node_boot_time_seconds', - record: 'node_boot_time', - }, - { - expr: 'node_context_switches_total', - record: 'node_context_switches', - }, - { - expr: 'node_forks_total', - record: 'node_forks', - }, - { - expr: 'node_intr_total', - record: 'node_intr', - }, - ], - }, - { - name: 'node_exporter-16-cpu', - rules: [ - { - expr: 'label_replace(node_cpu_seconds_total, "cpu", "$1", "cpu", "cpu(.+)")', - record: 'node_cpu', - }, - ], - }, - { - name: 'node_exporter-16-diskstats', - rules: [ - { - expr: 'node_disk_read_bytes_total', - record: 'node_disk_bytes_read', - }, - { - expr: 'node_disk_written_bytes_total', - record: 'node_disk_bytes_written', - }, - { - expr: 'node_disk_io_time_seconds_total * 1000', - record: 'node_disk_io_time_ms', - }, - { - expr: 'node_disk_io_time_weighted_seconds_total', - record: 'node_disk_io_time_weighted', - }, - { - expr: 'node_disk_reads_completed_total', - record: 'node_disk_reads_completed', - }, - { - expr: 'node_disk_reads_merged_total', - record: 'node_disk_reads_merged', - }, - { - expr: 'node_disk_read_time_seconds_total * 1000', - record: 'node_disk_read_time_ms', - }, - { - expr: 'node_disk_writes_completed_total', - record: 'node_disk_writes_completed', - }, - { - expr: 'node_disk_writes_merged_total', - record: 'node_disk_writes_merged', - }, - { - expr: 'node_disk_write_time_seconds_total * 1000', - record: 'node_disk_write_time_ms', - }, - ], - }, - { - name: 'node_exporter-16-filesystem', - rules: [ - { - expr: 'node_filesystem_free_bytes', - record: 'node_filesystem_free', - }, - { - expr: 'node_filesystem_avail_bytes', - record: 'node_filesystem_avail', - }, - { - expr: 'node_filesystem_size_bytes', - record: 'node_filesystem_size', - }, - ], - }, - { - name: 'node_exporter-16-infiniband', - rules: [ - { - expr: 'node_infiniband_port_data_received_bytes_total', - record: 'node_infiniband_port_data_received_bytes', - }, - { - expr: 'node_infiniband_port_data_transmitted_bytes_total', - record: 'node_infiniband_port_data_transmitted_bytes', - }, - ], - }, - { - name: 'node_exporter-16-interrupts', - rules: [ - { - expr: 'node_interrupts_total', - record: 'node_interrupts', - }, - ], - }, - { - name: 'node_exporter-16-memory', - rules: [ - { - expr: 'node_memory_Active_bytes', - record: 'node_memory_Active', - }, - { - expr: 'node_memory_Active_anon_bytes', - record: 'node_memory_Active_anon', - }, - { - expr: 'node_memory_Active_file_bytes', - record: 'node_memory_Active_file', - }, - { - expr: 'node_memory_AnonHugePages_bytes', - record: 'node_memory_AnonHugePages', - }, - { - expr: 'node_memory_AnonPages_bytes', - record: 'node_memory_AnonPages', - }, - { - expr: 'node_memory_Bounce_bytes', - record: 'node_memory_Bounce', - }, - { - expr: 'node_memory_Buffers_bytes', - record: 'node_memory_Buffers', - }, - { - expr: 'node_memory_Cached_bytes', - record: 'node_memory_Cached', - }, - { - expr: 'node_memory_CommitLimit_bytes', - record: 'node_memory_CommitLimit', - }, - { - expr: 'node_memory_Committed_AS_bytes', - record: 'node_memory_Committed_AS', - }, - { - expr: 'node_memory_DirectMap2M_bytes', - record: 'node_memory_DirectMap2M', - }, - { - expr: 'node_memory_DirectMap4k_bytes', - record: 'node_memory_DirectMap4k', - }, - { - expr: 'node_memory_Dirty_bytes', - record: 'node_memory_Dirty', - }, - { - expr: 'node_memory_HardwareCorrupted_bytes', - record: 'node_memory_HardwareCorrupted', - }, - { - expr: 'node_memory_Hugepagesize_bytes', - record: 'node_memory_Hugepagesize', - }, - { - expr: 'node_memory_Inactive_bytes', - record: 'node_memory_Inactive', - }, - { - expr: 'node_memory_Inactive_anon_bytes', - record: 'node_memory_Inactive_anon', - }, - { - expr: 'node_memory_Inactive_file_bytes', - record: 'node_memory_Inactive_file', - }, - { - expr: 'node_memory_KernelStack_bytes', - record: 'node_memory_KernelStack', - }, - { - expr: 'node_memory_Mapped_bytes', - record: 'node_memory_Mapped', - }, - { - expr: 'node_memory_MemAvailable_bytes', - record: 'node_memory_MemAvailable', - }, - { - expr: 'node_memory_MemFree_bytes', - record: 'node_memory_MemFree', - }, - { - expr: 'node_memory_MemTotal_bytes', - record: 'node_memory_MemTotal', - }, - { - expr: 'node_memory_Mlocked_bytes', - record: 'node_memory_Mlocked', - }, - { - expr: 'node_memory_NFS_Unstable_bytes', - record: 'node_memory_NFS_Unstable', - }, - { - expr: 'node_memory_PageTables_bytes', - record: 'node_memory_PageTables', - }, - { - expr: 'node_memory_Shmem_bytes', - record: 'node_memory_Shmem', - }, - { - expr: 'node_memory_Slab_bytes', - record: 'node_memory_Slab', - }, - { - expr: 'node_memory_SReclaimable_bytes', - record: 'node_memory_SReclaimable', - }, - { - expr: 'node_memory_SUnreclaim_bytes', - record: 'node_memory_SUnreclaim', - }, - { - expr: 'node_memory_SwapCached_bytes', - record: 'node_memory_SwapCached', - }, - { - expr: 'node_memory_SwapFree_bytes', - record: 'node_memory_SwapFree', - }, - { - expr: 'node_memory_SwapTotal_bytes', - record: 'node_memory_SwapTotal', - }, - { - expr: 'node_memory_Unevictable_bytes', - record: 'node_memory_Unevictable', - }, - { - expr: 'node_memory_VmallocChunk_bytes', - record: 'node_memory_VmallocChunk', - }, - { - expr: 'node_memory_VmallocTotal_bytes', - record: 'node_memory_VmallocTotal', - }, - { - expr: 'node_memory_VmallocUsed_bytes', - record: 'node_memory_VmallocUsed', - }, - { - expr: 'node_memory_Writeback_bytes', - record: 'node_memory_Writeback', - }, - { - expr: 'node_memory_WritebackTmp_bytes', - record: 'node_memory_WritebackTmp', - }, - ], - }, - { - name: 'node_exporter-16-network', - rules: [ - { - expr: 'node_network_receive_bytes_total', - record: 'node_network_receive_bytes', - }, - { - expr: 'node_network_receive_compressed_total', - record: 'node_network_receive_compressed', - }, - { - expr: 'node_network_receive_drop_total', - record: 'node_network_receive_drop', - }, - { - expr: 'node_network_receive_errs_total', - record: 'node_network_receive_errs', - }, - { - expr: 'node_network_receive_fifo_total', - record: 'node_network_receive_fifo', - }, - { - expr: 'node_network_receive_frame_total', - record: 'node_network_receive_frame', - }, - { - expr: 'node_network_receive_multicast_total', - record: 'node_network_receive_multicast', - }, - { - expr: 'node_network_receive_packets_total', - record: 'node_network_receive_packets', - }, - { - expr: 'node_network_transmit_bytes_total', - record: 'node_network_transmit_bytes', - }, - { - expr: 'node_network_transmit_compressed_total', - record: 'node_network_transmit_compressed', - }, - { - expr: 'node_network_transmit_drop_total', - record: 'node_network_transmit_drop', - }, - { - expr: 'node_network_transmit_errs_total', - record: 'node_network_transmit_errs', - }, - { - expr: 'node_network_transmit_fifo_total', - record: 'node_network_transmit_fifo', - }, - { - expr: 'node_network_transmit_frame_total', - record: 'node_network_transmit_frame', - }, - { - expr: 'node_network_transmit_multicast_total', - record: 'node_network_transmit_multicast', - }, - { - expr: 'node_network_transmit_packets_total', - record: 'node_network_transmit_packets', - }, - ], - }, - { - name: 'node_exporter-16-nfs', - rules: [ - { - expr: 'node_nfs_connections_total', - record: 'node_nfs_net_connections', - }, - { - expr: 'node_nfs_packets_total', - record: 'node_nfs_net_reads', - }, - { - expr: 'label_replace(label_replace(node_nfs_requests_total, "proto", "$1", "version", "(.+)"), "method", "$1", "procedure", "(.+)")', - record: 'node_nfs_procedures', - }, - { - expr: 'node_nfs_rpc_authentication_refreshes_total', - record: 'node_nfs_rpc_authentication_refreshes', - }, - { - expr: 'node_nfs_rpcs_total', - record: 'node_nfs_rpc_operations', - }, - { - expr: 'node_nfs_rpc_retransmissions_total', - record: 'node_nfs_rpc_retransmissions', - }, - ], - }, - { - name: 'node_exporter-16-textfile', - rules: [ - { - expr: 'node_textfile_mtime_seconds', - record: 'node_textfile_mtime', - }, - ], - }, - ], - }, -} diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/rules/rules.libsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/rules/rules.libsonnet index 6654e16bf..b0217aba8 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/rules/rules.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnet/kube-prometheus/rules/rules.libsonnet @@ -1,2 +1 @@ -(import 'node-rules.libsonnet') + -(import 'node-exporter-v0.16.0-compatibility-rules.libsonnet') +(import 'node-rules.libsonnet') diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnetfile.lock.json b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnetfile.lock.json index 46843efe8..5fa074803 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnetfile.lock.json +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/jsonnetfile.lock.json @@ -8,7 +8,7 @@ "subdir": "contrib/kube-prometheus/jsonnet/kube-prometheus" } }, - "version": "50038889fade4d7a17352592cd268d9d1e709b93" + "version": "606a53d42a836baa950f138be43fae7ae98821cd" }, { "name": "ksonnet", @@ -18,7 +18,7 @@ "subdir": "" } }, - "version": "ed0796f3cb97ebc35ae54f543b1814a7c8dae305" + "version": "d03da231d6c8bd74437b74a1e9e8b966f13dffa2" }, { "name": "kubernetes-mixin", @@ -28,7 +28,7 @@ "subdir": "" } }, - "version": "d24c4066aa2653370e1403812202eb38b2e70210" + "version": "c0b31ea63564966021f9e6010090acded475b192" }, { "name": "grafonnet", @@ -38,7 +38,7 @@ "subdir": "grafonnet" } }, - "version": "64147daa1267a2571ef95609550b782ec9807c52" + "version": "eea8b5ba6b8883cf2df5a17c39a42c4b57c0d63e" }, { "name": "grafana-builder", @@ -48,7 +48,7 @@ "subdir": "grafana-builder" } }, - "version": "bce24b0b087f7dc09c9e9f066f3e554a851792e9" + "version": "5b6050e8e883f24b508a18d4b02d1637ec4a540a" }, { "name": "grafana", @@ -58,7 +58,7 @@ "subdir": "grafana" } }, - "version": "850525cfa7a82115cf7a8a85f5ca632f4632be3d" + "version": "3df5e36ecbf348a13e155e12c495ac9fd05030b6" }, { "name": "prometheus-operator", @@ -68,7 +68,7 @@ "subdir": "jsonnet/prometheus-operator" } }, - "version": "8c6a68760010347134e41f3aa3d73c68eb094a1b" + "version": "82a6ad2071ff653e38b3b4719ecb789d73f3ab05" }, { "name": "etcd-mixin", @@ -78,7 +78,7 @@ "subdir": "Documentation/etcd-mixin" } }, - "version": "7a759c18d294698f537f8be91927354818a71e51" + "version": "02a9810a9e4e5c95feed4a6d6d2c5525fe2af1c1" } ] -} \ No newline at end of file +} diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0alertmanagerCustomResourceDefinition.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0alertmanagerCustomResourceDefinition.yaml index 7c5ff6681..22248a545 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0alertmanagerCustomResourceDefinition.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0alertmanagerCustomResourceDefinition.yaml @@ -593,6 +593,13 @@ spec: baseImage: description: Base image that is used to deploy pods, without tag. type: string + configMaps: + description: ConfigMaps is a list of ConfigMaps in the same namespace + as the Alertmanager object, which shall be mounted into the Alertmanager + Pods. The ConfigMaps are mounted into /etc/alertmanager/configmaps/. + items: + type: string + type: array containers: description: Containers allows injecting additional containers. This is meant to allow adding an authentication proxy to an Alertmanager @@ -1057,8 +1064,8 @@ spec: to by services. type: string protocol: - description: Protocol for port. Must be UDP or TCP. Defaults - to "TCP". + description: Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". type: string required: - containerPort @@ -1211,6 +1218,13 @@ spec: privileged containers are essentially equivalent to root on the host. Defaults to false. type: boolean + procMount: + description: procMount denotes the type of proc mount to use + for the containers. The default is DefaultProcMount which + uses the container runtime defaults for readonly paths and + masked paths. This requires the ProcMountType feature flag + to be enabled. + type: string readOnlyRootFilesystem: description: Whether this container has a read-only root filesystem. Default is false. @@ -1333,8 +1347,8 @@ spec: mountPropagation: description: mountPropagation determines how mounts are propagated from the host to container and the other way - around. When not set, MountPropagationHostToContainer - is used. This field is beta in 1.10. + around. When not set, MountPropagationNone is used. This + field is beta in 1.10. type: string name: description: This must match the Name of a Volume. @@ -1569,11 +1583,12 @@ spec: the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of - available objects. Continuing a list may not be possible - if the server configuration has changed or more than - a few minutes have passed. The resourceVersion field - returned when using this continue value will be identical - to the value in the first response. + available objects. Continuing a consistent list may + not be possible if the server configuration has changed + or more than a few minutes have passed. The resourceVersion + field returned when using this continue value will + be identical to the value in the first response, unless + you have received this token from an error message. type: string resourceVersion: description: 'String that identifies the server''s internal @@ -2093,12 +2108,14 @@ spec: available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next - set of available objects. Continuing a list - may not be possible if the server configuration + set of available objects. Continuing a consistent + list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical - to the value in the first response. + to the value in the first response, unless + you have received this token from an error + message. type: string resourceVersion: description: 'String that identifies the server''s @@ -2216,6 +2233,26 @@ spec: items: type: string type: array + dataSource: + description: TypedLocalObjectReference contains enough information + to let you locate the typed referenced object inside the + same namespace. + properties: + apiGroup: + description: APIGroup is the group for the resource + being referenced. If APIGroup is not specified, the + specified Kind must be in the core API group. For + any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name resources: description: ResourceRequirements describes the compute resource requirements. diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0prometheusCustomResourceDefinition.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0prometheusCustomResourceDefinition.yaml index 0117d343e..58265136d 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0prometheusCustomResourceDefinition.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0prometheusCustomResourceDefinition.yaml @@ -41,6 +41,21 @@ spec: type: boolean required: - key + additionalAlertRelabelConfigs: + description: SecretKeySelector selects a key of a Secret. + properties: + key: + description: The key of the secret to select from. Must be a valid + secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + optional: + description: Specify whether the Secret or it's key must be defined + type: boolean + required: + - key additionalScrapeConfigs: description: SecretKeySelector selects a key of a Secret. properties: @@ -744,6 +759,13 @@ spec: baseImage: description: Base image to use for a Prometheus deployment. type: string + configMaps: + description: ConfigMaps is a list of ConfigMaps in the same namespace + as the Prometheus object, which shall be mounted into the Prometheus + Pods. The ConfigMaps are mounted into /etc/prometheus/configmaps/. + items: + type: string + type: array containers: description: Containers allows injecting additional containers. This is meant to allow adding an authentication proxy to a Prometheus pod. @@ -1207,8 +1229,8 @@ spec: to by services. type: string protocol: - description: Protocol for port. Must be UDP or TCP. Defaults - to "TCP". + description: Protocol for port. Must be UDP, TCP, or SCTP. + Defaults to "TCP". type: string required: - containerPort @@ -1361,6 +1383,13 @@ spec: privileged containers are essentially equivalent to root on the host. Defaults to false. type: boolean + procMount: + description: procMount denotes the type of proc mount to use + for the containers. The default is DefaultProcMount which + uses the container runtime defaults for readonly paths and + masked paths. This requires the ProcMountType feature flag + to be enabled. + type: string readOnlyRootFilesystem: description: Whether this container has a read-only root filesystem. Default is false. @@ -1483,8 +1512,8 @@ spec: mountPropagation: description: mountPropagation determines how mounts are propagated from the host to container and the other way - around. When not set, MountPropagationHostToContainer - is used. This field is beta in 1.10. + around. When not set, MountPropagationNone is used. This + field is beta in 1.10. type: string name: description: This must match the Name of a Volume. @@ -1725,11 +1754,12 @@ spec: the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of - available objects. Continuing a list may not be possible - if the server configuration has changed or more than - a few minutes have passed. The resourceVersion field - returned when using this continue value will be identical - to the value in the first response. + available objects. Continuing a consistent list may + not be possible if the server configuration has changed + or more than a few minutes have passed. The resourceVersion + field returned when using this continue value will + be identical to the value in the first response, unless + you have received this token from an error message. type: string resourceVersion: description: 'String that identifies the server''s internal @@ -2199,10 +2229,6 @@ spec: description: Secrets is a list of Secrets in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. The Secrets are mounted into /etc/prometheus/secrets/. - Secrets changes after initial creation of a Prometheus object are - not reflected in the running Pods. To change the secrets mounted into - the Prometheus Pods, the object must be deleted and recreated with - the new list of secrets. items: type: string type: array @@ -2668,12 +2694,14 @@ spec: available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next - set of available objects. Continuing a list - may not be possible if the server configuration + set of available objects. Continuing a consistent + list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical - to the value in the first response. + to the value in the first response, unless + you have received this token from an error + message. type: string resourceVersion: description: 'String that identifies the server''s @@ -2791,6 +2819,26 @@ spec: items: type: string type: array + dataSource: + description: TypedLocalObjectReference contains enough information + to let you locate the typed referenced object inside the + same namespace. + properties: + apiGroup: + description: APIGroup is the group for the resource + being referenced. If APIGroup is not specified, the + specified Kind must be in the core API group. For + any other third-party types, APIGroup is required. + type: string + kind: + description: Kind is the type of resource being referenced + type: string + name: + description: Name is the name of resource being referenced + type: string + required: + - kind + - name resources: description: ResourceRequirements describes the compute resource requirements. diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0prometheusruleCustomResourceDefinition.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0prometheusruleCustomResourceDefinition.yaml index 525871928..877fadac9 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0prometheusruleCustomResourceDefinition.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-0prometheusruleCustomResourceDefinition.yaml @@ -196,11 +196,12 @@ spec: server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available - objects. Continuing a list may not be possible if the - server configuration has changed or more than a few minutes - have passed. The resourceVersion field returned when using - this continue value will be identical to the value in - the first response. + objects. Continuing a consistent list may not be possible + if the server configuration has changed or more than a + few minutes have passed. The resourceVersion field returned + when using this continue value will be identical to the + value in the first response, unless you have received + this token from an error message. type: string resourceVersion: description: 'String that identifies the server''s internal diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-deployment.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-deployment.yaml index 9c9c485a0..a82bf6f3e 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-deployment.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/0prometheus-operator-deployment.yaml @@ -20,8 +20,8 @@ spec: - --kubelet-service=kube-system/kubelet - --logtostderr=true - --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1 - - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.24.0 - image: quay.io/coreos/prometheus-operator:v0.24.0 + - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.25.0 + image: quay.io/coreos/prometheus-operator:v0.25.0 name: prometheus-operator ports: - containerPort: 8080 diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/alertmanager-alertmanager.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/alertmanager-alertmanager.yaml index e800beacf..2230ea9e3 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/alertmanager-alertmanager.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/alertmanager-alertmanager.yaml @@ -11,4 +11,4 @@ spec: beta.kubernetes.io/os: linux replicas: 3 serviceAccountName: alertmanager-main - version: v0.15.2 + version: v0.15.3 diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/grafana-dashboardDefinitions.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/grafana-dashboardDefinitions.yaml index 1f9a7a889..e4364aa65 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/grafana-dashboardDefinitions.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/grafana-dashboardDefinitions.yaml @@ -796,7 +796,7 @@ items: "steppedLine": false, "targets": [ { - "expr": "sum(max(node_filesystem_size{fstype=\u007e\"ext[234]|btrfs|xfs|zfs\"} - node_filesystem_avail{fstype=\u007e\"ext[234]|btrfs|xfs|zfs\"}) by (device,pod,namespace)) by (pod,namespace)\n/ scalar(sum(max(node_filesystem_size{fstype=\u007e\"ext[234]|btrfs|xfs|zfs\"}) by (device,pod,namespace)))\n* on (namespace, pod) group_left (node) node_namespace_pod:kube_pod_info:\n", + "expr": "sum(max(node_filesystem_size_bytes{fstype=\u007e\"ext[234]|btrfs|xfs|zfs\"} - node_filesystem_avail_bytes{fstype=\u007e\"ext[234]|btrfs|xfs|zfs\"}) by (device,pod,namespace)) by (pod,namespace)\n/ scalar(sum(max(node_filesystem_size_bytes{fstype=\u007e\"ext[234]|btrfs|xfs|zfs\"}) by (device,pod,namespace)))\n* on (namespace, pod) group_left (node) node_namespace_pod:kube_pod_info:\n", "format": "time_series", "intervalFactor": 2, "legendFormat": "{{node}}", @@ -1920,7 +1920,7 @@ items: "steppedLine": false, "targets": [ { - "expr": "1 - avg(rate(node_cpu{mode=\"idle\"}[1m]))", + "expr": "1 - avg(rate(node_cpu_seconds_total{mode=\"idle\"}[1m]))", "format": "time_series", "instant": true, "intervalFactor": 2, @@ -2172,7 +2172,7 @@ items: "steppedLine": false, "targets": [ { - "expr": "1 - sum(:node_memory_MemFreeCachedBuffers:sum) / sum(:node_memory_MemTotal:sum)", + "expr": "1 - sum(:node_memory_MemFreeCachedBuffers_bytes:sum) / sum(:node_memory_MemTotal_bytes:sum)", "format": "time_series", "instant": true, "intervalFactor": 2, @@ -2256,7 +2256,7 @@ items: "steppedLine": false, "targets": [ { - "expr": "sum(kube_pod_container_resource_requests_memory_bytes) / sum(:node_memory_MemTotal:sum)", + "expr": "sum(kube_pod_container_resource_requests_memory_bytes) / sum(:node_memory_MemTotal_bytes:sum)", "format": "time_series", "instant": true, "intervalFactor": 2, @@ -2340,7 +2340,7 @@ items: "steppedLine": false, "targets": [ { - "expr": "sum(kube_pod_container_resource_limits_memory_bytes) / sum(:node_memory_MemTotal:sum)", + "expr": "sum(kube_pod_container_resource_limits_memory_bytes) / sum(:node_memory_MemTotal_bytes:sum)", "format": "time_series", "instant": true, "intervalFactor": 2, @@ -5003,7 +5003,7 @@ items: }, "yaxes": [ { - "format": "percentunit", + "format": "short", "label": null, "logBase": 1, "max": null, @@ -5011,7 +5011,7 @@ items: "show": true }, { - "format": "percentunit", + "format": "short", "label": null, "logBase": 1, "max": null, @@ -5064,7 +5064,7 @@ items: "steppedLine": false, "targets": [ { - "expr": "avg by (cpu) (irate(node_cpu{job=\"node-exporter\", mode!=\"idle\", instance=\"$instance\"}[5m])) * 100", + "expr": "avg by (cpu) (irate(node_cpu_seconds_total{job=\"node-exporter\", mode!=\"idle\", instance=\"$instance\"}[5m])) * 100", "format": "time_series", "intervalFactor": 2, "legendFormat": "{{cpu}}", @@ -5076,7 +5076,7 @@ items: ], "timeFrom": null, "timeShift": null, - "title": "System load", + "title": "Usage Per Core", "tooltip": { "shared": true, "sort": 0, @@ -5168,7 +5168,7 @@ items: "steppedLine": false, "targets": [ { - "expr": "avg (sum by (cpu) (irate(node_cpu{job=\"node-exporter\", mode!=\"idle\", instance=\"$instance\"}[2m])) ) * 100\n", + "expr": "max (sum by (cpu) (irate(node_cpu_seconds_total{job=\"node-exporter\", mode!=\"idle\", instance=\"$instance\"}[2m])) ) * 100\n", "format": "time_series", "intervalFactor": 10, "legendFormat": "{{ cpu }}", @@ -5276,10 +5276,11 @@ items: "tableColumn": "", "targets": [ { - "expr": "avg(sum by (cpu) (irate(node_cpu{job=\"node-exporter\", mode!=\"idle\", instance=\"$instance\"}[2m]))) * 100\n", + "expr": "avg(sum by (cpu) (irate(node_cpu_seconds_total{job=\"node-exporter\", mode!=\"idle\", instance=\"$instance\"}[2m]))) * 100\n", "format": "time_series", "intervalFactor": 2, - "legendFormat": "" + "legendFormat": "", + "refId": "A" } ], "thresholds": "80, 90", @@ -5352,28 +5353,28 @@ items: "steppedLine": false, "targets": [ { - "expr": "max(\n node_memory_MemTotal{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_MemFree{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_Buffers{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_Cached{job=\"node-exporter\", instance=\"$instance\"}\n)\n", + "expr": "max(\n node_memory_MemTotal_bytes{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_MemFree_bytes{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_Buffers_bytes{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_Cached_bytes{job=\"node-exporter\", instance=\"$instance\"}\n)\n", "format": "time_series", "intervalFactor": 2, "legendFormat": "memory used", "refId": "A" }, { - "expr": "max(node_memory_Buffers{job=\"node-exporter\", instance=\"$instance\"})", + "expr": "max(node_memory_Buffers_bytes{job=\"node-exporter\", instance=\"$instance\"})", "format": "time_series", "intervalFactor": 2, "legendFormat": "memory buffers", "refId": "B" }, { - "expr": "max(node_memory_Cached{job=\"node-exporter\", instance=\"$instance\"})", + "expr": "max(node_memory_Cached_bytes{job=\"node-exporter\", instance=\"$instance\"})", "format": "time_series", "intervalFactor": 2, "legendFormat": "memory cached", "refId": "C" }, { - "expr": "max(node_memory_MemFree{job=\"node-exporter\", instance=\"$instance\"})", + "expr": "max(node_memory_MemFree_bytes{job=\"node-exporter\", instance=\"$instance\"})", "format": "time_series", "intervalFactor": 2, "legendFormat": "memory free", @@ -5481,10 +5482,11 @@ items: "tableColumn": "", "targets": [ { - "expr": "max(\n (\n (\n node_memory_MemTotal{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_MemFree{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_Buffers{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_Cached{job=\"node-exporter\", instance=\"$instance\"}\n )\n / node_memory_MemTotal{job=\"node-exporter\", instance=\"$instance\"}\n ) * 100)\n", + "expr": "max(\n (\n (\n node_memory_MemTotal_bytes{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_MemFree_bytes{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_Buffers_bytes{job=\"node-exporter\", instance=\"$instance\"}\n - node_memory_Cached_bytes{job=\"node-exporter\", instance=\"$instance\"}\n )\n / node_memory_MemTotal_bytes{job=\"node-exporter\", instance=\"$instance\"}\n ) * 100)\n", "format": "time_series", "intervalFactor": 2, - "legendFormat": "" + "legendFormat": "", + "refId": "A" } ], "thresholds": "80, 90", @@ -5564,21 +5566,21 @@ items: "steppedLine": false, "targets": [ { - "expr": "max(rate(node_disk_bytes_read{job=\"node-exporter\", instance=\"$instance\"}[2m]))", + "expr": "max(rate(node_disk_read_bytes_total{job=\"node-exporter\", instance=\"$instance\"}[2m]))", "format": "time_series", "intervalFactor": 2, "legendFormat": "read", "refId": "A" }, { - "expr": "max(rate(node_disk_bytes_written{job=\"node-exporter\", instance=\"$instance\"}[2m]))", + "expr": "max(rate(node_disk_written_bytes_total{job=\"node-exporter\", instance=\"$instance\"}[2m]))", "format": "time_series", "intervalFactor": 2, "legendFormat": "written", "refId": "B" }, { - "expr": "max(rate(node_disk_io_time_ms{job=\"node-exporter\", instance=\"$instance\"}[2m]))", + "expr": "max(rate(node_disk_io_time_seconds_total{job=\"node-exporter\", instance=\"$instance\"}[2m]))", "format": "time_series", "intervalFactor": 2, "legendFormat": "io time", @@ -5773,7 +5775,7 @@ items: "steppedLine": false, "targets": [ { - "expr": "max(rate(node_network_receive_bytes{job=\"node-exporter\", instance=\"$instance\", device!\u007e\"lo\"}[5m]))", + "expr": "max(rate(node_network_receive_bytes_total{job=\"node-exporter\", instance=\"$instance\", device!\u007e\"lo\"}[5m]))", "format": "time_series", "intervalFactor": 2, "legendFormat": "{{device}}", @@ -5864,7 +5866,7 @@ items: "steppedLine": false, "targets": [ { - "expr": "max(rate(node_network_transmit_bytes{job=\"node-exporter\", instance=\"$instance\", device!\u007e\"lo\"}[5m]))", + "expr": "max(rate(node_network_transmit_bytes_total{job=\"node-exporter\", instance=\"$instance\", device!\u007e\"lo\"}[5m]))", "format": "time_series", "intervalFactor": 2, "legendFormat": "{{device}}", @@ -5958,7 +5960,7 @@ items: "options": [ ], - "query": "label_values(node_boot_time{job=\"node-exporter\"}, instance)", + "query": "label_values(node_boot_time_seconds{job=\"node-exporter\"}, instance)", "refresh": 2, "regex": "", "sort": 0, @@ -6580,7 +6582,8 @@ items: "expr": "sum(rate(container_cpu_usage_seconds_total{job=\"kubelet\", namespace=\"$namespace\", pod_name=\u007e\"$statefulset.*\"}[3m]))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "" + "legendFormat": "", + "refId": "A" } ], "thresholds": "", @@ -6659,7 +6662,8 @@ items: "expr": "sum(container_memory_usage_bytes{job=\"kubelet\", namespace=\"$namespace\", pod_name=\u007e\"$statefulset.*\"}) / 1024^3", "format": "time_series", "intervalFactor": 2, - "legendFormat": "" + "legendFormat": "", + "refId": "A" } ], "thresholds": "", @@ -6738,7 +6742,8 @@ items: "expr": "sum(rate(container_network_transmit_bytes_total{job=\"kubelet\", namespace=\"$namespace\", pod_name=\u007e\"$statefulset.*\"}[3m])) + sum(rate(container_network_receive_bytes_total{namespace=\"$namespace\",pod_name=\u007e\"$statefulset.*\"}[3m]))", "format": "time_series", "intervalFactor": 2, - "legendFormat": "" + "legendFormat": "", + "refId": "A" } ], "thresholds": "", @@ -6832,7 +6837,8 @@ items: "expr": "max(kube_statefulset_replicas{job=\"kube-state-metrics\", namespace=\"$namespace\", statefulset=\"$statefulset\"}) without (instance, pod)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "" + "legendFormat": "", + "refId": "A" } ], "thresholds": "", @@ -6912,7 +6918,8 @@ items: "expr": "min(kube_statefulset_status_replicas_current{job=\"kube-state-metrics\", namespace=\"$namespace\", statefulset=\"$statefulset\"}) without (instance, pod)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "" + "legendFormat": "", + "refId": "A" } ], "thresholds": "", @@ -6992,7 +6999,8 @@ items: "expr": "max(kube_statefulset_status_observed_generation{job=\"kube-state-metrics\", namespace=\"$namespace\", statefulset=\"$statefulset\"}) without (instance, pod)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "" + "legendFormat": "", + "refId": "A" } ], "thresholds": "", @@ -7072,7 +7080,8 @@ items: "expr": "max(kube_statefulset_metadata_generation{job=\"kube-state-metrics\", statefulset=\"$statefulset\", namespace=\"$namespace\"}) without (instance, pod)", "format": "time_series", "intervalFactor": 2, - "legendFormat": "" + "legendFormat": "", + "refId": "A" } ], "thresholds": "", diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/grafana-deployment.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/grafana-deployment.yaml index e378f6898..6816ce2f4 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/grafana-deployment.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/grafana-deployment.yaml @@ -21,6 +21,10 @@ spec: ports: - containerPort: 3000 name: http + readinessProbe: + httpGet: + path: /api/health + port: http resources: limits: cpu: 200m diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/kube-state-metrics-deployment.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/kube-state-metrics-deployment.yaml index 065c87a98..87aa40afd 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/kube-state-metrics-deployment.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/kube-state-metrics-deployment.yaml @@ -19,7 +19,7 @@ spec: - args: - --secure-listen-address=:8443 - --upstream=http://127.0.0.1:8081/ - image: quay.io/coreos/kube-rbac-proxy:v0.3.1 + image: quay.io/coreos/kube-rbac-proxy:v0.4.0 name: kube-rbac-proxy-main ports: - containerPort: 8443 @@ -34,7 +34,7 @@ spec: - args: - --secure-listen-address=:9443 - --upstream=http://127.0.0.1:8082/ - image: quay.io/coreos/kube-rbac-proxy:v0.3.1 + image: quay.io/coreos/kube-rbac-proxy:v0.4.0 name: kube-rbac-proxy-self ports: - containerPort: 9443 @@ -51,7 +51,7 @@ spec: - --port=8081 - --telemetry-host=127.0.0.1 - --telemetry-port=8082 - image: quay.io/coreos/kube-state-metrics:v1.3.1 + image: quay.io/coreos/kube-state-metrics:v1.4.0 name: kube-state-metrics resources: limits: @@ -84,7 +84,7 @@ spec: name: addon-resizer resources: limits: - cpu: 10m + cpu: 50m memory: 30Mi requests: cpu: 10m diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/node-exporter-daemonset.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/node-exporter-daemonset.yaml index b3febf8cc..28d424b82 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/node-exporter-daemonset.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/node-exporter-daemonset.yaml @@ -16,7 +16,7 @@ spec: spec: containers: - args: - - --web.listen-address=127.0.0.1:9101 + - --web.listen-address=127.0.0.1:9100 - --path.procfs=/host/proc - --path.sysfs=/host/sys - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+)($|/) @@ -25,7 +25,7 @@ spec: name: node-exporter resources: limits: - cpu: 102m + cpu: 250m memory: 180Mi requests: cpu: 102m @@ -42,9 +42,14 @@ spec: name: root readOnly: true - args: - - --secure-listen-address=:9100 - - --upstream=http://127.0.0.1:9101/ - image: quay.io/coreos/kube-rbac-proxy:v0.3.1 + - --secure-listen-address=$(IP):9100 + - --upstream=http://127.0.0.1:9100/ + env: + - name: IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: quay.io/coreos/kube-rbac-proxy:v0.4.0 name: kube-rbac-proxy ports: - containerPort: 9100 diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-apiService.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-apiService.yaml new file mode 100644 index 000000000..95d5c32db --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-apiService.yaml @@ -0,0 +1,13 @@ +apiVersion: apiregistration.k8s.io/v1beta1 +kind: APIService +metadata: + name: v1beta1.metrics.k8s.io +spec: + group: metrics.k8s.io + groupPriorityMinimum: 100 + insecureSkipTLSVerify: true + service: + name: prometheus-adapter + namespace: monitoring + version: v1beta1 + versionPriority: 100 diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRole.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRole.yaml new file mode 100644 index 000000000..a02d2bb05 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRole.yaml @@ -0,0 +1,16 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: prometheus-adapter +rules: +- apiGroups: + - "" + resources: + - nodes + - namespaces + - pods + - services + verbs: + - get + - list + - watch diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRoleBinding.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRoleBinding.yaml new file mode 100644 index 000000000..29fa91764 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRoleBinding.yaml @@ -0,0 +1,13 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: prometheus-adapter + namespace: monitoring +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: prometheus-adapter +subjects: +- kind: ServiceAccount + name: prometheus-adapter + namespace: monitoring diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRoleBindingDelegator.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRoleBindingDelegator.yaml new file mode 100644 index 000000000..4295b50f0 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRoleBindingDelegator.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: resource-metrics:system:auth-delegator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:auth-delegator +subjects: +- kind: ServiceAccount + name: prometheus-adapter + namespace: monitoring diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRoleServerResources.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRoleServerResources.yaml new file mode 100644 index 000000000..fcb914c36 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-clusterRoleServerResources.yaml @@ -0,0 +1,11 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: resource-metrics-server-resources +rules: +- apiGroups: + - metrics.k8s.io + resources: + - '*' + verbs: + - '*' diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-configMap.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-configMap.yaml new file mode 100644 index 000000000..a231de36a --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-configMap.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +data: + config.yaml: | + resourceRules: + cpu: + containerQuery: sum(rate(container_cpu_usage_seconds_total{<<.LabelMatchers>>}[1m])) by (<<.GroupBy>>) + nodeQuery: sum(rate(container_cpu_usage_seconds_total{<<.LabelMatchers>>, id='/'}[1m])) by (<<.GroupBy>>) + resources: + overrides: + node: + resource: node + namespace: + resource: namespace + pod_name: + resource: pod + containerLabel: container_name + memory: + containerQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>}) by (<<.GroupBy>>) + nodeQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>,id='/'}) by (<<.GroupBy>>) + resources: + overrides: + node: + resource: node + namespace: + resource: namespace + pod_name: + resource: pod + containerLabel: container_name + window: 1m +kind: ConfigMap +metadata: + name: adapter-config + namespace: monitoring diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-deployment.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-deployment.yaml new file mode 100644 index 000000000..9d28503c5 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + name: prometheus-adapter + namespace: monitoring +spec: + replicas: 1 + selector: + matchLabels: + name: prometheus-adapter + template: + metadata: + labels: + name: prometheus-adapter + spec: + containers: + - args: + - --cert-dir=/var/run/serving-cert + - --config=/etc/adapter/config.yaml + - --logtostderr=true + - --metrics-relist-interval=1m + - --prometheus-url=http://prometheus-k8s.monitoring.svc:9090/ + - --secure-port=6443 + image: quay.io/coreos/k8s-prometheus-adapter-amd64:v0.3.0 + name: prometheus-adapter + ports: + - containerPort: 6443 + volumeMounts: + - mountPath: /tmp + name: tmpfs + readOnly: false + - mountPath: /var/run/serving-cert + name: volume-serving-cert + readOnly: false + - mountPath: /etc/adapter + name: config + readOnly: false + serviceAccountName: prometheus-adapter + volumes: + - emptyDir: {} + name: tmpfs + - emptyDir: {} + name: volume-serving-cert + - configMap: + name: adapter-config + name: config diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-roleBindingAuthReader.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-roleBindingAuthReader.yaml new file mode 100644 index 000000000..48c8f3253 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-roleBindingAuthReader.yaml @@ -0,0 +1,13 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: resource-metrics-auth-reader + namespace: kube-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: extension-apiserver-authentication-reader +subjects: +- kind: ServiceAccount + name: prometheus-adapter + namespace: monitoring diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-service.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-service.yaml new file mode 100644 index 000000000..e786e01c4 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: prometheus-adapter + name: prometheus-adapter + namespace: monitoring +spec: + ports: + - name: https + port: 443 + targetPort: 6443 + selector: + name: prometheus-adapter diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-serviceAccount.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-serviceAccount.yaml new file mode 100644 index 000000000..d7e705039 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-adapter-serviceAccount.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: prometheus-adapter + namespace: monitoring diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-prometheus.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-prometheus.yaml index ae18cd675..94fd64dc2 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-prometheus.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-prometheus.yaml @@ -25,4 +25,4 @@ spec: serviceAccountName: prometheus-k8s serviceMonitorNamespaceSelector: {} serviceMonitorSelector: {} - version: v2.4.3 + version: v2.5.0 diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-rules.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-rules.yaml index 3a427753c..872cf3105 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-rules.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-rules.yaml @@ -122,17 +122,17 @@ spec: record: 'node_namespace_pod:kube_pod_info:' - expr: | count by (node) (sum by (node, cpu) ( - node_cpu{job="node-exporter"} + node_cpu_seconds_total{job="node-exporter"} * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info: )) record: node:node_num_cpu:sum - expr: | - 1 - avg(rate(node_cpu{job="node-exporter",mode="idle"}[1m])) + 1 - avg(rate(node_cpu_seconds_total{job="node-exporter",mode="idle"}[1m])) record: :node_cpu_utilisation:avg1m - expr: | 1 - avg by (node) ( - rate(node_cpu{job="node-exporter",mode="idle"}[1m]) + rate(node_cpu_seconds_total{job="node-exporter",mode="idle"}[1m]) * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info:) record: node:node_cpu_utilisation:avg1m @@ -152,26 +152,26 @@ spec: record: 'node:node_cpu_saturation_load1:' - expr: | 1 - - sum(node_memory_MemFree{job="node-exporter"} + node_memory_Cached{job="node-exporter"} + node_memory_Buffers{job="node-exporter"}) + sum(node_memory_MemFree_bytes{job="node-exporter"} + node_memory_Cached_bytes{job="node-exporter"} + node_memory_Buffers_bytes{job="node-exporter"}) / - sum(node_memory_MemTotal{job="node-exporter"}) + sum(node_memory_MemTotal_bytes{job="node-exporter"}) record: ':node_memory_utilisation:' - expr: | - sum(node_memory_MemFree{job="node-exporter"} + node_memory_Cached{job="node-exporter"} + node_memory_Buffers{job="node-exporter"}) - record: :node_memory_MemFreeCachedBuffers:sum + sum(node_memory_MemFree_bytes{job="node-exporter"} + node_memory_Cached_bytes{job="node-exporter"} + node_memory_Buffers_bytes{job="node-exporter"}) + record: :node_memory_MemFreeCachedBuffers_bytes:sum - expr: | - sum(node_memory_MemTotal{job="node-exporter"}) - record: :node_memory_MemTotal:sum + sum(node_memory_MemTotal_bytes{job="node-exporter"}) + record: :node_memory_MemTotal_bytes:sum - expr: | sum by (node) ( - (node_memory_MemFree{job="node-exporter"} + node_memory_Cached{job="node-exporter"} + node_memory_Buffers{job="node-exporter"}) + (node_memory_MemFree_bytes{job="node-exporter"} + node_memory_Cached_bytes{job="node-exporter"} + node_memory_Buffers_bytes{job="node-exporter"}) * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info: ) record: node:node_memory_bytes_available:sum - expr: | sum by (node) ( - node_memory_MemTotal{job="node-exporter"} + node_memory_MemTotal_bytes{job="node-exporter"} * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info: ) @@ -190,13 +190,13 @@ spec: - expr: | 1 - sum by (node) ( - (node_memory_MemFree{job="node-exporter"} + node_memory_Cached{job="node-exporter"} + node_memory_Buffers{job="node-exporter"}) + (node_memory_MemFree_bytes{job="node-exporter"} + node_memory_Cached_bytes{job="node-exporter"} + node_memory_Buffers_bytes{job="node-exporter"}) * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info: ) / sum by (node) ( - node_memory_MemTotal{job="node-exporter"} + node_memory_MemTotal_bytes{job="node-exporter"} * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info: ) @@ -213,53 +213,53 @@ spec: ) record: node:node_memory_swap_io_bytes:sum_rate - expr: | - avg(irate(node_disk_io_time_ms{job="node-exporter",device=~"(sd|xvd|nvme).+"}[1m]) / 1e3) + avg(irate(node_disk_io_time_seconds_total{job="node-exporter",device=~"(sd|xvd|nvme).+"}[1m])) record: :node_disk_utilisation:avg_irate - expr: | avg by (node) ( - irate(node_disk_io_time_ms{job="node-exporter",device=~"(sd|xvd|nvme).+"}[1m]) / 1e3 + irate(node_disk_io_time_seconds_total{job="node-exporter",device=~"(sd|xvd|nvme).+"}[1m]) * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info: ) record: node:node_disk_utilisation:avg_irate - expr: | - avg(irate(node_disk_io_time_weighted{job="node-exporter",device=~"(sd|xvd|nvme).+"}[1m]) / 1e3) + avg(irate(node_disk_io_time_weighted_seconds_total{job="node-exporter",device=~"(sd|xvd|nvme).+"}[1m]) / 1e3) record: :node_disk_saturation:avg_irate - expr: | avg by (node) ( - irate(node_disk_io_time_weighted{job="node-exporter",device=~"(sd|xvd|nvme).+"}[1m]) / 1e3 + irate(node_disk_io_time_weighted_seconds_total{job="node-exporter",device=~"(sd|xvd|nvme).+"}[1m]) / 1e3 * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info: ) record: node:node_disk_saturation:avg_irate - expr: | - max by (namespace, pod, device) ((node_filesystem_size{fstype=~"ext[234]|btrfs|xfs|zfs"} - - node_filesystem_avail{fstype=~"ext[234]|btrfs|xfs|zfs"}) - / node_filesystem_size{fstype=~"ext[234]|btrfs|xfs|zfs"}) + max by (namespace, pod, device) ((node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"} + - node_filesystem_avail_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"}) + / node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"}) record: 'node:node_filesystem_usage:' - expr: | - max by (namespace, pod, device) (node_filesystem_avail{fstype=~"ext[234]|btrfs|xfs|zfs"} / node_filesystem_size{fstype=~"ext[234]|btrfs|xfs|zfs"}) + max by (namespace, pod, device) (node_filesystem_avail_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"} / node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"}) record: 'node:node_filesystem_avail:' - expr: | - sum(irate(node_network_receive_bytes{job="node-exporter",device="eth0"}[1m])) + - sum(irate(node_network_transmit_bytes{job="node-exporter",device="eth0"}[1m])) + sum(irate(node_network_receive_bytes_total{job="node-exporter",device="eth0"}[1m])) + + sum(irate(node_network_transmit_bytes_total{job="node-exporter",device="eth0"}[1m])) record: :node_net_utilisation:sum_irate - expr: | sum by (node) ( - (irate(node_network_receive_bytes{job="node-exporter",device="eth0"}[1m]) + - irate(node_network_transmit_bytes{job="node-exporter",device="eth0"}[1m])) + (irate(node_network_receive_bytes_total{job="node-exporter",device="eth0"}[1m]) + + irate(node_network_transmit_bytes_total{job="node-exporter",device="eth0"}[1m])) * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info: ) record: node:node_net_utilisation:sum_irate - expr: | - sum(irate(node_network_receive_drop{job="node-exporter",device="eth0"}[1m])) + - sum(irate(node_network_transmit_drop{job="node-exporter",device="eth0"}[1m])) + sum(irate(node_network_receive_drop_total{job="node-exporter",device="eth0"}[1m])) + + sum(irate(node_network_transmit_drop_total{job="node-exporter",device="eth0"}[1m])) record: :node_net_saturation:sum_irate - expr: | sum by (node) ( - (irate(node_network_receive_drop{job="node-exporter",device="eth0"}[1m]) + - irate(node_network_transmit_drop{job="node-exporter",device="eth0"}[1m])) + (irate(node_network_receive_drop_total{job="node-exporter",device="eth0"}[1m]) + + irate(node_network_transmit_drop_total{job="node-exporter",device="eth0"}[1m])) * on (namespace, pod) group_left(node) node_namespace_pod:kube_pod_info: ) @@ -282,201 +282,6 @@ spec: record: cluster:node_cpu:sum_rate5m - expr: cluster:node_cpu:rate5m / count(sum(node_cpu) BY (instance, cpu)) record: cluster:node_cpu:ratio - - name: node_exporter-16-bcache - rules: - - expr: node_bcache_cache_read_races - record: node_bcache_cache_read_races_total - - name: node_exporter-16-buddyinfo - rules: - - expr: node_buddyinfo_blocks - record: node_buddyinfo_count - - name: node_exporter-16-stat - rules: - - expr: node_boot_time_seconds - record: node_boot_time - - expr: node_context_switches_total - record: node_context_switches - - expr: node_forks_total - record: node_forks - - expr: node_intr_total - record: node_intr - - name: node_exporter-16-cpu - rules: - - expr: label_replace(node_cpu_seconds_total, "cpu", "$1", "cpu", "cpu(.+)") - record: node_cpu - - name: node_exporter-16-diskstats - rules: - - expr: node_disk_read_bytes_total - record: node_disk_bytes_read - - expr: node_disk_written_bytes_total - record: node_disk_bytes_written - - expr: node_disk_io_time_seconds_total * 1000 - record: node_disk_io_time_ms - - expr: node_disk_io_time_weighted_seconds_total - record: node_disk_io_time_weighted - - expr: node_disk_reads_completed_total - record: node_disk_reads_completed - - expr: node_disk_reads_merged_total - record: node_disk_reads_merged - - expr: node_disk_read_time_seconds_total * 1000 - record: node_disk_read_time_ms - - expr: node_disk_writes_completed_total - record: node_disk_writes_completed - - expr: node_disk_writes_merged_total - record: node_disk_writes_merged - - expr: node_disk_write_time_seconds_total * 1000 - record: node_disk_write_time_ms - - name: node_exporter-16-filesystem - rules: - - expr: node_filesystem_free_bytes - record: node_filesystem_free - - expr: node_filesystem_avail_bytes - record: node_filesystem_avail - - expr: node_filesystem_size_bytes - record: node_filesystem_size - - name: node_exporter-16-infiniband - rules: - - expr: node_infiniband_port_data_received_bytes_total - record: node_infiniband_port_data_received_bytes - - expr: node_infiniband_port_data_transmitted_bytes_total - record: node_infiniband_port_data_transmitted_bytes - - name: node_exporter-16-interrupts - rules: - - expr: node_interrupts_total - record: node_interrupts - - name: node_exporter-16-memory - rules: - - expr: node_memory_Active_bytes - record: node_memory_Active - - expr: node_memory_Active_anon_bytes - record: node_memory_Active_anon - - expr: node_memory_Active_file_bytes - record: node_memory_Active_file - - expr: node_memory_AnonHugePages_bytes - record: node_memory_AnonHugePages - - expr: node_memory_AnonPages_bytes - record: node_memory_AnonPages - - expr: node_memory_Bounce_bytes - record: node_memory_Bounce - - expr: node_memory_Buffers_bytes - record: node_memory_Buffers - - expr: node_memory_Cached_bytes - record: node_memory_Cached - - expr: node_memory_CommitLimit_bytes - record: node_memory_CommitLimit - - expr: node_memory_Committed_AS_bytes - record: node_memory_Committed_AS - - expr: node_memory_DirectMap2M_bytes - record: node_memory_DirectMap2M - - expr: node_memory_DirectMap4k_bytes - record: node_memory_DirectMap4k - - expr: node_memory_Dirty_bytes - record: node_memory_Dirty - - expr: node_memory_HardwareCorrupted_bytes - record: node_memory_HardwareCorrupted - - expr: node_memory_Hugepagesize_bytes - record: node_memory_Hugepagesize - - expr: node_memory_Inactive_bytes - record: node_memory_Inactive - - expr: node_memory_Inactive_anon_bytes - record: node_memory_Inactive_anon - - expr: node_memory_Inactive_file_bytes - record: node_memory_Inactive_file - - expr: node_memory_KernelStack_bytes - record: node_memory_KernelStack - - expr: node_memory_Mapped_bytes - record: node_memory_Mapped - - expr: node_memory_MemAvailable_bytes - record: node_memory_MemAvailable - - expr: node_memory_MemFree_bytes - record: node_memory_MemFree - - expr: node_memory_MemTotal_bytes - record: node_memory_MemTotal - - expr: node_memory_Mlocked_bytes - record: node_memory_Mlocked - - expr: node_memory_NFS_Unstable_bytes - record: node_memory_NFS_Unstable - - expr: node_memory_PageTables_bytes - record: node_memory_PageTables - - expr: node_memory_Shmem_bytes - record: node_memory_Shmem - - expr: node_memory_Slab_bytes - record: node_memory_Slab - - expr: node_memory_SReclaimable_bytes - record: node_memory_SReclaimable - - expr: node_memory_SUnreclaim_bytes - record: node_memory_SUnreclaim - - expr: node_memory_SwapCached_bytes - record: node_memory_SwapCached - - expr: node_memory_SwapFree_bytes - record: node_memory_SwapFree - - expr: node_memory_SwapTotal_bytes - record: node_memory_SwapTotal - - expr: node_memory_Unevictable_bytes - record: node_memory_Unevictable - - expr: node_memory_VmallocChunk_bytes - record: node_memory_VmallocChunk - - expr: node_memory_VmallocTotal_bytes - record: node_memory_VmallocTotal - - expr: node_memory_VmallocUsed_bytes - record: node_memory_VmallocUsed - - expr: node_memory_Writeback_bytes - record: node_memory_Writeback - - expr: node_memory_WritebackTmp_bytes - record: node_memory_WritebackTmp - - name: node_exporter-16-network - rules: - - expr: node_network_receive_bytes_total - record: node_network_receive_bytes - - expr: node_network_receive_compressed_total - record: node_network_receive_compressed - - expr: node_network_receive_drop_total - record: node_network_receive_drop - - expr: node_network_receive_errs_total - record: node_network_receive_errs - - expr: node_network_receive_fifo_total - record: node_network_receive_fifo - - expr: node_network_receive_frame_total - record: node_network_receive_frame - - expr: node_network_receive_multicast_total - record: node_network_receive_multicast - - expr: node_network_receive_packets_total - record: node_network_receive_packets - - expr: node_network_transmit_bytes_total - record: node_network_transmit_bytes - - expr: node_network_transmit_compressed_total - record: node_network_transmit_compressed - - expr: node_network_transmit_drop_total - record: node_network_transmit_drop - - expr: node_network_transmit_errs_total - record: node_network_transmit_errs - - expr: node_network_transmit_fifo_total - record: node_network_transmit_fifo - - expr: node_network_transmit_frame_total - record: node_network_transmit_frame - - expr: node_network_transmit_multicast_total - record: node_network_transmit_multicast - - expr: node_network_transmit_packets_total - record: node_network_transmit_packets - - name: node_exporter-16-nfs - rules: - - expr: node_nfs_connections_total - record: node_nfs_net_connections - - expr: node_nfs_packets_total - record: node_nfs_net_reads - - expr: label_replace(label_replace(node_nfs_requests_total, "proto", "$1", "version", - "(.+)"), "method", "$1", "procedure", "(.+)") - record: node_nfs_procedures - - expr: node_nfs_rpc_authentication_refreshes_total - record: node_nfs_rpc_authentication_refreshes - - expr: node_nfs_rpcs_total - record: node_nfs_rpc_operations - - expr: node_nfs_rpc_retransmissions_total - record: node_nfs_rpc_retransmissions - - name: node_exporter-16-textfile - rules: - - expr: node_textfile_mtime_seconds - record: node_textfile_mtime - name: kubernetes-absent rules: - alert: AlertmanagerDown @@ -488,6 +293,15 @@ spec: for: 15m labels: severity: critical + - alert: CoreDNSDown + annotations: + message: CoreDNS has disappeared from Prometheus target discovery. + runbook_url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-corednsdown + expr: | + absent(up{job="kube-dns"} == 1) + for: 15m + labels: + severity: critical - alert: KubeAPIDown annotations: message: KubeAPI has disappeared from Prometheus target discovery. @@ -688,8 +502,8 @@ spec: severity: warning - alert: KubeCronJobRunning annotations: - message: CronJob {{ $labels.namespaces }}/{{ $labels.cronjob }} is taking - more than 1h to complete. + message: CronJob {{ $labels.namespace }}/{{ $labels.cronjob }} is taking more + than 1h to complete. runbook_url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-kubecronjobrunning expr: | time() - kube_cronjob_next_schedule_time{job="kube-state-metrics"} > 3600 @@ -698,8 +512,8 @@ spec: severity: warning - alert: KubeJobCompletion annotations: - message: Job {{ $labels.namespaces }}/{{ $labels.job }} is taking more than - one hour to complete. + message: Job {{ $labels.namespace }}/{{ $labels.job_name }} is taking more + than one hour to complete. runbook_url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-kubejobcompletion expr: | kube_job_spec_completions{job="kube-state-metrics"} - kube_job_status_succeeded{job="kube-state-metrics"} > 0 @@ -708,7 +522,7 @@ spec: severity: warning - alert: KubeJobFailed annotations: - message: Job {{ $labels.namespaces }}/{{ $labels.job }} failed to complete. + message: Job {{ $labels.namespace }}/{{ $labels.job_name }} failed to complete. runbook_url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-kubejobfailed expr: | kube_job_status_failed{job="kube-state-metrics"} > 0 @@ -739,7 +553,7 @@ spec: expr: | sum(namespace_name:kube_pod_container_resource_requests_memory_bytes:sum) / - sum(node_memory_MemTotal) + sum(node_memory_MemTotal_bytes) > (count(node:node_num_cpu:sum)-1) / @@ -766,7 +580,7 @@ spec: expr: | sum(kube_resourcequota{job="kube-state-metrics", type="hard", resource="requests.memory"}) / - sum(node_memory_MemTotal{job="node-exporter"}) + sum(node_memory_MemTotal_bytes{job="node-exporter"}) > 1.5 for: 5m labels: @@ -787,10 +601,11 @@ spec: - alert: CPUThrottlingHigh annotations: message: '{{ printf "%0.0f" $value }}% throttling of CPU in namespace {{ $labels.namespace - }} for {{ $labels.container_name }}.' + }} for container {{ $labels.container_name }} in pod {{ $labels.pod_name + }}.' runbook_url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-cputhrottlinghigh - expr: "100 * sum(increase(container_cpu_cfs_throttled_periods_total[5m])) by - (container_name, pod_name, namespace) \n / \nsum(increase(container_cpu_cfs_periods_total[5m])) + expr: "100 * sum(increase(container_cpu_cfs_throttled_periods_total{}[5m])) + by (container_name, pod_name, namespace) \n / \nsum(increase(container_cpu_cfs_periods_total{}[5m])) by (container_name, pod_name, namespace)\n > 25 \n" for: 15m labels: @@ -800,7 +615,7 @@ spec: - alert: KubePersistentVolumeUsageCritical annotations: message: The PersistentVolume claimed by {{ $labels.persistentvolumeclaim - }} in Namespace {{ $labels.namespace }} is only {{ printf "%0.0f" $value + }} in Namespace {{ $labels.namespace }} is only {{ printf "%0.2f" $value }}% free. runbook_url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-kubepersistentvolumeusagecritical expr: | @@ -815,19 +630,29 @@ spec: annotations: message: Based on recent sampling, the PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} is expected to fill up within four - days. Currently {{ $value }} bytes are available. + days. Currently {{ printf "%0.2f" $value }}% is available. runbook_url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-kubepersistentvolumefullinfourdays expr: | - ( - kubelet_volume_stats_used_bytes{job="kubelet"} + 100 * ( + kubelet_volume_stats_available_bytes{job="kubelet"} / kubelet_volume_stats_capacity_bytes{job="kubelet"} - ) > 0.85 + ) < 15 and predict_linear(kubelet_volume_stats_available_bytes{job="kubelet"}[6h], 4 * 24 * 3600) < 0 for: 5m labels: severity: critical + - alert: KubePersistentVolumeErrors + annotations: + message: The persistent volume {{ $labels.persistentvolume }} has status {{ + $labels.phase }}. + runbook_url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-kubepersistentvolumeerrors + expr: | + kube_persistentvolume_status_phase{phase=~"Failed|Pending",job="kube-state-metrics"} > 0 + for: 5m + labels: + severity: critical - name: kubernetes-system rules: - alert: KubeNodeNotReady @@ -960,6 +785,16 @@ spec: for: 10m labels: severity: warning + - alert: AlertmanagerMembersInconsistent + annotations: + message: Alertmanager has not found all other members of the cluster. + expr: | + alertmanager_cluster_members{job="alertmanager-main"} + != on (service) GROUP_LEFT() + count by (service) (alertmanager_cluster_members{job="alertmanager-main"}) + for: 5m + labels: + severity: critical - name: general.rules rules: - alert: TargetDown @@ -1001,7 +836,7 @@ spec: - alert: PrometheusConfigReloadFailed annotations: description: Reloading Prometheus' configuration has failed for {{$labels.namespace}}/{{$labels.pod}} - summary: Reloading Promehteus' configuration failed + summary: Reloading Prometheus' configuration failed expr: | prometheus_config_last_reload_successful{job="prometheus-k8s"} == 0 for: 10m diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-serviceMonitorCoreDNS.yaml b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-serviceMonitorCoreDNS.yaml index 12a4c5bf9..14a245459 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-serviceMonitorCoreDNS.yaml +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/manifests/prometheus-serviceMonitorCoreDNS.yaml @@ -9,12 +9,10 @@ spec: endpoints: - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token interval: 15s - port: http-metrics - jobLabel: k8s-app + port: metrics namespaceSelector: matchNames: - kube-system selector: matchLabels: - component: metrics - k8s-app: coredns + k8s-app: kube-dns diff --git a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/sync-to-internal-registry.jsonnet b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/sync-to-internal-registry.jsonnet index f0cf35ae3..b7c85571f 100644 --- a/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/sync-to-internal-registry.jsonnet +++ b/vendor/github.com/coreos/prometheus-operator/contrib/kube-prometheus/sync-to-internal-registry.jsonnet @@ -3,20 +3,20 @@ local l = import 'kube-prometheus/lib/lib.libsonnet'; local config = kp._config; local makeImages(config) = [ - { - name: config.imageRepos[image], - tag: config.versions[image], - } - for image in std.objectFields(config.imageRepos) + { + name: config.imageRepos[image], + tag: config.versions[image], + } + for image in std.objectFields(config.imageRepos) ]; local upstreamImage(image) = '%s:%s' % [image.name, image.tag]; local downstreamImage(registry, image) = '%s/%s:%s' % [registry, l.imageName(image.name), image.tag]; local pullPush(image, newRegistry) = [ - 'docker pull %s' % upstreamImage(image), - 'docker tag %s %s' % [upstreamImage(image), downstreamImage(newRegistry, image)], - 'docker push %s' % downstreamImage(newRegistry, image), + 'docker pull %s' % upstreamImage(image), + 'docker tag %s %s' % [upstreamImage(image), downstreamImage(newRegistry, image)], + 'docker push %s' % downstreamImage(newRegistry, image), ]; local images = makeImages(config); @@ -26,5 +26,5 @@ local output(repository) = std.flattenArrays([ for image in images ]); -function(repository="my-registry.com/repository") - std.join('\n', output(repository)) +function(repository='my-registry.com/repository') + std.join('\n', output(repository)) diff --git a/vendor/github.com/coreos/prometheus-operator/example/non-rbac/prometheus-operator.yaml b/vendor/github.com/coreos/prometheus-operator/example/non-rbac/prometheus-operator.yaml index b8ae6f5c6..aa02876f0 100644 --- a/vendor/github.com/coreos/prometheus-operator/example/non-rbac/prometheus-operator.yaml +++ b/vendor/github.com/coreos/prometheus-operator/example/non-rbac/prometheus-operator.yaml @@ -20,8 +20,8 @@ spec: - --kubelet-service=kube-system/kubelet - --logtostderr=true - --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1 - - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.25.0 - image: quay.io/coreos/prometheus-operator:v0.25.0 + - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.26.0 + image: quay.io/coreos/prometheus-operator:v0.26.0 name: prometheus-operator ports: - containerPort: 8080 diff --git a/vendor/github.com/coreos/prometheus-operator/example/prometheus-operator-crd/alertmanager.crd.yaml b/vendor/github.com/coreos/prometheus-operator/example/prometheus-operator-crd/alertmanager.crd.yaml index bbe321366..73235580b 100644 --- a/vendor/github.com/coreos/prometheus-operator/example/prometheus-operator-crd/alertmanager.crd.yaml +++ b/vendor/github.com/coreos/prometheus-operator/example/prometheus-operator-crd/alertmanager.crd.yaml @@ -1714,8 +1714,8 @@ spec: type: object retention: description: Time duration Alertmanager shall retain data for. Default - is '120h', and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` - (milliseconds seconds minutes hours days weeks years). + is '120h', and must match the regular expression `[0-9]+(ms|s|m|h)` + (milliseconds seconds minutes hours). type: string routePrefix: description: The route prefix Alertmanager registers HTTP handlers for. @@ -1831,11 +1831,6 @@ spec: is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used. properties: - class: - description: 'Name of the StorageClass to use when requesting storage - provisioning. More info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses - (DEPRECATED - instead use `volumeClaimTemplate.spec.storageClassName`)' - type: string emptyDir: description: Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling. @@ -1846,63 +1841,6 @@ spec: Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' type: string sizeLimit: {} - resources: - description: ResourceRequirements describes the compute resource - requirements. - properties: - limits: - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' - type: object - requests: - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' - type: object - selector: - description: A label selector is a label query over a set of resources. - The result of matchLabels and matchExpressions are ANDed. An empty - label selector matches all objects. A null label selector matches - no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. - The requirements are ANDed. - items: - description: A label selector requirement is a selector that - contains values, a key, and an operator that relates the - key and values. - properties: - key: - description: key is the label key that the selector applies - to. - type: string - operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, NotIn, Exists - and DoesNotExist. - type: string - values: - description: values is an array of string values. If the - operator is In or NotIn, the values array must be non-empty. - If the operator is Exists or DoesNotExist, the values - array must be empty. This array is replaced during a - strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: array - matchLabels: - description: matchLabels is a map of {key,value} pairs. A single - {key,value} in the matchLabels map is equivalent to an element - of matchExpressions, whose key field is "key", the operator - is "In", and the values array contains only "value". The requirements - are ANDed. - type: object volumeClaimTemplate: description: PersistentVolumeClaim is a user's request for and claim to a persistent volume diff --git a/vendor/github.com/coreos/prometheus-operator/example/prometheus-operator-crd/prometheus.crd.yaml b/vendor/github.com/coreos/prometheus-operator/example/prometheus-operator-crd/prometheus.crd.yaml index a17d2a196..7659c803d 100644 --- a/vendor/github.com/coreos/prometheus-operator/example/prometheus-operator-crd/prometheus.crd.yaml +++ b/vendor/github.com/coreos/prometheus-operator/example/prometheus-operator-crd/prometheus.crd.yaml @@ -2417,11 +2417,6 @@ spec: is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used. properties: - class: - description: 'Name of the StorageClass to use when requesting storage - provisioning. More info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses - (DEPRECATED - instead use `volumeClaimTemplate.spec.storageClassName`)' - type: string emptyDir: description: Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling. @@ -2432,63 +2427,6 @@ spec: Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir' type: string sizeLimit: {} - resources: - description: ResourceRequirements describes the compute resource - requirements. - properties: - limits: - description: 'Limits describes the maximum amount of compute - resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' - type: object - requests: - description: 'Requests describes the minimum amount of compute - resources required. If Requests is omitted for a container, - it defaults to Limits if that is explicitly specified, otherwise - to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' - type: object - selector: - description: A label selector is a label query over a set of resources. - The result of matchLabels and matchExpressions are ANDed. An empty - label selector matches all objects. A null label selector matches - no objects. - properties: - matchExpressions: - description: matchExpressions is a list of label selector requirements. - The requirements are ANDed. - items: - description: A label selector requirement is a selector that - contains values, a key, and an operator that relates the - key and values. - properties: - key: - description: key is the label key that the selector applies - to. - type: string - operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, NotIn, Exists - and DoesNotExist. - type: string - values: - description: values is an array of string values. If the - operator is In or NotIn, the values array must be non-empty. - If the operator is Exists or DoesNotExist, the values - array must be empty. This array is replaced during a - strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: array - matchLabels: - description: matchLabels is a map of {key,value} pairs. A single - {key,value} in the matchLabels map is equivalent to an element - of matchExpressions, whose key field is "key", the operator - is "In", and the values array contains only "value". The requirements - are ANDed. - type: object volumeClaimTemplate: description: PersistentVolumeClaim is a user's request for and claim to a persistent volume diff --git a/vendor/github.com/coreos/prometheus-operator/example/rbac/prometheus-operator-crd/prometheus-operator-crd-cluster-roles.yaml b/vendor/github.com/coreos/prometheus-operator/example/rbac/prometheus-operator-crd/prometheus-operator-crd-cluster-roles.yaml index c2ed4ac7d..4bac43c7f 100644 --- a/vendor/github.com/coreos/prometheus-operator/example/rbac/prometheus-operator-crd/prometheus-operator-crd-cluster-roles.yaml +++ b/vendor/github.com/coreos/prometheus-operator/example/rbac/prometheus-operator-crd/prometheus-operator-crd-cluster-roles.yaml @@ -6,7 +6,7 @@ metadata: rbac.authorization.k8s.io/aggregate-to-view: "true" rules: - apiGroups: ["monitoring.coreos.com"] - resources: ["alertmanagers, prometheuses, prometheusrules, servicemonitors"] + resources: ["alertmanagers", "prometheuses", "prometheusrules", "servicemonitors"] verbs: ["get", "list", "watch"] --- kind: ClusterRole @@ -18,5 +18,5 @@ metadata: rbac.authorization.k8s.io/aggregate-to-admin: "true" rules: - apiGroups: ["monitoring.coreos.com"] - resources: ["alertmanagers, prometheuses, prometheusrules, servicemonitors"] + resources: ["alertmanagers", "prometheuses", "prometheusrules", "servicemonitors"] verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] diff --git a/vendor/github.com/coreos/prometheus-operator/example/rbac/prometheus-operator/prometheus-operator-deployment.yaml b/vendor/github.com/coreos/prometheus-operator/example/rbac/prometheus-operator/prometheus-operator-deployment.yaml index d07b75649..b8a56c7aa 100644 --- a/vendor/github.com/coreos/prometheus-operator/example/rbac/prometheus-operator/prometheus-operator-deployment.yaml +++ b/vendor/github.com/coreos/prometheus-operator/example/rbac/prometheus-operator/prometheus-operator-deployment.yaml @@ -20,8 +20,8 @@ spec: - --kubelet-service=kube-system/kubelet - --logtostderr=true - --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1 - - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.25.0 - image: quay.io/coreos/prometheus-operator:v0.25.0 + - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.26.0 + image: quay.io/coreos/prometheus-operator:v0.26.0 name: prometheus-operator ports: - containerPort: 8080 diff --git a/vendor/github.com/coreos/prometheus-operator/hack/generate/build-rbac-prometheus-operator.sh b/vendor/github.com/coreos/prometheus-operator/hack/generate/build-rbac-prometheus-operator.sh index ae3f0c92c..07ba5a63c 100755 --- a/vendor/github.com/coreos/prometheus-operator/hack/generate/build-rbac-prometheus-operator.sh +++ b/vendor/github.com/coreos/prometheus-operator/hack/generate/build-rbac-prometheus-operator.sh @@ -9,8 +9,7 @@ set -u rm -rf tmp mkdir tmp jsonnet -J hack/generate/vendor hack/generate/prometheus-operator-rbac.jsonnet > tmp/po.json -mapfile -t files < <(jq -r 'keys[]' tmp/po.json) -for file in "${files[@]}" +jq -r 'keys[]' tmp/po.json | while read -r file do jq -r ".[\"${file}\"]" tmp/po.json | gojsontoyaml > "example/rbac/prometheus-operator/${file}" done diff --git a/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/alertmanager-crd.libsonnet b/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/alertmanager-crd.libsonnet index 4b8091e74..8f195a2cf 100644 --- a/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/alertmanager-crd.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/alertmanager-crd.libsonnet @@ -1 +1 @@ -{"apiVersion":"apiextensions.k8s.io/v1beta1","kind":"CustomResourceDefinition","metadata":{"creationTimestamp":null,"name":"alertmanagers.monitoring.coreos.com"},"spec":{"group":"monitoring.coreos.com","names":{"kind":"Alertmanager","plural":"alertmanagers"},"scope":"Namespaced","validation":{"openAPIV3Schema":{"properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"spec":{"description":"AlertmanagerSpec is a specification of the desired behavior of the Alertmanager cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status","properties":{"additionalPeers":{"description":"AdditionalPeers allows injecting a set of additional Alertmanagers to peer with to form a highly available cluster.","items":{"type":"string"},"type":"array"},"affinity":{"description":"Affinity is a group of affinity scheduling rules.","properties":{"nodeAffinity":{"description":"Node affinity is a group of node affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.","items":{"description":"An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).","properties":{"preference":{"description":"A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.","properties":{"matchExpressions":{"description":"A list of node selector requirements by node's labels.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchFields":{"description":"A list of node selector requirements by node's fields.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"}}},"weight":{"description":"Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","preference"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.","properties":{"nodeSelectorTerms":{"description":"Required. A list of node selector terms. The terms are ORed.","items":{"description":"A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.","properties":{"matchExpressions":{"description":"A list of node selector requirements by node's labels.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchFields":{"description":"A list of node selector requirements by node's fields.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"}}},"type":"array"}},"required":["nodeSelectorTerms"]}}},"podAffinity":{"description":"Pod affinity is a group of inter pod affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.","items":{"description":"The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)","properties":{"podAffinityTerm":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"weight":{"description":"weight associated with matching the corresponding podAffinityTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","podAffinityTerm"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.","items":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"type":"array"}}},"podAntiAffinity":{"description":"Pod anti affinity is a group of inter pod anti affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.","items":{"description":"The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)","properties":{"podAffinityTerm":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"weight":{"description":"weight associated with matching the corresponding podAffinityTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","podAffinityTerm"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.","items":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"type":"array"}}}}},"baseImage":{"description":"Base image that is used to deploy pods, without tag.","type":"string"},"configMaps":{"description":"ConfigMaps is a list of ConfigMaps in the same namespace as the Alertmanager object, which shall be mounted into the Alertmanager Pods. The ConfigMaps are mounted into /etc/alertmanager/configmaps/\u003cconfigmap-name\u003e.","items":{"type":"string"},"type":"array"},"containers":{"description":"Containers allows injecting additional containers. This is meant to allow adding an authentication proxy to an Alertmanager pod.","items":{"description":"A single application container that you want to run within a pod.","properties":{"args":{"description":"Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell","items":{"type":"string"},"type":"array"},"command":{"description":"Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell","items":{"type":"string"},"type":"array"},"env":{"description":"List of environment variables to set in the container. Cannot be updated.","items":{"description":"EnvVar represents an environment variable present in a Container.","properties":{"name":{"description":"Name of the environment variable. Must be a C_IDENTIFIER.","type":"string"},"value":{"description":"Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\".","type":"string"},"valueFrom":{"description":"EnvVarSource represents a source for the value of an EnvVar.","properties":{"configMapKeyRef":{"description":"Selects a key from a ConfigMap.","properties":{"key":{"description":"The key to select.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the ConfigMap or it's key must be defined","type":"boolean"}},"required":["key"]},"fieldRef":{"description":"ObjectFieldSelector selects an APIVersioned field of an object.","properties":{"apiVersion":{"description":"Version of the schema the FieldPath is written in terms of, defaults to \"v1\".","type":"string"},"fieldPath":{"description":"Path of the field to select in the specified API version.","type":"string"}},"required":["fieldPath"]},"resourceFieldRef":{"description":"ResourceFieldSelector represents container resources (cpu, memory) and their output format","properties":{"containerName":{"description":"Container name: required for volumes, optional for env vars","type":"string"},"divisor":{},"resource":{"description":"Required: resource to select","type":"string"}},"required":["resource"]},"secretKeyRef":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}}},"required":["name"]},"type":"array"},"envFrom":{"description":"List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.","items":{"description":"EnvFromSource represents the source of a set of ConfigMaps","properties":{"configMapRef":{"description":"ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the ConfigMap must be defined","type":"boolean"}}},"prefix":{"description":"An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.","type":"string"},"secretRef":{"description":"SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret must be defined","type":"boolean"}}}}},"type":"array"},"image":{"description":"Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.","type":"string"},"imagePullPolicy":{"description":"Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images","type":"string"},"lifecycle":{"description":"Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.","properties":{"postStart":{"description":"Handler defines a specific action that should be taken","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]}}},"preStop":{"description":"Handler defines a specific action that should be taken","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]}}}}},"livenessProbe":{"description":"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"failureThreshold":{"description":"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.","format":"int32","type":"integer"},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"initialDelaySeconds":{"description":"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"},"periodSeconds":{"description":"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.","format":"int32","type":"integer"},"successThreshold":{"description":"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.","format":"int32","type":"integer"},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]},"timeoutSeconds":{"description":"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"}}},"name":{"description":"Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.","type":"string"},"ports":{"description":"List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated.","items":{"description":"ContainerPort represents a network port in a single container.","properties":{"containerPort":{"description":"Number of port to expose on the pod's IP address. This must be a valid port number, 0 \u003c x \u003c 65536.","format":"int32","type":"integer"},"hostIP":{"description":"What host IP to bind the external port to.","type":"string"},"hostPort":{"description":"Number of port to expose on the host. If specified, this must be a valid port number, 0 \u003c x \u003c 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.","format":"int32","type":"integer"},"name":{"description":"If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.","type":"string"},"protocol":{"description":"Protocol for port. Must be UDP, TCP, or SCTP. Defaults to \"TCP\".","type":"string"}},"required":["containerPort"]},"type":"array"},"readinessProbe":{"description":"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"failureThreshold":{"description":"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.","format":"int32","type":"integer"},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"initialDelaySeconds":{"description":"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"},"periodSeconds":{"description":"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.","format":"int32","type":"integer"},"successThreshold":{"description":"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.","format":"int32","type":"integer"},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]},"timeoutSeconds":{"description":"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"}}},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"securityContext":{"description":"SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.","properties":{"allowPrivilegeEscalation":{"description":"AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN","type":"boolean"},"capabilities":{"description":"Adds and removes POSIX capabilities from running containers.","properties":{"add":{"description":"Added capabilities","items":{"type":"string"},"type":"array"},"drop":{"description":"Removed capabilities","items":{"type":"string"},"type":"array"}}},"privileged":{"description":"Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.","type":"boolean"},"procMount":{"description":"procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled.","type":"string"},"readOnlyRootFilesystem":{"description":"Whether this container has a read-only root filesystem. Default is false.","type":"boolean"},"runAsGroup":{"description":"The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","format":"int64","type":"integer"},"runAsNonRoot":{"description":"Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","type":"boolean"},"runAsUser":{"description":"The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","format":"int64","type":"integer"},"seLinuxOptions":{"description":"SELinuxOptions are the labels to be applied to the container","properties":{"level":{"description":"Level is SELinux level label that applies to the container.","type":"string"},"role":{"description":"Role is a SELinux role label that applies to the container.","type":"string"},"type":{"description":"Type is a SELinux type label that applies to the container.","type":"string"},"user":{"description":"User is a SELinux user label that applies to the container.","type":"string"}}}}},"stdin":{"description":"Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.","type":"boolean"},"stdinOnce":{"description":"Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false","type":"boolean"},"terminationMessagePath":{"description":"Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.","type":"string"},"terminationMessagePolicy":{"description":"Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.","type":"string"},"tty":{"description":"Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.","type":"boolean"},"volumeDevices":{"description":"volumeDevices is the list of block devices to be used by the container. This is an alpha feature and may change in the future.","items":{"description":"volumeDevice describes a mapping of a raw block device within a container.","properties":{"devicePath":{"description":"devicePath is the path inside of the container that the device will be mapped to.","type":"string"},"name":{"description":"name must match the name of a persistentVolumeClaim in the pod","type":"string"}},"required":["name","devicePath"]},"type":"array"},"volumeMounts":{"description":"Pod volumes to mount into the container's filesystem. Cannot be updated.","items":{"description":"VolumeMount describes a mounting of a Volume within a container.","properties":{"mountPath":{"description":"Path within the container at which the volume should be mounted. Must not contain ':'.","type":"string"},"mountPropagation":{"description":"mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10.","type":"string"},"name":{"description":"This must match the Name of a Volume.","type":"string"},"readOnly":{"description":"Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.","type":"boolean"},"subPath":{"description":"Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).","type":"string"}},"required":["name","mountPath"]},"type":"array"},"workingDir":{"description":"Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.","type":"string"}},"required":["name"]},"type":"array"},"externalUrl":{"description":"The external URL the Alertmanager instances will be available under. This is necessary to generate correct URLs. This is necessary if Alertmanager is not served from root of a DNS name.","type":"string"},"imagePullSecrets":{"description":"An optional list of references to secrets in the same namespace to use for pulling prometheus and alertmanager images from registries see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod","items":{"description":"LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"}}},"type":"array"},"listenLocal":{"description":"ListenLocal makes the Alertmanager server listen on loopback, so that it does not bind against the Pod IP. Note this is only for the Alertmanager UI, not the gossip communication.","type":"boolean"},"logLevel":{"description":"Log level for Alertmanager to be configured with.","type":"string"},"nodeSelector":{"description":"Define which Nodes the Pods are scheduled on.","type":"object"},"paused":{"description":"If set to true all actions on the underlaying managed objects are not goint to be performed, except for delete actions.","type":"boolean"},"podMetadata":{"description":"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.","properties":{"annotations":{"description":"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations","type":"object"},"clusterName":{"description":"The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.","type":"string"},"creationTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"deletionGracePeriodSeconds":{"description":"Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.","format":"int64","type":"integer"},"deletionTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"finalizers":{"description":"Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.","items":{"type":"string"},"type":"array"},"generateName":{"description":"GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency","type":"string"},"generation":{"description":"A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.","format":"int64","type":"integer"},"initializers":{"description":"Initializers tracks the progress of initialization.","properties":{"pending":{"description":"Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.","items":{"description":"Initializer is information about an initializer that has not yet completed.","properties":{"name":{"description":"name of the process that is responsible for initializing this object.","type":"string"}},"required":["name"]},"type":"array"},"result":{"description":"Status is a return value for calls that don't return other objects.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"code":{"description":"Suggested HTTP return code for this status, 0 if not set.","format":"int32","type":"integer"},"details":{"description":"StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.","properties":{"causes":{"description":"The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.","items":{"description":"StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.","properties":{"field":{"description":"The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"","type":"string"},"message":{"description":"A human-readable description of the cause of the error. This field may be presented as-is to a reader.","type":"string"},"reason":{"description":"A machine-readable description of the cause of the error. If this value is empty there is no information available.","type":"string"}}},"type":"array"},"group":{"description":"The group attribute of the resource associated with the status StatusReason.","type":"string"},"kind":{"description":"The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).","type":"string"},"retryAfterSeconds":{"description":"If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.","format":"int32","type":"integer"},"uid":{"description":"UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"message":{"description":"A human-readable description of the status of this operation.","type":"string"},"metadata":{"description":"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.","properties":{"continue":{"description":"continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.","type":"string"},"resourceVersion":{"description":"String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"selfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"}}},"reason":{"description":"A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.","type":"string"},"status":{"description":"Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status","type":"string"}}}},"required":["pending"]},"labels":{"description":"Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels","type":"object"},"name":{"description":"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"namespace":{"description":"Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces","type":"string"},"ownerReferences":{"description":"List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.","items":{"description":"OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.","properties":{"apiVersion":{"description":"API version of the referent.","type":"string"},"blockOwnerDeletion":{"description":"If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.","type":"boolean"},"controller":{"description":"If true, this reference points to the managing controller.","type":"boolean"},"kind":{"description":"Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"uid":{"description":"UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}},"required":["apiVersion","kind","name","uid"]},"type":"array"},"resourceVersion":{"description":"An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"SelfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"},"uid":{"description":"UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"priorityClassName":{"description":"Priority class assigned to the Pods","type":"string"},"replicas":{"description":"Size is the expected size of the alertmanager cluster. The controller will eventually make the size of the running cluster equal to the expected size.","format":"int32","type":"integer"},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"retention":{"description":"Time duration Alertmanager shall retain data for. Default is '120h', and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years).","type":"string"},"routePrefix":{"description":"The route prefix Alertmanager registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`.","type":"string"},"secrets":{"description":"Secrets is a list of Secrets in the same namespace as the Alertmanager object, which shall be mounted into the Alertmanager Pods. The Secrets are mounted into /etc/alertmanager/secrets/\u003csecret-name\u003e.","items":{"type":"string"},"type":"array"},"securityContext":{"description":"PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.","properties":{"fsGroup":{"description":"A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----\n\nIf unset, the Kubelet will not modify the ownership and permissions of any volume.","format":"int64","type":"integer"},"runAsGroup":{"description":"The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.","format":"int64","type":"integer"},"runAsNonRoot":{"description":"Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","type":"boolean"},"runAsUser":{"description":"The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.","format":"int64","type":"integer"},"seLinuxOptions":{"description":"SELinuxOptions are the labels to be applied to the container","properties":{"level":{"description":"Level is SELinux level label that applies to the container.","type":"string"},"role":{"description":"Role is a SELinux role label that applies to the container.","type":"string"},"type":{"description":"Type is a SELinux type label that applies to the container.","type":"string"},"user":{"description":"User is a SELinux user label that applies to the container.","type":"string"}}},"supplementalGroups":{"description":"A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.","items":{"format":"int64","type":"integer"},"type":"array"},"sysctls":{"description":"Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch.","items":{"description":"Sysctl defines a kernel parameter to be set","properties":{"name":{"description":"Name of a property to set","type":"string"},"value":{"description":"Value of a property to set","type":"string"}},"required":["name","value"]},"type":"array"}}},"serviceAccountName":{"description":"ServiceAccountName is the name of the ServiceAccount to use to run the Prometheus Pods.","type":"string"},"sha":{"description":"SHA of Alertmanager container image to be deployed. Defaults to the value of `version`. Similar to a tag, but the SHA explicitly deploys an immutable container image. Version and Tag are ignored if SHA is set.","type":"string"},"storage":{"description":"StorageSpec defines the configured storage for a group Prometheus servers. If neither `emptyDir` nor `volumeClaimTemplate` is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used.","properties":{"class":{"description":"Name of the StorageClass to use when requesting storage provisioning. More info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses (DEPRECATED - instead use `volumeClaimTemplate.spec.storageClassName`)","type":"string"},"emptyDir":{"description":"Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.","properties":{"medium":{"description":"What type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir","type":"string"},"sizeLimit":{}}},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"selector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"volumeClaimTemplate":{"description":"PersistentVolumeClaim is a user's request for and claim to a persistent volume","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"metadata":{"description":"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.","properties":{"annotations":{"description":"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations","type":"object"},"clusterName":{"description":"The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.","type":"string"},"creationTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"deletionGracePeriodSeconds":{"description":"Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.","format":"int64","type":"integer"},"deletionTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"finalizers":{"description":"Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.","items":{"type":"string"},"type":"array"},"generateName":{"description":"GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency","type":"string"},"generation":{"description":"A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.","format":"int64","type":"integer"},"initializers":{"description":"Initializers tracks the progress of initialization.","properties":{"pending":{"description":"Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.","items":{"description":"Initializer is information about an initializer that has not yet completed.","properties":{"name":{"description":"name of the process that is responsible for initializing this object.","type":"string"}},"required":["name"]},"type":"array"},"result":{"description":"Status is a return value for calls that don't return other objects.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"code":{"description":"Suggested HTTP return code for this status, 0 if not set.","format":"int32","type":"integer"},"details":{"description":"StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.","properties":{"causes":{"description":"The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.","items":{"description":"StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.","properties":{"field":{"description":"The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"","type":"string"},"message":{"description":"A human-readable description of the cause of the error. This field may be presented as-is to a reader.","type":"string"},"reason":{"description":"A machine-readable description of the cause of the error. If this value is empty there is no information available.","type":"string"}}},"type":"array"},"group":{"description":"The group attribute of the resource associated with the status StatusReason.","type":"string"},"kind":{"description":"The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).","type":"string"},"retryAfterSeconds":{"description":"If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.","format":"int32","type":"integer"},"uid":{"description":"UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"message":{"description":"A human-readable description of the status of this operation.","type":"string"},"metadata":{"description":"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.","properties":{"continue":{"description":"continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.","type":"string"},"resourceVersion":{"description":"String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"selfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"}}},"reason":{"description":"A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.","type":"string"},"status":{"description":"Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status","type":"string"}}}},"required":["pending"]},"labels":{"description":"Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels","type":"object"},"name":{"description":"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"namespace":{"description":"Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces","type":"string"},"ownerReferences":{"description":"List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.","items":{"description":"OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.","properties":{"apiVersion":{"description":"API version of the referent.","type":"string"},"blockOwnerDeletion":{"description":"If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.","type":"boolean"},"controller":{"description":"If true, this reference points to the managing controller.","type":"boolean"},"kind":{"description":"Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"uid":{"description":"UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}},"required":["apiVersion","kind","name","uid"]},"type":"array"},"resourceVersion":{"description":"An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"SelfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"},"uid":{"description":"UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"spec":{"description":"PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes","properties":{"accessModes":{"description":"AccessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1","items":{"type":"string"},"type":"array"},"dataSource":{"description":"TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.","properties":{"apiGroup":{"description":"APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.","type":"string"},"kind":{"description":"Kind is the type of resource being referenced","type":"string"},"name":{"description":"Name is the name of resource being referenced","type":"string"}},"required":["kind","name"]},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"selector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"storageClassName":{"description":"Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1","type":"string"},"volumeMode":{"description":"volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is an alpha feature and may change in the future.","type":"string"},"volumeName":{"description":"VolumeName is the binding reference to the PersistentVolume backing this claim.","type":"string"}}},"status":{"description":"PersistentVolumeClaimStatus is the current status of a persistent volume claim.","properties":{"accessModes":{"description":"AccessModes contains the actual access modes the volume backing the PVC has. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1","items":{"type":"string"},"type":"array"},"capacity":{"description":"Represents the actual resources of the underlying volume.","type":"object"},"conditions":{"description":"Current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'.","items":{"description":"PersistentVolumeClaimCondition contails details about state of pvc","properties":{"lastProbeTime":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"lastTransitionTime":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"message":{"description":"Human-readable message indicating details about last transition.","type":"string"},"reason":{"description":"Unique, this should be a short, machine understandable string that gives the reason for condition's last transition. If it reports \"ResizeStarted\" that means the underlying persistent volume is being resized.","type":"string"},"status":{"type":"string"},"type":{"type":"string"}},"required":["type","status"]},"type":"array"},"phase":{"description":"Phase represents the current phase of PersistentVolumeClaim.","type":"string"}}}}}}},"tag":{"description":"Tag of Alertmanager container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set.","type":"string"},"tolerations":{"description":"If specified, the pod's tolerations.","items":{"description":"The pod this Toleration is attached to tolerates any taint that matches the triple \u003ckey,value,effect\u003e using the matching operator \u003coperator\u003e.","properties":{"effect":{"description":"Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.","type":"string"},"key":{"description":"Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.","type":"string"},"operator":{"description":"Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.","type":"string"},"tolerationSeconds":{"description":"TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.","format":"int64","type":"integer"},"value":{"description":"Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.","type":"string"}}},"type":"array"},"version":{"description":"Version the cluster should be on.","type":"string"}}},"status":{"description":"AlertmanagerStatus is the most recent observed status of the Alertmanager cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status","properties":{"availableReplicas":{"description":"Total number of available pods (ready for at least minReadySeconds) targeted by this Alertmanager cluster.","format":"int32","type":"integer"},"paused":{"description":"Represents whether any actions on the underlaying managed objects are being performed. Only delete actions will be performed.","type":"boolean"},"replicas":{"description":"Total number of non-terminated pods targeted by this Alertmanager cluster (their labels match the selector).","format":"int32","type":"integer"},"unavailableReplicas":{"description":"Total number of unavailable pods targeted by this Alertmanager cluster.","format":"int32","type":"integer"},"updatedReplicas":{"description":"Total number of non-terminated pods targeted by this Alertmanager cluster that have the desired version spec.","format":"int32","type":"integer"}},"required":["paused","replicas","updatedReplicas","availableReplicas","unavailableReplicas"]}}}},"version":"v1"}} \ No newline at end of file +{"apiVersion":"apiextensions.k8s.io/v1beta1","kind":"CustomResourceDefinition","metadata":{"creationTimestamp":null,"name":"alertmanagers.monitoring.coreos.com"},"spec":{"group":"monitoring.coreos.com","names":{"kind":"Alertmanager","plural":"alertmanagers"},"scope":"Namespaced","validation":{"openAPIV3Schema":{"properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"spec":{"description":"AlertmanagerSpec is a specification of the desired behavior of the Alertmanager cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status","properties":{"additionalPeers":{"description":"AdditionalPeers allows injecting a set of additional Alertmanagers to peer with to form a highly available cluster.","items":{"type":"string"},"type":"array"},"affinity":{"description":"Affinity is a group of affinity scheduling rules.","properties":{"nodeAffinity":{"description":"Node affinity is a group of node affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.","items":{"description":"An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).","properties":{"preference":{"description":"A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.","properties":{"matchExpressions":{"description":"A list of node selector requirements by node's labels.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchFields":{"description":"A list of node selector requirements by node's fields.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"}}},"weight":{"description":"Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","preference"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.","properties":{"nodeSelectorTerms":{"description":"Required. A list of node selector terms. The terms are ORed.","items":{"description":"A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.","properties":{"matchExpressions":{"description":"A list of node selector requirements by node's labels.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchFields":{"description":"A list of node selector requirements by node's fields.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"}}},"type":"array"}},"required":["nodeSelectorTerms"]}}},"podAffinity":{"description":"Pod affinity is a group of inter pod affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.","items":{"description":"The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)","properties":{"podAffinityTerm":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"weight":{"description":"weight associated with matching the corresponding podAffinityTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","podAffinityTerm"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.","items":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"type":"array"}}},"podAntiAffinity":{"description":"Pod anti affinity is a group of inter pod anti affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.","items":{"description":"The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)","properties":{"podAffinityTerm":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"weight":{"description":"weight associated with matching the corresponding podAffinityTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","podAffinityTerm"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.","items":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"type":"array"}}}}},"baseImage":{"description":"Base image that is used to deploy pods, without tag.","type":"string"},"configMaps":{"description":"ConfigMaps is a list of ConfigMaps in the same namespace as the Alertmanager object, which shall be mounted into the Alertmanager Pods. The ConfigMaps are mounted into /etc/alertmanager/configmaps/\u003cconfigmap-name\u003e.","items":{"type":"string"},"type":"array"},"containers":{"description":"Containers allows injecting additional containers. This is meant to allow adding an authentication proxy to an Alertmanager pod.","items":{"description":"A single application container that you want to run within a pod.","properties":{"args":{"description":"Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell","items":{"type":"string"},"type":"array"},"command":{"description":"Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell","items":{"type":"string"},"type":"array"},"env":{"description":"List of environment variables to set in the container. Cannot be updated.","items":{"description":"EnvVar represents an environment variable present in a Container.","properties":{"name":{"description":"Name of the environment variable. Must be a C_IDENTIFIER.","type":"string"},"value":{"description":"Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\".","type":"string"},"valueFrom":{"description":"EnvVarSource represents a source for the value of an EnvVar.","properties":{"configMapKeyRef":{"description":"Selects a key from a ConfigMap.","properties":{"key":{"description":"The key to select.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the ConfigMap or it's key must be defined","type":"boolean"}},"required":["key"]},"fieldRef":{"description":"ObjectFieldSelector selects an APIVersioned field of an object.","properties":{"apiVersion":{"description":"Version of the schema the FieldPath is written in terms of, defaults to \"v1\".","type":"string"},"fieldPath":{"description":"Path of the field to select in the specified API version.","type":"string"}},"required":["fieldPath"]},"resourceFieldRef":{"description":"ResourceFieldSelector represents container resources (cpu, memory) and their output format","properties":{"containerName":{"description":"Container name: required for volumes, optional for env vars","type":"string"},"divisor":{},"resource":{"description":"Required: resource to select","type":"string"}},"required":["resource"]},"secretKeyRef":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}}},"required":["name"]},"type":"array"},"envFrom":{"description":"List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.","items":{"description":"EnvFromSource represents the source of a set of ConfigMaps","properties":{"configMapRef":{"description":"ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the ConfigMap must be defined","type":"boolean"}}},"prefix":{"description":"An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.","type":"string"},"secretRef":{"description":"SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret must be defined","type":"boolean"}}}}},"type":"array"},"image":{"description":"Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.","type":"string"},"imagePullPolicy":{"description":"Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images","type":"string"},"lifecycle":{"description":"Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.","properties":{"postStart":{"description":"Handler defines a specific action that should be taken","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]}}},"preStop":{"description":"Handler defines a specific action that should be taken","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]}}}}},"livenessProbe":{"description":"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"failureThreshold":{"description":"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.","format":"int32","type":"integer"},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"initialDelaySeconds":{"description":"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"},"periodSeconds":{"description":"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.","format":"int32","type":"integer"},"successThreshold":{"description":"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.","format":"int32","type":"integer"},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]},"timeoutSeconds":{"description":"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"}}},"name":{"description":"Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.","type":"string"},"ports":{"description":"List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated.","items":{"description":"ContainerPort represents a network port in a single container.","properties":{"containerPort":{"description":"Number of port to expose on the pod's IP address. This must be a valid port number, 0 \u003c x \u003c 65536.","format":"int32","type":"integer"},"hostIP":{"description":"What host IP to bind the external port to.","type":"string"},"hostPort":{"description":"Number of port to expose on the host. If specified, this must be a valid port number, 0 \u003c x \u003c 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.","format":"int32","type":"integer"},"name":{"description":"If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.","type":"string"},"protocol":{"description":"Protocol for port. Must be UDP, TCP, or SCTP. Defaults to \"TCP\".","type":"string"}},"required":["containerPort"]},"type":"array"},"readinessProbe":{"description":"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"failureThreshold":{"description":"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.","format":"int32","type":"integer"},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"initialDelaySeconds":{"description":"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"},"periodSeconds":{"description":"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.","format":"int32","type":"integer"},"successThreshold":{"description":"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.","format":"int32","type":"integer"},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]},"timeoutSeconds":{"description":"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"}}},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"securityContext":{"description":"SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.","properties":{"allowPrivilegeEscalation":{"description":"AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN","type":"boolean"},"capabilities":{"description":"Adds and removes POSIX capabilities from running containers.","properties":{"add":{"description":"Added capabilities","items":{"type":"string"},"type":"array"},"drop":{"description":"Removed capabilities","items":{"type":"string"},"type":"array"}}},"privileged":{"description":"Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.","type":"boolean"},"procMount":{"description":"procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled.","type":"string"},"readOnlyRootFilesystem":{"description":"Whether this container has a read-only root filesystem. Default is false.","type":"boolean"},"runAsGroup":{"description":"The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","format":"int64","type":"integer"},"runAsNonRoot":{"description":"Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","type":"boolean"},"runAsUser":{"description":"The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","format":"int64","type":"integer"},"seLinuxOptions":{"description":"SELinuxOptions are the labels to be applied to the container","properties":{"level":{"description":"Level is SELinux level label that applies to the container.","type":"string"},"role":{"description":"Role is a SELinux role label that applies to the container.","type":"string"},"type":{"description":"Type is a SELinux type label that applies to the container.","type":"string"},"user":{"description":"User is a SELinux user label that applies to the container.","type":"string"}}}}},"stdin":{"description":"Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.","type":"boolean"},"stdinOnce":{"description":"Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false","type":"boolean"},"terminationMessagePath":{"description":"Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.","type":"string"},"terminationMessagePolicy":{"description":"Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.","type":"string"},"tty":{"description":"Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.","type":"boolean"},"volumeDevices":{"description":"volumeDevices is the list of block devices to be used by the container. This is an alpha feature and may change in the future.","items":{"description":"volumeDevice describes a mapping of a raw block device within a container.","properties":{"devicePath":{"description":"devicePath is the path inside of the container that the device will be mapped to.","type":"string"},"name":{"description":"name must match the name of a persistentVolumeClaim in the pod","type":"string"}},"required":["name","devicePath"]},"type":"array"},"volumeMounts":{"description":"Pod volumes to mount into the container's filesystem. Cannot be updated.","items":{"description":"VolumeMount describes a mounting of a Volume within a container.","properties":{"mountPath":{"description":"Path within the container at which the volume should be mounted. Must not contain ':'.","type":"string"},"mountPropagation":{"description":"mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10.","type":"string"},"name":{"description":"This must match the Name of a Volume.","type":"string"},"readOnly":{"description":"Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.","type":"boolean"},"subPath":{"description":"Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).","type":"string"}},"required":["name","mountPath"]},"type":"array"},"workingDir":{"description":"Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.","type":"string"}},"required":["name"]},"type":"array"},"externalUrl":{"description":"The external URL the Alertmanager instances will be available under. This is necessary to generate correct URLs. This is necessary if Alertmanager is not served from root of a DNS name.","type":"string"},"imagePullSecrets":{"description":"An optional list of references to secrets in the same namespace to use for pulling prometheus and alertmanager images from registries see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod","items":{"description":"LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"}}},"type":"array"},"listenLocal":{"description":"ListenLocal makes the Alertmanager server listen on loopback, so that it does not bind against the Pod IP. Note this is only for the Alertmanager UI, not the gossip communication.","type":"boolean"},"logLevel":{"description":"Log level for Alertmanager to be configured with.","type":"string"},"nodeSelector":{"description":"Define which Nodes the Pods are scheduled on.","type":"object"},"paused":{"description":"If set to true all actions on the underlaying managed objects are not goint to be performed, except for delete actions.","type":"boolean"},"podMetadata":{"description":"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.","properties":{"annotations":{"description":"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations","type":"object"},"clusterName":{"description":"The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.","type":"string"},"creationTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"deletionGracePeriodSeconds":{"description":"Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.","format":"int64","type":"integer"},"deletionTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"finalizers":{"description":"Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.","items":{"type":"string"},"type":"array"},"generateName":{"description":"GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency","type":"string"},"generation":{"description":"A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.","format":"int64","type":"integer"},"initializers":{"description":"Initializers tracks the progress of initialization.","properties":{"pending":{"description":"Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.","items":{"description":"Initializer is information about an initializer that has not yet completed.","properties":{"name":{"description":"name of the process that is responsible for initializing this object.","type":"string"}},"required":["name"]},"type":"array"},"result":{"description":"Status is a return value for calls that don't return other objects.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"code":{"description":"Suggested HTTP return code for this status, 0 if not set.","format":"int32","type":"integer"},"details":{"description":"StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.","properties":{"causes":{"description":"The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.","items":{"description":"StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.","properties":{"field":{"description":"The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"","type":"string"},"message":{"description":"A human-readable description of the cause of the error. This field may be presented as-is to a reader.","type":"string"},"reason":{"description":"A machine-readable description of the cause of the error. If this value is empty there is no information available.","type":"string"}}},"type":"array"},"group":{"description":"The group attribute of the resource associated with the status StatusReason.","type":"string"},"kind":{"description":"The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).","type":"string"},"retryAfterSeconds":{"description":"If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.","format":"int32","type":"integer"},"uid":{"description":"UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"message":{"description":"A human-readable description of the status of this operation.","type":"string"},"metadata":{"description":"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.","properties":{"continue":{"description":"continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.","type":"string"},"resourceVersion":{"description":"String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"selfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"}}},"reason":{"description":"A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.","type":"string"},"status":{"description":"Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status","type":"string"}}}},"required":["pending"]},"labels":{"description":"Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels","type":"object"},"name":{"description":"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"namespace":{"description":"Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces","type":"string"},"ownerReferences":{"description":"List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.","items":{"description":"OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.","properties":{"apiVersion":{"description":"API version of the referent.","type":"string"},"blockOwnerDeletion":{"description":"If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.","type":"boolean"},"controller":{"description":"If true, this reference points to the managing controller.","type":"boolean"},"kind":{"description":"Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"uid":{"description":"UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}},"required":["apiVersion","kind","name","uid"]},"type":"array"},"resourceVersion":{"description":"An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"SelfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"},"uid":{"description":"UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"priorityClassName":{"description":"Priority class assigned to the Pods","type":"string"},"replicas":{"description":"Size is the expected size of the alertmanager cluster. The controller will eventually make the size of the running cluster equal to the expected size.","format":"int32","type":"integer"},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"retention":{"description":"Time duration Alertmanager shall retain data for. Default is '120h', and must match the regular expression `[0-9]+(ms|s|m|h)` (milliseconds seconds minutes hours).","type":"string"},"routePrefix":{"description":"The route prefix Alertmanager registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`.","type":"string"},"secrets":{"description":"Secrets is a list of Secrets in the same namespace as the Alertmanager object, which shall be mounted into the Alertmanager Pods. The Secrets are mounted into /etc/alertmanager/secrets/\u003csecret-name\u003e.","items":{"type":"string"},"type":"array"},"securityContext":{"description":"PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.","properties":{"fsGroup":{"description":"A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----\n\nIf unset, the Kubelet will not modify the ownership and permissions of any volume.","format":"int64","type":"integer"},"runAsGroup":{"description":"The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.","format":"int64","type":"integer"},"runAsNonRoot":{"description":"Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","type":"boolean"},"runAsUser":{"description":"The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.","format":"int64","type":"integer"},"seLinuxOptions":{"description":"SELinuxOptions are the labels to be applied to the container","properties":{"level":{"description":"Level is SELinux level label that applies to the container.","type":"string"},"role":{"description":"Role is a SELinux role label that applies to the container.","type":"string"},"type":{"description":"Type is a SELinux type label that applies to the container.","type":"string"},"user":{"description":"User is a SELinux user label that applies to the container.","type":"string"}}},"supplementalGroups":{"description":"A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.","items":{"format":"int64","type":"integer"},"type":"array"},"sysctls":{"description":"Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch.","items":{"description":"Sysctl defines a kernel parameter to be set","properties":{"name":{"description":"Name of a property to set","type":"string"},"value":{"description":"Value of a property to set","type":"string"}},"required":["name","value"]},"type":"array"}}},"serviceAccountName":{"description":"ServiceAccountName is the name of the ServiceAccount to use to run the Prometheus Pods.","type":"string"},"sha":{"description":"SHA of Alertmanager container image to be deployed. Defaults to the value of `version`. Similar to a tag, but the SHA explicitly deploys an immutable container image. Version and Tag are ignored if SHA is set.","type":"string"},"storage":{"description":"StorageSpec defines the configured storage for a group Prometheus servers. If neither `emptyDir` nor `volumeClaimTemplate` is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used.","properties":{"emptyDir":{"description":"Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.","properties":{"medium":{"description":"What type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir","type":"string"},"sizeLimit":{}}},"volumeClaimTemplate":{"description":"PersistentVolumeClaim is a user's request for and claim to a persistent volume","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"metadata":{"description":"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.","properties":{"annotations":{"description":"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations","type":"object"},"clusterName":{"description":"The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.","type":"string"},"creationTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"deletionGracePeriodSeconds":{"description":"Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.","format":"int64","type":"integer"},"deletionTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"finalizers":{"description":"Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.","items":{"type":"string"},"type":"array"},"generateName":{"description":"GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency","type":"string"},"generation":{"description":"A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.","format":"int64","type":"integer"},"initializers":{"description":"Initializers tracks the progress of initialization.","properties":{"pending":{"description":"Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.","items":{"description":"Initializer is information about an initializer that has not yet completed.","properties":{"name":{"description":"name of the process that is responsible for initializing this object.","type":"string"}},"required":["name"]},"type":"array"},"result":{"description":"Status is a return value for calls that don't return other objects.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"code":{"description":"Suggested HTTP return code for this status, 0 if not set.","format":"int32","type":"integer"},"details":{"description":"StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.","properties":{"causes":{"description":"The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.","items":{"description":"StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.","properties":{"field":{"description":"The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"","type":"string"},"message":{"description":"A human-readable description of the cause of the error. This field may be presented as-is to a reader.","type":"string"},"reason":{"description":"A machine-readable description of the cause of the error. If this value is empty there is no information available.","type":"string"}}},"type":"array"},"group":{"description":"The group attribute of the resource associated with the status StatusReason.","type":"string"},"kind":{"description":"The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).","type":"string"},"retryAfterSeconds":{"description":"If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.","format":"int32","type":"integer"},"uid":{"description":"UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"message":{"description":"A human-readable description of the status of this operation.","type":"string"},"metadata":{"description":"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.","properties":{"continue":{"description":"continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.","type":"string"},"resourceVersion":{"description":"String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"selfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"}}},"reason":{"description":"A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.","type":"string"},"status":{"description":"Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status","type":"string"}}}},"required":["pending"]},"labels":{"description":"Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels","type":"object"},"name":{"description":"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"namespace":{"description":"Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces","type":"string"},"ownerReferences":{"description":"List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.","items":{"description":"OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.","properties":{"apiVersion":{"description":"API version of the referent.","type":"string"},"blockOwnerDeletion":{"description":"If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.","type":"boolean"},"controller":{"description":"If true, this reference points to the managing controller.","type":"boolean"},"kind":{"description":"Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"uid":{"description":"UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}},"required":["apiVersion","kind","name","uid"]},"type":"array"},"resourceVersion":{"description":"An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"SelfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"},"uid":{"description":"UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"spec":{"description":"PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes","properties":{"accessModes":{"description":"AccessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1","items":{"type":"string"},"type":"array"},"dataSource":{"description":"TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.","properties":{"apiGroup":{"description":"APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.","type":"string"},"kind":{"description":"Kind is the type of resource being referenced","type":"string"},"name":{"description":"Name is the name of resource being referenced","type":"string"}},"required":["kind","name"]},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"selector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"storageClassName":{"description":"Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1","type":"string"},"volumeMode":{"description":"volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is an alpha feature and may change in the future.","type":"string"},"volumeName":{"description":"VolumeName is the binding reference to the PersistentVolume backing this claim.","type":"string"}}},"status":{"description":"PersistentVolumeClaimStatus is the current status of a persistent volume claim.","properties":{"accessModes":{"description":"AccessModes contains the actual access modes the volume backing the PVC has. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1","items":{"type":"string"},"type":"array"},"capacity":{"description":"Represents the actual resources of the underlying volume.","type":"object"},"conditions":{"description":"Current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'.","items":{"description":"PersistentVolumeClaimCondition contails details about state of pvc","properties":{"lastProbeTime":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"lastTransitionTime":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"message":{"description":"Human-readable message indicating details about last transition.","type":"string"},"reason":{"description":"Unique, this should be a short, machine understandable string that gives the reason for condition's last transition. If it reports \"ResizeStarted\" that means the underlying persistent volume is being resized.","type":"string"},"status":{"type":"string"},"type":{"type":"string"}},"required":["type","status"]},"type":"array"},"phase":{"description":"Phase represents the current phase of PersistentVolumeClaim.","type":"string"}}}}}}},"tag":{"description":"Tag of Alertmanager container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set.","type":"string"},"tolerations":{"description":"If specified, the pod's tolerations.","items":{"description":"The pod this Toleration is attached to tolerates any taint that matches the triple \u003ckey,value,effect\u003e using the matching operator \u003coperator\u003e.","properties":{"effect":{"description":"Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.","type":"string"},"key":{"description":"Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.","type":"string"},"operator":{"description":"Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.","type":"string"},"tolerationSeconds":{"description":"TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.","format":"int64","type":"integer"},"value":{"description":"Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.","type":"string"}}},"type":"array"},"version":{"description":"Version the cluster should be on.","type":"string"}}},"status":{"description":"AlertmanagerStatus is the most recent observed status of the Alertmanager cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status","properties":{"availableReplicas":{"description":"Total number of available pods (ready for at least minReadySeconds) targeted by this Alertmanager cluster.","format":"int32","type":"integer"},"paused":{"description":"Represents whether any actions on the underlaying managed objects are being performed. Only delete actions will be performed.","type":"boolean"},"replicas":{"description":"Total number of non-terminated pods targeted by this Alertmanager cluster (their labels match the selector).","format":"int32","type":"integer"},"unavailableReplicas":{"description":"Total number of unavailable pods targeted by this Alertmanager cluster.","format":"int32","type":"integer"},"updatedReplicas":{"description":"Total number of non-terminated pods targeted by this Alertmanager cluster that have the desired version spec.","format":"int32","type":"integer"}},"required":["paused","replicas","updatedReplicas","availableReplicas","unavailableReplicas"]}}}},"version":"v1"}} \ No newline at end of file diff --git a/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/prometheus-crd.libsonnet b/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/prometheus-crd.libsonnet index 1733a6066..3e6a83dfd 100644 --- a/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/prometheus-crd.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/prometheus-crd.libsonnet @@ -1 +1 @@ -{"apiVersion":"apiextensions.k8s.io/v1beta1","kind":"CustomResourceDefinition","metadata":{"creationTimestamp":null,"name":"prometheuses.monitoring.coreos.com"},"spec":{"group":"monitoring.coreos.com","names":{"kind":"Prometheus","plural":"prometheuses"},"scope":"Namespaced","validation":{"openAPIV3Schema":{"properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"spec":{"description":"PrometheusSpec is a specification of the desired behavior of the Prometheus cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status","properties":{"additionalAlertManagerConfigs":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"additionalAlertRelabelConfigs":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"additionalScrapeConfigs":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"affinity":{"description":"Affinity is a group of affinity scheduling rules.","properties":{"nodeAffinity":{"description":"Node affinity is a group of node affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.","items":{"description":"An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).","properties":{"preference":{"description":"A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.","properties":{"matchExpressions":{"description":"A list of node selector requirements by node's labels.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchFields":{"description":"A list of node selector requirements by node's fields.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"}}},"weight":{"description":"Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","preference"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.","properties":{"nodeSelectorTerms":{"description":"Required. A list of node selector terms. The terms are ORed.","items":{"description":"A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.","properties":{"matchExpressions":{"description":"A list of node selector requirements by node's labels.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchFields":{"description":"A list of node selector requirements by node's fields.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"}}},"type":"array"}},"required":["nodeSelectorTerms"]}}},"podAffinity":{"description":"Pod affinity is a group of inter pod affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.","items":{"description":"The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)","properties":{"podAffinityTerm":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"weight":{"description":"weight associated with matching the corresponding podAffinityTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","podAffinityTerm"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.","items":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"type":"array"}}},"podAntiAffinity":{"description":"Pod anti affinity is a group of inter pod anti affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.","items":{"description":"The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)","properties":{"podAffinityTerm":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"weight":{"description":"weight associated with matching the corresponding podAffinityTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","podAffinityTerm"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.","items":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"type":"array"}}}}},"alerting":{"description":"AlertingSpec defines parameters for alerting configuration of Prometheus servers.","properties":{"alertmanagers":{"description":"AlertmanagerEndpoints Prometheus should fire alerts against.","items":{"description":"AlertmanagerEndpoints defines a selection of a single Endpoints object containing alertmanager IPs to fire alerts against.","properties":{"bearerTokenFile":{"description":"BearerTokenFile to read from filesystem to use when authenticating to Alertmanager.","type":"string"},"name":{"description":"Name of Endpoints object in Namespace.","type":"string"},"namespace":{"description":"Namespace of Endpoints object.","type":"string"},"pathPrefix":{"description":"Prefix for the HTTP path alerts are pushed to.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use when firing alerts.","type":"string"},"tlsConfig":{"description":"TLSConfig specifies TLS configuration parameters.","properties":{"caFile":{"description":"The CA cert to use for the targets.","type":"string"},"certFile":{"description":"The client cert file for the targets.","type":"string"},"insecureSkipVerify":{"description":"Disable target certificate validation.","type":"boolean"},"keyFile":{"description":"The client key file for the targets.","type":"string"},"serverName":{"description":"Used to verify the hostname for the targets.","type":"string"}}}},"required":["namespace","name","port"]},"type":"array"}},"required":["alertmanagers"]},"apiserverConfig":{"description":"APIServerConfig defines a host and auth methods to access apiserver. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config","properties":{"basicAuth":{"description":"BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints","properties":{"password":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"username":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}},"bearerToken":{"description":"Bearer token for accessing apiserver.","type":"string"},"bearerTokenFile":{"description":"File to read bearer token for accessing apiserver.","type":"string"},"host":{"description":"Host of apiserver. A valid string consisting of a hostname or IP followed by an optional port number","type":"string"},"tlsConfig":{"description":"TLSConfig specifies TLS configuration parameters.","properties":{"caFile":{"description":"The CA cert to use for the targets.","type":"string"},"certFile":{"description":"The client cert file for the targets.","type":"string"},"insecureSkipVerify":{"description":"Disable target certificate validation.","type":"boolean"},"keyFile":{"description":"The client key file for the targets.","type":"string"},"serverName":{"description":"Used to verify the hostname for the targets.","type":"string"}}}},"required":["host"]},"baseImage":{"description":"Base image to use for a Prometheus deployment.","type":"string"},"configMaps":{"description":"ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. The ConfigMaps are mounted into /etc/prometheus/configmaps/\u003cconfigmap-name\u003e.","items":{"type":"string"},"type":"array"},"containers":{"description":"Containers allows injecting additional containers. This is meant to allow adding an authentication proxy to a Prometheus pod.","items":{"description":"A single application container that you want to run within a pod.","properties":{"args":{"description":"Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell","items":{"type":"string"},"type":"array"},"command":{"description":"Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell","items":{"type":"string"},"type":"array"},"env":{"description":"List of environment variables to set in the container. Cannot be updated.","items":{"description":"EnvVar represents an environment variable present in a Container.","properties":{"name":{"description":"Name of the environment variable. Must be a C_IDENTIFIER.","type":"string"},"value":{"description":"Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\".","type":"string"},"valueFrom":{"description":"EnvVarSource represents a source for the value of an EnvVar.","properties":{"configMapKeyRef":{"description":"Selects a key from a ConfigMap.","properties":{"key":{"description":"The key to select.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the ConfigMap or it's key must be defined","type":"boolean"}},"required":["key"]},"fieldRef":{"description":"ObjectFieldSelector selects an APIVersioned field of an object.","properties":{"apiVersion":{"description":"Version of the schema the FieldPath is written in terms of, defaults to \"v1\".","type":"string"},"fieldPath":{"description":"Path of the field to select in the specified API version.","type":"string"}},"required":["fieldPath"]},"resourceFieldRef":{"description":"ResourceFieldSelector represents container resources (cpu, memory) and their output format","properties":{"containerName":{"description":"Container name: required for volumes, optional for env vars","type":"string"},"divisor":{},"resource":{"description":"Required: resource to select","type":"string"}},"required":["resource"]},"secretKeyRef":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}}},"required":["name"]},"type":"array"},"envFrom":{"description":"List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.","items":{"description":"EnvFromSource represents the source of a set of ConfigMaps","properties":{"configMapRef":{"description":"ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the ConfigMap must be defined","type":"boolean"}}},"prefix":{"description":"An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.","type":"string"},"secretRef":{"description":"SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret must be defined","type":"boolean"}}}}},"type":"array"},"image":{"description":"Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.","type":"string"},"imagePullPolicy":{"description":"Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images","type":"string"},"lifecycle":{"description":"Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.","properties":{"postStart":{"description":"Handler defines a specific action that should be taken","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]}}},"preStop":{"description":"Handler defines a specific action that should be taken","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]}}}}},"livenessProbe":{"description":"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"failureThreshold":{"description":"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.","format":"int32","type":"integer"},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"initialDelaySeconds":{"description":"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"},"periodSeconds":{"description":"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.","format":"int32","type":"integer"},"successThreshold":{"description":"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.","format":"int32","type":"integer"},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]},"timeoutSeconds":{"description":"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"}}},"name":{"description":"Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.","type":"string"},"ports":{"description":"List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated.","items":{"description":"ContainerPort represents a network port in a single container.","properties":{"containerPort":{"description":"Number of port to expose on the pod's IP address. This must be a valid port number, 0 \u003c x \u003c 65536.","format":"int32","type":"integer"},"hostIP":{"description":"What host IP to bind the external port to.","type":"string"},"hostPort":{"description":"Number of port to expose on the host. If specified, this must be a valid port number, 0 \u003c x \u003c 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.","format":"int32","type":"integer"},"name":{"description":"If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.","type":"string"},"protocol":{"description":"Protocol for port. Must be UDP, TCP, or SCTP. Defaults to \"TCP\".","type":"string"}},"required":["containerPort"]},"type":"array"},"readinessProbe":{"description":"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"failureThreshold":{"description":"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.","format":"int32","type":"integer"},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"initialDelaySeconds":{"description":"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"},"periodSeconds":{"description":"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.","format":"int32","type":"integer"},"successThreshold":{"description":"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.","format":"int32","type":"integer"},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]},"timeoutSeconds":{"description":"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"}}},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"securityContext":{"description":"SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.","properties":{"allowPrivilegeEscalation":{"description":"AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN","type":"boolean"},"capabilities":{"description":"Adds and removes POSIX capabilities from running containers.","properties":{"add":{"description":"Added capabilities","items":{"type":"string"},"type":"array"},"drop":{"description":"Removed capabilities","items":{"type":"string"},"type":"array"}}},"privileged":{"description":"Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.","type":"boolean"},"procMount":{"description":"procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled.","type":"string"},"readOnlyRootFilesystem":{"description":"Whether this container has a read-only root filesystem. Default is false.","type":"boolean"},"runAsGroup":{"description":"The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","format":"int64","type":"integer"},"runAsNonRoot":{"description":"Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","type":"boolean"},"runAsUser":{"description":"The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","format":"int64","type":"integer"},"seLinuxOptions":{"description":"SELinuxOptions are the labels to be applied to the container","properties":{"level":{"description":"Level is SELinux level label that applies to the container.","type":"string"},"role":{"description":"Role is a SELinux role label that applies to the container.","type":"string"},"type":{"description":"Type is a SELinux type label that applies to the container.","type":"string"},"user":{"description":"User is a SELinux user label that applies to the container.","type":"string"}}}}},"stdin":{"description":"Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.","type":"boolean"},"stdinOnce":{"description":"Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false","type":"boolean"},"terminationMessagePath":{"description":"Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.","type":"string"},"terminationMessagePolicy":{"description":"Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.","type":"string"},"tty":{"description":"Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.","type":"boolean"},"volumeDevices":{"description":"volumeDevices is the list of block devices to be used by the container. This is an alpha feature and may change in the future.","items":{"description":"volumeDevice describes a mapping of a raw block device within a container.","properties":{"devicePath":{"description":"devicePath is the path inside of the container that the device will be mapped to.","type":"string"},"name":{"description":"name must match the name of a persistentVolumeClaim in the pod","type":"string"}},"required":["name","devicePath"]},"type":"array"},"volumeMounts":{"description":"Pod volumes to mount into the container's filesystem. Cannot be updated.","items":{"description":"VolumeMount describes a mounting of a Volume within a container.","properties":{"mountPath":{"description":"Path within the container at which the volume should be mounted. Must not contain ':'.","type":"string"},"mountPropagation":{"description":"mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10.","type":"string"},"name":{"description":"This must match the Name of a Volume.","type":"string"},"readOnly":{"description":"Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.","type":"boolean"},"subPath":{"description":"Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).","type":"string"}},"required":["name","mountPath"]},"type":"array"},"workingDir":{"description":"Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.","type":"string"}},"required":["name"]},"type":"array"},"evaluationInterval":{"description":"Interval between consecutive evaluations.","type":"string"},"externalLabels":{"description":"The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, Alertmanager).","type":"object"},"externalUrl":{"description":"The external URL the Prometheus instances will be available under. This is necessary to generate correct URLs. This is necessary if Prometheus is not served from root of a DNS name.","type":"string"},"imagePullSecrets":{"description":"An optional list of references to secrets in the same namespace to use for pulling prometheus and alertmanager images from registries see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod","items":{"description":"LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"}}},"type":"array"},"listenLocal":{"description":"ListenLocal makes the Prometheus server listen on loopback, so that it does not bind against the Pod IP.","type":"boolean"},"logLevel":{"description":"Log level for Prometheus to be configured with.","type":"string"},"nodeSelector":{"description":"Define which Nodes the Pods are scheduled on.","type":"object"},"paused":{"description":"When a Prometheus deployment is paused, no actions except for deletion will be performed on the underlying objects.","type":"boolean"},"podMetadata":{"description":"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.","properties":{"annotations":{"description":"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations","type":"object"},"clusterName":{"description":"The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.","type":"string"},"creationTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"deletionGracePeriodSeconds":{"description":"Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.","format":"int64","type":"integer"},"deletionTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"finalizers":{"description":"Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.","items":{"type":"string"},"type":"array"},"generateName":{"description":"GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency","type":"string"},"generation":{"description":"A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.","format":"int64","type":"integer"},"initializers":{"description":"Initializers tracks the progress of initialization.","properties":{"pending":{"description":"Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.","items":{"description":"Initializer is information about an initializer that has not yet completed.","properties":{"name":{"description":"name of the process that is responsible for initializing this object.","type":"string"}},"required":["name"]},"type":"array"},"result":{"description":"Status is a return value for calls that don't return other objects.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"code":{"description":"Suggested HTTP return code for this status, 0 if not set.","format":"int32","type":"integer"},"details":{"description":"StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.","properties":{"causes":{"description":"The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.","items":{"description":"StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.","properties":{"field":{"description":"The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"","type":"string"},"message":{"description":"A human-readable description of the cause of the error. This field may be presented as-is to a reader.","type":"string"},"reason":{"description":"A machine-readable description of the cause of the error. If this value is empty there is no information available.","type":"string"}}},"type":"array"},"group":{"description":"The group attribute of the resource associated with the status StatusReason.","type":"string"},"kind":{"description":"The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).","type":"string"},"retryAfterSeconds":{"description":"If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.","format":"int32","type":"integer"},"uid":{"description":"UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"message":{"description":"A human-readable description of the status of this operation.","type":"string"},"metadata":{"description":"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.","properties":{"continue":{"description":"continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.","type":"string"},"resourceVersion":{"description":"String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"selfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"}}},"reason":{"description":"A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.","type":"string"},"status":{"description":"Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status","type":"string"}}}},"required":["pending"]},"labels":{"description":"Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels","type":"object"},"name":{"description":"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"namespace":{"description":"Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces","type":"string"},"ownerReferences":{"description":"List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.","items":{"description":"OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.","properties":{"apiVersion":{"description":"API version of the referent.","type":"string"},"blockOwnerDeletion":{"description":"If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.","type":"boolean"},"controller":{"description":"If true, this reference points to the managing controller.","type":"boolean"},"kind":{"description":"Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"uid":{"description":"UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}},"required":["apiVersion","kind","name","uid"]},"type":"array"},"resourceVersion":{"description":"An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"SelfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"},"uid":{"description":"UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"priorityClassName":{"description":"Priority class assigned to the Pods","type":"string"},"remoteRead":{"description":"If specified, the remote_read spec. This is an experimental feature, it may change in any upcoming release in a breaking way.","items":{"description":"RemoteReadSpec defines the remote_read configuration for prometheus.","properties":{"basicAuth":{"description":"BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints","properties":{"password":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"username":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}},"bearerToken":{"description":"bearer token for remote read.","type":"string"},"bearerTokenFile":{"description":"File to read bearer token for remote read.","type":"string"},"proxyUrl":{"description":"Optional ProxyURL","type":"string"},"readRecent":{"description":"Whether reads should be made for queries for time ranges that the local storage should have complete data for.","type":"boolean"},"remoteTimeout":{"description":"Timeout for requests to the remote read endpoint.","type":"string"},"requiredMatchers":{"description":"An optional list of equality matchers which have to be present in a selector to query the remote read endpoint.","type":"object"},"tlsConfig":{"description":"TLSConfig specifies TLS configuration parameters.","properties":{"caFile":{"description":"The CA cert to use for the targets.","type":"string"},"certFile":{"description":"The client cert file for the targets.","type":"string"},"insecureSkipVerify":{"description":"Disable target certificate validation.","type":"boolean"},"keyFile":{"description":"The client key file for the targets.","type":"string"},"serverName":{"description":"Used to verify the hostname for the targets.","type":"string"}}},"url":{"description":"The URL of the endpoint to send samples to.","type":"string"}},"required":["url"]},"type":"array"},"remoteWrite":{"description":"If specified, the remote_write spec. This is an experimental feature, it may change in any upcoming release in a breaking way.","items":{"description":"RemoteWriteSpec defines the remote_write configuration for prometheus.","properties":{"basicAuth":{"description":"BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints","properties":{"password":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"username":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}},"bearerToken":{"description":"File to read bearer token for remote write.","type":"string"},"bearerTokenFile":{"description":"File to read bearer token for remote write.","type":"string"},"proxyUrl":{"description":"Optional ProxyURL","type":"string"},"queueConfig":{"description":"QueueConfig allows the tuning of remote_write queue_config parameters. This object is referenced in the RemoteWriteSpec object.","properties":{"batchSendDeadline":{"description":"BatchSendDeadline is the maximum time a sample will wait in buffer.","type":"string"},"capacity":{"description":"Capacity is the number of samples to buffer per shard before we start dropping them.","format":"int32","type":"integer"},"maxBackoff":{"description":"MaxBackoff is the maximum retry delay.","type":"string"},"maxRetries":{"description":"MaxRetries is the maximum number of times to retry a batch on recoverable errors.","format":"int32","type":"integer"},"maxSamplesPerSend":{"description":"MaxSamplesPerSend is the maximum number of samples per send.","format":"int32","type":"integer"},"maxShards":{"description":"MaxShards is the maximum number of shards, i.e. amount of concurrency.","format":"int32","type":"integer"},"minBackoff":{"description":"MinBackoff is the initial retry delay. Gets doubled for every retry.","type":"string"}}},"remoteTimeout":{"description":"Timeout for requests to the remote write endpoint.","type":"string"},"tlsConfig":{"description":"TLSConfig specifies TLS configuration parameters.","properties":{"caFile":{"description":"The CA cert to use for the targets.","type":"string"},"certFile":{"description":"The client cert file for the targets.","type":"string"},"insecureSkipVerify":{"description":"Disable target certificate validation.","type":"boolean"},"keyFile":{"description":"The client key file for the targets.","type":"string"},"serverName":{"description":"Used to verify the hostname for the targets.","type":"string"}}},"url":{"description":"The URL of the endpoint to send samples to.","type":"string"},"writeRelabelConfigs":{"description":"The list of remote write relabel configurations.","items":{"description":"RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. It defines `\u003cmetric_relabel_configs\u003e`-section of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs","properties":{"action":{"description":"Action to perform based on regex matching. Default is 'replace'","type":"string"},"modulus":{"description":"Modulus to take of the hash of the source label values.","format":"int64","type":"integer"},"regex":{"description":"Regular expression against which the extracted value is matched. defailt is '(.*)'","type":"string"},"replacement":{"description":"Replacement value against which a regex replace is performed if the regular expression matches. Regex capture groups are available. Default is '$1'","type":"string"},"separator":{"description":"Separator placed between concatenated source label values. default is ';'.","type":"string"},"sourceLabels":{"description":"The source labels select values from existing labels. Their content is concatenated using the configured separator and matched against the configured regular expression for the replace, keep, and drop actions.","items":{"type":"string"},"type":"array"},"targetLabel":{"description":"Label to which the resulting value is written in a replace action. It is mandatory for replace actions. Regex capture groups are available.","type":"string"}}},"type":"array"}},"required":["url"]},"type":"array"},"replicas":{"description":"Number of instances to deploy for a Prometheus deployment.","format":"int32","type":"integer"},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"retention":{"description":"Time duration Prometheus shall retain data for. Default is '24h', and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years).","type":"string"},"routePrefix":{"description":"The route prefix Prometheus registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`.","type":"string"},"ruleNamespaceSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"ruleSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"scrapeInterval":{"description":"Interval between consecutive scrapes.","type":"string"},"secrets":{"description":"Secrets is a list of Secrets in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. The Secrets are mounted into /etc/prometheus/secrets/\u003csecret-name\u003e.","items":{"type":"string"},"type":"array"},"securityContext":{"description":"PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.","properties":{"fsGroup":{"description":"A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----\n\nIf unset, the Kubelet will not modify the ownership and permissions of any volume.","format":"int64","type":"integer"},"runAsGroup":{"description":"The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.","format":"int64","type":"integer"},"runAsNonRoot":{"description":"Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","type":"boolean"},"runAsUser":{"description":"The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.","format":"int64","type":"integer"},"seLinuxOptions":{"description":"SELinuxOptions are the labels to be applied to the container","properties":{"level":{"description":"Level is SELinux level label that applies to the container.","type":"string"},"role":{"description":"Role is a SELinux role label that applies to the container.","type":"string"},"type":{"description":"Type is a SELinux type label that applies to the container.","type":"string"},"user":{"description":"User is a SELinux user label that applies to the container.","type":"string"}}},"supplementalGroups":{"description":"A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.","items":{"format":"int64","type":"integer"},"type":"array"},"sysctls":{"description":"Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch.","items":{"description":"Sysctl defines a kernel parameter to be set","properties":{"name":{"description":"Name of a property to set","type":"string"},"value":{"description":"Value of a property to set","type":"string"}},"required":["name","value"]},"type":"array"}}},"serviceAccountName":{"description":"ServiceAccountName is the name of the ServiceAccount to use to run the Prometheus Pods.","type":"string"},"serviceMonitorNamespaceSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"serviceMonitorSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"sha":{"description":"SHA of Prometheus container image to be deployed. Defaults to the value of `version`. Similar to a tag, but the SHA explicitly deploys an immutable container image. Version and Tag are ignored if SHA is set.","type":"string"},"storage":{"description":"StorageSpec defines the configured storage for a group Prometheus servers. If neither `emptyDir` nor `volumeClaimTemplate` is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used.","properties":{"class":{"description":"Name of the StorageClass to use when requesting storage provisioning. More info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses (DEPRECATED - instead use `volumeClaimTemplate.spec.storageClassName`)","type":"string"},"emptyDir":{"description":"Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.","properties":{"medium":{"description":"What type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir","type":"string"},"sizeLimit":{}}},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"selector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"volumeClaimTemplate":{"description":"PersistentVolumeClaim is a user's request for and claim to a persistent volume","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"metadata":{"description":"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.","properties":{"annotations":{"description":"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations","type":"object"},"clusterName":{"description":"The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.","type":"string"},"creationTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"deletionGracePeriodSeconds":{"description":"Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.","format":"int64","type":"integer"},"deletionTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"finalizers":{"description":"Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.","items":{"type":"string"},"type":"array"},"generateName":{"description":"GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency","type":"string"},"generation":{"description":"A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.","format":"int64","type":"integer"},"initializers":{"description":"Initializers tracks the progress of initialization.","properties":{"pending":{"description":"Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.","items":{"description":"Initializer is information about an initializer that has not yet completed.","properties":{"name":{"description":"name of the process that is responsible for initializing this object.","type":"string"}},"required":["name"]},"type":"array"},"result":{"description":"Status is a return value for calls that don't return other objects.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"code":{"description":"Suggested HTTP return code for this status, 0 if not set.","format":"int32","type":"integer"},"details":{"description":"StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.","properties":{"causes":{"description":"The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.","items":{"description":"StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.","properties":{"field":{"description":"The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"","type":"string"},"message":{"description":"A human-readable description of the cause of the error. This field may be presented as-is to a reader.","type":"string"},"reason":{"description":"A machine-readable description of the cause of the error. If this value is empty there is no information available.","type":"string"}}},"type":"array"},"group":{"description":"The group attribute of the resource associated with the status StatusReason.","type":"string"},"kind":{"description":"The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).","type":"string"},"retryAfterSeconds":{"description":"If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.","format":"int32","type":"integer"},"uid":{"description":"UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"message":{"description":"A human-readable description of the status of this operation.","type":"string"},"metadata":{"description":"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.","properties":{"continue":{"description":"continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.","type":"string"},"resourceVersion":{"description":"String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"selfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"}}},"reason":{"description":"A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.","type":"string"},"status":{"description":"Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status","type":"string"}}}},"required":["pending"]},"labels":{"description":"Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels","type":"object"},"name":{"description":"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"namespace":{"description":"Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces","type":"string"},"ownerReferences":{"description":"List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.","items":{"description":"OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.","properties":{"apiVersion":{"description":"API version of the referent.","type":"string"},"blockOwnerDeletion":{"description":"If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.","type":"boolean"},"controller":{"description":"If true, this reference points to the managing controller.","type":"boolean"},"kind":{"description":"Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"uid":{"description":"UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}},"required":["apiVersion","kind","name","uid"]},"type":"array"},"resourceVersion":{"description":"An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"SelfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"},"uid":{"description":"UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"spec":{"description":"PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes","properties":{"accessModes":{"description":"AccessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1","items":{"type":"string"},"type":"array"},"dataSource":{"description":"TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.","properties":{"apiGroup":{"description":"APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.","type":"string"},"kind":{"description":"Kind is the type of resource being referenced","type":"string"},"name":{"description":"Name is the name of resource being referenced","type":"string"}},"required":["kind","name"]},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"selector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"storageClassName":{"description":"Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1","type":"string"},"volumeMode":{"description":"volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is an alpha feature and may change in the future.","type":"string"},"volumeName":{"description":"VolumeName is the binding reference to the PersistentVolume backing this claim.","type":"string"}}},"status":{"description":"PersistentVolumeClaimStatus is the current status of a persistent volume claim.","properties":{"accessModes":{"description":"AccessModes contains the actual access modes the volume backing the PVC has. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1","items":{"type":"string"},"type":"array"},"capacity":{"description":"Represents the actual resources of the underlying volume.","type":"object"},"conditions":{"description":"Current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'.","items":{"description":"PersistentVolumeClaimCondition contails details about state of pvc","properties":{"lastProbeTime":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"lastTransitionTime":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"message":{"description":"Human-readable message indicating details about last transition.","type":"string"},"reason":{"description":"Unique, this should be a short, machine understandable string that gives the reason for condition's last transition. If it reports \"ResizeStarted\" that means the underlying persistent volume is being resized.","type":"string"},"status":{"type":"string"},"type":{"type":"string"}},"required":["type","status"]},"type":"array"},"phase":{"description":"Phase represents the current phase of PersistentVolumeClaim.","type":"string"}}}}}}},"tag":{"description":"Tag of Prometheus container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set.","type":"string"},"thanos":{"description":"ThanosSpec defines parameters for a Prometheus server within a Thanos deployment.","properties":{"baseImage":{"description":"Thanos base image if other than default.","type":"string"},"gcs":{"description":"ThanosGCSSpec defines parameters for use of Google Cloud Storage (GCS) with Thanos.","properties":{"bucket":{"description":"Google Cloud Storage bucket name for stored blocks. If empty it won't store any block inside Google Cloud Storage.","type":"string"},"credentials":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}},"peers":{"description":"Peers is a DNS name for Thanos to discover peers through.","type":"string"},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"s3":{"description":"ThanosS3Spec defines parameters for of AWS Simple Storage Service (S3) with Thanos. (S3 compatible services apply as well)","properties":{"accessKey":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"bucket":{"description":"S3-Compatible API bucket name for stored blocks.","type":"string"},"encryptsse":{"description":"Whether to use Server Side Encryption","type":"boolean"},"endpoint":{"description":"S3-Compatible API endpoint for stored blocks.","type":"string"},"insecure":{"description":"Whether to use an insecure connection with an S3-Compatible API.","type":"boolean"},"secretKey":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"signatureVersion2":{"description":"Whether to use S3 Signature Version 2; otherwise Signature Version 4 will be used.","type":"boolean"}}},"sha":{"description":"SHA of Thanos container image to be deployed. Defaults to the value of `version`. Similar to a tag, but the SHA explicitly deploys an immutable container image. Version and Tag are ignored if SHA is set.","type":"string"},"tag":{"description":"Tag of Thanos sidecar container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set.","type":"string"},"version":{"description":"Version describes the version of Thanos to use.","type":"string"}}},"tolerations":{"description":"If specified, the pod's tolerations.","items":{"description":"The pod this Toleration is attached to tolerates any taint that matches the triple \u003ckey,value,effect\u003e using the matching operator \u003coperator\u003e.","properties":{"effect":{"description":"Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.","type":"string"},"key":{"description":"Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.","type":"string"},"operator":{"description":"Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.","type":"string"},"tolerationSeconds":{"description":"TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.","format":"int64","type":"integer"},"value":{"description":"Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.","type":"string"}}},"type":"array"},"version":{"description":"Version of Prometheus to be deployed.","type":"string"}}},"status":{"description":"PrometheusStatus is the most recent observed status of the Prometheus cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status","properties":{"availableReplicas":{"description":"Total number of available pods (ready for at least minReadySeconds) targeted by this Prometheus deployment.","format":"int32","type":"integer"},"paused":{"description":"Represents whether any actions on the underlaying managed objects are being performed. Only delete actions will be performed.","type":"boolean"},"replicas":{"description":"Total number of non-terminated pods targeted by this Prometheus deployment (their labels match the selector).","format":"int32","type":"integer"},"unavailableReplicas":{"description":"Total number of unavailable pods targeted by this Prometheus deployment.","format":"int32","type":"integer"},"updatedReplicas":{"description":"Total number of non-terminated pods targeted by this Prometheus deployment that have the desired version spec.","format":"int32","type":"integer"}},"required":["paused","replicas","updatedReplicas","availableReplicas","unavailableReplicas"]}}}},"version":"v1"}} \ No newline at end of file +{"apiVersion":"apiextensions.k8s.io/v1beta1","kind":"CustomResourceDefinition","metadata":{"creationTimestamp":null,"name":"prometheuses.monitoring.coreos.com"},"spec":{"group":"monitoring.coreos.com","names":{"kind":"Prometheus","plural":"prometheuses"},"scope":"Namespaced","validation":{"openAPIV3Schema":{"properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"spec":{"description":"PrometheusSpec is a specification of the desired behavior of the Prometheus cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status","properties":{"additionalAlertManagerConfigs":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"additionalAlertRelabelConfigs":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"additionalScrapeConfigs":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"affinity":{"description":"Affinity is a group of affinity scheduling rules.","properties":{"nodeAffinity":{"description":"Node affinity is a group of node affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node matches the corresponding matchExpressions; the node(s) with the highest sum are the most preferred.","items":{"description":"An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).","properties":{"preference":{"description":"A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.","properties":{"matchExpressions":{"description":"A list of node selector requirements by node's labels.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchFields":{"description":"A list of node selector requirements by node's fields.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"}}},"weight":{"description":"Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","preference"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.","properties":{"nodeSelectorTerms":{"description":"Required. A list of node selector terms. The terms are ORed.","items":{"description":"A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.","properties":{"matchExpressions":{"description":"A list of node selector requirements by node's labels.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchFields":{"description":"A list of node selector requirements by node's fields.","items":{"description":"A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"The label key that the selector applies to.","type":"string"},"operator":{"description":"Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.","type":"string"},"values":{"description":"An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"}}},"type":"array"}},"required":["nodeSelectorTerms"]}}},"podAffinity":{"description":"Pod affinity is a group of inter pod affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.","items":{"description":"The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)","properties":{"podAffinityTerm":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"weight":{"description":"weight associated with matching the corresponding podAffinityTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","podAffinityTerm"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"If the affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.","items":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"type":"array"}}},"podAntiAffinity":{"description":"Pod anti affinity is a group of inter pod anti affinity scheduling rules.","properties":{"preferredDuringSchedulingIgnoredDuringExecution":{"description":"The scheduler will prefer to schedule pods to nodes that satisfy the anti-affinity expressions specified by this field, but it may choose a node that violates one or more of the expressions. The node that is most preferred is the one with the greatest sum of weights, i.e. for each node that meets all of the scheduling requirements (resource request, requiredDuringScheduling anti-affinity expressions, etc.), compute a sum by iterating through the elements of this field and adding \"weight\" to the sum if the node has pods which matches the corresponding podAffinityTerm; the node(s) with the highest sum are the most preferred.","items":{"description":"The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s)","properties":{"podAffinityTerm":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"weight":{"description":"weight associated with matching the corresponding podAffinityTerm, in the range 1-100.","format":"int32","type":"integer"}},"required":["weight","podAffinityTerm"]},"type":"array"},"requiredDuringSchedulingIgnoredDuringExecution":{"description":"If the anti-affinity requirements specified by this field are not met at scheduling time, the pod will not be scheduled onto the node. If the anti-affinity requirements specified by this field cease to be met at some point during pod execution (e.g. due to a pod label update), the system may or may not try to eventually evict the pod from its node. When there are multiple elements, the lists of nodes corresponding to each podAffinityTerm are intersected, i.e. all terms must be satisfied.","items":{"description":"Defines a set of pods (namely those matching the labelSelector relative to the given namespace(s)) that this pod should be co-located (affinity) or not co-located (anti-affinity) with, where co-located is defined as running on a node whose value of the label with key \u003ctopologyKey\u003e matches that of any node on which a pod of the set of pods is running","properties":{"labelSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"namespaces":{"description":"namespaces specifies which namespaces the labelSelector applies to (matches against); null or empty list means \"this pod's namespace\"","items":{"type":"string"},"type":"array"},"topologyKey":{"description":"This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed.","type":"string"}},"required":["topologyKey"]},"type":"array"}}}}},"alerting":{"description":"AlertingSpec defines parameters for alerting configuration of Prometheus servers.","properties":{"alertmanagers":{"description":"AlertmanagerEndpoints Prometheus should fire alerts against.","items":{"description":"AlertmanagerEndpoints defines a selection of a single Endpoints object containing alertmanager IPs to fire alerts against.","properties":{"bearerTokenFile":{"description":"BearerTokenFile to read from filesystem to use when authenticating to Alertmanager.","type":"string"},"name":{"description":"Name of Endpoints object in Namespace.","type":"string"},"namespace":{"description":"Namespace of Endpoints object.","type":"string"},"pathPrefix":{"description":"Prefix for the HTTP path alerts are pushed to.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use when firing alerts.","type":"string"},"tlsConfig":{"description":"TLSConfig specifies TLS configuration parameters.","properties":{"caFile":{"description":"The CA cert to use for the targets.","type":"string"},"certFile":{"description":"The client cert file for the targets.","type":"string"},"insecureSkipVerify":{"description":"Disable target certificate validation.","type":"boolean"},"keyFile":{"description":"The client key file for the targets.","type":"string"},"serverName":{"description":"Used to verify the hostname for the targets.","type":"string"}}}},"required":["namespace","name","port"]},"type":"array"}},"required":["alertmanagers"]},"apiserverConfig":{"description":"APIServerConfig defines a host and auth methods to access apiserver. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config","properties":{"basicAuth":{"description":"BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints","properties":{"password":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"username":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}},"bearerToken":{"description":"Bearer token for accessing apiserver.","type":"string"},"bearerTokenFile":{"description":"File to read bearer token for accessing apiserver.","type":"string"},"host":{"description":"Host of apiserver. A valid string consisting of a hostname or IP followed by an optional port number","type":"string"},"tlsConfig":{"description":"TLSConfig specifies TLS configuration parameters.","properties":{"caFile":{"description":"The CA cert to use for the targets.","type":"string"},"certFile":{"description":"The client cert file for the targets.","type":"string"},"insecureSkipVerify":{"description":"Disable target certificate validation.","type":"boolean"},"keyFile":{"description":"The client key file for the targets.","type":"string"},"serverName":{"description":"Used to verify the hostname for the targets.","type":"string"}}}},"required":["host"]},"baseImage":{"description":"Base image to use for a Prometheus deployment.","type":"string"},"configMaps":{"description":"ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. The ConfigMaps are mounted into /etc/prometheus/configmaps/\u003cconfigmap-name\u003e.","items":{"type":"string"},"type":"array"},"containers":{"description":"Containers allows injecting additional containers. This is meant to allow adding an authentication proxy to a Prometheus pod.","items":{"description":"A single application container that you want to run within a pod.","properties":{"args":{"description":"Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell","items":{"type":"string"},"type":"array"},"command":{"description":"Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell","items":{"type":"string"},"type":"array"},"env":{"description":"List of environment variables to set in the container. Cannot be updated.","items":{"description":"EnvVar represents an environment variable present in a Container.","properties":{"name":{"description":"Name of the environment variable. Must be a C_IDENTIFIER.","type":"string"},"value":{"description":"Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\".","type":"string"},"valueFrom":{"description":"EnvVarSource represents a source for the value of an EnvVar.","properties":{"configMapKeyRef":{"description":"Selects a key from a ConfigMap.","properties":{"key":{"description":"The key to select.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the ConfigMap or it's key must be defined","type":"boolean"}},"required":["key"]},"fieldRef":{"description":"ObjectFieldSelector selects an APIVersioned field of an object.","properties":{"apiVersion":{"description":"Version of the schema the FieldPath is written in terms of, defaults to \"v1\".","type":"string"},"fieldPath":{"description":"Path of the field to select in the specified API version.","type":"string"}},"required":["fieldPath"]},"resourceFieldRef":{"description":"ResourceFieldSelector represents container resources (cpu, memory) and their output format","properties":{"containerName":{"description":"Container name: required for volumes, optional for env vars","type":"string"},"divisor":{},"resource":{"description":"Required: resource to select","type":"string"}},"required":["resource"]},"secretKeyRef":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}}},"required":["name"]},"type":"array"},"envFrom":{"description":"List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.","items":{"description":"EnvFromSource represents the source of a set of ConfigMaps","properties":{"configMapRef":{"description":"ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the ConfigMap must be defined","type":"boolean"}}},"prefix":{"description":"An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.","type":"string"},"secretRef":{"description":"SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret must be defined","type":"boolean"}}}}},"type":"array"},"image":{"description":"Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.","type":"string"},"imagePullPolicy":{"description":"Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images","type":"string"},"lifecycle":{"description":"Lifecycle describes actions that the management system should take in response to container lifecycle events. For the PostStart and PreStop lifecycle handlers, management of the container blocks until the action is complete, unless the container process fails, in which case the handler is aborted.","properties":{"postStart":{"description":"Handler defines a specific action that should be taken","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]}}},"preStop":{"description":"Handler defines a specific action that should be taken","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]}}}}},"livenessProbe":{"description":"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"failureThreshold":{"description":"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.","format":"int32","type":"integer"},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"initialDelaySeconds":{"description":"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"},"periodSeconds":{"description":"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.","format":"int32","type":"integer"},"successThreshold":{"description":"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.","format":"int32","type":"integer"},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]},"timeoutSeconds":{"description":"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"}}},"name":{"description":"Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.","type":"string"},"ports":{"description":"List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default \"0.0.0.0\" address inside a container will be accessible from the network. Cannot be updated.","items":{"description":"ContainerPort represents a network port in a single container.","properties":{"containerPort":{"description":"Number of port to expose on the pod's IP address. This must be a valid port number, 0 \u003c x \u003c 65536.","format":"int32","type":"integer"},"hostIP":{"description":"What host IP to bind the external port to.","type":"string"},"hostPort":{"description":"Number of port to expose on the host. If specified, this must be a valid port number, 0 \u003c x \u003c 65536. If HostNetwork is specified, this must match ContainerPort. Most containers do not need this.","format":"int32","type":"integer"},"name":{"description":"If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.","type":"string"},"protocol":{"description":"Protocol for port. Must be UDP, TCP, or SCTP. Defaults to \"TCP\".","type":"string"}},"required":["containerPort"]},"type":"array"},"readinessProbe":{"description":"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.","properties":{"exec":{"description":"ExecAction describes a \"run in container\" action.","properties":{"command":{"description":"Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.","items":{"type":"string"},"type":"array"}}},"failureThreshold":{"description":"Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.","format":"int32","type":"integer"},"httpGet":{"description":"HTTPGetAction describes an action based on HTTP Get requests.","properties":{"host":{"description":"Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.","type":"string"},"httpHeaders":{"description":"Custom headers to set in the request. HTTP allows repeated headers.","items":{"description":"HTTPHeader describes a custom header to be used in HTTP probes","properties":{"name":{"description":"The header field name","type":"string"},"value":{"description":"The header field value","type":"string"}},"required":["name","value"]},"type":"array"},"path":{"description":"Path to access on the HTTP server.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]},"scheme":{"description":"Scheme to use for connecting to the host. Defaults to HTTP.","type":"string"}},"required":["port"]},"initialDelaySeconds":{"description":"Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"},"periodSeconds":{"description":"How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.","format":"int32","type":"integer"},"successThreshold":{"description":"Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness. Minimum value is 1.","format":"int32","type":"integer"},"tcpSocket":{"description":"TCPSocketAction describes an action based on opening a socket","properties":{"host":{"description":"Optional: Host name to connect to, defaults to the pod IP.","type":"string"},"port":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"required":["port"]},"timeoutSeconds":{"description":"Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes","format":"int32","type":"integer"}}},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"securityContext":{"description":"SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.","properties":{"allowPrivilegeEscalation":{"description":"AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN","type":"boolean"},"capabilities":{"description":"Adds and removes POSIX capabilities from running containers.","properties":{"add":{"description":"Added capabilities","items":{"type":"string"},"type":"array"},"drop":{"description":"Removed capabilities","items":{"type":"string"},"type":"array"}}},"privileged":{"description":"Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.","type":"boolean"},"procMount":{"description":"procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled.","type":"string"},"readOnlyRootFilesystem":{"description":"Whether this container has a read-only root filesystem. Default is false.","type":"boolean"},"runAsGroup":{"description":"The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","format":"int64","type":"integer"},"runAsNonRoot":{"description":"Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","type":"boolean"},"runAsUser":{"description":"The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","format":"int64","type":"integer"},"seLinuxOptions":{"description":"SELinuxOptions are the labels to be applied to the container","properties":{"level":{"description":"Level is SELinux level label that applies to the container.","type":"string"},"role":{"description":"Role is a SELinux role label that applies to the container.","type":"string"},"type":{"description":"Type is a SELinux type label that applies to the container.","type":"string"},"user":{"description":"User is a SELinux user label that applies to the container.","type":"string"}}}}},"stdin":{"description":"Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.","type":"boolean"},"stdinOnce":{"description":"Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false","type":"boolean"},"terminationMessagePath":{"description":"Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.","type":"string"},"terminationMessagePolicy":{"description":"Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.","type":"string"},"tty":{"description":"Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.","type":"boolean"},"volumeDevices":{"description":"volumeDevices is the list of block devices to be used by the container. This is an alpha feature and may change in the future.","items":{"description":"volumeDevice describes a mapping of a raw block device within a container.","properties":{"devicePath":{"description":"devicePath is the path inside of the container that the device will be mapped to.","type":"string"},"name":{"description":"name must match the name of a persistentVolumeClaim in the pod","type":"string"}},"required":["name","devicePath"]},"type":"array"},"volumeMounts":{"description":"Pod volumes to mount into the container's filesystem. Cannot be updated.","items":{"description":"VolumeMount describes a mounting of a Volume within a container.","properties":{"mountPath":{"description":"Path within the container at which the volume should be mounted. Must not contain ':'.","type":"string"},"mountPropagation":{"description":"mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10.","type":"string"},"name":{"description":"This must match the Name of a Volume.","type":"string"},"readOnly":{"description":"Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.","type":"boolean"},"subPath":{"description":"Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).","type":"string"}},"required":["name","mountPath"]},"type":"array"},"workingDir":{"description":"Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.","type":"string"}},"required":["name"]},"type":"array"},"evaluationInterval":{"description":"Interval between consecutive evaluations.","type":"string"},"externalLabels":{"description":"The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, Alertmanager).","type":"object"},"externalUrl":{"description":"The external URL the Prometheus instances will be available under. This is necessary to generate correct URLs. This is necessary if Prometheus is not served from root of a DNS name.","type":"string"},"imagePullSecrets":{"description":"An optional list of references to secrets in the same namespace to use for pulling prometheus and alertmanager images from registries see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod","items":{"description":"LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.","properties":{"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"}}},"type":"array"},"listenLocal":{"description":"ListenLocal makes the Prometheus server listen on loopback, so that it does not bind against the Pod IP.","type":"boolean"},"logLevel":{"description":"Log level for Prometheus to be configured with.","type":"string"},"nodeSelector":{"description":"Define which Nodes the Pods are scheduled on.","type":"object"},"paused":{"description":"When a Prometheus deployment is paused, no actions except for deletion will be performed on the underlying objects.","type":"boolean"},"podMetadata":{"description":"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.","properties":{"annotations":{"description":"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations","type":"object"},"clusterName":{"description":"The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.","type":"string"},"creationTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"deletionGracePeriodSeconds":{"description":"Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.","format":"int64","type":"integer"},"deletionTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"finalizers":{"description":"Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.","items":{"type":"string"},"type":"array"},"generateName":{"description":"GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency","type":"string"},"generation":{"description":"A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.","format":"int64","type":"integer"},"initializers":{"description":"Initializers tracks the progress of initialization.","properties":{"pending":{"description":"Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.","items":{"description":"Initializer is information about an initializer that has not yet completed.","properties":{"name":{"description":"name of the process that is responsible for initializing this object.","type":"string"}},"required":["name"]},"type":"array"},"result":{"description":"Status is a return value for calls that don't return other objects.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"code":{"description":"Suggested HTTP return code for this status, 0 if not set.","format":"int32","type":"integer"},"details":{"description":"StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.","properties":{"causes":{"description":"The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.","items":{"description":"StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.","properties":{"field":{"description":"The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"","type":"string"},"message":{"description":"A human-readable description of the cause of the error. This field may be presented as-is to a reader.","type":"string"},"reason":{"description":"A machine-readable description of the cause of the error. If this value is empty there is no information available.","type":"string"}}},"type":"array"},"group":{"description":"The group attribute of the resource associated with the status StatusReason.","type":"string"},"kind":{"description":"The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).","type":"string"},"retryAfterSeconds":{"description":"If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.","format":"int32","type":"integer"},"uid":{"description":"UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"message":{"description":"A human-readable description of the status of this operation.","type":"string"},"metadata":{"description":"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.","properties":{"continue":{"description":"continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.","type":"string"},"resourceVersion":{"description":"String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"selfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"}}},"reason":{"description":"A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.","type":"string"},"status":{"description":"Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status","type":"string"}}}},"required":["pending"]},"labels":{"description":"Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels","type":"object"},"name":{"description":"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"namespace":{"description":"Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces","type":"string"},"ownerReferences":{"description":"List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.","items":{"description":"OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.","properties":{"apiVersion":{"description":"API version of the referent.","type":"string"},"blockOwnerDeletion":{"description":"If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.","type":"boolean"},"controller":{"description":"If true, this reference points to the managing controller.","type":"boolean"},"kind":{"description":"Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"uid":{"description":"UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}},"required":["apiVersion","kind","name","uid"]},"type":"array"},"resourceVersion":{"description":"An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"SelfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"},"uid":{"description":"UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"priorityClassName":{"description":"Priority class assigned to the Pods","type":"string"},"remoteRead":{"description":"If specified, the remote_read spec. This is an experimental feature, it may change in any upcoming release in a breaking way.","items":{"description":"RemoteReadSpec defines the remote_read configuration for prometheus.","properties":{"basicAuth":{"description":"BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints","properties":{"password":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"username":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}},"bearerToken":{"description":"bearer token for remote read.","type":"string"},"bearerTokenFile":{"description":"File to read bearer token for remote read.","type":"string"},"proxyUrl":{"description":"Optional ProxyURL","type":"string"},"readRecent":{"description":"Whether reads should be made for queries for time ranges that the local storage should have complete data for.","type":"boolean"},"remoteTimeout":{"description":"Timeout for requests to the remote read endpoint.","type":"string"},"requiredMatchers":{"description":"An optional list of equality matchers which have to be present in a selector to query the remote read endpoint.","type":"object"},"tlsConfig":{"description":"TLSConfig specifies TLS configuration parameters.","properties":{"caFile":{"description":"The CA cert to use for the targets.","type":"string"},"certFile":{"description":"The client cert file for the targets.","type":"string"},"insecureSkipVerify":{"description":"Disable target certificate validation.","type":"boolean"},"keyFile":{"description":"The client key file for the targets.","type":"string"},"serverName":{"description":"Used to verify the hostname for the targets.","type":"string"}}},"url":{"description":"The URL of the endpoint to send samples to.","type":"string"}},"required":["url"]},"type":"array"},"remoteWrite":{"description":"If specified, the remote_write spec. This is an experimental feature, it may change in any upcoming release in a breaking way.","items":{"description":"RemoteWriteSpec defines the remote_write configuration for prometheus.","properties":{"basicAuth":{"description":"BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints","properties":{"password":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"username":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}},"bearerToken":{"description":"File to read bearer token for remote write.","type":"string"},"bearerTokenFile":{"description":"File to read bearer token for remote write.","type":"string"},"proxyUrl":{"description":"Optional ProxyURL","type":"string"},"queueConfig":{"description":"QueueConfig allows the tuning of remote_write queue_config parameters. This object is referenced in the RemoteWriteSpec object.","properties":{"batchSendDeadline":{"description":"BatchSendDeadline is the maximum time a sample will wait in buffer.","type":"string"},"capacity":{"description":"Capacity is the number of samples to buffer per shard before we start dropping them.","format":"int32","type":"integer"},"maxBackoff":{"description":"MaxBackoff is the maximum retry delay.","type":"string"},"maxRetries":{"description":"MaxRetries is the maximum number of times to retry a batch on recoverable errors.","format":"int32","type":"integer"},"maxSamplesPerSend":{"description":"MaxSamplesPerSend is the maximum number of samples per send.","format":"int32","type":"integer"},"maxShards":{"description":"MaxShards is the maximum number of shards, i.e. amount of concurrency.","format":"int32","type":"integer"},"minBackoff":{"description":"MinBackoff is the initial retry delay. Gets doubled for every retry.","type":"string"}}},"remoteTimeout":{"description":"Timeout for requests to the remote write endpoint.","type":"string"},"tlsConfig":{"description":"TLSConfig specifies TLS configuration parameters.","properties":{"caFile":{"description":"The CA cert to use for the targets.","type":"string"},"certFile":{"description":"The client cert file for the targets.","type":"string"},"insecureSkipVerify":{"description":"Disable target certificate validation.","type":"boolean"},"keyFile":{"description":"The client key file for the targets.","type":"string"},"serverName":{"description":"Used to verify the hostname for the targets.","type":"string"}}},"url":{"description":"The URL of the endpoint to send samples to.","type":"string"},"writeRelabelConfigs":{"description":"The list of remote write relabel configurations.","items":{"description":"RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. It defines `\u003cmetric_relabel_configs\u003e`-section of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs","properties":{"action":{"description":"Action to perform based on regex matching. Default is 'replace'","type":"string"},"modulus":{"description":"Modulus to take of the hash of the source label values.","format":"int64","type":"integer"},"regex":{"description":"Regular expression against which the extracted value is matched. defailt is '(.*)'","type":"string"},"replacement":{"description":"Replacement value against which a regex replace is performed if the regular expression matches. Regex capture groups are available. Default is '$1'","type":"string"},"separator":{"description":"Separator placed between concatenated source label values. default is ';'.","type":"string"},"sourceLabels":{"description":"The source labels select values from existing labels. Their content is concatenated using the configured separator and matched against the configured regular expression for the replace, keep, and drop actions.","items":{"type":"string"},"type":"array"},"targetLabel":{"description":"Label to which the resulting value is written in a replace action. It is mandatory for replace actions. Regex capture groups are available.","type":"string"}}},"type":"array"}},"required":["url"]},"type":"array"},"replicas":{"description":"Number of instances to deploy for a Prometheus deployment.","format":"int32","type":"integer"},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"retention":{"description":"Time duration Prometheus shall retain data for. Default is '24h', and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years).","type":"string"},"routePrefix":{"description":"The route prefix Prometheus registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`.","type":"string"},"ruleNamespaceSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"ruleSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"scrapeInterval":{"description":"Interval between consecutive scrapes.","type":"string"},"secrets":{"description":"Secrets is a list of Secrets in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. The Secrets are mounted into /etc/prometheus/secrets/\u003csecret-name\u003e.","items":{"type":"string"},"type":"array"},"securityContext":{"description":"PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.","properties":{"fsGroup":{"description":"A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:\n\n1. The owning GID will be the FSGroup 2. The setgid bit is set (new files created in the volume will be owned by FSGroup) 3. The permission bits are OR'd with rw-rw----\n\nIf unset, the Kubelet will not modify the ownership and permissions of any volume.","format":"int64","type":"integer"},"runAsGroup":{"description":"The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.","format":"int64","type":"integer"},"runAsNonRoot":{"description":"Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.","type":"boolean"},"runAsUser":{"description":"The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.","format":"int64","type":"integer"},"seLinuxOptions":{"description":"SELinuxOptions are the labels to be applied to the container","properties":{"level":{"description":"Level is SELinux level label that applies to the container.","type":"string"},"role":{"description":"Role is a SELinux role label that applies to the container.","type":"string"},"type":{"description":"Type is a SELinux type label that applies to the container.","type":"string"},"user":{"description":"User is a SELinux user label that applies to the container.","type":"string"}}},"supplementalGroups":{"description":"A list of groups applied to the first process run in each container, in addition to the container's primary GID. If unspecified, no groups will be added to any container.","items":{"format":"int64","type":"integer"},"type":"array"},"sysctls":{"description":"Sysctls hold a list of namespaced sysctls used for the pod. Pods with unsupported sysctls (by the container runtime) might fail to launch.","items":{"description":"Sysctl defines a kernel parameter to be set","properties":{"name":{"description":"Name of a property to set","type":"string"},"value":{"description":"Value of a property to set","type":"string"}},"required":["name","value"]},"type":"array"}}},"serviceAccountName":{"description":"ServiceAccountName is the name of the ServiceAccount to use to run the Prometheus Pods.","type":"string"},"serviceMonitorNamespaceSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"serviceMonitorSelector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"sha":{"description":"SHA of Prometheus container image to be deployed. Defaults to the value of `version`. Similar to a tag, but the SHA explicitly deploys an immutable container image. Version and Tag are ignored if SHA is set.","type":"string"},"storage":{"description":"StorageSpec defines the configured storage for a group Prometheus servers. If neither `emptyDir` nor `volumeClaimTemplate` is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used.","properties":{"emptyDir":{"description":"Represents an empty directory for a pod. Empty directory volumes support ownership management and SELinux relabeling.","properties":{"medium":{"description":"What type of storage medium should back this directory. The default is \"\" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir","type":"string"},"sizeLimit":{}}},"volumeClaimTemplate":{"description":"PersistentVolumeClaim is a user's request for and claim to a persistent volume","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"metadata":{"description":"ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.","properties":{"annotations":{"description":"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations","type":"object"},"clusterName":{"description":"The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.","type":"string"},"creationTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"deletionGracePeriodSeconds":{"description":"Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.","format":"int64","type":"integer"},"deletionTimestamp":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"finalizers":{"description":"Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed.","items":{"type":"string"},"type":"array"},"generateName":{"description":"GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency","type":"string"},"generation":{"description":"A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.","format":"int64","type":"integer"},"initializers":{"description":"Initializers tracks the progress of initialization.","properties":{"pending":{"description":"Pending is a list of initializers that must execute in order before this object is visible. When the last pending initializer is removed, and no failing result is set, the initializers struct will be set to nil and the object is considered as initialized and visible to all clients.","items":{"description":"Initializer is information about an initializer that has not yet completed.","properties":{"name":{"description":"name of the process that is responsible for initializing this object.","type":"string"}},"required":["name"]},"type":"array"},"result":{"description":"Status is a return value for calls that don't return other objects.","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"code":{"description":"Suggested HTTP return code for this status, 0 if not set.","format":"int32","type":"integer"},"details":{"description":"StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.","properties":{"causes":{"description":"The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.","items":{"description":"StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.","properties":{"field":{"description":"The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"","type":"string"},"message":{"description":"A human-readable description of the cause of the error. This field may be presented as-is to a reader.","type":"string"},"reason":{"description":"A machine-readable description of the cause of the error. If this value is empty there is no information available.","type":"string"}}},"type":"array"},"group":{"description":"The group attribute of the resource associated with the status StatusReason.","type":"string"},"kind":{"description":"The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).","type":"string"},"retryAfterSeconds":{"description":"If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.","format":"int32","type":"integer"},"uid":{"description":"UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"message":{"description":"A human-readable description of the status of this operation.","type":"string"},"metadata":{"description":"ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.","properties":{"continue":{"description":"continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.","type":"string"},"resourceVersion":{"description":"String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"selfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"}}},"reason":{"description":"A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.","type":"string"},"status":{"description":"Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status","type":"string"}}}},"required":["pending"]},"labels":{"description":"Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels","type":"object"},"name":{"description":"Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"namespace":{"description":"Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces","type":"string"},"ownerReferences":{"description":"List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.","items":{"description":"OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.","properties":{"apiVersion":{"description":"API version of the referent.","type":"string"},"blockOwnerDeletion":{"description":"If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.","type":"boolean"},"controller":{"description":"If true, this reference points to the managing controller.","type":"boolean"},"kind":{"description":"Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"name":{"description":"Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names","type":"string"},"uid":{"description":"UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}},"required":["apiVersion","kind","name","uid"]},"type":"array"},"resourceVersion":{"description":"An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency","type":"string"},"selfLink":{"description":"SelfLink is a URL representing this object. Populated by the system. Read-only.","type":"string"},"uid":{"description":"UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids","type":"string"}}},"spec":{"description":"PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes","properties":{"accessModes":{"description":"AccessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1","items":{"type":"string"},"type":"array"},"dataSource":{"description":"TypedLocalObjectReference contains enough information to let you locate the typed referenced object inside the same namespace.","properties":{"apiGroup":{"description":"APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.","type":"string"},"kind":{"description":"Kind is the type of resource being referenced","type":"string"},"name":{"description":"Name is the name of resource being referenced","type":"string"}},"required":["kind","name"]},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"selector":{"description":"A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.","properties":{"matchExpressions":{"description":"matchExpressions is a list of label selector requirements. The requirements are ANDed.","items":{"description":"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.","properties":{"key":{"description":"key is the label key that the selector applies to.","type":"string"},"operator":{"description":"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.","type":"string"},"values":{"description":"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.","items":{"type":"string"},"type":"array"}},"required":["key","operator"]},"type":"array"},"matchLabels":{"description":"matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.","type":"object"}}},"storageClassName":{"description":"Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1","type":"string"},"volumeMode":{"description":"volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is an alpha feature and may change in the future.","type":"string"},"volumeName":{"description":"VolumeName is the binding reference to the PersistentVolume backing this claim.","type":"string"}}},"status":{"description":"PersistentVolumeClaimStatus is the current status of a persistent volume claim.","properties":{"accessModes":{"description":"AccessModes contains the actual access modes the volume backing the PVC has. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1","items":{"type":"string"},"type":"array"},"capacity":{"description":"Represents the actual resources of the underlying volume.","type":"object"},"conditions":{"description":"Current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to 'ResizeStarted'.","items":{"description":"PersistentVolumeClaimCondition contails details about state of pvc","properties":{"lastProbeTime":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"lastTransitionTime":{"description":"Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.","format":"date-time","type":"string"},"message":{"description":"Human-readable message indicating details about last transition.","type":"string"},"reason":{"description":"Unique, this should be a short, machine understandable string that gives the reason for condition's last transition. If it reports \"ResizeStarted\" that means the underlying persistent volume is being resized.","type":"string"},"status":{"type":"string"},"type":{"type":"string"}},"required":["type","status"]},"type":"array"},"phase":{"description":"Phase represents the current phase of PersistentVolumeClaim.","type":"string"}}}}}}},"tag":{"description":"Tag of Prometheus container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set.","type":"string"},"thanos":{"description":"ThanosSpec defines parameters for a Prometheus server within a Thanos deployment.","properties":{"baseImage":{"description":"Thanos base image if other than default.","type":"string"},"gcs":{"description":"ThanosGCSSpec defines parameters for use of Google Cloud Storage (GCS) with Thanos.","properties":{"bucket":{"description":"Google Cloud Storage bucket name for stored blocks. If empty it won't store any block inside Google Cloud Storage.","type":"string"},"credentials":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]}}},"peers":{"description":"Peers is a DNS name for Thanos to discover peers through.","type":"string"},"resources":{"description":"ResourceRequirements describes the compute resource requirements.","properties":{"limits":{"description":"Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"},"requests":{"description":"Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/","type":"object"}}},"s3":{"description":"ThanosS3Spec defines parameters for of AWS Simple Storage Service (S3) with Thanos. (S3 compatible services apply as well)","properties":{"accessKey":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"bucket":{"description":"S3-Compatible API bucket name for stored blocks.","type":"string"},"encryptsse":{"description":"Whether to use Server Side Encryption","type":"boolean"},"endpoint":{"description":"S3-Compatible API endpoint for stored blocks.","type":"string"},"insecure":{"description":"Whether to use an insecure connection with an S3-Compatible API.","type":"boolean"},"secretKey":{"description":"SecretKeySelector selects a key of a Secret.","properties":{"key":{"description":"The key of the secret to select from. Must be a valid secret key.","type":"string"},"name":{"description":"Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names","type":"string"},"optional":{"description":"Specify whether the Secret or it's key must be defined","type":"boolean"}},"required":["key"]},"signatureVersion2":{"description":"Whether to use S3 Signature Version 2; otherwise Signature Version 4 will be used.","type":"boolean"}}},"sha":{"description":"SHA of Thanos container image to be deployed. Defaults to the value of `version`. Similar to a tag, but the SHA explicitly deploys an immutable container image. Version and Tag are ignored if SHA is set.","type":"string"},"tag":{"description":"Tag of Thanos sidecar container image to be deployed. Defaults to the value of `version`. Version is ignored if Tag is set.","type":"string"},"version":{"description":"Version describes the version of Thanos to use.","type":"string"}}},"tolerations":{"description":"If specified, the pod's tolerations.","items":{"description":"The pod this Toleration is attached to tolerates any taint that matches the triple \u003ckey,value,effect\u003e using the matching operator \u003coperator\u003e.","properties":{"effect":{"description":"Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.","type":"string"},"key":{"description":"Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.","type":"string"},"operator":{"description":"Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.","type":"string"},"tolerationSeconds":{"description":"TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.","format":"int64","type":"integer"},"value":{"description":"Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.","type":"string"}}},"type":"array"},"version":{"description":"Version of Prometheus to be deployed.","type":"string"}}},"status":{"description":"PrometheusStatus is the most recent observed status of the Prometheus cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status","properties":{"availableReplicas":{"description":"Total number of available pods (ready for at least minReadySeconds) targeted by this Prometheus deployment.","format":"int32","type":"integer"},"paused":{"description":"Represents whether any actions on the underlaying managed objects are being performed. Only delete actions will be performed.","type":"boolean"},"replicas":{"description":"Total number of non-terminated pods targeted by this Prometheus deployment (their labels match the selector).","format":"int32","type":"integer"},"unavailableReplicas":{"description":"Total number of unavailable pods targeted by this Prometheus deployment.","format":"int32","type":"integer"},"updatedReplicas":{"description":"Total number of non-terminated pods targeted by this Prometheus deployment that have the desired version spec.","format":"int32","type":"integer"}},"required":["paused","replicas","updatedReplicas","availableReplicas","unavailableReplicas"]}}}},"version":"v1"}} \ No newline at end of file diff --git a/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/prometheus-operator.libsonnet b/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/prometheus-operator.libsonnet index 7e0e6105f..1a82af08c 100644 --- a/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/prometheus-operator.libsonnet +++ b/vendor/github.com/coreos/prometheus-operator/jsonnet/prometheus-operator/prometheus-operator.libsonnet @@ -5,7 +5,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; namespace: 'default', versions+:: { - prometheusOperator: 'v0.25.0', + prometheusOperator: 'v0.26.0', prometheusConfigReloader: self.prometheusOperator, configmapReloader: 'v0.0.1', }, diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/collector.go b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/collector.go index 00faaac13..18c09a5b6 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/collector.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/collector.go @@ -15,7 +15,7 @@ package alertmanager import ( - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/prometheus/client_golang/prometheus" "k8s.io/client-go/tools/cache" diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/operator.go b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/operator.go index bf8ded19e..b67b4e7f0 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/operator.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/operator.go @@ -20,8 +20,8 @@ import ( "strings" "time" - "github.com/coreos/prometheus-operator/pkg/client/monitoring" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + monitoringclient "github.com/coreos/prometheus-operator/pkg/client/versioned" "github.com/coreos/prometheus-operator/pkg/k8sutil" "github.com/coreos/prometheus-operator/pkg/listwatch" prometheusoperator "github.com/coreos/prometheus-operator/pkg/prometheus" @@ -54,7 +54,7 @@ const ( // monitoring configurations. type Operator struct { kclient kubernetes.Interface - mclient monitoring.Interface + mclient monitoringclient.Interface crdclient apiextensionsclient.Interface logger log.Logger @@ -79,7 +79,6 @@ type Config struct { CrdKinds monitoringv1.CrdKinds CrdGroup string EnableValidation bool - DisableAutoUserGroup bool ManageCRDs bool } @@ -95,7 +94,7 @@ func New(c prometheusoperator.Config, logger log.Logger) (*Operator, error) { return nil, errors.Wrap(err, "instantiating kubernetes client failed") } - mclient, err := monitoring.NewForConfig(&c.CrdKinds, c.CrdGroup, cfg) + mclient, err := monitoringclient.NewForConfig(cfg) if err != nil { return nil, errors.Wrap(err, "instantiating monitoring client failed") } @@ -121,7 +120,6 @@ func New(c prometheusoperator.Config, logger log.Logger) (*Operator, error) { CrdKinds: c.CrdKinds, Labels: c.Labels, EnableValidation: c.EnableValidation, - DisableAutoUserGroup: c.DisableAutoUserGroup, ManageCRDs: c.ManageCRDs, }, } @@ -129,7 +127,9 @@ func New(c prometheusoperator.Config, logger log.Logger) (*Operator, error) { o.alrtInf = cache.NewSharedIndexInformer( listwatch.MultiNamespaceListerWatcher(o.config.Namespaces, func(namespace string) cache.ListerWatcher { return &cache.ListWatch{ - ListFunc: o.mclient.MonitoringV1().Alertmanagers(namespace).List, + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return o.mclient.MonitoringV1().Alertmanagers(namespace).List(options) + }, WatchFunc: o.mclient.MonitoringV1().Alertmanagers(namespace).Watch, } }), @@ -441,6 +441,10 @@ func (c *Operator) sync(key string) error { } am := obj.(*monitoringv1.Alertmanager) + am = am.DeepCopy() + am.APIVersion = monitoringv1.SchemeGroupVersion.String() + am.Kind = monitoringv1.AlertmanagersKind + if am.Spec.Paused { return nil } @@ -635,7 +639,11 @@ func (c *Operator) createCRDs() error { { "Alertmanager", listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { - return &cache.ListWatch{ListFunc: c.mclient.MonitoringV1().Alertmanagers(namespace).List} + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return c.mclient.MonitoringV1().Alertmanagers(namespace).List(options) + }, + } }).List, }, } diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset.go b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset.go index 4bb9fc851..99a5c24e2 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset.go @@ -27,14 +27,14 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "github.com/blang/semver" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/coreos/prometheus-operator/pkg/k8sutil" "github.com/pkg/errors" ) const ( governingServiceName = "alertmanager-operated" - defaultVersion = "v0.15.2" + defaultVersion = "v0.15.3" defaultRetention = "120h" secretsDir = "/etc/alertmanager/secrets/" configmapsDir = "/etc/alertmanager/configmaps/" @@ -146,6 +146,14 @@ func makeStatefulSetService(p *monitoringv1.Alertmanager, config Config) *v1.Ser Labels: config.Labels.Merge(map[string]string{ "operated-alertmanager": "true", }), + OwnerReferences: []metav1.OwnerReference{ + metav1.OwnerReference{ + Name: p.GetName(), + Kind: p.Kind, + APIVersion: p.APIVersion, + UID: p.GetUID(), + }, + }, }, Spec: v1.ServiceSpec{ ClusterIP: "None", @@ -295,16 +303,7 @@ func makeStatefulSetSpec(a *monitoringv1.Alertmanager, config Config) (*appsv1.S }, ports...) } - gid := int64(2000) - uid := int64(1000) - nr := true - securityContext := &v1.PodSecurityContext{ - RunAsNonRoot: &nr, - } - if !config.DisableAutoUserGroup { - securityContext.FSGroup = &gid - securityContext.RunAsUser = &uid - } + var securityContext *v1.PodSecurityContext = nil if a.Spec.SecurityContext != nil { securityContext = a.Spec.SecurityContext } @@ -460,7 +459,7 @@ func makeStatefulSetSpec(a *monitoringv1.Alertmanager, config Config) (*appsv1.S }, Resources: v1.ResourceRequirements{ Limits: v1.ResourceList{ - v1.ResourceCPU: resource.MustParse("5m"), + v1.ResourceCPU: resource.MustParse("50m"), v1.ResourceMemory: resource.MustParse("10Mi"), }, }, diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset_test.go b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset_test.go index 9b7b3e5ef..6d241569d 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset_test.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/alertmanager/statefulset_test.go @@ -20,7 +20,7 @@ import ( "strings" "testing" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/stretchr/testify/require" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -290,7 +290,7 @@ func TestMakeStatefulSetSpecMeshClusterFlags(t *testing.T) { wrongHAPrefix string }{ {"v0.14.0", "mesh", "cluster"}, - {"v0.15.2", "cluster", "mesh"}, + {"v0.15.3", "cluster", "mesh"}, } for _, test := range tests { @@ -326,7 +326,7 @@ func TestMakeStatefulSetSpecPeerFlagPort(t *testing.T) { portNeeded bool }{ {"v0.14.0", false}, - {"v0.15.2", true}, + {"v0.15.3", true}, } for _, test := range tests { @@ -354,7 +354,7 @@ func TestMakeStatefulSetSpecPeerFlagPort(t *testing.T) { func TestMakeStatefulSetSpecAdditionalPeers(t *testing.T) { a := monitoringv1.Alertmanager{} - a.Spec.Version = "v0.15.2" + a.Spec.Version = "v0.15.3" replicas := int32(1) a.Spec.Replicas = &replicas a.Spec.AdditionalPeers = []string{"example.com"} @@ -425,7 +425,7 @@ func TestSHAAndTagAndVersion(t *testing.T) { sset, err := makeStatefulSet(&monitoringv1.Alertmanager{ Spec: monitoringv1.AlertmanagerSpec{ Tag: "my-unrelated-tag", - Version: "v0.15.2", + Version: "v0.15.3", }, }, nil, defaultTestConfig) if err != nil { @@ -443,7 +443,7 @@ func TestSHAAndTagAndVersion(t *testing.T) { Spec: monitoringv1.AlertmanagerSpec{ SHA: "7384a79f4b4991bf8269e7452390249b7c70bcdd10509c8c1c6c6e30e32fb324", Tag: "my-unrelated-tag", - Version: "v0.15.2", + Version: "v0.15.3", }, }, nil, defaultTestConfig) if err != nil { diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/api/api.go b/vendor/github.com/coreos/prometheus-operator/pkg/api/api.go index 9ce674213..d29da40a4 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/api/api.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/api/api.go @@ -20,34 +20,36 @@ import ( "regexp" "github.com/go-kit/kit/log" + "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + monitoringclient "github.com/coreos/prometheus-operator/pkg/client/versioned" "github.com/coreos/prometheus-operator/pkg/k8sutil" "github.com/coreos/prometheus-operator/pkg/prometheus" ) type API struct { kclient *kubernetes.Clientset - mclient *v1.MonitoringV1Client + mclient monitoringclient.Interface logger log.Logger } func New(conf prometheus.Config, l log.Logger) (*API, error) { cfg, err := k8sutil.NewClusterConfig(conf.Host, conf.TLSInsecure, &conf.TLSConfig) if err != nil { - return nil, err + return nil, errors.Wrap(err, "instantiating cluster config failed") } kclient, err := kubernetes.NewForConfig(cfg) if err != nil { - return nil, err + return nil, errors.Wrap(err, "instantiating kubernetes client failed") } - mclient, err := v1.NewForConfig(&conf.CrdKinds, conf.CrdGroup, cfg) + mclient, err := monitoringclient.NewForConfig(cfg) if err != nil { - return nil, err + return nil, errors.Wrap(err, "instantiating monitoring client failed") } return &API{ @@ -96,7 +98,7 @@ func parsePrometheusStatusUrl(path string) objectReference { func (api *API) prometheusStatus(w http.ResponseWriter, req *http.Request) { or := parsePrometheusStatusUrl(req.URL.Path) - p, err := api.mclient.Prometheuses(or.namespace).Get(or.name, metav1.GetOptions{}) + p, err := api.mclient.MonitoringV1().Prometheuses(or.namespace).Get(or.name, metav1.GetOptions{}) if err != nil { if k8sutil.IsResourceNotFoundError(err) { w.WriteHeader(404) diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/register.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/register.go new file mode 100644 index 000000000..a9914fb1a --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/register.go @@ -0,0 +1,19 @@ +// Copyright 2018 The prometheus-operator 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 monitoring + +const ( + GroupName = "monitoring.coreos.com" +) diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/crd_kinds.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/crd_kinds.go new file mode 100644 index 000000000..8e3ab879e --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/crd_kinds.go @@ -0,0 +1,81 @@ +// Copyright 2018 The prometheus-operator 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 v1 + +import ( + "fmt" + "strings" +) + +type CrdKind struct { + Kind string + Plural string + SpecName string +} + +type CrdKinds struct { + KindsString string + Prometheus CrdKind + Alertmanager CrdKind + ServiceMonitor CrdKind + PrometheusRule CrdKind +} + +var DefaultCrdKinds = CrdKinds{ + KindsString: "", + Prometheus: CrdKind{Plural: PrometheusName, Kind: PrometheusesKind, SpecName: "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Prometheus"}, + ServiceMonitor: CrdKind{Plural: ServiceMonitorName, Kind: ServiceMonitorsKind, SpecName: "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitor"}, + Alertmanager: CrdKind{Plural: AlertmanagerName, Kind: AlertmanagersKind, SpecName: "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Alertmanager"}, + PrometheusRule: CrdKind{Plural: PrometheusRuleName, Kind: PrometheusRuleKind, SpecName: "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRule"}, +} + +// Implement the flag.Value interface +func (crdkinds *CrdKinds) String() string { + return crdkinds.KindsString +} + +// Set Implement the flag.Set interface +func (crdkinds *CrdKinds) Set(value string) error { + *crdkinds = DefaultCrdKinds + if value == "" { + value = fmt.Sprintf("%s=%s:%s,%s=%s:%s,%s=%s:%s,%s=%s:%s", + PrometheusKindKey, PrometheusesKind, PrometheusName, + AlertManagerKindKey, AlertmanagersKind, AlertmanagerName, + ServiceMonitorKindKey, ServiceMonitorsKind, ServiceMonitorName, + PrometheusRuleKindKey, PrometheusRuleKind, PrometheusRuleName, + ) + } + splited := strings.Split(value, ",") + for _, pair := range splited { + sp := strings.Split(pair, "=") + kind := strings.Split(sp[1], ":") + crdKind := CrdKind{Plural: kind[1], Kind: kind[0]} + switch kindKey := sp[0]; kindKey { + case PrometheusKindKey: + (*crdkinds).Prometheus = crdKind + case ServiceMonitorKindKey: + (*crdkinds).ServiceMonitor = crdKind + case AlertManagerKindKey: + (*crdkinds).Alertmanager = crdKind + case PrometheusRuleKindKey: + (*crdkinds).PrometheusRule = crdKind + default: + fmt.Printf("Warning: unknown kind: %s... ignoring", kindKey) + } + + } + (*crdkinds).KindsString = value + return nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/doc.go new file mode 100644 index 000000000..64c472527 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2017 The prometheus-operator 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. + +// +k8s:deepcopy-gen=package +// +groupName=monitoring.coreos.com + +package v1 diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/openapi_generated.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/openapi_generated.go similarity index 97% rename from vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/openapi_generated.go rename to vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/openapi_generated.go index 38efd8dbd..dbb8a780a 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/openapi_generated.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/openapi_generated.go @@ -28,38 +28,38 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.APIServerConfig": schema_pkg_client_monitoring_v1_APIServerConfig(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertingSpec": schema_pkg_client_monitoring_v1_AlertingSpec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Alertmanager": schema_pkg_client_monitoring_v1_Alertmanager(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerEndpoints": schema_pkg_client_monitoring_v1_AlertmanagerEndpoints(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerList": schema_pkg_client_monitoring_v1_AlertmanagerList(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerSpec": schema_pkg_client_monitoring_v1_AlertmanagerSpec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerStatus": schema_pkg_client_monitoring_v1_AlertmanagerStatus(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.BasicAuth": schema_pkg_client_monitoring_v1_BasicAuth(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Endpoint": schema_pkg_client_monitoring_v1_Endpoint(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.NamespaceSelector": schema_pkg_client_monitoring_v1_NamespaceSelector(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Prometheus": schema_pkg_client_monitoring_v1_Prometheus(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusList": schema_pkg_client_monitoring_v1_PrometheusList(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusRule": schema_pkg_client_monitoring_v1_PrometheusRule(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusRuleList": schema_pkg_client_monitoring_v1_PrometheusRuleList(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusRuleSpec": schema_pkg_client_monitoring_v1_PrometheusRuleSpec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusSpec": schema_pkg_client_monitoring_v1_PrometheusSpec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusStatus": schema_pkg_client_monitoring_v1_PrometheusStatus(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.QueueConfig": schema_pkg_client_monitoring_v1_QueueConfig(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RelabelConfig": schema_pkg_client_monitoring_v1_RelabelConfig(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RemoteReadSpec": schema_pkg_client_monitoring_v1_RemoteReadSpec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RemoteWriteSpec": schema_pkg_client_monitoring_v1_RemoteWriteSpec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Rule": schema_pkg_client_monitoring_v1_Rule(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RuleGroup": schema_pkg_client_monitoring_v1_RuleGroup(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ServiceMonitor": schema_pkg_client_monitoring_v1_ServiceMonitor(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ServiceMonitorList": schema_pkg_client_monitoring_v1_ServiceMonitorList(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ServiceMonitorSpec": schema_pkg_client_monitoring_v1_ServiceMonitorSpec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.StorageSpec": schema_pkg_client_monitoring_v1_StorageSpec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig": schema_pkg_client_monitoring_v1_TLSConfig(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ThanosGCSSpec": schema_pkg_client_monitoring_v1_ThanosGCSSpec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ThanosS3Spec": schema_pkg_client_monitoring_v1_ThanosS3Spec(ref), - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ThanosSpec": schema_pkg_client_monitoring_v1_ThanosSpec(ref), - "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource": schema_k8sio_api_core_v1_AWSElasticBlockStoreVolumeSource(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.APIServerConfig": schema_pkg_apis_monitoring_v1_APIServerConfig(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertingSpec": schema_pkg_apis_monitoring_v1_AlertingSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Alertmanager": schema_pkg_apis_monitoring_v1_Alertmanager(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerEndpoints": schema_pkg_apis_monitoring_v1_AlertmanagerEndpoints(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerList": schema_pkg_apis_monitoring_v1_AlertmanagerList(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerSpec": schema_pkg_apis_monitoring_v1_AlertmanagerSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerStatus": schema_pkg_apis_monitoring_v1_AlertmanagerStatus(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth": schema_pkg_apis_monitoring_v1_BasicAuth(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Endpoint": schema_pkg_apis_monitoring_v1_Endpoint(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.NamespaceSelector": schema_pkg_apis_monitoring_v1_NamespaceSelector(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Prometheus": schema_pkg_apis_monitoring_v1_Prometheus(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusList": schema_pkg_apis_monitoring_v1_PrometheusList(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRule": schema_pkg_apis_monitoring_v1_PrometheusRule(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRuleList": schema_pkg_apis_monitoring_v1_PrometheusRuleList(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRuleSpec": schema_pkg_apis_monitoring_v1_PrometheusRuleSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusSpec": schema_pkg_apis_monitoring_v1_PrometheusSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusStatus": schema_pkg_apis_monitoring_v1_PrometheusStatus(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.QueueConfig": schema_pkg_apis_monitoring_v1_QueueConfig(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig": schema_pkg_apis_monitoring_v1_RelabelConfig(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteReadSpec": schema_pkg_apis_monitoring_v1_RemoteReadSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteWriteSpec": schema_pkg_apis_monitoring_v1_RemoteWriteSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Rule": schema_pkg_apis_monitoring_v1_Rule(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RuleGroup": schema_pkg_apis_monitoring_v1_RuleGroup(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitor": schema_pkg_apis_monitoring_v1_ServiceMonitor(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitorList": schema_pkg_apis_monitoring_v1_ServiceMonitorList(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitorSpec": schema_pkg_apis_monitoring_v1_ServiceMonitorSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec": schema_pkg_apis_monitoring_v1_StorageSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig": schema_pkg_apis_monitoring_v1_TLSConfig(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosGCSSpec": schema_pkg_apis_monitoring_v1_ThanosGCSSpec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosS3Spec": schema_pkg_apis_monitoring_v1_ThanosS3Spec(ref), + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosSpec": schema_pkg_apis_monitoring_v1_ThanosSpec(ref), + "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource": schema_k8sio_api_core_v1_AWSElasticBlockStoreVolumeSource(ref), "k8s.io/api/core/v1.Affinity": schema_k8sio_api_core_v1_Affinity(ref), "k8s.io/api/core/v1.AttachedVolume": schema_k8sio_api_core_v1_AttachedVolume(ref), "k8s.io/api/core/v1.AvoidPods": schema_k8sio_api_core_v1_AvoidPods(ref), @@ -295,7 +295,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA } } -func schema_pkg_client_monitoring_v1_APIServerConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_APIServerConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -311,7 +311,7 @@ func schema_pkg_client_monitoring_v1_APIServerConfig(ref common.ReferenceCallbac "basicAuth": { SchemaProps: spec.SchemaProps{ Description: "BasicAuth allow an endpoint to authenticate over basic authentication", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.BasicAuth"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth"), }, }, "bearerToken": { @@ -331,7 +331,7 @@ func schema_pkg_client_monitoring_v1_APIServerConfig(ref common.ReferenceCallbac "tlsConfig": { SchemaProps: spec.SchemaProps{ Description: "TLS Config to use for accessing apiserver.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), }, }, }, @@ -339,11 +339,11 @@ func schema_pkg_client_monitoring_v1_APIServerConfig(ref common.ReferenceCallbac }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"}, } } -func schema_pkg_client_monitoring_v1_AlertingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_AlertingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -356,7 +356,7 @@ func schema_pkg_client_monitoring_v1_AlertingSpec(ref common.ReferenceCallback) Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerEndpoints"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerEndpoints"), }, }, }, @@ -367,11 +367,11 @@ func schema_pkg_client_monitoring_v1_AlertingSpec(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerEndpoints"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerEndpoints"}, } } -func schema_pkg_client_monitoring_v1_Alertmanager(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_Alertmanager(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -394,13 +394,13 @@ func schema_pkg_client_monitoring_v1_Alertmanager(ref common.ReferenceCallback) "spec": { SchemaProps: spec.SchemaProps{ Description: "Specification of the desired behavior of the Alertmanager cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ Description: "Most recent observed status of the Alertmanager cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerStatus"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerStatus"), }, }, }, @@ -408,11 +408,11 @@ func schema_pkg_client_monitoring_v1_Alertmanager(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerSpec", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertmanagerStatus"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertmanagerStatus"}, } } -func schema_pkg_client_monitoring_v1_AlertmanagerEndpoints(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_AlertmanagerEndpoints(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -455,7 +455,7 @@ func schema_pkg_client_monitoring_v1_AlertmanagerEndpoints(ref common.ReferenceC "tlsConfig": { SchemaProps: spec.SchemaProps{ Description: "TLS Config to use for alertmanager connection.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), }, }, "bearerTokenFile": { @@ -470,11 +470,11 @@ func schema_pkg_client_monitoring_v1_AlertmanagerEndpoints(ref common.ReferenceC }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, } } -func schema_pkg_client_monitoring_v1_AlertmanagerList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_AlertmanagerList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -507,7 +507,7 @@ func schema_pkg_client_monitoring_v1_AlertmanagerList(ref common.ReferenceCallba Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Alertmanager"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Alertmanager"), }, }, }, @@ -518,11 +518,11 @@ func schema_pkg_client_monitoring_v1_AlertmanagerList(ref common.ReferenceCallba }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Alertmanager", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Alertmanager", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, } } -func schema_pkg_client_monitoring_v1_AlertmanagerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_AlertmanagerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -619,7 +619,7 @@ func schema_pkg_client_monitoring_v1_AlertmanagerSpec(ref common.ReferenceCallba }, "retention": { SchemaProps: spec.SchemaProps{ - Description: "Time duration Alertmanager shall retain data for. Default is '120h', and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years).", + Description: "Time duration Alertmanager shall retain data for. Default is '120h', and must match the regular expression `[0-9]+(ms|s|m|h)` (milliseconds seconds minutes hours).", Type: []string{"string"}, Format: "", }, @@ -627,7 +627,7 @@ func schema_pkg_client_monitoring_v1_AlertmanagerSpec(ref common.ReferenceCallba "storage": { SchemaProps: spec.SchemaProps{ Description: "Storage is the definition of how storage will be used by the Alertmanager instances.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.StorageSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec"), }, }, "externalUrl": { @@ -748,11 +748,11 @@ func schema_pkg_client_monitoring_v1_AlertmanagerSpec(ref common.ReferenceCallba }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.StorageSpec", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.Toleration", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.Toleration", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, } } -func schema_pkg_client_monitoring_v1_AlertmanagerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_AlertmanagerStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -801,7 +801,7 @@ func schema_pkg_client_monitoring_v1_AlertmanagerStatus(ref common.ReferenceCall } } -func schema_pkg_client_monitoring_v1_BasicAuth(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_BasicAuth(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -827,7 +827,7 @@ func schema_pkg_client_monitoring_v1_BasicAuth(ref common.ReferenceCallback) com } } -func schema_pkg_client_monitoring_v1_Endpoint(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_Endpoint(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -898,7 +898,7 @@ func schema_pkg_client_monitoring_v1_Endpoint(ref common.ReferenceCallback) comm "tlsConfig": { SchemaProps: spec.SchemaProps{ Description: "TLS configuration to use when scraping the endpoint", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), }, }, "bearerTokenFile": { @@ -918,7 +918,7 @@ func schema_pkg_client_monitoring_v1_Endpoint(ref common.ReferenceCallback) comm "basicAuth": { SchemaProps: spec.SchemaProps{ Description: "BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.BasicAuth"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth"), }, }, "metricRelabelings": { @@ -928,7 +928,7 @@ func schema_pkg_client_monitoring_v1_Endpoint(ref common.ReferenceCallback) comm Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RelabelConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig"), }, }, }, @@ -941,7 +941,7 @@ func schema_pkg_client_monitoring_v1_Endpoint(ref common.ReferenceCallback) comm Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RelabelConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig"), }, }, }, @@ -958,11 +958,11 @@ func schema_pkg_client_monitoring_v1_Endpoint(ref common.ReferenceCallback) comm }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RelabelConfig", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig", "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, } } -func schema_pkg_client_monitoring_v1_NamespaceSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_NamespaceSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -996,7 +996,7 @@ func schema_pkg_client_monitoring_v1_NamespaceSelector(ref common.ReferenceCallb } } -func schema_pkg_client_monitoring_v1_Prometheus(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_Prometheus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1019,13 +1019,13 @@ func schema_pkg_client_monitoring_v1_Prometheus(ref common.ReferenceCallback) co "spec": { SchemaProps: spec.SchemaProps{ Description: "Specification of the desired behavior of the Prometheus cluster. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ Description: "Most recent observed status of the Prometheus cluster. Read-only. Not included when requesting from the apiserver, only from the Prometheus Operator API itself. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusStatus"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusStatus"), }, }, }, @@ -1033,11 +1033,11 @@ func schema_pkg_client_monitoring_v1_Prometheus(ref common.ReferenceCallback) co }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusSpec", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusStatus"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusStatus"}, } } -func schema_pkg_client_monitoring_v1_PrometheusList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_PrometheusList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1070,7 +1070,7 @@ func schema_pkg_client_monitoring_v1_PrometheusList(ref common.ReferenceCallback Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Prometheus"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Prometheus"), }, }, }, @@ -1081,11 +1081,11 @@ func schema_pkg_client_monitoring_v1_PrometheusList(ref common.ReferenceCallback }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Prometheus", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Prometheus", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, } } -func schema_pkg_client_monitoring_v1_PrometheusRule(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_PrometheusRule(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1114,7 +1114,7 @@ func schema_pkg_client_monitoring_v1_PrometheusRule(ref common.ReferenceCallback "spec": { SchemaProps: spec.SchemaProps{ Description: "Specification of desired alerting rule definitions for Prometheus.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusRuleSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRuleSpec"), }, }, }, @@ -1122,11 +1122,11 @@ func schema_pkg_client_monitoring_v1_PrometheusRule(ref common.ReferenceCallback }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusRuleSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRuleSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, } } -func schema_pkg_client_monitoring_v1_PrometheusRuleList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_PrometheusRuleList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1159,7 +1159,7 @@ func schema_pkg_client_monitoring_v1_PrometheusRuleList(ref common.ReferenceCall Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusRule"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRule"), }, }, }, @@ -1170,11 +1170,11 @@ func schema_pkg_client_monitoring_v1_PrometheusRuleList(ref common.ReferenceCall }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusRule", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.PrometheusRule", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, } } -func schema_pkg_client_monitoring_v1_PrometheusRuleSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_PrometheusRuleSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1187,7 +1187,7 @@ func schema_pkg_client_monitoring_v1_PrometheusRuleSpec(ref common.ReferenceCall Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RuleGroup"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RuleGroup"), }, }, }, @@ -1197,11 +1197,11 @@ func schema_pkg_client_monitoring_v1_PrometheusRuleSpec(ref common.ReferenceCall }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RuleGroup"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RuleGroup"}, } } -func schema_pkg_client_monitoring_v1_PrometheusSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_PrometheusSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1339,7 +1339,7 @@ func schema_pkg_client_monitoring_v1_PrometheusSpec(ref common.ReferenceCallback "storage": { SchemaProps: spec.SchemaProps{ Description: "Storage spec to specify how storage shall be used.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.StorageSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec"), }, }, "ruleSelector": { @@ -1357,7 +1357,7 @@ func schema_pkg_client_monitoring_v1_PrometheusSpec(ref common.ReferenceCallback "alerting": { SchemaProps: spec.SchemaProps{ Description: "Define details regarding alerting.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertingSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertingSpec"), }, }, "resources": { @@ -1441,7 +1441,7 @@ func schema_pkg_client_monitoring_v1_PrometheusSpec(ref common.ReferenceCallback Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RemoteWriteSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteWriteSpec"), }, }, }, @@ -1454,7 +1454,7 @@ func schema_pkg_client_monitoring_v1_PrometheusSpec(ref common.ReferenceCallback Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RemoteReadSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteReadSpec"), }, }, }, @@ -1507,13 +1507,13 @@ func schema_pkg_client_monitoring_v1_PrometheusSpec(ref common.ReferenceCallback "apiserverConfig": { SchemaProps: spec.SchemaProps{ Description: "APIServerConfig allows specifying a host and auth methods to access apiserver. If left empty, Prometheus is assumed to run inside of the cluster and will discover API servers automatically and use the pod's CA certificate and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount/.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.APIServerConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.APIServerConfig"), }, }, "thanos": { SchemaProps: spec.SchemaProps{ Description: "Thanos configuration allows configuring various aspects of a Prometheus server in a Thanos environment.\n\nThis section is experimental, it may change significantly without deprecation notice in any release.\n\nThis is experimental and may change significantly without backward compatibility in any release.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ThanosSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosSpec"), }, }, "priorityClassName": { @@ -1527,11 +1527,11 @@ func schema_pkg_client_monitoring_v1_PrometheusSpec(ref common.ReferenceCallback }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.APIServerConfig", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.AlertingSpec", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RemoteReadSpec", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RemoteWriteSpec", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.StorageSpec", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ThanosSpec", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.SecretKeySelector", "k8s.io/api/core/v1.Toleration", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.APIServerConfig", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.AlertingSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteReadSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RemoteWriteSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.StorageSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosSpec", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.Container", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.SecretKeySelector", "k8s.io/api/core/v1.Toleration", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, } } -func schema_pkg_client_monitoring_v1_PrometheusStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_PrometheusStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1580,7 +1580,7 @@ func schema_pkg_client_monitoring_v1_PrometheusStatus(ref common.ReferenceCallba } } -func schema_pkg_client_monitoring_v1_QueueConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_QueueConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1642,7 +1642,7 @@ func schema_pkg_client_monitoring_v1_QueueConfig(ref common.ReferenceCallback) c } } -func schema_pkg_client_monitoring_v1_RelabelConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_RelabelConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1711,7 +1711,7 @@ func schema_pkg_client_monitoring_v1_RelabelConfig(ref common.ReferenceCallback) } } -func schema_pkg_client_monitoring_v1_RemoteReadSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_RemoteReadSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1755,7 +1755,7 @@ func schema_pkg_client_monitoring_v1_RemoteReadSpec(ref common.ReferenceCallback "basicAuth": { SchemaProps: spec.SchemaProps{ Description: "BasicAuth for the URL.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.BasicAuth"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth"), }, }, "bearerToken": { @@ -1775,7 +1775,7 @@ func schema_pkg_client_monitoring_v1_RemoteReadSpec(ref common.ReferenceCallback "tlsConfig": { SchemaProps: spec.SchemaProps{ Description: "TLS Config to use for remote read.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), }, }, "proxyUrl": { @@ -1790,11 +1790,11 @@ func schema_pkg_client_monitoring_v1_RemoteReadSpec(ref common.ReferenceCallback }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"}, } } -func schema_pkg_client_monitoring_v1_RemoteWriteSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_RemoteWriteSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1821,7 +1821,7 @@ func schema_pkg_client_monitoring_v1_RemoteWriteSpec(ref common.ReferenceCallbac Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RelabelConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig"), }, }, }, @@ -1830,7 +1830,7 @@ func schema_pkg_client_monitoring_v1_RemoteWriteSpec(ref common.ReferenceCallbac "basicAuth": { SchemaProps: spec.SchemaProps{ Description: "BasicAuth for the URL.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.BasicAuth"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth"), }, }, "bearerToken": { @@ -1850,7 +1850,7 @@ func schema_pkg_client_monitoring_v1_RemoteWriteSpec(ref common.ReferenceCallbac "tlsConfig": { SchemaProps: spec.SchemaProps{ Description: "TLS Config to use for remote write.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"), }, }, "proxyUrl": { @@ -1863,7 +1863,7 @@ func schema_pkg_client_monitoring_v1_RemoteWriteSpec(ref common.ReferenceCallbac "queueConfig": { SchemaProps: spec.SchemaProps{ Description: "QueueConfig allows tuning of the remote write queue parameters.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.QueueConfig"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.QueueConfig"), }, }, }, @@ -1871,11 +1871,11 @@ func schema_pkg_client_monitoring_v1_RemoteWriteSpec(ref common.ReferenceCallbac }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.QueueConfig", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.RelabelConfig", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.TLSConfig"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.BasicAuth", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.QueueConfig", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.RelabelConfig", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.TLSConfig"}, } } -func schema_pkg_client_monitoring_v1_Rule(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_Rule(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1939,7 +1939,7 @@ func schema_pkg_client_monitoring_v1_Rule(ref common.ReferenceCallback) common.O } } -func schema_pkg_client_monitoring_v1_RuleGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_RuleGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -1963,7 +1963,7 @@ func schema_pkg_client_monitoring_v1_RuleGroup(ref common.ReferenceCallback) com Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Rule"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Rule"), }, }, }, @@ -1974,11 +1974,11 @@ func schema_pkg_client_monitoring_v1_RuleGroup(ref common.ReferenceCallback) com }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Rule"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Rule"}, } } -func schema_pkg_client_monitoring_v1_ServiceMonitor(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_ServiceMonitor(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -2001,7 +2001,7 @@ func schema_pkg_client_monitoring_v1_ServiceMonitor(ref common.ReferenceCallback "spec": { SchemaProps: spec.SchemaProps{ Description: "Specification of desired Service selection for target discrovery by Prometheus.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ServiceMonitorSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitorSpec"), }, }, }, @@ -2009,11 +2009,11 @@ func schema_pkg_client_monitoring_v1_ServiceMonitor(ref common.ReferenceCallback }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ServiceMonitorSpec"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitorSpec"}, } } -func schema_pkg_client_monitoring_v1_ServiceMonitorList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_ServiceMonitorList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -2046,7 +2046,7 @@ func schema_pkg_client_monitoring_v1_ServiceMonitorList(ref common.ReferenceCall Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ServiceMonitor"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitor"), }, }, }, @@ -2057,11 +2057,11 @@ func schema_pkg_client_monitoring_v1_ServiceMonitorList(ref common.ReferenceCall }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ServiceMonitor", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ServiceMonitor", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, } } -func schema_pkg_client_monitoring_v1_ServiceMonitorSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_ServiceMonitorSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -2109,7 +2109,7 @@ func schema_pkg_client_monitoring_v1_ServiceMonitorSpec(ref common.ReferenceCall Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Endpoint"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Endpoint"), }, }, }, @@ -2124,7 +2124,7 @@ func schema_pkg_client_monitoring_v1_ServiceMonitorSpec(ref common.ReferenceCall "namespaceSelector": { SchemaProps: spec.SchemaProps{ Description: "Selector to select which namespaces the Endpoints objects are discovered from.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.NamespaceSelector"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.NamespaceSelector"), }, }, "sampleLimit": { @@ -2139,41 +2139,22 @@ func schema_pkg_client_monitoring_v1_ServiceMonitorSpec(ref common.ReferenceCall }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Endpoint", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.NamespaceSelector", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.Endpoint", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.NamespaceSelector", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, } } -func schema_pkg_client_monitoring_v1_StorageSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_StorageSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "StorageSpec defines the configured storage for a group Prometheus servers. If neither `emptyDir` nor `volumeClaimTemplate` is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used.", Properties: map[string]spec.Schema{ - "class": { - SchemaProps: spec.SchemaProps{ - Description: "Name of the StorageClass to use when requesting storage provisioning. More info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses (DEPRECATED - instead use `volumeClaimTemplate.spec.storageClassName`)", - Type: []string{"string"}, - Format: "", - }, - }, "emptyDir": { SchemaProps: spec.SchemaProps{ Description: "EmptyDirVolumeSource to be used by the Prometheus StatefulSets. If specified, used in place of any volumeClaimTemplate. More info: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir", Ref: ref("k8s.io/api/core/v1.EmptyDirVolumeSource"), }, }, - "selector": { - SchemaProps: spec.SchemaProps{ - Description: "A label query over volumes to consider for binding. (DEPRECATED - instead use `volumeClaimTemplate.spec.selector`)", - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), - }, - }, - "resources": { - SchemaProps: spec.SchemaProps{ - Description: "Resources represents the minimum resources the volume should have. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#resources (DEPRECATED - instead use `volumeClaimTemplate.spec.resources`)", - Ref: ref("k8s.io/api/core/v1.ResourceRequirements"), - }, - }, "volumeClaimTemplate": { SchemaProps: spec.SchemaProps{ Description: "A PVC spec to be used by the Prometheus StatefulSets.", @@ -2184,11 +2165,11 @@ func schema_pkg_client_monitoring_v1_StorageSpec(ref common.ReferenceCallback) c }, }, Dependencies: []string{ - "k8s.io/api/core/v1.EmptyDirVolumeSource", "k8s.io/api/core/v1.PersistentVolumeClaim", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + "k8s.io/api/core/v1.EmptyDirVolumeSource", "k8s.io/api/core/v1.PersistentVolumeClaim"}, } } -func schema_pkg_client_monitoring_v1_TLSConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_TLSConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -2236,7 +2217,7 @@ func schema_pkg_client_monitoring_v1_TLSConfig(ref common.ReferenceCallback) com } } -func schema_pkg_client_monitoring_v1_ThanosGCSSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_ThanosGCSSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -2263,7 +2244,7 @@ func schema_pkg_client_monitoring_v1_ThanosGCSSpec(ref common.ReferenceCallback) } } -func schema_pkg_client_monitoring_v1_ThanosS3Spec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_ThanosS3Spec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -2324,7 +2305,7 @@ func schema_pkg_client_monitoring_v1_ThanosS3Spec(ref common.ReferenceCallback) } } -func schema_pkg_client_monitoring_v1_ThanosSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_monitoring_v1_ThanosSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -2374,20 +2355,20 @@ func schema_pkg_client_monitoring_v1_ThanosSpec(ref common.ReferenceCallback) co "gcs": { SchemaProps: spec.SchemaProps{ Description: "GCS configures use of GCS in Thanos.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ThanosGCSSpec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosGCSSpec"), }, }, "s3": { SchemaProps: spec.SchemaProps{ Description: "S3 configures use of S3 in Thanos.", - Ref: ref("github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ThanosS3Spec"), + Ref: ref("github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosS3Spec"), }, }, }, }, }, Dependencies: []string{ - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ThanosGCSSpec", "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ThanosS3Spec", "k8s.io/api/core/v1.ResourceRequirements"}, + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosGCSSpec", "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1.ThanosS3Spec", "k8s.io/api/core/v1.ResourceRequirements"}, } } diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/register.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/register.go new file mode 100644 index 000000000..60b8adda7 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/register.go @@ -0,0 +1,61 @@ +// Copyright 2018 The prometheus-operator 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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/coreos/prometheus-operator/pkg/apis/monitoring" +) + +// SchemeGroupVersion is the group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: monitoring.GroupName, Version: Version} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Prometheus{}, + &PrometheusList{}, + &ServiceMonitor{}, + &ServiceMonitorList{}, + &Alertmanager{}, + &AlertmanagerList{}, + &PrometheusRule{}, + &PrometheusRuleList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/types.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/types.go new file mode 100644 index 000000000..adbf18ea3 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/types.go @@ -0,0 +1,798 @@ +// Copyright 2018 The prometheus-operator 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 v1 + +import ( + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/intstr" +) + +const ( + Version = "v1" + + PrometheusesKind = "Prometheus" + PrometheusName = "prometheuses" + PrometheusKindKey = "prometheus" + + AlertmanagersKind = "Alertmanager" + AlertmanagerName = "alertmanagers" + AlertManagerKindKey = "alertmanager" + + ServiceMonitorsKind = "ServiceMonitor" + ServiceMonitorName = "servicemonitors" + ServiceMonitorKindKey = "servicemonitor" + + PrometheusRuleKind = "PrometheusRule" + PrometheusRuleName = "prometheusrules" + PrometheusRuleKindKey = "prometheusrule" +) + +// Prometheus defines a Prometheus deployment. +// +genclient +// +k8s:openapi-gen=true +type Prometheus struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // +k8s:openapi-gen=false + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the Prometheus cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec PrometheusSpec `json:"spec"` + // Most recent observed status of the Prometheus cluster. Read-only. Not + // included when requesting from the apiserver, only from the Prometheus + // Operator API itself. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Status *PrometheusStatus `json:"status,omitempty"` +} + +// PrometheusList is a list of Prometheuses. +// +k8s:openapi-gen=true +type PrometheusList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of Prometheuses + Items []*Prometheus `json:"items"` +} + +// PrometheusSpec is a specification of the desired behavior of the Prometheus cluster. More info: +// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status +// +k8s:openapi-gen=true +type PrometheusSpec struct { + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // Metadata Labels and Annotations gets propagated to the prometheus pods. + PodMetadata *metav1.ObjectMeta `json:"podMetadata,omitempty"` + // ServiceMonitors to be selected for target discovery. + ServiceMonitorSelector *metav1.LabelSelector `json:"serviceMonitorSelector,omitempty"` + // Namespaces to be selected for ServiceMonitor discovery. If nil, only + // check own namespace. + ServiceMonitorNamespaceSelector *metav1.LabelSelector `json:"serviceMonitorNamespaceSelector,omitempty"` + // Version of Prometheus to be deployed. + Version string `json:"version,omitempty"` + // Tag of Prometheus container image to be deployed. Defaults to the value of `version`. + // Version is ignored if Tag is set. + Tag string `json:"tag,omitempty"` + // SHA of Prometheus container image to be deployed. Defaults to the value of `version`. + // Similar to a tag, but the SHA explicitly deploys an immutable container image. + // Version and Tag are ignored if SHA is set. + SHA string `json:"sha,omitempty"` + // When a Prometheus deployment is paused, no actions except for deletion + // will be performed on the underlying objects. + Paused bool `json:"paused,omitempty"` + // Base image to use for a Prometheus deployment. + BaseImage string `json:"baseImage,omitempty"` + // An optional list of references to secrets in the same namespace + // to use for pulling prometheus and alertmanager images from registries + // see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod + ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"` + // Number of instances to deploy for a Prometheus deployment. + Replicas *int32 `json:"replicas,omitempty"` + // Time duration Prometheus shall retain data for. Default is '24h', + // and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years). + Retention string `json:"retention,omitempty"` + // Log level for Prometheus to be configured with. + LogLevel string `json:"logLevel,omitempty"` + // Interval between consecutive scrapes. + ScrapeInterval string `json:"scrapeInterval,omitempty"` + // Interval between consecutive evaluations. + EvaluationInterval string `json:"evaluationInterval,omitempty"` + // The labels to add to any time series or alerts when communicating with + // external systems (federation, remote storage, Alertmanager). + ExternalLabels map[string]string `json:"externalLabels,omitempty"` + // The external URL the Prometheus instances will be available under. This is + // necessary to generate correct URLs. This is necessary if Prometheus is not + // served from root of a DNS name. + ExternalURL string `json:"externalUrl,omitempty"` + // The route prefix Prometheus registers HTTP handlers for. This is useful, + // if using ExternalURL and a proxy is rewriting HTTP routes of a request, + // and the actual ExternalURL is still true, but the server serves requests + // under a different route prefix. For example for use with `kubectl proxy`. + RoutePrefix string `json:"routePrefix,omitempty"` + // Storage spec to specify how storage shall be used. + Storage *StorageSpec `json:"storage,omitempty"` + // A selector to select which PrometheusRules to mount for loading alerting + // rules from. Until (excluding) Prometheus Operator v0.24.0 Prometheus + // Operator will migrate any legacy rule ConfigMaps to PrometheusRule custom + // resources selected by RuleSelector. Make sure it does not match any config + // maps that you do not want to be migrated. + RuleSelector *metav1.LabelSelector `json:"ruleSelector,omitempty"` + // Namespaces to be selected for PrometheusRules discovery. If unspecified, only + // the same namespace as the Prometheus object is in is used. + RuleNamespaceSelector *metav1.LabelSelector `json:"ruleNamespaceSelector,omitempty"` + // Define details regarding alerting. + Alerting *AlertingSpec `json:"alerting,omitempty"` + // Define resources requests and limits for single Pods. + Resources v1.ResourceRequirements `json:"resources,omitempty"` + // Define which Nodes the Pods are scheduled on. + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // ServiceAccountName is the name of the ServiceAccount to use to run the + // Prometheus Pods. + ServiceAccountName string `json:"serviceAccountName,omitempty"` + // Secrets is a list of Secrets in the same namespace as the Prometheus + // object, which shall be mounted into the Prometheus Pods. + // The Secrets are mounted into /etc/prometheus/secrets/. + Secrets []string `json:"secrets,omitempty"` + // ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus + // object, which shall be mounted into the Prometheus Pods. + // The ConfigMaps are mounted into /etc/prometheus/configmaps/. + ConfigMaps []string `json:"configMaps,omitempty"` + // If specified, the pod's scheduling constraints. + Affinity *v1.Affinity `json:"affinity,omitempty"` + // If specified, the pod's tolerations. + Tolerations []v1.Toleration `json:"tolerations,omitempty"` + // If specified, the remote_write spec. This is an experimental feature, it may change in any upcoming release in a breaking way. + RemoteWrite []RemoteWriteSpec `json:"remoteWrite,omitempty"` + // If specified, the remote_read spec. This is an experimental feature, it may change in any upcoming release in a breaking way. + RemoteRead []RemoteReadSpec `json:"remoteRead,omitempty"` + // SecurityContext holds pod-level security attributes and common container settings. + // This defaults to non root user with uid 1000 and gid 2000 for Prometheus >v2.0 and + // default PodSecurityContext for other versions. + SecurityContext *v1.PodSecurityContext `json:"securityContext,omitempty"` + // ListenLocal makes the Prometheus server listen on loopback, so that it + // does not bind against the Pod IP. + ListenLocal bool `json:"listenLocal,omitempty"` + // Containers allows injecting additional containers. This is meant to + // allow adding an authentication proxy to a Prometheus pod. + Containers []v1.Container `json:"containers,omitempty"` + // AdditionalScrapeConfigs allows specifying a key of a Secret containing + // additional Prometheus scrape configurations. Scrape configurations + // specified are appended to the configurations generated by the Prometheus + // Operator. Job configurations specified must have the form as specified + // in the official Prometheus documentation: + // https://prometheus.io/docs/prometheus/latest/configuration/configuration/#. + // As scrape configs are appended, the user is responsible to make sure it + // is valid. Note that using this feature may expose the possibility to + // break upgrades of Prometheus. It is advised to review Prometheus release + // notes to ensure that no incompatible scrape configs are going to break + // Prometheus after the upgrade. + AdditionalScrapeConfigs *v1.SecretKeySelector `json:"additionalScrapeConfigs,omitempty"` + // AdditionalAlertRelabelConfigs allows specifying a key of a Secret containing + // additional Prometheus alert relabel configurations. Alert relabel configurations + // specified are appended to the configurations generated by the Prometheus + // Operator. Alert relabel configurations specified must have the form as specified + // in the official Prometheus documentation: + // https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alert_relabel_configs. + // As alert relabel configs are appended, the user is responsible to make sure it + // is valid. Note that using this feature may expose the possibility to + // break upgrades of Prometheus. It is advised to review Prometheus release + // notes to ensure that no incompatible alert relabel configs are going to break + // Prometheus after the upgrade. + AdditionalAlertRelabelConfigs *v1.SecretKeySelector `json:"additionalAlertRelabelConfigs,omitempty"` + // AdditionalAlertManagerConfigs allows specifying a key of a Secret containing + // additional Prometheus AlertManager configurations. AlertManager configurations + // specified are appended to the configurations generated by the Prometheus + // Operator. Job configurations specified must have the form as specified + // in the official Prometheus documentation: + // https://prometheus.io/docs/prometheus/latest/configuration/configuration/#. + // As AlertManager configs are appended, the user is responsible to make sure it + // is valid. Note that using this feature may expose the possibility to + // break upgrades of Prometheus. It is advised to review Prometheus release + // notes to ensure that no incompatible AlertManager configs are going to break + // Prometheus after the upgrade. + AdditionalAlertManagerConfigs *v1.SecretKeySelector `json:"additionalAlertManagerConfigs,omitempty"` + // APIServerConfig allows specifying a host and auth methods to access apiserver. + // If left empty, Prometheus is assumed to run inside of the cluster + // and will discover API servers automatically and use the pod's CA certificate + // and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount/. + APIServerConfig *APIServerConfig `json:"apiserverConfig,omitempty"` + // Thanos configuration allows configuring various aspects of a Prometheus + // server in a Thanos environment. + // + // This section is experimental, it may change significantly without + // deprecation notice in any release. + // + // This is experimental and may change significantly without backward + // compatibility in any release. + Thanos *ThanosSpec `json:"thanos,omitempty"` + // Priority class assigned to the Pods + PriorityClassName string `json:"priorityClassName,omitempty"` +} + +// PrometheusStatus is the most recent observed status of the Prometheus cluster. Read-only. Not +// included when requesting from the apiserver, only from the Prometheus +// Operator API itself. More info: +// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status +// +k8s:openapi-gen=true +type PrometheusStatus struct { + // Represents whether any actions on the underlaying managed objects are + // being performed. Only delete actions will be performed. + Paused bool `json:"paused"` + // Total number of non-terminated pods targeted by this Prometheus deployment + // (their labels match the selector). + Replicas int32 `json:"replicas"` + // Total number of non-terminated pods targeted by this Prometheus deployment + // that have the desired version spec. + UpdatedReplicas int32 `json:"updatedReplicas"` + // Total number of available pods (ready for at least minReadySeconds) + // targeted by this Prometheus deployment. + AvailableReplicas int32 `json:"availableReplicas"` + // Total number of unavailable pods targeted by this Prometheus deployment. + UnavailableReplicas int32 `json:"unavailableReplicas"` +} + +// AlertingSpec defines parameters for alerting configuration of Prometheus servers. +// +k8s:openapi-gen=true +type AlertingSpec struct { + // AlertmanagerEndpoints Prometheus should fire alerts against. + Alertmanagers []AlertmanagerEndpoints `json:"alertmanagers"` +} + +// StorageSpec defines the configured storage for a group Prometheus servers. +// If neither `emptyDir` nor `volumeClaimTemplate` is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used. +// +k8s:openapi-gen=true +type StorageSpec struct { + // EmptyDirVolumeSource to be used by the Prometheus StatefulSets. If specified, used in place of any volumeClaimTemplate. More + // info: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir + EmptyDir *v1.EmptyDirVolumeSource `json:"emptyDir,omitempty"` + // A PVC spec to be used by the Prometheus StatefulSets. + VolumeClaimTemplate v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"` +} + +// ThanosSpec defines parameters for a Prometheus server within a Thanos deployment. +// +k8s:openapi-gen=true +type ThanosSpec struct { + // Peers is a DNS name for Thanos to discover peers through. + Peers *string `json:"peers,omitempty"` + // Version describes the version of Thanos to use. + Version *string `json:"version,omitempty"` + // Tag of Thanos sidecar container image to be deployed. Defaults to the value of `version`. + // Version is ignored if Tag is set. + Tag *string `json:"tag,omitempty"` + // SHA of Thanos container image to be deployed. Defaults to the value of `version`. + // Similar to a tag, but the SHA explicitly deploys an immutable container image. + // Version and Tag are ignored if SHA is set. + SHA *string `json:"sha,omitempty"` + // Thanos base image if other than default. + BaseImage *string `json:"baseImage,omitempty"` + // Resources defines the resource requirements for the Thanos sidecar. + // If not provided, no requests/limits will be set + Resources v1.ResourceRequirements `json:"resources,omitempty"` + // GCS configures use of GCS in Thanos. + GCS *ThanosGCSSpec `json:"gcs,omitempty"` + // S3 configures use of S3 in Thanos. + S3 *ThanosS3Spec `json:"s3,omitempty"` +} + +// ThanosGCSSpec defines parameters for use of Google Cloud Storage (GCS) with +// Thanos. +// +k8s:openapi-gen=true +type ThanosGCSSpec struct { + // Google Cloud Storage bucket name for stored blocks. If empty it won't + // store any block inside Google Cloud Storage. + Bucket *string `json:"bucket,omitempty"` + // Secret to access our Bucket. + SecretKey *v1.SecretKeySelector `json:"credentials,omitempty"` +} + +// ThanosS3Spec defines parameters for of AWS Simple Storage Service (S3) with +// Thanos. (S3 compatible services apply as well) +// +k8s:openapi-gen=true +type ThanosS3Spec struct { + // S3-Compatible API bucket name for stored blocks. + Bucket *string `json:"bucket,omitempty"` + // S3-Compatible API endpoint for stored blocks. + Endpoint *string `json:"endpoint,omitempty"` + // AccessKey for an S3-Compatible API. + AccessKey *v1.SecretKeySelector `json:"accessKey,omitempty"` + // SecretKey for an S3-Compatible API. + SecretKey *v1.SecretKeySelector `json:"secretKey,omitempty"` + // Whether to use an insecure connection with an S3-Compatible API. + Insecure *bool `json:"insecure,omitempty"` + // Whether to use S3 Signature Version 2; otherwise Signature Version 4 will be used. + SignatureVersion2 *bool `json:"signatureVersion2,omitempty"` + // Whether to use Server Side Encryption + EncryptSSE *bool `json:"encryptsse,omitempty"` +} + +// RemoteWriteSpec defines the remote_write configuration for prometheus. +// +k8s:openapi-gen=true +type RemoteWriteSpec struct { + //The URL of the endpoint to send samples to. + URL string `json:"url"` + //Timeout for requests to the remote write endpoint. + RemoteTimeout string `json:"remoteTimeout,omitempty"` + //The list of remote write relabel configurations. + WriteRelabelConfigs []RelabelConfig `json:"writeRelabelConfigs,omitempty"` + //BasicAuth for the URL. + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // File to read bearer token for remote write. + BearerToken string `json:"bearerToken,omitempty"` + // File to read bearer token for remote write. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` + // TLS Config to use for remote write. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` + //Optional ProxyURL + ProxyURL string `json:"proxyUrl,omitempty"` + // QueueConfig allows tuning of the remote write queue parameters. + QueueConfig *QueueConfig `json:"queueConfig,omitempty"` +} + +// QueueConfig allows the tuning of remote_write queue_config parameters. This object +// is referenced in the RemoteWriteSpec object. +// +k8s:openapi-gen=true +type QueueConfig struct { + // Capacity is the number of samples to buffer per shard before we start dropping them. + Capacity int `json:"capacity,omitempty"` + // MaxShards is the maximum number of shards, i.e. amount of concurrency. + MaxShards int `json:"maxShards,omitempty"` + // MaxSamplesPerSend is the maximum number of samples per send. + MaxSamplesPerSend int `json:"maxSamplesPerSend,omitempty"` + // BatchSendDeadline is the maximum time a sample will wait in buffer. + BatchSendDeadline string `json:"batchSendDeadline,omitempty"` + // MaxRetries is the maximum number of times to retry a batch on recoverable errors. + MaxRetries int `json:"maxRetries,omitempty"` + // MinBackoff is the initial retry delay. Gets doubled for every retry. + MinBackoff string `json:"minBackoff,omitempty"` + // MaxBackoff is the maximum retry delay. + MaxBackoff string `json:"maxBackoff,omitempty"` +} + +// RemoteReadSpec defines the remote_read configuration for prometheus. +// +k8s:openapi-gen=true +type RemoteReadSpec struct { + //The URL of the endpoint to send samples to. + URL string `json:"url"` + //An optional list of equality matchers which have to be present + // in a selector to query the remote read endpoint. + RequiredMatchers map[string]string `json:"requiredMatchers,omitempty"` + //Timeout for requests to the remote read endpoint. + RemoteTimeout string `json:"remoteTimeout,omitempty"` + //Whether reads should be made for queries for time ranges that + // the local storage should have complete data for. + ReadRecent bool `json:"readRecent,omitempty"` + //BasicAuth for the URL. + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // bearer token for remote read. + BearerToken string `json:"bearerToken,omitempty"` + // File to read bearer token for remote read. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` + // TLS Config to use for remote read. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` + //Optional ProxyURL + ProxyURL string `json:"proxyUrl,omitempty"` +} + +// RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. +// It defines ``-section of Prometheus configuration. +// More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs +// +k8s:openapi-gen=true +type RelabelConfig struct { + //The source labels select values from existing labels. Their content is concatenated + //using the configured separator and matched against the configured regular expression + //for the replace, keep, and drop actions. + SourceLabels []string `json:"sourceLabels,omitempty"` + //Separator placed between concatenated source label values. default is ';'. + Separator string `json:"separator,omitempty"` + //Label to which the resulting value is written in a replace action. + //It is mandatory for replace actions. Regex capture groups are available. + TargetLabel string `json:"targetLabel,omitempty"` + //Regular expression against which the extracted value is matched. defailt is '(.*)' + Regex string `json:"regex,omitempty"` + // Modulus to take of the hash of the source label values. + Modulus uint64 `json:"modulus,omitempty"` + //Replacement value against which a regex replace is performed if the + //regular expression matches. Regex capture groups are available. Default is '$1' + Replacement string `json:"replacement,omitempty"` + // Action to perform based on regex matching. Default is 'replace' + Action string `json:"action,omitempty"` +} + +// APIServerConfig defines a host and auth methods to access apiserver. +// More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config +// +k8s:openapi-gen=true +type APIServerConfig struct { + // Host of apiserver. + // A valid string consisting of a hostname or IP followed by an optional port number + Host string `json:"host"` + // BasicAuth allow an endpoint to authenticate over basic authentication + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // Bearer token for accessing apiserver. + BearerToken string `json:"bearerToken,omitempty"` + // File to read bearer token for accessing apiserver. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` + // TLS Config to use for accessing apiserver. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` +} + +// AlertmanagerEndpoints defines a selection of a single Endpoints object +// containing alertmanager IPs to fire alerts against. +// +k8s:openapi-gen=true +type AlertmanagerEndpoints struct { + // Namespace of Endpoints object. + Namespace string `json:"namespace"` + // Name of Endpoints object in Namespace. + Name string `json:"name"` + // Port the Alertmanager API is exposed on. + Port intstr.IntOrString `json:"port"` + // Scheme to use when firing alerts. + Scheme string `json:"scheme,omitempty"` + // Prefix for the HTTP path alerts are pushed to. + PathPrefix string `json:"pathPrefix,omitempty"` + // TLS Config to use for alertmanager connection. + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` + // BearerTokenFile to read from filesystem to use when authenticating to + // Alertmanager. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` +} + +// ServiceMonitor defines monitoring for a set of services. +// +genclient +// +k8s:openapi-gen=true +type ServiceMonitor struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // +k8s:openapi-gen=false + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of desired Service selection for target discrovery by + // Prometheus. + Spec ServiceMonitorSpec `json:"spec"` +} + +// ServiceMonitorSpec contains specification parameters for a ServiceMonitor. +// +k8s:openapi-gen=true +type ServiceMonitorSpec struct { + // The label to use to retrieve the job name from. + JobLabel string `json:"jobLabel,omitempty"` + // TargetLabels transfers labels on the Kubernetes Service onto the target. + TargetLabels []string `json:"targetLabels,omitempty"` + // PodTargetLabels transfers labels on the Kubernetes Pod onto the target. + PodTargetLabels []string `json:"podTargetLabels,omitempty"` + // A list of endpoints allowed as part of this ServiceMonitor. + Endpoints []Endpoint `json:"endpoints"` + // Selector to select Endpoints objects. + Selector metav1.LabelSelector `json:"selector"` + // Selector to select which namespaces the Endpoints objects are discovered from. + NamespaceSelector NamespaceSelector `json:"namespaceSelector,omitempty"` + // SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. + SampleLimit uint64 `json:"sampleLimit,omitempty"` +} + +// Endpoint defines a scrapeable endpoint serving Prometheus metrics. +// +k8s:openapi-gen=true +type Endpoint struct { + // Name of the service port this endpoint refers to. Mutually exclusive with targetPort. + Port string `json:"port,omitempty"` + // Name or number of the target port of the endpoint. Mutually exclusive with port. + TargetPort *intstr.IntOrString `json:"targetPort,omitempty"` + // HTTP path to scrape for metrics. + Path string `json:"path,omitempty"` + // HTTP scheme to use for scraping. + Scheme string `json:"scheme,omitempty"` + // Optional HTTP URL parameters + Params map[string][]string `json:"params,omitempty"` + // Interval at which metrics should be scraped + Interval string `json:"interval,omitempty"` + // Timeout after which the scrape is ended + ScrapeTimeout string `json:"scrapeTimeout,omitempty"` + // TLS configuration to use when scraping the endpoint + TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` + // File to read bearer token for scraping targets. + BearerTokenFile string `json:"bearerTokenFile,omitempty"` + // HonorLabels chooses the metric's labels on collisions with target labels. + HonorLabels bool `json:"honorLabels,omitempty"` + // BasicAuth allow an endpoint to authenticate over basic authentication + // More info: https://prometheus.io/docs/operating/configuration/#endpoints + BasicAuth *BasicAuth `json:"basicAuth,omitempty"` + // MetricRelabelConfigs to apply to samples before ingestion. + MetricRelabelConfigs []*RelabelConfig `json:"metricRelabelings,omitempty"` + // RelabelConfigs to apply to samples before ingestion. + // More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/# + RelabelConfigs []*RelabelConfig `json:"relabelings,omitempty"` + // ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint. + ProxyURL *string `json:"proxyUrl,omitempty"` +} + +// BasicAuth allow an endpoint to authenticate over basic authentication +// More info: https://prometheus.io/docs/operating/configuration/#endpoints +// +k8s:openapi-gen=true +type BasicAuth struct { + // The secret that contains the username for authenticate + Username v1.SecretKeySelector `json:"username,omitempty"` + // The secret that contains the password for authenticate + Password v1.SecretKeySelector `json:"password,omitempty"` +} + +// TLSConfig specifies TLS configuration parameters. +// +k8s:openapi-gen=true +type TLSConfig struct { + // The CA cert to use for the targets. + CAFile string `json:"caFile,omitempty"` + // The client cert file for the targets. + CertFile string `json:"certFile,omitempty"` + // The client key file for the targets. + KeyFile string `json:"keyFile,omitempty"` + // Used to verify the hostname for the targets. + ServerName string `json:"serverName,omitempty"` + // Disable target certificate validation. + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` +} + +// ServiceMonitorList is a list of ServiceMonitors. +// +k8s:openapi-gen=true +type ServiceMonitorList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of ServiceMonitors + Items []*ServiceMonitor `json:"items"` +} + +// PrometheusRuleList is a list of PrometheusRules. +// +k8s:openapi-gen=true +type PrometheusRuleList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of Rules + Items []*PrometheusRule `json:"items"` +} + +// PrometheusRule defines alerting rules for a Prometheus instance +// +genclient +// +k8s:openapi-gen=true +type PrometheusRule struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of desired alerting rule definitions for Prometheus. + Spec PrometheusRuleSpec `json:"spec"` +} + +// PrometheusRuleSpec contains specification parameters for a Rule. +// +k8s:openapi-gen=true +type PrometheusRuleSpec struct { + // Content of Prometheus rule file + Groups []RuleGroup `json:"groups,omitempty"` +} + +// RuleGroup and Rule are copied instead of vendored because the +// upstream Prometheus struct definitions don't have json struct tags. + +// RuleGroup is a list of sequentially evaluated recording and alerting rules. +// +k8s:openapi-gen=true +type RuleGroup struct { + Name string `json:"name"` + Interval string `json:"interval,omitempty"` + Rules []Rule `json:"rules"` +} + +// Rule describes an alerting or recording rule. +// +k8s:openapi-gen=true +type Rule struct { + Record string `json:"record,omitempty"` + Alert string `json:"alert,omitempty"` + Expr intstr.IntOrString `json:"expr"` + For string `json:"for,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` +} + +// Alertmanager describes an Alertmanager cluster. +// +genclient +// +k8s:openapi-gen=true +type Alertmanager struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // +k8s:openapi-gen=false + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the Alertmanager cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec AlertmanagerSpec `json:"spec"` + // Most recent observed status of the Alertmanager cluster. Read-only. Not + // included when requesting from the apiserver, only from the Prometheus + // Operator API itself. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Status *AlertmanagerStatus `json:"status,omitempty"` +} + +// AlertmanagerSpec is a specification of the desired behavior of the Alertmanager cluster. More info: +// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status +// +k8s:openapi-gen=true +type AlertmanagerSpec struct { + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + // Metadata Labels and Annotations gets propagated to the prometheus pods. + PodMetadata *metav1.ObjectMeta `json:"podMetadata,omitempty"` + // Version the cluster should be on. + Version string `json:"version,omitempty"` + // Tag of Alertmanager container image to be deployed. Defaults to the value of `version`. + // Version is ignored if Tag is set. + Tag string `json:"tag,omitempty"` + // SHA of Alertmanager container image to be deployed. Defaults to the value of `version`. + // Similar to a tag, but the SHA explicitly deploys an immutable container image. + // Version and Tag are ignored if SHA is set. + SHA string `json:"sha,omitempty"` + // Base image that is used to deploy pods, without tag. + BaseImage string `json:"baseImage,omitempty"` + // An optional list of references to secrets in the same namespace + // to use for pulling prometheus and alertmanager images from registries + // see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod + ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"` + // Secrets is a list of Secrets in the same namespace as the Alertmanager + // object, which shall be mounted into the Alertmanager Pods. + // The Secrets are mounted into /etc/alertmanager/secrets/. + Secrets []string `json:"secrets,omitempty"` + // ConfigMaps is a list of ConfigMaps in the same namespace as the Alertmanager + // object, which shall be mounted into the Alertmanager Pods. + // The ConfigMaps are mounted into /etc/alertmanager/configmaps/. + ConfigMaps []string `json:"configMaps,omitempty"` + // Log level for Alertmanager to be configured with. + LogLevel string `json:"logLevel,omitempty"` + // Size is the expected size of the alertmanager cluster. The controller will + // eventually make the size of the running cluster equal to the expected + // size. + Replicas *int32 `json:"replicas,omitempty"` + // Time duration Alertmanager shall retain data for. Default is '120h', + // and must match the regular expression `[0-9]+(ms|s|m|h)` (milliseconds seconds minutes hours). + Retention string `json:"retention,omitempty"` + // Storage is the definition of how storage will be used by the Alertmanager + // instances. + Storage *StorageSpec `json:"storage,omitempty"` + // The external URL the Alertmanager instances will be available under. This is + // necessary to generate correct URLs. This is necessary if Alertmanager is not + // served from root of a DNS name. + ExternalURL string `json:"externalUrl,omitempty"` + // The route prefix Alertmanager registers HTTP handlers for. This is useful, + // if using ExternalURL and a proxy is rewriting HTTP routes of a request, + // and the actual ExternalURL is still true, but the server serves requests + // under a different route prefix. For example for use with `kubectl proxy`. + RoutePrefix string `json:"routePrefix,omitempty"` + // If set to true all actions on the underlaying managed objects are not + // goint to be performed, except for delete actions. + Paused bool `json:"paused,omitempty"` + // Define which Nodes the Pods are scheduled on. + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // Define resources requests and limits for single Pods. + Resources v1.ResourceRequirements `json:"resources,omitempty"` + // If specified, the pod's scheduling constraints. + Affinity *v1.Affinity `json:"affinity,omitempty"` + // If specified, the pod's tolerations. + Tolerations []v1.Toleration `json:"tolerations,omitempty"` + // SecurityContext holds pod-level security attributes and common container settings. + // This defaults to non root user with uid 1000 and gid 2000. + SecurityContext *v1.PodSecurityContext `json:"securityContext,omitempty"` + // ServiceAccountName is the name of the ServiceAccount to use to run the + // Prometheus Pods. + ServiceAccountName string `json:"serviceAccountName,omitempty"` + // ListenLocal makes the Alertmanager server listen on loopback, so that it + // does not bind against the Pod IP. Note this is only for the Alertmanager + // UI, not the gossip communication. + ListenLocal bool `json:"listenLocal,omitempty"` + // Containers allows injecting additional containers. This is meant to + // allow adding an authentication proxy to an Alertmanager pod. + Containers []v1.Container `json:"containers,omitempty"` + // Priority class assigned to the Pods + PriorityClassName string `json:"priorityClassName,omitempty"` + // AdditionalPeers allows injecting a set of additional Alertmanagers to peer with to form a highly available cluster. + AdditionalPeers []string `json:"additionalPeers,omitempty"` +} + +// AlertmanagerList is a list of Alertmanagers. +// +k8s:openapi-gen=true +type AlertmanagerList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ListMeta `json:"metadata,omitempty"` + // List of Alertmanagers + Items []Alertmanager `json:"items"` +} + +// AlertmanagerStatus is the most recent observed status of the Alertmanager cluster. Read-only. Not +// included when requesting from the apiserver, only from the Prometheus +// Operator API itself. More info: +// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status +// +k8s:openapi-gen=true +type AlertmanagerStatus struct { + // Represents whether any actions on the underlaying managed objects are + // being performed. Only delete actions will be performed. + Paused bool `json:"paused"` + // Total number of non-terminated pods targeted by this Alertmanager + // cluster (their labels match the selector). + Replicas int32 `json:"replicas"` + // Total number of non-terminated pods targeted by this Alertmanager + // cluster that have the desired version spec. + UpdatedReplicas int32 `json:"updatedReplicas"` + // Total number of available pods (ready for at least minReadySeconds) + // targeted by this Alertmanager cluster. + AvailableReplicas int32 `json:"availableReplicas"` + // Total number of unavailable pods targeted by this Alertmanager cluster. + UnavailableReplicas int32 `json:"unavailableReplicas"` +} + +// NamespaceSelector is a selector for selecting either all namespaces or a +// list of namespaces. +// +k8s:openapi-gen=true +type NamespaceSelector struct { + // Boolean describing whether all namespaces are selected in contrast to a + // list restricting them. + Any bool `json:"any,omitempty"` + // List of namespace names. + MatchNames []string `json:"matchNames,omitempty"` + + // TODO(fabxc): this should embed metav1.LabelSelector eventually. + // Currently the selector is only used for namespaces which require more complex + // implementation to support label selections. +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *Alertmanager) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *AlertmanagerList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *Prometheus) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *PrometheusList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *ServiceMonitor) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *ServiceMonitorList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (f *PrometheusRule) DeepCopyObject() runtime.Object { + return f.DeepCopy() +} + +// DeepCopyObject implements the runtime.Object interface. +func (l *PrometheusRuleList) DeepCopyObject() runtime.Object { + return l.DeepCopy() +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/types_test.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/types_test.go similarity index 100% rename from vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/types_test.go rename to vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/types_test.go diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/zz_generated.deepcopy.go b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/zz_generated.deepcopy.go new file mode 100644 index 000000000..0dfecfe65 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1/zz_generated.deepcopy.go @@ -0,0 +1,1299 @@ +// +build !ignore_autogenerated + +// Copyright 2018 The prometheus-operator 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. + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + core_v1 "k8s.io/api/core/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIServerConfig) DeepCopyInto(out *APIServerConfig) { + *out = *in + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + if *in == nil { + *out = nil + } else { + *out = new(BasicAuth) + (*in).DeepCopyInto(*out) + } + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServerConfig. +func (in *APIServerConfig) DeepCopy() *APIServerConfig { + if in == nil { + return nil + } + out := new(APIServerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertingSpec) DeepCopyInto(out *AlertingSpec) { + *out = *in + if in.Alertmanagers != nil { + in, out := &in.Alertmanagers, &out.Alertmanagers + *out = make([]AlertmanagerEndpoints, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertingSpec. +func (in *AlertingSpec) DeepCopy() *AlertingSpec { + if in == nil { + return nil + } + out := new(AlertingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Alertmanager) DeepCopyInto(out *Alertmanager) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + if *in == nil { + *out = nil + } else { + *out = new(AlertmanagerStatus) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Alertmanager. +func (in *Alertmanager) DeepCopy() *Alertmanager { + if in == nil { + return nil + } + out := new(Alertmanager) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerEndpoints) DeepCopyInto(out *AlertmanagerEndpoints) { + *out = *in + out.Port = in.Port + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerEndpoints. +func (in *AlertmanagerEndpoints) DeepCopy() *AlertmanagerEndpoints { + if in == nil { + return nil + } + out := new(AlertmanagerEndpoints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerList) DeepCopyInto(out *AlertmanagerList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Alertmanager, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerList. +func (in *AlertmanagerList) DeepCopy() *AlertmanagerList { + if in == nil { + return nil + } + out := new(AlertmanagerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerSpec) DeepCopyInto(out *AlertmanagerSpec) { + *out = *in + if in.PodMetadata != nil { + in, out := &in.PodMetadata, &out.PodMetadata + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.ObjectMeta) + (*in).DeepCopyInto(*out) + } + } + if in.ImagePullSecrets != nil { + in, out := &in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]core_v1.LocalObjectReference, len(*in)) + copy(*out, *in) + } + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ConfigMaps != nil { + in, out := &in.ConfigMaps, &out.ConfigMaps + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + if in.Storage != nil { + in, out := &in.Storage, &out.Storage + if *in == nil { + *out = nil + } else { + *out = new(StorageSpec) + (*in).DeepCopyInto(*out) + } + } + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + in.Resources.DeepCopyInto(&out.Resources) + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + if *in == nil { + *out = nil + } else { + *out = new(core_v1.Affinity) + (*in).DeepCopyInto(*out) + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]core_v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SecurityContext != nil { + in, out := &in.SecurityContext, &out.SecurityContext + if *in == nil { + *out = nil + } else { + *out = new(core_v1.PodSecurityContext) + (*in).DeepCopyInto(*out) + } + } + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]core_v1.Container, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.AdditionalPeers != nil { + in, out := &in.AdditionalPeers, &out.AdditionalPeers + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerSpec. +func (in *AlertmanagerSpec) DeepCopy() *AlertmanagerSpec { + if in == nil { + return nil + } + out := new(AlertmanagerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerStatus) DeepCopyInto(out *AlertmanagerStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerStatus. +func (in *AlertmanagerStatus) DeepCopy() *AlertmanagerStatus { + if in == nil { + return nil + } + out := new(AlertmanagerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BasicAuth) DeepCopyInto(out *BasicAuth) { + *out = *in + in.Username.DeepCopyInto(&out.Username) + in.Password.DeepCopyInto(&out.Password) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuth. +func (in *BasicAuth) DeepCopy() *BasicAuth { + if in == nil { + return nil + } + out := new(BasicAuth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CrdKind) DeepCopyInto(out *CrdKind) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrdKind. +func (in *CrdKind) DeepCopy() *CrdKind { + if in == nil { + return nil + } + out := new(CrdKind) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CrdKinds) DeepCopyInto(out *CrdKinds) { + *out = *in + out.Prometheus = in.Prometheus + out.Alertmanager = in.Alertmanager + out.ServiceMonitor = in.ServiceMonitor + out.PrometheusRule = in.PrometheusRule + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrdKinds. +func (in *CrdKinds) DeepCopy() *CrdKinds { + if in == nil { + return nil + } + out := new(CrdKinds) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Endpoint) DeepCopyInto(out *Endpoint) { + *out = *in + if in.TargetPort != nil { + in, out := &in.TargetPort, &out.TargetPort + if *in == nil { + *out = nil + } else { + *out = new(intstr.IntOrString) + **out = **in + } + } + if in.Params != nil { + in, out := &in.Params, &out.Params + *out = make(map[string][]string, len(*in)) + for key, val := range *in { + if val == nil { + (*out)[key] = nil + } else { + (*out)[key] = make([]string, len(val)) + copy((*out)[key], val) + } + } + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + if *in == nil { + *out = nil + } else { + *out = new(BasicAuth) + (*in).DeepCopyInto(*out) + } + } + if in.MetricRelabelConfigs != nil { + in, out := &in.MetricRelabelConfigs, &out.MetricRelabelConfigs + *out = make([]*RelabelConfig, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(RelabelConfig) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + if in.RelabelConfigs != nil { + in, out := &in.RelabelConfigs, &out.RelabelConfigs + *out = make([]*RelabelConfig, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(RelabelConfig) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + if in.ProxyURL != nil { + in, out := &in.ProxyURL, &out.ProxyURL + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. +func (in *Endpoint) DeepCopy() *Endpoint { + if in == nil { + return nil + } + out := new(Endpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NamespaceSelector) DeepCopyInto(out *NamespaceSelector) { + *out = *in + if in.MatchNames != nil { + in, out := &in.MatchNames, &out.MatchNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceSelector. +func (in *NamespaceSelector) DeepCopy() *NamespaceSelector { + if in == nil { + return nil + } + out := new(NamespaceSelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Prometheus) DeepCopyInto(out *Prometheus) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + if *in == nil { + *out = nil + } else { + *out = new(PrometheusStatus) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Prometheus. +func (in *Prometheus) DeepCopy() *Prometheus { + if in == nil { + return nil + } + out := new(Prometheus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusList) DeepCopyInto(out *PrometheusList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*Prometheus, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(Prometheus) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusList. +func (in *PrometheusList) DeepCopy() *PrometheusList { + if in == nil { + return nil + } + out := new(PrometheusList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusRule) DeepCopyInto(out *PrometheusRule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRule. +func (in *PrometheusRule) DeepCopy() *PrometheusRule { + if in == nil { + return nil + } + out := new(PrometheusRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusRuleList) DeepCopyInto(out *PrometheusRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*PrometheusRule, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(PrometheusRule) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRuleList. +func (in *PrometheusRuleList) DeepCopy() *PrometheusRuleList { + if in == nil { + return nil + } + out := new(PrometheusRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusRuleSpec) DeepCopyInto(out *PrometheusRuleSpec) { + *out = *in + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = make([]RuleGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRuleSpec. +func (in *PrometheusRuleSpec) DeepCopy() *PrometheusRuleSpec { + if in == nil { + return nil + } + out := new(PrometheusRuleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusSpec) DeepCopyInto(out *PrometheusSpec) { + *out = *in + if in.PodMetadata != nil { + in, out := &in.PodMetadata, &out.PodMetadata + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.ObjectMeta) + (*in).DeepCopyInto(*out) + } + } + if in.ServiceMonitorSelector != nil { + in, out := &in.ServiceMonitorSelector, &out.ServiceMonitorSelector + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + if in.ServiceMonitorNamespaceSelector != nil { + in, out := &in.ServiceMonitorNamespaceSelector, &out.ServiceMonitorNamespaceSelector + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + if in.ImagePullSecrets != nil { + in, out := &in.ImagePullSecrets, &out.ImagePullSecrets + *out = make([]core_v1.LocalObjectReference, len(*in)) + copy(*out, *in) + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + if *in == nil { + *out = nil + } else { + *out = new(int32) + **out = **in + } + } + if in.ExternalLabels != nil { + in, out := &in.ExternalLabels, &out.ExternalLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Storage != nil { + in, out := &in.Storage, &out.Storage + if *in == nil { + *out = nil + } else { + *out = new(StorageSpec) + (*in).DeepCopyInto(*out) + } + } + if in.RuleSelector != nil { + in, out := &in.RuleSelector, &out.RuleSelector + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + if in.RuleNamespaceSelector != nil { + in, out := &in.RuleNamespaceSelector, &out.RuleNamespaceSelector + if *in == nil { + *out = nil + } else { + *out = new(meta_v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + } + if in.Alerting != nil { + in, out := &in.Alerting, &out.Alerting + if *in == nil { + *out = nil + } else { + *out = new(AlertingSpec) + (*in).DeepCopyInto(*out) + } + } + in.Resources.DeepCopyInto(&out.Resources) + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Secrets != nil { + in, out := &in.Secrets, &out.Secrets + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ConfigMaps != nil { + in, out := &in.ConfigMaps, &out.ConfigMaps + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + if *in == nil { + *out = nil + } else { + *out = new(core_v1.Affinity) + (*in).DeepCopyInto(*out) + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]core_v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RemoteWrite != nil { + in, out := &in.RemoteWrite, &out.RemoteWrite + *out = make([]RemoteWriteSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RemoteRead != nil { + in, out := &in.RemoteRead, &out.RemoteRead + *out = make([]RemoteReadSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SecurityContext != nil { + in, out := &in.SecurityContext, &out.SecurityContext + if *in == nil { + *out = nil + } else { + *out = new(core_v1.PodSecurityContext) + (*in).DeepCopyInto(*out) + } + } + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]core_v1.Container, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.AdditionalScrapeConfigs != nil { + in, out := &in.AdditionalScrapeConfigs, &out.AdditionalScrapeConfigs + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.AdditionalAlertRelabelConfigs != nil { + in, out := &in.AdditionalAlertRelabelConfigs, &out.AdditionalAlertRelabelConfigs + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.AdditionalAlertManagerConfigs != nil { + in, out := &in.AdditionalAlertManagerConfigs, &out.AdditionalAlertManagerConfigs + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.APIServerConfig != nil { + in, out := &in.APIServerConfig, &out.APIServerConfig + if *in == nil { + *out = nil + } else { + *out = new(APIServerConfig) + (*in).DeepCopyInto(*out) + } + } + if in.Thanos != nil { + in, out := &in.Thanos, &out.Thanos + if *in == nil { + *out = nil + } else { + *out = new(ThanosSpec) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusSpec. +func (in *PrometheusSpec) DeepCopy() *PrometheusSpec { + if in == nil { + return nil + } + out := new(PrometheusSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrometheusStatus) DeepCopyInto(out *PrometheusStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusStatus. +func (in *PrometheusStatus) DeepCopy() *PrometheusStatus { + if in == nil { + return nil + } + out := new(PrometheusStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueueConfig) DeepCopyInto(out *QueueConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueConfig. +func (in *QueueConfig) DeepCopy() *QueueConfig { + if in == nil { + return nil + } + out := new(QueueConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RelabelConfig) DeepCopyInto(out *RelabelConfig) { + *out = *in + if in.SourceLabels != nil { + in, out := &in.SourceLabels, &out.SourceLabels + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RelabelConfig. +func (in *RelabelConfig) DeepCopy() *RelabelConfig { + if in == nil { + return nil + } + out := new(RelabelConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteReadSpec) DeepCopyInto(out *RemoteReadSpec) { + *out = *in + if in.RequiredMatchers != nil { + in, out := &in.RequiredMatchers, &out.RequiredMatchers + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + if *in == nil { + *out = nil + } else { + *out = new(BasicAuth) + (*in).DeepCopyInto(*out) + } + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteReadSpec. +func (in *RemoteReadSpec) DeepCopy() *RemoteReadSpec { + if in == nil { + return nil + } + out := new(RemoteReadSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RemoteWriteSpec) DeepCopyInto(out *RemoteWriteSpec) { + *out = *in + if in.WriteRelabelConfigs != nil { + in, out := &in.WriteRelabelConfigs, &out.WriteRelabelConfigs + *out = make([]RelabelConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.BasicAuth != nil { + in, out := &in.BasicAuth, &out.BasicAuth + if *in == nil { + *out = nil + } else { + *out = new(BasicAuth) + (*in).DeepCopyInto(*out) + } + } + if in.TLSConfig != nil { + in, out := &in.TLSConfig, &out.TLSConfig + if *in == nil { + *out = nil + } else { + *out = new(TLSConfig) + **out = **in + } + } + if in.QueueConfig != nil { + in, out := &in.QueueConfig, &out.QueueConfig + if *in == nil { + *out = nil + } else { + *out = new(QueueConfig) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteWriteSpec. +func (in *RemoteWriteSpec) DeepCopy() *RemoteWriteSpec { + if in == nil { + return nil + } + out := new(RemoteWriteSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Rule) DeepCopyInto(out *Rule) { + *out = *in + out.Expr = in.Expr + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule. +func (in *Rule) DeepCopy() *Rule { + if in == nil { + return nil + } + out := new(Rule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuleGroup) DeepCopyInto(out *RuleGroup) { + *out = *in + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + *out = make([]Rule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleGroup. +func (in *RuleGroup) DeepCopy() *RuleGroup { + if in == nil { + return nil + } + out := new(RuleGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceMonitor) DeepCopyInto(out *ServiceMonitor) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitor. +func (in *ServiceMonitor) DeepCopy() *ServiceMonitor { + if in == nil { + return nil + } + out := new(ServiceMonitor) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceMonitorList) DeepCopyInto(out *ServiceMonitorList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*ServiceMonitor, len(*in)) + for i := range *in { + if (*in)[i] == nil { + (*out)[i] = nil + } else { + (*out)[i] = new(ServiceMonitor) + (*in)[i].DeepCopyInto((*out)[i]) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitorList. +func (in *ServiceMonitorList) DeepCopy() *ServiceMonitorList { + if in == nil { + return nil + } + out := new(ServiceMonitorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceMonitorSpec) DeepCopyInto(out *ServiceMonitorSpec) { + *out = *in + if in.TargetLabels != nil { + in, out := &in.TargetLabels, &out.TargetLabels + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PodTargetLabels != nil { + in, out := &in.PodTargetLabels, &out.PodTargetLabels + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]Endpoint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.Selector.DeepCopyInto(&out.Selector) + in.NamespaceSelector.DeepCopyInto(&out.NamespaceSelector) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitorSpec. +func (in *ServiceMonitorSpec) DeepCopy() *ServiceMonitorSpec { + if in == nil { + return nil + } + out := new(ServiceMonitorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageSpec) DeepCopyInto(out *StorageSpec) { + *out = *in + if in.EmptyDir != nil { + in, out := &in.EmptyDir, &out.EmptyDir + if *in == nil { + *out = nil + } else { + *out = new(core_v1.EmptyDirVolumeSource) + (*in).DeepCopyInto(*out) + } + } + in.VolumeClaimTemplate.DeepCopyInto(&out.VolumeClaimTemplate) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageSpec. +func (in *StorageSpec) DeepCopy() *StorageSpec { + if in == nil { + return nil + } + out := new(StorageSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TLSConfig) DeepCopyInto(out *TLSConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSConfig. +func (in *TLSConfig) DeepCopy() *TLSConfig { + if in == nil { + return nil + } + out := new(TLSConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ThanosGCSSpec) DeepCopyInto(out *ThanosGCSSpec) { + *out = *in + if in.Bucket != nil { + in, out := &in.Bucket, &out.Bucket + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.SecretKey != nil { + in, out := &in.SecretKey, &out.SecretKey + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosGCSSpec. +func (in *ThanosGCSSpec) DeepCopy() *ThanosGCSSpec { + if in == nil { + return nil + } + out := new(ThanosGCSSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ThanosS3Spec) DeepCopyInto(out *ThanosS3Spec) { + *out = *in + if in.Bucket != nil { + in, out := &in.Bucket, &out.Bucket + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.Endpoint != nil { + in, out := &in.Endpoint, &out.Endpoint + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.AccessKey != nil { + in, out := &in.AccessKey, &out.AccessKey + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.SecretKey != nil { + in, out := &in.SecretKey, &out.SecretKey + if *in == nil { + *out = nil + } else { + *out = new(core_v1.SecretKeySelector) + (*in).DeepCopyInto(*out) + } + } + if in.Insecure != nil { + in, out := &in.Insecure, &out.Insecure + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + if in.SignatureVersion2 != nil { + in, out := &in.SignatureVersion2, &out.SignatureVersion2 + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + if in.EncryptSSE != nil { + in, out := &in.EncryptSSE, &out.EncryptSSE + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosS3Spec. +func (in *ThanosS3Spec) DeepCopy() *ThanosS3Spec { + if in == nil { + return nil + } + out := new(ThanosS3Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ThanosSpec) DeepCopyInto(out *ThanosSpec) { + *out = *in + if in.Peers != nil { + in, out := &in.Peers, &out.Peers + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.Version != nil { + in, out := &in.Version, &out.Version + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.Tag != nil { + in, out := &in.Tag, &out.Tag + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.SHA != nil { + in, out := &in.SHA, &out.SHA + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + if in.BaseImage != nil { + in, out := &in.BaseImage, &out.BaseImage + if *in == nil { + *out = nil + } else { + *out = new(string) + **out = **in + } + } + in.Resources.DeepCopyInto(&out.Resources) + if in.GCS != nil { + in, out := &in.GCS, &out.GCS + if *in == nil { + *out = nil + } else { + *out = new(ThanosGCSSpec) + (*in).DeepCopyInto(*out) + } + } + if in.S3 != nil { + in, out := &in.S3, &out.S3 + if *in == nil { + *out = nil + } else { + *out = new(ThanosS3Spec) + (*in).DeepCopyInto(*out) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosSpec. +func (in *ThanosSpec) DeepCopy() *ThanosSpec { + if in == nil { + return nil + } + out := new(ThanosSpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/factory.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/factory.go new file mode 100644 index 000000000..dbce27d46 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/factory.go @@ -0,0 +1,178 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + monitoring "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Monitoring() monitoring.Interface +} + +func (f *sharedInformerFactory) Monitoring() monitoring.Interface { + return monitoring.New(f, f.namespace, f.tweakListOptions) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/generic.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/generic.go new file mode 100644 index 000000000..a284f2671 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/generic.go @@ -0,0 +1,66 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=monitoring.coreos.com, Version=v1 + case v1.SchemeGroupVersion.WithResource("alertmanagers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().Alertmanagers().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("prometheuses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().Prometheuses().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("prometheusrules"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().PrometheusRules().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("servicemonitors"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().ServiceMonitors().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 000000000..edbe533dc --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,36 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/interface.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/interface.go new file mode 100644 index 000000000..0daf262b4 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/interface.go @@ -0,0 +1,44 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by informer-gen. DO NOT EDIT. + +package monitoring + +import ( + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/alertmanager.go new file mode 100644 index 000000000..f4b92c42a --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/alertmanager.go @@ -0,0 +1,87 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// AlertmanagerInformer provides access to a shared informer and lister for +// Alertmanagers. +type AlertmanagerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.AlertmanagerLister +} + +type alertmanagerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewAlertmanagerInformer constructs a new informer for Alertmanager type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewAlertmanagerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredAlertmanagerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredAlertmanagerInformer constructs a new informer for Alertmanager type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredAlertmanagerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().Alertmanagers(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().Alertmanagers(namespace).Watch(options) + }, + }, + &monitoring_v1.Alertmanager{}, + resyncPeriod, + indexers, + ) +} + +func (f *alertmanagerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredAlertmanagerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *alertmanagerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&monitoring_v1.Alertmanager{}, f.defaultInformer) +} + +func (f *alertmanagerInformer) Lister() v1.AlertmanagerLister { + return v1.NewAlertmanagerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/interface.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/interface.go new file mode 100644 index 000000000..05533da0c --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/interface.go @@ -0,0 +1,64 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Alertmanagers returns a AlertmanagerInformer. + Alertmanagers() AlertmanagerInformer + // Prometheuses returns a PrometheusInformer. + Prometheuses() PrometheusInformer + // PrometheusRules returns a PrometheusRuleInformer. + PrometheusRules() PrometheusRuleInformer + // ServiceMonitors returns a ServiceMonitorInformer. + ServiceMonitors() ServiceMonitorInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Alertmanagers returns a AlertmanagerInformer. +func (v *version) Alertmanagers() AlertmanagerInformer { + return &alertmanagerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Prometheuses returns a PrometheusInformer. +func (v *version) Prometheuses() PrometheusInformer { + return &prometheusInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PrometheusRules returns a PrometheusRuleInformer. +func (v *version) PrometheusRules() PrometheusRuleInformer { + return &prometheusRuleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ServiceMonitors returns a ServiceMonitorInformer. +func (v *version) ServiceMonitors() ServiceMonitorInformer { + return &serviceMonitorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheus.go new file mode 100644 index 000000000..46caf6c25 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheus.go @@ -0,0 +1,87 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PrometheusInformer provides access to a shared informer and lister for +// Prometheuses. +type PrometheusInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PrometheusLister +} + +type prometheusInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPrometheusInformer constructs a new informer for Prometheus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPrometheusInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPrometheusInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPrometheusInformer constructs a new informer for Prometheus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPrometheusInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().Prometheuses(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().Prometheuses(namespace).Watch(options) + }, + }, + &monitoring_v1.Prometheus{}, + resyncPeriod, + indexers, + ) +} + +func (f *prometheusInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPrometheusInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *prometheusInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&monitoring_v1.Prometheus{}, f.defaultInformer) +} + +func (f *prometheusInformer) Lister() v1.PrometheusLister { + return v1.NewPrometheusLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheusrule.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheusrule.go new file mode 100644 index 000000000..122d8e641 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/prometheusrule.go @@ -0,0 +1,87 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PrometheusRuleInformer provides access to a shared informer and lister for +// PrometheusRules. +type PrometheusRuleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PrometheusRuleLister +} + +type prometheusRuleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPrometheusRuleInformer constructs a new informer for PrometheusRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPrometheusRuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPrometheusRuleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPrometheusRuleInformer constructs a new informer for PrometheusRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPrometheusRuleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().PrometheusRules(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().PrometheusRules(namespace).Watch(options) + }, + }, + &monitoring_v1.PrometheusRule{}, + resyncPeriod, + indexers, + ) +} + +func (f *prometheusRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPrometheusRuleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *prometheusRuleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&monitoring_v1.PrometheusRule{}, f.defaultInformer) +} + +func (f *prometheusRuleInformer) Lister() v1.PrometheusRuleLister { + return v1.NewPrometheusRuleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/servicemonitor.go new file mode 100644 index 000000000..c9dd0ee41 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1/servicemonitor.go @@ -0,0 +1,87 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + time "time" + + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + internalinterfaces "github.com/coreos/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1" + versioned "github.com/coreos/prometheus-operator/pkg/client/versioned" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ServiceMonitorInformer provides access to a shared informer and lister for +// ServiceMonitors. +type ServiceMonitorInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ServiceMonitorLister +} + +type serviceMonitorInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceMonitorInformer constructs a new informer for ServiceMonitor type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceMonitorInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceMonitorInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceMonitorInformer constructs a new informer for ServiceMonitor type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceMonitorInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().ServiceMonitors(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.MonitoringV1().ServiceMonitors(namespace).Watch(options) + }, + }, + &monitoring_v1.ServiceMonitor{}, + resyncPeriod, + indexers, + ) +} + +func (f *serviceMonitorInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceMonitorInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serviceMonitorInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&monitoring_v1.ServiceMonitor{}, f.defaultInformer) +} + +func (f *serviceMonitorInformer) Lister() v1.ServiceMonitorLister { + return v1.NewServiceMonitorLister(f.Informer().GetIndexer()) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/alertmanager.go new file mode 100644 index 000000000..dcc5ee7ff --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/alertmanager.go @@ -0,0 +1,92 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// AlertmanagerLister helps list Alertmanagers. +type AlertmanagerLister interface { + // List lists all Alertmanagers in the indexer. + List(selector labels.Selector) (ret []*v1.Alertmanager, err error) + // Alertmanagers returns an object that can list and get Alertmanagers. + Alertmanagers(namespace string) AlertmanagerNamespaceLister + AlertmanagerListerExpansion +} + +// alertmanagerLister implements the AlertmanagerLister interface. +type alertmanagerLister struct { + indexer cache.Indexer +} + +// NewAlertmanagerLister returns a new AlertmanagerLister. +func NewAlertmanagerLister(indexer cache.Indexer) AlertmanagerLister { + return &alertmanagerLister{indexer: indexer} +} + +// List lists all Alertmanagers in the indexer. +func (s *alertmanagerLister) List(selector labels.Selector) (ret []*v1.Alertmanager, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Alertmanager)) + }) + return ret, err +} + +// Alertmanagers returns an object that can list and get Alertmanagers. +func (s *alertmanagerLister) Alertmanagers(namespace string) AlertmanagerNamespaceLister { + return alertmanagerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// AlertmanagerNamespaceLister helps list and get Alertmanagers. +type AlertmanagerNamespaceLister interface { + // List lists all Alertmanagers in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Alertmanager, err error) + // Get retrieves the Alertmanager from the indexer for a given namespace and name. + Get(name string) (*v1.Alertmanager, error) + AlertmanagerNamespaceListerExpansion +} + +// alertmanagerNamespaceLister implements the AlertmanagerNamespaceLister +// interface. +type alertmanagerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Alertmanagers in the indexer for a given namespace. +func (s alertmanagerNamespaceLister) List(selector labels.Selector) (ret []*v1.Alertmanager, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Alertmanager)) + }) + return ret, err +} + +// Get retrieves the Alertmanager from the indexer for a given namespace and name. +func (s alertmanagerNamespaceLister) Get(name string) (*v1.Alertmanager, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("alertmanager"), name) + } + return obj.(*v1.Alertmanager), nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/expansion_generated.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/expansion_generated.go new file mode 100644 index 000000000..9abc0af71 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/expansion_generated.go @@ -0,0 +1,49 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// AlertmanagerListerExpansion allows custom methods to be added to +// AlertmanagerLister. +type AlertmanagerListerExpansion interface{} + +// AlertmanagerNamespaceListerExpansion allows custom methods to be added to +// AlertmanagerNamespaceLister. +type AlertmanagerNamespaceListerExpansion interface{} + +// PrometheusListerExpansion allows custom methods to be added to +// PrometheusLister. +type PrometheusListerExpansion interface{} + +// PrometheusNamespaceListerExpansion allows custom methods to be added to +// PrometheusNamespaceLister. +type PrometheusNamespaceListerExpansion interface{} + +// PrometheusRuleListerExpansion allows custom methods to be added to +// PrometheusRuleLister. +type PrometheusRuleListerExpansion interface{} + +// PrometheusRuleNamespaceListerExpansion allows custom methods to be added to +// PrometheusRuleNamespaceLister. +type PrometheusRuleNamespaceListerExpansion interface{} + +// ServiceMonitorListerExpansion allows custom methods to be added to +// ServiceMonitorLister. +type ServiceMonitorListerExpansion interface{} + +// ServiceMonitorNamespaceListerExpansion allows custom methods to be added to +// ServiceMonitorNamespaceLister. +type ServiceMonitorNamespaceListerExpansion interface{} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheus.go new file mode 100644 index 000000000..d89d1d2e2 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheus.go @@ -0,0 +1,92 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PrometheusLister helps list Prometheuses. +type PrometheusLister interface { + // List lists all Prometheuses in the indexer. + List(selector labels.Selector) (ret []*v1.Prometheus, err error) + // Prometheuses returns an object that can list and get Prometheuses. + Prometheuses(namespace string) PrometheusNamespaceLister + PrometheusListerExpansion +} + +// prometheusLister implements the PrometheusLister interface. +type prometheusLister struct { + indexer cache.Indexer +} + +// NewPrometheusLister returns a new PrometheusLister. +func NewPrometheusLister(indexer cache.Indexer) PrometheusLister { + return &prometheusLister{indexer: indexer} +} + +// List lists all Prometheuses in the indexer. +func (s *prometheusLister) List(selector labels.Selector) (ret []*v1.Prometheus, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Prometheus)) + }) + return ret, err +} + +// Prometheuses returns an object that can list and get Prometheuses. +func (s *prometheusLister) Prometheuses(namespace string) PrometheusNamespaceLister { + return prometheusNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PrometheusNamespaceLister helps list and get Prometheuses. +type PrometheusNamespaceLister interface { + // List lists all Prometheuses in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Prometheus, err error) + // Get retrieves the Prometheus from the indexer for a given namespace and name. + Get(name string) (*v1.Prometheus, error) + PrometheusNamespaceListerExpansion +} + +// prometheusNamespaceLister implements the PrometheusNamespaceLister +// interface. +type prometheusNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Prometheuses in the indexer for a given namespace. +func (s prometheusNamespaceLister) List(selector labels.Selector) (ret []*v1.Prometheus, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Prometheus)) + }) + return ret, err +} + +// Get retrieves the Prometheus from the indexer for a given namespace and name. +func (s prometheusNamespaceLister) Get(name string) (*v1.Prometheus, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("prometheus"), name) + } + return obj.(*v1.Prometheus), nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheusrule.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheusrule.go new file mode 100644 index 000000000..b55bed8d1 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/prometheusrule.go @@ -0,0 +1,92 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PrometheusRuleLister helps list PrometheusRules. +type PrometheusRuleLister interface { + // List lists all PrometheusRules in the indexer. + List(selector labels.Selector) (ret []*v1.PrometheusRule, err error) + // PrometheusRules returns an object that can list and get PrometheusRules. + PrometheusRules(namespace string) PrometheusRuleNamespaceLister + PrometheusRuleListerExpansion +} + +// prometheusRuleLister implements the PrometheusRuleLister interface. +type prometheusRuleLister struct { + indexer cache.Indexer +} + +// NewPrometheusRuleLister returns a new PrometheusRuleLister. +func NewPrometheusRuleLister(indexer cache.Indexer) PrometheusRuleLister { + return &prometheusRuleLister{indexer: indexer} +} + +// List lists all PrometheusRules in the indexer. +func (s *prometheusRuleLister) List(selector labels.Selector) (ret []*v1.PrometheusRule, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PrometheusRule)) + }) + return ret, err +} + +// PrometheusRules returns an object that can list and get PrometheusRules. +func (s *prometheusRuleLister) PrometheusRules(namespace string) PrometheusRuleNamespaceLister { + return prometheusRuleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PrometheusRuleNamespaceLister helps list and get PrometheusRules. +type PrometheusRuleNamespaceLister interface { + // List lists all PrometheusRules in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.PrometheusRule, err error) + // Get retrieves the PrometheusRule from the indexer for a given namespace and name. + Get(name string) (*v1.PrometheusRule, error) + PrometheusRuleNamespaceListerExpansion +} + +// prometheusRuleNamespaceLister implements the PrometheusRuleNamespaceLister +// interface. +type prometheusRuleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PrometheusRules in the indexer for a given namespace. +func (s prometheusRuleNamespaceLister) List(selector labels.Selector) (ret []*v1.PrometheusRule, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PrometheusRule)) + }) + return ret, err +} + +// Get retrieves the PrometheusRule from the indexer for a given namespace and name. +func (s prometheusRuleNamespaceLister) Get(name string) (*v1.PrometheusRule, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("prometheusrule"), name) + } + return obj.(*v1.PrometheusRule), nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/servicemonitor.go new file mode 100644 index 000000000..4864592f6 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/listers/monitoring/v1/servicemonitor.go @@ -0,0 +1,92 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ServiceMonitorLister helps list ServiceMonitors. +type ServiceMonitorLister interface { + // List lists all ServiceMonitors in the indexer. + List(selector labels.Selector) (ret []*v1.ServiceMonitor, err error) + // ServiceMonitors returns an object that can list and get ServiceMonitors. + ServiceMonitors(namespace string) ServiceMonitorNamespaceLister + ServiceMonitorListerExpansion +} + +// serviceMonitorLister implements the ServiceMonitorLister interface. +type serviceMonitorLister struct { + indexer cache.Indexer +} + +// NewServiceMonitorLister returns a new ServiceMonitorLister. +func NewServiceMonitorLister(indexer cache.Indexer) ServiceMonitorLister { + return &serviceMonitorLister{indexer: indexer} +} + +// List lists all ServiceMonitors in the indexer. +func (s *serviceMonitorLister) List(selector labels.Selector) (ret []*v1.ServiceMonitor, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceMonitor)) + }) + return ret, err +} + +// ServiceMonitors returns an object that can list and get ServiceMonitors. +func (s *serviceMonitorLister) ServiceMonitors(namespace string) ServiceMonitorNamespaceLister { + return serviceMonitorNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServiceMonitorNamespaceLister helps list and get ServiceMonitors. +type ServiceMonitorNamespaceLister interface { + // List lists all ServiceMonitors in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.ServiceMonitor, err error) + // Get retrieves the ServiceMonitor from the indexer for a given namespace and name. + Get(name string) (*v1.ServiceMonitor, error) + ServiceMonitorNamespaceListerExpansion +} + +// serviceMonitorNamespaceLister implements the ServiceMonitorNamespaceLister +// interface. +type serviceMonitorNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ServiceMonitors in the indexer for a given namespace. +func (s serviceMonitorNamespaceLister) List(selector labels.Selector) (ret []*v1.ServiceMonitor, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceMonitor)) + }) + return ret, err +} + +// Get retrieves the ServiceMonitor from the indexer for a given namespace and name. +func (s serviceMonitorNamespaceLister) Get(name string) (*v1.ServiceMonitor, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("servicemonitor"), name) + } + return obj.(*v1.ServiceMonitor), nil +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/clientset.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/clientset.go deleted file mode 100644 index 98bf773d7..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/clientset.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2017 The prometheus-operator 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 monitoring - -import ( - "k8s.io/client-go/rest" - "k8s.io/client-go/util/flowcontrol" - - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1" -) - -var _ Interface = &Clientset{} - -type Interface interface { - MonitoringV1alpha1() v1alpha1.MonitoringV1alpha1Interface - MonitoringV1() v1.MonitoringV1Interface -} - -type Clientset struct { - *v1alpha1.MonitoringV1alpha1Client - *v1.MonitoringV1Client -} - -func (c *Clientset) MonitoringV1alpha1() v1alpha1.MonitoringV1alpha1Interface { - if c == nil { - return nil - } - return c.MonitoringV1alpha1Client -} - -func (c *Clientset) MonitoringV1() v1.MonitoringV1Interface { - if c == nil { - return nil - } - return c.MonitoringV1Client -} - -func NewForConfig(crdKinds *v1.CrdKinds, apiGroup string, c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - var cs Clientset - var err error - - cs.MonitoringV1alpha1Client, err = v1alpha1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - - cs.MonitoringV1Client, err = v1.NewForConfig(crdKinds, apiGroup, &configShallowCopy) - if err != nil { - return nil, err - } - - return &cs, nil -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/alertmanager.go deleted file mode 100644 index d2c80f132..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/alertmanager.go +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1 - -import ( - "encoding/json" - - "github.com/pkg/errors" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - dynamic "k8s.io/client-go/deprecated-dynamic" - "k8s.io/client-go/rest" -) - -const ( - AlertmanagersKind = "Alertmanager" - AlertmanagerName = "alertmanagers" -) - -type AlertmanagersGetter interface { - Alertmanagers(namespace string) AlertmanagerInterface -} - -var _ AlertmanagerInterface = &alertmanagers{} - -type AlertmanagerInterface interface { - Create(*Alertmanager) (*Alertmanager, error) - Get(name string, opts metav1.GetOptions) (*Alertmanager, error) - Update(*Alertmanager) (*Alertmanager, error) - Delete(name string, options *metav1.DeleteOptions) error - List(opts metav1.ListOptions) (runtime.Object, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error -} - -type alertmanagers struct { - restClient rest.Interface - client dynamic.ResourceInterface - crdKind CrdKind - ns string -} - -func newAlertmanagers(r rest.Interface, c *dynamic.Client, crdKind CrdKind, namespace string) *alertmanagers { - return &alertmanagers{ - restClient: r, - client: c.Resource( - &metav1.APIResource{ - Kind: crdKind.Kind, - Name: crdKind.Plural, - Namespaced: true, - }, - namespace, - ), - crdKind: crdKind, - ns: namespace, - } -} - -func (a *alertmanagers) Create(o *Alertmanager) (*Alertmanager, error) { - ua, err := UnstructuredFromAlertmanager(o) - if err != nil { - return nil, err - } - - ua, err = a.client.Create(ua) - if err != nil { - return nil, err - } - - return AlertmanagerFromUnstructured(ua) -} - -func (a *alertmanagers) Get(name string, opts metav1.GetOptions) (*Alertmanager, error) { - obj, err := a.client.Get(name, opts) - if err != nil { - return nil, err - } - return AlertmanagerFromUnstructured(obj) -} - -func (a *alertmanagers) Update(o *Alertmanager) (*Alertmanager, error) { - ua, err := UnstructuredFromAlertmanager(o) - if err != nil { - return nil, err - } - - cura, err := a.Get(o.Name, metav1.GetOptions{}) - if err != nil { - return nil, errors.Wrap(err, "unable to get current version for update") - } - ua.SetResourceVersion(cura.ObjectMeta.ResourceVersion) - - ua, err = a.client.Update(ua) - if err != nil { - return nil, err - } - - return AlertmanagerFromUnstructured(ua) -} - -func (a *alertmanagers) Delete(name string, options *metav1.DeleteOptions) error { - return a.client.Delete(name, options) -} - -func (a *alertmanagers) List(opts metav1.ListOptions) (runtime.Object, error) { - req := a.restClient.Get(). - Namespace(a.ns). - Resource(a.crdKind.Plural) - - b, err := req.DoRaw() - if err != nil { - return nil, err - } - var p AlertmanagerList - return &p, json.Unmarshal(b, &p) -} - -func (a *alertmanagers) Watch(opts metav1.ListOptions) (watch.Interface, error) { - r, err := a.restClient.Get(). - Prefix("watch"). - Namespace(a.ns). - Resource(a.crdKind.Plural). - Stream() - if err != nil { - return nil, err - } - return watch.NewStreamWatcher(&alertmanagerDecoder{ - dec: json.NewDecoder(r), - close: r.Close, - }), nil - -} - -func (a *alertmanagers) DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error { - return a.client.DeleteCollection(dopts, lopts) -} - -// AlertmanagerFromUnstructured unmarshals an Alertmanager object from dynamic client's unstructured -func AlertmanagerFromUnstructured(r *unstructured.Unstructured) (*Alertmanager, error) { - b, err := json.Marshal(r.Object) - if err != nil { - return nil, err - } - var a Alertmanager - if err := json.Unmarshal(b, &a); err != nil { - return nil, err - } - a.TypeMeta.Kind = AlertmanagersKind - a.TypeMeta.APIVersion = Group + "/" + Version - return &a, nil -} - -// UnstructuredFromAlertmanager marshals an Alertmanager object into dynamic client's unstructured -func UnstructuredFromAlertmanager(a *Alertmanager) (*unstructured.Unstructured, error) { - a.TypeMeta.Kind = AlertmanagersKind - a.TypeMeta.APIVersion = Group + "/" + Version - b, err := json.Marshal(a) - if err != nil { - return nil, err - } - var r unstructured.Unstructured - if err := json.Unmarshal(b, &r.Object); err != nil { - return nil, err - } - // Value-type timestamp fields like ObjectMeta.CreationTimestamp with a zero - // value are marshalled as "null" in JSON (rather than omitted) and then - // unmarshalled into Unstructured with the key intact and a null value (rather - // than being omitted); the net effect is the resulting structs can't be used - // to issue a POST because creationTimestamp=null is sent to the server and - // fails validation. For example, passing an Alertmanager with a - // volumeClaimTemplate can result in an invalid object. This hack simply - // removes such timestamp fields manually. - // - // TODO: reevaluate the use of Unstructured directly here in the context of - // the latest dynamic client capabilities; this manual conversion may not be - // necessary anymore. - unstructured.RemoveNestedField(r.Object, "metadata", "creationTimestamp") - unstructured.RemoveNestedField(r.Object, "spec", "storage", "volumeClaimTemplate", "metadata", "creationTimestamp") - unstructured.RemoveNestedField(r.Object, "spec", "podMetadata", "creationTimestamp") - return &r, nil -} - -type alertmanagerDecoder struct { - dec *json.Decoder - close func() error -} - -func (d *alertmanagerDecoder) Close() { - d.close() -} - -func (d *alertmanagerDecoder) Decode() (action watch.EventType, object runtime.Object, err error) { - var e struct { - Type watch.EventType - Object Alertmanager - } - if err := d.dec.Decode(&e); err != nil { - return watch.Error, nil, err - } - return e.Type, &e.Object, nil -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/alertmanager_test.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/alertmanager_test.go deleted file mode 100644 index fa0966df3..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/alertmanager_test.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2018 The prometheus-operator 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 v1 - -import ( - "reflect" - "testing" - - "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - - "github.com/kylelemons/godebug/pretty" -) - -// TestAlertmanagerUnstructuredTimestamps ensures that an Alertmanager with many -// default values can be converted into an Unstructured which would be valid to -// POST (this is primarily to ensure that creationTimestamp is omitted). -func TestAlertmanagerUnstructuredTimestamps(t *testing.T) { - p := &Alertmanager{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", - }, - Spec: AlertmanagerSpec{ - Storage: &StorageSpec{ - VolumeClaimTemplate: v1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", - }, - Spec: v1.PersistentVolumeClaimSpec{}, - }, - }, - }, - } - - actual, err := UnstructuredFromAlertmanager(p) - if err != nil { - t.Fatalf("err: %v", err) - } - - expected := &unstructured.Unstructured{ - Object: map[string]interface{}{ - "kind": "Alertmanager", - "apiVersion": "monitoring.coreos.com/v1", - "metadata": map[string]interface{}{ - "name": "test", - }, - "spec": map[string]interface{}{ - "resources": map[string]interface{}{}, - "storage": map[string]interface{}{ - "resources": map[string]interface{}{}, - "volumeClaimTemplate": map[string]interface{}{ - "metadata": map[string]interface{}{ - "name": "test", - }, - "spec": map[string]interface{}{ - "dataSource": nil, - "resources": map[string]interface{}{}, - }, - "status": map[string]interface{}{}, - }, - }, - }, - }, - } - - if e, a := expected.Object, actual.Object; !reflect.DeepEqual(e, a) { - t.Fatal(pretty.Compare(e, a)) - } -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/client.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/client.go deleted file mode 100644 index f63c895cd..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/client.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1 - -import ( - "fmt" - "strings" - - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/runtime/serializer" - dynamic "k8s.io/client-go/deprecated-dynamic" - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" -) - -const ( - Group = "monitoring.coreos.com" - PrometheusKindKey = "prometheus" - AlertManagerKindKey = "alertmanager" - ServiceMonitorKindKey = "servicemonitor" - PrometheusRuleKindKey = "prometheusrule" -) - -type CrdKind struct { - Kind string - Plural string - SpecName string -} - -type CrdKinds struct { - KindsString string - Prometheus CrdKind - Alertmanager CrdKind - ServiceMonitor CrdKind - PrometheusRule CrdKind -} - -var DefaultCrdKinds = CrdKinds{ - KindsString: "", - Prometheus: CrdKind{Plural: PrometheusName, Kind: PrometheusesKind, SpecName: "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Prometheus"}, - ServiceMonitor: CrdKind{Plural: ServiceMonitorName, Kind: ServiceMonitorsKind, SpecName: "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.ServiceMonitor"}, - Alertmanager: CrdKind{Plural: AlertmanagerName, Kind: AlertmanagersKind, SpecName: "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.Alertmanager"}, - PrometheusRule: CrdKind{Plural: PrometheusRuleName, Kind: PrometheusRuleKind, SpecName: "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1.PrometheusRule"}, -} - -// Implement the flag.Value interface -func (crdkinds *CrdKinds) String() string { - return crdkinds.KindsString -} - -// Set Implement the flag.Set interface -func (crdkinds *CrdKinds) Set(value string) error { - *crdkinds = DefaultCrdKinds - if value == "" { - value = fmt.Sprintf("%s=%s:%s,%s=%s:%s,%s=%s:%s,%s=%s:%s", - PrometheusKindKey, PrometheusesKind, PrometheusName, - AlertManagerKindKey, AlertmanagersKind, AlertmanagerName, - ServiceMonitorKindKey, ServiceMonitorsKind, ServiceMonitorName, - PrometheusRuleKindKey, PrometheusRuleKind, PrometheusRuleName, - ) - } - splited := strings.Split(value, ",") - for _, pair := range splited { - sp := strings.Split(pair, "=") - kind := strings.Split(sp[1], ":") - crdKind := CrdKind{Plural: kind[1], Kind: kind[0]} - switch kindKey := sp[0]; kindKey { - case PrometheusKindKey: - (*crdkinds).Prometheus = crdKind - case ServiceMonitorKindKey: - (*crdkinds).ServiceMonitor = crdKind - case AlertManagerKindKey: - (*crdkinds).Alertmanager = crdKind - case PrometheusRuleKindKey: - (*crdkinds).PrometheusRule = crdKind - default: - fmt.Printf("Warning: unknown kind: %s... ignoring", kindKey) - } - - } - (*crdkinds).KindsString = value - return nil -} - -var Version = "v1" - -type MonitoringV1Interface interface { - RESTClient() rest.Interface - PrometheusesGetter - AlertmanagersGetter - ServiceMonitorsGetter - PrometheusRulesGetter -} - -// +k8s:deepcopy-gen=false -type MonitoringV1Client struct { - restClient rest.Interface - dynamicClient *dynamic.Client - crdKinds *CrdKinds -} - -func (c *MonitoringV1Client) Prometheuses(namespace string) PrometheusInterface { - return newPrometheuses(c.restClient, c.dynamicClient, c.crdKinds.Prometheus, namespace) -} - -func (c *MonitoringV1Client) Alertmanagers(namespace string) AlertmanagerInterface { - return newAlertmanagers(c.restClient, c.dynamicClient, c.crdKinds.Alertmanager, namespace) -} - -func (c *MonitoringV1Client) ServiceMonitors(namespace string) ServiceMonitorInterface { - return newServiceMonitors(c.restClient, c.dynamicClient, c.crdKinds.ServiceMonitor, namespace) -} - -func (c *MonitoringV1Client) PrometheusRules(namespace string) PrometheusRuleInterface { - return newPrometheusRules(c.restClient, c.dynamicClient, c.crdKinds.PrometheusRule, namespace) -} - -func (c *MonitoringV1Client) RESTClient() rest.Interface { - return c.restClient -} - -func NewForConfig(crdKinds *CrdKinds, apiGroup string, c *rest.Config) (*MonitoringV1Client, error) { - config := *c - SetConfigDefaults(apiGroup, &config) - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - - dynamicClient, err := dynamic.NewClient(&config, schema.GroupVersion{ - Group: apiGroup, - Version: Version, - }) - if err != nil { - return nil, err - } - - return &MonitoringV1Client{client, dynamicClient, crdKinds}, nil -} - -func SetConfigDefaults(apiGroup string, config *rest.Config) { - config.GroupVersion = &schema.GroupVersion{ - Group: apiGroup, - Version: Version, - } - config.APIPath = "/apis" - config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} - return -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/doc.go deleted file mode 100644 index dd445deda..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The prometheus-operator 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. - -// +k8s:deepcopy-gen=package - -package v1 diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/prometheus.go deleted file mode 100644 index b18d9a057..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/prometheus.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1 - -import ( - "encoding/json" - - "github.com/pkg/errors" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - dynamic "k8s.io/client-go/deprecated-dynamic" - "k8s.io/client-go/rest" -) - -const ( - PrometheusesKind = "Prometheus" - PrometheusName = "prometheuses" -) - -type PrometheusesGetter interface { - Prometheuses(namespace string) PrometheusInterface -} - -var _ PrometheusInterface = &prometheuses{} - -type PrometheusInterface interface { - Create(*Prometheus) (*Prometheus, error) - Get(name string, opts metav1.GetOptions) (*Prometheus, error) - Update(*Prometheus) (*Prometheus, error) - Delete(name string, options *metav1.DeleteOptions) error - List(opts metav1.ListOptions) (runtime.Object, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error -} - -type prometheuses struct { - restClient rest.Interface - client dynamic.ResourceInterface - crdKind CrdKind - ns string -} - -func newPrometheuses(r rest.Interface, c *dynamic.Client, crdKind CrdKind, namespace string) *prometheuses { - return &prometheuses{ - restClient: r, - client: c.Resource( - &metav1.APIResource{ - Kind: crdKind.Kind, - Name: crdKind.Plural, - Namespaced: true, - }, - namespace, - ), - crdKind: crdKind, - ns: namespace, - } -} - -func (p *prometheuses) Create(o *Prometheus) (*Prometheus, error) { - up, err := UnstructuredFromPrometheus(o) - if err != nil { - return nil, err - } - - up, err = p.client.Create(up) - if err != nil { - return nil, err - } - - return PrometheusFromUnstructured(up) -} - -func (p *prometheuses) Get(name string, opts metav1.GetOptions) (*Prometheus, error) { - obj, err := p.client.Get(name, opts) - if err != nil { - return nil, err - } - return PrometheusFromUnstructured(obj) -} - -func (p *prometheuses) Update(o *Prometheus) (*Prometheus, error) { - up, err := UnstructuredFromPrometheus(o) - if err != nil { - return nil, err - } - - curp, err := p.Get(o.Name, metav1.GetOptions{}) - if err != nil { - return nil, errors.Wrap(err, "unable to get current version for update") - } - up.SetResourceVersion(curp.ObjectMeta.ResourceVersion) - - up, err = p.client.Update(up) - if err != nil { - return nil, err - } - - return PrometheusFromUnstructured(up) -} - -func (p *prometheuses) Delete(name string, options *metav1.DeleteOptions) error { - return p.client.Delete(name, options) -} - -func (p *prometheuses) List(opts metav1.ListOptions) (runtime.Object, error) { - req := p.restClient.Get(). - Namespace(p.ns). - Resource(p.crdKind.Plural) - - b, err := req.DoRaw() - if err != nil { - return nil, err - } - var prom PrometheusList - return &prom, json.Unmarshal(b, &prom) -} - -func (p *prometheuses) Watch(opts metav1.ListOptions) (watch.Interface, error) { - r, err := p.restClient.Get(). - Prefix("watch"). - Namespace(p.ns). - Resource(p.crdKind.Plural). - Stream() - if err != nil { - return nil, err - } - return watch.NewStreamWatcher(&prometheusDecoder{ - dec: json.NewDecoder(r), - close: r.Close, - }), nil -} - -func (p *prometheuses) DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error { - return p.client.DeleteCollection(dopts, lopts) -} - -// PrometheusFromUnstructured unmarshals a Prometheus object from dynamic client's unstructured -func PrometheusFromUnstructured(r *unstructured.Unstructured) (*Prometheus, error) { - b, err := json.Marshal(r.Object) - if err != nil { - return nil, err - } - var p Prometheus - if err := json.Unmarshal(b, &p); err != nil { - return nil, err - } - p.TypeMeta.Kind = PrometheusesKind - p.TypeMeta.APIVersion = Group + "/" + Version - return &p, nil -} - -// UnstructuredFromPrometheus marshals a Prometheus object into dynamic client's unstructured -func UnstructuredFromPrometheus(p *Prometheus) (*unstructured.Unstructured, error) { - p.TypeMeta.Kind = PrometheusesKind - p.TypeMeta.APIVersion = Group + "/" + Version - b, err := json.Marshal(p) - if err != nil { - return nil, err - } - var r unstructured.Unstructured - if err := json.Unmarshal(b, &r.Object); err != nil { - return nil, err - } - // Value-type timestamp fields like ObjectMeta.CreationTimestamp with a zero - // value are marshalled as "null" in JSON (rather than omitted) and then - // unmarshalled into Unstructured with the key intact and a null value (rather - // than being omitted); the net effect is the resulting structs can't be used - // to issue a POST because creationTimestamp=null is sent to the server and - // fails validation. For example, passing a Prometheus with a - // volumeClaimTemplate can result in an invalid object. This hack simply - // removes such timestamp fields manually. - // - // TODO: reevaluate the use of Unstructured directly here in the context of - // the latest dynamic client capabilities; this manual conversion may not be - // necessary anymore. - unstructured.RemoveNestedField(r.Object, "metadata", "creationTimestamp") - unstructured.RemoveNestedField(r.Object, "spec", "storage", "volumeClaimTemplate", "metadata", "creationTimestamp") - unstructured.RemoveNestedField(r.Object, "spec", "podMetadata", "creationTimestamp") - return &r, nil -} - -type prometheusDecoder struct { - dec *json.Decoder - close func() error -} - -func (d *prometheusDecoder) Close() { - d.close() -} - -func (d *prometheusDecoder) Decode() (action watch.EventType, object runtime.Object, err error) { - var e struct { - Type watch.EventType - Object Prometheus - } - if err := d.dec.Decode(&e); err != nil { - return watch.Error, nil, err - } - return e.Type, &e.Object, nil -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/prometheus_test.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/prometheus_test.go deleted file mode 100644 index 0628fa615..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/prometheus_test.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2018 The prometheus-operator 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 v1 - -import ( - "reflect" - "testing" - - "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - - "github.com/kylelemons/godebug/pretty" -) - -// TestPrometheusUnstructuredTimestamps ensures that a Prometheus with many -// default values can be converted into an Unstructured which would be valid to -// POST (this is primarily to ensure that creationTimestamp is omitted). -func TestPrometheusUnstructuredTimestamps(t *testing.T) { - p := &Prometheus{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", - }, - Spec: PrometheusSpec{ - Storage: &StorageSpec{ - VolumeClaimTemplate: v1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", - }, - Spec: v1.PersistentVolumeClaimSpec{}, - }, - }, - }, - } - - actual, err := UnstructuredFromPrometheus(p) - if err != nil { - t.Fatalf("err: %v", err) - } - - expected := &unstructured.Unstructured{ - Object: map[string]interface{}{ - "kind": "Prometheus", - "apiVersion": "monitoring.coreos.com/v1", - "metadata": map[string]interface{}{ - "name": "test", - }, - "spec": map[string]interface{}{ - "resources": map[string]interface{}{}, - "storage": map[string]interface{}{ - "resources": map[string]interface{}{}, - "volumeClaimTemplate": map[string]interface{}{ - "metadata": map[string]interface{}{ - "name": "test", - }, - "spec": map[string]interface{}{ - "dataSource": nil, - "resources": map[string]interface{}{}, - }, - "status": map[string]interface{}{}, - }, - }, - }, - }, - } - - if e, a := expected.Object, actual.Object; !reflect.DeepEqual(e, a) { - t.Fatal(pretty.Compare(e, a)) - } -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/prometheusrule.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/prometheusrule.go deleted file mode 100644 index 4adb04d76..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/prometheusrule.go +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1 - -import ( - "encoding/json" - - "github.com/pkg/errors" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - dynamic "k8s.io/client-go/deprecated-dynamic" - "k8s.io/client-go/rest" -) - -const ( - PrometheusRuleKind = "PrometheusRule" - PrometheusRuleName = "prometheusrules" -) - -type PrometheusRulesGetter interface { - PrometheusRules(namespace string) PrometheusRuleInterface -} - -var _ PrometheusRuleInterface = &prometheusrules{} - -type PrometheusRuleInterface interface { - Create(*PrometheusRule) (*PrometheusRule, error) - Get(name string, opts metav1.GetOptions) (*PrometheusRule, error) - Update(*PrometheusRule) (*PrometheusRule, error) - Delete(name string, options *metav1.DeleteOptions) error - List(opts metav1.ListOptions) (runtime.Object, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error -} - -type prometheusrules struct { - restClient rest.Interface - client dynamic.ResourceInterface - crdKind CrdKind - ns string -} - -func newPrometheusRules(r rest.Interface, c *dynamic.Client, crdKind CrdKind, namespace string) *prometheusrules { - return &prometheusrules{ - restClient: r, - client: c.Resource( - &metav1.APIResource{ - Kind: crdKind.Kind, - Name: crdKind.Plural, - Namespaced: true, - }, - namespace, - ), - crdKind: crdKind, - ns: namespace, - } -} - -func (s *prometheusrules) Create(o *PrometheusRule) (*PrometheusRule, error) { - us, err := UnstructuredFromPrometheusRule(o) - if err != nil { - return nil, err - } - - us, err = s.client.Create(us) - if err != nil { - return nil, err - } - - return PrometheusRuleFromUnstructured(us) -} - -func (s *prometheusrules) Get(name string, opts metav1.GetOptions) (*PrometheusRule, error) { - obj, err := s.client.Get(name, opts) - if err != nil { - return nil, err - } - return PrometheusRuleFromUnstructured(obj) -} - -func (s *prometheusrules) Update(o *PrometheusRule) (*PrometheusRule, error) { - us, err := UnstructuredFromPrometheusRule(o) - if err != nil { - return nil, err - } - - curs, err := s.Get(o.Name, metav1.GetOptions{}) - if err != nil { - return nil, errors.Wrap(err, "unable to get current version for update") - } - us.SetResourceVersion(curs.ObjectMeta.ResourceVersion) - - us, err = s.client.Update(us) - if err != nil { - return nil, err - } - - return PrometheusRuleFromUnstructured(us) -} - -func (s *prometheusrules) Delete(name string, options *metav1.DeleteOptions) error { - return s.client.Delete(name, options) -} - -func (s *prometheusrules) List(opts metav1.ListOptions) (runtime.Object, error) { - req := s.restClient.Get(). - Namespace(s.ns). - Resource(s.crdKind.Plural) - - b, err := req.DoRaw() - if err != nil { - return nil, err - } - var sm PrometheusRuleList - return &sm, json.Unmarshal(b, &sm) -} - -func (s *prometheusrules) Watch(opts metav1.ListOptions) (watch.Interface, error) { - r, err := s.restClient.Get(). - Prefix("watch"). - Namespace(s.ns). - Resource(s.crdKind.Plural). - Stream() - if err != nil { - return nil, err - } - return watch.NewStreamWatcher(&prometheusRuleDecoder{ - dec: json.NewDecoder(r), - close: r.Close, - }), nil -} - -func (s *prometheusrules) DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error { - return s.client.DeleteCollection(dopts, lopts) -} - -// PrometheusRuleFromUnstructured unmarshals a PrometheusRule object from dynamic client's unstructured -func PrometheusRuleFromUnstructured(r *unstructured.Unstructured) (*PrometheusRule, error) { - b, err := json.Marshal(r.Object) - if err != nil { - return nil, err - } - var s PrometheusRule - if err := json.Unmarshal(b, &s); err != nil { - return nil, err - } - s.TypeMeta.Kind = PrometheusRuleKind - s.TypeMeta.APIVersion = Group + "/" + Version - return &s, nil -} - -// UnstructuredFromPrometheusRule marshals a PrometheusRule object into dynamic client's unstructured -func UnstructuredFromPrometheusRule(s *PrometheusRule) (*unstructured.Unstructured, error) { - s.TypeMeta.Kind = PrometheusRuleKind - s.TypeMeta.APIVersion = Group + "/" + Version - b, err := json.Marshal(s) - if err != nil { - return nil, err - } - var r unstructured.Unstructured - if err := json.Unmarshal(b, &r.Object); err != nil { - return nil, err - } - return &r, nil -} - -type prometheusRuleDecoder struct { - dec *json.Decoder - close func() error -} - -func (d *prometheusRuleDecoder) Close() { - d.close() -} - -func (d *prometheusRuleDecoder) Decode() (action watch.EventType, object runtime.Object, err error) { - var e struct { - Type watch.EventType - Object PrometheusRule - } - if err := d.dec.Decode(&e); err != nil { - return watch.Error, nil, err - } - return e.Type, &e.Object, nil -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/servicemonitor.go deleted file mode 100644 index 243046993..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/servicemonitor.go +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1 - -import ( - "encoding/json" - - "github.com/pkg/errors" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - dynamic "k8s.io/client-go/deprecated-dynamic" - "k8s.io/client-go/rest" -) - -const ( - ServiceMonitorsKind = "ServiceMonitor" - ServiceMonitorName = "servicemonitors" -) - -type ServiceMonitorsGetter interface { - ServiceMonitors(namespace string) ServiceMonitorInterface -} - -var _ ServiceMonitorInterface = &servicemonitors{} - -type ServiceMonitorInterface interface { - Create(*ServiceMonitor) (*ServiceMonitor, error) - Get(name string, opts metav1.GetOptions) (*ServiceMonitor, error) - Update(*ServiceMonitor) (*ServiceMonitor, error) - Delete(name string, options *metav1.DeleteOptions) error - List(opts metav1.ListOptions) (runtime.Object, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error -} - -type servicemonitors struct { - restClient rest.Interface - client dynamic.ResourceInterface - crdKind CrdKind - ns string -} - -func newServiceMonitors(r rest.Interface, c *dynamic.Client, crdKind CrdKind, namespace string) *servicemonitors { - return &servicemonitors{ - restClient: r, - client: c.Resource( - &metav1.APIResource{ - Kind: crdKind.Kind, - Name: crdKind.Plural, - Namespaced: true, - }, - namespace, - ), - crdKind: crdKind, - ns: namespace, - } -} - -func (s *servicemonitors) Create(o *ServiceMonitor) (*ServiceMonitor, error) { - us, err := UnstructuredFromServiceMonitor(o) - if err != nil { - return nil, err - } - - us, err = s.client.Create(us) - if err != nil { - return nil, err - } - - return ServiceMonitorFromUnstructured(us) -} - -func (s *servicemonitors) Get(name string, opts metav1.GetOptions) (*ServiceMonitor, error) { - obj, err := s.client.Get(name, opts) - if err != nil { - return nil, err - } - return ServiceMonitorFromUnstructured(obj) -} - -func (s *servicemonitors) Update(o *ServiceMonitor) (*ServiceMonitor, error) { - us, err := UnstructuredFromServiceMonitor(o) - if err != nil { - return nil, err - } - - curs, err := s.Get(o.Name, metav1.GetOptions{}) - if err != nil { - return nil, errors.Wrap(err, "unable to get current version for update") - } - us.SetResourceVersion(curs.ObjectMeta.ResourceVersion) - - us, err = s.client.Update(us) - if err != nil { - return nil, err - } - - return ServiceMonitorFromUnstructured(us) -} - -func (s *servicemonitors) Delete(name string, options *metav1.DeleteOptions) error { - return s.client.Delete(name, options) -} - -func (s *servicemonitors) List(opts metav1.ListOptions) (runtime.Object, error) { - req := s.restClient.Get(). - Namespace(s.ns). - Resource(s.crdKind.Plural) - - b, err := req.DoRaw() - if err != nil { - return nil, err - } - var sm ServiceMonitorList - return &sm, json.Unmarshal(b, &sm) -} - -func (s *servicemonitors) Watch(opts metav1.ListOptions) (watch.Interface, error) { - r, err := s.restClient.Get(). - Prefix("watch"). - Namespace(s.ns). - Resource(s.crdKind.Plural). - Stream() - if err != nil { - return nil, err - } - return watch.NewStreamWatcher(&serviceMonitorDecoder{ - dec: json.NewDecoder(r), - close: r.Close, - }), nil -} - -func (s *servicemonitors) DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error { - return s.client.DeleteCollection(dopts, lopts) -} - -// ServiceMonitorFromUnstructured unmarshals a ServiceMonitor object from dynamic client's unstructured -func ServiceMonitorFromUnstructured(r *unstructured.Unstructured) (*ServiceMonitor, error) { - b, err := json.Marshal(r.Object) - if err != nil { - return nil, err - } - var s ServiceMonitor - if err := json.Unmarshal(b, &s); err != nil { - return nil, err - } - s.TypeMeta.Kind = ServiceMonitorsKind - s.TypeMeta.APIVersion = Group + "/" + Version - return &s, nil -} - -// UnstructuredFromServiceMonitor marshals a ServiceMonitor object into dynamic client's unstructured -func UnstructuredFromServiceMonitor(s *ServiceMonitor) (*unstructured.Unstructured, error) { - s.TypeMeta.Kind = ServiceMonitorsKind - s.TypeMeta.APIVersion = Group + "/" + Version - b, err := json.Marshal(s) - if err != nil { - return nil, err - } - var r unstructured.Unstructured - if err := json.Unmarshal(b, &r.Object); err != nil { - return nil, err - } - return &r, nil -} - -type serviceMonitorDecoder struct { - dec *json.Decoder - close func() error -} - -func (d *serviceMonitorDecoder) Close() { - d.close() -} - -func (d *serviceMonitorDecoder) Decode() (action watch.EventType, object runtime.Object, err error) { - var e struct { - Type watch.EventType - Object ServiceMonitor - } - if err := d.dec.Decode(&e); err != nil { - return watch.Error, nil, err - } - return e.Type, &e.Object, nil -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/types.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/types.go deleted file mode 100644 index 31e3449ec..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/types.go +++ /dev/null @@ -1,785 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1 - -import ( - "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/intstr" -) - -// Prometheus defines a Prometheus deployment. -// +k8s:openapi-gen=true -type Prometheus struct { - metav1.TypeMeta `json:",inline"` - // Standard object’s metadata. More info: - // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - // +k8s:openapi-gen=false - metav1.ObjectMeta `json:"metadata,omitempty"` - // Specification of the desired behavior of the Prometheus cluster. More info: - // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status - Spec PrometheusSpec `json:"spec"` - // Most recent observed status of the Prometheus cluster. Read-only. Not - // included when requesting from the apiserver, only from the Prometheus - // Operator API itself. More info: - // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status - Status *PrometheusStatus `json:"status,omitempty"` -} - -// PrometheusList is a list of Prometheuses. -// +k8s:openapi-gen=true -type PrometheusList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - metav1.ListMeta `json:"metadata,omitempty"` - // List of Prometheuses - Items []*Prometheus `json:"items"` -} - -// PrometheusSpec is a specification of the desired behavior of the Prometheus cluster. More info: -// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status -// +k8s:openapi-gen=true -type PrometheusSpec struct { - // Standard object’s metadata. More info: - // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - // Metadata Labels and Annotations gets propagated to the prometheus pods. - PodMetadata *metav1.ObjectMeta `json:"podMetadata,omitempty"` - // ServiceMonitors to be selected for target discovery. - ServiceMonitorSelector *metav1.LabelSelector `json:"serviceMonitorSelector,omitempty"` - // Namespaces to be selected for ServiceMonitor discovery. If nil, only - // check own namespace. - ServiceMonitorNamespaceSelector *metav1.LabelSelector `json:"serviceMonitorNamespaceSelector,omitempty"` - // Version of Prometheus to be deployed. - Version string `json:"version,omitempty"` - // Tag of Prometheus container image to be deployed. Defaults to the value of `version`. - // Version is ignored if Tag is set. - Tag string `json:"tag,omitempty"` - // SHA of Prometheus container image to be deployed. Defaults to the value of `version`. - // Similar to a tag, but the SHA explicitly deploys an immutable container image. - // Version and Tag are ignored if SHA is set. - SHA string `json:"sha,omitempty"` - // When a Prometheus deployment is paused, no actions except for deletion - // will be performed on the underlying objects. - Paused bool `json:"paused,omitempty"` - // Base image to use for a Prometheus deployment. - BaseImage string `json:"baseImage,omitempty"` - // An optional list of references to secrets in the same namespace - // to use for pulling prometheus and alertmanager images from registries - // see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod - ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"` - // Number of instances to deploy for a Prometheus deployment. - Replicas *int32 `json:"replicas,omitempty"` - // Time duration Prometheus shall retain data for. Default is '24h', - // and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years). - Retention string `json:"retention,omitempty"` - // Log level for Prometheus to be configured with. - LogLevel string `json:"logLevel,omitempty"` - // Interval between consecutive scrapes. - ScrapeInterval string `json:"scrapeInterval,omitempty"` - // Interval between consecutive evaluations. - EvaluationInterval string `json:"evaluationInterval,omitempty"` - // The labels to add to any time series or alerts when communicating with - // external systems (federation, remote storage, Alertmanager). - ExternalLabels map[string]string `json:"externalLabels,omitempty"` - // The external URL the Prometheus instances will be available under. This is - // necessary to generate correct URLs. This is necessary if Prometheus is not - // served from root of a DNS name. - ExternalURL string `json:"externalUrl,omitempty"` - // The route prefix Prometheus registers HTTP handlers for. This is useful, - // if using ExternalURL and a proxy is rewriting HTTP routes of a request, - // and the actual ExternalURL is still true, but the server serves requests - // under a different route prefix. For example for use with `kubectl proxy`. - RoutePrefix string `json:"routePrefix,omitempty"` - // Storage spec to specify how storage shall be used. - Storage *StorageSpec `json:"storage,omitempty"` - // A selector to select which PrometheusRules to mount for loading alerting - // rules from. Until (excluding) Prometheus Operator v0.24.0 Prometheus - // Operator will migrate any legacy rule ConfigMaps to PrometheusRule custom - // resources selected by RuleSelector. Make sure it does not match any config - // maps that you do not want to be migrated. - RuleSelector *metav1.LabelSelector `json:"ruleSelector,omitempty"` - // Namespaces to be selected for PrometheusRules discovery. If unspecified, only - // the same namespace as the Prometheus object is in is used. - RuleNamespaceSelector *metav1.LabelSelector `json:"ruleNamespaceSelector,omitempty"` - // Define details regarding alerting. - Alerting *AlertingSpec `json:"alerting,omitempty"` - // Define resources requests and limits for single Pods. - Resources v1.ResourceRequirements `json:"resources,omitempty"` - // Define which Nodes the Pods are scheduled on. - NodeSelector map[string]string `json:"nodeSelector,omitempty"` - // ServiceAccountName is the name of the ServiceAccount to use to run the - // Prometheus Pods. - ServiceAccountName string `json:"serviceAccountName,omitempty"` - // Secrets is a list of Secrets in the same namespace as the Prometheus - // object, which shall be mounted into the Prometheus Pods. - // The Secrets are mounted into /etc/prometheus/secrets/. - Secrets []string `json:"secrets,omitempty"` - // ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus - // object, which shall be mounted into the Prometheus Pods. - // The ConfigMaps are mounted into /etc/prometheus/configmaps/. - ConfigMaps []string `json:"configMaps,omitempty"` - // If specified, the pod's scheduling constraints. - Affinity *v1.Affinity `json:"affinity,omitempty"` - // If specified, the pod's tolerations. - Tolerations []v1.Toleration `json:"tolerations,omitempty"` - // If specified, the remote_write spec. This is an experimental feature, it may change in any upcoming release in a breaking way. - RemoteWrite []RemoteWriteSpec `json:"remoteWrite,omitempty"` - // If specified, the remote_read spec. This is an experimental feature, it may change in any upcoming release in a breaking way. - RemoteRead []RemoteReadSpec `json:"remoteRead,omitempty"` - // SecurityContext holds pod-level security attributes and common container settings. - // This defaults to non root user with uid 1000 and gid 2000 for Prometheus >v2.0 and - // default PodSecurityContext for other versions. - SecurityContext *v1.PodSecurityContext `json:"securityContext,omitempty"` - // ListenLocal makes the Prometheus server listen on loopback, so that it - // does not bind against the Pod IP. - ListenLocal bool `json:"listenLocal,omitempty"` - // Containers allows injecting additional containers. This is meant to - // allow adding an authentication proxy to a Prometheus pod. - Containers []v1.Container `json:"containers,omitempty"` - // AdditionalScrapeConfigs allows specifying a key of a Secret containing - // additional Prometheus scrape configurations. Scrape configurations - // specified are appended to the configurations generated by the Prometheus - // Operator. Job configurations specified must have the form as specified - // in the official Prometheus documentation: - // https://prometheus.io/docs/prometheus/latest/configuration/configuration/#. - // As scrape configs are appended, the user is responsible to make sure it - // is valid. Note that using this feature may expose the possibility to - // break upgrades of Prometheus. It is advised to review Prometheus release - // notes to ensure that no incompatible scrape configs are going to break - // Prometheus after the upgrade. - AdditionalScrapeConfigs *v1.SecretKeySelector `json:"additionalScrapeConfigs,omitempty"` - // AdditionalAlertRelabelConfigs allows specifying a key of a Secret containing - // additional Prometheus alert relabel configurations. Alert relabel configurations - // specified are appended to the configurations generated by the Prometheus - // Operator. Alert relabel configurations specified must have the form as specified - // in the official Prometheus documentation: - // https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alert_relabel_configs. - // As alert relabel configs are appended, the user is responsible to make sure it - // is valid. Note that using this feature may expose the possibility to - // break upgrades of Prometheus. It is advised to review Prometheus release - // notes to ensure that no incompatible alert relabel configs are going to break - // Prometheus after the upgrade. - AdditionalAlertRelabelConfigs *v1.SecretKeySelector `json:"additionalAlertRelabelConfigs,omitempty"` - // AdditionalAlertManagerConfigs allows specifying a key of a Secret containing - // additional Prometheus AlertManager configurations. AlertManager configurations - // specified are appended to the configurations generated by the Prometheus - // Operator. Job configurations specified must have the form as specified - // in the official Prometheus documentation: - // https://prometheus.io/docs/prometheus/latest/configuration/configuration/#. - // As AlertManager configs are appended, the user is responsible to make sure it - // is valid. Note that using this feature may expose the possibility to - // break upgrades of Prometheus. It is advised to review Prometheus release - // notes to ensure that no incompatible AlertManager configs are going to break - // Prometheus after the upgrade. - AdditionalAlertManagerConfigs *v1.SecretKeySelector `json:"additionalAlertManagerConfigs,omitempty"` - // APIServerConfig allows specifying a host and auth methods to access apiserver. - // If left empty, Prometheus is assumed to run inside of the cluster - // and will discover API servers automatically and use the pod's CA certificate - // and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount/. - APIServerConfig *APIServerConfig `json:"apiserverConfig,omitempty"` - // Thanos configuration allows configuring various aspects of a Prometheus - // server in a Thanos environment. - // - // This section is experimental, it may change significantly without - // deprecation notice in any release. - // - // This is experimental and may change significantly without backward - // compatibility in any release. - Thanos *ThanosSpec `json:"thanos,omitempty"` - // Priority class assigned to the Pods - PriorityClassName string `json:"priorityClassName,omitempty"` -} - -// PrometheusStatus is the most recent observed status of the Prometheus cluster. Read-only. Not -// included when requesting from the apiserver, only from the Prometheus -// Operator API itself. More info: -// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status -// +k8s:openapi-gen=true -type PrometheusStatus struct { - // Represents whether any actions on the underlaying managed objects are - // being performed. Only delete actions will be performed. - Paused bool `json:"paused"` - // Total number of non-terminated pods targeted by this Prometheus deployment - // (their labels match the selector). - Replicas int32 `json:"replicas"` - // Total number of non-terminated pods targeted by this Prometheus deployment - // that have the desired version spec. - UpdatedReplicas int32 `json:"updatedReplicas"` - // Total number of available pods (ready for at least minReadySeconds) - // targeted by this Prometheus deployment. - AvailableReplicas int32 `json:"availableReplicas"` - // Total number of unavailable pods targeted by this Prometheus deployment. - UnavailableReplicas int32 `json:"unavailableReplicas"` -} - -// AlertingSpec defines parameters for alerting configuration of Prometheus servers. -// +k8s:openapi-gen=true -type AlertingSpec struct { - // AlertmanagerEndpoints Prometheus should fire alerts against. - Alertmanagers []AlertmanagerEndpoints `json:"alertmanagers"` -} - -// StorageSpec defines the configured storage for a group Prometheus servers. -// If neither `emptyDir` nor `volumeClaimTemplate` is specified, then by default an [EmptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) will be used. -// +k8s:openapi-gen=true -type StorageSpec struct { - // Name of the StorageClass to use when requesting storage provisioning. More - // info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses - // (DEPRECATED - instead use `volumeClaimTemplate.spec.storageClassName`) - Class string `json:"class,omitempty"` - // EmptyDirVolumeSource to be used by the Prometheus StatefulSets. If specified, used in place of any volumeClaimTemplate. More - // info: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir - EmptyDir *v1.EmptyDirVolumeSource `json:"emptyDir,omitempty"` - // A label query over volumes to consider for binding. - // (DEPRECATED - instead use `volumeClaimTemplate.spec.selector`) - Selector *metav1.LabelSelector `json:"selector,omitempty"` - // Resources represents the minimum resources the volume should have. More - // info: http://kubernetes.io/docs/user-guide/persistent-volumes#resources - // (DEPRECATED - instead use `volumeClaimTemplate.spec.resources`) - Resources v1.ResourceRequirements `json:"resources,omitempty"` - // A PVC spec to be used by the Prometheus StatefulSets. - VolumeClaimTemplate v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"` -} - -// ThanosSpec defines parameters for a Prometheus server within a Thanos deployment. -// +k8s:openapi-gen=true -type ThanosSpec struct { - // Peers is a DNS name for Thanos to discover peers through. - Peers *string `json:"peers,omitempty"` - // Version describes the version of Thanos to use. - Version *string `json:"version,omitempty"` - // Tag of Thanos sidecar container image to be deployed. Defaults to the value of `version`. - // Version is ignored if Tag is set. - Tag *string `json:"tag,omitempty"` - // SHA of Thanos container image to be deployed. Defaults to the value of `version`. - // Similar to a tag, but the SHA explicitly deploys an immutable container image. - // Version and Tag are ignored if SHA is set. - SHA *string `json:"sha,omitempty"` - // Thanos base image if other than default. - BaseImage *string `json:"baseImage,omitempty"` - // Resources defines the resource requirements for the Thanos sidecar. - // If not provided, no requests/limits will be set - Resources v1.ResourceRequirements `json:"resources,omitempty"` - // GCS configures use of GCS in Thanos. - GCS *ThanosGCSSpec `json:"gcs,omitempty"` - // S3 configures use of S3 in Thanos. - S3 *ThanosS3Spec `json:"s3,omitempty"` -} - -// ThanosGCSSpec defines parameters for use of Google Cloud Storage (GCS) with -// Thanos. -// +k8s:openapi-gen=true -type ThanosGCSSpec struct { - // Google Cloud Storage bucket name for stored blocks. If empty it won't - // store any block inside Google Cloud Storage. - Bucket *string `json:"bucket,omitempty"` - // Secret to access our Bucket. - SecretKey *v1.SecretKeySelector `json:"credentials,omitempty"` -} - -// ThanosS3Spec defines parameters for of AWS Simple Storage Service (S3) with -// Thanos. (S3 compatible services apply as well) -// +k8s:openapi-gen=true -type ThanosS3Spec struct { - // S3-Compatible API bucket name for stored blocks. - Bucket *string `json:"bucket,omitempty"` - // S3-Compatible API endpoint for stored blocks. - Endpoint *string `json:"endpoint,omitempty"` - // AccessKey for an S3-Compatible API. - AccessKey *v1.SecretKeySelector `json:"accessKey,omitempty"` - // SecretKey for an S3-Compatible API. - SecretKey *v1.SecretKeySelector `json:"secretKey,omitempty"` - // Whether to use an insecure connection with an S3-Compatible API. - Insecure *bool `json:"insecure,omitempty"` - // Whether to use S3 Signature Version 2; otherwise Signature Version 4 will be used. - SignatureVersion2 *bool `json:"signatureVersion2,omitempty"` - // Whether to use Server Side Encryption - EncryptSSE *bool `json:"encryptsse,omitempty"` -} - -// RemoteWriteSpec defines the remote_write configuration for prometheus. -// +k8s:openapi-gen=true -type RemoteWriteSpec struct { - //The URL of the endpoint to send samples to. - URL string `json:"url"` - //Timeout for requests to the remote write endpoint. - RemoteTimeout string `json:"remoteTimeout,omitempty"` - //The list of remote write relabel configurations. - WriteRelabelConfigs []RelabelConfig `json:"writeRelabelConfigs,omitempty"` - //BasicAuth for the URL. - BasicAuth *BasicAuth `json:"basicAuth,omitempty"` - // File to read bearer token for remote write. - BearerToken string `json:"bearerToken,omitempty"` - // File to read bearer token for remote write. - BearerTokenFile string `json:"bearerTokenFile,omitempty"` - // TLS Config to use for remote write. - TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` - //Optional ProxyURL - ProxyURL string `json:"proxyUrl,omitempty"` - // QueueConfig allows tuning of the remote write queue parameters. - QueueConfig *QueueConfig `json:"queueConfig,omitempty"` -} - -// QueueConfig allows the tuning of remote_write queue_config parameters. This object -// is referenced in the RemoteWriteSpec object. -// +k8s:openapi-gen=true -type QueueConfig struct { - // Capacity is the number of samples to buffer per shard before we start dropping them. - Capacity int `json:"capacity,omitempty"` - // MaxShards is the maximum number of shards, i.e. amount of concurrency. - MaxShards int `json:"maxShards,omitempty"` - // MaxSamplesPerSend is the maximum number of samples per send. - MaxSamplesPerSend int `json:"maxSamplesPerSend,omitempty"` - // BatchSendDeadline is the maximum time a sample will wait in buffer. - BatchSendDeadline string `json:"batchSendDeadline,omitempty"` - // MaxRetries is the maximum number of times to retry a batch on recoverable errors. - MaxRetries int `json:"maxRetries,omitempty"` - // MinBackoff is the initial retry delay. Gets doubled for every retry. - MinBackoff string `json:"minBackoff,omitempty"` - // MaxBackoff is the maximum retry delay. - MaxBackoff string `json:"maxBackoff,omitempty"` -} - -// RemoteReadSpec defines the remote_read configuration for prometheus. -// +k8s:openapi-gen=true -type RemoteReadSpec struct { - //The URL of the endpoint to send samples to. - URL string `json:"url"` - //An optional list of equality matchers which have to be present - // in a selector to query the remote read endpoint. - RequiredMatchers map[string]string `json:"requiredMatchers,omitempty"` - //Timeout for requests to the remote read endpoint. - RemoteTimeout string `json:"remoteTimeout,omitempty"` - //Whether reads should be made for queries for time ranges that - // the local storage should have complete data for. - ReadRecent bool `json:"readRecent,omitempty"` - //BasicAuth for the URL. - BasicAuth *BasicAuth `json:"basicAuth,omitempty"` - // bearer token for remote read. - BearerToken string `json:"bearerToken,omitempty"` - // File to read bearer token for remote read. - BearerTokenFile string `json:"bearerTokenFile,omitempty"` - // TLS Config to use for remote read. - TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` - //Optional ProxyURL - ProxyURL string `json:"proxyUrl,omitempty"` -} - -// RelabelConfig allows dynamic rewriting of the label set, being applied to samples before ingestion. -// It defines ``-section of Prometheus configuration. -// More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs -// +k8s:openapi-gen=true -type RelabelConfig struct { - //The source labels select values from existing labels. Their content is concatenated - //using the configured separator and matched against the configured regular expression - //for the replace, keep, and drop actions. - SourceLabels []string `json:"sourceLabels,omitempty"` - //Separator placed between concatenated source label values. default is ';'. - Separator string `json:"separator,omitempty"` - //Label to which the resulting value is written in a replace action. - //It is mandatory for replace actions. Regex capture groups are available. - TargetLabel string `json:"targetLabel,omitempty"` - //Regular expression against which the extracted value is matched. defailt is '(.*)' - Regex string `json:"regex,omitempty"` - // Modulus to take of the hash of the source label values. - Modulus uint64 `json:"modulus,omitempty"` - //Replacement value against which a regex replace is performed if the - //regular expression matches. Regex capture groups are available. Default is '$1' - Replacement string `json:"replacement,omitempty"` - // Action to perform based on regex matching. Default is 'replace' - Action string `json:"action,omitempty"` -} - -// APIServerConfig defines a host and auth methods to access apiserver. -// More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#kubernetes_sd_config -// +k8s:openapi-gen=true -type APIServerConfig struct { - // Host of apiserver. - // A valid string consisting of a hostname or IP followed by an optional port number - Host string `json:"host"` - // BasicAuth allow an endpoint to authenticate over basic authentication - BasicAuth *BasicAuth `json:"basicAuth,omitempty"` - // Bearer token for accessing apiserver. - BearerToken string `json:"bearerToken,omitempty"` - // File to read bearer token for accessing apiserver. - BearerTokenFile string `json:"bearerTokenFile,omitempty"` - // TLS Config to use for accessing apiserver. - TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` -} - -// AlertmanagerEndpoints defines a selection of a single Endpoints object -// containing alertmanager IPs to fire alerts against. -// +k8s:openapi-gen=true -type AlertmanagerEndpoints struct { - // Namespace of Endpoints object. - Namespace string `json:"namespace"` - // Name of Endpoints object in Namespace. - Name string `json:"name"` - // Port the Alertmanager API is exposed on. - Port intstr.IntOrString `json:"port"` - // Scheme to use when firing alerts. - Scheme string `json:"scheme,omitempty"` - // Prefix for the HTTP path alerts are pushed to. - PathPrefix string `json:"pathPrefix,omitempty"` - // TLS Config to use for alertmanager connection. - TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` - // BearerTokenFile to read from filesystem to use when authenticating to - // Alertmanager. - BearerTokenFile string `json:"bearerTokenFile,omitempty"` -} - -// ServiceMonitor defines monitoring for a set of services. -// +k8s:openapi-gen=true -type ServiceMonitor struct { - metav1.TypeMeta `json:",inline"` - // Standard object’s metadata. More info: - // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - // +k8s:openapi-gen=false - metav1.ObjectMeta `json:"metadata,omitempty"` - // Specification of desired Service selection for target discrovery by - // Prometheus. - Spec ServiceMonitorSpec `json:"spec"` -} - -// ServiceMonitorSpec contains specification parameters for a ServiceMonitor. -// +k8s:openapi-gen=true -type ServiceMonitorSpec struct { - // The label to use to retrieve the job name from. - JobLabel string `json:"jobLabel,omitempty"` - // TargetLabels transfers labels on the Kubernetes Service onto the target. - TargetLabels []string `json:"targetLabels,omitempty"` - // PodTargetLabels transfers labels on the Kubernetes Pod onto the target. - PodTargetLabels []string `json:"podTargetLabels,omitempty"` - // A list of endpoints allowed as part of this ServiceMonitor. - Endpoints []Endpoint `json:"endpoints"` - // Selector to select Endpoints objects. - Selector metav1.LabelSelector `json:"selector"` - // Selector to select which namespaces the Endpoints objects are discovered from. - NamespaceSelector NamespaceSelector `json:"namespaceSelector,omitempty"` - // SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. - SampleLimit uint64 `json:"sampleLimit,omitempty"` -} - -// Endpoint defines a scrapeable endpoint serving Prometheus metrics. -// +k8s:openapi-gen=true -type Endpoint struct { - // Name of the service port this endpoint refers to. Mutually exclusive with targetPort. - Port string `json:"port,omitempty"` - // Name or number of the target port of the endpoint. Mutually exclusive with port. - TargetPort *intstr.IntOrString `json:"targetPort,omitempty"` - // HTTP path to scrape for metrics. - Path string `json:"path,omitempty"` - // HTTP scheme to use for scraping. - Scheme string `json:"scheme,omitempty"` - // Optional HTTP URL parameters - Params map[string][]string `json:"params,omitempty"` - // Interval at which metrics should be scraped - Interval string `json:"interval,omitempty"` - // Timeout after which the scrape is ended - ScrapeTimeout string `json:"scrapeTimeout,omitempty"` - // TLS configuration to use when scraping the endpoint - TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` - // File to read bearer token for scraping targets. - BearerTokenFile string `json:"bearerTokenFile,omitempty"` - // HonorLabels chooses the metric's labels on collisions with target labels. - HonorLabels bool `json:"honorLabels,omitempty"` - // BasicAuth allow an endpoint to authenticate over basic authentication - // More info: https://prometheus.io/docs/operating/configuration/#endpoints - BasicAuth *BasicAuth `json:"basicAuth,omitempty"` - // MetricRelabelConfigs to apply to samples before ingestion. - MetricRelabelConfigs []*RelabelConfig `json:"metricRelabelings,omitempty"` - // RelabelConfigs to apply to samples before ingestion. - // More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/# - RelabelConfigs []*RelabelConfig `json:"relabelings,omitempty"` - // ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint. - ProxyURL *string `json:"proxyUrl,omitempty"` -} - -// BasicAuth allow an endpoint to authenticate over basic authentication -// More info: https://prometheus.io/docs/operating/configuration/#endpoints -// +k8s:openapi-gen=true -type BasicAuth struct { - // The secret that contains the username for authenticate - Username v1.SecretKeySelector `json:"username,omitempty"` - // The secret that contains the password for authenticate - Password v1.SecretKeySelector `json:"password,omitempty"` -} - -// TLSConfig specifies TLS configuration parameters. -// +k8s:openapi-gen=true -type TLSConfig struct { - // The CA cert to use for the targets. - CAFile string `json:"caFile,omitempty"` - // The client cert file for the targets. - CertFile string `json:"certFile,omitempty"` - // The client key file for the targets. - KeyFile string `json:"keyFile,omitempty"` - // Used to verify the hostname for the targets. - ServerName string `json:"serverName,omitempty"` - // Disable target certificate validation. - InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` -} - -// ServiceMonitorList is a list of ServiceMonitors. -// +k8s:openapi-gen=true -type ServiceMonitorList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - metav1.ListMeta `json:"metadata,omitempty"` - // List of ServiceMonitors - Items []*ServiceMonitor `json:"items"` -} - -// PrometheusRuleList is a list of PrometheusRules. -// +k8s:openapi-gen=true -type PrometheusRuleList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - metav1.ListMeta `json:"metadata,omitempty"` - // List of Rules - Items []*PrometheusRule `json:"items"` -} - -// PrometheusRule defines alerting rules for a Prometheus instance -// +k8s:openapi-gen=true -type PrometheusRule struct { - metav1.TypeMeta `json:",inline"` - // Standard object’s metadata. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - metav1.ObjectMeta `json:"metadata,omitempty"` - // Specification of desired alerting rule definitions for Prometheus. - Spec PrometheusRuleSpec `json:"spec"` -} - -// PrometheusRuleSpec contains specification parameters for a Rule. -// +k8s:openapi-gen=true -type PrometheusRuleSpec struct { - // Content of Prometheus rule file - Groups []RuleGroup `json:"groups,omitempty"` -} - -// RuleGroup and Rule are copied instead of vendored because the -// upstream Prometheus struct definitions don't have json struct tags. - -// RuleGroup is a list of sequentially evaluated recording and alerting rules. -// +k8s:openapi-gen=true -type RuleGroup struct { - Name string `json:"name"` - Interval string `json:"interval,omitempty"` - Rules []Rule `json:"rules"` -} - -// Rule describes an alerting or recording rule. -// +k8s:openapi-gen=true -type Rule struct { - Record string `json:"record,omitempty"` - Alert string `json:"alert,omitempty"` - Expr intstr.IntOrString `json:"expr"` - For string `json:"for,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - Annotations map[string]string `json:"annotations,omitempty"` -} - -// Alertmanager describes an Alertmanager cluster. -// +k8s:openapi-gen=true -type Alertmanager struct { - metav1.TypeMeta `json:",inline"` - // Standard object’s metadata. More info: - // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - // +k8s:openapi-gen=false - metav1.ObjectMeta `json:"metadata,omitempty"` - // Specification of the desired behavior of the Alertmanager cluster. More info: - // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status - Spec AlertmanagerSpec `json:"spec"` - // Most recent observed status of the Alertmanager cluster. Read-only. Not - // included when requesting from the apiserver, only from the Prometheus - // Operator API itself. More info: - // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status - Status *AlertmanagerStatus `json:"status,omitempty"` -} - -// AlertmanagerSpec is a specification of the desired behavior of the Alertmanager cluster. More info: -// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status -// +k8s:openapi-gen=true -type AlertmanagerSpec struct { - // Standard object’s metadata. More info: - // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - // Metadata Labels and Annotations gets propagated to the prometheus pods. - PodMetadata *metav1.ObjectMeta `json:"podMetadata,omitempty"` - // Version the cluster should be on. - Version string `json:"version,omitempty"` - // Tag of Alertmanager container image to be deployed. Defaults to the value of `version`. - // Version is ignored if Tag is set. - Tag string `json:"tag,omitempty"` - // SHA of Alertmanager container image to be deployed. Defaults to the value of `version`. - // Similar to a tag, but the SHA explicitly deploys an immutable container image. - // Version and Tag are ignored if SHA is set. - SHA string `json:"sha,omitempty"` - // Base image that is used to deploy pods, without tag. - BaseImage string `json:"baseImage,omitempty"` - // An optional list of references to secrets in the same namespace - // to use for pulling prometheus and alertmanager images from registries - // see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod - ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"` - // Secrets is a list of Secrets in the same namespace as the Alertmanager - // object, which shall be mounted into the Alertmanager Pods. - // The Secrets are mounted into /etc/alertmanager/secrets/. - Secrets []string `json:"secrets,omitempty"` - // ConfigMaps is a list of ConfigMaps in the same namespace as the Alertmanager - // object, which shall be mounted into the Alertmanager Pods. - // The ConfigMaps are mounted into /etc/alertmanager/configmaps/. - ConfigMaps []string `json:"configMaps,omitempty"` - // Log level for Alertmanager to be configured with. - LogLevel string `json:"logLevel,omitempty"` - // Size is the expected size of the alertmanager cluster. The controller will - // eventually make the size of the running cluster equal to the expected - // size. - Replicas *int32 `json:"replicas,omitempty"` - // Time duration Alertmanager shall retain data for. Default is '120h', - // and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years). - Retention string `json:"retention,omitempty"` - // Storage is the definition of how storage will be used by the Alertmanager - // instances. - Storage *StorageSpec `json:"storage,omitempty"` - // The external URL the Alertmanager instances will be available under. This is - // necessary to generate correct URLs. This is necessary if Alertmanager is not - // served from root of a DNS name. - ExternalURL string `json:"externalUrl,omitempty"` - // The route prefix Alertmanager registers HTTP handlers for. This is useful, - // if using ExternalURL and a proxy is rewriting HTTP routes of a request, - // and the actual ExternalURL is still true, but the server serves requests - // under a different route prefix. For example for use with `kubectl proxy`. - RoutePrefix string `json:"routePrefix,omitempty"` - // If set to true all actions on the underlaying managed objects are not - // goint to be performed, except for delete actions. - Paused bool `json:"paused,omitempty"` - // Define which Nodes the Pods are scheduled on. - NodeSelector map[string]string `json:"nodeSelector,omitempty"` - // Define resources requests and limits for single Pods. - Resources v1.ResourceRequirements `json:"resources,omitempty"` - // If specified, the pod's scheduling constraints. - Affinity *v1.Affinity `json:"affinity,omitempty"` - // If specified, the pod's tolerations. - Tolerations []v1.Toleration `json:"tolerations,omitempty"` - // SecurityContext holds pod-level security attributes and common container settings. - // This defaults to non root user with uid 1000 and gid 2000. - SecurityContext *v1.PodSecurityContext `json:"securityContext,omitempty"` - // ServiceAccountName is the name of the ServiceAccount to use to run the - // Prometheus Pods. - ServiceAccountName string `json:"serviceAccountName,omitempty"` - // ListenLocal makes the Alertmanager server listen on loopback, so that it - // does not bind against the Pod IP. Note this is only for the Alertmanager - // UI, not the gossip communication. - ListenLocal bool `json:"listenLocal,omitempty"` - // Containers allows injecting additional containers. This is meant to - // allow adding an authentication proxy to an Alertmanager pod. - Containers []v1.Container `json:"containers,omitempty"` - // Priority class assigned to the Pods - PriorityClassName string `json:"priorityClassName,omitempty"` - // AdditionalPeers allows injecting a set of additional Alertmanagers to peer with to form a highly available cluster. - AdditionalPeers []string `json:"additionalPeers,omitempty"` -} - -// AlertmanagerList is a list of Alertmanagers. -// +k8s:openapi-gen=true -type AlertmanagerList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata - metav1.ListMeta `json:"metadata,omitempty"` - // List of Alertmanagers - Items []Alertmanager `json:"items"` -} - -// AlertmanagerStatus is the most recent observed status of the Alertmanager cluster. Read-only. Not -// included when requesting from the apiserver, only from the Prometheus -// Operator API itself. More info: -// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status -// +k8s:openapi-gen=true -type AlertmanagerStatus struct { - // Represents whether any actions on the underlaying managed objects are - // being performed. Only delete actions will be performed. - Paused bool `json:"paused"` - // Total number of non-terminated pods targeted by this Alertmanager - // cluster (their labels match the selector). - Replicas int32 `json:"replicas"` - // Total number of non-terminated pods targeted by this Alertmanager - // cluster that have the desired version spec. - UpdatedReplicas int32 `json:"updatedReplicas"` - // Total number of available pods (ready for at least minReadySeconds) - // targeted by this Alertmanager cluster. - AvailableReplicas int32 `json:"availableReplicas"` - // Total number of unavailable pods targeted by this Alertmanager cluster. - UnavailableReplicas int32 `json:"unavailableReplicas"` -} - -// NamespaceSelector is a selector for selecting either all namespaces or a -// list of namespaces. -// +k8s:openapi-gen=true -type NamespaceSelector struct { - // Boolean describing whether all namespaces are selected in contrast to a - // list restricting them. - Any bool `json:"any,omitempty"` - // List of namespace names. - MatchNames []string `json:"matchNames,omitempty"` - - // TODO(fabxc): this should embed metav1.LabelSelector eventually. - // Currently the selector is only used for namespaces which require more complex - // implementation to support label selections. -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *Alertmanager) DeepCopyObject() runtime.Object { - return l.DeepCopy() -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *AlertmanagerList) DeepCopyObject() runtime.Object { - return l.DeepCopy() -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *Prometheus) DeepCopyObject() runtime.Object { - return l.DeepCopy() -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *PrometheusList) DeepCopyObject() runtime.Object { - return l.DeepCopy() -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *ServiceMonitor) DeepCopyObject() runtime.Object { - return l.DeepCopy() -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *ServiceMonitorList) DeepCopyObject() runtime.Object { - return l.DeepCopy() -} - -// DeepCopyObject implements the runtime.Object interface. -func (f *PrometheusRule) DeepCopyObject() runtime.Object { - return f.DeepCopy() -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *PrometheusRuleList) DeepCopyObject() runtime.Object { - return l.DeepCopy() -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/zz_generated.deepcopy.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/zz_generated.deepcopy.go deleted file mode 100644 index 74f449fcc..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1/zz_generated.deepcopy.go +++ /dev/null @@ -1,1309 +0,0 @@ -// +build !ignore_autogenerated - -// Copyright 2018 The prometheus-operator 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. - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1 - -import ( - core_v1 "k8s.io/api/core/v1" - meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - intstr "k8s.io/apimachinery/pkg/util/intstr" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *APIServerConfig) DeepCopyInto(out *APIServerConfig) { - *out = *in - if in.BasicAuth != nil { - in, out := &in.BasicAuth, &out.BasicAuth - if *in == nil { - *out = nil - } else { - *out = new(BasicAuth) - (*in).DeepCopyInto(*out) - } - } - if in.TLSConfig != nil { - in, out := &in.TLSConfig, &out.TLSConfig - if *in == nil { - *out = nil - } else { - *out = new(TLSConfig) - **out = **in - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServerConfig. -func (in *APIServerConfig) DeepCopy() *APIServerConfig { - if in == nil { - return nil - } - out := new(APIServerConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AlertingSpec) DeepCopyInto(out *AlertingSpec) { - *out = *in - if in.Alertmanagers != nil { - in, out := &in.Alertmanagers, &out.Alertmanagers - *out = make([]AlertmanagerEndpoints, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertingSpec. -func (in *AlertingSpec) DeepCopy() *AlertingSpec { - if in == nil { - return nil - } - out := new(AlertingSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Alertmanager) DeepCopyInto(out *Alertmanager) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - if *in == nil { - *out = nil - } else { - *out = new(AlertmanagerStatus) - **out = **in - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Alertmanager. -func (in *Alertmanager) DeepCopy() *Alertmanager { - if in == nil { - return nil - } - out := new(Alertmanager) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AlertmanagerEndpoints) DeepCopyInto(out *AlertmanagerEndpoints) { - *out = *in - out.Port = in.Port - if in.TLSConfig != nil { - in, out := &in.TLSConfig, &out.TLSConfig - if *in == nil { - *out = nil - } else { - *out = new(TLSConfig) - **out = **in - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerEndpoints. -func (in *AlertmanagerEndpoints) DeepCopy() *AlertmanagerEndpoints { - if in == nil { - return nil - } - out := new(AlertmanagerEndpoints) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AlertmanagerList) DeepCopyInto(out *AlertmanagerList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Alertmanager, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerList. -func (in *AlertmanagerList) DeepCopy() *AlertmanagerList { - if in == nil { - return nil - } - out := new(AlertmanagerList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AlertmanagerSpec) DeepCopyInto(out *AlertmanagerSpec) { - *out = *in - if in.PodMetadata != nil { - in, out := &in.PodMetadata, &out.PodMetadata - if *in == nil { - *out = nil - } else { - *out = new(meta_v1.ObjectMeta) - (*in).DeepCopyInto(*out) - } - } - if in.ImagePullSecrets != nil { - in, out := &in.ImagePullSecrets, &out.ImagePullSecrets - *out = make([]core_v1.LocalObjectReference, len(*in)) - copy(*out, *in) - } - if in.Secrets != nil { - in, out := &in.Secrets, &out.Secrets - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.ConfigMaps != nil { - in, out := &in.ConfigMaps, &out.ConfigMaps - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - if *in == nil { - *out = nil - } else { - *out = new(int32) - **out = **in - } - } - if in.Storage != nil { - in, out := &in.Storage, &out.Storage - if *in == nil { - *out = nil - } else { - *out = new(StorageSpec) - (*in).DeepCopyInto(*out) - } - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.Affinity != nil { - in, out := &in.Affinity, &out.Affinity - if *in == nil { - *out = nil - } else { - *out = new(core_v1.Affinity) - (*in).DeepCopyInto(*out) - } - } - if in.Tolerations != nil { - in, out := &in.Tolerations, &out.Tolerations - *out = make([]core_v1.Toleration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.SecurityContext != nil { - in, out := &in.SecurityContext, &out.SecurityContext - if *in == nil { - *out = nil - } else { - *out = new(core_v1.PodSecurityContext) - (*in).DeepCopyInto(*out) - } - } - if in.Containers != nil { - in, out := &in.Containers, &out.Containers - *out = make([]core_v1.Container, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.AdditionalPeers != nil { - in, out := &in.AdditionalPeers, &out.AdditionalPeers - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerSpec. -func (in *AlertmanagerSpec) DeepCopy() *AlertmanagerSpec { - if in == nil { - return nil - } - out := new(AlertmanagerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AlertmanagerStatus) DeepCopyInto(out *AlertmanagerStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerStatus. -func (in *AlertmanagerStatus) DeepCopy() *AlertmanagerStatus { - if in == nil { - return nil - } - out := new(AlertmanagerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BasicAuth) DeepCopyInto(out *BasicAuth) { - *out = *in - in.Username.DeepCopyInto(&out.Username) - in.Password.DeepCopyInto(&out.Password) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicAuth. -func (in *BasicAuth) DeepCopy() *BasicAuth { - if in == nil { - return nil - } - out := new(BasicAuth) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CrdKind) DeepCopyInto(out *CrdKind) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrdKind. -func (in *CrdKind) DeepCopy() *CrdKind { - if in == nil { - return nil - } - out := new(CrdKind) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CrdKinds) DeepCopyInto(out *CrdKinds) { - *out = *in - out.Prometheus = in.Prometheus - out.Alertmanager = in.Alertmanager - out.ServiceMonitor = in.ServiceMonitor - out.PrometheusRule = in.PrometheusRule - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrdKinds. -func (in *CrdKinds) DeepCopy() *CrdKinds { - if in == nil { - return nil - } - out := new(CrdKinds) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Endpoint) DeepCopyInto(out *Endpoint) { - *out = *in - if in.TargetPort != nil { - in, out := &in.TargetPort, &out.TargetPort - if *in == nil { - *out = nil - } else { - *out = new(intstr.IntOrString) - **out = **in - } - } - if in.Params != nil { - in, out := &in.Params, &out.Params - *out = make(map[string][]string, len(*in)) - for key, val := range *in { - if val == nil { - (*out)[key] = nil - } else { - (*out)[key] = make([]string, len(val)) - copy((*out)[key], val) - } - } - } - if in.TLSConfig != nil { - in, out := &in.TLSConfig, &out.TLSConfig - if *in == nil { - *out = nil - } else { - *out = new(TLSConfig) - **out = **in - } - } - if in.BasicAuth != nil { - in, out := &in.BasicAuth, &out.BasicAuth - if *in == nil { - *out = nil - } else { - *out = new(BasicAuth) - (*in).DeepCopyInto(*out) - } - } - if in.MetricRelabelConfigs != nil { - in, out := &in.MetricRelabelConfigs, &out.MetricRelabelConfigs - *out = make([]*RelabelConfig, len(*in)) - for i := range *in { - if (*in)[i] == nil { - (*out)[i] = nil - } else { - (*out)[i] = new(RelabelConfig) - (*in)[i].DeepCopyInto((*out)[i]) - } - } - } - if in.RelabelConfigs != nil { - in, out := &in.RelabelConfigs, &out.RelabelConfigs - *out = make([]*RelabelConfig, len(*in)) - for i := range *in { - if (*in)[i] == nil { - (*out)[i] = nil - } else { - (*out)[i] = new(RelabelConfig) - (*in)[i].DeepCopyInto((*out)[i]) - } - } - } - if in.ProxyURL != nil { - in, out := &in.ProxyURL, &out.ProxyURL - if *in == nil { - *out = nil - } else { - *out = new(string) - **out = **in - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. -func (in *Endpoint) DeepCopy() *Endpoint { - if in == nil { - return nil - } - out := new(Endpoint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NamespaceSelector) DeepCopyInto(out *NamespaceSelector) { - *out = *in - if in.MatchNames != nil { - in, out := &in.MatchNames, &out.MatchNames - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceSelector. -func (in *NamespaceSelector) DeepCopy() *NamespaceSelector { - if in == nil { - return nil - } - out := new(NamespaceSelector) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Prometheus) DeepCopyInto(out *Prometheus) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - if in.Status != nil { - in, out := &in.Status, &out.Status - if *in == nil { - *out = nil - } else { - *out = new(PrometheusStatus) - **out = **in - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Prometheus. -func (in *Prometheus) DeepCopy() *Prometheus { - if in == nil { - return nil - } - out := new(Prometheus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PrometheusList) DeepCopyInto(out *PrometheusList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]*Prometheus, len(*in)) - for i := range *in { - if (*in)[i] == nil { - (*out)[i] = nil - } else { - (*out)[i] = new(Prometheus) - (*in)[i].DeepCopyInto((*out)[i]) - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusList. -func (in *PrometheusList) DeepCopy() *PrometheusList { - if in == nil { - return nil - } - out := new(PrometheusList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PrometheusRule) DeepCopyInto(out *PrometheusRule) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRule. -func (in *PrometheusRule) DeepCopy() *PrometheusRule { - if in == nil { - return nil - } - out := new(PrometheusRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PrometheusRuleList) DeepCopyInto(out *PrometheusRuleList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]*PrometheusRule, len(*in)) - for i := range *in { - if (*in)[i] == nil { - (*out)[i] = nil - } else { - (*out)[i] = new(PrometheusRule) - (*in)[i].DeepCopyInto((*out)[i]) - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRuleList. -func (in *PrometheusRuleList) DeepCopy() *PrometheusRuleList { - if in == nil { - return nil - } - out := new(PrometheusRuleList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PrometheusRuleSpec) DeepCopyInto(out *PrometheusRuleSpec) { - *out = *in - if in.Groups != nil { - in, out := &in.Groups, &out.Groups - *out = make([]RuleGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRuleSpec. -func (in *PrometheusRuleSpec) DeepCopy() *PrometheusRuleSpec { - if in == nil { - return nil - } - out := new(PrometheusRuleSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PrometheusSpec) DeepCopyInto(out *PrometheusSpec) { - *out = *in - if in.PodMetadata != nil { - in, out := &in.PodMetadata, &out.PodMetadata - if *in == nil { - *out = nil - } else { - *out = new(meta_v1.ObjectMeta) - (*in).DeepCopyInto(*out) - } - } - if in.ServiceMonitorSelector != nil { - in, out := &in.ServiceMonitorSelector, &out.ServiceMonitorSelector - if *in == nil { - *out = nil - } else { - *out = new(meta_v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - } - if in.ServiceMonitorNamespaceSelector != nil { - in, out := &in.ServiceMonitorNamespaceSelector, &out.ServiceMonitorNamespaceSelector - if *in == nil { - *out = nil - } else { - *out = new(meta_v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - } - if in.ImagePullSecrets != nil { - in, out := &in.ImagePullSecrets, &out.ImagePullSecrets - *out = make([]core_v1.LocalObjectReference, len(*in)) - copy(*out, *in) - } - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - if *in == nil { - *out = nil - } else { - *out = new(int32) - **out = **in - } - } - if in.ExternalLabels != nil { - in, out := &in.ExternalLabels, &out.ExternalLabels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Storage != nil { - in, out := &in.Storage, &out.Storage - if *in == nil { - *out = nil - } else { - *out = new(StorageSpec) - (*in).DeepCopyInto(*out) - } - } - if in.RuleSelector != nil { - in, out := &in.RuleSelector, &out.RuleSelector - if *in == nil { - *out = nil - } else { - *out = new(meta_v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - } - if in.RuleNamespaceSelector != nil { - in, out := &in.RuleNamespaceSelector, &out.RuleNamespaceSelector - if *in == nil { - *out = nil - } else { - *out = new(meta_v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - } - if in.Alerting != nil { - in, out := &in.Alerting, &out.Alerting - if *in == nil { - *out = nil - } else { - *out = new(AlertingSpec) - (*in).DeepCopyInto(*out) - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Secrets != nil { - in, out := &in.Secrets, &out.Secrets - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.ConfigMaps != nil { - in, out := &in.ConfigMaps, &out.ConfigMaps - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Affinity != nil { - in, out := &in.Affinity, &out.Affinity - if *in == nil { - *out = nil - } else { - *out = new(core_v1.Affinity) - (*in).DeepCopyInto(*out) - } - } - if in.Tolerations != nil { - in, out := &in.Tolerations, &out.Tolerations - *out = make([]core_v1.Toleration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.RemoteWrite != nil { - in, out := &in.RemoteWrite, &out.RemoteWrite - *out = make([]RemoteWriteSpec, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.RemoteRead != nil { - in, out := &in.RemoteRead, &out.RemoteRead - *out = make([]RemoteReadSpec, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.SecurityContext != nil { - in, out := &in.SecurityContext, &out.SecurityContext - if *in == nil { - *out = nil - } else { - *out = new(core_v1.PodSecurityContext) - (*in).DeepCopyInto(*out) - } - } - if in.Containers != nil { - in, out := &in.Containers, &out.Containers - *out = make([]core_v1.Container, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.AdditionalScrapeConfigs != nil { - in, out := &in.AdditionalScrapeConfigs, &out.AdditionalScrapeConfigs - if *in == nil { - *out = nil - } else { - *out = new(core_v1.SecretKeySelector) - (*in).DeepCopyInto(*out) - } - } - if in.AdditionalAlertRelabelConfigs != nil { - in, out := &in.AdditionalAlertRelabelConfigs, &out.AdditionalAlertRelabelConfigs - if *in == nil { - *out = nil - } else { - *out = new(core_v1.SecretKeySelector) - (*in).DeepCopyInto(*out) - } - } - if in.AdditionalAlertManagerConfigs != nil { - in, out := &in.AdditionalAlertManagerConfigs, &out.AdditionalAlertManagerConfigs - if *in == nil { - *out = nil - } else { - *out = new(core_v1.SecretKeySelector) - (*in).DeepCopyInto(*out) - } - } - if in.APIServerConfig != nil { - in, out := &in.APIServerConfig, &out.APIServerConfig - if *in == nil { - *out = nil - } else { - *out = new(APIServerConfig) - (*in).DeepCopyInto(*out) - } - } - if in.Thanos != nil { - in, out := &in.Thanos, &out.Thanos - if *in == nil { - *out = nil - } else { - *out = new(ThanosSpec) - (*in).DeepCopyInto(*out) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusSpec. -func (in *PrometheusSpec) DeepCopy() *PrometheusSpec { - if in == nil { - return nil - } - out := new(PrometheusSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PrometheusStatus) DeepCopyInto(out *PrometheusStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusStatus. -func (in *PrometheusStatus) DeepCopy() *PrometheusStatus { - if in == nil { - return nil - } - out := new(PrometheusStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *QueueConfig) DeepCopyInto(out *QueueConfig) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueueConfig. -func (in *QueueConfig) DeepCopy() *QueueConfig { - if in == nil { - return nil - } - out := new(QueueConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RelabelConfig) DeepCopyInto(out *RelabelConfig) { - *out = *in - if in.SourceLabels != nil { - in, out := &in.SourceLabels, &out.SourceLabels - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RelabelConfig. -func (in *RelabelConfig) DeepCopy() *RelabelConfig { - if in == nil { - return nil - } - out := new(RelabelConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RemoteReadSpec) DeepCopyInto(out *RemoteReadSpec) { - *out = *in - if in.RequiredMatchers != nil { - in, out := &in.RequiredMatchers, &out.RequiredMatchers - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.BasicAuth != nil { - in, out := &in.BasicAuth, &out.BasicAuth - if *in == nil { - *out = nil - } else { - *out = new(BasicAuth) - (*in).DeepCopyInto(*out) - } - } - if in.TLSConfig != nil { - in, out := &in.TLSConfig, &out.TLSConfig - if *in == nil { - *out = nil - } else { - *out = new(TLSConfig) - **out = **in - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteReadSpec. -func (in *RemoteReadSpec) DeepCopy() *RemoteReadSpec { - if in == nil { - return nil - } - out := new(RemoteReadSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RemoteWriteSpec) DeepCopyInto(out *RemoteWriteSpec) { - *out = *in - if in.WriteRelabelConfigs != nil { - in, out := &in.WriteRelabelConfigs, &out.WriteRelabelConfigs - *out = make([]RelabelConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.BasicAuth != nil { - in, out := &in.BasicAuth, &out.BasicAuth - if *in == nil { - *out = nil - } else { - *out = new(BasicAuth) - (*in).DeepCopyInto(*out) - } - } - if in.TLSConfig != nil { - in, out := &in.TLSConfig, &out.TLSConfig - if *in == nil { - *out = nil - } else { - *out = new(TLSConfig) - **out = **in - } - } - if in.QueueConfig != nil { - in, out := &in.QueueConfig, &out.QueueConfig - if *in == nil { - *out = nil - } else { - *out = new(QueueConfig) - **out = **in - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemoteWriteSpec. -func (in *RemoteWriteSpec) DeepCopy() *RemoteWriteSpec { - if in == nil { - return nil - } - out := new(RemoteWriteSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Rule) DeepCopyInto(out *Rule) { - *out = *in - out.Expr = in.Expr - if in.Labels != nil { - in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Annotations != nil { - in, out := &in.Annotations, &out.Annotations - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule. -func (in *Rule) DeepCopy() *Rule { - if in == nil { - return nil - } - out := new(Rule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RuleGroup) DeepCopyInto(out *RuleGroup) { - *out = *in - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]Rule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleGroup. -func (in *RuleGroup) DeepCopy() *RuleGroup { - if in == nil { - return nil - } - out := new(RuleGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceMonitor) DeepCopyInto(out *ServiceMonitor) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitor. -func (in *ServiceMonitor) DeepCopy() *ServiceMonitor { - if in == nil { - return nil - } - out := new(ServiceMonitor) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceMonitorList) DeepCopyInto(out *ServiceMonitorList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]*ServiceMonitor, len(*in)) - for i := range *in { - if (*in)[i] == nil { - (*out)[i] = nil - } else { - (*out)[i] = new(ServiceMonitor) - (*in)[i].DeepCopyInto((*out)[i]) - } - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitorList. -func (in *ServiceMonitorList) DeepCopy() *ServiceMonitorList { - if in == nil { - return nil - } - out := new(ServiceMonitorList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ServiceMonitorSpec) DeepCopyInto(out *ServiceMonitorSpec) { - *out = *in - if in.TargetLabels != nil { - in, out := &in.TargetLabels, &out.TargetLabels - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.PodTargetLabels != nil { - in, out := &in.PodTargetLabels, &out.PodTargetLabels - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]Endpoint, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Selector.DeepCopyInto(&out.Selector) - in.NamespaceSelector.DeepCopyInto(&out.NamespaceSelector) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitorSpec. -func (in *ServiceMonitorSpec) DeepCopy() *ServiceMonitorSpec { - if in == nil { - return nil - } - out := new(ServiceMonitorSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StorageSpec) DeepCopyInto(out *StorageSpec) { - *out = *in - if in.EmptyDir != nil { - in, out := &in.EmptyDir, &out.EmptyDir - if *in == nil { - *out = nil - } else { - *out = new(core_v1.EmptyDirVolumeSource) - (*in).DeepCopyInto(*out) - } - } - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - if *in == nil { - *out = nil - } else { - *out = new(meta_v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - } - in.Resources.DeepCopyInto(&out.Resources) - in.VolumeClaimTemplate.DeepCopyInto(&out.VolumeClaimTemplate) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageSpec. -func (in *StorageSpec) DeepCopy() *StorageSpec { - if in == nil { - return nil - } - out := new(StorageSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TLSConfig) DeepCopyInto(out *TLSConfig) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSConfig. -func (in *TLSConfig) DeepCopy() *TLSConfig { - if in == nil { - return nil - } - out := new(TLSConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ThanosGCSSpec) DeepCopyInto(out *ThanosGCSSpec) { - *out = *in - if in.Bucket != nil { - in, out := &in.Bucket, &out.Bucket - if *in == nil { - *out = nil - } else { - *out = new(string) - **out = **in - } - } - if in.SecretKey != nil { - in, out := &in.SecretKey, &out.SecretKey - if *in == nil { - *out = nil - } else { - *out = new(core_v1.SecretKeySelector) - (*in).DeepCopyInto(*out) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosGCSSpec. -func (in *ThanosGCSSpec) DeepCopy() *ThanosGCSSpec { - if in == nil { - return nil - } - out := new(ThanosGCSSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ThanosS3Spec) DeepCopyInto(out *ThanosS3Spec) { - *out = *in - if in.Bucket != nil { - in, out := &in.Bucket, &out.Bucket - if *in == nil { - *out = nil - } else { - *out = new(string) - **out = **in - } - } - if in.Endpoint != nil { - in, out := &in.Endpoint, &out.Endpoint - if *in == nil { - *out = nil - } else { - *out = new(string) - **out = **in - } - } - if in.AccessKey != nil { - in, out := &in.AccessKey, &out.AccessKey - if *in == nil { - *out = nil - } else { - *out = new(core_v1.SecretKeySelector) - (*in).DeepCopyInto(*out) - } - } - if in.SecretKey != nil { - in, out := &in.SecretKey, &out.SecretKey - if *in == nil { - *out = nil - } else { - *out = new(core_v1.SecretKeySelector) - (*in).DeepCopyInto(*out) - } - } - if in.Insecure != nil { - in, out := &in.Insecure, &out.Insecure - if *in == nil { - *out = nil - } else { - *out = new(bool) - **out = **in - } - } - if in.SignatureVersion2 != nil { - in, out := &in.SignatureVersion2, &out.SignatureVersion2 - if *in == nil { - *out = nil - } else { - *out = new(bool) - **out = **in - } - } - if in.EncryptSSE != nil { - in, out := &in.EncryptSSE, &out.EncryptSSE - if *in == nil { - *out = nil - } else { - *out = new(bool) - **out = **in - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosS3Spec. -func (in *ThanosS3Spec) DeepCopy() *ThanosS3Spec { - if in == nil { - return nil - } - out := new(ThanosS3Spec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ThanosSpec) DeepCopyInto(out *ThanosSpec) { - *out = *in - if in.Peers != nil { - in, out := &in.Peers, &out.Peers - if *in == nil { - *out = nil - } else { - *out = new(string) - **out = **in - } - } - if in.Version != nil { - in, out := &in.Version, &out.Version - if *in == nil { - *out = nil - } else { - *out = new(string) - **out = **in - } - } - if in.Tag != nil { - in, out := &in.Tag, &out.Tag - if *in == nil { - *out = nil - } else { - *out = new(string) - **out = **in - } - } - if in.SHA != nil { - in, out := &in.SHA, &out.SHA - if *in == nil { - *out = nil - } else { - *out = new(string) - **out = **in - } - } - if in.BaseImage != nil { - in, out := &in.BaseImage, &out.BaseImage - if *in == nil { - *out = nil - } else { - *out = new(string) - **out = **in - } - } - in.Resources.DeepCopyInto(&out.Resources) - if in.GCS != nil { - in, out := &in.GCS, &out.GCS - if *in == nil { - *out = nil - } else { - *out = new(ThanosGCSSpec) - (*in).DeepCopyInto(*out) - } - } - if in.S3 != nil { - in, out := &in.S3, &out.S3 - if *in == nil { - *out = nil - } else { - *out = new(ThanosS3Spec) - (*in).DeepCopyInto(*out) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosSpec. -func (in *ThanosSpec) DeepCopy() *ThanosSpec { - if in == nil { - return nil - } - out := new(ThanosSpec) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/alertmanager.go deleted file mode 100644 index 1f9a9dcce..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/alertmanager.go +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1alpha1 - -import ( - "encoding/json" - - "github.com/pkg/errors" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - dynamic "k8s.io/client-go/deprecated-dynamic" - "k8s.io/client-go/rest" -) - -const ( - AlertmanagersKind = "Alertmanager" - AlertmanagerName = "alertmanagers" -) - -type AlertmanagersGetter interface { - Alertmanagers(namespace string) AlertmanagerInterface -} - -var _ AlertmanagerInterface = &alertmanagers{} - -type AlertmanagerInterface interface { - Create(*Alertmanager) (*Alertmanager, error) - Get(name string, opts metav1.GetOptions) (*Alertmanager, error) - Update(*Alertmanager) (*Alertmanager, error) - Delete(name string, options *metav1.DeleteOptions) error - List(opts metav1.ListOptions) (runtime.Object, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error -} - -type alertmanagers struct { - restClient rest.Interface - client dynamic.ResourceInterface - ns string -} - -func newAlertmanagers(r rest.Interface, c *dynamic.Client, namespace string) *alertmanagers { - return &alertmanagers{ - r, - c.Resource( - &metav1.APIResource{ - Kind: AlertmanagersKind, - Name: AlertmanagerName, - Namespaced: true, - }, - namespace, - ), - namespace, - } -} - -func (a *alertmanagers) Create(o *Alertmanager) (*Alertmanager, error) { - ua, err := UnstructuredFromAlertmanager(o) - if err != nil { - return nil, err - } - - ua, err = a.client.Create(ua) - if err != nil { - return nil, err - } - - return AlertmanagerFromUnstructured(ua) -} - -func (a *alertmanagers) Get(name string, opts metav1.GetOptions) (*Alertmanager, error) { - obj, err := a.client.Get(name, opts) - if err != nil { - return nil, err - } - return AlertmanagerFromUnstructured(obj) -} - -func (a *alertmanagers) Update(o *Alertmanager) (*Alertmanager, error) { - ua, err := UnstructuredFromAlertmanager(o) - if err != nil { - return nil, err - } - - cura, err := a.Get(o.Name, metav1.GetOptions{}) - if err != nil { - return nil, errors.Wrap(err, "unable to get current version for update") - } - ua.SetResourceVersion(cura.ObjectMeta.ResourceVersion) - - ua, err = a.client.Update(ua) - if err != nil { - return nil, err - } - - return AlertmanagerFromUnstructured(ua) -} - -func (a *alertmanagers) Delete(name string, options *metav1.DeleteOptions) error { - return a.client.Delete(name, options) -} - -func (a *alertmanagers) List(opts metav1.ListOptions) (runtime.Object, error) { - req := a.restClient.Get(). - Namespace(a.ns). - Resource("alertmanagers") - - b, err := req.DoRaw() - if err != nil { - return nil, err - } - var p AlertmanagerList - return &p, json.Unmarshal(b, &p) -} - -func (a *alertmanagers) Watch(opts metav1.ListOptions) (watch.Interface, error) { - r, err := a.restClient.Get(). - Prefix("watch"). - Namespace(a.ns). - Resource("alertmanagers"). - Stream() - if err != nil { - return nil, err - } - return watch.NewStreamWatcher(&alertmanagerDecoder{ - dec: json.NewDecoder(r), - close: r.Close, - }), nil -} - -func (a *alertmanagers) DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error { - return a.client.DeleteCollection(dopts, lopts) -} - -// AlertmanagerFromUnstructured unmarshals an Alertmanager object from dynamic client's unstructured -func AlertmanagerFromUnstructured(r *unstructured.Unstructured) (*Alertmanager, error) { - b, err := json.Marshal(r.Object) - if err != nil { - return nil, err - } - var a Alertmanager - if err := json.Unmarshal(b, &a); err != nil { - return nil, err - } - a.TypeMeta.Kind = AlertmanagersKind - a.TypeMeta.APIVersion = Group + "/" + Version - return &a, nil -} - -// UnstructuredFromAlertmanager marshals an Alertmanager object into dynamic client's unstructured -func UnstructuredFromAlertmanager(a *Alertmanager) (*unstructured.Unstructured, error) { - a.TypeMeta.Kind = AlertmanagersKind - a.TypeMeta.APIVersion = Group + "/" + Version - b, err := json.Marshal(a) - if err != nil { - return nil, err - } - var r unstructured.Unstructured - if err := json.Unmarshal(b, &r.Object); err != nil { - return nil, err - } - return &r, nil -} - -type alertmanagerDecoder struct { - dec *json.Decoder - close func() error -} - -func (d *alertmanagerDecoder) Close() { - d.close() -} - -func (d *alertmanagerDecoder) Decode() (action watch.EventType, object runtime.Object, err error) { - var e struct { - Type watch.EventType - Object Alertmanager - } - if err := d.dec.Decode(&e); err != nil { - return watch.Error, nil, err - } - return e.Type, &e.Object, nil -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/client.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/client.go deleted file mode 100644 index 265cbcbf0..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/client.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/runtime/serializer" - dynamic "k8s.io/client-go/deprecated-dynamic" - "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/rest" -) - -const ( - Group = "monitoring.coreos.com" - Version = "v1alpha1" -) - -type MonitoringV1alpha1Interface interface { - RESTClient() rest.Interface - PrometheusesGetter - AlertmanagersGetter - ServiceMonitorsGetter -} - -type MonitoringV1alpha1Client struct { - restClient rest.Interface - dynamicClient *dynamic.Client -} - -func (c *MonitoringV1alpha1Client) Prometheuses(namespace string) PrometheusInterface { - return newPrometheuses(c.restClient, c.dynamicClient, namespace) -} - -func (c *MonitoringV1alpha1Client) Alertmanagers(namespace string) AlertmanagerInterface { - return newAlertmanagers(c.restClient, c.dynamicClient, namespace) -} - -func (c *MonitoringV1alpha1Client) ServiceMonitors(namespace string) ServiceMonitorInterface { - return newServiceMonitors(c.restClient, c.dynamicClient, namespace) -} - -func (c *MonitoringV1alpha1Client) RESTClient() rest.Interface { - return c.restClient -} - -func NewForConfig(c *rest.Config) (*MonitoringV1alpha1Client, error) { - config := *c - SetConfigDefaults(&config) - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - - dynamicClient, err := dynamic.NewClient(&config, schema.GroupVersion{ - Group: Group, - Version: Version, - }) - if err != nil { - return nil, err - } - - return &MonitoringV1alpha1Client{client, dynamicClient}, nil -} - -func SetConfigDefaults(config *rest.Config) { - config.GroupVersion = &schema.GroupVersion{ - Group: Group, - Version: Version, - } - config.APIPath = "/apis" - config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} - return -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/prometheus.go deleted file mode 100644 index 66a3d850b..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/prometheus.go +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1alpha1 - -import ( - "encoding/json" - - "github.com/pkg/errors" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - dynamic "k8s.io/client-go/deprecated-dynamic" - "k8s.io/client-go/rest" -) - -const ( - PrometheusesKind = "Prometheus" - PrometheusName = "prometheuses" -) - -type PrometheusesGetter interface { - Prometheuses(namespace string) PrometheusInterface -} - -var _ PrometheusInterface = &prometheuses{} - -type PrometheusInterface interface { - Create(*Prometheus) (*Prometheus, error) - Get(name string, opts metav1.GetOptions) (*Prometheus, error) - Update(*Prometheus) (*Prometheus, error) - Delete(name string, options *metav1.DeleteOptions) error - List(opts metav1.ListOptions) (runtime.Object, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error -} - -type prometheuses struct { - restClient rest.Interface - client dynamic.ResourceInterface - ns string -} - -func newPrometheuses(r rest.Interface, c *dynamic.Client, namespace string) *prometheuses { - return &prometheuses{ - r, - c.Resource( - &metav1.APIResource{ - Kind: PrometheusesKind, - Name: PrometheusName, - Namespaced: true, - }, - namespace, - ), - namespace, - } -} - -func (p *prometheuses) Create(o *Prometheus) (*Prometheus, error) { - up, err := UnstructuredFromPrometheus(o) - if err != nil { - return nil, err - } - - up, err = p.client.Create(up) - if err != nil { - return nil, err - } - - return PrometheusFromUnstructured(up) -} - -func (p *prometheuses) Get(name string, opts metav1.GetOptions) (*Prometheus, error) { - obj, err := p.client.Get(name, opts) - if err != nil { - return nil, err - } - return PrometheusFromUnstructured(obj) -} - -func (p *prometheuses) Update(o *Prometheus) (*Prometheus, error) { - up, err := UnstructuredFromPrometheus(o) - if err != nil { - return nil, err - } - - curp, err := p.Get(o.Name, metav1.GetOptions{}) - if err != nil { - return nil, errors.Wrap(err, "unable to get current version for update") - } - up.SetResourceVersion(curp.ObjectMeta.ResourceVersion) - - up, err = p.client.Update(up) - if err != nil { - return nil, err - } - - return PrometheusFromUnstructured(up) -} - -func (p *prometheuses) Delete(name string, options *metav1.DeleteOptions) error { - return p.client.Delete(name, options) -} - -func (p *prometheuses) List(opts metav1.ListOptions) (runtime.Object, error) { - req := p.restClient.Get(). - Namespace(p.ns). - Resource("prometheuses") - - b, err := req.DoRaw() - if err != nil { - return nil, err - } - var prom PrometheusList - return &prom, json.Unmarshal(b, &prom) -} - -func (p *prometheuses) Watch(opts metav1.ListOptions) (watch.Interface, error) { - r, err := p.restClient.Get(). - Prefix("watch"). - Namespace(p.ns). - Resource("prometheuses"). - Stream() - if err != nil { - return nil, err - } - return watch.NewStreamWatcher(&prometheusDecoder{ - dec: json.NewDecoder(r), - close: r.Close, - }), nil -} - -func (p *prometheuses) DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error { - return p.client.DeleteCollection(dopts, lopts) -} - -// PrometheusFromUnstructured unmarshals a Prometheus object from dynamic client's unstructured -func PrometheusFromUnstructured(r *unstructured.Unstructured) (*Prometheus, error) { - b, err := json.Marshal(r.Object) - if err != nil { - return nil, err - } - var p Prometheus - if err := json.Unmarshal(b, &p); err != nil { - return nil, err - } - p.TypeMeta.Kind = PrometheusesKind - p.TypeMeta.APIVersion = Group + "/" + Version - return &p, nil -} - -// UnstructuredFromPrometheus marshals a Prometheus object into dynamic client's unstructured -func UnstructuredFromPrometheus(p *Prometheus) (*unstructured.Unstructured, error) { - p.TypeMeta.Kind = PrometheusesKind - p.TypeMeta.APIVersion = Group + "/" + Version - b, err := json.Marshal(p) - if err != nil { - return nil, err - } - var r unstructured.Unstructured - if err := json.Unmarshal(b, &r.Object); err != nil { - return nil, err - } - return &r, nil -} - -type prometheusDecoder struct { - dec *json.Decoder - close func() error -} - -func (d *prometheusDecoder) Close() { - d.close() -} - -func (d *prometheusDecoder) Decode() (action watch.EventType, object runtime.Object, err error) { - var e struct { - Type watch.EventType - Object Prometheus - } - if err := d.dec.Decode(&e); err != nil { - return watch.Error, nil, err - } - return e.Type, &e.Object, nil -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/servicemonitor.go deleted file mode 100644 index adc2a5b9e..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/servicemonitor.go +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1alpha1 - -import ( - "encoding/json" - - "github.com/pkg/errors" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - dynamic "k8s.io/client-go/deprecated-dynamic" - "k8s.io/client-go/rest" -) - -const ( - ServiceMonitorsKind = "ServiceMonitor" - ServiceMonitorName = "servicemonitors" -) - -type ServiceMonitorsGetter interface { - ServiceMonitors(namespace string) ServiceMonitorInterface -} - -var _ ServiceMonitorInterface = &servicemonitors{} - -type ServiceMonitorInterface interface { - Create(*ServiceMonitor) (*ServiceMonitor, error) - Get(name string, opts metav1.GetOptions) (*ServiceMonitor, error) - Update(*ServiceMonitor) (*ServiceMonitor, error) - Delete(name string, options *metav1.DeleteOptions) error - List(opts metav1.ListOptions) (runtime.Object, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error -} - -type servicemonitors struct { - restClient rest.Interface - client dynamic.ResourceInterface - ns string -} - -func newServiceMonitors(r rest.Interface, c *dynamic.Client, namespace string) *servicemonitors { - return &servicemonitors{ - r, - c.Resource( - &metav1.APIResource{ - Kind: ServiceMonitorsKind, - Name: ServiceMonitorName, - Namespaced: true, - }, - namespace, - ), - namespace, - } -} - -func (s *servicemonitors) Create(o *ServiceMonitor) (*ServiceMonitor, error) { - us, err := UnstructuredFromServiceMonitor(o) - if err != nil { - return nil, err - } - - us, err = s.client.Create(us) - if err != nil { - return nil, err - } - - return ServiceMonitorFromUnstructured(us) -} - -func (s *servicemonitors) Get(name string, opts metav1.GetOptions) (*ServiceMonitor, error) { - obj, err := s.client.Get(name, opts) - if err != nil { - return nil, err - } - return ServiceMonitorFromUnstructured(obj) -} - -func (s *servicemonitors) Update(o *ServiceMonitor) (*ServiceMonitor, error) { - us, err := UnstructuredFromServiceMonitor(o) - if err != nil { - return nil, err - } - - curs, err := s.Get(o.Name, metav1.GetOptions{}) - if err != nil { - return nil, errors.Wrap(err, "unable to get current version for update") - } - us.SetResourceVersion(curs.ObjectMeta.ResourceVersion) - - us, err = s.client.Update(us) - if err != nil { - return nil, err - } - - return ServiceMonitorFromUnstructured(us) -} - -func (s *servicemonitors) Delete(name string, options *metav1.DeleteOptions) error { - return s.client.Delete(name, options) -} - -func (s *servicemonitors) List(opts metav1.ListOptions) (runtime.Object, error) { - req := s.restClient.Get(). - Namespace(s.ns). - Resource("servicemonitors") - - b, err := req.DoRaw() - if err != nil { - return nil, err - } - var sm ServiceMonitorList - return &sm, json.Unmarshal(b, &sm) -} - -func (s *servicemonitors) Watch(opts metav1.ListOptions) (watch.Interface, error) { - r, err := s.restClient.Get(). - Prefix("watch"). - Namespace(s.ns). - Resource("servicemonitors"). - Stream() - if err != nil { - return nil, err - } - return watch.NewStreamWatcher(&serviceMonitorDecoder{ - dec: json.NewDecoder(r), - close: r.Close, - }), nil -} - -func (s *servicemonitors) DeleteCollection(dopts *metav1.DeleteOptions, lopts metav1.ListOptions) error { - return s.client.DeleteCollection(dopts, lopts) -} - -// ServiceMonitorFromUnstructured unmarshals a ServiceMonitor object from dynamic client's unstructured -func ServiceMonitorFromUnstructured(r *unstructured.Unstructured) (*ServiceMonitor, error) { - b, err := json.Marshal(r.Object) - if err != nil { - return nil, err - } - var s ServiceMonitor - if err := json.Unmarshal(b, &s); err != nil { - return nil, err - } - s.TypeMeta.Kind = ServiceMonitorsKind - s.TypeMeta.APIVersion = Group + "/" + Version - return &s, nil -} - -// UnstructuredFromServiceMonitor marshals a ServiceMonitor object into dynamic client's unstructured -func UnstructuredFromServiceMonitor(s *ServiceMonitor) (*unstructured.Unstructured, error) { - s.TypeMeta.Kind = ServiceMonitorsKind - s.TypeMeta.APIVersion = Group + "/" + Version - b, err := json.Marshal(s) - if err != nil { - return nil, err - } - var r unstructured.Unstructured - if err := json.Unmarshal(b, &r.Object); err != nil { - return nil, err - } - return &r, nil -} - -type serviceMonitorDecoder struct { - dec *json.Decoder - close func() error -} - -func (d *serviceMonitorDecoder) Close() { - d.close() -} - -func (d *serviceMonitorDecoder) Decode() (action watch.EventType, object runtime.Object, err error) { - var e struct { - Type watch.EventType - Object ServiceMonitor - } - if err := d.dec.Decode(&e); err != nil { - return watch.Error, nil, err - } - return e.Type, &e.Object, nil -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/types.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/types.go deleted file mode 100644 index 49f8e4c29..000000000 --- a/vendor/github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1/types.go +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright 2016 The prometheus-operator 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 v1alpha1 - -import ( - "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/intstr" -) - -// Prometheus defines a Prometheus deployment. -type Prometheus struct { - metav1.TypeMeta `json:",inline"` - // Standard object’s metadata. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - metav1.ObjectMeta `json:"metadata,omitempty"` - // Specification of the desired behavior of the Prometheus cluster. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status - Spec PrometheusSpec `json:"spec"` - // Most recent observed status of the Prometheus cluster. Read-only. Not - // included when requesting from the apiserver, only from the Prometheus - // Operator API itself. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status - Status *PrometheusStatus `json:"status,omitempty"` -} - -// PrometheusList is a list of Prometheuses. -type PrometheusList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - metav1.ListMeta `json:"metadata,omitempty"` - // List of Prometheuses - Items []*Prometheus `json:"items"` -} - -// PrometheusSpec is the specification of the desired behavior of the Prometheus cluster. More info: -// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status -type PrometheusSpec struct { - // Standard object’s metadata. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - // Metadata Labels and Annotations gets propagated to the prometheus pods. - PodMetadata *metav1.ObjectMeta `json:"podMetadata,omitempty"` - // ServiceMonitors to be selected for target discovery. - ServiceMonitorSelector *metav1.LabelSelector `json:"serviceMonitorSelector,omitempty"` - // Version of Prometheus to be deployed. - Version string `json:"version,omitempty"` - // When a Prometheus deployment is paused, no actions except for deletion - // will be performed on the underlying objects. - Paused bool `json:"paused,omitempty"` - // Base image to use for a Prometheus deployment. - BaseImage string `json:"baseImage,omitempty"` - // An optional list of references to secrets in the same namespace - // to use for pulling prometheus and alertmanager images from registries - // see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod - ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"` - // Number of instances to deploy for a Prometheus deployment. - Replicas *int32 `json:"replicas,omitempty"` - // Time duration Prometheus shall retain data for. - Retention string `json:"retention,omitempty"` - // Interval between consecutive evaluations. - EvaluationInterval string `json:"evaluationInterval,omitempty"` - // The labels to add to any time series or alerts when communicating with - // external systems (federation, remote storage, Alertmanager). - ExternalLabels map[string]string `json:"externalLabels,omitempty"` - // The external URL the Prometheus instances will be available under. This is - // necessary to generate correct URLs. This is necessary if Prometheus is not - // served from root of a DNS name. - ExternalURL string `json:"externalUrl,omitempty"` - // The route prefix Prometheus registers HTTP handlers for. This is useful, - // if using ExternalURL and a proxy is rewriting HTTP routes of a request, - // and the actual ExternalURL is still true, but the server serves requests - // under a different route prefix. For example for use with `kubectl proxy`. - RoutePrefix string `json:"routePrefix,omitempty"` - // Storage spec to specify how storage shall be used. - Storage *StorageSpec `json:"storage,omitempty"` - // A selector to select which ConfigMaps to mount for loading rule files from. - RuleSelector *metav1.LabelSelector `json:"ruleSelector,omitempty"` - // Define details regarding alerting. - Alerting AlertingSpec `json:"alerting,omitempty"` - // Define resources requests and limits for single Pods. - Resources v1.ResourceRequirements `json:"resources,omitempty"` - // Define which Nodes the Pods are scheduled on. - NodeSelector map[string]string `json:"nodeSelector,omitempty"` - // ServiceAccountName is the name of the ServiceAccount to use to run the - // Prometheus Pods. - ServiceAccountName string `json:"serviceAccountName,omitempty"` - // Secrets is a list of Secrets in the same namespace as the Prometheus - // object, which shall be mounted into the Prometheus Pods. - // The Secrets are mounted into /etc/prometheus/secrets/. - // Secrets changes after initial creation of a Prometheus object are not - // reflected in the running Pods. To change the secrets mounted into the - // Prometheus Pods, the object must be deleted and recreated with the new list - // of secrets. - Secrets []string `json:"secrets,omitempty"` - // EvaluationInterval string `json:"evaluationInterval"` - // Remote RemoteSpec `json:"remote"` - // Sharding... - // Priority class assigned to the Pods - PriorityClassName string `json:"priorityClassName,omitempty"` -} - -// PrometheusStatus is the most recent observed status of the Prometheus cluster. Read-only. Not -// included when requesting from the apiserver, only from the Prometheus -// Operator API itself. More info: -// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status -type PrometheusStatus struct { - // Represents whether any actions on the underlaying managed objects are - // being performed. Only delete actions will be performed. - Paused bool `json:"paused"` - // Total number of non-terminated pods targeted by this Prometheus deployment - // (their labels match the selector). - Replicas int32 `json:"replicas"` - // Total number of non-terminated pods targeted by this Prometheus deployment - // that have the desired version spec. - UpdatedReplicas int32 `json:"updatedReplicas"` - // Total number of available pods (ready for at least minReadySeconds) - // targeted by this Prometheus deployment. - AvailableReplicas int32 `json:"availableReplicas"` - // Total number of unavailable pods targeted by this Prometheus deployment. - UnavailableReplicas int32 `json:"unavailableReplicas"` -} - -// AlertingSpec defines parameters for alerting configuration of Prometheus servers. -type AlertingSpec struct { - // AlertmanagerEndpoints Prometheus should fire alerts against. - Alertmanagers []AlertmanagerEndpoints `json:"alertmanagers"` -} - -// StorageSpec defines the configured storage for a group Prometheus servers. -type StorageSpec struct { - // Name of the StorageClass to use when requesting storage provisioning. More - // info: https://kubernetes.io/docs/user-guide/persistent-volumes/#storageclasses - // DEPRECATED - Class string `json:"class"` - // A label query over volumes to consider for binding. - // DEPRECATED - Selector *metav1.LabelSelector `json:"selector"` - // Resources represents the minimum resources the volume should have. More - // info: http://kubernetes.io/docs/user-guide/persistent-volumes#resources - // DEPRECATED - Resources v1.ResourceRequirements `json:"resources"` - // A PVC spec to be used by the Prometheus StatefulSets. - VolumeClaimTemplate v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"` -} - -// AlertmanagerEndpoints defines a selection of a single Endpoints object -// containing alertmanager IPs to fire alerts against. -type AlertmanagerEndpoints struct { - // Namespace of Endpoints object. - Namespace string `json:"namespace"` - // Name of Endpoints object in Namespace. - Name string `json:"name"` - // Port the Alertmanager API is exposed on. - Port intstr.IntOrString `json:"port"` - // Scheme to use when firing alerts. - Scheme string `json:"scheme,omitempty"` - // Prefix for the HTTP path alerts are pushed to. - PathPrefix string `json:"pathPrefix,omitempty"` -} - -// ServiceMonitor defines monitoring for a set of services. -type ServiceMonitor struct { - metav1.TypeMeta `json:",inline"` - // Standard object’s metadata. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - metav1.ObjectMeta `json:"metadata,omitempty"` - // Specification of desired Service selection for target discrovery by - // Prometheus. - Spec ServiceMonitorSpec `json:"spec"` -} - -// ServiceMonitorSpec contains specification parameters for a ServiceMonitor. -type ServiceMonitorSpec struct { - // The label to use to retrieve the job name from. - JobLabel string `json:"jobLabel,omitempty"` - // A list of endpoints allowed as part of this ServiceMonitor. - Endpoints []Endpoint `json:"endpoints"` - // Selector to select Endpoints objects. - Selector metav1.LabelSelector `json:"selector"` - // Selector to select which namespaces the Endpoints objects are discovered from. - NamespaceSelector NamespaceSelector `json:"namespaceSelector,omitempty"` -} - -// Endpoint defines a scrapeable endpoint serving Prometheus metrics. -type Endpoint struct { - // Name of the service port this endpoint refers to. Mutually exclusive with targetPort. - Port string `json:"port,omitempty"` - // Name or number of the target port of the endpoint. Mutually exclusive with port. - TargetPort intstr.IntOrString `json:"targetPort,omitempty"` - // HTTP path to scrape for metrics. - Path string `json:"path,omitempty"` - // HTTP scheme to use for scraping. - Scheme string `json:"scheme,omitempty"` - // Interval at which metrics should be scraped - Interval string `json:"interval,omitempty"` - // Timeout after which the scrape is ended - ScrapeTimeout string `json:"scrapeTimeout,omitempty"` - // TLS configuration to use when scraping the endpoint - TLSConfig *TLSConfig `json:"tlsConfig,omitempty"` - // File to read bearer token for scraping targets. - BearerTokenFile string `json:"bearerTokenFile,omitempty"` - // HonorLabels chooses the metric's labels on collisions with target labels. - HonorLabels bool `json:"honorLabels,omitempty"` - // BasicAuth allow an endpoint to authenticate over basic authentication - // More info: https://prometheus.io/docs/operating/configuration/#endpoints - BasicAuth *BasicAuth `json:"basicAuth,omitempty"` - // ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint. - ProxyURL *string `json:"proxyUrl,omitempty"` -} - -// BasicAuth allow an endpoint to authenticate over basic authentication -// More info: https://prometheus.io/docs/operating/configuration/#endpoints -type BasicAuth struct { - // The secret that contains the username for authenticate - Username v1.SecretKeySelector `json:"username,omitempty"` - // The secret that contains the password for authenticate - Password v1.SecretKeySelector `json:"password,omitempty"` -} - -// TLSConfig specifies TLS configuration parameters. -type TLSConfig struct { - // The CA cert to use for the targets. - CAFile string `json:"caFile,omitempty"` - // The client cert file for the targets. - CertFile string `json:"certFile,omitempty"` - // The client key file for the targets. - KeyFile string `json:"keyFile,omitempty"` - // Used to verify the hostname for the targets. - ServerName string `json:"serverName,omitempty"` - // Disable target certificate validation. - InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` -} - -// ServiceMonitorList is a list of ServiceMonitors. -type ServiceMonitorList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - metav1.ListMeta `json:"metadata,omitempty"` - // List of ServiceMonitors - Items []*ServiceMonitor `json:"items"` -} - -// Alertmanager describes an Alertmanager cluster. -type Alertmanager struct { - metav1.TypeMeta `json:",inline"` - // Standard object’s metadata. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - metav1.ObjectMeta `json:"metadata,omitempty"` - // Specification of the desired behavior of the Alertmanager cluster. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status - Spec AlertmanagerSpec `json:"spec"` - // Most recent observed status of the Alertmanager cluster. Read-only. Not - // included when requesting from the apiserver, only from the Prometheus - // Operator API itself. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status - Status *AlertmanagerStatus `json:"status,omitempty"` -} - -// AlertmanagerSpec is the specification of the desired behavior of the Alertmanager cluster. More info: -// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status -type AlertmanagerSpec struct { - // Standard object’s metadata. More info: - // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - // Metadata Labels and Annotations gets propagated to the prometheus pods. - PodMetadata *metav1.ObjectMeta `json:"podMetadata,omitempty"` - // Version the cluster should be on. - Version string `json:"version,omitempty"` - // Base image that is used to deploy pods. - BaseImage string `json:"baseImage,omitempty"` - // An optional list of references to secrets in the same namespace - // to use for pulling prometheus and alertmanager images from registries - // see http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod - ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"` - // Size is the expected size of the alertmanager cluster. The controller will - // eventually make the size of the running cluster equal to the expected - // size. - Replicas *int32 `json:"replicas,omitempty"` - // Storage is the definition of how storage will be used by the Alertmanager - // instances. - Storage *StorageSpec `json:"storage,omitempty"` - // The external URL the Alertmanager instances will be available under. This is - // necessary to generate correct URLs. This is necessary if Alertmanager is not - // served from root of a DNS name. - ExternalURL string `json:"externalUrl,omitempty"` - // The route prefix Alertmanager registers HTTP handlers for. This is useful, - // if using ExternalURL and a proxy is rewriting HTTP routes of a request, - // and the actual ExternalURL is still true, but the server serves requests - // under a different route prefix. For example for use with `kubectl proxy`. - RoutePrefix string `json:"routePrefix,omitempty"` - // If set to true all actions on the underlaying managed objects are not - // goint to be performed, except for delete actions. - Paused bool `json:"paused,omitempty"` - // Define which Nodes the Pods are scheduled on. - NodeSelector map[string]string `json:"nodeSelector,omitempty"` - // Define resources requests and limits for single Pods. - Resources v1.ResourceRequirements `json:"resources,omitempty"` - // Priority class assigned to the Pods - PriorityClassName string `json:"priorityClassName,omitempty"` -} - -// AlertmanagerList is a list of Alertmanagers. -type AlertmanagerList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata - metav1.ListMeta `json:"metadata,omitempty"` - // List of Alertmanagers - Items []Alertmanager `json:"items"` -} - -// AlertmanagerStatus is the most recent observed status of the Alertmanager cluster. Read-only. Not -// included when requesting from the apiserver, only from the Prometheus -// Operator API itself. More info: -// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status -type AlertmanagerStatus struct { - // Represents whether any actions on the underlaying managed objects are - // being performed. Only delete actions will be performed. - Paused bool `json:"paused"` - // Total number of non-terminated pods targeted by this Alertmanager - // cluster (their labels match the selector). - Replicas int32 `json:"replicas"` - // Total number of non-terminated pods targeted by this Alertmanager - // cluster that have the desired version spec. - UpdatedReplicas int32 `json:"updatedReplicas"` - // Total number of available pods (ready for at least minReadySeconds) - // targeted by this Alertmanager cluster. - AvailableReplicas int32 `json:"availableReplicas"` - // Total number of unavailable pods targeted by this Alertmanager cluster. - UnavailableReplicas int32 `json:"unavailableReplicas"` -} - -// NamespaceSelector is a selector for selecting either all namespaces or a -// list of namespaces. -type NamespaceSelector struct { - // Boolean describing whether all namespaces are selected in contrast to a - // list restricting them. - Any bool `json:"any,omitempty"` - // List of namespace names. - MatchNames []string `json:"matchNames,omitempty"` - - // TODO(fabxc): this should embed metav1.LabelSelector eventually. - // Currently the selector is only used for namespaces which require more complex - // implementation to support label selections. -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *Alertmanager) DeepCopyObject() runtime.Object { - panic("DeepCopyObject not implemented for Alertmanager") -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *AlertmanagerList) DeepCopyObject() runtime.Object { - panic("DeepCopyObject not implemented for AlertmanagerList") -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *Prometheus) DeepCopyObject() runtime.Object { - panic("DeepCopyObject not implemented for Prometheus") -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *PrometheusList) DeepCopyObject() runtime.Object { - panic("DeepCopyObject not implemented for PrometheusList") -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *ServiceMonitor) DeepCopyObject() runtime.Object { - panic("DeepCopyObject not implemented for ServiceMonitor") -} - -// DeepCopyObject implements the runtime.Object interface. -func (l *ServiceMonitorList) DeepCopyObject() runtime.Object { - panic("DeepCopyObject not implemented for ServiceMonitorList") -} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/clientset.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/clientset.go new file mode 100644 index 000000000..65bcd3f50 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/clientset.go @@ -0,0 +1,96 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + MonitoringV1() monitoringv1.MonitoringV1Interface + // Deprecated: please explicitly pick a version if possible. + Monitoring() monitoringv1.MonitoringV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + monitoringV1 *monitoringv1.MonitoringV1Client +} + +// MonitoringV1 retrieves the MonitoringV1Client +func (c *Clientset) MonitoringV1() monitoringv1.MonitoringV1Interface { + return c.monitoringV1 +} + +// Deprecated: Monitoring retrieves the default version of MonitoringClient. +// Please explicitly pick a version. +func (c *Clientset) Monitoring() monitoringv1.MonitoringV1Interface { + return c.monitoringV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.monitoringV1, err = monitoringv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.monitoringV1 = monitoringv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.monitoringV1 = monitoringv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/doc.go new file mode 100644 index 000000000..864d1ee95 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package versioned diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/clientset_generated.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/clientset_generated.go new file mode 100644 index 000000000..9793e9287 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/clientset_generated.go @@ -0,0 +1,80 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + clientset "github.com/coreos/prometheus-operator/pkg/client/versioned" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1" + fakemonitoringv1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// MonitoringV1 retrieves the MonitoringV1Client +func (c *Clientset) MonitoringV1() monitoringv1.MonitoringV1Interface { + return &fakemonitoringv1.FakeMonitoringV1{Fake: &c.Fake} +} + +// Monitoring retrieves the MonitoringV1Client +func (c *Clientset) Monitoring() monitoringv1.MonitoringV1Interface { + return &fakemonitoringv1.FakeMonitoringV1{Fake: &c.Fake} +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/doc.go new file mode 100644 index 000000000..196645603 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/register.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/register.go new file mode 100644 index 000000000..a367c6906 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/fake/register.go @@ -0,0 +1,52 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + monitoringv1.AddToScheme(scheme) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/doc.go new file mode 100644 index 000000000..ff8997207 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/register.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/register.go new file mode 100644 index 000000000..2fbbd18bb --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/scheme/register.go @@ -0,0 +1,52 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + monitoringv1.AddToScheme(scheme) +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/alertmanager.go new file mode 100644 index 000000000..3aee46abd --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/alertmanager.go @@ -0,0 +1,172 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + scheme "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// AlertmanagersGetter has a method to return a AlertmanagerInterface. +// A group's client should implement this interface. +type AlertmanagersGetter interface { + Alertmanagers(namespace string) AlertmanagerInterface +} + +// AlertmanagerInterface has methods to work with Alertmanager resources. +type AlertmanagerInterface interface { + Create(*v1.Alertmanager) (*v1.Alertmanager, error) + Update(*v1.Alertmanager) (*v1.Alertmanager, error) + UpdateStatus(*v1.Alertmanager) (*v1.Alertmanager, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Alertmanager, error) + List(opts meta_v1.ListOptions) (*v1.AlertmanagerList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Alertmanager, err error) + AlertmanagerExpansion +} + +// alertmanagers implements AlertmanagerInterface +type alertmanagers struct { + client rest.Interface + ns string +} + +// newAlertmanagers returns a Alertmanagers +func newAlertmanagers(c *MonitoringV1Client, namespace string) *alertmanagers { + return &alertmanagers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the alertmanager, and returns the corresponding alertmanager object, and an error if there is any. +func (c *alertmanagers) Get(name string, options meta_v1.GetOptions) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Get(). + Namespace(c.ns). + Resource("alertmanagers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Alertmanagers that match those selectors. +func (c *alertmanagers) List(opts meta_v1.ListOptions) (result *v1.AlertmanagerList, err error) { + result = &v1.AlertmanagerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("alertmanagers"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested alertmanagers. +func (c *alertmanagers) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("alertmanagers"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a alertmanager and creates it. Returns the server's representation of the alertmanager, and an error, if there is any. +func (c *alertmanagers) Create(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Post(). + Namespace(c.ns). + Resource("alertmanagers"). + Body(alertmanager). + Do(). + Into(result) + return +} + +// Update takes the representation of a alertmanager and updates it. Returns the server's representation of the alertmanager, and an error, if there is any. +func (c *alertmanagers) Update(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Put(). + Namespace(c.ns). + Resource("alertmanagers"). + Name(alertmanager.Name). + Body(alertmanager). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *alertmanagers) UpdateStatus(alertmanager *v1.Alertmanager) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Put(). + Namespace(c.ns). + Resource("alertmanagers"). + Name(alertmanager.Name). + SubResource("status"). + Body(alertmanager). + Do(). + Into(result) + return +} + +// Delete takes name of the alertmanager and deletes it. Returns an error if one occurs. +func (c *alertmanagers) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("alertmanagers"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *alertmanagers) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("alertmanagers"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched alertmanager. +func (c *alertmanagers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Alertmanager, err error) { + result = &v1.Alertmanager{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("alertmanagers"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/doc.go new file mode 100644 index 000000000..7938dcdd2 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/doc.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/doc.go new file mode 100644 index 000000000..04062e3f3 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_alertmanager.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_alertmanager.go new file mode 100644 index 000000000..18bb1e9c6 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_alertmanager.go @@ -0,0 +1,138 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeAlertmanagers implements AlertmanagerInterface +type FakeAlertmanagers struct { + Fake *FakeMonitoringV1 + ns string +} + +var alertmanagersResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "alertmanagers"} + +var alertmanagersKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "Alertmanager"} + +// Get takes name of the alertmanager, and returns the corresponding alertmanager object, and an error if there is any. +func (c *FakeAlertmanagers) Get(name string, options v1.GetOptions) (result *monitoring_v1.Alertmanager, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(alertmanagersResource, c.ns, name), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), err +} + +// List takes label and field selectors, and returns the list of Alertmanagers that match those selectors. +func (c *FakeAlertmanagers) List(opts v1.ListOptions) (result *monitoring_v1.AlertmanagerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(alertmanagersResource, alertmanagersKind, c.ns, opts), &monitoring_v1.AlertmanagerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &monitoring_v1.AlertmanagerList{ListMeta: obj.(*monitoring_v1.AlertmanagerList).ListMeta} + for _, item := range obj.(*monitoring_v1.AlertmanagerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested alertmanagers. +func (c *FakeAlertmanagers) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(alertmanagersResource, c.ns, opts)) + +} + +// Create takes the representation of a alertmanager and creates it. Returns the server's representation of the alertmanager, and an error, if there is any. +func (c *FakeAlertmanagers) Create(alertmanager *monitoring_v1.Alertmanager) (result *monitoring_v1.Alertmanager, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(alertmanagersResource, c.ns, alertmanager), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), err +} + +// Update takes the representation of a alertmanager and updates it. Returns the server's representation of the alertmanager, and an error, if there is any. +func (c *FakeAlertmanagers) Update(alertmanager *monitoring_v1.Alertmanager) (result *monitoring_v1.Alertmanager, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(alertmanagersResource, c.ns, alertmanager), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeAlertmanagers) UpdateStatus(alertmanager *monitoring_v1.Alertmanager) (*monitoring_v1.Alertmanager, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(alertmanagersResource, "status", c.ns, alertmanager), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), err +} + +// Delete takes name of the alertmanager and deletes it. Returns an error if one occurs. +func (c *FakeAlertmanagers) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(alertmanagersResource, c.ns, name), &monitoring_v1.Alertmanager{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAlertmanagers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(alertmanagersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &monitoring_v1.AlertmanagerList{}) + return err +} + +// Patch applies the patch and returns the patched alertmanager. +func (c *FakeAlertmanagers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *monitoring_v1.Alertmanager, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(alertmanagersResource, c.ns, name, data, subresources...), &monitoring_v1.Alertmanager{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Alertmanager), err +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_monitoring_client.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_monitoring_client.go new file mode 100644 index 000000000..71d7ee8f6 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_monitoring_client.go @@ -0,0 +1,50 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeMonitoringV1 struct { + *testing.Fake +} + +func (c *FakeMonitoringV1) Alertmanagers(namespace string) v1.AlertmanagerInterface { + return &FakeAlertmanagers{c, namespace} +} + +func (c *FakeMonitoringV1) Prometheuses(namespace string) v1.PrometheusInterface { + return &FakePrometheuses{c, namespace} +} + +func (c *FakeMonitoringV1) PrometheusRules(namespace string) v1.PrometheusRuleInterface { + return &FakePrometheusRules{c, namespace} +} + +func (c *FakeMonitoringV1) ServiceMonitors(namespace string) v1.ServiceMonitorInterface { + return &FakeServiceMonitors{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMonitoringV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheus.go new file mode 100644 index 000000000..5dc4eb208 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheus.go @@ -0,0 +1,138 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePrometheuses implements PrometheusInterface +type FakePrometheuses struct { + Fake *FakeMonitoringV1 + ns string +} + +var prometheusesResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "prometheuses"} + +var prometheusesKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "Prometheus"} + +// Get takes name of the prometheus, and returns the corresponding prometheus object, and an error if there is any. +func (c *FakePrometheuses) Get(name string, options v1.GetOptions) (result *monitoring_v1.Prometheus, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(prometheusesResource, c.ns, name), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), err +} + +// List takes label and field selectors, and returns the list of Prometheuses that match those selectors. +func (c *FakePrometheuses) List(opts v1.ListOptions) (result *monitoring_v1.PrometheusList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(prometheusesResource, prometheusesKind, c.ns, opts), &monitoring_v1.PrometheusList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &monitoring_v1.PrometheusList{ListMeta: obj.(*monitoring_v1.PrometheusList).ListMeta} + for _, item := range obj.(*monitoring_v1.PrometheusList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested prometheuses. +func (c *FakePrometheuses) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(prometheusesResource, c.ns, opts)) + +} + +// Create takes the representation of a prometheus and creates it. Returns the server's representation of the prometheus, and an error, if there is any. +func (c *FakePrometheuses) Create(prometheus *monitoring_v1.Prometheus) (result *monitoring_v1.Prometheus, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(prometheusesResource, c.ns, prometheus), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), err +} + +// Update takes the representation of a prometheus and updates it. Returns the server's representation of the prometheus, and an error, if there is any. +func (c *FakePrometheuses) Update(prometheus *monitoring_v1.Prometheus) (result *monitoring_v1.Prometheus, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(prometheusesResource, c.ns, prometheus), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePrometheuses) UpdateStatus(prometheus *monitoring_v1.Prometheus) (*monitoring_v1.Prometheus, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(prometheusesResource, "status", c.ns, prometheus), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), err +} + +// Delete takes name of the prometheus and deletes it. Returns an error if one occurs. +func (c *FakePrometheuses) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(prometheusesResource, c.ns, name), &monitoring_v1.Prometheus{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePrometheuses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(prometheusesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &monitoring_v1.PrometheusList{}) + return err +} + +// Patch applies the patch and returns the patched prometheus. +func (c *FakePrometheuses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *monitoring_v1.Prometheus, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(prometheusesResource, c.ns, name, data, subresources...), &monitoring_v1.Prometheus{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.Prometheus), err +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheusrule.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheusrule.go new file mode 100644 index 000000000..4ad2b5379 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_prometheusrule.go @@ -0,0 +1,126 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePrometheusRules implements PrometheusRuleInterface +type FakePrometheusRules struct { + Fake *FakeMonitoringV1 + ns string +} + +var prometheusrulesResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "prometheusrules"} + +var prometheusrulesKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "PrometheusRule"} + +// Get takes name of the prometheusRule, and returns the corresponding prometheusRule object, and an error if there is any. +func (c *FakePrometheusRules) Get(name string, options v1.GetOptions) (result *monitoring_v1.PrometheusRule, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(prometheusrulesResource, c.ns, name), &monitoring_v1.PrometheusRule{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.PrometheusRule), err +} + +// List takes label and field selectors, and returns the list of PrometheusRules that match those selectors. +func (c *FakePrometheusRules) List(opts v1.ListOptions) (result *monitoring_v1.PrometheusRuleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(prometheusrulesResource, prometheusrulesKind, c.ns, opts), &monitoring_v1.PrometheusRuleList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &monitoring_v1.PrometheusRuleList{ListMeta: obj.(*monitoring_v1.PrometheusRuleList).ListMeta} + for _, item := range obj.(*monitoring_v1.PrometheusRuleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested prometheusRules. +func (c *FakePrometheusRules) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(prometheusrulesResource, c.ns, opts)) + +} + +// Create takes the representation of a prometheusRule and creates it. Returns the server's representation of the prometheusRule, and an error, if there is any. +func (c *FakePrometheusRules) Create(prometheusRule *monitoring_v1.PrometheusRule) (result *monitoring_v1.PrometheusRule, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(prometheusrulesResource, c.ns, prometheusRule), &monitoring_v1.PrometheusRule{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.PrometheusRule), err +} + +// Update takes the representation of a prometheusRule and updates it. Returns the server's representation of the prometheusRule, and an error, if there is any. +func (c *FakePrometheusRules) Update(prometheusRule *monitoring_v1.PrometheusRule) (result *monitoring_v1.PrometheusRule, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(prometheusrulesResource, c.ns, prometheusRule), &monitoring_v1.PrometheusRule{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.PrometheusRule), err +} + +// Delete takes name of the prometheusRule and deletes it. Returns an error if one occurs. +func (c *FakePrometheusRules) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(prometheusrulesResource, c.ns, name), &monitoring_v1.PrometheusRule{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePrometheusRules) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(prometheusrulesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &monitoring_v1.PrometheusRuleList{}) + return err +} + +// Patch applies the patch and returns the patched prometheusRule. +func (c *FakePrometheusRules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *monitoring_v1.PrometheusRule, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(prometheusrulesResource, c.ns, name, data, subresources...), &monitoring_v1.PrometheusRule{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.PrometheusRule), err +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_servicemonitor.go new file mode 100644 index 000000000..9ea2b24d0 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/fake/fake_servicemonitor.go @@ -0,0 +1,126 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + monitoring_v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeServiceMonitors implements ServiceMonitorInterface +type FakeServiceMonitors struct { + Fake *FakeMonitoringV1 + ns string +} + +var servicemonitorsResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "servicemonitors"} + +var servicemonitorsKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "ServiceMonitor"} + +// Get takes name of the serviceMonitor, and returns the corresponding serviceMonitor object, and an error if there is any. +func (c *FakeServiceMonitors) Get(name string, options v1.GetOptions) (result *monitoring_v1.ServiceMonitor, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(servicemonitorsResource, c.ns, name), &monitoring_v1.ServiceMonitor{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.ServiceMonitor), err +} + +// List takes label and field selectors, and returns the list of ServiceMonitors that match those selectors. +func (c *FakeServiceMonitors) List(opts v1.ListOptions) (result *monitoring_v1.ServiceMonitorList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(servicemonitorsResource, servicemonitorsKind, c.ns, opts), &monitoring_v1.ServiceMonitorList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &monitoring_v1.ServiceMonitorList{ListMeta: obj.(*monitoring_v1.ServiceMonitorList).ListMeta} + for _, item := range obj.(*monitoring_v1.ServiceMonitorList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested serviceMonitors. +func (c *FakeServiceMonitors) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(servicemonitorsResource, c.ns, opts)) + +} + +// Create takes the representation of a serviceMonitor and creates it. Returns the server's representation of the serviceMonitor, and an error, if there is any. +func (c *FakeServiceMonitors) Create(serviceMonitor *monitoring_v1.ServiceMonitor) (result *monitoring_v1.ServiceMonitor, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(servicemonitorsResource, c.ns, serviceMonitor), &monitoring_v1.ServiceMonitor{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.ServiceMonitor), err +} + +// Update takes the representation of a serviceMonitor and updates it. Returns the server's representation of the serviceMonitor, and an error, if there is any. +func (c *FakeServiceMonitors) Update(serviceMonitor *monitoring_v1.ServiceMonitor) (result *monitoring_v1.ServiceMonitor, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(servicemonitorsResource, c.ns, serviceMonitor), &monitoring_v1.ServiceMonitor{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.ServiceMonitor), err +} + +// Delete takes name of the serviceMonitor and deletes it. Returns an error if one occurs. +func (c *FakeServiceMonitors) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(servicemonitorsResource, c.ns, name), &monitoring_v1.ServiceMonitor{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeServiceMonitors) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(servicemonitorsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &monitoring_v1.ServiceMonitorList{}) + return err +} + +// Patch applies the patch and returns the patched serviceMonitor. +func (c *FakeServiceMonitors) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *monitoring_v1.ServiceMonitor, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(servicemonitorsResource, c.ns, name, data, subresources...), &monitoring_v1.ServiceMonitor{}) + + if obj == nil { + return nil, err + } + return obj.(*monitoring_v1.ServiceMonitor), err +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/generated_expansion.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/generated_expansion.go new file mode 100644 index 000000000..88cf4ce92 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/generated_expansion.go @@ -0,0 +1,25 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type AlertmanagerExpansion interface{} + +type PrometheusExpansion interface{} + +type PrometheusRuleExpansion interface{} + +type ServiceMonitorExpansion interface{} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/monitoring_client.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/monitoring_client.go new file mode 100644 index 000000000..6e5bac92b --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/monitoring_client.go @@ -0,0 +1,103 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type MonitoringV1Interface interface { + RESTClient() rest.Interface + AlertmanagersGetter + PrometheusesGetter + PrometheusRulesGetter + ServiceMonitorsGetter +} + +// MonitoringV1Client is used to interact with features provided by the monitoring.coreos.com group. +type MonitoringV1Client struct { + restClient rest.Interface +} + +func (c *MonitoringV1Client) Alertmanagers(namespace string) AlertmanagerInterface { + return newAlertmanagers(c, namespace) +} + +func (c *MonitoringV1Client) Prometheuses(namespace string) PrometheusInterface { + return newPrometheuses(c, namespace) +} + +func (c *MonitoringV1Client) PrometheusRules(namespace string) PrometheusRuleInterface { + return newPrometheusRules(c, namespace) +} + +func (c *MonitoringV1Client) ServiceMonitors(namespace string) ServiceMonitorInterface { + return newServiceMonitors(c, namespace) +} + +// NewForConfig creates a new MonitoringV1Client for the given config. +func NewForConfig(c *rest.Config) (*MonitoringV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &MonitoringV1Client{client}, nil +} + +// NewForConfigOrDie creates a new MonitoringV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *MonitoringV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new MonitoringV1Client for the given RESTClient. +func New(c rest.Interface) *MonitoringV1Client { + return &MonitoringV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *MonitoringV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheus.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheus.go new file mode 100644 index 000000000..2e572b1b7 --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheus.go @@ -0,0 +1,172 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + scheme "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PrometheusesGetter has a method to return a PrometheusInterface. +// A group's client should implement this interface. +type PrometheusesGetter interface { + Prometheuses(namespace string) PrometheusInterface +} + +// PrometheusInterface has methods to work with Prometheus resources. +type PrometheusInterface interface { + Create(*v1.Prometheus) (*v1.Prometheus, error) + Update(*v1.Prometheus) (*v1.Prometheus, error) + UpdateStatus(*v1.Prometheus) (*v1.Prometheus, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Prometheus, error) + List(opts meta_v1.ListOptions) (*v1.PrometheusList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Prometheus, err error) + PrometheusExpansion +} + +// prometheuses implements PrometheusInterface +type prometheuses struct { + client rest.Interface + ns string +} + +// newPrometheuses returns a Prometheuses +func newPrometheuses(c *MonitoringV1Client, namespace string) *prometheuses { + return &prometheuses{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the prometheus, and returns the corresponding prometheus object, and an error if there is any. +func (c *prometheuses) Get(name string, options meta_v1.GetOptions) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Get(). + Namespace(c.ns). + Resource("prometheuses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Prometheuses that match those selectors. +func (c *prometheuses) List(opts meta_v1.ListOptions) (result *v1.PrometheusList, err error) { + result = &v1.PrometheusList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("prometheuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested prometheuses. +func (c *prometheuses) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("prometheuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a prometheus and creates it. Returns the server's representation of the prometheus, and an error, if there is any. +func (c *prometheuses) Create(prometheus *v1.Prometheus) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Post(). + Namespace(c.ns). + Resource("prometheuses"). + Body(prometheus). + Do(). + Into(result) + return +} + +// Update takes the representation of a prometheus and updates it. Returns the server's representation of the prometheus, and an error, if there is any. +func (c *prometheuses) Update(prometheus *v1.Prometheus) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Put(). + Namespace(c.ns). + Resource("prometheuses"). + Name(prometheus.Name). + Body(prometheus). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *prometheuses) UpdateStatus(prometheus *v1.Prometheus) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Put(). + Namespace(c.ns). + Resource("prometheuses"). + Name(prometheus.Name). + SubResource("status"). + Body(prometheus). + Do(). + Into(result) + return +} + +// Delete takes name of the prometheus and deletes it. Returns an error if one occurs. +func (c *prometheuses) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("prometheuses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *prometheuses) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("prometheuses"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched prometheus. +func (c *prometheuses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Prometheus, err error) { + result = &v1.Prometheus{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("prometheuses"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheusrule.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheusrule.go new file mode 100644 index 000000000..6e0f17bcd --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/prometheusrule.go @@ -0,0 +1,155 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + scheme "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PrometheusRulesGetter has a method to return a PrometheusRuleInterface. +// A group's client should implement this interface. +type PrometheusRulesGetter interface { + PrometheusRules(namespace string) PrometheusRuleInterface +} + +// PrometheusRuleInterface has methods to work with PrometheusRule resources. +type PrometheusRuleInterface interface { + Create(*v1.PrometheusRule) (*v1.PrometheusRule, error) + Update(*v1.PrometheusRule) (*v1.PrometheusRule, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.PrometheusRule, error) + List(opts meta_v1.ListOptions) (*v1.PrometheusRuleList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PrometheusRule, err error) + PrometheusRuleExpansion +} + +// prometheusRules implements PrometheusRuleInterface +type prometheusRules struct { + client rest.Interface + ns string +} + +// newPrometheusRules returns a PrometheusRules +func newPrometheusRules(c *MonitoringV1Client, namespace string) *prometheusRules { + return &prometheusRules{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the prometheusRule, and returns the corresponding prometheusRule object, and an error if there is any. +func (c *prometheusRules) Get(name string, options meta_v1.GetOptions) (result *v1.PrometheusRule, err error) { + result = &v1.PrometheusRule{} + err = c.client.Get(). + Namespace(c.ns). + Resource("prometheusrules"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PrometheusRules that match those selectors. +func (c *prometheusRules) List(opts meta_v1.ListOptions) (result *v1.PrometheusRuleList, err error) { + result = &v1.PrometheusRuleList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("prometheusrules"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested prometheusRules. +func (c *prometheusRules) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("prometheusrules"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a prometheusRule and creates it. Returns the server's representation of the prometheusRule, and an error, if there is any. +func (c *prometheusRules) Create(prometheusRule *v1.PrometheusRule) (result *v1.PrometheusRule, err error) { + result = &v1.PrometheusRule{} + err = c.client.Post(). + Namespace(c.ns). + Resource("prometheusrules"). + Body(prometheusRule). + Do(). + Into(result) + return +} + +// Update takes the representation of a prometheusRule and updates it. Returns the server's representation of the prometheusRule, and an error, if there is any. +func (c *prometheusRules) Update(prometheusRule *v1.PrometheusRule) (result *v1.PrometheusRule, err error) { + result = &v1.PrometheusRule{} + err = c.client.Put(). + Namespace(c.ns). + Resource("prometheusrules"). + Name(prometheusRule.Name). + Body(prometheusRule). + Do(). + Into(result) + return +} + +// Delete takes name of the prometheusRule and deletes it. Returns an error if one occurs. +func (c *prometheusRules) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("prometheusrules"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *prometheusRules) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("prometheusrules"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched prometheusRule. +func (c *prometheusRules) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PrometheusRule, err error) { + result = &v1.PrometheusRule{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("prometheusrules"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/servicemonitor.go b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/servicemonitor.go new file mode 100644 index 000000000..ae31233bc --- /dev/null +++ b/vendor/github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1/servicemonitor.go @@ -0,0 +1,155 @@ +// Copyright 2018 The prometheus-operator 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. + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + scheme "github.com/coreos/prometheus-operator/pkg/client/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ServiceMonitorsGetter has a method to return a ServiceMonitorInterface. +// A group's client should implement this interface. +type ServiceMonitorsGetter interface { + ServiceMonitors(namespace string) ServiceMonitorInterface +} + +// ServiceMonitorInterface has methods to work with ServiceMonitor resources. +type ServiceMonitorInterface interface { + Create(*v1.ServiceMonitor) (*v1.ServiceMonitor, error) + Update(*v1.ServiceMonitor) (*v1.ServiceMonitor, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ServiceMonitor, error) + List(opts meta_v1.ListOptions) (*v1.ServiceMonitorList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ServiceMonitor, err error) + ServiceMonitorExpansion +} + +// serviceMonitors implements ServiceMonitorInterface +type serviceMonitors struct { + client rest.Interface + ns string +} + +// newServiceMonitors returns a ServiceMonitors +func newServiceMonitors(c *MonitoringV1Client, namespace string) *serviceMonitors { + return &serviceMonitors{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the serviceMonitor, and returns the corresponding serviceMonitor object, and an error if there is any. +func (c *serviceMonitors) Get(name string, options meta_v1.GetOptions) (result *v1.ServiceMonitor, err error) { + result = &v1.ServiceMonitor{} + err = c.client.Get(). + Namespace(c.ns). + Resource("servicemonitors"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ServiceMonitors that match those selectors. +func (c *serviceMonitors) List(opts meta_v1.ListOptions) (result *v1.ServiceMonitorList, err error) { + result = &v1.ServiceMonitorList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("servicemonitors"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested serviceMonitors. +func (c *serviceMonitors) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("servicemonitors"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a serviceMonitor and creates it. Returns the server's representation of the serviceMonitor, and an error, if there is any. +func (c *serviceMonitors) Create(serviceMonitor *v1.ServiceMonitor) (result *v1.ServiceMonitor, err error) { + result = &v1.ServiceMonitor{} + err = c.client.Post(). + Namespace(c.ns). + Resource("servicemonitors"). + Body(serviceMonitor). + Do(). + Into(result) + return +} + +// Update takes the representation of a serviceMonitor and updates it. Returns the server's representation of the serviceMonitor, and an error, if there is any. +func (c *serviceMonitors) Update(serviceMonitor *v1.ServiceMonitor) (result *v1.ServiceMonitor, err error) { + result = &v1.ServiceMonitor{} + err = c.client.Put(). + Namespace(c.ns). + Resource("servicemonitors"). + Name(serviceMonitor.Name). + Body(serviceMonitor). + Do(). + Into(result) + return +} + +// Delete takes name of the serviceMonitor and deletes it. Returns an error if one occurs. +func (c *serviceMonitors) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("servicemonitors"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *serviceMonitors) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("servicemonitors"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched serviceMonitor. +func (c *serviceMonitors) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ServiceMonitor, err error) { + result = &v1.ServiceMonitor{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("servicemonitors"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/k8sutil/k8sutil.go b/vendor/github.com/coreos/prometheus-operator/pkg/k8sutil/k8sutil.go index b3733aaf3..17bda0cc2 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/k8sutil/k8sutil.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/k8sutil/k8sutil.go @@ -23,7 +23,7 @@ import ( "time" crdutils "github.com/ant31/crd-validation/pkg" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" version "github.com/hashicorp/go-version" "github.com/pkg/errors" "k8s.io/api/core/v1" @@ -133,6 +133,7 @@ func CreateOrUpdateService(sclient clientv1.ServiceInterface, svc *v1.Service) e } } else { svc.ResourceVersion = service.ResourceVersion + svc.SetOwnerReferences(mergeOwnerReferences(service.GetOwnerReferences(), svc.GetOwnerReferences())) _, err := sclient.Update(svc) if err != nil && !apierrors.IsNotFound(err) { return errors.Wrap(err, "updating service object failed") @@ -203,3 +204,16 @@ func SanitizeVolumeName(name string) string { } return strings.Trim(name, "-") } + +func mergeOwnerReferences(old []metav1.OwnerReference, new []metav1.OwnerReference) []metav1.OwnerReference { + existing := make(map[metav1.OwnerReference]bool) + for _, ownerRef := range old { + existing[ownerRef] = true + } + for _, ownerRef := range new { + if _, ok := existing[ownerRef]; !ok { + old = append(old, ownerRef) + } + } + return old +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch.go b/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch.go index 3d5ca7f0f..6234c75b6 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch.go @@ -153,9 +153,8 @@ func (mlw multiListerWatcher) Watch(options metav1.ListOptions) (watch.Interface // multiWatch abstracts multiple watch.Interface's, allowing them // to be treated as a single watch.Interface. type multiWatch struct { - mu sync.Mutex result chan watch.Event - stopped bool + stopped chan struct{} stoppers []func() } @@ -163,8 +162,15 @@ type multiWatch struct { // Watch funcs errored. The length of []cache.ListerWatcher and []string must // match. func newMultiWatch(lws []cache.ListerWatcher, resourceVersions []string, options metav1.ListOptions) (*multiWatch, error) { - ch := make(chan watch.Event) - var stoppers []func() + var ( + result = make(chan watch.Event) + stopped = make(chan struct{}) + stoppers []func() + wg sync.WaitGroup + ) + + wg.Add(len(lws)) + for i, lw := range lws { o := options.DeepCopy() o.ResourceVersion = resourceVersions[i] @@ -172,18 +178,38 @@ func newMultiWatch(lws []cache.ListerWatcher, resourceVersions []string, options if err != nil { return nil, err } + go func() { + defer wg.Done() + for { event, ok := <-w.ResultChan() if !ok { - break + return + } + + select { + case result <- event: + case <-stopped: + return } - ch <- event } }() stoppers = append(stoppers, w.Stop) } - return &multiWatch{result: ch, stoppers: stoppers}, nil + + // result chan must be closed, + // once all event sender goroutines exited. + go func() { + wg.Wait() + close(result) + }() + + return &multiWatch{ + result: result, + stoppers: stoppers, + stopped: stopped, + }, nil } // ResultChan implements the watch.Interface interface. @@ -195,14 +221,14 @@ func (mw *multiWatch) ResultChan() <-chan watch.Event { // It stops all of the underlying watch.Interfaces and closes the backing chan. // Can safely be called more than once. func (mw *multiWatch) Stop() { - mw.mu.Lock() - defer mw.mu.Unlock() - if !mw.stopped { + select { + case <-mw.stopped: + // nothing to do, we are already stopped + default: for _, stop := range mw.stoppers { stop() } - close(mw.result) - mw.stopped = true + close(mw.stopped) } return } diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch_test.go b/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch_test.go index 012097970..e5bce227f 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch_test.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/listwatch/listwatch_test.go @@ -74,6 +74,7 @@ func TestMultiWatchResultChan(t *testing.T) { var events []watch.Event var wg sync.WaitGroup for _, w := range ws { + w := w wg.Add(1) go func() { w.Add(&runtime.Unknown{}) @@ -108,7 +109,10 @@ func TestMultiWatchStop(t *testing.T) { if stopped != len(ws) { t.Errorf("expected %d watchers to be stopped but got %d", len(ws), stopped) } - if !m.stopped { + select { + case <-m.stopped: + // all good, watcher is closed, proceed + default: t.Error("expected multiWatch to be stopped") } _, running := <-m.ResultChan() @@ -116,3 +120,66 @@ func TestMultiWatchStop(t *testing.T) { t.Errorf("expected multiWatch chan to be closed") } } + +type mockListerWatcher struct { + evCh chan watch.Event + stopped bool +} + +func (m *mockListerWatcher) List(options metav1.ListOptions) (runtime.Object, error) { + return nil, nil +} + +func (m *mockListerWatcher) Watch(options metav1.ListOptions) (watch.Interface, error) { + return m, nil +} + +func (m *mockListerWatcher) Stop() { + m.stopped = true +} + +func (m *mockListerWatcher) ResultChan() <-chan watch.Event { + return m.evCh +} + +func TestRacyMultiWatch(t *testing.T) { + evCh := make(chan watch.Event) + lw := &mockListerWatcher{evCh: evCh} + + mw, err := newMultiWatch( + []cache.ListerWatcher{lw}, + []string{"foo"}, + metav1.ListOptions{}, + ) + if err != nil { + t.Error(err) + return + } + + // this will not block, as newMultiWatch started a goroutine, + // receiving that event and block on the dispatching it there. + evCh <- watch.Event{ + Type: "foo", + } + + if got := <-mw.ResultChan(); got.Type != "foo" { + t.Errorf("expected foo, got %s", got.Type) + return + } + + // Enqueue event, do not dequeue it. + // In conjunction with go test -race this asserts + // if there is a race between stopping and dispatching an event + evCh <- watch.Event{ + Type: "bar", + } + mw.Stop() + + if got := lw.stopped; got != true { + t.Errorf("expected watcher to be closed true, got %t", got) + } + + // some reentrant calls, should be non-blocking + mw.Stop() + mw.Stop() +} diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/collector.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/collector.go index dcce83d9b..e61d76546 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/collector.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/collector.go @@ -15,7 +15,7 @@ package prometheus import ( - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/prometheus/client_golang/prometheus" "k8s.io/client-go/tools/cache" diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator.go index 79d53872f..e7d94acac 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator.go @@ -21,8 +21,8 @@ import ( "strings" "time" - "github.com/coreos/prometheus-operator/pkg/client/monitoring" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" + monitoringclient "github.com/coreos/prometheus-operator/pkg/client/versioned" "github.com/coreos/prometheus-operator/pkg/k8sutil" "github.com/coreos/prometheus-operator/pkg/listwatch" @@ -56,7 +56,7 @@ const ( // monitoring configurations. type Operator struct { kclient kubernetes.Interface - mclient monitoring.Interface + mclient monitoringclient.Interface crdclient apiextensionsclient.Interface logger log.Logger @@ -143,7 +143,6 @@ type Config struct { CrdGroup string CrdKinds monitoringv1.CrdKinds EnableValidation bool - DisableAutoUserGroup bool LocalHost string LogLevel string LogFormat string @@ -159,21 +158,22 @@ type BasicAuthCredentials struct { func New(conf Config, logger log.Logger) (*Operator, error) { cfg, err := k8sutil.NewClusterConfig(conf.Host, conf.TLSInsecure, &conf.TLSConfig) if err != nil { - return nil, err + return nil, errors.Wrap(err, "instantiating cluster config failed") } + client, err := kubernetes.NewForConfig(cfg) if err != nil { - return nil, err + return nil, errors.Wrap(err, "instantiating kubernetes client failed") } - mclient, err := monitoring.NewForConfig(&conf.CrdKinds, conf.CrdGroup, cfg) + crdclient, err := apiextensionsclient.NewForConfig(cfg) if err != nil { - return nil, err + return nil, errors.Wrap(err, "instantiating apiextensions client failed") } - crdclient, err := apiextensionsclient.NewForConfig(cfg) + mclient, err := monitoringclient.NewForConfig(cfg) if err != nil { - return nil, errors.Wrap(err, "instantiating apiextensions client failed") + return nil, errors.Wrap(err, "instantiating monitoring client failed") } kubeletObjectName := "" @@ -207,7 +207,9 @@ func New(conf Config, logger log.Logger) (*Operator, error) { c.promInf = cache.NewSharedIndexInformer( listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { return &cache.ListWatch{ - ListFunc: mclient.MonitoringV1().Prometheuses(namespace).List, + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return mclient.MonitoringV1().Prometheuses(namespace).List(options) + }, WatchFunc: mclient.MonitoringV1().Prometheuses(namespace).Watch, } }), @@ -217,7 +219,9 @@ func New(conf Config, logger log.Logger) (*Operator, error) { c.smonInf = cache.NewSharedIndexInformer( listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { return &cache.ListWatch{ - ListFunc: mclient.MonitoringV1().ServiceMonitors(namespace).List, + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return mclient.MonitoringV1().ServiceMonitors(namespace).List(options) + }, WatchFunc: mclient.MonitoringV1().ServiceMonitors(namespace).Watch, } }), @@ -227,7 +231,9 @@ func New(conf Config, logger log.Logger) (*Operator, error) { c.ruleInf = cache.NewSharedIndexInformer( listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { return &cache.ListWatch{ - ListFunc: mclient.MonitoringV1().PrometheusRules(namespace).List, + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return mclient.MonitoringV1().PrometheusRules(namespace).List(options) + }, WatchFunc: mclient.MonitoringV1().PrometheusRules(namespace).Watch, } }), @@ -949,6 +955,10 @@ func (c *Operator) sync(key string) error { } p := obj.(*monitoringv1.Prometheus) + p = p.DeepCopy() + p.APIVersion = monitoringv1.SchemeGroupVersion.String() + p.Kind = monitoringv1.PrometheusesKind + if p.Spec.Paused { return nil } @@ -1423,21 +1433,33 @@ func (c *Operator) createCRDs() error { listFunc func(opts metav1.ListOptions) (runtime.Object, error) }{ { - "Prometheus", + monitoringv1.PrometheusesKind, listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { - return &cache.ListWatch{ListFunc: c.mclient.MonitoringV1().Prometheuses(namespace).List} + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return c.mclient.MonitoringV1().Prometheuses(namespace).List(options) + }, + } }).List, }, { - "ServiceMonitor", + monitoringv1.ServiceMonitorsKind, listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { - return &cache.ListWatch{ListFunc: c.mclient.MonitoringV1().ServiceMonitors(namespace).List} + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return c.mclient.MonitoringV1().ServiceMonitors(namespace).List(options) + }, + } }).List, }, { - "PrometheusRule", + monitoringv1.PrometheusRuleKind, listwatch.MultiNamespaceListerWatcher(c.config.Namespaces, func(namespace string) cache.ListerWatcher { - return &cache.ListWatch{ListFunc: c.mclient.MonitoringV1().PrometheusRules(namespace).List} + return &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + return c.mclient.MonitoringV1().PrometheusRules(namespace).List(options) + }, + } }).List, }, } diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator_test.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator_test.go index 564c3ba8f..34d47762f 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator_test.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/operator_test.go @@ -18,7 +18,7 @@ import ( "reflect" "testing" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg.go index c119de63a..241245aa7 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg.go @@ -27,7 +27,7 @@ import ( "gopkg.in/yaml.v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" ) var ( @@ -398,28 +398,32 @@ func (cg *configGenerator) generateServiceMonitorConfig(version semver.Version, // Relabel namespace and pod and service labels into proper labels. relabelings = append(relabelings, []yaml.MapSlice{ - { - {Key: "source_labels", Value: []string{"__meta_kubernetes_namespace"}}, - {Key: "target_label", Value: "namespace"}, - }, - { + { // Relabel node labels for pre v2.3 meta labels {Key: "source_labels", Value: []string{"__meta_kubernetes_endpoint_address_target_kind", "__meta_kubernetes_endpoint_address_target_name"}}, {Key: "separator", Value: ";"}, {Key: "regex", Value: "Node;(.*)"}, {Key: "replacement", Value: "${1}"}, {Key: "target_label", Value: "node"}, }, - { + { // Relabel pod labels for >=v2.3 meta labels {Key: "source_labels", Value: []string{"__meta_kubernetes_endpoint_address_target_kind", "__meta_kubernetes_endpoint_address_target_name"}}, {Key: "separator", Value: ";"}, {Key: "regex", Value: "Pod;(.*)"}, {Key: "replacement", Value: "${1}"}, {Key: "target_label", Value: "pod"}, }, + { + {Key: "source_labels", Value: []string{"__meta_kubernetes_namespace"}}, + {Key: "target_label", Value: "namespace"}, + }, { {Key: "source_labels", Value: []string{"__meta_kubernetes_service_name"}}, {Key: "target_label", Value: "service"}, }, + { + {Key: "source_labels", Value: []string{"__meta_kubernetes_pod_name"}}, + {Key: "target_label", Value: "pod"}, + }, }...) // Relabel targetLabels from Service onto target. diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg_test.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg_test.go index f5f3cc384..7bc70c74a 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg_test.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/promcfg_test.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/kylelemons/godebug/pretty" ) @@ -464,9 +464,6 @@ scrape_configs: source_labels: - __meta_kubernetes_endpoint_port_name regex: web - - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - source_labels: - __meta_kubernetes_endpoint_address_target_kind - __meta_kubernetes_endpoint_address_target_name @@ -481,9 +478,15 @@ scrape_configs: regex: Pod;(.*) replacement: ${1} target_label: pod + - source_labels: + - __meta_kubernetes_namespace + target_label: namespace - source_labels: - __meta_kubernetes_service_name target_label: service + - source_labels: + - __meta_kubernetes_pod_name + target_label: pod - source_labels: - __meta_kubernetes_service_label_example target_label: example @@ -582,9 +585,6 @@ scrape_configs: source_labels: - __meta_kubernetes_endpoint_port_name regex: web - - source_labels: - - __meta_kubernetes_namespace - target_label: namespace - source_labels: - __meta_kubernetes_endpoint_address_target_kind - __meta_kubernetes_endpoint_address_target_name @@ -599,9 +599,15 @@ scrape_configs: regex: Pod;(.*) replacement: ${1} target_label: pod + - source_labels: + - __meta_kubernetes_namespace + target_label: namespace - source_labels: - __meta_kubernetes_service_name target_label: service + - source_labels: + - __meta_kubernetes_pod_name + target_label: pod - source_labels: - __meta_kubernetes_pod_label_example target_label: example diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules.go index c62073365..bd2efde8b 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules.go @@ -21,7 +21,7 @@ import ( "strconv" "strings" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules_test.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules_test.go index c972dc3aa..23ff81d69 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules_test.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/rules_test.go @@ -18,7 +18,7 @@ import ( "strings" "testing" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "k8s.io/api/core/v1" ) diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset.go index b8daf8798..d36c3aca7 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset.go @@ -27,14 +27,14 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "github.com/blang/semver" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/coreos/prometheus-operator/pkg/k8sutil" "github.com/pkg/errors" ) const ( governingServiceName = "prometheus-operated" - DefaultPrometheusVersion = "v2.4.3" + DefaultPrometheusVersion = "v2.5.0" DefaultThanosVersion = "v0.1.0" defaultRetention = "24h" storageDir = "/prometheus" @@ -80,6 +80,7 @@ var ( "v2.4.1", "v2.4.2", "v2.4.3", + "v2.5.0", } ) @@ -254,6 +255,14 @@ func makeStatefulSetService(p *monitoringv1.Prometheus, config Config) *v1.Servi svc := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: governingServiceName, + OwnerReferences: []metav1.OwnerReference{ + metav1.OwnerReference{ + Name: p.GetName(), + Kind: p.Kind, + APIVersion: p.APIVersion, + UID: p.GetUID(), + }, + }, Labels: config.Labels.Merge(map[string]string{ "operated-prometheus": "true", }), @@ -292,8 +301,6 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName "-web.console.libraries=/etc/prometheus/console_libraries", } - var securityContext *v1.PodSecurityContext - switch version.Major { case 1: promArgs = append(promArgs, @@ -327,8 +334,6 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName "-storage.local.target-heap-size="+fmt.Sprintf("%d", reqMem.Value()/3*2), ) } - - securityContext = &v1.PodSecurityContext{} case 2: promArgs = append(promArgs, fmt.Sprintf("-config.file=%s", path.Join(confOutDir, configEnvsubstFilename)), @@ -337,21 +342,11 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName "-web.enable-lifecycle", "-storage.tsdb.no-lockfile", ) - - gid := int64(2000) - uid := int64(1000) - nr := true - securityContext = &v1.PodSecurityContext{ - RunAsNonRoot: &nr, - } - if !c.DisableAutoUserGroup { - securityContext.FSGroup = &gid - securityContext.RunAsUser = &uid - } default: return nil, errors.Errorf("unsupported Prometheus major version %s", version) } + var securityContext *v1.PodSecurityContext = nil if p.Spec.SecurityContext != nil { securityContext = p.Spec.SecurityContext } @@ -583,7 +578,7 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName VolumeMounts: []v1.VolumeMount{}, Resources: v1.ResourceRequirements{ Limits: v1.ResourceList{ - v1.ResourceCPU: resource.MustParse("5m"), + v1.ResourceCPU: resource.MustParse("25m"), v1.ResourceMemory: resource.MustParse("10Mi"), }, }, @@ -667,7 +662,7 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName Name: "GOOGLE_APPLICATION_CREDENTIALS", Value: path.Join(secretDir, secretFileName), }) - volumeName := "secret-" + p.Spec.Thanos.GCS.SecretKey.Name + volumeName := k8sutil.SanitizeVolumeName("secret-" + p.Spec.Thanos.GCS.SecretKey.Name) volumes = append(volumes, v1.Volume{ Name: volumeName, VolumeSource: v1.VolumeSource{ @@ -799,7 +794,7 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName VolumeMounts: configReloadVolumeMounts, Resources: v1.ResourceRequirements{ Limits: v1.ResourceList{ - v1.ResourceCPU: resource.MustParse("10m"), + v1.ResourceCPU: resource.MustParse("50m"), v1.ResourceMemory: resource.MustParse("50Mi"), }, }, diff --git a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset_test.go b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset_test.go index f9ce114cb..19cccf39d 100644 --- a/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset_test.go +++ b/vendor/github.com/coreos/prometheus-operator/pkg/prometheus/statefulset_test.go @@ -19,7 +19,7 @@ import ( "reflect" "testing" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/stretchr/testify/require" appsv1 "k8s.io/api/apps/v1beta2" "k8s.io/api/core/v1" @@ -529,8 +529,8 @@ func TestRetention(t *testing.T) { }{ {"v1.8.2", "", "-storage.local.retention=24h"}, {"v1.8.2", "1d", "-storage.local.retention=1d"}, - {"v2.4.3", "", "--storage.tsdb.retention=24h"}, - {"v2.4.3", "1d", "--storage.tsdb.retention=1d"}, + {"v2.5.0", "", "--storage.tsdb.retention=24h"}, + {"v2.5.0", "1d", "--storage.tsdb.retention=1d"}, } for _, test := range tests { diff --git a/vendor/github.com/coreos/prometheus-operator/test/e2e/alertmanager_test.go b/vendor/github.com/coreos/prometheus-operator/test/e2e/alertmanager_test.go index 2472b8395..0548dac46 100644 --- a/vendor/github.com/coreos/prometheus-operator/test/e2e/alertmanager_test.go +++ b/vendor/github.com/coreos/prometheus-operator/test/e2e/alertmanager_test.go @@ -31,8 +31,9 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "github.com/coreos/prometheus-operator/pkg/alertmanager" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" testFramework "github.com/coreos/prometheus-operator/test/framework" + "github.com/golang/protobuf/proto" ) func testAMCreateDeleteCluster(t *testing.T) { @@ -45,7 +46,7 @@ func testAMCreateDeleteCluster(t *testing.T) { name := "test" - if err := framework.CreateAlertmanagerAndWaitUntilReady(ns, framework.MakeBasicAlertmanager(name, 3)); err != nil { + if _, err := framework.CreateAlertmanagerAndWaitUntilReady(ns, framework.MakeBasicAlertmanager(name, 3)); err != nil { t.Fatal(err) } @@ -64,15 +65,19 @@ func testAMScaling(t *testing.T) { name := "test" - if err := framework.CreateAlertmanagerAndWaitUntilReady(ns, framework.MakeBasicAlertmanager(name, 3)); err != nil { + a, err := framework.CreateAlertmanagerAndWaitUntilReady(ns, framework.MakeBasicAlertmanager(name, 3)) + if err != nil { t.Fatal(err) } - if err := framework.UpdateAlertmanagerAndWaitUntilReady(ns, framework.MakeBasicAlertmanager(name, 5)); err != nil { + a.Spec.Replicas = proto.Int32(5) + a, err = framework.UpdateAlertmanagerAndWaitUntilReady(ns, a) + if err != nil { t.Fatal(err) } - if err := framework.UpdateAlertmanagerAndWaitUntilReady(ns, framework.MakeBasicAlertmanager(name, 3)); err != nil { + a.Spec.Replicas = proto.Int32(3) + if _, err := framework.UpdateAlertmanagerAndWaitUntilReady(ns, a); err != nil { t.Fatal(err) } } @@ -89,17 +94,20 @@ func testAMVersionMigration(t *testing.T) { am := framework.MakeBasicAlertmanager(name, 1) am.Spec.Version = "v0.14.0" - if err := framework.CreateAlertmanagerAndWaitUntilReady(ns, am); err != nil { + am, err := framework.CreateAlertmanagerAndWaitUntilReady(ns, am) + if err != nil { t.Fatal(err) } - am.Spec.Version = "v0.15.2" - if err := framework.UpdateAlertmanagerAndWaitUntilReady(ns, am); err != nil { + am.Spec.Version = "v0.15.3" + am, err = framework.UpdateAlertmanagerAndWaitUntilReady(ns, am) + if err != nil { t.Fatal(err) } am.Spec.Version = "v0.14.0" - if err := framework.UpdateAlertmanagerAndWaitUntilReady(ns, am); err != nil { + am, err = framework.UpdateAlertmanagerAndWaitUntilReady(ns, am) + if err != nil { t.Fatal(err) } } @@ -115,12 +123,16 @@ func testAMStorageUpdate(t *testing.T) { am := framework.MakeBasicAlertmanager(name, 1) - if err := framework.CreateAlertmanagerAndWaitUntilReady(ns, am); err != nil { + am, err := framework.CreateAlertmanagerAndWaitUntilReady(ns, am) + if err != nil { t.Fatal(err) } am.Spec.Storage = &monitoringv1.StorageSpec{ VolumeClaimTemplate: v1.PersistentVolumeClaim{ + ObjectMeta: metav1.ObjectMeta{ + CreationTimestamp: metav1.Now(), + }, Spec: v1.PersistentVolumeClaimSpec{ AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}, Resources: v1.ResourceRequirements{ @@ -131,7 +143,8 @@ func testAMStorageUpdate(t *testing.T) { }, }, } - _, err := framework.MonClientV1.Alertmanagers(ns).Update(am) + + am, err = framework.MonClientV1.Alertmanagers(ns).Update(am) if err != nil { t.Fatal(err) } @@ -171,7 +184,7 @@ func testAMExposingWithKubernetesAPI(t *testing.T) { alertmanager := framework.MakeBasicAlertmanager("test-alertmanager", 1) alertmanagerService := framework.MakeAlertmanagerService(alertmanager.Name, "alertmanager-service", v1.ServiceTypeClusterIP) - if err := framework.CreateAlertmanagerAndWaitUntilReady(ns, alertmanager); err != nil { + if _, err := framework.CreateAlertmanagerAndWaitUntilReady(ns, alertmanager); err != nil { t.Fatal(err) } @@ -192,7 +205,7 @@ func testAMMeshInitialization(t *testing.T) { // Starting with Alertmanager v0.15.0 hashicorp/memberlist is used for HA. // Make sure both memberlist as well as mesh (< 0.15.0) work - amVersions := []string{"v0.14.0", "v0.15.2"} + amVersions := []string{"v0.14.0", "v0.15.3"} for _, v := range amVersions { version := v @@ -210,7 +223,7 @@ func testAMMeshInitialization(t *testing.T) { alertmanager.Spec.Version = version alertmanagerService := framework.MakeAlertmanagerService(alertmanager.Name, "alertmanager-service", v1.ServiceTypeClusterIP) - if err := framework.CreateAlertmanagerAndWaitUntilReady(ns, alertmanager); err != nil { + if _, err := framework.CreateAlertmanagerAndWaitUntilReady(ns, alertmanager); err != nil { t.Fatal(err) } @@ -239,7 +252,7 @@ func testAMClusterGossipSilences(t *testing.T) { amClusterSize := 3 alertmanager := framework.MakeBasicAlertmanager("test", int32(amClusterSize)) - if err := framework.CreateAlertmanagerAndWaitUntilReady(ns, alertmanager); err != nil { + if _, err := framework.CreateAlertmanagerAndWaitUntilReady(ns, alertmanager); err != nil { t.Fatal(err) } @@ -325,7 +338,7 @@ receivers: }, } - if err := framework.CreateAlertmanagerAndWaitUntilReady(ns, alertmanager); err != nil { + if _, err := framework.CreateAlertmanagerAndWaitUntilReady(ns, alertmanager); err != nil { t.Fatal(err) } @@ -463,7 +476,8 @@ inhibit_rules: if _, err := framework.KubeClient.CoreV1().Secrets(ns).Create(amcfg); err != nil { t.Fatal(err) } - if _, err := framework.MonClientV1.Alertmanagers(ns).Create(alertmanager); err != nil { + alertmanager, err = framework.MonClientV1.Alertmanagers(ns).Create(alertmanager) + if err != nil { t.Fatal(err) } if _, err := testFramework.CreateServiceAndWaitUntilReady(framework.KubeClient, ns, amsvc); err != nil { @@ -500,8 +514,8 @@ inhibit_rules: ) if err != nil { failures++ - // Allow 30 (~3 Seconds) failures during Alertmanager rolling update. - if failures > 30 { + // Allow 50 (~5 Seconds) failures during Alertmanager rolling update. + if failures > 50 { errc <- err return } @@ -543,7 +557,8 @@ inhibit_rules: } alertmanager.Spec.Version = "v0.14.0" - if _, err := framework.MonClientV1.Alertmanagers(ns).Update(alertmanager); err != nil { + alertmanager, err = framework.MonClientV1.Alertmanagers(ns).Update(alertmanager) + if err != nil { t.Fatal(err) } diff --git a/vendor/github.com/coreos/prometheus-operator/test/e2e/prometheus_test.go b/vendor/github.com/coreos/prometheus-operator/test/e2e/prometheus_test.go index a7e93a874..c6caf27a7 100644 --- a/vendor/github.com/coreos/prometheus-operator/test/e2e/prometheus_test.go +++ b/vendor/github.com/coreos/prometheus-operator/test/e2e/prometheus_test.go @@ -35,10 +35,11 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "github.com/coreos/prometheus-operator/pkg/alertmanager" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/coreos/prometheus-operator/pkg/prometheus" testFramework "github.com/coreos/prometheus-operator/test/framework" + "github.com/golang/protobuf/proto" "github.com/kylelemons/godebug/pretty" "github.com/pkg/errors" ) @@ -56,7 +57,7 @@ func testPromCreateDeleteCluster(t *testing.T) { prometheusCRD := framework.MakeBasicPrometheus(ns, name, name, 1) prometheusCRD.Namespace = ns - if err := framework.CreatePrometheusAndWaitUntilReady(ns, prometheusCRD); err != nil { + if _, err := framework.CreatePrometheusAndWaitUntilReady(ns, prometheusCRD); err != nil { t.Fatal(err) } @@ -75,15 +76,20 @@ func testPromScaleUpDownCluster(t *testing.T) { name := "test" - if err := framework.CreatePrometheusAndWaitUntilReady(ns, framework.MakeBasicPrometheus(ns, name, name, 1)); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(ns, framework.MakeBasicPrometheus(ns, name, name, 1)) + if err != nil { t.Fatal(err) } - if err := framework.UpdatePrometheusAndWaitUntilReady(ns, framework.MakeBasicPrometheus(ns, name, name, 3)); err != nil { + p.Spec.Replicas = proto.Int32(3) + p, err = framework.UpdatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } - if err := framework.UpdatePrometheusAndWaitUntilReady(ns, framework.MakeBasicPrometheus(ns, name, name, 2)); err != nil { + p.Spec.Replicas = proto.Int32(2) + p, err = framework.UpdatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } } @@ -99,7 +105,7 @@ func testPromNoServiceMonitorSelector(t *testing.T) { name := "test" p := framework.MakeBasicPrometheus(ns, name, name, 1) p.Spec.ServiceMonitorSelector = nil - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + if _, err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { t.Fatal(err) } } @@ -118,13 +124,15 @@ func testPromVersionMigration(t *testing.T) { p := framework.MakeBasicPrometheus(ns, name, name, 1) p.Spec.Version = startVersion - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } for _, v := range compatibilityMatrix { p.Spec.Version = v - if err := framework.UpdatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err = framework.UpdatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } if err := framework.WaitForPrometheusRunImageAndReady(ns, p); err != nil { @@ -150,7 +158,8 @@ func testPromResourceUpdate(t *testing.T) { v1.ResourceMemory: resource.MustParse("100Mi"), }, } - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } @@ -169,7 +178,7 @@ func testPromResourceUpdate(t *testing.T) { v1.ResourceMemory: resource.MustParse("200Mi"), }, } - _, err = framework.MonClientV1.Prometheuses(ns).Update(p) + p, err = framework.MonClientV1.Prometheuses(ns).Update(p) if err != nil { t.Fatal(err) } @@ -209,12 +218,16 @@ func testPromStorageUpdate(t *testing.T) { p := framework.MakeBasicPrometheus(ns, name, name, 1) - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } p.Spec.Storage = &monitoringv1.StorageSpec{ VolumeClaimTemplate: v1.PersistentVolumeClaim{ + ObjectMeta: metav1.ObjectMeta{ + CreationTimestamp: metav1.Now(), + }, Spec: v1.PersistentVolumeClaimSpec{ AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}, Resources: v1.ResourceRequirements{ @@ -225,7 +238,7 @@ func testPromStorageUpdate(t *testing.T) { }, }, } - _, err := framework.MonClientV1.Prometheuses(ns).Update(p) + p, err = framework.MonClientV1.Prometheuses(ns).Update(p) if err != nil { t.Fatal(err) } @@ -293,7 +306,7 @@ scrape_configs: t.Fatal(err) } - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + if _, err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { t.Fatal(err) } @@ -376,7 +389,7 @@ func testPromAdditionalScrapeConfig(t *testing.T) { }, Key: "prometheus-additional.yaml", } - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + if _, err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { t.Fatal(err) } @@ -435,7 +448,7 @@ func testPromAdditionalAlertManagerConfig(t *testing.T) { }, Key: "prometheus-additional.yaml", } - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + if _, err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { t.Fatal(err) } @@ -492,7 +505,8 @@ func testPromReloadRules(t *testing.T) { p := framework.MakeBasicPrometheus(ns, name, name, 1) p.Spec.EvaluationInterval = "1s" - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err = framework.CreatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } @@ -519,7 +533,7 @@ func testPromReloadRules(t *testing.T) { }, }, } - err = framework.UpdateRule(ns, ruleFile) + ruleFile, err = framework.UpdateRule(ns, ruleFile) if err != nil { t.Fatal(err) } @@ -550,7 +564,8 @@ func testPromMultiplePrometheusRulesSameNS(t *testing.T) { p := framework.MakeBasicPrometheus(ns, name, name, 1) p.Spec.EvaluationInterval = "1s" - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } @@ -606,7 +621,8 @@ func testPromMultiplePrometheusRulesDifferentNS(t *testing.T) { p.Spec.RuleNamespaceSelector = &metav1.LabelSelector{ MatchLabels: ruleFilesNamespaceSelector, } - if err := framework.CreatePrometheusAndWaitUntilReady(rootNS, p); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(rootNS, p) + if err != nil { t.Fatal(err) } @@ -633,10 +649,10 @@ func testPromRulesExceedingConfigMapLimit(t *testing.T) { ns := ctx.CreateNamespace(t, framework.KubeClient) ctx.SetupPrometheusRBAC(t, ns, framework.KubeClient) - prometheusRules := []monitoringv1.PrometheusRule{} + prometheusRules := []*monitoringv1.PrometheusRule{} for i := 0; i < 2; i++ { rule := generateHugePrometheusRule(ns, strconv.Itoa(i)) - err := framework.CreateRule(ns, rule) + rule, err := framework.CreateRule(ns, rule) if err != nil { t.Fatal(err) } @@ -647,7 +663,8 @@ func testPromRulesExceedingConfigMapLimit(t *testing.T) { p := framework.MakeBasicPrometheus(ns, name, name, 1) p.Spec.EvaluationInterval = "1s" - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } @@ -681,7 +698,7 @@ func testPromRulesExceedingConfigMapLimit(t *testing.T) { } } - err := framework.DeleteRule(ns, prometheusRules[1].Name) + err = framework.DeleteRule(ns, prometheusRules[1].Name) if err != nil { t.Fatal(err) } @@ -703,7 +720,7 @@ func testPromRulesExceedingConfigMapLimit(t *testing.T) { // generateHugePrometheusRule returns a Prometheus rule instance that would fill // more than half of the space of a Kubernetes ConfigMap. -func generateHugePrometheusRule(ns, identifier string) monitoringv1.PrometheusRule { +func generateHugePrometheusRule(ns, identifier string) *monitoringv1.PrometheusRule { alertName := "my-alert" groups := []monitoringv1.RuleGroup{ { @@ -859,7 +876,8 @@ func testPromOnlyUpdatedOnRelevantChanges(t *testing.T) { t.Fatal(err) } - if err := framework.CreatePrometheusAndWaitUntilReady(ns, prometheus); err != nil { + prometheus, err := framework.CreatePrometheusAndWaitUntilReady(ns, prometheus) + if err != nil { t.Fatal(err) } @@ -875,7 +893,7 @@ func testPromOnlyUpdatedOnRelevantChanges(t *testing.T) { t.Fatal("Creating ServiceMonitor failed: ", err) } - err := framework.WaitForPrometheusFiringAlert(prometheus.Namespace, pSVC.Name, alertName) + err = framework.WaitForPrometheusFiringAlert(prometheus.Namespace, pSVC.Name, alertName) if err != nil { t.Fatal(err) } @@ -924,13 +942,14 @@ func testPromWhenDeleteCRDCleanUpViaOwnerRef(t *testing.T) { name := "test" p := framework.MakeBasicPrometheus(ns, name, name, 1) - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } configMapName := fmt.Sprintf("prometheus-%v-rulefiles-0", p.Name) - _, err := framework.WaitForConfigMapExist(ns, configMapName) + _, err = framework.WaitForConfigMapExist(ns, configMapName) if err != nil { t.Fatal(err) } @@ -965,7 +984,8 @@ func testPromDiscovery(t *testing.T) { } p := framework.MakeBasicPrometheus(ns, prometheusName, group, 1) - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } @@ -975,7 +995,7 @@ func testPromDiscovery(t *testing.T) { ctx.AddFinalizerFn(finalizerFn) } - _, err := framework.KubeClient.CoreV1().Secrets(ns).Get(fmt.Sprintf("prometheus-%s", prometheusName), metav1.GetOptions{}) + _, err = framework.KubeClient.CoreV1().Secrets(ns).Get(fmt.Sprintf("prometheus-%s", prometheusName), metav1.GetOptions{}) if err != nil { t.Fatal("Generated Secret could not be retrieved: ", err) } @@ -1002,7 +1022,8 @@ func testPromAlertmanagerDiscovery(t *testing.T) { p := framework.MakeBasicPrometheus(ns, prometheusName, group, 1) framework.AddAlertingToPrometheus(p, ns, alertmanagerName) - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + p, err := framework.CreatePrometheusAndWaitUntilReady(ns, p) + if err != nil { t.Fatal(err) } @@ -1017,12 +1038,12 @@ func testPromAlertmanagerDiscovery(t *testing.T) { t.Fatalf("Creating ServiceMonitor failed: %v", err) } - _, err := framework.KubeClient.CoreV1().Secrets(ns).Get(fmt.Sprintf("prometheus-%s", prometheusName), metav1.GetOptions{}) + _, err = framework.KubeClient.CoreV1().Secrets(ns).Get(fmt.Sprintf("prometheus-%s", prometheusName), metav1.GetOptions{}) if err != nil { t.Fatalf("Generated Secret could not be retrieved: %v", err) } - if err := framework.CreateAlertmanagerAndWaitUntilReady(ns, framework.MakeBasicAlertmanager(alertmanagerName, 3)); err != nil { + if _, err := framework.CreateAlertmanagerAndWaitUntilReady(ns, framework.MakeBasicAlertmanager(alertmanagerName, 3)); err != nil { t.Fatal(err) } @@ -1047,7 +1068,7 @@ func testPromExposingWithKubernetesAPI(t *testing.T) { basicPrometheus := framework.MakeBasicPrometheus(ns, "basic-prometheus", "test-group", 1) service := framework.MakePrometheusService(basicPrometheus.Name, "test-group", v1.ServiceTypeClusterIP) - if err := framework.CreatePrometheusAndWaitUntilReady(ns, basicPrometheus); err != nil { + if _, err := framework.CreatePrometheusAndWaitUntilReady(ns, basicPrometheus); err != nil { t.Fatal("Creating prometheus failed: ", err) } @@ -1101,7 +1122,7 @@ func testPromDiscoverTargetPort(t *testing.T) { } p := framework.MakeBasicPrometheus(ns, prometheusName, group, 1) - if err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { + if _, err := framework.CreatePrometheusAndWaitUntilReady(ns, p); err != nil { t.Fatal(err) } @@ -1158,7 +1179,7 @@ func testPromOpMatchPromAndServMonInDiffNSs(t *testing.T) { "team": "frontend", }, } - if err := framework.CreatePrometheusAndWaitUntilReady(prometheusNSName, p); err != nil { + if _, err := framework.CreatePrometheusAndWaitUntilReady(prometheusNSName, p); err != nil { t.Fatal(err) } @@ -1196,6 +1217,7 @@ func testThanos(t *testing.T) { Version: &version, } basicPrometheus.Spec.PodMetadata = &metav1.ObjectMeta{ + CreationTimestamp: metav1.Now(), Labels: map[string]string{ "thanos-peer": "true", }, @@ -1296,7 +1318,7 @@ func testPromGetBasicAuthSecret(t *testing.T) { MatchLabels: maptest, } - if err := framework.CreatePrometheusAndWaitUntilReady(ns, prometheusCRD); err != nil { + if _, err := framework.CreatePrometheusAndWaitUntilReady(ns, prometheusCRD); err != nil { t.Fatal(err) } testNamespace := ctx.CreateNamespace(t, framework.KubeClient) @@ -1435,7 +1457,8 @@ func testOperatorNSScope(t *testing.T) { MatchLabels: prometheusNamespaceSelector, } p.Spec.EvaluationInterval = "1s" - if err := framework.CreatePrometheusAndWaitUntilReady(mainNS, p); err != nil { + p, err = framework.CreatePrometheusAndWaitUntilReady(mainNS, p) + if err != nil { t.Fatal(err) } @@ -1504,7 +1527,8 @@ func testOperatorNSScope(t *testing.T) { MatchLabels: prometheusNamespaceSelector, } p.Spec.EvaluationInterval = "1s" - if err := framework.CreatePrometheusAndWaitUntilReady(prometheusNS, p); err != nil { + p, err = framework.CreatePrometheusAndWaitUntilReady(prometheusNS, p) + if err != nil { t.Fatal(err) } diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/alertmanager.go b/vendor/github.com/coreos/prometheus-operator/test/framework/alertmanager.go index dd796cfe7..8ae2c6848 100644 --- a/vendor/github.com/coreos/prometheus-operator/test/framework/alertmanager.go +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/alertmanager.go @@ -28,8 +28,7 @@ import ( "k8s.io/apimachinery/pkg/util/yaml" "github.com/coreos/prometheus-operator/pkg/alertmanager" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/pkg/errors" ) @@ -59,17 +58,6 @@ func (f *Framework) MakeBasicAlertmanager(name string, replicas int32) *monitori } } -func (f *Framework) MakeBasicAlertmanagerV1alpha1(name string, replicas int32) *v1alpha1.Alertmanager { - return &v1alpha1.Alertmanager{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - }, - Spec: v1alpha1.AlertmanagerSpec{ - Replicas: &replicas, - }, - } -} - func (f *Framework) MakeAlertmanagerService(name, group string, serviceType v1.ServiceType) *v1.Service { service := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ @@ -122,23 +110,23 @@ func (f *Framework) AlertmanagerConfigSecret(ns, name string) (*v1.Secret, error return s, nil } -func (f *Framework) CreateAlertmanagerAndWaitUntilReady(ns string, a *monitoringv1.Alertmanager) error { +func (f *Framework) CreateAlertmanagerAndWaitUntilReady(ns string, a *monitoringv1.Alertmanager) (*monitoringv1.Alertmanager, error) { amConfigSecretName := fmt.Sprintf("alertmanager-%s", a.Name) s, err := f.AlertmanagerConfigSecret(ns, amConfigSecretName) if err != nil { - return errors.Wrap(err, fmt.Sprintf("making alertmanager config secret %v failed", amConfigSecretName)) + return nil, errors.Wrap(err, fmt.Sprintf("making alertmanager config secret %v failed", amConfigSecretName)) } _, err = f.KubeClient.CoreV1().Secrets(ns).Create(s) if err != nil { - return errors.Wrap(err, fmt.Sprintf("creating alertmanager config secret %v failed", s.Name)) + return nil, errors.Wrap(err, fmt.Sprintf("creating alertmanager config secret %v failed", s.Name)) } - _, err = f.MonClientV1.Alertmanagers(ns).Create(a) + a, err = f.MonClientV1.Alertmanagers(ns).Create(a) if err != nil { - return errors.Wrap(err, fmt.Sprintf("creating alertmanager %v failed", a.Name)) + return nil, errors.Wrap(err, fmt.Sprintf("creating alertmanager %v failed", a.Name)) } - return f.WaitForAlertmanagerReady(ns, a.Name, int(*a.Spec.Replicas)) + return a, f.WaitForAlertmanagerReady(ns, a.Name, int(*a.Spec.Replicas)) } func (f *Framework) WaitForAlertmanagerReady(ns, name string, replicas int) error { @@ -153,10 +141,10 @@ func (f *Framework) WaitForAlertmanagerReady(ns, name string, replicas int) erro return errors.Wrap(err, fmt.Sprintf("failed to create an Alertmanager cluster (%s) with %d instances", name, replicas)) } -func (f *Framework) UpdateAlertmanagerAndWaitUntilReady(ns string, a *monitoringv1.Alertmanager) error { - _, err := f.MonClientV1.Alertmanagers(ns).Update(a) +func (f *Framework) UpdateAlertmanagerAndWaitUntilReady(ns string, a *monitoringv1.Alertmanager) (*monitoringv1.Alertmanager, error) { + a, err := f.MonClientV1.Alertmanagers(ns).Update(a) if err != nil { - return err + return nil, err } err = WaitForPodsReady( @@ -167,10 +155,10 @@ func (f *Framework) UpdateAlertmanagerAndWaitUntilReady(ns string, a *monitoring alertmanager.ListOptions(a.Name), ) if err != nil { - return fmt.Errorf("failed to update %d Alertmanager instances (%s): %v", a.Spec.Replicas, a.Name, err) + return nil, fmt.Errorf("failed to update %d Alertmanager instances (%s): %v", a.Spec.Replicas, a.Name, err) } - return nil + return a, nil } func (f *Framework) DeleteAlertmanagerAndWaitUntilGone(ns, name string) error { diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/framework.go b/vendor/github.com/coreos/prometheus-operator/test/framework/framework.go index 6d283371f..552bdb70e 100644 --- a/vendor/github.com/coreos/prometheus-operator/test/framework/framework.go +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/framework.go @@ -25,23 +25,23 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" - monitoringv1alpha1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1" + monitoringclient "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1" "github.com/coreos/prometheus-operator/pkg/k8sutil" + "github.com/pkg/errors" ) type Framework struct { - KubeClient kubernetes.Interface - MonClientV1 monitoringv1.MonitoringV1Interface - MonClientV1alpha1 monitoringv1alpha1.MonitoringV1alpha1Interface - HTTPClient *http.Client - MasterHost string - DefaultTimeout time.Duration + KubeClient kubernetes.Interface + MonClientV1 monitoringclient.MonitoringV1Interface + HTTPClient *http.Client + MasterHost string + DefaultTimeout time.Duration } // New setups a test framework and returns it. @@ -61,23 +61,17 @@ func New(kubeconfig, opImage string) (*Framework, error) { return nil, errors.Wrap(err, "creating http-client failed") } - mClientV1, err := monitoringv1.NewForConfig(&monitoringv1.DefaultCrdKinds, monitoringv1.Group, config) + mClientV1, err := monitoringclient.NewForConfig(config) if err != nil { return nil, errors.Wrap(err, "creating v1 monitoring client failed") } - mClientV1alpha1, err := monitoringv1alpha1.NewForConfig(config) - if err != nil { - return nil, errors.Wrap(err, "creating v1alpha1 monitoring client failed") - } - f := &Framework{ - MasterHost: config.Host, - KubeClient: cli, - MonClientV1: mClientV1, - MonClientV1alpha1: mClientV1alpha1, - HTTPClient: httpc, - DefaultTimeout: time.Minute, + MasterHost: config.Host, + KubeClient: cli, + MonClientV1: mClientV1, + HTTPClient: httpc, + DefaultTimeout: time.Minute, } return f, nil @@ -150,22 +144,30 @@ func (f *Framework) CreatePrometheusOperator(ns, opImage string, namespacesToWat return errors.Wrap(err, "failed to wait for prometheus operator to become ready") } - err = k8sutil.WaitForCRDReady(f.MonClientV1.Prometheuses(v1.NamespaceAll).List) + err = k8sutil.WaitForCRDReady(func(opts metav1.ListOptions) (runtime.Object, error) { + return f.MonClientV1.Prometheuses(v1.NamespaceAll).List(opts) + }) if err != nil { return errors.Wrap(err, "Prometheus CRD not ready: %v\n") } - err = k8sutil.WaitForCRDReady(f.MonClientV1.ServiceMonitors(v1.NamespaceAll).List) + err = k8sutil.WaitForCRDReady(func(opts metav1.ListOptions) (runtime.Object, error) { + return f.MonClientV1.ServiceMonitors(v1.NamespaceAll).List(opts) + }) if err != nil { return errors.Wrap(err, "ServiceMonitor CRD not ready: %v\n") } - err = k8sutil.WaitForCRDReady(f.MonClientV1.PrometheusRules(v1.NamespaceAll).List) + err = k8sutil.WaitForCRDReady(func(opts metav1.ListOptions) (runtime.Object, error) { + return f.MonClientV1.PrometheusRules(v1.NamespaceAll).List(opts) + }) if err != nil { return errors.Wrap(err, "PrometheusRule CRD not ready: %v\n") } - err = k8sutil.WaitForCRDReady(f.MonClientV1.Alertmanagers(v1.NamespaceAll).List) + err = k8sutil.WaitForCRDReady(func(opts metav1.ListOptions) (runtime.Object, error) { + return f.MonClientV1.Alertmanagers(v1.NamespaceAll).List(opts) + }) if err != nil { return errors.Wrap(err, "Alertmanager CRD not ready: %v\n") } diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus.go b/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus.go index 636cb0a4b..b75f50cbe 100644 --- a/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus.go +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus.go @@ -26,8 +26,7 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/wait" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" - "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1alpha1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/coreos/prometheus-operator/pkg/prometheus" "github.com/pkg/errors" ) @@ -98,30 +97,6 @@ func (f *Framework) MakeBasicServiceMonitor(name string) *monitoringv1.ServiceMo } } -func (f *Framework) MakeBasicServiceMonitorV1alpha1(name string) *v1alpha1.ServiceMonitor { - return &v1alpha1.ServiceMonitor{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: map[string]string{ - "group": name, - }, - }, - Spec: v1alpha1.ServiceMonitorSpec{ - Selector: metav1.LabelSelector{ - MatchLabels: map[string]string{ - "group": name, - }, - }, - Endpoints: []v1alpha1.Endpoint{ - { - Port: "web", - Interval: "30s", - }, - }, - }, - } -} - func (f *Framework) MakePrometheusService(name, group string, serviceType v1.ServiceType) *v1.Service { service := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ @@ -189,29 +164,29 @@ func (f *Framework) MakeThanosService(name string) *v1.Service { return service } -func (f *Framework) CreatePrometheusAndWaitUntilReady(ns string, p *monitoringv1.Prometheus) error { - _, err := f.MonClientV1.Prometheuses(ns).Create(p) +func (f *Framework) CreatePrometheusAndWaitUntilReady(ns string, p *monitoringv1.Prometheus) (*monitoringv1.Prometheus, error) { + result, err := f.MonClientV1.Prometheuses(ns).Create(p) if err != nil { - return fmt.Errorf("creating %v Prometheus instances failed (%v): %v", p.Spec.Replicas, p.Name, err) + return nil, fmt.Errorf("creating %v Prometheus instances failed (%v): %v", p.Spec.Replicas, p.Name, err) } - if err := f.WaitForPrometheusReady(p, 5*time.Minute); err != nil { - return fmt.Errorf("waiting for %v Prometheus instances timed out (%v): %v", p.Spec.Replicas, p.Name, err) + if err := f.WaitForPrometheusReady(result, 5*time.Minute); err != nil { + return nil, fmt.Errorf("waiting for %v Prometheus instances timed out (%v): %v", p.Spec.Replicas, p.Name, err) } - return nil + return result, nil } -func (f *Framework) UpdatePrometheusAndWaitUntilReady(ns string, p *monitoringv1.Prometheus) error { - _, err := f.MonClientV1.Prometheuses(ns).Update(p) +func (f *Framework) UpdatePrometheusAndWaitUntilReady(ns string, p *monitoringv1.Prometheus) (*monitoringv1.Prometheus, error) { + result, err := f.MonClientV1.Prometheuses(ns).Update(p) if err != nil { - return err + return nil, err } - if err := f.WaitForPrometheusReady(p, 5*time.Minute); err != nil { - return fmt.Errorf("failed to update %d Prometheus instances (%v): %v", p.Spec.Replicas, p.Name, err) + if err := f.WaitForPrometheusReady(result, 5*time.Minute); err != nil { + return nil, fmt.Errorf("failed to update %d Prometheus instances (%v): %v", p.Spec.Replicas, p.Name, err) } - return nil + return result, nil } func (f *Framework) WaitForPrometheusReady(p *monitoringv1.Prometheus, timeout time.Duration) error { diff --git a/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus_rule.go b/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus_rule.go index 053bc4c32..a4d604db2 100644 --- a/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus_rule.go +++ b/vendor/github.com/coreos/prometheus-operator/test/framework/prometheus_rule.go @@ -18,15 +18,15 @@ import ( "fmt" "time" - monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/wait" ) -func (f *Framework) MakeBasicRule(ns, name string, groups []monitoringv1.RuleGroup) monitoringv1.PrometheusRule { - return monitoringv1.PrometheusRule{ +func (f *Framework) MakeBasicRule(ns, name string, groups []monitoringv1.RuleGroup) *monitoringv1.PrometheusRule { + return &monitoringv1.PrometheusRule{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: ns, @@ -40,16 +40,16 @@ func (f *Framework) MakeBasicRule(ns, name string, groups []monitoringv1.RuleGro } } -func (f *Framework) CreateRule(ns string, ar monitoringv1.PrometheusRule) error { - _, err := f.MonClientV1.PrometheusRules(ns).Create(&ar) +func (f *Framework) CreateRule(ns string, ar *monitoringv1.PrometheusRule) (*monitoringv1.PrometheusRule, error) { + result, err := f.MonClientV1.PrometheusRules(ns).Create(ar) if err != nil { - return fmt.Errorf("creating %v RuleFile failed: %v", ar.Name, err) + return nil, fmt.Errorf("creating %v RuleFile failed: %v", ar.Name, err) } - return nil + return result, nil } -func (f *Framework) MakeAndCreateFiringRule(ns, name, alertName string) (monitoringv1.PrometheusRule, error) { +func (f *Framework) MakeAndCreateFiringRule(ns, name, alertName string) (*monitoringv1.PrometheusRule, error) { groups := []monitoringv1.RuleGroup{ { Name: alertName, @@ -63,12 +63,12 @@ func (f *Framework) MakeAndCreateFiringRule(ns, name, alertName string) (monitor } file := f.MakeBasicRule(ns, name, groups) - err := f.CreateRule(ns, file) + result, err := f.CreateRule(ns, file) if err != nil { - return file, err + return nil, err } - return file, nil + return result, nil } // WaitForRule waits for a rule file with a given name to exist in a given @@ -85,13 +85,13 @@ func (f *Framework) WaitForRule(ns, name string) error { }) } -func (f *Framework) UpdateRule(ns string, ar monitoringv1.PrometheusRule) error { - _, err := f.MonClientV1.PrometheusRules(ns).Update(&ar) +func (f *Framework) UpdateRule(ns string, ar *monitoringv1.PrometheusRule) (*monitoringv1.PrometheusRule, error) { + result, err := f.MonClientV1.PrometheusRules(ns).Update(ar) if err != nil { - return fmt.Errorf("updating %v RuleFile failed: %v", ar.Name, err) + return nil, fmt.Errorf("updating %v RuleFile failed: %v", ar.Name, err) } - return nil + return result, nil } func (f *Framework) DeleteRule(ns string, r string) error { diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE b/vendor/github.com/go-logr/logr/LICENSE similarity index 100% rename from vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE rename to vendor/github.com/go-logr/logr/LICENSE diff --git a/vendor/github.com/go-logr/logr/README.md b/vendor/github.com/go-logr/logr/README.md new file mode 100644 index 000000000..26296d024 --- /dev/null +++ b/vendor/github.com/go-logr/logr/README.md @@ -0,0 +1,36 @@ +# A more minimal logging API for Go + +Before you consider this package, please read [this blog post by the inimitable +Dave Cheney](http://dave.cheney.net/2015/11/05/lets-talk-about-logging). I +really appreciate what he has to say, and it largely aligns with my own +experiences. Too many choices of levels means inconsistent logs. + +This package offers a purely abstract interface, based on these ideas but with +a few twists. Code can depend on just this interface and have the actual +logging implementation be injected from callers. Ideally only `main()` knows +what logging implementation is being used. + +# Differences from Dave's ideas + +The main differences are: + +1) Dave basically proposes doing away with the notion of a logging API in favor +of `fmt.Printf()`. I disagree, especially when you consider things like output +locations, timestamps, file and line decorations, and structured logging. I +restrict the API to just 2 types of logs: info and error. + +Info logs are things you want to tell the user which are not errors. Error +logs are, well, errors. If your code receives an `error` from a subordinate +function call and is logging that `error` *and not returning it*, use error +logs. + +2) Verbosity-levels on info logs. This gives developers a chance to indicate +arbitrary grades of importance for info logs, without assigning names with +semantic meaning such as "warning", "trace", and "debug". Superficially this +may feel very similar, but the primary difference is the lack of semantics. +Because verbosity is a numerical value, it's safe to assume that an app running +with higher verbosity means more (and less important) logs will be generated. + +This is a BETA grade API. I have implemented it for +[glog](https://godoc.org/github.com/golang/glog). Until there is a significant +2nd implementation, I don't really know how it will change. diff --git a/vendor/github.com/go-logr/logr/examples/tab_logger.go b/vendor/github.com/go-logr/logr/examples/tab_logger.go new file mode 100644 index 000000000..cb6223073 --- /dev/null +++ b/vendor/github.com/go-logr/logr/examples/tab_logger.go @@ -0,0 +1,74 @@ +package main + +import ( + "os" + "fmt" + "text/tabwriter" + + "github.com/go-logr/logr" +) + +// TabLogger is a sample logr.Logger that logs to stderr. +// It's terribly inefficient, and is *only* a basic example. +type TabLogger struct{ + name string + keyValues map[string]interface{} + + writer *tabwriter.Writer +} + +var _ logr.Logger = &TabLogger{} + +func (l *TabLogger) Info(msg string, kvs ...interface{}) { + fmt.Fprintf(l.writer, "%s\t%s\t", l.name, msg) + for k, v := range l.keyValues { + fmt.Fprintf(l.writer, "%s: %+v ", k, v) + } + for i := 0; i < len(kvs); i += 2 { + fmt.Fprintf(l.writer, "%s: %+v ", kvs[i], kvs[i+1]) + } + fmt.Fprintf(l.writer, "\n") + l.writer.Flush() +} + +func (_ *TabLogger) Enabled() bool { + return true +} + +func (l *TabLogger) Error(err error, msg string, kvs ...interface{}) { + kvs = append(kvs, "error", err) + l.Info(msg, kvs...) +} + +func (l *TabLogger) V(_ int) logr.InfoLogger { + return l +} + +func (l *TabLogger) WithName(name string) logr.Logger { + return &TabLogger{ + name: l.name+"."+name, + keyValues: l.keyValues, + writer: l.writer, + } +} + +func (l *TabLogger) WithValues(kvs ...interface{}) logr.Logger { + newMap := make(map[string]interface{}, len(l.keyValues)+len(kvs)/2) + for k, v := range l.keyValues { + newMap[k] = v + } + for i := 0; i < len(kvs); i += 2 { + newMap[kvs[i].(string)] = kvs[i+1] + } + return &TabLogger{ + name: l.name, + keyValues: newMap, + writer: l.writer, + } +} + +func NewTabLogger() logr.Logger { + return &TabLogger{ + writer: tabwriter.NewWriter(os.Stderr, 40, 8, 2, '\t', 0), + } +} diff --git a/vendor/github.com/go-logr/logr/examples/usage_example.go b/vendor/github.com/go-logr/logr/examples/usage_example.go new file mode 100644 index 000000000..ad32db9d8 --- /dev/null +++ b/vendor/github.com/go-logr/logr/examples/usage_example.go @@ -0,0 +1,149 @@ +package main + +import ( + "fmt" + "math/rand" + "time" + + "github.com/go-logr/logr" +) + +// This application demonstrates the usage of logger. +// It's a simple reconciliation loop that pretends to +// receive notifications about updates from a some API +// server, make some changes, and then submit updates of +// its own. + +// This uses object-based logging. It's also possible +// (but a bit trickier) to use file-level "base" loggers. + +var objectMap = map[string]Object{ + "obj1": Object{ + Name: "obj1", + Kind: "one", + Details: 33, + }, + "obj2": Object{ + Name: "obj2", + Kind: "two", + Details: "hi", + }, + "obj3": Object{ + Name: "obj3", + Kind: "one", + Details: 1, + }, +} + +type Object struct { + Name string + Kind string + Details interface{} +} + +type Client struct { + objects map[string]Object + log logr.Logger +} + +func (c *Client) Get(key string) (Object, error) { + c.log.V(1).Info("fetching object", "key", key) + obj, ok := c.objects[key] + if !ok { + return Object{}, fmt.Errorf("no object %s exists", key) + } + c.log.V(1).Info("pretending to deserialize object", "key", key, "json", "[insert real json here]") + return obj, nil +} + +func (c *Client) Save(obj Object) error { + c.log.V(1).Info("saving object", "key", obj.Name, "object", obj) + if rand.Intn(2) == 0 { + return fmt.Errorf("couldn't save to %s", obj.Name) + } + c.log.V(1).Info("pretending to post object", "key", obj.Name, "url", "https://fake.test") + return nil +} + +func (c *Client) WatchNext() string { + time.Sleep(2*time.Second) + + keyInd := rand.Intn(len(c.objects)) + + currInd := 0 + for key := range c.objects { + if currInd == keyInd { + return key + } + currInd++ + } + + c.log.Info("watch ended") + return "" +} + +type Controller struct { + log logr.Logger + expectedKind string + client *Client +} + +func (c *Controller) Run() { + c.log.Info("starting reconciliation") + + for key := c.client.WatchNext(); key != ""; key = c.client.WatchNext() { + // we can make more specific loggers if we always want to attach a particular named value + log := c.log.WithValues("key", key) + + // fetch our object + obj, err := c.client.Get(key) + if err != nil { + log.Error(err, "unable to reconcile object") + continue + } + + // make sure it's as expected + if obj.Kind != c.expectedKind { + log.Error(nil, "got object that wasn't expected kind", "actual-kind", obj.Kind, "object", obj) + continue + } + + // always log the object with log messages + log = log.WithValues("object", obj) + log.V(1).Info("reconciling object for key") + + // Do some complicated updates updates + obj.Details = obj.Details.(int) * 2 + + // actually save the updates + log.V(1).Info("updating object", "details", obj.Details) + if err := c.client.Save(obj); err != nil { + log.Error(err, "unable to reconcile object") + } + } + + c.log.Info("stopping reconciliation") +} + +func NewController(log logr.Logger, objectKind string) *Controller { + ctrlLogger := log.WithName("controller").WithName(objectKind) + client := &Client{ + log: ctrlLogger.WithName("client"), + objects: objectMap, + } + return &Controller{ + log: ctrlLogger, + expectedKind: objectKind, + client: client, + } +} + +func main() { + // use a fake implementation just for demonstration purposes + log := NewTabLogger() + + // update objects with the "one" kind + ctrl := NewController(log, "one") + + ctrl.Run() +} diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go new file mode 100644 index 000000000..ad72e7886 --- /dev/null +++ b/vendor/github.com/go-logr/logr/logr.go @@ -0,0 +1,151 @@ +// Package logr defines abstract interfaces for logging. Packages can depend on +// these interfaces and callers can implement logging in whatever way is +// appropriate. +// +// This design derives from Dave Cheney's blog: +// http://dave.cheney.net/2015/11/05/lets-talk-about-logging +// +// This is a BETA grade API. Until there is a significant 2nd implementation, +// I don't really know how it will change. +// +// The logging specifically makes it non-trivial to use format strings, to encourage +// attaching structured information instead of unstructured format strings. +// +// Usage +// +// Logging is done using a Logger. Loggers can have name prefixes and named values +// attached, so that all log messages logged with that Logger have some base context +// associated. +// +// The term "key" is used to refer to the name associated with a particular value, to +// disambiguate it from the general Logger name. +// +// For instance, suppose we're trying to reconcile the state of an object, and we want +// to log that we've made some decision. +// +// With the traditional log package, we might write +// log.Printf( +// "decided to set field foo to value %q for object %s/%s", +// targetValue, object.Namespace, object.Name) +// +// With logr's structured logging, we'd write +// // elsewhere in the file, set up the logger to log with the prefix of "reconcilers", +// // and the named value target-type=Foo, for extra context. +// log := mainLogger.WithName("reconcilers").WithValues("target-type", "Foo") +// +// // later on... +// log.Info("setting field foo on object", "value", targetValue, "object", object) +// +// Depending on our logging implementation, we could then make logging decisions based on field values +// (like only logging such events for objects in a certain namespace), or copy the structured +// information into a structured log store. +// +// For logging errors, Logger has a method called Error. Suppose we wanted to log an +// error while reconciling. With the traditional log package, we might write +// log.Errorf("unable to reconcile object %s/%s: %v", object.Namespace, object.Name, err) +// +// With logr, we'd instead write +// // assuming the above setup for log +// log.Error(err, "unable to reconcile object", "object", object) +// +// This functions similarly to: +// log.Info("unable to reconcile object", "error", err, "object", object) +// +// However, it ensures that a standard key for the error value ("error") is used across all +// error logging. Furthermore, certain implementations may choose to attach additional +// information (such as stack traces) on calls to Error, so it's preferred to use Error +// to log errors. +// +// Parts of a log line +// +// Each log message from a Logger has four types of context: +// logger name, log verbosity, log message, and the named values. +// +// The Logger name constists of a series of name "segments" added by successive calls to WithName. +// These name segments will be joined in some way by the underlying implementation. It is strongly +// reccomended that name segements contain simple identifiers (letters, digits, and hyphen), and do +// not contain characters that could muddle the log output or confuse the joining operation (e.g. +// whitespace, commas, periods, slashes, brackets, quotes, etc). +// +// Log verbosity represents how little a log matters. Level zero, the default, matters most. +// Increasing levels matter less and less. Try to avoid lots of different verbosity levels, +// and instead provide useful keys, logger names, and log messages for users to filter on. +// It's illegal to pass a log level below zero. +// +// The log message consists of a constant message attached to the the log line. This +// should generally be a simple description of what's occuring, and should never be a format string. +// +// Variable information can then be attached using named values (key/value pairs). Keys are arbitrary +// strings, while values may be any Go value. +// +// Key Naming Conventions +// +// While users are generally free to use key names of their choice, it's generally best to avoid +// using the following keys, as they're frequently used by implementations: +// +// - `"error"`: the underlying error value in the `Error` method. +// - `"stacktrace"`: the stack trace associated with a particular log line or error +// (often from the `Error` message). +// - `"caller"`: the calling information (file/line) of a particular log line. +// - `"msg"`: the log message. +// - `"level"`: the log level. +// - `"ts"`: the timestamp for a log line. +// +// Implementations are encouraged to make use of these keys to represent the above +// concepts, when neccessary (for example, in a pure-JSON output form, it would be +// necessary to represent at least message and timestamp as ordinary named values). +package logr + +// TODO: consider adding back in format strings if they're really needed +// TODO: consider other bits of zap/zapcore functionality like ObjectMarshaller (for arbitrary objects) +// TODO: consider other bits of glog functionality like Flush, InfoDepth, OutputStats + +// InfoLogger represents the ability to log non-error messages, at a particular verbosity. +type InfoLogger interface { + // Info logs a non-error message with the given key/value pairs as context. + // + // The msg argument should be used to add some constant description to + // the log line. The key/value pairs can then be used to add additional + // variable information. The key/value pairs should alternate string + // keys and arbitrary values. + Info(msg string, keysAndValues ...interface{}) + + // Enabled tests whether this InfoLogger is enabled. For example, + // commandline flags might be used to set the logging verbosity and disable + // some info logs. + Enabled() bool +} + +// Logger represents the ability to log messages, both errors and not. +type Logger interface { + // All Loggers implement InfoLogger. Calling InfoLogger methods directly on + // a Logger value is equivalent to calling them on a V(0) InfoLogger. For + // example, logger.Info() produces the same result as logger.V(0).Info. + InfoLogger + + // Error logs an error, with the given message and key/value pairs as context. + // It functions similarly to calling Info with the "error" named value, but may + // have unique behavior, and should be preferred for logging errors (see the + // package documentations for more information). + // + // The msg field should be used to add context to any underlying error, + // while the err field should be used to attach the actual error that + // triggered this log line, if present. + Error(err error, msg string, keysAndValues ...interface{}) + + // V returns an InfoLogger value for a specific verbosity level. A higher + // verbosity level means a log message is less important. It's illegal to + // pass a log level less than zero. + V(level int) InfoLogger + + // WithValues adds some key-value pairs of context to a logger. + // See Info for documentation on how key/value pairs work. + WithValues(keysAndValues ...interface{}) Logger + + // WithName adds a new element to the logger's name. + // Successive calls with WithName continue to append + // suffixes to the logger's name. It's strongly reccomended + // that name segments contain only letters, digits, and hyphens + // (see the package documentation for more information). + WithName(name string) Logger +} diff --git a/vendor/github.com/go-logr/logr/testing/null.go b/vendor/github.com/go-logr/logr/testing/null.go new file mode 100644 index 000000000..c69c3540b --- /dev/null +++ b/vendor/github.com/go-logr/logr/testing/null.go @@ -0,0 +1,32 @@ +package testing + +import "github.com/go-logr/logr" + +// NullLogger is a logr.Logger that does nothing. +type NullLogger struct{} + +var _ logr.Logger = NullLogger{} + +func (_ NullLogger) Info(_ string, _ ...interface{}) { + // Do nothing. +} + +func (_ NullLogger) Enabled() bool { + return false +} + +func (_ NullLogger) Error(_ error, _ string, _ ...interface{}) { + // Do nothing. +} + +func (log NullLogger) V(_ int) logr.InfoLogger { + return log +} + +func (log NullLogger) WithName(_ string) logr.Logger { + return log +} + +func (log NullLogger) WithValues(_ ...interface{}) logr.Logger { + return log +} diff --git a/vendor/github.com/go-logr/logr/testing/test.go b/vendor/github.com/go-logr/logr/testing/test.go new file mode 100644 index 000000000..af761fbdb --- /dev/null +++ b/vendor/github.com/go-logr/logr/testing/test.go @@ -0,0 +1,39 @@ +package testing + +import ( + "testing" + + "github.com/go-logr/logr" +) + +// TestLogger is a logr.Logger that prints through a testing.T object. +// Only error logs will have any effect. +type TestLogger struct { + T *testing.T +} + +var _ logr.Logger = TestLogger{} + +func (_ TestLogger) Info(_ string, _ ...interface{}) { + // Do nothing. +} + +func (_ TestLogger) Enabled() bool { + return false +} + +func (log TestLogger) Error(err error, msg string, args ...interface{}) { + log.T.Logf("%s: %v -- %v", msg, err, args) +} + +func (log TestLogger) V(v int) logr.InfoLogger { + return log +} + +func (log TestLogger) WithName(_ string) logr.Logger { + return log +} + +func (log TestLogger) WithValues(_ ...interface{}) logr.Logger { + return log +} diff --git a/vendor/github.com/go-logr/zapr/.gitignore b/vendor/github.com/go-logr/zapr/.gitignore new file mode 100644 index 000000000..5ba77727f --- /dev/null +++ b/vendor/github.com/go-logr/zapr/.gitignore @@ -0,0 +1,3 @@ +*~ +*.swp +/vendor diff --git a/vendor/github.com/go-logr/zapr/Gopkg.lock b/vendor/github.com/go-logr/zapr/Gopkg.lock new file mode 100644 index 000000000..4e0d08eca --- /dev/null +++ b/vendor/github.com/go-logr/zapr/Gopkg.lock @@ -0,0 +1,40 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "master" + name = "github.com/go-logr/logr" + packages = ["."] + revision = "9fb12b3b21c5415d16ac18dc5cd42c1cfdd40c4e" + +[[projects]] + name = "go.uber.org/atomic" + packages = ["."] + revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289" + version = "v1.3.2" + +[[projects]] + name = "go.uber.org/multierr" + packages = ["."] + revision = "3c4937480c32f4c13a875a1829af76c98ca3d40a" + version = "v1.1.0" + +[[projects]] + name = "go.uber.org/zap" + packages = [ + ".", + "buffer", + "internal/bufferpool", + "internal/color", + "internal/exit", + "zapcore" + ] + revision = "eeedf312bc6c57391d84767a4cd413f02a917974" + version = "v1.8.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "9b4b2f75bc457ddc6ebb276c32fc8e30525b6133ee76886c804ba0a6b815abc2" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/vendor/github.com/go-logr/zapr/Gopkg.toml b/vendor/github.com/go-logr/zapr/Gopkg.toml new file mode 100644 index 000000000..78944774c --- /dev/null +++ b/vendor/github.com/go-logr/zapr/Gopkg.toml @@ -0,0 +1,38 @@ +# 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" +# +# [prune] +# non-go = false +# go-tests = true +# unused-packages = true + + +[[constraint]] + branch = "master" + name = "github.com/go-logr/logr" + +[[constraint]] + name = "go.uber.org/zap" + version = "1.8.0" + +[prune] + go-tests = true + unused-packages = true diff --git a/vendor/github.com/go-logr/zapr/LICENSE b/vendor/github.com/go-logr/zapr/LICENSE new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/vendor/github.com/go-logr/zapr/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-logr/zapr/README.md b/vendor/github.com/go-logr/zapr/README.md new file mode 100644 index 000000000..8472875fa --- /dev/null +++ b/vendor/github.com/go-logr/zapr/README.md @@ -0,0 +1,45 @@ +Zapr :zap: +========== + +A [logr](https://github.com/go-logr/logr) implementation using +[Zap](go.uber.org/zap). + +Usage +----- + +```go +import ( + "fmt" + + "go.uber.org/zap" + "github.com/go-logr/logr" + "github.com/directxman12/zapr" +) + +func main() { + var log logr.Logger + + zapLog, err := zap.NewDevelopment() + if err != nil { + panic(fmt.Sprintf("who watches the watchmen (%v)?", err)) + } + log = zapr.NewLogger(zapLog) + + log.Info("Logr in action!", "the answer", 42) +} +``` + +Implementation Details +---------------------- + +For the most part, concepts in Zap correspond directly with those in logr. + +Unlike Zap, all fields *must* be in the form of suggared fields -- +it's illegal to pass a strongly-typed Zap field in a key position to any +of the logging methods (`Log`, `Error`). + +Levels in logr correspond to custom debug levels in Zap. Any given level +in logr is represents by its inverse in Zap (`zapLevel = -1*logrLevel`). + +For example `V(2)` is equivalent to log level -2 in Zap, while `V(1)` is +equivalent to Zap's `DebugLevel`. diff --git a/vendor/github.com/go-logr/zapr/zapr.go b/vendor/github.com/go-logr/zapr/zapr.go new file mode 100644 index 000000000..a9a10ae2e --- /dev/null +++ b/vendor/github.com/go-logr/zapr/zapr.go @@ -0,0 +1,163 @@ +// Copyright 2018 Solly Ross +// +// 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 zapr defines an implementation of the github.com/go-logr/logr +// interfaces built on top of Zap (go.uber.org/zap). +// +// Usage +// +// A new logr.Logger can be constructed from an existing zap.Logger using +// the NewLogger function: +// +// log := zapr.NewLogger(someZapLogger) +// +// Implementation Details +// +// For the most part, concepts in Zap correspond directly with those in +// logr. +// +// Unlike Zap, all fields *must* be in the form of suggared fields -- +// it's illegal to pass a strongly-typed Zap field in a key position +// to any of the log methods. +// +// Levels in logr correspond to custom debug levels in Zap. Any given level +// in logr is represents by its inverse in zap (`zapLevel = -1*logrLevel`). +// For example V(2) is equivalent to log level -2 in Zap, while V(1) is +// equivalent to Zap's DebugLevel. +package zapr + +import ( + "github.com/go-logr/logr" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +// noopInfoLogger is a logr.InfoLogger that's always disabled, and does nothing. +type noopInfoLogger struct{} + +func (l *noopInfoLogger) Enabled() bool { return false } +func (l *noopInfoLogger) Info(_ string, _ ...interface{}) {} + +var disabledInfoLogger = &noopInfoLogger{} + +// NB: right now, we always use the equivalent of sugared logging. +// This is necessary, since logr doesn't define non-suggared types, +// and using zap-specific non-suggared types would make uses tied +// directly to Zap. + +// infoLogger is a logr.InfoLogger that uses Zap to log at a particular +// level. The level has already been converted to a Zap level, which +// is to say that `logrLevel = -1*zapLevel`. +type infoLogger struct { + lvl zapcore.Level + l *zap.Logger +} + +func (l *infoLogger) Enabled() bool { return true } +func (l *infoLogger) Info(msg string, keysAndVals ...interface{}) { + if checkedEntry := l.l.Check(l.lvl, msg); checkedEntry != nil { + checkedEntry.Write(handleFields(l.l, keysAndVals)...) + } +} + +// zapLogger is a logr.Logger that uses Zap to log. +type zapLogger struct { + // NB: this looks very similar to zap.SugaredLogger, but + // deals with our desire to have multiple verbosity levels. + l *zap.Logger + infoLogger +} + +// handleFields converts a bunch of arbitrary key-value pairs into Zap fields. It takes +// additional pre-converted Zap fields, for use with automatically attached fields, like +// `error`. +func handleFields(l *zap.Logger, args []interface{}, additional ...zap.Field) []zap.Field { + // a slightly modified version of zap.SugaredLogger.sweetenFields + if len(args) == 0 { + // fast-return if we have no suggared fields. + return additional + } + + // unlike Zap, we can be pretty sure users aren't passing structured + // fields (since logr has no concept of that), so guess that we need a + // little less space. + fields := make([]zap.Field, 0, len(args)/2+len(additional)) + for i := 0; i < len(args); { + // check just in case for strongly-typed Zap fields, which is illegal (since + // it breaks implementation agnosticism), so we can give a better error message. + if _, ok := args[i].(zap.Field); ok { + l.DPanic("strongly-typed Zap Field passed to logr", zap.Any("zap field", args[i])) + break + } + + // make sure this isn't a mismatched key + if i == len(args)-1 { + l.DPanic("odd number of arguments passed as key-value pairs for logging", zap.Any("ignored key", args[i])) + break + } + + // process a key-value pair, + // ensuring that the key is a string + key, val := args[i], args[i+1] + keyStr, isString := key.(string) + if !isString { + // if the key isn't a string, DPanic and stop logging + l.DPanic("non-string key argument passed to logging, ignoring all later arguments", zap.Any("invalid key", key)) + break + } + + fields = append(fields, zap.Any(keyStr, val)) + i += 2 + } + + return append(fields, additional...) +} + +func (l *zapLogger) Error(err error, msg string, keysAndVals ...interface{}) { + if checkedEntry := l.l.Check(zap.ErrorLevel, msg); checkedEntry != nil { + checkedEntry.Write(handleFields(l.l, keysAndVals, zap.Error(err))...) + } +} + +func (l *zapLogger) V(level int) logr.InfoLogger { + lvl := zapcore.Level(-1 * level) + if l.l.Core().Enabled(lvl) { + return &infoLogger{ + lvl: lvl, + l: l.l, + } + } + return disabledInfoLogger +} + +func (l *zapLogger) WithValues(keysAndValues ...interface{}) logr.Logger { + newLogger := l.l.With(handleFields(l.l, keysAndValues)...) + return NewLogger(newLogger) +} + +func (l *zapLogger) WithName(name string) logr.Logger { + newLogger := l.l.Named(name) + return NewLogger(newLogger) +} + +// NewLogger creates a new logr.Logger using the given Zap Logger to log. +func NewLogger(l *zap.Logger) logr.Logger { + return &zapLogger{ + l: l, + infoLogger: infoLogger{ + l: l, + lvl: zap.InfoLevel, + }, + } +} diff --git a/vendor/github.com/go-openapi/spec/.golangci.yml b/vendor/github.com/go-openapi/spec/.golangci.yml index ed53e5cd7..48c9813ff 100644 --- a/vendor/github.com/go-openapi/spec/.golangci.yml +++ b/vendor/github.com/go-openapi/spec/.golangci.yml @@ -19,3 +19,5 @@ linters: - maligned - unparam - lll + - gochecknoinits + - gochecknoglobals diff --git a/vendor/github.com/go-openapi/spec/info_test.go b/vendor/github.com/go-openapi/spec/info_test.go index fc40c1630..24cc31a58 100644 --- a/vendor/github.com/go-openapi/spec/info_test.go +++ b/vendor/github.com/go-openapi/spec/info_test.go @@ -63,3 +63,13 @@ func TestIntegrationInfo_Deserialize(t *testing.T) { assert.EqualValues(t, info, actual) } } + +func TestInfoGobEncoding(t *testing.T) { + var src, dst Info + if assert.NoError(t, json.Unmarshal([]byte(infoJSON), &src)) { + assert.EqualValues(t, src, info) + } else { + t.FailNow() + } + doTestAnyGobEncoding(t, &src, &dst) +} diff --git a/vendor/github.com/go-openapi/spec/operation.go b/vendor/github.com/go-openapi/spec/operation.go index 32f7d8fe7..344e31776 100644 --- a/vendor/github.com/go-openapi/spec/operation.go +++ b/vendor/github.com/go-openapi/spec/operation.go @@ -15,12 +15,20 @@ package spec import ( + "bytes" + "encoding/gob" "encoding/json" "github.com/go-openapi/jsonpointer" "github.com/go-openapi/swag" ) +func init() { + //gob.Register(map[string][]interface{}{}) + gob.Register(map[string]interface{}{}) + gob.Register([]interface{}{}) +} + // OperationProps describes an operation type OperationProps struct { Description string `json:"description,omitempty"` @@ -257,3 +265,126 @@ func (o *Operation) RespondsWith(code int, response *Response) *Operation { o.Responses.StatusCodeResponses[code] = *response return o } + +type opsAlias OperationProps + +type gobAlias struct { + Security []map[string]struct { + List []string + Pad bool + } + Alias *opsAlias + SecurityIsEmpty bool +} + +// GobEncode provides a safe gob encoder for Operation, including empty security requirements +func (o Operation) GobEncode() ([]byte, error) { + raw := struct { + Ext VendorExtensible + Props OperationProps + }{ + Ext: o.VendorExtensible, + Props: o.OperationProps, + } + var b bytes.Buffer + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Operation, including empty security requirements +func (o *Operation) GobDecode(b []byte) error { + var raw struct { + Ext VendorExtensible + Props OperationProps + } + + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + o.VendorExtensible = raw.Ext + o.OperationProps = raw.Props + return nil +} + +// GobEncode provides a safe gob encoder for Operation, including empty security requirements +func (op OperationProps) GobEncode() ([]byte, error) { + raw := gobAlias{ + Alias: (*opsAlias)(&op), + } + + var b bytes.Buffer + if op.Security == nil { + // nil security requirement + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + if len(op.Security) == 0 { + // empty, but non-nil security requirement + raw.SecurityIsEmpty = true + raw.Alias.Security = nil + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + raw.Security = make([]map[string]struct { + List []string + Pad bool + }, 0, len(op.Security)) + for _, req := range op.Security { + v := make(map[string]struct { + List []string + Pad bool + }, len(req)) + for k, val := range req { + v[k] = struct { + List []string + Pad bool + }{ + List: val, + } + } + raw.Security = append(raw.Security, v) + } + + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Operation, including empty security requirements +func (op *OperationProps) GobDecode(b []byte) error { + var raw gobAlias + + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + if raw.Alias == nil { + return nil + } + + switch { + case raw.SecurityIsEmpty: + // empty, but non-nil security requirement + raw.Alias.Security = []map[string][]string{} + case len(raw.Alias.Security) == 0: + // nil security requirement + raw.Alias.Security = nil + default: + raw.Alias.Security = make([]map[string][]string, 0, len(raw.Security)) + for _, req := range raw.Security { + v := make(map[string][]string, len(req)) + for k, val := range req { + v[k] = make([]string, 0, len(val.List)) + v[k] = append(v[k], val.List...) + } + raw.Alias.Security = append(raw.Alias.Security, v) + } + } + + *op = *(*OperationProps)(raw.Alias) + return nil +} diff --git a/vendor/github.com/go-openapi/spec/operation_test.go b/vendor/github.com/go-openapi/spec/operation_test.go index 0bc721d85..46e3f2754 100644 --- a/vendor/github.com/go-openapi/spec/operation_test.go +++ b/vendor/github.com/go-openapi/spec/operation_test.go @@ -15,6 +15,8 @@ package spec import ( + "bytes" + "encoding/gob" "encoding/json" "testing" @@ -103,5 +105,100 @@ func TestSecurityProperty(t *testing.T) { assert.Equal(t, securityContainsEmptyArray, props) } } +} + +func TestOperationGobEncoding(t *testing.T) { + // 1. empty scope in security requirements: "security": [ { "apiKey": [] } ], + doTestOperationGobEncoding(t, operationJSON) + + // 2. nil security requirements + doTestOperationGobEncoding(t, `{ + "description": "operation description", + "x-framework": "go-swagger", + "consumes": [ "application/json", "application/x-yaml" ], + "produces": [ "application/json", "application/x-yaml" ], + "schemes": ["http", "https"], + "tags": ["dogs"], + "summary": "the summary of the operation", + "operationId": "sendCat", + "deprecated": true, + "parameters": [{"$ref":"Cat"}], + "responses": { + "default": { + "description": "void response" + } + } +}`) + // 3. empty security requirement + doTestOperationGobEncoding(t, `{ + "description": "operation description", + "x-framework": "go-swagger", + "consumes": [ "application/json", "application/x-yaml" ], + "produces": [ "application/json", "application/x-yaml" ], + "schemes": ["http", "https"], + "tags": ["dogs"], + "security": [], + "summary": "the summary of the operation", + "operationId": "sendCat", + "deprecated": true, + "parameters": [{"$ref":"Cat"}], + "responses": { + "default": { + "description": "void response" + } + } +}`) + + // 4. non-empty security requirements + doTestOperationGobEncoding(t, `{ + "description": "operation description", + "x-framework": "go-swagger", + "consumes": [ "application/json", "application/x-yaml" ], + "produces": [ "application/json", "application/x-yaml" ], + "schemes": ["http", "https"], + "tags": ["dogs"], + "summary": "the summary of the operation", + "security": [ { "scoped-auth": [ "phone", "email" ] , "api-key": []} ], + "operationId": "sendCat", + "deprecated": true, + "parameters": [{"$ref":"Cat"}], + "responses": { + "default": { + "description": "void response" + } + } +}`) + +} + +func doTestOperationGobEncoding(t *testing.T, fixture string) { + var src, dst Operation + + if !assert.NoError(t, json.Unmarshal([]byte(fixture), &src)) { + t.FailNow() + } + + doTestAnyGobEncoding(t, &src, &dst) +} + +func doTestAnyGobEncoding(t *testing.T, src, dst interface{}) { + expectedJSON, _ := json.MarshalIndent(src, "", " ") + + var b bytes.Buffer + err := gob.NewEncoder(&b).Encode(src) + if !assert.NoError(t, err) { + t.FailNow() + } + + err = gob.NewDecoder(&b).Decode(dst) + if !assert.NoError(t, err) { + t.FailNow() + } + + jazon, err := json.MarshalIndent(dst, "", " ") + if !assert.NoError(t, err) { + t.FailNow() + } + assert.JSONEq(t, string(expectedJSON), string(jazon)) } diff --git a/vendor/github.com/go-openapi/spec/parameters_test.go b/vendor/github.com/go-openapi/spec/parameters_test.go index 043b859ed..02b926680 100644 --- a/vendor/github.com/go-openapi/spec/parameters_test.go +++ b/vendor/github.com/go-openapi/spec/parameters_test.go @@ -154,3 +154,11 @@ func TestParameterSerialization(t *testing.T) { `{"type":"object","in":"body","schema":{"type":"array","items":{"$ref":"Cat"}}}`) } + +func TestParameterGobEncoding(t *testing.T) { + var src, dst Parameter + if !assert.NoError(t, json.Unmarshal([]byte(parameterJSON), &src)) { + t.FailNow() + } + doTestAnyGobEncoding(t, &src, &dst) +} diff --git a/vendor/github.com/go-openapi/spec/ref.go b/vendor/github.com/go-openapi/spec/ref.go index 1405bfd8e..08ff869b2 100644 --- a/vendor/github.com/go-openapi/spec/ref.go +++ b/vendor/github.com/go-openapi/spec/ref.go @@ -15,6 +15,8 @@ package spec import ( + "bytes" + "encoding/gob" "encoding/json" "net/http" "os" @@ -148,6 +150,28 @@ func (r *Ref) UnmarshalJSON(d []byte) error { return r.fromMap(v) } +// GobEncode provides a safe gob encoder for Ref +func (r Ref) GobEncode() ([]byte, error) { + var b bytes.Buffer + raw, err := r.MarshalJSON() + if err != nil { + return nil, err + } + err = gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Ref +func (r *Ref) GobDecode(b []byte) error { + var raw []byte + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + return json.Unmarshal(raw, r) +} + func (r *Ref) fromMap(v map[string]interface{}) error { if v == nil { return nil diff --git a/vendor/github.com/go-openapi/spec/ref_test.go b/vendor/github.com/go-openapi/spec/ref_test.go new file mode 100644 index 000000000..7dc2f59e2 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/ref_test.go @@ -0,0 +1,47 @@ +// Copyright 2015 go-swagger maintainers +// +// 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 spec + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "testing" + + "github.com/stretchr/testify/assert" +) + +// pin pointing go-swagger/go-swagger#1816 issue with cloning ref's +func TestCloneRef(t *testing.T) { + var b bytes.Buffer + src := MustCreateRef("#/definitions/test") + err := gob.NewEncoder(&b).Encode(&src) + if !assert.NoError(t, err) { + t.FailNow() + } + + var dst Ref + err = gob.NewDecoder(&b).Decode(&dst) + if !assert.NoError(t, err) { + t.FailNow() + } + + jazon, err := json.Marshal(dst) + if !assert.NoError(t, err) { + t.FailNow() + } + + assert.Equal(t, `{"$ref":"#/definitions/test"}`, string(jazon)) +} diff --git a/vendor/github.com/golang/groupcache/.gitignore b/vendor/github.com/golang/groupcache/.gitignore new file mode 100644 index 000000000..b25c15b81 --- /dev/null +++ b/vendor/github.com/golang/groupcache/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/vendor/github.com/golang/groupcache/.travis.yml b/vendor/github.com/golang/groupcache/.travis.yml new file mode 100644 index 000000000..674925795 --- /dev/null +++ b/vendor/github.com/golang/groupcache/.travis.yml @@ -0,0 +1,19 @@ +language: go +go_import_path: github.com/golang/groupcache + +os: linux +dist: trusty +sudo: false + +script: + - go test ./... + +go: + - 1.9.x + - 1.10.x + - 1.11.x + - master + +cache: + directories: + - $GOPATH/pkg diff --git a/vendor/github.com/golang/groupcache/LICENSE b/vendor/github.com/golang/groupcache/LICENSE new file mode 100644 index 000000000..37ec93a14 --- /dev/null +++ b/vendor/github.com/golang/groupcache/LICENSE @@ -0,0 +1,191 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright [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/golang/groupcache/README.md b/vendor/github.com/golang/groupcache/README.md new file mode 100644 index 000000000..70c29da16 --- /dev/null +++ b/vendor/github.com/golang/groupcache/README.md @@ -0,0 +1,73 @@ +# groupcache + +## Summary + +groupcache is a caching and cache-filling library, intended as a +replacement for memcached in many cases. + +For API docs and examples, see http://godoc.org/github.com/golang/groupcache + +## Comparison to memcached + +### **Like memcached**, groupcache: + + * shards by key to select which peer is responsible for that key + +### **Unlike memcached**, groupcache: + + * does not require running a separate set of servers, thus massively + reducing deployment/configuration pain. groupcache is a client + library as well as a server. It connects to its own peers. + + * comes with a cache filling mechanism. Whereas memcached just says + "Sorry, cache miss", often resulting in a thundering herd of + database (or whatever) loads from an unbounded number of clients + (which has resulted in several fun outages), groupcache coordinates + cache fills such that only one load in one process of an entire + replicated set of processes populates the cache, then multiplexes + the loaded value to all callers. + + * does not support versioned values. If key "foo" is value "bar", + key "foo" must always be "bar". There are neither cache expiration + times, nor explicit cache evictions. Thus there is also no CAS, + nor Increment/Decrement. This also means that groupcache.... + + * ... supports automatic mirroring of super-hot items to multiple + processes. This prevents memcached hot spotting where a machine's + CPU and/or NIC are overloaded by very popular keys/values. + + * is currently only available for Go. It's very unlikely that I + (bradfitz@) will port the code to any other language. + +## Loading process + +In a nutshell, a groupcache lookup of **Get("foo")** looks like: + +(On machine #5 of a set of N machines running the same code) + + 1. Is the value of "foo" in local memory because it's super hot? If so, use it. + + 2. Is the value of "foo" in local memory because peer #5 (the current + peer) is the owner of it? If so, use it. + + 3. Amongst all the peers in my set of N, am I the owner of the key + "foo"? (e.g. does it consistent hash to 5?) If so, load it. If + other callers come in, via the same process or via RPC requests + from peers, they block waiting for the load to finish and get the + same answer. If not, RPC to the peer that's the owner and get + the answer. If the RPC fails, just load it locally (still with + local dup suppression). + +## Users + +groupcache is in production use by dl.google.com (its original user), +parts of Blogger, parts of Google Code, parts of Google Fiber, parts +of Google production monitoring systems, etc. + +## Presentations + +See http://talks.golang.org/2013/oscon-dl.slide + +## Help + +Use the golang-nuts mailing list for any discussion or questions. diff --git a/vendor/github.com/golang/groupcache/byteview.go b/vendor/github.com/golang/groupcache/byteview.go new file mode 100644 index 000000000..a2c2c493d --- /dev/null +++ b/vendor/github.com/golang/groupcache/byteview.go @@ -0,0 +1,175 @@ +/* +Copyright 2012 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. +*/ + +package groupcache + +import ( + "bytes" + "errors" + "io" + "strings" +) + +// A ByteView holds an immutable view of bytes. +// Internally it wraps either a []byte or a string, +// but that detail is invisible to callers. +// +// A ByteView is meant to be used as a value type, not +// a pointer (like a time.Time). +type ByteView struct { + // If b is non-nil, b is used, else s is used. + b []byte + s string +} + +// Len returns the view's length. +func (v ByteView) Len() int { + if v.b != nil { + return len(v.b) + } + return len(v.s) +} + +// ByteSlice returns a copy of the data as a byte slice. +func (v ByteView) ByteSlice() []byte { + if v.b != nil { + return cloneBytes(v.b) + } + return []byte(v.s) +} + +// String returns the data as a string, making a copy if necessary. +func (v ByteView) String() string { + if v.b != nil { + return string(v.b) + } + return v.s +} + +// At returns the byte at index i. +func (v ByteView) At(i int) byte { + if v.b != nil { + return v.b[i] + } + return v.s[i] +} + +// Slice slices the view between the provided from and to indices. +func (v ByteView) Slice(from, to int) ByteView { + if v.b != nil { + return ByteView{b: v.b[from:to]} + } + return ByteView{s: v.s[from:to]} +} + +// SliceFrom slices the view from the provided index until the end. +func (v ByteView) SliceFrom(from int) ByteView { + if v.b != nil { + return ByteView{b: v.b[from:]} + } + return ByteView{s: v.s[from:]} +} + +// Copy copies b into dest and returns the number of bytes copied. +func (v ByteView) Copy(dest []byte) int { + if v.b != nil { + return copy(dest, v.b) + } + return copy(dest, v.s) +} + +// Equal returns whether the bytes in b are the same as the bytes in +// b2. +func (v ByteView) Equal(b2 ByteView) bool { + if b2.b == nil { + return v.EqualString(b2.s) + } + return v.EqualBytes(b2.b) +} + +// EqualString returns whether the bytes in b are the same as the bytes +// in s. +func (v ByteView) EqualString(s string) bool { + if v.b == nil { + return v.s == s + } + l := v.Len() + if len(s) != l { + return false + } + for i, bi := range v.b { + if bi != s[i] { + return false + } + } + return true +} + +// EqualBytes returns whether the bytes in b are the same as the bytes +// in b2. +func (v ByteView) EqualBytes(b2 []byte) bool { + if v.b != nil { + return bytes.Equal(v.b, b2) + } + l := v.Len() + if len(b2) != l { + return false + } + for i, bi := range b2 { + if bi != v.s[i] { + return false + } + } + return true +} + +// Reader returns an io.ReadSeeker for the bytes in v. +func (v ByteView) Reader() io.ReadSeeker { + if v.b != nil { + return bytes.NewReader(v.b) + } + return strings.NewReader(v.s) +} + +// ReadAt implements io.ReaderAt on the bytes in v. +func (v ByteView) ReadAt(p []byte, off int64) (n int, err error) { + if off < 0 { + return 0, errors.New("view: invalid offset") + } + if off >= int64(v.Len()) { + return 0, io.EOF + } + n = v.SliceFrom(int(off)).Copy(p) + if n < len(p) { + err = io.EOF + } + return +} + +// WriteTo implements io.WriterTo on the bytes in v. +func (v ByteView) WriteTo(w io.Writer) (n int64, err error) { + var m int + if v.b != nil { + m, err = w.Write(v.b) + } else { + m, err = io.WriteString(w, v.s) + } + if err == nil && m < v.Len() { + err = io.ErrShortWrite + } + n = int64(m) + return +} diff --git a/vendor/github.com/golang/groupcache/byteview_test.go b/vendor/github.com/golang/groupcache/byteview_test.go new file mode 100644 index 000000000..a09757aa8 --- /dev/null +++ b/vendor/github.com/golang/groupcache/byteview_test.go @@ -0,0 +1,147 @@ +/* +Copyright 2012 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. +*/ + +package groupcache + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "testing" +) + +func TestByteView(t *testing.T) { + for _, s := range []string{"", "x", "yy"} { + for _, v := range []ByteView{of([]byte(s)), of(s)} { + name := fmt.Sprintf("string %q, view %+v", s, v) + if v.Len() != len(s) { + t.Errorf("%s: Len = %d; want %d", name, v.Len(), len(s)) + } + if v.String() != s { + t.Errorf("%s: String = %q; want %q", name, v.String(), s) + } + var longDest [3]byte + if n := v.Copy(longDest[:]); n != len(s) { + t.Errorf("%s: long Copy = %d; want %d", name, n, len(s)) + } + var shortDest [1]byte + if n := v.Copy(shortDest[:]); n != min(len(s), 1) { + t.Errorf("%s: short Copy = %d; want %d", name, n, min(len(s), 1)) + } + if got, err := ioutil.ReadAll(v.Reader()); err != nil || string(got) != s { + t.Errorf("%s: Reader = %q, %v; want %q", name, got, err, s) + } + if got, err := ioutil.ReadAll(io.NewSectionReader(v, 0, int64(len(s)))); err != nil || string(got) != s { + t.Errorf("%s: SectionReader of ReaderAt = %q, %v; want %q", name, got, err, s) + } + var dest bytes.Buffer + if _, err := v.WriteTo(&dest); err != nil || !bytes.Equal(dest.Bytes(), []byte(s)) { + t.Errorf("%s: WriteTo = %q, %v; want %q", name, dest.Bytes(), err, s) + } + } + } +} + +// of returns a byte view of the []byte or string in x. +func of(x interface{}) ByteView { + if bytes, ok := x.([]byte); ok { + return ByteView{b: bytes} + } + return ByteView{s: x.(string)} +} + +func TestByteViewEqual(t *testing.T) { + tests := []struct { + a interface{} // string or []byte + b interface{} // string or []byte + want bool + }{ + {"x", "x", true}, + {"x", "y", false}, + {"x", "yy", false}, + {[]byte("x"), []byte("x"), true}, + {[]byte("x"), []byte("y"), false}, + {[]byte("x"), []byte("yy"), false}, + {[]byte("x"), "x", true}, + {[]byte("x"), "y", false}, + {[]byte("x"), "yy", false}, + {"x", []byte("x"), true}, + {"x", []byte("y"), false}, + {"x", []byte("yy"), false}, + } + for i, tt := range tests { + va := of(tt.a) + if bytes, ok := tt.b.([]byte); ok { + if got := va.EqualBytes(bytes); got != tt.want { + t.Errorf("%d. EqualBytes = %v; want %v", i, got, tt.want) + } + } else { + if got := va.EqualString(tt.b.(string)); got != tt.want { + t.Errorf("%d. EqualString = %v; want %v", i, got, tt.want) + } + } + if got := va.Equal(of(tt.b)); got != tt.want { + t.Errorf("%d. Equal = %v; want %v", i, got, tt.want) + } + } +} + +func TestByteViewSlice(t *testing.T) { + tests := []struct { + in string + from int + to interface{} // nil to mean the end (SliceFrom); else int + want string + }{ + { + in: "abc", + from: 1, + to: 2, + want: "b", + }, + { + in: "abc", + from: 1, + want: "bc", + }, + { + in: "abc", + to: 2, + want: "ab", + }, + } + for i, tt := range tests { + for _, v := range []ByteView{of([]byte(tt.in)), of(tt.in)} { + name := fmt.Sprintf("test %d, view %+v", i, v) + if tt.to != nil { + v = v.Slice(tt.from, tt.to.(int)) + } else { + v = v.SliceFrom(tt.from) + } + if v.String() != tt.want { + t.Errorf("%s: got %q; want %q", name, v.String(), tt.want) + } + } + } +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} diff --git a/vendor/github.com/golang/groupcache/consistenthash/consistenthash.go b/vendor/github.com/golang/groupcache/consistenthash/consistenthash.go new file mode 100644 index 000000000..a9c56f076 --- /dev/null +++ b/vendor/github.com/golang/groupcache/consistenthash/consistenthash.go @@ -0,0 +1,81 @@ +/* +Copyright 2013 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. +*/ + +// Package consistenthash provides an implementation of a ring hash. +package consistenthash + +import ( + "hash/crc32" + "sort" + "strconv" +) + +type Hash func(data []byte) uint32 + +type Map struct { + hash Hash + replicas int + keys []int // Sorted + hashMap map[int]string +} + +func New(replicas int, fn Hash) *Map { + m := &Map{ + replicas: replicas, + hash: fn, + hashMap: make(map[int]string), + } + if m.hash == nil { + m.hash = crc32.ChecksumIEEE + } + return m +} + +// Returns true if there are no items available. +func (m *Map) IsEmpty() bool { + return len(m.keys) == 0 +} + +// Adds some keys to the hash. +func (m *Map) Add(keys ...string) { + for _, key := range keys { + for i := 0; i < m.replicas; i++ { + hash := int(m.hash([]byte(strconv.Itoa(i) + key))) + m.keys = append(m.keys, hash) + m.hashMap[hash] = key + } + } + sort.Ints(m.keys) +} + +// Gets the closest item in the hash to the provided key. +func (m *Map) Get(key string) string { + if m.IsEmpty() { + return "" + } + + hash := int(m.hash([]byte(key))) + + // Binary search for appropriate replica. + idx := sort.Search(len(m.keys), func(i int) bool { return m.keys[i] >= hash }) + + // Means we have cycled back to the first replica. + if idx == len(m.keys) { + idx = 0 + } + + return m.hashMap[m.keys[idx]] +} diff --git a/vendor/github.com/golang/groupcache/consistenthash/consistenthash_test.go b/vendor/github.com/golang/groupcache/consistenthash/consistenthash_test.go new file mode 100644 index 000000000..1a37fd7ff --- /dev/null +++ b/vendor/github.com/golang/groupcache/consistenthash/consistenthash_test.go @@ -0,0 +1,110 @@ +/* +Copyright 2013 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. +*/ + +package consistenthash + +import ( + "fmt" + "strconv" + "testing" +) + +func TestHashing(t *testing.T) { + + // Override the hash function to return easier to reason about values. Assumes + // the keys can be converted to an integer. + hash := New(3, func(key []byte) uint32 { + i, err := strconv.Atoi(string(key)) + if err != nil { + panic(err) + } + return uint32(i) + }) + + // Given the above hash function, this will give replicas with "hashes": + // 2, 4, 6, 12, 14, 16, 22, 24, 26 + hash.Add("6", "4", "2") + + testCases := map[string]string{ + "2": "2", + "11": "2", + "23": "4", + "27": "2", + } + + for k, v := range testCases { + if hash.Get(k) != v { + t.Errorf("Asking for %s, should have yielded %s", k, v) + } + } + + // Adds 8, 18, 28 + hash.Add("8") + + // 27 should now map to 8. + testCases["27"] = "8" + + for k, v := range testCases { + if hash.Get(k) != v { + t.Errorf("Asking for %s, should have yielded %s", k, v) + } + } + +} + +func TestConsistency(t *testing.T) { + hash1 := New(1, nil) + hash2 := New(1, nil) + + hash1.Add("Bill", "Bob", "Bonny") + hash2.Add("Bob", "Bonny", "Bill") + + if hash1.Get("Ben") != hash2.Get("Ben") { + t.Errorf("Fetching 'Ben' from both hashes should be the same") + } + + hash2.Add("Becky", "Ben", "Bobby") + + if hash1.Get("Ben") != hash2.Get("Ben") || + hash1.Get("Bob") != hash2.Get("Bob") || + hash1.Get("Bonny") != hash2.Get("Bonny") { + t.Errorf("Direct matches should always return the same entry") + } + +} + +func BenchmarkGet8(b *testing.B) { benchmarkGet(b, 8) } +func BenchmarkGet32(b *testing.B) { benchmarkGet(b, 32) } +func BenchmarkGet128(b *testing.B) { benchmarkGet(b, 128) } +func BenchmarkGet512(b *testing.B) { benchmarkGet(b, 512) } + +func benchmarkGet(b *testing.B, shards int) { + + hash := New(50, nil) + + var buckets []string + for i := 0; i < shards; i++ { + buckets = append(buckets, fmt.Sprintf("shard-%d", i)) + } + + hash.Add(buckets...) + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + hash.Get(buckets[i&(shards-1)]) + } +} diff --git a/vendor/github.com/golang/groupcache/groupcache.go b/vendor/github.com/golang/groupcache/groupcache.go new file mode 100644 index 000000000..316ca4940 --- /dev/null +++ b/vendor/github.com/golang/groupcache/groupcache.go @@ -0,0 +1,491 @@ +/* +Copyright 2012 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. +*/ + +// Package groupcache provides a data loading mechanism with caching +// and de-duplication that works across a set of peer processes. +// +// Each data Get first consults its local cache, otherwise delegates +// to the requested key's canonical owner, which then checks its cache +// or finally gets the data. In the common case, many concurrent +// cache misses across a set of peers for the same key result in just +// one cache fill. +package groupcache + +import ( + "errors" + "math/rand" + "strconv" + "sync" + "sync/atomic" + + pb "github.com/golang/groupcache/groupcachepb" + "github.com/golang/groupcache/lru" + "github.com/golang/groupcache/singleflight" +) + +// A Getter loads data for a key. +type Getter interface { + // Get returns the value identified by key, populating dest. + // + // The returned data must be unversioned. That is, key must + // uniquely describe the loaded data, without an implicit + // current time, and without relying on cache expiration + // mechanisms. + Get(ctx Context, key string, dest Sink) error +} + +// A GetterFunc implements Getter with a function. +type GetterFunc func(ctx Context, key string, dest Sink) error + +func (f GetterFunc) Get(ctx Context, key string, dest Sink) error { + return f(ctx, key, dest) +} + +var ( + mu sync.RWMutex + groups = make(map[string]*Group) + + initPeerServerOnce sync.Once + initPeerServer func() +) + +// GetGroup returns the named group previously created with NewGroup, or +// nil if there's no such group. +func GetGroup(name string) *Group { + mu.RLock() + g := groups[name] + mu.RUnlock() + return g +} + +// NewGroup creates a coordinated group-aware Getter from a Getter. +// +// The returned Getter tries (but does not guarantee) to run only one +// Get call at once for a given key across an entire set of peer +// processes. Concurrent callers both in the local process and in +// other processes receive copies of the answer once the original Get +// completes. +// +// The group name must be unique for each getter. +func NewGroup(name string, cacheBytes int64, getter Getter) *Group { + return newGroup(name, cacheBytes, getter, nil) +} + +// If peers is nil, the peerPicker is called via a sync.Once to initialize it. +func newGroup(name string, cacheBytes int64, getter Getter, peers PeerPicker) *Group { + if getter == nil { + panic("nil Getter") + } + mu.Lock() + defer mu.Unlock() + initPeerServerOnce.Do(callInitPeerServer) + if _, dup := groups[name]; dup { + panic("duplicate registration of group " + name) + } + g := &Group{ + name: name, + getter: getter, + peers: peers, + cacheBytes: cacheBytes, + loadGroup: &singleflight.Group{}, + } + if fn := newGroupHook; fn != nil { + fn(g) + } + groups[name] = g + return g +} + +// newGroupHook, if non-nil, is called right after a new group is created. +var newGroupHook func(*Group) + +// RegisterNewGroupHook registers a hook that is run each time +// a group is created. +func RegisterNewGroupHook(fn func(*Group)) { + if newGroupHook != nil { + panic("RegisterNewGroupHook called more than once") + } + newGroupHook = fn +} + +// RegisterServerStart registers a hook that is run when the first +// group is created. +func RegisterServerStart(fn func()) { + if initPeerServer != nil { + panic("RegisterServerStart called more than once") + } + initPeerServer = fn +} + +func callInitPeerServer() { + if initPeerServer != nil { + initPeerServer() + } +} + +// A Group is a cache namespace and associated data loaded spread over +// a group of 1 or more machines. +type Group struct { + name string + getter Getter + peersOnce sync.Once + peers PeerPicker + cacheBytes int64 // limit for sum of mainCache and hotCache size + + // mainCache is a cache of the keys for which this process + // (amongst its peers) is authoritative. That is, this cache + // contains keys which consistent hash on to this process's + // peer number. + mainCache cache + + // hotCache contains keys/values for which this peer is not + // authoritative (otherwise they would be in mainCache), but + // are popular enough to warrant mirroring in this process to + // avoid going over the network to fetch from a peer. Having + // a hotCache avoids network hotspotting, where a peer's + // network card could become the bottleneck on a popular key. + // This cache is used sparingly to maximize the total number + // of key/value pairs that can be stored globally. + hotCache cache + + // loadGroup ensures that each key is only fetched once + // (either locally or remotely), regardless of the number of + // concurrent callers. + loadGroup flightGroup + + _ int32 // force Stats to be 8-byte aligned on 32-bit platforms + + // Stats are statistics on the group. + Stats Stats +} + +// flightGroup is defined as an interface which flightgroup.Group +// satisfies. We define this so that we may test with an alternate +// implementation. +type flightGroup interface { + // Done is called when Do is done. + Do(key string, fn func() (interface{}, error)) (interface{}, error) +} + +// Stats are per-group statistics. +type Stats struct { + Gets AtomicInt // any Get request, including from peers + CacheHits AtomicInt // either cache was good + PeerLoads AtomicInt // either remote load or remote cache hit (not an error) + PeerErrors AtomicInt + Loads AtomicInt // (gets - cacheHits) + LoadsDeduped AtomicInt // after singleflight + LocalLoads AtomicInt // total good local loads + LocalLoadErrs AtomicInt // total bad local loads + ServerRequests AtomicInt // gets that came over the network from peers +} + +// Name returns the name of the group. +func (g *Group) Name() string { + return g.name +} + +func (g *Group) initPeers() { + if g.peers == nil { + g.peers = getPeers(g.name) + } +} + +func (g *Group) Get(ctx Context, key string, dest Sink) error { + g.peersOnce.Do(g.initPeers) + g.Stats.Gets.Add(1) + if dest == nil { + return errors.New("groupcache: nil dest Sink") + } + value, cacheHit := g.lookupCache(key) + + if cacheHit { + g.Stats.CacheHits.Add(1) + return setSinkView(dest, value) + } + + // Optimization to avoid double unmarshalling or copying: keep + // track of whether the dest was already populated. One caller + // (if local) will set this; the losers will not. The common + // case will likely be one caller. + destPopulated := false + value, destPopulated, err := g.load(ctx, key, dest) + if err != nil { + return err + } + if destPopulated { + return nil + } + return setSinkView(dest, value) +} + +// load loads key either by invoking the getter locally or by sending it to another machine. +func (g *Group) load(ctx Context, key string, dest Sink) (value ByteView, destPopulated bool, err error) { + g.Stats.Loads.Add(1) + viewi, err := g.loadGroup.Do(key, func() (interface{}, error) { + // Check the cache again because singleflight can only dedup calls + // that overlap concurrently. It's possible for 2 concurrent + // requests to miss the cache, resulting in 2 load() calls. An + // unfortunate goroutine scheduling would result in this callback + // being run twice, serially. If we don't check the cache again, + // cache.nbytes would be incremented below even though there will + // be only one entry for this key. + // + // Consider the following serialized event ordering for two + // goroutines in which this callback gets called twice for hte + // same key: + // 1: Get("key") + // 2: Get("key") + // 1: lookupCache("key") + // 2: lookupCache("key") + // 1: load("key") + // 2: load("key") + // 1: loadGroup.Do("key", fn) + // 1: fn() + // 2: loadGroup.Do("key", fn) + // 2: fn() + if value, cacheHit := g.lookupCache(key); cacheHit { + g.Stats.CacheHits.Add(1) + return value, nil + } + g.Stats.LoadsDeduped.Add(1) + var value ByteView + var err error + if peer, ok := g.peers.PickPeer(key); ok { + value, err = g.getFromPeer(ctx, peer, key) + if err == nil { + g.Stats.PeerLoads.Add(1) + return value, nil + } + g.Stats.PeerErrors.Add(1) + // TODO(bradfitz): log the peer's error? keep + // log of the past few for /groupcachez? It's + // probably boring (normal task movement), so not + // worth logging I imagine. + } + value, err = g.getLocally(ctx, key, dest) + if err != nil { + g.Stats.LocalLoadErrs.Add(1) + return nil, err + } + g.Stats.LocalLoads.Add(1) + destPopulated = true // only one caller of load gets this return value + g.populateCache(key, value, &g.mainCache) + return value, nil + }) + if err == nil { + value = viewi.(ByteView) + } + return +} + +func (g *Group) getLocally(ctx Context, key string, dest Sink) (ByteView, error) { + err := g.getter.Get(ctx, key, dest) + if err != nil { + return ByteView{}, err + } + return dest.view() +} + +func (g *Group) getFromPeer(ctx Context, peer ProtoGetter, key string) (ByteView, error) { + req := &pb.GetRequest{ + Group: &g.name, + Key: &key, + } + res := &pb.GetResponse{} + err := peer.Get(ctx, req, res) + if err != nil { + return ByteView{}, err + } + value := ByteView{b: res.Value} + // TODO(bradfitz): use res.MinuteQps or something smart to + // conditionally populate hotCache. For now just do it some + // percentage of the time. + if rand.Intn(10) == 0 { + g.populateCache(key, value, &g.hotCache) + } + return value, nil +} + +func (g *Group) lookupCache(key string) (value ByteView, ok bool) { + if g.cacheBytes <= 0 { + return + } + value, ok = g.mainCache.get(key) + if ok { + return + } + value, ok = g.hotCache.get(key) + return +} + +func (g *Group) populateCache(key string, value ByteView, cache *cache) { + if g.cacheBytes <= 0 { + return + } + cache.add(key, value) + + // Evict items from cache(s) if necessary. + for { + mainBytes := g.mainCache.bytes() + hotBytes := g.hotCache.bytes() + if mainBytes+hotBytes <= g.cacheBytes { + return + } + + // TODO(bradfitz): this is good-enough-for-now logic. + // It should be something based on measurements and/or + // respecting the costs of different resources. + victim := &g.mainCache + if hotBytes > mainBytes/8 { + victim = &g.hotCache + } + victim.removeOldest() + } +} + +// CacheType represents a type of cache. +type CacheType int + +const ( + // The MainCache is the cache for items that this peer is the + // owner for. + MainCache CacheType = iota + 1 + + // The HotCache is the cache for items that seem popular + // enough to replicate to this node, even though it's not the + // owner. + HotCache +) + +// CacheStats returns stats about the provided cache within the group. +func (g *Group) CacheStats(which CacheType) CacheStats { + switch which { + case MainCache: + return g.mainCache.stats() + case HotCache: + return g.hotCache.stats() + default: + return CacheStats{} + } +} + +// cache is a wrapper around an *lru.Cache that adds synchronization, +// makes values always be ByteView, and counts the size of all keys and +// values. +type cache struct { + mu sync.RWMutex + nbytes int64 // of all keys and values + lru *lru.Cache + nhit, nget int64 + nevict int64 // number of evictions +} + +func (c *cache) stats() CacheStats { + c.mu.RLock() + defer c.mu.RUnlock() + return CacheStats{ + Bytes: c.nbytes, + Items: c.itemsLocked(), + Gets: c.nget, + Hits: c.nhit, + Evictions: c.nevict, + } +} + +func (c *cache) add(key string, value ByteView) { + c.mu.Lock() + defer c.mu.Unlock() + if c.lru == nil { + c.lru = &lru.Cache{ + OnEvicted: func(key lru.Key, value interface{}) { + val := value.(ByteView) + c.nbytes -= int64(len(key.(string))) + int64(val.Len()) + c.nevict++ + }, + } + } + c.lru.Add(key, value) + c.nbytes += int64(len(key)) + int64(value.Len()) +} + +func (c *cache) get(key string) (value ByteView, ok bool) { + c.mu.Lock() + defer c.mu.Unlock() + c.nget++ + if c.lru == nil { + return + } + vi, ok := c.lru.Get(key) + if !ok { + return + } + c.nhit++ + return vi.(ByteView), true +} + +func (c *cache) removeOldest() { + c.mu.Lock() + defer c.mu.Unlock() + if c.lru != nil { + c.lru.RemoveOldest() + } +} + +func (c *cache) bytes() int64 { + c.mu.RLock() + defer c.mu.RUnlock() + return c.nbytes +} + +func (c *cache) items() int64 { + c.mu.RLock() + defer c.mu.RUnlock() + return c.itemsLocked() +} + +func (c *cache) itemsLocked() int64 { + if c.lru == nil { + return 0 + } + return int64(c.lru.Len()) +} + +// An AtomicInt is an int64 to be accessed atomically. +type AtomicInt int64 + +// Add atomically adds n to i. +func (i *AtomicInt) Add(n int64) { + atomic.AddInt64((*int64)(i), n) +} + +// Get atomically gets the value of i. +func (i *AtomicInt) Get() int64 { + return atomic.LoadInt64((*int64)(i)) +} + +func (i *AtomicInt) String() string { + return strconv.FormatInt(i.Get(), 10) +} + +// CacheStats are returned by stats accessors on Group. +type CacheStats struct { + Bytes int64 + Items int64 + Gets int64 + Hits int64 + Evictions int64 +} diff --git a/vendor/github.com/golang/groupcache/groupcache_test.go b/vendor/github.com/golang/groupcache/groupcache_test.go new file mode 100644 index 000000000..ea05cac4a --- /dev/null +++ b/vendor/github.com/golang/groupcache/groupcache_test.go @@ -0,0 +1,456 @@ +/* +Copyright 2012 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. +*/ + +// Tests for groupcache. + +package groupcache + +import ( + "errors" + "fmt" + "hash/crc32" + "math/rand" + "reflect" + "sync" + "testing" + "time" + "unsafe" + + "github.com/golang/protobuf/proto" + + pb "github.com/golang/groupcache/groupcachepb" + testpb "github.com/golang/groupcache/testpb" +) + +var ( + once sync.Once + stringGroup, protoGroup Getter + + stringc = make(chan string) + + dummyCtx Context + + // cacheFills is the number of times stringGroup or + // protoGroup's Getter have been called. Read using the + // cacheFills function. + cacheFills AtomicInt +) + +const ( + stringGroupName = "string-group" + protoGroupName = "proto-group" + testMessageType = "google3/net/groupcache/go/test_proto.TestMessage" + fromChan = "from-chan" + cacheSize = 1 << 20 +) + +func testSetup() { + stringGroup = NewGroup(stringGroupName, cacheSize, GetterFunc(func(_ Context, key string, dest Sink) error { + if key == fromChan { + key = <-stringc + } + cacheFills.Add(1) + return dest.SetString("ECHO:" + key) + })) + + protoGroup = NewGroup(protoGroupName, cacheSize, GetterFunc(func(_ Context, key string, dest Sink) error { + if key == fromChan { + key = <-stringc + } + cacheFills.Add(1) + return dest.SetProto(&testpb.TestMessage{ + Name: proto.String("ECHO:" + key), + City: proto.String("SOME-CITY"), + }) + })) +} + +// tests that a Getter's Get method is only called once with two +// outstanding callers. This is the string variant. +func TestGetDupSuppressString(t *testing.T) { + once.Do(testSetup) + // Start two getters. The first should block (waiting reading + // from stringc) and the second should latch on to the first + // one. + resc := make(chan string, 2) + for i := 0; i < 2; i++ { + go func() { + var s string + if err := stringGroup.Get(dummyCtx, fromChan, StringSink(&s)); err != nil { + resc <- "ERROR:" + err.Error() + return + } + resc <- s + }() + } + + // Wait a bit so both goroutines get merged together via + // singleflight. + // TODO(bradfitz): decide whether there are any non-offensive + // debug/test hooks that could be added to singleflight to + // make a sleep here unnecessary. + time.Sleep(250 * time.Millisecond) + + // Unblock the first getter, which should unblock the second + // as well. + stringc <- "foo" + + for i := 0; i < 2; i++ { + select { + case v := <-resc: + if v != "ECHO:foo" { + t.Errorf("got %q; want %q", v, "ECHO:foo") + } + case <-time.After(5 * time.Second): + t.Errorf("timeout waiting on getter #%d of 2", i+1) + } + } +} + +// tests that a Getter's Get method is only called once with two +// outstanding callers. This is the proto variant. +func TestGetDupSuppressProto(t *testing.T) { + once.Do(testSetup) + // Start two getters. The first should block (waiting reading + // from stringc) and the second should latch on to the first + // one. + resc := make(chan *testpb.TestMessage, 2) + for i := 0; i < 2; i++ { + go func() { + tm := new(testpb.TestMessage) + if err := protoGroup.Get(dummyCtx, fromChan, ProtoSink(tm)); err != nil { + tm.Name = proto.String("ERROR:" + err.Error()) + } + resc <- tm + }() + } + + // Wait a bit so both goroutines get merged together via + // singleflight. + // TODO(bradfitz): decide whether there are any non-offensive + // debug/test hooks that could be added to singleflight to + // make a sleep here unnecessary. + time.Sleep(250 * time.Millisecond) + + // Unblock the first getter, which should unblock the second + // as well. + stringc <- "Fluffy" + want := &testpb.TestMessage{ + Name: proto.String("ECHO:Fluffy"), + City: proto.String("SOME-CITY"), + } + for i := 0; i < 2; i++ { + select { + case v := <-resc: + if !reflect.DeepEqual(v, want) { + t.Errorf(" Got: %v\nWant: %v", proto.CompactTextString(v), proto.CompactTextString(want)) + } + case <-time.After(5 * time.Second): + t.Errorf("timeout waiting on getter #%d of 2", i+1) + } + } +} + +func countFills(f func()) int64 { + fills0 := cacheFills.Get() + f() + return cacheFills.Get() - fills0 +} + +func TestCaching(t *testing.T) { + once.Do(testSetup) + fills := countFills(func() { + for i := 0; i < 10; i++ { + var s string + if err := stringGroup.Get(dummyCtx, "TestCaching-key", StringSink(&s)); err != nil { + t.Fatal(err) + } + } + }) + if fills != 1 { + t.Errorf("expected 1 cache fill; got %d", fills) + } +} + +func TestCacheEviction(t *testing.T) { + once.Do(testSetup) + testKey := "TestCacheEviction-key" + getTestKey := func() { + var res string + for i := 0; i < 10; i++ { + if err := stringGroup.Get(dummyCtx, testKey, StringSink(&res)); err != nil { + t.Fatal(err) + } + } + } + fills := countFills(getTestKey) + if fills != 1 { + t.Fatalf("expected 1 cache fill; got %d", fills) + } + + g := stringGroup.(*Group) + evict0 := g.mainCache.nevict + + // Trash the cache with other keys. + var bytesFlooded int64 + // cacheSize/len(testKey) is approximate + for bytesFlooded < cacheSize+1024 { + var res string + key := fmt.Sprintf("dummy-key-%d", bytesFlooded) + stringGroup.Get(dummyCtx, key, StringSink(&res)) + bytesFlooded += int64(len(key) + len(res)) + } + evicts := g.mainCache.nevict - evict0 + if evicts <= 0 { + t.Errorf("evicts = %v; want more than 0", evicts) + } + + // Test that the key is gone. + fills = countFills(getTestKey) + if fills != 1 { + t.Fatalf("expected 1 cache fill after cache trashing; got %d", fills) + } +} + +type fakePeer struct { + hits int + fail bool +} + +func (p *fakePeer) Get(_ Context, in *pb.GetRequest, out *pb.GetResponse) error { + p.hits++ + if p.fail { + return errors.New("simulated error from peer") + } + out.Value = []byte("got:" + in.GetKey()) + return nil +} + +type fakePeers []ProtoGetter + +func (p fakePeers) PickPeer(key string) (peer ProtoGetter, ok bool) { + if len(p) == 0 { + return + } + n := crc32.Checksum([]byte(key), crc32.IEEETable) % uint32(len(p)) + return p[n], p[n] != nil +} + +// tests that peers (virtual, in-process) are hit, and how much. +func TestPeers(t *testing.T) { + once.Do(testSetup) + rand.Seed(123) + peer0 := &fakePeer{} + peer1 := &fakePeer{} + peer2 := &fakePeer{} + peerList := fakePeers([]ProtoGetter{peer0, peer1, peer2, nil}) + const cacheSize = 0 // disabled + localHits := 0 + getter := func(_ Context, key string, dest Sink) error { + localHits++ + return dest.SetString("got:" + key) + } + testGroup := newGroup("TestPeers-group", cacheSize, GetterFunc(getter), peerList) + run := func(name string, n int, wantSummary string) { + // Reset counters + localHits = 0 + for _, p := range []*fakePeer{peer0, peer1, peer2} { + p.hits = 0 + } + + for i := 0; i < n; i++ { + key := fmt.Sprintf("key-%d", i) + want := "got:" + key + var got string + err := testGroup.Get(dummyCtx, key, StringSink(&got)) + if err != nil { + t.Errorf("%s: error on key %q: %v", name, key, err) + continue + } + if got != want { + t.Errorf("%s: for key %q, got %q; want %q", name, key, got, want) + } + } + summary := func() string { + return fmt.Sprintf("localHits = %d, peers = %d %d %d", localHits, peer0.hits, peer1.hits, peer2.hits) + } + if got := summary(); got != wantSummary { + t.Errorf("%s: got %q; want %q", name, got, wantSummary) + } + } + resetCacheSize := func(maxBytes int64) { + g := testGroup + g.cacheBytes = maxBytes + g.mainCache = cache{} + g.hotCache = cache{} + } + + // Base case; peers all up, with no problems. + resetCacheSize(1 << 20) + run("base", 200, "localHits = 49, peers = 51 49 51") + + // Verify cache was hit. All localHits are gone, and some of + // the peer hits (the ones randomly selected to be maybe hot) + run("cached_base", 200, "localHits = 0, peers = 49 47 48") + resetCacheSize(0) + + // With one of the peers being down. + // TODO(bradfitz): on a peer number being unavailable, the + // consistent hashing should maybe keep trying others to + // spread the load out. Currently it fails back to local + // execution if the first consistent-hash slot is unavailable. + peerList[0] = nil + run("one_peer_down", 200, "localHits = 100, peers = 0 49 51") + + // Failing peer + peerList[0] = peer0 + peer0.fail = true + run("peer0_failing", 200, "localHits = 100, peers = 51 49 51") +} + +func TestTruncatingByteSliceTarget(t *testing.T) { + var buf [100]byte + s := buf[:] + if err := stringGroup.Get(dummyCtx, "short", TruncatingByteSliceSink(&s)); err != nil { + t.Fatal(err) + } + if want := "ECHO:short"; string(s) != want { + t.Errorf("short key got %q; want %q", s, want) + } + + s = buf[:6] + if err := stringGroup.Get(dummyCtx, "truncated", TruncatingByteSliceSink(&s)); err != nil { + t.Fatal(err) + } + if want := "ECHO:t"; string(s) != want { + t.Errorf("truncated key got %q; want %q", s, want) + } +} + +func TestAllocatingByteSliceTarget(t *testing.T) { + var dst []byte + sink := AllocatingByteSliceSink(&dst) + + inBytes := []byte("some bytes") + sink.SetBytes(inBytes) + if want := "some bytes"; string(dst) != want { + t.Errorf("SetBytes resulted in %q; want %q", dst, want) + } + v, err := sink.view() + if err != nil { + t.Fatalf("view after SetBytes failed: %v", err) + } + if &inBytes[0] == &dst[0] { + t.Error("inBytes and dst share memory") + } + if &inBytes[0] == &v.b[0] { + t.Error("inBytes and view share memory") + } + if &dst[0] == &v.b[0] { + t.Error("dst and view share memory") + } +} + +// orderedFlightGroup allows the caller to force the schedule of when +// orig.Do will be called. This is useful to serialize calls such +// that singleflight cannot dedup them. +type orderedFlightGroup struct { + mu sync.Mutex + stage1 chan bool + stage2 chan bool + orig flightGroup +} + +func (g *orderedFlightGroup) Do(key string, fn func() (interface{}, error)) (interface{}, error) { + <-g.stage1 + <-g.stage2 + g.mu.Lock() + defer g.mu.Unlock() + return g.orig.Do(key, fn) +} + +// TestNoDedup tests invariants on the cache size when singleflight is +// unable to dedup calls. +func TestNoDedup(t *testing.T) { + const testkey = "testkey" + const testval = "testval" + g := newGroup("testgroup", 1024, GetterFunc(func(_ Context, key string, dest Sink) error { + return dest.SetString(testval) + }), nil) + + orderedGroup := &orderedFlightGroup{ + stage1: make(chan bool), + stage2: make(chan bool), + orig: g.loadGroup, + } + // Replace loadGroup with our wrapper so we can control when + // loadGroup.Do is entered for each concurrent request. + g.loadGroup = orderedGroup + + // Issue two idential requests concurrently. Since the cache is + // empty, it will miss. Both will enter load(), but we will only + // allow one at a time to enter singleflight.Do, so the callback + // function will be called twice. + resc := make(chan string, 2) + for i := 0; i < 2; i++ { + go func() { + var s string + if err := g.Get(dummyCtx, testkey, StringSink(&s)); err != nil { + resc <- "ERROR:" + err.Error() + return + } + resc <- s + }() + } + + // Ensure both goroutines have entered the Do routine. This implies + // both concurrent requests have checked the cache, found it empty, + // and called load(). + orderedGroup.stage1 <- true + orderedGroup.stage1 <- true + orderedGroup.stage2 <- true + orderedGroup.stage2 <- true + + for i := 0; i < 2; i++ { + if s := <-resc; s != testval { + t.Errorf("result is %s want %s", s, testval) + } + } + + const wantItems = 1 + if g.mainCache.items() != wantItems { + t.Errorf("mainCache has %d items, want %d", g.mainCache.items(), wantItems) + } + + // If the singleflight callback doesn't double-check the cache again + // upon entry, we would increment nbytes twice but the entry would + // only be in the cache once. + const wantBytes = int64(len(testkey) + len(testval)) + if g.mainCache.nbytes != wantBytes { + t.Errorf("cache has %d bytes, want %d", g.mainCache.nbytes, wantBytes) + } +} + +func TestGroupStatsAlignment(t *testing.T) { + var g Group + off := unsafe.Offsetof(g.Stats) + if off%8 != 0 { + t.Fatal("Stats structure is not 8-byte aligned.") + } +} + +// TODO(bradfitz): port the Google-internal full integration test into here, +// using HTTP requests instead of our RPC system. diff --git a/vendor/github.com/golang/groupcache/groupcachepb/groupcache.pb.go b/vendor/github.com/golang/groupcache/groupcachepb/groupcache.pb.go new file mode 100644 index 000000000..520d1ee9a --- /dev/null +++ b/vendor/github.com/golang/groupcache/groupcachepb/groupcache.pb.go @@ -0,0 +1,65 @@ +// Code generated by protoc-gen-go. +// source: groupcache.proto +// DO NOT EDIT! + +package groupcachepb + +import proto "github.com/golang/protobuf/proto" +import json "encoding/json" +import math "math" + +// Reference proto, json, and math imports to suppress error if they are not otherwise used. +var _ = proto.Marshal +var _ = &json.SyntaxError{} +var _ = math.Inf + +type GetRequest struct { + Group *string `protobuf:"bytes,1,req,name=group" json:"group,omitempty"` + Key *string `protobuf:"bytes,2,req,name=key" json:"key,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} + +func (m *GetRequest) GetGroup() string { + if m != nil && m.Group != nil { + return *m.Group + } + return "" +} + +func (m *GetRequest) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +type GetResponse struct { + Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + MinuteQps *float64 `protobuf:"fixed64,2,opt,name=minute_qps" json:"minute_qps,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} + +func (m *GetResponse) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *GetResponse) GetMinuteQps() float64 { + if m != nil && m.MinuteQps != nil { + return *m.MinuteQps + } + return 0 +} + +func init() { +} diff --git a/vendor/github.com/golang/groupcache/groupcachepb/groupcache.proto b/vendor/github.com/golang/groupcache/groupcachepb/groupcache.proto new file mode 100644 index 000000000..b5bdff94f --- /dev/null +++ b/vendor/github.com/golang/groupcache/groupcachepb/groupcache.proto @@ -0,0 +1,34 @@ +/* +Copyright 2012 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. +*/ + +syntax = "proto2"; + +package groupcachepb; + +message GetRequest { + required string group = 1; + required string key = 2; // not actually required/guaranteed to be UTF-8 +} + +message GetResponse { + optional bytes value = 1; + optional double minute_qps = 2; +} + +service GroupCache { + rpc Get(GetRequest) returns (GetResponse) { + }; +} diff --git a/vendor/github.com/golang/groupcache/http.go b/vendor/github.com/golang/groupcache/http.go new file mode 100644 index 000000000..f37467a78 --- /dev/null +++ b/vendor/github.com/golang/groupcache/http.go @@ -0,0 +1,227 @@ +/* +Copyright 2013 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. +*/ + +package groupcache + +import ( + "bytes" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "sync" + + "github.com/golang/groupcache/consistenthash" + pb "github.com/golang/groupcache/groupcachepb" + "github.com/golang/protobuf/proto" +) + +const defaultBasePath = "/_groupcache/" + +const defaultReplicas = 50 + +// HTTPPool implements PeerPicker for a pool of HTTP peers. +type HTTPPool struct { + // Context optionally specifies a context for the server to use when it + // receives a request. + // If nil, the server uses a nil Context. + Context func(*http.Request) Context + + // Transport optionally specifies an http.RoundTripper for the client + // to use when it makes a request. + // If nil, the client uses http.DefaultTransport. + Transport func(Context) http.RoundTripper + + // this peer's base URL, e.g. "https://example.net:8000" + self string + + // opts specifies the options. + opts HTTPPoolOptions + + mu sync.Mutex // guards peers and httpGetters + peers *consistenthash.Map + httpGetters map[string]*httpGetter // keyed by e.g. "http://10.0.0.2:8008" +} + +// HTTPPoolOptions are the configurations of a HTTPPool. +type HTTPPoolOptions struct { + // BasePath specifies the HTTP path that will serve groupcache requests. + // If blank, it defaults to "/_groupcache/". + BasePath string + + // Replicas specifies the number of key replicas on the consistent hash. + // If blank, it defaults to 50. + Replicas int + + // HashFn specifies the hash function of the consistent hash. + // If blank, it defaults to crc32.ChecksumIEEE. + HashFn consistenthash.Hash +} + +// NewHTTPPool initializes an HTTP pool of peers, and registers itself as a PeerPicker. +// For convenience, it also registers itself as an http.Handler with http.DefaultServeMux. +// The self argument should be a valid base URL that points to the current server, +// for example "http://example.net:8000". +func NewHTTPPool(self string) *HTTPPool { + p := NewHTTPPoolOpts(self, nil) + http.Handle(p.opts.BasePath, p) + return p +} + +var httpPoolMade bool + +// NewHTTPPoolOpts initializes an HTTP pool of peers with the given options. +// Unlike NewHTTPPool, this function does not register the created pool as an HTTP handler. +// The returned *HTTPPool implements http.Handler and must be registered using http.Handle. +func NewHTTPPoolOpts(self string, o *HTTPPoolOptions) *HTTPPool { + if httpPoolMade { + panic("groupcache: NewHTTPPool must be called only once") + } + httpPoolMade = true + + p := &HTTPPool{ + self: self, + httpGetters: make(map[string]*httpGetter), + } + if o != nil { + p.opts = *o + } + if p.opts.BasePath == "" { + p.opts.BasePath = defaultBasePath + } + if p.opts.Replicas == 0 { + p.opts.Replicas = defaultReplicas + } + p.peers = consistenthash.New(p.opts.Replicas, p.opts.HashFn) + + RegisterPeerPicker(func() PeerPicker { return p }) + return p +} + +// Set updates the pool's list of peers. +// Each peer value should be a valid base URL, +// for example "http://example.net:8000". +func (p *HTTPPool) Set(peers ...string) { + p.mu.Lock() + defer p.mu.Unlock() + p.peers = consistenthash.New(p.opts.Replicas, p.opts.HashFn) + p.peers.Add(peers...) + p.httpGetters = make(map[string]*httpGetter, len(peers)) + for _, peer := range peers { + p.httpGetters[peer] = &httpGetter{transport: p.Transport, baseURL: peer + p.opts.BasePath} + } +} + +func (p *HTTPPool) PickPeer(key string) (ProtoGetter, bool) { + p.mu.Lock() + defer p.mu.Unlock() + if p.peers.IsEmpty() { + return nil, false + } + if peer := p.peers.Get(key); peer != p.self { + return p.httpGetters[peer], true + } + return nil, false +} + +func (p *HTTPPool) ServeHTTP(w http.ResponseWriter, r *http.Request) { + // Parse request. + if !strings.HasPrefix(r.URL.Path, p.opts.BasePath) { + panic("HTTPPool serving unexpected path: " + r.URL.Path) + } + parts := strings.SplitN(r.URL.Path[len(p.opts.BasePath):], "/", 2) + if len(parts) != 2 { + http.Error(w, "bad request", http.StatusBadRequest) + return + } + groupName := parts[0] + key := parts[1] + + // Fetch the value for this group/key. + group := GetGroup(groupName) + if group == nil { + http.Error(w, "no such group: "+groupName, http.StatusNotFound) + return + } + var ctx Context + if p.Context != nil { + ctx = p.Context(r) + } + + group.Stats.ServerRequests.Add(1) + var value []byte + err := group.Get(ctx, key, AllocatingByteSliceSink(&value)) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + // Write the value to the response body as a proto message. + body, err := proto.Marshal(&pb.GetResponse{Value: value}) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + w.Header().Set("Content-Type", "application/x-protobuf") + w.Write(body) +} + +type httpGetter struct { + transport func(Context) http.RoundTripper + baseURL string +} + +var bufferPool = sync.Pool{ + New: func() interface{} { return new(bytes.Buffer) }, +} + +func (h *httpGetter) Get(context Context, in *pb.GetRequest, out *pb.GetResponse) error { + u := fmt.Sprintf( + "%v%v/%v", + h.baseURL, + url.QueryEscape(in.GetGroup()), + url.QueryEscape(in.GetKey()), + ) + req, err := http.NewRequest("GET", u, nil) + if err != nil { + return err + } + tr := http.DefaultTransport + if h.transport != nil { + tr = h.transport(context) + } + res, err := tr.RoundTrip(req) + if err != nil { + return err + } + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + return fmt.Errorf("server returned: %v", res.Status) + } + b := bufferPool.Get().(*bytes.Buffer) + b.Reset() + defer bufferPool.Put(b) + _, err = io.Copy(b, res.Body) + if err != nil { + return fmt.Errorf("reading response body: %v", err) + } + err = proto.Unmarshal(b.Bytes(), out) + if err != nil { + return fmt.Errorf("decoding response body: %v", err) + } + return nil +} diff --git a/vendor/github.com/golang/groupcache/http_test.go b/vendor/github.com/golang/groupcache/http_test.go new file mode 100644 index 000000000..b42edd7f0 --- /dev/null +++ b/vendor/github.com/golang/groupcache/http_test.go @@ -0,0 +1,166 @@ +/* +Copyright 2013 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. +*/ + +package groupcache + +import ( + "errors" + "flag" + "log" + "net" + "net/http" + "os" + "os/exec" + "strconv" + "strings" + "sync" + "testing" + "time" +) + +var ( + peerAddrs = flag.String("test_peer_addrs", "", "Comma-separated list of peer addresses; used by TestHTTPPool") + peerIndex = flag.Int("test_peer_index", -1, "Index of which peer this child is; used by TestHTTPPool") + peerChild = flag.Bool("test_peer_child", false, "True if running as a child process; used by TestHTTPPool") +) + +func TestHTTPPool(t *testing.T) { + if *peerChild { + beChildForTestHTTPPool() + os.Exit(0) + } + + const ( + nChild = 4 + nGets = 100 + ) + + var childAddr []string + for i := 0; i < nChild; i++ { + childAddr = append(childAddr, pickFreeAddr(t)) + } + + var cmds []*exec.Cmd + var wg sync.WaitGroup + for i := 0; i < nChild; i++ { + cmd := exec.Command(os.Args[0], + "--test.run=TestHTTPPool", + "--test_peer_child", + "--test_peer_addrs="+strings.Join(childAddr, ","), + "--test_peer_index="+strconv.Itoa(i), + ) + cmds = append(cmds, cmd) + wg.Add(1) + if err := cmd.Start(); err != nil { + t.Fatal("failed to start child process: ", err) + } + go awaitAddrReady(t, childAddr[i], &wg) + } + defer func() { + for i := 0; i < nChild; i++ { + if cmds[i].Process != nil { + cmds[i].Process.Kill() + } + } + }() + wg.Wait() + + // Use a dummy self address so that we don't handle gets in-process. + p := NewHTTPPool("should-be-ignored") + p.Set(addrToURL(childAddr)...) + + // Dummy getter function. Gets should go to children only. + // The only time this process will handle a get is when the + // children can't be contacted for some reason. + getter := GetterFunc(func(ctx Context, key string, dest Sink) error { + return errors.New("parent getter called; something's wrong") + }) + g := NewGroup("httpPoolTest", 1<<20, getter) + + for _, key := range testKeys(nGets) { + var value string + if err := g.Get(nil, key, StringSink(&value)); err != nil { + t.Fatal(err) + } + if suffix := ":" + key; !strings.HasSuffix(value, suffix) { + t.Errorf("Get(%q) = %q, want value ending in %q", key, value, suffix) + } + t.Logf("Get key=%q, value=%q (peer:key)", key, value) + } +} + +func testKeys(n int) (keys []string) { + keys = make([]string, n) + for i := range keys { + keys[i] = strconv.Itoa(i) + } + return +} + +func beChildForTestHTTPPool() { + addrs := strings.Split(*peerAddrs, ",") + + p := NewHTTPPool("http://" + addrs[*peerIndex]) + p.Set(addrToURL(addrs)...) + + getter := GetterFunc(func(ctx Context, key string, dest Sink) error { + dest.SetString(strconv.Itoa(*peerIndex) + ":" + key) + return nil + }) + NewGroup("httpPoolTest", 1<<20, getter) + + log.Fatal(http.ListenAndServe(addrs[*peerIndex], p)) +} + +// This is racy. Another process could swoop in and steal the port between the +// call to this function and the next listen call. Should be okay though. +// The proper way would be to pass the l.File() as ExtraFiles to the child +// process, and then close your copy once the child starts. +func pickFreeAddr(t *testing.T) string { + l, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + defer l.Close() + return l.Addr().String() +} + +func addrToURL(addr []string) []string { + url := make([]string, len(addr)) + for i := range addr { + url[i] = "http://" + addr[i] + } + return url +} + +func awaitAddrReady(t *testing.T, addr string, wg *sync.WaitGroup) { + defer wg.Done() + const max = 1 * time.Second + tries := 0 + for { + tries++ + c, err := net.Dial("tcp", addr) + if err == nil { + c.Close() + return + } + delay := time.Duration(tries) * 25 * time.Millisecond + if delay > max { + delay = max + } + time.Sleep(delay) + } +} diff --git a/vendor/github.com/golang/groupcache/lru/lru.go b/vendor/github.com/golang/groupcache/lru/lru.go new file mode 100644 index 000000000..532cc45e6 --- /dev/null +++ b/vendor/github.com/golang/groupcache/lru/lru.go @@ -0,0 +1,133 @@ +/* +Copyright 2013 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. +*/ + +// Package lru implements an LRU cache. +package lru + +import "container/list" + +// Cache is an LRU cache. It is not safe for concurrent access. +type Cache struct { + // MaxEntries is the maximum number of cache entries before + // an item is evicted. Zero means no limit. + MaxEntries int + + // OnEvicted optionally specificies a callback function to be + // executed when an entry is purged from the cache. + OnEvicted func(key Key, value interface{}) + + ll *list.List + cache map[interface{}]*list.Element +} + +// A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators +type Key interface{} + +type entry struct { + key Key + value interface{} +} + +// New creates a new Cache. +// If maxEntries is zero, the cache has no limit and it's assumed +// that eviction is done by the caller. +func New(maxEntries int) *Cache { + return &Cache{ + MaxEntries: maxEntries, + ll: list.New(), + cache: make(map[interface{}]*list.Element), + } +} + +// Add adds a value to the cache. +func (c *Cache) Add(key Key, value interface{}) { + if c.cache == nil { + c.cache = make(map[interface{}]*list.Element) + c.ll = list.New() + } + if ee, ok := c.cache[key]; ok { + c.ll.MoveToFront(ee) + ee.Value.(*entry).value = value + return + } + ele := c.ll.PushFront(&entry{key, value}) + c.cache[key] = ele + if c.MaxEntries != 0 && c.ll.Len() > c.MaxEntries { + c.RemoveOldest() + } +} + +// Get looks up a key's value from the cache. +func (c *Cache) Get(key Key) (value interface{}, ok bool) { + if c.cache == nil { + return + } + if ele, hit := c.cache[key]; hit { + c.ll.MoveToFront(ele) + return ele.Value.(*entry).value, true + } + return +} + +// Remove removes the provided key from the cache. +func (c *Cache) Remove(key Key) { + if c.cache == nil { + return + } + if ele, hit := c.cache[key]; hit { + c.removeElement(ele) + } +} + +// RemoveOldest removes the oldest item from the cache. +func (c *Cache) RemoveOldest() { + if c.cache == nil { + return + } + ele := c.ll.Back() + if ele != nil { + c.removeElement(ele) + } +} + +func (c *Cache) removeElement(e *list.Element) { + c.ll.Remove(e) + kv := e.Value.(*entry) + delete(c.cache, kv.key) + if c.OnEvicted != nil { + c.OnEvicted(kv.key, kv.value) + } +} + +// Len returns the number of items in the cache. +func (c *Cache) Len() int { + if c.cache == nil { + return 0 + } + return c.ll.Len() +} + +// Clear purges all stored items from the cache. +func (c *Cache) Clear() { + if c.OnEvicted != nil { + for _, e := range c.cache { + kv := e.Value.(*entry) + c.OnEvicted(kv.key, kv.value) + } + } + c.ll = nil + c.cache = nil +} diff --git a/vendor/github.com/golang/groupcache/lru/lru_test.go b/vendor/github.com/golang/groupcache/lru/lru_test.go new file mode 100644 index 000000000..a14f439e8 --- /dev/null +++ b/vendor/github.com/golang/groupcache/lru/lru_test.go @@ -0,0 +1,97 @@ +/* +Copyright 2013 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. +*/ + +package lru + +import ( + "fmt" + "testing" +) + +type simpleStruct struct { + int + string +} + +type complexStruct struct { + int + simpleStruct +} + +var getTests = []struct { + name string + keyToAdd interface{} + keyToGet interface{} + expectedOk bool +}{ + {"string_hit", "myKey", "myKey", true}, + {"string_miss", "myKey", "nonsense", false}, + {"simple_struct_hit", simpleStruct{1, "two"}, simpleStruct{1, "two"}, true}, + {"simple_struct_miss", simpleStruct{1, "two"}, simpleStruct{0, "noway"}, false}, + {"complex_struct_hit", complexStruct{1, simpleStruct{2, "three"}}, + complexStruct{1, simpleStruct{2, "three"}}, true}, +} + +func TestGet(t *testing.T) { + for _, tt := range getTests { + lru := New(0) + lru.Add(tt.keyToAdd, 1234) + val, ok := lru.Get(tt.keyToGet) + if ok != tt.expectedOk { + t.Fatalf("%s: cache hit = %v; want %v", tt.name, ok, !ok) + } else if ok && val != 1234 { + t.Fatalf("%s expected get to return 1234 but got %v", tt.name, val) + } + } +} + +func TestRemove(t *testing.T) { + lru := New(0) + lru.Add("myKey", 1234) + if val, ok := lru.Get("myKey"); !ok { + t.Fatal("TestRemove returned no match") + } else if val != 1234 { + t.Fatalf("TestRemove failed. Expected %d, got %v", 1234, val) + } + + lru.Remove("myKey") + if _, ok := lru.Get("myKey"); ok { + t.Fatal("TestRemove returned a removed entry") + } +} + +func TestEvict(t *testing.T) { + evictedKeys := make([]Key, 0) + onEvictedFun := func(key Key, value interface{}) { + evictedKeys = append(evictedKeys, key) + } + + lru := New(20) + lru.OnEvicted = onEvictedFun + for i := 0; i < 22; i++ { + lru.Add(fmt.Sprintf("myKey%d", i), 1234) + } + + if len(evictedKeys) != 2 { + t.Fatalf("got %d evicted keys; want 2", len(evictedKeys)) + } + if evictedKeys[0] != Key("myKey0") { + t.Fatalf("got %v in first evicted key; want %s", evictedKeys[0], "myKey0") + } + if evictedKeys[1] != Key("myKey1") { + t.Fatalf("got %v in second evicted key; want %s", evictedKeys[1], "myKey1") + } +} diff --git a/vendor/github.com/golang/groupcache/peers.go b/vendor/github.com/golang/groupcache/peers.go new file mode 100644 index 000000000..1625ff043 --- /dev/null +++ b/vendor/github.com/golang/groupcache/peers.go @@ -0,0 +1,85 @@ +/* +Copyright 2012 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. +*/ + +// peers.go defines how processes find and communicate with their peers. + +package groupcache + +import ( + pb "github.com/golang/groupcache/groupcachepb" +) + +// Context is an opaque value passed through calls to the +// ProtoGetter. It may be nil if your ProtoGetter implementation does +// not require a context. +type Context interface{} + +// ProtoGetter is the interface that must be implemented by a peer. +type ProtoGetter interface { + Get(context Context, in *pb.GetRequest, out *pb.GetResponse) error +} + +// PeerPicker is the interface that must be implemented to locate +// the peer that owns a specific key. +type PeerPicker interface { + // PickPeer returns the peer that owns the specific key + // and true to indicate that a remote peer was nominated. + // It returns nil, false if the key owner is the current peer. + PickPeer(key string) (peer ProtoGetter, ok bool) +} + +// NoPeers is an implementation of PeerPicker that never finds a peer. +type NoPeers struct{} + +func (NoPeers) PickPeer(key string) (peer ProtoGetter, ok bool) { return } + +var ( + portPicker func(groupName string) PeerPicker +) + +// RegisterPeerPicker registers the peer initialization function. +// It is called once, when the first group is created. +// Either RegisterPeerPicker or RegisterPerGroupPeerPicker should be +// called exactly once, but not both. +func RegisterPeerPicker(fn func() PeerPicker) { + if portPicker != nil { + panic("RegisterPeerPicker called more than once") + } + portPicker = func(_ string) PeerPicker { return fn() } +} + +// RegisterPerGroupPeerPicker registers the peer initialization function, +// which takes the groupName, to be used in choosing a PeerPicker. +// It is called once, when the first group is created. +// Either RegisterPeerPicker or RegisterPerGroupPeerPicker should be +// called exactly once, but not both. +func RegisterPerGroupPeerPicker(fn func(groupName string) PeerPicker) { + if portPicker != nil { + panic("RegisterPeerPicker called more than once") + } + portPicker = fn +} + +func getPeers(groupName string) PeerPicker { + if portPicker == nil { + return NoPeers{} + } + pk := portPicker(groupName) + if pk == nil { + pk = NoPeers{} + } + return pk +} diff --git a/vendor/github.com/golang/groupcache/singleflight/singleflight.go b/vendor/github.com/golang/groupcache/singleflight/singleflight.go new file mode 100644 index 000000000..ff2c2ee4f --- /dev/null +++ b/vendor/github.com/golang/groupcache/singleflight/singleflight.go @@ -0,0 +1,64 @@ +/* +Copyright 2012 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. +*/ + +// Package singleflight provides a duplicate function call suppression +// mechanism. +package singleflight + +import "sync" + +// call is an in-flight or completed Do call +type call struct { + wg sync.WaitGroup + val interface{} + err error +} + +// Group represents a class of work and forms a namespace in which +// units of work can be executed with duplicate suppression. +type Group struct { + mu sync.Mutex // protects m + m map[string]*call // lazily initialized +} + +// Do executes and returns the results of the given function, making +// sure that only one execution is in-flight for a given key at a +// time. If a duplicate comes in, the duplicate caller waits for the +// original to complete and receives the same results. +func (g *Group) Do(key string, fn func() (interface{}, error)) (interface{}, error) { + g.mu.Lock() + if g.m == nil { + g.m = make(map[string]*call) + } + if c, ok := g.m[key]; ok { + g.mu.Unlock() + c.wg.Wait() + return c.val, c.err + } + c := new(call) + c.wg.Add(1) + g.m[key] = c + g.mu.Unlock() + + c.val, c.err = fn() + c.wg.Done() + + g.mu.Lock() + delete(g.m, key) + g.mu.Unlock() + + return c.val, c.err +} diff --git a/vendor/github.com/golang/groupcache/singleflight/singleflight_test.go b/vendor/github.com/golang/groupcache/singleflight/singleflight_test.go new file mode 100644 index 000000000..47b4d3dc0 --- /dev/null +++ b/vendor/github.com/golang/groupcache/singleflight/singleflight_test.go @@ -0,0 +1,85 @@ +/* +Copyright 2012 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. +*/ + +package singleflight + +import ( + "errors" + "fmt" + "sync" + "sync/atomic" + "testing" + "time" +) + +func TestDo(t *testing.T) { + var g Group + v, err := g.Do("key", func() (interface{}, error) { + return "bar", nil + }) + if got, want := fmt.Sprintf("%v (%T)", v, v), "bar (string)"; got != want { + t.Errorf("Do = %v; want %v", got, want) + } + if err != nil { + t.Errorf("Do error = %v", err) + } +} + +func TestDoErr(t *testing.T) { + var g Group + someErr := errors.New("Some error") + v, err := g.Do("key", func() (interface{}, error) { + return nil, someErr + }) + if err != someErr { + t.Errorf("Do error = %v; want someErr", err) + } + if v != nil { + t.Errorf("unexpected non-nil value %#v", v) + } +} + +func TestDoDupSuppress(t *testing.T) { + var g Group + c := make(chan string) + var calls int32 + fn := func() (interface{}, error) { + atomic.AddInt32(&calls, 1) + return <-c, nil + } + + const n = 10 + var wg sync.WaitGroup + for i := 0; i < n; i++ { + wg.Add(1) + go func() { + v, err := g.Do("key", fn) + if err != nil { + t.Errorf("Do error: %v", err) + } + if v.(string) != "bar" { + t.Errorf("got %q; want %q", v, "bar") + } + wg.Done() + }() + } + time.Sleep(100 * time.Millisecond) // let goroutines above block + c <- "bar" + wg.Wait() + if got := atomic.LoadInt32(&calls); got != 1 { + t.Errorf("number of calls = %d; want 1", got) + } +} diff --git a/vendor/github.com/golang/groupcache/sinks.go b/vendor/github.com/golang/groupcache/sinks.go new file mode 100644 index 000000000..6c0b8be5c --- /dev/null +++ b/vendor/github.com/golang/groupcache/sinks.go @@ -0,0 +1,322 @@ +/* +Copyright 2012 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. +*/ + +package groupcache + +import ( + "errors" + + "github.com/golang/protobuf/proto" +) + +// A Sink receives data from a Get call. +// +// Implementation of Getter must call exactly one of the Set methods +// on success. +type Sink interface { + // SetString sets the value to s. + SetString(s string) error + + // SetBytes sets the value to the contents of v. + // The caller retains ownership of v. + SetBytes(v []byte) error + + // SetProto sets the value to the encoded version of m. + // The caller retains ownership of m. + SetProto(m proto.Message) error + + // view returns a frozen view of the bytes for caching. + view() (ByteView, error) +} + +func cloneBytes(b []byte) []byte { + c := make([]byte, len(b)) + copy(c, b) + return c +} + +func setSinkView(s Sink, v ByteView) error { + // A viewSetter is a Sink that can also receive its value from + // a ByteView. This is a fast path to minimize copies when the + // item was already cached locally in memory (where it's + // cached as a ByteView) + type viewSetter interface { + setView(v ByteView) error + } + if vs, ok := s.(viewSetter); ok { + return vs.setView(v) + } + if v.b != nil { + return s.SetBytes(v.b) + } + return s.SetString(v.s) +} + +// StringSink returns a Sink that populates the provided string pointer. +func StringSink(sp *string) Sink { + return &stringSink{sp: sp} +} + +type stringSink struct { + sp *string + v ByteView + // TODO(bradfitz): track whether any Sets were called. +} + +func (s *stringSink) view() (ByteView, error) { + // TODO(bradfitz): return an error if no Set was called + return s.v, nil +} + +func (s *stringSink) SetString(v string) error { + s.v.b = nil + s.v.s = v + *s.sp = v + return nil +} + +func (s *stringSink) SetBytes(v []byte) error { + return s.SetString(string(v)) +} + +func (s *stringSink) SetProto(m proto.Message) error { + b, err := proto.Marshal(m) + if err != nil { + return err + } + s.v.b = b + *s.sp = string(b) + return nil +} + +// ByteViewSink returns a Sink that populates a ByteView. +func ByteViewSink(dst *ByteView) Sink { + if dst == nil { + panic("nil dst") + } + return &byteViewSink{dst: dst} +} + +type byteViewSink struct { + dst *ByteView + + // if this code ever ends up tracking that at least one set* + // method was called, don't make it an error to call set + // methods multiple times. Lorry's payload.go does that, and + // it makes sense. The comment at the top of this file about + // "exactly one of the Set methods" is overly strict. We + // really care about at least once (in a handler), but if + // multiple handlers fail (or multiple functions in a program + // using a Sink), it's okay to re-use the same one. +} + +func (s *byteViewSink) setView(v ByteView) error { + *s.dst = v + return nil +} + +func (s *byteViewSink) view() (ByteView, error) { + return *s.dst, nil +} + +func (s *byteViewSink) SetProto(m proto.Message) error { + b, err := proto.Marshal(m) + if err != nil { + return err + } + *s.dst = ByteView{b: b} + return nil +} + +func (s *byteViewSink) SetBytes(b []byte) error { + *s.dst = ByteView{b: cloneBytes(b)} + return nil +} + +func (s *byteViewSink) SetString(v string) error { + *s.dst = ByteView{s: v} + return nil +} + +// ProtoSink returns a sink that unmarshals binary proto values into m. +func ProtoSink(m proto.Message) Sink { + return &protoSink{ + dst: m, + } +} + +type protoSink struct { + dst proto.Message // authoritative value + typ string + + v ByteView // encoded +} + +func (s *protoSink) view() (ByteView, error) { + return s.v, nil +} + +func (s *protoSink) SetBytes(b []byte) error { + err := proto.Unmarshal(b, s.dst) + if err != nil { + return err + } + s.v.b = cloneBytes(b) + s.v.s = "" + return nil +} + +func (s *protoSink) SetString(v string) error { + b := []byte(v) + err := proto.Unmarshal(b, s.dst) + if err != nil { + return err + } + s.v.b = b + s.v.s = "" + return nil +} + +func (s *protoSink) SetProto(m proto.Message) error { + b, err := proto.Marshal(m) + if err != nil { + return err + } + // TODO(bradfitz): optimize for same-task case more and write + // right through? would need to document ownership rules at + // the same time. but then we could just assign *dst = *m + // here. This works for now: + err = proto.Unmarshal(b, s.dst) + if err != nil { + return err + } + s.v.b = b + s.v.s = "" + return nil +} + +// AllocatingByteSliceSink returns a Sink that allocates +// a byte slice to hold the received value and assigns +// it to *dst. The memory is not retained by groupcache. +func AllocatingByteSliceSink(dst *[]byte) Sink { + return &allocBytesSink{dst: dst} +} + +type allocBytesSink struct { + dst *[]byte + v ByteView +} + +func (s *allocBytesSink) view() (ByteView, error) { + return s.v, nil +} + +func (s *allocBytesSink) setView(v ByteView) error { + if v.b != nil { + *s.dst = cloneBytes(v.b) + } else { + *s.dst = []byte(v.s) + } + s.v = v + return nil +} + +func (s *allocBytesSink) SetProto(m proto.Message) error { + b, err := proto.Marshal(m) + if err != nil { + return err + } + return s.setBytesOwned(b) +} + +func (s *allocBytesSink) SetBytes(b []byte) error { + return s.setBytesOwned(cloneBytes(b)) +} + +func (s *allocBytesSink) setBytesOwned(b []byte) error { + if s.dst == nil { + return errors.New("nil AllocatingByteSliceSink *[]byte dst") + } + *s.dst = cloneBytes(b) // another copy, protecting the read-only s.v.b view + s.v.b = b + s.v.s = "" + return nil +} + +func (s *allocBytesSink) SetString(v string) error { + if s.dst == nil { + return errors.New("nil AllocatingByteSliceSink *[]byte dst") + } + *s.dst = []byte(v) + s.v.b = nil + s.v.s = v + return nil +} + +// TruncatingByteSliceSink returns a Sink that writes up to len(*dst) +// bytes to *dst. If more bytes are available, they're silently +// truncated. If fewer bytes are available than len(*dst), *dst +// is shrunk to fit the number of bytes available. +func TruncatingByteSliceSink(dst *[]byte) Sink { + return &truncBytesSink{dst: dst} +} + +type truncBytesSink struct { + dst *[]byte + v ByteView +} + +func (s *truncBytesSink) view() (ByteView, error) { + return s.v, nil +} + +func (s *truncBytesSink) SetProto(m proto.Message) error { + b, err := proto.Marshal(m) + if err != nil { + return err + } + return s.setBytesOwned(b) +} + +func (s *truncBytesSink) SetBytes(b []byte) error { + return s.setBytesOwned(cloneBytes(b)) +} + +func (s *truncBytesSink) setBytesOwned(b []byte) error { + if s.dst == nil { + return errors.New("nil TruncatingByteSliceSink *[]byte dst") + } + n := copy(*s.dst, b) + if n < len(*s.dst) { + *s.dst = (*s.dst)[:n] + } + s.v.b = b + s.v.s = "" + return nil +} + +func (s *truncBytesSink) SetString(v string) error { + if s.dst == nil { + return errors.New("nil TruncatingByteSliceSink *[]byte dst") + } + n := copy(*s.dst, v) + if n < len(*s.dst) { + *s.dst = (*s.dst)[:n] + } + s.v.b = nil + s.v.s = v + return nil +} diff --git a/vendor/github.com/golang/groupcache/testpb/test.pb.go b/vendor/github.com/golang/groupcache/testpb/test.pb.go new file mode 100644 index 000000000..038040d15 --- /dev/null +++ b/vendor/github.com/golang/groupcache/testpb/test.pb.go @@ -0,0 +1,235 @@ +// Code generated by protoc-gen-go. +// source: test.proto +// DO NOT EDIT! + +package testpb + +import proto "github.com/golang/protobuf/proto" +import json "encoding/json" +import math "math" + +// Reference proto, json, and math imports to suppress error if they are not otherwise used. +var _ = proto.Marshal +var _ = &json.SyntaxError{} +var _ = math.Inf + +type TestMessage struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + City *string `protobuf:"bytes,2,opt,name=city" json:"city,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *TestMessage) Reset() { *m = TestMessage{} } +func (m *TestMessage) String() string { return proto.CompactTextString(m) } +func (*TestMessage) ProtoMessage() {} + +func (m *TestMessage) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *TestMessage) GetCity() string { + if m != nil && m.City != nil { + return *m.City + } + return "" +} + +type TestRequest struct { + Lower *string `protobuf:"bytes,1,req,name=lower" json:"lower,omitempty"` + RepeatCount *int32 `protobuf:"varint,2,opt,name=repeat_count,def=1" json:"repeat_count,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *TestRequest) Reset() { *m = TestRequest{} } +func (m *TestRequest) String() string { return proto.CompactTextString(m) } +func (*TestRequest) ProtoMessage() {} + +const Default_TestRequest_RepeatCount int32 = 1 + +func (m *TestRequest) GetLower() string { + if m != nil && m.Lower != nil { + return *m.Lower + } + return "" +} + +func (m *TestRequest) GetRepeatCount() int32 { + if m != nil && m.RepeatCount != nil { + return *m.RepeatCount + } + return Default_TestRequest_RepeatCount +} + +type TestResponse struct { + Value *string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *TestResponse) Reset() { *m = TestResponse{} } +func (m *TestResponse) String() string { return proto.CompactTextString(m) } +func (*TestResponse) ProtoMessage() {} + +func (m *TestResponse) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type CacheStats struct { + Items *int64 `protobuf:"varint,1,opt,name=items" json:"items,omitempty"` + Bytes *int64 `protobuf:"varint,2,opt,name=bytes" json:"bytes,omitempty"` + Gets *int64 `protobuf:"varint,3,opt,name=gets" json:"gets,omitempty"` + Hits *int64 `protobuf:"varint,4,opt,name=hits" json:"hits,omitempty"` + Evicts *int64 `protobuf:"varint,5,opt,name=evicts" json:"evicts,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CacheStats) Reset() { *m = CacheStats{} } +func (m *CacheStats) String() string { return proto.CompactTextString(m) } +func (*CacheStats) ProtoMessage() {} + +func (m *CacheStats) GetItems() int64 { + if m != nil && m.Items != nil { + return *m.Items + } + return 0 +} + +func (m *CacheStats) GetBytes() int64 { + if m != nil && m.Bytes != nil { + return *m.Bytes + } + return 0 +} + +func (m *CacheStats) GetGets() int64 { + if m != nil && m.Gets != nil { + return *m.Gets + } + return 0 +} + +func (m *CacheStats) GetHits() int64 { + if m != nil && m.Hits != nil { + return *m.Hits + } + return 0 +} + +func (m *CacheStats) GetEvicts() int64 { + if m != nil && m.Evicts != nil { + return *m.Evicts + } + return 0 +} + +type StatsResponse struct { + Gets *int64 `protobuf:"varint,1,opt,name=gets" json:"gets,omitempty"` + CacheHits *int64 `protobuf:"varint,12,opt,name=cache_hits" json:"cache_hits,omitempty"` + Fills *int64 `protobuf:"varint,2,opt,name=fills" json:"fills,omitempty"` + TotalAlloc *uint64 `protobuf:"varint,3,opt,name=total_alloc" json:"total_alloc,omitempty"` + MainCache *CacheStats `protobuf:"bytes,4,opt,name=main_cache" json:"main_cache,omitempty"` + HotCache *CacheStats `protobuf:"bytes,5,opt,name=hot_cache" json:"hot_cache,omitempty"` + ServerIn *int64 `protobuf:"varint,6,opt,name=server_in" json:"server_in,omitempty"` + Loads *int64 `protobuf:"varint,8,opt,name=loads" json:"loads,omitempty"` + PeerLoads *int64 `protobuf:"varint,9,opt,name=peer_loads" json:"peer_loads,omitempty"` + PeerErrors *int64 `protobuf:"varint,10,opt,name=peer_errors" json:"peer_errors,omitempty"` + LocalLoads *int64 `protobuf:"varint,11,opt,name=local_loads" json:"local_loads,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *StatsResponse) Reset() { *m = StatsResponse{} } +func (m *StatsResponse) String() string { return proto.CompactTextString(m) } +func (*StatsResponse) ProtoMessage() {} + +func (m *StatsResponse) GetGets() int64 { + if m != nil && m.Gets != nil { + return *m.Gets + } + return 0 +} + +func (m *StatsResponse) GetCacheHits() int64 { + if m != nil && m.CacheHits != nil { + return *m.CacheHits + } + return 0 +} + +func (m *StatsResponse) GetFills() int64 { + if m != nil && m.Fills != nil { + return *m.Fills + } + return 0 +} + +func (m *StatsResponse) GetTotalAlloc() uint64 { + if m != nil && m.TotalAlloc != nil { + return *m.TotalAlloc + } + return 0 +} + +func (m *StatsResponse) GetMainCache() *CacheStats { + if m != nil { + return m.MainCache + } + return nil +} + +func (m *StatsResponse) GetHotCache() *CacheStats { + if m != nil { + return m.HotCache + } + return nil +} + +func (m *StatsResponse) GetServerIn() int64 { + if m != nil && m.ServerIn != nil { + return *m.ServerIn + } + return 0 +} + +func (m *StatsResponse) GetLoads() int64 { + if m != nil && m.Loads != nil { + return *m.Loads + } + return 0 +} + +func (m *StatsResponse) GetPeerLoads() int64 { + if m != nil && m.PeerLoads != nil { + return *m.PeerLoads + } + return 0 +} + +func (m *StatsResponse) GetPeerErrors() int64 { + if m != nil && m.PeerErrors != nil { + return *m.PeerErrors + } + return 0 +} + +func (m *StatsResponse) GetLocalLoads() int64 { + if m != nil && m.LocalLoads != nil { + return *m.LocalLoads + } + return 0 +} + +type Empty struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} + +func init() { +} diff --git a/vendor/github.com/golang/groupcache/testpb/test.proto b/vendor/github.com/golang/groupcache/testpb/test.proto new file mode 100644 index 000000000..b9dc6c9a0 --- /dev/null +++ b/vendor/github.com/golang/groupcache/testpb/test.proto @@ -0,0 +1,63 @@ +/* +Copyright 2012 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. +*/ + +syntax = "proto2"; + +package testpb; + +message TestMessage { + optional string name = 1; + optional string city = 2; +} + +message TestRequest { + required string lower = 1; // to be returned upper case + optional int32 repeat_count = 2 [default = 1]; // .. this many times +} + +message TestResponse { + optional string value = 1; +} + +message CacheStats { + optional int64 items = 1; + optional int64 bytes = 2; + optional int64 gets = 3; + optional int64 hits = 4; + optional int64 evicts = 5; +} + +message StatsResponse { + optional int64 gets = 1; + optional int64 cache_hits = 12; + optional int64 fills = 2; + optional uint64 total_alloc = 3; + optional CacheStats main_cache = 4; + optional CacheStats hot_cache = 5; + optional int64 server_in = 6; + optional int64 loads = 8; + optional int64 peer_loads = 9; + optional int64 peer_errors = 10; + optional int64 local_loads = 11; +} + +message Empty {} + +service GroupCacheTest { + rpc InitPeers(Empty) returns (Empty) {}; + rpc Get(TestRequest) returns (TestResponse) {}; + rpc GetStats(Empty) returns (StatsResponse) {}; +} diff --git a/vendor/github.com/google/uuid/.travis.yml b/vendor/github.com/google/uuid/.travis.yml new file mode 100644 index 000000000..d8156a60b --- /dev/null +++ b/vendor/github.com/google/uuid/.travis.yml @@ -0,0 +1,9 @@ +language: go + +go: + - 1.4.3 + - 1.5.3 + - tip + +script: + - go test -v ./... diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md new file mode 100644 index 000000000..04fdf09f1 --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to contribute + +We definitely welcome patches and contribution to this project! + +### Legal requirements + +In order to protect both you and ourselves, you will need to sign the +[Contributor License Agreement](https://cla.developers.google.com/clas). + +You may have already signed it for other Google projects. diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS new file mode 100644 index 000000000..b4bb97f6b --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTORS @@ -0,0 +1,9 @@ +Paul Borman +bmatsuo +shawnps +theory +jboverfelt +dsymonds +cd1 +wallclockbuilder +dansouza diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE new file mode 100644 index 000000000..5dc68268d --- /dev/null +++ b/vendor/github.com/google/uuid/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009,2014 Google 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 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/google/uuid/README.md b/vendor/github.com/google/uuid/README.md new file mode 100644 index 000000000..9d92c11f1 --- /dev/null +++ b/vendor/github.com/google/uuid/README.md @@ -0,0 +1,19 @@ +# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) +The uuid package generates and inspects UUIDs based on +[RFC 4122](http://tools.ietf.org/html/rfc4122) +and DCE 1.1: Authentication and Security Services. + +This package is based on the github.com/pborman/uuid package (previously named +code.google.com/p/go-uuid). It differs from these earlier packages in that +a UUID is a 16 byte array rather than a byte slice. One loss due to this +change is the ability to represent an invalid UUID (vs a NIL UUID). + +###### Install +`go get github.com/google/uuid` + +###### Documentation +[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) + +Full `go doc` style documentation for the package can be viewed online without +installing this package by using the GoDoc site here: +http://godoc.org/github.com/google/uuid diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go new file mode 100644 index 000000000..fa820b9d3 --- /dev/null +++ b/vendor/github.com/google/uuid/dce.go @@ -0,0 +1,80 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "fmt" + "os" +) + +// A Domain represents a Version 2 domain +type Domain byte + +// Domain constants for DCE Security (Version 2) UUIDs. +const ( + Person = Domain(0) + Group = Domain(1) + Org = Domain(2) +) + +// NewDCESecurity returns a DCE Security (Version 2) UUID. +// +// The domain should be one of Person, Group or Org. +// On a POSIX system the id should be the users UID for the Person +// domain and the users GID for the Group. The meaning of id for +// the domain Org or on non-POSIX systems is site defined. +// +// For a given domain/id pair the same token may be returned for up to +// 7 minutes and 10 seconds. +func NewDCESecurity(domain Domain, id uint32) (UUID, error) { + uuid, err := NewUUID() + if err == nil { + uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 + uuid[9] = byte(domain) + binary.BigEndian.PutUint32(uuid[0:], id) + } + return uuid, err +} + +// NewDCEPerson returns a DCE Security (Version 2) UUID in the person +// domain with the id returned by os.Getuid. +// +// NewDCESecurity(Person, uint32(os.Getuid())) +func NewDCEPerson() (UUID, error) { + return NewDCESecurity(Person, uint32(os.Getuid())) +} + +// NewDCEGroup returns a DCE Security (Version 2) UUID in the group +// domain with the id returned by os.Getgid. +// +// NewDCESecurity(Group, uint32(os.Getgid())) +func NewDCEGroup() (UUID, error) { + return NewDCESecurity(Group, uint32(os.Getgid())) +} + +// Domain returns the domain for a Version 2 UUID. Domains are only defined +// for Version 2 UUIDs. +func (uuid UUID) Domain() Domain { + return Domain(uuid[9]) +} + +// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 +// UUIDs. +func (uuid UUID) ID() uint32 { + return binary.BigEndian.Uint32(uuid[0:4]) +} + +func (d Domain) String() string { + switch d { + case Person: + return "Person" + case Group: + return "Group" + case Org: + return "Org" + } + return fmt.Sprintf("Domain%d", int(d)) +} diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go new file mode 100644 index 000000000..5b8a4b9af --- /dev/null +++ b/vendor/github.com/google/uuid/doc.go @@ -0,0 +1,12 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package uuid generates and inspects UUIDs. +// +// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security +// Services. +// +// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to +// maps or compared directly. +package uuid diff --git a/vendor/github.com/google/uuid/go.mod b/vendor/github.com/google/uuid/go.mod new file mode 100644 index 000000000..fc84cd79d --- /dev/null +++ b/vendor/github.com/google/uuid/go.mod @@ -0,0 +1 @@ +module github.com/google/uuid diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go new file mode 100644 index 000000000..b17461631 --- /dev/null +++ b/vendor/github.com/google/uuid/hash.go @@ -0,0 +1,53 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "crypto/md5" + "crypto/sha1" + "hash" +) + +// Well known namespace IDs and UUIDs +var ( + NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) + Nil UUID // empty UUID, all zeros +) + +// NewHash returns a new UUID derived from the hash of space concatenated with +// data generated by h. The hash should be at least 16 byte in length. The +// first 16 bytes of the hash are used to form the UUID. The version of the +// UUID will be the lower 4 bits of version. NewHash is used to implement +// NewMD5 and NewSHA1. +func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { + h.Reset() + h.Write(space[:]) + h.Write(data) + s := h.Sum(nil) + var uuid UUID + copy(uuid[:], s) + uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) + uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant + return uuid +} + +// NewMD5 returns a new MD5 (Version 3) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(md5.New(), space, data, 3) +func NewMD5(space UUID, data []byte) UUID { + return NewHash(md5.New(), space, data, 3) +} + +// NewSHA1 returns a new SHA1 (Version 5) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(sha1.New(), space, data, 5) +func NewSHA1(space UUID, data []byte) UUID { + return NewHash(sha1.New(), space, data, 5) +} diff --git a/vendor/github.com/google/uuid/json_test.go b/vendor/github.com/google/uuid/json_test.go new file mode 100644 index 000000000..245f91edf --- /dev/null +++ b/vendor/github.com/google/uuid/json_test.go @@ -0,0 +1,62 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/json" + "reflect" + "testing" +) + +var testUUID = Must(Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")) + +func TestJSON(t *testing.T) { + type S struct { + ID1 UUID + ID2 UUID + } + s1 := S{ID1: testUUID} + data, err := json.Marshal(&s1) + if err != nil { + t.Fatal(err) + } + var s2 S + if err := json.Unmarshal(data, &s2); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(&s1, &s2) { + t.Errorf("got %#v, want %#v", s2, s1) + } +} + +func BenchmarkUUID_MarshalJSON(b *testing.B) { + x := &struct { + UUID UUID `json:"uuid"` + }{} + var err error + x.UUID, err = Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if err != nil { + b.Fatal(err) + } + for i := 0; i < b.N; i++ { + js, err := json.Marshal(x) + if err != nil { + b.Fatalf("marshal json: %#v (%v)", js, err) + } + } +} + +func BenchmarkUUID_UnmarshalJSON(b *testing.B) { + js := []byte(`{"uuid":"f47ac10b-58cc-0372-8567-0e02b2c3d479"}`) + var x *struct { + UUID UUID `json:"uuid"` + } + for i := 0; i < b.N; i++ { + err := json.Unmarshal(js, &x) + if err != nil { + b.Fatalf("marshal json: %#v (%v)", js, err) + } + } +} diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go new file mode 100644 index 000000000..7f9e0c6c0 --- /dev/null +++ b/vendor/github.com/google/uuid/marshal.go @@ -0,0 +1,37 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "fmt" + +// MarshalText implements encoding.TextMarshaler. +func (uuid UUID) MarshalText() ([]byte, error) { + var js [36]byte + encodeHex(js[:], uuid) + return js[:], nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (uuid *UUID) UnmarshalText(data []byte) error { + id, err := ParseBytes(data) + if err == nil { + *uuid = id + } + return err +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (uuid UUID) MarshalBinary() ([]byte, error) { + return uuid[:], nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (uuid *UUID) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(uuid[:], data) + return nil +} diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go new file mode 100644 index 000000000..3e4e90dc4 --- /dev/null +++ b/vendor/github.com/google/uuid/node.go @@ -0,0 +1,89 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "sync" +) + +var ( + nodeMu sync.Mutex + ifname string // name of interface being used + nodeID [6]byte // hardware for version 1 UUIDs + zeroID [6]byte // nodeID with only 0's +) + +// NodeInterface returns the name of the interface from which the NodeID was +// derived. The interface "user" is returned if the NodeID was set by +// SetNodeID. +func NodeInterface() string { + defer nodeMu.Unlock() + nodeMu.Lock() + return ifname +} + +// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. +// If name is "" then the first usable interface found will be used or a random +// Node ID will be generated. If a named interface cannot be found then false +// is returned. +// +// SetNodeInterface never fails when name is "". +func SetNodeInterface(name string) bool { + defer nodeMu.Unlock() + nodeMu.Lock() + return setNodeInterface(name) +} + +func setNodeInterface(name string) bool { + iname, addr := getHardwareInterface(name) // null implementation for js + if iname != "" && addr != nil { + ifname = iname + copy(nodeID[:], addr) + return true + } + + // We found no interfaces with a valid hardware address. If name + // does not specify a specific interface generate a random Node ID + // (section 4.1.6) + if name == "" { + randomBits(nodeID[:]) + return true + } + return false +} + +// NodeID returns a slice of a copy of the current Node ID, setting the Node ID +// if not already set. +func NodeID() []byte { + defer nodeMu.Unlock() + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + nid := nodeID + return nid[:] +} + +// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes +// of id are used. If id is less than 6 bytes then false is returned and the +// Node ID is not set. +func SetNodeID(id []byte) bool { + if len(id) < 6 { + return false + } + defer nodeMu.Unlock() + nodeMu.Lock() + copy(nodeID[:], id) + ifname = "user" + return true +} + +// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is +// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) NodeID() []byte { + var node [6]byte + copy(node[:], uuid[10:]) + return node[:] +} diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go new file mode 100644 index 000000000..24b78edc9 --- /dev/null +++ b/vendor/github.com/google/uuid/node_js.go @@ -0,0 +1,12 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build js + +package uuid + +// getHardwareInterface returns nil values for the JS version of the code. +// This remvoves the "net" dependency, because it is not used in the browser. +// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. +func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go new file mode 100644 index 000000000..0cbbcddbd --- /dev/null +++ b/vendor/github.com/google/uuid/node_net.go @@ -0,0 +1,33 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !js + +package uuid + +import "net" + +var interfaces []net.Interface // cached list of interfaces + +// getHardwareInterface returns the name and hardware address of interface name. +// If name is "" then the name and hardware address of one of the system's +// interfaces is returned. If no interfaces are found (name does not exist or +// there are no interfaces) then "", nil is returned. +// +// Only addresses of at least 6 bytes are returned. +func getHardwareInterface(name string) (string, []byte) { + if interfaces == nil { + var err error + interfaces, err = net.Interfaces() + if err != nil { + return "", nil + } + } + for _, ifs := range interfaces { + if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { + return ifs.Name, ifs.HardwareAddr + } + } + return "", nil +} diff --git a/vendor/github.com/google/uuid/seq_test.go b/vendor/github.com/google/uuid/seq_test.go new file mode 100644 index 000000000..4f6c54912 --- /dev/null +++ b/vendor/github.com/google/uuid/seq_test.go @@ -0,0 +1,66 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "flag" + "runtime" + "testing" + "time" +) + +// This test is only run when --regressions is passed on the go test line. +var regressions = flag.Bool("regressions", false, "run uuid regression tests") + +// TestClockSeqRace tests for a particular race condition of returning two +// identical Version1 UUIDs. The duration of 1 minute was chosen as the race +// condition, before being fixed, nearly always occurred in under 30 seconds. +func TestClockSeqRace(t *testing.T) { + if !*regressions { + t.Skip("skipping regression tests") + } + duration := time.Minute + + done := make(chan struct{}) + defer close(done) + + ch := make(chan UUID, 10000) + ncpu := runtime.NumCPU() + switch ncpu { + case 0, 1: + // We can't run the test effectively. + t.Skip("skipping race test, only one CPU detected") + return + default: + runtime.GOMAXPROCS(ncpu) + } + for i := 0; i < ncpu; i++ { + go func() { + for { + select { + case <-done: + return + case ch <- Must(NewUUID()): + } + } + }() + } + + uuids := make(map[string]bool) + cnt := 0 + start := time.Now() + for u := range ch { + s := u.String() + if uuids[s] { + t.Errorf("duplicate uuid after %d in %v: %s", cnt, time.Since(start), s) + return + } + uuids[s] = true + if time.Since(start) > duration { + return + } + cnt++ + } +} diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go new file mode 100644 index 000000000..f326b54db --- /dev/null +++ b/vendor/github.com/google/uuid/sql.go @@ -0,0 +1,59 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "database/sql/driver" + "fmt" +) + +// Scan implements sql.Scanner so UUIDs can be read from databases transparently +// Currently, database types that map to string and []byte are supported. Please +// consult database-specific driver documentation for matching types. +func (uuid *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case nil: + return nil + + case string: + // if an empty UUID comes from a table, we return a null UUID + if src == "" { + return nil + } + + // see Parse for required string format + u, err := Parse(src) + if err != nil { + return fmt.Errorf("Scan: %v", err) + } + + *uuid = u + + case []byte: + // if an empty UUID comes from a table, we return a null UUID + if len(src) == 0 { + return nil + } + + // assumes a simple slice of bytes if 16 bytes + // otherwise attempts to parse + if len(src) != 16 { + return uuid.Scan(string(src)) + } + copy((*uuid)[:], src) + + default: + return fmt.Errorf("Scan: unable to scan type %T into UUID", src) + } + + return nil +} + +// Value implements sql.Valuer so that UUIDs can be written to databases +// transparently. Currently, UUIDs map to strings. Please consult +// database-specific driver documentation for matching types. +func (uuid UUID) Value() (driver.Value, error) { + return uuid.String(), nil +} diff --git a/vendor/github.com/google/uuid/sql_test.go b/vendor/github.com/google/uuid/sql_test.go new file mode 100644 index 000000000..1803dfd87 --- /dev/null +++ b/vendor/github.com/google/uuid/sql_test.go @@ -0,0 +1,113 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "strings" + "testing" +) + +func TestScan(t *testing.T) { + stringTest := "f47ac10b-58cc-0372-8567-0e02b2c3d479" + badTypeTest := 6 + invalidTest := "f47ac10b-58cc-0372-8567-0e02b2c3d4" + + byteTest := make([]byte, 16) + byteTestUUID := Must(Parse(stringTest)) + copy(byteTest, byteTestUUID[:]) + + // sunny day tests + + var uuid UUID + err := (&uuid).Scan(stringTest) + if err != nil { + t.Fatal(err) + } + + err = (&uuid).Scan([]byte(stringTest)) + if err != nil { + t.Fatal(err) + } + + err = (&uuid).Scan(byteTest) + if err != nil { + t.Fatal(err) + } + + // bad type tests + + err = (&uuid).Scan(badTypeTest) + if err == nil { + t.Error("int correctly parsed and shouldn't have") + } + if !strings.Contains(err.Error(), "unable to scan type") { + t.Error("attempting to parse an int returned an incorrect error message") + } + + // invalid/incomplete uuids + + err = (&uuid).Scan(invalidTest) + if err == nil { + t.Error("invalid uuid was parsed without error") + } + if !strings.Contains(err.Error(), "invalid UUID") { + t.Error("attempting to parse an invalid UUID returned an incorrect error message") + } + + err = (&uuid).Scan(byteTest[:len(byteTest)-2]) + if err == nil { + t.Error("invalid byte uuid was parsed without error") + } + if !strings.Contains(err.Error(), "invalid UUID") { + t.Error("attempting to parse an invalid byte UUID returned an incorrect error message") + } + + // empty tests + + uuid = UUID{} + var emptySlice []byte + err = (&uuid).Scan(emptySlice) + if err != nil { + t.Fatal(err) + } + + for _, v := range uuid { + if v != 0 { + t.Error("UUID was not nil after scanning empty byte slice") + } + } + + uuid = UUID{} + var emptyString string + err = (&uuid).Scan(emptyString) + if err != nil { + t.Fatal(err) + } + for _, v := range uuid { + if v != 0 { + t.Error("UUID was not nil after scanning empty byte slice") + } + } + + uuid = UUID{} + err = (&uuid).Scan(nil) + if err != nil { + t.Fatal(err) + } + for _, v := range uuid { + if v != 0 { + t.Error("UUID was not nil after scanning nil") + } + } +} + +func TestValue(t *testing.T) { + stringTest := "f47ac10b-58cc-0372-8567-0e02b2c3d479" + uuid := Must(Parse(stringTest)) + val, _ := uuid.Value() + if val != stringTest { + t.Error("Value() did not return expected string") + } +} diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go new file mode 100644 index 000000000..e6ef06cdc --- /dev/null +++ b/vendor/github.com/google/uuid/time.go @@ -0,0 +1,123 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "sync" + "time" +) + +// A Time represents a time as the number of 100's of nanoseconds since 15 Oct +// 1582. +type Time int64 + +const ( + lillian = 2299160 // Julian day of 15 Oct 1582 + unix = 2440587 // Julian day of 1 Jan 1970 + epoch = unix - lillian // Days between epochs + g1582 = epoch * 86400 // seconds between epochs + g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs +) + +var ( + timeMu sync.Mutex + lasttime uint64 // last time we returned + clockSeq uint16 // clock sequence for this run + + timeNow = time.Now // for testing +) + +// UnixTime converts t the number of seconds and nanoseconds using the Unix +// epoch of 1 Jan 1970. +func (t Time) UnixTime() (sec, nsec int64) { + sec = int64(t - g1582ns100) + nsec = (sec % 10000000) * 100 + sec /= 10000000 + return sec, nsec +} + +// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and +// clock sequence as well as adjusting the clock sequence as needed. An error +// is returned if the current time cannot be determined. +func GetTime() (Time, uint16, error) { + defer timeMu.Unlock() + timeMu.Lock() + return getTime() +} + +func getTime() (Time, uint16, error) { + t := timeNow() + + // If we don't have a clock sequence already, set one. + if clockSeq == 0 { + setClockSequence(-1) + } + now := uint64(t.UnixNano()/100) + g1582ns100 + + // If time has gone backwards with this clock sequence then we + // increment the clock sequence + if now <= lasttime { + clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 + } + lasttime = now + return Time(now), clockSeq, nil +} + +// ClockSequence returns the current clock sequence, generating one if not +// already set. The clock sequence is only used for Version 1 UUIDs. +// +// The uuid package does not use global static storage for the clock sequence or +// the last time a UUID was generated. Unless SetClockSequence is used, a new +// random clock sequence is generated the first time a clock sequence is +// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) +func ClockSequence() int { + defer timeMu.Unlock() + timeMu.Lock() + return clockSequence() +} + +func clockSequence() int { + if clockSeq == 0 { + setClockSequence(-1) + } + return int(clockSeq & 0x3fff) +} + +// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to +// -1 causes a new sequence to be generated. +func SetClockSequence(seq int) { + defer timeMu.Unlock() + timeMu.Lock() + setClockSequence(seq) +} + +func setClockSequence(seq int) { + if seq == -1 { + var b [2]byte + randomBits(b[:]) // clock sequence + seq = int(b[0])<<8 | int(b[1]) + } + oldSeq := clockSeq + clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant + if oldSeq != clockSeq { + lasttime = 0 + } +} + +// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in +// uuid. The time is only defined for version 1 and 2 UUIDs. +func (uuid UUID) Time() Time { + time := int64(binary.BigEndian.Uint32(uuid[0:4])) + time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 + time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 + return Time(time) +} + +// ClockSequence returns the clock sequence encoded in uuid. +// The clock sequence is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) ClockSequence() int { + return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff +} diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go new file mode 100644 index 000000000..5ea6c7378 --- /dev/null +++ b/vendor/github.com/google/uuid/util.go @@ -0,0 +1,43 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "io" +) + +// randomBits completely fills slice b with random data. +func randomBits(b []byte) { + if _, err := io.ReadFull(rander, b); err != nil { + panic(err.Error()) // rand should never fail + } +} + +// xvalues returns the value of a byte as a hexadecimal digit or 255. +var xvalues = [256]byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, +} + +// xtob converts hex characters x1 and x2 into a byte. +func xtob(x1, x2 byte) (byte, bool) { + b1 := xvalues[x1] + b2 := xvalues[x2] + return (b1 << 4) | b2, b1 != 255 && b2 != 255 +} diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go new file mode 100644 index 000000000..524404cc5 --- /dev/null +++ b/vendor/github.com/google/uuid/uuid.go @@ -0,0 +1,245 @@ +// Copyright 2018 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "io" + "strings" +) + +// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC +// 4122. +type UUID [16]byte + +// A Version represents a UUID's version. +type Version byte + +// A Variant represents a UUID's variant. +type Variant byte + +// Constants returned by Variant. +const ( + Invalid = Variant(iota) // Invalid UUID + RFC4122 // The variant specified in RFC4122 + Reserved // Reserved, NCS backward compatibility. + Microsoft // Reserved, Microsoft Corporation backward compatibility. + Future // Reserved for future definition. +) + +var rander = rand.Reader // random function + +// Parse decodes s into a UUID or returns an error. Both the standard UUID +// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the +// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex +// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. +func Parse(s string) (UUID, error) { + var uuid UUID + switch len(s) { + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36: + + // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: + if strings.ToLower(s[:9]) != "urn:uuid:" { + return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) + } + s = s[9:] + + // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + case 36 + 2: + s = s[1:] + + // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + case 32: + var ok bool + for i := range uuid { + uuid[i], ok = xtob(s[i*2], s[i*2+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, fmt.Errorf("invalid UUID length: %d", len(s)) + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + v, ok := xtob(s[x], s[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// ParseBytes is like Parse, except it parses a byte slice instead of a string. +func ParseBytes(b []byte) (UUID, error) { + var uuid UUID + switch len(b) { + case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { + return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) + } + b = b[9:] + case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + b = b[1:] + case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + var ok bool + for i := 0; i < 32; i += 2 { + uuid[i/2], ok = xtob(b[i], b[i+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, fmt.Errorf("invalid UUID length: %d", len(b)) + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + v, ok := xtob(b[x], b[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// MustParse is like Parse but panics if the string cannot be parsed. +// It simplifies safe initialization of global variables holding compiled UUIDs. +func MustParse(s string) UUID { + uuid, err := Parse(s) + if err != nil { + panic(`uuid: Parse(` + s + `): ` + err.Error()) + } + return uuid +} + +// FromBytes creates a new UUID from a byte slice. Returns an error if the slice +// does not have a length of 16. The bytes are copied from the slice. +func FromBytes(b []byte) (uuid UUID, err error) { + err = uuid.UnmarshalBinary(b) + return uuid, err +} + +// Must returns uuid if err is nil and panics otherwise. +func Must(uuid UUID, err error) UUID { + if err != nil { + panic(err) + } + return uuid +} + +// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// , or "" if uuid is invalid. +func (uuid UUID) String() string { + var buf [36]byte + encodeHex(buf[:], uuid) + return string(buf[:]) +} + +// URN returns the RFC 2141 URN form of uuid, +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. +func (uuid UUID) URN() string { + var buf [36 + 9]byte + copy(buf[:], "urn:uuid:") + encodeHex(buf[9:], uuid) + return string(buf[:]) +} + +func encodeHex(dst []byte, uuid UUID) { + hex.Encode(dst, uuid[:4]) + dst[8] = '-' + hex.Encode(dst[9:13], uuid[4:6]) + dst[13] = '-' + hex.Encode(dst[14:18], uuid[6:8]) + dst[18] = '-' + hex.Encode(dst[19:23], uuid[8:10]) + dst[23] = '-' + hex.Encode(dst[24:], uuid[10:]) +} + +// Variant returns the variant encoded in uuid. +func (uuid UUID) Variant() Variant { + switch { + case (uuid[8] & 0xc0) == 0x80: + return RFC4122 + case (uuid[8] & 0xe0) == 0xc0: + return Microsoft + case (uuid[8] & 0xe0) == 0xe0: + return Future + default: + return Reserved + } +} + +// Version returns the version of uuid. +func (uuid UUID) Version() Version { + return Version(uuid[6] >> 4) +} + +func (v Version) String() string { + if v > 15 { + return fmt.Sprintf("BAD_VERSION_%d", v) + } + return fmt.Sprintf("VERSION_%d", v) +} + +func (v Variant) String() string { + switch v { + case RFC4122: + return "RFC4122" + case Reserved: + return "Reserved" + case Microsoft: + return "Microsoft" + case Future: + return "Future" + case Invalid: + return "Invalid" + } + return fmt.Sprintf("BadVariant%d", int(v)) +} + +// SetRand sets the random number generator to r, which implements io.Reader. +// If r.Read returns an error when the package requests random data then +// a panic will be issued. +// +// Calling SetRand with nil sets the random number generator to the default +// generator. +func SetRand(r io.Reader) { + if r == nil { + rander = rand.Reader + return + } + rander = r +} diff --git a/vendor/github.com/google/uuid/uuid_test.go b/vendor/github.com/google/uuid/uuid_test.go new file mode 100644 index 000000000..e7876f151 --- /dev/null +++ b/vendor/github.com/google/uuid/uuid_test.go @@ -0,0 +1,559 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "fmt" + "os" + "runtime" + "strings" + "testing" + "time" + "unsafe" +) + +type test struct { + in string + version Version + variant Variant + isuuid bool +} + +var tests = []test{ + {"f47ac10b-58cc-0372-8567-0e02b2c3d479", 0, RFC4122, true}, + {"f47ac10b-58cc-1372-8567-0e02b2c3d479", 1, RFC4122, true}, + {"f47ac10b-58cc-2372-8567-0e02b2c3d479", 2, RFC4122, true}, + {"f47ac10b-58cc-3372-8567-0e02b2c3d479", 3, RFC4122, true}, + {"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-5372-8567-0e02b2c3d479", 5, RFC4122, true}, + {"f47ac10b-58cc-6372-8567-0e02b2c3d479", 6, RFC4122, true}, + {"f47ac10b-58cc-7372-8567-0e02b2c3d479", 7, RFC4122, true}, + {"f47ac10b-58cc-8372-8567-0e02b2c3d479", 8, RFC4122, true}, + {"f47ac10b-58cc-9372-8567-0e02b2c3d479", 9, RFC4122, true}, + {"f47ac10b-58cc-a372-8567-0e02b2c3d479", 10, RFC4122, true}, + {"f47ac10b-58cc-b372-8567-0e02b2c3d479", 11, RFC4122, true}, + {"f47ac10b-58cc-c372-8567-0e02b2c3d479", 12, RFC4122, true}, + {"f47ac10b-58cc-d372-8567-0e02b2c3d479", 13, RFC4122, true}, + {"f47ac10b-58cc-e372-8567-0e02b2c3d479", 14, RFC4122, true}, + {"f47ac10b-58cc-f372-8567-0e02b2c3d479", 15, RFC4122, true}, + + {"urn:uuid:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true}, + {"URN:UUID:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-1567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-2567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-3567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-4567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-5567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-6567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-7567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-4372-9567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-4372-a567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-4372-b567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-4372-c567-0e02b2c3d479", 4, Microsoft, true}, + {"f47ac10b-58cc-4372-d567-0e02b2c3d479", 4, Microsoft, true}, + {"f47ac10b-58cc-4372-e567-0e02b2c3d479", 4, Future, true}, + {"f47ac10b-58cc-4372-f567-0e02b2c3d479", 4, Future, true}, + + + {"f47ac10b158cc-5372-a567-0e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc25372-a567-0e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc-53723a567-0e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc-5372-a56740e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc-5372-a567-0e02-2c3d479", 0, Invalid, false}, + {"g47ac10b-58cc-4372-a567-0e02b2c3d479", 0, Invalid, false}, + + + {"{f47ac10b-58cc-0372-8567-0e02b2c3d479}", 0, RFC4122, true}, + {"{f47ac10b-58cc-0372-8567-0e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc-0372-8567-0e02b2c3d479}", 0, Invalid, false}, + + {"f47ac10b58cc037285670e02b2c3d479", 0, RFC4122, true}, + {"f47ac10b58cc037285670e02b2c3d4790", 0, Invalid, false}, + {"f47ac10b58cc037285670e02b2c3d47", 0, Invalid, false}, +} + +var constants = []struct { + c interface{} + name string +}{ + {Person, "Person"}, + {Group, "Group"}, + {Org, "Org"}, + {Invalid, "Invalid"}, + {RFC4122, "RFC4122"}, + {Reserved, "Reserved"}, + {Microsoft, "Microsoft"}, + {Future, "Future"}, + {Domain(17), "Domain17"}, + {Variant(42), "BadVariant42"}, +} + +func testTest(t *testing.T, in string, tt test) { + uuid, err := Parse(in) + if ok := (err == nil); ok != tt.isuuid { + t.Errorf("Parse(%s) got %v expected %v\b", in, ok, tt.isuuid) + } + if err != nil { + return + } + + if v := uuid.Variant(); v != tt.variant { + t.Errorf("Variant(%s) got %d expected %d\b", in, v, tt.variant) + } + if v := uuid.Version(); v != tt.version { + t.Errorf("Version(%s) got %d expected %d\b", in, v, tt.version) + } +} + +func testBytes(t *testing.T, in []byte, tt test) { + uuid, err := ParseBytes(in) + if ok := (err == nil); ok != tt.isuuid { + t.Errorf("ParseBytes(%s) got %v expected %v\b", in, ok, tt.isuuid) + } + if err != nil { + return + } + suuid, _ := Parse(string(in)) + if uuid != suuid { + t.Errorf("ParseBytes(%s) got %v expected %v\b", in, uuid, suuid) + } +} + +func TestUUID(t *testing.T) { + for _, tt := range tests { + testTest(t, tt.in, tt) + testTest(t, strings.ToUpper(tt.in), tt) + testBytes(t, []byte(tt.in), tt) + } +} + +func TestFromBytes(t *testing.T) { + b := []byte{ + 0x7d, 0x44, 0x48, 0x40, + 0x9d, 0xc0, + 0x11, 0xd1, + 0xb2, 0x45, + 0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2, + } + uuid, err := FromBytes(b) + if err != nil { + t.Fatalf("%s", err) + } + for i := 0; i < len(uuid); i++ { + if b[i] != uuid[i] { + t.Fatalf("FromBytes() got %v expected %v\b", uuid[:], b) + } + } +} + +func TestConstants(t *testing.T) { + for x, tt := range constants { + v, ok := tt.c.(fmt.Stringer) + if !ok { + t.Errorf("%x: %v: not a stringer", x, v) + } else if s := v.String(); s != tt.name { + v, _ := tt.c.(int) + t.Errorf("%x: Constant %T:%d gives %q, expected %q", x, tt.c, v, s, tt.name) + } + } +} + +func TestRandomUUID(t *testing.T) { + m := make(map[string]bool) + for x := 1; x < 32; x++ { + uuid := New() + s := uuid.String() + if m[s] { + t.Errorf("NewRandom returned duplicated UUID %s", s) + } + m[s] = true + if v := uuid.Version(); v != 4 { + t.Errorf("Random UUID of version %s", v) + } + if uuid.Variant() != RFC4122 { + t.Errorf("Random UUID is variant %d", uuid.Variant()) + } + } +} + +func TestNew(t *testing.T) { + m := make(map[UUID]bool) + for x := 1; x < 32; x++ { + s := New() + if m[s] { + t.Errorf("New returned duplicated UUID %s", s) + } + m[s] = true + uuid, err := Parse(s.String()) + if err != nil { + t.Errorf("New.String() returned %q which does not decode", s) + continue + } + if v := uuid.Version(); v != 4 { + t.Errorf("Random UUID of version %s", v) + } + if uuid.Variant() != RFC4122 { + t.Errorf("Random UUID is variant %d", uuid.Variant()) + } + } +} + +func TestClockSeq(t *testing.T) { + // Fake time.Now for this test to return a monotonically advancing time; restore it at end. + defer func(orig func() time.Time) { timeNow = orig }(timeNow) + monTime := time.Now() + timeNow = func() time.Time { + monTime = monTime.Add(1 * time.Second) + return monTime + } + + SetClockSequence(-1) + uuid1, err := NewUUID() + if err != nil { + t.Fatalf("could not create UUID: %v", err) + } + uuid2, err := NewUUID() + if err != nil { + t.Fatalf("could not create UUID: %v", err) + } + + if s1, s2 := uuid1.ClockSequence(), uuid2.ClockSequence(); s1 != s2 { + t.Errorf("clock sequence %d != %d", s1, s2) + } + + SetClockSequence(-1) + uuid2, err = NewUUID() + if err != nil { + t.Fatalf("could not create UUID: %v", err) + } + + // Just on the very off chance we generated the same sequence + // two times we try again. + if uuid1.ClockSequence() == uuid2.ClockSequence() { + SetClockSequence(-1) + uuid2, err = NewUUID() + if err != nil { + t.Fatalf("could not create UUID: %v", err) + } + } + if s1, s2 := uuid1.ClockSequence(), uuid2.ClockSequence(); s1 == s2 { + t.Errorf("Duplicate clock sequence %d", s1) + } + + SetClockSequence(0x1234) + uuid1, err = NewUUID() + if err != nil { + t.Fatalf("could not create UUID: %v", err) + } + if seq := uuid1.ClockSequence(); seq != 0x1234 { + t.Errorf("%s: expected seq 0x1234 got 0x%04x", uuid1, seq) + } +} + +func TestCoding(t *testing.T) { + text := "7d444840-9dc0-11d1-b245-5ffdce74fad2" + urn := "urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2" + data := UUID{ + 0x7d, 0x44, 0x48, 0x40, + 0x9d, 0xc0, + 0x11, 0xd1, + 0xb2, 0x45, + 0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2, + } + if v := data.String(); v != text { + t.Errorf("%x: encoded to %s, expected %s", data, v, text) + } + if v := data.URN(); v != urn { + t.Errorf("%x: urn is %s, expected %s", data, v, urn) + } + + uuid, err := Parse(text) + if err != nil { + t.Errorf("Parse returned unexpected error %v", err) + } + if data != uuid { + t.Errorf("%s: decoded to %s, expected %s", text, uuid, data) + } +} + +func TestVersion1(t *testing.T) { + uuid1, err := NewUUID() + if err != nil { + t.Fatalf("could not create UUID: %v", err) + } + uuid2, err := NewUUID() + if err != nil { + t.Fatalf("could not create UUID: %v", err) + } + + if uuid1 == uuid2 { + t.Errorf("%s:duplicate uuid", uuid1) + } + if v := uuid1.Version(); v != 1 { + t.Errorf("%s: version %s expected 1", uuid1, v) + } + if v := uuid2.Version(); v != 1 { + t.Errorf("%s: version %s expected 1", uuid2, v) + } + n1 := uuid1.NodeID() + n2 := uuid2.NodeID() + if !bytes.Equal(n1, n2) { + t.Errorf("Different nodes %x != %x", n1, n2) + } + t1 := uuid1.Time() + t2 := uuid2.Time() + q1 := uuid1.ClockSequence() + q2 := uuid2.ClockSequence() + + switch { + case t1 == t2 && q1 == q2: + t.Error("time stopped") + case t1 > t2 && q1 == q2: + t.Error("time reversed") + case t1 < t2 && q1 != q2: + t.Error("clock sequence changed unexpectedly") + } +} + +func TestNode(t *testing.T) { + // This test is mostly to make sure we don't leave nodeMu locked. + ifname = "" + if ni := NodeInterface(); ni != "" { + t.Errorf("NodeInterface got %q, want %q", ni, "") + } + if SetNodeInterface("xyzzy") { + t.Error("SetNodeInterface succeeded on a bad interface name") + } + if !SetNodeInterface("") { + t.Error("SetNodeInterface failed") + } + if runtime.GOARCH != "js" { + if ni := NodeInterface(); ni == "" { + t.Error("NodeInterface returned an empty string") + } + } + + ni := NodeID() + if len(ni) != 6 { + t.Errorf("ni got %d bytes, want 6", len(ni)) + } + hasData := false + for _, b := range ni { + if b != 0 { + hasData = true + } + } + if !hasData { + t.Error("nodeid is all zeros") + } + + id := []byte{1, 2, 3, 4, 5, 6, 7, 8} + SetNodeID(id) + ni = NodeID() + if !bytes.Equal(ni, id[:6]) { + t.Errorf("got nodeid %v, want %v", ni, id[:6]) + } + + if ni := NodeInterface(); ni != "user" { + t.Errorf("got interface %q, want %q", ni, "user") + } +} + +func TestNodeAndTime(t *testing.T) { + // Time is February 5, 1998 12:30:23.136364800 AM GMT + + uuid, err := Parse("7d444840-9dc0-11d1-b245-5ffdce74fad2") + if err != nil { + t.Fatalf("Parser returned unexpected error %v", err) + } + node := []byte{0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2} + + ts := uuid.Time() + c := time.Unix(ts.UnixTime()) + want := time.Date(1998, 2, 5, 0, 30, 23, 136364800, time.UTC) + if !c.Equal(want) { + t.Errorf("Got time %v, want %v", c, want) + } + if !bytes.Equal(node, uuid.NodeID()) { + t.Errorf("Expected node %v got %v", node, uuid.NodeID()) + } +} + +func TestMD5(t *testing.T) { + uuid := NewMD5(NameSpaceDNS, []byte("python.org")).String() + want := "6fa459ea-ee8a-3ca4-894e-db77e160355e" + if uuid != want { + t.Errorf("MD5: got %q expected %q", uuid, want) + } +} + +func TestSHA1(t *testing.T) { + uuid := NewSHA1(NameSpaceDNS, []byte("python.org")).String() + want := "886313e1-3b8a-5372-9b90-0c9aee199e5d" + if uuid != want { + t.Errorf("SHA1: got %q expected %q", uuid, want) + } +} + +func TestNodeID(t *testing.T) { + nid := []byte{1, 2, 3, 4, 5, 6} + SetNodeInterface("") + s := NodeInterface() + if runtime.GOARCH != "js" { + if s == "" || s == "user" { + t.Errorf("NodeInterface %q after SetInterface", s) + } + } + node1 := NodeID() + if node1 == nil { + t.Error("NodeID nil after SetNodeInterface", s) + } + SetNodeID(nid) + s = NodeInterface() + if s != "user" { + t.Errorf("Expected NodeInterface %q got %q", "user", s) + } + node2 := NodeID() + if node2 == nil { + t.Error("NodeID nil after SetNodeID", s) + } + if bytes.Equal(node1, node2) { + t.Error("NodeID not changed after SetNodeID", s) + } else if !bytes.Equal(nid, node2) { + t.Errorf("NodeID is %x, expected %x", node2, nid) + } +} + +func testDCE(t *testing.T, name string, uuid UUID, err error, domain Domain, id uint32) { + if err != nil { + t.Errorf("%s failed: %v", name, err) + return + } + if v := uuid.Version(); v != 2 { + t.Errorf("%s: %s: expected version 2, got %s", name, uuid, v) + return + } + if v := uuid.Domain(); v != domain { + t.Errorf("%s: %s: expected domain %d, got %d", name, uuid, domain, v) + } + if v := uuid.ID(); v != id { + t.Errorf("%s: %s: expected id %d, got %d", name, uuid, id, v) + } +} + +func TestDCE(t *testing.T) { + uuid, err := NewDCESecurity(42, 12345678) + testDCE(t, "NewDCESecurity", uuid, err, 42, 12345678) + uuid, err = NewDCEPerson() + testDCE(t, "NewDCEPerson", uuid, err, Person, uint32(os.Getuid())) + uuid, err = NewDCEGroup() + testDCE(t, "NewDCEGroup", uuid, err, Group, uint32(os.Getgid())) +} + +type badRand struct{} + +func (r badRand) Read(buf []byte) (int, error) { + for i := range buf { + buf[i] = byte(i) + } + return len(buf), nil +} + +func TestBadRand(t *testing.T) { + SetRand(badRand{}) + uuid1 := New() + uuid2 := New() + if uuid1 != uuid2 { + t.Errorf("expected duplicates, got %q and %q", uuid1, uuid2) + } + SetRand(nil) + uuid1 = New() + uuid2 = New() + if uuid1 == uuid2 { + t.Errorf("unexpected duplicates, got %q", uuid1) + } +} + +var asString = "f47ac10b-58cc-0372-8567-0e02b2c3d479" +var asBytes = []byte(asString) + +func BenchmarkParse(b *testing.B) { + for i := 0; i < b.N; i++ { + _, err := Parse(asString) + if err != nil { + b.Fatal(err) + } + } +} + +func BenchmarkParseBytes(b *testing.B) { + for i := 0; i < b.N; i++ { + _, err := ParseBytes(asBytes) + if err != nil { + b.Fatal(err) + } + } +} + +// parseBytesUnsafe is to benchmark using unsafe. +func parseBytesUnsafe(b []byte) (UUID, error) { + return Parse(*(*string)(unsafe.Pointer(&b))) +} + +func BenchmarkParseBytesUnsafe(b *testing.B) { + for i := 0; i < b.N; i++ { + _, err := parseBytesUnsafe(asBytes) + if err != nil { + b.Fatal(err) + } + } +} + +// parseBytesCopy is to benchmark not using unsafe. +func parseBytesCopy(b []byte) (UUID, error) { + return Parse(string(b)) +} + +func BenchmarkParseBytesCopy(b *testing.B) { + for i := 0; i < b.N; i++ { + _, err := parseBytesCopy(asBytes) + if err != nil { + b.Fatal(err) + } + } +} + +func BenchmarkNew(b *testing.B) { + for i := 0; i < b.N; i++ { + New() + } +} + +func BenchmarkUUID_String(b *testing.B) { + uuid, err := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if err != nil { + b.Fatal(err) + } + for i := 0; i < b.N; i++ { + if uuid.String() == "" { + b.Fatal("invalid uuid") + } + } +} + +func BenchmarkUUID_URN(b *testing.B) { + uuid, err := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if err != nil { + b.Fatal(err) + } + for i := 0; i < b.N; i++ { + if uuid.URN() == "" { + b.Fatal("invalid uuid") + } + } +} diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go new file mode 100644 index 000000000..199a1ac65 --- /dev/null +++ b/vendor/github.com/google/uuid/version1.go @@ -0,0 +1,44 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" +) + +// NewUUID returns a Version 1 UUID based on the current NodeID and clock +// sequence, and the current time. If the NodeID has not been set by SetNodeID +// or SetNodeInterface then it will be set automatically. If the NodeID cannot +// be set NewUUID returns nil. If clock sequence has not been set by +// SetClockSequence then it will be set automatically. If GetTime fails to +// return the current NewUUID returns nil and an error. +// +// In most cases, New should be used. +func NewUUID() (UUID, error) { + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + nodeMu.Unlock() + + var uuid UUID + now, seq, err := GetTime() + if err != nil { + return uuid, err + } + + timeLow := uint32(now & 0xffffffff) + timeMid := uint16((now >> 32) & 0xffff) + timeHi := uint16((now >> 48) & 0x0fff) + timeHi |= 0x1000 // Version 1 + + binary.BigEndian.PutUint32(uuid[0:], timeLow) + binary.BigEndian.PutUint16(uuid[4:], timeMid) + binary.BigEndian.PutUint16(uuid[6:], timeHi) + binary.BigEndian.PutUint16(uuid[8:], seq) + copy(uuid[10:], nodeID[:]) + + return uuid, nil +} diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go new file mode 100644 index 000000000..84af91c9f --- /dev/null +++ b/vendor/github.com/google/uuid/version4.go @@ -0,0 +1,38 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "io" + +// New creates a new random UUID or panics. New is equivalent to +// the expression +// +// uuid.Must(uuid.NewRandom()) +func New() UUID { + return Must(NewRandom()) +} + +// NewRandom returns a Random (Version 4) UUID. +// +// The strength of the UUIDs is based on the strength of the crypto/rand +// package. +// +// A note about uniqueness derived from the UUID Wikipedia entry: +// +// Randomly generated UUIDs have 122 random bits. One's annual risk of being +// hit by a meteorite is estimated to be one chance in 17 billion, that +// means the probability is about 0.00000000006 (6 × 10−11), +// equivalent to the odds of creating a few tens of trillions of UUIDs in a +// year and having one duplicate. +func NewRandom() (UUID, error) { + var uuid UUID + _, err := io.ReadFull(rander, uuid[:]) + if err != nil { + return Nil, err + } + uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 + uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 + return uuid, nil +} diff --git a/vendor/github.com/pkg/errors/.gitignore b/vendor/github.com/mattbaird/jsonpatch/.gitignore similarity index 100% rename from vendor/github.com/pkg/errors/.gitignore rename to vendor/github.com/mattbaird/jsonpatch/.gitignore diff --git a/vendor/github.com/mattbaird/jsonpatch/LICENSE b/vendor/github.com/mattbaird/jsonpatch/LICENSE new file mode 100644 index 000000000..8f71f43fe --- /dev/null +++ b/vendor/github.com/mattbaird/jsonpatch/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/vendor/github.com/mattbaird/jsonpatch/README.md b/vendor/github.com/mattbaird/jsonpatch/README.md new file mode 100644 index 000000000..91c03b3fc --- /dev/null +++ b/vendor/github.com/mattbaird/jsonpatch/README.md @@ -0,0 +1,46 @@ +# jsonpatch +As per http://jsonpatch.com/ JSON Patch is specified in RFC 6902 from the IETF. + +JSON Patch allows you to generate JSON that describes changes you want to make to a document, so you don't have to send the whole doc. JSON Patch format is supported by HTTP PATCH method, allowing for standards based partial updates via REST APIs. + +```bash +go get github.com/mattbaird/jsonpatch +``` + +I tried some of the other "jsonpatch" go implementations, but none of them could diff two json documents and +generate format like jsonpatch.com specifies. Here's an example of the patch format: + +```json +[ + { "op": "replace", "path": "/baz", "value": "boo" }, + { "op": "add", "path": "/hello", "value": ["world"] }, + { "op": "remove", "path": "/foo"} +] + +``` +The API is super simple +#example +```go +package main + +import ( + "fmt" + "github.com/mattbaird/jsonpatch" +) + +var simpleA = `{"a":100, "b":200, "c":"hello"}` +var simpleB = `{"a":100, "b":200, "c":"goodbye"}` + +func main() { + patch, e := jsonpatch.CreatePatch([]byte(simpleA), []byte(simpleA)) + if e != nil { + fmt.Printf("Error creating JSON patch:%v", e) + return + } + for _, operation := range patch { + fmt.Printf("%s\n", operation.Json()) + } +} +``` + +This code needs more tests, as it's a highly recursive, type-fiddly monster. It's not a lot of code, but it has to deal with a lot of complexity. diff --git a/vendor/github.com/mattbaird/jsonpatch/jsonpatch.go b/vendor/github.com/mattbaird/jsonpatch/jsonpatch.go new file mode 100644 index 000000000..295f260f5 --- /dev/null +++ b/vendor/github.com/mattbaird/jsonpatch/jsonpatch.go @@ -0,0 +1,257 @@ +package jsonpatch + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strings" +) + +var errBadJSONDoc = fmt.Errorf("Invalid JSON Document") + +type JsonPatchOperation struct { + Operation string `json:"op"` + Path string `json:"path"` + Value interface{} `json:"value,omitempty"` +} + +func (j *JsonPatchOperation) Json() string { + b, _ := json.Marshal(j) + return string(b) +} + +func (j *JsonPatchOperation) MarshalJSON() ([]byte, error) { + var b bytes.Buffer + b.WriteString("{") + b.WriteString(fmt.Sprintf(`"op":"%s"`, j.Operation)) + b.WriteString(fmt.Sprintf(`,"path":"%s"`, j.Path)) + // Consider omitting Value for non-nullable operations. + if j.Value != nil || j.Operation == "replace" || j.Operation == "add" { + v, err := json.Marshal(j.Value) + if err != nil { + return nil, err + } + b.WriteString(`,"value":`) + b.Write(v) + } + b.WriteString("}") + return b.Bytes(), nil +} + +type ByPath []JsonPatchOperation + +func (a ByPath) Len() int { return len(a) } +func (a ByPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a ByPath) Less(i, j int) bool { return a[i].Path < a[j].Path } + +func NewPatch(operation, path string, value interface{}) JsonPatchOperation { + return JsonPatchOperation{Operation: operation, Path: path, Value: value} +} + +// CreatePatch creates a patch as specified in http://jsonpatch.com/ +// +// 'a' is original, 'b' is the modified document. Both are to be given as json encoded content. +// The function will return an array of JsonPatchOperations +// +// An error will be returned if any of the two documents are invalid. +func CreatePatch(a, b []byte) ([]JsonPatchOperation, error) { + aI := map[string]interface{}{} + bI := map[string]interface{}{} + err := json.Unmarshal(a, &aI) + if err != nil { + return nil, errBadJSONDoc + } + err = json.Unmarshal(b, &bI) + if err != nil { + return nil, errBadJSONDoc + } + return diff(aI, bI, "", []JsonPatchOperation{}) +} + +// Returns true if the values matches (must be json types) +// The types of the values must match, otherwise it will always return false +// If two map[string]interface{} are given, all elements must match. +func matchesValue(av, bv interface{}) bool { + if reflect.TypeOf(av) != reflect.TypeOf(bv) { + return false + } + switch at := av.(type) { + case string: + bt := bv.(string) + if bt == at { + return true + } + case float64: + bt := bv.(float64) + if bt == at { + return true + } + case bool: + bt := bv.(bool) + if bt == at { + return true + } + case map[string]interface{}: + bt := bv.(map[string]interface{}) + for key := range at { + if !matchesValue(at[key], bt[key]) { + return false + } + } + for key := range bt { + if !matchesValue(at[key], bt[key]) { + return false + } + } + return true + case []interface{}: + bt := bv.([]interface{}) + if len(bt) != len(at) { + return false + } + for key := range at { + if !matchesValue(at[key], bt[key]) { + return false + } + } + for key := range bt { + if !matchesValue(at[key], bt[key]) { + return false + } + } + return true + } + return false +} + +// From http://tools.ietf.org/html/rfc6901#section-4 : +// +// Evaluation of each reference token begins by decoding any escaped +// character sequence. This is performed by first transforming any +// occurrence of the sequence '~1' to '/', and then transforming any +// occurrence of the sequence '~0' to '~'. +// TODO decode support: +// var rfc6901Decoder = strings.NewReplacer("~1", "/", "~0", "~") + +var rfc6901Encoder = strings.NewReplacer("~", "~0", "/", "~1") + +func makePath(path string, newPart interface{}) string { + key := rfc6901Encoder.Replace(fmt.Sprintf("%v", newPart)) + if path == "" { + return "/" + key + } + if strings.HasSuffix(path, "/") { + return path + key + } + return path + "/" + key +} + +// diff returns the (recursive) difference between a and b as an array of JsonPatchOperations. +func diff(a, b map[string]interface{}, path string, patch []JsonPatchOperation) ([]JsonPatchOperation, error) { + for key, bv := range b { + p := makePath(path, key) + av, ok := a[key] + // value was added + if !ok { + patch = append(patch, NewPatch("add", p, bv)) + continue + } + // If types have changed, replace completely + if reflect.TypeOf(av) != reflect.TypeOf(bv) { + patch = append(patch, NewPatch("replace", p, bv)) + continue + } + // Types are the same, compare values + var err error + patch, err = handleValues(av, bv, p, patch) + if err != nil { + return nil, err + } + } + // Now add all deleted values as nil + for key := range a { + _, found := b[key] + if !found { + p := makePath(path, key) + + patch = append(patch, NewPatch("remove", p, nil)) + } + } + return patch, nil +} + +func handleValues(av, bv interface{}, p string, patch []JsonPatchOperation) ([]JsonPatchOperation, error) { + var err error + switch at := av.(type) { + case map[string]interface{}: + bt := bv.(map[string]interface{}) + patch, err = diff(at, bt, p, patch) + if err != nil { + return nil, err + } + case string, float64, bool: + if !matchesValue(av, bv) { + patch = append(patch, NewPatch("replace", p, bv)) + } + case []interface{}: + bt, ok := bv.([]interface{}) + if !ok { + // array replaced by non-array + patch = append(patch, NewPatch("replace", p, bv)) + } else if len(at) != len(bt) { + // arrays are not the same length + patch = append(patch, compareArray(at, bt, p)...) + + } else { + for i := range bt { + patch, err = handleValues(at[i], bt[i], makePath(p, i), patch) + if err != nil { + return nil, err + } + } + } + case nil: + switch bv.(type) { + case nil: + // Both nil, fine. + default: + patch = append(patch, NewPatch("add", p, bv)) + } + default: + panic(fmt.Sprintf("Unknown type:%T ", av)) + } + return patch, nil +} + +func compareArray(av, bv []interface{}, p string) []JsonPatchOperation { + retval := []JsonPatchOperation{} + // var err error + for i, v := range av { + found := false + for _, v2 := range bv { + if reflect.DeepEqual(v, v2) { + found = true + break + } + } + if !found { + retval = append(retval, NewPatch("remove", makePath(p, i), nil)) + } + } + + for i, v := range bv { + found := false + for _, v2 := range av { + if reflect.DeepEqual(v, v2) { + found = true + break + } + } + if !found { + retval = append(retval, NewPatch("add", makePath(p, i), v)) + } + } + + return retval +} diff --git a/vendor/github.com/mattbaird/jsonpatch/jsonpatch_complex_test.go b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_complex_test.go new file mode 100644 index 000000000..2a98871ff --- /dev/null +++ b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_complex_test.go @@ -0,0 +1,88 @@ +package jsonpatch + +import ( + "github.com/stretchr/testify/assert" + "sort" + "testing" +) + +var complexBase = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":200, "g":"h", "i":"j"}}` +var complexA = `{"a":100, "b":[{"c1":"goodbye", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":200, "g":"h", "i":"j"}}` +var complexB = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":100, "g":"h", "i":"j"}}` +var complexC = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":200, "g":"h", "i":"j"}, "k":[{"l":"m"}, {"l":"o"}]}` +var complexD = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"}, {"c3":"hello3", "d3":"foo3"} ], "e":{"f":200, "g":"h", "i":"j"}}` +var complexE = `{"a":100, "b":[{"c1":"hello", "d1":"foo"},{"c2":"hello2", "d2":"foo2"} ], "e":{"f":200, "g":"h", "i":"j"}}` + +func TestComplexSame(t *testing.T) { + patch, e := CreatePatch([]byte(complexBase), []byte(complexBase)) + assert.NoError(t, e) + assert.Equal(t, 0, len(patch), "they should be equal") +} +func TestComplexOneStringReplaceInArray(t *testing.T) { + patch, e := CreatePatch([]byte(complexBase), []byte(complexA)) + assert.NoError(t, e) + assert.Equal(t, 1, len(patch), "they should be equal") + change := patch[0] + assert.Equal(t, "replace", change.Operation, "they should be equal") + assert.Equal(t, "/b/0/c1", change.Path, "they should be equal") + assert.Equal(t, "goodbye", change.Value, "they should be equal") +} + +func TestComplexOneIntReplace(t *testing.T) { + patch, e := CreatePatch([]byte(complexBase), []byte(complexB)) + assert.NoError(t, e) + assert.Equal(t, 1, len(patch), "they should be equal") + change := patch[0] + assert.Equal(t, "replace", change.Operation, "they should be equal") + assert.Equal(t, "/e/f", change.Path, "they should be equal") + var expected float64 = 100 + assert.Equal(t, expected, change.Value, "they should be equal") +} + +func TestComplexOneAdd(t *testing.T) { + patch, e := CreatePatch([]byte(complexBase), []byte(complexC)) + assert.NoError(t, e) + assert.Equal(t, 1, len(patch), "they should be equal") + change := patch[0] + assert.Equal(t, "add", change.Operation, "they should be equal") + assert.Equal(t, "/k", change.Path, "they should be equal") + a := make(map[string]interface{}) + b := make(map[string]interface{}) + a["l"] = "m" + b["l"] = "o" + expected := []interface{}{a, b} + assert.Equal(t, expected, change.Value, "they should be equal") +} + +func TestComplexOneAddToArray(t *testing.T) { + patch, e := CreatePatch([]byte(complexBase), []byte(complexC)) + assert.NoError(t, e) + assert.Equal(t, 1, len(patch), "they should be equal") + change := patch[0] + assert.Equal(t, "add", change.Operation, "they should be equal") + assert.Equal(t, "/k", change.Path, "they should be equal") + a := make(map[string]interface{}) + b := make(map[string]interface{}) + a["l"] = "m" + b["l"] = "o" + expected := []interface{}{a, b} + assert.Equal(t, expected, change.Value, "they should be equal") +} + +func TestComplexVsEmpty(t *testing.T) { + patch, e := CreatePatch([]byte(complexBase), []byte(empty)) + assert.NoError(t, e) + assert.Equal(t, 3, len(patch), "they should be equal") + sort.Sort(ByPath(patch)) + change := patch[0] + assert.Equal(t, "remove", change.Operation, "they should be equal") + assert.Equal(t, "/a", change.Path, "they should be equal") + + change = patch[1] + assert.Equal(t, "remove", change.Operation, "they should be equal") + assert.Equal(t, "/b", change.Path, "they should be equal") + + change = patch[2] + assert.Equal(t, "remove", change.Operation, "they should be equal") + assert.Equal(t, "/e", change.Path, "they should be equal") +} diff --git a/vendor/github.com/mattbaird/jsonpatch/jsonpatch_geojson_test.go b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_geojson_test.go new file mode 100644 index 000000000..6a92da038 --- /dev/null +++ b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_geojson_test.go @@ -0,0 +1,48 @@ +package jsonpatch + +import ( + "github.com/stretchr/testify/assert" + "sort" + "testing" +) + +var point = `{"type":"Point", "coordinates":[0.0, 1.0]}` +var lineString = `{"type":"LineString", "coordinates":[[0.0, 1.0], [2.0, 3.0]]}` + +func TestPointLineStringReplace(t *testing.T) { + patch, e := CreatePatch([]byte(point), []byte(lineString)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 3, "they should be equal") + sort.Sort(ByPath(patch)) + change := patch[0] + assert.Equal(t, change.Operation, "replace", "they should be equal") + assert.Equal(t, change.Path, "/coordinates/0", "they should be equal") + assert.Equal(t, change.Value, []interface{}{0.0, 1.0}, "they should be equal") + change = patch[1] + assert.Equal(t, change.Operation, "replace", "they should be equal") + assert.Equal(t, change.Path, "/coordinates/1", "they should be equal") + assert.Equal(t, change.Value, []interface{}{2.0, 3.0}, "they should be equal") + change = patch[2] + assert.Equal(t, change.Operation, "replace", "they should be equal") + assert.Equal(t, change.Path, "/type", "they should be equal") + assert.Equal(t, change.Value, "LineString", "they should be equal") +} + +func TestLineStringPointReplace(t *testing.T) { + patch, e := CreatePatch([]byte(lineString), []byte(point)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 3, "they should be equal") + sort.Sort(ByPath(patch)) + change := patch[0] + assert.Equal(t, change.Operation, "replace", "they should be equal") + assert.Equal(t, change.Path, "/coordinates/0", "they should be equal") + assert.Equal(t, change.Value, 0.0, "they should be equal") + change = patch[1] + assert.Equal(t, change.Operation, "replace", "they should be equal") + assert.Equal(t, change.Path, "/coordinates/1", "they should be equal") + assert.Equal(t, change.Value, 1.0, "they should be equal") + change = patch[2] + assert.Equal(t, change.Operation, "replace", "they should be equal") + assert.Equal(t, change.Path, "/type", "they should be equal") + assert.Equal(t, change.Value, "Point", "they should be equal") +} diff --git a/vendor/github.com/mattbaird/jsonpatch/jsonpatch_hypercomplex_test.go b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_hypercomplex_test.go new file mode 100644 index 000000000..f34423b4b --- /dev/null +++ b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_hypercomplex_test.go @@ -0,0 +1,181 @@ +package jsonpatch + +import ( + "github.com/stretchr/testify/assert" + "sort" + "testing" +) + +var hyperComplexBase = ` +{ + "goods": [ + { + "id": "0001", + "type": "donut", + "name": "Cake", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" }, + { "id": "1002", "type": "Chocolate" }, + { "id": "1003", "type": "Blueberry" }, + { "id": "1004", "type": "Devil's Food" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5005", "type": "Sugar" }, + { "id": "5007", "type": "Powdered Sugar" }, + { "id": "5006", "type": "Chocolate with Sprinkles" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + }, + { + "id": "0002", + "type": "donut", + "name": "Raised", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5005", "type": "Sugar" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + }, + { + "id": "0003", + "type": "donut", + "name": "Old Fashioned", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" }, + { "id": "1002", "type": "Chocolate" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + } +] +}` + +var hyperComplexA = ` +{ + "goods": [ + { + "id": "0001", + "type": "donut", + "name": "Cake", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" }, + { "id": "1002", "type": "Chocolate" }, + { "id": "1003", "type": "Strawberry" }, + { "id": "1004", "type": "Devil's Food" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5005", "type": "Sugar" }, + { "id": "5007", "type": "Powdered Sugar" }, + { "id": "5006", "type": "Chocolate with Sprinkles" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + }, + { + "id": "0002", + "type": "donut", + "name": "Raised", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5005", "type": "Sugar" }, + { "id": "5003", "type": "Chocolate" }, + { "id": "5004", "type": "Maple" } + ] + }, + { + "id": "0003", + "type": "donut", + "name": "Old Fashioned", + "ppu": 0.55, + "batters": + { + "batter": + [ + { "id": "1001", "type": "Regular" }, + { "id": "1002", "type": "Chocolate" }, + { "id": "1003", "type": "Vanilla" } + ] + }, + "topping": + [ + { "id": "5001", "type": "None" }, + { "id": "5002", "type": "Glazed" }, + { "id": "5004", "type": "Maple" } + ] + } +] +}` + +func TestHyperComplexSame(t *testing.T) { + patch, e := CreatePatch([]byte(hyperComplexBase), []byte(hyperComplexBase)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 0, "they should be equal") +} + +func TestHyperComplexBoolReplace(t *testing.T) { + patch, e := CreatePatch([]byte(hyperComplexBase), []byte(hyperComplexA)) + assert.NoError(t, e) + assert.Equal(t, 3, len(patch), "they should be equal") + sort.Sort(ByPath(patch)) + + change := patch[0] + assert.Equal(t, "replace", change.Operation, "they should be equal") + assert.Equal(t, "/goods/0/batters/batter/2/type", change.Path, "they should be equal") + assert.Equal(t, "Strawberry", change.Value, "they should be equal") + change = patch[1] + assert.Equal(t, "add", change.Operation, "they should be equal") + assert.Equal(t, "/goods/2/batters/batter/2", change.Path, "they should be equal") + assert.Equal(t, map[string]interface{}{"id": "1003", "type": "Vanilla"}, change.Value, "they should be equal") + change = patch[2] + assert.Equal(t, change.Operation, "remove", "they should be equal") + assert.Equal(t, change.Path, "/goods/2/topping/2", "they should be equal") + assert.Equal(t, nil, change.Value, "they should be equal") +} diff --git a/vendor/github.com/mattbaird/jsonpatch/jsonpatch_json_test.go b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_json_test.go new file mode 100644 index 000000000..4f8617f75 --- /dev/null +++ b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_json_test.go @@ -0,0 +1,31 @@ +package jsonpatch + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestMarshalNullableValue(t *testing.T) { + p1 := JsonPatchOperation{ + Operation: "replace", + Path: "/a1", + Value: nil, + } + assert.JSONEq(t, `{"op":"replace", "path":"/a1","value":null}`, p1.Json()) + + p2 := JsonPatchOperation{ + Operation: "replace", + Path: "/a2", + Value: "v2", + } + assert.JSONEq(t, `{"op":"replace", "path":"/a2", "value":"v2"}`, p2.Json()) +} + +func TestMarshalNonNullableValue(t *testing.T) { + p1 := JsonPatchOperation{ + Operation: "remove", + Path: "/a1", + } + assert.JSONEq(t, `{"op":"remove", "path":"/a1"}`, p1.Json()) + +} diff --git a/vendor/github.com/mattbaird/jsonpatch/jsonpatch_simple_test.go b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_simple_test.go new file mode 100644 index 000000000..1a6ec2972 --- /dev/null +++ b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_simple_test.go @@ -0,0 +1,120 @@ +package jsonpatch + +import ( + "sort" + "testing" + + "github.com/stretchr/testify/assert" +) + +var simpleA = `{"a":100, "b":200, "c":"hello"}` +var simpleB = `{"a":100, "b":200, "c":"goodbye"}` +var simpleC = `{"a":100, "b":100, "c":"hello"}` +var simpleD = `{"a":100, "b":200, "c":"hello", "d":"foo"}` +var simpleE = `{"a":100, "b":200}` +var simplef = `{"a":100, "b":100, "d":"foo"}` +var simpleG = `{"a":100, "b":null, "d":"foo"}` +var empty = `{}` + +func TestOneNullReplace(t *testing.T) { + patch, e := CreatePatch([]byte(simplef), []byte(simpleG)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 1, "they should be equal") + change := patch[0] + assert.Equal(t, change.Operation, "replace", "they should be equal") + assert.Equal(t, change.Path, "/b", "they should be equal") + assert.Equal(t, change.Value, nil, "they should be equal") +} + +func TestSame(t *testing.T) { + patch, e := CreatePatch([]byte(simpleA), []byte(simpleA)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 0, "they should be equal") +} + +func TestOneStringReplace(t *testing.T) { + patch, e := CreatePatch([]byte(simpleA), []byte(simpleB)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 1, "they should be equal") + change := patch[0] + assert.Equal(t, change.Operation, "replace", "they should be equal") + assert.Equal(t, change.Path, "/c", "they should be equal") + assert.Equal(t, change.Value, "goodbye", "they should be equal") +} + +func TestOneIntReplace(t *testing.T) { + patch, e := CreatePatch([]byte(simpleA), []byte(simpleC)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 1, "they should be equal") + change := patch[0] + assert.Equal(t, change.Operation, "replace", "they should be equal") + assert.Equal(t, change.Path, "/b", "they should be equal") + var expected float64 = 100 + assert.Equal(t, change.Value, expected, "they should be equal") +} + +func TestOneAdd(t *testing.T) { + patch, e := CreatePatch([]byte(simpleA), []byte(simpleD)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 1, "they should be equal") + change := patch[0] + assert.Equal(t, change.Operation, "add", "they should be equal") + assert.Equal(t, change.Path, "/d", "they should be equal") + assert.Equal(t, change.Value, "foo", "they should be equal") +} + +func TestOneRemove(t *testing.T) { + patch, e := CreatePatch([]byte(simpleA), []byte(simpleE)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 1, "they should be equal") + change := patch[0] + assert.Equal(t, change.Operation, "remove", "they should be equal") + assert.Equal(t, change.Path, "/c", "they should be equal") + assert.Equal(t, change.Value, nil, "they should be equal") +} + +func TestVsEmpty(t *testing.T) { + patch, e := CreatePatch([]byte(simpleA), []byte(empty)) + assert.NoError(t, e) + assert.Equal(t, len(patch), 3, "they should be equal") + sort.Sort(ByPath(patch)) + change := patch[0] + assert.Equal(t, change.Operation, "remove", "they should be equal") + assert.Equal(t, change.Path, "/a", "they should be equal") + + change = patch[1] + assert.Equal(t, change.Operation, "remove", "they should be equal") + assert.Equal(t, change.Path, "/b", "they should be equal") + + change = patch[2] + assert.Equal(t, change.Operation, "remove", "they should be equal") + assert.Equal(t, change.Path, "/c", "they should be equal") +} + +func BenchmarkBigArrays(b *testing.B) { + var a1, a2 []interface{} + a1 = make([]interface{}, 100) + a2 = make([]interface{}, 101) + + for i := 0; i < 100; i++ { + a1[i] = i + a2[i+1] = i + } + for i := 0; i < b.N; i++ { + compareArray(a1, a2, "/") + } +} + +func BenchmarkBigArrays2(b *testing.B) { + var a1, a2 []interface{} + a1 = make([]interface{}, 100) + a2 = make([]interface{}, 101) + + for i := 0; i < 100; i++ { + a1[i] = i + a2[i] = i + } + for i := 0; i < b.N; i++ { + compareArray(a1, a2, "/") + } +} diff --git a/vendor/github.com/mattbaird/jsonpatch/jsonpatch_supercomplex_test.go b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_supercomplex_test.go new file mode 100644 index 000000000..6e98f3a6a --- /dev/null +++ b/vendor/github.com/mattbaird/jsonpatch/jsonpatch_supercomplex_test.go @@ -0,0 +1,506 @@ +package jsonpatch + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +var superComplexBase = ` +{ + "annotations": { + "annotation": [ + { + "name": "version", + "value": "8" + }, + { + "name": "versionTag", + "value": "Published on May 13, 2015 at 8:48pm (MST)" + } + ] + }, + "attributes": { + "attribute-key": [ + { + "id": "3b05c943-d81a-436f-b242-8b519e7a6f30", + "properties": { + "visible": true + } + }, + { + "id": "d794c7ee-2a4b-4da4-bba7-e8b973d50c4b", + "properties": { + "visible": true + } + }, + { + "id": "a0259458-517c-480f-9f04-9b54b1b2af1f", + "properties": { + "visible": true + } + }, + { + "id": "9415f39d-c396-4458-9019-fc076c847964", + "properties": { + "visible": true + } + }, + { + "id": "0a2e49a9-8989-42fb-97da-cc66334f828b", + "properties": { + "visible": true + } + }, + { + "id": "27f5f14a-ea97-4feb-b22a-6ff754a31212", + "properties": { + "visible": true + } + }, + { + "id": "6f810508-4615-4fd0-9e87-80f9c94f9ad8", + "properties": { + "visible": true + } + }, + { + "id": "3451b1b2-7365-455c-8bb1-0b464d4d3ba1", + "properties": { + "visible": true + } + }, + { + "id": "a82ec957-8c26-41ea-8af6-6dd75c384801", + "properties": { + "visible": true + } + }, + { + "id": "736c5496-9a6e-4a82-aa00-456725796432", + "properties": { + "visible": true + } + }, + { + "id": "2d428b3c-9d3b-4ec1-bf98-e00673599d60", + "properties": { + "visible": true + } + }, + { + "id": "68566ebb-811d-4337-aba9-a8a8baf90e4b", + "properties": { + "visible": true + } + }, + { + "id": "ca88bab1-a1ea-40cc-8f96-96d1e9f1217d", + "properties": { + "visible": true + } + }, + { + "id": "c63a12c8-542d-47f3-bee1-30b5fe2b0690", + "properties": { + "visible": true + } + }, + { + "id": "cbd9e3bc-6a49-432a-a906-b1674c1de24c", + "properties": { + "visible": true + } + }, + { + "id": "03262f07-8a15-416d-a3f5-e2bf561c78f9", + "properties": { + "visible": true + } + }, + { + "id": "e5c93b87-83fc-45b6-b4d5-bf1e3f523075", + "properties": { + "visible": true + } + }, + { + "id": "72260ac5-3d51-49d7-bb31-f794dd129f1c", + "properties": { + "visible": true + } + }, + { + "id": "d856bde1-1b42-4935-9bee-c37e886c9ecf", + "properties": { + "visible": true + } + }, + { + "id": "62380509-bedf-4134-95c3-77ff377a4a6a", + "properties": { + "visible": true + } + }, + { + "id": "f4ed5ac9-b386-49a6-a0a0-6f3341ce9021", + "properties": { + "visible": true + } + }, + { + "id": "528d2bd2-87fe-4a49-954a-c93a03256929", + "properties": { + "visible": true + } + }, + { + "id": "ff8951f1-61a7-416b-9223-fac4bb6dac50", + "properties": { + "visible": true + } + }, + { + "id": "95c2b011-d782-4042-8a07-6aa4a5765c2e", + "properties": { + "visible": true + } + }, + { + "id": "dbe5837b-0624-4a05-91f3-67b5bd9b812a", + "properties": { + "visible": true + } + }, + { + "id": "13f198ed-82ab-4e51-8144-bfaa5bf77fd5", + "properties": { + "visible": true + } + }, + { + "id": "025312eb-12b6-47e6-9750-0fb31ddc2111", + "properties": { + "visible": true + } + }, + { + "id": "24292d58-db66-4ef3-8f4f-005d7b719433", + "properties": { + "visible": true + } + }, + { + "id": "22e5b5c4-821c-413a-a5b1-ab866d9a03bb", + "properties": { + "visible": true + } + }, + { + "id": "2fde0aac-df89-403d-998e-854b949c7b57", + "properties": { + "visible": true + } + }, + { + "id": "8b576876-5c16-4178-805e-24984c24fac3", + "properties": { + "visible": true + } + }, + { + "id": "415b7d2a-b362-4f1e-b83a-927802328ecb", + "properties": { + "visible": true + } + }, + { + "id": "8ef24fc2-ab25-4f22-9d9f-61902b49dc01", + "properties": { + "visible": true + } + }, + { + "id": "2299b09e-9f8e-4b79-a55c-a7edacde2c85", + "properties": { + "visible": true + } + }, + { + "id": "bf506538-f438-425c-be85-5aa2f9b075b8", + "properties": { + "visible": true + } + }, + { + "id": "2b501dc6-799d-4675-9144-fac77c50c57c", + "properties": { + "visible": true + } + }, + { + "id": "c0446da1-e069-417e-bd5a-34edcd028edc", + "properties": { + "visible": true + } + } + ] + } +}` + +var superComplexA = ` +{ + "annotations": { + "annotation": [ + { + "name": "version", + "value": "8" + }, + { + "name": "versionTag", + "value": "Published on May 13, 2015 at 8:48pm (MST)" + } + ] + }, + "attributes": { + "attribute-key": [ + { + "id": "3b05c943-d81a-436f-b242-8b519e7a6f30", + "properties": { + "visible": true + } + }, + { + "id": "d794c7ee-2a4b-4da4-bba7-e8b973d50c4b", + "properties": { + "visible": true + } + }, + { + "id": "a0259458-517c-480f-9f04-9b54b1b2af1f", + "properties": { + "visible": true + } + }, + { + "id": "9415f39d-c396-4458-9019-fc076c847964", + "properties": { + "visible": true + } + }, + { + "id": "0a2e49a9-8989-42fb-97da-cc66334f828b", + "properties": { + "visible": true + } + }, + { + "id": "27f5f14a-ea97-4feb-b22a-6ff754a31212", + "properties": { + "visible": true + } + }, + { + "id": "6f810508-4615-4fd0-9e87-80f9c94f9ad8", + "properties": { + "visible": true + } + }, + { + "id": "3451b1b2-7365-455c-8bb1-0b464d4d3ba1", + "properties": { + "visible": true + } + }, + { + "id": "a82ec957-8c26-41ea-8af6-6dd75c384801", + "properties": { + "visible": true + } + }, + { + "id": "736c5496-9a6e-4a82-aa00-456725796432", + "properties": { + "visible": true + } + }, + { + "id": "2d428b3c-9d3b-4ec1-bf98-e00673599d60", + "properties": { + "visible": true + } + }, + { + "id": "68566ebb-811d-4337-aba9-a8a8baf90e4b", + "properties": { + "visible": true + } + }, + { + "id": "ca88bab1-a1ea-40cc-8f96-96d1e9f1217d", + "properties": { + "visible": true + } + }, + { + "id": "c63a12c8-542d-47f3-bee1-30b5fe2b0690", + "properties": { + "visible": true + } + }, + { + "id": "cbd9e3bc-6a49-432a-a906-b1674c1de24c", + "properties": { + "visible": true + } + }, + { + "id": "03262f07-8a15-416d-a3f5-e2bf561c78f9", + "properties": { + "visible": true + } + }, + { + "id": "e5c93b87-83fc-45b6-b4d5-bf1e3f523075", + "properties": { + "visible": true + } + }, + { + "id": "72260ac5-3d51-49d7-bb31-f794dd129f1c", + "properties": { + "visible": true + } + }, + { + "id": "d856bde1-1b42-4935-9bee-c37e886c9ecf", + "properties": { + "visible": true + } + }, + { + "id": "62380509-bedf-4134-95c3-77ff377a4a6a", + "properties": { + "visible": true + } + }, + { + "id": "f4ed5ac9-b386-49a6-a0a0-6f3341ce9021", + "properties": { + "visible": true + } + }, + { + "id": "528d2bd2-87fe-4a49-954a-c93a03256929", + "properties": { + "visible": true + } + }, + { + "id": "ff8951f1-61a7-416b-9223-fac4bb6dac50", + "properties": { + "visible": true + } + }, + { + "id": "95c2b011-d782-4042-8a07-6aa4a5765c2e", + "properties": { + "visible": true + } + }, + { + "id": "dbe5837b-0624-4a05-91f3-67b5bd9b812a", + "properties": { + "visible": true + } + }, + { + "id": "13f198ed-82ab-4e51-8144-bfaa5bf77fd5", + "properties": { + "visible": true + } + }, + { + "id": "025312eb-12b6-47e6-9750-0fb31ddc2111", + "properties": { + "visible": true + } + }, + { + "id": "24292d58-db66-4ef3-8f4f-005d7b719433", + "properties": { + "visible": true + } + }, + { + "id": "22e5b5c4-821c-413a-a5b1-ab866d9a03bb", + "properties": { + "visible": true + } + }, + { + "id": "2fde0aac-df89-403d-998e-854b949c7b57", + "properties": { + "visible": true + } + }, + { + "id": "8b576876-5c16-4178-805e-24984c24fac3", + "properties": { + "visible": true + } + }, + { + "id": "415b7d2a-b362-4f1e-b83a-927802328ecb", + "properties": { + "visible": true + } + }, + { + "id": "8ef24fc2-ab25-4f22-9d9f-61902b49dc01", + "properties": { + "visible": true + } + }, + { + "id": "2299b09e-9f8e-4b79-a55c-a7edacde2c85", + "properties": { + "visible": true + } + }, + { + "id": "bf506538-f438-425c-be85-5aa2f9b075b8", + "properties": { + "visible": true + } + }, + { + "id": "2b501dc6-799d-4675-9144-fac77c50c57c", + "properties": { + "visible": true + } + }, + { + "id": "c0446da1-e069-417e-bd5a-34edcd028edc", + "properties": { + "visible": false + } + } + ] + } +}` + +func TestSuperComplexSame(t *testing.T) { + patch, e := CreatePatch([]byte(superComplexBase), []byte(superComplexBase)) + assert.NoError(t, e) + assert.Equal(t, 0, len(patch), "they should be equal") +} + +func TestSuperComplexBoolReplace(t *testing.T) { + patch, e := CreatePatch([]byte(superComplexBase), []byte(superComplexA)) + assert.NoError(t, e) + assert.Equal(t, 1, len(patch), "they should be equal") + change := patch[0] + assert.Equal(t, "replace", change.Operation, "they should be equal") + assert.Equal(t, "/attributes/attribute-key/36/properties/visible", change.Path, "they should be equal") + assert.Equal(t, false, change.Value, "they should be equal") +} diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/.travis.yml b/vendor/github.com/matttproud/golang_protobuf_extensions/.travis.yml deleted file mode 100644 index 5db258039..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go - -go: - - 1.5 - - 1.6 - - tip - -script: make -f Makefile.TRAVIS diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/Makefile.TRAVIS b/vendor/github.com/matttproud/golang_protobuf_extensions/Makefile.TRAVIS deleted file mode 100644 index 24f9649e2..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/Makefile.TRAVIS +++ /dev/null @@ -1,15 +0,0 @@ -all: build cover test vet - -build: - go build -v ./... - -cover: test - $(MAKE) -C pbutil cover - -test: build - go test -v ./... - -vet: build - go vet -v ./... - -.PHONY: build cover test vet diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE b/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE deleted file mode 100644 index 5d8cb5b72..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE +++ /dev/null @@ -1 +0,0 @@ -Copyright 2012 Matt T. Proud (matt.proud@gmail.com) diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/README.md b/vendor/github.com/matttproud/golang_protobuf_extensions/README.md deleted file mode 100644 index 751ee6967..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Overview -This repository provides various Protocol Buffer extensions for the Go -language (golang), namely support for record length-delimited message -streaming. - -| Java | Go | -| ------------------------------ | --------------------- | -| MessageLite#parseDelimitedFrom | pbutil.ReadDelimited | -| MessageLite#writeDelimitedTo | pbutil.WriteDelimited | - -Because [Code Review 9102043](https://codereview.appspot.com/9102043/) is -destined to never be merged into mainline (i.e., never be promoted to formal -[goprotobuf features](https://github.com/golang/protobuf)), this repository -will live here in the wild. - -# Documentation -We have [generated Go Doc documentation](http://godoc.org/github.com/matttproud/golang_protobuf_extensions/pbutil) here. - -# Testing -[![Build Status](https://travis-ci.org/matttproud/golang_protobuf_extensions.png?branch=master)](https://travis-ci.org/matttproud/golang_protobuf_extensions) diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/ext/moved.go b/vendor/github.com/matttproud/golang_protobuf_extensions/ext/moved.go deleted file mode 100644 index f31a0f049..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/ext/moved.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package ext moved to a new location: github.com/matttproud/golang_protobuf_extensions/pbutil. -package ext diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbtest/deleted.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbtest/deleted.go deleted file mode 100644 index 73efcb181..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbtest/deleted.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package pbtest is deleted for the time being, because upstream Protocol Buffer 3 may have rendered quick.Value-based blackbox generation impossible. -package pbtest diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore deleted file mode 100644 index e16fb946b..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cover.dat diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile deleted file mode 100644 index 81be21437..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - -cover: - go test -cover -v -coverprofile=cover.dat ./... - go tool cover -func cover.dat - -.PHONY: cover diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go deleted file mode 100644 index a793c8856..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/all_test.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2013 Matt T. Proud -// -// 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 pbutil - -import ( - "bytes" - "testing" - - "github.com/golang/protobuf/proto" - - . "github.com/matttproud/golang_protobuf_extensions/testdata" -) - -func TestWriteDelimited(t *testing.T) { - t.Parallel() - for _, test := range []struct { - msg proto.Message - buf []byte - n int - err error - }{ - { - msg: &Empty{}, - n: 1, - buf: []byte{0}, - }, - { - msg: &GoEnum{Foo: FOO_FOO1.Enum()}, - n: 3, - buf: []byte{2, 8, 1}, - }, - { - msg: &Strings{ - StringField: proto.String(`This is my gigantic, unhappy string. It exceeds -the encoding size of a single byte varint. We are using it to fuzz test the -correctness of the header decoding mechanisms, which may prove problematic. -I expect it may. Let's hope you enjoy testing as much as we do.`), - }, - n: 271, - buf: []byte{141, 2, 10, 138, 2, 84, 104, 105, 115, 32, 105, 115, 32, 109, - 121, 32, 103, 105, 103, 97, 110, 116, 105, 99, 44, 32, 117, 110, 104, - 97, 112, 112, 121, 32, 115, 116, 114, 105, 110, 103, 46, 32, 32, 73, - 116, 32, 101, 120, 99, 101, 101, 100, 115, 10, 116, 104, 101, 32, 101, - 110, 99, 111, 100, 105, 110, 103, 32, 115, 105, 122, 101, 32, 111, 102, - 32, 97, 32, 115, 105, 110, 103, 108, 101, 32, 98, 121, 116, 101, 32, - 118, 97, 114, 105, 110, 116, 46, 32, 32, 87, 101, 32, 97, 114, 101, 32, - 117, 115, 105, 110, 103, 32, 105, 116, 32, 116, 111, 32, 102, 117, 122, - 122, 32, 116, 101, 115, 116, 32, 116, 104, 101, 10, 99, 111, 114, 114, - 101, 99, 116, 110, 101, 115, 115, 32, 111, 102, 32, 116, 104, 101, 32, - 104, 101, 97, 100, 101, 114, 32, 100, 101, 99, 111, 100, 105, 110, 103, - 32, 109, 101, 99, 104, 97, 110, 105, 115, 109, 115, 44, 32, 119, 104, - 105, 99, 104, 32, 109, 97, 121, 32, 112, 114, 111, 118, 101, 32, 112, - 114, 111, 98, 108, 101, 109, 97, 116, 105, 99, 46, 10, 73, 32, 101, 120, - 112, 101, 99, 116, 32, 105, 116, 32, 109, 97, 121, 46, 32, 32, 76, 101, - 116, 39, 115, 32, 104, 111, 112, 101, 32, 121, 111, 117, 32, 101, 110, - 106, 111, 121, 32, 116, 101, 115, 116, 105, 110, 103, 32, 97, 115, 32, - 109, 117, 99, 104, 32, 97, 115, 32, 119, 101, 32, 100, 111, 46}, - }, - } { - var buf bytes.Buffer - if n, err := WriteDelimited(&buf, test.msg); n != test.n || err != test.err { - t.Fatalf("WriteDelimited(buf, %#v) = %v, %v; want %v, %v", test.msg, n, err, test.n, test.err) - } - if out := buf.Bytes(); !bytes.Equal(out, test.buf) { - t.Fatalf("WriteDelimited(buf, %#v); buf = %v; want %v", test.msg, out, test.buf) - } - } -} - -func TestReadDelimited(t *testing.T) { - t.Parallel() - for _, test := range []struct { - buf []byte - msg proto.Message - n int - err error - }{ - { - buf: []byte{0}, - msg: &Empty{}, - n: 1, - }, - { - n: 3, - buf: []byte{2, 8, 1}, - msg: &GoEnum{Foo: FOO_FOO1.Enum()}, - }, - { - buf: []byte{141, 2, 10, 138, 2, 84, 104, 105, 115, 32, 105, 115, 32, 109, - 121, 32, 103, 105, 103, 97, 110, 116, 105, 99, 44, 32, 117, 110, 104, - 97, 112, 112, 121, 32, 115, 116, 114, 105, 110, 103, 46, 32, 32, 73, - 116, 32, 101, 120, 99, 101, 101, 100, 115, 10, 116, 104, 101, 32, 101, - 110, 99, 111, 100, 105, 110, 103, 32, 115, 105, 122, 101, 32, 111, 102, - 32, 97, 32, 115, 105, 110, 103, 108, 101, 32, 98, 121, 116, 101, 32, - 118, 97, 114, 105, 110, 116, 46, 32, 32, 87, 101, 32, 97, 114, 101, 32, - 117, 115, 105, 110, 103, 32, 105, 116, 32, 116, 111, 32, 102, 117, 122, - 122, 32, 116, 101, 115, 116, 32, 116, 104, 101, 10, 99, 111, 114, 114, - 101, 99, 116, 110, 101, 115, 115, 32, 111, 102, 32, 116, 104, 101, 32, - 104, 101, 97, 100, 101, 114, 32, 100, 101, 99, 111, 100, 105, 110, 103, - 32, 109, 101, 99, 104, 97, 110, 105, 115, 109, 115, 44, 32, 119, 104, - 105, 99, 104, 32, 109, 97, 121, 32, 112, 114, 111, 118, 101, 32, 112, - 114, 111, 98, 108, 101, 109, 97, 116, 105, 99, 46, 10, 73, 32, 101, 120, - 112, 101, 99, 116, 32, 105, 116, 32, 109, 97, 121, 46, 32, 32, 76, 101, - 116, 39, 115, 32, 104, 111, 112, 101, 32, 121, 111, 117, 32, 101, 110, - 106, 111, 121, 32, 116, 101, 115, 116, 105, 110, 103, 32, 97, 115, 32, - 109, 117, 99, 104, 32, 97, 115, 32, 119, 101, 32, 100, 111, 46}, - msg: &Strings{ - StringField: proto.String(`This is my gigantic, unhappy string. It exceeds -the encoding size of a single byte varint. We are using it to fuzz test the -correctness of the header decoding mechanisms, which may prove problematic. -I expect it may. Let's hope you enjoy testing as much as we do.`), - }, - n: 271, - }, - } { - msg := proto.Clone(test.msg) - msg.Reset() - if n, err := ReadDelimited(bytes.NewBuffer(test.buf), msg); n != test.n || err != test.err { - t.Fatalf("ReadDelimited(%v, msg) = %v, %v; want %v, %v", test.buf, n, err, test.n, test.err) - } - if !proto.Equal(msg, test.msg) { - t.Fatalf("ReadDelimited(%v, msg); msg = %v; want %v", test.buf, msg, test.msg) - } - } -} - -func TestEndToEndValid(t *testing.T) { - t.Parallel() - for _, test := range [][]proto.Message{ - {&Empty{}}, - {&GoEnum{Foo: FOO_FOO1.Enum()}, &Empty{}, &GoEnum{Foo: FOO_FOO1.Enum()}}, - {&GoEnum{Foo: FOO_FOO1.Enum()}}, - {&Strings{ - StringField: proto.String(`This is my gigantic, unhappy string. It exceeds -the encoding size of a single byte varint. We are using it to fuzz test the -correctness of the header decoding mechanisms, which may prove problematic. -I expect it may. Let's hope you enjoy testing as much as we do.`), - }}, - } { - var buf bytes.Buffer - var written int - for i, msg := range test { - n, err := WriteDelimited(&buf, msg) - if err != nil { - // Assumption: TestReadDelimited and TestWriteDelimited are sufficient - // and inputs for this test are explicitly exercised there. - t.Fatalf("WriteDelimited(buf, %v[%d]) = ?, %v; wanted ?, nil", test, i, err) - } - written += n - } - var read int - for i, msg := range test { - out := proto.Clone(msg) - out.Reset() - n, _ := ReadDelimited(&buf, out) - // Decide to do EOF checking? - read += n - if !proto.Equal(out, msg) { - t.Fatalf("out = %v; want %v[%d] = %#v", out, test, i, msg) - } - } - if read != written { - t.Fatalf("%v read = %d; want %d", test, read, written) - } - } -} diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go deleted file mode 100644 index 258c0636a..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2013 Matt T. Proud -// -// 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 pbutil - -import ( - "encoding/binary" - "errors" - "io" - - "github.com/golang/protobuf/proto" -) - -var errInvalidVarint = errors.New("invalid varint32 encountered") - -// ReadDelimited decodes a message from the provided length-delimited stream, -// where the length is encoded as 32-bit varint prefix to the message body. -// It returns the total number of bytes read and any applicable error. This is -// roughly equivalent to the companion Java API's -// MessageLite#parseDelimitedFrom. As per the reader contract, this function -// calls r.Read repeatedly as required until exactly one message including its -// prefix is read and decoded (or an error has occurred). The function never -// reads more bytes from the stream than required. The function never returns -// an error if a message has been read and decoded correctly, even if the end -// of the stream has been reached in doing so. In that case, any subsequent -// calls return (0, io.EOF). -func ReadDelimited(r io.Reader, m proto.Message) (n int, err error) { - // Per AbstractParser#parsePartialDelimitedFrom with - // CodedInputStream#readRawVarint32. - var headerBuf [binary.MaxVarintLen32]byte - var bytesRead, varIntBytes int - var messageLength uint64 - for varIntBytes == 0 { // i.e. no varint has been decoded yet. - if bytesRead >= len(headerBuf) { - return bytesRead, errInvalidVarint - } - // We have to read byte by byte here to avoid reading more bytes - // than required. Each read byte is appended to what we have - // read before. - newBytesRead, err := r.Read(headerBuf[bytesRead : bytesRead+1]) - if newBytesRead == 0 { - if err != nil { - return bytesRead, err - } - // A Reader should not return (0, nil), but if it does, - // it should be treated as no-op (according to the - // Reader contract). So let's go on... - continue - } - bytesRead += newBytesRead - // Now present everything read so far to the varint decoder and - // see if a varint can be decoded already. - messageLength, varIntBytes = proto.DecodeVarint(headerBuf[:bytesRead]) - } - - messageBuf := make([]byte, messageLength) - newBytesRead, err := io.ReadFull(r, messageBuf) - bytesRead += newBytesRead - if err != nil { - return bytesRead, err - } - - return bytesRead, proto.Unmarshal(messageBuf, m) -} diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go deleted file mode 100644 index 364a7b799..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode_test.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2016 Matt T. Proud -// -// 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 pbutil - -import ( - "bytes" - "io" - "testing" - "testing/iotest" -) - -func TestReadDelimitedIllegalVarint(t *testing.T) { - t.Parallel() - var tests = []struct { - in []byte - n int - err error - }{ - { - in: []byte{255, 255, 255, 255, 255}, - n: 5, - err: errInvalidVarint, - }, - { - in: []byte{255, 255, 255, 255, 255, 255}, - n: 5, - err: errInvalidVarint, - }, - } - for _, test := range tests { - n, err := ReadDelimited(bytes.NewReader(test.in), nil) - if got, want := n, test.n; got != want { - t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", test.in, got, want) - } - if got, want := err, test.err; got != want { - t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", test.in, got, want) - } - } -} - -func TestReadDelimitedPrematureHeader(t *testing.T) { - t.Parallel() - var data = []byte{128, 5} // 256 + 256 + 128 - n, err := ReadDelimited(bytes.NewReader(data[0:1]), nil) - if got, want := n, 1; got != want { - t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", data[0:1], got, want) - } - if got, want := err, io.EOF; got != want { - t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", data[0:1], got, want) - } -} - -func TestReadDelimitedPrematureBody(t *testing.T) { - t.Parallel() - var data = []byte{128, 5, 0, 0, 0} // 256 + 256 + 128 - n, err := ReadDelimited(bytes.NewReader(data[:]), nil) - if got, want := n, 5; got != want { - t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", data, got, want) - } - if got, want := err, io.ErrUnexpectedEOF; got != want { - t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", data, got, want) - } -} - -func TestReadDelimitedPrematureHeaderIncremental(t *testing.T) { - t.Parallel() - var data = []byte{128, 5} // 256 + 256 + 128 - n, err := ReadDelimited(iotest.OneByteReader(bytes.NewReader(data[0:1])), nil) - if got, want := n, 1; got != want { - t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", data[0:1], got, want) - } - if got, want := err, io.EOF; got != want { - t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", data[0:1], got, want) - } -} - -func TestReadDelimitedPrematureBodyIncremental(t *testing.T) { - t.Parallel() - var data = []byte{128, 5, 0, 0, 0} // 256 + 256 + 128 - n, err := ReadDelimited(iotest.OneByteReader(bytes.NewReader(data[:])), nil) - if got, want := n, 5; got != want { - t.Errorf("ReadDelimited(%#v, nil) = %#v, ?; want = %v#, ?", data, got, want) - } - if got, want := err, io.ErrUnexpectedEOF; got != want { - t.Errorf("ReadDelimited(%#v, nil) = ?, %#v; want = ?, %#v", data, got, want) - } -} diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go deleted file mode 100644 index c318385cb..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 Matt T. Proud -// -// 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 pbutil provides record length-delimited Protocol Buffer streaming. -package pbutil diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go deleted file mode 100644 index 8fb59ad22..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2013 Matt T. Proud -// -// 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 pbutil - -import ( - "encoding/binary" - "io" - - "github.com/golang/protobuf/proto" -) - -// WriteDelimited encodes and dumps a message to the provided writer prefixed -// with a 32-bit varint indicating the length of the encoded message, producing -// a length-delimited record stream, which can be used to chain together -// encoded messages of the same type together in a file. It returns the total -// number of bytes written and any applicable error. This is roughly -// equivalent to the companion Java API's MessageLite#writeDelimitedTo. -func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) { - buffer, err := proto.Marshal(m) - if err != nil { - return 0, err - } - - var buf [binary.MaxVarintLen32]byte - encodedLength := binary.PutUvarint(buf[:], uint64(len(buffer))) - - sync, err := w.Write(buf[:encodedLength]) - if err != nil { - return sync, err - } - - n, err = w.Write(buffer) - return n + sync, err -} diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go deleted file mode 100644 index f92632b0b..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode_test.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2016 Matt T. Proud -// -// 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 pbutil - -import ( - "bytes" - "errors" - "testing" - - "github.com/golang/protobuf/proto" -) - -var errMarshal = errors.New("pbutil: can't marshal") - -type cantMarshal struct{ proto.Message } - -func (cantMarshal) Marshal() ([]byte, error) { return nil, errMarshal } - -var _ proto.Message = cantMarshal{} - -func TestWriteDelimitedMarshalErr(t *testing.T) { - t.Parallel() - var data cantMarshal - var buf bytes.Buffer - n, err := WriteDelimited(&buf, data) - if got, want := n, 0; got != want { - t.Errorf("WriteDelimited(buf, %#v) = %#v, ?; want = %v#, ?", data, got, want) - } - if got, want := err, errMarshal; got != want { - t.Errorf("WriteDelimited(buf, %#v) = ?, %#v; want = ?, %#v", data, got, want) - } -} - -type canMarshal struct{ proto.Message } - -func (canMarshal) Marshal() ([]byte, error) { return []byte{0, 1, 2, 3, 4, 5}, nil } - -var errWrite = errors.New("pbutil: can't write") - -type cantWrite struct{} - -func (cantWrite) Write([]byte) (int, error) { return 0, errWrite } - -func TestWriteDelimitedWriteErr(t *testing.T) { - t.Parallel() - var data canMarshal - var buf cantWrite - n, err := WriteDelimited(buf, data) - if got, want := n, 0; got != want { - t.Errorf("WriteDelimited(buf, %#v) = %#v, ?; want = %v#, ?", data, got, want) - } - if got, want := err, errWrite; got != want { - t.Errorf("WriteDelimited(buf, %#v) = ?, %#v; want = ?, %#v", data, got, want) - } -} diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/README.THIRD_PARTY b/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/README.THIRD_PARTY deleted file mode 100644 index 0c1f84246..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/README.THIRD_PARTY +++ /dev/null @@ -1,4 +0,0 @@ -test.pb.go and test.proto are third-party data. - -SOURCE: https://github.com/golang/protobuf -REVISION: bf531ff1a004f24ee53329dfd5ce0b41bfdc17df diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/test.pb.go b/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/test.pb.go deleted file mode 100644 index 772adcb62..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/test.pb.go +++ /dev/null @@ -1,4029 +0,0 @@ -// Code generated by protoc-gen-go. -// source: test.proto -// DO NOT EDIT! - -/* -Package testdata is a generated protocol buffer package. - -It is generated from these files: - test.proto - -It has these top-level messages: - GoEnum - GoTestField - GoTest - GoSkipTest - NonPackedTest - PackedTest - MaxTag - OldMessage - NewMessage - InnerMessage - OtherMessage - RequiredInnerMessage - MyMessage - Ext - ComplexExtension - DefaultsMessage - MyMessageSet - Empty - MessageList - Strings - Defaults - SubDefaults - RepeatedEnum - MoreRepeated - GroupOld - GroupNew - FloatingPoint - MessageWithMap - Oneof - Communique -*/ -package testdata - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -const _ = proto.ProtoPackageIsVersion1 - -type FOO int32 - -const ( - FOO_FOO1 FOO = 1 -) - -var FOO_name = map[int32]string{ - 1: "FOO1", -} -var FOO_value = map[string]int32{ - "FOO1": 1, -} - -func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p -} -func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) -} -func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data, "FOO") - if err != nil { - return err - } - *x = FOO(value) - return nil -} -func (FOO) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -// An enum, for completeness. -type GoTest_KIND int32 - -const ( - GoTest_VOID GoTest_KIND = 0 - // Basic types - GoTest_BOOL GoTest_KIND = 1 - GoTest_BYTES GoTest_KIND = 2 - GoTest_FINGERPRINT GoTest_KIND = 3 - GoTest_FLOAT GoTest_KIND = 4 - GoTest_INT GoTest_KIND = 5 - GoTest_STRING GoTest_KIND = 6 - GoTest_TIME GoTest_KIND = 7 - // Groupings - GoTest_TUPLE GoTest_KIND = 8 - GoTest_ARRAY GoTest_KIND = 9 - GoTest_MAP GoTest_KIND = 10 - // Table types - GoTest_TABLE GoTest_KIND = 11 - // Functions - GoTest_FUNCTION GoTest_KIND = 12 -) - -var GoTest_KIND_name = map[int32]string{ - 0: "VOID", - 1: "BOOL", - 2: "BYTES", - 3: "FINGERPRINT", - 4: "FLOAT", - 5: "INT", - 6: "STRING", - 7: "TIME", - 8: "TUPLE", - 9: "ARRAY", - 10: "MAP", - 11: "TABLE", - 12: "FUNCTION", -} -var GoTest_KIND_value = map[string]int32{ - "VOID": 0, - "BOOL": 1, - "BYTES": 2, - "FINGERPRINT": 3, - "FLOAT": 4, - "INT": 5, - "STRING": 6, - "TIME": 7, - "TUPLE": 8, - "ARRAY": 9, - "MAP": 10, - "TABLE": 11, - "FUNCTION": 12, -} - -func (x GoTest_KIND) Enum() *GoTest_KIND { - p := new(GoTest_KIND) - *p = x - return p -} -func (x GoTest_KIND) String() string { - return proto.EnumName(GoTest_KIND_name, int32(x)) -} -func (x *GoTest_KIND) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(GoTest_KIND_value, data, "GoTest_KIND") - if err != nil { - return err - } - *x = GoTest_KIND(value) - return nil -} -func (GoTest_KIND) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } - -type MyMessage_Color int32 - -const ( - MyMessage_RED MyMessage_Color = 0 - MyMessage_GREEN MyMessage_Color = 1 - MyMessage_BLUE MyMessage_Color = 2 -) - -var MyMessage_Color_name = map[int32]string{ - 0: "RED", - 1: "GREEN", - 2: "BLUE", -} -var MyMessage_Color_value = map[string]int32{ - "RED": 0, - "GREEN": 1, - "BLUE": 2, -} - -func (x MyMessage_Color) Enum() *MyMessage_Color { - p := new(MyMessage_Color) - *p = x - return p -} -func (x MyMessage_Color) String() string { - return proto.EnumName(MyMessage_Color_name, int32(x)) -} -func (x *MyMessage_Color) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(MyMessage_Color_value, data, "MyMessage_Color") - if err != nil { - return err - } - *x = MyMessage_Color(value) - return nil -} -func (MyMessage_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 0} } - -type DefaultsMessage_DefaultsEnum int32 - -const ( - DefaultsMessage_ZERO DefaultsMessage_DefaultsEnum = 0 - DefaultsMessage_ONE DefaultsMessage_DefaultsEnum = 1 - DefaultsMessage_TWO DefaultsMessage_DefaultsEnum = 2 -) - -var DefaultsMessage_DefaultsEnum_name = map[int32]string{ - 0: "ZERO", - 1: "ONE", - 2: "TWO", -} -var DefaultsMessage_DefaultsEnum_value = map[string]int32{ - "ZERO": 0, - "ONE": 1, - "TWO": 2, -} - -func (x DefaultsMessage_DefaultsEnum) Enum() *DefaultsMessage_DefaultsEnum { - p := new(DefaultsMessage_DefaultsEnum) - *p = x - return p -} -func (x DefaultsMessage_DefaultsEnum) String() string { - return proto.EnumName(DefaultsMessage_DefaultsEnum_name, int32(x)) -} -func (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(DefaultsMessage_DefaultsEnum_value, data, "DefaultsMessage_DefaultsEnum") - if err != nil { - return err - } - *x = DefaultsMessage_DefaultsEnum(value) - return nil -} -func (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{15, 0} -} - -type Defaults_Color int32 - -const ( - Defaults_RED Defaults_Color = 0 - Defaults_GREEN Defaults_Color = 1 - Defaults_BLUE Defaults_Color = 2 -) - -var Defaults_Color_name = map[int32]string{ - 0: "RED", - 1: "GREEN", - 2: "BLUE", -} -var Defaults_Color_value = map[string]int32{ - "RED": 0, - "GREEN": 1, - "BLUE": 2, -} - -func (x Defaults_Color) Enum() *Defaults_Color { - p := new(Defaults_Color) - *p = x - return p -} -func (x Defaults_Color) String() string { - return proto.EnumName(Defaults_Color_name, int32(x)) -} -func (x *Defaults_Color) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(Defaults_Color_value, data, "Defaults_Color") - if err != nil { - return err - } - *x = Defaults_Color(value) - return nil -} -func (Defaults_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{20, 0} } - -type RepeatedEnum_Color int32 - -const ( - RepeatedEnum_RED RepeatedEnum_Color = 1 -) - -var RepeatedEnum_Color_name = map[int32]string{ - 1: "RED", -} -var RepeatedEnum_Color_value = map[string]int32{ - "RED": 1, -} - -func (x RepeatedEnum_Color) Enum() *RepeatedEnum_Color { - p := new(RepeatedEnum_Color) - *p = x - return p -} -func (x RepeatedEnum_Color) String() string { - return proto.EnumName(RepeatedEnum_Color_name, int32(x)) -} -func (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(RepeatedEnum_Color_value, data, "RepeatedEnum_Color") - if err != nil { - return err - } - *x = RepeatedEnum_Color(value) - return nil -} -func (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{22, 0} } - -type GoEnum struct { - Foo *FOO `protobuf:"varint,1,req,name=foo,enum=testdata.FOO" json:"foo,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoEnum) Reset() { *m = GoEnum{} } -func (m *GoEnum) String() string { return proto.CompactTextString(m) } -func (*GoEnum) ProtoMessage() {} -func (*GoEnum) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *GoEnum) GetFoo() FOO { - if m != nil && m.Foo != nil { - return *m.Foo - } - return FOO_FOO1 -} - -type GoTestField struct { - Label *string `protobuf:"bytes,1,req,name=Label,json=label" json:"Label,omitempty"` - Type *string `protobuf:"bytes,2,req,name=Type,json=type" json:"Type,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTestField) Reset() { *m = GoTestField{} } -func (m *GoTestField) String() string { return proto.CompactTextString(m) } -func (*GoTestField) ProtoMessage() {} -func (*GoTestField) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *GoTestField) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" -} - -func (m *GoTestField) GetType() string { - if m != nil && m.Type != nil { - return *m.Type - } - return "" -} - -type GoTest struct { - // Some typical parameters - Kind *GoTest_KIND `protobuf:"varint,1,req,name=Kind,json=kind,enum=testdata.GoTest_KIND" json:"Kind,omitempty"` - Table *string `protobuf:"bytes,2,opt,name=Table,json=table" json:"Table,omitempty"` - Param *int32 `protobuf:"varint,3,opt,name=Param,json=param" json:"Param,omitempty"` - // Required, repeated and optional foreign fields. - RequiredField *GoTestField `protobuf:"bytes,4,req,name=RequiredField,json=requiredField" json:"RequiredField,omitempty"` - RepeatedField []*GoTestField `protobuf:"bytes,5,rep,name=RepeatedField,json=repeatedField" json:"RepeatedField,omitempty"` - OptionalField *GoTestField `protobuf:"bytes,6,opt,name=OptionalField,json=optionalField" json:"OptionalField,omitempty"` - // Required fields of all basic types - F_BoolRequired *bool `protobuf:"varint,10,req,name=F_Bool_required,json=fBoolRequired" json:"F_Bool_required,omitempty"` - F_Int32Required *int32 `protobuf:"varint,11,req,name=F_Int32_required,json=fInt32Required" json:"F_Int32_required,omitempty"` - F_Int64Required *int64 `protobuf:"varint,12,req,name=F_Int64_required,json=fInt64Required" json:"F_Int64_required,omitempty"` - F_Fixed32Required *uint32 `protobuf:"fixed32,13,req,name=F_Fixed32_required,json=fFixed32Required" json:"F_Fixed32_required,omitempty"` - F_Fixed64Required *uint64 `protobuf:"fixed64,14,req,name=F_Fixed64_required,json=fFixed64Required" json:"F_Fixed64_required,omitempty"` - F_Uint32Required *uint32 `protobuf:"varint,15,req,name=F_Uint32_required,json=fUint32Required" json:"F_Uint32_required,omitempty"` - F_Uint64Required *uint64 `protobuf:"varint,16,req,name=F_Uint64_required,json=fUint64Required" json:"F_Uint64_required,omitempty"` - F_FloatRequired *float32 `protobuf:"fixed32,17,req,name=F_Float_required,json=fFloatRequired" json:"F_Float_required,omitempty"` - F_DoubleRequired *float64 `protobuf:"fixed64,18,req,name=F_Double_required,json=fDoubleRequired" json:"F_Double_required,omitempty"` - F_StringRequired *string `protobuf:"bytes,19,req,name=F_String_required,json=fStringRequired" json:"F_String_required,omitempty"` - F_BytesRequired []byte `protobuf:"bytes,101,req,name=F_Bytes_required,json=fBytesRequired" json:"F_Bytes_required,omitempty"` - F_Sint32Required *int32 `protobuf:"zigzag32,102,req,name=F_Sint32_required,json=fSint32Required" json:"F_Sint32_required,omitempty"` - F_Sint64Required *int64 `protobuf:"zigzag64,103,req,name=F_Sint64_required,json=fSint64Required" json:"F_Sint64_required,omitempty"` - // Repeated fields of all basic types - F_BoolRepeated []bool `protobuf:"varint,20,rep,name=F_Bool_repeated,json=fBoolRepeated" json:"F_Bool_repeated,omitempty"` - F_Int32Repeated []int32 `protobuf:"varint,21,rep,name=F_Int32_repeated,json=fInt32Repeated" json:"F_Int32_repeated,omitempty"` - F_Int64Repeated []int64 `protobuf:"varint,22,rep,name=F_Int64_repeated,json=fInt64Repeated" json:"F_Int64_repeated,omitempty"` - F_Fixed32Repeated []uint32 `protobuf:"fixed32,23,rep,name=F_Fixed32_repeated,json=fFixed32Repeated" json:"F_Fixed32_repeated,omitempty"` - F_Fixed64Repeated []uint64 `protobuf:"fixed64,24,rep,name=F_Fixed64_repeated,json=fFixed64Repeated" json:"F_Fixed64_repeated,omitempty"` - F_Uint32Repeated []uint32 `protobuf:"varint,25,rep,name=F_Uint32_repeated,json=fUint32Repeated" json:"F_Uint32_repeated,omitempty"` - F_Uint64Repeated []uint64 `protobuf:"varint,26,rep,name=F_Uint64_repeated,json=fUint64Repeated" json:"F_Uint64_repeated,omitempty"` - F_FloatRepeated []float32 `protobuf:"fixed32,27,rep,name=F_Float_repeated,json=fFloatRepeated" json:"F_Float_repeated,omitempty"` - F_DoubleRepeated []float64 `protobuf:"fixed64,28,rep,name=F_Double_repeated,json=fDoubleRepeated" json:"F_Double_repeated,omitempty"` - F_StringRepeated []string `protobuf:"bytes,29,rep,name=F_String_repeated,json=fStringRepeated" json:"F_String_repeated,omitempty"` - F_BytesRepeated [][]byte `protobuf:"bytes,201,rep,name=F_Bytes_repeated,json=fBytesRepeated" json:"F_Bytes_repeated,omitempty"` - F_Sint32Repeated []int32 `protobuf:"zigzag32,202,rep,name=F_Sint32_repeated,json=fSint32Repeated" json:"F_Sint32_repeated,omitempty"` - F_Sint64Repeated []int64 `protobuf:"zigzag64,203,rep,name=F_Sint64_repeated,json=fSint64Repeated" json:"F_Sint64_repeated,omitempty"` - // Optional fields of all basic types - F_BoolOptional *bool `protobuf:"varint,30,opt,name=F_Bool_optional,json=fBoolOptional" json:"F_Bool_optional,omitempty"` - F_Int32Optional *int32 `protobuf:"varint,31,opt,name=F_Int32_optional,json=fInt32Optional" json:"F_Int32_optional,omitempty"` - F_Int64Optional *int64 `protobuf:"varint,32,opt,name=F_Int64_optional,json=fInt64Optional" json:"F_Int64_optional,omitempty"` - F_Fixed32Optional *uint32 `protobuf:"fixed32,33,opt,name=F_Fixed32_optional,json=fFixed32Optional" json:"F_Fixed32_optional,omitempty"` - F_Fixed64Optional *uint64 `protobuf:"fixed64,34,opt,name=F_Fixed64_optional,json=fFixed64Optional" json:"F_Fixed64_optional,omitempty"` - F_Uint32Optional *uint32 `protobuf:"varint,35,opt,name=F_Uint32_optional,json=fUint32Optional" json:"F_Uint32_optional,omitempty"` - F_Uint64Optional *uint64 `protobuf:"varint,36,opt,name=F_Uint64_optional,json=fUint64Optional" json:"F_Uint64_optional,omitempty"` - F_FloatOptional *float32 `protobuf:"fixed32,37,opt,name=F_Float_optional,json=fFloatOptional" json:"F_Float_optional,omitempty"` - F_DoubleOptional *float64 `protobuf:"fixed64,38,opt,name=F_Double_optional,json=fDoubleOptional" json:"F_Double_optional,omitempty"` - F_StringOptional *string `protobuf:"bytes,39,opt,name=F_String_optional,json=fStringOptional" json:"F_String_optional,omitempty"` - F_BytesOptional []byte `protobuf:"bytes,301,opt,name=F_Bytes_optional,json=fBytesOptional" json:"F_Bytes_optional,omitempty"` - F_Sint32Optional *int32 `protobuf:"zigzag32,302,opt,name=F_Sint32_optional,json=fSint32Optional" json:"F_Sint32_optional,omitempty"` - F_Sint64Optional *int64 `protobuf:"zigzag64,303,opt,name=F_Sint64_optional,json=fSint64Optional" json:"F_Sint64_optional,omitempty"` - // Default-valued fields of all basic types - F_BoolDefaulted *bool `protobuf:"varint,40,opt,name=F_Bool_defaulted,json=fBoolDefaulted,def=1" json:"F_Bool_defaulted,omitempty"` - F_Int32Defaulted *int32 `protobuf:"varint,41,opt,name=F_Int32_defaulted,json=fInt32Defaulted,def=32" json:"F_Int32_defaulted,omitempty"` - F_Int64Defaulted *int64 `protobuf:"varint,42,opt,name=F_Int64_defaulted,json=fInt64Defaulted,def=64" json:"F_Int64_defaulted,omitempty"` - F_Fixed32Defaulted *uint32 `protobuf:"fixed32,43,opt,name=F_Fixed32_defaulted,json=fFixed32Defaulted,def=320" json:"F_Fixed32_defaulted,omitempty"` - F_Fixed64Defaulted *uint64 `protobuf:"fixed64,44,opt,name=F_Fixed64_defaulted,json=fFixed64Defaulted,def=640" json:"F_Fixed64_defaulted,omitempty"` - F_Uint32Defaulted *uint32 `protobuf:"varint,45,opt,name=F_Uint32_defaulted,json=fUint32Defaulted,def=3200" json:"F_Uint32_defaulted,omitempty"` - F_Uint64Defaulted *uint64 `protobuf:"varint,46,opt,name=F_Uint64_defaulted,json=fUint64Defaulted,def=6400" json:"F_Uint64_defaulted,omitempty"` - F_FloatDefaulted *float32 `protobuf:"fixed32,47,opt,name=F_Float_defaulted,json=fFloatDefaulted,def=314159" json:"F_Float_defaulted,omitempty"` - F_DoubleDefaulted *float64 `protobuf:"fixed64,48,opt,name=F_Double_defaulted,json=fDoubleDefaulted,def=271828" json:"F_Double_defaulted,omitempty"` - F_StringDefaulted *string `protobuf:"bytes,49,opt,name=F_String_defaulted,json=fStringDefaulted,def=hello, \"world!\"\n" json:"F_String_defaulted,omitempty"` - F_BytesDefaulted []byte `protobuf:"bytes,401,opt,name=F_Bytes_defaulted,json=fBytesDefaulted,def=Bignose" json:"F_Bytes_defaulted,omitempty"` - F_Sint32Defaulted *int32 `protobuf:"zigzag32,402,opt,name=F_Sint32_defaulted,json=fSint32Defaulted,def=-32" json:"F_Sint32_defaulted,omitempty"` - F_Sint64Defaulted *int64 `protobuf:"zigzag64,403,opt,name=F_Sint64_defaulted,json=fSint64Defaulted,def=-64" json:"F_Sint64_defaulted,omitempty"` - // Packed repeated fields (no string or bytes). - F_BoolRepeatedPacked []bool `protobuf:"varint,50,rep,packed,name=F_Bool_repeated_packed,json=fBoolRepeatedPacked" json:"F_Bool_repeated_packed,omitempty"` - F_Int32RepeatedPacked []int32 `protobuf:"varint,51,rep,packed,name=F_Int32_repeated_packed,json=fInt32RepeatedPacked" json:"F_Int32_repeated_packed,omitempty"` - F_Int64RepeatedPacked []int64 `protobuf:"varint,52,rep,packed,name=F_Int64_repeated_packed,json=fInt64RepeatedPacked" json:"F_Int64_repeated_packed,omitempty"` - F_Fixed32RepeatedPacked []uint32 `protobuf:"fixed32,53,rep,packed,name=F_Fixed32_repeated_packed,json=fFixed32RepeatedPacked" json:"F_Fixed32_repeated_packed,omitempty"` - F_Fixed64RepeatedPacked []uint64 `protobuf:"fixed64,54,rep,packed,name=F_Fixed64_repeated_packed,json=fFixed64RepeatedPacked" json:"F_Fixed64_repeated_packed,omitempty"` - F_Uint32RepeatedPacked []uint32 `protobuf:"varint,55,rep,packed,name=F_Uint32_repeated_packed,json=fUint32RepeatedPacked" json:"F_Uint32_repeated_packed,omitempty"` - F_Uint64RepeatedPacked []uint64 `protobuf:"varint,56,rep,packed,name=F_Uint64_repeated_packed,json=fUint64RepeatedPacked" json:"F_Uint64_repeated_packed,omitempty"` - F_FloatRepeatedPacked []float32 `protobuf:"fixed32,57,rep,packed,name=F_Float_repeated_packed,json=fFloatRepeatedPacked" json:"F_Float_repeated_packed,omitempty"` - F_DoubleRepeatedPacked []float64 `protobuf:"fixed64,58,rep,packed,name=F_Double_repeated_packed,json=fDoubleRepeatedPacked" json:"F_Double_repeated_packed,omitempty"` - F_Sint32RepeatedPacked []int32 `protobuf:"zigzag32,502,rep,packed,name=F_Sint32_repeated_packed,json=fSint32RepeatedPacked" json:"F_Sint32_repeated_packed,omitempty"` - F_Sint64RepeatedPacked []int64 `protobuf:"zigzag64,503,rep,packed,name=F_Sint64_repeated_packed,json=fSint64RepeatedPacked" json:"F_Sint64_repeated_packed,omitempty"` - Requiredgroup *GoTest_RequiredGroup `protobuf:"group,70,req,name=RequiredGroup,json=requiredgroup" json:"requiredgroup,omitempty"` - Repeatedgroup []*GoTest_RepeatedGroup `protobuf:"group,80,rep,name=RepeatedGroup,json=repeatedgroup" json:"repeatedgroup,omitempty"` - Optionalgroup *GoTest_OptionalGroup `protobuf:"group,90,opt,name=OptionalGroup,json=optionalgroup" json:"optionalgroup,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTest) Reset() { *m = GoTest{} } -func (m *GoTest) String() string { return proto.CompactTextString(m) } -func (*GoTest) ProtoMessage() {} -func (*GoTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -const Default_GoTest_F_BoolDefaulted bool = true -const Default_GoTest_F_Int32Defaulted int32 = 32 -const Default_GoTest_F_Int64Defaulted int64 = 64 -const Default_GoTest_F_Fixed32Defaulted uint32 = 320 -const Default_GoTest_F_Fixed64Defaulted uint64 = 640 -const Default_GoTest_F_Uint32Defaulted uint32 = 3200 -const Default_GoTest_F_Uint64Defaulted uint64 = 6400 -const Default_GoTest_F_FloatDefaulted float32 = 314159 -const Default_GoTest_F_DoubleDefaulted float64 = 271828 -const Default_GoTest_F_StringDefaulted string = "hello, \"world!\"\n" - -var Default_GoTest_F_BytesDefaulted []byte = []byte("Bignose") - -const Default_GoTest_F_Sint32Defaulted int32 = -32 -const Default_GoTest_F_Sint64Defaulted int64 = -64 - -func (m *GoTest) GetKind() GoTest_KIND { - if m != nil && m.Kind != nil { - return *m.Kind - } - return GoTest_VOID -} - -func (m *GoTest) GetTable() string { - if m != nil && m.Table != nil { - return *m.Table - } - return "" -} - -func (m *GoTest) GetParam() int32 { - if m != nil && m.Param != nil { - return *m.Param - } - return 0 -} - -func (m *GoTest) GetRequiredField() *GoTestField { - if m != nil { - return m.RequiredField - } - return nil -} - -func (m *GoTest) GetRepeatedField() []*GoTestField { - if m != nil { - return m.RepeatedField - } - return nil -} - -func (m *GoTest) GetOptionalField() *GoTestField { - if m != nil { - return m.OptionalField - } - return nil -} - -func (m *GoTest) GetF_BoolRequired() bool { - if m != nil && m.F_BoolRequired != nil { - return *m.F_BoolRequired - } - return false -} - -func (m *GoTest) GetF_Int32Required() int32 { - if m != nil && m.F_Int32Required != nil { - return *m.F_Int32Required - } - return 0 -} - -func (m *GoTest) GetF_Int64Required() int64 { - if m != nil && m.F_Int64Required != nil { - return *m.F_Int64Required - } - return 0 -} - -func (m *GoTest) GetF_Fixed32Required() uint32 { - if m != nil && m.F_Fixed32Required != nil { - return *m.F_Fixed32Required - } - return 0 -} - -func (m *GoTest) GetF_Fixed64Required() uint64 { - if m != nil && m.F_Fixed64Required != nil { - return *m.F_Fixed64Required - } - return 0 -} - -func (m *GoTest) GetF_Uint32Required() uint32 { - if m != nil && m.F_Uint32Required != nil { - return *m.F_Uint32Required - } - return 0 -} - -func (m *GoTest) GetF_Uint64Required() uint64 { - if m != nil && m.F_Uint64Required != nil { - return *m.F_Uint64Required - } - return 0 -} - -func (m *GoTest) GetF_FloatRequired() float32 { - if m != nil && m.F_FloatRequired != nil { - return *m.F_FloatRequired - } - return 0 -} - -func (m *GoTest) GetF_DoubleRequired() float64 { - if m != nil && m.F_DoubleRequired != nil { - return *m.F_DoubleRequired - } - return 0 -} - -func (m *GoTest) GetF_StringRequired() string { - if m != nil && m.F_StringRequired != nil { - return *m.F_StringRequired - } - return "" -} - -func (m *GoTest) GetF_BytesRequired() []byte { - if m != nil { - return m.F_BytesRequired - } - return nil -} - -func (m *GoTest) GetF_Sint32Required() int32 { - if m != nil && m.F_Sint32Required != nil { - return *m.F_Sint32Required - } - return 0 -} - -func (m *GoTest) GetF_Sint64Required() int64 { - if m != nil && m.F_Sint64Required != nil { - return *m.F_Sint64Required - } - return 0 -} - -func (m *GoTest) GetF_BoolRepeated() []bool { - if m != nil { - return m.F_BoolRepeated - } - return nil -} - -func (m *GoTest) GetF_Int32Repeated() []int32 { - if m != nil { - return m.F_Int32Repeated - } - return nil -} - -func (m *GoTest) GetF_Int64Repeated() []int64 { - if m != nil { - return m.F_Int64Repeated - } - return nil -} - -func (m *GoTest) GetF_Fixed32Repeated() []uint32 { - if m != nil { - return m.F_Fixed32Repeated - } - return nil -} - -func (m *GoTest) GetF_Fixed64Repeated() []uint64 { - if m != nil { - return m.F_Fixed64Repeated - } - return nil -} - -func (m *GoTest) GetF_Uint32Repeated() []uint32 { - if m != nil { - return m.F_Uint32Repeated - } - return nil -} - -func (m *GoTest) GetF_Uint64Repeated() []uint64 { - if m != nil { - return m.F_Uint64Repeated - } - return nil -} - -func (m *GoTest) GetF_FloatRepeated() []float32 { - if m != nil { - return m.F_FloatRepeated - } - return nil -} - -func (m *GoTest) GetF_DoubleRepeated() []float64 { - if m != nil { - return m.F_DoubleRepeated - } - return nil -} - -func (m *GoTest) GetF_StringRepeated() []string { - if m != nil { - return m.F_StringRepeated - } - return nil -} - -func (m *GoTest) GetF_BytesRepeated() [][]byte { - if m != nil { - return m.F_BytesRepeated - } - return nil -} - -func (m *GoTest) GetF_Sint32Repeated() []int32 { - if m != nil { - return m.F_Sint32Repeated - } - return nil -} - -func (m *GoTest) GetF_Sint64Repeated() []int64 { - if m != nil { - return m.F_Sint64Repeated - } - return nil -} - -func (m *GoTest) GetF_BoolOptional() bool { - if m != nil && m.F_BoolOptional != nil { - return *m.F_BoolOptional - } - return false -} - -func (m *GoTest) GetF_Int32Optional() int32 { - if m != nil && m.F_Int32Optional != nil { - return *m.F_Int32Optional - } - return 0 -} - -func (m *GoTest) GetF_Int64Optional() int64 { - if m != nil && m.F_Int64Optional != nil { - return *m.F_Int64Optional - } - return 0 -} - -func (m *GoTest) GetF_Fixed32Optional() uint32 { - if m != nil && m.F_Fixed32Optional != nil { - return *m.F_Fixed32Optional - } - return 0 -} - -func (m *GoTest) GetF_Fixed64Optional() uint64 { - if m != nil && m.F_Fixed64Optional != nil { - return *m.F_Fixed64Optional - } - return 0 -} - -func (m *GoTest) GetF_Uint32Optional() uint32 { - if m != nil && m.F_Uint32Optional != nil { - return *m.F_Uint32Optional - } - return 0 -} - -func (m *GoTest) GetF_Uint64Optional() uint64 { - if m != nil && m.F_Uint64Optional != nil { - return *m.F_Uint64Optional - } - return 0 -} - -func (m *GoTest) GetF_FloatOptional() float32 { - if m != nil && m.F_FloatOptional != nil { - return *m.F_FloatOptional - } - return 0 -} - -func (m *GoTest) GetF_DoubleOptional() float64 { - if m != nil && m.F_DoubleOptional != nil { - return *m.F_DoubleOptional - } - return 0 -} - -func (m *GoTest) GetF_StringOptional() string { - if m != nil && m.F_StringOptional != nil { - return *m.F_StringOptional - } - return "" -} - -func (m *GoTest) GetF_BytesOptional() []byte { - if m != nil { - return m.F_BytesOptional - } - return nil -} - -func (m *GoTest) GetF_Sint32Optional() int32 { - if m != nil && m.F_Sint32Optional != nil { - return *m.F_Sint32Optional - } - return 0 -} - -func (m *GoTest) GetF_Sint64Optional() int64 { - if m != nil && m.F_Sint64Optional != nil { - return *m.F_Sint64Optional - } - return 0 -} - -func (m *GoTest) GetF_BoolDefaulted() bool { - if m != nil && m.F_BoolDefaulted != nil { - return *m.F_BoolDefaulted - } - return Default_GoTest_F_BoolDefaulted -} - -func (m *GoTest) GetF_Int32Defaulted() int32 { - if m != nil && m.F_Int32Defaulted != nil { - return *m.F_Int32Defaulted - } - return Default_GoTest_F_Int32Defaulted -} - -func (m *GoTest) GetF_Int64Defaulted() int64 { - if m != nil && m.F_Int64Defaulted != nil { - return *m.F_Int64Defaulted - } - return Default_GoTest_F_Int64Defaulted -} - -func (m *GoTest) GetF_Fixed32Defaulted() uint32 { - if m != nil && m.F_Fixed32Defaulted != nil { - return *m.F_Fixed32Defaulted - } - return Default_GoTest_F_Fixed32Defaulted -} - -func (m *GoTest) GetF_Fixed64Defaulted() uint64 { - if m != nil && m.F_Fixed64Defaulted != nil { - return *m.F_Fixed64Defaulted - } - return Default_GoTest_F_Fixed64Defaulted -} - -func (m *GoTest) GetF_Uint32Defaulted() uint32 { - if m != nil && m.F_Uint32Defaulted != nil { - return *m.F_Uint32Defaulted - } - return Default_GoTest_F_Uint32Defaulted -} - -func (m *GoTest) GetF_Uint64Defaulted() uint64 { - if m != nil && m.F_Uint64Defaulted != nil { - return *m.F_Uint64Defaulted - } - return Default_GoTest_F_Uint64Defaulted -} - -func (m *GoTest) GetF_FloatDefaulted() float32 { - if m != nil && m.F_FloatDefaulted != nil { - return *m.F_FloatDefaulted - } - return Default_GoTest_F_FloatDefaulted -} - -func (m *GoTest) GetF_DoubleDefaulted() float64 { - if m != nil && m.F_DoubleDefaulted != nil { - return *m.F_DoubleDefaulted - } - return Default_GoTest_F_DoubleDefaulted -} - -func (m *GoTest) GetF_StringDefaulted() string { - if m != nil && m.F_StringDefaulted != nil { - return *m.F_StringDefaulted - } - return Default_GoTest_F_StringDefaulted -} - -func (m *GoTest) GetF_BytesDefaulted() []byte { - if m != nil && m.F_BytesDefaulted != nil { - return m.F_BytesDefaulted - } - return append([]byte(nil), Default_GoTest_F_BytesDefaulted...) -} - -func (m *GoTest) GetF_Sint32Defaulted() int32 { - if m != nil && m.F_Sint32Defaulted != nil { - return *m.F_Sint32Defaulted - } - return Default_GoTest_F_Sint32Defaulted -} - -func (m *GoTest) GetF_Sint64Defaulted() int64 { - if m != nil && m.F_Sint64Defaulted != nil { - return *m.F_Sint64Defaulted - } - return Default_GoTest_F_Sint64Defaulted -} - -func (m *GoTest) GetF_BoolRepeatedPacked() []bool { - if m != nil { - return m.F_BoolRepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Int32RepeatedPacked() []int32 { - if m != nil { - return m.F_Int32RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Int64RepeatedPacked() []int64 { - if m != nil { - return m.F_Int64RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Fixed32RepeatedPacked() []uint32 { - if m != nil { - return m.F_Fixed32RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Fixed64RepeatedPacked() []uint64 { - if m != nil { - return m.F_Fixed64RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Uint32RepeatedPacked() []uint32 { - if m != nil { - return m.F_Uint32RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Uint64RepeatedPacked() []uint64 { - if m != nil { - return m.F_Uint64RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_FloatRepeatedPacked() []float32 { - if m != nil { - return m.F_FloatRepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_DoubleRepeatedPacked() []float64 { - if m != nil { - return m.F_DoubleRepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Sint32RepeatedPacked() []int32 { - if m != nil { - return m.F_Sint32RepeatedPacked - } - return nil -} - -func (m *GoTest) GetF_Sint64RepeatedPacked() []int64 { - if m != nil { - return m.F_Sint64RepeatedPacked - } - return nil -} - -func (m *GoTest) GetRequiredgroup() *GoTest_RequiredGroup { - if m != nil { - return m.Requiredgroup - } - return nil -} - -func (m *GoTest) GetRepeatedgroup() []*GoTest_RepeatedGroup { - if m != nil { - return m.Repeatedgroup - } - return nil -} - -func (m *GoTest) GetOptionalgroup() *GoTest_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil -} - -// Required, repeated, and optional groups. -type GoTest_RequiredGroup struct { - RequiredField *string `protobuf:"bytes,71,req,name=RequiredField,json=requiredField" json:"RequiredField,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } -func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_RequiredGroup) ProtoMessage() {} -func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } - -func (m *GoTest_RequiredGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -type GoTest_RepeatedGroup struct { - RequiredField *string `protobuf:"bytes,81,req,name=RequiredField,json=requiredField" json:"RequiredField,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } -func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_RepeatedGroup) ProtoMessage() {} -func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 1} } - -func (m *GoTest_RepeatedGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -type GoTest_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,91,req,name=RequiredField,json=requiredField" json:"RequiredField,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } -func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } -func (*GoTest_OptionalGroup) ProtoMessage() {} -func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 2} } - -func (m *GoTest_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" -} - -// For testing skipping of unrecognized fields. -// Numbers are all big, larger than tag numbers in GoTestField, -// the message used in the corresponding test. -type GoSkipTest struct { - SkipInt32 *int32 `protobuf:"varint,11,req,name=skip_int32,json=skipInt32" json:"skip_int32,omitempty"` - SkipFixed32 *uint32 `protobuf:"fixed32,12,req,name=skip_fixed32,json=skipFixed32" json:"skip_fixed32,omitempty"` - SkipFixed64 *uint64 `protobuf:"fixed64,13,req,name=skip_fixed64,json=skipFixed64" json:"skip_fixed64,omitempty"` - SkipString *string `protobuf:"bytes,14,req,name=skip_string,json=skipString" json:"skip_string,omitempty"` - Skipgroup *GoSkipTest_SkipGroup `protobuf:"group,15,req,name=SkipGroup,json=skipgroup" json:"skipgroup,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoSkipTest) Reset() { *m = GoSkipTest{} } -func (m *GoSkipTest) String() string { return proto.CompactTextString(m) } -func (*GoSkipTest) ProtoMessage() {} -func (*GoSkipTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *GoSkipTest) GetSkipInt32() int32 { - if m != nil && m.SkipInt32 != nil { - return *m.SkipInt32 - } - return 0 -} - -func (m *GoSkipTest) GetSkipFixed32() uint32 { - if m != nil && m.SkipFixed32 != nil { - return *m.SkipFixed32 - } - return 0 -} - -func (m *GoSkipTest) GetSkipFixed64() uint64 { - if m != nil && m.SkipFixed64 != nil { - return *m.SkipFixed64 - } - return 0 -} - -func (m *GoSkipTest) GetSkipString() string { - if m != nil && m.SkipString != nil { - return *m.SkipString - } - return "" -} - -func (m *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup { - if m != nil { - return m.Skipgroup - } - return nil -} - -type GoSkipTest_SkipGroup struct { - GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32,json=groupInt32" json:"group_int32,omitempty"` - GroupString *string `protobuf:"bytes,17,req,name=group_string,json=groupString" json:"group_string,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } -func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } -func (*GoSkipTest_SkipGroup) ProtoMessage() {} -func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3, 0} } - -func (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 { - if m != nil && m.GroupInt32 != nil { - return *m.GroupInt32 - } - return 0 -} - -func (m *GoSkipTest_SkipGroup) GetGroupString() string { - if m != nil && m.GroupString != nil { - return *m.GroupString - } - return "" -} - -// For testing packed/non-packed decoder switching. -// A serialized instance of one should be deserializable as the other. -type NonPackedTest struct { - A []int32 `protobuf:"varint,1,rep,name=a" json:"a,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *NonPackedTest) Reset() { *m = NonPackedTest{} } -func (m *NonPackedTest) String() string { return proto.CompactTextString(m) } -func (*NonPackedTest) ProtoMessage() {} -func (*NonPackedTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *NonPackedTest) GetA() []int32 { - if m != nil { - return m.A - } - return nil -} - -type PackedTest struct { - B []int32 `protobuf:"varint,1,rep,packed,name=b" json:"b,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *PackedTest) Reset() { *m = PackedTest{} } -func (m *PackedTest) String() string { return proto.CompactTextString(m) } -func (*PackedTest) ProtoMessage() {} -func (*PackedTest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -func (m *PackedTest) GetB() []int32 { - if m != nil { - return m.B - } - return nil -} - -type MaxTag struct { - // Maximum possible tag number. - LastField *string `protobuf:"bytes,536870911,opt,name=last_field,json=lastField" json:"last_field,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MaxTag) Reset() { *m = MaxTag{} } -func (m *MaxTag) String() string { return proto.CompactTextString(m) } -func (*MaxTag) ProtoMessage() {} -func (*MaxTag) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func (m *MaxTag) GetLastField() string { - if m != nil && m.LastField != nil { - return *m.LastField - } - return "" -} - -type OldMessage struct { - Nested *OldMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - Num *int32 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OldMessage) Reset() { *m = OldMessage{} } -func (m *OldMessage) String() string { return proto.CompactTextString(m) } -func (*OldMessage) ProtoMessage() {} -func (*OldMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } - -func (m *OldMessage) GetNested() *OldMessage_Nested { - if m != nil { - return m.Nested - } - return nil -} - -func (m *OldMessage) GetNum() int32 { - if m != nil && m.Num != nil { - return *m.Num - } - return 0 -} - -type OldMessage_Nested struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } -func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } -func (*OldMessage_Nested) ProtoMessage() {} -func (*OldMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 0} } - -func (m *OldMessage_Nested) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -// NewMessage is wire compatible with OldMessage; -// imagine it as a future version. -type NewMessage struct { - Nested *NewMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty"` - // This is an int32 in OldMessage. - Num *int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *NewMessage) Reset() { *m = NewMessage{} } -func (m *NewMessage) String() string { return proto.CompactTextString(m) } -func (*NewMessage) ProtoMessage() {} -func (*NewMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } - -func (m *NewMessage) GetNested() *NewMessage_Nested { - if m != nil { - return m.Nested - } - return nil -} - -func (m *NewMessage) GetNum() int64 { - if m != nil && m.Num != nil { - return *m.Num - } - return 0 -} - -type NewMessage_Nested struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - FoodGroup *string `protobuf:"bytes,2,opt,name=food_group,json=foodGroup" json:"food_group,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } -func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } -func (*NewMessage_Nested) ProtoMessage() {} -func (*NewMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8, 0} } - -func (m *NewMessage_Nested) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *NewMessage_Nested) GetFoodGroup() string { - if m != nil && m.FoodGroup != nil { - return *m.FoodGroup - } - return "" -} - -type InnerMessage struct { - Host *string `protobuf:"bytes,1,req,name=host" json:"host,omitempty"` - Port *int32 `protobuf:"varint,2,opt,name=port,def=4000" json:"port,omitempty"` - Connected *bool `protobuf:"varint,3,opt,name=connected" json:"connected,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *InnerMessage) Reset() { *m = InnerMessage{} } -func (m *InnerMessage) String() string { return proto.CompactTextString(m) } -func (*InnerMessage) ProtoMessage() {} -func (*InnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } - -const Default_InnerMessage_Port int32 = 4000 - -func (m *InnerMessage) GetHost() string { - if m != nil && m.Host != nil { - return *m.Host - } - return "" -} - -func (m *InnerMessage) GetPort() int32 { - if m != nil && m.Port != nil { - return *m.Port - } - return Default_InnerMessage_Port -} - -func (m *InnerMessage) GetConnected() bool { - if m != nil && m.Connected != nil { - return *m.Connected - } - return false -} - -type OtherMessage struct { - Key *int64 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` - Weight *float32 `protobuf:"fixed32,3,opt,name=weight" json:"weight,omitempty"` - Inner *InnerMessage `protobuf:"bytes,4,opt,name=inner" json:"inner,omitempty"` - XXX_extensions map[int32]proto.Extension `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OtherMessage) Reset() { *m = OtherMessage{} } -func (m *OtherMessage) String() string { return proto.CompactTextString(m) } -func (*OtherMessage) ProtoMessage() {} -func (*OtherMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } - -var extRange_OtherMessage = []proto.ExtensionRange{ - {100, 536870911}, -} - -func (*OtherMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OtherMessage -} -func (m *OtherMessage) ExtensionMap() map[int32]proto.Extension { - if m.XXX_extensions == nil { - m.XXX_extensions = make(map[int32]proto.Extension) - } - return m.XXX_extensions -} - -func (m *OtherMessage) GetKey() int64 { - if m != nil && m.Key != nil { - return *m.Key - } - return 0 -} - -func (m *OtherMessage) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *OtherMessage) GetWeight() float32 { - if m != nil && m.Weight != nil { - return *m.Weight - } - return 0 -} - -func (m *OtherMessage) GetInner() *InnerMessage { - if m != nil { - return m.Inner - } - return nil -} - -type RequiredInnerMessage struct { - LeoFinallyWonAnOscar *InnerMessage `protobuf:"bytes,1,req,name=leo_finally_won_an_oscar,json=leoFinallyWonAnOscar" json:"leo_finally_won_an_oscar,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RequiredInnerMessage) Reset() { *m = RequiredInnerMessage{} } -func (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) } -func (*RequiredInnerMessage) ProtoMessage() {} -func (*RequiredInnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } - -func (m *RequiredInnerMessage) GetLeoFinallyWonAnOscar() *InnerMessage { - if m != nil { - return m.LeoFinallyWonAnOscar - } - return nil -} - -type MyMessage struct { - Count *int32 `protobuf:"varint,1,req,name=count" json:"count,omitempty"` - Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Quote *string `protobuf:"bytes,3,opt,name=quote" json:"quote,omitempty"` - Pet []string `protobuf:"bytes,4,rep,name=pet" json:"pet,omitempty"` - Inner *InnerMessage `protobuf:"bytes,5,opt,name=inner" json:"inner,omitempty"` - Others []*OtherMessage `protobuf:"bytes,6,rep,name=others" json:"others,omitempty"` - WeMustGoDeeper *RequiredInnerMessage `protobuf:"bytes,13,opt,name=we_must_go_deeper,json=weMustGoDeeper" json:"we_must_go_deeper,omitempty"` - RepInner []*InnerMessage `protobuf:"bytes,12,rep,name=rep_inner,json=repInner" json:"rep_inner,omitempty"` - Bikeshed *MyMessage_Color `protobuf:"varint,7,opt,name=bikeshed,enum=testdata.MyMessage_Color" json:"bikeshed,omitempty"` - Somegroup *MyMessage_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty"` - // This field becomes [][]byte in the generated code. - RepBytes [][]byte `protobuf:"bytes,10,rep,name=rep_bytes,json=repBytes" json:"rep_bytes,omitempty"` - Bigfloat *float64 `protobuf:"fixed64,11,opt,name=bigfloat" json:"bigfloat,omitempty"` - XXX_extensions map[int32]proto.Extension `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MyMessage) Reset() { *m = MyMessage{} } -func (m *MyMessage) String() string { return proto.CompactTextString(m) } -func (*MyMessage) ProtoMessage() {} -func (*MyMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } - -var extRange_MyMessage = []proto.ExtensionRange{ - {100, 536870911}, -} - -func (*MyMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MyMessage -} -func (m *MyMessage) ExtensionMap() map[int32]proto.Extension { - if m.XXX_extensions == nil { - m.XXX_extensions = make(map[int32]proto.Extension) - } - return m.XXX_extensions -} - -func (m *MyMessage) GetCount() int32 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -func (m *MyMessage) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MyMessage) GetQuote() string { - if m != nil && m.Quote != nil { - return *m.Quote - } - return "" -} - -func (m *MyMessage) GetPet() []string { - if m != nil { - return m.Pet - } - return nil -} - -func (m *MyMessage) GetInner() *InnerMessage { - if m != nil { - return m.Inner - } - return nil -} - -func (m *MyMessage) GetOthers() []*OtherMessage { - if m != nil { - return m.Others - } - return nil -} - -func (m *MyMessage) GetWeMustGoDeeper() *RequiredInnerMessage { - if m != nil { - return m.WeMustGoDeeper - } - return nil -} - -func (m *MyMessage) GetRepInner() []*InnerMessage { - if m != nil { - return m.RepInner - } - return nil -} - -func (m *MyMessage) GetBikeshed() MyMessage_Color { - if m != nil && m.Bikeshed != nil { - return *m.Bikeshed - } - return MyMessage_RED -} - -func (m *MyMessage) GetSomegroup() *MyMessage_SomeGroup { - if m != nil { - return m.Somegroup - } - return nil -} - -func (m *MyMessage) GetRepBytes() [][]byte { - if m != nil { - return m.RepBytes - } - return nil -} - -func (m *MyMessage) GetBigfloat() float64 { - if m != nil && m.Bigfloat != nil { - return *m.Bigfloat - } - return 0 -} - -type MyMessage_SomeGroup struct { - GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } -func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } -func (*MyMessage_SomeGroup) ProtoMessage() {} -func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12, 0} } - -func (m *MyMessage_SomeGroup) GetGroupField() int32 { - if m != nil && m.GroupField != nil { - return *m.GroupField - } - return 0 -} - -type Ext struct { - Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Ext) Reset() { *m = Ext{} } -func (m *Ext) String() string { return proto.CompactTextString(m) } -func (*Ext) ProtoMessage() {} -func (*Ext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } - -func (m *Ext) GetData() string { - if m != nil && m.Data != nil { - return *m.Data - } - return "" -} - -var E_Ext_More = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*Ext)(nil), - Field: 103, - Name: "testdata.Ext.more", - Tag: "bytes,103,opt,name=more", -} - -var E_Ext_Text = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*string)(nil), - Field: 104, - Name: "testdata.Ext.text", - Tag: "bytes,104,opt,name=text", -} - -var E_Ext_Number = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 105, - Name: "testdata.Ext.number", - Tag: "varint,105,opt,name=number", -} - -type ComplexExtension struct { - First *int32 `protobuf:"varint,1,opt,name=first" json:"first,omitempty"` - Second *int32 `protobuf:"varint,2,opt,name=second" json:"second,omitempty"` - Third []int32 `protobuf:"varint,3,rep,name=third" json:"third,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ComplexExtension) Reset() { *m = ComplexExtension{} } -func (m *ComplexExtension) String() string { return proto.CompactTextString(m) } -func (*ComplexExtension) ProtoMessage() {} -func (*ComplexExtension) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } - -func (m *ComplexExtension) GetFirst() int32 { - if m != nil && m.First != nil { - return *m.First - } - return 0 -} - -func (m *ComplexExtension) GetSecond() int32 { - if m != nil && m.Second != nil { - return *m.Second - } - return 0 -} - -func (m *ComplexExtension) GetThird() []int32 { - if m != nil { - return m.Third - } - return nil -} - -type DefaultsMessage struct { - XXX_extensions map[int32]proto.Extension `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *DefaultsMessage) Reset() { *m = DefaultsMessage{} } -func (m *DefaultsMessage) String() string { return proto.CompactTextString(m) } -func (*DefaultsMessage) ProtoMessage() {} -func (*DefaultsMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } - -var extRange_DefaultsMessage = []proto.ExtensionRange{ - {100, 536870911}, -} - -func (*DefaultsMessage) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_DefaultsMessage -} -func (m *DefaultsMessage) ExtensionMap() map[int32]proto.Extension { - if m.XXX_extensions == nil { - m.XXX_extensions = make(map[int32]proto.Extension) - } - return m.XXX_extensions -} - -type MyMessageSet struct { - XXX_extensions map[int32]proto.Extension `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MyMessageSet) Reset() { *m = MyMessageSet{} } -func (m *MyMessageSet) String() string { return proto.CompactTextString(m) } -func (*MyMessageSet) ProtoMessage() {} -func (*MyMessageSet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } - -func (m *MyMessageSet) Marshal() ([]byte, error) { - return proto.MarshalMessageSet(m.ExtensionMap()) -} -func (m *MyMessageSet) Unmarshal(buf []byte) error { - return proto.UnmarshalMessageSet(buf, m.ExtensionMap()) -} -func (m *MyMessageSet) MarshalJSON() ([]byte, error) { - return proto.MarshalMessageSetJSON(m.XXX_extensions) -} -func (m *MyMessageSet) UnmarshalJSON(buf []byte) error { - return proto.UnmarshalMessageSetJSON(buf, m.XXX_extensions) -} - -// ensure MyMessageSet satisfies proto.Marshaler and proto.Unmarshaler -var _ proto.Marshaler = (*MyMessageSet)(nil) -var _ proto.Unmarshaler = (*MyMessageSet)(nil) - -var extRange_MyMessageSet = []proto.ExtensionRange{ - {100, 2147483646}, -} - -func (*MyMessageSet) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MyMessageSet -} -func (m *MyMessageSet) ExtensionMap() map[int32]proto.Extension { - if m.XXX_extensions == nil { - m.XXX_extensions = make(map[int32]proto.Extension) - } - return m.XXX_extensions -} - -type Empty struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *Empty) Reset() { *m = Empty{} } -func (m *Empty) String() string { return proto.CompactTextString(m) } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } - -type MessageList struct { - Message []*MessageList_Message `protobuf:"group,1,rep,name=Message,json=message" json:"message,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MessageList) Reset() { *m = MessageList{} } -func (m *MessageList) String() string { return proto.CompactTextString(m) } -func (*MessageList) ProtoMessage() {} -func (*MessageList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } - -func (m *MessageList) GetMessage() []*MessageList_Message { - if m != nil { - return m.Message - } - return nil -} - -type MessageList_Message struct { - Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"` - Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } -func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } -func (*MessageList_Message) ProtoMessage() {} -func (*MessageList_Message) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18, 0} } - -func (m *MessageList_Message) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MessageList_Message) GetCount() int32 { - if m != nil && m.Count != nil { - return *m.Count - } - return 0 -} - -type Strings struct { - StringField *string `protobuf:"bytes,1,opt,name=string_field,json=stringField" json:"string_field,omitempty"` - BytesField []byte `protobuf:"bytes,2,opt,name=bytes_field,json=bytesField" json:"bytes_field,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Strings) Reset() { *m = Strings{} } -func (m *Strings) String() string { return proto.CompactTextString(m) } -func (*Strings) ProtoMessage() {} -func (*Strings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } - -func (m *Strings) GetStringField() string { - if m != nil && m.StringField != nil { - return *m.StringField - } - return "" -} - -func (m *Strings) GetBytesField() []byte { - if m != nil { - return m.BytesField - } - return nil -} - -type Defaults struct { - // Default-valued fields of all basic types. - // Same as GoTest, but copied here to make testing easier. - F_Bool *bool `protobuf:"varint,1,opt,name=F_Bool,json=fBool,def=1" json:"F_Bool,omitempty"` - F_Int32 *int32 `protobuf:"varint,2,opt,name=F_Int32,json=fInt32,def=32" json:"F_Int32,omitempty"` - F_Int64 *int64 `protobuf:"varint,3,opt,name=F_Int64,json=fInt64,def=64" json:"F_Int64,omitempty"` - F_Fixed32 *uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=fFixed32,def=320" json:"F_Fixed32,omitempty"` - F_Fixed64 *uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=fFixed64,def=640" json:"F_Fixed64,omitempty"` - F_Uint32 *uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=fUint32,def=3200" json:"F_Uint32,omitempty"` - F_Uint64 *uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=fUint64,def=6400" json:"F_Uint64,omitempty"` - F_Float *float32 `protobuf:"fixed32,8,opt,name=F_Float,json=fFloat,def=314159" json:"F_Float,omitempty"` - F_Double *float64 `protobuf:"fixed64,9,opt,name=F_Double,json=fDouble,def=271828" json:"F_Double,omitempty"` - F_String *string `protobuf:"bytes,10,opt,name=F_String,json=fString,def=hello, \"world!\"\n" json:"F_String,omitempty"` - F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=fBytes,def=Bignose" json:"F_Bytes,omitempty"` - F_Sint32 *int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=fSint32,def=-32" json:"F_Sint32,omitempty"` - F_Sint64 *int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=fSint64,def=-64" json:"F_Sint64,omitempty"` - F_Enum *Defaults_Color `protobuf:"varint,14,opt,name=F_Enum,json=fEnum,enum=testdata.Defaults_Color,def=1" json:"F_Enum,omitempty"` - // More fields with crazy defaults. - F_Pinf *float32 `protobuf:"fixed32,15,opt,name=F_Pinf,json=fPinf,def=inf" json:"F_Pinf,omitempty"` - F_Ninf *float32 `protobuf:"fixed32,16,opt,name=F_Ninf,json=fNinf,def=-inf" json:"F_Ninf,omitempty"` - F_Nan *float32 `protobuf:"fixed32,17,opt,name=F_Nan,json=fNan,def=nan" json:"F_Nan,omitempty"` - // Sub-message. - Sub *SubDefaults `protobuf:"bytes,18,opt,name=sub" json:"sub,omitempty"` - // Redundant but explicit defaults. - StrZero *string `protobuf:"bytes,19,opt,name=str_zero,json=strZero,def=" json:"str_zero,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Defaults) Reset() { *m = Defaults{} } -func (m *Defaults) String() string { return proto.CompactTextString(m) } -func (*Defaults) ProtoMessage() {} -func (*Defaults) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } - -const Default_Defaults_F_Bool bool = true -const Default_Defaults_F_Int32 int32 = 32 -const Default_Defaults_F_Int64 int64 = 64 -const Default_Defaults_F_Fixed32 uint32 = 320 -const Default_Defaults_F_Fixed64 uint64 = 640 -const Default_Defaults_F_Uint32 uint32 = 3200 -const Default_Defaults_F_Uint64 uint64 = 6400 -const Default_Defaults_F_Float float32 = 314159 -const Default_Defaults_F_Double float64 = 271828 -const Default_Defaults_F_String string = "hello, \"world!\"\n" - -var Default_Defaults_F_Bytes []byte = []byte("Bignose") - -const Default_Defaults_F_Sint32 int32 = -32 -const Default_Defaults_F_Sint64 int64 = -64 -const Default_Defaults_F_Enum Defaults_Color = Defaults_GREEN - -var Default_Defaults_F_Pinf float32 = float32(math.Inf(1)) -var Default_Defaults_F_Ninf float32 = float32(math.Inf(-1)) -var Default_Defaults_F_Nan float32 = float32(math.NaN()) - -func (m *Defaults) GetF_Bool() bool { - if m != nil && m.F_Bool != nil { - return *m.F_Bool - } - return Default_Defaults_F_Bool -} - -func (m *Defaults) GetF_Int32() int32 { - if m != nil && m.F_Int32 != nil { - return *m.F_Int32 - } - return Default_Defaults_F_Int32 -} - -func (m *Defaults) GetF_Int64() int64 { - if m != nil && m.F_Int64 != nil { - return *m.F_Int64 - } - return Default_Defaults_F_Int64 -} - -func (m *Defaults) GetF_Fixed32() uint32 { - if m != nil && m.F_Fixed32 != nil { - return *m.F_Fixed32 - } - return Default_Defaults_F_Fixed32 -} - -func (m *Defaults) GetF_Fixed64() uint64 { - if m != nil && m.F_Fixed64 != nil { - return *m.F_Fixed64 - } - return Default_Defaults_F_Fixed64 -} - -func (m *Defaults) GetF_Uint32() uint32 { - if m != nil && m.F_Uint32 != nil { - return *m.F_Uint32 - } - return Default_Defaults_F_Uint32 -} - -func (m *Defaults) GetF_Uint64() uint64 { - if m != nil && m.F_Uint64 != nil { - return *m.F_Uint64 - } - return Default_Defaults_F_Uint64 -} - -func (m *Defaults) GetF_Float() float32 { - if m != nil && m.F_Float != nil { - return *m.F_Float - } - return Default_Defaults_F_Float -} - -func (m *Defaults) GetF_Double() float64 { - if m != nil && m.F_Double != nil { - return *m.F_Double - } - return Default_Defaults_F_Double -} - -func (m *Defaults) GetF_String() string { - if m != nil && m.F_String != nil { - return *m.F_String - } - return Default_Defaults_F_String -} - -func (m *Defaults) GetF_Bytes() []byte { - if m != nil && m.F_Bytes != nil { - return m.F_Bytes - } - return append([]byte(nil), Default_Defaults_F_Bytes...) -} - -func (m *Defaults) GetF_Sint32() int32 { - if m != nil && m.F_Sint32 != nil { - return *m.F_Sint32 - } - return Default_Defaults_F_Sint32 -} - -func (m *Defaults) GetF_Sint64() int64 { - if m != nil && m.F_Sint64 != nil { - return *m.F_Sint64 - } - return Default_Defaults_F_Sint64 -} - -func (m *Defaults) GetF_Enum() Defaults_Color { - if m != nil && m.F_Enum != nil { - return *m.F_Enum - } - return Default_Defaults_F_Enum -} - -func (m *Defaults) GetF_Pinf() float32 { - if m != nil && m.F_Pinf != nil { - return *m.F_Pinf - } - return Default_Defaults_F_Pinf -} - -func (m *Defaults) GetF_Ninf() float32 { - if m != nil && m.F_Ninf != nil { - return *m.F_Ninf - } - return Default_Defaults_F_Ninf -} - -func (m *Defaults) GetF_Nan() float32 { - if m != nil && m.F_Nan != nil { - return *m.F_Nan - } - return Default_Defaults_F_Nan -} - -func (m *Defaults) GetSub() *SubDefaults { - if m != nil { - return m.Sub - } - return nil -} - -func (m *Defaults) GetStrZero() string { - if m != nil && m.StrZero != nil { - return *m.StrZero - } - return "" -} - -type SubDefaults struct { - N *int64 `protobuf:"varint,1,opt,name=n,def=7" json:"n,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SubDefaults) Reset() { *m = SubDefaults{} } -func (m *SubDefaults) String() string { return proto.CompactTextString(m) } -func (*SubDefaults) ProtoMessage() {} -func (*SubDefaults) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } - -const Default_SubDefaults_N int64 = 7 - -func (m *SubDefaults) GetN() int64 { - if m != nil && m.N != nil { - return *m.N - } - return Default_SubDefaults_N -} - -type RepeatedEnum struct { - Color []RepeatedEnum_Color `protobuf:"varint,1,rep,name=color,enum=testdata.RepeatedEnum_Color" json:"color,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RepeatedEnum) Reset() { *m = RepeatedEnum{} } -func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) } -func (*RepeatedEnum) ProtoMessage() {} -func (*RepeatedEnum) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } - -func (m *RepeatedEnum) GetColor() []RepeatedEnum_Color { - if m != nil { - return m.Color - } - return nil -} - -type MoreRepeated struct { - Bools []bool `protobuf:"varint,1,rep,name=bools" json:"bools,omitempty"` - BoolsPacked []bool `protobuf:"varint,2,rep,packed,name=bools_packed,json=boolsPacked" json:"bools_packed,omitempty"` - Ints []int32 `protobuf:"varint,3,rep,name=ints" json:"ints,omitempty"` - IntsPacked []int32 `protobuf:"varint,4,rep,packed,name=ints_packed,json=intsPacked" json:"ints_packed,omitempty"` - Int64SPacked []int64 `protobuf:"varint,7,rep,packed,name=int64s_packed,json=int64sPacked" json:"int64s_packed,omitempty"` - Strings []string `protobuf:"bytes,5,rep,name=strings" json:"strings,omitempty"` - Fixeds []uint32 `protobuf:"fixed32,6,rep,name=fixeds" json:"fixeds,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MoreRepeated) Reset() { *m = MoreRepeated{} } -func (m *MoreRepeated) String() string { return proto.CompactTextString(m) } -func (*MoreRepeated) ProtoMessage() {} -func (*MoreRepeated) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } - -func (m *MoreRepeated) GetBools() []bool { - if m != nil { - return m.Bools - } - return nil -} - -func (m *MoreRepeated) GetBoolsPacked() []bool { - if m != nil { - return m.BoolsPacked - } - return nil -} - -func (m *MoreRepeated) GetInts() []int32 { - if m != nil { - return m.Ints - } - return nil -} - -func (m *MoreRepeated) GetIntsPacked() []int32 { - if m != nil { - return m.IntsPacked - } - return nil -} - -func (m *MoreRepeated) GetInt64SPacked() []int64 { - if m != nil { - return m.Int64SPacked - } - return nil -} - -func (m *MoreRepeated) GetStrings() []string { - if m != nil { - return m.Strings - } - return nil -} - -func (m *MoreRepeated) GetFixeds() []uint32 { - if m != nil { - return m.Fixeds - } - return nil -} - -type GroupOld struct { - G *GroupOld_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupOld) Reset() { *m = GroupOld{} } -func (m *GroupOld) String() string { return proto.CompactTextString(m) } -func (*GroupOld) ProtoMessage() {} -func (*GroupOld) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} } - -func (m *GroupOld) GetG() *GroupOld_G { - if m != nil { - return m.G - } - return nil -} - -type GroupOld_G struct { - X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } -func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } -func (*GroupOld_G) ProtoMessage() {} -func (*GroupOld_G) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24, 0} } - -func (m *GroupOld_G) GetX() int32 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - -type GroupNew struct { - G *GroupNew_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupNew) Reset() { *m = GroupNew{} } -func (m *GroupNew) String() string { return proto.CompactTextString(m) } -func (*GroupNew) ProtoMessage() {} -func (*GroupNew) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } - -func (m *GroupNew) GetG() *GroupNew_G { - if m != nil { - return m.G - } - return nil -} - -type GroupNew_G struct { - X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty"` - Y *int32 `protobuf:"varint,3,opt,name=y" json:"y,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } -func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } -func (*GroupNew_G) ProtoMessage() {} -func (*GroupNew_G) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25, 0} } - -func (m *GroupNew_G) GetX() int32 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - -func (m *GroupNew_G) GetY() int32 { - if m != nil && m.Y != nil { - return *m.Y - } - return 0 -} - -type FloatingPoint struct { - F *float64 `protobuf:"fixed64,1,req,name=f" json:"f,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *FloatingPoint) Reset() { *m = FloatingPoint{} } -func (m *FloatingPoint) String() string { return proto.CompactTextString(m) } -func (*FloatingPoint) ProtoMessage() {} -func (*FloatingPoint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } - -func (m *FloatingPoint) GetF() float64 { - if m != nil && m.F != nil { - return *m.F - } - return 0 -} - -type MessageWithMap struct { - NameMapping map[int32]string `protobuf:"bytes,1,rep,name=name_mapping,json=nameMapping" json:"name_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - MsgMapping map[int64]*FloatingPoint `protobuf:"bytes,2,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - ByteMapping map[bool][]byte `protobuf:"bytes,3,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - StrToStr map[string]string `protobuf:"bytes,4,rep,name=str_to_str,json=strToStr" json:"str_to_str,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } -func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } -func (*MessageWithMap) ProtoMessage() {} -func (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } - -func (m *MessageWithMap) GetNameMapping() map[int32]string { - if m != nil { - return m.NameMapping - } - return nil -} - -func (m *MessageWithMap) GetMsgMapping() map[int64]*FloatingPoint { - if m != nil { - return m.MsgMapping - } - return nil -} - -func (m *MessageWithMap) GetByteMapping() map[bool][]byte { - if m != nil { - return m.ByteMapping - } - return nil -} - -func (m *MessageWithMap) GetStrToStr() map[string]string { - if m != nil { - return m.StrToStr - } - return nil -} - -type Oneof struct { - // Types that are valid to be assigned to Union: - // *Oneof_F_Bool - // *Oneof_F_Int32 - // *Oneof_F_Int64 - // *Oneof_F_Fixed32 - // *Oneof_F_Fixed64 - // *Oneof_F_Uint32 - // *Oneof_F_Uint64 - // *Oneof_F_Float - // *Oneof_F_Double - // *Oneof_F_String - // *Oneof_F_Bytes - // *Oneof_F_Sint32 - // *Oneof_F_Sint64 - // *Oneof_F_Enum - // *Oneof_F_Message - // *Oneof_FGroup - // *Oneof_F_Largest_Tag - Union isOneof_Union `protobuf_oneof:"union"` - // Types that are valid to be assigned to Tormato: - // *Oneof_Value - Tormato isOneof_Tormato `protobuf_oneof:"tormato"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Oneof) Reset() { *m = Oneof{} } -func (m *Oneof) String() string { return proto.CompactTextString(m) } -func (*Oneof) ProtoMessage() {} -func (*Oneof) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } - -type isOneof_Union interface { - isOneof_Union() -} -type isOneof_Tormato interface { - isOneof_Tormato() -} - -type Oneof_F_Bool struct { - F_Bool bool `protobuf:"varint,1,opt,name=F_Bool,json=fBool,oneof"` -} -type Oneof_F_Int32 struct { - F_Int32 int32 `protobuf:"varint,2,opt,name=F_Int32,json=fInt32,oneof"` -} -type Oneof_F_Int64 struct { - F_Int64 int64 `protobuf:"varint,3,opt,name=F_Int64,json=fInt64,oneof"` -} -type Oneof_F_Fixed32 struct { - F_Fixed32 uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=fFixed32,oneof"` -} -type Oneof_F_Fixed64 struct { - F_Fixed64 uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=fFixed64,oneof"` -} -type Oneof_F_Uint32 struct { - F_Uint32 uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=fUint32,oneof"` -} -type Oneof_F_Uint64 struct { - F_Uint64 uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=fUint64,oneof"` -} -type Oneof_F_Float struct { - F_Float float32 `protobuf:"fixed32,8,opt,name=F_Float,json=fFloat,oneof"` -} -type Oneof_F_Double struct { - F_Double float64 `protobuf:"fixed64,9,opt,name=F_Double,json=fDouble,oneof"` -} -type Oneof_F_String struct { - F_String string `protobuf:"bytes,10,opt,name=F_String,json=fString,oneof"` -} -type Oneof_F_Bytes struct { - F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=fBytes,oneof"` -} -type Oneof_F_Sint32 struct { - F_Sint32 int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=fSint32,oneof"` -} -type Oneof_F_Sint64 struct { - F_Sint64 int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=fSint64,oneof"` -} -type Oneof_F_Enum struct { - F_Enum MyMessage_Color `protobuf:"varint,14,opt,name=F_Enum,json=fEnum,enum=testdata.MyMessage_Color,oneof"` -} -type Oneof_F_Message struct { - F_Message *GoTestField `protobuf:"bytes,15,opt,name=F_Message,json=fMessage,oneof"` -} -type Oneof_FGroup struct { - FGroup *Oneof_F_Group `protobuf:"group,16,opt,name=F_Group,json=fGroup,oneof"` -} -type Oneof_F_Largest_Tag struct { - F_Largest_Tag int32 `protobuf:"varint,536870911,opt,name=F_Largest_Tag,json=fLargestTag,oneof"` -} -type Oneof_Value struct { - Value int32 `protobuf:"varint,100,opt,name=value,oneof"` -} - -func (*Oneof_F_Bool) isOneof_Union() {} -func (*Oneof_F_Int32) isOneof_Union() {} -func (*Oneof_F_Int64) isOneof_Union() {} -func (*Oneof_F_Fixed32) isOneof_Union() {} -func (*Oneof_F_Fixed64) isOneof_Union() {} -func (*Oneof_F_Uint32) isOneof_Union() {} -func (*Oneof_F_Uint64) isOneof_Union() {} -func (*Oneof_F_Float) isOneof_Union() {} -func (*Oneof_F_Double) isOneof_Union() {} -func (*Oneof_F_String) isOneof_Union() {} -func (*Oneof_F_Bytes) isOneof_Union() {} -func (*Oneof_F_Sint32) isOneof_Union() {} -func (*Oneof_F_Sint64) isOneof_Union() {} -func (*Oneof_F_Enum) isOneof_Union() {} -func (*Oneof_F_Message) isOneof_Union() {} -func (*Oneof_FGroup) isOneof_Union() {} -func (*Oneof_F_Largest_Tag) isOneof_Union() {} -func (*Oneof_Value) isOneof_Tormato() {} - -func (m *Oneof) GetUnion() isOneof_Union { - if m != nil { - return m.Union - } - return nil -} -func (m *Oneof) GetTormato() isOneof_Tormato { - if m != nil { - return m.Tormato - } - return nil -} - -func (m *Oneof) GetF_Bool() bool { - if x, ok := m.GetUnion().(*Oneof_F_Bool); ok { - return x.F_Bool - } - return false -} - -func (m *Oneof) GetF_Int32() int32 { - if x, ok := m.GetUnion().(*Oneof_F_Int32); ok { - return x.F_Int32 - } - return 0 -} - -func (m *Oneof) GetF_Int64() int64 { - if x, ok := m.GetUnion().(*Oneof_F_Int64); ok { - return x.F_Int64 - } - return 0 -} - -func (m *Oneof) GetF_Fixed32() uint32 { - if x, ok := m.GetUnion().(*Oneof_F_Fixed32); ok { - return x.F_Fixed32 - } - return 0 -} - -func (m *Oneof) GetF_Fixed64() uint64 { - if x, ok := m.GetUnion().(*Oneof_F_Fixed64); ok { - return x.F_Fixed64 - } - return 0 -} - -func (m *Oneof) GetF_Uint32() uint32 { - if x, ok := m.GetUnion().(*Oneof_F_Uint32); ok { - return x.F_Uint32 - } - return 0 -} - -func (m *Oneof) GetF_Uint64() uint64 { - if x, ok := m.GetUnion().(*Oneof_F_Uint64); ok { - return x.F_Uint64 - } - return 0 -} - -func (m *Oneof) GetF_Float() float32 { - if x, ok := m.GetUnion().(*Oneof_F_Float); ok { - return x.F_Float - } - return 0 -} - -func (m *Oneof) GetF_Double() float64 { - if x, ok := m.GetUnion().(*Oneof_F_Double); ok { - return x.F_Double - } - return 0 -} - -func (m *Oneof) GetF_String() string { - if x, ok := m.GetUnion().(*Oneof_F_String); ok { - return x.F_String - } - return "" -} - -func (m *Oneof) GetF_Bytes() []byte { - if x, ok := m.GetUnion().(*Oneof_F_Bytes); ok { - return x.F_Bytes - } - return nil -} - -func (m *Oneof) GetF_Sint32() int32 { - if x, ok := m.GetUnion().(*Oneof_F_Sint32); ok { - return x.F_Sint32 - } - return 0 -} - -func (m *Oneof) GetF_Sint64() int64 { - if x, ok := m.GetUnion().(*Oneof_F_Sint64); ok { - return x.F_Sint64 - } - return 0 -} - -func (m *Oneof) GetF_Enum() MyMessage_Color { - if x, ok := m.GetUnion().(*Oneof_F_Enum); ok { - return x.F_Enum - } - return MyMessage_RED -} - -func (m *Oneof) GetF_Message() *GoTestField { - if x, ok := m.GetUnion().(*Oneof_F_Message); ok { - return x.F_Message - } - return nil -} - -func (m *Oneof) GetFGroup() *Oneof_F_Group { - if x, ok := m.GetUnion().(*Oneof_FGroup); ok { - return x.FGroup - } - return nil -} - -func (m *Oneof) GetF_Largest_Tag() int32 { - if x, ok := m.GetUnion().(*Oneof_F_Largest_Tag); ok { - return x.F_Largest_Tag - } - return 0 -} - -func (m *Oneof) GetValue() int32 { - if x, ok := m.GetTormato().(*Oneof_Value); ok { - return x.Value - } - return 0 -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Oneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Oneof_OneofMarshaler, _Oneof_OneofUnmarshaler, _Oneof_OneofSizer, []interface{}{ - (*Oneof_F_Bool)(nil), - (*Oneof_F_Int32)(nil), - (*Oneof_F_Int64)(nil), - (*Oneof_F_Fixed32)(nil), - (*Oneof_F_Fixed64)(nil), - (*Oneof_F_Uint32)(nil), - (*Oneof_F_Uint64)(nil), - (*Oneof_F_Float)(nil), - (*Oneof_F_Double)(nil), - (*Oneof_F_String)(nil), - (*Oneof_F_Bytes)(nil), - (*Oneof_F_Sint32)(nil), - (*Oneof_F_Sint64)(nil), - (*Oneof_F_Enum)(nil), - (*Oneof_F_Message)(nil), - (*Oneof_FGroup)(nil), - (*Oneof_F_Largest_Tag)(nil), - (*Oneof_Value)(nil), - } -} - -func _Oneof_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Oneof) - // union - switch x := m.Union.(type) { - case *Oneof_F_Bool: - t := uint64(0) - if x.F_Bool { - t = 1 - } - b.EncodeVarint(1<<3 | proto.WireVarint) - b.EncodeVarint(t) - case *Oneof_F_Int32: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Int32)) - case *Oneof_F_Int64: - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Int64)) - case *Oneof_F_Fixed32: - b.EncodeVarint(4<<3 | proto.WireFixed32) - b.EncodeFixed32(uint64(x.F_Fixed32)) - case *Oneof_F_Fixed64: - b.EncodeVarint(5<<3 | proto.WireFixed64) - b.EncodeFixed64(uint64(x.F_Fixed64)) - case *Oneof_F_Uint32: - b.EncodeVarint(6<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Uint32)) - case *Oneof_F_Uint64: - b.EncodeVarint(7<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Uint64)) - case *Oneof_F_Float: - b.EncodeVarint(8<<3 | proto.WireFixed32) - b.EncodeFixed32(uint64(math.Float32bits(x.F_Float))) - case *Oneof_F_Double: - b.EncodeVarint(9<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.F_Double)) - case *Oneof_F_String: - b.EncodeVarint(10<<3 | proto.WireBytes) - b.EncodeStringBytes(x.F_String) - case *Oneof_F_Bytes: - b.EncodeVarint(11<<3 | proto.WireBytes) - b.EncodeRawBytes(x.F_Bytes) - case *Oneof_F_Sint32: - b.EncodeVarint(12<<3 | proto.WireVarint) - b.EncodeZigzag32(uint64(x.F_Sint32)) - case *Oneof_F_Sint64: - b.EncodeVarint(13<<3 | proto.WireVarint) - b.EncodeZigzag64(uint64(x.F_Sint64)) - case *Oneof_F_Enum: - b.EncodeVarint(14<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Enum)) - case *Oneof_F_Message: - b.EncodeVarint(15<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.F_Message); err != nil { - return err - } - case *Oneof_FGroup: - b.EncodeVarint(16<<3 | proto.WireStartGroup) - if err := b.Marshal(x.FGroup); err != nil { - return err - } - b.EncodeVarint(16<<3 | proto.WireEndGroup) - case *Oneof_F_Largest_Tag: - b.EncodeVarint(536870911<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.F_Largest_Tag)) - case nil: - default: - return fmt.Errorf("Oneof.Union has unexpected type %T", x) - } - // tormato - switch x := m.Tormato.(type) { - case *Oneof_Value: - b.EncodeVarint(100<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Value)) - case nil: - default: - return fmt.Errorf("Oneof.Tormato has unexpected type %T", x) - } - return nil -} - -func _Oneof_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Oneof) - switch tag { - case 1: // union.F_Bool - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Bool{x != 0} - return true, err - case 2: // union.F_Int32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Int32{int32(x)} - return true, err - case 3: // union.F_Int64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Int64{int64(x)} - return true, err - case 4: // union.F_Fixed32 - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.Union = &Oneof_F_Fixed32{uint32(x)} - return true, err - case 5: // union.F_Fixed64 - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Oneof_F_Fixed64{x} - return true, err - case 6: // union.F_Uint32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Uint32{uint32(x)} - return true, err - case 7: // union.F_Uint64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Uint64{x} - return true, err - case 8: // union.F_Float - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.Union = &Oneof_F_Float{math.Float32frombits(uint32(x))} - return true, err - case 9: // union.F_Double - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Oneof_F_Double{math.Float64frombits(x)} - return true, err - case 10: // union.F_String - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &Oneof_F_String{x} - return true, err - case 11: // union.F_Bytes - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Union = &Oneof_F_Bytes{x} - return true, err - case 12: // union.F_Sint32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeZigzag32() - m.Union = &Oneof_F_Sint32{int32(x)} - return true, err - case 13: // union.F_Sint64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeZigzag64() - m.Union = &Oneof_F_Sint64{int64(x)} - return true, err - case 14: // union.F_Enum - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Enum{MyMessage_Color(x)} - return true, err - case 15: // union.F_Message - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(GoTestField) - err := b.DecodeMessage(msg) - m.Union = &Oneof_F_Message{msg} - return true, err - case 16: // union.f_group - if wire != proto.WireStartGroup { - return true, proto.ErrInternalBadWireType - } - msg := new(Oneof_F_Group) - err := b.DecodeGroup(msg) - m.Union = &Oneof_FGroup{msg} - return true, err - case 536870911: // union.F_Largest_Tag - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Oneof_F_Largest_Tag{int32(x)} - return true, err - case 100: // tormato.value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Tormato = &Oneof_Value{int32(x)} - return true, err - default: - return false, nil - } -} - -func _Oneof_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Oneof) - // union - switch x := m.Union.(type) { - case *Oneof_F_Bool: - n += proto.SizeVarint(1<<3 | proto.WireVarint) - n += 1 - case *Oneof_F_Int32: - n += proto.SizeVarint(2<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Int32)) - case *Oneof_F_Int64: - n += proto.SizeVarint(3<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Int64)) - case *Oneof_F_Fixed32: - n += proto.SizeVarint(4<<3 | proto.WireFixed32) - n += 4 - case *Oneof_F_Fixed64: - n += proto.SizeVarint(5<<3 | proto.WireFixed64) - n += 8 - case *Oneof_F_Uint32: - n += proto.SizeVarint(6<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Uint32)) - case *Oneof_F_Uint64: - n += proto.SizeVarint(7<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Uint64)) - case *Oneof_F_Float: - n += proto.SizeVarint(8<<3 | proto.WireFixed32) - n += 4 - case *Oneof_F_Double: - n += proto.SizeVarint(9<<3 | proto.WireFixed64) - n += 8 - case *Oneof_F_String: - n += proto.SizeVarint(10<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.F_String))) - n += len(x.F_String) - case *Oneof_F_Bytes: - n += proto.SizeVarint(11<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.F_Bytes))) - n += len(x.F_Bytes) - case *Oneof_F_Sint32: - n += proto.SizeVarint(12<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64((uint32(x.F_Sint32) << 1) ^ uint32((int32(x.F_Sint32) >> 31)))) - case *Oneof_F_Sint64: - n += proto.SizeVarint(13<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(uint64(x.F_Sint64<<1) ^ uint64((int64(x.F_Sint64) >> 63)))) - case *Oneof_F_Enum: - n += proto.SizeVarint(14<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Enum)) - case *Oneof_F_Message: - s := proto.Size(x.F_Message) - n += proto.SizeVarint(15<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *Oneof_FGroup: - n += proto.SizeVarint(16<<3 | proto.WireStartGroup) - n += proto.Size(x.FGroup) - n += proto.SizeVarint(16<<3 | proto.WireEndGroup) - case *Oneof_F_Largest_Tag: - n += proto.SizeVarint(536870911<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.F_Largest_Tag)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // tormato - switch x := m.Tormato.(type) { - case *Oneof_Value: - n += proto.SizeVarint(100<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Value)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type Oneof_F_Group struct { - X *int32 `protobuf:"varint,17,opt,name=x" json:"x,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } -func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } -func (*Oneof_F_Group) ProtoMessage() {} -func (*Oneof_F_Group) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28, 0} } - -func (m *Oneof_F_Group) GetX() int32 { - if m != nil && m.X != nil { - return *m.X - } - return 0 -} - -type Communique struct { - MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"` - // This is a oneof, called "union". - // - // Types that are valid to be assigned to Union: - // *Communique_Number - // *Communique_Name - // *Communique_Data - // *Communique_TempC - // *Communique_Col - // *Communique_Msg - Union isCommunique_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Communique) Reset() { *m = Communique{} } -func (m *Communique) String() string { return proto.CompactTextString(m) } -func (*Communique) ProtoMessage() {} -func (*Communique) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } - -type isCommunique_Union interface { - isCommunique_Union() -} - -type Communique_Number struct { - Number int32 `protobuf:"varint,5,opt,name=number,oneof"` -} -type Communique_Name struct { - Name string `protobuf:"bytes,6,opt,name=name,oneof"` -} -type Communique_Data struct { - Data []byte `protobuf:"bytes,7,opt,name=data,oneof"` -} -type Communique_TempC struct { - TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"` -} -type Communique_Col struct { - Col MyMessage_Color `protobuf:"varint,9,opt,name=col,enum=testdata.MyMessage_Color,oneof"` -} -type Communique_Msg struct { - Msg *Strings `protobuf:"bytes,10,opt,name=msg,oneof"` -} - -func (*Communique_Number) isCommunique_Union() {} -func (*Communique_Name) isCommunique_Union() {} -func (*Communique_Data) isCommunique_Union() {} -func (*Communique_TempC) isCommunique_Union() {} -func (*Communique_Col) isCommunique_Union() {} -func (*Communique_Msg) isCommunique_Union() {} - -func (m *Communique) GetUnion() isCommunique_Union { - if m != nil { - return m.Union - } - return nil -} - -func (m *Communique) GetMakeMeCry() bool { - if m != nil && m.MakeMeCry != nil { - return *m.MakeMeCry - } - return false -} - -func (m *Communique) GetNumber() int32 { - if x, ok := m.GetUnion().(*Communique_Number); ok { - return x.Number - } - return 0 -} - -func (m *Communique) GetName() string { - if x, ok := m.GetUnion().(*Communique_Name); ok { - return x.Name - } - return "" -} - -func (m *Communique) GetData() []byte { - if x, ok := m.GetUnion().(*Communique_Data); ok { - return x.Data - } - return nil -} - -func (m *Communique) GetTempC() float64 { - if x, ok := m.GetUnion().(*Communique_TempC); ok { - return x.TempC - } - return 0 -} - -func (m *Communique) GetCol() MyMessage_Color { - if x, ok := m.GetUnion().(*Communique_Col); ok { - return x.Col - } - return MyMessage_RED -} - -func (m *Communique) GetMsg() *Strings { - if x, ok := m.GetUnion().(*Communique_Msg); ok { - return x.Msg - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{ - (*Communique_Number)(nil), - (*Communique_Name)(nil), - (*Communique_Data)(nil), - (*Communique_TempC)(nil), - (*Communique_Col)(nil), - (*Communique_Msg)(nil), - } -} - -func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - b.EncodeVarint(5<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Number)) - case *Communique_Name: - b.EncodeVarint(6<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Name) - case *Communique_Data: - b.EncodeVarint(7<<3 | proto.WireBytes) - b.EncodeRawBytes(x.Data) - case *Communique_TempC: - b.EncodeVarint(8<<3 | proto.WireFixed64) - b.EncodeFixed64(math.Float64bits(x.TempC)) - case *Communique_Col: - b.EncodeVarint(9<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.Col)) - case *Communique_Msg: - b.EncodeVarint(10<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Msg); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Communique.Union has unexpected type %T", x) - } - return nil -} - -func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Communique) - switch tag { - case 5: // union.number - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Number{int32(x)} - return true, err - case 6: // union.name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Union = &Communique_Name{x} - return true, err - case 7: // union.data - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Union = &Communique_Data{x} - return true, err - case 8: // union.temp_c - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Union = &Communique_TempC{math.Float64frombits(x)} - return true, err - case 9: // union.col - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Union = &Communique_Col{MyMessage_Color(x)} - return true, err - case 10: // union.msg - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Strings) - err := b.DecodeMessage(msg) - m.Union = &Communique_Msg{msg} - return true, err - default: - return false, nil - } -} - -func _Communique_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Communique) - // union - switch x := m.Union.(type) { - case *Communique_Number: - n += proto.SizeVarint(5<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Number)) - case *Communique_Name: - n += proto.SizeVarint(6<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Name))) - n += len(x.Name) - case *Communique_Data: - n += proto.SizeVarint(7<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Data))) - n += len(x.Data) - case *Communique_TempC: - n += proto.SizeVarint(8<<3 | proto.WireFixed64) - n += 8 - case *Communique_Col: - n += proto.SizeVarint(9<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.Col)) - case *Communique_Msg: - s := proto.Size(x.Msg) - n += proto.SizeVarint(10<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -var E_Greeting = &proto.ExtensionDesc{ - ExtendedType: (*MyMessage)(nil), - ExtensionType: ([]string)(nil), - Field: 106, - Name: "testdata.greeting", - Tag: "bytes,106,rep,name=greeting", -} - -var E_Complex = &proto.ExtensionDesc{ - ExtendedType: (*OtherMessage)(nil), - ExtensionType: (*ComplexExtension)(nil), - Field: 200, - Name: "testdata.complex", - Tag: "bytes,200,opt,name=complex", -} - -var E_RComplex = &proto.ExtensionDesc{ - ExtendedType: (*OtherMessage)(nil), - ExtensionType: ([]*ComplexExtension)(nil), - Field: 201, - Name: "testdata.r_complex", - Tag: "bytes,201,rep,name=r_complex,json=rComplex", -} - -var E_NoDefaultDouble = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*float64)(nil), - Field: 101, - Name: "testdata.no_default_double", - Tag: "fixed64,101,opt,name=no_default_double,json=noDefaultDouble", -} - -var E_NoDefaultFloat = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*float32)(nil), - Field: 102, - Name: "testdata.no_default_float", - Tag: "fixed32,102,opt,name=no_default_float,json=noDefaultFloat", -} - -var E_NoDefaultInt32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 103, - Name: "testdata.no_default_int32", - Tag: "varint,103,opt,name=no_default_int32,json=noDefaultInt32", -} - -var E_NoDefaultInt64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 104, - Name: "testdata.no_default_int64", - Tag: "varint,104,opt,name=no_default_int64,json=noDefaultInt64", -} - -var E_NoDefaultUint32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 105, - Name: "testdata.no_default_uint32", - Tag: "varint,105,opt,name=no_default_uint32,json=noDefaultUint32", -} - -var E_NoDefaultUint64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint64)(nil), - Field: 106, - Name: "testdata.no_default_uint64", - Tag: "varint,106,opt,name=no_default_uint64,json=noDefaultUint64", -} - -var E_NoDefaultSint32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 107, - Name: "testdata.no_default_sint32", - Tag: "zigzag32,107,opt,name=no_default_sint32,json=noDefaultSint32", -} - -var E_NoDefaultSint64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 108, - Name: "testdata.no_default_sint64", - Tag: "zigzag64,108,opt,name=no_default_sint64,json=noDefaultSint64", -} - -var E_NoDefaultFixed32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 109, - Name: "testdata.no_default_fixed32", - Tag: "fixed32,109,opt,name=no_default_fixed32,json=noDefaultFixed32", -} - -var E_NoDefaultFixed64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint64)(nil), - Field: 110, - Name: "testdata.no_default_fixed64", - Tag: "fixed64,110,opt,name=no_default_fixed64,json=noDefaultFixed64", -} - -var E_NoDefaultSfixed32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 111, - Name: "testdata.no_default_sfixed32", - Tag: "fixed32,111,opt,name=no_default_sfixed32,json=noDefaultSfixed32", -} - -var E_NoDefaultSfixed64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 112, - Name: "testdata.no_default_sfixed64", - Tag: "fixed64,112,opt,name=no_default_sfixed64,json=noDefaultSfixed64", -} - -var E_NoDefaultBool = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*bool)(nil), - Field: 113, - Name: "testdata.no_default_bool", - Tag: "varint,113,opt,name=no_default_bool,json=noDefaultBool", -} - -var E_NoDefaultString = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*string)(nil), - Field: 114, - Name: "testdata.no_default_string", - Tag: "bytes,114,opt,name=no_default_string,json=noDefaultString", -} - -var E_NoDefaultBytes = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: ([]byte)(nil), - Field: 115, - Name: "testdata.no_default_bytes", - Tag: "bytes,115,opt,name=no_default_bytes,json=noDefaultBytes", -} - -var E_NoDefaultEnum = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), - Field: 116, - Name: "testdata.no_default_enum", - Tag: "varint,116,opt,name=no_default_enum,json=noDefaultEnum,enum=testdata.DefaultsMessage_DefaultsEnum", -} - -var E_DefaultDouble = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*float64)(nil), - Field: 201, - Name: "testdata.default_double", - Tag: "fixed64,201,opt,name=default_double,json=defaultDouble,def=3.1415", -} - -var E_DefaultFloat = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*float32)(nil), - Field: 202, - Name: "testdata.default_float", - Tag: "fixed32,202,opt,name=default_float,json=defaultFloat,def=3.14", -} - -var E_DefaultInt32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 203, - Name: "testdata.default_int32", - Tag: "varint,203,opt,name=default_int32,json=defaultInt32,def=42", -} - -var E_DefaultInt64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 204, - Name: "testdata.default_int64", - Tag: "varint,204,opt,name=default_int64,json=defaultInt64,def=43", -} - -var E_DefaultUint32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 205, - Name: "testdata.default_uint32", - Tag: "varint,205,opt,name=default_uint32,json=defaultUint32,def=44", -} - -var E_DefaultUint64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint64)(nil), - Field: 206, - Name: "testdata.default_uint64", - Tag: "varint,206,opt,name=default_uint64,json=defaultUint64,def=45", -} - -var E_DefaultSint32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 207, - Name: "testdata.default_sint32", - Tag: "zigzag32,207,opt,name=default_sint32,json=defaultSint32,def=46", -} - -var E_DefaultSint64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 208, - Name: "testdata.default_sint64", - Tag: "zigzag64,208,opt,name=default_sint64,json=defaultSint64,def=47", -} - -var E_DefaultFixed32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint32)(nil), - Field: 209, - Name: "testdata.default_fixed32", - Tag: "fixed32,209,opt,name=default_fixed32,json=defaultFixed32,def=48", -} - -var E_DefaultFixed64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*uint64)(nil), - Field: 210, - Name: "testdata.default_fixed64", - Tag: "fixed64,210,opt,name=default_fixed64,json=defaultFixed64,def=49", -} - -var E_DefaultSfixed32 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int32)(nil), - Field: 211, - Name: "testdata.default_sfixed32", - Tag: "fixed32,211,opt,name=default_sfixed32,json=defaultSfixed32,def=50", -} - -var E_DefaultSfixed64 = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*int64)(nil), - Field: 212, - Name: "testdata.default_sfixed64", - Tag: "fixed64,212,opt,name=default_sfixed64,json=defaultSfixed64,def=51", -} - -var E_DefaultBool = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*bool)(nil), - Field: 213, - Name: "testdata.default_bool", - Tag: "varint,213,opt,name=default_bool,json=defaultBool,def=1", -} - -var E_DefaultString = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*string)(nil), - Field: 214, - Name: "testdata.default_string", - Tag: "bytes,214,opt,name=default_string,json=defaultString,def=Hello, string", -} - -var E_DefaultBytes = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: ([]byte)(nil), - Field: 215, - Name: "testdata.default_bytes", - Tag: "bytes,215,opt,name=default_bytes,json=defaultBytes,def=Hello, bytes", -} - -var E_DefaultEnum = &proto.ExtensionDesc{ - ExtendedType: (*DefaultsMessage)(nil), - ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), - Field: 216, - Name: "testdata.default_enum", - Tag: "varint,216,opt,name=default_enum,json=defaultEnum,enum=testdata.DefaultsMessage_DefaultsEnum,def=1", -} - -var E_X201 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 201, - Name: "testdata.x201", - Tag: "bytes,201,opt,name=x201", -} - -var E_X202 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 202, - Name: "testdata.x202", - Tag: "bytes,202,opt,name=x202", -} - -var E_X203 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 203, - Name: "testdata.x203", - Tag: "bytes,203,opt,name=x203", -} - -var E_X204 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 204, - Name: "testdata.x204", - Tag: "bytes,204,opt,name=x204", -} - -var E_X205 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 205, - Name: "testdata.x205", - Tag: "bytes,205,opt,name=x205", -} - -var E_X206 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 206, - Name: "testdata.x206", - Tag: "bytes,206,opt,name=x206", -} - -var E_X207 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 207, - Name: "testdata.x207", - Tag: "bytes,207,opt,name=x207", -} - -var E_X208 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 208, - Name: "testdata.x208", - Tag: "bytes,208,opt,name=x208", -} - -var E_X209 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 209, - Name: "testdata.x209", - Tag: "bytes,209,opt,name=x209", -} - -var E_X210 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 210, - Name: "testdata.x210", - Tag: "bytes,210,opt,name=x210", -} - -var E_X211 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 211, - Name: "testdata.x211", - Tag: "bytes,211,opt,name=x211", -} - -var E_X212 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 212, - Name: "testdata.x212", - Tag: "bytes,212,opt,name=x212", -} - -var E_X213 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 213, - Name: "testdata.x213", - Tag: "bytes,213,opt,name=x213", -} - -var E_X214 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 214, - Name: "testdata.x214", - Tag: "bytes,214,opt,name=x214", -} - -var E_X215 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 215, - Name: "testdata.x215", - Tag: "bytes,215,opt,name=x215", -} - -var E_X216 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 216, - Name: "testdata.x216", - Tag: "bytes,216,opt,name=x216", -} - -var E_X217 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 217, - Name: "testdata.x217", - Tag: "bytes,217,opt,name=x217", -} - -var E_X218 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 218, - Name: "testdata.x218", - Tag: "bytes,218,opt,name=x218", -} - -var E_X219 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 219, - Name: "testdata.x219", - Tag: "bytes,219,opt,name=x219", -} - -var E_X220 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 220, - Name: "testdata.x220", - Tag: "bytes,220,opt,name=x220", -} - -var E_X221 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 221, - Name: "testdata.x221", - Tag: "bytes,221,opt,name=x221", -} - -var E_X222 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 222, - Name: "testdata.x222", - Tag: "bytes,222,opt,name=x222", -} - -var E_X223 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 223, - Name: "testdata.x223", - Tag: "bytes,223,opt,name=x223", -} - -var E_X224 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 224, - Name: "testdata.x224", - Tag: "bytes,224,opt,name=x224", -} - -var E_X225 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 225, - Name: "testdata.x225", - Tag: "bytes,225,opt,name=x225", -} - -var E_X226 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 226, - Name: "testdata.x226", - Tag: "bytes,226,opt,name=x226", -} - -var E_X227 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 227, - Name: "testdata.x227", - Tag: "bytes,227,opt,name=x227", -} - -var E_X228 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 228, - Name: "testdata.x228", - Tag: "bytes,228,opt,name=x228", -} - -var E_X229 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 229, - Name: "testdata.x229", - Tag: "bytes,229,opt,name=x229", -} - -var E_X230 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 230, - Name: "testdata.x230", - Tag: "bytes,230,opt,name=x230", -} - -var E_X231 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 231, - Name: "testdata.x231", - Tag: "bytes,231,opt,name=x231", -} - -var E_X232 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 232, - Name: "testdata.x232", - Tag: "bytes,232,opt,name=x232", -} - -var E_X233 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 233, - Name: "testdata.x233", - Tag: "bytes,233,opt,name=x233", -} - -var E_X234 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 234, - Name: "testdata.x234", - Tag: "bytes,234,opt,name=x234", -} - -var E_X235 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 235, - Name: "testdata.x235", - Tag: "bytes,235,opt,name=x235", -} - -var E_X236 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 236, - Name: "testdata.x236", - Tag: "bytes,236,opt,name=x236", -} - -var E_X237 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 237, - Name: "testdata.x237", - Tag: "bytes,237,opt,name=x237", -} - -var E_X238 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 238, - Name: "testdata.x238", - Tag: "bytes,238,opt,name=x238", -} - -var E_X239 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 239, - Name: "testdata.x239", - Tag: "bytes,239,opt,name=x239", -} - -var E_X240 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 240, - Name: "testdata.x240", - Tag: "bytes,240,opt,name=x240", -} - -var E_X241 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 241, - Name: "testdata.x241", - Tag: "bytes,241,opt,name=x241", -} - -var E_X242 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 242, - Name: "testdata.x242", - Tag: "bytes,242,opt,name=x242", -} - -var E_X243 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 243, - Name: "testdata.x243", - Tag: "bytes,243,opt,name=x243", -} - -var E_X244 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 244, - Name: "testdata.x244", - Tag: "bytes,244,opt,name=x244", -} - -var E_X245 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 245, - Name: "testdata.x245", - Tag: "bytes,245,opt,name=x245", -} - -var E_X246 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 246, - Name: "testdata.x246", - Tag: "bytes,246,opt,name=x246", -} - -var E_X247 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 247, - Name: "testdata.x247", - Tag: "bytes,247,opt,name=x247", -} - -var E_X248 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 248, - Name: "testdata.x248", - Tag: "bytes,248,opt,name=x248", -} - -var E_X249 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 249, - Name: "testdata.x249", - Tag: "bytes,249,opt,name=x249", -} - -var E_X250 = &proto.ExtensionDesc{ - ExtendedType: (*MyMessageSet)(nil), - ExtensionType: (*Empty)(nil), - Field: 250, - Name: "testdata.x250", - Tag: "bytes,250,opt,name=x250", -} - -func init() { - proto.RegisterType((*GoEnum)(nil), "testdata.GoEnum") - proto.RegisterType((*GoTestField)(nil), "testdata.GoTestField") - proto.RegisterType((*GoTest)(nil), "testdata.GoTest") - proto.RegisterType((*GoTest_RequiredGroup)(nil), "testdata.GoTest.RequiredGroup") - proto.RegisterType((*GoTest_RepeatedGroup)(nil), "testdata.GoTest.RepeatedGroup") - proto.RegisterType((*GoTest_OptionalGroup)(nil), "testdata.GoTest.OptionalGroup") - proto.RegisterType((*GoSkipTest)(nil), "testdata.GoSkipTest") - proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "testdata.GoSkipTest.SkipGroup") - proto.RegisterType((*NonPackedTest)(nil), "testdata.NonPackedTest") - proto.RegisterType((*PackedTest)(nil), "testdata.PackedTest") - proto.RegisterType((*MaxTag)(nil), "testdata.MaxTag") - proto.RegisterType((*OldMessage)(nil), "testdata.OldMessage") - proto.RegisterType((*OldMessage_Nested)(nil), "testdata.OldMessage.Nested") - proto.RegisterType((*NewMessage)(nil), "testdata.NewMessage") - proto.RegisterType((*NewMessage_Nested)(nil), "testdata.NewMessage.Nested") - proto.RegisterType((*InnerMessage)(nil), "testdata.InnerMessage") - proto.RegisterType((*OtherMessage)(nil), "testdata.OtherMessage") - proto.RegisterType((*RequiredInnerMessage)(nil), "testdata.RequiredInnerMessage") - proto.RegisterType((*MyMessage)(nil), "testdata.MyMessage") - proto.RegisterType((*MyMessage_SomeGroup)(nil), "testdata.MyMessage.SomeGroup") - proto.RegisterType((*Ext)(nil), "testdata.Ext") - proto.RegisterType((*ComplexExtension)(nil), "testdata.ComplexExtension") - proto.RegisterType((*DefaultsMessage)(nil), "testdata.DefaultsMessage") - proto.RegisterType((*MyMessageSet)(nil), "testdata.MyMessageSet") - proto.RegisterType((*Empty)(nil), "testdata.Empty") - proto.RegisterType((*MessageList)(nil), "testdata.MessageList") - proto.RegisterType((*MessageList_Message)(nil), "testdata.MessageList.Message") - proto.RegisterType((*Strings)(nil), "testdata.Strings") - proto.RegisterType((*Defaults)(nil), "testdata.Defaults") - proto.RegisterType((*SubDefaults)(nil), "testdata.SubDefaults") - proto.RegisterType((*RepeatedEnum)(nil), "testdata.RepeatedEnum") - proto.RegisterType((*MoreRepeated)(nil), "testdata.MoreRepeated") - proto.RegisterType((*GroupOld)(nil), "testdata.GroupOld") - proto.RegisterType((*GroupOld_G)(nil), "testdata.GroupOld.G") - proto.RegisterType((*GroupNew)(nil), "testdata.GroupNew") - proto.RegisterType((*GroupNew_G)(nil), "testdata.GroupNew.G") - proto.RegisterType((*FloatingPoint)(nil), "testdata.FloatingPoint") - proto.RegisterType((*MessageWithMap)(nil), "testdata.MessageWithMap") - proto.RegisterType((*Oneof)(nil), "testdata.Oneof") - proto.RegisterType((*Oneof_F_Group)(nil), "testdata.Oneof.F_Group") - proto.RegisterType((*Communique)(nil), "testdata.Communique") - proto.RegisterEnum("testdata.FOO", FOO_name, FOO_value) - proto.RegisterEnum("testdata.GoTest_KIND", GoTest_KIND_name, GoTest_KIND_value) - proto.RegisterEnum("testdata.MyMessage_Color", MyMessage_Color_name, MyMessage_Color_value) - proto.RegisterEnum("testdata.DefaultsMessage_DefaultsEnum", DefaultsMessage_DefaultsEnum_name, DefaultsMessage_DefaultsEnum_value) - proto.RegisterEnum("testdata.Defaults_Color", Defaults_Color_name, Defaults_Color_value) - proto.RegisterEnum("testdata.RepeatedEnum_Color", RepeatedEnum_Color_name, RepeatedEnum_Color_value) - proto.RegisterExtension(E_Ext_More) - proto.RegisterExtension(E_Ext_Text) - proto.RegisterExtension(E_Ext_Number) - proto.RegisterExtension(E_Greeting) - proto.RegisterExtension(E_Complex) - proto.RegisterExtension(E_RComplex) - proto.RegisterExtension(E_NoDefaultDouble) - proto.RegisterExtension(E_NoDefaultFloat) - proto.RegisterExtension(E_NoDefaultInt32) - proto.RegisterExtension(E_NoDefaultInt64) - proto.RegisterExtension(E_NoDefaultUint32) - proto.RegisterExtension(E_NoDefaultUint64) - proto.RegisterExtension(E_NoDefaultSint32) - proto.RegisterExtension(E_NoDefaultSint64) - proto.RegisterExtension(E_NoDefaultFixed32) - proto.RegisterExtension(E_NoDefaultFixed64) - proto.RegisterExtension(E_NoDefaultSfixed32) - proto.RegisterExtension(E_NoDefaultSfixed64) - proto.RegisterExtension(E_NoDefaultBool) - proto.RegisterExtension(E_NoDefaultString) - proto.RegisterExtension(E_NoDefaultBytes) - proto.RegisterExtension(E_NoDefaultEnum) - proto.RegisterExtension(E_DefaultDouble) - proto.RegisterExtension(E_DefaultFloat) - proto.RegisterExtension(E_DefaultInt32) - proto.RegisterExtension(E_DefaultInt64) - proto.RegisterExtension(E_DefaultUint32) - proto.RegisterExtension(E_DefaultUint64) - proto.RegisterExtension(E_DefaultSint32) - proto.RegisterExtension(E_DefaultSint64) - proto.RegisterExtension(E_DefaultFixed32) - proto.RegisterExtension(E_DefaultFixed64) - proto.RegisterExtension(E_DefaultSfixed32) - proto.RegisterExtension(E_DefaultSfixed64) - proto.RegisterExtension(E_DefaultBool) - proto.RegisterExtension(E_DefaultString) - proto.RegisterExtension(E_DefaultBytes) - proto.RegisterExtension(E_DefaultEnum) - proto.RegisterExtension(E_X201) - proto.RegisterExtension(E_X202) - proto.RegisterExtension(E_X203) - proto.RegisterExtension(E_X204) - proto.RegisterExtension(E_X205) - proto.RegisterExtension(E_X206) - proto.RegisterExtension(E_X207) - proto.RegisterExtension(E_X208) - proto.RegisterExtension(E_X209) - proto.RegisterExtension(E_X210) - proto.RegisterExtension(E_X211) - proto.RegisterExtension(E_X212) - proto.RegisterExtension(E_X213) - proto.RegisterExtension(E_X214) - proto.RegisterExtension(E_X215) - proto.RegisterExtension(E_X216) - proto.RegisterExtension(E_X217) - proto.RegisterExtension(E_X218) - proto.RegisterExtension(E_X219) - proto.RegisterExtension(E_X220) - proto.RegisterExtension(E_X221) - proto.RegisterExtension(E_X222) - proto.RegisterExtension(E_X223) - proto.RegisterExtension(E_X224) - proto.RegisterExtension(E_X225) - proto.RegisterExtension(E_X226) - proto.RegisterExtension(E_X227) - proto.RegisterExtension(E_X228) - proto.RegisterExtension(E_X229) - proto.RegisterExtension(E_X230) - proto.RegisterExtension(E_X231) - proto.RegisterExtension(E_X232) - proto.RegisterExtension(E_X233) - proto.RegisterExtension(E_X234) - proto.RegisterExtension(E_X235) - proto.RegisterExtension(E_X236) - proto.RegisterExtension(E_X237) - proto.RegisterExtension(E_X238) - proto.RegisterExtension(E_X239) - proto.RegisterExtension(E_X240) - proto.RegisterExtension(E_X241) - proto.RegisterExtension(E_X242) - proto.RegisterExtension(E_X243) - proto.RegisterExtension(E_X244) - proto.RegisterExtension(E_X245) - proto.RegisterExtension(E_X246) - proto.RegisterExtension(E_X247) - proto.RegisterExtension(E_X248) - proto.RegisterExtension(E_X249) - proto.RegisterExtension(E_X250) -} - -var fileDescriptor0 = []byte{ - // 4407 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x5a, 0x59, 0x77, 0xdb, 0x48, - 0x76, 0x36, 0xc0, 0xfd, 0x92, 0x12, 0xa1, 0xb2, 0xda, 0x4d, 0x4b, 0x5e, 0x60, 0xce, 0x74, 0x37, - 0xbd, 0x69, 0x24, 0x10, 0xa2, 0x6d, 0xba, 0xd3, 0xe7, 0x78, 0xa1, 0x64, 0x9d, 0xb1, 0x44, 0x05, - 0x52, 0x77, 0x9f, 0xe9, 0x3c, 0xf0, 0x50, 0x22, 0x48, 0xb3, 0x4d, 0x02, 0x34, 0x09, 0xc5, 0x52, - 0xf2, 0xd2, 0x2f, 0xc9, 0x6b, 0xb6, 0x97, 0xbc, 0xe6, 0x29, 0x4f, 0x49, 0xce, 0xc9, 0x9f, 0x48, - 0xba, 0x7b, 0xd6, 0x9e, 0x35, 0xeb, 0x64, 0x5f, 0x26, 0xfb, 0x36, 0x93, 0xe4, 0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6, 0x20, 0x76, 0xcf, 0x19, 0xf7, - 0xad, 0x9e, 0x8f, 0x3d, 0x8f, 0xfa, 0x2d, 0x76, 0x59, 0x7b, 0xd0, 0x83, 0x87, 0x27, 0x8e, 0x39, - 0xf1, 0xa1, 0xa6, 0x2a, 0x57, 0x0a, 0xc6, 0x7c, 0x17, 0x9b, 0x43, 0x56, 0x43, 0x6b, 0xd0, 0x55, - 0xe5, 0xca, 0x02, 0xb5, 0x3a, 0x63, 0x0d, 0xf6, 0x42, 0x6b, 0xd0, 0x53, 0xe5, 0x0a, 0xe1, 0x58, - 0x61, 0x0d, 0x44, 0xcd, 0x30, 0x21, 0x96, 0x16, 0xd5, 0x84, 0xa0, 0x19, 0xd6, 0x18, 0xd4, 0x0c, - 0x07, 0xbe, 0xa6, 0x26, 0x44, 0xcd, 0x84, 0x90, 0x38, 0x38, 0x47, 0x5e, 0x50, 0x13, 0xa2, 0x66, - 0x38, 0x32, 0xa4, 0x19, 0x8e, 0x7d, 0x5d, 0x4d, 0x04, 0x35, 0x33, 0x85, 0x16, 0x2d, 0x97, 0xd4, - 0x44, 0x50, 0x33, 0x1c, 0x1d, 0xd4, 0x0c, 0x07, 0x5f, 0x54, 0x13, 0x01, 0xcd, 0x84, 0xb1, 0xa2, - 0xe1, 0x25, 0x35, 0x11, 0xd0, 0x8c, 0x38, 0x3b, 0x57, 0x33, 0x1c, 0xba, 0xac, 0x26, 0x44, 0xcd, - 0x88, 0x56, 0x3d, 0xcd, 0x70, 0xe8, 0x25, 0x35, 0x11, 0xd0, 0x8c, 0x88, 0xf5, 0x34, 0xc3, 0xb1, - 0x97, 0xd5, 0x44, 0x40, 0x33, 0x1c, 0x7b, 0x5d, 0xd4, 0x0c, 0x87, 0x7e, 0x2c, 0xa9, 0x09, 0x51, - 0x34, 0x1c, 0x7a, 0x33, 0x20, 0x1a, 0x8e, 0xfd, 0x84, 0x62, 0x45, 0xd5, 0x84, 0xc1, 0xe2, 0x2a, - 0x7c, 0x4a, 0x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0x32, 0x14, 0xb9, 0xff, 0xee, 0xee, 0xd3, 0x86, 0x92, - 0xa5, 0x3f, 0x1f, 0x18, 0xc6, 0x83, 0xaf, 0x28, 0x39, 0x4a, 0xda, 0x7e, 0xb0, 0xab, 0x00, 0x76, - 0x3f, 0x78, 0xf8, 0xb4, 0xa1, 0xe4, 0x49, 0x01, 0xb2, 0x1b, 0xef, 0xee, 0x3c, 0xda, 0xdf, 0x6a, - 0xee, 0x28, 0x85, 0xf2, 0x6f, 0xc9, 0x00, 0x9b, 0xf6, 0xde, 0xf3, 0xfe, 0x08, 0xab, 0xe2, 0xcb, - 0x00, 0x93, 0xe7, 0xfd, 0x51, 0x0b, 0xa5, 0xc7, 0x2b, 0xbb, 0x1c, 0x6d, 0xc1, 0xa0, 0x43, 0xae, - 0x41, 0x01, 0xbb, 0xbb, 0x2c, 0x14, 0x60, 0x41, 0x97, 0x31, 0xf2, 0xb4, 0x8d, 0x47, 0x87, 0x20, - 0xa4, 0xa6, 0x63, 0x1d, 0x97, 0x16, 0x20, 0x35, 0x9d, 0x5c, 0x05, 0x7c, 0x6c, 0x4d, 0x30, 0xac, - 0x63, 0xed, 0x96, 0x33, 0x70, 0x5c, 0x16, 0xe8, 0xc9, 0xdb, 0x80, 0x63, 0x32, 0x59, 0x14, 0xa7, - 0x25, 0xea, 0xba, 0xbb, 0x42, 0x7f, 0x30, 0x59, 0xf8, 0x84, 0xa5, 0x26, 0xe4, 0xbc, 0x76, 0x3a, - 0x16, 0xb6, 0xf2, 0x19, 0x29, 0x38, 0x23, 0xc0, 0x26, 0x6f, 0x4a, 0x0c, 0xc0, 0xbd, 0x59, 0x40, - 0x6f, 0x18, 0x89, 0xb9, 0x53, 0xbe, 0x0c, 0x73, 0x3b, 0xb6, 0xc5, 0xb6, 0x10, 0xae, 0x52, 0x01, - 0xa4, 0x76, 0x49, 0xc2, 0x12, 0x46, 0x6a, 0x97, 0xaf, 0x00, 0x08, 0x7d, 0x0a, 0x48, 0x07, 0xac, -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0xf2, 0x1c, 0xf4, 0xb4, 0x3f, 0x71, 0xc8, 0x1d, - 0xc8, 0x0c, 0xf9, 0x7c, 0x25, 0x3c, 0x73, 0x89, 0x9a, 0xf2, 0x71, 0xee, 0x6f, 0xc3, 0x45, 0x2f, - 0x55, 0x21, 0x23, 0xc4, 0x52, 0xbe, 0xd5, 0x65, 0x71, 0xab, 0xb3, 0xa0, 0x90, 0x10, 0x82, 0x42, - 0x79, 0x1b, 0x32, 0x2c, 0x03, 0x4e, 0x30, 0xab, 0xb3, 0x7a, 0x8d, 0x89, 0x89, 0xbd, 0xf9, 0x3c, - 0x6b, 0x63, 0x57, 0xc8, 0x57, 0x21, 0x8f, 0x82, 0xe5, 0x08, 0x16, 0x3a, 0x01, 0x9b, 0x98, 0xdc, - 0x7e, 0x3f, 0x05, 0x59, 0x77, 0xa5, 0xc8, 0x32, 0xa4, 0x59, 0x91, 0x84, 0xa6, 0xdc, 0x22, 0x3e, - 0x85, 0x65, 0x11, 0x59, 0x86, 0x0c, 0x2f, 0x84, 0x78, 0x74, 0xa7, 0x15, 0x7b, 0x9a, 0x15, 0x3e, - 0x5e, 0x67, 0x4d, 0xc7, 0xc0, 0xc4, 0xca, 0xf3, 0x34, 0x2b, 0x6d, 0x88, 0x0a, 0x39, 0xaf, 0x98, - 0xc1, 0x78, 0xcc, 0x6b, 0xf1, 0xac, 0x5b, 0xbd, 0x08, 0x88, 0x9a, 0x8e, 0x11, 0x8b, 0x17, 0xde, - 0xd9, 0xae, 0x7f, 0x3c, 0xc9, 0xba, 0x25, 0x09, 0xde, 0xa1, 0xbb, 0x55, 0x76, 0x86, 0x17, 0x21, - 0x3e, 0xa0, 0xa6, 0x63, 0x48, 0x70, 0x4b, 0xea, 0x0c, 0x2f, 0x34, 0xc8, 0x55, 0xea, 0x22, 0x16, - 0x0e, 0xb8, 0xf5, 0xfd, 0xfa, 0x39, 0xcd, 0xca, 0x09, 0x72, 0x8d, 0x5a, 0x60, 0xd5, 0x01, 0xee, -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0x2f, 0x31, 0x6c, 0xae, 0xb5, 0x6a, 0xb4, 0xd6, 0xfe, 0x35, 0x86, 0xcd, - 0xb5, 0x56, 0x8d, 0xd6, 0xda, 0xbf, 0xc5, 0xb0, 0xb9, 0xd6, 0xf4, 0x68, 0xad, 0xfd, 0x7b, 0x34, - 0x5b, 0xe7, 0x5a, 0xd3, 0xa3, 0xb5, 0xf6, 0x1f, 0x31, 0x6c, 0xae, 0x35, 0x3d, 0x5a, 0x6b, 0xff, - 0x19, 0xc3, 0xe6, 0x5a, 0xd3, 0xa3, 0xb5, 0xf6, 0x5f, 0x31, 0x6c, 0xae, 0x35, 0x3d, 0x5a, 0x6b, - 0xff, 0x1d, 0xc3, 0xe6, 0x5a, 0xd3, 0xa3, 0xb5, 0xf6, 0x3f, 0x31, 0x6c, 0xae, 0x35, 0x3d, 0x5a, - 0x6b, 0x3f, 0x8e, 0x61, 0x73, 0xad, 0xe9, 0xd1, 0x5a, 0xfb, 0x49, 0x0c, 0x9b, 0x6b, 0x4d, 0x8f, - 0xd6, 0xda, 0xff, 0xc6, 0xb0, 0xb9, 0xd6, 0xf4, 0x68, 0xad, 0xfd, 0x5f, 0x0c, 0x9b, 0x6b, 0x6d, - 0x3d, 0x5a, 0x6b, 0xff, 0x1f, 0xcd, 0x5e, 0x5f, 0xfd, 0x69, 0x00, 0x00, 0x00, 0xff, 0xff, 0x81, - 0x23, 0xc6, 0xe6, 0xc6, 0x38, 0x00, 0x00, -} diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/test.proto b/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/test.proto deleted file mode 100644 index f60711369..000000000 --- a/vendor/github.com/matttproud/golang_protobuf_extensions/testdata/test.proto +++ /dev/null @@ -1,540 +0,0 @@ -// 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 feature-rich test file for the protocol compiler and libraries. - -syntax = "proto2"; - -package testdata; - -enum FOO { FOO1 = 1; }; - -message GoEnum { - required FOO foo = 1; -} - -message GoTestField { - required string Label = 1; - required string Type = 2; -} - -message GoTest { - // An enum, for completeness. - enum KIND { - VOID = 0; - - // Basic types - BOOL = 1; - BYTES = 2; - FINGERPRINT = 3; - FLOAT = 4; - INT = 5; - STRING = 6; - TIME = 7; - - // Groupings - TUPLE = 8; - ARRAY = 9; - MAP = 10; - - // Table types - TABLE = 11; - - // Functions - FUNCTION = 12; // last tag - }; - - // Some typical parameters - required KIND Kind = 1; - optional string Table = 2; - optional int32 Param = 3; - - // Required, repeated and optional foreign fields. - required GoTestField RequiredField = 4; - repeated GoTestField RepeatedField = 5; - optional GoTestField OptionalField = 6; - - // Required fields of all basic types - required bool F_Bool_required = 10; - required int32 F_Int32_required = 11; - required int64 F_Int64_required = 12; - required fixed32 F_Fixed32_required = 13; - required fixed64 F_Fixed64_required = 14; - required uint32 F_Uint32_required = 15; - required uint64 F_Uint64_required = 16; - required float F_Float_required = 17; - required double F_Double_required = 18; - required string F_String_required = 19; - required bytes F_Bytes_required = 101; - required sint32 F_Sint32_required = 102; - required sint64 F_Sint64_required = 103; - - // Repeated fields of all basic types - repeated bool F_Bool_repeated = 20; - repeated int32 F_Int32_repeated = 21; - repeated int64 F_Int64_repeated = 22; - repeated fixed32 F_Fixed32_repeated = 23; - repeated fixed64 F_Fixed64_repeated = 24; - repeated uint32 F_Uint32_repeated = 25; - repeated uint64 F_Uint64_repeated = 26; - repeated float F_Float_repeated = 27; - repeated double F_Double_repeated = 28; - repeated string F_String_repeated = 29; - repeated bytes F_Bytes_repeated = 201; - repeated sint32 F_Sint32_repeated = 202; - repeated sint64 F_Sint64_repeated = 203; - - // Optional fields of all basic types - optional bool F_Bool_optional = 30; - optional int32 F_Int32_optional = 31; - optional int64 F_Int64_optional = 32; - optional fixed32 F_Fixed32_optional = 33; - optional fixed64 F_Fixed64_optional = 34; - optional uint32 F_Uint32_optional = 35; - optional uint64 F_Uint64_optional = 36; - optional float F_Float_optional = 37; - optional double F_Double_optional = 38; - optional string F_String_optional = 39; - optional bytes F_Bytes_optional = 301; - optional sint32 F_Sint32_optional = 302; - optional sint64 F_Sint64_optional = 303; - - // Default-valued fields of all basic types - optional bool F_Bool_defaulted = 40 [default=true]; - optional int32 F_Int32_defaulted = 41 [default=32]; - optional int64 F_Int64_defaulted = 42 [default=64]; - optional fixed32 F_Fixed32_defaulted = 43 [default=320]; - optional fixed64 F_Fixed64_defaulted = 44 [default=640]; - optional uint32 F_Uint32_defaulted = 45 [default=3200]; - optional uint64 F_Uint64_defaulted = 46 [default=6400]; - optional float F_Float_defaulted = 47 [default=314159.]; - optional double F_Double_defaulted = 48 [default=271828.]; - optional string F_String_defaulted = 49 [default="hello, \"world!\"\n"]; - optional bytes F_Bytes_defaulted = 401 [default="Bignose"]; - optional sint32 F_Sint32_defaulted = 402 [default = -32]; - optional sint64 F_Sint64_defaulted = 403 [default = -64]; - - // Packed repeated fields (no string or bytes). - repeated bool F_Bool_repeated_packed = 50 [packed=true]; - repeated int32 F_Int32_repeated_packed = 51 [packed=true]; - repeated int64 F_Int64_repeated_packed = 52 [packed=true]; - repeated fixed32 F_Fixed32_repeated_packed = 53 [packed=true]; - repeated fixed64 F_Fixed64_repeated_packed = 54 [packed=true]; - repeated uint32 F_Uint32_repeated_packed = 55 [packed=true]; - repeated uint64 F_Uint64_repeated_packed = 56 [packed=true]; - repeated float F_Float_repeated_packed = 57 [packed=true]; - repeated double F_Double_repeated_packed = 58 [packed=true]; - repeated sint32 F_Sint32_repeated_packed = 502 [packed=true]; - repeated sint64 F_Sint64_repeated_packed = 503 [packed=true]; - - // Required, repeated, and optional groups. - required group RequiredGroup = 70 { - required string RequiredField = 71; - }; - - repeated group RepeatedGroup = 80 { - required string RequiredField = 81; - }; - - optional group OptionalGroup = 90 { - required string RequiredField = 91; - }; -} - -// For testing skipping of unrecognized fields. -// Numbers are all big, larger than tag numbers in GoTestField, -// the message used in the corresponding test. -message GoSkipTest { - required int32 skip_int32 = 11; - required fixed32 skip_fixed32 = 12; - required fixed64 skip_fixed64 = 13; - required string skip_string = 14; - required group SkipGroup = 15 { - required int32 group_int32 = 16; - required string group_string = 17; - } -} - -// For testing packed/non-packed decoder switching. -// A serialized instance of one should be deserializable as the other. -message NonPackedTest { - repeated int32 a = 1; -} - -message PackedTest { - repeated int32 b = 1 [packed=true]; -} - -message MaxTag { - // Maximum possible tag number. - optional string last_field = 536870911; -} - -message OldMessage { - message Nested { - optional string name = 1; - } - optional Nested nested = 1; - - optional int32 num = 2; -} - -// NewMessage is wire compatible with OldMessage; -// imagine it as a future version. -message NewMessage { - message Nested { - optional string name = 1; - optional string food_group = 2; - } - optional Nested nested = 1; - - // This is an int32 in OldMessage. - optional int64 num = 2; -} - -// Smaller tests for ASCII formatting. - -message InnerMessage { - required string host = 1; - optional int32 port = 2 [default=4000]; - optional bool connected = 3; -} - -message OtherMessage { - optional int64 key = 1; - optional bytes value = 2; - optional float weight = 3; - optional InnerMessage inner = 4; - - extensions 100 to max; -} - -message RequiredInnerMessage { - required InnerMessage leo_finally_won_an_oscar = 1; -} - -message MyMessage { - required int32 count = 1; - optional string name = 2; - optional string quote = 3; - repeated string pet = 4; - optional InnerMessage inner = 5; - repeated OtherMessage others = 6; - optional RequiredInnerMessage we_must_go_deeper = 13; - repeated InnerMessage rep_inner = 12; - - enum Color { - RED = 0; - GREEN = 1; - BLUE = 2; - }; - optional Color bikeshed = 7; - - optional group SomeGroup = 8 { - optional int32 group_field = 9; - } - - // This field becomes [][]byte in the generated code. - repeated bytes rep_bytes = 10; - - optional double bigfloat = 11; - - extensions 100 to max; -} - -message Ext { - extend MyMessage { - optional Ext more = 103; - optional string text = 104; - optional int32 number = 105; - } - - optional string data = 1; -} - -extend MyMessage { - repeated string greeting = 106; -} - -message ComplexExtension { - optional int32 first = 1; - optional int32 second = 2; - repeated int32 third = 3; -} - -extend OtherMessage { - optional ComplexExtension complex = 200; - repeated ComplexExtension r_complex = 201; -} - -message DefaultsMessage { - enum DefaultsEnum { - ZERO = 0; - ONE = 1; - TWO = 2; - }; - extensions 100 to max; -} - -extend DefaultsMessage { - optional double no_default_double = 101; - optional float no_default_float = 102; - optional int32 no_default_int32 = 103; - optional int64 no_default_int64 = 104; - optional uint32 no_default_uint32 = 105; - optional uint64 no_default_uint64 = 106; - optional sint32 no_default_sint32 = 107; - optional sint64 no_default_sint64 = 108; - optional fixed32 no_default_fixed32 = 109; - optional fixed64 no_default_fixed64 = 110; - optional sfixed32 no_default_sfixed32 = 111; - optional sfixed64 no_default_sfixed64 = 112; - optional bool no_default_bool = 113; - optional string no_default_string = 114; - optional bytes no_default_bytes = 115; - optional DefaultsMessage.DefaultsEnum no_default_enum = 116; - - optional double default_double = 201 [default = 3.1415]; - optional float default_float = 202 [default = 3.14]; - optional int32 default_int32 = 203 [default = 42]; - optional int64 default_int64 = 204 [default = 43]; - optional uint32 default_uint32 = 205 [default = 44]; - optional uint64 default_uint64 = 206 [default = 45]; - optional sint32 default_sint32 = 207 [default = 46]; - optional sint64 default_sint64 = 208 [default = 47]; - optional fixed32 default_fixed32 = 209 [default = 48]; - optional fixed64 default_fixed64 = 210 [default = 49]; - optional sfixed32 default_sfixed32 = 211 [default = 50]; - optional sfixed64 default_sfixed64 = 212 [default = 51]; - optional bool default_bool = 213 [default = true]; - optional string default_string = 214 [default = "Hello, string"]; - optional bytes default_bytes = 215 [default = "Hello, bytes"]; - optional DefaultsMessage.DefaultsEnum default_enum = 216 [default = ONE]; -} - -message MyMessageSet { - option message_set_wire_format = true; - extensions 100 to max; -} - -message Empty { -} - -extend MyMessageSet { - optional Empty x201 = 201; - optional Empty x202 = 202; - optional Empty x203 = 203; - optional Empty x204 = 204; - optional Empty x205 = 205; - optional Empty x206 = 206; - optional Empty x207 = 207; - optional Empty x208 = 208; - optional Empty x209 = 209; - optional Empty x210 = 210; - optional Empty x211 = 211; - optional Empty x212 = 212; - optional Empty x213 = 213; - optional Empty x214 = 214; - optional Empty x215 = 215; - optional Empty x216 = 216; - optional Empty x217 = 217; - optional Empty x218 = 218; - optional Empty x219 = 219; - optional Empty x220 = 220; - optional Empty x221 = 221; - optional Empty x222 = 222; - optional Empty x223 = 223; - optional Empty x224 = 224; - optional Empty x225 = 225; - optional Empty x226 = 226; - optional Empty x227 = 227; - optional Empty x228 = 228; - optional Empty x229 = 229; - optional Empty x230 = 230; - optional Empty x231 = 231; - optional Empty x232 = 232; - optional Empty x233 = 233; - optional Empty x234 = 234; - optional Empty x235 = 235; - optional Empty x236 = 236; - optional Empty x237 = 237; - optional Empty x238 = 238; - optional Empty x239 = 239; - optional Empty x240 = 240; - optional Empty x241 = 241; - optional Empty x242 = 242; - optional Empty x243 = 243; - optional Empty x244 = 244; - optional Empty x245 = 245; - optional Empty x246 = 246; - optional Empty x247 = 247; - optional Empty x248 = 248; - optional Empty x249 = 249; - optional Empty x250 = 250; -} - -message MessageList { - repeated group Message = 1 { - required string name = 2; - required int32 count = 3; - } -} - -message Strings { - optional string string_field = 1; - optional bytes bytes_field = 2; -} - -message Defaults { - enum Color { - RED = 0; - GREEN = 1; - BLUE = 2; - } - - // Default-valued fields of all basic types. - // Same as GoTest, but copied here to make testing easier. - optional bool F_Bool = 1 [default=true]; - optional int32 F_Int32 = 2 [default=32]; - optional int64 F_Int64 = 3 [default=64]; - optional fixed32 F_Fixed32 = 4 [default=320]; - optional fixed64 F_Fixed64 = 5 [default=640]; - optional uint32 F_Uint32 = 6 [default=3200]; - optional uint64 F_Uint64 = 7 [default=6400]; - optional float F_Float = 8 [default=314159.]; - optional double F_Double = 9 [default=271828.]; - optional string F_String = 10 [default="hello, \"world!\"\n"]; - optional bytes F_Bytes = 11 [default="Bignose"]; - optional sint32 F_Sint32 = 12 [default=-32]; - optional sint64 F_Sint64 = 13 [default=-64]; - optional Color F_Enum = 14 [default=GREEN]; - - // More fields with crazy defaults. - optional float F_Pinf = 15 [default=inf]; - optional float F_Ninf = 16 [default=-inf]; - optional float F_Nan = 17 [default=nan]; - - // Sub-message. - optional SubDefaults sub = 18; - - // Redundant but explicit defaults. - optional string str_zero = 19 [default=""]; -} - -message SubDefaults { - optional int64 n = 1 [default=7]; -} - -message RepeatedEnum { - enum Color { - RED = 1; - } - repeated Color color = 1; -} - -message MoreRepeated { - repeated bool bools = 1; - repeated bool bools_packed = 2 [packed=true]; - repeated int32 ints = 3; - repeated int32 ints_packed = 4 [packed=true]; - repeated int64 int64s_packed = 7 [packed=true]; - repeated string strings = 5; - repeated fixed32 fixeds = 6; -} - -// GroupOld and GroupNew have the same wire format. -// GroupNew has a new field inside a group. - -message GroupOld { - optional group G = 101 { - optional int32 x = 2; - } -} - -message GroupNew { - optional group G = 101 { - optional int32 x = 2; - optional int32 y = 3; - } -} - -message FloatingPoint { - required double f = 1; -} - -message MessageWithMap { - map name_mapping = 1; - map msg_mapping = 2; - map byte_mapping = 3; - map str_to_str = 4; -} - -message Oneof { - oneof union { - bool F_Bool = 1; - int32 F_Int32 = 2; - int64 F_Int64 = 3; - fixed32 F_Fixed32 = 4; - fixed64 F_Fixed64 = 5; - uint32 F_Uint32 = 6; - uint64 F_Uint64 = 7; - float F_Float = 8; - double F_Double = 9; - string F_String = 10; - bytes F_Bytes = 11; - sint32 F_Sint32 = 12; - sint64 F_Sint64 = 13; - MyMessage.Color F_Enum = 14; - GoTestField F_Message = 15; - group F_Group = 16 { - optional int32 x = 17; - } - int32 F_Largest_Tag = 536870911; - } - - oneof tormato { - int32 value = 100; - } -} - -message Communique { - optional bool make_me_cry = 1; - - // This is a oneof, called "union". - oneof union { - int32 number = 5; - string name = 6; - bytes data = 7; - double temp_c = 8; - MyMessage.Color col = 9; - Strings msg = 10; - } -} diff --git a/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE.md b/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..fff4504a7 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,5 @@ + diff --git a/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE/bug-report.md b/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 000000000..af2439dfd --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,42 @@ +--- +name: Bug Report +about: If things aren't working as expected. + +--- + +## Bug Report + + + +**What did you do?** +A clear and concise description of the steps you took (or insert a code snippet). + +**What did you expect to see?** +A clear and concise description of what you expected to happen (or insert a code snippet). + +**What did you see instead? Under which circumstances?** +A clear and concise description of what you expected to happen (or insert a code snippet). + + +**Environment** +* operator-sdk version: + + Insert operator-sdk release or Git SHA here. If you have paste the Gopkg.lock operator-sdk information here. + +* Kubernetes version information: + + Insert output of `kubectl version` here + +* Kubernetes cluster kind: + +* Are you writing your operator in ansible or go? + +**Possible Solution** + + +**Additional context** +Add any other context about the problem here. diff --git a/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE/feature-request.md b/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 000000000..ac39f0117 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,13 @@ +--- +name: Feature Request +about: Suggest a feature + +--- + +## Feature Request + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Example: "I have an issue when [...]" + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. Add any considered drawbacks. diff --git a/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE/support-question.md b/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE/support-question.md new file mode 100644 index 000000000..5fd7ed25f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/.github/ISSUE_TEMPLATE/support-question.md @@ -0,0 +1,44 @@ +--- +name: Support Question +about: Any support questions you might have. + +--- + + + +## Type of question + +**Are you asking about community best practices, how to implement a specific feature, or about general context and help around the operator-sdk?** + + +## Question + +**What did you do?** +A clear and concise description of the steps you took (or insert a code snippet). + +**What did you expect to see?** +A clear and concise description of what you expected to happen (or insert a code snippet). + +**What did you see instead? Under which circumstances?** +A clear and concise description of what you expected to happen (or insert a code snippet). + + +**Environment** +* operator-sdk version: + + insert release or Git SHA here + +* Kubernetes version information: + + insert output of `kubectl version` here + +* Kubernetes cluster kind: + +**Additional context** +Add any other context about the question here. diff --git a/vendor/github.com/operator-framework/operator-sdk/.github/PULL_REQUEST_TEMPLATE.md b/vendor/github.com/operator-framework/operator-sdk/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..82da101a3 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,19 @@ + + +**Description of the change:** + + +**Motivation for the change:** + + diff --git a/vendor/github.com/operator-framework/operator-sdk/.gitignore b/vendor/github.com/operator-framework/operator-sdk/.gitignore index 4398fa902..7a8c82e32 100644 --- a/vendor/github.com/operator-framework/operator-sdk/.gitignore +++ b/vendor/github.com/operator-framework/operator-sdk/.gitignore @@ -96,13 +96,12 @@ tags ### VisualStudioCode ### .vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - # End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode # Build artifacts build/* +test/ansible-operator/ansible-operator + +# Test artifacts +pkg/ansible/runner/testdata/valid.yaml diff --git a/vendor/github.com/operator-framework/operator-sdk/.travis.yml b/vendor/github.com/operator-framework/operator-sdk/.travis.yml index aead491d9..7a7f1d6d6 100644 --- a/vendor/github.com/operator-framework/operator-sdk/.travis.yml +++ b/vendor/github.com/operator-framework/operator-sdk/.travis.yml @@ -10,33 +10,19 @@ go: jobs: include: - - before_script: hack/ci/setup-minikube.sh - env: - - CLUSTER=minikube - - CHANGE_MINIKUBE_NONE_USER=true - script: test/test-go.sh - name: Go on minikube - - before_script: hack/ci/setup-minikube.sh - env: - - CLUSTER=minikube - - CHANGE_MINIKUBE_NONE_USER=true - script: test/test-ansible.sh - name: Ansible on minikube - before_script: hack/ci/setup-openshift.sh env: CLUSTER=openshift - script: test/test-go.sh + script: make test/ci-go name: Go on OpenShift - before_script: hack/ci/setup-openshift.sh env: CLUSTER=openshift - script: test/test-ansible.sh + script: make test/ci-ansible name: Ansible on OpenShift -install: +install: - curl -Lo dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && chmod +x dep && sudo mv dep /usr/local/bin/ - dep ensure - make install -# Create example operator directory -- mkdir -p $GOPATH/src/github.com/example-inc - sudo pip install ansible after_success: diff --git a/vendor/github.com/operator-framework/operator-sdk/CHANGELOG.md b/vendor/github.com/operator-framework/operator-sdk/CHANGELOG.md index cbfd7eec4..9c48eeb3e 100644 --- a/vendor/github.com/operator-framework/operator-sdk/CHANGELOG.md +++ b/vendor/github.com/operator-framework/operator-sdk/CHANGELOG.md @@ -1,3 +1,15 @@ +## v0.1.1 + +### Bug fixes +- Fix hardcoded CRD version in crd scaffold ([#690](https://github.com/operator-framework/operator-sdk/pull/690)) + +## v0.1.0 + +### Changed + +- Use [controller runtime](https://github.com/kubernetes-sigs/controller-runtime) library for controller and client APIs +- See [migration guide](https://github.com/operator-framework/operator-sdk/blob/master/doc/migration/v0.1.0-migration-guide.md) to migrate your project to `v0.1.0` + ## v0.0.7 ### Added diff --git a/vendor/github.com/operator-framework/operator-sdk/Gopkg.lock b/vendor/github.com/operator-framework/operator-sdk/Gopkg.lock index e9094a529..5bcec0c60 100644 --- a/vendor/github.com/operator-framework/operator-sdk/Gopkg.lock +++ b/vendor/github.com/operator-framework/operator-sdk/Gopkg.lock @@ -1,6 +1,22 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. +[[projects]] + digest = "1:8e47871087b94913898333f37af26732faaab30cdb41571136cf7aec9921dae7" + name = "github.com/PuerkitoBio/purell" + packages = ["."] + pruneopts = "" + revision = "0bcb03f4b4d0a9428594752bd2a3b9aa0a9d4bd4" + version = "v1.1.0" + +[[projects]] + branch = "master" + digest = "1:331a419049c2be691e5ba1d24342fc77c7e767a80c666a18fd8a9f7b82419c1c" + name = "github.com/PuerkitoBio/urlesc" + packages = ["."] + pruneopts = "" + revision = "de5bf2ad457846296e2031421a34e2568e304e35" + [[projects]] branch = "master" digest = "1:c0bec5f9b98d0bc872ff5e834fac186b807b656683bd29cb82fb207a1513fabb" @@ -9,6 +25,14 @@ pruneopts = "" revision = "3a771d992973f24aa725d07868b467d1ddfceafb" +[[projects]] + digest = "1:83222dd265299f065a2ae969c7780b6c6a225c770975051955320a95b0526239" + name = "github.com/coreos/prometheus-operator" + packages = ["pkg/client/monitoring/v1"] + pruneopts = "" + revision = "4a7fea51ab3f10329472c07028354617fb6635fe" + version = "v0.24.0" + [[projects]] digest = "1:0deddd908b6b4b768cfc272c16ee61e7088a60f7fe2f06c547bd3d8e1f8b8e77" name = "github.com/davecgh/go-spew" @@ -17,6 +41,17 @@ revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" version = "v1.1.1" +[[projects]] + digest = "1:8a34d7a37b8f07239487752e14a5faafcbbc718fc385ad429a2c4ac6f27a207f" + name = "github.com/emicklei/go-restful" + packages = [ + ".", + "log", + ] + pruneopts = "" + revision = "3eb9738c1697594ea6e71a7156a9bb32ed216cf0" + version = "v2.8.0" + [[projects]] digest = "1:b13707423743d41665fd23f0c36b2f37bb49c30e94adb813319c44188a51ba22" name = "github.com/ghodss/yaml" @@ -41,6 +76,46 @@ pruneopts = "" revision = "7536572e8d55209135cd5e7ccf7fce43dca217ab" +[[projects]] + digest = "1:c8052dcf3ec378a9a6bc4f00ecc10d6d5eb3cc1f8faaf6b2f70f047e8881d446" + name = "github.com/go-openapi/jsonpointer" + packages = ["."] + pruneopts = "" + revision = "ef5f0afec364d3b9396b7b77b43dbe26bf1f8004" + version = "v0.17.0" + +[[projects]] + digest = "1:1824e5330b35b2a2418d06aa55629cc59ad454b72e338aa125ba8ff98f16298b" + name = "github.com/go-openapi/jsonreference" + packages = ["."] + pruneopts = "" + revision = "8483a886a90412cd6858df4ea3483dce9c8e35a3" + version = "v0.17.0" + +[[projects]] + branch = "master" + digest = "1:d4680b89600466e543754c838cbc987ed58b962417a88600881cd0ed88d6b4cc" + name = "github.com/go-openapi/spec" + packages = ["."] + pruneopts = "" + revision = "5bae59e25b21498baea7f9d46e9c147ec106a42e" + +[[projects]] + digest = "1:062de20b7d299ae95c902a5c472c4bc87a2f3ae707751fe155ecf640d99074b4" + name = "github.com/go-openapi/swag" + packages = ["."] + pruneopts = "" + revision = "5899d5c5e619fda5fa86e14795a835f473ca284c" + version = "v0.17.0" + +[[projects]] + digest = "1:a51f75337287a485731485c646d701e237246f7c5d0e221dee18ca37b672538e" + name = "github.com/gobuffalo/envy" + packages = ["."] + pruneopts = "" + revision = "047ecc927cd0b7d27bab83eb948e120fb7d1ea68" + version = "v1.6.5" + [[projects]] digest = "1:6e73003ecd35f4487a5e88270d3ca0a81bc80dc88053ac7e4dcfec5fba30d918" name = "github.com/gogo/protobuf" @@ -156,6 +231,14 @@ revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" version = "v1.0" +[[projects]] + digest = "1:7df5a9695a743c3e1626b28bb8741602c8c15527e1efaeaec48ab2ff9a23f74c" + name = "github.com/joho/godotenv" + packages = ["."] + pruneopts = "" + revision = "23d116af351c84513e1946b527c88823e476be13" + version = "v1.3.0" + [[projects]] digest = "1:b79fc583e4dc7055ed86742e22164ac41bf8c0940722dbcb600f1a3ace1a8cb5" name = "github.com/json-iterator/go" @@ -164,6 +247,34 @@ revision = "1624edc4454b8682399def8740d46db5e4362ba4" version = "v1.1.5" +[[projects]] + digest = "1:6a874e3ddfb9db2b42bd8c85b6875407c702fa868eed20634ff489bc896ccfd3" + name = "github.com/konsorten/go-windows-terminal-sequences" + packages = ["."] + pruneopts = "" + revision = "5c8c8bd35d3832f5d134ae1e1e375b69a4d25242" + version = "v1.0.1" + +[[projects]] + branch = "master" + digest = "1:212bebc561f4f654a653225868b2a97353cd5e160dc0b0bbc7232b06608474ec" + name = "github.com/mailru/easyjson" + packages = [ + "buffer", + "jlexer", + "jwriter", + ] + pruneopts = "" + revision = "60711f1a8329503b04e1c88535f419d0bb440bff" + +[[projects]] + digest = "1:3d8a9dd6693e55d63b28634d66d11d647cd0b65362dedc18d686db01aa5f8678" + name = "github.com/markbates/inflect" + packages = ["."] + pruneopts = "" + revision = "28bf78dadb0f64748ff13a0b6547e4972a5cea64" + version = "v1.0.1" + [[projects]] branch = "master" digest = "1:58050e2bc9621cc6b68c1da3e4a0d1c40ad1f89062b9855c26521fd42a97a106" @@ -229,15 +340,24 @@ version = "v2.0.1" [[projects]] - digest = "1:4142d94383572e74b42352273652c62afec5b23f325222ed09198f46009022d1" + digest = "1:7365acd48986e205ccb8652cc746f09c8b7876030d53710ea6ef7d0bd0dcd7ca" + name = "github.com/pkg/errors" + packages = ["."] + pruneopts = "" + revision = "645ef00459ed84a119197bfb8d8205042c6df63d" + version = "v0.8.0" + +[[projects]] + digest = "1:f3e56d302f80d760e718743f89f4e7eaae532d4218ba330e979bd051f78de141" name = "github.com/prometheus/client_golang" packages = [ "prometheus", + "prometheus/internal", "prometheus/promhttp", ] pruneopts = "" - revision = "c5b7fccd204277076155f10851dad72b76a49317" - version = "v0.8.0" + revision = "1cafe34db7fdec6022e17e00e1c1ea501022f3e4" + version = "v0.9.0" [[projects]] branch = "master" @@ -249,7 +369,7 @@ [[projects]] branch = "master" - digest = "1:f477ef7b65d94fb17574fc6548cef0c99a69c1634ea3b6da248b63a61ebe0498" + digest = "1:d1b5970f2a453e7c4be08117fb683b5d096bad9d17f119a6e58d4c561ca205dd" name = "github.com/prometheus/common" packages = [ "expfmt", @@ -257,11 +377,11 @@ "model", ] pruneopts = "" - revision = "c7de2306084e37d54b8be01f3541a8464345e9a5" + revision = "bcb74de08d37a417cb6789eec1d6c810040f0470" [[projects]] branch = "master" - digest = "1:5a57ea878c9a40657ebe7916eca6bea7c76808f5acb68fd42ea5e204dd35f6f7" + digest = "1:1f62ed2c173c42c1edad2e94e127318ea11b0d28c62590c82a8d2d3cde189afe" name = "github.com/prometheus/procfs" packages = [ ".", @@ -270,7 +390,7 @@ "xfs", ] pruneopts = "" - revision = "418d78d0b9a7b7de3a6bbc8a23def624cc977bb2" + revision = "185b4288413d2a0dd0806f78c90dde719829e5ae" [[projects]] digest = "1:3962f553b77bf6c03fc07cd687a22dd3b00fe11aa14d31194f5505f5bb65cdc8" @@ -281,12 +401,23 @@ version = "v1.0.0" [[projects]] - digest = "1:3fcbf733a8d810a21265a7f2fe08a3353db2407da052b233f8b204b5afc03d9b" + digest = "1:5f48b818f16848d05cf74f4cbdd0cbe9e0dcddb3c459b4c510c6e2c8e1b4dff1" name = "github.com/sirupsen/logrus" packages = ["."] pruneopts = "" - revision = "3e01752db0189b9157070a0e1668a620f9a85da2" - version = "v1.0.6" + revision = "ad15b42461921f1fb3529b058c6786c6a45d5162" + version = "v1.1.1" + +[[projects]] + digest = "1:d0431c2fd72e39ee43ea7742322abbc200c3e704c9102c5c3c2e2e667095b0ca" + name = "github.com/spf13/afero" + packages = [ + ".", + "mem", + ] + pruneopts = "" + revision = "d40851caa0d747393da1ffb28f7f9d8b4eeffebd" + version = "v1.1.2" [[projects]] digest = "1:a1403cc8a94b8d7956ee5e9694badef0e7b051af289caad1cf668331e3ffa4f6" @@ -297,12 +428,12 @@ version = "v0.0.3" [[projects]] - digest = "1:0a52bcb568386d98f4894575d53ce3e456f56471de6897bb8b9de13c33d9340e" + digest = "1:cbaf13cdbfef0e4734ed8a7504f57fe893d471d62a35b982bf6fb3f036449a66" name = "github.com/spf13/pflag" packages = ["."] pruneopts = "" - revision = "9a97c102cda95a86cec2345a6f09f55a939babf5" - version = "v1.0.2" + revision = "298182f68c66c05229eb03ac171abe6e309ee79a" + version = "v1.0.3" [[projects]] digest = "1:74f86c458e82e1c4efbab95233e0cf51b7cc02dc03193be9f62cd81224e10401" @@ -337,15 +468,15 @@ [[projects]] branch = "master" - digest = "1:61a86f0be8b466d6e3fbdabb155aaa4006137cb5e3fd3b949329d103fa0ceb0f" + digest = "1:78f41d38365ccef743e54ed854a2faf73313ba0750c621116a8eeb0395590bd0" name = "golang.org/x/crypto" packages = ["ssh/terminal"] pruneopts = "" - revision = "0e37d006457bf46f9e6692014ba72ef82c33022c" + revision = "0c41d7ab0a0ee717d4590a44bcb987dfd9e183eb" [[projects]] branch = "master" - digest = "1:6846191f608c0dd6109f37ca46b784f9630191ff13f86ae974135c05a4c92971" + digest = "1:6543c75ddc1efc0041202dd49378ee2e5711b7cc82c2845c0437eef6276cc984" name = "golang.org/x/net" packages = [ "context", @@ -357,18 +488,18 @@ "idna", ] pruneopts = "" - revision = "f04abc6bdfa7a0171a8a0c9fd2ada9391044d056" + revision = "04a2e542c03f1d053ab3e4d6e5abcd4b66e2be8e" [[projects]] branch = "master" - digest = "1:18ebd6e65d5223778b5fc92bbf2afffb54c6ac3889bbc362df692b965f932fae" + digest = "1:9bbe878c5cef3e193360515704d01ddb34c756e8cfd4abf7166f3f6a2059c553" name = "golang.org/x/sys" packages = [ "unix", "windows", ] pruneopts = "" - revision = "b09afc3d579e346c4a7e4705953acaf6f9e551bd" + revision = "8f1d3d21f81be6e86ebcd6febee89c89bc50719f" [[projects]] digest = "1:5acd3512b047305d49e8763eef7ba423901e85d5dd2fd1e71778a0ea8de10bd4" @@ -388,6 +519,7 @@ "unicode/cldr", "unicode/norm", "unicode/rangetable", + "width", ] pruneopts = "" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" @@ -401,6 +533,19 @@ pruneopts = "" revision = "fbb02b2291d28baffd63558aa44b4b56f178d650" +[[projects]] + branch = "master" + digest = "1:82ccb6c2d7281541440010c216e7e1eeab3f056f83e3d44911a69fca2e746443" + name = "golang.org/x/tools" + packages = [ + "go/ast/astutil", + "imports", + "internal/fastwalk", + "internal/gopathwalk", + ] + pruneopts = "" + revision = "6adeb8aab2ded9eb693b831d5fd090c10a6ebdfa" + [[projects]] digest = "1:75fb3fcfc73a8c723efde7777b40e8e8ff9babf30d8c56160d01beffea8a95a6" name = "gopkg.in/inf.v0" @@ -526,6 +671,7 @@ digest = "1:da788b52eda4a8cd4c564a69051b029f310f4ec232cfa3ec0e49b80b0e7b6616" name = "k8s.io/client-go" packages = [ + "deprecated-dynamic", "discovery", "discovery/cached", "dynamic", @@ -596,11 +742,14 @@ [[projects]] branch = "master" - digest = "1:951bc2047eea6d316a17850244274554f26fd59189360e45f4056b424dadf2c1" + digest = "1:27b5d6ad25d086dda2c482099d4b918a2c3e947f80e0671fa366732daf59afed" name = "k8s.io/kube-openapi" - packages = ["pkg/util/proto"] + packages = [ + "pkg/common", + "pkg/util/proto", + ] pruneopts = "" - revision = "e3762e86a74c878ffed47484592986685639c2cd" + revision = "e494cc58111187acad93e64529228a2fc0153e39" [[projects]] digest = "1:6cad2468c5831529b860a01f09032f6ff38202bc4f76332ef7ad74a993e4aa5a" @@ -624,6 +773,7 @@ "pkg/recorder", "pkg/runtime/inject", "pkg/runtime/log", + "pkg/runtime/scheme", "pkg/runtime/signals", "pkg/source", "pkg/source/internal", @@ -639,14 +789,19 @@ analyzer-name = "dep" analyzer-version = 1 input-imports = [ + "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1", "github.com/ghodss/yaml", + "github.com/markbates/inflect", "github.com/prometheus/client_golang/prometheus", "github.com/prometheus/client_golang/prometheus/promhttp", "github.com/sergi/go-diff/diffmatchpatch", "github.com/sirupsen/logrus", + "github.com/spf13/afero", "github.com/spf13/cobra", + "golang.org/x/tools/imports", "gopkg.in/yaml.v2", "k8s.io/api/core/v1", + "k8s.io/api/rbac/v1", "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme", "k8s.io/apimachinery/pkg/api/errors", "k8s.io/apimachinery/pkg/api/meta", @@ -660,17 +815,13 @@ "k8s.io/apimachinery/pkg/util/net", "k8s.io/apimachinery/pkg/util/proxy", "k8s.io/apimachinery/pkg/util/wait", - "k8s.io/apimachinery/pkg/watch", "k8s.io/client-go/discovery/cached", - "k8s.io/client-go/dynamic", "k8s.io/client-go/kubernetes", "k8s.io/client-go/kubernetes/scheme", "k8s.io/client-go/rest", "k8s.io/client-go/restmapper", - "k8s.io/client-go/tools/cache", "k8s.io/client-go/tools/clientcmd", "k8s.io/client-go/transport", - "k8s.io/client-go/util/workqueue", "sigs.k8s.io/controller-runtime/pkg/client", "sigs.k8s.io/controller-runtime/pkg/client/config", "sigs.k8s.io/controller-runtime/pkg/controller", @@ -678,6 +829,7 @@ "sigs.k8s.io/controller-runtime/pkg/manager", "sigs.k8s.io/controller-runtime/pkg/reconcile", "sigs.k8s.io/controller-runtime/pkg/runtime/log", + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme", "sigs.k8s.io/controller-runtime/pkg/runtime/signals", "sigs.k8s.io/controller-runtime/pkg/source", ] diff --git a/vendor/github.com/operator-framework/operator-sdk/Gopkg.toml b/vendor/github.com/operator-framework/operator-sdk/Gopkg.toml index ab038af9f..0e3dbae0e 100644 --- a/vendor/github.com/operator-framework/operator-sdk/Gopkg.toml +++ b/vendor/github.com/operator-framework/operator-sdk/Gopkg.toml @@ -29,3 +29,4 @@ [[constraint]] name = "sigs.k8s.io/controller-runtime" version = "v0.1.4" + diff --git a/vendor/github.com/operator-framework/operator-sdk/Makefile b/vendor/github.com/operator-framework/operator-sdk/Makefile index 51ba488de..f2caa8d15 100644 --- a/vendor/github.com/operator-framework/operator-sdk/Makefile +++ b/vendor/github.com/operator-framework/operator-sdk/Makefile @@ -9,7 +9,7 @@ else Q = @ endif -VERSION = $(shell git describe --dirty --tags) +VERSION = $(shell git describe --dirty --tags --always) REPO = github.com/operator-framework/operator-sdk BUILD_PATH = $(REPO)/commands/operator-sdk PKGS = $(shell go list ./... | grep -v /vendor/) @@ -44,15 +44,42 @@ build/operator-sdk-%-x86_64-apple-darwin: GOARGS = GOOS=darwin GOARCH=amd64 build/%: $(Q)$(GOARGS) go build -o $@ $(BUILD_PATH) -DEFAULT_KEY = $(shell gpgconf --list-options gpg \ - | awk -F: '$$1 == "default-key" { gsub(/"/,""); print $$10}') build/%.asc: -ifeq ("$(DEFAULT_KEY)","$(shell git config --get user.signingkey)") - $(Q)gpg --output $@ --detach-sig build/$* - $(Q)gpg --verify $@ build/$* -else - @echo "git and/or gpg are not configured to have default signing key ${DEFAULT_KEY}" - @exit 1 -endif + $(Q){ \ + default_key=$$(gpgconf --list-options gpg | awk -F: '$$1 == "default-key" { gsub(/"/,""); print toupper($$10)}'); \ + git_key=$$(git config --get user.signingkey | awk '{ print toupper($$0) }'); \ + if [ "$${default_key}" = "$${git_key}" ]; then \ + gpg --output $@ --detach-sig build/$*; \ + gpg --verify $@ build/$*; \ + else \ + echo "git and/or gpg are not configured to have default signing key $${default_key}"; \ + exit 1; \ + fi; \ + } .PHONY: install release_x86_64 release + +test: dep test/sanity test/unit install test/subcommand test/e2e + +test/ci-go: test/sanity test/unit test/subcommand test/e2e/go + +test/ci-ansible: test/e2e/ansible + +test/sanity: + ./hack/tests/sanity-check.sh + +test/unit: + ./hack/tests/unit.sh + +test/subcommand: + ./hack/tests/test-subcommand.sh + +test/e2e: test/e2e/go test/e2e/ansible + +test/e2e/go: + ./hack/tests/e2e-go.sh + +test/e2e/ansible: + ./hack/tests/e2e-ansible.sh + +.PHONY: test test/sanity test/unit test/subcommand test/e2e test/e2e/go test/e2e/ansible test/ci-go test/ci-ansible diff --git a/vendor/github.com/operator-framework/operator-sdk/README.md b/vendor/github.com/operator-framework/operator-sdk/README.md index 9fd3cbeba..254356a02 100644 --- a/vendor/github.com/operator-framework/operator-sdk/README.md +++ b/vendor/github.com/operator-framework/operator-sdk/README.md @@ -2,11 +2,13 @@ [![Build Status](https://travis-ci.org/operator-framework/operator-sdk.svg?branch=master)](https://travis-ci.org/operator-framework/operator-sdk) -### Project Status: pre-alpha +### Project Status: alpha -The project is currently pre-alpha and it is expected that breaking changes to the API will be made in the upcoming releases. +The project is currently alpha which means that there are still new features and APIs planned that will be added in the future. Due to this breaking changes may still happen. -See the [design docs][design_docs] for planned work on upcoming milestones. +**Note:** The core APIs provided by the [controller-runtime][controller_runtime] will most likely stay unchanged however the expectation is that any breaking changes should be relatively minor and easier to handle than the changes from SDK `v0.0.7` to `v0.1.0`. + +See the [proposal docs][proposals_docs] and issues for ongoing or planned work. ## Overview @@ -14,30 +16,30 @@ This project is a component of the [Operator Framework][of-home], an open source [Operators][operator_link] make it easy to manage complex stateful applications on top of Kubernetes. However writing an operator today can be difficult because of challenges such as using low level APIs, writing boilerplate, and a lack of modularity which leads to duplication. -The Operator SDK is a framework designed to make writing operators easier by providing: +The Operator SDK is a framework that uses the [controller-runtime][controller_runtime] library to make writing operators easier by providing: - High level APIs and abstractions to write the operational logic more intuitively - Tools for scaffolding and code generation to bootstrap a new project fast - Extensions to cover common operator use cases ## Workflow -The SDK provides the following workflow to develop a new operator: +The SDK provides workflows to develop operators in Go or Ansible. + +The following workflow is for a new Go operator: 1. Create a new operator project using the SDK Command Line Interface(CLI) 2. Define new resource APIs by adding Custom Resource Definitions(CRD) -3. Specify resources to watch using the SDK API -4. Define the operator reconciling logic in a designated handler and use the SDK API to interact with resources +3. Define Controllers to watch and reconcile resources +4. Write the reconciling logic for your Controller using the SDK and controller-runtime APIs 5. Use the SDK CLI to build and generate the operator deployment manifests -At a high level an operator using the SDK processes events for watched resources in a user defined handler and takes actions to reconcile the state of the application. - ## Prerequisites - [dep][dep_tool] version v0.5.0+. - [git][git_tool] - [go][go_tool] version v1.10+. - [docker][docker_tool] version 17.03+. -- [kubectl][kubectl_tool] version v1.9.0+. -- Access to a kubernetes v.1.9.0+ cluster. +- [kubectl][kubectl_tool] version v1.11.0+. +- Access to a kubernetes v.1.11.0+ cluster. ## Quick Start @@ -58,10 +60,17 @@ Create and deploy an app-operator using the SDK CLI: ```sh # Create an app-operator project that defines the App CR. $ mkdir -p $GOPATH/src/github.com/example-inc/ +# Create a new app-operator project $ cd $GOPATH/src/github.com/example-inc/ -$ operator-sdk new app-operator --api-version=app.example.com/v1alpha1 --kind=App +$ operator-sdk new app-operator $ cd app-operator +# Add a new API for the custom resource AppService +$ operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService + +# Add a new controller that watches for AppService +$ operator-sdk add controller --api-version=app.example.com/v1alpha1 --kind=AppService + # Build and push the app-operator image to a public registry such as quay.io $ operator-sdk build quay.io/example/app-operator $ docker push quay.io/example/app-operator @@ -69,31 +78,39 @@ $ docker push quay.io/example/app-operator # Update the operator manifest to use the built image name $ sed -i 's|REPLACE_IMAGE|quay.io/example/app-operator|g' deploy/operator.yaml +# Setup Service Account +$ kubectl create -f deploy/service_account.yaml +# Setup RBAC +$ kubectl create -f deploy/role.yaml +$ kubectl create -f deploy/role_binding.yaml +# Setup the CRD +$ kubectl create -f deploy/crds/app_v1alpha1_appservice_crd.yaml # Deploy the app-operator -$ kubectl create -f deploy/sa.yaml -$ kubectl create -f deploy/rbac.yaml -$ kubectl create -f deploy/crd.yaml $ kubectl create -f deploy/operator.yaml -# By default, creating a custom resource (App) triggers the app-operator to deploy a busybox pod -$ kubectl create -f deploy/cr.yaml +# Create an AppService CR +# The default controller will watch for AppService objects and create a pod for each CR +$ kubectl create -f deploy/crds/app_v1alpha1_appservice_cr.yaml -# Verify that the busybox pod is created -$ kubectl get pod -l app=busy-box -NAME READY STATUS RESTARTS AGE -busy-box 1/1 Running 0 50s +# Verify that a pod is created +$ kubectl get pod -l app=example-appservice +NAME READY STATUS RESTARTS AGE +example-appservice-pod 1/1 Running 0 1m # Cleanup -$ kubectl delete -f deploy/cr.yaml -$ kubectl delete -f deploy/crd.yaml +$ kubectl delete -f deploy/app_v1alpha1_appservice_cr.yaml $ kubectl delete -f deploy/operator.yaml -$ kubectl delete -f deploy/rbac.yaml -$ kubectl delete -f deploy/sa.yaml +$ kubectl delete -f deploy/role.yaml +$ kubectl delete -f deploy/role_binding.yaml +$ kubectl delete -f deploy/service_account.yaml +$ kubectl delete -f deploy/crds/app_v1alpha1_appservice_crd.yaml ``` -## User Guide +## User Guides + +To learn more about the writing an operator in Go, see the [user guide][guide]. -To learn more about the operator-sdk, see the [user guide][guide]. +The SDK also supports developing an operator using Ansible. See the [Ansible operator user guide][ansible_user_guide]. ## Samples @@ -112,7 +129,7 @@ See [reporting bugs][bug_guide] for details about reporting any issues. Operator SDK is under Apache 2.0 license. See the [LICENSE][license_file] file for details. [operator_link]: https://coreos.com/operators/ -[design_docs]: ./doc/design +[proposals_docs]: ./doc/proposals [guide]: ./doc/user-guide.md [samples]: https://github.com/operator-framework/operator-sdk-samples [of-home]: https://github.com/operator-framework @@ -125,3 +142,5 @@ Operator SDK is under Apache 2.0 license. See the [LICENSE][license_file] file f [go_tool]:https://golang.org/dl/ [docker_tool]:https://docs.docker.com/install/ [kubectl_tool]:https://kubernetes.io/docs/tasks/tools/install-kubectl/ +[controller_runtime]: https://github.com/kubernetes-sigs/controller-runtime +[ansible_user_guide]:./doc/ansible/user-guide.md diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add.go new file mode 100644 index 000000000..f4f87be3e --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add.go @@ -0,0 +1,34 @@ +// Copyright 2018 The Operator-SDK 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 cmd + +import ( + "github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add" + + "github.com/spf13/cobra" +) + +func NewAddCmd() *cobra.Command { + upCmd := &cobra.Command{ + Use: "add", + Short: "Adds a controller or resource to the project", + Long: "", + } + + upCmd.AddCommand(add.NewApiCmd()) + upCmd.AddCommand(add.NewControllerCmd()) + upCmd.AddCommand(add.NewAddCrdCmd()) + return upCmd +} diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add/api.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add/api.go new file mode 100644 index 000000000..7a5dc6fe8 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add/api.go @@ -0,0 +1,100 @@ +// Copyright 2018 The Operator-SDK 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 add + +import ( + "log" + + "github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate" + "github.com/operator-framework/operator-sdk/internal/util/projutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" + + "github.com/spf13/cobra" +) + +var ( + apiVersion string + kind string +) + +func NewApiCmd() *cobra.Command { + apiCmd := &cobra.Command{ + Use: "api", + Short: "Adds a new api definition under pkg/apis", + Long: `operator-sdk add api --kind= --api-version= creates the +api definition for a new custom resource under pkg/apis. This command must be run from the project root directory. +If the api already exists at pkg/apis// then the command will not overwrite and return an error. + +Example: + $ operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService + $ tree pkg/apis + pkg/apis/ + ├── addtoscheme_app_appservice.go + ├── apis.go + └── app + └── v1alpha1 + ├── doc.go + ├── register.go + ├── types.go + +`, + Run: apiRun, + } + + apiCmd.Flags().StringVar(&apiVersion, "api-version", "", "Kubernetes APIVersion that has a format of $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)") + apiCmd.MarkFlagRequired("api-version") + apiCmd.Flags().StringVar(&kind, "kind", "", "Kubernetes resource Kind name. (e.g AppService)") + apiCmd.MarkFlagRequired("kind") + + return apiCmd +} + +func apiRun(cmd *cobra.Command, args []string) { + // Create and validate new resource + projutil.MustInProjectRoot() + r, err := scaffold.NewResource(apiVersion, kind) + if err != nil { + log.Fatal(err) + } + + absProjectPath := projutil.MustGetwd() + + cfg := &input.Config{ + Repo: projutil.CheckAndGetCurrPkg(), + AbsProjectPath: absProjectPath, + } + + s := &scaffold.Scaffold{} + err = s.Execute(cfg, + &scaffold.Types{Resource: r}, + &scaffold.AddToScheme{Resource: r}, + &scaffold.Register{Resource: r}, + &scaffold.Doc{Resource: r}, + &scaffold.Cr{Resource: r}, + &scaffold.Crd{Resource: r}, + ) + if err != nil { + log.Fatalf("add scaffold failed: (%v)", err) + } + + // update deploy/role.yaml for the given resource r. + if err := scaffold.UpdateRoleForResource(r, absProjectPath); err != nil { + log.Fatalf("failed to update the RBAC manifest for the resource (%v, %v): %v", r.APIVersion, r.Kind, err) + } + + // Run k8s codegen for deepcopy + generate.K8sCodegen() +} diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add/controller.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add/controller.go new file mode 100644 index 000000000..dff0303a6 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add/controller.go @@ -0,0 +1,80 @@ +// Copyright 2018 The Operator-SDK 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 add + +import ( + "log" + + "github.com/operator-framework/operator-sdk/internal/util/projutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" + + "github.com/spf13/cobra" +) + +func NewControllerCmd() *cobra.Command { + apiCmd := &cobra.Command{ + Use: "controller", + Short: "Adds a new controller pkg", + Long: `operator-sdk add controller --kind= --api-version= creates a new +controller pkg under pkg/controller/ that, by default, reconciles on a custom resource for the specified apiversion and kind. +The controller will expect to use the custom resource type that should already be defined under pkg/apis// +via the "operator-sdk add api --kind= --api-version=" command. +This command must be run from the project root directory. +If the controller pkg for that Kind already exists at pkg/controller/ then the command will not overwrite and return an error. + +Example: + $ operator-sdk add controller --api-version=app.example.com/v1alpha1 --kind=AppService + $ tree pkg/controller + pkg/controller/ + ├── add_appservice.go + ├── appservice + │   └── appservice_controller.go + └── controller.go + +`, + Run: controllerRun, + } + + apiCmd.Flags().StringVar(&apiVersion, "api-version", "", "Kubernetes APIVersion that has a format of $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)") + apiCmd.MarkFlagRequired("api-version") + apiCmd.Flags().StringVar(&kind, "kind", "", "Kubernetes resource Kind name. (e.g AppService)") + apiCmd.MarkFlagRequired("kind") + + return apiCmd +} + +func controllerRun(cmd *cobra.Command, args []string) { + projutil.MustInProjectRoot() + // Create and validate new resource + r, err := scaffold.NewResource(apiVersion, kind) + if err != nil { + log.Fatal(err) + } + + cfg := &input.Config{ + Repo: projutil.CheckAndGetCurrPkg(), + AbsProjectPath: projutil.MustGetwd(), + } + + s := &scaffold.Scaffold{} + err = s.Execute(cfg, + &scaffold.ControllerKind{Resource: r}, + &scaffold.AddController{Resource: r}, + ) + if err != nil { + log.Fatalf("add scaffold failed: (%v)", err) + } +} diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add/crd.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add/crd.go new file mode 100644 index 000000000..e6980bae4 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/add/crd.go @@ -0,0 +1,113 @@ +// Copyright 2018 The Operator-SDK 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 add + +import ( + "fmt" + "log" + "os" + "path/filepath" + "strings" + + "github.com/operator-framework/operator-sdk/internal/util/projutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" + + "github.com/spf13/cobra" +) + +// NewAddCrdCmd - add crd command +func NewAddCrdCmd() *cobra.Command { + crdCmd := &cobra.Command{ + Use: "crd", + Short: "Adds a custom resource definition (CRD) and the custom resource (CR) files", + Long: `The operator-sdk add crd command will create a custom resource definition (CRD) and the custom resource (CR) files for the specified api-version and kind. + +Generated CRD filename: /deploy/crds/___crd.yaml +Generated CR filename: /deploy/crds/___cr.yaml + + /deploy path must already exist + --api-version and --kind are required flags to generate the new operator application. +`, + Run: crdFunc, + } + crdCmd.Flags().StringVar(&apiVersion, "api-version", "", "Kubernetes apiVersion and has a format of $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)") + crdCmd.MarkFlagRequired("api-version") + crdCmd.Flags().StringVar(&kind, "kind", "", "Kubernetes CustomResourceDefintion kind. (e.g AppService)") + crdCmd.MarkFlagRequired("kind") + return crdCmd +} + +func crdFunc(cmd *cobra.Command, args []string) { + cfg := &input.Config{ + AbsProjectPath: projutil.MustGetwd(), + } + if len(args) != 0 { + log.Fatal("crd command doesn't accept any arguments") + } + verifyCrdFlags() + verifyCrdDeployPath() + + fmt.Fprintln(os.Stdout, "Generating custom resource definition (CRD) file") + + // generate CR/CRD file + resource, err := scaffold.NewResource(apiVersion, kind) + if err != nil { + log.Fatalf("%v", err) + } + s := scaffold.Scaffold{} + err = s.Execute(cfg, + &scaffold.Crd{Resource: resource}, + &scaffold.Cr{Resource: resource}, + ) + + if err != nil { + log.Fatalf("add scaffold failed: (%v)", err) + } + + // update deploy/role.yaml for the given resource r. + if err := scaffold.UpdateRoleForResource(resource, cfg.AbsProjectPath); err != nil { + log.Fatalf("failed to update the RBAC manifest for the resource (%v, %v): %v", resource.APIVersion, resource.Kind, err) + } +} + +func verifyCrdFlags() { + if len(apiVersion) == 0 { + log.Fatal("--api-version must not have empty value") + } + if len(kind) == 0 { + log.Fatal("--kind must not have empty value") + } + kindFirstLetter := string(kind[0]) + if kindFirstLetter != strings.ToUpper(kindFirstLetter) { + log.Fatal("--kind must start with an uppercase letter") + } + if strings.Count(apiVersion, "/") != 1 { + log.Fatalf("api-version has wrong format (%v); format must be $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)", apiVersion) + } +} + +// verifyCrdDeployPath checks if the path /deploy sub-directory is exists, and that is rooted under $GOPATH +func verifyCrdDeployPath() { + wd, err := os.Getwd() + if err != nil { + log.Fatalf("failed to determine the full path of the current directory: %v", err) + } + // check if the deploy sub-directory exist + _, err = os.Stat(filepath.Join(wd, scaffold.DeployDir)) + if err != nil { + log.Fatalf("the path (./%v) does not exist. run this command in your project directory", scaffold.DeployDir) + } +} diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/build.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/build.go index a060c7e87..059fbe4c9 100644 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/build.go +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/build.go @@ -23,11 +23,11 @@ import ( "os" "os/exec" "path/filepath" - "strings" - "github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/cmdutil" - cmdError "github.com/operator-framework/operator-sdk/commands/operator-sdk/error" - "github.com/operator-framework/operator-sdk/pkg/generator" + "github.com/operator-framework/operator-sdk/internal/util/projutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" + "github.com/operator-framework/operator-sdk/pkg/test" "github.com/ghodss/yaml" "github.com/spf13/cobra" @@ -119,14 +119,12 @@ func verifyDeploymentImage(yamlFile []byte, imageName string) error { return errors.New(warningMessages) } -func renderTestManifest(image string) { +func verifyTestManifest(image string) { namespacedBytes, err := ioutil.ReadFile(namespacedManBuild) if err != nil { log.Fatalf("could not read namespaced manifest: %v", err) } - if err = generator.RenderTestYaml(cmdutil.GetConfig(), image); err != nil { - log.Fatalf("failed to generate deploy/test-pod.yaml: (%v)", err) - } + err = verifyDeploymentImage(namespacedBytes, image) // the error from verifyDeploymentImage is just a warning, not fatal error if err != nil { @@ -134,27 +132,23 @@ func renderTestManifest(image string) { } } -const ( - build = "./tmp/build/build.sh" - configYaml = "./config/config.yaml" - mainGo = "./cmd/%s/main.go" -) - func buildFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("build command needs exactly 1 argument")) + log.Fatalf("build command needs exactly 1 argument") } - cmdutil.MustInProjectRoot() + projutil.MustInProjectRoot() goBuildEnv := append(os.Environ(), "GOOS=linux", "GOARCH=amd64", "CGO_ENABLED=0") wd, err := os.Getwd() if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("could not identify current working directory: %v", err)) + log.Fatalf("could not identify current working directory: %v", err) } // Don't need to buld go code if Ansible Operator if mainExists() { - buildCmd := exec.Command("go", "build", "-o", filepath.Join(wd, "tmp/_output/bin", filepath.Base(wd)), filepath.Join(cmdutil.GetCurrPkg(), "cmd", filepath.Base(wd))) + managerDir := filepath.Join(projutil.CheckAndGetCurrPkg(), scaffold.ManagerDir) + outputBinName := filepath.Join(wd, scaffold.BuildBinDir, filepath.Base(wd)) + buildCmd := exec.Command("go", "build", "-o", outputBinName, managerDir) buildCmd.Env = goBuildEnv o, err := buildCmd.CombinedOutput() if err != nil { @@ -168,19 +162,20 @@ func buildFunc(cmd *cobra.Command, args []string) { if enableTests { baseImageName += "-intermediate" } - dbcmd := exec.Command("docker", "build", ".", "-f", "tmp/build/Dockerfile", "-t", baseImageName) + dbcmd := exec.Command("docker", "build", ".", "-f", "build/Dockerfile", "-t", baseImageName) o, err := dbcmd.CombinedOutput() if err != nil { if enableTests { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to build intermediate image for %s image: (%s)", image, string(o))) + log.Fatalf("failed to build intermediate image for %s image: %v (%s)", image, err, string(o)) } else { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to output build image %s: (%s)", image, string(o))) + log.Fatalf("failed to output build image %s: %v (%s)", image, err, string(o)) } } fmt.Fprintln(os.Stdout, string(o)) if enableTests { - buildTestCmd := exec.Command("go", "test", "-c", "-o", filepath.Join(wd, "tmp/_output/bin", filepath.Base(wd)+"-test"), testLocationBuild+"/...") + testBinary := filepath.Join(wd, scaffold.BuildBinDir, filepath.Base(wd)+"-test") + buildTestCmd := exec.Command("go", "test", "-c", "-o", testBinary, testLocationBuild+"/...") buildTestCmd.Env = goBuildEnv o, err := buildTestCmd.CombinedOutput() if err != nil { @@ -188,30 +183,40 @@ func buildFunc(cmd *cobra.Command, args []string) { } fmt.Fprintln(os.Stdout, string(o)) // if a user is using an older sdk repo as their library, make sure they have required build files - _, err = os.Stat("tmp/build/test-framework/Dockerfile") - if err != nil { - generator.RenderTestingContainerFiles(filepath.Join(wd, "tmp/build"), filepath.Base(wd)) + testDockerfile := filepath.Join(scaffold.BuildTestDir, scaffold.DockerfileFile) + _, err = os.Stat(testDockerfile) + if err != nil && os.IsNotExist(err) { + + absProjectPath := projutil.MustGetwd() + cfg := &input.Config{ + Repo: projutil.CheckAndGetCurrPkg(), + AbsProjectPath: absProjectPath, + ProjectName: filepath.Base(wd), + } + + s := &scaffold.Scaffold{} + err = s.Execute(cfg, + &scaffold.TestFrameworkDockerfile{}, + &scaffold.GoTestScript{}, + &scaffold.TestPod{Image: image, TestNamespaceEnv: test.TestNamespaceEnv}, + ) + if err != nil { + log.Fatalf("build scaffold failed: (%v)", err) + } } - testDbcmd := exec.Command("docker", "build", ".", "-f", "tmp/build/test-framework/Dockerfile", "-t", image, "--build-arg", "NAMESPACEDMAN="+namespacedManBuild, "--build-arg", "BASEIMAGE="+baseImageName) + + testDbcmd := exec.Command("docker", "build", ".", "-f", testDockerfile, "-t", image, "--build-arg", "NAMESPACEDMAN="+namespacedManBuild, "--build-arg", "BASEIMAGE="+baseImageName) o, err = testDbcmd.CombinedOutput() if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to output build image %v: (%v)", image, string(o))) + log.Fatalf("failed to output build image %s: %v (%s)", image, err, string(o)) } fmt.Fprintln(os.Stdout, string(o)) - // create test-pod.yaml as well as check image name of deployments in namespaced manifest - renderTestManifest(image) + // Check image name of deployments in namespaced manifest + verifyTestManifest(image) } } func mainExists() bool { - dir, err := os.Getwd() - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to get current working dir: %v", err)) - } - dirSplit := strings.Split(dir, "/") - projectName := dirSplit[len(dirSplit)-1] - if _, err = os.Stat(fmt.Sprintf(mainGo, projectName)); err == nil { - return true - } - return false + _, err := os.Stat(filepath.Join(scaffold.ManagerDir, scaffold.CmdFile)) + return err == nil } diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/cmdutil/util.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/cmdutil/util.go deleted file mode 100644 index 9eed7d1f3..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/cmdutil/util.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 cmdutil - -import ( - "errors" - "fmt" - gobuild "go/build" - "io/ioutil" - "os" - "path/filepath" - "strings" - - cmdError "github.com/operator-framework/operator-sdk/commands/operator-sdk/error" - "github.com/operator-framework/operator-sdk/pkg/generator" - - yaml "gopkg.in/yaml.v2" -) - -type OperatorType int - -const ( - configYaml = "./config/config.yaml" - gopkgToml = "./Gopkg.toml" - tmpDockerfile = "./tmp/build/Dockerfile" -) -const ( - OperatorTypeGo OperatorType = iota - OperatorTypeAnsible -) - -// MustInProjectRoot checks if the current dir is the project root. -func MustInProjectRoot() { - // if the current directory has the "./tmp/build/Dockerfile" file, then it is safe to say - // we are at the project root. - _, err := os.Stat(tmpDockerfile) - if err != nil && os.IsNotExist(err) { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("must in project root dir: %v", err)) - } -} - -// GetConfig gets the values from ./config/config.yaml and parses them into a Config struct. -func GetConfig() *generator.Config { - c := &generator.Config{} - fp, err := ioutil.ReadFile(configYaml) - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to read config file %v: (%v)", configYaml, err)) - } - if err = yaml.Unmarshal(fp, c); err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to unmarshal config file %v: (%v)", configYaml, err)) - } - return c -} - -// GetCurrPkg returns the current directory's import path -// e.g: "github.com/example-inc/app-operator" -func GetCurrPkg() string { - gopath := os.Getenv("GOPATH") - if len(gopath) == 0 { - gopath = gobuild.Default.GOPATH - } - goSrc := filepath.Join(gopath, "src") - - wd, err := os.Getwd() - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to get working directory: (%v)", err)) - } - if !strings.HasPrefix(filepath.Dir(wd), goSrc) { - cmdError.ExitWithError(cmdError.ExitError, errors.New("must run from gopath")) - } - currPkg := strings.Replace(wd, goSrc+string(filepath.Separator), "", 1) - return currPkg -} - -// GetOperatorType returns type of operator is in cwd -// This function should be called after verifying the user is in project root -// e.g: "go", "ansible" -func GetOperatorType() OperatorType { - // Assuming that if Gopkg.toml exists then this is a Go operator - _, err := os.Stat(gopkgToml) - if err != nil && os.IsNotExist(err) { - return OperatorTypeAnsible - } - return OperatorTypeGo -} diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate.go index e164a919c..39923f518 100644 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate.go +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate.go @@ -24,11 +24,8 @@ func NewGenerateCmd() *cobra.Command { cmd := &cobra.Command{ Use: "generate ", Short: "Invokes specific generator", - Long: `The operator-sdk generate command invokes specific generator to generate code as needed. -`, + Long: `The operator-sdk generate command invokes specific generator to generate code as needed.`, } cmd.AddCommand(generate.NewGenerateK8SCmd()) - cmd.AddCommand(generate.NewGenerateOlmCatalogCmd()) - cmd.AddCommand(generate.NewGenerateCrdCmd()) return cmd } diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/crd.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/crd.go deleted file mode 100644 index b9f1c0e89..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/crd.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generate - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "strings" - - cmdError "github.com/operator-framework/operator-sdk/commands/operator-sdk/error" - "github.com/operator-framework/operator-sdk/pkg/generator" - - "github.com/spf13/cobra" -) - -var ( - apiVersion string - kind string -) - -const ( - goDir = "GOPATH" - deployCrdDir = "deploy" -) - -func NewGenerateCrdCmd() *cobra.Command { - crdCmd := &cobra.Command{ - Use: "crd", - Short: "Generates a custom resource definition (CRD) and the custom resource (CR) files", - Long: `The operator-sdk generate command will create a custom resource definition (CRD) and the custom resource (CR) files for the specified api-version and kind. - -Generated CRD filename: /deploy/___crd.yaml -Generated CR filename: /deploy/___cr.yaml - - /deploy path must already exist - --api-version and --kind are required flags to generate the new operator application. -`, - Run: crdFunc, - } - crdCmd.Flags().StringVar(&apiVersion, "api-version", "", "Kubernetes apiVersion and has a format of $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)") - crdCmd.MarkFlagRequired("api-version") - crdCmd.Flags().StringVar(&kind, "kind", "", "Kubernetes CustomResourceDefintion kind. (e.g AppService)") - crdCmd.MarkFlagRequired("kind") - return crdCmd -} - -func crdFunc(cmd *cobra.Command, args []string) { - if len(args) != 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("crd command doesn't accept any arguments.")) - } - verifyCrdFlags() - verifyCrdDeployPath() - - fmt.Fprintln(os.Stdout, "Generating custom resource definition (CRD) file") - - // generate CR/CRD file - wd, err := os.Getwd() - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, err) - } - if err := generator.RenderDeployCrdFiles(filepath.Join(wd, deployCrdDir), apiVersion, kind); err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to generate CRD and CR files: (%v)", err)) - } -} - -func verifyCrdFlags() { - if len(apiVersion) == 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--api-version must not have empty value")) - } - if len(kind) == 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--kind must not have empty value")) - } - kindFirstLetter := string(kind[0]) - if kindFirstLetter != strings.ToUpper(kindFirstLetter) { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--kind must start with an uppercase letter")) - } - if strings.Count(apiVersion, "/") != 1 { - cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("api-version has wrong format (%v); format must be $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)", apiVersion)) - } -} - -// verifyCrdDeployPath checks if the path /deploy sub-directory is exists, and that is rooted under $GOPATH -func verifyCrdDeployPath() { - wd, err := os.Getwd() - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to determine the full path of the current directory: %v", err)) - } - // check if the deploy sub-directory exist - _, err = os.Stat(filepath.Join(wd, deployCrdDir)) - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("the path (./%v) does not exist. run this command in your project directory", deployCrdDir)) - } -} diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/k8s.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/k8s.go index 9933e5c59..6ab093caa 100644 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/k8s.go +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/k8s.go @@ -15,22 +15,19 @@ package generate import ( - "errors" "fmt" + "io/ioutil" + "log" "os" "os/exec" + "path/filepath" - cmdError "github.com/operator-framework/operator-sdk/commands/operator-sdk/error" + "github.com/operator-framework/operator-sdk/internal/util/projutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold" "github.com/spf13/cobra" ) -const ( - k8sGenerated = "./tmp/codegen/update-generated.sh" - // dot represents current dir. - dot = "." -) - func NewGenerateK8SCmd() *cobra.Command { return &cobra.Command{ Use: "k8s", @@ -44,19 +41,67 @@ to comply with kube-API requirements. func k8sFunc(cmd *cobra.Command, args []string) { if len(args) != 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("k8s command doesn't accept any arguments.")) + log.Fatalf("k8s command doesn't accept any arguments.") + } + K8sCodegen() +} + +// K8sCodegen performs deepcopy code-generation for all custom resources under pkg/apis +func K8sCodegen() { + projutil.MustInProjectRoot() + repoPkg := projutil.CheckAndGetCurrPkg() + outputPkg := filepath.Join(repoPkg, "pkg/generated") + apisPkg := filepath.Join(repoPkg, scaffold.ApisDir) + groupVersions, err := parseGroupVersions() + if err != nil { + log.Fatalf("failed to parse group versions: (%v)", err) + } + + fmt.Fprintf(os.Stdout, "Running code-generation for custom resource group versions: [%s]\n", groupVersions) + // TODO: Replace generate-groups.sh by building the vendored generators(deepcopy, lister etc) + // and running them directly + // TODO: remove dependency on boilerplate.go.txt + genGroupsCmd := "vendor/k8s.io/code-generator/generate-groups.sh" + args := []string{ + "deepcopy", + outputPkg, + apisPkg, + groupVersions, + } + out, err := exec.Command(genGroupsCmd, args...).CombinedOutput() + if err != nil { + log.Fatalf("failed to perform code-generation: (%v)", err) } - K8sCodegen(dot) + fmt.Fprintln(os.Stdout, string(out)) } -// K8sCodegen performs code-generation for custom resources of this project given the projectDir. -func K8sCodegen(projectDir string) { - fmt.Fprintln(os.Stdout, "Run code-generation for custom resources") - kcmd := exec.Command(k8sGenerated) - kcmd.Dir = projectDir - o, err := kcmd.CombinedOutput() +// getGroupVersions parses the layout of pkg/apis to return the API groups and versions +// in the format "groupA:v1,v2 groupB:v1 groupC:v2", +// as required by the generate-groups.sh script +func parseGroupVersions() (string, error) { + var groupVersions string + groups, err := ioutil.ReadDir(scaffold.ApisDir) if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to perform code-generation for CustomResources: (%v)", string(o))) + return "", fmt.Errorf("could not read pkg/apis directory to find api Versions: %v", err) } - fmt.Fprintln(os.Stdout, string(o)) + + for _, g := range groups { + if g.IsDir() { + groupDir := filepath.Join(scaffold.ApisDir, g.Name()) + versions, err := ioutil.ReadDir(groupDir) + if err != nil { + return "", fmt.Errorf("could not read %s directory to find api Versions: %v", groupDir, err) + } + + groupVersion := "" + for _, v := range versions { + if v.IsDir() && scaffold.ResourceVersionRegexp.MatchString(v.Name()) { + groupVersion = groupVersion + v.Name() + "," + } + } + groupVersions += fmt.Sprintf("%s:%s ", g.Name(), groupVersion) + } + } + + return groupVersions, nil } diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/olm_catalog.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/olm_catalog.go deleted file mode 100644 index dee712ac2..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate/olm_catalog.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generate - -import ( - "errors" - "fmt" - "io/ioutil" - "os" - - cmdError "github.com/operator-framework/operator-sdk/commands/operator-sdk/error" - "github.com/operator-framework/operator-sdk/pkg/generator" - yaml "gopkg.in/yaml.v2" - - "github.com/spf13/cobra" -) - -const ( - configYaml = "./config/config.yaml" -) - -var ( - image string - version string -) - -func NewGenerateOlmCatalogCmd() *cobra.Command { - olmCatalogCmd := &cobra.Command{ - Use: "olm-catalog", - Short: "Generates OLM Catalog manifests", - Long: `olm-catalog generator generates the following OLM Catalog manifests needed to create a catalog entry in OLM: -- Cluster Service Version: deploy/olm-catalog/csv.yaml -- Package: deploy/olm-catalog/package.yaml -- Custom Resource Definition: deploy/olm-catalog/crd.yaml - -The following flags are required: ---image: The container image name to set in the CSV to deploy the operator ---version: The version of the current CSV - -For example: - $ operator-sdk generate olm-catalog --image=quay.io/example/operator:v0.0.1 --version=0.0.1 -`, - Run: olmCatalogFunc, - } - olmCatalogCmd.Flags().StringVar(&image, "image", "", "The container image name to set in the CSV to deploy the operator e.g: quay.io/example/operator:v0.0.1") - olmCatalogCmd.MarkFlagRequired("image") - olmCatalogCmd.Flags().StringVar(&version, "version", "", "The version of the current CSV e.g: 0.0.1") - olmCatalogCmd.MarkFlagRequired("version") - - return olmCatalogCmd -} - -func olmCatalogFunc(cmd *cobra.Command, args []string) { - if len(args) != 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("olm-catalog command doesn't accept any arguments.")) - } - verifyFlags() - - fmt.Fprintln(os.Stdout, "Generating OLM catalog manifests") - - c := &generator.Config{} - fp, err := ioutil.ReadFile(configYaml) - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to read config file %v: (%v)", configYaml, err)) - } - if err = yaml.Unmarshal(fp, c); err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to unmarshal config file %v: (%v)", configYaml, err)) - } - - // Generate OLM catalog manifests - if err = generator.RenderOlmCatalog(c, image, version); err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to generate deploy/olm-catalog: (%v)", err)) - } -} - -func verifyFlags() { - if len(image) == 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--image must not have empty value")) - } - if len(version) == 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--version must not have empty value")) - } -} diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/new.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/new.go index 5c68d1f14..5b4d4c5e9 100644 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/new.go +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/new.go @@ -15,44 +15,42 @@ package cmd import ( - "errors" "fmt" + "io/ioutil" + "log" "os" "os/exec" "path/filepath" "strings" - "github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/generate" - cmdError "github.com/operator-framework/operator-sdk/commands/operator-sdk/error" - "github.com/operator-framework/operator-sdk/pkg/generator" + "github.com/operator-framework/operator-sdk/internal/util/projutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/ansible" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" "github.com/spf13/cobra" ) func NewNewCmd() *cobra.Command { newCmd := &cobra.Command{ - Use: "new [required-flags]", + Use: "new ", Short: "Creates a new operator application", Long: `The operator-sdk new command creates a new operator application and generates a default directory layout based on the input . is the project name of the new operator. (e.g app-operator) - --api-version and --kind are required flags to generate the new operator application. - For example: $ mkdir $GOPATH/src/github.com/example.com/ $ cd $GOPATH/src/github.com/example.com/ - $ operator-sdk new app-operator --api-version=app.example.com/v1alpha1 --kind=AppService + $ operator-sdk new app-operator generates a skeletal app-operator application in $GOPATH/src/github.com/example.com/app-operator. `, Run: newFunc, } newCmd.Flags().StringVar(&apiVersion, "api-version", "", "Kubernetes apiVersion and has a format of $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)") - newCmd.MarkFlagRequired("api-version") newCmd.Flags().StringVar(&kind, "kind", "", "Kubernetes CustomResourceDefintion kind. (e.g AppService)") - newCmd.MarkFlagRequired("kind") newCmd.Flags().StringVar(&operatorType, "type", "go", "Type of operator to initialize (e.g \"ansible\")") newCmd.Flags().BoolVar(&skipGit, "skip-git-init", false, "Do not init the directory as a git repository") newCmd.Flags().BoolVar(&generatePlaybook, "generate-playbook", false, "Generate a playbook skeleton. (Only used for --type ansible)") @@ -70,53 +68,156 @@ var ( ) const ( - gopath = "GOPATH" - src = "src" - dep = "dep" - ensureCmd = "ensure" - goOperatorType = "go" - ansibleOperatorType = "ansible" + gopath = "GOPATH" + src = "src" + dep = "dep" + ensureCmd = "ensure" ) func newFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("new command needs 1 argument")) + log.Fatal("new command needs 1 argument") } parse(args) mustBeNewProject() verifyFlags() - g := generator.NewGenerator(apiVersion, kind, operatorType, projectName, repoPath(), generatePlaybook) - err := g.Render() - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to create project %v: %v", projectName, err)) - } - if operatorType == goOperatorType { + + switch operatorType { + case projutil.OperatorTypeGo: + doScaffold() pullDep() - generate.K8sCodegen(projectName) + case projutil.OperatorTypeAnsible: + doAnsibleScaffold() } initGit() } func parse(args []string) { + if len(args) != 1 { + log.Fatal("new command needs 1 argument") + } projectName = args[0] if len(projectName) == 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("project-name must not be empty")) + log.Fatal("project-name must not be empty") } } // mustBeNewProject checks if the given project exists under the current diretory. // it exits with error when the project exists. func mustBeNewProject() { - fp := filepath.Join(mustGetwd(), projectName) + fp := filepath.Join(projutil.MustGetwd(), projectName) stat, err := os.Stat(fp) if err != nil && os.IsNotExist(err) { return } if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to determine if project (%v) exists", projectName)) + log.Fatalf("failed to determine if project (%v) exists", projectName) } if stat.IsDir() { - cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("project (%v) exists. please use a different project name or delete the existing one", projectName)) + log.Fatalf("project (%v) exists. please use a different project name or delete the existing one", projectName) + } +} + +func doScaffold() { + cfg := &input.Config{ + Repo: filepath.Join(projutil.CheckAndGetCurrPkg(), projectName), + AbsProjectPath: filepath.Join(projutil.MustGetwd(), projectName), + ProjectName: projectName, + } + + s := &scaffold.Scaffold{} + err := s.Execute(cfg, + &scaffold.Cmd{}, + &scaffold.Dockerfile{}, + &scaffold.ServiceAccount{}, + &scaffold.Role{}, + &scaffold.RoleBinding{}, + &scaffold.Operator{}, + &scaffold.Apis{}, + &scaffold.Controller{}, + &scaffold.Version{}, + &scaffold.Gitignore{}, + &scaffold.GopkgToml{}, + ) + if err != nil { + log.Fatalf("new scaffold failed: (%v)", err) + } +} + +func doAnsibleScaffold() { + cfg := &input.Config{ + AbsProjectPath: filepath.Join(projutil.MustGetwd(), projectName), + ProjectName: projectName, + } + + resource, err := scaffold.NewResource(apiVersion, kind) + if err != nil { + log.Fatal("Invalid apiVersion and kind.") + } + + s := &scaffold.Scaffold{} + tmpdir, err := ioutil.TempDir("", "osdk") + if err != nil { + log.Fatal("unable to get temp directory") + } + + galaxyInit := &ansible.GalaxyInit{ + Resource: *resource, + Dir: tmpdir, + } + + err = s.Execute(cfg, + &ansible.Dockerfile{ + GeneratePlaybook: generatePlaybook, + }, + &ansible.WatchesYAML{ + Resource: *resource, + GeneratePlaybook: generatePlaybook, + }, + galaxyInit, + &scaffold.ServiceAccount{}, + &scaffold.Role{}, + &scaffold.RoleBinding{}, + &ansible.Operator{}, + &scaffold.Crd{ + Resource: resource, + }, + &scaffold.Cr{ + Resource: resource, + }, + ) + if err != nil { + log.Fatalf("new scaffold failed: (%v)", err) + } + + // Decide on playbook. + if generatePlaybook { + err := s.Execute(cfg, + &ansible.Playbook{ + Resource: *resource, + }, + ) + if err != nil { + log.Fatalf("new scaffold failed: (%v)", err) + } + } + + // Run galaxy init. + cmd := exec.Command(filepath.Join(galaxyInit.AbsProjectPath, galaxyInit.Path)) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + cmd.Run() + // Delete Galxy INIT + // Mac OS tmp directory is /var/folders/_c/..... this means we have to make sure that we get the top level directory to remove + // everything. + tmpDirectorySlice := strings.Split(os.TempDir(), "/") + if err = os.RemoveAll(filepath.Join(galaxyInit.AbsProjectPath, tmpDirectorySlice[1])); err != nil { + log.Fatalf("failed to remove the galaxy init script") + } + + // update deploy/role.yaml for the given resource r. + if err := scaffold.UpdateRoleForResource(resource, cfg.AbsProjectPath); err != nil { + log.Fatalf("failed to update the RBAC manifest for the resource (%v, %v): %v", resource.APIVersion, resource.Kind, err) } } @@ -124,15 +225,15 @@ func mustBeNewProject() { // repoPath field on generator is used primarily in generation of Go operator. For Ansible we will set it to cwd func repoPath() string { // We only care about GOPATH constraint checks if we are a Go operator - wd := mustGetwd() - if operatorType == goOperatorType { + wd := projutil.MustGetwd() + if operatorType == projutil.OperatorTypeGo { gp := os.Getenv(gopath) if len(gp) == 0 { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("$GOPATH env not set")) + log.Fatal("$GOPATH env not set") } // check if this project's repository path is rooted under $GOPATH if !strings.HasPrefix(wd, gp) { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("project's repository path (%v) is not rooted under GOPATH (%v)", wd, gp)) + log.Fatalf("project's repository path (%v) is not rooted under GOPATH (%v)", wd, gp) } // compute the repo path by stripping "$GOPATH/src/" from the path of the current directory. rp := filepath.Join(string(wd[len(filepath.Join(gp, src)):]), projectName) @@ -143,50 +244,48 @@ func repoPath() string { } func verifyFlags() { - if len(apiVersion) == 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--api-version must not have empty value")) + if operatorType != projutil.OperatorTypeGo && operatorType != projutil.OperatorTypeAnsible { + log.Fatal("--type can only be `go` or `ansible`") } - if len(kind) == 0 { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--kind must not have empty value")) + if operatorType != projutil.OperatorTypeAnsible && generatePlaybook { + log.Fatal("--generate-playbook can only be used with --type `ansible`") } - if operatorType != goOperatorType && operatorType != ansibleOperatorType { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--type can only be `go` or `ansible`")) + if operatorType == projutil.OperatorTypeGo && (len(apiVersion) != 0 || len(kind) != 0) { + log.Fatal(`go type operator does not use --api-version or --kind. Please see "operator-sdk add" command after running new.`) } - if operatorType != ansibleOperatorType && generatePlaybook { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--generate-playbook can only be used with --type `ansible`")) - } - kindFirstLetter := string(kind[0]) - if kindFirstLetter != strings.ToUpper(kindFirstLetter) { - cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--kind must start with an uppercase letter")) - } - if strings.Count(apiVersion, "/") != 1 { - cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("api-version has wrong format (%v); format must be $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)", apiVersion)) - } -} -func mustGetwd() string { - wd, err := os.Getwd() - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to determine the full path of the current directory: %v", err)) + if operatorType != projutil.OperatorTypeGo { + if len(apiVersion) == 0 { + log.Fatal("--api-version must not have empty value") + } + if len(kind) == 0 { + log.Fatal("--kind must not have empty value") + } + kindFirstLetter := string(kind[0]) + if kindFirstLetter != strings.ToUpper(kindFirstLetter) { + log.Fatal("--kind must start with an uppercase letter") + } + if strings.Count(apiVersion, "/") != 1 { + log.Fatalf("api-version has wrong format (%v); format must be $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)", apiVersion) + } } - return wd } func execCmd(stdout *os.File, cmd string, args ...string) { dc := exec.Command(cmd, args...) - dc.Dir = filepath.Join(mustGetwd(), projectName) + dc.Dir = filepath.Join(projutil.MustGetwd(), projectName) dc.Stdout = stdout dc.Stderr = os.Stderr err := dc.Run() if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to exec %s %#v: %v", cmd, args, err)) + log.Fatalf("failed to exec %s %#v: %v", cmd, args, err) } } func pullDep() { _, err := exec.LookPath(dep) if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("looking for dep in $PATH: %v", err)) + log.Fatalf("looking for dep in $PATH: %v", err) } fmt.Fprintln(os.Stdout, "Run dep ensure ...") execCmd(os.Stdout, dep, ensureCmd, "-v") diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/root.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/root.go index b69fa21fb..37f925008 100644 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/root.go +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/root.go @@ -23,11 +23,12 @@ import ( func NewRootCmd() *cobra.Command { cmd := &cobra.Command{ Use: "operator-sdk", - Short: "A sdk for building operator with ease", + Short: "An SDK for building operators with ease", Version: version.Version, } cmd.AddCommand(NewNewCmd()) + cmd.AddCommand(NewAddCmd()) cmd.AddCommand(NewBuildCmd()) cmd.AddCommand(NewGenerateCmd()) cmd.AddCommand(NewUpCmd()) diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/test/cluster.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/test/cluster.go index 8c0ae4c79..cb02ab939 100644 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/test/cluster.go +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/test/cluster.go @@ -21,6 +21,7 @@ import ( "strings" "time" + "github.com/operator-framework/operator-sdk/pkg/scaffold" "github.com/operator-framework/operator-sdk/pkg/test" "github.com/spf13/cobra" @@ -89,7 +90,7 @@ func testClusterFunc(cmd *cobra.Command, args []string) error { Name: "operator-test", Image: args[0], ImagePullPolicy: pullPolicy, - Command: []string{"/go-test.sh"}, + Command: []string{"/" + scaffold.GoTestScriptFile}, Env: []v1.EnvVar{{ Name: test.TestNamespaceEnv, ValueFrom: &v1.EnvVarSource{FieldRef: &v1.ObjectFieldSelector{FieldPath: "metadata.namespace"}}, @@ -152,7 +153,10 @@ func testClusterFunc(cmd *cobra.Command, args []string) error { } defer readCloser.Close() buf := new(bytes.Buffer) - buf.ReadFrom(readCloser) + _, err = buf.ReadFrom(readCloser) + if err != nil { + return fmt.Errorf("test failed and failed to read pod logs: %v", err) + } return fmt.Errorf("test failed:\n%s", buf.String()) } } diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/test/local.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/test/local.go index 45b61f084..6a2ff5db9 100644 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/test/local.go +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/test/local.go @@ -20,14 +20,19 @@ import ( "log" "os" "os/exec" + "path/filepath" "strings" - cmdError "github.com/operator-framework/operator-sdk/commands/operator-sdk/error" + "github.com/operator-framework/operator-sdk/internal/util/fileutil" + "github.com/operator-framework/operator-sdk/internal/util/projutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold" "github.com/operator-framework/operator-sdk/pkg/test" "github.com/spf13/cobra" ) +var deployTestDir = filepath.Join(scaffold.DeployDir, "test") + type testLocalConfig struct { kubeconfig string globalManPath string @@ -50,7 +55,7 @@ func NewTestLocalCmd() *cobra.Command { defaultKubeConfig = homedir + "/.kube/config" } testCmd.Flags().StringVar(&tlConfig.kubeconfig, "kubeconfig", defaultKubeConfig, "Kubeconfig path") - testCmd.Flags().StringVar(&tlConfig.globalManPath, "global-manifest", "deploy/crd.yaml", "Path to manifest for Global resources (e.g. CRD manifest)") + testCmd.Flags().StringVar(&tlConfig.globalManPath, "global-manifest", "", "Path to manifest for Global resources (e.g. CRD manifests)") testCmd.Flags().StringVar(&tlConfig.namespacedManPath, "namespaced-manifest", "", "Path to manifest for per-test, namespaced resources (e.g. RBAC and Operator manifest)") testCmd.Flags().StringVar(&tlConfig.goTestFlags, "go-test-flags", "", "Additional flags to pass to go test") testCmd.Flags().StringVar(&tlConfig.namespace, "namespace", "", "If non-empty, single namespace to run tests in") @@ -60,29 +65,40 @@ func NewTestLocalCmd() *cobra.Command { func testLocalFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("operator-sdk test local requires exactly 1 argument")) + log.Fatalf("operator-sdk test local requires exactly 1 argument") } - // if no namespaced manifest path is given, combine deploy/sa.yaml, deploy/rbac.yaml and deploy/operator.yaml + // if no namespaced manifest path is given, combine deploy/service_account.yaml, deploy/role.yaml, deploy/role_binding.yaml and deploy/operator.yaml if tlConfig.namespacedManPath == "" { - os.Mkdir("deploy/test", os.FileMode(int(0775))) - tlConfig.namespacedManPath = "deploy/test/namespace-manifests.yaml" - sa, err := ioutil.ReadFile("deploy/sa.yaml") + err := os.MkdirAll(deployTestDir, os.FileMode(fileutil.DefaultDirFileMode)) + if err != nil { + log.Fatalf("could not create %s: %v", deployTestDir, err) + } + tlConfig.namespacedManPath = filepath.Join(deployTestDir, "namespace-manifests.yaml") + + saFile := filepath.Join(scaffold.DeployDir, scaffold.ServiceAccountYamlFile) + sa, err := ioutil.ReadFile(saFile) + if err != nil { + log.Fatalf("could not find the manifest %s: %v", saFile, err) + } + role, err := ioutil.ReadFile(filepath.Join(scaffold.DeployDir, scaffold.RoleYamlFile)) if err != nil { - log.Fatalf("could not find sa manifest: %v", err) + log.Fatalf("could not find role manifest: %v", err) } - rbac, err := ioutil.ReadFile("deploy/rbac.yaml") + roleBinding, err := ioutil.ReadFile(filepath.Join(scaffold.DeployDir, scaffold.RoleBindingYamlFile)) if err != nil { - log.Fatalf("could not find rbac manifest: %v", err) + log.Fatalf("could not find role_binding manifest: %v", err) } - operator, err := ioutil.ReadFile("deploy/operator.yaml") + operator, err := ioutil.ReadFile(filepath.Join(scaffold.DeployDir, scaffold.OperatorYamlFile)) if err != nil { log.Fatalf("could not find operator manifest: %v", err) } combined := append(sa, []byte("\n---\n")...) - combined = append(combined, rbac...) + combined = append(combined, role...) + combined = append(combined, []byte("\n---\n")...) + combined = append(combined, roleBinding...) combined = append(combined, []byte("\n---\n")...) combined = append(combined, operator...) - err = ioutil.WriteFile(tlConfig.namespacedManPath, combined, os.FileMode(int(0664))) + err = ioutil.WriteFile(tlConfig.namespacedManPath, combined, os.FileMode(fileutil.DefaultFileMode)) if err != nil { log.Fatalf("could not create temporary namespaced manifest file: %v", err) } @@ -93,11 +109,47 @@ func testLocalFunc(cmd *cobra.Command, args []string) { } }() } + if tlConfig.globalManPath == "" { + err := os.MkdirAll(deployTestDir, os.FileMode(fileutil.DefaultDirFileMode)) + if err != nil { + log.Fatalf("could not create %s: %v", deployTestDir, err) + } + tlConfig.globalManPath = filepath.Join(deployTestDir, "global-manifests.yaml") + files, err := ioutil.ReadDir(scaffold.CrdsDir) + if err != nil { + log.Fatalf("could not read deploy directory: %v", err) + } + var combined []byte + for _, file := range files { + if strings.HasSuffix(file.Name(), "crd.yaml") { + fileBytes, err := ioutil.ReadFile(filepath.Join(scaffold.CrdsDir, file.Name())) + if err != nil { + log.Fatalf("could not read file %s: %v", filepath.Join(scaffold.CrdsDir, file.Name()), err) + } + if combined == nil { + combined = []byte{} + } else { + combined = append(combined, []byte("\n---\n")...) + } + combined = append(combined, fileBytes...) + } + } + err = ioutil.WriteFile(tlConfig.globalManPath, combined, os.FileMode(fileutil.DefaultFileMode)) + if err != nil { + log.Fatalf("could not create temporary global manifest file: %v", err) + } + defer func() { + err := os.Remove(tlConfig.globalManPath) + if err != nil { + log.Fatalf("could not delete global namespace manifest file") + } + }() + } testArgs := []string{"test", args[0] + "/..."} testArgs = append(testArgs, "-"+test.KubeConfigFlag, tlConfig.kubeconfig) testArgs = append(testArgs, "-"+test.NamespacedManPathFlag, tlConfig.namespacedManPath) testArgs = append(testArgs, "-"+test.GlobalManPathFlag, tlConfig.globalManPath) - testArgs = append(testArgs, "-"+test.ProjRootFlag, mustGetwd()) + testArgs = append(testArgs, "-"+test.ProjRootFlag, projutil.MustGetwd()) // if we do the append using an empty go flags, it inserts an empty arg, which causes // any later flags to be ignored if tlConfig.goTestFlags != "" { @@ -108,19 +160,11 @@ func testLocalFunc(cmd *cobra.Command, args []string) { } dc := exec.Command("go", testArgs...) dc.Env = append(os.Environ(), fmt.Sprintf("%v=%v", test.TestNamespaceEnv, tlConfig.namespace)) - dc.Dir = mustGetwd() + dc.Dir = projutil.MustGetwd() dc.Stdout = os.Stdout dc.Stderr = os.Stderr err := dc.Run() if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to exec `go %s`: %v", strings.Join(testArgs, " "), err)) - } -} - -func mustGetwd() string { - wd, err := os.Getwd() - if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to determine the full path of the current directory: %v", err)) + log.Fatalf("failed to exec `go %s`: %v", strings.Join(testArgs, " "), err) } - return wd } diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/up/local.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/up/local.go index c3c6d2353..b712f2255 100644 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/up/local.go +++ b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/up/local.go @@ -25,13 +25,16 @@ import ( "runtime" "strings" "syscall" + "time" - "github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/cmdutil" - cmdError "github.com/operator-framework/operator-sdk/commands/operator-sdk/error" + "github.com/operator-framework/operator-sdk/internal/util/projutil" ansibleOperator "github.com/operator-framework/operator-sdk/pkg/ansible/operator" proxy "github.com/operator-framework/operator-sdk/pkg/ansible/proxy" - "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" + "github.com/operator-framework/operator-sdk/pkg/k8sutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold" + ansibleScaffold "github.com/operator-framework/operator-sdk/pkg/scaffold/ansible" sdkVersion "github.com/operator-framework/operator-sdk/version" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" "sigs.k8s.io/controller-runtime/pkg/client/config" @@ -63,24 +66,19 @@ var ( ) const ( - gocmd = "go" - run = "run" - cmd = "cmd" - main = "main.go" defaultConfigPath = ".kube/config" ) func upLocalFunc(cmd *cobra.Command, args []string) { mustKubeConfig() - cmdutil.MustInProjectRoot() - switch cmdutil.GetOperatorType() { - case cmdutil.OperatorTypeGo: - c := cmdutil.GetConfig() - upLocal(c.ProjectName) - case cmdutil.OperatorTypeAnsible: + switch projutil.GetOperatorType() { + case projutil.OperatorTypeGo: + projutil.MustInProjectRoot() + upLocal() + case projutil.OperatorTypeAnsible: upLocalAnsible() default: - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to determine operator type")) + log.Fatal("failed to determine operator type") } } @@ -90,31 +88,31 @@ func mustKubeConfig() { if len(kubeConfig) == 0 { usr, err := user.Current() if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to determine user's home dir: %v", err)) + log.Fatalf("failed to determine user's home dir: %v", err) } kubeConfig = filepath.Join(usr.HomeDir, defaultConfigPath) } _, err := os.Stat(kubeConfig) if err != nil && os.IsNotExist(err) { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to find the kubeconfig file (%v): %v", kubeConfig, err)) + log.Fatalf("failed to find the kubeconfig file (%v): %v", kubeConfig, err) } } -func upLocal(projectName string) { - args := []string{run, filepath.Join(cmd, projectName, main)} +func upLocal() { + args := []string{"run", filepath.Join(scaffold.ManagerDir, scaffold.CmdFile)} if operatorFlags != "" { extraArgs := strings.Split(operatorFlags, " ") args = append(args, extraArgs...) } - dc := exec.Command(gocmd, args...) + dc := exec.Command("go", args...) c := make(chan os.Signal) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c err := dc.Process.Kill() if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to terminate the operator: %v", err)) + log.Fatalf("failed to terminate the operator: %v", err) } os.Exit(0) }() @@ -123,7 +121,7 @@ func upLocal(projectName string) { dc.Env = append(os.Environ(), fmt.Sprintf("%v=%v", k8sutil.KubeConfigEnvVar, kubeConfig), fmt.Sprintf("%v=%v", k8sutil.WatchNamespaceEnvVar, namespace)) err := dc.Run() if err != nil { - cmdError.ExitWithError(cmdError.ExitError, fmt.Errorf("failed to run operator locally: %v", err)) + log.Fatalf("failed to run operator locally: %v", err) } } @@ -138,14 +136,17 @@ func upLocalAnsible() { done := make(chan error) // start the proxy - proxy.RunProxy(done, proxy.Options{ + err = proxy.Run(done, proxy.Options{ Address: "localhost", Port: 8888, KubeConfig: mgr.GetConfig(), }) + if err != nil { + logrus.Fatalf("error starting proxy: %v", err) + } // start the operator - go ansibleOperator.Run(done, mgr) + go ansibleOperator.Run(done, mgr, "./"+ansibleScaffold.WatchesYamlFile, time.Minute) // wait for either to finish err = <-done diff --git a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/error/error.go b/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/error/error.go deleted file mode 100644 index 08ae9b0b9..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/commands/operator-sdk/error/error.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 error - -import ( - "fmt" - "os" -) - -const ( - // http://tldp.org/LDP/abs/html/exitcodes.html - ExitSuccess = iota - ExitError - // ExitBadArgs is the exit error code for bad arguments. - ExitBadArgs = 128 -) - -// ExitWithError prints out an error code and an error string to stderr. -func ExitWithError(code int, err error) { - fmt.Fprintln(os.Stderr, "Error:", err) - os.Exit(code) -} diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/ansible/dev/developer_guide.md b/vendor/github.com/operator-framework/operator-sdk/doc/ansible/dev/developer_guide.md new file mode 100644 index 000000000..5248846a7 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/doc/ansible/dev/developer_guide.md @@ -0,0 +1,437 @@ +# Developer guide + +This document provides some useful information and tips for a developer +creating an operator powered by Ansible. + +## Getting started with the k8s Ansible modules + +Since we are interested in using Ansible for the lifecycle management of our +application on Kubernetes, it is beneficial for a developer to get a good grasp +of the [k8s Ansible module][k8s_ansible_module]. This Ansible module allows a +developer to either leverage their existing Kubernetes resource files (written +in YaML) or express the lifecycle management in native Ansible. One of the +biggest benefits of using Ansible in conjunction with existing Kubernetes +resource files is the ability to use Jinja templating so that you can customize +deployments with the simplicity of a few variables in Ansible. + +The easiest way to get started is to install the modules on your local machine +and test them using a playbook. + +### Installing the k8s Ansible modules + +To install the k8s Ansible modules, one must first install Ansible 2.6+. On +Fedora/Centos: +```bash +$ sudo dnf install ansible +``` + +In addition to Ansible, a user must install the [Openshift Restclient +Python][openshift_restclient_python] package. This can be installed from pip: +```bash +$ pip install openshift +``` + +### Testing the k8s Ansible modules locally + +Sometimes it is beneficial for a developer to run the Ansible code from their +local machine as opposed to running/rebuilding the operator each time. To do +this, initialize a new project: +```bash +$ operator-sdk new --type ansible --kind Foo --api-version foo.example.com/v1alpha1 foo-operator +Create foo-operator/tmp/init/galaxy-init.sh +Create foo-operator/tmp/build/Dockerfile +Create foo-operator/tmp/build/test-framework/Dockerfile +Create foo-operator/tmp/build/go-test.sh +Rendering Ansible Galaxy role [foo-operator/roles/Foo]... +Cleaning up foo-operator/tmp/init +Create foo-operator/watches.yaml +Create foo-operator/deploy/rbac.yaml +Create foo-operator/deploy/crd.yaml +Create foo-operator/deploy/cr.yaml +Create foo-operator/deploy/operator.yaml +Run git init ... +Initialized empty Git repository in /home/dymurray/go/src/github.com/dymurray/opsdk/foo-operator/.git/ +Run git init done + +$ cd foo-operator +``` + +Modify `roles/Foo/tasks/main.yml` with desired Ansible logic. For this example +we will create and delete a namespace with the switch of a variable: +```yaml +--- +- name: set test namespace to {{ state }} + k8s: + api_version: v1 + kind: Namespace + state: "{{ state }}" + ignore_errors: true +``` +**note**: Setting `ignore_errors: true` is done so that deleting a nonexistent +project doesn't error out. + +Modify `roles/Foo/defaults/main.yml` to set `state` to `present` by default. +```yaml +--- +state: present +``` + +Create an Ansible playbook `playbook.yaml` in the top-level directory which +includes role `Foo`: +```yaml +--- +- hosts: localhost + roles: + - Foo +``` + +Run the playbook: +```bash +$ ansible-playbook playbook.yaml + [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' + + +PLAY [localhost] *************************************************************************** + +TASK [Gathering Facts] ********************************************************************* +ok: [localhost] + +Task [Foo : set test namespace to present] +changed: [localhost] + +PLAY RECAP ********************************************************************************* +localhost : ok=2 changed=1 unreachable=0 failed=0 + +``` + +Check that the namespace was created: +```bash +$ kubectl get namespace +NAME STATUS AGE +default Active 28d +kube-public Active 28d +kube-system Active 28d +test Active 3s +``` + +Rerun the playbook setting `state` to `absent`: +```bash +$ ansible-playbook playbook.yml --extra-vars state=absent + [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' + + +PLAY [localhost] *************************************************************************** + +TASK [Gathering Facts] ********************************************************************* +ok: [localhost] + +Task [Foo : set test namespace to absent] +changed: [localhost] + +PLAY RECAP ********************************************************************************* +localhost : ok=2 changed=1 unreachable=0 failed=0 + +``` + +Check that the namespace was deleted: +```bash +$ kubectl get namespace +NAME STATUS AGE +default Active 28d +kube-public Active 28d +kube-system Active 28d +``` +## Using Ansible inside of an Operator +Now that we have demonstrated using the Ansible Kubernetes modules, we want to +trigger this Ansible logic when a custom resource changes. In the above +example, we want to map a role to a specific Kubernetes resource that the +operator will watch. This mapping is done in a file called `watches.yaml`. + +### Watches file + +The Operator expects a mapping file, which lists each GVK to watch and the +corresponding path to an Ansible role or playbook, to be copied into the +container at a predefined location: /opt/ansible/watches.yaml + +Dockerfile example: +```Dockerfile +COPY watches.yaml /opt/ansible/watches.yaml +``` + +The Watches file format is yaml and is an array of objects. The object has +mandatory fields: + +**version**: The version of the Custom Resource that you will be watching. + +**group**: The group of the Custom Resource that you will be watching. + +**kind**: The kind of the Custom Resource that you will be watching. + +**playbook**: This is the path to the playbook that you have added to the +container. This playbook is expected to be simply a way to call roles. This +field is mutually exclusive with the "role" field. + +**role**: This is the path to the role that you have added to the container. +For example if your roles directory is at `/opt/ansible/roles/` and your role +is named `busybox`, this value will be `/opt/ansible/roles/busybox`. This field +is mutually exclusive with the "playbook" field. + +Example specifying a role: + +```yaml +--- +- version: v1alpha1 + group: foo.example.com + kind: Foo + role: /opt/ansible/roles/Foo +``` + +#### Using playbooks in watches.yaml + +By default, `operator-sdk new --type ansible` sets `watches.yaml` to execute a +role directly on a resource event. This works well for new projects, but with a +lot of Ansible code this can be hard to scale if we are putting everything +inside of one role. Using a playbook allows the developer to have more +flexibility in consuming other roles and enabling more customized deployments +of their application. To do this, modify `watches.yaml` to use a playbook +instead of the role: +```yaml +--- +- version: v1alpha1 + group: foo.example.com + kind: Foo + playbook: /opt/ansible/playbook.yml +``` + +Modify `tmp/build/Dockerfile` to put `playbook.yml` in `/opt/ansible` in the +container in addition to the role (`/opt/ansible` is the `HOME` environment +variable inside of the Ansible Operator base image): +```Dockerfile +FROM quay.io/water-hole/ansible-operator + +COPY roles/ ${HOME}/roles +COPY playbook.yaml ${HOME}/playbook.yaml +COPY watches.yaml ${HOME}/watches.yaml +``` + +Alternatively, to generate a skeleton project with the above changes, a +developer can also do: +```bash +$ operator-sdk new --type ansible --kind Foo --api-version foo.example.com/v1alpha1 foo-operator --generate-playbook +``` + +### Custom Resource file + +The Custom Resource file format is Kubernetes resource file. The object has +mandatory fields: + +**apiVersion**: The version of the Custom Resource that will be created. + +**kind**: The kind of the Custom Resource that will be created + +**metadata**: Kubernetes specific metadata to be created + +**spec**: This is the key-value list of variables which are passed to Ansible. +This field is optional and will be empty by default. + +**annotations**: Kubernetes specific annotations to be appened to the CR. See +the below section for Ansible Operator specifc annotations. + +#### Ansible Operator annotations +This is the list of CR annotations which will modify the behavior of the operator: + +**ansible.operator-sdk/reconcile-period**: Used to specify the reconciliation +interval for the CR. This value is parsed using the standard Golang package +[time][time_pkg]. Specifically [ParseDuration][time_parse_duration] is used +which will apply the default suffix of `s` giving the value in seconds. + +Example: +``` +apiVersion: "foo.example.com/v1alpha1" +kind: "Foo" +metadata: + name: "example" +annotations: + ansible.operator-sdk/reconcile-period: "30s" +``` + +### Testing an Ansible operator locally + +Once a developer is comfortable working with the above workflow, it will be +beneficial to test the logic inside of an operator. To accomplish this, we can +use `operator-sdk up local` from the top-level directory of our project. The +`up local` command reads from `./watches.yaml` and uses `~/.kube/config` to +communicate with a kubernetes cluster just as the `k8s` modules do. This +section assumes the developer has read the [Ansible Operator user +guide][ansible_operator_user_guide] and has the proper dependencies installed. + +Since `up local` reads from `./watches.yaml`, there are a couple options +available to the developer. If `role` is left alone (by default +`/opt/ansible/roles/`) the developer must copy the role over to +`/opt/ansible/roles` from the operator directly. This is cumbersome because +changes will not be reflected from the current directory. It is recommended +that the developer instead change the `role` field to point to the current +directory and simply comment out the existing line: +```yaml +- version: v1alpha1 + group: foo.example.com + kind: Foo + # role: /opt/ansible/roles/Foo + role: /home/user/foo-operator/Foo +``` + +Create a Custom Resource Definiton (CRD) and proper Role-Based Access Control +(RBAC) definitions for resource Foo. `operator-sdk` autogenerates these files +inside of the `deploy` folder: +```bash +$ kubectl create -f deploy/crds/foo_v1alpha1_foo_crd.yaml +$ kubectl create -f deploy/service_account.yaml +$ kubectl create -f deploy/role.yaml +$ kubectl create -f deploy/role_binding.yaml +``` + +Run the `up local` command: +```bash +$ operator-sdk up local +INFO[0000] Go Version: go1.10.3 +INFO[0000] Go OS/Arch: linux/amd64 +INFO[0000] operator-sdk Version: 0.0.6+git +INFO[0000] Starting to serve on 127.0.0.1:8888 + +INFO[0000] Watching foo.example.com/v1alpha1, Foo, default +``` + +Now that the operator is watching resource `Foo` for events, the creation of a +Custom Resource will trigger our Ansible Role to be executed. Take a look at +`deploy/cr.yaml`: +```yaml +apiVersion: "foo.example.com/v1alpha1" +kind: "Foo" +metadata: + name: "example" +``` + +Since `spec` is not set, Ansible is invoked with no extra variables. The next +section covers how extra variables are passed from a Custom Resource to +Ansible. This is why it is important to set sane defaults for the operator. + +Create a Custom Resource instance of Foo with default var `state` set to +`present`: +```bash +$ kubectl create -f deploy/cr.yaml +``` + +Check that namespace `test` was created: +```bash +$ kubectl get namespace +NAME STATUS AGE +default Active 28d +kube-public Active 28d +kube-system Active 28d +test Active 3s +``` + +Modify `deploy/cr.yaml` to set `state` to `absent`: +```yaml +apiVersion: "foo.example.com/v1alpha1" +kind: "Foo" +metadata: + name: "example" +spec: + state: "absent" +``` + +Apply the changes to Kubernetes and confirm that the namespace is deleted: +```bash +$ kubectl apply -f deploy/cr.yaml +$ kubectl get namespace +NAME STATUS AGE +default Active 28d +kube-public Active 28d +kube-system Active 28d +``` + +### Testing an Ansible operator on a cluster + +Now that a developer is confident in the operator logic, testing the operator +inside of a pod on a Kubernetes cluster is desired. Running as a pod inside a +Kubernetes cluster is preferred for production use. + +To build the `foo-operator` image and push it to a registry: +``` +$ operator-sdk build quay.io/example/foo-operator:v0.0.1 +$ docker push quay.io/example/foo-operator:v0.0.1 +``` + +Kubernetes deployment manifests are generated in `deploy/operator.yaml`. The +deployment image in this file needs to be modified from the placeholder +`REPLACE_IMAGE` to the previous built image. To do this run: +``` +$ sed -i 's|REPLACE_IMAGE|quay.io/example/foo-operator:v0.0.1|g' deploy/operator.yaml +``` + +Deploy the foo-operator: + +```sh +$ kubectl create -f deploy/crds/foo_v1alpha1_foo_crd.yaml # if CRD doesn't exist already +$ kubectl create -f deploy/service_account.yaml +$ kubectl create -f deploy/role.yaml +$ kubectl create -f deploy/role_binding.yaml +$ kubectl create -f deploy/operator.yaml +``` + +Verify that the foo-operator is up and running: + +```sh +$ kubectl get deployment +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE +foo-operator 1 1 1 1 1m +``` + +## Extra vars sent to Ansible +The extra vars that are sent to Ansible are managed by the operator. The `spec` +section will pass along the key-value pairs as extra vars. This is equivalent +to how above extra vars are passed in to `ansible-playbook`. The operator also +passes along additional variables under the `meta` field for the name of the CR +and the namespace of the CR. + +For the CR example: +```yaml +apiVersion: "app.example.com/v1alpha1" +kind: "Database" +metadata: + name: "example" +spec: + message:"Hello world 2" + newParameter: "newParam" +``` + +The structure passed to Ansible as extra vars is: + + +```json +{ "meta": { + "name": "", + "namespace": "", + }, + "message": "Hello world 2", + "new_parameter": "newParam", + "_app_example_com_database": { + + }, +} +``` +`message` and `newParameter` are set in the top level as extra variables, and +`meta` provides the relevant metadata for the Custom Resource as defined in the +operator. The `meta` fields can be accesses via dot notation in Ansible as so: +```yaml +--- +- debug: + msg: "name: {{ meta.name }}, {{ meta.namespace }}" +``` + +[k8s_ansible_module]:https://docs.ansible.com/ansible/2.6/modules/k8s_module.html +[openshift_restclient_python]:https://github.com/openshift/openshift-restclient-python +[ansible_operator_user_guide]:../user-guide.md +[time_pkg]:https://golang.org/pkg/time/ +[time_parse_duration]:https://golang.org/pkg/time/#ParseDuration diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/ansible/project_layout.md b/vendor/github.com/operator-framework/operator-sdk/doc/ansible/project_layout.md index b16eddcab..3826905be 100644 --- a/vendor/github.com/operator-framework/operator-sdk/doc/ansible/project_layout.md +++ b/vendor/github.com/operator-framework/operator-sdk/doc/ansible/project_layout.md @@ -8,5 +8,5 @@ After creating a new operator project using | :--- | :--- | | deploy | Contains a generic set of kubernetes manifests for deploying this operator on a kubernetes cluster. | | roles/ | Contains an Ansible Role initialized using [Ansible Galaxy](https://docs.ansible.com/ansible/latest/reference_appendices/galaxy.html) | -| tmp | Contains scripts that the operator-sdk uses for build and initialization. | +| build | Contains scripts that the operator-sdk uses for build and initialization. | | watches.yaml | Contains Group, Version, Kind, and Ansible invocation method. | diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/ansible/user-guide.md b/vendor/github.com/operator-framework/operator-sdk/doc/ansible/user-guide.md index 112098c42..efb33ccef 100644 --- a/vendor/github.com/operator-framework/operator-sdk/doc/ansible/user-guide.md +++ b/vendor/github.com/operator-framework/operator-sdk/doc/ansible/user-guide.md @@ -42,8 +42,6 @@ This installs the CLI binary `operator-sdk` at `$GOPATH/bin`. Use the CLI to create a new Ansible-based memcached-operator project: ```sh -$ mkdir -p $GOPATH/src/github.com/example-inc/ -$ cd $GOPATH/src/github.com/example-inc/ $ operator-sdk new memcached-operator --api-version=cache.example.com/v1alpha1 --kind=Memcached --type=ansible $ cd memcached-operator ``` @@ -113,6 +111,9 @@ Defining the spec for an Ansible Operator can be done entirely in Ansible. The Ansible Operator will simply pass all key value pairs listed in the Custom Resource spec field along to Ansible as [variables](https://docs.ansible.com/ansible/2.5/user_guide/playbooks_variables.html#passing-variables-on-the-command-line). +The names of all variables in the spec field are converted to snake_case +by the operator before running ansible. For example, `serviceAccount` in +the spec becomes `service_account` in ansible. It is recommended that you perform some type validation in Ansible on the variables to ensure that your application is receiving expected input. @@ -179,7 +180,7 @@ resource definition the operator will be watching. Deploy the CRD: ```sh -$ kubectl create -f deploy/crd.yaml +$ kubectl create -f deploy/crds/cache_v1alpha1_memcached_crd.yaml ``` Once this is done, there are two ways to run the operator: @@ -207,7 +208,9 @@ $ sed -i 's|REPLACE_IMAGE|quay.io/example/memcached-operator:v0.0.1|g' deploy/op Deploy the memcached-operator: ```sh -$ kubectl create -f deploy/rbac.yaml +$ kubectl create -f deploy/service_account.yaml +$ kubectl create -f deploy/role.yaml +$ kubectl create -f deploy/role_binding.yaml $ kubectl create -f deploy/operator.yaml ``` @@ -268,7 +271,7 @@ metadata: spec: size: 3 -$ kubectl apply -f deploy/cr.yaml +$ kubectl apply -f deploy/crds/cache_v1alpha1_memcached_cr.yaml ``` Ensure that the memcached-operator creates the deployment for the CR: @@ -305,7 +308,7 @@ metadata: spec: size: 4 -$ kubectl apply -f deploy/cr.yaml +$ kubectl apply -f deploy/crds/cache_v1alpha1_memcached_cr.yaml ``` Confirm that the operator changes the deployment size: @@ -321,8 +324,12 @@ example-memcached 4 4 4 4 5m Clean up the resources: ```sh -$ kubectl delete -f deploy/cr.yaml +$ kubectl delete -f deploy/crds/cache_v1alpha1_memcached_cr.yaml $ kubectl delete -f deploy/operator.yaml +$ kubectl delete -f deploy/role_binding.yaml +$ kubectl delete -f deploy/role.yaml +$ kubectl delete -f deploy/service_account.yaml +$ kubectl delete -f deploy/crds/cache_v1alpha1_memcached_cr.yaml ``` [layout_doc]:./project_layout.md diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/dev/testing/end-to-end.md b/vendor/github.com/operator-framework/operator-sdk/doc/dev/testing/end-to-end.md index dcf14d840..e4d84f759 100644 --- a/vendor/github.com/operator-framework/operator-sdk/doc/dev/testing/end-to-end.md +++ b/vendor/github.com/operator-framework/operator-sdk/doc/dev/testing/end-to-end.md @@ -47,4 +47,4 @@ testing process, the cleanup functions will not run. To manually clean up a test 1. Delete the created project in $GOPATH/src/github.com/example-inc/memcached-operator 2. Delete the namespaces that the tests run in, which also deletes any resources created within the namespaces. The namespaces start with `memcached-memcached-group`. -3. Delete the CRD (`kubectl delete -f deploy/crd.yaml`). +3. Delete the CRD (`kubectl delete -f deploy/crds/cache_v1alpha1_memcached_crd.yaml`). diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/migration/v0.1.0-migration-guide.md b/vendor/github.com/operator-framework/operator-sdk/doc/migration/v0.1.0-migration-guide.md new file mode 100644 index 000000000..9f8fe3f2f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/doc/migration/v0.1.0-migration-guide.md @@ -0,0 +1,303 @@ +# Migration Guide from v0.0.x to v0.1.0 + +This document describes how to migrate an operator project built using Operator SDK `v0.0.x` to the project structure required by `v0.1.0`. + +The recommended way to migrate your project is to initialize a new `v0.1.0` project, then copy your code into the new project and modify as described below. + +This guide goes over migrating the memcached-operator, an example project from the user guide, to illustrate migration steps. See the [v0.0.7 memcached-operator][v0.0.7-memcached-operator] and [v0.1.0 memcached-operator][v0.1.0-memcached-operator] project structures for pre- and post-migration examples, respectively. + +## Create a new v0.1.0 project + +Rename your `v0.0.x` project and create a new `v0.1.0` project in its place. + +```sh +# Ensure SDK version is v0.1.0 +$ operator-sdk --version +operator-sdk version 0.1.0 + +# Create new project +$ cd $GOPATH/src/github.com/example-inc/ +$ mv memcached-operator old-memcached-operator +$ operator-sdk new memcached-operator +$ ls +memcached-operator old-memcached-operator + +# Copy over .git from old project +$ cp -rf old-memcached-operator/.git memcached-operator/.git +``` + +## Migrate custom types from pkg/apis + +### Scaffold api for custom types + +Create the api for your custom resource (CR) in the new project with `operator-sdk add api --api-version= --kind=` +```sh +$ cd memcached-operator +$ operator-sdk add api --api-version=cache.example.com/v1alpha1 --kind=Memcached + +$ tree pkg/apis +pkg/apis/ +├── addtoscheme_cache_v1alpha1.go +├── apis.go +└── cache + └── v1alpha1 + ├── doc.go + ├── memcached_types.go + ├── register.go + └── zz_generated.deepcopy.go +``` + +Repeat the above command for as many custom types as you had defined in your old project. Each type will be defined in the file `pkg/apis///_types.go`. + +### Copy the contents of the type + +Copy the `Spec` and `Status` contents of the `pkg/apis///types.go` file from the old project to the new project's `pkg/apis///_types.go` file. + +**Note:** Each `_types.go` file has an `init()` function. Be sure not to remove that since that registers the type with the Manager's scheme. +```Go +func init() { + SchemeBuilder.Register(&Memcached{}, &MemcachedList{}) +} +``` + +## Migrate reconcile code + +### Add a controller to watch your CR + +In a `v0.0.x` project you would define what resource to watch in `cmd//main.go` +```Go +sdk.Watch("cache.example.com/v1alpha1", "Memcached", "default", time.Duration(5)*time.Second) +``` + +For a `v0.1.0` project you define a [Controller][controller-go-doc] to watch resources. + +Add a controller to watch your CR type with `operator-sdk add controller --api-version= --kind=`. +``` +$ operator-sdk add controller --api-version=cache.example.com/v1alpha1 --kind=Memcached +$ tree pkg/controller +pkg/controller/ +├── add_memcached.go +├── controller.go +└── memcached + └── memcached_controller.go +``` + +Inspect the `add()` function in your `pkg/controller//_controller.go` file: +```Go +import ( + cachev1alpha1 "github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1" + ... +) + +func add(mgr manager.Manager, r reconcile.Reconciler) error { + c, err := controller.New("memcached-controller", mgr, controller.Options{Reconciler: r}) + + // Watch for changes to the primary resource Memcached + err = c.Watch(&source.Kind{Type: &cachev1alpha1.Memcached{}}, &handler.EnqueueRequestForObject{}) + + // Watch for changes to the secondary resource Pods and enqueue reconcile requests for the owner Memcached + err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{ + IsController: true, + OwnerType: &cachev1alpha1.Memcached{}, + }) +} +``` +Remove the second `Watch()` or modify it to watch a secondary resource type that is owned by your CR. + +Watching multiple resources lets you trigger the reconcile loop for multiple resources relevant to your application. See the [watching and eventhandling][watching-eventhandling-doc] doc and the Kubernetes [controller conventions][controller-conventions] doc for more details. + +#### Multiple custom resources + +If your operator is watching more than 1 CR type then you can do one of the following depending on your application: +- If the CR is owned by your primary CR then watch it as a secondary resource in the same controller to trigger the reconcile loop for the primary resource. + ```Go + // Watch for changes to the primary resource Memcached + err = c.Watch(&source.Kind{Type: &cachev1alpha1.Memcached{}}, &handler.EnqueueRequestForObject{}) + + // Watch for changes to the secondary resource AppService and enqueue reconcile requests for the owner Memcached + err = c.Watch(&source.Kind{Type: &appv1alpha1.AppService{}}, &handler.EnqueueRequestForOwner{ + IsController: true, + OwnerType: &cachev1alpha1.Memcached{}, + }) + ``` +- Add a new controller to watch and reconcile the CR independently of the other CR. + ```sh + $ operator-sdk add controller --api-version=app.example.com/v1alpha1 --kind=AppService + ``` + ```Go + // Watch for changes to the primary resource AppService + err = c.Watch(&source.Kind{Type: &appv1alpha1.AppService{}}, &handler.EnqueueRequestForObject{}) + ``` + +### Copy and modify reconcile code from pkg/stub/handler.go + +In a `v0.1.0` project the reconcile code is defined in the `Reconcile()` method of a controller's [Reconciler][reconciler-go-doc]. This is similar to the `Handle()` function in the older project. Note the difference in the arguments and return values: +- Reconcile + ```Go + func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Result, error) + ``` +- Handle + ```Go + func (h *Handler) Handle(ctx context.Context, event sdk.Event) error + ``` + +Instead of receiving an `sdk.Event` (with the object), the `Reconcile()` function receives a [Request][request-go-doc] (Name/Namespace key) to lookup the object. + +If the `Reconcile()` function returns an error, the controller will requeue and retry the `Request`. If no error is returned, then depending on the [Result][result-go-doc] the controller will either not retry the `Request`, immediately retry, or retry after a specified duration. + +Copy the code from the old project's `Handle()` function over the existing code in your controller's `Reconcile()` function. +Be sure to keep the initial section in the `Reconcile()` code that looks up the object for the `Request` and checks to see if it's deleted. + +```Go +import ( + apierrors "k8s.io/apimachinery/pkg/api/errors" + cachev1alpha1 "github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1" + ... +) +func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Result, error) { + // Fetch the Memcached instance + instance := &cachev1alpha1.Memcached{} + err := r.client.Get(context.TODO() + request.NamespacedName, instance) + if err != nil { + if apierrors.IsNotFound(err) { + // Request object not found, could have been deleted after reconcile request. + // Owned objects are automatically garbage collected. + // Return and don't requeue + return reconcile.Result{}, nil + } + // Error reading the object - requeue the request. + return reconcile.Result{}, err + } + + // Rest of your reconcile code goes here. + ... +} +``` +#### Update return values + +Change the return values in your reconcile code: +- Replace `return err` with `return reconcile.Result{}, err` +- Replace `return nil` with `return reconcile.Result{}, nil` + +#### Periodic reconcile +In order to periodically reconcile a CR in your controller you can set the [RequeueAfter][result-go-doc] field for reconcile.Result. +This will cause the controller to requeue the `Request` and trigger the reconcile after the desired duration. Note that the default value of 0 means no requeue. + +```Go +reconcilePeriod := 30 * time.Second +reconcileResult := reconcile.Result{RequeueAfter: reconcilePeriod} +... + +// Update the status +err := r.client.Update(context.TODO(), memcached) +if err != nil { + log.Printf("failed to update memcached status: %v", err) + return reconcileResult, err +} +return reconcileResult, nil + +``` + +#### Update client + +Replace the calls to the SDK client(Create, Update, Delete, Get, List) with the reconciler's client. + +See the examples below and the controller-runtime [client API doc][client-api-doc] for more details. + +```Go +// Create +dep := &appsv1.Deployment{...} +err := sdk.Create(dep) +// v0.0.1 +err := r.client.Create(context.TODO(), dep) + +// Update +err := sdk.Update(dep) +// v0.0.1 +err := r.client.Update(context.TODO(), dep) + +// Delete +err := sdk.Delete(dep) +// v0.0.1 +err := r.client.Delete(context.TODO(), dep) + +// List +podList := &corev1.PodList{} +labelSelector := labels.SelectorFromSet(labelsForMemcached(memcached.Name)) +listOps := &metav1.ListOptions{LabelSelector: labelSelector} +err := sdk.List(memcached.Namespace, podList, sdk.WithListOptions(listOps)) +// v0.1.0 +listOps := &client.ListOptions{Namespace: memcached.Namespace, LabelSelector: labelSelector} +err := r.client.List(context.TODO(), listOps, podList) + +// Get +dep := &appsv1.Deployment{APIVersion: "apps/v1", Kind: "Deployment", Name: name, Namespace: namespace} +err := sdk.Get(dep) +// v0.1.0 +dep := &appsv1.Deployment{} +err = r.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: namespace}, dep) +``` + +Lastly copy and initialize any other fields that you may have had in your `Handler` struct into the `Reconcile` struct: + +```Go +// newReconciler returns a new reconcile.Reconciler +func newReconciler(mgr manager.Manager) reconcile.Reconciler { + return &ReconcileMemcached{client: mgr.GetClient(), scheme: mgr.GetScheme(), foo: "bar"} +} + +// ReconcileMemcached reconciles a Memcached object +type ReconcileMemcached struct { + client client.Client + scheme *runtime.Scheme + // Other fields + foo string +} +``` + +### Copy changes from main.go + +The main function for a `v0.1.0` operator in `cmd/manager/main.go` sets up the [Manager][manager-go-doc] which registers the custom resources and starts all the controllers. + +There is no need to migrate the SDK functions `sdk.Watch()`,`sdk.Handle()`, and `sdk.Run()` from the old `main.go` since that logic is now defined in a controller. + +However if there are any operator specific flags or settings defined in the old main file copy those over. + +If you have any 3rd party resource types registered with the SDK's scheme, then register those with the Manager's scheme in the new project. See how to [register 3rd party resources][register-3rd-party-resources]. + +### Copy user defined files + +If there are any user defined pkgs, scripts, and docs in the older project, copy these files into the new project. + +### Copy changes to deployment manifests + +For any updates made to the following manifests in the old project, copy over the changes to their corresponding files in the new project. Be careful not to directly overwrite the files but inspect and make any changes necessary. +- `tmp/build/Dockerfile` to `build/Dockerfile` + - There is no tmp directory in the new project layout +- RBAC rules updates from `deploy/rbac.yaml` to `deploy/role.yaml` and `deploy/role_binding.yaml` +- `deploy/cr.yaml` to `deploy/crds/___cr.yaml` +- `deploy/crd.yaml` to `deploy/crds/___crd.yaml` + +### Copy user defined dependencies + +For any user defined dependencies added to the old project's Gopkg.toml, copy and append them to the new project's Gopkg.toml. +Run `dep ensure` to update the vendor in the new project. + +### Confirmation + +At this point you should be able to build and run your operator to verify that it works. See the [user-guide][user-guide-build-run] on how to build and run your operator. + +[v0.1.0-changes-doc]: ./v0.1.0-changes.md +[v0.0.7-memcached-operator]: https://github.com/operator-framework/operator-sdk-samples/tree/aa15bd278eec0959595e0a0a7282a26055d7f9d6/memcached-operator +[v0.1.0-memcached-operator]: https://github.com/operator-framework/operator-sdk-samples/tree/4c6934448684a6953ece4d3d9f3f77494b1c125e/memcached-operator +[controller-conventions]: https://github.com/kubernetes/community/blob/master/contributors/devel/controllers.md#guidelines +[reconciler-go-doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/reconcile#Reconciler +[watching-eventhandling-doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg#hdr-Watching_and_EventHandling +[controller-go-doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg#hdr-Controller +[request-go-doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/reconcile#Request +[result-go-doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/reconcile#Result +[client-api-doc]: ./../user/client.md +[manager-go-doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/manager +[register-3rd-party-resources]: ./../user-guide.md#adding-3rd-party-resources-to-your-operator +[user-guide-build-run]: ./../user-guide.md#build-and-run-the-operator diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/project_layout.md b/vendor/github.com/operator-framework/operator-sdk/doc/project_layout.md index 031f1c827..e4f6a1c7c 100644 --- a/vendor/github.com/operator-framework/operator-sdk/doc/project_layout.md +++ b/vendor/github.com/operator-framework/operator-sdk/doc/project_layout.md @@ -1,19 +1,18 @@ # Project Scaffolding Layout -After creating a new operator project using -`operator-sdk new`, the project directory has numerous generated folders and files. The following table describes a basic rundown of each generated file/directory. +The `operator-sdk` CLI generates a number of packages for each project. The following table describes a basic rundown of each generated file/directory. | File/Folders | Purpose | | :--- | :--- | +| cmd | Contains `manager/main.go` which is the main program of the operator. This instantiates a new manager which registers all custom resource definitions under `pkg/apis/...` and starts all controllers under `pkg/controllers/...` . | +| pkg/apis | Contains the directory tree that defines the APIs of the Custom Resource Definitions(CRD). Users are expected to edit the `pkg/apis///_types.go` files to define the API for each resource type and import these packages in their controllers to watch for these resource types.| +| pkg/controller | This pkg contains the controller implementations. Users are expected to edit the `pkg/controller//_controller.go` to define the controller's reconcile logic for handling a resource type of the specified `kind`. | +| build | Contains the `Dockerfile` and build scripts used to build the operator. | +| deploy | Contains various YAML manifests for registering CRDs, setting up [RBAC][RBAC], and deploying the operator as a Deployment. | Gopkg.toml Gopkg.lock | The [Go Dep][dep] manifests that describe the external dependencies of this operator. | -| cmd | Contains `main.go` which is the entry point to initialize and start this operator using the operator-sdk APIs. | -| config | Contains metadata about state of this project such as project name, kind, api-version, and so forth. The operator-sdk commands use this metadata to perform actions that require knowing the state. | -| deploy | Contains a generic set of kubernetes manifests for deploying this operator on a kubernetes cluster. | -| pkg/apis | Contains the directory tree that defines the APIs and types of Custom Resource Definitions(CRD). These files allow the sdk to do code generation for CRD types and register the schemes for all types in order to correctly decode Custom Resource objects. | -| pkg/stub | Contains `handler.go` which is the place for a user to write all the operating business logic. | -| tmp | Contains scripts that the operator-sdk uses for build and code generation. | | vendor | The golang [vendor][Vendor] folder that contains the local copies of the external dependencies that satisfy the imports of this project. [Go Dep][dep] manages the vendor directly. | +[RBAC]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/ [Vendor]: https://golang.org/cmd/go/#hdr-Vendor_Directories [dep]: https://github.com/golang/dep diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/release-versioning.md b/vendor/github.com/operator-framework/operator-sdk/doc/release-versioning.md index 58bbb61ed..5da0fda65 100644 --- a/vendor/github.com/operator-framework/operator-sdk/doc/release-versioning.md +++ b/vendor/github.com/operator-framework/operator-sdk/doc/release-versioning.md @@ -24,8 +24,8 @@ Minor version changes will not break compatibility between the previous minor ve We expect to release patches for minor releases, so we create a patch trunk to branch from. The naming convention follows "v2.1.x", where the major version is 2, minor is 1, and "x" is a patch version placeholder. ```bash -$ MAV_MIN_VER="v${MAJOR_VERSION}.${NEW_MINOR_VERSION}" -$ git checkout -b "${MAJ_MIN_VER}.x" tags/"v${MAJ_MIN_VER}.0" +$ export MAJ_MIN_VER="${MAJOR_VERSION}.${NEW_MINOR_VERSION}" +$ git checkout -b "v${MAJ_MIN_VER}.x" tags/"v${MAJ_MIN_VER}.0" $ git push git@github.com:operator-framework/operator-sdk.git "v${MAJ_MIN_VER}.x" ``` @@ -116,9 +116,64 @@ Patch releases should have the following format: ... ``` +# Release Signing + +When a new release is created, the tag for the commit it signed with a maintainer's gpg key and +the binaries for the release are also signed by the same key. All keys used by maintainers will +be available via public gpg keyservers such as [pgp.mit.edu][mit-keyserver]. To verify a git +tag signature, use this command: + +```sh +$ git verify-tag --verbose ${TAG_NAME} +``` + +To verify a release binary using the provided asc files, place the binary and corresponding asc +file into the same directory and use the corresponding command: + +```sh +# macOS +$ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin.asc +# GNU/Linux +$ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu.asc +``` + +If you do not have the maintainers public key on your machine, you will get an error message similar +to this: + +```sh +$ git verify-tag ${TAG_NAME} +gpg: Signature made Wed 31 Oct 2018 02:57:31 PM PDT +gpg: using RSA key 4AEE18F83AFDEB23 +gpg: Can't check signature: public key not found +``` + +To download the key, use this command, replacing `${KEY_ID}` with the RSA key string provided in the output +of the previous command: + +```sh +$ gpg --recv-key ${KEY_ID} +``` + +Now you should be able to verify the tags and/or binaries + +## For maintainers +For new maintainers who have not done a release and do not have their gpg key on a public +keyserver, you must add your public key to a keyserver. To do this, output your armored +public key using this command: + +```sh +$ gpg --armor --export ${GPG_EMAIL} > mykey.asc +``` + +Then, copy and paste the content of the outputted file into the `Submit a key` section on +the [MIT PGP Public Key Server][mit-keyserver] or any other public keyserver that forwards +the key to other public keyservers. Once that is done, other people can download your public +key and you are ready to sign releases. + [link-semver]:https://semver.org/ [link-github-milestones]: https://help.github.com/articles/about-milestones/ [doc-maintainers]:../MAINTAINERS [link-github-gpg-key-upload]:https://github.com/settings/keys [link-git-config-gpg-key]:https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work -[doc-kube-version]:https://github.com/operator-framework/operator-sdk#prerequisites \ No newline at end of file +[doc-kube-version]:https://github.com/operator-framework/operator-sdk#prerequisites +[mit-keyserver]:https://pgp.mit.edu \ No newline at end of file diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/sdk-cli-reference.md b/vendor/github.com/operator-framework/operator-sdk/doc/sdk-cli-reference.md index c46e4c10d..368eb1ace 100644 --- a/vendor/github.com/operator-framework/operator-sdk/doc/sdk-cli-reference.md +++ b/vendor/github.com/operator-framework/operator-sdk/doc/sdk-cli-reference.md @@ -90,100 +90,125 @@ operator-sdk completion bash ## generate -### Available Commands - -#### k8s - Generates Kubernetes code for custom resource +### k8s -##### Use +Runs the Kubernetes [code-generators][k8s-code-generator] for all Custom Resource Definitions (CRD) apis under `pkg/apis/...`. +Currently only runs `deepcopy-gen` to generate the required `DeepCopy()` functions for all custom resource types. -k8s generator generates code for custom resource given the API spec -to comply with kube-API requirements. +**Note**: This command must be run every time the api (spec and status) for a custom resource type is updated. -##### Flags - -* `-h, --help` - help for k8s - -##### Example +#### Example ```bash -operator-sdk generate k8s - -# Output: -Run code-generation for custom resources +$ tree pkg/apis/app/v1alpha1/ +pkg/apis/app/v1alpha1/ +├── appservice_types.go +├── doc.go +├── register.go + +$ operator-sdk generate k8s +Running code-generation for custom resource group versions: [app:v1alpha1] Generating deepcopy funcs + +$ tree pkg/apis/app/v1alpha1/ +pkg/apis/app/v1alpha1/ +├── appservice_types.go +├── doc.go +├── register.go +└── zz_generated.deepcopy.go ``` -#### crd - Generates a custom resource definition (CRD) and the custom resource (CR) files +## new -##### Use +Scaffolds a new operator project. -crd generator generates custom resource definition and custom resource -files for the specified api-version and kind. +### Args -##### Flags +* `project-name` - name of the new project -* `--api-version` **(required)** string - Kubernetes apiVersion and has a format of $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1) -* `-h, --help` - help for k8s -* `--kind` **(required)** string - Kubernetes CustomResourceDefinition kind. (e.g AppService) +### Flags -##### Example +* `--skip-git-init` Do not init the directory as a git repository +* `--type` Type of operator to initialize: "ansible" or "go" (default "go"). Also requires the following flags if `--type=ansible` + * `--api-version` CRD APIVersion in the format `$GROUP_NAME/$VERSION` (e.g app.example.com/v1alpha1) + * `--kind` CRD Kind. (e.g AppService) +* `-h, --help` - help for new + +### Example + +Go project: ```bash -operator-sdk generate crd --api-version app.example.com/v1alpha1 --kind AppService +mkdir $GOPATH/src/github.com/example.com/ +cd $GOPATH/src/github.com/example.com/ +operator-sdk new app-operator +``` -# Output: -Generating custom resource definition (CRD) file -Create /deploy/appservice_cr.yaml -Create /deploy/appservice_crd.yaml +Ansible project: +```bash +operator-sdk new app-operator --type=ansible --api-version=app.example.com/v1alpha1 --kind=AppService ``` -#### olm-catalog - Generates OLM Catalog manifests -##### Flags +## add -* `--image` **(required)** string - The container image name to set in the CSV to deploy the operator e.g: quay.io/example/operator:v0.0.1 -* `--version` **(required)** string - The version of the current CSV e.g: 0.0.1 -* `-h, --help` - help for olm-catalog +### api -##### Example +Adds the +api definition for a new custom resource under `pkg/apis` and generates the CRD and CR files under `depoy/crds/...`. -```bash -operator-sdk generate olm-catalog --image=quay.io/example/operator:v0.0.1 --version=0.0.1 +#### Flags -# Output: -Generating OLM catalog manifests +* `--api-version` CRD APIVersion in the format `$GROUP_NAME/$VERSION` (e.g app.example.com/v1alpha1) +* `--kind` CRD Kind. (e.g AppService) + +#### Example + +```bash +$ operator-sdk add api --api-version app.example.com/v1alpha1 --kind AppService +Create pkg/apis/app/v1alpha1/appservice_types.go +Create pkg/apis/addtoscheme_app_v1alpha1.go +Create pkg/apis/app/v1alpha1/register.go +Create pkg/apis/app/v1alpha1/doc.go +Create deploy/crds/app_v1alpha1_appservice_cr.yaml +Create deploy/crds/app_v1alpha1_appservice_crd.yaml +Running code-generation for custom resource group versions: [app:v1alpha1] +Generating deepcopy funcs ``` -### Flags +### controller -* `-h, --help` - help for generate +Adds a new +controller under `pkg/controller//...` that, by default, reconciles a custom resource for the specified apiversion and kind. -## new +#### Flags -The operator-sdk new command creates a new operator application and -generates a default directory layout based on the input `project-name`. +* `--api-version` CRD APIVersion in the format `$GROUP_NAME/$VERSION` (e.g app.example.com/v1alpha1) +* `--kind` CRD Kind. (e.g AppService) -### Args +#### Example -* `project-name` - the project name of the new +```bash +$ operator-sdk add controller --api-version app.example.com/v1alpha1 --kind AppService +Create pkg/controller/appservice/appservice_controller.go +Create pkg/controller/add_appservice.go +``` -### Flags +### crd -* `--api-version` **(required)** string - Kubernetes apiVersion and has a format of `$GROUP_NAME/$VERSION` (e.g app.example.com/v1alpha1) -* `--kind` **(required)** string - Kubernetes CustomResourceDefintion kind. (e.g AppService) -* `--skip-git-init` Do not init the directory as a git repository -* `--type` Type of operator to initialize (e.g "ansible") (default "go") -* `-h, --help` - help for new +Generates the CRD and the CR files for the specified api-version and kind. -### Example +#### Flags -```bash -mkdir $GOPATH/src/github.com/example.com/ -cd $GOPATH/src/github.com/example.com/ -operator-sdk new app-operator --api-version=app.example.com/v1alpha1 --kind=AppService +* `--api-version` CRD APIVersion in the format `$GROUP_NAME/$VERSION` (e.g app.example.com/v1alpha1) +* `--kind` CRD Kind. (e.g AppService) -# Output: -Create app-operator/.gitignore -... +#### Example + +```bash +$ operator-sdk add crd --api-version app.example.com/v1alpha1 --kind AppService +Generating custom resource definition (CRD) files +Create deploy/crds/app_v1alpha1_appservice_crd.yaml +Create deploy/crds/app_v1alpha1_appservice_cr.yaml ``` ## test @@ -199,7 +224,7 @@ Runs the tests locally ##### Flags * `--kubeconfig` string - location of kubeconfig for kubernetes cluster (default "~/.kube/config") * `--global-manifest` string - path to manifest for global resources (default "deploy/crd.yaml) -* `--namespaced-manifest` string - path to manifest for per-test, namespaced resources (default: combines deploy/sa.yaml, deploy/rbac.yaml, and deploy/operator.yaml) +* `--namespaced-manifest` string - path to manifest for per-test, namespaced resources (default: combines deploy/service_account.yaml, deploy/rbac.yaml, and deploy/operator.yaml) * `--namespace` string - if non-empty, single namespace to run tests in (e.g. "operator-test") (default: "") * `--go-test-flags` string - extra arguments to pass to `go test` (e.g. -f "-v -parallel=2") * `-h, --help` - help for local @@ -293,3 +318,4 @@ operator-sdk up local --namespace "testing" * `-h, --help` - help for up [utility_link]: https://github.com/operator-framework/operator-sdk/blob/89bf021063d18b6769bdc551ed08fc37027939d5/pkg/util/k8sutil/k8sutil.go#L140 +[k8s-code-generator]: https://github.com/kubernetes/code-generator diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/test-framework/writing-e2e-tests.md b/vendor/github.com/operator-framework/operator-sdk/doc/test-framework/writing-e2e-tests.md index 187cdf197..28d0f90a3 100644 --- a/vendor/github.com/operator-framework/operator-sdk/doc/test-framework/writing-e2e-tests.md +++ b/vendor/github.com/operator-framework/operator-sdk/doc/test-framework/writing-e2e-tests.md @@ -224,7 +224,7 @@ functions will automatically be run since they were deferred when the TestCtx wa To make running the tests simpler, the `operator-sdk` CLI tool has a `test` subcommand that can configure default test settings, such as locations of your global resource manifest file (by default -`deploy/crd.yaml`) and your namespaced resource manifest file (by default `deploy/sa.yaml` concatenated with +`deploy/crd.yaml`) and your namespaced resource manifest file (by default `deploy/service_account.yaml` concatenated with `deploy/rbac.yaml` and `deploy/operator.yaml`), and allows the user to configure runtime options. There are 2 ways to use the subcommand: local and cluster. ### Local @@ -249,8 +249,8 @@ in [MainEntry][main-entry-link] are declared, the tests will run correctly. Runn will result in undefined behavior. This is an example `go test` equivalent to the `operator-sdk test local` example above: ```shell -# Combine sa, rbac, operator manifest into namespaced manifest -$ cp deploy/sa.yaml deploy/namespace-init.yaml +# Combine service_account, rbac, operator manifest into namespaced manifest +$ cp deploy/service_account.yaml deploy/namespace-init.yaml $ echo -e "\n---\n" >> deploy/namespace-init.yaml $ cat deploy/rbac.yaml >> deploy/namespace-init.yaml $ echo -e "\n---\n" >> deploy/namespace-init.yaml @@ -277,16 +277,17 @@ Once the image is ready, the tests are ready to be run. To run the tests, make s and a namespace with proper rbac configured: ```shell -$ kubectl create -f deploy/crd.yaml +$ kubectl create -f deploy/crds/cache_v1alpha1_memcached_crd.yaml $ kubectl create namespace memcached-test -$ kubectl create -f deploy/sa.yaml -n memcached-test -$ kubectl create -f deploy/rbac.yaml -n memcached-test +$ kubectl create -f deploy/service_account.yaml -n memcached-test +$ kubectl create -f deploy/role.yaml -n memcached-test +$ kubectl create -f deploy/role_binding.yaml -n memcached-test ``` Once you have your environment properly configured, you can start the tests using the `operator-sdk test cluster` command: ```shell -$ operator-sdk test cluster quay.io/example/memcached-operator:v0.0.1 --namespace memcached-test +$ operator-sdk test cluster quay.io/example/memcached-operator:v0.0.1 --namespace memcached-test --service-account memcached-operator Example Output: Test Successfully Completed @@ -328,7 +329,7 @@ $ kubectl delete namespace main-153428703 Since the CRD is not namespaced, it must be deleted separately. Clean up the CRD created by the tests using the CRD manifest `deploy/crd.yaml`: ```shell -$ kubectl delete -f deploy/crd.yaml +$ kubectl delete -f deploy/crds/cache_v1alpha1_memcached_crd.yaml ``` [memcached-sample]:https://github.com/operator-framework/operator-sdk-samples/tree/master/memcached-operator diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/user-guide.md b/vendor/github.com/operator-framework/operator-sdk/doc/user-guide.md index 0d6000616..2ee7c6f11 100644 --- a/vendor/github.com/operator-framework/operator-sdk/doc/user-guide.md +++ b/vendor/github.com/operator-framework/operator-sdk/doc/user-guide.md @@ -1,7 +1,6 @@ # User Guide -This guide walks through an example of building a simple memcached-operator using tools and libraries provided by the Operator SDK. - +This guide walks through an example of building a simple memcached-operator using the operator-sdk CLI tool and controller-runtime library API. To learn how to use Ansible to create a Memcached operator, see [Ansible Operator User Guide][ansible_user_guide]. The rest of this document will show how to program an operator in Go. @@ -12,8 +11,8 @@ how to program an operator in Go. - [git][git_tool] - [go][go_tool] version v1.10+. - [docker][docker_tool] version 17.03+. -- [kubectl][kubectl_tool] version v1.9.0+. -- Access to a kubernetes v.1.9.0+ cluster. +- [kubectl][kubectl_tool] version v1.11.0+. +- Access to a kubernetes v.1.11.0+ cluster. **Note**: This guide uses [minikube][minikube_tool] version v0.25.0+ as the local kubernetes cluster and quay.io for the public registry. @@ -42,52 +41,39 @@ Use the CLI to create a new memcached-operator project: ```sh $ mkdir -p $GOPATH/src/github.com/example-inc/ $ cd $GOPATH/src/github.com/example-inc/ -$ operator-sdk new memcached-operator --api-version=cache.example.com/v1alpha1 --kind=Memcached +$ operator-sdk new memcached-operator $ cd memcached-operator ``` -This creates the memcached-operator project specifically for watching the Memcached resource with APIVersion `cache.example.com/v1apha1` and Kind `Memcached`. - -To learn more about the project directory structure, see [project layout][layout_doc] doc. - -## Customize the operator logic - -For this example the memcached-operator will execute the following reconciliation logic for each `Memcached` CR: -- Create a memcached Deployment if it doesn't exist -- Ensure that the Deployment size is the same as specified by the `Memcached` CR spec -- Update the `Memcached` CR status with the names of the memcached pods +To learn about the project directory structure, see [project layout][layout_doc] doc. -### Watch the Memcached CR +### Manager +The main program for the operator `cmd/manager/main.go` initializes and runs the [Manager][manager_go_doc]. -By default, the memcached-operator watches `Memcached` resource events as shown in `cmd/memcached-operator/main.go`. +The Manager will automatically register the scheme for all custom resources defined under `pkg/apis/...` and run all controllers under `pkg/controller/...`. +The Manager can restrict the namespace that all controllers will watch for resources: ```Go -func main() { - sdk.Watch("cache.example.com/v1alpha1", "Memcached", "default", time.Duration(5)*time.Second) - sdk.Handle(stub.NewHandler()) - sdk.Run(context.TODO()) -} +mgr, err := manager.New(cfg, manager.Options{Namespace: namespace}) ``` - -#### Options -**Worker Count** -The number of concurrent informer workers can be configured with an additional Watch option. The default value is 1 if an argument is not given. +By default this will be the namespace that the operator is running in. To watch all namespaces leave the namespace option empty: ```Go -sdk.Watch("cache.example.com/v1alpha1", "Memcached", "default", time.Duration(5)*time.Second, sdk.WithNumWorkers(n)) +mgr, err := manager.New(cfg, manager.Options{Namespace: ""}) ``` -**Label Selector** -Label selectors allow the watch to filter resources by kubernetes labels. It can be specified using the standard kubernetes label selector format: +## Add a new Custom Resource Definition -https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors +Add a new Custom Resource Definition(CRD) API called Memcached, with APIVersion `cache.example.com/v1apha1` and Kind `Memcached`. -```Go -sdk.Watch("cache.example.com/v1alpha1", "Memcached", "default", time.Duration(5)*time.Second, sdk.WithLabelSelector("app=myapp")) +```sh +$ operator-sdk add api --api-version=cache.example.com/v1alpha1 --kind=Memcached ``` -### Define the Memcached spec and status +This will scaffold the Memcached resource API under `pkg/apis/cache/v1alpha1/...`. -Modify the spec and status of the `Memcached` CR at `pkg/apis/cache/v1alpha1/types.go`: +### Define the spec and status + +Modify the spec and status of the `Memcached` Custom Resource(CR) at `pkg/apis/cache/v1alpha1/memcached_types.go`: ```Go type MemcachedSpec struct { @@ -99,38 +85,106 @@ type MemcachedStatus struct { Nodes []string `json:"nodes"` } ``` -Update the generated code for the CR: + +After modifying the `*_types.go` file always run the following command to update the generated code for that resource type: ```sh $ operator-sdk generate k8s ``` -### Define the Handler +## Add a new Controller + +Add a new [Controller][controller-go-doc] to the project that will watch and reconcile the Memcached resource: + +```sh +$ operator-sdk add controller --api-version=cache.example.com/v1alpha1 --kind=Memcached +``` + +This will scaffold a new Controller implementation under `pkg/controller/memcached/...`. + +For this example replace the generated Controller file `pkg/controller/memcached/memcached_controller.go` with the example [`memcached_controller.go`][memcached_controller] implementation. + +The example Controller executes the following reconciliation logic for each `Memcached` CR: +- Create a memcached Deployment if it doesn't exist +- Ensure that the Deployment size is the same as specified by the `Memcached` CR spec +- Update the `Memcached` CR status with the names of the memcached pods + +The next two subsections explain how the Controller watches resources and how the reconcile loop is triggered. Skip to the [Build](#build-and-run-the-operator) section to see how to build and run the operator. + +### Resources watched by the Controller + +Inspect the Controller implementation at `pkg/controller/memcached/memcached_controller.go` to see how the Controller watches resources. + +The first watch is for the Memcached type as the primary resource. For each Add/Update/Delete event the reconcile loop will be sent a reconcile `Request` (a namespace/name key) for that Memcached object: -The reconciliation loop for an event is defined in the `Handle()` function at `pkg/stub/handler.go`. +```Go +err := c.Watch( + &source.Kind{Type: &cachev1alpha1.Memcached{}}, &handler.EnqueueRequestForObject{}) +``` -Replace the default handler with the reference [memcached handler][memcached_handler] implementation. +The next watch is for Deployments but the event handler will map each event to a reconcile `Request` for the owner of the Deployment. Which in this case is the Memcached object for which the Deployment was created. This allows the controller to watch Deployments as a secondary resource. -> Note: The provided handler implementation is only meant to demonstrate the use of the SDK APIs and is not representative of the best practices of a reconciliation loop. +```Go +err := c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{ + IsController: true, + OwnerType: &cachev1alpha1.Memcached{}, + }) +``` -### Build and run the operator +**// TODO:** Doc on eventhandler, arbitrary mapping between watched and reconciled resource. -Before running the operator, Kubernetes needs to know about the new custom resource definition the operator will be watching. +**// TODO:** Doc on configuring a Controller: number of workers, predicates, watching channels, -Deploy the CRD: +### Reconcile loop + +Every Controller has a Reconciler object with a `Reconcile()` method that implements the reconcile loop. The reconcile loop is passed the [`Request`][request-go-doc] argument which is a Namespace/Name key used to lookup the primary resource object, Memcached, from the cache: + +```Go +func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Result, error) { + // Lookup the Memcached instance for this reconcile request + memcached := &cachev1alpha1.Memcached{} + err := r.client.Get(context.TODO(), request.NamespacedName, memcached) + ... +} +``` + +Based on the return values, [`Result`][result_go_doc] and error, the `Request` may be requeued and the reconcile loop may be triggered again: + +```Go +// Reconcile successful - don't requeue +return reconcile.Result{}, nil +// Reconcile failed due to error - requeue +return reconcile.Result{}, err +// Requeue for any reason other than error +return reconcile.Result{Requeue: true}, nil +``` + +You can set the `Result.RequeueAfter` to requeue the `Request` after a grace period as well: +```Go +import "time" + +// Reconcile for any reason than error after 5 seconds +return reconcile.Result{RequeueAfter: time.Second*5}, nil +``` + +**Note:** Returning `Result` with `RequeueAfter` set is how you can periodically reconcile a CR. + +For a guide on Reconcilers, Clients, and interacting with resource Events, see the [Client API doc][doc_client_api]. + +## Build and run the operator + +Before running the operator, the CRD must be registered with the Kubernetes apiserver: ```sh -$ kubectl create -f deploy/crd.yaml +$ kubectl create -f deploy/crds/cache_v1alpha1_memcached_crd.yaml ``` Once this is done, there are two ways to run the operator: -- As pod inside Kubernetes cluster -- As go program outside cluster +- As a Deployment inside a Kubernetes cluster +- As Go program outside a cluster -#### 1. Run as pod inside a Kubernetes cluster - -Run as pod inside a Kubernetes cluster is preferred for production use. +### 1. Run as a Deployment inside the cluster Build the memcached-operator image and push it to a registry: ``` @@ -139,13 +193,14 @@ $ sed -i 's|REPLACE_IMAGE|quay.io/example/memcached-operator:v0.0.1|g' deploy/op $ docker push quay.io/example/memcached-operator:v0.0.1 ``` -Kubernetes deployment manifests are generated in `deploy/operator.yaml`. The deployment image is set to the container image specified above. +The Deployment manifest is generated at `deploy/operator.yaml`. Be sure to update the deployment image as shown above since the default is just a placeholder. -Deploy the memcached-operator: +Setup RBAC and deploy the memcached-operator: ```sh -$ kubectl create -f deploy/sa.yaml -$ kubectl create -f deploy/rbac.yaml +$ kubectl create -f deploy/service_account.yaml +$ kubectl create -f deploy/role.yaml +$ kubectl create -f deploy/role_binding.yaml $ kubectl create -f deploy/operator.yaml ``` @@ -157,7 +212,7 @@ NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE memcached-operator 1 1 1 1 1m ``` -#### 2. Run outside the cluster +### 2. Run locally outside the cluster This method is preferred during development cycle to deploy and test faster. @@ -170,27 +225,22 @@ export OPERATOR_NAME=memcached-operator Run the operator locally with the default kubernetes config file present at `$HOME/.kube/config`: ```sh -$ operator-sdk up local -INFO[0000] Go Version: go1.10 -INFO[0000] Go OS/Arch: darwin/amd64 -INFO[0000] operator-sdk Version: 0.0.5+git +$ operator-sdk up local --namespace=default +2018/09/30 23:10:11 Go Version: go1.10.2 +2018/09/30 23:10:11 Go OS/Arch: darwin/amd64 +2018/09/30 23:10:11 operator-sdk Version: 0.0.6+git +2018/09/30 23:10:12 Registering Components. +2018/09/30 23:10:12 Starting the Cmd. ``` -Run the operator locally with a provided kubernetes config file: - -```sh -$ operator-sdk up local --kubeconfig=config -INFO[0000] Go Version: go1.10 -INFO[0000] Go OS/Arch: darwin/amd64 -INFO[0000] operator-sdk Version: 0.0.5+git -``` +You can use a specific kubeconfig via the flag `--kubeconfig=`. -### Create a Memcached CR +## Create a Memcached CR -Modify `deploy/cr.yaml` as shown and create a `Memcached` custom resource: +Create the example `Memcached` CR that was generated at `deploy/crds/cache_v1alpha1_memcached_cr.yaml`: ```sh -$ cat deploy/cr.yaml +$ cat deploy/crds/cache_v1alpha1_memcached_cr.yaml apiVersion: "cache.example.com/v1alpha1" kind: "Memcached" metadata: @@ -198,7 +248,7 @@ metadata: spec: size: 3 -$ kubectl apply -f deploy/cr.yaml +$ kubectl apply -f deploy/crds/cache_v1alpha1_memcached_cr.yaml ``` Ensure that the memcached-operator creates the deployment for the CR: @@ -248,7 +298,7 @@ status: Change the `spec.size` field in the memcached CR from 3 to 4 and apply the change: ```sh -$ cat deploy/cr.yaml +$ cat deploy/crds/cache_v1alpha1_memcached_cr.yaml apiVersion: "cache.example.com/v1alpha1" kind: "Memcached" metadata: @@ -256,7 +306,7 @@ metadata: spec: size: 4 -$ kubectl apply -f deploy/cr.yaml +$ kubectl apply -f deploy/crds/cache_v1alpha1_memcached_cr.yaml ``` Confirm that the operator changes the deployment size: @@ -272,32 +322,35 @@ example-memcached 4 4 4 4 5m Clean up the resources: ```sh -$ kubectl delete -f deploy/cr.yaml +$ kubectl delete -f deploy/crds/cache_v1alpha1_memcached_cr.yaml $ kubectl delete -f deploy/operator.yaml +$ kubectl delete -f deploy/role_binding.yaml +$ kubectl delete -f deploy/role.yaml +$ kubectl delete -f deploy/service_account.yaml ``` - ## Advanced Topics + ### Adding 3rd Party Resources To Your Operator -To add a resource to an operator, you must add it to a scheme. By creating an `AddToScheme` method or reusing one you can easily add a resource to your scheme. An [example][deployments_register] shows that you define a function and then use the [runtime][runtime_package] package to create a `SchemeBuilder` -#### Current Operator-SDK -You then need to tell the operators to use these functions to add the resources to its scheme. In operator-sdk you use [AddToSDKScheme][osdk_add_to_scheme] to add this. -Example of you main.go: -```go +By default the operator's Manager will register all custom resource types defined in your project under `pkg/apis` with its scheme. +```Go import ( - .... - appsv1 "k8s.io/api/apps/v1" + "github.com/example-inc/memcached-operator/pkg/apis" + ... ) - -func main() { - k8sutil.AddToSDKScheme(appsv1.AddToScheme)` - sdk.Watch(appsv1.SchemeGroupVersion.String(), "Deployments", , ) +// Setup Scheme for all resources +if err := apis.AddToScheme(mgr.GetScheme()); err != nil { + log.Fatal(err) } ``` -#### Future with Controller Runtime -When using controller runtime, you will also need to tell its scheme about your resourece. In controller runtime to add to the scheme, you can get the managers [scheme][manager_scheme]. If you would like to see what kubebuilder generates to add the resoureces to the [scheme][simple_resource]. +To add a 3rd party resource to an operator, you must add it to the Manager's scheme. By creating an `AddToScheme` method or reusing one you can easily add a resource to your scheme. An [example][deployments_register] shows that you define a function and then use the [runtime][runtime_package] package to create a `SchemeBuilder`. + +#### Register with the Manager's scheme + +Call the `AddToScheme()` function for your 3rd party resource and pass it the Manager's scheme via `mgr.GetScheme()`. + Example: ```go import ( @@ -315,6 +368,7 @@ func main() { ``` [memcached_handler]: ../example/memcached-operator/handler.go.tmpl +[memcached_controller]: ../example/memcached-operator/memcached_controller.go.tmpl [layout_doc]:./project_layout.md [ansible_user_guide]:./ansible/user-guide.md [dep_tool]:https://golang.github.io/dep/docs/installation.html @@ -323,8 +377,10 @@ func main() { [docker_tool]:https://docs.docker.com/install/ [kubectl_tool]:https://kubernetes.io/docs/tasks/tools/install-kubectl/ [minikube_tool]:https://github.com/kubernetes/minikube#installation -[manager_scheme]: https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/manager/manager.go#L61 -[simple_resource]: https://book.kubebuilder.io/basics/simple_resource.html [deployments_register]: https://github.com/kubernetes/api/blob/master/apps/v1/register.go#L41 +[doc_client_api]:./user/client.md [runtime_package]: https://godoc.org/k8s.io/apimachinery/pkg/runtime -[osdk_add_to_scheme]: https://github.com/operator-framework/operator-sdk/blob/4179b6ac459b2b0cb04ab3a1b438c280bd28d1a5/pkg/util/k8sutil/k8sutil.go#L67 +[manager_go_doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/manager#Manager +[controller-go-doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg#hdr-Controller +[request-go-doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/reconcile#Request +[result_go_doc]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/reconcile#Result \ No newline at end of file diff --git a/vendor/github.com/operator-framework/operator-sdk/doc/user/client.md b/vendor/github.com/operator-framework/operator-sdk/doc/user/client.md new file mode 100644 index 000000000..7a3d7b9b8 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/doc/user/client.md @@ -0,0 +1,455 @@ +# Operator-SDK: Controller Runtime Client API + +## Overview + +The [`controller-runtime`][repo-controller-runtime] library provides various abstractions to watch and reconcile resources in a Kubernetes cluster via CRUD (Create, Update, Delete, as well as Get and List in this case) operations. Operators use at least one controller to perform a coherent set of tasks within a cluster, usually through a combination of CRUD operations. The Operator SDK uses controller-runtime's [Client][doc-client-client] interface, which provides the interface for these operations. + +controller-runtime defines several interfaces used for cluster interaction: +- `client.Client`: implementers perform CRUD operations on a Kubernetes cluster. +- `manager.Manager`: manages shared dependencies, such as Caches and Clients. +- `reconcile.Reconciler`: compares provided state with actual cluster state and updates the cluster on finding state differences using a Client. + +Clients are the focus of this document. A separate document will discuss Managers. + +## Client Usage + +### Default Client + +The SDK relies on a `manager.Manager` to create a `client.Client` interface that performs Create, Update, Delete, Get, and List operations within a `reconcile.Reconciler`'s Reconcile function. The SDK will generate code to create a Manager, which holds a Cache and a Client to be used in CRUD operations and communicate with the API server. By default a Controller's Reconciler will be populated with the Manager's Client which is a [split-client][doc-split-client]. + +`pkg/controller//_controller.go`: +```Go +func newReconciler(mgr manager.Manager) reconcile.Reconciler { + return &ReconcileKind{client: mgr.GetClient(), scheme: mgr.GetScheme()} +} + +type ReconcileKind struct { + // Populated above from a manager.Manager. + client client.Client + scheme *runtime.Scheme +} +``` + +A split client reads (Get and List) from the Cache and writes (Create, Update, Delete) to the API server. Reading from the Cache significantly reduces request load on the API server; as long as the Cache is updated by the API server, read operations are eventually consistent. + +### Non-default Client + +An operator developer may wish to create their own Client that serves read requests(Get List) from the API server instead of the cache, for example. controller-runtime provides a [constructor][doc-client-constr] for Clients: + +```Go +// New returns a new Client using the provided config and Options. +func New(config *rest.Config, options client.Options) (client.Client, error) +``` + +`client.Options` allow the caller to specify how the new Client should communicate with the API server. + +```Go +// Options are creation options for a Client +type Options struct { + // Scheme, if provided, will be used to map go structs to GroupVersionKinds + Scheme *runtime.Scheme + + // Mapper, if provided, will be used to map GroupVersionKinds to Resources + Mapper meta.RESTMapper +} +``` +Example: +```Go +import ( + "sigs.k8s.io/controller-runtime/pkg/client/config" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +cfg, err := config.GetConfig() +... +c, err := client.New(cfg, client.Options{}) +... +``` + +**Note**: defaults are set by `client.New` when Options are empty. The default [scheme][code-scheme-default] will have the [core][doc-k8s-core] Kubernetes resource types registered. The caller *must* set a scheme that has custom operator types registered for the new Client to recognize these types. + +Creating a new Client is not usually necessary nor advised, as the default Client is sufficient for most use cases. + +### Reconcile and the Client API + +A Reconciler implements the [`reconcile.Reconciler`][doc-reconcile-reconciler] interface, which exposes the Reconcile method. Reconcilers are added to a corresponding Controller for a Kind; Reconcile is called in response to cluster or external Events, with a `reconcile.Request` object argument, to read and write cluster state by the Controller, and returns a `reconcile.Result`. SDK Reconcilers have access to a Client in order to make Kubernetes API calls. + +**Note**: For those familiar with the SDK's old project semantics, [Handle][doc-osdk-handle] received resource events and reconciled state for multiple resource types, whereas Reconcile receives resource events and reconciles state for a single resource type. + +```Go +// ReconcileKind reconciles a Kind object +type ReconcileKind struct { + // client, initialized using mgr.Client() above, is a split client + // that reads objects from the cache and writes to the apiserver + client client.Client + + // scheme defines methods for serializing and deserializing API objects, + // a type registry for converting group, version, and kind information + // to and from Go schemas, and mappings between Go schemas of different + // versions. A scheme is the foundation for a versioned API and versioned + // configuration over time. + scheme *runtime.Scheme +} + +// Reconcile watches for Events and reconciles cluster state with desired +// state defined in the method body. +// The Controller will requeue the Request to be processed again if an error +// is non-nil or Result.Requeue is true, otherwise upon completion it will +// remove the work from the queue. +func (r *ReconcileKind) Reconcile(request reconcile.Request) (reconcile.Result, error) +``` + +Reconcile is where Controller business logic lives, i.e. where Client API calls are made via `ReconcileKind.client`. A `client.Client` implementer performs the following operations: + +#### Get + +```Go +// Get retrieves an API object for a given object key from the Kubernetes cluster +// and stores it in obj. +func (c Client) Get(ctx context.Context, key ObjectKey, obj runtime.Object) error +``` +**Note**: An `ObjectKey` is simply a `client` package alias for [`types.NamespacedName`][doc-types-nsname]. + +Example: +```Go +import ( + "context" + "github.com/example-org/app-operator/pkg/apis/cache/v1alpha1" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, error) { + ... + + app := &v1alpha1.App{} + ctx := context.TODO() + err := r.client.Get(ctx, request.NamespacedName, app) + + ... +} +``` + +#### List + +```Go +// List retrieves a list of objects for a given namespace and list options +// and stores the list in obj. +func (c Client) List(ctx context.Context, opts *ListOptions, obj runtime.Object) error +``` +A `client.ListOptions` sets filters and options for a `List` call: +```Go +type ListOptions struct { + // LabelSelector filters results by label. Use SetLabelSelector to + // set from raw string form. + LabelSelector labels.Selector + + // FieldSelector filters results by a particular field. In order + // to use this with cache-based implementations, restrict usage to + // a single field-value pair that's been added to the indexers. + FieldSelector fields.Selector + + // Namespace represents the namespace to list for, or empty for + // non-namespaced objects, or to list across all namespaces. + Namespace string + + // Raw represents raw ListOptions, as passed to the API server. Note + // that these may not be respected by all implementations of interface, + // and the LabelSelector and FieldSelector fields are ignored. + Raw *metav1.ListOptions +} +``` +Example: +```Go +import ( + "context" + "fmt" + "k8s.io/api/core/v1" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, error) { + ... + + // Return all pods in the request namespace with a label of `app=` + opts := &client.ListOptions{} + opts.SetLabelSelector(fmt.Sprintf("app=%s", request.NamespacedName.Name)) + opts.InNamespace(request.NamespacedName.Namespace) + + podList := &v1.PodList{} + ctx := context.TODO() + err := r.client.List(ctx, opts, podList) + + ... +} +``` + +#### Create + +```Go +// Create saves the object obj in the Kubernetes cluster. +// Returns an error +func (c Client) Create(ctx context.Context, obj runtime.Object) error +``` +Example: +```Go +import ( + "context" + "k8s.io/api/apps/v1" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, error) { + ... + + app := &v1.Deployment{ // Any cluster object you want to create. + ... + } + ctx := context.TODO() + err := r.client.Create(ctx, app) + + ... +} +``` + +#### Update + +```Go +// Update updates the given obj in the Kubernetes cluster. obj must be a +// struct pointer so that obj can be updated with the content returned +// by the API server. +func (c Client) Update(ctx context.Context, obj runtime.Object) error +``` +Example: +```Go +import ( + "context" + "k8s.io/api/apps/v1" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, error) { + ... + + dep := &v1.Deployment{} + err := r.client.Get(context.TODO(), request.NamespacedName, dep) + + ... + + ctx := context.TODO() + dep.Spec.Selector.MatchLabels["is_running"] = "true" + err := r.client.Update(ctx, dep) + + ... +} +``` + +#### Delete + +```Go +// Delete deletes the given obj from Kubernetes cluster. +func (c Client) Delete(ctx context.Context, obj runtime.Object, opts ...DeleteOptionFunc) error +``` +A `client.DeleteOptionFunc` sets fields of `client.DeleteOptions` to configure a `Delete` call: +```Go +// DeleteOptionFunc is a function that mutates a DeleteOptions struct. +type DeleteOptionFunc func(*DeleteOptions) + +type DeleteOptions struct { + // GracePeriodSeconds is the duration in seconds before the object should be + // deleted. Value must be non-negative integer. The value zero indicates + // delete immediately. If this value is nil, the default grace period for the + // specified type will be used. + GracePeriodSeconds *int64 + + // Preconditions must be fulfilled before a deletion is carried out. If not + // possible, a 409 Conflict status will be returned. + Preconditions *metav1.Preconditions + + // PropagationPolicy determined whether and how garbage collection will be + // performed. Either this field or OrphanDependents may be set, but not both. + // The default policy is decided by the existing finalizer set in the + // metadata.finalizers and the resource-specific default policy. + // Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - + // allow the garbage collector to delete the dependents in the background; + // 'Foreground' - a cascading policy that deletes all dependents in the + // foreground. + PropagationPolicy *metav1.DeletionPropagation + + // Raw represents raw DeleteOptions, as passed to the API server. + Raw *metav1.DeleteOptions +} +``` +Example: +```Go +import ( + "context" + "k8s.io/api/core/v1" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, error) { + ... + + pod := &v1.Pod{} + err := r.client.Get(context.TODO(), request.NamespacedName, pod) + + ... + + ctx := context.TODO() + if pod.Status.Phase == v1.PodUnknown { + // Delete the pod after 5 seconds. + err := r.client.Delete(ctx, pod, client.GracePeriodSeconds(5)) + ... + } + + ... +} +``` + +### Example usage + +```Go +import ( + "context" + "reflect" + + appv1alpha1 "github.com/example-org/app-operator/pkg/apis/app/v1alpha1" + + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/reconcile" +) + +type ReconcileApp struct { + client client.Client + scheme *runtime.Scheme +} + +func (r *ReconcileApp) Reconcile(request reconcile.Request) (reconcile.Result, error) { + + // Fetch the App instance. + app := &appv1alpha1.App{} + err := r.client.Get(context.TODO(), request.NamespacedName, app) + if err != nil { + if errors.IsNotFound(err) { + return reconcile.Result{}, nil + } + return reconcile.Result{}, err + } + + // Check if the deployment already exists, if not create a new deployment. + found := &appsv1.Deployment{} + err = r.client.Get(context.TODO(), types.NamespacedName{Name: app.Name, Namespace: app.Namespace}, found) + if err != nil { + if errors.IsNotFound(err) { + // Define and create a new deployment. + dep := r.deploymentForApp(app) + if err = r.client.Create(context.TODO(), dep); err != nil { + return reconcile.Result{}, err + } + return reconcile.Result{Requeue: true}, nil + } else { + return reconcile.Result{}, err + } + } + + // Ensure the deployment size is the same as the spec. + size := app.Spec.Size + if *found.Spec.Replicas != size { + found.Spec.Replicas = &size + if err = r.client.Update(context.TODO(), found); err != nil { + return reconcile.Result{}, err + } + return reconcile.Result{Requeue: true}, nil + } + + // Update the App status with the pod names. + // List the pods for this app's deployment. + podList := &corev1.PodList{} + labelSelector := labels.SelectorFromSet(labelsForApp(app.Name)) + listOps := &client.ListOptions{Namespace: app.Namespace, LabelSelector: labelSelector} + if err = r.client.List(context.TODO(), listOps, podList); err != nil { + return reconcile.Result{}, err + } + + // Update status.Nodes if needed. + podNames := getPodNames(podList.Items) + if !reflect.DeepEqual(podNames, app.Status.Nodes) { + app.Status.Nodes = podNames + if err := r.client.Update(context.TODO(), app); err != nil { + return reconcile.Result{}, err + } + } + + return reconcile.Result{}, nil +} + +// deploymentForApp returns a app Deployment object. +func (r *ReconcileKind) deploymentForApp(m *appv1alpha1.App) *appsv1.Deployment { + lbls := labelsForApp(m.Name) + replicas := m.Spec.Size + + dep := &appsv1.Deployment{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apps/v1", + Kind: "Deployment", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: m.Name, + Namespace: m.Namespace, + }, + Spec: appsv1.DeploymentSpec{ + Replicas: &replicas, + Selector: &metav1.LabelSelector{ + MatchLabels: lbls, + }, + Template: corev1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: lbls, + }, + Spec: corev1.PodSpec{ + Containers: []corev1.Container{{ + Image: "app:alpine", + Name: "app", + Command: []string{"app", "-a=64", "-b"}, + Ports: []corev1.ContainerPort{{ + ContainerPort: 10000, + Name: "app", + }}, + }}, + }, + }, + }, + } + + // Set App instance as the owner and controller. + // NOTE: calling SetControllerReference, and setting owner references in + // general, is important as it allows deleted objects to be garbage collected. + controllerutil.SetControllerReference(m, dep, r.scheme) + return dep +} + +// labelsForApp creates a simple set of labels for App. +func labelsForApp(name string) map[string]string { + return map[string]string{"app_name": "app", "app_cr": name} +} +``` + +[repo-controller-runtime]:https://github.com/kubernetes-sigs/controller-runtime +[doc-client-client]:https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/client#Client +[doc-split-client]:https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/client#DelegatingClient +[doc-client-constr]:https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/client#New +[code-scheme-default]:https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/client/client.go#L51 +[doc-k8s-core]:https://godoc.org/k8s.io/api/core/v1 +[doc-reconcile-reconciler]:https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/reconcile#Reconciler +[doc-osdk-handle]:https://github.com/operator-framework/operator-sdk/blob/master/doc/design/milestone-0.0.2/action-api.md#handler +[doc-types-nsname]:https://godoc.org/k8s.io/apimachinery/pkg/types#NamespacedName diff --git a/vendor/github.com/operator-framework/operator-sdk/example/memcached-operator/handler.go.tmpl b/vendor/github.com/operator-framework/operator-sdk/example/memcached-operator/handler.go.tmpl deleted file mode 100644 index 0468f0b3a..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/example/memcached-operator/handler.go.tmpl +++ /dev/null @@ -1,179 +0,0 @@ -package stub - -import ( - "context" - "fmt" - "reflect" - - v1alpha1 "github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1" - - "github.com/operator-framework/operator-sdk/pkg/sdk" - "github.com/prometheus/client_golang/prometheus" - appsv1 "k8s.io/api/apps/v1" - "k8s.io/api/core/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" -) - -func NewHandler(m *Metrics) sdk.Handler { - return &Handler{ - metrics: m, - } -} - -type Metrics struct { - operatorErrors prometheus.Counter -} - -type Handler struct { - // Metrics example - metrics *Metrics -} - -func (h *Handler) Handle(ctx context.Context, event sdk.Event) error { - switch o := event.Object.(type) { - case *v1alpha1.Memcached: - memcached := o - - // Ignore the delete event since the garbage collector will clean up all secondary resources for the CR - // All secondary resources must have the CR set as their OwnerReference for this to be the case - if event.Deleted { - return nil - } - - // Create the deployment if it doesn't exist - dep := deploymentForMemcached(memcached) - err := sdk.Create(dep) - if err != nil && !apierrors.IsAlreadyExists(err) { - return fmt.Errorf("failed to create deployment: %v", err) - } - - // Ensure the deployment size is the same as the spec - err = sdk.Get(dep) - if err != nil { - return fmt.Errorf("failed to get deployment: %v", err) - } - size := memcached.Spec.Size - if *dep.Spec.Replicas != size { - dep.Spec.Replicas = &size - err = sdk.Update(dep) - if err != nil { - return fmt.Errorf("failed to update deployment: %v", err) - } - } - - // Update the Memcached status with the pod names - podList := podList() - labelSelector := labels.SelectorFromSet(labelsForMemcached(memcached.Name)).String() - listOps := &metav1.ListOptions{LabelSelector: labelSelector} - err = sdk.List(memcached.Namespace, podList, sdk.WithListOptions(listOps)) - if err != nil { - return fmt.Errorf("failed to list pods: %v", err) - } - podNames := getPodNames(podList.Items) - if !reflect.DeepEqual(podNames, memcached.Status.Nodes) { - memcached.Status.Nodes = podNames - err := sdk.Update(memcached) - if err != nil { - return fmt.Errorf("failed to update memcached status: %v", err) - } - } - } - return nil -} - -// deploymentForMemcached returns a memcached Deployment object -func deploymentForMemcached(m *v1alpha1.Memcached) *appsv1.Deployment { - ls := labelsForMemcached(m.Name) - replicas := m.Spec.Size - - dep := &appsv1.Deployment{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "apps/v1", - Kind: "Deployment", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: m.Name, - Namespace: m.Namespace, - }, - Spec: appsv1.DeploymentSpec{ - Replicas: &replicas, - Selector: &metav1.LabelSelector{ - MatchLabels: ls, - }, - Template: v1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: ls, - }, - Spec: v1.PodSpec{ - Containers: []v1.Container{{ - Image: "memcached:1.4.36-alpine", - Name: "memcached", - Command: []string{"memcached", "-m=64", "-o", "modern", "-v"}, - Ports: []v1.ContainerPort{{ - ContainerPort: 11211, - Name: "memcached", - }}, - }}, - }, - }, - }, - } - addOwnerRefToObject(dep, asOwner(m)) - return dep -} - -// labelsForMemcached returns the labels for selecting the resources -// belonging to the given memcached CR name. -func labelsForMemcached(name string) map[string]string { - return map[string]string{"app": "memcached", "memcached_cr": name} -} - -// addOwnerRefToObject appends the desired OwnerReference to the object -func addOwnerRefToObject(obj metav1.Object, ownerRef metav1.OwnerReference) { - obj.SetOwnerReferences(append(obj.GetOwnerReferences(), ownerRef)) -} - -// asOwner returns an OwnerReference set as the memcached CR -func asOwner(m *v1alpha1.Memcached) metav1.OwnerReference { - trueVar := true - return metav1.OwnerReference{ - APIVersion: m.APIVersion, - Kind: m.Kind, - Name: m.Name, - UID: m.UID, - Controller: &trueVar, - } -} - -// podList returns a v1.PodList object -func podList() *v1.PodList { - return &v1.PodList{ - TypeMeta: metav1.TypeMeta{ - Kind: "Pod", - APIVersion: "v1", - }, - } -} - -// getPodNames returns the pod names of the array of pods passed in -func getPodNames(pods []v1.Pod) []string { - var podNames []string - for _, pod := range pods { - podNames = append(podNames, pod.Name) - } - return podNames -} - -func RegisterOperatorMetrics() (*Metrics, error) { - operatorErrors := prometheus.NewCounter(prometheus.CounterOpts{ - Name: "memcached_operator_reconcile_errors_total", - Help: "Number of errors that occurred while reconciling the memcached deployment", - }) - err := prometheus.Register(operatorErrors) - if err != nil { - return nil, err - } - return &Metrics{operatorErrors: operatorErrors}, nil -} diff --git a/vendor/github.com/operator-framework/operator-sdk/example/memcached-operator/memcached_controller.go.tmpl b/vendor/github.com/operator-framework/operator-sdk/example/memcached-operator/memcached_controller.go.tmpl new file mode 100644 index 000000000..0d8d84370 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/example/memcached-operator/memcached_controller.go.tmpl @@ -0,0 +1,218 @@ +package memcached + +import ( + "context" + "log" + "reflect" + + cachev1alpha1 "github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1" + + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" +) + +/** +* USER ACTION REQUIRED: This is a scaffold file intended for the user to modify with their own Controller +* business logic. Delete these comments after modifying this file.* + */ + +// Add creates a new Memcached Controller and adds it to the Manager. The Manager will set fields on the Controller +// and Start it when the Manager is Started. +func Add(mgr manager.Manager) error { + return add(mgr, newReconciler(mgr)) +} + +// newReconciler returns a new reconcile.Reconciler +func newReconciler(mgr manager.Manager) reconcile.Reconciler { + return &ReconcileMemcached{client: mgr.GetClient(), scheme: mgr.GetScheme()} +} + +// add adds a new Controller to mgr with r as the reconcile.Reconciler +func add(mgr manager.Manager, r reconcile.Reconciler) error { + // Create a new controller + c, err := controller.New("memcached-controller", mgr, controller.Options{Reconciler: r}) + if err != nil { + return err + } + + // Watch for changes to primary resource Memcached + err = c.Watch(&source.Kind{Type: &cachev1alpha1.Memcached{}}, &handler.EnqueueRequestForObject{}) + if err != nil { + return err + } + + // TODO(user): Modify this to be the types you create that are owned by the primary resource + // Watch for changes to secondary resource Pods and requeue the owner Memcached + err = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{ + IsController: true, + OwnerType: &cachev1alpha1.Memcached{}, + }) + if err != nil { + return err + } + + return nil +} + +var _ reconcile.Reconciler = &ReconcileMemcached{} + +// ReconcileMemcached reconciles a Memcached object +type ReconcileMemcached struct { + // TODO: Clarify the split client + // This client, initialized using mgr.Client() above, is a split client + // that reads objects from the cache and writes to the apiserver + client client.Client + scheme *runtime.Scheme +} + +// Reconcile reads that state of the cluster for a Memcached object and makes changes based on the state read +// and what is in the Memcached.Spec +// TODO(user): Modify this Reconcile function to implement your Controller logic. This example creates +// a Memcached Deployment for each Memcached CR +// Note: +// The Controller will requeue the Request to be processed again if the returned error is non-nil or +// Result.Requeue is true, otherwise upon completion it will remove the work from the queue. +func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Result, error) { + log.Printf("Reconciling Memcached %s/%s\n", request.Namespace, request.Name) + + // Fetch the Memcached instance + memcached := &cachev1alpha1.Memcached{} + err := r.client.Get(context.TODO(), request.NamespacedName, memcached) + if err != nil { + if errors.IsNotFound(err) { + // Request object not found, could have been deleted after reconcile request. + // Owned objects are automatically garbage collected. For additional cleanup logic use finalizers. + // Return and don't requeue + log.Printf("Memcached %s/%s not found. Ignoring since object must be deleted\n", request.Namespace, request.Name) + return reconcile.Result{}, nil + } + // Error reading the object - requeue the request. + log.Printf("Failed to get Memcached: %v", err) + return reconcile.Result{}, err + } + + // Check if the deployment already exists, if not create a new one + found := &appsv1.Deployment{} + err = r.client.Get(context.TODO(), types.NamespacedName{Name: memcached.Name, Namespace: memcached.Namespace}, found) + if err != nil && errors.IsNotFound(err) { + // Define a new deployment + dep := r.deploymentForMemcached(memcached) + log.Printf("Creating a new Deployment %s/%s\n", dep.Namespace, dep.Name) + err = r.client.Create(context.TODO(), dep) + if err != nil { + log.Printf("Failed to create new Deployment: %v\n", err) + return reconcile.Result{}, err + } + // Deployment created successfully - return and requeue + return reconcile.Result{Requeue: true}, nil + } else if err != nil { + log.Printf("Failed to get Deployment: %v\n", err) + return reconcile.Result{}, err + } + + // Ensure the deployment size is the same as the spec + size := memcached.Spec.Size + if *found.Spec.Replicas != size { + found.Spec.Replicas = &size + err = r.client.Update(context.TODO(), found) + if err != nil { + log.Printf("Failed to update Deployment: %v\n", err) + return reconcile.Result{}, err + } + // Spec updated - return and requeue + return reconcile.Result{Requeue: true}, nil + } + + // Update the Memcached status with the pod names + // List the pods for this memcached's deployment + podList := &corev1.PodList{} + labelSelector := labels.SelectorFromSet(labelsForMemcached(memcached.Name)) + listOps := &client.ListOptions{Namespace: memcached.Namespace, LabelSelector: labelSelector} + err = r.client.List(context.TODO(), listOps, podList) + if err != nil { + log.Printf("Failed to list pods: %v", err) + return reconcile.Result{}, err + } + podNames := getPodNames(podList.Items) + + // Update status.Nodes if needed + if !reflect.DeepEqual(podNames, memcached.Status.Nodes) { + memcached.Status.Nodes = podNames + err := r.client.Update(context.TODO(), memcached) + if err != nil { + log.Printf("failed to update memcached status: %v", err) + return reconcile.Result{}, err + } + } + + return reconcile.Result{}, nil +} + +// deploymentForMemcached returns a memcached Deployment object +func (r *ReconcileMemcached) deploymentForMemcached(m *cachev1alpha1.Memcached) *appsv1.Deployment { + ls := labelsForMemcached(m.Name) + replicas := m.Spec.Size + + dep := &appsv1.Deployment{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "apps/v1", + Kind: "Deployment", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: m.Name, + Namespace: m.Namespace, + }, + Spec: appsv1.DeploymentSpec{ + Replicas: &replicas, + Selector: &metav1.LabelSelector{ + MatchLabels: ls, + }, + Template: corev1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: ls, + }, + Spec: corev1.PodSpec{ + Containers: []corev1.Container{{ + Image: "memcached:1.4.36-alpine", + Name: "memcached", + Command: []string{"memcached", "-m=64", "-o", "modern", "-v"}, + Ports: []corev1.ContainerPort{{ + ContainerPort: 11211, + Name: "memcached", + }}, + }}, + }, + }, + }, + } + // Set Memcached instance as the owner and controller + controllerutil.SetControllerReference(m, dep, r.scheme) + return dep +} + +// labelsForMemcached returns the labels for selecting the resources +// belonging to the given memcached CR name. +func labelsForMemcached(name string) map[string]string { + return map[string]string{"app": "memcached", "memcached_cr": name} +} + +// getPodNames returns the pod names of the array of pods passed in +func getPodNames(pods []corev1.Pod) []string { + var podNames []string + for _, pod := range pods { + podNames = append(podNames, pod.Name) + } + return podNames +} diff --git a/vendor/github.com/operator-framework/operator-sdk/hack/ci/setup-openshift.sh b/vendor/github.com/operator-framework/operator-sdk/hack/ci/setup-openshift.sh index 8e5ffe82d..72236af8d 100755 --- a/vendor/github.com/operator-framework/operator-sdk/hack/ci/setup-openshift.sh +++ b/vendor/github.com/operator-framework/operator-sdk/hack/ci/setup-openshift.sh @@ -3,9 +3,9 @@ sudo service docker stop sudo sed -i 's/DOCKER_OPTS=\"/DOCKER_OPTS=\"--insecure-registry 172.30.0.0\/16 /' /etc/default/docker sudo service docker start # Download oc to spin up openshift on local docker instance -curl -Lo oc.tar.gz https://github.com/openshift/origin/releases/download/v3.10.0/openshift-origin-client-tools-v3.10.0-dd10d17-linux-64bit.tar.gz +curl -Lo oc.tar.gz https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz # Put oc binary in path -tar xvzOf oc.tar.gz openshift-origin-client-tools-v3.10.0-dd10d17-linux-64bit/oc > oc && chmod +x oc && sudo mv oc /usr/local/bin/ +tar xvzOf oc.tar.gz openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/oc > oc && chmod +x oc && sudo mv oc /usr/local/bin/ # Start oc cluster oc cluster up # Become cluster admin diff --git a/vendor/github.com/operator-framework/operator-sdk/hack/tests/e2e-ansible.sh b/vendor/github.com/operator-framework/operator-sdk/hack/tests/e2e-ansible.sh new file mode 100755 index 000000000..5c5d1b0e1 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/hack/tests/e2e-ansible.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash + +#=================================================================== +# FUNCTION trap_add () +# +# Purpose: prepends a command to a trap +# +# - 1st arg: code to add +# - remaining args: names of traps to modify +# +# Example: trap_add 'echo "in trap DEBUG"' DEBUG +# +# See: http://stackoverflow.com/questions/3338030/multiple-bash-traps-for-the-same-signal +#=================================================================== +trap_add() { + trap_add_cmd=$1; shift || fatal "${FUNCNAME} usage error" + new_cmd= + for trap_add_name in "$@"; do + # Grab the currently defined trap commands for this trap + existing_cmd=`trap -p "${trap_add_name}" | awk -F"'" '{print $2}'` + + # Define default command + [ -z "${existing_cmd}" ] && existing_cmd="echo exiting @ `date`" + + # Generate the new command + new_cmd="${trap_add_cmd};${existing_cmd}" + + # Assign the test + trap "${new_cmd}" "${trap_add_name}" || \ + fatal "unable to add to trap ${trap_add_name}" + done +} + +DEST_IMAGE="quay.io/example/memcached-operator:v0.0.2" + +set -ex + +# switch to the "default" namespace if on openshift, to match the minikube test +if which oc 2>/dev/null; then oc project default; fi + +# build operator binary and base image +go build -o test/ansible-operator/ansible-operator test/ansible-operator/cmd/ansible-operator/main.go +pushd test +pushd ansible-operator +docker build -t quay.io/water-hole/ansible-operator . +popd + +# get current directory so we can delete project on exit +DIR1=$(pwd) +trap_add 'rm -rf ${DIR1}/memcached-operator' EXIT +# create and build the operator +operator-sdk new memcached-operator --api-version=ansible.example.com/v1alpha1 --kind=Memcached --type=ansible +cp ansible-memcached/tasks.yml memcached-operator/roles/Memcached/tasks/main.yml +cp ansible-memcached/defaults.yml memcached-operator/roles/Memcached/defaults/main.yml +cp -a ansible-memcached/memfin memcached-operator/roles/ +cat ansible-memcached/watches-finalizer.yaml >> memcached-operator/watches.yaml + +pushd memcached-operator +operator-sdk build $DEST_IMAGE +sed -i "s|REPLACE_IMAGE|$DEST_IMAGE|g" deploy/operator.yaml +sed -i 's|Always|Never|g' deploy/operator.yaml + +DIR2=$(pwd) +# deploy the operator +kubectl create -f deploy/service_account.yaml +trap_add 'kubectl delete -f ${DIR2}/deploy/service_account.yaml' EXIT +kubectl create -f deploy/role.yaml +trap_add 'kubectl delete -f ${DIR2}/deploy/role.yaml' EXIT +kubectl create -f deploy/role_binding.yaml +trap_add 'kubectl delete -f ${DIR2}/deploy/role_binding.yaml' EXIT +kubectl create -f deploy/crds/ansible_v1alpha1_memcached_crd.yaml +trap_add 'kubectl delete -f ${DIR2}/deploy/crds/ansible_v1alpha1_memcached_crd.yaml' EXIT +kubectl create -f deploy/operator.yaml +trap_add 'kubectl delete -f ${DIR2}/deploy/operator.yaml' EXIT + +# wait for operator pod to run +if ! timeout 1m kubectl rollout status deployment/memcached-operator; +then + kubectl logs deployment/memcached-operator + exit 1 +fi + +# create CR +kubectl create -f deploy/crds/ansible_v1alpha1_memcached_cr.yaml +trap_add 'kubectl delete --ignore-not-found -f ${DIR2}/deploy/crds/ansible_v1alpha1_memcached_cr.yaml' EXIT +if ! timeout 20s bash -c -- 'until kubectl get deployment -l app=memcached | grep memcached; do sleep 1; done'; +then + kubectl logs deployment/memcached-operator + exit 1 +fi +memcached_deployment=$(kubectl get deployment -l app=memcached -o jsonpath="{..metadata.name}") +if ! timeout 1m kubectl rollout status deployment/${memcached_deployment}; +then + kubectl logs deployment/${memcached_deployment} + exit 1 +fi + +kubectl delete -f ${DIR2}/deploy/crds/ansible_v1alpha1_memcached_cr.yaml --wait=true +kubectl logs deployment/memcached-operator | grep "this is a finalizer" + +popd +popd diff --git a/vendor/github.com/operator-framework/operator-sdk/hack/tests/e2e-go.sh b/vendor/github.com/operator-framework/operator-sdk/hack/tests/e2e-go.sh new file mode 100755 index 000000000..5b7ae8252 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/hack/tests/e2e-go.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +go test ./test/e2e/... diff --git a/vendor/github.com/operator-framework/operator-sdk/hack/tests/sanity-check.sh b/vendor/github.com/operator-framework/operator-sdk/hack/tests/sanity-check.sh new file mode 100755 index 000000000..02e12c0e2 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/hack/tests/sanity-check.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -ex + +go vet ./... +./hack/check_license.sh +./hack/check_error_case.sh + +# Make sure repo is in clean state +git diff --exit-code diff --git a/vendor/github.com/operator-framework/operator-sdk/hack/tests/test-subcommand.sh b/vendor/github.com/operator-framework/operator-sdk/hack/tests/test-subcommand.sh new file mode 100755 index 000000000..092412cd2 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/hack/tests/test-subcommand.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -ex + +cd test/test-framework +# test framework with defaults +operator-sdk test local . +# test operator-sdk test flags +operator-sdk test local . --global-manifest deploy/crds/cache_v1alpha1_memcached_crd.yaml --namespaced-manifest deploy/namespace-init.yaml --go-test-flags "-parallel 1" --kubeconfig $HOME/.kube/config +# test operator-sdk test local single namespace mode +kubectl create namespace test-memcached +operator-sdk test local . --namespace=test-memcached +kubectl delete namespace test-memcached diff --git a/vendor/github.com/operator-framework/operator-sdk/hack/tests/unit.sh b/vendor/github.com/operator-framework/operator-sdk/hack/tests/unit.sh new file mode 100755 index 000000000..964f3921a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/hack/tests/unit.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -ex + +go test ./commands/... +go test ./pkg/... diff --git a/vendor/github.com/operator-framework/operator-sdk/internal/util/fileutil/file_util.go b/vendor/github.com/operator-framework/operator-sdk/internal/util/fileutil/file_util.go new file mode 100644 index 000000000..995edc210 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/internal/util/fileutil/file_util.go @@ -0,0 +1,91 @@ +// Copyright 2018 The Operator-SDK 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. + +// Modified from github.com/kubernetes-sigs/controller-tools/pkg/util/util.go + +package fileutil + +import ( + "fmt" + "io" + "log" + "os" + "path/filepath" + "sync" + + "github.com/spf13/afero" +) + +const ( + // file modes + DefaultDirFileMode = 0750 + DefaultFileMode = 0644 + DefaultExecFileMode = 0755 + + DefaultFileFlags = os.O_WRONLY | os.O_CREATE | os.O_TRUNC +) + +// FileWriter is a io wrapper to write files +type FileWriter struct { + Fs afero.Fs + + once sync.Once +} + +// WriteCloser returns a WriteCloser to write to given path +func (fw *FileWriter) WriteCloser(path string, mode os.FileMode) (io.Writer, error) { + fw.once.Do(func() { + fw.Fs = afero.NewOsFs() + }) + + dir := filepath.Dir(path) + err := fw.Fs.MkdirAll(dir, DefaultDirFileMode) + if err != nil { + return nil, err + } + + fi, err := fw.Fs.OpenFile(path, DefaultFileFlags, mode) + if err != nil { + return nil, err + } + + return fi, nil +} + +// WriteFile write given content to the file path +func (fw *FileWriter) WriteFile(filePath string, content []byte) error { + fw.once.Do(func() { + fw.Fs = afero.NewOsFs() + }) + + f, err := fw.WriteCloser(filePath, DefaultFileMode) + if err != nil { + return fmt.Errorf("failed to create %s: %v", filePath, err) + } + + if c, ok := f.(io.Closer); ok { + defer func() { + if err := c.Close(); err != nil { + log.Fatal(err) + } + }() + } + + _, err = f.Write(content) + if err != nil { + return fmt.Errorf("failed to write %s: %v", filePath, err) + } + + return nil +} diff --git a/vendor/github.com/operator-framework/operator-sdk/internal/util/projutil/project_util.go b/vendor/github.com/operator-framework/operator-sdk/internal/util/projutil/project_util.go new file mode 100644 index 000000000..502cfa9e5 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/internal/util/projutil/project_util.go @@ -0,0 +1,91 @@ +// Copyright 2018 The Operator-SDK 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 projutil + +import ( + "log" + "os" + "path/filepath" + "strings" +) + +const ( + SrcDir = "src" + gopkgToml = "./Gopkg.toml" + buildDockerfile = "./build/Dockerfile" +) + +const ( + GopathEnv = "GOPATH" +) + +// OperatorType - the type of operator +type OperatorType = string + +const ( + // OperatorTypeGo - golang type of operator. + OperatorTypeGo OperatorType = "go" + // OperatorTypeAnsible - ansible type of operator. + OperatorTypeAnsible OperatorType = "ansible" +) + +// MustInProjectRoot checks if the current dir is the project root and returns the current repo's import path +// e.g github.com/example-inc/app-operator +func MustInProjectRoot() { + // if the current directory has the "./build/dockerfile" file, then it is safe to say + // we are at the project root. + _, err := os.Stat(buildDockerfile) + if err != nil && os.IsNotExist(err) { + log.Fatalf("must run command in project root dir: %v", err) + } +} + +func MustGetwd() string { + wd, err := os.Getwd() + if err != nil { + log.Fatalf("failed to get working directory: (%v)", err) + } + return wd +} + +// CheckAndGetCurrPkg checks if this project's repository path is rooted under $GOPATH and returns the current directory's import path +// e.g: "github.com/example-inc/app-operator" +func CheckAndGetCurrPkg() string { + gopath := os.Getenv(GopathEnv) + if len(gopath) == 0 { + log.Fatalf("get current pkg failed: GOPATH env not set") + } + goSrc := filepath.Join(gopath, SrcDir) + + wd := MustGetwd() + if !strings.HasPrefix(filepath.Dir(wd), goSrc) { + log.Fatalf("check current pkg failed: must run from gopath") + } + currPkg := strings.Replace(wd, goSrc+string(filepath.Separator), "", 1) + // strip any "/" prefix from the repo path. + return strings.TrimPrefix(currPkg, string(filepath.Separator)) +} + +// GetOperatorType returns type of operator is in cwd +// This function should be called after verifying the user is in project root +// e.g: "go", "ansible" +func GetOperatorType() OperatorType { + // Assuming that if Gopkg.toml exists then this is a Go operator + _, err := os.Stat(gopkgToml) + if err != nil && os.IsNotExist(err) { + return OperatorTypeAnsible + } + return OperatorTypeGo +} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/events/log_events.go b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/events/log_events.go index 629dbb0b2..15ddd6244 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/events/log_events.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/events/log_events.go @@ -67,7 +67,7 @@ func (l loggingEventHandler) Handle(u *unstructured.Unstructured, e eventapi.Job t, ok := e.EventData["task"] if ok { setFactAction := e.EventData["task_action"] == TaskActionSetFact - debugAction := e.EventData["task_action"] == TaskActionDebug + debugAction := e.EventData["task_action"] == TaskActionDebug if e.Event == EventPlaybookOnTaskStart && !setFactAction && !debugAction { log.Infof("[playbook task]: %s", e.EventData["name"]) diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/operator/operator.go b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/operator/operator.go index 20f278299..394bacaf0 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/operator/operator.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/operator/operator.go @@ -15,7 +15,6 @@ package operator import ( - "log" "math/rand" "time" @@ -30,8 +29,8 @@ import ( // Run - A blocking function which starts a controller-runtime manager // It starts an Operator by reading in the values in `./watches.yaml`, adds a controller // to the manager, and finally running the manager. -func Run(done chan error, mgr manager.Manager) { - watches, err := runner.NewFromWatches("./watches.yaml") +func Run(done chan error, mgr manager.Manager, watchesPath string, reconcilePeriod time.Duration) { + watches, err := runner.NewFromWatches(watchesPath) if err != nil { logrus.Error("Failed to get watches") done <- err @@ -41,11 +40,16 @@ func Run(done chan error, mgr manager.Manager) { c := signals.SetupSignalHandler() for gvk, runner := range watches { - controller.Add(mgr, controller.Options{ - GVK: gvk, - Runner: runner, - }) + o := controller.Options{ + GVK: gvk, + Runner: runner, + ReconcilePeriod: reconcilePeriod, + } + d, ok := runner.GetReconcilePeriod() + if ok { + o.ReconcilePeriod = d + } + controller.Add(mgr, o) } - log.Fatal(mgr.Start(c)) - done <- nil + done <- mgr.Start(c) } diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/proxy/proxy.go b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/proxy/proxy.go index 58596f22f..0ab87eca3 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/proxy/proxy.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/proxy/proxy.go @@ -51,7 +51,7 @@ func InjectOwnerReferenceHandler(h http.Handler) http.Handler { authString, err := base64.StdEncoding.DecodeString(user) if err != nil { m := "could not base64 decode username" - logrus.Errorf("%s: %s", err.Error()) + logrus.Errorf("%s", err.Error()) http.Error(w, m, http.StatusBadRequest) return } @@ -63,7 +63,7 @@ func InjectOwnerReferenceHandler(h http.Handler) http.Handler { body, err := ioutil.ReadAll(req.Body) if err != nil { m := "could not read request body" - logrus.Errorf("%s: %s", err.Error()) + logrus.Errorf("%s", err.Error()) http.Error(w, m, http.StatusInternalServerError) return } @@ -71,7 +71,7 @@ func InjectOwnerReferenceHandler(h http.Handler) http.Handler { err = json.Unmarshal(body, data) if err != nil { m := "could not deserialize request body" - logrus.Errorf("%s: %s", err.Error()) + logrus.Errorf("%s", err.Error()) http.Error(w, m, http.StatusBadRequest) return } @@ -79,7 +79,7 @@ func InjectOwnerReferenceHandler(h http.Handler) http.Handler { newBody, err := json.Marshal(data.Object) if err != nil { m := "could not serialize body" - logrus.Errorf("%s: %s", err.Error()) + logrus.Errorf("%s", err.Error()) http.Error(w, m, http.StatusInternalServerError) return } @@ -108,13 +108,13 @@ type Options struct { KubeConfig *rest.Config } -// RunProxy will start a proxy server in a go routine and return on the error -// channel if something is not correct on startup. -func RunProxy(done chan error, o Options) { +// Run will start a proxy server in a go routine that returns on the error +// channel if something is not correct on startup. Run will not return until +// the network socket is listening. +func Run(done chan error, o Options) error { server, err := newServer("/", o.KubeConfig) if err != nil { - done <- err - return + return err } if o.Handler != nil { server.Handler = o.Handler(server.Handler) @@ -125,11 +125,11 @@ func RunProxy(done chan error, o Options) { } l, err := server.Listen(o.Address, o.Port) if err != nil { - done <- err - return + return err } go func() { logrus.Infof("Starting to serve on %s\n", l.Addr().String()) done <- server.ServeOnListener(l) }() + return nil } diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi/eventapi.go b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi/eventapi.go index a28e22f3f..f8e0bf69f 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi/eventapi.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi/eventapi.go @@ -122,7 +122,7 @@ func (e *EventReceiver) handleEvents(w http.ResponseWriter, r *http.Request) { if strings.Split(ct, ";")[0] != "application/json" { e.logger.WithFields(logrus.Fields{ "code": "415", - }).Info("wrong content type: %s", ct) + }).Infof("wrong content type: %s", ct) w.WriteHeader(http.StatusUnsupportedMediaType) w.Write([]byte("The content-type must be \"application/json\"")) return diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/runner.go b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/runner.go index 737050b54..37181b442 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/runner.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/runner.go @@ -25,6 +25,7 @@ import ( "path/filepath" "strconv" "strings" + "time" "github.com/operator-framework/operator-sdk/pkg/ansible/paramconv" "github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi" @@ -40,17 +41,19 @@ import ( type Runner interface { Run(*unstructured.Unstructured, string) (chan eventapi.JobEvent, error) GetFinalizer() (string, bool) + GetReconcilePeriod() (time.Duration, bool) } // watch holds data used to create a mapping of GVK to ansible playbook or role. // The mapping is used to compose an ansible operator. type watch struct { - Version string `yaml:"version"` - Group string `yaml:"group"` - Kind string `yaml:"kind"` - Playbook string `yaml:"playbook"` - Role string `yaml:"role"` - Finalizer *Finalizer `yaml:"finalizer"` + Version string `yaml:"version"` + Group string `yaml:"group"` + Kind string `yaml:"kind"` + Playbook string `yaml:"playbook"` + Role string `yaml:"role"` + ReconcilePeriod string `yaml:"reconcilePeriod"` + Finalizer *Finalizer `yaml:"finalizer"` } // Finalizer - Expose finalizer to be used by a user. @@ -82,19 +85,28 @@ func NewFromWatches(path string) (map[schema.GroupVersionKind]Runner, error) { Version: w.Version, Kind: w.Kind, } + var reconcilePeriod time.Duration + if w.ReconcilePeriod != "" { + d, err := time.ParseDuration(w.ReconcilePeriod) + if err != nil { + return nil, fmt.Errorf("unable to parse duration: %v - %v, setting to default", w.ReconcilePeriod, err) + } + reconcilePeriod = d + } + // Check if schema is a duplicate if _, ok := m[s]; ok { return nil, fmt.Errorf("duplicate GVK: %v", s.String()) } switch { case w.Playbook != "": - r, err := NewForPlaybook(w.Playbook, s, w.Finalizer) + r, err := NewForPlaybook(w.Playbook, s, w.Finalizer, reconcilePeriod) if err != nil { return nil, err } m[s] = r case w.Role != "": - r, err := NewForRole(w.Role, s, w.Finalizer) + r, err := NewForRole(w.Role, s, w.Finalizer, reconcilePeriod) if err != nil { return nil, err } @@ -107,16 +119,20 @@ func NewFromWatches(path string) (map[schema.GroupVersionKind]Runner, error) { } // NewForPlaybook returns a new Runner based on the path to an ansible playbook. -func NewForPlaybook(path string, gvk schema.GroupVersionKind, finalizer *Finalizer) (Runner, error) { +func NewForPlaybook(path string, gvk schema.GroupVersionKind, finalizer *Finalizer, reconcilePeriod time.Duration) (Runner, error) { if !filepath.IsAbs(path) { return nil, fmt.Errorf("playbook path must be absolute for %v", gvk) } + if _, err := os.Stat(path); err != nil { + return nil, fmt.Errorf("playbook: %v was not found for %v", path, gvk) + } r := &runner{ Path: path, GVK: gvk, cmdFunc: func(ident, inputDirPath string) *exec.Cmd { return exec.Command("ansible-runner", "-vv", "-p", path, "-i", ident, "run", inputDirPath) }, + reconcilePeriod: reconcilePeriod, } err := r.addFinalizer(finalizer) if err != nil { @@ -126,10 +142,13 @@ func NewForPlaybook(path string, gvk schema.GroupVersionKind, finalizer *Finaliz } // NewForRole returns a new Runner based on the path to an ansible role. -func NewForRole(path string, gvk schema.GroupVersionKind, finalizer *Finalizer) (Runner, error) { +func NewForRole(path string, gvk schema.GroupVersionKind, finalizer *Finalizer, reconcilePeriod time.Duration) (Runner, error) { if !filepath.IsAbs(path) { return nil, fmt.Errorf("role path must be absolute for %v", gvk) } + if _, err := os.Stat(path); err != nil { + return nil, fmt.Errorf("role path: %v was not found for %v", path, gvk) + } path = strings.TrimRight(path, "/") r := &runner{ Path: path, @@ -138,6 +157,7 @@ func NewForRole(path string, gvk schema.GroupVersionKind, finalizer *Finalizer) rolePath, roleName := filepath.Split(path) return exec.Command("ansible-runner", "-vv", "--role", roleName, "--roles-path", rolePath, "--hosts", "localhost", "-i", ident, "run", inputDirPath) }, + reconcilePeriod: reconcilePeriod, } err := r.addFinalizer(finalizer) if err != nil { @@ -153,6 +173,7 @@ type runner struct { Finalizer *Finalizer cmdFunc func(ident, inputDirPath string) *exec.Cmd // returns a Cmd that runs ansible-runner finalizerCmdFunc func(ident, inputDirPath string) *exec.Cmd + reconcilePeriod time.Duration } func (r *runner) Run(u *unstructured.Unstructured, kubeconfig string) (chan eventapi.JobEvent, error) { @@ -224,6 +245,14 @@ func (r *runner) Run(u *unstructured.Unstructured, kubeconfig string) (chan even return receiver.Events, nil } +// GetReconcilePeriod - new reconcile period. +func (r *runner) GetReconcilePeriod() (time.Duration, bool) { + if r.reconcilePeriod == time.Duration(0) { + return r.reconcilePeriod, false + } + return r.reconcilePeriod, true +} + func (r *runner) GetFinalizer() (string, bool) { if r.Finalizer != nil { return r.Finalizer.Name, true diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/runner_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/runner_test.go new file mode 100644 index 000000000..d96ba771b --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/runner_test.go @@ -0,0 +1,192 @@ +// Copyright 2018 The Operator-SDK 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 runner + +import ( + "html/template" + "os" + "path/filepath" + "reflect" + "testing" + "time" + + "k8s.io/apimachinery/pkg/runtime/schema" +) + +func TestNewFromWatches(t *testing.T) { + cwd, err := os.Getwd() + if err != nil { + t.Fatalf("unable to get working director: %v", err) + } + + validTemplate := struct { + ValidPlaybook string + ValidRole string + }{ + + ValidPlaybook: filepath.Join(cwd, "testdata", "playbook.yml"), + ValidRole: filepath.Join(cwd, "testdata", "roles", "role"), + } + + tmpl, err := template.ParseFiles("testdata/valid.yaml.tmpl") + if err != nil { + } + f, err := os.Create("testdata/valid.yaml") + if err != nil { + t.Fatalf("unable to create valid.yaml: %v", err) + } + err = tmpl.Execute(f, validTemplate) + if err != nil { + t.Fatalf("unable to create valid.yaml: %v", err) + return + } + + testCases := []struct { + name string + path string + expectedMap map[schema.GroupVersionKind]runner + shouldError bool + }{ + { + name: "error duplicate GVK", + path: "testdata/duplicate_gvk.yaml", + shouldError: true, + }, + { + name: "error no file", + path: "testdata/please_don't_create_me_gvk.yaml", + shouldError: true, + }, + { + name: "error invalid yaml", + path: "testdata/invalid.yaml", + shouldError: true, + }, + { + name: "error invalid playbook path", + path: "testdata/invalid_playbook_path.yaml", + shouldError: true, + }, + { + name: "error invalid playbook finalizer path", + path: "testdata/invalid_finalizer_playbook_path.yaml", + shouldError: true, + }, + { + name: "error invalid role path", + path: "testdata/invalid_role_path.yaml", + shouldError: true, + }, + { + name: "error invalid role finalizer path", + path: "testdata/invalid_finalizer_role_path.yaml", + shouldError: true, + }, + { + name: "error invalid duration", + path: "testdata/invalid_duration.yaml", + shouldError: true, + }, + { + name: "valid watches file", + path: "testdata/valid.yaml", + expectedMap: map[schema.GroupVersionKind]runner{ + schema.GroupVersionKind{ + Version: "v1alpha1", + Group: "app.example.com", + Kind: "NoFinalizer", + }: runner{ + GVK: schema.GroupVersionKind{ + Version: "v1alpha1", + Group: "app.example.com", + Kind: "NoFinalizer", + }, + Path: validTemplate.ValidPlaybook, + reconcilePeriod: time.Second * 2, + }, + schema.GroupVersionKind{ + Version: "v1alpha1", + Group: "app.example.com", + Kind: "Playbook", + }: runner{ + GVK: schema.GroupVersionKind{ + Version: "v1alpha1", + Group: "app.example.com", + Kind: "Playbook", + }, + Path: validTemplate.ValidPlaybook, + Finalizer: &Finalizer{ + Name: "finalizer.app.example.com", + Role: validTemplate.ValidRole, + Vars: map[string]interface{}{"sentinel": "finalizer_running"}, + }, + }, + schema.GroupVersionKind{ + Version: "v1alpha1", + Group: "app.example.com", + Kind: "Role", + }: runner{ + GVK: schema.GroupVersionKind{ + Version: "v1alpha1", + Group: "app.example.com", + Kind: "Role", + }, + Path: validTemplate.ValidRole, + Finalizer: &Finalizer{ + Name: "finalizer.app.example.com", + Playbook: validTemplate.ValidPlaybook, + Vars: map[string]interface{}{"sentinel": "finalizer_running"}, + }, + }, + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + m, err := NewFromWatches(tc.path) + if err != nil && !tc.shouldError { + t.Fatalf("err: %v occurred unexpectedly", err) + } + if err != nil && tc.shouldError { + return + } + for k, expectedR := range tc.expectedMap { + r, ok := m[k] + if !ok { + t.Fatalf("did not find expected GVK: %v", k) + } + run, ok := r.(*runner) + if !ok { + t.Fatalf("here: %#v", r) + } + if run.Path != expectedR.Path { + t.Fatalf("the GVK: %v unexpected path: %v expected path: %v", k, run.Path, expectedR.Path) + } + if run.GVK != expectedR.GVK { + t.Fatalf("the GVK: %v\nunexpected GVK: %#v\nexpected GVK: %#v", k, run.GVK, expectedR.GVK) + } + if run.Finalizer != expectedR.Finalizer { + if run.Finalizer.Name != expectedR.Finalizer.Name || run.Finalizer.Playbook != expectedR.Finalizer.Playbook || run.Finalizer.Role != expectedR.Finalizer.Role || reflect.DeepEqual(run.Finalizer.Vars["sentinel"], expectedR.Finalizer.Vars["sentininel"]) { + t.Fatalf("the GVK: %v\nunexpected finalizer: %#v\nexpected finalizer: %#v", k, run.Finalizer, expectedR.Finalizer) + } + } + if run.reconcilePeriod != expectedR.reconcilePeriod { + t.Fatalf("the GVK: %v unexpected reconcile period: %v expected reconcile period: %v", k, run.reconcilePeriod, expectedR.reconcilePeriod) + } + } + }) + } +} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/duplicate_gvk.yaml b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/duplicate_gvk.yaml new file mode 100644 index 000000000..e9add1185 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/duplicate_gvk.yaml @@ -0,0 +1,17 @@ +--- +- version: v1alpha1 + group: app.example.com + kind: Database + playbook: /opt/ansible/playbook.yaml + finalizer: + name: finalizer.app.example.com + vars: + sentinel: finalizer_running +- version: v1alpha1 + group: app.example.com + kind: Database + playbook: /opt/ansible/playbook.yaml + finalizer: + name: finalizer.app.example.com + vars: + sentinel: finalizer_running diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid.yaml b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid.yaml new file mode 100644 index 000000000..8458789ba --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid.yaml @@ -0,0 +1,9 @@ +--- +version: v1alpha1 + group: app.example.com + kind: Database + playbook: /opt/ansible/playbook.yaml + finalizer: + name: finalizer.app.example.com + vars: + sentinel: finalizer_running diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_duration.yaml b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_duration.yaml new file mode 100644 index 000000000..b4124e090 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_duration.yaml @@ -0,0 +1,6 @@ +--- +- version: v1alpha1 + group: app.example.com + kind: Database + playbook: /opt/ansible/playbook.yaml + reconcilePeriod: invalid diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_finalizer_playbook_path.yaml b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_finalizer_playbook_path.yaml new file mode 100644 index 000000000..4141b65d4 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_finalizer_playbook_path.yaml @@ -0,0 +1,10 @@ +--- +- version: v1alpha1 + group: app.example.com + kind: Database + playbook: /opt/ansible/playbook.yaml + finalizer: + name: finalizer.app.example.com + playbook: opt/ansible/playbook.yaml + vars: + sentinel: finalizer_running diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_finalizer_role_path.yaml b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_finalizer_role_path.yaml new file mode 100644 index 000000000..53d06c654 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_finalizer_role_path.yaml @@ -0,0 +1,10 @@ +--- +- version: v1alpha1 + group: app.example.com + kind: Database + playbook: /ansible/playbook.yaml + finalizer: + name: finalizer.app.example.com + role: ansible/role + vars: + sentinel: finalizer_running diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_playbook_path.yaml b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_playbook_path.yaml new file mode 100644 index 000000000..38c33e21e --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_playbook_path.yaml @@ -0,0 +1,9 @@ +--- +- version: v1alpha1 + group: app.example.com + kind: Database + playbook: opt/ansible/playbook.yaml + finalizer: + name: finalizer.app.example.com + vars: + sentinel: finalizer_running diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_role_path.yaml b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_role_path.yaml new file mode 100644 index 000000000..414f20d05 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/invalid_role_path.yaml @@ -0,0 +1,9 @@ +--- +- version: v1alpha1 + group: app.example.com + kind: Database + role: opt/ansible/playbook.yaml + finalizer: + name: finalizer.app.example.com + vars: + sentinel: finalizer_running diff --git a/vendor/github.com/prometheus/common/config/testdata/tls_config.empty.good.yml b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/playbook.yml similarity index 100% rename from vendor/github.com/prometheus/common/config/testdata/tls_config.empty.good.yml rename to vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/playbook.yml diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/roles/role/tasks.yaml b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/roles/role/tasks.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/valid.yaml.tmpl b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/valid.yaml.tmpl new file mode 100644 index 000000000..2d5764bbd --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/ansible/runner/testdata/valid.yaml.tmpl @@ -0,0 +1,24 @@ +--- +- version: v1alpha1 + group: app.example.com + kind: NoFinalizer + playbook: {{ .ValidPlaybook }} + reconcilePeriod: 2s +- version: v1alpha1 + group: app.example.com + kind: Playbook + playbook: {{ .ValidPlaybook }} + finalizer: + name: finalizer.app.example.com + role: {{ .ValidRole }} + vars: + sentinel: finalizer_running +- version: v1alpha1 + group: app.example.com + kind: Role + role: {{ .ValidRole }} + finalizer: + name: finalizer.app.example.com + playbook: {{ .ValidPlaybook }} + vars: + sentinel: finalizer_running diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_config.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_config.go deleted file mode 100644 index 113ff809e..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_config.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -import ( - "io" - - yaml "gopkg.in/yaml.v2" -) - -type Config struct { - // APIVersion is the kubernetes apiVersion that has the format of $GROUP_NAME/$VERSION. - APIVersion string `yaml:"apiVersion"` - // Kind is the kubernetes resource kind. - Kind string `yaml:"kind"` - // ProjectName is name of the new operator application - // and is also the name of the base directory. - ProjectName string `yaml:"projectName"` -} - -func renderConfigFile(w io.Writer, apiVersion, kind, projectName string) error { - o, err := yaml.Marshal(&Config{ - APIVersion: apiVersion, - Kind: kind, - ProjectName: projectName, - }) - if err != nil { - return err - } - - _, err = w.Write(o) - return err -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_config_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_config_test.go deleted file mode 100644 index 71e9592d2..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_config_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -import ( - "bytes" - "testing" -) - -const configExp = `apiVersion: app.example.com/v1alpha1 -kind: AppService -projectName: app-operator -` - -func TestGenConfig(t *testing.T) { - buf := &bytes.Buffer{} - if err := renderConfigFile(buf, appAPIVersion, appKind, appProjectName); err != nil { - t.Error(err) - } - if configExp != buf.String() { - t.Errorf(errorMessage, configExp, buf.String()) - } -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_deps.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_deps.go deleted file mode 100644 index 5034da6fb..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_deps.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -import "io" - -func renderGopkgTomlFile(w io.Writer) error { - _, err := w.Write([]byte(gopkgTomlTmpl)) - return err -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_deps_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_deps_test.go deleted file mode 100644 index 94f5f76ce..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/gen_deps_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -import ( - "bytes" - "testing" -) - -func TestGenGopkg(t *testing.T) { - buf := &bytes.Buffer{} - if err := renderGopkgTomlFile(buf); err != nil { - t.Error(err) - return - } - - if gopkgTomlTmpl != buf.String() { - t.Errorf(errorMessage, gopkgTomlTmpl, buf.String()) - } -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/generator.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/generator.go deleted file mode 100644 index da513094b..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/generator.go +++ /dev/null @@ -1,774 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "strings" - "text/template" - - "github.com/operator-framework/operator-sdk/pkg/test" - - k8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" -) - -const ( - defaultDirFileMode = 0750 - defaultFileMode = 0644 - defaultExecFileMode = 0755 - - // types - goOperatorType = "go" - ansibleOperatorType = "ansible" - - // dirs - cmdDir = "cmd" - deployDir = "deploy" - rolesDir = "roles" - olmCatalogDir = deployDir + "/olm-catalog" - configDir = "config" - tmpDir = "tmp" - buildDir = tmpDir + "/build" - codegenDir = tmpDir + "/codegen" - dockerTestDir = buildDir + "/test-framework" - initDir = tmpDir + "/init" - pkgDir = "pkg" - apisDir = pkgDir + "/apis" - stubDir = pkgDir + "/stub" - versionDir = "version" - - // files - main = "main.go" - handler = "handler.go" - doc = "doc.go" - register = "register.go" - types = "types.go" - build = "build.sh" - dockerfile = "Dockerfile" - testingDockerfile = "Dockerfile" - goTest = "go-test.sh" - boilerplate = "boilerplate.go.txt" - updateGenerated = "update-generated.sh" - galaxyInit = "galaxy-init.sh" - gopkgtoml = "Gopkg.toml" - gopkglock = "Gopkg.lock" - config = "config.yaml" - rbacYaml = "rbac.yaml" - crYaml = "cr.yaml" - saYaml = "sa.yaml" - catalogPackageYaml = "package.yaml" - catalogCSVYaml = "csv.yaml" - crdYaml = "crd.yaml" - gitignore = ".gitignore" - versionfile = "version.go" - watches = "watches.yaml" - playbook = "playbook.yaml" - - // commands - galaxyInitCmd = initDir + "/" + galaxyInit - - // sdkImport is the operator-sdk import path. - sdkImport = "github.com/operator-framework/operator-sdk/pkg/sdk" - k8sutilImport = "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - versionImport = "github.com/operator-framework/operator-sdk/version" - packageChannel = "alpha" - catalogCRDTmplName = "deploy/olm-catalog/crd.yaml" - crdTmplName = "deploy/crd.yaml" - operatorTmplName = "deploy/operator.yaml" - rbacTmplName = "deploy/rbac.yaml" - crTmplName = "deploy/cr.yaml" - testYamlName = "deploy/test-pod.yaml" - saTmplName = "deploy/sa.yaml" - pluralSuffix = "s" -) - -type Generator struct { - // apiVersion is the kubernetes apiVersion that has the format of $GROUP_NAME/$VERSION. - apiVersion string - kind string - // operatorType is the type of operator to initialize - operatorType string - // generatePlaybook is a switch to set playbook instead of role in watches.yaml for Ansible Operator - generatePlaybook bool - // projectName is name of the new operator application - // and is also the name of the base directory. - projectName string - // repoPath is the project's repository path rooted under $GOPATH. - repoPath string -} - -// NewGenerator creates a new scaffold Generator. -func NewGenerator(apiVersion, kind, operatorType, projectName, repoPath string, generatePlaybook bool) *Generator { - return &Generator{ - apiVersion: apiVersion, - kind: kind, - operatorType: operatorType, - generatePlaybook: generatePlaybook, - projectName: projectName, - repoPath: repoPath, - } -} - -// Render generates the default project structure: -// -// ├── -// │ ├── cmd -// │ │ └── -// │ ├── config -// │ ├── deploy -// │ ├── pkg -// │ │ ├── apis -// │ │ │ └── // computed from apiDirName(apiVersion). -// │ │ │ └── // computed from version(apiVersion). -// │ │ └── stub -// │ ├── tmp -// │ | ├── build -// │ | └── codegen -// │ └── version -// -// Render generates the following project structure for Operator type Ansible -// ├── -// │ ├── Dockerfile -// │ ├── roles -// │ │ └── -// │ ├── watches.yaml -// │ ├── deploy -// │ │ ├── -CRD.yaml -// │ │ ├── rbac.yaml -// │ │ ├── operator.yaml -// │ ├ └── cr.yaml - -func (g *Generator) Render() error { - switch g.operatorType { - case ansibleOperatorType: - if err := g.renderAnsibleOperator(); err != nil { - return err - } - case goOperatorType: - if err := g.renderGoOperator(); err != nil { - return err - } - default: - return fmt.Errorf("unexpected operator type [%v]", g.operatorType) - } - return nil -} - -func (g *Generator) renderAnsibleOperator() error { - if err := g.generateAnsibleDirStructure(); err != nil { - return err - } - if err := g.renderTmp(); err != nil { - return err - } - if err := g.renderRole(); err != nil { - return err - } - if err := g.renderWatches(); err != nil { - return err - } - if err := g.renderPlaybook(); err != nil { - return err - } - return g.renderDeploy() -} - -func (g *Generator) renderRole() error { - fmt.Printf("Rendering Ansible Galaxy role [%v/%v/%v]...\n", g.projectName, rolesDir, g.kind) - agcmd := exec.Command(filepath.Join(g.projectName, galaxyInitCmd)) - output, err := agcmd.CombinedOutput() - if err != nil { - fmt.Printf("Rendering Ansible Galaxy role failed: [%v], Output: %s", err.Error(), string(output)) - return err - } - // Clean up tmp/init - fmt.Printf("Cleaning up %v\n", filepath.Join(g.projectName, initDir)) - err = os.RemoveAll(filepath.Join(g.projectName, initDir)) - if err != nil { - return err - } - return nil -} - -func (g *Generator) renderPlaybook() error { - if !g.generatePlaybook { - return nil - } - buf := &bytes.Buffer{} - bTd := tmplData{ - Kind: g.kind, - } - - if err := renderFile(buf, playbook, playbookTmpl, bTd); err != nil { - return err - } - if err := writeFileAndPrint(filepath.Join(g.projectName, playbook), buf.Bytes(), defaultFileMode); err != nil { - return err - } - return nil -} - -func (g *Generator) renderWatches() error { - buf := &bytes.Buffer{} - bTd := tmplData{ - GroupName: groupName(g.apiVersion), - Version: version(g.apiVersion), - Kind: g.kind, - GeneratePlaybook: g.generatePlaybook, - } - - if err := renderFile(buf, watches, watchesTmpl, bTd); err != nil { - return err - } - if err := writeFileAndPrint(filepath.Join(g.projectName, watches), buf.Bytes(), defaultFileMode); err != nil { - return err - } - return nil -} - -func (g *Generator) renderGoOperator() error { - if err := g.generateGoDirStructure(); err != nil { - return err - } - - if err := g.renderProject(); err != nil { - return err - } - - if err := g.renderCmd(); err != nil { - return err - } - if err := g.renderConfig(); err != nil { - return err - } - if err := g.renderDeploy(); err != nil { - return err - } - if err := g.renderPkg(); err != nil { - return err - } - if err := g.renderTmp(); err != nil { - return err - } - if err := g.renderVersion(); err != nil { - return err - } - return g.renderGoDep() -} - -func (g *Generator) renderProject() error { - return renderProjectGitignore(g.projectName) -} - -func renderProjectGitignore(projectName string) error { - gitignoreFile := filepath.Join(projectName, gitignore) - buf := &bytes.Buffer{} - if _, err := buf.Write([]byte(projectGitignoreTmpl)); err != nil { - return err - } - - return writeFileAndPrint(gitignoreFile, buf.Bytes(), defaultFileMode) -} - -func (g *Generator) renderGoDep() error { - buf := &bytes.Buffer{} - if err := renderGopkgTomlFile(buf); err != nil { - return err - } - return writeFileAndPrint(filepath.Join(g.projectName, gopkgtoml), buf.Bytes(), defaultFileMode) -} - -func (g *Generator) renderCmd() error { - cpDir := filepath.Join(g.projectName, cmdDir, g.projectName) - return renderCmdFiles(cpDir, g.repoPath, g.apiVersion, g.kind) -} - -func renderCmdFiles(cmdProjectDir, repoPath, apiVersion, kind string) error { - td := tmplData{ - OperatorSDKImport: sdkImport, - StubImport: filepath.Join(repoPath, stubDir), - K8sutilImport: k8sutilImport, - SDKVersionImport: versionImport, - APIVersion: apiVersion, - Kind: kind, - } - - return renderWriteFile(filepath.Join(cmdProjectDir, main), "cmd//main.go", mainTmpl, td) -} - -func (g *Generator) renderConfig() error { - cp := filepath.Join(g.projectName, configDir) - return renderConfigFiles(cp, g.apiVersion, g.kind, g.projectName) -} - -func renderConfigFiles(configDir, apiVersion, kind, projectName string) error { - buf := &bytes.Buffer{} - if err := renderConfigFile(buf, apiVersion, kind, projectName); err != nil { - return err - } - return writeFileAndPrint(filepath.Join(configDir, config), buf.Bytes(), defaultFileMode) -} - -func (g *Generator) renderDeploy() error { - dp := filepath.Join(g.projectName, deployDir) - return renderDeployFiles(dp, g.projectName, g.apiVersion, g.kind, g.operatorType) -} - -func renderRBAC(deployDir, projectName, groupName string) error { - td := tmplData{ - ProjectName: projectName, - GroupName: groupName, - } - - return renderWriteFile(filepath.Join(deployDir, rbacYaml), rbacTmplName, rbacYamlTmpl, td) -} - -func RenderDeployCrdFiles(deployPath, apiVersion, kind string) error { - crTd := tmplData{ - APIVersion: apiVersion, - Kind: kind, - } - crFilePath := filepath.Join(deployPath, - groupName(apiVersion)+"_"+version(apiVersion)+"_"+strings.ToLower(kind)+"_cr.yaml") - if err := renderWriteFile(crFilePath, crFilePath, crYamlTmpl, crTd); err != nil { - return err - } - - crdTd := tmplData{ - Kind: kind, - KindSingular: strings.ToLower(kind), - KindPlural: toPlural(strings.ToLower(kind)), - GroupName: groupName(apiVersion), - Version: version(apiVersion), - } - crdFilePath := filepath.Join(deployPath, - groupName(apiVersion)+"_"+version(apiVersion)+"_"+strings.ToLower(kind)+"_crd.yaml") - return renderWriteFile(crdFilePath, crdFilePath, crdYamlTmpl, crdTd) -} - -func renderDeployFiles(deployDir, projectName, apiVersion, kind, operatorType string) error { - rbacTd := tmplData{ - ProjectName: projectName, - GroupName: groupName(apiVersion), - IsGoOperator: isGoOperator(operatorType), - } - if err := renderWriteFile(filepath.Join(deployDir, rbacYaml), rbacTmplName, rbacYamlTmpl, rbacTd); err != nil { - return err - } - - crdTd := tmplData{ - Kind: kind, - KindSingular: strings.ToLower(kind), - KindPlural: toPlural(strings.ToLower(kind)), - GroupName: groupName(apiVersion), - Version: version(apiVersion), - } - if err := renderWriteFile(filepath.Join(deployDir, crdYaml), crdTmplName, crdYamlTmpl, crdTd); err != nil { - return err - } - - crTd := tmplData{ - APIVersion: apiVersion, - Kind: kind, - } - if err := renderWriteFile(filepath.Join(deployDir, crYaml), crTmplName, crYamlTmpl, crTd); err != nil { - return err - } - - // Service account file is only needed for Go operator - if operatorType == goOperatorType { - saTd := tmplData{ - ProjectName: projectName, - } - if err := renderWriteFile(filepath.Join(deployDir, saYaml), saTmplName, saYamlTmpl, saTd); err != nil { - return err - } - } - - opTd := tmplData{ - ProjectName: projectName, - Image: "REPLACE_IMAGE", - MetricsPort: k8sutil.PrometheusMetricsPort, - MetricsPortName: k8sutil.PrometheusMetricsPortName, - OperatorNameEnv: k8sutil.OperatorNameEnvVar, - IsGoOperator: isGoOperator(operatorType), - } - return renderWriteFile(filepath.Join(deployDir, "operator.yaml"), operatorTmplName, operatorYamlTmpl, opTd) -} - -func RenderTestYaml(c *Config, image string) error { - opTd := tmplData{ - ProjectName: c.ProjectName, - Image: image, - TestNamespaceEnv: test.TestNamespaceEnv, - } - return renderWriteFile(filepath.Join(deployDir, "test-pod.yaml"), testYamlName, testYamlTmpl, opTd) -} - -// RenderOlmCatalog generates catalog manifests "deploy/olm-catalog/*" -// The current working directory must be the project repository root -func RenderOlmCatalog(c *Config, image, version string) error { - // mkdir deploy/olm-catalog - repoPath, err := os.Getwd() - if err != nil { - return err - } - olmDir := filepath.Join(repoPath, olmCatalogDir) - - // deploy/olm-catalog/package.yaml - cpTd := tmplData{ - PackageName: strings.ToLower(c.Kind), - ChannelName: packageChannel, - CurrentCSV: getCSVName(strings.ToLower(c.Kind), version), - } - path := filepath.Join(olmDir, catalogPackageYaml) - if err := renderWriteFile(path, catalogPackageYaml, catalogPackageTmpl, cpTd); err != nil { - return err - } - - // deploy/olm-catalog/crd.yaml - ccrdTd := tmplData{ - Kind: c.Kind, - KindSingular: strings.ToLower(c.Kind), - KindPlural: toPlural(strings.ToLower(c.Kind)), - GroupName: groupName(c.APIVersion), - Version: version, - } - path = filepath.Join(olmDir, crdYaml) - if err := renderWriteFile(path, catalogCRDTmplName, crdTmpl, ccrdTd); err != nil { - return err - } - - // deploy/olm-catalog/csv.yaml - ccsvTd := tmplData{ - Kind: c.Kind, - KindSingular: strings.ToLower(c.Kind), - KindPlural: toPlural(strings.ToLower(c.Kind)), - GroupName: groupName(c.APIVersion), - CRDVersion: version, - CSVName: getCSVName(strings.ToLower(c.Kind), version), - Image: image, - CatalogVersion: version, - ProjectName: c.ProjectName, - } - path = filepath.Join(olmDir, catalogCSVYaml) - return renderWriteFile(path, catalogCSVYaml, catalogCSVTmpl, ccsvTd) -} - -func getCSVName(name, version string) string { - return name + ".v" + version -} - -func (g *Generator) renderTmp() error { - switch g.operatorType { - case goOperatorType: - cDir := filepath.Join(g.projectName, codegenDir) - if err := renderCodegenFiles(cDir, g.repoPath, apiDirName(g.apiVersion), version(g.apiVersion), g.projectName); err != nil { - return err - } - case ansibleOperatorType: - iDir := filepath.Join(g.projectName, initDir) - if err := renderInitFiles(iDir, g.repoPath, g.projectName, g.kind); err != nil { - return err - } - } - - bDir := filepath.Join(g.projectName, buildDir) - return renderBuildFiles(bDir, g.repoPath, g.projectName, g.operatorType, g.generatePlaybook) -} - -func (g *Generator) renderVersion() error { - td := tmplData{ - VersionNumber: "0.0.1", - } - - return renderWriteFile(filepath.Join(g.projectName, versionDir, versionfile), "version/version.go", versionTmpl, td) -} - -func renderBuildFiles(buildDir, repoPath, projectName, operatorType string, generatePlaybook bool) error { - var dockerFileTmplName string - switch operatorType { - case goOperatorType: - dockerFileTmplName = dockerFileTmpl - case ansibleOperatorType: - dockerFileTmplName = dockerFileAnsibleTmpl - } - - dTd := tmplData{ - ProjectName: projectName, - GeneratePlaybook: generatePlaybook, - } - - if err := renderWriteFile(filepath.Join(buildDir, dockerfile), "tmp/build/Dockerfile", dockerFileTmplName, dTd); err != nil { - return err - } - - return RenderTestingContainerFiles(buildDir, projectName) -} - -func RenderTestingContainerFiles(buildDir, projectName string) error { - dTd := tmplData{ - ProjectName: projectName, - } - if err := renderWriteFile(filepath.Join(buildDir, "test-framework", testingDockerfile), "tmp/build/test-framework/Dockerfile", testingDockerFileTmpl, dTd); err != nil { - return err - } - buf := &bytes.Buffer{} - if err := renderFile(buf, filepath.Join(buildDir, goTest), goTestScript, tmplData{}); err != nil { - return err - } - return writeFileAndPrint(filepath.Join(buildDir, goTest), buf.Bytes(), defaultExecFileMode) -} - -func renderInitFiles(initDir, repoPath, projectName, kind string) error { - buf := &bytes.Buffer{} - iTd := tmplData{ - Kind: kind, - Name: projectName, - } - if err := renderFile(buf, galaxyInitCmd, galaxyInitTmpl, iTd); err != nil { - return err - } - return writeFileAndPrint(filepath.Join(initDir, galaxyInit), buf.Bytes(), defaultExecFileMode) -} - -func renderCodegenFiles(codegenDir, repoPath, apiDirName, version, projectName string) error { - bTd := tmplData{ - ProjectName: projectName, - } - if err := renderWriteFile(filepath.Join(codegenDir, boilerplate), "codegen/boilerplate.go.txt", boilerplateTmpl, bTd); err != nil { - return err - } - - buf := &bytes.Buffer{} - ugTd := tmplData{ - RepoPath: repoPath, - APIDirName: apiDirName, - Version: version, - } - if err := renderFile(buf, "codegen/update-generated.sh", updateGeneratedTmpl, ugTd); err != nil { - return err - } - return writeFileAndPrint(filepath.Join(codegenDir, updateGenerated), buf.Bytes(), defaultExecFileMode) -} - -func (g *Generator) renderPkg() error { - v := version(g.apiVersion) - adn := apiDirName(g.apiVersion) - apiDir := filepath.Join(g.projectName, apisDir, adn, v) - if err := renderAPIFiles(apiDir, groupName(g.apiVersion), v, g.kind); err != nil { - return err - } - - sDir := filepath.Join(g.projectName, stubDir) - return renderStubFiles(sDir, g.repoPath, g.kind, adn, v) -} - -func renderAPIFiles(apiDir, groupName, version, kind string) error { - adTd := tmplData{ - GroupName: groupName, - Version: version, - } - if err := renderWriteFile(filepath.Join(apiDir, doc), "apis///doc.go", apiDocTmpl, adTd); err != nil { - return err - } - - arTd := tmplData{ - Kind: kind, - KindPlural: toPlural(strings.ToLower(kind)), - GroupName: groupName, - Version: version, - } - if err := renderWriteFile(filepath.Join(apiDir, register), "apis///register.go", apiRegisterTmpl, arTd); err != nil { - return err - } - - atTd := tmplData{ - Kind: kind, - Version: version, - } - return renderWriteFile(filepath.Join(apiDir, types), "apis///types.go", apiTypesTmpl, atTd) -} - -func renderStubFiles(stubDir, repoPath, kind, apiDirName, version string) error { - td := tmplData{ - OperatorSDKImport: sdkImport, - RepoPath: repoPath, - Kind: kind, - APIDirName: apiDirName, - Version: version, - } - return renderWriteFile(filepath.Join(stubDir, handler), "stub/handler.go", handlerTmpl, td) -} - -type tmplData struct { - VersionNumber string - - OperatorSDKImport string - StubImport string - K8sutilImport string - SDKVersionImport string - - APIVersion string - Kind string - - RepoPath string - APIDirName string - Version string - - ProjectName string - GroupName string - - // singular name to be used as an alias on the CLI and for display - KindSingular string - // plural name to be used in the URL: /apis/// - KindPlural string - - Image string - Name string - MetricsPort int - MetricsPortName string - OperatorNameEnv string - - PackageName string - ChannelName string - CurrentCSV string - - CRDVersion string - CSVName string - CatalogVersion string - - // for test framework - TestNamespaceEnv string - - // Ansible Operator specific vars - GeneratePlaybook bool - IsGoOperator bool -} - -// Creates all the necesary directories for the generated files for Go Operator -func (g *Generator) generateGoDirStructure() error { - dirsToCreate := []string{ - g.projectName, - filepath.Join(g.projectName, cmdDir, g.projectName), - filepath.Join(g.projectName, configDir), - filepath.Join(g.projectName, deployDir), - filepath.Join(g.projectName, olmCatalogDir), - filepath.Join(g.projectName, buildDir), - filepath.Join(g.projectName, codegenDir), - filepath.Join(g.projectName, dockerTestDir), - filepath.Join(g.projectName, versionDir), - filepath.Join(g.projectName, apisDir, apiDirName(g.apiVersion), version(g.apiVersion)), - filepath.Join(g.projectName, stubDir), - } - - for _, dir := range dirsToCreate { - if err := os.MkdirAll(dir, defaultDirFileMode); err != nil { - return err - } - } - - return nil -} - -// Creates all the necesary directories for the generated files for Ansible Operator -func (g *Generator) generateAnsibleDirStructure() error { - dirsToCreate := []string{ - g.projectName, - filepath.Join(g.projectName, deployDir), - filepath.Join(g.projectName, initDir), - filepath.Join(g.projectName, buildDir), - filepath.Join(g.projectName, rolesDir), - } - - for _, dir := range dirsToCreate { - if err := os.MkdirAll(dir, defaultDirFileMode); err != nil { - return err - } - } - - return nil -} - -// Renders a file given a template, and fills in template fields according to values passed in the tmplData struct -func renderFile(w io.Writer, fileLoc string, fileTmpl string, info tmplData) error { - t := template.New(fileLoc) - - t, err := t.Parse(fileTmpl) - if err != nil { - return err - } - - return t.Execute(w, info) -} - -// version extracts the VERSION from the given apiVersion ($GROUP_NAME/$VERSION). -func version(apiVersion string) string { - return strings.Split(apiVersion, "/")[1] -} - -// groupName extracts the GROUP_NAME from the given apiVersion ($GROUP_NAME/$VERSION). -func groupName(apiVersion string) string { - return strings.Split(apiVersion, "/")[0] -} - -// apiDirName extracts the name of api directory under ../apis/ folder -// from the given apiVersion ($GROUP_NAME/$VERSION). -// the first word separated with "." of the GROUP_NAME is the api directory name. -// for example, -// apiDirName("app.example.com/v1alpha1") => "app". -func apiDirName(apiVersion string) string { - return strings.Split(groupName(apiVersion), ".")[0] -} - -// Writes file to a given path and data buffer, as well as prints out a message confirming creation of a file -func writeFileAndPrint(filePath string, data []byte, fileMode os.FileMode) error { - if err := os.MkdirAll(filepath.Dir(filePath), defaultDirFileMode); err != nil { - return err - } - if err := ioutil.WriteFile(filePath, data, fileMode); err != nil { - return err - } - fmt.Printf("Create %v \n", filePath) - return nil -} - -// Combines steps of creating buffer, writing to buffer, and writing buffer to file in one call -func renderWriteFile(filePath string, fileLoc string, fileTmpl string, info tmplData) error { - buf := &bytes.Buffer{} - - if err := renderFile(buf, fileLoc, fileTmpl, info); err != nil { - return err - } - - if err := writeFileAndPrint(filePath, buf.Bytes(), defaultFileMode); err != nil { - return err - } - - return nil -} - -func isGoOperator(operatorType string) bool { - if operatorType == "go" { - return true - } - return false -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/generator_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/generator_test.go deleted file mode 100644 index 083727417..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/generator_test.go +++ /dev/null @@ -1,745 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -import ( - "bytes" - "io/ioutil" - "os" - "path/filepath" - "strings" - "testing" - - k8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - "github.com/sergi/go-diff/diffmatchpatch" -) - -const updateGeneratedExp = `#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -vendor/k8s.io/code-generator/generate-groups.sh \ -deepcopy \ -github.com/example-inc/app-operator/pkg/generated \ -github.com/example-inc/app-operator/pkg/apis \ -app:v1alpha1 \ ---go-header-file "./tmp/codegen/boilerplate.go.txt" -` - -func TestCodeGen(t *testing.T) { - buf := &bytes.Buffer{} - td := tmplData{ - RepoPath: appRepoPath, - APIDirName: appApiDirName, - Version: appVersion, - } - if err := renderFile(buf, "codegen/update-generated.sh", updateGeneratedTmpl, td); err != nil { - t.Error(err) - return - } - if updateGeneratedExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(updateGeneratedExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } -} - -const versionExp = `package version - -var ( - Version = "0.9.2+git" -) -` - -func TestGenVersion(t *testing.T) { - buf := &bytes.Buffer{} - if err := renderFile(buf, "version/version.go", versionTmpl, tmplData{VersionNumber: "0.9.2+git"}); err != nil { - t.Error(err) - return - } - if versionExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(versionExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } -} - -const handlerExp = `package stub - -import ( - "context" - - "github.com/example-inc/app-operator/pkg/apis/app/v1alpha1" - - "github.com/operator-framework/operator-sdk/pkg/sdk" - "github.com/sirupsen/logrus" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "github.com/prometheus/client_golang/prometheus" -) - -func NewHandler(m *Metrics) sdk.Handler { - return &Handler{ - metrics: m, - } -} - -type Metrics struct { - operatorErrors prometheus.Counter -} - -type Handler struct { - // Metrics example - metrics *Metrics - - // Fill me -} - -func (h *Handler) Handle(ctx context.Context, event sdk.Event) error { - switch o := event.Object.(type) { - case *v1alpha1.AppService: - err := sdk.Create(newbusyBoxPod(o)) - if err != nil && !errors.IsAlreadyExists(err) { - logrus.Errorf("failed to create busybox pod : %v", err) - // increment error metric - h.metrics.operatorErrors.Inc() - return err - } - } - return nil -} - -// newbusyBoxPod demonstrates how to create a busybox pod -func newbusyBoxPod(cr *v1alpha1.AppService) *corev1.Pod { - labels := map[string]string{ - "app": "busy-box", - } - return &corev1.Pod{ - TypeMeta: metav1.TypeMeta{ - Kind: "Pod", - APIVersion: "v1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: "busy-box", - Namespace: cr.Namespace, - OwnerReferences: []metav1.OwnerReference{ - *metav1.NewControllerRef(cr, schema.GroupVersionKind{ - Group: v1alpha1.SchemeGroupVersion.Group, - Version: v1alpha1.SchemeGroupVersion.Version, - Kind: "AppService", - }), - }, - Labels: labels, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: "busybox", - Image: "docker.io/busybox", - Command: []string{"sleep", "3600"}, - }, - }, - }, - } -} - -func RegisterOperatorMetrics() (*Metrics, error) { - operatorErrors := prometheus.NewCounter(prometheus.CounterOpts{ - Name: "memcached_operator_reconcile_errors_total", - Help: "Number of errors that occurred while reconciling the memcached deployment", - }) - err := prometheus.Register(operatorErrors) - if err != nil { - return nil, err - } - return &Metrics{operatorErrors: operatorErrors}, nil -} -` - -func TestGenHandler(t *testing.T) { - buf := &bytes.Buffer{} - - td := tmplData{ - OperatorSDKImport: sdkImport, - RepoPath: appRepoPath, - Kind: appKind, - APIDirName: appApiDirName, - Version: appVersion, - } - - if err := renderFile(buf, "stub/handler.go", handlerTmpl, td); err != nil { - t.Error(err) - return - } - if handlerExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(handlerExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } -} - -const crdYamlExp = `apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: appservices.app.example.com -spec: - group: app.example.com - names: - kind: AppService - listKind: AppServiceList - plural: appservices - singular: appservice - scope: Namespaced - version: v1alpha1 -` - -const operatorYamlExp = `apiVersion: apps/v1 -kind: Deployment -metadata: - name: app-operator -spec: - replicas: 1 - selector: - matchLabels: - name: app-operator - template: - metadata: - labels: - name: app-operator - spec: - serviceAccountName: app-operator - containers: - - name: app-operator - image: quay.io/example-inc/app-operator:0.0.1 - ports: - - containerPort: 60000 - name: metrics - command: - - app-operator - imagePullPolicy: Always - env: - - name: WATCH_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: OPERATOR_NAME - value: "app-operator" -` - -const ansibleOperatorYamlExp = `apiVersion: apps/v1 -kind: Deployment -metadata: - name: app-operator -spec: - replicas: 1 - selector: - matchLabels: - name: app-operator - template: - metadata: - labels: - name: app-operator - spec: - containers: - - name: app-operator - image: quay.io/example-inc/app-operator:0.0.1 - ports: - - containerPort: 60000 - name: metrics - imagePullPolicy: Always - env: - - name: WATCH_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: OPERATOR_NAME - value: "app-operator" -` - -const rbacYamlExp = `kind: Role -apiVersion: rbac.authorization.k8s.io/v1beta1 -metadata: - name: app-operator -rules: -- apiGroups: - - app.example.com - resources: - - "*" - verbs: - - "*" -- apiGroups: - - "" - resources: - - pods - - services - - endpoints - - persistentvolumeclaims - - events - - configmaps - - secrets - verbs: - - "*" -- apiGroups: - - apps - resources: - - deployments - - daemonsets - - replicasets - - statefulsets - verbs: - - "*" - ---- - -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 -metadata: - name: app-operator -subjects: -- kind: ServiceAccount - name: app-operator -roleRef: - kind: Role - name: app-operator - apiGroup: rbac.authorization.k8s.io -` - -const rbacYamlAnsibleExp = `kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1beta1 -metadata: - name: app-operator -rules: -- apiGroups: - - app.example.com - resources: - - "*" - verbs: - - "*" -- apiGroups: - - "" - resources: - - pods - - services - - endpoints - - persistentvolumeclaims - - events - - configmaps - - secrets - verbs: - - "*" -- apiGroups: - - apps - resources: - - deployments - - daemonsets - - replicasets - - statefulsets - verbs: - - "*" - ---- - -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 -metadata: - name: app-operator -subjects: -- kind: ServiceAccount - name: default - namespace: default -roleRef: - kind: ClusterRole - name: app-operator - apiGroup: rbac.authorization.k8s.io -` - -const saYamlExp = `apiVersion: v1 -kind: ServiceAccount -metadata: - name: app-operator -` - -func TestGenDeploy(t *testing.T) { - buf := &bytes.Buffer{} - crdTd := tmplData{ - Kind: appKind, - KindSingular: strings.ToLower(appKind), - KindPlural: toPlural(strings.ToLower(appKind)), - GroupName: groupName(appAPIVersion), - Version: version(appAPIVersion), - } - if err := renderFile(buf, crdTmplName, crdTmpl, crdTd); err != nil { - t.Error(err) - } - if crdYamlExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(crdYamlExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } - - buf = &bytes.Buffer{} - td := tmplData{ - ProjectName: appProjectName, - Image: appImage, - MetricsPort: k8sutil.PrometheusMetricsPort, - MetricsPortName: k8sutil.PrometheusMetricsPortName, - OperatorNameEnv: k8sutil.OperatorNameEnvVar, - IsGoOperator: true, - } - if err := renderFile(buf, operatorTmplName, operatorYamlTmpl, td); err != nil { - t.Error(err) - } - if operatorYamlExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(operatorYamlExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } - - // Test Ansible Operator operator.yaml - buf = &bytes.Buffer{} - td = tmplData{ - ProjectName: appProjectName, - Image: appImage, - MetricsPort: k8sutil.PrometheusMetricsPort, - MetricsPortName: k8sutil.PrometheusMetricsPortName, - OperatorNameEnv: k8sutil.OperatorNameEnvVar, - IsGoOperator: false, - } - if err := renderFile(buf, operatorTmplName, operatorYamlTmpl, td); err != nil { - t.Error(err) - } - if ansibleOperatorYamlExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(ansibleOperatorYamlExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } - - buf = &bytes.Buffer{} - if err := renderFile(buf, rbacTmplName, rbacYamlTmpl, tmplData{ProjectName: appProjectName, GroupName: appGroupName, IsGoOperator: true}); err != nil { - t.Error(err) - } - if rbacYamlExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(rbacYamlExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } - - // Test Ansible Operator rbac.yaml - buf = &bytes.Buffer{} - if err := renderFile(buf, rbacTmplName, rbacYamlTmpl, tmplData{ProjectName: appProjectName, GroupName: appGroupName, IsGoOperator: false}); err != nil { - t.Error(err) - } - if rbacYamlAnsibleExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(rbacYamlAnsibleExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } - buf = &bytes.Buffer{} - if err := renderFile(buf, saTmplName, saYamlTmpl, tmplData{ProjectName: appProjectName}); err != nil { - t.Error(err) - } - if saYamlExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(saYamlExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } -} - -const registerExp = `package v1alpha1 - -import ( - sdkK8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - version = "v1alpha1" - groupName = "app.example.com" -) - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme - // SchemeGroupVersion is the group version used to register these objects. - SchemeGroupVersion = schema.GroupVersion{Group: groupName, Version: version} -) - -func init() { - sdkK8sutil.AddToSDKScheme(AddToScheme) -} - -// addKnownTypes adds the set of types defined in this package to the supplied scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &AppService{}, - &AppServiceList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} -` - -func TestGenRegister(t *testing.T) { - buf := &bytes.Buffer{} - arTd := tmplData{ - Kind: appKind, - KindPlural: toPlural(strings.ToLower(appKind)), - GroupName: appGroupName, - Version: appVersion, - } - if err := renderFile(buf, "apis///register.go", apiRegisterTmpl, arTd); err != nil { - t.Error(err) - return - } - if registerExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(registerExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } -} - -const typesExp = `package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type AppServiceList struct { - metav1.TypeMeta ` + "`" + `json:",inline"` + "`\n" + - ` metav1.ListMeta ` + "`" + `json:"metadata"` + "`\n" + - ` Items []AppService ` + "`" + `json:"items"` + "`" + ` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type AppService struct { - metav1.TypeMeta ` + "`" + `json:",inline"` + "`\n" + - ` metav1.ObjectMeta ` + "`" + `json:"metadata"` + "`\n" + - ` Spec AppServiceSpec ` + "`" + `json:"spec"` + "`\n" + - ` Status AppServiceStatus ` + "`" + `json:"status,omitempty"` + "`" + ` -} - -type AppServiceSpec struct { - // Fill me -} -type AppServiceStatus struct { - // Fill me -} -` - -func TestGenTypes(t *testing.T) { - buf := &bytes.Buffer{} - atTd := tmplData{ - Kind: appKind, - Version: appVersion, - } - if err := renderFile(buf, "apis///types.go", apiTypesTmpl, atTd); err != nil { - t.Error(err) - return - } - if typesExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(typesExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } -} - -const mainExp = `package main - -import ( - "context" - "runtime" - "time" - - stub "github.com/example-inc/app-operator/pkg/stub" - sdk "github.com/operator-framework/operator-sdk/pkg/sdk" - k8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - sdkVersion "github.com/operator-framework/operator-sdk/version" - - "github.com/sirupsen/logrus" - _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" -) - -func printVersion() { - logrus.Infof("Go Version: %s", runtime.Version()) - logrus.Infof("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH) - logrus.Infof("operator-sdk Version: %v", sdkVersion.Version) -} - -func main() { - printVersion() - - sdk.ExposeMetricsPort() - metrics, err := stub.RegisterOperatorMetrics() - if err != nil { - logrus.Errorf("failed to register operator specific metrics: %v", err) - } - h := stub.NewHandler(metrics) - - resource := "app.example.com/v1alpha1" - kind := "AppService" - namespace, err := k8sutil.GetWatchNamespace() - if err != nil { - logrus.Fatalf("failed to get watch namespace: %v", err) - } - resyncPeriod := time.Duration(5) * time.Second - logrus.Infof("Watching %s, %s, %s, %d", resource, kind, namespace, resyncPeriod) - sdk.Watch(resource, kind, namespace, resyncPeriod) - sdk.Handle(h) - sdk.Run(context.TODO()) -} -` - -func TestGenMain(t *testing.T) { - buf := &bytes.Buffer{} - td := tmplData{ - OperatorSDKImport: sdkImport, - StubImport: filepath.Join(appRepoPath, stubDir), - K8sutilImport: k8sutilImport, - SDKVersionImport: versionImport, - APIVersion: appAPIVersion, - Kind: appKind, - } - if err := renderFile(buf, "cmd//main.go", mainTmpl, td); err != nil { - t.Error(err) - return - } - - if mainExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(mainExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } -} - -const buildExp = `#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -if ! which go > /dev/null; then - echo "golang needs to be installed" - exit 1 -fi - -BIN_DIR="$(pwd)/tmp/_output/bin" -mkdir -p ${BIN_DIR} -PROJECT_NAME="app-operator" -REPO_PATH="github.com/example-inc/app-operator" -BUILD_PATH="${REPO_PATH}/cmd/${PROJECT_NAME}" -TEST_PATH="${REPO_PATH}/${TEST_LOCATION}" -echo "building "${PROJECT_NAME}"..." -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ${BIN_DIR}/${PROJECT_NAME} $BUILD_PATH -if $ENABLE_TESTS ; then - echo "building "${PROJECT_NAME}-test"..." - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go test -c -o ${BIN_DIR}/${PROJECT_NAME}-test $TEST_PATH -fi -` - -const dockerFileExp = `FROM alpine:3.6 - -RUN adduser -D app-operator -USER app-operator - -ADD tmp/_output/bin/app-operator /usr/local/bin/app-operator -` - -const dockerFileAnsibleNoPlaybookExp = `FROM quay.io/water-hole/ansible-operator - -COPY roles/ ${HOME}/roles/ -COPY watches.yaml ${HOME}/watches.yaml -` - -const dockerFileAnsiblePlaybookExp = `FROM quay.io/water-hole/ansible-operator - -COPY roles/ ${HOME}/roles/ -COPY playbook.yaml ${HOME}/playbook.yaml -COPY watches.yaml ${HOME}/watches.yaml -` - -func TestGenBuild(t *testing.T) { - buf := &bytes.Buffer{} - dTd := tmplData{ - ProjectName: appProjectName, - } - if err := renderFile(buf, "tmp/build/Dockerfile", dockerFileTmpl, dTd); err != nil { - t.Error(err) - return - } - if dockerFileExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(dockerFileExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } - - // Test Ansible Operator Dockerfile with no playbook - buf = &bytes.Buffer{} - dTd = tmplData{ - ProjectName: appProjectName, - GeneratePlaybook: false, - } - if err := renderFile(buf, "tmp/build/Dockerfile", dockerFileAnsibleTmpl, dTd); err != nil { - t.Error(err) - return - } - if dockerFileAnsibleNoPlaybookExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(dockerFileAnsibleNoPlaybookExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } - - // Test Ansible Operator Dockerfile with playbook generation - buf = &bytes.Buffer{} - dTd = tmplData{ - ProjectName: appProjectName, - GeneratePlaybook: true, - } - if err := renderFile(buf, "tmp/build/Dockerfile", dockerFileAnsibleTmpl, dTd); err != nil { - t.Error(err) - return - } - if dockerFileAnsiblePlaybookExp != buf.String() { - dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(dockerFileAnsiblePlaybookExp, buf.String(), false) - t.Errorf("\nTest failed. Below is the diff of the expected vs actual results.\nRed text is missing and green text is extra.\n\n" + dmp.DiffPrettyText(diffs)) - } -} - -func TestWriteFileAndPrint(t *testing.T) { - deployDir, err := ioutil.TempDir("", "test-write-file-and-print") - if err != nil { - t.Fatal(err) - } - - defer os.RemoveAll(deployDir) - - olmCatalogPackagePath := filepath.Join(deployDir, olmCatalogDir, catalogPackageYaml) - if err = writeFileAndPrint(olmCatalogPackagePath, []byte("sometext"), defaultFileMode); err != nil { - t.Fatalf("\nTest failed. Failed to write file and print: %v", err) - } - if _, err := os.Stat(olmCatalogPackagePath); os.IsNotExist(err) { - t.Errorf("\nTest failed. Failed to create %s", olmCatalogPackagePath) - } -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/templates.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/templates.go deleted file mode 100644 index 0c91cabc1..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/templates.go +++ /dev/null @@ -1,728 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -// versionTmpl is the template for version/version.go. -const versionTmpl = `package version - -var ( - Version = "{{.VersionNumber}}" -) -` -const catalogPackageTmpl = `packageName: {{.PackageName}} -channels: -- name: {{.ChannelName}} - currentCSV: {{.CurrentCSV}} -` - -const crdTmpl = `apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: {{.KindPlural}}.{{.GroupName}} -spec: - group: {{.GroupName}} - names: - kind: {{.Kind}} - listKind: {{.Kind}}List - plural: {{.KindPlural}} - singular: {{.KindSingular}} - scope: Namespaced - version: {{.Version}} -` - -const catalogCSVTmpl = `apiVersion: operators.coreos.com/v1alpha1 -kind: ClusterServiceVersion -metadata: - name: {{.CSVName}} - namespace: placeholder -spec: - install: - strategy: deployment - spec: - permissions: - - serviceAccountName: {{.ProjectName}} - rules: - - apiGroups: - - {{.GroupName}} - resources: - - "*" - verbs: - - "*" - - apiGroups: - - "" - resources: - - pods - - services - - endpoints - - persistentvolumeclaims - - events - - configmaps - - secrets - verbs: - - "*" - - apiGroups: - - apps - resources: - - deployments - - daemonsets - - replicasets - - statefulsets - verbs: - - "*" - deployments: - - name: {{.ProjectName}} - spec: - replicas: 1 - selector: - matchLabels: - app: {{.ProjectName}} - template: - metadata: - labels: - app: {{.ProjectName}} - spec: - containers: - - name: {{.ProjectName}}-olm-owned - image: {{.Image}} - command: - - {{.ProjectName}} - imagePullPolicy: Always - env: - - name: MY_POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: MY_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - restartPolicy: Always - terminationGracePeriodSeconds: 5 - serviceAccountName: {{.ProjectName}} - serviceAccount: {{.ProjectName}} - customresourcedefinitions: - owned: - - description: Represents an instance of a {{.Kind}} application - displayName: {{.Kind}} Application - kind: {{.Kind}} - name: {{.KindPlural}}.{{.GroupName}} - version: {{.CRDVersion}} - version: {{.CatalogVersion}} - displayName: {{.Kind}} - labels: - olm-owner-enterprise-app: {{.ProjectName}} - olm-status-descriptors: {{.CSVName}} -` - -// mainTmpl is the template for cmd/main.go. -const mainTmpl = `package main - -import ( - "context" - "runtime" - "time" - - stub "{{.StubImport}}" - sdk "{{.OperatorSDKImport}}" - k8sutil "{{.K8sutilImport}}" - sdkVersion "{{.SDKVersionImport}}" - - "github.com/sirupsen/logrus" - _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" -) - -func printVersion() { - logrus.Infof("Go Version: %s", runtime.Version()) - logrus.Infof("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH) - logrus.Infof("operator-sdk Version: %v", sdkVersion.Version) -} - -func main() { - printVersion() - - sdk.ExposeMetricsPort() - metrics, err := stub.RegisterOperatorMetrics() - if err != nil { - logrus.Errorf("failed to register operator specific metrics: %v", err) - } - h := stub.NewHandler(metrics) - - resource := "{{.APIVersion}}" - kind := "{{.Kind}}" - namespace, err := k8sutil.GetWatchNamespace() - if err != nil { - logrus.Fatalf("failed to get watch namespace: %v", err) - } - resyncPeriod := time.Duration(5) * time.Second - logrus.Infof("Watching %s, %s, %s, %d", resource, kind, namespace, resyncPeriod) - sdk.Watch(resource, kind, namespace, resyncPeriod) - sdk.Handle(h) - sdk.Run(context.TODO()) -} -` - -// handlerTmpl is the template for stub/handler.go. -const handlerTmpl = `package stub - -import ( - "context" - - "{{.RepoPath}}/pkg/apis/{{.APIDirName}}/{{.Version}}" - - "{{.OperatorSDKImport}}" - "github.com/sirupsen/logrus" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" - "github.com/prometheus/client_golang/prometheus" -) - -func NewHandler(m *Metrics) sdk.Handler { - return &Handler{ - metrics: m, - } -} - -type Metrics struct { - operatorErrors prometheus.Counter -} - -type Handler struct { - // Metrics example - metrics *Metrics - - // Fill me -} - -func (h *Handler) Handle(ctx context.Context, event sdk.Event) error { - switch o := event.Object.(type) { - case *{{.Version}}.{{.Kind}}: - err := sdk.Create(newbusyBoxPod(o)) - if err != nil && !errors.IsAlreadyExists(err) { - logrus.Errorf("failed to create busybox pod : %v", err) - // increment error metric - h.metrics.operatorErrors.Inc() - return err - } - } - return nil -} - -// newbusyBoxPod demonstrates how to create a busybox pod -func newbusyBoxPod(cr *{{.Version}}.{{.Kind}}) *corev1.Pod { - labels := map[string]string{ - "app": "busy-box", - } - return &corev1.Pod{ - TypeMeta: metav1.TypeMeta{ - Kind: "Pod", - APIVersion: "v1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: "busy-box", - Namespace: cr.Namespace, - OwnerReferences: []metav1.OwnerReference{ - *metav1.NewControllerRef(cr, schema.GroupVersionKind{ - Group: {{.Version}}.SchemeGroupVersion.Group, - Version: {{.Version}}.SchemeGroupVersion.Version, - Kind: "{{.Kind}}", - }), - }, - Labels: labels, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: "busybox", - Image: "docker.io/busybox", - Command: []string{"sleep", "3600"}, - }, - }, - }, - } -} - -func RegisterOperatorMetrics() (*Metrics, error) { - operatorErrors := prometheus.NewCounter(prometheus.CounterOpts{ - Name: "memcached_operator_reconcile_errors_total", - Help: "Number of errors that occurred while reconciling the memcached deployment", - }) - err := prometheus.Register(operatorErrors) - if err != nil { - return nil, err - } - return &Metrics{operatorErrors: operatorErrors}, nil -} -` - -const gopkgTomlTmpl = ` -# Force dep to vendor the code generators, which aren't imported just used at dev time. -# Picking a subpackage with Go code won't be necessary once https://github.com/golang/dep/pull/1545 is merged. -required = [ - "k8s.io/code-generator/cmd/defaulter-gen", - "k8s.io/code-generator/cmd/deepcopy-gen", - "k8s.io/code-generator/cmd/conversion-gen", - "k8s.io/code-generator/cmd/client-gen", - "k8s.io/code-generator/cmd/lister-gen", - "k8s.io/code-generator/cmd/informer-gen", - "k8s.io/code-generator/cmd/openapi-gen", - "k8s.io/gengo/args", -] - -[[override]] - name = "k8s.io/code-generator" - # revision for tag "kubernetes-1.11.2" - revision = "6702109cc68eb6fe6350b83e14407c8d7309fd1a" - -[[override]] - name = "k8s.io/api" - # revision for tag "kubernetes-1.11.2" - revision = "2d6f90ab1293a1fb871cf149423ebb72aa7423aa" - -[[override]] - name = "k8s.io/apiextensions-apiserver" - # revision for tag "kubernetes-1.11.2" - revision = "408db4a50408e2149acbd657bceb2480c13cb0a4" - -[[override]] - name = "k8s.io/apimachinery" - # revision for tag "kubernetes-1.11.2" - revision = "103fd098999dc9c0c88536f5c9ad2e5da39373ae" - -[[override]] - name = "k8s.io/client-go" - # revision for tag "kubernetes-1.11.2" - revision = "1f13a808da65775f22cbf47862c4e5898d8f4ca1" - -[[override]] - name = "sigs.k8s.io/controller-runtime" - version = "v0.1.3" - -[prune] - go-tests = true - non-go = true - unused-packages = true - - [[prune.project]] - name = "k8s.io/code-generator" - non-go = false - unused-packages = false - -[[constraint]] - name = "github.com/operator-framework/operator-sdk" - # The version rule is used for a specific release and the master branch for in between releases. - # branch = "master" #osdk_branch_annotation - version = "=v0.0.7" #osdk_version_annotation -` - -const projectGitignoreTmpl = ` -# Temporary Build Files -tmp/_output -tmp/_test - - -# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode - -### Emacs ### -# -*- mode: gitignore; -*- -*~ -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -*.elc -auto-save-list -tramp -.\#* - -# Org-mode -.org-id-locations -*_archive - -# flymake-mode -*_flymake.* - -# eshell files -/eshell/history -/eshell/lastdir - -# elpa packages -/elpa/ - -# reftex files -*.rel - -# AUCTeX auto folder -/auto/ - -# cask packages -.cask/ -dist/ - -# Flycheck -flycheck_*.el - -# server auth directory -/server/ - -# projectiles files -.projectile -projectile-bookmarks.eld - -# directory configuration -.dir-locals.el - -# saveplace -places - -# url cache -url/cache/ - -# cedet -ede-projects.el - -# smex -smex-items - -# company-statistics -company-statistics-cache.el - -# anaconda-mode -anaconda-mode/ - -### Go ### -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, build with 'go test -c' -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -### Vim ### -# swap -.sw[a-p] -.*.sw[a-p] -# session -Session.vim -# temporary -.netrwhist -# auto-generated tag files -tags - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -.history - - -# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode -` -const crdYamlTmpl = `apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: {{.KindPlural}}.{{.GroupName}} -spec: - group: {{.GroupName}} - names: - kind: {{.Kind}} - listKind: {{.Kind}}List - plural: {{.KindPlural}} - singular: {{.KindSingular}} - scope: Namespaced - version: {{.Version}} -` - -const testYamlTmpl = `apiVersion: v1 -kind: Pod -metadata: - name: {{.ProjectName}}-test -spec: - restartPolicy: Never - containers: - - name: {{.ProjectName}}-test - image: {{.Image}} - imagePullPolicy: Always - command: ["/go-test.sh"] - env: - - name: {{.TestNamespaceEnv}} - valueFrom: - fieldRef: - fieldPath: metadata.namespace -` - -const operatorYamlTmpl = `apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{.ProjectName}} -spec: - replicas: 1 - selector: - matchLabels: - name: {{.ProjectName}} - template: - metadata: - labels: - name: {{.ProjectName}} - spec: -{{- if .IsGoOperator }} - serviceAccountName: {{.ProjectName}}{{ end }} - containers: - - name: {{.ProjectName}} - image: {{.Image}} - ports: - - containerPort: {{.MetricsPort}} - name: {{.MetricsPortName}} -{{ if .IsGoOperator }} command: - - {{.ProjectName}} -{{ end }} imagePullPolicy: Always - env: - - name: WATCH_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: {{.OperatorNameEnv}} - value: "{{.ProjectName}}" -` - -// For Ansible Operator we are assuming namespace: default on ClusterRoleBinding -// Documentation will tell user to update -const rbacYamlTmpl = `{{- if .IsGoOperator }}kind: Role -{{- else -}} -kind: ClusterRole{{ end }} -apiVersion: rbac.authorization.k8s.io/v1beta1 -metadata: - name: {{.ProjectName}} -rules: -- apiGroups: - - {{.GroupName}} - resources: - - "*" - verbs: - - "*" -- apiGroups: - - "" - resources: - - pods - - services - - endpoints - - persistentvolumeclaims - - events - - configmaps - - secrets - verbs: - - "*" -- apiGroups: - - apps - resources: - - deployments - - daemonsets - - replicasets - - statefulsets - verbs: - - "*" - ---- -{{ if .IsGoOperator }} -kind: RoleBinding -{{- else }} -kind: ClusterRoleBinding{{ end }} -apiVersion: rbac.authorization.k8s.io/v1beta1 -metadata: - name: {{.ProjectName}} -subjects: -- kind: ServiceAccount -{{- if .IsGoOperator }} - name: {{.ProjectName}} -{{- else }} - name: default - namespace: default{{ end }} -roleRef: -{{- if .IsGoOperator }} - kind: Role -{{- else }} - kind: ClusterRole{{ end }} - name: {{.ProjectName}} - apiGroup: rbac.authorization.k8s.io -` - -const saYamlTmpl = `apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{.ProjectName}} -` - -const crYamlTmpl = `apiVersion: "{{.APIVersion}}" -kind: "{{.Kind}}" -metadata: - name: "example" -` -const boilerplateTmpl = ` -` - -const updateGeneratedTmpl = `#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -vendor/k8s.io/code-generator/generate-groups.sh \ -deepcopy \ -{{.RepoPath}}/pkg/generated \ -{{.RepoPath}}/pkg/apis \ -{{.APIDirName}}:{{.Version}} \ ---go-header-file "./tmp/codegen/boilerplate.go.txt" -` - -const goTestScript = `#!/bin/sh - -memcached-operator-test -test.parallel=1 -test.failfast -root=/ -kubeconfig=incluster -namespacedMan=namespaced.yaml -test.v -` - -const dockerFileTmpl = `FROM alpine:3.6 - -RUN adduser -D {{.ProjectName}} -USER {{.ProjectName}} - -ADD tmp/_output/bin/{{.ProjectName}} /usr/local/bin/{{.ProjectName}} -` - -const testingDockerFileTmpl = `ARG BASEIMAGE - -FROM ${BASEIMAGE} - -ADD tmp/_output/bin/memcached-operator-test /usr/local/bin/memcached-operator-test -ARG NAMESPACEDMAN -ADD $NAMESPACEDMAN /namespaced.yaml -ADD tmp/build/go-test.sh /go-test.sh -` - -// Ansible Operator files -const dockerFileAnsibleTmpl = `FROM quay.io/water-hole/ansible-operator - -COPY roles/ ${HOME}/roles/ -{{- if .GeneratePlaybook }} -COPY playbook.yaml ${HOME}/playbook.yaml{{ end }} -COPY watches.yaml ${HOME}/watches.yaml -` - -const watchesTmpl = `--- -- version: {{.Version}} - group: {{.GroupName}} - kind: {{.Kind}} -{{ if .GeneratePlaybook }} playbook: /opt/ansible/playbook.yaml{{ else }} role: /opt/ansible/roles/{{.Kind}}{{ end }} -` - -const playbookTmpl = `- hosts: localhost - gather_facts: no - tasks: - - import_role: - name: "{{.Kind}}" -` - -const galaxyInitTmpl = `#!/usr/bin/env bash - -if ! which ansible-galaxy > /dev/null; then - echo "ansible needs to be installed" - exit 1 -fi - -echo "Initializing role skeleton..." -ansible-galaxy init --init-path={{.Name}}/roles/ {{.Kind}} -` - -// apiDocTmpl is the template for apis/../doc.go -const apiDocTmpl = `// +k8s:deepcopy-gen=package -// +groupName={{.GroupName}} -package {{.Version}} -` - -// apiRegisterTmpl is the template for apis/../register.go -const apiRegisterTmpl = `package {{.Version}} - -import ( - sdkK8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - version = "{{.Version}}" - groupName = "{{.GroupName}}" -) - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme - // SchemeGroupVersion is the group version used to register these objects. - SchemeGroupVersion = schema.GroupVersion{Group: groupName, Version: version} -) - -func init() { - sdkK8sutil.AddToSDKScheme(AddToScheme) -} - -// addKnownTypes adds the set of types defined in this package to the supplied scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &{{.Kind}}{}, - &{{.Kind}}List{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} -` - -// apiTypesTmpl is the template for apis/../types.go -const apiTypesTmpl = `package {{.Version}} - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type {{.Kind}}List struct { - metav1.TypeMeta ` + "`" + `json:",inline"` + "`\n" + - ` metav1.ListMeta ` + "`" + `json:"metadata"` + "`\n" + - ` Items []{{.Kind}} ` + "`" + `json:"items"` + "`" + ` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type {{.Kind}} struct { - metav1.TypeMeta ` + "`" + `json:",inline"` + "`\n" + - ` metav1.ObjectMeta ` + "`" + `json:"metadata"` + "`\n" + - ` Spec {{.Kind}}Spec ` + "`" + `json:"spec"` + "`\n" + - ` Status {{.Kind}}Status ` + "`" + `json:"status,omitempty"` + "`" + ` -} - -type {{.Kind}}Spec struct { - // Fill me -} -type {{.Kind}}Status struct { - // Fill me -} -` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/test_constants.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/test_constants.go deleted file mode 100644 index 445d16ca2..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/test_constants.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -const ( - // test constants for app-operator - appImage = "quay.io/example-inc/app-operator:0.0.1" - appRepoPath = "github.com/example-inc/" + appProjectName - appKind = "AppService" - appApiDirName = "app" - appAPIVersion = appGroupName + "/" + appVersion - appVersion = "v1alpha1" - appGroupName = "app.example.com" - appProjectName = "app-operator" - errorMessage = "Want:\n%v\nGot:\n%v" -) diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/util.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/util.go deleted file mode 100644 index b60320a66..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/util.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -// toPlural makes "input" word plural. -// TODO: make this an input parameter as English grammar is highly variable -func toPlural(input string) string { - lastchar := input[len(input)-1:] - - if lastchar == "s" { - return input + "es" - } else if lastchar == "x" { - return input + "es" - } else if lastchar == "y" { - return input[0:len(input)-1] + "ies" - } - - if len(input) >= 2 { - lasttwo := input[len(input)-2:] - - if lasttwo == "ch" { - return input + "es" - } else if lasttwo == "sh" { - return input + "es" - } - } - - return input + "s" -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/util_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/generator/util_test.go deleted file mode 100644 index 4f2541575..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/generator/util_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 generator - -import ( - "testing" -) - -func TestToPlural(t *testing.T) { - var pluralTestData = []struct { - input string - expValue string - }{ - {"value", "values"}, - {"class", "classes"}, - {"box", "boxes"}, - {"brush", "brushes"}, - {"watch", "watches"}, - {"bunny", "bunnies"}, - } - - for _, testData := range pluralTestData { - output := toPlural(testData.input) - if output != testData.expValue { - t.Errorf(errorMessage, testData.expValue, output) - } - } -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/k8sclient/client.go b/vendor/github.com/operator-framework/operator-sdk/pkg/k8sclient/client.go deleted file mode 100644 index 466bd3bde..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/k8sclient/client.go +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 k8sclient - -import ( - "fmt" - "net" - "os" - "sync" - "time" - - "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/discovery/cached" - "k8s.io/client-go/dynamic" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/rest" - "k8s.io/client-go/restmapper" - "k8s.io/client-go/tools/clientcmd" -) - -type resourceClientFactory struct { - dynamicClient dynamic.Interface - restMapper *restmapper.DeferredDiscoveryRESTMapper - kubeClient kubernetes.Interface - kubeConfig *rest.Config -} - -var ( - // this stores the singleton in a package local - singletonFactory *resourceClientFactory - once sync.Once -) - -// Private constructor for once.Do -func newSingletonFactory() { - kubeClient, kubeConfig := mustNewKubeClientAndConfig() - cachedDiscoveryClient := cached.NewMemCacheClient(kubeClient.Discovery()) - restMapper := restmapper.NewDeferredDiscoveryRESTMapper(cachedDiscoveryClient) - restMapper.Reset() - - dynamicClient, err := dynamic.NewForConfig(kubeConfig) - if err != nil { - panic(err) - } - - singletonFactory = &resourceClientFactory{ - kubeClient: kubeClient, - kubeConfig: kubeConfig, - dynamicClient: dynamicClient, - restMapper: restMapper, - } - singletonFactory.runBackgroundCacheReset(1 * time.Minute) -} - -// GetResourceClient returns the resource client using a singleton factory -func GetResourceClient(apiVersion, kind, namespace string) (dynamic.ResourceInterface, string, error) { - once.Do(newSingletonFactory) - return singletonFactory.GetResourceClient(apiVersion, kind, namespace) -} - -// GetKubeClient returns the kubernetes client used to create the dynamic client -func GetKubeClient() kubernetes.Interface { - once.Do(newSingletonFactory) - return singletonFactory.kubeClient -} - -// GetKubeConfig returns the kubernetes rest configuration -func GetKubeConfig() *rest.Config { - once.Do(newSingletonFactory) - return singletonFactory.kubeConfig -} - -// GetResourceClient returns the dynamic client and pluralName for the resource specified by the apiVersion and kind -func (c *resourceClientFactory) GetResourceClient(apiVersion, kind, namespace string) (dynamic.ResourceInterface, string, error) { - gv, err := schema.ParseGroupVersion(apiVersion) - if err != nil { - return nil, "", fmt.Errorf("failed to parse apiVersion: %v", err) - } - gvk := schema.GroupVersionKind{ - Group: gv.Group, - Version: gv.Version, - Kind: kind, - } - - gvr, err := gvkToGVR(gvk, c.restMapper) - if err != nil { - return nil, "", fmt.Errorf("failed to get resource type: %v", err) - } - pluralName := gvr.Resource - - resourceClient := c.dynamicClient.Resource(*gvr).Namespace(namespace) - return resourceClient, pluralName, nil -} - -// apiResource consults the REST mapper to translate an tuple to a GroupVersionResource -func gvkToGVR(gvk schema.GroupVersionKind, restMapper *restmapper.DeferredDiscoveryRESTMapper) (*schema.GroupVersionResource, error) { - mapping, err := restMapper.RESTMapping(gvk.GroupKind(), gvk.Version) - if err != nil { - return nil, fmt.Errorf("failed to get the resource REST mapping for GroupVersionKind(%s): %v", gvk.String(), err) - } - return &mapping.Resource, nil -} - -// mustNewKubeClientAndConfig returns the in-cluster config and kubernetes client -// or if KUBERNETES_CONFIG is given an out of cluster config and client -func mustNewKubeClientAndConfig() (kubernetes.Interface, *rest.Config) { - var cfg *rest.Config - var err error - if os.Getenv(k8sutil.KubeConfigEnvVar) != "" { - cfg, err = outOfClusterConfig() - } else { - cfg, err = inClusterConfig() - } - if err != nil { - panic(err) - } - return kubernetes.NewForConfigOrDie(cfg), cfg -} - -// inClusterConfig returns the in-cluster config accessible inside a pod -func inClusterConfig() (*rest.Config, error) { - // Work around https://github.com/kubernetes/kubernetes/issues/40973 - // See https://github.com/coreos/etcd-operator/issues/731#issuecomment-283804819 - if len(os.Getenv("KUBERNETES_SERVICE_HOST")) == 0 { - addrs, err := net.LookupHost("kubernetes.default.svc") - if err != nil { - return nil, err - } - os.Setenv("KUBERNETES_SERVICE_HOST", addrs[0]) - } - if len(os.Getenv("KUBERNETES_SERVICE_PORT")) == 0 { - os.Setenv("KUBERNETES_SERVICE_PORT", "443") - } - return rest.InClusterConfig() -} - -func outOfClusterConfig() (*rest.Config, error) { - kubeconfig := os.Getenv(k8sutil.KubeConfigEnvVar) - config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) - return config, err -} - -// runBackgroundCacheReset - Starts the rest mapper cache reseting -// at a duration given. -func (c *resourceClientFactory) runBackgroundCacheReset(duration time.Duration) { - ticker := time.NewTicker(duration) - go func() { - for range ticker.C { - c.restMapper.Reset() - } - }() -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/util/k8sutil/constants.go b/vendor/github.com/operator-framework/operator-sdk/pkg/k8sutil/constants.go similarity index 100% rename from vendor/github.com/operator-framework/operator-sdk/pkg/util/k8sutil/constants.go rename to vendor/github.com/operator-framework/operator-sdk/pkg/k8sutil/constants.go diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/k8sutil/k8sutil.go b/vendor/github.com/operator-framework/operator-sdk/pkg/k8sutil/k8sutil.go new file mode 100644 index 000000000..3e6570853 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/k8sutil/k8sutil.go @@ -0,0 +1,83 @@ +// Copyright 2018 The Operator-SDK 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 k8sutil + +import ( + "fmt" + "os" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// GetWatchNamespace returns the namespace the operator should be watching for changes +func GetWatchNamespace() (string, error) { + ns, found := os.LookupEnv(WatchNamespaceEnvVar) + if !found { + return "", fmt.Errorf("%s must be set", WatchNamespaceEnvVar) + } + return ns, nil +} + +// GetOperatorName return the operator name +func GetOperatorName() (string, error) { + operatorName, found := os.LookupEnv(OperatorNameEnvVar) + if !found { + return "", fmt.Errorf("%s must be set", OperatorNameEnvVar) + } + if len(operatorName) == 0 { + return "", fmt.Errorf("%s must not be empty", OperatorNameEnvVar) + } + return operatorName, nil +} + +// InitOperatorService return the static service which expose operator metrics +func InitOperatorService() (*v1.Service, error) { + operatorName, err := GetOperatorName() + if err != nil { + return nil, err + } + namespace, err := GetWatchNamespace() + if err != nil { + return nil, err + } + service := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: operatorName, + Namespace: namespace, + Labels: map[string]string{"name": operatorName}, + }, + TypeMeta: metav1.TypeMeta{ + Kind: "Service", + APIVersion: "v1", + }, + Spec: v1.ServiceSpec{ + Ports: []v1.ServicePort{ + { + Port: PrometheusMetricsPort, + Protocol: v1.ProtocolTCP, + TargetPort: intstr.IntOrString{ + Type: intstr.String, + StrVal: PrometheusMetricsPortName, + }, + Name: PrometheusMetricsPortName, + }, + }, + Selector: map[string]string{"name": operatorName}, + }, + } + return service, nil +} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/util/k8sutil/k8sutil_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/k8sutil/k8sutil_test.go similarity index 98% rename from vendor/github.com/operator-framework/operator-sdk/pkg/util/k8sutil/k8sutil_test.go rename to vendor/github.com/operator-framework/operator-sdk/pkg/k8sutil/k8sutil_test.go index a3db25727..5c5b71aed 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/util/k8sutil/k8sutil_test.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/k8sutil/k8sutil_test.go @@ -35,7 +35,7 @@ func TestGetOperatorName(t *testing.T) { } tests := []Scenario{ - Scenario{ + { name: "Simple case", envVarKey: OperatorNameEnvVar, envVarValue: "myoperator", @@ -44,7 +44,7 @@ func TestGetOperatorName(t *testing.T) { err: nil, }, }, - Scenario{ + { name: "Unset env var", envVarKey: "", envVarValue: "", @@ -53,7 +53,7 @@ func TestGetOperatorName(t *testing.T) { err: fmt.Errorf("%s must be set", OperatorNameEnvVar), }, }, - Scenario{ + { name: "Empty env var", envVarKey: OperatorNameEnvVar, envVarValue: "", diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/leader/doc.go b/vendor/github.com/operator-framework/operator-sdk/pkg/leader/doc.go index 7c0771e9b..b88c30a2c 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/leader/doc.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/leader/doc.go @@ -41,6 +41,14 @@ The lock record in this case is a ConfigMap whose OwnerReference is set to the Pod that is the leader. When the leader is destroyed, the ConfigMap gets garbage-collected, enabling a different candidate Pod to become the leader. -Leader for Life requires that all candidate Pods be in the same Namespace. +Leader for Life requires that all candidate Pods be in the same Namespace. It +uses the downwards API to determine the pod name, as hostname is not reliable. +You should run it configured with: + +env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name */ package leader diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/leader/leader.go b/vendor/github.com/operator-framework/operator-sdk/pkg/leader/leader.go index c589158fb..14536a4a0 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/leader/leader.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/leader/leader.go @@ -17,6 +17,7 @@ package leader import ( "context" "errors" + "fmt" "io/ioutil" "os" "strings" @@ -39,6 +40,8 @@ var errNoNS = errors.New("namespace not found for current environment") // attempts to become the leader. const maxBackoffInterval = time.Second * 16 +const PodNameEnv = "POD_NAME" + // Become ensures that the current pod is the leader within its namespace. If // run outside a cluster, it will skip leader election and return nil. It // continuously tries to create a ConfigMap with the provided name and the @@ -156,12 +159,14 @@ func myNS() (string, error) { // myOwnerRef returns an OwnerReference that corresponds to the pod in which // this code is currently running. +// It expects the environment variable POD_NAME to be set by the downwards API func myOwnerRef(ctx context.Context, client crclient.Client, ns string) (*metav1.OwnerReference, error) { - hostname, err := os.Hostname() - if err != nil { - return nil, err + podName := os.Getenv(PodNameEnv) + if podName == "" { + return nil, fmt.Errorf("required env %s not set, please configure downward API", PodNameEnv) } - logrus.Debugf("found hostname: %s", hostname) + + logrus.Debugf("found podname: %s", podName) myPod := &corev1.Pod{ TypeMeta: metav1.TypeMeta{ @@ -170,8 +175,8 @@ func myOwnerRef(ctx context.Context, client crclient.Client, ns string) (*metav1 }, } - key := crclient.ObjectKey{Namespace: ns, Name: hostname} - err = client.Get(ctx, key, myPod) + key := crclient.ObjectKey{Namespace: ns, Name: podName} + err := client.Get(ctx, key, myPod) if err != nil { logrus.Errorf("failed to get pod: %v", err) return nil, err diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/add_controller.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/add_controller.go new file mode 100644 index 000000000..a7f9310c7 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/add_controller.go @@ -0,0 +1,50 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +// AddController is the input needed to generate a pkg/controller/add_.go file +type AddController struct { + input.Input + + // Resource defines the inputs for the controller's primary resource + Resource *Resource +} + +func (s *AddController) GetInput() (input.Input, error) { + if s.Path == "" { + fileName := "add_" + s.Resource.LowerKind + ".go" + s.Path = filepath.Join(ControllerDir, fileName) + } + s.TemplateBody = addControllerTemplate + return s.Input, nil +} + +const addControllerTemplate = `package controller + +import ( + "{{ .Repo }}/pkg/controller/{{ .Resource.LowerKind }}" +) + +func init() { + // AddToManagerFuncs is a list of functions to create controllers and add them to a manager. + AddToManagerFuncs = append(AddToManagerFuncs, {{ .Resource.LowerKind }}.Add) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/add_controller_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/add_controller_test.go new file mode 100644 index 000000000..2e8dcc87d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/add_controller_test.go @@ -0,0 +1,48 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestAddController(t *testing.T) { + r, err := NewResource(appApiVersion, appKind) + if err != nil { + t.Fatal(err) + } + s, buf := setupScaffoldAndWriter() + err = s.Execute(appConfig, &AddController{Resource: r}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if addControllerExp != buf.String() { + diffs := diff(addControllerExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const addControllerExp = `package controller + +import ( + "github.com/example-inc/app-operator/pkg/controller/appservice" +) + +func init() { + // AddToManagerFuncs is a list of functions to create controllers and add them to a manager. + AddToManagerFuncs = append(AddToManagerFuncs, appservice.Add) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/addtoscheme.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/addtoscheme.go new file mode 100644 index 000000000..343f8b263 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/addtoscheme.go @@ -0,0 +1,54 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "fmt" + "path/filepath" + "strings" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +// AddToScheme is the input needed to generate an addtoscheme__.go file +type AddToScheme struct { + input.Input + + // Resource defines the inputs for the new api + Resource *Resource +} + +func (s *AddToScheme) GetInput() (input.Input, error) { + if s.Path == "" { + fileName := fmt.Sprintf("addtoscheme_%s_%s.go", + strings.ToLower(s.Resource.Group), + strings.ToLower(s.Resource.Version)) + s.Path = filepath.Join(ApisDir, fileName) + } + s.TemplateBody = addToSchemeTemplate + return s.Input, nil +} + +const addToSchemeTemplate = `package apis + +import ( + "{{ .Repo }}/pkg/apis/{{ .Resource.Group }}/{{ .Resource.Version }}" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, {{ .Resource.Version }}.SchemeBuilder.AddToScheme) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/addtoscheme_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/addtoscheme_test.go new file mode 100644 index 000000000..f6cfca063 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/addtoscheme_test.go @@ -0,0 +1,48 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestAddToScheme(t *testing.T) { + r, err := NewResource(appApiVersion, appKind) + if err != nil { + t.Fatal(err) + } + s, buf := setupScaffoldAndWriter() + err = s.Execute(appConfig, &AddToScheme{Resource: r}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if addtoschemeExp != buf.String() { + diffs := diff(addtoschemeExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const addtoschemeExp = `package apis + +import ( + "github.com/example-inc/app-operator/pkg/apis/app/v1alpha1" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/dockerfile.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/dockerfile.go new file mode 100644 index 000000000..dc49c141d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/dockerfile.go @@ -0,0 +1,46 @@ +// Copyright 2018 The Operator-SDK 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 ansible + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +//Dockerfile - docker file for creating image +type Dockerfile struct { + input.Input + + GeneratePlaybook bool +} + +// GetInput - gets the input +func (d *Dockerfile) GetInput() (input.Input, error) { + if d.Path == "" { + d.Path = filepath.Join(scaffold.BuildDir, scaffold.DockerfileFile) + } + d.TemplateBody = dockerFileAnsibleTmpl + return d.Input, nil +} + +const dockerFileAnsibleTmpl = `FROM quay.io/water-hole/ansible-operator + +COPY roles/ ${HOME}/roles/ +{{- if .GeneratePlaybook }} +COPY playbook.yaml ${HOME}/playbook.yaml{{ end }} +COPY watches.yaml ${HOME}/watches.yaml +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/galaxy_init.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/galaxy_init.go new file mode 100644 index 000000000..e30bd8c57 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/galaxy_init.go @@ -0,0 +1,58 @@ +// Copyright 2018 The Operator-SDK 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 ansible + +import ( + "io/ioutil" + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +// GalaxyInit - wrapper +type GalaxyInit struct { + input.Input + Resource scaffold.Resource + Dir string +} + +// GetInput - get input +func (g *GalaxyInit) GetInput() (input.Input, error) { + if g.Dir == "" { + dir, err := ioutil.TempDir("", "osdk") + if err != nil { + return input.Input{}, err + } + g.Dir = dir + } + if g.Path == "" { + g.Path = filepath.Join(g.Dir, "galaxy_init.sh") + } + g.TemplateBody = galaxyInitTmpl + g.IsExec = true + return g.Input, nil +} + +const galaxyInitTmpl = `#!/usr/bin/env bash + +if ! which ansible-galaxy > /dev/null; then + echo "ansible needs to be installed" + exit 1 +fi + +echo "Initializing role skeleton..." +ansible-galaxy init --init-path={{.Input.AbsProjectPath}}/roles/ {{.Resource.Kind}} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/operator.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/operator.go new file mode 100644 index 000000000..c4031e7eb --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/operator.go @@ -0,0 +1,66 @@ +// Copyright 2018 The Operator-SDK 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 ansible + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +type Operator struct { + input.Input +} + +func (s *Operator) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(scaffold.DeployDir, scaffold.OperatorYamlFile) + } + s.TemplateBody = operatorTemplate + return s.Input, nil +} + +const operatorTemplate = `apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{.ProjectName}} +spec: + replicas: 1 + selector: + matchLabels: + name: {{.ProjectName}} + template: + metadata: + labels: + name: {{.ProjectName}} + spec: + serviceAccountName: {{.ProjectName}} + containers: + - name: {{.ProjectName}} + # Replace this with the built image name + image: REPLACE_IMAGE + ports: + - containerPort: 60000 + name: metrics + imagePullPolicy: Always + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: OPERATOR_NAME + value: "{{.ProjectName}}" +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/playbook.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/playbook.go new file mode 100644 index 000000000..b0c4f634c --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/playbook.go @@ -0,0 +1,44 @@ +// Copyright 2018 The Operator-SDK 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 ansible + +import ( + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const PlaybookYamlFile = "playbook.yaml" + +// Playbook - the playbook tmpl wrapper +type Playbook struct { + input.Input + Resource scaffold.Resource +} + +// GetInput - gets the input +func (p *Playbook) GetInput() (input.Input, error) { + if p.Path == "" { + p.Path = PlaybookYamlFile + } + p.TemplateBody = playbookTmpl + return p.Input, nil +} + +const playbookTmpl = `- hosts: localhost + gather_facts: no + tasks: + - import_role: + name: "{{.Resource.Kind}}" +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/watches.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/watches.go new file mode 100644 index 000000000..749bda165 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/ansible/watches.go @@ -0,0 +1,46 @@ +// Copyright 2018 The Operator-SDK 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 ansible + +import ( + "github.com/operator-framework/operator-sdk/pkg/scaffold" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const WatchesYamlFile = "watches.yaml" + +// WatchesYAML - watches yaml input wrapper +type WatchesYAML struct { + input.Input + + Resource scaffold.Resource + GeneratePlaybook bool +} + +// GetInput - gets the input +func (s *WatchesYAML) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = WatchesYamlFile + } + s.TemplateBody = watchesYAMLTmpl + return s.Input, nil +} + +const watchesYAMLTmpl = `--- +- version: {{.Resource.Version}} + group: {{.Resource.FullGroup}} + kind: {{.Resource.Kind}} +{{ if .GeneratePlaybook }} playbook: /opt/ansible/playbook.yaml{{ else }} role: /opt/ansible/roles/{{.Resource.Kind}}{{ end }} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/apis.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/apis.go new file mode 100644 index 000000000..5f32d7ce5 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/apis.go @@ -0,0 +1,50 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const ApisFile = "apis.go" + +type Apis struct { + input.Input +} + +func (s *Apis) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(ApisDir, ApisFile) + } + s.TemplateBody = apisTmpl + return s.Input, nil +} + +const apisTmpl = `package apis + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// AddToSchemes may be used to add all resources defined in the project to a Scheme +var AddToSchemes runtime.SchemeBuilder + +// AddToScheme adds all Resources to the Scheme +func AddToScheme(s *runtime.Scheme) error { + return AddToSchemes.AddToScheme(s) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/apis_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/apis_test.go new file mode 100644 index 000000000..5af1ec917 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/apis_test.go @@ -0,0 +1,47 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestApis(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &Apis{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if apisExp != buf.String() { + diffs := diff(apisExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const apisExp = `package apis + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// AddToSchemes may be used to add all resources defined in the project to a Scheme +var AddToSchemes runtime.SchemeBuilder + +// AddToScheme adds all Resources to the Scheme +func AddToScheme(s *runtime.Scheme) error { + return AddToSchemes.AddToScheme(s) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/build_dockerfile.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/build_dockerfile.go new file mode 100644 index 000000000..e62572a28 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/build_dockerfile.go @@ -0,0 +1,42 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const DockerfileFile = "Dockerfile" + +type Dockerfile struct { + input.Input +} + +func (s *Dockerfile) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(BuildDir, DockerfileFile) + } + s.TemplateBody = dockerfileTmpl + return s.Input, nil +} + +const dockerfileTmpl = `FROM alpine:3.6 + +USER nobody + +ADD build/_output/bin/{{.ProjectName}} /usr/local/bin/{{.ProjectName}} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/build_dockerfile_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/build_dockerfile_test.go new file mode 100644 index 000000000..f0b9db29f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/build_dockerfile_test.go @@ -0,0 +1,39 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestDockerfile(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &Dockerfile{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if dockerfileExp != buf.String() { + diffs := diff(dockerfileExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const dockerfileExp = `FROM alpine:3.6 + +USER nobody + +ADD build/_output/bin/app-operator /usr/local/bin/app-operator +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cmd.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cmd.go new file mode 100644 index 000000000..8410d16e3 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cmd.go @@ -0,0 +1,99 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const CmdFile = "main.go" + +type Cmd struct { + input.Input +} + +func (s *Cmd) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(ManagerDir, CmdFile) + } + s.TemplateBody = cmdTmpl + return s.Input, nil +} + +const cmdTmpl = `package main + +import ( + "flag" + "log" + "runtime" + + "{{ .Repo }}/pkg/apis" + "{{ .Repo }}/pkg/controller" + + "github.com/operator-framework/operator-sdk/pkg/k8sutil" + sdkVersion "github.com/operator-framework/operator-sdk/version" + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + "sigs.k8s.io/controller-runtime/pkg/client/config" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/runtime/signals" +) + +func printVersion() { + log.Printf("Go Version: %s", runtime.Version()) + log.Printf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH) + log.Printf("operator-sdk Version: %v", sdkVersion.Version) +} + +func main() { + printVersion() + flag.Parse() + + namespace, err := k8sutil.GetWatchNamespace() + if err != nil { + log.Fatalf("failed to get watch namespace: %v", err) + } + + // Get a config to talk to the apiserver + cfg, err := config.GetConfig() + if err != nil { + log.Fatal(err) + } + + // Create a new Cmd to provide shared dependencies and start components + mgr, err := manager.New(cfg, manager.Options{Namespace: namespace}) + if err != nil { + log.Fatal(err) + } + + log.Print("Registering Components.") + + // Setup Scheme for all resources + if err := apis.AddToScheme(mgr.GetScheme()); err != nil { + log.Fatal(err) + } + + // Setup all Controllers + if err := controller.AddToManager(mgr); err != nil { + log.Fatal(err) + } + + log.Print("Starting the Cmd.") + + // Start the Cmd + log.Fatal(mgr.Start(signals.SetupSignalHandler())) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cmd_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cmd_test.go new file mode 100644 index 000000000..94e5d4f88 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cmd_test.go @@ -0,0 +1,95 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestCmd(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &Cmd{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if cmdExp != buf.String() { + diffs := diff(cmdExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const cmdExp = `package main + +import ( + "flag" + "log" + "runtime" + + "github.com/example-inc/app-operator/pkg/apis" + "github.com/example-inc/app-operator/pkg/controller" + "github.com/operator-framework/operator-sdk/pkg/k8sutil" + sdkVersion "github.com/operator-framework/operator-sdk/version" + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + "sigs.k8s.io/controller-runtime/pkg/client/config" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/runtime/signals" +) + +func printVersion() { + log.Printf("Go Version: %s", runtime.Version()) + log.Printf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH) + log.Printf("operator-sdk Version: %v", sdkVersion.Version) +} + +func main() { + printVersion() + flag.Parse() + + namespace, err := k8sutil.GetWatchNamespace() + if err != nil { + log.Fatalf("failed to get watch namespace: %v", err) + } + + // Get a config to talk to the apiserver + cfg, err := config.GetConfig() + if err != nil { + log.Fatal(err) + } + + // Create a new Cmd to provide shared dependencies and start components + mgr, err := manager.New(cfg, manager.Options{Namespace: namespace}) + if err != nil { + log.Fatal(err) + } + + log.Print("Registering Components.") + + // Setup Scheme for all resources + if err := apis.AddToScheme(mgr.GetScheme()); err != nil { + log.Fatal(err) + } + + // Setup all Controllers + if err := controller.AddToManager(mgr); err != nil { + log.Fatal(err) + } + + log.Print("Starting the Cmd.") + + // Start the Cmd + log.Fatal(mgr.Start(signals.SetupSignalHandler())) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/constants.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/constants.go new file mode 100644 index 000000000..fdcbbccb0 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/constants.go @@ -0,0 +1,38 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" +) + +const ( + // Separator to statically create directories. + filePathSep = string(filepath.Separator) + + // dirs + CmdDir = "cmd" + ManagerDir = CmdDir + filePathSep + "manager" + PkgDir = "pkg" + ApisDir = PkgDir + filePathSep + "apis" + ControllerDir = PkgDir + filePathSep + "controller" + BuildDir = "build" + BuildTestDir = BuildDir + filePathSep + "test-framework" + BuildBinDir = BuildDir + filePathSep + "_output" + filePathSep + "bin" + DeployDir = "deploy" + OlmCatalogDir = DeployDir + filePathSep + "olm-catalog" + CrdsDir = DeployDir + filePathSep + "crds" + VersionDir = "version" +) diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller.go new file mode 100644 index 000000000..d47fa9192 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller.go @@ -0,0 +1,55 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const ControllerFile = "controller.go" + +type Controller struct { + input.Input +} + +func (s *Controller) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(ControllerDir, ControllerFile) + } + s.TemplateBody = controllerTmpl + return s.Input, nil +} + +const controllerTmpl = `package controller + +import ( + "sigs.k8s.io/controller-runtime/pkg/manager" +) + +// AddToManagerFuncs is a list of functions to add all Controllers to the Manager +var AddToManagerFuncs []func(manager.Manager) error + +// AddToManager adds all Controllers to the Manager +func AddToManager(m manager.Manager) error { + for _, f := range AddToManagerFuncs { + if err := f(m); err != nil { + return err + } + } + return nil +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller_kind.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller_kind.go new file mode 100644 index 000000000..d831066b0 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller_kind.go @@ -0,0 +1,192 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +// ControllerKind is the input needed to generate a pkg/controller//_controller.go file +type ControllerKind struct { + input.Input + + // Resource defines the inputs for the controller's primary resource + Resource *Resource +} + +func (s *ControllerKind) GetInput() (input.Input, error) { + if s.Path == "" { + fileName := s.Resource.LowerKind + "_controller.go" + s.Path = filepath.Join(ControllerDir, s.Resource.LowerKind, fileName) + } + // Error if this file exists. + s.IfExistsAction = input.Error + s.TemplateBody = controllerKindTemplate + return s.Input, nil +} + +const controllerKindTemplate = `package {{ .Resource.LowerKind }} + +import ( + "context" + "log" + + {{ .Resource.Group}}{{ .Resource.Version }} "{{ .Repo }}/pkg/apis/{{ .Resource.Group}}/{{ .Resource.Version }}" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" +) + +/** +* USER ACTION REQUIRED: This is a scaffold file intended for the user to modify with their own Controller +* business logic. Delete these comments after modifying this file.* + */ + +// Add creates a new {{ .Resource.Kind }} Controller and adds it to the Manager. The Manager will set fields on the Controller +// and Start it when the Manager is Started. +func Add(mgr manager.Manager) error { + return add(mgr, newReconciler(mgr)) +} + +// newReconciler returns a new reconcile.Reconciler +func newReconciler(mgr manager.Manager) reconcile.Reconciler { + return &Reconcile{{ .Resource.Kind }}{client: mgr.GetClient(), scheme: mgr.GetScheme()} +} + +// add adds a new Controller to mgr with r as the reconcile.Reconciler +func add(mgr manager.Manager, r reconcile.Reconciler) error { + // Create a new controller + c, err := controller.New("{{ .Resource.LowerKind }}-controller", mgr, controller.Options{Reconciler: r}) + if err != nil { + return err + } + + // Watch for changes to primary resource {{ .Resource.Kind }} + err = c.Watch(&source.Kind{Type: &{{ .Resource.Group}}{{ .Resource.Version }}.{{ .Resource.Kind }}{}}, &handler.EnqueueRequestForObject{}) + if err != nil { + return err + } + + // TODO(user): Modify this to be the types you create that are owned by the primary resource + // Watch for changes to secondary resource Pods and requeue the owner {{ .Resource.Kind }} + err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{ + IsController: true, + OwnerType: &{{ .Resource.Group}}{{ .Resource.Version }}.{{ .Resource.Kind }}{}, + }) + if err != nil { + return err + } + + return nil +} + +var _ reconcile.Reconciler = &Reconcile{{ .Resource.Kind }}{} + +// Reconcile{{ .Resource.Kind }} reconciles a {{ .Resource.Kind }} object +type Reconcile{{ .Resource.Kind }} struct { + // This client, initialized using mgr.Client() above, is a split client + // that reads objects from the cache and writes to the apiserver + client client.Client + scheme *runtime.Scheme +} + +// Reconcile reads that state of the cluster for a {{ .Resource.Kind }} object and makes changes based on the state read +// and what is in the {{ .Resource.Kind }}.Spec +// TODO(user): Modify this Reconcile function to implement your Controller logic. This example creates +// a Pod as an example +// Note: +// The Controller will requeue the Request to be processed again if the returned error is non-nil or +// Result.Requeue is true, otherwise upon completion it will remove the work from the queue. +func (r *Reconcile{{ .Resource.Kind }}) Reconcile(request reconcile.Request) (reconcile.Result, error) { + log.Printf("Reconciling {{ .Resource.Kind }} %s/%s\n", request.Namespace, request.Name) + + // Fetch the {{ .Resource.Kind }} instance + instance := &{{ .Resource.Group}}{{ .Resource.Version }}.{{ .Resource.Kind }}{} + err := r.client.Get(context.TODO(), request.NamespacedName, instance) + if err != nil { + if errors.IsNotFound(err) { + // Request object not found, could have been deleted after reconcile request. + // Owned objects are automatically garbage collected. For additional cleanup logic use finalizers. + // Return and don't requeue + return reconcile.Result{}, nil + } + // Error reading the object - requeue the request. + return reconcile.Result{}, err + } + + // Define a new Pod object + pod := newPodForCR(instance) + + // Set {{ .Resource.Kind }} instance as the owner and controller + if err := controllerutil.SetControllerReference(instance, pod, r.scheme); err != nil { + return reconcile.Result{}, err + } + + // Check if this Pod already exists + found := &corev1.Pod{} + err = r.client.Get(context.TODO(), types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, found) + if err != nil && errors.IsNotFound(err) { + log.Printf("Creating a new Pod %s/%s\n", pod.Namespace, pod.Name) + err = r.client.Create(context.TODO(), pod) + if err != nil { + return reconcile.Result{}, err + } + + // Pod created successfully - don't requeue + return reconcile.Result{}, nil + } else if err != nil { + return reconcile.Result{}, err + } + + // Pod already exists - don't requeue + log.Printf("Skip reconcile: Pod %s/%s already exists", found.Namespace, found.Name) + return reconcile.Result{}, nil +} + +// newPodForCR returns a busybox pod with the same name/namespace as the cr +func newPodForCR(cr *{{ .Resource.Group}}{{ .Resource.Version }}.{{ .Resource.Kind }}) *corev1.Pod { + labels := map[string]string{ + "app": cr.Name, + } + return &corev1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Name: cr.Name + "-pod", + Namespace: cr.Namespace, + Labels: labels, + }, + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ + { + Name: "busybox", + Image: "busybox", + Command: []string{"sleep", "3600"}, + }, + }, + }, + } +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller_kind_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller_kind_test.go new file mode 100644 index 000000000..020dd2ba4 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller_kind_test.go @@ -0,0 +1,187 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestControllerKind(t *testing.T) { + r, err := NewResource(appApiVersion, appKind) + if err != nil { + t.Fatal(err) + } + s, buf := setupScaffoldAndWriter() + err = s.Execute(appConfig, &ControllerKind{Resource: r}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if controllerKindExp != buf.String() { + diffs := diff(controllerKindExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const controllerKindExp = `package appservice + +import ( + "context" + "log" + + appv1alpha1 "github.com/example-inc/app-operator/pkg/apis/app/v1alpha1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/reconcile" + "sigs.k8s.io/controller-runtime/pkg/source" +) + +/** +* USER ACTION REQUIRED: This is a scaffold file intended for the user to modify with their own Controller +* business logic. Delete these comments after modifying this file.* + */ + +// Add creates a new AppService Controller and adds it to the Manager. The Manager will set fields on the Controller +// and Start it when the Manager is Started. +func Add(mgr manager.Manager) error { + return add(mgr, newReconciler(mgr)) +} + +// newReconciler returns a new reconcile.Reconciler +func newReconciler(mgr manager.Manager) reconcile.Reconciler { + return &ReconcileAppService{client: mgr.GetClient(), scheme: mgr.GetScheme()} +} + +// add adds a new Controller to mgr with r as the reconcile.Reconciler +func add(mgr manager.Manager, r reconcile.Reconciler) error { + // Create a new controller + c, err := controller.New("appservice-controller", mgr, controller.Options{Reconciler: r}) + if err != nil { + return err + } + + // Watch for changes to primary resource AppService + err = c.Watch(&source.Kind{Type: &appv1alpha1.AppService{}}, &handler.EnqueueRequestForObject{}) + if err != nil { + return err + } + + // TODO(user): Modify this to be the types you create that are owned by the primary resource + // Watch for changes to secondary resource Pods and requeue the owner AppService + err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{ + IsController: true, + OwnerType: &appv1alpha1.AppService{}, + }) + if err != nil { + return err + } + + return nil +} + +var _ reconcile.Reconciler = &ReconcileAppService{} + +// ReconcileAppService reconciles a AppService object +type ReconcileAppService struct { + // This client, initialized using mgr.Client() above, is a split client + // that reads objects from the cache and writes to the apiserver + client client.Client + scheme *runtime.Scheme +} + +// Reconcile reads that state of the cluster for a AppService object and makes changes based on the state read +// and what is in the AppService.Spec +// TODO(user): Modify this Reconcile function to implement your Controller logic. This example creates +// a Pod as an example +// Note: +// The Controller will requeue the Request to be processed again if the returned error is non-nil or +// Result.Requeue is true, otherwise upon completion it will remove the work from the queue. +func (r *ReconcileAppService) Reconcile(request reconcile.Request) (reconcile.Result, error) { + log.Printf("Reconciling AppService %s/%s\n", request.Namespace, request.Name) + + // Fetch the AppService instance + instance := &appv1alpha1.AppService{} + err := r.client.Get(context.TODO(), request.NamespacedName, instance) + if err != nil { + if errors.IsNotFound(err) { + // Request object not found, could have been deleted after reconcile request. + // Owned objects are automatically garbage collected. For additional cleanup logic use finalizers. + // Return and don't requeue + return reconcile.Result{}, nil + } + // Error reading the object - requeue the request. + return reconcile.Result{}, err + } + + // Define a new Pod object + pod := newPodForCR(instance) + + // Set AppService instance as the owner and controller + if err := controllerutil.SetControllerReference(instance, pod, r.scheme); err != nil { + return reconcile.Result{}, err + } + + // Check if this Pod already exists + found := &corev1.Pod{} + err = r.client.Get(context.TODO(), types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, found) + if err != nil && errors.IsNotFound(err) { + log.Printf("Creating a new Pod %s/%s\n", pod.Namespace, pod.Name) + err = r.client.Create(context.TODO(), pod) + if err != nil { + return reconcile.Result{}, err + } + + // Pod created successfully - don't requeue + return reconcile.Result{}, nil + } else if err != nil { + return reconcile.Result{}, err + } + + // Pod already exists - don't requeue + log.Printf("Skip reconcile: Pod %s/%s already exists", found.Namespace, found.Name) + return reconcile.Result{}, nil +} + +// newPodForCR returns a busybox pod with the same name/namespace as the cr +func newPodForCR(cr *appv1alpha1.AppService) *corev1.Pod { + labels := map[string]string{ + "app": cr.Name, + } + return &corev1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Name: cr.Name + "-pod", + Namespace: cr.Namespace, + Labels: labels, + }, + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ + { + Name: "busybox", + Image: "busybox", + Command: []string{"sleep", "3600"}, + }, + }, + }, + } +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller_test.go new file mode 100644 index 000000000..2ed470a0b --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/controller_test.go @@ -0,0 +1,52 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestController(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &Controller{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if controllerExp != buf.String() { + diffs := diff(controllerKindExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const controllerExp = `package controller + +import ( + "sigs.k8s.io/controller-runtime/pkg/manager" +) + +// AddToManagerFuncs is a list of functions to add all Controllers to the Manager +var AddToManagerFuncs []func(manager.Manager) error + +// AddToManager adds all Controllers to the Manager +func AddToManager(m manager.Manager) error { + for _, f := range AddToManagerFuncs { + if err := f(m); err != nil { + return err + } + } + return nil +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cr.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cr.go new file mode 100644 index 000000000..18d58cc03 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cr.go @@ -0,0 +1,52 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "fmt" + "path/filepath" + "strings" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +// Cr is the input needed to generate a deploy/crds/___cr.yaml file +type Cr struct { + input.Input + + // Resource defines the inputs for the new custom resource + Resource *Resource +} + +func (s *Cr) GetInput() (input.Input, error) { + if s.Path == "" { + fileName := fmt.Sprintf("%s_%s_%s_cr.yaml", + strings.ToLower(s.Resource.Group), + strings.ToLower(s.Resource.Version), + s.Resource.LowerKind) + s.Path = filepath.Join(CrdsDir, fileName) + } + s.TemplateBody = crTemplate + return s.Input, nil +} + +const crTemplate = `apiVersion: {{ .Resource.APIVersion }} +kind: {{ .Resource.Kind }} +metadata: + name: example-{{ .Resource.LowerKind }} +spec: + # Add fields here + size: 3 +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cr_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cr_test.go new file mode 100644 index 000000000..e4e030a48 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/cr_test.go @@ -0,0 +1,45 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestCr(t *testing.T) { + r, err := NewResource(appApiVersion, appKind) + if err != nil { + t.Fatal(err) + } + s, buf := setupScaffoldAndWriter() + err = s.Execute(appConfig, &Cr{Resource: r}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if crExp != buf.String() { + diffs := diff(crExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const crExp = `apiVersion: app.example.com/v1alpha1 +kind: AppService +metadata: + name: example-appservice +spec: + # Add fields here + size: 3 +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/crd.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/crd.go new file mode 100644 index 000000000..7ea7c9733 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/crd.go @@ -0,0 +1,59 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "fmt" + "path/filepath" + "strings" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +// Crd is the input needed to generate a deploy/crds/___crd.yaml file +type Crd struct { + input.Input + + // Resource defines the inputs for the new custom resource definition + Resource *Resource +} + +func (s *Crd) GetInput() (input.Input, error) { + if s.Path == "" { + fileName := fmt.Sprintf("%s_%s_%s_crd.yaml", + strings.ToLower(s.Resource.Group), + strings.ToLower(s.Resource.Version), + s.Resource.LowerKind) + s.Path = filepath.Join(CrdsDir, fileName) + } + s.TemplateBody = crdTemplate + return s.Input, nil +} + +// TODO: Parse pkg/apis to generate CRD with open-api validation instead of using a static template +const crdTemplate = `apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: {{ .Resource.Resource }}.{{ .Resource.FullGroup }} +spec: + group: {{ .Resource.FullGroup }} + names: + kind: {{ .Resource.Kind }} + listKind: {{ .Resource.Kind }}List + plural: {{ .Resource.Resource }} + singular: {{ .Resource.LowerKind }} + scope: Namespaced + version: {{ .Resource.Version }} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/crd_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/crd_test.go new file mode 100644 index 000000000..f90b73e3f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/crd_test.go @@ -0,0 +1,51 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestCRD(t *testing.T) { + r, err := NewResource(appApiVersion, appKind) + if err != nil { + t.Fatal(err) + } + s, buf := setupScaffoldAndWriter() + err = s.Execute(appConfig, &Crd{Resource: r}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if crdExp != buf.String() { + diffs := diff(crdExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const crdExp = `apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: appservices.app.example.com +spec: + group: app.example.com + names: + kind: AppService + listKind: AppServiceList + plural: appservices + singular: appservice + scope: Namespaced + version: v1alpha1 +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/doc.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/doc.go new file mode 100644 index 000000000..86bd812d7 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/doc.go @@ -0,0 +1,50 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + "strings" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const DocFile = "doc.go" + +// Doc is the input needed to generate a pkg/apis///doc.go file +type Doc struct { + input.Input + + // Resource defines the inputs for the new doc file + Resource *Resource +} + +func (s *Doc) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(ApisDir, + strings.ToLower(s.Resource.Group), + strings.ToLower(s.Resource.Version), + DocFile) + } + s.IfExistsAction = input.Skip + s.TemplateBody = docTemplate + return s.Input, nil +} + +const docTemplate = `// Package {{.Resource.Version}} contains API Schema definitions for the {{ .Resource.Group }} {{.Resource.Version}} API group +// +k8s:deepcopy-gen=package,register +// +groupName={{ .Resource.FullGroup }} +package {{.Resource.Version}} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/doc_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/doc_test.go new file mode 100644 index 000000000..c79bb4019 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/doc_test.go @@ -0,0 +1,42 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestDoc(t *testing.T) { + r, err := NewResource(appApiVersion, appKind) + if err != nil { + t.Fatal(err) + } + s, buf := setupScaffoldAndWriter() + err = s.Execute(appConfig, &Doc{Resource: r}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if docExp != buf.String() { + diffs := diff(docExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const docExp = `// Package v1alpha1 contains API Schema definitions for the app v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +groupName=app.example.com +package v1alpha1 +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gitignore.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gitignore.go new file mode 100644 index 000000000..b33b5f506 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gitignore.go @@ -0,0 +1,112 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const GitignoreFile = ".gitignore" + +type Gitignore struct { + input.Input +} + +func (s *Gitignore) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = GitignoreFile + } + s.TemplateBody = gitignoreTmpl + return s.Input, nil +} + +const gitignoreTmpl = `# Temporary Build Files +build/_output +build/_test +# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode +### Emacs ### +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* +# Org-mode +.org-id-locations +*_archive +# flymake-mode +*_flymake.* +# eshell files +/eshell/history +/eshell/lastdir +# elpa packages +/elpa/ +# reftex files +*.rel +# AUCTeX auto folder +/auto/ +# cask packages +.cask/ +dist/ +# Flycheck +flycheck_*.el +# server auth directory +/server/ +# projectiles files +.projectile +projectile-bookmarks.eld +# directory configuration +.dir-locals.el +# saveplace +places +# url cache +url/cache/ +# cedet +ede-projects.el +# smex +smex-items +# company-statistics +company-statistics-cache.el +# anaconda-mode +anaconda-mode/ +### Go ### +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +# Test binary, build with 'go test -c' +*.test +# Output of the go coverage tool, specifically when used with LiteIDE +*.out +### Vim ### +# swap +.sw[a-p] +.*.sw[a-p] +# session +Session.vim +# temporary +.netrwhist +# auto-generated tag files +tags +### VisualStudioCode ### +.vscode/* +.history +# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gitignore_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gitignore_test.go new file mode 100644 index 000000000..806c551bc --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gitignore_test.go @@ -0,0 +1,111 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestGitignore(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &Gitignore{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if gitignoreExp != buf.String() { + diffs := diff(gitignoreExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const gitignoreExp = `# Temporary Build Files +build/_output +build/_test +# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode +### Emacs ### +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* +# Org-mode +.org-id-locations +*_archive +# flymake-mode +*_flymake.* +# eshell files +/eshell/history +/eshell/lastdir +# elpa packages +/elpa/ +# reftex files +*.rel +# AUCTeX auto folder +/auto/ +# cask packages +.cask/ +dist/ +# Flycheck +flycheck_*.el +# server auth directory +/server/ +# projectiles files +.projectile +projectile-bookmarks.eld +# directory configuration +.dir-locals.el +# saveplace +places +# url cache +url/cache/ +# cedet +ede-projects.el +# smex +smex-items +# company-statistics +company-statistics-cache.el +# anaconda-mode +anaconda-mode/ +### Go ### +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +# Test binary, build with 'go test -c' +*.test +# Output of the go coverage tool, specifically when used with LiteIDE +*.out +### Vim ### +# swap +.sw[a-p] +.*.sw[a-p] +# session +Session.vim +# temporary +.netrwhist +# auto-generated tag files +tags +### VisualStudioCode ### +.vscode/* +.history +# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/go_test_script.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/go_test_script.go new file mode 100644 index 000000000..2a4427887 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/go_test_script.go @@ -0,0 +1,41 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const GoTestScriptFile = "go-test.sh" + +type GoTestScript struct { + input.Input +} + +func (s *GoTestScript) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(BuildTestDir, GoTestScriptFile) + } + s.IsExec = true + s.TemplateBody = goTestScriptTmpl + return s.Input, nil +} + +const goTestScriptTmpl = `#!/bin/sh + +{{.ProjectName}}-test -test.parallel=1 -test.failfast -root=/ -kubeconfig=incluster -namespacedMan=namespaced.yaml -test.v +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/go_test_script_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/go_test_script_test.go new file mode 100644 index 000000000..61807018a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/go_test_script_test.go @@ -0,0 +1,37 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestGoTestScript(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &GoTestScript{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if goTestScriptExp != buf.String() { + diffs := diff(goTestScriptExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const goTestScriptExp = `#!/bin/sh + +app-operator-test -test.parallel=1 -test.failfast -root=/ -kubeconfig=incluster -namespacedMan=namespaced.yaml -test.v +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gopkgtoml.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gopkgtoml.go new file mode 100644 index 000000000..bed8d8050 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gopkgtoml.go @@ -0,0 +1,89 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const GopkgTomlFile = "Gopkg.toml" + +type GopkgToml struct { + input.Input +} + +func (s *GopkgToml) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = GopkgTomlFile + } + s.TemplateBody = gopkgTomlTmpl + return s.Input, nil +} + +const gopkgTomlTmpl = `# Force dep to vendor the code generators, which aren't imported just used at dev time. +required = [ + "k8s.io/code-generator/cmd/defaulter-gen", + "k8s.io/code-generator/cmd/deepcopy-gen", + "k8s.io/code-generator/cmd/conversion-gen", + "k8s.io/code-generator/cmd/client-gen", + "k8s.io/code-generator/cmd/lister-gen", + "k8s.io/code-generator/cmd/informer-gen", + "k8s.io/code-generator/cmd/openapi-gen", + "k8s.io/gengo/args", +] + +[[override]] + name = "k8s.io/code-generator" + # revision for tag "kubernetes-1.11.2" + revision = "6702109cc68eb6fe6350b83e14407c8d7309fd1a" + +[[override]] + name = "k8s.io/api" + # revision for tag "kubernetes-1.11.2" + revision = "2d6f90ab1293a1fb871cf149423ebb72aa7423aa" + +[[override]] + name = "k8s.io/apiextensions-apiserver" + # revision for tag "kubernetes-1.11.2" + revision = "408db4a50408e2149acbd657bceb2480c13cb0a4" + +[[override]] + name = "k8s.io/apimachinery" + # revision for tag "kubernetes-1.11.2" + revision = "103fd098999dc9c0c88536f5c9ad2e5da39373ae" + +[[override]] + name = "k8s.io/client-go" + # revision for tag "kubernetes-1.11.2" + revision = "1f13a808da65775f22cbf47862c4e5898d8f4ca1" + +[[override]] + name = "sigs.k8s.io/controller-runtime" + version = "v0.1.4" + +[[constraint]] + name = "github.com/operator-framework/operator-sdk" + # The version rule is used for a specific release and the master branch for in between releases. + # branch = "v0.1.x" #osdk_branch_annotation + version = "=v0.1.1" #osdk_version_annotation + +[prune] + go-tests = true + non-go = true + + [[prune.project]] + name = "k8s.io/code-generator" + non-go = false +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gopkgtoml_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gopkgtoml_test.go new file mode 100644 index 000000000..25a7a0e40 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/gopkgtoml_test.go @@ -0,0 +1,88 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestGopkgtoml(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &GopkgToml{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if gopkgtomlExp != buf.String() { + diffs := diff(gopkgtomlExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const gopkgtomlExp = `# Force dep to vendor the code generators, which aren't imported just used at dev time. +required = [ + "k8s.io/code-generator/cmd/defaulter-gen", + "k8s.io/code-generator/cmd/deepcopy-gen", + "k8s.io/code-generator/cmd/conversion-gen", + "k8s.io/code-generator/cmd/client-gen", + "k8s.io/code-generator/cmd/lister-gen", + "k8s.io/code-generator/cmd/informer-gen", + "k8s.io/code-generator/cmd/openapi-gen", + "k8s.io/gengo/args", +] + +[[override]] + name = "k8s.io/code-generator" + # revision for tag "kubernetes-1.11.2" + revision = "6702109cc68eb6fe6350b83e14407c8d7309fd1a" + +[[override]] + name = "k8s.io/api" + # revision for tag "kubernetes-1.11.2" + revision = "2d6f90ab1293a1fb871cf149423ebb72aa7423aa" + +[[override]] + name = "k8s.io/apiextensions-apiserver" + # revision for tag "kubernetes-1.11.2" + revision = "408db4a50408e2149acbd657bceb2480c13cb0a4" + +[[override]] + name = "k8s.io/apimachinery" + # revision for tag "kubernetes-1.11.2" + revision = "103fd098999dc9c0c88536f5c9ad2e5da39373ae" + +[[override]] + name = "k8s.io/client-go" + # revision for tag "kubernetes-1.11.2" + revision = "1f13a808da65775f22cbf47862c4e5898d8f4ca1" + +[[override]] + name = "sigs.k8s.io/controller-runtime" + version = "v0.1.4" + +[[constraint]] + name = "github.com/operator-framework/operator-sdk" + # The version rule is used for a specific release and the master branch for in between releases. + # branch = "v0.1.x" #osdk_branch_annotation + version = "=v0.1.1" #osdk_version_annotation + +[prune] + go-tests = true + non-go = true + + [[prune.project]] + name = "k8s.io/code-generator" + non-go = false +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/input/input.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/input/input.go new file mode 100644 index 000000000..02dc400a7 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/input/input.go @@ -0,0 +1,121 @@ +// Copyright 2018 The Operator-SDK 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. + +// Modified from github.com/kubernetes-sigs/controller-tools/pkg/scaffold/input/input.go + +package input + +// IfExistsAction determines what to do if the scaffold file already exists +type IfExistsAction int + +const ( + // Overwrite truncates and overwrites the existing file (default) + Overwrite IfExistsAction = iota + + // Error returns an error and stops processing + Error + + // Skip skips the file and moves to the next one + Skip +) + +// Input is the input for scaffoldig a file +type Input struct { + // Path is the file to write + Path string + + // IfExistsAction determines what to do if the file exists + IfExistsAction IfExistsAction + + // IsExec indicates whether the file should be written with executable + // permissions. + // Defaults to false + IsExec bool + + // TemplateBody is the template body to execute + TemplateBody string + + // Repo is the go project package + Repo string + + // AbsProjectPath is the absolute path to the project root, including the project directory. + AbsProjectPath string + + // ProjectName is the operator's name, ex. app-operator + ProjectName string +} + +// Repo allows a repo to be set on an object +type Repo interface { + // SetRepo sets the repo + SetRepo(string) +} + +// SetRepo sets the repo +func (i *Input) SetRepo(r string) { + if i.Repo == "" { + i.Repo = r + } +} + +// AbsProjectPath allows the absolute project path to be set on an object +type AbsProjectPath interface { + // SetAbsProjectPath sets the project file location + SetAbsProjectPath(string) +} + +// SetAbsProjectPath sets the absolute project path +func (i *Input) SetAbsProjectPath(p string) { + if i.AbsProjectPath == "" { + i.AbsProjectPath = p + } +} + +// ProjectName allows the project name to be set on an object +type ProjectName interface { + // SetProjectName sets the project name + SetProjectName(string) +} + +// SetProjectName sets the project name +func (i *Input) SetProjectName(n string) { + if i.ProjectName == "" { + i.ProjectName = n + } +} + +// File is a scaffoldable file +type File interface { + // GetInput returns the Input for creating a scaffold file + GetInput() (Input, error) +} + +// Validate validates input +type Validate interface { + // Validate returns nil if the inputs' validation logic approves of + // field values, the template, etc. + Validate() error +} + +// Config configures the execution scaffold templates +type Config struct { + // Repo is the go project package + Repo string + + // AbsProjectPath is the absolute path to the project root, including the project directory. + AbsProjectPath string + + // ProjectName is the operator's name, ex. app-operator + ProjectName string +} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/operator.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/operator.go new file mode 100644 index 000000000..f89eaf8d1 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/operator.go @@ -0,0 +1,73 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const OperatorYamlFile = "operator.yaml" + +type Operator struct { + input.Input +} + +func (s *Operator) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(DeployDir, OperatorYamlFile) + } + s.TemplateBody = operatorTemplate + return s.Input, nil +} + +const operatorTemplate = `apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{.ProjectName}} +spec: + replicas: 1 + selector: + matchLabels: + name: {{.ProjectName}} + template: + metadata: + labels: + name: {{.ProjectName}} + spec: + serviceAccountName: {{.ProjectName}} + containers: + - name: {{.ProjectName}} + # Replace this with the built image name + image: REPLACE_IMAGE + ports: + - containerPort: 60000 + name: metrics + command: + - {{.ProjectName}} + imagePullPolicy: Always + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "{{.ProjectName}}" +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/operator_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/operator_test.go new file mode 100644 index 000000000..18cd1a99d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/operator_test.go @@ -0,0 +1,70 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestOperator(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &Operator{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if operatorExp != buf.String() { + diffs := diff(operatorExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const operatorExp = `apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-operator +spec: + replicas: 1 + selector: + matchLabels: + name: app-operator + template: + metadata: + labels: + name: app-operator + spec: + serviceAccountName: app-operator + containers: + - name: app-operator + # Replace this with the built image name + image: REPLACE_IMAGE + ports: + - containerPort: 60000 + name: metrics + command: + - app-operator + imagePullPolicy: Always + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "app-operator" +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/register.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/register.go new file mode 100644 index 000000000..7c8a0329a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/register.go @@ -0,0 +1,66 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + "strings" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const RegisterFile = "register.go" + +// Register is the input needed to generate a pkg/apis///register.go file +type Register struct { + input.Input + + // Resource defines the inputs for the new custom resource definition + Resource *Resource +} + +func (s *Register) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(ApisDir, + strings.ToLower(s.Resource.Group), + strings.ToLower(s.Resource.Version), + RegisterFile) + } + // Do not overwrite this file if it exists. + s.IfExistsAction = input.Skip + s.TemplateBody = registerTemplate + return s.Input, nil +} + +const registerTemplate = `// NOTE: Boilerplate only. Ignore this file. + +// Package {{.Resource.Version}} contains API Schema definitions for the {{ .Resource.Group }} {{.Resource.Version}} API group +// +k8s:deepcopy-gen=package,register +// +groupName={{ .Resource.FullGroup }} +package {{.Resource.Version}} + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "{{ .Resource.FullGroup }}", Version: "{{ .Resource.Version }}"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} +) +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/register_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/register_test.go new file mode 100644 index 000000000..794da7b5f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/register_test.go @@ -0,0 +1,57 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestRegister(t *testing.T) { + r, err := NewResource(appApiVersion, appKind) + if err != nil { + t.Fatal(err) + } + s, buf := setupScaffoldAndWriter() + err = s.Execute(appConfig, &Register{Resource: r}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if registerExp != buf.String() { + diffs := diff(registerExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const registerExp = `// NOTE: Boilerplate only. Ignore this file. + +// Package v1alpha1 contains API Schema definitions for the app v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +groupName=app.example.com +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "app.example.com", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} +) +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/resource.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/resource.go new file mode 100644 index 000000000..bc22aee54 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/resource.go @@ -0,0 +1,141 @@ +// Copyright 2018 The Operator-SDK 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. + +// Modified from github.com/kubernetes-sigs/controller-tools/pkg/scaffold/resource/resource.go + +package scaffold + +import ( + "errors" + "fmt" + "regexp" + "strings" + + "github.com/markbates/inflect" +) + +var ( + // ResourceVersionRegexp matches Kubernetes API versions. + // See https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-versioning + ResourceVersionRegexp = regexp.MustCompile("^v[1-9][0-9]*((alpha|beta)[1-9][0-9]*)?$") + // ResourceKindRegexp matches Kubernetes API Kind's. + ResourceKindRegexp = regexp.MustCompile("^[a-zA-Z]+$") + // ResourceGroupRegexp matches Kubernetes API Group's. + ResourceGroupRegexp = regexp.MustCompile("^[a-z]+$") +) + +// Resource contains the information required to scaffold files for a resource. +type Resource struct { + // APIVersion is the complete group-subdomain/version e.g app.example.com/v1alpha1 + APIVersion string + + // Kind is the API Kind e.g AppService + Kind string + + // FullGroup is the complete group name with subdomain e.g app.example.com + // Parsed from APIVersion + FullGroup string + + // Group is the API Group. Does not contain the sub-domain. e.g app + // Parsed from APIVersion + Group string + + // Version is the API version - e.g. v1alpha1 + // Parsed from APIVersion + Version string + + // Resource is the API Resource i.e plural(lowercased(Kind)) e.g appservices + Resource string + + // LowerKind is lowercased(Kind) e.g appservice + LowerKind string + + // TODO: allow user to specify list of short names for Resource e.g app, myapp +} + +func NewResource(apiVersion, kind string) (*Resource, error) { + r := &Resource{ + APIVersion: apiVersion, + Kind: kind, + } + if err := r.Validate(); err != nil { + return nil, err + } + return r, nil +} + +// Validate defaults and checks the Resource values to make sure they are valid. +func (r *Resource) Validate() error { + if len(r.APIVersion) == 0 { + return errors.New("api-version cannot be empty") + } + + if err := r.checkAndSetKinds(); err != nil { + return err + } + if err := r.checkAndSetGroups(); err != nil { + return err + } + if err := r.checkAndSetVersion(); err != nil { + return err + } + + rs := inflect.NewDefaultRuleset() + if len(r.Resource) == 0 { + r.Resource = rs.Pluralize(strings.ToLower(r.Kind)) + } + + return nil +} + +func (r *Resource) checkAndSetKinds() error { + if len(r.Kind) == 0 { + return errors.New("kind cannot be empty") + } + + r.LowerKind = strings.ToLower(r.Kind) + + if strings.Title(r.Kind) != r.Kind { + return fmt.Errorf("kind must begin with uppercase (was %v)", r.Kind) + } + if !ResourceKindRegexp.MatchString(r.Kind) { + return errors.New("kind should consist of lower and uppercase alphabetical characters") + } + return nil +} + +func (r *Resource) checkAndSetGroups() error { + r.FullGroup = strings.Split(r.APIVersion, "/")[0] + r.Group = strings.Split(r.FullGroup, ".")[0] + + if len(r.Group) == 0 { + return errors.New("group cannot be empty") + } + if !ResourceGroupRegexp.MatchString(r.Group) { + return errors.New("group should consist of lowercase alphabetical characters") + } + return nil +} + +func (r *Resource) checkAndSetVersion() error { + r.Version = strings.Split(r.APIVersion, "/")[1] + + if len(r.Version) == 0 { + return errors.New("version cannot be empty") + } + if !ResourceVersionRegexp.MatchString(r.Version) { + return errors.New("version is not in the correct Kubernetes version format, ex. v1alpha1") + } + return nil +} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/role.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/role.go new file mode 100644 index 000000000..7f76f566a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/role.go @@ -0,0 +1,184 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "log" + "path/filepath" + + "github.com/operator-framework/operator-sdk/internal/util/fileutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" + + yaml "gopkg.in/yaml.v2" + rbacv1 "k8s.io/api/rbac/v1" + cgoscheme "k8s.io/client-go/kubernetes/scheme" +) + +const RoleYamlFile = "role.yaml" + +type Role struct { + input.Input +} + +func (s *Role) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(DeployDir, RoleYamlFile) + } + s.TemplateBody = roleTemplate + return s.Input, nil +} + +func UpdateRoleForResource(r *Resource, absProjectPath string) error { + // append rbac rule to deploy/role.yaml + roleFilePath := filepath.Join(absProjectPath, DeployDir, RoleYamlFile) + roleYAML, err := ioutil.ReadFile(roleFilePath) + if err != nil { + return fmt.Errorf("failed to read role manifest %v: %v", roleFilePath, err) + } + obj, _, err := cgoscheme.Codecs.UniversalDeserializer().Decode(roleYAML, nil, nil) + if err != nil { + return fmt.Errorf("failed to decode role manifest %v: %v", roleFilePath, err) + } + switch role := obj.(type) { + // TODO: use rbac/v1. + case *rbacv1.Role: + pr := &rbacv1.PolicyRule{} + apiGroupFound := false + for i := range role.Rules { + if role.Rules[i].APIGroups[0] == r.FullGroup { + apiGroupFound = true + pr = &role.Rules[i] + break + } + } + // check if the resource already exists + for _, resource := range pr.Resources { + if resource == r.Resource { + log.Printf("deploy/role.yaml RBAC rules already up to date for the resource (%v, %v)", r.APIVersion, r.Kind) + return nil + } + } + + pr.Resources = append(pr.Resources, r.Resource) + // create a new apiGroup if not found. + if !apiGroupFound { + pr.APIGroups = []string{r.FullGroup} + // Using "*" to allow access to the resource and all its subresources e.g "memcacheds" and "memcacheds/finalizers" + // https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#ownerreferencespermissionenforcement + pr.Resources = []string{"*"} + pr.Verbs = []string{"*"} + role.Rules = append(role.Rules, *pr) + } + // update role.yaml + d, err := json.Marshal(&role) + if err != nil { + return fmt.Errorf("failed to marshal role(%+v): %v", role, err) + } + m := &map[string]interface{}{} + err = yaml.Unmarshal(d, m) + data, err := yaml.Marshal(m) + if err != nil { + return fmt.Errorf("failed to marshal role(%+v): %v", role, err) + } + if err := ioutil.WriteFile(roleFilePath, data, fileutil.DefaultFileMode); err != nil { + return fmt.Errorf("failed to update %v: %v", roleFilePath, err) + } + case *rbacv1.ClusterRole: + pr := &rbacv1.PolicyRule{} + apiGroupFound := false + for i := range role.Rules { + if role.Rules[i].APIGroups[0] == r.FullGroup { + apiGroupFound = true + pr = &role.Rules[i] + break + } + } + // check if the resource already exists + for _, resource := range pr.Resources { + if resource == r.Resource { + log.Printf("deploy/role.yaml RBAC rules already up to date for the resource (%v, %v)", r.APIVersion, r.Kind) + return nil + } + } + + pr.Resources = append(pr.Resources, r.Resource) + // create a new apiGroup if not found. + if !apiGroupFound { + pr.APIGroups = []string{r.FullGroup} + // Using "*" to allow access to the resource and all its subresources e.g "memcacheds" and "memcacheds/finalizers" + // https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#ownerreferencespermissionenforcement + pr.Resources = []string{"*"} + pr.Verbs = []string{"*"} + role.Rules = append(role.Rules, *pr) + } + // update role.yaml + d, err := json.Marshal(&role) + if err != nil { + return fmt.Errorf("failed to marshal role(%+v): %v", role, err) + } + m := &map[string]interface{}{} + err = yaml.Unmarshal(d, m) + data, err := yaml.Marshal(m) + if err != nil { + return fmt.Errorf("failed to marshal role(%+v): %v", role, err) + } + if err := ioutil.WriteFile(roleFilePath, data, fileutil.DefaultFileMode); err != nil { + return fmt.Errorf("failed to update %v: %v", roleFilePath, err) + } + default: + return errors.New("failed to parse role.yaml as a role") + } + // not reachable + return nil +} + +const roleTemplate = `kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{.ProjectName}} +rules: +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - "*" +- apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - "*" +- apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - "get" + - "create" +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/role_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/role_test.go new file mode 100644 index 000000000..ad0479dd4 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/role_test.go @@ -0,0 +1,67 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestRole(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &Role{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if roleExp != buf.String() { + diffs := diff(roleExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const roleExp = `kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: app-operator +rules: +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - "*" +- apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - "*" +- apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - "get" + - "create" +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/rolebinding.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/rolebinding.go new file mode 100644 index 000000000..a9718354f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/rolebinding.go @@ -0,0 +1,48 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const RoleBindingYamlFile = "role_binding.yaml" + +type RoleBinding struct { + input.Input +} + +func (s *RoleBinding) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(DeployDir, RoleBindingYamlFile) + } + s.TemplateBody = roleBindingTemplate + return s.Input, nil +} + +const roleBindingTemplate = `kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{.ProjectName}} +subjects: +- kind: ServiceAccount + name: {{.ProjectName}} +roleRef: + kind: Role + name: {{.ProjectName}} + apiGroup: rbac.authorization.k8s.io +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/rolebinding_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/rolebinding_test.go new file mode 100644 index 000000000..722a59315 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/rolebinding_test.go @@ -0,0 +1,45 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestRoleBinding(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &RoleBinding{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if rolebindingExp != buf.String() { + diffs := diff(rolebindingExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const rolebindingExp = `kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: app-operator +subjects: +- kind: ServiceAccount + name: app-operator +roleRef: + kind: Role + name: app-operator + apiGroup: rbac.authorization.k8s.io +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/scaffold.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/scaffold.go new file mode 100644 index 000000000..18de34a82 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/scaffold.go @@ -0,0 +1,174 @@ +// Copyright 2018 The Operator-SDK 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. + +// Modified from github.com/kubernetes-sigs/controller-tools/pkg/scaffold/scaffold.go + +package scaffold + +import ( + "bytes" + "fmt" + "io" + "log" + "os" + "path/filepath" + "strings" + "text/template" + + "github.com/operator-framework/operator-sdk/internal/util/fileutil" + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" + "golang.org/x/tools/imports" +) + +// Scaffold writes Templates to scaffold new files +type Scaffold struct { + // Repo is the go project package + Repo string + + // AbsProjectPath is the absolute path to the project root, including the project directory. + AbsProjectPath string + + // ProjectName is the operator's name, ex. app-operator + ProjectName string + + GetWriter func(path string, mode os.FileMode) (io.Writer, error) +} + +func (s *Scaffold) setFieldsAndValidate(t input.File) error { + if b, ok := t.(input.Repo); ok { + b.SetRepo(s.Repo) + } + if b, ok := t.(input.AbsProjectPath); ok { + b.SetAbsProjectPath(s.AbsProjectPath) + } + if b, ok := t.(input.ProjectName); ok { + b.SetProjectName(s.ProjectName) + } + + // Validate the template is ok + if v, ok := t.(input.Validate); ok { + if err := v.Validate(); err != nil { + return err + } + } + return nil +} + +func (s *Scaffold) configure(cfg *input.Config) { + s.Repo = cfg.Repo + s.AbsProjectPath = cfg.AbsProjectPath + s.ProjectName = cfg.ProjectName +} + +// Execute executes scaffolding the Files +func (s *Scaffold) Execute(cfg *input.Config, files ...input.File) error { + if s.GetWriter == nil { + s.GetWriter = (&fileutil.FileWriter{}).WriteCloser + } + + // Configure s using common fields from cfg. + s.configure(cfg) + + for _, f := range files { + if err := s.doFile(f); err != nil { + return err + } + } + return nil +} + +// doFile scaffolds a single file +func (s *Scaffold) doFile(e input.File) error { + // Set common fields + err := s.setFieldsAndValidate(e) + if err != nil { + return err + } + + // Get the template input params + i, err := e.GetInput() + if err != nil { + return err + } + + // Ensure we use the absolute file path; i.Path is relative to the project root. + absFilePath := filepath.Join(s.AbsProjectPath, i.Path) + + // Check if the file to write already exists + if _, err := os.Stat(absFilePath); err == nil || os.IsExist(err) { + switch i.IfExistsAction { + case input.Overwrite: + case input.Skip: + return nil + case input.Error: + return fmt.Errorf("%s already exists", absFilePath) + } + } + + return s.doTemplate(i, e, absFilePath) +} + +const goFileExt = ".go" + +// doTemplate executes the template at absPath for a file using the input +func (s *Scaffold) doTemplate(i input.Input, e input.File, absPath string) error { + temp, err := newTemplate(e).Parse(i.TemplateBody) + if err != nil { + return err + } + + var mode os.FileMode = fileutil.DefaultFileMode + if i.IsExec { + mode = fileutil.DefaultExecFileMode + } + f, err := s.GetWriter(absPath, mode) + if err != nil { + return err + } + if c, ok := f.(io.Closer); ok { + defer func() { + if err := c.Close(); err != nil { + log.Fatal(err) + } + }() + } + + out := &bytes.Buffer{} + err = temp.Execute(out, e) + if err != nil { + return err + } + b := out.Bytes() + + // gofmt the imports + if filepath.Ext(absPath) == goFileExt { + b, err = imports.Process(absPath, b, nil) + if err != nil { + fmt.Printf("%s\n", out.Bytes()) + return err + } + } + + _, err = f.Write(b) + fmt.Printf("Create %s\n", i.Path) + return err +} + +// newTemplate a new template with common functions +func newTemplate(t input.File) *template.Template { + return template.New(fmt.Sprintf("%T", t)).Funcs(template.FuncMap{ + "title": strings.Title, + "lower": strings.ToLower, + }) +} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/service_account.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/service_account.go new file mode 100644 index 000000000..456f89a49 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/service_account.go @@ -0,0 +1,41 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const ServiceAccountYamlFile = "service_account.yaml" + +type ServiceAccount struct { + input.Input +} + +func (s *ServiceAccount) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(DeployDir, ServiceAccountYamlFile) + } + s.TemplateBody = serviceAccountTemplate + return s.Input, nil +} + +const serviceAccountTemplate = `apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{.ProjectName}} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/service_account_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/service_account_test.go new file mode 100644 index 000000000..2a1b1fffc --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/service_account_test.go @@ -0,0 +1,41 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" + + "github.com/sergi/go-diff/diffmatchpatch" +) + +func TestServiceAccount(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &ServiceAccount{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if serviceAccountExp != buf.String() { + dmp := diffmatchpatch.New() + diffs := diffmatchpatch.New().DiffMain(serviceAccountExp, buf.String(), false) + t.Fatalf("expected vs actual differs. Red text is missing and green text is extra.\n%v", dmp.DiffPrettyText(diffs)) + } +} + +const serviceAccountExp = `apiVersion: v1 +kind: ServiceAccount +metadata: + name: app-operator +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_framework_dockerfile.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_framework_dockerfile.go new file mode 100644 index 000000000..618c6bd91 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_framework_dockerfile.go @@ -0,0 +1,41 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +type TestFrameworkDockerfile struct { + input.Input +} + +func (s *TestFrameworkDockerfile) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(BuildTestDir, DockerfileFile) + } + s.TemplateBody = testFrameworkDockerfileTmpl + return s.Input, nil +} + +const testFrameworkDockerfileTmpl = `ARG BASEIMAGE +FROM ${BASEIMAGE} +ADD build/_output/bin/{{.ProjectName}}-test /usr/local/bin/{{.ProjectName}}-test +ARG NAMESPACEDMAN +ADD $NAMESPACEDMAN /namespaced.yaml +ADD build/test-framework/go-test.sh /go-test.sh +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_framework_dockerfile_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_framework_dockerfile_test.go new file mode 100644 index 000000000..8d680d4b7 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_framework_dockerfile_test.go @@ -0,0 +1,40 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestTestFrameworkDockerfile(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &TestFrameworkDockerfile{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if testFrameworkDockerfileExp != buf.String() { + diffs := diff(testFrameworkDockerfileExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const testFrameworkDockerfileExp = `ARG BASEIMAGE +FROM ${BASEIMAGE} +ADD build/_output/bin/app-operator-test /usr/local/bin/app-operator-test +ARG NAMESPACEDMAN +ADD $NAMESPACEDMAN /namespaced.yaml +ADD build/test-framework/go-test.sh /go-test.sh +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_pod.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_pod.go new file mode 100644 index 000000000..0bb423530 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_pod.go @@ -0,0 +1,59 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const TestPodYamlFile = "test-pod.yaml" + +type TestPod struct { + input.Input + + // Image is the image name used for testing, ex. quay.io/repo/operator-image + Image string + + // TestNamespaceEnv is an env variable specifying the test namespace + TestNamespaceEnv string +} + +func (s *TestPod) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(DeployDir, TestPodYamlFile) + } + s.TemplateBody = testPodTmpl + return s.Input, nil +} + +const testPodTmpl = `apiVersion: v1 +kind: Pod +metadata: + name: {{.ProjectName}}-test +spec: + restartPolicy: Never + containers: + - name: {{.ProjectName}}-test + image: {{.Image}} + imagePullPolicy: Always + command: ["/go-test.sh"] + env: + - name: {{.TestNamespaceEnv}} + valueFrom: + fieldRef: + fieldPath: metadata.namespace +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_pod_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_pod_test.go new file mode 100644 index 000000000..3535aa303 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_pod_test.go @@ -0,0 +1,56 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" + + "github.com/operator-framework/operator-sdk/pkg/test" +) + +func TestPodTest(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, + &TestPod{ + Image: "quay.io/app/operator:v1.0.0", + TestNamespaceEnv: test.TestNamespaceEnv, + }) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if testPodExp != buf.String() { + diffs := diff(testPodExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const testPodExp = `apiVersion: v1 +kind: Pod +metadata: + name: app-operator-test +spec: + restartPolicy: Never + containers: + - name: app-operator-test + image: quay.io/app/operator:v1.0.0 + imagePullPolicy: Always + command: ["/go-test.sh"] + env: + - name: TEST_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_setup.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_setup.go new file mode 100644 index 000000000..06c91e14d --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/test_setup.go @@ -0,0 +1,58 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "bytes" + "io" + "log" + "os" + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const ( + // test constants describing an app operator project + appProjectName = "app-operator" + appRepo = "github.com" + filePathSep + "example-inc" + filePathSep + appProjectName + appApiVersion = "app.example.com/v1alpha1" + appKind = "AppService" +) + +var ( + appConfig = &input.Config{ + Repo: appRepo, + AbsProjectPath: mustGetImportPath(), + ProjectName: appProjectName, + } +) + +func mustGetImportPath() string { + wd, err := os.Getwd() + if err != nil { + log.Fatal("mustGetImportPath: ", err) + } + return filepath.Join(wd, appRepo) +} + +func setupScaffoldAndWriter() (*Scaffold, *bytes.Buffer) { + buf := &bytes.Buffer{} + return &Scaffold{ + GetWriter: func(_ string, _ os.FileMode) (io.Writer, error) { + return buf, nil + }, + }, buf +} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/types.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/types.go new file mode 100644 index 000000000..ccf5d7d43 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/types.go @@ -0,0 +1,90 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + "strings" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +// Types is the input needed to generate a pkg/apis///_types.go file +type Types struct { + input.Input + + // Resource defines the inputs for the new types file + Resource *Resource +} + +func (s *Types) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(ApisDir, + strings.ToLower(s.Resource.Group), + strings.ToLower(s.Resource.Version), + s.Resource.LowerKind+"_types.go") + } + // Error if this file exists. + s.IfExistsAction = input.Error + s.TemplateBody = typesTemplate + return s.Input, nil +} + +const typesTemplate = `package {{ .Resource.Version }} + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// {{.Resource.Kind}}Spec defines the desired state of {{.Resource.Kind}} +type {{.Resource.Kind}}Spec struct { + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file +} + +// {{.Resource.Kind}}Status defines the observed state of {{.Resource.Kind}} +type {{.Resource.Kind}}Status struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// {{.Resource.Kind}} is the Schema for the {{ .Resource.Resource }} API +// +k8s:openapi-gen=true +type {{.Resource.Kind}} struct { + metav1.TypeMeta ` + "`" + `json:",inline"` + "`" + ` + metav1.ObjectMeta ` + "`" + `json:"metadata,omitempty"` + "`" + ` + + Spec {{.Resource.Kind}}Spec ` + "`" + `json:"spec,omitempty"` + "`" + ` + Status {{.Resource.Kind}}Status ` + "`" + `json:"status,omitempty"` + "`" + ` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// {{.Resource.Kind}}List contains a list of {{.Resource.Kind}} +type {{.Resource.Kind}}List struct { + metav1.TypeMeta ` + "`" + `json:",inline"` + "`" + ` + metav1.ListMeta ` + "`" + `json:"metadata,omitempty"` + "`" + ` + Items []{{ .Resource.Kind }} ` + "`" + `json:"items"` + "`" + ` +} + +func init() { + SchemeBuilder.Register(&{{.Resource.Kind}}{}, &{{.Resource.Kind}}List{}) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/types_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/types_test.go new file mode 100644 index 000000000..cb2c9db11 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/types_test.go @@ -0,0 +1,83 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestTypes(t *testing.T) { + r, err := NewResource(appApiVersion, appKind) + if err != nil { + t.Fatal(err) + } + s, buf := setupScaffoldAndWriter() + err = s.Execute(appConfig, &Types{Resource: r}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if typesExp != buf.String() { + diffs := diff(typesExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const typesExp = `package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// AppServiceSpec defines the desired state of AppService +type AppServiceSpec struct { + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file +} + +// AppServiceStatus defines the observed state of AppService +type AppServiceStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AppService is the Schema for the appservices API +// +k8s:openapi-gen=true +type AppService struct { + metav1.TypeMeta ` + "`" + `json:",inline"` + "`" + ` + metav1.ObjectMeta ` + "`" + `json:"metadata,omitempty"` + "`" + ` + + Spec AppServiceSpec ` + "`" + `json:"spec,omitempty"` + "`" + ` + Status AppServiceStatus ` + "`" + `json:"status,omitempty"` + "`" + ` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// AppServiceList contains a list of AppService +type AppServiceList struct { + metav1.TypeMeta ` + "`" + `json:",inline"` + "`" + ` + metav1.ListMeta ` + "`" + `json:"metadata,omitempty"` + "`" + ` + Items []AppService ` + "`" + `json:"items"` + "`" + ` +} + +func init() { + SchemeBuilder.Register(&AppService{}, &AppServiceList{}) +} +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/util.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/util.go new file mode 100644 index 000000000..a96836747 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/util.go @@ -0,0 +1,62 @@ +// Copyright 2018 The Operator-SDK 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. + +// Modified from github.com/kubernetes-sigs/controller-tools/pkg/util/util.go + +package scaffold + +import ( + "bytes" + "regexp" + "strings" + + "github.com/sergi/go-diff/diffmatchpatch" +) + +func diff(a, b string) string { + dmp := diffmatchpatch.New() + + wSrc, wDst, warray := dmp.DiffLinesToRunes(a, b) + diffs := dmp.DiffMainRunes(wSrc, wDst, false) + diffs = dmp.DiffCharsToLines(diffs, warray) + var buff bytes.Buffer + for _, diff := range diffs { + text := diff.Text + + switch diff.Type { + case diffmatchpatch.DiffInsert: + _, _ = buff.WriteString("\x1b[32m") + _, _ = buff.WriteString(prefixLines(text, "+")) + _, _ = buff.WriteString("\x1b[0m") + case diffmatchpatch.DiffDelete: + _, _ = buff.WriteString("\x1b[31m") + _, _ = buff.WriteString(prefixLines(text, "-")) + _, _ = buff.WriteString("\x1b[0m") + case diffmatchpatch.DiffEqual: + _, _ = buff.WriteString(prefixLines(text, " ")) + } + } + return buff.String() +} + +func prefixLines(s, prefix string) string { + var buf bytes.Buffer + lines := strings.Split(s, "\n") + ls := regexp.MustCompile("^") + for _, line := range lines[:len(lines)-1] { + buf.WriteString(ls.ReplaceAllString(line, prefix)) + buf.WriteString("\n") + } + return buf.String() +} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/version.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/version.go new file mode 100644 index 000000000..f844062a6 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/version.go @@ -0,0 +1,42 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "path/filepath" + + "github.com/operator-framework/operator-sdk/pkg/scaffold/input" +) + +const VersionFile = "version.go" + +type Version struct { + input.Input +} + +func (s *Version) GetInput() (input.Input, error) { + if s.Path == "" { + s.Path = filepath.Join(VersionDir, VersionFile) + } + s.TemplateBody = versionTemplate + return s.Input, nil +} + +const versionTemplate = `package version + +var ( + Version = "0.0.1" +) +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/version_test.go b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/version_test.go new file mode 100644 index 000000000..ad68cd35f --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/scaffold/version_test.go @@ -0,0 +1,39 @@ +// Copyright 2018 The Operator-SDK 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 scaffold + +import ( + "testing" +) + +func TestVersion(t *testing.T) { + s, buf := setupScaffoldAndWriter() + err := s.Execute(appConfig, &Version{}) + if err != nil { + t.Fatalf("failed to execute the scaffold: (%v)", err) + } + + if versionExp != buf.String() { + diffs := diff(versionExp, buf.String()) + t.Fatalf("expected vs actual differs.\n%v", diffs) + } +} + +const versionExp = `package version + +var ( + Version = "0.0.1" +) +` diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/action.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/action.go deleted file mode 100644 index d62df2d67..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/action.go +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 sdk - -import ( - "fmt" - - "github.com/operator-framework/operator-sdk/pkg/k8sclient" - "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" -) - -// Create creates the provided object on the server and updates the arg -// "object" with the result from the server(UID, resourceVersion, etc). -// Returns an error if the object’s TypeMeta(Kind, APIVersion) or ObjectMeta(Name/GenerateName, Namespace) is missing or incorrect. -// Can also return an api error from the server -// e.g AlreadyExists https://github.com/kubernetes/apimachinery/blob/master/pkg/api/errors/errors.go#L423 -func Create(object Object) (err error) { - _, namespace, err := k8sutil.GetNameAndNamespace(object) - if err != nil { - return err - } - gvk := object.GetObjectKind().GroupVersionKind() - - apiVersion, kind := gvk.ToAPIVersionAndKind() - resourceClient, _, err := k8sclient.GetResourceClient(apiVersion, kind, namespace) - if err != nil { - return fmt.Errorf("failed to get resource client: %v", err) - } - - unstructObj, err := k8sutil.UnstructuredFromRuntimeObject(object) - if err != nil { - return err - } - unstructObj, err = resourceClient.Create(unstructObj) - if err != nil { - return err - } - - // Update the arg object with the result - err = k8sutil.UnstructuredIntoRuntimeObject(unstructObj, object) - if err != nil { - return fmt.Errorf("failed to unmarshal the retrieved data: %v", err) - } - return nil -} - -// Patch patches provided "object" on the server with given "patch" and updates the arg -// "object" with the result from the server(UID, resourceVersion, etc). -// Returns an error if the object’s TypeMeta(Kind, APIVersion) or ObjectMeta(Name, Namespace) is missing or incorrect. -// Returns an error if patch couldn't be json serialized into bytes. -// Can also return an api error from the server -// e.g Conflict https://github.com/kubernetes/apimachinery/blob/master/pkg/api/errors/errors.go#L428 -func Patch(object Object, pt types.PatchType, patch []byte) (err error) { - name, namespace, err := k8sutil.GetNameAndNamespace(object) - if err != nil { - return err - } - gvk := object.GetObjectKind().GroupVersionKind() - - apiVersion, kind := gvk.ToAPIVersionAndKind() - resourceClient, _, err := k8sclient.GetResourceClient(apiVersion, kind, namespace) - if err != nil { - return fmt.Errorf("failed to get resource client: %v", err) - } - - unstructObj, err := resourceClient.Patch(name, pt, patch) - if err != nil { - return err - } - - // Update the arg object with the result - err = k8sutil.UnstructuredIntoRuntimeObject(unstructObj, object) - if err != nil { - return fmt.Errorf("failed to unmarshal the retrieved data: %v", err) - } - return nil -} - -// Update updates the provided object on the server and updates the arg -// "object" with the result from the server(UID, resourceVersion, etc). -// Returns an error if the object’s TypeMeta(Kind, APIVersion) or ObjectMeta(Name, Namespace) is missing or incorrect. -// Can also return an api error from the server -// e.g Conflict https://github.com/kubernetes/apimachinery/blob/master/pkg/api/errors/errors.go#L428 -func Update(object Object) (err error) { - _, namespace, err := k8sutil.GetNameAndNamespace(object) - if err != nil { - return err - } - gvk := object.GetObjectKind().GroupVersionKind() - - apiVersion, kind := gvk.ToAPIVersionAndKind() - resourceClient, _, err := k8sclient.GetResourceClient(apiVersion, kind, namespace) - if err != nil { - return fmt.Errorf("failed to get resource client: %v", err) - } - - unstructObj, err := k8sutil.UnstructuredFromRuntimeObject(object) - if err != nil { - return err - } - unstructObj, err = resourceClient.Update(unstructObj) - if err != nil { - return err - } - - // Update the arg object with the result - err = k8sutil.UnstructuredIntoRuntimeObject(unstructObj, object) - if err != nil { - return fmt.Errorf("failed to unmarshal the retrieved data: %v", err) - } - return nil -} - -// DeleteOp wraps all the options for Delete(). -type DeleteOp struct { - metaDeleteOptions *metav1.DeleteOptions -} - -// DeleteOption configures DeleteOp. -type DeleteOption func(*DeleteOp) - -func NewDeleteOp() *DeleteOp { - op := &DeleteOp{} - op.setDefaults() - return op -} - -func (op *DeleteOp) applyOpts(opts []DeleteOption) { - for _, opt := range opts { - opt(op) - } -} - -func (op *DeleteOp) setDefaults() { - if op.metaDeleteOptions == nil { - op.metaDeleteOptions = &metav1.DeleteOptions{} - } -} - -// WithDeleteOptions sets the metav1.DeleteOptions for the Delete() operation. -func WithDeleteOptions(metaDeleteOptions *metav1.DeleteOptions) DeleteOption { - return func(op *DeleteOp) { - op.metaDeleteOptions = metaDeleteOptions - } -} - -// Delete deletes the specified object -// Returns an error if the object’s TypeMeta(Kind, APIVersion) or ObjectMeta(Name, Namespace) is missing or incorrect. -// e.g NotFound https://github.com/kubernetes/apimachinery/blob/master/pkg/api/errors/errors.go#L418 -// “opts” configures the DeleteOptions -// When passed WithDeleteOptions(o), the specified metav1.DeleteOptions are set. -func Delete(object Object, opts ...DeleteOption) (err error) { - name, namespace, err := k8sutil.GetNameAndNamespace(object) - if err != nil { - return err - } - gvk := object.GetObjectKind().GroupVersionKind() - - apiVersion, kind := gvk.ToAPIVersionAndKind() - resourceClient, _, err := k8sclient.GetResourceClient(apiVersion, kind, namespace) - if err != nil { - return fmt.Errorf("failed to get resource client: %v", err) - } - - o := NewDeleteOp() - o.applyOpts(opts) - return resourceClient.Delete(name, o.metaDeleteOptions) -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/api.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/api.go deleted file mode 100644 index 56ef2fcc9..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/api.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 sdk - -import ( - "context" - "time" - - "github.com/operator-framework/operator-sdk/pkg/k8sclient" - "github.com/operator-framework/operator-sdk/pkg/sdk/internal/metrics" - - "github.com/sirupsen/logrus" -) - -var ( - // informers is the set of all informers for the resources watched by the user - informers []Informer - collector *metrics.Collector -) - -// Watch watches for changes on the given resource. -// apiVersion for a resource is of the format "Group/Version" except for the "Core" group whose APIVersion is just "v1". For e.g: -// - Deployments have Group "apps" and Version "v1beta2" giving the APIVersion "apps/v1beta2" -// - Pods have Group "Core" and Version "v1" giving the APIVersion "v1" -// - The custom resource Memcached might have Group "cache.example.com" and Version "v1alpha1" giving the APIVersion "cache.example.com/v1alpha1" -// kind is the Kind of the resource, e.g "Pod" for pods -// resyncPeriod is the time period for how often an event with the latest resource version will be sent to the handler, even if there is no change. -// - 0 means no periodic events will be sent -// Consult the API reference for the Group, Version and Kind of a resource: https://kubernetes.io/docs/reference/ -// namespace is the Namespace to watch for the resource -// TODO: support opts for specifying label selector -func Watch(apiVersion, kind, namespace string, resyncPeriod time.Duration, opts ...watchOption) { - resourceClient, resourcePluralName, err := k8sclient.GetResourceClient(apiVersion, kind, namespace) - // TODO: Better error handling, e.g retry - if err != nil { - logrus.Errorf("failed to get resource client for (apiVersion:%s, kind:%s, ns:%s): %v", apiVersion, kind, namespace, err) - panic(err) - } - if collector == nil { - collector = metrics.New() - metrics.RegisterCollector(collector) - } - o := newWatchOp() - o.applyOpts(opts) - informer := NewInformer(resourcePluralName, namespace, resourceClient, resyncPeriod, collector, o.numWorkers, o.labelSelector) - informers = append(informers, informer) -} - -// Handle registers the handler for all events. -// In the future, we would have a mux-pattern to dispatch events to matched handlers. -func Handle(handler Handler) { - RegisteredHandler = handler -} - -// Run starts the process of Watching resources, handling Events, and processing Actions -func Run(ctx context.Context) { - for _, informer := range informers { - go informer.Run(ctx) - } - <-ctx.Done() -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/handler.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/handler.go deleted file mode 100644 index baedd6f38..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/handler.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 sdk - -import "context" - -// Handler reacts to events and outputs actions. -// If any intended action failed, the event would be re-triggered. -// For actions done before the failed action, there is no rollback. -type Handler interface { - Handle(context.Context, Event) error -} - -var ( - // RegisteredHandler is the user registered handler set by sdk.Handle() - RegisteredHandler Handler -) diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/informer-sync.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/informer-sync.go deleted file mode 100644 index e61589495..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/informer-sync.go +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 sdk - -import ( - "github.com/operator-framework/operator-sdk/pkg/sdk/internal/metrics" - "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - - "github.com/sirupsen/logrus" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" -) - -const ( - // Copy from deployment_controller.go: - // maxRetries is the number of times a Vault will be retried before it is dropped out of the queue. - // With the current rate-limiter in use (5ms*2^(maxRetries-1)) the following numbers represent the times - // a Vault is going to be requeued: - // - // 5ms, 10ms, 20ms, 40ms, 80ms, 160ms, 320ms, 640ms, 1.3s, 2.6s, 5.1s, 10.2s, 20.4s, 41s, 82s - maxRetries = 15 -) - -func (i *informer) runWorker() { - for i.processNextItem() { - } -} - -func (i *informer) processNextItem() bool { - // Wait until there is a new item in the working queue - key, quit := i.queue.Get() - if quit { - return false - } - // Tell the queue that we are done with processing this key. This unblocks the key for other workers - // This allows safe parallel processing because two pods with the same key are never processed in - // parallel. - defer i.queue.Done(key) - - // Invoke the method containing the business logic - err := i.sync(key.(string)) - - // Handle the error if something went wrong during the execution of the business logic - i.handleErr(err, key) - return true -} - -// sync creates the event for the object and sends it to the handler -func (i *informer) sync(key string) error { - obj, exists, err := i.sharedIndexInformer.GetIndexer().GetByKey(key) - if err != nil { - return err - } - if !exists { - logrus.Debugf("Object (%s) is deleted", key) - // Lookup the last saved state for the deleted object - _, ok := i.deletedObjects[key] - if !ok { - logrus.Errorf("no last known state found for deleted object (%s)", key) - return nil - } - obj = i.deletedObjects[key] - } - - unstructObj := obj.(*unstructured.Unstructured).DeepCopy() - object, err := k8sutil.RuntimeObjectFromUnstructured(unstructObj) - if err != nil { - return err - } - - event := Event{ - Object: object, - Deleted: !exists, - } - - // TODO: Add option to prevent multiple informers from invoking Handle() concurrently? - err = RegisteredHandler.Handle(i.context, event) - if !exists && err == nil { - delete(i.deletedObjects, key) - } - switch { - case err == nil: - i.collector.ReconcileResult.WithLabelValues(metrics.ReconcileResultSuccess).Inc() - case err != nil: - i.collector.ReconcileResult.WithLabelValues(metrics.ReconcileResultFailure).Inc() - } - return err -} - -// handleErr checks if an error happened and makes sure we will retry later. -func (i *informer) handleErr(err error, key interface{}) { - if err == nil { - // Forget about the #AddRateLimited history of the key on every successful synchronization. - // This ensures that future processing of updates for this key is not delayed because of - // an outdated error history. - i.queue.Forget(key) - return - } - - // This controller retries maxRetries times if something goes wrong. After that, it stops trying. - if i.queue.NumRequeues(key) < maxRetries { - logrus.Errorf("error syncing key (%v): %v", key, err) - - // Re-enqueue the key rate limited. Based on the rate limiter on the - // queue and the re-enqueue history, the key will be processed later again. - i.queue.AddRateLimited(key) - return - } - - i.queue.Forget(key) - // Report that, even after several retries, we could not successfully process this key - logrus.Warnf("Dropping key (%v) out of the queue: %v", key, err) -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/informer.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/informer.go deleted file mode 100644 index 6a76559e7..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/informer.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 sdk - -import ( - "context" - "time" - - "github.com/operator-framework/operator-sdk/pkg/sdk/internal/metrics" - - "github.com/sirupsen/logrus" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/dynamic" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/util/workqueue" -) - -type Informer interface { - Run(ctx context.Context) -} - -type informer struct { - resourcePluralName string - sharedIndexInformer cache.SharedIndexInformer - queue workqueue.RateLimitingInterface - namespace string - context context.Context - deletedObjects map[string]interface{} - collector *metrics.Collector - numWorkers int -} - -func NewInformer(resourcePluralName, namespace string, resourceClient dynamic.ResourceInterface, resyncPeriod time.Duration, c *metrics.Collector, n int, labelSelector string) Informer { - i := &informer{ - resourcePluralName: resourcePluralName, - queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), resourcePluralName), - namespace: namespace, - deletedObjects: map[string]interface{}{}, - collector: c, - numWorkers: n, - } - - i.sharedIndexInformer = cache.NewSharedIndexInformer( - newListWatcherFromResourceClient(resourceClient, labelSelector), &unstructured.Unstructured{}, resyncPeriod, cache.Indexers{}, - ) - i.sharedIndexInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: i.handleAddResourceEvent, - DeleteFunc: i.handleDeleteResourceEvent, - UpdateFunc: i.handleUpdateResourceEvent, - }) - return i -} - -func newListWatcherFromResourceClient(resourceClient dynamic.ResourceInterface, labelSelector string) *cache.ListWatch { - listFunc := func(options metav1.ListOptions) (runtime.Object, error) { - if labelSelector != "" { - options.LabelSelector = labelSelector - } - return resourceClient.List(options) - } - watchFunc := func(options metav1.ListOptions) (watch.Interface, error) { - if labelSelector != "" { - options.LabelSelector = labelSelector - } - return resourceClient.Watch(options) - } - return &cache.ListWatch{ListFunc: listFunc, WatchFunc: watchFunc} -} - -func (i *informer) Run(ctx context.Context) { - i.context = ctx - defer i.queue.ShutDown() - - logrus.Debugf("starting %s controller", i.resourcePluralName) - go i.sharedIndexInformer.Run(ctx.Done()) - - if !cache.WaitForCacheSync(ctx.Done(), i.sharedIndexInformer.HasSynced) { - panic("Timed out waiting for caches to sync") - } - - for n := 0; n < i.numWorkers; n++ { - go wait.Until(i.runWorker, time.Second, ctx.Done()) - } - <-ctx.Done() - logrus.Debugf("stopping %s controller", i.resourcePluralName) -} - -func (i *informer) handleAddResourceEvent(obj interface{}) { - key, err := cache.MetaNamespaceKeyFunc(obj) - if err != nil { - panic(err) - } - i.collector.EventType.WithLabelValues(metrics.EventTypeAdd).Inc() - i.queue.Add(key) -} - -func (i *informer) handleDeleteResourceEvent(obj interface{}) { - // For deletes we have to use this key function - // to handle the DeletedFinalStateUnknown case for the object - key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj) - if err != nil { - panic(err) - } - - // TODO: Revisit the need for passing delete events to the handler - // Save the last known state for the deleted object - i.deletedObjects[key] = obj.(*unstructured.Unstructured).DeepCopy() - i.collector.EventType.WithLabelValues(metrics.EventTypeDelete).Inc() - - i.queue.Add(key) -} - -func (i *informer) handleUpdateResourceEvent(oldObj, newObj interface{}) { - key, err := cache.MetaNamespaceKeyFunc(newObj) - if err != nil { - panic(err) - } - i.collector.EventType.WithLabelValues(metrics.EventTypeUpdate).Inc() - i.queue.Add(key) -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/metrics.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/metrics.go index 19b3ee887..2e603e973 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/metrics.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/metrics.go @@ -15,29 +15,42 @@ package sdk import ( + "context" "net/http" "strconv" - k8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" + "github.com/operator-framework/operator-sdk/pkg/k8sutil" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/sirupsen/logrus" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/config" ) // ExposeMetricsPort generate a Kubernetes Service to expose metrics port -func ExposeMetricsPort() { +func ExposeMetricsPort() *v1.Service { http.Handle("/"+k8sutil.PrometheusMetricsPortName, promhttp.Handler()) go http.ListenAndServe(":"+strconv.Itoa(k8sutil.PrometheusMetricsPort), nil) service, err := k8sutil.InitOperatorService() if err != nil { logrus.Errorf("failed to initialize service object for operator metrics: %v", err) - return + return nil } - err = Create(service) + kubeconfig, err := config.GetConfig() + if err != nil { + panic(err) + } + runtimeClient, err := client.New(kubeconfig, client.Options{}) + if err != nil { + panic(err) + } + err = runtimeClient.Create(context.TODO(), service) if err != nil && !errors.IsAlreadyExists(err) { logrus.Errorf("failed to create service for operator metrics: %v", err) - return + return nil } logrus.Infof("Metrics service %s created", service.Name) + return service } diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/query-opt.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/query-opt.go deleted file mode 100644 index 3a2528f7a..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/query-opt.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 sdk - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// GetOp wraps all the options for Get(). -type GetOp struct { - metaGetOptions *metav1.GetOptions -} - -func NewGetOp() *GetOp { - op := &GetOp{} - op.setDefaults() - return op -} - -func (op *GetOp) applyOpts(opts []GetOption) { - for _, opt := range opts { - opt(op) - } -} - -func (op *GetOp) setDefaults() { - if op.metaGetOptions == nil { - op.metaGetOptions = &metav1.GetOptions{} - } -} - -// GetOption configures GetOp. -type GetOption func(*GetOp) - -// WithGetOptions sets the metav1.GetOptions for the Get() operation. -func WithGetOptions(metaGetOptions *metav1.GetOptions) GetOption { - return func(op *GetOp) { - op.metaGetOptions = metaGetOptions - } -} - -// ListOp wraps all the options for List. -type ListOp struct { - metaListOptions *metav1.ListOptions -} - -func NewListOp() *ListOp { - op := &ListOp{} - op.setDefaults() - return op -} - -// ListOption configures ListOp. -type ListOption func(*ListOp) - -func (op *ListOp) applyOpts(opts []ListOption) { - for _, opt := range opts { - opt(op) - } -} - -func (op *ListOp) setDefaults() { - if op.metaListOptions == nil { - op.metaListOptions = &metav1.ListOptions{} - } -} - -// WithListOptions sets the metav1.ListOptions for -// the List() operation. -func WithListOptions(metaListOptions *metav1.ListOptions) ListOption { - return func(op *ListOp) { - op.metaListOptions = metaListOptions - } -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/query.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/query.go deleted file mode 100644 index 2c2c0a848..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/query.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 sdk - -import ( - "fmt" - - "github.com/operator-framework/operator-sdk/pkg/k8sclient" - "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" -) - -// Get gets the specified object and unmarshals the retrieved data into the "into" object. -// "into" is a Object that must have -// "Kind" and "APIVersion" specified in its "TypeMeta" field -// and "Name" and "Namespace" specified in its "ObjectMeta" field. -// "opts" configures the Get operation. -// When passed With WithGetOptions(o), the specified metav1.GetOptions is set. -func Get(into Object, opts ...GetOption) error { - name, namespace, err := k8sutil.GetNameAndNamespace(into) - if err != nil { - return err - } - gvk := into.GetObjectKind().GroupVersionKind() - apiVersion, kind := gvk.ToAPIVersionAndKind() - resourceClient, _, err := k8sclient.GetResourceClient(apiVersion, kind, namespace) - if err != nil { - return fmt.Errorf("failed to get resource client for (apiVersion:%s, kind:%s, ns:%s): %v", apiVersion, kind, namespace, err) - } - o := NewGetOp() - o.applyOpts(opts) - u, err := resourceClient.Get(name, *o.metaGetOptions) - if err != nil { - return err - } - if err := k8sutil.UnstructuredIntoRuntimeObject(u, into); err != nil { - return fmt.Errorf("failed to unmarshal the retrieved data: %v", err) - } - return nil -} - -// List retrieves the specified object list and unmarshals the retrieved data into the "into" object. -// "namespace" indicates which kubernetes namespace to look for the list of kubernetes objects. -// "into" is a sdkType.Object that must have -// "Kind" and "APIVersion" specified in its "TypeMeta" field -// "opts" configures the List operation. -// When passed With WithListOptions(o), the specified metav1.ListOptions is set. -func List(namespace string, into Object, opts ...ListOption) error { - gvk := into.GetObjectKind().GroupVersionKind() - apiVersion, kind := gvk.ToAPIVersionAndKind() - resourceClient, _, err := k8sclient.GetResourceClient(apiVersion, kind, namespace) - if err != nil { - return fmt.Errorf("failed to get resource client for (apiVersion:%s, kind:%s, ns:%s): %v", apiVersion, kind, namespace, err) - } - o := NewListOp() - o.applyOpts(opts) - l, err := resourceClient.List(*o.metaListOptions) - if err != nil { - return err - } - if err := k8sutil.RuntimeObjectIntoRuntimeObject(l, into); err != nil { - return fmt.Errorf("failed to unmarshal the retrieved data: %v", err) - } - return nil -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/service-monitor.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/service-monitor.go new file mode 100644 index 000000000..6c531ab5a --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/service-monitor.go @@ -0,0 +1,52 @@ +// Copyright 2018 The Operator-SDK 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 sdk + +import ( + monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// GenereateServiceMonitor generates a prometheus-operator ServiceMonitor object +// based on the passed Service object. +func GenerateServiceMonitor(s *v1.Service) *monitoringv1.ServiceMonitor { + labels := make(map[string]string) + for k, v := range s.ObjectMeta.Labels { + labels[k] = v + } + + return &monitoringv1.ServiceMonitor{ + TypeMeta: metav1.TypeMeta{ + Kind: "ServiceMonitor", + APIVersion: "monitoring.coreos.com/v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: s.ObjectMeta.Name, + Namespace: s.ObjectMeta.Namespace, + Labels: labels, + }, + Spec: monitoringv1.ServiceMonitorSpec{ + Selector: metav1.LabelSelector{ + MatchLabels: labels, + }, + Endpoints: []monitoringv1.Endpoint{ + { + Port: s.Spec.Ports[0].Name, + }, + }, + }, + } +} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/types.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/types.go deleted file mode 100644 index bd9b922f8..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/types.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 sdk - -import "k8s.io/apimachinery/pkg/runtime" - -// Object is the Kubernetes runtime.Object interface expected -// of all resources that the user can watch. -type Object runtime.Object - -// Event is triggered when some change has happened on the watched resources. -// If created or updated, Object would be the current state and Deleted=false. -// If deleted, Object would be the last known state and Deleted=true. -type Event struct { - Object Object - Deleted bool -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/watch-opt.go b/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/watch-opt.go deleted file mode 100644 index c7103ea38..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/sdk/watch-opt.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 sdk - -// WatchOp wraps all the options for Watch(). -type watchOp struct { - numWorkers int - labelSelector string -} - -// NewWatchOp create a new deafult WatchOp -func newWatchOp() *watchOp { - op := &watchOp{} - op.setDefaults() - return op -} - -func (op *watchOp) applyOpts(opts []watchOption) { - for _, opt := range opts { - opt(op) - } -} - -func (op *watchOp) setDefaults() { - if op.numWorkers == 0 { - op.numWorkers = 1 - } -} - -// WatchOption configures WatchOp. -type watchOption func(*watchOp) - -// WithNumWorkers sets the number of workers for the Watch() operation. -func WithNumWorkers(numWorkers int) watchOption { - return func(op *watchOp) { - op.numWorkers = numWorkers - } -} - -func WithLabelSelector(labelSelector string) watchOption { - return func(op *watchOp) { - op.labelSelector = labelSelector - } -} diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/tlsutil/error.go b/vendor/github.com/operator-framework/operator-sdk/pkg/tls/error.go similarity index 100% rename from vendor/github.com/operator-framework/operator-sdk/pkg/tlsutil/error.go rename to vendor/github.com/operator-framework/operator-sdk/pkg/tls/error.go diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/tlsutil/primitives.go b/vendor/github.com/operator-framework/operator-sdk/pkg/tls/primitives.go similarity index 99% rename from vendor/github.com/operator-framework/operator-sdk/pkg/tlsutil/primitives.go rename to vendor/github.com/operator-framework/operator-sdk/pkg/tls/primitives.go index a8673479b..0f9d935e9 100644 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/tlsutil/primitives.go +++ b/vendor/github.com/operator-framework/operator-sdk/pkg/tls/primitives.go @@ -87,7 +87,7 @@ func newSelfSignedCACertificate(key *rsa.PrivateKey) (*x509.Certificate, error) NotAfter: now.Add(duration365d).UTC(), KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, BasicConstraintsValid: true, - IsCA: true, + IsCA: true, } certDERBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, key.Public(), key) if err != nil { diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/tlsutil/tls.go b/vendor/github.com/operator-framework/operator-sdk/pkg/tls/tls.go similarity index 100% rename from vendor/github.com/operator-framework/operator-sdk/pkg/tlsutil/tls.go rename to vendor/github.com/operator-framework/operator-sdk/pkg/tls/tls.go diff --git a/vendor/github.com/operator-framework/operator-sdk/pkg/util/k8sutil/k8sutil.go b/vendor/github.com/operator-framework/operator-sdk/pkg/util/k8sutil/k8sutil.go deleted file mode 100644 index d2d23faa4..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/pkg/util/k8sutil/k8sutil.go +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 k8sutil - -import ( - "encoding/json" - "fmt" - "os" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/runtime/serializer" - intstr "k8s.io/apimachinery/pkg/util/intstr" - cgoscheme "k8s.io/client-go/kubernetes/scheme" -) - -var ( - // scheme tracks the type registry for the sdk - // This scheme is used to decode json data into the correct Go type based on the object's GVK - // All types that the operator watches must be added to this scheme - scheme = runtime.NewScheme() - codecs = serializer.NewCodecFactory(scheme) - decoderFunc = decoder -) - -func init() { - // Add the standard kubernetes [GVK:Types] type registry - // e.g (v1,Pods):&v1.Pod{} - metav1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - cgoscheme.AddToScheme(scheme) -} - -// UtilDecoderFunc retrieve the correct decoder from a GroupVersion -// and the schemes codec factory. -type UtilDecoderFunc func(schema.GroupVersion, serializer.CodecFactory) runtime.Decoder - -// SetDecoderFunc sets a non default decoder function -// This is used as a work around to add support for unstructured objects -func SetDecoderFunc(u UtilDecoderFunc) { - decoderFunc = u -} - -func decoder(gv schema.GroupVersion, codecs serializer.CodecFactory) runtime.Decoder { - codec := codecs.UniversalDecoder(gv) - return codec -} - -type addToSchemeFunc func(*runtime.Scheme) error - -// AddToSDKScheme allows CRDs to register their types with the sdk scheme -func AddToSDKScheme(addToScheme addToSchemeFunc) { - addToScheme(scheme) -} - -// RuntimeObjectFromUnstructured converts an unstructured to a runtime object -func RuntimeObjectFromUnstructured(u *unstructured.Unstructured) (runtime.Object, error) { - gvk := u.GroupVersionKind() - decoder := decoderFunc(gvk.GroupVersion(), codecs) - - b, err := u.MarshalJSON() - if err != nil { - return nil, fmt.Errorf("error running MarshalJSON on unstructured object: %v", err) - } - ro, _, err := decoder.Decode(b, &gvk, nil) - if err != nil { - return nil, fmt.Errorf("failed to decode json data with gvk(%v): %v", gvk.String(), err) - } - return ro, nil -} - -// UnstructuredFromRuntimeObject converts a runtime object to an unstructured -func UnstructuredFromRuntimeObject(ro runtime.Object) (*unstructured.Unstructured, error) { - b, err := json.Marshal(ro) - if err != nil { - return nil, fmt.Errorf("error running MarshalJSON on runtime object: %v", err) - } - var u unstructured.Unstructured - if err := json.Unmarshal(b, &u.Object); err != nil { - return nil, fmt.Errorf("failed to unmarshal json into unstructured object: %v", err) - } - return &u, nil -} - -// UnstructuredIntoRuntimeObject unmarshalls an unstructured into a given runtime object -// TODO: https://github.com/operator-framework/operator-sdk/issues/127 -func UnstructuredIntoRuntimeObject(u *unstructured.Unstructured, into runtime.Object) error { - gvk := u.GroupVersionKind() - decoder := decoderFunc(gvk.GroupVersion(), codecs) - - b, err := u.MarshalJSON() - if err != nil { - return err - } - _, _, err = decoder.Decode(b, &gvk, into) - if err != nil { - return fmt.Errorf("failed to decode json data with gvk(%v): %v", gvk.String(), err) - } - return nil -} - -// RuntimeObjectIntoRuntimeObject unmarshalls an runtime.Object into a given runtime object -func RuntimeObjectIntoRuntimeObject(from runtime.Object, into runtime.Object) error { - b, err := json.Marshal(from) - if err != nil { - return err - } - gvk := from.GetObjectKind().GroupVersionKind() - decoder := decoderFunc(gvk.GroupVersion(), codecs) - _, _, err = decoder.Decode(b, &gvk, into) - if err != nil { - return fmt.Errorf("failed to decode json data with gvk(%v): %v", gvk.String(), err) - } - return nil -} - -// GetNameAndNamespace extracts the name and namespace from the given runtime.Object -// and returns a error if any of those is missing. -func GetNameAndNamespace(object runtime.Object) (string, string, error) { - accessor := meta.NewAccessor() - name, err := accessor.Name(object) - if err != nil { - return "", "", fmt.Errorf("failed to get name for object: %v", err) - } - namespace, err := accessor.Namespace(object) - if err != nil { - return "", "", fmt.Errorf("failed to get namespace for object: %v", err) - } - return name, namespace, nil -} - -func ObjectInfo(kind, name, namespace string) string { - return kind + ": " + namespace + "/" + name -} - -// GetWatchNamespace returns the namespace the operator should be watching for changes -func GetWatchNamespace() (string, error) { - ns, found := os.LookupEnv(WatchNamespaceEnvVar) - if !found { - return "", fmt.Errorf("%s must be set", WatchNamespaceEnvVar) - } - return ns, nil -} - -// GetOperatorName return the operator name -func GetOperatorName() (string, error) { - operatorName, found := os.LookupEnv(OperatorNameEnvVar) - if !found { - return "", fmt.Errorf("%s must be set", OperatorNameEnvVar) - } - if len(operatorName) == 0 { - return "", fmt.Errorf("%s must not be empty", OperatorNameEnvVar) - } - return operatorName, nil -} - -// InitOperatorService return the static service which expose operator metrics -func InitOperatorService() (*v1.Service, error) { - operatorName, err := GetOperatorName() - if err != nil { - return nil, err - } - namespace, err := GetWatchNamespace() - if err != nil { - return nil, err - } - service := &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: operatorName, - Namespace: namespace, - Labels: map[string]string{"name": operatorName}, - }, - TypeMeta: metav1.TypeMeta{ - Kind: "Service", - APIVersion: "v1", - }, - Spec: v1.ServiceSpec{ - Ports: []v1.ServicePort{ - { - Port: PrometheusMetricsPort, - Protocol: v1.ProtocolTCP, - TargetPort: intstr.IntOrString{ - Type: intstr.String, - StrVal: PrometheusMetricsPortName, - }, - Name: PrometheusMetricsPortName, - }, - }, - Selector: map[string]string{"name": operatorName}, - }, - } - return service, nil -} diff --git a/vendor/github.com/operator-framework/operator-sdk/release.sh b/vendor/github.com/operator-framework/operator-sdk/release.sh index 5f0c343fa..7f6606832 100755 --- a/vendor/github.com/operator-framework/operator-sdk/release.sh +++ b/vendor/github.com/operator-framework/operator-sdk/release.sh @@ -26,7 +26,7 @@ fi # Detect whether versions in code were updated. CURR_VER="$(git describe --dirty --tags)" VER_FILE="version/version.go" -TOML_TMPL_FILE="pkg/generator/templates.go" +TOML_TMPL_FILE="pkg/scaffold/gopkgtoml.go" CURR_VER_VER_FILE="$(sed -nr 's/Version = "(.+)"/\1/p' "$VER_FILE" | tr -d '\s\t\n')" CURR_VER_TMPL_FILE="$(sed -nr 's/.*".*v(.+)".*#osdk_version_annotation/v\1/p' "$TOML_TMPL_FILE" | tr -d '\s\t\n')" if [ "$VER" != "$CURR_VER_VER_FILE" ] \ diff --git a/vendor/github.com/operator-framework/operator-sdk/test/.gitignore b/vendor/github.com/operator-framework/operator-sdk/test/.gitignore deleted file mode 100644 index 9daeafb98..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/vendor/github.com/operator-framework/operator-sdk/test/ansible-operator/Dockerfile b/vendor/github.com/operator-framework/operator-sdk/test/ansible-operator/Dockerfile index b4a2c70cc..1d5639ca7 100644 --- a/vendor/github.com/operator-framework/operator-sdk/test/ansible-operator/Dockerfile +++ b/vendor/github.com/operator-framework/operator-sdk/test/ansible-operator/Dockerfile @@ -1,6 +1,7 @@ FROM ansible/ansible-runner RUN pip install --upgrade setuptools +RUN pip install urllib3==1.23 RUN pip install openshift ansible-runner-http RUN echo "localhost ansible_connection=local" > /etc/ansible/hosts \ diff --git a/vendor/github.com/operator-framework/operator-sdk/test/ansible-operator/cmd/ansible-operator/main.go b/vendor/github.com/operator-framework/operator-sdk/test/ansible-operator/cmd/ansible-operator/main.go index b06b328b0..38d45eab2 100644 --- a/vendor/github.com/operator-framework/operator-sdk/test/ansible-operator/cmd/ansible-operator/main.go +++ b/vendor/github.com/operator-framework/operator-sdk/test/ansible-operator/cmd/ansible-operator/main.go @@ -17,18 +17,16 @@ package main import ( "flag" "log" - "math/rand" "runtime" "time" - "github.com/operator-framework/operator-sdk/pkg/ansible/controller" + "github.com/operator-framework/operator-sdk/pkg/ansible/operator" proxy "github.com/operator-framework/operator-sdk/pkg/ansible/proxy" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner" + "github.com/operator-framework/operator-sdk/pkg/k8sutil" sdkVersion "github.com/operator-framework/operator-sdk/version" "sigs.k8s.io/controller-runtime/pkg/client/config" "sigs.k8s.io/controller-runtime/pkg/manager" logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" - "sigs.k8s.io/controller-runtime/pkg/runtime/signals" "github.com/sirupsen/logrus" ) @@ -43,7 +41,14 @@ func main() { flag.Parse() logf.SetLogger(logf.ZapLogger(false)) - mgr, err := manager.New(config.GetConfigOrDie(), manager.Options{}) + namespace, err := k8sutil.GetWatchNamespace() + if err != nil { + log.Fatalf("failed to get watch namespace: %v", err) + } + + mgr, err := manager.New(config.GetConfigOrDie(), manager.Options{ + Namespace: namespace, + }) if err != nil { log.Fatal(err) } @@ -52,14 +57,17 @@ func main() { done := make(chan error) // start the proxy - proxy.RunProxy(done, proxy.Options{ + err = proxy.Run(done, proxy.Options{ Address: "localhost", Port: 8888, KubeConfig: mgr.GetConfig(), }) + if err != nil { + logrus.Fatalf("error starting proxy: %v", err) + } // start the operator - go runSDK(done, mgr) + go operator.Run(done, mgr, "/opt/ansible/watches.yaml", time.Minute) // wait for either to finish err = <-done @@ -69,23 +77,3 @@ func main() { logrus.Fatal(err.Error()) } } - -func runSDK(done chan error, mgr manager.Manager) { - watches, err := runner.NewFromWatches("/opt/ansible/watches.yaml") - if err != nil { - logrus.Error("Failed to get watches") - done <- err - return - } - rand.Seed(time.Now().Unix()) - c := signals.SetupSignalHandler() - - for gvk, runner := range watches { - controller.Add(mgr, controller.Options{ - GVK: gvk, - Runner: runner, - }) - } - log.Fatal(mgr.Start(c)) - done <- nil -} diff --git a/vendor/github.com/operator-framework/operator-sdk/test/e2e/incluster-test-code/memcached_test.go.tmpl b/vendor/github.com/operator-framework/operator-sdk/test/e2e/incluster-test-code/memcached_test.go.tmpl index 527371fc7..6f43c81b7 100644 --- a/vendor/github.com/operator-framework/operator-sdk/test/e2e/incluster-test-code/memcached_test.go.tmpl +++ b/vendor/github.com/operator-framework/operator-sdk/test/e2e/incluster-test-code/memcached_test.go.tmpl @@ -21,6 +21,7 @@ import ( "time" operator "github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1" + apis "github.com/example-inc/memcached-operator/pkg/apis" framework "github.com/operator-framework/operator-sdk/pkg/test" "github.com/operator-framework/operator-sdk/pkg/test/e2eutil" @@ -42,7 +43,7 @@ func TestMemcached(t *testing.T) { APIVersion: "cache.example.com/v1alpha1", }, } - err := framework.AddToFrameworkScheme(operator.AddToScheme, memcachedList) + err := framework.AddToFrameworkScheme(apis.AddToScheme, memcachedList) if err != nil { t.Fatalf("failed to add custom resource scheme to framework: %v", err) } diff --git a/vendor/github.com/operator-framework/operator-sdk/test/e2e/memcached_test.go b/vendor/github.com/operator-framework/operator-sdk/test/e2e/memcached_test.go index 638bafdbe..88ce30fc1 100644 --- a/vendor/github.com/operator-framework/operator-sdk/test/e2e/memcached_test.go +++ b/vendor/github.com/operator-framework/operator-sdk/test/e2e/memcached_test.go @@ -19,7 +19,8 @@ import ( "io/ioutil" "os" "os/exec" - "path" + "path/filepath" + "regexp" "strings" "testing" "time" @@ -32,10 +33,8 @@ import ( ) const ( - filemode = int(0664) - // amount of lines to remove from end of types file to allow us to fill in the - // blank structs - typesFileTrimAmount = 7 + filemode os.FileMode = 0664 + dirmode os.FileMode = 0750 ) func TestMemcached(t *testing.T) { @@ -54,33 +53,111 @@ func TestMemcached(t *testing.T) { defer func() { os.Chdir(cd) }() - os.Chdir(path.Join(gopath, "/src/github.com/example-inc")) + + // Setup + absProjectPath := filepath.Join(gopath, "src/github.com/example-inc") + if err := os.MkdirAll(absProjectPath, dirmode); err != nil { + t.Fatal(err) + } + if err := os.Chdir(absProjectPath); err != nil { + t.Fatal(err) + } + t.Log("Creating new operator project") cmdOut, err := exec.Command("operator-sdk", "new", - "memcached-operator", + "memcached-operator").CombinedOutput() + if err != nil { + // HACK: dep cannot resolve non-master branches as the base branch for PR's, + // so running `dep ensure` will fail when first running + // `operator-sdk new ...`. For now we can ignore the first solve failure. + // A permanent solution can be implemented once the following is merged: + // https://github.com/golang/dep/pull/1658 + solveFailRe := regexp.MustCompile(`(?m)^[ \t]*Solving failure:.+github\.com/operator-framework/operator-sdk.+:$`) + if !solveFailRe.Match(cmdOut) { + t.Fatalf("error: %v\nCommand Output: %s\n", err, string(cmdOut)) + } + } + ctx.AddFinalizerFn(func() error { return os.RemoveAll(absProjectPath) }) + + os.Chdir("memcached-operator") + prSlug, ok := os.LookupEnv("TRAVIS_PULL_REQUEST_SLUG") + if ok && prSlug != "" { + prSha, ok := os.LookupEnv("TRAVIS_PULL_REQUEST_SHA") + if ok && prSha != "" { + gopkg, err := ioutil.ReadFile("Gopkg.toml") + if err != nil { + t.Fatal(err) + } + // Match against the '#osdk_branch_annotation' used for version substitution + // and comment out the current branch. + branchRe := regexp.MustCompile("([ ]+)(.+#osdk_branch_annotation)") + gopkg = branchRe.ReplaceAll(gopkg, []byte("$1# $2")) + versionRe := regexp.MustCompile("([ ]+)(.+#osdk_version_annotation)") + gopkg = versionRe.ReplaceAll(gopkg, []byte("$1# $2")) + // Plug in the fork to test against so `dep ensure` can resolve dependencies + // correctly. + gopkgString := string(gopkg) + gopkgLoc := strings.LastIndex(gopkgString, "\n name = \"github.com/operator-framework/operator-sdk\"\n") + gopkgString = gopkgString[:gopkgLoc] + "\n source = \"https://github.com/" + prSlug + "\"\n revision = \"" + prSha + "\"\n" + gopkgString[gopkgLoc+1:] + err = ioutil.WriteFile("Gopkg.toml", []byte(gopkgString), filemode) + if err != nil { + t.Fatalf("failed to write updated Gopkg.toml: %v", err) + } + + t.Logf("Gopkg.toml: %v", gopkgString) + } else { + t.Fatal("could not find sha of PR") + } + } + cmdOut, err = exec.Command("dep", "ensure").CombinedOutput() + if err != nil { + t.Fatalf("error: %v\nCommand Output: %s\n", err, string(cmdOut)) + } + + cmdOut, err = exec.Command("operator-sdk", + "add", + "api", + "--api-version=cache.example.com/v1alpha1", + "--kind=Memcached").CombinedOutput() + if err != nil { + t.Fatalf("error: %v\nCommand Output: %s\n", err, string(cmdOut)) + } + cmdOut, err = exec.Command("operator-sdk", + "add", + "controller", "--api-version=cache.example.com/v1alpha1", "--kind=Memcached").CombinedOutput() if err != nil { t.Fatalf("error: %v\nCommand Output: %s\n", err, string(cmdOut)) } - ctx.AddFinalizerFn(func() error { return os.RemoveAll(path.Join(gopath, "/src/github.com/example-inc/memcached-operator")) }) - os.Chdir("memcached-operator") - cmdOut, err = exec.Command("cp", "-a", path.Join(gopath, "/src/github.com/operator-framework/operator-sdk/example/memcached-operator/handler.go.tmpl"), "pkg/stub/handler.go").CombinedOutput() + cmdOut, err = exec.Command("cp", "-a", filepath.Join(gopath, "src/github.com/operator-framework/operator-sdk/example/memcached-operator/memcached_controller.go.tmpl"), + "pkg/controller/memcached/memcached_controller.go").CombinedOutput() if err != nil { - t.Fatalf("could not copy memcached example to to pkg/stub/handler.go: %v\nCommand Output:\n%v", err, string(cmdOut)) + t.Fatalf("could not copy memcached example to to pkg/controller/memcached/memcached_controller.go: %v\nCommand Output:\n%v", err, string(cmdOut)) } - memcachedTypesFile, err := ioutil.ReadFile("pkg/apis/cache/v1alpha1/types.go") + memcachedTypesFile, err := ioutil.ReadFile("pkg/apis/cache/v1alpha1/memcached_types.go") if err != nil { t.Fatal(err) } memcachedTypesFileLines := bytes.Split(memcachedTypesFile, []byte("\n")) - memcachedTypesFileLines = memcachedTypesFileLines[:len(memcachedTypesFileLines)-typesFileTrimAmount] - memcachedTypesFileLines = append(memcachedTypesFileLines, []byte("type MemcachedSpec struct { Size int32 `json:\"size\"`}")) - memcachedTypesFileLines = append(memcachedTypesFileLines, []byte("type MemcachedStatus struct {Nodes []string `json:\"nodes\"`}\n")) - os.Remove("pkg/apis/cache/v1alpha1/types.go") - err = ioutil.WriteFile("pkg/apis/cache/v1alpha1/types.go", bytes.Join(memcachedTypesFileLines, []byte("\n")), os.FileMode(filemode)) + for lineNum, line := range memcachedTypesFileLines { + if strings.Contains(string(line), "type MemcachedSpec struct {") { + memcachedTypesFileLinesIntermediate := append(memcachedTypesFileLines[:lineNum+1], []byte("\tSize int32 `json:\"size\"`")) + memcachedTypesFileLines = append(memcachedTypesFileLinesIntermediate, memcachedTypesFileLines[lineNum+3:]...) + break + } + } + for lineNum, line := range memcachedTypesFileLines { + if strings.Contains(string(line), "type MemcachedStatus struct {") { + memcachedTypesFileLinesIntermediate := append(memcachedTypesFileLines[:lineNum+1], []byte("\tNodes []string `json:\"nodes\"`")) + memcachedTypesFileLines = append(memcachedTypesFileLinesIntermediate, memcachedTypesFileLines[lineNum+3:]...) + break + } + } + os.Remove("pkg/apis/cache/v1alpha1/memcached_types.go") + err = ioutil.WriteFile("pkg/apis/cache/v1alpha1/memcached_types.go", bytes.Join(memcachedTypesFileLines, []byte("\n")), filemode) if err != nil { t.Fatal(err) } @@ -92,10 +169,10 @@ func TestMemcached(t *testing.T) { } t.Log("Copying test files to ./test") - if err = os.MkdirAll("./test", os.FileMode(int(0755))); err != nil { + if err = os.MkdirAll("./test", dirmode); err != nil { t.Fatalf("could not create test/e2e dir: %v", err) } - cmdOut, err = exec.Command("cp", "-a", path.Join(gopath, "/src/github.com/operator-framework/operator-sdk/test/e2e/incluster-test-code"), "./test/e2e").CombinedOutput() + cmdOut, err = exec.Command("cp", "-a", filepath.Join(gopath, "src/github.com/operator-framework/operator-sdk/test/e2e/incluster-test-code"), "./test/e2e").CombinedOutput() if err != nil { t.Fatalf("could not copy tests to test/e2e: %v\nCommand Output:\n%v", err, string(cmdOut)) } @@ -108,29 +185,8 @@ func TestMemcached(t *testing.T) { if err != nil { t.Fatalf("could not rename test/e2e/memcached_test.go.tmpl: %v\nCommand Output:\n%v", err, string(cmdOut)) } + t.Log("Pulling new dependencies with dep ensure") - prSlug, ok := os.LookupEnv("TRAVIS_PULL_REQUEST_SLUG") - if ok && prSlug != "" { - prSha, ok := os.LookupEnv("TRAVIS_PULL_REQUEST_SHA") - if ok && prSha != "" { - gopkg, err := ioutil.ReadFile("Gopkg.toml") - if err != nil { - t.Fatal(err) - } - // TODO: make this match more complete in case we add another repo tracking master - gopkg = bytes.Replace(gopkg, []byte("branch = \"master\""), []byte("# branch = \"master\""), -1) - gopkgString := string(gopkg) - gopkgLoc := strings.LastIndex(gopkgString, "\n name = \"github.com/operator-framework/operator-sdk\"\n") - gopkgString = gopkgString[:gopkgLoc] + "\n source = \"https://github.com/" + prSlug + "\"\n revision = \"" + prSha + "\"\n" + gopkgString[gopkgLoc+1:] - err = ioutil.WriteFile("Gopkg.toml", []byte(gopkgString), os.FileMode(filemode)) - if err != nil { - t.Fatalf("failed to write updated Gopkg.toml: %v", err) - } - t.Logf("Gopkg.toml: %v", gopkgString) - } else { - t.Fatal("could not find sha of PR") - } - } cmdOut, err = exec.Command("dep", "ensure").CombinedOutput() if err != nil { t.Fatalf("dep ensure failed: %v\nCommand Output:\n%v", err, string(cmdOut)) @@ -138,12 +194,15 @@ func TestMemcached(t *testing.T) { // link local sdk to vendor if not in travis if prSlug == "" { os.RemoveAll("vendor/github.com/operator-framework/operator-sdk/pkg") - os.Symlink(path.Join(gopath, "/src/github.com/operator-framework/operator-sdk/pkg"), + os.Symlink(filepath.Join(gopath, "src/github.com/operator-framework/operator-sdk/pkg"), "vendor/github.com/operator-framework/operator-sdk/pkg") } // create crd - crdYAML, err := ioutil.ReadFile("deploy/crd.yaml") + crdYAML, err := ioutil.ReadFile("deploy/crds/cache_v1alpha1_memcached_crd.yaml") + if err != nil { + t.Fatalf("could not read crd file: %v", err) + } err = ctx.CreateFromYAML(crdYAML) if err != nil { t.Fatal(err) @@ -162,7 +221,7 @@ func memcachedScaleTest(t *testing.T, f *framework.Framework, ctx framework.Test // create example-memcached yaml file err := ioutil.WriteFile("deploy/cr.yaml", []byte("apiVersion: \"cache.example.com/v1alpha1\"\nkind: \"Memcached\"\nmetadata:\n name: \"example-memcached\"\nspec:\n size: 3"), - os.FileMode(filemode)) + filemode) if err != nil { return err } @@ -265,7 +324,7 @@ func MemcachedCluster(t *testing.T) { t.Fatal(err) } operatorYAML = bytes.Replace(operatorYAML, []byte("imagePullPolicy: Always"), []byte("imagePullPolicy: Never"), 1) - err = ioutil.WriteFile("deploy/operator.yaml", operatorYAML, os.FileMode(filemode)) + err = ioutil.WriteFile("deploy/operator.yaml", operatorYAML, filemode) if err != nil { t.Fatal(err) } @@ -293,7 +352,7 @@ func MemcachedCluster(t *testing.T) { } // create sa - saYAML, err := ioutil.ReadFile("deploy/sa.yaml") + saYAML, err := ioutil.ReadFile("deploy/service_account.yaml") if err != nil { t.Fatal(err) } @@ -304,15 +363,24 @@ func MemcachedCluster(t *testing.T) { t.Log("Created sa") // create rbac - rbacYAML, err := ioutil.ReadFile("deploy/rbac.yaml") - rbacYAMLSplit := bytes.Split(rbacYAML, []byte("\n---\n")) - for _, rbacSpec := range rbacYAMLSplit { - err = ctx.CreateFromYAML(rbacSpec) - if err != nil { - t.Fatal(err) - } + roleYAML, err := ioutil.ReadFile("deploy/role.yaml") + if err != nil { + t.Fatalf("could not read role file: %v", err) + } + err = ctx.CreateFromYAML(roleYAML) + if err != nil { + t.Fatal(err) + } + t.Log("Created role") + roleBindingYAML, err := ioutil.ReadFile("deploy/role_binding.yaml") + if err != nil { + t.Fatalf("could not read role_binding file: %v", err) } - t.Log("Created rbac") + err = ctx.CreateFromYAML(roleBindingYAML) + if err != nil { + t.Fatal(err) + } + t.Log("Created role_binding") // create operator operatorYAML, err = ioutil.ReadFile("deploy/operator.yaml") @@ -347,7 +415,7 @@ func MemcachedClusterTest(t *testing.T) { defer ctx.Cleanup(t) // create sa - saYAML, err := ioutil.ReadFile("deploy/sa.yaml") + saYAML, err := ioutil.ReadFile("deploy/service_account.yaml") if err != nil { t.Fatal(err) } @@ -358,12 +426,24 @@ func MemcachedClusterTest(t *testing.T) { t.Log("Created sa") // create rbac - rbacYAML, err := ioutil.ReadFile("deploy/rbac.yaml") - err = ctx.CreateFromYAML(rbacYAML) + roleYAML, err := ioutil.ReadFile("deploy/role.yaml") if err != nil { - t.Fatalf("failed to create rbac: %v", err) + t.Fatalf("could not read role file: %v", err) + } + err = ctx.CreateFromYAML(roleYAML) + if err != nil { + t.Fatal(err) + } + t.Log("Created role") + roleBindingYAML, err := ioutil.ReadFile("deploy/role_binding.yaml") + if err != nil { + t.Fatalf("could not read role_binding file: %v", err) + } + err = ctx.CreateFromYAML(roleBindingYAML) + if err != nil { + t.Fatal(err) } - t.Log("Created rbac") + t.Log("Created role_binding") namespace, err := ctx.GetNamespace() if err != nil { diff --git a/vendor/github.com/operator-framework/operator-sdk/test/e2e/tls_util_test.go b/vendor/github.com/operator-framework/operator-sdk/test/e2e/tls_util_test.go index f87a60f3d..14b39e46f 100644 --- a/vendor/github.com/operator-framework/operator-sdk/test/e2e/tls_util_test.go +++ b/vendor/github.com/operator-framework/operator-sdk/test/e2e/tls_util_test.go @@ -19,7 +19,7 @@ import ( "reflect" "testing" - "github.com/operator-framework/operator-sdk/pkg/tlsutil" + tlsutil "github.com/operator-framework/operator-sdk/pkg/tls" framework "github.com/operator-framework/operator-sdk/test/e2e/framework" "k8s.io/api/core/v1" diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-ansible.sh b/vendor/github.com/operator-framework/operator-sdk/test/test-ansible.sh deleted file mode 100755 index 4077f590e..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/test/test-ansible.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -set -ev - -# switch to the "default" namespace if on openshift, to match the minikube test -if which oc 2>/dev/null; then oc project default; fi - -# build operator binary and base image -go build -o test/ansible-operator/ansible-operator test/ansible-operator/cmd/ansible-operator/main.go -pushd test -pushd ansible-operator -docker build -t quay.io/water-hole/ansible-operator . -popd - -# create and build the operator -operator-sdk new memcached-operator --api-version=ansible.example.com/v1alpha1 --kind=Memcached --type=ansible -cp ansible-memcached/tasks.yml memcached-operator/roles/Memcached/tasks/main.yml -cp ansible-memcached/defaults.yml memcached-operator/roles/Memcached/defaults/main.yml -cp -a ansible-memcached/memfin memcached-operator/roles/ -cat ansible-memcached/watches-finalizer.yaml >> memcached-operator/watches.yaml - -pushd memcached-operator -operator-sdk build quay.io/example/memcached-operator:v0.0.2 -sed -i 's|REPLACE_IMAGE|quay.io/example/memcached-operator:v0.0.2|g' deploy/operator.yaml -sed -i 's|Always|Never|g' deploy/operator.yaml - -# deploy the operator -kubectl create -f deploy/rbac.yaml -kubectl create -f deploy/crd.yaml -kubectl create -f deploy/operator.yaml - -# wait for operator pod to run -kubectl rollout status deployment/memcached-operator -kubectl logs deployment/memcached-operator - -# create CR -kubectl create -f deploy/cr.yaml -until kubectl get deployment -l app=memcached | grep memcached; do sleep 1; done -memcached_deployment=$(kubectl get deployment -l app=memcached -o jsonpath="{..metadata.name}") -kubectl rollout status deployment/${memcached_deployment} -kubectl logs deployment/${memcached_deployment} - -# Test finalizer -kubectl delete -f deploy/cr.yaml --wait=true -kubectl logs deployment/memcached-operator | grep "this is a finalizer" - -popd -popd diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/crds/cache_v1alpha1_memcached_cr.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/crds/cache_v1alpha1_memcached_cr.yaml new file mode 100644 index 000000000..2b8f17c39 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/crds/cache_v1alpha1_memcached_cr.yaml @@ -0,0 +1,7 @@ +apiVersion: cache.example.com/v1alpha1 +kind: Memcached +metadata: + name: example-memcached +spec: + # Add fields here + size: 3 diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/crd.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/crds/cache_v1alpha1_memcached_crd.yaml similarity index 100% rename from vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/crd.yaml rename to vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/crds/cache_v1alpha1_memcached_crd.yaml diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/namespace-init.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/namespace-init.yaml index 616ffcdca..73b814767 100644 --- a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/namespace-init.yaml +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/namespace-init.yaml @@ -2,20 +2,13 @@ apiVersion: v1 kind: ServiceAccount metadata: name: memcached-operator - --- - +apiVersion: rbac.authorization.k8s.io/v1 kind: Role -apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: + creationTimestamp: null name: memcached-operator rules: -- apiGroups: - - cache.example.com - resources: - - "*" - verbs: - - "*" - apiGroups: - "" resources: @@ -27,7 +20,7 @@ rules: - configmaps - secrets verbs: - - "*" + - '*' - apiGroups: - apps resources: @@ -36,12 +29,16 @@ rules: - replicasets - statefulsets verbs: - - "*" - + - '*' +- apiGroups: + - cache.example.com + resources: + - '*' + verbs: + - '*' --- - kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: memcached-operator subjects: @@ -51,9 +48,7 @@ roleRef: kind: Role name: memcached-operator apiGroup: rbac.authorization.k8s.io - --- - apiVersion: apps/v1 kind: Deployment metadata: @@ -71,7 +66,8 @@ spec: serviceAccountName: memcached-operator containers: - name: memcached-operator - image: quay.io/coreos/operator-sdk-dev:test-framework-operator + # Replace this with the built image name + image: quay.io/coreos/operator-sdk-dev:test-framework-operator-runtime ports: - containerPort: 60000 name: metrics diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/operator.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/operator.yaml index c6d41c356..6552adc6e 100644 --- a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/operator.yaml +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/operator.yaml @@ -15,7 +15,8 @@ spec: serviceAccountName: memcached-operator containers: - name: memcached-operator - image: quay.io/coreos/operator-sdk-dev:test-framework-operator + # Replace this with the built image name + image: quay.io/coreos/operator-sdk-dev:test-framework-operator-runtime ports: - containerPort: 60000 name: metrics diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/rbac.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/rbac.yaml deleted file mode 100644 index 6b5c50692..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/rbac.yaml +++ /dev/null @@ -1,46 +0,0 @@ -kind: Role -apiVersion: rbac.authorization.k8s.io/v1beta1 -metadata: - name: memcached-operator -rules: -- apiGroups: - - cache.example.com - resources: - - "*" - verbs: - - "*" -- apiGroups: - - "" - resources: - - pods - - services - - endpoints - - persistentvolumeclaims - - events - - configmaps - - secrets - verbs: - - "*" -- apiGroups: - - apps - resources: - - deployments - - daemonsets - - replicasets - - statefulsets - verbs: - - "*" - ---- - -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 -metadata: - name: memcached-operator -subjects: -- kind: ServiceAccount - name: memcached-operator -roleRef: - kind: Role - name: memcached-operator - apiGroup: rbac.authorization.k8s.io diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/role.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/role.yaml new file mode 100644 index 000000000..a3075d534 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/role.yaml @@ -0,0 +1,33 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + creationTimestamp: null + name: memcached-operator +rules: +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' +- apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' +- apiGroups: + - cache.example.com + resources: + - '*' + verbs: + - '*' diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/role_binding.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/role_binding.yaml new file mode 100644 index 000000000..322ecc9e6 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/role_binding.yaml @@ -0,0 +1,11 @@ +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: memcached-operator +subjects: +- kind: ServiceAccount + name: memcached-operator +roleRef: + kind: Role + name: memcached-operator + apiGroup: rbac.authorization.k8s.io diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/sa.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/sa.yaml deleted file mode 100644 index 3d20ca24c..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/sa.yaml +++ /dev/null @@ -1,4 +0,0 @@ -kind: ServiceAccount -apiVersion: v1 -metadata: - name: memcached-operator diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/service_account.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/service_account.yaml new file mode 100644 index 000000000..8d58bc783 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/service_account.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: memcached-operator diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/test-pod.yaml b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/test-pod.yaml new file mode 100644 index 000000000..bb7e32515 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/deploy/test-pod.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Pod +metadata: + name: -test +spec: + restartPolicy: Never + containers: + - name: -test + image: + imagePullPolicy: Always + command: ["/go-test.sh"] + env: + - name: + valueFrom: + fieldRef: + fieldPath: metadata.namespace diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/memcached_test.go b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/memcached_test.go index 1325a0e5a..21df1dae4 100644 --- a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/memcached_test.go +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/memcached_test.go @@ -22,6 +22,7 @@ import ( framework "github.com/operator-framework/operator-sdk/pkg/test" "github.com/operator-framework/operator-sdk/pkg/test/e2eutil" + apis "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis" operator "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -30,7 +31,7 @@ import ( var ( retryInterval = time.Second * 5 - timeout = time.Second * 30 + timeout = time.Second * 60 cleanupRetryInterval = time.Second * 1 cleanupTimeout = time.Second * 5 ) @@ -42,7 +43,7 @@ func TestMemcached(t *testing.T) { APIVersion: "cache.example.com/v1alpha1", }, } - err := framework.AddToFrameworkScheme(operator.AddToScheme, memcachedList) + err := framework.AddToFrameworkScheme(apis.AddToScheme, memcachedList) if err != nil { t.Fatalf("failed to add custom resource scheme to framework: %v", err) } diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/addtoscheme_cache_v1alpha1.go b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/addtoscheme_cache_v1alpha1.go new file mode 100644 index 000000000..117b8dfb5 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/addtoscheme_cache_v1alpha1.go @@ -0,0 +1,24 @@ +// Copyright 2018 The Operator-SDK 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 apis + +import ( + "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1" +) + +func init() { + // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back + AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme) +} diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/apis.go b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/apis.go new file mode 100644 index 000000000..6f7914916 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/apis.go @@ -0,0 +1,27 @@ +// Copyright 2018 The Operator-SDK 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 apis + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// AddToSchemes may be used to add all resources defined in the project to a Scheme +var AddToSchemes runtime.SchemeBuilder + +// AddToScheme adds all Resources to the Scheme +func AddToScheme(s *runtime.Scheme) error { + return AddToSchemes.AddToScheme(s) +} diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/doc.go b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/doc.go new file mode 100644 index 000000000..84fd6d207 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/doc.go @@ -0,0 +1,18 @@ +// Copyright 2018 The Operator-SDK 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 v1alpha1 contains API Schema definitions for the cache v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +groupName=cache.example.com +package v1alpha1 diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/memcached_types.go b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/memcached_types.go new file mode 100644 index 000000000..231543b66 --- /dev/null +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/memcached_types.go @@ -0,0 +1,56 @@ +// Copyright 2018 The Operator-SDK 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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +type MemcachedSpec struct { + // Size is the size of the memcached deployment + Size int32 `json:"size"` +} +type MemcachedStatus struct { + // Nodes are the names of the memcached pods + Nodes []string `json:"nodes"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Memcached is the Schema for the memcacheds API +// +k8s:openapi-gen=true +type Memcached struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MemcachedSpec `json:"spec,omitempty"` + Status MemcachedStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MemcachedList contains a list of Memcached +type MemcachedList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Memcached `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Memcached{}, &MemcachedList{}) +} diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/register.go b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/register.go index e7c3da87f..6eb96210b 100644 --- a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/register.go +++ b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/register.go @@ -12,38 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +// NOTE: Boilerplate only. Ignore this file. + +// Package v1alpha1 contains API Schema definitions for the cache v1alpha1 API group +// +k8s:deepcopy-gen=package,register +// +groupName=cache.example.com package v1alpha1 import ( - sdkK8sutil "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - version = "v1alpha1" - groupName = "cache.example.com" + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" ) var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme - // SchemeGroupVersion is the group version used to register these objects. - SchemeGroupVersion = schema.GroupVersion{Group: groupName, Version: version} -) - -func init() { - sdkK8sutil.AddToSDKScheme(AddToScheme) -} + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "cache.example.com", Version: "v1alpha1"} -// addKnownTypes adds the set of types defined in this package to the supplied scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &Memcached{}, - &MemcachedList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} +) diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/types.go b/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/types.go deleted file mode 100644 index b4462ee37..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1/types.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018 The Operator-SDK 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 v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type MemcachedList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - Items []Memcached `json:"items"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type Memcached struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata"` - Spec MemcachedSpec `json:"spec"` - Status MemcachedStatus `json:"status,omitempty"` -} - -type MemcachedSpec struct { - Size int32 `json:"size"` -} -type MemcachedStatus struct { - Nodes []string `json:"nodes"` -} diff --git a/vendor/github.com/operator-framework/operator-sdk/test/test-go.sh b/vendor/github.com/operator-framework/operator-sdk/test/test-go.sh deleted file mode 100755 index 176cec659..000000000 --- a/vendor/github.com/operator-framework/operator-sdk/test/test-go.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -set -e - -go test ./commands/... -go test ./pkg/... -go test ./test/e2e/... -cd test/test-framework - -# test framework with defaults -operator-sdk test local . - -# test operator-sdk test flags -operator-sdk test local . --global-manifest deploy/crd.yaml --namespaced-manifest deploy/namespace-init.yaml --go-test-flags "-parallel 1" --kubeconfig $HOME/.kube/config - -# test operator-sdk test local single namespace mode -kubectl create namespace test-memcached -operator-sdk test local . --namespace=test-memcached -kubectl delete namespace test-memcached - -# go back to project root -cd ../.. -go vet ./... -./hack/check_license.sh -./hack/check_error_case.sh - -# Make sure repo is in clean state -git diff --exit-code diff --git a/vendor/github.com/operator-framework/operator-sdk/version/version.go b/vendor/github.com/operator-framework/operator-sdk/version/version.go index 617efb392..47d2f0927 100644 --- a/vendor/github.com/operator-framework/operator-sdk/version/version.go +++ b/vendor/github.com/operator-framework/operator-sdk/version/version.go @@ -15,5 +15,5 @@ package version var ( - Version = "0.0.7" + Version = "v0.1.1" ) diff --git a/vendor/github.com/pborman/uuid/.travis.yml b/vendor/github.com/pborman/uuid/.travis.yml new file mode 100644 index 000000000..3deb4a124 --- /dev/null +++ b/vendor/github.com/pborman/uuid/.travis.yml @@ -0,0 +1,10 @@ +language: go + +go: + - "1.9" + - "1.10" + - "1.11" + - tip + +script: + - go test -v ./... diff --git a/vendor/github.com/pborman/uuid/CONTRIBUTING.md b/vendor/github.com/pborman/uuid/CONTRIBUTING.md new file mode 100644 index 000000000..04fdf09f1 --- /dev/null +++ b/vendor/github.com/pborman/uuid/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to contribute + +We definitely welcome patches and contribution to this project! + +### Legal requirements + +In order to protect both you and ourselves, you will need to sign the +[Contributor License Agreement](https://cla.developers.google.com/clas). + +You may have already signed it for other Google projects. diff --git a/vendor/github.com/pborman/uuid/CONTRIBUTORS b/vendor/github.com/pborman/uuid/CONTRIBUTORS new file mode 100644 index 000000000..b382a04ed --- /dev/null +++ b/vendor/github.com/pborman/uuid/CONTRIBUTORS @@ -0,0 +1 @@ +Paul Borman diff --git a/vendor/github.com/pborman/uuid/LICENSE b/vendor/github.com/pborman/uuid/LICENSE new file mode 100644 index 000000000..5dc68268d --- /dev/null +++ b/vendor/github.com/pborman/uuid/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009,2014 Google 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 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/pborman/uuid/README.md b/vendor/github.com/pborman/uuid/README.md new file mode 100644 index 000000000..810ad40dc --- /dev/null +++ b/vendor/github.com/pborman/uuid/README.md @@ -0,0 +1,15 @@ +This project was automatically exported from code.google.com/p/go-uuid + +# uuid ![build status](https://travis-ci.org/pborman/uuid.svg?branch=master) +The uuid package generates and inspects UUIDs based on [RFC 4122](http://tools.ietf.org/html/rfc4122) and DCE 1.1: Authentication and Security Services. + +This package now leverages the github.com/google/uuid package (which is based off an earlier version of this package). + +###### Install +`go get github.com/pborman/uuid` + +###### Documentation +[![GoDoc](https://godoc.org/github.com/pborman/uuid?status.svg)](http://godoc.org/github.com/pborman/uuid) + +Full `go doc` style documentation for the package can be viewed online without installing this package by using the GoDoc site here: +http://godoc.org/github.com/pborman/uuid diff --git a/vendor/github.com/pborman/uuid/dce.go b/vendor/github.com/pborman/uuid/dce.go new file mode 100644 index 000000000..50a0f2d09 --- /dev/null +++ b/vendor/github.com/pborman/uuid/dce.go @@ -0,0 +1,84 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "fmt" + "os" +) + +// A Domain represents a Version 2 domain +type Domain byte + +// Domain constants for DCE Security (Version 2) UUIDs. +const ( + Person = Domain(0) + Group = Domain(1) + Org = Domain(2) +) + +// NewDCESecurity returns a DCE Security (Version 2) UUID. +// +// The domain should be one of Person, Group or Org. +// On a POSIX system the id should be the users UID for the Person +// domain and the users GID for the Group. The meaning of id for +// the domain Org or on non-POSIX systems is site defined. +// +// For a given domain/id pair the same token may be returned for up to +// 7 minutes and 10 seconds. +func NewDCESecurity(domain Domain, id uint32) UUID { + uuid := NewUUID() + if uuid != nil { + uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 + uuid[9] = byte(domain) + binary.BigEndian.PutUint32(uuid[0:], id) + } + return uuid +} + +// NewDCEPerson returns a DCE Security (Version 2) UUID in the person +// domain with the id returned by os.Getuid. +// +// NewDCEPerson(Person, uint32(os.Getuid())) +func NewDCEPerson() UUID { + return NewDCESecurity(Person, uint32(os.Getuid())) +} + +// NewDCEGroup returns a DCE Security (Version 2) UUID in the group +// domain with the id returned by os.Getgid. +// +// NewDCEGroup(Group, uint32(os.Getgid())) +func NewDCEGroup() UUID { + return NewDCESecurity(Group, uint32(os.Getgid())) +} + +// Domain returns the domain for a Version 2 UUID or false. +func (uuid UUID) Domain() (Domain, bool) { + if v, _ := uuid.Version(); v != 2 { + return 0, false + } + return Domain(uuid[9]), true +} + +// Id returns the id for a Version 2 UUID or false. +func (uuid UUID) Id() (uint32, bool) { + if v, _ := uuid.Version(); v != 2 { + return 0, false + } + return binary.BigEndian.Uint32(uuid[0:4]), true +} + +func (d Domain) String() string { + switch d { + case Person: + return "Person" + case Group: + return "Group" + case Org: + return "Org" + } + return fmt.Sprintf("Domain%d", int(d)) +} diff --git a/vendor/github.com/pborman/uuid/doc.go b/vendor/github.com/pborman/uuid/doc.go new file mode 100644 index 000000000..727d76167 --- /dev/null +++ b/vendor/github.com/pborman/uuid/doc.go @@ -0,0 +1,13 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// The uuid package generates and inspects UUIDs. +// +// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security +// Services. +// +// This package is a partial wrapper around the github.com/google/uuid package. +// This package represents a UUID as []byte while github.com/google/uuid +// represents a UUID as [16]byte. +package uuid diff --git a/vendor/github.com/pborman/uuid/hash.go b/vendor/github.com/pborman/uuid/hash.go new file mode 100644 index 000000000..a0420c1ef --- /dev/null +++ b/vendor/github.com/pborman/uuid/hash.go @@ -0,0 +1,53 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "crypto/md5" + "crypto/sha1" + "hash" +) + +// Well known Name Space IDs and UUIDs +var ( + NameSpace_DNS = Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + NameSpace_URL = Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8") + NameSpace_OID = Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8") + NameSpace_X500 = Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8") + NIL = Parse("00000000-0000-0000-0000-000000000000") +) + +// NewHash returns a new UUID derived from the hash of space concatenated with +// data generated by h. The hash should be at least 16 byte in length. The +// first 16 bytes of the hash are used to form the UUID. The version of the +// UUID will be the lower 4 bits of version. NewHash is used to implement +// NewMD5 and NewSHA1. +func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { + h.Reset() + h.Write(space) + h.Write([]byte(data)) + s := h.Sum(nil) + uuid := make([]byte, 16) + copy(uuid, s) + uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) + uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant + return uuid +} + +// NewMD5 returns a new MD5 (Version 3) UUID based on the +// supplied name space and data. +// +// NewHash(md5.New(), space, data, 3) +func NewMD5(space UUID, data []byte) UUID { + return NewHash(md5.New(), space, data, 3) +} + +// NewSHA1 returns a new SHA1 (Version 5) UUID based on the +// supplied name space and data. +// +// NewHash(sha1.New(), space, data, 5) +func NewSHA1(space UUID, data []byte) UUID { + return NewHash(sha1.New(), space, data, 5) +} diff --git a/vendor/github.com/pborman/uuid/marshal.go b/vendor/github.com/pborman/uuid/marshal.go new file mode 100644 index 000000000..35b89352a --- /dev/null +++ b/vendor/github.com/pborman/uuid/marshal.go @@ -0,0 +1,85 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "errors" + "fmt" + + guuid "github.com/google/uuid" +) + +// MarshalText implements encoding.TextMarshaler. +func (u UUID) MarshalText() ([]byte, error) { + if len(u) != 16 { + return nil, nil + } + var js [36]byte + encodeHex(js[:], u) + return js[:], nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (u *UUID) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + id := Parse(string(data)) + if id == nil { + return errors.New("invalid UUID") + } + *u = id + return nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (u UUID) MarshalBinary() ([]byte, error) { + return u[:], nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (u *UUID) UnmarshalBinary(data []byte) error { + if len(data) == 0 { + return nil + } + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + var id [16]byte + copy(id[:], data) + *u = id[:] + return nil +} + +// MarshalText implements encoding.TextMarshaler. +func (u Array) MarshalText() ([]byte, error) { + var js [36]byte + encodeHex(js[:], u[:]) + return js[:], nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (u *Array) UnmarshalText(data []byte) error { + id, err := guuid.ParseBytes(data) + if err != nil { + return err + } + *u = Array(id) + return nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (u Array) MarshalBinary() ([]byte, error) { + return u[:], nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (u *Array) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(u[:], data) + return nil +} diff --git a/vendor/github.com/pborman/uuid/marshal_test.go b/vendor/github.com/pborman/uuid/marshal_test.go new file mode 100644 index 000000000..4e85b6bab --- /dev/null +++ b/vendor/github.com/pborman/uuid/marshal_test.go @@ -0,0 +1,124 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "encoding/json" + "reflect" + "testing" +) + +var testUUID = Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") +var testArray = testUUID.Array() + +func TestJSON(t *testing.T) { + type S struct { + ID1 UUID + ID2 UUID + } + s1 := S{ID1: testUUID} + data, err := json.Marshal(&s1) + if err != nil { + t.Fatal(err) + } + var s2 S + if err := json.Unmarshal(data, &s2); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(&s1, &s2) { + t.Errorf("got %#v, want %#v", s2, s1) + } +} + +func TestJSONArray(t *testing.T) { + type S struct { + ID1 Array + ID2 Array + } + s1 := S{ID1: testArray} + data, err := json.Marshal(&s1) + if err != nil { + t.Fatal(err) + } + var s2 S + if err := json.Unmarshal(data, &s2); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(&s1, &s2) { + t.Errorf("got %#v, want %#v", s2, s1) + } +} + +func TestMarshal(t *testing.T) { + data, err := testUUID.MarshalBinary() + if err != nil { + t.Fatalf("MarhsalBinary returned unexpected error %v", err) + } + if !bytes.Equal(data, testUUID) { + t.Fatalf("MarhsalBinary returns %x, want %x", data, testUUID) + } + var u UUID + u.UnmarshalBinary(data) + if !Equal(data, u) { + t.Fatalf("UnmarhsalBinary returns %v, want %v", u, testUUID) + } +} + +func TestMarshalArray(t *testing.T) { + data, err := testArray.MarshalBinary() + if err != nil { + t.Fatalf("MarhsalBinary returned unexpected error %v", err) + } + if !bytes.Equal(data, testUUID) { + t.Fatalf("MarhsalBinary returns %x, want %x", data, testUUID) + } + var a Array + a.UnmarshalBinary(data) + if a != testArray { + t.Fatalf("UnmarhsalBinary returns %v, want %v", a, testArray) + } +} + +func TestMarshalTextArray(t *testing.T) { + data, err := testArray.MarshalText() + if err != nil { + t.Fatalf("MarhsalText returned unexpected error %v", err) + } + var a Array + a.UnmarshalText(data) + if a != testArray { + t.Fatalf("UnmarhsalText returns %v, want %v", a, testArray) + } +} + +func BenchmarkUUID_MarshalJSON(b *testing.B) { + x := &struct { + UUID UUID `json:"uuid"` + }{} + x.UUID = Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if x.UUID == nil { + b.Fatal("invalid uuid") + } + for i := 0; i < b.N; i++ { + js, err := json.Marshal(x) + if err != nil { + b.Fatalf("marshal json: %#v (%v)", js, err) + } + } +} + +func BenchmarkUUID_UnmarshalJSON(b *testing.B) { + js := []byte(`{"uuid":"f47ac10b-58cc-0372-8567-0e02b2c3d479"}`) + var x *struct { + UUID UUID `json:"uuid"` + } + for i := 0; i < b.N; i++ { + err := json.Unmarshal(js, &x) + if err != nil { + b.Fatalf("marshal json: %#v (%v)", js, err) + } + } +} diff --git a/vendor/github.com/pborman/uuid/node.go b/vendor/github.com/pborman/uuid/node.go new file mode 100644 index 000000000..e524e0101 --- /dev/null +++ b/vendor/github.com/pborman/uuid/node.go @@ -0,0 +1,50 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + guuid "github.com/google/uuid" +) + +// NodeInterface returns the name of the interface from which the NodeID was +// derived. The interface "user" is returned if the NodeID was set by +// SetNodeID. +func NodeInterface() string { + return guuid.NodeInterface() +} + +// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. +// If name is "" then the first usable interface found will be used or a random +// Node ID will be generated. If a named interface cannot be found then false +// is returned. +// +// SetNodeInterface never fails when name is "". +func SetNodeInterface(name string) bool { + return guuid.SetNodeInterface(name) +} + +// NodeID returns a slice of a copy of the current Node ID, setting the Node ID +// if not already set. +func NodeID() []byte { + return guuid.NodeID() +} + +// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes +// of id are used. If id is less than 6 bytes then false is returned and the +// Node ID is not set. +func SetNodeID(id []byte) bool { + return guuid.SetNodeID(id) +} + +// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is +// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) NodeID() []byte { + if len(uuid) != 16 { + return nil + } + node := make([]byte, 6) + copy(node, uuid[10:]) + return node +} diff --git a/vendor/github.com/pborman/uuid/seq_test.go b/vendor/github.com/pborman/uuid/seq_test.go new file mode 100644 index 000000000..3b3d1430d --- /dev/null +++ b/vendor/github.com/pborman/uuid/seq_test.go @@ -0,0 +1,66 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "flag" + "runtime" + "testing" + "time" +) + +// This test is only run when --regressions is passed on the go test line. +var regressions = flag.Bool("regressions", false, "run uuid regression tests") + +// TestClockSeqRace tests for a particular race condition of returning two +// identical Version1 UUIDs. The duration of 1 minute was chosen as the race +// condition, before being fixed, nearly always occured in under 30 seconds. +func TestClockSeqRace(t *testing.T) { + if !*regressions { + t.Skip("skipping regression tests") + } + duration := time.Minute + + done := make(chan struct{}) + defer close(done) + + ch := make(chan UUID, 10000) + ncpu := runtime.NumCPU() + switch ncpu { + case 0, 1: + // We can't run the test effectively. + t.Skip("skipping race test, only one CPU detected") + return + default: + runtime.GOMAXPROCS(ncpu) + } + for i := 0; i < ncpu; i++ { + go func() { + for { + select { + case <-done: + return + case ch <- NewUUID(): + } + } + }() + } + + uuids := make(map[string]bool) + cnt := 0 + start := time.Now() + for u := range ch { + s := u.String() + if uuids[s] { + t.Errorf("duplicate uuid after %d in %v: %s", cnt, time.Since(start), s) + return + } + uuids[s] = true + if time.Since(start) > duration { + return + } + cnt++ + } +} diff --git a/vendor/github.com/pborman/uuid/sql.go b/vendor/github.com/pborman/uuid/sql.go new file mode 100644 index 000000000..929c3847e --- /dev/null +++ b/vendor/github.com/pborman/uuid/sql.go @@ -0,0 +1,68 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "database/sql/driver" + "errors" + "fmt" +) + +// Scan implements sql.Scanner so UUIDs can be read from databases transparently +// Currently, database types that map to string and []byte are supported. Please +// consult database-specific driver documentation for matching types. +func (uuid *UUID) Scan(src interface{}) error { + switch src.(type) { + case string: + // if an empty UUID comes from a table, we return a null UUID + if src.(string) == "" { + return nil + } + + // see uuid.Parse for required string format + parsed := Parse(src.(string)) + + if parsed == nil { + return errors.New("Scan: invalid UUID format") + } + + *uuid = parsed + case []byte: + b := src.([]byte) + + // if an empty UUID comes from a table, we return a null UUID + if len(b) == 0 { + return nil + } + + // assumes a simple slice of bytes if 16 bytes + // otherwise attempts to parse + if len(b) == 16 { + parsed := make([]byte, 16) + copy(parsed, b) + *uuid = UUID(parsed) + } else { + u := Parse(string(b)) + + if u == nil { + return errors.New("Scan: invalid UUID format") + } + + *uuid = u + } + + default: + return fmt.Errorf("Scan: unable to scan type %T into UUID", src) + } + + return nil +} + +// Value implements sql.Valuer so that UUIDs can be written to databases +// transparently. Currently, UUIDs map to strings. Please consult +// database-specific driver documentation for matching types. +func (uuid UUID) Value() (driver.Value, error) { + return uuid.String(), nil +} diff --git a/vendor/github.com/pborman/uuid/sql_test.go b/vendor/github.com/pborman/uuid/sql_test.go new file mode 100644 index 000000000..103095156 --- /dev/null +++ b/vendor/github.com/pborman/uuid/sql_test.go @@ -0,0 +1,96 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "strings" + "testing" +) + +func TestScan(t *testing.T) { + var stringTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d479" + var byteTest []byte = Parse(stringTest) + var badTypeTest int = 6 + var invalidTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d4" + + // sunny day tests + + var uuid UUID + err := (&uuid).Scan(stringTest) + if err != nil { + t.Fatal(err) + } + + err = (&uuid).Scan([]byte(stringTest)) + if err != nil { + t.Fatal(err) + } + + err = (&uuid).Scan(byteTest) + if err != nil { + t.Fatal(err) + } + + // bad type tests + + err = (&uuid).Scan(badTypeTest) + if err == nil { + t.Error("int correctly parsed and shouldn't have") + } + if !strings.Contains(err.Error(), "unable to scan type") { + t.Error("attempting to parse an int returned an incorrect error message") + } + + // invalid/incomplete uuids + + err = (&uuid).Scan(invalidTest) + if err == nil { + t.Error("invalid uuid was parsed without error") + } + if !strings.Contains(err.Error(), "invalid UUID") { + t.Error("attempting to parse an invalid UUID returned an incorrect error message") + } + + err = (&uuid).Scan(byteTest[:len(byteTest)-2]) + if err == nil { + t.Error("invalid byte uuid was parsed without error") + } + if !strings.Contains(err.Error(), "invalid UUID") { + t.Error("attempting to parse an invalid byte UUID returned an incorrect error message") + } + + // empty tests + + uuid = nil + var emptySlice []byte + err = (&uuid).Scan(emptySlice) + if err != nil { + t.Fatal(err) + } + + if uuid != nil { + t.Error("UUID was not nil after scanning empty byte slice") + } + + uuid = nil + var emptyString string + err = (&uuid).Scan(emptyString) + if err != nil { + t.Fatal(err) + } + + if uuid != nil { + t.Error("UUID was not nil after scanning empty string") + } +} + +func TestValue(t *testing.T) { + stringTest := "f47ac10b-58cc-0372-8567-0e02b2c3d479" + uuid := Parse(stringTest) + val, _ := uuid.Value() + if val != stringTest { + t.Error("Value() did not return expected string") + } +} diff --git a/vendor/github.com/pborman/uuid/time.go b/vendor/github.com/pborman/uuid/time.go new file mode 100644 index 000000000..5c0960d87 --- /dev/null +++ b/vendor/github.com/pborman/uuid/time.go @@ -0,0 +1,57 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + + guuid "github.com/google/uuid" +) + +// A Time represents a time as the number of 100's of nanoseconds since 15 Oct +// 1582. +type Time = guuid.Time + +// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and +// clock sequence as well as adjusting the clock sequence as needed. An error +// is returned if the current time cannot be determined. +func GetTime() (Time, uint16, error) { return guuid.GetTime() } + +// ClockSequence returns the current clock sequence, generating one if not +// already set. The clock sequence is only used for Version 1 UUIDs. +// +// The uuid package does not use global static storage for the clock sequence or +// the last time a UUID was generated. Unless SetClockSequence a new random +// clock sequence is generated the first time a clock sequence is requested by +// ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) sequence is generated +// for +func ClockSequence() int { return guuid.ClockSequence() } + +// SetClockSeq sets the clock sequence to the lower 14 bits of seq. Setting to +// -1 causes a new sequence to be generated. +func SetClockSequence(seq int) { guuid.SetClockSequence(seq) } + +// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in +// uuid. It returns false if uuid is not valid. The time is only well defined +// for version 1 and 2 UUIDs. +func (uuid UUID) Time() (Time, bool) { + if len(uuid) != 16 { + return 0, false + } + time := int64(binary.BigEndian.Uint32(uuid[0:4])) + time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 + time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 + return Time(time), true +} + +// ClockSequence returns the clock sequence encoded in uuid. It returns false +// if uuid is not valid. The clock sequence is only well defined for version 1 +// and 2 UUIDs. +func (uuid UUID) ClockSequence() (int, bool) { + if len(uuid) != 16 { + return 0, false + } + return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff, true +} diff --git a/vendor/github.com/pborman/uuid/util.go b/vendor/github.com/pborman/uuid/util.go new file mode 100644 index 000000000..255b5e248 --- /dev/null +++ b/vendor/github.com/pborman/uuid/util.go @@ -0,0 +1,32 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +// xvalues returns the value of a byte as a hexadecimal digit or 255. +var xvalues = [256]byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, +} + +// xtob converts the the first two hex bytes of x into a byte. +func xtob(x string) (byte, bool) { + b1 := xvalues[x[0]] + b2 := xvalues[x[1]] + return (b1 << 4) | b2, b1 != 255 && b2 != 255 +} diff --git a/vendor/github.com/pborman/uuid/uuid.go b/vendor/github.com/pborman/uuid/uuid.go new file mode 100644 index 000000000..a2429b0dd --- /dev/null +++ b/vendor/github.com/pborman/uuid/uuid.go @@ -0,0 +1,163 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "crypto/rand" + "encoding/hex" + "io" + + guuid "github.com/google/uuid" +) + +// Array is a pass-by-value UUID that can be used as an effecient key in a map. +type Array [16]byte + +// UUID converts uuid into a slice. +func (uuid Array) UUID() UUID { + return uuid[:] +} + +// String returns the string representation of uuid, +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. +func (uuid Array) String() string { + return guuid.UUID(uuid).String() +} + +// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC +// 4122. +type UUID []byte + +// A Version represents a UUIDs version. +type Version = guuid.Version + +// A Variant represents a UUIDs variant. +type Variant = guuid.Variant + +// Constants returned by Variant. +const ( + Invalid = guuid.Invalid // Invalid UUID + RFC4122 = guuid.RFC4122 // The variant specified in RFC4122 + Reserved = guuid.Reserved // Reserved, NCS backward compatibility. + Microsoft = guuid.Microsoft // Reserved, Microsoft Corporation backward compatibility. + Future = guuid.Future // Reserved for future definition. +) + +var rander = rand.Reader // random function + +// New returns a new random (version 4) UUID as a string. It is a convenience +// function for NewRandom().String(). +func New() string { + return NewRandom().String() +} + +// Parse decodes s into a UUID or returns nil. Both the UUID form of +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded. +func Parse(s string) UUID { + gu, err := guuid.Parse(s) + if err == nil { + return gu[:] + } + return nil +} + +// ParseBytes is like Parse, except it parses a byte slice instead of a string. +func ParseBytes(b []byte) (UUID, error) { + gu, err := guuid.ParseBytes(b) + if err == nil { + return gu[:], nil + } + return nil, err +} + +// Equal returns true if uuid1 and uuid2 are equal. +func Equal(uuid1, uuid2 UUID) bool { + return bytes.Equal(uuid1, uuid2) +} + +// Array returns an array representation of uuid that can be used as a map key. +// Array panics if uuid is not valid. +func (uuid UUID) Array() Array { + if len(uuid) != 16 { + panic("invalid uuid") + } + var a Array + copy(a[:], uuid) + return a +} + +// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// , or "" if uuid is invalid. +func (uuid UUID) String() string { + if len(uuid) != 16 { + return "" + } + var buf [36]byte + encodeHex(buf[:], uuid) + return string(buf[:]) +} + +// URN returns the RFC 2141 URN form of uuid, +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. +func (uuid UUID) URN() string { + if len(uuid) != 16 { + return "" + } + var buf [36 + 9]byte + copy(buf[:], "urn:uuid:") + encodeHex(buf[9:], uuid) + return string(buf[:]) +} + +func encodeHex(dst []byte, uuid UUID) { + hex.Encode(dst[:], uuid[:4]) + dst[8] = '-' + hex.Encode(dst[9:13], uuid[4:6]) + dst[13] = '-' + hex.Encode(dst[14:18], uuid[6:8]) + dst[18] = '-' + hex.Encode(dst[19:23], uuid[8:10]) + dst[23] = '-' + hex.Encode(dst[24:], uuid[10:]) +} + +// Variant returns the variant encoded in uuid. It returns Invalid if +// uuid is invalid. +func (uuid UUID) Variant() Variant { + if len(uuid) != 16 { + return Invalid + } + switch { + case (uuid[8] & 0xc0) == 0x80: + return RFC4122 + case (uuid[8] & 0xe0) == 0xc0: + return Microsoft + case (uuid[8] & 0xe0) == 0xe0: + return Future + default: + return Reserved + } +} + +// Version returns the version of uuid. It returns false if uuid is not +// valid. +func (uuid UUID) Version() (Version, bool) { + if len(uuid) != 16 { + return 0, false + } + return Version(uuid[6] >> 4), true +} + +// SetRand sets the random number generator to r, which implements io.Reader. +// If r.Read returns an error when the package requests random data then +// a panic will be issued. +// +// Calling SetRand with nil sets the random number generator to the default +// generator. +func SetRand(r io.Reader) { + guuid.SetRand(r) +} diff --git a/vendor/github.com/pborman/uuid/uuid_test.go b/vendor/github.com/pborman/uuid/uuid_test.go new file mode 100644 index 000000000..7e9d144fb --- /dev/null +++ b/vendor/github.com/pborman/uuid/uuid_test.go @@ -0,0 +1,410 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +// Some of these tests can probably be removed as they are redundant with the +// tests in github.com/google/uuid. + +import ( + "bytes" + "fmt" + "os" + "strings" + "testing" +) + +type test struct { + in string + version Version + variant Variant + isuuid bool +} + +var tests = []test{ + {"f47ac10b-58cc-0372-8567-0e02b2c3d479", 0, RFC4122, true}, + {"f47ac10b-58cc-1372-8567-0e02b2c3d479", 1, RFC4122, true}, + {"f47ac10b-58cc-2372-8567-0e02b2c3d479", 2, RFC4122, true}, + {"f47ac10b-58cc-3372-8567-0e02b2c3d479", 3, RFC4122, true}, + {"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-5372-8567-0e02b2c3d479", 5, RFC4122, true}, + {"f47ac10b-58cc-6372-8567-0e02b2c3d479", 6, RFC4122, true}, + {"f47ac10b-58cc-7372-8567-0e02b2c3d479", 7, RFC4122, true}, + {"f47ac10b-58cc-8372-8567-0e02b2c3d479", 8, RFC4122, true}, + {"f47ac10b-58cc-9372-8567-0e02b2c3d479", 9, RFC4122, true}, + {"f47ac10b-58cc-a372-8567-0e02b2c3d479", 10, RFC4122, true}, + {"f47ac10b-58cc-b372-8567-0e02b2c3d479", 11, RFC4122, true}, + {"f47ac10b-58cc-c372-8567-0e02b2c3d479", 12, RFC4122, true}, + {"f47ac10b-58cc-d372-8567-0e02b2c3d479", 13, RFC4122, true}, + {"f47ac10b-58cc-e372-8567-0e02b2c3d479", 14, RFC4122, true}, + {"f47ac10b-58cc-f372-8567-0e02b2c3d479", 15, RFC4122, true}, + + {"urn:uuid:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true}, + {"URN:UUID:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-1567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-2567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-3567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-4567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-5567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-6567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-7567-0e02b2c3d479", 4, Reserved, true}, + {"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-4372-9567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-4372-a567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-4372-b567-0e02b2c3d479", 4, RFC4122, true}, + {"f47ac10b-58cc-4372-c567-0e02b2c3d479", 4, Microsoft, true}, + {"f47ac10b-58cc-4372-d567-0e02b2c3d479", 4, Microsoft, true}, + {"f47ac10b-58cc-4372-e567-0e02b2c3d479", 4, Future, true}, + {"f47ac10b-58cc-4372-f567-0e02b2c3d479", 4, Future, true}, + + {"f47ac10b158cc-5372-a567-0e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc25372-a567-0e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc-53723a567-0e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc-5372-a56740e02b2c3d479", 0, Invalid, false}, + {"f47ac10b-58cc-5372-a567-0e02-2c3d479", 0, Invalid, false}, + {"g47ac10b-58cc-4372-a567-0e02b2c3d479", 0, Invalid, false}, +} + +var constants = []struct { + c interface{} + name string +}{ + {Person, "Person"}, + {Group, "Group"}, + {Org, "Org"}, + {Invalid, "Invalid"}, + {RFC4122, "RFC4122"}, + {Reserved, "Reserved"}, + {Microsoft, "Microsoft"}, + {Future, "Future"}, + {Domain(17), "Domain17"}, + {Variant(42), "BadVariant42"}, +} + +func testTest(t *testing.T, in string, tt test) { + uuid := Parse(in) + if ok := (uuid != nil); ok != tt.isuuid { + t.Errorf("Parse(%s) got %v expected %v\b", in, ok, tt.isuuid) + } + if uuid == nil { + return + } + + if v := uuid.Variant(); v != tt.variant { + t.Errorf("Variant(%s) got %d expected %d\b", in, v, tt.variant) + } + if v, _ := uuid.Version(); v != tt.version { + t.Errorf("Version(%s) got %d expected %d\b", in, v, tt.version) + } +} + +func TestUUID(t *testing.T) { + for _, tt := range tests { + testTest(t, tt.in, tt) + testTest(t, strings.ToUpper(tt.in), tt) + } +} + +func TestConstants(t *testing.T) { + for x, tt := range constants { + v, ok := tt.c.(fmt.Stringer) + if !ok { + t.Errorf("%x: %v: not a stringer", x, v) + } else if s := v.String(); s != tt.name { + v, _ := tt.c.(int) + t.Errorf("%x: Constant %T:%d gives %q, expected %q", x, tt.c, v, s, tt.name) + } + } +} + +func TestRandomUUID(t *testing.T) { + m := make(map[string]bool) + for x := 1; x < 32; x++ { + uuid := NewRandom() + s := uuid.String() + if m[s] { + t.Errorf("NewRandom returned duplicated UUID %s", s) + } + m[s] = true + if v, _ := uuid.Version(); v != 4 { + t.Errorf("Random UUID of version %s", v) + } + if uuid.Variant() != RFC4122 { + t.Errorf("Random UUID is variant %d", uuid.Variant()) + } + } +} + +func TestNew(t *testing.T) { + m := make(map[string]bool) + for x := 1; x < 32; x++ { + s := New() + if m[s] { + t.Errorf("New returned duplicated UUID %s", s) + } + m[s] = true + uuid := Parse(s) + if uuid == nil { + t.Errorf("New returned %q which does not decode", s) + continue + } + if v, _ := uuid.Version(); v != 4 { + t.Errorf("Random UUID of version %s", v) + } + if uuid.Variant() != RFC4122 { + t.Errorf("Random UUID is variant %d", uuid.Variant()) + } + } +} + +func TestCoding(t *testing.T) { + text := "7d444840-9dc0-11d1-b245-5ffdce74fad2" + urn := "urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2" + data := UUID{ + 0x7d, 0x44, 0x48, 0x40, + 0x9d, 0xc0, + 0x11, 0xd1, + 0xb2, 0x45, + 0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2, + } + if v := data.String(); v != text { + t.Errorf("%x: encoded to %s, expected %s", data, v, text) + } + if v := data.URN(); v != urn { + t.Errorf("%x: urn is %s, expected %s", data, v, urn) + } + + uuid := Parse(text) + if !Equal(uuid, data) { + t.Errorf("%s: decoded to %s, expected %s", text, uuid, data) + } +} + +func TestVersion1(t *testing.T) { + uuid1 := NewUUID() + uuid2 := NewUUID() + + if Equal(uuid1, uuid2) { + t.Errorf("%s:duplicate uuid", uuid1) + } + if v, _ := uuid1.Version(); v != 1 { + t.Errorf("%s: version %s expected 1", uuid1, v) + } + if v, _ := uuid2.Version(); v != 1 { + t.Errorf("%s: version %s expected 1", uuid2, v) + } + n1 := uuid1.NodeID() + n2 := uuid2.NodeID() + if !bytes.Equal(n1, n2) { + t.Errorf("Different nodes %x != %x", n1, n2) + } + t1, ok := uuid1.Time() + if !ok { + t.Errorf("%s: invalid time", uuid1) + } + t2, ok := uuid2.Time() + if !ok { + t.Errorf("%s: invalid time", uuid2) + } + q1, ok := uuid1.ClockSequence() + if !ok { + t.Errorf("%s: invalid clock sequence", uuid1) + } + q2, ok := uuid2.ClockSequence() + if !ok { + t.Errorf("%s: invalid clock sequence", uuid2) + } + + switch { + case t1 == t2 && q1 == q2: + t.Error("time stopped") + case t1 > t2 && q1 == q2: + t.Error("time reversed") + case t1 < t2 && q1 != q2: + t.Error("clock sequence chaned unexpectedly") + } +} + +func TestMD5(t *testing.T) { + uuid := NewMD5(NameSpace_DNS, []byte("python.org")).String() + want := "6fa459ea-ee8a-3ca4-894e-db77e160355e" + if uuid != want { + t.Errorf("MD5: got %q expected %q", uuid, want) + } +} + +func TestSHA1(t *testing.T) { + uuid := NewSHA1(NameSpace_DNS, []byte("python.org")).String() + want := "886313e1-3b8a-5372-9b90-0c9aee199e5d" + if uuid != want { + t.Errorf("SHA1: got %q expected %q", uuid, want) + } +} + +func testDCE(t *testing.T, name string, uuid UUID, domain Domain, id uint32) { + if uuid == nil { + t.Errorf("%s failed", name) + return + } + if v, _ := uuid.Version(); v != 2 { + t.Errorf("%s: %s: expected version 2, got %s", name, uuid, v) + return + } + if v, ok := uuid.Domain(); !ok || v != domain { + if !ok { + t.Errorf("%s: %d: Domain failed", name, uuid) + } else { + t.Errorf("%s: %s: expected domain %d, got %d", name, uuid, domain, v) + } + } + if v, ok := uuid.Id(); !ok || v != id { + if !ok { + t.Errorf("%s: %d: Id failed", name, uuid) + } else { + t.Errorf("%s: %s: expected id %d, got %d", name, uuid, id, v) + } + } +} + +func TestDCE(t *testing.T) { + testDCE(t, "NewDCESecurity", NewDCESecurity(42, 12345678), 42, 12345678) + testDCE(t, "NewDCEPerson", NewDCEPerson(), Person, uint32(os.Getuid())) + testDCE(t, "NewDCEGroup", NewDCEGroup(), Group, uint32(os.Getgid())) +} + +type badRand struct{} + +func (r badRand) Read(buf []byte) (int, error) { + for i, _ := range buf { + buf[i] = byte(i) + } + return len(buf), nil +} + +func TestBadRand(t *testing.T) { + SetRand(badRand{}) + uuid1 := New() + uuid2 := New() + if uuid1 != uuid2 { + t.Errorf("expected duplicates, got %q and %q", uuid1, uuid2) + } + SetRand(nil) + uuid1 = New() + uuid2 = New() + if uuid1 == uuid2 { + t.Errorf("unexpected duplicates, got %q", uuid1) + } +} + +func TestUUID_Array(t *testing.T) { + expect := Array{ + 0xf4, 0x7a, 0xc1, 0x0b, + 0x58, 0xcc, + 0x03, 0x72, + 0x85, 0x67, + 0x0e, 0x02, 0xb2, 0xc3, 0xd4, 0x79, + } + uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if uuid == nil { + t.Fatal("invalid uuid") + } + if uuid.Array() != expect { + t.Fatal("invalid array") + } +} + +func TestArray_UUID(t *testing.T) { + array := Array{ + 0xf4, 0x7a, 0xc1, 0x0b, + 0x58, 0xcc, + 0x03, 0x72, + 0x85, 0x67, + 0x0e, 0x02, 0xb2, 0xc3, 0xd4, 0x79, + } + expect := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if expect == nil { + t.Fatal("invalid uuid") + } + if !bytes.Equal(array.UUID(), expect) { + t.Fatal("invalid uuid") + } +} + +func BenchmarkParse(b *testing.B) { + for i := 0; i < b.N; i++ { + uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if uuid == nil { + b.Fatal("invalid uuid") + } + } +} + +func BenchmarkNew(b *testing.B) { + for i := 0; i < b.N; i++ { + New() + } +} + +func BenchmarkUUID_String(b *testing.B) { + uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if uuid == nil { + b.Fatal("invalid uuid") + } + for i := 0; i < b.N; i++ { + if uuid.String() == "" { + b.Fatal("invalid uuid") + } + } +} + +func BenchmarkUUID_URN(b *testing.B) { + uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if uuid == nil { + b.Fatal("invalid uuid") + } + for i := 0; i < b.N; i++ { + if uuid.URN() == "" { + b.Fatal("invalid uuid") + } + } +} + +func BenchmarkUUID_Array(b *testing.B) { + expect := Array{ + 0xf4, 0x7a, 0xc1, 0x0b, + 0x58, 0xcc, + 0x03, 0x72, + 0x85, 0x67, + 0x0e, 0x02, 0xb2, 0xc3, 0xd4, 0x79, + } + uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if uuid == nil { + b.Fatal("invalid uuid") + } + for i := 0; i < b.N; i++ { + if uuid.Array() != expect { + b.Fatal("invalid array") + } + } +} + +func BenchmarkArray_UUID(b *testing.B) { + array := Array{ + 0xf4, 0x7a, 0xc1, 0x0b, + 0x58, 0xcc, + 0x03, 0x72, + 0x85, 0x67, + 0x0e, 0x02, 0xb2, 0xc3, 0xd4, 0x79, + } + expect := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479") + if expect == nil { + b.Fatal("invalid uuid") + } + for i := 0; i < b.N; i++ { + if !bytes.Equal(array.UUID(), expect) { + b.Fatal("invalid uuid") + } + } +} diff --git a/vendor/github.com/pborman/uuid/version1.go b/vendor/github.com/pborman/uuid/version1.go new file mode 100644 index 000000000..7af948da7 --- /dev/null +++ b/vendor/github.com/pborman/uuid/version1.go @@ -0,0 +1,23 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + guuid "github.com/google/uuid" +) + +// NewUUID returns a Version 1 UUID based on the current NodeID and clock +// sequence, and the current time. If the NodeID has not been set by SetNodeID +// or SetNodeInterface then it will be set automatically. If the NodeID cannot +// be set NewUUID returns nil. If clock sequence has not been set by +// SetClockSequence then it will be set automatically. If GetTime fails to +// return the current NewUUID returns nil. +func NewUUID() UUID { + gu, err := guuid.NewUUID() + if err == nil { + return UUID(gu[:]) + } + return nil +} diff --git a/vendor/github.com/pborman/uuid/version4.go b/vendor/github.com/pborman/uuid/version4.go new file mode 100644 index 000000000..b459d46d1 --- /dev/null +++ b/vendor/github.com/pborman/uuid/version4.go @@ -0,0 +1,26 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import guuid "github.com/google/uuid" + +// Random returns a Random (Version 4) UUID or panics. +// +// The strength of the UUIDs is based on the strength of the crypto/rand +// package. +// +// A note about uniqueness derived from the UUID Wikipedia entry: +// +// Randomly generated UUIDs have 122 random bits. One's annual risk of being +// hit by a meteorite is estimated to be one chance in 17 billion, that +// means the probability is about 0.00000000006 (6 × 10−11), +// equivalent to the odds of creating a few tens of trillions of UUIDs in a +// year and having one duplicate. +func NewRandom() UUID { + if gu, err := guuid.NewRandom(); err == nil { + return UUID(gu[:]) + } + return nil +} diff --git a/vendor/github.com/pkg/errors/.travis.yml b/vendor/github.com/pkg/errors/.travis.yml deleted file mode 100644 index 588ceca18..000000000 --- a/vendor/github.com/pkg/errors/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: go -go_import_path: github.com/pkg/errors -go: - - 1.4.3 - - 1.5.4 - - 1.6.2 - - 1.7.1 - - tip - -script: - - go test -v ./... diff --git a/vendor/github.com/pkg/errors/LICENSE b/vendor/github.com/pkg/errors/LICENSE deleted file mode 100644 index 835ba3e75..000000000 --- a/vendor/github.com/pkg/errors/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2015, Dave Cheney -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pkg/errors/README.md b/vendor/github.com/pkg/errors/README.md deleted file mode 100644 index 273db3c98..000000000 --- a/vendor/github.com/pkg/errors/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) - -Package errors provides simple error handling primitives. - -`go get github.com/pkg/errors` - -The traditional error handling idiom in Go is roughly akin to -```go -if err != nil { - return err -} -``` -which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. - -## Adding context to an error - -The errors.Wrap function returns a new error that adds context to the original error. For example -```go -_, err := ioutil.ReadAll(r) -if err != nil { - return errors.Wrap(err, "read failed") -} -``` -## Retrieving the cause of an error - -Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. -```go -type causer interface { - Cause() error -} -``` -`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: -```go -switch err := errors.Cause(err).(type) { -case *MyError: - // handle specifically -default: - // unknown error -} -``` - -[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). - -## Contributing - -We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. - -Before proposing a change, please discuss your change by raising an issue. - -## Licence - -BSD-2-Clause diff --git a/vendor/github.com/pkg/errors/appveyor.yml b/vendor/github.com/pkg/errors/appveyor.yml deleted file mode 100644 index a932eade0..000000000 --- a/vendor/github.com/pkg/errors/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -version: build-{build}.{branch} - -clone_folder: C:\gopath\src\github.com\pkg\errors -shallow_clone: true # for startup speed - -environment: - GOPATH: C:\gopath - -platform: - - x64 - -# http://www.appveyor.com/docs/installed-software -install: - # some helpful output for debugging builds - - go version - - go env - # pre-installed MinGW at C:\MinGW is 32bit only - # but MSYS2 at C:\msys64 has mingw64 - - set PATH=C:\msys64\mingw64\bin;%PATH% - - gcc --version - - g++ --version - -build_script: - - go install -v ./... - -test_script: - - set PATH=C:\gopath\bin;%PATH% - - go test -v ./... - -#artifacts: -# - path: '%GOPATH%\bin\*.exe' -deploy: off diff --git a/vendor/github.com/pkg/errors/bench_test.go b/vendor/github.com/pkg/errors/bench_test.go deleted file mode 100644 index 0416a3cbb..000000000 --- a/vendor/github.com/pkg/errors/bench_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// +build go1.7 - -package errors - -import ( - "fmt" - "testing" - - stderrors "errors" -) - -func noErrors(at, depth int) error { - if at >= depth { - return stderrors.New("no error") - } - return noErrors(at+1, depth) -} -func yesErrors(at, depth int) error { - if at >= depth { - return New("ye error") - } - return yesErrors(at+1, depth) -} - -func BenchmarkErrors(b *testing.B) { - var toperr error - type run struct { - stack int - std bool - } - runs := []run{ - {10, false}, - {10, true}, - {100, false}, - {100, true}, - {1000, false}, - {1000, true}, - } - for _, r := range runs { - part := "pkg/errors" - if r.std { - part = "errors" - } - name := fmt.Sprintf("%s-stack-%d", part, r.stack) - b.Run(name, func(b *testing.B) { - var err error - f := yesErrors - if r.std { - f = noErrors - } - b.ReportAllocs() - for i := 0; i < b.N; i++ { - err = f(0, r.stack) - } - b.StopTimer() - toperr = err - }) - } -} diff --git a/vendor/github.com/pkg/errors/errors.go b/vendor/github.com/pkg/errors/errors.go deleted file mode 100644 index 842ee8045..000000000 --- a/vendor/github.com/pkg/errors/errors.go +++ /dev/null @@ -1,269 +0,0 @@ -// Package errors provides simple error handling primitives. -// -// The traditional error handling idiom in Go is roughly akin to -// -// if err != nil { -// return err -// } -// -// which applied recursively up the call stack results in error reports -// without context or debugging information. The errors package allows -// programmers to add context to the failure path in their code in a way -// that does not destroy the original value of the error. -// -// Adding context to an error -// -// The errors.Wrap function returns a new error that adds context to the -// original error by recording a stack trace at the point Wrap is called, -// and the supplied message. For example -// -// _, err := ioutil.ReadAll(r) -// if err != nil { -// return errors.Wrap(err, "read failed") -// } -// -// If additional control is required the errors.WithStack and errors.WithMessage -// functions destructure errors.Wrap into its component operations of annotating -// an error with a stack trace and an a message, respectively. -// -// Retrieving the cause of an error -// -// Using errors.Wrap constructs a stack of errors, adding context to the -// preceding error. Depending on the nature of the error it may be necessary -// to reverse the operation of errors.Wrap to retrieve the original error -// for inspection. Any error value which implements this interface -// -// type causer interface { -// Cause() error -// } -// -// can be inspected by errors.Cause. errors.Cause will recursively retrieve -// the topmost error which does not implement causer, which is assumed to be -// the original cause. For example: -// -// switch err := errors.Cause(err).(type) { -// case *MyError: -// // handle specifically -// default: -// // unknown error -// } -// -// causer interface is not exported by this package, but is considered a part -// of stable public API. -// -// Formatted printing of errors -// -// All error values returned from this package implement fmt.Formatter and can -// be formatted by the fmt package. The following verbs are supported -// -// %s print the error. If the error has a Cause it will be -// printed recursively -// %v see %s -// %+v extended format. Each Frame of the error's StackTrace will -// be printed in detail. -// -// Retrieving the stack trace of an error or wrapper -// -// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are -// invoked. This information can be retrieved with the following interface. -// -// type stackTracer interface { -// StackTrace() errors.StackTrace -// } -// -// Where errors.StackTrace is defined as -// -// type StackTrace []Frame -// -// The Frame type represents a call site in the stack trace. Frame supports -// the fmt.Formatter interface that can be used for printing information about -// the stack trace of this error. For example: -// -// if err, ok := err.(stackTracer); ok { -// for _, f := range err.StackTrace() { -// fmt.Printf("%+s:%d", f) -// } -// } -// -// stackTracer interface is not exported by this package, but is considered a part -// of stable public API. -// -// See the documentation for Frame.Format for more details. -package errors - -import ( - "fmt" - "io" -) - -// New returns an error with the supplied message. -// New also records the stack trace at the point it was called. -func New(message string) error { - return &fundamental{ - msg: message, - stack: callers(), - } -} - -// Errorf formats according to a format specifier and returns the string -// as a value that satisfies error. -// Errorf also records the stack trace at the point it was called. -func Errorf(format string, args ...interface{}) error { - return &fundamental{ - msg: fmt.Sprintf(format, args...), - stack: callers(), - } -} - -// fundamental is an error that has a message and a stack, but no caller. -type fundamental struct { - msg string - *stack -} - -func (f *fundamental) Error() string { return f.msg } - -func (f *fundamental) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - io.WriteString(s, f.msg) - f.stack.Format(s, verb) - return - } - fallthrough - case 's': - io.WriteString(s, f.msg) - case 'q': - fmt.Fprintf(s, "%q", f.msg) - } -} - -// WithStack annotates err with a stack trace at the point WithStack was called. -// If err is nil, WithStack returns nil. -func WithStack(err error) error { - if err == nil { - return nil - } - return &withStack{ - err, - callers(), - } -} - -type withStack struct { - error - *stack -} - -func (w *withStack) Cause() error { return w.error } - -func (w *withStack) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - fmt.Fprintf(s, "%+v", w.Cause()) - w.stack.Format(s, verb) - return - } - fallthrough - case 's': - io.WriteString(s, w.Error()) - case 'q': - fmt.Fprintf(s, "%q", w.Error()) - } -} - -// Wrap returns an error annotating err with a stack trace -// at the point Wrap is called, and the supplied message. -// If err is nil, Wrap returns nil. -func Wrap(err error, message string) error { - if err == nil { - return nil - } - err = &withMessage{ - cause: err, - msg: message, - } - return &withStack{ - err, - callers(), - } -} - -// Wrapf returns an error annotating err with a stack trace -// at the point Wrapf is call, and the format specifier. -// If err is nil, Wrapf returns nil. -func Wrapf(err error, format string, args ...interface{}) error { - if err == nil { - return nil - } - err = &withMessage{ - cause: err, - msg: fmt.Sprintf(format, args...), - } - return &withStack{ - err, - callers(), - } -} - -// WithMessage annotates err with a new message. -// If err is nil, WithMessage returns nil. -func WithMessage(err error, message string) error { - if err == nil { - return nil - } - return &withMessage{ - cause: err, - msg: message, - } -} - -type withMessage struct { - cause error - msg string -} - -func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } -func (w *withMessage) Cause() error { return w.cause } - -func (w *withMessage) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - fmt.Fprintf(s, "%+v\n", w.Cause()) - io.WriteString(s, w.msg) - return - } - fallthrough - case 's', 'q': - io.WriteString(s, w.Error()) - } -} - -// Cause returns the underlying cause of the error, if possible. -// An error value has a cause if it implements the following -// interface: -// -// type causer interface { -// Cause() error -// } -// -// If the error does not implement Cause, the original error will -// be returned. If the error is nil, nil will be returned without further -// investigation. -func Cause(err error) error { - type causer interface { - Cause() error - } - - for err != nil { - cause, ok := err.(causer) - if !ok { - break - } - err = cause.Cause() - } - return err -} diff --git a/vendor/github.com/pkg/errors/errors_test.go b/vendor/github.com/pkg/errors/errors_test.go deleted file mode 100644 index 1d8c63558..000000000 --- a/vendor/github.com/pkg/errors/errors_test.go +++ /dev/null @@ -1,226 +0,0 @@ -package errors - -import ( - "errors" - "fmt" - "io" - "reflect" - "testing" -) - -func TestNew(t *testing.T) { - tests := []struct { - err string - want error - }{ - {"", fmt.Errorf("")}, - {"foo", fmt.Errorf("foo")}, - {"foo", New("foo")}, - {"string with format specifiers: %v", errors.New("string with format specifiers: %v")}, - } - - for _, tt := range tests { - got := New(tt.err) - if got.Error() != tt.want.Error() { - t.Errorf("New.Error(): got: %q, want %q", got, tt.want) - } - } -} - -func TestWrapNil(t *testing.T) { - got := Wrap(nil, "no error") - if got != nil { - t.Errorf("Wrap(nil, \"no error\"): got %#v, expected nil", got) - } -} - -func TestWrap(t *testing.T) { - tests := []struct { - err error - message string - want string - }{ - {io.EOF, "read error", "read error: EOF"}, - {Wrap(io.EOF, "read error"), "client error", "client error: read error: EOF"}, - } - - for _, tt := range tests { - got := Wrap(tt.err, tt.message).Error() - if got != tt.want { - t.Errorf("Wrap(%v, %q): got: %v, want %v", tt.err, tt.message, got, tt.want) - } - } -} - -type nilError struct{} - -func (nilError) Error() string { return "nil error" } - -func TestCause(t *testing.T) { - x := New("error") - tests := []struct { - err error - want error - }{{ - // nil error is nil - err: nil, - want: nil, - }, { - // explicit nil error is nil - err: (error)(nil), - want: nil, - }, { - // typed nil is nil - err: (*nilError)(nil), - want: (*nilError)(nil), - }, { - // uncaused error is unaffected - err: io.EOF, - want: io.EOF, - }, { - // caused error returns cause - err: Wrap(io.EOF, "ignored"), - want: io.EOF, - }, { - err: x, // return from errors.New - want: x, - }, { - WithMessage(nil, "whoops"), - nil, - }, { - WithMessage(io.EOF, "whoops"), - io.EOF, - }, { - WithStack(nil), - nil, - }, { - WithStack(io.EOF), - io.EOF, - }} - - for i, tt := range tests { - got := Cause(tt.err) - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("test %d: got %#v, want %#v", i+1, got, tt.want) - } - } -} - -func TestWrapfNil(t *testing.T) { - got := Wrapf(nil, "no error") - if got != nil { - t.Errorf("Wrapf(nil, \"no error\"): got %#v, expected nil", got) - } -} - -func TestWrapf(t *testing.T) { - tests := []struct { - err error - message string - want string - }{ - {io.EOF, "read error", "read error: EOF"}, - {Wrapf(io.EOF, "read error without format specifiers"), "client error", "client error: read error without format specifiers: EOF"}, - {Wrapf(io.EOF, "read error with %d format specifier", 1), "client error", "client error: read error with 1 format specifier: EOF"}, - } - - for _, tt := range tests { - got := Wrapf(tt.err, tt.message).Error() - if got != tt.want { - t.Errorf("Wrapf(%v, %q): got: %v, want %v", tt.err, tt.message, got, tt.want) - } - } -} - -func TestErrorf(t *testing.T) { - tests := []struct { - err error - want string - }{ - {Errorf("read error without format specifiers"), "read error without format specifiers"}, - {Errorf("read error with %d format specifier", 1), "read error with 1 format specifier"}, - } - - for _, tt := range tests { - got := tt.err.Error() - if got != tt.want { - t.Errorf("Errorf(%v): got: %q, want %q", tt.err, got, tt.want) - } - } -} - -func TestWithStackNil(t *testing.T) { - got := WithStack(nil) - if got != nil { - t.Errorf("WithStack(nil): got %#v, expected nil", got) - } -} - -func TestWithStack(t *testing.T) { - tests := []struct { - err error - want string - }{ - {io.EOF, "EOF"}, - {WithStack(io.EOF), "EOF"}, - } - - for _, tt := range tests { - got := WithStack(tt.err).Error() - if got != tt.want { - t.Errorf("WithStack(%v): got: %v, want %v", tt.err, got, tt.want) - } - } -} - -func TestWithMessageNil(t *testing.T) { - got := WithMessage(nil, "no error") - if got != nil { - t.Errorf("WithMessage(nil, \"no error\"): got %#v, expected nil", got) - } -} - -func TestWithMessage(t *testing.T) { - tests := []struct { - err error - message string - want string - }{ - {io.EOF, "read error", "read error: EOF"}, - {WithMessage(io.EOF, "read error"), "client error", "client error: read error: EOF"}, - } - - for _, tt := range tests { - got := WithMessage(tt.err, tt.message).Error() - if got != tt.want { - t.Errorf("WithMessage(%v, %q): got: %q, want %q", tt.err, tt.message, got, tt.want) - } - } - -} - -// errors.New, etc values are not expected to be compared by value -// but the change in errors#27 made them incomparable. Assert that -// various kinds of errors have a functional equality operator, even -// if the result of that equality is always false. -func TestErrorEquality(t *testing.T) { - vals := []error{ - nil, - io.EOF, - errors.New("EOF"), - New("EOF"), - Errorf("EOF"), - Wrap(io.EOF, "EOF"), - Wrapf(io.EOF, "EOF%d", 2), - WithMessage(nil, "whoops"), - WithMessage(io.EOF, "whoops"), - WithStack(io.EOF), - WithStack(nil), - } - - for i := range vals { - for j := range vals { - _ = vals[i] == vals[j] // mustn't panic - } - } -} diff --git a/vendor/github.com/pkg/errors/example_test.go b/vendor/github.com/pkg/errors/example_test.go deleted file mode 100644 index c1fc13e38..000000000 --- a/vendor/github.com/pkg/errors/example_test.go +++ /dev/null @@ -1,205 +0,0 @@ -package errors_test - -import ( - "fmt" - - "github.com/pkg/errors" -) - -func ExampleNew() { - err := errors.New("whoops") - fmt.Println(err) - - // Output: whoops -} - -func ExampleNew_printf() { - err := errors.New("whoops") - fmt.Printf("%+v", err) - - // Example output: - // whoops - // github.com/pkg/errors_test.ExampleNew_printf - // /home/dfc/src/github.com/pkg/errors/example_test.go:17 - // testing.runExample - // /home/dfc/go/src/testing/example.go:114 - // testing.RunExamples - // /home/dfc/go/src/testing/example.go:38 - // testing.(*M).Run - // /home/dfc/go/src/testing/testing.go:744 - // main.main - // /github.com/pkg/errors/_test/_testmain.go:106 - // runtime.main - // /home/dfc/go/src/runtime/proc.go:183 - // runtime.goexit - // /home/dfc/go/src/runtime/asm_amd64.s:2059 -} - -func ExampleWithMessage() { - cause := errors.New("whoops") - err := errors.WithMessage(cause, "oh noes") - fmt.Println(err) - - // Output: oh noes: whoops -} - -func ExampleWithStack() { - cause := errors.New("whoops") - err := errors.WithStack(cause) - fmt.Println(err) - - // Output: whoops -} - -func ExampleWithStack_printf() { - cause := errors.New("whoops") - err := errors.WithStack(cause) - fmt.Printf("%+v", err) - - // Example Output: - // whoops - // github.com/pkg/errors_test.ExampleWithStack_printf - // /home/fabstu/go/src/github.com/pkg/errors/example_test.go:55 - // testing.runExample - // /usr/lib/go/src/testing/example.go:114 - // testing.RunExamples - // /usr/lib/go/src/testing/example.go:38 - // testing.(*M).Run - // /usr/lib/go/src/testing/testing.go:744 - // main.main - // github.com/pkg/errors/_test/_testmain.go:106 - // runtime.main - // /usr/lib/go/src/runtime/proc.go:183 - // runtime.goexit - // /usr/lib/go/src/runtime/asm_amd64.s:2086 - // github.com/pkg/errors_test.ExampleWithStack_printf - // /home/fabstu/go/src/github.com/pkg/errors/example_test.go:56 - // testing.runExample - // /usr/lib/go/src/testing/example.go:114 - // testing.RunExamples - // /usr/lib/go/src/testing/example.go:38 - // testing.(*M).Run - // /usr/lib/go/src/testing/testing.go:744 - // main.main - // github.com/pkg/errors/_test/_testmain.go:106 - // runtime.main - // /usr/lib/go/src/runtime/proc.go:183 - // runtime.goexit - // /usr/lib/go/src/runtime/asm_amd64.s:2086 -} - -func ExampleWrap() { - cause := errors.New("whoops") - err := errors.Wrap(cause, "oh noes") - fmt.Println(err) - - // Output: oh noes: whoops -} - -func fn() error { - e1 := errors.New("error") - e2 := errors.Wrap(e1, "inner") - e3 := errors.Wrap(e2, "middle") - return errors.Wrap(e3, "outer") -} - -func ExampleCause() { - err := fn() - fmt.Println(err) - fmt.Println(errors.Cause(err)) - - // Output: outer: middle: inner: error - // error -} - -func ExampleWrap_extended() { - err := fn() - fmt.Printf("%+v\n", err) - - // Example output: - // error - // github.com/pkg/errors_test.fn - // /home/dfc/src/github.com/pkg/errors/example_test.go:47 - // github.com/pkg/errors_test.ExampleCause_printf - // /home/dfc/src/github.com/pkg/errors/example_test.go:63 - // testing.runExample - // /home/dfc/go/src/testing/example.go:114 - // testing.RunExamples - // /home/dfc/go/src/testing/example.go:38 - // testing.(*M).Run - // /home/dfc/go/src/testing/testing.go:744 - // main.main - // /github.com/pkg/errors/_test/_testmain.go:104 - // runtime.main - // /home/dfc/go/src/runtime/proc.go:183 - // runtime.goexit - // /home/dfc/go/src/runtime/asm_amd64.s:2059 - // github.com/pkg/errors_test.fn - // /home/dfc/src/github.com/pkg/errors/example_test.go:48: inner - // github.com/pkg/errors_test.fn - // /home/dfc/src/github.com/pkg/errors/example_test.go:49: middle - // github.com/pkg/errors_test.fn - // /home/dfc/src/github.com/pkg/errors/example_test.go:50: outer -} - -func ExampleWrapf() { - cause := errors.New("whoops") - err := errors.Wrapf(cause, "oh noes #%d", 2) - fmt.Println(err) - - // Output: oh noes #2: whoops -} - -func ExampleErrorf_extended() { - err := errors.Errorf("whoops: %s", "foo") - fmt.Printf("%+v", err) - - // Example output: - // whoops: foo - // github.com/pkg/errors_test.ExampleErrorf - // /home/dfc/src/github.com/pkg/errors/example_test.go:101 - // testing.runExample - // /home/dfc/go/src/testing/example.go:114 - // testing.RunExamples - // /home/dfc/go/src/testing/example.go:38 - // testing.(*M).Run - // /home/dfc/go/src/testing/testing.go:744 - // main.main - // /github.com/pkg/errors/_test/_testmain.go:102 - // runtime.main - // /home/dfc/go/src/runtime/proc.go:183 - // runtime.goexit - // /home/dfc/go/src/runtime/asm_amd64.s:2059 -} - -func Example_stackTrace() { - type stackTracer interface { - StackTrace() errors.StackTrace - } - - err, ok := errors.Cause(fn()).(stackTracer) - if !ok { - panic("oops, err does not implement stackTracer") - } - - st := err.StackTrace() - fmt.Printf("%+v", st[0:2]) // top two frames - - // Example output: - // github.com/pkg/errors_test.fn - // /home/dfc/src/github.com/pkg/errors/example_test.go:47 - // github.com/pkg/errors_test.Example_stackTrace - // /home/dfc/src/github.com/pkg/errors/example_test.go:127 -} - -func ExampleCause_printf() { - err := errors.Wrap(func() error { - return func() error { - return errors.Errorf("hello %s", fmt.Sprintf("world")) - }() - }(), "failed") - - fmt.Printf("%v", err) - - // Output: failed: hello world -} diff --git a/vendor/github.com/pkg/errors/format_test.go b/vendor/github.com/pkg/errors/format_test.go deleted file mode 100644 index 15fd7d89d..000000000 --- a/vendor/github.com/pkg/errors/format_test.go +++ /dev/null @@ -1,535 +0,0 @@ -package errors - -import ( - "errors" - "fmt" - "io" - "regexp" - "strings" - "testing" -) - -func TestFormatNew(t *testing.T) { - tests := []struct { - error - format string - want string - }{{ - New("error"), - "%s", - "error", - }, { - New("error"), - "%v", - "error", - }, { - New("error"), - "%+v", - "error\n" + - "github.com/pkg/errors.TestFormatNew\n" + - "\t.+/github.com/pkg/errors/format_test.go:26", - }, { - New("error"), - "%q", - `"error"`, - }} - - for i, tt := range tests { - testFormatRegexp(t, i, tt.error, tt.format, tt.want) - } -} - -func TestFormatErrorf(t *testing.T) { - tests := []struct { - error - format string - want string - }{{ - Errorf("%s", "error"), - "%s", - "error", - }, { - Errorf("%s", "error"), - "%v", - "error", - }, { - Errorf("%s", "error"), - "%+v", - "error\n" + - "github.com/pkg/errors.TestFormatErrorf\n" + - "\t.+/github.com/pkg/errors/format_test.go:56", - }} - - for i, tt := range tests { - testFormatRegexp(t, i, tt.error, tt.format, tt.want) - } -} - -func TestFormatWrap(t *testing.T) { - tests := []struct { - error - format string - want string - }{{ - Wrap(New("error"), "error2"), - "%s", - "error2: error", - }, { - Wrap(New("error"), "error2"), - "%v", - "error2: error", - }, { - Wrap(New("error"), "error2"), - "%+v", - "error\n" + - "github.com/pkg/errors.TestFormatWrap\n" + - "\t.+/github.com/pkg/errors/format_test.go:82", - }, { - Wrap(io.EOF, "error"), - "%s", - "error: EOF", - }, { - Wrap(io.EOF, "error"), - "%v", - "error: EOF", - }, { - Wrap(io.EOF, "error"), - "%+v", - "EOF\n" + - "error\n" + - "github.com/pkg/errors.TestFormatWrap\n" + - "\t.+/github.com/pkg/errors/format_test.go:96", - }, { - Wrap(Wrap(io.EOF, "error1"), "error2"), - "%+v", - "EOF\n" + - "error1\n" + - "github.com/pkg/errors.TestFormatWrap\n" + - "\t.+/github.com/pkg/errors/format_test.go:103\n", - }, { - Wrap(New("error with space"), "context"), - "%q", - `"context: error with space"`, - }} - - for i, tt := range tests { - testFormatRegexp(t, i, tt.error, tt.format, tt.want) - } -} - -func TestFormatWrapf(t *testing.T) { - tests := []struct { - error - format string - want string - }{{ - Wrapf(io.EOF, "error%d", 2), - "%s", - "error2: EOF", - }, { - Wrapf(io.EOF, "error%d", 2), - "%v", - "error2: EOF", - }, { - Wrapf(io.EOF, "error%d", 2), - "%+v", - "EOF\n" + - "error2\n" + - "github.com/pkg/errors.TestFormatWrapf\n" + - "\t.+/github.com/pkg/errors/format_test.go:134", - }, { - Wrapf(New("error"), "error%d", 2), - "%s", - "error2: error", - }, { - Wrapf(New("error"), "error%d", 2), - "%v", - "error2: error", - }, { - Wrapf(New("error"), "error%d", 2), - "%+v", - "error\n" + - "github.com/pkg/errors.TestFormatWrapf\n" + - "\t.+/github.com/pkg/errors/format_test.go:149", - }} - - for i, tt := range tests { - testFormatRegexp(t, i, tt.error, tt.format, tt.want) - } -} - -func TestFormatWithStack(t *testing.T) { - tests := []struct { - error - format string - want []string - }{{ - WithStack(io.EOF), - "%s", - []string{"EOF"}, - }, { - WithStack(io.EOF), - "%v", - []string{"EOF"}, - }, { - WithStack(io.EOF), - "%+v", - []string{"EOF", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:175"}, - }, { - WithStack(New("error")), - "%s", - []string{"error"}, - }, { - WithStack(New("error")), - "%v", - []string{"error"}, - }, { - WithStack(New("error")), - "%+v", - []string{"error", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:189", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:189"}, - }, { - WithStack(WithStack(io.EOF)), - "%+v", - []string{"EOF", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:197", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:197"}, - }, { - WithStack(WithStack(Wrapf(io.EOF, "message"))), - "%+v", - []string{"EOF", - "message", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:205", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:205", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:205"}, - }, { - WithStack(Errorf("error%d", 1)), - "%+v", - []string{"error1", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:216", - "github.com/pkg/errors.TestFormatWithStack\n" + - "\t.+/github.com/pkg/errors/format_test.go:216"}, - }} - - for i, tt := range tests { - testFormatCompleteCompare(t, i, tt.error, tt.format, tt.want, true) - } -} - -func TestFormatWithMessage(t *testing.T) { - tests := []struct { - error - format string - want []string - }{{ - WithMessage(New("error"), "error2"), - "%s", - []string{"error2: error"}, - }, { - WithMessage(New("error"), "error2"), - "%v", - []string{"error2: error"}, - }, { - WithMessage(New("error"), "error2"), - "%+v", - []string{ - "error", - "github.com/pkg/errors.TestFormatWithMessage\n" + - "\t.+/github.com/pkg/errors/format_test.go:244", - "error2"}, - }, { - WithMessage(io.EOF, "addition1"), - "%s", - []string{"addition1: EOF"}, - }, { - WithMessage(io.EOF, "addition1"), - "%v", - []string{"addition1: EOF"}, - }, { - WithMessage(io.EOF, "addition1"), - "%+v", - []string{"EOF", "addition1"}, - }, { - WithMessage(WithMessage(io.EOF, "addition1"), "addition2"), - "%v", - []string{"addition2: addition1: EOF"}, - }, { - WithMessage(WithMessage(io.EOF, "addition1"), "addition2"), - "%+v", - []string{"EOF", "addition1", "addition2"}, - }, { - Wrap(WithMessage(io.EOF, "error1"), "error2"), - "%+v", - []string{"EOF", "error1", "error2", - "github.com/pkg/errors.TestFormatWithMessage\n" + - "\t.+/github.com/pkg/errors/format_test.go:272"}, - }, { - WithMessage(Errorf("error%d", 1), "error2"), - "%+v", - []string{"error1", - "github.com/pkg/errors.TestFormatWithMessage\n" + - "\t.+/github.com/pkg/errors/format_test.go:278", - "error2"}, - }, { - WithMessage(WithStack(io.EOF), "error"), - "%+v", - []string{ - "EOF", - "github.com/pkg/errors.TestFormatWithMessage\n" + - "\t.+/github.com/pkg/errors/format_test.go:285", - "error"}, - }, { - WithMessage(Wrap(WithStack(io.EOF), "inside-error"), "outside-error"), - "%+v", - []string{ - "EOF", - "github.com/pkg/errors.TestFormatWithMessage\n" + - "\t.+/github.com/pkg/errors/format_test.go:293", - "inside-error", - "github.com/pkg/errors.TestFormatWithMessage\n" + - "\t.+/github.com/pkg/errors/format_test.go:293", - "outside-error"}, - }} - - for i, tt := range tests { - testFormatCompleteCompare(t, i, tt.error, tt.format, tt.want, true) - } -} - -func TestFormatGeneric(t *testing.T) { - starts := []struct { - err error - want []string - }{ - {New("new-error"), []string{ - "new-error", - "github.com/pkg/errors.TestFormatGeneric\n" + - "\t.+/github.com/pkg/errors/format_test.go:315"}, - }, {Errorf("errorf-error"), []string{ - "errorf-error", - "github.com/pkg/errors.TestFormatGeneric\n" + - "\t.+/github.com/pkg/errors/format_test.go:319"}, - }, {errors.New("errors-new-error"), []string{ - "errors-new-error"}, - }, - } - - wrappers := []wrapper{ - { - func(err error) error { return WithMessage(err, "with-message") }, - []string{"with-message"}, - }, { - func(err error) error { return WithStack(err) }, - []string{ - "github.com/pkg/errors.(func·002|TestFormatGeneric.func2)\n\t" + - ".+/github.com/pkg/errors/format_test.go:333", - }, - }, { - func(err error) error { return Wrap(err, "wrap-error") }, - []string{ - "wrap-error", - "github.com/pkg/errors.(func·003|TestFormatGeneric.func3)\n\t" + - ".+/github.com/pkg/errors/format_test.go:339", - }, - }, { - func(err error) error { return Wrapf(err, "wrapf-error%d", 1) }, - []string{ - "wrapf-error1", - "github.com/pkg/errors.(func·004|TestFormatGeneric.func4)\n\t" + - ".+/github.com/pkg/errors/format_test.go:346", - }, - }, - } - - for s := range starts { - err := starts[s].err - want := starts[s].want - testFormatCompleteCompare(t, s, err, "%+v", want, false) - testGenericRecursive(t, err, want, wrappers, 3) - } -} - -func testFormatRegexp(t *testing.T, n int, arg interface{}, format, want string) { - got := fmt.Sprintf(format, arg) - gotLines := strings.SplitN(got, "\n", -1) - wantLines := strings.SplitN(want, "\n", -1) - - if len(wantLines) > len(gotLines) { - t.Errorf("test %d: wantLines(%d) > gotLines(%d):\n got: %q\nwant: %q", n+1, len(wantLines), len(gotLines), got, want) - return - } - - for i, w := range wantLines { - match, err := regexp.MatchString(w, gotLines[i]) - if err != nil { - t.Fatal(err) - } - if !match { - t.Errorf("test %d: line %d: fmt.Sprintf(%q, err):\n got: %q\nwant: %q", n+1, i+1, format, got, want) - } - } -} - -var stackLineR = regexp.MustCompile(`\.`) - -// parseBlocks parses input into a slice, where: -// - incase entry contains a newline, its a stacktrace -// - incase entry contains no newline, its a solo line. -// -// Detecting stack boundaries only works incase the WithStack-calls are -// to be found on the same line, thats why it is optionally here. -// -// Example use: -// -// for _, e := range blocks { -// if strings.ContainsAny(e, "\n") { -// // Match as stack -// } else { -// // Match as line -// } -// } -// -func parseBlocks(input string, detectStackboundaries bool) ([]string, error) { - var blocks []string - - stack := "" - wasStack := false - lines := map[string]bool{} // already found lines - - for _, l := range strings.Split(input, "\n") { - isStackLine := stackLineR.MatchString(l) - - switch { - case !isStackLine && wasStack: - blocks = append(blocks, stack, l) - stack = "" - lines = map[string]bool{} - case isStackLine: - if wasStack { - // Detecting two stacks after another, possible cause lines match in - // our tests due to WithStack(WithStack(io.EOF)) on same line. - if detectStackboundaries { - if lines[l] { - if len(stack) == 0 { - return nil, errors.New("len of block must not be zero here") - } - - blocks = append(blocks, stack) - stack = l - lines = map[string]bool{l: true} - continue - } - } - - stack = stack + "\n" + l - } else { - stack = l - } - lines[l] = true - case !isStackLine && !wasStack: - blocks = append(blocks, l) - default: - return nil, errors.New("must not happen") - } - - wasStack = isStackLine - } - - // Use up stack - if stack != "" { - blocks = append(blocks, stack) - } - return blocks, nil -} - -func testFormatCompleteCompare(t *testing.T, n int, arg interface{}, format string, want []string, detectStackBoundaries bool) { - gotStr := fmt.Sprintf(format, arg) - - got, err := parseBlocks(gotStr, detectStackBoundaries) - if err != nil { - t.Fatal(err) - } - - if len(got) != len(want) { - t.Fatalf("test %d: fmt.Sprintf(%s, err) -> wrong number of blocks: got(%d) want(%d)\n got: %s\nwant: %s\ngotStr: %q", - n+1, format, len(got), len(want), prettyBlocks(got), prettyBlocks(want), gotStr) - } - - for i := range got { - if strings.ContainsAny(want[i], "\n") { - // Match as stack - match, err := regexp.MatchString(want[i], got[i]) - if err != nil { - t.Fatal(err) - } - if !match { - t.Fatalf("test %d: block %d: fmt.Sprintf(%q, err):\ngot:\n%q\nwant:\n%q\nall-got:\n%s\nall-want:\n%s\n", - n+1, i+1, format, got[i], want[i], prettyBlocks(got), prettyBlocks(want)) - } - } else { - // Match as message - if got[i] != want[i] { - t.Fatalf("test %d: fmt.Sprintf(%s, err) at block %d got != want:\n got: %q\nwant: %q", n+1, format, i+1, got[i], want[i]) - } - } - } -} - -type wrapper struct { - wrap func(err error) error - want []string -} - -func prettyBlocks(blocks []string, prefix ...string) string { - var out []string - - for _, b := range blocks { - out = append(out, fmt.Sprintf("%v", b)) - } - - return " " + strings.Join(out, "\n ") -} - -func testGenericRecursive(t *testing.T, beforeErr error, beforeWant []string, list []wrapper, maxDepth int) { - if len(beforeWant) == 0 { - panic("beforeWant must not be empty") - } - for _, w := range list { - if len(w.want) == 0 { - panic("want must not be empty") - } - - err := w.wrap(beforeErr) - - // Copy required cause append(beforeWant, ..) modified beforeWant subtly. - beforeCopy := make([]string, len(beforeWant)) - copy(beforeCopy, beforeWant) - - beforeWant := beforeCopy - last := len(beforeWant) - 1 - var want []string - - // Merge two stacks behind each other. - if strings.ContainsAny(beforeWant[last], "\n") && strings.ContainsAny(w.want[0], "\n") { - want = append(beforeWant[:last], append([]string{beforeWant[last] + "((?s).*)" + w.want[0]}, w.want[1:]...)...) - } else { - want = append(beforeWant, w.want...) - } - - testFormatCompleteCompare(t, maxDepth, err, "%+v", want, false) - if maxDepth > 0 { - testGenericRecursive(t, err, want, list, maxDepth-1) - } - } -} diff --git a/vendor/github.com/pkg/errors/stack.go b/vendor/github.com/pkg/errors/stack.go deleted file mode 100644 index 6b1f2891a..000000000 --- a/vendor/github.com/pkg/errors/stack.go +++ /dev/null @@ -1,178 +0,0 @@ -package errors - -import ( - "fmt" - "io" - "path" - "runtime" - "strings" -) - -// Frame represents a program counter inside a stack frame. -type Frame uintptr - -// pc returns the program counter for this frame; -// multiple frames may have the same PC value. -func (f Frame) pc() uintptr { return uintptr(f) - 1 } - -// file returns the full path to the file that contains the -// function for this Frame's pc. -func (f Frame) file() string { - fn := runtime.FuncForPC(f.pc()) - if fn == nil { - return "unknown" - } - file, _ := fn.FileLine(f.pc()) - return file -} - -// line returns the line number of source code of the -// function for this Frame's pc. -func (f Frame) line() int { - fn := runtime.FuncForPC(f.pc()) - if fn == nil { - return 0 - } - _, line := fn.FileLine(f.pc()) - return line -} - -// Format formats the frame according to the fmt.Formatter interface. -// -// %s source file -// %d source line -// %n function name -// %v equivalent to %s:%d -// -// Format accepts flags that alter the printing of some verbs, as follows: -// -// %+s path of source file relative to the compile time GOPATH -// %+v equivalent to %+s:%d -func (f Frame) Format(s fmt.State, verb rune) { - switch verb { - case 's': - switch { - case s.Flag('+'): - pc := f.pc() - fn := runtime.FuncForPC(pc) - if fn == nil { - io.WriteString(s, "unknown") - } else { - file, _ := fn.FileLine(pc) - fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file) - } - default: - io.WriteString(s, path.Base(f.file())) - } - case 'd': - fmt.Fprintf(s, "%d", f.line()) - case 'n': - name := runtime.FuncForPC(f.pc()).Name() - io.WriteString(s, funcname(name)) - case 'v': - f.Format(s, 's') - io.WriteString(s, ":") - f.Format(s, 'd') - } -} - -// StackTrace is stack of Frames from innermost (newest) to outermost (oldest). -type StackTrace []Frame - -func (st StackTrace) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - switch { - case s.Flag('+'): - for _, f := range st { - fmt.Fprintf(s, "\n%+v", f) - } - case s.Flag('#'): - fmt.Fprintf(s, "%#v", []Frame(st)) - default: - fmt.Fprintf(s, "%v", []Frame(st)) - } - case 's': - fmt.Fprintf(s, "%s", []Frame(st)) - } -} - -// stack represents a stack of program counters. -type stack []uintptr - -func (s *stack) Format(st fmt.State, verb rune) { - switch verb { - case 'v': - switch { - case st.Flag('+'): - for _, pc := range *s { - f := Frame(pc) - fmt.Fprintf(st, "\n%+v", f) - } - } - } -} - -func (s *stack) StackTrace() StackTrace { - f := make([]Frame, len(*s)) - for i := 0; i < len(f); i++ { - f[i] = Frame((*s)[i]) - } - return f -} - -func callers() *stack { - const depth = 32 - var pcs [depth]uintptr - n := runtime.Callers(3, pcs[:]) - var st stack = pcs[0:n] - return &st -} - -// funcname removes the path prefix component of a function's name reported by func.Name(). -func funcname(name string) string { - i := strings.LastIndex(name, "/") - name = name[i+1:] - i = strings.Index(name, ".") - return name[i+1:] -} - -func trimGOPATH(name, file string) string { - // Here we want to get the source file path relative to the compile time - // GOPATH. As of Go 1.6.x there is no direct way to know the compiled - // GOPATH at runtime, but we can infer the number of path segments in the - // GOPATH. We note that fn.Name() returns the function name qualified by - // the import path, which does not include the GOPATH. Thus we can trim - // segments from the beginning of the file path until the number of path - // separators remaining is one more than the number of path separators in - // the function name. For example, given: - // - // GOPATH /home/user - // file /home/user/src/pkg/sub/file.go - // fn.Name() pkg/sub.Type.Method - // - // We want to produce: - // - // pkg/sub/file.go - // - // From this we can easily see that fn.Name() has one less path separator - // than our desired output. We count separators from the end of the file - // path until it finds two more than in the function name and then move - // one character forward to preserve the initial path segment without a - // leading separator. - const sep = "/" - goal := strings.Count(name, sep) + 2 - i := len(file) - for n := 0; n < goal; n++ { - i = strings.LastIndex(file[:i], sep) - if i == -1 { - // not enough separators found, set i so that the slice expression - // below leaves file unmodified - i = -len(sep) - break - } - } - // get back to 0 or trim the leading separator - file = file[i+len(sep):] - return file -} diff --git a/vendor/github.com/pkg/errors/stack_test.go b/vendor/github.com/pkg/errors/stack_test.go deleted file mode 100644 index 510c27a9f..000000000 --- a/vendor/github.com/pkg/errors/stack_test.go +++ /dev/null @@ -1,292 +0,0 @@ -package errors - -import ( - "fmt" - "runtime" - "testing" -) - -var initpc, _, _, _ = runtime.Caller(0) - -func TestFrameLine(t *testing.T) { - var tests = []struct { - Frame - want int - }{{ - Frame(initpc), - 9, - }, { - func() Frame { - var pc, _, _, _ = runtime.Caller(0) - return Frame(pc) - }(), - 20, - }, { - func() Frame { - var pc, _, _, _ = runtime.Caller(1) - return Frame(pc) - }(), - 28, - }, { - Frame(0), // invalid PC - 0, - }} - - for _, tt := range tests { - got := tt.Frame.line() - want := tt.want - if want != got { - t.Errorf("Frame(%v): want: %v, got: %v", uintptr(tt.Frame), want, got) - } - } -} - -type X struct{} - -func (x X) val() Frame { - var pc, _, _, _ = runtime.Caller(0) - return Frame(pc) -} - -func (x *X) ptr() Frame { - var pc, _, _, _ = runtime.Caller(0) - return Frame(pc) -} - -func TestFrameFormat(t *testing.T) { - var tests = []struct { - Frame - format string - want string - }{{ - Frame(initpc), - "%s", - "stack_test.go", - }, { - Frame(initpc), - "%+s", - "github.com/pkg/errors.init\n" + - "\t.+/github.com/pkg/errors/stack_test.go", - }, { - Frame(0), - "%s", - "unknown", - }, { - Frame(0), - "%+s", - "unknown", - }, { - Frame(initpc), - "%d", - "9", - }, { - Frame(0), - "%d", - "0", - }, { - Frame(initpc), - "%n", - "init", - }, { - func() Frame { - var x X - return x.ptr() - }(), - "%n", - `\(\*X\).ptr`, - }, { - func() Frame { - var x X - return x.val() - }(), - "%n", - "X.val", - }, { - Frame(0), - "%n", - "", - }, { - Frame(initpc), - "%v", - "stack_test.go:9", - }, { - Frame(initpc), - "%+v", - "github.com/pkg/errors.init\n" + - "\t.+/github.com/pkg/errors/stack_test.go:9", - }, { - Frame(0), - "%v", - "unknown:0", - }} - - for i, tt := range tests { - testFormatRegexp(t, i, tt.Frame, tt.format, tt.want) - } -} - -func TestFuncname(t *testing.T) { - tests := []struct { - name, want string - }{ - {"", ""}, - {"runtime.main", "main"}, - {"github.com/pkg/errors.funcname", "funcname"}, - {"funcname", "funcname"}, - {"io.copyBuffer", "copyBuffer"}, - {"main.(*R).Write", "(*R).Write"}, - } - - for _, tt := range tests { - got := funcname(tt.name) - want := tt.want - if got != want { - t.Errorf("funcname(%q): want: %q, got %q", tt.name, want, got) - } - } -} - -func TestTrimGOPATH(t *testing.T) { - var tests = []struct { - Frame - want string - }{{ - Frame(initpc), - "github.com/pkg/errors/stack_test.go", - }} - - for i, tt := range tests { - pc := tt.Frame.pc() - fn := runtime.FuncForPC(pc) - file, _ := fn.FileLine(pc) - got := trimGOPATH(fn.Name(), file) - testFormatRegexp(t, i, got, "%s", tt.want) - } -} - -func TestStackTrace(t *testing.T) { - tests := []struct { - err error - want []string - }{{ - New("ooh"), []string{ - "github.com/pkg/errors.TestStackTrace\n" + - "\t.+/github.com/pkg/errors/stack_test.go:172", - }, - }, { - Wrap(New("ooh"), "ahh"), []string{ - "github.com/pkg/errors.TestStackTrace\n" + - "\t.+/github.com/pkg/errors/stack_test.go:177", // this is the stack of Wrap, not New - }, - }, { - Cause(Wrap(New("ooh"), "ahh")), []string{ - "github.com/pkg/errors.TestStackTrace\n" + - "\t.+/github.com/pkg/errors/stack_test.go:182", // this is the stack of New - }, - }, { - func() error { return New("ooh") }(), []string{ - `github.com/pkg/errors.(func·009|TestStackTrace.func1)` + - "\n\t.+/github.com/pkg/errors/stack_test.go:187", // this is the stack of New - "github.com/pkg/errors.TestStackTrace\n" + - "\t.+/github.com/pkg/errors/stack_test.go:187", // this is the stack of New's caller - }, - }, { - Cause(func() error { - return func() error { - return Errorf("hello %s", fmt.Sprintf("world")) - }() - }()), []string{ - `github.com/pkg/errors.(func·010|TestStackTrace.func2.1)` + - "\n\t.+/github.com/pkg/errors/stack_test.go:196", // this is the stack of Errorf - `github.com/pkg/errors.(func·011|TestStackTrace.func2)` + - "\n\t.+/github.com/pkg/errors/stack_test.go:197", // this is the stack of Errorf's caller - "github.com/pkg/errors.TestStackTrace\n" + - "\t.+/github.com/pkg/errors/stack_test.go:198", // this is the stack of Errorf's caller's caller - }, - }} - for i, tt := range tests { - x, ok := tt.err.(interface { - StackTrace() StackTrace - }) - if !ok { - t.Errorf("expected %#v to implement StackTrace() StackTrace", tt.err) - continue - } - st := x.StackTrace() - for j, want := range tt.want { - testFormatRegexp(t, i, st[j], "%+v", want) - } - } -} - -func stackTrace() StackTrace { - const depth = 8 - var pcs [depth]uintptr - n := runtime.Callers(1, pcs[:]) - var st stack = pcs[0:n] - return st.StackTrace() -} - -func TestStackTraceFormat(t *testing.T) { - tests := []struct { - StackTrace - format string - want string - }{{ - nil, - "%s", - `\[\]`, - }, { - nil, - "%v", - `\[\]`, - }, { - nil, - "%+v", - "", - }, { - nil, - "%#v", - `\[\]errors.Frame\(nil\)`, - }, { - make(StackTrace, 0), - "%s", - `\[\]`, - }, { - make(StackTrace, 0), - "%v", - `\[\]`, - }, { - make(StackTrace, 0), - "%+v", - "", - }, { - make(StackTrace, 0), - "%#v", - `\[\]errors.Frame{}`, - }, { - stackTrace()[:2], - "%s", - `\[stack_test.go stack_test.go\]`, - }, { - stackTrace()[:2], - "%v", - `\[stack_test.go:225 stack_test.go:272\]`, - }, { - stackTrace()[:2], - "%+v", - "\n" + - "github.com/pkg/errors.stackTrace\n" + - "\t.+/github.com/pkg/errors/stack_test.go:225\n" + - "github.com/pkg/errors.TestStackTraceFormat\n" + - "\t.+/github.com/pkg/errors/stack_test.go:276", - }, { - stackTrace()[:2], - "%#v", - `\[\]errors.Frame{stack_test.go:225, stack_test.go:284}`, - }} - - for i, tt := range tests { - testFormatRegexp(t, i, tt.StackTrace, tt.format, tt.want) - } -} diff --git a/vendor/github.com/prometheus/client_golang/.github/ISSUE_TEMPLATE.md b/vendor/github.com/prometheus/client_golang/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 5161adf4a..000000000 --- a/vendor/github.com/prometheus/client_golang/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,30 +0,0 @@ - - - diff --git a/vendor/github.com/prometheus/client_golang/.gitignore b/vendor/github.com/prometheus/client_golang/.gitignore deleted file mode 100644 index 5725b80fd..000000000 --- a/vendor/github.com/prometheus/client_golang/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Examples -/examples/simple/simple -/examples/random/random - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe - -*~ -*# -.build diff --git a/vendor/github.com/prometheus/client_golang/.travis.yml b/vendor/github.com/prometheus/client_golang/.travis.yml deleted file mode 100644 index a5cbf7585..000000000 --- a/vendor/github.com/prometheus/client_golang/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -sudo: false -language: go - -go: - - 1.7.x # See README.md for current minimum version. - - 1.8.x - - 1.9.x - - 1.10.x - - 1.11.x - -script: - - make check_license style unused test-short - - if [[ ! $TRAVIS_GO_VERSION =~ ^1\.(7|8|9)\.[x0-9]+$ ]]; then make staticcheck; fi diff --git a/vendor/github.com/prometheus/client_golang/CHANGELOG.md b/vendor/github.com/prometheus/client_golang/CHANGELOG.md deleted file mode 100644 index adcef046a..000000000 --- a/vendor/github.com/prometheus/client_golang/CHANGELOG.md +++ /dev/null @@ -1,161 +0,0 @@ -## 0.9.0 / 2018-10-15 -* [CHANGE] Go1.6 is no longer supported. -* [CHANGE] More refinements of the `Registry` consistency checks: Duplicated - labels are now detected, but inconsistent label dimensions are now allowed. - Collisions with the “magic” metric and label names in Summaries and - Histograms are detected now. #108 #417 #471 -* [CHANGE] Changed `ProcessCollector` constructor. #219 -* [CHANGE] Changed Go counter `go_memstats_heap_released_bytes_total` to gauge - `go_memstats_heap_released_bytes`. #229 -* [CHANGE] Unexported `LabelPairSorter`. #453 -* [CHANGE] Removed the `Untyped` metric from direct instrumentation. #340 -* [CHANGE] Unexported `MetricVec`. #319 -* [CHANGE] Removed deprecated `Set` method from `Counter` #247 -* [CHANGE] Removed deprecated `RegisterOrGet` and `MustRegisterOrGet`. #247 -* [CHANGE] API client: Introduced versioned packages. -* [FEATURE] A `Registerer` can be wrapped with prefixes and labels. #357 -* [FEATURE] “Describe by collect” helper function. #239 -* [FEATURE] Added package `testutil`. #58 -* [FEATURE] Timestamp can be explicitly set for const metrics. #187 -* [FEATURE] “Unchecked” collectors are possible now without cheating. #47 -* [FEATURE] Pushing to the Pushgateway reworked in package `push` to support - many new features. (The old functions are still usable but deprecated.) #372 - #341 -* [FEATURE] Configurable connection limit for scrapes. #179 -* [FEATURE] New HTTP middlewares to instrument `http.Handler` and - `http.RoundTripper`. The old middlewares and the pre-instrumented `/metrics` - handler are (strongly) deprecated. #316 #57 #101 #224 -* [FEATURE] “Currying” for metric vectors. #320 -* [FEATURE] A `Summary` can be created without quantiles. #118 -* [FEATURE] Added a `Timer` helper type. #231 -* [FEATURE] Added a Graphite bridge. #197 -* [FEATURE] Help strings are now optional. #460 -* [FEATURE] Added `process_virtual_memory_max_bytes` metric. #438 #440 -* [FEATURE] Added `go_gc_cpu_fraction` and `go_threads` metrics. #281 #277 -* [FEATURE] Added `promauto` package with auto-registering metrics. #385 #393 -* [FEATURE] Add `SetToCurrentTime` method to `Gauge`. #259 -* [FEATURE] API client: Add AlertManager, Status, and Target methods. #402 -* [FEATURE] API client: Add admin methods. #398 -* [FEATURE] API client: Support series API. #361 -* [FEATURE] API client: Support querying label values. -* [ENHANCEMENT] Smarter creation of goroutines during scraping. Solves memory - usage spikes in certain situations. #369 -* [ENHANCEMENT] Counters are now faster if dealing with integers only. #367 -* [ENHANCEMENT] Improved label validation. #274 #335 -* [BUGFIX] Creating a const metric with an invalid `Desc` returns an error. #460 -* [BUGFIX] Histogram observations don't race any longer with exposition. #275 -* [BUGFIX] Fixed goroutine leaks. #236 #472 -* [BUGFIX] Fixed an error message for exponential histogram buckets. #467 -* [BUGFIX] Fixed data race writing to the metric map. #401 -* [BUGFIX] API client: Decode JSON on a 4xx respons but do not on 204 - responses. #476 #414 - -## 0.8.0 / 2016-08-17 -* [CHANGE] Registry is doing more consistency checks. This might break - existing setups that used to export inconsistent metrics. -* [CHANGE] Pushing to Pushgateway moved to package `push` and changed to allow - arbitrary grouping. -* [CHANGE] Removed `SelfCollector`. -* [CHANGE] Removed `PanicOnCollectError` and `EnableCollectChecks` methods. -* [CHANGE] Moved packages to the prometheus/common repo: `text`, `model`, - `extraction`. -* [CHANGE] Deprecated a number of functions. -* [FEATURE] Allow custom registries. Added `Registerer` and `Gatherer` - interfaces. -* [FEATURE] Separated HTTP exposition, allowing custom HTTP handlers (package - `promhttp`) and enabling the creation of other exposition mechanisms. -* [FEATURE] `MustRegister` is variadic now, allowing registration of many - collectors in one call. -* [FEATURE] Added HTTP API v1 package. -* [ENHANCEMENT] Numerous documentation improvements. -* [ENHANCEMENT] Improved metric sorting. -* [ENHANCEMENT] Inlined fnv64a hashing for improved performance. -* [ENHANCEMENT] Several test improvements. -* [BUGFIX] Handle collisions in MetricVec. - -## 0.7.0 / 2015-07-27 -* [CHANGE] Rename ExporterLabelPrefix to ExportedLabelPrefix. -* [BUGFIX] Closed gaps in metric consistency check. -* [BUGFIX] Validate LabelName/LabelSet on JSON unmarshaling. -* [ENHANCEMENT] Document the possibility to create "empty" metrics in - a metric vector. -* [ENHANCEMENT] Fix and clarify various doc comments and the README.md. -* [ENHANCEMENT] (Kind of) solve "The Proxy Problem" of http.InstrumentHandler. -* [ENHANCEMENT] Change responseWriterDelegator.written to int64. - -## 0.6.0 / 2015-06-01 -* [CHANGE] Rename process_goroutines to go_goroutines. -* [ENHANCEMENT] Validate label names during YAML decoding. -* [ENHANCEMENT] Add LabelName regular expression. -* [BUGFIX] Ensure alignment of struct members for 32-bit systems. - -## 0.5.0 / 2015-05-06 -* [BUGFIX] Removed a weakness in the fingerprinting aka signature code. - This makes fingerprinting slower and more allocation-heavy, but the - weakness was too severe to be tolerated. -* [CHANGE] As a result of the above, Metric.Fingerprint is now returning - a different fingerprint. To keep the same fingerprint, the new method - Metric.FastFingerprint was introduced, which will be used by the - Prometheus server for storage purposes (implying that a collision - detection has to be added, too). -* [ENHANCEMENT] The Metric.Equal and Metric.Before do not depend on - fingerprinting anymore, removing the possibility of an undetected - fingerprint collision. -* [FEATURE] The Go collector in the exposition library includes garbage - collection stats. -* [FEATURE] The exposition library allows to create constant "throw-away" - summaries and histograms. -* [CHANGE] A number of new reserved labels and prefixes. - -## 0.4.0 / 2015-04-08 -* [CHANGE] Return NaN when Summaries have no observations yet. -* [BUGFIX] Properly handle Summary decay upon Write(). -* [BUGFIX] Fix the documentation link to the consumption library. -* [FEATURE] Allow the metric family injection hook to merge with existing - metric families. -* [ENHANCEMENT] Removed cgo dependency and conditional compilation of procfs. -* [MAINTENANCE] Adjusted to changes in matttproud/golang_protobuf_extensions. - -## 0.3.2 / 2015-03-11 -* [BUGFIX] Fixed the receiver type of COWMetric.Set(). This method is - only used by the Prometheus server internally. -* [CLEANUP] Added licenses of vendored code left out by godep. - -## 0.3.1 / 2015-03-04 -* [ENHANCEMENT] Switched fingerprinting functions from own free list to - sync.Pool. -* [CHANGE] Makefile uses Go 1.4.2 now (only relevant for examples and tests). - -## 0.3.0 / 2015-03-03 -* [CHANGE] Changed the fingerprinting for metrics. THIS WILL INVALIDATE ALL - PERSISTED FINGERPRINTS. IF YOU COMPILE THE PROMETHEUS SERVER WITH THIS - VERSION, YOU HAVE TO WIPE THE PREVIOUSLY CREATED STORAGE. -* [CHANGE] LabelValuesToSignature removed. (Nobody had used it, and it was - arguably broken.) -* [CHANGE] Vendored dependencies. Those are only used by the Makefile. If - client_golang is used as a library, the vendoring will stay out of your way. -* [BUGFIX] Remove a weakness in the fingerprinting for metrics. (This made - the fingerprinting change above necessary.) -* [FEATURE] Added new fingerprinting functions SignatureForLabels and - SignatureWithoutLabels to be used by the Prometheus server. These functions - require fewer allocations than the ones currently used by the server. - -## 0.2.0 / 2015-02-23 -* [FEATURE] Introduce new Histagram metric type. -* [CHANGE] Ignore process collector errors for now (better error handling - pending). -* [CHANGE] Use clear error interface for process pidFn. -* [BUGFIX] Fix Go download links for several archs and OSes. -* [ENHANCEMENT] Massively improve Gauge and Counter performance. -* [ENHANCEMENT] Catch illegal label names for summaries in histograms. -* [ENHANCEMENT] Reduce allocations during fingerprinting. -* [ENHANCEMENT] Remove cgo dependency. procfs package will only be included if - both cgo is available and the build is for an OS with procfs. -* [CLEANUP] Clean up code style issues. -* [CLEANUP] Mark slow test as such and exclude them from travis. -* [CLEANUP] Update protobuf library package name. -* [CLEANUP] Updated vendoring of beorn7/perks. - -## 0.1.0 / 2015-02-02 -* [CLEANUP] Introduced semantic versioning and changelog. From now on, - changes will be reported in this file. diff --git a/vendor/github.com/prometheus/client_golang/CONTRIBUTING.md b/vendor/github.com/prometheus/client_golang/CONTRIBUTING.md deleted file mode 100644 index e015a85cb..000000000 --- a/vendor/github.com/prometheus/client_golang/CONTRIBUTING.md +++ /dev/null @@ -1,20 +0,0 @@ -# Contributing - -Prometheus uses GitHub to manage reviews of pull requests. - -* If you have a trivial fix or improvement, go ahead and create a pull request, - addressing (with `@...`) the maintainer of this repository (see - [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request. - -* If you plan to do something more involved, first discuss your ideas - on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). - This will avoid unnecessary work and surely give you and us a good deal - of inspiration. - -* Relevant coding style guidelines are the [Go Code Review - Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) - and the _Formatting and style_ section of Peter Bourgon's [Go: Best - Practices for Production - Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style). - -* Be sure to sign off on the [DCO](https://github.com/probot/dco#how-it-works) diff --git a/vendor/github.com/prometheus/client_golang/Dockerfile b/vendor/github.com/prometheus/client_golang/Dockerfile deleted file mode 100644 index 211f22b9d..000000000 --- a/vendor/github.com/prometheus/client_golang/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -# This Dockerfile builds an image for a client_golang example. -# -# Use as (from the root for the client_golang repository): -# docker build -f examples/$name/Dockerfile -t prometheus/golang-example-$name . - -# Builder image, where we build the example. -FROM golang:1 AS builder -WORKDIR /go/src/github.com/prometheus/client_golang -COPY . . -WORKDIR /go/src/github.com/prometheus/client_golang/prometheus -RUN go get -d -WORKDIR /go/src/github.com/prometheus/client_golang/examples/random -RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w' -WORKDIR /go/src/github.com/prometheus/client_golang/examples/simple -RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w' - -# Final image. -FROM prom/busybox -LABEL maintainer="The Prometheus Authors " -COPY --from=builder /go/src/github.com/prometheus/client_golang/examples/random \ - /go/src/github.com/prometheus/client_golang/examples/simple ./ -EXPOSE 8080 -CMD echo Please run an example. Either /random or /simple diff --git a/vendor/github.com/prometheus/client_golang/LICENSE b/vendor/github.com/prometheus/client_golang/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/vendor/github.com/prometheus/client_golang/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/prometheus/client_golang/MAINTAINERS.md b/vendor/github.com/prometheus/client_golang/MAINTAINERS.md deleted file mode 100644 index 66668ad01..000000000 --- a/vendor/github.com/prometheus/client_golang/MAINTAINERS.md +++ /dev/null @@ -1,2 +0,0 @@ -* Krasi Georgiev for `api/...` -* Björn Rabenstein for everything else diff --git a/vendor/github.com/prometheus/client_golang/Makefile b/vendor/github.com/prometheus/client_golang/Makefile deleted file mode 100644 index 443c360b9..000000000 --- a/vendor/github.com/prometheus/client_golang/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2018 The Prometheus 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. - -include Makefile.common - -# http.CloseNotifier is deprecated but we don't want to remove support -# from client_golang to not break anybody still using it. -STATICCHECK_IGNORE = \ - github.com/prometheus/client_golang/prometheus/promhttp/delegator*.go:SA1019 \ - github.com/prometheus/client_golang/prometheus/promhttp/instrument_server_test.go:SA1019 \ - github.com/prometheus/client_golang/prometheus/http.go:SA1019 - -.PHONY: get_dep -get_dep: - @echo ">> getting dependencies" - $(GO) get -t ./... - -.PHONY: test -test: get_dep common-test - -.PHONY: test-short -test-short: get_dep common-test-short diff --git a/vendor/github.com/prometheus/client_golang/Makefile.common b/vendor/github.com/prometheus/client_golang/Makefile.common deleted file mode 100644 index c9d832373..000000000 --- a/vendor/github.com/prometheus/client_golang/Makefile.common +++ /dev/null @@ -1,132 +0,0 @@ -# Copyright 2018 The Prometheus 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. - - -# A common Makefile that includes rules to be reused in different prometheus projects. -# !!! Open PRs only against the prometheus/prometheus/Makefile.common repository! - -# Example usage : -# Create the main Makefile in the root project directory. -# include Makefile.common -# customTarget: -# @echo ">> Running customTarget" -# - -# Ensure GOBIN is not set during build so that promu is installed to the correct path -unexport GOBIN - -GO ?= go -GOFMT ?= $(GO)fmt -FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) -PROMU := $(FIRST_GOPATH)/bin/promu -STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck -GOVENDOR := $(FIRST_GOPATH)/bin/govendor -pkgs = ./... - -PREFIX ?= $(shell pwd) -BIN_DIR ?= $(shell pwd) -DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) -DOCKER_REPO ?= prom - -.PHONY: all -all: style staticcheck unused build test - -# This rule is used to forward a target like "build" to "common-build". This -# allows a new "build" target to be defined in a Makefile which includes this -# one and override "common-build" without override warnings. -%: common-% ; - -.PHONY: common-style -common-style: - @echo ">> checking code style" - @fmtRes=$$($(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print)); \ - if [ -n "$${fmtRes}" ]; then \ - echo "gofmt checking failed!"; echo "$${fmtRes}"; echo; \ - echo "Please ensure you are using $$($(GO) version) for formatting code."; \ - exit 1; \ - fi - -.PHONY: common-check_license -common-check_license: - @echo ">> checking license header" - @licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \ - awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \ - done); \ - if [ -n "$${licRes}" ]; then \ - echo "license header checking failed:"; echo "$${licRes}"; \ - exit 1; \ - fi - -.PHONY: common-test-short -common-test-short: - @echo ">> running short tests" - $(GO) test -short $(pkgs) - -.PHONY: common-test -common-test: - @echo ">> running all tests" - $(GO) test -race $(pkgs) - -.PHONY: common-format -common-format: - @echo ">> formatting code" - $(GO) fmt $(pkgs) - -.PHONY: common-vet -common-vet: - @echo ">> vetting code" - $(GO) vet $(pkgs) - -.PHONY: common-staticcheck -common-staticcheck: $(STATICCHECK) - @echo ">> running staticcheck" - $(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs) - -.PHONY: common-unused -common-unused: $(GOVENDOR) - @echo ">> running check for unused packages" - @$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages' - -.PHONY: common-build -common-build: promu - @echo ">> building binaries" - $(PROMU) build --prefix $(PREFIX) - -.PHONY: common-tarball -common-tarball: promu - @echo ">> building release tarball" - $(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR) - -.PHONY: common-docker -common-docker: - docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . - -.PHONY: common-docker-publish -common-docker-publish: - docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)" - -.PHONY: common-docker-tag-latest -common-docker-tag-latest: - docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):latest" - -.PHONY: promu -promu: - GOOS= GOARCH= $(GO) get -u github.com/prometheus/promu - -.PHONY: $(STATICCHECK) -$(STATICCHECK): - GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck - -.PHONY: $(GOVENDOR) -$(GOVENDOR): - GOOS= GOARCH= $(GO) get -u github.com/kardianos/govendor diff --git a/vendor/github.com/prometheus/client_golang/NOTICE b/vendor/github.com/prometheus/client_golang/NOTICE deleted file mode 100644 index dd878a30e..000000000 --- a/vendor/github.com/prometheus/client_golang/NOTICE +++ /dev/null @@ -1,23 +0,0 @@ -Prometheus instrumentation library for Go applications -Copyright 2012-2015 The Prometheus Authors - -This product includes software developed at -SoundCloud Ltd. (http://soundcloud.com/). - - -The following components are included in this product: - -perks - a fork of https://github.com/bmizerany/perks -https://github.com/beorn7/perks -Copyright 2013-2015 Blake Mizerany, Björn Rabenstein -See https://github.com/beorn7/perks/blob/master/README.md for license details. - -Go support for Protocol Buffers - Google's data interchange format -http://github.com/golang/protobuf/ -Copyright 2010 The Go Authors -See source code for license details. - -Support for streaming Protocol Buffer messages for the Go language (golang). -https://github.com/matttproud/golang_protobuf_extensions -Copyright 2013 Matt T. Proud -Licensed under the Apache License, Version 2.0 diff --git a/vendor/github.com/prometheus/client_golang/README.md b/vendor/github.com/prometheus/client_golang/README.md deleted file mode 100644 index 894a6a3e2..000000000 --- a/vendor/github.com/prometheus/client_golang/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# Prometheus Go client library - -[![Build Status](https://travis-ci.org/prometheus/client_golang.svg?branch=master)](https://travis-ci.org/prometheus/client_golang) -[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/client_golang)](https://goreportcard.com/report/github.com/prometheus/client_golang) -[![go-doc](https://godoc.org/github.com/prometheus/client_golang?status.svg)](https://godoc.org/github.com/prometheus/client_golang) - -This is the [Go](http://golang.org) client library for -[Prometheus](http://prometheus.io). It has two separate parts, one for -instrumenting application code, and one for creating clients that talk to the -Prometheus HTTP API. - -__This library requires Go1.7 or later.__ - -## Important note about releases, versioning, tagging, and stability - -While our goal is to follow [Semantic Versioning](https://semver.org/), this -repository is still pre-1.0.0. To quote the -[Semantic Versioning spec](https://semver.org/#spec-item-4): “Anything may -change at any time. The public API should not be considered stable.” We know -that this is at odds with the widespread use of this library. However, just -declaring something 1.0.0 doesn't make it 1.0.0. Instead, we are working -towards a 1.0.0 release that actually deserves its major version number. - -Having said that, we aim for always keeping the tip of master in a workable -state. We occasionally tag versions and track their changes in CHANGELOG.md, -but this happens mostly to keep dependency management tools happy and to give -people a handle they can talk about easily. In particular, all commits in the -master branch have passed the same testing and reviewing. There is no QA -process in place that would render tagged commits more stable or better tested -than others. - -There is a plan behind the current (pre-1.0.0) versioning, though: - -- v0.9 is the “production release”, currently tracked in the master - branch. “Patch” releases will usually be just bug fixes, indeed, but - important new features that do not require invasive code changes might also - be included in those. We do not plan any breaking changes from one v0.9.x - release to any later v0.9.y release, but nothing is guaranteed. Since the - master branch will eventually be switched over to track the upcoming v0.10 - (see below), we recommend to tell your dependency management tool of choice - to use the latest v0.9.x release, at least for your production software. In - that way, you should get bug fixes and non-invasive, low-risk new features - without the need to change anything on your part. -- v0.10 is a planned release that will have a _lot_ of breaking changes - (despite being only a “minor” release in the Semantic Versioning terminology, - but as said, pre-1.0.0 means nothing is guaranteed). Essentially, we have - been piling up feature requests that require breaking changes for a while, - and they are all collected in the - [v0.10 milestone](https://github.com/prometheus/client_golang/milestone/2). - Since there will be so many breaking changes, the development for v0.10 is - currently not happening in the master branch, but in the - [dev-0.10 branch](https://github.com/prometheus/client_golang/tree/dev-0.10). - It will violently change for a while, and it will definitely be in a - non-working state now and then. It should only be used for sneak-peaks and - discussions of the new features and designs. -- Once v0.10 is ready for real-life use, it will be merged into the master - branch (which is the reason why you should lock your dependency management - tool to v0.9.x and only migrate to v0.10 when both you and v0.10 are ready - for it). In the ideal case, v0.10 will be the basis for the future v1.0 - release, but we cannot provide an ETA at this time. - -## Instrumenting applications - -[![code-coverage](http://gocover.io/_badge/github.com/prometheus/client_golang/prometheus)](http://gocover.io/github.com/prometheus/client_golang/prometheus) [![go-doc](https://godoc.org/github.com/prometheus/client_golang/prometheus?status.svg)](https://godoc.org/github.com/prometheus/client_golang/prometheus) - -The -[`prometheus` directory](https://github.com/prometheus/client_golang/tree/master/prometheus) -contains the instrumentation library. See the -[guide](https://prometheus.io/docs/guides/go-application/) on the Prometheus -website to learn more about instrumenting applications. - -The -[`examples` directory](https://github.com/prometheus/client_golang/tree/master/examples) -contains simple examples of instrumented code. - -## Client for the Prometheus HTTP API - -[![code-coverage](http://gocover.io/_badge/github.com/prometheus/client_golang/api/prometheus/v1)](http://gocover.io/github.com/prometheus/client_golang/api/prometheus/v1) [![go-doc](https://godoc.org/github.com/prometheus/client_golang/api/prometheus?status.svg)](https://godoc.org/github.com/prometheus/client_golang/api) - -The -[`api/prometheus` directory](https://github.com/prometheus/client_golang/tree/master/api/prometheus) -contains the client for the -[Prometheus HTTP API](http://prometheus.io/docs/querying/api/). It allows you -to write Go applications that query time series data from a Prometheus -server. It is still in alpha stage. - -## Where is `model`, `extraction`, and `text`? - -The `model` packages has been moved to -[`prometheus/common/model`](https://github.com/prometheus/common/tree/master/model). - -The `extraction` and `text` packages are now contained in -[`prometheus/common/expfmt`](https://github.com/prometheus/common/tree/master/expfmt). - -## Contributing and community - -See the [contributing guidelines](CONTRIBUTING.md) and the -[Community section](http://prometheus.io/community/) of the homepage. diff --git a/vendor/github.com/prometheus/client_golang/VERSION b/vendor/github.com/prometheus/client_golang/VERSION deleted file mode 100644 index ac39a106c..000000000 --- a/vendor/github.com/prometheus/client_golang/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.9.0 diff --git a/vendor/github.com/prometheus/client_golang/api/client.go b/vendor/github.com/prometheus/client_golang/api/client.go deleted file mode 100644 index 09af749ca..000000000 --- a/vendor/github.com/prometheus/client_golang/api/client.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2015 The Prometheus 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. - -// +build go1.7 - -// Package api provides clients for the HTTP APIs. -package api - -import ( - "context" - "io/ioutil" - "net" - "net/http" - "net/url" - "path" - "strings" - "time" -) - -// DefaultRoundTripper is used if no RoundTripper is set in Config. -var DefaultRoundTripper http.RoundTripper = &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }).DialContext, - TLSHandshakeTimeout: 10 * time.Second, -} - -// Config defines configuration parameters for a new client. -type Config struct { - // The address of the Prometheus to connect to. - Address string - - // RoundTripper is used by the Client to drive HTTP requests. If not - // provided, DefaultRoundTripper will be used. - RoundTripper http.RoundTripper -} - -func (cfg *Config) roundTripper() http.RoundTripper { - if cfg.RoundTripper == nil { - return DefaultRoundTripper - } - return cfg.RoundTripper -} - -// Client is the interface for an API client. -type Client interface { - URL(ep string, args map[string]string) *url.URL - Do(context.Context, *http.Request) (*http.Response, []byte, error) -} - -// NewClient returns a new Client. -// -// It is safe to use the returned Client from multiple goroutines. -func NewClient(cfg Config) (Client, error) { - u, err := url.Parse(cfg.Address) - if err != nil { - return nil, err - } - u.Path = strings.TrimRight(u.Path, "/") - - return &httpClient{ - endpoint: u, - client: http.Client{Transport: cfg.roundTripper()}, - }, nil -} - -type httpClient struct { - endpoint *url.URL - client http.Client -} - -func (c *httpClient) URL(ep string, args map[string]string) *url.URL { - p := path.Join(c.endpoint.Path, ep) - - for arg, val := range args { - arg = ":" + arg - p = strings.Replace(p, arg, val, -1) - } - - u := *c.endpoint - u.Path = p - - return &u -} - -func (c *httpClient) Do(ctx context.Context, req *http.Request) (*http.Response, []byte, error) { - if ctx != nil { - req = req.WithContext(ctx) - } - resp, err := c.client.Do(req) - defer func() { - if resp != nil { - resp.Body.Close() - } - }() - - if err != nil { - return nil, nil, err - } - - var body []byte - done := make(chan struct{}) - go func() { - body, err = ioutil.ReadAll(resp.Body) - close(done) - }() - - select { - case <-ctx.Done(): - err = resp.Body.Close() - <-done - if err == nil { - err = ctx.Err() - } - case <-done: - } - - return resp, body, err -} diff --git a/vendor/github.com/prometheus/client_golang/api/client_test.go b/vendor/github.com/prometheus/client_golang/api/client_test.go deleted file mode 100644 index b1bcfc9b8..000000000 --- a/vendor/github.com/prometheus/client_golang/api/client_test.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2015 The Prometheus 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. - -// +build go1.7 - -package api - -import ( - "net/http" - "net/url" - "testing" -) - -func TestConfig(t *testing.T) { - c := Config{} - if c.roundTripper() != DefaultRoundTripper { - t.Fatalf("expected default roundtripper for nil RoundTripper field") - } -} - -func TestClientURL(t *testing.T) { - tests := []struct { - address string - endpoint string - args map[string]string - expected string - }{ - { - address: "http://localhost:9090", - endpoint: "/test", - expected: "http://localhost:9090/test", - }, - { - address: "http://localhost", - endpoint: "/test", - expected: "http://localhost/test", - }, - { - address: "http://localhost:9090", - endpoint: "test", - expected: "http://localhost:9090/test", - }, - { - address: "http://localhost:9090/prefix", - endpoint: "/test", - expected: "http://localhost:9090/prefix/test", - }, - { - address: "https://localhost:9090/", - endpoint: "/test/", - expected: "https://localhost:9090/test", - }, - { - address: "http://localhost:9090", - endpoint: "/test/:param", - args: map[string]string{ - "param": "content", - }, - expected: "http://localhost:9090/test/content", - }, - { - address: "http://localhost:9090", - endpoint: "/test/:param/more/:param", - args: map[string]string{ - "param": "content", - }, - expected: "http://localhost:9090/test/content/more/content", - }, - { - address: "http://localhost:9090", - endpoint: "/test/:param/more/:foo", - args: map[string]string{ - "param": "content", - "foo": "bar", - }, - expected: "http://localhost:9090/test/content/more/bar", - }, - { - address: "http://localhost:9090", - endpoint: "/test/:param", - args: map[string]string{ - "nonexistent": "content", - }, - expected: "http://localhost:9090/test/:param", - }, - } - - for _, test := range tests { - ep, err := url.Parse(test.address) - if err != nil { - t.Fatal(err) - } - - hclient := &httpClient{ - endpoint: ep, - client: http.Client{Transport: DefaultRoundTripper}, - } - - u := hclient.URL(test.endpoint, test.args) - if u.String() != test.expected { - t.Errorf("unexpected result: got %s, want %s", u, test.expected) - continue - } - } -} diff --git a/vendor/github.com/prometheus/client_golang/api/prometheus/v1/api.go b/vendor/github.com/prometheus/client_golang/api/prometheus/v1/api.go deleted file mode 100644 index 6a19fac12..000000000 --- a/vendor/github.com/prometheus/client_golang/api/prometheus/v1/api.go +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright 2017 The Prometheus 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. - -// +build go1.7 - -// Package v1 provides bindings to the Prometheus HTTP API v1: -// http://prometheus.io/docs/querying/api/ -package v1 - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - "strconv" - "time" - - "github.com/prometheus/client_golang/api" - "github.com/prometheus/common/model" -) - -const ( - statusAPIError = 422 - - apiPrefix = "/api/v1" - - epAlertManagers = apiPrefix + "/alertmanagers" - epQuery = apiPrefix + "/query" - epQueryRange = apiPrefix + "/query_range" - epLabelValues = apiPrefix + "/label/:name/values" - epSeries = apiPrefix + "/series" - epTargets = apiPrefix + "/targets" - epSnapshot = apiPrefix + "/admin/tsdb/snapshot" - epDeleteSeries = apiPrefix + "/admin/tsdb/delete_series" - epCleanTombstones = apiPrefix + "/admin/tsdb/clean_tombstones" - epConfig = apiPrefix + "/status/config" - epFlags = apiPrefix + "/status/flags" -) - -// ErrorType models the different API error types. -type ErrorType string - -// HealthStatus models the health status of a scrape target. -type HealthStatus string - -const ( - // Possible values for ErrorType. - ErrBadData ErrorType = "bad_data" - ErrTimeout = "timeout" - ErrCanceled = "canceled" - ErrExec = "execution" - ErrBadResponse = "bad_response" - - // Possible values for HealthStatus. - HealthGood HealthStatus = "up" - HealthUnknown HealthStatus = "unknown" - HealthBad HealthStatus = "down" -) - -// Error is an error returned by the API. -type Error struct { - Type ErrorType - Msg string -} - -func (e *Error) Error() string { - return fmt.Sprintf("%s: %s", e.Type, e.Msg) -} - -// Range represents a sliced time range. -type Range struct { - // The boundaries of the time range. - Start, End time.Time - // The maximum time between two slices within the boundaries. - Step time.Duration -} - -// API provides bindings for Prometheus's v1 API. -type API interface { - // AlertManagers returns an overview of the current state of the Prometheus alert manager discovery. - AlertManagers(ctx context.Context) (AlertManagersResult, error) - // CleanTombstones removes the deleted data from disk and cleans up the existing tombstones. - CleanTombstones(ctx context.Context) error - // Config returns the current Prometheus configuration. - Config(ctx context.Context) (ConfigResult, error) - // DeleteSeries deletes data for a selection of series in a time range. - DeleteSeries(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) error - // Flags returns the flag values that Prometheus was launched with. - Flags(ctx context.Context) (FlagsResult, error) - // LabelValues performs a query for the values of the given label. - LabelValues(ctx context.Context, label string) (model.LabelValues, error) - // Query performs a query for the given time. - Query(ctx context.Context, query string, ts time.Time) (model.Value, error) - // QueryRange performs a query for the given range. - QueryRange(ctx context.Context, query string, r Range) (model.Value, error) - // Series finds series by label matchers. - Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]model.LabelSet, error) - // Snapshot creates a snapshot of all current data into snapshots/- - // under the TSDB's data directory and returns the directory as response. - Snapshot(ctx context.Context, skipHead bool) (SnapshotResult, error) - // Targets returns an overview of the current state of the Prometheus target discovery. - Targets(ctx context.Context) (TargetsResult, error) -} - -// AlertManagersResult contains the result from querying the alertmanagers endpoint. -type AlertManagersResult struct { - Active []AlertManager `json:"activeAlertManagers"` - Dropped []AlertManager `json:"droppedAlertManagers"` -} - -// AlertManager models a configured Alert Manager. -type AlertManager struct { - URL string `json:"url"` -} - -// ConfigResult contains the result from querying the config endpoint. -type ConfigResult struct { - YAML string `json:"yaml"` -} - -// FlagsResult contains the result from querying the flag endpoint. -type FlagsResult map[string]string - -// SnapshotResult contains the result from querying the snapshot endpoint. -type SnapshotResult struct { - Name string `json:"name"` -} - -// TargetsResult contains the result from querying the targets endpoint. -type TargetsResult struct { - Active []ActiveTarget `json:"activeTargets"` - Dropped []DroppedTarget `json:"droppedTargets"` -} - -// ActiveTarget models an active Prometheus scrape target. -type ActiveTarget struct { - DiscoveredLabels model.LabelSet `json:"discoveredLabels"` - Labels model.LabelSet `json:"labels"` - ScrapeURL string `json:"scrapeUrl"` - LastError string `json:"lastError"` - LastScrape time.Time `json:"lastScrape"` - Health HealthStatus `json:"health"` -} - -// DroppedTarget models a dropped Prometheus scrape target. -type DroppedTarget struct { - DiscoveredLabels model.LabelSet `json:"discoveredLabels"` -} - -// queryResult contains result data for a query. -type queryResult struct { - Type model.ValueType `json:"resultType"` - Result interface{} `json:"result"` - - // The decoded value. - v model.Value -} - -func (qr *queryResult) UnmarshalJSON(b []byte) error { - v := struct { - Type model.ValueType `json:"resultType"` - Result json.RawMessage `json:"result"` - }{} - - err := json.Unmarshal(b, &v) - if err != nil { - return err - } - - switch v.Type { - case model.ValScalar: - var sv model.Scalar - err = json.Unmarshal(v.Result, &sv) - qr.v = &sv - - case model.ValVector: - var vv model.Vector - err = json.Unmarshal(v.Result, &vv) - qr.v = vv - - case model.ValMatrix: - var mv model.Matrix - err = json.Unmarshal(v.Result, &mv) - qr.v = mv - - default: - err = fmt.Errorf("unexpected value type %q", v.Type) - } - return err -} - -// NewAPI returns a new API for the client. -// -// It is safe to use the returned API from multiple goroutines. -func NewAPI(c api.Client) API { - return &httpAPI{client: apiClient{c}} -} - -type httpAPI struct { - client api.Client -} - -func (h *httpAPI) AlertManagers(ctx context.Context) (AlertManagersResult, error) { - u := h.client.URL(epAlertManagers, nil) - - req, err := http.NewRequest(http.MethodGet, u.String(), nil) - if err != nil { - return AlertManagersResult{}, err - } - - _, body, err := h.client.Do(ctx, req) - if err != nil { - return AlertManagersResult{}, err - } - - var res AlertManagersResult - err = json.Unmarshal(body, &res) - return res, err -} - -func (h *httpAPI) CleanTombstones(ctx context.Context) error { - u := h.client.URL(epCleanTombstones, nil) - - req, err := http.NewRequest(http.MethodPost, u.String(), nil) - if err != nil { - return err - } - - _, _, err = h.client.Do(ctx, req) - return err -} - -func (h *httpAPI) Config(ctx context.Context) (ConfigResult, error) { - u := h.client.URL(epConfig, nil) - - req, err := http.NewRequest(http.MethodGet, u.String(), nil) - if err != nil { - return ConfigResult{}, err - } - - _, body, err := h.client.Do(ctx, req) - if err != nil { - return ConfigResult{}, err - } - - var res ConfigResult - err = json.Unmarshal(body, &res) - return res, err -} - -func (h *httpAPI) DeleteSeries(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) error { - u := h.client.URL(epDeleteSeries, nil) - q := u.Query() - - for _, m := range matches { - q.Add("match[]", m) - } - - q.Set("start", startTime.Format(time.RFC3339Nano)) - q.Set("end", endTime.Format(time.RFC3339Nano)) - - u.RawQuery = q.Encode() - - req, err := http.NewRequest(http.MethodPost, u.String(), nil) - if err != nil { - return err - } - - _, _, err = h.client.Do(ctx, req) - return err -} - -func (h *httpAPI) Flags(ctx context.Context) (FlagsResult, error) { - u := h.client.URL(epFlags, nil) - - req, err := http.NewRequest(http.MethodGet, u.String(), nil) - if err != nil { - return FlagsResult{}, err - } - - _, body, err := h.client.Do(ctx, req) - if err != nil { - return FlagsResult{}, err - } - - var res FlagsResult - err = json.Unmarshal(body, &res) - return res, err -} - -func (h *httpAPI) LabelValues(ctx context.Context, label string) (model.LabelValues, error) { - u := h.client.URL(epLabelValues, map[string]string{"name": label}) - req, err := http.NewRequest(http.MethodGet, u.String(), nil) - if err != nil { - return nil, err - } - _, body, err := h.client.Do(ctx, req) - if err != nil { - return nil, err - } - var labelValues model.LabelValues - err = json.Unmarshal(body, &labelValues) - return labelValues, err -} - -func (h *httpAPI) Query(ctx context.Context, query string, ts time.Time) (model.Value, error) { - u := h.client.URL(epQuery, nil) - q := u.Query() - - q.Set("query", query) - if !ts.IsZero() { - q.Set("time", ts.Format(time.RFC3339Nano)) - } - - u.RawQuery = q.Encode() - - req, err := http.NewRequest(http.MethodGet, u.String(), nil) - if err != nil { - return nil, err - } - - _, body, err := h.client.Do(ctx, req) - if err != nil { - return nil, err - } - - var qres queryResult - err = json.Unmarshal(body, &qres) - - return model.Value(qres.v), err -} - -func (h *httpAPI) QueryRange(ctx context.Context, query string, r Range) (model.Value, error) { - u := h.client.URL(epQueryRange, nil) - q := u.Query() - - var ( - start = r.Start.Format(time.RFC3339Nano) - end = r.End.Format(time.RFC3339Nano) - step = strconv.FormatFloat(r.Step.Seconds(), 'f', 3, 64) - ) - - q.Set("query", query) - q.Set("start", start) - q.Set("end", end) - q.Set("step", step) - - u.RawQuery = q.Encode() - - req, err := http.NewRequest(http.MethodGet, u.String(), nil) - if err != nil { - return nil, err - } - - _, body, err := h.client.Do(ctx, req) - if err != nil { - return nil, err - } - - var qres queryResult - err = json.Unmarshal(body, &qres) - - return model.Value(qres.v), err -} - -func (h *httpAPI) Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]model.LabelSet, error) { - u := h.client.URL(epSeries, nil) - q := u.Query() - - for _, m := range matches { - q.Add("match[]", m) - } - - q.Set("start", startTime.Format(time.RFC3339Nano)) - q.Set("end", endTime.Format(time.RFC3339Nano)) - - u.RawQuery = q.Encode() - - req, err := http.NewRequest(http.MethodGet, u.String(), nil) - if err != nil { - return nil, err - } - - _, body, err := h.client.Do(ctx, req) - if err != nil { - return nil, err - } - - var mset []model.LabelSet - err = json.Unmarshal(body, &mset) - return mset, err -} - -func (h *httpAPI) Snapshot(ctx context.Context, skipHead bool) (SnapshotResult, error) { - u := h.client.URL(epSnapshot, nil) - q := u.Query() - - q.Set("skip_head", strconv.FormatBool(skipHead)) - - u.RawQuery = q.Encode() - - req, err := http.NewRequest(http.MethodPost, u.String(), nil) - if err != nil { - return SnapshotResult{}, err - } - - _, body, err := h.client.Do(ctx, req) - if err != nil { - return SnapshotResult{}, err - } - - var res SnapshotResult - err = json.Unmarshal(body, &res) - return res, err -} - -func (h *httpAPI) Targets(ctx context.Context) (TargetsResult, error) { - u := h.client.URL(epTargets, nil) - - req, err := http.NewRequest(http.MethodGet, u.String(), nil) - if err != nil { - return TargetsResult{}, err - } - - _, body, err := h.client.Do(ctx, req) - if err != nil { - return TargetsResult{}, err - } - - var res TargetsResult - err = json.Unmarshal(body, &res) - return res, err -} - -// apiClient wraps a regular client and processes successful API responses. -// Successful also includes responses that errored at the API level. -type apiClient struct { - api.Client -} - -type apiResponse struct { - Status string `json:"status"` - Data json.RawMessage `json:"data"` - ErrorType ErrorType `json:"errorType"` - Error string `json:"error"` -} - -func apiError(code int) bool { - // These are the codes that Prometheus sends when it returns an error. - return code == statusAPIError || code == http.StatusBadRequest -} - -func (c apiClient) Do(ctx context.Context, req *http.Request) (*http.Response, []byte, error) { - resp, body, err := c.Client.Do(ctx, req) - if err != nil { - return resp, body, err - } - - code := resp.StatusCode - - if code/100 != 2 && !apiError(code) { - return resp, body, &Error{ - Type: ErrBadResponse, - Msg: fmt.Sprintf("bad response code %d", resp.StatusCode), - } - } - - var result apiResponse - - if http.StatusNoContent != code { - if err = json.Unmarshal(body, &result); err != nil { - return resp, body, &Error{ - Type: ErrBadResponse, - Msg: err.Error(), - } - } - } - - if apiError(code) != (result.Status == "error") { - err = &Error{ - Type: ErrBadResponse, - Msg: "inconsistent body for response code", - } - } - - if apiError(code) && result.Status == "error" { - err = &Error{ - Type: result.ErrorType, - Msg: result.Error, - } - } - - return resp, []byte(result.Data), err -} diff --git a/vendor/github.com/prometheus/client_golang/api/prometheus/v1/api_test.go b/vendor/github.com/prometheus/client_golang/api/prometheus/v1/api_test.go deleted file mode 100644 index 1f7fda7f9..000000000 --- a/vendor/github.com/prometheus/client_golang/api/prometheus/v1/api_test.go +++ /dev/null @@ -1,706 +0,0 @@ -// Copyright 2017 The Prometheus 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. - -// +build go1.7 - -package v1 - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - "net/url" - "reflect" - "strings" - "testing" - "time" - - "github.com/prometheus/common/model" -) - -type apiTest struct { - do func() (interface{}, error) - inErr error - inRes interface{} - - reqPath string - reqParam url.Values - reqMethod string - res interface{} - err error -} - -type apiTestClient struct { - *testing.T - curTest apiTest -} - -func (c *apiTestClient) URL(ep string, args map[string]string) *url.URL { - path := ep - for k, v := range args { - path = strings.Replace(path, ":"+k, v, -1) - } - u := &url.URL{ - Host: "test:9090", - Path: path, - } - return u -} - -func (c *apiTestClient) Do(ctx context.Context, req *http.Request) (*http.Response, []byte, error) { - - test := c.curTest - - if req.URL.Path != test.reqPath { - c.Errorf("unexpected request path: want %s, got %s", test.reqPath, req.URL.Path) - } - if req.Method != test.reqMethod { - c.Errorf("unexpected request method: want %s, got %s", test.reqMethod, req.Method) - } - - b, err := json.Marshal(test.inRes) - if err != nil { - c.Fatal(err) - } - - resp := &http.Response{} - if test.inErr != nil { - resp.StatusCode = statusAPIError - } else { - resp.StatusCode = http.StatusOK - } - - return resp, b, test.inErr -} - -func TestAPIs(t *testing.T) { - - testTime := time.Now() - - client := &apiTestClient{T: t} - - promAPI := &httpAPI{ - client: client, - } - - doAlertManagers := func() func() (interface{}, error) { - return func() (interface{}, error) { - return promAPI.AlertManagers(context.Background()) - } - } - - doCleanTombstones := func() func() (interface{}, error) { - return func() (interface{}, error) { - return nil, promAPI.CleanTombstones(context.Background()) - } - } - - doConfig := func() func() (interface{}, error) { - return func() (interface{}, error) { - return promAPI.Config(context.Background()) - } - } - - doDeleteSeries := func(matcher string, startTime time.Time, endTime time.Time) func() (interface{}, error) { - return func() (interface{}, error) { - return nil, promAPI.DeleteSeries(context.Background(), []string{matcher}, startTime, endTime) - } - } - - doFlags := func() func() (interface{}, error) { - return func() (interface{}, error) { - return promAPI.Flags(context.Background()) - } - } - - doLabelValues := func(label string) func() (interface{}, error) { - return func() (interface{}, error) { - return promAPI.LabelValues(context.Background(), label) - } - } - - doQuery := func(q string, ts time.Time) func() (interface{}, error) { - return func() (interface{}, error) { - return promAPI.Query(context.Background(), q, ts) - } - } - - doQueryRange := func(q string, rng Range) func() (interface{}, error) { - return func() (interface{}, error) { - return promAPI.QueryRange(context.Background(), q, rng) - } - } - - doSeries := func(matcher string, startTime time.Time, endTime time.Time) func() (interface{}, error) { - return func() (interface{}, error) { - return promAPI.Series(context.Background(), []string{matcher}, startTime, endTime) - } - } - - doSnapshot := func(skipHead bool) func() (interface{}, error) { - return func() (interface{}, error) { - return promAPI.Snapshot(context.Background(), skipHead) - } - } - - doTargets := func() func() (interface{}, error) { - return func() (interface{}, error) { - return promAPI.Targets(context.Background()) - } - } - - queryTests := []apiTest{ - { - do: doQuery("2", testTime), - inRes: &queryResult{ - Type: model.ValScalar, - Result: &model.Scalar{ - Value: 2, - Timestamp: model.TimeFromUnix(testTime.Unix()), - }, - }, - - reqMethod: "GET", - reqPath: "/api/v1/query", - reqParam: url.Values{ - "query": []string{"2"}, - "time": []string{testTime.Format(time.RFC3339Nano)}, - }, - res: &model.Scalar{ - Value: 2, - Timestamp: model.TimeFromUnix(testTime.Unix()), - }, - }, - { - do: doQuery("2", testTime), - inErr: fmt.Errorf("some error"), - - reqMethod: "GET", - reqPath: "/api/v1/query", - reqParam: url.Values{ - "query": []string{"2"}, - "time": []string{testTime.Format(time.RFC3339Nano)}, - }, - err: fmt.Errorf("some error"), - }, - - { - do: doQueryRange("2", Range{ - Start: testTime.Add(-time.Minute), - End: testTime, - Step: time.Minute, - }), - inErr: fmt.Errorf("some error"), - - reqMethod: "GET", - reqPath: "/api/v1/query_range", - reqParam: url.Values{ - "query": []string{"2"}, - "start": []string{testTime.Add(-time.Minute).Format(time.RFC3339Nano)}, - "end": []string{testTime.Format(time.RFC3339Nano)}, - "step": []string{time.Minute.String()}, - }, - err: fmt.Errorf("some error"), - }, - - { - do: doLabelValues("mylabel"), - inRes: []string{"val1", "val2"}, - reqMethod: "GET", - reqPath: "/api/v1/label/mylabel/values", - res: model.LabelValues{"val1", "val2"}, - }, - - { - do: doLabelValues("mylabel"), - inErr: fmt.Errorf("some error"), - reqMethod: "GET", - reqPath: "/api/v1/label/mylabel/values", - err: fmt.Errorf("some error"), - }, - - { - do: doSeries("up", testTime.Add(-time.Minute), testTime), - inRes: []map[string]string{ - { - "__name__": "up", - "job": "prometheus", - "instance": "localhost:9090"}, - }, - reqMethod: "GET", - reqPath: "/api/v1/series", - reqParam: url.Values{ - "match": []string{"up"}, - "start": []string{testTime.Add(-time.Minute).Format(time.RFC3339Nano)}, - "end": []string{testTime.Format(time.RFC3339Nano)}, - }, - res: []model.LabelSet{ - model.LabelSet{ - "__name__": "up", - "job": "prometheus", - "instance": "localhost:9090", - }, - }, - }, - - { - do: doSeries("up", testTime.Add(-time.Minute), testTime), - inErr: fmt.Errorf("some error"), - reqMethod: "GET", - reqPath: "/api/v1/series", - reqParam: url.Values{ - "match": []string{"up"}, - "start": []string{testTime.Add(-time.Minute).Format(time.RFC3339Nano)}, - "end": []string{testTime.Format(time.RFC3339Nano)}, - }, - err: fmt.Errorf("some error"), - }, - - { - do: doSnapshot(true), - inRes: map[string]string{ - "name": "20171210T211224Z-2be650b6d019eb54", - }, - reqMethod: "POST", - reqPath: "/api/v1/admin/tsdb/snapshot", - reqParam: url.Values{ - "skip_head": []string{"true"}, - }, - res: SnapshotResult{ - Name: "20171210T211224Z-2be650b6d019eb54", - }, - }, - - { - do: doSnapshot(true), - inErr: fmt.Errorf("some error"), - reqMethod: "POST", - reqPath: "/api/v1/admin/tsdb/snapshot", - err: fmt.Errorf("some error"), - }, - - { - do: doCleanTombstones(), - reqMethod: "POST", - reqPath: "/api/v1/admin/tsdb/clean_tombstones", - }, - - { - do: doCleanTombstones(), - inErr: fmt.Errorf("some error"), - reqMethod: "POST", - reqPath: "/api/v1/admin/tsdb/clean_tombstones", - err: fmt.Errorf("some error"), - }, - - { - do: doDeleteSeries("up", testTime.Add(-time.Minute), testTime), - inRes: []map[string]string{ - { - "__name__": "up", - "job": "prometheus", - "instance": "localhost:9090"}, - }, - reqMethod: "POST", - reqPath: "/api/v1/admin/tsdb/delete_series", - reqParam: url.Values{ - "match": []string{"up"}, - "start": []string{testTime.Add(-time.Minute).Format(time.RFC3339Nano)}, - "end": []string{testTime.Format(time.RFC3339Nano)}, - }, - }, - - { - do: doDeleteSeries("up", testTime.Add(-time.Minute), testTime), - inErr: fmt.Errorf("some error"), - reqMethod: "POST", - reqPath: "/api/v1/admin/tsdb/delete_series", - reqParam: url.Values{ - "match": []string{"up"}, - "start": []string{testTime.Add(-time.Minute).Format(time.RFC3339Nano)}, - "end": []string{testTime.Format(time.RFC3339Nano)}, - }, - err: fmt.Errorf("some error"), - }, - - { - do: doConfig(), - reqMethod: "GET", - reqPath: "/api/v1/status/config", - inRes: map[string]string{ - "yaml": "", - }, - res: ConfigResult{ - YAML: "", - }, - }, - - { - do: doConfig(), - reqMethod: "GET", - reqPath: "/api/v1/status/config", - inErr: fmt.Errorf("some error"), - err: fmt.Errorf("some error"), - }, - - { - do: doFlags(), - reqMethod: "GET", - reqPath: "/api/v1/status/flags", - inRes: map[string]string{ - "alertmanager.notification-queue-capacity": "10000", - "alertmanager.timeout": "10s", - "log.level": "info", - "query.lookback-delta": "5m", - "query.max-concurrency": "20", - }, - res: FlagsResult{ - "alertmanager.notification-queue-capacity": "10000", - "alertmanager.timeout": "10s", - "log.level": "info", - "query.lookback-delta": "5m", - "query.max-concurrency": "20", - }, - }, - - { - do: doFlags(), - reqMethod: "GET", - reqPath: "/api/v1/status/flags", - inErr: fmt.Errorf("some error"), - err: fmt.Errorf("some error"), - }, - - { - do: doAlertManagers(), - reqMethod: "GET", - reqPath: "/api/v1/alertmanagers", - inRes: map[string]interface{}{ - "activeAlertManagers": []map[string]string{ - { - "url": "http://127.0.0.1:9091/api/v1/alerts", - }, - }, - "droppedAlertManagers": []map[string]string{ - { - "url": "http://127.0.0.1:9092/api/v1/alerts", - }, - }, - }, - res: AlertManagersResult{ - Active: []AlertManager{ - { - URL: "http://127.0.0.1:9091/api/v1/alerts", - }, - }, - Dropped: []AlertManager{ - { - URL: "http://127.0.0.1:9092/api/v1/alerts", - }, - }, - }, - }, - - { - do: doAlertManagers(), - reqMethod: "GET", - reqPath: "/api/v1/alertmanagers", - inErr: fmt.Errorf("some error"), - err: fmt.Errorf("some error"), - }, - - { - do: doTargets(), - reqMethod: "GET", - reqPath: "/api/v1/targets", - inRes: map[string]interface{}{ - "activeTargets": []map[string]interface{}{ - { - "discoveredLabels": map[string]string{ - "__address__": "127.0.0.1:9090", - "__metrics_path__": "/metrics", - "__scheme__": "http", - "job": "prometheus", - }, - "labels": map[string]string{ - "instance": "127.0.0.1:9090", - "job": "prometheus", - }, - "scrapeUrl": "http://127.0.0.1:9090", - "lastError": "error while scraping target", - "lastScrape": testTime.UTC().Format(time.RFC3339Nano), - "health": "up", - }, - }, - "droppedTargets": []map[string]interface{}{ - { - "discoveredLabels": map[string]string{ - "__address__": "127.0.0.1:9100", - "__metrics_path__": "/metrics", - "__scheme__": "http", - "job": "node", - }, - }, - }, - }, - res: TargetsResult{ - Active: []ActiveTarget{ - { - DiscoveredLabels: model.LabelSet{ - "__address__": "127.0.0.1:9090", - "__metrics_path__": "/metrics", - "__scheme__": "http", - "job": "prometheus", - }, - Labels: model.LabelSet{ - "instance": "127.0.0.1:9090", - "job": "prometheus", - }, - ScrapeURL: "http://127.0.0.1:9090", - LastError: "error while scraping target", - LastScrape: testTime.UTC(), - Health: HealthGood, - }, - }, - Dropped: []DroppedTarget{ - { - DiscoveredLabels: model.LabelSet{ - "__address__": "127.0.0.1:9100", - "__metrics_path__": "/metrics", - "__scheme__": "http", - "job": "node", - }, - }, - }, - }, - }, - - { - do: doTargets(), - reqMethod: "GET", - reqPath: "/api/v1/targets", - inErr: fmt.Errorf("some error"), - err: fmt.Errorf("some error"), - }, - } - - var tests []apiTest - tests = append(tests, queryTests...) - - for _, test := range tests { - client.curTest = test - - res, err := test.do() - - if test.err != nil { - if err == nil { - t.Errorf("expected error %q but got none", test.err) - continue - } - if err.Error() != test.err.Error() { - t.Errorf("unexpected error: want %s, got %s", test.err, err) - } - continue - } - if err != nil { - t.Errorf("unexpected error: %s", err) - continue - } - - if !reflect.DeepEqual(res, test.res) { - t.Errorf("unexpected result: want %v, got %v", test.res, res) - } - } -} - -type testClient struct { - *testing.T - - ch chan apiClientTest - req *http.Request -} - -type apiClientTest struct { - code int - response interface{} - expected string - err *Error -} - -func (c *testClient) URL(ep string, args map[string]string) *url.URL { - return nil -} - -func (c *testClient) Do(ctx context.Context, req *http.Request) (*http.Response, []byte, error) { - if ctx == nil { - c.Fatalf("context was not passed down") - } - if req != c.req { - c.Fatalf("request was not passed down") - } - - test := <-c.ch - - var b []byte - var err error - - switch v := test.response.(type) { - case string: - b = []byte(v) - default: - b, err = json.Marshal(v) - if err != nil { - c.Fatal(err) - } - } - - resp := &http.Response{ - StatusCode: test.code, - } - - return resp, b, nil -} - -func TestAPIClientDo(t *testing.T) { - tests := []apiClientTest{ - { - response: &apiResponse{ - Status: "error", - Data: json.RawMessage(`null`), - ErrorType: ErrBadData, - Error: "failed", - }, - err: &Error{ - Type: ErrBadData, - Msg: "failed", - }, - code: statusAPIError, - expected: `null`, - }, - { - response: &apiResponse{ - Status: "error", - Data: json.RawMessage(`"test"`), - ErrorType: ErrTimeout, - Error: "timed out", - }, - err: &Error{ - Type: ErrTimeout, - Msg: "timed out", - }, - code: statusAPIError, - expected: `test`, - }, - { - response: "bad json", - err: &Error{ - Type: ErrBadResponse, - Msg: "bad response code 500", - }, - code: http.StatusInternalServerError, - }, - { - response: &apiResponse{ - Status: "error", - Data: json.RawMessage(`null`), - ErrorType: ErrBadData, - Error: "end timestamp must not be before start time", - }, - err: &Error{ - Type: ErrBadData, - Msg: "end timestamp must not be before start time", - }, - code: http.StatusBadRequest, - }, - { - response: "bad json", - err: &Error{ - Type: ErrBadResponse, - Msg: "invalid character 'b' looking for beginning of value", - }, - code: statusAPIError, - }, - { - response: &apiResponse{ - Status: "success", - Data: json.RawMessage(`"test"`), - }, - err: &Error{ - Type: ErrBadResponse, - Msg: "inconsistent body for response code", - }, - code: statusAPIError, - }, - { - response: &apiResponse{ - Status: "success", - Data: json.RawMessage(`"test"`), - ErrorType: ErrTimeout, - Error: "timed out", - }, - err: &Error{ - Type: ErrBadResponse, - Msg: "inconsistent body for response code", - }, - code: statusAPIError, - }, - { - response: &apiResponse{ - Status: "error", - Data: json.RawMessage(`"test"`), - ErrorType: ErrTimeout, - Error: "timed out", - }, - err: &Error{ - Type: ErrBadResponse, - Msg: "inconsistent body for response code", - }, - code: http.StatusOK, - }, - } - - tc := &testClient{ - T: t, - ch: make(chan apiClientTest, 1), - req: &http.Request{}, - } - client := &apiClient{tc} - - for _, test := range tests { - - tc.ch <- test - - _, body, err := client.Do(context.Background(), tc.req) - - if test.err != nil { - if err == nil { - t.Errorf("expected error %q but got none", test.err) - continue - } - if test.err.Error() != err.Error() { - t.Errorf("unexpected error: want %q, got %q", test.err, err) - } - continue - } - if err != nil { - t.Errorf("unexpeceted error %s", err) - continue - } - - want, got := test.expected, string(body) - if want != got { - t.Errorf("unexpected body: want %q, got %q", want, got) - } - } -} diff --git a/vendor/github.com/prometheus/client_golang/examples/random/main.go b/vendor/github.com/prometheus/client_golang/examples/random/main.go deleted file mode 100644 index eef50d200..000000000 --- a/vendor/github.com/prometheus/client_golang/examples/random/main.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2015 The Prometheus 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. - -// A simple example exposing fictional RPC latencies with different types of -// random distributions (uniform, normal, and exponential) as Prometheus -// metrics. -package main - -import ( - "flag" - "log" - "math" - "math/rand" - "net/http" - "time" - - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" -) - -var ( - addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.") - uniformDomain = flag.Float64("uniform.domain", 0.0002, "The domain for the uniform distribution.") - normDomain = flag.Float64("normal.domain", 0.0002, "The domain for the normal distribution.") - normMean = flag.Float64("normal.mean", 0.00001, "The mean for the normal distribution.") - oscillationPeriod = flag.Duration("oscillation-period", 10*time.Minute, "The duration of the rate oscillation period.") -) - -var ( - // Create a summary to track fictional interservice RPC latencies for three - // distinct services with different latency distributions. These services are - // differentiated via a "service" label. - rpcDurations = prometheus.NewSummaryVec( - prometheus.SummaryOpts{ - Name: "rpc_durations_seconds", - Help: "RPC latency distributions.", - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - []string{"service"}, - ) - // The same as above, but now as a histogram, and only for the normal - // distribution. The buckets are targeted to the parameters of the - // normal distribution, with 20 buckets centered on the mean, each - // half-sigma wide. - rpcDurationsHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{ - Name: "rpc_durations_histogram_seconds", - Help: "RPC latency distributions.", - Buckets: prometheus.LinearBuckets(*normMean-5**normDomain, .5**normDomain, 20), - }) -) - -func init() { - // Register the summary and the histogram with Prometheus's default registry. - prometheus.MustRegister(rpcDurations) - prometheus.MustRegister(rpcDurationsHistogram) -} - -func main() { - flag.Parse() - - start := time.Now() - - oscillationFactor := func() float64 { - return 2 + math.Sin(math.Sin(2*math.Pi*float64(time.Since(start))/float64(*oscillationPeriod))) - } - - // Periodically record some sample latencies for the three services. - go func() { - for { - v := rand.Float64() * *uniformDomain - rpcDurations.WithLabelValues("uniform").Observe(v) - time.Sleep(time.Duration(100*oscillationFactor()) * time.Millisecond) - } - }() - - go func() { - for { - v := (rand.NormFloat64() * *normDomain) + *normMean - rpcDurations.WithLabelValues("normal").Observe(v) - rpcDurationsHistogram.Observe(v) - time.Sleep(time.Duration(75*oscillationFactor()) * time.Millisecond) - } - }() - - go func() { - for { - v := rand.ExpFloat64() / 1e6 - rpcDurations.WithLabelValues("exponential").Observe(v) - time.Sleep(time.Duration(50*oscillationFactor()) * time.Millisecond) - } - }() - - // Expose the registered metrics via HTTP. - http.Handle("/metrics", promhttp.Handler()) - log.Fatal(http.ListenAndServe(*addr, nil)) -} diff --git a/vendor/github.com/prometheus/client_golang/examples/simple/main.go b/vendor/github.com/prometheus/client_golang/examples/simple/main.go deleted file mode 100644 index 1fc23249a..000000000 --- a/vendor/github.com/prometheus/client_golang/examples/simple/main.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Prometheus 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. - -// A minimal example of how to include Prometheus instrumentation. -package main - -import ( - "flag" - "log" - "net/http" - - "github.com/prometheus/client_golang/prometheus/promhttp" -) - -var addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.") - -func main() { - flag.Parse() - http.Handle("/metrics", promhttp.Handler()) - log.Fatal(http.ListenAndServe(*addr, nil)) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/.gitignore b/vendor/github.com/prometheus/client_golang/prometheus/.gitignore deleted file mode 100644 index 3460f0346..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/.gitignore +++ /dev/null @@ -1 +0,0 @@ -command-line-arguments.test diff --git a/vendor/github.com/prometheus/client_golang/prometheus/README.md b/vendor/github.com/prometheus/client_golang/prometheus/README.md deleted file mode 100644 index 44986bff0..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/README.md +++ /dev/null @@ -1 +0,0 @@ -See [![go-doc](https://godoc.org/github.com/prometheus/client_golang/prometheus?status.svg)](https://godoc.org/github.com/prometheus/client_golang/prometheus). diff --git a/vendor/github.com/prometheus/client_golang/prometheus/benchmark_test.go b/vendor/github.com/prometheus/client_golang/prometheus/benchmark_test.go deleted file mode 100644 index 4a05721dc..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/benchmark_test.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "sync" - "testing" -) - -func BenchmarkCounterWithLabelValues(b *testing.B) { - m := NewCounterVec( - CounterOpts{ - Name: "benchmark_counter", - Help: "A counter to benchmark it.", - }, - []string{"one", "two", "three"}, - ) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - m.WithLabelValues("eins", "zwei", "drei").Inc() - } -} - -func BenchmarkCounterWithLabelValuesConcurrent(b *testing.B) { - m := NewCounterVec( - CounterOpts{ - Name: "benchmark_counter", - Help: "A counter to benchmark it.", - }, - []string{"one", "two", "three"}, - ) - b.ReportAllocs() - b.ResetTimer() - wg := sync.WaitGroup{} - for i := 0; i < 10; i++ { - wg.Add(1) - go func() { - for j := 0; j < b.N/10; j++ { - m.WithLabelValues("eins", "zwei", "drei").Inc() - } - wg.Done() - }() - } - wg.Wait() -} - -func BenchmarkCounterWithMappedLabels(b *testing.B) { - m := NewCounterVec( - CounterOpts{ - Name: "benchmark_counter", - Help: "A counter to benchmark it.", - }, - []string{"one", "two", "three"}, - ) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - m.With(Labels{"two": "zwei", "one": "eins", "three": "drei"}).Inc() - } -} - -func BenchmarkCounterWithPreparedMappedLabels(b *testing.B) { - m := NewCounterVec( - CounterOpts{ - Name: "benchmark_counter", - Help: "A counter to benchmark it.", - }, - []string{"one", "two", "three"}, - ) - b.ReportAllocs() - b.ResetTimer() - labels := Labels{"two": "zwei", "one": "eins", "three": "drei"} - for i := 0; i < b.N; i++ { - m.With(labels).Inc() - } -} - -func BenchmarkCounterNoLabels(b *testing.B) { - m := NewCounter(CounterOpts{ - Name: "benchmark_counter", - Help: "A counter to benchmark it.", - }) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - m.Inc() - } -} - -func BenchmarkGaugeWithLabelValues(b *testing.B) { - m := NewGaugeVec( - GaugeOpts{ - Name: "benchmark_gauge", - Help: "A gauge to benchmark it.", - }, - []string{"one", "two", "three"}, - ) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - m.WithLabelValues("eins", "zwei", "drei").Set(3.1415) - } -} - -func BenchmarkGaugeNoLabels(b *testing.B) { - m := NewGauge(GaugeOpts{ - Name: "benchmark_gauge", - Help: "A gauge to benchmark it.", - }) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - m.Set(3.1415) - } -} - -func BenchmarkSummaryWithLabelValues(b *testing.B) { - m := NewSummaryVec( - SummaryOpts{ - Name: "benchmark_summary", - Help: "A summary to benchmark it.", - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - []string{"one", "two", "three"}, - ) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - m.WithLabelValues("eins", "zwei", "drei").Observe(3.1415) - } -} - -func BenchmarkSummaryNoLabels(b *testing.B) { - m := NewSummary(SummaryOpts{ - Name: "benchmark_summary", - Help: "A summary to benchmark it.", - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - ) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - m.Observe(3.1415) - } -} - -func BenchmarkHistogramWithLabelValues(b *testing.B) { - m := NewHistogramVec( - HistogramOpts{ - Name: "benchmark_histogram", - Help: "A histogram to benchmark it.", - }, - []string{"one", "two", "three"}, - ) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - m.WithLabelValues("eins", "zwei", "drei").Observe(3.1415) - } -} - -func BenchmarkHistogramNoLabels(b *testing.B) { - m := NewHistogram(HistogramOpts{ - Name: "benchmark_histogram", - Help: "A histogram to benchmark it.", - }, - ) - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - m.Observe(3.1415) - } -} - -func BenchmarkParallelCounter(b *testing.B) { - c := NewCounter(CounterOpts{ - Name: "benchmark_counter", - Help: "A Counter to benchmark it.", - }) - b.ReportAllocs() - b.ResetTimer() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - c.Inc() - } - }) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/collector.go b/vendor/github.com/prometheus/client_golang/prometheus/collector.go deleted file mode 100644 index c0d70b2fa..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/collector.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -// Collector is the interface implemented by anything that can be used by -// Prometheus to collect metrics. A Collector has to be registered for -// collection. See Registerer.Register. -// -// The stock metrics provided by this package (Gauge, Counter, Summary, -// Histogram, Untyped) are also Collectors (which only ever collect one metric, -// namely itself). An implementer of Collector may, however, collect multiple -// metrics in a coordinated fashion and/or create metrics on the fly. Examples -// for collectors already implemented in this library are the metric vectors -// (i.e. collection of multiple instances of the same Metric but with different -// label values) like GaugeVec or SummaryVec, and the ExpvarCollector. -type Collector interface { - // Describe sends the super-set of all possible descriptors of metrics - // collected by this Collector to the provided channel and returns once - // the last descriptor has been sent. The sent descriptors fulfill the - // consistency and uniqueness requirements described in the Desc - // documentation. - // - // It is valid if one and the same Collector sends duplicate - // descriptors. Those duplicates are simply ignored. However, two - // different Collectors must not send duplicate descriptors. - // - // Sending no descriptor at all marks the Collector as “unchecked”, - // i.e. no checks will be performed at registration time, and the - // Collector may yield any Metric it sees fit in its Collect method. - // - // This method idempotently sends the same descriptors throughout the - // lifetime of the Collector. It may be called concurrently and - // therefore must be implemented in a concurrency safe way. - // - // If a Collector encounters an error while executing this method, it - // must send an invalid descriptor (created with NewInvalidDesc) to - // signal the error to the registry. - Describe(chan<- *Desc) - // Collect is called by the Prometheus registry when collecting - // metrics. The implementation sends each collected metric via the - // provided channel and returns once the last metric has been sent. The - // descriptor of each sent metric is one of those returned by Describe - // (unless the Collector is unchecked, see above). Returned metrics that - // share the same descriptor must differ in their variable label - // values. - // - // This method may be called concurrently and must therefore be - // implemented in a concurrency safe way. Blocking occurs at the expense - // of total performance of rendering all registered metrics. Ideally, - // Collector implementations support concurrent readers. - Collect(chan<- Metric) -} - -// DescribeByCollect is a helper to implement the Describe method of a custom -// Collector. It collects the metrics from the provided Collector and sends -// their descriptors to the provided channel. -// -// If a Collector collects the same metrics throughout its lifetime, its -// Describe method can simply be implemented as: -// -// func (c customCollector) Describe(ch chan<- *Desc) { -// DescribeByCollect(c, ch) -// } -// -// However, this will not work if the metrics collected change dynamically over -// the lifetime of the Collector in a way that their combined set of descriptors -// changes as well. The shortcut implementation will then violate the contract -// of the Describe method. If a Collector sometimes collects no metrics at all -// (for example vectors like CounterVec, GaugeVec, etc., which only collect -// metrics after a metric with a fully specified label set has been accessed), -// it might even get registered as an unchecked Collecter (cf. the Register -// method of the Registerer interface). Hence, only use this shortcut -// implementation of Describe if you are certain to fulfill the contract. -// -// The Collector example demonstrates a use of DescribeByCollect. -func DescribeByCollect(c Collector, descs chan<- *Desc) { - metrics := make(chan Metric) - go func() { - c.Collect(metrics) - close(metrics) - }() - for m := range metrics { - descs <- m.Desc() - } -} - -// selfCollector implements Collector for a single Metric so that the Metric -// collects itself. Add it as an anonymous field to a struct that implements -// Metric, and call init with the Metric itself as an argument. -type selfCollector struct { - self Metric -} - -// init provides the selfCollector with a reference to the metric it is supposed -// to collect. It is usually called within the factory function to create a -// metric. See example. -func (c *selfCollector) init(self Metric) { - c.self = self -} - -// Describe implements Collector. -func (c *selfCollector) Describe(ch chan<- *Desc) { - ch <- c.self.Desc() -} - -// Collect implements Collector. -func (c *selfCollector) Collect(ch chan<- Metric) { - ch <- c.self -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/collector_test.go b/vendor/github.com/prometheus/client_golang/prometheus/collector_test.go deleted file mode 100644 index 45eab3ea4..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/collector_test.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2018 The Prometheus 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 prometheus - -import "testing" - -type collectorDescribedByCollect struct { - cnt Counter - gge Gauge -} - -func (c collectorDescribedByCollect) Collect(ch chan<- Metric) { - ch <- c.cnt - ch <- c.gge -} - -func (c collectorDescribedByCollect) Describe(ch chan<- *Desc) { - DescribeByCollect(c, ch) -} - -func TestDescribeByCollect(t *testing.T) { - - goodCollector := collectorDescribedByCollect{ - cnt: NewCounter(CounterOpts{Name: "c1", Help: "help c1"}), - gge: NewGauge(GaugeOpts{Name: "g1", Help: "help g1"}), - } - collidingCollector := collectorDescribedByCollect{ - cnt: NewCounter(CounterOpts{Name: "c2", Help: "help c2"}), - gge: NewGauge(GaugeOpts{Name: "g1", Help: "help g1"}), - } - inconsistentCollector := collectorDescribedByCollect{ - cnt: NewCounter(CounterOpts{Name: "c3", Help: "help c3"}), - gge: NewGauge(GaugeOpts{Name: "c3", Help: "help inconsistent"}), - } - - reg := NewPedanticRegistry() - - if err := reg.Register(goodCollector); err != nil { - t.Error("registration failed:", err) - } - if err := reg.Register(collidingCollector); err == nil { - t.Error("registration unexpectedly succeeded") - } - if err := reg.Register(inconsistentCollector); err == nil { - t.Error("registration unexpectedly succeeded") - } - - if _, err := reg.Gather(); err != nil { - t.Error("gathering failed:", err) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/counter.go b/vendor/github.com/prometheus/client_golang/prometheus/counter.go deleted file mode 100644 index 765e4550c..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/counter.go +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "errors" - "math" - "sync/atomic" - - dto "github.com/prometheus/client_model/go" -) - -// Counter is a Metric that represents a single numerical value that only ever -// goes up. That implies that it cannot be used to count items whose number can -// also go down, e.g. the number of currently running goroutines. Those -// "counters" are represented by Gauges. -// -// A Counter is typically used to count requests served, tasks completed, errors -// occurred, etc. -// -// To create Counter instances, use NewCounter. -type Counter interface { - Metric - Collector - - // Inc increments the counter by 1. Use Add to increment it by arbitrary - // non-negative values. - Inc() - // Add adds the given value to the counter. It panics if the value is < - // 0. - Add(float64) -} - -// CounterOpts is an alias for Opts. See there for doc comments. -type CounterOpts Opts - -// NewCounter creates a new Counter based on the provided CounterOpts. -// -// The returned implementation tracks the counter value in two separate -// variables, a float64 and a uint64. The latter is used to track calls of the -// Inc method and calls of the Add method with a value that can be represented -// as a uint64. This allows atomic increments of the counter with optimal -// performance. (It is common to have an Inc call in very hot execution paths.) -// Both internal tracking values are added up in the Write method. This has to -// be taken into account when it comes to precision and overflow behavior. -func NewCounter(opts CounterOpts) Counter { - desc := NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - nil, - opts.ConstLabels, - ) - result := &counter{desc: desc, labelPairs: desc.constLabelPairs} - result.init(result) // Init self-collection. - return result -} - -type counter struct { - // valBits contains the bits of the represented float64 value, while - // valInt stores values that are exact integers. Both have to go first - // in the struct to guarantee alignment for atomic operations. - // http://golang.org/pkg/sync/atomic/#pkg-note-BUG - valBits uint64 - valInt uint64 - - selfCollector - desc *Desc - - labelPairs []*dto.LabelPair -} - -func (c *counter) Desc() *Desc { - return c.desc -} - -func (c *counter) Add(v float64) { - if v < 0 { - panic(errors.New("counter cannot decrease in value")) - } - ival := uint64(v) - if float64(ival) == v { - atomic.AddUint64(&c.valInt, ival) - return - } - - for { - oldBits := atomic.LoadUint64(&c.valBits) - newBits := math.Float64bits(math.Float64frombits(oldBits) + v) - if atomic.CompareAndSwapUint64(&c.valBits, oldBits, newBits) { - return - } - } -} - -func (c *counter) Inc() { - atomic.AddUint64(&c.valInt, 1) -} - -func (c *counter) Write(out *dto.Metric) error { - fval := math.Float64frombits(atomic.LoadUint64(&c.valBits)) - ival := atomic.LoadUint64(&c.valInt) - val := fval + float64(ival) - - return populateMetric(CounterValue, val, c.labelPairs, out) -} - -// CounterVec is a Collector that bundles a set of Counters that all share the -// same Desc, but have different values for their variable labels. This is used -// if you want to count the same thing partitioned by various dimensions -// (e.g. number of HTTP requests, partitioned by response code and -// method). Create instances with NewCounterVec. -type CounterVec struct { - *metricVec -} - -// NewCounterVec creates a new CounterVec based on the provided CounterOpts and -// partitioned by the given label names. -func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec { - desc := NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - labelNames, - opts.ConstLabels, - ) - return &CounterVec{ - metricVec: newMetricVec(desc, func(lvs ...string) Metric { - if len(lvs) != len(desc.variableLabels) { - panic(errInconsistentCardinality) - } - result := &counter{desc: desc, labelPairs: makeLabelPairs(desc, lvs)} - result.init(result) // Init self-collection. - return result - }), - } -} - -// GetMetricWithLabelValues returns the Counter for the given slice of label -// values (same order as the VariableLabels in Desc). If that combination of -// label values is accessed for the first time, a new Counter is created. -// -// It is possible to call this method without using the returned Counter to only -// create the new Counter but leave it at its starting value 0. See also the -// SummaryVec example. -// -// Keeping the Counter for later use is possible (and should be considered if -// performance is critical), but keep in mind that Reset, DeleteLabelValues and -// Delete can be used to delete the Counter from the CounterVec. In that case, -// the Counter will still exist, but it will not be exported anymore, even if a -// Counter with the same label values is created later. -// -// An error is returned if the number of label values is not the same as the -// number of VariableLabels in Desc (minus any curried labels). -// -// Note that for more than one label value, this method is prone to mistakes -// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as -// an alternative to avoid that type of mistake. For higher label numbers, the -// latter has a much more readable (albeit more verbose) syntax, but it comes -// with a performance overhead (for creating and processing the Labels map). -// See also the GaugeVec example. -func (v *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) { - metric, err := v.metricVec.getMetricWithLabelValues(lvs...) - if metric != nil { - return metric.(Counter), err - } - return nil, err -} - -// GetMetricWith returns the Counter for the given Labels map (the label names -// must match those of the VariableLabels in Desc). If that label map is -// accessed for the first time, a new Counter is created. Implications of -// creating a Counter without using it and keeping the Counter for later use are -// the same as for GetMetricWithLabelValues. -// -// An error is returned if the number and names of the Labels are inconsistent -// with those of the VariableLabels in Desc (minus any curried labels). -// -// This method is used for the same purpose as -// GetMetricWithLabelValues(...string). See there for pros and cons of the two -// methods. -func (v *CounterVec) GetMetricWith(labels Labels) (Counter, error) { - metric, err := v.metricVec.getMetricWith(labels) - if metric != nil { - return metric.(Counter), err - } - return nil, err -} - -// WithLabelValues works as GetMetricWithLabelValues, but panics where -// GetMetricWithLabelValues would have returned an error. Not returning an -// error allows shortcuts like -// myVec.WithLabelValues("404", "GET").Add(42) -func (v *CounterVec) WithLabelValues(lvs ...string) Counter { - c, err := v.GetMetricWithLabelValues(lvs...) - if err != nil { - panic(err) - } - return c -} - -// With works as GetMetricWith, but panics where GetMetricWithLabels would have -// returned an error. Not returning an error allows shortcuts like -// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42) -func (v *CounterVec) With(labels Labels) Counter { - c, err := v.GetMetricWith(labels) - if err != nil { - panic(err) - } - return c -} - -// CurryWith returns a vector curried with the provided labels, i.e. the -// returned vector has those labels pre-set for all labeled operations performed -// on it. The cardinality of the curried vector is reduced accordingly. The -// order of the remaining labels stays the same (just with the curried labels -// taken out of the sequence – which is relevant for the -// (GetMetric)WithLabelValues methods). It is possible to curry a curried -// vector, but only with labels not yet used for currying before. -// -// The metrics contained in the CounterVec are shared between the curried and -// uncurried vectors. They are just accessed differently. Curried and uncurried -// vectors behave identically in terms of collection. Only one must be -// registered with a given registry (usually the uncurried version). The Reset -// method deletes all metrics, even if called on a curried vector. -func (v *CounterVec) CurryWith(labels Labels) (*CounterVec, error) { - vec, err := v.curryWith(labels) - if vec != nil { - return &CounterVec{vec}, err - } - return nil, err -} - -// MustCurryWith works as CurryWith but panics where CurryWith would have -// returned an error. -func (v *CounterVec) MustCurryWith(labels Labels) *CounterVec { - vec, err := v.CurryWith(labels) - if err != nil { - panic(err) - } - return vec -} - -// CounterFunc is a Counter whose value is determined at collect time by calling a -// provided function. -// -// To create CounterFunc instances, use NewCounterFunc. -type CounterFunc interface { - Metric - Collector -} - -// NewCounterFunc creates a new CounterFunc based on the provided -// CounterOpts. The value reported is determined by calling the given function -// from within the Write method. Take into account that metric collection may -// happen concurrently. If that results in concurrent calls to Write, like in -// the case where a CounterFunc is directly registered with Prometheus, the -// provided function must be concurrency-safe. The function should also honor -// the contract for a Counter (values only go up, not down), but compliance will -// not be checked. -func NewCounterFunc(opts CounterOpts, function func() float64) CounterFunc { - return newValueFunc(NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - nil, - opts.ConstLabels, - ), CounterValue, function) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/counter_test.go b/vendor/github.com/prometheus/client_golang/prometheus/counter_test.go deleted file mode 100644 index 5062f51af..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/counter_test.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "fmt" - "math" - "testing" - - dto "github.com/prometheus/client_model/go" -) - -func TestCounterAdd(t *testing.T) { - counter := NewCounter(CounterOpts{ - Name: "test", - Help: "test help", - ConstLabels: Labels{"a": "1", "b": "2"}, - }).(*counter) - counter.Inc() - if expected, got := 0.0, math.Float64frombits(counter.valBits); expected != got { - t.Errorf("Expected %f, got %f.", expected, got) - } - if expected, got := uint64(1), counter.valInt; expected != got { - t.Errorf("Expected %d, got %d.", expected, got) - } - counter.Add(42) - if expected, got := 0.0, math.Float64frombits(counter.valBits); expected != got { - t.Errorf("Expected %f, got %f.", expected, got) - } - if expected, got := uint64(43), counter.valInt; expected != got { - t.Errorf("Expected %d, got %d.", expected, got) - } - - counter.Add(24.42) - if expected, got := 24.42, math.Float64frombits(counter.valBits); expected != got { - t.Errorf("Expected %f, got %f.", expected, got) - } - if expected, got := uint64(43), counter.valInt; expected != got { - t.Errorf("Expected %d, got %d.", expected, got) - } - - if expected, got := "counter cannot decrease in value", decreaseCounter(counter).Error(); expected != got { - t.Errorf("Expected error %q, got %q.", expected, got) - } - - m := &dto.Metric{} - counter.Write(m) - - if expected, got := `label: label: counter: `, m.String(); expected != got { - t.Errorf("expected %q, got %q", expected, got) - } -} - -func decreaseCounter(c *counter) (err error) { - defer func() { - if e := recover(); e != nil { - err = e.(error) - } - }() - c.Add(-1) - return nil -} - -func TestCounterVecGetMetricWithInvalidLabelValues(t *testing.T) { - testCases := []struct { - desc string - labels Labels - }{ - { - desc: "non utf8 label value", - labels: Labels{"a": "\xFF"}, - }, - { - desc: "not enough label values", - labels: Labels{}, - }, - { - desc: "too many label values", - labels: Labels{"a": "1", "b": "2"}, - }, - } - - for _, test := range testCases { - counterVec := NewCounterVec(CounterOpts{ - Name: "test", - }, []string{"a"}) - - labelValues := make([]string, len(test.labels)) - for _, val := range test.labels { - labelValues = append(labelValues, val) - } - - expectPanic(t, func() { - counterVec.WithLabelValues(labelValues...) - }, fmt.Sprintf("WithLabelValues: expected panic because: %s", test.desc)) - expectPanic(t, func() { - counterVec.With(test.labels) - }, fmt.Sprintf("WithLabelValues: expected panic because: %s", test.desc)) - - if _, err := counterVec.GetMetricWithLabelValues(labelValues...); err == nil { - t.Errorf("GetMetricWithLabelValues: expected error because: %s", test.desc) - } - if _, err := counterVec.GetMetricWith(test.labels); err == nil { - t.Errorf("GetMetricWith: expected error because: %s", test.desc) - } - } -} - -func expectPanic(t *testing.T, op func(), errorMsg string) { - defer func() { - if err := recover(); err == nil { - t.Error(errorMsg) - } - }() - - op() -} - -func TestCounterAddInf(t *testing.T) { - counter := NewCounter(CounterOpts{ - Name: "test", - Help: "test help", - }).(*counter) - - counter.Inc() - if expected, got := 0.0, math.Float64frombits(counter.valBits); expected != got { - t.Errorf("Expected %f, got %f.", expected, got) - } - if expected, got := uint64(1), counter.valInt; expected != got { - t.Errorf("Expected %d, got %d.", expected, got) - } - - counter.Add(math.Inf(1)) - if expected, got := math.Inf(1), math.Float64frombits(counter.valBits); expected != got { - t.Errorf("valBits expected %f, got %f.", expected, got) - } - if expected, got := uint64(1), counter.valInt; expected != got { - t.Errorf("valInts expected %d, got %d.", expected, got) - } - - counter.Inc() - if expected, got := math.Inf(1), math.Float64frombits(counter.valBits); expected != got { - t.Errorf("Expected %f, got %f.", expected, got) - } - if expected, got := uint64(2), counter.valInt; expected != got { - t.Errorf("Expected %d, got %d.", expected, got) - } - - m := &dto.Metric{} - counter.Write(m) - - if expected, got := `counter: `, m.String(); expected != got { - t.Errorf("expected %q, got %q", expected, got) - } -} - -func TestCounterAddLarge(t *testing.T) { - counter := NewCounter(CounterOpts{ - Name: "test", - Help: "test help", - }).(*counter) - - // large overflows the underlying type and should therefore be stored in valBits. - large := float64(math.MaxUint64 + 1) - counter.Add(large) - if expected, got := large, math.Float64frombits(counter.valBits); expected != got { - t.Errorf("valBits expected %f, got %f.", expected, got) - } - if expected, got := uint64(0), counter.valInt; expected != got { - t.Errorf("valInts expected %d, got %d.", expected, got) - } - - m := &dto.Metric{} - counter.Write(m) - - if expected, got := fmt.Sprintf("counter: ", large), m.String(); expected != got { - t.Errorf("expected %q, got %q", expected, got) - } -} - -func TestCounterAddSmall(t *testing.T) { - counter := NewCounter(CounterOpts{ - Name: "test", - Help: "test help", - }).(*counter) - small := 0.000000000001 - counter.Add(small) - if expected, got := small, math.Float64frombits(counter.valBits); expected != got { - t.Errorf("valBits expected %f, got %f.", expected, got) - } - if expected, got := uint64(0), counter.valInt; expected != got { - t.Errorf("valInts expected %d, got %d.", expected, got) - } - - m := &dto.Metric{} - counter.Write(m) - - if expected, got := fmt.Sprintf("counter: ", small), m.String(); expected != got { - t.Errorf("expected %q, got %q", expected, got) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/desc.go b/vendor/github.com/prometheus/client_golang/prometheus/desc.go deleted file mode 100644 index 7b8827ffb..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/desc.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2016 The Prometheus 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 prometheus - -import ( - "errors" - "fmt" - "sort" - "strings" - - "github.com/golang/protobuf/proto" - "github.com/prometheus/common/model" - - dto "github.com/prometheus/client_model/go" -) - -// Desc is the descriptor used by every Prometheus Metric. It is essentially -// the immutable meta-data of a Metric. The normal Metric implementations -// included in this package manage their Desc under the hood. Users only have to -// deal with Desc if they use advanced features like the ExpvarCollector or -// custom Collectors and Metrics. -// -// Descriptors registered with the same registry have to fulfill certain -// consistency and uniqueness criteria if they share the same fully-qualified -// name: They must have the same help string and the same label names (aka label -// dimensions) in each, constLabels and variableLabels, but they must differ in -// the values of the constLabels. -// -// Descriptors that share the same fully-qualified names and the same label -// values of their constLabels are considered equal. -// -// Use NewDesc to create new Desc instances. -type Desc struct { - // fqName has been built from Namespace, Subsystem, and Name. - fqName string - // help provides some helpful information about this metric. - help string - // constLabelPairs contains precalculated DTO label pairs based on - // the constant labels. - constLabelPairs []*dto.LabelPair - // VariableLabels contains names of labels for which the metric - // maintains variable values. - variableLabels []string - // id is a hash of the values of the ConstLabels and fqName. This - // must be unique among all registered descriptors and can therefore be - // used as an identifier of the descriptor. - id uint64 - // dimHash is a hash of the label names (preset and variable) and the - // Help string. Each Desc with the same fqName must have the same - // dimHash. - dimHash uint64 - // err is an error that occurred during construction. It is reported on - // registration time. - err error -} - -// NewDesc allocates and initializes a new Desc. Errors are recorded in the Desc -// and will be reported on registration time. variableLabels and constLabels can -// be nil if no such labels should be set. fqName must not be empty. -// -// variableLabels only contain the label names. Their label values are variable -// and therefore not part of the Desc. (They are managed within the Metric.) -// -// For constLabels, the label values are constant. Therefore, they are fully -// specified in the Desc. See the Collector example for a usage pattern. -func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *Desc { - d := &Desc{ - fqName: fqName, - help: help, - variableLabels: variableLabels, - } - if !model.IsValidMetricName(model.LabelValue(fqName)) { - d.err = fmt.Errorf("%q is not a valid metric name", fqName) - return d - } - // labelValues contains the label values of const labels (in order of - // their sorted label names) plus the fqName (at position 0). - labelValues := make([]string, 1, len(constLabels)+1) - labelValues[0] = fqName - labelNames := make([]string, 0, len(constLabels)+len(variableLabels)) - labelNameSet := map[string]struct{}{} - // First add only the const label names and sort them... - for labelName := range constLabels { - if !checkLabelName(labelName) { - d.err = fmt.Errorf("%q is not a valid label name", labelName) - return d - } - labelNames = append(labelNames, labelName) - labelNameSet[labelName] = struct{}{} - } - sort.Strings(labelNames) - // ... so that we can now add const label values in the order of their names. - for _, labelName := range labelNames { - labelValues = append(labelValues, constLabels[labelName]) - } - // Validate the const label values. They can't have a wrong cardinality, so - // use in len(labelValues) as expectedNumberOfValues. - if err := validateLabelValues(labelValues, len(labelValues)); err != nil { - d.err = err - return d - } - // Now add the variable label names, but prefix them with something that - // cannot be in a regular label name. That prevents matching the label - // dimension with a different mix between preset and variable labels. - for _, labelName := range variableLabels { - if !checkLabelName(labelName) { - d.err = fmt.Errorf("%q is not a valid label name", labelName) - return d - } - labelNames = append(labelNames, "$"+labelName) - labelNameSet[labelName] = struct{}{} - } - if len(labelNames) != len(labelNameSet) { - d.err = errors.New("duplicate label names") - return d - } - - vh := hashNew() - for _, val := range labelValues { - vh = hashAdd(vh, val) - vh = hashAddByte(vh, separatorByte) - } - d.id = vh - // Sort labelNames so that order doesn't matter for the hash. - sort.Strings(labelNames) - // Now hash together (in this order) the help string and the sorted - // label names. - lh := hashNew() - lh = hashAdd(lh, help) - lh = hashAddByte(lh, separatorByte) - for _, labelName := range labelNames { - lh = hashAdd(lh, labelName) - lh = hashAddByte(lh, separatorByte) - } - d.dimHash = lh - - d.constLabelPairs = make([]*dto.LabelPair, 0, len(constLabels)) - for n, v := range constLabels { - d.constLabelPairs = append(d.constLabelPairs, &dto.LabelPair{ - Name: proto.String(n), - Value: proto.String(v), - }) - } - sort.Sort(labelPairSorter(d.constLabelPairs)) - return d -} - -// NewInvalidDesc returns an invalid descriptor, i.e. a descriptor with the -// provided error set. If a collector returning such a descriptor is registered, -// registration will fail with the provided error. NewInvalidDesc can be used by -// a Collector to signal inability to describe itself. -func NewInvalidDesc(err error) *Desc { - return &Desc{ - err: err, - } -} - -func (d *Desc) String() string { - lpStrings := make([]string, 0, len(d.constLabelPairs)) - for _, lp := range d.constLabelPairs { - lpStrings = append( - lpStrings, - fmt.Sprintf("%s=%q", lp.GetName(), lp.GetValue()), - ) - } - return fmt.Sprintf( - "Desc{fqName: %q, help: %q, constLabels: {%s}, variableLabels: %v}", - d.fqName, - d.help, - strings.Join(lpStrings, ","), - d.variableLabels, - ) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/desc_test.go b/vendor/github.com/prometheus/client_golang/prometheus/desc_test.go deleted file mode 100644 index 5f854db0b..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/desc_test.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Prometheus 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 prometheus - -import ( - "testing" -) - -func TestNewDescInvalidLabelValues(t *testing.T) { - desc := NewDesc( - "sample_label", - "sample label", - nil, - Labels{"a": "\xFF"}, - ) - if desc.err == nil { - t.Errorf("NewDesc: expected error because: %s", desc.err) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/doc.go b/vendor/github.com/prometheus/client_golang/prometheus/doc.go deleted file mode 100644 index 5d9525def..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/doc.go +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus is the core instrumentation package. It provides metrics -// primitives to instrument code for monitoring. It also offers a registry for -// metrics. Sub-packages allow to expose the registered metrics via HTTP -// (package promhttp) or push them to a Pushgateway (package push). There is -// also a sub-package promauto, which provides metrics constructors with -// automatic registration. -// -// All exported functions and methods are safe to be used concurrently unless -// specified otherwise. -// -// A Basic Example -// -// As a starting point, a very basic usage example: -// -// package main -// -// import ( -// "log" -// "net/http" -// -// "github.com/prometheus/client_golang/prometheus" -// "github.com/prometheus/client_golang/prometheus/promhttp" -// ) -// -// var ( -// cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{ -// Name: "cpu_temperature_celsius", -// Help: "Current temperature of the CPU.", -// }) -// hdFailures = prometheus.NewCounterVec( -// prometheus.CounterOpts{ -// Name: "hd_errors_total", -// Help: "Number of hard-disk errors.", -// }, -// []string{"device"}, -// ) -// ) -// -// func init() { -// // Metrics have to be registered to be exposed: -// prometheus.MustRegister(cpuTemp) -// prometheus.MustRegister(hdFailures) -// } -// -// func main() { -// cpuTemp.Set(65.3) -// hdFailures.With(prometheus.Labels{"device":"/dev/sda"}).Inc() -// -// // The Handler function provides a default handler to expose metrics -// // via an HTTP server. "/metrics" is the usual endpoint for that. -// http.Handle("/metrics", promhttp.Handler()) -// log.Fatal(http.ListenAndServe(":8080", nil)) -// } -// -// -// This is a complete program that exports two metrics, a Gauge and a Counter, -// the latter with a label attached to turn it into a (one-dimensional) vector. -// -// Metrics -// -// The number of exported identifiers in this package might appear a bit -// overwhelming. However, in addition to the basic plumbing shown in the example -// above, you only need to understand the different metric types and their -// vector versions for basic usage. Furthermore, if you are not concerned with -// fine-grained control of when and how to register metrics with the registry, -// have a look at the promauto package, which will effectively allow you to -// ignore registration altogether in simple cases. -// -// Above, you have already touched the Counter and the Gauge. There are two more -// advanced metric types: the Summary and Histogram. A more thorough description -// of those four metric types can be found in the Prometheus docs: -// https://prometheus.io/docs/concepts/metric_types/ -// -// A fifth "type" of metric is Untyped. It behaves like a Gauge, but signals the -// Prometheus server not to assume anything about its type. -// -// In addition to the fundamental metric types Gauge, Counter, Summary, -// Histogram, and Untyped, a very important part of the Prometheus data model is -// the partitioning of samples along dimensions called labels, which results in -// metric vectors. The fundamental types are GaugeVec, CounterVec, SummaryVec, -// HistogramVec, and UntypedVec. -// -// While only the fundamental metric types implement the Metric interface, both -// the metrics and their vector versions implement the Collector interface. A -// Collector manages the collection of a number of Metrics, but for convenience, -// a Metric can also “collect itself”. Note that Gauge, Counter, Summary, -// Histogram, and Untyped are interfaces themselves while GaugeVec, CounterVec, -// SummaryVec, HistogramVec, and UntypedVec are not. -// -// To create instances of Metrics and their vector versions, you need a suitable -// …Opts struct, i.e. GaugeOpts, CounterOpts, SummaryOpts, HistogramOpts, or -// UntypedOpts. -// -// Custom Collectors and constant Metrics -// -// While you could create your own implementations of Metric, most likely you -// will only ever implement the Collector interface on your own. At a first -// glance, a custom Collector seems handy to bundle Metrics for common -// registration (with the prime example of the different metric vectors above, -// which bundle all the metrics of the same name but with different labels). -// -// There is a more involved use case, too: If you already have metrics -// available, created outside of the Prometheus context, you don't need the -// interface of the various Metric types. You essentially want to mirror the -// existing numbers into Prometheus Metrics during collection. An own -// implementation of the Collector interface is perfect for that. You can create -// Metric instances “on the fly” using NewConstMetric, NewConstHistogram, and -// NewConstSummary (and their respective Must… versions). That will happen in -// the Collect method. The Describe method has to return separate Desc -// instances, representative of the “throw-away” metrics to be created later. -// NewDesc comes in handy to create those Desc instances. Alternatively, you -// could return no Desc at all, which will marke the Collector “unchecked”. No -// checks are porformed at registration time, but metric consistency will still -// be ensured at scrape time, i.e. any inconsistencies will lead to scrape -// errors. Thus, with unchecked Collectors, the responsibility to not collect -// metrics that lead to inconsistencies in the total scrape result lies with the -// implementer of the Collector. While this is not a desirable state, it is -// sometimes necessary. The typical use case is a situatios where the exact -// metrics to be returned by a Collector cannot be predicted at registration -// time, but the implementer has sufficient knowledge of the whole system to -// guarantee metric consistency. -// -// The Collector example illustrates the use case. You can also look at the -// source code of the processCollector (mirroring process metrics), the -// goCollector (mirroring Go metrics), or the expvarCollector (mirroring expvar -// metrics) as examples that are used in this package itself. -// -// If you just need to call a function to get a single float value to collect as -// a metric, GaugeFunc, CounterFunc, or UntypedFunc might be interesting -// shortcuts. -// -// Advanced Uses of the Registry -// -// While MustRegister is the by far most common way of registering a Collector, -// sometimes you might want to handle the errors the registration might cause. -// As suggested by the name, MustRegister panics if an error occurs. With the -// Register function, the error is returned and can be handled. -// -// An error is returned if the registered Collector is incompatible or -// inconsistent with already registered metrics. The registry aims for -// consistency of the collected metrics according to the Prometheus data model. -// Inconsistencies are ideally detected at registration time, not at collect -// time. The former will usually be detected at start-up time of a program, -// while the latter will only happen at scrape time, possibly not even on the -// first scrape if the inconsistency only becomes relevant later. That is the -// main reason why a Collector and a Metric have to describe themselves to the -// registry. -// -// So far, everything we did operated on the so-called default registry, as it -// can be found in the global DefaultRegisterer variable. With NewRegistry, you -// can create a custom registry, or you can even implement the Registerer or -// Gatherer interfaces yourself. The methods Register and Unregister work in the -// same way on a custom registry as the global functions Register and Unregister -// on the default registry. -// -// There are a number of uses for custom registries: You can use registries with -// special properties, see NewPedanticRegistry. You can avoid global state, as -// it is imposed by the DefaultRegisterer. You can use multiple registries at -// the same time to expose different metrics in different ways. You can use -// separate registries for testing purposes. -// -// Also note that the DefaultRegisterer comes registered with a Collector for Go -// runtime metrics (via NewGoCollector) and a Collector for process metrics (via -// NewProcessCollector). With a custom registry, you are in control and decide -// yourself about the Collectors to register. -// -// HTTP Exposition -// -// The Registry implements the Gatherer interface. The caller of the Gather -// method can then expose the gathered metrics in some way. Usually, the metrics -// are served via HTTP on the /metrics endpoint. That's happening in the example -// above. The tools to expose metrics via HTTP are in the promhttp sub-package. -// (The top-level functions in the prometheus package are deprecated.) -// -// Pushing to the Pushgateway -// -// Function for pushing to the Pushgateway can be found in the push sub-package. -// -// Graphite Bridge -// -// Functions and examples to push metrics from a Gatherer to Graphite can be -// found in the graphite sub-package. -// -// Other Means of Exposition -// -// More ways of exposing metrics can easily be added by following the approaches -// of the existing implementations. -package prometheus diff --git a/vendor/github.com/prometheus/client_golang/prometheus/example_clustermanager_test.go b/vendor/github.com/prometheus/client_golang/prometheus/example_clustermanager_test.go deleted file mode 100644 index 9a5a4b8a2..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/example_clustermanager_test.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus_test - -import "github.com/prometheus/client_golang/prometheus" - -// ClusterManager is an example for a system that might have been built without -// Prometheus in mind. It models a central manager of jobs running in a -// cluster. Thus, we implement a custom Collector called -// ClusterManagerCollector, which collects information from a ClusterManager -// using its provided methods and turns them into Prometheus Metrics for -// collection. -// -// An additional challenge is that multiple instances of the ClusterManager are -// run within the same binary, each in charge of a different zone. We need to -// make use of wrapping Registerers to be able to register each -// ClusterManagerCollector instance with Prometheus. -type ClusterManager struct { - Zone string - // Contains many more fields not listed in this example. -} - -// ReallyExpensiveAssessmentOfTheSystemState is a mock for the data gathering a -// real cluster manager would have to do. Since it may actually be really -// expensive, it must only be called once per collection. This implementation, -// obviously, only returns some made-up data. -func (c *ClusterManager) ReallyExpensiveAssessmentOfTheSystemState() ( - oomCountByHost map[string]int, ramUsageByHost map[string]float64, -) { - // Just example fake data. - oomCountByHost = map[string]int{ - "foo.example.org": 42, - "bar.example.org": 2001, - } - ramUsageByHost = map[string]float64{ - "foo.example.org": 6.023e23, - "bar.example.org": 3.14, - } - return -} - -// ClusterManagerCollector implements the Collector interface. -type ClusterManagerCollector struct { - ClusterManager *ClusterManager -} - -// Descriptors used by the ClusterManagerCollector below. -var ( - oomCountDesc = prometheus.NewDesc( - "clustermanager_oom_crashes_total", - "Number of OOM crashes.", - []string{"host"}, nil, - ) - ramUsageDesc = prometheus.NewDesc( - "clustermanager_ram_usage_bytes", - "RAM usage as reported to the cluster manager.", - []string{"host"}, nil, - ) -) - -// Describe is implemented with DescribeByCollect. That's possible because the -// Collect method will always return the same two metrics with the same two -// descriptors. -func (cc ClusterManagerCollector) Describe(ch chan<- *prometheus.Desc) { - prometheus.DescribeByCollect(cc, ch) -} - -// Collect first triggers the ReallyExpensiveAssessmentOfTheSystemState. Then it -// creates constant metrics for each host on the fly based on the returned data. -// -// Note that Collect could be called concurrently, so we depend on -// ReallyExpensiveAssessmentOfTheSystemState to be concurrency-safe. -func (cc ClusterManagerCollector) Collect(ch chan<- prometheus.Metric) { - oomCountByHost, ramUsageByHost := cc.ClusterManager.ReallyExpensiveAssessmentOfTheSystemState() - for host, oomCount := range oomCountByHost { - ch <- prometheus.MustNewConstMetric( - oomCountDesc, - prometheus.CounterValue, - float64(oomCount), - host, - ) - } - for host, ramUsage := range ramUsageByHost { - ch <- prometheus.MustNewConstMetric( - ramUsageDesc, - prometheus.GaugeValue, - ramUsage, - host, - ) - } -} - -// NewClusterManager first creates a Prometheus-ignorant ClusterManager -// instance. Then, it creates a ClusterManagerCollector for the just created -// ClusterManager. Finally, it registers the ClusterManagerCollector with a -// wrapping Registerer that adds the zone as a label. In this way, the metrics -// collected by different ClusterManagerCollectors do not collide. -func NewClusterManager(zone string, reg prometheus.Registerer) *ClusterManager { - c := &ClusterManager{ - Zone: zone, - } - cc := ClusterManagerCollector{ClusterManager: c} - prometheus.WrapRegistererWith(prometheus.Labels{"zone": zone}, reg).MustRegister(cc) - return c -} - -func ExampleCollector() { - // Since we are dealing with custom Collector implementations, it might - // be a good idea to try it out with a pedantic registry. - reg := prometheus.NewPedanticRegistry() - - // Construct cluster managers. In real code, we would assign them to - // variables to then do something with them. - NewClusterManager("db", reg) - NewClusterManager("ca", reg) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/example_timer_complex_test.go b/vendor/github.com/prometheus/client_golang/prometheus/example_timer_complex_test.go deleted file mode 100644 index c5e7de5e5..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/example_timer_complex_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus_test - -import ( - "net/http" - - "github.com/prometheus/client_golang/prometheus" -) - -var ( - // apiRequestDuration tracks the duration separate for each HTTP status - // class (1xx, 2xx, ...). This creates a fair amount of time series on - // the Prometheus server. Usually, you would track the duration of - // serving HTTP request without partitioning by outcome. Do something - // like this only if needed. Also note how only status classes are - // tracked, not every single status code. The latter would create an - // even larger amount of time series. Request counters partitioned by - // status code are usually OK as each counter only creates one time - // series. Histograms are way more expensive, so partition with care and - // only where you really need separate latency tracking. Partitioning by - // status class is only an example. In concrete cases, other partitions - // might make more sense. - apiRequestDuration = prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "api_request_duration_seconds", - Help: "Histogram for the request duration of the public API, partitioned by status class.", - Buckets: prometheus.ExponentialBuckets(0.1, 1.5, 5), - }, - []string{"status_class"}, - ) -) - -func handler(w http.ResponseWriter, r *http.Request) { - status := http.StatusOK - // The ObserverFunc gets called by the deferred ObserveDuration and - // decides which Histogram's Observe method is called. - timer := prometheus.NewTimer(prometheus.ObserverFunc(func(v float64) { - switch { - case status >= 500: // Server error. - apiRequestDuration.WithLabelValues("5xx").Observe(v) - case status >= 400: // Client error. - apiRequestDuration.WithLabelValues("4xx").Observe(v) - case status >= 300: // Redirection. - apiRequestDuration.WithLabelValues("3xx").Observe(v) - case status >= 200: // Success. - apiRequestDuration.WithLabelValues("2xx").Observe(v) - default: // Informational. - apiRequestDuration.WithLabelValues("1xx").Observe(v) - } - })) - defer timer.ObserveDuration() - - // Handle the request. Set status accordingly. - // ... -} - -func ExampleTimer_complex() { - http.HandleFunc("/api", handler) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/example_timer_gauge_test.go b/vendor/github.com/prometheus/client_golang/prometheus/example_timer_gauge_test.go deleted file mode 100644 index 7184a0d1d..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/example_timer_gauge_test.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus_test - -import ( - "os" - - "github.com/prometheus/client_golang/prometheus" -) - -var ( - // If a function is called rarely (i.e. not more often than scrapes - // happen) or ideally only once (like in a batch job), it can make sense - // to use a Gauge for timing the function call. For timing a batch job - // and pushing the result to a Pushgateway, see also the comprehensive - // example in the push package. - funcDuration = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "example_function_duration_seconds", - Help: "Duration of the last call of an example function.", - }) -) - -func run() error { - // The Set method of the Gauge is used to observe the duration. - timer := prometheus.NewTimer(prometheus.ObserverFunc(funcDuration.Set)) - defer timer.ObserveDuration() - - // Do something. Return errors as encountered. The use of 'defer' above - // makes sure the function is still timed properly. - return nil -} - -func ExampleTimer_gauge() { - if err := run(); err != nil { - os.Exit(1) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/example_timer_test.go b/vendor/github.com/prometheus/client_golang/prometheus/example_timer_test.go deleted file mode 100644 index bd86bb472..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/example_timer_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus_test - -import ( - "math/rand" - "time" - - "github.com/prometheus/client_golang/prometheus" -) - -var ( - requestDuration = prometheus.NewHistogram(prometheus.HistogramOpts{ - Name: "example_request_duration_seconds", - Help: "Histogram for the runtime of a simple example function.", - Buckets: prometheus.LinearBuckets(0.01, 0.01, 10), - }) -) - -func ExampleTimer() { - // timer times this example function. It uses a Histogram, but a Summary - // would also work, as both implement Observer. Check out - // https://prometheus.io/docs/practices/histograms/ for differences. - timer := prometheus.NewTimer(requestDuration) - defer timer.ObserveDuration() - - // Do something here that takes time. - time.Sleep(time.Duration(rand.NormFloat64()*10000+50000) * time.Microsecond) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/examples_test.go b/vendor/github.com/prometheus/client_golang/prometheus/examples_test.go deleted file mode 100644 index 538a23999..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/examples_test.go +++ /dev/null @@ -1,742 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus_test - -import ( - "bytes" - "fmt" - "math" - "net/http" - "runtime" - "strings" - "time" - - "github.com/golang/protobuf/proto" - "github.com/prometheus/common/expfmt" - - dto "github.com/prometheus/client_model/go" - - "github.com/prometheus/client_golang/prometheus" -) - -func ExampleGauge() { - opsQueued := prometheus.NewGauge(prometheus.GaugeOpts{ - Namespace: "our_company", - Subsystem: "blob_storage", - Name: "ops_queued", - Help: "Number of blob storage operations waiting to be processed.", - }) - prometheus.MustRegister(opsQueued) - - // 10 operations queued by the goroutine managing incoming requests. - opsQueued.Add(10) - // A worker goroutine has picked up a waiting operation. - opsQueued.Dec() - // And once more... - opsQueued.Dec() -} - -func ExampleGaugeVec() { - opsQueued := prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: "our_company", - Subsystem: "blob_storage", - Name: "ops_queued", - Help: "Number of blob storage operations waiting to be processed, partitioned by user and type.", - }, - []string{ - // Which user has requested the operation? - "user", - // Of what type is the operation? - "type", - }, - ) - prometheus.MustRegister(opsQueued) - - // Increase a value using compact (but order-sensitive!) WithLabelValues(). - opsQueued.WithLabelValues("bob", "put").Add(4) - // Increase a value with a map using WithLabels. More verbose, but order - // doesn't matter anymore. - opsQueued.With(prometheus.Labels{"type": "delete", "user": "alice"}).Inc() -} - -func ExampleGaugeFunc() { - if err := prometheus.Register(prometheus.NewGaugeFunc( - prometheus.GaugeOpts{ - Subsystem: "runtime", - Name: "goroutines_count", - Help: "Number of goroutines that currently exist.", - }, - func() float64 { return float64(runtime.NumGoroutine()) }, - )); err == nil { - fmt.Println("GaugeFunc 'goroutines_count' registered.") - } - // Note that the count of goroutines is a gauge (and not a counter) as - // it can go up and down. - - // Output: - // GaugeFunc 'goroutines_count' registered. -} - -func ExampleCounterVec() { - httpReqs := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "http_requests_total", - Help: "How many HTTP requests processed, partitioned by status code and HTTP method.", - }, - []string{"code", "method"}, - ) - prometheus.MustRegister(httpReqs) - - httpReqs.WithLabelValues("404", "POST").Add(42) - - // If you have to access the same set of labels very frequently, it - // might be good to retrieve the metric only once and keep a handle to - // it. But beware of deletion of that metric, see below! - m := httpReqs.WithLabelValues("200", "GET") - for i := 0; i < 1000000; i++ { - m.Inc() - } - // Delete a metric from the vector. If you have previously kept a handle - // to that metric (as above), future updates via that handle will go - // unseen (even if you re-create a metric with the same label set - // later). - httpReqs.DeleteLabelValues("200", "GET") - // Same thing with the more verbose Labels syntax. - httpReqs.Delete(prometheus.Labels{"method": "GET", "code": "200"}) -} - -func ExampleInstrumentHandler() { - // Handle the "/doc" endpoint with the standard http.FileServer handler. - // By wrapping the handler with InstrumentHandler, request count, - // request and response sizes, and request latency are automatically - // exported to Prometheus, partitioned by HTTP status code and method - // and by the handler name (here "fileserver"). - http.Handle("/doc", prometheus.InstrumentHandler( - "fileserver", http.FileServer(http.Dir("/usr/share/doc")), - )) - // The Prometheus handler still has to be registered to handle the - // "/metrics" endpoint. The handler returned by prometheus.Handler() is - // already instrumented - with "prometheus" as the handler name. In this - // example, we want the handler name to be "metrics", so we instrument - // the uninstrumented Prometheus handler ourselves. - http.Handle("/metrics", prometheus.InstrumentHandler( - "metrics", prometheus.UninstrumentedHandler(), - )) -} - -func ExampleRegister() { - // Imagine you have a worker pool and want to count the tasks completed. - taskCounter := prometheus.NewCounter(prometheus.CounterOpts{ - Subsystem: "worker_pool", - Name: "completed_tasks_total", - Help: "Total number of tasks completed.", - }) - // This will register fine. - if err := prometheus.Register(taskCounter); err != nil { - fmt.Println(err) - } else { - fmt.Println("taskCounter registered.") - } - // Don't forget to tell the HTTP server about the Prometheus handler. - // (In a real program, you still need to start the HTTP server...) - http.Handle("/metrics", prometheus.Handler()) - - // Now you can start workers and give every one of them a pointer to - // taskCounter and let it increment it whenever it completes a task. - taskCounter.Inc() // This has to happen somewhere in the worker code. - - // But wait, you want to see how individual workers perform. So you need - // a vector of counters, with one element for each worker. - taskCounterVec := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Subsystem: "worker_pool", - Name: "completed_tasks_total", - Help: "Total number of tasks completed.", - }, - []string{"worker_id"}, - ) - - // Registering will fail because we already have a metric of that name. - if err := prometheus.Register(taskCounterVec); err != nil { - fmt.Println("taskCounterVec not registered:", err) - } else { - fmt.Println("taskCounterVec registered.") - } - - // To fix, first unregister the old taskCounter. - if prometheus.Unregister(taskCounter) { - fmt.Println("taskCounter unregistered.") - } - - // Try registering taskCounterVec again. - if err := prometheus.Register(taskCounterVec); err != nil { - fmt.Println("taskCounterVec not registered:", err) - } else { - fmt.Println("taskCounterVec registered.") - } - // Bummer! Still doesn't work. - - // Prometheus will not allow you to ever export metrics with - // inconsistent help strings or label names. After unregistering, the - // unregistered metrics will cease to show up in the /metrics HTTP - // response, but the registry still remembers that those metrics had - // been exported before. For this example, we will now choose a - // different name. (In a real program, you would obviously not export - // the obsolete metric in the first place.) - taskCounterVec = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Subsystem: "worker_pool", - Name: "completed_tasks_by_id", - Help: "Total number of tasks completed.", - }, - []string{"worker_id"}, - ) - if err := prometheus.Register(taskCounterVec); err != nil { - fmt.Println("taskCounterVec not registered:", err) - } else { - fmt.Println("taskCounterVec registered.") - } - // Finally it worked! - - // The workers have to tell taskCounterVec their id to increment the - // right element in the metric vector. - taskCounterVec.WithLabelValues("42").Inc() // Code from worker 42. - - // Each worker could also keep a reference to their own counter element - // around. Pick the counter at initialization time of the worker. - myCounter := taskCounterVec.WithLabelValues("42") // From worker 42 initialization code. - myCounter.Inc() // Somewhere in the code of that worker. - - // Note that something like WithLabelValues("42", "spurious arg") would - // panic (because you have provided too many label values). If you want - // to get an error instead, use GetMetricWithLabelValues(...) instead. - notMyCounter, err := taskCounterVec.GetMetricWithLabelValues("42", "spurious arg") - if err != nil { - fmt.Println("Worker initialization failed:", err) - } - if notMyCounter == nil { - fmt.Println("notMyCounter is nil.") - } - - // A different (and somewhat tricky) approach is to use - // ConstLabels. ConstLabels are pairs of label names and label values - // that never change. You might ask what those labels are good for (and - // rightfully so - if they never change, they could as well be part of - // the metric name). There are essentially two use-cases: The first is - // if labels are constant throughout the lifetime of a binary execution, - // but they vary over time or between different instances of a running - // binary. The second is what we have here: Each worker creates and - // registers an own Counter instance where the only difference is in the - // value of the ConstLabels. Those Counters can all be registered - // because the different ConstLabel values guarantee that each worker - // will increment a different Counter metric. - counterOpts := prometheus.CounterOpts{ - Subsystem: "worker_pool", - Name: "completed_tasks", - Help: "Total number of tasks completed.", - ConstLabels: prometheus.Labels{"worker_id": "42"}, - } - taskCounterForWorker42 := prometheus.NewCounter(counterOpts) - if err := prometheus.Register(taskCounterForWorker42); err != nil { - fmt.Println("taskCounterVForWorker42 not registered:", err) - } else { - fmt.Println("taskCounterForWorker42 registered.") - } - // Obviously, in real code, taskCounterForWorker42 would be a member - // variable of a worker struct, and the "42" would be retrieved with a - // GetId() method or something. The Counter would be created and - // registered in the initialization code of the worker. - - // For the creation of the next Counter, we can recycle - // counterOpts. Just change the ConstLabels. - counterOpts.ConstLabels = prometheus.Labels{"worker_id": "2001"} - taskCounterForWorker2001 := prometheus.NewCounter(counterOpts) - if err := prometheus.Register(taskCounterForWorker2001); err != nil { - fmt.Println("taskCounterVForWorker2001 not registered:", err) - } else { - fmt.Println("taskCounterForWorker2001 registered.") - } - - taskCounterForWorker2001.Inc() - taskCounterForWorker42.Inc() - taskCounterForWorker2001.Inc() - - // Yet another approach would be to turn the workers themselves into - // Collectors and register them. See the Collector example for details. - - // Output: - // taskCounter registered. - // taskCounterVec not registered: a previously registered descriptor with the same fully-qualified name as Desc{fqName: "worker_pool_completed_tasks_total", help: "Total number of tasks completed.", constLabels: {}, variableLabels: [worker_id]} has different label names or a different help string - // taskCounter unregistered. - // taskCounterVec not registered: a previously registered descriptor with the same fully-qualified name as Desc{fqName: "worker_pool_completed_tasks_total", help: "Total number of tasks completed.", constLabels: {}, variableLabels: [worker_id]} has different label names or a different help string - // taskCounterVec registered. - // Worker initialization failed: inconsistent label cardinality - // notMyCounter is nil. - // taskCounterForWorker42 registered. - // taskCounterForWorker2001 registered. -} - -func ExampleSummary() { - temps := prometheus.NewSummary(prometheus.SummaryOpts{ - Name: "pond_temperature_celsius", - Help: "The temperature of the frog pond.", - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }) - - // Simulate some observations. - for i := 0; i < 1000; i++ { - temps.Observe(30 + math.Floor(120*math.Sin(float64(i)*0.1))/10) - } - - // Just for demonstration, let's check the state of the summary by - // (ab)using its Write method (which is usually only used by Prometheus - // internally). - metric := &dto.Metric{} - temps.Write(metric) - fmt.Println(proto.MarshalTextString(metric)) - - // Output: - // summary: < - // sample_count: 1000 - // sample_sum: 29969.50000000001 - // quantile: < - // quantile: 0.5 - // value: 31.1 - // > - // quantile: < - // quantile: 0.9 - // value: 41.3 - // > - // quantile: < - // quantile: 0.99 - // value: 41.9 - // > - // > -} - -func ExampleSummaryVec() { - temps := prometheus.NewSummaryVec( - prometheus.SummaryOpts{ - Name: "pond_temperature_celsius", - Help: "The temperature of the frog pond.", - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - []string{"species"}, - ) - - // Simulate some observations. - for i := 0; i < 1000; i++ { - temps.WithLabelValues("litoria-caerulea").Observe(30 + math.Floor(120*math.Sin(float64(i)*0.1))/10) - temps.WithLabelValues("lithobates-catesbeianus").Observe(32 + math.Floor(100*math.Cos(float64(i)*0.11))/10) - } - - // Create a Summary without any observations. - temps.WithLabelValues("leiopelma-hochstetteri") - - // Just for demonstration, let's check the state of the summary vector - // by registering it with a custom registry and then let it collect the - // metrics. - reg := prometheus.NewRegistry() - reg.MustRegister(temps) - - metricFamilies, err := reg.Gather() - if err != nil || len(metricFamilies) != 1 { - panic("unexpected behavior of custom test registry") - } - fmt.Println(proto.MarshalTextString(metricFamilies[0])) - - // Output: - // name: "pond_temperature_celsius" - // help: "The temperature of the frog pond." - // type: SUMMARY - // metric: < - // label: < - // name: "species" - // value: "leiopelma-hochstetteri" - // > - // summary: < - // sample_count: 0 - // sample_sum: 0 - // quantile: < - // quantile: 0.5 - // value: nan - // > - // quantile: < - // quantile: 0.9 - // value: nan - // > - // quantile: < - // quantile: 0.99 - // value: nan - // > - // > - // > - // metric: < - // label: < - // name: "species" - // value: "lithobates-catesbeianus" - // > - // summary: < - // sample_count: 1000 - // sample_sum: 31956.100000000017 - // quantile: < - // quantile: 0.5 - // value: 32.4 - // > - // quantile: < - // quantile: 0.9 - // value: 41.4 - // > - // quantile: < - // quantile: 0.99 - // value: 41.9 - // > - // > - // > - // metric: < - // label: < - // name: "species" - // value: "litoria-caerulea" - // > - // summary: < - // sample_count: 1000 - // sample_sum: 29969.50000000001 - // quantile: < - // quantile: 0.5 - // value: 31.1 - // > - // quantile: < - // quantile: 0.9 - // value: 41.3 - // > - // quantile: < - // quantile: 0.99 - // value: 41.9 - // > - // > - // > -} - -func ExampleNewConstSummary() { - desc := prometheus.NewDesc( - "http_request_duration_seconds", - "A summary of the HTTP request durations.", - []string{"code", "method"}, - prometheus.Labels{"owner": "example"}, - ) - - // Create a constant summary from values we got from a 3rd party telemetry system. - s := prometheus.MustNewConstSummary( - desc, - 4711, 403.34, - map[float64]float64{0.5: 42.3, 0.9: 323.3}, - "200", "get", - ) - - // Just for demonstration, let's check the state of the summary by - // (ab)using its Write method (which is usually only used by Prometheus - // internally). - metric := &dto.Metric{} - s.Write(metric) - fmt.Println(proto.MarshalTextString(metric)) - - // Output: - // label: < - // name: "code" - // value: "200" - // > - // label: < - // name: "method" - // value: "get" - // > - // label: < - // name: "owner" - // value: "example" - // > - // summary: < - // sample_count: 4711 - // sample_sum: 403.34 - // quantile: < - // quantile: 0.5 - // value: 42.3 - // > - // quantile: < - // quantile: 0.9 - // value: 323.3 - // > - // > -} - -func ExampleHistogram() { - temps := prometheus.NewHistogram(prometheus.HistogramOpts{ - Name: "pond_temperature_celsius", - Help: "The temperature of the frog pond.", // Sorry, we can't measure how badly it smells. - Buckets: prometheus.LinearBuckets(20, 5, 5), // 5 buckets, each 5 centigrade wide. - }) - - // Simulate some observations. - for i := 0; i < 1000; i++ { - temps.Observe(30 + math.Floor(120*math.Sin(float64(i)*0.1))/10) - } - - // Just for demonstration, let's check the state of the histogram by - // (ab)using its Write method (which is usually only used by Prometheus - // internally). - metric := &dto.Metric{} - temps.Write(metric) - fmt.Println(proto.MarshalTextString(metric)) - - // Output: - // histogram: < - // sample_count: 1000 - // sample_sum: 29969.50000000001 - // bucket: < - // cumulative_count: 192 - // upper_bound: 20 - // > - // bucket: < - // cumulative_count: 366 - // upper_bound: 25 - // > - // bucket: < - // cumulative_count: 501 - // upper_bound: 30 - // > - // bucket: < - // cumulative_count: 638 - // upper_bound: 35 - // > - // bucket: < - // cumulative_count: 816 - // upper_bound: 40 - // > - // > -} - -func ExampleNewConstHistogram() { - desc := prometheus.NewDesc( - "http_request_duration_seconds", - "A histogram of the HTTP request durations.", - []string{"code", "method"}, - prometheus.Labels{"owner": "example"}, - ) - - // Create a constant histogram from values we got from a 3rd party telemetry system. - h := prometheus.MustNewConstHistogram( - desc, - 4711, 403.34, - map[float64]uint64{25: 121, 50: 2403, 100: 3221, 200: 4233}, - "200", "get", - ) - - // Just for demonstration, let's check the state of the histogram by - // (ab)using its Write method (which is usually only used by Prometheus - // internally). - metric := &dto.Metric{} - h.Write(metric) - fmt.Println(proto.MarshalTextString(metric)) - - // Output: - // label: < - // name: "code" - // value: "200" - // > - // label: < - // name: "method" - // value: "get" - // > - // label: < - // name: "owner" - // value: "example" - // > - // histogram: < - // sample_count: 4711 - // sample_sum: 403.34 - // bucket: < - // cumulative_count: 121 - // upper_bound: 25 - // > - // bucket: < - // cumulative_count: 2403 - // upper_bound: 50 - // > - // bucket: < - // cumulative_count: 3221 - // upper_bound: 100 - // > - // bucket: < - // cumulative_count: 4233 - // upper_bound: 200 - // > - // > -} - -func ExampleAlreadyRegisteredError() { - reqCounter := prometheus.NewCounter(prometheus.CounterOpts{ - Name: "requests_total", - Help: "The total number of requests served.", - }) - if err := prometheus.Register(reqCounter); err != nil { - if are, ok := err.(prometheus.AlreadyRegisteredError); ok { - // A counter for that metric has been registered before. - // Use the old counter from now on. - reqCounter = are.ExistingCollector.(prometheus.Counter) - } else { - // Something else went wrong! - panic(err) - } - } - reqCounter.Inc() -} - -func ExampleGatherers() { - reg := prometheus.NewRegistry() - temp := prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: "temperature_kelvin", - Help: "Temperature in Kelvin.", - }, - []string{"location"}, - ) - reg.MustRegister(temp) - temp.WithLabelValues("outside").Set(273.14) - temp.WithLabelValues("inside").Set(298.44) - - var parser expfmt.TextParser - - text := ` -# TYPE humidity_percent gauge -# HELP humidity_percent Humidity in %. -humidity_percent{location="outside"} 45.4 -humidity_percent{location="inside"} 33.2 -# TYPE temperature_kelvin gauge -# HELP temperature_kelvin Temperature in Kelvin. -temperature_kelvin{location="somewhere else"} 4.5 -` - - parseText := func() ([]*dto.MetricFamily, error) { - parsed, err := parser.TextToMetricFamilies(strings.NewReader(text)) - if err != nil { - return nil, err - } - var result []*dto.MetricFamily - for _, mf := range parsed { - result = append(result, mf) - } - return result, nil - } - - gatherers := prometheus.Gatherers{ - reg, - prometheus.GathererFunc(parseText), - } - - gathering, err := gatherers.Gather() - if err != nil { - fmt.Println(err) - } - - out := &bytes.Buffer{} - for _, mf := range gathering { - if _, err := expfmt.MetricFamilyToText(out, mf); err != nil { - panic(err) - } - } - fmt.Print(out.String()) - fmt.Println("----------") - - // Note how the temperature_kelvin metric family has been merged from - // different sources. Now try - text = ` -# TYPE humidity_percent gauge -# HELP humidity_percent Humidity in %. -humidity_percent{location="outside"} 45.4 -humidity_percent{location="inside"} 33.2 -# TYPE temperature_kelvin gauge -# HELP temperature_kelvin Temperature in Kelvin. -# Duplicate metric: -temperature_kelvin{location="outside"} 265.3 - # Missing location label (note that this is undesirable but valid): -temperature_kelvin 4.5 -` - - gathering, err = gatherers.Gather() - if err != nil { - fmt.Println(err) - } - // Note that still as many metrics as possible are returned: - out.Reset() - for _, mf := range gathering { - if _, err := expfmt.MetricFamilyToText(out, mf); err != nil { - panic(err) - } - } - fmt.Print(out.String()) - - // Output: - // # HELP humidity_percent Humidity in %. - // # TYPE humidity_percent gauge - // humidity_percent{location="inside"} 33.2 - // humidity_percent{location="outside"} 45.4 - // # HELP temperature_kelvin Temperature in Kelvin. - // # TYPE temperature_kelvin gauge - // temperature_kelvin{location="inside"} 298.44 - // temperature_kelvin{location="outside"} 273.14 - // temperature_kelvin{location="somewhere else"} 4.5 - // ---------- - // collected metric "temperature_kelvin" { label: gauge: } was collected before with the same name and label values - // # HELP humidity_percent Humidity in %. - // # TYPE humidity_percent gauge - // humidity_percent{location="inside"} 33.2 - // humidity_percent{location="outside"} 45.4 - // # HELP temperature_kelvin Temperature in Kelvin. - // # TYPE temperature_kelvin gauge - // temperature_kelvin 4.5 - // temperature_kelvin{location="inside"} 298.44 - // temperature_kelvin{location="outside"} 273.14 -} - -func ExampleNewMetricWithTimestamp() { - desc := prometheus.NewDesc( - "temperature_kelvin", - "Current temperature in Kelvin.", - nil, nil, - ) - - // Create a constant gauge from values we got from an external - // temperature reporting system. Those values are reported with a slight - // delay, so we want to add the timestamp of the actual measurement. - temperatureReportedByExternalSystem := 298.15 - timeReportedByExternalSystem := time.Date(2009, time.November, 10, 23, 0, 0, 12345678, time.UTC) - s := prometheus.NewMetricWithTimestamp( - timeReportedByExternalSystem, - prometheus.MustNewConstMetric( - desc, prometheus.GaugeValue, temperatureReportedByExternalSystem, - ), - ) - - // Just for demonstration, let's check the state of the gauge by - // (ab)using its Write method (which is usually only used by Prometheus - // internally). - metric := &dto.Metric{} - s.Write(metric) - fmt.Println(proto.MarshalTextString(metric)) - - // Output: - // gauge: < - // value: 298.15 - // > - // timestamp_ms: 1257894000012 -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go deleted file mode 100644 index 18a99d5fa..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "encoding/json" - "expvar" -) - -type expvarCollector struct { - exports map[string]*Desc -} - -// NewExpvarCollector returns a newly allocated expvar Collector that still has -// to be registered with a Prometheus registry. -// -// An expvar Collector collects metrics from the expvar interface. It provides a -// quick way to expose numeric values that are already exported via expvar as -// Prometheus metrics. Note that the data models of expvar and Prometheus are -// fundamentally different, and that the expvar Collector is inherently slower -// than native Prometheus metrics. Thus, the expvar Collector is probably great -// for experiments and prototying, but you should seriously consider a more -// direct implementation of Prometheus metrics for monitoring production -// systems. -// -// The exports map has the following meaning: -// -// The keys in the map correspond to expvar keys, i.e. for every expvar key you -// want to export as Prometheus metric, you need an entry in the exports -// map. The descriptor mapped to each key describes how to export the expvar -// value. It defines the name and the help string of the Prometheus metric -// proxying the expvar value. The type will always be Untyped. -// -// For descriptors without variable labels, the expvar value must be a number or -// a bool. The number is then directly exported as the Prometheus sample -// value. (For a bool, 'false' translates to 0 and 'true' to 1). Expvar values -// that are not numbers or bools are silently ignored. -// -// If the descriptor has one variable label, the expvar value must be an expvar -// map. The keys in the expvar map become the various values of the one -// Prometheus label. The values in the expvar map must be numbers or bools again -// as above. -// -// For descriptors with more than one variable label, the expvar must be a -// nested expvar map, i.e. where the values of the topmost map are maps again -// etc. until a depth is reached that corresponds to the number of labels. The -// leaves of that structure must be numbers or bools as above to serve as the -// sample values. -// -// Anything that does not fit into the scheme above is silently ignored. -func NewExpvarCollector(exports map[string]*Desc) Collector { - return &expvarCollector{ - exports: exports, - } -} - -// Describe implements Collector. -func (e *expvarCollector) Describe(ch chan<- *Desc) { - for _, desc := range e.exports { - ch <- desc - } -} - -// Collect implements Collector. -func (e *expvarCollector) Collect(ch chan<- Metric) { - for name, desc := range e.exports { - var m Metric - expVar := expvar.Get(name) - if expVar == nil { - continue - } - var v interface{} - labels := make([]string, len(desc.variableLabels)) - if err := json.Unmarshal([]byte(expVar.String()), &v); err != nil { - ch <- NewInvalidMetric(desc, err) - continue - } - var processValue func(v interface{}, i int) - processValue = func(v interface{}, i int) { - if i >= len(labels) { - copiedLabels := append(make([]string, 0, len(labels)), labels...) - switch v := v.(type) { - case float64: - m = MustNewConstMetric(desc, UntypedValue, v, copiedLabels...) - case bool: - if v { - m = MustNewConstMetric(desc, UntypedValue, 1, copiedLabels...) - } else { - m = MustNewConstMetric(desc, UntypedValue, 0, copiedLabels...) - } - default: - return - } - ch <- m - return - } - vm, ok := v.(map[string]interface{}) - if !ok { - return - } - for lv, val := range vm { - labels[i] = lv - processValue(val, i+1) - } - } - processValue(v, 0) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector_test.go b/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector_test.go deleted file mode 100644 index 6bcd9b692..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector_test.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus_test - -import ( - "expvar" - "fmt" - "sort" - "strings" - - dto "github.com/prometheus/client_model/go" - - "github.com/prometheus/client_golang/prometheus" -) - -func ExampleNewExpvarCollector() { - expvarCollector := prometheus.NewExpvarCollector(map[string]*prometheus.Desc{ - "memstats": prometheus.NewDesc( - "expvar_memstats", - "All numeric memstats as one metric family. Not a good role-model, actually... ;-)", - []string{"type"}, nil, - ), - "lone-int": prometheus.NewDesc( - "expvar_lone_int", - "Just an expvar int as an example.", - nil, nil, - ), - "http-request-map": prometheus.NewDesc( - "expvar_http_request_total", - "How many http requests processed, partitioned by status code and http method.", - []string{"code", "method"}, nil, - ), - }) - prometheus.MustRegister(expvarCollector) - - // The Prometheus part is done here. But to show that this example is - // doing anything, we have to manually export something via expvar. In - // real-life use-cases, some library would already have exported via - // expvar what we want to re-export as Prometheus metrics. - expvar.NewInt("lone-int").Set(42) - expvarMap := expvar.NewMap("http-request-map") - var ( - expvarMap1, expvarMap2 expvar.Map - expvarInt11, expvarInt12, expvarInt21, expvarInt22 expvar.Int - ) - expvarMap1.Init() - expvarMap2.Init() - expvarInt11.Set(3) - expvarInt12.Set(13) - expvarInt21.Set(11) - expvarInt22.Set(212) - expvarMap1.Set("POST", &expvarInt11) - expvarMap1.Set("GET", &expvarInt12) - expvarMap2.Set("POST", &expvarInt21) - expvarMap2.Set("GET", &expvarInt22) - expvarMap.Set("404", &expvarMap1) - expvarMap.Set("200", &expvarMap2) - // Results in the following expvar map: - // "http-request-count": {"200": {"POST": 11, "GET": 212}, "404": {"POST": 3, "GET": 13}} - - // Let's see what the scrape would yield, but exclude the memstats metrics. - metricStrings := []string{} - metric := dto.Metric{} - metricChan := make(chan prometheus.Metric) - go func() { - expvarCollector.Collect(metricChan) - close(metricChan) - }() - for m := range metricChan { - if !strings.Contains(m.Desc().String(), "expvar_memstats") { - metric.Reset() - m.Write(&metric) - metricStrings = append(metricStrings, metric.String()) - } - } - sort.Strings(metricStrings) - for _, s := range metricStrings { - fmt.Println(strings.TrimRight(s, " ")) - } - // Output: - // label: label: untyped: - // label: label: untyped: - // label: label: untyped: - // label: label: untyped: - // untyped: -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/fnv.go b/vendor/github.com/prometheus/client_golang/prometheus/fnv.go deleted file mode 100644 index 3d383a735..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/fnv.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2018 The Prometheus 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 prometheus - -// Inline and byte-free variant of hash/fnv's fnv64a. - -const ( - offset64 = 14695981039346656037 - prime64 = 1099511628211 -) - -// hashNew initializies a new fnv64a hash value. -func hashNew() uint64 { - return offset64 -} - -// hashAdd adds a string to a fnv64a hash value, returning the updated hash. -func hashAdd(h uint64, s string) uint64 { - for i := 0; i < len(s); i++ { - h ^= uint64(s[i]) - h *= prime64 - } - return h -} - -// hashAddByte adds a byte to a fnv64a hash value, returning the updated hash. -func hashAddByte(h uint64, b byte) uint64 { - h ^= uint64(b) - h *= prime64 - return h -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go b/vendor/github.com/prometheus/client_golang/prometheus/gauge.go deleted file mode 100644 index 17c72d7eb..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "math" - "sync/atomic" - "time" - - dto "github.com/prometheus/client_model/go" -) - -// Gauge is a Metric that represents a single numerical value that can -// arbitrarily go up and down. -// -// A Gauge is typically used for measured values like temperatures or current -// memory usage, but also "counts" that can go up and down, like the number of -// running goroutines. -// -// To create Gauge instances, use NewGauge. -type Gauge interface { - Metric - Collector - - // Set sets the Gauge to an arbitrary value. - Set(float64) - // Inc increments the Gauge by 1. Use Add to increment it by arbitrary - // values. - Inc() - // Dec decrements the Gauge by 1. Use Sub to decrement it by arbitrary - // values. - Dec() - // Add adds the given value to the Gauge. (The value can be negative, - // resulting in a decrease of the Gauge.) - Add(float64) - // Sub subtracts the given value from the Gauge. (The value can be - // negative, resulting in an increase of the Gauge.) - Sub(float64) - - // SetToCurrentTime sets the Gauge to the current Unix time in seconds. - SetToCurrentTime() -} - -// GaugeOpts is an alias for Opts. See there for doc comments. -type GaugeOpts Opts - -// NewGauge creates a new Gauge based on the provided GaugeOpts. -// -// The returned implementation is optimized for a fast Set method. If you have a -// choice for managing the value of a Gauge via Set vs. Inc/Dec/Add/Sub, pick -// the former. For example, the Inc method of the returned Gauge is slower than -// the Inc method of a Counter returned by NewCounter. This matches the typical -// scenarios for Gauges and Counters, where the former tends to be Set-heavy and -// the latter Inc-heavy. -func NewGauge(opts GaugeOpts) Gauge { - desc := NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - nil, - opts.ConstLabels, - ) - result := &gauge{desc: desc, labelPairs: desc.constLabelPairs} - result.init(result) // Init self-collection. - return result -} - -type gauge struct { - // valBits contains the bits of the represented float64 value. It has - // to go first in the struct to guarantee alignment for atomic - // operations. http://golang.org/pkg/sync/atomic/#pkg-note-BUG - valBits uint64 - - selfCollector - - desc *Desc - labelPairs []*dto.LabelPair -} - -func (g *gauge) Desc() *Desc { - return g.desc -} - -func (g *gauge) Set(val float64) { - atomic.StoreUint64(&g.valBits, math.Float64bits(val)) -} - -func (g *gauge) SetToCurrentTime() { - g.Set(float64(time.Now().UnixNano()) / 1e9) -} - -func (g *gauge) Inc() { - g.Add(1) -} - -func (g *gauge) Dec() { - g.Add(-1) -} - -func (g *gauge) Add(val float64) { - for { - oldBits := atomic.LoadUint64(&g.valBits) - newBits := math.Float64bits(math.Float64frombits(oldBits) + val) - if atomic.CompareAndSwapUint64(&g.valBits, oldBits, newBits) { - return - } - } -} - -func (g *gauge) Sub(val float64) { - g.Add(val * -1) -} - -func (g *gauge) Write(out *dto.Metric) error { - val := math.Float64frombits(atomic.LoadUint64(&g.valBits)) - return populateMetric(GaugeValue, val, g.labelPairs, out) -} - -// GaugeVec is a Collector that bundles a set of Gauges that all share the same -// Desc, but have different values for their variable labels. This is used if -// you want to count the same thing partitioned by various dimensions -// (e.g. number of operations queued, partitioned by user and operation -// type). Create instances with NewGaugeVec. -type GaugeVec struct { - *metricVec -} - -// NewGaugeVec creates a new GaugeVec based on the provided GaugeOpts and -// partitioned by the given label names. -func NewGaugeVec(opts GaugeOpts, labelNames []string) *GaugeVec { - desc := NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - labelNames, - opts.ConstLabels, - ) - return &GaugeVec{ - metricVec: newMetricVec(desc, func(lvs ...string) Metric { - if len(lvs) != len(desc.variableLabels) { - panic(errInconsistentCardinality) - } - result := &gauge{desc: desc, labelPairs: makeLabelPairs(desc, lvs)} - result.init(result) // Init self-collection. - return result - }), - } -} - -// GetMetricWithLabelValues returns the Gauge for the given slice of label -// values (same order as the VariableLabels in Desc). If that combination of -// label values is accessed for the first time, a new Gauge is created. -// -// It is possible to call this method without using the returned Gauge to only -// create the new Gauge but leave it at its starting value 0. See also the -// SummaryVec example. -// -// Keeping the Gauge for later use is possible (and should be considered if -// performance is critical), but keep in mind that Reset, DeleteLabelValues and -// Delete can be used to delete the Gauge from the GaugeVec. In that case, the -// Gauge will still exist, but it will not be exported anymore, even if a -// Gauge with the same label values is created later. See also the CounterVec -// example. -// -// An error is returned if the number of label values is not the same as the -// number of VariableLabels in Desc (minus any curried labels). -// -// Note that for more than one label value, this method is prone to mistakes -// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as -// an alternative to avoid that type of mistake. For higher label numbers, the -// latter has a much more readable (albeit more verbose) syntax, but it comes -// with a performance overhead (for creating and processing the Labels map). -func (v *GaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) { - metric, err := v.metricVec.getMetricWithLabelValues(lvs...) - if metric != nil { - return metric.(Gauge), err - } - return nil, err -} - -// GetMetricWith returns the Gauge for the given Labels map (the label names -// must match those of the VariableLabels in Desc). If that label map is -// accessed for the first time, a new Gauge is created. Implications of -// creating a Gauge without using it and keeping the Gauge for later use are -// the same as for GetMetricWithLabelValues. -// -// An error is returned if the number and names of the Labels are inconsistent -// with those of the VariableLabels in Desc (minus any curried labels). -// -// This method is used for the same purpose as -// GetMetricWithLabelValues(...string). See there for pros and cons of the two -// methods. -func (v *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) { - metric, err := v.metricVec.getMetricWith(labels) - if metric != nil { - return metric.(Gauge), err - } - return nil, err -} - -// WithLabelValues works as GetMetricWithLabelValues, but panics where -// GetMetricWithLabelValues would have returned an error. Not returning an -// error allows shortcuts like -// myVec.WithLabelValues("404", "GET").Add(42) -func (v *GaugeVec) WithLabelValues(lvs ...string) Gauge { - g, err := v.GetMetricWithLabelValues(lvs...) - if err != nil { - panic(err) - } - return g -} - -// With works as GetMetricWith, but panics where GetMetricWithLabels would have -// returned an error. Not returning an error allows shortcuts like -// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42) -func (v *GaugeVec) With(labels Labels) Gauge { - g, err := v.GetMetricWith(labels) - if err != nil { - panic(err) - } - return g -} - -// CurryWith returns a vector curried with the provided labels, i.e. the -// returned vector has those labels pre-set for all labeled operations performed -// on it. The cardinality of the curried vector is reduced accordingly. The -// order of the remaining labels stays the same (just with the curried labels -// taken out of the sequence – which is relevant for the -// (GetMetric)WithLabelValues methods). It is possible to curry a curried -// vector, but only with labels not yet used for currying before. -// -// The metrics contained in the GaugeVec are shared between the curried and -// uncurried vectors. They are just accessed differently. Curried and uncurried -// vectors behave identically in terms of collection. Only one must be -// registered with a given registry (usually the uncurried version). The Reset -// method deletes all metrics, even if called on a curried vector. -func (v *GaugeVec) CurryWith(labels Labels) (*GaugeVec, error) { - vec, err := v.curryWith(labels) - if vec != nil { - return &GaugeVec{vec}, err - } - return nil, err -} - -// MustCurryWith works as CurryWith but panics where CurryWith would have -// returned an error. -func (v *GaugeVec) MustCurryWith(labels Labels) *GaugeVec { - vec, err := v.CurryWith(labels) - if err != nil { - panic(err) - } - return vec -} - -// GaugeFunc is a Gauge whose value is determined at collect time by calling a -// provided function. -// -// To create GaugeFunc instances, use NewGaugeFunc. -type GaugeFunc interface { - Metric - Collector -} - -// NewGaugeFunc creates a new GaugeFunc based on the provided GaugeOpts. The -// value reported is determined by calling the given function from within the -// Write method. Take into account that metric collection may happen -// concurrently. If that results in concurrent calls to Write, like in the case -// where a GaugeFunc is directly registered with Prometheus, the provided -// function must be concurrency-safe. -func NewGaugeFunc(opts GaugeOpts, function func() float64) GaugeFunc { - return newValueFunc(NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - nil, - opts.ConstLabels, - ), GaugeValue, function) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/gauge_test.go b/vendor/github.com/prometheus/client_golang/prometheus/gauge_test.go deleted file mode 100644 index a2e3c1416..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/gauge_test.go +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "math" - "math/rand" - "sync" - "testing" - "testing/quick" - "time" - - dto "github.com/prometheus/client_model/go" -) - -func listenGaugeStream(vals, result chan float64, done chan struct{}) { - var sum float64 -outer: - for { - select { - case <-done: - close(vals) - for v := range vals { - sum += v - } - break outer - case v := <-vals: - sum += v - } - } - result <- sum - close(result) -} - -func TestGaugeConcurrency(t *testing.T) { - it := func(n uint32) bool { - mutations := int(n % 10000) - concLevel := int(n%15 + 1) - - var start, end sync.WaitGroup - start.Add(1) - end.Add(concLevel) - - sStream := make(chan float64, mutations*concLevel) - result := make(chan float64) - done := make(chan struct{}) - - go listenGaugeStream(sStream, result, done) - go func() { - end.Wait() - close(done) - }() - - gge := NewGauge(GaugeOpts{ - Name: "test_gauge", - Help: "no help can be found here", - }) - for i := 0; i < concLevel; i++ { - vals := make([]float64, mutations) - for j := 0; j < mutations; j++ { - vals[j] = rand.Float64() - 0.5 - } - - go func(vals []float64) { - start.Wait() - for _, v := range vals { - sStream <- v - gge.Add(v) - } - end.Done() - }(vals) - } - start.Done() - - if expected, got := <-result, math.Float64frombits(gge.(*gauge).valBits); math.Abs(expected-got) > 0.000001 { - t.Fatalf("expected approx. %f, got %f", expected, got) - return false - } - return true - } - - if err := quick.Check(it, nil); err != nil { - t.Fatal(err) - } -} - -func TestGaugeVecConcurrency(t *testing.T) { - it := func(n uint32) bool { - mutations := int(n % 10000) - concLevel := int(n%15 + 1) - vecLength := int(n%5 + 1) - - var start, end sync.WaitGroup - start.Add(1) - end.Add(concLevel) - - sStreams := make([]chan float64, vecLength) - results := make([]chan float64, vecLength) - done := make(chan struct{}) - - for i := 0; i < vecLength; i++ { - sStreams[i] = make(chan float64, mutations*concLevel) - results[i] = make(chan float64) - go listenGaugeStream(sStreams[i], results[i], done) - } - - go func() { - end.Wait() - close(done) - }() - - gge := NewGaugeVec( - GaugeOpts{ - Name: "test_gauge", - Help: "no help can be found here", - }, - []string{"label"}, - ) - for i := 0; i < concLevel; i++ { - vals := make([]float64, mutations) - pick := make([]int, mutations) - for j := 0; j < mutations; j++ { - vals[j] = rand.Float64() - 0.5 - pick[j] = rand.Intn(vecLength) - } - - go func(vals []float64) { - start.Wait() - for i, v := range vals { - sStreams[pick[i]] <- v - gge.WithLabelValues(string('A' + pick[i])).Add(v) - } - end.Done() - }(vals) - } - start.Done() - - for i := range sStreams { - if expected, got := <-results[i], math.Float64frombits(gge.WithLabelValues(string('A'+i)).(*gauge).valBits); math.Abs(expected-got) > 0.000001 { - t.Fatalf("expected approx. %f, got %f", expected, got) - return false - } - } - return true - } - - if err := quick.Check(it, nil); err != nil { - t.Fatal(err) - } -} - -func TestGaugeFunc(t *testing.T) { - gf := NewGaugeFunc( - GaugeOpts{ - Name: "test_name", - Help: "test help", - ConstLabels: Labels{"a": "1", "b": "2"}, - }, - func() float64 { return 3.1415 }, - ) - - if expected, got := `Desc{fqName: "test_name", help: "test help", constLabels: {a="1",b="2"}, variableLabels: []}`, gf.Desc().String(); expected != got { - t.Errorf("expected %q, got %q", expected, got) - } - - m := &dto.Metric{} - gf.Write(m) - - if expected, got := `label: label: gauge: `, m.String(); expected != got { - t.Errorf("expected %q, got %q", expected, got) - } -} - -func TestGaugeSetCurrentTime(t *testing.T) { - g := NewGauge(GaugeOpts{ - Name: "test_name", - Help: "test help", - }) - g.SetToCurrentTime() - unixTime := float64(time.Now().Unix()) - - m := &dto.Metric{} - g.Write(m) - - delta := unixTime - m.GetGauge().GetValue() - // This is just a smoke test to make sure SetToCurrentTime is not - // totally off. Tests with current time involved are hard... - if math.Abs(delta) > 5 { - t.Errorf("Gauge set to current time deviates from current time by more than 5s, delta is %f seconds", delta) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go deleted file mode 100644 index ba3b9333e..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright 2018 The Prometheus 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 prometheus - -import ( - "fmt" - "runtime" - "runtime/debug" - "time" -) - -type goCollector struct { - goroutinesDesc *Desc - threadsDesc *Desc - gcDesc *Desc - goInfoDesc *Desc - - // metrics to describe and collect - metrics memStatsMetrics -} - -// NewGoCollector returns a collector which exports metrics about the current Go -// process. This includes memory stats. To collect those, runtime.ReadMemStats -// is called. This causes a stop-the-world, which is very short with Go1.9+ -// (~25µs). However, with older Go versions, the stop-the-world duration depends -// on the heap size and can be quite significant (~1.7 ms/GiB as per -// https://go-review.googlesource.com/c/go/+/34937). -func NewGoCollector() Collector { - return &goCollector{ - goroutinesDesc: NewDesc( - "go_goroutines", - "Number of goroutines that currently exist.", - nil, nil), - threadsDesc: NewDesc( - "go_threads", - "Number of OS threads created.", - nil, nil), - gcDesc: NewDesc( - "go_gc_duration_seconds", - "A summary of the GC invocation durations.", - nil, nil), - goInfoDesc: NewDesc( - "go_info", - "Information about the Go environment.", - nil, Labels{"version": runtime.Version()}), - metrics: memStatsMetrics{ - { - desc: NewDesc( - memstatNamespace("alloc_bytes"), - "Number of bytes allocated and still in use.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.Alloc) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("alloc_bytes_total"), - "Total number of bytes allocated, even if freed.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.TotalAlloc) }, - valType: CounterValue, - }, { - desc: NewDesc( - memstatNamespace("sys_bytes"), - "Number of bytes obtained from system.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.Sys) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("lookups_total"), - "Total number of pointer lookups.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.Lookups) }, - valType: CounterValue, - }, { - desc: NewDesc( - memstatNamespace("mallocs_total"), - "Total number of mallocs.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.Mallocs) }, - valType: CounterValue, - }, { - desc: NewDesc( - memstatNamespace("frees_total"), - "Total number of frees.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.Frees) }, - valType: CounterValue, - }, { - desc: NewDesc( - memstatNamespace("heap_alloc_bytes"), - "Number of heap bytes allocated and still in use.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapAlloc) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("heap_sys_bytes"), - "Number of heap bytes obtained from system.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapSys) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("heap_idle_bytes"), - "Number of heap bytes waiting to be used.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapIdle) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("heap_inuse_bytes"), - "Number of heap bytes that are in use.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapInuse) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("heap_released_bytes"), - "Number of heap bytes released to OS.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapReleased) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("heap_objects"), - "Number of allocated objects.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapObjects) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("stack_inuse_bytes"), - "Number of bytes in use by the stack allocator.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackInuse) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("stack_sys_bytes"), - "Number of bytes obtained from system for stack allocator.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackSys) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("mspan_inuse_bytes"), - "Number of bytes in use by mspan structures.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanInuse) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("mspan_sys_bytes"), - "Number of bytes used for mspan structures obtained from system.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanSys) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("mcache_inuse_bytes"), - "Number of bytes in use by mcache structures.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheInuse) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("mcache_sys_bytes"), - "Number of bytes used for mcache structures obtained from system.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheSys) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("buck_hash_sys_bytes"), - "Number of bytes used by the profiling bucket hash table.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.BuckHashSys) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("gc_sys_bytes"), - "Number of bytes used for garbage collection system metadata.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.GCSys) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("other_sys_bytes"), - "Number of bytes used for other system allocations.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.OtherSys) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("next_gc_bytes"), - "Number of heap bytes when next garbage collection will take place.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.NextGC) }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("last_gc_time_seconds"), - "Number of seconds since 1970 of last garbage collection.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return float64(ms.LastGC) / 1e9 }, - valType: GaugeValue, - }, { - desc: NewDesc( - memstatNamespace("gc_cpu_fraction"), - "The fraction of this program's available CPU time used by the GC since the program started.", - nil, nil, - ), - eval: func(ms *runtime.MemStats) float64 { return ms.GCCPUFraction }, - valType: GaugeValue, - }, - }, - } -} - -func memstatNamespace(s string) string { - return fmt.Sprintf("go_memstats_%s", s) -} - -// Describe returns all descriptions of the collector. -func (c *goCollector) Describe(ch chan<- *Desc) { - ch <- c.goroutinesDesc - ch <- c.threadsDesc - ch <- c.gcDesc - ch <- c.goInfoDesc - for _, i := range c.metrics { - ch <- i.desc - } -} - -// Collect returns the current state of all metrics of the collector. -func (c *goCollector) Collect(ch chan<- Metric) { - ch <- MustNewConstMetric(c.goroutinesDesc, GaugeValue, float64(runtime.NumGoroutine())) - n, _ := runtime.ThreadCreateProfile(nil) - ch <- MustNewConstMetric(c.threadsDesc, GaugeValue, float64(n)) - - var stats debug.GCStats - stats.PauseQuantiles = make([]time.Duration, 5) - debug.ReadGCStats(&stats) - - quantiles := make(map[float64]float64) - for idx, pq := range stats.PauseQuantiles[1:] { - quantiles[float64(idx+1)/float64(len(stats.PauseQuantiles)-1)] = pq.Seconds() - } - quantiles[0.0] = stats.PauseQuantiles[0].Seconds() - ch <- MustNewConstSummary(c.gcDesc, uint64(stats.NumGC), stats.PauseTotal.Seconds(), quantiles) - - ch <- MustNewConstMetric(c.goInfoDesc, GaugeValue, 1) - - ms := &runtime.MemStats{} - runtime.ReadMemStats(ms) - for _, i := range c.metrics { - ch <- MustNewConstMetric(i.desc, i.valType, i.eval(ms)) - } -} - -// memStatsMetrics provide description, value, and value type for memstat metrics. -type memStatsMetrics []struct { - desc *Desc - eval func(*runtime.MemStats) float64 - valType ValueType -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_test.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector_test.go deleted file mode 100644 index f93dcdcfc..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_test.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2018 The Prometheus 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 prometheus - -import ( - "runtime" - "testing" - "time" - - dto "github.com/prometheus/client_model/go" -) - -func TestGoCollector(t *testing.T) { - var ( - c = NewGoCollector() - ch = make(chan Metric) - waitc = make(chan struct{}) - closec = make(chan struct{}) - old = -1 - ) - defer close(closec) - - go func() { - c.Collect(ch) - go func(c <-chan struct{}) { - <-c - }(closec) - <-waitc - c.Collect(ch) - }() - - for { - select { - case m := <-ch: - // m can be Gauge or Counter, - // currently just test the go_goroutines Gauge - // and ignore others. - if m.Desc().fqName != "go_goroutines" { - continue - } - pb := &dto.Metric{} - m.Write(pb) - if pb.GetGauge() == nil { - continue - } - - if old == -1 { - old = int(pb.GetGauge().GetValue()) - close(waitc) - continue - } - - if diff := int(pb.GetGauge().GetValue()) - old; diff != 1 { - // TODO: This is flaky in highly concurrent situations. - t.Errorf("want 1 new goroutine, got %d", diff) - } - - // GoCollector performs three sends per call. - // On line 27 we need to receive three more sends - // to shut down cleanly. - <-ch - <-ch - <-ch - return - case <-time.After(1 * time.Second): - t.Fatalf("expected collect timed out") - } - } -} - -func TestGCCollector(t *testing.T) { - var ( - c = NewGoCollector() - ch = make(chan Metric) - waitc = make(chan struct{}) - closec = make(chan struct{}) - oldGC uint64 - oldPause float64 - ) - defer close(closec) - - go func() { - c.Collect(ch) - // force GC - runtime.GC() - <-waitc - c.Collect(ch) - }() - - first := true - for { - select { - case metric := <-ch: - pb := &dto.Metric{} - metric.Write(pb) - if pb.GetSummary() == nil { - continue - } - if len(pb.GetSummary().Quantile) != 5 { - t.Errorf("expected 4 buckets, got %d", len(pb.GetSummary().Quantile)) - } - for idx, want := range []float64{0.0, 0.25, 0.5, 0.75, 1.0} { - if *pb.GetSummary().Quantile[idx].Quantile != want { - t.Errorf("bucket #%d is off, got %f, want %f", idx, *pb.GetSummary().Quantile[idx].Quantile, want) - } - } - if first { - first = false - oldGC = *pb.GetSummary().SampleCount - oldPause = *pb.GetSummary().SampleSum - close(waitc) - continue - } - if diff := *pb.GetSummary().SampleCount - oldGC; diff != 1 { - t.Errorf("want 1 new garbage collection run, got %d", diff) - } - if diff := *pb.GetSummary().SampleSum - oldPause; diff <= 0 { - t.Errorf("want moar pause, got %f", diff) - } - return - case <-time.After(1 * time.Second): - t.Fatalf("expected collect timed out") - } - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/graphite/bridge.go b/vendor/github.com/prometheus/client_golang/prometheus/graphite/bridge.go deleted file mode 100644 index 466e2295d..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/graphite/bridge.go +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright 2016 The Prometheus 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 graphite provides a bridge to push Prometheus metrics to a Graphite -// server. -package graphite - -import ( - "bufio" - "errors" - "fmt" - "io" - "net" - "sort" - "time" - - "github.com/prometheus/common/expfmt" - "github.com/prometheus/common/model" - "golang.org/x/net/context" - - dto "github.com/prometheus/client_model/go" - - "github.com/prometheus/client_golang/prometheus" -) - -const ( - defaultInterval = 15 * time.Second - millisecondsPerSecond = 1000 -) - -// HandlerErrorHandling defines how a Handler serving metrics will handle -// errors. -type HandlerErrorHandling int - -// These constants cause handlers serving metrics to behave as described if -// errors are encountered. -const ( - // Ignore errors and try to push as many metrics to Graphite as possible. - ContinueOnError HandlerErrorHandling = iota - - // Abort the push to Graphite upon the first error encountered. - AbortOnError -) - -// Config defines the Graphite bridge config. -type Config struct { - // The url to push data to. Required. - URL string - - // The prefix for the pushed Graphite metrics. Defaults to empty string. - Prefix string - - // The interval to use for pushing data to Graphite. Defaults to 15 seconds. - Interval time.Duration - - // The timeout for pushing metrics to Graphite. Defaults to 15 seconds. - Timeout time.Duration - - // The Gatherer to use for metrics. Defaults to prometheus.DefaultGatherer. - Gatherer prometheus.Gatherer - - // The logger that messages are written to. Defaults to no logging. - Logger Logger - - // ErrorHandling defines how errors are handled. Note that errors are - // logged regardless of the configured ErrorHandling provided Logger - // is not nil. - ErrorHandling HandlerErrorHandling -} - -// Bridge pushes metrics to the configured Graphite server. -type Bridge struct { - url string - prefix string - interval time.Duration - timeout time.Duration - - errorHandling HandlerErrorHandling - logger Logger - - g prometheus.Gatherer -} - -// Logger is the minimal interface Bridge needs for logging. Note that -// log.Logger from the standard library implements this interface, and it is -// easy to implement by custom loggers, if they don't do so already anyway. -type Logger interface { - Println(v ...interface{}) -} - -// NewBridge returns a pointer to a new Bridge struct. -func NewBridge(c *Config) (*Bridge, error) { - b := &Bridge{} - - if c.URL == "" { - return nil, errors.New("missing URL") - } - b.url = c.URL - - if c.Gatherer == nil { - b.g = prometheus.DefaultGatherer - } else { - b.g = c.Gatherer - } - - if c.Logger != nil { - b.logger = c.Logger - } - - if c.Prefix != "" { - b.prefix = c.Prefix - } - - var z time.Duration - if c.Interval == z { - b.interval = defaultInterval - } else { - b.interval = c.Interval - } - - if c.Timeout == z { - b.timeout = defaultInterval - } else { - b.timeout = c.Timeout - } - - b.errorHandling = c.ErrorHandling - - return b, nil -} - -// Run starts the event loop that pushes Prometheus metrics to Graphite at the -// configured interval. -func (b *Bridge) Run(ctx context.Context) { - ticker := time.NewTicker(b.interval) - defer ticker.Stop() - for { - select { - case <-ticker.C: - if err := b.Push(); err != nil && b.logger != nil { - b.logger.Println("error pushing to Graphite:", err) - } - case <-ctx.Done(): - return - } - } -} - -// Push pushes Prometheus metrics to the configured Graphite server. -func (b *Bridge) Push() error { - mfs, err := b.g.Gather() - if err != nil || len(mfs) == 0 { - switch b.errorHandling { - case AbortOnError: - return err - case ContinueOnError: - if b.logger != nil { - b.logger.Println("continue on error:", err) - } - default: - panic("unrecognized error handling value") - } - } - - conn, err := net.DialTimeout("tcp", b.url, b.timeout) - if err != nil { - return err - } - defer conn.Close() - - return writeMetrics(conn, mfs, b.prefix, model.Now()) -} - -func writeMetrics(w io.Writer, mfs []*dto.MetricFamily, prefix string, now model.Time) error { - vec, err := expfmt.ExtractSamples(&expfmt.DecodeOptions{ - Timestamp: now, - }, mfs...) - if err != nil { - return err - } - - buf := bufio.NewWriter(w) - for _, s := range vec { - for _, c := range prefix { - if _, err := buf.WriteRune(c); err != nil { - return err - } - } - if err := buf.WriteByte('.'); err != nil { - return err - } - if err := writeMetric(buf, s.Metric); err != nil { - return err - } - if _, err := fmt.Fprintf(buf, " %g %d\n", s.Value, int64(s.Timestamp)/millisecondsPerSecond); err != nil { - return err - } - if err := buf.Flush(); err != nil { - return err - } - } - - return nil -} - -func writeMetric(buf *bufio.Writer, m model.Metric) error { - metricName, hasName := m[model.MetricNameLabel] - numLabels := len(m) - 1 - if !hasName { - numLabels = len(m) - } - - labelStrings := make([]string, 0, numLabels) - for label, value := range m { - if label != model.MetricNameLabel { - labelStrings = append(labelStrings, fmt.Sprintf("%s %s", string(label), string(value))) - } - } - - var err error - switch numLabels { - case 0: - if hasName { - return writeSanitized(buf, string(metricName)) - } - default: - sort.Strings(labelStrings) - if err = writeSanitized(buf, string(metricName)); err != nil { - return err - } - for _, s := range labelStrings { - if err = buf.WriteByte('.'); err != nil { - return err - } - if err = writeSanitized(buf, s); err != nil { - return err - } - } - } - return nil -} - -func writeSanitized(buf *bufio.Writer, s string) error { - prevUnderscore := false - - for _, c := range s { - c = replaceInvalidRune(c) - if c == '_' { - if prevUnderscore { - continue - } - prevUnderscore = true - } else { - prevUnderscore = false - } - if _, err := buf.WriteRune(c); err != nil { - return err - } - } - - return nil -} - -func replaceInvalidRune(c rune) rune { - if c == ' ' { - return '.' - } - if !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == ':' || c == '-' || (c >= '0' && c <= '9')) { - return '_' - } - return c -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/graphite/bridge_test.go b/vendor/github.com/prometheus/client_golang/prometheus/graphite/bridge_test.go deleted file mode 100644 index 471edfe40..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/graphite/bridge_test.go +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright 2018 The Prometheus 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 graphite - -import ( - "bufio" - "bytes" - "fmt" - "io" - "log" - "net" - "os" - "regexp" - "testing" - "time" - - "github.com/prometheus/common/model" - "golang.org/x/net/context" - - "github.com/prometheus/client_golang/prometheus" -) - -func TestSanitize(t *testing.T) { - testCases := []struct { - in, out string - }{ - {in: "hello", out: "hello"}, - {in: "hE/l1o", out: "hE_l1o"}, - {in: "he,*ll(.o", out: "he_ll_o"}, - {in: "hello_there%^&", out: "hello_there_"}, - {in: "hell-.o", out: "hell-_o"}, - } - - var buf bytes.Buffer - w := bufio.NewWriter(&buf) - - for i, tc := range testCases { - if err := writeSanitized(w, tc.in); err != nil { - t.Fatalf("write failed: %v", err) - } - if err := w.Flush(); err != nil { - t.Fatalf("flush failed: %v", err) - } - - if want, got := tc.out, buf.String(); want != got { - t.Fatalf("test case index %d: got sanitized string %s, want %s", i, got, want) - } - - buf.Reset() - } -} - -func TestWriteSummary(t *testing.T) { - sumVec := prometheus.NewSummaryVec( - prometheus.SummaryOpts{ - Name: "name", - Help: "docstring", - ConstLabels: prometheus.Labels{"constname": "constvalue"}, - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - []string{"labelname"}, - ) - - sumVec.WithLabelValues("val1").Observe(float64(10)) - sumVec.WithLabelValues("val1").Observe(float64(20)) - sumVec.WithLabelValues("val1").Observe(float64(30)) - sumVec.WithLabelValues("val2").Observe(float64(20)) - sumVec.WithLabelValues("val2").Observe(float64(30)) - sumVec.WithLabelValues("val2").Observe(float64(40)) - - reg := prometheus.NewRegistry() - reg.MustRegister(sumVec) - - mfs, err := reg.Gather() - if err != nil { - t.Fatalf("error: %v", err) - } - - testCases := []struct { - prefix string - }{ - {prefix: "prefix"}, - {prefix: "pre/fix"}, - {prefix: "pre.fix"}, - } - - const want = `%s.name.constname.constvalue.labelname.val1.quantile.0_5 20 1477043 -%s.name.constname.constvalue.labelname.val1.quantile.0_9 30 1477043 -%s.name.constname.constvalue.labelname.val1.quantile.0_99 30 1477043 -%s.name_sum.constname.constvalue.labelname.val1 60 1477043 -%s.name_count.constname.constvalue.labelname.val1 3 1477043 -%s.name.constname.constvalue.labelname.val2.quantile.0_5 30 1477043 -%s.name.constname.constvalue.labelname.val2.quantile.0_9 40 1477043 -%s.name.constname.constvalue.labelname.val2.quantile.0_99 40 1477043 -%s.name_sum.constname.constvalue.labelname.val2 90 1477043 -%s.name_count.constname.constvalue.labelname.val2 3 1477043 -` - for i, tc := range testCases { - - now := model.Time(1477043083) - var buf bytes.Buffer - err = writeMetrics(&buf, mfs, tc.prefix, now) - if err != nil { - t.Fatalf("error: %v", err) - } - - wantWithPrefix := fmt.Sprintf(want, - tc.prefix, tc.prefix, tc.prefix, tc.prefix, tc.prefix, - tc.prefix, tc.prefix, tc.prefix, tc.prefix, tc.prefix, - ) - if got := buf.String(); wantWithPrefix != got { - t.Fatalf("test case index %d: wanted \n%s\n, got \n%s\n", i, wantWithPrefix, got) - } - } -} - -func TestWriteHistogram(t *testing.T) { - histVec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "name", - Help: "docstring", - ConstLabels: prometheus.Labels{"constname": "constvalue"}, - Buckets: []float64{0.01, 0.02, 0.05, 0.1}, - }, - []string{"labelname"}, - ) - - histVec.WithLabelValues("val1").Observe(float64(10)) - histVec.WithLabelValues("val1").Observe(float64(20)) - histVec.WithLabelValues("val1").Observe(float64(30)) - histVec.WithLabelValues("val2").Observe(float64(20)) - histVec.WithLabelValues("val2").Observe(float64(30)) - histVec.WithLabelValues("val2").Observe(float64(40)) - - reg := prometheus.NewRegistry() - reg.MustRegister(histVec) - - mfs, err := reg.Gather() - if err != nil { - t.Fatalf("error: %v", err) - } - - now := model.Time(1477043083) - var buf bytes.Buffer - err = writeMetrics(&buf, mfs, "prefix", now) - if err != nil { - t.Fatalf("error: %v", err) - } - - want := `prefix.name_bucket.constname.constvalue.labelname.val1.le.0_01 0 1477043 -prefix.name_bucket.constname.constvalue.labelname.val1.le.0_02 0 1477043 -prefix.name_bucket.constname.constvalue.labelname.val1.le.0_05 0 1477043 -prefix.name_bucket.constname.constvalue.labelname.val1.le.0_1 0 1477043 -prefix.name_sum.constname.constvalue.labelname.val1 60 1477043 -prefix.name_count.constname.constvalue.labelname.val1 3 1477043 -prefix.name_bucket.constname.constvalue.labelname.val1.le._Inf 3 1477043 -prefix.name_bucket.constname.constvalue.labelname.val2.le.0_01 0 1477043 -prefix.name_bucket.constname.constvalue.labelname.val2.le.0_02 0 1477043 -prefix.name_bucket.constname.constvalue.labelname.val2.le.0_05 0 1477043 -prefix.name_bucket.constname.constvalue.labelname.val2.le.0_1 0 1477043 -prefix.name_sum.constname.constvalue.labelname.val2 90 1477043 -prefix.name_count.constname.constvalue.labelname.val2 3 1477043 -prefix.name_bucket.constname.constvalue.labelname.val2.le._Inf 3 1477043 -` - if got := buf.String(); want != got { - t.Fatalf("wanted \n%s\n, got \n%s\n", want, got) - } -} - -func TestToReader(t *testing.T) { - cntVec := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "name", - Help: "docstring", - ConstLabels: prometheus.Labels{"constname": "constvalue"}, - }, - []string{"labelname"}, - ) - cntVec.WithLabelValues("val1").Inc() - cntVec.WithLabelValues("val2").Inc() - - reg := prometheus.NewRegistry() - reg.MustRegister(cntVec) - - want := `prefix.name.constname.constvalue.labelname.val1 1 1477043 -prefix.name.constname.constvalue.labelname.val2 1 1477043 -` - mfs, err := reg.Gather() - if err != nil { - t.Fatalf("error: %v", err) - } - - now := model.Time(1477043083) - var buf bytes.Buffer - err = writeMetrics(&buf, mfs, "prefix", now) - if err != nil { - t.Fatalf("error: %v", err) - } - - if got := buf.String(); want != got { - t.Fatalf("wanted \n%s\n, got \n%s\n", want, got) - } -} - -func TestPush(t *testing.T) { - reg := prometheus.NewRegistry() - cntVec := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "name", - Help: "docstring", - ConstLabels: prometheus.Labels{"constname": "constvalue"}, - }, - []string{"labelname"}, - ) - cntVec.WithLabelValues("val1").Inc() - cntVec.WithLabelValues("val2").Inc() - reg.MustRegister(cntVec) - - host := "localhost" - port := ":56789" - b, err := NewBridge(&Config{ - URL: host + port, - Gatherer: reg, - Prefix: "prefix", - }) - if err != nil { - t.Fatalf("error creating bridge: %v", err) - } - - nmg, err := newMockGraphite(port) - if err != nil { - t.Fatalf("error creating mock graphite: %v", err) - } - defer nmg.Close() - - err = b.Push() - if err != nil { - t.Fatalf("error pushing: %v", err) - } - - wants := []string{ - "prefix.name.constname.constvalue.labelname.val1 1", - "prefix.name.constname.constvalue.labelname.val2 1", - } - - select { - case got := <-nmg.readc: - for _, want := range wants { - matched, err := regexp.MatchString(want, got) - if err != nil { - t.Fatalf("error pushing: %v", err) - } - if !matched { - t.Fatalf("missing metric:\nno match for %s received by server:\n%s", want, got) - } - } - return - case err := <-nmg.errc: - t.Fatalf("error reading push: %v", err) - case <-time.After(50 * time.Millisecond): - t.Fatalf("no result from graphite server") - } -} - -func newMockGraphite(port string) (*mockGraphite, error) { - readc := make(chan string) - errc := make(chan error) - ln, err := net.Listen("tcp", port) - if err != nil { - return nil, err - } - - go func() { - conn, err := ln.Accept() - if err != nil { - errc <- err - } - var b bytes.Buffer - io.Copy(&b, conn) - readc <- b.String() - }() - - return &mockGraphite{ - readc: readc, - errc: errc, - Listener: ln, - }, nil -} - -type mockGraphite struct { - readc chan string - errc chan error - - net.Listener -} - -func ExampleBridge() { - b, err := NewBridge(&Config{ - URL: "graphite.example.org:3099", - Gatherer: prometheus.DefaultGatherer, - Prefix: "prefix", - Interval: 15 * time.Second, - Timeout: 10 * time.Second, - ErrorHandling: AbortOnError, - Logger: log.New(os.Stdout, "graphite bridge: ", log.Lshortfile), - }) - if err != nil { - panic(err) - } - - go func() { - // Start something in a goroutine that uses metrics. - }() - - // Push initial metrics to Graphite. Fail fast if the push fails. - if err := b.Push(); err != nil { - panic(err) - } - - // Create a Context to control stopping the Run() loop that pushes - // metrics to Graphite. - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Start pushing metrics to Graphite in the Run() loop. - b.Run(ctx) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go deleted file mode 100644 index 4d7fa976e..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go +++ /dev/null @@ -1,614 +0,0 @@ -// Copyright 2015 The Prometheus 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 prometheus - -import ( - "fmt" - "math" - "runtime" - "sort" - "sync" - "sync/atomic" - - "github.com/golang/protobuf/proto" - - dto "github.com/prometheus/client_model/go" -) - -// A Histogram counts individual observations from an event or sample stream in -// configurable buckets. Similar to a summary, it also provides a sum of -// observations and an observation count. -// -// On the Prometheus server, quantiles can be calculated from a Histogram using -// the histogram_quantile function in the query language. -// -// Note that Histograms, in contrast to Summaries, can be aggregated with the -// Prometheus query language (see the documentation for detailed -// procedures). However, Histograms require the user to pre-define suitable -// buckets, and they are in general less accurate. The Observe method of a -// Histogram has a very low performance overhead in comparison with the Observe -// method of a Summary. -// -// To create Histogram instances, use NewHistogram. -type Histogram interface { - Metric - Collector - - // Observe adds a single observation to the histogram. - Observe(float64) -} - -// bucketLabel is used for the label that defines the upper bound of a -// bucket of a histogram ("le" -> "less or equal"). -const bucketLabel = "le" - -// DefBuckets are the default Histogram buckets. The default buckets are -// tailored to broadly measure the response time (in seconds) of a network -// service. Most likely, however, you will be required to define buckets -// customized to your use case. -var ( - DefBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10} - - errBucketLabelNotAllowed = fmt.Errorf( - "%q is not allowed as label name in histograms", bucketLabel, - ) -) - -// LinearBuckets creates 'count' buckets, each 'width' wide, where the lowest -// bucket has an upper bound of 'start'. The final +Inf bucket is not counted -// and not included in the returned slice. The returned slice is meant to be -// used for the Buckets field of HistogramOpts. -// -// The function panics if 'count' is zero or negative. -func LinearBuckets(start, width float64, count int) []float64 { - if count < 1 { - panic("LinearBuckets needs a positive count") - } - buckets := make([]float64, count) - for i := range buckets { - buckets[i] = start - start += width - } - return buckets -} - -// ExponentialBuckets creates 'count' buckets, where the lowest bucket has an -// upper bound of 'start' and each following bucket's upper bound is 'factor' -// times the previous bucket's upper bound. The final +Inf bucket is not counted -// and not included in the returned slice. The returned slice is meant to be -// used for the Buckets field of HistogramOpts. -// -// The function panics if 'count' is 0 or negative, if 'start' is 0 or negative, -// or if 'factor' is less than or equal 1. -func ExponentialBuckets(start, factor float64, count int) []float64 { - if count < 1 { - panic("ExponentialBuckets needs a positive count") - } - if start <= 0 { - panic("ExponentialBuckets needs a positive start value") - } - if factor <= 1 { - panic("ExponentialBuckets needs a factor greater than 1") - } - buckets := make([]float64, count) - for i := range buckets { - buckets[i] = start - start *= factor - } - return buckets -} - -// HistogramOpts bundles the options for creating a Histogram metric. It is -// mandatory to set Name to a non-empty string. All other fields are optional -// and can safely be left at their zero value, although it is strongly -// encouraged to set a Help string. -type HistogramOpts struct { - // Namespace, Subsystem, and Name are components of the fully-qualified - // name of the Histogram (created by joining these components with - // "_"). Only Name is mandatory, the others merely help structuring the - // name. Note that the fully-qualified name of the Histogram must be a - // valid Prometheus metric name. - Namespace string - Subsystem string - Name string - - // Help provides information about this Histogram. - // - // Metrics with the same fully-qualified name must have the same Help - // string. - Help string - - // ConstLabels are used to attach fixed labels to this metric. Metrics - // with the same fully-qualified name must have the same label names in - // their ConstLabels. - // - // ConstLabels are only used rarely. In particular, do not use them to - // attach the same labels to all your metrics. Those use cases are - // better covered by target labels set by the scraping Prometheus - // server, or by one specific metric (e.g. a build_info or a - // machine_role metric). See also - // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels,-not-static-scraped-labels - ConstLabels Labels - - // Buckets defines the buckets into which observations are counted. Each - // element in the slice is the upper inclusive bound of a bucket. The - // values must be sorted in strictly increasing order. There is no need - // to add a highest bucket with +Inf bound, it will be added - // implicitly. The default value is DefBuckets. - Buckets []float64 -} - -// NewHistogram creates a new Histogram based on the provided HistogramOpts. It -// panics if the buckets in HistogramOpts are not in strictly increasing order. -func NewHistogram(opts HistogramOpts) Histogram { - return newHistogram( - NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - nil, - opts.ConstLabels, - ), - opts, - ) -} - -func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogram { - if len(desc.variableLabels) != len(labelValues) { - panic(errInconsistentCardinality) - } - - for _, n := range desc.variableLabels { - if n == bucketLabel { - panic(errBucketLabelNotAllowed) - } - } - for _, lp := range desc.constLabelPairs { - if lp.GetName() == bucketLabel { - panic(errBucketLabelNotAllowed) - } - } - - if len(opts.Buckets) == 0 { - opts.Buckets = DefBuckets - } - - h := &histogram{ - desc: desc, - upperBounds: opts.Buckets, - labelPairs: makeLabelPairs(desc, labelValues), - counts: [2]*histogramCounts{&histogramCounts{}, &histogramCounts{}}, - } - for i, upperBound := range h.upperBounds { - if i < len(h.upperBounds)-1 { - if upperBound >= h.upperBounds[i+1] { - panic(fmt.Errorf( - "histogram buckets must be in increasing order: %f >= %f", - upperBound, h.upperBounds[i+1], - )) - } - } else { - if math.IsInf(upperBound, +1) { - // The +Inf bucket is implicit. Remove it here. - h.upperBounds = h.upperBounds[:i] - } - } - } - // Finally we know the final length of h.upperBounds and can make counts - // for both states: - h.counts[0].buckets = make([]uint64, len(h.upperBounds)) - h.counts[1].buckets = make([]uint64, len(h.upperBounds)) - - h.init(h) // Init self-collection. - return h -} - -type histogramCounts struct { - // sumBits contains the bits of the float64 representing the sum of all - // observations. sumBits and count have to go first in the struct to - // guarantee alignment for atomic operations. - // http://golang.org/pkg/sync/atomic/#pkg-note-BUG - sumBits uint64 - count uint64 - buckets []uint64 -} - -type histogram struct { - // countAndHotIdx is a complicated one. For lock-free yet atomic - // observations, we need to save the total count of observations again, - // combined with the index of the currently-hot counts struct, so that - // we can perform the operation on both values atomically. The least - // significant bit defines the hot counts struct. The remaining 63 bits - // represent the total count of observations. This happens under the - // assumption that the 63bit count will never overflow. Rationale: An - // observations takes about 30ns. Let's assume it could happen in - // 10ns. Overflowing the counter will then take at least (2^63)*10ns, - // which is about 3000 years. - // - // This has to be first in the struct for 64bit alignment. See - // http://golang.org/pkg/sync/atomic/#pkg-note-BUG - countAndHotIdx uint64 - - selfCollector - desc *Desc - writeMtx sync.Mutex // Only used in the Write method. - - upperBounds []float64 - - // Two counts, one is "hot" for lock-free observations, the other is - // "cold" for writing out a dto.Metric. It has to be an array of - // pointers to guarantee 64bit alignment of the histogramCounts, see - // http://golang.org/pkg/sync/atomic/#pkg-note-BUG. - counts [2]*histogramCounts - hotIdx int // Index of currently-hot counts. Only used within Write. - - labelPairs []*dto.LabelPair -} - -func (h *histogram) Desc() *Desc { - return h.desc -} - -func (h *histogram) Observe(v float64) { - // TODO(beorn7): For small numbers of buckets (<30), a linear search is - // slightly faster than the binary search. If we really care, we could - // switch from one search strategy to the other depending on the number - // of buckets. - // - // Microbenchmarks (BenchmarkHistogramNoLabels): - // 11 buckets: 38.3 ns/op linear - binary 48.7 ns/op - // 100 buckets: 78.1 ns/op linear - binary 54.9 ns/op - // 300 buckets: 154 ns/op linear - binary 61.6 ns/op - i := sort.SearchFloat64s(h.upperBounds, v) - - // We increment h.countAndHotIdx by 2 so that the counter in the upper - // 63 bits gets incremented by 1. At the same time, we get the new value - // back, which we can use to find the currently-hot counts. - n := atomic.AddUint64(&h.countAndHotIdx, 2) - hotCounts := h.counts[n%2] - - if i < len(h.upperBounds) { - atomic.AddUint64(&hotCounts.buckets[i], 1) - } - for { - oldBits := atomic.LoadUint64(&hotCounts.sumBits) - newBits := math.Float64bits(math.Float64frombits(oldBits) + v) - if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { - break - } - } - // Increment count last as we take it as a signal that the observation - // is complete. - atomic.AddUint64(&hotCounts.count, 1) -} - -func (h *histogram) Write(out *dto.Metric) error { - var ( - his = &dto.Histogram{} - buckets = make([]*dto.Bucket, len(h.upperBounds)) - hotCounts, coldCounts *histogramCounts - count uint64 - ) - - // For simplicity, we mutex the rest of this method. It is not in the - // hot path, i.e. Observe is called much more often than Write. The - // complication of making Write lock-free isn't worth it. - h.writeMtx.Lock() - defer h.writeMtx.Unlock() - - // This is a bit arcane, which is why the following spells out this if - // clause in English: - // - // If the currently-hot counts struct is #0, we atomically increment - // h.countAndHotIdx by 1 so that from now on Observe will use the counts - // struct #1. Furthermore, the atomic increment gives us the new value, - // which, in its most significant 63 bits, tells us the count of - // observations done so far up to and including currently ongoing - // observations still using the counts struct just changed from hot to - // cold. To have a normal uint64 for the count, we bitshift by 1 and - // save the result in count. We also set h.hotIdx to 1 for the next - // Write call, and we will refer to counts #1 as hotCounts and to counts - // #0 as coldCounts. - // - // If the currently-hot counts struct is #1, we do the corresponding - // things the other way round. We have to _decrement_ h.countAndHotIdx - // (which is a bit arcane in itself, as we have to express -1 with an - // unsigned int...). - if h.hotIdx == 0 { - count = atomic.AddUint64(&h.countAndHotIdx, 1) >> 1 - h.hotIdx = 1 - hotCounts = h.counts[1] - coldCounts = h.counts[0] - } else { - count = atomic.AddUint64(&h.countAndHotIdx, ^uint64(0)) >> 1 // Decrement. - h.hotIdx = 0 - hotCounts = h.counts[0] - coldCounts = h.counts[1] - } - - // Now we have to wait for the now-declared-cold counts to actually cool - // down, i.e. wait for all observations still using it to finish. That's - // the case once the count in the cold counts struct is the same as the - // one atomically retrieved from the upper 63bits of h.countAndHotIdx. - for { - if count == atomic.LoadUint64(&coldCounts.count) { - break - } - runtime.Gosched() // Let observations get work done. - } - - his.SampleCount = proto.Uint64(count) - his.SampleSum = proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))) - var cumCount uint64 - for i, upperBound := range h.upperBounds { - cumCount += atomic.LoadUint64(&coldCounts.buckets[i]) - buckets[i] = &dto.Bucket{ - CumulativeCount: proto.Uint64(cumCount), - UpperBound: proto.Float64(upperBound), - } - } - - his.Bucket = buckets - out.Histogram = his - out.Label = h.labelPairs - - // Finally add all the cold counts to the new hot counts and reset the cold counts. - atomic.AddUint64(&hotCounts.count, count) - atomic.StoreUint64(&coldCounts.count, 0) - for { - oldBits := atomic.LoadUint64(&hotCounts.sumBits) - newBits := math.Float64bits(math.Float64frombits(oldBits) + his.GetSampleSum()) - if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { - atomic.StoreUint64(&coldCounts.sumBits, 0) - break - } - } - for i := range h.upperBounds { - atomic.AddUint64(&hotCounts.buckets[i], atomic.LoadUint64(&coldCounts.buckets[i])) - atomic.StoreUint64(&coldCounts.buckets[i], 0) - } - return nil -} - -// HistogramVec is a Collector that bundles a set of Histograms that all share the -// same Desc, but have different values for their variable labels. This is used -// if you want to count the same thing partitioned by various dimensions -// (e.g. HTTP request latencies, partitioned by status code and method). Create -// instances with NewHistogramVec. -type HistogramVec struct { - *metricVec -} - -// NewHistogramVec creates a new HistogramVec based on the provided HistogramOpts and -// partitioned by the given label names. -func NewHistogramVec(opts HistogramOpts, labelNames []string) *HistogramVec { - desc := NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - labelNames, - opts.ConstLabels, - ) - return &HistogramVec{ - metricVec: newMetricVec(desc, func(lvs ...string) Metric { - return newHistogram(desc, opts, lvs...) - }), - } -} - -// GetMetricWithLabelValues returns the Histogram for the given slice of label -// values (same order as the VariableLabels in Desc). If that combination of -// label values is accessed for the first time, a new Histogram is created. -// -// It is possible to call this method without using the returned Histogram to only -// create the new Histogram but leave it at its starting value, a Histogram without -// any observations. -// -// Keeping the Histogram for later use is possible (and should be considered if -// performance is critical), but keep in mind that Reset, DeleteLabelValues and -// Delete can be used to delete the Histogram from the HistogramVec. In that case, the -// Histogram will still exist, but it will not be exported anymore, even if a -// Histogram with the same label values is created later. See also the CounterVec -// example. -// -// An error is returned if the number of label values is not the same as the -// number of VariableLabels in Desc (minus any curried labels). -// -// Note that for more than one label value, this method is prone to mistakes -// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as -// an alternative to avoid that type of mistake. For higher label numbers, the -// latter has a much more readable (albeit more verbose) syntax, but it comes -// with a performance overhead (for creating and processing the Labels map). -// See also the GaugeVec example. -func (v *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { - metric, err := v.metricVec.getMetricWithLabelValues(lvs...) - if metric != nil { - return metric.(Observer), err - } - return nil, err -} - -// GetMetricWith returns the Histogram for the given Labels map (the label names -// must match those of the VariableLabels in Desc). If that label map is -// accessed for the first time, a new Histogram is created. Implications of -// creating a Histogram without using it and keeping the Histogram for later use -// are the same as for GetMetricWithLabelValues. -// -// An error is returned if the number and names of the Labels are inconsistent -// with those of the VariableLabels in Desc (minus any curried labels). -// -// This method is used for the same purpose as -// GetMetricWithLabelValues(...string). See there for pros and cons of the two -// methods. -func (v *HistogramVec) GetMetricWith(labels Labels) (Observer, error) { - metric, err := v.metricVec.getMetricWith(labels) - if metric != nil { - return metric.(Observer), err - } - return nil, err -} - -// WithLabelValues works as GetMetricWithLabelValues, but panics where -// GetMetricWithLabelValues would have returned an error. Not returning an -// error allows shortcuts like -// myVec.WithLabelValues("404", "GET").Observe(42.21) -func (v *HistogramVec) WithLabelValues(lvs ...string) Observer { - h, err := v.GetMetricWithLabelValues(lvs...) - if err != nil { - panic(err) - } - return h -} - -// With works as GetMetricWith but panics where GetMetricWithLabels would have -// returned an error. Not returning an error allows shortcuts like -// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21) -func (v *HistogramVec) With(labels Labels) Observer { - h, err := v.GetMetricWith(labels) - if err != nil { - panic(err) - } - return h -} - -// CurryWith returns a vector curried with the provided labels, i.e. the -// returned vector has those labels pre-set for all labeled operations performed -// on it. The cardinality of the curried vector is reduced accordingly. The -// order of the remaining labels stays the same (just with the curried labels -// taken out of the sequence – which is relevant for the -// (GetMetric)WithLabelValues methods). It is possible to curry a curried -// vector, but only with labels not yet used for currying before. -// -// The metrics contained in the HistogramVec are shared between the curried and -// uncurried vectors. They are just accessed differently. Curried and uncurried -// vectors behave identically in terms of collection. Only one must be -// registered with a given registry (usually the uncurried version). The Reset -// method deletes all metrics, even if called on a curried vector. -func (v *HistogramVec) CurryWith(labels Labels) (ObserverVec, error) { - vec, err := v.curryWith(labels) - if vec != nil { - return &HistogramVec{vec}, err - } - return nil, err -} - -// MustCurryWith works as CurryWith but panics where CurryWith would have -// returned an error. -func (v *HistogramVec) MustCurryWith(labels Labels) ObserverVec { - vec, err := v.CurryWith(labels) - if err != nil { - panic(err) - } - return vec -} - -type constHistogram struct { - desc *Desc - count uint64 - sum float64 - buckets map[float64]uint64 - labelPairs []*dto.LabelPair -} - -func (h *constHistogram) Desc() *Desc { - return h.desc -} - -func (h *constHistogram) Write(out *dto.Metric) error { - his := &dto.Histogram{} - buckets := make([]*dto.Bucket, 0, len(h.buckets)) - - his.SampleCount = proto.Uint64(h.count) - his.SampleSum = proto.Float64(h.sum) - - for upperBound, count := range h.buckets { - buckets = append(buckets, &dto.Bucket{ - CumulativeCount: proto.Uint64(count), - UpperBound: proto.Float64(upperBound), - }) - } - - if len(buckets) > 0 { - sort.Sort(buckSort(buckets)) - } - his.Bucket = buckets - - out.Histogram = his - out.Label = h.labelPairs - - return nil -} - -// NewConstHistogram returns a metric representing a Prometheus histogram with -// fixed values for the count, sum, and bucket counts. As those parameters -// cannot be changed, the returned value does not implement the Histogram -// interface (but only the Metric interface). Users of this package will not -// have much use for it in regular operations. However, when implementing custom -// Collectors, it is useful as a throw-away metric that is generated on the fly -// to send it to Prometheus in the Collect method. -// -// buckets is a map of upper bounds to cumulative counts, excluding the +Inf -// bucket. -// -// NewConstHistogram returns an error if the length of labelValues is not -// consistent with the variable labels in Desc or if Desc is invalid. -func NewConstHistogram( - desc *Desc, - count uint64, - sum float64, - buckets map[float64]uint64, - labelValues ...string, -) (Metric, error) { - if desc.err != nil { - return nil, desc.err - } - if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil { - return nil, err - } - return &constHistogram{ - desc: desc, - count: count, - sum: sum, - buckets: buckets, - labelPairs: makeLabelPairs(desc, labelValues), - }, nil -} - -// MustNewConstHistogram is a version of NewConstHistogram that panics where -// NewConstMetric would have returned an error. -func MustNewConstHistogram( - desc *Desc, - count uint64, - sum float64, - buckets map[float64]uint64, - labelValues ...string, -) Metric { - m, err := NewConstHistogram(desc, count, sum, buckets, labelValues...) - if err != nil { - panic(err) - } - return m -} - -type buckSort []*dto.Bucket - -func (s buckSort) Len() int { - return len(s) -} - -func (s buckSort) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s buckSort) Less(i, j int) bool { - return s[i].GetUpperBound() < s[j].GetUpperBound() -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram_test.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram_test.go deleted file mode 100644 index 9546b8776..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/histogram_test.go +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright 2015 The Prometheus 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 prometheus - -import ( - "math" - "math/rand" - "reflect" - "runtime" - "sort" - "sync" - "testing" - "testing/quick" - - dto "github.com/prometheus/client_model/go" -) - -func benchmarkHistogramObserve(w int, b *testing.B) { - b.StopTimer() - - wg := new(sync.WaitGroup) - wg.Add(w) - - g := new(sync.WaitGroup) - g.Add(1) - - s := NewHistogram(HistogramOpts{}) - - for i := 0; i < w; i++ { - go func() { - g.Wait() - - for i := 0; i < b.N; i++ { - s.Observe(float64(i)) - } - - wg.Done() - }() - } - - b.StartTimer() - g.Done() - wg.Wait() -} - -func BenchmarkHistogramObserve1(b *testing.B) { - benchmarkHistogramObserve(1, b) -} - -func BenchmarkHistogramObserve2(b *testing.B) { - benchmarkHistogramObserve(2, b) -} - -func BenchmarkHistogramObserve4(b *testing.B) { - benchmarkHistogramObserve(4, b) -} - -func BenchmarkHistogramObserve8(b *testing.B) { - benchmarkHistogramObserve(8, b) -} - -func benchmarkHistogramWrite(w int, b *testing.B) { - b.StopTimer() - - wg := new(sync.WaitGroup) - wg.Add(w) - - g := new(sync.WaitGroup) - g.Add(1) - - s := NewHistogram(HistogramOpts{}) - - for i := 0; i < 1000000; i++ { - s.Observe(float64(i)) - } - - for j := 0; j < w; j++ { - outs := make([]dto.Metric, b.N) - - go func(o []dto.Metric) { - g.Wait() - - for i := 0; i < b.N; i++ { - s.Write(&o[i]) - } - - wg.Done() - }(outs) - } - - b.StartTimer() - g.Done() - wg.Wait() -} - -func BenchmarkHistogramWrite1(b *testing.B) { - benchmarkHistogramWrite(1, b) -} - -func BenchmarkHistogramWrite2(b *testing.B) { - benchmarkHistogramWrite(2, b) -} - -func BenchmarkHistogramWrite4(b *testing.B) { - benchmarkHistogramWrite(4, b) -} - -func BenchmarkHistogramWrite8(b *testing.B) { - benchmarkHistogramWrite(8, b) -} - -func TestHistogramNonMonotonicBuckets(t *testing.T) { - testCases := map[string][]float64{ - "not strictly monotonic": {1, 2, 2, 3}, - "not monotonic at all": {1, 2, 4, 3, 5}, - "have +Inf in the middle": {1, 2, math.Inf(+1), 3}, - } - for name, buckets := range testCases { - func() { - defer func() { - if r := recover(); r == nil { - t.Errorf("Buckets %v are %s but NewHistogram did not panic.", buckets, name) - } - }() - _ = NewHistogram(HistogramOpts{ - Name: "test_histogram", - Help: "helpless", - Buckets: buckets, - }) - }() - } -} - -// Intentionally adding +Inf here to test if that case is handled correctly. -// Also, getCumulativeCounts depends on it. -var testBuckets = []float64{-2, -1, -0.5, 0, 0.5, 1, 2, math.Inf(+1)} - -func TestHistogramConcurrency(t *testing.T) { - if testing.Short() { - t.Skip("Skipping test in short mode.") - } - - rand.Seed(42) - - it := func(n uint32) bool { - mutations := int(n%1e4 + 1e4) - concLevel := int(n%5 + 1) - total := mutations * concLevel - - var start, end sync.WaitGroup - start.Add(1) - end.Add(concLevel) - - sum := NewHistogram(HistogramOpts{ - Name: "test_histogram", - Help: "helpless", - Buckets: testBuckets, - }) - - allVars := make([]float64, total) - var sampleSum float64 - for i := 0; i < concLevel; i++ { - vals := make([]float64, mutations) - for j := 0; j < mutations; j++ { - v := rand.NormFloat64() - vals[j] = v - allVars[i*mutations+j] = v - sampleSum += v - } - - go func(vals []float64) { - start.Wait() - for _, v := range vals { - sum.Observe(v) - } - end.Done() - }(vals) - } - sort.Float64s(allVars) - start.Done() - end.Wait() - - m := &dto.Metric{} - sum.Write(m) - if got, want := int(*m.Histogram.SampleCount), total; got != want { - t.Errorf("got sample count %d, want %d", got, want) - } - if got, want := *m.Histogram.SampleSum, sampleSum; math.Abs((got-want)/want) > 0.001 { - t.Errorf("got sample sum %f, want %f", got, want) - } - - wantCounts := getCumulativeCounts(allVars) - - if got, want := len(m.Histogram.Bucket), len(testBuckets)-1; got != want { - t.Errorf("got %d buckets in protobuf, want %d", got, want) - } - for i, wantBound := range testBuckets { - if i == len(testBuckets)-1 { - break // No +Inf bucket in protobuf. - } - if gotBound := *m.Histogram.Bucket[i].UpperBound; gotBound != wantBound { - t.Errorf("got bound %f, want %f", gotBound, wantBound) - } - if gotCount, wantCount := *m.Histogram.Bucket[i].CumulativeCount, wantCounts[i]; gotCount != wantCount { - t.Errorf("got count %d, want %d", gotCount, wantCount) - } - } - return true - } - - if err := quick.Check(it, nil); err != nil { - t.Error(err) - } -} - -func TestHistogramVecConcurrency(t *testing.T) { - if testing.Short() { - t.Skip("Skipping test in short mode.") - } - - rand.Seed(42) - - objectives := make([]float64, 0, len(DefObjectives)) - for qu := range DefObjectives { - - objectives = append(objectives, qu) - } - sort.Float64s(objectives) - - it := func(n uint32) bool { - mutations := int(n%1e4 + 1e4) - concLevel := int(n%7 + 1) - vecLength := int(n%3 + 1) - - var start, end sync.WaitGroup - start.Add(1) - end.Add(concLevel) - - his := NewHistogramVec( - HistogramOpts{ - Name: "test_histogram", - Help: "helpless", - Buckets: []float64{-2, -1, -0.5, 0, 0.5, 1, 2, math.Inf(+1)}, - }, - []string{"label"}, - ) - - allVars := make([][]float64, vecLength) - sampleSums := make([]float64, vecLength) - for i := 0; i < concLevel; i++ { - vals := make([]float64, mutations) - picks := make([]int, mutations) - for j := 0; j < mutations; j++ { - v := rand.NormFloat64() - vals[j] = v - pick := rand.Intn(vecLength) - picks[j] = pick - allVars[pick] = append(allVars[pick], v) - sampleSums[pick] += v - } - - go func(vals []float64) { - start.Wait() - for i, v := range vals { - his.WithLabelValues(string('A' + picks[i])).Observe(v) - } - end.Done() - }(vals) - } - for _, vars := range allVars { - sort.Float64s(vars) - } - start.Done() - end.Wait() - - for i := 0; i < vecLength; i++ { - m := &dto.Metric{} - s := his.WithLabelValues(string('A' + i)) - s.(Histogram).Write(m) - - if got, want := len(m.Histogram.Bucket), len(testBuckets)-1; got != want { - t.Errorf("got %d buckets in protobuf, want %d", got, want) - } - if got, want := int(*m.Histogram.SampleCount), len(allVars[i]); got != want { - t.Errorf("got sample count %d, want %d", got, want) - } - if got, want := *m.Histogram.SampleSum, sampleSums[i]; math.Abs((got-want)/want) > 0.001 { - t.Errorf("got sample sum %f, want %f", got, want) - } - - wantCounts := getCumulativeCounts(allVars[i]) - - for j, wantBound := range testBuckets { - if j == len(testBuckets)-1 { - break // No +Inf bucket in protobuf. - } - if gotBound := *m.Histogram.Bucket[j].UpperBound; gotBound != wantBound { - t.Errorf("got bound %f, want %f", gotBound, wantBound) - } - if gotCount, wantCount := *m.Histogram.Bucket[j].CumulativeCount, wantCounts[j]; gotCount != wantCount { - t.Errorf("got count %d, want %d", gotCount, wantCount) - } - } - } - return true - } - - if err := quick.Check(it, nil); err != nil { - t.Error(err) - } -} - -func getCumulativeCounts(vars []float64) []uint64 { - counts := make([]uint64, len(testBuckets)) - for _, v := range vars { - for i := len(testBuckets) - 1; i >= 0; i-- { - if v > testBuckets[i] { - break - } - counts[i]++ - } - } - return counts -} - -func TestBuckets(t *testing.T) { - got := LinearBuckets(-15, 5, 6) - want := []float64{-15, -10, -5, 0, 5, 10} - if !reflect.DeepEqual(got, want) { - t.Errorf("linear buckets: got %v, want %v", got, want) - } - - got = ExponentialBuckets(100, 1.2, 3) - want = []float64{100, 120, 144} - if !reflect.DeepEqual(got, want) { - t.Errorf("exponential buckets: got %v, want %v", got, want) - } -} - -func TestHistogramAtomicObserve(t *testing.T) { - var ( - quit = make(chan struct{}) - his = NewHistogram(HistogramOpts{ - Buckets: []float64{0.5, 10, 20}, - }) - ) - - defer func() { close(quit) }() - - observe := func() { - for { - select { - case <-quit: - return - default: - his.Observe(1) - } - } - } - - go observe() - go observe() - go observe() - - for i := 0; i < 100; i++ { - m := &dto.Metric{} - if err := his.Write(m); err != nil { - t.Fatal("unexpected error writing histogram:", err) - } - h := m.GetHistogram() - if h.GetSampleCount() != uint64(h.GetSampleSum()) || - h.GetSampleCount() != h.GetBucket()[1].GetCumulativeCount() || - h.GetSampleCount() != h.GetBucket()[2].GetCumulativeCount() { - t.Fatalf( - "inconsistent counts in histogram: count=%d sum=%f buckets=[%d, %d]", - h.GetSampleCount(), h.GetSampleSum(), - h.GetBucket()[1].GetCumulativeCount(), h.GetBucket()[2].GetCumulativeCount(), - ) - } - runtime.Gosched() - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/http.go b/vendor/github.com/prometheus/client_golang/prometheus/http.go deleted file mode 100644 index 4b8e60273..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/http.go +++ /dev/null @@ -1,505 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "bufio" - "bytes" - "compress/gzip" - "fmt" - "io" - "net" - "net/http" - "strconv" - "strings" - "sync" - "time" - - "github.com/prometheus/common/expfmt" -) - -// TODO(beorn7): Remove this whole file. It is a partial mirror of -// promhttp/http.go (to avoid circular import chains) where everything HTTP -// related should live. The functions here are just for avoiding -// breakage. Everything is deprecated. - -const ( - contentTypeHeader = "Content-Type" - contentLengthHeader = "Content-Length" - contentEncodingHeader = "Content-Encoding" - acceptEncodingHeader = "Accept-Encoding" -) - -var bufPool sync.Pool - -func getBuf() *bytes.Buffer { - buf := bufPool.Get() - if buf == nil { - return &bytes.Buffer{} - } - return buf.(*bytes.Buffer) -} - -func giveBuf(buf *bytes.Buffer) { - buf.Reset() - bufPool.Put(buf) -} - -// Handler returns an HTTP handler for the DefaultGatherer. It is -// already instrumented with InstrumentHandler (using "prometheus" as handler -// name). -// -// Deprecated: Please note the issues described in the doc comment of -// InstrumentHandler. You might want to consider using promhttp.Handler instead. -func Handler() http.Handler { - return InstrumentHandler("prometheus", UninstrumentedHandler()) -} - -// UninstrumentedHandler returns an HTTP handler for the DefaultGatherer. -// -// Deprecated: Use promhttp.HandlerFor(DefaultGatherer, promhttp.HandlerOpts{}) -// instead. See there for further documentation. -func UninstrumentedHandler() http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - mfs, err := DefaultGatherer.Gather() - if err != nil { - http.Error(w, "An error has occurred during metrics collection:\n\n"+err.Error(), http.StatusInternalServerError) - return - } - - contentType := expfmt.Negotiate(req.Header) - buf := getBuf() - defer giveBuf(buf) - writer, encoding := decorateWriter(req, buf) - enc := expfmt.NewEncoder(writer, contentType) - var lastErr error - for _, mf := range mfs { - if err := enc.Encode(mf); err != nil { - lastErr = err - http.Error(w, "An error has occurred during metrics encoding:\n\n"+err.Error(), http.StatusInternalServerError) - return - } - } - if closer, ok := writer.(io.Closer); ok { - closer.Close() - } - if lastErr != nil && buf.Len() == 0 { - http.Error(w, "No metrics encoded, last error:\n\n"+lastErr.Error(), http.StatusInternalServerError) - return - } - header := w.Header() - header.Set(contentTypeHeader, string(contentType)) - header.Set(contentLengthHeader, fmt.Sprint(buf.Len())) - if encoding != "" { - header.Set(contentEncodingHeader, encoding) - } - w.Write(buf.Bytes()) - }) -} - -// decorateWriter wraps a writer to handle gzip compression if requested. It -// returns the decorated writer and the appropriate "Content-Encoding" header -// (which is empty if no compression is enabled). -func decorateWriter(request *http.Request, writer io.Writer) (io.Writer, string) { - header := request.Header.Get(acceptEncodingHeader) - parts := strings.Split(header, ",") - for _, part := range parts { - part = strings.TrimSpace(part) - if part == "gzip" || strings.HasPrefix(part, "gzip;") { - return gzip.NewWriter(writer), "gzip" - } - } - return writer, "" -} - -var instLabels = []string{"method", "code"} - -type nower interface { - Now() time.Time -} - -type nowFunc func() time.Time - -func (n nowFunc) Now() time.Time { - return n() -} - -var now nower = nowFunc(func() time.Time { - return time.Now() -}) - -// InstrumentHandler wraps the given HTTP handler for instrumentation. It -// registers four metric collectors (if not already done) and reports HTTP -// metrics to the (newly or already) registered collectors: http_requests_total -// (CounterVec), http_request_duration_microseconds (Summary), -// http_request_size_bytes (Summary), http_response_size_bytes (Summary). Each -// has a constant label named "handler" with the provided handlerName as -// value. http_requests_total is a metric vector partitioned by HTTP method -// (label name "method") and HTTP status code (label name "code"). -// -// Deprecated: InstrumentHandler has several issues. Use the tooling provided in -// package promhttp instead. The issues are the following: (1) It uses Summaries -// rather than Histograms. Summaries are not useful if aggregation across -// multiple instances is required. (2) It uses microseconds as unit, which is -// deprecated and should be replaced by seconds. (3) The size of the request is -// calculated in a separate goroutine. Since this calculator requires access to -// the request header, it creates a race with any writes to the header performed -// during request handling. httputil.ReverseProxy is a prominent example for a -// handler performing such writes. (4) It has additional issues with HTTP/2, cf. -// https://github.com/prometheus/client_golang/issues/272. -func InstrumentHandler(handlerName string, handler http.Handler) http.HandlerFunc { - return InstrumentHandlerFunc(handlerName, handler.ServeHTTP) -} - -// InstrumentHandlerFunc wraps the given function for instrumentation. It -// otherwise works in the same way as InstrumentHandler (and shares the same -// issues). -// -// Deprecated: InstrumentHandlerFunc is deprecated for the same reasons as -// InstrumentHandler is. Use the tooling provided in package promhttp instead. -func InstrumentHandlerFunc(handlerName string, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc { - return InstrumentHandlerFuncWithOpts( - SummaryOpts{ - Subsystem: "http", - ConstLabels: Labels{"handler": handlerName}, - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - handlerFunc, - ) -} - -// InstrumentHandlerWithOpts works like InstrumentHandler (and shares the same -// issues) but provides more flexibility (at the cost of a more complex call -// syntax). As InstrumentHandler, this function registers four metric -// collectors, but it uses the provided SummaryOpts to create them. However, the -// fields "Name" and "Help" in the SummaryOpts are ignored. "Name" is replaced -// by "requests_total", "request_duration_microseconds", "request_size_bytes", -// and "response_size_bytes", respectively. "Help" is replaced by an appropriate -// help string. The names of the variable labels of the http_requests_total -// CounterVec are "method" (get, post, etc.), and "code" (HTTP status code). -// -// If InstrumentHandlerWithOpts is called as follows, it mimics exactly the -// behavior of InstrumentHandler: -// -// prometheus.InstrumentHandlerWithOpts( -// prometheus.SummaryOpts{ -// Subsystem: "http", -// ConstLabels: prometheus.Labels{"handler": handlerName}, -// }, -// handler, -// ) -// -// Technical detail: "requests_total" is a CounterVec, not a SummaryVec, so it -// cannot use SummaryOpts. Instead, a CounterOpts struct is created internally, -// and all its fields are set to the equally named fields in the provided -// SummaryOpts. -// -// Deprecated: InstrumentHandlerWithOpts is deprecated for the same reasons as -// InstrumentHandler is. Use the tooling provided in package promhttp instead. -func InstrumentHandlerWithOpts(opts SummaryOpts, handler http.Handler) http.HandlerFunc { - return InstrumentHandlerFuncWithOpts(opts, handler.ServeHTTP) -} - -// InstrumentHandlerFuncWithOpts works like InstrumentHandlerFunc (and shares -// the same issues) but provides more flexibility (at the cost of a more complex -// call syntax). See InstrumentHandlerWithOpts for details how the provided -// SummaryOpts are used. -// -// Deprecated: InstrumentHandlerFuncWithOpts is deprecated for the same reasons -// as InstrumentHandler is. Use the tooling provided in package promhttp instead. -func InstrumentHandlerFuncWithOpts(opts SummaryOpts, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc { - reqCnt := NewCounterVec( - CounterOpts{ - Namespace: opts.Namespace, - Subsystem: opts.Subsystem, - Name: "requests_total", - Help: "Total number of HTTP requests made.", - ConstLabels: opts.ConstLabels, - }, - instLabels, - ) - if err := Register(reqCnt); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - reqCnt = are.ExistingCollector.(*CounterVec) - } else { - panic(err) - } - } - - opts.Name = "request_duration_microseconds" - opts.Help = "The HTTP request latencies in microseconds." - reqDur := NewSummary(opts) - if err := Register(reqDur); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - reqDur = are.ExistingCollector.(Summary) - } else { - panic(err) - } - } - - opts.Name = "request_size_bytes" - opts.Help = "The HTTP request sizes in bytes." - reqSz := NewSummary(opts) - if err := Register(reqSz); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - reqSz = are.ExistingCollector.(Summary) - } else { - panic(err) - } - } - - opts.Name = "response_size_bytes" - opts.Help = "The HTTP response sizes in bytes." - resSz := NewSummary(opts) - if err := Register(resSz); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - resSz = are.ExistingCollector.(Summary) - } else { - panic(err) - } - } - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - now := time.Now() - - delegate := &responseWriterDelegator{ResponseWriter: w} - out := computeApproximateRequestSize(r) - - _, cn := w.(http.CloseNotifier) - _, fl := w.(http.Flusher) - _, hj := w.(http.Hijacker) - _, rf := w.(io.ReaderFrom) - var rw http.ResponseWriter - if cn && fl && hj && rf { - rw = &fancyResponseWriterDelegator{delegate} - } else { - rw = delegate - } - handlerFunc(rw, r) - - elapsed := float64(time.Since(now)) / float64(time.Microsecond) - - method := sanitizeMethod(r.Method) - code := sanitizeCode(delegate.status) - reqCnt.WithLabelValues(method, code).Inc() - reqDur.Observe(elapsed) - resSz.Observe(float64(delegate.written)) - reqSz.Observe(float64(<-out)) - }) -} - -func computeApproximateRequestSize(r *http.Request) <-chan int { - // Get URL length in current goroutine for avoiding a race condition. - // HandlerFunc that runs in parallel may modify the URL. - s := 0 - if r.URL != nil { - s += len(r.URL.String()) - } - - out := make(chan int, 1) - - go func() { - s += len(r.Method) - s += len(r.Proto) - for name, values := range r.Header { - s += len(name) - for _, value := range values { - s += len(value) - } - } - s += len(r.Host) - - // N.B. r.Form and r.MultipartForm are assumed to be included in r.URL. - - if r.ContentLength != -1 { - s += int(r.ContentLength) - } - out <- s - close(out) - }() - - return out -} - -type responseWriterDelegator struct { - http.ResponseWriter - - status int - written int64 - wroteHeader bool -} - -func (r *responseWriterDelegator) WriteHeader(code int) { - r.status = code - r.wroteHeader = true - r.ResponseWriter.WriteHeader(code) -} - -func (r *responseWriterDelegator) Write(b []byte) (int, error) { - if !r.wroteHeader { - r.WriteHeader(http.StatusOK) - } - n, err := r.ResponseWriter.Write(b) - r.written += int64(n) - return n, err -} - -type fancyResponseWriterDelegator struct { - *responseWriterDelegator -} - -func (f *fancyResponseWriterDelegator) CloseNotify() <-chan bool { - return f.ResponseWriter.(http.CloseNotifier).CloseNotify() -} - -func (f *fancyResponseWriterDelegator) Flush() { - f.ResponseWriter.(http.Flusher).Flush() -} - -func (f *fancyResponseWriterDelegator) Hijack() (net.Conn, *bufio.ReadWriter, error) { - return f.ResponseWriter.(http.Hijacker).Hijack() -} - -func (f *fancyResponseWriterDelegator) ReadFrom(r io.Reader) (int64, error) { - if !f.wroteHeader { - f.WriteHeader(http.StatusOK) - } - n, err := f.ResponseWriter.(io.ReaderFrom).ReadFrom(r) - f.written += n - return n, err -} - -func sanitizeMethod(m string) string { - switch m { - case "GET", "get": - return "get" - case "PUT", "put": - return "put" - case "HEAD", "head": - return "head" - case "POST", "post": - return "post" - case "DELETE", "delete": - return "delete" - case "CONNECT", "connect": - return "connect" - case "OPTIONS", "options": - return "options" - case "NOTIFY", "notify": - return "notify" - default: - return strings.ToLower(m) - } -} - -func sanitizeCode(s int) string { - switch s { - case 100: - return "100" - case 101: - return "101" - - case 200: - return "200" - case 201: - return "201" - case 202: - return "202" - case 203: - return "203" - case 204: - return "204" - case 205: - return "205" - case 206: - return "206" - - case 300: - return "300" - case 301: - return "301" - case 302: - return "302" - case 304: - return "304" - case 305: - return "305" - case 307: - return "307" - - case 400: - return "400" - case 401: - return "401" - case 402: - return "402" - case 403: - return "403" - case 404: - return "404" - case 405: - return "405" - case 406: - return "406" - case 407: - return "407" - case 408: - return "408" - case 409: - return "409" - case 410: - return "410" - case 411: - return "411" - case 412: - return "412" - case 413: - return "413" - case 414: - return "414" - case 415: - return "415" - case 416: - return "416" - case 417: - return "417" - case 418: - return "418" - - case 500: - return "500" - case 501: - return "501" - case 502: - return "502" - case 503: - return "503" - case 504: - return "504" - case 505: - return "505" - - case 428: - return "428" - case 429: - return "429" - case 431: - return "431" - case 511: - return "511" - - default: - return strconv.Itoa(s) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/http_test.go b/vendor/github.com/prometheus/client_golang/prometheus/http_test.go deleted file mode 100644 index dd89ccf1a..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/http_test.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "net/http" - "net/http/httptest" - "testing" - "time" - - dto "github.com/prometheus/client_model/go" -) - -type respBody string - -func (b respBody) ServeHTTP(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusTeapot) - w.Write([]byte(b)) -} - -func nowSeries(t ...time.Time) nower { - return nowFunc(func() time.Time { - defer func() { - t = t[1:] - }() - - return t[0] - }) -} - -func TestInstrumentHandler(t *testing.T) { - defer func(n nower) { - now = n.(nower) - }(now) - - instant := time.Now() - end := instant.Add(30 * time.Second) - now = nowSeries(instant, end) - body := respBody("Howdy there!") - - hndlr := InstrumentHandler("test-handler", body) - - opts := SummaryOpts{ - Subsystem: "http", - ConstLabels: Labels{"handler": "test-handler"}, - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - } - - reqCnt := NewCounterVec( - CounterOpts{ - Namespace: opts.Namespace, - Subsystem: opts.Subsystem, - Name: "requests_total", - Help: "Total number of HTTP requests made.", - ConstLabels: opts.ConstLabels, - }, - instLabels, - ) - err := Register(reqCnt) - if err == nil { - t.Fatal("expected reqCnt to be registered already") - } - if are, ok := err.(AlreadyRegisteredError); ok { - reqCnt = are.ExistingCollector.(*CounterVec) - } else { - t.Fatal("unexpected registration error:", err) - } - - opts.Name = "request_duration_microseconds" - opts.Help = "The HTTP request latencies in microseconds." - reqDur := NewSummary(opts) - err = Register(reqDur) - if err == nil { - t.Fatal("expected reqDur to be registered already") - } - if are, ok := err.(AlreadyRegisteredError); ok { - reqDur = are.ExistingCollector.(Summary) - } else { - t.Fatal("unexpected registration error:", err) - } - - opts.Name = "request_size_bytes" - opts.Help = "The HTTP request sizes in bytes." - reqSz := NewSummary(opts) - err = Register(reqSz) - if err == nil { - t.Fatal("expected reqSz to be registered already") - } - if _, ok := err.(AlreadyRegisteredError); !ok { - t.Fatal("unexpected registration error:", err) - } - - opts.Name = "response_size_bytes" - opts.Help = "The HTTP response sizes in bytes." - resSz := NewSummary(opts) - err = Register(resSz) - if err == nil { - t.Fatal("expected resSz to be registered already") - } - if _, ok := err.(AlreadyRegisteredError); !ok { - t.Fatal("unexpected registration error:", err) - } - - reqCnt.Reset() - - resp := httptest.NewRecorder() - req := &http.Request{ - Method: "GET", - } - - hndlr.ServeHTTP(resp, req) - - if resp.Code != http.StatusTeapot { - t.Fatalf("expected status %d, got %d", http.StatusTeapot, resp.Code) - } - if resp.Body.String() != "Howdy there!" { - t.Fatalf("expected body %s, got %s", "Howdy there!", resp.Body.String()) - } - - out := &dto.Metric{} - reqDur.Write(out) - if want, got := "test-handler", out.Label[0].GetValue(); want != got { - t.Errorf("want label value %q in reqDur, got %q", want, got) - } - if want, got := uint64(1), out.Summary.GetSampleCount(); want != got { - t.Errorf("want sample count %d in reqDur, got %d", want, got) - } - - out.Reset() - if want, got := 1, len(reqCnt.metricMap.metrics); want != got { - t.Errorf("want %d children in reqCnt, got %d", want, got) - } - cnt, err := reqCnt.GetMetricWithLabelValues("get", "418") - if err != nil { - t.Fatal(err) - } - cnt.Write(out) - if want, got := "418", out.Label[0].GetValue(); want != got { - t.Errorf("want label value %q in reqCnt, got %q", want, got) - } - if want, got := "test-handler", out.Label[1].GetValue(); want != got { - t.Errorf("want label value %q in reqCnt, got %q", want, got) - } - if want, got := "get", out.Label[2].GetValue(); want != got { - t.Errorf("want label value %q in reqCnt, got %q", want, got) - } - if out.Counter == nil { - t.Fatal("expected non-nil counter in reqCnt") - } - if want, got := 1., out.Counter.GetValue(); want != got { - t.Errorf("want reqCnt of %f, got %f", want, got) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go deleted file mode 100644 index 351c26e1a..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2018 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal - -import ( - "sort" - - dto "github.com/prometheus/client_model/go" -) - -// metricSorter is a sortable slice of *dto.Metric. -type metricSorter []*dto.Metric - -func (s metricSorter) Len() int { - return len(s) -} - -func (s metricSorter) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s metricSorter) Less(i, j int) bool { - if len(s[i].Label) != len(s[j].Label) { - // This should not happen. The metrics are - // inconsistent. However, we have to deal with the fact, as - // people might use custom collectors or metric family injection - // to create inconsistent metrics. So let's simply compare the - // number of labels in this case. That will still yield - // reproducible sorting. - return len(s[i].Label) < len(s[j].Label) - } - for n, lp := range s[i].Label { - vi := lp.GetValue() - vj := s[j].Label[n].GetValue() - if vi != vj { - return vi < vj - } - } - - // We should never arrive here. Multiple metrics with the same - // label set in the same scrape will lead to undefined ingestion - // behavior. However, as above, we have to provide stable sorting - // here, even for inconsistent metrics. So sort equal metrics - // by their timestamp, with missing timestamps (implying "now") - // coming last. - if s[i].TimestampMs == nil { - return false - } - if s[j].TimestampMs == nil { - return true - } - return s[i].GetTimestampMs() < s[j].GetTimestampMs() -} - -// NormalizeMetricFamilies returns a MetricFamily slice with empty -// MetricFamilies pruned and the remaining MetricFamilies sorted by name within -// the slice, with the contained Metrics sorted within each MetricFamily. -func NormalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily { - for _, mf := range metricFamiliesByName { - sort.Sort(metricSorter(mf.Metric)) - } - names := make([]string, 0, len(metricFamiliesByName)) - for name, mf := range metricFamiliesByName { - if len(mf.Metric) > 0 { - names = append(names, name) - } - } - sort.Strings(names) - result := make([]*dto.MetricFamily, 0, len(names)) - for _, name := range names { - result = append(result, metricFamiliesByName[name]) - } - return result -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/labels.go b/vendor/github.com/prometheus/client_golang/prometheus/labels.go deleted file mode 100644 index e68f132ec..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/labels.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2018 The Prometheus 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 prometheus - -import ( - "errors" - "fmt" - "strings" - "unicode/utf8" - - "github.com/prometheus/common/model" -) - -// Labels represents a collection of label name -> value mappings. This type is -// commonly used with the With(Labels) and GetMetricWith(Labels) methods of -// metric vector Collectors, e.g.: -// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42) -// -// The other use-case is the specification of constant label pairs in Opts or to -// create a Desc. -type Labels map[string]string - -// reservedLabelPrefix is a prefix which is not legal in user-supplied -// label names. -const reservedLabelPrefix = "__" - -var errInconsistentCardinality = errors.New("inconsistent label cardinality") - -func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error { - if len(labels) != expectedNumberOfValues { - return errInconsistentCardinality - } - - for name, val := range labels { - if !utf8.ValidString(val) { - return fmt.Errorf("label %s: value %q is not valid UTF-8", name, val) - } - } - - return nil -} - -func validateLabelValues(vals []string, expectedNumberOfValues int) error { - if len(vals) != expectedNumberOfValues { - return errInconsistentCardinality - } - - for _, val := range vals { - if !utf8.ValidString(val) { - return fmt.Errorf("label value %q is not valid UTF-8", val) - } - } - - return nil -} - -func checkLabelName(l string) bool { - return model.LabelName(l).IsValid() && !strings.HasPrefix(l, reservedLabelPrefix) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/metric.go deleted file mode 100644 index 55e6d86d5..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/metric.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "strings" - "time" - - "github.com/golang/protobuf/proto" - - dto "github.com/prometheus/client_model/go" -) - -const separatorByte byte = 255 - -// A Metric models a single sample value with its meta data being exported to -// Prometheus. Implementations of Metric in this package are Gauge, Counter, -// Histogram, Summary, and Untyped. -type Metric interface { - // Desc returns the descriptor for the Metric. This method idempotently - // returns the same descriptor throughout the lifetime of the - // Metric. The returned descriptor is immutable by contract. A Metric - // unable to describe itself must return an invalid descriptor (created - // with NewInvalidDesc). - Desc() *Desc - // Write encodes the Metric into a "Metric" Protocol Buffer data - // transmission object. - // - // Metric implementations must observe concurrency safety as reads of - // this metric may occur at any time, and any blocking occurs at the - // expense of total performance of rendering all registered - // metrics. Ideally, Metric implementations should support concurrent - // readers. - // - // While populating dto.Metric, it is the responsibility of the - // implementation to ensure validity of the Metric protobuf (like valid - // UTF-8 strings or syntactically valid metric and label names). It is - // recommended to sort labels lexicographically. Callers of Write should - // still make sure of sorting if they depend on it. - Write(*dto.Metric) error - // TODO(beorn7): The original rationale of passing in a pre-allocated - // dto.Metric protobuf to save allocations has disappeared. The - // signature of this method should be changed to "Write() (*dto.Metric, - // error)". -} - -// Opts bundles the options for creating most Metric types. Each metric -// implementation XXX has its own XXXOpts type, but in most cases, it is just be -// an alias of this type (which might change when the requirement arises.) -// -// It is mandatory to set Name to a non-empty string. All other fields are -// optional and can safely be left at their zero value, although it is strongly -// encouraged to set a Help string. -type Opts struct { - // Namespace, Subsystem, and Name are components of the fully-qualified - // name of the Metric (created by joining these components with - // "_"). Only Name is mandatory, the others merely help structuring the - // name. Note that the fully-qualified name of the metric must be a - // valid Prometheus metric name. - Namespace string - Subsystem string - Name string - - // Help provides information about this metric. - // - // Metrics with the same fully-qualified name must have the same Help - // string. - Help string - - // ConstLabels are used to attach fixed labels to this metric. Metrics - // with the same fully-qualified name must have the same label names in - // their ConstLabels. - // - // ConstLabels are only used rarely. In particular, do not use them to - // attach the same labels to all your metrics. Those use cases are - // better covered by target labels set by the scraping Prometheus - // server, or by one specific metric (e.g. a build_info or a - // machine_role metric). See also - // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels,-not-static-scraped-labels - ConstLabels Labels -} - -// BuildFQName joins the given three name components by "_". Empty name -// components are ignored. If the name parameter itself is empty, an empty -// string is returned, no matter what. Metric implementations included in this -// library use this function internally to generate the fully-qualified metric -// name from the name component in their Opts. Users of the library will only -// need this function if they implement their own Metric or instantiate a Desc -// (with NewDesc) directly. -func BuildFQName(namespace, subsystem, name string) string { - if name == "" { - return "" - } - switch { - case namespace != "" && subsystem != "": - return strings.Join([]string{namespace, subsystem, name}, "_") - case namespace != "": - return strings.Join([]string{namespace, name}, "_") - case subsystem != "": - return strings.Join([]string{subsystem, name}, "_") - } - return name -} - -// labelPairSorter implements sort.Interface. It is used to sort a slice of -// dto.LabelPair pointers. -type labelPairSorter []*dto.LabelPair - -func (s labelPairSorter) Len() int { - return len(s) -} - -func (s labelPairSorter) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s labelPairSorter) Less(i, j int) bool { - return s[i].GetName() < s[j].GetName() -} - -type invalidMetric struct { - desc *Desc - err error -} - -// NewInvalidMetric returns a metric whose Write method always returns the -// provided error. It is useful if a Collector finds itself unable to collect -// a metric and wishes to report an error to the registry. -func NewInvalidMetric(desc *Desc, err error) Metric { - return &invalidMetric{desc, err} -} - -func (m *invalidMetric) Desc() *Desc { return m.desc } - -func (m *invalidMetric) Write(*dto.Metric) error { return m.err } - -type timestampedMetric struct { - Metric - t time.Time -} - -func (m timestampedMetric) Write(pb *dto.Metric) error { - e := m.Metric.Write(pb) - pb.TimestampMs = proto.Int64(m.t.Unix()*1000 + int64(m.t.Nanosecond()/1000000)) - return e -} - -// NewMetricWithTimestamp returns a new Metric wrapping the provided Metric in a -// way that it has an explicit timestamp set to the provided Time. This is only -// useful in rare cases as the timestamp of a Prometheus metric should usually -// be set by the Prometheus server during scraping. Exceptions include mirroring -// metrics with given timestamps from other metric -// sources. -// -// NewMetricWithTimestamp works best with MustNewConstMetric, -// MustNewConstHistogram, and MustNewConstSummary, see example. -// -// Currently, the exposition formats used by Prometheus are limited to -// millisecond resolution. Thus, the provided time will be rounded down to the -// next full millisecond value. -func NewMetricWithTimestamp(t time.Time, m Metric) Metric { - return timestampedMetric{Metric: m, t: t} -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/metric_test.go b/vendor/github.com/prometheus/client_golang/prometheus/metric_test.go deleted file mode 100644 index 7145f5e53..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/metric_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import "testing" - -func TestBuildFQName(t *testing.T) { - scenarios := []struct{ namespace, subsystem, name, result string }{ - {"a", "b", "c", "a_b_c"}, - {"", "b", "c", "b_c"}, - {"a", "", "c", "a_c"}, - {"", "", "c", "c"}, - {"a", "b", "", ""}, - {"a", "", "", ""}, - {"", "b", "", ""}, - {" ", "", "", ""}, - } - - for i, s := range scenarios { - if want, got := s.result, BuildFQName(s.namespace, s.subsystem, s.name); want != got { - t.Errorf("%d. want %s, got %s", i, want, got) - } - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/observer.go b/vendor/github.com/prometheus/client_golang/prometheus/observer.go deleted file mode 100644 index 5806cd09e..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/observer.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2017 The Prometheus 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 prometheus - -// Observer is the interface that wraps the Observe method, which is used by -// Histogram and Summary to add observations. -type Observer interface { - Observe(float64) -} - -// The ObserverFunc type is an adapter to allow the use of ordinary -// functions as Observers. If f is a function with the appropriate -// signature, ObserverFunc(f) is an Observer that calls f. -// -// This adapter is usually used in connection with the Timer type, and there are -// two general use cases: -// -// The most common one is to use a Gauge as the Observer for a Timer. -// See the "Gauge" Timer example. -// -// The more advanced use case is to create a function that dynamically decides -// which Observer to use for observing the duration. See the "Complex" Timer -// example. -type ObserverFunc func(float64) - -// Observe calls f(value). It implements Observer. -func (f ObserverFunc) Observe(value float64) { - f(value) -} - -// ObserverVec is an interface implemented by `HistogramVec` and `SummaryVec`. -type ObserverVec interface { - GetMetricWith(Labels) (Observer, error) - GetMetricWithLabelValues(lvs ...string) (Observer, error) - With(Labels) Observer - WithLabelValues(...string) Observer - CurryWith(Labels) (ObserverVec, error) - MustCurryWith(Labels) ObserverVec - - Collector -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go deleted file mode 100644 index 55176d58c..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright 2015 The Prometheus 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 prometheus - -import ( - "errors" - "os" - - "github.com/prometheus/procfs" -) - -type processCollector struct { - collectFn func(chan<- Metric) - pidFn func() (int, error) - reportErrors bool - cpuTotal *Desc - openFDs, maxFDs *Desc - vsize, maxVsize *Desc - rss *Desc - startTime *Desc -} - -// ProcessCollectorOpts defines the behavior of a process metrics collector -// created with NewProcessCollector. -type ProcessCollectorOpts struct { - // PidFn returns the PID of the process the collector collects metrics - // for. It is called upon each collection. By default, the PID of the - // current process is used, as determined on construction time by - // calling os.Getpid(). - PidFn func() (int, error) - // If non-empty, each of the collected metrics is prefixed by the - // provided string and an underscore ("_"). - Namespace string - // If true, any error encountered during collection is reported as an - // invalid metric (see NewInvalidMetric). Otherwise, errors are ignored - // and the collected metrics will be incomplete. (Possibly, no metrics - // will be collected at all.) While that's usually not desired, it is - // appropriate for the common "mix-in" of process metrics, where process - // metrics are nice to have, but failing to collect them should not - // disrupt the collection of the remaining metrics. - ReportErrors bool -} - -// NewProcessCollector returns a collector which exports the current state of -// process metrics including CPU, memory and file descriptor usage as well as -// the process start time. The detailed behavior is defined by the provided -// ProcessCollectorOpts. The zero value of ProcessCollectorOpts creates a -// collector for the current process with an empty namespace string and no error -// reporting. -// -// Currently, the collector depends on a Linux-style proc filesystem and -// therefore only exports metrics for Linux. -// -// Note: An older version of this function had the following signature: -// -// NewProcessCollector(pid int, namespace string) Collector -// -// Most commonly, it was called as -// -// NewProcessCollector(os.Getpid(), "") -// -// The following call of the current version is equivalent to the above: -// -// NewProcessCollector(ProcessCollectorOpts{}) -func NewProcessCollector(opts ProcessCollectorOpts) Collector { - ns := "" - if len(opts.Namespace) > 0 { - ns = opts.Namespace + "_" - } - - c := &processCollector{ - reportErrors: opts.ReportErrors, - cpuTotal: NewDesc( - ns+"process_cpu_seconds_total", - "Total user and system CPU time spent in seconds.", - nil, nil, - ), - openFDs: NewDesc( - ns+"process_open_fds", - "Number of open file descriptors.", - nil, nil, - ), - maxFDs: NewDesc( - ns+"process_max_fds", - "Maximum number of open file descriptors.", - nil, nil, - ), - vsize: NewDesc( - ns+"process_virtual_memory_bytes", - "Virtual memory size in bytes.", - nil, nil, - ), - maxVsize: NewDesc( - ns+"process_virtual_memory_max_bytes", - "Maximum amount of virtual memory available in bytes.", - nil, nil, - ), - rss: NewDesc( - ns+"process_resident_memory_bytes", - "Resident memory size in bytes.", - nil, nil, - ), - startTime: NewDesc( - ns+"process_start_time_seconds", - "Start time of the process since unix epoch in seconds.", - nil, nil, - ), - } - - if opts.PidFn == nil { - pid := os.Getpid() - c.pidFn = func() (int, error) { return pid, nil } - } else { - c.pidFn = opts.PidFn - } - - // Set up process metric collection if supported by the runtime. - if _, err := procfs.NewStat(); err == nil { - c.collectFn = c.processCollect - } else { - c.collectFn = func(ch chan<- Metric) { - c.reportError(ch, nil, errors.New("process metrics not supported on this platform")) - } - } - - return c -} - -// Describe returns all descriptions of the collector. -func (c *processCollector) Describe(ch chan<- *Desc) { - ch <- c.cpuTotal - ch <- c.openFDs - ch <- c.maxFDs - ch <- c.vsize - ch <- c.maxVsize - ch <- c.rss - ch <- c.startTime -} - -// Collect returns the current state of all metrics of the collector. -func (c *processCollector) Collect(ch chan<- Metric) { - c.collectFn(ch) -} - -func (c *processCollector) processCollect(ch chan<- Metric) { - pid, err := c.pidFn() - if err != nil { - c.reportError(ch, nil, err) - return - } - - p, err := procfs.NewProc(pid) - if err != nil { - c.reportError(ch, nil, err) - return - } - - if stat, err := p.NewStat(); err == nil { - ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime()) - ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory())) - ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory())) - if startTime, err := stat.StartTime(); err == nil { - ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime) - } else { - c.reportError(ch, c.startTime, err) - } - } else { - c.reportError(ch, nil, err) - } - - if fds, err := p.FileDescriptorsLen(); err == nil { - ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds)) - } else { - c.reportError(ch, c.openFDs, err) - } - - if limits, err := p.NewLimits(); err == nil { - ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles)) - ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace)) - } else { - c.reportError(ch, nil, err) - } -} - -func (c *processCollector) reportError(ch chan<- Metric, desc *Desc, err error) { - if !c.reportErrors { - return - } - if desc == nil { - desc = NewInvalidDesc(err) - } - ch <- NewInvalidMetric(desc, err) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_test.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_test.go deleted file mode 100644 index 8651d4f13..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_test.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2018 The Prometheus 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. - -// +build linux - -package prometheus - -import ( - "bytes" - "errors" - "os" - "regexp" - "testing" - - "github.com/prometheus/common/expfmt" - "github.com/prometheus/procfs" - - dto "github.com/prometheus/client_model/go" -) - -func TestProcessCollector(t *testing.T) { - if _, err := procfs.Self(); err != nil { - t.Skipf("skipping TestProcessCollector, procfs not available: %s", err) - } - - registry := NewRegistry() - if err := registry.Register(NewProcessCollector(ProcessCollectorOpts{})); err != nil { - t.Fatal(err) - } - if err := registry.Register(NewProcessCollector(ProcessCollectorOpts{ - PidFn: func() (int, error) { return os.Getpid(), nil }, - Namespace: "foobar", - ReportErrors: true, // No errors expected, just to see if none are reported. - })); err != nil { - t.Fatal(err) - } - - mfs, err := registry.Gather() - if err != nil { - t.Fatal(err) - } - - var buf bytes.Buffer - for _, mf := range mfs { - if _, err := expfmt.MetricFamilyToText(&buf, mf); err != nil { - t.Fatal(err) - } - } - - for _, re := range []*regexp.Regexp{ - regexp.MustCompile("\nprocess_cpu_seconds_total [0-9]"), - regexp.MustCompile("\nprocess_max_fds [1-9]"), - regexp.MustCompile("\nprocess_open_fds [1-9]"), - regexp.MustCompile("\nprocess_virtual_memory_max_bytes (-1|[1-9])"), - regexp.MustCompile("\nprocess_virtual_memory_bytes [1-9]"), - regexp.MustCompile("\nprocess_resident_memory_bytes [1-9]"), - regexp.MustCompile("\nprocess_start_time_seconds [0-9.]{10,}"), - regexp.MustCompile("\nfoobar_process_cpu_seconds_total [0-9]"), - regexp.MustCompile("\nfoobar_process_max_fds [1-9]"), - regexp.MustCompile("\nfoobar_process_open_fds [1-9]"), - regexp.MustCompile("\nfoobar_process_virtual_memory_max_bytes (-1|[1-9])"), - regexp.MustCompile("\nfoobar_process_virtual_memory_bytes [1-9]"), - regexp.MustCompile("\nfoobar_process_resident_memory_bytes [1-9]"), - regexp.MustCompile("\nfoobar_process_start_time_seconds [0-9.]{10,}"), - } { - if !re.Match(buf.Bytes()) { - t.Errorf("want body to match %s\n%s", re, buf.String()) - } - } - - brokenProcessCollector := NewProcessCollector(ProcessCollectorOpts{ - PidFn: func() (int, error) { return 0, errors.New("boo") }, - ReportErrors: true, - }) - - ch := make(chan Metric) - go func() { - brokenProcessCollector.Collect(ch) - close(ch) - }() - n := 0 - for m := range ch { - n++ - pb := &dto.Metric{} - err := m.Write(pb) - if err == nil { - t.Error("metric collected from broken process collector is unexpectedly valid") - } - } - if n != 1 { - t.Errorf("%d metrics collected, want 1", n) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promauto/auto.go b/vendor/github.com/prometheus/client_golang/prometheus/promauto/auto.go deleted file mode 100644 index a00ba1eb8..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promauto/auto.go +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright 2018 The Prometheus 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 promauto provides constructors for the usual Prometheus metrics that -// return them already registered with the global registry -// (prometheus.DefaultRegisterer). This allows very compact code, avoiding any -// references to the registry altogether, but all the constructors in this -// package will panic if the registration fails. -// -// The following example is a complete program to create a histogram of normally -// distributed random numbers from the math/rand package: -// -// package main -// -// import ( -// "math/rand" -// "net/http" -// -// "github.com/prometheus/client_golang/prometheus" -// "github.com/prometheus/client_golang/prometheus/promauto" -// "github.com/prometheus/client_golang/prometheus/promhttp" -// ) -// -// var histogram = promauto.NewHistogram(prometheus.HistogramOpts{ -// Name: "random_numbers", -// Help: "A histogram of normally distributed random numbers.", -// Buckets: prometheus.LinearBuckets(-3, .1, 61), -// }) -// -// func Random() { -// for { -// histogram.Observe(rand.NormFloat64()) -// } -// } -// -// func main() { -// go Random() -// http.Handle("/metrics", promhttp.Handler()) -// http.ListenAndServe(":1971", nil) -// } -// -// Prometheus's version of a minimal hello-world program: -// -// package main -// -// import ( -// "fmt" -// "net/http" -// -// "github.com/prometheus/client_golang/prometheus" -// "github.com/prometheus/client_golang/prometheus/promauto" -// "github.com/prometheus/client_golang/prometheus/promhttp" -// ) -// -// func main() { -// http.Handle("/", promhttp.InstrumentHandlerCounter( -// promauto.NewCounterVec( -// prometheus.CounterOpts{ -// Name: "hello_requests_total", -// Help: "Total number of hello-world requests by HTTP code.", -// }, -// []string{"code"}, -// ), -// http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// fmt.Fprint(w, "Hello, world!") -// }), -// )) -// http.Handle("/metrics", promhttp.Handler()) -// http.ListenAndServe(":1971", nil) -// } -// -// This appears very handy. So why are these constructors locked away in a -// separate package? There are two caveats: -// -// First, in more complex programs, global state is often quite problematic. -// That's the reason why the metrics constructors in the prometheus package do -// not interact with the global prometheus.DefaultRegisterer on their own. You -// are free to use the Register or MustRegister functions to register them with -// the global prometheus.DefaultRegisterer, but you could as well choose a local -// Registerer (usually created with prometheus.NewRegistry, but there are other -// scenarios, e.g. testing). -// -// The second issue is that registration may fail, e.g. if a metric inconsistent -// with the newly to be registered one is already registered. But how to signal -// and handle a panic in the automatic registration with the default registry? -// The only way is panicking. While panicking on invalid input provided by the -// programmer is certainly fine, things are a bit more subtle in this case: You -// might just add another package to the program, and that package (in its init -// function) happens to register a metric with the same name as your code. Now, -// all of a sudden, either your code or the code of the newly imported package -// panics, depending on initialization order, without any opportunity to handle -// the case gracefully. Even worse is a scenario where registration happens -// later during the runtime (e.g. upon loading some kind of plugin), where the -// panic could be triggered long after the code has been deployed to -// production. A possibility to panic should be explicitly called out by the -// Must… idiom, cf. prometheus.MustRegister. But adding a separate set of -// constructors in the prometheus package called MustRegisterNewCounterVec or -// similar would be quite unwieldy. Adding an extra MustRegister method to each -// metric, returning the registered metric, would result in nice code for those -// using the method, but would pollute every single metric interface for -// everybody avoiding the global registry. -// -// To address both issues, the problematic auto-registering and possibly -// panicking constructors are all in this package with a clear warning -// ahead. And whoever cares about avoiding global state and possibly panicking -// function calls can simply ignore the existence of the promauto package -// altogether. -// -// A final note: There is a similar case in the net/http package of the standard -// library. It has DefaultServeMux as a global instance of ServeMux, and the -// Handle function acts on it, panicking if a handler for the same pattern has -// already been registered. However, one might argue that the whole HTTP routing -// is usually set up closely together in the same package or file, while -// Prometheus metrics tend to be spread widely over the codebase, increasing the -// chance of surprising registration failures. Furthermore, the use of global -// state in net/http has been criticized widely, and some avoid it altogether. -package promauto - -import "github.com/prometheus/client_golang/prometheus" - -// NewCounter works like the function of the same name in the prometheus package -// but it automatically registers the Counter with the -// prometheus.DefaultRegisterer. If the registration fails, NewCounter panics. -func NewCounter(opts prometheus.CounterOpts) prometheus.Counter { - c := prometheus.NewCounter(opts) - prometheus.MustRegister(c) - return c -} - -// NewCounterVec works like the function of the same name in the prometheus -// package but it automatically registers the CounterVec with the -// prometheus.DefaultRegisterer. If the registration fails, NewCounterVec -// panics. -func NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec { - c := prometheus.NewCounterVec(opts, labelNames) - prometheus.MustRegister(c) - return c -} - -// NewCounterFunc works like the function of the same name in the prometheus -// package but it automatically registers the CounterFunc with the -// prometheus.DefaultRegisterer. If the registration fails, NewCounterFunc -// panics. -func NewCounterFunc(opts prometheus.CounterOpts, function func() float64) prometheus.CounterFunc { - g := prometheus.NewCounterFunc(opts, function) - prometheus.MustRegister(g) - return g -} - -// NewGauge works like the function of the same name in the prometheus package -// but it automatically registers the Gauge with the -// prometheus.DefaultRegisterer. If the registration fails, NewGauge panics. -func NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge { - g := prometheus.NewGauge(opts) - prometheus.MustRegister(g) - return g -} - -// NewGaugeVec works like the function of the same name in the prometheus -// package but it automatically registers the GaugeVec with the -// prometheus.DefaultRegisterer. If the registration fails, NewGaugeVec panics. -func NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec { - g := prometheus.NewGaugeVec(opts, labelNames) - prometheus.MustRegister(g) - return g -} - -// NewGaugeFunc works like the function of the same name in the prometheus -// package but it automatically registers the GaugeFunc with the -// prometheus.DefaultRegisterer. If the registration fails, NewGaugeFunc panics. -func NewGaugeFunc(opts prometheus.GaugeOpts, function func() float64) prometheus.GaugeFunc { - g := prometheus.NewGaugeFunc(opts, function) - prometheus.MustRegister(g) - return g -} - -// NewSummary works like the function of the same name in the prometheus package -// but it automatically registers the Summary with the -// prometheus.DefaultRegisterer. If the registration fails, NewSummary panics. -func NewSummary(opts prometheus.SummaryOpts) prometheus.Summary { - s := prometheus.NewSummary(opts) - prometheus.MustRegister(s) - return s -} - -// NewSummaryVec works like the function of the same name in the prometheus -// package but it automatically registers the SummaryVec with the -// prometheus.DefaultRegisterer. If the registration fails, NewSummaryVec -// panics. -func NewSummaryVec(opts prometheus.SummaryOpts, labelNames []string) *prometheus.SummaryVec { - s := prometheus.NewSummaryVec(opts, labelNames) - prometheus.MustRegister(s) - return s -} - -// NewHistogram works like the function of the same name in the prometheus -// package but it automatically registers the Histogram with the -// prometheus.DefaultRegisterer. If the registration fails, NewHistogram panics. -func NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram { - h := prometheus.NewHistogram(opts) - prometheus.MustRegister(h) - return h -} - -// NewHistogramVec works like the function of the same name in the prometheus -// package but it automatically registers the HistogramVec with the -// prometheus.DefaultRegisterer. If the registration fails, NewHistogramVec -// panics. -func NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec { - h := prometheus.NewHistogramVec(opts, labelNames) - prometheus.MustRegister(h) - return h -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go deleted file mode 100644 index 67b56d37c..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2017 The Prometheus 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 promhttp - -import ( - "bufio" - "io" - "net" - "net/http" -) - -const ( - closeNotifier = 1 << iota - flusher - hijacker - readerFrom - pusher -) - -type delegator interface { - http.ResponseWriter - - Status() int - Written() int64 -} - -type responseWriterDelegator struct { - http.ResponseWriter - - handler, method string - status int - written int64 - wroteHeader bool - observeWriteHeader func(int) -} - -func (r *responseWriterDelegator) Status() int { - return r.status -} - -func (r *responseWriterDelegator) Written() int64 { - return r.written -} - -func (r *responseWriterDelegator) WriteHeader(code int) { - r.status = code - r.wroteHeader = true - r.ResponseWriter.WriteHeader(code) - if r.observeWriteHeader != nil { - r.observeWriteHeader(code) - } -} - -func (r *responseWriterDelegator) Write(b []byte) (int, error) { - if !r.wroteHeader { - r.WriteHeader(http.StatusOK) - } - n, err := r.ResponseWriter.Write(b) - r.written += int64(n) - return n, err -} - -type closeNotifierDelegator struct{ *responseWriterDelegator } -type flusherDelegator struct{ *responseWriterDelegator } -type hijackerDelegator struct{ *responseWriterDelegator } -type readerFromDelegator struct{ *responseWriterDelegator } - -func (d closeNotifierDelegator) CloseNotify() <-chan bool { - return d.ResponseWriter.(http.CloseNotifier).CloseNotify() -} -func (d flusherDelegator) Flush() { - d.ResponseWriter.(http.Flusher).Flush() -} -func (d hijackerDelegator) Hijack() (net.Conn, *bufio.ReadWriter, error) { - return d.ResponseWriter.(http.Hijacker).Hijack() -} -func (d readerFromDelegator) ReadFrom(re io.Reader) (int64, error) { - if !d.wroteHeader { - d.WriteHeader(http.StatusOK) - } - n, err := d.ResponseWriter.(io.ReaderFrom).ReadFrom(re) - d.written += n - return n, err -} - -var pickDelegator = make([]func(*responseWriterDelegator) delegator, 32) - -func init() { - // TODO(beorn7): Code generation would help here. - pickDelegator[0] = func(d *responseWriterDelegator) delegator { // 0 - return d - } - pickDelegator[closeNotifier] = func(d *responseWriterDelegator) delegator { // 1 - return closeNotifierDelegator{d} - } - pickDelegator[flusher] = func(d *responseWriterDelegator) delegator { // 2 - return flusherDelegator{d} - } - pickDelegator[flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 3 - return struct { - *responseWriterDelegator - http.Flusher - http.CloseNotifier - }{d, flusherDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[hijacker] = func(d *responseWriterDelegator) delegator { // 4 - return hijackerDelegator{d} - } - pickDelegator[hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 5 - return struct { - *responseWriterDelegator - http.Hijacker - http.CloseNotifier - }{d, hijackerDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 6 - return struct { - *responseWriterDelegator - http.Hijacker - http.Flusher - }{d, hijackerDelegator{d}, flusherDelegator{d}} - } - pickDelegator[hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 7 - return struct { - *responseWriterDelegator - http.Hijacker - http.Flusher - http.CloseNotifier - }{d, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[readerFrom] = func(d *responseWriterDelegator) delegator { // 8 - return readerFromDelegator{d} - } - pickDelegator[readerFrom+closeNotifier] = func(d *responseWriterDelegator) delegator { // 9 - return struct { - *responseWriterDelegator - io.ReaderFrom - http.CloseNotifier - }{d, readerFromDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 10 - return struct { - *responseWriterDelegator - io.ReaderFrom - http.Flusher - }{d, readerFromDelegator{d}, flusherDelegator{d}} - } - pickDelegator[readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 11 - return struct { - *responseWriterDelegator - io.ReaderFrom - http.Flusher - http.CloseNotifier - }{d, readerFromDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 12 - return struct { - *responseWriterDelegator - io.ReaderFrom - http.Hijacker - }{d, readerFromDelegator{d}, hijackerDelegator{d}} - } - pickDelegator[readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 13 - return struct { - *responseWriterDelegator - io.ReaderFrom - http.Hijacker - http.CloseNotifier - }{d, readerFromDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 14 - return struct { - *responseWriterDelegator - io.ReaderFrom - http.Hijacker - http.Flusher - }{d, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}} - } - pickDelegator[readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 15 - return struct { - *responseWriterDelegator - io.ReaderFrom - http.Hijacker - http.Flusher - http.CloseNotifier - }{d, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_1_8.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_1_8.go deleted file mode 100644 index 31a706956..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_1_8.go +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright 2017 The Prometheus 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. - -// +build go1.8 - -package promhttp - -import ( - "io" - "net/http" -) - -type pusherDelegator struct{ *responseWriterDelegator } - -func (d pusherDelegator) Push(target string, opts *http.PushOptions) error { - return d.ResponseWriter.(http.Pusher).Push(target, opts) -} - -func init() { - pickDelegator[pusher] = func(d *responseWriterDelegator) delegator { // 16 - return pusherDelegator{d} - } - pickDelegator[pusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 17 - return struct { - *responseWriterDelegator - http.Pusher - http.CloseNotifier - }{d, pusherDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[pusher+flusher] = func(d *responseWriterDelegator) delegator { // 18 - return struct { - *responseWriterDelegator - http.Pusher - http.Flusher - }{d, pusherDelegator{d}, flusherDelegator{d}} - } - pickDelegator[pusher+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 19 - return struct { - *responseWriterDelegator - http.Pusher - http.Flusher - http.CloseNotifier - }{d, pusherDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[pusher+hijacker] = func(d *responseWriterDelegator) delegator { // 20 - return struct { - *responseWriterDelegator - http.Pusher - http.Hijacker - }{d, pusherDelegator{d}, hijackerDelegator{d}} - } - pickDelegator[pusher+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 21 - return struct { - *responseWriterDelegator - http.Pusher - http.Hijacker - http.CloseNotifier - }{d, pusherDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[pusher+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 22 - return struct { - *responseWriterDelegator - http.Pusher - http.Hijacker - http.Flusher - }{d, pusherDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}} - } - pickDelegator[pusher+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { //23 - return struct { - *responseWriterDelegator - http.Pusher - http.Hijacker - http.Flusher - http.CloseNotifier - }{d, pusherDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[pusher+readerFrom] = func(d *responseWriterDelegator) delegator { // 24 - return struct { - *responseWriterDelegator - http.Pusher - io.ReaderFrom - }{d, pusherDelegator{d}, readerFromDelegator{d}} - } - pickDelegator[pusher+readerFrom+closeNotifier] = func(d *responseWriterDelegator) delegator { // 25 - return struct { - *responseWriterDelegator - http.Pusher - io.ReaderFrom - http.CloseNotifier - }{d, pusherDelegator{d}, readerFromDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[pusher+readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 26 - return struct { - *responseWriterDelegator - http.Pusher - io.ReaderFrom - http.Flusher - }{d, pusherDelegator{d}, readerFromDelegator{d}, flusherDelegator{d}} - } - pickDelegator[pusher+readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 27 - return struct { - *responseWriterDelegator - http.Pusher - io.ReaderFrom - http.Flusher - http.CloseNotifier - }{d, pusherDelegator{d}, readerFromDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[pusher+readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 28 - return struct { - *responseWriterDelegator - http.Pusher - io.ReaderFrom - http.Hijacker - }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}} - } - pickDelegator[pusher+readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 29 - return struct { - *responseWriterDelegator - http.Pusher - io.ReaderFrom - http.Hijacker - http.CloseNotifier - }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}} - } - pickDelegator[pusher+readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 30 - return struct { - *responseWriterDelegator - http.Pusher - io.ReaderFrom - http.Hijacker - http.Flusher - }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}} - } - pickDelegator[pusher+readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 31 - return struct { - *responseWriterDelegator - http.Pusher - io.ReaderFrom - http.Hijacker - http.Flusher - http.CloseNotifier - }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} - } -} - -func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) delegator { - d := &responseWriterDelegator{ - ResponseWriter: w, - observeWriteHeader: observeWriteHeaderFunc, - } - - id := 0 - if _, ok := w.(http.CloseNotifier); ok { - id += closeNotifier - } - if _, ok := w.(http.Flusher); ok { - id += flusher - } - if _, ok := w.(http.Hijacker); ok { - id += hijacker - } - if _, ok := w.(io.ReaderFrom); ok { - id += readerFrom - } - if _, ok := w.(http.Pusher); ok { - id += pusher - } - - return pickDelegator[id](d) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_pre_1_8.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_pre_1_8.go deleted file mode 100644 index 8bb9b8b68..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator_pre_1_8.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 The Prometheus 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. - -// +build !go1.8 - -package promhttp - -import ( - "io" - "net/http" -) - -func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) delegator { - d := &responseWriterDelegator{ - ResponseWriter: w, - observeWriteHeader: observeWriteHeaderFunc, - } - - id := 0 - if _, ok := w.(http.CloseNotifier); ok { - id += closeNotifier - } - if _, ok := w.(http.Flusher); ok { - id += flusher - } - if _, ok := w.(http.Hijacker); ok { - id += hijacker - } - if _, ok := w.(io.ReaderFrom); ok { - id += readerFrom - } - - return pickDelegator[id](d) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go deleted file mode 100644 index 01357374f..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright 2016 The Prometheus 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 promhttp provides tooling around HTTP servers and clients. -// -// First, the package allows the creation of http.Handler instances to expose -// Prometheus metrics via HTTP. promhttp.Handler acts on the -// prometheus.DefaultGatherer. With HandlerFor, you can create a handler for a -// custom registry or anything that implements the Gatherer interface. It also -// allows the creation of handlers that act differently on errors or allow to -// log errors. -// -// Second, the package provides tooling to instrument instances of http.Handler -// via middleware. Middleware wrappers follow the naming scheme -// InstrumentHandlerX, where X describes the intended use of the middleware. -// See each function's doc comment for specific details. -// -// Finally, the package allows for an http.RoundTripper to be instrumented via -// middleware. Middleware wrappers follow the naming scheme -// InstrumentRoundTripperX, where X describes the intended use of the -// middleware. See each function's doc comment for specific details. -package promhttp - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "net/http" - "strings" - "sync" - "time" - - "github.com/prometheus/common/expfmt" - - "github.com/prometheus/client_golang/prometheus" -) - -const ( - contentTypeHeader = "Content-Type" - contentLengthHeader = "Content-Length" - contentEncodingHeader = "Content-Encoding" - acceptEncodingHeader = "Accept-Encoding" -) - -var bufPool sync.Pool - -func getBuf() *bytes.Buffer { - buf := bufPool.Get() - if buf == nil { - return &bytes.Buffer{} - } - return buf.(*bytes.Buffer) -} - -func giveBuf(buf *bytes.Buffer) { - buf.Reset() - bufPool.Put(buf) -} - -// Handler returns an http.Handler for the prometheus.DefaultGatherer, using -// default HandlerOpts, i.e. it reports the first error as an HTTP error, it has -// no error logging, and it applies compression if requested by the client. -// -// The returned http.Handler is already instrumented using the -// InstrumentMetricHandler function and the prometheus.DefaultRegisterer. If you -// create multiple http.Handlers by separate calls of the Handler function, the -// metrics used for instrumentation will be shared between them, providing -// global scrape counts. -// -// This function is meant to cover the bulk of basic use cases. If you are doing -// anything that requires more customization (including using a non-default -// Gatherer, different instrumentation, and non-default HandlerOpts), use the -// HandlerFor function. See there for details. -func Handler() http.Handler { - return InstrumentMetricHandler( - prometheus.DefaultRegisterer, HandlerFor(prometheus.DefaultGatherer, HandlerOpts{}), - ) -} - -// HandlerFor returns an uninstrumented http.Handler for the provided -// Gatherer. The behavior of the Handler is defined by the provided -// HandlerOpts. Thus, HandlerFor is useful to create http.Handlers for custom -// Gatherers, with non-default HandlerOpts, and/or with custom (or no) -// instrumentation. Use the InstrumentMetricHandler function to apply the same -// kind of instrumentation as it is used by the Handler function. -func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler { - var inFlightSem chan struct{} - if opts.MaxRequestsInFlight > 0 { - inFlightSem = make(chan struct{}, opts.MaxRequestsInFlight) - } - - h := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - if inFlightSem != nil { - select { - case inFlightSem <- struct{}{}: // All good, carry on. - defer func() { <-inFlightSem }() - default: - http.Error(w, fmt.Sprintf( - "Limit of concurrent requests reached (%d), try again later.", opts.MaxRequestsInFlight, - ), http.StatusServiceUnavailable) - return - } - } - - mfs, err := reg.Gather() - if err != nil { - if opts.ErrorLog != nil { - opts.ErrorLog.Println("error gathering metrics:", err) - } - switch opts.ErrorHandling { - case PanicOnError: - panic(err) - case ContinueOnError: - if len(mfs) == 0 { - http.Error(w, "No metrics gathered, last error:\n\n"+err.Error(), http.StatusInternalServerError) - return - } - case HTTPErrorOnError: - http.Error(w, "An error has occurred during metrics gathering:\n\n"+err.Error(), http.StatusInternalServerError) - return - } - } - - contentType := expfmt.Negotiate(req.Header) - buf := getBuf() - defer giveBuf(buf) - writer, encoding := decorateWriter(req, buf, opts.DisableCompression) - enc := expfmt.NewEncoder(writer, contentType) - var lastErr error - for _, mf := range mfs { - if err := enc.Encode(mf); err != nil { - lastErr = err - if opts.ErrorLog != nil { - opts.ErrorLog.Println("error encoding metric family:", err) - } - switch opts.ErrorHandling { - case PanicOnError: - panic(err) - case ContinueOnError: - // Handled later. - case HTTPErrorOnError: - http.Error(w, "An error has occurred during metrics encoding:\n\n"+err.Error(), http.StatusInternalServerError) - return - } - } - } - if closer, ok := writer.(io.Closer); ok { - closer.Close() - } - if lastErr != nil && buf.Len() == 0 { - http.Error(w, "No metrics encoded, last error:\n\n"+lastErr.Error(), http.StatusInternalServerError) - return - } - header := w.Header() - header.Set(contentTypeHeader, string(contentType)) - header.Set(contentLengthHeader, fmt.Sprint(buf.Len())) - if encoding != "" { - header.Set(contentEncodingHeader, encoding) - } - if _, err := w.Write(buf.Bytes()); err != nil && opts.ErrorLog != nil { - opts.ErrorLog.Println("error while sending encoded metrics:", err) - } - // TODO(beorn7): Consider streaming serving of metrics. - }) - - if opts.Timeout <= 0 { - return h - } - return http.TimeoutHandler(h, opts.Timeout, fmt.Sprintf( - "Exceeded configured timeout of %v.\n", - opts.Timeout, - )) -} - -// InstrumentMetricHandler is usually used with an http.Handler returned by the -// HandlerFor function. It instruments the provided http.Handler with two -// metrics: A counter vector "promhttp_metric_handler_requests_total" to count -// scrapes partitioned by HTTP status code, and a gauge -// "promhttp_metric_handler_requests_in_flight" to track the number of -// simultaneous scrapes. This function idempotently registers collectors for -// both metrics with the provided Registerer. It panics if the registration -// fails. The provided metrics are useful to see how many scrapes hit the -// monitored target (which could be from different Prometheus servers or other -// scrapers), and how often they overlap (which would result in more than one -// scrape in flight at the same time). Note that the scrapes-in-flight gauge -// will contain the scrape by which it is exposed, while the scrape counter will -// only get incremented after the scrape is complete (as only then the status -// code is known). For tracking scrape durations, use the -// "scrape_duration_seconds" gauge created by the Prometheus server upon each -// scrape. -func InstrumentMetricHandler(reg prometheus.Registerer, handler http.Handler) http.Handler { - cnt := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "promhttp_metric_handler_requests_total", - Help: "Total number of scrapes by HTTP status code.", - }, - []string{"code"}, - ) - // Initialize the most likely HTTP status codes. - cnt.WithLabelValues("200") - cnt.WithLabelValues("500") - cnt.WithLabelValues("503") - if err := reg.Register(cnt); err != nil { - if are, ok := err.(prometheus.AlreadyRegisteredError); ok { - cnt = are.ExistingCollector.(*prometheus.CounterVec) - } else { - panic(err) - } - } - - gge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "promhttp_metric_handler_requests_in_flight", - Help: "Current number of scrapes being served.", - }) - if err := reg.Register(gge); err != nil { - if are, ok := err.(prometheus.AlreadyRegisteredError); ok { - gge = are.ExistingCollector.(prometheus.Gauge) - } else { - panic(err) - } - } - - return InstrumentHandlerCounter(cnt, InstrumentHandlerInFlight(gge, handler)) -} - -// HandlerErrorHandling defines how a Handler serving metrics will handle -// errors. -type HandlerErrorHandling int - -// These constants cause handlers serving metrics to behave as described if -// errors are encountered. -const ( - // Serve an HTTP status code 500 upon the first error - // encountered. Report the error message in the body. - HTTPErrorOnError HandlerErrorHandling = iota - // Ignore errors and try to serve as many metrics as possible. However, - // if no metrics can be served, serve an HTTP status code 500 and the - // last error message in the body. Only use this in deliberate "best - // effort" metrics collection scenarios. It is recommended to at least - // log errors (by providing an ErrorLog in HandlerOpts) to not mask - // errors completely. - ContinueOnError - // Panic upon the first error encountered (useful for "crash only" apps). - PanicOnError -) - -// Logger is the minimal interface HandlerOpts needs for logging. Note that -// log.Logger from the standard library implements this interface, and it is -// easy to implement by custom loggers, if they don't do so already anyway. -type Logger interface { - Println(v ...interface{}) -} - -// HandlerOpts specifies options how to serve metrics via an http.Handler. The -// zero value of HandlerOpts is a reasonable default. -type HandlerOpts struct { - // ErrorLog specifies an optional logger for errors collecting and - // serving metrics. If nil, errors are not logged at all. - ErrorLog Logger - // ErrorHandling defines how errors are handled. Note that errors are - // logged regardless of the configured ErrorHandling provided ErrorLog - // is not nil. - ErrorHandling HandlerErrorHandling - // If DisableCompression is true, the handler will never compress the - // response, even if requested by the client. - DisableCompression bool - // The number of concurrent HTTP requests is limited to - // MaxRequestsInFlight. Additional requests are responded to with 503 - // Service Unavailable and a suitable message in the body. If - // MaxRequestsInFlight is 0 or negative, no limit is applied. - MaxRequestsInFlight int - // If handling a request takes longer than Timeout, it is responded to - // with 503 ServiceUnavailable and a suitable Message. No timeout is - // applied if Timeout is 0 or negative. Note that with the current - // implementation, reaching the timeout simply ends the HTTP requests as - // described above (and even that only if sending of the body hasn't - // started yet), while the bulk work of gathering all the metrics keeps - // running in the background (with the eventual result to be thrown - // away). Until the implementation is improved, it is recommended to - // implement a separate timeout in potentially slow Collectors. - Timeout time.Duration -} - -// decorateWriter wraps a writer to handle gzip compression if requested. It -// returns the decorated writer and the appropriate "Content-Encoding" header -// (which is empty if no compression is enabled). -func decorateWriter(request *http.Request, writer io.Writer, compressionDisabled bool) (io.Writer, string) { - if compressionDisabled { - return writer, "" - } - header := request.Header.Get(acceptEncodingHeader) - parts := strings.Split(header, ",") - for _, part := range parts { - part = strings.TrimSpace(part) - if part == "gzip" || strings.HasPrefix(part, "gzip;") { - return gzip.NewWriter(writer), "gzip" - } - } - return writer, "" -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http_test.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http_test.go deleted file mode 100644 index 24d2f8cff..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http_test.go +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2016 The Prometheus 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 promhttp - -import ( - "bytes" - "errors" - "log" - "net/http" - "net/http/httptest" - "strings" - "testing" - "time" - - "github.com/prometheus/client_golang/prometheus" -) - -type errorCollector struct{} - -func (e errorCollector) Describe(ch chan<- *prometheus.Desc) { - ch <- prometheus.NewDesc("invalid_metric", "not helpful", nil, nil) -} - -func (e errorCollector) Collect(ch chan<- prometheus.Metric) { - ch <- prometheus.NewInvalidMetric( - prometheus.NewDesc("invalid_metric", "not helpful", nil, nil), - errors.New("collect error"), - ) -} - -type blockingCollector struct { - CollectStarted, Block chan struct{} -} - -func (b blockingCollector) Describe(ch chan<- *prometheus.Desc) { - ch <- prometheus.NewDesc("dummy_desc", "not helpful", nil, nil) -} - -func (b blockingCollector) Collect(ch chan<- prometheus.Metric) { - select { - case b.CollectStarted <- struct{}{}: - default: - } - // Collects nothing, just waits for a channel receive. - <-b.Block -} - -func TestHandlerErrorHandling(t *testing.T) { - - // Create a registry that collects a MetricFamily with two elements, - // another with one, and reports an error. - reg := prometheus.NewRegistry() - - cnt := prometheus.NewCounter(prometheus.CounterOpts{ - Name: "the_count", - Help: "Ah-ah-ah! Thunder and lightning!", - }) - reg.MustRegister(cnt) - - cntVec := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "name", - Help: "docstring", - ConstLabels: prometheus.Labels{"constname": "constvalue"}, - }, - []string{"labelname"}, - ) - cntVec.WithLabelValues("val1").Inc() - cntVec.WithLabelValues("val2").Inc() - reg.MustRegister(cntVec) - - reg.MustRegister(errorCollector{}) - - logBuf := &bytes.Buffer{} - logger := log.New(logBuf, "", 0) - - writer := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/", nil) - request.Header.Add("Accept", "test/plain") - - errorHandler := HandlerFor(reg, HandlerOpts{ - ErrorLog: logger, - ErrorHandling: HTTPErrorOnError, - }) - continueHandler := HandlerFor(reg, HandlerOpts{ - ErrorLog: logger, - ErrorHandling: ContinueOnError, - }) - panicHandler := HandlerFor(reg, HandlerOpts{ - ErrorLog: logger, - ErrorHandling: PanicOnError, - }) - wantMsg := `error gathering metrics: error collecting metric Desc{fqName: "invalid_metric", help: "not helpful", constLabels: {}, variableLabels: []}: collect error -` - wantErrorBody := `An error has occurred during metrics gathering: - -error collecting metric Desc{fqName: "invalid_metric", help: "not helpful", constLabels: {}, variableLabels: []}: collect error -` - wantOKBody := `# HELP name docstring -# TYPE name counter -name{constname="constvalue",labelname="val1"} 1 -name{constname="constvalue",labelname="val2"} 1 -# HELP the_count Ah-ah-ah! Thunder and lightning! -# TYPE the_count counter -the_count 0 -` - - errorHandler.ServeHTTP(writer, request) - if got, want := writer.Code, http.StatusInternalServerError; got != want { - t.Errorf("got HTTP status code %d, want %d", got, want) - } - if got := logBuf.String(); got != wantMsg { - t.Errorf("got log message:\n%s\nwant log message:\n%s\n", got, wantMsg) - } - if got := writer.Body.String(); got != wantErrorBody { - t.Errorf("got body:\n%s\nwant body:\n%s\n", got, wantErrorBody) - } - logBuf.Reset() - writer.Body.Reset() - writer.Code = http.StatusOK - - continueHandler.ServeHTTP(writer, request) - if got, want := writer.Code, http.StatusOK; got != want { - t.Errorf("got HTTP status code %d, want %d", got, want) - } - if got := logBuf.String(); got != wantMsg { - t.Errorf("got log message %q, want %q", got, wantMsg) - } - if got := writer.Body.String(); got != wantOKBody { - t.Errorf("got body %q, want %q", got, wantOKBody) - } - - defer func() { - if err := recover(); err == nil { - t.Error("expected panic from panicHandler") - } - }() - panicHandler.ServeHTTP(writer, request) -} - -func TestInstrumentMetricHandler(t *testing.T) { - reg := prometheus.NewRegistry() - handler := InstrumentMetricHandler(reg, HandlerFor(reg, HandlerOpts{})) - // Do it again to test idempotency. - InstrumentMetricHandler(reg, HandlerFor(reg, HandlerOpts{})) - writer := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/", nil) - request.Header.Add("Accept", "test/plain") - - handler.ServeHTTP(writer, request) - if got, want := writer.Code, http.StatusOK; got != want { - t.Errorf("got HTTP status code %d, want %d", got, want) - } - - want := "promhttp_metric_handler_requests_in_flight 1\n" - if got := writer.Body.String(); !strings.Contains(got, want) { - t.Errorf("got body %q, does not contain %q", got, want) - } - want = "promhttp_metric_handler_requests_total{code=\"200\"} 0\n" - if got := writer.Body.String(); !strings.Contains(got, want) { - t.Errorf("got body %q, does not contain %q", got, want) - } - - writer.Body.Reset() - handler.ServeHTTP(writer, request) - if got, want := writer.Code, http.StatusOK; got != want { - t.Errorf("got HTTP status code %d, want %d", got, want) - } - - want = "promhttp_metric_handler_requests_in_flight 1\n" - if got := writer.Body.String(); !strings.Contains(got, want) { - t.Errorf("got body %q, does not contain %q", got, want) - } - want = "promhttp_metric_handler_requests_total{code=\"200\"} 1\n" - if got := writer.Body.String(); !strings.Contains(got, want) { - t.Errorf("got body %q, does not contain %q", got, want) - } -} - -func TestHandlerMaxRequestsInFlight(t *testing.T) { - reg := prometheus.NewRegistry() - handler := HandlerFor(reg, HandlerOpts{MaxRequestsInFlight: 1}) - w1 := httptest.NewRecorder() - w2 := httptest.NewRecorder() - w3 := httptest.NewRecorder() - request, _ := http.NewRequest("GET", "/", nil) - request.Header.Add("Accept", "test/plain") - - c := blockingCollector{Block: make(chan struct{}), CollectStarted: make(chan struct{}, 1)} - reg.MustRegister(c) - - rq1Done := make(chan struct{}) - go func() { - handler.ServeHTTP(w1, request) - close(rq1Done) - }() - <-c.CollectStarted - - handler.ServeHTTP(w2, request) - - if got, want := w2.Code, http.StatusServiceUnavailable; got != want { - t.Errorf("got HTTP status code %d, want %d", got, want) - } - if got, want := w2.Body.String(), "Limit of concurrent requests reached (1), try again later.\n"; got != want { - t.Errorf("got body %q, want %q", got, want) - } - - close(c.Block) - <-rq1Done - - handler.ServeHTTP(w3, request) - - if got, want := w3.Code, http.StatusOK; got != want { - t.Errorf("got HTTP status code %d, want %d", got, want) - } -} - -func TestHandlerTimeout(t *testing.T) { - reg := prometheus.NewRegistry() - handler := HandlerFor(reg, HandlerOpts{Timeout: time.Millisecond}) - w := httptest.NewRecorder() - - request, _ := http.NewRequest("GET", "/", nil) - request.Header.Add("Accept", "test/plain") - - c := blockingCollector{Block: make(chan struct{}), CollectStarted: make(chan struct{}, 1)} - reg.MustRegister(c) - - handler.ServeHTTP(w, request) - - if got, want := w.Code, http.StatusServiceUnavailable; got != want { - t.Errorf("got HTTP status code %d, want %d", got, want) - } - if got, want := w.Body.String(), "Exceeded configured timeout of 1ms.\n"; got != want { - t.Errorf("got body %q, want %q", got, want) - } - - close(c.Block) // To not leak a goroutine. -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go deleted file mode 100644 index 86fd56447..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2017 The Prometheus 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 promhttp - -import ( - "net/http" - "time" - - "github.com/prometheus/client_golang/prometheus" -) - -// The RoundTripperFunc type is an adapter to allow the use of ordinary -// functions as RoundTrippers. If f is a function with the appropriate -// signature, RountTripperFunc(f) is a RoundTripper that calls f. -type RoundTripperFunc func(req *http.Request) (*http.Response, error) - -// RoundTrip implements the RoundTripper interface. -func (rt RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { - return rt(r) -} - -// InstrumentRoundTripperInFlight is a middleware that wraps the provided -// http.RoundTripper. It sets the provided prometheus.Gauge to the number of -// requests currently handled by the wrapped http.RoundTripper. -// -// See the example for ExampleInstrumentRoundTripperDuration for example usage. -func InstrumentRoundTripperInFlight(gauge prometheus.Gauge, next http.RoundTripper) RoundTripperFunc { - return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { - gauge.Inc() - defer gauge.Dec() - return next.RoundTrip(r) - }) -} - -// InstrumentRoundTripperCounter is a middleware that wraps the provided -// http.RoundTripper to observe the request result with the provided CounterVec. -// The CounterVec must have zero, one, or two non-const non-curried labels. For -// those, the only allowed label names are "code" and "method". The function -// panics otherwise. Partitioning of the CounterVec happens by HTTP status code -// and/or HTTP method if the respective instance label names are present in the -// CounterVec. For unpartitioned counting, use a CounterVec with zero labels. -// -// If the wrapped RoundTripper panics or returns a non-nil error, the Counter -// is not incremented. -// -// See the example for ExampleInstrumentRoundTripperDuration for example usage. -func InstrumentRoundTripperCounter(counter *prometheus.CounterVec, next http.RoundTripper) RoundTripperFunc { - code, method := checkLabels(counter) - - return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { - resp, err := next.RoundTrip(r) - if err == nil { - counter.With(labels(code, method, r.Method, resp.StatusCode)).Inc() - } - return resp, err - }) -} - -// InstrumentRoundTripperDuration is a middleware that wraps the provided -// http.RoundTripper to observe the request duration with the provided -// ObserverVec. The ObserverVec must have zero, one, or two non-const -// non-curried labels. For those, the only allowed label names are "code" and -// "method". The function panics otherwise. The Observe method of the Observer -// in the ObserverVec is called with the request duration in -// seconds. Partitioning happens by HTTP status code and/or HTTP method if the -// respective instance label names are present in the ObserverVec. For -// unpartitioned observations, use an ObserverVec with zero labels. Note that -// partitioning of Histograms is expensive and should be used judiciously. -// -// If the wrapped RoundTripper panics or returns a non-nil error, no values are -// reported. -// -// Note that this method is only guaranteed to never observe negative durations -// if used with Go1.9+. -func InstrumentRoundTripperDuration(obs prometheus.ObserverVec, next http.RoundTripper) RoundTripperFunc { - code, method := checkLabels(obs) - - return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { - start := time.Now() - resp, err := next.RoundTrip(r) - if err == nil { - obs.With(labels(code, method, r.Method, resp.StatusCode)).Observe(time.Since(start).Seconds()) - } - return resp, err - }) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client_1_8.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client_1_8.go deleted file mode 100644 index a034d1ec0..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client_1_8.go +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2017 The Prometheus 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. - -// +build go1.8 - -package promhttp - -import ( - "context" - "crypto/tls" - "net/http" - "net/http/httptrace" - "time" -) - -// InstrumentTrace is used to offer flexibility in instrumenting the available -// httptrace.ClientTrace hook functions. Each function is passed a float64 -// representing the time in seconds since the start of the http request. A user -// may choose to use separately buckets Histograms, or implement custom -// instance labels on a per function basis. -type InstrumentTrace struct { - GotConn func(float64) - PutIdleConn func(float64) - GotFirstResponseByte func(float64) - Got100Continue func(float64) - DNSStart func(float64) - DNSDone func(float64) - ConnectStart func(float64) - ConnectDone func(float64) - TLSHandshakeStart func(float64) - TLSHandshakeDone func(float64) - WroteHeaders func(float64) - Wait100Continue func(float64) - WroteRequest func(float64) -} - -// InstrumentRoundTripperTrace is a middleware that wraps the provided -// RoundTripper and reports times to hook functions provided in the -// InstrumentTrace struct. Hook functions that are not present in the provided -// InstrumentTrace struct are ignored. Times reported to the hook functions are -// time since the start of the request. Only with Go1.9+, those times are -// guaranteed to never be negative. (Earlier Go versions are not using a -// monotonic clock.) Note that partitioning of Histograms is expensive and -// should be used judiciously. -// -// For hook functions that receive an error as an argument, no observations are -// made in the event of a non-nil error value. -// -// See the example for ExampleInstrumentRoundTripperDuration for example usage. -func InstrumentRoundTripperTrace(it *InstrumentTrace, next http.RoundTripper) RoundTripperFunc { - return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { - start := time.Now() - - trace := &httptrace.ClientTrace{ - GotConn: func(_ httptrace.GotConnInfo) { - if it.GotConn != nil { - it.GotConn(time.Since(start).Seconds()) - } - }, - PutIdleConn: func(err error) { - if err != nil { - return - } - if it.PutIdleConn != nil { - it.PutIdleConn(time.Since(start).Seconds()) - } - }, - DNSStart: func(_ httptrace.DNSStartInfo) { - if it.DNSStart != nil { - it.DNSStart(time.Since(start).Seconds()) - } - }, - DNSDone: func(_ httptrace.DNSDoneInfo) { - if it.DNSDone != nil { - it.DNSDone(time.Since(start).Seconds()) - } - }, - ConnectStart: func(_, _ string) { - if it.ConnectStart != nil { - it.ConnectStart(time.Since(start).Seconds()) - } - }, - ConnectDone: func(_, _ string, err error) { - if err != nil { - return - } - if it.ConnectDone != nil { - it.ConnectDone(time.Since(start).Seconds()) - } - }, - GotFirstResponseByte: func() { - if it.GotFirstResponseByte != nil { - it.GotFirstResponseByte(time.Since(start).Seconds()) - } - }, - Got100Continue: func() { - if it.Got100Continue != nil { - it.Got100Continue(time.Since(start).Seconds()) - } - }, - TLSHandshakeStart: func() { - if it.TLSHandshakeStart != nil { - it.TLSHandshakeStart(time.Since(start).Seconds()) - } - }, - TLSHandshakeDone: func(_ tls.ConnectionState, err error) { - if err != nil { - return - } - if it.TLSHandshakeDone != nil { - it.TLSHandshakeDone(time.Since(start).Seconds()) - } - }, - WroteHeaders: func() { - if it.WroteHeaders != nil { - it.WroteHeaders(time.Since(start).Seconds()) - } - }, - Wait100Continue: func() { - if it.Wait100Continue != nil { - it.Wait100Continue(time.Since(start).Seconds()) - } - }, - WroteRequest: func(_ httptrace.WroteRequestInfo) { - if it.WroteRequest != nil { - it.WroteRequest(time.Since(start).Seconds()) - } - }, - } - r = r.WithContext(httptrace.WithClientTrace(context.Background(), trace)) - - return next.RoundTrip(r) - }) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client_1_8_test.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client_1_8_test.go deleted file mode 100644 index 7e3f5229f..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client_1_8_test.go +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright 2017 The Prometheus 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. - -// +build go1.8 - -package promhttp - -import ( - "log" - "net/http" - "testing" - "time" - - "github.com/prometheus/client_golang/prometheus" -) - -func TestClientMiddlewareAPI(t *testing.T) { - client := http.DefaultClient - client.Timeout = 1 * time.Second - - reg := prometheus.NewRegistry() - - inFlightGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "client_in_flight_requests", - Help: "A gauge of in-flight requests for the wrapped client.", - }) - - counter := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "client_api_requests_total", - Help: "A counter for requests from the wrapped client.", - }, - []string{"code", "method"}, - ) - - dnsLatencyVec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "dns_duration_seconds", - Help: "Trace dns latency histogram.", - Buckets: []float64{.005, .01, .025, .05}, - }, - []string{"event"}, - ) - - tlsLatencyVec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "tls_duration_seconds", - Help: "Trace tls latency histogram.", - Buckets: []float64{.05, .1, .25, .5}, - }, - []string{"event"}, - ) - - histVec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "request_duration_seconds", - Help: "A histogram of request latencies.", - Buckets: prometheus.DefBuckets, - }, - []string{"method"}, - ) - - reg.MustRegister(counter, tlsLatencyVec, dnsLatencyVec, histVec, inFlightGauge) - - trace := &InstrumentTrace{ - DNSStart: func(t float64) { - dnsLatencyVec.WithLabelValues("dns_start") - }, - DNSDone: func(t float64) { - dnsLatencyVec.WithLabelValues("dns_done") - }, - TLSHandshakeStart: func(t float64) { - tlsLatencyVec.WithLabelValues("tls_handshake_start") - }, - TLSHandshakeDone: func(t float64) { - tlsLatencyVec.WithLabelValues("tls_handshake_done") - }, - } - - client.Transport = InstrumentRoundTripperInFlight(inFlightGauge, - InstrumentRoundTripperCounter(counter, - InstrumentRoundTripperTrace(trace, - InstrumentRoundTripperDuration(histVec, http.DefaultTransport), - ), - ), - ) - - resp, err := client.Get("http://google.com") - if err != nil { - t.Fatalf("%v", err) - } - defer resp.Body.Close() -} - -func ExampleInstrumentRoundTripperDuration() { - client := http.DefaultClient - client.Timeout = 1 * time.Second - - inFlightGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "client_in_flight_requests", - Help: "A gauge of in-flight requests for the wrapped client.", - }) - - counter := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "client_api_requests_total", - Help: "A counter for requests from the wrapped client.", - }, - []string{"code", "method"}, - ) - - // dnsLatencyVec uses custom buckets based on expected dns durations. - // It has an instance label "event", which is set in the - // DNSStart and DNSDonehook functions defined in the - // InstrumentTrace struct below. - dnsLatencyVec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "dns_duration_seconds", - Help: "Trace dns latency histogram.", - Buckets: []float64{.005, .01, .025, .05}, - }, - []string{"event"}, - ) - - // tlsLatencyVec uses custom buckets based on expected tls durations. - // It has an instance label "event", which is set in the - // TLSHandshakeStart and TLSHandshakeDone hook functions defined in the - // InstrumentTrace struct below. - tlsLatencyVec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "tls_duration_seconds", - Help: "Trace tls latency histogram.", - Buckets: []float64{.05, .1, .25, .5}, - }, - []string{"event"}, - ) - - // histVec has no labels, making it a zero-dimensional ObserverVec. - histVec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "request_duration_seconds", - Help: "A histogram of request latencies.", - Buckets: prometheus.DefBuckets, - }, - []string{}, - ) - - // Register all of the metrics in the standard registry. - prometheus.MustRegister(counter, tlsLatencyVec, dnsLatencyVec, histVec, inFlightGauge) - - // Define functions for the available httptrace.ClientTrace hook - // functions that we want to instrument. - trace := &InstrumentTrace{ - DNSStart: func(t float64) { - dnsLatencyVec.WithLabelValues("dns_start") - }, - DNSDone: func(t float64) { - dnsLatencyVec.WithLabelValues("dns_done") - }, - TLSHandshakeStart: func(t float64) { - tlsLatencyVec.WithLabelValues("tls_handshake_start") - }, - TLSHandshakeDone: func(t float64) { - tlsLatencyVec.WithLabelValues("tls_handshake_done") - }, - } - - // Wrap the default RoundTripper with middleware. - roundTripper := InstrumentRoundTripperInFlight(inFlightGauge, - InstrumentRoundTripperCounter(counter, - InstrumentRoundTripperTrace(trace, - InstrumentRoundTripperDuration(histVec, http.DefaultTransport), - ), - ), - ) - - // Set the RoundTripper on our client. - client.Transport = roundTripper - - resp, err := client.Get("http://google.com") - if err != nil { - log.Printf("error: %v", err) - } - defer resp.Body.Close() -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go deleted file mode 100644 index 9db243805..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go +++ /dev/null @@ -1,447 +0,0 @@ -// Copyright 2017 The Prometheus 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 promhttp - -import ( - "errors" - "net/http" - "strconv" - "strings" - "time" - - dto "github.com/prometheus/client_model/go" - - "github.com/prometheus/client_golang/prometheus" -) - -// magicString is used for the hacky label test in checkLabels. Remove once fixed. -const magicString = "zZgWfBxLqvG8kc8IMv3POi2Bb0tZI3vAnBx+gBaFi9FyPzB/CzKUer1yufDa" - -// InstrumentHandlerInFlight is a middleware that wraps the provided -// http.Handler. It sets the provided prometheus.Gauge to the number of -// requests currently handled by the wrapped http.Handler. -// -// See the example for InstrumentHandlerDuration for example usage. -func InstrumentHandlerInFlight(g prometheus.Gauge, next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - g.Inc() - defer g.Dec() - next.ServeHTTP(w, r) - }) -} - -// InstrumentHandlerDuration is a middleware that wraps the provided -// http.Handler to observe the request duration with the provided ObserverVec. -// The ObserverVec must have zero, one, or two non-const non-curried labels. For -// those, the only allowed label names are "code" and "method". The function -// panics otherwise. The Observe method of the Observer in the ObserverVec is -// called with the request duration in seconds. Partitioning happens by HTTP -// status code and/or HTTP method if the respective instance label names are -// present in the ObserverVec. For unpartitioned observations, use an -// ObserverVec with zero labels. Note that partitioning of Histograms is -// expensive and should be used judiciously. -// -// If the wrapped Handler does not set a status code, a status code of 200 is assumed. -// -// If the wrapped Handler panics, no values are reported. -// -// Note that this method is only guaranteed to never observe negative durations -// if used with Go1.9+. -func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc { - code, method := checkLabels(obs) - - if code { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - now := time.Now() - d := newDelegator(w, nil) - next.ServeHTTP(d, r) - - obs.With(labels(code, method, r.Method, d.Status())).Observe(time.Since(now).Seconds()) - }) - } - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - now := time.Now() - next.ServeHTTP(w, r) - obs.With(labels(code, method, r.Method, 0)).Observe(time.Since(now).Seconds()) - }) -} - -// InstrumentHandlerCounter is a middleware that wraps the provided http.Handler -// to observe the request result with the provided CounterVec. The CounterVec -// must have zero, one, or two non-const non-curried labels. For those, the only -// allowed label names are "code" and "method". The function panics -// otherwise. Partitioning of the CounterVec happens by HTTP status code and/or -// HTTP method if the respective instance label names are present in the -// CounterVec. For unpartitioned counting, use a CounterVec with zero labels. -// -// If the wrapped Handler does not set a status code, a status code of 200 is assumed. -// -// If the wrapped Handler panics, the Counter is not incremented. -// -// See the example for InstrumentHandlerDuration for example usage. -func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler) http.HandlerFunc { - code, method := checkLabels(counter) - - if code { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - d := newDelegator(w, nil) - next.ServeHTTP(d, r) - counter.With(labels(code, method, r.Method, d.Status())).Inc() - }) - } - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - next.ServeHTTP(w, r) - counter.With(labels(code, method, r.Method, 0)).Inc() - }) -} - -// InstrumentHandlerTimeToWriteHeader is a middleware that wraps the provided -// http.Handler to observe with the provided ObserverVec the request duration -// until the response headers are written. The ObserverVec must have zero, one, -// or two non-const non-curried labels. For those, the only allowed label names -// are "code" and "method". The function panics otherwise. The Observe method of -// the Observer in the ObserverVec is called with the request duration in -// seconds. Partitioning happens by HTTP status code and/or HTTP method if the -// respective instance label names are present in the ObserverVec. For -// unpartitioned observations, use an ObserverVec with zero labels. Note that -// partitioning of Histograms is expensive and should be used judiciously. -// -// If the wrapped Handler panics before calling WriteHeader, no value is -// reported. -// -// Note that this method is only guaranteed to never observe negative durations -// if used with Go1.9+. -// -// See the example for InstrumentHandlerDuration for example usage. -func InstrumentHandlerTimeToWriteHeader(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc { - code, method := checkLabels(obs) - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - now := time.Now() - d := newDelegator(w, func(status int) { - obs.With(labels(code, method, r.Method, status)).Observe(time.Since(now).Seconds()) - }) - next.ServeHTTP(d, r) - }) -} - -// InstrumentHandlerRequestSize is a middleware that wraps the provided -// http.Handler to observe the request size with the provided ObserverVec. The -// ObserverVec must have zero, one, or two non-const non-curried labels. For -// those, the only allowed label names are "code" and "method". The function -// panics otherwise. The Observe method of the Observer in the ObserverVec is -// called with the request size in bytes. Partitioning happens by HTTP status -// code and/or HTTP method if the respective instance label names are present in -// the ObserverVec. For unpartitioned observations, use an ObserverVec with zero -// labels. Note that partitioning of Histograms is expensive and should be used -// judiciously. -// -// If the wrapped Handler does not set a status code, a status code of 200 is assumed. -// -// If the wrapped Handler panics, no values are reported. -// -// See the example for InstrumentHandlerDuration for example usage. -func InstrumentHandlerRequestSize(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc { - code, method := checkLabels(obs) - - if code { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - d := newDelegator(w, nil) - next.ServeHTTP(d, r) - size := computeApproximateRequestSize(r) - obs.With(labels(code, method, r.Method, d.Status())).Observe(float64(size)) - }) - } - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - next.ServeHTTP(w, r) - size := computeApproximateRequestSize(r) - obs.With(labels(code, method, r.Method, 0)).Observe(float64(size)) - }) -} - -// InstrumentHandlerResponseSize is a middleware that wraps the provided -// http.Handler to observe the response size with the provided ObserverVec. The -// ObserverVec must have zero, one, or two non-const non-curried labels. For -// those, the only allowed label names are "code" and "method". The function -// panics otherwise. The Observe method of the Observer in the ObserverVec is -// called with the response size in bytes. Partitioning happens by HTTP status -// code and/or HTTP method if the respective instance label names are present in -// the ObserverVec. For unpartitioned observations, use an ObserverVec with zero -// labels. Note that partitioning of Histograms is expensive and should be used -// judiciously. -// -// If the wrapped Handler does not set a status code, a status code of 200 is assumed. -// -// If the wrapped Handler panics, no values are reported. -// -// See the example for InstrumentHandlerDuration for example usage. -func InstrumentHandlerResponseSize(obs prometheus.ObserverVec, next http.Handler) http.Handler { - code, method := checkLabels(obs) - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - d := newDelegator(w, nil) - next.ServeHTTP(d, r) - obs.With(labels(code, method, r.Method, d.Status())).Observe(float64(d.Written())) - }) -} - -func checkLabels(c prometheus.Collector) (code bool, method bool) { - // TODO(beorn7): Remove this hacky way to check for instance labels - // once Descriptors can have their dimensionality queried. - var ( - desc *prometheus.Desc - m prometheus.Metric - pm dto.Metric - lvs []string - ) - - // Get the Desc from the Collector. - descc := make(chan *prometheus.Desc, 1) - c.Describe(descc) - - select { - case desc = <-descc: - default: - panic("no description provided by collector") - } - select { - case <-descc: - panic("more than one description provided by collector") - default: - } - - close(descc) - - // Create a ConstMetric with the Desc. Since we don't know how many - // variable labels there are, try for as long as it needs. - for err := errors.New("dummy"); err != nil; lvs = append(lvs, magicString) { - m, err = prometheus.NewConstMetric(desc, prometheus.UntypedValue, 0, lvs...) - } - - // Write out the metric into a proto message and look at the labels. - // If the value is not the magicString, it is a constLabel, which doesn't interest us. - // If the label is curried, it doesn't interest us. - // In all other cases, only "code" or "method" is allowed. - if err := m.Write(&pm); err != nil { - panic("error checking metric for labels") - } - for _, label := range pm.Label { - name, value := label.GetName(), label.GetValue() - if value != magicString || isLabelCurried(c, name) { - continue - } - switch name { - case "code": - code = true - case "method": - method = true - default: - panic("metric partitioned with non-supported labels") - } - } - return -} - -func isLabelCurried(c prometheus.Collector, label string) bool { - // This is even hackier than the label test above. - // We essentially try to curry again and see if it works. - // But for that, we need to type-convert to the two - // types we use here, ObserverVec or *CounterVec. - switch v := c.(type) { - case *prometheus.CounterVec: - if _, err := v.CurryWith(prometheus.Labels{label: "dummy"}); err == nil { - return false - } - case prometheus.ObserverVec: - if _, err := v.CurryWith(prometheus.Labels{label: "dummy"}); err == nil { - return false - } - default: - panic("unsupported metric vec type") - } - return true -} - -// emptyLabels is a one-time allocation for non-partitioned metrics to avoid -// unnecessary allocations on each request. -var emptyLabels = prometheus.Labels{} - -func labels(code, method bool, reqMethod string, status int) prometheus.Labels { - if !(code || method) { - return emptyLabels - } - labels := prometheus.Labels{} - - if code { - labels["code"] = sanitizeCode(status) - } - if method { - labels["method"] = sanitizeMethod(reqMethod) - } - - return labels -} - -func computeApproximateRequestSize(r *http.Request) int { - s := 0 - if r.URL != nil { - s += len(r.URL.String()) - } - - s += len(r.Method) - s += len(r.Proto) - for name, values := range r.Header { - s += len(name) - for _, value := range values { - s += len(value) - } - } - s += len(r.Host) - - // N.B. r.Form and r.MultipartForm are assumed to be included in r.URL. - - if r.ContentLength != -1 { - s += int(r.ContentLength) - } - return s -} - -func sanitizeMethod(m string) string { - switch m { - case "GET", "get": - return "get" - case "PUT", "put": - return "put" - case "HEAD", "head": - return "head" - case "POST", "post": - return "post" - case "DELETE", "delete": - return "delete" - case "CONNECT", "connect": - return "connect" - case "OPTIONS", "options": - return "options" - case "NOTIFY", "notify": - return "notify" - default: - return strings.ToLower(m) - } -} - -// If the wrapped http.Handler has not set a status code, i.e. the value is -// currently 0, santizeCode will return 200, for consistency with behavior in -// the stdlib. -func sanitizeCode(s int) string { - switch s { - case 100: - return "100" - case 101: - return "101" - - case 200, 0: - return "200" - case 201: - return "201" - case 202: - return "202" - case 203: - return "203" - case 204: - return "204" - case 205: - return "205" - case 206: - return "206" - - case 300: - return "300" - case 301: - return "301" - case 302: - return "302" - case 304: - return "304" - case 305: - return "305" - case 307: - return "307" - - case 400: - return "400" - case 401: - return "401" - case 402: - return "402" - case 403: - return "403" - case 404: - return "404" - case 405: - return "405" - case 406: - return "406" - case 407: - return "407" - case 408: - return "408" - case 409: - return "409" - case 410: - return "410" - case 411: - return "411" - case 412: - return "412" - case 413: - return "413" - case 414: - return "414" - case 415: - return "415" - case 416: - return "416" - case 417: - return "417" - case 418: - return "418" - - case 500: - return "500" - case 501: - return "501" - case 502: - return "502" - case 503: - return "503" - case 504: - return "504" - case 505: - return "505" - - case 428: - return "428" - case 429: - return "429" - case 431: - return "431" - case 511: - return "511" - - default: - return strconv.Itoa(s) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server_test.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server_test.go deleted file mode 100644 index 716c6f45e..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server_test.go +++ /dev/null @@ -1,401 +0,0 @@ -// Copyright 2017 The Prometheus 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 promhttp - -import ( - "io" - "log" - "net/http" - "net/http/httptest" - "testing" - - "github.com/prometheus/client_golang/prometheus" -) - -func TestLabelCheck(t *testing.T) { - scenarios := map[string]struct { - varLabels []string - constLabels []string - curriedLabels []string - ok bool - }{ - "empty": { - varLabels: []string{}, - constLabels: []string{}, - curriedLabels: []string{}, - ok: true, - }, - "code as single var label": { - varLabels: []string{"code"}, - constLabels: []string{}, - curriedLabels: []string{}, - ok: true, - }, - "method as single var label": { - varLabels: []string{"method"}, - constLabels: []string{}, - curriedLabels: []string{}, - ok: true, - }, - "cade and method as var labels": { - varLabels: []string{"method", "code"}, - constLabels: []string{}, - curriedLabels: []string{}, - ok: true, - }, - "valid case with all labels used": { - varLabels: []string{"code", "method"}, - constLabels: []string{"foo", "bar"}, - curriedLabels: []string{"dings", "bums"}, - ok: true, - }, - "unsupported var label": { - varLabels: []string{"foo"}, - constLabels: []string{}, - curriedLabels: []string{}, - ok: false, - }, - "mixed var labels": { - varLabels: []string{"method", "foo", "code"}, - constLabels: []string{}, - curriedLabels: []string{}, - ok: false, - }, - "unsupported var label but curried": { - varLabels: []string{}, - constLabels: []string{}, - curriedLabels: []string{"foo"}, - ok: true, - }, - "mixed var labels but unsupported curried": { - varLabels: []string{"code", "method"}, - constLabels: []string{}, - curriedLabels: []string{"foo"}, - ok: true, - }, - "supported label as const and curry": { - varLabels: []string{}, - constLabels: []string{"code"}, - curriedLabels: []string{"method"}, - ok: true, - }, - "supported label as const and curry with unsupported as var": { - varLabels: []string{"foo"}, - constLabels: []string{"code"}, - curriedLabels: []string{"method"}, - ok: false, - }, - } - - for name, sc := range scenarios { - t.Run(name, func(t *testing.T) { - constLabels := prometheus.Labels{} - for _, l := range sc.constLabels { - constLabels[l] = "dummy" - } - c := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "c", - Help: "c help", - ConstLabels: constLabels, - }, - append(sc.varLabels, sc.curriedLabels...), - ) - o := prometheus.ObserverVec(prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "c", - Help: "c help", - ConstLabels: constLabels, - }, - append(sc.varLabels, sc.curriedLabels...), - )) - for _, l := range sc.curriedLabels { - c = c.MustCurryWith(prometheus.Labels{l: "dummy"}) - o = o.MustCurryWith(prometheus.Labels{l: "dummy"}) - } - - func() { - defer func() { - if err := recover(); err != nil { - if sc.ok { - t.Error("unexpected panic:", err) - } - } else if !sc.ok { - t.Error("expected panic") - } - }() - InstrumentHandlerCounter(c, nil) - }() - func() { - defer func() { - if err := recover(); err != nil { - if sc.ok { - t.Error("unexpected panic:", err) - } - } else if !sc.ok { - t.Error("expected panic") - } - }() - InstrumentHandlerDuration(o, nil) - }() - if sc.ok { - // Test if wantCode and wantMethod were detected correctly. - var wantCode, wantMethod bool - for _, l := range sc.varLabels { - if l == "code" { - wantCode = true - } - if l == "method" { - wantMethod = true - } - } - gotCode, gotMethod := checkLabels(c) - if gotCode != wantCode { - t.Errorf("wanted code=%t for counter, got code=%t", wantCode, gotCode) - } - if gotMethod != wantMethod { - t.Errorf("wanted method=%t for counter, got method=%t", wantMethod, gotMethod) - } - gotCode, gotMethod = checkLabels(o) - if gotCode != wantCode { - t.Errorf("wanted code=%t for observer, got code=%t", wantCode, gotCode) - } - if gotMethod != wantMethod { - t.Errorf("wanted method=%t for observer, got method=%t", wantMethod, gotMethod) - } - } - }) - } -} - -func TestMiddlewareAPI(t *testing.T) { - reg := prometheus.NewRegistry() - - inFlightGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "in_flight_requests", - Help: "A gauge of requests currently being served by the wrapped handler.", - }) - - counter := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "api_requests_total", - Help: "A counter for requests to the wrapped handler.", - }, - []string{"code", "method"}, - ) - - histVec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "response_duration_seconds", - Help: "A histogram of request latencies.", - Buckets: prometheus.DefBuckets, - ConstLabels: prometheus.Labels{"handler": "api"}, - }, - []string{"method"}, - ) - - writeHeaderVec := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "write_header_duration_seconds", - Help: "A histogram of time to first write latencies.", - Buckets: prometheus.DefBuckets, - ConstLabels: prometheus.Labels{"handler": "api"}, - }, - []string{}, - ) - - responseSize := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "push_request_size_bytes", - Help: "A histogram of request sizes for requests.", - Buckets: []float64{200, 500, 900, 1500}, - }, - []string{}, - ) - - handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("OK")) - }) - - reg.MustRegister(inFlightGauge, counter, histVec, responseSize, writeHeaderVec) - - chain := InstrumentHandlerInFlight(inFlightGauge, - InstrumentHandlerCounter(counter, - InstrumentHandlerDuration(histVec, - InstrumentHandlerTimeToWriteHeader(writeHeaderVec, - InstrumentHandlerResponseSize(responseSize, handler), - ), - ), - ), - ) - - r, _ := http.NewRequest("GET", "www.example.com", nil) - w := httptest.NewRecorder() - chain.ServeHTTP(w, r) -} - -func TestInstrumentTimeToFirstWrite(t *testing.T) { - var i int - dobs := &responseWriterDelegator{ - ResponseWriter: httptest.NewRecorder(), - observeWriteHeader: func(status int) { - i = status - }, - } - d := newDelegator(dobs, nil) - - d.WriteHeader(http.StatusOK) - - if i != http.StatusOK { - t.Fatalf("failed to execute observeWriteHeader") - } -} - -// testResponseWriter is an http.ResponseWriter that also implements -// http.CloseNotifier, http.Flusher, and io.ReaderFrom. -type testResponseWriter struct { - closeNotifyCalled, flushCalled, readFromCalled bool -} - -func (t *testResponseWriter) Header() http.Header { return nil } -func (t *testResponseWriter) Write([]byte) (int, error) { return 0, nil } -func (t *testResponseWriter) WriteHeader(int) {} -func (t *testResponseWriter) CloseNotify() <-chan bool { - t.closeNotifyCalled = true - return nil -} -func (t *testResponseWriter) Flush() { t.flushCalled = true } -func (t *testResponseWriter) ReadFrom(io.Reader) (int64, error) { - t.readFromCalled = true - return 0, nil -} - -// testFlusher is an http.ResponseWriter that also implements http.Flusher. -type testFlusher struct { - flushCalled bool -} - -func (t *testFlusher) Header() http.Header { return nil } -func (t *testFlusher) Write([]byte) (int, error) { return 0, nil } -func (t *testFlusher) WriteHeader(int) {} -func (t *testFlusher) Flush() { t.flushCalled = true } - -func TestInterfaceUpgrade(t *testing.T) { - w := &testResponseWriter{} - d := newDelegator(w, nil) - d.(http.CloseNotifier).CloseNotify() - if !w.closeNotifyCalled { - t.Error("CloseNotify not called") - } - d.(http.Flusher).Flush() - if !w.flushCalled { - t.Error("Flush not called") - } - d.(io.ReaderFrom).ReadFrom(nil) - if !w.readFromCalled { - t.Error("ReadFrom not called") - } - if _, ok := d.(http.Hijacker); ok { - t.Error("delegator unexpectedly implements http.Hijacker") - } - - f := &testFlusher{} - d = newDelegator(f, nil) - if _, ok := d.(http.CloseNotifier); ok { - t.Error("delegator unexpectedly implements http.CloseNotifier") - } - d.(http.Flusher).Flush() - if !w.flushCalled { - t.Error("Flush not called") - } - if _, ok := d.(io.ReaderFrom); ok { - t.Error("delegator unexpectedly implements io.ReaderFrom") - } - if _, ok := d.(http.Hijacker); ok { - t.Error("delegator unexpectedly implements http.Hijacker") - } -} - -func ExampleInstrumentHandlerDuration() { - inFlightGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "in_flight_requests", - Help: "A gauge of requests currently being served by the wrapped handler.", - }) - - counter := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "api_requests_total", - Help: "A counter for requests to the wrapped handler.", - }, - []string{"code", "method"}, - ) - - // duration is partitioned by the HTTP method and handler. It uses custom - // buckets based on the expected request duration. - duration := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "request_duration_seconds", - Help: "A histogram of latencies for requests.", - Buckets: []float64{.25, .5, 1, 2.5, 5, 10}, - }, - []string{"handler", "method"}, - ) - - // responseSize has no labels, making it a zero-dimensional - // ObserverVec. - responseSize := prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "response_size_bytes", - Help: "A histogram of response sizes for requests.", - Buckets: []float64{200, 500, 900, 1500}, - }, - []string{}, - ) - - // Create the handlers that will be wrapped by the middleware. - pushHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("Push")) - }) - pullHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("Pull")) - }) - - // Register all of the metrics in the standard registry. - prometheus.MustRegister(inFlightGauge, counter, duration, responseSize) - - // Instrument the handlers with all the metrics, injecting the "handler" - // label by currying. - pushChain := InstrumentHandlerInFlight(inFlightGauge, - InstrumentHandlerDuration(duration.MustCurryWith(prometheus.Labels{"handler": "push"}), - InstrumentHandlerCounter(counter, - InstrumentHandlerResponseSize(responseSize, pushHandler), - ), - ), - ) - pullChain := InstrumentHandlerInFlight(inFlightGauge, - InstrumentHandlerDuration(duration.MustCurryWith(prometheus.Labels{"handler": "pull"}), - InstrumentHandlerCounter(counter, - InstrumentHandlerResponseSize(responseSize, pullHandler), - ), - ), - ) - - http.Handle("/metrics", Handler()) - http.Handle("/push", pushChain) - http.Handle("/pull", pullChain) - - if err := http.ListenAndServe(":3000", nil); err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/push/deprecated.go b/vendor/github.com/prometheus/client_golang/prometheus/push/deprecated.go deleted file mode 100644 index 3d62b5725..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/push/deprecated.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2018 The Prometheus 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 push - -// This file contains only deprecated code. Remove after v0.9 is released. - -import ( - "bytes" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "os" - "strings" - - "github.com/prometheus/common/expfmt" - "github.com/prometheus/common/model" - - "github.com/prometheus/client_golang/prometheus" -) - -// FromGatherer triggers a metric collection by the provided Gatherer (which is -// usually implemented by a prometheus.Registry) and pushes all gathered metrics -// to the Pushgateway specified by url, using the provided job name and the -// (optional) further grouping labels (the grouping map may be nil). See the -// Pushgateway documentation for detailed implications of the job and other -// grouping labels. Neither the job name nor any grouping label value may -// contain a "/". The metrics pushed must not contain a job label of their own -// nor any of the grouping labels. -// -// You can use just host:port or ip:port as url, in which case 'http://' is -// added automatically. You can also include the schema in the URL. However, do -// not include the '/metrics/jobs/...' part. -// -// Note that all previously pushed metrics with the same job and other grouping -// labels will be replaced with the metrics pushed by this call. (It uses HTTP -// method 'PUT' to push to the Pushgateway.) -// -// Deprecated: Please use a Pusher created with New instead. -func FromGatherer(job string, grouping map[string]string, url string, g prometheus.Gatherer) error { - return push(job, grouping, url, g, "PUT") -} - -// AddFromGatherer works like FromGatherer, but only previously pushed metrics -// with the same name (and the same job and other grouping labels) will be -// replaced. (It uses HTTP method 'POST' to push to the Pushgateway.) -// -// Deprecated: Please use a Pusher created with New instead. -func AddFromGatherer(job string, grouping map[string]string, url string, g prometheus.Gatherer) error { - return push(job, grouping, url, g, "POST") -} - -func push(job string, grouping map[string]string, pushURL string, g prometheus.Gatherer, method string) error { - if !strings.Contains(pushURL, "://") { - pushURL = "http://" + pushURL - } - if strings.HasSuffix(pushURL, "/") { - pushURL = pushURL[:len(pushURL)-1] - } - - if strings.Contains(job, "/") { - return fmt.Errorf("job contains '/': %s", job) - } - urlComponents := []string{url.QueryEscape(job)} - for ln, lv := range grouping { - if !model.LabelName(ln).IsValid() { - return fmt.Errorf("grouping label has invalid name: %s", ln) - } - if strings.Contains(lv, "/") { - return fmt.Errorf("value of grouping label %s contains '/': %s", ln, lv) - } - urlComponents = append(urlComponents, ln, lv) - } - pushURL = fmt.Sprintf("%s/metrics/job/%s", pushURL, strings.Join(urlComponents, "/")) - - mfs, err := g.Gather() - if err != nil { - return err - } - buf := &bytes.Buffer{} - enc := expfmt.NewEncoder(buf, expfmt.FmtProtoDelim) - // Check for pre-existing grouping labels: - for _, mf := range mfs { - for _, m := range mf.GetMetric() { - for _, l := range m.GetLabel() { - if l.GetName() == "job" { - return fmt.Errorf("pushed metric %s (%s) already contains a job label", mf.GetName(), m) - } - if _, ok := grouping[l.GetName()]; ok { - return fmt.Errorf( - "pushed metric %s (%s) already contains grouping label %s", - mf.GetName(), m, l.GetName(), - ) - } - } - } - enc.Encode(mf) - } - req, err := http.NewRequest(method, pushURL, buf) - if err != nil { - return err - } - req.Header.Set(contentTypeHeader, string(expfmt.FmtProtoDelim)) - resp, err := http.DefaultClient.Do(req) - if err != nil { - return err - } - defer resp.Body.Close() - if resp.StatusCode != 202 { - body, _ := ioutil.ReadAll(resp.Body) // Ignore any further error as this is for an error message only. - return fmt.Errorf("unexpected status code %d while pushing to %s: %s", resp.StatusCode, pushURL, body) - } - return nil -} - -// Collectors works like FromGatherer, but it does not use a Gatherer. Instead, -// it collects from the provided collectors directly. It is a convenient way to -// push only a few metrics. -// -// Deprecated: Please use a Pusher created with New instead. -func Collectors(job string, grouping map[string]string, url string, collectors ...prometheus.Collector) error { - return pushCollectors(job, grouping, url, "PUT", collectors...) -} - -// AddCollectors works like AddFromGatherer, but it does not use a Gatherer. -// Instead, it collects from the provided collectors directly. It is a -// convenient way to push only a few metrics. -// -// Deprecated: Please use a Pusher created with New instead. -func AddCollectors(job string, grouping map[string]string, url string, collectors ...prometheus.Collector) error { - return pushCollectors(job, grouping, url, "POST", collectors...) -} - -func pushCollectors(job string, grouping map[string]string, url, method string, collectors ...prometheus.Collector) error { - r := prometheus.NewRegistry() - for _, collector := range collectors { - if err := r.Register(collector); err != nil { - return err - } - } - return push(job, grouping, url, r, method) -} - -// HostnameGroupingKey returns a label map with the only entry -// {instance=""}. This can be conveniently used as the grouping -// parameter if metrics should be pushed with the hostname as label. The -// returned map is created upon each call so that the caller is free to add more -// labels to the map. -// -// Deprecated: Usually, metrics pushed to the Pushgateway should not be -// host-centric. (You would use https://github.com/prometheus/node_exporter in -// that case.) If you have the need to add the hostname to the grouping key, you -// are probably doing something wrong. See -// https://prometheus.io/docs/practices/pushing/ for details. -func HostnameGroupingKey() map[string]string { - hostname, err := os.Hostname() - if err != nil { - return map[string]string{"instance": "unknown"} - } - return map[string]string{"instance": hostname} -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/push/example_add_from_gatherer_test.go b/vendor/github.com/prometheus/client_golang/prometheus/push/example_add_from_gatherer_test.go deleted file mode 100644 index dd22b526a..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/push/example_add_from_gatherer_test.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2016 The Prometheus 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 push_test - -import ( - "fmt" - "time" - - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/push" -) - -var ( - completionTime = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "db_backup_last_completion_timestamp_seconds", - Help: "The timestamp of the last completion of a DB backup, successful or not.", - }) - successTime = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "db_backup_last_success_timestamp_seconds", - Help: "The timestamp of the last successful completion of a DB backup.", - }) - duration = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "db_backup_duration_seconds", - Help: "The duration of the last DB backup in seconds.", - }) - records = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "db_backup_records_processed", - Help: "The number of records processed in the last DB backup.", - }) -) - -func performBackup() (int, error) { - // Perform the backup and return the number of backed up records and any - // applicable error. - // ... - return 42, nil -} - -func ExamplePusher_Add() { - // We use a registry here to benefit from the consistency checks that - // happen during registration. - registry := prometheus.NewRegistry() - registry.MustRegister(completionTime, duration, records) - // Note that successTime is not registered. - - pusher := push.New("http://pushgateway:9091", "db_backup").Gatherer(registry) - - start := time.Now() - n, err := performBackup() - records.Set(float64(n)) - // Note that time.Since only uses a monotonic clock in Go1.9+. - duration.Set(time.Since(start).Seconds()) - completionTime.SetToCurrentTime() - if err != nil { - fmt.Println("DB backup failed:", err) - } else { - // Add successTime to pusher only in case of success. - // We could as well register it with the registry. - // This example, however, demonstrates that you can - // mix Gatherers and Collectors when handling a Pusher. - pusher.Collector(successTime) - successTime.SetToCurrentTime() - } - // Add is used here rather than Push to not delete a previously pushed - // success timestamp in case of a failure of this backup. - if err := pusher.Add(); err != nil { - fmt.Println("Could not push to Pushgateway:", err) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go b/vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go deleted file mode 100644 index fa5549a9e..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2016 The Prometheus 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 push_test - -import ( - "fmt" - - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/push" -) - -func ExamplePusher_Push() { - completionTime := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "db_backup_last_completion_timestamp_seconds", - Help: "The timestamp of the last successful completion of a DB backup.", - }) - completionTime.SetToCurrentTime() - if err := push.New("http://pushgateway:9091", "db_backup"). - Collector(completionTime). - Grouping("db", "customers"). - Push(); err != nil { - fmt.Println("Could not push completion time to Pushgateway:", err) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/push/push.go b/vendor/github.com/prometheus/client_golang/prometheus/push/push.go deleted file mode 100644 index 3721ff198..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/push/push.go +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright 2015 The Prometheus 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 push provides functions to push metrics to a Pushgateway. It uses a -// builder approach. Create a Pusher with New and then add the various options -// by using its methods, finally calling Add or Push, like this: -// -// // Easy case: -// push.New("http://example.org/metrics", "my_job").Gatherer(myRegistry).Push() -// -// // Complex case: -// push.New("http://example.org/metrics", "my_job"). -// Collector(myCollector1). -// Collector(myCollector2). -// Grouping("zone", "xy"). -// Client(&myHTTPClient). -// BasicAuth("top", "secret"). -// Add() -// -// See the examples section for more detailed examples. -// -// See the documentation of the Pushgateway to understand the meaning of -// the grouping key and the differences between Push and Add: -// https://github.com/prometheus/pushgateway -package push - -import ( - "bytes" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "strings" - - "github.com/prometheus/common/expfmt" - "github.com/prometheus/common/model" - - "github.com/prometheus/client_golang/prometheus" -) - -const contentTypeHeader = "Content-Type" - -// Pusher manages a push to the Pushgateway. Use New to create one, configure it -// with its methods, and finally use the Add or Push method to push. -type Pusher struct { - error error - - url, job string - grouping map[string]string - - gatherers prometheus.Gatherers - registerer prometheus.Registerer - - client *http.Client - useBasicAuth bool - username, password string -} - -// New creates a new Pusher to push to the provided URL with the provided job -// name. You can use just host:port or ip:port as url, in which case “http://” -// is added automatically. Alternatively, include the schema in the -// URL. However, do not include the “/metrics/jobs/…” part. -// -// Note that until https://github.com/prometheus/pushgateway/issues/97 is -// resolved, a “/” character in the job name is prohibited. -func New(url, job string) *Pusher { - var ( - reg = prometheus.NewRegistry() - err error - ) - if !strings.Contains(url, "://") { - url = "http://" + url - } - if strings.HasSuffix(url, "/") { - url = url[:len(url)-1] - } - if strings.Contains(job, "/") { - err = fmt.Errorf("job contains '/': %s", job) - } - - return &Pusher{ - error: err, - url: url, - job: job, - grouping: map[string]string{}, - gatherers: prometheus.Gatherers{reg}, - registerer: reg, - client: &http.Client{}, - } -} - -// Push collects/gathers all metrics from all Collectors and Gatherers added to -// this Pusher. Then, it pushes them to the Pushgateway configured while -// creating this Pusher, using the configured job name and any added grouping -// labels as grouping key. All previously pushed metrics with the same job and -// other grouping labels will be replaced with the metrics pushed by this -// call. (It uses HTTP method “PUT” to push to the Pushgateway.) -// -// Push returns the first error encountered by any method call (including this -// one) in the lifetime of the Pusher. -func (p *Pusher) Push() error { - return p.push("PUT") -} - -// Add works like push, but only previously pushed metrics with the same name -// (and the same job and other grouping labels) will be replaced. (It uses HTTP -// method “POST” to push to the Pushgateway.) -func (p *Pusher) Add() error { - return p.push("POST") -} - -// Gatherer adds a Gatherer to the Pusher, from which metrics will be gathered -// to push them to the Pushgateway. The gathered metrics must not contain a job -// label of their own. -// -// For convenience, this method returns a pointer to the Pusher itself. -func (p *Pusher) Gatherer(g prometheus.Gatherer) *Pusher { - p.gatherers = append(p.gatherers, g) - return p -} - -// Collector adds a Collector to the Pusher, from which metrics will be -// collected to push them to the Pushgateway. The collected metrics must not -// contain a job label of their own. -// -// For convenience, this method returns a pointer to the Pusher itself. -func (p *Pusher) Collector(c prometheus.Collector) *Pusher { - if p.error == nil { - p.error = p.registerer.Register(c) - } - return p -} - -// Grouping adds a label pair to the grouping key of the Pusher, replacing any -// previously added label pair with the same label name. Note that setting any -// labels in the grouping key that are already contained in the metrics to push -// will lead to an error. -// -// For convenience, this method returns a pointer to the Pusher itself. -// -// Note that until https://github.com/prometheus/pushgateway/issues/97 is -// resolved, this method does not allow a “/” character in the label value. -func (p *Pusher) Grouping(name, value string) *Pusher { - if p.error == nil { - if !model.LabelName(name).IsValid() { - p.error = fmt.Errorf("grouping label has invalid name: %s", name) - return p - } - if strings.Contains(value, "/") { - p.error = fmt.Errorf("value of grouping label %s contains '/': %s", name, value) - return p - } - p.grouping[name] = value - } - return p -} - -// Client sets a custom HTTP client for the Pusher. For convenience, this method -// returns a pointer to the Pusher itself. -func (p *Pusher) Client(c *http.Client) *Pusher { - p.client = c - return p -} - -// BasicAuth configures the Pusher to use HTTP Basic Authentication with the -// provided username and password. For convenience, this method returns a -// pointer to the Pusher itself. -func (p *Pusher) BasicAuth(username, password string) *Pusher { - p.useBasicAuth = true - p.username = username - p.password = password - return p -} - -func (p *Pusher) push(method string) error { - if p.error != nil { - return p.error - } - urlComponents := []string{url.QueryEscape(p.job)} - for ln, lv := range p.grouping { - urlComponents = append(urlComponents, ln, lv) - } - pushURL := fmt.Sprintf("%s/metrics/job/%s", p.url, strings.Join(urlComponents, "/")) - - mfs, err := p.gatherers.Gather() - if err != nil { - return err - } - buf := &bytes.Buffer{} - enc := expfmt.NewEncoder(buf, expfmt.FmtProtoDelim) - // Check for pre-existing grouping labels: - for _, mf := range mfs { - for _, m := range mf.GetMetric() { - for _, l := range m.GetLabel() { - if l.GetName() == "job" { - return fmt.Errorf("pushed metric %s (%s) already contains a job label", mf.GetName(), m) - } - if _, ok := p.grouping[l.GetName()]; ok { - return fmt.Errorf( - "pushed metric %s (%s) already contains grouping label %s", - mf.GetName(), m, l.GetName(), - ) - } - } - } - enc.Encode(mf) - } - req, err := http.NewRequest(method, pushURL, buf) - if err != nil { - return err - } - if p.useBasicAuth { - req.SetBasicAuth(p.username, p.password) - } - req.Header.Set(contentTypeHeader, string(expfmt.FmtProtoDelim)) - resp, err := p.client.Do(req) - if err != nil { - return err - } - defer resp.Body.Close() - if resp.StatusCode != 202 { - body, _ := ioutil.ReadAll(resp.Body) // Ignore any further error as this is for an error message only. - return fmt.Errorf("unexpected status code %d while pushing to %s: %s", resp.StatusCode, pushURL, body) - } - return nil -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/push/push_test.go b/vendor/github.com/prometheus/client_golang/prometheus/push/push_test.go deleted file mode 100644 index 34ec334bb..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/push/push_test.go +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright 2016 The Prometheus 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 push - -import ( - "bytes" - "io/ioutil" - "net/http" - "net/http/httptest" - "testing" - - "github.com/prometheus/common/expfmt" - - "github.com/prometheus/client_golang/prometheus" -) - -func TestPush(t *testing.T) { - - var ( - lastMethod string - lastBody []byte - lastPath string - ) - - // Fake a Pushgateway that always responds with 202. - pgwOK := httptest.NewServer( - http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - lastMethod = r.Method - var err error - lastBody, err = ioutil.ReadAll(r.Body) - if err != nil { - t.Fatal(err) - } - lastPath = r.URL.EscapedPath() - w.Header().Set("Content-Type", `text/plain; charset=utf-8`) - w.WriteHeader(http.StatusAccepted) - }), - ) - defer pgwOK.Close() - - // Fake a Pushgateway that always responds with 500. - pgwErr := httptest.NewServer( - http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "fake error", http.StatusInternalServerError) - }), - ) - defer pgwErr.Close() - - metric1 := prometheus.NewCounter(prometheus.CounterOpts{ - Name: "testname1", - Help: "testhelp1", - }) - metric2 := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "testname2", - Help: "testhelp2", - ConstLabels: prometheus.Labels{"foo": "bar", "dings": "bums"}, - }) - - reg := prometheus.NewRegistry() - reg.MustRegister(metric1) - reg.MustRegister(metric2) - - mfs, err := reg.Gather() - if err != nil { - t.Fatal(err) - } - - buf := &bytes.Buffer{} - enc := expfmt.NewEncoder(buf, expfmt.FmtProtoDelim) - - for _, mf := range mfs { - if err := enc.Encode(mf); err != nil { - t.Fatal(err) - } - } - wantBody := buf.Bytes() - - // Push some Collectors, all good. - if err := New(pgwOK.URL, "testjob"). - Collector(metric1). - Collector(metric2). - Push(); err != nil { - t.Fatal(err) - } - if lastMethod != "PUT" { - t.Error("want method PUT for Push, got", lastMethod) - } - if bytes.Compare(lastBody, wantBody) != 0 { - t.Errorf("got body %v, want %v", lastBody, wantBody) - } - if lastPath != "/metrics/job/testjob" { - t.Error("unexpected path:", lastPath) - } - - // Add some Collectors, with nil grouping, all good. - if err := New(pgwOK.URL, "testjob"). - Collector(metric1). - Collector(metric2). - Add(); err != nil { - t.Fatal(err) - } - if lastMethod != "POST" { - t.Error("want method POST for Add, got", lastMethod) - } - if bytes.Compare(lastBody, wantBody) != 0 { - t.Errorf("got body %v, want %v", lastBody, wantBody) - } - if lastPath != "/metrics/job/testjob" { - t.Error("unexpected path:", lastPath) - } - - // Push some Collectors with a broken PGW. - if err := New(pgwErr.URL, "testjob"). - Collector(metric1). - Collector(metric2). - Push(); err == nil { - t.Error("push to broken Pushgateway succeeded") - } else { - if got, want := err.Error(), "unexpected status code 500 while pushing to "+pgwErr.URL+"/metrics/job/testjob: fake error\n"; got != want { - t.Errorf("got error %q, want %q", got, want) - } - } - - // Push some Collectors with invalid grouping or job. - if err := New(pgwOK.URL, "testjob"). - Grouping("foo", "bums"). - Collector(metric1). - Collector(metric2). - Push(); err == nil { - t.Error("push with grouping contained in metrics succeeded") - } - if err := New(pgwOK.URL, "test/job"). - Collector(metric1). - Collector(metric2). - Push(); err == nil { - t.Error("push with invalid job value succeeded") - } - if err := New(pgwOK.URL, "testjob"). - Grouping("foobar", "bu/ms"). - Collector(metric1). - Collector(metric2). - Push(); err == nil { - t.Error("push with invalid grouping succeeded") - } - if err := New(pgwOK.URL, "testjob"). - Grouping("foo-bar", "bums"). - Collector(metric1). - Collector(metric2). - Push(); err == nil { - t.Error("push with invalid grouping succeeded") - } - - // Push registry, all good. - if err := New(pgwOK.URL, "testjob"). - Gatherer(reg). - Push(); err != nil { - t.Fatal(err) - } - if lastMethod != "PUT" { - t.Error("want method PUT for Push, got", lastMethod) - } - if bytes.Compare(lastBody, wantBody) != 0 { - t.Errorf("got body %v, want %v", lastBody, wantBody) - } - - // Add registry, all good. - if err := New(pgwOK.URL, "testjob"). - Grouping("a", "x"). - Grouping("b", "y"). - Gatherer(reg). - Add(); err != nil { - t.Fatal(err) - } - if lastMethod != "POST" { - t.Error("want method POST for Add, got", lastMethod) - } - if bytes.Compare(lastBody, wantBody) != 0 { - t.Errorf("got body %v, want %v", lastBody, wantBody) - } - if lastPath != "/metrics/job/testjob/a/x/b/y" && lastPath != "/metrics/job/testjob/b/y/a/x" { - t.Error("unexpected path:", lastPath) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go deleted file mode 100644 index e422ef383..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go +++ /dev/null @@ -1,895 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "bytes" - "fmt" - "runtime" - "sort" - "strings" - "sync" - "unicode/utf8" - - "github.com/golang/protobuf/proto" - - dto "github.com/prometheus/client_model/go" - - "github.com/prometheus/client_golang/prometheus/internal" -) - -const ( - // Capacity for the channel to collect metrics and descriptors. - capMetricChan = 1000 - capDescChan = 10 -) - -// DefaultRegisterer and DefaultGatherer are the implementations of the -// Registerer and Gatherer interface a number of convenience functions in this -// package act on. Initially, both variables point to the same Registry, which -// has a process collector (currently on Linux only, see NewProcessCollector) -// and a Go collector (see NewGoCollector, in particular the note about -// stop-the-world implication with Go versions older than 1.9) already -// registered. This approach to keep default instances as global state mirrors -// the approach of other packages in the Go standard library. Note that there -// are caveats. Change the variables with caution and only if you understand the -// consequences. Users who want to avoid global state altogether should not use -// the convenience functions and act on custom instances instead. -var ( - defaultRegistry = NewRegistry() - DefaultRegisterer Registerer = defaultRegistry - DefaultGatherer Gatherer = defaultRegistry -) - -func init() { - MustRegister(NewProcessCollector(ProcessCollectorOpts{})) - MustRegister(NewGoCollector()) -} - -// NewRegistry creates a new vanilla Registry without any Collectors -// pre-registered. -func NewRegistry() *Registry { - return &Registry{ - collectorsByID: map[uint64]Collector{}, - descIDs: map[uint64]struct{}{}, - dimHashesByName: map[string]uint64{}, - } -} - -// NewPedanticRegistry returns a registry that checks during collection if each -// collected Metric is consistent with its reported Desc, and if the Desc has -// actually been registered with the registry. Unchecked Collectors (those whose -// Describe methed does not yield any descriptors) are excluded from the check. -// -// Usually, a Registry will be happy as long as the union of all collected -// Metrics is consistent and valid even if some metrics are not consistent with -// their own Desc or a Desc provided by their registered Collector. Well-behaved -// Collectors and Metrics will only provide consistent Descs. This Registry is -// useful to test the implementation of Collectors and Metrics. -func NewPedanticRegistry() *Registry { - r := NewRegistry() - r.pedanticChecksEnabled = true - return r -} - -// Registerer is the interface for the part of a registry in charge of -// registering and unregistering. Users of custom registries should use -// Registerer as type for registration purposes (rather than the Registry type -// directly). In that way, they are free to use custom Registerer implementation -// (e.g. for testing purposes). -type Registerer interface { - // Register registers a new Collector to be included in metrics - // collection. It returns an error if the descriptors provided by the - // Collector are invalid or if they — in combination with descriptors of - // already registered Collectors — do not fulfill the consistency and - // uniqueness criteria described in the documentation of metric.Desc. - // - // If the provided Collector is equal to a Collector already registered - // (which includes the case of re-registering the same Collector), the - // returned error is an instance of AlreadyRegisteredError, which - // contains the previously registered Collector. - // - // A Collector whose Describe method does not yield any Desc is treated - // as unchecked. Registration will always succeed. No check for - // re-registering (see previous paragraph) is performed. Thus, the - // caller is responsible for not double-registering the same unchecked - // Collector, and for providing a Collector that will not cause - // inconsistent metrics on collection. (This would lead to scrape - // errors.) - Register(Collector) error - // MustRegister works like Register but registers any number of - // Collectors and panics upon the first registration that causes an - // error. - MustRegister(...Collector) - // Unregister unregisters the Collector that equals the Collector passed - // in as an argument. (Two Collectors are considered equal if their - // Describe method yields the same set of descriptors.) The function - // returns whether a Collector was unregistered. Note that an unchecked - // Collector cannot be unregistered (as its Describe method does not - // yield any descriptor). - // - // Note that even after unregistering, it will not be possible to - // register a new Collector that is inconsistent with the unregistered - // Collector, e.g. a Collector collecting metrics with the same name but - // a different help string. The rationale here is that the same registry - // instance must only collect consistent metrics throughout its - // lifetime. - Unregister(Collector) bool -} - -// Gatherer is the interface for the part of a registry in charge of gathering -// the collected metrics into a number of MetricFamilies. The Gatherer interface -// comes with the same general implication as described for the Registerer -// interface. -type Gatherer interface { - // Gather calls the Collect method of the registered Collectors and then - // gathers the collected metrics into a lexicographically sorted slice - // of uniquely named MetricFamily protobufs. Gather ensures that the - // returned slice is valid and self-consistent so that it can be used - // for valid exposition. As an exception to the strict consistency - // requirements described for metric.Desc, Gather will tolerate - // different sets of label names for metrics of the same metric family. - // - // Even if an error occurs, Gather attempts to gather as many metrics as - // possible. Hence, if a non-nil error is returned, the returned - // MetricFamily slice could be nil (in case of a fatal error that - // prevented any meaningful metric collection) or contain a number of - // MetricFamily protobufs, some of which might be incomplete, and some - // might be missing altogether. The returned error (which might be a - // MultiError) explains the details. Note that this is mostly useful for - // debugging purposes. If the gathered protobufs are to be used for - // exposition in actual monitoring, it is almost always better to not - // expose an incomplete result and instead disregard the returned - // MetricFamily protobufs in case the returned error is non-nil. - Gather() ([]*dto.MetricFamily, error) -} - -// Register registers the provided Collector with the DefaultRegisterer. -// -// Register is a shortcut for DefaultRegisterer.Register(c). See there for more -// details. -func Register(c Collector) error { - return DefaultRegisterer.Register(c) -} - -// MustRegister registers the provided Collectors with the DefaultRegisterer and -// panics if any error occurs. -// -// MustRegister is a shortcut for DefaultRegisterer.MustRegister(cs...). See -// there for more details. -func MustRegister(cs ...Collector) { - DefaultRegisterer.MustRegister(cs...) -} - -// Unregister removes the registration of the provided Collector from the -// DefaultRegisterer. -// -// Unregister is a shortcut for DefaultRegisterer.Unregister(c). See there for -// more details. -func Unregister(c Collector) bool { - return DefaultRegisterer.Unregister(c) -} - -// GathererFunc turns a function into a Gatherer. -type GathererFunc func() ([]*dto.MetricFamily, error) - -// Gather implements Gatherer. -func (gf GathererFunc) Gather() ([]*dto.MetricFamily, error) { - return gf() -} - -// AlreadyRegisteredError is returned by the Register method if the Collector to -// be registered has already been registered before, or a different Collector -// that collects the same metrics has been registered before. Registration fails -// in that case, but you can detect from the kind of error what has -// happened. The error contains fields for the existing Collector and the -// (rejected) new Collector that equals the existing one. This can be used to -// find out if an equal Collector has been registered before and switch over to -// using the old one, as demonstrated in the example. -type AlreadyRegisteredError struct { - ExistingCollector, NewCollector Collector -} - -func (err AlreadyRegisteredError) Error() string { - return "duplicate metrics collector registration attempted" -} - -// MultiError is a slice of errors implementing the error interface. It is used -// by a Gatherer to report multiple errors during MetricFamily gathering. -type MultiError []error - -func (errs MultiError) Error() string { - if len(errs) == 0 { - return "" - } - buf := &bytes.Buffer{} - fmt.Fprintf(buf, "%d error(s) occurred:", len(errs)) - for _, err := range errs { - fmt.Fprintf(buf, "\n* %s", err) - } - return buf.String() -} - -// Append appends the provided error if it is not nil. -func (errs *MultiError) Append(err error) { - if err != nil { - *errs = append(*errs, err) - } -} - -// MaybeUnwrap returns nil if len(errs) is 0. It returns the first and only -// contained error as error if len(errs is 1). In all other cases, it returns -// the MultiError directly. This is helpful for returning a MultiError in a way -// that only uses the MultiError if needed. -func (errs MultiError) MaybeUnwrap() error { - switch len(errs) { - case 0: - return nil - case 1: - return errs[0] - default: - return errs - } -} - -// Registry registers Prometheus collectors, collects their metrics, and gathers -// them into MetricFamilies for exposition. It implements both Registerer and -// Gatherer. The zero value is not usable. Create instances with NewRegistry or -// NewPedanticRegistry. -type Registry struct { - mtx sync.RWMutex - collectorsByID map[uint64]Collector // ID is a hash of the descIDs. - descIDs map[uint64]struct{} - dimHashesByName map[string]uint64 - uncheckedCollectors []Collector - pedanticChecksEnabled bool -} - -// Register implements Registerer. -func (r *Registry) Register(c Collector) error { - var ( - descChan = make(chan *Desc, capDescChan) - newDescIDs = map[uint64]struct{}{} - newDimHashesByName = map[string]uint64{} - collectorID uint64 // Just a sum of all desc IDs. - duplicateDescErr error - ) - go func() { - c.Describe(descChan) - close(descChan) - }() - r.mtx.Lock() - defer func() { - // Drain channel in case of premature return to not leak a goroutine. - for range descChan { - } - r.mtx.Unlock() - }() - // Conduct various tests... - for desc := range descChan { - - // Is the descriptor valid at all? - if desc.err != nil { - return fmt.Errorf("descriptor %s is invalid: %s", desc, desc.err) - } - - // Is the descID unique? - // (In other words: Is the fqName + constLabel combination unique?) - if _, exists := r.descIDs[desc.id]; exists { - duplicateDescErr = fmt.Errorf("descriptor %s already exists with the same fully-qualified name and const label values", desc) - } - // If it is not a duplicate desc in this collector, add it to - // the collectorID. (We allow duplicate descs within the same - // collector, but their existence must be a no-op.) - if _, exists := newDescIDs[desc.id]; !exists { - newDescIDs[desc.id] = struct{}{} - collectorID += desc.id - } - - // Are all the label names and the help string consistent with - // previous descriptors of the same name? - // First check existing descriptors... - if dimHash, exists := r.dimHashesByName[desc.fqName]; exists { - if dimHash != desc.dimHash { - return fmt.Errorf("a previously registered descriptor with the same fully-qualified name as %s has different label names or a different help string", desc) - } - } else { - // ...then check the new descriptors already seen. - if dimHash, exists := newDimHashesByName[desc.fqName]; exists { - if dimHash != desc.dimHash { - return fmt.Errorf("descriptors reported by collector have inconsistent label names or help strings for the same fully-qualified name, offender is %s", desc) - } - } else { - newDimHashesByName[desc.fqName] = desc.dimHash - } - } - } - // A Collector yielding no Desc at all is considered unchecked. - if len(newDescIDs) == 0 { - r.uncheckedCollectors = append(r.uncheckedCollectors, c) - return nil - } - if existing, exists := r.collectorsByID[collectorID]; exists { - return AlreadyRegisteredError{ - ExistingCollector: existing, - NewCollector: c, - } - } - // If the collectorID is new, but at least one of the descs existed - // before, we are in trouble. - if duplicateDescErr != nil { - return duplicateDescErr - } - - // Only after all tests have passed, actually register. - r.collectorsByID[collectorID] = c - for hash := range newDescIDs { - r.descIDs[hash] = struct{}{} - } - for name, dimHash := range newDimHashesByName { - r.dimHashesByName[name] = dimHash - } - return nil -} - -// Unregister implements Registerer. -func (r *Registry) Unregister(c Collector) bool { - var ( - descChan = make(chan *Desc, capDescChan) - descIDs = map[uint64]struct{}{} - collectorID uint64 // Just a sum of the desc IDs. - ) - go func() { - c.Describe(descChan) - close(descChan) - }() - for desc := range descChan { - if _, exists := descIDs[desc.id]; !exists { - collectorID += desc.id - descIDs[desc.id] = struct{}{} - } - } - - r.mtx.RLock() - if _, exists := r.collectorsByID[collectorID]; !exists { - r.mtx.RUnlock() - return false - } - r.mtx.RUnlock() - - r.mtx.Lock() - defer r.mtx.Unlock() - - delete(r.collectorsByID, collectorID) - for id := range descIDs { - delete(r.descIDs, id) - } - // dimHashesByName is left untouched as those must be consistent - // throughout the lifetime of a program. - return true -} - -// MustRegister implements Registerer. -func (r *Registry) MustRegister(cs ...Collector) { - for _, c := range cs { - if err := r.Register(c); err != nil { - panic(err) - } - } -} - -// Gather implements Gatherer. -func (r *Registry) Gather() ([]*dto.MetricFamily, error) { - var ( - checkedMetricChan = make(chan Metric, capMetricChan) - uncheckedMetricChan = make(chan Metric, capMetricChan) - metricHashes = map[uint64]struct{}{} - wg sync.WaitGroup - errs MultiError // The collected errors to return in the end. - registeredDescIDs map[uint64]struct{} // Only used for pedantic checks - ) - - r.mtx.RLock() - goroutineBudget := len(r.collectorsByID) + len(r.uncheckedCollectors) - metricFamiliesByName := make(map[string]*dto.MetricFamily, len(r.dimHashesByName)) - checkedCollectors := make(chan Collector, len(r.collectorsByID)) - uncheckedCollectors := make(chan Collector, len(r.uncheckedCollectors)) - for _, collector := range r.collectorsByID { - checkedCollectors <- collector - } - for _, collector := range r.uncheckedCollectors { - uncheckedCollectors <- collector - } - // In case pedantic checks are enabled, we have to copy the map before - // giving up the RLock. - if r.pedanticChecksEnabled { - registeredDescIDs = make(map[uint64]struct{}, len(r.descIDs)) - for id := range r.descIDs { - registeredDescIDs[id] = struct{}{} - } - } - r.mtx.RUnlock() - - wg.Add(goroutineBudget) - - collectWorker := func() { - for { - select { - case collector := <-checkedCollectors: - collector.Collect(checkedMetricChan) - case collector := <-uncheckedCollectors: - collector.Collect(uncheckedMetricChan) - default: - return - } - wg.Done() - } - } - - // Start the first worker now to make sure at least one is running. - go collectWorker() - goroutineBudget-- - - // Close checkedMetricChan and uncheckedMetricChan once all collectors - // are collected. - go func() { - wg.Wait() - close(checkedMetricChan) - close(uncheckedMetricChan) - }() - - // Drain checkedMetricChan and uncheckedMetricChan in case of premature return. - defer func() { - if checkedMetricChan != nil { - for range checkedMetricChan { - } - } - if uncheckedMetricChan != nil { - for range uncheckedMetricChan { - } - } - }() - - // Copy the channel references so we can nil them out later to remove - // them from the select statements below. - cmc := checkedMetricChan - umc := uncheckedMetricChan - - for { - select { - case metric, ok := <-cmc: - if !ok { - cmc = nil - break - } - errs.Append(processMetric( - metric, metricFamiliesByName, - metricHashes, - registeredDescIDs, - )) - case metric, ok := <-umc: - if !ok { - umc = nil - break - } - errs.Append(processMetric( - metric, metricFamiliesByName, - metricHashes, - nil, - )) - default: - if goroutineBudget <= 0 || len(checkedCollectors)+len(uncheckedCollectors) == 0 { - // All collectors are already being worked on or - // we have already as many goroutines started as - // there are collectors. Do the same as above, - // just without the default. - select { - case metric, ok := <-cmc: - if !ok { - cmc = nil - break - } - errs.Append(processMetric( - metric, metricFamiliesByName, - metricHashes, - registeredDescIDs, - )) - case metric, ok := <-umc: - if !ok { - umc = nil - break - } - errs.Append(processMetric( - metric, metricFamiliesByName, - metricHashes, - nil, - )) - } - break - } - // Start more workers. - go collectWorker() - goroutineBudget-- - runtime.Gosched() - } - // Once both checkedMetricChan and uncheckdMetricChan are closed - // and drained, the contraption above will nil out cmc and umc, - // and then we can leave the collect loop here. - if cmc == nil && umc == nil { - break - } - } - return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap() -} - -// processMetric is an internal helper method only used by the Gather method. -func processMetric( - metric Metric, - metricFamiliesByName map[string]*dto.MetricFamily, - metricHashes map[uint64]struct{}, - registeredDescIDs map[uint64]struct{}, -) error { - desc := metric.Desc() - // Wrapped metrics collected by an unchecked Collector can have an - // invalid Desc. - if desc.err != nil { - return desc.err - } - dtoMetric := &dto.Metric{} - if err := metric.Write(dtoMetric); err != nil { - return fmt.Errorf("error collecting metric %v: %s", desc, err) - } - metricFamily, ok := metricFamiliesByName[desc.fqName] - if ok { // Existing name. - if metricFamily.GetHelp() != desc.help { - return fmt.Errorf( - "collected metric %s %s has help %q but should have %q", - desc.fqName, dtoMetric, desc.help, metricFamily.GetHelp(), - ) - } - // TODO(beorn7): Simplify switch once Desc has type. - switch metricFamily.GetType() { - case dto.MetricType_COUNTER: - if dtoMetric.Counter == nil { - return fmt.Errorf( - "collected metric %s %s should be a Counter", - desc.fqName, dtoMetric, - ) - } - case dto.MetricType_GAUGE: - if dtoMetric.Gauge == nil { - return fmt.Errorf( - "collected metric %s %s should be a Gauge", - desc.fqName, dtoMetric, - ) - } - case dto.MetricType_SUMMARY: - if dtoMetric.Summary == nil { - return fmt.Errorf( - "collected metric %s %s should be a Summary", - desc.fqName, dtoMetric, - ) - } - case dto.MetricType_UNTYPED: - if dtoMetric.Untyped == nil { - return fmt.Errorf( - "collected metric %s %s should be Untyped", - desc.fqName, dtoMetric, - ) - } - case dto.MetricType_HISTOGRAM: - if dtoMetric.Histogram == nil { - return fmt.Errorf( - "collected metric %s %s should be a Histogram", - desc.fqName, dtoMetric, - ) - } - default: - panic("encountered MetricFamily with invalid type") - } - } else { // New name. - metricFamily = &dto.MetricFamily{} - metricFamily.Name = proto.String(desc.fqName) - metricFamily.Help = proto.String(desc.help) - // TODO(beorn7): Simplify switch once Desc has type. - switch { - case dtoMetric.Gauge != nil: - metricFamily.Type = dto.MetricType_GAUGE.Enum() - case dtoMetric.Counter != nil: - metricFamily.Type = dto.MetricType_COUNTER.Enum() - case dtoMetric.Summary != nil: - metricFamily.Type = dto.MetricType_SUMMARY.Enum() - case dtoMetric.Untyped != nil: - metricFamily.Type = dto.MetricType_UNTYPED.Enum() - case dtoMetric.Histogram != nil: - metricFamily.Type = dto.MetricType_HISTOGRAM.Enum() - default: - return fmt.Errorf("empty metric collected: %s", dtoMetric) - } - if err := checkSuffixCollisions(metricFamily, metricFamiliesByName); err != nil { - return err - } - metricFamiliesByName[desc.fqName] = metricFamily - } - if err := checkMetricConsistency(metricFamily, dtoMetric, metricHashes); err != nil { - return err - } - if registeredDescIDs != nil { - // Is the desc registered at all? - if _, exist := registeredDescIDs[desc.id]; !exist { - return fmt.Errorf( - "collected metric %s %s with unregistered descriptor %s", - metricFamily.GetName(), dtoMetric, desc, - ) - } - if err := checkDescConsistency(metricFamily, dtoMetric, desc); err != nil { - return err - } - } - metricFamily.Metric = append(metricFamily.Metric, dtoMetric) - return nil -} - -// Gatherers is a slice of Gatherer instances that implements the Gatherer -// interface itself. Its Gather method calls Gather on all Gatherers in the -// slice in order and returns the merged results. Errors returned from the -// Gather calles are all returned in a flattened MultiError. Duplicate and -// inconsistent Metrics are skipped (first occurrence in slice order wins) and -// reported in the returned error. -// -// Gatherers can be used to merge the Gather results from multiple -// Registries. It also provides a way to directly inject existing MetricFamily -// protobufs into the gathering by creating a custom Gatherer with a Gather -// method that simply returns the existing MetricFamily protobufs. Note that no -// registration is involved (in contrast to Collector registration), so -// obviously registration-time checks cannot happen. Any inconsistencies between -// the gathered MetricFamilies are reported as errors by the Gather method, and -// inconsistent Metrics are dropped. Invalid parts of the MetricFamilies -// (e.g. syntactically invalid metric or label names) will go undetected. -type Gatherers []Gatherer - -// Gather implements Gatherer. -func (gs Gatherers) Gather() ([]*dto.MetricFamily, error) { - var ( - metricFamiliesByName = map[string]*dto.MetricFamily{} - metricHashes = map[uint64]struct{}{} - errs MultiError // The collected errors to return in the end. - ) - - for i, g := range gs { - mfs, err := g.Gather() - if err != nil { - if multiErr, ok := err.(MultiError); ok { - for _, err := range multiErr { - errs = append(errs, fmt.Errorf("[from Gatherer #%d] %s", i+1, err)) - } - } else { - errs = append(errs, fmt.Errorf("[from Gatherer #%d] %s", i+1, err)) - } - } - for _, mf := range mfs { - existingMF, exists := metricFamiliesByName[mf.GetName()] - if exists { - if existingMF.GetHelp() != mf.GetHelp() { - errs = append(errs, fmt.Errorf( - "gathered metric family %s has help %q but should have %q", - mf.GetName(), mf.GetHelp(), existingMF.GetHelp(), - )) - continue - } - if existingMF.GetType() != mf.GetType() { - errs = append(errs, fmt.Errorf( - "gathered metric family %s has type %s but should have %s", - mf.GetName(), mf.GetType(), existingMF.GetType(), - )) - continue - } - } else { - existingMF = &dto.MetricFamily{} - existingMF.Name = mf.Name - existingMF.Help = mf.Help - existingMF.Type = mf.Type - if err := checkSuffixCollisions(existingMF, metricFamiliesByName); err != nil { - errs = append(errs, err) - continue - } - metricFamiliesByName[mf.GetName()] = existingMF - } - for _, m := range mf.Metric { - if err := checkMetricConsistency(existingMF, m, metricHashes); err != nil { - errs = append(errs, err) - continue - } - existingMF.Metric = append(existingMF.Metric, m) - } - } - } - return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap() -} - -// checkSuffixCollisions checks for collisions with the “magic” suffixes the -// Prometheus text format and the internal metric representation of the -// Prometheus server add while flattening Summaries and Histograms. -func checkSuffixCollisions(mf *dto.MetricFamily, mfs map[string]*dto.MetricFamily) error { - var ( - newName = mf.GetName() - newType = mf.GetType() - newNameWithoutSuffix = "" - ) - switch { - case strings.HasSuffix(newName, "_count"): - newNameWithoutSuffix = newName[:len(newName)-6] - case strings.HasSuffix(newName, "_sum"): - newNameWithoutSuffix = newName[:len(newName)-4] - case strings.HasSuffix(newName, "_bucket"): - newNameWithoutSuffix = newName[:len(newName)-7] - } - if newNameWithoutSuffix != "" { - if existingMF, ok := mfs[newNameWithoutSuffix]; ok { - switch existingMF.GetType() { - case dto.MetricType_SUMMARY: - if !strings.HasSuffix(newName, "_bucket") { - return fmt.Errorf( - "collected metric named %q collides with previously collected summary named %q", - newName, newNameWithoutSuffix, - ) - } - case dto.MetricType_HISTOGRAM: - return fmt.Errorf( - "collected metric named %q collides with previously collected histogram named %q", - newName, newNameWithoutSuffix, - ) - } - } - } - if newType == dto.MetricType_SUMMARY || newType == dto.MetricType_HISTOGRAM { - if _, ok := mfs[newName+"_count"]; ok { - return fmt.Errorf( - "collected histogram or summary named %q collides with previously collected metric named %q", - newName, newName+"_count", - ) - } - if _, ok := mfs[newName+"_sum"]; ok { - return fmt.Errorf( - "collected histogram or summary named %q collides with previously collected metric named %q", - newName, newName+"_sum", - ) - } - } - if newType == dto.MetricType_HISTOGRAM { - if _, ok := mfs[newName+"_bucket"]; ok { - return fmt.Errorf( - "collected histogram named %q collides with previously collected metric named %q", - newName, newName+"_bucket", - ) - } - } - return nil -} - -// checkMetricConsistency checks if the provided Metric is consistent with the -// provided MetricFamily. It also hashes the Metric labels and the MetricFamily -// name. If the resulting hash is already in the provided metricHashes, an error -// is returned. If not, it is added to metricHashes. -func checkMetricConsistency( - metricFamily *dto.MetricFamily, - dtoMetric *dto.Metric, - metricHashes map[uint64]struct{}, -) error { - name := metricFamily.GetName() - - // Type consistency with metric family. - if metricFamily.GetType() == dto.MetricType_GAUGE && dtoMetric.Gauge == nil || - metricFamily.GetType() == dto.MetricType_COUNTER && dtoMetric.Counter == nil || - metricFamily.GetType() == dto.MetricType_SUMMARY && dtoMetric.Summary == nil || - metricFamily.GetType() == dto.MetricType_HISTOGRAM && dtoMetric.Histogram == nil || - metricFamily.GetType() == dto.MetricType_UNTYPED && dtoMetric.Untyped == nil { - return fmt.Errorf( - "collected metric %q { %s} is not a %s", - name, dtoMetric, metricFamily.GetType(), - ) - } - - previousLabelName := "" - for _, labelPair := range dtoMetric.GetLabel() { - labelName := labelPair.GetName() - if labelName == previousLabelName { - return fmt.Errorf( - "collected metric %q { %s} has two or more labels with the same name: %s", - name, dtoMetric, labelName, - ) - } - if !checkLabelName(labelName) { - return fmt.Errorf( - "collected metric %q { %s} has a label with an invalid name: %s", - name, dtoMetric, labelName, - ) - } - if dtoMetric.Summary != nil && labelName == quantileLabel { - return fmt.Errorf( - "collected metric %q { %s} must not have an explicit %q label", - name, dtoMetric, quantileLabel, - ) - } - if !utf8.ValidString(labelPair.GetValue()) { - return fmt.Errorf( - "collected metric %q { %s} has a label named %q whose value is not utf8: %#v", - name, dtoMetric, labelName, labelPair.GetValue()) - } - previousLabelName = labelName - } - - // Is the metric unique (i.e. no other metric with the same name and the same labels)? - h := hashNew() - h = hashAdd(h, name) - h = hashAddByte(h, separatorByte) - // Make sure label pairs are sorted. We depend on it for the consistency - // check. - sort.Sort(labelPairSorter(dtoMetric.Label)) - for _, lp := range dtoMetric.Label { - h = hashAdd(h, lp.GetName()) - h = hashAddByte(h, separatorByte) - h = hashAdd(h, lp.GetValue()) - h = hashAddByte(h, separatorByte) - } - if _, exists := metricHashes[h]; exists { - return fmt.Errorf( - "collected metric %q { %s} was collected before with the same name and label values", - name, dtoMetric, - ) - } - metricHashes[h] = struct{}{} - return nil -} - -func checkDescConsistency( - metricFamily *dto.MetricFamily, - dtoMetric *dto.Metric, - desc *Desc, -) error { - // Desc help consistency with metric family help. - if metricFamily.GetHelp() != desc.help { - return fmt.Errorf( - "collected metric %s %s has help %q but should have %q", - metricFamily.GetName(), dtoMetric, metricFamily.GetHelp(), desc.help, - ) - } - - // Is the desc consistent with the content of the metric? - lpsFromDesc := make([]*dto.LabelPair, 0, len(dtoMetric.Label)) - lpsFromDesc = append(lpsFromDesc, desc.constLabelPairs...) - for _, l := range desc.variableLabels { - lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{ - Name: proto.String(l), - }) - } - if len(lpsFromDesc) != len(dtoMetric.Label) { - return fmt.Errorf( - "labels in collected metric %s %s are inconsistent with descriptor %s", - metricFamily.GetName(), dtoMetric, desc, - ) - } - sort.Sort(labelPairSorter(lpsFromDesc)) - for i, lpFromDesc := range lpsFromDesc { - lpFromMetric := dtoMetric.Label[i] - if lpFromDesc.GetName() != lpFromMetric.GetName() || - lpFromDesc.Value != nil && lpFromDesc.GetValue() != lpFromMetric.GetValue() { - return fmt.Errorf( - "labels in collected metric %s %s are inconsistent with descriptor %s", - metricFamily.GetName(), dtoMetric, desc, - ) - } - } - return nil -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry_test.go b/vendor/github.com/prometheus/client_golang/prometheus/registry_test.go deleted file mode 100644 index d05ac9ad0..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/registry_test.go +++ /dev/null @@ -1,873 +0,0 @@ -// Copyright 2014 The Prometheus 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. - -// Copyright (c) 2013, The Prometheus 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 prometheus_test - -import ( - "bytes" - "math/rand" - "net/http" - "net/http/httptest" - "sync" - "testing" - "time" - - dto "github.com/prometheus/client_model/go" - - "github.com/golang/protobuf/proto" - "github.com/prometheus/common/expfmt" - - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" -) - -// uncheckedCollector wraps a Collector but its Describe method yields no Desc. -type uncheckedCollector struct { - c prometheus.Collector -} - -func (u uncheckedCollector) Describe(_ chan<- *prometheus.Desc) {} -func (u uncheckedCollector) Collect(c chan<- prometheus.Metric) { - u.c.Collect(c) -} - -func testHandler(t testing.TB) { - // TODO(beorn7): This test is a bit too "end-to-end". It tests quite a - // few moving parts that are not strongly coupled. They could/should be - // tested separately. However, the changes planned for v0.10 will - // require a major rework of this test anyway, at which time I will - // structure it in a better way. - - metricVec := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "name", - Help: "docstring", - ConstLabels: prometheus.Labels{"constname": "constvalue"}, - }, - []string{"labelname"}, - ) - - metricVec.WithLabelValues("val1").Inc() - metricVec.WithLabelValues("val2").Inc() - - externalMetricFamily := &dto.MetricFamily{ - Name: proto.String("externalname"), - Help: proto.String("externaldocstring"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - { - Label: []*dto.LabelPair{ - { - Name: proto.String("externalconstname"), - Value: proto.String("externalconstvalue"), - }, - { - Name: proto.String("externallabelname"), - Value: proto.String("externalval1"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(1), - }, - }, - }, - } - externalBuf := &bytes.Buffer{} - enc := expfmt.NewEncoder(externalBuf, expfmt.FmtProtoDelim) - if err := enc.Encode(externalMetricFamily); err != nil { - t.Fatal(err) - } - externalMetricFamilyAsBytes := externalBuf.Bytes() - externalMetricFamilyAsText := []byte(`# HELP externalname externaldocstring -# TYPE externalname counter -externalname{externalconstname="externalconstvalue",externallabelname="externalval1"} 1 -`) - externalMetricFamilyAsProtoText := []byte(`name: "externalname" -help: "externaldocstring" -type: COUNTER -metric: < - label: < - name: "externalconstname" - value: "externalconstvalue" - > - label: < - name: "externallabelname" - value: "externalval1" - > - counter: < - value: 1 - > -> - -`) - externalMetricFamilyAsProtoCompactText := []byte(`name:"externalname" help:"externaldocstring" type:COUNTER metric: label: counter: > -`) - - expectedMetricFamily := &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("docstring"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - { - Label: []*dto.LabelPair{ - { - Name: proto.String("constname"), - Value: proto.String("constvalue"), - }, - { - Name: proto.String("labelname"), - Value: proto.String("val1"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(1), - }, - }, - { - Label: []*dto.LabelPair{ - { - Name: proto.String("constname"), - Value: proto.String("constvalue"), - }, - { - Name: proto.String("labelname"), - Value: proto.String("val2"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(1), - }, - }, - }, - } - buf := &bytes.Buffer{} - enc = expfmt.NewEncoder(buf, expfmt.FmtProtoDelim) - if err := enc.Encode(expectedMetricFamily); err != nil { - t.Fatal(err) - } - expectedMetricFamilyAsBytes := buf.Bytes() - expectedMetricFamilyAsText := []byte(`# HELP name docstring -# TYPE name counter -name{constname="constvalue",labelname="val1"} 1 -name{constname="constvalue",labelname="val2"} 1 -`) - expectedMetricFamilyAsProtoText := []byte(`name: "name" -help: "docstring" -type: COUNTER -metric: < - label: < - name: "constname" - value: "constvalue" - > - label: < - name: "labelname" - value: "val1" - > - counter: < - value: 1 - > -> -metric: < - label: < - name: "constname" - value: "constvalue" - > - label: < - name: "labelname" - value: "val2" - > - counter: < - value: 1 - > -> - -`) - expectedMetricFamilyAsProtoCompactText := []byte(`name:"name" help:"docstring" type:COUNTER metric: label: counter: > metric: label: counter: > -`) - - externalMetricFamilyWithSameName := &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("docstring"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - { - Label: []*dto.LabelPair{ - { - Name: proto.String("constname"), - Value: proto.String("constvalue"), - }, - { - Name: proto.String("labelname"), - Value: proto.String("different_val"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(42), - }, - }, - }, - } - - expectedMetricFamilyMergedWithExternalAsProtoCompactText := []byte(`name:"name" help:"docstring" type:COUNTER metric: label: counter: > metric: label: counter: > metric: label: counter: > -`) - - externalMetricFamilyWithInvalidLabelValue := &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("docstring"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - { - Label: []*dto.LabelPair{ - { - Name: proto.String("constname"), - Value: proto.String("\xFF"), - }, - { - Name: proto.String("labelname"), - Value: proto.String("different_val"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(42), - }, - }, - }, - } - - expectedMetricFamilyInvalidLabelValueAsText := []byte(`An error has occurred during metrics gathering: - -collected metric "name" { label: label: counter: } has a label named "constname" whose value is not utf8: "\xff" -`) - - summary := prometheus.NewSummary(prometheus.SummaryOpts{ - Name: "complex", - Help: "A metric to check collisions with _sum and _count.", - }) - summaryAsText := []byte(`# HELP complex A metric to check collisions with _sum and _count. -# TYPE complex summary -complex{quantile="0.5"} NaN -complex{quantile="0.9"} NaN -complex{quantile="0.99"} NaN -complex_sum 0 -complex_count 0 -`) - histogram := prometheus.NewHistogram(prometheus.HistogramOpts{ - Name: "complex", - Help: "A metric to check collisions with _sun, _count, and _bucket.", - }) - externalMetricFamilyWithBucketSuffix := &dto.MetricFamily{ - Name: proto.String("complex_bucket"), - Help: proto.String("externaldocstring"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - { - Counter: &dto.Counter{ - Value: proto.Float64(1), - }, - }, - }, - } - externalMetricFamilyWithBucketSuffixAsText := []byte(`# HELP complex_bucket externaldocstring -# TYPE complex_bucket counter -complex_bucket 1 -`) - externalMetricFamilyWithCountSuffix := &dto.MetricFamily{ - Name: proto.String("complex_count"), - Help: proto.String("externaldocstring"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - { - Counter: &dto.Counter{ - Value: proto.Float64(1), - }, - }, - }, - } - bucketCollisionMsg := []byte(`An error has occurred during metrics gathering: - -collected metric named "complex_bucket" collides with previously collected histogram named "complex" -`) - summaryCountCollisionMsg := []byte(`An error has occurred during metrics gathering: - -collected metric named "complex_count" collides with previously collected summary named "complex" -`) - histogramCountCollisionMsg := []byte(`An error has occurred during metrics gathering: - -collected metric named "complex_count" collides with previously collected histogram named "complex" -`) - externalMetricFamilyWithDuplicateLabel := &dto.MetricFamily{ - Name: proto.String("broken_metric"), - Help: proto.String("The registry should detect the duplicate label."), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - { - Label: []*dto.LabelPair{ - { - Name: proto.String("foo"), - Value: proto.String("bar"), - }, - { - Name: proto.String("foo"), - Value: proto.String("baz"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(2.7), - }, - }, - }, - } - duplicateLabelMsg := []byte(`An error has occurred during metrics gathering: - -collected metric "broken_metric" { label: label: counter: } has two or more labels with the same name: foo -`) - - type output struct { - headers map[string]string - body []byte - } - - var scenarios = []struct { - headers map[string]string - out output - collector prometheus.Collector - externalMF []*dto.MetricFamily - }{ - { // 0 - headers: map[string]string{ - "Accept": "foo/bar;q=0.2, dings/bums;q=0.8", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: []byte{}, - }, - }, - { // 1 - headers: map[string]string{ - "Accept": "foo/bar;q=0.2, application/quark;q=0.8", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: []byte{}, - }, - }, - { // 2 - headers: map[string]string{ - "Accept": "foo/bar;q=0.2, application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=bla;q=0.8", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: []byte{}, - }, - }, - { // 3 - headers: map[string]string{ - "Accept": "text/plain;q=0.2, application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited;q=0.8", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`, - }, - body: []byte{}, - }, - }, - { // 4 - headers: map[string]string{ - "Accept": "application/json", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: expectedMetricFamilyAsText, - }, - collector: metricVec, - }, - { // 5 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`, - }, - body: expectedMetricFamilyAsBytes, - }, - collector: metricVec, - }, - { // 6 - headers: map[string]string{ - "Accept": "application/json", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: externalMetricFamilyAsText, - }, - externalMF: []*dto.MetricFamily{externalMetricFamily}, - }, - { // 7 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`, - }, - body: externalMetricFamilyAsBytes, - }, - externalMF: []*dto.MetricFamily{externalMetricFamily}, - }, - { // 8 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`, - }, - body: bytes.Join( - [][]byte{ - externalMetricFamilyAsBytes, - expectedMetricFamilyAsBytes, - }, - []byte{}, - ), - }, - collector: metricVec, - externalMF: []*dto.MetricFamily{externalMetricFamily}, - }, - { // 9 - headers: map[string]string{ - "Accept": "text/plain", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: []byte{}, - }, - }, - { // 10 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=bla;q=0.2, text/plain;q=0.5", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: expectedMetricFamilyAsText, - }, - collector: metricVec, - }, - { // 11 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=bla;q=0.2, text/plain;q=0.5;version=0.0.4", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: bytes.Join( - [][]byte{ - externalMetricFamilyAsText, - expectedMetricFamilyAsText, - }, - []byte{}, - ), - }, - collector: metricVec, - externalMF: []*dto.MetricFamily{externalMetricFamily}, - }, - { // 12 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited;q=0.2, text/plain;q=0.5;version=0.0.2", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`, - }, - body: bytes.Join( - [][]byte{ - externalMetricFamilyAsBytes, - expectedMetricFamilyAsBytes, - }, - []byte{}, - ), - }, - collector: metricVec, - externalMF: []*dto.MetricFamily{externalMetricFamily}, - }, - { // 13 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=text;q=0.5, application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=delimited;q=0.4", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=text`, - }, - body: bytes.Join( - [][]byte{ - externalMetricFamilyAsProtoText, - expectedMetricFamilyAsProtoText, - }, - []byte{}, - ), - }, - collector: metricVec, - externalMF: []*dto.MetricFamily{externalMetricFamily}, - }, - { // 14 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=compact-text", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=compact-text`, - }, - body: bytes.Join( - [][]byte{ - externalMetricFamilyAsProtoCompactText, - expectedMetricFamilyAsProtoCompactText, - }, - []byte{}, - ), - }, - collector: metricVec, - externalMF: []*dto.MetricFamily{externalMetricFamily}, - }, - { // 15 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=compact-text", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=compact-text`, - }, - body: bytes.Join( - [][]byte{ - externalMetricFamilyAsProtoCompactText, - expectedMetricFamilyMergedWithExternalAsProtoCompactText, - }, - []byte{}, - ), - }, - collector: metricVec, - externalMF: []*dto.MetricFamily{ - externalMetricFamily, - externalMetricFamilyWithSameName, - }, - }, - { // 16 - headers: map[string]string{ - "Accept": "application/vnd.google.protobuf;proto=io.prometheus.client.MetricFamily;encoding=compact-text", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; charset=utf-8`, - }, - body: expectedMetricFamilyInvalidLabelValueAsText, - }, - collector: metricVec, - externalMF: []*dto.MetricFamily{ - externalMetricFamily, - externalMetricFamilyWithInvalidLabelValue, - }, - }, - { // 17 - headers: map[string]string{ - "Accept": "text/plain", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: expectedMetricFamilyAsText, - }, - collector: uncheckedCollector{metricVec}, - }, - { // 18 - headers: map[string]string{ - "Accept": "text/plain", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; charset=utf-8`, - }, - body: histogramCountCollisionMsg, - }, - collector: histogram, - externalMF: []*dto.MetricFamily{ - externalMetricFamilyWithCountSuffix, - }, - }, - { // 19 - headers: map[string]string{ - "Accept": "text/plain", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; charset=utf-8`, - }, - body: bucketCollisionMsg, - }, - collector: histogram, - externalMF: []*dto.MetricFamily{ - externalMetricFamilyWithBucketSuffix, - }, - }, - { // 20 - headers: map[string]string{ - "Accept": "text/plain", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; charset=utf-8`, - }, - body: summaryCountCollisionMsg, - }, - collector: summary, - externalMF: []*dto.MetricFamily{ - externalMetricFamilyWithCountSuffix, - }, - }, - { // 21 - headers: map[string]string{ - "Accept": "text/plain", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; version=0.0.4; charset=utf-8`, - }, - body: bytes.Join( - [][]byte{ - summaryAsText, - externalMetricFamilyWithBucketSuffixAsText, - }, - []byte{}, - ), - }, - collector: summary, - externalMF: []*dto.MetricFamily{ - externalMetricFamilyWithBucketSuffix, - }, - }, - { // 22 - headers: map[string]string{ - "Accept": "text/plain", - }, - out: output{ - headers: map[string]string{ - "Content-Type": `text/plain; charset=utf-8`, - }, - body: duplicateLabelMsg, - }, - externalMF: []*dto.MetricFamily{ - externalMetricFamilyWithDuplicateLabel, - }, - }, - } - for i, scenario := range scenarios { - registry := prometheus.NewPedanticRegistry() - gatherer := prometheus.Gatherer(registry) - if scenario.externalMF != nil { - gatherer = prometheus.Gatherers{ - registry, - prometheus.GathererFunc(func() ([]*dto.MetricFamily, error) { - return scenario.externalMF, nil - }), - } - } - - if scenario.collector != nil { - registry.MustRegister(scenario.collector) - } - writer := httptest.NewRecorder() - handler := prometheus.InstrumentHandler("prometheus", promhttp.HandlerFor(gatherer, promhttp.HandlerOpts{})) - request, _ := http.NewRequest("GET", "/", nil) - for key, value := range scenario.headers { - request.Header.Add(key, value) - } - handler(writer, request) - - for key, value := range scenario.out.headers { - if writer.Header().Get(key) != value { - t.Errorf( - "%d. expected %q for header %q, got %q", - i, value, key, writer.Header().Get(key), - ) - } - } - - if !bytes.Equal(scenario.out.body, writer.Body.Bytes()) { - t.Errorf( - "%d. expected body:\n%s\ngot body:\n%s\n", - i, scenario.out.body, writer.Body.Bytes(), - ) - } - } -} - -func TestHandler(t *testing.T) { - testHandler(t) -} - -func BenchmarkHandler(b *testing.B) { - for i := 0; i < b.N; i++ { - testHandler(b) - } -} - -func TestAlreadyRegistered(t *testing.T) { - reg := prometheus.NewRegistry() - original := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "test", - Help: "help", - }, - []string{"foo", "bar"}, - ) - equalButNotSame := prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "test", - Help: "help", - }, - []string{"foo", "bar"}, - ) - var err error - if err = reg.Register(original); err != nil { - t.Fatal(err) - } - if err = reg.Register(equalButNotSame); err == nil { - t.Fatal("expected error when registering equal collector") - } - if are, ok := err.(prometheus.AlreadyRegisteredError); ok { - if are.ExistingCollector != original { - t.Error("expected original collector but got something else") - } - if are.ExistingCollector == equalButNotSame { - t.Error("expected original callector but got new one") - } - } else { - t.Error("unexpected error:", err) - } -} - -// TestHistogramVecRegisterGatherConcurrency is an end-to-end test that -// concurrently calls Observe on random elements of a HistogramVec while the -// same HistogramVec is registered concurrently and the Gather method of the -// registry is called concurrently. -func TestHistogramVecRegisterGatherConcurrency(t *testing.T) { - var ( - reg = prometheus.NewPedanticRegistry() - hv = prometheus.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "test_histogram", - Help: "This helps testing.", - ConstLabels: prometheus.Labels{"foo": "bar"}, - }, - []string{"one", "two", "three"}, - ) - labelValues = []string{"a", "b", "c", "alpha", "beta", "gamma", "aleph", "beth", "gimel"} - quit = make(chan struct{}) - wg sync.WaitGroup - ) - - observe := func() { - defer wg.Done() - for { - select { - case <-quit: - return - default: - obs := rand.NormFloat64()*.1 + .2 - hv.WithLabelValues( - labelValues[rand.Intn(len(labelValues))], - labelValues[rand.Intn(len(labelValues))], - labelValues[rand.Intn(len(labelValues))], - ).Observe(obs) - } - } - } - - register := func() { - defer wg.Done() - for { - select { - case <-quit: - return - default: - if err := reg.Register(hv); err != nil { - if _, ok := err.(prometheus.AlreadyRegisteredError); !ok { - t.Error("Registering failed:", err) - } - } - time.Sleep(7 * time.Millisecond) - } - } - } - - gather := func() { - defer wg.Done() - for { - select { - case <-quit: - return - default: - if g, err := reg.Gather(); err != nil { - t.Error("Gathering failed:", err) - } else { - if len(g) == 0 { - continue - } - if len(g) != 1 { - t.Error("Gathered unexpected number of metric families:", len(g)) - } - if len(g[0].Metric[0].Label) != 4 { - t.Error("Gathered unexpected number of label pairs:", len(g[0].Metric[0].Label)) - } - } - time.Sleep(4 * time.Millisecond) - } - } - } - - wg.Add(10) - go observe() - go observe() - go register() - go observe() - go gather() - go observe() - go register() - go observe() - go gather() - go observe() - - time.Sleep(time.Second) - close(quit) - wg.Wait() -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/vendor/github.com/prometheus/client_golang/prometheus/summary.go deleted file mode 100644 index f7e92d829..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/summary.go +++ /dev/null @@ -1,626 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "fmt" - "math" - "sort" - "sync" - "time" - - "github.com/beorn7/perks/quantile" - "github.com/golang/protobuf/proto" - - dto "github.com/prometheus/client_model/go" -) - -// quantileLabel is used for the label that defines the quantile in a -// summary. -const quantileLabel = "quantile" - -// A Summary captures individual observations from an event or sample stream and -// summarizes them in a manner similar to traditional summary statistics: 1. sum -// of observations, 2. observation count, 3. rank estimations. -// -// A typical use-case is the observation of request latencies. By default, a -// Summary provides the median, the 90th and the 99th percentile of the latency -// as rank estimations. However, the default behavior will change in the -// upcoming v0.10 of the library. There will be no rank estimations at all by -// default. For a sane transition, it is recommended to set the desired rank -// estimations explicitly. -// -// Note that the rank estimations cannot be aggregated in a meaningful way with -// the Prometheus query language (i.e. you cannot average or add them). If you -// need aggregatable quantiles (e.g. you want the 99th percentile latency of all -// queries served across all instances of a service), consider the Histogram -// metric type. See the Prometheus documentation for more details. -// -// To create Summary instances, use NewSummary. -type Summary interface { - Metric - Collector - - // Observe adds a single observation to the summary. - Observe(float64) -} - -// DefObjectives are the default Summary quantile values. -// -// Deprecated: DefObjectives will not be used as the default objectives in -// v0.10 of the library. The default Summary will have no quantiles then. -var ( - DefObjectives = map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001} - - errQuantileLabelNotAllowed = fmt.Errorf( - "%q is not allowed as label name in summaries", quantileLabel, - ) -) - -// Default values for SummaryOpts. -const ( - // DefMaxAge is the default duration for which observations stay - // relevant. - DefMaxAge time.Duration = 10 * time.Minute - // DefAgeBuckets is the default number of buckets used to calculate the - // age of observations. - DefAgeBuckets = 5 - // DefBufCap is the standard buffer size for collecting Summary observations. - DefBufCap = 500 -) - -// SummaryOpts bundles the options for creating a Summary metric. It is -// mandatory to set Name to a non-empty string. While all other fields are -// optional and can safely be left at their zero value, it is recommended to set -// a help string and to explicitly set the Objectives field to the desired value -// as the default value will change in the upcoming v0.10 of the library. -type SummaryOpts struct { - // Namespace, Subsystem, and Name are components of the fully-qualified - // name of the Summary (created by joining these components with - // "_"). Only Name is mandatory, the others merely help structuring the - // name. Note that the fully-qualified name of the Summary must be a - // valid Prometheus metric name. - Namespace string - Subsystem string - Name string - - // Help provides information about this Summary. - // - // Metrics with the same fully-qualified name must have the same Help - // string. - Help string - - // ConstLabels are used to attach fixed labels to this metric. Metrics - // with the same fully-qualified name must have the same label names in - // their ConstLabels. - // - // Due to the way a Summary is represented in the Prometheus text format - // and how it is handled by the Prometheus server internally, “quantile” - // is an illegal label name. Construction of a Summary or SummaryVec - // will panic if this label name is used in ConstLabels. - // - // ConstLabels are only used rarely. In particular, do not use them to - // attach the same labels to all your metrics. Those use cases are - // better covered by target labels set by the scraping Prometheus - // server, or by one specific metric (e.g. a build_info or a - // machine_role metric). See also - // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels,-not-static-scraped-labels - ConstLabels Labels - - // Objectives defines the quantile rank estimates with their respective - // absolute error. If Objectives[q] = e, then the value reported for q - // will be the φ-quantile value for some φ between q-e and q+e. The - // default value is DefObjectives. It is used if Objectives is left at - // its zero value (i.e. nil). To create a Summary without Objectives, - // set it to an empty map (i.e. map[float64]float64{}). - // - // Deprecated: Note that the current value of DefObjectives is - // deprecated. It will be replaced by an empty map in v0.10 of the - // library. Please explicitly set Objectives to the desired value. - Objectives map[float64]float64 - - // MaxAge defines the duration for which an observation stays relevant - // for the summary. Must be positive. The default value is DefMaxAge. - MaxAge time.Duration - - // AgeBuckets is the number of buckets used to exclude observations that - // are older than MaxAge from the summary. A higher number has a - // resource penalty, so only increase it if the higher resolution is - // really required. For very high observation rates, you might want to - // reduce the number of age buckets. With only one age bucket, you will - // effectively see a complete reset of the summary each time MaxAge has - // passed. The default value is DefAgeBuckets. - AgeBuckets uint32 - - // BufCap defines the default sample stream buffer size. The default - // value of DefBufCap should suffice for most uses. If there is a need - // to increase the value, a multiple of 500 is recommended (because that - // is the internal buffer size of the underlying package - // "github.com/bmizerany/perks/quantile"). - BufCap uint32 -} - -// Great fuck-up with the sliding-window decay algorithm... The Merge method of -// perk/quantile is actually not working as advertised - and it might be -// unfixable, as the underlying algorithm is apparently not capable of merging -// summaries in the first place. To avoid using Merge, we are currently adding -// observations to _each_ age bucket, i.e. the effort to add a sample is -// essentially multiplied by the number of age buckets. When rotating age -// buckets, we empty the previous head stream. On scrape time, we simply take -// the quantiles from the head stream (no merging required). Result: More effort -// on observation time, less effort on scrape time, which is exactly the -// opposite of what we try to accomplish, but at least the results are correct. -// -// The quite elegant previous contraption to merge the age buckets efficiently -// on scrape time (see code up commit 6b9530d72ea715f0ba612c0120e6e09fbf1d49d0) -// can't be used anymore. - -// NewSummary creates a new Summary based on the provided SummaryOpts. -func NewSummary(opts SummaryOpts) Summary { - return newSummary( - NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - nil, - opts.ConstLabels, - ), - opts, - ) -} - -func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary { - if len(desc.variableLabels) != len(labelValues) { - panic(errInconsistentCardinality) - } - - for _, n := range desc.variableLabels { - if n == quantileLabel { - panic(errQuantileLabelNotAllowed) - } - } - for _, lp := range desc.constLabelPairs { - if lp.GetName() == quantileLabel { - panic(errQuantileLabelNotAllowed) - } - } - - if opts.Objectives == nil { - opts.Objectives = DefObjectives - } - - if opts.MaxAge < 0 { - panic(fmt.Errorf("illegal max age MaxAge=%v", opts.MaxAge)) - } - if opts.MaxAge == 0 { - opts.MaxAge = DefMaxAge - } - - if opts.AgeBuckets == 0 { - opts.AgeBuckets = DefAgeBuckets - } - - if opts.BufCap == 0 { - opts.BufCap = DefBufCap - } - - s := &summary{ - desc: desc, - - objectives: opts.Objectives, - sortedObjectives: make([]float64, 0, len(opts.Objectives)), - - labelPairs: makeLabelPairs(desc, labelValues), - - hotBuf: make([]float64, 0, opts.BufCap), - coldBuf: make([]float64, 0, opts.BufCap), - streamDuration: opts.MaxAge / time.Duration(opts.AgeBuckets), - } - s.headStreamExpTime = time.Now().Add(s.streamDuration) - s.hotBufExpTime = s.headStreamExpTime - - for i := uint32(0); i < opts.AgeBuckets; i++ { - s.streams = append(s.streams, s.newStream()) - } - s.headStream = s.streams[0] - - for qu := range s.objectives { - s.sortedObjectives = append(s.sortedObjectives, qu) - } - sort.Float64s(s.sortedObjectives) - - s.init(s) // Init self-collection. - return s -} - -type summary struct { - selfCollector - - bufMtx sync.Mutex // Protects hotBuf and hotBufExpTime. - mtx sync.Mutex // Protects every other moving part. - // Lock bufMtx before mtx if both are needed. - - desc *Desc - - objectives map[float64]float64 - sortedObjectives []float64 - - labelPairs []*dto.LabelPair - - sum float64 - cnt uint64 - - hotBuf, coldBuf []float64 - - streams []*quantile.Stream - streamDuration time.Duration - headStream *quantile.Stream - headStreamIdx int - headStreamExpTime, hotBufExpTime time.Time -} - -func (s *summary) Desc() *Desc { - return s.desc -} - -func (s *summary) Observe(v float64) { - s.bufMtx.Lock() - defer s.bufMtx.Unlock() - - now := time.Now() - if now.After(s.hotBufExpTime) { - s.asyncFlush(now) - } - s.hotBuf = append(s.hotBuf, v) - if len(s.hotBuf) == cap(s.hotBuf) { - s.asyncFlush(now) - } -} - -func (s *summary) Write(out *dto.Metric) error { - sum := &dto.Summary{} - qs := make([]*dto.Quantile, 0, len(s.objectives)) - - s.bufMtx.Lock() - s.mtx.Lock() - // Swap bufs even if hotBuf is empty to set new hotBufExpTime. - s.swapBufs(time.Now()) - s.bufMtx.Unlock() - - s.flushColdBuf() - sum.SampleCount = proto.Uint64(s.cnt) - sum.SampleSum = proto.Float64(s.sum) - - for _, rank := range s.sortedObjectives { - var q float64 - if s.headStream.Count() == 0 { - q = math.NaN() - } else { - q = s.headStream.Query(rank) - } - qs = append(qs, &dto.Quantile{ - Quantile: proto.Float64(rank), - Value: proto.Float64(q), - }) - } - - s.mtx.Unlock() - - if len(qs) > 0 { - sort.Sort(quantSort(qs)) - } - sum.Quantile = qs - - out.Summary = sum - out.Label = s.labelPairs - return nil -} - -func (s *summary) newStream() *quantile.Stream { - return quantile.NewTargeted(s.objectives) -} - -// asyncFlush needs bufMtx locked. -func (s *summary) asyncFlush(now time.Time) { - s.mtx.Lock() - s.swapBufs(now) - - // Unblock the original goroutine that was responsible for the mutation - // that triggered the compaction. But hold onto the global non-buffer - // state mutex until the operation finishes. - go func() { - s.flushColdBuf() - s.mtx.Unlock() - }() -} - -// rotateStreams needs mtx AND bufMtx locked. -func (s *summary) maybeRotateStreams() { - for !s.hotBufExpTime.Equal(s.headStreamExpTime) { - s.headStream.Reset() - s.headStreamIdx++ - if s.headStreamIdx >= len(s.streams) { - s.headStreamIdx = 0 - } - s.headStream = s.streams[s.headStreamIdx] - s.headStreamExpTime = s.headStreamExpTime.Add(s.streamDuration) - } -} - -// flushColdBuf needs mtx locked. -func (s *summary) flushColdBuf() { - for _, v := range s.coldBuf { - for _, stream := range s.streams { - stream.Insert(v) - } - s.cnt++ - s.sum += v - } - s.coldBuf = s.coldBuf[0:0] - s.maybeRotateStreams() -} - -// swapBufs needs mtx AND bufMtx locked, coldBuf must be empty. -func (s *summary) swapBufs(now time.Time) { - if len(s.coldBuf) != 0 { - panic("coldBuf is not empty") - } - s.hotBuf, s.coldBuf = s.coldBuf, s.hotBuf - // hotBuf is now empty and gets new expiration set. - for now.After(s.hotBufExpTime) { - s.hotBufExpTime = s.hotBufExpTime.Add(s.streamDuration) - } -} - -type quantSort []*dto.Quantile - -func (s quantSort) Len() int { - return len(s) -} - -func (s quantSort) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s quantSort) Less(i, j int) bool { - return s[i].GetQuantile() < s[j].GetQuantile() -} - -// SummaryVec is a Collector that bundles a set of Summaries that all share the -// same Desc, but have different values for their variable labels. This is used -// if you want to count the same thing partitioned by various dimensions -// (e.g. HTTP request latencies, partitioned by status code and method). Create -// instances with NewSummaryVec. -type SummaryVec struct { - *metricVec -} - -// NewSummaryVec creates a new SummaryVec based on the provided SummaryOpts and -// partitioned by the given label names. -// -// Due to the way a Summary is represented in the Prometheus text format and how -// it is handled by the Prometheus server internally, “quantile” is an illegal -// label name. NewSummaryVec will panic if this label name is used. -func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec { - for _, ln := range labelNames { - if ln == quantileLabel { - panic(errQuantileLabelNotAllowed) - } - } - desc := NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - labelNames, - opts.ConstLabels, - ) - return &SummaryVec{ - metricVec: newMetricVec(desc, func(lvs ...string) Metric { - return newSummary(desc, opts, lvs...) - }), - } -} - -// GetMetricWithLabelValues returns the Summary for the given slice of label -// values (same order as the VariableLabels in Desc). If that combination of -// label values is accessed for the first time, a new Summary is created. -// -// It is possible to call this method without using the returned Summary to only -// create the new Summary but leave it at its starting value, a Summary without -// any observations. -// -// Keeping the Summary for later use is possible (and should be considered if -// performance is critical), but keep in mind that Reset, DeleteLabelValues and -// Delete can be used to delete the Summary from the SummaryVec. In that case, -// the Summary will still exist, but it will not be exported anymore, even if a -// Summary with the same label values is created later. See also the CounterVec -// example. -// -// An error is returned if the number of label values is not the same as the -// number of VariableLabels in Desc (minus any curried labels). -// -// Note that for more than one label value, this method is prone to mistakes -// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as -// an alternative to avoid that type of mistake. For higher label numbers, the -// latter has a much more readable (albeit more verbose) syntax, but it comes -// with a performance overhead (for creating and processing the Labels map). -// See also the GaugeVec example. -func (v *SummaryVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { - metric, err := v.metricVec.getMetricWithLabelValues(lvs...) - if metric != nil { - return metric.(Observer), err - } - return nil, err -} - -// GetMetricWith returns the Summary for the given Labels map (the label names -// must match those of the VariableLabels in Desc). If that label map is -// accessed for the first time, a new Summary is created. Implications of -// creating a Summary without using it and keeping the Summary for later use are -// the same as for GetMetricWithLabelValues. -// -// An error is returned if the number and names of the Labels are inconsistent -// with those of the VariableLabels in Desc (minus any curried labels). -// -// This method is used for the same purpose as -// GetMetricWithLabelValues(...string). See there for pros and cons of the two -// methods. -func (v *SummaryVec) GetMetricWith(labels Labels) (Observer, error) { - metric, err := v.metricVec.getMetricWith(labels) - if metric != nil { - return metric.(Observer), err - } - return nil, err -} - -// WithLabelValues works as GetMetricWithLabelValues, but panics where -// GetMetricWithLabelValues would have returned an error. Not returning an -// error allows shortcuts like -// myVec.WithLabelValues("404", "GET").Observe(42.21) -func (v *SummaryVec) WithLabelValues(lvs ...string) Observer { - s, err := v.GetMetricWithLabelValues(lvs...) - if err != nil { - panic(err) - } - return s -} - -// With works as GetMetricWith, but panics where GetMetricWithLabels would have -// returned an error. Not returning an error allows shortcuts like -// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21) -func (v *SummaryVec) With(labels Labels) Observer { - s, err := v.GetMetricWith(labels) - if err != nil { - panic(err) - } - return s -} - -// CurryWith returns a vector curried with the provided labels, i.e. the -// returned vector has those labels pre-set for all labeled operations performed -// on it. The cardinality of the curried vector is reduced accordingly. The -// order of the remaining labels stays the same (just with the curried labels -// taken out of the sequence – which is relevant for the -// (GetMetric)WithLabelValues methods). It is possible to curry a curried -// vector, but only with labels not yet used for currying before. -// -// The metrics contained in the SummaryVec are shared between the curried and -// uncurried vectors. They are just accessed differently. Curried and uncurried -// vectors behave identically in terms of collection. Only one must be -// registered with a given registry (usually the uncurried version). The Reset -// method deletes all metrics, even if called on a curried vector. -func (v *SummaryVec) CurryWith(labels Labels) (ObserverVec, error) { - vec, err := v.curryWith(labels) - if vec != nil { - return &SummaryVec{vec}, err - } - return nil, err -} - -// MustCurryWith works as CurryWith but panics where CurryWith would have -// returned an error. -func (v *SummaryVec) MustCurryWith(labels Labels) ObserverVec { - vec, err := v.CurryWith(labels) - if err != nil { - panic(err) - } - return vec -} - -type constSummary struct { - desc *Desc - count uint64 - sum float64 - quantiles map[float64]float64 - labelPairs []*dto.LabelPair -} - -func (s *constSummary) Desc() *Desc { - return s.desc -} - -func (s *constSummary) Write(out *dto.Metric) error { - sum := &dto.Summary{} - qs := make([]*dto.Quantile, 0, len(s.quantiles)) - - sum.SampleCount = proto.Uint64(s.count) - sum.SampleSum = proto.Float64(s.sum) - - for rank, q := range s.quantiles { - qs = append(qs, &dto.Quantile{ - Quantile: proto.Float64(rank), - Value: proto.Float64(q), - }) - } - - if len(qs) > 0 { - sort.Sort(quantSort(qs)) - } - sum.Quantile = qs - - out.Summary = sum - out.Label = s.labelPairs - - return nil -} - -// NewConstSummary returns a metric representing a Prometheus summary with fixed -// values for the count, sum, and quantiles. As those parameters cannot be -// changed, the returned value does not implement the Summary interface (but -// only the Metric interface). Users of this package will not have much use for -// it in regular operations. However, when implementing custom Collectors, it is -// useful as a throw-away metric that is generated on the fly to send it to -// Prometheus in the Collect method. -// -// quantiles maps ranks to quantile values. For example, a median latency of -// 0.23s and a 99th percentile latency of 0.56s would be expressed as: -// map[float64]float64{0.5: 0.23, 0.99: 0.56} -// -// NewConstSummary returns an error if the length of labelValues is not -// consistent with the variable labels in Desc or if Desc is invalid. -func NewConstSummary( - desc *Desc, - count uint64, - sum float64, - quantiles map[float64]float64, - labelValues ...string, -) (Metric, error) { - if desc.err != nil { - return nil, desc.err - } - if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil { - return nil, err - } - return &constSummary{ - desc: desc, - count: count, - sum: sum, - quantiles: quantiles, - labelPairs: makeLabelPairs(desc, labelValues), - }, nil -} - -// MustNewConstSummary is a version of NewConstSummary that panics where -// NewConstMetric would have returned an error. -func MustNewConstSummary( - desc *Desc, - count uint64, - sum float64, - quantiles map[float64]float64, - labelValues ...string, -) Metric { - m, err := NewConstSummary(desc, count, sum, quantiles, labelValues...) - if err != nil { - panic(err) - } - return m -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary_test.go b/vendor/github.com/prometheus/client_golang/prometheus/summary_test.go deleted file mode 100644 index 8b1a62eee..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/summary_test.go +++ /dev/null @@ -1,413 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "math" - "math/rand" - "sort" - "sync" - "testing" - "testing/quick" - "time" - - dto "github.com/prometheus/client_model/go" -) - -func TestSummaryWithDefaultObjectives(t *testing.T) { - reg := NewRegistry() - summaryWithDefaultObjectives := NewSummary(SummaryOpts{ - Name: "default_objectives", - Help: "Test help.", - }) - if err := reg.Register(summaryWithDefaultObjectives); err != nil { - t.Error(err) - } - - m := &dto.Metric{} - if err := summaryWithDefaultObjectives.Write(m); err != nil { - t.Error(err) - } - if len(m.GetSummary().Quantile) != len(DefObjectives) { - t.Error("expected default objectives in summary") - } -} - -func TestSummaryWithoutObjectives(t *testing.T) { - reg := NewRegistry() - summaryWithEmptyObjectives := NewSummary(SummaryOpts{ - Name: "empty_objectives", - Help: "Test help.", - Objectives: map[float64]float64{}, - }) - if err := reg.Register(summaryWithEmptyObjectives); err != nil { - t.Error(err) - } - - m := &dto.Metric{} - if err := summaryWithEmptyObjectives.Write(m); err != nil { - t.Error(err) - } - if len(m.GetSummary().Quantile) != 0 { - t.Error("expected no objectives in summary") - } -} - -func TestSummaryWithQuantileLabel(t *testing.T) { - defer func() { - if r := recover(); r == nil { - t.Error("Attempt to create Summary with 'quantile' label did not panic.") - } - }() - _ = NewSummary(SummaryOpts{ - Name: "test_summary", - Help: "less", - ConstLabels: Labels{"quantile": "test"}, - }) -} - -func TestSummaryVecWithQuantileLabel(t *testing.T) { - defer func() { - if r := recover(); r == nil { - t.Error("Attempt to create SummaryVec with 'quantile' label did not panic.") - } - }() - _ = NewSummaryVec(SummaryOpts{ - Name: "test_summary", - Help: "less", - }, []string{"quantile"}) -} - -func benchmarkSummaryObserve(w int, b *testing.B) { - b.StopTimer() - - wg := new(sync.WaitGroup) - wg.Add(w) - - g := new(sync.WaitGroup) - g.Add(1) - - s := NewSummary(SummaryOpts{}) - - for i := 0; i < w; i++ { - go func() { - g.Wait() - - for i := 0; i < b.N; i++ { - s.Observe(float64(i)) - } - - wg.Done() - }() - } - - b.StartTimer() - g.Done() - wg.Wait() -} - -func BenchmarkSummaryObserve1(b *testing.B) { - benchmarkSummaryObserve(1, b) -} - -func BenchmarkSummaryObserve2(b *testing.B) { - benchmarkSummaryObserve(2, b) -} - -func BenchmarkSummaryObserve4(b *testing.B) { - benchmarkSummaryObserve(4, b) -} - -func BenchmarkSummaryObserve8(b *testing.B) { - benchmarkSummaryObserve(8, b) -} - -func benchmarkSummaryWrite(w int, b *testing.B) { - b.StopTimer() - - wg := new(sync.WaitGroup) - wg.Add(w) - - g := new(sync.WaitGroup) - g.Add(1) - - s := NewSummary(SummaryOpts{}) - - for i := 0; i < 1000000; i++ { - s.Observe(float64(i)) - } - - for j := 0; j < w; j++ { - outs := make([]dto.Metric, b.N) - - go func(o []dto.Metric) { - g.Wait() - - for i := 0; i < b.N; i++ { - s.Write(&o[i]) - } - - wg.Done() - }(outs) - } - - b.StartTimer() - g.Done() - wg.Wait() -} - -func BenchmarkSummaryWrite1(b *testing.B) { - benchmarkSummaryWrite(1, b) -} - -func BenchmarkSummaryWrite2(b *testing.B) { - benchmarkSummaryWrite(2, b) -} - -func BenchmarkSummaryWrite4(b *testing.B) { - benchmarkSummaryWrite(4, b) -} - -func BenchmarkSummaryWrite8(b *testing.B) { - benchmarkSummaryWrite(8, b) -} - -func TestSummaryConcurrency(t *testing.T) { - if testing.Short() { - t.Skip("Skipping test in short mode.") - } - - rand.Seed(42) - - it := func(n uint32) bool { - mutations := int(n%1e4 + 1e4) - concLevel := int(n%5 + 1) - total := mutations * concLevel - - var start, end sync.WaitGroup - start.Add(1) - end.Add(concLevel) - - sum := NewSummary(SummaryOpts{ - Name: "test_summary", - Help: "helpless", - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }) - - allVars := make([]float64, total) - var sampleSum float64 - for i := 0; i < concLevel; i++ { - vals := make([]float64, mutations) - for j := 0; j < mutations; j++ { - v := rand.NormFloat64() - vals[j] = v - allVars[i*mutations+j] = v - sampleSum += v - } - - go func(vals []float64) { - start.Wait() - for _, v := range vals { - sum.Observe(v) - } - end.Done() - }(vals) - } - sort.Float64s(allVars) - start.Done() - end.Wait() - - m := &dto.Metric{} - sum.Write(m) - if got, want := int(*m.Summary.SampleCount), total; got != want { - t.Errorf("got sample count %d, want %d", got, want) - } - if got, want := *m.Summary.SampleSum, sampleSum; math.Abs((got-want)/want) > 0.001 { - t.Errorf("got sample sum %f, want %f", got, want) - } - - objectives := make([]float64, 0, len(DefObjectives)) - for qu := range DefObjectives { - objectives = append(objectives, qu) - } - sort.Float64s(objectives) - - for i, wantQ := range objectives { - ε := DefObjectives[wantQ] - gotQ := *m.Summary.Quantile[i].Quantile - gotV := *m.Summary.Quantile[i].Value - min, max := getBounds(allVars, wantQ, ε) - if gotQ != wantQ { - t.Errorf("got quantile %f, want %f", gotQ, wantQ) - } - if gotV < min || gotV > max { - t.Errorf("got %f for quantile %f, want [%f,%f]", gotV, gotQ, min, max) - } - } - return true - } - - if err := quick.Check(it, nil); err != nil { - t.Error(err) - } -} - -func TestSummaryVecConcurrency(t *testing.T) { - if testing.Short() { - t.Skip("Skipping test in short mode.") - } - - rand.Seed(42) - - objectives := make([]float64, 0, len(DefObjectives)) - for qu := range DefObjectives { - - objectives = append(objectives, qu) - } - sort.Float64s(objectives) - - it := func(n uint32) bool { - mutations := int(n%1e4 + 1e4) - concLevel := int(n%7 + 1) - vecLength := int(n%3 + 1) - - var start, end sync.WaitGroup - start.Add(1) - end.Add(concLevel) - - sum := NewSummaryVec( - SummaryOpts{ - Name: "test_summary", - Help: "helpless", - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - []string{"label"}, - ) - - allVars := make([][]float64, vecLength) - sampleSums := make([]float64, vecLength) - for i := 0; i < concLevel; i++ { - vals := make([]float64, mutations) - picks := make([]int, mutations) - for j := 0; j < mutations; j++ { - v := rand.NormFloat64() - vals[j] = v - pick := rand.Intn(vecLength) - picks[j] = pick - allVars[pick] = append(allVars[pick], v) - sampleSums[pick] += v - } - - go func(vals []float64) { - start.Wait() - for i, v := range vals { - sum.WithLabelValues(string('A' + picks[i])).Observe(v) - } - end.Done() - }(vals) - } - for _, vars := range allVars { - sort.Float64s(vars) - } - start.Done() - end.Wait() - - for i := 0; i < vecLength; i++ { - m := &dto.Metric{} - s := sum.WithLabelValues(string('A' + i)) - s.(Summary).Write(m) - if got, want := int(*m.Summary.SampleCount), len(allVars[i]); got != want { - t.Errorf("got sample count %d for label %c, want %d", got, 'A'+i, want) - } - if got, want := *m.Summary.SampleSum, sampleSums[i]; math.Abs((got-want)/want) > 0.001 { - t.Errorf("got sample sum %f for label %c, want %f", got, 'A'+i, want) - } - for j, wantQ := range objectives { - ε := DefObjectives[wantQ] - gotQ := *m.Summary.Quantile[j].Quantile - gotV := *m.Summary.Quantile[j].Value - min, max := getBounds(allVars[i], wantQ, ε) - if gotQ != wantQ { - t.Errorf("got quantile %f for label %c, want %f", gotQ, 'A'+i, wantQ) - } - if gotV < min || gotV > max { - t.Errorf("got %f for quantile %f for label %c, want [%f,%f]", gotV, gotQ, 'A'+i, min, max) - } - } - } - return true - } - - if err := quick.Check(it, nil); err != nil { - t.Error(err) - } -} - -func TestSummaryDecay(t *testing.T) { - if testing.Short() { - t.Skip("Skipping test in short mode.") - // More because it depends on timing than because it is particularly long... - } - - sum := NewSummary(SummaryOpts{ - Name: "test_summary", - Help: "helpless", - MaxAge: 100 * time.Millisecond, - Objectives: map[float64]float64{0.1: 0.001}, - AgeBuckets: 10, - }) - - m := &dto.Metric{} - i := 0 - tick := time.NewTicker(time.Millisecond) - for range tick.C { - i++ - sum.Observe(float64(i)) - if i%10 == 0 { - sum.Write(m) - if got, want := *m.Summary.Quantile[0].Value, math.Max(float64(i)/10, float64(i-90)); math.Abs(got-want) > 20 { - t.Errorf("%d. got %f, want %f", i, got, want) - } - m.Reset() - } - if i >= 1000 { - break - } - } - tick.Stop() - // Wait for MaxAge without observations and make sure quantiles are NaN. - time.Sleep(100 * time.Millisecond) - sum.Write(m) - if got := *m.Summary.Quantile[0].Value; !math.IsNaN(got) { - t.Errorf("got %f, want NaN after expiration", got) - } -} - -func getBounds(vars []float64, q, ε float64) (min, max float64) { - // TODO(beorn7): This currently tolerates an error of up to 2*ε. The - // error must be at most ε, but for some reason, it's sometimes slightly - // higher. That's a bug. - n := float64(len(vars)) - lower := int((q - 2*ε) * n) - upper := int(math.Ceil((q + 2*ε) * n)) - min = vars[0] - if lower > 1 { - min = vars[lower-1] - } - max = vars[len(vars)-1] - if upper < len(vars) { - max = vars[upper-1] - } - return -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil.go b/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil.go deleted file mode 100644 index d148af9b8..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2018 The Prometheus 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 testutil provides helpers to test code using the prometheus package -// of client_golang. -// -// While writing unit tests to verify correct instrumentation of your code, it's -// a common mistake to mostly test the instrumentation library instead of your -// own code. Rather than verifying that a prometheus.Counter's value has changed -// as expected or that it shows up in the exposition after registration, it is -// in general more robust and more faithful to the concept of unit tests to use -// mock implementations of the prometheus.Counter and prometheus.Registerer -// interfaces that simply assert that the Add or Register methods have been -// called with the expected arguments. However, this might be overkill in simple -// scenarios. The ToFloat64 function is provided for simple inspection of a -// single-value metric, but it has to be used with caution. -// -// End-to-end tests to verify all or larger parts of the metrics exposition can -// be implemented with the CollectAndCompare or GatherAndCompare functions. The -// most appropriate use is not so much testing instrumentation of your code, but -// testing custom prometheus.Collector implementations and in particular whole -// exporters, i.e. programs that retrieve telemetry data from a 3rd party source -// and convert it into Prometheus metrics. -package testutil - -import ( - "bytes" - "fmt" - "io" - "reflect" - - "github.com/prometheus/common/expfmt" - - dto "github.com/prometheus/client_model/go" - - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/internal" -) - -// ToFloat64 collects all Metrics from the provided Collector. It expects that -// this results in exactly one Metric being collected, which must be a Gauge, -// Counter, or Untyped. In all other cases, ToFloat64 panics. ToFloat64 returns -// the value of the collected Metric. -// -// The Collector provided is typically a simple instance of Gauge or Counter, or -// – less commonly – a GaugeVec or CounterVec with exactly one element. But any -// Collector fulfilling the prerequisites described above will do. -// -// Use this function with caution. It is computationally very expensive and thus -// not suited at all to read values from Metrics in regular code. This is really -// only for testing purposes, and even for testing, other approaches are often -// more appropriate (see this package's documentation). -// -// A clear anti-pattern would be to use a metric type from the prometheus -// package to track values that are also needed for something else than the -// exposition of Prometheus metrics. For example, you would like to track the -// number of items in a queue because your code should reject queuing further -// items if a certain limit is reached. It is tempting to track the number of -// items in a prometheus.Gauge, as it is then easily available as a metric for -// exposition, too. However, then you would need to call ToFloat64 in your -// regular code, potentially quite often. The recommended way is to track the -// number of items conventionally (in the way you would have done it without -// considering Prometheus metrics) and then expose the number with a -// prometheus.GaugeFunc. -func ToFloat64(c prometheus.Collector) float64 { - var ( - m prometheus.Metric - mCount int - mChan = make(chan prometheus.Metric) - done = make(chan struct{}) - ) - - go func() { - for m = range mChan { - mCount++ - } - close(done) - }() - - c.Collect(mChan) - close(mChan) - <-done - - if mCount != 1 { - panic(fmt.Errorf("collected %d metrics instead of exactly 1", mCount)) - } - - pb := &dto.Metric{} - m.Write(pb) - if pb.Gauge != nil { - return pb.Gauge.GetValue() - } - if pb.Counter != nil { - return pb.Counter.GetValue() - } - if pb.Untyped != nil { - return pb.Untyped.GetValue() - } - panic(fmt.Errorf("collected a non-gauge/counter/untyped metric: %s", pb)) -} - -// CollectAndCompare registers the provided Collector with a newly created -// pedantic Registry. It then does the same as GatherAndCompare, gathering the -// metrics from the pedantic Registry. -func CollectAndCompare(c prometheus.Collector, expected io.Reader, metricNames ...string) error { - reg := prometheus.NewPedanticRegistry() - if err := reg.Register(c); err != nil { - return fmt.Errorf("registering collector failed: %s", err) - } - return GatherAndCompare(reg, expected, metricNames...) -} - -// GatherAndCompare gathers all metrics from the provided Gatherer and compares -// it to an expected output read from the provided Reader in the Prometheus text -// exposition format. If any metricNames are provided, only metrics with those -// names are compared. -func GatherAndCompare(g prometheus.Gatherer, expected io.Reader, metricNames ...string) error { - metrics, err := g.Gather() - if err != nil { - return fmt.Errorf("gathering metrics failed: %s", err) - } - if metricNames != nil { - metrics = filterMetrics(metrics, metricNames) - } - var tp expfmt.TextParser - expectedMetrics, err := tp.TextToMetricFamilies(expected) - if err != nil { - return fmt.Errorf("parsing expected metrics failed: %s", err) - } - - if !reflect.DeepEqual(metrics, internal.NormalizeMetricFamilies(expectedMetrics)) { - // Encode the gathered output to the readable text format for comparison. - var buf1 bytes.Buffer - enc := expfmt.NewEncoder(&buf1, expfmt.FmtText) - for _, mf := range metrics { - if err := enc.Encode(mf); err != nil { - return fmt.Errorf("encoding result failed: %s", err) - } - } - // Encode normalized expected metrics again to generate them in the same ordering - // the registry does to spot differences more easily. - var buf2 bytes.Buffer - enc = expfmt.NewEncoder(&buf2, expfmt.FmtText) - for _, mf := range internal.NormalizeMetricFamilies(expectedMetrics) { - if err := enc.Encode(mf); err != nil { - return fmt.Errorf("encoding result failed: %s", err) - } - } - - return fmt.Errorf(` -metric output does not match expectation; want: - -%s - -got: - -%s -`, buf2.String(), buf1.String()) - } - return nil -} - -func filterMetrics(metrics []*dto.MetricFamily, names []string) []*dto.MetricFamily { - var filtered []*dto.MetricFamily - for _, m := range metrics { - for _, name := range names { - if m.GetName() == name { - filtered = append(filtered, m) - break - } - } - } - return filtered -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil_test.go b/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil_test.go deleted file mode 100644 index e25b1306f..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/testutil/testutil_test.go +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright 2018 The Prometheus 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 testutil - -import ( - "strings" - "testing" - - "github.com/prometheus/client_golang/prometheus" -) - -type untypedCollector struct{} - -func (u untypedCollector) Describe(c chan<- *prometheus.Desc) { - c <- prometheus.NewDesc("name", "help", nil, nil) -} - -func (u untypedCollector) Collect(c chan<- prometheus.Metric) { - c <- prometheus.MustNewConstMetric( - prometheus.NewDesc("name", "help", nil, nil), - prometheus.UntypedValue, - 2001, - ) -} - -func TestToFloat64(t *testing.T) { - gaugeWithAValueSet := prometheus.NewGauge(prometheus.GaugeOpts{}) - gaugeWithAValueSet.Set(3.14) - - counterVecWithOneElement := prometheus.NewCounterVec(prometheus.CounterOpts{}, []string{"foo"}) - counterVecWithOneElement.WithLabelValues("bar").Inc() - - counterVecWithTwoElements := prometheus.NewCounterVec(prometheus.CounterOpts{}, []string{"foo"}) - counterVecWithTwoElements.WithLabelValues("bar").Add(42) - counterVecWithTwoElements.WithLabelValues("baz").Inc() - - histogramVecWithOneElement := prometheus.NewHistogramVec(prometheus.HistogramOpts{}, []string{"foo"}) - histogramVecWithOneElement.WithLabelValues("bar").Observe(2.7) - - scenarios := map[string]struct { - collector prometheus.Collector - panics bool - want float64 - }{ - "simple counter": { - collector: prometheus.NewCounter(prometheus.CounterOpts{}), - panics: false, - want: 0, - }, - "simple gauge": { - collector: prometheus.NewGauge(prometheus.GaugeOpts{}), - panics: false, - want: 0, - }, - "simple untyped": { - collector: untypedCollector{}, - panics: false, - want: 2001, - }, - "simple histogram": { - collector: prometheus.NewHistogram(prometheus.HistogramOpts{}), - panics: true, - }, - "simple summary": { - collector: prometheus.NewSummary(prometheus.SummaryOpts{}), - panics: true, - }, - "simple gauge with an actual value set": { - collector: gaugeWithAValueSet, - panics: false, - want: 3.14, - }, - "counter vec with zero elements": { - collector: prometheus.NewCounterVec(prometheus.CounterOpts{}, nil), - panics: true, - }, - "counter vec with one element": { - collector: counterVecWithOneElement, - panics: false, - want: 1, - }, - "counter vec with two elements": { - collector: counterVecWithTwoElements, - panics: true, - }, - "histogram vec with one element": { - collector: histogramVecWithOneElement, - panics: true, - }, - } - - for n, s := range scenarios { - t.Run(n, func(t *testing.T) { - defer func() { - r := recover() - if r == nil && s.panics { - t.Error("expected panic") - } else if r != nil && !s.panics { - t.Error("unexpected panic: ", r) - } - // Any other combination is the expected outcome. - }() - if got := ToFloat64(s.collector); got != s.want { - t.Errorf("want %f, got %f", s.want, got) - } - }) - } -} - -func TestCollectAndCompare(t *testing.T) { - const metadata = ` - # HELP some_total A value that represents a counter. - # TYPE some_total counter - ` - - c := prometheus.NewCounter(prometheus.CounterOpts{ - Name: "some_total", - Help: "A value that represents a counter.", - ConstLabels: prometheus.Labels{ - "label1": "value1", - }, - }) - c.Inc() - - expected := ` - - some_total{ label1 = "value1" } 1 - ` - - if err := CollectAndCompare(c, strings.NewReader(metadata+expected), "some_total"); err != nil { - t.Errorf("unexpected collecting result:\n%s", err) - } -} - -func TestNoMetricFilter(t *testing.T) { - const metadata = ` - # HELP some_total A value that represents a counter. - # TYPE some_total counter - ` - - c := prometheus.NewCounter(prometheus.CounterOpts{ - Name: "some_total", - Help: "A value that represents a counter.", - ConstLabels: prometheus.Labels{ - "label1": "value1", - }, - }) - c.Inc() - - expected := ` - some_total{label1="value1"} 1 - ` - - if err := CollectAndCompare(c, strings.NewReader(metadata+expected)); err != nil { - t.Errorf("unexpected collecting result:\n%s", err) - } -} - -func TestMetricNotFound(t *testing.T) { - const metadata = ` - # HELP some_other_metric A value that represents a counter. - # TYPE some_other_metric counter - ` - - c := prometheus.NewCounter(prometheus.CounterOpts{ - Name: "some_total", - Help: "A value that represents a counter.", - ConstLabels: prometheus.Labels{ - "label1": "value1", - }, - }) - c.Inc() - - expected := ` - some_other_metric{label1="value1"} 1 - ` - - expectedError := ` -metric output does not match expectation; want: - -# HELP some_other_metric A value that represents a counter. -# TYPE some_other_metric counter -some_other_metric{label1="value1"} 1 - - -got: - -# HELP some_total A value that represents a counter. -# TYPE some_total counter -some_total{label1="value1"} 1 - -` - - err := CollectAndCompare(c, strings.NewReader(metadata+expected)) - if err == nil { - t.Error("Expected error, got no error.") - } - - if err.Error() != expectedError { - t.Errorf("Expected\n%#+v\nGot:\n%#+v\n", expectedError, err.Error()) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/timer.go b/vendor/github.com/prometheus/client_golang/prometheus/timer.go deleted file mode 100644 index b8fc5f18c..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/timer.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2016 The Prometheus 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 prometheus - -import "time" - -// Timer is a helper type to time functions. Use NewTimer to create new -// instances. -type Timer struct { - begin time.Time - observer Observer -} - -// NewTimer creates a new Timer. The provided Observer is used to observe a -// duration in seconds. Timer is usually used to time a function call in the -// following way: -// func TimeMe() { -// timer := NewTimer(myHistogram) -// defer timer.ObserveDuration() -// // Do actual work. -// } -func NewTimer(o Observer) *Timer { - return &Timer{ - begin: time.Now(), - observer: o, - } -} - -// ObserveDuration records the duration passed since the Timer was created with -// NewTimer. It calls the Observe method of the Observer provided during -// construction with the duration in seconds as an argument. ObserveDuration is -// usually called with a defer statement. -// -// Note that this method is only guaranteed to never observe negative durations -// if used with Go1.9+. -func (t *Timer) ObserveDuration() { - if t.observer != nil { - t.observer.Observe(time.Since(t.begin).Seconds()) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/timer_test.go b/vendor/github.com/prometheus/client_golang/prometheus/timer_test.go deleted file mode 100644 index 294902068..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/timer_test.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2016 The Prometheus 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 prometheus - -import ( - "testing" - - dto "github.com/prometheus/client_model/go" -) - -func TestTimerObserve(t *testing.T) { - var ( - his = NewHistogram(HistogramOpts{Name: "test_histogram"}) - sum = NewSummary(SummaryOpts{Name: "test_summary"}) - gauge = NewGauge(GaugeOpts{Name: "test_gauge"}) - ) - - func() { - hisTimer := NewTimer(his) - sumTimer := NewTimer(sum) - gaugeTimer := NewTimer(ObserverFunc(gauge.Set)) - defer hisTimer.ObserveDuration() - defer sumTimer.ObserveDuration() - defer gaugeTimer.ObserveDuration() - }() - - m := &dto.Metric{} - his.Write(m) - if want, got := uint64(1), m.GetHistogram().GetSampleCount(); want != got { - t.Errorf("want %d observations for histogram, got %d", want, got) - } - m.Reset() - sum.Write(m) - if want, got := uint64(1), m.GetSummary().GetSampleCount(); want != got { - t.Errorf("want %d observations for summary, got %d", want, got) - } - m.Reset() - gauge.Write(m) - if got := m.GetGauge().GetValue(); got <= 0 { - t.Errorf("want value > 0 for gauge, got %f", got) - } -} - -func TestTimerEmpty(t *testing.T) { - emptyTimer := NewTimer(nil) - emptyTimer.ObserveDuration() - // Do nothing, just demonstrate it works without panic. -} - -func TestTimerConditionalTiming(t *testing.T) { - var ( - his = NewHistogram(HistogramOpts{ - Name: "test_histogram", - }) - timeMe = true - m = &dto.Metric{} - ) - - timedFunc := func() { - timer := NewTimer(ObserverFunc(func(v float64) { - if timeMe { - his.Observe(v) - } - })) - defer timer.ObserveDuration() - } - - timedFunc() // This will time. - his.Write(m) - if want, got := uint64(1), m.GetHistogram().GetSampleCount(); want != got { - t.Errorf("want %d observations for histogram, got %d", want, got) - } - - timeMe = false - timedFunc() // This will not time again. - m.Reset() - his.Write(m) - if want, got := uint64(1), m.GetHistogram().GetSampleCount(); want != got { - t.Errorf("want %d observations for histogram, got %d", want, got) - } -} - -func TestTimerByOutcome(t *testing.T) { - var ( - his = NewHistogramVec( - HistogramOpts{Name: "test_histogram"}, - []string{"outcome"}, - ) - outcome = "foo" - m = &dto.Metric{} - ) - - timedFunc := func() { - timer := NewTimer(ObserverFunc(func(v float64) { - his.WithLabelValues(outcome).Observe(v) - })) - defer timer.ObserveDuration() - - if outcome == "foo" { - outcome = "bar" - return - } - outcome = "foo" - } - - timedFunc() - his.WithLabelValues("foo").(Histogram).Write(m) - if want, got := uint64(0), m.GetHistogram().GetSampleCount(); want != got { - t.Errorf("want %d observations for 'foo' histogram, got %d", want, got) - } - m.Reset() - his.WithLabelValues("bar").(Histogram).Write(m) - if want, got := uint64(1), m.GetHistogram().GetSampleCount(); want != got { - t.Errorf("want %d observations for 'bar' histogram, got %d", want, got) - } - - timedFunc() - m.Reset() - his.WithLabelValues("foo").(Histogram).Write(m) - if want, got := uint64(1), m.GetHistogram().GetSampleCount(); want != got { - t.Errorf("want %d observations for 'foo' histogram, got %d", want, got) - } - m.Reset() - his.WithLabelValues("bar").(Histogram).Write(m) - if want, got := uint64(1), m.GetHistogram().GetSampleCount(); want != got { - t.Errorf("want %d observations for 'bar' histogram, got %d", want, got) - } - - timedFunc() - m.Reset() - his.WithLabelValues("foo").(Histogram).Write(m) - if want, got := uint64(1), m.GetHistogram().GetSampleCount(); want != got { - t.Errorf("want %d observations for 'foo' histogram, got %d", want, got) - } - m.Reset() - his.WithLabelValues("bar").(Histogram).Write(m) - if want, got := uint64(2), m.GetHistogram().GetSampleCount(); want != got { - t.Errorf("want %d observations for 'bar' histogram, got %d", want, got) - } - -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/untyped.go b/vendor/github.com/prometheus/client_golang/prometheus/untyped.go deleted file mode 100644 index 0f9ce63f4..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/untyped.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -// UntypedOpts is an alias for Opts. See there for doc comments. -type UntypedOpts Opts - -// UntypedFunc works like GaugeFunc but the collected metric is of type -// "Untyped". UntypedFunc is useful to mirror an external metric of unknown -// type. -// -// To create UntypedFunc instances, use NewUntypedFunc. -type UntypedFunc interface { - Metric - Collector -} - -// NewUntypedFunc creates a new UntypedFunc based on the provided -// UntypedOpts. The value reported is determined by calling the given function -// from within the Write method. Take into account that metric collection may -// happen concurrently. If that results in concurrent calls to Write, like in -// the case where an UntypedFunc is directly registered with Prometheus, the -// provided function must be concurrency-safe. -func NewUntypedFunc(opts UntypedOpts, function func() float64) UntypedFunc { - return newValueFunc(NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - nil, - opts.ConstLabels, - ), UntypedValue, function) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/value.go b/vendor/github.com/prometheus/client_golang/prometheus/value.go deleted file mode 100644 index eb248f108..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/value.go +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "fmt" - "sort" - - "github.com/golang/protobuf/proto" - - dto "github.com/prometheus/client_model/go" -) - -// ValueType is an enumeration of metric types that represent a simple value. -type ValueType int - -// Possible values for the ValueType enum. -const ( - _ ValueType = iota - CounterValue - GaugeValue - UntypedValue -) - -// valueFunc is a generic metric for simple values retrieved on collect time -// from a function. It implements Metric and Collector. Its effective type is -// determined by ValueType. This is a low-level building block used by the -// library to back the implementations of CounterFunc, GaugeFunc, and -// UntypedFunc. -type valueFunc struct { - selfCollector - - desc *Desc - valType ValueType - function func() float64 - labelPairs []*dto.LabelPair -} - -// newValueFunc returns a newly allocated valueFunc with the given Desc and -// ValueType. The value reported is determined by calling the given function -// from within the Write method. Take into account that metric collection may -// happen concurrently. If that results in concurrent calls to Write, like in -// the case where a valueFunc is directly registered with Prometheus, the -// provided function must be concurrency-safe. -func newValueFunc(desc *Desc, valueType ValueType, function func() float64) *valueFunc { - result := &valueFunc{ - desc: desc, - valType: valueType, - function: function, - labelPairs: makeLabelPairs(desc, nil), - } - result.init(result) - return result -} - -func (v *valueFunc) Desc() *Desc { - return v.desc -} - -func (v *valueFunc) Write(out *dto.Metric) error { - return populateMetric(v.valType, v.function(), v.labelPairs, out) -} - -// NewConstMetric returns a metric with one fixed value that cannot be -// changed. Users of this package will not have much use for it in regular -// operations. However, when implementing custom Collectors, it is useful as a -// throw-away metric that is generated on the fly to send it to Prometheus in -// the Collect method. NewConstMetric returns an error if the length of -// labelValues is not consistent with the variable labels in Desc or if Desc is -// invalid. -func NewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) (Metric, error) { - if desc.err != nil { - return nil, desc.err - } - if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil { - return nil, err - } - return &constMetric{ - desc: desc, - valType: valueType, - val: value, - labelPairs: makeLabelPairs(desc, labelValues), - }, nil -} - -// MustNewConstMetric is a version of NewConstMetric that panics where -// NewConstMetric would have returned an error. -func MustNewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) Metric { - m, err := NewConstMetric(desc, valueType, value, labelValues...) - if err != nil { - panic(err) - } - return m -} - -type constMetric struct { - desc *Desc - valType ValueType - val float64 - labelPairs []*dto.LabelPair -} - -func (m *constMetric) Desc() *Desc { - return m.desc -} - -func (m *constMetric) Write(out *dto.Metric) error { - return populateMetric(m.valType, m.val, m.labelPairs, out) -} - -func populateMetric( - t ValueType, - v float64, - labelPairs []*dto.LabelPair, - m *dto.Metric, -) error { - m.Label = labelPairs - switch t { - case CounterValue: - m.Counter = &dto.Counter{Value: proto.Float64(v)} - case GaugeValue: - m.Gauge = &dto.Gauge{Value: proto.Float64(v)} - case UntypedValue: - m.Untyped = &dto.Untyped{Value: proto.Float64(v)} - default: - return fmt.Errorf("encountered unknown type %v", t) - } - return nil -} - -func makeLabelPairs(desc *Desc, labelValues []string) []*dto.LabelPair { - totalLen := len(desc.variableLabels) + len(desc.constLabelPairs) - if totalLen == 0 { - // Super fast path. - return nil - } - if len(desc.variableLabels) == 0 { - // Moderately fast path. - return desc.constLabelPairs - } - labelPairs := make([]*dto.LabelPair, 0, totalLen) - for i, n := range desc.variableLabels { - labelPairs = append(labelPairs, &dto.LabelPair{ - Name: proto.String(n), - Value: proto.String(labelValues[i]), - }) - } - labelPairs = append(labelPairs, desc.constLabelPairs...) - sort.Sort(labelPairSorter(labelPairs)) - return labelPairs -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/value_test.go b/vendor/github.com/prometheus/client_golang/prometheus/value_test.go deleted file mode 100644 index 51867b5e4..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/value_test.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2018 The Prometheus 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 prometheus - -import ( - "fmt" - "testing" -) - -func TestNewConstMetricInvalidLabelValues(t *testing.T) { - testCases := []struct { - desc string - labels Labels - }{ - { - desc: "non utf8 label value", - labels: Labels{"a": "\xFF"}, - }, - { - desc: "not enough label values", - labels: Labels{}, - }, - { - desc: "too many label values", - labels: Labels{"a": "1", "b": "2"}, - }, - } - - for _, test := range testCases { - metricDesc := NewDesc( - "sample_value", - "sample value", - []string{"a"}, - Labels{}, - ) - - expectPanic(t, func() { - MustNewConstMetric(metricDesc, CounterValue, 0.3, "\xFF") - }, fmt.Sprintf("WithLabelValues: expected panic because: %s", test.desc)) - - if _, err := NewConstMetric(metricDesc, CounterValue, 0.3, "\xFF"); err == nil { - t.Errorf("NewConstMetric: expected error because: %s", test.desc) - } - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/vec.go b/vendor/github.com/prometheus/client_golang/prometheus/vec.go deleted file mode 100644 index 14ed9e856..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/vec.go +++ /dev/null @@ -1,472 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "fmt" - "sync" - - "github.com/prometheus/common/model" -) - -// metricVec is a Collector to bundle metrics of the same name that differ in -// their label values. metricVec is not used directly (and therefore -// unexported). It is used as a building block for implementations of vectors of -// a given metric type, like GaugeVec, CounterVec, SummaryVec, and HistogramVec. -// It also handles label currying. It uses basicMetricVec internally. -type metricVec struct { - *metricMap - - curry []curriedLabelValue - - // hashAdd and hashAddByte can be replaced for testing collision handling. - hashAdd func(h uint64, s string) uint64 - hashAddByte func(h uint64, b byte) uint64 -} - -// newMetricVec returns an initialized metricVec. -func newMetricVec(desc *Desc, newMetric func(lvs ...string) Metric) *metricVec { - return &metricVec{ - metricMap: &metricMap{ - metrics: map[uint64][]metricWithLabelValues{}, - desc: desc, - newMetric: newMetric, - }, - hashAdd: hashAdd, - hashAddByte: hashAddByte, - } -} - -// DeleteLabelValues removes the metric where the variable labels are the same -// as those passed in as labels (same order as the VariableLabels in Desc). It -// returns true if a metric was deleted. -// -// It is not an error if the number of label values is not the same as the -// number of VariableLabels in Desc. However, such inconsistent label count can -// never match an actual metric, so the method will always return false in that -// case. -// -// Note that for more than one label value, this method is prone to mistakes -// caused by an incorrect order of arguments. Consider Delete(Labels) as an -// alternative to avoid that type of mistake. For higher label numbers, the -// latter has a much more readable (albeit more verbose) syntax, but it comes -// with a performance overhead (for creating and processing the Labels map). -// See also the CounterVec example. -func (m *metricVec) DeleteLabelValues(lvs ...string) bool { - h, err := m.hashLabelValues(lvs) - if err != nil { - return false - } - - return m.metricMap.deleteByHashWithLabelValues(h, lvs, m.curry) -} - -// Delete deletes the metric where the variable labels are the same as those -// passed in as labels. It returns true if a metric was deleted. -// -// It is not an error if the number and names of the Labels are inconsistent -// with those of the VariableLabels in Desc. However, such inconsistent Labels -// can never match an actual metric, so the method will always return false in -// that case. -// -// This method is used for the same purpose as DeleteLabelValues(...string). See -// there for pros and cons of the two methods. -func (m *metricVec) Delete(labels Labels) bool { - h, err := m.hashLabels(labels) - if err != nil { - return false - } - - return m.metricMap.deleteByHashWithLabels(h, labels, m.curry) -} - -func (m *metricVec) curryWith(labels Labels) (*metricVec, error) { - var ( - newCurry []curriedLabelValue - oldCurry = m.curry - iCurry int - ) - for i, label := range m.desc.variableLabels { - val, ok := labels[label] - if iCurry < len(oldCurry) && oldCurry[iCurry].index == i { - if ok { - return nil, fmt.Errorf("label name %q is already curried", label) - } - newCurry = append(newCurry, oldCurry[iCurry]) - iCurry++ - } else { - if !ok { - continue // Label stays uncurried. - } - newCurry = append(newCurry, curriedLabelValue{i, val}) - } - } - if l := len(oldCurry) + len(labels) - len(newCurry); l > 0 { - return nil, fmt.Errorf("%d unknown label(s) found during currying", l) - } - - return &metricVec{ - metricMap: m.metricMap, - curry: newCurry, - hashAdd: m.hashAdd, - hashAddByte: m.hashAddByte, - }, nil -} - -func (m *metricVec) getMetricWithLabelValues(lvs ...string) (Metric, error) { - h, err := m.hashLabelValues(lvs) - if err != nil { - return nil, err - } - - return m.metricMap.getOrCreateMetricWithLabelValues(h, lvs, m.curry), nil -} - -func (m *metricVec) getMetricWith(labels Labels) (Metric, error) { - h, err := m.hashLabels(labels) - if err != nil { - return nil, err - } - - return m.metricMap.getOrCreateMetricWithLabels(h, labels, m.curry), nil -} - -func (m *metricVec) hashLabelValues(vals []string) (uint64, error) { - if err := validateLabelValues(vals, len(m.desc.variableLabels)-len(m.curry)); err != nil { - return 0, err - } - - var ( - h = hashNew() - curry = m.curry - iVals, iCurry int - ) - for i := 0; i < len(m.desc.variableLabels); i++ { - if iCurry < len(curry) && curry[iCurry].index == i { - h = m.hashAdd(h, curry[iCurry].value) - iCurry++ - } else { - h = m.hashAdd(h, vals[iVals]) - iVals++ - } - h = m.hashAddByte(h, model.SeparatorByte) - } - return h, nil -} - -func (m *metricVec) hashLabels(labels Labels) (uint64, error) { - if err := validateValuesInLabels(labels, len(m.desc.variableLabels)-len(m.curry)); err != nil { - return 0, err - } - - var ( - h = hashNew() - curry = m.curry - iCurry int - ) - for i, label := range m.desc.variableLabels { - val, ok := labels[label] - if iCurry < len(curry) && curry[iCurry].index == i { - if ok { - return 0, fmt.Errorf("label name %q is already curried", label) - } - h = m.hashAdd(h, curry[iCurry].value) - iCurry++ - } else { - if !ok { - return 0, fmt.Errorf("label name %q missing in label map", label) - } - h = m.hashAdd(h, val) - } - h = m.hashAddByte(h, model.SeparatorByte) - } - return h, nil -} - -// metricWithLabelValues provides the metric and its label values for -// disambiguation on hash collision. -type metricWithLabelValues struct { - values []string - metric Metric -} - -// curriedLabelValue sets the curried value for a label at the given index. -type curriedLabelValue struct { - index int - value string -} - -// metricMap is a helper for metricVec and shared between differently curried -// metricVecs. -type metricMap struct { - mtx sync.RWMutex // Protects metrics. - metrics map[uint64][]metricWithLabelValues - desc *Desc - newMetric func(labelValues ...string) Metric -} - -// Describe implements Collector. It will send exactly one Desc to the provided -// channel. -func (m *metricMap) Describe(ch chan<- *Desc) { - ch <- m.desc -} - -// Collect implements Collector. -func (m *metricMap) Collect(ch chan<- Metric) { - m.mtx.RLock() - defer m.mtx.RUnlock() - - for _, metrics := range m.metrics { - for _, metric := range metrics { - ch <- metric.metric - } - } -} - -// Reset deletes all metrics in this vector. -func (m *metricMap) Reset() { - m.mtx.Lock() - defer m.mtx.Unlock() - - for h := range m.metrics { - delete(m.metrics, h) - } -} - -// deleteByHashWithLabelValues removes the metric from the hash bucket h. If -// there are multiple matches in the bucket, use lvs to select a metric and -// remove only that metric. -func (m *metricMap) deleteByHashWithLabelValues( - h uint64, lvs []string, curry []curriedLabelValue, -) bool { - m.mtx.Lock() - defer m.mtx.Unlock() - - metrics, ok := m.metrics[h] - if !ok { - return false - } - - i := findMetricWithLabelValues(metrics, lvs, curry) - if i >= len(metrics) { - return false - } - - if len(metrics) > 1 { - m.metrics[h] = append(metrics[:i], metrics[i+1:]...) - } else { - delete(m.metrics, h) - } - return true -} - -// deleteByHashWithLabels removes the metric from the hash bucket h. If there -// are multiple matches in the bucket, use lvs to select a metric and remove -// only that metric. -func (m *metricMap) deleteByHashWithLabels( - h uint64, labels Labels, curry []curriedLabelValue, -) bool { - m.mtx.Lock() - defer m.mtx.Unlock() - - metrics, ok := m.metrics[h] - if !ok { - return false - } - i := findMetricWithLabels(m.desc, metrics, labels, curry) - if i >= len(metrics) { - return false - } - - if len(metrics) > 1 { - m.metrics[h] = append(metrics[:i], metrics[i+1:]...) - } else { - delete(m.metrics, h) - } - return true -} - -// getOrCreateMetricWithLabelValues retrieves the metric by hash and label value -// or creates it and returns the new one. -// -// This function holds the mutex. -func (m *metricMap) getOrCreateMetricWithLabelValues( - hash uint64, lvs []string, curry []curriedLabelValue, -) Metric { - m.mtx.RLock() - metric, ok := m.getMetricWithHashAndLabelValues(hash, lvs, curry) - m.mtx.RUnlock() - if ok { - return metric - } - - m.mtx.Lock() - defer m.mtx.Unlock() - metric, ok = m.getMetricWithHashAndLabelValues(hash, lvs, curry) - if !ok { - inlinedLVs := inlineLabelValues(lvs, curry) - metric = m.newMetric(inlinedLVs...) - m.metrics[hash] = append(m.metrics[hash], metricWithLabelValues{values: inlinedLVs, metric: metric}) - } - return metric -} - -// getOrCreateMetricWithLabelValues retrieves the metric by hash and label value -// or creates it and returns the new one. -// -// This function holds the mutex. -func (m *metricMap) getOrCreateMetricWithLabels( - hash uint64, labels Labels, curry []curriedLabelValue, -) Metric { - m.mtx.RLock() - metric, ok := m.getMetricWithHashAndLabels(hash, labels, curry) - m.mtx.RUnlock() - if ok { - return metric - } - - m.mtx.Lock() - defer m.mtx.Unlock() - metric, ok = m.getMetricWithHashAndLabels(hash, labels, curry) - if !ok { - lvs := extractLabelValues(m.desc, labels, curry) - metric = m.newMetric(lvs...) - m.metrics[hash] = append(m.metrics[hash], metricWithLabelValues{values: lvs, metric: metric}) - } - return metric -} - -// getMetricWithHashAndLabelValues gets a metric while handling possible -// collisions in the hash space. Must be called while holding the read mutex. -func (m *metricMap) getMetricWithHashAndLabelValues( - h uint64, lvs []string, curry []curriedLabelValue, -) (Metric, bool) { - metrics, ok := m.metrics[h] - if ok { - if i := findMetricWithLabelValues(metrics, lvs, curry); i < len(metrics) { - return metrics[i].metric, true - } - } - return nil, false -} - -// getMetricWithHashAndLabels gets a metric while handling possible collisions in -// the hash space. Must be called while holding read mutex. -func (m *metricMap) getMetricWithHashAndLabels( - h uint64, labels Labels, curry []curriedLabelValue, -) (Metric, bool) { - metrics, ok := m.metrics[h] - if ok { - if i := findMetricWithLabels(m.desc, metrics, labels, curry); i < len(metrics) { - return metrics[i].metric, true - } - } - return nil, false -} - -// findMetricWithLabelValues returns the index of the matching metric or -// len(metrics) if not found. -func findMetricWithLabelValues( - metrics []metricWithLabelValues, lvs []string, curry []curriedLabelValue, -) int { - for i, metric := range metrics { - if matchLabelValues(metric.values, lvs, curry) { - return i - } - } - return len(metrics) -} - -// findMetricWithLabels returns the index of the matching metric or len(metrics) -// if not found. -func findMetricWithLabels( - desc *Desc, metrics []metricWithLabelValues, labels Labels, curry []curriedLabelValue, -) int { - for i, metric := range metrics { - if matchLabels(desc, metric.values, labels, curry) { - return i - } - } - return len(metrics) -} - -func matchLabelValues(values []string, lvs []string, curry []curriedLabelValue) bool { - if len(values) != len(lvs)+len(curry) { - return false - } - var iLVs, iCurry int - for i, v := range values { - if iCurry < len(curry) && curry[iCurry].index == i { - if v != curry[iCurry].value { - return false - } - iCurry++ - continue - } - if v != lvs[iLVs] { - return false - } - iLVs++ - } - return true -} - -func matchLabels(desc *Desc, values []string, labels Labels, curry []curriedLabelValue) bool { - if len(values) != len(labels)+len(curry) { - return false - } - iCurry := 0 - for i, k := range desc.variableLabels { - if iCurry < len(curry) && curry[iCurry].index == i { - if values[i] != curry[iCurry].value { - return false - } - iCurry++ - continue - } - if values[i] != labels[k] { - return false - } - } - return true -} - -func extractLabelValues(desc *Desc, labels Labels, curry []curriedLabelValue) []string { - labelValues := make([]string, len(labels)+len(curry)) - iCurry := 0 - for i, k := range desc.variableLabels { - if iCurry < len(curry) && curry[iCurry].index == i { - labelValues[i] = curry[iCurry].value - iCurry++ - continue - } - labelValues[i] = labels[k] - } - return labelValues -} - -func inlineLabelValues(lvs []string, curry []curriedLabelValue) []string { - labelValues := make([]string, len(lvs)+len(curry)) - var iCurry, iLVs int - for i := range labelValues { - if iCurry < len(curry) && curry[iCurry].index == i { - labelValues[i] = curry[iCurry].value - iCurry++ - continue - } - labelValues[i] = lvs[iLVs] - iLVs++ - } - return labelValues -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/vec_test.go b/vendor/github.com/prometheus/client_golang/prometheus/vec_test.go deleted file mode 100644 index bd18a9f4e..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/vec_test.go +++ /dev/null @@ -1,535 +0,0 @@ -// Copyright 2014 The Prometheus 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 prometheus - -import ( - "fmt" - "testing" - - dto "github.com/prometheus/client_model/go" -) - -func TestDelete(t *testing.T) { - vec := NewGaugeVec( - GaugeOpts{ - Name: "test", - Help: "helpless", - }, - []string{"l1", "l2"}, - ) - testDelete(t, vec) -} - -func TestDeleteWithCollisions(t *testing.T) { - vec := NewGaugeVec( - GaugeOpts{ - Name: "test", - Help: "helpless", - }, - []string{"l1", "l2"}, - ) - vec.hashAdd = func(h uint64, s string) uint64 { return 1 } - vec.hashAddByte = func(h uint64, b byte) uint64 { return 1 } - testDelete(t, vec) -} - -func testDelete(t *testing.T, vec *GaugeVec) { - if got, want := vec.Delete(Labels{"l1": "v1", "l2": "v2"}), false; got != want { - t.Errorf("got %v, want %v", got, want) - } - - vec.With(Labels{"l1": "v1", "l2": "v2"}).(Gauge).Set(42) - if got, want := vec.Delete(Labels{"l1": "v1", "l2": "v2"}), true; got != want { - t.Errorf("got %v, want %v", got, want) - } - if got, want := vec.Delete(Labels{"l1": "v1", "l2": "v2"}), false; got != want { - t.Errorf("got %v, want %v", got, want) - } - - vec.With(Labels{"l1": "v1", "l2": "v2"}).(Gauge).Set(42) - if got, want := vec.Delete(Labels{"l2": "v2", "l1": "v1"}), true; got != want { - t.Errorf("got %v, want %v", got, want) - } - if got, want := vec.Delete(Labels{"l2": "v2", "l1": "v1"}), false; got != want { - t.Errorf("got %v, want %v", got, want) - } - - vec.With(Labels{"l1": "v1", "l2": "v2"}).(Gauge).Set(42) - if got, want := vec.Delete(Labels{"l2": "v1", "l1": "v2"}), false; got != want { - t.Errorf("got %v, want %v", got, want) - } - if got, want := vec.Delete(Labels{"l1": "v1"}), false; got != want { - t.Errorf("got %v, want %v", got, want) - } -} - -func TestDeleteLabelValues(t *testing.T) { - vec := NewGaugeVec( - GaugeOpts{ - Name: "test", - Help: "helpless", - }, - []string{"l1", "l2"}, - ) - testDeleteLabelValues(t, vec) -} - -func TestDeleteLabelValuesWithCollisions(t *testing.T) { - vec := NewGaugeVec( - GaugeOpts{ - Name: "test", - Help: "helpless", - }, - []string{"l1", "l2"}, - ) - vec.hashAdd = func(h uint64, s string) uint64 { return 1 } - vec.hashAddByte = func(h uint64, b byte) uint64 { return 1 } - testDeleteLabelValues(t, vec) -} - -func testDeleteLabelValues(t *testing.T, vec *GaugeVec) { - if got, want := vec.DeleteLabelValues("v1", "v2"), false; got != want { - t.Errorf("got %v, want %v", got, want) - } - - vec.With(Labels{"l1": "v1", "l2": "v2"}).(Gauge).Set(42) - vec.With(Labels{"l1": "v1", "l2": "v3"}).(Gauge).Set(42) // Add junk data for collision. - if got, want := vec.DeleteLabelValues("v1", "v2"), true; got != want { - t.Errorf("got %v, want %v", got, want) - } - if got, want := vec.DeleteLabelValues("v1", "v2"), false; got != want { - t.Errorf("got %v, want %v", got, want) - } - if got, want := vec.DeleteLabelValues("v1", "v3"), true; got != want { - t.Errorf("got %v, want %v", got, want) - } - - vec.With(Labels{"l1": "v1", "l2": "v2"}).(Gauge).Set(42) - // Delete out of order. - if got, want := vec.DeleteLabelValues("v2", "v1"), false; got != want { - t.Errorf("got %v, want %v", got, want) - } - if got, want := vec.DeleteLabelValues("v1"), false; got != want { - t.Errorf("got %v, want %v", got, want) - } -} - -func TestMetricVec(t *testing.T) { - vec := NewGaugeVec( - GaugeOpts{ - Name: "test", - Help: "helpless", - }, - []string{"l1", "l2"}, - ) - testMetricVec(t, vec) -} - -func TestMetricVecWithCollisions(t *testing.T) { - vec := NewGaugeVec( - GaugeOpts{ - Name: "test", - Help: "helpless", - }, - []string{"l1", "l2"}, - ) - vec.hashAdd = func(h uint64, s string) uint64 { return 1 } - vec.hashAddByte = func(h uint64, b byte) uint64 { return 1 } - testMetricVec(t, vec) -} - -func testMetricVec(t *testing.T, vec *GaugeVec) { - vec.Reset() // Actually test Reset now! - - var pair [2]string - // Keep track of metrics. - expected := map[[2]string]int{} - - for i := 0; i < 1000; i++ { - pair[0], pair[1] = fmt.Sprint(i%4), fmt.Sprint(i%5) // Varying combinations multiples. - expected[pair]++ - vec.WithLabelValues(pair[0], pair[1]).Inc() - - expected[[2]string{"v1", "v2"}]++ - vec.WithLabelValues("v1", "v2").(Gauge).Inc() - } - - var total int - for _, metrics := range vec.metricMap.metrics { - for _, metric := range metrics { - total++ - copy(pair[:], metric.values) - - var metricOut dto.Metric - if err := metric.metric.Write(&metricOut); err != nil { - t.Fatal(err) - } - actual := *metricOut.Gauge.Value - - var actualPair [2]string - for i, label := range metricOut.Label { - actualPair[i] = *label.Value - } - - // Test output pair against metric.values to ensure we've selected - // the right one. We check this to ensure the below check means - // anything at all. - if actualPair != pair { - t.Fatalf("unexpected pair association in metric map: %v != %v", actualPair, pair) - } - - if actual != float64(expected[pair]) { - t.Fatalf("incorrect counter value for %v: %v != %v", pair, actual, expected[pair]) - } - } - } - - if total != len(expected) { - t.Fatalf("unexpected number of metrics: %v != %v", total, len(expected)) - } - - vec.Reset() - - if len(vec.metricMap.metrics) > 0 { - t.Fatalf("reset failed") - } -} - -func TestCounterVecEndToEndWithCollision(t *testing.T) { - vec := NewCounterVec( - CounterOpts{ - Name: "test", - Help: "helpless", - }, - []string{"labelname"}, - ) - vec.WithLabelValues("77kepQFQ8Kl").Inc() - vec.WithLabelValues("!0IC=VloaY").Add(2) - - m := &dto.Metric{} - if err := vec.WithLabelValues("77kepQFQ8Kl").Write(m); err != nil { - t.Fatal(err) - } - if got, want := m.GetLabel()[0].GetValue(), "77kepQFQ8Kl"; got != want { - t.Errorf("got label value %q, want %q", got, want) - } - if got, want := m.GetCounter().GetValue(), 1.; got != want { - t.Errorf("got value %f, want %f", got, want) - } - m.Reset() - if err := vec.WithLabelValues("!0IC=VloaY").Write(m); err != nil { - t.Fatal(err) - } - if got, want := m.GetLabel()[0].GetValue(), "!0IC=VloaY"; got != want { - t.Errorf("got label value %q, want %q", got, want) - } - if got, want := m.GetCounter().GetValue(), 2.; got != want { - t.Errorf("got value %f, want %f", got, want) - } -} - -func TestCurryVec(t *testing.T) { - vec := NewCounterVec( - CounterOpts{ - Name: "test", - Help: "helpless", - }, - []string{"one", "two", "three"}, - ) - testCurryVec(t, vec) -} - -func TestCurryVecWithCollisions(t *testing.T) { - vec := NewCounterVec( - CounterOpts{ - Name: "test", - Help: "helpless", - }, - []string{"one", "two", "three"}, - ) - vec.hashAdd = func(h uint64, s string) uint64 { return 1 } - vec.hashAddByte = func(h uint64, b byte) uint64 { return 1 } - testCurryVec(t, vec) -} - -func testCurryVec(t *testing.T, vec *CounterVec) { - - assertMetrics := func(t *testing.T) { - n := 0 - for _, m := range vec.metricMap.metrics { - n += len(m) - } - if n != 2 { - t.Error("expected two metrics, got", n) - } - m := &dto.Metric{} - c1, err := vec.GetMetricWithLabelValues("1", "2", "3") - if err != nil { - t.Fatal("unexpected error getting metric:", err) - } - c1.Write(m) - if want, got := 1., m.GetCounter().GetValue(); want != got { - t.Errorf("want %f as counter value, got %f", want, got) - } - m.Reset() - c2, err := vec.GetMetricWithLabelValues("11", "22", "33") - if err != nil { - t.Fatal("unexpected error getting metric:", err) - } - c2.Write(m) - if want, got := 1., m.GetCounter().GetValue(); want != got { - t.Errorf("want %f as counter value, got %f", want, got) - } - } - - assertNoMetric := func(t *testing.T) { - if n := len(vec.metricMap.metrics); n != 0 { - t.Error("expected no metrics, got", n) - } - } - - t.Run("zero labels", func(t *testing.T) { - c1 := vec.MustCurryWith(nil) - c2 := vec.MustCurryWith(nil) - c1.WithLabelValues("1", "2", "3").Inc() - c2.With(Labels{"one": "11", "two": "22", "three": "33"}).Inc() - assertMetrics(t) - if !c1.Delete(Labels{"one": "1", "two": "2", "three": "3"}) { - t.Error("deletion failed") - } - if !c2.DeleteLabelValues("11", "22", "33") { - t.Error("deletion failed") - } - assertNoMetric(t) - }) - t.Run("first label", func(t *testing.T) { - c1 := vec.MustCurryWith(Labels{"one": "1"}) - c2 := vec.MustCurryWith(Labels{"one": "11"}) - c1.WithLabelValues("2", "3").Inc() - c2.With(Labels{"two": "22", "three": "33"}).Inc() - assertMetrics(t) - if c1.Delete(Labels{"two": "22", "three": "33"}) { - t.Error("deletion unexpectedly succeeded") - } - if c2.DeleteLabelValues("2", "3") { - t.Error("deletion unexpectedly succeeded") - } - if !c1.Delete(Labels{"two": "2", "three": "3"}) { - t.Error("deletion failed") - } - if !c2.DeleteLabelValues("22", "33") { - t.Error("deletion failed") - } - assertNoMetric(t) - }) - t.Run("middle label", func(t *testing.T) { - c1 := vec.MustCurryWith(Labels{"two": "2"}) - c2 := vec.MustCurryWith(Labels{"two": "22"}) - c1.WithLabelValues("1", "3").Inc() - c2.With(Labels{"one": "11", "three": "33"}).Inc() - assertMetrics(t) - if c1.Delete(Labels{"one": "11", "three": "33"}) { - t.Error("deletion unexpectedly succeeded") - } - if c2.DeleteLabelValues("1", "3") { - t.Error("deletion unexpectedly succeeded") - } - if !c1.Delete(Labels{"one": "1", "three": "3"}) { - t.Error("deletion failed") - } - if !c2.DeleteLabelValues("11", "33") { - t.Error("deletion failed") - } - assertNoMetric(t) - }) - t.Run("last label", func(t *testing.T) { - c1 := vec.MustCurryWith(Labels{"three": "3"}) - c2 := vec.MustCurryWith(Labels{"three": "33"}) - c1.WithLabelValues("1", "2").Inc() - c2.With(Labels{"one": "11", "two": "22"}).Inc() - assertMetrics(t) - if c1.Delete(Labels{"two": "22", "one": "11"}) { - t.Error("deletion unexpectedly succeeded") - } - if c2.DeleteLabelValues("1", "2") { - t.Error("deletion unexpectedly succeeded") - } - if !c1.Delete(Labels{"two": "2", "one": "1"}) { - t.Error("deletion failed") - } - if !c2.DeleteLabelValues("11", "22") { - t.Error("deletion failed") - } - assertNoMetric(t) - }) - t.Run("two labels", func(t *testing.T) { - c1 := vec.MustCurryWith(Labels{"three": "3", "one": "1"}) - c2 := vec.MustCurryWith(Labels{"three": "33", "one": "11"}) - c1.WithLabelValues("2").Inc() - c2.With(Labels{"two": "22"}).Inc() - assertMetrics(t) - if c1.Delete(Labels{"two": "22"}) { - t.Error("deletion unexpectedly succeeded") - } - if c2.DeleteLabelValues("2") { - t.Error("deletion unexpectedly succeeded") - } - if !c1.Delete(Labels{"two": "2"}) { - t.Error("deletion failed") - } - if !c2.DeleteLabelValues("22") { - t.Error("deletion failed") - } - assertNoMetric(t) - }) - t.Run("all labels", func(t *testing.T) { - c1 := vec.MustCurryWith(Labels{"three": "3", "two": "2", "one": "1"}) - c2 := vec.MustCurryWith(Labels{"three": "33", "one": "11", "two": "22"}) - c1.WithLabelValues().Inc() - c2.With(nil).Inc() - assertMetrics(t) - if !c1.Delete(Labels{}) { - t.Error("deletion failed") - } - if !c2.DeleteLabelValues() { - t.Error("deletion failed") - } - assertNoMetric(t) - }) - t.Run("double curry", func(t *testing.T) { - c1 := vec.MustCurryWith(Labels{"three": "3"}).MustCurryWith(Labels{"one": "1"}) - c2 := vec.MustCurryWith(Labels{"three": "33"}).MustCurryWith(Labels{"one": "11"}) - c1.WithLabelValues("2").Inc() - c2.With(Labels{"two": "22"}).Inc() - assertMetrics(t) - if c1.Delete(Labels{"two": "22"}) { - t.Error("deletion unexpectedly succeeded") - } - if c2.DeleteLabelValues("2") { - t.Error("deletion unexpectedly succeeded") - } - if !c1.Delete(Labels{"two": "2"}) { - t.Error("deletion failed") - } - if !c2.DeleteLabelValues("22") { - t.Error("deletion failed") - } - assertNoMetric(t) - }) - t.Run("use already curried label", func(t *testing.T) { - c1 := vec.MustCurryWith(Labels{"three": "3"}) - if _, err := c1.GetMetricWithLabelValues("1", "2", "3"); err == nil { - t.Error("expected error when using already curried label") - } - if _, err := c1.GetMetricWith(Labels{"one": "1", "two": "2", "three": "3"}); err == nil { - t.Error("expected error when using already curried label") - } - assertNoMetric(t) - c1.WithLabelValues("1", "2").Inc() - if c1.Delete(Labels{"one": "1", "two": "2", "three": "3"}) { - t.Error("deletion unexpectedly succeeded") - } - if !c1.Delete(Labels{"one": "1", "two": "2"}) { - t.Error("deletion failed") - } - assertNoMetric(t) - }) - t.Run("curry already curried label", func(t *testing.T) { - if _, err := vec.MustCurryWith(Labels{"three": "3"}).CurryWith(Labels{"three": "33"}); err == nil { - t.Error("currying unexpectedly succeeded") - } else if err.Error() != `label name "three" is already curried` { - t.Error("currying returned unexpected error:", err) - } - - }) - t.Run("unknown label", func(t *testing.T) { - if _, err := vec.CurryWith(Labels{"foo": "bar"}); err == nil { - t.Error("currying unexpectedly succeeded") - } else if err.Error() != "1 unknown label(s) found during currying" { - t.Error("currying returned unexpected error:", err) - } - }) -} - -func BenchmarkMetricVecWithLabelValuesBasic(b *testing.B) { - benchmarkMetricVecWithLabelValues(b, map[string][]string{ - "l1": {"onevalue"}, - "l2": {"twovalue"}, - }) -} - -func BenchmarkMetricVecWithLabelValues2Keys10ValueCardinality(b *testing.B) { - benchmarkMetricVecWithLabelValuesCardinality(b, 2, 10) -} - -func BenchmarkMetricVecWithLabelValues4Keys10ValueCardinality(b *testing.B) { - benchmarkMetricVecWithLabelValuesCardinality(b, 4, 10) -} - -func BenchmarkMetricVecWithLabelValues2Keys100ValueCardinality(b *testing.B) { - benchmarkMetricVecWithLabelValuesCardinality(b, 2, 100) -} - -func BenchmarkMetricVecWithLabelValues10Keys100ValueCardinality(b *testing.B) { - benchmarkMetricVecWithLabelValuesCardinality(b, 10, 100) -} - -func BenchmarkMetricVecWithLabelValues10Keys1000ValueCardinality(b *testing.B) { - benchmarkMetricVecWithLabelValuesCardinality(b, 10, 1000) -} - -func benchmarkMetricVecWithLabelValuesCardinality(b *testing.B, nkeys, nvalues int) { - labels := map[string][]string{} - - for i := 0; i < nkeys; i++ { - var ( - k = fmt.Sprintf("key-%v", i) - vs = make([]string, 0, nvalues) - ) - for j := 0; j < nvalues; j++ { - vs = append(vs, fmt.Sprintf("value-%v", j)) - } - labels[k] = vs - } - - benchmarkMetricVecWithLabelValues(b, labels) -} - -func benchmarkMetricVecWithLabelValues(b *testing.B, labels map[string][]string) { - var keys []string - for k := range labels { // Map order dependent, who cares though. - keys = append(keys, k) - } - - values := make([]string, len(labels)) // Value cache for permutations. - vec := NewGaugeVec( - GaugeOpts{ - Name: "test", - Help: "helpless", - }, - keys, - ) - - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - // Varies input across provide map entries based on key size. - for j, k := range keys { - candidates := labels[k] - values[j] = candidates[i%len(candidates)] - } - - vec.WithLabelValues(values...) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go deleted file mode 100644 index 49159bf3e..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright 2018 The Prometheus 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 prometheus - -import ( - "fmt" - "sort" - - "github.com/golang/protobuf/proto" - - dto "github.com/prometheus/client_model/go" -) - -// WrapRegistererWith returns a Registerer wrapping the provided -// Registerer. Collectors registered with the returned Registerer will be -// registered with the wrapped Registerer in a modified way. The modified -// Collector adds the provided Labels to all Metrics it collects (as -// ConstLabels). The Metrics collected by the unmodified Collector must not -// duplicate any of those labels. -// -// WrapRegistererWith provides a way to add fixed labels to a subset of -// Collectors. It should not be used to add fixed labels to all metrics exposed. -// -// The Collector example demonstrates a use of WrapRegistererWith. -func WrapRegistererWith(labels Labels, reg Registerer) Registerer { - return &wrappingRegisterer{ - wrappedRegisterer: reg, - labels: labels, - } -} - -// WrapRegistererWithPrefix returns a Registerer wrapping the provided -// Registerer. Collectors registered with the returned Registerer will be -// registered with the wrapped Registerer in a modified way. The modified -// Collector adds the provided prefix to the name of all Metrics it collects. -// -// WrapRegistererWithPrefix is useful to have one place to prefix all metrics of -// a sub-system. To make this work, register metrics of the sub-system with the -// wrapping Registerer returned by WrapRegistererWithPrefix. It is rarely useful -// to use the same prefix for all metrics exposed. In particular, do not prefix -// metric names that are standardized across applications, as that would break -// horizontal monitoring, for example the metrics provided by the Go collector -// (see NewGoCollector) and the process collector (see NewProcessCollector). (In -// fact, those metrics are already prefixed with “go_” or “process_”, -// respectively.) -func WrapRegistererWithPrefix(prefix string, reg Registerer) Registerer { - return &wrappingRegisterer{ - wrappedRegisterer: reg, - prefix: prefix, - } -} - -type wrappingRegisterer struct { - wrappedRegisterer Registerer - prefix string - labels Labels -} - -func (r *wrappingRegisterer) Register(c Collector) error { - return r.wrappedRegisterer.Register(&wrappingCollector{ - wrappedCollector: c, - prefix: r.prefix, - labels: r.labels, - }) -} - -func (r *wrappingRegisterer) MustRegister(cs ...Collector) { - for _, c := range cs { - if err := r.Register(c); err != nil { - panic(err) - } - } -} - -func (r *wrappingRegisterer) Unregister(c Collector) bool { - return r.wrappedRegisterer.Unregister(&wrappingCollector{ - wrappedCollector: c, - prefix: r.prefix, - labels: r.labels, - }) -} - -type wrappingCollector struct { - wrappedCollector Collector - prefix string - labels Labels -} - -func (c *wrappingCollector) Collect(ch chan<- Metric) { - wrappedCh := make(chan Metric) - go func() { - c.wrappedCollector.Collect(wrappedCh) - close(wrappedCh) - }() - for m := range wrappedCh { - ch <- &wrappingMetric{ - wrappedMetric: m, - prefix: c.prefix, - labels: c.labels, - } - } -} - -func (c *wrappingCollector) Describe(ch chan<- *Desc) { - wrappedCh := make(chan *Desc) - go func() { - c.wrappedCollector.Describe(wrappedCh) - close(wrappedCh) - }() - for desc := range wrappedCh { - ch <- wrapDesc(desc, c.prefix, c.labels) - } -} - -type wrappingMetric struct { - wrappedMetric Metric - prefix string - labels Labels -} - -func (m *wrappingMetric) Desc() *Desc { - return wrapDesc(m.wrappedMetric.Desc(), m.prefix, m.labels) -} - -func (m *wrappingMetric) Write(out *dto.Metric) error { - if err := m.wrappedMetric.Write(out); err != nil { - return err - } - if len(m.labels) == 0 { - // No wrapping labels. - return nil - } - for ln, lv := range m.labels { - out.Label = append(out.Label, &dto.LabelPair{ - Name: proto.String(ln), - Value: proto.String(lv), - }) - } - sort.Sort(labelPairSorter(out.Label)) - return nil -} - -func wrapDesc(desc *Desc, prefix string, labels Labels) *Desc { - constLabels := Labels{} - for _, lp := range desc.constLabelPairs { - constLabels[*lp.Name] = *lp.Value - } - for ln, lv := range labels { - if _, alreadyUsed := constLabels[ln]; alreadyUsed { - return &Desc{ - fqName: desc.fqName, - help: desc.help, - variableLabels: desc.variableLabels, - constLabelPairs: desc.constLabelPairs, - err: fmt.Errorf("attempted wrapping with already existing label name %q", ln), - } - } - constLabels[ln] = lv - } - // NewDesc will do remaining validations. - newDesc := NewDesc(prefix+desc.fqName, desc.help, desc.variableLabels, constLabels) - // Propagate errors if there was any. This will override any errer - // created by NewDesc above, i.e. earlier errors get precedence. - if desc.err != nil { - newDesc.err = desc.err - } - return newDesc -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/wrap_test.go b/vendor/github.com/prometheus/client_golang/prometheus/wrap_test.go deleted file mode 100644 index bed103e5e..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/wrap_test.go +++ /dev/null @@ -1,322 +0,0 @@ -// Copyright 2018 The Prometheus 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 prometheus - -import ( - "fmt" - "reflect" - "strings" - "testing" - - "github.com/gogo/protobuf/proto" - - dto "github.com/prometheus/client_model/go" -) - -// uncheckedCollector wraps a Collector but its Describe method yields no Desc. -type uncheckedCollector struct { - c Collector -} - -func (u uncheckedCollector) Describe(_ chan<- *Desc) {} -func (u uncheckedCollector) Collect(c chan<- Metric) { - u.c.Collect(c) -} - -func toMetricFamilies(cs ...Collector) []*dto.MetricFamily { - reg := NewRegistry() - reg.MustRegister(cs...) - out, err := reg.Gather() - if err != nil { - panic(err) - } - return out -} - -func TestWrap(t *testing.T) { - - simpleCnt := NewCounter(CounterOpts{ - Name: "simpleCnt", - Help: "helpSimpleCnt", - }) - simpleCnt.Inc() - - simpleGge := NewGauge(GaugeOpts{ - Name: "simpleGge", - Help: "helpSimpleGge", - }) - simpleGge.Set(3.14) - - preCnt := NewCounter(CounterOpts{ - Name: "pre_simpleCnt", - Help: "helpSimpleCnt", - }) - preCnt.Inc() - - barLabeledCnt := NewCounter(CounterOpts{ - Name: "simpleCnt", - Help: "helpSimpleCnt", - ConstLabels: Labels{"foo": "bar"}, - }) - barLabeledCnt.Inc() - - bazLabeledCnt := NewCounter(CounterOpts{ - Name: "simpleCnt", - Help: "helpSimpleCnt", - ConstLabels: Labels{"foo": "baz"}, - }) - bazLabeledCnt.Inc() - - labeledPreCnt := NewCounter(CounterOpts{ - Name: "pre_simpleCnt", - Help: "helpSimpleCnt", - ConstLabels: Labels{"foo": "bar"}, - }) - labeledPreCnt.Inc() - - twiceLabeledPreCnt := NewCounter(CounterOpts{ - Name: "pre_simpleCnt", - Help: "helpSimpleCnt", - ConstLabels: Labels{"foo": "bar", "dings": "bums"}, - }) - twiceLabeledPreCnt.Inc() - - barLabeledUncheckedCollector := uncheckedCollector{barLabeledCnt} - - scenarios := map[string]struct { - prefix string // First wrap with this prefix. - labels Labels // Then wrap the result with these labels. - labels2 Labels // If any, wrap the prefix-wrapped one again. - preRegister []Collector - toRegister []struct { // If there are any labels2, register every other with that one. - collector Collector - registrationFails bool - } - gatherFails bool - output []Collector - }{ - "wrap nothing": { - prefix: "pre_", - labels: Labels{"foo": "bar"}, - }, - "wrap with nothing": { - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{simpleCnt, false}}, - output: []Collector{simpleGge, simpleCnt}, - }, - "wrap counter with prefix": { - prefix: "pre_", - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{simpleCnt, false}}, - output: []Collector{simpleGge, preCnt}, - }, - "wrap counter with label pair": { - labels: Labels{"foo": "bar"}, - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{simpleCnt, false}}, - output: []Collector{simpleGge, barLabeledCnt}, - }, - "wrap counter with label pair and prefix": { - prefix: "pre_", - labels: Labels{"foo": "bar"}, - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{simpleCnt, false}}, - output: []Collector{simpleGge, labeledPreCnt}, - }, - "wrap counter with invalid prefix": { - prefix: "1+1", - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{simpleCnt, true}}, - output: []Collector{simpleGge}, - }, - "wrap counter with invalid label": { - preRegister: []Collector{simpleGge}, - labels: Labels{"42": "bar"}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{simpleCnt, true}}, - output: []Collector{simpleGge}, - }, - "counter registered twice but wrapped with different label values": { - labels: Labels{"foo": "bar"}, - labels2: Labels{"foo": "baz"}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{simpleCnt, false}, {simpleCnt, false}}, - output: []Collector{barLabeledCnt, bazLabeledCnt}, - }, - "counter registered twice but wrapped with different inconsistent label values": { - labels: Labels{"foo": "bar"}, - labels2: Labels{"bar": "baz"}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{simpleCnt, false}, {simpleCnt, true}}, - output: []Collector{barLabeledCnt}, - }, - "wrap counter with prefix and two labels": { - prefix: "pre_", - labels: Labels{"foo": "bar", "dings": "bums"}, - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{simpleCnt, false}}, - output: []Collector{simpleGge, twiceLabeledPreCnt}, - }, - "wrap labeled counter with prefix and another label": { - prefix: "pre_", - labels: Labels{"dings": "bums"}, - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{barLabeledCnt, false}}, - output: []Collector{simpleGge, twiceLabeledPreCnt}, - }, - "wrap labeled counter with prefix and inconsistent label": { - prefix: "pre_", - labels: Labels{"foo": "bums"}, - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{barLabeledCnt, true}}, - output: []Collector{simpleGge}, - }, - "wrap labeled counter with prefix and the same label again": { - prefix: "pre_", - labels: Labels{"foo": "bar"}, - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{barLabeledCnt, true}}, - output: []Collector{simpleGge}, - }, - "wrap labeled unchecked collector with prefix and another label": { - prefix: "pre_", - labels: Labels{"dings": "bums"}, - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{barLabeledUncheckedCollector, false}}, - output: []Collector{simpleGge, twiceLabeledPreCnt}, - }, - "wrap labeled unchecked collector with prefix and inconsistent label": { - prefix: "pre_", - labels: Labels{"foo": "bums"}, - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{barLabeledUncheckedCollector, false}}, - gatherFails: true, - output: []Collector{simpleGge}, - }, - "wrap labeled unchecked collector with prefix and the same label again": { - prefix: "pre_", - labels: Labels{"foo": "bar"}, - preRegister: []Collector{simpleGge}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{barLabeledUncheckedCollector, false}}, - gatherFails: true, - output: []Collector{simpleGge}, - }, - "wrap labeled unchecked collector with prefix and another label resulting in collision with pre-registered counter": { - prefix: "pre_", - labels: Labels{"dings": "bums"}, - preRegister: []Collector{twiceLabeledPreCnt}, - toRegister: []struct { - collector Collector - registrationFails bool - }{{barLabeledUncheckedCollector, false}}, - gatherFails: true, - output: []Collector{twiceLabeledPreCnt}, - }, - } - - for n, s := range scenarios { - t.Run(n, func(t *testing.T) { - reg := NewPedanticRegistry() - for _, c := range s.preRegister { - if err := reg.Register(c); err != nil { - t.Fatal("error registering with unwrapped registry:", err) - } - } - preReg := WrapRegistererWithPrefix(s.prefix, reg) - lReg := WrapRegistererWith(s.labels, preReg) - l2Reg := WrapRegistererWith(s.labels2, preReg) - for i, tr := range s.toRegister { - var err error - if i%2 != 0 && len(s.labels2) != 0 { - err = l2Reg.Register(tr.collector) - } else { - err = lReg.Register(tr.collector) - } - if tr.registrationFails && err == nil { - t.Fatalf("registration with wrapping registry unexpectedly succeded for collector #%d", i) - } - if !tr.registrationFails && err != nil { - t.Fatalf("registration with wrapping registry failed for collector #%d: %s", i, err) - } - } - wantMF := toMetricFamilies(s.output...) - gotMF, err := reg.Gather() - if s.gatherFails && err == nil { - t.Fatal("gathering unexpectedly succeded") - } - if !s.gatherFails && err != nil { - t.Fatal("gathering failed:", err) - } - if !reflect.DeepEqual(gotMF, wantMF) { - var want, got []string - - for i, mf := range wantMF { - want = append(want, fmt.Sprintf("%3d: %s", i, proto.MarshalTextString(mf))) - } - for i, mf := range gotMF { - got = append(got, fmt.Sprintf("%3d: %s", i, proto.MarshalTextString(mf))) - } - - t.Fatalf( - "unexpected output of gathering:\n\nWANT:\n%s\n\nGOT:\n%s\n", - strings.Join(want, "\n"), - strings.Join(got, "\n"), - ) - } - }) - } - -} diff --git a/vendor/github.com/prometheus/client_model/.gitignore b/vendor/github.com/prometheus/client_model/.gitignore deleted file mode 100644 index 2f7896d1d..000000000 --- a/vendor/github.com/prometheus/client_model/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target/ diff --git a/vendor/github.com/prometheus/client_model/CONTRIBUTING.md b/vendor/github.com/prometheus/client_model/CONTRIBUTING.md deleted file mode 100644 index 40503edbf..000000000 --- a/vendor/github.com/prometheus/client_model/CONTRIBUTING.md +++ /dev/null @@ -1,18 +0,0 @@ -# Contributing - -Prometheus uses GitHub to manage reviews of pull requests. - -* If you have a trivial fix or improvement, go ahead and create a pull request, - addressing (with `@...`) the maintainer of this repository (see - [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request. - -* If you plan to do something more involved, first discuss your ideas - on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). - This will avoid unnecessary work and surely give you and us a good deal - of inspiration. - -* Relevant coding style guidelines are the [Go Code Review - Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) - and the _Formatting and style_ section of Peter Bourgon's [Go: Best - Practices for Production - Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style). diff --git a/vendor/github.com/prometheus/client_model/LICENSE b/vendor/github.com/prometheus/client_model/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/vendor/github.com/prometheus/client_model/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/prometheus/client_model/MAINTAINERS.md b/vendor/github.com/prometheus/client_model/MAINTAINERS.md deleted file mode 100644 index 3ede55fe1..000000000 --- a/vendor/github.com/prometheus/client_model/MAINTAINERS.md +++ /dev/null @@ -1 +0,0 @@ -* Björn Rabenstein diff --git a/vendor/github.com/prometheus/client_model/Makefile b/vendor/github.com/prometheus/client_model/Makefile deleted file mode 100644 index 03c470816..000000000 --- a/vendor/github.com/prometheus/client_model/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2013 Prometheus Team -# 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. - -KEY_ID ?= _DEFINE_ME_ - -all: cpp go java python ruby - -SUFFIXES: - -cpp: cpp/metrics.pb.cc cpp/metrics.pb.h - -cpp/metrics.pb.cc: metrics.proto - protoc $< --cpp_out=cpp/ - -cpp/metrics.pb.h: metrics.proto - protoc $< --cpp_out=cpp/ - -go: go/metrics.pb.go - -go/metrics.pb.go: metrics.proto - protoc $< --go_out=import_path=github.com/prometheus/client_model/,paths=source_relative:go/ - -java: src/main/java/io/prometheus/client/Metrics.java pom.xml - mvn clean compile package - -src/main/java/io/prometheus/client/Metrics.java: metrics.proto - protoc $< --java_out=src/main/java - -python: python/prometheus/client/model/metrics_pb2.py - -python/prometheus/client/model/metrics_pb2.py: metrics.proto - mkdir -p python/prometheus/client/model - protoc $< --python_out=python/prometheus/client/model - -ruby: - $(MAKE) -C ruby build - -clean: - -rm -rf cpp/* - -rm -rf go/* - -rm -rf java/* - -rm -rf python/* - -$(MAKE) -C ruby clean - -mvn clean - -maven-deploy-snapshot: java - mvn clean deploy -Dgpg.keyname=$(KEY_ID) -DperformRelease=true - -maven-deploy-release: java - mvn clean release:clean release:prepare release:perform -Dgpg.keyname=$(KEY_ID) -DperformRelease=true - -.PHONY: all clean cpp go java maven-deploy-snapshot maven-deploy-release python ruby diff --git a/vendor/github.com/prometheus/client_model/NOTICE b/vendor/github.com/prometheus/client_model/NOTICE deleted file mode 100644 index 20110e410..000000000 --- a/vendor/github.com/prometheus/client_model/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Data model artifacts for Prometheus. -Copyright 2012-2015 The Prometheus Authors - -This product includes software developed at -SoundCloud Ltd. (http://soundcloud.com/). diff --git a/vendor/github.com/prometheus/client_model/README.md b/vendor/github.com/prometheus/client_model/README.md deleted file mode 100644 index a710042db..000000000 --- a/vendor/github.com/prometheus/client_model/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Background -Under most circumstances, manually downloading this repository should never -be required. - -# Prerequisites -# Base -* [Google Protocol Buffers](https://developers.google.com/protocol-buffers) - -## Java -* [Apache Maven](http://maven.apache.org) -* [Prometheus Maven Repository](https://github.com/prometheus/io.prometheus-maven-repository) checked out into ../io.prometheus-maven-repository - -## Go -* [Go](http://golang.org) -* [goprotobuf](https://code.google.com/p/goprotobuf) - -## Ruby -* [Ruby](https://www.ruby-lang.org) -* [bundler](https://rubygems.org/gems/bundler) - -# Building - $ make - -# Getting Started - * The Go source code is periodically indexed: [Go Protocol Buffer Model](http://godoc.org/github.com/prometheus/client_model/go). - * All of the core developers are accessible via the [Prometheus Developers Mailinglist](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). diff --git a/vendor/github.com/prometheus/client_model/cpp/metrics.pb.cc b/vendor/github.com/prometheus/client_model/cpp/metrics.pb.cc deleted file mode 100644 index 1ff893b83..000000000 --- a/vendor/github.com/prometheus/client_model/cpp/metrics.pb.cc +++ /dev/null @@ -1,3380 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: metrics.proto - -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION -#include "metrics.pb.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace io { -namespace prometheus { -namespace client { - -namespace { - -const ::google::protobuf::Descriptor* LabelPair_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - LabelPair_reflection_ = NULL; -const ::google::protobuf::Descriptor* Gauge_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Gauge_reflection_ = NULL; -const ::google::protobuf::Descriptor* Counter_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Counter_reflection_ = NULL; -const ::google::protobuf::Descriptor* Quantile_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Quantile_reflection_ = NULL; -const ::google::protobuf::Descriptor* Summary_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Summary_reflection_ = NULL; -const ::google::protobuf::Descriptor* Untyped_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Untyped_reflection_ = NULL; -const ::google::protobuf::Descriptor* Histogram_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Histogram_reflection_ = NULL; -const ::google::protobuf::Descriptor* Bucket_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Bucket_reflection_ = NULL; -const ::google::protobuf::Descriptor* Metric_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Metric_reflection_ = NULL; -const ::google::protobuf::Descriptor* MetricFamily_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - MetricFamily_reflection_ = NULL; -const ::google::protobuf::EnumDescriptor* MetricType_descriptor_ = NULL; - -} // namespace - - -void protobuf_AssignDesc_metrics_2eproto() { - protobuf_AddDesc_metrics_2eproto(); - const ::google::protobuf::FileDescriptor* file = - ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( - "metrics.proto"); - GOOGLE_CHECK(file != NULL); - LabelPair_descriptor_ = file->message_type(0); - static const int LabelPair_offsets_[2] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LabelPair, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LabelPair, value_), - }; - LabelPair_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - LabelPair_descriptor_, - LabelPair::default_instance_, - LabelPair_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LabelPair, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LabelPair, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(LabelPair)); - Gauge_descriptor_ = file->message_type(1); - static const int Gauge_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Gauge, value_), - }; - Gauge_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Gauge_descriptor_, - Gauge::default_instance_, - Gauge_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Gauge, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Gauge, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Gauge)); - Counter_descriptor_ = file->message_type(2); - static const int Counter_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Counter, value_), - }; - Counter_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Counter_descriptor_, - Counter::default_instance_, - Counter_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Counter, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Counter, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Counter)); - Quantile_descriptor_ = file->message_type(3); - static const int Quantile_offsets_[2] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Quantile, quantile_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Quantile, value_), - }; - Quantile_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Quantile_descriptor_, - Quantile::default_instance_, - Quantile_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Quantile, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Quantile, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Quantile)); - Summary_descriptor_ = file->message_type(4); - static const int Summary_offsets_[3] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Summary, sample_count_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Summary, sample_sum_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Summary, quantile_), - }; - Summary_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Summary_descriptor_, - Summary::default_instance_, - Summary_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Summary, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Summary, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Summary)); - Untyped_descriptor_ = file->message_type(5); - static const int Untyped_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Untyped, value_), - }; - Untyped_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Untyped_descriptor_, - Untyped::default_instance_, - Untyped_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Untyped, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Untyped, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Untyped)); - Histogram_descriptor_ = file->message_type(6); - static const int Histogram_offsets_[3] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Histogram, sample_count_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Histogram, sample_sum_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Histogram, bucket_), - }; - Histogram_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Histogram_descriptor_, - Histogram::default_instance_, - Histogram_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Histogram, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Histogram, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Histogram)); - Bucket_descriptor_ = file->message_type(7); - static const int Bucket_offsets_[2] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bucket, cumulative_count_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bucket, upper_bound_), - }; - Bucket_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Bucket_descriptor_, - Bucket::default_instance_, - Bucket_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bucket, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Bucket, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Bucket)); - Metric_descriptor_ = file->message_type(8); - static const int Metric_offsets_[7] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Metric, label_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Metric, gauge_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Metric, counter_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Metric, summary_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Metric, untyped_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Metric, histogram_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Metric, timestamp_ms_), - }; - Metric_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Metric_descriptor_, - Metric::default_instance_, - Metric_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Metric, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Metric, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Metric)); - MetricFamily_descriptor_ = file->message_type(9); - static const int MetricFamily_offsets_[4] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricFamily, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricFamily, help_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricFamily, type_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricFamily, metric_), - }; - MetricFamily_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - MetricFamily_descriptor_, - MetricFamily::default_instance_, - MetricFamily_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricFamily, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricFamily, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(MetricFamily)); - MetricType_descriptor_ = file->enum_type(0); -} - -namespace { - -GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); -inline void protobuf_AssignDescriptorsOnce() { - ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, - &protobuf_AssignDesc_metrics_2eproto); -} - -void protobuf_RegisterTypes(const ::std::string&) { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - LabelPair_descriptor_, &LabelPair::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Gauge_descriptor_, &Gauge::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Counter_descriptor_, &Counter::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Quantile_descriptor_, &Quantile::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Summary_descriptor_, &Summary::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Untyped_descriptor_, &Untyped::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Histogram_descriptor_, &Histogram::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Bucket_descriptor_, &Bucket::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Metric_descriptor_, &Metric::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - MetricFamily_descriptor_, &MetricFamily::default_instance()); -} - -} // namespace - -void protobuf_ShutdownFile_metrics_2eproto() { - delete LabelPair::default_instance_; - delete LabelPair_reflection_; - delete Gauge::default_instance_; - delete Gauge_reflection_; - delete Counter::default_instance_; - delete Counter_reflection_; - delete Quantile::default_instance_; - delete Quantile_reflection_; - delete Summary::default_instance_; - delete Summary_reflection_; - delete Untyped::default_instance_; - delete Untyped_reflection_; - delete Histogram::default_instance_; - delete Histogram_reflection_; - delete Bucket::default_instance_; - delete Bucket_reflection_; - delete Metric::default_instance_; - delete Metric_reflection_; - delete MetricFamily::default_instance_; - delete MetricFamily_reflection_; -} - -void protobuf_AddDesc_metrics_2eproto() { - static bool already_here = false; - if (already_here) return; - already_here = true; - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\rmetrics.proto\022\024io.prometheus.client\"(\n" - "\tLabelPair\022\014\n\004name\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\"" - "\026\n\005Gauge\022\r\n\005value\030\001 \001(\001\"\030\n\007Counter\022\r\n\005va" - "lue\030\001 \001(\001\"+\n\010Quantile\022\020\n\010quantile\030\001 \001(\001\022" - "\r\n\005value\030\002 \001(\001\"e\n\007Summary\022\024\n\014sample_coun" - "t\030\001 \001(\004\022\022\n\nsample_sum\030\002 \001(\001\0220\n\010quantile\030" - "\003 \003(\0132\036.io.prometheus.client.Quantile\"\030\n" - "\007Untyped\022\r\n\005value\030\001 \001(\001\"c\n\tHistogram\022\024\n\014" - "sample_count\030\001 \001(\004\022\022\n\nsample_sum\030\002 \001(\001\022," - "\n\006bucket\030\003 \003(\0132\034.io.prometheus.client.Bu" - "cket\"7\n\006Bucket\022\030\n\020cumulative_count\030\001 \001(\004" - "\022\023\n\013upper_bound\030\002 \001(\001\"\276\002\n\006Metric\022.\n\005labe" - "l\030\001 \003(\0132\037.io.prometheus.client.LabelPair" - "\022*\n\005gauge\030\002 \001(\0132\033.io.prometheus.client.G" - "auge\022.\n\007counter\030\003 \001(\0132\035.io.prometheus.cl" - "ient.Counter\022.\n\007summary\030\004 \001(\0132\035.io.prome" - "theus.client.Summary\022.\n\007untyped\030\005 \001(\0132\035." - "io.prometheus.client.Untyped\0222\n\thistogra" - "m\030\007 \001(\0132\037.io.prometheus.client.Histogram" - "\022\024\n\014timestamp_ms\030\006 \001(\003\"\210\001\n\014MetricFamily\022" - "\014\n\004name\030\001 \001(\t\022\014\n\004help\030\002 \001(\t\022.\n\004type\030\003 \001(" - "\0162 .io.prometheus.client.MetricType\022,\n\006m" - "etric\030\004 \003(\0132\034.io.prometheus.client.Metri" - "c*M\n\nMetricType\022\013\n\007COUNTER\020\000\022\t\n\005GAUGE\020\001\022" - "\013\n\007SUMMARY\020\002\022\013\n\007UNTYPED\020\003\022\r\n\tHISTOGRAM\020\004" - "B\026\n\024io.prometheus.client", 1024); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( - "metrics.proto", &protobuf_RegisterTypes); - LabelPair::default_instance_ = new LabelPair(); - Gauge::default_instance_ = new Gauge(); - Counter::default_instance_ = new Counter(); - Quantile::default_instance_ = new Quantile(); - Summary::default_instance_ = new Summary(); - Untyped::default_instance_ = new Untyped(); - Histogram::default_instance_ = new Histogram(); - Bucket::default_instance_ = new Bucket(); - Metric::default_instance_ = new Metric(); - MetricFamily::default_instance_ = new MetricFamily(); - LabelPair::default_instance_->InitAsDefaultInstance(); - Gauge::default_instance_->InitAsDefaultInstance(); - Counter::default_instance_->InitAsDefaultInstance(); - Quantile::default_instance_->InitAsDefaultInstance(); - Summary::default_instance_->InitAsDefaultInstance(); - Untyped::default_instance_->InitAsDefaultInstance(); - Histogram::default_instance_->InitAsDefaultInstance(); - Bucket::default_instance_->InitAsDefaultInstance(); - Metric::default_instance_->InitAsDefaultInstance(); - MetricFamily::default_instance_->InitAsDefaultInstance(); - ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_metrics_2eproto); -} - -// Force AddDescriptors() to be called at static initialization time. -struct StaticDescriptorInitializer_metrics_2eproto { - StaticDescriptorInitializer_metrics_2eproto() { - protobuf_AddDesc_metrics_2eproto(); - } -} static_descriptor_initializer_metrics_2eproto_; -const ::google::protobuf::EnumDescriptor* MetricType_descriptor() { - protobuf_AssignDescriptorsOnce(); - return MetricType_descriptor_; -} -bool MetricType_IsValid(int value) { - switch(value) { - case 0: - case 1: - case 2: - case 3: - case 4: - return true; - default: - return false; - } -} - - -// =================================================================== - -#ifndef _MSC_VER -const int LabelPair::kNameFieldNumber; -const int LabelPair::kValueFieldNumber; -#endif // !_MSC_VER - -LabelPair::LabelPair() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.LabelPair) -} - -void LabelPair::InitAsDefaultInstance() { -} - -LabelPair::LabelPair(const LabelPair& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.LabelPair) -} - -void LabelPair::SharedCtor() { - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -LabelPair::~LabelPair() { - // @@protoc_insertion_point(destructor:io.prometheus.client.LabelPair) - SharedDtor(); -} - -void LabelPair::SharedDtor() { - if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete name_; - } - if (value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete value_; - } - if (this != default_instance_) { - } -} - -void LabelPair::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* LabelPair::descriptor() { - protobuf_AssignDescriptorsOnce(); - return LabelPair_descriptor_; -} - -const LabelPair& LabelPair::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -LabelPair* LabelPair::default_instance_ = NULL; - -LabelPair* LabelPair::New() const { - return new LabelPair; -} - -void LabelPair::Clear() { - if (_has_bits_[0 / 32] & 3) { - if (has_name()) { - if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_->clear(); - } - } - if (has_value()) { - if (value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - value_->clear(); - } - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool LabelPair::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.LabelPair) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (tag == 10) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_name())); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), - ::google::protobuf::internal::WireFormat::PARSE, - "name"); - } else { - goto handle_unusual; - } - if (input->ExpectTag(18)) goto parse_value; - break; - } - - // optional string value = 2; - case 2: { - if (tag == 18) { - parse_value: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_value())); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->value().data(), this->value().length(), - ::google::protobuf::internal::WireFormat::PARSE, - "value"); - } else { - goto handle_unusual; - } - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.LabelPair) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.LabelPair) - return false; -#undef DO_ -} - -void LabelPair::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.LabelPair) - // optional string name = 1; - if (has_name()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "name"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->name(), output); - } - - // optional string value = 2; - if (has_value()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->value().data(), this->value().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "value"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 2, this->value(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.LabelPair) -} - -::google::protobuf::uint8* LabelPair::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.LabelPair) - // optional string name = 1; - if (has_name()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "name"); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->name(), target); - } - - // optional string value = 2; - if (has_value()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->value().data(), this->value().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "value"); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 2, this->value(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.LabelPair) - return target; -} - -int LabelPair::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional string name = 1; - if (has_name()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - } - - // optional string value = 2; - if (has_value()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->value()); - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void LabelPair::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const LabelPair* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void LabelPair::MergeFrom(const LabelPair& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_name()) { - set_name(from.name()); - } - if (from.has_value()) { - set_value(from.value()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void LabelPair::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void LabelPair::CopyFrom(const LabelPair& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool LabelPair::IsInitialized() const { - - return true; -} - -void LabelPair::Swap(LabelPair* other) { - if (other != this) { - std::swap(name_, other->name_); - std::swap(value_, other->value_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata LabelPair::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = LabelPair_descriptor_; - metadata.reflection = LabelPair_reflection_; - return metadata; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int Gauge::kValueFieldNumber; -#endif // !_MSC_VER - -Gauge::Gauge() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.Gauge) -} - -void Gauge::InitAsDefaultInstance() { -} - -Gauge::Gauge(const Gauge& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.Gauge) -} - -void Gauge::SharedCtor() { - _cached_size_ = 0; - value_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Gauge::~Gauge() { - // @@protoc_insertion_point(destructor:io.prometheus.client.Gauge) - SharedDtor(); -} - -void Gauge::SharedDtor() { - if (this != default_instance_) { - } -} - -void Gauge::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Gauge::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Gauge_descriptor_; -} - -const Gauge& Gauge::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -Gauge* Gauge::default_instance_ = NULL; - -Gauge* Gauge::New() const { - return new Gauge; -} - -void Gauge::Clear() { - value_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Gauge::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.Gauge) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional double value = 1; - case 1: { - if (tag == 9) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &value_))); - set_has_value(); - } else { - goto handle_unusual; - } - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.Gauge) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.Gauge) - return false; -#undef DO_ -} - -void Gauge::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.Gauge) - // optional double value = 1; - if (has_value()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(1, this->value(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.Gauge) -} - -::google::protobuf::uint8* Gauge::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.Gauge) - // optional double value = 1; - if (has_value()) { - target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(1, this->value(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.Gauge) - return target; -} - -int Gauge::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional double value = 1; - if (has_value()) { - total_size += 1 + 8; - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Gauge::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Gauge* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Gauge::MergeFrom(const Gauge& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_value()) { - set_value(from.value()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Gauge::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Gauge::CopyFrom(const Gauge& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Gauge::IsInitialized() const { - - return true; -} - -void Gauge::Swap(Gauge* other) { - if (other != this) { - std::swap(value_, other->value_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Gauge::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Gauge_descriptor_; - metadata.reflection = Gauge_reflection_; - return metadata; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int Counter::kValueFieldNumber; -#endif // !_MSC_VER - -Counter::Counter() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.Counter) -} - -void Counter::InitAsDefaultInstance() { -} - -Counter::Counter(const Counter& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.Counter) -} - -void Counter::SharedCtor() { - _cached_size_ = 0; - value_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Counter::~Counter() { - // @@protoc_insertion_point(destructor:io.prometheus.client.Counter) - SharedDtor(); -} - -void Counter::SharedDtor() { - if (this != default_instance_) { - } -} - -void Counter::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Counter::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Counter_descriptor_; -} - -const Counter& Counter::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -Counter* Counter::default_instance_ = NULL; - -Counter* Counter::New() const { - return new Counter; -} - -void Counter::Clear() { - value_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Counter::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.Counter) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional double value = 1; - case 1: { - if (tag == 9) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &value_))); - set_has_value(); - } else { - goto handle_unusual; - } - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.Counter) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.Counter) - return false; -#undef DO_ -} - -void Counter::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.Counter) - // optional double value = 1; - if (has_value()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(1, this->value(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.Counter) -} - -::google::protobuf::uint8* Counter::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.Counter) - // optional double value = 1; - if (has_value()) { - target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(1, this->value(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.Counter) - return target; -} - -int Counter::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional double value = 1; - if (has_value()) { - total_size += 1 + 8; - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Counter::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Counter* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Counter::MergeFrom(const Counter& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_value()) { - set_value(from.value()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Counter::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Counter::CopyFrom(const Counter& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Counter::IsInitialized() const { - - return true; -} - -void Counter::Swap(Counter* other) { - if (other != this) { - std::swap(value_, other->value_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Counter::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Counter_descriptor_; - metadata.reflection = Counter_reflection_; - return metadata; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int Quantile::kQuantileFieldNumber; -const int Quantile::kValueFieldNumber; -#endif // !_MSC_VER - -Quantile::Quantile() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.Quantile) -} - -void Quantile::InitAsDefaultInstance() { -} - -Quantile::Quantile(const Quantile& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.Quantile) -} - -void Quantile::SharedCtor() { - _cached_size_ = 0; - quantile_ = 0; - value_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Quantile::~Quantile() { - // @@protoc_insertion_point(destructor:io.prometheus.client.Quantile) - SharedDtor(); -} - -void Quantile::SharedDtor() { - if (this != default_instance_) { - } -} - -void Quantile::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Quantile::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Quantile_descriptor_; -} - -const Quantile& Quantile::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -Quantile* Quantile::default_instance_ = NULL; - -Quantile* Quantile::New() const { - return new Quantile; -} - -void Quantile::Clear() { -#define OFFSET_OF_FIELD_(f) (reinterpret_cast( \ - &reinterpret_cast(16)->f) - \ - reinterpret_cast(16)) - -#define ZR_(first, last) do { \ - size_t f = OFFSET_OF_FIELD_(first); \ - size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \ - ::memset(&first, 0, n); \ - } while (0) - - ZR_(quantile_, value_); - -#undef OFFSET_OF_FIELD_ -#undef ZR_ - - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Quantile::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.Quantile) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional double quantile = 1; - case 1: { - if (tag == 9) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &quantile_))); - set_has_quantile(); - } else { - goto handle_unusual; - } - if (input->ExpectTag(17)) goto parse_value; - break; - } - - // optional double value = 2; - case 2: { - if (tag == 17) { - parse_value: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &value_))); - set_has_value(); - } else { - goto handle_unusual; - } - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.Quantile) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.Quantile) - return false; -#undef DO_ -} - -void Quantile::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.Quantile) - // optional double quantile = 1; - if (has_quantile()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(1, this->quantile(), output); - } - - // optional double value = 2; - if (has_value()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->value(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.Quantile) -} - -::google::protobuf::uint8* Quantile::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.Quantile) - // optional double quantile = 1; - if (has_quantile()) { - target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(1, this->quantile(), target); - } - - // optional double value = 2; - if (has_value()) { - target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(2, this->value(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.Quantile) - return target; -} - -int Quantile::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional double quantile = 1; - if (has_quantile()) { - total_size += 1 + 8; - } - - // optional double value = 2; - if (has_value()) { - total_size += 1 + 8; - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Quantile::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Quantile* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Quantile::MergeFrom(const Quantile& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_quantile()) { - set_quantile(from.quantile()); - } - if (from.has_value()) { - set_value(from.value()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Quantile::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Quantile::CopyFrom(const Quantile& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Quantile::IsInitialized() const { - - return true; -} - -void Quantile::Swap(Quantile* other) { - if (other != this) { - std::swap(quantile_, other->quantile_); - std::swap(value_, other->value_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Quantile::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Quantile_descriptor_; - metadata.reflection = Quantile_reflection_; - return metadata; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int Summary::kSampleCountFieldNumber; -const int Summary::kSampleSumFieldNumber; -const int Summary::kQuantileFieldNumber; -#endif // !_MSC_VER - -Summary::Summary() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.Summary) -} - -void Summary::InitAsDefaultInstance() { -} - -Summary::Summary(const Summary& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.Summary) -} - -void Summary::SharedCtor() { - _cached_size_ = 0; - sample_count_ = GOOGLE_ULONGLONG(0); - sample_sum_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Summary::~Summary() { - // @@protoc_insertion_point(destructor:io.prometheus.client.Summary) - SharedDtor(); -} - -void Summary::SharedDtor() { - if (this != default_instance_) { - } -} - -void Summary::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Summary::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Summary_descriptor_; -} - -const Summary& Summary::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -Summary* Summary::default_instance_ = NULL; - -Summary* Summary::New() const { - return new Summary; -} - -void Summary::Clear() { -#define OFFSET_OF_FIELD_(f) (reinterpret_cast( \ - &reinterpret_cast(16)->f) - \ - reinterpret_cast(16)) - -#define ZR_(first, last) do { \ - size_t f = OFFSET_OF_FIELD_(first); \ - size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \ - ::memset(&first, 0, n); \ - } while (0) - - ZR_(sample_count_, sample_sum_); - -#undef OFFSET_OF_FIELD_ -#undef ZR_ - - quantile_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Summary::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.Summary) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional uint64 sample_count = 1; - case 1: { - if (tag == 8) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( - input, &sample_count_))); - set_has_sample_count(); - } else { - goto handle_unusual; - } - if (input->ExpectTag(17)) goto parse_sample_sum; - break; - } - - // optional double sample_sum = 2; - case 2: { - if (tag == 17) { - parse_sample_sum: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &sample_sum_))); - set_has_sample_sum(); - } else { - goto handle_unusual; - } - if (input->ExpectTag(26)) goto parse_quantile; - break; - } - - // repeated .io.prometheus.client.Quantile quantile = 3; - case 3: { - if (tag == 26) { - parse_quantile: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_quantile())); - } else { - goto handle_unusual; - } - if (input->ExpectTag(26)) goto parse_quantile; - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.Summary) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.Summary) - return false; -#undef DO_ -} - -void Summary::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.Summary) - // optional uint64 sample_count = 1; - if (has_sample_count()) { - ::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->sample_count(), output); - } - - // optional double sample_sum = 2; - if (has_sample_sum()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->sample_sum(), output); - } - - // repeated .io.prometheus.client.Quantile quantile = 3; - for (int i = 0; i < this->quantile_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->quantile(i), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.Summary) -} - -::google::protobuf::uint8* Summary::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.Summary) - // optional uint64 sample_count = 1; - if (has_sample_count()) { - target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->sample_count(), target); - } - - // optional double sample_sum = 2; - if (has_sample_sum()) { - target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(2, this->sample_sum(), target); - } - - // repeated .io.prometheus.client.Quantile quantile = 3; - for (int i = 0; i < this->quantile_size(); i++) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 3, this->quantile(i), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.Summary) - return target; -} - -int Summary::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional uint64 sample_count = 1; - if (has_sample_count()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::UInt64Size( - this->sample_count()); - } - - // optional double sample_sum = 2; - if (has_sample_sum()) { - total_size += 1 + 8; - } - - } - // repeated .io.prometheus.client.Quantile quantile = 3; - total_size += 1 * this->quantile_size(); - for (int i = 0; i < this->quantile_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->quantile(i)); - } - - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Summary::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Summary* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Summary::MergeFrom(const Summary& from) { - GOOGLE_CHECK_NE(&from, this); - quantile_.MergeFrom(from.quantile_); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_sample_count()) { - set_sample_count(from.sample_count()); - } - if (from.has_sample_sum()) { - set_sample_sum(from.sample_sum()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Summary::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Summary::CopyFrom(const Summary& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Summary::IsInitialized() const { - - return true; -} - -void Summary::Swap(Summary* other) { - if (other != this) { - std::swap(sample_count_, other->sample_count_); - std::swap(sample_sum_, other->sample_sum_); - quantile_.Swap(&other->quantile_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Summary::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Summary_descriptor_; - metadata.reflection = Summary_reflection_; - return metadata; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int Untyped::kValueFieldNumber; -#endif // !_MSC_VER - -Untyped::Untyped() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.Untyped) -} - -void Untyped::InitAsDefaultInstance() { -} - -Untyped::Untyped(const Untyped& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.Untyped) -} - -void Untyped::SharedCtor() { - _cached_size_ = 0; - value_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Untyped::~Untyped() { - // @@protoc_insertion_point(destructor:io.prometheus.client.Untyped) - SharedDtor(); -} - -void Untyped::SharedDtor() { - if (this != default_instance_) { - } -} - -void Untyped::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Untyped::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Untyped_descriptor_; -} - -const Untyped& Untyped::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -Untyped* Untyped::default_instance_ = NULL; - -Untyped* Untyped::New() const { - return new Untyped; -} - -void Untyped::Clear() { - value_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Untyped::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.Untyped) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional double value = 1; - case 1: { - if (tag == 9) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &value_))); - set_has_value(); - } else { - goto handle_unusual; - } - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.Untyped) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.Untyped) - return false; -#undef DO_ -} - -void Untyped::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.Untyped) - // optional double value = 1; - if (has_value()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(1, this->value(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.Untyped) -} - -::google::protobuf::uint8* Untyped::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.Untyped) - // optional double value = 1; - if (has_value()) { - target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(1, this->value(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.Untyped) - return target; -} - -int Untyped::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional double value = 1; - if (has_value()) { - total_size += 1 + 8; - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Untyped::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Untyped* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Untyped::MergeFrom(const Untyped& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_value()) { - set_value(from.value()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Untyped::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Untyped::CopyFrom(const Untyped& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Untyped::IsInitialized() const { - - return true; -} - -void Untyped::Swap(Untyped* other) { - if (other != this) { - std::swap(value_, other->value_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Untyped::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Untyped_descriptor_; - metadata.reflection = Untyped_reflection_; - return metadata; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int Histogram::kSampleCountFieldNumber; -const int Histogram::kSampleSumFieldNumber; -const int Histogram::kBucketFieldNumber; -#endif // !_MSC_VER - -Histogram::Histogram() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.Histogram) -} - -void Histogram::InitAsDefaultInstance() { -} - -Histogram::Histogram(const Histogram& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.Histogram) -} - -void Histogram::SharedCtor() { - _cached_size_ = 0; - sample_count_ = GOOGLE_ULONGLONG(0); - sample_sum_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Histogram::~Histogram() { - // @@protoc_insertion_point(destructor:io.prometheus.client.Histogram) - SharedDtor(); -} - -void Histogram::SharedDtor() { - if (this != default_instance_) { - } -} - -void Histogram::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Histogram::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Histogram_descriptor_; -} - -const Histogram& Histogram::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -Histogram* Histogram::default_instance_ = NULL; - -Histogram* Histogram::New() const { - return new Histogram; -} - -void Histogram::Clear() { -#define OFFSET_OF_FIELD_(f) (reinterpret_cast( \ - &reinterpret_cast(16)->f) - \ - reinterpret_cast(16)) - -#define ZR_(first, last) do { \ - size_t f = OFFSET_OF_FIELD_(first); \ - size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \ - ::memset(&first, 0, n); \ - } while (0) - - ZR_(sample_count_, sample_sum_); - -#undef OFFSET_OF_FIELD_ -#undef ZR_ - - bucket_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Histogram::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.Histogram) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional uint64 sample_count = 1; - case 1: { - if (tag == 8) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( - input, &sample_count_))); - set_has_sample_count(); - } else { - goto handle_unusual; - } - if (input->ExpectTag(17)) goto parse_sample_sum; - break; - } - - // optional double sample_sum = 2; - case 2: { - if (tag == 17) { - parse_sample_sum: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &sample_sum_))); - set_has_sample_sum(); - } else { - goto handle_unusual; - } - if (input->ExpectTag(26)) goto parse_bucket; - break; - } - - // repeated .io.prometheus.client.Bucket bucket = 3; - case 3: { - if (tag == 26) { - parse_bucket: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_bucket())); - } else { - goto handle_unusual; - } - if (input->ExpectTag(26)) goto parse_bucket; - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.Histogram) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.Histogram) - return false; -#undef DO_ -} - -void Histogram::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.Histogram) - // optional uint64 sample_count = 1; - if (has_sample_count()) { - ::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->sample_count(), output); - } - - // optional double sample_sum = 2; - if (has_sample_sum()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->sample_sum(), output); - } - - // repeated .io.prometheus.client.Bucket bucket = 3; - for (int i = 0; i < this->bucket_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->bucket(i), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.Histogram) -} - -::google::protobuf::uint8* Histogram::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.Histogram) - // optional uint64 sample_count = 1; - if (has_sample_count()) { - target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->sample_count(), target); - } - - // optional double sample_sum = 2; - if (has_sample_sum()) { - target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(2, this->sample_sum(), target); - } - - // repeated .io.prometheus.client.Bucket bucket = 3; - for (int i = 0; i < this->bucket_size(); i++) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 3, this->bucket(i), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.Histogram) - return target; -} - -int Histogram::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional uint64 sample_count = 1; - if (has_sample_count()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::UInt64Size( - this->sample_count()); - } - - // optional double sample_sum = 2; - if (has_sample_sum()) { - total_size += 1 + 8; - } - - } - // repeated .io.prometheus.client.Bucket bucket = 3; - total_size += 1 * this->bucket_size(); - for (int i = 0; i < this->bucket_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->bucket(i)); - } - - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Histogram::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Histogram* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Histogram::MergeFrom(const Histogram& from) { - GOOGLE_CHECK_NE(&from, this); - bucket_.MergeFrom(from.bucket_); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_sample_count()) { - set_sample_count(from.sample_count()); - } - if (from.has_sample_sum()) { - set_sample_sum(from.sample_sum()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Histogram::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Histogram::CopyFrom(const Histogram& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Histogram::IsInitialized() const { - - return true; -} - -void Histogram::Swap(Histogram* other) { - if (other != this) { - std::swap(sample_count_, other->sample_count_); - std::swap(sample_sum_, other->sample_sum_); - bucket_.Swap(&other->bucket_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Histogram::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Histogram_descriptor_; - metadata.reflection = Histogram_reflection_; - return metadata; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int Bucket::kCumulativeCountFieldNumber; -const int Bucket::kUpperBoundFieldNumber; -#endif // !_MSC_VER - -Bucket::Bucket() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.Bucket) -} - -void Bucket::InitAsDefaultInstance() { -} - -Bucket::Bucket(const Bucket& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.Bucket) -} - -void Bucket::SharedCtor() { - _cached_size_ = 0; - cumulative_count_ = GOOGLE_ULONGLONG(0); - upper_bound_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Bucket::~Bucket() { - // @@protoc_insertion_point(destructor:io.prometheus.client.Bucket) - SharedDtor(); -} - -void Bucket::SharedDtor() { - if (this != default_instance_) { - } -} - -void Bucket::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Bucket::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Bucket_descriptor_; -} - -const Bucket& Bucket::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -Bucket* Bucket::default_instance_ = NULL; - -Bucket* Bucket::New() const { - return new Bucket; -} - -void Bucket::Clear() { -#define OFFSET_OF_FIELD_(f) (reinterpret_cast( \ - &reinterpret_cast(16)->f) - \ - reinterpret_cast(16)) - -#define ZR_(first, last) do { \ - size_t f = OFFSET_OF_FIELD_(first); \ - size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \ - ::memset(&first, 0, n); \ - } while (0) - - ZR_(cumulative_count_, upper_bound_); - -#undef OFFSET_OF_FIELD_ -#undef ZR_ - - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Bucket::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.Bucket) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional uint64 cumulative_count = 1; - case 1: { - if (tag == 8) { - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( - input, &cumulative_count_))); - set_has_cumulative_count(); - } else { - goto handle_unusual; - } - if (input->ExpectTag(17)) goto parse_upper_bound; - break; - } - - // optional double upper_bound = 2; - case 2: { - if (tag == 17) { - parse_upper_bound: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( - input, &upper_bound_))); - set_has_upper_bound(); - } else { - goto handle_unusual; - } - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.Bucket) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.Bucket) - return false; -#undef DO_ -} - -void Bucket::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.Bucket) - // optional uint64 cumulative_count = 1; - if (has_cumulative_count()) { - ::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->cumulative_count(), output); - } - - // optional double upper_bound = 2; - if (has_upper_bound()) { - ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->upper_bound(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.Bucket) -} - -::google::protobuf::uint8* Bucket::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.Bucket) - // optional uint64 cumulative_count = 1; - if (has_cumulative_count()) { - target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->cumulative_count(), target); - } - - // optional double upper_bound = 2; - if (has_upper_bound()) { - target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(2, this->upper_bound(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.Bucket) - return target; -} - -int Bucket::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional uint64 cumulative_count = 1; - if (has_cumulative_count()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::UInt64Size( - this->cumulative_count()); - } - - // optional double upper_bound = 2; - if (has_upper_bound()) { - total_size += 1 + 8; - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Bucket::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Bucket* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Bucket::MergeFrom(const Bucket& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_cumulative_count()) { - set_cumulative_count(from.cumulative_count()); - } - if (from.has_upper_bound()) { - set_upper_bound(from.upper_bound()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Bucket::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Bucket::CopyFrom(const Bucket& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Bucket::IsInitialized() const { - - return true; -} - -void Bucket::Swap(Bucket* other) { - if (other != this) { - std::swap(cumulative_count_, other->cumulative_count_); - std::swap(upper_bound_, other->upper_bound_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Bucket::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Bucket_descriptor_; - metadata.reflection = Bucket_reflection_; - return metadata; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int Metric::kLabelFieldNumber; -const int Metric::kGaugeFieldNumber; -const int Metric::kCounterFieldNumber; -const int Metric::kSummaryFieldNumber; -const int Metric::kUntypedFieldNumber; -const int Metric::kHistogramFieldNumber; -const int Metric::kTimestampMsFieldNumber; -#endif // !_MSC_VER - -Metric::Metric() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.Metric) -} - -void Metric::InitAsDefaultInstance() { - gauge_ = const_cast< ::io::prometheus::client::Gauge*>(&::io::prometheus::client::Gauge::default_instance()); - counter_ = const_cast< ::io::prometheus::client::Counter*>(&::io::prometheus::client::Counter::default_instance()); - summary_ = const_cast< ::io::prometheus::client::Summary*>(&::io::prometheus::client::Summary::default_instance()); - untyped_ = const_cast< ::io::prometheus::client::Untyped*>(&::io::prometheus::client::Untyped::default_instance()); - histogram_ = const_cast< ::io::prometheus::client::Histogram*>(&::io::prometheus::client::Histogram::default_instance()); -} - -Metric::Metric(const Metric& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.Metric) -} - -void Metric::SharedCtor() { - _cached_size_ = 0; - gauge_ = NULL; - counter_ = NULL; - summary_ = NULL; - untyped_ = NULL; - histogram_ = NULL; - timestamp_ms_ = GOOGLE_LONGLONG(0); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Metric::~Metric() { - // @@protoc_insertion_point(destructor:io.prometheus.client.Metric) - SharedDtor(); -} - -void Metric::SharedDtor() { - if (this != default_instance_) { - delete gauge_; - delete counter_; - delete summary_; - delete untyped_; - delete histogram_; - } -} - -void Metric::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Metric::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Metric_descriptor_; -} - -const Metric& Metric::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -Metric* Metric::default_instance_ = NULL; - -Metric* Metric::New() const { - return new Metric; -} - -void Metric::Clear() { - if (_has_bits_[0 / 32] & 126) { - if (has_gauge()) { - if (gauge_ != NULL) gauge_->::io::prometheus::client::Gauge::Clear(); - } - if (has_counter()) { - if (counter_ != NULL) counter_->::io::prometheus::client::Counter::Clear(); - } - if (has_summary()) { - if (summary_ != NULL) summary_->::io::prometheus::client::Summary::Clear(); - } - if (has_untyped()) { - if (untyped_ != NULL) untyped_->::io::prometheus::client::Untyped::Clear(); - } - if (has_histogram()) { - if (histogram_ != NULL) histogram_->::io::prometheus::client::Histogram::Clear(); - } - timestamp_ms_ = GOOGLE_LONGLONG(0); - } - label_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Metric::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.Metric) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .io.prometheus.client.LabelPair label = 1; - case 1: { - if (tag == 10) { - parse_label: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_label())); - } else { - goto handle_unusual; - } - if (input->ExpectTag(10)) goto parse_label; - if (input->ExpectTag(18)) goto parse_gauge; - break; - } - - // optional .io.prometheus.client.Gauge gauge = 2; - case 2: { - if (tag == 18) { - parse_gauge: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_gauge())); - } else { - goto handle_unusual; - } - if (input->ExpectTag(26)) goto parse_counter; - break; - } - - // optional .io.prometheus.client.Counter counter = 3; - case 3: { - if (tag == 26) { - parse_counter: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_counter())); - } else { - goto handle_unusual; - } - if (input->ExpectTag(34)) goto parse_summary; - break; - } - - // optional .io.prometheus.client.Summary summary = 4; - case 4: { - if (tag == 34) { - parse_summary: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_summary())); - } else { - goto handle_unusual; - } - if (input->ExpectTag(42)) goto parse_untyped; - break; - } - - // optional .io.prometheus.client.Untyped untyped = 5; - case 5: { - if (tag == 42) { - parse_untyped: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_untyped())); - } else { - goto handle_unusual; - } - if (input->ExpectTag(48)) goto parse_timestamp_ms; - break; - } - - // optional int64 timestamp_ms = 6; - case 6: { - if (tag == 48) { - parse_timestamp_ms: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, ×tamp_ms_))); - set_has_timestamp_ms(); - } else { - goto handle_unusual; - } - if (input->ExpectTag(58)) goto parse_histogram; - break; - } - - // optional .io.prometheus.client.Histogram histogram = 7; - case 7: { - if (tag == 58) { - parse_histogram: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_histogram())); - } else { - goto handle_unusual; - } - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.Metric) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.Metric) - return false; -#undef DO_ -} - -void Metric::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.Metric) - // repeated .io.prometheus.client.LabelPair label = 1; - for (int i = 0; i < this->label_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 1, this->label(i), output); - } - - // optional .io.prometheus.client.Gauge gauge = 2; - if (has_gauge()) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 2, this->gauge(), output); - } - - // optional .io.prometheus.client.Counter counter = 3; - if (has_counter()) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 3, this->counter(), output); - } - - // optional .io.prometheus.client.Summary summary = 4; - if (has_summary()) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, this->summary(), output); - } - - // optional .io.prometheus.client.Untyped untyped = 5; - if (has_untyped()) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 5, this->untyped(), output); - } - - // optional int64 timestamp_ms = 6; - if (has_timestamp_ms()) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(6, this->timestamp_ms(), output); - } - - // optional .io.prometheus.client.Histogram histogram = 7; - if (has_histogram()) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 7, this->histogram(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.Metric) -} - -::google::protobuf::uint8* Metric::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.Metric) - // repeated .io.prometheus.client.LabelPair label = 1; - for (int i = 0; i < this->label_size(); i++) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 1, this->label(i), target); - } - - // optional .io.prometheus.client.Gauge gauge = 2; - if (has_gauge()) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 2, this->gauge(), target); - } - - // optional .io.prometheus.client.Counter counter = 3; - if (has_counter()) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 3, this->counter(), target); - } - - // optional .io.prometheus.client.Summary summary = 4; - if (has_summary()) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 4, this->summary(), target); - } - - // optional .io.prometheus.client.Untyped untyped = 5; - if (has_untyped()) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 5, this->untyped(), target); - } - - // optional int64 timestamp_ms = 6; - if (has_timestamp_ms()) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(6, this->timestamp_ms(), target); - } - - // optional .io.prometheus.client.Histogram histogram = 7; - if (has_histogram()) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 7, this->histogram(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.Metric) - return target; -} - -int Metric::ByteSize() const { - int total_size = 0; - - if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { - // optional .io.prometheus.client.Gauge gauge = 2; - if (has_gauge()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->gauge()); - } - - // optional .io.prometheus.client.Counter counter = 3; - if (has_counter()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->counter()); - } - - // optional .io.prometheus.client.Summary summary = 4; - if (has_summary()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->summary()); - } - - // optional .io.prometheus.client.Untyped untyped = 5; - if (has_untyped()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->untyped()); - } - - // optional .io.prometheus.client.Histogram histogram = 7; - if (has_histogram()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->histogram()); - } - - // optional int64 timestamp_ms = 6; - if (has_timestamp_ms()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int64Size( - this->timestamp_ms()); - } - - } - // repeated .io.prometheus.client.LabelPair label = 1; - total_size += 1 * this->label_size(); - for (int i = 0; i < this->label_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->label(i)); - } - - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Metric::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Metric* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Metric::MergeFrom(const Metric& from) { - GOOGLE_CHECK_NE(&from, this); - label_.MergeFrom(from.label_); - if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) { - if (from.has_gauge()) { - mutable_gauge()->::io::prometheus::client::Gauge::MergeFrom(from.gauge()); - } - if (from.has_counter()) { - mutable_counter()->::io::prometheus::client::Counter::MergeFrom(from.counter()); - } - if (from.has_summary()) { - mutable_summary()->::io::prometheus::client::Summary::MergeFrom(from.summary()); - } - if (from.has_untyped()) { - mutable_untyped()->::io::prometheus::client::Untyped::MergeFrom(from.untyped()); - } - if (from.has_histogram()) { - mutable_histogram()->::io::prometheus::client::Histogram::MergeFrom(from.histogram()); - } - if (from.has_timestamp_ms()) { - set_timestamp_ms(from.timestamp_ms()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Metric::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Metric::CopyFrom(const Metric& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Metric::IsInitialized() const { - - return true; -} - -void Metric::Swap(Metric* other) { - if (other != this) { - label_.Swap(&other->label_); - std::swap(gauge_, other->gauge_); - std::swap(counter_, other->counter_); - std::swap(summary_, other->summary_); - std::swap(untyped_, other->untyped_); - std::swap(histogram_, other->histogram_); - std::swap(timestamp_ms_, other->timestamp_ms_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Metric::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Metric_descriptor_; - metadata.reflection = Metric_reflection_; - return metadata; -} - - -// =================================================================== - -#ifndef _MSC_VER -const int MetricFamily::kNameFieldNumber; -const int MetricFamily::kHelpFieldNumber; -const int MetricFamily::kTypeFieldNumber; -const int MetricFamily::kMetricFieldNumber; -#endif // !_MSC_VER - -MetricFamily::MetricFamily() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:io.prometheus.client.MetricFamily) -} - -void MetricFamily::InitAsDefaultInstance() { -} - -MetricFamily::MetricFamily(const MetricFamily& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:io.prometheus.client.MetricFamily) -} - -void MetricFamily::SharedCtor() { - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - help_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - type_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -MetricFamily::~MetricFamily() { - // @@protoc_insertion_point(destructor:io.prometheus.client.MetricFamily) - SharedDtor(); -} - -void MetricFamily::SharedDtor() { - if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete name_; - } - if (help_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete help_; - } - if (this != default_instance_) { - } -} - -void MetricFamily::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* MetricFamily::descriptor() { - protobuf_AssignDescriptorsOnce(); - return MetricFamily_descriptor_; -} - -const MetricFamily& MetricFamily::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_metrics_2eproto(); - return *default_instance_; -} - -MetricFamily* MetricFamily::default_instance_ = NULL; - -MetricFamily* MetricFamily::New() const { - return new MetricFamily; -} - -void MetricFamily::Clear() { - if (_has_bits_[0 / 32] & 7) { - if (has_name()) { - if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_->clear(); - } - } - if (has_help()) { - if (help_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - help_->clear(); - } - } - type_ = 0; - } - metric_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool MetricFamily::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:io.prometheus.client.MetricFamily) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string name = 1; - case 1: { - if (tag == 10) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_name())); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), - ::google::protobuf::internal::WireFormat::PARSE, - "name"); - } else { - goto handle_unusual; - } - if (input->ExpectTag(18)) goto parse_help; - break; - } - - // optional string help = 2; - case 2: { - if (tag == 18) { - parse_help: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_help())); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->help().data(), this->help().length(), - ::google::protobuf::internal::WireFormat::PARSE, - "help"); - } else { - goto handle_unusual; - } - if (input->ExpectTag(24)) goto parse_type; - break; - } - - // optional .io.prometheus.client.MetricType type = 3; - case 3: { - if (tag == 24) { - parse_type: - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::io::prometheus::client::MetricType_IsValid(value)) { - set_type(static_cast< ::io::prometheus::client::MetricType >(value)); - } else { - mutable_unknown_fields()->AddVarint(3, value); - } - } else { - goto handle_unusual; - } - if (input->ExpectTag(34)) goto parse_metric; - break; - } - - // repeated .io.prometheus.client.Metric metric = 4; - case 4: { - if (tag == 34) { - parse_metric: - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_metric())); - } else { - goto handle_unusual; - } - if (input->ExpectTag(34)) goto parse_metric; - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:io.prometheus.client.MetricFamily) - return true; -failure: - // @@protoc_insertion_point(parse_failure:io.prometheus.client.MetricFamily) - return false; -#undef DO_ -} - -void MetricFamily::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:io.prometheus.client.MetricFamily) - // optional string name = 1; - if (has_name()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "name"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->name(), output); - } - - // optional string help = 2; - if (has_help()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->help().data(), this->help().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "help"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 2, this->help(), output); - } - - // optional .io.prometheus.client.MetricType type = 3; - if (has_type()) { - ::google::protobuf::internal::WireFormatLite::WriteEnum( - 3, this->type(), output); - } - - // repeated .io.prometheus.client.Metric metric = 4; - for (int i = 0; i < this->metric_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( - 4, this->metric(i), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:io.prometheus.client.MetricFamily) -} - -::google::protobuf::uint8* MetricFamily::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:io.prometheus.client.MetricFamily) - // optional string name = 1; - if (has_name()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->name().data(), this->name().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "name"); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->name(), target); - } - - // optional string help = 2; - if (has_help()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->help().data(), this->help().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "help"); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 2, this->help(), target); - } - - // optional .io.prometheus.client.MetricType type = 3; - if (has_type()) { - target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( - 3, this->type(), target); - } - - // repeated .io.prometheus.client.Metric metric = 4; - for (int i = 0; i < this->metric_size(); i++) { - target = ::google::protobuf::internal::WireFormatLite:: - WriteMessageNoVirtualToArray( - 4, this->metric(i), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:io.prometheus.client.MetricFamily) - return target; -} - -int MetricFamily::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional string name = 1; - if (has_name()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - } - - // optional string help = 2; - if (has_help()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->help()); - } - - // optional .io.prometheus.client.MetricType type = 3; - if (has_type()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); - } - - } - // repeated .io.prometheus.client.Metric metric = 4; - total_size += 1 * this->metric_size(); - for (int i = 0; i < this->metric_size(); i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->metric(i)); - } - - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void MetricFamily::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const MetricFamily* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void MetricFamily::MergeFrom(const MetricFamily& from) { - GOOGLE_CHECK_NE(&from, this); - metric_.MergeFrom(from.metric_); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_name()) { - set_name(from.name()); - } - if (from.has_help()) { - set_help(from.help()); - } - if (from.has_type()) { - set_type(from.type()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void MetricFamily::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void MetricFamily::CopyFrom(const MetricFamily& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool MetricFamily::IsInitialized() const { - - return true; -} - -void MetricFamily::Swap(MetricFamily* other) { - if (other != this) { - std::swap(name_, other->name_); - std::swap(help_, other->help_); - std::swap(type_, other->type_); - metric_.Swap(&other->metric_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata MetricFamily::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = MetricFamily_descriptor_; - metadata.reflection = MetricFamily_reflection_; - return metadata; -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace client -} // namespace prometheus -} // namespace io - -// @@protoc_insertion_point(global_scope) diff --git a/vendor/github.com/prometheus/client_model/cpp/metrics.pb.h b/vendor/github.com/prometheus/client_model/cpp/metrics.pb.h deleted file mode 100644 index 206ba3704..000000000 --- a/vendor/github.com/prometheus/client_model/cpp/metrics.pb.h +++ /dev/null @@ -1,2072 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: metrics.proto - -#ifndef PROTOBUF_metrics_2eproto__INCLUDED -#define PROTOBUF_metrics_2eproto__INCLUDED - -#include - -#include - -#if GOOGLE_PROTOBUF_VERSION < 2006000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 2006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif - -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace io { -namespace prometheus { -namespace client { - -// Internal implementation detail -- do not call these. -void protobuf_AddDesc_metrics_2eproto(); -void protobuf_AssignDesc_metrics_2eproto(); -void protobuf_ShutdownFile_metrics_2eproto(); - -class LabelPair; -class Gauge; -class Counter; -class Quantile; -class Summary; -class Untyped; -class Histogram; -class Bucket; -class Metric; -class MetricFamily; - -enum MetricType { - COUNTER = 0, - GAUGE = 1, - SUMMARY = 2, - UNTYPED = 3, - HISTOGRAM = 4 -}; -bool MetricType_IsValid(int value); -const MetricType MetricType_MIN = COUNTER; -const MetricType MetricType_MAX = HISTOGRAM; -const int MetricType_ARRAYSIZE = MetricType_MAX + 1; - -const ::google::protobuf::EnumDescriptor* MetricType_descriptor(); -inline const ::std::string& MetricType_Name(MetricType value) { - return ::google::protobuf::internal::NameOfEnum( - MetricType_descriptor(), value); -} -inline bool MetricType_Parse( - const ::std::string& name, MetricType* value) { - return ::google::protobuf::internal::ParseNamedEnum( - MetricType_descriptor(), name, value); -} -// =================================================================== - -class LabelPair : public ::google::protobuf::Message { - public: - LabelPair(); - virtual ~LabelPair(); - - LabelPair(const LabelPair& from); - - inline LabelPair& operator=(const LabelPair& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const LabelPair& default_instance(); - - void Swap(LabelPair* other); - - // implements Message ---------------------------------------------- - - LabelPair* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const LabelPair& from); - void MergeFrom(const LabelPair& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional string name = 1; - inline bool has_name() const; - inline void clear_name(); - static const int kNameFieldNumber = 1; - inline const ::std::string& name() const; - inline void set_name(const ::std::string& value); - inline void set_name(const char* value); - inline void set_name(const char* value, size_t size); - inline ::std::string* mutable_name(); - inline ::std::string* release_name(); - inline void set_allocated_name(::std::string* name); - - // optional string value = 2; - inline bool has_value() const; - inline void clear_value(); - static const int kValueFieldNumber = 2; - inline const ::std::string& value() const; - inline void set_value(const ::std::string& value); - inline void set_value(const char* value); - inline void set_value(const char* value, size_t size); - inline ::std::string* mutable_value(); - inline ::std::string* release_value(); - inline void set_allocated_value(::std::string* value); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.LabelPair) - private: - inline void set_has_name(); - inline void clear_has_name(); - inline void set_has_value(); - inline void clear_has_value(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::std::string* name_; - ::std::string* value_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static LabelPair* default_instance_; -}; -// ------------------------------------------------------------------- - -class Gauge : public ::google::protobuf::Message { - public: - Gauge(); - virtual ~Gauge(); - - Gauge(const Gauge& from); - - inline Gauge& operator=(const Gauge& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Gauge& default_instance(); - - void Swap(Gauge* other); - - // implements Message ---------------------------------------------- - - Gauge* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Gauge& from); - void MergeFrom(const Gauge& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional double value = 1; - inline bool has_value() const; - inline void clear_value(); - static const int kValueFieldNumber = 1; - inline double value() const; - inline void set_value(double value); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Gauge) - private: - inline void set_has_value(); - inline void clear_has_value(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - double value_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static Gauge* default_instance_; -}; -// ------------------------------------------------------------------- - -class Counter : public ::google::protobuf::Message { - public: - Counter(); - virtual ~Counter(); - - Counter(const Counter& from); - - inline Counter& operator=(const Counter& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Counter& default_instance(); - - void Swap(Counter* other); - - // implements Message ---------------------------------------------- - - Counter* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Counter& from); - void MergeFrom(const Counter& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional double value = 1; - inline bool has_value() const; - inline void clear_value(); - static const int kValueFieldNumber = 1; - inline double value() const; - inline void set_value(double value); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Counter) - private: - inline void set_has_value(); - inline void clear_has_value(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - double value_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static Counter* default_instance_; -}; -// ------------------------------------------------------------------- - -class Quantile : public ::google::protobuf::Message { - public: - Quantile(); - virtual ~Quantile(); - - Quantile(const Quantile& from); - - inline Quantile& operator=(const Quantile& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Quantile& default_instance(); - - void Swap(Quantile* other); - - // implements Message ---------------------------------------------- - - Quantile* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Quantile& from); - void MergeFrom(const Quantile& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional double quantile = 1; - inline bool has_quantile() const; - inline void clear_quantile(); - static const int kQuantileFieldNumber = 1; - inline double quantile() const; - inline void set_quantile(double value); - - // optional double value = 2; - inline bool has_value() const; - inline void clear_value(); - static const int kValueFieldNumber = 2; - inline double value() const; - inline void set_value(double value); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Quantile) - private: - inline void set_has_quantile(); - inline void clear_has_quantile(); - inline void set_has_value(); - inline void clear_has_value(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - double quantile_; - double value_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static Quantile* default_instance_; -}; -// ------------------------------------------------------------------- - -class Summary : public ::google::protobuf::Message { - public: - Summary(); - virtual ~Summary(); - - Summary(const Summary& from); - - inline Summary& operator=(const Summary& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Summary& default_instance(); - - void Swap(Summary* other); - - // implements Message ---------------------------------------------- - - Summary* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Summary& from); - void MergeFrom(const Summary& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional uint64 sample_count = 1; - inline bool has_sample_count() const; - inline void clear_sample_count(); - static const int kSampleCountFieldNumber = 1; - inline ::google::protobuf::uint64 sample_count() const; - inline void set_sample_count(::google::protobuf::uint64 value); - - // optional double sample_sum = 2; - inline bool has_sample_sum() const; - inline void clear_sample_sum(); - static const int kSampleSumFieldNumber = 2; - inline double sample_sum() const; - inline void set_sample_sum(double value); - - // repeated .io.prometheus.client.Quantile quantile = 3; - inline int quantile_size() const; - inline void clear_quantile(); - static const int kQuantileFieldNumber = 3; - inline const ::io::prometheus::client::Quantile& quantile(int index) const; - inline ::io::prometheus::client::Quantile* mutable_quantile(int index); - inline ::io::prometheus::client::Quantile* add_quantile(); - inline const ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Quantile >& - quantile() const; - inline ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Quantile >* - mutable_quantile(); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Summary) - private: - inline void set_has_sample_count(); - inline void clear_has_sample_count(); - inline void set_has_sample_sum(); - inline void clear_has_sample_sum(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::google::protobuf::uint64 sample_count_; - double sample_sum_; - ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Quantile > quantile_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static Summary* default_instance_; -}; -// ------------------------------------------------------------------- - -class Untyped : public ::google::protobuf::Message { - public: - Untyped(); - virtual ~Untyped(); - - Untyped(const Untyped& from); - - inline Untyped& operator=(const Untyped& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Untyped& default_instance(); - - void Swap(Untyped* other); - - // implements Message ---------------------------------------------- - - Untyped* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Untyped& from); - void MergeFrom(const Untyped& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional double value = 1; - inline bool has_value() const; - inline void clear_value(); - static const int kValueFieldNumber = 1; - inline double value() const; - inline void set_value(double value); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Untyped) - private: - inline void set_has_value(); - inline void clear_has_value(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - double value_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static Untyped* default_instance_; -}; -// ------------------------------------------------------------------- - -class Histogram : public ::google::protobuf::Message { - public: - Histogram(); - virtual ~Histogram(); - - Histogram(const Histogram& from); - - inline Histogram& operator=(const Histogram& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Histogram& default_instance(); - - void Swap(Histogram* other); - - // implements Message ---------------------------------------------- - - Histogram* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Histogram& from); - void MergeFrom(const Histogram& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional uint64 sample_count = 1; - inline bool has_sample_count() const; - inline void clear_sample_count(); - static const int kSampleCountFieldNumber = 1; - inline ::google::protobuf::uint64 sample_count() const; - inline void set_sample_count(::google::protobuf::uint64 value); - - // optional double sample_sum = 2; - inline bool has_sample_sum() const; - inline void clear_sample_sum(); - static const int kSampleSumFieldNumber = 2; - inline double sample_sum() const; - inline void set_sample_sum(double value); - - // repeated .io.prometheus.client.Bucket bucket = 3; - inline int bucket_size() const; - inline void clear_bucket(); - static const int kBucketFieldNumber = 3; - inline const ::io::prometheus::client::Bucket& bucket(int index) const; - inline ::io::prometheus::client::Bucket* mutable_bucket(int index); - inline ::io::prometheus::client::Bucket* add_bucket(); - inline const ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Bucket >& - bucket() const; - inline ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Bucket >* - mutable_bucket(); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Histogram) - private: - inline void set_has_sample_count(); - inline void clear_has_sample_count(); - inline void set_has_sample_sum(); - inline void clear_has_sample_sum(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::google::protobuf::uint64 sample_count_; - double sample_sum_; - ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Bucket > bucket_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static Histogram* default_instance_; -}; -// ------------------------------------------------------------------- - -class Bucket : public ::google::protobuf::Message { - public: - Bucket(); - virtual ~Bucket(); - - Bucket(const Bucket& from); - - inline Bucket& operator=(const Bucket& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Bucket& default_instance(); - - void Swap(Bucket* other); - - // implements Message ---------------------------------------------- - - Bucket* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Bucket& from); - void MergeFrom(const Bucket& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional uint64 cumulative_count = 1; - inline bool has_cumulative_count() const; - inline void clear_cumulative_count(); - static const int kCumulativeCountFieldNumber = 1; - inline ::google::protobuf::uint64 cumulative_count() const; - inline void set_cumulative_count(::google::protobuf::uint64 value); - - // optional double upper_bound = 2; - inline bool has_upper_bound() const; - inline void clear_upper_bound(); - static const int kUpperBoundFieldNumber = 2; - inline double upper_bound() const; - inline void set_upper_bound(double value); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Bucket) - private: - inline void set_has_cumulative_count(); - inline void clear_has_cumulative_count(); - inline void set_has_upper_bound(); - inline void clear_has_upper_bound(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::google::protobuf::uint64 cumulative_count_; - double upper_bound_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static Bucket* default_instance_; -}; -// ------------------------------------------------------------------- - -class Metric : public ::google::protobuf::Message { - public: - Metric(); - virtual ~Metric(); - - Metric(const Metric& from); - - inline Metric& operator=(const Metric& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Metric& default_instance(); - - void Swap(Metric* other); - - // implements Message ---------------------------------------------- - - Metric* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Metric& from); - void MergeFrom(const Metric& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated .io.prometheus.client.LabelPair label = 1; - inline int label_size() const; - inline void clear_label(); - static const int kLabelFieldNumber = 1; - inline const ::io::prometheus::client::LabelPair& label(int index) const; - inline ::io::prometheus::client::LabelPair* mutable_label(int index); - inline ::io::prometheus::client::LabelPair* add_label(); - inline const ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::LabelPair >& - label() const; - inline ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::LabelPair >* - mutable_label(); - - // optional .io.prometheus.client.Gauge gauge = 2; - inline bool has_gauge() const; - inline void clear_gauge(); - static const int kGaugeFieldNumber = 2; - inline const ::io::prometheus::client::Gauge& gauge() const; - inline ::io::prometheus::client::Gauge* mutable_gauge(); - inline ::io::prometheus::client::Gauge* release_gauge(); - inline void set_allocated_gauge(::io::prometheus::client::Gauge* gauge); - - // optional .io.prometheus.client.Counter counter = 3; - inline bool has_counter() const; - inline void clear_counter(); - static const int kCounterFieldNumber = 3; - inline const ::io::prometheus::client::Counter& counter() const; - inline ::io::prometheus::client::Counter* mutable_counter(); - inline ::io::prometheus::client::Counter* release_counter(); - inline void set_allocated_counter(::io::prometheus::client::Counter* counter); - - // optional .io.prometheus.client.Summary summary = 4; - inline bool has_summary() const; - inline void clear_summary(); - static const int kSummaryFieldNumber = 4; - inline const ::io::prometheus::client::Summary& summary() const; - inline ::io::prometheus::client::Summary* mutable_summary(); - inline ::io::prometheus::client::Summary* release_summary(); - inline void set_allocated_summary(::io::prometheus::client::Summary* summary); - - // optional .io.prometheus.client.Untyped untyped = 5; - inline bool has_untyped() const; - inline void clear_untyped(); - static const int kUntypedFieldNumber = 5; - inline const ::io::prometheus::client::Untyped& untyped() const; - inline ::io::prometheus::client::Untyped* mutable_untyped(); - inline ::io::prometheus::client::Untyped* release_untyped(); - inline void set_allocated_untyped(::io::prometheus::client::Untyped* untyped); - - // optional .io.prometheus.client.Histogram histogram = 7; - inline bool has_histogram() const; - inline void clear_histogram(); - static const int kHistogramFieldNumber = 7; - inline const ::io::prometheus::client::Histogram& histogram() const; - inline ::io::prometheus::client::Histogram* mutable_histogram(); - inline ::io::prometheus::client::Histogram* release_histogram(); - inline void set_allocated_histogram(::io::prometheus::client::Histogram* histogram); - - // optional int64 timestamp_ms = 6; - inline bool has_timestamp_ms() const; - inline void clear_timestamp_ms(); - static const int kTimestampMsFieldNumber = 6; - inline ::google::protobuf::int64 timestamp_ms() const; - inline void set_timestamp_ms(::google::protobuf::int64 value); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Metric) - private: - inline void set_has_gauge(); - inline void clear_has_gauge(); - inline void set_has_counter(); - inline void clear_has_counter(); - inline void set_has_summary(); - inline void clear_has_summary(); - inline void set_has_untyped(); - inline void clear_has_untyped(); - inline void set_has_histogram(); - inline void clear_has_histogram(); - inline void set_has_timestamp_ms(); - inline void clear_has_timestamp_ms(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::LabelPair > label_; - ::io::prometheus::client::Gauge* gauge_; - ::io::prometheus::client::Counter* counter_; - ::io::prometheus::client::Summary* summary_; - ::io::prometheus::client::Untyped* untyped_; - ::io::prometheus::client::Histogram* histogram_; - ::google::protobuf::int64 timestamp_ms_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static Metric* default_instance_; -}; -// ------------------------------------------------------------------- - -class MetricFamily : public ::google::protobuf::Message { - public: - MetricFamily(); - virtual ~MetricFamily(); - - MetricFamily(const MetricFamily& from); - - inline MetricFamily& operator=(const MetricFamily& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const MetricFamily& default_instance(); - - void Swap(MetricFamily* other); - - // implements Message ---------------------------------------------- - - MetricFamily* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const MetricFamily& from); - void MergeFrom(const MetricFamily& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional string name = 1; - inline bool has_name() const; - inline void clear_name(); - static const int kNameFieldNumber = 1; - inline const ::std::string& name() const; - inline void set_name(const ::std::string& value); - inline void set_name(const char* value); - inline void set_name(const char* value, size_t size); - inline ::std::string* mutable_name(); - inline ::std::string* release_name(); - inline void set_allocated_name(::std::string* name); - - // optional string help = 2; - inline bool has_help() const; - inline void clear_help(); - static const int kHelpFieldNumber = 2; - inline const ::std::string& help() const; - inline void set_help(const ::std::string& value); - inline void set_help(const char* value); - inline void set_help(const char* value, size_t size); - inline ::std::string* mutable_help(); - inline ::std::string* release_help(); - inline void set_allocated_help(::std::string* help); - - // optional .io.prometheus.client.MetricType type = 3; - inline bool has_type() const; - inline void clear_type(); - static const int kTypeFieldNumber = 3; - inline ::io::prometheus::client::MetricType type() const; - inline void set_type(::io::prometheus::client::MetricType value); - - // repeated .io.prometheus.client.Metric metric = 4; - inline int metric_size() const; - inline void clear_metric(); - static const int kMetricFieldNumber = 4; - inline const ::io::prometheus::client::Metric& metric(int index) const; - inline ::io::prometheus::client::Metric* mutable_metric(int index); - inline ::io::prometheus::client::Metric* add_metric(); - inline const ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Metric >& - metric() const; - inline ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Metric >* - mutable_metric(); - - // @@protoc_insertion_point(class_scope:io.prometheus.client.MetricFamily) - private: - inline void set_has_name(); - inline void clear_has_name(); - inline void set_has_help(); - inline void clear_has_help(); - inline void set_has_type(); - inline void clear_has_type(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::std::string* name_; - ::std::string* help_; - ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Metric > metric_; - int type_; - friend void protobuf_AddDesc_metrics_2eproto(); - friend void protobuf_AssignDesc_metrics_2eproto(); - friend void protobuf_ShutdownFile_metrics_2eproto(); - - void InitAsDefaultInstance(); - static MetricFamily* default_instance_; -}; -// =================================================================== - - -// =================================================================== - -// LabelPair - -// optional string name = 1; -inline bool LabelPair::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void LabelPair::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -inline void LabelPair::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -inline void LabelPair::clear_name() { - if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_->clear(); - } - clear_has_name(); -} -inline const ::std::string& LabelPair::name() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.LabelPair.name) - return *name_; -} -inline void LabelPair::set_name(const ::std::string& value) { - set_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_ = new ::std::string; - } - name_->assign(value); - // @@protoc_insertion_point(field_set:io.prometheus.client.LabelPair.name) -} -inline void LabelPair::set_name(const char* value) { - set_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_ = new ::std::string; - } - name_->assign(value); - // @@protoc_insertion_point(field_set_char:io.prometheus.client.LabelPair.name) -} -inline void LabelPair::set_name(const char* value, size_t size) { - set_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_ = new ::std::string; - } - name_->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:io.prometheus.client.LabelPair.name) -} -inline ::std::string* LabelPair::mutable_name() { - set_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_ = new ::std::string; - } - // @@protoc_insertion_point(field_mutable:io.prometheus.client.LabelPair.name) - return name_; -} -inline ::std::string* LabelPair::release_name() { - clear_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - return NULL; - } else { - ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - return temp; - } -} -inline void LabelPair::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete name_; - } - if (name) { - set_has_name(); - name_ = name; - } else { - clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - // @@protoc_insertion_point(field_set_allocated:io.prometheus.client.LabelPair.name) -} - -// optional string value = 2; -inline bool LabelPair::has_value() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void LabelPair::set_has_value() { - _has_bits_[0] |= 0x00000002u; -} -inline void LabelPair::clear_has_value() { - _has_bits_[0] &= ~0x00000002u; -} -inline void LabelPair::clear_value() { - if (value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - value_->clear(); - } - clear_has_value(); -} -inline const ::std::string& LabelPair::value() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.LabelPair.value) - return *value_; -} -inline void LabelPair::set_value(const ::std::string& value) { - set_has_value(); - if (value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - value_ = new ::std::string; - } - value_->assign(value); - // @@protoc_insertion_point(field_set:io.prometheus.client.LabelPair.value) -} -inline void LabelPair::set_value(const char* value) { - set_has_value(); - if (value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - value_ = new ::std::string; - } - value_->assign(value); - // @@protoc_insertion_point(field_set_char:io.prometheus.client.LabelPair.value) -} -inline void LabelPair::set_value(const char* value, size_t size) { - set_has_value(); - if (value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - value_ = new ::std::string; - } - value_->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:io.prometheus.client.LabelPair.value) -} -inline ::std::string* LabelPair::mutable_value() { - set_has_value(); - if (value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - value_ = new ::std::string; - } - // @@protoc_insertion_point(field_mutable:io.prometheus.client.LabelPair.value) - return value_; -} -inline ::std::string* LabelPair::release_value() { - clear_has_value(); - if (value_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - return NULL; - } else { - ::std::string* temp = value_; - value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - return temp; - } -} -inline void LabelPair::set_allocated_value(::std::string* value) { - if (value_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete value_; - } - if (value) { - set_has_value(); - value_ = value; - } else { - clear_has_value(); - value_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - // @@protoc_insertion_point(field_set_allocated:io.prometheus.client.LabelPair.value) -} - -// ------------------------------------------------------------------- - -// Gauge - -// optional double value = 1; -inline bool Gauge::has_value() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Gauge::set_has_value() { - _has_bits_[0] |= 0x00000001u; -} -inline void Gauge::clear_has_value() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Gauge::clear_value() { - value_ = 0; - clear_has_value(); -} -inline double Gauge::value() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Gauge.value) - return value_; -} -inline void Gauge::set_value(double value) { - set_has_value(); - value_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Gauge.value) -} - -// ------------------------------------------------------------------- - -// Counter - -// optional double value = 1; -inline bool Counter::has_value() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Counter::set_has_value() { - _has_bits_[0] |= 0x00000001u; -} -inline void Counter::clear_has_value() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Counter::clear_value() { - value_ = 0; - clear_has_value(); -} -inline double Counter::value() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Counter.value) - return value_; -} -inline void Counter::set_value(double value) { - set_has_value(); - value_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Counter.value) -} - -// ------------------------------------------------------------------- - -// Quantile - -// optional double quantile = 1; -inline bool Quantile::has_quantile() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Quantile::set_has_quantile() { - _has_bits_[0] |= 0x00000001u; -} -inline void Quantile::clear_has_quantile() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Quantile::clear_quantile() { - quantile_ = 0; - clear_has_quantile(); -} -inline double Quantile::quantile() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Quantile.quantile) - return quantile_; -} -inline void Quantile::set_quantile(double value) { - set_has_quantile(); - quantile_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Quantile.quantile) -} - -// optional double value = 2; -inline bool Quantile::has_value() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void Quantile::set_has_value() { - _has_bits_[0] |= 0x00000002u; -} -inline void Quantile::clear_has_value() { - _has_bits_[0] &= ~0x00000002u; -} -inline void Quantile::clear_value() { - value_ = 0; - clear_has_value(); -} -inline double Quantile::value() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Quantile.value) - return value_; -} -inline void Quantile::set_value(double value) { - set_has_value(); - value_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Quantile.value) -} - -// ------------------------------------------------------------------- - -// Summary - -// optional uint64 sample_count = 1; -inline bool Summary::has_sample_count() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Summary::set_has_sample_count() { - _has_bits_[0] |= 0x00000001u; -} -inline void Summary::clear_has_sample_count() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Summary::clear_sample_count() { - sample_count_ = GOOGLE_ULONGLONG(0); - clear_has_sample_count(); -} -inline ::google::protobuf::uint64 Summary::sample_count() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Summary.sample_count) - return sample_count_; -} -inline void Summary::set_sample_count(::google::protobuf::uint64 value) { - set_has_sample_count(); - sample_count_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Summary.sample_count) -} - -// optional double sample_sum = 2; -inline bool Summary::has_sample_sum() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void Summary::set_has_sample_sum() { - _has_bits_[0] |= 0x00000002u; -} -inline void Summary::clear_has_sample_sum() { - _has_bits_[0] &= ~0x00000002u; -} -inline void Summary::clear_sample_sum() { - sample_sum_ = 0; - clear_has_sample_sum(); -} -inline double Summary::sample_sum() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Summary.sample_sum) - return sample_sum_; -} -inline void Summary::set_sample_sum(double value) { - set_has_sample_sum(); - sample_sum_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Summary.sample_sum) -} - -// repeated .io.prometheus.client.Quantile quantile = 3; -inline int Summary::quantile_size() const { - return quantile_.size(); -} -inline void Summary::clear_quantile() { - quantile_.Clear(); -} -inline const ::io::prometheus::client::Quantile& Summary::quantile(int index) const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Summary.quantile) - return quantile_.Get(index); -} -inline ::io::prometheus::client::Quantile* Summary::mutable_quantile(int index) { - // @@protoc_insertion_point(field_mutable:io.prometheus.client.Summary.quantile) - return quantile_.Mutable(index); -} -inline ::io::prometheus::client::Quantile* Summary::add_quantile() { - // @@protoc_insertion_point(field_add:io.prometheus.client.Summary.quantile) - return quantile_.Add(); -} -inline const ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Quantile >& -Summary::quantile() const { - // @@protoc_insertion_point(field_list:io.prometheus.client.Summary.quantile) - return quantile_; -} -inline ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Quantile >* -Summary::mutable_quantile() { - // @@protoc_insertion_point(field_mutable_list:io.prometheus.client.Summary.quantile) - return &quantile_; -} - -// ------------------------------------------------------------------- - -// Untyped - -// optional double value = 1; -inline bool Untyped::has_value() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Untyped::set_has_value() { - _has_bits_[0] |= 0x00000001u; -} -inline void Untyped::clear_has_value() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Untyped::clear_value() { - value_ = 0; - clear_has_value(); -} -inline double Untyped::value() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Untyped.value) - return value_; -} -inline void Untyped::set_value(double value) { - set_has_value(); - value_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Untyped.value) -} - -// ------------------------------------------------------------------- - -// Histogram - -// optional uint64 sample_count = 1; -inline bool Histogram::has_sample_count() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Histogram::set_has_sample_count() { - _has_bits_[0] |= 0x00000001u; -} -inline void Histogram::clear_has_sample_count() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Histogram::clear_sample_count() { - sample_count_ = GOOGLE_ULONGLONG(0); - clear_has_sample_count(); -} -inline ::google::protobuf::uint64 Histogram::sample_count() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Histogram.sample_count) - return sample_count_; -} -inline void Histogram::set_sample_count(::google::protobuf::uint64 value) { - set_has_sample_count(); - sample_count_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Histogram.sample_count) -} - -// optional double sample_sum = 2; -inline bool Histogram::has_sample_sum() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void Histogram::set_has_sample_sum() { - _has_bits_[0] |= 0x00000002u; -} -inline void Histogram::clear_has_sample_sum() { - _has_bits_[0] &= ~0x00000002u; -} -inline void Histogram::clear_sample_sum() { - sample_sum_ = 0; - clear_has_sample_sum(); -} -inline double Histogram::sample_sum() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Histogram.sample_sum) - return sample_sum_; -} -inline void Histogram::set_sample_sum(double value) { - set_has_sample_sum(); - sample_sum_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Histogram.sample_sum) -} - -// repeated .io.prometheus.client.Bucket bucket = 3; -inline int Histogram::bucket_size() const { - return bucket_.size(); -} -inline void Histogram::clear_bucket() { - bucket_.Clear(); -} -inline const ::io::prometheus::client::Bucket& Histogram::bucket(int index) const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Histogram.bucket) - return bucket_.Get(index); -} -inline ::io::prometheus::client::Bucket* Histogram::mutable_bucket(int index) { - // @@protoc_insertion_point(field_mutable:io.prometheus.client.Histogram.bucket) - return bucket_.Mutable(index); -} -inline ::io::prometheus::client::Bucket* Histogram::add_bucket() { - // @@protoc_insertion_point(field_add:io.prometheus.client.Histogram.bucket) - return bucket_.Add(); -} -inline const ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Bucket >& -Histogram::bucket() const { - // @@protoc_insertion_point(field_list:io.prometheus.client.Histogram.bucket) - return bucket_; -} -inline ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Bucket >* -Histogram::mutable_bucket() { - // @@protoc_insertion_point(field_mutable_list:io.prometheus.client.Histogram.bucket) - return &bucket_; -} - -// ------------------------------------------------------------------- - -// Bucket - -// optional uint64 cumulative_count = 1; -inline bool Bucket::has_cumulative_count() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Bucket::set_has_cumulative_count() { - _has_bits_[0] |= 0x00000001u; -} -inline void Bucket::clear_has_cumulative_count() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Bucket::clear_cumulative_count() { - cumulative_count_ = GOOGLE_ULONGLONG(0); - clear_has_cumulative_count(); -} -inline ::google::protobuf::uint64 Bucket::cumulative_count() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Bucket.cumulative_count) - return cumulative_count_; -} -inline void Bucket::set_cumulative_count(::google::protobuf::uint64 value) { - set_has_cumulative_count(); - cumulative_count_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Bucket.cumulative_count) -} - -// optional double upper_bound = 2; -inline bool Bucket::has_upper_bound() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void Bucket::set_has_upper_bound() { - _has_bits_[0] |= 0x00000002u; -} -inline void Bucket::clear_has_upper_bound() { - _has_bits_[0] &= ~0x00000002u; -} -inline void Bucket::clear_upper_bound() { - upper_bound_ = 0; - clear_has_upper_bound(); -} -inline double Bucket::upper_bound() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Bucket.upper_bound) - return upper_bound_; -} -inline void Bucket::set_upper_bound(double value) { - set_has_upper_bound(); - upper_bound_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Bucket.upper_bound) -} - -// ------------------------------------------------------------------- - -// Metric - -// repeated .io.prometheus.client.LabelPair label = 1; -inline int Metric::label_size() const { - return label_.size(); -} -inline void Metric::clear_label() { - label_.Clear(); -} -inline const ::io::prometheus::client::LabelPair& Metric::label(int index) const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Metric.label) - return label_.Get(index); -} -inline ::io::prometheus::client::LabelPair* Metric::mutable_label(int index) { - // @@protoc_insertion_point(field_mutable:io.prometheus.client.Metric.label) - return label_.Mutable(index); -} -inline ::io::prometheus::client::LabelPair* Metric::add_label() { - // @@protoc_insertion_point(field_add:io.prometheus.client.Metric.label) - return label_.Add(); -} -inline const ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::LabelPair >& -Metric::label() const { - // @@protoc_insertion_point(field_list:io.prometheus.client.Metric.label) - return label_; -} -inline ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::LabelPair >* -Metric::mutable_label() { - // @@protoc_insertion_point(field_mutable_list:io.prometheus.client.Metric.label) - return &label_; -} - -// optional .io.prometheus.client.Gauge gauge = 2; -inline bool Metric::has_gauge() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void Metric::set_has_gauge() { - _has_bits_[0] |= 0x00000002u; -} -inline void Metric::clear_has_gauge() { - _has_bits_[0] &= ~0x00000002u; -} -inline void Metric::clear_gauge() { - if (gauge_ != NULL) gauge_->::io::prometheus::client::Gauge::Clear(); - clear_has_gauge(); -} -inline const ::io::prometheus::client::Gauge& Metric::gauge() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Metric.gauge) - return gauge_ != NULL ? *gauge_ : *default_instance_->gauge_; -} -inline ::io::prometheus::client::Gauge* Metric::mutable_gauge() { - set_has_gauge(); - if (gauge_ == NULL) gauge_ = new ::io::prometheus::client::Gauge; - // @@protoc_insertion_point(field_mutable:io.prometheus.client.Metric.gauge) - return gauge_; -} -inline ::io::prometheus::client::Gauge* Metric::release_gauge() { - clear_has_gauge(); - ::io::prometheus::client::Gauge* temp = gauge_; - gauge_ = NULL; - return temp; -} -inline void Metric::set_allocated_gauge(::io::prometheus::client::Gauge* gauge) { - delete gauge_; - gauge_ = gauge; - if (gauge) { - set_has_gauge(); - } else { - clear_has_gauge(); - } - // @@protoc_insertion_point(field_set_allocated:io.prometheus.client.Metric.gauge) -} - -// optional .io.prometheus.client.Counter counter = 3; -inline bool Metric::has_counter() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void Metric::set_has_counter() { - _has_bits_[0] |= 0x00000004u; -} -inline void Metric::clear_has_counter() { - _has_bits_[0] &= ~0x00000004u; -} -inline void Metric::clear_counter() { - if (counter_ != NULL) counter_->::io::prometheus::client::Counter::Clear(); - clear_has_counter(); -} -inline const ::io::prometheus::client::Counter& Metric::counter() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Metric.counter) - return counter_ != NULL ? *counter_ : *default_instance_->counter_; -} -inline ::io::prometheus::client::Counter* Metric::mutable_counter() { - set_has_counter(); - if (counter_ == NULL) counter_ = new ::io::prometheus::client::Counter; - // @@protoc_insertion_point(field_mutable:io.prometheus.client.Metric.counter) - return counter_; -} -inline ::io::prometheus::client::Counter* Metric::release_counter() { - clear_has_counter(); - ::io::prometheus::client::Counter* temp = counter_; - counter_ = NULL; - return temp; -} -inline void Metric::set_allocated_counter(::io::prometheus::client::Counter* counter) { - delete counter_; - counter_ = counter; - if (counter) { - set_has_counter(); - } else { - clear_has_counter(); - } - // @@protoc_insertion_point(field_set_allocated:io.prometheus.client.Metric.counter) -} - -// optional .io.prometheus.client.Summary summary = 4; -inline bool Metric::has_summary() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void Metric::set_has_summary() { - _has_bits_[0] |= 0x00000008u; -} -inline void Metric::clear_has_summary() { - _has_bits_[0] &= ~0x00000008u; -} -inline void Metric::clear_summary() { - if (summary_ != NULL) summary_->::io::prometheus::client::Summary::Clear(); - clear_has_summary(); -} -inline const ::io::prometheus::client::Summary& Metric::summary() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Metric.summary) - return summary_ != NULL ? *summary_ : *default_instance_->summary_; -} -inline ::io::prometheus::client::Summary* Metric::mutable_summary() { - set_has_summary(); - if (summary_ == NULL) summary_ = new ::io::prometheus::client::Summary; - // @@protoc_insertion_point(field_mutable:io.prometheus.client.Metric.summary) - return summary_; -} -inline ::io::prometheus::client::Summary* Metric::release_summary() { - clear_has_summary(); - ::io::prometheus::client::Summary* temp = summary_; - summary_ = NULL; - return temp; -} -inline void Metric::set_allocated_summary(::io::prometheus::client::Summary* summary) { - delete summary_; - summary_ = summary; - if (summary) { - set_has_summary(); - } else { - clear_has_summary(); - } - // @@protoc_insertion_point(field_set_allocated:io.prometheus.client.Metric.summary) -} - -// optional .io.prometheus.client.Untyped untyped = 5; -inline bool Metric::has_untyped() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -inline void Metric::set_has_untyped() { - _has_bits_[0] |= 0x00000010u; -} -inline void Metric::clear_has_untyped() { - _has_bits_[0] &= ~0x00000010u; -} -inline void Metric::clear_untyped() { - if (untyped_ != NULL) untyped_->::io::prometheus::client::Untyped::Clear(); - clear_has_untyped(); -} -inline const ::io::prometheus::client::Untyped& Metric::untyped() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Metric.untyped) - return untyped_ != NULL ? *untyped_ : *default_instance_->untyped_; -} -inline ::io::prometheus::client::Untyped* Metric::mutable_untyped() { - set_has_untyped(); - if (untyped_ == NULL) untyped_ = new ::io::prometheus::client::Untyped; - // @@protoc_insertion_point(field_mutable:io.prometheus.client.Metric.untyped) - return untyped_; -} -inline ::io::prometheus::client::Untyped* Metric::release_untyped() { - clear_has_untyped(); - ::io::prometheus::client::Untyped* temp = untyped_; - untyped_ = NULL; - return temp; -} -inline void Metric::set_allocated_untyped(::io::prometheus::client::Untyped* untyped) { - delete untyped_; - untyped_ = untyped; - if (untyped) { - set_has_untyped(); - } else { - clear_has_untyped(); - } - // @@protoc_insertion_point(field_set_allocated:io.prometheus.client.Metric.untyped) -} - -// optional .io.prometheus.client.Histogram histogram = 7; -inline bool Metric::has_histogram() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -inline void Metric::set_has_histogram() { - _has_bits_[0] |= 0x00000020u; -} -inline void Metric::clear_has_histogram() { - _has_bits_[0] &= ~0x00000020u; -} -inline void Metric::clear_histogram() { - if (histogram_ != NULL) histogram_->::io::prometheus::client::Histogram::Clear(); - clear_has_histogram(); -} -inline const ::io::prometheus::client::Histogram& Metric::histogram() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Metric.histogram) - return histogram_ != NULL ? *histogram_ : *default_instance_->histogram_; -} -inline ::io::prometheus::client::Histogram* Metric::mutable_histogram() { - set_has_histogram(); - if (histogram_ == NULL) histogram_ = new ::io::prometheus::client::Histogram; - // @@protoc_insertion_point(field_mutable:io.prometheus.client.Metric.histogram) - return histogram_; -} -inline ::io::prometheus::client::Histogram* Metric::release_histogram() { - clear_has_histogram(); - ::io::prometheus::client::Histogram* temp = histogram_; - histogram_ = NULL; - return temp; -} -inline void Metric::set_allocated_histogram(::io::prometheus::client::Histogram* histogram) { - delete histogram_; - histogram_ = histogram; - if (histogram) { - set_has_histogram(); - } else { - clear_has_histogram(); - } - // @@protoc_insertion_point(field_set_allocated:io.prometheus.client.Metric.histogram) -} - -// optional int64 timestamp_ms = 6; -inline bool Metric::has_timestamp_ms() const { - return (_has_bits_[0] & 0x00000040u) != 0; -} -inline void Metric::set_has_timestamp_ms() { - _has_bits_[0] |= 0x00000040u; -} -inline void Metric::clear_has_timestamp_ms() { - _has_bits_[0] &= ~0x00000040u; -} -inline void Metric::clear_timestamp_ms() { - timestamp_ms_ = GOOGLE_LONGLONG(0); - clear_has_timestamp_ms(); -} -inline ::google::protobuf::int64 Metric::timestamp_ms() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.Metric.timestamp_ms) - return timestamp_ms_; -} -inline void Metric::set_timestamp_ms(::google::protobuf::int64 value) { - set_has_timestamp_ms(); - timestamp_ms_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.Metric.timestamp_ms) -} - -// ------------------------------------------------------------------- - -// MetricFamily - -// optional string name = 1; -inline bool MetricFamily::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void MetricFamily::set_has_name() { - _has_bits_[0] |= 0x00000001u; -} -inline void MetricFamily::clear_has_name() { - _has_bits_[0] &= ~0x00000001u; -} -inline void MetricFamily::clear_name() { - if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_->clear(); - } - clear_has_name(); -} -inline const ::std::string& MetricFamily::name() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.MetricFamily.name) - return *name_; -} -inline void MetricFamily::set_name(const ::std::string& value) { - set_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_ = new ::std::string; - } - name_->assign(value); - // @@protoc_insertion_point(field_set:io.prometheus.client.MetricFamily.name) -} -inline void MetricFamily::set_name(const char* value) { - set_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_ = new ::std::string; - } - name_->assign(value); - // @@protoc_insertion_point(field_set_char:io.prometheus.client.MetricFamily.name) -} -inline void MetricFamily::set_name(const char* value, size_t size) { - set_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_ = new ::std::string; - } - name_->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:io.prometheus.client.MetricFamily.name) -} -inline ::std::string* MetricFamily::mutable_name() { - set_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - name_ = new ::std::string; - } - // @@protoc_insertion_point(field_mutable:io.prometheus.client.MetricFamily.name) - return name_; -} -inline ::std::string* MetricFamily::release_name() { - clear_has_name(); - if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - return NULL; - } else { - ::std::string* temp = name_; - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - return temp; - } -} -inline void MetricFamily::set_allocated_name(::std::string* name) { - if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete name_; - } - if (name) { - set_has_name(); - name_ = name; - } else { - clear_has_name(); - name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - // @@protoc_insertion_point(field_set_allocated:io.prometheus.client.MetricFamily.name) -} - -// optional string help = 2; -inline bool MetricFamily::has_help() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void MetricFamily::set_has_help() { - _has_bits_[0] |= 0x00000002u; -} -inline void MetricFamily::clear_has_help() { - _has_bits_[0] &= ~0x00000002u; -} -inline void MetricFamily::clear_help() { - if (help_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - help_->clear(); - } - clear_has_help(); -} -inline const ::std::string& MetricFamily::help() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.MetricFamily.help) - return *help_; -} -inline void MetricFamily::set_help(const ::std::string& value) { - set_has_help(); - if (help_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - help_ = new ::std::string; - } - help_->assign(value); - // @@protoc_insertion_point(field_set:io.prometheus.client.MetricFamily.help) -} -inline void MetricFamily::set_help(const char* value) { - set_has_help(); - if (help_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - help_ = new ::std::string; - } - help_->assign(value); - // @@protoc_insertion_point(field_set_char:io.prometheus.client.MetricFamily.help) -} -inline void MetricFamily::set_help(const char* value, size_t size) { - set_has_help(); - if (help_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - help_ = new ::std::string; - } - help_->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:io.prometheus.client.MetricFamily.help) -} -inline ::std::string* MetricFamily::mutable_help() { - set_has_help(); - if (help_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - help_ = new ::std::string; - } - // @@protoc_insertion_point(field_mutable:io.prometheus.client.MetricFamily.help) - return help_; -} -inline ::std::string* MetricFamily::release_help() { - clear_has_help(); - if (help_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - return NULL; - } else { - ::std::string* temp = help_; - help_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - return temp; - } -} -inline void MetricFamily::set_allocated_help(::std::string* help) { - if (help_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete help_; - } - if (help) { - set_has_help(); - help_ = help; - } else { - clear_has_help(); - help_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - // @@protoc_insertion_point(field_set_allocated:io.prometheus.client.MetricFamily.help) -} - -// optional .io.prometheus.client.MetricType type = 3; -inline bool MetricFamily::has_type() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void MetricFamily::set_has_type() { - _has_bits_[0] |= 0x00000004u; -} -inline void MetricFamily::clear_has_type() { - _has_bits_[0] &= ~0x00000004u; -} -inline void MetricFamily::clear_type() { - type_ = 0; - clear_has_type(); -} -inline ::io::prometheus::client::MetricType MetricFamily::type() const { - // @@protoc_insertion_point(field_get:io.prometheus.client.MetricFamily.type) - return static_cast< ::io::prometheus::client::MetricType >(type_); -} -inline void MetricFamily::set_type(::io::prometheus::client::MetricType value) { - assert(::io::prometheus::client::MetricType_IsValid(value)); - set_has_type(); - type_ = value; - // @@protoc_insertion_point(field_set:io.prometheus.client.MetricFamily.type) -} - -// repeated .io.prometheus.client.Metric metric = 4; -inline int MetricFamily::metric_size() const { - return metric_.size(); -} -inline void MetricFamily::clear_metric() { - metric_.Clear(); -} -inline const ::io::prometheus::client::Metric& MetricFamily::metric(int index) const { - // @@protoc_insertion_point(field_get:io.prometheus.client.MetricFamily.metric) - return metric_.Get(index); -} -inline ::io::prometheus::client::Metric* MetricFamily::mutable_metric(int index) { - // @@protoc_insertion_point(field_mutable:io.prometheus.client.MetricFamily.metric) - return metric_.Mutable(index); -} -inline ::io::prometheus::client::Metric* MetricFamily::add_metric() { - // @@protoc_insertion_point(field_add:io.prometheus.client.MetricFamily.metric) - return metric_.Add(); -} -inline const ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Metric >& -MetricFamily::metric() const { - // @@protoc_insertion_point(field_list:io.prometheus.client.MetricFamily.metric) - return metric_; -} -inline ::google::protobuf::RepeatedPtrField< ::io::prometheus::client::Metric >* -MetricFamily::mutable_metric() { - // @@protoc_insertion_point(field_mutable_list:io.prometheus.client.MetricFamily.metric) - return &metric_; -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace client -} // namespace prometheus -} // namespace io - -#ifndef SWIG -namespace google { -namespace protobuf { - -template <> struct is_proto_enum< ::io::prometheus::client::MetricType> : ::google::protobuf::internal::true_type {}; -template <> -inline const EnumDescriptor* GetEnumDescriptor< ::io::prometheus::client::MetricType>() { - return ::io::prometheus::client::MetricType_descriptor(); -} - -} // namespace google -} // namespace protobuf -#endif // SWIG - -// @@protoc_insertion_point(global_scope) - -#endif // PROTOBUF_metrics_2eproto__INCLUDED diff --git a/vendor/github.com/prometheus/client_model/go/metrics.pb.go b/vendor/github.com/prometheus/client_model/go/metrics.pb.go deleted file mode 100644 index 9805432c2..000000000 --- a/vendor/github.com/prometheus/client_model/go/metrics.pb.go +++ /dev/null @@ -1,629 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: metrics.proto - -package io_prometheus_client // import "github.com/prometheus/client_model/go" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type MetricType int32 - -const ( - MetricType_COUNTER MetricType = 0 - MetricType_GAUGE MetricType = 1 - MetricType_SUMMARY MetricType = 2 - MetricType_UNTYPED MetricType = 3 - MetricType_HISTOGRAM MetricType = 4 -) - -var MetricType_name = map[int32]string{ - 0: "COUNTER", - 1: "GAUGE", - 2: "SUMMARY", - 3: "UNTYPED", - 4: "HISTOGRAM", -} -var MetricType_value = map[string]int32{ - "COUNTER": 0, - "GAUGE": 1, - "SUMMARY": 2, - "UNTYPED": 3, - "HISTOGRAM": 4, -} - -func (x MetricType) Enum() *MetricType { - p := new(MetricType) - *p = x - return p -} -func (x MetricType) String() string { - return proto.EnumName(MetricType_name, int32(x)) -} -func (x *MetricType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(MetricType_value, data, "MetricType") - if err != nil { - return err - } - *x = MetricType(value) - return nil -} -func (MetricType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{0} -} - -type LabelPair struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LabelPair) Reset() { *m = LabelPair{} } -func (m *LabelPair) String() string { return proto.CompactTextString(m) } -func (*LabelPair) ProtoMessage() {} -func (*LabelPair) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{0} -} -func (m *LabelPair) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LabelPair.Unmarshal(m, b) -} -func (m *LabelPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LabelPair.Marshal(b, m, deterministic) -} -func (dst *LabelPair) XXX_Merge(src proto.Message) { - xxx_messageInfo_LabelPair.Merge(dst, src) -} -func (m *LabelPair) XXX_Size() int { - return xxx_messageInfo_LabelPair.Size(m) -} -func (m *LabelPair) XXX_DiscardUnknown() { - xxx_messageInfo_LabelPair.DiscardUnknown(m) -} - -var xxx_messageInfo_LabelPair proto.InternalMessageInfo - -func (m *LabelPair) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *LabelPair) GetValue() string { - if m != nil && m.Value != nil { - return *m.Value - } - return "" -} - -type Gauge struct { - Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Gauge) Reset() { *m = Gauge{} } -func (m *Gauge) String() string { return proto.CompactTextString(m) } -func (*Gauge) ProtoMessage() {} -func (*Gauge) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{1} -} -func (m *Gauge) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Gauge.Unmarshal(m, b) -} -func (m *Gauge) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Gauge.Marshal(b, m, deterministic) -} -func (dst *Gauge) XXX_Merge(src proto.Message) { - xxx_messageInfo_Gauge.Merge(dst, src) -} -func (m *Gauge) XXX_Size() int { - return xxx_messageInfo_Gauge.Size(m) -} -func (m *Gauge) XXX_DiscardUnknown() { - xxx_messageInfo_Gauge.DiscardUnknown(m) -} - -var xxx_messageInfo_Gauge proto.InternalMessageInfo - -func (m *Gauge) GetValue() float64 { - if m != nil && m.Value != nil { - return *m.Value - } - return 0 -} - -type Counter struct { - Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Counter) Reset() { *m = Counter{} } -func (m *Counter) String() string { return proto.CompactTextString(m) } -func (*Counter) ProtoMessage() {} -func (*Counter) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{2} -} -func (m *Counter) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Counter.Unmarshal(m, b) -} -func (m *Counter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Counter.Marshal(b, m, deterministic) -} -func (dst *Counter) XXX_Merge(src proto.Message) { - xxx_messageInfo_Counter.Merge(dst, src) -} -func (m *Counter) XXX_Size() int { - return xxx_messageInfo_Counter.Size(m) -} -func (m *Counter) XXX_DiscardUnknown() { - xxx_messageInfo_Counter.DiscardUnknown(m) -} - -var xxx_messageInfo_Counter proto.InternalMessageInfo - -func (m *Counter) GetValue() float64 { - if m != nil && m.Value != nil { - return *m.Value - } - return 0 -} - -type Quantile struct { - Quantile *float64 `protobuf:"fixed64,1,opt,name=quantile" json:"quantile,omitempty"` - Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Quantile) Reset() { *m = Quantile{} } -func (m *Quantile) String() string { return proto.CompactTextString(m) } -func (*Quantile) ProtoMessage() {} -func (*Quantile) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{3} -} -func (m *Quantile) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Quantile.Unmarshal(m, b) -} -func (m *Quantile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Quantile.Marshal(b, m, deterministic) -} -func (dst *Quantile) XXX_Merge(src proto.Message) { - xxx_messageInfo_Quantile.Merge(dst, src) -} -func (m *Quantile) XXX_Size() int { - return xxx_messageInfo_Quantile.Size(m) -} -func (m *Quantile) XXX_DiscardUnknown() { - xxx_messageInfo_Quantile.DiscardUnknown(m) -} - -var xxx_messageInfo_Quantile proto.InternalMessageInfo - -func (m *Quantile) GetQuantile() float64 { - if m != nil && m.Quantile != nil { - return *m.Quantile - } - return 0 -} - -func (m *Quantile) GetValue() float64 { - if m != nil && m.Value != nil { - return *m.Value - } - return 0 -} - -type Summary struct { - SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"` - SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"` - Quantile []*Quantile `protobuf:"bytes,3,rep,name=quantile" json:"quantile,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Summary) Reset() { *m = Summary{} } -func (m *Summary) String() string { return proto.CompactTextString(m) } -func (*Summary) ProtoMessage() {} -func (*Summary) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{4} -} -func (m *Summary) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Summary.Unmarshal(m, b) -} -func (m *Summary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Summary.Marshal(b, m, deterministic) -} -func (dst *Summary) XXX_Merge(src proto.Message) { - xxx_messageInfo_Summary.Merge(dst, src) -} -func (m *Summary) XXX_Size() int { - return xxx_messageInfo_Summary.Size(m) -} -func (m *Summary) XXX_DiscardUnknown() { - xxx_messageInfo_Summary.DiscardUnknown(m) -} - -var xxx_messageInfo_Summary proto.InternalMessageInfo - -func (m *Summary) GetSampleCount() uint64 { - if m != nil && m.SampleCount != nil { - return *m.SampleCount - } - return 0 -} - -func (m *Summary) GetSampleSum() float64 { - if m != nil && m.SampleSum != nil { - return *m.SampleSum - } - return 0 -} - -func (m *Summary) GetQuantile() []*Quantile { - if m != nil { - return m.Quantile - } - return nil -} - -type Untyped struct { - Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Untyped) Reset() { *m = Untyped{} } -func (m *Untyped) String() string { return proto.CompactTextString(m) } -func (*Untyped) ProtoMessage() {} -func (*Untyped) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{5} -} -func (m *Untyped) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Untyped.Unmarshal(m, b) -} -func (m *Untyped) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Untyped.Marshal(b, m, deterministic) -} -func (dst *Untyped) XXX_Merge(src proto.Message) { - xxx_messageInfo_Untyped.Merge(dst, src) -} -func (m *Untyped) XXX_Size() int { - return xxx_messageInfo_Untyped.Size(m) -} -func (m *Untyped) XXX_DiscardUnknown() { - xxx_messageInfo_Untyped.DiscardUnknown(m) -} - -var xxx_messageInfo_Untyped proto.InternalMessageInfo - -func (m *Untyped) GetValue() float64 { - if m != nil && m.Value != nil { - return *m.Value - } - return 0 -} - -type Histogram struct { - SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"` - SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"` - Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Histogram) Reset() { *m = Histogram{} } -func (m *Histogram) String() string { return proto.CompactTextString(m) } -func (*Histogram) ProtoMessage() {} -func (*Histogram) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{6} -} -func (m *Histogram) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Histogram.Unmarshal(m, b) -} -func (m *Histogram) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Histogram.Marshal(b, m, deterministic) -} -func (dst *Histogram) XXX_Merge(src proto.Message) { - xxx_messageInfo_Histogram.Merge(dst, src) -} -func (m *Histogram) XXX_Size() int { - return xxx_messageInfo_Histogram.Size(m) -} -func (m *Histogram) XXX_DiscardUnknown() { - xxx_messageInfo_Histogram.DiscardUnknown(m) -} - -var xxx_messageInfo_Histogram proto.InternalMessageInfo - -func (m *Histogram) GetSampleCount() uint64 { - if m != nil && m.SampleCount != nil { - return *m.SampleCount - } - return 0 -} - -func (m *Histogram) GetSampleSum() float64 { - if m != nil && m.SampleSum != nil { - return *m.SampleSum - } - return 0 -} - -func (m *Histogram) GetBucket() []*Bucket { - if m != nil { - return m.Bucket - } - return nil -} - -type Bucket struct { - CumulativeCount *uint64 `protobuf:"varint,1,opt,name=cumulative_count,json=cumulativeCount" json:"cumulative_count,omitempty"` - UpperBound *float64 `protobuf:"fixed64,2,opt,name=upper_bound,json=upperBound" json:"upper_bound,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Bucket) Reset() { *m = Bucket{} } -func (m *Bucket) String() string { return proto.CompactTextString(m) } -func (*Bucket) ProtoMessage() {} -func (*Bucket) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{7} -} -func (m *Bucket) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Bucket.Unmarshal(m, b) -} -func (m *Bucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Bucket.Marshal(b, m, deterministic) -} -func (dst *Bucket) XXX_Merge(src proto.Message) { - xxx_messageInfo_Bucket.Merge(dst, src) -} -func (m *Bucket) XXX_Size() int { - return xxx_messageInfo_Bucket.Size(m) -} -func (m *Bucket) XXX_DiscardUnknown() { - xxx_messageInfo_Bucket.DiscardUnknown(m) -} - -var xxx_messageInfo_Bucket proto.InternalMessageInfo - -func (m *Bucket) GetCumulativeCount() uint64 { - if m != nil && m.CumulativeCount != nil { - return *m.CumulativeCount - } - return 0 -} - -func (m *Bucket) GetUpperBound() float64 { - if m != nil && m.UpperBound != nil { - return *m.UpperBound - } - return 0 -} - -type Metric struct { - Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"` - Gauge *Gauge `protobuf:"bytes,2,opt,name=gauge" json:"gauge,omitempty"` - Counter *Counter `protobuf:"bytes,3,opt,name=counter" json:"counter,omitempty"` - Summary *Summary `protobuf:"bytes,4,opt,name=summary" json:"summary,omitempty"` - Untyped *Untyped `protobuf:"bytes,5,opt,name=untyped" json:"untyped,omitempty"` - Histogram *Histogram `protobuf:"bytes,7,opt,name=histogram" json:"histogram,omitempty"` - TimestampMs *int64 `protobuf:"varint,6,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,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_metrics_c97c9a2b9560cb8f, []int{8} -} -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 (dst *Metric) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metric.Merge(dst, 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) GetLabel() []*LabelPair { - if m != nil { - return m.Label - } - return nil -} - -func (m *Metric) GetGauge() *Gauge { - if m != nil { - return m.Gauge - } - return nil -} - -func (m *Metric) GetCounter() *Counter { - if m != nil { - return m.Counter - } - return nil -} - -func (m *Metric) GetSummary() *Summary { - if m != nil { - return m.Summary - } - return nil -} - -func (m *Metric) GetUntyped() *Untyped { - if m != nil { - return m.Untyped - } - return nil -} - -func (m *Metric) GetHistogram() *Histogram { - if m != nil { - return m.Histogram - } - return nil -} - -func (m *Metric) GetTimestampMs() int64 { - if m != nil && m.TimestampMs != nil { - return *m.TimestampMs - } - return 0 -} - -type MetricFamily struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Help *string `protobuf:"bytes,2,opt,name=help" json:"help,omitempty"` - Type *MetricType `protobuf:"varint,3,opt,name=type,enum=io.prometheus.client.MetricType" json:"type,omitempty"` - Metric []*Metric `protobuf:"bytes,4,rep,name=metric" json:"metric,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MetricFamily) Reset() { *m = MetricFamily{} } -func (m *MetricFamily) String() string { return proto.CompactTextString(m) } -func (*MetricFamily) ProtoMessage() {} -func (*MetricFamily) Descriptor() ([]byte, []int) { - return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{9} -} -func (m *MetricFamily) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MetricFamily.Unmarshal(m, b) -} -func (m *MetricFamily) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MetricFamily.Marshal(b, m, deterministic) -} -func (dst *MetricFamily) XXX_Merge(src proto.Message) { - xxx_messageInfo_MetricFamily.Merge(dst, src) -} -func (m *MetricFamily) XXX_Size() int { - return xxx_messageInfo_MetricFamily.Size(m) -} -func (m *MetricFamily) XXX_DiscardUnknown() { - xxx_messageInfo_MetricFamily.DiscardUnknown(m) -} - -var xxx_messageInfo_MetricFamily proto.InternalMessageInfo - -func (m *MetricFamily) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MetricFamily) GetHelp() string { - if m != nil && m.Help != nil { - return *m.Help - } - return "" -} - -func (m *MetricFamily) GetType() MetricType { - if m != nil && m.Type != nil { - return *m.Type - } - return MetricType_COUNTER -} - -func (m *MetricFamily) GetMetric() []*Metric { - if m != nil { - return m.Metric - } - return nil -} - -func init() { - proto.RegisterType((*LabelPair)(nil), "io.prometheus.client.LabelPair") - proto.RegisterType((*Gauge)(nil), "io.prometheus.client.Gauge") - proto.RegisterType((*Counter)(nil), "io.prometheus.client.Counter") - proto.RegisterType((*Quantile)(nil), "io.prometheus.client.Quantile") - proto.RegisterType((*Summary)(nil), "io.prometheus.client.Summary") - proto.RegisterType((*Untyped)(nil), "io.prometheus.client.Untyped") - proto.RegisterType((*Histogram)(nil), "io.prometheus.client.Histogram") - proto.RegisterType((*Bucket)(nil), "io.prometheus.client.Bucket") - proto.RegisterType((*Metric)(nil), "io.prometheus.client.Metric") - proto.RegisterType((*MetricFamily)(nil), "io.prometheus.client.MetricFamily") - proto.RegisterEnum("io.prometheus.client.MetricType", MetricType_name, MetricType_value) -} - -func init() { proto.RegisterFile("metrics.proto", fileDescriptor_metrics_c97c9a2b9560cb8f) } - -var fileDescriptor_metrics_c97c9a2b9560cb8f = []byte{ - // 591 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x4f, 0xdb, 0x4e, - 0x14, 0xfc, 0x99, 0xd8, 0x09, 0x7e, 0x86, 0x5f, 0xad, 0x15, 0x07, 0xab, 0x2d, 0x25, 0xcd, 0x89, - 0xf6, 0x10, 0x54, 0x04, 0xaa, 0x44, 0xdb, 0x03, 0x50, 0x1a, 0x2a, 0xd5, 0x40, 0x37, 0xc9, 0x81, - 0x5e, 0xac, 0x8d, 0x59, 0x25, 0x56, 0xbd, 0xb6, 0x6b, 0xef, 0x22, 0xe5, 0xdc, 0x43, 0xbf, 0x47, - 0xbf, 0x68, 0xab, 0xfd, 0xe3, 0x18, 0x24, 0xc3, 0xa9, 0xb7, 0xb7, 0xf3, 0x66, 0xde, 0x8e, 0x77, - 0xc7, 0x0b, 0x9b, 0x8c, 0xf2, 0x32, 0x89, 0xab, 0x61, 0x51, 0xe6, 0x3c, 0x47, 0x5b, 0x49, 0x2e, - 0x2b, 0x46, 0xf9, 0x82, 0x8a, 0x6a, 0x18, 0xa7, 0x09, 0xcd, 0xf8, 0xe0, 0x10, 0xdc, 0x2f, 0x64, - 0x46, 0xd3, 0x2b, 0x92, 0x94, 0x08, 0x81, 0x9d, 0x11, 0x46, 0x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, 0x40, 0x33, 0x09, 0x79, 0xd0, 0x3b, 0xbd, - 0x9c, 0x5e, 0x4c, 0xce, 0xb0, 0xff, 0x1f, 0x72, 0xc1, 0x19, 0x1d, 0x4f, 0x47, 0x67, 0xbe, 0x25, - 0xf1, 0xf1, 0x34, 0x0c, 0x8f, 0xf1, 0xb5, 0xbf, 0x26, 0x17, 0xd3, 0x8b, 0xc9, 0xf5, 0xd5, 0xd9, - 0x47, 0xbf, 0x83, 0x36, 0xc1, 0x3d, 0xff, 0x3c, 0x9e, 0x5c, 0x8e, 0xf0, 0x71, 0xe8, 0xdb, 0x27, - 0x18, 0x5a, 0x5f, 0xb2, 0x6f, 0x47, 0xf3, 0x84, 0x2f, 0xc4, 0x6c, 0x18, 0xe7, 0x6c, 0xaf, 0xe9, - 0xee, 0xe9, 0x6e, 0xc4, 0xf2, 0x1b, 0x9a, 0xee, 0xcd, 0xf3, 0x77, 0x49, 0x1e, 0x35, 0xdd, 0x48, - 0x77, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x45, 0x21, 0x7f, 0x64, 0x2b, 0x05, 0x00, 0x00, -} diff --git a/vendor/github.com/prometheus/client_model/metrics.proto b/vendor/github.com/prometheus/client_model/metrics.proto deleted file mode 100644 index 31633b3f6..000000000 --- a/vendor/github.com/prometheus/client_model/metrics.proto +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2013 Prometheus Team -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; - -package io.prometheus.client; -option java_package = "io.prometheus.client"; -option go_package = "github.com/prometheus/client_model/go;io_prometheus_client"; - -message LabelPair { - optional string name = 1; - optional string value = 2; -} - -enum MetricType { - COUNTER = 0; - GAUGE = 1; - SUMMARY = 2; - UNTYPED = 3; - HISTOGRAM = 4; -} - -message Gauge { - optional double value = 1; -} - -message Counter { - optional double value = 1; -} - -message Quantile { - optional double quantile = 1; - optional double value = 2; -} - -message Summary { - optional uint64 sample_count = 1; - optional double sample_sum = 2; - repeated Quantile quantile = 3; -} - -message Untyped { - optional double value = 1; -} - -message Histogram { - optional uint64 sample_count = 1; - optional double sample_sum = 2; - repeated Bucket bucket = 3; // Ordered in increasing order of upper_bound, +Inf bucket is optional. -} - -message Bucket { - optional uint64 cumulative_count = 1; // Cumulative in increasing order. - optional double upper_bound = 2; // Inclusive. -} - -message Metric { - repeated LabelPair label = 1; - optional Gauge gauge = 2; - optional Counter counter = 3; - optional Summary summary = 4; - optional Untyped untyped = 5; - optional Histogram histogram = 7; - optional int64 timestamp_ms = 6; -} - -message MetricFamily { - optional string name = 1; - optional string help = 2; - optional MetricType type = 3; - repeated Metric metric = 4; -} diff --git a/vendor/github.com/prometheus/client_model/pom.xml b/vendor/github.com/prometheus/client_model/pom.xml deleted file mode 100644 index 4d34c9015..000000000 --- a/vendor/github.com/prometheus/client_model/pom.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - 4.0.0 - - io.prometheus.client - model - 0.0.3-SNAPSHOT - - - org.sonatype.oss - oss-parent - 7 - - - Prometheus Client Data Model - http://github.com/prometheus/client_model - - Prometheus Client Data Model: Generated Protocol Buffer Assets - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - scm:git:git@github.com:prometheus/client_model.git - scm:git:git@github.com:prometheus/client_model.git - git@github.com:prometheus/client_model.git - - - - - mtp - Matt T. Proud - matt.proud@gmail.com - - - - - - com.google.protobuf - protobuf-java - 2.5.0 - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.8 - - UTF-8 - UTF-8 - true - - - - generate-javadoc-site-report - site - - javadoc - - - - attach-javadocs - - jar - - - - - - maven-compiler-plugin - - 1.6 - 1.6 - - 3.1 - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar - - - - - - - - - release-sign-artifacts - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.4 - - - sign-artifacts - verify - - sign - - - - - - - - - diff --git a/vendor/github.com/prometheus/client_model/python/prometheus/__init__.py b/vendor/github.com/prometheus/client_model/python/prometheus/__init__.py deleted file mode 100644 index 617c0ced0..000000000 --- a/vendor/github.com/prometheus/client_model/python/prometheus/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ - # Copyright 2013 Prometheus Team - # 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/prometheus/client_model/python/prometheus/client/__init__.py b/vendor/github.com/prometheus/client_model/python/prometheus/client/__init__.py deleted file mode 100644 index 617c0ced0..000000000 --- a/vendor/github.com/prometheus/client_model/python/prometheus/client/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ - # Copyright 2013 Prometheus Team - # 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/prometheus/client_model/python/prometheus/client/model/__init__.py b/vendor/github.com/prometheus/client_model/python/prometheus/client/model/__init__.py deleted file mode 100644 index d40327c32..000000000 --- a/vendor/github.com/prometheus/client_model/python/prometheus/client/model/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ - # Copyright 2013 Prometheus Team - # 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. - -__all__ = ['metrics_pb2'] diff --git a/vendor/github.com/prometheus/client_model/python/prometheus/client/model/metrics_pb2.py b/vendor/github.com/prometheus/client_model/python/prometheus/client/model/metrics_pb2.py deleted file mode 100644 index 8c239ac06..000000000 --- a/vendor/github.com/prometheus/client_model/python/prometheus/client/model/metrics_pb2.py +++ /dev/null @@ -1,575 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: metrics.proto - -import sys -_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -from google.protobuf import descriptor_pb2 -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='metrics.proto', - package='io.prometheus.client', - serialized_pb=_b('\n\rmetrics.proto\x12\x14io.prometheus.client\"(\n\tLabelPair\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"\x16\n\x05Gauge\x12\r\n\x05value\x18\x01 \x01(\x01\"\x18\n\x07\x43ounter\x12\r\n\x05value\x18\x01 \x01(\x01\"+\n\x08Quantile\x12\x10\n\x08quantile\x18\x01 \x01(\x01\x12\r\n\x05value\x18\x02 \x01(\x01\"e\n\x07Summary\x12\x14\n\x0csample_count\x18\x01 \x01(\x04\x12\x12\n\nsample_sum\x18\x02 \x01(\x01\x12\x30\n\x08quantile\x18\x03 \x03(\x0b\x32\x1e.io.prometheus.client.Quantile\"\x18\n\x07Untyped\x12\r\n\x05value\x18\x01 \x01(\x01\"c\n\tHistogram\x12\x14\n\x0csample_count\x18\x01 \x01(\x04\x12\x12\n\nsample_sum\x18\x02 \x01(\x01\x12,\n\x06\x62ucket\x18\x03 \x03(\x0b\x32\x1c.io.prometheus.client.Bucket\"7\n\x06\x42ucket\x12\x18\n\x10\x63umulative_count\x18\x01 \x01(\x04\x12\x13\n\x0bupper_bound\x18\x02 \x01(\x01\"\xbe\x02\n\x06Metric\x12.\n\x05label\x18\x01 \x03(\x0b\x32\x1f.io.prometheus.client.LabelPair\x12*\n\x05gauge\x18\x02 \x01(\x0b\x32\x1b.io.prometheus.client.Gauge\x12.\n\x07\x63ounter\x18\x03 \x01(\x0b\x32\x1d.io.prometheus.client.Counter\x12.\n\x07summary\x18\x04 \x01(\x0b\x32\x1d.io.prometheus.client.Summary\x12.\n\x07untyped\x18\x05 \x01(\x0b\x32\x1d.io.prometheus.client.Untyped\x12\x32\n\thistogram\x18\x07 \x01(\x0b\x32\x1f.io.prometheus.client.Histogram\x12\x14\n\x0ctimestamp_ms\x18\x06 \x01(\x03\"\x88\x01\n\x0cMetricFamily\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04help\x18\x02 \x01(\t\x12.\n\x04type\x18\x03 \x01(\x0e\x32 .io.prometheus.client.MetricType\x12,\n\x06metric\x18\x04 \x03(\x0b\x32\x1c.io.prometheus.client.Metric*M\n\nMetricType\x12\x0b\n\x07\x43OUNTER\x10\x00\x12\t\n\x05GAUGE\x10\x01\x12\x0b\n\x07SUMMARY\x10\x02\x12\x0b\n\x07UNTYPED\x10\x03\x12\r\n\tHISTOGRAM\x10\x04\x42\x16\n\x14io.prometheus.client') -) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -_METRICTYPE = _descriptor.EnumDescriptor( - name='MetricType', - full_name='io.prometheus.client.MetricType', - filename=None, - file=DESCRIPTOR, - values=[ - _descriptor.EnumValueDescriptor( - name='COUNTER', index=0, number=0, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='GAUGE', index=1, number=1, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='SUMMARY', index=2, number=2, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='UNTYPED', index=3, number=3, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='HISTOGRAM', index=4, number=4, - options=None, - type=None), - ], - containing_type=None, - options=None, - serialized_start=923, - serialized_end=1000, -) -_sym_db.RegisterEnumDescriptor(_METRICTYPE) - -MetricType = enum_type_wrapper.EnumTypeWrapper(_METRICTYPE) -COUNTER = 0 -GAUGE = 1 -SUMMARY = 2 -UNTYPED = 3 -HISTOGRAM = 4 - - - -_LABELPAIR = _descriptor.Descriptor( - name='LabelPair', - full_name='io.prometheus.client.LabelPair', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='io.prometheus.client.LabelPair.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='value', full_name='io.prometheus.client.LabelPair.value', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=39, - serialized_end=79, -) - - -_GAUGE = _descriptor.Descriptor( - name='Gauge', - full_name='io.prometheus.client.Gauge', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='value', full_name='io.prometheus.client.Gauge.value', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=81, - serialized_end=103, -) - - -_COUNTER = _descriptor.Descriptor( - name='Counter', - full_name='io.prometheus.client.Counter', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='value', full_name='io.prometheus.client.Counter.value', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=105, - serialized_end=129, -) - - -_QUANTILE = _descriptor.Descriptor( - name='Quantile', - full_name='io.prometheus.client.Quantile', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='quantile', full_name='io.prometheus.client.Quantile.quantile', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='value', full_name='io.prometheus.client.Quantile.value', index=1, - number=2, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=131, - serialized_end=174, -) - - -_SUMMARY = _descriptor.Descriptor( - name='Summary', - full_name='io.prometheus.client.Summary', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='sample_count', full_name='io.prometheus.client.Summary.sample_count', index=0, - number=1, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='sample_sum', full_name='io.prometheus.client.Summary.sample_sum', index=1, - number=2, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='quantile', full_name='io.prometheus.client.Summary.quantile', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=176, - serialized_end=277, -) - - -_UNTYPED = _descriptor.Descriptor( - name='Untyped', - full_name='io.prometheus.client.Untyped', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='value', full_name='io.prometheus.client.Untyped.value', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=279, - serialized_end=303, -) - - -_HISTOGRAM = _descriptor.Descriptor( - name='Histogram', - full_name='io.prometheus.client.Histogram', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='sample_count', full_name='io.prometheus.client.Histogram.sample_count', index=0, - number=1, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='sample_sum', full_name='io.prometheus.client.Histogram.sample_sum', index=1, - number=2, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='bucket', full_name='io.prometheus.client.Histogram.bucket', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=305, - serialized_end=404, -) - - -_BUCKET = _descriptor.Descriptor( - name='Bucket', - full_name='io.prometheus.client.Bucket', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='cumulative_count', full_name='io.prometheus.client.Bucket.cumulative_count', index=0, - number=1, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='upper_bound', full_name='io.prometheus.client.Bucket.upper_bound', index=1, - number=2, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=406, - serialized_end=461, -) - - -_METRIC = _descriptor.Descriptor( - name='Metric', - full_name='io.prometheus.client.Metric', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='label', full_name='io.prometheus.client.Metric.label', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='gauge', full_name='io.prometheus.client.Metric.gauge', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='counter', full_name='io.prometheus.client.Metric.counter', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='summary', full_name='io.prometheus.client.Metric.summary', index=3, - number=4, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='untyped', full_name='io.prometheus.client.Metric.untyped', index=4, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='histogram', full_name='io.prometheus.client.Metric.histogram', index=5, - number=7, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='timestamp_ms', full_name='io.prometheus.client.Metric.timestamp_ms', index=6, - number=6, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=464, - serialized_end=782, -) - - -_METRICFAMILY = _descriptor.Descriptor( - name='MetricFamily', - full_name='io.prometheus.client.MetricFamily', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='io.prometheus.client.MetricFamily.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='help', full_name='io.prometheus.client.MetricFamily.help', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='type', full_name='io.prometheus.client.MetricFamily.type', index=2, - number=3, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='metric', full_name='io.prometheus.client.MetricFamily.metric', index=3, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=785, - serialized_end=921, -) - -_SUMMARY.fields_by_name['quantile'].message_type = _QUANTILE -_HISTOGRAM.fields_by_name['bucket'].message_type = _BUCKET -_METRIC.fields_by_name['label'].message_type = _LABELPAIR -_METRIC.fields_by_name['gauge'].message_type = _GAUGE -_METRIC.fields_by_name['counter'].message_type = _COUNTER -_METRIC.fields_by_name['summary'].message_type = _SUMMARY -_METRIC.fields_by_name['untyped'].message_type = _UNTYPED -_METRIC.fields_by_name['histogram'].message_type = _HISTOGRAM -_METRICFAMILY.fields_by_name['type'].enum_type = _METRICTYPE -_METRICFAMILY.fields_by_name['metric'].message_type = _METRIC -DESCRIPTOR.message_types_by_name['LabelPair'] = _LABELPAIR -DESCRIPTOR.message_types_by_name['Gauge'] = _GAUGE -DESCRIPTOR.message_types_by_name['Counter'] = _COUNTER -DESCRIPTOR.message_types_by_name['Quantile'] = _QUANTILE -DESCRIPTOR.message_types_by_name['Summary'] = _SUMMARY -DESCRIPTOR.message_types_by_name['Untyped'] = _UNTYPED -DESCRIPTOR.message_types_by_name['Histogram'] = _HISTOGRAM -DESCRIPTOR.message_types_by_name['Bucket'] = _BUCKET -DESCRIPTOR.message_types_by_name['Metric'] = _METRIC -DESCRIPTOR.message_types_by_name['MetricFamily'] = _METRICFAMILY -DESCRIPTOR.enum_types_by_name['MetricType'] = _METRICTYPE - -LabelPair = _reflection.GeneratedProtocolMessageType('LabelPair', (_message.Message,), dict( - DESCRIPTOR = _LABELPAIR, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.LabelPair) - )) -_sym_db.RegisterMessage(LabelPair) - -Gauge = _reflection.GeneratedProtocolMessageType('Gauge', (_message.Message,), dict( - DESCRIPTOR = _GAUGE, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.Gauge) - )) -_sym_db.RegisterMessage(Gauge) - -Counter = _reflection.GeneratedProtocolMessageType('Counter', (_message.Message,), dict( - DESCRIPTOR = _COUNTER, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.Counter) - )) -_sym_db.RegisterMessage(Counter) - -Quantile = _reflection.GeneratedProtocolMessageType('Quantile', (_message.Message,), dict( - DESCRIPTOR = _QUANTILE, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.Quantile) - )) -_sym_db.RegisterMessage(Quantile) - -Summary = _reflection.GeneratedProtocolMessageType('Summary', (_message.Message,), dict( - DESCRIPTOR = _SUMMARY, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.Summary) - )) -_sym_db.RegisterMessage(Summary) - -Untyped = _reflection.GeneratedProtocolMessageType('Untyped', (_message.Message,), dict( - DESCRIPTOR = _UNTYPED, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.Untyped) - )) -_sym_db.RegisterMessage(Untyped) - -Histogram = _reflection.GeneratedProtocolMessageType('Histogram', (_message.Message,), dict( - DESCRIPTOR = _HISTOGRAM, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.Histogram) - )) -_sym_db.RegisterMessage(Histogram) - -Bucket = _reflection.GeneratedProtocolMessageType('Bucket', (_message.Message,), dict( - DESCRIPTOR = _BUCKET, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.Bucket) - )) -_sym_db.RegisterMessage(Bucket) - -Metric = _reflection.GeneratedProtocolMessageType('Metric', (_message.Message,), dict( - DESCRIPTOR = _METRIC, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.Metric) - )) -_sym_db.RegisterMessage(Metric) - -MetricFamily = _reflection.GeneratedProtocolMessageType('MetricFamily', (_message.Message,), dict( - DESCRIPTOR = _METRICFAMILY, - __module__ = 'metrics_pb2' - # @@protoc_insertion_point(class_scope:io.prometheus.client.MetricFamily) - )) -_sym_db.RegisterMessage(MetricFamily) - - -DESCRIPTOR.has_options = True -DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\024io.prometheus.client')) -# @@protoc_insertion_point(module_scope) diff --git a/vendor/github.com/prometheus/client_model/ruby/.gitignore b/vendor/github.com/prometheus/client_model/ruby/.gitignore deleted file mode 100644 index 8442a4709..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.gem -.bundle -Gemfile.lock -pkg -vendor/bundle diff --git a/vendor/github.com/prometheus/client_model/ruby/Gemfile b/vendor/github.com/prometheus/client_model/ruby/Gemfile deleted file mode 100644 index 1ff638cdc..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/Gemfile +++ /dev/null @@ -1,4 +0,0 @@ -source 'https://rubygems.org' - -# Specify your gem's dependencies in prometheus-client-model.gemspec -gemspec diff --git a/vendor/github.com/prometheus/client_model/ruby/LICENSE b/vendor/github.com/prometheus/client_model/ruby/LICENSE deleted file mode 100644 index 11069edd7..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/vendor/github.com/prometheus/client_model/ruby/Makefile b/vendor/github.com/prometheus/client_model/ruby/Makefile deleted file mode 100644 index 09d544bf0..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -VENDOR_BUNDLE = vendor/bundle - -build: $(VENDOR_BUNDLE)/.bundled - BEEFCAKE_NAMESPACE=Prometheus::Client protoc --beefcake_out lib/prometheus/client/model -I .. ../metrics.proto - -$(VENDOR_BUNDLE): - mkdir -p $@ - -$(VENDOR_BUNDLE)/.bundled: $(VENDOR_BUNDLE) Gemfile - bundle install --quiet --path $< - @touch $@ - -clean: - -rm -f lib/prometheus/client/model/metrics.pb.rb - -rm -rf $(VENDOR_BUNDLE) - -.PHONY: build clean diff --git a/vendor/github.com/prometheus/client_model/ruby/README.md b/vendor/github.com/prometheus/client_model/ruby/README.md deleted file mode 100644 index c45fcc7a9..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Prometheus Ruby client model - -Data model artifacts for the [Prometheus Ruby client][1]. - -## Installation - - gem install prometheus-client-model - -## Usage - -Build the artifacts from the protobuf specification: - - make build - -While this Gem's main purpose is to define the Prometheus data types for the -[client][1], it's possible to use it without the client to decode a stream of -delimited protobuf messages: - -```ruby -require 'open-uri' -require 'prometheus/client/model' - -CONTENT_TYPE = 'application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited' - -stream = open('http://localhost:9090/metrics', 'Accept' => CONTENT_TYPE).read -while family = Prometheus::Client::MetricFamily.read_delimited(stream) - puts family -end -``` - -[1]: https://github.com/prometheus/client_ruby diff --git a/vendor/github.com/prometheus/client_model/ruby/Rakefile b/vendor/github.com/prometheus/client_model/ruby/Rakefile deleted file mode 100644 index 29955274e..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/Rakefile +++ /dev/null @@ -1 +0,0 @@ -require "bundler/gem_tasks" diff --git a/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model.rb b/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model.rb deleted file mode 100644 index b5303bf1e..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model.rb +++ /dev/null @@ -1,2 +0,0 @@ -require 'prometheus/client/model/metrics.pb' -require 'prometheus/client/model/version' diff --git a/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model/metrics.pb.rb b/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model/metrics.pb.rb deleted file mode 100644 index a72114b8f..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model/metrics.pb.rb +++ /dev/null @@ -1,111 +0,0 @@ -## Generated from metrics.proto for io.prometheus.client -require "beefcake" - -module Prometheus - module Client - - module MetricType - COUNTER = 0 - GAUGE = 1 - SUMMARY = 2 - UNTYPED = 3 - HISTOGRAM = 4 - end - - class LabelPair - include Beefcake::Message - end - - class Gauge - include Beefcake::Message - end - - class Counter - include Beefcake::Message - end - - class Quantile - include Beefcake::Message - end - - class Summary - include Beefcake::Message - end - - class Untyped - include Beefcake::Message - end - - class Histogram - include Beefcake::Message - end - - class Bucket - include Beefcake::Message - end - - class Metric - include Beefcake::Message - end - - class MetricFamily - include Beefcake::Message - end - - class LabelPair - optional :name, :string, 1 - optional :value, :string, 2 - end - - class Gauge - optional :value, :double, 1 - end - - class Counter - optional :value, :double, 1 - end - - class Quantile - optional :quantile, :double, 1 - optional :value, :double, 2 - end - - class Summary - optional :sample_count, :uint64, 1 - optional :sample_sum, :double, 2 - repeated :quantile, Quantile, 3 - end - - class Untyped - optional :value, :double, 1 - end - - class Histogram - optional :sample_count, :uint64, 1 - optional :sample_sum, :double, 2 - repeated :bucket, Bucket, 3 - end - - class Bucket - optional :cumulative_count, :uint64, 1 - optional :upper_bound, :double, 2 - end - - class Metric - repeated :label, LabelPair, 1 - optional :gauge, Gauge, 2 - optional :counter, Counter, 3 - optional :summary, Summary, 4 - optional :untyped, Untyped, 5 - optional :histogram, Histogram, 7 - optional :timestamp_ms, :int64, 6 - end - - class MetricFamily - optional :name, :string, 1 - optional :help, :string, 2 - optional :type, MetricType, 3 - repeated :metric, Metric, 4 - end - end -end diff --git a/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model/version.rb b/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model/version.rb deleted file mode 100644 index 00b5e863e..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/lib/prometheus/client/model/version.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Prometheus - module Client - module Model - VERSION = '0.1.0' - end - end -end diff --git a/vendor/github.com/prometheus/client_model/ruby/prometheus-client-model.gemspec b/vendor/github.com/prometheus/client_model/ruby/prometheus-client-model.gemspec deleted file mode 100644 index 438ba127e..000000000 --- a/vendor/github.com/prometheus/client_model/ruby/prometheus-client-model.gemspec +++ /dev/null @@ -1,22 +0,0 @@ -# coding: utf-8 -lib = File.expand_path('../lib', __FILE__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'prometheus/client/model/version' - -Gem::Specification.new do |spec| - spec.name = 'prometheus-client-model' - spec.version = Prometheus::Client::Model::VERSION - spec.authors = ['Tobias Schmidt'] - spec.email = ['tobidt@gmail.com'] - spec.summary = 'Data model artifacts for the Prometheus Ruby client' - spec.homepage = 'https://github.com/prometheus/client_model/tree/master/ruby' - spec.license = 'Apache 2.0' - - spec.files = %w[README.md LICENSE] + Dir.glob('{lib/**/*}') - spec.require_paths = ['lib'] - - spec.add_dependency 'beefcake', '>= 0.4.0' - - spec.add_development_dependency 'bundler', '~> 1.3' - spec.add_development_dependency 'rake' -end diff --git a/vendor/github.com/prometheus/client_model/setup.py b/vendor/github.com/prometheus/client_model/setup.py deleted file mode 100644 index 67b9f20e3..000000000 --- a/vendor/github.com/prometheus/client_model/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/python - -from setuptools import setup - -setup( - name = 'prometheus_client_model', - version = '0.0.1', - author = 'Matt T. Proud', - author_email = 'matt.proud@gmail.com', - description = 'Data model artifacts for the Prometheus client.', - license = 'Apache License 2.0', - url = 'http://github.com/prometheus/client_model', - packages = ['prometheus', 'prometheus/client', 'prometheus/client/model'], - package_dir = {'': 'python'}, - requires = ['protobuf(==2.4.1)'], - platforms = 'Platform Independent', - classifiers = ['Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: OS Independent', - 'Topic :: Software Development :: Testing', - 'Topic :: System :: Monitoring']) diff --git a/vendor/github.com/prometheus/client_model/src/main/java/io/prometheus/client/Metrics.java b/vendor/github.com/prometheus/client_model/src/main/java/io/prometheus/client/Metrics.java deleted file mode 100644 index fb6218e1e..000000000 --- a/vendor/github.com/prometheus/client_model/src/main/java/io/prometheus/client/Metrics.java +++ /dev/null @@ -1,7683 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: metrics.proto - -package io.prometheus.client; - -public final class Metrics { - private Metrics() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - } - /** - * Protobuf enum {@code io.prometheus.client.MetricType} - */ - public enum MetricType - implements com.google.protobuf.ProtocolMessageEnum { - /** - * COUNTER = 0; - */ - COUNTER(0, 0), - /** - * GAUGE = 1; - */ - GAUGE(1, 1), - /** - * SUMMARY = 2; - */ - SUMMARY(2, 2), - /** - * UNTYPED = 3; - */ - UNTYPED(3, 3), - /** - * HISTOGRAM = 4; - */ - HISTOGRAM(4, 4), - ; - - /** - * COUNTER = 0; - */ - public static final int COUNTER_VALUE = 0; - /** - * GAUGE = 1; - */ - public static final int GAUGE_VALUE = 1; - /** - * SUMMARY = 2; - */ - public static final int SUMMARY_VALUE = 2; - /** - * UNTYPED = 3; - */ - public static final int UNTYPED_VALUE = 3; - /** - * HISTOGRAM = 4; - */ - public static final int HISTOGRAM_VALUE = 4; - - - public final int getNumber() { return value; } - - public static MetricType valueOf(int value) { - switch (value) { - case 0: return COUNTER; - case 1: return GAUGE; - case 2: return SUMMARY; - case 3: return UNTYPED; - case 4: return HISTOGRAM; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public MetricType findValueByNumber(int number) { - return MetricType.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return io.prometheus.client.Metrics.getDescriptor().getEnumTypes().get(0); - } - - private static final MetricType[] VALUES = values(); - - public static MetricType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private MetricType(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:io.prometheus.client.MetricType) - } - - public interface LabelPairOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.LabelPair) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string name = 1; - */ - boolean hasName(); - /** - * optional string name = 1; - */ - java.lang.String getName(); - /** - * optional string name = 1; - */ - com.google.protobuf.ByteString - getNameBytes(); - - /** - * optional string value = 2; - */ - boolean hasValue(); - /** - * optional string value = 2; - */ - java.lang.String getValue(); - /** - * optional string value = 2; - */ - com.google.protobuf.ByteString - getValueBytes(); - } - /** - * Protobuf type {@code io.prometheus.client.LabelPair} - */ - public static final class LabelPair extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.LabelPair) - LabelPairOrBuilder { - // Use LabelPair.newBuilder() to construct. - private LabelPair(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private LabelPair(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final LabelPair defaultInstance; - public static LabelPair getDefaultInstance() { - return defaultInstance; - } - - public LabelPair getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private LabelPair( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - name_ = bs; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - value_ = bs; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_LabelPair_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_LabelPair_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.LabelPair.class, io.prometheus.client.Metrics.LabelPair.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public LabelPair parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new LabelPair(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int NAME_FIELD_NUMBER = 1; - private java.lang.Object name_; - /** - * optional string name = 1; - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string name = 1; - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - name_ = s; - } - return s; - } - } - /** - * optional string name = 1; - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int VALUE_FIELD_NUMBER = 2; - private java.lang.Object value_; - /** - * optional string value = 2; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string value = 2; - */ - public java.lang.String getValue() { - java.lang.Object ref = value_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - value_ = s; - } - return s; - } - } - /** - * optional string value = 2; - */ - public com.google.protobuf.ByteString - getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - name_ = ""; - value_ = ""; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getValueBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getValueBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.LabelPair parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.LabelPair parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.LabelPair parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.LabelPair parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.LabelPair parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.LabelPair parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.LabelPair parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.LabelPair parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.LabelPair parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.LabelPair parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.LabelPair prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.LabelPair} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.LabelPair) - io.prometheus.client.Metrics.LabelPairOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_LabelPair_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_LabelPair_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.LabelPair.class, io.prometheus.client.Metrics.LabelPair.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.LabelPair.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - name_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_LabelPair_descriptor; - } - - public io.prometheus.client.Metrics.LabelPair getDefaultInstanceForType() { - return io.prometheus.client.Metrics.LabelPair.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.LabelPair build() { - io.prometheus.client.Metrics.LabelPair result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.LabelPair buildPartial() { - io.prometheus.client.Metrics.LabelPair result = new io.prometheus.client.Metrics.LabelPair(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.LabelPair) { - return mergeFrom((io.prometheus.client.Metrics.LabelPair)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.LabelPair other) { - if (other == io.prometheus.client.Metrics.LabelPair.getDefaultInstance()) return this; - if (other.hasName()) { - bitField0_ |= 0x00000001; - name_ = other.name_; - onChanged(); - } - if (other.hasValue()) { - bitField0_ |= 0x00000002; - value_ = other.value_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.LabelPair parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.LabelPair) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.lang.Object name_ = ""; - /** - * optional string name = 1; - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string name = 1; - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - name_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string name = 1; - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string name = 1; - */ - public Builder setName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - /** - * optional string name = 1; - */ - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * optional string name = 1; - */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - - private java.lang.Object value_ = ""; - /** - * optional string value = 2; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string value = 2; - */ - public java.lang.String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - value_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string value = 2; - */ - public com.google.protobuf.ByteString - getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string value = 2; - */ - public Builder setValue( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - /** - * optional string value = 2; - */ - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - /** - * optional string value = 2; - */ - public Builder setValueBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.LabelPair) - } - - static { - defaultInstance = new LabelPair(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.LabelPair) - } - - public interface GaugeOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.Gauge) - com.google.protobuf.MessageOrBuilder { - - /** - * optional double value = 1; - */ - boolean hasValue(); - /** - * optional double value = 1; - */ - double getValue(); - } - /** - * Protobuf type {@code io.prometheus.client.Gauge} - */ - public static final class Gauge extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.Gauge) - GaugeOrBuilder { - // Use Gauge.newBuilder() to construct. - private Gauge(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Gauge(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Gauge defaultInstance; - public static Gauge getDefaultInstance() { - return defaultInstance; - } - - public Gauge getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Gauge( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 9: { - bitField0_ |= 0x00000001; - value_ = input.readDouble(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Gauge_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Gauge_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Gauge.class, io.prometheus.client.Metrics.Gauge.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Gauge parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Gauge(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int VALUE_FIELD_NUMBER = 1; - private double value_; - /** - * optional double value = 1; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional double value = 1; - */ - public double getValue() { - return value_; - } - - private void initFields() { - value_ = 0D; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeDouble(1, value_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(1, value_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.Gauge parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Gauge parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Gauge parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Gauge parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Gauge parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Gauge parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Gauge parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.Gauge parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Gauge parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Gauge parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.Gauge prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.Gauge} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.Gauge) - io.prometheus.client.Metrics.GaugeOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Gauge_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Gauge_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Gauge.class, io.prometheus.client.Metrics.Gauge.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.Gauge.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - value_ = 0D; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Gauge_descriptor; - } - - public io.prometheus.client.Metrics.Gauge getDefaultInstanceForType() { - return io.prometheus.client.Metrics.Gauge.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.Gauge build() { - io.prometheus.client.Metrics.Gauge result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.Gauge buildPartial() { - io.prometheus.client.Metrics.Gauge result = new io.prometheus.client.Metrics.Gauge(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.value_ = value_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.Gauge) { - return mergeFrom((io.prometheus.client.Metrics.Gauge)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.Gauge other) { - if (other == io.prometheus.client.Metrics.Gauge.getDefaultInstance()) return this; - if (other.hasValue()) { - setValue(other.getValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.Gauge parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.Gauge) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private double value_ ; - /** - * optional double value = 1; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional double value = 1; - */ - public double getValue() { - return value_; - } - /** - * optional double value = 1; - */ - public Builder setValue(double value) { - bitField0_ |= 0x00000001; - value_ = value; - onChanged(); - return this; - } - /** - * optional double value = 1; - */ - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000001); - value_ = 0D; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.Gauge) - } - - static { - defaultInstance = new Gauge(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Gauge) - } - - public interface CounterOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.Counter) - com.google.protobuf.MessageOrBuilder { - - /** - * optional double value = 1; - */ - boolean hasValue(); - /** - * optional double value = 1; - */ - double getValue(); - } - /** - * Protobuf type {@code io.prometheus.client.Counter} - */ - public static final class Counter extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.Counter) - CounterOrBuilder { - // Use Counter.newBuilder() to construct. - private Counter(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Counter(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Counter defaultInstance; - public static Counter getDefaultInstance() { - return defaultInstance; - } - - public Counter getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Counter( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 9: { - bitField0_ |= 0x00000001; - value_ = input.readDouble(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Counter_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Counter_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Counter.class, io.prometheus.client.Metrics.Counter.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Counter parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Counter(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int VALUE_FIELD_NUMBER = 1; - private double value_; - /** - * optional double value = 1; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional double value = 1; - */ - public double getValue() { - return value_; - } - - private void initFields() { - value_ = 0D; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeDouble(1, value_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(1, value_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.Counter parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Counter parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Counter parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Counter parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Counter parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Counter parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Counter parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.Counter parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Counter parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Counter parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.Counter prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.Counter} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.Counter) - io.prometheus.client.Metrics.CounterOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Counter_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Counter_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Counter.class, io.prometheus.client.Metrics.Counter.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.Counter.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - value_ = 0D; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Counter_descriptor; - } - - public io.prometheus.client.Metrics.Counter getDefaultInstanceForType() { - return io.prometheus.client.Metrics.Counter.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.Counter build() { - io.prometheus.client.Metrics.Counter result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.Counter buildPartial() { - io.prometheus.client.Metrics.Counter result = new io.prometheus.client.Metrics.Counter(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.value_ = value_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.Counter) { - return mergeFrom((io.prometheus.client.Metrics.Counter)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.Counter other) { - if (other == io.prometheus.client.Metrics.Counter.getDefaultInstance()) return this; - if (other.hasValue()) { - setValue(other.getValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.Counter parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.Counter) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private double value_ ; - /** - * optional double value = 1; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional double value = 1; - */ - public double getValue() { - return value_; - } - /** - * optional double value = 1; - */ - public Builder setValue(double value) { - bitField0_ |= 0x00000001; - value_ = value; - onChanged(); - return this; - } - /** - * optional double value = 1; - */ - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000001); - value_ = 0D; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.Counter) - } - - static { - defaultInstance = new Counter(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Counter) - } - - public interface QuantileOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.Quantile) - com.google.protobuf.MessageOrBuilder { - - /** - * optional double quantile = 1; - */ - boolean hasQuantile(); - /** - * optional double quantile = 1; - */ - double getQuantile(); - - /** - * optional double value = 2; - */ - boolean hasValue(); - /** - * optional double value = 2; - */ - double getValue(); - } - /** - * Protobuf type {@code io.prometheus.client.Quantile} - */ - public static final class Quantile extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.Quantile) - QuantileOrBuilder { - // Use Quantile.newBuilder() to construct. - private Quantile(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Quantile(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Quantile defaultInstance; - public static Quantile getDefaultInstance() { - return defaultInstance; - } - - public Quantile getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Quantile( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 9: { - bitField0_ |= 0x00000001; - quantile_ = input.readDouble(); - break; - } - case 17: { - bitField0_ |= 0x00000002; - value_ = input.readDouble(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Quantile_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Quantile_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Quantile.class, io.prometheus.client.Metrics.Quantile.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Quantile parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Quantile(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int QUANTILE_FIELD_NUMBER = 1; - private double quantile_; - /** - * optional double quantile = 1; - */ - public boolean hasQuantile() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional double quantile = 1; - */ - public double getQuantile() { - return quantile_; - } - - public static final int VALUE_FIELD_NUMBER = 2; - private double value_; - /** - * optional double value = 2; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional double value = 2; - */ - public double getValue() { - return value_; - } - - private void initFields() { - quantile_ = 0D; - value_ = 0D; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeDouble(1, quantile_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeDouble(2, value_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(1, quantile_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(2, value_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.Quantile parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Quantile parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Quantile parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Quantile parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Quantile parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Quantile parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Quantile parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.Quantile parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Quantile parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Quantile parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.Quantile prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.Quantile} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.Quantile) - io.prometheus.client.Metrics.QuantileOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Quantile_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Quantile_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Quantile.class, io.prometheus.client.Metrics.Quantile.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.Quantile.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - quantile_ = 0D; - bitField0_ = (bitField0_ & ~0x00000001); - value_ = 0D; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Quantile_descriptor; - } - - public io.prometheus.client.Metrics.Quantile getDefaultInstanceForType() { - return io.prometheus.client.Metrics.Quantile.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.Quantile build() { - io.prometheus.client.Metrics.Quantile result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.Quantile buildPartial() { - io.prometheus.client.Metrics.Quantile result = new io.prometheus.client.Metrics.Quantile(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.quantile_ = quantile_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.value_ = value_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.Quantile) { - return mergeFrom((io.prometheus.client.Metrics.Quantile)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.Quantile other) { - if (other == io.prometheus.client.Metrics.Quantile.getDefaultInstance()) return this; - if (other.hasQuantile()) { - setQuantile(other.getQuantile()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.Quantile parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.Quantile) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private double quantile_ ; - /** - * optional double quantile = 1; - */ - public boolean hasQuantile() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional double quantile = 1; - */ - public double getQuantile() { - return quantile_; - } - /** - * optional double quantile = 1; - */ - public Builder setQuantile(double value) { - bitField0_ |= 0x00000001; - quantile_ = value; - onChanged(); - return this; - } - /** - * optional double quantile = 1; - */ - public Builder clearQuantile() { - bitField0_ = (bitField0_ & ~0x00000001); - quantile_ = 0D; - onChanged(); - return this; - } - - private double value_ ; - /** - * optional double value = 2; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional double value = 2; - */ - public double getValue() { - return value_; - } - /** - * optional double value = 2; - */ - public Builder setValue(double value) { - bitField0_ |= 0x00000002; - value_ = value; - onChanged(); - return this; - } - /** - * optional double value = 2; - */ - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000002); - value_ = 0D; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.Quantile) - } - - static { - defaultInstance = new Quantile(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Quantile) - } - - public interface SummaryOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.Summary) - com.google.protobuf.MessageOrBuilder { - - /** - * optional uint64 sample_count = 1; - */ - boolean hasSampleCount(); - /** - * optional uint64 sample_count = 1; - */ - long getSampleCount(); - - /** - * optional double sample_sum = 2; - */ - boolean hasSampleSum(); - /** - * optional double sample_sum = 2; - */ - double getSampleSum(); - - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - java.util.List - getQuantileList(); - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - io.prometheus.client.Metrics.Quantile getQuantile(int index); - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - int getQuantileCount(); - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - java.util.List - getQuantileOrBuilderList(); - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - io.prometheus.client.Metrics.QuantileOrBuilder getQuantileOrBuilder( - int index); - } - /** - * Protobuf type {@code io.prometheus.client.Summary} - */ - public static final class Summary extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.Summary) - SummaryOrBuilder { - // Use Summary.newBuilder() to construct. - private Summary(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Summary(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Summary defaultInstance; - public static Summary getDefaultInstance() { - return defaultInstance; - } - - public Summary getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Summary( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - sampleCount_ = input.readUInt64(); - break; - } - case 17: { - bitField0_ |= 0x00000002; - sampleSum_ = input.readDouble(); - break; - } - case 26: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - quantile_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - quantile_.add(input.readMessage(io.prometheus.client.Metrics.Quantile.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - quantile_ = java.util.Collections.unmodifiableList(quantile_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Summary_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Summary_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Summary.class, io.prometheus.client.Metrics.Summary.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Summary parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Summary(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int SAMPLE_COUNT_FIELD_NUMBER = 1; - private long sampleCount_; - /** - * optional uint64 sample_count = 1; - */ - public boolean hasSampleCount() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint64 sample_count = 1; - */ - public long getSampleCount() { - return sampleCount_; - } - - public static final int SAMPLE_SUM_FIELD_NUMBER = 2; - private double sampleSum_; - /** - * optional double sample_sum = 2; - */ - public boolean hasSampleSum() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional double sample_sum = 2; - */ - public double getSampleSum() { - return sampleSum_; - } - - public static final int QUANTILE_FIELD_NUMBER = 3; - private java.util.List quantile_; - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public java.util.List getQuantileList() { - return quantile_; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public java.util.List - getQuantileOrBuilderList() { - return quantile_; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public int getQuantileCount() { - return quantile_.size(); - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public io.prometheus.client.Metrics.Quantile getQuantile(int index) { - return quantile_.get(index); - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public io.prometheus.client.Metrics.QuantileOrBuilder getQuantileOrBuilder( - int index) { - return quantile_.get(index); - } - - private void initFields() { - sampleCount_ = 0L; - sampleSum_ = 0D; - quantile_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt64(1, sampleCount_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeDouble(2, sampleSum_); - } - for (int i = 0; i < quantile_.size(); i++) { - output.writeMessage(3, quantile_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, sampleCount_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(2, sampleSum_); - } - for (int i = 0; i < quantile_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, quantile_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.Summary parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Summary parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Summary parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Summary parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Summary parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Summary parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Summary parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.Summary parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Summary parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Summary parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.Summary prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.Summary} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.Summary) - io.prometheus.client.Metrics.SummaryOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Summary_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Summary_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Summary.class, io.prometheus.client.Metrics.Summary.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.Summary.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getQuantileFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - sampleCount_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - sampleSum_ = 0D; - bitField0_ = (bitField0_ & ~0x00000002); - if (quantileBuilder_ == null) { - quantile_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - quantileBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Summary_descriptor; - } - - public io.prometheus.client.Metrics.Summary getDefaultInstanceForType() { - return io.prometheus.client.Metrics.Summary.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.Summary build() { - io.prometheus.client.Metrics.Summary result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.Summary buildPartial() { - io.prometheus.client.Metrics.Summary result = new io.prometheus.client.Metrics.Summary(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.sampleCount_ = sampleCount_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.sampleSum_ = sampleSum_; - if (quantileBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - quantile_ = java.util.Collections.unmodifiableList(quantile_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.quantile_ = quantile_; - } else { - result.quantile_ = quantileBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.Summary) { - return mergeFrom((io.prometheus.client.Metrics.Summary)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.Summary other) { - if (other == io.prometheus.client.Metrics.Summary.getDefaultInstance()) return this; - if (other.hasSampleCount()) { - setSampleCount(other.getSampleCount()); - } - if (other.hasSampleSum()) { - setSampleSum(other.getSampleSum()); - } - if (quantileBuilder_ == null) { - if (!other.quantile_.isEmpty()) { - if (quantile_.isEmpty()) { - quantile_ = other.quantile_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureQuantileIsMutable(); - quantile_.addAll(other.quantile_); - } - onChanged(); - } - } else { - if (!other.quantile_.isEmpty()) { - if (quantileBuilder_.isEmpty()) { - quantileBuilder_.dispose(); - quantileBuilder_ = null; - quantile_ = other.quantile_; - bitField0_ = (bitField0_ & ~0x00000004); - quantileBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getQuantileFieldBuilder() : null; - } else { - quantileBuilder_.addAllMessages(other.quantile_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.Summary parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.Summary) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private long sampleCount_ ; - /** - * optional uint64 sample_count = 1; - */ - public boolean hasSampleCount() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint64 sample_count = 1; - */ - public long getSampleCount() { - return sampleCount_; - } - /** - * optional uint64 sample_count = 1; - */ - public Builder setSampleCount(long value) { - bitField0_ |= 0x00000001; - sampleCount_ = value; - onChanged(); - return this; - } - /** - * optional uint64 sample_count = 1; - */ - public Builder clearSampleCount() { - bitField0_ = (bitField0_ & ~0x00000001); - sampleCount_ = 0L; - onChanged(); - return this; - } - - private double sampleSum_ ; - /** - * optional double sample_sum = 2; - */ - public boolean hasSampleSum() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional double sample_sum = 2; - */ - public double getSampleSum() { - return sampleSum_; - } - /** - * optional double sample_sum = 2; - */ - public Builder setSampleSum(double value) { - bitField0_ |= 0x00000002; - sampleSum_ = value; - onChanged(); - return this; - } - /** - * optional double sample_sum = 2; - */ - public Builder clearSampleSum() { - bitField0_ = (bitField0_ & ~0x00000002); - sampleSum_ = 0D; - onChanged(); - return this; - } - - private java.util.List quantile_ = - java.util.Collections.emptyList(); - private void ensureQuantileIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - quantile_ = new java.util.ArrayList(quantile_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.Quantile, io.prometheus.client.Metrics.Quantile.Builder, io.prometheus.client.Metrics.QuantileOrBuilder> quantileBuilder_; - - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public java.util.List getQuantileList() { - if (quantileBuilder_ == null) { - return java.util.Collections.unmodifiableList(quantile_); - } else { - return quantileBuilder_.getMessageList(); - } - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public int getQuantileCount() { - if (quantileBuilder_ == null) { - return quantile_.size(); - } else { - return quantileBuilder_.getCount(); - } - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public io.prometheus.client.Metrics.Quantile getQuantile(int index) { - if (quantileBuilder_ == null) { - return quantile_.get(index); - } else { - return quantileBuilder_.getMessage(index); - } - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public Builder setQuantile( - int index, io.prometheus.client.Metrics.Quantile value) { - if (quantileBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureQuantileIsMutable(); - quantile_.set(index, value); - onChanged(); - } else { - quantileBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public Builder setQuantile( - int index, io.prometheus.client.Metrics.Quantile.Builder builderForValue) { - if (quantileBuilder_ == null) { - ensureQuantileIsMutable(); - quantile_.set(index, builderForValue.build()); - onChanged(); - } else { - quantileBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public Builder addQuantile(io.prometheus.client.Metrics.Quantile value) { - if (quantileBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureQuantileIsMutable(); - quantile_.add(value); - onChanged(); - } else { - quantileBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public Builder addQuantile( - int index, io.prometheus.client.Metrics.Quantile value) { - if (quantileBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureQuantileIsMutable(); - quantile_.add(index, value); - onChanged(); - } else { - quantileBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public Builder addQuantile( - io.prometheus.client.Metrics.Quantile.Builder builderForValue) { - if (quantileBuilder_ == null) { - ensureQuantileIsMutable(); - quantile_.add(builderForValue.build()); - onChanged(); - } else { - quantileBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public Builder addQuantile( - int index, io.prometheus.client.Metrics.Quantile.Builder builderForValue) { - if (quantileBuilder_ == null) { - ensureQuantileIsMutable(); - quantile_.add(index, builderForValue.build()); - onChanged(); - } else { - quantileBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public Builder addAllQuantile( - java.lang.Iterable values) { - if (quantileBuilder_ == null) { - ensureQuantileIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, quantile_); - onChanged(); - } else { - quantileBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public Builder clearQuantile() { - if (quantileBuilder_ == null) { - quantile_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - quantileBuilder_.clear(); - } - return this; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public Builder removeQuantile(int index) { - if (quantileBuilder_ == null) { - ensureQuantileIsMutable(); - quantile_.remove(index); - onChanged(); - } else { - quantileBuilder_.remove(index); - } - return this; - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public io.prometheus.client.Metrics.Quantile.Builder getQuantileBuilder( - int index) { - return getQuantileFieldBuilder().getBuilder(index); - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public io.prometheus.client.Metrics.QuantileOrBuilder getQuantileOrBuilder( - int index) { - if (quantileBuilder_ == null) { - return quantile_.get(index); } else { - return quantileBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public java.util.List - getQuantileOrBuilderList() { - if (quantileBuilder_ != null) { - return quantileBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(quantile_); - } - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public io.prometheus.client.Metrics.Quantile.Builder addQuantileBuilder() { - return getQuantileFieldBuilder().addBuilder( - io.prometheus.client.Metrics.Quantile.getDefaultInstance()); - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public io.prometheus.client.Metrics.Quantile.Builder addQuantileBuilder( - int index) { - return getQuantileFieldBuilder().addBuilder( - index, io.prometheus.client.Metrics.Quantile.getDefaultInstance()); - } - /** - * repeated .io.prometheus.client.Quantile quantile = 3; - */ - public java.util.List - getQuantileBuilderList() { - return getQuantileFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.Quantile, io.prometheus.client.Metrics.Quantile.Builder, io.prometheus.client.Metrics.QuantileOrBuilder> - getQuantileFieldBuilder() { - if (quantileBuilder_ == null) { - quantileBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.Quantile, io.prometheus.client.Metrics.Quantile.Builder, io.prometheus.client.Metrics.QuantileOrBuilder>( - quantile_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - quantile_ = null; - } - return quantileBuilder_; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.Summary) - } - - static { - defaultInstance = new Summary(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Summary) - } - - public interface UntypedOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.Untyped) - com.google.protobuf.MessageOrBuilder { - - /** - * optional double value = 1; - */ - boolean hasValue(); - /** - * optional double value = 1; - */ - double getValue(); - } - /** - * Protobuf type {@code io.prometheus.client.Untyped} - */ - public static final class Untyped extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.Untyped) - UntypedOrBuilder { - // Use Untyped.newBuilder() to construct. - private Untyped(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Untyped(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Untyped defaultInstance; - public static Untyped getDefaultInstance() { - return defaultInstance; - } - - public Untyped getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Untyped( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 9: { - bitField0_ |= 0x00000001; - value_ = input.readDouble(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Untyped_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Untyped_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Untyped.class, io.prometheus.client.Metrics.Untyped.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Untyped parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Untyped(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int VALUE_FIELD_NUMBER = 1; - private double value_; - /** - * optional double value = 1; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional double value = 1; - */ - public double getValue() { - return value_; - } - - private void initFields() { - value_ = 0D; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeDouble(1, value_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(1, value_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.Untyped parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Untyped parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Untyped parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Untyped parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Untyped parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Untyped parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Untyped parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.Untyped parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Untyped parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Untyped parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.Untyped prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.Untyped} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.Untyped) - io.prometheus.client.Metrics.UntypedOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Untyped_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Untyped_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Untyped.class, io.prometheus.client.Metrics.Untyped.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.Untyped.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - value_ = 0D; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Untyped_descriptor; - } - - public io.prometheus.client.Metrics.Untyped getDefaultInstanceForType() { - return io.prometheus.client.Metrics.Untyped.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.Untyped build() { - io.prometheus.client.Metrics.Untyped result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.Untyped buildPartial() { - io.prometheus.client.Metrics.Untyped result = new io.prometheus.client.Metrics.Untyped(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.value_ = value_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.Untyped) { - return mergeFrom((io.prometheus.client.Metrics.Untyped)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.Untyped other) { - if (other == io.prometheus.client.Metrics.Untyped.getDefaultInstance()) return this; - if (other.hasValue()) { - setValue(other.getValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.Untyped parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.Untyped) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private double value_ ; - /** - * optional double value = 1; - */ - public boolean hasValue() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional double value = 1; - */ - public double getValue() { - return value_; - } - /** - * optional double value = 1; - */ - public Builder setValue(double value) { - bitField0_ |= 0x00000001; - value_ = value; - onChanged(); - return this; - } - /** - * optional double value = 1; - */ - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000001); - value_ = 0D; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.Untyped) - } - - static { - defaultInstance = new Untyped(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Untyped) - } - - public interface HistogramOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.Histogram) - com.google.protobuf.MessageOrBuilder { - - /** - * optional uint64 sample_count = 1; - */ - boolean hasSampleCount(); - /** - * optional uint64 sample_count = 1; - */ - long getSampleCount(); - - /** - * optional double sample_sum = 2; - */ - boolean hasSampleSum(); - /** - * optional double sample_sum = 2; - */ - double getSampleSum(); - - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - java.util.List - getBucketList(); - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - io.prometheus.client.Metrics.Bucket getBucket(int index); - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - int getBucketCount(); - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - java.util.List - getBucketOrBuilderList(); - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - io.prometheus.client.Metrics.BucketOrBuilder getBucketOrBuilder( - int index); - } - /** - * Protobuf type {@code io.prometheus.client.Histogram} - */ - public static final class Histogram extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.Histogram) - HistogramOrBuilder { - // Use Histogram.newBuilder() to construct. - private Histogram(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Histogram(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Histogram defaultInstance; - public static Histogram getDefaultInstance() { - return defaultInstance; - } - - public Histogram getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Histogram( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - sampleCount_ = input.readUInt64(); - break; - } - case 17: { - bitField0_ |= 0x00000002; - sampleSum_ = input.readDouble(); - break; - } - case 26: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - bucket_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - bucket_.add(input.readMessage(io.prometheus.client.Metrics.Bucket.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - bucket_ = java.util.Collections.unmodifiableList(bucket_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Histogram_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Histogram_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Histogram.class, io.prometheus.client.Metrics.Histogram.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Histogram parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Histogram(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int SAMPLE_COUNT_FIELD_NUMBER = 1; - private long sampleCount_; - /** - * optional uint64 sample_count = 1; - */ - public boolean hasSampleCount() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint64 sample_count = 1; - */ - public long getSampleCount() { - return sampleCount_; - } - - public static final int SAMPLE_SUM_FIELD_NUMBER = 2; - private double sampleSum_; - /** - * optional double sample_sum = 2; - */ - public boolean hasSampleSum() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional double sample_sum = 2; - */ - public double getSampleSum() { - return sampleSum_; - } - - public static final int BUCKET_FIELD_NUMBER = 3; - private java.util.List bucket_; - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - public java.util.List getBucketList() { - return bucket_; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - public java.util.List - getBucketOrBuilderList() { - return bucket_; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - public int getBucketCount() { - return bucket_.size(); - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - public io.prometheus.client.Metrics.Bucket getBucket(int index) { - return bucket_.get(index); - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-     * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-     * 
- */ - public io.prometheus.client.Metrics.BucketOrBuilder getBucketOrBuilder( - int index) { - return bucket_.get(index); - } - - private void initFields() { - sampleCount_ = 0L; - sampleSum_ = 0D; - bucket_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt64(1, sampleCount_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeDouble(2, sampleSum_); - } - for (int i = 0; i < bucket_.size(); i++) { - output.writeMessage(3, bucket_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, sampleCount_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(2, sampleSum_); - } - for (int i = 0; i < bucket_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, bucket_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.Histogram parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Histogram parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Histogram parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Histogram parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Histogram parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Histogram parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Histogram parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.Histogram parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Histogram parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Histogram parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.Histogram prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.Histogram} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.Histogram) - io.prometheus.client.Metrics.HistogramOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Histogram_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Histogram_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Histogram.class, io.prometheus.client.Metrics.Histogram.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.Histogram.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getBucketFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - sampleCount_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - sampleSum_ = 0D; - bitField0_ = (bitField0_ & ~0x00000002); - if (bucketBuilder_ == null) { - bucket_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - bucketBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Histogram_descriptor; - } - - public io.prometheus.client.Metrics.Histogram getDefaultInstanceForType() { - return io.prometheus.client.Metrics.Histogram.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.Histogram build() { - io.prometheus.client.Metrics.Histogram result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.Histogram buildPartial() { - io.prometheus.client.Metrics.Histogram result = new io.prometheus.client.Metrics.Histogram(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.sampleCount_ = sampleCount_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.sampleSum_ = sampleSum_; - if (bucketBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - bucket_ = java.util.Collections.unmodifiableList(bucket_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.bucket_ = bucket_; - } else { - result.bucket_ = bucketBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.Histogram) { - return mergeFrom((io.prometheus.client.Metrics.Histogram)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.Histogram other) { - if (other == io.prometheus.client.Metrics.Histogram.getDefaultInstance()) return this; - if (other.hasSampleCount()) { - setSampleCount(other.getSampleCount()); - } - if (other.hasSampleSum()) { - setSampleSum(other.getSampleSum()); - } - if (bucketBuilder_ == null) { - if (!other.bucket_.isEmpty()) { - if (bucket_.isEmpty()) { - bucket_ = other.bucket_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureBucketIsMutable(); - bucket_.addAll(other.bucket_); - } - onChanged(); - } - } else { - if (!other.bucket_.isEmpty()) { - if (bucketBuilder_.isEmpty()) { - bucketBuilder_.dispose(); - bucketBuilder_ = null; - bucket_ = other.bucket_; - bitField0_ = (bitField0_ & ~0x00000004); - bucketBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getBucketFieldBuilder() : null; - } else { - bucketBuilder_.addAllMessages(other.bucket_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.Histogram parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.Histogram) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private long sampleCount_ ; - /** - * optional uint64 sample_count = 1; - */ - public boolean hasSampleCount() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint64 sample_count = 1; - */ - public long getSampleCount() { - return sampleCount_; - } - /** - * optional uint64 sample_count = 1; - */ - public Builder setSampleCount(long value) { - bitField0_ |= 0x00000001; - sampleCount_ = value; - onChanged(); - return this; - } - /** - * optional uint64 sample_count = 1; - */ - public Builder clearSampleCount() { - bitField0_ = (bitField0_ & ~0x00000001); - sampleCount_ = 0L; - onChanged(); - return this; - } - - private double sampleSum_ ; - /** - * optional double sample_sum = 2; - */ - public boolean hasSampleSum() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional double sample_sum = 2; - */ - public double getSampleSum() { - return sampleSum_; - } - /** - * optional double sample_sum = 2; - */ - public Builder setSampleSum(double value) { - bitField0_ |= 0x00000002; - sampleSum_ = value; - onChanged(); - return this; - } - /** - * optional double sample_sum = 2; - */ - public Builder clearSampleSum() { - bitField0_ = (bitField0_ & ~0x00000002); - sampleSum_ = 0D; - onChanged(); - return this; - } - - private java.util.List bucket_ = - java.util.Collections.emptyList(); - private void ensureBucketIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - bucket_ = new java.util.ArrayList(bucket_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.Bucket, io.prometheus.client.Metrics.Bucket.Builder, io.prometheus.client.Metrics.BucketOrBuilder> bucketBuilder_; - - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public java.util.List getBucketList() { - if (bucketBuilder_ == null) { - return java.util.Collections.unmodifiableList(bucket_); - } else { - return bucketBuilder_.getMessageList(); - } - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public int getBucketCount() { - if (bucketBuilder_ == null) { - return bucket_.size(); - } else { - return bucketBuilder_.getCount(); - } - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public io.prometheus.client.Metrics.Bucket getBucket(int index) { - if (bucketBuilder_ == null) { - return bucket_.get(index); - } else { - return bucketBuilder_.getMessage(index); - } - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public Builder setBucket( - int index, io.prometheus.client.Metrics.Bucket value) { - if (bucketBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureBucketIsMutable(); - bucket_.set(index, value); - onChanged(); - } else { - bucketBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public Builder setBucket( - int index, io.prometheus.client.Metrics.Bucket.Builder builderForValue) { - if (bucketBuilder_ == null) { - ensureBucketIsMutable(); - bucket_.set(index, builderForValue.build()); - onChanged(); - } else { - bucketBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public Builder addBucket(io.prometheus.client.Metrics.Bucket value) { - if (bucketBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureBucketIsMutable(); - bucket_.add(value); - onChanged(); - } else { - bucketBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public Builder addBucket( - int index, io.prometheus.client.Metrics.Bucket value) { - if (bucketBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureBucketIsMutable(); - bucket_.add(index, value); - onChanged(); - } else { - bucketBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public Builder addBucket( - io.prometheus.client.Metrics.Bucket.Builder builderForValue) { - if (bucketBuilder_ == null) { - ensureBucketIsMutable(); - bucket_.add(builderForValue.build()); - onChanged(); - } else { - bucketBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public Builder addBucket( - int index, io.prometheus.client.Metrics.Bucket.Builder builderForValue) { - if (bucketBuilder_ == null) { - ensureBucketIsMutable(); - bucket_.add(index, builderForValue.build()); - onChanged(); - } else { - bucketBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public Builder addAllBucket( - java.lang.Iterable values) { - if (bucketBuilder_ == null) { - ensureBucketIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, bucket_); - onChanged(); - } else { - bucketBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public Builder clearBucket() { - if (bucketBuilder_ == null) { - bucket_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - bucketBuilder_.clear(); - } - return this; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public Builder removeBucket(int index) { - if (bucketBuilder_ == null) { - ensureBucketIsMutable(); - bucket_.remove(index); - onChanged(); - } else { - bucketBuilder_.remove(index); - } - return this; - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public io.prometheus.client.Metrics.Bucket.Builder getBucketBuilder( - int index) { - return getBucketFieldBuilder().getBuilder(index); - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public io.prometheus.client.Metrics.BucketOrBuilder getBucketOrBuilder( - int index) { - if (bucketBuilder_ == null) { - return bucket_.get(index); } else { - return bucketBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public java.util.List - getBucketOrBuilderList() { - if (bucketBuilder_ != null) { - return bucketBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(bucket_); - } - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public io.prometheus.client.Metrics.Bucket.Builder addBucketBuilder() { - return getBucketFieldBuilder().addBuilder( - io.prometheus.client.Metrics.Bucket.getDefaultInstance()); - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public io.prometheus.client.Metrics.Bucket.Builder addBucketBuilder( - int index) { - return getBucketFieldBuilder().addBuilder( - index, io.prometheus.client.Metrics.Bucket.getDefaultInstance()); - } - /** - * repeated .io.prometheus.client.Bucket bucket = 3; - * - *
-       * Ordered in increasing order of upper_bound, +Inf bucket is optional.
-       * 
- */ - public java.util.List - getBucketBuilderList() { - return getBucketFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.Bucket, io.prometheus.client.Metrics.Bucket.Builder, io.prometheus.client.Metrics.BucketOrBuilder> - getBucketFieldBuilder() { - if (bucketBuilder_ == null) { - bucketBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.Bucket, io.prometheus.client.Metrics.Bucket.Builder, io.prometheus.client.Metrics.BucketOrBuilder>( - bucket_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - bucket_ = null; - } - return bucketBuilder_; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.Histogram) - } - - static { - defaultInstance = new Histogram(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Histogram) - } - - public interface BucketOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.Bucket) - com.google.protobuf.MessageOrBuilder { - - /** - * optional uint64 cumulative_count = 1; - * - *
-     * Cumulative in increasing order.
-     * 
- */ - boolean hasCumulativeCount(); - /** - * optional uint64 cumulative_count = 1; - * - *
-     * Cumulative in increasing order.
-     * 
- */ - long getCumulativeCount(); - - /** - * optional double upper_bound = 2; - * - *
-     * Inclusive.
-     * 
- */ - boolean hasUpperBound(); - /** - * optional double upper_bound = 2; - * - *
-     * Inclusive.
-     * 
- */ - double getUpperBound(); - } - /** - * Protobuf type {@code io.prometheus.client.Bucket} - */ - public static final class Bucket extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.Bucket) - BucketOrBuilder { - // Use Bucket.newBuilder() to construct. - private Bucket(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Bucket(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Bucket defaultInstance; - public static Bucket getDefaultInstance() { - return defaultInstance; - } - - public Bucket getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Bucket( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - cumulativeCount_ = input.readUInt64(); - break; - } - case 17: { - bitField0_ |= 0x00000002; - upperBound_ = input.readDouble(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Bucket_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Bucket_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Bucket.class, io.prometheus.client.Metrics.Bucket.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Bucket parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Bucket(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int CUMULATIVE_COUNT_FIELD_NUMBER = 1; - private long cumulativeCount_; - /** - * optional uint64 cumulative_count = 1; - * - *
-     * Cumulative in increasing order.
-     * 
- */ - public boolean hasCumulativeCount() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint64 cumulative_count = 1; - * - *
-     * Cumulative in increasing order.
-     * 
- */ - public long getCumulativeCount() { - return cumulativeCount_; - } - - public static final int UPPER_BOUND_FIELD_NUMBER = 2; - private double upperBound_; - /** - * optional double upper_bound = 2; - * - *
-     * Inclusive.
-     * 
- */ - public boolean hasUpperBound() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional double upper_bound = 2; - * - *
-     * Inclusive.
-     * 
- */ - public double getUpperBound() { - return upperBound_; - } - - private void initFields() { - cumulativeCount_ = 0L; - upperBound_ = 0D; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt64(1, cumulativeCount_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeDouble(2, upperBound_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, cumulativeCount_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(2, upperBound_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.Bucket parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Bucket parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Bucket parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Bucket parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Bucket parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Bucket parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Bucket parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.Bucket parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Bucket parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Bucket parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.Bucket prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.Bucket} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.Bucket) - io.prometheus.client.Metrics.BucketOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Bucket_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Bucket_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Bucket.class, io.prometheus.client.Metrics.Bucket.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.Bucket.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - cumulativeCount_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - upperBound_ = 0D; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Bucket_descriptor; - } - - public io.prometheus.client.Metrics.Bucket getDefaultInstanceForType() { - return io.prometheus.client.Metrics.Bucket.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.Bucket build() { - io.prometheus.client.Metrics.Bucket result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.Bucket buildPartial() { - io.prometheus.client.Metrics.Bucket result = new io.prometheus.client.Metrics.Bucket(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.cumulativeCount_ = cumulativeCount_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.upperBound_ = upperBound_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.Bucket) { - return mergeFrom((io.prometheus.client.Metrics.Bucket)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.Bucket other) { - if (other == io.prometheus.client.Metrics.Bucket.getDefaultInstance()) return this; - if (other.hasCumulativeCount()) { - setCumulativeCount(other.getCumulativeCount()); - } - if (other.hasUpperBound()) { - setUpperBound(other.getUpperBound()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.Bucket parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.Bucket) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private long cumulativeCount_ ; - /** - * optional uint64 cumulative_count = 1; - * - *
-       * Cumulative in increasing order.
-       * 
- */ - public boolean hasCumulativeCount() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint64 cumulative_count = 1; - * - *
-       * Cumulative in increasing order.
-       * 
- */ - public long getCumulativeCount() { - return cumulativeCount_; - } - /** - * optional uint64 cumulative_count = 1; - * - *
-       * Cumulative in increasing order.
-       * 
- */ - public Builder setCumulativeCount(long value) { - bitField0_ |= 0x00000001; - cumulativeCount_ = value; - onChanged(); - return this; - } - /** - * optional uint64 cumulative_count = 1; - * - *
-       * Cumulative in increasing order.
-       * 
- */ - public Builder clearCumulativeCount() { - bitField0_ = (bitField0_ & ~0x00000001); - cumulativeCount_ = 0L; - onChanged(); - return this; - } - - private double upperBound_ ; - /** - * optional double upper_bound = 2; - * - *
-       * Inclusive.
-       * 
- */ - public boolean hasUpperBound() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional double upper_bound = 2; - * - *
-       * Inclusive.
-       * 
- */ - public double getUpperBound() { - return upperBound_; - } - /** - * optional double upper_bound = 2; - * - *
-       * Inclusive.
-       * 
- */ - public Builder setUpperBound(double value) { - bitField0_ |= 0x00000002; - upperBound_ = value; - onChanged(); - return this; - } - /** - * optional double upper_bound = 2; - * - *
-       * Inclusive.
-       * 
- */ - public Builder clearUpperBound() { - bitField0_ = (bitField0_ & ~0x00000002); - upperBound_ = 0D; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.Bucket) - } - - static { - defaultInstance = new Bucket(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Bucket) - } - - public interface MetricOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.Metric) - com.google.protobuf.MessageOrBuilder { - - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - java.util.List - getLabelList(); - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - io.prometheus.client.Metrics.LabelPair getLabel(int index); - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - int getLabelCount(); - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - java.util.List - getLabelOrBuilderList(); - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - io.prometheus.client.Metrics.LabelPairOrBuilder getLabelOrBuilder( - int index); - - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - boolean hasGauge(); - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - io.prometheus.client.Metrics.Gauge getGauge(); - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - io.prometheus.client.Metrics.GaugeOrBuilder getGaugeOrBuilder(); - - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - boolean hasCounter(); - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - io.prometheus.client.Metrics.Counter getCounter(); - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - io.prometheus.client.Metrics.CounterOrBuilder getCounterOrBuilder(); - - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - boolean hasSummary(); - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - io.prometheus.client.Metrics.Summary getSummary(); - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - io.prometheus.client.Metrics.SummaryOrBuilder getSummaryOrBuilder(); - - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - boolean hasUntyped(); - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - io.prometheus.client.Metrics.Untyped getUntyped(); - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - io.prometheus.client.Metrics.UntypedOrBuilder getUntypedOrBuilder(); - - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - boolean hasHistogram(); - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - io.prometheus.client.Metrics.Histogram getHistogram(); - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - io.prometheus.client.Metrics.HistogramOrBuilder getHistogramOrBuilder(); - - /** - * optional int64 timestamp_ms = 6; - */ - boolean hasTimestampMs(); - /** - * optional int64 timestamp_ms = 6; - */ - long getTimestampMs(); - } - /** - * Protobuf type {@code io.prometheus.client.Metric} - */ - public static final class Metric extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.Metric) - MetricOrBuilder { - // Use Metric.newBuilder() to construct. - private Metric(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private Metric(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final Metric defaultInstance; - public static Metric getDefaultInstance() { - return defaultInstance; - } - - public Metric getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Metric( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - label_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - label_.add(input.readMessage(io.prometheus.client.Metrics.LabelPair.PARSER, extensionRegistry)); - break; - } - case 18: { - io.prometheus.client.Metrics.Gauge.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - subBuilder = gauge_.toBuilder(); - } - gauge_ = input.readMessage(io.prometheus.client.Metrics.Gauge.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(gauge_); - gauge_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - case 26: { - io.prometheus.client.Metrics.Counter.Builder subBuilder = null; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subBuilder = counter_.toBuilder(); - } - counter_ = input.readMessage(io.prometheus.client.Metrics.Counter.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(counter_); - counter_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000002; - break; - } - case 34: { - io.prometheus.client.Metrics.Summary.Builder subBuilder = null; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - subBuilder = summary_.toBuilder(); - } - summary_ = input.readMessage(io.prometheus.client.Metrics.Summary.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(summary_); - summary_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000004; - break; - } - case 42: { - io.prometheus.client.Metrics.Untyped.Builder subBuilder = null; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - subBuilder = untyped_.toBuilder(); - } - untyped_ = input.readMessage(io.prometheus.client.Metrics.Untyped.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(untyped_); - untyped_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000008; - break; - } - case 48: { - bitField0_ |= 0x00000020; - timestampMs_ = input.readInt64(); - break; - } - case 58: { - io.prometheus.client.Metrics.Histogram.Builder subBuilder = null; - if (((bitField0_ & 0x00000010) == 0x00000010)) { - subBuilder = histogram_.toBuilder(); - } - histogram_ = input.readMessage(io.prometheus.client.Metrics.Histogram.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(histogram_); - histogram_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000010; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - label_ = java.util.Collections.unmodifiableList(label_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Metric_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Metric_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Metric.class, io.prometheus.client.Metrics.Metric.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Metric parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Metric(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int LABEL_FIELD_NUMBER = 1; - private java.util.List label_; - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public java.util.List getLabelList() { - return label_; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public java.util.List - getLabelOrBuilderList() { - return label_; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public int getLabelCount() { - return label_.size(); - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public io.prometheus.client.Metrics.LabelPair getLabel(int index) { - return label_.get(index); - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public io.prometheus.client.Metrics.LabelPairOrBuilder getLabelOrBuilder( - int index) { - return label_.get(index); - } - - public static final int GAUGE_FIELD_NUMBER = 2; - private io.prometheus.client.Metrics.Gauge gauge_; - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public boolean hasGauge() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public io.prometheus.client.Metrics.Gauge getGauge() { - return gauge_; - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public io.prometheus.client.Metrics.GaugeOrBuilder getGaugeOrBuilder() { - return gauge_; - } - - public static final int COUNTER_FIELD_NUMBER = 3; - private io.prometheus.client.Metrics.Counter counter_; - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public boolean hasCounter() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public io.prometheus.client.Metrics.Counter getCounter() { - return counter_; - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public io.prometheus.client.Metrics.CounterOrBuilder getCounterOrBuilder() { - return counter_; - } - - public static final int SUMMARY_FIELD_NUMBER = 4; - private io.prometheus.client.Metrics.Summary summary_; - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public boolean hasSummary() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public io.prometheus.client.Metrics.Summary getSummary() { - return summary_; - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public io.prometheus.client.Metrics.SummaryOrBuilder getSummaryOrBuilder() { - return summary_; - } - - public static final int UNTYPED_FIELD_NUMBER = 5; - private io.prometheus.client.Metrics.Untyped untyped_; - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public boolean hasUntyped() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public io.prometheus.client.Metrics.Untyped getUntyped() { - return untyped_; - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public io.prometheus.client.Metrics.UntypedOrBuilder getUntypedOrBuilder() { - return untyped_; - } - - public static final int HISTOGRAM_FIELD_NUMBER = 7; - private io.prometheus.client.Metrics.Histogram histogram_; - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public boolean hasHistogram() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public io.prometheus.client.Metrics.Histogram getHistogram() { - return histogram_; - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public io.prometheus.client.Metrics.HistogramOrBuilder getHistogramOrBuilder() { - return histogram_; - } - - public static final int TIMESTAMP_MS_FIELD_NUMBER = 6; - private long timestampMs_; - /** - * optional int64 timestamp_ms = 6; - */ - public boolean hasTimestampMs() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * optional int64 timestamp_ms = 6; - */ - public long getTimestampMs() { - return timestampMs_; - } - - private void initFields() { - label_ = java.util.Collections.emptyList(); - gauge_ = io.prometheus.client.Metrics.Gauge.getDefaultInstance(); - counter_ = io.prometheus.client.Metrics.Counter.getDefaultInstance(); - summary_ = io.prometheus.client.Metrics.Summary.getDefaultInstance(); - untyped_ = io.prometheus.client.Metrics.Untyped.getDefaultInstance(); - histogram_ = io.prometheus.client.Metrics.Histogram.getDefaultInstance(); - timestampMs_ = 0L; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < label_.size(); i++) { - output.writeMessage(1, label_.get(i)); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(2, gauge_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(3, counter_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeMessage(4, summary_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeMessage(5, untyped_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeInt64(6, timestampMs_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeMessage(7, histogram_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < label_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, label_.get(i)); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, gauge_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, counter_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, summary_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(5, untyped_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(6, timestampMs_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(7, histogram_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.Metric parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Metric parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Metric parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.Metric parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.Metric parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Metric parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Metric parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.Metric parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.Metric parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.Metric parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.Metric prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.Metric} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.Metric) - io.prometheus.client.Metrics.MetricOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Metric_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Metric_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.Metric.class, io.prometheus.client.Metrics.Metric.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.Metric.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getLabelFieldBuilder(); - getGaugeFieldBuilder(); - getCounterFieldBuilder(); - getSummaryFieldBuilder(); - getUntypedFieldBuilder(); - getHistogramFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (labelBuilder_ == null) { - label_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - labelBuilder_.clear(); - } - if (gaugeBuilder_ == null) { - gauge_ = io.prometheus.client.Metrics.Gauge.getDefaultInstance(); - } else { - gaugeBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (counterBuilder_ == null) { - counter_ = io.prometheus.client.Metrics.Counter.getDefaultInstance(); - } else { - counterBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - if (summaryBuilder_ == null) { - summary_ = io.prometheus.client.Metrics.Summary.getDefaultInstance(); - } else { - summaryBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - if (untypedBuilder_ == null) { - untyped_ = io.prometheus.client.Metrics.Untyped.getDefaultInstance(); - } else { - untypedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000010); - if (histogramBuilder_ == null) { - histogram_ = io.prometheus.client.Metrics.Histogram.getDefaultInstance(); - } else { - histogramBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000020); - timestampMs_ = 0L; - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_Metric_descriptor; - } - - public io.prometheus.client.Metrics.Metric getDefaultInstanceForType() { - return io.prometheus.client.Metrics.Metric.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.Metric build() { - io.prometheus.client.Metrics.Metric result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.Metric buildPartial() { - io.prometheus.client.Metrics.Metric result = new io.prometheus.client.Metrics.Metric(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (labelBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - label_ = java.util.Collections.unmodifiableList(label_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.label_ = label_; - } else { - result.label_ = labelBuilder_.build(); - } - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000001; - } - if (gaugeBuilder_ == null) { - result.gauge_ = gauge_; - } else { - result.gauge_ = gaugeBuilder_.build(); - } - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000002; - } - if (counterBuilder_ == null) { - result.counter_ = counter_; - } else { - result.counter_ = counterBuilder_.build(); - } - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000004; - } - if (summaryBuilder_ == null) { - result.summary_ = summary_; - } else { - result.summary_ = summaryBuilder_.build(); - } - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000008; - } - if (untypedBuilder_ == null) { - result.untyped_ = untyped_; - } else { - result.untyped_ = untypedBuilder_.build(); - } - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000010; - } - if (histogramBuilder_ == null) { - result.histogram_ = histogram_; - } else { - result.histogram_ = histogramBuilder_.build(); - } - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000020; - } - result.timestampMs_ = timestampMs_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.Metric) { - return mergeFrom((io.prometheus.client.Metrics.Metric)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.Metric other) { - if (other == io.prometheus.client.Metrics.Metric.getDefaultInstance()) return this; - if (labelBuilder_ == null) { - if (!other.label_.isEmpty()) { - if (label_.isEmpty()) { - label_ = other.label_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureLabelIsMutable(); - label_.addAll(other.label_); - } - onChanged(); - } - } else { - if (!other.label_.isEmpty()) { - if (labelBuilder_.isEmpty()) { - labelBuilder_.dispose(); - labelBuilder_ = null; - label_ = other.label_; - bitField0_ = (bitField0_ & ~0x00000001); - labelBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getLabelFieldBuilder() : null; - } else { - labelBuilder_.addAllMessages(other.label_); - } - } - } - if (other.hasGauge()) { - mergeGauge(other.getGauge()); - } - if (other.hasCounter()) { - mergeCounter(other.getCounter()); - } - if (other.hasSummary()) { - mergeSummary(other.getSummary()); - } - if (other.hasUntyped()) { - mergeUntyped(other.getUntyped()); - } - if (other.hasHistogram()) { - mergeHistogram(other.getHistogram()); - } - if (other.hasTimestampMs()) { - setTimestampMs(other.getTimestampMs()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.Metric parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.Metric) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.util.List label_ = - java.util.Collections.emptyList(); - private void ensureLabelIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - label_ = new java.util.ArrayList(label_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.LabelPair, io.prometheus.client.Metrics.LabelPair.Builder, io.prometheus.client.Metrics.LabelPairOrBuilder> labelBuilder_; - - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public java.util.List getLabelList() { - if (labelBuilder_ == null) { - return java.util.Collections.unmodifiableList(label_); - } else { - return labelBuilder_.getMessageList(); - } - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public int getLabelCount() { - if (labelBuilder_ == null) { - return label_.size(); - } else { - return labelBuilder_.getCount(); - } - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public io.prometheus.client.Metrics.LabelPair getLabel(int index) { - if (labelBuilder_ == null) { - return label_.get(index); - } else { - return labelBuilder_.getMessage(index); - } - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public Builder setLabel( - int index, io.prometheus.client.Metrics.LabelPair value) { - if (labelBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLabelIsMutable(); - label_.set(index, value); - onChanged(); - } else { - labelBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public Builder setLabel( - int index, io.prometheus.client.Metrics.LabelPair.Builder builderForValue) { - if (labelBuilder_ == null) { - ensureLabelIsMutable(); - label_.set(index, builderForValue.build()); - onChanged(); - } else { - labelBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public Builder addLabel(io.prometheus.client.Metrics.LabelPair value) { - if (labelBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLabelIsMutable(); - label_.add(value); - onChanged(); - } else { - labelBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public Builder addLabel( - int index, io.prometheus.client.Metrics.LabelPair value) { - if (labelBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLabelIsMutable(); - label_.add(index, value); - onChanged(); - } else { - labelBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public Builder addLabel( - io.prometheus.client.Metrics.LabelPair.Builder builderForValue) { - if (labelBuilder_ == null) { - ensureLabelIsMutable(); - label_.add(builderForValue.build()); - onChanged(); - } else { - labelBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public Builder addLabel( - int index, io.prometheus.client.Metrics.LabelPair.Builder builderForValue) { - if (labelBuilder_ == null) { - ensureLabelIsMutable(); - label_.add(index, builderForValue.build()); - onChanged(); - } else { - labelBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public Builder addAllLabel( - java.lang.Iterable values) { - if (labelBuilder_ == null) { - ensureLabelIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, label_); - onChanged(); - } else { - labelBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public Builder clearLabel() { - if (labelBuilder_ == null) { - label_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - labelBuilder_.clear(); - } - return this; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public Builder removeLabel(int index) { - if (labelBuilder_ == null) { - ensureLabelIsMutable(); - label_.remove(index); - onChanged(); - } else { - labelBuilder_.remove(index); - } - return this; - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public io.prometheus.client.Metrics.LabelPair.Builder getLabelBuilder( - int index) { - return getLabelFieldBuilder().getBuilder(index); - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public io.prometheus.client.Metrics.LabelPairOrBuilder getLabelOrBuilder( - int index) { - if (labelBuilder_ == null) { - return label_.get(index); } else { - return labelBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public java.util.List - getLabelOrBuilderList() { - if (labelBuilder_ != null) { - return labelBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(label_); - } - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public io.prometheus.client.Metrics.LabelPair.Builder addLabelBuilder() { - return getLabelFieldBuilder().addBuilder( - io.prometheus.client.Metrics.LabelPair.getDefaultInstance()); - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public io.prometheus.client.Metrics.LabelPair.Builder addLabelBuilder( - int index) { - return getLabelFieldBuilder().addBuilder( - index, io.prometheus.client.Metrics.LabelPair.getDefaultInstance()); - } - /** - * repeated .io.prometheus.client.LabelPair label = 1; - */ - public java.util.List - getLabelBuilderList() { - return getLabelFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.LabelPair, io.prometheus.client.Metrics.LabelPair.Builder, io.prometheus.client.Metrics.LabelPairOrBuilder> - getLabelFieldBuilder() { - if (labelBuilder_ == null) { - labelBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.LabelPair, io.prometheus.client.Metrics.LabelPair.Builder, io.prometheus.client.Metrics.LabelPairOrBuilder>( - label_, - ((bitField0_ & 0x00000001) == 0x00000001), - getParentForChildren(), - isClean()); - label_ = null; - } - return labelBuilder_; - } - - private io.prometheus.client.Metrics.Gauge gauge_ = io.prometheus.client.Metrics.Gauge.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Gauge, io.prometheus.client.Metrics.Gauge.Builder, io.prometheus.client.Metrics.GaugeOrBuilder> gaugeBuilder_; - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public boolean hasGauge() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public io.prometheus.client.Metrics.Gauge getGauge() { - if (gaugeBuilder_ == null) { - return gauge_; - } else { - return gaugeBuilder_.getMessage(); - } - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public Builder setGauge(io.prometheus.client.Metrics.Gauge value) { - if (gaugeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - gauge_ = value; - onChanged(); - } else { - gaugeBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public Builder setGauge( - io.prometheus.client.Metrics.Gauge.Builder builderForValue) { - if (gaugeBuilder_ == null) { - gauge_ = builderForValue.build(); - onChanged(); - } else { - gaugeBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public Builder mergeGauge(io.prometheus.client.Metrics.Gauge value) { - if (gaugeBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - gauge_ != io.prometheus.client.Metrics.Gauge.getDefaultInstance()) { - gauge_ = - io.prometheus.client.Metrics.Gauge.newBuilder(gauge_).mergeFrom(value).buildPartial(); - } else { - gauge_ = value; - } - onChanged(); - } else { - gaugeBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public Builder clearGauge() { - if (gaugeBuilder_ == null) { - gauge_ = io.prometheus.client.Metrics.Gauge.getDefaultInstance(); - onChanged(); - } else { - gaugeBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public io.prometheus.client.Metrics.Gauge.Builder getGaugeBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getGaugeFieldBuilder().getBuilder(); - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - public io.prometheus.client.Metrics.GaugeOrBuilder getGaugeOrBuilder() { - if (gaugeBuilder_ != null) { - return gaugeBuilder_.getMessageOrBuilder(); - } else { - return gauge_; - } - } - /** - * optional .io.prometheus.client.Gauge gauge = 2; - */ - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Gauge, io.prometheus.client.Metrics.Gauge.Builder, io.prometheus.client.Metrics.GaugeOrBuilder> - getGaugeFieldBuilder() { - if (gaugeBuilder_ == null) { - gaugeBuilder_ = new com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Gauge, io.prometheus.client.Metrics.Gauge.Builder, io.prometheus.client.Metrics.GaugeOrBuilder>( - getGauge(), - getParentForChildren(), - isClean()); - gauge_ = null; - } - return gaugeBuilder_; - } - - private io.prometheus.client.Metrics.Counter counter_ = io.prometheus.client.Metrics.Counter.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Counter, io.prometheus.client.Metrics.Counter.Builder, io.prometheus.client.Metrics.CounterOrBuilder> counterBuilder_; - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public boolean hasCounter() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public io.prometheus.client.Metrics.Counter getCounter() { - if (counterBuilder_ == null) { - return counter_; - } else { - return counterBuilder_.getMessage(); - } - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public Builder setCounter(io.prometheus.client.Metrics.Counter value) { - if (counterBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - counter_ = value; - onChanged(); - } else { - counterBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public Builder setCounter( - io.prometheus.client.Metrics.Counter.Builder builderForValue) { - if (counterBuilder_ == null) { - counter_ = builderForValue.build(); - onChanged(); - } else { - counterBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public Builder mergeCounter(io.prometheus.client.Metrics.Counter value) { - if (counterBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004) && - counter_ != io.prometheus.client.Metrics.Counter.getDefaultInstance()) { - counter_ = - io.prometheus.client.Metrics.Counter.newBuilder(counter_).mergeFrom(value).buildPartial(); - } else { - counter_ = value; - } - onChanged(); - } else { - counterBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public Builder clearCounter() { - if (counterBuilder_ == null) { - counter_ = io.prometheus.client.Metrics.Counter.getDefaultInstance(); - onChanged(); - } else { - counterBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public io.prometheus.client.Metrics.Counter.Builder getCounterBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getCounterFieldBuilder().getBuilder(); - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - public io.prometheus.client.Metrics.CounterOrBuilder getCounterOrBuilder() { - if (counterBuilder_ != null) { - return counterBuilder_.getMessageOrBuilder(); - } else { - return counter_; - } - } - /** - * optional .io.prometheus.client.Counter counter = 3; - */ - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Counter, io.prometheus.client.Metrics.Counter.Builder, io.prometheus.client.Metrics.CounterOrBuilder> - getCounterFieldBuilder() { - if (counterBuilder_ == null) { - counterBuilder_ = new com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Counter, io.prometheus.client.Metrics.Counter.Builder, io.prometheus.client.Metrics.CounterOrBuilder>( - getCounter(), - getParentForChildren(), - isClean()); - counter_ = null; - } - return counterBuilder_; - } - - private io.prometheus.client.Metrics.Summary summary_ = io.prometheus.client.Metrics.Summary.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Summary, io.prometheus.client.Metrics.Summary.Builder, io.prometheus.client.Metrics.SummaryOrBuilder> summaryBuilder_; - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public boolean hasSummary() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public io.prometheus.client.Metrics.Summary getSummary() { - if (summaryBuilder_ == null) { - return summary_; - } else { - return summaryBuilder_.getMessage(); - } - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public Builder setSummary(io.prometheus.client.Metrics.Summary value) { - if (summaryBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - summary_ = value; - onChanged(); - } else { - summaryBuilder_.setMessage(value); - } - bitField0_ |= 0x00000008; - return this; - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public Builder setSummary( - io.prometheus.client.Metrics.Summary.Builder builderForValue) { - if (summaryBuilder_ == null) { - summary_ = builderForValue.build(); - onChanged(); - } else { - summaryBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000008; - return this; - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public Builder mergeSummary(io.prometheus.client.Metrics.Summary value) { - if (summaryBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008) && - summary_ != io.prometheus.client.Metrics.Summary.getDefaultInstance()) { - summary_ = - io.prometheus.client.Metrics.Summary.newBuilder(summary_).mergeFrom(value).buildPartial(); - } else { - summary_ = value; - } - onChanged(); - } else { - summaryBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000008; - return this; - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public Builder clearSummary() { - if (summaryBuilder_ == null) { - summary_ = io.prometheus.client.Metrics.Summary.getDefaultInstance(); - onChanged(); - } else { - summaryBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public io.prometheus.client.Metrics.Summary.Builder getSummaryBuilder() { - bitField0_ |= 0x00000008; - onChanged(); - return getSummaryFieldBuilder().getBuilder(); - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - public io.prometheus.client.Metrics.SummaryOrBuilder getSummaryOrBuilder() { - if (summaryBuilder_ != null) { - return summaryBuilder_.getMessageOrBuilder(); - } else { - return summary_; - } - } - /** - * optional .io.prometheus.client.Summary summary = 4; - */ - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Summary, io.prometheus.client.Metrics.Summary.Builder, io.prometheus.client.Metrics.SummaryOrBuilder> - getSummaryFieldBuilder() { - if (summaryBuilder_ == null) { - summaryBuilder_ = new com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Summary, io.prometheus.client.Metrics.Summary.Builder, io.prometheus.client.Metrics.SummaryOrBuilder>( - getSummary(), - getParentForChildren(), - isClean()); - summary_ = null; - } - return summaryBuilder_; - } - - private io.prometheus.client.Metrics.Untyped untyped_ = io.prometheus.client.Metrics.Untyped.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Untyped, io.prometheus.client.Metrics.Untyped.Builder, io.prometheus.client.Metrics.UntypedOrBuilder> untypedBuilder_; - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public boolean hasUntyped() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public io.prometheus.client.Metrics.Untyped getUntyped() { - if (untypedBuilder_ == null) { - return untyped_; - } else { - return untypedBuilder_.getMessage(); - } - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public Builder setUntyped(io.prometheus.client.Metrics.Untyped value) { - if (untypedBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - untyped_ = value; - onChanged(); - } else { - untypedBuilder_.setMessage(value); - } - bitField0_ |= 0x00000010; - return this; - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public Builder setUntyped( - io.prometheus.client.Metrics.Untyped.Builder builderForValue) { - if (untypedBuilder_ == null) { - untyped_ = builderForValue.build(); - onChanged(); - } else { - untypedBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000010; - return this; - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public Builder mergeUntyped(io.prometheus.client.Metrics.Untyped value) { - if (untypedBuilder_ == null) { - if (((bitField0_ & 0x00000010) == 0x00000010) && - untyped_ != io.prometheus.client.Metrics.Untyped.getDefaultInstance()) { - untyped_ = - io.prometheus.client.Metrics.Untyped.newBuilder(untyped_).mergeFrom(value).buildPartial(); - } else { - untyped_ = value; - } - onChanged(); - } else { - untypedBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000010; - return this; - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public Builder clearUntyped() { - if (untypedBuilder_ == null) { - untyped_ = io.prometheus.client.Metrics.Untyped.getDefaultInstance(); - onChanged(); - } else { - untypedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public io.prometheus.client.Metrics.Untyped.Builder getUntypedBuilder() { - bitField0_ |= 0x00000010; - onChanged(); - return getUntypedFieldBuilder().getBuilder(); - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - public io.prometheus.client.Metrics.UntypedOrBuilder getUntypedOrBuilder() { - if (untypedBuilder_ != null) { - return untypedBuilder_.getMessageOrBuilder(); - } else { - return untyped_; - } - } - /** - * optional .io.prometheus.client.Untyped untyped = 5; - */ - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Untyped, io.prometheus.client.Metrics.Untyped.Builder, io.prometheus.client.Metrics.UntypedOrBuilder> - getUntypedFieldBuilder() { - if (untypedBuilder_ == null) { - untypedBuilder_ = new com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Untyped, io.prometheus.client.Metrics.Untyped.Builder, io.prometheus.client.Metrics.UntypedOrBuilder>( - getUntyped(), - getParentForChildren(), - isClean()); - untyped_ = null; - } - return untypedBuilder_; - } - - private io.prometheus.client.Metrics.Histogram histogram_ = io.prometheus.client.Metrics.Histogram.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Histogram, io.prometheus.client.Metrics.Histogram.Builder, io.prometheus.client.Metrics.HistogramOrBuilder> histogramBuilder_; - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public boolean hasHistogram() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public io.prometheus.client.Metrics.Histogram getHistogram() { - if (histogramBuilder_ == null) { - return histogram_; - } else { - return histogramBuilder_.getMessage(); - } - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public Builder setHistogram(io.prometheus.client.Metrics.Histogram value) { - if (histogramBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - histogram_ = value; - onChanged(); - } else { - histogramBuilder_.setMessage(value); - } - bitField0_ |= 0x00000020; - return this; - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public Builder setHistogram( - io.prometheus.client.Metrics.Histogram.Builder builderForValue) { - if (histogramBuilder_ == null) { - histogram_ = builderForValue.build(); - onChanged(); - } else { - histogramBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000020; - return this; - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public Builder mergeHistogram(io.prometheus.client.Metrics.Histogram value) { - if (histogramBuilder_ == null) { - if (((bitField0_ & 0x00000020) == 0x00000020) && - histogram_ != io.prometheus.client.Metrics.Histogram.getDefaultInstance()) { - histogram_ = - io.prometheus.client.Metrics.Histogram.newBuilder(histogram_).mergeFrom(value).buildPartial(); - } else { - histogram_ = value; - } - onChanged(); - } else { - histogramBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000020; - return this; - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public Builder clearHistogram() { - if (histogramBuilder_ == null) { - histogram_ = io.prometheus.client.Metrics.Histogram.getDefaultInstance(); - onChanged(); - } else { - histogramBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000020); - return this; - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public io.prometheus.client.Metrics.Histogram.Builder getHistogramBuilder() { - bitField0_ |= 0x00000020; - onChanged(); - return getHistogramFieldBuilder().getBuilder(); - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - public io.prometheus.client.Metrics.HistogramOrBuilder getHistogramOrBuilder() { - if (histogramBuilder_ != null) { - return histogramBuilder_.getMessageOrBuilder(); - } else { - return histogram_; - } - } - /** - * optional .io.prometheus.client.Histogram histogram = 7; - */ - private com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Histogram, io.prometheus.client.Metrics.Histogram.Builder, io.prometheus.client.Metrics.HistogramOrBuilder> - getHistogramFieldBuilder() { - if (histogramBuilder_ == null) { - histogramBuilder_ = new com.google.protobuf.SingleFieldBuilder< - io.prometheus.client.Metrics.Histogram, io.prometheus.client.Metrics.Histogram.Builder, io.prometheus.client.Metrics.HistogramOrBuilder>( - getHistogram(), - getParentForChildren(), - isClean()); - histogram_ = null; - } - return histogramBuilder_; - } - - private long timestampMs_ ; - /** - * optional int64 timestamp_ms = 6; - */ - public boolean hasTimestampMs() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * optional int64 timestamp_ms = 6; - */ - public long getTimestampMs() { - return timestampMs_; - } - /** - * optional int64 timestamp_ms = 6; - */ - public Builder setTimestampMs(long value) { - bitField0_ |= 0x00000040; - timestampMs_ = value; - onChanged(); - return this; - } - /** - * optional int64 timestamp_ms = 6; - */ - public Builder clearTimestampMs() { - bitField0_ = (bitField0_ & ~0x00000040); - timestampMs_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.Metric) - } - - static { - defaultInstance = new Metric(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.Metric) - } - - public interface MetricFamilyOrBuilder extends - // @@protoc_insertion_point(interface_extends:io.prometheus.client.MetricFamily) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string name = 1; - */ - boolean hasName(); - /** - * optional string name = 1; - */ - java.lang.String getName(); - /** - * optional string name = 1; - */ - com.google.protobuf.ByteString - getNameBytes(); - - /** - * optional string help = 2; - */ - boolean hasHelp(); - /** - * optional string help = 2; - */ - java.lang.String getHelp(); - /** - * optional string help = 2; - */ - com.google.protobuf.ByteString - getHelpBytes(); - - /** - * optional .io.prometheus.client.MetricType type = 3; - */ - boolean hasType(); - /** - * optional .io.prometheus.client.MetricType type = 3; - */ - io.prometheus.client.Metrics.MetricType getType(); - - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - java.util.List - getMetricList(); - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - io.prometheus.client.Metrics.Metric getMetric(int index); - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - int getMetricCount(); - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - java.util.List - getMetricOrBuilderList(); - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - io.prometheus.client.Metrics.MetricOrBuilder getMetricOrBuilder( - int index); - } - /** - * Protobuf type {@code io.prometheus.client.MetricFamily} - */ - public static final class MetricFamily extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:io.prometheus.client.MetricFamily) - MetricFamilyOrBuilder { - // Use MetricFamily.newBuilder() to construct. - private MetricFamily(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private MetricFamily(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final MetricFamily defaultInstance; - public static MetricFamily getDefaultInstance() { - return defaultInstance; - } - - public MetricFamily getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private MetricFamily( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - name_ = bs; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - help_ = bs; - break; - } - case 24: { - int rawValue = input.readEnum(); - io.prometheus.client.Metrics.MetricType value = io.prometheus.client.Metrics.MetricType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(3, rawValue); - } else { - bitField0_ |= 0x00000004; - type_ = value; - } - break; - } - case 34: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - metric_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000008; - } - metric_.add(input.readMessage(io.prometheus.client.Metrics.Metric.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - metric_ = java.util.Collections.unmodifiableList(metric_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_MetricFamily_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_MetricFamily_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.MetricFamily.class, io.prometheus.client.Metrics.MetricFamily.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public MetricFamily parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new MetricFamily(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - public static final int NAME_FIELD_NUMBER = 1; - private java.lang.Object name_; - /** - * optional string name = 1; - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string name = 1; - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - name_ = s; - } - return s; - } - } - /** - * optional string name = 1; - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int HELP_FIELD_NUMBER = 2; - private java.lang.Object help_; - /** - * optional string help = 2; - */ - public boolean hasHelp() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string help = 2; - */ - public java.lang.String getHelp() { - java.lang.Object ref = help_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - help_ = s; - } - return s; - } - } - /** - * optional string help = 2; - */ - public com.google.protobuf.ByteString - getHelpBytes() { - java.lang.Object ref = help_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - help_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int TYPE_FIELD_NUMBER = 3; - private io.prometheus.client.Metrics.MetricType type_; - /** - * optional .io.prometheus.client.MetricType type = 3; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .io.prometheus.client.MetricType type = 3; - */ - public io.prometheus.client.Metrics.MetricType getType() { - return type_; - } - - public static final int METRIC_FIELD_NUMBER = 4; - private java.util.List metric_; - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public java.util.List getMetricList() { - return metric_; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public java.util.List - getMetricOrBuilderList() { - return metric_; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public int getMetricCount() { - return metric_.size(); - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public io.prometheus.client.Metrics.Metric getMetric(int index) { - return metric_.get(index); - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public io.prometheus.client.Metrics.MetricOrBuilder getMetricOrBuilder( - int index) { - return metric_.get(index); - } - - private void initFields() { - name_ = ""; - help_ = ""; - type_ = io.prometheus.client.Metrics.MetricType.COUNTER; - metric_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getHelpBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeEnum(3, type_.getNumber()); - } - for (int i = 0; i < metric_.size(); i++) { - output.writeMessage(4, metric_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getHelpBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(3, type_.getNumber()); - } - for (int i = 0; i < metric_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, metric_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static io.prometheus.client.Metrics.MetricFamily parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.MetricFamily parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.MetricFamily parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static io.prometheus.client.Metrics.MetricFamily parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static io.prometheus.client.Metrics.MetricFamily parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.MetricFamily parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.MetricFamily parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static io.prometheus.client.Metrics.MetricFamily parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static io.prometheus.client.Metrics.MetricFamily parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static io.prometheus.client.Metrics.MetricFamily parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(io.prometheus.client.Metrics.MetricFamily prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code io.prometheus.client.MetricFamily} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:io.prometheus.client.MetricFamily) - io.prometheus.client.Metrics.MetricFamilyOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_MetricFamily_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_MetricFamily_fieldAccessorTable - .ensureFieldAccessorsInitialized( - io.prometheus.client.Metrics.MetricFamily.class, io.prometheus.client.Metrics.MetricFamily.Builder.class); - } - - // Construct using io.prometheus.client.Metrics.MetricFamily.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getMetricFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - name_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - help_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - type_ = io.prometheus.client.Metrics.MetricType.COUNTER; - bitField0_ = (bitField0_ & ~0x00000004); - if (metricBuilder_ == null) { - metric_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - metricBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return io.prometheus.client.Metrics.internal_static_io_prometheus_client_MetricFamily_descriptor; - } - - public io.prometheus.client.Metrics.MetricFamily getDefaultInstanceForType() { - return io.prometheus.client.Metrics.MetricFamily.getDefaultInstance(); - } - - public io.prometheus.client.Metrics.MetricFamily build() { - io.prometheus.client.Metrics.MetricFamily result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public io.prometheus.client.Metrics.MetricFamily buildPartial() { - io.prometheus.client.Metrics.MetricFamily result = new io.prometheus.client.Metrics.MetricFamily(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.help_ = help_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.type_ = type_; - if (metricBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - metric_ = java.util.Collections.unmodifiableList(metric_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.metric_ = metric_; - } else { - result.metric_ = metricBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof io.prometheus.client.Metrics.MetricFamily) { - return mergeFrom((io.prometheus.client.Metrics.MetricFamily)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(io.prometheus.client.Metrics.MetricFamily other) { - if (other == io.prometheus.client.Metrics.MetricFamily.getDefaultInstance()) return this; - if (other.hasName()) { - bitField0_ |= 0x00000001; - name_ = other.name_; - onChanged(); - } - if (other.hasHelp()) { - bitField0_ |= 0x00000002; - help_ = other.help_; - onChanged(); - } - if (other.hasType()) { - setType(other.getType()); - } - if (metricBuilder_ == null) { - if (!other.metric_.isEmpty()) { - if (metric_.isEmpty()) { - metric_ = other.metric_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureMetricIsMutable(); - metric_.addAll(other.metric_); - } - onChanged(); - } - } else { - if (!other.metric_.isEmpty()) { - if (metricBuilder_.isEmpty()) { - metricBuilder_.dispose(); - metricBuilder_ = null; - metric_ = other.metric_; - bitField0_ = (bitField0_ & ~0x00000008); - metricBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getMetricFieldBuilder() : null; - } else { - metricBuilder_.addAllMessages(other.metric_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - io.prometheus.client.Metrics.MetricFamily parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (io.prometheus.client.Metrics.MetricFamily) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.lang.Object name_ = ""; - /** - * optional string name = 1; - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional string name = 1; - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - name_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string name = 1; - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string name = 1; - */ - public Builder setName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - /** - * optional string name = 1; - */ - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * optional string name = 1; - */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - - private java.lang.Object help_ = ""; - /** - * optional string help = 2; - */ - public boolean hasHelp() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string help = 2; - */ - public java.lang.String getHelp() { - java.lang.Object ref = help_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - help_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string help = 2; - */ - public com.google.protobuf.ByteString - getHelpBytes() { - java.lang.Object ref = help_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - help_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string help = 2; - */ - public Builder setHelp( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - help_ = value; - onChanged(); - return this; - } - /** - * optional string help = 2; - */ - public Builder clearHelp() { - bitField0_ = (bitField0_ & ~0x00000002); - help_ = getDefaultInstance().getHelp(); - onChanged(); - return this; - } - /** - * optional string help = 2; - */ - public Builder setHelpBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - help_ = value; - onChanged(); - return this; - } - - private io.prometheus.client.Metrics.MetricType type_ = io.prometheus.client.Metrics.MetricType.COUNTER; - /** - * optional .io.prometheus.client.MetricType type = 3; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .io.prometheus.client.MetricType type = 3; - */ - public io.prometheus.client.Metrics.MetricType getType() { - return type_; - } - /** - * optional .io.prometheus.client.MetricType type = 3; - */ - public Builder setType(io.prometheus.client.Metrics.MetricType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - type_ = value; - onChanged(); - return this; - } - /** - * optional .io.prometheus.client.MetricType type = 3; - */ - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000004); - type_ = io.prometheus.client.Metrics.MetricType.COUNTER; - onChanged(); - return this; - } - - private java.util.List metric_ = - java.util.Collections.emptyList(); - private void ensureMetricIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - metric_ = new java.util.ArrayList(metric_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.Metric, io.prometheus.client.Metrics.Metric.Builder, io.prometheus.client.Metrics.MetricOrBuilder> metricBuilder_; - - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public java.util.List getMetricList() { - if (metricBuilder_ == null) { - return java.util.Collections.unmodifiableList(metric_); - } else { - return metricBuilder_.getMessageList(); - } - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public int getMetricCount() { - if (metricBuilder_ == null) { - return metric_.size(); - } else { - return metricBuilder_.getCount(); - } - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public io.prometheus.client.Metrics.Metric getMetric(int index) { - if (metricBuilder_ == null) { - return metric_.get(index); - } else { - return metricBuilder_.getMessage(index); - } - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public Builder setMetric( - int index, io.prometheus.client.Metrics.Metric value) { - if (metricBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureMetricIsMutable(); - metric_.set(index, value); - onChanged(); - } else { - metricBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public Builder setMetric( - int index, io.prometheus.client.Metrics.Metric.Builder builderForValue) { - if (metricBuilder_ == null) { - ensureMetricIsMutable(); - metric_.set(index, builderForValue.build()); - onChanged(); - } else { - metricBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public Builder addMetric(io.prometheus.client.Metrics.Metric value) { - if (metricBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureMetricIsMutable(); - metric_.add(value); - onChanged(); - } else { - metricBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public Builder addMetric( - int index, io.prometheus.client.Metrics.Metric value) { - if (metricBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureMetricIsMutable(); - metric_.add(index, value); - onChanged(); - } else { - metricBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public Builder addMetric( - io.prometheus.client.Metrics.Metric.Builder builderForValue) { - if (metricBuilder_ == null) { - ensureMetricIsMutable(); - metric_.add(builderForValue.build()); - onChanged(); - } else { - metricBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public Builder addMetric( - int index, io.prometheus.client.Metrics.Metric.Builder builderForValue) { - if (metricBuilder_ == null) { - ensureMetricIsMutable(); - metric_.add(index, builderForValue.build()); - onChanged(); - } else { - metricBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public Builder addAllMetric( - java.lang.Iterable values) { - if (metricBuilder_ == null) { - ensureMetricIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, metric_); - onChanged(); - } else { - metricBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public Builder clearMetric() { - if (metricBuilder_ == null) { - metric_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - metricBuilder_.clear(); - } - return this; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public Builder removeMetric(int index) { - if (metricBuilder_ == null) { - ensureMetricIsMutable(); - metric_.remove(index); - onChanged(); - } else { - metricBuilder_.remove(index); - } - return this; - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public io.prometheus.client.Metrics.Metric.Builder getMetricBuilder( - int index) { - return getMetricFieldBuilder().getBuilder(index); - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public io.prometheus.client.Metrics.MetricOrBuilder getMetricOrBuilder( - int index) { - if (metricBuilder_ == null) { - return metric_.get(index); } else { - return metricBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public java.util.List - getMetricOrBuilderList() { - if (metricBuilder_ != null) { - return metricBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(metric_); - } - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public io.prometheus.client.Metrics.Metric.Builder addMetricBuilder() { - return getMetricFieldBuilder().addBuilder( - io.prometheus.client.Metrics.Metric.getDefaultInstance()); - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public io.prometheus.client.Metrics.Metric.Builder addMetricBuilder( - int index) { - return getMetricFieldBuilder().addBuilder( - index, io.prometheus.client.Metrics.Metric.getDefaultInstance()); - } - /** - * repeated .io.prometheus.client.Metric metric = 4; - */ - public java.util.List - getMetricBuilderList() { - return getMetricFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.Metric, io.prometheus.client.Metrics.Metric.Builder, io.prometheus.client.Metrics.MetricOrBuilder> - getMetricFieldBuilder() { - if (metricBuilder_ == null) { - metricBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - io.prometheus.client.Metrics.Metric, io.prometheus.client.Metrics.Metric.Builder, io.prometheus.client.Metrics.MetricOrBuilder>( - metric_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - metric_ = null; - } - return metricBuilder_; - } - - // @@protoc_insertion_point(builder_scope:io.prometheus.client.MetricFamily) - } - - static { - defaultInstance = new MetricFamily(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:io.prometheus.client.MetricFamily) - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_LabelPair_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_LabelPair_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_Gauge_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_Gauge_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_Counter_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_Counter_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_Quantile_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_Quantile_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_Summary_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_Summary_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_Untyped_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_Untyped_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_Histogram_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_Histogram_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_Bucket_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_Bucket_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_Metric_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_Metric_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_io_prometheus_client_MetricFamily_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_io_prometheus_client_MetricFamily_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\rmetrics.proto\022\024io.prometheus.client\"(\n" + - "\tLabelPair\022\014\n\004name\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\"" + - "\026\n\005Gauge\022\r\n\005value\030\001 \001(\001\"\030\n\007Counter\022\r\n\005va" + - "lue\030\001 \001(\001\"+\n\010Quantile\022\020\n\010quantile\030\001 \001(\001\022" + - "\r\n\005value\030\002 \001(\001\"e\n\007Summary\022\024\n\014sample_coun" + - "t\030\001 \001(\004\022\022\n\nsample_sum\030\002 \001(\001\0220\n\010quantile\030" + - "\003 \003(\0132\036.io.prometheus.client.Quantile\"\030\n" + - "\007Untyped\022\r\n\005value\030\001 \001(\001\"c\n\tHistogram\022\024\n\014" + - "sample_count\030\001 \001(\004\022\022\n\nsample_sum\030\002 \001(\001\022," + - "\n\006bucket\030\003 \003(\0132\034.io.prometheus.client.Bu", - "cket\"7\n\006Bucket\022\030\n\020cumulative_count\030\001 \001(\004" + - "\022\023\n\013upper_bound\030\002 \001(\001\"\276\002\n\006Metric\022.\n\005labe" + - "l\030\001 \003(\0132\037.io.prometheus.client.LabelPair" + - "\022*\n\005gauge\030\002 \001(\0132\033.io.prometheus.client.G" + - "auge\022.\n\007counter\030\003 \001(\0132\035.io.prometheus.cl" + - "ient.Counter\022.\n\007summary\030\004 \001(\0132\035.io.prome" + - "theus.client.Summary\022.\n\007untyped\030\005 \001(\0132\035." + - "io.prometheus.client.Untyped\0222\n\thistogra" + - "m\030\007 \001(\0132\037.io.prometheus.client.Histogram" + - "\022\024\n\014timestamp_ms\030\006 \001(\003\"\210\001\n\014MetricFamily\022", - "\014\n\004name\030\001 \001(\t\022\014\n\004help\030\002 \001(\t\022.\n\004type\030\003 \001(" + - "\0162 .io.prometheus.client.MetricType\022,\n\006m" + - "etric\030\004 \003(\0132\034.io.prometheus.client.Metri" + - "c*M\n\nMetricType\022\013\n\007COUNTER\020\000\022\t\n\005GAUGE\020\001\022" + - "\013\n\007SUMMARY\020\002\022\013\n\007UNTYPED\020\003\022\r\n\tHISTOGRAM\020\004" + - "B\026\n\024io.prometheus.client" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - internal_static_io_prometheus_client_LabelPair_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_io_prometheus_client_LabelPair_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_LabelPair_descriptor, - new java.lang.String[] { "Name", "Value", }); - internal_static_io_prometheus_client_Gauge_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_io_prometheus_client_Gauge_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_Gauge_descriptor, - new java.lang.String[] { "Value", }); - internal_static_io_prometheus_client_Counter_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_io_prometheus_client_Counter_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_Counter_descriptor, - new java.lang.String[] { "Value", }); - internal_static_io_prometheus_client_Quantile_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_io_prometheus_client_Quantile_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_Quantile_descriptor, - new java.lang.String[] { "Quantile", "Value", }); - internal_static_io_prometheus_client_Summary_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_io_prometheus_client_Summary_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_Summary_descriptor, - new java.lang.String[] { "SampleCount", "SampleSum", "Quantile", }); - internal_static_io_prometheus_client_Untyped_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_io_prometheus_client_Untyped_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_Untyped_descriptor, - new java.lang.String[] { "Value", }); - internal_static_io_prometheus_client_Histogram_descriptor = - getDescriptor().getMessageTypes().get(6); - internal_static_io_prometheus_client_Histogram_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_Histogram_descriptor, - new java.lang.String[] { "SampleCount", "SampleSum", "Bucket", }); - internal_static_io_prometheus_client_Bucket_descriptor = - getDescriptor().getMessageTypes().get(7); - internal_static_io_prometheus_client_Bucket_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_Bucket_descriptor, - new java.lang.String[] { "CumulativeCount", "UpperBound", }); - internal_static_io_prometheus_client_Metric_descriptor = - getDescriptor().getMessageTypes().get(8); - internal_static_io_prometheus_client_Metric_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_Metric_descriptor, - new java.lang.String[] { "Label", "Gauge", "Counter", "Summary", "Untyped", "Histogram", "TimestampMs", }); - internal_static_io_prometheus_client_MetricFamily_descriptor = - getDescriptor().getMessageTypes().get(9); - internal_static_io_prometheus_client_MetricFamily_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_io_prometheus_client_MetricFamily_descriptor, - new java.lang.String[] { "Name", "Help", "Type", "Metric", }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/vendor/github.com/prometheus/common/.travis.yml b/vendor/github.com/prometheus/common/.travis.yml deleted file mode 100644 index 2fe8e9ad7..000000000 --- a/vendor/github.com/prometheus/common/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -sudo: false - -language: go -go: - - 1.7.5 - - tip diff --git a/vendor/github.com/prometheus/common/CONTRIBUTING.md b/vendor/github.com/prometheus/common/CONTRIBUTING.md deleted file mode 100644 index 40503edbf..000000000 --- a/vendor/github.com/prometheus/common/CONTRIBUTING.md +++ /dev/null @@ -1,18 +0,0 @@ -# Contributing - -Prometheus uses GitHub to manage reviews of pull requests. - -* If you have a trivial fix or improvement, go ahead and create a pull request, - addressing (with `@...`) the maintainer of this repository (see - [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request. - -* If you plan to do something more involved, first discuss your ideas - on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). - This will avoid unnecessary work and surely give you and us a good deal - of inspiration. - -* Relevant coding style guidelines are the [Go Code Review - Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) - and the _Formatting and style_ section of Peter Bourgon's [Go: Best - Practices for Production - Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style). diff --git a/vendor/github.com/prometheus/common/LICENSE b/vendor/github.com/prometheus/common/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/vendor/github.com/prometheus/common/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/prometheus/common/MAINTAINERS.md b/vendor/github.com/prometheus/common/MAINTAINERS.md deleted file mode 100644 index 1b3152161..000000000 --- a/vendor/github.com/prometheus/common/MAINTAINERS.md +++ /dev/null @@ -1 +0,0 @@ -* Fabian Reinartz diff --git a/vendor/github.com/prometheus/common/NOTICE b/vendor/github.com/prometheus/common/NOTICE deleted file mode 100644 index 636a2c1a5..000000000 --- a/vendor/github.com/prometheus/common/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Common libraries shared by Prometheus Go components. -Copyright 2015 The Prometheus Authors - -This product includes software developed at -SoundCloud Ltd. (http://soundcloud.com/). diff --git a/vendor/github.com/prometheus/common/README.md b/vendor/github.com/prometheus/common/README.md deleted file mode 100644 index 47985e4ad..000000000 --- a/vendor/github.com/prometheus/common/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Common -[![Build Status](https://travis-ci.org/prometheus/common.svg)](https://travis-ci.org/prometheus/common) - -This repository contains Go libraries that are shared across Prometheus -components and libraries. - -* **config**: Common configuration structures -* **expfmt**: Decoding and encoding for the exposition format -* **log**: A logging wrapper around [logrus](https://github.com/sirupsen/logrus) -* **model**: Shared data structures -* **route**: A routing wrapper around [httprouter](https://github.com/julienschmidt/httprouter) using `context.Context` -* **version**: Version information and metrics diff --git a/vendor/github.com/prometheus/common/config/config.go b/vendor/github.com/prometheus/common/config/config.go deleted file mode 100644 index 30719d838..000000000 --- a/vendor/github.com/prometheus/common/config/config.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This package no longer handles safe yaml parsing. In order to -// ensure correct yaml unmarshalling, use "yaml.UnmarshalStrict()". - -package config - -// Secret special type for storing secrets. -type Secret string - -// MarshalYAML implements the yaml.Marshaler interface for Secrets. -func (s Secret) MarshalYAML() (interface{}, error) { - if s != "" { - return "", nil - } - return nil, nil -} - -//UnmarshalYAML implements the yaml.Unmarshaler interface for Secrets. -func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error { - type plain Secret - return unmarshal((*plain)(s)) -} diff --git a/vendor/github.com/prometheus/common/config/http_config.go b/vendor/github.com/prometheus/common/config/http_config.go deleted file mode 100644 index da5d59014..000000000 --- a/vendor/github.com/prometheus/common/config/http_config.go +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright 2016 The Prometheus 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 config - -import ( - "crypto/tls" - "crypto/x509" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "strings" - "time" - - "github.com/mwitkow/go-conntrack" - "gopkg.in/yaml.v2" -) - -// BasicAuth contains basic HTTP authentication credentials. -type BasicAuth struct { - Username string `yaml:"username"` - Password Secret `yaml:"password,omitempty"` - PasswordFile string `yaml:"password_file,omitempty"` -} - -// URL is a custom URL type that allows validation at configuration load time. -type URL struct { - *url.URL -} - -// UnmarshalYAML implements the yaml.Unmarshaler interface for URLs. -func (u *URL) UnmarshalYAML(unmarshal func(interface{}) error) error { - var s string - if err := unmarshal(&s); err != nil { - return err - } - - urlp, err := url.Parse(s) - if err != nil { - return err - } - u.URL = urlp - return nil -} - -// MarshalYAML implements the yaml.Marshaler interface for URLs. -func (u URL) MarshalYAML() (interface{}, error) { - if u.URL != nil { - return u.String(), nil - } - return nil, nil -} - -// HTTPClientConfig configures an HTTP client. -type HTTPClientConfig struct { - // The HTTP basic authentication credentials for the targets. - BasicAuth *BasicAuth `yaml:"basic_auth,omitempty"` - // The bearer token for the targets. - BearerToken Secret `yaml:"bearer_token,omitempty"` - // The bearer token file for the targets. - BearerTokenFile string `yaml:"bearer_token_file,omitempty"` - // HTTP proxy server to use to connect to the targets. - ProxyURL URL `yaml:"proxy_url,omitempty"` - // TLSConfig to use to connect to the targets. - TLSConfig TLSConfig `yaml:"tls_config,omitempty"` -} - -// Validate validates the HTTPClientConfig to check only one of BearerToken, -// BasicAuth and BearerTokenFile is configured. -func (c *HTTPClientConfig) Validate() error { - if len(c.BearerToken) > 0 && len(c.BearerTokenFile) > 0 { - return fmt.Errorf("at most one of bearer_token & bearer_token_file must be configured") - } - if c.BasicAuth != nil && (len(c.BearerToken) > 0 || len(c.BearerTokenFile) > 0) { - return fmt.Errorf("at most one of basic_auth, bearer_token & bearer_token_file must be configured") - } - if c.BasicAuth != nil && (string(c.BasicAuth.Password) != "" && c.BasicAuth.PasswordFile != "") { - return fmt.Errorf("at most one of basic_auth password & password_file must be configured") - } - return nil -} - -// UnmarshalYAML implements the yaml.Unmarshaler interface -func (c *HTTPClientConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { - type plain HTTPClientConfig - if err := unmarshal((*plain)(c)); err != nil { - return err - } - return c.Validate() -} - -// UnmarshalYAML implements the yaml.Unmarshaler interface. -func (a *BasicAuth) UnmarshalYAML(unmarshal func(interface{}) error) error { - type plain BasicAuth - return unmarshal((*plain)(a)) -} - -// NewClient returns a http.Client using the specified http.RoundTripper. -func newClient(rt http.RoundTripper) *http.Client { - return &http.Client{Transport: rt} -} - -// NewClientFromConfig returns a new HTTP client configured for the -// given config.HTTPClientConfig. The name is used as go-conntrack metric label. -func NewClientFromConfig(cfg HTTPClientConfig, name string) (*http.Client, error) { - rt, err := NewRoundTripperFromConfig(cfg, name) - if err != nil { - return nil, err - } - return newClient(rt), nil -} - -// NewRoundTripperFromConfig returns a new HTTP RoundTripper configured for the -// given config.HTTPClientConfig. The name is used as go-conntrack metric label. -func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string) (http.RoundTripper, error) { - tlsConfig, err := NewTLSConfig(&cfg.TLSConfig) - if err != nil { - return nil, err - } - // The only timeout we care about is the configured scrape timeout. - // It is applied on request. So we leave out any timings here. - var rt http.RoundTripper = &http.Transport{ - Proxy: http.ProxyURL(cfg.ProxyURL.URL), - MaxIdleConns: 20000, - MaxIdleConnsPerHost: 1000, // see https://github.com/golang/go/issues/13801 - DisableKeepAlives: false, - TLSClientConfig: tlsConfig, - DisableCompression: true, - // 5 minutes is typically above the maximum sane scrape interval. So we can - // use keepalive for all configurations. - IdleConnTimeout: 5 * time.Minute, - DialContext: conntrack.NewDialContextFunc( - conntrack.DialWithTracing(), - conntrack.DialWithName(name), - ), - } - - // If a bearer token is provided, create a round tripper that will set the - // Authorization header correctly on each request. - if len(cfg.BearerToken) > 0 { - rt = NewBearerAuthRoundTripper(cfg.BearerToken, rt) - } else if len(cfg.BearerTokenFile) > 0 { - rt = NewBearerAuthFileRoundTripper(cfg.BearerTokenFile, rt) - } - - if cfg.BasicAuth != nil { - rt = NewBasicAuthRoundTripper(cfg.BasicAuth.Username, cfg.BasicAuth.Password, cfg.BasicAuth.PasswordFile, rt) - } - - // Return a new configured RoundTripper. - return rt, nil -} - -type bearerAuthRoundTripper struct { - bearerToken Secret - rt http.RoundTripper -} - -// NewBearerAuthRoundTripper adds the provided bearer token to a request unless the authorization -// header has already been set. -func NewBearerAuthRoundTripper(token Secret, rt http.RoundTripper) http.RoundTripper { - return &bearerAuthRoundTripper{token, rt} -} - -func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - if len(req.Header.Get("Authorization")) == 0 { - req = cloneRequest(req) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", string(rt.bearerToken))) - } - return rt.rt.RoundTrip(req) -} - -type bearerAuthFileRoundTripper struct { - bearerFile string - rt http.RoundTripper -} - -// NewBearerAuthFileRoundTripper adds the bearer token read from the provided file to a request unless -// the authorization header has already been set. This file is read for every request. -func NewBearerAuthFileRoundTripper(bearerFile string, rt http.RoundTripper) http.RoundTripper { - return &bearerAuthFileRoundTripper{bearerFile, rt} -} - -func (rt *bearerAuthFileRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - if len(req.Header.Get("Authorization")) == 0 { - b, err := ioutil.ReadFile(rt.bearerFile) - if err != nil { - return nil, fmt.Errorf("unable to read bearer token file %s: %s", rt.bearerFile, err) - } - bearerToken := strings.TrimSpace(string(b)) - - req = cloneRequest(req) - req.Header.Set("Authorization", "Bearer "+bearerToken) - } - - return rt.rt.RoundTrip(req) -} - -type basicAuthRoundTripper struct { - username string - password Secret - passwordFile string - rt http.RoundTripper -} - -// NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a request unless it has -// already been set. -func NewBasicAuthRoundTripper(username string, password Secret, passwordFile string, rt http.RoundTripper) http.RoundTripper { - return &basicAuthRoundTripper{username, password, passwordFile, rt} -} - -func (rt *basicAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - if len(req.Header.Get("Authorization")) != 0 { - return rt.rt.RoundTrip(req) - } - req = cloneRequest(req) - if rt.passwordFile != "" { - bs, err := ioutil.ReadFile(rt.passwordFile) - if err != nil { - return nil, fmt.Errorf("unable to read basic auth password file %s: %s", rt.passwordFile, err) - } - req.SetBasicAuth(rt.username, strings.TrimSpace(string(bs))) - } else { - req.SetBasicAuth(rt.username, strings.TrimSpace(string(rt.password))) - } - return rt.rt.RoundTrip(req) -} - -// cloneRequest returns a clone of the provided *http.Request. -// The clone is a shallow copy of the struct and its Header map. -func cloneRequest(r *http.Request) *http.Request { - // Shallow copy of the struct. - r2 := new(http.Request) - *r2 = *r - // Deep copy of the Header. - r2.Header = make(http.Header) - for k, s := range r.Header { - r2.Header[k] = s - } - return r2 -} - -// NewTLSConfig creates a new tls.Config from the given TLSConfig. -func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error) { - tlsConfig := &tls.Config{InsecureSkipVerify: cfg.InsecureSkipVerify} - - // If a CA cert is provided then let's read it in so we can validate the - // scrape target's certificate properly. - if len(cfg.CAFile) > 0 { - caCertPool := x509.NewCertPool() - // Load CA cert. - caCert, err := ioutil.ReadFile(cfg.CAFile) - if err != nil { - return nil, fmt.Errorf("unable to use specified CA cert %s: %s", cfg.CAFile, err) - } - caCertPool.AppendCertsFromPEM(caCert) - tlsConfig.RootCAs = caCertPool - } - - if len(cfg.ServerName) > 0 { - tlsConfig.ServerName = cfg.ServerName - } - // If a client cert & key is provided then configure TLS config accordingly. - if len(cfg.CertFile) > 0 && len(cfg.KeyFile) == 0 { - return nil, fmt.Errorf("client cert file %q specified without client key file", cfg.CertFile) - } else if len(cfg.KeyFile) > 0 && len(cfg.CertFile) == 0 { - return nil, fmt.Errorf("client key file %q specified without client cert file", cfg.KeyFile) - } else if len(cfg.CertFile) > 0 && len(cfg.KeyFile) > 0 { - cert, err := tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile) - if err != nil { - return nil, fmt.Errorf("unable to use specified client cert (%s) & key (%s): %s", cfg.CertFile, cfg.KeyFile, err) - } - tlsConfig.Certificates = []tls.Certificate{cert} - } - tlsConfig.BuildNameToCertificate() - - return tlsConfig, nil -} - -// TLSConfig configures the options for TLS connections. -type TLSConfig struct { - // The CA cert to use for the targets. - CAFile string `yaml:"ca_file,omitempty"` - // The client cert file for the targets. - CertFile string `yaml:"cert_file,omitempty"` - // The client key file for the targets. - KeyFile string `yaml:"key_file,omitempty"` - // Used to verify the hostname for the targets. - ServerName string `yaml:"server_name,omitempty"` - // Disable target certificate validation. - InsecureSkipVerify bool `yaml:"insecure_skip_verify"` -} - -// UnmarshalYAML implements the yaml.Unmarshaler interface. -func (c *TLSConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { - type plain TLSConfig - return unmarshal((*plain)(c)) -} - -func (c HTTPClientConfig) String() string { - b, err := yaml.Marshal(c) - if err != nil { - return fmt.Sprintf("", err) - } - return string(b) -} diff --git a/vendor/github.com/prometheus/common/config/http_config_test.go b/vendor/github.com/prometheus/common/config/http_config_test.go deleted file mode 100644 index 4639ae475..000000000 --- a/vendor/github.com/prometheus/common/config/http_config_test.go +++ /dev/null @@ -1,618 +0,0 @@ -// Copyright 2015 The Prometheus 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 config - -import ( - "crypto/tls" - "crypto/x509" - "fmt" - "io/ioutil" - "net/http" - "net/http/httptest" - "reflect" - "strings" - "testing" - - "gopkg.in/yaml.v2" -) - -const ( - TLSCAChainPath = "testdata/tls-ca-chain.pem" - ServerCertificatePath = "testdata/server.crt" - ServerKeyPath = "testdata/server.key" - BarneyCertificatePath = "testdata/barney.crt" - BarneyKeyNoPassPath = "testdata/barney-no-pass.key" - MissingCA = "missing/ca.crt" - MissingCert = "missing/cert.crt" - MissingKey = "missing/secret.key" - - ExpectedMessage = "I'm here to serve you!!!" - BearerToken = "theanswertothegreatquestionoflifetheuniverseandeverythingisfortytwo" - BearerTokenFile = "testdata/bearer.token" - MissingBearerTokenFile = "missing/bearer.token" - ExpectedBearer = "Bearer " + BearerToken - ExpectedUsername = "arthurdent" - ExpectedPassword = "42" -) - -var invalidHTTPClientConfigs = []struct { - httpClientConfigFile string - errMsg string -}{ - { - httpClientConfigFile: "testdata/http.conf.bearer-token-and-file-set.bad.yml", - errMsg: "at most one of bearer_token & bearer_token_file must be configured", - }, - { - httpClientConfigFile: "testdata/http.conf.empty.bad.yml", - errMsg: "at most one of basic_auth, bearer_token & bearer_token_file must be configured", - }, - { - httpClientConfigFile: "testdata/http.conf.basic-auth.too-much.bad.yaml", - errMsg: "at most one of basic_auth password & password_file must be configured", - }, -} - -func newTestServer(handler func(w http.ResponseWriter, r *http.Request)) (*httptest.Server, error) { - testServer := httptest.NewUnstartedServer(http.HandlerFunc(handler)) - - tlsCAChain, err := ioutil.ReadFile(TLSCAChainPath) - if err != nil { - return nil, fmt.Errorf("Can't read %s", TLSCAChainPath) - } - serverCertificate, err := tls.LoadX509KeyPair(ServerCertificatePath, ServerKeyPath) - if err != nil { - return nil, fmt.Errorf("Can't load X509 key pair %s - %s", ServerCertificatePath, ServerKeyPath) - } - - rootCAs := x509.NewCertPool() - rootCAs.AppendCertsFromPEM(tlsCAChain) - - testServer.TLS = &tls.Config{ - Certificates: make([]tls.Certificate, 1), - RootCAs: rootCAs, - ClientAuth: tls.RequireAndVerifyClientCert, - ClientCAs: rootCAs} - testServer.TLS.Certificates[0] = serverCertificate - testServer.TLS.BuildNameToCertificate() - - testServer.StartTLS() - - return testServer, nil -} - -func TestNewClientFromConfig(t *testing.T) { - var newClientValidConfig = []struct { - clientConfig HTTPClientConfig - handler func(w http.ResponseWriter, r *http.Request) - }{ - { - clientConfig: HTTPClientConfig{ - TLSConfig: TLSConfig{ - CAFile: "", - CertFile: BarneyCertificatePath, - KeyFile: BarneyKeyNoPassPath, - ServerName: "", - InsecureSkipVerify: true}, - }, - handler: func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, ExpectedMessage) - }, - }, { - clientConfig: HTTPClientConfig{ - TLSConfig: TLSConfig{ - CAFile: TLSCAChainPath, - CertFile: BarneyCertificatePath, - KeyFile: BarneyKeyNoPassPath, - ServerName: "", - InsecureSkipVerify: false}, - }, - handler: func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, ExpectedMessage) - }, - }, { - clientConfig: HTTPClientConfig{ - BearerToken: BearerToken, - TLSConfig: TLSConfig{ - CAFile: TLSCAChainPath, - CertFile: BarneyCertificatePath, - KeyFile: BarneyKeyNoPassPath, - ServerName: "", - InsecureSkipVerify: false}, - }, - handler: func(w http.ResponseWriter, r *http.Request) { - bearer := r.Header.Get("Authorization") - if bearer != ExpectedBearer { - fmt.Fprintf(w, "The expected Bearer Authorization (%s) differs from the obtained Bearer Authorization (%s)", - ExpectedBearer, bearer) - } else { - fmt.Fprint(w, ExpectedMessage) - } - }, - }, { - clientConfig: HTTPClientConfig{ - BearerTokenFile: BearerTokenFile, - TLSConfig: TLSConfig{ - CAFile: TLSCAChainPath, - CertFile: BarneyCertificatePath, - KeyFile: BarneyKeyNoPassPath, - ServerName: "", - InsecureSkipVerify: false}, - }, - handler: func(w http.ResponseWriter, r *http.Request) { - bearer := r.Header.Get("Authorization") - if bearer != ExpectedBearer { - fmt.Fprintf(w, "The expected Bearer Authorization (%s) differs from the obtained Bearer Authorization (%s)", - ExpectedBearer, bearer) - } else { - fmt.Fprint(w, ExpectedMessage) - } - }, - }, { - clientConfig: HTTPClientConfig{ - BasicAuth: &BasicAuth{ - Username: ExpectedUsername, - Password: ExpectedPassword, - }, - TLSConfig: TLSConfig{ - CAFile: TLSCAChainPath, - CertFile: BarneyCertificatePath, - KeyFile: BarneyKeyNoPassPath, - ServerName: "", - InsecureSkipVerify: false}, - }, - handler: func(w http.ResponseWriter, r *http.Request) { - username, password, ok := r.BasicAuth() - if !ok { - fmt.Fprintf(w, "The Authorization header wasn't set") - } else if ExpectedUsername != username { - fmt.Fprintf(w, "The expected username (%s) differs from the obtained username (%s).", ExpectedUsername, username) - } else if ExpectedPassword != password { - fmt.Fprintf(w, "The expected password (%s) differs from the obtained password (%s).", ExpectedPassword, password) - } else { - fmt.Fprint(w, ExpectedMessage) - } - }, - }, - } - - for _, validConfig := range newClientValidConfig { - testServer, err := newTestServer(validConfig.handler) - if err != nil { - t.Fatal(err.Error()) - } - defer testServer.Close() - - client, err := NewClientFromConfig(validConfig.clientConfig, "test") - if err != nil { - t.Errorf("Can't create a client from this config: %+v", validConfig.clientConfig) - continue - } - response, err := client.Get(testServer.URL) - if err != nil { - t.Errorf("Can't connect to the test server using this config: %+v", validConfig.clientConfig) - continue - } - - message, err := ioutil.ReadAll(response.Body) - response.Body.Close() - if err != nil { - t.Errorf("Can't read the server response body using this config: %+v", validConfig.clientConfig) - continue - } - - trimMessage := strings.TrimSpace(string(message)) - if ExpectedMessage != trimMessage { - t.Errorf("The expected message (%s) differs from the obtained message (%s) using this config: %+v", - ExpectedMessage, trimMessage, validConfig.clientConfig) - } - } -} - -func TestNewClientFromInvalidConfig(t *testing.T) { - var newClientInvalidConfig = []struct { - clientConfig HTTPClientConfig - errorMsg string - }{ - { - clientConfig: HTTPClientConfig{ - TLSConfig: TLSConfig{ - CAFile: MissingCA, - CertFile: "", - KeyFile: "", - ServerName: "", - InsecureSkipVerify: true}, - }, - errorMsg: fmt.Sprintf("unable to use specified CA cert %s:", MissingCA), - }, - } - - for _, invalidConfig := range newClientInvalidConfig { - client, err := NewClientFromConfig(invalidConfig.clientConfig, "test") - if client != nil { - t.Errorf("A client instance was returned instead of nil using this config: %+v", invalidConfig.clientConfig) - } - if err == nil { - t.Errorf("No error was returned using this config: %+v", invalidConfig.clientConfig) - } - if !strings.Contains(err.Error(), invalidConfig.errorMsg) { - t.Errorf("Expected error %s does not contain %s", err.Error(), invalidConfig.errorMsg) - } - } -} - -func TestMissingBearerAuthFile(t *testing.T) { - cfg := HTTPClientConfig{ - BearerTokenFile: MissingBearerTokenFile, - TLSConfig: TLSConfig{ - CAFile: TLSCAChainPath, - CertFile: BarneyCertificatePath, - KeyFile: BarneyKeyNoPassPath, - ServerName: "", - InsecureSkipVerify: false}, - } - handler := func(w http.ResponseWriter, r *http.Request) { - bearer := r.Header.Get("Authorization") - if bearer != ExpectedBearer { - fmt.Fprintf(w, "The expected Bearer Authorization (%s) differs from the obtained Bearer Authorization (%s)", - ExpectedBearer, bearer) - } else { - fmt.Fprint(w, ExpectedMessage) - } - } - - testServer, err := newTestServer(handler) - if err != nil { - t.Fatal(err.Error()) - } - defer testServer.Close() - - client, err := NewClientFromConfig(cfg, "test") - if err != nil { - t.Fatal(err) - } - - _, err = client.Get(testServer.URL) - if err == nil { - t.Fatal("No error is returned here") - } - - if !strings.Contains(err.Error(), "unable to read bearer token file missing/bearer.token: open missing/bearer.token: no such file or directory") { - t.Fatal("wrong error message being returned") - } -} - -func TestBearerAuthRoundTripper(t *testing.T) { - const ( - newBearerToken = "goodbyeandthankyouforthefish" - ) - - fakeRoundTripper := NewRoundTripCheckRequest(func(req *http.Request) { - bearer := req.Header.Get("Authorization") - if bearer != ExpectedBearer { - t.Errorf("The expected Bearer Authorization (%s) differs from the obtained Bearer Authorization (%s)", - ExpectedBearer, bearer) - } - }, nil, nil) - - // Normal flow. - bearerAuthRoundTripper := NewBearerAuthRoundTripper(BearerToken, fakeRoundTripper) - request, _ := http.NewRequest("GET", "/hitchhiker", nil) - request.Header.Set("User-Agent", "Douglas Adams mind") - bearerAuthRoundTripper.RoundTrip(request) - - // Should honor already Authorization header set. - bearerAuthRoundTripperShouldNotModifyExistingAuthorization := NewBearerAuthRoundTripper(newBearerToken, fakeRoundTripper) - request, _ = http.NewRequest("GET", "/hitchhiker", nil) - request.Header.Set("Authorization", ExpectedBearer) - bearerAuthRoundTripperShouldNotModifyExistingAuthorization.RoundTrip(request) -} - -func TestBearerAuthFileRoundTripper(t *testing.T) { - const ( - newBearerToken = "goodbyeandthankyouforthefish" - ) - - fakeRoundTripper := NewRoundTripCheckRequest(func(req *http.Request) { - bearer := req.Header.Get("Authorization") - if bearer != ExpectedBearer { - t.Errorf("The expected Bearer Authorization (%s) differs from the obtained Bearer Authorization (%s)", - ExpectedBearer, bearer) - } - }, nil, nil) - - // Normal flow. - bearerAuthRoundTripper := NewBearerAuthFileRoundTripper(BearerTokenFile, fakeRoundTripper) - request, _ := http.NewRequest("GET", "/hitchhiker", nil) - request.Header.Set("User-Agent", "Douglas Adams mind") - bearerAuthRoundTripper.RoundTrip(request) - - // Should honor already Authorization header set. - bearerAuthRoundTripperShouldNotModifyExistingAuthorization := NewBearerAuthFileRoundTripper(MissingBearerTokenFile, fakeRoundTripper) - request, _ = http.NewRequest("GET", "/hitchhiker", nil) - request.Header.Set("Authorization", ExpectedBearer) - bearerAuthRoundTripperShouldNotModifyExistingAuthorization.RoundTrip(request) -} - -func TestTLSConfig(t *testing.T) { - configTLSConfig := TLSConfig{ - CAFile: TLSCAChainPath, - CertFile: BarneyCertificatePath, - KeyFile: BarneyKeyNoPassPath, - ServerName: "localhost", - InsecureSkipVerify: false} - - tlsCAChain, err := ioutil.ReadFile(TLSCAChainPath) - if err != nil { - t.Fatalf("Can't read the CA certificate chain (%s)", - TLSCAChainPath) - } - rootCAs := x509.NewCertPool() - rootCAs.AppendCertsFromPEM(tlsCAChain) - - barneyCertificate, err := tls.LoadX509KeyPair(BarneyCertificatePath, BarneyKeyNoPassPath) - if err != nil { - t.Fatalf("Can't load the client key pair ('%s' and '%s'). Reason: %s", - BarneyCertificatePath, BarneyKeyNoPassPath, err) - } - - expectedTLSConfig := &tls.Config{ - RootCAs: rootCAs, - Certificates: []tls.Certificate{barneyCertificate}, - ServerName: configTLSConfig.ServerName, - InsecureSkipVerify: configTLSConfig.InsecureSkipVerify} - expectedTLSConfig.BuildNameToCertificate() - - tlsConfig, err := NewTLSConfig(&configTLSConfig) - if err != nil { - t.Fatalf("Can't create a new TLS Config from a configuration (%s).", err) - } - - if !reflect.DeepEqual(tlsConfig, expectedTLSConfig) { - t.Fatalf("Unexpected TLS Config result: \n\n%+v\n expected\n\n%+v", tlsConfig, expectedTLSConfig) - } -} - -func TestTLSConfigEmpty(t *testing.T) { - configTLSConfig := TLSConfig{ - CAFile: "", - CertFile: "", - KeyFile: "", - ServerName: "", - InsecureSkipVerify: true} - - expectedTLSConfig := &tls.Config{ - InsecureSkipVerify: configTLSConfig.InsecureSkipVerify} - expectedTLSConfig.BuildNameToCertificate() - - tlsConfig, err := NewTLSConfig(&configTLSConfig) - if err != nil { - t.Fatalf("Can't create a new TLS Config from a configuration (%s).", err) - } - - if !reflect.DeepEqual(tlsConfig, expectedTLSConfig) { - t.Fatalf("Unexpected TLS Config result: \n\n%+v\n expected\n\n%+v", tlsConfig, expectedTLSConfig) - } -} - -func TestTLSConfigInvalidCA(t *testing.T) { - var invalidTLSConfig = []struct { - configTLSConfig TLSConfig - errorMessage string - }{ - { - configTLSConfig: TLSConfig{ - CAFile: MissingCA, - CertFile: "", - KeyFile: "", - ServerName: "", - InsecureSkipVerify: false}, - errorMessage: fmt.Sprintf("unable to use specified CA cert %s:", MissingCA), - }, { - configTLSConfig: TLSConfig{ - CAFile: "", - CertFile: MissingCert, - KeyFile: BarneyKeyNoPassPath, - ServerName: "", - InsecureSkipVerify: false}, - errorMessage: fmt.Sprintf("unable to use specified client cert (%s) & key (%s):", MissingCert, BarneyKeyNoPassPath), - }, { - configTLSConfig: TLSConfig{ - CAFile: "", - CertFile: BarneyCertificatePath, - KeyFile: MissingKey, - ServerName: "", - InsecureSkipVerify: false}, - errorMessage: fmt.Sprintf("unable to use specified client cert (%s) & key (%s):", BarneyCertificatePath, MissingKey), - }, - } - - for _, anInvalididTLSConfig := range invalidTLSConfig { - tlsConfig, err := NewTLSConfig(&anInvalididTLSConfig.configTLSConfig) - if tlsConfig != nil && err == nil { - t.Errorf("The TLS Config could be created even with this %+v", anInvalididTLSConfig.configTLSConfig) - continue - } - if !strings.Contains(err.Error(), anInvalididTLSConfig.errorMessage) { - t.Errorf("The expected error should contain %s, but got %s", anInvalididTLSConfig.errorMessage, err) - } - } -} - -func TestBasicAuthNoPassword(t *testing.T) { - cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.no-password.yaml") - if err != nil { - t.Errorf("Error loading HTTP client config: %v", err) - } - client, err := NewClientFromConfig(*cfg, "test") - if err != nil { - t.Errorf("Error creating HTTP Client: %v", err) - } - - rt, ok := client.Transport.(*basicAuthRoundTripper) - if !ok { - t.Fatalf("Error casting to basic auth transport, %v", client.Transport) - } - - if rt.username != "user" { - t.Errorf("Bad HTTP client username: %s", rt.username) - } - if string(rt.password) != "" { - t.Errorf("Expected empty HTTP client password: %s", rt.password) - } - if string(rt.passwordFile) != "" { - t.Errorf("Expected empty HTTP client passwordFile: %s", rt.passwordFile) - } -} - -func TestBasicAuthNoUsername(t *testing.T) { - cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.no-username.yaml") - if err != nil { - t.Errorf("Error loading HTTP client config: %v", err) - } - client, err := NewClientFromConfig(*cfg, "test") - if err != nil { - t.Errorf("Error creating HTTP Client: %v", err) - } - - rt, ok := client.Transport.(*basicAuthRoundTripper) - if !ok { - t.Fatalf("Error casting to basic auth transport, %v", client.Transport) - } - - if rt.username != "" { - t.Errorf("Got unexpected username: %s", rt.username) - } - if string(rt.password) != "secret" { - t.Errorf("Unexpected HTTP client password: %s", string(rt.password)) - } - if string(rt.passwordFile) != "" { - t.Errorf("Expected empty HTTP client passwordFile: %s", rt.passwordFile) - } -} - -func TestBasicAuthPasswordFile(t *testing.T) { - cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.good.yaml") - if err != nil { - t.Errorf("Error loading HTTP client config: %v", err) - } - client, err := NewClientFromConfig(*cfg, "test") - if err != nil { - t.Errorf("Error creating HTTP Client: %v", err) - } - - rt, ok := client.Transport.(*basicAuthRoundTripper) - if !ok { - t.Errorf("Error casting to basic auth transport, %v", client.Transport) - } - - if rt.username != "user" { - t.Errorf("Bad HTTP client username: %s", rt.username) - } - if string(rt.password) != "" { - t.Errorf("Bad HTTP client password: %s", rt.password) - } - if string(rt.passwordFile) != "testdata/basic-auth-password" { - t.Errorf("Bad HTTP client passwordFile: %s", rt.passwordFile) - } -} - -func TestHideHTTPClientConfigSecrets(t *testing.T) { - c, _, err := LoadHTTPConfigFile("testdata/http.conf.good.yml") - if err != nil { - t.Errorf("Error parsing %s: %s", "testdata/http.conf.good.yml", err) - } - - // String method must not reveal authentication credentials. - s := c.String() - if strings.Contains(s, "mysecret") { - t.Fatal("http client config's String method reveals authentication credentials.") - } -} - -func TestValidateHTTPConfig(t *testing.T) { - cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.good.yml") - if err != nil { - t.Errorf("Error loading HTTP client config: %v", err) - } - err = cfg.Validate() - if err != nil { - t.Fatalf("Error validating %s: %s", "testdata/http.conf.good.yml", err) - } -} - -func TestInvalidHTTPConfigs(t *testing.T) { - for _, ee := range invalidHTTPClientConfigs { - _, _, err := LoadHTTPConfigFile(ee.httpClientConfigFile) - if err == nil { - t.Error("Expected error with config but got none") - continue - } - if !strings.Contains(err.Error(), ee.errMsg) { - t.Errorf("Expected error for invalid HTTP client configuration to contain %q but got: %s", ee.errMsg, err) - } - } -} - -// LoadHTTPConfig parses the YAML input s into a HTTPClientConfig. -func LoadHTTPConfig(s string) (*HTTPClientConfig, error) { - cfg := &HTTPClientConfig{} - err := yaml.UnmarshalStrict([]byte(s), cfg) - if err != nil { - return nil, err - } - return cfg, nil -} - -// LoadHTTPConfigFile parses the given YAML file into a HTTPClientConfig. -func LoadHTTPConfigFile(filename string) (*HTTPClientConfig, []byte, error) { - content, err := ioutil.ReadFile(filename) - if err != nil { - return nil, nil, err - } - cfg, err := LoadHTTPConfig(string(content)) - if err != nil { - return nil, nil, err - } - return cfg, content, nil -} - -type roundTrip struct { - theResponse *http.Response - theError error -} - -func (rt *roundTrip) RoundTrip(r *http.Request) (*http.Response, error) { - return rt.theResponse, rt.theError -} - -type roundTripCheckRequest struct { - checkRequest func(*http.Request) - roundTrip -} - -func (rt *roundTripCheckRequest) RoundTrip(r *http.Request) (*http.Response, error) { - rt.checkRequest(r) - return rt.theResponse, rt.theError -} - -// NewRoundTripCheckRequest creates a new instance of a type that implements http.RoundTripper, -// which before returning theResponse and theError, executes checkRequest against a http.Request. -func NewRoundTripCheckRequest(checkRequest func(*http.Request), theResponse *http.Response, theError error) http.RoundTripper { - return &roundTripCheckRequest{ - checkRequest: checkRequest, - roundTrip: roundTrip{ - theResponse: theResponse, - theError: theError}} -} diff --git a/vendor/github.com/prometheus/common/config/testdata/barney-no-pass.key b/vendor/github.com/prometheus/common/config/testdata/barney-no-pass.key deleted file mode 100644 index b8e44f552..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/barney-no-pass.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAxmYjfBZhZbAup9uSULehoqPCv/U+77ETxUNyS2nviWEHDAb/ -pFS8Btx4oCQ1ECVSyxcUmXSlrvDjMY4sisOHvndNRlGi274M5a8Q5yD1BUqvxq3u -XB/+SYNVShBzaswrSjpzMe89AlOPxPjnE14OXh00j2hHunOG4jhlWgJnY0YyvUQQ -YWO6KrmKMiZ4MgmY0SWh/ZhlkDJPtkp3aUVM2sheCru/70E9viLGfdlhc2pIMshy -wNp4/5IkHBZwbqXFFGX4sRtSXI/auZNvcHOBse+3e3BonWvBWS2lIYbzpX3vLB7B -E9BGIxWn1fgNQr14yFPaccSszBvgtmEUONolnwIDAQABAoIBAQC7nBhQHgXKGBl2 -Z97rb0pstrjRtsLl/Cg68LWi9LEr0tHMIM4bgnkvb8qtfK+k7fZl0BSNrE2EqYvd -75jVO2MgzEYJieccLpKZm7u7JGIut9qSYSU2fpaCw6uiVv4dbqY9EhqejKG/km8w -j0JMATRK8Qkj1zOE7/wL7dKBlCZaK3u+OT17spuA/21PG/cLiPaSGSA3CU/eqbkU -BD6JeBxp33XNTytwWoOvarsigpL0dGqQ7+qhGq6t69qFfWoe9rimV7Ya+tB9zF/U -HzOIEspOYvzxe+C7VJjlVFr4haMYmsrO9qRUJ2ofp49OLVdfEANsdVISSvS63BEp -gBZN8Ko5AoGBAO1z8y8YCsI+2vBG6nxZ1eMba0KHi3bS8db1TaenJBV22w6WQATh -hEaU6VLMFcMvrOUjXN/7HJfnEMyvFT6gb9obPDVEMZw88s9lVN6njgGLZR/jodyN -7N7utLopN043Ra0WfEILAXPSz8esT1yn05OZV6AFHxJEWMrX3/4+spCLAoGBANXl -RomieVY4u3FF/uzhbzKNNb9ETxrQuexfbangKp5eLniwnr2SQWIbyPzeurwp15J8 -HvxB2vpNvs1khSwNx9dQfMdiUVPGLWj7MimAHTHsnQ9LVV9W28ghuSWbjQDGTUt1 -WCCu1MkKIOzupbi+zgsNlI33yilRQKAb9SRxdy29AoGBAOKpvyZiPcrkMxwPpb/k -BU7QGpgcSR25CQ+Xg3QZEVHH7h1DgYLnPtwdQ4g8tj1mohTsp7hKvSWndRrdulrY -zUyWmOeD3BN2/pTI9rW/nceNp49EPHsLo2O+2xelRlzMWB98ikqEtPM59gt1SSB6 -N3X6d3GR0fIe+d9PKEtK0Cs3AoGAZ9r8ReXSvm+ra5ON9Nx8znHMEAON2TpRnBi1 -uY7zgpO+QrGXUfqKrqVJEKbgym4SkribnuYm+fP32eid1McYKk6VV4ZAcMm/0MJv -F8Fx64S0ufFdEX6uFl1xdXYyn5apfyMJ2EyrWrYFSKWTZ8GVb753S/tteGRQWa1Z -eQly0Y0CgYEAnI6G9KFvXI+MLu5y2LPYAwsesDFzaWwyDl96ioQTA9hNSrjR33Vw -xwpiEe0T/WKF8NQ0QWnrQDbTvuCvZUK37TVxscYWuItL6vnBrYqr4Ck0j1BcGwV5 -jT581A/Vw8JJiR/vfcxgmrFYqoUmkMKDmCN1oImfz09GtQ4jQ1rlxz8= ------END RSA PRIVATE KEY----- diff --git a/vendor/github.com/prometheus/common/config/testdata/barney.crt b/vendor/github.com/prometheus/common/config/testdata/barney.crt deleted file mode 100644 index e2f950483..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/barney.crt +++ /dev/null @@ -1,96 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 2 (0x2) - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=NO, O=Green AS, OU=Green Certificate Authority, CN=Green TLS CA - Validity - Not Before: Jul 13 04:02:47 2017 GMT - Not After : Jul 13 04:02:47 2019 GMT - Subject: C=NO, O=Telenor AS, OU=Support, CN=Barney Rubble - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - Public-Key: (2048 bit) - Modulus: - 00:c6:66:23:7c:16:61:65:b0:2e:a7:db:92:50:b7: - a1:a2:a3:c2:bf:f5:3e:ef:b1:13:c5:43:72:4b:69: - ef:89:61:07:0c:06:ff:a4:54:bc:06:dc:78:a0:24: - 35:10:25:52:cb:17:14:99:74:a5:ae:f0:e3:31:8e: - 2c:8a:c3:87:be:77:4d:46:51:a2:db:be:0c:e5:af: - 10:e7:20:f5:05:4a:af:c6:ad:ee:5c:1f:fe:49:83: - 55:4a:10:73:6a:cc:2b:4a:3a:73:31:ef:3d:02:53: - 8f:c4:f8:e7:13:5e:0e:5e:1d:34:8f:68:47:ba:73: - 86:e2:38:65:5a:02:67:63:46:32:bd:44:10:61:63: - ba:2a:b9:8a:32:26:78:32:09:98:d1:25:a1:fd:98: - 65:90:32:4f:b6:4a:77:69:45:4c:da:c8:5e:0a:bb: - bf:ef:41:3d:be:22:c6:7d:d9:61:73:6a:48:32:c8: - 72:c0:da:78:ff:92:24:1c:16:70:6e:a5:c5:14:65: - f8:b1:1b:52:5c:8f:da:b9:93:6f:70:73:81:b1:ef: - b7:7b:70:68:9d:6b:c1:59:2d:a5:21:86:f3:a5:7d: - ef:2c:1e:c1:13:d0:46:23:15:a7:d5:f8:0d:42:bd: - 78:c8:53:da:71:c4:ac:cc:1b:e0:b6:61:14:38:da: - 25:9f - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Key Usage: critical - Digital Signature - X509v3 Basic Constraints: - CA:FALSE - X509v3 Extended Key Usage: - TLS Web Client Authentication - X509v3 Subject Key Identifier: - F4:17:02:DD:1B:01:AB:C5:BC:17:A4:5C:4B:75:8E:EC:B1:E0:C8:F1 - X509v3 Authority Key Identifier: - keyid:AE:42:88:75:DD:05:A6:8E:48:7F:50:69:F9:B7:34:23:49:B8:B4:71 - - Authority Information Access: - CA Issuers - URI:http://green.no/ca/tls-ca.cer - - X509v3 CRL Distribution Points: - - Full Name: - URI:http://green.no/ca/tls-ca.crl - - X509v3 Subject Alternative Name: - email:barney@telenor.no - Signature Algorithm: sha1WithRSAEncryption - 96:9a:c5:41:8a:2f:4a:c4:80:d9:2b:1a:cf:07:85:e9:b6:18: - 01:20:41:b9:c3:d4:ca:d3:2d:66:c3:1d:52:7f:25:d7:92:0c: - e9:a9:ae:e6:2e:fa:9d:0a:cf:84:b9:03:f2:63:e3:d3:c9:70: - 6a:ac:04:5e:a9:2d:a2:43:7a:34:60:f7:a9:32:e1:48:ec:c6: - 03:ac:b3:06:2e:48:6e:d0:35:11:31:3d:0c:04:66:41:e6:b2: - ec:8c:68:f8:e4:bc:47:85:39:60:69:a9:8a:ee:2f:56:88:8a: - 19:45:d0:84:8e:c2:27:2c:82:9c:07:6c:34:ae:41:61:63:f9: - 32:cb:8b:33:ea:2c:15:5f:f9:35:b0:3c:51:4d:5f:30:de:0b: - 88:28:94:79:f3:bd:69:37:ad:12:20:e1:6b:1d:b6:77:d9:83: - db:81:a4:53:6c:0f:6a:17:5e:2b:c1:94:c6:42:e3:73:cd:9e: - 79:1b:8c:89:cd:da:ce:b0:f4:21:c5:32:25:04:6e:68:9f:a7: - ca:f4:c5:86:e5:4e:d9:fd:69:73:e6:15:50:6e:76:0f:73:5e: - 7a:a3:f4:dc:15:4a:ab:bb:3c:9a:fa:9f:01:7a:5c:47:a9:a3: - 68:1c:49:e0:37:37:77:af:87:07:16:e4:e1:d7:98:39:15:a6: - 51:5d:4c:db ------BEGIN CERTIFICATE----- -MIIEITCCAwmgAwIBAgIBAjANBgkqhkiG9w0BAQUFADBdMQswCQYDVQQGEwJOTzER -MA8GA1UECgwIR3JlZW4gQVMxJDAiBgNVBAsMG0dyZWVuIENlcnRpZmljYXRlIEF1 -dGhvcml0eTEVMBMGA1UEAwwMR3JlZW4gVExTIENBMB4XDTE3MDcxMzA0MDI0N1oX -DTE5MDcxMzA0MDI0N1owTDELMAkGA1UEBhMCTk8xEzARBgNVBAoMClRlbGVub3Ig -QVMxEDAOBgNVBAsMB1N1cHBvcnQxFjAUBgNVBAMMDUJhcm5leSBSdWJibGUwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGZiN8FmFlsC6n25JQt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ERTIFICATE----- diff --git a/vendor/github.com/prometheus/common/config/testdata/basic-auth-password b/vendor/github.com/prometheus/common/config/testdata/basic-auth-password deleted file mode 100644 index 323fae03f..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/basic-auth-password +++ /dev/null @@ -1 +0,0 @@ -foobar diff --git a/vendor/github.com/prometheus/common/config/testdata/bearer.token b/vendor/github.com/prometheus/common/config/testdata/bearer.token deleted file mode 100644 index 3367abffd..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/bearer.token +++ /dev/null @@ -1 +0,0 @@ -theanswertothegreatquestionoflifetheuniverseandeverythingisfortytwo diff --git a/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.good.yaml b/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.good.yaml deleted file mode 100644 index 5e7aa41f5..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.good.yaml +++ /dev/null @@ -1,3 +0,0 @@ -basic_auth: - username: user - password_file: testdata/basic-auth-password diff --git a/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.no-password.yaml b/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.no-password.yaml deleted file mode 100644 index 38faad354..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.no-password.yaml +++ /dev/null @@ -1,2 +0,0 @@ -basic_auth: - username: user diff --git a/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.no-username.yaml b/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.no-username.yaml deleted file mode 100644 index 86e290372..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.no-username.yaml +++ /dev/null @@ -1,2 +0,0 @@ -basic_auth: - password: secret diff --git a/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.too-much.bad.yaml b/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.too-much.bad.yaml deleted file mode 100644 index 7cfb92200..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/http.conf.basic-auth.too-much.bad.yaml +++ /dev/null @@ -1,4 +0,0 @@ -basic_auth: - username: user - password: foo - password_file: testdata/basic-auth-password diff --git a/vendor/github.com/prometheus/common/config/testdata/http.conf.bearer-token-and-file-set.bad.yml b/vendor/github.com/prometheus/common/config/testdata/http.conf.bearer-token-and-file-set.bad.yml deleted file mode 100644 index c613bacb0..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/http.conf.bearer-token-and-file-set.bad.yml +++ /dev/null @@ -1,5 +0,0 @@ -basic_auth: - username: username - password: "mysecret" -bearer_token: mysecret -bearer_token_file: file diff --git a/vendor/github.com/prometheus/common/config/testdata/http.conf.empty.bad.yml b/vendor/github.com/prometheus/common/config/testdata/http.conf.empty.bad.yml deleted file mode 100644 index ea2811f7c..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/http.conf.empty.bad.yml +++ /dev/null @@ -1,4 +0,0 @@ -basic_auth: - username: username - password: mysecret -bearer_token_file: file diff --git a/vendor/github.com/prometheus/common/config/testdata/http.conf.good.yml b/vendor/github.com/prometheus/common/config/testdata/http.conf.good.yml deleted file mode 100644 index 46ca63908..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/http.conf.good.yml +++ /dev/null @@ -1,4 +0,0 @@ -basic_auth: - username: username - password: "mysecret" -proxy_url: "http://remote.host" diff --git a/vendor/github.com/prometheus/common/config/testdata/http.conf.invalid-bearer-token-file.bad.yml b/vendor/github.com/prometheus/common/config/testdata/http.conf.invalid-bearer-token-file.bad.yml deleted file mode 100644 index 4b1349bf4..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/http.conf.invalid-bearer-token-file.bad.yml +++ /dev/null @@ -1 +0,0 @@ -bearer_token_file: file diff --git a/vendor/github.com/prometheus/common/config/testdata/server.crt b/vendor/github.com/prometheus/common/config/testdata/server.crt deleted file mode 100644 index 87ad202fe..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/server.crt +++ /dev/null @@ -1,96 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 4 (0x4) - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=NO, O=Green AS, OU=Green Certificate Authority, CN=Green TLS CA - Validity - Not Before: Jul 26 12:47:08 2017 GMT - Not After : Jul 26 12:47:08 2019 GMT - Subject: C=NO, O=Green AS, OU=Green Certificate Authority, CN=Green TLS CA - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - Public-Key: (2048 bit) - Modulus: - 00:97:43:c5:f6:24:b8:ce:30:12:70:ea:17:9c:c0: - ce:f2:ef:58:8b:12:7d:46:5e:01:f1:1a:93:b2:3e: - d8:cf:99:bc:10:32:f1:12:b0:ef:00:6c:d6:c4:45: - 85:a8:33:7b:cd:ec:8f:4a:92:d0:5a:4a:41:69:7f: - e3:dd:7e:71:d2:21:9c:df:43:b5:6c:60:bb:2a:12: - a8:08:cf:c5:ee:08:7d:48:ea:4b:54:e4:82:d9:88: - b0:b8:5e:02:12:cb:0e:09:99:b7:5f:42:b6:d7:26: - 34:0f:4a:e7:fc:ac:9c:59:cd:a1:50:4c:88:5f:f1: - d2:7e:5b:21:41:f0:37:50:80:48:71:50:26:61:26: - 79:64:4b:7e:91:8d:0e:f4:27:fe:19:80:bf:39:55: - b7:f3:d0:cd:61:6c:d8:c1:c7:d3:26:77:92:1a:14: - 42:56:cb:bc:fd:1a:4a:eb:17:d8:8d:af:d1:c0:46: - 9f:f0:40:5e:0e:34:2f:e7:db:be:66:fd:89:0b:6b: - 8c:71:c1:0b:0a:c5:c4:c4:eb:7f:44:c1:75:36:23: - fd:ed:b6:ee:87:d9:88:47:e1:4b:7c:60:53:e7:85: - 1c:2f:82:4b:2b:5e:63:1a:49:17:36:2c:fc:39:23: - 49:22:4d:43:b5:51:22:12:24:9e:31:44:d8:16:4e: - a8:eb - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Key Usage: critical - Digital Signature, Key Encipherment - X509v3 Basic Constraints: - CA:FALSE - X509v3 Extended Key Usage: - TLS Web Server Authentication, TLS Web Client Authentication - X509v3 Subject Key Identifier: - 70:A9:FB:44:66:3C:63:96:E6:05:B2:74:47:C8:18:7E:43:6D:EE:8B - X509v3 Authority Key Identifier: - keyid:AE:42:88:75:DD:05:A6:8E:48:7F:50:69:F9:B7:34:23:49:B8:B4:71 - - Authority Information Access: - CA Issuers - URI:http://green.no/ca/tls-ca.cer - - X509v3 CRL Distribution Points: - - Full Name: - URI:http://green.no/ca/tls-ca.crl - - X509v3 Subject Alternative Name: - IP Address:127.0.0.1, IP Address:127.0.0.0, DNS:localhost - Signature Algorithm: sha1WithRSAEncryption - 56:1e:b8:52:ba:f5:72:42:ad:15:71:c1:5e:00:63:c9:4d:56: - f2:8d:a3:a9:91:db:d0:b5:1b:88:80:93:80:28:48:b2:d0:a9: - d0:ea:de:40:78:cc:57:8c:00:b8:65:99:68:95:98:9b:fb:a2: - 43:21:ea:00:37:01:77:c7:3b:1a:ec:58:2d:25:9c:ad:23:41: - 5e:ae:fd:ac:2f:26:81:b8:a7:49:9b:5a:10:fe:ad:c3:86:ab: - 59:67:b0:c7:81:72:95:60:b5:cb:fc:9f:ad:27:16:50:85:76: - 33:16:20:2c:1f:c6:14:09:0c:48:9f:c0:19:16:c9:fa:b0:d8: - bf:b7:8d:a7:aa:eb:fe:f8:6f:dd:2b:83:ee:c7:8a:df:c8:59: - e6:2e:13:1f:57:cc:6f:31:db:f7:b7:5c:3f:78:ad:22:2c:48: - bb:6d:c4:ab:dc:c1:76:34:29:d9:1e:67:e0:ac:37:2b:90:f9: - 71:bd:cf:a1:01:b9:eb:0b:0b:79:2e:8b:52:3d:8e:13:97:c8: - 05:a3:ef:68:82:49:12:2a:25:1a:48:49:b8:7c:3c:66:0d:74: - f9:00:8c:5b:57:d7:76:b1:26:95:86:b2:2e:a3:b2:9c:e0:eb: - 2d:fc:77:03:8f:cd:56:46:3a:c9:6a:fa:72:e3:19:d8:ef:de: - 4b:36:95:79 ------BEGIN CERTIFICATE----- -MIIEQjCCAyqgAwIBAgIBB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AAABhwR/AAAAgglsb2NhbGhv -c3QwDQYJKoZIhvcNAQEFBQADggEBAFYeuFK69XJCrRVxwV4AY8lNVvKNo6mR29C1 -G4iAk4AoSLLQqdDq3kB4zFeMALhlmWiVmJv7okMh6gA3AXfHOxrsWC0lnK0jQV6u -/awvJoG4p0mbWhD+rcOGq1lnsMeBcpVgtcv8n60nFlCFdjMWICwfxhQJDEifwBkW -yfqw2L+3jaeq6/74b90rg+7Hit/IWeYuEx9XzG8x2/e3XD94rSIsSLttxKvcwXY0 -KdkeZ+CsNyuQ+XG9z6EBuesLC3kui1I9jhOXyAWj72iCSRIqJRpISbh8PGYNdPkA -jFtX13axJpWGsi6jspzg6y38dwOPzVZGOslq+nLjGdjv3ks2lXk= ------END CERTIFICATE----- diff --git a/vendor/github.com/prometheus/common/config/testdata/server.key b/vendor/github.com/prometheus/common/config/testdata/server.key deleted file mode 100644 index 126c1b5d0..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/server.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXQ8X2JLjOMBJw -6hecwM7y71iLEn1GXgHxGpOyPtjPmbwQMvESsO8AbNbERYWoM3vN7I9KktBaSkFp -f+PdfnHSIZzfQ7VsYLsqEqgIz8XuCH1I6ktU5ILZiLC4XgISyw4JmbdfQrbXJjQP -Suf8rJxZzaFQTIhf8dJ+WyFB8DdQgEhxUCZhJnlkS36RjQ70J/4ZgL85Vbfz0M1h -bNjBx9Mmd5IaFEJWy7z9GkrrF9iNr9HARp/wQF4ONC/n275m/YkLa4xxwQsKxcTE -639EwXU2I/3ttu6H2YhH4Ut8YFPnhRwvgksrXmMaSRc2LPw5I0kiTUO1USISJJ4x -RNgWTqjrAgMBAAECggEAVurwo4FyV7gzwIIi00XPJLT3ceJL7dUy1HHrEG8gchnq -gHxlHdJhYyMnPVydcosyxp75r2YxJtCoSZDdRHbVvGLo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S24ZT+jlUl4jk6JU6SAlM/o6ixZl5KNR7yQm6zN2O/RHDeYm0urUQ9tF -9dux7LbIFeOoJmoDTWG2+fI= ------END PRIVATE KEY----- diff --git a/vendor/github.com/prometheus/common/config/testdata/tls-ca-chain.pem b/vendor/github.com/prometheus/common/config/testdata/tls-ca-chain.pem deleted file mode 100644 index 03e4189e6..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/tls-ca-chain.pem +++ /dev/null @@ -1,172 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 2 (0x2) - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=NO, O=Green AS, OU=Green Certificate Authority, CN=Green Root CA - Validity - Not Before: Jul 13 03:47:20 2017 GMT - Not After : Jul 13 03:47:20 2027 GMT - Subject: C=NO, O=Green AS, OU=Green Certificate Authority, CN=Green TLS CA - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - Public-Key: (2048 bit) - Modulus: - 00:b5:5a:b3:7a:7f:6a:5b:e9:ee:62:ee:4f:61:42: - 79:93:06:bf:81:fc:9a:1f:b5:80:83:7c:b3:a6:94: - 54:58:8a:b1:74:cb:c3:b8:3c:23:a8:69:1f:ca:2b: - af:be:97:ba:31:73:b5:b8:ce:d9:bf:bf:9a:7a:cf: - 3a:64:51:83:c9:36:d2:f7:3b:3a:0e:4c:c7:66:2e: - bf:1a:df:ce:10:aa:3d:0f:19:74:03:7e:b5:10:bb: - e8:37:bd:62:f0:42:2d:df:3d:ca:70:50:10:17:ce: - a9:ec:55:8e:87:6f:ce:9a:04:36:14:96:cb:d1:a5: - 48:d5:d2:87:02:62:93:4e:21:4a:ff:be:44:f1:d2: - 7e:ed:74:da:c2:51:26:8e:03:a0:c2:bd:bd:5f:b0: - 50:11:78:fd:ab:1d:04:86:6c:c1:8d:20:bd:05:5f: - 51:67:c6:d3:07:95:92:2d:92:90:00:c6:9f:2d:dd: - 36:5c:dc:78:10:7c:f6:68:39:1d:2c:e0:e1:26:64: - 4f:36:34:66:a7:84:6a:90:15:3a:94:b7:79:b1:47: - f5:d2:51:95:54:bf:92:76:9a:b9:88:ee:63:f9:6c: - 0d:38:c6:b6:1c:06:43:ed:24:1d:bb:6c:72:48:cc: - 8c:f4:35:bc:43:fe:a6:96:4c:31:5f:82:0d:0d:20: - 2a:3d - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Key Usage: critical - Certificate Sign, CRL Sign - X509v3 Basic Constraints: critical - CA:TRUE, pathlen:0 - X509v3 Subject Key Identifier: - AE:42:88:75:DD:05:A6:8E:48:7F:50:69:F9:B7:34:23:49:B8:B4:71 - X509v3 Authority Key Identifier: - keyid:60:93:53:2F:C7:CF:2A:D7:F3:09:28:F6:3C:AE:9C:50:EC:93:63:E5 - - Authority Information Access: - CA Issuers - URI:http://green.no/ca/root-ca.cer - - X509v3 CRL Distribution Points: - - Full Name: - URI:http://green.no/ca/root-ca.crl - - Signature Algorithm: sha1WithRSAEncryption - 15:a7:ac:d7:25:9e:2a:d4:d1:14:b4:99:38:3d:2f:73:61:2a: - d9:b6:8b:13:ea:fe:db:78:d9:0a:6c:df:26:6e:c1:d5:4a:97: - 42:19:dd:97:05:03:e4:2b:fc:1e:1f:38:3c:4e:b0:3b:8c:38: - ad:2b:65:fa:35:2d:81:8e:e0:f6:0a:89:4c:38:97:01:4b:9c: - ac:4e:e1:55:17:ef:0a:ad:a7:eb:1e:4b:86:23:12:f1:52:69: - cb:a3:8a:ce:fb:14:8b:86:d7:bb:81:5e:bd:2a:c7:a7:79:58: - 00:10:c0:db:ff:d4:a5:b9:19:74:b3:23:19:4a:1f:78:4b:a8: - b6:f6:20:26:c1:69:f9:89:7f:b8:1c:3b:a2:f9:37:31:80:2c: - b0:b6:2b:d2:84:44:d7:42:e4:e6:44:51:04:35:d9:1c:a4:48: - c6:b7:35:de:f2:ae:da:4b:ba:c8:09:42:8d:ed:7a:81:dc:ed: - 9d:f0:de:6e:21:b9:01:1c:ad:64:3d:25:4c:91:94:f1:13:18: - bb:89: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jyunFDsk2PlMDoGCCsGAQUFBwEBBC4wLDAq -BggrBgEFBQcwAoYeaHR0cDovL2dyZWVuLm5vL2NhL3Jvb3QtY2EuY2VyMC8GA1Ud -HwQoMCYwJKAioCCGHmh0dHA6Ly9ncmVlbi5uby9jYS9yb290LWNhLmNybDANBgkq -hkiG9w0BAQUFAAOCAQEAFaes1yWeKtTRFLSZOD0vc2Eq2baLE+r+23jZCmzfJm7B -1UqXQhndlwUD5Cv8Hh84PE6wO4w4rStl+jUtgY7g9gqJTDiXAUucrE7hVRfvCq2n -6x5LhiMS8VJpy6OKzvsUi4bXu4FevSrHp3lYABDA2//UpbkZdLMjGUofeEuotvYg -JsFp+Yl/uBw7ovk3MYAssLYr0oRE10Lk5kRRBDXZHKRIxrc13vKu2ku6yAlCje16 -gdztnfDebiG5ARytZD0lTJGU8RMYu4npSKwFcwfI271pjm8CnbAYwLnhqLEXUD2s -BW5vY0+xczNgmnfSgYoBOEPpTDyQY6SZS9Ib+Rvs7g== ------END CERTIFICATE----- -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 1 (0x1) - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=NO, O=Green AS, OU=Green Certificate Authority, CN=Green Root CA - Validity - Not Before: Jul 13 03:44:39 2017 GMT - Not After : Dec 31 23:59:59 2030 GMT - Subject: C=NO, O=Green AS, OU=Green Certificate Authority, CN=Green Root CA - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - Public-Key: (2048 bit) - Modulus: - 00:a7:e8:ed:de:d4:54:08:41:07:40:d5:c0:43:d6: - ab:d3:9e:21:87:c6:13:bf:a7:cf:3d:08:4f:c1:fe: - 8f:e5:6c:c5:89:97:e5:27:75:26:c3:2a:73:2d:34: - 7c:6f:35:8d:40:66:61:05:c0:eb:e9:b3:38:47:f8: - 8b:26:35:2c:df:dc:24:31:fe:72:e3:87:10:d1:f7: - a0:57:b7:f3:b1:1a:fe:c7:4b:f8:7b:14:6d:73:08: - 54:eb:63:3c:0c:ce:22:95:5f:3f:f2:6f:89:ae:63: - da:80:74:36:21:13:e8:91:01:58:77:cc:c2:f2:42: - bf:eb:b3:60:a7:21:ed:88:24:7f:eb:ff:07:41:9b: - 93:c8:5f:6a:8e:a6:1a:15:3c:bc:e7:0d:fd:05:fd: - 3c:c1:1c:1d:1f:57:2b:40:27:62:a1:7c:48:63:c1: - 45:e7:2f:20:ed:92:1c:42:94:e4:58:70:7a:b6:d2: - 85:c5:61:d8:cd:c6:37:6b:72:3b:7f:af:55:81:d6: - 9d:dc:10:c9:d8:0e:81:e4:5e:40:13:2f:20:e8:6b: - 46:81:ce:88:47:dd:38:71:3d:ef:21:cc:c0:67:cf: - 0a:f4:e9:3f:a8:9d:26:25:2e:23:1e:a3:11:18:cb: - d1:70:1c:9e:7d:09:b1:a4:20:dc:95:15:1d:49:cf: - 1b:ad - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Key Usage: critical - Certificate Sign, CRL Sign - X509v3 Basic Constraints: critical - CA:TRUE - X509v3 Subject Key Identifier: - 60:93:53:2F:C7:CF:2A:D7:F3:09:28:F6:3C:AE:9C:50:EC:93:63:E5 - X509v3 Authority Key Identifier: - keyid:60:93:53:2F:C7:CF:2A:D7:F3:09:28:F6:3C:AE:9C:50:EC:93:63:E5 - - Signature Algorithm: sha1WithRSAEncryption - a7:77:71:8b:1a:e5:5a:5b:87:54:08:bf:07:3e:cb:99:2f:dc: - 0e:8d:63:94:95:83:19:c9:92:82:d5:cb:5b:8f:1f:86:55:bc: - 70:01:1d:33:46:ec:99:de:6b:1f:c3:c2:7a:dd:ef:69:ab:96: - 58:ec:6c:6f:6c:70:82:71:8a:7f:f0:3b:80:90:d5:64:fa:80: - 27:b8:7b:50:69:98:4b:37:99:ad:bf:a2:5b:93:22:5e:96:44: - 3c:5a:cf:0c:f4:62:63:4a:6f:72:a7:f6:89:1d:09:26:3d:8f: - a8:86:d4:b4:bc:dd:b3:38:ca:c0:59:16:8c:20:1f:89:35:12: - b4:2d:c0:e9:de:93:e0:39:76:32:fc:80:db:da:44:26:fd:01: - 32:74:97:f8:44:ae:fe:05:b1:34:96:13:34:56:73:b4:93:a5: - 55:56:d1:01:51:9d:9c:55:e7:38:53:28:12:4e:38:72:0c:8f: - bd:91:4c:45:48:3b:e1:0d:03:5f:58:40:c9:d3:a0:ac:b3:89: - ce:af:27:8a:0f:ab:ec:72:4d:40:77:30:6b:36:fd:32:46:9f: - ee:f9:c4:f5:17:06:0f:4b:d3:88:f5:a4:2f:3d:87:9e:f5:26: - 74:f0:c9:dc:cb:ad:d9:a7:8a:d3:71:15:00:d3:5d:9f:4c:59: - 3e:24:63:f5 ------BEGIN CERTIFICATE----- -MIIDnDCCAoSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQGEwJOTzER -MA8GA1UECgwIR3JlZW4gQVMxJDAiBgNVBAsMG0dyZWVuIENlcnRpZmljYXRlIEF1 -dGhvcml0eTEWMBQGA1UEAwwNR3JlZW4gUm9vdCBDQTAgFw0xNzA3MTMwMzQ0Mzla -GA8yMDMwMTIzMTIzNTk1OVowXjELMAkGA1UEBhMCTk8xETAPBgNVBAoMCEdyZWVu -IEFTMSQwIgYDVQQLDBtHcmVlbiBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxFjAUBgNV -BAMMDUdyZWVuIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCn6O3e1FQIQQdA1cBD1qvTniGHxhO/p889CE/B/o/lbMWJl+UndSbDKnMtNHxv -NY1AZmEFwOvpszhH+IsmNSzf3CQx/nLjhxDR96BXt/OxGv7HS/h7FG1zCFTrYzwM -ziKVXz/yb4muY9qAdDYhE+iRAVh3zMLyQr/rs2CnIe2IJH/r/wdBm5PIX2qOphoV -PLznDf0F/TzBHB0fVytAJ2KhfEhjwUXnLyDtkhxClORYcHq20oXFYdjNxjdrcjt/ -r1WB1p3cEMnYDoHkXkATLyDoa0aBzohH3ThxPe8hzMBnzwr06T+onSYlLiMeoxEY -y9FwHJ59CbGkINyVFR1JzxutAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRgk1Mvx88q1/MJKPY8rpxQ7JNj5TAfBgNV -HSMEGDAWgBRgk1Mvx88q1/MJKPY8rpxQ7JNj5TANBgkqhkiG9w0BAQUFAAOCAQEA -p3dxixrlWluHVAi/Bz7LmS/cDo1jlJWDGcmSgtXLW48fhlW8cAEdM0bsmd5rH8PC -et3vaauWWOxsb2xwgnGKf/A7gJDVZPqAJ7h7UGmYSzeZrb+iW5MiXpZEPFrPDPRi -Y0pvcqf2iR0JJj2PqIbUtLzdszjKwFkWjCAfiTUStC3A6d6T4Dl2MvyA29pEJv0B -MnSX+ESu/gWxNJYTNFZztJOlVVbRAVGdnFXnOFMoEk44cgyPvZFMRUg74Q0DX1hA -ydOgrLOJzq8nig+r7HJNQHcwazb9Mkaf7vnE9RcGD0vTiPWkLz2HnvUmdPDJ3Mut -2aeK03EVANNdn0xZPiRj9Q== ------END CERTIFICATE----- diff --git a/vendor/github.com/prometheus/common/config/testdata/tls_config.cert_no_key.bad.yml b/vendor/github.com/prometheus/common/config/testdata/tls_config.cert_no_key.bad.yml deleted file mode 100644 index 7dfdc1ead..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/tls_config.cert_no_key.bad.yml +++ /dev/null @@ -1 +0,0 @@ -cert_file: somefile diff --git a/vendor/github.com/prometheus/common/config/testdata/tls_config.insecure.good.yml b/vendor/github.com/prometheus/common/config/testdata/tls_config.insecure.good.yml deleted file mode 100644 index d054383f1..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/tls_config.insecure.good.yml +++ /dev/null @@ -1 +0,0 @@ -insecure_skip_verify: true diff --git a/vendor/github.com/prometheus/common/config/testdata/tls_config.invalid_field.bad.yml b/vendor/github.com/prometheus/common/config/testdata/tls_config.invalid_field.bad.yml deleted file mode 100644 index 12cbaac3b..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/tls_config.invalid_field.bad.yml +++ /dev/null @@ -1 +0,0 @@ -something_invalid: true diff --git a/vendor/github.com/prometheus/common/config/testdata/tls_config.key_no_cert.bad.yml b/vendor/github.com/prometheus/common/config/testdata/tls_config.key_no_cert.bad.yml deleted file mode 100644 index cec045e89..000000000 --- a/vendor/github.com/prometheus/common/config/testdata/tls_config.key_no_cert.bad.yml +++ /dev/null @@ -1 +0,0 @@ -key_file: somefile diff --git a/vendor/github.com/prometheus/common/config/tls_config_test.go b/vendor/github.com/prometheus/common/config/tls_config_test.go deleted file mode 100644 index 31ddb6e9a..000000000 --- a/vendor/github.com/prometheus/common/config/tls_config_test.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2016 The Prometheus 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 config - -import ( - "crypto/tls" - "io/ioutil" - "reflect" - "testing" - - "gopkg.in/yaml.v2" -) - -// LoadTLSConfig parses the given YAML file into a tls.Config. -func LoadTLSConfig(filename string) (*tls.Config, error) { - content, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - cfg := TLSConfig{} - if err = yaml.UnmarshalStrict(content, &cfg); err != nil { - return nil, err - } - return NewTLSConfig(&cfg) -} - -var expectedTLSConfigs = []struct { - filename string - config *tls.Config -}{ - { - filename: "tls_config.empty.good.yml", - config: &tls.Config{}, - }, { - filename: "tls_config.insecure.good.yml", - config: &tls.Config{InsecureSkipVerify: true}, - }, -} - -func TestValidTLSConfig(t *testing.T) { - for _, cfg := range expectedTLSConfigs { - cfg.config.BuildNameToCertificate() - got, err := LoadTLSConfig("testdata/" + cfg.filename) - if err != nil { - t.Errorf("Error parsing %s: %s", cfg.filename, err) - } - if !reflect.DeepEqual(*got, *cfg.config) { - t.Fatalf("%v: unexpected config result: \n\n%v\n expected\n\n%v", cfg.filename, got, cfg.config) - } - } -} diff --git a/vendor/github.com/prometheus/common/expfmt/bench_test.go b/vendor/github.com/prometheus/common/expfmt/bench_test.go deleted file mode 100644 index e539bfc13..000000000 --- a/vendor/github.com/prometheus/common/expfmt/bench_test.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2015 The Prometheus 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 expfmt - -import ( - "bytes" - "compress/gzip" - "io" - "io/ioutil" - "testing" - - "github.com/matttproud/golang_protobuf_extensions/pbutil" - - dto "github.com/prometheus/client_model/go" -) - -var parser TextParser - -// Benchmarks to show how much penalty text format parsing actually inflicts. -// -// Example results on Linux 3.13.0, Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz, go1.4. -// -// BenchmarkParseText 1000 1188535 ns/op 205085 B/op 6135 allocs/op -// BenchmarkParseTextGzip 1000 1376567 ns/op 246224 B/op 6151 allocs/op -// BenchmarkParseProto 10000 172790 ns/op 52258 B/op 1160 allocs/op -// BenchmarkParseProtoGzip 5000 324021 ns/op 94931 B/op 1211 allocs/op -// BenchmarkParseProtoMap 10000 187946 ns/op 58714 B/op 1203 allocs/op -// -// CONCLUSION: The overhead for the map is negligible. Text format needs ~5x more allocations. -// Without compression, it needs ~7x longer, but with compression (the more relevant scenario), -// the difference becomes less relevant, only ~4x. -// -// The test data contains 248 samples. - -// BenchmarkParseText benchmarks the parsing of a text-format scrape into metric -// family DTOs. -func BenchmarkParseText(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/text") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - if _, err := parser.TextToMetricFamilies(bytes.NewReader(data)); err != nil { - b.Fatal(err) - } - } -} - -// BenchmarkParseTextGzip benchmarks the parsing of a gzipped text-format scrape -// into metric family DTOs. -func BenchmarkParseTextGzip(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/text.gz") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - in, err := gzip.NewReader(bytes.NewReader(data)) - if err != nil { - b.Fatal(err) - } - if _, err := parser.TextToMetricFamilies(in); err != nil { - b.Fatal(err) - } - } -} - -// BenchmarkParseProto benchmarks the parsing of a protobuf-format scrape into -// metric family DTOs. Note that this does not build a map of metric families -// (as the text version does), because it is not required for Prometheus -// ingestion either. (However, it is required for the text-format parsing, as -// the metric family might be sprinkled all over the text, while the -// protobuf-format guarantees bundling at one place.) -func BenchmarkParseProto(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/protobuf") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - family := &dto.MetricFamily{} - in := bytes.NewReader(data) - for { - family.Reset() - if _, err := pbutil.ReadDelimited(in, family); err != nil { - if err == io.EOF { - break - } - b.Fatal(err) - } - } - } -} - -// BenchmarkParseProtoGzip is like BenchmarkParseProto above, but parses gzipped -// protobuf format. -func BenchmarkParseProtoGzip(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/protobuf.gz") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - family := &dto.MetricFamily{} - in, err := gzip.NewReader(bytes.NewReader(data)) - if err != nil { - b.Fatal(err) - } - for { - family.Reset() - if _, err := pbutil.ReadDelimited(in, family); err != nil { - if err == io.EOF { - break - } - b.Fatal(err) - } - } - } -} - -// BenchmarkParseProtoMap is like BenchmarkParseProto but DOES put the parsed -// metric family DTOs into a map. This is not happening during Prometheus -// ingestion. It is just here to measure the overhead of that map creation and -// separate it from the overhead of the text format parsing. -func BenchmarkParseProtoMap(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/protobuf") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - families := map[string]*dto.MetricFamily{} - in := bytes.NewReader(data) - for { - family := &dto.MetricFamily{} - if _, err := pbutil.ReadDelimited(in, family); err != nil { - if err == io.EOF { - break - } - b.Fatal(err) - } - families[family.GetName()] = family - } - } -} diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go deleted file mode 100644 index c092723e8..000000000 --- a/vendor/github.com/prometheus/common/expfmt/decode.go +++ /dev/null @@ -1,429 +0,0 @@ -// Copyright 2015 The Prometheus 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 expfmt - -import ( - "fmt" - "io" - "math" - "mime" - "net/http" - - dto "github.com/prometheus/client_model/go" - - "github.com/matttproud/golang_protobuf_extensions/pbutil" - "github.com/prometheus/common/model" -) - -// Decoder types decode an input stream into metric families. -type Decoder interface { - Decode(*dto.MetricFamily) error -} - -// DecodeOptions contains options used by the Decoder and in sample extraction. -type DecodeOptions struct { - // Timestamp is added to each value from the stream that has no explicit timestamp set. - Timestamp model.Time -} - -// ResponseFormat extracts the correct format from a HTTP response header. -// If no matching format can be found FormatUnknown is returned. -func ResponseFormat(h http.Header) Format { - ct := h.Get(hdrContentType) - - mediatype, params, err := mime.ParseMediaType(ct) - if err != nil { - return FmtUnknown - } - - const textType = "text/plain" - - switch mediatype { - case ProtoType: - if p, ok := params["proto"]; ok && p != ProtoProtocol { - return FmtUnknown - } - if e, ok := params["encoding"]; ok && e != "delimited" { - return FmtUnknown - } - return FmtProtoDelim - - case textType: - if v, ok := params["version"]; ok && v != TextVersion { - return FmtUnknown - } - return FmtText - } - - return FmtUnknown -} - -// NewDecoder returns a new decoder based on the given input format. -// If the input format does not imply otherwise, a text format decoder is returned. -func NewDecoder(r io.Reader, format Format) Decoder { - switch format { - case FmtProtoDelim: - return &protoDecoder{r: r} - } - return &textDecoder{r: r} -} - -// protoDecoder implements the Decoder interface for protocol buffers. -type protoDecoder struct { - r io.Reader -} - -// Decode implements the Decoder interface. -func (d *protoDecoder) Decode(v *dto.MetricFamily) error { - _, err := pbutil.ReadDelimited(d.r, v) - if err != nil { - return err - } - if !model.IsValidMetricName(model.LabelValue(v.GetName())) { - return fmt.Errorf("invalid metric name %q", v.GetName()) - } - for _, m := range v.GetMetric() { - if m == nil { - continue - } - for _, l := range m.GetLabel() { - if l == nil { - continue - } - if !model.LabelValue(l.GetValue()).IsValid() { - return fmt.Errorf("invalid label value %q", l.GetValue()) - } - if !model.LabelName(l.GetName()).IsValid() { - return fmt.Errorf("invalid label name %q", l.GetName()) - } - } - } - return nil -} - -// textDecoder implements the Decoder interface for the text protocol. -type textDecoder struct { - r io.Reader - p TextParser - fams []*dto.MetricFamily -} - -// Decode implements the Decoder interface. -func (d *textDecoder) Decode(v *dto.MetricFamily) error { - // TODO(fabxc): Wrap this as a line reader to make streaming safer. - if len(d.fams) == 0 { - // No cached metric families, read everything and parse metrics. - fams, err := d.p.TextToMetricFamilies(d.r) - if err != nil { - return err - } - if len(fams) == 0 { - return io.EOF - } - d.fams = make([]*dto.MetricFamily, 0, len(fams)) - for _, f := range fams { - d.fams = append(d.fams, f) - } - } - - *v = *d.fams[0] - d.fams = d.fams[1:] - - return nil -} - -// SampleDecoder wraps a Decoder to extract samples from the metric families -// decoded by the wrapped Decoder. -type SampleDecoder struct { - Dec Decoder - Opts *DecodeOptions - - f dto.MetricFamily -} - -// Decode calls the Decode method of the wrapped Decoder and then extracts the -// samples from the decoded MetricFamily into the provided model.Vector. -func (sd *SampleDecoder) Decode(s *model.Vector) error { - err := sd.Dec.Decode(&sd.f) - if err != nil { - return err - } - *s, err = extractSamples(&sd.f, sd.Opts) - return err -} - -// ExtractSamples builds a slice of samples from the provided metric -// families. If an error occurrs during sample extraction, it continues to -// extract from the remaining metric families. The returned error is the last -// error that has occurred. -func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) { - var ( - all model.Vector - lastErr error - ) - for _, f := range fams { - some, err := extractSamples(f, o) - if err != nil { - lastErr = err - continue - } - all = append(all, some...) - } - return all, lastErr -} - -func extractSamples(f *dto.MetricFamily, o *DecodeOptions) (model.Vector, error) { - switch f.GetType() { - case dto.MetricType_COUNTER: - return extractCounter(o, f), nil - case dto.MetricType_GAUGE: - return extractGauge(o, f), nil - case dto.MetricType_SUMMARY: - return extractSummary(o, f), nil - case dto.MetricType_UNTYPED: - return extractUntyped(o, f), nil - case dto.MetricType_HISTOGRAM: - return extractHistogram(o, f), nil - } - return nil, fmt.Errorf("expfmt.extractSamples: unknown metric family type %v", f.GetType()) -} - -func extractCounter(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Counter == nil { - continue - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) - - smpl := &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Counter.GetValue()), - } - - if m.TimestampMs != nil { - smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } else { - smpl.Timestamp = o.Timestamp - } - - samples = append(samples, smpl) - } - - return samples -} - -func extractGauge(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Gauge == nil { - continue - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) - - smpl := &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Gauge.GetValue()), - } - - if m.TimestampMs != nil { - smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } else { - smpl.Timestamp = o.Timestamp - } - - samples = append(samples, smpl) - } - - return samples -} - -func extractUntyped(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Untyped == nil { - continue - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) - - smpl := &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Untyped.GetValue()), - } - - if m.TimestampMs != nil { - smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } else { - smpl.Timestamp = o.Timestamp - } - - samples = append(samples, smpl) - } - - return samples -} - -func extractSummary(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Summary == nil { - continue - } - - timestamp := o.Timestamp - if m.TimestampMs != nil { - timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } - - for _, q := range m.Summary.Quantile { - lset := make(model.LabelSet, len(m.Label)+2) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - // BUG(matt): Update other names to "quantile". - lset[model.LabelName(model.QuantileLabel)] = model.LabelValue(fmt.Sprint(q.GetQuantile())) - lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(q.GetValue()), - Timestamp: timestamp, - }) - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum") - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Summary.GetSampleSum()), - Timestamp: timestamp, - }) - - lset = make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count") - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Summary.GetSampleCount()), - Timestamp: timestamp, - }) - } - - return samples -} - -func extractHistogram(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Histogram == nil { - continue - } - - timestamp := o.Timestamp - if m.TimestampMs != nil { - timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } - - infSeen := false - - for _, q := range m.Histogram.Bucket { - lset := make(model.LabelSet, len(m.Label)+2) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.LabelName(model.BucketLabel)] = model.LabelValue(fmt.Sprint(q.GetUpperBound())) - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket") - - if math.IsInf(q.GetUpperBound(), +1) { - infSeen = true - } - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(q.GetCumulativeCount()), - Timestamp: timestamp, - }) - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum") - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Histogram.GetSampleSum()), - Timestamp: timestamp, - }) - - lset = make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count") - - count := &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Histogram.GetSampleCount()), - Timestamp: timestamp, - } - samples = append(samples, count) - - if !infSeen { - // Append an infinity bucket sample. - lset := make(model.LabelSet, len(m.Label)+2) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.LabelName(model.BucketLabel)] = model.LabelValue("+Inf") - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket") - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: count.Value, - Timestamp: timestamp, - }) - } - } - - return samples -} diff --git a/vendor/github.com/prometheus/common/expfmt/decode_test.go b/vendor/github.com/prometheus/common/expfmt/decode_test.go deleted file mode 100644 index 82c1130c9..000000000 --- a/vendor/github.com/prometheus/common/expfmt/decode_test.go +++ /dev/null @@ -1,435 +0,0 @@ -// Copyright 2015 The Prometheus 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 expfmt - -import ( - "io" - "net/http" - "reflect" - "sort" - "strings" - "testing" - - "github.com/golang/protobuf/proto" - dto "github.com/prometheus/client_model/go" - - "github.com/prometheus/common/model" -) - -func TestTextDecoder(t *testing.T) { - var ( - ts = model.Now() - in = ` -# Only a quite simple scenario with two metric families. -# More complicated tests of the parser itself can be found in the text package. -# TYPE mf2 counter -mf2 3 -mf1{label="value1"} -3.14 123456 -mf1{label="value2"} 42 -mf2 4 -` - out = model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "mf1", - "label": "value1", - }, - Value: -3.14, - Timestamp: 123456, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "mf1", - "label": "value2", - }, - Value: 42, - Timestamp: ts, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "mf2", - }, - Value: 3, - Timestamp: ts, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "mf2", - }, - Value: 4, - Timestamp: ts, - }, - } - ) - - dec := &SampleDecoder{ - Dec: &textDecoder{r: strings.NewReader(in)}, - Opts: &DecodeOptions{ - Timestamp: ts, - }, - } - var all model.Vector - for { - var smpls model.Vector - err := dec.Decode(&smpls) - if err == io.EOF { - break - } - if err != nil { - t.Fatal(err) - } - all = append(all, smpls...) - } - sort.Sort(all) - sort.Sort(out) - if !reflect.DeepEqual(all, out) { - t.Fatalf("output does not match") - } -} - -func TestProtoDecoder(t *testing.T) { - - var testTime = model.Now() - - scenarios := []struct { - in string - expected model.Vector - fail bool - }{ - { - in: "", - }, - { - in: "\x8f\x01\n\rrequest_count\x12\x12Number of requests\x18\x00\"0\n#\n\x0fsome_!abel_name\x12\x10some_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00E\xc0\"6\n)\n\x12another_label_name\x12\x13another_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00U@", - fail: true, - }, - { - in: "\x8f\x01\n\rrequest_count\x12\x12Number of requests\x18\x00\"0\n#\n\x0fsome_label_name\x12\x10some_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00E\xc0\"6\n)\n\x12another_label_name\x12\x13another_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00U@", - expected: model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "some_label_name": "some_label_value", - }, - Value: -42, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "another_label_name": "another_label_value", - }, - Value: 84, - Timestamp: testTime, - }, - }, - }, - { - in: "\xb9\x01\n\rrequest_count\x12\x12Number of requests\x18\x02\"O\n#\n\x0fsome_label_name\x12\x10some_label_value\"(\x1a\x12\t\xaeG\xe1z\x14\xae\xef?\x11\x00\x00\x00\x00\x00\x00E\xc0\x1a\x12\t+\x87\x16\xd9\xce\xf7\xef?\x11\x00\x00\x00\x00\x00\x00U\xc0\"A\n)\n\x12another_label_name\x12\x13another_label_value\"\x14\x1a\x12\t\x00\x00\x00\x00\x00\x00\xe0?\x11\x00\x00\x00\x00\x00\x00$@", - expected: model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count_count", - "some_label_name": "some_label_value", - }, - Value: 0, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count_sum", - "some_label_name": "some_label_value", - }, - Value: 0, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "some_label_name": "some_label_value", - "quantile": "0.99", - }, - Value: -42, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "some_label_name": "some_label_value", - "quantile": "0.999", - }, - Value: -84, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count_count", - "another_label_name": "another_label_value", - }, - Value: 0, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count_sum", - "another_label_name": "another_label_value", - }, - Value: 0, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "another_label_name": "another_label_value", - "quantile": "0.5", - }, - Value: 10, - Timestamp: testTime, - }, - }, - }, - { - in: "\x8d\x01\n\x1drequest_duration_microseconds\x12\x15The response latency.\x18\x04\"S:Q\b\x85\x15\x11\xcd\xcc\xccL\x8f\xcb:A\x1a\v\b{\x11\x00\x00\x00\x00\x00\x00Y@\x1a\f\b\x9c\x03\x11\x00\x00\x00\x00\x00\x00^@\x1a\f\b\xd0\x04\x11\x00\x00\x00\x00\x00\x00b@\x1a\f\b\xf4\v\x11\x9a\x99\x99\x99\x99\x99e@\x1a\f\b\x85\x15\x11\x00\x00\x00\x00\x00\x00\xf0\u007f", - expected: model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "100", - }, - Value: 123, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "120", - }, - Value: 412, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "144", - }, - Value: 592, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "172.8", - }, - Value: 1524, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "+Inf", - }, - Value: 2693, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_sum", - }, - Value: 1756047.3, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_count", - }, - Value: 2693, - Timestamp: testTime, - }, - }, - }, - { - // The metric type is unset in this protobuf, which needs to be handled - // correctly by the decoder. - in: "\x1c\n\rrequest_count\"\v\x1a\t\t\x00\x00\x00\x00\x00\x00\xf0?", - expected: model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - }, - Value: 1, - Timestamp: testTime, - }, - }, - }, - } - - for i, scenario := range scenarios { - dec := &SampleDecoder{ - Dec: &protoDecoder{r: strings.NewReader(scenario.in)}, - Opts: &DecodeOptions{ - Timestamp: testTime, - }, - } - - var all model.Vector - for { - var smpls model.Vector - err := dec.Decode(&smpls) - if err == io.EOF { - break - } - if scenario.fail { - if err == nil { - t.Fatal("Expected error but got none") - } - break - } - if err != nil { - t.Fatal(err) - } - all = append(all, smpls...) - } - sort.Sort(all) - sort.Sort(scenario.expected) - if !reflect.DeepEqual(all, scenario.expected) { - t.Fatalf("%d. output does not match, want: %#v, got %#v", i, scenario.expected, all) - } - } -} - -func testDiscriminatorHTTPHeader(t testing.TB) { - var scenarios = []struct { - input map[string]string - output Format - err error - }{ - { - input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="delimited"`}, - output: FmtProtoDelim, - }, - { - input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="illegal"; encoding="delimited"`}, - output: FmtUnknown, - }, - { - input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="illegal"`}, - output: FmtUnknown, - }, - { - input: map[string]string{"Content-Type": `text/plain; version=0.0.4`}, - output: FmtText, - }, - { - input: map[string]string{"Content-Type": `text/plain`}, - output: FmtText, - }, - { - input: map[string]string{"Content-Type": `text/plain; version=0.0.3`}, - output: FmtUnknown, - }, - } - - for i, scenario := range scenarios { - var header http.Header - - if len(scenario.input) > 0 { - header = http.Header{} - } - - for key, value := range scenario.input { - header.Add(key, value) - } - - actual := ResponseFormat(header) - - if scenario.output != actual { - t.Errorf("%d. expected %s, got %s", i, scenario.output, actual) - } - } -} - -func TestDiscriminatorHTTPHeader(t *testing.T) { - testDiscriminatorHTTPHeader(t) -} - -func BenchmarkDiscriminatorHTTPHeader(b *testing.B) { - for i := 0; i < b.N; i++ { - testDiscriminatorHTTPHeader(b) - } -} - -func TestExtractSamples(t *testing.T) { - var ( - goodMetricFamily1 = &dto.MetricFamily{ - Name: proto.String("foo"), - Help: proto.String("Help for foo."), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Counter: &dto.Counter{ - Value: proto.Float64(4711), - }, - }, - }, - } - goodMetricFamily2 = &dto.MetricFamily{ - Name: proto.String("bar"), - Help: proto.String("Help for bar."), - Type: dto.MetricType_GAUGE.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Gauge: &dto.Gauge{ - Value: proto.Float64(3.14), - }, - }, - }, - } - badMetricFamily = &dto.MetricFamily{ - Name: proto.String("bad"), - Help: proto.String("Help for bad."), - Type: dto.MetricType(42).Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Gauge: &dto.Gauge{ - Value: proto.Float64(2.7), - }, - }, - }, - } - - opts = &DecodeOptions{ - Timestamp: 42, - } - ) - - got, err := ExtractSamples(opts, goodMetricFamily1, goodMetricFamily2) - if err != nil { - t.Error("Unexpected error from ExtractSamples:", err) - } - want := model.Vector{ - &model.Sample{Metric: model.Metric{model.MetricNameLabel: "foo"}, Value: 4711, Timestamp: 42}, - &model.Sample{Metric: model.Metric{model.MetricNameLabel: "bar"}, Value: 3.14, Timestamp: 42}, - } - if !reflect.DeepEqual(got, want) { - t.Errorf("unexpected samples extracted, got: %v, want: %v", got, want) - } - - got, err = ExtractSamples(opts, goodMetricFamily1, badMetricFamily, goodMetricFamily2) - if err == nil { - t.Error("Expected error from ExtractSamples") - } - if !reflect.DeepEqual(got, want) { - t.Errorf("unexpected samples extracted, got: %v, want: %v", got, want) - } -} diff --git a/vendor/github.com/prometheus/common/expfmt/encode.go b/vendor/github.com/prometheus/common/expfmt/encode.go deleted file mode 100644 index 11839ed65..000000000 --- a/vendor/github.com/prometheus/common/expfmt/encode.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2015 The Prometheus 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 expfmt - -import ( - "fmt" - "io" - "net/http" - - "github.com/golang/protobuf/proto" - "github.com/matttproud/golang_protobuf_extensions/pbutil" - "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg" - - dto "github.com/prometheus/client_model/go" -) - -// Encoder types encode metric families into an underlying wire protocol. -type Encoder interface { - Encode(*dto.MetricFamily) error -} - -type encoder func(*dto.MetricFamily) error - -func (e encoder) Encode(v *dto.MetricFamily) error { - return e(v) -} - -// Negotiate returns the Content-Type based on the given Accept header. -// If no appropriate accepted type is found, FmtText is returned. -func Negotiate(h http.Header) Format { - for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) { - // Check for protocol buffer - if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol { - switch ac.Params["encoding"] { - case "delimited": - return FmtProtoDelim - case "text": - return FmtProtoText - case "compact-text": - return FmtProtoCompact - } - } - // Check for text format. - ver := ac.Params["version"] - if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") { - return FmtText - } - } - return FmtText -} - -// NewEncoder returns a new encoder based on content type negotiation. -func NewEncoder(w io.Writer, format Format) Encoder { - switch format { - case FmtProtoDelim: - return encoder(func(v *dto.MetricFamily) error { - _, err := pbutil.WriteDelimited(w, v) - return err - }) - case FmtProtoCompact: - return encoder(func(v *dto.MetricFamily) error { - _, err := fmt.Fprintln(w, v.String()) - return err - }) - case FmtProtoText: - return encoder(func(v *dto.MetricFamily) error { - _, err := fmt.Fprintln(w, proto.MarshalTextString(v)) - return err - }) - case FmtText: - return encoder(func(v *dto.MetricFamily) error { - _, err := MetricFamilyToText(w, v) - return err - }) - } - panic("expfmt.NewEncoder: unknown format") -} diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go deleted file mode 100644 index c71bcb981..000000000 --- a/vendor/github.com/prometheus/common/expfmt/expfmt.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Prometheus 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 expfmt contains tools for reading and writing Prometheus metrics. -package expfmt - -// Format specifies the HTTP content type of the different wire protocols. -type Format string - -// Constants to assemble the Content-Type values for the different wire protocols. -const ( - TextVersion = "0.0.4" - ProtoType = `application/vnd.google.protobuf` - ProtoProtocol = `io.prometheus.client.MetricFamily` - ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";" - - // The Content-Type values for the different wire protocols. - FmtUnknown Format = `` - FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8` - FmtProtoDelim Format = ProtoFmt + ` encoding=delimited` - FmtProtoText Format = ProtoFmt + ` encoding=text` - FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text` -) - -const ( - hdrContentType = "Content-Type" - hdrAccept = "Accept" -) diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz.go b/vendor/github.com/prometheus/common/expfmt/fuzz.go deleted file mode 100644 index dc2eedeef..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Prometheus 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. - -// Build only when actually fuzzing -// +build gofuzz - -package expfmt - -import "bytes" - -// Fuzz text metric parser with with github.com/dvyukov/go-fuzz: -// -// go-fuzz-build github.com/prometheus/common/expfmt -// go-fuzz -bin expfmt-fuzz.zip -workdir fuzz -// -// Further input samples should go in the folder fuzz/corpus. -func Fuzz(in []byte) int { - parser := TextParser{} - _, err := parser.TextToMetricFamilies(bytes.NewReader(in)) - - if err != nil { - return 0 - } - - return 1 -} diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_0 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_0 deleted file mode 100644 index 139597f9c..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_0 +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_1 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_1 deleted file mode 100644 index 2ae870679..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_1 +++ /dev/null @@ -1,6 +0,0 @@ - -minimal_metric 1.234 -another_metric -3e3 103948 -# Even that: -no_labels{} 3 -# HELP line for non-existing metric will be ignored. diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_2 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_2 deleted file mode 100644 index 5c351db36..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_2 +++ /dev/null @@ -1,12 +0,0 @@ - -# A normal comment. -# -# TYPE name counter -name{labelname="val1",basename="basevalue"} NaN -name {labelname="val2",basename="base\"v\\al\nue"} 0.23 1234567890 -# HELP name two-line\n doc str\\ing - - # HELP name2 doc str"ing 2 - # TYPE name2 gauge -name2{labelname="val2" ,basename = "basevalue2" } +Inf 54321 -name2{ labelname = "val1" , }-Inf diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_3 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_3 deleted file mode 100644 index 0b3c345aa..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_3 +++ /dev/null @@ -1,22 +0,0 @@ - -# TYPE my_summary summary -my_summary{n1="val1",quantile="0.5"} 110 -decoy -1 -2 -my_summary{n1="val1",quantile="0.9"} 140 1 -my_summary_count{n1="val1"} 42 -# Latest timestamp wins in case of a summary. -my_summary_sum{n1="val1"} 4711 2 -fake_sum{n1="val1"} 2001 -# TYPE another_summary summary -another_summary_count{n2="val2",n1="val1"} 20 -my_summary_count{n2="val2",n1="val1"} 5 5 -another_summary{n1="val1",n2="val2",quantile=".3"} -1.2 -my_summary_sum{n1="val2"} 08 15 -my_summary{n1="val3", quantile="0.2"} 4711 - my_summary{n1="val1",n2="val2",quantile="-12.34",} NaN -# some -# funny comments -# HELP -# HELP -# HELP my_summary -# HELP my_summary diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_4 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_4 deleted file mode 100644 index bde0a387a..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_4 +++ /dev/null @@ -1,10 +0,0 @@ - -# HELP request_duration_microseconds The response latency. -# TYPE request_duration_microseconds histogram -request_duration_microseconds_bucket{le="100"} 123 -request_duration_microseconds_bucket{le="120"} 412 -request_duration_microseconds_bucket{le="144"} 592 -request_duration_microseconds_bucket{le="172.8"} 1524 -request_duration_microseconds_bucket{le="+Inf"} 2693 -request_duration_microseconds_sum 1.7560473e+06 -request_duration_microseconds_count 2693 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_0 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_0 deleted file mode 100644 index 4c67f9a19..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_0 +++ /dev/null @@ -1 +0,0 @@ -bla 3.14 \ No newline at end of file diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_1 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_1 deleted file mode 100644 index b853478ee..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_1 +++ /dev/null @@ -1 +0,0 @@ -metric{label="\t"} 3.14 \ No newline at end of file diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_10 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_10 deleted file mode 100644 index b5fe5f5a6..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_10 +++ /dev/null @@ -1 +0,0 @@ -metric{label="bla"} 3.14 2 3 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_11 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_11 deleted file mode 100644 index 57c7fbc0b..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_11 +++ /dev/null @@ -1 +0,0 @@ -metric{label="bla"} blubb diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_12 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_12 deleted file mode 100644 index 0a9df79a1..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_12 +++ /dev/null @@ -1,3 +0,0 @@ - -# HELP metric one -# HELP metric two diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_13 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_13 deleted file mode 100644 index 5bc742781..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_13 +++ /dev/null @@ -1,3 +0,0 @@ - -# TYPE metric counter -# TYPE metric untyped diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_14 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_14 deleted file mode 100644 index a9a24265b..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_14 +++ /dev/null @@ -1,3 +0,0 @@ - -metric 4.12 -# TYPE metric counter diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_15 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_15 deleted file mode 100644 index 7e95ca8f4..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_15 +++ /dev/null @@ -1,2 +0,0 @@ - -# TYPE metric bla diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_16 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_16 deleted file mode 100644 index 7825f8887..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_16 +++ /dev/null @@ -1,2 +0,0 @@ - -# TYPE met-ric diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_17 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_17 deleted file mode 100644 index 8f35cae0c..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_17 +++ /dev/null @@ -1 +0,0 @@ -@invalidmetric{label="bla"} 3.14 2 \ No newline at end of file diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_18 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_18 deleted file mode 100644 index 7ca2cc268..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_18 +++ /dev/null @@ -1 +0,0 @@ -{label="bla"} 3.14 2 \ No newline at end of file diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_19 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_19 deleted file mode 100644 index 7a6ccc0dd..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_19 +++ /dev/null @@ -1,3 +0,0 @@ - -# TYPE metric histogram -metric_bucket{le="bla"} 3.14 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_2 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_2 deleted file mode 100644 index 726d0017c..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_2 +++ /dev/null @@ -1,3 +0,0 @@ - -metric{label="new -line"} 3.14 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_3 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_3 deleted file mode 100644 index 6aa9e3081..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_3 +++ /dev/null @@ -1 +0,0 @@ -metric{@="bla"} 3.14 \ No newline at end of file diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_4 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_4 deleted file mode 100644 index d112cb902..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_4 +++ /dev/null @@ -1 +0,0 @@ -metric{__name__="bla"} 3.14 \ No newline at end of file diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_5 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_5 deleted file mode 100644 index b34554a8d..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_5 +++ /dev/null @@ -1 +0,0 @@ -metric{label+="bla"} 3.14 \ No newline at end of file diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_6 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_6 deleted file mode 100644 index c4d7df3d1..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_6 +++ /dev/null @@ -1 +0,0 @@ -metric{label=bla} 3.14 \ No newline at end of file diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_7 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_7 deleted file mode 100644 index 97eafc4a6..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_7 +++ /dev/null @@ -1,3 +0,0 @@ - -# TYPE metric summary -metric{quantile="bla"} 3.14 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_8 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_8 deleted file mode 100644 index fc706496b..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_8 +++ /dev/null @@ -1 +0,0 @@ -metric{label="bla"+} 3.14 \ No newline at end of file diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_9 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_9 deleted file mode 100644 index 57b4879c0..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_9 +++ /dev/null @@ -1 +0,0 @@ -metric{label="bla"} 3.14 2.72 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/minimal b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/minimal deleted file mode 100644 index be1e6a369..000000000 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/minimal +++ /dev/null @@ -1 +0,0 @@ -m{} 0 diff --git a/vendor/github.com/prometheus/common/expfmt/testdata/json2 b/vendor/github.com/prometheus/common/expfmt/testdata/json2 deleted file mode 100644 index b914c9386..000000000 --- a/vendor/github.com/prometheus/common/expfmt/testdata/json2 +++ /dev/null @@ -1,46 +0,0 @@ -[ - { - "baseLabels": { - "__name__": "rpc_calls_total", - "job": "batch_job" - }, - "docstring": "RPC calls.", - "metric": { - "type": "counter", - "value": [ - { - "labels": { - "service": "zed" - }, - "value": 25 - }, - { - "labels": { - "service": "bar" - }, - "value": 24 - } - ] - } - }, - { - "baseLabels": { - "__name__": "rpc_latency_microseconds" - }, - "docstring": "RPC latency.", - "metric": { - "type": "histogram", - "value": [ - { - "labels": { - "service": "foo" - }, - "value": { - "0.010000": 15, - "0.990000": 17 - } - } - ] - } - } -] diff --git a/vendor/github.com/prometheus/common/expfmt/testdata/json2_bad b/vendor/github.com/prometheus/common/expfmt/testdata/json2_bad deleted file mode 100644 index cc6ac97c5..000000000 --- a/vendor/github.com/prometheus/common/expfmt/testdata/json2_bad +++ /dev/null @@ -1,46 +0,0 @@ -[ - { - "baseLabels": { - "__name__": "rpc_calls_total", - "job": "batch_job" - }, - "docstring": "RPC calls.", - "metric": { - "type": "counter", - "value": [ - { - "labels": { - "servic|e": "zed" - }, - "value": 25 - }, - { - "labels": { - "service": "bar" - }, - "value": 24 - } - ] - } - }, - { - "baseLabels": { - "__name__": "rpc_latency_microseconds" - }, - "docstring": "RPC latency.", - "metric": { - "type": "histogram", - "value": [ - { - "labels": { - "service": "foo" - }, - "value": { - "0.010000": 15, - "0.990000": 17 - } - } - ] - } - } -] diff --git a/vendor/github.com/prometheus/common/expfmt/testdata/protobuf b/vendor/github.com/prometheus/common/expfmt/testdata/protobuf deleted file mode 100644 index b2d018a7c..000000000 Binary files a/vendor/github.com/prometheus/common/expfmt/testdata/protobuf and /dev/null differ diff --git a/vendor/github.com/prometheus/common/expfmt/testdata/protobuf.gz b/vendor/github.com/prometheus/common/expfmt/testdata/protobuf.gz deleted file mode 100644 index 7622adb1c..000000000 Binary files a/vendor/github.com/prometheus/common/expfmt/testdata/protobuf.gz and /dev/null differ diff --git a/vendor/github.com/prometheus/common/expfmt/testdata/text b/vendor/github.com/prometheus/common/expfmt/testdata/text deleted file mode 100644 index f3d8c3784..000000000 --- a/vendor/github.com/prometheus/common/expfmt/testdata/text +++ /dev/null @@ -1,322 +0,0 @@ -# HELP http_request_duration_microseconds The HTTP request latencies in microseconds. -# TYPE http_request_duration_microseconds summary -http_request_duration_microseconds{handler="/",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/"} 0 -http_request_duration_microseconds_count{handler="/"} 0 -http_request_duration_microseconds{handler="/alerts",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/alerts",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/alerts",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/alerts"} 0 -http_request_duration_microseconds_count{handler="/alerts"} 0 -http_request_duration_microseconds{handler="/api/metrics",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/api/metrics",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/api/metrics",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/api/metrics"} 0 -http_request_duration_microseconds_count{handler="/api/metrics"} 0 -http_request_duration_microseconds{handler="/api/query",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/api/query",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/api/query",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/api/query"} 0 -http_request_duration_microseconds_count{handler="/api/query"} 0 -http_request_duration_microseconds{handler="/api/query_range",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/api/query_range",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/api/query_range",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/api/query_range"} 0 -http_request_duration_microseconds_count{handler="/api/query_range"} 0 -http_request_duration_microseconds{handler="/api/targets",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/api/targets",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/api/targets",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/api/targets"} 0 -http_request_duration_microseconds_count{handler="/api/targets"} 0 -http_request_duration_microseconds{handler="/consoles/",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/consoles/",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/consoles/",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/consoles/"} 0 -http_request_duration_microseconds_count{handler="/consoles/"} 0 -http_request_duration_microseconds{handler="/graph",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/graph",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/graph",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/graph"} 0 -http_request_duration_microseconds_count{handler="/graph"} 0 -http_request_duration_microseconds{handler="/heap",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/heap",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/heap",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/heap"} 0 -http_request_duration_microseconds_count{handler="/heap"} 0 -http_request_duration_microseconds{handler="/static/",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/static/",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/static/",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/static/"} 0 -http_request_duration_microseconds_count{handler="/static/"} 0 -http_request_duration_microseconds{handler="prometheus",quantile="0.5"} 1307.275 -http_request_duration_microseconds{handler="prometheus",quantile="0.9"} 1858.632 -http_request_duration_microseconds{handler="prometheus",quantile="0.99"} 3087.384 -http_request_duration_microseconds_sum{handler="prometheus"} 179886.5000000001 -http_request_duration_microseconds_count{handler="prometheus"} 119 -# HELP http_request_size_bytes The HTTP request sizes in bytes. -# TYPE http_request_size_bytes summary -http_request_size_bytes{handler="/",quantile="0.5"} 0 -http_request_size_bytes{handler="/",quantile="0.9"} 0 -http_request_size_bytes{handler="/",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/"} 0 -http_request_size_bytes_count{handler="/"} 0 -http_request_size_bytes{handler="/alerts",quantile="0.5"} 0 -http_request_size_bytes{handler="/alerts",quantile="0.9"} 0 -http_request_size_bytes{handler="/alerts",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/alerts"} 0 -http_request_size_bytes_count{handler="/alerts"} 0 -http_request_size_bytes{handler="/api/metrics",quantile="0.5"} 0 -http_request_size_bytes{handler="/api/metrics",quantile="0.9"} 0 -http_request_size_bytes{handler="/api/metrics",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/api/metrics"} 0 -http_request_size_bytes_count{handler="/api/metrics"} 0 -http_request_size_bytes{handler="/api/query",quantile="0.5"} 0 -http_request_size_bytes{handler="/api/query",quantile="0.9"} 0 -http_request_size_bytes{handler="/api/query",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/api/query"} 0 -http_request_size_bytes_count{handler="/api/query"} 0 -http_request_size_bytes{handler="/api/query_range",quantile="0.5"} 0 -http_request_size_bytes{handler="/api/query_range",quantile="0.9"} 0 -http_request_size_bytes{handler="/api/query_range",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/api/query_range"} 0 -http_request_size_bytes_count{handler="/api/query_range"} 0 -http_request_size_bytes{handler="/api/targets",quantile="0.5"} 0 -http_request_size_bytes{handler="/api/targets",quantile="0.9"} 0 -http_request_size_bytes{handler="/api/targets",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/api/targets"} 0 -http_request_size_bytes_count{handler="/api/targets"} 0 -http_request_size_bytes{handler="/consoles/",quantile="0.5"} 0 -http_request_size_bytes{handler="/consoles/",quantile="0.9"} 0 -http_request_size_bytes{handler="/consoles/",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/consoles/"} 0 -http_request_size_bytes_count{handler="/consoles/"} 0 -http_request_size_bytes{handler="/graph",quantile="0.5"} 0 -http_request_size_bytes{handler="/graph",quantile="0.9"} 0 -http_request_size_bytes{handler="/graph",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/graph"} 0 -http_request_size_bytes_count{handler="/graph"} 0 -http_request_size_bytes{handler="/heap",quantile="0.5"} 0 -http_request_size_bytes{handler="/heap",quantile="0.9"} 0 -http_request_size_bytes{handler="/heap",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/heap"} 0 -http_request_size_bytes_count{handler="/heap"} 0 -http_request_size_bytes{handler="/static/",quantile="0.5"} 0 -http_request_size_bytes{handler="/static/",quantile="0.9"} 0 -http_request_size_bytes{handler="/static/",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/static/"} 0 -http_request_size_bytes_count{handler="/static/"} 0 -http_request_size_bytes{handler="prometheus",quantile="0.5"} 291 -http_request_size_bytes{handler="prometheus",quantile="0.9"} 291 -http_request_size_bytes{handler="prometheus",quantile="0.99"} 291 -http_request_size_bytes_sum{handler="prometheus"} 34488 -http_request_size_bytes_count{handler="prometheus"} 119 -# HELP http_requests_total Total number of HTTP requests made. -# TYPE http_requests_total counter -http_requests_total{code="200",handler="prometheus",method="get"} 119 -# HELP http_response_size_bytes The HTTP response sizes in bytes. -# TYPE http_response_size_bytes summary -http_response_size_bytes{handler="/",quantile="0.5"} 0 -http_response_size_bytes{handler="/",quantile="0.9"} 0 -http_response_size_bytes{handler="/",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/"} 0 -http_response_size_bytes_count{handler="/"} 0 -http_response_size_bytes{handler="/alerts",quantile="0.5"} 0 -http_response_size_bytes{handler="/alerts",quantile="0.9"} 0 -http_response_size_bytes{handler="/alerts",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/alerts"} 0 -http_response_size_bytes_count{handler="/alerts"} 0 -http_response_size_bytes{handler="/api/metrics",quantile="0.5"} 0 -http_response_size_bytes{handler="/api/metrics",quantile="0.9"} 0 -http_response_size_bytes{handler="/api/metrics",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/api/metrics"} 0 -http_response_size_bytes_count{handler="/api/metrics"} 0 -http_response_size_bytes{handler="/api/query",quantile="0.5"} 0 -http_response_size_bytes{handler="/api/query",quantile="0.9"} 0 -http_response_size_bytes{handler="/api/query",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/api/query"} 0 -http_response_size_bytes_count{handler="/api/query"} 0 -http_response_size_bytes{handler="/api/query_range",quantile="0.5"} 0 -http_response_size_bytes{handler="/api/query_range",quantile="0.9"} 0 -http_response_size_bytes{handler="/api/query_range",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/api/query_range"} 0 -http_response_size_bytes_count{handler="/api/query_range"} 0 -http_response_size_bytes{handler="/api/targets",quantile="0.5"} 0 -http_response_size_bytes{handler="/api/targets",quantile="0.9"} 0 -http_response_size_bytes{handler="/api/targets",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/api/targets"} 0 -http_response_size_bytes_count{handler="/api/targets"} 0 -http_response_size_bytes{handler="/consoles/",quantile="0.5"} 0 -http_response_size_bytes{handler="/consoles/",quantile="0.9"} 0 -http_response_size_bytes{handler="/consoles/",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/consoles/"} 0 -http_response_size_bytes_count{handler="/consoles/"} 0 -http_response_size_bytes{handler="/graph",quantile="0.5"} 0 -http_response_size_bytes{handler="/graph",quantile="0.9"} 0 -http_response_size_bytes{handler="/graph",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/graph"} 0 -http_response_size_bytes_count{handler="/graph"} 0 -http_response_size_bytes{handler="/heap",quantile="0.5"} 0 -http_response_size_bytes{handler="/heap",quantile="0.9"} 0 -http_response_size_bytes{handler="/heap",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/heap"} 0 -http_response_size_bytes_count{handler="/heap"} 0 -http_response_size_bytes{handler="/static/",quantile="0.5"} 0 -http_response_size_bytes{handler="/static/",quantile="0.9"} 0 -http_response_size_bytes{handler="/static/",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/static/"} 0 -http_response_size_bytes_count{handler="/static/"} 0 -http_response_size_bytes{handler="prometheus",quantile="0.5"} 2049 -http_response_size_bytes{handler="prometheus",quantile="0.9"} 2058 -http_response_size_bytes{handler="prometheus",quantile="0.99"} 2064 -http_response_size_bytes_sum{handler="prometheus"} 247001 -http_response_size_bytes_count{handler="prometheus"} 119 -# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. -# TYPE process_cpu_seconds_total counter -process_cpu_seconds_total 0.55 -# HELP go_goroutines Number of goroutines that currently exist. -# TYPE go_goroutines gauge -go_goroutines 70 -# HELP process_max_fds Maximum number of open file descriptors. -# TYPE process_max_fds gauge -process_max_fds 8192 -# HELP process_open_fds Number of open file descriptors. -# TYPE process_open_fds gauge -process_open_fds 29 -# HELP process_resident_memory_bytes Resident memory size in bytes. -# TYPE process_resident_memory_bytes gauge -process_resident_memory_bytes 5.3870592e+07 -# HELP process_start_time_seconds Start time of the process since unix epoch in seconds. -# TYPE process_start_time_seconds gauge -process_start_time_seconds 1.42236894836e+09 -# HELP process_virtual_memory_bytes Virtual memory size in bytes. -# TYPE process_virtual_memory_bytes gauge -process_virtual_memory_bytes 5.41478912e+08 -# HELP prometheus_dns_sd_lookup_failures_total The number of DNS-SD lookup failures. -# TYPE prometheus_dns_sd_lookup_failures_total counter -prometheus_dns_sd_lookup_failures_total 0 -# HELP prometheus_dns_sd_lookups_total The number of DNS-SD lookups. -# TYPE prometheus_dns_sd_lookups_total counter -prometheus_dns_sd_lookups_total 7 -# HELP prometheus_evaluator_duration_milliseconds The duration for all evaluations to execute. -# TYPE prometheus_evaluator_duration_milliseconds summary -prometheus_evaluator_duration_milliseconds{quantile="0.01"} 0 -prometheus_evaluator_duration_milliseconds{quantile="0.05"} 0 -prometheus_evaluator_duration_milliseconds{quantile="0.5"} 0 -prometheus_evaluator_duration_milliseconds{quantile="0.9"} 1 -prometheus_evaluator_duration_milliseconds{quantile="0.99"} 1 -prometheus_evaluator_duration_milliseconds_sum 12 -prometheus_evaluator_duration_milliseconds_count 23 -# HELP prometheus_local_storage_checkpoint_duration_milliseconds The duration (in milliseconds) it took to checkpoint in-memory metrics and head chunks. -# TYPE prometheus_local_storage_checkpoint_duration_milliseconds gauge -prometheus_local_storage_checkpoint_duration_milliseconds 0 -# HELP prometheus_local_storage_chunk_ops_total The total number of chunk operations by their type. -# TYPE prometheus_local_storage_chunk_ops_total counter -prometheus_local_storage_chunk_ops_total{type="create"} 598 -prometheus_local_storage_chunk_ops_total{type="persist"} 174 -prometheus_local_storage_chunk_ops_total{type="pin"} 920 -prometheus_local_storage_chunk_ops_total{type="transcode"} 415 -prometheus_local_storage_chunk_ops_total{type="unpin"} 920 -# HELP prometheus_local_storage_indexing_batch_latency_milliseconds Quantiles for batch indexing latencies in milliseconds. -# TYPE prometheus_local_storage_indexing_batch_latency_milliseconds summary -prometheus_local_storage_indexing_batch_latency_milliseconds{quantile="0.5"} 0 -prometheus_local_storage_indexing_batch_latency_milliseconds{quantile="0.9"} 0 -prometheus_local_storage_indexing_batch_latency_milliseconds{quantile="0.99"} 0 -prometheus_local_storage_indexing_batch_latency_milliseconds_sum 0 -prometheus_local_storage_indexing_batch_latency_milliseconds_count 1 -# HELP prometheus_local_storage_indexing_batch_sizes Quantiles for indexing batch sizes (number of metrics per batch). -# TYPE prometheus_local_storage_indexing_batch_sizes summary -prometheus_local_storage_indexing_batch_sizes{quantile="0.5"} 2 -prometheus_local_storage_indexing_batch_sizes{quantile="0.9"} 2 -prometheus_local_storage_indexing_batch_sizes{quantile="0.99"} 2 -prometheus_local_storage_indexing_batch_sizes_sum 2 -prometheus_local_storage_indexing_batch_sizes_count 1 -# HELP prometheus_local_storage_indexing_queue_capacity The capacity of the indexing queue. -# TYPE prometheus_local_storage_indexing_queue_capacity gauge -prometheus_local_storage_indexing_queue_capacity 16384 -# HELP prometheus_local_storage_indexing_queue_length The number of metrics waiting to be indexed. -# TYPE prometheus_local_storage_indexing_queue_length gauge -prometheus_local_storage_indexing_queue_length 0 -# HELP prometheus_local_storage_ingested_samples_total The total number of samples ingested. -# TYPE prometheus_local_storage_ingested_samples_total counter -prometheus_local_storage_ingested_samples_total 30473 -# HELP prometheus_local_storage_invalid_preload_requests_total The total number of preload requests referring to a non-existent series. This is an indication of outdated label indexes. -# TYPE prometheus_local_storage_invalid_preload_requests_total counter -prometheus_local_storage_invalid_preload_requests_total 0 -# HELP prometheus_local_storage_memory_chunkdescs The current number of chunk descriptors in memory. -# TYPE prometheus_local_storage_memory_chunkdescs gauge -prometheus_local_storage_memory_chunkdescs 1059 -# HELP prometheus_local_storage_memory_chunks The current number of chunks in memory, excluding cloned chunks (i.e. chunks without a descriptor). -# TYPE prometheus_local_storage_memory_chunks gauge -prometheus_local_storage_memory_chunks 1020 -# HELP prometheus_local_storage_memory_series The current number of series in memory. -# TYPE prometheus_local_storage_memory_series gauge -prometheus_local_storage_memory_series 424 -# HELP prometheus_local_storage_persist_latency_microseconds A summary of latencies for persisting each chunk. -# TYPE prometheus_local_storage_persist_latency_microseconds summary -prometheus_local_storage_persist_latency_microseconds{quantile="0.5"} 30.377 -prometheus_local_storage_persist_latency_microseconds{quantile="0.9"} 203.539 -prometheus_local_storage_persist_latency_microseconds{quantile="0.99"} 2626.463 -prometheus_local_storage_persist_latency_microseconds_sum 20424.415 -prometheus_local_storage_persist_latency_microseconds_count 174 -# HELP prometheus_local_storage_persist_queue_capacity The total capacity of the persist queue. -# TYPE prometheus_local_storage_persist_queue_capacity gauge -prometheus_local_storage_persist_queue_capacity 1024 -# HELP prometheus_local_storage_persist_queue_length The current number of chunks waiting in the persist queue. -# TYPE prometheus_local_storage_persist_queue_length gauge -prometheus_local_storage_persist_queue_length 0 -# HELP prometheus_local_storage_series_ops_total The total number of series operations by their type. -# TYPE prometheus_local_storage_series_ops_total counter -prometheus_local_storage_series_ops_total{type="create"} 2 -prometheus_local_storage_series_ops_total{type="maintenance_in_memory"} 11 -# HELP prometheus_notifications_latency_milliseconds Latency quantiles for sending alert notifications (not including dropped notifications). -# TYPE prometheus_notifications_latency_milliseconds summary -prometheus_notifications_latency_milliseconds{quantile="0.5"} 0 -prometheus_notifications_latency_milliseconds{quantile="0.9"} 0 -prometheus_notifications_latency_milliseconds{quantile="0.99"} 0 -prometheus_notifications_latency_milliseconds_sum 0 -prometheus_notifications_latency_milliseconds_count 0 -# HELP prometheus_notifications_queue_capacity The capacity of the alert notifications queue. -# TYPE prometheus_notifications_queue_capacity gauge -prometheus_notifications_queue_capacity 100 -# HELP prometheus_notifications_queue_length The number of alert notifications in the queue. -# TYPE prometheus_notifications_queue_length gauge -prometheus_notifications_queue_length 0 -# HELP prometheus_rule_evaluation_duration_milliseconds The duration for a rule to execute. -# TYPE prometheus_rule_evaluation_duration_milliseconds summary -prometheus_rule_evaluation_duration_milliseconds{rule_type="alerting",quantile="0.5"} 0 -prometheus_rule_evaluation_duration_milliseconds{rule_type="alerting",quantile="0.9"} 0 -prometheus_rule_evaluation_duration_milliseconds{rule_type="alerting",quantile="0.99"} 2 -prometheus_rule_evaluation_duration_milliseconds_sum{rule_type="alerting"} 12 -prometheus_rule_evaluation_duration_milliseconds_count{rule_type="alerting"} 115 -prometheus_rule_evaluation_duration_milliseconds{rule_type="recording",quantile="0.5"} 0 -prometheus_rule_evaluation_duration_milliseconds{rule_type="recording",quantile="0.9"} 0 -prometheus_rule_evaluation_duration_milliseconds{rule_type="recording",quantile="0.99"} 3 -prometheus_rule_evaluation_duration_milliseconds_sum{rule_type="recording"} 15 -prometheus_rule_evaluation_duration_milliseconds_count{rule_type="recording"} 115 -# HELP prometheus_rule_evaluation_failures_total The total number of rule evaluation failures. -# TYPE prometheus_rule_evaluation_failures_total counter -prometheus_rule_evaluation_failures_total 0 -# HELP prometheus_samples_queue_capacity Capacity of the queue for unwritten samples. -# TYPE prometheus_samples_queue_capacity gauge -prometheus_samples_queue_capacity 4096 -# HELP prometheus_samples_queue_length Current number of items in the queue for unwritten samples. Each item comprises all samples exposed by one target as one metric family (i.e. metrics of the same name). -# TYPE prometheus_samples_queue_length gauge -prometheus_samples_queue_length 0 -# HELP prometheus_target_interval_length_seconds Actual intervals between scrapes. -# TYPE prometheus_target_interval_length_seconds summary -prometheus_target_interval_length_seconds{interval="15s",quantile="0.01"} 14 -prometheus_target_interval_length_seconds{interval="15s",quantile="0.05"} 14 -prometheus_target_interval_length_seconds{interval="15s",quantile="0.5"} 15 -prometheus_target_interval_length_seconds{interval="15s",quantile="0.9"} 15 -prometheus_target_interval_length_seconds{interval="15s",quantile="0.99"} 15 -prometheus_target_interval_length_seconds_sum{interval="15s"} 175 -prometheus_target_interval_length_seconds_count{interval="15s"} 12 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.01"} 0 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.05"} 0 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.5"} 0 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.9"} 1 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.99"} 1 -prometheus_target_interval_length_seconds_sum{interval="1s"} 55 -prometheus_target_interval_length_seconds_count{interval="1s"} 117 diff --git a/vendor/github.com/prometheus/common/expfmt/testdata/text.gz b/vendor/github.com/prometheus/common/expfmt/testdata/text.gz deleted file mode 100644 index b7658c84d..000000000 Binary files a/vendor/github.com/prometheus/common/expfmt/testdata/text.gz and /dev/null differ diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go deleted file mode 100644 index 8e473d0fe..000000000 --- a/vendor/github.com/prometheus/common/expfmt/text_create.go +++ /dev/null @@ -1,468 +0,0 @@ -// Copyright 2014 The Prometheus 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 expfmt - -import ( - "bytes" - "fmt" - "io" - "math" - "strconv" - "strings" - "sync" - - "github.com/prometheus/common/model" - - dto "github.com/prometheus/client_model/go" -) - -// enhancedWriter has all the enhanced write functions needed here. bytes.Buffer -// implements it. -type enhancedWriter interface { - io.Writer - WriteRune(r rune) (n int, err error) - WriteString(s string) (n int, err error) - WriteByte(c byte) error -} - -const ( - initialBufSize = 512 - initialNumBufSize = 24 -) - -var ( - bufPool = sync.Pool{ - New: func() interface{} { - return bytes.NewBuffer(make([]byte, 0, initialBufSize)) - }, - } - numBufPool = sync.Pool{ - New: func() interface{} { - b := make([]byte, 0, initialNumBufSize) - return &b - }, - } -) - -// MetricFamilyToText converts a MetricFamily proto message into text format and -// writes the resulting lines to 'out'. It returns the number of bytes written -// and any error encountered. The output will have the same order as the input, -// no further sorting is performed. Furthermore, this function assumes the input -// is already sanitized and does not perform any sanity checks. If the input -// contains duplicate metrics or invalid metric or label names, the conversion -// will result in invalid text format output. -// -// This method fulfills the type 'prometheus.encoder'. -func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err error) { - // Fail-fast checks. - if len(in.Metric) == 0 { - return 0, fmt.Errorf("MetricFamily has no metrics: %s", in) - } - name := in.GetName() - if name == "" { - return 0, fmt.Errorf("MetricFamily has no name: %s", in) - } - - // Try the interface upgrade. If it doesn't work, we'll use a - // bytes.Buffer from the sync.Pool and write out its content to out in a - // single go in the end. - w, ok := out.(enhancedWriter) - if !ok { - b := bufPool.Get().(*bytes.Buffer) - b.Reset() - w = b - defer func() { - bWritten, bErr := out.Write(b.Bytes()) - written = bWritten - if err == nil { - err = bErr - } - bufPool.Put(b) - }() - } - - var n int - - // Comments, first HELP, then TYPE. - if in.Help != nil { - n, err = w.WriteString("# HELP ") - written += n - if err != nil { - return - } - n, err = w.WriteString(name) - written += n - if err != nil { - return - } - err = w.WriteByte(' ') - written++ - if err != nil { - return - } - n, err = writeEscapedString(w, *in.Help, false) - written += n - if err != nil { - return - } - err = w.WriteByte('\n') - written++ - if err != nil { - return - } - } - n, err = w.WriteString("# TYPE ") - written += n - if err != nil { - return - } - n, err = w.WriteString(name) - written += n - if err != nil { - return - } - metricType := in.GetType() - switch metricType { - case dto.MetricType_COUNTER: - n, err = w.WriteString(" counter\n") - case dto.MetricType_GAUGE: - n, err = w.WriteString(" gauge\n") - case dto.MetricType_SUMMARY: - n, err = w.WriteString(" summary\n") - case dto.MetricType_UNTYPED: - n, err = w.WriteString(" untyped\n") - case dto.MetricType_HISTOGRAM: - n, err = w.WriteString(" histogram\n") - default: - return written, fmt.Errorf("unknown metric type %s", metricType.String()) - } - written += n - if err != nil { - return - } - - // Finally the samples, one line for each. - for _, metric := range in.Metric { - switch metricType { - case dto.MetricType_COUNTER: - if metric.Counter == nil { - return written, fmt.Errorf( - "expected counter in metric %s %s", name, metric, - ) - } - n, err = writeSample( - w, name, "", metric, "", 0, - metric.Counter.GetValue(), - ) - case dto.MetricType_GAUGE: - if metric.Gauge == nil { - return written, fmt.Errorf( - "expected gauge in metric %s %s", name, metric, - ) - } - n, err = writeSample( - w, name, "", metric, "", 0, - metric.Gauge.GetValue(), - ) - case dto.MetricType_UNTYPED: - if metric.Untyped == nil { - return written, fmt.Errorf( - "expected untyped in metric %s %s", name, metric, - ) - } - n, err = writeSample( - w, name, "", metric, "", 0, - metric.Untyped.GetValue(), - ) - case dto.MetricType_SUMMARY: - if metric.Summary == nil { - return written, fmt.Errorf( - "expected summary in metric %s %s", name, metric, - ) - } - for _, q := range metric.Summary.Quantile { - n, err = writeSample( - w, name, "", metric, - model.QuantileLabel, q.GetQuantile(), - q.GetValue(), - ) - written += n - if err != nil { - return - } - } - n, err = writeSample( - w, name, "_sum", metric, "", 0, - metric.Summary.GetSampleSum(), - ) - written += n - if err != nil { - return - } - n, err = writeSample( - w, name, "_count", metric, "", 0, - float64(metric.Summary.GetSampleCount()), - ) - case dto.MetricType_HISTOGRAM: - if metric.Histogram == nil { - return written, fmt.Errorf( - "expected histogram in metric %s %s", name, metric, - ) - } - infSeen := false - for _, b := range metric.Histogram.Bucket { - n, err = writeSample( - w, name, "_bucket", metric, - model.BucketLabel, b.GetUpperBound(), - float64(b.GetCumulativeCount()), - ) - written += n - if err != nil { - return - } - if math.IsInf(b.GetUpperBound(), +1) { - infSeen = true - } - } - if !infSeen { - n, err = writeSample( - w, name, "_bucket", metric, - model.BucketLabel, math.Inf(+1), - float64(metric.Histogram.GetSampleCount()), - ) - written += n - if err != nil { - return - } - } - n, err = writeSample( - w, name, "_sum", metric, "", 0, - metric.Histogram.GetSampleSum(), - ) - written += n - if err != nil { - return - } - n, err = writeSample( - w, name, "_count", metric, "", 0, - float64(metric.Histogram.GetSampleCount()), - ) - default: - return written, fmt.Errorf( - "unexpected type in metric %s %s", name, metric, - ) - } - written += n - if err != nil { - return - } - } - return -} - -// writeSample writes a single sample in text format to w, given the metric -// name, the metric proto message itself, optionally an additional label name -// with a float64 value (use empty string as label name if not required), and -// the value. The function returns the number of bytes written and any error -// encountered. -func writeSample( - w enhancedWriter, - name, suffix string, - metric *dto.Metric, - additionalLabelName string, additionalLabelValue float64, - value float64, -) (int, error) { - var written int - n, err := w.WriteString(name) - written += n - if err != nil { - return written, err - } - if suffix != "" { - n, err = w.WriteString(suffix) - written += n - if err != nil { - return written, err - } - } - n, err = writeLabelPairs( - w, metric.Label, additionalLabelName, additionalLabelValue, - ) - written += n - if err != nil { - return written, err - } - err = w.WriteByte(' ') - written++ - if err != nil { - return written, err - } - n, err = writeFloat(w, value) - written += n - if err != nil { - return written, err - } - if metric.TimestampMs != nil { - err = w.WriteByte(' ') - written++ - if err != nil { - return written, err - } - n, err = writeInt(w, *metric.TimestampMs) - written += n - if err != nil { - return written, err - } - } - err = w.WriteByte('\n') - written++ - if err != nil { - return written, err - } - return written, nil -} - -// writeLabelPairs converts a slice of LabelPair proto messages plus the -// explicitly given additional label pair into text formatted as required by the -// text format and writes it to 'w'. An empty slice in combination with an empty -// string 'additionalLabelName' results in nothing being written. Otherwise, the -// label pairs are written, escaped as required by the text format, and enclosed -// in '{...}'. The function returns the number of bytes written and any error -// encountered. -func writeLabelPairs( - w enhancedWriter, - in []*dto.LabelPair, - additionalLabelName string, additionalLabelValue float64, -) (int, error) { - if len(in) == 0 && additionalLabelName == "" { - return 0, nil - } - var ( - written int - separator byte = '{' - ) - for _, lp := range in { - err := w.WriteByte(separator) - written++ - if err != nil { - return written, err - } - n, err := w.WriteString(lp.GetName()) - written += n - if err != nil { - return written, err - } - n, err = w.WriteString(`="`) - written += n - if err != nil { - return written, err - } - n, err = writeEscapedString(w, lp.GetValue(), true) - written += n - if err != nil { - return written, err - } - err = w.WriteByte('"') - written++ - if err != nil { - return written, err - } - separator = ',' - } - if additionalLabelName != "" { - err := w.WriteByte(separator) - written++ - if err != nil { - return written, err - } - n, err := w.WriteString(additionalLabelName) - written += n - if err != nil { - return written, err - } - n, err = w.WriteString(`="`) - written += n - if err != nil { - return written, err - } - n, err = writeFloat(w, additionalLabelValue) - written += n - if err != nil { - return written, err - } - err = w.WriteByte('"') - written++ - if err != nil { - return written, err - } - } - err := w.WriteByte('}') - written++ - if err != nil { - return written, err - } - return written, nil -} - -// writeEscapedString replaces '\' by '\\', new line character by '\n', and - if -// includeDoubleQuote is true - '"' by '\"'. -var ( - escaper = strings.NewReplacer("\\", `\\`, "\n", `\n`) - quotedEscaper = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`) -) - -func writeEscapedString(w enhancedWriter, v string, includeDoubleQuote bool) (int, error) { - if includeDoubleQuote { - return quotedEscaper.WriteString(w, v) - } else { - return escaper.WriteString(w, v) - } -} - -// writeFloat is equivalent to fmt.Fprint with a float64 argument but hardcodes -// a few common cases for increased efficiency. For non-hardcoded cases, it uses -// strconv.AppendFloat to avoid allocations, similar to writeInt. -func writeFloat(w enhancedWriter, f float64) (int, error) { - switch { - case f == 1: - return 1, w.WriteByte('1') - case f == 0: - return 1, w.WriteByte('0') - case f == -1: - return w.WriteString("-1") - case math.IsNaN(f): - return w.WriteString("NaN") - case math.IsInf(f, +1): - return w.WriteString("+Inf") - case math.IsInf(f, -1): - return w.WriteString("-Inf") - default: - bp := numBufPool.Get().(*[]byte) - *bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64) - written, err := w.Write(*bp) - numBufPool.Put(bp) - return written, err - } -} - -// writeInt is equivalent to fmt.Fprint with an int64 argument but uses -// strconv.AppendInt with a byte slice taken from a sync.Pool to avoid -// allocations. -func writeInt(w enhancedWriter, i int64) (int, error) { - bp := numBufPool.Get().(*[]byte) - *bp = strconv.AppendInt((*bp)[:0], i, 10) - written, err := w.Write(*bp) - numBufPool.Put(bp) - return written, err -} diff --git a/vendor/github.com/prometheus/common/expfmt/text_create_test.go b/vendor/github.com/prometheus/common/expfmt/text_create_test.go deleted file mode 100644 index 86e767c19..000000000 --- a/vendor/github.com/prometheus/common/expfmt/text_create_test.go +++ /dev/null @@ -1,561 +0,0 @@ -// Copyright 2014 The Prometheus 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 expfmt - -import ( - "bytes" - "math" - "strings" - "testing" - - "github.com/golang/protobuf/proto" - - dto "github.com/prometheus/client_model/go" -) - -func TestCreate(t *testing.T) { - var scenarios = []struct { - in *dto.MetricFamily - out string - }{ - // 0: Counter, NaN as value, timestamp given. - { - in: &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("two-line\n doc str\\ing"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val1"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("basevalue"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(math.NaN()), - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("basevalue"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(.23), - }, - TimestampMs: proto.Int64(1234567890), - }, - }, - }, - out: `# HELP name two-line\n doc str\\ing -# TYPE name counter -name{labelname="val1",basename="basevalue"} NaN -name{labelname="val2",basename="basevalue"} 0.23 1234567890 -`, - }, - // 1: Gauge, some escaping required, +Inf as value, multi-byte characters in label values. - { - in: &dto.MetricFamily{ - Name: proto.String("gauge_name"), - Help: proto.String("gauge\ndoc\nstr\"ing"), - Type: dto.MetricType_GAUGE.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("val with\nnew line"), - }, - &dto.LabelPair{ - Name: proto.String("name_2"), - Value: proto.String("val with \\backslash and \"quotes\""), - }, - }, - Gauge: &dto.Gauge{ - Value: proto.Float64(math.Inf(+1)), - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("Björn"), - }, - &dto.LabelPair{ - Name: proto.String("name_2"), - Value: proto.String("佖佥"), - }, - }, - Gauge: &dto.Gauge{ - Value: proto.Float64(3.14E42), - }, - }, - }, - }, - out: `# HELP gauge_name gauge\ndoc\nstr"ing -# TYPE gauge_name gauge -gauge_name{name_1="val with\nnew line",name_2="val with \\backslash and \"quotes\""} +Inf -gauge_name{name_1="Björn",name_2="佖佥"} 3.14e+42 -`, - }, - // 2: Untyped, no help, one sample with no labels and -Inf as value, another sample with one label. - { - in: &dto.MetricFamily{ - Name: proto.String("untyped_name"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("value 1"), - }, - }, - Untyped: &dto.Untyped{ - Value: proto.Float64(-1.23e-45), - }, - }, - }, - }, - out: `# TYPE untyped_name untyped -untyped_name -Inf -untyped_name{name_1="value 1"} -1.23e-45 -`, - }, - // 3: Summary. - { - in: &dto.MetricFamily{ - Name: proto.String("summary_name"), - Help: proto.String("summary docstring"), - Type: dto.MetricType_SUMMARY.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Summary: &dto.Summary{ - SampleCount: proto.Uint64(42), - SampleSum: proto.Float64(-3.4567), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.5), - Value: proto.Float64(-1.23), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.9), - Value: proto.Float64(.2342354), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.99), - Value: proto.Float64(0), - }, - }, - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("value 1"), - }, - &dto.LabelPair{ - Name: proto.String("name_2"), - Value: proto.String("value 2"), - }, - }, - Summary: &dto.Summary{ - SampleCount: proto.Uint64(4711), - SampleSum: proto.Float64(2010.1971), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.5), - Value: proto.Float64(1), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.9), - Value: proto.Float64(2), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.99), - Value: proto.Float64(3), - }, - }, - }, - }, - }, - }, - out: `# HELP summary_name summary docstring -# TYPE summary_name summary -summary_name{quantile="0.5"} -1.23 -summary_name{quantile="0.9"} 0.2342354 -summary_name{quantile="0.99"} 0 -summary_name_sum -3.4567 -summary_name_count 42 -summary_name{name_1="value 1",name_2="value 2",quantile="0.5"} 1 -summary_name{name_1="value 1",name_2="value 2",quantile="0.9"} 2 -summary_name{name_1="value 1",name_2="value 2",quantile="0.99"} 3 -summary_name_sum{name_1="value 1",name_2="value 2"} 2010.1971 -summary_name_count{name_1="value 1",name_2="value 2"} 4711 -`, - }, - // 4: Histogram - { - in: &dto.MetricFamily{ - Name: proto.String("request_duration_microseconds"), - Help: proto.String("The response latency."), - Type: dto.MetricType_HISTOGRAM.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Histogram: &dto.Histogram{ - SampleCount: proto.Uint64(2693), - SampleSum: proto.Float64(1756047.3), - Bucket: []*dto.Bucket{ - &dto.Bucket{ - UpperBound: proto.Float64(100), - CumulativeCount: proto.Uint64(123), - }, - &dto.Bucket{ - UpperBound: proto.Float64(120), - CumulativeCount: proto.Uint64(412), - }, - &dto.Bucket{ - UpperBound: proto.Float64(144), - CumulativeCount: proto.Uint64(592), - }, - &dto.Bucket{ - UpperBound: proto.Float64(172.8), - CumulativeCount: proto.Uint64(1524), - }, - &dto.Bucket{ - UpperBound: proto.Float64(math.Inf(+1)), - CumulativeCount: proto.Uint64(2693), - }, - }, - }, - }, - }, - }, - out: `# HELP request_duration_microseconds The response latency. -# TYPE request_duration_microseconds histogram -request_duration_microseconds_bucket{le="100"} 123 -request_duration_microseconds_bucket{le="120"} 412 -request_duration_microseconds_bucket{le="144"} 592 -request_duration_microseconds_bucket{le="172.8"} 1524 -request_duration_microseconds_bucket{le="+Inf"} 2693 -request_duration_microseconds_sum 1.7560473e+06 -request_duration_microseconds_count 2693 -`, - }, - // 5: Histogram with missing +Inf bucket. - { - in: &dto.MetricFamily{ - Name: proto.String("request_duration_microseconds"), - Help: proto.String("The response latency."), - Type: dto.MetricType_HISTOGRAM.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Histogram: &dto.Histogram{ - SampleCount: proto.Uint64(2693), - SampleSum: proto.Float64(1756047.3), - Bucket: []*dto.Bucket{ - &dto.Bucket{ - UpperBound: proto.Float64(100), - CumulativeCount: proto.Uint64(123), - }, - &dto.Bucket{ - UpperBound: proto.Float64(120), - CumulativeCount: proto.Uint64(412), - }, - &dto.Bucket{ - UpperBound: proto.Float64(144), - CumulativeCount: proto.Uint64(592), - }, - &dto.Bucket{ - UpperBound: proto.Float64(172.8), - CumulativeCount: proto.Uint64(1524), - }, - }, - }, - }, - }, - }, - out: `# HELP request_duration_microseconds The response latency. -# TYPE request_duration_microseconds histogram -request_duration_microseconds_bucket{le="100"} 123 -request_duration_microseconds_bucket{le="120"} 412 -request_duration_microseconds_bucket{le="144"} 592 -request_duration_microseconds_bucket{le="172.8"} 1524 -request_duration_microseconds_bucket{le="+Inf"} 2693 -request_duration_microseconds_sum 1.7560473e+06 -request_duration_microseconds_count 2693 -`, - }, - // 6: No metric type, should result in default type Counter. - { - in: &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("doc string"), - Metric: []*dto.Metric{ - &dto.Metric{ - Counter: &dto.Counter{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - }, - }, - out: `# HELP name doc string -# TYPE name counter -name -Inf -`, - }, - } - - for i, scenario := range scenarios { - out := bytes.NewBuffer(make([]byte, 0, len(scenario.out))) - n, err := MetricFamilyToText(out, scenario.in) - if err != nil { - t.Errorf("%d. error: %s", i, err) - continue - } - if expected, got := len(scenario.out), n; expected != got { - t.Errorf( - "%d. expected %d bytes written, got %d", - i, expected, got, - ) - } - if expected, got := scenario.out, out.String(); expected != got { - t.Errorf( - "%d. expected out=%q, got %q", - i, expected, got, - ) - } - } - -} - -func BenchmarkCreate(b *testing.B) { - mf := &dto.MetricFamily{ - Name: proto.String("request_duration_microseconds"), - Help: proto.String("The response latency."), - Type: dto.MetricType_HISTOGRAM.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("val with\nnew line"), - }, - &dto.LabelPair{ - Name: proto.String("name_2"), - Value: proto.String("val with \\backslash and \"quotes\""), - }, - &dto.LabelPair{ - Name: proto.String("name_3"), - Value: proto.String("Just a quite long label value to test performance."), - }, - }, - Histogram: &dto.Histogram{ - SampleCount: proto.Uint64(2693), - SampleSum: proto.Float64(1756047.3), - Bucket: []*dto.Bucket{ - &dto.Bucket{ - UpperBound: proto.Float64(100), - CumulativeCount: proto.Uint64(123), - }, - &dto.Bucket{ - UpperBound: proto.Float64(120), - CumulativeCount: proto.Uint64(412), - }, - &dto.Bucket{ - UpperBound: proto.Float64(144), - CumulativeCount: proto.Uint64(592), - }, - &dto.Bucket{ - UpperBound: proto.Float64(172.8), - CumulativeCount: proto.Uint64(1524), - }, - &dto.Bucket{ - UpperBound: proto.Float64(math.Inf(+1)), - CumulativeCount: proto.Uint64(2693), - }, - }, - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("Björn"), - }, - &dto.LabelPair{ - Name: proto.String("name_2"), - Value: proto.String("佖佥"), - }, - &dto.LabelPair{ - Name: proto.String("name_3"), - Value: proto.String("Just a quite long label value to test performance."), - }, - }, - Histogram: &dto.Histogram{ - SampleCount: proto.Uint64(5699), - SampleSum: proto.Float64(49484343543.4343), - Bucket: []*dto.Bucket{ - &dto.Bucket{ - UpperBound: proto.Float64(100), - CumulativeCount: proto.Uint64(120), - }, - &dto.Bucket{ - UpperBound: proto.Float64(120), - CumulativeCount: proto.Uint64(412), - }, - &dto.Bucket{ - UpperBound: proto.Float64(144), - CumulativeCount: proto.Uint64(596), - }, - &dto.Bucket{ - UpperBound: proto.Float64(172.8), - CumulativeCount: proto.Uint64(1535), - }, - }, - }, - TimestampMs: proto.Int64(1234567890), - }, - }, - } - out := bytes.NewBuffer(make([]byte, 0, 1024)) - - for i := 0; i < b.N; i++ { - _, err := MetricFamilyToText(out, mf) - if err != nil { - b.Fatal(err) - } - out.Reset() - } -} - -func BenchmarkCreateBuildInfo(b *testing.B) { - mf := &dto.MetricFamily{ - Name: proto.String("benchmark_build_info"), - Help: proto.String("Test the creation of constant 1-value build_info metric."), - Type: dto.MetricType_GAUGE.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("version"), - Value: proto.String("1.2.3"), - }, - &dto.LabelPair{ - Name: proto.String("revision"), - Value: proto.String("2e84f5e4eacdffb574035810305191ff390360fe"), - }, - &dto.LabelPair{ - Name: proto.String("go_version"), - Value: proto.String("1.11.1"), - }, - }, - Gauge: &dto.Gauge{ - Value: proto.Float64(1), - }, - }, - }, - } - out := bytes.NewBuffer(make([]byte, 0, 1024)) - - for i := 0; i < b.N; i++ { - _, err := MetricFamilyToText(out, mf) - if err != nil { - b.Fatal(err) - } - out.Reset() - } -} - -func TestCreateError(t *testing.T) { - var scenarios = []struct { - in *dto.MetricFamily - err string - }{ - // 0: No metric. - { - in: &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("doc string"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{}, - }, - err: "MetricFamily has no metrics", - }, - // 1: No metric name. - { - in: &dto.MetricFamily{ - Help: proto.String("doc string"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - }, - }, - err: "MetricFamily has no name", - }, - // 2: Wrong type. - { - in: &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("doc string"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - }, - }, - err: "expected counter in metric", - }, - } - - for i, scenario := range scenarios { - var out bytes.Buffer - _, err := MetricFamilyToText(&out, scenario.in) - if err == nil { - t.Errorf("%d. expected error, got nil", i) - continue - } - if expected, got := scenario.err, err.Error(); strings.Index(got, expected) != 0 { - t.Errorf( - "%d. expected error starting with %q, got %q", - i, expected, got, - ) - } - } - -} diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go deleted file mode 100644 index ec3d86ba7..000000000 --- a/vendor/github.com/prometheus/common/expfmt/text_parse.go +++ /dev/null @@ -1,757 +0,0 @@ -// Copyright 2014 The Prometheus 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 expfmt - -import ( - "bufio" - "bytes" - "fmt" - "io" - "math" - "strconv" - "strings" - - dto "github.com/prometheus/client_model/go" - - "github.com/golang/protobuf/proto" - "github.com/prometheus/common/model" -) - -// A stateFn is a function that represents a state in a state machine. By -// executing it, the state is progressed to the next state. The stateFn returns -// another stateFn, which represents the new state. The end state is represented -// by nil. -type stateFn func() stateFn - -// ParseError signals errors while parsing the simple and flat text-based -// exchange format. -type ParseError struct { - Line int - Msg string -} - -// Error implements the error interface. -func (e ParseError) Error() string { - return fmt.Sprintf("text format parsing error in line %d: %s", e.Line, e.Msg) -} - -// TextParser is used to parse the simple and flat text-based exchange format. Its -// zero value is ready to use. -type TextParser struct { - metricFamiliesByName map[string]*dto.MetricFamily - buf *bufio.Reader // Where the parsed input is read through. - err error // Most recent error. - lineCount int // Tracks the line count for error messages. - currentByte byte // The most recent byte read. - currentToken bytes.Buffer // Re-used each time a token has to be gathered from multiple bytes. - currentMF *dto.MetricFamily - currentMetric *dto.Metric - currentLabelPair *dto.LabelPair - - // The remaining member variables are only used for summaries/histograms. - currentLabels map[string]string // All labels including '__name__' but excluding 'quantile'/'le' - // Summary specific. - summaries map[uint64]*dto.Metric // Key is created with LabelsToSignature. - currentQuantile float64 - // Histogram specific. - histograms map[uint64]*dto.Metric // Key is created with LabelsToSignature. - currentBucket float64 - // These tell us if the currently processed line ends on '_count' or - // '_sum' respectively and belong to a summary/histogram, representing the sample - // count and sum of that summary/histogram. - currentIsSummaryCount, currentIsSummarySum bool - currentIsHistogramCount, currentIsHistogramSum bool -} - -// TextToMetricFamilies reads 'in' as the simple and flat text-based exchange -// format and creates MetricFamily proto messages. It returns the MetricFamily -// proto messages in a map where the metric names are the keys, along with any -// error encountered. -// -// If the input contains duplicate metrics (i.e. lines with the same metric name -// and exactly the same label set), the resulting MetricFamily will contain -// duplicate Metric proto messages. Similar is true for duplicate label -// names. Checks for duplicates have to be performed separately, if required. -// Also note that neither the metrics within each MetricFamily are sorted nor -// the label pairs within each Metric. Sorting is not required for the most -// frequent use of this method, which is sample ingestion in the Prometheus -// server. However, for presentation purposes, you might want to sort the -// metrics, and in some cases, you must sort the labels, e.g. for consumption by -// the metric family injection hook of the Prometheus registry. -// -// Summaries and histograms are rather special beasts. You would probably not -// use them in the simple text format anyway. This method can deal with -// summaries and histograms if they are presented in exactly the way the -// text.Create function creates them. -// -// This method must not be called concurrently. If you want to parse different -// input concurrently, instantiate a separate Parser for each goroutine. -func (p *TextParser) TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricFamily, error) { - p.reset(in) - for nextState := p.startOfLine; nextState != nil; nextState = nextState() { - // Magic happens here... - } - // Get rid of empty metric families. - for k, mf := range p.metricFamiliesByName { - if len(mf.GetMetric()) == 0 { - delete(p.metricFamiliesByName, k) - } - } - // If p.err is io.EOF now, we have run into a premature end of the input - // stream. Turn this error into something nicer and more - // meaningful. (io.EOF is often used as a signal for the legitimate end - // of an input stream.) - if p.err == io.EOF { - p.parseError("unexpected end of input stream") - } - return p.metricFamiliesByName, p.err -} - -func (p *TextParser) reset(in io.Reader) { - p.metricFamiliesByName = map[string]*dto.MetricFamily{} - if p.buf == nil { - p.buf = bufio.NewReader(in) - } else { - p.buf.Reset(in) - } - p.err = nil - p.lineCount = 0 - if p.summaries == nil || len(p.summaries) > 0 { - p.summaries = map[uint64]*dto.Metric{} - } - if p.histograms == nil || len(p.histograms) > 0 { - p.histograms = map[uint64]*dto.Metric{} - } - p.currentQuantile = math.NaN() - p.currentBucket = math.NaN() -} - -// startOfLine represents the state where the next byte read from p.buf is the -// start of a line (or whitespace leading up to it). -func (p *TextParser) startOfLine() stateFn { - p.lineCount++ - if p.skipBlankTab(); p.err != nil { - // End of input reached. This is the only case where - // that is not an error but a signal that we are done. - p.err = nil - return nil - } - switch p.currentByte { - case '#': - return p.startComment - case '\n': - return p.startOfLine // Empty line, start the next one. - } - return p.readingMetricName -} - -// startComment represents the state where the next byte read from p.buf is the -// start of a comment (or whitespace leading up to it). -func (p *TextParser) startComment() stateFn { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte == '\n' { - return p.startOfLine - } - if p.readTokenUntilWhitespace(); p.err != nil { - return nil // Unexpected end of input. - } - // If we have hit the end of line already, there is nothing left - // to do. This is not considered a syntax error. - if p.currentByte == '\n' { - return p.startOfLine - } - keyword := p.currentToken.String() - if keyword != "HELP" && keyword != "TYPE" { - // Generic comment, ignore by fast forwarding to end of line. - for p.currentByte != '\n' { - if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil { - return nil // Unexpected end of input. - } - } - return p.startOfLine - } - // There is something. Next has to be a metric name. - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.readTokenAsMetricName(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte == '\n' { - // At the end of the line already. - // Again, this is not considered a syntax error. - return p.startOfLine - } - if !isBlankOrTab(p.currentByte) { - p.parseError("invalid metric name in comment") - return nil - } - p.setOrCreateCurrentMF() - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte == '\n' { - // At the end of the line already. - // Again, this is not considered a syntax error. - return p.startOfLine - } - switch keyword { - case "HELP": - return p.readingHelp - case "TYPE": - return p.readingType - } - panic(fmt.Sprintf("code error: unexpected keyword %q", keyword)) -} - -// readingMetricName represents the state where the last byte read (now in -// p.currentByte) is the first byte of a metric name. -func (p *TextParser) readingMetricName() stateFn { - if p.readTokenAsMetricName(); p.err != nil { - return nil - } - if p.currentToken.Len() == 0 { - p.parseError("invalid metric name") - return nil - } - p.setOrCreateCurrentMF() - // Now is the time to fix the type if it hasn't happened yet. - if p.currentMF.Type == nil { - p.currentMF.Type = dto.MetricType_UNTYPED.Enum() - } - p.currentMetric = &dto.Metric{} - // Do not append the newly created currentMetric to - // currentMF.Metric right now. First wait if this is a summary, - // and the metric exists already, which we can only know after - // having read all the labels. - if p.skipBlankTabIfCurrentBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - return p.readingLabels -} - -// readingLabels represents the state where the last byte read (now in -// p.currentByte) is either the first byte of the label set (i.e. a '{'), or the -// first byte of the value (otherwise). -func (p *TextParser) readingLabels() stateFn { - // Summaries/histograms are special. We have to reset the - // currentLabels map, currentQuantile and currentBucket before starting to - // read labels. - if p.currentMF.GetType() == dto.MetricType_SUMMARY || p.currentMF.GetType() == dto.MetricType_HISTOGRAM { - p.currentLabels = map[string]string{} - p.currentLabels[string(model.MetricNameLabel)] = p.currentMF.GetName() - p.currentQuantile = math.NaN() - p.currentBucket = math.NaN() - } - if p.currentByte != '{' { - return p.readingValue - } - return p.startLabelName -} - -// startLabelName represents the state where the next byte read from p.buf is -// the start of a label name (or whitespace leading up to it). -func (p *TextParser) startLabelName() stateFn { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte == '}' { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - return p.readingValue - } - if p.readTokenAsLabelName(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentToken.Len() == 0 { - p.parseError(fmt.Sprintf("invalid label name for metric %q", p.currentMF.GetName())) - return nil - } - p.currentLabelPair = &dto.LabelPair{Name: proto.String(p.currentToken.String())} - if p.currentLabelPair.GetName() == string(model.MetricNameLabel) { - p.parseError(fmt.Sprintf("label name %q is reserved", model.MetricNameLabel)) - return nil - } - // Special summary/histogram treatment. Don't add 'quantile' and 'le' - // labels to 'real' labels. - if !(p.currentMF.GetType() == dto.MetricType_SUMMARY && p.currentLabelPair.GetName() == model.QuantileLabel) && - !(p.currentMF.GetType() == dto.MetricType_HISTOGRAM && p.currentLabelPair.GetName() == model.BucketLabel) { - p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPair) - } - if p.skipBlankTabIfCurrentBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte != '=' { - p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte)) - return nil - } - return p.startLabelValue -} - -// startLabelValue represents the state where the next byte read from p.buf is -// the start of a (quoted) label value (or whitespace leading up to it). -func (p *TextParser) startLabelValue() stateFn { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte != '"' { - p.parseError(fmt.Sprintf("expected '\"' at start of label value, found %q", p.currentByte)) - return nil - } - if p.readTokenAsLabelValue(); p.err != nil { - return nil - } - if !model.LabelValue(p.currentToken.String()).IsValid() { - p.parseError(fmt.Sprintf("invalid label value %q", p.currentToken.String())) - return nil - } - p.currentLabelPair.Value = proto.String(p.currentToken.String()) - // Special treatment of summaries: - // - Quantile labels are special, will result in dto.Quantile later. - // - Other labels have to be added to currentLabels for signature calculation. - if p.currentMF.GetType() == dto.MetricType_SUMMARY { - if p.currentLabelPair.GetName() == model.QuantileLabel { - if p.currentQuantile, p.err = strconv.ParseFloat(p.currentLabelPair.GetValue(), 64); p.err != nil { - // Create a more helpful error message. - p.parseError(fmt.Sprintf("expected float as value for 'quantile' label, got %q", p.currentLabelPair.GetValue())) - return nil - } - } else { - p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue() - } - } - // Similar special treatment of histograms. - if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { - if p.currentLabelPair.GetName() == model.BucketLabel { - if p.currentBucket, p.err = strconv.ParseFloat(p.currentLabelPair.GetValue(), 64); p.err != nil { - // Create a more helpful error message. - p.parseError(fmt.Sprintf("expected float as value for 'le' label, got %q", p.currentLabelPair.GetValue())) - return nil - } - } else { - p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue() - } - } - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - switch p.currentByte { - case ',': - return p.startLabelName - - case '}': - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - return p.readingValue - default: - p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.GetValue())) - return nil - } -} - -// readingValue represents the state where the last byte read (now in -// p.currentByte) is the first byte of the sample value (i.e. a float). -func (p *TextParser) readingValue() stateFn { - // When we are here, we have read all the labels, so for the - // special case of a summary/histogram, we can finally find out - // if the metric already exists. - if p.currentMF.GetType() == dto.MetricType_SUMMARY { - signature := model.LabelsToSignature(p.currentLabels) - if summary := p.summaries[signature]; summary != nil { - p.currentMetric = summary - } else { - p.summaries[signature] = p.currentMetric - p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) - } - } else if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { - signature := model.LabelsToSignature(p.currentLabels) - if histogram := p.histograms[signature]; histogram != nil { - p.currentMetric = histogram - } else { - p.histograms[signature] = p.currentMetric - p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) - } - } else { - p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) - } - if p.readTokenUntilWhitespace(); p.err != nil { - return nil // Unexpected end of input. - } - value, err := strconv.ParseFloat(p.currentToken.String(), 64) - if err != nil { - // Create a more helpful error message. - p.parseError(fmt.Sprintf("expected float as value, got %q", p.currentToken.String())) - return nil - } - switch p.currentMF.GetType() { - case dto.MetricType_COUNTER: - p.currentMetric.Counter = &dto.Counter{Value: proto.Float64(value)} - case dto.MetricType_GAUGE: - p.currentMetric.Gauge = &dto.Gauge{Value: proto.Float64(value)} - case dto.MetricType_UNTYPED: - p.currentMetric.Untyped = &dto.Untyped{Value: proto.Float64(value)} - case dto.MetricType_SUMMARY: - // *sigh* - if p.currentMetric.Summary == nil { - p.currentMetric.Summary = &dto.Summary{} - } - switch { - case p.currentIsSummaryCount: - p.currentMetric.Summary.SampleCount = proto.Uint64(uint64(value)) - case p.currentIsSummarySum: - p.currentMetric.Summary.SampleSum = proto.Float64(value) - case !math.IsNaN(p.currentQuantile): - p.currentMetric.Summary.Quantile = append( - p.currentMetric.Summary.Quantile, - &dto.Quantile{ - Quantile: proto.Float64(p.currentQuantile), - Value: proto.Float64(value), - }, - ) - } - case dto.MetricType_HISTOGRAM: - // *sigh* - if p.currentMetric.Histogram == nil { - p.currentMetric.Histogram = &dto.Histogram{} - } - switch { - case p.currentIsHistogramCount: - p.currentMetric.Histogram.SampleCount = proto.Uint64(uint64(value)) - case p.currentIsHistogramSum: - p.currentMetric.Histogram.SampleSum = proto.Float64(value) - case !math.IsNaN(p.currentBucket): - p.currentMetric.Histogram.Bucket = append( - p.currentMetric.Histogram.Bucket, - &dto.Bucket{ - UpperBound: proto.Float64(p.currentBucket), - CumulativeCount: proto.Uint64(uint64(value)), - }, - ) - } - default: - p.err = fmt.Errorf("unexpected type for metric name %q", p.currentMF.GetName()) - } - if p.currentByte == '\n' { - return p.startOfLine - } - return p.startTimestamp -} - -// startTimestamp represents the state where the next byte read from p.buf is -// the start of the timestamp (or whitespace leading up to it). -func (p *TextParser) startTimestamp() stateFn { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.readTokenUntilWhitespace(); p.err != nil { - return nil // Unexpected end of input. - } - timestamp, err := strconv.ParseInt(p.currentToken.String(), 10, 64) - if err != nil { - // Create a more helpful error message. - p.parseError(fmt.Sprintf("expected integer as timestamp, got %q", p.currentToken.String())) - return nil - } - p.currentMetric.TimestampMs = proto.Int64(timestamp) - if p.readTokenUntilNewline(false); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentToken.Len() > 0 { - p.parseError(fmt.Sprintf("spurious string after timestamp: %q", p.currentToken.String())) - return nil - } - return p.startOfLine -} - -// readingHelp represents the state where the last byte read (now in -// p.currentByte) is the first byte of the docstring after 'HELP'. -func (p *TextParser) readingHelp() stateFn { - if p.currentMF.Help != nil { - p.parseError(fmt.Sprintf("second HELP line for metric name %q", p.currentMF.GetName())) - return nil - } - // Rest of line is the docstring. - if p.readTokenUntilNewline(true); p.err != nil { - return nil // Unexpected end of input. - } - p.currentMF.Help = proto.String(p.currentToken.String()) - return p.startOfLine -} - -// readingType represents the state where the last byte read (now in -// p.currentByte) is the first byte of the type hint after 'HELP'. -func (p *TextParser) readingType() stateFn { - if p.currentMF.Type != nil { - p.parseError(fmt.Sprintf("second TYPE line for metric name %q, or TYPE reported after samples", p.currentMF.GetName())) - return nil - } - // Rest of line is the type. - if p.readTokenUntilNewline(false); p.err != nil { - return nil // Unexpected end of input. - } - metricType, ok := dto.MetricType_value[strings.ToUpper(p.currentToken.String())] - if !ok { - p.parseError(fmt.Sprintf("unknown metric type %q", p.currentToken.String())) - return nil - } - p.currentMF.Type = dto.MetricType(metricType).Enum() - return p.startOfLine -} - -// parseError sets p.err to a ParseError at the current line with the given -// message. -func (p *TextParser) parseError(msg string) { - p.err = ParseError{ - Line: p.lineCount, - Msg: msg, - } -} - -// skipBlankTab reads (and discards) bytes from p.buf until it encounters a byte -// that is neither ' ' nor '\t'. That byte is left in p.currentByte. -func (p *TextParser) skipBlankTab() { - for { - if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil || !isBlankOrTab(p.currentByte) { - return - } - } -} - -// skipBlankTabIfCurrentBlankTab works exactly as skipBlankTab but doesn't do -// anything if p.currentByte is neither ' ' nor '\t'. -func (p *TextParser) skipBlankTabIfCurrentBlankTab() { - if isBlankOrTab(p.currentByte) { - p.skipBlankTab() - } -} - -// readTokenUntilWhitespace copies bytes from p.buf into p.currentToken. The -// first byte considered is the byte already read (now in p.currentByte). The -// first whitespace byte encountered is still copied into p.currentByte, but not -// into p.currentToken. -func (p *TextParser) readTokenUntilWhitespace() { - p.currentToken.Reset() - for p.err == nil && !isBlankOrTab(p.currentByte) && p.currentByte != '\n' { - p.currentToken.WriteByte(p.currentByte) - p.currentByte, p.err = p.buf.ReadByte() - } -} - -// readTokenUntilNewline copies bytes from p.buf into p.currentToken. The first -// byte considered is the byte already read (now in p.currentByte). The first -// newline byte encountered is still copied into p.currentByte, but not into -// p.currentToken. If recognizeEscapeSequence is true, two escape sequences are -// recognized: '\\' translates into '\', and '\n' into a line-feed character. -// All other escape sequences are invalid and cause an error. -func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) { - p.currentToken.Reset() - escaped := false - for p.err == nil { - if recognizeEscapeSequence && escaped { - switch p.currentByte { - case '\\': - p.currentToken.WriteByte(p.currentByte) - case 'n': - p.currentToken.WriteByte('\n') - default: - p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) - return - } - escaped = false - } else { - switch p.currentByte { - case '\n': - return - case '\\': - escaped = true - default: - p.currentToken.WriteByte(p.currentByte) - } - } - p.currentByte, p.err = p.buf.ReadByte() - } -} - -// readTokenAsMetricName copies a metric name from p.buf into p.currentToken. -// The first byte considered is the byte already read (now in p.currentByte). -// The first byte not part of a metric name is still copied into p.currentByte, -// but not into p.currentToken. -func (p *TextParser) readTokenAsMetricName() { - p.currentToken.Reset() - if !isValidMetricNameStart(p.currentByte) { - return - } - for { - p.currentToken.WriteByte(p.currentByte) - p.currentByte, p.err = p.buf.ReadByte() - if p.err != nil || !isValidMetricNameContinuation(p.currentByte) { - return - } - } -} - -// readTokenAsLabelName copies a label name from p.buf into p.currentToken. -// The first byte considered is the byte already read (now in p.currentByte). -// The first byte not part of a label name is still copied into p.currentByte, -// but not into p.currentToken. -func (p *TextParser) readTokenAsLabelName() { - p.currentToken.Reset() - if !isValidLabelNameStart(p.currentByte) { - return - } - for { - p.currentToken.WriteByte(p.currentByte) - p.currentByte, p.err = p.buf.ReadByte() - if p.err != nil || !isValidLabelNameContinuation(p.currentByte) { - return - } - } -} - -// readTokenAsLabelValue copies a label value from p.buf into p.currentToken. -// In contrast to the other 'readTokenAs...' functions, which start with the -// last read byte in p.currentByte, this method ignores p.currentByte and starts -// with reading a new byte from p.buf. The first byte not part of a label value -// is still copied into p.currentByte, but not into p.currentToken. -func (p *TextParser) readTokenAsLabelValue() { - p.currentToken.Reset() - escaped := false - for { - if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil { - return - } - if escaped { - switch p.currentByte { - case '"', '\\': - p.currentToken.WriteByte(p.currentByte) - case 'n': - p.currentToken.WriteByte('\n') - default: - p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) - return - } - escaped = false - continue - } - switch p.currentByte { - case '"': - return - case '\n': - p.parseError(fmt.Sprintf("label value %q contains unescaped new-line", p.currentToken.String())) - return - case '\\': - escaped = true - default: - p.currentToken.WriteByte(p.currentByte) - } - } -} - -func (p *TextParser) setOrCreateCurrentMF() { - p.currentIsSummaryCount = false - p.currentIsSummarySum = false - p.currentIsHistogramCount = false - p.currentIsHistogramSum = false - name := p.currentToken.String() - if p.currentMF = p.metricFamiliesByName[name]; p.currentMF != nil { - return - } - // Try out if this is a _sum or _count for a summary/histogram. - summaryName := summaryMetricName(name) - if p.currentMF = p.metricFamiliesByName[summaryName]; p.currentMF != nil { - if p.currentMF.GetType() == dto.MetricType_SUMMARY { - if isCount(name) { - p.currentIsSummaryCount = true - } - if isSum(name) { - p.currentIsSummarySum = true - } - return - } - } - histogramName := histogramMetricName(name) - if p.currentMF = p.metricFamiliesByName[histogramName]; p.currentMF != nil { - if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { - if isCount(name) { - p.currentIsHistogramCount = true - } - if isSum(name) { - p.currentIsHistogramSum = true - } - return - } - } - p.currentMF = &dto.MetricFamily{Name: proto.String(name)} - p.metricFamiliesByName[name] = p.currentMF -} - -func isValidLabelNameStart(b byte) bool { - return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' -} - -func isValidLabelNameContinuation(b byte) bool { - return isValidLabelNameStart(b) || (b >= '0' && b <= '9') -} - -func isValidMetricNameStart(b byte) bool { - return isValidLabelNameStart(b) || b == ':' -} - -func isValidMetricNameContinuation(b byte) bool { - return isValidLabelNameContinuation(b) || b == ':' -} - -func isBlankOrTab(b byte) bool { - return b == ' ' || b == '\t' -} - -func isCount(name string) bool { - return len(name) > 6 && name[len(name)-6:] == "_count" -} - -func isSum(name string) bool { - return len(name) > 4 && name[len(name)-4:] == "_sum" -} - -func isBucket(name string) bool { - return len(name) > 7 && name[len(name)-7:] == "_bucket" -} - -func summaryMetricName(name string) string { - switch { - case isCount(name): - return name[:len(name)-6] - case isSum(name): - return name[:len(name)-4] - default: - return name - } -} - -func histogramMetricName(name string) string { - switch { - case isCount(name): - return name[:len(name)-6] - case isSum(name): - return name[:len(name)-4] - case isBucket(name): - return name[:len(name)-7] - default: - return name - } -} diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse_test.go b/vendor/github.com/prometheus/common/expfmt/text_parse_test.go deleted file mode 100644 index 76c951185..000000000 --- a/vendor/github.com/prometheus/common/expfmt/text_parse_test.go +++ /dev/null @@ -1,593 +0,0 @@ -// Copyright 2014 The Prometheus 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 expfmt - -import ( - "math" - "strings" - "testing" - - "github.com/golang/protobuf/proto" - dto "github.com/prometheus/client_model/go" -) - -func testTextParse(t testing.TB) { - var scenarios = []struct { - in string - out []*dto.MetricFamily - }{ - // 0: Empty lines as input. - { - in: ` - -`, - out: []*dto.MetricFamily{}, - }, - // 1: Minimal case. - { - in: ` -minimal_metric 1.234 -another_metric -3e3 103948 -# Even that: -no_labels{} 3 -# HELP line for non-existing metric will be ignored. -`, - out: []*dto.MetricFamily{ - &dto.MetricFamily{ - Name: proto.String("minimal_metric"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(1.234), - }, - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("another_metric"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(-3e3), - }, - TimestampMs: proto.Int64(103948), - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("no_labels"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(3), - }, - }, - }, - }, - }, - }, - // 2: Counters & gauges, docstrings, various whitespace, escape sequences. - { - in: ` -# A normal comment. -# -# TYPE name counter -name{labelname="val1",basename="basevalue"} NaN -name {labelname="val2",basename="base\"v\\al\nue"} 0.23 1234567890 -# HELP name two-line\n doc str\\ing - - # HELP name2 doc str"ing 2 - # TYPE name2 gauge -name2{labelname="val2" ,basename = "basevalue2" } +Inf 54321 -name2{ labelname = "val1" , }-Inf -`, - out: []*dto.MetricFamily{ - &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("two-line\n doc str\\ing"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val1"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("basevalue"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(math.NaN()), - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("base\"v\\al\nue"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(.23), - }, - TimestampMs: proto.Int64(1234567890), - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("name2"), - Help: proto.String("doc str\"ing 2"), - Type: dto.MetricType_GAUGE.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("basevalue2"), - }, - }, - Gauge: &dto.Gauge{ - Value: proto.Float64(math.Inf(+1)), - }, - TimestampMs: proto.Int64(54321), - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val1"), - }, - }, - Gauge: &dto.Gauge{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - }, - }, - }, - }, - // 3: The evil summary, mixed with other types and funny comments. - { - in: ` -# TYPE my_summary summary -my_summary{n1="val1",quantile="0.5"} 110 -decoy -1 -2 -my_summary{n1="val1",quantile="0.9"} 140 1 -my_summary_count{n1="val1"} 42 -# Latest timestamp wins in case of a summary. -my_summary_sum{n1="val1"} 4711 2 -fake_sum{n1="val1"} 2001 -# TYPE another_summary summary -another_summary_count{n2="val2",n1="val1"} 20 -my_summary_count{n2="val2",n1="val1"} 5 5 -another_summary{n1="val1",n2="val2",quantile=".3"} -1.2 -my_summary_sum{n1="val2"} 08 15 -my_summary{n1="val3", quantile="0.2"} 4711 - my_summary{n1="val1",n2="val2",quantile="-12.34",} NaN -# some -# funny comments -# HELP -# HELP -# HELP my_summary -# HELP my_summary -`, - out: []*dto.MetricFamily{ - &dto.MetricFamily{ - Name: proto.String("fake_sum"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val1"), - }, - }, - Untyped: &dto.Untyped{ - Value: proto.Float64(2001), - }, - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("decoy"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(-1), - }, - TimestampMs: proto.Int64(-2), - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("my_summary"), - Type: dto.MetricType_SUMMARY.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val1"), - }, - }, - Summary: &dto.Summary{ - SampleCount: proto.Uint64(42), - SampleSum: proto.Float64(4711), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.5), - Value: proto.Float64(110), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.9), - Value: proto.Float64(140), - }, - }, - }, - TimestampMs: proto.Int64(2), - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n2"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val1"), - }, - }, - Summary: &dto.Summary{ - SampleCount: proto.Uint64(5), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(-12.34), - Value: proto.Float64(math.NaN()), - }, - }, - }, - TimestampMs: proto.Int64(5), - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val2"), - }, - }, - Summary: &dto.Summary{ - SampleSum: proto.Float64(8), - }, - TimestampMs: proto.Int64(15), - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val3"), - }, - }, - Summary: &dto.Summary{ - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.2), - Value: proto.Float64(4711), - }, - }, - }, - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("another_summary"), - Type: dto.MetricType_SUMMARY.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n2"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val1"), - }, - }, - Summary: &dto.Summary{ - SampleCount: proto.Uint64(20), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.3), - Value: proto.Float64(-1.2), - }, - }, - }, - }, - }, - }, - }, - }, - // 4: The histogram. - { - in: ` -# HELP request_duration_microseconds The response latency. -# TYPE request_duration_microseconds histogram -request_duration_microseconds_bucket{le="100"} 123 -request_duration_microseconds_bucket{le="120"} 412 -request_duration_microseconds_bucket{le="144"} 592 -request_duration_microseconds_bucket{le="172.8"} 1524 -request_duration_microseconds_bucket{le="+Inf"} 2693 -request_duration_microseconds_sum 1.7560473e+06 -request_duration_microseconds_count 2693 -`, - out: []*dto.MetricFamily{ - { - Name: proto.String("request_duration_microseconds"), - Help: proto.String("The response latency."), - Type: dto.MetricType_HISTOGRAM.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Histogram: &dto.Histogram{ - SampleCount: proto.Uint64(2693), - SampleSum: proto.Float64(1756047.3), - Bucket: []*dto.Bucket{ - &dto.Bucket{ - UpperBound: proto.Float64(100), - CumulativeCount: proto.Uint64(123), - }, - &dto.Bucket{ - UpperBound: proto.Float64(120), - CumulativeCount: proto.Uint64(412), - }, - &dto.Bucket{ - UpperBound: proto.Float64(144), - CumulativeCount: proto.Uint64(592), - }, - &dto.Bucket{ - UpperBound: proto.Float64(172.8), - CumulativeCount: proto.Uint64(1524), - }, - &dto.Bucket{ - UpperBound: proto.Float64(math.Inf(+1)), - CumulativeCount: proto.Uint64(2693), - }, - }, - }, - }, - }, - }, - }, - }, - } - - for i, scenario := range scenarios { - out, err := parser.TextToMetricFamilies(strings.NewReader(scenario.in)) - if err != nil { - t.Errorf("%d. error: %s", i, err) - continue - } - if expected, got := len(scenario.out), len(out); expected != got { - t.Errorf( - "%d. expected %d MetricFamilies, got %d", - i, expected, got, - ) - } - for _, expected := range scenario.out { - got, ok := out[expected.GetName()] - if !ok { - t.Errorf( - "%d. expected MetricFamily %q, found none", - i, expected.GetName(), - ) - continue - } - if expected.String() != got.String() { - t.Errorf( - "%d. expected MetricFamily %s, got %s", - i, expected, got, - ) - } - } - } -} - -func TestTextParse(t *testing.T) { - testTextParse(t) -} - -func BenchmarkTextParse(b *testing.B) { - for i := 0; i < b.N; i++ { - testTextParse(b) - } -} - -func testTextParseError(t testing.TB) { - var scenarios = []struct { - in string - err string - }{ - // 0: No new-line at end of input. - { - in: ` -bla 3.14 -blubber 42`, - err: "text format parsing error in line 3: unexpected end of input stream", - }, - // 1: Invalid escape sequence in label value. - { - in: `metric{label="\t"} 3.14`, - err: "text format parsing error in line 1: invalid escape sequence", - }, - // 2: Newline in label value. - { - in: ` -metric{label="new -line"} 3.14 -`, - err: `text format parsing error in line 2: label value "new" contains unescaped new-line`, - }, - // 3: - { - in: `metric{@="bla"} 3.14`, - err: "text format parsing error in line 1: invalid label name for metric", - }, - // 4: - { - in: `metric{__name__="bla"} 3.14`, - err: `text format parsing error in line 1: label name "__name__" is reserved`, - }, - // 5: - { - in: `metric{label+="bla"} 3.14`, - err: "text format parsing error in line 1: expected '=' after label name", - }, - // 6: - { - in: `metric{label=bla} 3.14`, - err: "text format parsing error in line 1: expected '\"' at start of label value", - }, - // 7: - { - in: ` -# TYPE metric summary -metric{quantile="bla"} 3.14 -`, - err: "text format parsing error in line 3: expected float as value for 'quantile' label", - }, - // 8: - { - in: `metric{label="bla"+} 3.14`, - err: "text format parsing error in line 1: unexpected end of label value", - }, - // 9: - { - in: `metric{label="bla"} 3.14 2.72 -`, - err: "text format parsing error in line 1: expected integer as timestamp", - }, - // 10: - { - in: `metric{label="bla"} 3.14 2 3 -`, - err: "text format parsing error in line 1: spurious string after timestamp", - }, - // 11: - { - in: `metric{label="bla"} blubb -`, - err: "text format parsing error in line 1: expected float as value", - }, - // 12: - { - in: ` -# HELP metric one -# HELP metric two -`, - err: "text format parsing error in line 3: second HELP line for metric name", - }, - // 13: - { - in: ` -# TYPE metric counter -# TYPE metric untyped -`, - err: `text format parsing error in line 3: second TYPE line for metric name "metric", or TYPE reported after samples`, - }, - // 14: - { - in: ` -metric 4.12 -# TYPE metric counter -`, - err: `text format parsing error in line 3: second TYPE line for metric name "metric", or TYPE reported after samples`, - }, - // 14: - { - in: ` -# TYPE metric bla -`, - err: "text format parsing error in line 2: unknown metric type", - }, - // 15: - { - in: ` -# TYPE met-ric -`, - err: "text format parsing error in line 2: invalid metric name in comment", - }, - // 16: - { - in: `@invalidmetric{label="bla"} 3.14 2`, - err: "text format parsing error in line 1: invalid metric name", - }, - // 17: - { - in: `{label="bla"} 3.14 2`, - err: "text format parsing error in line 1: invalid metric name", - }, - // 18: - { - in: ` -# TYPE metric histogram -metric_bucket{le="bla"} 3.14 -`, - err: "text format parsing error in line 3: expected float as value for 'le' label", - }, - // 19: Invalid UTF-8 in label value. - { - in: "metric{l=\"\xbd\"} 3.14\n", - err: "text format parsing error in line 1: invalid label value \"\\xbd\"", - }, - } - - for i, scenario := range scenarios { - _, err := parser.TextToMetricFamilies(strings.NewReader(scenario.in)) - if err == nil { - t.Errorf("%d. expected error, got nil", i) - continue - } - if expected, got := scenario.err, err.Error(); strings.Index(got, expected) != 0 { - t.Errorf( - "%d. expected error starting with %q, got %q", - i, expected, got, - ) - } - } - -} - -func TestTextParseError(t *testing.T) { - testTextParseError(t) -} - -func BenchmarkParseError(b *testing.B) { - for i := 0; i < b.N; i++ { - testTextParseError(b) - } -} diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt deleted file mode 100644 index 7723656d5..000000000 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt +++ /dev/null @@ -1,67 +0,0 @@ -PACKAGE - -package goautoneg -import "bitbucket.org/ww/goautoneg" - -HTTP Content-Type Autonegotiation. - -The functions in this package implement the behaviour specified in -http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - -Copyright (c) 2011, Open Knowledge Foundation Ltd. -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 the Open Knowledge Foundation Ltd. nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -FUNCTIONS - -func Negotiate(header string, alternatives []string) (content_type string) -Negotiate the most appropriate content_type given the accept header -and a list of alternatives. - -func ParseAccept(header string) (accept []Accept) -Parse an Accept Header string returning a sorted list -of clauses - - -TYPES - -type Accept struct { - Type, SubType string - Q float32 - Params map[string]string -} -Structure to represent a clause in an HTTP Accept Header - - -SUBDIRECTORIES - - .hg diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go deleted file mode 100644 index 648b38cb6..000000000 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go +++ /dev/null @@ -1,162 +0,0 @@ -/* -HTTP Content-Type Autonegotiation. - -The functions in this package implement the behaviour specified in -http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - -Copyright (c) 2011, Open Knowledge Foundation Ltd. -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 the Open Knowledge Foundation Ltd. nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ -package goautoneg - -import ( - "sort" - "strconv" - "strings" -) - -// Structure to represent a clause in an HTTP Accept Header -type Accept struct { - Type, SubType string - Q float64 - Params map[string]string -} - -// For internal use, so that we can use the sort interface -type accept_slice []Accept - -func (accept accept_slice) Len() int { - slice := []Accept(accept) - return len(slice) -} - -func (accept accept_slice) Less(i, j int) bool { - slice := []Accept(accept) - ai, aj := slice[i], slice[j] - if ai.Q > aj.Q { - return true - } - if ai.Type != "*" && aj.Type == "*" { - return true - } - if ai.SubType != "*" && aj.SubType == "*" { - return true - } - return false -} - -func (accept accept_slice) Swap(i, j int) { - slice := []Accept(accept) - slice[i], slice[j] = slice[j], slice[i] -} - -// Parse an Accept Header string returning a sorted list -// of clauses -func ParseAccept(header string) (accept []Accept) { - parts := strings.Split(header, ",") - accept = make([]Accept, 0, len(parts)) - for _, part := range parts { - part := strings.Trim(part, " ") - - a := Accept{} - a.Params = make(map[string]string) - a.Q = 1.0 - - mrp := strings.Split(part, ";") - - media_range := mrp[0] - sp := strings.Split(media_range, "/") - a.Type = strings.Trim(sp[0], " ") - - switch { - case len(sp) == 1 && a.Type == "*": - a.SubType = "*" - case len(sp) == 2: - a.SubType = strings.Trim(sp[1], " ") - default: - continue - } - - if len(mrp) == 1 { - accept = append(accept, a) - continue - } - - for _, param := range mrp[1:] { - sp := strings.SplitN(param, "=", 2) - if len(sp) != 2 { - continue - } - token := strings.Trim(sp[0], " ") - if token == "q" { - a.Q, _ = strconv.ParseFloat(sp[1], 32) - } else { - a.Params[token] = strings.Trim(sp[1], " ") - } - } - - accept = append(accept, a) - } - - slice := accept_slice(accept) - sort.Sort(slice) - - return -} - -// Negotiate the most appropriate content_type given the accept header -// and a list of alternatives. -func Negotiate(header string, alternatives []string) (content_type string) { - asp := make([][]string, 0, len(alternatives)) - for _, ctype := range alternatives { - asp = append(asp, strings.SplitN(ctype, "/", 2)) - } - for _, clause := range ParseAccept(header) { - for i, ctsp := range asp { - if clause.Type == ctsp[0] && clause.SubType == ctsp[1] { - content_type = alternatives[i] - return - } - if clause.Type == ctsp[0] && clause.SubType == "*" { - content_type = alternatives[i] - return - } - if clause.Type == "*" && clause.SubType == "*" { - content_type = alternatives[i] - return - } - } - } - return -} diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go deleted file mode 100644 index 41d328f1d..000000000 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package goautoneg - -import ( - "testing" -) - -var chrome = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" - -func TestParseAccept(t *testing.T) { - alternatives := []string{"text/html", "image/png"} - content_type := Negotiate(chrome, alternatives) - if content_type != "image/png" { - t.Errorf("got %s expected image/png", content_type) - } - - alternatives = []string{"text/html", "text/plain", "text/n3"} - content_type = Negotiate(chrome, alternatives) - if content_type != "text/html" { - t.Errorf("got %s expected text/html", content_type) - } - - alternatives = []string{"text/n3", "text/plain"} - content_type = Negotiate(chrome, alternatives) - if content_type != "text/plain" { - t.Errorf("got %s expected text/plain", content_type) - } - - alternatives = []string{"text/n3", "application/rdf+xml"} - content_type = Negotiate(chrome, alternatives) - if content_type != "text/n3" { - t.Errorf("got %s expected text/n3", content_type) - } -} diff --git a/vendor/github.com/prometheus/common/log/eventlog_formatter.go b/vendor/github.com/prometheus/common/log/eventlog_formatter.go deleted file mode 100644 index bcf68e6f2..000000000 --- a/vendor/github.com/prometheus/common/log/eventlog_formatter.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2015 The Prometheus 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. - -// +build windows - -package log - -import ( - "fmt" - "os" - - "golang.org/x/sys/windows/svc/eventlog" - - "github.com/sirupsen/logrus" -) - -func init() { - setEventlogFormatter = func(l logger, name string, debugAsInfo bool) error { - if name == "" { - return fmt.Errorf("missing name parameter") - } - - fmter, err := newEventlogger(name, debugAsInfo, l.entry.Logger.Formatter) - if err != nil { - fmt.Fprintf(os.Stderr, "error creating eventlog formatter: %v\n", err) - l.Errorf("can't connect logger to eventlog: %v", err) - return err - } - l.entry.Logger.Formatter = fmter - return nil - } -} - -type eventlogger struct { - log *eventlog.Log - debugAsInfo bool - wrap logrus.Formatter -} - -func newEventlogger(name string, debugAsInfo bool, fmter logrus.Formatter) (*eventlogger, error) { - logHandle, err := eventlog.Open(name) - if err != nil { - return nil, err - } - return &eventlogger{log: logHandle, debugAsInfo: debugAsInfo, wrap: fmter}, nil -} - -func (s *eventlogger) Format(e *logrus.Entry) ([]byte, error) { - data, err := s.wrap.Format(e) - if err != nil { - fmt.Fprintf(os.Stderr, "eventlogger: can't format entry: %v\n", err) - return data, err - } - - switch e.Level { - case logrus.PanicLevel: - fallthrough - case logrus.FatalLevel: - fallthrough - case logrus.ErrorLevel: - err = s.log.Error(102, e.Message) - case logrus.WarnLevel: - err = s.log.Warning(101, e.Message) - case logrus.InfoLevel: - err = s.log.Info(100, e.Message) - case logrus.DebugLevel: - if s.debugAsInfo { - err = s.log.Info(100, e.Message) - } - default: - err = s.log.Info(100, e.Message) - } - - if err != nil { - fmt.Fprintf(os.Stderr, "eventlogger: can't send log to eventlog: %v\n", err) - } - - return data, err -} diff --git a/vendor/github.com/prometheus/common/log/log.go b/vendor/github.com/prometheus/common/log/log.go deleted file mode 100644 index 108830255..000000000 --- a/vendor/github.com/prometheus/common/log/log.go +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright 2015 The Prometheus 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 log - -import ( - "fmt" - "io" - "io/ioutil" - "log" - "net/url" - "os" - "runtime" - "strconv" - "strings" - - "github.com/sirupsen/logrus" - "gopkg.in/alecthomas/kingpin.v2" -) - -// setSyslogFormatter is nil if the target architecture does not support syslog. -var setSyslogFormatter func(logger, string, string) error - -// setEventlogFormatter is nil if the target OS does not support Eventlog (i.e., is not Windows). -var setEventlogFormatter func(logger, string, bool) error - -func setJSONFormatter() { - origLogger.Formatter = &logrus.JSONFormatter{} -} - -type loggerSettings struct { - level string - format string -} - -func (s *loggerSettings) apply(ctx *kingpin.ParseContext) error { - err := baseLogger.SetLevel(s.level) - if err != nil { - return err - } - err = baseLogger.SetFormat(s.format) - return err -} - -// AddFlags adds the flags used by this package to the Kingpin application. -// To use the default Kingpin application, call AddFlags(kingpin.CommandLine) -func AddFlags(a *kingpin.Application) { - s := loggerSettings{} - a.Flag("log.level", "Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]"). - Default(origLogger.Level.String()). - StringVar(&s.level) - defaultFormat := url.URL{Scheme: "logger", Opaque: "stderr"} - a.Flag("log.format", `Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"`). - Default(defaultFormat.String()). - StringVar(&s.format) - a.Action(s.apply) -} - -// Logger is the interface for loggers used in the Prometheus components. -type Logger interface { - Debug(...interface{}) - Debugln(...interface{}) - Debugf(string, ...interface{}) - - Info(...interface{}) - Infoln(...interface{}) - Infof(string, ...interface{}) - - Warn(...interface{}) - Warnln(...interface{}) - Warnf(string, ...interface{}) - - Error(...interface{}) - Errorln(...interface{}) - Errorf(string, ...interface{}) - - Fatal(...interface{}) - Fatalln(...interface{}) - Fatalf(string, ...interface{}) - - With(key string, value interface{}) Logger - - SetFormat(string) error - SetLevel(string) error -} - -type logger struct { - entry *logrus.Entry -} - -func (l logger) With(key string, value interface{}) Logger { - return logger{l.entry.WithField(key, value)} -} - -// Debug logs a message at level Debug on the standard logger. -func (l logger) Debug(args ...interface{}) { - l.sourced().Debug(args...) -} - -// Debug logs a message at level Debug on the standard logger. -func (l logger) Debugln(args ...interface{}) { - l.sourced().Debugln(args...) -} - -// Debugf logs a message at level Debug on the standard logger. -func (l logger) Debugf(format string, args ...interface{}) { - l.sourced().Debugf(format, args...) -} - -// Info logs a message at level Info on the standard logger. -func (l logger) Info(args ...interface{}) { - l.sourced().Info(args...) -} - -// Info logs a message at level Info on the standard logger. -func (l logger) Infoln(args ...interface{}) { - l.sourced().Infoln(args...) -} - -// Infof logs a message at level Info on the standard logger. -func (l logger) Infof(format string, args ...interface{}) { - l.sourced().Infof(format, args...) -} - -// Warn logs a message at level Warn on the standard logger. -func (l logger) Warn(args ...interface{}) { - l.sourced().Warn(args...) -} - -// Warn logs a message at level Warn on the standard logger. -func (l logger) Warnln(args ...interface{}) { - l.sourced().Warnln(args...) -} - -// Warnf logs a message at level Warn on the standard logger. -func (l logger) Warnf(format string, args ...interface{}) { - l.sourced().Warnf(format, args...) -} - -// Error logs a message at level Error on the standard logger. -func (l logger) Error(args ...interface{}) { - l.sourced().Error(args...) -} - -// Error logs a message at level Error on the standard logger. -func (l logger) Errorln(args ...interface{}) { - l.sourced().Errorln(args...) -} - -// Errorf logs a message at level Error on the standard logger. -func (l logger) Errorf(format string, args ...interface{}) { - l.sourced().Errorf(format, args...) -} - -// Fatal logs a message at level Fatal on the standard logger. -func (l logger) Fatal(args ...interface{}) { - l.sourced().Fatal(args...) -} - -// Fatal logs a message at level Fatal on the standard logger. -func (l logger) Fatalln(args ...interface{}) { - l.sourced().Fatalln(args...) -} - -// Fatalf logs a message at level Fatal on the standard logger. -func (l logger) Fatalf(format string, args ...interface{}) { - l.sourced().Fatalf(format, args...) -} - -func (l logger) SetLevel(level string) error { - lvl, err := logrus.ParseLevel(level) - if err != nil { - return err - } - - l.entry.Logger.Level = lvl - return nil -} - -func (l logger) SetFormat(format string) error { - u, err := url.Parse(format) - if err != nil { - return err - } - if u.Scheme != "logger" { - return fmt.Errorf("invalid scheme %s", u.Scheme) - } - jsonq := u.Query().Get("json") - if jsonq == "true" { - setJSONFormatter() - } - - switch u.Opaque { - case "syslog": - if setSyslogFormatter == nil { - return fmt.Errorf("system does not support syslog") - } - appname := u.Query().Get("appname") - facility := u.Query().Get("local") - return setSyslogFormatter(l, appname, facility) - case "eventlog": - if setEventlogFormatter == nil { - return fmt.Errorf("system does not support eventlog") - } - name := u.Query().Get("name") - debugAsInfo := false - debugAsInfoRaw := u.Query().Get("debugAsInfo") - if parsedDebugAsInfo, err := strconv.ParseBool(debugAsInfoRaw); err == nil { - debugAsInfo = parsedDebugAsInfo - } - return setEventlogFormatter(l, name, debugAsInfo) - case "stdout": - l.entry.Logger.Out = os.Stdout - case "stderr": - l.entry.Logger.Out = os.Stderr - default: - return fmt.Errorf("unsupported logger %q", u.Opaque) - } - return nil -} - -// sourced adds a source field to the logger that contains -// the file name and line where the logging happened. -func (l logger) sourced() *logrus.Entry { - _, file, line, ok := runtime.Caller(2) - if !ok { - file = "" - line = 1 - } else { - slash := strings.LastIndex(file, "/") - file = file[slash+1:] - } - return l.entry.WithField("source", fmt.Sprintf("%s:%d", file, line)) -} - -var origLogger = logrus.New() -var baseLogger = logger{entry: logrus.NewEntry(origLogger)} - -// Base returns the default Logger logging to -func Base() Logger { - return baseLogger -} - -// NewLogger returns a new Logger logging to out. -func NewLogger(w io.Writer) Logger { - l := logrus.New() - l.Out = w - return logger{entry: logrus.NewEntry(l)} -} - -// NewNopLogger returns a logger that discards all log messages. -func NewNopLogger() Logger { - l := logrus.New() - l.Out = ioutil.Discard - return logger{entry: logrus.NewEntry(l)} -} - -// With adds a field to the logger. -func With(key string, value interface{}) Logger { - return baseLogger.With(key, value) -} - -// Debug logs a message at level Debug on the standard logger. -func Debug(args ...interface{}) { - baseLogger.sourced().Debug(args...) -} - -// Debugln logs a message at level Debug on the standard logger. -func Debugln(args ...interface{}) { - baseLogger.sourced().Debugln(args...) -} - -// Debugf logs a message at level Debug on the standard logger. -func Debugf(format string, args ...interface{}) { - baseLogger.sourced().Debugf(format, args...) -} - -// Info logs a message at level Info on the standard logger. -func Info(args ...interface{}) { - baseLogger.sourced().Info(args...) -} - -// Infoln logs a message at level Info on the standard logger. -func Infoln(args ...interface{}) { - baseLogger.sourced().Infoln(args...) -} - -// Infof logs a message at level Info on the standard logger. -func Infof(format string, args ...interface{}) { - baseLogger.sourced().Infof(format, args...) -} - -// Warn logs a message at level Warn on the standard logger. -func Warn(args ...interface{}) { - baseLogger.sourced().Warn(args...) -} - -// Warnln logs a message at level Warn on the standard logger. -func Warnln(args ...interface{}) { - baseLogger.sourced().Warnln(args...) -} - -// Warnf logs a message at level Warn on the standard logger. -func Warnf(format string, args ...interface{}) { - baseLogger.sourced().Warnf(format, args...) -} - -// Error logs a message at level Error on the standard logger. -func Error(args ...interface{}) { - baseLogger.sourced().Error(args...) -} - -// Errorln logs a message at level Error on the standard logger. -func Errorln(args ...interface{}) { - baseLogger.sourced().Errorln(args...) -} - -// Errorf logs a message at level Error on the standard logger. -func Errorf(format string, args ...interface{}) { - baseLogger.sourced().Errorf(format, args...) -} - -// Fatal logs a message at level Fatal on the standard logger. -func Fatal(args ...interface{}) { - baseLogger.sourced().Fatal(args...) -} - -// Fatalln logs a message at level Fatal on the standard logger. -func Fatalln(args ...interface{}) { - baseLogger.sourced().Fatalln(args...) -} - -// Fatalf logs a message at level Fatal on the standard logger. -func Fatalf(format string, args ...interface{}) { - baseLogger.sourced().Fatalf(format, args...) -} - -// AddHook adds hook to Prometheus' original logger. -func AddHook(hook logrus.Hook) { - origLogger.Hooks.Add(hook) -} - -type errorLogWriter struct{} - -func (errorLogWriter) Write(b []byte) (int, error) { - baseLogger.sourced().Error(string(b)) - return len(b), nil -} - -// NewErrorLogger returns a log.Logger that is meant to be used -// in the ErrorLog field of an http.Server to log HTTP server errors. -func NewErrorLogger() *log.Logger { - return log.New(&errorLogWriter{}, "", 0) -} diff --git a/vendor/github.com/prometheus/common/log/log_test.go b/vendor/github.com/prometheus/common/log/log_test.go deleted file mode 100644 index f63b4417f..000000000 --- a/vendor/github.com/prometheus/common/log/log_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Prometheus 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 log - -import ( - "bytes" - "regexp" - "testing" - - "github.com/sirupsen/logrus" -) - -func TestFileLineLogging(t *testing.T) { - var buf bytes.Buffer - origLogger.Out = &buf - origLogger.Formatter = &logrus.TextFormatter{ - DisableColors: true, - } - - // The default logging level should be "info". - Debug("This debug-level line should not show up in the output.") - Infof("This %s-level line should show up in the output.", "info") - - re := `^time=".*" level=info msg="This info-level line should show up in the output." source="log_test.go:33"\n$` - if !regexp.MustCompile(re).Match(buf.Bytes()) { - t.Fatalf("%q did not match expected regex %q", buf.String(), re) - } -} diff --git a/vendor/github.com/prometheus/common/log/syslog_formatter.go b/vendor/github.com/prometheus/common/log/syslog_formatter.go deleted file mode 100644 index f882f2f84..000000000 --- a/vendor/github.com/prometheus/common/log/syslog_formatter.go +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2015 The Prometheus 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. - -// +build !windows,!nacl,!plan9 - -package log - -import ( - "fmt" - "log/syslog" - "os" - - "github.com/sirupsen/logrus" -) - -var _ logrus.Formatter = (*syslogger)(nil) - -func init() { - setSyslogFormatter = func(l logger, appname, local string) error { - if appname == "" { - return fmt.Errorf("missing appname parameter") - } - if local == "" { - return fmt.Errorf("missing local parameter") - } - - fmter, err := newSyslogger(appname, local, l.entry.Logger.Formatter) - if err != nil { - fmt.Fprintf(os.Stderr, "error creating syslog formatter: %v\n", err) - l.entry.Errorf("can't connect logger to syslog: %v", err) - return err - } - l.entry.Logger.Formatter = fmter - return nil - } -} - -var prefixTag []byte - -type syslogger struct { - wrap logrus.Formatter - out *syslog.Writer -} - -func newSyslogger(appname string, facility string, fmter logrus.Formatter) (*syslogger, error) { - priority, err := getFacility(facility) - if err != nil { - return nil, err - } - out, err := syslog.New(priority, appname) - _, isJSON := fmter.(*logrus.JSONFormatter) - if isJSON { - // add cee tag to json formatted syslogs - prefixTag = []byte("@cee:") - } - return &syslogger{ - out: out, - wrap: fmter, - }, err -} - -func getFacility(facility string) (syslog.Priority, error) { - switch facility { - case "0": - return syslog.LOG_LOCAL0, nil - case "1": - return syslog.LOG_LOCAL1, nil - case "2": - return syslog.LOG_LOCAL2, nil - case "3": - return syslog.LOG_LOCAL3, nil - case "4": - return syslog.LOG_LOCAL4, nil - case "5": - return syslog.LOG_LOCAL5, nil - case "6": - return syslog.LOG_LOCAL6, nil - case "7": - return syslog.LOG_LOCAL7, nil - } - return syslog.LOG_LOCAL0, fmt.Errorf("invalid local(%s) for syslog", facility) -} - -func (s *syslogger) Format(e *logrus.Entry) ([]byte, error) { - data, err := s.wrap.Format(e) - if err != nil { - fmt.Fprintf(os.Stderr, "syslogger: can't format entry: %v\n", err) - return data, err - } - // only append tag to data sent to syslog (line), not to what - // is returned - line := string(append(prefixTag, data...)) - - switch e.Level { - case logrus.PanicLevel: - err = s.out.Crit(line) - case logrus.FatalLevel: - err = s.out.Crit(line) - case logrus.ErrorLevel: - err = s.out.Err(line) - case logrus.WarnLevel: - err = s.out.Warning(line) - case logrus.InfoLevel: - err = s.out.Info(line) - case logrus.DebugLevel: - err = s.out.Debug(line) - default: - err = s.out.Notice(line) - } - - if err != nil { - fmt.Fprintf(os.Stderr, "syslogger: can't send log to syslog: %v\n", err) - } - - return data, err -} diff --git a/vendor/github.com/prometheus/common/log/syslog_formatter_test.go b/vendor/github.com/prometheus/common/log/syslog_formatter_test.go deleted file mode 100644 index b7e68848f..000000000 --- a/vendor/github.com/prometheus/common/log/syslog_formatter_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2015 The Prometheus 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. - -// +build !windows,!nacl,!plan9 - -package log - -import ( - "errors" - "log/syslog" - "testing" -) - -func TestGetFacility(t *testing.T) { - testCases := []struct { - facility string - expectedPriority syslog.Priority - expectedErr error - }{ - {"0", syslog.LOG_LOCAL0, nil}, - {"1", syslog.LOG_LOCAL1, nil}, - {"2", syslog.LOG_LOCAL2, nil}, - {"3", syslog.LOG_LOCAL3, nil}, - {"4", syslog.LOG_LOCAL4, nil}, - {"5", syslog.LOG_LOCAL5, nil}, - {"6", syslog.LOG_LOCAL6, nil}, - {"7", syslog.LOG_LOCAL7, nil}, - {"8", syslog.LOG_LOCAL0, errors.New("invalid local(8) for syslog")}, - } - for _, tc := range testCases { - priority, err := getFacility(tc.facility) - if err != tc.expectedErr { - if err.Error() != tc.expectedErr.Error() { - t.Errorf("want %s, got %s", tc.expectedErr.Error(), err.Error()) - } - } - - if priority != tc.expectedPriority { - t.Errorf("want %q, got %q", tc.expectedPriority, priority) - } - } -} diff --git a/vendor/github.com/prometheus/common/model/alert.go b/vendor/github.com/prometheus/common/model/alert.go deleted file mode 100644 index 35e739c7a..000000000 --- a/vendor/github.com/prometheus/common/model/alert.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "fmt" - "time" -) - -type AlertStatus string - -const ( - AlertFiring AlertStatus = "firing" - AlertResolved AlertStatus = "resolved" -) - -// Alert is a generic representation of an alert in the Prometheus eco-system. -type Alert struct { - // Label value pairs for purpose of aggregation, matching, and disposition - // dispatching. This must minimally include an "alertname" label. - Labels LabelSet `json:"labels"` - - // Extra key/value information which does not define alert identity. - Annotations LabelSet `json:"annotations"` - - // The known time range for this alert. Both ends are optional. - StartsAt time.Time `json:"startsAt,omitempty"` - EndsAt time.Time `json:"endsAt,omitempty"` - GeneratorURL string `json:"generatorURL"` -} - -// Name returns the name of the alert. It is equivalent to the "alertname" label. -func (a *Alert) Name() string { - return string(a.Labels[AlertNameLabel]) -} - -// Fingerprint returns a unique hash for the alert. It is equivalent to -// the fingerprint of the alert's label set. -func (a *Alert) Fingerprint() Fingerprint { - return a.Labels.Fingerprint() -} - -func (a *Alert) String() string { - s := fmt.Sprintf("%s[%s]", a.Name(), a.Fingerprint().String()[:7]) - if a.Resolved() { - return s + "[resolved]" - } - return s + "[active]" -} - -// Resolved returns true iff the activity interval ended in the past. -func (a *Alert) Resolved() bool { - return a.ResolvedAt(time.Now()) -} - -// ResolvedAt returns true off the activity interval ended before -// the given timestamp. -func (a *Alert) ResolvedAt(ts time.Time) bool { - if a.EndsAt.IsZero() { - return false - } - return !a.EndsAt.After(ts) -} - -// Status returns the status of the alert. -func (a *Alert) Status() AlertStatus { - if a.Resolved() { - return AlertResolved - } - return AlertFiring -} - -// Validate checks whether the alert data is inconsistent. -func (a *Alert) Validate() error { - if a.StartsAt.IsZero() { - return fmt.Errorf("start time missing") - } - if !a.EndsAt.IsZero() && a.EndsAt.Before(a.StartsAt) { - return fmt.Errorf("start time must be before end time") - } - if err := a.Labels.Validate(); err != nil { - return fmt.Errorf("invalid label set: %s", err) - } - if len(a.Labels) == 0 { - return fmt.Errorf("at least one label pair required") - } - if err := a.Annotations.Validate(); err != nil { - return fmt.Errorf("invalid annotations: %s", err) - } - return nil -} - -// Alert is a list of alerts that can be sorted in chronological order. -type Alerts []*Alert - -func (as Alerts) Len() int { return len(as) } -func (as Alerts) Swap(i, j int) { as[i], as[j] = as[j], as[i] } - -func (as Alerts) Less(i, j int) bool { - if as[i].StartsAt.Before(as[j].StartsAt) { - return true - } - if as[i].EndsAt.Before(as[j].EndsAt) { - return true - } - return as[i].Fingerprint() < as[j].Fingerprint() -} - -// HasFiring returns true iff one of the alerts is not resolved. -func (as Alerts) HasFiring() bool { - for _, a := range as { - if !a.Resolved() { - return true - } - } - return false -} - -// Status returns StatusFiring iff at least one of the alerts is firing. -func (as Alerts) Status() AlertStatus { - if as.HasFiring() { - return AlertFiring - } - return AlertResolved -} diff --git a/vendor/github.com/prometheus/common/model/alert_test.go b/vendor/github.com/prometheus/common/model/alert_test.go deleted file mode 100644 index 9692bca21..000000000 --- a/vendor/github.com/prometheus/common/model/alert_test.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "strings" - "testing" - "time" -) - -func TestAlertValidate(t *testing.T) { - ts := time.Now() - - var cases = []struct { - alert *Alert - err string - }{ - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - StartsAt: ts, - }, - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - }, - err: "start time missing", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - StartsAt: ts, - EndsAt: ts, - }, - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - StartsAt: ts, - EndsAt: ts.Add(1 * time.Minute), - }, - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - StartsAt: ts, - EndsAt: ts.Add(-1 * time.Minute), - }, - err: "start time must be before end time", - }, - { - alert: &Alert{ - StartsAt: ts, - }, - err: "at least one label pair required", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b", "!bad": "label"}, - StartsAt: ts, - }, - err: "invalid label set: invalid name", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b", "bad": "\xfflabel"}, - StartsAt: ts, - }, - err: "invalid label set: invalid value", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - Annotations: LabelSet{"!bad": "label"}, - StartsAt: ts, - }, - err: "invalid annotations: invalid name", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - Annotations: LabelSet{"bad": "\xfflabel"}, - StartsAt: ts, - }, - err: "invalid annotations: invalid value", - }, - } - - for i, c := range cases { - err := c.alert.Validate() - if err == nil { - if c.err == "" { - continue - } - t.Errorf("%d. Expected error %q but got none", i, c.err) - continue - } - if c.err == "" && err != nil { - t.Errorf("%d. Expected no error but got %q", i, err) - continue - } - if !strings.Contains(err.Error(), c.err) { - t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err) - } - } -} diff --git a/vendor/github.com/prometheus/common/model/fingerprinting.go b/vendor/github.com/prometheus/common/model/fingerprinting.go deleted file mode 100644 index fc4de4106..000000000 --- a/vendor/github.com/prometheus/common/model/fingerprinting.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "fmt" - "strconv" -) - -// Fingerprint provides a hash-capable representation of a Metric. -// For our purposes, FNV-1A 64-bit is used. -type Fingerprint uint64 - -// FingerprintFromString transforms a string representation into a Fingerprint. -func FingerprintFromString(s string) (Fingerprint, error) { - num, err := strconv.ParseUint(s, 16, 64) - return Fingerprint(num), err -} - -// ParseFingerprint parses the input string into a fingerprint. -func ParseFingerprint(s string) (Fingerprint, error) { - num, err := strconv.ParseUint(s, 16, 64) - if err != nil { - return 0, err - } - return Fingerprint(num), nil -} - -func (f Fingerprint) String() string { - return fmt.Sprintf("%016x", uint64(f)) -} - -// Fingerprints represents a collection of Fingerprint subject to a given -// natural sorting scheme. It implements sort.Interface. -type Fingerprints []Fingerprint - -// Len implements sort.Interface. -func (f Fingerprints) Len() int { - return len(f) -} - -// Less implements sort.Interface. -func (f Fingerprints) Less(i, j int) bool { - return f[i] < f[j] -} - -// Swap implements sort.Interface. -func (f Fingerprints) Swap(i, j int) { - f[i], f[j] = f[j], f[i] -} - -// FingerprintSet is a set of Fingerprints. -type FingerprintSet map[Fingerprint]struct{} - -// Equal returns true if both sets contain the same elements (and not more). -func (s FingerprintSet) Equal(o FingerprintSet) bool { - if len(s) != len(o) { - return false - } - - for k := range s { - if _, ok := o[k]; !ok { - return false - } - } - - return true -} - -// Intersection returns the elements contained in both sets. -func (s FingerprintSet) Intersection(o FingerprintSet) FingerprintSet { - myLength, otherLength := len(s), len(o) - if myLength == 0 || otherLength == 0 { - return FingerprintSet{} - } - - subSet := s - superSet := o - - if otherLength < myLength { - subSet = o - superSet = s - } - - out := FingerprintSet{} - - for k := range subSet { - if _, ok := superSet[k]; ok { - out[k] = struct{}{} - } - } - - return out -} diff --git a/vendor/github.com/prometheus/common/model/fnv.go b/vendor/github.com/prometheus/common/model/fnv.go deleted file mode 100644 index 038fc1c90..000000000 --- a/vendor/github.com/prometheus/common/model/fnv.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Prometheus 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 model - -// Inline and byte-free variant of hash/fnv's fnv64a. - -const ( - offset64 = 14695981039346656037 - prime64 = 1099511628211 -) - -// hashNew initializies a new fnv64a hash value. -func hashNew() uint64 { - return offset64 -} - -// hashAdd adds a string to a fnv64a hash value, returning the updated hash. -func hashAdd(h uint64, s string) uint64 { - for i := 0; i < len(s); i++ { - h ^= uint64(s[i]) - h *= prime64 - } - return h -} - -// hashAddByte adds a byte to a fnv64a hash value, returning the updated hash. -func hashAddByte(h uint64, b byte) uint64 { - h ^= uint64(b) - h *= prime64 - return h -} diff --git a/vendor/github.com/prometheus/common/model/labels.go b/vendor/github.com/prometheus/common/model/labels.go deleted file mode 100644 index 41051a01a..000000000 --- a/vendor/github.com/prometheus/common/model/labels.go +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "encoding/json" - "fmt" - "regexp" - "strings" - "unicode/utf8" -) - -const ( - // AlertNameLabel is the name of the label containing the an alert's name. - AlertNameLabel = "alertname" - - // ExportedLabelPrefix is the prefix to prepend to the label names present in - // exported metrics if a label of the same name is added by the server. - ExportedLabelPrefix = "exported_" - - // MetricNameLabel is the label name indicating the metric name of a - // timeseries. - MetricNameLabel = "__name__" - - // SchemeLabel is the name of the label that holds the scheme on which to - // scrape a target. - SchemeLabel = "__scheme__" - - // AddressLabel is the name of the label that holds the address of - // a scrape target. - AddressLabel = "__address__" - - // MetricsPathLabel is the name of the label that holds the path on which to - // scrape a target. - MetricsPathLabel = "__metrics_path__" - - // ReservedLabelPrefix is a prefix which is not legal in user-supplied - // label names. - ReservedLabelPrefix = "__" - - // MetaLabelPrefix is a prefix for labels that provide meta information. - // Labels with this prefix are used for intermediate label processing and - // will not be attached to time series. - MetaLabelPrefix = "__meta_" - - // TmpLabelPrefix is a prefix for temporary labels as part of relabelling. - // Labels with this prefix are used for intermediate label processing and - // will not be attached to time series. This is reserved for use in - // Prometheus configuration files by users. - TmpLabelPrefix = "__tmp_" - - // ParamLabelPrefix is a prefix for labels that provide URL parameters - // used to scrape a target. - ParamLabelPrefix = "__param_" - - // JobLabel is the label name indicating the job from which a timeseries - // was scraped. - JobLabel = "job" - - // InstanceLabel is the label name used for the instance label. - InstanceLabel = "instance" - - // BucketLabel is used for the label that defines the upper bound of a - // bucket of a histogram ("le" -> "less or equal"). - BucketLabel = "le" - - // QuantileLabel is used for the label that defines the quantile in a - // summary. - QuantileLabel = "quantile" -) - -// LabelNameRE is a regular expression matching valid label names. Note that the -// IsValid method of LabelName performs the same check but faster than a match -// with this regular expression. -var LabelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$") - -// A LabelName is a key for a LabelSet or Metric. It has a value associated -// therewith. -type LabelName string - -// IsValid is true iff the label name matches the pattern of LabelNameRE. This -// method, however, does not use LabelNameRE for the check but a much faster -// hardcoded implementation. -func (ln LabelName) IsValid() bool { - if len(ln) == 0 { - return false - } - for i, b := range ln { - if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) { - return false - } - } - return true -} - -// UnmarshalYAML implements the yaml.Unmarshaler interface. -func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error { - var s string - if err := unmarshal(&s); err != nil { - return err - } - if !LabelName(s).IsValid() { - return fmt.Errorf("%q is not a valid label name", s) - } - *ln = LabelName(s) - return nil -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (ln *LabelName) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - if !LabelName(s).IsValid() { - return fmt.Errorf("%q is not a valid label name", s) - } - *ln = LabelName(s) - return nil -} - -// LabelNames is a sortable LabelName slice. In implements sort.Interface. -type LabelNames []LabelName - -func (l LabelNames) Len() int { - return len(l) -} - -func (l LabelNames) Less(i, j int) bool { - return l[i] < l[j] -} - -func (l LabelNames) Swap(i, j int) { - l[i], l[j] = l[j], l[i] -} - -func (l LabelNames) String() string { - labelStrings := make([]string, 0, len(l)) - for _, label := range l { - labelStrings = append(labelStrings, string(label)) - } - return strings.Join(labelStrings, ", ") -} - -// A LabelValue is an associated value for a LabelName. -type LabelValue string - -// IsValid returns true iff the string is a valid UTF8. -func (lv LabelValue) IsValid() bool { - return utf8.ValidString(string(lv)) -} - -// LabelValues is a sortable LabelValue slice. It implements sort.Interface. -type LabelValues []LabelValue - -func (l LabelValues) Len() int { - return len(l) -} - -func (l LabelValues) Less(i, j int) bool { - return string(l[i]) < string(l[j]) -} - -func (l LabelValues) Swap(i, j int) { - l[i], l[j] = l[j], l[i] -} - -// LabelPair pairs a name with a value. -type LabelPair struct { - Name LabelName - Value LabelValue -} - -// LabelPairs is a sortable slice of LabelPair pointers. It implements -// sort.Interface. -type LabelPairs []*LabelPair - -func (l LabelPairs) Len() int { - return len(l) -} - -func (l LabelPairs) Less(i, j int) bool { - switch { - case l[i].Name > l[j].Name: - return false - case l[i].Name < l[j].Name: - return true - case l[i].Value > l[j].Value: - return false - case l[i].Value < l[j].Value: - return true - default: - return false - } -} - -func (l LabelPairs) Swap(i, j int) { - l[i], l[j] = l[j], l[i] -} diff --git a/vendor/github.com/prometheus/common/model/labels_test.go b/vendor/github.com/prometheus/common/model/labels_test.go deleted file mode 100644 index e8df28ffa..000000000 --- a/vendor/github.com/prometheus/common/model/labels_test.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "sort" - "testing" -) - -func testLabelNames(t testing.TB) { - var scenarios = []struct { - in LabelNames - out LabelNames - }{ - { - in: LabelNames{"ZZZ", "zzz"}, - out: LabelNames{"ZZZ", "zzz"}, - }, - { - in: LabelNames{"aaa", "AAA"}, - out: LabelNames{"AAA", "aaa"}, - }, - } - - for i, scenario := range scenarios { - sort.Sort(scenario.in) - - for j, expected := range scenario.out { - if expected != scenario.in[j] { - t.Errorf("%d.%d expected %s, got %s", i, j, expected, scenario.in[j]) - } - } - } -} - -func TestLabelNames(t *testing.T) { - testLabelNames(t) -} - -func BenchmarkLabelNames(b *testing.B) { - for i := 0; i < b.N; i++ { - testLabelNames(b) - } -} - -func testLabelValues(t testing.TB) { - var scenarios = []struct { - in LabelValues - out LabelValues - }{ - { - in: LabelValues{"ZZZ", "zzz"}, - out: LabelValues{"ZZZ", "zzz"}, - }, - { - in: LabelValues{"aaa", "AAA"}, - out: LabelValues{"AAA", "aaa"}, - }, - } - - for i, scenario := range scenarios { - sort.Sort(scenario.in) - - for j, expected := range scenario.out { - if expected != scenario.in[j] { - t.Errorf("%d.%d expected %s, got %s", i, j, expected, scenario.in[j]) - } - } - } -} - -func TestLabelValues(t *testing.T) { - testLabelValues(t) -} - -func BenchmarkLabelValues(b *testing.B) { - for i := 0; i < b.N; i++ { - testLabelValues(b) - } -} - -func TestLabelNameIsValid(t *testing.T) { - var scenarios = []struct { - ln LabelName - valid bool - }{ - { - ln: "Avalid_23name", - valid: true, - }, - { - ln: "_Avalid_23name", - valid: true, - }, - { - ln: "1valid_23name", - valid: false, - }, - { - ln: "avalid_23name", - valid: true, - }, - { - ln: "Ava:lid_23name", - valid: false, - }, - { - ln: "a lid_23name", - valid: false, - }, - { - ln: ":leading_colon", - valid: false, - }, - { - ln: "colon:in:the:middle", - valid: false, - }, - } - - for _, s := range scenarios { - if s.ln.IsValid() != s.valid { - t.Errorf("Expected %v for %q using IsValid method", s.valid, s.ln) - } - if LabelNameRE.MatchString(string(s.ln)) != s.valid { - t.Errorf("Expected %v for %q using regexp match", s.valid, s.ln) - } - } -} diff --git a/vendor/github.com/prometheus/common/model/labelset.go b/vendor/github.com/prometheus/common/model/labelset.go deleted file mode 100644 index 6eda08a73..000000000 --- a/vendor/github.com/prometheus/common/model/labelset.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "encoding/json" - "fmt" - "sort" - "strings" -) - -// A LabelSet is a collection of LabelName and LabelValue pairs. The LabelSet -// may be fully-qualified down to the point where it may resolve to a single -// Metric in the data store or not. All operations that occur within the realm -// of a LabelSet can emit a vector of Metric entities to which the LabelSet may -// match. -type LabelSet map[LabelName]LabelValue - -// Validate checks whether all names and values in the label set -// are valid. -func (ls LabelSet) Validate() error { - for ln, lv := range ls { - if !ln.IsValid() { - return fmt.Errorf("invalid name %q", ln) - } - if !lv.IsValid() { - return fmt.Errorf("invalid value %q", lv) - } - } - return nil -} - -// Equal returns true iff both label sets have exactly the same key/value pairs. -func (ls LabelSet) Equal(o LabelSet) bool { - if len(ls) != len(o) { - return false - } - for ln, lv := range ls { - olv, ok := o[ln] - if !ok { - return false - } - if olv != lv { - return false - } - } - return true -} - -// Before compares the metrics, using the following criteria: -// -// If m has fewer labels than o, it is before o. If it has more, it is not. -// -// If the number of labels is the same, the superset of all label names is -// sorted alphanumerically. The first differing label pair found in that order -// determines the outcome: If the label does not exist at all in m, then m is -// before o, and vice versa. Otherwise the label value is compared -// alphanumerically. -// -// If m and o are equal, the method returns false. -func (ls LabelSet) Before(o LabelSet) bool { - if len(ls) < len(o) { - return true - } - if len(ls) > len(o) { - return false - } - - lns := make(LabelNames, 0, len(ls)+len(o)) - for ln := range ls { - lns = append(lns, ln) - } - for ln := range o { - lns = append(lns, ln) - } - // It's probably not worth it to de-dup lns. - sort.Sort(lns) - for _, ln := range lns { - mlv, ok := ls[ln] - if !ok { - return true - } - olv, ok := o[ln] - if !ok { - return false - } - if mlv < olv { - return true - } - if mlv > olv { - return false - } - } - return false -} - -// Clone returns a copy of the label set. -func (ls LabelSet) Clone() LabelSet { - lsn := make(LabelSet, len(ls)) - for ln, lv := range ls { - lsn[ln] = lv - } - return lsn -} - -// Merge is a helper function to non-destructively merge two label sets. -func (l LabelSet) Merge(other LabelSet) LabelSet { - result := make(LabelSet, len(l)) - - for k, v := range l { - result[k] = v - } - - for k, v := range other { - result[k] = v - } - - return result -} - -func (l LabelSet) String() string { - lstrs := make([]string, 0, len(l)) - for l, v := range l { - lstrs = append(lstrs, fmt.Sprintf("%s=%q", l, v)) - } - - sort.Strings(lstrs) - return fmt.Sprintf("{%s}", strings.Join(lstrs, ", ")) -} - -// Fingerprint returns the LabelSet's fingerprint. -func (ls LabelSet) Fingerprint() Fingerprint { - return labelSetToFingerprint(ls) -} - -// FastFingerprint returns the LabelSet's Fingerprint calculated by a faster hashing -// algorithm, which is, however, more susceptible to hash collisions. -func (ls LabelSet) FastFingerprint() Fingerprint { - return labelSetToFastFingerprint(ls) -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (l *LabelSet) UnmarshalJSON(b []byte) error { - var m map[LabelName]LabelValue - if err := json.Unmarshal(b, &m); err != nil { - return err - } - // encoding/json only unmarshals maps of the form map[string]T. It treats - // LabelName as a string and does not call its UnmarshalJSON method. - // Thus, we have to replicate the behavior here. - for ln := range m { - if !ln.IsValid() { - return fmt.Errorf("%q is not a valid label name", ln) - } - } - *l = LabelSet(m) - return nil -} diff --git a/vendor/github.com/prometheus/common/model/metric.go b/vendor/github.com/prometheus/common/model/metric.go deleted file mode 100644 index f7250909b..000000000 --- a/vendor/github.com/prometheus/common/model/metric.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "fmt" - "regexp" - "sort" - "strings" -) - -var ( - separator = []byte{0} - // MetricNameRE is a regular expression matching valid metric - // names. Note that the IsValidMetricName function performs the same - // check but faster than a match with this regular expression. - MetricNameRE = regexp.MustCompile(`^[a-zA-Z_:][a-zA-Z0-9_:]*$`) -) - -// A Metric is similar to a LabelSet, but the key difference is that a Metric is -// a singleton and refers to one and only one stream of samples. -type Metric LabelSet - -// Equal compares the metrics. -func (m Metric) Equal(o Metric) bool { - return LabelSet(m).Equal(LabelSet(o)) -} - -// Before compares the metrics' underlying label sets. -func (m Metric) Before(o Metric) bool { - return LabelSet(m).Before(LabelSet(o)) -} - -// Clone returns a copy of the Metric. -func (m Metric) Clone() Metric { - clone := make(Metric, len(m)) - for k, v := range m { - clone[k] = v - } - return clone -} - -func (m Metric) String() string { - metricName, hasName := m[MetricNameLabel] - numLabels := len(m) - 1 - if !hasName { - numLabels = len(m) - } - labelStrings := make([]string, 0, numLabels) - for label, value := range m { - if label != MetricNameLabel { - labelStrings = append(labelStrings, fmt.Sprintf("%s=%q", label, value)) - } - } - - switch numLabels { - case 0: - if hasName { - return string(metricName) - } - return "{}" - default: - sort.Strings(labelStrings) - return fmt.Sprintf("%s{%s}", metricName, strings.Join(labelStrings, ", ")) - } -} - -// Fingerprint returns a Metric's Fingerprint. -func (m Metric) Fingerprint() Fingerprint { - return LabelSet(m).Fingerprint() -} - -// FastFingerprint returns a Metric's Fingerprint calculated by a faster hashing -// algorithm, which is, however, more susceptible to hash collisions. -func (m Metric) FastFingerprint() Fingerprint { - return LabelSet(m).FastFingerprint() -} - -// IsValidMetricName returns true iff name matches the pattern of MetricNameRE. -// This function, however, does not use MetricNameRE for the check but a much -// faster hardcoded implementation. -func IsValidMetricName(n LabelValue) bool { - if len(n) == 0 { - return false - } - for i, b := range n { - if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || b == ':' || (b >= '0' && b <= '9' && i > 0)) { - return false - } - } - return true -} diff --git a/vendor/github.com/prometheus/common/model/metric_test.go b/vendor/github.com/prometheus/common/model/metric_test.go deleted file mode 100644 index 06f9de525..000000000 --- a/vendor/github.com/prometheus/common/model/metric_test.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import "testing" - -func testMetric(t testing.TB) { - var scenarios = []struct { - input LabelSet - fingerprint Fingerprint - fastFingerprint Fingerprint - }{ - { - input: LabelSet{}, - fingerprint: 14695981039346656037, - fastFingerprint: 14695981039346656037, - }, - { - input: LabelSet{ - "first_name": "electro", - "occupation": "robot", - "manufacturer": "westinghouse", - }, - fingerprint: 5911716720268894962, - fastFingerprint: 11310079640881077873, - }, - { - input: LabelSet{ - "x": "y", - }, - fingerprint: 8241431561484471700, - fastFingerprint: 13948396922932177635, - }, - { - input: LabelSet{ - "a": "bb", - "b": "c", - }, - fingerprint: 3016285359649981711, - fastFingerprint: 3198632812309449502, - }, - { - input: LabelSet{ - "a": "b", - "bb": "c", - }, - fingerprint: 7122421792099404749, - fastFingerprint: 5774953389407657638, - }, - } - - for i, scenario := range scenarios { - input := Metric(scenario.input) - - if scenario.fingerprint != input.Fingerprint() { - t.Errorf("%d. expected %d, got %d", i, scenario.fingerprint, input.Fingerprint()) - } - if scenario.fastFingerprint != input.FastFingerprint() { - t.Errorf("%d. expected %d, got %d", i, scenario.fastFingerprint, input.FastFingerprint()) - } - } -} - -func TestMetric(t *testing.T) { - testMetric(t) -} - -func BenchmarkMetric(b *testing.B) { - for i := 0; i < b.N; i++ { - testMetric(b) - } -} - -func TestMetricNameIsValid(t *testing.T) { - var scenarios = []struct { - mn LabelValue - valid bool - }{ - { - mn: "Avalid_23name", - valid: true, - }, - { - mn: "_Avalid_23name", - valid: true, - }, - { - mn: "1valid_23name", - valid: false, - }, - { - mn: "avalid_23name", - valid: true, - }, - { - mn: "Ava:lid_23name", - valid: true, - }, - { - mn: "a lid_23name", - valid: false, - }, - { - mn: ":leading_colon", - valid: true, - }, - { - mn: "colon:in:the:middle", - valid: true, - }, - } - - for _, s := range scenarios { - if IsValidMetricName(s.mn) != s.valid { - t.Errorf("Expected %v for %q using IsValidMetricName function", s.valid, s.mn) - } - if MetricNameRE.MatchString(string(s.mn)) != s.valid { - t.Errorf("Expected %v for %q using regexp matching", s.valid, s.mn) - } - } -} diff --git a/vendor/github.com/prometheus/common/model/model.go b/vendor/github.com/prometheus/common/model/model.go deleted file mode 100644 index a7b969170..000000000 --- a/vendor/github.com/prometheus/common/model/model.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Prometheus 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 model contains common data structures that are shared across -// Prometheus components and libraries. -package model diff --git a/vendor/github.com/prometheus/common/model/signature.go b/vendor/github.com/prometheus/common/model/signature.go deleted file mode 100644 index 8762b13c6..000000000 --- a/vendor/github.com/prometheus/common/model/signature.go +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2014 The Prometheus 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 model - -import ( - "sort" -) - -// SeparatorByte is a byte that cannot occur in valid UTF-8 sequences and is -// used to separate label names, label values, and other strings from each other -// when calculating their combined hash value (aka signature aka fingerprint). -const SeparatorByte byte = 255 - -var ( - // cache the signature of an empty label set. - emptyLabelSignature = hashNew() -) - -// LabelsToSignature returns a quasi-unique signature (i.e., fingerprint) for a -// given label set. (Collisions are possible but unlikely if the number of label -// sets the function is applied to is small.) -func LabelsToSignature(labels map[string]string) uint64 { - if len(labels) == 0 { - return emptyLabelSignature - } - - labelNames := make([]string, 0, len(labels)) - for labelName := range labels { - labelNames = append(labelNames, labelName) - } - sort.Strings(labelNames) - - sum := hashNew() - for _, labelName := range labelNames { - sum = hashAdd(sum, labelName) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, labels[labelName]) - sum = hashAddByte(sum, SeparatorByte) - } - return sum -} - -// labelSetToFingerprint works exactly as LabelsToSignature but takes a LabelSet as -// parameter (rather than a label map) and returns a Fingerprint. -func labelSetToFingerprint(ls LabelSet) Fingerprint { - if len(ls) == 0 { - return Fingerprint(emptyLabelSignature) - } - - labelNames := make(LabelNames, 0, len(ls)) - for labelName := range ls { - labelNames = append(labelNames, labelName) - } - sort.Sort(labelNames) - - sum := hashNew() - for _, labelName := range labelNames { - sum = hashAdd(sum, string(labelName)) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, string(ls[labelName])) - sum = hashAddByte(sum, SeparatorByte) - } - return Fingerprint(sum) -} - -// labelSetToFastFingerprint works similar to labelSetToFingerprint but uses a -// faster and less allocation-heavy hash function, which is more susceptible to -// create hash collisions. Therefore, collision detection should be applied. -func labelSetToFastFingerprint(ls LabelSet) Fingerprint { - if len(ls) == 0 { - return Fingerprint(emptyLabelSignature) - } - - var result uint64 - for labelName, labelValue := range ls { - sum := hashNew() - sum = hashAdd(sum, string(labelName)) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, string(labelValue)) - result ^= sum - } - return Fingerprint(result) -} - -// SignatureForLabels works like LabelsToSignature but takes a Metric as -// parameter (rather than a label map) and only includes the labels with the -// specified LabelNames into the signature calculation. The labels passed in -// will be sorted by this function. -func SignatureForLabels(m Metric, labels ...LabelName) uint64 { - if len(labels) == 0 { - return emptyLabelSignature - } - - sort.Sort(LabelNames(labels)) - - sum := hashNew() - for _, label := range labels { - sum = hashAdd(sum, string(label)) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, string(m[label])) - sum = hashAddByte(sum, SeparatorByte) - } - return sum -} - -// SignatureWithoutLabels works like LabelsToSignature but takes a Metric as -// parameter (rather than a label map) and excludes the labels with any of the -// specified LabelNames from the signature calculation. -func SignatureWithoutLabels(m Metric, labels map[LabelName]struct{}) uint64 { - if len(m) == 0 { - return emptyLabelSignature - } - - labelNames := make(LabelNames, 0, len(m)) - for labelName := range m { - if _, exclude := labels[labelName]; !exclude { - labelNames = append(labelNames, labelName) - } - } - if len(labelNames) == 0 { - return emptyLabelSignature - } - sort.Sort(labelNames) - - sum := hashNew() - for _, labelName := range labelNames { - sum = hashAdd(sum, string(labelName)) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, string(m[labelName])) - sum = hashAddByte(sum, SeparatorByte) - } - return sum -} diff --git a/vendor/github.com/prometheus/common/model/signature_test.go b/vendor/github.com/prometheus/common/model/signature_test.go deleted file mode 100644 index d59c8a8c3..000000000 --- a/vendor/github.com/prometheus/common/model/signature_test.go +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright 2014 The Prometheus 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 model - -import ( - "runtime" - "sync" - "testing" -) - -func TestLabelsToSignature(t *testing.T) { - var scenarios = []struct { - in map[string]string - out uint64 - }{ - { - in: map[string]string{}, - out: 14695981039346656037, - }, - { - in: map[string]string{"name": "garland, briggs", "fear": "love is not enough"}, - out: 5799056148416392346, - }, - } - - for i, scenario := range scenarios { - actual := LabelsToSignature(scenario.in) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func TestMetricToFingerprint(t *testing.T) { - var scenarios = []struct { - in LabelSet - out Fingerprint - }{ - { - in: LabelSet{}, - out: 14695981039346656037, - }, - { - in: LabelSet{"name": "garland, briggs", "fear": "love is not enough"}, - out: 5799056148416392346, - }, - } - - for i, scenario := range scenarios { - actual := labelSetToFingerprint(scenario.in) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func TestMetricToFastFingerprint(t *testing.T) { - var scenarios = []struct { - in LabelSet - out Fingerprint - }{ - { - in: LabelSet{}, - out: 14695981039346656037, - }, - { - in: LabelSet{"name": "garland, briggs", "fear": "love is not enough"}, - out: 12952432476264840823, - }, - } - - for i, scenario := range scenarios { - actual := labelSetToFastFingerprint(scenario.in) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func TestSignatureForLabels(t *testing.T) { - var scenarios = []struct { - in Metric - labels LabelNames - out uint64 - }{ - { - in: Metric{}, - labels: nil, - out: 14695981039346656037, - }, - { - in: Metric{}, - labels: LabelNames{"empty"}, - out: 7187873163539638612, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: LabelNames{"empty"}, - out: 7187873163539638612, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: LabelNames{"fear", "name"}, - out: 5799056148416392346, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough", "foo": "bar"}, - labels: LabelNames{"fear", "name"}, - out: 5799056148416392346, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: LabelNames{}, - out: 14695981039346656037, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: nil, - out: 14695981039346656037, - }, - } - - for i, scenario := range scenarios { - actual := SignatureForLabels(scenario.in, scenario.labels...) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func TestSignatureWithoutLabels(t *testing.T) { - var scenarios = []struct { - in Metric - labels map[LabelName]struct{} - out uint64 - }{ - { - in: Metric{}, - labels: nil, - out: 14695981039346656037, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: map[LabelName]struct{}{"fear": struct{}{}, "name": struct{}{}}, - out: 14695981039346656037, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough", "foo": "bar"}, - labels: map[LabelName]struct{}{"foo": struct{}{}}, - out: 5799056148416392346, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: map[LabelName]struct{}{}, - out: 5799056148416392346, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: nil, - out: 5799056148416392346, - }, - } - - for i, scenario := range scenarios { - actual := SignatureWithoutLabels(scenario.in, scenario.labels) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func benchmarkLabelToSignature(b *testing.B, l map[string]string, e uint64) { - for i := 0; i < b.N; i++ { - if a := LabelsToSignature(l); a != e { - b.Fatalf("expected signature of %d for %s, got %d", e, l, a) - } - } -} - -func BenchmarkLabelToSignatureScalar(b *testing.B) { - benchmarkLabelToSignature(b, nil, 14695981039346656037) -} - -func BenchmarkLabelToSignatureSingle(b *testing.B) { - benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value"}, 5146282821936882169) -} - -func BenchmarkLabelToSignatureDouble(b *testing.B) { - benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value", "second-label": "second-label-value"}, 3195800080984914717) -} - -func BenchmarkLabelToSignatureTriple(b *testing.B) { - benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 13843036195897128121) -} - -func benchmarkMetricToFingerprint(b *testing.B, ls LabelSet, e Fingerprint) { - for i := 0; i < b.N; i++ { - if a := labelSetToFingerprint(ls); a != e { - b.Fatalf("expected signature of %d for %s, got %d", e, ls, a) - } - } -} - -func BenchmarkMetricToFingerprintScalar(b *testing.B) { - benchmarkMetricToFingerprint(b, nil, 14695981039346656037) -} - -func BenchmarkMetricToFingerprintSingle(b *testing.B) { - benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value"}, 5146282821936882169) -} - -func BenchmarkMetricToFingerprintDouble(b *testing.B) { - benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value"}, 3195800080984914717) -} - -func BenchmarkMetricToFingerprintTriple(b *testing.B) { - benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 13843036195897128121) -} - -func benchmarkMetricToFastFingerprint(b *testing.B, ls LabelSet, e Fingerprint) { - for i := 0; i < b.N; i++ { - if a := labelSetToFastFingerprint(ls); a != e { - b.Fatalf("expected signature of %d for %s, got %d", e, ls, a) - } - } -} - -func BenchmarkMetricToFastFingerprintScalar(b *testing.B) { - benchmarkMetricToFastFingerprint(b, nil, 14695981039346656037) -} - -func BenchmarkMetricToFastFingerprintSingle(b *testing.B) { - benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value"}, 5147259542624943964) -} - -func BenchmarkMetricToFastFingerprintDouble(b *testing.B) { - benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value"}, 18269973311206963528) -} - -func BenchmarkMetricToFastFingerprintTriple(b *testing.B) { - benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676) -} - -func BenchmarkEmptyLabelSignature(b *testing.B) { - input := []map[string]string{nil, {}} - - var ms runtime.MemStats - runtime.ReadMemStats(&ms) - - alloc := ms.Alloc - - for _, labels := range input { - LabelsToSignature(labels) - } - - runtime.ReadMemStats(&ms) - - if got := ms.Alloc; alloc != got { - b.Fatal("expected LabelsToSignature with empty labels not to perform allocations") - } -} - -func benchmarkMetricToFastFingerprintConc(b *testing.B, ls LabelSet, e Fingerprint, concLevel int) { - var start, end sync.WaitGroup - start.Add(1) - end.Add(concLevel) - - for i := 0; i < concLevel; i++ { - go func() { - start.Wait() - for j := b.N / concLevel; j >= 0; j-- { - if a := labelSetToFastFingerprint(ls); a != e { - b.Fatalf("expected signature of %d for %s, got %d", e, ls, a) - } - } - end.Done() - }() - } - b.ResetTimer() - start.Done() - end.Wait() -} - -func BenchmarkMetricToFastFingerprintTripleConc1(b *testing.B) { - benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 1) -} - -func BenchmarkMetricToFastFingerprintTripleConc2(b *testing.B) { - benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 2) -} - -func BenchmarkMetricToFastFingerprintTripleConc4(b *testing.B) { - benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 4) -} - -func BenchmarkMetricToFastFingerprintTripleConc8(b *testing.B) { - benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 8) -} diff --git a/vendor/github.com/prometheus/common/model/silence.go b/vendor/github.com/prometheus/common/model/silence.go deleted file mode 100644 index bb99889d2..000000000 --- a/vendor/github.com/prometheus/common/model/silence.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2015 The Prometheus 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 model - -import ( - "encoding/json" - "fmt" - "regexp" - "time" -) - -// Matcher describes a matches the value of a given label. -type Matcher struct { - Name LabelName `json:"name"` - Value string `json:"value"` - IsRegex bool `json:"isRegex"` -} - -func (m *Matcher) UnmarshalJSON(b []byte) error { - type plain Matcher - if err := json.Unmarshal(b, (*plain)(m)); err != nil { - return err - } - - if len(m.Name) == 0 { - return fmt.Errorf("label name in matcher must not be empty") - } - if m.IsRegex { - if _, err := regexp.Compile(m.Value); err != nil { - return err - } - } - return nil -} - -// Validate returns true iff all fields of the matcher have valid values. -func (m *Matcher) Validate() error { - if !m.Name.IsValid() { - return fmt.Errorf("invalid name %q", m.Name) - } - if m.IsRegex { - if _, err := regexp.Compile(m.Value); err != nil { - return fmt.Errorf("invalid regular expression %q", m.Value) - } - } else if !LabelValue(m.Value).IsValid() || len(m.Value) == 0 { - return fmt.Errorf("invalid value %q", m.Value) - } - return nil -} - -// Silence defines the representation of a silence definition in the Prometheus -// eco-system. -type Silence struct { - ID uint64 `json:"id,omitempty"` - - Matchers []*Matcher `json:"matchers"` - - StartsAt time.Time `json:"startsAt"` - EndsAt time.Time `json:"endsAt"` - - CreatedAt time.Time `json:"createdAt,omitempty"` - CreatedBy string `json:"createdBy"` - Comment string `json:"comment,omitempty"` -} - -// Validate returns true iff all fields of the silence have valid values. -func (s *Silence) Validate() error { - if len(s.Matchers) == 0 { - return fmt.Errorf("at least one matcher required") - } - for _, m := range s.Matchers { - if err := m.Validate(); err != nil { - return fmt.Errorf("invalid matcher: %s", err) - } - } - if s.StartsAt.IsZero() { - return fmt.Errorf("start time missing") - } - if s.EndsAt.IsZero() { - return fmt.Errorf("end time missing") - } - if s.EndsAt.Before(s.StartsAt) { - return fmt.Errorf("start time must be before end time") - } - if s.CreatedBy == "" { - return fmt.Errorf("creator information missing") - } - if s.Comment == "" { - return fmt.Errorf("comment missing") - } - if s.CreatedAt.IsZero() { - return fmt.Errorf("creation timestamp missing") - } - return nil -} diff --git a/vendor/github.com/prometheus/common/model/silence_test.go b/vendor/github.com/prometheus/common/model/silence_test.go deleted file mode 100644 index 8eaaf0744..000000000 --- a/vendor/github.com/prometheus/common/model/silence_test.go +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2015 The Prometheus 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 model - -import ( - "strings" - "testing" - "time" -) - -func TestMatcherValidate(t *testing.T) { - var cases = []struct { - matcher *Matcher - err string - }{ - { - matcher: &Matcher{ - Name: "name", - Value: "value", - }, - }, - { - matcher: &Matcher{ - Name: "name", - Value: "value", - IsRegex: true, - }, - }, - { - matcher: &Matcher{ - Name: "name!", - Value: "value", - }, - err: "invalid name", - }, - { - matcher: &Matcher{ - Name: "", - Value: "value", - }, - err: "invalid name", - }, - { - matcher: &Matcher{ - Name: "name", - Value: "value\xff", - }, - err: "invalid value", - }, - { - matcher: &Matcher{ - Name: "name", - Value: "", - }, - err: "invalid value", - }, - } - - for i, c := range cases { - err := c.matcher.Validate() - if err == nil { - if c.err == "" { - continue - } - t.Errorf("%d. Expected error %q but got none", i, c.err) - continue - } - if c.err == "" && err != nil { - t.Errorf("%d. Expected no error but got %q", i, err) - continue - } - if !strings.Contains(err.Error(), c.err) { - t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err) - } - } -} - -func TestSilenceValidate(t *testing.T) { - ts := time.Now() - - var cases = []struct { - sil *Silence - err string - }{ - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - {Name: "name", Value: "value"}, - {Name: "name", Value: "value"}, - {Name: "name", Value: "value", IsRegex: true}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts.Add(-1 * time.Minute), - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "start time must be before end time", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "end time missing", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "start time missing", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "!name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "invalid matcher", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - }, - err: "comment missing", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "creation timestamp missing", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - Comment: "comment", - }, - err: "creator information missing", - }, - } - - for i, c := range cases { - err := c.sil.Validate() - if err == nil { - if c.err == "" { - continue - } - t.Errorf("%d. Expected error %q but got none", i, c.err) - continue - } - if c.err == "" && err != nil { - t.Errorf("%d. Expected no error but got %q", i, err) - continue - } - if !strings.Contains(err.Error(), c.err) { - t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err) - } - } -} diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go deleted file mode 100644 index 46259b1f1..000000000 --- a/vendor/github.com/prometheus/common/model/time.go +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "fmt" - "math" - "regexp" - "strconv" - "strings" - "time" -) - -const ( - // MinimumTick is the minimum supported time resolution. This has to be - // at least time.Second in order for the code below to work. - minimumTick = time.Millisecond - // second is the Time duration equivalent to one second. - second = int64(time.Second / minimumTick) - // The number of nanoseconds per minimum tick. - nanosPerTick = int64(minimumTick / time.Nanosecond) - - // Earliest is the earliest Time representable. Handy for - // initializing a high watermark. - Earliest = Time(math.MinInt64) - // Latest is the latest Time representable. Handy for initializing - // a low watermark. - Latest = Time(math.MaxInt64) -) - -// Time is the number of milliseconds since the epoch -// (1970-01-01 00:00 UTC) excluding leap seconds. -type Time int64 - -// Interval describes an interval between two timestamps. -type Interval struct { - Start, End Time -} - -// Now returns the current time as a Time. -func Now() Time { - return TimeFromUnixNano(time.Now().UnixNano()) -} - -// TimeFromUnix returns the Time equivalent to the Unix Time t -// provided in seconds. -func TimeFromUnix(t int64) Time { - return Time(t * second) -} - -// TimeFromUnixNano returns the Time equivalent to the Unix Time -// t provided in nanoseconds. -func TimeFromUnixNano(t int64) Time { - return Time(t / nanosPerTick) -} - -// Equal reports whether two Times represent the same instant. -func (t Time) Equal(o Time) bool { - return t == o -} - -// Before reports whether the Time t is before o. -func (t Time) Before(o Time) bool { - return t < o -} - -// After reports whether the Time t is after o. -func (t Time) After(o Time) bool { - return t > o -} - -// Add returns the Time t + d. -func (t Time) Add(d time.Duration) Time { - return t + Time(d/minimumTick) -} - -// Sub returns the Duration t - o. -func (t Time) Sub(o Time) time.Duration { - return time.Duration(t-o) * minimumTick -} - -// Time returns the time.Time representation of t. -func (t Time) Time() time.Time { - return time.Unix(int64(t)/second, (int64(t)%second)*nanosPerTick) -} - -// Unix returns t as a Unix time, the number of seconds elapsed -// since January 1, 1970 UTC. -func (t Time) Unix() int64 { - return int64(t) / second -} - -// UnixNano returns t as a Unix time, the number of nanoseconds elapsed -// since January 1, 1970 UTC. -func (t Time) UnixNano() int64 { - return int64(t) * nanosPerTick -} - -// The number of digits after the dot. -var dotPrecision = int(math.Log10(float64(second))) - -// String returns a string representation of the Time. -func (t Time) String() string { - return strconv.FormatFloat(float64(t)/float64(second), 'f', -1, 64) -} - -// MarshalJSON implements the json.Marshaler interface. -func (t Time) MarshalJSON() ([]byte, error) { - return []byte(t.String()), nil -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (t *Time) UnmarshalJSON(b []byte) error { - p := strings.Split(string(b), ".") - switch len(p) { - case 1: - v, err := strconv.ParseInt(string(p[0]), 10, 64) - if err != nil { - return err - } - *t = Time(v * second) - - case 2: - v, err := strconv.ParseInt(string(p[0]), 10, 64) - if err != nil { - return err - } - v *= second - - prec := dotPrecision - len(p[1]) - if prec < 0 { - p[1] = p[1][:dotPrecision] - } else if prec > 0 { - p[1] = p[1] + strings.Repeat("0", prec) - } - - va, err := strconv.ParseInt(p[1], 10, 32) - if err != nil { - return err - } - - *t = Time(v + va) - - default: - return fmt.Errorf("invalid time %q", string(b)) - } - return nil -} - -// Duration wraps time.Duration. It is used to parse the custom duration format -// from YAML. -// This type should not propagate beyond the scope of input/output processing. -type Duration time.Duration - -// Set implements pflag/flag.Value -func (d *Duration) Set(s string) error { - var err error - *d, err = ParseDuration(s) - return err -} - -// Type implements pflag.Value -func (d *Duration) Type() string { - return "duration" -} - -var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$") - -// ParseDuration parses a string into a time.Duration, assuming that a year -// always has 365d, a week always has 7d, and a day always has 24h. -func ParseDuration(durationStr string) (Duration, error) { - matches := durationRE.FindStringSubmatch(durationStr) - if len(matches) != 3 { - return 0, fmt.Errorf("not a valid duration string: %q", durationStr) - } - var ( - n, _ = strconv.Atoi(matches[1]) - dur = time.Duration(n) * time.Millisecond - ) - switch unit := matches[2]; unit { - case "y": - dur *= 1000 * 60 * 60 * 24 * 365 - case "w": - dur *= 1000 * 60 * 60 * 24 * 7 - case "d": - dur *= 1000 * 60 * 60 * 24 - case "h": - dur *= 1000 * 60 * 60 - case "m": - dur *= 1000 * 60 - case "s": - dur *= 1000 - case "ms": - // Value already correct - default: - return 0, fmt.Errorf("invalid time unit in duration string: %q", unit) - } - return Duration(dur), nil -} - -func (d Duration) String() string { - var ( - ms = int64(time.Duration(d) / time.Millisecond) - unit = "ms" - ) - if ms == 0 { - return "0s" - } - factors := map[string]int64{ - "y": 1000 * 60 * 60 * 24 * 365, - "w": 1000 * 60 * 60 * 24 * 7, - "d": 1000 * 60 * 60 * 24, - "h": 1000 * 60 * 60, - "m": 1000 * 60, - "s": 1000, - "ms": 1, - } - - switch int64(0) { - case ms % factors["y"]: - unit = "y" - case ms % factors["w"]: - unit = "w" - case ms % factors["d"]: - unit = "d" - case ms % factors["h"]: - unit = "h" - case ms % factors["m"]: - unit = "m" - case ms % factors["s"]: - unit = "s" - } - return fmt.Sprintf("%v%v", ms/factors[unit], unit) -} - -// MarshalYAML implements the yaml.Marshaler interface. -func (d Duration) MarshalYAML() (interface{}, error) { - return d.String(), nil -} - -// UnmarshalYAML implements the yaml.Unmarshaler interface. -func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error { - var s string - if err := unmarshal(&s); err != nil { - return err - } - dur, err := ParseDuration(s) - if err != nil { - return err - } - *d = dur - return nil -} diff --git a/vendor/github.com/prometheus/common/model/time_test.go b/vendor/github.com/prometheus/common/model/time_test.go deleted file mode 100644 index 3efdd65ff..000000000 --- a/vendor/github.com/prometheus/common/model/time_test.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "testing" - "time" -) - -func TestComparators(t *testing.T) { - t1a := TimeFromUnix(0) - t1b := TimeFromUnix(0) - t2 := TimeFromUnix(2*second - 1) - - if !t1a.Equal(t1b) { - t.Fatalf("Expected %s to be equal to %s", t1a, t1b) - } - if t1a.Equal(t2) { - t.Fatalf("Expected %s to not be equal to %s", t1a, t2) - } - - if !t1a.Before(t2) { - t.Fatalf("Expected %s to be before %s", t1a, t2) - } - if t1a.Before(t1b) { - t.Fatalf("Expected %s to not be before %s", t1a, t1b) - } - - if !t2.After(t1a) { - t.Fatalf("Expected %s to be after %s", t2, t1a) - } - if t1b.After(t1a) { - t.Fatalf("Expected %s to not be after %s", t1b, t1a) - } -} - -func TestTimeConversions(t *testing.T) { - unixSecs := int64(1136239445) - unixNsecs := int64(123456789) - unixNano := unixSecs*1e9 + unixNsecs - - t1 := time.Unix(unixSecs, unixNsecs-unixNsecs%nanosPerTick) - t2 := time.Unix(unixSecs, unixNsecs) - - ts := TimeFromUnixNano(unixNano) - if !ts.Time().Equal(t1) { - t.Fatalf("Expected %s, got %s", t1, ts.Time()) - } - - // Test available precision. - ts = TimeFromUnixNano(t2.UnixNano()) - if !ts.Time().Equal(t1) { - t.Fatalf("Expected %s, got %s", t1, ts.Time()) - } - - if ts.UnixNano() != unixNano-unixNano%nanosPerTick { - t.Fatalf("Expected %d, got %d", unixNano, ts.UnixNano()) - } -} - -func TestDuration(t *testing.T) { - duration := time.Second + time.Minute + time.Hour - goTime := time.Unix(1136239445, 0) - - ts := TimeFromUnix(goTime.Unix()) - if !goTime.Add(duration).Equal(ts.Add(duration).Time()) { - t.Fatalf("Expected %s to be equal to %s", goTime.Add(duration), ts.Add(duration)) - } - - earlier := ts.Add(-duration) - delta := ts.Sub(earlier) - if delta != duration { - t.Fatalf("Expected %s to be equal to %s", delta, duration) - } -} - -func TestParseDuration(t *testing.T) { - var cases = []struct { - in string - out time.Duration - }{ - { - in: "0s", - out: 0, - }, { - in: "324ms", - out: 324 * time.Millisecond, - }, { - in: "3s", - out: 3 * time.Second, - }, { - in: "5m", - out: 5 * time.Minute, - }, { - in: "1h", - out: time.Hour, - }, { - in: "4d", - out: 4 * 24 * time.Hour, - }, { - in: "3w", - out: 3 * 7 * 24 * time.Hour, - }, { - in: "10y", - out: 10 * 365 * 24 * time.Hour, - }, - } - - for _, c := range cases { - d, err := ParseDuration(c.in) - if err != nil { - t.Errorf("Unexpected error on input %q", c.in) - } - if time.Duration(d) != c.out { - t.Errorf("Expected %v but got %v", c.out, d) - } - if d.String() != c.in { - t.Errorf("Expected duration string %q but got %q", c.in, d.String()) - } - } -} diff --git a/vendor/github.com/prometheus/common/model/value.go b/vendor/github.com/prometheus/common/model/value.go deleted file mode 100644 index c9d8fb1a2..000000000 --- a/vendor/github.com/prometheus/common/model/value.go +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "encoding/json" - "fmt" - "math" - "sort" - "strconv" - "strings" -) - -var ( - // ZeroSamplePair is the pseudo zero-value of SamplePair used to signal a - // non-existing sample pair. It is a SamplePair with timestamp Earliest and - // value 0.0. Note that the natural zero value of SamplePair has a timestamp - // of 0, which is possible to appear in a real SamplePair and thus not - // suitable to signal a non-existing SamplePair. - ZeroSamplePair = SamplePair{Timestamp: Earliest} - - // ZeroSample is the pseudo zero-value of Sample used to signal a - // non-existing sample. It is a Sample with timestamp Earliest, value 0.0, - // and metric nil. Note that the natural zero value of Sample has a timestamp - // of 0, which is possible to appear in a real Sample and thus not suitable - // to signal a non-existing Sample. - ZeroSample = Sample{Timestamp: Earliest} -) - -// A SampleValue is a representation of a value for a given sample at a given -// time. -type SampleValue float64 - -// MarshalJSON implements json.Marshaler. -func (v SampleValue) MarshalJSON() ([]byte, error) { - return json.Marshal(v.String()) -} - -// UnmarshalJSON implements json.Unmarshaler. -func (v *SampleValue) UnmarshalJSON(b []byte) error { - if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' { - return fmt.Errorf("sample value must be a quoted string") - } - f, err := strconv.ParseFloat(string(b[1:len(b)-1]), 64) - if err != nil { - return err - } - *v = SampleValue(f) - return nil -} - -// Equal returns true if the value of v and o is equal or if both are NaN. Note -// that v==o is false if both are NaN. If you want the conventional float -// behavior, use == to compare two SampleValues. -func (v SampleValue) Equal(o SampleValue) bool { - if v == o { - return true - } - return math.IsNaN(float64(v)) && math.IsNaN(float64(o)) -} - -func (v SampleValue) String() string { - return strconv.FormatFloat(float64(v), 'f', -1, 64) -} - -// SamplePair pairs a SampleValue with a Timestamp. -type SamplePair struct { - Timestamp Time - Value SampleValue -} - -// MarshalJSON implements json.Marshaler. -func (s SamplePair) MarshalJSON() ([]byte, error) { - t, err := json.Marshal(s.Timestamp) - if err != nil { - return nil, err - } - v, err := json.Marshal(s.Value) - if err != nil { - return nil, err - } - return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (s *SamplePair) UnmarshalJSON(b []byte) error { - v := [...]json.Unmarshaler{&s.Timestamp, &s.Value} - return json.Unmarshal(b, &v) -} - -// Equal returns true if this SamplePair and o have equal Values and equal -// Timestamps. The semantics of Value equality is defined by SampleValue.Equal. -func (s *SamplePair) Equal(o *SamplePair) bool { - return s == o || (s.Value.Equal(o.Value) && s.Timestamp.Equal(o.Timestamp)) -} - -func (s SamplePair) String() string { - return fmt.Sprintf("%s @[%s]", s.Value, s.Timestamp) -} - -// Sample is a sample pair associated with a metric. -type Sample struct { - Metric Metric `json:"metric"` - Value SampleValue `json:"value"` - Timestamp Time `json:"timestamp"` -} - -// Equal compares first the metrics, then the timestamp, then the value. The -// semantics of value equality is defined by SampleValue.Equal. -func (s *Sample) Equal(o *Sample) bool { - if s == o { - return true - } - - if !s.Metric.Equal(o.Metric) { - return false - } - if !s.Timestamp.Equal(o.Timestamp) { - return false - } - - return s.Value.Equal(o.Value) -} - -func (s Sample) String() string { - return fmt.Sprintf("%s => %s", s.Metric, SamplePair{ - Timestamp: s.Timestamp, - Value: s.Value, - }) -} - -// MarshalJSON implements json.Marshaler. -func (s Sample) MarshalJSON() ([]byte, error) { - v := struct { - Metric Metric `json:"metric"` - Value SamplePair `json:"value"` - }{ - Metric: s.Metric, - Value: SamplePair{ - Timestamp: s.Timestamp, - Value: s.Value, - }, - } - - return json.Marshal(&v) -} - -// UnmarshalJSON implements json.Unmarshaler. -func (s *Sample) UnmarshalJSON(b []byte) error { - v := struct { - Metric Metric `json:"metric"` - Value SamplePair `json:"value"` - }{ - Metric: s.Metric, - Value: SamplePair{ - Timestamp: s.Timestamp, - Value: s.Value, - }, - } - - if err := json.Unmarshal(b, &v); err != nil { - return err - } - - s.Metric = v.Metric - s.Timestamp = v.Value.Timestamp - s.Value = v.Value.Value - - return nil -} - -// Samples is a sortable Sample slice. It implements sort.Interface. -type Samples []*Sample - -func (s Samples) Len() int { - return len(s) -} - -// Less compares first the metrics, then the timestamp. -func (s Samples) Less(i, j int) bool { - switch { - case s[i].Metric.Before(s[j].Metric): - return true - case s[j].Metric.Before(s[i].Metric): - return false - case s[i].Timestamp.Before(s[j].Timestamp): - return true - default: - return false - } -} - -func (s Samples) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -// Equal compares two sets of samples and returns true if they are equal. -func (s Samples) Equal(o Samples) bool { - if len(s) != len(o) { - return false - } - - for i, sample := range s { - if !sample.Equal(o[i]) { - return false - } - } - return true -} - -// SampleStream is a stream of Values belonging to an attached COWMetric. -type SampleStream struct { - Metric Metric `json:"metric"` - Values []SamplePair `json:"values"` -} - -func (ss SampleStream) String() string { - vals := make([]string, len(ss.Values)) - for i, v := range ss.Values { - vals[i] = v.String() - } - return fmt.Sprintf("%s =>\n%s", ss.Metric, strings.Join(vals, "\n")) -} - -// Value is a generic interface for values resulting from a query evaluation. -type Value interface { - Type() ValueType - String() string -} - -func (Matrix) Type() ValueType { return ValMatrix } -func (Vector) Type() ValueType { return ValVector } -func (*Scalar) Type() ValueType { return ValScalar } -func (*String) Type() ValueType { return ValString } - -type ValueType int - -const ( - ValNone ValueType = iota - ValScalar - ValVector - ValMatrix - ValString -) - -// MarshalJSON implements json.Marshaler. -func (et ValueType) MarshalJSON() ([]byte, error) { - return json.Marshal(et.String()) -} - -func (et *ValueType) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - switch s { - case "": - *et = ValNone - case "scalar": - *et = ValScalar - case "vector": - *et = ValVector - case "matrix": - *et = ValMatrix - case "string": - *et = ValString - default: - return fmt.Errorf("unknown value type %q", s) - } - return nil -} - -func (e ValueType) String() string { - switch e { - case ValNone: - return "" - case ValScalar: - return "scalar" - case ValVector: - return "vector" - case ValMatrix: - return "matrix" - case ValString: - return "string" - } - panic("ValueType.String: unhandled value type") -} - -// Scalar is a scalar value evaluated at the set timestamp. -type Scalar struct { - Value SampleValue `json:"value"` - Timestamp Time `json:"timestamp"` -} - -func (s Scalar) String() string { - return fmt.Sprintf("scalar: %v @[%v]", s.Value, s.Timestamp) -} - -// MarshalJSON implements json.Marshaler. -func (s Scalar) MarshalJSON() ([]byte, error) { - v := strconv.FormatFloat(float64(s.Value), 'f', -1, 64) - return json.Marshal([...]interface{}{s.Timestamp, string(v)}) -} - -// UnmarshalJSON implements json.Unmarshaler. -func (s *Scalar) UnmarshalJSON(b []byte) error { - var f string - v := [...]interface{}{&s.Timestamp, &f} - - if err := json.Unmarshal(b, &v); err != nil { - return err - } - - value, err := strconv.ParseFloat(f, 64) - if err != nil { - return fmt.Errorf("error parsing sample value: %s", err) - } - s.Value = SampleValue(value) - return nil -} - -// String is a string value evaluated at the set timestamp. -type String struct { - Value string `json:"value"` - Timestamp Time `json:"timestamp"` -} - -func (s *String) String() string { - return s.Value -} - -// MarshalJSON implements json.Marshaler. -func (s String) MarshalJSON() ([]byte, error) { - return json.Marshal([]interface{}{s.Timestamp, s.Value}) -} - -// UnmarshalJSON implements json.Unmarshaler. -func (s *String) UnmarshalJSON(b []byte) error { - v := [...]interface{}{&s.Timestamp, &s.Value} - return json.Unmarshal(b, &v) -} - -// Vector is basically only an alias for Samples, but the -// contract is that in a Vector, all Samples have the same timestamp. -type Vector []*Sample - -func (vec Vector) String() string { - entries := make([]string, len(vec)) - for i, s := range vec { - entries[i] = s.String() - } - return strings.Join(entries, "\n") -} - -func (vec Vector) Len() int { return len(vec) } -func (vec Vector) Swap(i, j int) { vec[i], vec[j] = vec[j], vec[i] } - -// Less compares first the metrics, then the timestamp. -func (vec Vector) Less(i, j int) bool { - switch { - case vec[i].Metric.Before(vec[j].Metric): - return true - case vec[j].Metric.Before(vec[i].Metric): - return false - case vec[i].Timestamp.Before(vec[j].Timestamp): - return true - default: - return false - } -} - -// Equal compares two sets of samples and returns true if they are equal. -func (vec Vector) Equal(o Vector) bool { - if len(vec) != len(o) { - return false - } - - for i, sample := range vec { - if !sample.Equal(o[i]) { - return false - } - } - return true -} - -// Matrix is a list of time series. -type Matrix []*SampleStream - -func (m Matrix) Len() int { return len(m) } -func (m Matrix) Less(i, j int) bool { return m[i].Metric.Before(m[j].Metric) } -func (m Matrix) Swap(i, j int) { m[i], m[j] = m[j], m[i] } - -func (mat Matrix) String() string { - matCp := make(Matrix, len(mat)) - copy(matCp, mat) - sort.Sort(matCp) - - strs := make([]string, len(matCp)) - - for i, ss := range matCp { - strs[i] = ss.String() - } - - return strings.Join(strs, "\n") -} diff --git a/vendor/github.com/prometheus/common/model/value_test.go b/vendor/github.com/prometheus/common/model/value_test.go deleted file mode 100644 index b97dcf84c..000000000 --- a/vendor/github.com/prometheus/common/model/value_test.go +++ /dev/null @@ -1,468 +0,0 @@ -// Copyright 2013 The Prometheus 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 model - -import ( - "encoding/json" - "math" - "reflect" - "sort" - "testing" -) - -func TestEqualValues(t *testing.T) { - tests := map[string]struct { - in1, in2 SampleValue - want bool - }{ - "equal floats": { - in1: 3.14, - in2: 3.14, - want: true, - }, - "unequal floats": { - in1: 3.14, - in2: 3.1415, - want: false, - }, - "positive inifinities": { - in1: SampleValue(math.Inf(+1)), - in2: SampleValue(math.Inf(+1)), - want: true, - }, - "negative inifinities": { - in1: SampleValue(math.Inf(-1)), - in2: SampleValue(math.Inf(-1)), - want: true, - }, - "different inifinities": { - in1: SampleValue(math.Inf(+1)), - in2: SampleValue(math.Inf(-1)), - want: false, - }, - "number and infinity": { - in1: 42, - in2: SampleValue(math.Inf(+1)), - want: false, - }, - "number and NaN": { - in1: 42, - in2: SampleValue(math.NaN()), - want: false, - }, - "NaNs": { - in1: SampleValue(math.NaN()), - in2: SampleValue(math.NaN()), - want: true, // !!! - }, - } - - for name, test := range tests { - got := test.in1.Equal(test.in2) - if got != test.want { - t.Errorf("Comparing %s, %f and %f: got %t, want %t", name, test.in1, test.in2, got, test.want) - } - } -} - -func TestEqualSamples(t *testing.T) { - testSample := &Sample{} - - tests := map[string]struct { - in1, in2 *Sample - want bool - }{ - "equal pointers": { - in1: testSample, - in2: testSample, - want: true, - }, - "different metrics": { - in1: &Sample{Metric: Metric{"foo": "bar"}}, - in2: &Sample{Metric: Metric{"foo": "biz"}}, - want: false, - }, - "different timestamp": { - in1: &Sample{Timestamp: 0}, - in2: &Sample{Timestamp: 1}, - want: false, - }, - "different value": { - in1: &Sample{Value: 0}, - in2: &Sample{Value: 1}, - want: false, - }, - "equal samples": { - in1: &Sample{ - Metric: Metric{"foo": "bar"}, - Timestamp: 0, - Value: 1, - }, - in2: &Sample{ - Metric: Metric{"foo": "bar"}, - Timestamp: 0, - Value: 1, - }, - want: true, - }, - } - - for name, test := range tests { - got := test.in1.Equal(test.in2) - if got != test.want { - t.Errorf("Comparing %s, %v and %v: got %t, want %t", name, test.in1, test.in2, got, test.want) - } - } - -} - -func TestSamplePairJSON(t *testing.T) { - input := []struct { - plain string - value SamplePair - }{ - { - plain: `[1234.567,"123.1"]`, - value: SamplePair{ - Value: 123.1, - Timestamp: 1234567, - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var sp SamplePair - err = json.Unmarshal(b, &sp) - if err != nil { - t.Error(err) - continue - } - - if sp != test.value { - t.Errorf("decoding error: expected %v, got %v", test.value, sp) - } - } -} - -func TestSampleJSON(t *testing.T) { - input := []struct { - plain string - value Sample - }{ - { - plain: `{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]}`, - value: Sample{ - Metric: Metric{ - MetricNameLabel: "test_metric", - }, - Value: 123.1, - Timestamp: 1234567, - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var sv Sample - err = json.Unmarshal(b, &sv) - if err != nil { - t.Error(err) - continue - } - - if !reflect.DeepEqual(sv, test.value) { - t.Errorf("decoding error: expected %v, got %v", test.value, sv) - } - } -} - -func TestVectorJSON(t *testing.T) { - input := []struct { - plain string - value Vector - }{ - { - plain: `[]`, - value: Vector{}, - }, - { - plain: `[{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]}]`, - value: Vector{&Sample{ - Metric: Metric{ - MetricNameLabel: "test_metric", - }, - Value: 123.1, - Timestamp: 1234567, - }}, - }, - { - plain: `[{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]},{"metric":{"foo":"bar"},"value":[1.234,"+Inf"]}]`, - value: Vector{ - &Sample{ - Metric: Metric{ - MetricNameLabel: "test_metric", - }, - Value: 123.1, - Timestamp: 1234567, - }, - &Sample{ - Metric: Metric{ - "foo": "bar", - }, - Value: SampleValue(math.Inf(1)), - Timestamp: 1234, - }, - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var vec Vector - err = json.Unmarshal(b, &vec) - if err != nil { - t.Error(err) - continue - } - - if !reflect.DeepEqual(vec, test.value) { - t.Errorf("decoding error: expected %v, got %v", test.value, vec) - } - } -} - -func TestScalarJSON(t *testing.T) { - input := []struct { - plain string - value Scalar - }{ - { - plain: `[123.456,"456"]`, - value: Scalar{ - Timestamp: 123456, - Value: 456, - }, - }, - { - plain: `[123123.456,"+Inf"]`, - value: Scalar{ - Timestamp: 123123456, - Value: SampleValue(math.Inf(1)), - }, - }, - { - plain: `[123123.456,"-Inf"]`, - value: Scalar{ - Timestamp: 123123456, - Value: SampleValue(math.Inf(-1)), - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var sv Scalar - err = json.Unmarshal(b, &sv) - if err != nil { - t.Error(err) - continue - } - - if sv != test.value { - t.Errorf("decoding error: expected %v, got %v", test.value, sv) - } - } -} - -func TestStringJSON(t *testing.T) { - input := []struct { - plain string - value String - }{ - { - plain: `[123.456,"test"]`, - value: String{ - Timestamp: 123456, - Value: "test", - }, - }, - { - plain: `[123123.456,"台北"]`, - value: String{ - Timestamp: 123123456, - Value: "台北", - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var sv String - err = json.Unmarshal(b, &sv) - if err != nil { - t.Error(err) - continue - } - - if sv != test.value { - t.Errorf("decoding error: expected %v, got %v", test.value, sv) - } - } -} - -func TestVectorSort(t *testing.T) { - input := Vector{ - &Sample{ - Metric: Metric{ - MetricNameLabel: "A", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "A", - }, - Timestamp: 2, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "C", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "C", - }, - Timestamp: 2, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "B", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "B", - }, - Timestamp: 2, - }, - } - - expected := Vector{ - &Sample{ - Metric: Metric{ - MetricNameLabel: "A", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "A", - }, - Timestamp: 2, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "B", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "B", - }, - Timestamp: 2, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "C", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "C", - }, - Timestamp: 2, - }, - } - - sort.Sort(input) - - for i, actual := range input { - actualFp := actual.Metric.Fingerprint() - expectedFp := expected[i].Metric.Fingerprint() - - if actualFp != expectedFp { - t.Fatalf("%d. Incorrect fingerprint. Got %s; want %s", i, actualFp.String(), expectedFp.String()) - } - - if actual.Timestamp != expected[i].Timestamp { - t.Fatalf("%d. Incorrect timestamp. Got %s; want %s", i, actual.Timestamp, expected[i].Timestamp) - } - } -} diff --git a/vendor/github.com/prometheus/common/promlog/flag/flag.go b/vendor/github.com/prometheus/common/promlog/flag/flag.go deleted file mode 100644 index b9d361e43..000000000 --- a/vendor/github.com/prometheus/common/promlog/flag/flag.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Prometheus 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 flag - -import ( - "github.com/prometheus/common/promlog" - kingpin "gopkg.in/alecthomas/kingpin.v2" -) - -// LevelFlagName is the canonical flag name to configure the allowed log level -// within Prometheus projects. -const LevelFlagName = "log.level" - -// LevelFlagHelp is the help description for the log.level flag. -const LevelFlagHelp = "Only log messages with the given severity or above. One of: [debug, info, warn, error]" - -// AddFlags adds the flags used by this package to the Kingpin application. -// To use the default Kingpin application, call AddFlags(kingpin.CommandLine) -func AddFlags(a *kingpin.Application, logLevel *promlog.AllowedLevel) { - a.Flag(LevelFlagName, LevelFlagHelp). - Default("info").SetValue(logLevel) -} diff --git a/vendor/github.com/prometheus/common/promlog/log.go b/vendor/github.com/prometheus/common/promlog/log.go deleted file mode 100644 index cf8307ad2..000000000 --- a/vendor/github.com/prometheus/common/promlog/log.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2017 The Prometheus 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 promlog defines standardised ways to initialize Go kit loggers -// across Prometheus components. -// It should typically only ever be imported by main packages. -package promlog - -import ( - "os" - - "github.com/go-kit/kit/log" - "github.com/go-kit/kit/log/level" - "github.com/pkg/errors" -) - -// AllowedLevel is a settable identifier for the minimum level a log entry -// must be have. -type AllowedLevel struct { - s string - o level.Option -} - -func (l *AllowedLevel) String() string { - return l.s -} - -// Set updates the value of the allowed level. -func (l *AllowedLevel) Set(s string) error { - switch s { - case "debug": - l.o = level.AllowDebug() - case "info": - l.o = level.AllowInfo() - case "warn": - l.o = level.AllowWarn() - case "error": - l.o = level.AllowError() - default: - return errors.Errorf("unrecognized log level %q", s) - } - l.s = s - return nil -} - -// New returns a new leveled oklog logger in the logfmt format. Each logged line will be annotated -// with a timestamp. The output always goes to stderr. -func New(al AllowedLevel) log.Logger { - l := log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)) - l = level.NewFilter(l, al.o) - l = log.With(l, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller) - return l -} diff --git a/vendor/github.com/prometheus/common/route/route.go b/vendor/github.com/prometheus/common/route/route.go deleted file mode 100644 index 742e57547..000000000 --- a/vendor/github.com/prometheus/common/route/route.go +++ /dev/null @@ -1,110 +0,0 @@ -package route - -import ( - "net/http" - - "github.com/julienschmidt/httprouter" - "golang.org/x/net/context" -) - -type param string - -// Param returns param p for the context. -func Param(ctx context.Context, p string) string { - return ctx.Value(param(p)).(string) -} - -// WithParam returns a new context with param p set to v. -func WithParam(ctx context.Context, p, v string) context.Context { - return context.WithValue(ctx, param(p), v) -} - -// Router wraps httprouter.Router and adds support for prefixed sub-routers, -// per-request context injections and instrumentation. -type Router struct { - rtr *httprouter.Router - prefix string - instrh func(handlerName string, handler http.HandlerFunc) http.HandlerFunc -} - -// New returns a new Router. -func New() *Router { - return &Router{ - rtr: httprouter.New(), - } -} - -// WithInstrumentation returns a router with instrumentation support. -func (r *Router) WithInstrumentation(instrh func(handlerName string, handler http.HandlerFunc) http.HandlerFunc) *Router { - return &Router{rtr: r.rtr, prefix: r.prefix, instrh: instrh} -} - -// WithPrefix returns a router that prefixes all registered routes with prefix. -func (r *Router) WithPrefix(prefix string) *Router { - return &Router{rtr: r.rtr, prefix: r.prefix + prefix, instrh: r.instrh} -} - -// handle turns a HandlerFunc into an httprouter.Handle. -func (r *Router) handle(handlerName string, h http.HandlerFunc) httprouter.Handle { - if r.instrh != nil { - // This needs to be outside the closure to avoid data race when reading and writing to 'h'. - h = r.instrh(handlerName, h) - } - return func(w http.ResponseWriter, req *http.Request, params httprouter.Params) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - - for _, p := range params { - ctx = context.WithValue(ctx, param(p.Key), p.Value) - } - h(w, req.WithContext(ctx)) - } -} - -// Get registers a new GET route. -func (r *Router) Get(path string, h http.HandlerFunc) { - r.rtr.GET(r.prefix+path, r.handle(path, h)) -} - -// Options registers a new OPTIONS route. -func (r *Router) Options(path string, h http.HandlerFunc) { - r.rtr.OPTIONS(r.prefix+path, r.handle(path, h)) -} - -// Del registers a new DELETE route. -func (r *Router) Del(path string, h http.HandlerFunc) { - r.rtr.DELETE(r.prefix+path, r.handle(path, h)) -} - -// Put registers a new PUT route. -func (r *Router) Put(path string, h http.HandlerFunc) { - r.rtr.PUT(r.prefix+path, r.handle(path, h)) -} - -// Post registers a new POST route. -func (r *Router) Post(path string, h http.HandlerFunc) { - r.rtr.POST(r.prefix+path, r.handle(path, h)) -} - -// Redirect takes an absolute path and sends an internal HTTP redirect for it, -// prefixed by the router's path prefix. Note that this method does not include -// functionality for handling relative paths or full URL redirects. -func (r *Router) Redirect(w http.ResponseWriter, req *http.Request, path string, code int) { - http.Redirect(w, req, r.prefix+path, code) -} - -// ServeHTTP implements http.Handler. -func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { - r.rtr.ServeHTTP(w, req) -} - -// FileServe returns a new http.HandlerFunc that serves files from dir. -// Using routes must provide the *filepath parameter. -func FileServe(dir string) http.HandlerFunc { - fs := http.FileServer(http.Dir(dir)) - - return func(w http.ResponseWriter, r *http.Request) { - r.URL.Path = Param(r.Context(), "filepath") - fs.ServeHTTP(w, r) - } -} diff --git a/vendor/github.com/prometheus/common/route/route_test.go b/vendor/github.com/prometheus/common/route/route_test.go deleted file mode 100644 index d491cad66..000000000 --- a/vendor/github.com/prometheus/common/route/route_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package route - -import ( - "net/http" - "net/http/httptest" - "testing" -) - -func TestRedirect(t *testing.T) { - router := New().WithPrefix("/test/prefix") - w := httptest.NewRecorder() - r, err := http.NewRequest("GET", "http://localhost:9090/foo", nil) - if err != nil { - t.Fatalf("Error building test request: %s", err) - } - - router.Redirect(w, r, "/some/endpoint", http.StatusFound) - if w.Code != http.StatusFound { - t.Fatalf("Unexpected redirect status code: got %d, want %d", w.Code, http.StatusFound) - } - - want := "/test/prefix/some/endpoint" - got := w.Header()["Location"][0] - if want != got { - t.Fatalf("Unexpected redirect location: got %s, want %s", got, want) - } -} - -func TestContext(t *testing.T) { - router := New() - router.Get("/test/:foo/", func(w http.ResponseWriter, r *http.Request) { - want := "bar" - got := Param(r.Context(), "foo") - if want != got { - t.Fatalf("Unexpected context value: want %q, got %q", want, got) - } - }) - - r, err := http.NewRequest("GET", "http://localhost:9090/test/bar/", nil) - if err != nil { - t.Fatalf("Error building test request: %s", err) - } - router.ServeHTTP(nil, r) -} - -func TestInstrumentation(t *testing.T) { - var got string - cases := []struct { - router *Router - want string - }{ - { - router: New(), - want: "", - }, { - router: New().WithInstrumentation(func(handlerName string, handler http.HandlerFunc) http.HandlerFunc { - got = handlerName - return handler - }), - want: "/foo", - }, - } - - for _, c := range cases { - c.router.Get("/foo", func(w http.ResponseWriter, r *http.Request) {}) - - r, err := http.NewRequest("GET", "http://localhost:9090/foo", nil) - if err != nil { - t.Fatalf("Error building test request: %s", err) - } - c.router.ServeHTTP(nil, r) - if c.want != got { - t.Fatalf("Unexpected value: want %q, got %q", c.want, got) - } - } -} diff --git a/vendor/github.com/prometheus/common/version/info.go b/vendor/github.com/prometheus/common/version/info.go deleted file mode 100644 index 84489a510..000000000 --- a/vendor/github.com/prometheus/common/version/info.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2016 The Prometheus 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 version - -import ( - "bytes" - "fmt" - "runtime" - "strings" - "text/template" - - "github.com/prometheus/client_golang/prometheus" -) - -// Build information. Populated at build-time. -var ( - Version string - Revision string - Branch string - BuildUser string - BuildDate string - GoVersion = runtime.Version() -) - -// NewCollector returns a collector which exports metrics about current version information. -func NewCollector(program string) *prometheus.GaugeVec { - buildInfo := prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: program, - Name: "build_info", - Help: fmt.Sprintf( - "A metric with a constant '1' value labeled by version, revision, branch, and goversion from which %s was built.", - program, - ), - }, - []string{"version", "revision", "branch", "goversion"}, - ) - buildInfo.WithLabelValues(Version, Revision, Branch, GoVersion).Set(1) - return buildInfo -} - -// versionInfoTmpl contains the template used by Info. -var versionInfoTmpl = ` -{{.program}}, version {{.version}} (branch: {{.branch}}, revision: {{.revision}}) - build user: {{.buildUser}} - build date: {{.buildDate}} - go version: {{.goVersion}} -` - -// Print returns version information. -func Print(program string) string { - m := map[string]string{ - "program": program, - "version": Version, - "revision": Revision, - "branch": Branch, - "buildUser": BuildUser, - "buildDate": BuildDate, - "goVersion": GoVersion, - } - t := template.Must(template.New("version").Parse(versionInfoTmpl)) - - var buf bytes.Buffer - if err := t.ExecuteTemplate(&buf, "version", m); err != nil { - panic(err) - } - return strings.TrimSpace(buf.String()) -} - -// Info returns version, branch and revision information. -func Info() string { - return fmt.Sprintf("(version=%s, branch=%s, revision=%s)", Version, Branch, Revision) -} - -// BuildContext returns goVersion, buildUser and buildDate information. -func BuildContext() string { - return fmt.Sprintf("(go=%s, user=%s, date=%s)", GoVersion, BuildUser, BuildDate) -} diff --git a/vendor/github.com/prometheus/procfs/.circleci/config.yml b/vendor/github.com/prometheus/procfs/.circleci/config.yml deleted file mode 100644 index c16d19248..000000000 --- a/vendor/github.com/prometheus/procfs/.circleci/config.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -version: 2 - -shared-linux: &shared-linux - working_directory: /go/src/github.com/prometheus/procfs - steps: - - checkout - - run: make style check_license vet test staticcheck - -shared-windows: &shared-windows - working_directory: /go/src/github.com/prometheus/procfs - steps: - - checkout - - run: make style check_license vet staticcheck - -jobs: - test-linux-1.10: - <<: *shared-linux - environment: - GOOS: linux - docker: - - image: circleci/golang:1.10 - test-linux-1.11: - <<: *shared-linux - environment: - GOOS: linux - docker: - - image: circleci/golang:1.11 - test-windows-1.10: - <<: *shared-windows - environment: - GOOS: windows - docker: - - image: circleci/golang:1.10 - test-windows-1.11: - <<: *shared-windows - environment: - GOOS: windows - docker: - - image: circleci/golang:1.11 - -workflows: - version: 2 - node_exporter: - jobs: - - test-linux-1.10 - - test-linux-1.11 - - test-windows-1.10 - - test-windows-1.11 diff --git a/vendor/github.com/prometheus/procfs/.gitignore b/vendor/github.com/prometheus/procfs/.gitignore deleted file mode 100644 index 25e3659ab..000000000 --- a/vendor/github.com/prometheus/procfs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/fixtures/ diff --git a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md b/vendor/github.com/prometheus/procfs/CONTRIBUTING.md deleted file mode 100644 index 40503edbf..000000000 --- a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md +++ /dev/null @@ -1,18 +0,0 @@ -# Contributing - -Prometheus uses GitHub to manage reviews of pull requests. - -* If you have a trivial fix or improvement, go ahead and create a pull request, - addressing (with `@...`) the maintainer of this repository (see - [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request. - -* If you plan to do something more involved, first discuss your ideas - on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). - This will avoid unnecessary work and surely give you and us a good deal - of inspiration. - -* Relevant coding style guidelines are the [Go Code Review - Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) - and the _Formatting and style_ section of Peter Bourgon's [Go: Best - Practices for Production - Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style). diff --git a/vendor/github.com/prometheus/procfs/LICENSE b/vendor/github.com/prometheus/procfs/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/vendor/github.com/prometheus/procfs/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/prometheus/procfs/MAINTAINERS.md b/vendor/github.com/prometheus/procfs/MAINTAINERS.md deleted file mode 100644 index 35993c41c..000000000 --- a/vendor/github.com/prometheus/procfs/MAINTAINERS.md +++ /dev/null @@ -1 +0,0 @@ -* Tobias Schmidt diff --git a/vendor/github.com/prometheus/procfs/Makefile b/vendor/github.com/prometheus/procfs/Makefile deleted file mode 100644 index 4d1098394..000000000 --- a/vendor/github.com/prometheus/procfs/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2018 The Prometheus 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. - -# Ensure GOBIN is not set during build so that promu is installed to the correct path -unexport GOBIN - -GO ?= go -GOFMT ?= $(GO)fmt -FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) -STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck -pkgs = $(shell $(GO) list ./... | grep -v /vendor/) - -PREFIX ?= $(shell pwd) -BIN_DIR ?= $(shell pwd) - -ifdef DEBUG - bindata_flags = -debug -endif - -STATICCHECK_IGNORE = - -all: format staticcheck build test - -style: - @echo ">> checking code style" - @! $(GOFMT) -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^' - -check_license: - @echo ">> checking license header" - @./scripts/check_license.sh - -test: fixtures/.unpacked sysfs/fixtures/.unpacked - @echo ">> running all tests" - @$(GO) test -race $(shell $(GO) list ./... | grep -v /vendor/ | grep -v examples) - -format: - @echo ">> formatting code" - @$(GO) fmt $(pkgs) - -vet: - @echo ">> vetting code" - @$(GO) vet $(pkgs) - -staticcheck: $(STATICCHECK) - @echo ">> running staticcheck" - @$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs) - -%/.unpacked: %.ttar - ./ttar -C $(dir $*) -x -f $*.ttar - touch $@ - -update_fixtures: fixtures.ttar sysfs/fixtures.ttar - -%fixtures.ttar: %/fixtures - rm -v $(dir $*)fixtures/.unpacked - ./ttar -C $(dir $*) -c -f $*fixtures.ttar fixtures/ - -$(FIRST_GOPATH)/bin/staticcheck: - @GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck - -.PHONY: all style check_license format test vet staticcheck - -# Declaring the binaries at their default locations as PHONY targets is a hack -# to ensure the latest version is downloaded on every make execution. -# If this is not desired, copy/symlink these binaries to a different path and -# set the respective environment variables. -.PHONY: $(GOPATH)/bin/staticcheck diff --git a/vendor/github.com/prometheus/procfs/NOTICE b/vendor/github.com/prometheus/procfs/NOTICE deleted file mode 100644 index 53c5e9aa1..000000000 --- a/vendor/github.com/prometheus/procfs/NOTICE +++ /dev/null @@ -1,7 +0,0 @@ -procfs provides functions to retrieve system, kernel and process -metrics from the pseudo-filesystem proc. - -Copyright 2014-2015 The Prometheus Authors - -This product includes software developed at -SoundCloud Ltd. (http://soundcloud.com/). diff --git a/vendor/github.com/prometheus/procfs/README.md b/vendor/github.com/prometheus/procfs/README.md deleted file mode 100644 index 209549471..000000000 --- a/vendor/github.com/prometheus/procfs/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# procfs - -This procfs package provides functions to retrieve system, kernel and process -metrics from the pseudo-filesystem proc. - -*WARNING*: This package is a work in progress. Its API may still break in -backwards-incompatible ways without warnings. Use it at your own risk. - -[![GoDoc](https://godoc.org/github.com/prometheus/procfs?status.png)](https://godoc.org/github.com/prometheus/procfs) -[![Build Status](https://travis-ci.org/prometheus/procfs.svg?branch=master)](https://travis-ci.org/prometheus/procfs) -[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/procfs)](https://goreportcard.com/report/github.com/prometheus/procfs) diff --git a/vendor/github.com/prometheus/procfs/bcache/bcache.go b/vendor/github.com/prometheus/procfs/bcache/bcache.go deleted file mode 100644 index 1db178cec..000000000 --- a/vendor/github.com/prometheus/procfs/bcache/bcache.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2017 The Prometheus 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 bcache provides access to statistics exposed by the bcache (Linux -// block cache). -package bcache - -// Stats contains bcache runtime statistics, parsed from /sys/fs/bcache/. -// -// The names and meanings of each statistic were taken from bcache.txt and -// files in drivers/md/bcache in the Linux kernel source. Counters are uint64 -// (in-kernel counters are mostly unsigned long). -type Stats struct { - // The name of the bcache used to source these statistics. - Name string - Bcache BcacheStats - Bdevs []BdevStats - Caches []CacheStats -} - -// BcacheStats contains statistics tied to a bcache ID. -type BcacheStats struct { - AverageKeySize uint64 - BtreeCacheSize uint64 - CacheAvailablePercent uint64 - Congested uint64 - RootUsagePercent uint64 - TreeDepth uint64 - Internal InternalStats - FiveMin PeriodStats - Total PeriodStats -} - -// BdevStats contains statistics for one backing device. -type BdevStats struct { - Name string - DirtyData uint64 - FiveMin PeriodStats - Total PeriodStats -} - -// CacheStats contains statistics for one cache device. -type CacheStats struct { - Name string - IOErrors uint64 - MetadataWritten uint64 - Written uint64 - Priority PriorityStats -} - -// PriorityStats contains statistics from the priority_stats file. -type PriorityStats struct { - UnusedPercent uint64 - MetadataPercent uint64 -} - -// InternalStats contains internal bcache statistics. -type InternalStats struct { - ActiveJournalEntries uint64 - BtreeNodes uint64 - BtreeReadAverageDurationNanoSeconds uint64 - CacheReadRaces uint64 -} - -// PeriodStats contains statistics for a time period (5 min or total). -type PeriodStats struct { - Bypassed uint64 - CacheBypassHits uint64 - CacheBypassMisses uint64 - CacheHits uint64 - CacheMissCollisions uint64 - CacheMisses uint64 - CacheReadaheads uint64 -} diff --git a/vendor/github.com/prometheus/procfs/bcache/get.go b/vendor/github.com/prometheus/procfs/bcache/get.go deleted file mode 100644 index b6d97de15..000000000 --- a/vendor/github.com/prometheus/procfs/bcache/get.go +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright 2017 The Prometheus 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 bcache - -import ( - "bufio" - "fmt" - "io/ioutil" - "os" - "path" - "path/filepath" - "strconv" - "strings" -) - -// ParsePseudoFloat parses the peculiar format produced by bcache's bch_hprint. -func parsePseudoFloat(str string) (float64, error) { - ss := strings.Split(str, ".") - - intPart, err := strconv.ParseFloat(ss[0], 64) - if err != nil { - return 0, err - } - - if len(ss) == 1 { - // Pure integers are fine. - return intPart, nil - } - fracPart, err := strconv.ParseFloat(ss[1], 64) - if err != nil { - return 0, err - } - // fracPart is a number between 0 and 1023 divided by 100; it is off - // by a small amount. Unexpected bumps in time lines may occur because - // for bch_hprint .1 != .10 and .10 > .9 (at least up to Linux - // v4.12-rc3). - - // Restore the proper order: - fracPart = fracPart / 10.24 - return intPart + fracPart, nil -} - -// Dehumanize converts a human-readable byte slice into a uint64. -func dehumanize(hbytes []byte) (uint64, error) { - ll := len(hbytes) - if ll == 0 { - return 0, fmt.Errorf("zero-length reply") - } - lastByte := hbytes[ll-1] - mul := float64(1) - var ( - mant float64 - err error - ) - // If lastByte is beyond the range of ASCII digits, it must be a - // multiplier. - if lastByte > 57 { - // Remove multiplier from slice. - hbytes = hbytes[:len(hbytes)-1] - - const ( - _ = 1 << (10 * iota) - KiB - MiB - GiB - TiB - PiB - EiB - ZiB - YiB - ) - - multipliers := map[rune]float64{ - // Source for conversion rules: - // linux-kernel/drivers/md/bcache/util.c:bch_hprint() - 'k': KiB, - 'M': MiB, - 'G': GiB, - 'T': TiB, - 'P': PiB, - 'E': EiB, - 'Z': ZiB, - 'Y': YiB, - } - mul = multipliers[rune(lastByte)] - mant, err = parsePseudoFloat(string(hbytes)) - if err != nil { - return 0, err - } - } else { - // Not humanized by bch_hprint - mant, err = strconv.ParseFloat(string(hbytes), 64) - if err != nil { - return 0, err - } - } - res := uint64(mant * mul) - return res, nil -} - -type parser struct { - uuidPath string - subDir string - currentDir string - err error -} - -func (p *parser) setSubDir(pathElements ...string) { - p.subDir = path.Join(pathElements...) - p.currentDir = path.Join(p.uuidPath, p.subDir) -} - -func (p *parser) readValue(fileName string) uint64 { - if p.err != nil { - return 0 - } - path := path.Join(p.currentDir, fileName) - byt, err := ioutil.ReadFile(path) - if err != nil { - p.err = fmt.Errorf("failed to read: %s", path) - return 0 - } - // Remove trailing newline. - byt = byt[:len(byt)-1] - res, err := dehumanize(byt) - p.err = err - return res -} - -// ParsePriorityStats parses lines from the priority_stats file. -func parsePriorityStats(line string, ps *PriorityStats) error { - var ( - value uint64 - err error - ) - switch { - case strings.HasPrefix(line, "Unused:"): - fields := strings.Fields(line) - rawValue := fields[len(fields)-1] - valueStr := strings.TrimSuffix(rawValue, "%") - value, err = strconv.ParseUint(valueStr, 10, 64) - if err != nil { - return err - } - ps.UnusedPercent = value - case strings.HasPrefix(line, "Metadata:"): - fields := strings.Fields(line) - rawValue := fields[len(fields)-1] - valueStr := strings.TrimSuffix(rawValue, "%") - value, err = strconv.ParseUint(valueStr, 10, 64) - if err != nil { - return err - } - ps.MetadataPercent = value - } - return nil -} - -func (p *parser) getPriorityStats() PriorityStats { - var res PriorityStats - - if p.err != nil { - return res - } - - path := path.Join(p.currentDir, "priority_stats") - - file, err := os.Open(path) - if err != nil { - p.err = fmt.Errorf("failed to read: %s", path) - return res - } - defer file.Close() - - scanner := bufio.NewScanner(file) - for scanner.Scan() { - err = parsePriorityStats(scanner.Text(), &res) - if err != nil { - p.err = fmt.Errorf("failed to parse: %s (%s)", path, err) - return res - } - } - if err := scanner.Err(); err != nil { - p.err = fmt.Errorf("failed to parse: %s (%s)", path, err) - return res - } - return res -} - -// GetStats collects from sysfs files data tied to one bcache ID. -func GetStats(uuidPath string) (*Stats, error) { - var bs Stats - - par := parser{uuidPath: uuidPath} - - // bcache stats - - // dir - par.setSubDir("") - bs.Bcache.AverageKeySize = par.readValue("average_key_size") - bs.Bcache.BtreeCacheSize = par.readValue("btree_cache_size") - bs.Bcache.CacheAvailablePercent = par.readValue("cache_available_percent") - bs.Bcache.Congested = par.readValue("congested") - bs.Bcache.RootUsagePercent = par.readValue("root_usage_percent") - bs.Bcache.TreeDepth = par.readValue("tree_depth") - - // bcache stats (internal) - - // dir /internal - par.setSubDir("internal") - bs.Bcache.Internal.ActiveJournalEntries = par.readValue("active_journal_entries") - bs.Bcache.Internal.BtreeNodes = par.readValue("btree_nodes") - bs.Bcache.Internal.BtreeReadAverageDurationNanoSeconds = par.readValue("btree_read_average_duration_us") - bs.Bcache.Internal.CacheReadRaces = par.readValue("cache_read_races") - - // bcache stats (period) - - // dir /stats_five_minute - par.setSubDir("stats_five_minute") - bs.Bcache.FiveMin.Bypassed = par.readValue("bypassed") - bs.Bcache.FiveMin.CacheHits = par.readValue("cache_hits") - - bs.Bcache.FiveMin.Bypassed = par.readValue("bypassed") - bs.Bcache.FiveMin.CacheBypassHits = par.readValue("cache_bypass_hits") - bs.Bcache.FiveMin.CacheBypassMisses = par.readValue("cache_bypass_misses") - bs.Bcache.FiveMin.CacheHits = par.readValue("cache_hits") - bs.Bcache.FiveMin.CacheMissCollisions = par.readValue("cache_miss_collisions") - bs.Bcache.FiveMin.CacheMisses = par.readValue("cache_misses") - bs.Bcache.FiveMin.CacheReadaheads = par.readValue("cache_readaheads") - - // dir /stats_total - par.setSubDir("stats_total") - bs.Bcache.Total.Bypassed = par.readValue("bypassed") - bs.Bcache.Total.CacheHits = par.readValue("cache_hits") - - bs.Bcache.Total.Bypassed = par.readValue("bypassed") - bs.Bcache.Total.CacheBypassHits = par.readValue("cache_bypass_hits") - bs.Bcache.Total.CacheBypassMisses = par.readValue("cache_bypass_misses") - bs.Bcache.Total.CacheHits = par.readValue("cache_hits") - bs.Bcache.Total.CacheMissCollisions = par.readValue("cache_miss_collisions") - bs.Bcache.Total.CacheMisses = par.readValue("cache_misses") - bs.Bcache.Total.CacheReadaheads = par.readValue("cache_readaheads") - - if par.err != nil { - return nil, par.err - } - - // bdev stats - - reg := path.Join(uuidPath, "bdev[0-9]*") - bdevDirs, err := filepath.Glob(reg) - if err != nil { - return nil, err - } - - bs.Bdevs = make([]BdevStats, len(bdevDirs)) - - for ii, bdevDir := range bdevDirs { - var bds = &bs.Bdevs[ii] - - bds.Name = filepath.Base(bdevDir) - - par.setSubDir(bds.Name) - bds.DirtyData = par.readValue("dirty_data") - - // dir //stats_five_minute - par.setSubDir(bds.Name, "stats_five_minute") - bds.FiveMin.Bypassed = par.readValue("bypassed") - bds.FiveMin.CacheBypassHits = par.readValue("cache_bypass_hits") - bds.FiveMin.CacheBypassMisses = par.readValue("cache_bypass_misses") - bds.FiveMin.CacheHits = par.readValue("cache_hits") - bds.FiveMin.CacheMissCollisions = par.readValue("cache_miss_collisions") - bds.FiveMin.CacheMisses = par.readValue("cache_misses") - bds.FiveMin.CacheReadaheads = par.readValue("cache_readaheads") - - // dir //stats_total - par.setSubDir("stats_total") - bds.Total.Bypassed = par.readValue("bypassed") - bds.Total.CacheBypassHits = par.readValue("cache_bypass_hits") - bds.Total.CacheBypassMisses = par.readValue("cache_bypass_misses") - bds.Total.CacheHits = par.readValue("cache_hits") - bds.Total.CacheMissCollisions = par.readValue("cache_miss_collisions") - bds.Total.CacheMisses = par.readValue("cache_misses") - bds.Total.CacheReadaheads = par.readValue("cache_readaheads") - } - - if par.err != nil { - return nil, par.err - } - - // cache stats - - reg = path.Join(uuidPath, "cache[0-9]*") - cacheDirs, err := filepath.Glob(reg) - if err != nil { - return nil, err - } - bs.Caches = make([]CacheStats, len(cacheDirs)) - - for ii, cacheDir := range cacheDirs { - var cs = &bs.Caches[ii] - cs.Name = filepath.Base(cacheDir) - - // dir is / - par.setSubDir(cs.Name) - cs.IOErrors = par.readValue("io_errors") - cs.MetadataWritten = par.readValue("metadata_written") - cs.Written = par.readValue("written") - - ps := par.getPriorityStats() - cs.Priority = ps - } - - if par.err != nil { - return nil, par.err - } - - return &bs, nil -} diff --git a/vendor/github.com/prometheus/procfs/bcache/get_test.go b/vendor/github.com/prometheus/procfs/bcache/get_test.go deleted file mode 100644 index 1d41a5ad3..000000000 --- a/vendor/github.com/prometheus/procfs/bcache/get_test.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2017 The Prometheus 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 bcache - -import ( - "math" - "testing" -) - -func TestDehumanizeTests(t *testing.T) { - dehumanizeTests := []struct { - in []byte - out uint64 - invalid bool - }{ - { - in: []byte("542k"), - out: 555008, - }, - { - in: []byte("322M"), - out: 337641472, - }, - { - in: []byte("1.1k"), - out: 1124, - }, - { - in: []byte("1.9k"), - out: 1924, - }, - { - in: []byte("1.10k"), - out: 2024, - }, - { - in: []byte(""), - out: 0, - invalid: true, - }, - } - for _, tst := range dehumanizeTests { - got, err := dehumanize(tst.in) - if tst.invalid && err == nil { - t.Error("expected an error, but none occurred") - } - if !tst.invalid && err != nil { - t.Errorf("unexpected error: %v", err) - } - if got != tst.out { - t.Errorf("dehumanize: '%s', want %d, got %d", tst.in, tst.out, got) - } - } -} - -func TestParsePseudoFloatTests(t *testing.T) { - parsePseudoFloatTests := []struct { - in string - out float64 - }{ - { - in: "1.1", - out: float64(1.097656), - }, - { - in: "1.9", - out: float64(1.878906), - }, - { - in: "1.10", - out: float64(1.976562), - }, - } - for _, tst := range parsePseudoFloatTests { - got, err := parsePseudoFloat(tst.in) - if err != nil || math.Abs(got-tst.out) > 0.0001 { - t.Errorf("parsePseudoFloat: %s, want %f, got %f", tst.in, tst.out, got) - } - } -} - -func TestPriorityStats(t *testing.T) { - var want = PriorityStats{ - UnusedPercent: 99, - MetadataPercent: 5, - } - var ( - in string - gotErr error - got PriorityStats - ) - in = "Metadata: 5%" - gotErr = parsePriorityStats(in, &got) - if gotErr != nil || got.MetadataPercent != want.MetadataPercent { - t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.MetadataPercent, got.MetadataPercent) - } - - in = "Unused: 99%" - gotErr = parsePriorityStats(in, &got) - if gotErr != nil || got.UnusedPercent != want.UnusedPercent { - t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.UnusedPercent, got.UnusedPercent) - } -} diff --git a/vendor/github.com/prometheus/procfs/buddyinfo.go b/vendor/github.com/prometheus/procfs/buddyinfo.go deleted file mode 100644 index d3a826807..000000000 --- a/vendor/github.com/prometheus/procfs/buddyinfo.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2017 The Prometheus 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 procfs - -import ( - "bufio" - "fmt" - "io" - "os" - "strconv" - "strings" -) - -// A BuddyInfo is the details parsed from /proc/buddyinfo. -// The data is comprised of an array of free fragments of each size. -// The sizes are 2^n*PAGE_SIZE, where n is the array index. -type BuddyInfo struct { - Node string - Zone string - Sizes []float64 -} - -// NewBuddyInfo reads the buddyinfo statistics. -func NewBuddyInfo() ([]BuddyInfo, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return nil, err - } - - return fs.NewBuddyInfo() -} - -// NewBuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem. -func (fs FS) NewBuddyInfo() ([]BuddyInfo, error) { - file, err := os.Open(fs.Path("buddyinfo")) - if err != nil { - return nil, err - } - defer file.Close() - - return parseBuddyInfo(file) -} - -func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) { - var ( - buddyInfo = []BuddyInfo{} - scanner = bufio.NewScanner(r) - bucketCount = -1 - ) - - for scanner.Scan() { - var err error - line := scanner.Text() - parts := strings.Fields(line) - - if len(parts) < 4 { - return nil, fmt.Errorf("invalid number of fields when parsing buddyinfo") - } - - node := strings.TrimRight(parts[1], ",") - zone := strings.TrimRight(parts[3], ",") - arraySize := len(parts[4:]) - - if bucketCount == -1 { - bucketCount = arraySize - } else { - if bucketCount != arraySize { - return nil, fmt.Errorf("mismatch in number of buddyinfo buckets, previous count %d, new count %d", bucketCount, arraySize) - } - } - - sizes := make([]float64, arraySize) - for i := 0; i < arraySize; i++ { - sizes[i], err = strconv.ParseFloat(parts[i+4], 64) - if err != nil { - return nil, fmt.Errorf("invalid value in buddyinfo: %s", err) - } - } - - buddyInfo = append(buddyInfo, BuddyInfo{node, zone, sizes}) - } - - return buddyInfo, scanner.Err() -} diff --git a/vendor/github.com/prometheus/procfs/buddyinfo_test.go b/vendor/github.com/prometheus/procfs/buddyinfo_test.go deleted file mode 100644 index bcf9355ca..000000000 --- a/vendor/github.com/prometheus/procfs/buddyinfo_test.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2017 The Prometheus 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 procfs - -import ( - "strings" - "testing" -) - -func TestBuddyInfo(t *testing.T) { - buddyInfo, err := FS("fixtures/buddyinfo/valid").NewBuddyInfo() - if err != nil { - t.Fatal(err) - } - - if want, got := "DMA", buddyInfo[0].Zone; want != got { - t.Errorf("want Node 0, Zone %s, got %s", want, got) - } - - if want, got := "Normal", buddyInfo[2].Zone; want != got { - t.Errorf("want Node 0, Zone %s, got %s", want, got) - } - - if want, got := 4381.0, buddyInfo[2].Sizes[0]; want != got { - t.Errorf("want Node 0, Zone Normal %f, got %f", want, got) - } - - if want, got := 572.0, buddyInfo[1].Sizes[1]; want != got { - t.Errorf("want Node 0, Zone DMA32 %f, got %f", want, got) - } -} - -func TestBuddyInfoShort(t *testing.T) { - _, err := FS("fixtures/buddyinfo/short").NewBuddyInfo() - if err == nil { - t.Errorf("expected error, but none occurred") - } - - if want, got := "invalid number of fields when parsing buddyinfo", err.Error(); want != got { - t.Errorf("wrong error returned, wanted %q, got %q", want, got) - } -} - -func TestBuddyInfoSizeMismatch(t *testing.T) { - _, err := FS("fixtures/buddyinfo/sizemismatch").NewBuddyInfo() - if err == nil { - t.Errorf("expected error, but none occurred") - } - - if want, got := "mismatch in number of buddyinfo buckets", err.Error(); !strings.HasPrefix(got, want) { - t.Errorf("wrong error returned, wanted prefix %q, got %q", want, got) - } -} diff --git a/vendor/github.com/prometheus/procfs/doc.go b/vendor/github.com/prometheus/procfs/doc.go deleted file mode 100644 index e2acd6d40..000000000 --- a/vendor/github.com/prometheus/procfs/doc.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 Prometheus Team -// 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 procfs provides functions to retrieve system, kernel and process -// metrics from the pseudo-filesystem proc. -// -// Example: -// -// package main -// -// import ( -// "fmt" -// "log" -// -// "github.com/prometheus/procfs" -// ) -// -// func main() { -// p, err := procfs.Self() -// if err != nil { -// log.Fatalf("could not get process: %s", err) -// } -// -// stat, err := p.NewStat() -// if err != nil { -// log.Fatalf("could not get process stat: %s", err) -// } -// -// fmt.Printf("command: %s\n", stat.Comm) -// fmt.Printf("cpu time: %fs\n", stat.CPUTime()) -// fmt.Printf("vsize: %dB\n", stat.VirtualMemory()) -// fmt.Printf("rss: %dB\n", stat.ResidentMemory()) -// } -// -package procfs diff --git a/vendor/github.com/prometheus/procfs/fixtures.ttar b/vendor/github.com/prometheus/procfs/fixtures.ttar deleted file mode 100644 index 13c831ef5..000000000 --- a/vendor/github.com/prometheus/procfs/fixtures.ttar +++ /dev/null @@ -1,462 +0,0 @@ -# Archive created by ttar -c -f fixtures.ttar fixtures/ -Directory: fixtures -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/26231 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/cmdline -Lines: 1 -vimNULLBYTEtest.goNULLBYTE+10NULLBYTEEOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/comm -Lines: 1 -vim -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/cwd -SymlinkTo: /usr/bin -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/exe -SymlinkTo: /usr/bin/vim -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/26231/fd -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/fd/0 -SymlinkTo: ../../symlinktargets/abc -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/fd/1 -SymlinkTo: ../../symlinktargets/def -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/fd/10 -SymlinkTo: ../../symlinktargets/xyz -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/fd/2 -SymlinkTo: ../../symlinktargets/ghi -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/fd/3 -SymlinkTo: ../../symlinktargets/uvw -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/io -Lines: 7 -rchar: 750339 -wchar: 818609 -syscr: 7405 -syscw: 5245 -read_bytes: 1024 -write_bytes: 2048 -cancelled_write_bytes: -1024 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/limits -Lines: 17 -Limit Soft Limit Hard Limit Units -Max cpu time unlimited unlimited seconds -Max file size unlimited unlimited bytes -Max data size unlimited unlimited bytes -Max stack size 8388608 unlimited bytes -Max core file size 0 unlimited bytes -Max resident set unlimited unlimited bytes -Max processes 62898 62898 processes -Max open files 2048 4096 files -Max locked memory 65536 65536 bytes -Max address space 8589934592 unlimited bytes -Max file locks unlimited unlimited locks -Max pending signals 62898 62898 signals -Max msgqueue size 819200 819200 bytes -Max nice priority 0 0 -Max realtime priority 0 0 -Max realtime timeout unlimited unlimited us -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/mountstats -Lines: 19 -device rootfs mounted on / with fstype rootfs -device sysfs mounted on /sys with fstype sysfs -device proc mounted on /proc with fstype proc -device /dev/sda1 mounted on / with fstype ext4 -device 192.168.1.1:/srv/test mounted on /mnt/nfs/test with fstype nfs4 statvers=1.1 - opts: rw,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.5,local_lock=none - age: 13968 - caps: caps=0xfff7,wtmult=512,dtsize=32768,bsize=0,namlen=255 - nfsv4: bm0=0xfdffafff,bm1=0xf9be3e,bm2=0x0,acl=0x0,pnfs=not configured - sec: flavor=1,pseudoflavor=1 - events: 52 226 0 0 1 13 398 0 0 331 0 47 0 0 77 0 0 77 0 0 0 0 0 0 0 0 0 - bytes: 1207640230 0 0 0 1210214218 0 295483 0 - RPC iostats version: 1.0 p/v: 100003/4 (nfs) - xprt: tcp 832 0 1 0 11 6428 6428 0 12154 0 24 26 5726 - per-op statistics - NULL: 0 0 0 0 0 0 0 0 - READ: 1298 1298 0 207680 1210292152 6 79386 79407 - WRITE: 0 0 0 0 0 0 0 0 - -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/26231/net -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/net/dev -Lines: 4 -Inter-| Receive | Transmit - face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed - lo: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - eth0: 438 5 0 0 0 0 0 0 648 8 0 0 0 0 0 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/26231/ns -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/ns/mnt -SymlinkTo: mnt:[4026531840] -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/ns/net -SymlinkTo: net:[4026531993] -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/root -SymlinkTo: / -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26231/stat -Lines: 1 -26231 (vim) R 5392 7446 5392 34835 7446 4218880 32533 309516 26 82 1677 44 158 99 20 0 1 0 82375 56274944 1981 18446744073709551615 4194304 6294284 140736914091744 140736914087944 139965136429984 0 0 12288 1870679807 0 0 0 17 0 0 0 31 0 0 8391624 8481048 16420864 140736914093252 140736914093279 140736914093279 140736914096107 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/26232 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/cmdline -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/comm -Lines: 1 -ata_sff -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/cwd -SymlinkTo: /does/not/exist -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/26232/fd -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/fd/0 -SymlinkTo: ../../symlinktargets/abc -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/fd/1 -SymlinkTo: ../../symlinktargets/def -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/fd/2 -SymlinkTo: ../../symlinktargets/ghi -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/fd/3 -SymlinkTo: ../../symlinktargets/uvw -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/fd/4 -SymlinkTo: ../../symlinktargets/xyz -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/limits -Lines: 17 -Limit Soft Limit Hard Limit Units -Max cpu time unlimited unlimited seconds -Max file size unlimited unlimited bytes -Max data size unlimited unlimited bytes -Max stack size 8388608 unlimited bytes -Max core file size 0 unlimited bytes -Max resident set unlimited unlimited bytes -Max processes 29436 29436 processes -Max open files 1024 4096 files -Max locked memory 65536 65536 bytes -Max address space unlimited unlimited bytes -Max file locks unlimited unlimited locks -Max pending signals 29436 29436 signals -Max msgqueue size 819200 819200 bytes -Max nice priority 0 0 -Max realtime priority 0 0 -Max realtime timeout unlimited unlimited us -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/root -SymlinkTo: /does/not/exist -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26232/stat -Lines: 1 -33 (ata_sff) S 2 0 0 0 -1 69238880 0 0 0 0 0 0 0 0 0 -20 1 0 5 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 17 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/26233 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/26233/cmdline -Lines: 1 -com.github.uiautomatorNULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTEEOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/584 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/584/stat -Lines: 2 -1020 ((a b ) ( c d) ) R 28378 1020 28378 34842 1020 4218880 286 0 0 0 0 0 0 0 20 0 1 0 10839175 10395648 155 18446744073709551615 4194304 4238788 140736466511168 140736466511168 140609271124624 0 0 0 0 0 0 0 17 5 0 0 0 0 0 6336016 6337300 25579520 140736466515030 140736466515061 140736466515061 140736466518002 0 -#!/bin/cat /proc/self/stat -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/buddyinfo -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/buddyinfo/short -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/buddyinfo/short/buddyinfo -Lines: 3 -Node 0, zone -Node 0, zone -Node 0, zone -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/buddyinfo/sizemismatch -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/buddyinfo/sizemismatch/buddyinfo -Lines: 3 -Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3 -Node 0, zone DMA32 759 572 791 475 194 45 12 0 0 0 0 0 -Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/buddyinfo/valid -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/buddyinfo/valid/buddyinfo -Lines: 3 -Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3 -Node 0, zone DMA32 759 572 791 475 194 45 12 0 0 0 0 -Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/xfs -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/xfs/stat -Lines: 23 -extent_alloc 92447 97589 92448 93751 -abt 0 0 0 0 -blk_map 1767055 188820 184891 92447 92448 2140766 0 -bmbt 0 0 0 0 -dir 185039 92447 92444 136422 -trans 706 944304 0 -ig 185045 58807 0 126238 0 33637 22 -log 2883 113448 9 17360 739 -push_ail 945014 0 134260 15483 0 3940 464 159985 0 40 -xstrat 92447 0 -rw 107739 94045 -attr 4 0 0 0 -icluster 8677 7849 135802 -vnodes 92601 0 0 0 92444 92444 92444 0 -buf 2666287 7122 2659202 3599 2 7085 0 10297 7085 -abtb2 184941 1277345 13257 13278 0 0 0 0 0 0 0 0 0 0 2746147 -abtc2 345295 2416764 172637 172658 0 0 0 0 0 0 0 0 0 0 21406023 -bmbt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -ibt2 343004 1358467 0 0 0 0 0 0 0 0 0 0 0 0 0 -fibt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -qm 0 0 0 0 0 0 0 0 -xpc 399724544 92823103 86219234 -debug 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/mdstat -Lines: 26 -Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] -md3 : active raid6 sda1[8] sdh1[7] sdg1[6] sdf1[5] sde1[11] sdd1[3] sdc1[10] sdb1[9] - 5853468288 blocks super 1.2 level 6, 64k chunk, algorithm 2 [8/8] [UUUUUUUU] - -md127 : active raid1 sdi2[0] sdj2[1] - 312319552 blocks [2/2] [UU] - -md0 : active raid1 sdk[2](S) sdi1[0] sdj1[1] - 248896 blocks [2/2] [UU] - -md4 : inactive raid1 sda3[0] sdb3[1] - 4883648 blocks [2/2] [UU] - -md6 : active raid1 sdb2[2] sda2[0] - 195310144 blocks [2/1] [U_] - [=>...................] recovery = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec - -md8 : active raid1 sdb1[1] sda1[0] - 195310144 blocks [2/2] [UU] - [=>...................] resync = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec - -md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1] - 7813735424 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [U_UU] - bitmap: 0/30 pages [0KB], 65536KB chunk - -unused devices: -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/net -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/net/dev -Lines: 6 -Inter-| Receive | Transmit - face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed -vethf345468: 648 8 0 0 0 0 0 0 438 5 0 0 0 0 0 0 - lo: 1664039048 1566805 0 0 0 0 0 0 1664039048 1566805 0 0 0 0 0 0 -docker0: 2568 38 0 0 0 0 0 0 438 5 0 0 0 0 0 0 - eth0: 874354587 1036395 0 0 0 0 0 0 563352563 732147 0 0 0 0 0 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/net/ip_vs -Lines: 21 -IP Virtual Server version 1.2.1 (size=4096) -Prot LocalAddress:Port Scheduler Flags - -> RemoteAddress:Port Forward Weight ActiveConn InActConn -TCP C0A80016:0CEA wlc - -> C0A85216:0CEA Tunnel 100 248 2 - -> C0A85318:0CEA Tunnel 100 248 2 - -> C0A85315:0CEA Tunnel 100 248 1 -TCP C0A80039:0CEA wlc - -> C0A85416:0CEA Tunnel 0 0 0 - -> C0A85215:0CEA Tunnel 100 1499 0 - -> C0A83215:0CEA Tunnel 100 1498 0 -TCP C0A80037:0CEA wlc - -> C0A8321A:0CEA Tunnel 0 0 0 - -> C0A83120:0CEA Tunnel 100 0 0 -TCP [2620:0000:0000:0000:0000:0000:0000:0001]:0050 sh - -> [2620:0000:0000:0000:0000:0000:0000:0002]:0050 Route 1 0 0 - -> [2620:0000:0000:0000:0000:0000:0000:0003]:0050 Route 1 0 0 - -> [2620:0000:0000:0000:0000:0000:0000:0004]:0050 Route 1 1 1 -FWM 10001000 wlc - -> C0A8321A:0CEA Route 0 0 1 - -> C0A83215:0CEA Route 0 0 2 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/net/ip_vs_stats -Lines: 6 - Total Incoming Outgoing Incoming Outgoing - Conns Packets Packets Bytes Bytes - 16AA370 E33656E5 0 51D8C8883AB3 0 - - Conns/s Pkts/s Pkts/s Bytes/s Bytes/s - 4 1FB3C 0 1282A8F 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/net/rpc -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/net/rpc/nfs -Lines: 5 -net 18628 0 18628 6 -rpc 4329785 0 4338291 -proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2 -proc3 22 1 4084749 29200 94754 32580 186 47747 7981 8639 0 6356 0 6962 0 7958 0 0 241 4 4 2 39 -proc4 61 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/net/rpc/nfsd -Lines: 11 -rc 0 6 18622 -fh 0 0 0 0 0 -io 157286400 0 -th 8 0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 -ra 32 0 0 0 0 0 0 0 0 0 0 0 -net 18628 0 18628 6 -rpc 18628 0 0 0 0 -proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2 -proc3 22 2 112 0 2719 111 0 0 0 0 0 0 0 0 0 0 0 27 216 0 2 1 0 -proc4 2 2 10853 -proc4ops 72 0 0 0 1098 2 0 0 0 0 8179 5896 0 0 0 0 5900 0 0 2 0 2 0 9609 0 2 150 1272 0 0 0 1236 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/net/xfrm_stat -Lines: 28 -XfrmInError 1 -XfrmInBufferError 2 -XfrmInHdrError 4 -XfrmInNoStates 3 -XfrmInStateProtoError 40 -XfrmInStateModeError 100 -XfrmInStateSeqError 6000 -XfrmInStateExpired 4 -XfrmInStateMismatch 23451 -XfrmInStateInvalid 55555 -XfrmInTmplMismatch 51 -XfrmInNoPols 65432 -XfrmInPolBlock 100 -XfrmInPolError 10000 -XfrmOutError 1000000 -XfrmOutBundleGenError 43321 -XfrmOutBundleCheckError 555 -XfrmOutNoStates 869 -XfrmOutStateProtoError 4542 -XfrmOutStateModeError 4 -XfrmOutStateSeqError 543 -XfrmOutStateExpired 565 -XfrmOutPolBlock 43456 -XfrmOutPolDead 7656 -XfrmOutPolError 1454 -XfrmFwdHdrError 6654 -XfrmOutStateInvalid 28765 -XfrmAcquireError 24532 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/self -SymlinkTo: 26231 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/stat -Lines: 16 -cpu 301854 612 111922 8979004 3552 2 3944 0 0 0 -cpu0 44490 19 21045 1087069 220 1 3410 0 0 0 -cpu1 47869 23 16474 1110787 591 0 46 0 0 0 -cpu2 46504 36 15916 1112321 441 0 326 0 0 0 -cpu3 47054 102 15683 1113230 533 0 60 0 0 0 -c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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -ctxt 38014093 -btime 1418183276 -processes 26442 -procs_running 2 -procs_blocked 1 -softirq 5057579 250191 1481983 1647 211099 186066 0 1783454 622196 12499 508444 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/symlinktargets -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/symlinktargets/README -Lines: 2 -This directory contains some empty files that are the symlinks the files in the "fd" directory point to. -They are otherwise ignored by the tests -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/symlinktargets/abc -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/symlinktargets/def -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/symlinktargets/ghi -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/symlinktargets/uvw -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/symlinktargets/xyz -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/.unpacked -Lines: 0 -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/github.com/prometheus/procfs/fs.go b/vendor/github.com/prometheus/procfs/fs.go deleted file mode 100644 index b6c6b2ce1..000000000 --- a/vendor/github.com/prometheus/procfs/fs.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "fmt" - "os" - "path" - - "github.com/prometheus/procfs/nfs" - "github.com/prometheus/procfs/xfs" -) - -// FS represents the pseudo-filesystem proc, which provides an interface to -// kernel data structures. -type FS string - -// DefaultMountPoint is the common mount point of the proc filesystem. -const DefaultMountPoint = "/proc" - -// NewFS returns a new FS mounted under the given mountPoint. It will error -// if the mount point can't be read. -func NewFS(mountPoint string) (FS, error) { - info, err := os.Stat(mountPoint) - if err != nil { - return "", fmt.Errorf("could not read %s: %s", mountPoint, err) - } - if !info.IsDir() { - return "", fmt.Errorf("mount point %s is not a directory", mountPoint) - } - - return FS(mountPoint), nil -} - -// Path returns the path of the given subsystem relative to the procfs root. -func (fs FS) Path(p ...string) string { - return path.Join(append([]string{string(fs)}, p...)...) -} - -// XFSStats retrieves XFS filesystem runtime statistics. -func (fs FS) XFSStats() (*xfs.Stats, error) { - f, err := os.Open(fs.Path("fs/xfs/stat")) - if err != nil { - return nil, err - } - defer f.Close() - - return xfs.ParseStats(f) -} - -// NFSClientRPCStats retrieves NFS client RPC statistics. -func (fs FS) NFSClientRPCStats() (*nfs.ClientRPCStats, error) { - f, err := os.Open(fs.Path("net/rpc/nfs")) - if err != nil { - return nil, err - } - defer f.Close() - - return nfs.ParseClientRPCStats(f) -} - -// NFSdServerRPCStats retrieves NFS daemon RPC statistics. -func (fs FS) NFSdServerRPCStats() (*nfs.ServerRPCStats, error) { - f, err := os.Open(fs.Path("net/rpc/nfsd")) - if err != nil { - return nil, err - } - defer f.Close() - - return nfs.ParseServerRPCStats(f) -} diff --git a/vendor/github.com/prometheus/procfs/fs_test.go b/vendor/github.com/prometheus/procfs/fs_test.go deleted file mode 100644 index a4e07f5c8..000000000 --- a/vendor/github.com/prometheus/procfs/fs_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import "testing" - -func TestNewFS(t *testing.T) { - if _, err := NewFS("foobar"); err == nil { - t.Error("want NewFS to fail for non-existing mount point") - } - - if _, err := NewFS("procfs.go"); err == nil { - t.Error("want NewFS to fail if mount point is not a directory") - } -} - -func TestFSXFSStats(t *testing.T) { - stats, err := FS("fixtures").XFSStats() - if err != nil { - t.Fatalf("failed to parse XFS stats: %v", err) - } - - // Very lightweight test just to sanity check the path used - // to open XFS stats. Heavier tests in package xfs. - if want, got := uint32(92447), stats.ExtentAllocation.ExtentsAllocated; want != got { - t.Errorf("unexpected extents allocated:\nwant: %d\nhave: %d", want, got) - } -} diff --git a/vendor/github.com/prometheus/procfs/internal/util/parse.go b/vendor/github.com/prometheus/procfs/internal/util/parse.go deleted file mode 100644 index 2ff228e9d..000000000 --- a/vendor/github.com/prometheus/procfs/internal/util/parse.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2018 The Prometheus 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 util - -import ( - "io/ioutil" - "strconv" - "strings" -) - -// ParseUint32s parses a slice of strings into a slice of uint32s. -func ParseUint32s(ss []string) ([]uint32, error) { - us := make([]uint32, 0, len(ss)) - for _, s := range ss { - u, err := strconv.ParseUint(s, 10, 32) - if err != nil { - return nil, err - } - - us = append(us, uint32(u)) - } - - return us, nil -} - -// ParseUint64s parses a slice of strings into a slice of uint64s. -func ParseUint64s(ss []string) ([]uint64, error) { - us := make([]uint64, 0, len(ss)) - for _, s := range ss { - u, err := strconv.ParseUint(s, 10, 64) - if err != nil { - return nil, err - } - - us = append(us, u) - } - - return us, nil -} - -// ReadUintFromFile reads a file and attempts to parse a uint64 from it. -func ReadUintFromFile(path string) (uint64, error) { - data, err := ioutil.ReadFile(path) - if err != nil { - return 0, err - } - return strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64) -} diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_linux.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_linux.go deleted file mode 100644 index df0d567b7..000000000 --- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_linux.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2018 The Prometheus 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. - -// +build !windows - -package util - -import ( - "bytes" - "os" - "syscall" -) - -// SysReadFile is a simplified ioutil.ReadFile that invokes syscall.Read directly. -// https://github.com/prometheus/node_exporter/pull/728/files -func SysReadFile(file string) (string, error) { - f, err := os.Open(file) - if err != nil { - return "", err - } - defer f.Close() - - // On some machines, hwmon drivers are broken and return EAGAIN. This causes - // Go's ioutil.ReadFile implementation to poll forever. - // - // Since we either want to read data or bail immediately, do the simplest - // possible read using syscall directly. - b := make([]byte, 128) - n, err := syscall.Read(int(f.Fd()), b) - if err != nil { - return "", err - } - - return string(bytes.TrimSpace(b[:n])), nil -} diff --git a/vendor/github.com/prometheus/procfs/ipvs.go b/vendor/github.com/prometheus/procfs/ipvs.go deleted file mode 100644 index e36d4a3bd..000000000 --- a/vendor/github.com/prometheus/procfs/ipvs.go +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "bufio" - "encoding/hex" - "errors" - "fmt" - "io" - "io/ioutil" - "net" - "os" - "strconv" - "strings" -) - -// IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`. -type IPVSStats struct { - // Total count of connections. - Connections uint64 - // Total incoming packages processed. - IncomingPackets uint64 - // Total outgoing packages processed. - OutgoingPackets uint64 - // Total incoming traffic. - IncomingBytes uint64 - // Total outgoing traffic. - OutgoingBytes uint64 -} - -// IPVSBackendStatus holds current metrics of one virtual / real address pair. -type IPVSBackendStatus struct { - // The local (virtual) IP address. - LocalAddress net.IP - // The remote (real) IP address. - RemoteAddress net.IP - // The local (virtual) port. - LocalPort uint16 - // The remote (real) port. - RemotePort uint16 - // The local firewall mark - LocalMark string - // The transport protocol (TCP, UDP). - Proto string - // The current number of active connections for this virtual/real address pair. - ActiveConn uint64 - // The current number of inactive connections for this virtual/real address pair. - InactConn uint64 - // The current weight of this virtual/real address pair. - Weight uint64 -} - -// NewIPVSStats reads the IPVS statistics. -func NewIPVSStats() (IPVSStats, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return IPVSStats{}, err - } - - return fs.NewIPVSStats() -} - -// NewIPVSStats reads the IPVS statistics from the specified `proc` filesystem. -func (fs FS) NewIPVSStats() (IPVSStats, error) { - file, err := os.Open(fs.Path("net/ip_vs_stats")) - if err != nil { - return IPVSStats{}, err - } - defer file.Close() - - return parseIPVSStats(file) -} - -// parseIPVSStats performs the actual parsing of `ip_vs_stats`. -func parseIPVSStats(file io.Reader) (IPVSStats, error) { - var ( - statContent []byte - statLines []string - statFields []string - stats IPVSStats - ) - - statContent, err := ioutil.ReadAll(file) - if err != nil { - return IPVSStats{}, err - } - - statLines = strings.SplitN(string(statContent), "\n", 4) - if len(statLines) != 4 { - return IPVSStats{}, errors.New("ip_vs_stats corrupt: too short") - } - - statFields = strings.Fields(statLines[2]) - if len(statFields) != 5 { - return IPVSStats{}, errors.New("ip_vs_stats corrupt: unexpected number of fields") - } - - stats.Connections, err = strconv.ParseUint(statFields[0], 16, 64) - if err != nil { - return IPVSStats{}, err - } - stats.IncomingPackets, err = strconv.ParseUint(statFields[1], 16, 64) - if err != nil { - return IPVSStats{}, err - } - stats.OutgoingPackets, err = strconv.ParseUint(statFields[2], 16, 64) - if err != nil { - return IPVSStats{}, err - } - stats.IncomingBytes, err = strconv.ParseUint(statFields[3], 16, 64) - if err != nil { - return IPVSStats{}, err - } - stats.OutgoingBytes, err = strconv.ParseUint(statFields[4], 16, 64) - if err != nil { - return IPVSStats{}, err - } - - return stats, nil -} - -// NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs. -func NewIPVSBackendStatus() ([]IPVSBackendStatus, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return []IPVSBackendStatus{}, err - } - - return fs.NewIPVSBackendStatus() -} - -// NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem. -func (fs FS) NewIPVSBackendStatus() ([]IPVSBackendStatus, error) { - file, err := os.Open(fs.Path("net/ip_vs")) - if err != nil { - return nil, err - } - defer file.Close() - - return parseIPVSBackendStatus(file) -} - -func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) { - var ( - status []IPVSBackendStatus - scanner = bufio.NewScanner(file) - proto string - localMark string - localAddress net.IP - localPort uint16 - err error - ) - - for scanner.Scan() { - fields := strings.Fields(scanner.Text()) - if len(fields) == 0 { - continue - } - switch { - case fields[0] == "IP" || fields[0] == "Prot" || fields[1] == "RemoteAddress:Port": - continue - case fields[0] == "TCP" || fields[0] == "UDP": - if len(fields) < 2 { - continue - } - proto = fields[0] - localMark = "" - localAddress, localPort, err = parseIPPort(fields[1]) - if err != nil { - return nil, err - } - case fields[0] == "FWM": - if len(fields) < 2 { - continue - } - proto = fields[0] - localMark = fields[1] - localAddress = nil - localPort = 0 - case fields[0] == "->": - if len(fields) < 6 { - continue - } - remoteAddress, remotePort, err := parseIPPort(fields[1]) - if err != nil { - return nil, err - } - weight, err := strconv.ParseUint(fields[3], 10, 64) - if err != nil { - return nil, err - } - activeConn, err := strconv.ParseUint(fields[4], 10, 64) - if err != nil { - return nil, err - } - inactConn, err := strconv.ParseUint(fields[5], 10, 64) - if err != nil { - return nil, err - } - status = append(status, IPVSBackendStatus{ - LocalAddress: localAddress, - LocalPort: localPort, - LocalMark: localMark, - RemoteAddress: remoteAddress, - RemotePort: remotePort, - Proto: proto, - Weight: weight, - ActiveConn: activeConn, - InactConn: inactConn, - }) - } - } - return status, nil -} - -func parseIPPort(s string) (net.IP, uint16, error) { - var ( - ip net.IP - err error - ) - - switch len(s) { - case 13: - ip, err = hex.DecodeString(s[0:8]) - if err != nil { - return nil, 0, err - } - case 46: - ip = net.ParseIP(s[1:40]) - if ip == nil { - return nil, 0, fmt.Errorf("invalid IPv6 address: %s", s[1:40]) - } - default: - return nil, 0, fmt.Errorf("unexpected IP:Port: %s", s) - } - - portString := s[len(s)-4:] - if len(portString) != 4 { - return nil, 0, fmt.Errorf("unexpected port string format: %s", portString) - } - port, err := strconv.ParseUint(portString, 16, 16) - if err != nil { - return nil, 0, err - } - - return ip, uint16(port), nil -} diff --git a/vendor/github.com/prometheus/procfs/ipvs_test.go b/vendor/github.com/prometheus/procfs/ipvs_test.go deleted file mode 100644 index 9c34e6d0d..000000000 --- a/vendor/github.com/prometheus/procfs/ipvs_test.go +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "net" - "testing" -) - -var ( - expectedIPVSStats = IPVSStats{ - Connections: 23765872, - IncomingPackets: 3811989221, - OutgoingPackets: 0, - IncomingBytes: 89991519156915, - OutgoingBytes: 0, - } - expectedIPVSBackendStatuses = []IPVSBackendStatus{ - { - LocalAddress: net.ParseIP("192.168.0.22"), - LocalPort: 3306, - RemoteAddress: net.ParseIP("192.168.82.22"), - RemotePort: 3306, - Proto: "TCP", - Weight: 100, - ActiveConn: 248, - InactConn: 2, - }, - { - LocalAddress: net.ParseIP("192.168.0.22"), - LocalPort: 3306, - RemoteAddress: net.ParseIP("192.168.83.24"), - RemotePort: 3306, - Proto: "TCP", - Weight: 100, - ActiveConn: 248, - InactConn: 2, - }, - { - LocalAddress: net.ParseIP("192.168.0.22"), - LocalPort: 3306, - RemoteAddress: net.ParseIP("192.168.83.21"), - RemotePort: 3306, - Proto: "TCP", - Weight: 100, - ActiveConn: 248, - InactConn: 1, - }, - { - LocalAddress: net.ParseIP("192.168.0.57"), - LocalPort: 3306, - RemoteAddress: net.ParseIP("192.168.84.22"), - RemotePort: 3306, - Proto: "TCP", - Weight: 0, - ActiveConn: 0, - InactConn: 0, - }, - { - LocalAddress: net.ParseIP("192.168.0.57"), - LocalPort: 3306, - RemoteAddress: net.ParseIP("192.168.82.21"), - RemotePort: 3306, - Proto: "TCP", - Weight: 100, - ActiveConn: 1499, - InactConn: 0, - }, - { - LocalAddress: net.ParseIP("192.168.0.57"), - LocalPort: 3306, - RemoteAddress: net.ParseIP("192.168.50.21"), - RemotePort: 3306, - Proto: "TCP", - Weight: 100, - ActiveConn: 1498, - InactConn: 0, - }, - { - LocalAddress: net.ParseIP("192.168.0.55"), - LocalPort: 3306, - RemoteAddress: net.ParseIP("192.168.50.26"), - RemotePort: 3306, - Proto: "TCP", - Weight: 0, - ActiveConn: 0, - InactConn: 0, - }, - { - LocalAddress: net.ParseIP("192.168.0.55"), - LocalPort: 3306, - RemoteAddress: net.ParseIP("192.168.49.32"), - RemotePort: 3306, - Proto: "TCP", - Weight: 100, - ActiveConn: 0, - InactConn: 0, - }, - { - LocalAddress: net.ParseIP("2620::1"), - LocalPort: 80, - RemoteAddress: net.ParseIP("2620::2"), - RemotePort: 80, - Proto: "TCP", - Weight: 1, - ActiveConn: 0, - InactConn: 0, - }, - { - LocalAddress: net.ParseIP("2620::1"), - LocalPort: 80, - RemoteAddress: net.ParseIP("2620::3"), - RemotePort: 80, - Proto: "TCP", - Weight: 1, - ActiveConn: 0, - InactConn: 0, - }, - { - LocalAddress: net.ParseIP("2620::1"), - LocalPort: 80, - RemoteAddress: net.ParseIP("2620::4"), - RemotePort: 80, - Proto: "TCP", - Weight: 1, - ActiveConn: 1, - InactConn: 1, - }, - { - LocalMark: "10001000", - RemoteAddress: net.ParseIP("192.168.50.26"), - RemotePort: 3306, - Proto: "FWM", - Weight: 0, - ActiveConn: 0, - InactConn: 1, - }, - { - LocalMark: "10001000", - RemoteAddress: net.ParseIP("192.168.50.21"), - RemotePort: 3306, - Proto: "FWM", - Weight: 0, - ActiveConn: 0, - InactConn: 2, - }, - } -) - -func TestIPVSStats(t *testing.T) { - stats, err := FS("fixtures").NewIPVSStats() - if err != nil { - t.Fatal(err) - } - - if stats != expectedIPVSStats { - t.Errorf("want %+v, have %+v", expectedIPVSStats, stats) - } -} - -func TestParseIPPort(t *testing.T) { - ip := net.ParseIP("192.168.0.22") - port := uint16(3306) - - gotIP, gotPort, err := parseIPPort("C0A80016:0CEA") - if err != nil { - t.Fatal(err) - } - if !(gotIP.Equal(ip) && port == gotPort) { - t.Errorf("want %s:%d, have %s:%d", ip, port, gotIP, gotPort) - } -} - -func TestParseIPPortInvalid(t *testing.T) { - testcases := []string{ - "", - "C0A80016", - "C0A800:1234", - "FOOBARBA:1234", - "C0A80016:0CEA:1234", - } - - for _, s := range testcases { - ip, port, err := parseIPPort(s) - if ip != nil || port != uint16(0) || err == nil { - t.Errorf("Expected error for input %s, have ip = %s, port = %v, err = %v", s, ip, port, err) - } - } -} - -func TestParseIPPortIPv6(t *testing.T) { - ip := net.ParseIP("dead:beef::1") - port := uint16(8080) - - gotIP, gotPort, err := parseIPPort("[DEAD:BEEF:0000:0000:0000:0000:0000:0001]:1F90") - if err != nil { - t.Fatal(err) - } - if !(gotIP.Equal(ip) && port == gotPort) { - t.Errorf("want %s:%d, have %s:%d", ip, port, gotIP, gotPort) - } -} - -func TestIPVSBackendStatus(t *testing.T) { - backendStats, err := FS("fixtures").NewIPVSBackendStatus() - if err != nil { - t.Fatal(err) - } - if want, have := len(expectedIPVSBackendStatuses), len(backendStats); want != have { - t.Fatalf("want %d backend statuses, have %d", want, have) - } - - for idx, expect := range expectedIPVSBackendStatuses { - if !backendStats[idx].LocalAddress.Equal(expect.LocalAddress) { - t.Errorf("want LocalAddress %s, have %s", expect.LocalAddress, backendStats[idx].LocalAddress) - } - if backendStats[idx].LocalPort != expect.LocalPort { - t.Errorf("want LocalPort %d, have %d", expect.LocalPort, backendStats[idx].LocalPort) - } - if !backendStats[idx].RemoteAddress.Equal(expect.RemoteAddress) { - t.Errorf("want RemoteAddress %s, have %s", expect.RemoteAddress, backendStats[idx].RemoteAddress) - } - if backendStats[idx].RemotePort != expect.RemotePort { - t.Errorf("want RemotePort %d, have %d", expect.RemotePort, backendStats[idx].RemotePort) - } - if backendStats[idx].Proto != expect.Proto { - t.Errorf("want Proto %s, have %s", expect.Proto, backendStats[idx].Proto) - } - if backendStats[idx].Weight != expect.Weight { - t.Errorf("want Weight %d, have %d", expect.Weight, backendStats[idx].Weight) - } - if backendStats[idx].ActiveConn != expect.ActiveConn { - t.Errorf("want ActiveConn %d, have %d", expect.ActiveConn, backendStats[idx].ActiveConn) - } - if backendStats[idx].InactConn != expect.InactConn { - t.Errorf("want InactConn %d, have %d", expect.InactConn, backendStats[idx].InactConn) - } - } -} diff --git a/vendor/github.com/prometheus/procfs/mdstat.go b/vendor/github.com/prometheus/procfs/mdstat.go deleted file mode 100644 index 9dc19583d..000000000 --- a/vendor/github.com/prometheus/procfs/mdstat.go +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "fmt" - "io/ioutil" - "regexp" - "strconv" - "strings" -) - -var ( - statuslineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`) - buildlineRE = regexp.MustCompile(`\((\d+)/\d+\)`) -) - -// MDStat holds info parsed from /proc/mdstat. -type MDStat struct { - // Name of the device. - Name string - // activity-state of the device. - ActivityState string - // Number of active disks. - DisksActive int64 - // Total number of disks the device consists of. - DisksTotal int64 - // Number of blocks the device holds. - BlocksTotal int64 - // Number of blocks on the device that are in sync. - BlocksSynced int64 -} - -// ParseMDStat parses an mdstat-file and returns a struct with the relevant infos. -func (fs FS) ParseMDStat() (mdstates []MDStat, err error) { - mdStatusFilePath := fs.Path("mdstat") - content, err := ioutil.ReadFile(mdStatusFilePath) - if err != nil { - return []MDStat{}, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) - } - - mdStates := []MDStat{} - lines := strings.Split(string(content), "\n") - for i, l := range lines { - if l == "" { - continue - } - if l[0] == ' ' { - continue - } - if strings.HasPrefix(l, "Personalities") || strings.HasPrefix(l, "unused") { - continue - } - - mainLine := strings.Split(l, " ") - if len(mainLine) < 3 { - return mdStates, fmt.Errorf("error parsing mdline: %s", l) - } - mdName := mainLine[0] - activityState := mainLine[2] - - if len(lines) <= i+3 { - return mdStates, fmt.Errorf( - "error parsing %s: too few lines for md device %s", - mdStatusFilePath, - mdName, - ) - } - - active, total, size, err := evalStatusline(lines[i+1]) - if err != nil { - return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) - } - - // j is the line number of the syncing-line. - j := i + 2 - if strings.Contains(lines[i+2], "bitmap") { // skip bitmap line - j = i + 3 - } - - // If device is syncing at the moment, get the number of currently - // synced bytes, otherwise that number equals the size of the device. - syncedBlocks := size - if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") { - syncedBlocks, err = evalBuildline(lines[j]) - if err != nil { - return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) - } - } - - mdStates = append(mdStates, MDStat{ - Name: mdName, - ActivityState: activityState, - DisksActive: active, - DisksTotal: total, - BlocksTotal: size, - BlocksSynced: syncedBlocks, - }) - } - - return mdStates, nil -} - -func evalStatusline(statusline string) (active, total, size int64, err error) { - matches := statuslineRE.FindStringSubmatch(statusline) - if len(matches) != 4 { - return 0, 0, 0, fmt.Errorf("unexpected statusline: %s", statusline) - } - - size, err = strconv.ParseInt(matches[1], 10, 64) - if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) - } - - total, err = strconv.ParseInt(matches[2], 10, 64) - if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) - } - - active, err = strconv.ParseInt(matches[3], 10, 64) - if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) - } - - return active, total, size, nil -} - -func evalBuildline(buildline string) (syncedBlocks int64, err error) { - matches := buildlineRE.FindStringSubmatch(buildline) - if len(matches) != 2 { - return 0, fmt.Errorf("unexpected buildline: %s", buildline) - } - - syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64) - if err != nil { - return 0, fmt.Errorf("%s in buildline: %s", err, buildline) - } - - return syncedBlocks, nil -} diff --git a/vendor/github.com/prometheus/procfs/mdstat_test.go b/vendor/github.com/prometheus/procfs/mdstat_test.go deleted file mode 100644 index 8819228f1..000000000 --- a/vendor/github.com/prometheus/procfs/mdstat_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "testing" -) - -func TestMDStat(t *testing.T) { - mdStates, err := FS("fixtures").ParseMDStat() - if err != nil { - t.Fatalf("parsing of reference-file failed entirely: %s", err) - } - - refs := map[string]MDStat{ - "md3": {"md3", "active", 8, 8, 5853468288, 5853468288}, - "md127": {"md127", "active", 2, 2, 312319552, 312319552}, - "md0": {"md0", "active", 2, 2, 248896, 248896}, - "md4": {"md4", "inactive", 2, 2, 4883648, 4883648}, - "md6": {"md6", "active", 1, 2, 195310144, 16775552}, - "md8": {"md8", "active", 2, 2, 195310144, 16775552}, - "md7": {"md7", "active", 3, 4, 7813735424, 7813735424}, - } - - if want, have := len(refs), len(mdStates); want != have { - t.Errorf("want %d parsed md-devices, have %d", want, have) - } - for _, md := range mdStates { - if want, have := refs[md.Name], md; want != have { - t.Errorf("%s: want %v, have %v", md.Name, want, have) - } - } -} diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go deleted file mode 100644 index 7a8a1e099..000000000 --- a/vendor/github.com/prometheus/procfs/mountstats.go +++ /dev/null @@ -1,606 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -// While implementing parsing of /proc/[pid]/mountstats, this blog was used -// heavily as a reference: -// https://utcc.utoronto.ca/~cks/space/blog/linux/NFSMountstatsIndex -// -// Special thanks to Chris Siebenmann for all of his posts explaining the -// various statistics available for NFS. - -import ( - "bufio" - "fmt" - "io" - "strconv" - "strings" - "time" -) - -// Constants shared between multiple functions. -const ( - deviceEntryLen = 8 - - fieldBytesLen = 8 - fieldEventsLen = 27 - - statVersion10 = "1.0" - statVersion11 = "1.1" - - fieldTransport10TCPLen = 10 - fieldTransport10UDPLen = 7 - - fieldTransport11TCPLen = 13 - fieldTransport11UDPLen = 10 -) - -// A Mount is a device mount parsed from /proc/[pid]/mountstats. -type Mount struct { - // Name of the device. - Device string - // The mount point of the device. - Mount string - // The filesystem type used by the device. - Type string - // If available additional statistics related to this Mount. - // Use a type assertion to determine if additional statistics are available. - Stats MountStats -} - -// A MountStats is a type which contains detailed statistics for a specific -// type of Mount. -type MountStats interface { - mountStats() -} - -// A MountStatsNFS is a MountStats implementation for NFSv3 and v4 mounts. -type MountStatsNFS struct { - // The version of statistics provided. - StatVersion string - // The age of the NFS mount. - Age time.Duration - // Statistics related to byte counters for various operations. - Bytes NFSBytesStats - // Statistics related to various NFS event occurrences. - Events NFSEventsStats - // Statistics broken down by filesystem operation. - Operations []NFSOperationStats - // Statistics about the NFS RPC transport. - Transport NFSTransportStats -} - -// mountStats implements MountStats. -func (m MountStatsNFS) mountStats() {} - -// A NFSBytesStats contains statistics about the number of bytes read and written -// by an NFS client to and from an NFS server. -type NFSBytesStats struct { - // Number of bytes read using the read() syscall. - Read uint64 - // Number of bytes written using the write() syscall. - Write uint64 - // Number of bytes read using the read() syscall in O_DIRECT mode. - DirectRead uint64 - // Number of bytes written using the write() syscall in O_DIRECT mode. - DirectWrite uint64 - // Number of bytes read from the NFS server, in total. - ReadTotal uint64 - // Number of bytes written to the NFS server, in total. - WriteTotal uint64 - // Number of pages read directly via mmap()'d files. - ReadPages uint64 - // Number of pages written directly via mmap()'d files. - WritePages uint64 -} - -// A NFSEventsStats contains statistics about NFS event occurrences. -type NFSEventsStats struct { - // Number of times cached inode attributes are re-validated from the server. - InodeRevalidate uint64 - // Number of times cached dentry nodes are re-validated from the server. - DnodeRevalidate uint64 - // Number of times an inode cache is cleared. - DataInvalidate uint64 - // Number of times cached inode attributes are invalidated. - AttributeInvalidate uint64 - // Number of times files or directories have been open()'d. - VFSOpen uint64 - // Number of times a directory lookup has occurred. - VFSLookup uint64 - // Number of times permissions have been checked. - VFSAccess uint64 - // Number of updates (and potential writes) to pages. - VFSUpdatePage uint64 - // Number of pages read directly via mmap()'d files. - VFSReadPage uint64 - // Number of times a group of pages have been read. - VFSReadPages uint64 - // Number of pages written directly via mmap()'d files. - VFSWritePage uint64 - // Number of times a group of pages have been written. - VFSWritePages uint64 - // Number of times directory entries have been read with getdents(). - VFSGetdents uint64 - // Number of times attributes have been set on inodes. - VFSSetattr uint64 - // Number of pending writes that have been forcefully flushed to the server. - VFSFlush uint64 - // Number of times fsync() has been called on directories and files. - VFSFsync uint64 - // Number of times locking has been attempted on a file. - VFSLock uint64 - // Number of times files have been closed and released. - VFSFileRelease uint64 - // Unknown. Possibly unused. - CongestionWait uint64 - // Number of times files have been truncated. - Truncation uint64 - // Number of times a file has been grown due to writes beyond its existing end. - WriteExtension uint64 - // Number of times a file was removed while still open by another process. - SillyRename uint64 - // Number of times the NFS server gave less data than expected while reading. - ShortRead uint64 - // Number of times the NFS server wrote less data than expected while writing. - ShortWrite uint64 - // Number of times the NFS server indicated EJUKEBOX; retrieving data from - // offline storage. - JukeboxDelay uint64 - // Number of NFS v4.1+ pNFS reads. - PNFSRead uint64 - // Number of NFS v4.1+ pNFS writes. - PNFSWrite uint64 -} - -// A NFSOperationStats contains statistics for a single operation. -type NFSOperationStats struct { - // The name of the operation. - Operation string - // Number of requests performed for this operation. - Requests uint64 - // Number of times an actual RPC request has been transmitted for this operation. - Transmissions uint64 - // Number of times a request has had a major timeout. - MajorTimeouts uint64 - // Number of bytes sent for this operation, including RPC headers and payload. - BytesSent uint64 - // Number of bytes received for this operation, including RPC headers and payload. - BytesReceived uint64 - // Duration all requests spent queued for transmission before they were sent. - CumulativeQueueTime time.Duration - // Duration it took to get a reply back after the request was transmitted. - CumulativeTotalResponseTime time.Duration - // Duration from when a request was enqueued to when it was completely handled. - CumulativeTotalRequestTime time.Duration -} - -// A NFSTransportStats contains statistics for the NFS mount RPC requests and -// responses. -type NFSTransportStats struct { - // The transport protocol used for the NFS mount. - Protocol string - // The local port used for the NFS mount. - Port uint64 - // Number of times the client has had to establish a connection from scratch - // to the NFS server. - Bind uint64 - // Number of times the client has made a TCP connection to the NFS server. - Connect uint64 - // Duration (in jiffies, a kernel internal unit of time) the NFS mount has - // spent waiting for connections to the server to be established. - ConnectIdleTime uint64 - // Duration since the NFS mount last saw any RPC traffic. - IdleTime time.Duration - // Number of RPC requests for this mount sent to the NFS server. - Sends uint64 - // Number of RPC responses for this mount received from the NFS server. - Receives uint64 - // Number of times the NFS server sent a response with a transaction ID - // unknown to this client. - BadTransactionIDs uint64 - // A running counter, incremented on each request as the current difference - // ebetween sends and receives. - CumulativeActiveRequests uint64 - // A running counter, incremented on each request by the current backlog - // queue size. - CumulativeBacklog uint64 - - // Stats below only available with stat version 1.1. - - // Maximum number of simultaneously active RPC requests ever used. - MaximumRPCSlotsUsed uint64 - // A running counter, incremented on each request as the current size of the - // sending queue. - CumulativeSendingQueue uint64 - // A running counter, incremented on each request as the current size of the - // pending queue. - CumulativePendingQueue uint64 -} - -// parseMountStats parses a /proc/[pid]/mountstats file and returns a slice -// of Mount structures containing detailed information about each mount. -// If available, statistics for each mount are parsed as well. -func parseMountStats(r io.Reader) ([]*Mount, error) { - const ( - device = "device" - statVersionPrefix = "statvers=" - - nfs3Type = "nfs" - nfs4Type = "nfs4" - ) - - var mounts []*Mount - - s := bufio.NewScanner(r) - for s.Scan() { - // Only look for device entries in this function - ss := strings.Fields(string(s.Bytes())) - if len(ss) == 0 || ss[0] != device { - continue - } - - m, err := parseMount(ss) - if err != nil { - return nil, err - } - - // Does this mount also possess statistics information? - if len(ss) > deviceEntryLen { - // Only NFSv3 and v4 are supported for parsing statistics - if m.Type != nfs3Type && m.Type != nfs4Type { - return nil, fmt.Errorf("cannot parse MountStats for fstype %q", m.Type) - } - - statVersion := strings.TrimPrefix(ss[8], statVersionPrefix) - - stats, err := parseMountStatsNFS(s, statVersion) - if err != nil { - return nil, err - } - - m.Stats = stats - } - - mounts = append(mounts, m) - } - - return mounts, s.Err() -} - -// parseMount parses an entry in /proc/[pid]/mountstats in the format: -// device [device] mounted on [mount] with fstype [type] -func parseMount(ss []string) (*Mount, error) { - if len(ss) < deviceEntryLen { - return nil, fmt.Errorf("invalid device entry: %v", ss) - } - - // Check for specific words appearing at specific indices to ensure - // the format is consistent with what we expect - format := []struct { - i int - s string - }{ - {i: 0, s: "device"}, - {i: 2, s: "mounted"}, - {i: 3, s: "on"}, - {i: 5, s: "with"}, - {i: 6, s: "fstype"}, - } - - for _, f := range format { - if ss[f.i] != f.s { - return nil, fmt.Errorf("invalid device entry: %v", ss) - } - } - - return &Mount{ - Device: ss[1], - Mount: ss[4], - Type: ss[7], - }, nil -} - -// parseMountStatsNFS parses a MountStatsNFS by scanning additional information -// related to NFS statistics. -func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, error) { - // Field indicators for parsing specific types of data - const ( - fieldAge = "age:" - fieldBytes = "bytes:" - fieldEvents = "events:" - fieldPerOpStats = "per-op" - fieldTransport = "xprt:" - ) - - stats := &MountStatsNFS{ - StatVersion: statVersion, - } - - for s.Scan() { - ss := strings.Fields(string(s.Bytes())) - if len(ss) == 0 { - break - } - if len(ss) < 2 { - return nil, fmt.Errorf("not enough information for NFS stats: %v", ss) - } - - switch ss[0] { - case fieldAge: - // Age integer is in seconds - d, err := time.ParseDuration(ss[1] + "s") - if err != nil { - return nil, err - } - - stats.Age = d - case fieldBytes: - bstats, err := parseNFSBytesStats(ss[1:]) - if err != nil { - return nil, err - } - - stats.Bytes = *bstats - case fieldEvents: - estats, err := parseNFSEventsStats(ss[1:]) - if err != nil { - return nil, err - } - - stats.Events = *estats - case fieldTransport: - if len(ss) < 3 { - return nil, fmt.Errorf("not enough information for NFS transport stats: %v", ss) - } - - tstats, err := parseNFSTransportStats(ss[1:], statVersion) - if err != nil { - return nil, err - } - - stats.Transport = *tstats - } - - // When encountering "per-operation statistics", we must break this - // loop and parse them separately to ensure we can terminate parsing - // before reaching another device entry; hence why this 'if' statement - // is not just another switch case - if ss[0] == fieldPerOpStats { - break - } - } - - if err := s.Err(); err != nil { - return nil, err - } - - // NFS per-operation stats appear last before the next device entry - perOpStats, err := parseNFSOperationStats(s) - if err != nil { - return nil, err - } - - stats.Operations = perOpStats - - return stats, nil -} - -// parseNFSBytesStats parses a NFSBytesStats line using an input set of -// integer fields. -func parseNFSBytesStats(ss []string) (*NFSBytesStats, error) { - if len(ss) != fieldBytesLen { - return nil, fmt.Errorf("invalid NFS bytes stats: %v", ss) - } - - ns := make([]uint64, 0, fieldBytesLen) - for _, s := range ss { - n, err := strconv.ParseUint(s, 10, 64) - if err != nil { - return nil, err - } - - ns = append(ns, n) - } - - return &NFSBytesStats{ - Read: ns[0], - Write: ns[1], - DirectRead: ns[2], - DirectWrite: ns[3], - ReadTotal: ns[4], - WriteTotal: ns[5], - ReadPages: ns[6], - WritePages: ns[7], - }, nil -} - -// parseNFSEventsStats parses a NFSEventsStats line using an input set of -// integer fields. -func parseNFSEventsStats(ss []string) (*NFSEventsStats, error) { - if len(ss) != fieldEventsLen { - return nil, fmt.Errorf("invalid NFS events stats: %v", ss) - } - - ns := make([]uint64, 0, fieldEventsLen) - for _, s := range ss { - n, err := strconv.ParseUint(s, 10, 64) - if err != nil { - return nil, err - } - - ns = append(ns, n) - } - - return &NFSEventsStats{ - InodeRevalidate: ns[0], - DnodeRevalidate: ns[1], - DataInvalidate: ns[2], - AttributeInvalidate: ns[3], - VFSOpen: ns[4], - VFSLookup: ns[5], - VFSAccess: ns[6], - VFSUpdatePage: ns[7], - VFSReadPage: ns[8], - VFSReadPages: ns[9], - VFSWritePage: ns[10], - VFSWritePages: ns[11], - VFSGetdents: ns[12], - VFSSetattr: ns[13], - VFSFlush: ns[14], - VFSFsync: ns[15], - VFSLock: ns[16], - VFSFileRelease: ns[17], - CongestionWait: ns[18], - Truncation: ns[19], - WriteExtension: ns[20], - SillyRename: ns[21], - ShortRead: ns[22], - ShortWrite: ns[23], - JukeboxDelay: ns[24], - PNFSRead: ns[25], - PNFSWrite: ns[26], - }, nil -} - -// parseNFSOperationStats parses a slice of NFSOperationStats by scanning -// additional information about per-operation statistics until an empty -// line is reached. -func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { - const ( - // Number of expected fields in each per-operation statistics set - numFields = 9 - ) - - var ops []NFSOperationStats - - for s.Scan() { - ss := strings.Fields(string(s.Bytes())) - if len(ss) == 0 { - // Must break when reading a blank line after per-operation stats to - // enable top-level function to parse the next device entry - break - } - - if len(ss) != numFields { - return nil, fmt.Errorf("invalid NFS per-operations stats: %v", ss) - } - - // Skip string operation name for integers - ns := make([]uint64, 0, numFields-1) - for _, st := range ss[1:] { - n, err := strconv.ParseUint(st, 10, 64) - if err != nil { - return nil, err - } - - ns = append(ns, n) - } - - ops = append(ops, NFSOperationStats{ - Operation: strings.TrimSuffix(ss[0], ":"), - Requests: ns[0], - Transmissions: ns[1], - MajorTimeouts: ns[2], - BytesSent: ns[3], - BytesReceived: ns[4], - CumulativeQueueTime: time.Duration(ns[5]) * time.Millisecond, - CumulativeTotalResponseTime: time.Duration(ns[6]) * time.Millisecond, - CumulativeTotalRequestTime: time.Duration(ns[7]) * time.Millisecond, - }) - } - - return ops, s.Err() -} - -// parseNFSTransportStats parses a NFSTransportStats line using an input set of -// integer fields matched to a specific stats version. -func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats, error) { - // Extract the protocol field. It is the only string value in the line - protocol := ss[0] - ss = ss[1:] - - switch statVersion { - case statVersion10: - var expectedLength int - if protocol == "tcp" { - expectedLength = fieldTransport10TCPLen - } else if protocol == "udp" { - expectedLength = fieldTransport10UDPLen - } else { - return nil, fmt.Errorf("invalid NFS protocol \"%s\" in stats 1.0 statement: %v", protocol, ss) - } - if len(ss) != expectedLength { - return nil, fmt.Errorf("invalid NFS transport stats 1.0 statement: %v", ss) - } - case statVersion11: - var expectedLength int - if protocol == "tcp" { - expectedLength = fieldTransport11TCPLen - } else if protocol == "udp" { - expectedLength = fieldTransport11UDPLen - } else { - return nil, fmt.Errorf("invalid NFS protocol \"%s\" in stats 1.1 statement: %v", protocol, ss) - } - if len(ss) != expectedLength { - return nil, fmt.Errorf("invalid NFS transport stats 1.1 statement: %v", ss) - } - default: - return nil, fmt.Errorf("unrecognized NFS transport stats version: %q", statVersion) - } - - // Allocate enough for v1.1 stats since zero value for v1.1 stats will be okay - // in a v1.0 response. Since the stat length is bigger for TCP stats, we use - // the TCP length here. - // - // Note: slice length must be set to length of v1.1 stats to avoid a panic when - // only v1.0 stats are present. - // See: https://github.com/prometheus/node_exporter/issues/571. - ns := make([]uint64, fieldTransport11TCPLen) - for i, s := range ss { - n, err := strconv.ParseUint(s, 10, 64) - if err != nil { - return nil, err - } - - ns[i] = n - } - - // The fields differ depending on the transport protocol (TCP or UDP) - // From https://utcc.utoronto.ca/%7Ecks/space/blog/linux/NFSMountstatsXprt - // - // For the udp RPC transport there is no connection count, connect idle time, - // or idle time (fields #3, #4, and #5); all other fields are the same. So - // we set them to 0 here. - if protocol == "udp" { - ns = append(ns[:2], append(make([]uint64, 3), ns[2:]...)...) - } - - return &NFSTransportStats{ - Protocol: protocol, - Port: ns[0], - Bind: ns[1], - Connect: ns[2], - ConnectIdleTime: ns[3], - IdleTime: time.Duration(ns[4]) * time.Second, - Sends: ns[5], - Receives: ns[6], - BadTransactionIDs: ns[7], - CumulativeActiveRequests: ns[8], - CumulativeBacklog: ns[9], - MaximumRPCSlotsUsed: ns[10], - CumulativeSendingQueue: ns[11], - CumulativePendingQueue: ns[12], - }, nil -} diff --git a/vendor/github.com/prometheus/procfs/mountstats_test.go b/vendor/github.com/prometheus/procfs/mountstats_test.go deleted file mode 100644 index 9ae3b02ab..000000000 --- a/vendor/github.com/prometheus/procfs/mountstats_test.go +++ /dev/null @@ -1,380 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "fmt" - "reflect" - "strings" - "testing" - "time" -) - -func TestMountStats(t *testing.T) { - tests := []struct { - name string - s string - mounts []*Mount - invalid bool - }{ - { - name: "no devices", - s: `hello`, - }, - { - name: "device has too few fields", - s: `device foo`, - invalid: true, - }, - { - name: "device incorrect format", - s: `device rootfs BAD on / with fstype rootfs`, - invalid: true, - }, - { - name: "device incorrect format", - s: `device rootfs mounted BAD / with fstype rootfs`, - invalid: true, - }, - { - name: "device incorrect format", - s: `device rootfs mounted on / BAD fstype rootfs`, - invalid: true, - }, - { - name: "device incorrect format", - s: `device rootfs mounted on / with BAD rootfs`, - invalid: true, - }, - { - name: "device rootfs cannot have stats", - s: `device rootfs mounted on / with fstype rootfs stats`, - invalid: true, - }, - { - name: "NFSv4 device with too little info", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nhello", - invalid: true, - }, - { - name: "NFSv4 device with bad bytes", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nbytes: 0", - invalid: true, - }, - { - name: "NFSv4 device with bad events", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nevents: 0", - invalid: true, - }, - { - name: "NFSv4 device with bad per-op stats", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nper-op statistics\nFOO 0", - invalid: true, - }, - { - name: "NFSv4 device with bad transport stats", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nxprt: tcp", - invalid: true, - }, - { - name: "NFSv4 device with bad transport version", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=foo\nxprt: tcp 0", - invalid: true, - }, - { - name: "NFSv4 device with bad transport stats version 1.0", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.0\nxprt: tcp 0 0 0 0 0 0 0 0 0 0 0 0 0", - invalid: true, - }, - { - name: "NFSv4 device with bad transport stats version 1.1", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nxprt: tcp 0 0 0 0 0 0 0 0 0 0", - invalid: true, - }, - { - name: "NFSv3 device with bad transport protocol", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nxprt: tcpx 0 0 0 0 0 0 0 0 0 0", - invalid: true, - }, - { - name: "NFSv3 device using TCP with transport stats version 1.0 OK", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.0\nxprt: tcp 1 2 3 4 5 6 7 8 9 10", - mounts: []*Mount{{ - Device: "192.168.1.1:/srv", - Mount: "/mnt/nfs", - Type: "nfs", - Stats: &MountStatsNFS{ - StatVersion: "1.0", - Transport: NFSTransportStats{ - Protocol: "tcp", - Port: 1, - Bind: 2, - Connect: 3, - ConnectIdleTime: 4, - IdleTime: 5 * time.Second, - Sends: 6, - Receives: 7, - BadTransactionIDs: 8, - CumulativeActiveRequests: 9, - CumulativeBacklog: 10, - MaximumRPCSlotsUsed: 0, // these three are not - CumulativeSendingQueue: 0, // present in statvers=1.0 - CumulativePendingQueue: 0, // - }, - }, - }}, - }, - { - name: "NFSv3 device using UDP with transport stats version 1.0 OK", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.0\nxprt: udp 1 2 3 4 5 6 7", - mounts: []*Mount{{ - Device: "192.168.1.1:/srv", - Mount: "/mnt/nfs", - Type: "nfs", - Stats: &MountStatsNFS{ - StatVersion: "1.0", - Transport: NFSTransportStats{ - Protocol: "udp", - Port: 1, - Bind: 2, - Connect: 0, - ConnectIdleTime: 0, - IdleTime: 0, - Sends: 3, - Receives: 4, - BadTransactionIDs: 5, - CumulativeActiveRequests: 6, - CumulativeBacklog: 7, - MaximumRPCSlotsUsed: 0, // these three are not - CumulativeSendingQueue: 0, // present in statvers=1.0 - CumulativePendingQueue: 0, // - }, - }, - }}, - }, - { - name: "NFSv3 device using TCP with transport stats version 1.1 OK", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1\nxprt: tcp 1 2 3 4 5 6 7 8 9 10 11 12 13", - mounts: []*Mount{{ - Device: "192.168.1.1:/srv", - Mount: "/mnt/nfs", - Type: "nfs", - Stats: &MountStatsNFS{ - StatVersion: "1.1", - Transport: NFSTransportStats{ - Protocol: "tcp", - Port: 1, - Bind: 2, - Connect: 3, - ConnectIdleTime: 4, - IdleTime: 5 * time.Second, - Sends: 6, - Receives: 7, - BadTransactionIDs: 8, - CumulativeActiveRequests: 9, - CumulativeBacklog: 10, - MaximumRPCSlotsUsed: 11, - CumulativeSendingQueue: 12, - CumulativePendingQueue: 13, - }, - }, - }}, - }, - { - name: "NFSv3 device using UDP with transport stats version 1.1 OK", - s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1\nxprt: udp 1 2 3 4 5 6 7 8 9 10", - mounts: []*Mount{{ - Device: "192.168.1.1:/srv", - Mount: "/mnt/nfs", - Type: "nfs", - Stats: &MountStatsNFS{ - StatVersion: "1.1", - Transport: NFSTransportStats{ - Protocol: "udp", - Port: 1, - Bind: 2, - Connect: 0, // these three are not - ConnectIdleTime: 0, // present for UDP - IdleTime: 0, // - Sends: 3, - Receives: 4, - BadTransactionIDs: 5, - CumulativeActiveRequests: 6, - CumulativeBacklog: 7, - MaximumRPCSlotsUsed: 8, - CumulativeSendingQueue: 9, - CumulativePendingQueue: 10, - }, - }, - }}, - }, - { - name: "device rootfs OK", - s: `device rootfs mounted on / with fstype rootfs`, - mounts: []*Mount{{ - Device: "rootfs", - Mount: "/", - Type: "rootfs", - }}, - }, - { - name: "NFSv3 device with minimal stats OK", - s: `device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs statvers=1.1`, - mounts: []*Mount{{ - Device: "192.168.1.1:/srv", - Mount: "/mnt/nfs", - Type: "nfs", - Stats: &MountStatsNFS{ - StatVersion: "1.1", - }, - }}, - }, - { - name: "fixtures OK", - mounts: []*Mount{ - { - Device: "rootfs", - Mount: "/", - Type: "rootfs", - }, - { - Device: "sysfs", - Mount: "/sys", - Type: "sysfs", - }, - { - Device: "proc", - Mount: "/proc", - Type: "proc", - }, - { - Device: "/dev/sda1", - Mount: "/", - Type: "ext4", - }, - { - Device: "192.168.1.1:/srv/test", - Mount: "/mnt/nfs/test", - Type: "nfs4", - Stats: &MountStatsNFS{ - StatVersion: "1.1", - Age: 13968 * time.Second, - Bytes: NFSBytesStats{ - Read: 1207640230, - ReadTotal: 1210214218, - ReadPages: 295483, - }, - Events: NFSEventsStats{ - InodeRevalidate: 52, - DnodeRevalidate: 226, - VFSOpen: 1, - VFSLookup: 13, - VFSAccess: 398, - VFSReadPages: 331, - VFSWritePages: 47, - VFSFlush: 77, - VFSFileRelease: 77, - }, - Operations: []NFSOperationStats{ - { - Operation: "NULL", - }, - { - Operation: "READ", - Requests: 1298, - Transmissions: 1298, - BytesSent: 207680, - BytesReceived: 1210292152, - CumulativeQueueTime: 6 * time.Millisecond, - CumulativeTotalResponseTime: 79386 * time.Millisecond, - CumulativeTotalRequestTime: 79407 * time.Millisecond, - }, - { - Operation: "WRITE", - }, - }, - Transport: NFSTransportStats{ - Protocol: "tcp", - Port: 832, - Connect: 1, - IdleTime: 11 * time.Second, - Sends: 6428, - Receives: 6428, - CumulativeActiveRequests: 12154, - MaximumRPCSlotsUsed: 24, - CumulativeSendingQueue: 26, - CumulativePendingQueue: 5726, - }, - }, - }, - }, - }, - } - - for i, tt := range tests { - t.Logf("[%02d] test %q", i, tt.name) - - var mounts []*Mount - var err error - - if tt.s != "" { - mounts, err = parseMountStats(strings.NewReader(tt.s)) - } else { - proc, e := FS("fixtures").NewProc(26231) - if e != nil { - t.Fatalf("failed to create proc: %v", err) - } - - mounts, err = proc.MountStats() - } - - if tt.invalid && err == nil { - t.Error("expected an error, but none occurred") - } - if !tt.invalid && err != nil { - t.Errorf("unexpected error: %v", err) - } - - if want, have := tt.mounts, mounts; !reflect.DeepEqual(want, have) { - t.Errorf("mounts:\nwant:\n%v\nhave:\n%v", mountsStr(want), mountsStr(have)) - } - } -} - -func mountsStr(mounts []*Mount) string { - var out string - for i, m := range mounts { - out += fmt.Sprintf("[%d] %q on %q (%q)", i, m.Device, m.Mount, m.Type) - - stats, ok := m.Stats.(*MountStatsNFS) - if !ok { - out += "\n" - continue - } - - out += fmt.Sprintf("\n\t- v%s, age: %s", stats.StatVersion, stats.Age) - out += fmt.Sprintf("\n\t- bytes: %v", stats.Bytes) - out += fmt.Sprintf("\n\t- events: %v", stats.Events) - out += fmt.Sprintf("\n\t- transport: %v", stats.Transport) - out += fmt.Sprintf("\n\t- per-operation stats:") - - for _, o := range stats.Operations { - out += fmt.Sprintf("\n\t\t- %v", o) - } - - out += "\n" - } - - return out -} diff --git a/vendor/github.com/prometheus/procfs/net_dev.go b/vendor/github.com/prometheus/procfs/net_dev.go deleted file mode 100644 index 3f2523371..000000000 --- a/vendor/github.com/prometheus/procfs/net_dev.go +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "bufio" - "errors" - "os" - "sort" - "strconv" - "strings" -) - -// NetDevLine is single line parsed from /proc/net/dev or /proc/[pid]/net/dev. -type NetDevLine struct { - Name string `json:"name"` // The name of the interface. - RxBytes uint64 `json:"rx_bytes"` // Cumulative count of bytes received. - RxPackets uint64 `json:"rx_packets"` // Cumulative count of packets received. - RxErrors uint64 `json:"rx_errors"` // Cumulative count of receive errors encountered. - RxDropped uint64 `json:"rx_dropped"` // Cumulative count of packets dropped while receiving. - RxFIFO uint64 `json:"rx_fifo"` // Cumulative count of FIFO buffer errors. - RxFrame uint64 `json:"rx_frame"` // Cumulative count of packet framing errors. - RxCompressed uint64 `json:"rx_compressed"` // Cumulative count of compressed packets received by the device driver. - RxMulticast uint64 `json:"rx_multicast"` // Cumulative count of multicast frames received by the device driver. - TxBytes uint64 `json:"tx_bytes"` // Cumulative count of bytes transmitted. - TxPackets uint64 `json:"tx_packets"` // Cumulative count of packets transmitted. - TxErrors uint64 `json:"tx_errors"` // Cumulative count of transmit errors encountered. - TxDropped uint64 `json:"tx_dropped"` // Cumulative count of packets dropped while transmitting. - TxFIFO uint64 `json:"tx_fifo"` // Cumulative count of FIFO buffer errors. - TxCollisions uint64 `json:"tx_collisions"` // Cumulative count of collisions detected on the interface. - TxCarrier uint64 `json:"tx_carrier"` // Cumulative count of carrier losses detected by the device driver. - TxCompressed uint64 `json:"tx_compressed"` // Cumulative count of compressed packets transmitted by the device driver. -} - -// NetDev is parsed from /proc/net/dev or /proc/[pid]/net/dev. The map keys -// are interface names. -type NetDev map[string]NetDevLine - -// NewNetDev returns kernel/system statistics read from /proc/net/dev. -func NewNetDev() (NetDev, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return nil, err - } - - return fs.NewNetDev() -} - -// NewNetDev returns kernel/system statistics read from /proc/net/dev. -func (fs FS) NewNetDev() (NetDev, error) { - return newNetDev(fs.Path("net/dev")) -} - -// NewNetDev returns kernel/system statistics read from /proc/[pid]/net/dev. -func (p Proc) NewNetDev() (NetDev, error) { - return newNetDev(p.path("net/dev")) -} - -// newNetDev creates a new NetDev from the contents of the given file. -func newNetDev(file string) (NetDev, error) { - f, err := os.Open(file) - if err != nil { - return NetDev{}, err - } - defer f.Close() - - nd := NetDev{} - s := bufio.NewScanner(f) - for n := 0; s.Scan(); n++ { - // Skip the 2 header lines. - if n < 2 { - continue - } - - line, err := nd.parseLine(s.Text()) - if err != nil { - return nd, err - } - - nd[line.Name] = *line - } - - return nd, s.Err() -} - -// parseLine parses a single line from the /proc/net/dev file. Header lines -// must be filtered prior to calling this method. -func (nd NetDev) parseLine(rawLine string) (*NetDevLine, error) { - parts := strings.SplitN(rawLine, ":", 2) - if len(parts) != 2 { - return nil, errors.New("invalid net/dev line, missing colon") - } - fields := strings.Fields(strings.TrimSpace(parts[1])) - - var err error - line := &NetDevLine{} - - // Interface Name - line.Name = strings.TrimSpace(parts[0]) - if line.Name == "" { - return nil, errors.New("invalid net/dev line, empty interface name") - } - - // RX - line.RxBytes, err = strconv.ParseUint(fields[0], 10, 64) - if err != nil { - return nil, err - } - line.RxPackets, err = strconv.ParseUint(fields[1], 10, 64) - if err != nil { - return nil, err - } - line.RxErrors, err = strconv.ParseUint(fields[2], 10, 64) - if err != nil { - return nil, err - } - line.RxDropped, err = strconv.ParseUint(fields[3], 10, 64) - if err != nil { - return nil, err - } - line.RxFIFO, err = strconv.ParseUint(fields[4], 10, 64) - if err != nil { - return nil, err - } - line.RxFrame, err = strconv.ParseUint(fields[5], 10, 64) - if err != nil { - return nil, err - } - line.RxCompressed, err = strconv.ParseUint(fields[6], 10, 64) - if err != nil { - return nil, err - } - line.RxMulticast, err = strconv.ParseUint(fields[7], 10, 64) - if err != nil { - return nil, err - } - - // TX - line.TxBytes, err = strconv.ParseUint(fields[8], 10, 64) - if err != nil { - return nil, err - } - line.TxPackets, err = strconv.ParseUint(fields[9], 10, 64) - if err != nil { - return nil, err - } - line.TxErrors, err = strconv.ParseUint(fields[10], 10, 64) - if err != nil { - return nil, err - } - line.TxDropped, err = strconv.ParseUint(fields[11], 10, 64) - if err != nil { - return nil, err - } - line.TxFIFO, err = strconv.ParseUint(fields[12], 10, 64) - if err != nil { - return nil, err - } - line.TxCollisions, err = strconv.ParseUint(fields[13], 10, 64) - if err != nil { - return nil, err - } - line.TxCarrier, err = strconv.ParseUint(fields[14], 10, 64) - if err != nil { - return nil, err - } - line.TxCompressed, err = strconv.ParseUint(fields[15], 10, 64) - if err != nil { - return nil, err - } - - return line, nil -} - -// Total aggregates the values across interfaces and returns a new NetDevLine. -// The Name field will be a sorted comma separated list of interface names. -func (nd NetDev) Total() NetDevLine { - total := NetDevLine{} - - names := make([]string, 0, len(nd)) - for _, ifc := range nd { - names = append(names, ifc.Name) - total.RxBytes += ifc.RxBytes - total.RxPackets += ifc.RxPackets - total.RxPackets += ifc.RxPackets - total.RxErrors += ifc.RxErrors - total.RxDropped += ifc.RxDropped - total.RxFIFO += ifc.RxFIFO - total.RxFrame += ifc.RxFrame - total.RxCompressed += ifc.RxCompressed - total.RxMulticast += ifc.RxMulticast - total.TxBytes += ifc.TxBytes - total.TxPackets += ifc.TxPackets - total.TxErrors += ifc.TxErrors - total.TxDropped += ifc.TxDropped - total.TxFIFO += ifc.TxFIFO - total.TxCollisions += ifc.TxCollisions - total.TxCarrier += ifc.TxCarrier - total.TxCompressed += ifc.TxCompressed - } - sort.Strings(names) - total.Name = strings.Join(names, ", ") - - return total -} diff --git a/vendor/github.com/prometheus/procfs/net_dev_test.go b/vendor/github.com/prometheus/procfs/net_dev_test.go deleted file mode 100644 index b162e9c95..000000000 --- a/vendor/github.com/prometheus/procfs/net_dev_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "testing" -) - -func TestNetDevParseLine(t *testing.T) { - const rawLine = ` eth0: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16` - - have, err := NetDev{}.parseLine(rawLine) - if err != nil { - t.Fatal(err) - } - - want := NetDevLine{"eth0", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} - if want != *have { - t.Errorf("want %v, have %v", want, have) - } -} - -func TestNewNetDev(t *testing.T) { - fs, err := NewFS("fixtures") - if err != nil { - t.Fatal(err) - } - - nd, err := fs.NewNetDev() - if err != nil { - t.Fatal(err) - } - - lines := map[string]NetDevLine{ - "vethf345468": {Name: "vethf345468", RxBytes: 648, RxPackets: 8, TxBytes: 438, TxPackets: 5}, - "lo": {Name: "lo", RxBytes: 1664039048, RxPackets: 1566805, TxBytes: 1664039048, TxPackets: 1566805}, - "docker0": {Name: "docker0", RxBytes: 2568, RxPackets: 38, TxBytes: 438, TxPackets: 5}, - "eth0": {Name: "eth0", RxBytes: 874354587, RxPackets: 1036395, TxBytes: 563352563, TxPackets: 732147}, - } - - if want, have := len(lines), len(nd); want != have { - t.Errorf("want %d parsed net/dev lines, have %d", want, have) - } - for _, line := range nd { - if want, have := lines[line.Name], line; want != have { - t.Errorf("%s: want %v, have %v", line.Name, want, have) - } - } -} - -func TestProcNewNetDev(t *testing.T) { - p, err := FS("fixtures").NewProc(26231) - if err != nil { - t.Fatal(err) - } - - nd, err := p.NewNetDev() - if err != nil { - t.Fatal(err) - } - - lines := map[string]NetDevLine{ - "lo": {Name: "lo"}, - "eth0": {Name: "eth0", RxBytes: 438, RxPackets: 5, TxBytes: 648, TxPackets: 8}, - } - - if want, have := len(lines), len(nd); want != have { - t.Errorf("want %d parsed net/dev lines, have %d", want, have) - } - for _, line := range nd { - if want, have := lines[line.Name], line; want != have { - t.Errorf("%s: want %v, have %v", line.Name, want, have) - } - } -} diff --git a/vendor/github.com/prometheus/procfs/nfs/nfs.go b/vendor/github.com/prometheus/procfs/nfs/nfs.go deleted file mode 100644 index 651bf6819..000000000 --- a/vendor/github.com/prometheus/procfs/nfs/nfs.go +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright 2018 The Prometheus 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 nfs implements parsing of /proc/net/rpc/nfsd. -// Fields are documented in https://www.svennd.be/nfsd-stats-explained-procnetrpcnfsd/ -package nfs - -// ReplyCache models the "rc" line. -type ReplyCache struct { - Hits uint64 - Misses uint64 - NoCache uint64 -} - -// FileHandles models the "fh" line. -type FileHandles struct { - Stale uint64 - TotalLookups uint64 - AnonLookups uint64 - DirNoCache uint64 - NoDirNoCache uint64 -} - -// InputOutput models the "io" line. -type InputOutput struct { - Read uint64 - Write uint64 -} - -// Threads models the "th" line. -type Threads struct { - Threads uint64 - FullCnt uint64 -} - -// ReadAheadCache models the "ra" line. -type ReadAheadCache struct { - CacheSize uint64 - CacheHistogram []uint64 - NotFound uint64 -} - -// Network models the "net" line. -type Network struct { - NetCount uint64 - UDPCount uint64 - TCPCount uint64 - TCPConnect uint64 -} - -// ClientRPC models the nfs "rpc" line. -type ClientRPC struct { - RPCCount uint64 - Retransmissions uint64 - AuthRefreshes uint64 -} - -// ServerRPC models the nfsd "rpc" line. -type ServerRPC struct { - RPCCount uint64 - BadCnt uint64 - BadFmt uint64 - BadAuth uint64 - BadcInt uint64 -} - -// V2Stats models the "proc2" line. -type V2Stats struct { - Null uint64 - GetAttr uint64 - SetAttr uint64 - Root uint64 - Lookup uint64 - ReadLink uint64 - Read uint64 - WrCache uint64 - Write uint64 - Create uint64 - Remove uint64 - Rename uint64 - Link uint64 - SymLink uint64 - MkDir uint64 - RmDir uint64 - ReadDir uint64 - FsStat uint64 -} - -// V3Stats models the "proc3" line. -type V3Stats struct { - Null uint64 - GetAttr uint64 - SetAttr uint64 - Lookup uint64 - Access uint64 - ReadLink uint64 - Read uint64 - Write uint64 - Create uint64 - MkDir uint64 - SymLink uint64 - MkNod uint64 - Remove uint64 - RmDir uint64 - Rename uint64 - Link uint64 - ReadDir uint64 - ReadDirPlus uint64 - FsStat uint64 - FsInfo uint64 - PathConf uint64 - Commit uint64 -} - -// ClientV4Stats models the nfs "proc4" line. -type ClientV4Stats struct { - Null uint64 - Read uint64 - Write uint64 - Commit uint64 - Open uint64 - OpenConfirm uint64 - OpenNoattr uint64 - OpenDowngrade uint64 - Close uint64 - Setattr uint64 - FsInfo uint64 - Renew uint64 - SetClientID uint64 - SetClientIDConfirm uint64 - Lock uint64 - Lockt uint64 - Locku uint64 - Access uint64 - Getattr uint64 - Lookup uint64 - LookupRoot uint64 - Remove uint64 - Rename uint64 - Link uint64 - Symlink uint64 - Create uint64 - Pathconf uint64 - StatFs uint64 - ReadLink uint64 - ReadDir uint64 - ServerCaps uint64 - DelegReturn uint64 - GetACL uint64 - SetACL uint64 - FsLocations uint64 - ReleaseLockowner uint64 - Secinfo uint64 - FsidPresent uint64 - ExchangeID uint64 - CreateSession uint64 - DestroySession uint64 - Sequence uint64 - GetLeaseTime uint64 - ReclaimComplete uint64 - LayoutGet uint64 - GetDeviceInfo uint64 - LayoutCommit uint64 - LayoutReturn uint64 - SecinfoNoName uint64 - TestStateID uint64 - FreeStateID uint64 - GetDeviceList uint64 - BindConnToSession uint64 - DestroyClientID uint64 - Seek uint64 - Allocate uint64 - DeAllocate uint64 - LayoutStats uint64 - Clone uint64 -} - -// ServerV4Stats models the nfsd "proc4" line. -type ServerV4Stats struct { - Null uint64 - Compound uint64 -} - -// V4Ops models the "proc4ops" line: NFSv4 operations -// Variable list, see: -// v4.0 https://tools.ietf.org/html/rfc3010 (38 operations) -// v4.1 https://tools.ietf.org/html/rfc5661 (58 operations) -// v4.2 https://tools.ietf.org/html/draft-ietf-nfsv4-minorversion2-41 (71 operations) -type V4Ops struct { - //Values uint64 // Variable depending on v4.x sub-version. TODO: Will this always at least include the fields in this struct? - Op0Unused uint64 - Op1Unused uint64 - Op2Future uint64 - Access uint64 - Close uint64 - Commit uint64 - Create uint64 - DelegPurge uint64 - DelegReturn uint64 - GetAttr uint64 - GetFH uint64 - Link uint64 - Lock uint64 - Lockt uint64 - Locku uint64 - Lookup uint64 - LookupRoot uint64 - Nverify uint64 - Open uint64 - OpenAttr uint64 - OpenConfirm uint64 - OpenDgrd uint64 - PutFH uint64 - PutPubFH uint64 - PutRootFH uint64 - Read uint64 - ReadDir uint64 - ReadLink uint64 - Remove uint64 - Rename uint64 - Renew uint64 - RestoreFH uint64 - SaveFH uint64 - SecInfo uint64 - SetAttr uint64 - Verify uint64 - Write uint64 - RelLockOwner uint64 -} - -// ClientRPCStats models all stats from /proc/net/rpc/nfs. -type ClientRPCStats struct { - Network Network - ClientRPC ClientRPC - V2Stats V2Stats - V3Stats V3Stats - ClientV4Stats ClientV4Stats -} - -// ServerRPCStats models all stats from /proc/net/rpc/nfsd. -type ServerRPCStats struct { - ReplyCache ReplyCache - FileHandles FileHandles - InputOutput InputOutput - Threads Threads - ReadAheadCache ReadAheadCache - Network Network - ServerRPC ServerRPC - V2Stats V2Stats - V3Stats V3Stats - ServerV4Stats ServerV4Stats - V4Ops V4Ops -} diff --git a/vendor/github.com/prometheus/procfs/nfs/parse.go b/vendor/github.com/prometheus/procfs/nfs/parse.go deleted file mode 100644 index 95a83cc5b..000000000 --- a/vendor/github.com/prometheus/procfs/nfs/parse.go +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright 2018 The Prometheus 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 nfs - -import ( - "fmt" -) - -func parseReplyCache(v []uint64) (ReplyCache, error) { - if len(v) != 3 { - return ReplyCache{}, fmt.Errorf("invalid ReplyCache line %q", v) - } - - return ReplyCache{ - Hits: v[0], - Misses: v[1], - NoCache: v[2], - }, nil -} - -func parseFileHandles(v []uint64) (FileHandles, error) { - if len(v) != 5 { - return FileHandles{}, fmt.Errorf("invalid FileHandles, line %q", v) - } - - return FileHandles{ - Stale: v[0], - TotalLookups: v[1], - AnonLookups: v[2], - DirNoCache: v[3], - NoDirNoCache: v[4], - }, nil -} - -func parseInputOutput(v []uint64) (InputOutput, error) { - if len(v) != 2 { - return InputOutput{}, fmt.Errorf("invalid InputOutput line %q", v) - } - - return InputOutput{ - Read: v[0], - Write: v[1], - }, nil -} - -func parseThreads(v []uint64) (Threads, error) { - if len(v) != 2 { - return Threads{}, fmt.Errorf("invalid Threads line %q", v) - } - - return Threads{ - Threads: v[0], - FullCnt: v[1], - }, nil -} - -func parseReadAheadCache(v []uint64) (ReadAheadCache, error) { - if len(v) != 12 { - return ReadAheadCache{}, fmt.Errorf("invalid ReadAheadCache line %q", v) - } - - return ReadAheadCache{ - CacheSize: v[0], - CacheHistogram: v[1:11], - NotFound: v[11], - }, nil -} - -func parseNetwork(v []uint64) (Network, error) { - if len(v) != 4 { - return Network{}, fmt.Errorf("invalid Network line %q", v) - } - - return Network{ - NetCount: v[0], - UDPCount: v[1], - TCPCount: v[2], - TCPConnect: v[3], - }, nil -} - -func parseServerRPC(v []uint64) (ServerRPC, error) { - if len(v) != 5 { - return ServerRPC{}, fmt.Errorf("invalid RPC line %q", v) - } - - return ServerRPC{ - RPCCount: v[0], - BadCnt: v[1], - BadFmt: v[2], - BadAuth: v[3], - BadcInt: v[4], - }, nil -} - -func parseClientRPC(v []uint64) (ClientRPC, error) { - if len(v) != 3 { - return ClientRPC{}, fmt.Errorf("invalid RPC line %q", v) - } - - return ClientRPC{ - RPCCount: v[0], - Retransmissions: v[1], - AuthRefreshes: v[2], - }, nil -} - -func parseV2Stats(v []uint64) (V2Stats, error) { - values := int(v[0]) - if len(v[1:]) != values || values != 18 { - return V2Stats{}, fmt.Errorf("invalid V2Stats line %q", v) - } - - return V2Stats{ - Null: v[1], - GetAttr: v[2], - SetAttr: v[3], - Root: v[4], - Lookup: v[5], - ReadLink: v[6], - Read: v[7], - WrCache: v[8], - Write: v[9], - Create: v[10], - Remove: v[11], - Rename: v[12], - Link: v[13], - SymLink: v[14], - MkDir: v[15], - RmDir: v[16], - ReadDir: v[17], - FsStat: v[18], - }, nil -} - -func parseV3Stats(v []uint64) (V3Stats, error) { - values := int(v[0]) - if len(v[1:]) != values || values != 22 { - return V3Stats{}, fmt.Errorf("invalid V3Stats line %q", v) - } - - return V3Stats{ - Null: v[1], - GetAttr: v[2], - SetAttr: v[3], - Lookup: v[4], - Access: v[5], - ReadLink: v[6], - Read: v[7], - Write: v[8], - Create: v[9], - MkDir: v[10], - SymLink: v[11], - MkNod: v[12], - Remove: v[13], - RmDir: v[14], - Rename: v[15], - Link: v[16], - ReadDir: v[17], - ReadDirPlus: v[18], - FsStat: v[19], - FsInfo: v[20], - PathConf: v[21], - Commit: v[22], - }, nil -} - -func parseClientV4Stats(v []uint64) (ClientV4Stats, error) { - values := int(v[0]) - if len(v[1:]) != values { - return ClientV4Stats{}, fmt.Errorf("invalid ClientV4Stats line %q", v) - } - - // This function currently supports mapping 59 NFS v4 client stats. Older - // kernels may emit fewer stats, so we must detect this and pad out the - // values to match the expected slice size. - if values < 59 { - newValues := make([]uint64, 60) - copy(newValues, v) - v = newValues - } - - return ClientV4Stats{ - Null: v[1], - Read: v[2], - Write: v[3], - Commit: v[4], - Open: v[5], - OpenConfirm: v[6], - OpenNoattr: v[7], - OpenDowngrade: v[8], - Close: v[9], - Setattr: v[10], - FsInfo: v[11], - Renew: v[12], - SetClientID: v[13], - SetClientIDConfirm: v[14], - Lock: v[15], - Lockt: v[16], - Locku: v[17], - Access: v[18], - Getattr: v[19], - Lookup: v[20], - LookupRoot: v[21], - Remove: v[22], - Rename: v[23], - Link: v[24], - Symlink: v[25], - Create: v[26], - Pathconf: v[27], - StatFs: v[28], - ReadLink: v[29], - ReadDir: v[30], - ServerCaps: v[31], - DelegReturn: v[32], - GetACL: v[33], - SetACL: v[34], - FsLocations: v[35], - ReleaseLockowner: v[36], - Secinfo: v[37], - FsidPresent: v[38], - ExchangeID: v[39], - CreateSession: v[40], - DestroySession: v[41], - Sequence: v[42], - GetLeaseTime: v[43], - ReclaimComplete: v[44], - LayoutGet: v[45], - GetDeviceInfo: v[46], - LayoutCommit: v[47], - LayoutReturn: v[48], - SecinfoNoName: v[49], - TestStateID: v[50], - FreeStateID: v[51], - GetDeviceList: v[52], - BindConnToSession: v[53], - DestroyClientID: v[54], - Seek: v[55], - Allocate: v[56], - DeAllocate: v[57], - LayoutStats: v[58], - Clone: v[59], - }, nil -} - -func parseServerV4Stats(v []uint64) (ServerV4Stats, error) { - values := int(v[0]) - if len(v[1:]) != values || values != 2 { - return ServerV4Stats{}, fmt.Errorf("invalid V4Stats line %q", v) - } - - return ServerV4Stats{ - Null: v[1], - Compound: v[2], - }, nil -} - -func parseV4Ops(v []uint64) (V4Ops, error) { - values := int(v[0]) - if len(v[1:]) != values || values < 39 { - return V4Ops{}, fmt.Errorf("invalid V4Ops line %q", v) - } - - stats := V4Ops{ - Op0Unused: v[1], - Op1Unused: v[2], - Op2Future: v[3], - Access: v[4], - Close: v[5], - Commit: v[6], - Create: v[7], - DelegPurge: v[8], - DelegReturn: v[9], - GetAttr: v[10], - GetFH: v[11], - Link: v[12], - Lock: v[13], - Lockt: v[14], - Locku: v[15], - Lookup: v[16], - LookupRoot: v[17], - Nverify: v[18], - Open: v[19], - OpenAttr: v[20], - OpenConfirm: v[21], - OpenDgrd: v[22], - PutFH: v[23], - PutPubFH: v[24], - PutRootFH: v[25], - Read: v[26], - ReadDir: v[27], - ReadLink: v[28], - Remove: v[29], - Rename: v[30], - Renew: v[31], - RestoreFH: v[32], - SaveFH: v[33], - SecInfo: v[34], - SetAttr: v[35], - Verify: v[36], - Write: v[37], - RelLockOwner: v[38], - } - - return stats, nil -} diff --git a/vendor/github.com/prometheus/procfs/nfs/parse_nfs.go b/vendor/github.com/prometheus/procfs/nfs/parse_nfs.go deleted file mode 100644 index c0d3a5ad9..000000000 --- a/vendor/github.com/prometheus/procfs/nfs/parse_nfs.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2018 The Prometheus 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 nfs - -import ( - "bufio" - "fmt" - "io" - "strings" - - "github.com/prometheus/procfs/internal/util" -) - -// ParseClientRPCStats returns stats read from /proc/net/rpc/nfs -func ParseClientRPCStats(r io.Reader) (*ClientRPCStats, error) { - stats := &ClientRPCStats{} - - scanner := bufio.NewScanner(r) - for scanner.Scan() { - line := scanner.Text() - parts := strings.Fields(scanner.Text()) - // require at least - if len(parts) < 2 { - return nil, fmt.Errorf("invalid NFS metric line %q", line) - } - - values, err := util.ParseUint64s(parts[1:]) - if err != nil { - return nil, fmt.Errorf("error parsing NFS metric line: %s", err) - } - - switch metricLine := parts[0]; metricLine { - case "net": - stats.Network, err = parseNetwork(values) - case "rpc": - stats.ClientRPC, err = parseClientRPC(values) - case "proc2": - stats.V2Stats, err = parseV2Stats(values) - case "proc3": - stats.V3Stats, err = parseV3Stats(values) - case "proc4": - stats.ClientV4Stats, err = parseClientV4Stats(values) - default: - return nil, fmt.Errorf("unknown NFS metric line %q", metricLine) - } - if err != nil { - return nil, fmt.Errorf("errors parsing NFS metric line: %s", err) - } - } - - if err := scanner.Err(); err != nil { - return nil, fmt.Errorf("error scanning NFS file: %s", err) - } - - return stats, nil -} diff --git a/vendor/github.com/prometheus/procfs/nfs/parse_nfs_test.go b/vendor/github.com/prometheus/procfs/nfs/parse_nfs_test.go deleted file mode 100644 index 8ebcfd16e..000000000 --- a/vendor/github.com/prometheus/procfs/nfs/parse_nfs_test.go +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright 2018 The Prometheus 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 nfs_test - -import ( - "reflect" - "strings" - "testing" - - "github.com/prometheus/procfs/nfs" -) - -func TestNewNFSClientRPCStats(t *testing.T) { - tests := []struct { - name string - content string - stats *nfs.ClientRPCStats - invalid bool - }{ - { - name: "invalid file", - content: "invalid", - invalid: true, - }, { - name: "good old kernel version file", - content: `net 70 70 69 45 -rpc 1218785755 374636 1218815394 -proc2 18 16 57 74 52 71 73 45 86 0 52 83 61 17 53 50 23 70 82 -proc3 22 0 1061909262 48906 4077635 117661341 5 29391916 2570425 2993289 590 0 0 7815 15 1130 0 3983 92385 13332 2 1 23729 -proc4 48 98 51 54 83 85 23 24 1 28 73 68 83 12 84 39 68 59 58 88 29 74 69 96 21 84 15 53 86 54 66 56 97 36 49 32 85 81 11 58 32 67 13 28 35 90 1 26 1337 -`, - stats: &nfs.ClientRPCStats{ - Network: nfs.Network{ - NetCount: 70, - UDPCount: 70, - TCPCount: 69, - TCPConnect: 45, - }, - ClientRPC: nfs.ClientRPC{ - RPCCount: 1218785755, - Retransmissions: 374636, - AuthRefreshes: 1218815394, - }, - V2Stats: nfs.V2Stats{ - Null: 16, - GetAttr: 57, - SetAttr: 74, - Root: 52, - Lookup: 71, - ReadLink: 73, - Read: 45, - WrCache: 86, - Write: 0, - Create: 52, - Remove: 83, - Rename: 61, - Link: 17, - SymLink: 53, - MkDir: 50, - RmDir: 23, - ReadDir: 70, - FsStat: 82, - }, - V3Stats: nfs.V3Stats{ - Null: 0, - GetAttr: 1061909262, - SetAttr: 48906, - Lookup: 4077635, - Access: 117661341, - ReadLink: 5, - Read: 29391916, - Write: 2570425, - Create: 2993289, - MkDir: 590, - SymLink: 0, - MkNod: 0, - Remove: 7815, - RmDir: 15, - Rename: 1130, - Link: 0, - ReadDir: 3983, - ReadDirPlus: 92385, - FsStat: 13332, - FsInfo: 2, - PathConf: 1, - Commit: 23729}, - ClientV4Stats: nfs.ClientV4Stats{ - Null: 98, - Read: 51, - Write: 54, - Commit: 83, - Open: 85, - OpenConfirm: 23, - OpenNoattr: 24, - OpenDowngrade: 1, - Close: 28, - Setattr: 73, - FsInfo: 68, - Renew: 83, - SetClientID: 12, - SetClientIDConfirm: 84, - Lock: 39, - Lockt: 68, - Locku: 59, - Access: 58, - Getattr: 88, - Lookup: 29, - LookupRoot: 74, - Remove: 69, - Rename: 96, - Link: 21, - Symlink: 84, - Create: 15, - Pathconf: 53, - StatFs: 86, - ReadLink: 54, - ReadDir: 66, - ServerCaps: 56, - DelegReturn: 97, - GetACL: 36, - SetACL: 49, - FsLocations: 32, - ReleaseLockowner: 85, - Secinfo: 81, - FsidPresent: 11, - ExchangeID: 58, - CreateSession: 32, - DestroySession: 67, - Sequence: 13, - GetLeaseTime: 28, - ReclaimComplete: 35, - LayoutGet: 90, - GetDeviceInfo: 1, - LayoutCommit: 26, - LayoutReturn: 1337, - SecinfoNoName: 0, - TestStateID: 0, - FreeStateID: 0, - GetDeviceList: 0, - BindConnToSession: 0, - DestroyClientID: 0, - Seek: 0, - Allocate: 0, - DeAllocate: 0, - LayoutStats: 0, - Clone: 0, - }, - }, - }, { - name: "good file", - content: `net 18628 0 18628 6 -rpc 4329785 0 4338291 -proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2 -proc3 22 1 4084749 29200 94754 32580 186 47747 7981 8639 0 6356 0 6962 0 7958 0 0 241 4 4 2 39 -proc4 61 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -`, - stats: &nfs.ClientRPCStats{ - Network: nfs.Network{ - NetCount: 18628, - UDPCount: 0, - TCPCount: 18628, - TCPConnect: 6, - }, - ClientRPC: nfs.ClientRPC{ - RPCCount: 4329785, - Retransmissions: 0, - AuthRefreshes: 4338291, - }, - V2Stats: nfs.V2Stats{ - Null: 2, - GetAttr: 69, - SetAttr: 0, - Root: 0, - Lookup: 4410, - ReadLink: 0, - Read: 0, - WrCache: 0, - Write: 0, - Create: 0, - Remove: 0, - Rename: 0, - Link: 0, - SymLink: 0, - MkDir: 0, - RmDir: 0, - ReadDir: 99, - FsStat: 2, - }, - V3Stats: nfs.V3Stats{ - Null: 1, - GetAttr: 4084749, - SetAttr: 29200, - Lookup: 94754, - Access: 32580, - ReadLink: 186, - Read: 47747, - Write: 7981, - Create: 8639, - MkDir: 0, - SymLink: 6356, - MkNod: 0, - Remove: 6962, - RmDir: 0, - Rename: 7958, - Link: 0, - ReadDir: 0, - ReadDirPlus: 241, - FsStat: 4, - FsInfo: 4, - PathConf: 2, - Commit: 39, - }, - ClientV4Stats: nfs.ClientV4Stats{ - Null: 1, - Read: 0, - Write: 0, - Commit: 0, - Open: 0, - OpenConfirm: 0, - OpenNoattr: 0, - OpenDowngrade: 0, - Close: 0, - Setattr: 0, - FsInfo: 0, - Renew: 0, - SetClientID: 1, - SetClientIDConfirm: 1, - Lock: 0, - Lockt: 0, - Locku: 0, - Access: 0, - Getattr: 0, - Lookup: 0, - LookupRoot: 0, - Remove: 2, - Rename: 0, - Link: 0, - Symlink: 0, - Create: 0, - Pathconf: 0, - StatFs: 0, - ReadLink: 0, - ReadDir: 0, - ServerCaps: 0, - DelegReturn: 0, - GetACL: 0, - SetACL: 0, - FsLocations: 0, - ReleaseLockowner: 0, - Secinfo: 0, - FsidPresent: 0, - ExchangeID: 0, - CreateSession: 0, - DestroySession: 0, - Sequence: 0, - GetLeaseTime: 0, - ReclaimComplete: 0, - LayoutGet: 0, - GetDeviceInfo: 0, - LayoutCommit: 0, - LayoutReturn: 0, - SecinfoNoName: 0, - TestStateID: 0, - FreeStateID: 0, - GetDeviceList: 0, - BindConnToSession: 0, - DestroyClientID: 0, - Seek: 0, - Allocate: 0, - DeAllocate: 0, - LayoutStats: 0, - Clone: 0, - }, - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - stats, err := nfs.ParseClientRPCStats(strings.NewReader(tt.content)) - - if tt.invalid && err == nil { - t.Fatal("expected an error, but none occurred") - } - if !tt.invalid && err != nil { - t.Fatalf("unexpected error: %v", err) - } - - if want, have := tt.stats, stats; !reflect.DeepEqual(want, have) { - t.Fatalf("unexpected NFS stats:\nwant:\n%v\nhave:\n%v", want, have) - } - }) - } -} diff --git a/vendor/github.com/prometheus/procfs/nfs/parse_nfsd.go b/vendor/github.com/prometheus/procfs/nfs/parse_nfsd.go deleted file mode 100644 index 57bb4a358..000000000 --- a/vendor/github.com/prometheus/procfs/nfs/parse_nfsd.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2018 The Prometheus 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 nfs - -import ( - "bufio" - "fmt" - "io" - "strings" - - "github.com/prometheus/procfs/internal/util" -) - -// ParseServerRPCStats returns stats read from /proc/net/rpc/nfsd -func ParseServerRPCStats(r io.Reader) (*ServerRPCStats, error) { - stats := &ServerRPCStats{} - - scanner := bufio.NewScanner(r) - for scanner.Scan() { - line := scanner.Text() - parts := strings.Fields(scanner.Text()) - // require at least - if len(parts) < 2 { - return nil, fmt.Errorf("invalid NFSd metric line %q", line) - } - label := parts[0] - - var values []uint64 - var err error - if label == "th" { - if len(parts) < 3 { - return nil, fmt.Errorf("invalid NFSd th metric line %q", line) - } - values, err = util.ParseUint64s(parts[1:3]) - } else { - values, err = util.ParseUint64s(parts[1:]) - } - if err != nil { - return nil, fmt.Errorf("error parsing NFSd metric line: %s", err) - } - - switch metricLine := parts[0]; metricLine { - case "rc": - stats.ReplyCache, err = parseReplyCache(values) - case "fh": - stats.FileHandles, err = parseFileHandles(values) - case "io": - stats.InputOutput, err = parseInputOutput(values) - case "th": - stats.Threads, err = parseThreads(values) - case "ra": - stats.ReadAheadCache, err = parseReadAheadCache(values) - case "net": - stats.Network, err = parseNetwork(values) - case "rpc": - stats.ServerRPC, err = parseServerRPC(values) - case "proc2": - stats.V2Stats, err = parseV2Stats(values) - case "proc3": - stats.V3Stats, err = parseV3Stats(values) - case "proc4": - stats.ServerV4Stats, err = parseServerV4Stats(values) - case "proc4ops": - stats.V4Ops, err = parseV4Ops(values) - default: - return nil, fmt.Errorf("unknown NFSd metric line %q", metricLine) - } - if err != nil { - return nil, fmt.Errorf("errors parsing NFSd metric line: %s", err) - } - } - - if err := scanner.Err(); err != nil { - return nil, fmt.Errorf("error scanning NFSd file: %s", err) - } - - return stats, nil -} diff --git a/vendor/github.com/prometheus/procfs/nfs/parse_nfsd_test.go b/vendor/github.com/prometheus/procfs/nfs/parse_nfsd_test.go deleted file mode 100644 index b09b3b580..000000000 --- a/vendor/github.com/prometheus/procfs/nfs/parse_nfsd_test.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2018 The Prometheus 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 nfs_test - -import ( - "reflect" - "strings" - "testing" - - "github.com/prometheus/procfs/nfs" -) - -func TestNewNFSdServerRPCStats(t *testing.T) { - tests := []struct { - name string - content string - stats *nfs.ServerRPCStats - invalid bool - }{ - { - name: "invalid file", - content: "invalid", - invalid: true, - }, { - name: "good file", - content: `rc 0 6 18622 -fh 0 0 0 0 0 -io 157286400 0 -th 8 0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 -ra 32 0 0 0 0 0 0 0 0 0 0 0 -net 18628 0 18628 6 -rpc 18628 0 0 0 0 -proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2 -proc3 22 2 112 0 2719 111 0 0 0 0 0 0 0 0 0 0 0 27 216 0 2 1 0 -proc4 2 2 10853 -proc4ops 72 0 0 0 1098 2 0 0 0 0 8179 5896 0 0 0 0 5900 0 0 2 0 2 0 9609 0 2 150 1272 0 0 0 1236 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -`, - stats: &nfs.ServerRPCStats{ - ReplyCache: nfs.ReplyCache{ - Hits: 0, - Misses: 6, - NoCache: 18622, - }, - FileHandles: nfs.FileHandles{ - Stale: 0, - TotalLookups: 0, - AnonLookups: 0, - DirNoCache: 0, - NoDirNoCache: 0, - }, - InputOutput: nfs.InputOutput{ - Read: 157286400, - Write: 0, - }, - Threads: nfs.Threads{ - Threads: 8, - FullCnt: 0, - }, - ReadAheadCache: nfs.ReadAheadCache{ - CacheSize: 32, - CacheHistogram: []uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - NotFound: 0, - }, - Network: nfs.Network{ - NetCount: 18628, - UDPCount: 0, - TCPCount: 18628, - TCPConnect: 6, - }, - ServerRPC: nfs.ServerRPC{ - RPCCount: 18628, - BadCnt: 0, - BadFmt: 0, - BadAuth: 0, - BadcInt: 0, - }, - V2Stats: nfs.V2Stats{ - Null: 2, - GetAttr: 69, - SetAttr: 0, - Root: 0, - Lookup: 4410, - ReadLink: 0, - Read: 0, - WrCache: 0, - Write: 0, - Create: 0, - Remove: 0, - Rename: 0, - Link: 0, - SymLink: 0, - MkDir: 0, - RmDir: 0, - ReadDir: 99, - FsStat: 2, - }, - V3Stats: nfs.V3Stats{ - Null: 2, - GetAttr: 112, - SetAttr: 0, - Lookup: 2719, - Access: 111, - ReadLink: 0, - Read: 0, - Write: 0, - Create: 0, - MkDir: 0, - SymLink: 0, - MkNod: 0, - Remove: 0, - RmDir: 0, - Rename: 0, - Link: 0, - ReadDir: 27, - ReadDirPlus: 216, - FsStat: 0, - FsInfo: 2, - PathConf: 1, - Commit: 0, - }, - ServerV4Stats: nfs.ServerV4Stats{ - Null: 2, - Compound: 10853, - }, - V4Ops: nfs.V4Ops{ - Op0Unused: 0, - Op1Unused: 0, - Op2Future: 0, - Access: 1098, - Close: 2, - Commit: 0, - Create: 0, - DelegPurge: 0, - DelegReturn: 0, - GetAttr: 8179, - GetFH: 5896, - Link: 0, - Lock: 0, - Lockt: 0, - Locku: 0, - Lookup: 5900, - LookupRoot: 0, - Nverify: 0, - Open: 2, - OpenAttr: 0, - OpenConfirm: 2, - OpenDgrd: 0, - PutFH: 9609, - PutPubFH: 0, - PutRootFH: 2, - Read: 150, - ReadDir: 1272, - ReadLink: 0, - Remove: 0, - Rename: 0, - Renew: 1236, - RestoreFH: 0, - SaveFH: 0, - SecInfo: 0, - SetAttr: 0, - Verify: 3, - Write: 3, - RelLockOwner: 0, - }, - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - stats, err := nfs.ParseServerRPCStats(strings.NewReader(tt.content)) - - if tt.invalid && err == nil { - t.Fatal("expected an error, but none occurred") - } - if !tt.invalid && err != nil { - t.Fatalf("unexpected error: %v", err) - } - - if want, have := tt.stats, stats; !reflect.DeepEqual(want, have) { - t.Fatalf("unexpected NFS stats:\nwant:\n%v\nhave:\n%v", want, have) - } - }) - } -} diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go deleted file mode 100644 index 06bed0ef4..000000000 --- a/vendor/github.com/prometheus/procfs/proc.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "bytes" - "fmt" - "io/ioutil" - "os" - "strconv" - "strings" -) - -// Proc provides information about a running process. -type Proc struct { - // The process ID. - PID int - - fs FS -} - -// Procs represents a list of Proc structs. -type Procs []Proc - -func (p Procs) Len() int { return len(p) } -func (p Procs) Swap(i, j int) { p[i], p[j] = p[j], p[i] } -func (p Procs) Less(i, j int) bool { return p[i].PID < p[j].PID } - -// Self returns a process for the current process read via /proc/self. -func Self() (Proc, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return Proc{}, err - } - return fs.Self() -} - -// NewProc returns a process for the given pid under /proc. -func NewProc(pid int) (Proc, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return Proc{}, err - } - return fs.NewProc(pid) -} - -// AllProcs returns a list of all currently available processes under /proc. -func AllProcs() (Procs, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return Procs{}, err - } - return fs.AllProcs() -} - -// Self returns a process for the current process. -func (fs FS) Self() (Proc, error) { - p, err := os.Readlink(fs.Path("self")) - if err != nil { - return Proc{}, err - } - pid, err := strconv.Atoi(strings.Replace(p, string(fs), "", -1)) - if err != nil { - return Proc{}, err - } - return fs.NewProc(pid) -} - -// NewProc returns a process for the given pid. -func (fs FS) NewProc(pid int) (Proc, error) { - if _, err := os.Stat(fs.Path(strconv.Itoa(pid))); err != nil { - return Proc{}, err - } - return Proc{PID: pid, fs: fs}, nil -} - -// AllProcs returns a list of all currently available processes. -func (fs FS) AllProcs() (Procs, error) { - d, err := os.Open(fs.Path()) - if err != nil { - return Procs{}, err - } - defer d.Close() - - names, err := d.Readdirnames(-1) - if err != nil { - return Procs{}, fmt.Errorf("could not read %s: %s", d.Name(), err) - } - - p := Procs{} - for _, n := range names { - pid, err := strconv.ParseInt(n, 10, 64) - if err != nil { - continue - } - p = append(p, Proc{PID: int(pid), fs: fs}) - } - - return p, nil -} - -// CmdLine returns the command line of a process. -func (p Proc) CmdLine() ([]string, error) { - f, err := os.Open(p.path("cmdline")) - if err != nil { - return nil, err - } - defer f.Close() - - data, err := ioutil.ReadAll(f) - if err != nil { - return nil, err - } - - if len(data) < 1 { - return []string{}, nil - } - - return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil -} - -// Comm returns the command name of a process. -func (p Proc) Comm() (string, error) { - f, err := os.Open(p.path("comm")) - if err != nil { - return "", err - } - defer f.Close() - - data, err := ioutil.ReadAll(f) - if err != nil { - return "", err - } - - return strings.TrimSpace(string(data)), nil -} - -// Executable returns the absolute path of the executable command of a process. -func (p Proc) Executable() (string, error) { - exe, err := os.Readlink(p.path("exe")) - if os.IsNotExist(err) { - return "", nil - } - - return exe, err -} - -// Cwd returns the absolute path to the current working directory of the process. -func (p Proc) Cwd() (string, error) { - wd, err := os.Readlink(p.path("cwd")) - if os.IsNotExist(err) { - return "", nil - } - - return wd, err -} - -// RootDir returns the absolute path to the process's root directory (as set by chroot) -func (p Proc) RootDir() (string, error) { - rdir, err := os.Readlink(p.path("root")) - if os.IsNotExist(err) { - return "", nil - } - - return rdir, err -} - -// FileDescriptors returns the currently open file descriptors of a process. -func (p Proc) FileDescriptors() ([]uintptr, error) { - names, err := p.fileDescriptors() - if err != nil { - return nil, err - } - - fds := make([]uintptr, len(names)) - for i, n := range names { - fd, err := strconv.ParseInt(n, 10, 32) - if err != nil { - return nil, fmt.Errorf("could not parse fd %s: %s", n, err) - } - fds[i] = uintptr(fd) - } - - return fds, nil -} - -// FileDescriptorTargets returns the targets of all file descriptors of a process. -// If a file descriptor is not a symlink to a file (like a socket), that value will be the empty string. -func (p Proc) FileDescriptorTargets() ([]string, error) { - names, err := p.fileDescriptors() - if err != nil { - return nil, err - } - - targets := make([]string, len(names)) - - for i, name := range names { - target, err := os.Readlink(p.path("fd", name)) - if err == nil { - targets[i] = target - } - } - - return targets, nil -} - -// FileDescriptorsLen returns the number of currently open file descriptors of -// a process. -func (p Proc) FileDescriptorsLen() (int, error) { - fds, err := p.fileDescriptors() - if err != nil { - return 0, err - } - - return len(fds), nil -} - -// MountStats retrieves statistics and configuration for mount points in a -// process's namespace. -func (p Proc) MountStats() ([]*Mount, error) { - f, err := os.Open(p.path("mountstats")) - if err != nil { - return nil, err - } - defer f.Close() - - return parseMountStats(f) -} - -func (p Proc) fileDescriptors() ([]string, error) { - d, err := os.Open(p.path("fd")) - if err != nil { - return nil, err - } - defer d.Close() - - names, err := d.Readdirnames(-1) - if err != nil { - return nil, fmt.Errorf("could not read %s: %s", d.Name(), err) - } - - return names, nil -} - -func (p Proc) path(pa ...string) string { - return p.fs.Path(append([]string{strconv.Itoa(p.PID)}, pa...)...) -} diff --git a/vendor/github.com/prometheus/procfs/proc_io.go b/vendor/github.com/prometheus/procfs/proc_io.go deleted file mode 100644 index 0251c83bf..000000000 --- a/vendor/github.com/prometheus/procfs/proc_io.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "fmt" - "io/ioutil" - "os" -) - -// ProcIO models the content of /proc//io. -type ProcIO struct { - // Chars read. - RChar uint64 - // Chars written. - WChar uint64 - // Read syscalls. - SyscR uint64 - // Write syscalls. - SyscW uint64 - // Bytes read. - ReadBytes uint64 - // Bytes written. - WriteBytes uint64 - // Bytes written, but taking into account truncation. See - // Documentation/filesystems/proc.txt in the kernel sources for - // detailed explanation. - CancelledWriteBytes int64 -} - -// NewIO creates a new ProcIO instance from a given Proc instance. -func (p Proc) NewIO() (ProcIO, error) { - pio := ProcIO{} - - f, err := os.Open(p.path("io")) - if err != nil { - return pio, err - } - defer f.Close() - - data, err := ioutil.ReadAll(f) - if err != nil { - return pio, err - } - - ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" + - "read_bytes: %d\nwrite_bytes: %d\n" + - "cancelled_write_bytes: %d\n" - - _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR, - &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes) - - return pio, err -} diff --git a/vendor/github.com/prometheus/procfs/proc_io_test.go b/vendor/github.com/prometheus/procfs/proc_io_test.go deleted file mode 100644 index 1afdbd463..000000000 --- a/vendor/github.com/prometheus/procfs/proc_io_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import "testing" - -func TestProcIO(t *testing.T) { - p, err := FS("fixtures").NewProc(26231) - if err != nil { - t.Fatal(err) - } - - s, err := p.NewIO() - if err != nil { - t.Fatal(err) - } - - for _, test := range []struct { - name string - want int64 - have int64 - }{ - {name: "RChar", want: 750339, have: int64(s.RChar)}, - {name: "WChar", want: 818609, have: int64(s.WChar)}, - {name: "SyscR", want: 7405, have: int64(s.SyscR)}, - {name: "SyscW", want: 5245, have: int64(s.SyscW)}, - {name: "ReadBytes", want: 1024, have: int64(s.ReadBytes)}, - {name: "WriteBytes", want: 2048, have: int64(s.WriteBytes)}, - {name: "CancelledWriteBytes", want: -1024, have: s.CancelledWriteBytes}, - } { - if test.want != test.have { - t.Errorf("want %s %d, have %d", test.name, test.want, test.have) - } - } -} diff --git a/vendor/github.com/prometheus/procfs/proc_limits.go b/vendor/github.com/prometheus/procfs/proc_limits.go deleted file mode 100644 index f04ba6fda..000000000 --- a/vendor/github.com/prometheus/procfs/proc_limits.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "bufio" - "fmt" - "os" - "regexp" - "strconv" -) - -// ProcLimits represents the soft limits for each of the process's resource -// limits. For more information see getrlimit(2): -// http://man7.org/linux/man-pages/man2/getrlimit.2.html. -type ProcLimits struct { - // CPU time limit in seconds. - CPUTime int64 - // Maximum size of files that the process may create. - FileSize int64 - // Maximum size of the process's data segment (initialized data, - // uninitialized data, and heap). - DataSize int64 - // Maximum size of the process stack in bytes. - StackSize int64 - // Maximum size of a core file. - CoreFileSize int64 - // Limit of the process's resident set in pages. - ResidentSet int64 - // Maximum number of processes that can be created for the real user ID of - // the calling process. - Processes int64 - // Value one greater than the maximum file descriptor number that can be - // opened by this process. - OpenFiles int64 - // Maximum number of bytes of memory that may be locked into RAM. - LockedMemory int64 - // Maximum size of the process's virtual memory address space in bytes. - AddressSpace int64 - // Limit on the combined number of flock(2) locks and fcntl(2) leases that - // this process may establish. - FileLocks int64 - // Limit of signals that may be queued for the real user ID of the calling - // process. - PendingSignals int64 - // Limit on the number of bytes that can be allocated for POSIX message - // queues for the real user ID of the calling process. - MsqqueueSize int64 - // Limit of the nice priority set using setpriority(2) or nice(2). - NicePriority int64 - // Limit of the real-time priority set using sched_setscheduler(2) or - // sched_setparam(2). - RealtimePriority int64 - // Limit (in microseconds) on the amount of CPU time that a process - // scheduled under a real-time scheduling policy may consume without making - // a blocking system call. - RealtimeTimeout int64 -} - -const ( - limitsFields = 3 - limitsUnlimited = "unlimited" -) - -var ( - limitsDelimiter = regexp.MustCompile(" +") -) - -// NewLimits returns the current soft limits of the process. -func (p Proc) NewLimits() (ProcLimits, error) { - f, err := os.Open(p.path("limits")) - if err != nil { - return ProcLimits{}, err - } - defer f.Close() - - var ( - l = ProcLimits{} - s = bufio.NewScanner(f) - ) - for s.Scan() { - fields := limitsDelimiter.Split(s.Text(), limitsFields) - if len(fields) != limitsFields { - return ProcLimits{}, fmt.Errorf( - "couldn't parse %s line %s", f.Name(), s.Text()) - } - - switch fields[0] { - case "Max cpu time": - l.CPUTime, err = parseInt(fields[1]) - case "Max file size": - l.FileSize, err = parseInt(fields[1]) - case "Max data size": - l.DataSize, err = parseInt(fields[1]) - case "Max stack size": - l.StackSize, err = parseInt(fields[1]) - case "Max core file size": - l.CoreFileSize, err = parseInt(fields[1]) - case "Max resident set": - l.ResidentSet, err = parseInt(fields[1]) - case "Max processes": - l.Processes, err = parseInt(fields[1]) - case "Max open files": - l.OpenFiles, err = parseInt(fields[1]) - case "Max locked memory": - l.LockedMemory, err = parseInt(fields[1]) - case "Max address space": - l.AddressSpace, err = parseInt(fields[1]) - case "Max file locks": - l.FileLocks, err = parseInt(fields[1]) - case "Max pending signals": - l.PendingSignals, err = parseInt(fields[1]) - case "Max msgqueue size": - l.MsqqueueSize, err = parseInt(fields[1]) - case "Max nice priority": - l.NicePriority, err = parseInt(fields[1]) - case "Max realtime priority": - l.RealtimePriority, err = parseInt(fields[1]) - case "Max realtime timeout": - l.RealtimeTimeout, err = parseInt(fields[1]) - } - if err != nil { - return ProcLimits{}, err - } - } - - return l, s.Err() -} - -func parseInt(s string) (int64, error) { - if s == limitsUnlimited { - return -1, nil - } - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - return 0, fmt.Errorf("couldn't parse value %s: %s", s, err) - } - return i, nil -} diff --git a/vendor/github.com/prometheus/procfs/proc_limits_test.go b/vendor/github.com/prometheus/procfs/proc_limits_test.go deleted file mode 100644 index ebb43ae74..000000000 --- a/vendor/github.com/prometheus/procfs/proc_limits_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import "testing" - -func TestNewLimits(t *testing.T) { - p, err := FS("fixtures").NewProc(26231) - if err != nil { - t.Fatal(err) - } - - l, err := p.NewLimits() - if err != nil { - t.Fatal(err) - } - - for _, test := range []struct { - name string - want int64 - have int64 - }{ - {name: "cpu time", want: -1, have: l.CPUTime}, - {name: "open files", want: 2048, have: l.OpenFiles}, - {name: "msgqueue size", want: 819200, have: l.MsqqueueSize}, - {name: "nice priority", want: 0, have: l.NicePriority}, - {name: "address space", want: 8589934592, have: l.AddressSpace}, - } { - if test.want != test.have { - t.Errorf("want %s %d, have %d", test.name, test.want, test.have) - } - } -} diff --git a/vendor/github.com/prometheus/procfs/proc_ns.go b/vendor/github.com/prometheus/procfs/proc_ns.go deleted file mode 100644 index d06c26eba..000000000 --- a/vendor/github.com/prometheus/procfs/proc_ns.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "fmt" - "os" - "strconv" - "strings" -) - -// Namespace represents a single namespace of a process. -type Namespace struct { - Type string // Namespace type. - Inode uint32 // Inode number of the namespace. If two processes are in the same namespace their inodes will match. -} - -// Namespaces contains all of the namespaces that the process is contained in. -type Namespaces map[string]Namespace - -// NewNamespaces reads from /proc/[pid/ns/* to get the namespaces of which the -// process is a member. -func (p Proc) NewNamespaces() (Namespaces, error) { - d, err := os.Open(p.path("ns")) - if err != nil { - return nil, err - } - defer d.Close() - - names, err := d.Readdirnames(-1) - if err != nil { - return nil, fmt.Errorf("failed to read contents of ns dir: %v", err) - } - - ns := make(Namespaces, len(names)) - for _, name := range names { - target, err := os.Readlink(p.path("ns", name)) - if err != nil { - return nil, err - } - - fields := strings.SplitN(target, ":", 2) - if len(fields) != 2 { - return nil, fmt.Errorf("failed to parse namespace type and inode from '%v'", target) - } - - typ := fields[0] - inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32) - if err != nil { - return nil, fmt.Errorf("failed to parse inode from '%v': %v", fields[1], err) - } - - ns[name] = Namespace{typ, uint32(inode)} - } - - return ns, nil -} diff --git a/vendor/github.com/prometheus/procfs/proc_ns_test.go b/vendor/github.com/prometheus/procfs/proc_ns_test.go deleted file mode 100644 index abfd63e5f..000000000 --- a/vendor/github.com/prometheus/procfs/proc_ns_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "testing" -) - -func TestNewNamespaces(t *testing.T) { - p, err := FS("fixtures").NewProc(26231) - if err != nil { - t.Fatal(err) - } - - namespaces, err := p.NewNamespaces() - if err != nil { - t.Fatal(err) - } - - expectedNamespaces := map[string]Namespace{ - "mnt": {"mnt", 4026531840}, - "net": {"net", 4026531993}, - } - - if want, have := len(expectedNamespaces), len(namespaces); want != have { - t.Errorf("want %d parsed namespaces, have %d", want, have) - } - for _, ns := range namespaces { - if want, have := expectedNamespaces[ns.Type], ns; want != have { - t.Errorf("%s: want %v, have %v", ns.Type, want, have) - } - } -} diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go deleted file mode 100644 index 3cf2a9f18..000000000 --- a/vendor/github.com/prometheus/procfs/proc_stat.go +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "bytes" - "fmt" - "io/ioutil" - "os" -) - -// Originally, this USER_HZ value was dynamically retrieved via a sysconf call -// which required cgo. However, that caused a lot of problems regarding -// cross-compilation. Alternatives such as running a binary to determine the -// value, or trying to derive it in some other way were all problematic. After -// much research it was determined that USER_HZ is actually hardcoded to 100 on -// all Go-supported platforms as of the time of this writing. This is why we -// decided to hardcode it here as well. It is not impossible that there could -// be systems with exceptions, but they should be very exotic edge cases, and -// in that case, the worst outcome will be two misreported metrics. -// -// See also the following discussions: -// -// - https://github.com/prometheus/node_exporter/issues/52 -// - https://github.com/prometheus/procfs/pull/2 -// - http://stackoverflow.com/questions/17410841/how-does-user-hz-solve-the-jiffy-scaling-issue -const userHZ = 100 - -// ProcStat provides status information about the process, -// read from /proc/[pid]/stat. -type ProcStat struct { - // The process ID. - PID int - // The filename of the executable. - Comm string - // The process state. - State string - // The PID of the parent of this process. - PPID int - // The process group ID of the process. - PGRP int - // The session ID of the process. - Session int - // The controlling terminal of the process. - TTY int - // The ID of the foreground process group of the controlling terminal of - // the process. - TPGID int - // The kernel flags word of the process. - Flags uint - // The number of minor faults the process has made which have not required - // loading a memory page from disk. - MinFlt uint - // The number of minor faults that the process's waited-for children have - // made. - CMinFlt uint - // The number of major faults the process has made which have required - // loading a memory page from disk. - MajFlt uint - // The number of major faults that the process's waited-for children have - // made. - CMajFlt uint - // Amount of time that this process has been scheduled in user mode, - // measured in clock ticks. - UTime uint - // Amount of time that this process has been scheduled in kernel mode, - // measured in clock ticks. - STime uint - // Amount of time that this process's waited-for children have been - // scheduled in user mode, measured in clock ticks. - CUTime uint - // Amount of time that this process's waited-for children have been - // scheduled in kernel mode, measured in clock ticks. - CSTime uint - // For processes running a real-time scheduling policy, this is the negated - // scheduling priority, minus one. - Priority int - // The nice value, a value in the range 19 (low priority) to -20 (high - // priority). - Nice int - // Number of threads in this process. - NumThreads int - // The time the process started after system boot, the value is expressed - // in clock ticks. - Starttime uint64 - // Virtual memory size in bytes. - VSize int - // Resident set size in pages. - RSS int - - fs FS -} - -// NewStat returns the current status information of the process. -func (p Proc) NewStat() (ProcStat, error) { - f, err := os.Open(p.path("stat")) - if err != nil { - return ProcStat{}, err - } - defer f.Close() - - data, err := ioutil.ReadAll(f) - if err != nil { - return ProcStat{}, err - } - - var ( - ignore int - - s = ProcStat{PID: p.PID, fs: p.fs} - l = bytes.Index(data, []byte("(")) - r = bytes.LastIndex(data, []byte(")")) - ) - - if l < 0 || r < 0 { - return ProcStat{}, fmt.Errorf( - "unexpected format, couldn't extract comm: %s", - data, - ) - } - - s.Comm = string(data[l+1 : r]) - _, err = fmt.Fscan( - bytes.NewBuffer(data[r+2:]), - &s.State, - &s.PPID, - &s.PGRP, - &s.Session, - &s.TTY, - &s.TPGID, - &s.Flags, - &s.MinFlt, - &s.CMinFlt, - &s.MajFlt, - &s.CMajFlt, - &s.UTime, - &s.STime, - &s.CUTime, - &s.CSTime, - &s.Priority, - &s.Nice, - &s.NumThreads, - &ignore, - &s.Starttime, - &s.VSize, - &s.RSS, - ) - if err != nil { - return ProcStat{}, err - } - - return s, nil -} - -// VirtualMemory returns the virtual memory size in bytes. -func (s ProcStat) VirtualMemory() int { - return s.VSize -} - -// ResidentMemory returns the resident memory size in bytes. -func (s ProcStat) ResidentMemory() int { - return s.RSS * os.Getpagesize() -} - -// StartTime returns the unix timestamp of the process in seconds. -func (s ProcStat) StartTime() (float64, error) { - stat, err := s.fs.NewStat() - if err != nil { - return 0, err - } - return float64(stat.BootTime) + (float64(s.Starttime) / userHZ), nil -} - -// CPUTime returns the total CPU user and system time in seconds. -func (s ProcStat) CPUTime() float64 { - return float64(s.UTime+s.STime) / userHZ -} diff --git a/vendor/github.com/prometheus/procfs/proc_stat_test.go b/vendor/github.com/prometheus/procfs/proc_stat_test.go deleted file mode 100644 index e2df8845f..000000000 --- a/vendor/github.com/prometheus/procfs/proc_stat_test.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "os" - "testing" -) - -func TestProcStat(t *testing.T) { - p, err := FS("fixtures").NewProc(26231) - if err != nil { - t.Fatal(err) - } - - s, err := p.NewStat() - if err != nil { - t.Fatal(err) - } - - for _, test := range []struct { - name string - want int - have int - }{ - {name: "pid", want: 26231, have: s.PID}, - {name: "user time", want: 1677, have: int(s.UTime)}, - {name: "system time", want: 44, have: int(s.STime)}, - {name: "start time", want: 82375, have: int(s.Starttime)}, - {name: "virtual memory size", want: 56274944, have: s.VSize}, - {name: "resident set size", want: 1981, have: s.RSS}, - } { - if test.want != test.have { - t.Errorf("want %s %d, have %d", test.name, test.want, test.have) - } - } -} - -func TestProcStatComm(t *testing.T) { - s1, err := testProcStat(26231) - if err != nil { - t.Fatal(err) - } - if want, have := "vim", s1.Comm; want != have { - t.Errorf("want comm %s, have %s", want, have) - } - - s2, err := testProcStat(584) - if err != nil { - t.Fatal(err) - } - if want, have := "(a b ) ( c d) ", s2.Comm; want != have { - t.Errorf("want comm %s, have %s", want, have) - } -} - -func TestProcStatVirtualMemory(t *testing.T) { - s, err := testProcStat(26231) - if err != nil { - t.Fatal(err) - } - - if want, have := 56274944, s.VirtualMemory(); want != have { - t.Errorf("want virtual memory %d, have %d", want, have) - } -} - -func TestProcStatResidentMemory(t *testing.T) { - s, err := testProcStat(26231) - if err != nil { - t.Fatal(err) - } - - if want, have := 1981*os.Getpagesize(), s.ResidentMemory(); want != have { - t.Errorf("want resident memory %d, have %d", want, have) - } -} - -func TestProcStatStartTime(t *testing.T) { - s, err := testProcStat(26231) - if err != nil { - t.Fatal(err) - } - - time, err := s.StartTime() - if err != nil { - t.Fatal(err) - } - if want, have := 1418184099.75, time; want != have { - t.Errorf("want start time %f, have %f", want, have) - } -} - -func TestProcStatCPUTime(t *testing.T) { - s, err := testProcStat(26231) - if err != nil { - t.Fatal(err) - } - - if want, have := 17.21, s.CPUTime(); want != have { - t.Errorf("want cpu time %f, have %f", want, have) - } -} - -func testProcStat(pid int) (ProcStat, error) { - p, err := FS("fixtures").NewProc(pid) - if err != nil { - return ProcStat{}, err - } - - return p.NewStat() -} diff --git a/vendor/github.com/prometheus/procfs/proc_test.go b/vendor/github.com/prometheus/procfs/proc_test.go deleted file mode 100644 index 2b342cae4..000000000 --- a/vendor/github.com/prometheus/procfs/proc_test.go +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "reflect" - "sort" - "testing" -) - -func TestSelf(t *testing.T) { - fs := FS("fixtures") - - p1, err := fs.NewProc(26231) - if err != nil { - t.Fatal(err) - } - p2, err := fs.Self() - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(p1, p2) { - t.Errorf("want process %v, have %v", p1, p2) - } -} - -func TestAllProcs(t *testing.T) { - procs, err := FS("fixtures").AllProcs() - if err != nil { - t.Fatal(err) - } - sort.Sort(procs) - for i, p := range []*Proc{{PID: 584}, {PID: 26231}} { - if want, have := p.PID, procs[i].PID; want != have { - t.Errorf("want processes %d, have %d", want, have) - } - } -} - -func TestCmdLine(t *testing.T) { - for _, tt := range []struct { - process int - want []string - }{ - {process: 26231, want: []string{"vim", "test.go", "+10"}}, - {process: 26232, want: []string{}}, - {process: 26233, want: []string{"com.github.uiautomator"}}, - } { - p1, err := FS("fixtures").NewProc(tt.process) - if err != nil { - t.Fatal(err) - } - c1, err := p1.CmdLine() - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(tt.want, c1) { - t.Errorf("want cmdline %v, have %v", tt.want, c1) - } - } -} - -func TestComm(t *testing.T) { - for _, tt := range []struct { - process int - want string - }{ - {process: 26231, want: "vim"}, - {process: 26232, want: "ata_sff"}, - } { - p1, err := FS("fixtures").NewProc(tt.process) - if err != nil { - t.Fatal(err) - } - c1, err := p1.Comm() - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(tt.want, c1) { - t.Errorf("want comm %v, have %v", tt.want, c1) - } - } -} - -func TestExecutable(t *testing.T) { - for _, tt := range []struct { - process int - want string - }{ - {process: 26231, want: "/usr/bin/vim"}, - {process: 26232, want: ""}, - } { - p, err := FS("fixtures").NewProc(tt.process) - if err != nil { - t.Fatal(err) - } - exe, err := p.Executable() - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(tt.want, exe) { - t.Errorf("want absolute path to exe %v, have %v", tt.want, exe) - } - } -} - -func TestCwd(t *testing.T) { - for _, tt := range []struct { - process int - want string - brokenLink bool - }{ - {process: 26231, want: "/usr/bin"}, - {process: 26232, want: "/does/not/exist", brokenLink: true}, - {process: 26233, want: ""}, - } { - p, err := FS("fixtures").NewProc(tt.process) - if err != nil { - t.Fatal(err) - } - wd, err := p.Cwd() - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(tt.want, wd) { - if wd == "" && tt.brokenLink { - // Allow the result to be empty when can't os.Readlink broken links - continue - } - t.Errorf("want absolute path to cwd %v, have %v", tt.want, wd) - } - } -} - -func TestRoot(t *testing.T) { - for _, tt := range []struct { - process int - want string - brokenLink bool - }{ - {process: 26231, want: "/"}, - {process: 26232, want: "/does/not/exist", brokenLink: true}, - {process: 26233, want: ""}, - } { - p, err := FS("fixtures").NewProc(tt.process) - if err != nil { - t.Fatal(err) - } - rdir, err := p.RootDir() - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(tt.want, rdir) { - if rdir == "" && tt.brokenLink { - // Allow the result to be empty when can't os.Readlink broken links - continue - } - t.Errorf("want absolute path to rootdir %v, have %v", tt.want, rdir) - } - } -} - -func TestFileDescriptors(t *testing.T) { - p1, err := FS("fixtures").NewProc(26231) - if err != nil { - t.Fatal(err) - } - fds, err := p1.FileDescriptors() - if err != nil { - t.Fatal(err) - } - sort.Sort(byUintptr(fds)) - if want := []uintptr{0, 1, 2, 3, 10}; !reflect.DeepEqual(want, fds) { - t.Errorf("want fds %v, have %v", want, fds) - } -} - -func TestFileDescriptorTargets(t *testing.T) { - p1, err := FS("fixtures").NewProc(26231) - if err != nil { - t.Fatal(err) - } - fds, err := p1.FileDescriptorTargets() - if err != nil { - t.Fatal(err) - } - sort.Strings(fds) - var want = []string{ - "../../symlinktargets/abc", - "../../symlinktargets/def", - "../../symlinktargets/ghi", - "../../symlinktargets/uvw", - "../../symlinktargets/xyz", - } - if !reflect.DeepEqual(want, fds) { - t.Errorf("want fds %v, have %v", want, fds) - } -} - -func TestFileDescriptorsLen(t *testing.T) { - p1, err := FS("fixtures").NewProc(26231) - if err != nil { - t.Fatal(err) - } - l, err := p1.FileDescriptorsLen() - if err != nil { - t.Fatal(err) - } - if want, have := 5, l; want != have { - t.Errorf("want fds %d, have %d", want, have) - } -} - -type byUintptr []uintptr - -func (a byUintptr) Len() int { return len(a) } -func (a byUintptr) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byUintptr) Less(i, j int) bool { return a[i] < a[j] } diff --git a/vendor/github.com/prometheus/procfs/scripts/check_license.sh b/vendor/github.com/prometheus/procfs/scripts/check_license.sh deleted file mode 100755 index ac13e9605..000000000 --- a/vendor/github.com/prometheus/procfs/scripts/check_license.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# -# Copyright 2018 The Prometheus 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. - -check_license() { - local file="" - for file in $(find . -type f -iname '*.go' ! -path './vendor/*'); do - head -n3 "${file}" | grep -Eq "(Copyright|generated|GENERATED)" || echo " ${file}" - done -} - -licRes=$(check_license) - -if [ -n "${licRes}" ]; then - echo "license header checking failed:" - echo "${licRes}" - exit 255 -fi diff --git a/vendor/github.com/prometheus/procfs/stat.go b/vendor/github.com/prometheus/procfs/stat.go deleted file mode 100644 index 61eb6b0e3..000000000 --- a/vendor/github.com/prometheus/procfs/stat.go +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import ( - "bufio" - "fmt" - "io" - "os" - "strconv" - "strings" -) - -// CPUStat shows how much time the cpu spend in various stages. -type CPUStat struct { - User float64 - Nice float64 - System float64 - Idle float64 - Iowait float64 - IRQ float64 - SoftIRQ float64 - Steal float64 - Guest float64 - GuestNice float64 -} - -// SoftIRQStat represent the softirq statistics as exported in the procfs stat file. -// A nice introduction can be found at https://0xax.gitbooks.io/linux-insides/content/interrupts/interrupts-9.html -// It is possible to get per-cpu stats by reading /proc/softirqs -type SoftIRQStat struct { - Hi uint64 - Timer uint64 - NetTx uint64 - NetRx uint64 - Block uint64 - BlockIoPoll uint64 - Tasklet uint64 - Sched uint64 - Hrtimer uint64 - Rcu uint64 -} - -// Stat represents kernel/system statistics. -type Stat struct { - // Boot time in seconds since the Epoch. - BootTime uint64 - // Summed up cpu statistics. - CPUTotal CPUStat - // Per-CPU statistics. - CPU []CPUStat - // Number of times interrupts were handled, which contains numbered and unnumbered IRQs. - IRQTotal uint64 - // Number of times a numbered IRQ was triggered. - IRQ []uint64 - // Number of times a context switch happened. - ContextSwitches uint64 - // Number of times a process was created. - ProcessCreated uint64 - // Number of processes currently running. - ProcessesRunning uint64 - // Number of processes currently blocked (waiting for IO). - ProcessesBlocked uint64 - // Number of times a softirq was scheduled. - SoftIRQTotal uint64 - // Detailed softirq statistics. - SoftIRQ SoftIRQStat -} - -// NewStat returns kernel/system statistics read from /proc/stat. -func NewStat() (Stat, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return Stat{}, err - } - - return fs.NewStat() -} - -// Parse a cpu statistics line and returns the CPUStat struct plus the cpu id (or -1 for the overall sum). -func parseCPUStat(line string) (CPUStat, int64, error) { - cpuStat := CPUStat{} - var cpu string - - count, err := fmt.Sscanf(line, "%s %f %f %f %f %f %f %f %f %f %f", - &cpu, - &cpuStat.User, &cpuStat.Nice, &cpuStat.System, &cpuStat.Idle, - &cpuStat.Iowait, &cpuStat.IRQ, &cpuStat.SoftIRQ, &cpuStat.Steal, - &cpuStat.Guest, &cpuStat.GuestNice) - - if err != nil && err != io.EOF { - return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu): %s", line, err) - } - if count == 0 { - return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu): 0 elements parsed", line) - } - - cpuStat.User /= userHZ - cpuStat.Nice /= userHZ - cpuStat.System /= userHZ - cpuStat.Idle /= userHZ - cpuStat.Iowait /= userHZ - cpuStat.IRQ /= userHZ - cpuStat.SoftIRQ /= userHZ - cpuStat.Steal /= userHZ - cpuStat.Guest /= userHZ - cpuStat.GuestNice /= userHZ - - if cpu == "cpu" { - return cpuStat, -1, nil - } - - cpuID, err := strconv.ParseInt(cpu[3:], 10, 64) - if err != nil { - return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu/cpuid): %s", line, err) - } - - return cpuStat, cpuID, nil -} - -// Parse a softirq line. -func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) { - softIRQStat := SoftIRQStat{} - var total uint64 - var prefix string - - _, err := fmt.Sscanf(line, "%s %d %d %d %d %d %d %d %d %d %d %d", - &prefix, &total, - &softIRQStat.Hi, &softIRQStat.Timer, &softIRQStat.NetTx, &softIRQStat.NetRx, - &softIRQStat.Block, &softIRQStat.BlockIoPoll, - &softIRQStat.Tasklet, &softIRQStat.Sched, - &softIRQStat.Hrtimer, &softIRQStat.Rcu) - - if err != nil { - return SoftIRQStat{}, 0, fmt.Errorf("couldn't parse %s (softirq): %s", line, err) - } - - return softIRQStat, total, nil -} - -// NewStat returns an information about current kernel/system statistics. -func (fs FS) NewStat() (Stat, error) { - // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt - - f, err := os.Open(fs.Path("stat")) - if err != nil { - return Stat{}, err - } - defer f.Close() - - stat := Stat{} - - scanner := bufio.NewScanner(f) - for scanner.Scan() { - line := scanner.Text() - parts := strings.Fields(scanner.Text()) - // require at least - if len(parts) < 2 { - continue - } - switch { - case parts[0] == "btime": - if stat.BootTime, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (btime): %s", parts[1], err) - } - case parts[0] == "intr": - if stat.IRQTotal, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (intr): %s", parts[1], err) - } - numberedIRQs := parts[2:] - stat.IRQ = make([]uint64, len(numberedIRQs)) - for i, count := range numberedIRQs { - if stat.IRQ[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (intr%d): %s", count, i, err) - } - } - case parts[0] == "ctxt": - if stat.ContextSwitches, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (ctxt): %s", parts[1], err) - } - case parts[0] == "processes": - if stat.ProcessCreated, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (processes): %s", parts[1], err) - } - case parts[0] == "procs_running": - if stat.ProcessesRunning, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (procs_running): %s", parts[1], err) - } - case parts[0] == "procs_blocked": - if stat.ProcessesBlocked, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (procs_blocked): %s", parts[1], err) - } - case parts[0] == "softirq": - softIRQStats, total, err := parseSoftIRQStat(line) - if err != nil { - return Stat{}, err - } - stat.SoftIRQTotal = total - stat.SoftIRQ = softIRQStats - case strings.HasPrefix(parts[0], "cpu"): - cpuStat, cpuID, err := parseCPUStat(line) - if err != nil { - return Stat{}, err - } - if cpuID == -1 { - stat.CPUTotal = cpuStat - } else { - for int64(len(stat.CPU)) <= cpuID { - stat.CPU = append(stat.CPU, CPUStat{}) - } - stat.CPU[cpuID] = cpuStat - } - } - } - - if err := scanner.Err(); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s: %s", f.Name(), err) - } - - return stat, nil -} diff --git a/vendor/github.com/prometheus/procfs/stat_test.go b/vendor/github.com/prometheus/procfs/stat_test.go deleted file mode 100644 index 2043b5e43..000000000 --- a/vendor/github.com/prometheus/procfs/stat_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2018 The Prometheus 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 procfs - -import "testing" - -func TestStat(t *testing.T) { - s, err := FS("fixtures").NewStat() - if err != nil { - t.Fatal(err) - } - - // cpu - if want, have := float64(301854)/userHZ, s.CPUTotal.User; want != have { - t.Errorf("want cpu/user %v, have %v", want, have) - } - if want, have := float64(31)/userHZ, s.CPU[7].SoftIRQ; want != have { - t.Errorf("want cpu7/softirq %v, have %v", want, have) - } - - // intr - if want, have := uint64(8885917), s.IRQTotal; want != have { - t.Errorf("want irq/total %d, have %d", want, have) - } - if want, have := uint64(1), s.IRQ[8]; want != have { - t.Errorf("want irq8 %d, have %d", want, have) - } - - // ctxt - if want, have := uint64(38014093), s.ContextSwitches; want != have { - t.Errorf("want context switches (ctxt) %d, have %d", want, have) - } - - // btime - if want, have := uint64(1418183276), s.BootTime; want != have { - t.Errorf("want boot time (btime) %d, have %d", want, have) - } - - // processes - if want, have := uint64(26442), s.ProcessCreated; want != have { - t.Errorf("want process created (processes) %d, have %d", want, have) - } - - // procs_running - if want, have := uint64(2), s.ProcessesRunning; want != have { - t.Errorf("want processes running (procs_running) %d, have %d", want, have) - } - - // procs_blocked - if want, have := uint64(1), s.ProcessesBlocked; want != have { - t.Errorf("want processes blocked (procs_blocked) %d, have %d", want, have) - } - - // softirq - if want, have := uint64(5057579), s.SoftIRQTotal; want != have { - t.Errorf("want softirq total %d, have %d", want, have) - } - - if want, have := uint64(508444), s.SoftIRQ.Rcu; want != have { - t.Errorf("want softirq RCU %d, have %d", want, have) - } - -} diff --git a/vendor/github.com/prometheus/procfs/sysfs/.gitignore b/vendor/github.com/prometheus/procfs/sysfs/.gitignore deleted file mode 100644 index 67fc140b9..000000000 --- a/vendor/github.com/prometheus/procfs/sysfs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -fixtures/ diff --git a/vendor/github.com/prometheus/procfs/sysfs/doc.go b/vendor/github.com/prometheus/procfs/sysfs/doc.go deleted file mode 100644 index 9a6c244e9..000000000 --- a/vendor/github.com/prometheus/procfs/sysfs/doc.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 The Prometheus 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 sysfs provides functions to retrieve system and kernel metrics -// from the pseudo-filesystem sys. -package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/fixtures.ttar b/vendor/github.com/prometheus/procfs/sysfs/fixtures.ttar deleted file mode 100644 index c0ac683e3..000000000 --- a/vendor/github.com/prometheus/procfs/sysfs/fixtures.ttar +++ /dev/null @@ -1,999 +0,0 @@ -# Archive created by ttar -C sysfs/ -c -f sysfs/fixtures.ttar fixtures/ -Directory: fixtures -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/class -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/class/net -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/class/net/eth0 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/addr_assign_type -Lines: 1 -3 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/addr_len -Lines: 1 -6 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/address -Lines: 1 -01:01:01:01:01:01 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/broadcast -Lines: 1 -ff:ff:ff:ff:ff:ff -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/carrier -Lines: 1 -1 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/carrier_changes -Lines: 1 -2 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/carrier_down_count -Lines: 1 -1 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/carrier_up_count -Lines: 1 -1 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/dev_id -Lines: 1 -0x20 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/dormant -Lines: 1 -1 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/duplex -Lines: 1 -full -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/flags -Lines: 1 -0x1303 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/ifalias -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/ifindex -Lines: 1 -2 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/iflink -Lines: 1 -2 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/link_mode -Lines: 1 -1 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/mtu -Lines: 1 -1500 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/name_assign_type -Lines: 1 -2 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/netdev_group -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/operstate -Lines: 1 -up -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/phys_port_id -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/phys_port_name -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/phys_switch_id -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/speed -Lines: 1 -1000 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/tx_queue_len -Lines: 1 -1000 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/class/net/eth0/type -Lines: 1 -1 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/dirty_data -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_hit_ratio -Lines: 1 -100 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_hits -Lines: 1 -289 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_hit_ratio -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_hit_ratio -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_hit_ratio -Lines: 1 -100 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_hits -Lines: 1 -546 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata5 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache/io_errors -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache/metadata_written -Lines: 1 -512 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache/priority_stats -Lines: 5 -Unused: 99% -Metadata: 0% -Average: 10473 -Sectors per Q: 64 -Quantiles: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946] -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache/written -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/system -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/system/cpu -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/system/cpu/cpu0 -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu0/cpufreq -SymlinkTo: ../cpufreq/policy0 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/system/cpu/cpu1 -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/system/cpu/cpu1/cpufreq -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq -Lines: 1 -1200195 -Mode: 400 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/cpuinfo_max_freq -Lines: 1 -3300000 -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq -Lines: 1 -1200000 -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/cpuinfo_transition_latency -Lines: 1 -4294967295 -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/related_cpus -Lines: 1 -1 -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/scaling_available_governors -Lines: 1 -performance powersave -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/scaling_driver -Lines: 1 -intel_pstate -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/scaling_governor -Lines: 1 -powersave -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/scaling_max_freq -Lines: 1 -3300000 -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/scaling_min_freq -Lines: 1 -1200000 -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpu1/cpufreq/scaling_setspeed -Lines: 1 - -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/system/cpu/cpufreq -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/system/cpu/cpufreq/policy0 -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/affected_cpus -Lines: 1 -0 -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq -Lines: 1 -2400000 -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/cpuinfo_min_freq -Lines: 1 -800000 -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/cpuinfo_transition_latency -Lines: 1 -0 -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/related_cpus -Lines: 1 -0 -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/scaling_available_governors -Lines: 1 -performance powersave -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/scaling_cur_freq -Lines: 1 -1219917 -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/scaling_driver -Lines: 1 -intel_pstate -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/scaling_governor -Lines: 1 -powersave -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/scaling_max_freq -Lines: 1 -2400000 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/scaling_min_freq -Lines: 1 -800000 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/devices/system/cpu/cpufreq/policy0/scaling_setspeed -Lines: 1 - -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/devices/system/cpu/cpufreq/policy1 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/average_key_size -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0 -Mode: 777 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/dirty_data -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_hit_ratio -Lines: 1 -100 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_hits -Lines: 1 -289 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_hit_ratio -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_hit_ratio -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_hit_ratio -Lines: 1 -100 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_hits -Lines: 1 -546 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/btree_cache_size -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0 -Mode: 777 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0/io_errors -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0/metadata_written -Lines: 1 -512 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0/priority_stats -Lines: 5 -Unused: 99% -Metadata: 0% -Average: 10473 -Sectors per Q: 64 -Quantiles: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946] -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0/written -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache_available_percent -Lines: 1 -100 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/congested -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal/active_journal_entries -Lines: 1 -1 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal/btree_nodes -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal/btree_read_average_duration_us -Lines: 1 -1305 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal/cache_read_races -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/root_usage_percent -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_hit_ratio -Lines: 1 -100 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_hits -Lines: 1 -289 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_hit_ratio -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_hit_ratio -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/bypassed -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_bypass_hits -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_bypass_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_hit_ratio -Lines: 1 -100 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_hits -Lines: 1 -546 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_miss_collisions -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_misses -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_readaheads -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/tree_depth -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/xfs -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/xfs/sda1 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/xfs/sda1/stats -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/xfs/sda1/stats/stats -Lines: 1 -extent_alloc 1 0 0 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/xfs/sdb1 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/fs/xfs/sdb1/stats -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/fs/xfs/sdb1/stats/stats -Lines: 1 -extent_alloc 2 0 0 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/github.com/prometheus/procfs/sysfs/fs.go b/vendor/github.com/prometheus/procfs/sysfs/fs.go deleted file mode 100644 index fb15d438a..000000000 --- a/vendor/github.com/prometheus/procfs/sysfs/fs.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2017 The Prometheus 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 sysfs - -import ( - "fmt" - "os" - "path/filepath" - - "github.com/prometheus/procfs/bcache" - "github.com/prometheus/procfs/xfs" -) - -// FS represents the pseudo-filesystem sys, which provides an interface to -// kernel data structures. -type FS string - -// DefaultMountPoint is the common mount point of the sys filesystem. -const DefaultMountPoint = "/sys" - -// NewFS returns a new FS mounted under the given mountPoint. It will error -// if the mount point can't be read. -func NewFS(mountPoint string) (FS, error) { - info, err := os.Stat(mountPoint) - if err != nil { - return "", fmt.Errorf("could not read %s: %s", mountPoint, err) - } - if !info.IsDir() { - return "", fmt.Errorf("mount point %s is not a directory", mountPoint) - } - - return FS(mountPoint), nil -} - -// Path returns the path of the given subsystem relative to the sys root. -func (fs FS) Path(p ...string) string { - return filepath.Join(append([]string{string(fs)}, p...)...) -} - -// XFSStats retrieves XFS filesystem runtime statistics for each mounted XFS -// filesystem. Only available on kernel 4.4+. On older kernels, an empty -// slice of *xfs.Stats will be returned. -func (fs FS) XFSStats() ([]*xfs.Stats, error) { - matches, err := filepath.Glob(fs.Path("fs/xfs/*/stats/stats")) - if err != nil { - return nil, err - } - - stats := make([]*xfs.Stats, 0, len(matches)) - for _, m := range matches { - f, err := os.Open(m) - if err != nil { - return nil, err - } - - // "*" used in glob above indicates the name of the filesystem. - name := filepath.Base(filepath.Dir(filepath.Dir(m))) - - // File must be closed after parsing, regardless of success or - // failure. Defer is not used because of the loop. - s, err := xfs.ParseStats(f) - _ = f.Close() - if err != nil { - return nil, err - } - - s.Name = name - stats = append(stats, s) - } - - return stats, nil -} - -// BcacheStats retrieves bcache runtime statistics for each bcache. -func (fs FS) BcacheStats() ([]*bcache.Stats, error) { - matches, err := filepath.Glob(fs.Path("fs/bcache/*-*")) - if err != nil { - return nil, err - } - - stats := make([]*bcache.Stats, 0, len(matches)) - for _, uuidPath := range matches { - // "*-*" in glob above indicates the name of the bcache. - name := filepath.Base(uuidPath) - - // stats - s, err := bcache.GetStats(uuidPath) - if err != nil { - return nil, err - } - - s.Name = name - stats = append(stats, s) - } - - return stats, nil -} diff --git a/vendor/github.com/prometheus/procfs/sysfs/fs_test.go b/vendor/github.com/prometheus/procfs/sysfs/fs_test.go deleted file mode 100644 index 2b7402eca..000000000 --- a/vendor/github.com/prometheus/procfs/sysfs/fs_test.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2017 The Prometheus 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 sysfs - -import "testing" - -func TestNewFS(t *testing.T) { - if _, err := NewFS("foobar"); err == nil { - t.Error("want NewFS to fail for non-existing mount point") - } - - if _, err := NewFS("doc.go"); err == nil { - t.Error("want NewFS to fail if mount point is not a directory") - } -} - -func TestFSXFSStats(t *testing.T) { - stats, err := FS("fixtures").XFSStats() - if err != nil { - t.Fatalf("failed to parse XFS stats: %v", err) - } - - tests := []struct { - name string - allocated uint32 - }{ - { - name: "sda1", - allocated: 1, - }, - { - name: "sdb1", - allocated: 2, - }, - } - - const expect = 2 - - if l := len(stats); l != expect { - t.Fatalf("unexpected number of XFS stats: %d", l) - } - if l := len(tests); l != expect { - t.Fatalf("unexpected number of tests: %d", l) - } - - for i, tt := range tests { - if want, got := tt.name, stats[i].Name; want != got { - t.Errorf("unexpected stats name:\nwant: %q\nhave: %q", want, got) - } - - if want, got := tt.allocated, stats[i].ExtentAllocation.ExtentsAllocated; want != got { - t.Errorf("unexpected extents allocated:\nwant: %d\nhave: %d", want, got) - } - } -} - -func TestFSBcacheStats(t *testing.T) { - stats, err := FS("fixtures").BcacheStats() - if err != nil { - t.Fatalf("failed to parse bcache stats: %v", err) - } - - tests := []struct { - name string - bdevs int - caches int - }{ - { - name: "deaddd54-c735-46d5-868e-f331c5fd7c74", - bdevs: 1, - caches: 1, - }, - } - - const expect = 1 - - if l := len(stats); l != expect { - t.Fatalf("unexpected number of bcache stats: %d", l) - } - if l := len(tests); l != expect { - t.Fatalf("unexpected number of tests: %d", l) - } - - for i, tt := range tests { - if want, got := tt.name, stats[i].Name; want != got { - t.Errorf("unexpected stats name:\nwant: %q\nhave: %q", want, got) - } - - if want, got := tt.bdevs, len(stats[i].Bdevs); want != got { - t.Errorf("unexpected value allocated:\nwant: %d\nhave: %d", want, got) - } - - if want, got := tt.caches, len(stats[i].Caches); want != got { - t.Errorf("unexpected value allocated:\nwant: %d\nhave: %d", want, got) - } - } -} diff --git a/vendor/github.com/prometheus/procfs/sysfs/net_class.go b/vendor/github.com/prometheus/procfs/sysfs/net_class.go deleted file mode 100644 index 1de96225d..000000000 --- a/vendor/github.com/prometheus/procfs/sysfs/net_class.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2018 The Prometheus 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. - -// +build !windows - -package sysfs - -import ( - "fmt" - "io/ioutil" - "os" - "reflect" - "strconv" - "strings" - - "github.com/prometheus/procfs/internal/util" -) - -// NetClassIface contains info from files in /sys/class/net/ -// for single interface (iface). -type NetClassIface struct { - Name string // Interface name - AddrAssignType *int64 `fileName:"addr_assign_type"` // /sys/class/net//addr_assign_type - AddrLen *int64 `fileName:"addr_len"` // /sys/class/net//addr_len - Address string `fileName:"address"` // /sys/class/net//address - Broadcast string `fileName:"broadcast"` // /sys/class/net//broadcast - Carrier *int64 `fileName:"carrier"` // /sys/class/net//carrier - CarrierChanges *int64 `fileName:"carrier_changes"` // /sys/class/net//carrier_changes - CarrierUpCount *int64 `fileName:"carrier_up_count"` // /sys/class/net//carrier_up_count - CarrierDownCount *int64 `fileName:"carrier_down_count"` // /sys/class/net//carrier_down_count - DevID *int64 `fileName:"dev_id"` // /sys/class/net//dev_id - Dormant *int64 `fileName:"dormant"` // /sys/class/net//dormant - Duplex string `fileName:"duplex"` // /sys/class/net//duplex - Flags *int64 `fileName:"flags"` // /sys/class/net//flags - IfAlias string `fileName:"ifalias"` // /sys/class/net//ifalias - IfIndex *int64 `fileName:"ifindex"` // /sys/class/net//ifindex - IfLink *int64 `fileName:"iflink"` // /sys/class/net//iflink - LinkMode *int64 `fileName:"link_mode"` // /sys/class/net//link_mode - MTU *int64 `fileName:"mtu"` // /sys/class/net//mtu - NameAssignType *int64 `fileName:"name_assign_type"` // /sys/class/net//name_assign_type - NetDevGroup *int64 `fileName:"netdev_group"` // /sys/class/net//netdev_group - OperState string `fileName:"operstate"` // /sys/class/net//operstate - PhysPortID string `fileName:"phys_port_id"` // /sys/class/net//phys_port_id - PhysPortName string `fileName:"phys_port_name"` // /sys/class/net//phys_port_name - PhysSwitchID string `fileName:"phys_switch_id"` // /sys/class/net//phys_switch_id - Speed *int64 `fileName:"speed"` // /sys/class/net//speed - TxQueueLen *int64 `fileName:"tx_queue_len"` // /sys/class/net//tx_queue_len - Type *int64 `fileName:"type"` // /sys/class/net//type -} - -// NetClass is collection of info for every interface (iface) in /sys/class/net. The map keys -// are interface (iface) names. -type NetClass map[string]NetClassIface - -// NewNetClass returns info for all net interfaces (iface) read from /sys/class/net/. -func NewNetClass() (NetClass, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return nil, err - } - - return fs.NewNetClass() -} - -// NewNetClass returns info for all net interfaces (iface) read from /sys/class/net/. -func (fs FS) NewNetClass() (NetClass, error) { - path := fs.Path("class/net") - - devices, err := ioutil.ReadDir(path) - if err != nil { - return NetClass{}, fmt.Errorf("cannot access %s dir %s", path, err) - } - - netClass := NetClass{} - for _, deviceDir := range devices { - if deviceDir.Mode().IsRegular() { - continue - } - interfaceClass, err := netClass.parseNetClassIface(path + "/" + deviceDir.Name()) - if err != nil { - return nil, err - } - interfaceClass.Name = deviceDir.Name() - netClass[deviceDir.Name()] = *interfaceClass - } - return netClass, nil -} - -// parseNetClassIface scans predefined files in /sys/class/net/ -// directory and gets their contents. -func (nc NetClass) parseNetClassIface(devicePath string) (*NetClassIface, error) { - interfaceClass := NetClassIface{} - interfaceElem := reflect.ValueOf(&interfaceClass).Elem() - interfaceType := reflect.TypeOf(interfaceClass) - - //start from 1 - skip the Name field - for i := 1; i < interfaceElem.NumField(); i++ { - fieldType := interfaceType.Field(i) - fieldValue := interfaceElem.Field(i) - - if fieldType.Tag.Get("fileName") == "" { - panic(fmt.Errorf("field %s does not have a filename tag", fieldType.Name)) - } - - value, err := util.SysReadFile(devicePath + "/" + fieldType.Tag.Get("fileName")) - - if err != nil { - if os.IsNotExist(err) || err.Error() == "operation not supported" || err.Error() == "invalid argument" { - continue - } - return nil, fmt.Errorf("could not access file %s: %s", fieldType.Tag.Get("fileName"), err) - } - - switch fieldValue.Kind() { - case reflect.String: - fieldValue.SetString(value) - case reflect.Ptr: - var int64ptr *int64 - switch fieldValue.Type() { - case reflect.TypeOf(int64ptr): - var intValue int64 - if strings.HasPrefix(value, "0x") { - intValue, err = strconv.ParseInt(value[2:], 16, 64) - if err != nil { - return nil, fmt.Errorf("expected hex value for %s, got: %s", fieldType.Name, value) - } - } else { - intValue, err = strconv.ParseInt(value, 10, 64) - if err != nil { - return nil, fmt.Errorf("expected Uint64 value for %s, got: %s", fieldType.Name, value) - } - } - fieldValue.Set(reflect.ValueOf(&intValue)) - default: - return nil, fmt.Errorf("unhandled pointer type %q", fieldValue.Type()) - } - default: - return nil, fmt.Errorf("unhandled type %q", fieldValue.Kind()) - } - } - - return &interfaceClass, nil -} diff --git a/vendor/github.com/prometheus/procfs/sysfs/net_class_test.go b/vendor/github.com/prometheus/procfs/sysfs/net_class_test.go deleted file mode 100644 index abc869ebe..000000000 --- a/vendor/github.com/prometheus/procfs/sysfs/net_class_test.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2018 The Prometheus 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. - -// +build !windows - -package sysfs - -import ( - "reflect" - "testing" -) - -func TestNewNetClass(t *testing.T) { - fs, err := NewFS("fixtures") - if err != nil { - t.Fatal(err) - } - - nc, err := fs.NewNetClass() - if err != nil { - t.Fatal(err) - } - - var ( - addrAssignType int64 = 3 - addrLen int64 = 6 - carrier int64 = 1 - carrierChanges int64 = 2 - carrierDownCount int64 = 1 - carrierUpCount int64 = 1 - devID int64 = 32 - dormant int64 = 1 - flags int64 = 4867 - ifIndex int64 = 2 - ifLink int64 = 2 - linkMode int64 = 1 - mtu int64 = 1500 - nameAssignType int64 = 2 - netDevGroup int64 = 0 - speed int64 = 1000 - txQueueLen int64 = 1000 - netType int64 = 1 - ) - - netClass := NetClass{ - "eth0": { - Address: "01:01:01:01:01:01", - AddrAssignType: &addrAssignType, - AddrLen: &addrLen, - Broadcast: "ff:ff:ff:ff:ff:ff", - Carrier: &carrier, - CarrierChanges: &carrierChanges, - CarrierDownCount: &carrierDownCount, - CarrierUpCount: &carrierUpCount, - DevID: &devID, - Dormant: &dormant, - Duplex: "full", - Flags: &flags, - IfAlias: "", - IfIndex: &ifIndex, - IfLink: &ifLink, - LinkMode: &linkMode, - MTU: &mtu, - Name: "eth0", - NameAssignType: &nameAssignType, - NetDevGroup: &netDevGroup, - OperState: "up", - PhysPortID: "", - PhysPortName: "", - PhysSwitchID: "", - Speed: &speed, - TxQueueLen: &txQueueLen, - Type: &netType, - }, - } - - if !reflect.DeepEqual(netClass, nc) { - t.Errorf("Result not correct: want %v, have %v", netClass, nc) - } -} diff --git a/vendor/github.com/prometheus/procfs/sysfs/system_cpu.go b/vendor/github.com/prometheus/procfs/sysfs/system_cpu.go deleted file mode 100644 index c90f569c4..000000000 --- a/vendor/github.com/prometheus/procfs/sysfs/system_cpu.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2018 The Prometheus 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. - -// +build !windows - -package sysfs - -import ( - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/prometheus/procfs/internal/util" -) - -// SystemCPUCpufreqStats contains stats from devices/system/cpu/cpu[0-9]*/cpufreq/... -type SystemCPUCpufreqStats struct { - Name string - CurrentFrequency uint64 - MinimumFrequency uint64 - MaximumFrequency uint64 - TransitionLatency uint64 - AvailableGovernors string - Driver string - Govenor string - RelatedCpus string - SetSpeed string -} - -// TODO: Add topology support. - -// TODO: Add thermal_throttle support. - -// NewSystemCpufreq returns CPU frequency metrics for all CPUs. -func NewSystemCpufreq() ([]SystemCPUCpufreqStats, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return []SystemCPUCpufreqStats{}, err - } - - return fs.NewSystemCpufreq() -} - -// NewSystemCpufreq returns CPU frequency metrics for all CPUs. -func (fs FS) NewSystemCpufreq() ([]SystemCPUCpufreqStats, error) { - var cpufreq = &SystemCPUCpufreqStats{} - - cpus, err := filepath.Glob(fs.Path("devices/system/cpu/cpu[0-9]*")) - if err != nil { - return []SystemCPUCpufreqStats{}, err - } - - systemCpufreq := []SystemCPUCpufreqStats{} - for _, cpu := range cpus { - cpuName := filepath.Base(cpu) - cpuNum := strings.TrimPrefix(cpuName, "cpu") - - cpuCpufreqPath := filepath.Join(cpu, "cpufreq") - if _, err := os.Stat(cpuCpufreqPath); os.IsNotExist(err) { - continue - } - if err != nil { - return []SystemCPUCpufreqStats{}, err - } - - if _, err = os.Stat(filepath.Join(cpuCpufreqPath, "scaling_cur_freq")); err == nil { - cpufreq, err = parseCpufreqCpuinfo("scaling", cpuCpufreqPath) - } else if _, err = os.Stat(filepath.Join(cpuCpufreqPath, "cpuinfo_cur_freq")); err == nil { - // Older kernels have metrics named `cpuinfo_...`. - cpufreq, err = parseCpufreqCpuinfo("cpuinfo", cpuCpufreqPath) - } else { - return []SystemCPUCpufreqStats{}, fmt.Errorf("CPU %v is missing cpufreq", cpu) - } - if err != nil { - return []SystemCPUCpufreqStats{}, err - } - cpufreq.Name = cpuNum - systemCpufreq = append(systemCpufreq, *cpufreq) - } - - return systemCpufreq, nil -} - -func parseCpufreqCpuinfo(prefix string, cpuPath string) (*SystemCPUCpufreqStats, error) { - uintFiles := []string{ - prefix + "_cur_freq", - prefix + "_max_freq", - prefix + "_min_freq", - "cpuinfo_transition_latency", - } - uintOut := make([]uint64, len(uintFiles)) - - for i, f := range uintFiles { - v, err := util.ReadUintFromFile(filepath.Join(cpuPath, f)) - if err != nil { - return &SystemCPUCpufreqStats{}, err - } - - uintOut[i] = v - } - - stringFiles := []string{ - "scaling_available_governors", - "scaling_driver", - "scaling_governor", - "related_cpus", - "scaling_setspeed", - } - stringOut := make([]string, len(stringFiles)) - var err error - - for i, f := range stringFiles { - stringOut[i], err = util.SysReadFile(filepath.Join(cpuPath, f)) - if err != nil { - return &SystemCPUCpufreqStats{}, err - } - } - - return &SystemCPUCpufreqStats{ - CurrentFrequency: uintOut[0], - MaximumFrequency: uintOut[1], - MinimumFrequency: uintOut[2], - TransitionLatency: uintOut[3], - AvailableGovernors: stringOut[0], - Driver: stringOut[1], - Govenor: stringOut[2], - RelatedCpus: stringOut[3], - SetSpeed: stringOut[4], - }, nil -} diff --git a/vendor/github.com/prometheus/procfs/sysfs/system_cpu_test.go b/vendor/github.com/prometheus/procfs/sysfs/system_cpu_test.go deleted file mode 100644 index 11d447b39..000000000 --- a/vendor/github.com/prometheus/procfs/sysfs/system_cpu_test.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2018 The Prometheus 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. - -// +build !windows - -package sysfs - -import ( - "reflect" - "testing" -) - -func TestNewSystemCpufreq(t *testing.T) { - fs, err := NewFS("fixtures") - if err != nil { - t.Fatal(err) - } - - c, err := fs.NewSystemCpufreq() - if err != nil { - t.Fatal(err) - } - - systemCpufreq := []SystemCPUCpufreqStats{ - // Ubuntu 16.04 (4.15.0-20-generic), has `scaling_cur_freq` file. - { - Name: "0", - CurrentFrequency: 1219917, - MinimumFrequency: 800000, - MaximumFrequency: 2400000, - TransitionLatency: 0, - AvailableGovernors: "performance powersave", - Driver: "intel_pstate", - Govenor: "powersave", - RelatedCpus: "0", - SetSpeed: "", - }, - // RHEL 7.3 (3.10.0-514.26.2.el7), missing `scaling_cur_freq` file. - { - Name: "1", - CurrentFrequency: 1200195, - MinimumFrequency: 1200000, - MaximumFrequency: 3300000, - TransitionLatency: 4294967295, - AvailableGovernors: "performance powersave", - Driver: "intel_pstate", - Govenor: "powersave", - RelatedCpus: "1", - SetSpeed: "", - }, - } - - if !reflect.DeepEqual(systemCpufreq, c) { - t.Errorf("Result not correct: want %v, have %v", systemCpufreq, c) - } -} diff --git a/vendor/github.com/prometheus/procfs/ttar b/vendor/github.com/prometheus/procfs/ttar deleted file mode 100755 index b0171a12b..000000000 --- a/vendor/github.com/prometheus/procfs/ttar +++ /dev/null @@ -1,389 +0,0 @@ -#!/usr/bin/env bash - -# Purpose: plain text tar format -# Limitations: - only suitable for text files, directories, and symlinks -# - stores only filename, content, and mode -# - not designed for untrusted input -# -# Note: must work with bash version 3.2 (macOS) - -# Copyright 2017 Roger Luethi -# -# 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. - -set -o errexit -o nounset - -# Sanitize environment (for instance, standard sorting of glob matches) -export LC_ALL=C - -path="" -CMD="" -ARG_STRING="$*" - -#------------------------------------------------------------------------------ -# Not all sed implementations can work on null bytes. In order to make ttar -# work out of the box on macOS, use Python as a stream editor. - -USE_PYTHON=0 - -PYTHON_CREATE_FILTER=$(cat << 'PCF' -#!/usr/bin/env python - -import re -import sys - -for line in sys.stdin: - line = re.sub(r'EOF', r'\EOF', line) - line = re.sub(r'NULLBYTE', r'\NULLBYTE', line) - line = re.sub('\x00', r'NULLBYTE', line) - sys.stdout.write(line) -PCF -) - -PYTHON_EXTRACT_FILTER=$(cat << 'PEF' -#!/usr/bin/env python - -import re -import sys - -for line in sys.stdin: - line = re.sub(r'(?/dev/null; then - echo "ERROR Python not found. Aborting." - exit 2 - fi - USE_PYTHON=1 - fi -} - -#------------------------------------------------------------------------------ - -function usage { - bname=$(basename "$0") - cat << USAGE -Usage: $bname [-C ] -c -f (create archive) - $bname -t -f (list archive contents) - $bname [-C ] -x -f (extract archive) - -Options: - -C (change directory) - -v (verbose) - -Example: Change to sysfs directory, create ttar file from fixtures directory - $bname -C sysfs -c -f sysfs/fixtures.ttar fixtures/ -USAGE -exit "$1" -} - -function vecho { - if [ "${VERBOSE:-}" == "yes" ]; then - echo >&7 "$@" - fi -} - -function set_cmd { - if [ -n "$CMD" ]; then - echo "ERROR: more than one command given" - echo - usage 2 - fi - CMD=$1 -} - -unset VERBOSE - -while getopts :cf:htxvC: opt; do - case $opt in - c) - set_cmd "create" - ;; - f) - ARCHIVE=$OPTARG - ;; - h) - usage 0 - ;; - t) - set_cmd "list" - ;; - x) - set_cmd "extract" - ;; - v) - VERBOSE=yes - exec 7>&1 - ;; - C) - CDIR=$OPTARG - ;; - *) - echo >&2 "ERROR: invalid option -$OPTARG" - echo - usage 1 - ;; - esac -done - -# Remove processed options from arguments -shift $(( OPTIND - 1 )); - -if [ "${CMD:-}" == "" ]; then - echo >&2 "ERROR: no command given" - echo - usage 1 -elif [ "${ARCHIVE:-}" == "" ]; then - echo >&2 "ERROR: no archive name given" - echo - usage 1 -fi - -function list { - local path="" - local size=0 - local line_no=0 - local ttar_file=$1 - if [ -n "${2:-}" ]; then - echo >&2 "ERROR: too many arguments." - echo - usage 1 - fi - if [ ! -e "$ttar_file" ]; then - echo >&2 "ERROR: file not found ($ttar_file)" - echo - usage 1 - fi - while read -r line; do - line_no=$(( line_no + 1 )) - if [ $size -gt 0 ]; then - size=$(( size - 1 )) - continue - fi - if [[ $line =~ ^Path:\ (.*)$ ]]; then - path=${BASH_REMATCH[1]} - elif [[ $line =~ ^Lines:\ (.*)$ ]]; then - size=${BASH_REMATCH[1]} - echo "$path" - elif [[ $line =~ ^Directory:\ (.*)$ ]]; then - path=${BASH_REMATCH[1]} - echo "$path/" - elif [[ $line =~ ^SymlinkTo:\ (.*)$ ]]; then - echo "$path -> ${BASH_REMATCH[1]}" - fi - done < "$ttar_file" -} - -function extract { - local path="" - local size=0 - local line_no=0 - local ttar_file=$1 - if [ -n "${2:-}" ]; then - echo >&2 "ERROR: too many arguments." - echo - usage 1 - fi - if [ ! -e "$ttar_file" ]; then - echo >&2 "ERROR: file not found ($ttar_file)" - echo - usage 1 - fi - while IFS= read -r line; do - line_no=$(( line_no + 1 )) - local eof_without_newline - if [ "$size" -gt 0 ]; then - if [[ "$line" =~ [^\\]EOF ]]; then - # An EOF not preceeded by a backslash indicates that the line - # does not end with a newline - eof_without_newline=1 - else - eof_without_newline=0 - fi - # Replace NULLBYTE with null byte if at beginning of line - # Replace NULLBYTE with null byte unless preceeded by backslash - # Remove one backslash in front of NULLBYTE (if any) - # Remove EOF unless preceeded by backslash - # Remove one backslash in front of EOF - if [ $USE_PYTHON -eq 1 ]; then - echo -n "$line" | python -c "$PYTHON_EXTRACT_FILTER" >> "$path" - else - # The repeated pattern makes up for sed's lack of negative - # lookbehind assertions (for consecutive null bytes). - echo -n "$line" | \ - sed -e 's/^NULLBYTE/\x0/g; - s/\([^\\]\)NULLBYTE/\1\x0/g; - s/\([^\\]\)NULLBYTE/\1\x0/g; - s/\\NULLBYTE/NULLBYTE/g; - s/\([^\\]\)EOF/\1/g; - s/\\EOF/EOF/g; - ' >> "$path" - fi - if [[ "$eof_without_newline" -eq 0 ]]; then - echo >> "$path" - fi - size=$(( size - 1 )) - continue - fi - if [[ $line =~ ^Path:\ (.*)$ ]]; then - path=${BASH_REMATCH[1]} - if [ -e "$path" ] || [ -L "$path" ]; then - rm "$path" - fi - elif [[ $line =~ ^Lines:\ (.*)$ ]]; then - size=${BASH_REMATCH[1]} - # Create file even if it is zero-length. - touch "$path" - vecho " $path" - elif [[ $line =~ ^Mode:\ (.*)$ ]]; then - mode=${BASH_REMATCH[1]} - chmod "$mode" "$path" - vecho "$mode" - elif [[ $line =~ ^Directory:\ (.*)$ ]]; then - path=${BASH_REMATCH[1]} - mkdir -p "$path" - vecho " $path/" - elif [[ $line =~ ^SymlinkTo:\ (.*)$ ]]; then - ln -s "${BASH_REMATCH[1]}" "$path" - vecho " $path -> ${BASH_REMATCH[1]}" - elif [[ $line =~ ^# ]]; then - # Ignore comments between files - continue - else - echo >&2 "ERROR: Unknown keyword on line $line_no: $line" - exit 1 - fi - done < "$ttar_file" -} - -function div { - echo "# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" \ - "- - - - - -" -} - -function get_mode { - local mfile=$1 - if [ -z "${STAT_OPTION:-}" ]; then - if stat -c '%a' "$mfile" >/dev/null 2>&1; then - # GNU stat - STAT_OPTION='-c' - STAT_FORMAT='%a' - else - # BSD stat - STAT_OPTION='-f' - # Octal output, user/group/other (omit file type, sticky bit) - STAT_FORMAT='%OLp' - fi - fi - stat "${STAT_OPTION}" "${STAT_FORMAT}" "$mfile" -} - -function _create { - shopt -s nullglob - local mode - local eof_without_newline - while (( "$#" )); do - file=$1 - if [ -L "$file" ]; then - echo "Path: $file" - symlinkTo=$(readlink "$file") - echo "SymlinkTo: $symlinkTo" - vecho " $file -> $symlinkTo" - div - elif [ -d "$file" ]; then - # Strip trailing slash (if there is one) - file=${file%/} - echo "Directory: $file" - mode=$(get_mode "$file") - echo "Mode: $mode" - vecho "$mode $file/" - div - # Find all files and dirs, including hidden/dot files - for x in "$file/"{*,.[^.]*}; do - _create "$x" - done - elif [ -f "$file" ]; then - echo "Path: $file" - lines=$(wc -l "$file"|awk '{print $1}') - eof_without_newline=0 - if [[ "$(wc -c "$file"|awk '{print $1}')" -gt 0 ]] && \ - [[ "$(tail -c 1 "$file" | wc -l)" -eq 0 ]]; then - eof_without_newline=1 - lines=$((lines+1)) - fi - echo "Lines: $lines" - # Add backslash in front of EOF - # Add backslash in front of NULLBYTE - # Replace null byte with NULLBYTE - if [ $USE_PYTHON -eq 1 ]; then - < "$file" python -c "$PYTHON_CREATE_FILTER" - else - < "$file" \ - sed 's/EOF/\\EOF/g; - s/NULLBYTE/\\NULLBYTE/g; - s/\x0/NULLBYTE/g; - ' - fi - if [[ "$eof_without_newline" -eq 1 ]]; then - # Finish line with EOF to indicate that the original line did - # not end with a linefeed - echo "EOF" - fi - mode=$(get_mode "$file") - echo "Mode: $mode" - vecho "$mode $file" - div - else - echo >&2 "ERROR: file not found ($file in $(pwd))" - exit 2 - fi - shift - done -} - -function create { - ttar_file=$1 - shift - if [ -z "${1:-}" ]; then - echo >&2 "ERROR: missing arguments." - echo - usage 1 - fi - if [ -e "$ttar_file" ]; then - rm "$ttar_file" - fi - exec > "$ttar_file" - echo "# Archive created by ttar $ARG_STRING" - _create "$@" -} - -test_environment - -if [ -n "${CDIR:-}" ]; then - if [[ "$ARCHIVE" != /* ]]; then - # Relative path: preserve the archive's location before changing - # directory - ARCHIVE="$(pwd)/$ARCHIVE" - fi - cd "$CDIR" -fi - -"$CMD" "$ARCHIVE" "$@" diff --git a/vendor/github.com/prometheus/procfs/xfrm.go b/vendor/github.com/prometheus/procfs/xfrm.go deleted file mode 100644 index 8f1508f0f..000000000 --- a/vendor/github.com/prometheus/procfs/xfrm.go +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2017 Prometheus Team -// 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 procfs - -import ( - "bufio" - "fmt" - "os" - "strconv" - "strings" -) - -// XfrmStat models the contents of /proc/net/xfrm_stat. -type XfrmStat struct { - // All errors which are not matched by other - XfrmInError int - // No buffer is left - XfrmInBufferError int - // Header Error - XfrmInHdrError int - // No state found - // i.e. either inbound SPI, address, or IPSEC protocol at SA is wrong - XfrmInNoStates int - // Transformation protocol specific error - // e.g. SA Key is wrong - XfrmInStateProtoError int - // Transformation mode specific error - XfrmInStateModeError int - // Sequence error - // e.g. sequence number is out of window - XfrmInStateSeqError int - // State is expired - XfrmInStateExpired int - // State has mismatch option - // e.g. UDP encapsulation type is mismatched - XfrmInStateMismatch int - // State is invalid - XfrmInStateInvalid int - // No matching template for states - // e.g. Inbound SAs are correct but SP rule is wrong - XfrmInTmplMismatch int - // No policy is found for states - // e.g. Inbound SAs are correct but no SP is found - XfrmInNoPols int - // Policy discards - XfrmInPolBlock int - // Policy error - XfrmInPolError int - // All errors which are not matched by others - XfrmOutError int - // Bundle generation error - XfrmOutBundleGenError int - // Bundle check error - XfrmOutBundleCheckError int - // No state was found - XfrmOutNoStates int - // Transformation protocol specific error - XfrmOutStateProtoError int - // Transportation mode specific error - XfrmOutStateModeError int - // Sequence error - // i.e sequence number overflow - XfrmOutStateSeqError int - // State is expired - XfrmOutStateExpired int - // Policy discads - XfrmOutPolBlock int - // Policy is dead - XfrmOutPolDead int - // Policy Error - XfrmOutPolError int - XfrmFwdHdrError int - XfrmOutStateInvalid int - XfrmAcquireError int -} - -// NewXfrmStat reads the xfrm_stat statistics. -func NewXfrmStat() (XfrmStat, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return XfrmStat{}, err - } - - return fs.NewXfrmStat() -} - -// NewXfrmStat reads the xfrm_stat statistics from the 'proc' filesystem. -func (fs FS) NewXfrmStat() (XfrmStat, error) { - file, err := os.Open(fs.Path("net/xfrm_stat")) - if err != nil { - return XfrmStat{}, err - } - defer file.Close() - - var ( - x = XfrmStat{} - s = bufio.NewScanner(file) - ) - - for s.Scan() { - fields := strings.Fields(s.Text()) - - if len(fields) != 2 { - return XfrmStat{}, fmt.Errorf( - "couldn't parse %s line %s", file.Name(), s.Text()) - } - - name := fields[0] - value, err := strconv.Atoi(fields[1]) - if err != nil { - return XfrmStat{}, err - } - - switch name { - case "XfrmInError": - x.XfrmInError = value - case "XfrmInBufferError": - x.XfrmInBufferError = value - case "XfrmInHdrError": - x.XfrmInHdrError = value - case "XfrmInNoStates": - x.XfrmInNoStates = value - case "XfrmInStateProtoError": - x.XfrmInStateProtoError = value - case "XfrmInStateModeError": - x.XfrmInStateModeError = value - case "XfrmInStateSeqError": - x.XfrmInStateSeqError = value - case "XfrmInStateExpired": - x.XfrmInStateExpired = value - case "XfrmInStateInvalid": - x.XfrmInStateInvalid = value - case "XfrmInTmplMismatch": - x.XfrmInTmplMismatch = value - case "XfrmInNoPols": - x.XfrmInNoPols = value - case "XfrmInPolBlock": - x.XfrmInPolBlock = value - case "XfrmInPolError": - x.XfrmInPolError = value - case "XfrmOutError": - x.XfrmOutError = value - case "XfrmInStateMismatch": - x.XfrmInStateMismatch = value - case "XfrmOutBundleGenError": - x.XfrmOutBundleGenError = value - case "XfrmOutBundleCheckError": - x.XfrmOutBundleCheckError = value - case "XfrmOutNoStates": - x.XfrmOutNoStates = value - case "XfrmOutStateProtoError": - x.XfrmOutStateProtoError = value - case "XfrmOutStateModeError": - x.XfrmOutStateModeError = value - case "XfrmOutStateSeqError": - x.XfrmOutStateSeqError = value - case "XfrmOutStateExpired": - x.XfrmOutStateExpired = value - case "XfrmOutPolBlock": - x.XfrmOutPolBlock = value - case "XfrmOutPolDead": - x.XfrmOutPolDead = value - case "XfrmOutPolError": - x.XfrmOutPolError = value - case "XfrmFwdHdrError": - x.XfrmFwdHdrError = value - case "XfrmOutStateInvalid": - x.XfrmOutStateInvalid = value - case "XfrmAcquireError": - x.XfrmAcquireError = value - } - - } - - return x, s.Err() -} diff --git a/vendor/github.com/prometheus/procfs/xfrm_test.go b/vendor/github.com/prometheus/procfs/xfrm_test.go deleted file mode 100644 index 5918c390e..000000000 --- a/vendor/github.com/prometheus/procfs/xfrm_test.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2017 Prometheus Team -// 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 procfs - -import ( - "testing" -) - -func TestXfrmStats(t *testing.T) { - xfrmStats, err := FS("fixtures").NewXfrmStat() - if err != nil { - t.Fatal(err) - } - - for _, test := range []struct { - name string - want int - got int - }{ - {name: "XfrmInError", want: 1, got: xfrmStats.XfrmInError}, - {name: "XfrmInBufferError", want: 2, got: xfrmStats.XfrmInBufferError}, - {name: "XfrmInHdrError", want: 4, got: xfrmStats.XfrmInHdrError}, - {name: "XfrmInNoStates", want: 3, got: xfrmStats.XfrmInNoStates}, - {name: "XfrmInStateProtoError", want: 40, got: xfrmStats.XfrmInStateProtoError}, - {name: "XfrmInStateModeError", want: 100, got: xfrmStats.XfrmInStateModeError}, - {name: "XfrmInStateSeqError", want: 6000, got: xfrmStats.XfrmInStateSeqError}, - {name: "XfrmInStateExpired", want: 4, got: xfrmStats.XfrmInStateExpired}, - {name: "XfrmInStateMismatch", want: 23451, got: xfrmStats.XfrmInStateMismatch}, - {name: "XfrmInStateInvalid", want: 55555, got: xfrmStats.XfrmInStateInvalid}, - {name: "XfrmInTmplMismatch", want: 51, got: xfrmStats.XfrmInTmplMismatch}, - {name: "XfrmInNoPols", want: 65432, got: xfrmStats.XfrmInNoPols}, - {name: "XfrmInPolBlock", want: 100, got: xfrmStats.XfrmInPolBlock}, - {name: "XfrmInPolError", want: 10000, got: xfrmStats.XfrmInPolError}, - {name: "XfrmOutError", want: 1000000, got: xfrmStats.XfrmOutError}, - {name: "XfrmOutBundleGenError", want: 43321, got: xfrmStats.XfrmOutBundleGenError}, - {name: "XfrmOutBundleCheckError", want: 555, got: xfrmStats.XfrmOutBundleCheckError}, - {name: "XfrmOutNoStates", want: 869, got: xfrmStats.XfrmOutNoStates}, - {name: "XfrmOutStateProtoError", want: 4542, got: xfrmStats.XfrmOutStateProtoError}, - {name: "XfrmOutStateModeError", want: 4, got: xfrmStats.XfrmOutStateModeError}, - {name: "XfrmOutStateSeqError", want: 543, got: xfrmStats.XfrmOutStateSeqError}, - {name: "XfrmOutStateExpired", want: 565, got: xfrmStats.XfrmOutStateExpired}, - {name: "XfrmOutPolBlock", want: 43456, got: xfrmStats.XfrmOutPolBlock}, - {name: "XfrmOutPolDead", want: 7656, got: xfrmStats.XfrmOutPolDead}, - {name: "XfrmOutPolError", want: 1454, got: xfrmStats.XfrmOutPolError}, - {name: "XfrmFwdHdrError", want: 6654, got: xfrmStats.XfrmFwdHdrError}, - {name: "XfrmOutStateInvaliad", want: 28765, got: xfrmStats.XfrmOutStateInvalid}, - {name: "XfrmAcquireError", want: 24532, got: xfrmStats.XfrmAcquireError}, - {name: "XfrmInStateInvalid", want: 55555, got: xfrmStats.XfrmInStateInvalid}, - {name: "XfrmOutError", want: 1000000, got: xfrmStats.XfrmOutError}, - } { - if test.want != test.got { - t.Errorf("Want %s %d, have %d", test.name, test.want, test.got) - } - } -} diff --git a/vendor/github.com/prometheus/procfs/xfs/parse.go b/vendor/github.com/prometheus/procfs/xfs/parse.go deleted file mode 100644 index 2bc0ef342..000000000 --- a/vendor/github.com/prometheus/procfs/xfs/parse.go +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright 2017 The Prometheus 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 xfs - -import ( - "bufio" - "fmt" - "io" - "strings" - - "github.com/prometheus/procfs/internal/util" -) - -// ParseStats parses a Stats from an input io.Reader, using the format -// found in /proc/fs/xfs/stat. -func ParseStats(r io.Reader) (*Stats, error) { - const ( - // Fields parsed into stats structures. - fieldExtentAlloc = "extent_alloc" - fieldAbt = "abt" - fieldBlkMap = "blk_map" - fieldBmbt = "bmbt" - fieldDir = "dir" - fieldTrans = "trans" - fieldIg = "ig" - fieldLog = "log" - fieldRw = "rw" - fieldAttr = "attr" - fieldIcluster = "icluster" - fieldVnodes = "vnodes" - fieldBuf = "buf" - fieldXpc = "xpc" - - // Unimplemented at this time due to lack of documentation. - fieldPushAil = "push_ail" - fieldXstrat = "xstrat" - fieldAbtb2 = "abtb2" - fieldAbtc2 = "abtc2" - fieldBmbt2 = "bmbt2" - fieldIbt2 = "ibt2" - fieldFibt2 = "fibt2" - fieldQm = "qm" - fieldDebug = "debug" - ) - - var xfss Stats - - s := bufio.NewScanner(r) - for s.Scan() { - // Expect at least a string label and a single integer value, ex: - // - abt 0 - // - rw 1 2 - ss := strings.Fields(string(s.Bytes())) - if len(ss) < 2 { - continue - } - label := ss[0] - - // Extended precision counters are uint64 values. - if label == fieldXpc { - us, err := util.ParseUint64s(ss[1:]) - if err != nil { - return nil, err - } - - xfss.ExtendedPrecision, err = extendedPrecisionStats(us) - if err != nil { - return nil, err - } - - continue - } - - // All other counters are uint32 values. - us, err := util.ParseUint32s(ss[1:]) - if err != nil { - return nil, err - } - - switch label { - case fieldExtentAlloc: - xfss.ExtentAllocation, err = extentAllocationStats(us) - case fieldAbt: - xfss.AllocationBTree, err = btreeStats(us) - case fieldBlkMap: - xfss.BlockMapping, err = blockMappingStats(us) - case fieldBmbt: - xfss.BlockMapBTree, err = btreeStats(us) - case fieldDir: - xfss.DirectoryOperation, err = directoryOperationStats(us) - case fieldTrans: - xfss.Transaction, err = transactionStats(us) - case fieldIg: - xfss.InodeOperation, err = inodeOperationStats(us) - case fieldLog: - xfss.LogOperation, err = logOperationStats(us) - case fieldRw: - xfss.ReadWrite, err = readWriteStats(us) - case fieldAttr: - xfss.AttributeOperation, err = attributeOperationStats(us) - case fieldIcluster: - xfss.InodeClustering, err = inodeClusteringStats(us) - case fieldVnodes: - xfss.Vnode, err = vnodeStats(us) - case fieldBuf: - xfss.Buffer, err = bufferStats(us) - } - if err != nil { - return nil, err - } - } - - return &xfss, s.Err() -} - -// extentAllocationStats builds an ExtentAllocationStats from a slice of uint32s. -func extentAllocationStats(us []uint32) (ExtentAllocationStats, error) { - if l := len(us); l != 4 { - return ExtentAllocationStats{}, fmt.Errorf("incorrect number of values for XFS extent allocation stats: %d", l) - } - - return ExtentAllocationStats{ - ExtentsAllocated: us[0], - BlocksAllocated: us[1], - ExtentsFreed: us[2], - BlocksFreed: us[3], - }, nil -} - -// btreeStats builds a BTreeStats from a slice of uint32s. -func btreeStats(us []uint32) (BTreeStats, error) { - if l := len(us); l != 4 { - return BTreeStats{}, fmt.Errorf("incorrect number of values for XFS btree stats: %d", l) - } - - return BTreeStats{ - Lookups: us[0], - Compares: us[1], - RecordsInserted: us[2], - RecordsDeleted: us[3], - }, nil -} - -// BlockMappingStat builds a BlockMappingStats from a slice of uint32s. -func blockMappingStats(us []uint32) (BlockMappingStats, error) { - if l := len(us); l != 7 { - return BlockMappingStats{}, fmt.Errorf("incorrect number of values for XFS block mapping stats: %d", l) - } - - return BlockMappingStats{ - Reads: us[0], - Writes: us[1], - Unmaps: us[2], - ExtentListInsertions: us[3], - ExtentListDeletions: us[4], - ExtentListLookups: us[5], - ExtentListCompares: us[6], - }, nil -} - -// DirectoryOperationStats builds a DirectoryOperationStats from a slice of uint32s. -func directoryOperationStats(us []uint32) (DirectoryOperationStats, error) { - if l := len(us); l != 4 { - return DirectoryOperationStats{}, fmt.Errorf("incorrect number of values for XFS directory operation stats: %d", l) - } - - return DirectoryOperationStats{ - Lookups: us[0], - Creates: us[1], - Removes: us[2], - Getdents: us[3], - }, nil -} - -// TransactionStats builds a TransactionStats from a slice of uint32s. -func transactionStats(us []uint32) (TransactionStats, error) { - if l := len(us); l != 3 { - return TransactionStats{}, fmt.Errorf("incorrect number of values for XFS transaction stats: %d", l) - } - - return TransactionStats{ - Sync: us[0], - Async: us[1], - Empty: us[2], - }, nil -} - -// InodeOperationStats builds an InodeOperationStats from a slice of uint32s. -func inodeOperationStats(us []uint32) (InodeOperationStats, error) { - if l := len(us); l != 7 { - return InodeOperationStats{}, fmt.Errorf("incorrect number of values for XFS inode operation stats: %d", l) - } - - return InodeOperationStats{ - Attempts: us[0], - Found: us[1], - Recycle: us[2], - Missed: us[3], - Duplicate: us[4], - Reclaims: us[5], - AttributeChange: us[6], - }, nil -} - -// LogOperationStats builds a LogOperationStats from a slice of uint32s. -func logOperationStats(us []uint32) (LogOperationStats, error) { - if l := len(us); l != 5 { - return LogOperationStats{}, fmt.Errorf("incorrect number of values for XFS log operation stats: %d", l) - } - - return LogOperationStats{ - Writes: us[0], - Blocks: us[1], - NoInternalBuffers: us[2], - Force: us[3], - ForceSleep: us[4], - }, nil -} - -// ReadWriteStats builds a ReadWriteStats from a slice of uint32s. -func readWriteStats(us []uint32) (ReadWriteStats, error) { - if l := len(us); l != 2 { - return ReadWriteStats{}, fmt.Errorf("incorrect number of values for XFS read write stats: %d", l) - } - - return ReadWriteStats{ - Read: us[0], - Write: us[1], - }, nil -} - -// AttributeOperationStats builds an AttributeOperationStats from a slice of uint32s. -func attributeOperationStats(us []uint32) (AttributeOperationStats, error) { - if l := len(us); l != 4 { - return AttributeOperationStats{}, fmt.Errorf("incorrect number of values for XFS attribute operation stats: %d", l) - } - - return AttributeOperationStats{ - Get: us[0], - Set: us[1], - Remove: us[2], - List: us[3], - }, nil -} - -// InodeClusteringStats builds an InodeClusteringStats from a slice of uint32s. -func inodeClusteringStats(us []uint32) (InodeClusteringStats, error) { - if l := len(us); l != 3 { - return InodeClusteringStats{}, fmt.Errorf("incorrect number of values for XFS inode clustering stats: %d", l) - } - - return InodeClusteringStats{ - Iflush: us[0], - Flush: us[1], - FlushInode: us[2], - }, nil -} - -// VnodeStats builds a VnodeStats from a slice of uint32s. -func vnodeStats(us []uint32) (VnodeStats, error) { - // The attribute "Free" appears to not be available on older XFS - // stats versions. Therefore, 7 or 8 elements may appear in - // this slice. - l := len(us) - if l != 7 && l != 8 { - return VnodeStats{}, fmt.Errorf("incorrect number of values for XFS vnode stats: %d", l) - } - - s := VnodeStats{ - Active: us[0], - Allocate: us[1], - Get: us[2], - Hold: us[3], - Release: us[4], - Reclaim: us[5], - Remove: us[6], - } - - // Skip adding free, unless it is present. The zero value will - // be used in place of an actual count. - if l == 7 { - return s, nil - } - - s.Free = us[7] - return s, nil -} - -// BufferStats builds a BufferStats from a slice of uint32s. -func bufferStats(us []uint32) (BufferStats, error) { - if l := len(us); l != 9 { - return BufferStats{}, fmt.Errorf("incorrect number of values for XFS buffer stats: %d", l) - } - - return BufferStats{ - Get: us[0], - Create: us[1], - GetLocked: us[2], - GetLockedWaited: us[3], - BusyLocked: us[4], - MissLocked: us[5], - PageRetries: us[6], - PageFound: us[7], - GetRead: us[8], - }, nil -} - -// ExtendedPrecisionStats builds an ExtendedPrecisionStats from a slice of uint32s. -func extendedPrecisionStats(us []uint64) (ExtendedPrecisionStats, error) { - if l := len(us); l != 3 { - return ExtendedPrecisionStats{}, fmt.Errorf("incorrect number of values for XFS extended precision stats: %d", l) - } - - return ExtendedPrecisionStats{ - FlushBytes: us[0], - WriteBytes: us[1], - ReadBytes: us[2], - }, nil -} diff --git a/vendor/github.com/prometheus/procfs/xfs/parse_test.go b/vendor/github.com/prometheus/procfs/xfs/parse_test.go deleted file mode 100644 index 2e946c2c5..000000000 --- a/vendor/github.com/prometheus/procfs/xfs/parse_test.go +++ /dev/null @@ -1,442 +0,0 @@ -// Copyright 2017 The Prometheus 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 xfs_test - -import ( - "reflect" - "strings" - "testing" - - "github.com/prometheus/procfs" - "github.com/prometheus/procfs/xfs" -) - -func TestParseStats(t *testing.T) { - tests := []struct { - name string - s string - fs bool - stats *xfs.Stats - invalid bool - }{ - { - name: "empty file OK", - }, - { - name: "short or empty lines and unknown labels ignored", - s: "one\n\ntwo 1 2 3\n", - stats: &xfs.Stats{}, - }, - { - name: "bad uint32", - s: "extent_alloc XXX", - invalid: true, - }, - { - name: "bad uint64", - s: "xpc XXX", - invalid: true, - }, - { - name: "extent_alloc bad", - s: "extent_alloc 1", - invalid: true, - }, - { - name: "extent_alloc OK", - s: "extent_alloc 1 2 3 4", - stats: &xfs.Stats{ - ExtentAllocation: xfs.ExtentAllocationStats{ - ExtentsAllocated: 1, - BlocksAllocated: 2, - ExtentsFreed: 3, - BlocksFreed: 4, - }, - }, - }, - { - name: "abt bad", - s: "abt 1", - invalid: true, - }, - { - name: "abt OK", - s: "abt 1 2 3 4", - stats: &xfs.Stats{ - AllocationBTree: xfs.BTreeStats{ - Lookups: 1, - Compares: 2, - RecordsInserted: 3, - RecordsDeleted: 4, - }, - }, - }, - { - name: "blk_map bad", - s: "blk_map 1", - invalid: true, - }, - { - name: "blk_map OK", - s: "blk_map 1 2 3 4 5 6 7", - stats: &xfs.Stats{ - BlockMapping: xfs.BlockMappingStats{ - Reads: 1, - Writes: 2, - Unmaps: 3, - ExtentListInsertions: 4, - ExtentListDeletions: 5, - ExtentListLookups: 6, - ExtentListCompares: 7, - }, - }, - }, - { - name: "bmbt bad", - s: "bmbt 1", - invalid: true, - }, - { - name: "bmbt OK", - s: "bmbt 1 2 3 4", - stats: &xfs.Stats{ - BlockMapBTree: xfs.BTreeStats{ - Lookups: 1, - Compares: 2, - RecordsInserted: 3, - RecordsDeleted: 4, - }, - }, - }, - { - name: "dir bad", - s: "dir 1", - invalid: true, - }, - { - name: "dir OK", - s: "dir 1 2 3 4", - stats: &xfs.Stats{ - DirectoryOperation: xfs.DirectoryOperationStats{ - Lookups: 1, - Creates: 2, - Removes: 3, - Getdents: 4, - }, - }, - }, - { - name: "trans bad", - s: "trans 1", - invalid: true, - }, - { - name: "trans OK", - s: "trans 1 2 3", - stats: &xfs.Stats{ - Transaction: xfs.TransactionStats{ - Sync: 1, - Async: 2, - Empty: 3, - }, - }, - }, - { - name: "ig bad", - s: "ig 1", - invalid: true, - }, - { - name: "ig OK", - s: "ig 1 2 3 4 5 6 7", - stats: &xfs.Stats{ - InodeOperation: xfs.InodeOperationStats{ - Attempts: 1, - Found: 2, - Recycle: 3, - Missed: 4, - Duplicate: 5, - Reclaims: 6, - AttributeChange: 7, - }, - }, - }, - { - name: "log bad", - s: "log 1", - invalid: true, - }, - { - name: "log OK", - s: "log 1 2 3 4 5", - stats: &xfs.Stats{ - LogOperation: xfs.LogOperationStats{ - Writes: 1, - Blocks: 2, - NoInternalBuffers: 3, - Force: 4, - ForceSleep: 5, - }, - }, - }, - { - name: "rw bad", - s: "rw 1", - invalid: true, - }, - { - name: "rw OK", - s: "rw 1 2", - stats: &xfs.Stats{ - ReadWrite: xfs.ReadWriteStats{ - Read: 1, - Write: 2, - }, - }, - }, - { - name: "attr bad", - s: "attr 1", - invalid: true, - }, - { - name: "attr OK", - s: "attr 1 2 3 4", - stats: &xfs.Stats{ - AttributeOperation: xfs.AttributeOperationStats{ - Get: 1, - Set: 2, - Remove: 3, - List: 4, - }, - }, - }, - { - name: "icluster bad", - s: "icluster 1", - invalid: true, - }, - { - name: "icluster OK", - s: "icluster 1 2 3", - stats: &xfs.Stats{ - InodeClustering: xfs.InodeClusteringStats{ - Iflush: 1, - Flush: 2, - FlushInode: 3, - }, - }, - }, - { - name: "vnodes bad", - s: "vnodes 1", - invalid: true, - }, - { - name: "vnodes (missing free) OK", - s: "vnodes 1 2 3 4 5 6 7", - stats: &xfs.Stats{ - Vnode: xfs.VnodeStats{ - Active: 1, - Allocate: 2, - Get: 3, - Hold: 4, - Release: 5, - Reclaim: 6, - Remove: 7, - }, - }, - }, - { - name: "vnodes (with free) OK", - s: "vnodes 1 2 3 4 5 6 7 8", - stats: &xfs.Stats{ - Vnode: xfs.VnodeStats{ - Active: 1, - Allocate: 2, - Get: 3, - Hold: 4, - Release: 5, - Reclaim: 6, - Remove: 7, - Free: 8, - }, - }, - }, - { - name: "buf bad", - s: "buf 1", - invalid: true, - }, - { - name: "buf OK", - s: "buf 1 2 3 4 5 6 7 8 9", - stats: &xfs.Stats{ - Buffer: xfs.BufferStats{ - Get: 1, - Create: 2, - GetLocked: 3, - GetLockedWaited: 4, - BusyLocked: 5, - MissLocked: 6, - PageRetries: 7, - PageFound: 8, - GetRead: 9, - }, - }, - }, - { - name: "xpc bad", - s: "xpc 1", - invalid: true, - }, - { - name: "xpc OK", - s: "xpc 1 2 3", - stats: &xfs.Stats{ - ExtendedPrecision: xfs.ExtendedPrecisionStats{ - FlushBytes: 1, - WriteBytes: 2, - ReadBytes: 3, - }, - }, - }, - { - name: "fixtures OK", - fs: true, - stats: &xfs.Stats{ - ExtentAllocation: xfs.ExtentAllocationStats{ - ExtentsAllocated: 92447, - BlocksAllocated: 97589, - ExtentsFreed: 92448, - BlocksFreed: 93751, - }, - AllocationBTree: xfs.BTreeStats{ - Lookups: 0, - Compares: 0, - RecordsInserted: 0, - RecordsDeleted: 0, - }, - BlockMapping: xfs.BlockMappingStats{ - Reads: 1767055, - Writes: 188820, - Unmaps: 184891, - ExtentListInsertions: 92447, - ExtentListDeletions: 92448, - ExtentListLookups: 2140766, - ExtentListCompares: 0, - }, - BlockMapBTree: xfs.BTreeStats{ - Lookups: 0, - Compares: 0, - RecordsInserted: 0, - RecordsDeleted: 0, - }, - DirectoryOperation: xfs.DirectoryOperationStats{ - Lookups: 185039, - Creates: 92447, - Removes: 92444, - Getdents: 136422, - }, - Transaction: xfs.TransactionStats{ - Sync: 706, - Async: 944304, - Empty: 0, - }, - InodeOperation: xfs.InodeOperationStats{ - Attempts: 185045, - Found: 58807, - Recycle: 0, - Missed: 126238, - Duplicate: 0, - Reclaims: 33637, - AttributeChange: 22, - }, - LogOperation: xfs.LogOperationStats{ - Writes: 2883, - Blocks: 113448, - NoInternalBuffers: 9, - Force: 17360, - ForceSleep: 739, - }, - ReadWrite: xfs.ReadWriteStats{ - Read: 107739, - Write: 94045, - }, - AttributeOperation: xfs.AttributeOperationStats{ - Get: 4, - Set: 0, - Remove: 0, - List: 0, - }, - InodeClustering: xfs.InodeClusteringStats{ - Iflush: 8677, - Flush: 7849, - FlushInode: 135802, - }, - Vnode: xfs.VnodeStats{ - Active: 92601, - Allocate: 0, - Get: 0, - Hold: 0, - Release: 92444, - Reclaim: 92444, - Remove: 92444, - Free: 0, - }, - Buffer: xfs.BufferStats{ - Get: 2666287, - Create: 7122, - GetLocked: 2659202, - GetLockedWaited: 3599, - BusyLocked: 2, - MissLocked: 7085, - PageRetries: 0, - PageFound: 10297, - GetRead: 7085, - }, - ExtendedPrecision: xfs.ExtendedPrecisionStats{ - FlushBytes: 399724544, - WriteBytes: 92823103, - ReadBytes: 86219234, - }, - }, - }, - } - - for _, tt := range tests { - var ( - stats *xfs.Stats - err error - ) - - if tt.s != "" { - stats, err = xfs.ParseStats(strings.NewReader(tt.s)) - } - if tt.fs { - stats, err = procfs.FS("../fixtures").XFSStats() - } - - if tt.invalid && err == nil { - t.Error("expected an error, but none occurred") - } - if !tt.invalid && err != nil { - t.Errorf("unexpected error: %v", err) - } - - if want, have := tt.stats, stats; !reflect.DeepEqual(want, have) { - t.Errorf("unexpected XFS stats:\nwant:\n%v\nhave:\n%v", want, have) - } - } -} diff --git a/vendor/github.com/prometheus/procfs/xfs/xfs.go b/vendor/github.com/prometheus/procfs/xfs/xfs.go deleted file mode 100644 index d86794b7c..000000000 --- a/vendor/github.com/prometheus/procfs/xfs/xfs.go +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright 2017 The Prometheus 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 xfs provides access to statistics exposed by the XFS filesystem. -package xfs - -// Stats contains XFS filesystem runtime statistics, parsed from -// /proc/fs/xfs/stat. -// -// The names and meanings of each statistic were taken from -// http://xfs.org/index.php/Runtime_Stats and xfs_stats.h in the Linux -// kernel source. Most counters are uint32s (same data types used in -// xfs_stats.h), but some of the "extended precision stats" are uint64s. -type Stats struct { - // The name of the filesystem used to source these statistics. - // If empty, this indicates aggregated statistics for all XFS - // filesystems on the host. - Name string - - ExtentAllocation ExtentAllocationStats - AllocationBTree BTreeStats - BlockMapping BlockMappingStats - BlockMapBTree BTreeStats - DirectoryOperation DirectoryOperationStats - Transaction TransactionStats - InodeOperation InodeOperationStats - LogOperation LogOperationStats - ReadWrite ReadWriteStats - AttributeOperation AttributeOperationStats - InodeClustering InodeClusteringStats - Vnode VnodeStats - Buffer BufferStats - ExtendedPrecision ExtendedPrecisionStats -} - -// ExtentAllocationStats contains statistics regarding XFS extent allocations. -type ExtentAllocationStats struct { - ExtentsAllocated uint32 - BlocksAllocated uint32 - ExtentsFreed uint32 - BlocksFreed uint32 -} - -// BTreeStats contains statistics regarding an XFS internal B-tree. -type BTreeStats struct { - Lookups uint32 - Compares uint32 - RecordsInserted uint32 - RecordsDeleted uint32 -} - -// BlockMappingStats contains statistics regarding XFS block maps. -type BlockMappingStats struct { - Reads uint32 - Writes uint32 - Unmaps uint32 - ExtentListInsertions uint32 - ExtentListDeletions uint32 - ExtentListLookups uint32 - ExtentListCompares uint32 -} - -// DirectoryOperationStats contains statistics regarding XFS directory entries. -type DirectoryOperationStats struct { - Lookups uint32 - Creates uint32 - Removes uint32 - Getdents uint32 -} - -// TransactionStats contains statistics regarding XFS metadata transactions. -type TransactionStats struct { - Sync uint32 - Async uint32 - Empty uint32 -} - -// InodeOperationStats contains statistics regarding XFS inode operations. -type InodeOperationStats struct { - Attempts uint32 - Found uint32 - Recycle uint32 - Missed uint32 - Duplicate uint32 - Reclaims uint32 - AttributeChange uint32 -} - -// LogOperationStats contains statistics regarding the XFS log buffer. -type LogOperationStats struct { - Writes uint32 - Blocks uint32 - NoInternalBuffers uint32 - Force uint32 - ForceSleep uint32 -} - -// ReadWriteStats contains statistics regarding the number of read and write -// system calls for XFS filesystems. -type ReadWriteStats struct { - Read uint32 - Write uint32 -} - -// AttributeOperationStats contains statistics regarding manipulation of -// XFS extended file attributes. -type AttributeOperationStats struct { - Get uint32 - Set uint32 - Remove uint32 - List uint32 -} - -// InodeClusteringStats contains statistics regarding XFS inode clustering -// operations. -type InodeClusteringStats struct { - Iflush uint32 - Flush uint32 - FlushInode uint32 -} - -// VnodeStats contains statistics regarding XFS vnode operations. -type VnodeStats struct { - Active uint32 - Allocate uint32 - Get uint32 - Hold uint32 - Release uint32 - Reclaim uint32 - Remove uint32 - Free uint32 -} - -// BufferStats contains statistics regarding XFS read/write I/O buffers. -type BufferStats struct { - Get uint32 - Create uint32 - GetLocked uint32 - GetLockedWaited uint32 - BusyLocked uint32 - MissLocked uint32 - PageRetries uint32 - PageFound uint32 - GetRead uint32 -} - -// ExtendedPrecisionStats contains high precision counters used to track the -// total number of bytes read, written, or flushed, during XFS operations. -type ExtendedPrecisionStats struct { - FlushBytes uint64 - WriteBytes uint64 - ReadBytes uint64 -} diff --git a/vendor/go.uber.org/atomic/.codecov.yml b/vendor/go.uber.org/atomic/.codecov.yml new file mode 100644 index 000000000..6d4d1be7b --- /dev/null +++ b/vendor/go.uber.org/atomic/.codecov.yml @@ -0,0 +1,15 @@ +coverage: + range: 80..100 + round: down + precision: 2 + + status: + project: # measuring the overall project coverage + default: # context, you can create multiple ones with custom titles + enabled: yes # must be yes|true to enable this status + target: 100 # specify the target coverage for each commit status + # option: "auto" (must increase from parent commit or pull request base) + # option: "X%" a static target percentage to hit + if_not_found: success # if parent is not found report status as success, error, or failure + if_ci_failed: error # if ci fails report status as success, error, or failure + diff --git a/vendor/go.uber.org/atomic/.github/PULL_REQUEST_TEMPLATE.md b/vendor/go.uber.org/atomic/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..8ef55f894 --- /dev/null +++ b/vendor/go.uber.org/atomic/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ +Before opening your pull request, please make sure that you've: + +- [ ] [signed Uber's Contributor License Agreement](https://docs.google.com/a/uber.com/forms/d/1pAwS_-dA1KhPlfxzYLBqK6rsSWwRwH95OCCZrcsY5rk/viewform); +- [ ] added tests to cover your changes; +- [ ] run the test suite locally (`make test`); and finally, +- [ ] run the linters locally (`make lint`). + +Thanks for your contribution! diff --git a/vendor/go.uber.org/atomic/.gitignore b/vendor/go.uber.org/atomic/.gitignore new file mode 100644 index 000000000..0a4504f11 --- /dev/null +++ b/vendor/go.uber.org/atomic/.gitignore @@ -0,0 +1,11 @@ +.DS_Store +/vendor +/cover +cover.out +lint.log + +# Binaries +*.test + +# Profiling output +*.prof diff --git a/vendor/go.uber.org/atomic/.travis.yml b/vendor/go.uber.org/atomic/.travis.yml new file mode 100644 index 000000000..58957222a --- /dev/null +++ b/vendor/go.uber.org/atomic/.travis.yml @@ -0,0 +1,23 @@ +sudo: false +language: go +go_import_path: go.uber.org/atomic + +go: + - 1.7 + - 1.8 + - 1.9 + +cache: + directories: + - vendor + +install: + - make install_ci + +script: + - make test_ci + - scripts/test-ubergo.sh + - make lint + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/go.uber.org/atomic/LICENSE.txt b/vendor/go.uber.org/atomic/LICENSE.txt new file mode 100644 index 000000000..8765c9fbc --- /dev/null +++ b/vendor/go.uber.org/atomic/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2016 Uber Technologies, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/go.uber.org/atomic/Makefile b/vendor/go.uber.org/atomic/Makefile new file mode 100644 index 000000000..dfc63d9db --- /dev/null +++ b/vendor/go.uber.org/atomic/Makefile @@ -0,0 +1,64 @@ +PACKAGES := $(shell glide nv) +# Many Go tools take file globs or directories as arguments instead of packages. +PACKAGE_FILES ?= *.go + + +# The linting tools evolve with each Go version, so run them only on the latest +# stable release. +GO_VERSION := $(shell go version | cut -d " " -f 3) +GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION))) +LINTABLE_MINOR_VERSIONS := 7 8 +ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),) +SHOULD_LINT := true +endif + + +export GO15VENDOREXPERIMENT=1 + + +.PHONY: build +build: + go build -i $(PACKAGES) + + +.PHONY: install +install: + glide --version || go get github.com/Masterminds/glide + glide install + + +.PHONY: test +test: + go test -cover -race $(PACKAGES) + + +.PHONY: install_ci +install_ci: install + go get github.com/wadey/gocovmerge + go get github.com/mattn/goveralls + go get golang.org/x/tools/cmd/cover +ifdef SHOULD_LINT + go get github.com/golang/lint/golint +endif + +.PHONY: lint +lint: +ifdef SHOULD_LINT + @rm -rf lint.log + @echo "Checking formatting..." + @gofmt -d -s $(PACKAGE_FILES) 2>&1 | tee lint.log + @echo "Checking vet..." + @$(foreach dir,$(PACKAGE_FILES),go tool vet $(dir) 2>&1 | tee -a lint.log;) + @echo "Checking lint..." + @$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;) + @echo "Checking for unresolved FIXMEs..." + @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log + @[ ! -s lint.log ] +else + @echo "Skipping linters on" $(GO_VERSION) +endif + + +.PHONY: test_ci +test_ci: install_ci build + ./scripts/cover.sh $(shell go list $(PACKAGES)) diff --git a/vendor/go.uber.org/atomic/README.md b/vendor/go.uber.org/atomic/README.md new file mode 100644 index 000000000..6505abf65 --- /dev/null +++ b/vendor/go.uber.org/atomic/README.md @@ -0,0 +1,36 @@ +# atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard] + +Simple wrappers for primitive types to enforce atomic access. + +## Installation +`go get -u go.uber.org/atomic` + +## Usage +The standard library's `sync/atomic` is powerful, but it's easy to forget which +variables must be accessed atomically. `go.uber.org/atomic` preserves all the +functionality of the standard library, but wraps the primitive types to +provide a safer, more convenient API. + +```go +var atom atomic.Uint32 +atom.Store(42) +atom.Sub(2) +atom.CAS(40, 11) +``` + +See the [documentation][doc] for a complete API specification. + +## Development Status +Stable. + +
+Released under the [MIT License](LICENSE.txt). + +[doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg +[doc]: https://godoc.org/go.uber.org/atomic +[ci-img]: https://travis-ci.org/uber-go/atomic.svg?branch=master +[ci]: https://travis-ci.org/uber-go/atomic +[cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg +[cov]: https://codecov.io/gh/uber-go/atomic +[reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic +[reportcard]: https://goreportcard.com/report/go.uber.org/atomic diff --git a/vendor/go.uber.org/atomic/atomic.go b/vendor/go.uber.org/atomic/atomic.go new file mode 100644 index 000000000..1db6849fc --- /dev/null +++ b/vendor/go.uber.org/atomic/atomic.go @@ -0,0 +1,351 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package atomic provides simple wrappers around numerics to enforce atomic +// access. +package atomic + +import ( + "math" + "sync/atomic" + "time" +) + +// Int32 is an atomic wrapper around an int32. +type Int32 struct{ v int32 } + +// NewInt32 creates an Int32. +func NewInt32(i int32) *Int32 { + return &Int32{i} +} + +// Load atomically loads the wrapped value. +func (i *Int32) Load() int32 { + return atomic.LoadInt32(&i.v) +} + +// Add atomically adds to the wrapped int32 and returns the new value. +func (i *Int32) Add(n int32) int32 { + return atomic.AddInt32(&i.v, n) +} + +// Sub atomically subtracts from the wrapped int32 and returns the new value. +func (i *Int32) Sub(n int32) int32 { + return atomic.AddInt32(&i.v, -n) +} + +// Inc atomically increments the wrapped int32 and returns the new value. +func (i *Int32) Inc() int32 { + return i.Add(1) +} + +// Dec atomically decrements the wrapped int32 and returns the new value. +func (i *Int32) Dec() int32 { + return i.Sub(1) +} + +// CAS is an atomic compare-and-swap. +func (i *Int32) CAS(old, new int32) bool { + return atomic.CompareAndSwapInt32(&i.v, old, new) +} + +// Store atomically stores the passed value. +func (i *Int32) Store(n int32) { + atomic.StoreInt32(&i.v, n) +} + +// Swap atomically swaps the wrapped int32 and returns the old value. +func (i *Int32) Swap(n int32) int32 { + return atomic.SwapInt32(&i.v, n) +} + +// Int64 is an atomic wrapper around an int64. +type Int64 struct{ v int64 } + +// NewInt64 creates an Int64. +func NewInt64(i int64) *Int64 { + return &Int64{i} +} + +// Load atomically loads the wrapped value. +func (i *Int64) Load() int64 { + return atomic.LoadInt64(&i.v) +} + +// Add atomically adds to the wrapped int64 and returns the new value. +func (i *Int64) Add(n int64) int64 { + return atomic.AddInt64(&i.v, n) +} + +// Sub atomically subtracts from the wrapped int64 and returns the new value. +func (i *Int64) Sub(n int64) int64 { + return atomic.AddInt64(&i.v, -n) +} + +// Inc atomically increments the wrapped int64 and returns the new value. +func (i *Int64) Inc() int64 { + return i.Add(1) +} + +// Dec atomically decrements the wrapped int64 and returns the new value. +func (i *Int64) Dec() int64 { + return i.Sub(1) +} + +// CAS is an atomic compare-and-swap. +func (i *Int64) CAS(old, new int64) bool { + return atomic.CompareAndSwapInt64(&i.v, old, new) +} + +// Store atomically stores the passed value. +func (i *Int64) Store(n int64) { + atomic.StoreInt64(&i.v, n) +} + +// Swap atomically swaps the wrapped int64 and returns the old value. +func (i *Int64) Swap(n int64) int64 { + return atomic.SwapInt64(&i.v, n) +} + +// Uint32 is an atomic wrapper around an uint32. +type Uint32 struct{ v uint32 } + +// NewUint32 creates a Uint32. +func NewUint32(i uint32) *Uint32 { + return &Uint32{i} +} + +// Load atomically loads the wrapped value. +func (i *Uint32) Load() uint32 { + return atomic.LoadUint32(&i.v) +} + +// Add atomically adds to the wrapped uint32 and returns the new value. +func (i *Uint32) Add(n uint32) uint32 { + return atomic.AddUint32(&i.v, n) +} + +// Sub atomically subtracts from the wrapped uint32 and returns the new value. +func (i *Uint32) Sub(n uint32) uint32 { + return atomic.AddUint32(&i.v, ^(n - 1)) +} + +// Inc atomically increments the wrapped uint32 and returns the new value. +func (i *Uint32) Inc() uint32 { + return i.Add(1) +} + +// Dec atomically decrements the wrapped int32 and returns the new value. +func (i *Uint32) Dec() uint32 { + return i.Sub(1) +} + +// CAS is an atomic compare-and-swap. +func (i *Uint32) CAS(old, new uint32) bool { + return atomic.CompareAndSwapUint32(&i.v, old, new) +} + +// Store atomically stores the passed value. +func (i *Uint32) Store(n uint32) { + atomic.StoreUint32(&i.v, n) +} + +// Swap atomically swaps the wrapped uint32 and returns the old value. +func (i *Uint32) Swap(n uint32) uint32 { + return atomic.SwapUint32(&i.v, n) +} + +// Uint64 is an atomic wrapper around a uint64. +type Uint64 struct{ v uint64 } + +// NewUint64 creates a Uint64. +func NewUint64(i uint64) *Uint64 { + return &Uint64{i} +} + +// Load atomically loads the wrapped value. +func (i *Uint64) Load() uint64 { + return atomic.LoadUint64(&i.v) +} + +// Add atomically adds to the wrapped uint64 and returns the new value. +func (i *Uint64) Add(n uint64) uint64 { + return atomic.AddUint64(&i.v, n) +} + +// Sub atomically subtracts from the wrapped uint64 and returns the new value. +func (i *Uint64) Sub(n uint64) uint64 { + return atomic.AddUint64(&i.v, ^(n - 1)) +} + +// Inc atomically increments the wrapped uint64 and returns the new value. +func (i *Uint64) Inc() uint64 { + return i.Add(1) +} + +// Dec atomically decrements the wrapped uint64 and returns the new value. +func (i *Uint64) Dec() uint64 { + return i.Sub(1) +} + +// CAS is an atomic compare-and-swap. +func (i *Uint64) CAS(old, new uint64) bool { + return atomic.CompareAndSwapUint64(&i.v, old, new) +} + +// Store atomically stores the passed value. +func (i *Uint64) Store(n uint64) { + atomic.StoreUint64(&i.v, n) +} + +// Swap atomically swaps the wrapped uint64 and returns the old value. +func (i *Uint64) Swap(n uint64) uint64 { + return atomic.SwapUint64(&i.v, n) +} + +// Bool is an atomic Boolean. +type Bool struct{ v uint32 } + +// NewBool creates a Bool. +func NewBool(initial bool) *Bool { + return &Bool{boolToInt(initial)} +} + +// Load atomically loads the Boolean. +func (b *Bool) Load() bool { + return truthy(atomic.LoadUint32(&b.v)) +} + +// CAS is an atomic compare-and-swap. +func (b *Bool) CAS(old, new bool) bool { + return atomic.CompareAndSwapUint32(&b.v, boolToInt(old), boolToInt(new)) +} + +// Store atomically stores the passed value. +func (b *Bool) Store(new bool) { + atomic.StoreUint32(&b.v, boolToInt(new)) +} + +// Swap sets the given value and returns the previous value. +func (b *Bool) Swap(new bool) bool { + return truthy(atomic.SwapUint32(&b.v, boolToInt(new))) +} + +// Toggle atomically negates the Boolean and returns the previous value. +func (b *Bool) Toggle() bool { + return truthy(atomic.AddUint32(&b.v, 1) - 1) +} + +func truthy(n uint32) bool { + return n&1 == 1 +} + +func boolToInt(b bool) uint32 { + if b { + return 1 + } + return 0 +} + +// Float64 is an atomic wrapper around float64. +type Float64 struct { + v uint64 +} + +// NewFloat64 creates a Float64. +func NewFloat64(f float64) *Float64 { + return &Float64{math.Float64bits(f)} +} + +// Load atomically loads the wrapped value. +func (f *Float64) Load() float64 { + return math.Float64frombits(atomic.LoadUint64(&f.v)) +} + +// Store atomically stores the passed value. +func (f *Float64) Store(s float64) { + atomic.StoreUint64(&f.v, math.Float64bits(s)) +} + +// Add atomically adds to the wrapped float64 and returns the new value. +func (f *Float64) Add(s float64) float64 { + for { + old := f.Load() + new := old + s + if f.CAS(old, new) { + return new + } + } +} + +// Sub atomically subtracts from the wrapped float64 and returns the new value. +func (f *Float64) Sub(s float64) float64 { + return f.Add(-s) +} + +// CAS is an atomic compare-and-swap. +func (f *Float64) CAS(old, new float64) bool { + return atomic.CompareAndSwapUint64(&f.v, math.Float64bits(old), math.Float64bits(new)) +} + +// Duration is an atomic wrapper around time.Duration +// https://godoc.org/time#Duration +type Duration struct { + v Int64 +} + +// NewDuration creates a Duration. +func NewDuration(d time.Duration) *Duration { + return &Duration{v: *NewInt64(int64(d))} +} + +// Load atomically loads the wrapped value. +func (d *Duration) Load() time.Duration { + return time.Duration(d.v.Load()) +} + +// Store atomically stores the passed value. +func (d *Duration) Store(n time.Duration) { + d.v.Store(int64(n)) +} + +// Add atomically adds to the wrapped time.Duration and returns the new value. +func (d *Duration) Add(n time.Duration) time.Duration { + return time.Duration(d.v.Add(int64(n))) +} + +// Sub atomically subtracts from the wrapped time.Duration and returns the new value. +func (d *Duration) Sub(n time.Duration) time.Duration { + return time.Duration(d.v.Sub(int64(n))) +} + +// Swap atomically swaps the wrapped time.Duration and returns the old value. +func (d *Duration) Swap(n time.Duration) time.Duration { + return time.Duration(d.v.Swap(int64(n))) +} + +// CAS is an atomic compare-and-swap. +func (d *Duration) CAS(old, new time.Duration) bool { + return d.v.CAS(int64(old), int64(new)) +} + +// Value shadows the type of the same name from sync/atomic +// https://godoc.org/sync/atomic#Value +type Value struct{ atomic.Value } diff --git a/vendor/go.uber.org/atomic/atomic_test.go b/vendor/go.uber.org/atomic/atomic_test.go new file mode 100644 index 000000000..6666f8a25 --- /dev/null +++ b/vendor/go.uber.org/atomic/atomic_test.go @@ -0,0 +1,172 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestInt32(t *testing.T) { + atom := NewInt32(42) + + require.Equal(t, int32(42), atom.Load(), "Load didn't work.") + require.Equal(t, int32(46), atom.Add(4), "Add didn't work.") + require.Equal(t, int32(44), atom.Sub(2), "Sub didn't work.") + require.Equal(t, int32(45), atom.Inc(), "Inc didn't work.") + require.Equal(t, int32(44), atom.Dec(), "Dec didn't work.") + + require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.") + require.Equal(t, int32(0), atom.Load(), "CAS didn't set the correct value.") + + require.Equal(t, int32(0), atom.Swap(1), "Swap didn't return the old value.") + require.Equal(t, int32(1), atom.Load(), "Swap didn't set the correct value.") + + atom.Store(42) + require.Equal(t, int32(42), atom.Load(), "Store didn't set the correct value.") +} + +func TestInt64(t *testing.T) { + atom := NewInt64(42) + + require.Equal(t, int64(42), atom.Load(), "Load didn't work.") + require.Equal(t, int64(46), atom.Add(4), "Add didn't work.") + require.Equal(t, int64(44), atom.Sub(2), "Sub didn't work.") + require.Equal(t, int64(45), atom.Inc(), "Inc didn't work.") + require.Equal(t, int64(44), atom.Dec(), "Dec didn't work.") + + require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.") + require.Equal(t, int64(0), atom.Load(), "CAS didn't set the correct value.") + + require.Equal(t, int64(0), atom.Swap(1), "Swap didn't return the old value.") + require.Equal(t, int64(1), atom.Load(), "Swap didn't set the correct value.") + + atom.Store(42) + require.Equal(t, int64(42), atom.Load(), "Store didn't set the correct value.") +} + +func TestUint32(t *testing.T) { + atom := NewUint32(42) + + require.Equal(t, uint32(42), atom.Load(), "Load didn't work.") + require.Equal(t, uint32(46), atom.Add(4), "Add didn't work.") + require.Equal(t, uint32(44), atom.Sub(2), "Sub didn't work.") + require.Equal(t, uint32(45), atom.Inc(), "Inc didn't work.") + require.Equal(t, uint32(44), atom.Dec(), "Dec didn't work.") + + require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.") + require.Equal(t, uint32(0), atom.Load(), "CAS didn't set the correct value.") + + require.Equal(t, uint32(0), atom.Swap(1), "Swap didn't return the old value.") + require.Equal(t, uint32(1), atom.Load(), "Swap didn't set the correct value.") + + atom.Store(42) + require.Equal(t, uint32(42), atom.Load(), "Store didn't set the correct value.") +} + +func TestUint64(t *testing.T) { + atom := NewUint64(42) + + require.Equal(t, uint64(42), atom.Load(), "Load didn't work.") + require.Equal(t, uint64(46), atom.Add(4), "Add didn't work.") + require.Equal(t, uint64(44), atom.Sub(2), "Sub didn't work.") + require.Equal(t, uint64(45), atom.Inc(), "Inc didn't work.") + require.Equal(t, uint64(44), atom.Dec(), "Dec didn't work.") + + require.True(t, atom.CAS(44, 0), "CAS didn't report a swap.") + require.Equal(t, uint64(0), atom.Load(), "CAS didn't set the correct value.") + + require.Equal(t, uint64(0), atom.Swap(1), "Swap didn't return the old value.") + require.Equal(t, uint64(1), atom.Load(), "Swap didn't set the correct value.") + + atom.Store(42) + require.Equal(t, uint64(42), atom.Load(), "Store didn't set the correct value.") +} + +func TestBool(t *testing.T) { + atom := NewBool(false) + require.False(t, atom.Toggle(), "Expected swap to return previous value.") + require.True(t, atom.Load(), "Unexpected state after swap.") + + require.True(t, atom.CAS(true, true), "CAS should swap when old matches") + require.True(t, atom.Load(), "CAS should have no effect") + require.True(t, atom.CAS(true, false), "CAS should swap when old matches") + require.False(t, atom.Load(), "CAS should have modified the value") + require.False(t, atom.CAS(true, false), "CAS should fail on old mismatch") + require.False(t, atom.Load(), "CAS should not have modified the value") + + atom.Store(false) + require.False(t, atom.Load(), "Unexpected state after store.") + + prev := atom.Swap(false) + require.False(t, prev, "Expected Swap to return previous value.") + + prev = atom.Swap(true) + require.False(t, prev, "Expected Swap to return previous value.") +} + +func TestFloat64(t *testing.T) { + atom := NewFloat64(4.2) + + require.Equal(t, float64(4.2), atom.Load(), "Load didn't work.") + + require.True(t, atom.CAS(4.2, 0.5), "CAS didn't report a swap.") + require.Equal(t, float64(0.5), atom.Load(), "CAS didn't set the correct value.") + require.False(t, atom.CAS(0.0, 1.5), "CAS reported a swap.") + + atom.Store(42.0) + require.Equal(t, float64(42.0), atom.Load(), "Store didn't set the correct value.") + require.Equal(t, float64(42.5), atom.Add(0.5), "Add didn't work.") + require.Equal(t, float64(42.0), atom.Sub(0.5), "Sub didn't work.") +} + +func TestDuration(t *testing.T) { + atom := NewDuration(5 * time.Minute) + + require.Equal(t, 5*time.Minute, atom.Load(), "Load didn't work.") + require.Equal(t, 6*time.Minute, atom.Add(time.Minute), "Add didn't work.") + require.Equal(t, 4*time.Minute, atom.Sub(2*time.Minute), "Sub didn't work.") + + require.True(t, atom.CAS(4*time.Minute, time.Minute), "CAS didn't report a swap.") + require.Equal(t, time.Minute, atom.Load(), "CAS didn't set the correct value.") + + require.Equal(t, time.Minute, atom.Swap(2*time.Minute), "Swap didn't return the old value.") + require.Equal(t, 2*time.Minute, atom.Load(), "Swap didn't set the correct value.") + + atom.Store(10 * time.Minute) + require.Equal(t, 10*time.Minute, atom.Load(), "Store didn't set the correct value.") +} + +func TestValue(t *testing.T) { + var v Value + assert.Nil(t, v.Load(), "initial Value is not nil") + + v.Store(42) + assert.Equal(t, 42, v.Load()) + + v.Store(84) + assert.Equal(t, 84, v.Load()) + + assert.Panics(t, func() { v.Store("foo") }) +} diff --git a/vendor/go.uber.org/atomic/example_test.go b/vendor/go.uber.org/atomic/example_test.go new file mode 100644 index 000000000..806e11c43 --- /dev/null +++ b/vendor/go.uber.org/atomic/example_test.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic_test + +import ( + "fmt" + + "go.uber.org/atomic" +) + +func Example() { + // Uint32 is a thin wrapper around the primitive uint32 type. + var atom atomic.Uint32 + + // The wrapper ensures that all operations are atomic. + atom.Store(42) + fmt.Println(atom.Inc()) + fmt.Println(atom.CAS(43, 0)) + fmt.Println(atom.Load()) + + // Output: + // 43 + // true + // 0 +} diff --git a/vendor/go.uber.org/atomic/glide.lock b/vendor/go.uber.org/atomic/glide.lock new file mode 100644 index 000000000..3c72c5997 --- /dev/null +++ b/vendor/go.uber.org/atomic/glide.lock @@ -0,0 +1,17 @@ +hash: f14d51408e3e0e4f73b34e4039484c78059cd7fc5f4996fdd73db20dc8d24f53 +updated: 2016-10-27T00:10:51.16960137-07:00 +imports: [] +testImports: +- name: github.com/davecgh/go-spew + version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d + subpackages: + - spew +- name: github.com/pmezard/go-difflib + version: d8ed2627bdf02c080bf22230dbb337003b7aba2d + subpackages: + - difflib +- name: github.com/stretchr/testify + version: d77da356e56a7428ad25149ca77381849a6a5232 + subpackages: + - assert + - require diff --git a/vendor/go.uber.org/atomic/glide.yaml b/vendor/go.uber.org/atomic/glide.yaml new file mode 100644 index 000000000..4cf608ec0 --- /dev/null +++ b/vendor/go.uber.org/atomic/glide.yaml @@ -0,0 +1,6 @@ +package: go.uber.org/atomic +testImport: +- package: github.com/stretchr/testify + subpackages: + - assert + - require diff --git a/vendor/go.uber.org/atomic/scripts/cover.sh b/vendor/go.uber.org/atomic/scripts/cover.sh new file mode 100755 index 000000000..5dfb65e47 --- /dev/null +++ b/vendor/go.uber.org/atomic/scripts/cover.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +set -e + +COVER=cover +ROOT_PKG=go.uber.org/atomic + +if [[ -d "$COVER" ]]; then + rm -rf "$COVER" +fi +mkdir -p "$COVER" + +i=0 +for pkg in "$@"; do + i=$((i + 1)) + + extracoverpkg="" + if [[ -f "$GOPATH/src/$pkg/.extra-coverpkg" ]]; then + extracoverpkg=$( \ + sed -e "s|^|$pkg/|g" < "$GOPATH/src/$pkg/.extra-coverpkg" \ + | tr '\n' ',') + fi + + coverpkg=$(go list -json "$pkg" | jq -r ' + .Deps + | map(select(startswith("'"$ROOT_PKG"'"))) + | map(select(contains("/vendor/") | not)) + | . + ["'"$pkg"'"] + | join(",") + ') + if [[ -n "$extracoverpkg" ]]; then + coverpkg="$extracoverpkg$coverpkg" + fi + + go test \ + -coverprofile "$COVER/cover.${i}.out" -coverpkg "$coverpkg" \ + -v "$pkg" +done + +gocovmerge "$COVER"/*.out > cover.out diff --git a/vendor/go.uber.org/atomic/scripts/test-ubergo.sh b/vendor/go.uber.org/atomic/scripts/test-ubergo.sh new file mode 100755 index 000000000..9bc526de7 --- /dev/null +++ b/vendor/go.uber.org/atomic/scripts/test-ubergo.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -euox pipefail +IFS=$'\n\t' + +# This script creates a fake GOPATH, symlinks in the current +# directory as uber-go/atomic and verifies that tests still pass. + +WORK_DIR=`mktemp -d` +function cleanup { + rm -rf "$WORK_DIR" +} +trap cleanup EXIT + + +export GOPATH="$WORK_DIR" +PKG_PARENT="$WORK_DIR/src/github.com/uber-go" +PKG_DIR="$PKG_PARENT/atomic" + +mkdir -p "$PKG_PARENT" +cp -R `pwd` "$PKG_DIR" +cd "$PKG_DIR" + +# The example imports go.uber.org, fix the import. +sed -e 's/go.uber.org\/atomic/github.com\/uber-go\/atomic/' -i="" example_test.go + +make test diff --git a/vendor/go.uber.org/atomic/stress_test.go b/vendor/go.uber.org/atomic/stress_test.go new file mode 100644 index 000000000..8fd125100 --- /dev/null +++ b/vendor/go.uber.org/atomic/stress_test.go @@ -0,0 +1,258 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "math" + "runtime" + "sync" + "sync/atomic" + "testing" +) + +const ( + _parallelism = 4 + _iterations = 1000 +) + +var _stressTests = map[string]func() func(){ + "i32/std": stressStdInt32, + "i32": stressInt32, + "i64/std": stressStdInt32, + "i64": stressInt64, + "u32/std": stressStdUint32, + "u32": stressUint32, + "u64/std": stressStdUint64, + "u64": stressUint64, + "f64": stressFloat64, + "bool": stressBool, + "string": stressString, + "duration": stressDuration, +} + +func TestStress(t *testing.T) { + for name, ff := range _stressTests { + t.Run(name, func(t *testing.T) { + defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(_parallelism)) + + start := make(chan struct{}) + var wg sync.WaitGroup + wg.Add(_parallelism) + f := ff() + for i := 0; i < _parallelism; i++ { + go func() { + defer wg.Done() + <-start + for j := 0; j < _iterations; j++ { + f() + } + }() + } + close(start) + wg.Wait() + }) + } +} + +func BenchmarkStress(b *testing.B) { + for name, ff := range _stressTests { + b.Run(name, func(b *testing.B) { + f := ff() + + b.Run("serial", func(b *testing.B) { + for i := 0; i < b.N; i++ { + f() + } + }) + + b.Run("parallel", func(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + f() + } + }) + }) + }) + } +} + +func stressStdInt32() func() { + var atom int32 + return func() { + atomic.LoadInt32(&atom) + atomic.AddInt32(&atom, 1) + atomic.AddInt32(&atom, -2) + atomic.AddInt32(&atom, 1) + atomic.AddInt32(&atom, -1) + atomic.CompareAndSwapInt32(&atom, 1, 0) + atomic.SwapInt32(&atom, 5) + atomic.StoreInt32(&atom, 1) + } +} + +func stressInt32() func() { + var atom Int32 + return func() { + atom.Load() + atom.Add(1) + atom.Sub(2) + atom.Inc() + atom.Dec() + atom.CAS(1, 0) + atom.Swap(5) + atom.Store(1) + } +} + +func stressStdInt64() func() { + var atom int64 + return func() { + atomic.LoadInt64(&atom) + atomic.AddInt64(&atom, 1) + atomic.AddInt64(&atom, -2) + atomic.AddInt64(&atom, 1) + atomic.AddInt64(&atom, -1) + atomic.CompareAndSwapInt64(&atom, 1, 0) + atomic.SwapInt64(&atom, 5) + atomic.StoreInt64(&atom, 1) + } +} + +func stressInt64() func() { + var atom Int64 + return func() { + atom.Load() + atom.Add(1) + atom.Sub(2) + atom.Inc() + atom.Dec() + atom.CAS(1, 0) + atom.Swap(5) + atom.Store(1) + } +} + +func stressStdUint32() func() { + var atom uint32 + return func() { + atomic.LoadUint32(&atom) + atomic.AddUint32(&atom, 1) + // Adding `MaxUint32` is the same as subtracting 1 + atomic.AddUint32(&atom, math.MaxUint32-1) + atomic.AddUint32(&atom, 1) + atomic.AddUint32(&atom, math.MaxUint32) + atomic.CompareAndSwapUint32(&atom, 1, 0) + atomic.SwapUint32(&atom, 5) + atomic.StoreUint32(&atom, 1) + } +} + +func stressUint32() func() { + var atom Uint32 + return func() { + atom.Load() + atom.Add(1) + atom.Sub(2) + atom.Inc() + atom.Dec() + atom.CAS(1, 0) + atom.Swap(5) + atom.Store(1) + } +} + +func stressStdUint64() func() { + var atom uint64 + return func() { + atomic.LoadUint64(&atom) + atomic.AddUint64(&atom, 1) + // Adding `MaxUint64` is the same as subtracting 1 + atomic.AddUint64(&atom, math.MaxUint64-1) + atomic.AddUint64(&atom, 1) + atomic.AddUint64(&atom, math.MaxUint64) + atomic.CompareAndSwapUint64(&atom, 1, 0) + atomic.SwapUint64(&atom, 5) + atomic.StoreUint64(&atom, 1) + } +} + +func stressUint64() func() { + var atom Uint64 + return func() { + atom.Load() + atom.Add(1) + atom.Sub(2) + atom.Inc() + atom.Dec() + atom.CAS(1, 0) + atom.Swap(5) + atom.Store(1) + } +} + +func stressFloat64() func() { + var atom Float64 + return func() { + atom.Load() + atom.CAS(1.0, 0.1) + atom.Add(1.1) + atom.Sub(0.2) + atom.Store(1.0) + } +} + +func stressBool() func() { + var atom Bool + return func() { + atom.Load() + atom.Store(false) + atom.Swap(true) + atom.CAS(true, false) + atom.CAS(true, false) + atom.Load() + atom.Toggle() + atom.Toggle() + } +} + +func stressString() func() { + var atom String + return func() { + atom.Load() + atom.Store("abc") + atom.Load() + atom.Store("def") + atom.Load() + atom.Store("") + } +} + +func stressDuration() func() { + var atom = NewDuration(0) + return func() { + atom.Load() + atom.Add(1) + atom.Sub(2) + atom.CAS(1, 0) + atom.Swap(5) + atom.Store(1) + } +} diff --git a/vendor/go.uber.org/atomic/string.go b/vendor/go.uber.org/atomic/string.go new file mode 100644 index 000000000..ede8136fa --- /dev/null +++ b/vendor/go.uber.org/atomic/string.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +// String is an atomic type-safe wrapper around Value for strings. +type String struct{ v Value } + +// NewString creates a String. +func NewString(str string) *String { + s := &String{} + if str != "" { + s.Store(str) + } + return s +} + +// Load atomically loads the wrapped string. +func (s *String) Load() string { + v := s.v.Load() + if v == nil { + return "" + } + return v.(string) +} + +// Store atomically stores the passed string. +// Note: Converting the string to an interface{} to store in the Value +// requires an allocation. +func (s *String) Store(str string) { + s.v.Store(str) +} diff --git a/vendor/go.uber.org/atomic/string_test.go b/vendor/go.uber.org/atomic/string_test.go new file mode 100644 index 000000000..91b793ef8 --- /dev/null +++ b/vendor/go.uber.org/atomic/string_test.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestStringNoInitialValue(t *testing.T) { + atom := &String{} + require.Equal(t, "", atom.Load(), "Initial value should be blank string") +} + +func TestString(t *testing.T) { + atom := NewString("") + require.Equal(t, "", atom.Load(), "Expected Load to return initialized value") + + atom.Store("abc") + require.Equal(t, "abc", atom.Load(), "Unexpected value after Store") + + atom = NewString("bcd") + require.Equal(t, "bcd", atom.Load(), "Expected Load to return initialized value") +} diff --git a/vendor/go.uber.org/multierr/.codecov.yml b/vendor/go.uber.org/multierr/.codecov.yml new file mode 100644 index 000000000..6d4d1be7b --- /dev/null +++ b/vendor/go.uber.org/multierr/.codecov.yml @@ -0,0 +1,15 @@ +coverage: + range: 80..100 + round: down + precision: 2 + + status: + project: # measuring the overall project coverage + default: # context, you can create multiple ones with custom titles + enabled: yes # must be yes|true to enable this status + target: 100 # specify the target coverage for each commit status + # option: "auto" (must increase from parent commit or pull request base) + # option: "X%" a static target percentage to hit + if_not_found: success # if parent is not found report status as success, error, or failure + if_ci_failed: error # if ci fails report status as success, error, or failure + diff --git a/vendor/go.uber.org/multierr/.gitignore b/vendor/go.uber.org/multierr/.gitignore new file mode 100644 index 000000000..61ead8666 --- /dev/null +++ b/vendor/go.uber.org/multierr/.gitignore @@ -0,0 +1 @@ +/vendor diff --git a/vendor/go.uber.org/multierr/.travis.yml b/vendor/go.uber.org/multierr/.travis.yml new file mode 100644 index 000000000..5ffa8fed4 --- /dev/null +++ b/vendor/go.uber.org/multierr/.travis.yml @@ -0,0 +1,33 @@ +sudo: false +language: go +go_import_path: go.uber.org/multierr + +env: + global: + - GO15VENDOREXPERIMENT=1 + +go: + - 1.7 + - 1.8 + - tip + +cache: + directories: + - vendor + +before_install: +- go version + +install: +- | + set -e + make install_ci + +script: +- | + set -e + make lint + make test_ci + +after_success: +- bash <(curl -s https://codecov.io/bash) diff --git a/vendor/go.uber.org/multierr/CHANGELOG.md b/vendor/go.uber.org/multierr/CHANGELOG.md new file mode 100644 index 000000000..898445d06 --- /dev/null +++ b/vendor/go.uber.org/multierr/CHANGELOG.md @@ -0,0 +1,28 @@ +Releases +======== + +v1.1.0 (2017-06-30) +=================== + +- Added an `Errors(error) []error` function to extract the underlying list of + errors for a multierr error. + + +v1.0.0 (2017-05-31) +=================== + +No changes since v0.2.0. This release is committing to making no breaking +changes to the current API in the 1.X series. + + +v0.2.0 (2017-04-11) +=================== + +- Repeatedly appending to the same error is now faster due to fewer + allocations. + + +v0.1.0 (2017-31-03) +=================== + +- Initial release diff --git a/vendor/go.uber.org/multierr/LICENSE.txt b/vendor/go.uber.org/multierr/LICENSE.txt new file mode 100644 index 000000000..858e02475 --- /dev/null +++ b/vendor/go.uber.org/multierr/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2017 Uber Technologies, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/go.uber.org/multierr/Makefile b/vendor/go.uber.org/multierr/Makefile new file mode 100644 index 000000000..a7437d061 --- /dev/null +++ b/vendor/go.uber.org/multierr/Makefile @@ -0,0 +1,74 @@ +export GO15VENDOREXPERIMENT=1 + +PACKAGES := $(shell glide nv) + +GO_FILES := $(shell \ + find . '(' -path '*/.*' -o -path './vendor' ')' -prune \ + -o -name '*.go' -print | cut -b3-) + +.PHONY: install +install: + glide --version || go get github.com/Masterminds/glide + glide install + +.PHONY: build +build: + go build -i $(PACKAGES) + +.PHONY: test +test: + go test -cover -race $(PACKAGES) + +.PHONY: gofmt +gofmt: + $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX)) + @gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true + @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" | cat - $(FMT_LOG) && false) + +.PHONY: govet +govet: + $(eval VET_LOG := $(shell mktemp -t govet.XXXXX)) + @go vet $(PACKAGES) 2>&1 \ + | grep -v '^exit status' > $(VET_LOG) || true + @[ ! -s "$(VET_LOG)" ] || (echo "govet failed:" | cat - $(VET_LOG) && false) + +.PHONY: golint +golint: + @go get github.com/golang/lint/golint + $(eval LINT_LOG := $(shell mktemp -t golint.XXXXX)) + @cat /dev/null > $(LINT_LOG) + @$(foreach pkg, $(PACKAGES), golint $(pkg) >> $(LINT_LOG) || true;) + @[ ! -s "$(LINT_LOG)" ] || (echo "golint failed:" | cat - $(LINT_LOG) && false) + +.PHONY: staticcheck +staticcheck: + @go get honnef.co/go/tools/cmd/staticcheck + $(eval STATICCHECK_LOG := $(shell mktemp -t staticcheck.XXXXX)) + @staticcheck $(PACKAGES) 2>&1 > $(STATICCHECK_LOG) || true + @[ ! -s "$(STATICCHECK_LOG)" ] || (echo "staticcheck failed:" | cat - $(STATICCHECK_LOG) && false) + +.PHONY: lint +lint: gofmt govet golint staticcheck + +.PHONY: cover +cover: + ./scripts/cover.sh $(shell go list $(PACKAGES)) + go tool cover -html=cover.out -o cover.html + +update-license: + @go get go.uber.org/tools/update-license + @update-license \ + $(shell go list -json $(PACKAGES) | \ + jq -r '.Dir + "/" + (.GoFiles | .[])') + +############################################################################## + +.PHONY: install_ci +install_ci: install + go get github.com/wadey/gocovmerge + go get github.com/mattn/goveralls + go get golang.org/x/tools/cmd/cover + +.PHONY: test_ci +test_ci: install_ci + ./scripts/cover.sh $(shell go list $(PACKAGES)) diff --git a/vendor/go.uber.org/multierr/README.md b/vendor/go.uber.org/multierr/README.md new file mode 100644 index 000000000..065088f64 --- /dev/null +++ b/vendor/go.uber.org/multierr/README.md @@ -0,0 +1,23 @@ +# multierr [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] + +`multierr` allows combining one or more Go `error`s together. + +## Installation + + go get -u go.uber.org/multierr + +## Status + +Stable: No breaking changes will be made before 2.0. + +------------------------------------------------------------------------------- + +Released under the [MIT License]. + +[MIT License]: LICENSE.txt +[doc-img]: https://godoc.org/go.uber.org/multierr?status.svg +[doc]: https://godoc.org/go.uber.org/multierr +[ci-img]: https://travis-ci.org/uber-go/multierr.svg?branch=master +[cov-img]: https://codecov.io/gh/uber-go/multierr/branch/master/graph/badge.svg +[ci]: https://travis-ci.org/uber-go/multierr +[cov]: https://codecov.io/gh/uber-go/multierr diff --git a/vendor/go.uber.org/multierr/benchmarks_test.go b/vendor/go.uber.org/multierr/benchmarks_test.go new file mode 100644 index 000000000..797f5a0f3 --- /dev/null +++ b/vendor/go.uber.org/multierr/benchmarks_test.go @@ -0,0 +1,62 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package multierr + +import ( + "errors" + "fmt" + "testing" +) + +func BenchmarkAppend(b *testing.B) { + errorTypes := []struct { + name string + err error + }{ + { + name: "nil", + err: nil, + }, + { + name: "single error", + err: errors.New("test"), + }, + { + name: "multiple errors", + err: appendN(nil, errors.New("err"), 10), + }, + } + + for _, initial := range errorTypes { + for _, v := range errorTypes { + msg := fmt.Sprintf("append %v to %v", v.name, initial.name) + b.Run(msg, func(b *testing.B) { + for _, appends := range []int{1, 2, 10} { + b.Run(fmt.Sprint(appends), func(b *testing.B) { + for i := 0; i < b.N; i++ { + appendN(initial.err, v.err, appends) + } + }) + } + }) + } + } +} diff --git a/vendor/go.uber.org/multierr/error.go b/vendor/go.uber.org/multierr/error.go new file mode 100644 index 000000000..de6ce4736 --- /dev/null +++ b/vendor/go.uber.org/multierr/error.go @@ -0,0 +1,401 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package multierr allows combining one or more errors together. +// +// Overview +// +// Errors can be combined with the use of the Combine function. +// +// multierr.Combine( +// reader.Close(), +// writer.Close(), +// conn.Close(), +// ) +// +// If only two errors are being combined, the Append function may be used +// instead. +// +// err = multierr.Combine(reader.Close(), writer.Close()) +// +// This makes it possible to record resource cleanup failures from deferred +// blocks with the help of named return values. +// +// func sendRequest(req Request) (err error) { +// conn, err := openConnection() +// if err != nil { +// return err +// } +// defer func() { +// err = multierr.Append(err, conn.Close()) +// }() +// // ... +// } +// +// The underlying list of errors for a returned error object may be retrieved +// with the Errors function. +// +// errors := multierr.Errors(err) +// if len(errors) > 0 { +// fmt.Println("The following errors occurred:") +// } +// +// Advanced Usage +// +// Errors returned by Combine and Append MAY implement the following +// interface. +// +// type errorGroup interface { +// // Returns a slice containing the underlying list of errors. +// // +// // This slice MUST NOT be modified by the caller. +// Errors() []error +// } +// +// Note that if you need access to list of errors behind a multierr error, you +// should prefer using the Errors function. That said, if you need cheap +// read-only access to the underlying errors slice, you can attempt to cast +// the error to this interface. You MUST handle the failure case gracefully +// because errors returned by Combine and Append are not guaranteed to +// implement this interface. +// +// var errors []error +// group, ok := err.(errorGroup) +// if ok { +// errors = group.Errors() +// } else { +// errors = []error{err} +// } +package multierr // import "go.uber.org/multierr" + +import ( + "bytes" + "fmt" + "io" + "strings" + "sync" + + "go.uber.org/atomic" +) + +var ( + // Separator for single-line error messages. + _singlelineSeparator = []byte("; ") + + _newline = []byte("\n") + + // Prefix for multi-line messages + _multilinePrefix = []byte("the following errors occurred:") + + // Prefix for the first and following lines of an item in a list of + // multi-line error messages. + // + // For example, if a single item is: + // + // foo + // bar + // + // It will become, + // + // - foo + // bar + _multilineSeparator = []byte("\n - ") + _multilineIndent = []byte(" ") +) + +// _bufferPool is a pool of bytes.Buffers. +var _bufferPool = sync.Pool{ + New: func() interface{} { + return &bytes.Buffer{} + }, +} + +type errorGroup interface { + Errors() []error +} + +// Errors returns a slice containing zero or more errors that the supplied +// error is composed of. If the error is nil, the returned slice is empty. +// +// err := multierr.Append(r.Close(), w.Close()) +// errors := multierr.Errors(err) +// +// If the error is not composed of other errors, the returned slice contains +// just the error that was passed in. +// +// Callers of this function are free to modify the returned slice. +func Errors(err error) []error { + if err == nil { + return nil + } + + // Note that we're casting to multiError, not errorGroup. Our contract is + // that returned errors MAY implement errorGroup. Errors, however, only + // has special behavior for multierr-specific error objects. + // + // This behavior can be expanded in the future but I think it's prudent to + // start with as little as possible in terms of contract and possibility + // of misuse. + eg, ok := err.(*multiError) + if !ok { + return []error{err} + } + + errors := eg.Errors() + result := make([]error, len(errors)) + copy(result, errors) + return result +} + +// multiError is an error that holds one or more errors. +// +// An instance of this is guaranteed to be non-empty and flattened. That is, +// none of the errors inside multiError are other multiErrors. +// +// multiError formats to a semi-colon delimited list of error messages with +// %v and with a more readable multi-line format with %+v. +type multiError struct { + copyNeeded atomic.Bool + errors []error +} + +var _ errorGroup = (*multiError)(nil) + +// Errors returns the list of underlying errors. +// +// This slice MUST NOT be modified. +func (merr *multiError) Errors() []error { + if merr == nil { + return nil + } + return merr.errors +} + +func (merr *multiError) Error() string { + if merr == nil { + return "" + } + + buff := _bufferPool.Get().(*bytes.Buffer) + buff.Reset() + + merr.writeSingleline(buff) + + result := buff.String() + _bufferPool.Put(buff) + return result +} + +func (merr *multiError) Format(f fmt.State, c rune) { + if c == 'v' && f.Flag('+') { + merr.writeMultiline(f) + } else { + merr.writeSingleline(f) + } +} + +func (merr *multiError) writeSingleline(w io.Writer) { + first := true + for _, item := range merr.errors { + if first { + first = false + } else { + w.Write(_singlelineSeparator) + } + io.WriteString(w, item.Error()) + } +} + +func (merr *multiError) writeMultiline(w io.Writer) { + w.Write(_multilinePrefix) + for _, item := range merr.errors { + w.Write(_multilineSeparator) + writePrefixLine(w, _multilineIndent, fmt.Sprintf("%+v", item)) + } +} + +// Writes s to the writer with the given prefix added before each line after +// the first. +func writePrefixLine(w io.Writer, prefix []byte, s string) { + first := true + for len(s) > 0 { + if first { + first = false + } else { + w.Write(prefix) + } + + idx := strings.IndexByte(s, '\n') + if idx < 0 { + idx = len(s) - 1 + } + + io.WriteString(w, s[:idx+1]) + s = s[idx+1:] + } +} + +type inspectResult struct { + // Number of top-level non-nil errors + Count int + + // Total number of errors including multiErrors + Capacity int + + // Index of the first non-nil error in the list. Value is meaningless if + // Count is zero. + FirstErrorIdx int + + // Whether the list contains at least one multiError + ContainsMultiError bool +} + +// Inspects the given slice of errors so that we can efficiently allocate +// space for it. +func inspect(errors []error) (res inspectResult) { + first := true + for i, err := range errors { + if err == nil { + continue + } + + res.Count++ + if first { + first = false + res.FirstErrorIdx = i + } + + if merr, ok := err.(*multiError); ok { + res.Capacity += len(merr.errors) + res.ContainsMultiError = true + } else { + res.Capacity++ + } + } + return +} + +// fromSlice converts the given list of errors into a single error. +func fromSlice(errors []error) error { + res := inspect(errors) + switch res.Count { + case 0: + return nil + case 1: + // only one non-nil entry + return errors[res.FirstErrorIdx] + case len(errors): + if !res.ContainsMultiError { + // already flat + return &multiError{errors: errors} + } + } + + nonNilErrs := make([]error, 0, res.Capacity) + for _, err := range errors[res.FirstErrorIdx:] { + if err == nil { + continue + } + + if nested, ok := err.(*multiError); ok { + nonNilErrs = append(nonNilErrs, nested.errors...) + } else { + nonNilErrs = append(nonNilErrs, err) + } + } + + return &multiError{errors: nonNilErrs} +} + +// Combine combines the passed errors into a single error. +// +// If zero arguments were passed or if all items are nil, a nil error is +// returned. +// +// Combine(nil, nil) // == nil +// +// If only a single error was passed, it is returned as-is. +// +// Combine(err) // == err +// +// Combine skips over nil arguments so this function may be used to combine +// together errors from operations that fail independently of each other. +// +// multierr.Combine( +// reader.Close(), +// writer.Close(), +// pipe.Close(), +// ) +// +// If any of the passed errors is a multierr error, it will be flattened along +// with the other errors. +// +// multierr.Combine(multierr.Combine(err1, err2), err3) +// // is the same as +// multierr.Combine(err1, err2, err3) +// +// The returned error formats into a readable multi-line error message if +// formatted with %+v. +// +// fmt.Sprintf("%+v", multierr.Combine(err1, err2)) +func Combine(errors ...error) error { + return fromSlice(errors) +} + +// Append appends the given errors together. Either value may be nil. +// +// This function is a specialization of Combine for the common case where +// there are only two errors. +// +// err = multierr.Append(reader.Close(), writer.Close()) +// +// The following pattern may also be used to record failure of deferred +// operations without losing information about the original error. +// +// func doSomething(..) (err error) { +// f := acquireResource() +// defer func() { +// err = multierr.Append(err, f.Close()) +// }() +func Append(left error, right error) error { + switch { + case left == nil: + return right + case right == nil: + return left + } + + if _, ok := right.(*multiError); !ok { + if l, ok := left.(*multiError); ok && !l.copyNeeded.Swap(true) { + // Common case where the error on the left is constantly being + // appended to. + errs := append(l.errors, right) + return &multiError{errors: errs} + } else if !ok { + // Both errors are single errors. + return &multiError{errors: []error{left, right}} + } + } + + // Either right or both, left and right, are multiErrors. Rely on usual + // expensive logic. + errors := [2]error{left, right} + return fromSlice(errors[0:]) +} diff --git a/vendor/go.uber.org/multierr/error_test.go b/vendor/go.uber.org/multierr/error_test.go new file mode 100644 index 000000000..9384ff5a0 --- /dev/null +++ b/vendor/go.uber.org/multierr/error_test.go @@ -0,0 +1,511 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package multierr + +import ( + "errors" + "fmt" + "io" + "sync" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// richFormatError is an error that prints a different output depending on +// whether %v or %+v was used. +type richFormatError struct{} + +func (r richFormatError) Error() string { + return fmt.Sprint(r) +} + +func (richFormatError) Format(f fmt.State, c rune) { + if c == 'v' && f.Flag('+') { + io.WriteString(f, "multiline\nmessage\nwith plus") + } else { + io.WriteString(f, "without plus") + } +} + +func appendN(initial, err error, n int) error { + errs := initial + for i := 0; i < n; i++ { + errs = Append(errs, err) + } + return errs +} + +func newMultiErr(errors ...error) error { + return &multiError{errors: errors} +} + +func TestCombine(t *testing.T) { + tests := []struct { + // Input + giveErrors []error + + // Resulting error + wantError error + + // %+v and %v string representations + wantMultiline string + wantSingleline string + }{ + { + giveErrors: nil, + wantError: nil, + }, + { + giveErrors: []error{}, + wantError: nil, + }, + { + giveErrors: []error{ + errors.New("foo"), + nil, + newMultiErr( + errors.New("bar"), + ), + nil, + }, + wantError: newMultiErr( + errors.New("foo"), + errors.New("bar"), + ), + wantMultiline: "the following errors occurred:\n" + + " - foo\n" + + " - bar", + wantSingleline: "foo; bar", + }, + { + giveErrors: []error{ + errors.New("foo"), + newMultiErr( + errors.New("bar"), + ), + }, + wantError: newMultiErr( + errors.New("foo"), + errors.New("bar"), + ), + wantMultiline: "the following errors occurred:\n" + + " - foo\n" + + " - bar", + wantSingleline: "foo; bar", + }, + { + giveErrors: []error{errors.New("great sadness")}, + wantError: errors.New("great sadness"), + wantMultiline: "great sadness", + wantSingleline: "great sadness", + }, + { + giveErrors: []error{ + errors.New("foo"), + errors.New("bar"), + }, + wantError: newMultiErr( + errors.New("foo"), + errors.New("bar"), + ), + wantMultiline: "the following errors occurred:\n" + + " - foo\n" + + " - bar", + wantSingleline: "foo; bar", + }, + { + giveErrors: []error{ + errors.New("great sadness"), + errors.New("multi\n line\nerror message"), + errors.New("single line error message"), + }, + wantError: newMultiErr( + errors.New("great sadness"), + errors.New("multi\n line\nerror message"), + errors.New("single line error message"), + ), + wantMultiline: "the following errors occurred:\n" + + " - great sadness\n" + + " - multi\n" + + " line\n" + + " error message\n" + + " - single line error message", + wantSingleline: "great sadness; " + + "multi\n line\nerror message; " + + "single line error message", + }, + { + giveErrors: []error{ + errors.New("foo"), + newMultiErr( + errors.New("bar"), + errors.New("baz"), + ), + errors.New("qux"), + }, + wantError: newMultiErr( + errors.New("foo"), + errors.New("bar"), + errors.New("baz"), + errors.New("qux"), + ), + wantMultiline: "the following errors occurred:\n" + + " - foo\n" + + " - bar\n" + + " - baz\n" + + " - qux", + wantSingleline: "foo; bar; baz; qux", + }, + { + giveErrors: []error{ + errors.New("foo"), + nil, + newMultiErr( + errors.New("bar"), + ), + nil, + }, + wantError: newMultiErr( + errors.New("foo"), + errors.New("bar"), + ), + wantMultiline: "the following errors occurred:\n" + + " - foo\n" + + " - bar", + wantSingleline: "foo; bar", + }, + { + giveErrors: []error{ + errors.New("foo"), + newMultiErr( + errors.New("bar"), + ), + }, + wantError: newMultiErr( + errors.New("foo"), + errors.New("bar"), + ), + wantMultiline: "the following errors occurred:\n" + + " - foo\n" + + " - bar", + wantSingleline: "foo; bar", + }, + { + giveErrors: []error{ + errors.New("foo"), + richFormatError{}, + errors.New("bar"), + }, + wantError: newMultiErr( + errors.New("foo"), + richFormatError{}, + errors.New("bar"), + ), + wantMultiline: "the following errors occurred:\n" + + " - foo\n" + + " - multiline\n" + + " message\n" + + " with plus\n" + + " - bar", + wantSingleline: "foo; without plus; bar", + }, + } + + for i, tt := range tests { + t.Run(fmt.Sprint(i), func(t *testing.T) { + err := Combine(tt.giveErrors...) + require.Equal(t, tt.wantError, err) + + if tt.wantMultiline != "" { + t.Run("Sprintf/multiline", func(t *testing.T) { + assert.Equal(t, tt.wantMultiline, fmt.Sprintf("%+v", err)) + }) + } + + if tt.wantSingleline != "" { + t.Run("Sprintf/singleline", func(t *testing.T) { + assert.Equal(t, tt.wantSingleline, fmt.Sprintf("%v", err)) + }) + + t.Run("Error()", func(t *testing.T) { + assert.Equal(t, tt.wantSingleline, err.Error()) + }) + + if s, ok := err.(fmt.Stringer); ok { + t.Run("String()", func(t *testing.T) { + assert.Equal(t, tt.wantSingleline, s.String()) + }) + } + } + }) + } +} + +func TestCombineDoesNotModifySlice(t *testing.T) { + errors := []error{ + errors.New("foo"), + nil, + errors.New("bar"), + } + + assert.NotNil(t, Combine(errors...)) + assert.Len(t, errors, 3) + assert.Nil(t, errors[1], 3) +} + +func TestAppend(t *testing.T) { + tests := []struct { + left error + right error + want error + }{ + { + left: nil, + right: nil, + want: nil, + }, + { + left: nil, + right: errors.New("great sadness"), + want: errors.New("great sadness"), + }, + { + left: errors.New("great sadness"), + right: nil, + want: errors.New("great sadness"), + }, + { + left: errors.New("foo"), + right: errors.New("bar"), + want: newMultiErr( + errors.New("foo"), + errors.New("bar"), + ), + }, + { + left: newMultiErr( + errors.New("foo"), + errors.New("bar"), + ), + right: errors.New("baz"), + want: newMultiErr( + errors.New("foo"), + errors.New("bar"), + errors.New("baz"), + ), + }, + { + left: errors.New("baz"), + right: newMultiErr( + errors.New("foo"), + errors.New("bar"), + ), + want: newMultiErr( + errors.New("baz"), + errors.New("foo"), + errors.New("bar"), + ), + }, + { + left: newMultiErr( + errors.New("foo"), + ), + right: newMultiErr( + errors.New("bar"), + ), + want: newMultiErr( + errors.New("foo"), + errors.New("bar"), + ), + }, + } + + for _, tt := range tests { + assert.Equal(t, tt.want, Append(tt.left, tt.right)) + } +} + +type notMultiErr struct{} + +var _ errorGroup = notMultiErr{} + +func (notMultiErr) Error() string { + return "great sadness" +} + +func (notMultiErr) Errors() []error { + return []error{errors.New("great sadness")} +} + +func TestErrors(t *testing.T) { + tests := []struct { + give error + want []error + + // Don't attempt to cast to errorGroup or *multiError + dontCast bool + }{ + {dontCast: true}, // nil + { + give: errors.New("hi"), + want: []error{errors.New("hi")}, + dontCast: true, + }, + { + // We don't yet support non-multierr errors. + give: notMultiErr{}, + want: []error{notMultiErr{}}, + dontCast: true, + }, + { + give: Combine( + errors.New("foo"), + errors.New("bar"), + ), + want: []error{ + errors.New("foo"), + errors.New("bar"), + }, + }, + { + give: Append( + errors.New("foo"), + errors.New("bar"), + ), + want: []error{ + errors.New("foo"), + errors.New("bar"), + }, + }, + { + give: Append( + errors.New("foo"), + Combine( + errors.New("bar"), + ), + ), + want: []error{ + errors.New("foo"), + errors.New("bar"), + }, + }, + { + give: Combine( + errors.New("foo"), + Append( + errors.New("bar"), + errors.New("baz"), + ), + errors.New("qux"), + ), + want: []error{ + errors.New("foo"), + errors.New("bar"), + errors.New("baz"), + errors.New("qux"), + }, + }, + } + + for i, tt := range tests { + t.Run(fmt.Sprint(i), func(t *testing.T) { + t.Run("Errors()", func(t *testing.T) { + require.Equal(t, tt.want, Errors(tt.give)) + }) + + if tt.dontCast { + return + } + + t.Run("multiError", func(t *testing.T) { + require.Equal(t, tt.want, tt.give.(*multiError).Errors()) + }) + + t.Run("errorGroup", func(t *testing.T) { + require.Equal(t, tt.want, tt.give.(errorGroup).Errors()) + }) + }) + } +} + +func createMultiErrWithCapacity() error { + // Create a multiError that has capacity for more errors so Append will + // modify the underlying array that may be shared. + return appendN(nil, errors.New("append"), 50) +} + +func TestAppendDoesNotModify(t *testing.T) { + initial := createMultiErrWithCapacity() + err1 := Append(initial, errors.New("err1")) + err2 := Append(initial, errors.New("err2")) + + // Make sure the error messages match, since we do modify the copyNeeded + // atomic, the values cannot be compared. + assert.EqualError(t, initial, createMultiErrWithCapacity().Error(), "Initial should not be modified") + + assert.EqualError(t, err1, Append(createMultiErrWithCapacity(), errors.New("err1")).Error()) + assert.EqualError(t, err2, Append(createMultiErrWithCapacity(), errors.New("err2")).Error()) +} + +func TestAppendRace(t *testing.T) { + initial := createMultiErrWithCapacity() + + var wg sync.WaitGroup + for i := 0; i < 10; i++ { + wg.Add(1) + go func() { + defer wg.Done() + + err := initial + for j := 0; j < 10; j++ { + err = Append(err, errors.New("err")) + } + }() + } + + wg.Wait() +} + +func TestErrorsSliceIsImmutable(t *testing.T) { + err1 := errors.New("err1") + err2 := errors.New("err2") + + err := Append(err1, err2) + gotErrors := Errors(err) + require.Equal(t, []error{err1, err2}, gotErrors, "errors must match") + + gotErrors[0] = nil + gotErrors[1] = errors.New("err3") + + require.Equal(t, []error{err1, err2}, Errors(err), + "errors must match after modification") +} + +func TestNilMultierror(t *testing.T) { + // For safety, all operations on multiError should be safe even if it is + // nil. + var err *multiError + + require.Empty(t, err.Error()) + require.Empty(t, err.Errors()) +} diff --git a/vendor/go.uber.org/multierr/example_test.go b/vendor/go.uber.org/multierr/example_test.go new file mode 100644 index 000000000..da4d91406 --- /dev/null +++ b/vendor/go.uber.org/multierr/example_test.go @@ -0,0 +1,72 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package multierr_test + +import ( + "errors" + "fmt" + + "go.uber.org/multierr" +) + +func ExampleCombine() { + err := multierr.Combine( + errors.New("call 1 failed"), + nil, // successful request + errors.New("call 3 failed"), + nil, // successful request + errors.New("call 5 failed"), + ) + fmt.Printf("%+v", err) + // Output: + // the following errors occurred: + // - call 1 failed + // - call 3 failed + // - call 5 failed +} + +func ExampleAppend() { + var err error + err = multierr.Append(err, errors.New("call 1 failed")) + err = multierr.Append(err, errors.New("call 2 failed")) + fmt.Println(err) + // Output: + // call 1 failed; call 2 failed +} + +func ExampleErrors() { + err := multierr.Combine( + nil, // successful request + errors.New("call 2 failed"), + errors.New("call 3 failed"), + ) + err = multierr.Append(err, nil) // successful request + err = multierr.Append(err, errors.New("call 5 failed")) + + errors := multierr.Errors(err) + for _, err := range errors { + fmt.Println(err) + } + // Output: + // call 2 failed + // call 3 failed + // call 5 failed +} diff --git a/vendor/go.uber.org/multierr/glide.lock b/vendor/go.uber.org/multierr/glide.lock new file mode 100644 index 000000000..f9ea94c33 --- /dev/null +++ b/vendor/go.uber.org/multierr/glide.lock @@ -0,0 +1,19 @@ +hash: b53b5e9a84b9cb3cc4b2d0499e23da2feca1eec318ce9bb717ecf35bf24bf221 +updated: 2017-04-10T13:34:45.671678062-07:00 +imports: +- name: go.uber.org/atomic + version: 3b8db5e93c4c02efbc313e17b2e796b0914a01fb +testImports: +- name: github.com/davecgh/go-spew + version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9 + subpackages: + - spew +- name: github.com/pmezard/go-difflib + version: d8ed2627bdf02c080bf22230dbb337003b7aba2d + subpackages: + - difflib +- name: github.com/stretchr/testify + version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0 + subpackages: + - assert + - require diff --git a/vendor/go.uber.org/multierr/glide.yaml b/vendor/go.uber.org/multierr/glide.yaml new file mode 100644 index 000000000..6ef084ec2 --- /dev/null +++ b/vendor/go.uber.org/multierr/glide.yaml @@ -0,0 +1,8 @@ +package: go.uber.org/multierr +import: +- package: go.uber.org/atomic + version: ^1 +testImport: +- package: github.com/stretchr/testify + subpackages: + - assert diff --git a/vendor/go.uber.org/multierr/scripts/cover.sh b/vendor/go.uber.org/multierr/scripts/cover.sh new file mode 100755 index 000000000..e7f2b8863 --- /dev/null +++ b/vendor/go.uber.org/multierr/scripts/cover.sh @@ -0,0 +1,40 @@ +#!/bin/bash -e + +COVER=cover +ROOT_PKG=go.uber.org/multierr + +if [[ -d "$COVER" ]]; then + rm -rf "$COVER" +fi +mkdir -p "$COVER" + +i=0 +for pkg in "$@"; do + i=$((i + 1)) + + extracoverpkg="" + if [[ -f "$GOPATH/src/$pkg/.extra-coverpkg" ]]; then + extracoverpkg=$( \ + sed -e "s|^|$pkg/|g" < "$GOPATH/src/$pkg/.extra-coverpkg" \ + | tr '\n' ',') + fi + + coverpkg=$(go list -json "$pkg" | jq -r ' + .Deps + | . + ["'"$pkg"'"] + | map + ( select(startswith("'"$ROOT_PKG"'")) + | select(contains("/vendor/") | not) + ) + | join(",") + ') + if [[ -n "$extracoverpkg" ]]; then + coverpkg="$extracoverpkg$coverpkg" + fi + + go test \ + -coverprofile "$COVER/cover.${i}.out" -coverpkg "$coverpkg" \ + -v "$pkg" +done + +gocovmerge "$COVER"/*.out > cover.out diff --git a/vendor/go.uber.org/zap/.codecov.yml b/vendor/go.uber.org/zap/.codecov.yml new file mode 100644 index 000000000..8e5ca7d3e --- /dev/null +++ b/vendor/go.uber.org/zap/.codecov.yml @@ -0,0 +1,17 @@ +coverage: + range: 80..100 + round: down + precision: 2 + + status: + project: # measuring the overall project coverage + default: # context, you can create multiple ones with custom titles + enabled: yes # must be yes|true to enable this status + target: 95% # specify the target coverage for each commit status + # option: "auto" (must increase from parent commit or pull request base) + # option: "X%" a static target percentage to hit + if_not_found: success # if parent is not found report status as success, error, or failure + if_ci_failed: error # if ci fails report status as success, error, or failure +ignore: + - internal/readme/readme.go + diff --git a/vendor/go.uber.org/zap/.gitignore b/vendor/go.uber.org/zap/.gitignore new file mode 100644 index 000000000..08fbde6ce --- /dev/null +++ b/vendor/go.uber.org/zap/.gitignore @@ -0,0 +1,28 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test +vendor + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof +*.pprof +*.out +*.log diff --git a/vendor/go.uber.org/zap/.readme.tmpl b/vendor/go.uber.org/zap/.readme.tmpl new file mode 100644 index 000000000..c6440db8e --- /dev/null +++ b/vendor/go.uber.org/zap/.readme.tmpl @@ -0,0 +1,108 @@ +# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] + +Blazing fast, structured, leveled logging in Go. + +## Installation + +`go get -u go.uber.org/zap` + +Note that zap only supports the two most recent minor versions of Go. + +## Quick Start + +In contexts where performance is nice, but not critical, use the +`SugaredLogger`. It's 4-10x faster than other structured logging +packages and includes both structured and `printf`-style APIs. + +```go +logger, _ := zap.NewProduction() +defer logger.Sync() // flushes buffer, if any +sugar := logger.Sugar() +sugar.Infow("failed to fetch URL", + // Structured context as loosely typed key-value pairs. + "url", url, + "attempt", 3, + "backoff", time.Second, +) +sugar.Infof("Failed to fetch URL: %s", url) +``` + +When performance and type safety are critical, use the `Logger`. It's even +faster than the `SugaredLogger` and allocates far less, but it only supports +structured logging. + +```go +logger, _ := zap.NewProduction() +defer logger.Sync() +logger.Info("failed to fetch URL", + // Structured context as strongly typed Field values. + zap.String("url", url), + zap.Int("attempt", 3), + zap.Duration("backoff", time.Second), +) +``` + +See the [documentation][doc] and [FAQ](FAQ.md) for more details. + +## Performance + +For applications that log in the hot path, reflection-based serialization and +string formatting are prohibitively expensive — they're CPU-intensive +and make many small allocations. Put differently, using `encoding/json` and +`fmt.Fprintf` to log tons of `interface{}`s makes your application slow. + +Zap takes a different approach. It includes a reflection-free, zero-allocation +JSON encoder, and the base `Logger` strives to avoid serialization overhead +and allocations wherever possible. By building the high-level `SugaredLogger` +on that foundation, zap lets users *choose* when they need to count every +allocation and when they'd prefer a more familiar, loosely typed API. + +As measured by its own [benchmarking suite][], not only is zap more performant +than comparable structured logging packages — it's also faster than the +standard library. Like all benchmarks, take these with a grain of salt.[1](#footnote-versions) + +Log a message and 10 fields: + +{{.BenchmarkAddingFields}} + +Log a message with a logger that already has 10 fields of context: + +{{.BenchmarkAccumulatedContext}} + +Log a static string, without any context or `printf`-style templating: + +{{.BenchmarkWithoutFields}} + +## Development Status: Stable + +All APIs are finalized, and no breaking changes will be made in the 1.x series +of releases. Users of semver-aware dependency management systems should pin +zap to `^1`. + +## Contributing + +We encourage and support an active, healthy community of contributors — +including you! Details are in the [contribution guide](CONTRIBUTING.md) and +the [code of conduct](CODE_OF_CONDUCT.md). The zap maintainers keep an eye on +issues and pull requests, but you can also report any negative conduct to +oss-conduct@uber.com. That email list is a private, safe space; even the zap +maintainers don't have access, so don't hesitate to hold us to a high +standard. + +
+ +Released under the [MIT License](LICENSE.txt). + +1 In particular, keep in mind that we may be +benchmarking against slightly older versions of other packages. Versions are +pinned in zap's [glide.lock][] file. [↩](#anchor-versions) + +[doc-img]: https://godoc.org/go.uber.org/zap?status.svg +[doc]: https://godoc.org/go.uber.org/zap +[ci-img]: https://travis-ci.org/uber-go/zap.svg?branch=master +[ci]: https://travis-ci.org/uber-go/zap +[cov-img]: https://codecov.io/gh/uber-go/zap/branch/master/graph/badge.svg +[cov]: https://codecov.io/gh/uber-go/zap +[benchmarking suite]: https://github.com/uber-go/zap/tree/master/benchmarks +[glide.lock]: https://github.com/uber-go/zap/blob/master/glide.lock diff --git a/vendor/go.uber.org/zap/.travis.yml b/vendor/go.uber.org/zap/.travis.yml new file mode 100644 index 000000000..a3321fa2d --- /dev/null +++ b/vendor/go.uber.org/zap/.travis.yml @@ -0,0 +1,21 @@ +language: go +sudo: false +go: + - 1.9.x + - 1.10.x +go_import_path: go.uber.org/zap +env: + global: + - TEST_TIMEOUT_SCALE=10 +cache: + directories: + - vendor +install: + - make dependencies +script: + - make lint + - make test + - make bench +after_success: + - make cover + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/go.uber.org/zap/CHANGELOG.md b/vendor/go.uber.org/zap/CHANGELOG.md new file mode 100644 index 000000000..17d5b49f3 --- /dev/null +++ b/vendor/go.uber.org/zap/CHANGELOG.md @@ -0,0 +1,305 @@ +# Changelog + +## v1.9.1 (06 Aug 2018) + +Bugfixes: + +* [#614][]: MapObjectEncoder should not ignore empty slices. + +## v1.9.0 (19 Jul 2018) + +Enhancements: +* [#602][]: Reduce number of allocations when logging with reflection. +* [#572][], [#606][]: Expose a registry for third-party logging sinks. + +Thanks to @nfarah86, @AlekSi, @JeanMertz, @philippgille, @etsangsplk, and +@dimroc for their contributions to this release. + +## v1.8.0 (13 Apr 2018) + +Enhancements: +* [#508][]: Make log level configurable when redirecting the standard + library's logger. +* [#518][]: Add a logger that writes to a `*testing.TB`. +* [#577][]: Add a top-level alias for `zapcore.Field` to clean up GoDoc. + +Bugfixes: +* [#574][]: Add a missing import comment to `go.uber.org/zap/buffer`. + +Thanks to @DiSiqueira and @djui for their contributions to this release. + +## v1.7.1 (25 Sep 2017) + +Bugfixes: +* [#504][]: Store strings when using AddByteString with the map encoder. + +## v1.7.0 (21 Sep 2017) + +Enhancements: + +* [#487][]: Add `NewStdLogAt`, which extends `NewStdLog` by allowing the user + to specify the level of the logged messages. + +## v1.6.0 (30 Aug 2017) + +Enhancements: + +* [#491][]: Omit zap stack frames from stacktraces. +* [#490][]: Add a `ContextMap` method to observer logs for simpler + field validation in tests. + +## v1.5.0 (22 Jul 2017) + +Enhancements: + +* [#460][] and [#470][]: Support errors produced by `go.uber.org/multierr`. +* [#465][]: Support user-supplied encoders for logger names. + +Bugfixes: + +* [#477][]: Fix a bug that incorrectly truncated deep stacktraces. + +Thanks to @richard-tunein and @pavius for their contributions to this release. + +## v1.4.1 (08 Jun 2017) + +This release fixes two bugs. + +Bugfixes: + +* [#435][]: Support a variety of case conventions when unmarshaling levels. +* [#444][]: Fix a panic in the observer. + +## v1.4.0 (12 May 2017) + +This release adds a few small features and is fully backward-compatible. + +Enhancements: + +* [#424][]: Add a `LineEnding` field to `EncoderConfig`, allowing users to + override the Unix-style default. +* [#425][]: Preserve time zones when logging times. +* [#431][]: Make `zap.AtomicLevel` implement `fmt.Stringer`, which makes a + variety of operations a bit simpler. + +## v1.3.0 (25 Apr 2017) + +This release adds an enhancement to zap's testing helpers as well as the +ability to marshal an AtomicLevel. It is fully backward-compatible. + +Enhancements: + +* [#415][]: Add a substring-filtering helper to zap's observer. This is + particularly useful when testing the `SugaredLogger`. +* [#416][]: Make `AtomicLevel` implement `encoding.TextMarshaler`. + +## v1.2.0 (13 Apr 2017) + +This release adds a gRPC compatibility wrapper. It is fully backward-compatible. + +Enhancements: + +* [#402][]: Add a `zapgrpc` package that wraps zap's Logger and implements + `grpclog.Logger`. + +## v1.1.0 (31 Mar 2017) + +This release fixes two bugs and adds some enhancements to zap's testing helpers. +It is fully backward-compatible. + +Bugfixes: + +* [#385][]: Fix caller path trimming on Windows. +* [#396][]: Fix a panic when attempting to use non-existent directories with + zap's configuration struct. + +Enhancements: + +* [#386][]: Add filtering helpers to zaptest's observing logger. + +Thanks to @moitias for contributing to this release. + +## v1.0.0 (14 Mar 2017) + +This is zap's first stable release. All exported APIs are now final, and no +further breaking changes will be made in the 1.x release series. Anyone using a +semver-aware dependency manager should now pin to `^1`. + +Breaking changes: + +* [#366][]: Add byte-oriented APIs to encoders to log UTF-8 encoded text without + casting from `[]byte` to `string`. +* [#364][]: To support buffering outputs, add `Sync` methods to `zapcore.Core`, + `zap.Logger`, and `zap.SugaredLogger`. +* [#371][]: Rename the `testutils` package to `zaptest`, which is less likely to + clash with other testing helpers. + +Bugfixes: + +* [#362][]: Make the ISO8601 time formatters fixed-width, which is friendlier + for tab-separated console output. +* [#369][]: Remove the automatic locks in `zapcore.NewCore`, which allows zap to + work with concurrency-safe `WriteSyncer` implementations. +* [#347][]: Stop reporting errors when trying to `fsync` standard out on Linux + systems. +* [#373][]: Report the correct caller from zap's standard library + interoperability wrappers. + +Enhancements: + +* [#348][]: Add a registry allowing third-party encodings to work with zap's + built-in `Config`. +* [#327][]: Make the representation of logger callers configurable (like times, + levels, and durations). +* [#376][]: Allow third-party encoders to use their own buffer pools, which + removes the last performance advantage that zap's encoders have over plugins. +* [#346][]: Add `CombineWriteSyncers`, a convenience function to tee multiple + `WriteSyncer`s and lock the result. +* [#365][]: Make zap's stacktraces compatible with mid-stack inlining (coming in + Go 1.9). +* [#372][]: Export zap's observing logger as `zaptest/observer`. This makes it + easier for particularly punctilious users to unit test their application's + logging. + +Thanks to @suyash, @htrendev, @flisky, @Ulexus, and @skipor for their +contributions to this release. + +## v1.0.0-rc.3 (7 Mar 2017) + +This is the third release candidate for zap's stable release. There are no +breaking changes. + +Bugfixes: + +* [#339][]: Byte slices passed to `zap.Any` are now correctly treated as binary blobs + rather than `[]uint8`. + +Enhancements: + +* [#307][]: Users can opt into colored output for log levels. +* [#353][]: In addition to hijacking the output of the standard library's + package-global logging functions, users can now construct a zap-backed + `log.Logger` instance. +* [#311][]: Frames from common runtime functions and some of zap's internal + machinery are now omitted from stacktraces. + +Thanks to @ansel1 and @suyash for their contributions to this release. + +## v1.0.0-rc.2 (21 Feb 2017) + +This is the second release candidate for zap's stable release. It includes two +breaking changes. + +Breaking changes: + +* [#316][]: Zap's global loggers are now fully concurrency-safe + (previously, users had to ensure that `ReplaceGlobals` was called before the + loggers were in use). However, they must now be accessed via the `L()` and + `S()` functions. Users can update their projects with + + ``` + gofmt -r "zap.L -> zap.L()" -w . + gofmt -r "zap.S -> zap.S()" -w . + ``` +* [#309][] and [#317][]: RC1 was mistakenly shipped with invalid + JSON and YAML struct tags on all config structs. This release fixes the tags + and adds static analysis to prevent similar bugs in the future. + +Bugfixes: + +* [#321][]: Redirecting the standard library's `log` output now + correctly reports the logger's caller. + +Enhancements: + +* [#325][] and [#333][]: Zap now transparently supports non-standard, rich + errors like those produced by `github.com/pkg/errors`. +* [#326][]: Though `New(nil)` continues to return a no-op logger, `NewNop()` is + now preferred. Users can update their projects with `gofmt -r 'zap.New(nil) -> + zap.NewNop()' -w .`. +* [#300][]: Incorrectly importing zap as `github.com/uber-go/zap` now returns a + more informative error. + +Thanks to @skipor and @chapsuk for their contributions to this release. + +## v1.0.0-rc.1 (14 Feb 2017) + +This is the first release candidate for zap's stable release. There are multiple +breaking changes and improvements from the pre-release version. Most notably: + +* **Zap's import path is now "go.uber.org/zap"** — all users will + need to update their code. +* User-facing types and functions remain in the `zap` package. Code relevant + largely to extension authors is now in the `zapcore` package. +* The `zapcore.Core` type makes it easy for third-party packages to use zap's + internals but provide a different user-facing API. +* `Logger` is now a concrete type instead of an interface. +* A less verbose (though slower) logging API is included by default. +* Package-global loggers `L` and `S` are included. +* A human-friendly console encoder is included. +* A declarative config struct allows common logger configurations to be managed + as configuration instead of code. +* Sampling is more accurate, and doesn't depend on the standard library's shared + timer heap. + +## v0.1.0-beta.1 (6 Feb 2017) + +This is a minor version, tagged to allow users to pin to the pre-1.0 APIs and +upgrade at their leisure. Since this is the first tagged release, there are no +backward compatibility concerns and all functionality is new. + +Early zap adopters should pin to the 0.1.x minor version until they're ready to +upgrade to the upcoming stable release. + +[#316]: https://github.com/uber-go/zap/pull/316 +[#309]: https://github.com/uber-go/zap/pull/309 +[#317]: https://github.com/uber-go/zap/pull/317 +[#321]: https://github.com/uber-go/zap/pull/321 +[#325]: https://github.com/uber-go/zap/pull/325 +[#333]: https://github.com/uber-go/zap/pull/333 +[#326]: https://github.com/uber-go/zap/pull/326 +[#300]: https://github.com/uber-go/zap/pull/300 +[#339]: https://github.com/uber-go/zap/pull/339 +[#307]: https://github.com/uber-go/zap/pull/307 +[#353]: https://github.com/uber-go/zap/pull/353 +[#311]: https://github.com/uber-go/zap/pull/311 +[#366]: https://github.com/uber-go/zap/pull/366 +[#364]: https://github.com/uber-go/zap/pull/364 +[#371]: https://github.com/uber-go/zap/pull/371 +[#362]: https://github.com/uber-go/zap/pull/362 +[#369]: https://github.com/uber-go/zap/pull/369 +[#347]: https://github.com/uber-go/zap/pull/347 +[#373]: https://github.com/uber-go/zap/pull/373 +[#348]: https://github.com/uber-go/zap/pull/348 +[#327]: https://github.com/uber-go/zap/pull/327 +[#376]: https://github.com/uber-go/zap/pull/376 +[#346]: https://github.com/uber-go/zap/pull/346 +[#365]: https://github.com/uber-go/zap/pull/365 +[#372]: https://github.com/uber-go/zap/pull/372 +[#385]: https://github.com/uber-go/zap/pull/385 +[#396]: https://github.com/uber-go/zap/pull/396 +[#386]: https://github.com/uber-go/zap/pull/386 +[#402]: https://github.com/uber-go/zap/pull/402 +[#415]: https://github.com/uber-go/zap/pull/415 +[#416]: https://github.com/uber-go/zap/pull/416 +[#424]: https://github.com/uber-go/zap/pull/424 +[#425]: https://github.com/uber-go/zap/pull/425 +[#431]: https://github.com/uber-go/zap/pull/431 +[#435]: https://github.com/uber-go/zap/pull/435 +[#444]: https://github.com/uber-go/zap/pull/444 +[#477]: https://github.com/uber-go/zap/pull/477 +[#465]: https://github.com/uber-go/zap/pull/465 +[#460]: https://github.com/uber-go/zap/pull/460 +[#470]: https://github.com/uber-go/zap/pull/470 +[#487]: https://github.com/uber-go/zap/pull/487 +[#490]: https://github.com/uber-go/zap/pull/490 +[#491]: https://github.com/uber-go/zap/pull/491 +[#504]: https://github.com/uber-go/zap/pull/504 +[#508]: https://github.com/uber-go/zap/pull/508 +[#518]: https://github.com/uber-go/zap/pull/518 +[#577]: https://github.com/uber-go/zap/pull/577 +[#574]: https://github.com/uber-go/zap/pull/574 +[#602]: https://github.com/uber-go/zap/pull/602 +[#572]: https://github.com/uber-go/zap/pull/572 +[#606]: https://github.com/uber-go/zap/pull/606 +[#614]: https://github.com/uber-go/zap/pull/614 diff --git a/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md b/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..e327d9aa5 --- /dev/null +++ b/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md @@ -0,0 +1,75 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, +body size, disability, ethnicity, gender identity and expression, level of +experience, nationality, personal appearance, race, religion, or sexual +identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +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, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an +appointed representative at an online or offline event. Representation of a +project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at oss-conduct@uber.com. The project +team will review and investigate all complaints, and will respond in a way +that it deems appropriate to the circumstances. The project team is obligated +to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.4, available at +[http://contributor-covenant.org/version/1/4][version]. + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/go.uber.org/zap/CONTRIBUTING.md b/vendor/go.uber.org/zap/CONTRIBUTING.md new file mode 100644 index 000000000..9454bbaf0 --- /dev/null +++ b/vendor/go.uber.org/zap/CONTRIBUTING.md @@ -0,0 +1,81 @@ +# Contributing + +We'd love your help making zap the very best structured logging library in Go! + +If you'd like to add new exported APIs, please [open an issue][open-issue] +describing your proposal — discussing API changes ahead of time makes +pull request review much smoother. In your issue, pull request, and any other +communications, please remember to treat your fellow contributors with +respect! We take our [code of conduct](CODE_OF_CONDUCT.md) seriously. + +Note that you'll need to sign [Uber's Contributor License Agreement][cla] +before we can accept any of your contributions. If necessary, a bot will remind +you to accept the CLA when you open your pull request. + +## Setup + +[Fork][fork], then clone the repository: + +``` +mkdir -p $GOPATH/src/go.uber.org +cd $GOPATH/src/go.uber.org +git clone git@github.com:your_github_username/zap.git +cd zap +git remote add upstream https://github.com/uber-go/zap.git +git fetch upstream +``` + +Install zap's dependencies: + +``` +make dependencies +``` + +Make sure that the tests and the linters pass: + +``` +make test +make lint +``` + +If you're not using the minor version of Go specified in the Makefile's +`LINTABLE_MINOR_VERSIONS` variable, `make lint` doesn't do anything. This is +fine, but it means that you'll only discover lint failures after you open your +pull request. + +## Making Changes + +Start by creating a new branch for your changes: + +``` +cd $GOPATH/src/go.uber.org/zap +git checkout master +git fetch upstream +git rebase upstream/master +git checkout -b cool_new_feature +``` + +Make your changes, then ensure that `make lint` and `make test` still pass. If +you're satisfied with your changes, push them to your fork. + +``` +git push origin cool_new_feature +``` + +Then use the GitHub UI to open a pull request. + +At this point, you're waiting on us to review your changes. We *try* to respond +to issues and pull requests within a few business days, and we may suggest some +improvements or alternatives. Once your changes are approved, one of the +project maintainers will merge them. + +We're much more likely to approve your changes if you: + +* Add tests for new functionality. +* Write a [good commit message][commit-message]. +* Maintain backward compatibility. + +[fork]: https://github.com/uber-go/zap/fork +[open-issue]: https://github.com/uber-go/zap/issues/new +[cla]: https://cla-assistant.io/uber-go/zap +[commit-message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html diff --git a/vendor/go.uber.org/zap/FAQ.md b/vendor/go.uber.org/zap/FAQ.md new file mode 100644 index 000000000..4256d35c7 --- /dev/null +++ b/vendor/go.uber.org/zap/FAQ.md @@ -0,0 +1,155 @@ +# Frequently Asked Questions + +## Design + +### Why spend so much effort on logger performance? + +Of course, most applications won't notice the impact of a slow logger: they +already take tens or hundreds of milliseconds for each operation, so an extra +millisecond doesn't matter. + +On the other hand, why *not* make structured logging fast? The `SugaredLogger` +isn't any harder to use than other logging packages, and the `Logger` makes +structured logging possible in performance-sensitive contexts. Across a fleet +of Go microservices, making each application even slightly more efficient adds +up quickly. + +### Why aren't `Logger` and `SugaredLogger` interfaces? + +Unlike the familiar `io.Writer` and `http.Handler`, `Logger` and +`SugaredLogger` interfaces would include *many* methods. As [Rob Pike points +out][go-proverbs], "The bigger the interface, the weaker the abstraction." +Interfaces are also rigid — *any* change requires releasing a new major +version, since it breaks all third-party implementations. + +Making the `Logger` and `SugaredLogger` concrete types doesn't sacrifice much +abstraction, and it lets us add methods without introducing breaking changes. +Your applications should define and depend upon an interface that includes +just the methods you use. + +### Why sample application logs? + +Applications often experience runs of errors, either because of a bug or +because of a misbehaving user. Logging errors is usually a good idea, but it +can easily make this bad situation worse: not only is your application coping +with a flood of errors, it's also spending extra CPU cycles and I/O logging +those errors. Since writes are typically serialized, logging limits throughput +when you need it most. + +Sampling fixes this problem by dropping repetitive log entries. Under normal +conditions, your application writes out every entry. When similar entries are +logged hundreds or thousands of times each second, though, zap begins dropping +duplicates to preserve throughput. + +### Why do the structured logging APIs take a message in addition to fields? + +Subjectively, we find it helpful to accompany structured context with a brief +description. This isn't critical during development, but it makes debugging +and operating unfamiliar systems much easier. + +More concretely, zap's sampling algorithm uses the message to identify +duplicate entries. In our experience, this is a practical middle ground +between random sampling (which often drops the exact entry that you need while +debugging) and hashing the complete entry (which is prohibitively expensive). + +### Why include package-global loggers? + +Since so many other logging packages include a global logger, many +applications aren't designed to accept loggers as explicit parameters. +Changing function signatures is often a breaking change, so zap includes +global loggers to simplify migration. + +Avoid them where possible. + +### Why include dedicated Panic and Fatal log levels? + +In general, application code should handle errors gracefully instead of using +`panic` or `os.Exit`. However, every rule has exceptions, and it's common to +crash when an error is truly unrecoverable. To avoid losing any information +— especially the reason for the crash — the logger must flush any +buffered entries before the process exits. + +Zap makes this easy by offering `Panic` and `Fatal` logging methods that +automatically flush before exiting. Of course, this doesn't guarantee that +logs will never be lost, but it eliminates a common error. + +See the discussion in uber-go/zap#207 for more details. + +### What's `DPanic`? + +`DPanic` stands for "panic in development." In development, it logs at +`PanicLevel`; otherwise, it logs at `ErrorLevel`. `DPanic` makes it easier to +catch errors that are theoretically possible, but shouldn't actually happen, +*without* crashing in production. + +If you've ever written code like this, you need `DPanic`: + +```go +if err != nil { + panic(fmt.Sprintf("shouldn't ever get here: %v", err)) +} +``` + +## Installation + +### What does the error `expects import "go.uber.org/zap"` mean? + +Either zap was installed incorrectly or you're referencing the wrong package +name in your code. + +Zap's source code happens to be hosted on GitHub, but the [import +path][import-path] is `go.uber.org/zap`. This gives us, the project +maintainers, the freedom to move the source code if necessary. However, it +means that you need to take a little care when installing and using the +package. + +If you follow two simple rules, everything should work: install zap with `go +get -u go.uber.org/zap`, and always import it in your code with `import +"go.uber.org/zap"`. Your code shouldn't contain *any* references to +`github.com/uber-go/zap`. + +## Usage + +### Does zap support log rotation? + +Zap doesn't natively support rotating log files, since we prefer to leave this +to an external program like `logrotate`. + +However, it's easy to integrate a log rotation package like +[`gopkg.in/natefinch/lumberjack.v2`][lumberjack] as a `zapcore.WriteSyncer`. + +```go +// lumberjack.Logger is already safe for concurrent use, so we don't need to +// lock it. +w := zapcore.AddSync(&lumberjack.Logger{ + Filename: "/var/log/myapp/foo.log", + MaxSize: 500, // megabytes + MaxBackups: 3, + MaxAge: 28, // days +}) +core := zapcore.NewCore( + zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()), + w, + zap.InfoLevel, +) +logger := zap.New(core) +``` + +## Extensions + +We'd love to support every logging need within zap itself, but we're only +familiar with a handful of log ingestion systems, flag-parsing packages, and +the like. Rather than merging code that we can't effectively debug and +support, we'd rather grow an ecosystem of zap extensions. + +We're aware of the following extensions, but haven't used them ourselves: + +| Package | Integration | +| --- | --- | +| `github.com/tchap/zapext` | Sentry, syslog | +| `github.com/fgrosse/zaptest` | Ginkgo | +| `github.com/blendle/zapdriver` | Stackdriver | + +[go-proverbs]: https://go-proverbs.github.io/ +[import-path]: https://golang.org/cmd/go/#hdr-Remote_import_paths +[lumberjack]: https://godoc.org/gopkg.in/natefinch/lumberjack.v2 diff --git a/vendor/go.uber.org/zap/LICENSE.txt b/vendor/go.uber.org/zap/LICENSE.txt new file mode 100644 index 000000000..6652bed45 --- /dev/null +++ b/vendor/go.uber.org/zap/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2016-2017 Uber Technologies, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/go.uber.org/zap/Makefile b/vendor/go.uber.org/zap/Makefile new file mode 100644 index 000000000..ef7893b3b --- /dev/null +++ b/vendor/go.uber.org/zap/Makefile @@ -0,0 +1,76 @@ +export GO15VENDOREXPERIMENT=1 + +BENCH_FLAGS ?= -cpuprofile=cpu.pprof -memprofile=mem.pprof -benchmem +PKGS ?= $(shell glide novendor) +# Many Go tools take file globs or directories as arguments instead of packages. +PKG_FILES ?= *.go zapcore benchmarks buffer zapgrpc zaptest zaptest/observer internal/bufferpool internal/exit internal/color internal/ztest + +# The linting tools evolve with each Go version, so run them only on the latest +# stable release. +GO_VERSION := $(shell go version | cut -d " " -f 3) +GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION))) +LINTABLE_MINOR_VERSIONS := 10 +ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),) +SHOULD_LINT := true +endif + + +.PHONY: all +all: lint test + +.PHONY: dependencies +dependencies: + @echo "Installing Glide and locked dependencies..." + glide --version || go get -u -f github.com/Masterminds/glide + glide install + @echo "Installing test dependencies..." + go install ./vendor/github.com/axw/gocov/gocov + go install ./vendor/github.com/mattn/goveralls +ifdef SHOULD_LINT + @echo "Installing golint..." + go install ./vendor/github.com/golang/lint/golint +else + @echo "Not installing golint, since we don't expect to lint on" $(GO_VERSION) +endif + +# Disable printf-like invocation checking due to testify.assert.Error() +VET_RULES := -printf=false + +.PHONY: lint +lint: +ifdef SHOULD_LINT + @rm -rf lint.log + @echo "Checking formatting..." + @gofmt -d -s $(PKG_FILES) 2>&1 | tee lint.log + @echo "Installing test dependencies for vet..." + @go test -i $(PKGS) + @echo "Checking vet..." + @$(foreach dir,$(PKG_FILES),go tool vet $(VET_RULES) $(dir) 2>&1 | tee -a lint.log;) + @echo "Checking lint..." + @$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;) + @echo "Checking for unresolved FIXMEs..." + @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log + @echo "Checking for license headers..." + @./check_license.sh | tee -a lint.log + @[ ! -s lint.log ] +else + @echo "Skipping linters on" $(GO_VERSION) +endif + +.PHONY: test +test: + go test -race $(PKGS) + +.PHONY: cover +cover: + ./scripts/cover.sh $(PKGS) + +.PHONY: bench +BENCH ?= . +bench: + @$(foreach pkg,$(PKGS),go test -bench=$(BENCH) -run="^$$" $(BENCH_FLAGS) $(pkg);) + +.PHONY: updatereadme +updatereadme: + rm -f README.md + cat .readme.tmpl | go run internal/readme/readme.go > README.md diff --git a/vendor/go.uber.org/zap/README.md b/vendor/go.uber.org/zap/README.md new file mode 100644 index 000000000..f4fd1cb44 --- /dev/null +++ b/vendor/go.uber.org/zap/README.md @@ -0,0 +1,136 @@ +# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] + +Blazing fast, structured, leveled logging in Go. + +## Installation + +`go get -u go.uber.org/zap` + +Note that zap only supports the two most recent minor versions of Go. + +## Quick Start + +In contexts where performance is nice, but not critical, use the +`SugaredLogger`. It's 4-10x faster than other structured logging +packages and includes both structured and `printf`-style APIs. + +```go +logger, _ := zap.NewProduction() +defer logger.Sync() // flushes buffer, if any +sugar := logger.Sugar() +sugar.Infow("failed to fetch URL", + // Structured context as loosely typed key-value pairs. + "url", url, + "attempt", 3, + "backoff", time.Second, +) +sugar.Infof("Failed to fetch URL: %s", url) +``` + +When performance and type safety are critical, use the `Logger`. It's even +faster than the `SugaredLogger` and allocates far less, but it only supports +structured logging. + +```go +logger, _ := zap.NewProduction() +defer logger.Sync() +logger.Info("failed to fetch URL", + // Structured context as strongly typed Field values. + zap.String("url", url), + zap.Int("attempt", 3), + zap.Duration("backoff", time.Second), +) +``` + +See the [documentation][doc] and [FAQ](FAQ.md) for more details. + +## Performance + +For applications that log in the hot path, reflection-based serialization and +string formatting are prohibitively expensive — they're CPU-intensive +and make many small allocations. Put differently, using `encoding/json` and +`fmt.Fprintf` to log tons of `interface{}`s makes your application slow. + +Zap takes a different approach. It includes a reflection-free, zero-allocation +JSON encoder, and the base `Logger` strives to avoid serialization overhead +and allocations wherever possible. By building the high-level `SugaredLogger` +on that foundation, zap lets users *choose* when they need to count every +allocation and when they'd prefer a more familiar, loosely typed API. + +As measured by its own [benchmarking suite][], not only is zap more performant +than comparable structured logging packages — it's also faster than the +standard library. Like all benchmarks, take these with a grain of salt.[1](#footnote-versions) + +Log a message and 10 fields: + +| Package | Time | Objects Allocated | +| :--- | :---: | :---: | +| :zap: zap | 3131 ns/op | 5 allocs/op | +| :zap: zap (sugared) | 4173 ns/op | 21 allocs/op | +| zerolog | 16154 ns/op | 90 allocs/op | +| lion | 16341 ns/op | 111 allocs/op | +| go-kit | 17049 ns/op | 126 allocs/op | +| logrus | 23662 ns/op | 142 allocs/op | +| log15 | 36351 ns/op | 149 allocs/op | +| apex/log | 42530 ns/op | 126 allocs/op | + +Log a message with a logger that already has 10 fields of context: + +| Package | Time | Objects Allocated | +| :--- | :---: | :---: | +| :zap: zap | 380 ns/op | 0 allocs/op | +| :zap: zap (sugared) | 564 ns/op | 2 allocs/op | +| zerolog | 321 ns/op | 0 allocs/op | +| lion | 7092 ns/op | 39 allocs/op | +| go-kit | 20226 ns/op | 115 allocs/op | +| logrus | 22312 ns/op | 130 allocs/op | +| log15 | 28788 ns/op | 79 allocs/op | +| apex/log | 42063 ns/op | 115 allocs/op | + +Log a static string, without any context or `printf`-style templating: + +| Package | Time | Objects Allocated | +| :--- | :---: | :---: | +| :zap: zap | 361 ns/op | 0 allocs/op | +| :zap: zap (sugared) | 534 ns/op | 2 allocs/op | +| zerolog | 323 ns/op | 0 allocs/op | +| standard library | 575 ns/op | 2 allocs/op | +| go-kit | 922 ns/op | 13 allocs/op | +| lion | 1413 ns/op | 10 allocs/op | +| logrus | 2291 ns/op | 27 allocs/op | +| apex/log | 3690 ns/op | 11 allocs/op | +| log15 | 5954 ns/op | 26 allocs/op | + +## Development Status: Stable + +All APIs are finalized, and no breaking changes will be made in the 1.x series +of releases. Users of semver-aware dependency management systems should pin +zap to `^1`. + +## Contributing + +We encourage and support an active, healthy community of contributors — +including you! Details are in the [contribution guide](CONTRIBUTING.md) and +the [code of conduct](CODE_OF_CONDUCT.md). The zap maintainers keep an eye on +issues and pull requests, but you can also report any negative conduct to +oss-conduct@uber.com. That email list is a private, safe space; even the zap +maintainers don't have access, so don't hesitate to hold us to a high +standard. + +
+ +Released under the [MIT License](LICENSE.txt). + +1 In particular, keep in mind that we may be +benchmarking against slightly older versions of other packages. Versions are +pinned in zap's [glide.lock][] file. [↩](#anchor-versions) + +[doc-img]: https://godoc.org/go.uber.org/zap?status.svg +[doc]: https://godoc.org/go.uber.org/zap +[ci-img]: https://travis-ci.org/uber-go/zap.svg?branch=master +[ci]: https://travis-ci.org/uber-go/zap +[cov-img]: https://codecov.io/gh/uber-go/zap/branch/master/graph/badge.svg +[cov]: https://codecov.io/gh/uber-go/zap +[benchmarking suite]: https://github.com/uber-go/zap/tree/master/benchmarks +[glide.lock]: https://github.com/uber-go/zap/blob/master/glide.lock diff --git a/vendor/go.uber.org/zap/array.go b/vendor/go.uber.org/zap/array.go new file mode 100644 index 000000000..5be3704a3 --- /dev/null +++ b/vendor/go.uber.org/zap/array.go @@ -0,0 +1,320 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "time" + + "go.uber.org/zap/zapcore" +) + +// Array constructs a field with the given key and ArrayMarshaler. It provides +// a flexible, but still type-safe and efficient, way to add array-like types +// to the logging context. The struct's MarshalLogArray method is called lazily. +func Array(key string, val zapcore.ArrayMarshaler) Field { + return Field{Key: key, Type: zapcore.ArrayMarshalerType, Interface: val} +} + +// Bools constructs a field that carries a slice of bools. +func Bools(key string, bs []bool) Field { + return Array(key, bools(bs)) +} + +// ByteStrings constructs a field that carries a slice of []byte, each of which +// must be UTF-8 encoded text. +func ByteStrings(key string, bss [][]byte) Field { + return Array(key, byteStringsArray(bss)) +} + +// Complex128s constructs a field that carries a slice of complex numbers. +func Complex128s(key string, nums []complex128) Field { + return Array(key, complex128s(nums)) +} + +// Complex64s constructs a field that carries a slice of complex numbers. +func Complex64s(key string, nums []complex64) Field { + return Array(key, complex64s(nums)) +} + +// Durations constructs a field that carries a slice of time.Durations. +func Durations(key string, ds []time.Duration) Field { + return Array(key, durations(ds)) +} + +// Float64s constructs a field that carries a slice of floats. +func Float64s(key string, nums []float64) Field { + return Array(key, float64s(nums)) +} + +// Float32s constructs a field that carries a slice of floats. +func Float32s(key string, nums []float32) Field { + return Array(key, float32s(nums)) +} + +// Ints constructs a field that carries a slice of integers. +func Ints(key string, nums []int) Field { + return Array(key, ints(nums)) +} + +// Int64s constructs a field that carries a slice of integers. +func Int64s(key string, nums []int64) Field { + return Array(key, int64s(nums)) +} + +// Int32s constructs a field that carries a slice of integers. +func Int32s(key string, nums []int32) Field { + return Array(key, int32s(nums)) +} + +// Int16s constructs a field that carries a slice of integers. +func Int16s(key string, nums []int16) Field { + return Array(key, int16s(nums)) +} + +// Int8s constructs a field that carries a slice of integers. +func Int8s(key string, nums []int8) Field { + return Array(key, int8s(nums)) +} + +// Strings constructs a field that carries a slice of strings. +func Strings(key string, ss []string) Field { + return Array(key, stringArray(ss)) +} + +// Times constructs a field that carries a slice of time.Times. +func Times(key string, ts []time.Time) Field { + return Array(key, times(ts)) +} + +// Uints constructs a field that carries a slice of unsigned integers. +func Uints(key string, nums []uint) Field { + return Array(key, uints(nums)) +} + +// Uint64s constructs a field that carries a slice of unsigned integers. +func Uint64s(key string, nums []uint64) Field { + return Array(key, uint64s(nums)) +} + +// Uint32s constructs a field that carries a slice of unsigned integers. +func Uint32s(key string, nums []uint32) Field { + return Array(key, uint32s(nums)) +} + +// Uint16s constructs a field that carries a slice of unsigned integers. +func Uint16s(key string, nums []uint16) Field { + return Array(key, uint16s(nums)) +} + +// Uint8s constructs a field that carries a slice of unsigned integers. +func Uint8s(key string, nums []uint8) Field { + return Array(key, uint8s(nums)) +} + +// Uintptrs constructs a field that carries a slice of pointer addresses. +func Uintptrs(key string, us []uintptr) Field { + return Array(key, uintptrs(us)) +} + +// Errors constructs a field that carries a slice of errors. +func Errors(key string, errs []error) Field { + return Array(key, errArray(errs)) +} + +type bools []bool + +func (bs bools) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range bs { + arr.AppendBool(bs[i]) + } + return nil +} + +type byteStringsArray [][]byte + +func (bss byteStringsArray) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range bss { + arr.AppendByteString(bss[i]) + } + return nil +} + +type complex128s []complex128 + +func (nums complex128s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendComplex128(nums[i]) + } + return nil +} + +type complex64s []complex64 + +func (nums complex64s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendComplex64(nums[i]) + } + return nil +} + +type durations []time.Duration + +func (ds durations) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range ds { + arr.AppendDuration(ds[i]) + } + return nil +} + +type float64s []float64 + +func (nums float64s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendFloat64(nums[i]) + } + return nil +} + +type float32s []float32 + +func (nums float32s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendFloat32(nums[i]) + } + return nil +} + +type ints []int + +func (nums ints) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendInt(nums[i]) + } + return nil +} + +type int64s []int64 + +func (nums int64s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendInt64(nums[i]) + } + return nil +} + +type int32s []int32 + +func (nums int32s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendInt32(nums[i]) + } + return nil +} + +type int16s []int16 + +func (nums int16s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendInt16(nums[i]) + } + return nil +} + +type int8s []int8 + +func (nums int8s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendInt8(nums[i]) + } + return nil +} + +type stringArray []string + +func (ss stringArray) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range ss { + arr.AppendString(ss[i]) + } + return nil +} + +type times []time.Time + +func (ts times) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range ts { + arr.AppendTime(ts[i]) + } + return nil +} + +type uints []uint + +func (nums uints) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendUint(nums[i]) + } + return nil +} + +type uint64s []uint64 + +func (nums uint64s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendUint64(nums[i]) + } + return nil +} + +type uint32s []uint32 + +func (nums uint32s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendUint32(nums[i]) + } + return nil +} + +type uint16s []uint16 + +func (nums uint16s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendUint16(nums[i]) + } + return nil +} + +type uint8s []uint8 + +func (nums uint8s) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendUint8(nums[i]) + } + return nil +} + +type uintptrs []uintptr + +func (nums uintptrs) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range nums { + arr.AppendUintptr(nums[i]) + } + return nil +} diff --git a/vendor/go.uber.org/zap/array_test.go b/vendor/go.uber.org/zap/array_test.go new file mode 100644 index 000000000..4f709f09c --- /dev/null +++ b/vendor/go.uber.org/zap/array_test.go @@ -0,0 +1,107 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "testing" + "time" + + "go.uber.org/zap/zapcore" + + "github.com/stretchr/testify/assert" +) + +func BenchmarkBoolsArrayMarshaler(b *testing.B) { + // Keep this benchmark here to capture the overhead of the ArrayMarshaler + // wrapper. + bs := make([]bool, 50) + enc := zapcore.NewJSONEncoder(zapcore.EncoderConfig{}) + b.ResetTimer() + for i := 0; i < b.N; i++ { + Bools("array", bs).AddTo(enc.Clone()) + } +} + +func BenchmarkBoolsReflect(b *testing.B) { + bs := make([]bool, 50) + enc := zapcore.NewJSONEncoder(zapcore.EncoderConfig{}) + b.ResetTimer() + for i := 0; i < b.N; i++ { + Reflect("array", bs).AddTo(enc.Clone()) + } +} + +func TestArrayWrappers(t *testing.T) { + tests := []struct { + desc string + field Field + expected []interface{} + }{ + {"empty bools", Bools("", []bool{}), []interface{}{}}, + {"empty byte strings", ByteStrings("", [][]byte{}), []interface{}{}}, + {"empty complex128s", Complex128s("", []complex128{}), []interface{}{}}, + {"empty complex64s", Complex64s("", []complex64{}), []interface{}{}}, + {"empty durations", Durations("", []time.Duration{}), []interface{}{}}, + {"empty float64s", Float64s("", []float64{}), []interface{}{}}, + {"empty float32s", Float32s("", []float32{}), []interface{}{}}, + {"empty ints", Ints("", []int{}), []interface{}{}}, + {"empty int64s", Int64s("", []int64{}), []interface{}{}}, + {"empty int32s", Int32s("", []int32{}), []interface{}{}}, + {"empty int16s", Int16s("", []int16{}), []interface{}{}}, + {"empty int8s", Int8s("", []int8{}), []interface{}{}}, + {"empty strings", Strings("", []string{}), []interface{}{}}, + {"empty times", Times("", []time.Time{}), []interface{}{}}, + {"empty uints", Uints("", []uint{}), []interface{}{}}, + {"empty uint64s", Uint64s("", []uint64{}), []interface{}{}}, + {"empty uint32s", Uint32s("", []uint32{}), []interface{}{}}, + {"empty uint16s", Uint16s("", []uint16{}), []interface{}{}}, + {"empty uint8s", Uint8s("", []uint8{}), []interface{}{}}, + {"empty uintptrs", Uintptrs("", []uintptr{}), []interface{}{}}, + {"bools", Bools("", []bool{true, false}), []interface{}{true, false}}, + {"byte strings", ByteStrings("", [][]byte{{1, 2}, {3, 4}}), []interface{}{[]byte{1, 2}, []byte{3, 4}}}, + {"complex128s", Complex128s("", []complex128{1 + 2i, 3 + 4i}), []interface{}{1 + 2i, 3 + 4i}}, + {"complex64s", Complex64s("", []complex64{1 + 2i, 3 + 4i}), []interface{}{complex64(1 + 2i), complex64(3 + 4i)}}, + {"durations", Durations("", []time.Duration{1, 2}), []interface{}{time.Nanosecond, 2 * time.Nanosecond}}, + {"float64s", Float64s("", []float64{1.2, 3.4}), []interface{}{1.2, 3.4}}, + {"float32s", Float32s("", []float32{1.2, 3.4}), []interface{}{float32(1.2), float32(3.4)}}, + {"ints", Ints("", []int{1, 2}), []interface{}{1, 2}}, + {"int64s", Int64s("", []int64{1, 2}), []interface{}{int64(1), int64(2)}}, + {"int32s", Int32s("", []int32{1, 2}), []interface{}{int32(1), int32(2)}}, + {"int16s", Int16s("", []int16{1, 2}), []interface{}{int16(1), int16(2)}}, + {"int8s", Int8s("", []int8{1, 2}), []interface{}{int8(1), int8(2)}}, + {"strings", Strings("", []string{"foo", "bar"}), []interface{}{"foo", "bar"}}, + {"times", Times("", []time.Time{time.Unix(0, 0), time.Unix(0, 0)}), []interface{}{time.Unix(0, 0), time.Unix(0, 0)}}, + {"uints", Uints("", []uint{1, 2}), []interface{}{uint(1), uint(2)}}, + {"uint64s", Uint64s("", []uint64{1, 2}), []interface{}{uint64(1), uint64(2)}}, + {"uint32s", Uint32s("", []uint32{1, 2}), []interface{}{uint32(1), uint32(2)}}, + {"uint16s", Uint16s("", []uint16{1, 2}), []interface{}{uint16(1), uint16(2)}}, + {"uint8s", Uint8s("", []uint8{1, 2}), []interface{}{uint8(1), uint8(2)}}, + {"uintptrs", Uintptrs("", []uintptr{1, 2}), []interface{}{uintptr(1), uintptr(2)}}, + } + + for _, tt := range tests { + enc := zapcore.NewMapObjectEncoder() + tt.field.Key = "k" + tt.field.AddTo(enc) + assert.Equal(t, tt.expected, enc.Fields["k"], "%s: unexpected map contents.", tt.desc) + assert.Equal(t, 1, len(enc.Fields), "%s: found extra keys in map: %v", tt.desc, enc.Fields) + } +} diff --git a/vendor/go.uber.org/zap/benchmarks/apex_test.go b/vendor/go.uber.org/zap/benchmarks/apex_test.go new file mode 100644 index 000000000..67d764635 --- /dev/null +++ b/vendor/go.uber.org/zap/benchmarks/apex_test.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package benchmarks + +import ( + "io/ioutil" + + "github.com/apex/log" + "github.com/apex/log/handlers/json" +) + +func newDisabledApexLog() *log.Logger { + return &log.Logger{ + Handler: json.New(ioutil.Discard), + Level: log.ErrorLevel, + } +} + +func newApexLog() *log.Logger { + return &log.Logger{ + Handler: json.New(ioutil.Discard), + Level: log.DebugLevel, + } +} + +func fakeApexFields() log.Fields { + return log.Fields{ + "int": _tenInts[0], + "ints": _tenInts, + "string": _tenStrings[0], + "strings": _tenStrings, + "time": _tenTimes[0], + "times": _tenTimes, + "user1": _oneUser, + "user2": _oneUser, + "users": _tenUsers, + "error": errExample, + } +} diff --git a/vendor/go.uber.org/zap/benchmarks/doc.go b/vendor/go.uber.org/zap/benchmarks/doc.go new file mode 100644 index 000000000..b79f79f0b --- /dev/null +++ b/vendor/go.uber.org/zap/benchmarks/doc.go @@ -0,0 +1,23 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package benchmarks contains only benchmarks comparing zap to other +// structured logging libraries. +package benchmarks diff --git a/vendor/go.uber.org/zap/benchmarks/kit_test.go b/vendor/go.uber.org/zap/benchmarks/kit_test.go new file mode 100644 index 000000000..b9da29332 --- /dev/null +++ b/vendor/go.uber.org/zap/benchmarks/kit_test.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package benchmarks + +import ( + "io/ioutil" + + "github.com/go-kit/kit/log" +) + +func newKitLog(fields ...interface{}) log.Logger { + return log.With(log.NewJSONLogger(ioutil.Discard), fields...) +} diff --git a/vendor/go.uber.org/zap/benchmarks/lion_test.go b/vendor/go.uber.org/zap/benchmarks/lion_test.go new file mode 100644 index 000000000..6c41cb110 --- /dev/null +++ b/vendor/go.uber.org/zap/benchmarks/lion_test.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package benchmarks + +import ( + "io/ioutil" + + "go.pedge.io/lion" +) + +func newLion() lion.Logger { + return lion.NewLogger(lion.NewJSONWritePusher(ioutil.Discard)) +} diff --git a/vendor/go.uber.org/zap/benchmarks/log15_test.go b/vendor/go.uber.org/zap/benchmarks/log15_test.go new file mode 100644 index 000000000..70a60b354 --- /dev/null +++ b/vendor/go.uber.org/zap/benchmarks/log15_test.go @@ -0,0 +1,33 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package benchmarks + +import ( + "io/ioutil" + + "gopkg.in/inconshreveable/log15.v2" +) + +func newLog15() log15.Logger { + logger := log15.New() + logger.SetHandler(log15.StreamHandler(ioutil.Discard, log15.JsonFormat())) + return logger +} diff --git a/vendor/go.uber.org/zap/benchmarks/logrus_test.go b/vendor/go.uber.org/zap/benchmarks/logrus_test.go new file mode 100644 index 000000000..ee684a6f9 --- /dev/null +++ b/vendor/go.uber.org/zap/benchmarks/logrus_test.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package benchmarks + +import ( + "io/ioutil" + + "github.com/sirupsen/logrus" +) + +func newDisabledLogrus() *logrus.Logger { + logger := newLogrus() + logger.Level = logrus.ErrorLevel + return logger +} + +func newLogrus() *logrus.Logger { + return &logrus.Logger{ + Out: ioutil.Discard, + Formatter: new(logrus.JSONFormatter), + Hooks: make(logrus.LevelHooks), + Level: logrus.DebugLevel, + } +} + +func fakeLogrusFields() logrus.Fields { + return logrus.Fields{ + "int": _tenInts[0], + "ints": _tenInts, + "string": _tenStrings[0], + "strings": _tenStrings, + "time": _tenTimes[0], + "times": _tenTimes, + "user1": _oneUser, + "user2": _oneUser, + "users": _tenUsers, + "error": errExample, + } +} diff --git a/vendor/go.uber.org/zap/benchmarks/scenario_bench_test.go b/vendor/go.uber.org/zap/benchmarks/scenario_bench_test.go new file mode 100644 index 000000000..4e307d215 --- /dev/null +++ b/vendor/go.uber.org/zap/benchmarks/scenario_bench_test.go @@ -0,0 +1,614 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package benchmarks + +import ( + "io/ioutil" + "log" + "testing" + + "go.uber.org/zap" +) + +func BenchmarkDisabledWithoutFields(b *testing.B) { + b.Logf("Logging at a disabled level without any structured context.") + b.Run("Zap", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("Zap.Check", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if m := logger.Check(zap.InfoLevel, getMessage(0)); m != nil { + m.Write() + } + } + }) + }) + b.Run("Zap.Sugar", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("Zap.SugarFormatting", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Infof("%v %v %v %s %v %v %v %v %v %s\n", fakeFmtArgs()...) + } + }) + }) + b.Run("apex/log", func(b *testing.B) { + logger := newDisabledApexLog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("sirupsen/logrus", func(b *testing.B) { + logger := newDisabledLogrus() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("rs/zerolog", func(b *testing.B) { + logger := newDisabledZerolog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info().Msg(getMessage(0)) + } + }) + }) +} + +func BenchmarkDisabledAccumulatedContext(b *testing.B) { + b.Logf("Logging at a disabled level with some accumulated context.") + b.Run("Zap", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel).With(fakeFields()...) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("Zap.Check", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel).With(fakeFields()...) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if m := logger.Check(zap.InfoLevel, getMessage(0)); m != nil { + m.Write() + } + } + }) + }) + b.Run("Zap.Sugar", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel).With(fakeFields()...).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("Zap.SugarFormatting", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel).With(fakeFields()...).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Infof("%v %v %v %s %v %v %v %v %v %s\n", fakeFmtArgs()...) + } + }) + }) + b.Run("apex/log", func(b *testing.B) { + logger := newDisabledApexLog().WithFields(fakeApexFields()) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("sirupsen/logrus", func(b *testing.B) { + logger := newDisabledLogrus().WithFields(fakeLogrusFields()) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("rs/zerolog", func(b *testing.B) { + logger := fakeZerologContext(newDisabledZerolog().With()).Logger() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info().Msg(getMessage(0)) + } + }) + }) +} + +func BenchmarkDisabledAddingFields(b *testing.B) { + b.Logf("Logging at a disabled level, adding context at each log site.") + b.Run("Zap", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0), fakeFields()...) + } + }) + }) + b.Run("Zap.Check", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if m := logger.Check(zap.InfoLevel, getMessage(0)); m != nil { + m.Write(fakeFields()...) + } + } + }) + }) + b.Run("Zap.Sugar", func(b *testing.B) { + logger := newZapLogger(zap.ErrorLevel).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Infow(getMessage(0), fakeSugarFields()...) + } + }) + }) + b.Run("apex/log", func(b *testing.B) { + logger := newDisabledApexLog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.WithFields(fakeApexFields()).Info(getMessage(0)) + } + }) + }) + b.Run("sirupsen/logrus", func(b *testing.B) { + logger := newDisabledLogrus() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.WithFields(fakeLogrusFields()).Info(getMessage(0)) + } + }) + }) + b.Run("rs/zerolog", func(b *testing.B) { + logger := newDisabledZerolog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + fakeZerologFields(logger.Info()).Msg(getMessage(0)) + } + }) + }) +} + +func BenchmarkWithoutFields(b *testing.B) { + b.Logf("Logging without any structured context.") + b.Run("Zap", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("Zap.Check", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if ce := logger.Check(zap.InfoLevel, getMessage(0)); ce != nil { + ce.Write() + } + } + }) + }) + b.Run("Zap.CheckSampled", func(b *testing.B) { + logger := newSampledLogger(zap.DebugLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + i := 0 + for pb.Next() { + i++ + if ce := logger.Check(zap.InfoLevel, getMessage(i)); ce != nil { + ce.Write() + } + } + }) + }) + b.Run("Zap.Sugar", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("Zap.SugarFormatting", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Infof("%v %v %v %s %v %v %v %v %v %s\n", fakeFmtArgs()...) + } + }) + }) + b.Run("apex/log", func(b *testing.B) { + logger := newApexLog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("go-kit/kit/log", func(b *testing.B) { + logger := newKitLog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Log(getMessage(0), getMessage(1)) + } + }) + }) + b.Run("inconshreveable/log15", func(b *testing.B) { + logger := newLog15() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("sirupsen/logrus", func(b *testing.B) { + logger := newLogrus() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("go.pedge.io/lion", func(b *testing.B) { + logger := newLion() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Printf(getMessage(0)) + } + }) + }) + b.Run("stdlib.Println", func(b *testing.B) { + logger := log.New(ioutil.Discard, "", log.LstdFlags) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Println(getMessage(0)) + } + }) + }) + b.Run("stdlib.Printf", func(b *testing.B) { + logger := log.New(ioutil.Discard, "", log.LstdFlags) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Printf("%v %v %v %s %v %v %v %v %v %s\n", fakeFmtArgs()...) + } + }) + }) + b.Run("rs/zerolog", func(b *testing.B) { + logger := newZerolog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info().Msg(getMessage(0)) + } + }) + }) + b.Run("rs/zerolog.Formatting", func(b *testing.B) { + logger := newZerolog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info().Msgf("%v %v %v %s %v %v %v %v %v %s\n", fakeFmtArgs()...) + } + }) + }) + b.Run("rs/zerolog.Check", func(b *testing.B) { + logger := newZerolog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if e := logger.Info(); e.Enabled() { + e.Msg(getMessage(0)) + } + } + }) + }) +} + +func BenchmarkAccumulatedContext(b *testing.B) { + b.Logf("Logging with some accumulated context.") + b.Run("Zap", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel).With(fakeFields()...) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("Zap.Check", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel).With(fakeFields()...) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if ce := logger.Check(zap.InfoLevel, getMessage(0)); ce != nil { + ce.Write() + } + } + }) + }) + b.Run("Zap.CheckSampled", func(b *testing.B) { + logger := newSampledLogger(zap.DebugLevel).With(fakeFields()...) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + i := 0 + for pb.Next() { + i++ + if ce := logger.Check(zap.InfoLevel, getMessage(i)); ce != nil { + ce.Write() + } + } + }) + }) + b.Run("Zap.Sugar", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel).With(fakeFields()...).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("Zap.SugarFormatting", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel).With(fakeFields()...).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Infof("%v %v %v %s %v %v %v %v %v %s\n", fakeFmtArgs()...) + } + }) + }) + b.Run("apex/log", func(b *testing.B) { + logger := newApexLog().WithFields(fakeApexFields()) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("go-kit/kit/log", func(b *testing.B) { + logger := newKitLog(fakeSugarFields()...) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Log(getMessage(0), getMessage(1)) + } + }) + }) + b.Run("inconshreveable/log15", func(b *testing.B) { + logger := newLog15().New(fakeSugarFields()) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("sirupsen/logrus", func(b *testing.B) { + logger := newLogrus().WithFields(fakeLogrusFields()) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0)) + } + }) + }) + b.Run("go.pedge.io/lion", func(b *testing.B) { + logger := newLion().WithFields(fakeLogrusFields()) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Infof(getMessage(0)) + } + }) + }) + b.Run("rs/zerolog", func(b *testing.B) { + logger := fakeZerologContext(newZerolog().With()).Logger() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info().Msg(getMessage(0)) + } + }) + }) + b.Run("rs/zerolog.Check", func(b *testing.B) { + logger := fakeZerologContext(newZerolog().With()).Logger() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if e := logger.Info(); e.Enabled() { + e.Msg(getMessage(0)) + } + } + }) + }) + b.Run("rs/zerolog.Formatting", func(b *testing.B) { + logger := fakeZerologContext(newZerolog().With()).Logger() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info().Msgf("%v %v %v %s %v %v %v %v %v %s\n", fakeFmtArgs()...) + } + }) + }) +} + +func BenchmarkAddingFields(b *testing.B) { + b.Logf("Logging with additional context at each log site.") + b.Run("Zap", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0), fakeFields()...) + } + }) + }) + b.Run("Zap.Check", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if ce := logger.Check(zap.InfoLevel, getMessage(0)); ce != nil { + ce.Write(fakeFields()...) + } + } + }) + }) + b.Run("Zap.CheckSampled", func(b *testing.B) { + logger := newSampledLogger(zap.DebugLevel) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + i := 0 + for pb.Next() { + i++ + if ce := logger.Check(zap.InfoLevel, getMessage(i)); ce != nil { + ce.Write(fakeFields()...) + } + } + }) + }) + b.Run("Zap.Sugar", func(b *testing.B) { + logger := newZapLogger(zap.DebugLevel).Sugar() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Infow(getMessage(0), fakeSugarFields()...) + } + }) + }) + b.Run("apex/log", func(b *testing.B) { + logger := newApexLog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.WithFields(fakeApexFields()).Info(getMessage(0)) + } + }) + }) + b.Run("go-kit/kit/log", func(b *testing.B) { + logger := newKitLog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Log(fakeSugarFields()...) + } + }) + }) + b.Run("inconshreveable/log15", func(b *testing.B) { + logger := newLog15() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info(getMessage(0), fakeSugarFields()...) + } + }) + }) + b.Run("sirupsen/logrus", func(b *testing.B) { + logger := newLogrus() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.WithFields(fakeLogrusFields()).Info(getMessage(0)) + } + }) + }) + b.Run("go.pedge.io/lion", func(b *testing.B) { + logger := newLion() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.WithFields(fakeLogrusFields()).Infof(getMessage(0)) + } + }) + }) + b.Run("rs/zerolog", func(b *testing.B) { + logger := newZerolog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + fakeZerologFields(logger.Info()).Msg(getMessage(0)) + } + }) + }) + b.Run("rs/zerolog.Check", func(b *testing.B) { + logger := newZerolog() + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if e := logger.Info(); e.Enabled() { + fakeZerologFields(e).Msg(getMessage(0)) + } + } + }) + }) +} diff --git a/vendor/go.uber.org/zap/benchmarks/zap_test.go b/vendor/go.uber.org/zap/benchmarks/zap_test.go new file mode 100644 index 000000000..92f7120ec --- /dev/null +++ b/vendor/go.uber.org/zap/benchmarks/zap_test.go @@ -0,0 +1,172 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package benchmarks + +import ( + "errors" + "fmt" + "time" + + "go.uber.org/multierr" + "go.uber.org/zap" + "go.uber.org/zap/internal/ztest" + "go.uber.org/zap/zapcore" +) + +var ( + errExample = errors.New("fail") + + _messages = fakeMessages(1000) + _tenInts = []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 0} + _tenStrings = []string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j"} + _tenTimes = []time.Time{ + time.Unix(0, 0), + time.Unix(1, 0), + time.Unix(2, 0), + time.Unix(3, 0), + time.Unix(4, 0), + time.Unix(5, 0), + time.Unix(6, 0), + time.Unix(7, 0), + time.Unix(8, 0), + time.Unix(9, 0), + } + _oneUser = &user{ + Name: "Jane Doe", + Email: "jane@test.com", + CreatedAt: time.Date(1980, 1, 1, 12, 0, 0, 0, time.UTC), + } + _tenUsers = users{ + _oneUser, + _oneUser, + _oneUser, + _oneUser, + _oneUser, + _oneUser, + _oneUser, + _oneUser, + _oneUser, + _oneUser, + } +) + +func fakeMessages(n int) []string { + messages := make([]string, n) + for i := range messages { + messages[i] = fmt.Sprintf("Test logging, but use a somewhat realistic message length. (#%v)", i) + } + return messages +} + +func getMessage(iter int) string { + return _messages[iter%1000] +} + +type users []*user + +func (uu users) MarshalLogArray(arr zapcore.ArrayEncoder) error { + var err error + for i := range uu { + err = multierr.Append(err, arr.AppendObject(uu[i])) + } + return err +} + +type user struct { + Name string `json:"name"` + Email string `json:"email"` + CreatedAt time.Time `json:"created_at"` +} + +func (u *user) MarshalLogObject(enc zapcore.ObjectEncoder) error { + enc.AddString("name", u.Name) + enc.AddString("email", u.Email) + enc.AddInt64("createdAt", u.CreatedAt.UnixNano()) + return nil +} + +func newZapLogger(lvl zapcore.Level) *zap.Logger { + ec := zap.NewProductionEncoderConfig() + ec.EncodeDuration = zapcore.NanosDurationEncoder + ec.EncodeTime = zapcore.EpochNanosTimeEncoder + enc := zapcore.NewJSONEncoder(ec) + return zap.New(zapcore.NewCore( + enc, + &ztest.Discarder{}, + lvl, + )) +} + +func newSampledLogger(lvl zapcore.Level) *zap.Logger { + return zap.New(zapcore.NewSampler( + newZapLogger(zap.DebugLevel).Core(), + 100*time.Millisecond, + 10, // first + 10, // thereafter + )) +} + +func fakeFields() []zap.Field { + return []zap.Field{ + zap.Int("int", _tenInts[0]), + zap.Ints("ints", _tenInts), + zap.String("string", _tenStrings[0]), + zap.Strings("strings", _tenStrings), + zap.Time("time", _tenTimes[0]), + zap.Times("times", _tenTimes), + zap.Object("user1", _oneUser), + zap.Object("user2", _oneUser), + zap.Array("users", _tenUsers), + zap.Error(errExample), + } +} + +func fakeSugarFields() []interface{} { + return []interface{}{ + "int", _tenInts[0], + "ints", _tenInts, + "string", _tenStrings[0], + "strings", _tenStrings, + "time", _tenTimes[0], + "times", _tenTimes, + "user1", _oneUser, + "user2", _oneUser, + "users", _tenUsers, + "error", errExample, + } +} + +func fakeFmtArgs() []interface{} { + // Need to keep this a function instead of a package-global var so that we + // pay the cast-to-interface{} penalty on each call. + return []interface{}{ + _tenInts[0], + _tenInts, + _tenStrings[0], + _tenStrings, + _tenTimes[0], + _tenTimes, + _oneUser, + _oneUser, + _tenUsers, + errExample, + } +} diff --git a/vendor/go.uber.org/zap/benchmarks/zerolog_test.go b/vendor/go.uber.org/zap/benchmarks/zerolog_test.go new file mode 100644 index 000000000..b14cd9df3 --- /dev/null +++ b/vendor/go.uber.org/zap/benchmarks/zerolog_test.go @@ -0,0 +1,63 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package benchmarks + +import ( + "io/ioutil" + + "github.com/rs/zerolog" +) + +func newZerolog() zerolog.Logger { + return zerolog.New(ioutil.Discard).With().Timestamp().Logger() +} + +func newDisabledZerolog() zerolog.Logger { + return newZerolog().Level(zerolog.Disabled) +} + +func fakeZerologFields(e *zerolog.Event) *zerolog.Event { + return e. + Int("int", _tenInts[0]). + Interface("ints", _tenInts). + Str("string", _tenStrings[0]). + Interface("strings", _tenStrings). + Time("time", _tenTimes[0]). + Interface("times", _tenTimes). + Interface("user1", _oneUser). + Interface("user2", _oneUser). + Interface("users", _tenUsers). + Err(errExample) +} + +func fakeZerologContext(c zerolog.Context) zerolog.Context { + return c. + Int("int", _tenInts[0]). + Interface("ints", _tenInts). + Str("string", _tenStrings[0]). + Interface("strings", _tenStrings). + Time("time", _tenTimes[0]). + Interface("times", _tenTimes). + Interface("user1", _oneUser). + Interface("user2", _oneUser). + Interface("users", _tenUsers). + Err(errExample) +} diff --git a/vendor/go.uber.org/zap/buffer/buffer.go b/vendor/go.uber.org/zap/buffer/buffer.go new file mode 100644 index 000000000..7592e8c63 --- /dev/null +++ b/vendor/go.uber.org/zap/buffer/buffer.go @@ -0,0 +1,115 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package buffer provides a thin wrapper around a byte slice. Unlike the +// standard library's bytes.Buffer, it supports a portion of the strconv +// package's zero-allocation formatters. +package buffer // import "go.uber.org/zap/buffer" + +import "strconv" + +const _size = 1024 // by default, create 1 KiB buffers + +// Buffer is a thin wrapper around a byte slice. It's intended to be pooled, so +// the only way to construct one is via a Pool. +type Buffer struct { + bs []byte + pool Pool +} + +// AppendByte writes a single byte to the Buffer. +func (b *Buffer) AppendByte(v byte) { + b.bs = append(b.bs, v) +} + +// AppendString writes a string to the Buffer. +func (b *Buffer) AppendString(s string) { + b.bs = append(b.bs, s...) +} + +// AppendInt appends an integer to the underlying buffer (assuming base 10). +func (b *Buffer) AppendInt(i int64) { + b.bs = strconv.AppendInt(b.bs, i, 10) +} + +// AppendUint appends an unsigned integer to the underlying buffer (assuming +// base 10). +func (b *Buffer) AppendUint(i uint64) { + b.bs = strconv.AppendUint(b.bs, i, 10) +} + +// AppendBool appends a bool to the underlying buffer. +func (b *Buffer) AppendBool(v bool) { + b.bs = strconv.AppendBool(b.bs, v) +} + +// AppendFloat appends a float to the underlying buffer. It doesn't quote NaN +// or +/- Inf. +func (b *Buffer) AppendFloat(f float64, bitSize int) { + b.bs = strconv.AppendFloat(b.bs, f, 'f', -1, bitSize) +} + +// Len returns the length of the underlying byte slice. +func (b *Buffer) Len() int { + return len(b.bs) +} + +// Cap returns the capacity of the underlying byte slice. +func (b *Buffer) Cap() int { + return cap(b.bs) +} + +// Bytes returns a mutable reference to the underlying byte slice. +func (b *Buffer) Bytes() []byte { + return b.bs +} + +// String returns a string copy of the underlying byte slice. +func (b *Buffer) String() string { + return string(b.bs) +} + +// Reset resets the underlying byte slice. Subsequent writes re-use the slice's +// backing array. +func (b *Buffer) Reset() { + b.bs = b.bs[:0] +} + +// Write implements io.Writer. +func (b *Buffer) Write(bs []byte) (int, error) { + b.bs = append(b.bs, bs...) + return len(bs), nil +} + +// TrimNewline trims any final "\n" byte from the end of the buffer. +func (b *Buffer) TrimNewline() { + if i := len(b.bs) - 1; i >= 0 { + if b.bs[i] == '\n' { + b.bs = b.bs[:i] + } + } +} + +// Free returns the Buffer to its Pool. +// +// Callers must not retain references to the Buffer after calling Free. +func (b *Buffer) Free() { + b.pool.put(b) +} diff --git a/vendor/go.uber.org/zap/buffer/buffer_test.go b/vendor/go.uber.org/zap/buffer/buffer_test.go new file mode 100644 index 000000000..59bc08a6a --- /dev/null +++ b/vendor/go.uber.org/zap/buffer/buffer_test.go @@ -0,0 +1,91 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package buffer + +import ( + "bytes" + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestBufferWrites(t *testing.T) { + buf := NewPool().Get() + + tests := []struct { + desc string + f func() + want string + }{ + {"AppendByte", func() { buf.AppendByte('v') }, "v"}, + {"AppendString", func() { buf.AppendString("foo") }, "foo"}, + {"AppendIntPositive", func() { buf.AppendInt(42) }, "42"}, + {"AppendIntNegative", func() { buf.AppendInt(-42) }, "-42"}, + {"AppendUint", func() { buf.AppendUint(42) }, "42"}, + {"AppendBool", func() { buf.AppendBool(true) }, "true"}, + {"AppendFloat64", func() { buf.AppendFloat(3.14, 64) }, "3.14"}, + // Intenationally introduce some floating-point error. + {"AppendFloat32", func() { buf.AppendFloat(float64(float32(3.14)), 32) }, "3.14"}, + {"AppendWrite", func() { buf.Write([]byte("foo")) }, "foo"}, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + buf.Reset() + tt.f() + assert.Equal(t, tt.want, buf.String(), "Unexpected buffer.String().") + assert.Equal(t, tt.want, string(buf.Bytes()), "Unexpected string(buffer.Bytes()).") + assert.Equal(t, len(tt.want), buf.Len(), "Unexpected buffer length.") + // We're not writing more than a kibibyte in tests. + assert.Equal(t, _size, buf.Cap(), "Expected buffer capacity to remain constant.") + }) + } +} + +func BenchmarkBuffers(b *testing.B) { + // Because we use the strconv.AppendFoo functions so liberally, we can't + // use the standard library's bytes.Buffer anyways (without incurring a + // bunch of extra allocations). Nevertheless, let's make sure that we're + // not losing any precious nanoseconds. + str := strings.Repeat("a", 1024) + slice := make([]byte, 1024) + buf := bytes.NewBuffer(slice) + custom := NewPool().Get() + b.Run("ByteSlice", func(b *testing.B) { + for i := 0; i < b.N; i++ { + slice = append(slice, str...) + slice = slice[:0] + } + }) + b.Run("BytesBuffer", func(b *testing.B) { + for i := 0; i < b.N; i++ { + buf.WriteString(str) + buf.Reset() + } + }) + b.Run("CustomBuffer", func(b *testing.B) { + for i := 0; i < b.N; i++ { + custom.AppendString(str) + custom.Reset() + } + }) +} diff --git a/vendor/go.uber.org/zap/buffer/pool.go b/vendor/go.uber.org/zap/buffer/pool.go new file mode 100644 index 000000000..8fb3e202c --- /dev/null +++ b/vendor/go.uber.org/zap/buffer/pool.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package buffer + +import "sync" + +// A Pool is a type-safe wrapper around a sync.Pool. +type Pool struct { + p *sync.Pool +} + +// NewPool constructs a new Pool. +func NewPool() Pool { + return Pool{p: &sync.Pool{ + New: func() interface{} { + return &Buffer{bs: make([]byte, 0, _size)} + }, + }} +} + +// Get retrieves a Buffer from the pool, creating one if necessary. +func (p Pool) Get() *Buffer { + buf := p.p.Get().(*Buffer) + buf.Reset() + buf.pool = p + return buf +} + +func (p Pool) put(buf *Buffer) { + p.p.Put(buf) +} diff --git a/vendor/go.uber.org/zap/buffer/pool_test.go b/vendor/go.uber.org/zap/buffer/pool_test.go new file mode 100644 index 000000000..a219815b5 --- /dev/null +++ b/vendor/go.uber.org/zap/buffer/pool_test.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package buffer + +import ( + "sync" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestBuffers(t *testing.T) { + const dummyData = "dummy data" + p := NewPool() + + var wg sync.WaitGroup + for g := 0; g < 10; g++ { + wg.Add(1) + go func() { + for i := 0; i < 100; i++ { + buf := p.Get() + assert.Zero(t, buf.Len(), "Expected truncated buffer") + assert.NotZero(t, buf.Cap(), "Expected non-zero capacity") + + buf.AppendString(dummyData) + assert.Equal(t, buf.Len(), len(dummyData), "Expected buffer to contain dummy data") + + buf.Free() + } + wg.Done() + }() + } + wg.Wait() +} diff --git a/vendor/go.uber.org/zap/check_license.sh b/vendor/go.uber.org/zap/check_license.sh new file mode 100755 index 000000000..345ac8b89 --- /dev/null +++ b/vendor/go.uber.org/zap/check_license.sh @@ -0,0 +1,17 @@ +#!/bin/bash -e + +ERROR_COUNT=0 +while read -r file +do + case "$(head -1 "${file}")" in + *"Copyright (c) "*" Uber Technologies, Inc.") + # everything's cool + ;; + *) + echo "$file is missing license header." + (( ERROR_COUNT++ )) + ;; + esac +done < <(git ls-files "*\.go") + +exit $ERROR_COUNT diff --git a/vendor/go.uber.org/zap/common_test.go b/vendor/go.uber.org/zap/common_test.go new file mode 100644 index 000000000..b0a4a2e52 --- /dev/null +++ b/vendor/go.uber.org/zap/common_test.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "sync" + "testing" + + "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest/observer" +) + +func opts(opts ...Option) []Option { + return opts +} + +// Here specifically to introduce an easily-identifiable filename for testing +// stacktraces and caller skips. +func withLogger(t testing.TB, e zapcore.LevelEnabler, opts []Option, f func(*Logger, *observer.ObservedLogs)) { + fac, logs := observer.New(e) + log := New(fac, opts...) + f(log, logs) +} + +func withSugar(t testing.TB, e zapcore.LevelEnabler, opts []Option, f func(*SugaredLogger, *observer.ObservedLogs)) { + withLogger(t, e, opts, func(logger *Logger, logs *observer.ObservedLogs) { f(logger.Sugar(), logs) }) +} + +func runConcurrently(goroutines, iterations int, wg *sync.WaitGroup, f func()) { + wg.Add(goroutines) + for g := 0; g < goroutines; g++ { + go func() { + defer wg.Done() + for i := 0; i < iterations; i++ { + f() + } + }() + } +} diff --git a/vendor/go.uber.org/zap/config.go b/vendor/go.uber.org/zap/config.go new file mode 100644 index 000000000..6fe17d9e0 --- /dev/null +++ b/vendor/go.uber.org/zap/config.go @@ -0,0 +1,243 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "sort" + "time" + + "go.uber.org/zap/zapcore" +) + +// SamplingConfig sets a sampling strategy for the logger. Sampling caps the +// global CPU and I/O load that logging puts on your process while attempting +// to preserve a representative subset of your logs. +// +// Values configured here are per-second. See zapcore.NewSampler for details. +type SamplingConfig struct { + Initial int `json:"initial" yaml:"initial"` + Thereafter int `json:"thereafter" yaml:"thereafter"` +} + +// Config offers a declarative way to construct a logger. It doesn't do +// anything that can't be done with New, Options, and the various +// zapcore.WriteSyncer and zapcore.Core wrappers, but it's a simpler way to +// toggle common options. +// +// Note that Config intentionally supports only the most common options. More +// unusual logging setups (logging to network connections or message queues, +// splitting output between multiple files, etc.) are possible, but require +// direct use of the zapcore package. For sample code, see the package-level +// BasicConfiguration and AdvancedConfiguration examples. +// +// For an example showing runtime log level changes, see the documentation for +// AtomicLevel. +type Config struct { + // Level is the minimum enabled logging level. Note that this is a dynamic + // level, so calling Config.Level.SetLevel will atomically change the log + // level of all loggers descended from this config. + Level AtomicLevel `json:"level" yaml:"level"` + // Development puts the logger in development mode, which changes the + // behavior of DPanicLevel and takes stacktraces more liberally. + Development bool `json:"development" yaml:"development"` + // DisableCaller stops annotating logs with the calling function's file + // name and line number. By default, all logs are annotated. + DisableCaller bool `json:"disableCaller" yaml:"disableCaller"` + // DisableStacktrace completely disables automatic stacktrace capturing. By + // default, stacktraces are captured for WarnLevel and above logs in + // development and ErrorLevel and above in production. + DisableStacktrace bool `json:"disableStacktrace" yaml:"disableStacktrace"` + // Sampling sets a sampling policy. A nil SamplingConfig disables sampling. + Sampling *SamplingConfig `json:"sampling" yaml:"sampling"` + // Encoding sets the logger's encoding. Valid values are "json" and + // "console", as well as any third-party encodings registered via + // RegisterEncoder. + Encoding string `json:"encoding" yaml:"encoding"` + // EncoderConfig sets options for the chosen encoder. See + // zapcore.EncoderConfig for details. + EncoderConfig zapcore.EncoderConfig `json:"encoderConfig" yaml:"encoderConfig"` + // OutputPaths is a list of URLs or file paths to write logging output to. + // See Open for details. + OutputPaths []string `json:"outputPaths" yaml:"outputPaths"` + // ErrorOutputPaths is a list of URLs to write internal logger errors to. + // The default is standard error. + // + // Note that this setting only affects internal errors; for sample code that + // sends error-level logs to a different location from info- and debug-level + // logs, see the package-level AdvancedConfiguration example. + ErrorOutputPaths []string `json:"errorOutputPaths" yaml:"errorOutputPaths"` + // InitialFields is a collection of fields to add to the root logger. + InitialFields map[string]interface{} `json:"initialFields" yaml:"initialFields"` +} + +// NewProductionEncoderConfig returns an opinionated EncoderConfig for +// production environments. +func NewProductionEncoderConfig() zapcore.EncoderConfig { + return zapcore.EncoderConfig{ + TimeKey: "ts", + LevelKey: "level", + NameKey: "logger", + CallerKey: "caller", + MessageKey: "msg", + StacktraceKey: "stacktrace", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.LowercaseLevelEncoder, + EncodeTime: zapcore.EpochTimeEncoder, + EncodeDuration: zapcore.SecondsDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, + } +} + +// NewProductionConfig is a reasonable production logging configuration. +// Logging is enabled at InfoLevel and above. +// +// It uses a JSON encoder, writes to standard error, and enables sampling. +// Stacktraces are automatically included on logs of ErrorLevel and above. +func NewProductionConfig() Config { + return Config{ + Level: NewAtomicLevelAt(InfoLevel), + Development: false, + Sampling: &SamplingConfig{ + Initial: 100, + Thereafter: 100, + }, + Encoding: "json", + EncoderConfig: NewProductionEncoderConfig(), + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, + } +} + +// NewDevelopmentEncoderConfig returns an opinionated EncoderConfig for +// development environments. +func NewDevelopmentEncoderConfig() zapcore.EncoderConfig { + return zapcore.EncoderConfig{ + // Keys can be anything except the empty string. + TimeKey: "T", + LevelKey: "L", + NameKey: "N", + CallerKey: "C", + MessageKey: "M", + StacktraceKey: "S", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.CapitalLevelEncoder, + EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.StringDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, + } +} + +// NewDevelopmentConfig is a reasonable development logging configuration. +// Logging is enabled at DebugLevel and above. +// +// It enables development mode (which makes DPanicLevel logs panic), uses a +// console encoder, writes to standard error, and disables sampling. +// Stacktraces are automatically included on logs of WarnLevel and above. +func NewDevelopmentConfig() Config { + return Config{ + Level: NewAtomicLevelAt(DebugLevel), + Development: true, + Encoding: "console", + EncoderConfig: NewDevelopmentEncoderConfig(), + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, + } +} + +// Build constructs a logger from the Config and Options. +func (cfg Config) Build(opts ...Option) (*Logger, error) { + enc, err := cfg.buildEncoder() + if err != nil { + return nil, err + } + + sink, errSink, err := cfg.openSinks() + if err != nil { + return nil, err + } + + log := New( + zapcore.NewCore(enc, sink, cfg.Level), + cfg.buildOptions(errSink)..., + ) + if len(opts) > 0 { + log = log.WithOptions(opts...) + } + return log, nil +} + +func (cfg Config) buildOptions(errSink zapcore.WriteSyncer) []Option { + opts := []Option{ErrorOutput(errSink)} + + if cfg.Development { + opts = append(opts, Development()) + } + + if !cfg.DisableCaller { + opts = append(opts, AddCaller()) + } + + stackLevel := ErrorLevel + if cfg.Development { + stackLevel = WarnLevel + } + if !cfg.DisableStacktrace { + opts = append(opts, AddStacktrace(stackLevel)) + } + + if cfg.Sampling != nil { + opts = append(opts, WrapCore(func(core zapcore.Core) zapcore.Core { + return zapcore.NewSampler(core, time.Second, int(cfg.Sampling.Initial), int(cfg.Sampling.Thereafter)) + })) + } + + if len(cfg.InitialFields) > 0 { + fs := make([]Field, 0, len(cfg.InitialFields)) + keys := make([]string, 0, len(cfg.InitialFields)) + for k := range cfg.InitialFields { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + fs = append(fs, Any(k, cfg.InitialFields[k])) + } + opts = append(opts, Fields(fs...)) + } + + return opts +} + +func (cfg Config) openSinks() (zapcore.WriteSyncer, zapcore.WriteSyncer, error) { + sink, closeOut, err := Open(cfg.OutputPaths...) + if err != nil { + return nil, nil, err + } + errSink, _, err := Open(cfg.ErrorOutputPaths...) + if err != nil { + closeOut() + return nil, nil, err + } + return sink, errSink, nil +} + +func (cfg Config) buildEncoder() (zapcore.Encoder, error) { + return newEncoder(cfg.Encoding, cfg.EncoderConfig) +} diff --git a/vendor/go.uber.org/zap/config_test.go b/vendor/go.uber.org/zap/config_test.go new file mode 100644 index 000000000..7a875703b --- /dev/null +++ b/vendor/go.uber.org/zap/config_test.go @@ -0,0 +1,108 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "io/ioutil" + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + tests := []struct { + desc string + cfg Config + expectN int64 + expectRe string + }{ + { + desc: "production", + cfg: NewProductionConfig(), + expectN: 2 + 100 + 1, // 2 from initial logs, 100 initial sampled logs, 1 from off-by-one in sampler + expectRe: `{"level":"info","caller":"zap/config_test.go:\d+","msg":"info","k":"v","z":"zz"}` + "\n" + + `{"level":"warn","caller":"zap/config_test.go:\d+","msg":"warn","k":"v","z":"zz"}` + "\n", + }, + { + desc: "development", + cfg: NewDevelopmentConfig(), + expectN: 3 + 200, // 3 initial logs, all 200 subsequent logs + expectRe: "DEBUG\tzap/config_test.go:" + `\d+` + "\tdebug\t" + `{"k": "v", "z": "zz"}` + "\n" + + "INFO\tzap/config_test.go:" + `\d+` + "\tinfo\t" + `{"k": "v", "z": "zz"}` + "\n" + + "WARN\tzap/config_test.go:" + `\d+` + "\twarn\t" + `{"k": "v", "z": "zz"}` + "\n" + + `testing.\w+`, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + temp, err := ioutil.TempFile("", "zap-prod-config-test") + require.NoError(t, err, "Failed to create temp file.") + defer os.Remove(temp.Name()) + + tt.cfg.OutputPaths = []string{temp.Name()} + tt.cfg.EncoderConfig.TimeKey = "" // no timestamps in tests + tt.cfg.InitialFields = map[string]interface{}{"z": "zz", "k": "v"} + + hook, count := makeCountingHook() + logger, err := tt.cfg.Build(Hooks(hook)) + require.NoError(t, err, "Unexpected error constructing logger.") + + logger.Debug("debug") + logger.Info("info") + logger.Warn("warn") + + byteContents, err := ioutil.ReadAll(temp) + require.NoError(t, err, "Couldn't read log contents from temp file.") + logs := string(byteContents) + assert.Regexp(t, tt.expectRe, logs, "Unexpected log output.") + + for i := 0; i < 200; i++ { + logger.Info("sampling") + } + assert.Equal(t, tt.expectN, count.Load(), "Hook called an unexpected number of times.") + }) + } +} + +func TestConfigWithInvalidPaths(t *testing.T) { + tests := []struct { + desc string + output string + errOutput string + }{ + {"output directory doesn't exist", "/tmp/not-there/foo.log", "stderr"}, + {"error output directory doesn't exist", "stdout", "/tmp/not-there/foo-errors.log"}, + {"neither output directory exists", "/tmp/not-there/foo.log", "/tmp/not-there/foo-errors.log"}, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + cfg := NewProductionConfig() + cfg.OutputPaths = []string{tt.output} + cfg.ErrorOutputPaths = []string{tt.errOutput} + _, err := cfg.Build() + assert.Error(t, err, "Expected an error opening a non-existent directory.") + }) + } +} diff --git a/vendor/go.uber.org/zap/doc.go b/vendor/go.uber.org/zap/doc.go new file mode 100644 index 000000000..8638dd1b9 --- /dev/null +++ b/vendor/go.uber.org/zap/doc.go @@ -0,0 +1,113 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package zap provides fast, structured, leveled logging. +// +// For applications that log in the hot path, reflection-based serialization +// and string formatting are prohibitively expensive - they're CPU-intensive +// and make many small allocations. Put differently, using json.Marshal and +// fmt.Fprintf to log tons of interface{} makes your application slow. +// +// Zap takes a different approach. It includes a reflection-free, +// zero-allocation JSON encoder, and the base Logger strives to avoid +// serialization overhead and allocations wherever possible. By building the +// high-level SugaredLogger on that foundation, zap lets users choose when +// they need to count every allocation and when they'd prefer a more familiar, +// loosely typed API. +// +// Choosing a Logger +// +// In contexts where performance is nice, but not critical, use the +// SugaredLogger. It's 4-10x faster than other structured logging packages and +// supports both structured and printf-style logging. Like log15 and go-kit, +// the SugaredLogger's structured logging APIs are loosely typed and accept a +// variadic number of key-value pairs. (For more advanced use cases, they also +// accept strongly typed fields - see the SugaredLogger.With documentation for +// details.) +// sugar := zap.NewExample().Sugar() +// defer sugar.Sync() +// sugar.Infow("failed to fetch URL", +// "url", "http://example.com", +// "attempt", 3, +// "backoff", time.Second, +// ) +// sugar.Infof("failed to fetch URL: %s", "http://example.com") +// +// By default, loggers are unbuffered. However, since zap's low-level APIs +// allow buffering, calling Sync before letting your process exit is a good +// habit. +// +// In the rare contexts where every microsecond and every allocation matter, +// use the Logger. It's even faster than the SugaredLogger and allocates far +// less, but it only supports strongly-typed, structured logging. +// logger := zap.NewExample() +// defer logger.Sync() +// logger.Info("failed to fetch URL", +// zap.String("url", "http://example.com"), +// zap.Int("attempt", 3), +// zap.Duration("backoff", time.Second), +// ) +// +// Choosing between the Logger and SugaredLogger doesn't need to be an +// application-wide decision: converting between the two is simple and +// inexpensive. +// logger := zap.NewExample() +// defer logger.Sync() +// sugar := logger.Sugar() +// plain := sugar.Desugar() +// +// Configuring Zap +// +// The simplest way to build a Logger is to use zap's opinionated presets: +// NewExample, NewProduction, and NewDevelopment. These presets build a logger +// with a single function call: +// logger, err := zap.NewProduction() +// if err != nil { +// log.Fatalf("can't initialize zap logger: %v", err) +// } +// defer logger.Sync() +// +// Presets are fine for small projects, but larger projects and organizations +// naturally require a bit more customization. For most users, zap's Config +// struct strikes the right balance between flexibility and convenience. See +// the package-level BasicConfiguration example for sample code. +// +// More unusual configurations (splitting output between files, sending logs +// to a message queue, etc.) are possible, but require direct use of +// go.uber.org/zap/zapcore. See the package-level AdvancedConfiguration +// example for sample code. +// +// Extending Zap +// +// The zap package itself is a relatively thin wrapper around the interfaces +// in go.uber.org/zap/zapcore. Extending zap to support a new encoding (e.g., +// BSON), a new log sink (e.g., Kafka), or something more exotic (perhaps an +// exception aggregation service, like Sentry or Rollbar) typically requires +// implementing the zapcore.Encoder, zapcore.WriteSyncer, or zapcore.Core +// interfaces. See the zapcore documentation for details. +// +// Similarly, package authors can use the high-performance Encoder and Core +// implementations in the zapcore package to build their own loggers. +// +// Frequently Asked Questions +// +// An FAQ covering everything from installation errors to design decisions is +// available at https://github.com/uber-go/zap/blob/master/FAQ.md. +package zap // import "go.uber.org/zap" diff --git a/vendor/go.uber.org/zap/encoder.go b/vendor/go.uber.org/zap/encoder.go new file mode 100644 index 000000000..2e9d3c341 --- /dev/null +++ b/vendor/go.uber.org/zap/encoder.go @@ -0,0 +1,75 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "errors" + "fmt" + "sync" + + "go.uber.org/zap/zapcore" +) + +var ( + errNoEncoderNameSpecified = errors.New("no encoder name specified") + + _encoderNameToConstructor = map[string]func(zapcore.EncoderConfig) (zapcore.Encoder, error){ + "console": func(encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) { + return zapcore.NewConsoleEncoder(encoderConfig), nil + }, + "json": func(encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) { + return zapcore.NewJSONEncoder(encoderConfig), nil + }, + } + _encoderMutex sync.RWMutex +) + +// RegisterEncoder registers an encoder constructor, which the Config struct +// can then reference. By default, the "json" and "console" encoders are +// registered. +// +// Attempting to register an encoder whose name is already taken returns an +// error. +func RegisterEncoder(name string, constructor func(zapcore.EncoderConfig) (zapcore.Encoder, error)) error { + _encoderMutex.Lock() + defer _encoderMutex.Unlock() + if name == "" { + return errNoEncoderNameSpecified + } + if _, ok := _encoderNameToConstructor[name]; ok { + return fmt.Errorf("encoder already registered for name %q", name) + } + _encoderNameToConstructor[name] = constructor + return nil +} + +func newEncoder(name string, encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error) { + _encoderMutex.RLock() + defer _encoderMutex.RUnlock() + if name == "" { + return nil, errNoEncoderNameSpecified + } + constructor, ok := _encoderNameToConstructor[name] + if !ok { + return nil, fmt.Errorf("no encoder registered for name %q", name) + } + return constructor(encoderConfig) +} diff --git a/vendor/go.uber.org/zap/encoder_test.go b/vendor/go.uber.org/zap/encoder_test.go new file mode 100644 index 000000000..f6be665b1 --- /dev/null +++ b/vendor/go.uber.org/zap/encoder_test.go @@ -0,0 +1,88 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "testing" + + "go.uber.org/zap/zapcore" + + "github.com/stretchr/testify/assert" +) + +func TestRegisterDefaultEncoders(t *testing.T) { + testEncodersRegistered(t, "console", "json") +} + +func TestRegisterEncoder(t *testing.T) { + testEncoders(func() { + assert.NoError(t, RegisterEncoder("foo", newNilEncoder), "expected to be able to register the encoder foo") + testEncodersRegistered(t, "foo") + }) +} + +func TestDuplicateRegisterEncoder(t *testing.T) { + testEncoders(func() { + RegisterEncoder("foo", newNilEncoder) + assert.Error(t, RegisterEncoder("foo", newNilEncoder), "expected an error when registering an encoder with the same name twice") + }) +} + +func TestRegisterEncoderNoName(t *testing.T) { + assert.Equal(t, errNoEncoderNameSpecified, RegisterEncoder("", newNilEncoder), "expected an error when registering an encoder with no name") +} + +func TestNewEncoder(t *testing.T) { + testEncoders(func() { + RegisterEncoder("foo", newNilEncoder) + encoder, err := newEncoder("foo", zapcore.EncoderConfig{}) + assert.NoError(t, err, "could not create an encoder for the registered name foo") + assert.Nil(t, encoder, "the encoder from newNilEncoder is not nil") + }) +} + +func TestNewEncoderNotRegistered(t *testing.T) { + _, err := newEncoder("foo", zapcore.EncoderConfig{}) + assert.Error(t, err, "expected an error when trying to create an encoder of an unregistered name") +} + +func TestNewEncoderNoName(t *testing.T) { + _, err := newEncoder("", zapcore.EncoderConfig{}) + assert.Equal(t, errNoEncoderNameSpecified, err, "expected an error when creating an encoder with no name") +} + +func testEncoders(f func()) { + existing := _encoderNameToConstructor + _encoderNameToConstructor = make(map[string]func(zapcore.EncoderConfig) (zapcore.Encoder, error)) + defer func() { _encoderNameToConstructor = existing }() + f() +} + +func testEncodersRegistered(t *testing.T, names ...string) { + assert.Len(t, _encoderNameToConstructor, len(names), "the expected number of registered encoders does not match the actual number") + for _, name := range names { + assert.NotNil(t, _encoderNameToConstructor[name], "no encoder is registered for name %s", name) + } +} + +func newNilEncoder(_ zapcore.EncoderConfig) (zapcore.Encoder, error) { + return nil, nil +} diff --git a/vendor/go.uber.org/zap/error.go b/vendor/go.uber.org/zap/error.go new file mode 100644 index 000000000..65982a51e --- /dev/null +++ b/vendor/go.uber.org/zap/error.go @@ -0,0 +1,80 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "sync" + + "go.uber.org/zap/zapcore" +) + +var _errArrayElemPool = sync.Pool{New: func() interface{} { + return &errArrayElem{} +}} + +// Error is shorthand for the common idiom NamedError("error", err). +func Error(err error) Field { + return NamedError("error", err) +} + +// NamedError constructs a field that lazily stores err.Error() under the +// provided key. Errors which also implement fmt.Formatter (like those produced +// by github.com/pkg/errors) will also have their verbose representation stored +// under key+"Verbose". If passed a nil error, the field is a no-op. +// +// For the common case in which the key is simply "error", the Error function +// is shorter and less repetitive. +func NamedError(key string, err error) Field { + if err == nil { + return Skip() + } + return Field{Key: key, Type: zapcore.ErrorType, Interface: err} +} + +type errArray []error + +func (errs errArray) MarshalLogArray(arr zapcore.ArrayEncoder) error { + for i := range errs { + if errs[i] == nil { + continue + } + // To represent each error as an object with an "error" attribute and + // potentially an "errorVerbose" attribute, we need to wrap it in a + // type that implements LogObjectMarshaler. To prevent this from + // allocating, pool the wrapper type. + elem := _errArrayElemPool.Get().(*errArrayElem) + elem.error = errs[i] + arr.AppendObject(elem) + elem.error = nil + _errArrayElemPool.Put(elem) + } + return nil +} + +type errArrayElem struct { + error +} + +func (e *errArrayElem) MarshalLogObject(enc zapcore.ObjectEncoder) error { + // Re-use the error field's logic, which supports non-standard error types. + Error(e.error).AddTo(enc) + return nil +} diff --git a/vendor/go.uber.org/zap/error_test.go b/vendor/go.uber.org/zap/error_test.go new file mode 100644 index 000000000..674b1596a --- /dev/null +++ b/vendor/go.uber.org/zap/error_test.go @@ -0,0 +1,99 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "errors" + "testing" + + "go.uber.org/zap/zapcore" + + richErrors "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestErrorConstructors(t *testing.T) { + fail := errors.New("fail") + + tests := []struct { + name string + field Field + expect Field + }{ + {"Error", Skip(), Error(nil)}, + {"Error", Field{Key: "error", Type: zapcore.ErrorType, Interface: fail}, Error(fail)}, + {"NamedError", Skip(), NamedError("foo", nil)}, + {"NamedError", Field{Key: "foo", Type: zapcore.ErrorType, Interface: fail}, NamedError("foo", fail)}, + {"Any:Error", Any("k", errors.New("v")), NamedError("k", errors.New("v"))}, + {"Any:Errors", Any("k", []error{errors.New("v")}), Errors("k", []error{errors.New("v")})}, + } + + for _, tt := range tests { + if !assert.Equal(t, tt.expect, tt.field, "Unexpected output from convenience field constructor %s.", tt.name) { + t.Logf("type expected: %T\nGot: %T", tt.expect.Interface, tt.field.Interface) + } + assertCanBeReused(t, tt.field) + } +} + +func TestErrorArrayConstructor(t *testing.T) { + tests := []struct { + desc string + field Field + expected []interface{} + }{ + {"empty errors", Errors("", []error{}), []interface{}{}}, + { + "errors", + Errors("", []error{nil, errors.New("foo"), nil, errors.New("bar")}), + []interface{}{map[string]interface{}{"error": "foo"}, map[string]interface{}{"error": "bar"}}, + }, + } + + for _, tt := range tests { + enc := zapcore.NewMapObjectEncoder() + tt.field.Key = "k" + tt.field.AddTo(enc) + assert.Equal(t, tt.expected, enc.Fields["k"], "%s: unexpected map contents.", tt.desc) + assert.Equal(t, 1, len(enc.Fields), "%s: found extra keys in map: %v", tt.desc, enc.Fields) + } +} + +func TestErrorsArraysHandleRichErrors(t *testing.T) { + errs := []error{richErrors.New("egad")} + + enc := zapcore.NewMapObjectEncoder() + Errors("k", errs).AddTo(enc) + assert.Equal(t, 1, len(enc.Fields), "Expected only top-level field.") + + val := enc.Fields["k"] + arr, ok := val.([]interface{}) + require.True(t, ok, "Expected top-level field to be an array.") + require.Equal(t, 1, len(arr), "Expected only one error object in array.") + + serialized := arr[0] + errMap, ok := serialized.(map[string]interface{}) + require.True(t, ok, "Expected serialized error to be a map, got %T.", serialized) + assert.Equal(t, "egad", errMap["error"], "Unexpected standard error string.") + assert.Contains(t, errMap["errorVerbose"], "egad", "Verbose error string should be a superset of standard error.") + assert.Contains(t, errMap["errorVerbose"], "TestErrorsArraysHandleRichErrors", "Verbose error string should contain a stacktrace.") +} diff --git a/vendor/go.uber.org/zap/example_test.go b/vendor/go.uber.org/zap/example_test.go new file mode 100644 index 000000000..b61f153de --- /dev/null +++ b/vendor/go.uber.org/zap/example_test.go @@ -0,0 +1,327 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap_test + +import ( + "encoding/json" + "io/ioutil" + "log" + "os" + "time" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +func Example_presets() { + // Using zap's preset constructors is the simplest way to get a feel for the + // package, but they don't allow much customization. + logger := zap.NewExample() // or NewProduction, or NewDevelopment + defer logger.Sync() + + const url = "http://example.com" + + // In most circumstances, use the SugaredLogger. It's 4-10x faster than most + // other structured logging packages and has a familiar, loosely-typed API. + sugar := logger.Sugar() + sugar.Infow("Failed to fetch URL.", + // Structured context as loosely typed key-value pairs. + "url", url, + "attempt", 3, + "backoff", time.Second, + ) + sugar.Infof("Failed to fetch URL: %s", url) + + // In the unusual situations where every microsecond matters, use the + // Logger. It's even faster than the SugaredLogger, but only supports + // structured logging. + logger.Info("Failed to fetch URL.", + // Structured context as strongly typed fields. + zap.String("url", url), + zap.Int("attempt", 3), + zap.Duration("backoff", time.Second), + ) + // Output: + // {"level":"info","msg":"Failed to fetch URL.","url":"http://example.com","attempt":3,"backoff":"1s"} + // {"level":"info","msg":"Failed to fetch URL: http://example.com"} + // {"level":"info","msg":"Failed to fetch URL.","url":"http://example.com","attempt":3,"backoff":"1s"} +} + +func Example_basicConfiguration() { + // For some users, the presets offered by the NewProduction, NewDevelopment, + // and NewExample constructors won't be appropriate. For most of those + // users, the bundled Config struct offers the right balance of flexibility + // and convenience. (For more complex needs, see the AdvancedConfiguration + // example.) + // + // See the documentation for Config and zapcore.EncoderConfig for all the + // available options. + rawJSON := []byte(`{ + "level": "debug", + "encoding": "json", + "outputPaths": ["stdout", "/tmp/logs"], + "errorOutputPaths": ["stderr"], + "initialFields": {"foo": "bar"}, + "encoderConfig": { + "messageKey": "message", + "levelKey": "level", + "levelEncoder": "lowercase" + } + }`) + + var cfg zap.Config + if err := json.Unmarshal(rawJSON, &cfg); err != nil { + panic(err) + } + logger, err := cfg.Build() + if err != nil { + panic(err) + } + defer logger.Sync() + + logger.Info("logger construction succeeded") + // Output: + // {"level":"info","message":"logger construction succeeded","foo":"bar"} +} + +func Example_advancedConfiguration() { + // The bundled Config struct only supports the most common configuration + // options. More complex needs, like splitting logs between multiple files + // or writing to non-file outputs, require use of the zapcore package. + // + // In this example, imagine we're both sending our logs to Kafka and writing + // them to the console. We'd like to encode the console output and the Kafka + // topics differently, and we'd also like special treatment for + // high-priority logs. + + // First, define our level-handling logic. + highPriority := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool { + return lvl >= zapcore.ErrorLevel + }) + lowPriority := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool { + return lvl < zapcore.ErrorLevel + }) + + // Assume that we have clients for two Kafka topics. The clients implement + // zapcore.WriteSyncer and are safe for concurrent use. (If they only + // implement io.Writer, we can use zapcore.AddSync to add a no-op Sync + // method. If they're not safe for concurrent use, we can add a protecting + // mutex with zapcore.Lock.) + topicDebugging := zapcore.AddSync(ioutil.Discard) + topicErrors := zapcore.AddSync(ioutil.Discard) + + // High-priority output should also go to standard error, and low-priority + // output should also go to standard out. + consoleDebugging := zapcore.Lock(os.Stdout) + consoleErrors := zapcore.Lock(os.Stderr) + + // Optimize the Kafka output for machine consumption and the console output + // for human operators. + kafkaEncoder := zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()) + consoleEncoder := zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()) + + // Join the outputs, encoders, and level-handling functions into + // zapcore.Cores, then tee the four cores together. + core := zapcore.NewTee( + zapcore.NewCore(kafkaEncoder, topicErrors, highPriority), + zapcore.NewCore(consoleEncoder, consoleErrors, highPriority), + zapcore.NewCore(kafkaEncoder, topicDebugging, lowPriority), + zapcore.NewCore(consoleEncoder, consoleDebugging, lowPriority), + ) + + // From a zapcore.Core, it's easy to construct a Logger. + logger := zap.New(core) + defer logger.Sync() + logger.Info("constructed a logger") +} + +func ExampleNamespace() { + logger := zap.NewExample() + defer logger.Sync() + + logger.With( + zap.Namespace("metrics"), + zap.Int("counter", 1), + ).Info("tracked some metrics") + // Output: + // {"level":"info","msg":"tracked some metrics","metrics":{"counter":1}} +} + +func ExampleNewStdLog() { + logger := zap.NewExample() + defer logger.Sync() + + std := zap.NewStdLog(logger) + std.Print("standard logger wrapper") + // Output: + // {"level":"info","msg":"standard logger wrapper"} +} + +func ExampleRedirectStdLog() { + logger := zap.NewExample() + defer logger.Sync() + + undo := zap.RedirectStdLog(logger) + defer undo() + + log.Print("redirected standard library") + // Output: + // {"level":"info","msg":"redirected standard library"} +} + +func ExampleReplaceGlobals() { + logger := zap.NewExample() + defer logger.Sync() + + undo := zap.ReplaceGlobals(logger) + defer undo() + + zap.L().Info("replaced zap's global loggers") + // Output: + // {"level":"info","msg":"replaced zap's global loggers"} +} + +func ExampleAtomicLevel() { + atom := zap.NewAtomicLevel() + + // To keep the example deterministic, disable timestamps in the output. + encoderCfg := zap.NewProductionEncoderConfig() + encoderCfg.TimeKey = "" + + logger := zap.New(zapcore.NewCore( + zapcore.NewJSONEncoder(encoderCfg), + zapcore.Lock(os.Stdout), + atom, + )) + defer logger.Sync() + + logger.Info("info logging enabled") + + atom.SetLevel(zap.ErrorLevel) + logger.Info("info logging disabled") + // Output: + // {"level":"info","msg":"info logging enabled"} +} + +func ExampleAtomicLevel_config() { + // The zap.Config struct includes an AtomicLevel. To use it, keep a + // reference to the Config. + rawJSON := []byte(`{ + "level": "info", + "outputPaths": ["stdout"], + "errorOutputPaths": ["stderr"], + "encoding": "json", + "encoderConfig": { + "messageKey": "message", + "levelKey": "level", + "levelEncoder": "lowercase" + } + }`) + var cfg zap.Config + if err := json.Unmarshal(rawJSON, &cfg); err != nil { + panic(err) + } + logger, err := cfg.Build() + if err != nil { + panic(err) + } + defer logger.Sync() + + logger.Info("info logging enabled") + + cfg.Level.SetLevel(zap.ErrorLevel) + logger.Info("info logging disabled") + // Output: + // {"level":"info","message":"info logging enabled"} +} + +func ExampleLogger_Check() { + logger := zap.NewExample() + defer logger.Sync() + + if ce := logger.Check(zap.DebugLevel, "debugging"); ce != nil { + // If debug-level log output isn't enabled or if zap's sampling would have + // dropped this log entry, we don't allocate the slice that holds these + // fields. + ce.Write( + zap.String("foo", "bar"), + zap.String("baz", "quux"), + ) + } + + // Output: + // {"level":"debug","msg":"debugging","foo":"bar","baz":"quux"} +} + +func ExampleLogger_Named() { + logger := zap.NewExample() + defer logger.Sync() + + // By default, Loggers are unnamed. + logger.Info("no name") + + // The first call to Named sets the Logger name. + main := logger.Named("main") + main.Info("main logger") + + // Additional calls to Named create a period-separated path. + main.Named("subpackage").Info("sub-logger") + // Output: + // {"level":"info","msg":"no name"} + // {"level":"info","logger":"main","msg":"main logger"} + // {"level":"info","logger":"main.subpackage","msg":"sub-logger"} +} + +func ExampleWrapCore_replace() { + // Replacing a Logger's core can alter fundamental behaviors. For example, + // example, it can convert a Logger to a no-op. + nop := zap.WrapCore(func(zapcore.Core) zapcore.Core { + return zapcore.NewNopCore() + }) + + logger := zap.NewExample() + defer logger.Sync() + + logger.Info("working") + logger.WithOptions(nop).Info("no-op") + logger.Info("original logger still works") + // Output: + // {"level":"info","msg":"working"} + // {"level":"info","msg":"original logger still works"} +} + +func ExampleWrapCore_wrap() { + // Wrapping a Logger's core can extend its functionality. As a trivial + // example, it can double-write all logs. + doubled := zap.WrapCore(func(c zapcore.Core) zapcore.Core { + return zapcore.NewTee(c, c) + }) + + logger := zap.NewExample() + defer logger.Sync() + + logger.Info("single") + logger.WithOptions(doubled).Info("doubled") + // Output: + // {"level":"info","msg":"single"} + // {"level":"info","msg":"doubled"} + // {"level":"info","msg":"doubled"} +} diff --git a/vendor/go.uber.org/zap/field.go b/vendor/go.uber.org/zap/field.go new file mode 100644 index 000000000..5130e1347 --- /dev/null +++ b/vendor/go.uber.org/zap/field.go @@ -0,0 +1,310 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "fmt" + "math" + "time" + + "go.uber.org/zap/zapcore" +) + +// Field is an alias for Field. Aliasing this type dramatically +// improves the navigability of this package's API documentation. +type Field = zapcore.Field + +// Skip constructs a no-op field, which is often useful when handling invalid +// inputs in other Field constructors. +func Skip() Field { + return Field{Type: zapcore.SkipType} +} + +// Binary constructs a field that carries an opaque binary blob. +// +// Binary data is serialized in an encoding-appropriate format. For example, +// zap's JSON encoder base64-encodes binary blobs. To log UTF-8 encoded text, +// use ByteString. +func Binary(key string, val []byte) Field { + return Field{Key: key, Type: zapcore.BinaryType, Interface: val} +} + +// Bool constructs a field that carries a bool. +func Bool(key string, val bool) Field { + var ival int64 + if val { + ival = 1 + } + return Field{Key: key, Type: zapcore.BoolType, Integer: ival} +} + +// ByteString constructs a field that carries UTF-8 encoded text as a []byte. +// To log opaque binary blobs (which aren't necessarily valid UTF-8), use +// Binary. +func ByteString(key string, val []byte) Field { + return Field{Key: key, Type: zapcore.ByteStringType, Interface: val} +} + +// Complex128 constructs a field that carries a complex number. Unlike most +// numeric fields, this costs an allocation (to convert the complex128 to +// interface{}). +func Complex128(key string, val complex128) Field { + return Field{Key: key, Type: zapcore.Complex128Type, Interface: val} +} + +// Complex64 constructs a field that carries a complex number. Unlike most +// numeric fields, this costs an allocation (to convert the complex64 to +// interface{}). +func Complex64(key string, val complex64) Field { + return Field{Key: key, Type: zapcore.Complex64Type, Interface: val} +} + +// Float64 constructs a field that carries a float64. The way the +// floating-point value is represented is encoder-dependent, so marshaling is +// necessarily lazy. +func Float64(key string, val float64) Field { + return Field{Key: key, Type: zapcore.Float64Type, Integer: int64(math.Float64bits(val))} +} + +// Float32 constructs a field that carries a float32. The way the +// floating-point value is represented is encoder-dependent, so marshaling is +// necessarily lazy. +func Float32(key string, val float32) Field { + return Field{Key: key, Type: zapcore.Float32Type, Integer: int64(math.Float32bits(val))} +} + +// Int constructs a field with the given key and value. +func Int(key string, val int) Field { + return Int64(key, int64(val)) +} + +// Int64 constructs a field with the given key and value. +func Int64(key string, val int64) Field { + return Field{Key: key, Type: zapcore.Int64Type, Integer: val} +} + +// Int32 constructs a field with the given key and value. +func Int32(key string, val int32) Field { + return Field{Key: key, Type: zapcore.Int32Type, Integer: int64(val)} +} + +// Int16 constructs a field with the given key and value. +func Int16(key string, val int16) Field { + return Field{Key: key, Type: zapcore.Int16Type, Integer: int64(val)} +} + +// Int8 constructs a field with the given key and value. +func Int8(key string, val int8) Field { + return Field{Key: key, Type: zapcore.Int8Type, Integer: int64(val)} +} + +// String constructs a field with the given key and value. +func String(key string, val string) Field { + return Field{Key: key, Type: zapcore.StringType, String: val} +} + +// Uint constructs a field with the given key and value. +func Uint(key string, val uint) Field { + return Uint64(key, uint64(val)) +} + +// Uint64 constructs a field with the given key and value. +func Uint64(key string, val uint64) Field { + return Field{Key: key, Type: zapcore.Uint64Type, Integer: int64(val)} +} + +// Uint32 constructs a field with the given key and value. +func Uint32(key string, val uint32) Field { + return Field{Key: key, Type: zapcore.Uint32Type, Integer: int64(val)} +} + +// Uint16 constructs a field with the given key and value. +func Uint16(key string, val uint16) Field { + return Field{Key: key, Type: zapcore.Uint16Type, Integer: int64(val)} +} + +// Uint8 constructs a field with the given key and value. +func Uint8(key string, val uint8) Field { + return Field{Key: key, Type: zapcore.Uint8Type, Integer: int64(val)} +} + +// Uintptr constructs a field with the given key and value. +func Uintptr(key string, val uintptr) Field { + return Field{Key: key, Type: zapcore.UintptrType, Integer: int64(val)} +} + +// Reflect constructs a field with the given key and an arbitrary object. It uses +// an encoding-appropriate, reflection-based function to lazily serialize nearly +// any object into the logging context, but it's relatively slow and +// allocation-heavy. Outside tests, Any is always a better choice. +// +// If encoding fails (e.g., trying to serialize a map[int]string to JSON), Reflect +// includes the error message in the final log output. +func Reflect(key string, val interface{}) Field { + return Field{Key: key, Type: zapcore.ReflectType, Interface: val} +} + +// Namespace creates a named, isolated scope within the logger's context. All +// subsequent fields will be added to the new namespace. +// +// This helps prevent key collisions when injecting loggers into sub-components +// or third-party libraries. +func Namespace(key string) Field { + return Field{Key: key, Type: zapcore.NamespaceType} +} + +// Stringer constructs a field with the given key and the output of the value's +// String method. The Stringer's String method is called lazily. +func Stringer(key string, val fmt.Stringer) Field { + return Field{Key: key, Type: zapcore.StringerType, Interface: val} +} + +// Time constructs a Field with the given key and value. The encoder +// controls how the time is serialized. +func Time(key string, val time.Time) Field { + return Field{Key: key, Type: zapcore.TimeType, Integer: val.UnixNano(), Interface: val.Location()} +} + +// Stack constructs a field that stores a stacktrace of the current goroutine +// under provided key. Keep in mind that taking a stacktrace is eager and +// expensive (relatively speaking); this function both makes an allocation and +// takes about two microseconds. +func Stack(key string) Field { + // Returning the stacktrace as a string costs an allocation, but saves us + // from expanding the zapcore.Field union struct to include a byte slice. Since + // taking a stacktrace is already so expensive (~10us), the extra allocation + // is okay. + return String(key, takeStacktrace()) +} + +// Duration constructs a field with the given key and value. The encoder +// controls how the duration is serialized. +func Duration(key string, val time.Duration) Field { + return Field{Key: key, Type: zapcore.DurationType, Integer: int64(val)} +} + +// Object constructs a field with the given key and ObjectMarshaler. It +// provides a flexible, but still type-safe and efficient, way to add map- or +// struct-like user-defined types to the logging context. The struct's +// MarshalLogObject method is called lazily. +func Object(key string, val zapcore.ObjectMarshaler) Field { + return Field{Key: key, Type: zapcore.ObjectMarshalerType, Interface: val} +} + +// Any takes a key and an arbitrary value and chooses the best way to represent +// them as a field, falling back to a reflection-based approach only if +// necessary. +// +// Since byte/uint8 and rune/int32 are aliases, Any can't differentiate between +// them. To minimize surprises, []byte values are treated as binary blobs, byte +// values are treated as uint8, and runes are always treated as integers. +func Any(key string, value interface{}) Field { + switch val := value.(type) { + case zapcore.ObjectMarshaler: + return Object(key, val) + case zapcore.ArrayMarshaler: + return Array(key, val) + case bool: + return Bool(key, val) + case []bool: + return Bools(key, val) + case complex128: + return Complex128(key, val) + case []complex128: + return Complex128s(key, val) + case complex64: + return Complex64(key, val) + case []complex64: + return Complex64s(key, val) + case float64: + return Float64(key, val) + case []float64: + return Float64s(key, val) + case float32: + return Float32(key, val) + case []float32: + return Float32s(key, val) + case int: + return Int(key, val) + case []int: + return Ints(key, val) + case int64: + return Int64(key, val) + case []int64: + return Int64s(key, val) + case int32: + return Int32(key, val) + case []int32: + return Int32s(key, val) + case int16: + return Int16(key, val) + case []int16: + return Int16s(key, val) + case int8: + return Int8(key, val) + case []int8: + return Int8s(key, val) + case string: + return String(key, val) + case []string: + return Strings(key, val) + case uint: + return Uint(key, val) + case []uint: + return Uints(key, val) + case uint64: + return Uint64(key, val) + case []uint64: + return Uint64s(key, val) + case uint32: + return Uint32(key, val) + case []uint32: + return Uint32s(key, val) + case uint16: + return Uint16(key, val) + case []uint16: + return Uint16s(key, val) + case uint8: + return Uint8(key, val) + case []byte: + return Binary(key, val) + case uintptr: + return Uintptr(key, val) + case []uintptr: + return Uintptrs(key, val) + case time.Time: + return Time(key, val) + case []time.Time: + return Times(key, val) + case time.Duration: + return Duration(key, val) + case []time.Duration: + return Durations(key, val) + case error: + return NamedError(key, val) + case []error: + return Errors(key, val) + case fmt.Stringer: + return Stringer(key, val) + default: + return Reflect(key, val) + } +} diff --git a/vendor/go.uber.org/zap/field_test.go b/vendor/go.uber.org/zap/field_test.go new file mode 100644 index 000000000..069bfe372 --- /dev/null +++ b/vendor/go.uber.org/zap/field_test.go @@ -0,0 +1,159 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "net" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "go.uber.org/zap/zapcore" +) + +type username string + +func (n username) MarshalLogObject(enc zapcore.ObjectEncoder) error { + enc.AddString("username", string(n)) + return nil +} + +func assertCanBeReused(t testing.TB, field Field) { + var wg sync.WaitGroup + + for i := 0; i < 100; i++ { + enc := zapcore.NewMapObjectEncoder() + + // Ensure using the field in multiple encoders in separate goroutines + // does not cause any races or panics. + wg.Add(1) + go func() { + defer wg.Done() + assert.NotPanics(t, func() { + field.AddTo(enc) + }, "Reusing a field should not cause issues") + }() + } + + wg.Wait() +} + +func TestFieldConstructors(t *testing.T) { + // Interface types. + addr := net.ParseIP("1.2.3.4") + name := username("phil") + ints := []int{5, 6} + + tests := []struct { + name string + field Field + expect Field + }{ + {"Skip", Field{Type: zapcore.SkipType}, Skip()}, + {"Binary", Field{Key: "k", Type: zapcore.BinaryType, Interface: []byte("ab12")}, Binary("k", []byte("ab12"))}, + {"Bool", Field{Key: "k", Type: zapcore.BoolType, Integer: 1}, Bool("k", true)}, + {"Bool", Field{Key: "k", Type: zapcore.BoolType, Integer: 1}, Bool("k", true)}, + {"ByteString", Field{Key: "k", Type: zapcore.ByteStringType, Interface: []byte("ab12")}, ByteString("k", []byte("ab12"))}, + {"Complex128", Field{Key: "k", Type: zapcore.Complex128Type, Interface: 1 + 2i}, Complex128("k", 1+2i)}, + {"Complex64", Field{Key: "k", Type: zapcore.Complex64Type, Interface: complex64(1 + 2i)}, Complex64("k", 1+2i)}, + {"Duration", Field{Key: "k", Type: zapcore.DurationType, Integer: 1}, Duration("k", 1)}, + {"Int", Field{Key: "k", Type: zapcore.Int64Type, Integer: 1}, Int("k", 1)}, + {"Int64", Field{Key: "k", Type: zapcore.Int64Type, Integer: 1}, Int64("k", 1)}, + {"Int32", Field{Key: "k", Type: zapcore.Int32Type, Integer: 1}, Int32("k", 1)}, + {"Int16", Field{Key: "k", Type: zapcore.Int16Type, Integer: 1}, Int16("k", 1)}, + {"Int8", Field{Key: "k", Type: zapcore.Int8Type, Integer: 1}, Int8("k", 1)}, + {"String", Field{Key: "k", Type: zapcore.StringType, String: "foo"}, String("k", "foo")}, + {"Time", Field{Key: "k", Type: zapcore.TimeType, Integer: 0, Interface: time.UTC}, Time("k", time.Unix(0, 0).In(time.UTC))}, + {"Time", Field{Key: "k", Type: zapcore.TimeType, Integer: 1000, Interface: time.UTC}, Time("k", time.Unix(0, 1000).In(time.UTC))}, + {"Uint", Field{Key: "k", Type: zapcore.Uint64Type, Integer: 1}, Uint("k", 1)}, + {"Uint64", Field{Key: "k", Type: zapcore.Uint64Type, Integer: 1}, Uint64("k", 1)}, + {"Uint32", Field{Key: "k", Type: zapcore.Uint32Type, Integer: 1}, Uint32("k", 1)}, + {"Uint16", Field{Key: "k", Type: zapcore.Uint16Type, Integer: 1}, Uint16("k", 1)}, + {"Uint8", Field{Key: "k", Type: zapcore.Uint8Type, Integer: 1}, Uint8("k", 1)}, + {"Uintptr", Field{Key: "k", Type: zapcore.UintptrType, Integer: 10}, Uintptr("k", 0xa)}, + {"Reflect", Field{Key: "k", Type: zapcore.ReflectType, Interface: ints}, Reflect("k", ints)}, + {"Stringer", Field{Key: "k", Type: zapcore.StringerType, Interface: addr}, Stringer("k", addr)}, + {"Object", Field{Key: "k", Type: zapcore.ObjectMarshalerType, Interface: name}, Object("k", name)}, + {"Any:ObjectMarshaler", Any("k", name), Object("k", name)}, + {"Any:ArrayMarshaler", Any("k", bools([]bool{true})), Array("k", bools([]bool{true}))}, + {"Any:Stringer", Any("k", addr), Stringer("k", addr)}, + {"Any:Bool", Any("k", true), Bool("k", true)}, + {"Any:Bools", Any("k", []bool{true}), Bools("k", []bool{true})}, + {"Any:Byte", Any("k", byte(1)), Uint8("k", 1)}, + {"Any:Bytes", Any("k", []byte{1}), Binary("k", []byte{1})}, + {"Any:Complex128", Any("k", 1+2i), Complex128("k", 1+2i)}, + {"Any:Complex128s", Any("k", []complex128{1 + 2i}), Complex128s("k", []complex128{1 + 2i})}, + {"Any:Complex64", Any("k", complex64(1+2i)), Complex64("k", 1+2i)}, + {"Any:Complex64s", Any("k", []complex64{1 + 2i}), Complex64s("k", []complex64{1 + 2i})}, + {"Any:Float64", Any("k", 3.14), Float64("k", 3.14)}, + {"Any:Float64s", Any("k", []float64{3.14}), Float64s("k", []float64{3.14})}, + {"Any:Float32", Any("k", float32(3.14)), Float32("k", 3.14)}, + {"Any:Float32s", Any("k", []float32{3.14}), Float32s("k", []float32{3.14})}, + {"Any:Int", Any("k", 1), Int("k", 1)}, + {"Any:Ints", Any("k", []int{1}), Ints("k", []int{1})}, + {"Any:Int64", Any("k", int64(1)), Int64("k", 1)}, + {"Any:Int64s", Any("k", []int64{1}), Int64s("k", []int64{1})}, + {"Any:Int32", Any("k", int32(1)), Int32("k", 1)}, + {"Any:Int32s", Any("k", []int32{1}), Int32s("k", []int32{1})}, + {"Any:Int16", Any("k", int16(1)), Int16("k", 1)}, + {"Any:Int16s", Any("k", []int16{1}), Int16s("k", []int16{1})}, + {"Any:Int8", Any("k", int8(1)), Int8("k", 1)}, + {"Any:Int8s", Any("k", []int8{1}), Int8s("k", []int8{1})}, + {"Any:Rune", Any("k", rune(1)), Int32("k", 1)}, + {"Any:Runes", Any("k", []rune{1}), Int32s("k", []int32{1})}, + {"Any:String", Any("k", "v"), String("k", "v")}, + {"Any:Strings", Any("k", []string{"v"}), Strings("k", []string{"v"})}, + {"Any:Uint", Any("k", uint(1)), Uint("k", 1)}, + {"Any:Uints", Any("k", []uint{1}), Uints("k", []uint{1})}, + {"Any:Uint64", Any("k", uint64(1)), Uint64("k", 1)}, + {"Any:Uint64s", Any("k", []uint64{1}), Uint64s("k", []uint64{1})}, + {"Any:Uint32", Any("k", uint32(1)), Uint32("k", 1)}, + {"Any:Uint32s", Any("k", []uint32{1}), Uint32s("k", []uint32{1})}, + {"Any:Uint16", Any("k", uint16(1)), Uint16("k", 1)}, + {"Any:Uint16s", Any("k", []uint16{1}), Uint16s("k", []uint16{1})}, + {"Any:Uint8", Any("k", uint8(1)), Uint8("k", 1)}, + {"Any:Uint8s", Any("k", []uint8{1}), Binary("k", []uint8{1})}, + {"Any:Uintptr", Any("k", uintptr(1)), Uintptr("k", 1)}, + {"Any:Uintptrs", Any("k", []uintptr{1}), Uintptrs("k", []uintptr{1})}, + {"Any:Time", Any("k", time.Unix(0, 0)), Time("k", time.Unix(0, 0))}, + {"Any:Times", Any("k", []time.Time{time.Unix(0, 0)}), Times("k", []time.Time{time.Unix(0, 0)})}, + {"Any:Duration", Any("k", time.Second), Duration("k", time.Second)}, + {"Any:Durations", Any("k", []time.Duration{time.Second}), Durations("k", []time.Duration{time.Second})}, + {"Any:Fallback", Any("k", struct{}{}), Reflect("k", struct{}{})}, + {"Namespace", Namespace("k"), Field{Key: "k", Type: zapcore.NamespaceType}}, + } + + for _, tt := range tests { + if !assert.Equal(t, tt.expect, tt.field, "Unexpected output from convenience field constructor %s.", tt.name) { + t.Logf("type expected: %T\nGot: %T", tt.expect.Interface, tt.field.Interface) + } + assertCanBeReused(t, tt.field) + } +} + +func TestStackField(t *testing.T) { + f := Stack("stacktrace") + assert.Equal(t, "stacktrace", f.Key, "Unexpected field key.") + assert.Equal(t, zapcore.StringType, f.Type, "Unexpected field type.") + assert.Equal(t, takeStacktrace(), f.String, "Unexpected stack trace") + assertCanBeReused(t, f) +} diff --git a/vendor/go.uber.org/zap/flag.go b/vendor/go.uber.org/zap/flag.go new file mode 100644 index 000000000..131287507 --- /dev/null +++ b/vendor/go.uber.org/zap/flag.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "flag" + + "go.uber.org/zap/zapcore" +) + +// LevelFlag uses the standard library's flag.Var to declare a global flag +// with the specified name, default, and usage guidance. The returned value is +// a pointer to the value of the flag. +// +// If you don't want to use the flag package's global state, you can use any +// non-nil *Level as a flag.Value with your own *flag.FlagSet. +func LevelFlag(name string, defaultLevel zapcore.Level, usage string) *zapcore.Level { + lvl := defaultLevel + flag.Var(&lvl, name, usage) + return &lvl +} diff --git a/vendor/go.uber.org/zap/flag_test.go b/vendor/go.uber.org/zap/flag_test.go new file mode 100644 index 000000000..b1698944a --- /dev/null +++ b/vendor/go.uber.org/zap/flag_test.go @@ -0,0 +1,102 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "flag" + "io/ioutil" + "testing" + + "go.uber.org/zap/zapcore" + + "github.com/stretchr/testify/assert" +) + +type flagTestCase struct { + args []string + wantLevel zapcore.Level + wantErr bool +} + +func (tc flagTestCase) runImplicitSet(t testing.TB) { + origCommandLine := flag.CommandLine + flag.CommandLine = flag.NewFlagSet("test", flag.ContinueOnError) + flag.CommandLine.SetOutput(ioutil.Discard) + defer func() { flag.CommandLine = origCommandLine }() + + level := LevelFlag("level", InfoLevel, "") + tc.run(t, flag.CommandLine, level) +} + +func (tc flagTestCase) runExplicitSet(t testing.TB) { + var lvl zapcore.Level + set := flag.NewFlagSet("test", flag.ContinueOnError) + set.Var(&lvl, "level", "minimum enabled logging level") + tc.run(t, set, &lvl) +} + +func (tc flagTestCase) run(t testing.TB, set *flag.FlagSet, actual *zapcore.Level) { + err := set.Parse(tc.args) + if tc.wantErr { + assert.Error(t, err, "Parse(%v) should fail.", tc.args) + return + } + if assert.NoError(t, err, "Parse(%v) should succeed.", tc.args) { + assert.Equal(t, tc.wantLevel, *actual, "Level mismatch.") + } +} + +func TestLevelFlag(t *testing.T) { + tests := []flagTestCase{ + { + args: nil, + wantLevel: zapcore.InfoLevel, + }, + { + args: []string{"--level", "unknown"}, + wantErr: true, + }, + { + args: []string{"--level", "error"}, + wantLevel: zapcore.ErrorLevel, + }, + } + + for _, tt := range tests { + tt.runExplicitSet(t) + tt.runImplicitSet(t) + } +} + +func TestLevelFlagsAreIndependent(t *testing.T) { + origCommandLine := flag.CommandLine + flag.CommandLine = flag.NewFlagSet("test", flag.ContinueOnError) + flag.CommandLine.SetOutput(ioutil.Discard) + defer func() { flag.CommandLine = origCommandLine }() + + // Make sure that these two flags are independent. + fileLevel := LevelFlag("file-level", InfoLevel, "") + consoleLevel := LevelFlag("console-level", InfoLevel, "") + + assert.NoError(t, flag.CommandLine.Parse([]string{"-file-level", "debug"}), "Unexpected flag-parsing error.") + assert.Equal(t, InfoLevel, *consoleLevel, "Expected file logging level to remain unchanged.") + assert.Equal(t, DebugLevel, *fileLevel, "Expected console logging level to have changed.") +} diff --git a/vendor/go.uber.org/zap/glide.lock b/vendor/go.uber.org/zap/glide.lock new file mode 100644 index 000000000..881b462c0 --- /dev/null +++ b/vendor/go.uber.org/zap/glide.lock @@ -0,0 +1,76 @@ +hash: f073ba522c06c88ea3075bde32a8aaf0969a840a66cab6318a0897d141ffee92 +updated: 2017-07-22T18:06:49.598185334-07:00 +imports: +- name: go.uber.org/atomic + version: 4e336646b2ef9fc6e47be8e21594178f98e5ebcf +- name: go.uber.org/multierr + version: 3c4937480c32f4c13a875a1829af76c98ca3d40a +testImports: +- name: github.com/apex/log + version: d9b960447bfa720077b2da653cc79e533455b499 + subpackages: + - handlers/json +- name: github.com/axw/gocov + version: 3a69a0d2a4ef1f263e2d92b041a69593d6964fe8 + subpackages: + - gocov +- name: github.com/davecgh/go-spew + version: 04cdfd42973bb9c8589fd6a731800cf222fde1a9 + subpackages: + - spew +- name: github.com/fatih/color + version: 62e9147c64a1ed519147b62a56a14e83e2be02c1 +- name: github.com/go-kit/kit + version: e10f5bf035be9af21fd5b2fb4469d5716c6ab07d + subpackages: + - log +- name: github.com/go-logfmt/logfmt + version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5 +- name: github.com/go-stack/stack + version: 54be5f394ed2c3e19dac9134a40a95ba5a017f7b +- name: github.com/golang/lint + version: c5fb716d6688a859aae56d26d3e6070808df29f7 + subpackages: + - golint +- name: github.com/kr/logfmt + version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0 +- name: github.com/mattn/go-colorable + version: 3fa8c76f9daed4067e4a806fb7e4dc86455c6d6a +- name: github.com/mattn/go-isatty + version: fc9e8d8ef48496124e79ae0df75490096eccf6fe +- name: github.com/mattn/goveralls + version: 6efce81852ad1b7567c17ad71b03aeccc9dd9ae0 +- name: github.com/pborman/uuid + version: e790cca94e6cc75c7064b1332e63811d4aae1a53 +- name: github.com/pkg/errors + version: 645ef00459ed84a119197bfb8d8205042c6df63d +- name: github.com/pmezard/go-difflib + version: d8ed2627bdf02c080bf22230dbb337003b7aba2d + subpackages: + - difflib +- name: github.com/rs/zerolog + version: eed4c2b94d945e0b2456ad6aa518a443986b5f22 +- name: github.com/satori/go.uuid + version: 5bf94b69c6b68ee1b541973bb8e1144db23a194b +- name: github.com/sirupsen/logrus + version: 7dd06bf38e1e13df288d471a57d5adbac106be9e +- name: github.com/stretchr/testify + version: f6abca593680b2315d2075e0f5e2a9751e3f431a + subpackages: + - assert + - require +- name: go.pedge.io/lion + version: 87958e8713f1fa138d993087133b97e976642159 +- name: golang.org/x/sys + version: c4489faa6e5ab84c0ef40d6ee878f7a030281f0f + subpackages: + - unix +- name: golang.org/x/tools + version: 496819729719f9d07692195e0a94d6edd2251389 + subpackages: + - cover +- name: gopkg.in/inconshreveable/log15.v2 + version: b105bd37f74e5d9dc7b6ad7806715c7a2b83fd3f + subpackages: + - stack + - term diff --git a/vendor/go.uber.org/zap/glide.yaml b/vendor/go.uber.org/zap/glide.yaml new file mode 100644 index 000000000..94412594c --- /dev/null +++ b/vendor/go.uber.org/zap/glide.yaml @@ -0,0 +1,35 @@ +package: go.uber.org/zap +license: MIT +import: +- package: go.uber.org/atomic + version: ^1 +- package: go.uber.org/multierr + version: ^1 +testImport: +- package: github.com/satori/go.uuid +- package: github.com/sirupsen/logrus +- package: github.com/apex/log + subpackages: + - handlers/json +- package: github.com/go-kit/kit + subpackages: + - log +- package: github.com/stretchr/testify + subpackages: + - assert + - require +- package: gopkg.in/inconshreveable/log15.v2 +- package: github.com/mattn/goveralls +- package: github.com/pborman/uuid +- package: github.com/pkg/errors +- package: go.pedge.io/lion +- package: github.com/rs/zerolog +- package: golang.org/x/tools + subpackages: + - cover +- package: github.com/golang/lint + subpackages: + - golint +- package: github.com/axw/gocov + subpackages: + - gocov diff --git a/vendor/go.uber.org/zap/global.go b/vendor/go.uber.org/zap/global.go new file mode 100644 index 000000000..d02232e39 --- /dev/null +++ b/vendor/go.uber.org/zap/global.go @@ -0,0 +1,169 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "bytes" + "fmt" + "log" + "os" + "sync" + + "go.uber.org/zap/zapcore" +) + +const ( + _stdLogDefaultDepth = 2 + _loggerWriterDepth = 2 + _programmerErrorTemplate = "You've found a bug in zap! Please file a bug at " + + "https://github.com/uber-go/zap/issues/new and reference this error: %v" +) + +var ( + _globalMu sync.RWMutex + _globalL = NewNop() + _globalS = _globalL.Sugar() +) + +// L returns the global Logger, which can be reconfigured with ReplaceGlobals. +// It's safe for concurrent use. +func L() *Logger { + _globalMu.RLock() + l := _globalL + _globalMu.RUnlock() + return l +} + +// S returns the global SugaredLogger, which can be reconfigured with +// ReplaceGlobals. It's safe for concurrent use. +func S() *SugaredLogger { + _globalMu.RLock() + s := _globalS + _globalMu.RUnlock() + return s +} + +// ReplaceGlobals replaces the global Logger and SugaredLogger, and returns a +// function to restore the original values. It's safe for concurrent use. +func ReplaceGlobals(logger *Logger) func() { + _globalMu.Lock() + prev := _globalL + _globalL = logger + _globalS = logger.Sugar() + _globalMu.Unlock() + return func() { ReplaceGlobals(prev) } +} + +// NewStdLog returns a *log.Logger which writes to the supplied zap Logger at +// InfoLevel. To redirect the standard library's package-global logging +// functions, use RedirectStdLog instead. +func NewStdLog(l *Logger) *log.Logger { + logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth)) + f := logger.Info + return log.New(&loggerWriter{f}, "" /* prefix */, 0 /* flags */) +} + +// NewStdLogAt returns *log.Logger which writes to supplied zap logger at +// required level. +func NewStdLogAt(l *Logger, level zapcore.Level) (*log.Logger, error) { + logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth)) + logFunc, err := levelToFunc(logger, level) + if err != nil { + return nil, err + } + return log.New(&loggerWriter{logFunc}, "" /* prefix */, 0 /* flags */), nil +} + +// RedirectStdLog redirects output from the standard library's package-global +// logger to the supplied logger at InfoLevel. Since zap already handles caller +// annotations, timestamps, etc., it automatically disables the standard +// library's annotations and prefixing. +// +// It returns a function to restore the original prefix and flags and reset the +// standard library's output to os.Stderr. +func RedirectStdLog(l *Logger) func() { + f, err := redirectStdLogAt(l, InfoLevel) + if err != nil { + // Can't get here, since passing InfoLevel to redirectStdLogAt always + // works. + panic(fmt.Sprintf(_programmerErrorTemplate, err)) + } + return f +} + +// RedirectStdLogAt redirects output from the standard library's package-global +// logger to the supplied logger at the specified level. Since zap already +// handles caller annotations, timestamps, etc., it automatically disables the +// standard library's annotations and prefixing. +// +// It returns a function to restore the original prefix and flags and reset the +// standard library's output to os.Stderr. +func RedirectStdLogAt(l *Logger, level zapcore.Level) (func(), error) { + return redirectStdLogAt(l, level) +} + +func redirectStdLogAt(l *Logger, level zapcore.Level) (func(), error) { + flags := log.Flags() + prefix := log.Prefix() + log.SetFlags(0) + log.SetPrefix("") + logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth)) + logFunc, err := levelToFunc(logger, level) + if err != nil { + return nil, err + } + log.SetOutput(&loggerWriter{logFunc}) + return func() { + log.SetFlags(flags) + log.SetPrefix(prefix) + log.SetOutput(os.Stderr) + }, nil +} + +func levelToFunc(logger *Logger, lvl zapcore.Level) (func(string, ...Field), error) { + switch lvl { + case DebugLevel: + return logger.Debug, nil + case InfoLevel: + return logger.Info, nil + case WarnLevel: + return logger.Warn, nil + case ErrorLevel: + return logger.Error, nil + case DPanicLevel: + return logger.DPanic, nil + case PanicLevel: + return logger.Panic, nil + case FatalLevel: + return logger.Fatal, nil + } + return nil, fmt.Errorf("unrecognized level: %q", lvl) +} + +type loggerWriter struct { + logFunc func(msg string, fields ...Field) +} + +func (l *loggerWriter) Write(p []byte) (int, error) { + p = bytes.TrimSpace(p) + l.logFunc(string(p)) + return len(p), nil +} diff --git a/vendor/go.uber.org/zap/global_test.go b/vendor/go.uber.org/zap/global_test.go new file mode 100644 index 000000000..e169f5179 --- /dev/null +++ b/vendor/go.uber.org/zap/global_test.go @@ -0,0 +1,280 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "log" + "sync" + "testing" + "time" + + "go.uber.org/zap/internal/exit" + "go.uber.org/zap/internal/ztest" + + "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest/observer" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" +) + +func TestReplaceGlobals(t *testing.T) { + initialL := *L() + initialS := *S() + + withLogger(t, DebugLevel, nil, func(l *Logger, logs *observer.ObservedLogs) { + L().Info("no-op") + S().Info("no-op") + assert.Equal(t, 0, logs.Len(), "Expected initial logs to go to default no-op global.") + + defer ReplaceGlobals(l)() + + L().Info("captured") + S().Info("captured") + expected := observer.LoggedEntry{ + Entry: zapcore.Entry{Message: "captured"}, + Context: []Field{}, + } + assert.Equal( + t, + []observer.LoggedEntry{expected, expected}, + logs.AllUntimed(), + "Unexpected global log output.", + ) + }) + + assert.Equal(t, initialL, *L(), "Expected func returned from ReplaceGlobals to restore initial L.") + assert.Equal(t, initialS, *S(), "Expected func returned from ReplaceGlobals to restore initial S.") +} + +func TestGlobalsConcurrentUse(t *testing.T) { + var ( + stop atomic.Bool + wg sync.WaitGroup + ) + + for i := 0; i < 100; i++ { + wg.Add(2) + go func() { + for !stop.Load() { + ReplaceGlobals(NewNop()) + } + wg.Done() + }() + go func() { + for !stop.Load() { + L().With(Int("foo", 42)).Named("main").WithOptions(Development()).Info("") + S().Info("") + } + wg.Done() + }() + } + + ztest.Sleep(100 * time.Millisecond) + stop.Toggle() + wg.Wait() +} + +func TestNewStdLog(t *testing.T) { + withLogger(t, DebugLevel, []Option{AddCaller()}, func(l *Logger, logs *observer.ObservedLogs) { + std := NewStdLog(l) + std.Print("redirected") + checkStdLogMessage(t, "redirected", logs) + }) +} + +func TestNewStdLogAt(t *testing.T) { + // include DPanicLevel here, but do not include Development in options + levels := []zapcore.Level{DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel} + for _, level := range levels { + withLogger(t, DebugLevel, []Option{AddCaller()}, func(l *Logger, logs *observer.ObservedLogs) { + std, err := NewStdLogAt(l, level) + require.NoError(t, err, "Unexpected error.") + std.Print("redirected") + checkStdLogMessage(t, "redirected", logs) + }) + } +} + +func TestNewStdLogAtPanics(t *testing.T) { + // include DPanicLevel here and enable Development in options + levels := []zapcore.Level{DPanicLevel, PanicLevel} + for _, level := range levels { + withLogger(t, DebugLevel, []Option{AddCaller(), Development()}, func(l *Logger, logs *observer.ObservedLogs) { + std, err := NewStdLogAt(l, level) + require.NoError(t, err, "Unexpected error") + assert.Panics(t, func() { std.Print("redirected") }, "Expected log to panic.") + checkStdLogMessage(t, "redirected", logs) + }) + } +} + +func TestNewStdLogAtFatal(t *testing.T) { + withLogger(t, DebugLevel, []Option{AddCaller()}, func(l *Logger, logs *observer.ObservedLogs) { + stub := exit.WithStub(func() { + std, err := NewStdLogAt(l, FatalLevel) + require.NoError(t, err, "Unexpected error.") + std.Print("redirected") + checkStdLogMessage(t, "redirected", logs) + }) + assert.True(t, true, stub.Exited, "Expected Fatal logger call to terminate process.") + stub.Unstub() + }) +} + +func TestNewStdLogAtInvalid(t *testing.T) { + _, err := NewStdLogAt(NewNop(), zapcore.Level(99)) + assert.Error(t, err, "Expected to get error.") + assert.Contains(t, err.Error(), "99", "Expected level code in error message") +} + +func TestRedirectStdLog(t *testing.T) { + initialFlags := log.Flags() + initialPrefix := log.Prefix() + + withLogger(t, DebugLevel, nil, func(l *Logger, logs *observer.ObservedLogs) { + defer RedirectStdLog(l)() + log.Print("redirected") + + assert.Equal(t, []observer.LoggedEntry{{ + Entry: zapcore.Entry{Message: "redirected"}, + Context: []Field{}, + }}, logs.AllUntimed(), "Unexpected global log output.") + }) + + assert.Equal(t, initialFlags, log.Flags(), "Expected to reset initial flags.") + assert.Equal(t, initialPrefix, log.Prefix(), "Expected to reset initial prefix.") +} + +func TestRedirectStdLogCaller(t *testing.T) { + withLogger(t, DebugLevel, []Option{AddCaller()}, func(l *Logger, logs *observer.ObservedLogs) { + defer RedirectStdLog(l)() + log.Print("redirected") + entries := logs.All() + require.Len(t, entries, 1, "Unexpected number of logs.") + assert.Contains(t, entries[0].Entry.Caller.File, "global_test.go", "Unexpected caller annotation.") + }) +} + +func TestRedirectStdLogAt(t *testing.T) { + initialFlags := log.Flags() + initialPrefix := log.Prefix() + + // include DPanicLevel here, but do not include Development in options + levels := []zapcore.Level{DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel} + for _, level := range levels { + withLogger(t, DebugLevel, nil, func(l *Logger, logs *observer.ObservedLogs) { + restore, err := RedirectStdLogAt(l, level) + require.NoError(t, err, "Unexpected error.") + defer restore() + log.Print("redirected") + + assert.Equal(t, []observer.LoggedEntry{{ + Entry: zapcore.Entry{Level: level, Message: "redirected"}, + Context: []Field{}, + }}, logs.AllUntimed(), "Unexpected global log output.") + }) + } + + assert.Equal(t, initialFlags, log.Flags(), "Expected to reset initial flags.") + assert.Equal(t, initialPrefix, log.Prefix(), "Expected to reset initial prefix.") +} + +func TestRedirectStdLogAtCaller(t *testing.T) { + // include DPanicLevel here, but do not include Development in options + levels := []zapcore.Level{DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel} + for _, level := range levels { + withLogger(t, DebugLevel, []Option{AddCaller()}, func(l *Logger, logs *observer.ObservedLogs) { + restore, err := RedirectStdLogAt(l, level) + require.NoError(t, err, "Unexpected error.") + defer restore() + log.Print("redirected") + entries := logs.All() + require.Len(t, entries, 1, "Unexpected number of logs.") + assert.Contains(t, entries[0].Entry.Caller.File, "global_test.go", "Unexpected caller annotation.") + }) + } +} + +func TestRedirectStdLogAtPanics(t *testing.T) { + initialFlags := log.Flags() + initialPrefix := log.Prefix() + + // include DPanicLevel here and enable Development in options + levels := []zapcore.Level{DPanicLevel, PanicLevel} + for _, level := range levels { + withLogger(t, DebugLevel, []Option{AddCaller(), Development()}, func(l *Logger, logs *observer.ObservedLogs) { + restore, err := RedirectStdLogAt(l, level) + require.NoError(t, err, "Unexpected error.") + defer restore() + assert.Panics(t, func() { log.Print("redirected") }, "Expected log to panic.") + checkStdLogMessage(t, "redirected", logs) + }) + } + + assert.Equal(t, initialFlags, log.Flags(), "Expected to reset initial flags.") + assert.Equal(t, initialPrefix, log.Prefix(), "Expected to reset initial prefix.") +} + +func TestRedirectStdLogAtFatal(t *testing.T) { + initialFlags := log.Flags() + initialPrefix := log.Prefix() + + withLogger(t, DebugLevel, []Option{AddCaller()}, func(l *Logger, logs *observer.ObservedLogs) { + stub := exit.WithStub(func() { + restore, err := RedirectStdLogAt(l, FatalLevel) + require.NoError(t, err, "Unexpected error.") + defer restore() + log.Print("redirected") + checkStdLogMessage(t, "redirected", logs) + }) + assert.True(t, true, stub.Exited, "Expected Fatal logger call to terminate process.") + stub.Unstub() + }) + + assert.Equal(t, initialFlags, log.Flags(), "Expected to reset initial flags.") + assert.Equal(t, initialPrefix, log.Prefix(), "Expected to reset initial prefix.") +} + +func TestRedirectStdLogAtInvalid(t *testing.T) { + restore, err := RedirectStdLogAt(NewNop(), zapcore.Level(99)) + defer func() { + if restore != nil { + restore() + } + }() + require.Error(t, err, "Expected to get error.") + assert.Contains(t, err.Error(), "99", "Expected level code in error message") +} + +func checkStdLogMessage(t *testing.T, msg string, logs *observer.ObservedLogs) { + require.Equal(t, 1, logs.Len(), "Expected exactly one entry to be logged") + entry := logs.AllUntimed()[0] + assert.Equal(t, []Field{}, entry.Context, "Unexpected entry context.") + assert.Equal(t, "redirected", entry.Entry.Message, "Unexpected entry message.") + assert.Regexp( + t, + `go.uber.org/zap/global_test.go:\d+$`, + entry.Entry.Caller.String(), + "Unexpected caller annotation.", + ) +} diff --git a/vendor/go.uber.org/zap/http_handler.go b/vendor/go.uber.org/zap/http_handler.go new file mode 100644 index 000000000..1b0ecaca9 --- /dev/null +++ b/vendor/go.uber.org/zap/http_handler.go @@ -0,0 +1,81 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "encoding/json" + "fmt" + "net/http" + + "go.uber.org/zap/zapcore" +) + +// ServeHTTP is a simple JSON endpoint that can report on or change the current +// logging level. +// +// GET requests return a JSON description of the current logging level. PUT +// requests change the logging level and expect a payload like: +// {"level":"info"} +// +// It's perfectly safe to change the logging level while a program is running. +func (lvl AtomicLevel) ServeHTTP(w http.ResponseWriter, r *http.Request) { + type errorResponse struct { + Error string `json:"error"` + } + type payload struct { + Level *zapcore.Level `json:"level"` + } + + enc := json.NewEncoder(w) + + switch r.Method { + + case http.MethodGet: + current := lvl.Level() + enc.Encode(payload{Level: ¤t}) + + case http.MethodPut: + var req payload + + if errmess := func() string { + if err := json.NewDecoder(r.Body).Decode(&req); err != nil { + return fmt.Sprintf("Request body must be well-formed JSON: %v", err) + } + if req.Level == nil { + return "Must specify a logging level." + } + return "" + }(); errmess != "" { + w.WriteHeader(http.StatusBadRequest) + enc.Encode(errorResponse{Error: errmess}) + return + } + + lvl.SetLevel(*req.Level) + enc.Encode(req) + + default: + w.WriteHeader(http.StatusMethodNotAllowed) + enc.Encode(errorResponse{ + Error: "Only GET and PUT are supported.", + }) + } +} diff --git a/vendor/go.uber.org/zap/http_handler_test.go b/vendor/go.uber.org/zap/http_handler_test.go new file mode 100644 index 000000000..474b3c7cd --- /dev/null +++ b/vendor/go.uber.org/zap/http_handler_test.go @@ -0,0 +1,131 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap_test + +import ( + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/http/httptest" + "strings" + "testing" + + . "go.uber.org/zap" + "go.uber.org/zap/zapcore" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func newHandler() (AtomicLevel, *Logger) { + lvl := NewAtomicLevel() + logger := New(zapcore.NewNopCore()) + return lvl, logger +} + +func assertCodeOK(t testing.TB, code int) { + assert.Equal(t, http.StatusOK, code, "Unexpected response status code.") +} + +func assertCodeBadRequest(t testing.TB, code int) { + assert.Equal(t, http.StatusBadRequest, code, "Unexpected response status code.") +} + +func assertCodeMethodNotAllowed(t testing.TB, code int) { + assert.Equal(t, http.StatusMethodNotAllowed, code, "Unexpected response status code.") +} + +func assertResponse(t testing.TB, expectedLevel zapcore.Level, actualBody string) { + assert.Equal(t, fmt.Sprintf(`{"level":"%s"}`, expectedLevel)+"\n", actualBody, "Unexpected response body.") +} + +func assertJSONError(t testing.TB, body string) { + // Don't need to test exact error message, but one should be present. + var payload map[string]interface{} + require.NoError(t, json.Unmarshal([]byte(body), &payload), "Expected error response to be JSON.") + + msg, ok := payload["error"] + require.True(t, ok, "Error message is an unexpected type.") + assert.NotEqual(t, "", msg, "Expected an error message in response.") +} + +func makeRequest(t testing.TB, method string, handler http.Handler, reader io.Reader) (int, string) { + ts := httptest.NewServer(handler) + defer ts.Close() + + req, err := http.NewRequest(method, ts.URL, reader) + require.NoError(t, err, "Error constructing %s request.", method) + + res, err := http.DefaultClient.Do(req) + require.NoError(t, err, "Error making %s request.", method) + defer res.Body.Close() + + body, err := ioutil.ReadAll(res.Body) + require.NoError(t, err, "Error reading request body.") + + return res.StatusCode, string(body) +} + +func TestHTTPHandlerGetLevel(t *testing.T) { + lvl, _ := newHandler() + code, body := makeRequest(t, "GET", lvl, nil) + assertCodeOK(t, code) + assertResponse(t, lvl.Level(), body) +} + +func TestHTTPHandlerPutLevel(t *testing.T) { + lvl, _ := newHandler() + + code, body := makeRequest(t, "PUT", lvl, strings.NewReader(`{"level":"warn"}`)) + + assertCodeOK(t, code) + assertResponse(t, lvl.Level(), body) +} + +func TestHTTPHandlerPutUnrecognizedLevel(t *testing.T) { + lvl, _ := newHandler() + code, body := makeRequest(t, "PUT", lvl, strings.NewReader(`{"level":"unrecognized-level"}`)) + assertCodeBadRequest(t, code) + assertJSONError(t, body) +} + +func TestHTTPHandlerNotJSON(t *testing.T) { + lvl, _ := newHandler() + code, body := makeRequest(t, "PUT", lvl, strings.NewReader(`{`)) + assertCodeBadRequest(t, code) + assertJSONError(t, body) +} + +func TestHTTPHandlerNoLevelSpecified(t *testing.T) { + lvl, _ := newHandler() + code, body := makeRequest(t, "PUT", lvl, strings.NewReader(`{}`)) + assertCodeBadRequest(t, code) + assertJSONError(t, body) +} + +func TestHTTPHandlerMethodNotAllowed(t *testing.T) { + lvl, _ := newHandler() + code, body := makeRequest(t, "POST", lvl, strings.NewReader(`{`)) + assertCodeMethodNotAllowed(t, code) + assertJSONError(t, body) +} diff --git a/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go b/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go new file mode 100644 index 000000000..dad583aaa --- /dev/null +++ b/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package bufferpool houses zap's shared internal buffer pool. Third-party +// packages can recreate the same functionality with buffers.NewPool. +package bufferpool + +import "go.uber.org/zap/buffer" + +var ( + _pool = buffer.NewPool() + // Get retrieves a buffer from the pool, creating one if necessary. + Get = _pool.Get +) diff --git a/vendor/go.uber.org/zap/internal/color/color.go b/vendor/go.uber.org/zap/internal/color/color.go new file mode 100644 index 000000000..c4d5d02ab --- /dev/null +++ b/vendor/go.uber.org/zap/internal/color/color.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package color adds coloring functionality for TTY output. +package color + +import "fmt" + +// Foreground colors. +const ( + Black Color = iota + 30 + Red + Green + Yellow + Blue + Magenta + Cyan + White +) + +// Color represents a text color. +type Color uint8 + +// Add adds the coloring to the given string. +func (c Color) Add(s string) string { + return fmt.Sprintf("\x1b[%dm%s\x1b[0m", uint8(c), s) +} diff --git a/vendor/go.uber.org/zap/internal/color/color_test.go b/vendor/go.uber.org/zap/internal/color/color_test.go new file mode 100644 index 000000000..4982903aa --- /dev/null +++ b/vendor/go.uber.org/zap/internal/color/color_test.go @@ -0,0 +1,36 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package color + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestColorFormatting(t *testing.T) { + assert.Equal( + t, + "\x1b[31mfoo\x1b[0m", + Red.Add("foo"), + "Unexpected colored output.", + ) +} diff --git a/vendor/go.uber.org/zap/internal/exit/exit.go b/vendor/go.uber.org/zap/internal/exit/exit.go new file mode 100644 index 000000000..dfc5b05fe --- /dev/null +++ b/vendor/go.uber.org/zap/internal/exit/exit.go @@ -0,0 +1,64 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package exit provides stubs so that unit tests can exercise code that calls +// os.Exit(1). +package exit + +import "os" + +var real = func() { os.Exit(1) } + +// Exit normally terminates the process by calling os.Exit(1). If the package +// is stubbed, it instead records a call in the testing spy. +func Exit() { + real() +} + +// A StubbedExit is a testing fake for os.Exit. +type StubbedExit struct { + Exited bool + prev func() +} + +// Stub substitutes a fake for the call to os.Exit(1). +func Stub() *StubbedExit { + s := &StubbedExit{prev: real} + real = s.exit + return s +} + +// WithStub runs the supplied function with Exit stubbed. It returns the stub +// used, so that users can test whether the process would have crashed. +func WithStub(f func()) *StubbedExit { + s := Stub() + defer s.Unstub() + f() + return s +} + +// Unstub restores the previous exit function. +func (se *StubbedExit) Unstub() { + real = se.prev +} + +func (se *StubbedExit) exit() { + se.Exited = true +} diff --git a/vendor/go.uber.org/zap/internal/exit/exit_test.go b/vendor/go.uber.org/zap/internal/exit/exit_test.go new file mode 100644 index 000000000..300cdc309 --- /dev/null +++ b/vendor/go.uber.org/zap/internal/exit/exit_test.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package exit + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestStub(t *testing.T) { + tests := []struct { + f func() + want bool + }{ + {Exit, true}, + {func() {}, false}, + } + + for _, tt := range tests { + s := WithStub(tt.f) + assert.Equal(t, tt.want, s.Exited, "Stub captured unexpected exit value.") + } +} diff --git a/vendor/go.uber.org/zap/internal/readme/readme.go b/vendor/go.uber.org/zap/internal/readme/readme.go new file mode 100644 index 000000000..55414573e --- /dev/null +++ b/vendor/go.uber.org/zap/internal/readme/readme.go @@ -0,0 +1,209 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "log" + "os" + "os/exec" + "sort" + "strconv" + "strings" + "text/template" + "time" +) + +var ( + libraryNameToMarkdownName = map[string]string{ + "Zap": ":zap: zap", + "Zap.Sugar": ":zap: zap (sugared)", + "stdlib.Println": "standard library", + "sirupsen/logrus": "logrus", + "go-kit/kit/log": "go-kit", + "inconshreveable/log15": "log15", + "apex/log": "apex/log", + "go.pedge.io/lion": "lion", + "rs/zerolog": "zerolog", + } +) + +func main() { + flag.Parse() + if err := do(); err != nil { + log.Fatal(err) + } +} + +func do() error { + tmplData, err := getTmplData() + if err != nil { + return err + } + data, err := ioutil.ReadAll(os.Stdin) + if err != nil { + return err + } + t, err := template.New("tmpl").Parse(string(data)) + if err != nil { + return err + } + return t.Execute(os.Stdout, tmplData) +} + +func getTmplData() (*tmplData, error) { + tmplData := &tmplData{} + rows, err := getBenchmarkRows("BenchmarkAddingFields") + if err != nil { + return nil, err + } + tmplData.BenchmarkAddingFields = rows + rows, err = getBenchmarkRows("BenchmarkAccumulatedContext") + if err != nil { + return nil, err + } + tmplData.BenchmarkAccumulatedContext = rows + rows, err = getBenchmarkRows("BenchmarkWithoutFields") + if err != nil { + return nil, err + } + tmplData.BenchmarkWithoutFields = rows + return tmplData, nil +} + +func getBenchmarkRows(benchmarkName string) (string, error) { + benchmarkOutput, err := getBenchmarkOutput(benchmarkName) + if err != nil { + return "", err + } + var benchmarkRows []*benchmarkRow + for libraryName := range libraryNameToMarkdownName { + benchmarkRow, err := getBenchmarkRow(benchmarkOutput, benchmarkName, libraryName) + if err != nil { + return "", err + } + if benchmarkRow == nil { + continue + } + benchmarkRows = append(benchmarkRows, benchmarkRow) + } + sort.Sort(benchmarkRowsByTime(benchmarkRows)) + rows := []string{ + "| Package | Time | Objects Allocated |", + "| :--- | :---: | :---: |", + } + for _, benchmarkRow := range benchmarkRows { + rows = append(rows, benchmarkRow.String()) + } + return strings.Join(rows, "\n"), nil +} + +func getBenchmarkRow(input []string, benchmarkName string, libraryName string) (*benchmarkRow, error) { + line, err := findUniqueSubstring(input, fmt.Sprintf("%s/%s-", benchmarkName, libraryName)) + if err != nil { + return nil, err + } + if line == "" { + return nil, nil + } + split := strings.Split(line, "\t") + if len(split) < 5 { + return nil, fmt.Errorf("unknown benchmark line: %s", line) + } + duration, err := time.ParseDuration(strings.Replace(strings.TrimSuffix(strings.TrimSpace(split[2]), "/op"), " ", "", -1)) + if err != nil { + return nil, err + } + allocatedBytes, err := strconv.Atoi(strings.TrimSuffix(strings.TrimSpace(split[3]), " B/op")) + if err != nil { + return nil, err + } + allocatedObjects, err := strconv.Atoi(strings.TrimSuffix(strings.TrimSpace(split[4]), " allocs/op")) + if err != nil { + return nil, err + } + return &benchmarkRow{ + libraryNameToMarkdownName[libraryName], + duration, + allocatedBytes, + allocatedObjects, + }, nil +} + +func findUniqueSubstring(input []string, substring string) (string, error) { + var output string + for _, line := range input { + if strings.Contains(line, substring) { + if output != "" { + return "", fmt.Errorf("input has duplicate substring %s", substring) + } + output = line + } + } + return output, nil +} + +func getBenchmarkOutput(benchmarkName string) ([]string, error) { + return getOutput("go", "test", fmt.Sprintf("-bench=%s", benchmarkName), "-benchmem", "./benchmarks") +} + +func getOutput(name string, arg ...string) ([]string, error) { + output, err := exec.Command(name, arg...).CombinedOutput() + if err != nil { + return nil, fmt.Errorf("error running %s %s: %v\n%s", name, strings.Join(arg, " "), err, string(output)) + } + return strings.Split(string(output), "\n"), nil +} + +type tmplData struct { + BenchmarkAddingFields string + BenchmarkAccumulatedContext string + BenchmarkWithoutFields string +} + +type benchmarkRow struct { + Name string + Time time.Duration + AllocatedBytes int + AllocatedObjects int +} + +func (b *benchmarkRow) String() string { + return fmt.Sprintf("| %s | %d ns/op | %d allocs/op |", b.Name, b.Time.Nanoseconds(), b.AllocatedObjects) +} + +type benchmarkRowsByTime []*benchmarkRow + +func (b benchmarkRowsByTime) Len() int { return len(b) } +func (b benchmarkRowsByTime) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b benchmarkRowsByTime) Less(i, j int) bool { + left, right := b[i], b[j] + leftZap, rightZap := strings.Contains(left.Name, "zap"), strings.Contains(right.Name, "zap") + + // If neither benchmark is for zap or both are, sort by time. + if !(leftZap || rightZap) || (leftZap && rightZap) { + return left.Time.Nanoseconds() < right.Time.Nanoseconds() + } + // Sort zap benchmark first. + return leftZap +} diff --git a/vendor/go.uber.org/zap/internal/ztest/doc.go b/vendor/go.uber.org/zap/internal/ztest/doc.go new file mode 100644 index 000000000..cd4b98cbc --- /dev/null +++ b/vendor/go.uber.org/zap/internal/ztest/doc.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package ztest provides low-level helpers for testing log output. These +// utilities are helpful in zap's own unit tests, but any assertions using +// them are strongly coupled to a single encoding. +package ztest // import "go.uber.org/zap/internal/ztest" diff --git a/vendor/go.uber.org/zap/internal/ztest/timeout.go b/vendor/go.uber.org/zap/internal/ztest/timeout.go new file mode 100644 index 000000000..f7d58f316 --- /dev/null +++ b/vendor/go.uber.org/zap/internal/ztest/timeout.go @@ -0,0 +1,59 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package ztest + +import ( + "log" + "os" + "strconv" + "time" +) + +var _timeoutScale = 1.0 + +// Timeout scales the provided duration by $TEST_TIMEOUT_SCALE. +func Timeout(base time.Duration) time.Duration { + return time.Duration(float64(base) * _timeoutScale) +} + +// Sleep scales the sleep duration by $TEST_TIMEOUT_SCALE. +func Sleep(base time.Duration) { + time.Sleep(Timeout(base)) +} + +// Initialize checks the environment and alters the timeout scale accordingly. +// It returns a function to undo the scaling. +func Initialize(factor string) func() { + original := _timeoutScale + fv, err := strconv.ParseFloat(factor, 64) + if err != nil { + panic(err) + } + _timeoutScale = fv + return func() { _timeoutScale = original } +} + +func init() { + if v := os.Getenv("TEST_TIMEOUT_SCALE"); v != "" { + Initialize(v) + log.Printf("Scaling timeouts by %vx.\n", _timeoutScale) + } +} diff --git a/vendor/go.uber.org/zap/internal/ztest/writer.go b/vendor/go.uber.org/zap/internal/ztest/writer.go new file mode 100644 index 000000000..9fdd5805e --- /dev/null +++ b/vendor/go.uber.org/zap/internal/ztest/writer.go @@ -0,0 +1,96 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package ztest + +import ( + "bytes" + "errors" + "io/ioutil" + "strings" +) + +// A Syncer is a spy for the Sync portion of zapcore.WriteSyncer. +type Syncer struct { + err error + called bool +} + +// SetError sets the error that the Sync method will return. +func (s *Syncer) SetError(err error) { + s.err = err +} + +// Sync records that it was called, then returns the user-supplied error (if +// any). +func (s *Syncer) Sync() error { + s.called = true + return s.err +} + +// Called reports whether the Sync method was called. +func (s *Syncer) Called() bool { + return s.called +} + +// A Discarder sends all writes to ioutil.Discard. +type Discarder struct{ Syncer } + +// Write implements io.Writer. +func (d *Discarder) Write(b []byte) (int, error) { + return ioutil.Discard.Write(b) +} + +// FailWriter is a WriteSyncer that always returns an error on writes. +type FailWriter struct{ Syncer } + +// Write implements io.Writer. +func (w FailWriter) Write(b []byte) (int, error) { + return len(b), errors.New("failed") +} + +// ShortWriter is a WriteSyncer whose write method never fails, but +// nevertheless fails to the last byte of the input. +type ShortWriter struct{ Syncer } + +// Write implements io.Writer. +func (w ShortWriter) Write(b []byte) (int, error) { + return len(b) - 1, nil +} + +// Buffer is an implementation of zapcore.WriteSyncer that sends all writes to +// a bytes.Buffer. It has convenience methods to split the accumulated buffer +// on newlines. +type Buffer struct { + bytes.Buffer + Syncer +} + +// Lines returns the current buffer contents, split on newlines. +func (b *Buffer) Lines() []string { + output := strings.Split(b.String(), "\n") + return output[:len(output)-1] +} + +// Stripped returns the current buffer contents with the last trailing newline +// stripped. +func (b *Buffer) Stripped() string { + return strings.TrimRight(b.String(), "\n") +} diff --git a/vendor/go.uber.org/zap/level.go b/vendor/go.uber.org/zap/level.go new file mode 100644 index 000000000..3567a9a1e --- /dev/null +++ b/vendor/go.uber.org/zap/level.go @@ -0,0 +1,132 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "go.uber.org/atomic" + "go.uber.org/zap/zapcore" +) + +const ( + // DebugLevel logs are typically voluminous, and are usually disabled in + // production. + DebugLevel = zapcore.DebugLevel + // InfoLevel is the default logging priority. + InfoLevel = zapcore.InfoLevel + // WarnLevel logs are more important than Info, but don't need individual + // human review. + WarnLevel = zapcore.WarnLevel + // ErrorLevel logs are high-priority. If an application is running smoothly, + // it shouldn't generate any error-level logs. + ErrorLevel = zapcore.ErrorLevel + // DPanicLevel logs are particularly important errors. In development the + // logger panics after writing the message. + DPanicLevel = zapcore.DPanicLevel + // PanicLevel logs a message, then panics. + PanicLevel = zapcore.PanicLevel + // FatalLevel logs a message, then calls os.Exit(1). + FatalLevel = zapcore.FatalLevel +) + +// LevelEnablerFunc is a convenient way to implement zapcore.LevelEnabler with +// an anonymous function. +// +// It's particularly useful when splitting log output between different +// outputs (e.g., standard error and standard out). For sample code, see the +// package-level AdvancedConfiguration example. +type LevelEnablerFunc func(zapcore.Level) bool + +// Enabled calls the wrapped function. +func (f LevelEnablerFunc) Enabled(lvl zapcore.Level) bool { return f(lvl) } + +// An AtomicLevel is an atomically changeable, dynamic logging level. It lets +// you safely change the log level of a tree of loggers (the root logger and +// any children created by adding context) at runtime. +// +// The AtomicLevel itself is an http.Handler that serves a JSON endpoint to +// alter its level. +// +// AtomicLevels must be created with the NewAtomicLevel constructor to allocate +// their internal atomic pointer. +type AtomicLevel struct { + l *atomic.Int32 +} + +// NewAtomicLevel creates an AtomicLevel with InfoLevel and above logging +// enabled. +func NewAtomicLevel() AtomicLevel { + return AtomicLevel{ + l: atomic.NewInt32(int32(InfoLevel)), + } +} + +// NewAtomicLevelAt is a convenience function that creates an AtomicLevel +// and then calls SetLevel with the given level. +func NewAtomicLevelAt(l zapcore.Level) AtomicLevel { + a := NewAtomicLevel() + a.SetLevel(l) + return a +} + +// Enabled implements the zapcore.LevelEnabler interface, which allows the +// AtomicLevel to be used in place of traditional static levels. +func (lvl AtomicLevel) Enabled(l zapcore.Level) bool { + return lvl.Level().Enabled(l) +} + +// Level returns the minimum enabled log level. +func (lvl AtomicLevel) Level() zapcore.Level { + return zapcore.Level(int8(lvl.l.Load())) +} + +// SetLevel alters the logging level. +func (lvl AtomicLevel) SetLevel(l zapcore.Level) { + lvl.l.Store(int32(l)) +} + +// String returns the string representation of the underlying Level. +func (lvl AtomicLevel) String() string { + return lvl.Level().String() +} + +// UnmarshalText unmarshals the text to an AtomicLevel. It uses the same text +// representations as the static zapcore.Levels ("debug", "info", "warn", +// "error", "dpanic", "panic", and "fatal"). +func (lvl *AtomicLevel) UnmarshalText(text []byte) error { + if lvl.l == nil { + lvl.l = &atomic.Int32{} + } + + var l zapcore.Level + if err := l.UnmarshalText(text); err != nil { + return err + } + + lvl.SetLevel(l) + return nil +} + +// MarshalText marshals the AtomicLevel to a byte slice. It uses the same +// text representation as the static zapcore.Levels ("debug", "info", "warn", +// "error", "dpanic", "panic", and "fatal"). +func (lvl AtomicLevel) MarshalText() (text []byte, err error) { + return lvl.Level().MarshalText() +} diff --git a/vendor/go.uber.org/zap/level_test.go b/vendor/go.uber.org/zap/level_test.go new file mode 100644 index 000000000..a8fb650c3 --- /dev/null +++ b/vendor/go.uber.org/zap/level_test.go @@ -0,0 +1,117 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "sync" + "testing" + + "go.uber.org/zap/zapcore" + + "github.com/stretchr/testify/assert" +) + +func TestLevelEnablerFunc(t *testing.T) { + enab := LevelEnablerFunc(func(l zapcore.Level) bool { return l == zapcore.InfoLevel }) + tests := []struct { + level zapcore.Level + enabled bool + }{ + {DebugLevel, false}, + {InfoLevel, true}, + {WarnLevel, false}, + {ErrorLevel, false}, + {DPanicLevel, false}, + {PanicLevel, false}, + {FatalLevel, false}, + } + for _, tt := range tests { + assert.Equal(t, tt.enabled, enab.Enabled(tt.level), "Unexpected result applying LevelEnablerFunc to %s", tt.level) + } +} + +func TestNewAtomicLevel(t *testing.T) { + lvl := NewAtomicLevel() + assert.Equal(t, InfoLevel, lvl.Level(), "Unexpected initial level.") + lvl.SetLevel(ErrorLevel) + assert.Equal(t, ErrorLevel, lvl.Level(), "Unexpected level after SetLevel.") + lvl = NewAtomicLevelAt(WarnLevel) + assert.Equal(t, WarnLevel, lvl.Level(), "Unexpected level after SetLevel.") +} + +func TestAtomicLevelMutation(t *testing.T) { + lvl := NewAtomicLevel() + lvl.SetLevel(WarnLevel) + // Trigger races for non-atomic level mutations. + proceed := make(chan struct{}) + wg := &sync.WaitGroup{} + runConcurrently(10, 100, wg, func() { + <-proceed + assert.Equal(t, WarnLevel, lvl.Level()) + }) + runConcurrently(10, 100, wg, func() { + <-proceed + lvl.SetLevel(WarnLevel) + }) + close(proceed) + wg.Wait() +} + +func TestAtomicLevelText(t *testing.T) { + tests := []struct { + text string + expect zapcore.Level + err bool + }{ + {"debug", DebugLevel, false}, + {"info", InfoLevel, false}, + {"", InfoLevel, false}, + {"warn", WarnLevel, false}, + {"error", ErrorLevel, false}, + {"dpanic", DPanicLevel, false}, + {"panic", PanicLevel, false}, + {"fatal", FatalLevel, false}, + {"foobar", InfoLevel, true}, + } + + for _, tt := range tests { + var lvl AtomicLevel + // Test both initial unmarshaling and overwriting existing value. + for i := 0; i < 2; i++ { + if tt.err { + assert.Error(t, lvl.UnmarshalText([]byte(tt.text)), "Expected unmarshaling %q to fail.", tt.text) + } else { + assert.NoError(t, lvl.UnmarshalText([]byte(tt.text)), "Expected unmarshaling %q to succeed.", tt.text) + } + assert.Equal(t, tt.expect, lvl.Level(), "Unexpected level after unmarshaling.") + lvl.SetLevel(InfoLevel) + } + + // Test marshalling + if tt.text != "" && !tt.err { + lvl.SetLevel(tt.expect) + marshaled, err := lvl.MarshalText() + assert.NoError(t, err, `Unexpected error marshalling level "%v" to text.`, tt.expect) + assert.Equal(t, tt.text, string(marshaled), "Expected marshaled text to match") + assert.Equal(t, tt.text, lvl.String(), "Expected Stringer call to match") + } + } +} diff --git a/vendor/go.uber.org/zap/logger.go b/vendor/go.uber.org/zap/logger.go new file mode 100644 index 000000000..dc8f6e3a4 --- /dev/null +++ b/vendor/go.uber.org/zap/logger.go @@ -0,0 +1,305 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "fmt" + "io/ioutil" + "os" + "runtime" + "strings" + "time" + + "go.uber.org/zap/zapcore" +) + +// A Logger provides fast, leveled, structured logging. All methods are safe +// for concurrent use. +// +// The Logger is designed for contexts in which every microsecond and every +// allocation matters, so its API intentionally favors performance and type +// safety over brevity. For most applications, the SugaredLogger strikes a +// better balance between performance and ergonomics. +type Logger struct { + core zapcore.Core + + development bool + name string + errorOutput zapcore.WriteSyncer + + addCaller bool + addStack zapcore.LevelEnabler + + callerSkip int +} + +// New constructs a new Logger from the provided zapcore.Core and Options. If +// the passed zapcore.Core is nil, it falls back to using a no-op +// implementation. +// +// This is the most flexible way to construct a Logger, but also the most +// verbose. For typical use cases, the highly-opinionated presets +// (NewProduction, NewDevelopment, and NewExample) or the Config struct are +// more convenient. +// +// For sample code, see the package-level AdvancedConfiguration example. +func New(core zapcore.Core, options ...Option) *Logger { + if core == nil { + return NewNop() + } + log := &Logger{ + core: core, + errorOutput: zapcore.Lock(os.Stderr), + addStack: zapcore.FatalLevel + 1, + } + return log.WithOptions(options...) +} + +// NewNop returns a no-op Logger. It never writes out logs or internal errors, +// and it never runs user-defined hooks. +// +// Using WithOptions to replace the Core or error output of a no-op Logger can +// re-enable logging. +func NewNop() *Logger { + return &Logger{ + core: zapcore.NewNopCore(), + errorOutput: zapcore.AddSync(ioutil.Discard), + addStack: zapcore.FatalLevel + 1, + } +} + +// NewProduction builds a sensible production Logger that writes InfoLevel and +// above logs to standard error as JSON. +// +// It's a shortcut for NewProductionConfig().Build(...Option). +func NewProduction(options ...Option) (*Logger, error) { + return NewProductionConfig().Build(options...) +} + +// NewDevelopment builds a development Logger that writes DebugLevel and above +// logs to standard error in a human-friendly format. +// +// It's a shortcut for NewDevelopmentConfig().Build(...Option). +func NewDevelopment(options ...Option) (*Logger, error) { + return NewDevelopmentConfig().Build(options...) +} + +// NewExample builds a Logger that's designed for use in zap's testable +// examples. It writes DebugLevel and above logs to standard out as JSON, but +// omits the timestamp and calling function to keep example output +// short and deterministic. +func NewExample(options ...Option) *Logger { + encoderCfg := zapcore.EncoderConfig{ + MessageKey: "msg", + LevelKey: "level", + NameKey: "logger", + EncodeLevel: zapcore.LowercaseLevelEncoder, + EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.StringDurationEncoder, + } + core := zapcore.NewCore(zapcore.NewJSONEncoder(encoderCfg), os.Stdout, DebugLevel) + return New(core).WithOptions(options...) +} + +// Sugar wraps the Logger to provide a more ergonomic, but slightly slower, +// API. Sugaring a Logger is quite inexpensive, so it's reasonable for a +// single application to use both Loggers and SugaredLoggers, converting +// between them on the boundaries of performance-sensitive code. +func (log *Logger) Sugar() *SugaredLogger { + core := log.clone() + core.callerSkip += 2 + return &SugaredLogger{core} +} + +// Named adds a new path segment to the logger's name. Segments are joined by +// periods. By default, Loggers are unnamed. +func (log *Logger) Named(s string) *Logger { + if s == "" { + return log + } + l := log.clone() + if log.name == "" { + l.name = s + } else { + l.name = strings.Join([]string{l.name, s}, ".") + } + return l +} + +// WithOptions clones the current Logger, applies the supplied Options, and +// returns the resulting Logger. It's safe to use concurrently. +func (log *Logger) WithOptions(opts ...Option) *Logger { + c := log.clone() + for _, opt := range opts { + opt.apply(c) + } + return c +} + +// With creates a child logger and adds structured context to it. Fields added +// to the child don't affect the parent, and vice versa. +func (log *Logger) With(fields ...Field) *Logger { + if len(fields) == 0 { + return log + } + l := log.clone() + l.core = l.core.With(fields) + return l +} + +// Check returns a CheckedEntry if logging a message at the specified level +// is enabled. It's a completely optional optimization; in high-performance +// applications, Check can help avoid allocating a slice to hold fields. +func (log *Logger) Check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry { + return log.check(lvl, msg) +} + +// Debug logs a message at DebugLevel. The message includes any fields passed +// at the log site, as well as any fields accumulated on the logger. +func (log *Logger) Debug(msg string, fields ...Field) { + if ce := log.check(DebugLevel, msg); ce != nil { + ce.Write(fields...) + } +} + +// Info logs a message at InfoLevel. The message includes any fields passed +// at the log site, as well as any fields accumulated on the logger. +func (log *Logger) Info(msg string, fields ...Field) { + if ce := log.check(InfoLevel, msg); ce != nil { + ce.Write(fields...) + } +} + +// Warn logs a message at WarnLevel. The message includes any fields passed +// at the log site, as well as any fields accumulated on the logger. +func (log *Logger) Warn(msg string, fields ...Field) { + if ce := log.check(WarnLevel, msg); ce != nil { + ce.Write(fields...) + } +} + +// Error logs a message at ErrorLevel. The message includes any fields passed +// at the log site, as well as any fields accumulated on the logger. +func (log *Logger) Error(msg string, fields ...Field) { + if ce := log.check(ErrorLevel, msg); ce != nil { + ce.Write(fields...) + } +} + +// DPanic logs a message at DPanicLevel. The message includes any fields +// passed at the log site, as well as any fields accumulated on the logger. +// +// If the logger is in development mode, it then panics (DPanic means +// "development panic"). This is useful for catching errors that are +// recoverable, but shouldn't ever happen. +func (log *Logger) DPanic(msg string, fields ...Field) { + if ce := log.check(DPanicLevel, msg); ce != nil { + ce.Write(fields...) + } +} + +// Panic logs a message at PanicLevel. The message includes any fields passed +// at the log site, as well as any fields accumulated on the logger. +// +// The logger then panics, even if logging at PanicLevel is disabled. +func (log *Logger) Panic(msg string, fields ...Field) { + if ce := log.check(PanicLevel, msg); ce != nil { + ce.Write(fields...) + } +} + +// Fatal logs a message at FatalLevel. The message includes any fields passed +// at the log site, as well as any fields accumulated on the logger. +// +// The logger then calls os.Exit(1), even if logging at FatalLevel is +// disabled. +func (log *Logger) Fatal(msg string, fields ...Field) { + if ce := log.check(FatalLevel, msg); ce != nil { + ce.Write(fields...) + } +} + +// Sync calls the underlying Core's Sync method, flushing any buffered log +// entries. Applications should take care to call Sync before exiting. +func (log *Logger) Sync() error { + return log.core.Sync() +} + +// Core returns the Logger's underlying zapcore.Core. +func (log *Logger) Core() zapcore.Core { + return log.core +} + +func (log *Logger) clone() *Logger { + copy := *log + return © +} + +func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry { + // check must always be called directly by a method in the Logger interface + // (e.g., Check, Info, Fatal). + const callerSkipOffset = 2 + + // Create basic checked entry thru the core; this will be non-nil if the + // log message will actually be written somewhere. + ent := zapcore.Entry{ + LoggerName: log.name, + Time: time.Now(), + Level: lvl, + Message: msg, + } + ce := log.core.Check(ent, nil) + willWrite := ce != nil + + // Set up any required terminal behavior. + switch ent.Level { + case zapcore.PanicLevel: + ce = ce.Should(ent, zapcore.WriteThenPanic) + case zapcore.FatalLevel: + ce = ce.Should(ent, zapcore.WriteThenFatal) + case zapcore.DPanicLevel: + if log.development { + ce = ce.Should(ent, zapcore.WriteThenPanic) + } + } + + // Only do further annotation if we're going to write this message; checked + // entries that exist only for terminal behavior don't benefit from + // annotation. + if !willWrite { + return ce + } + + // Thread the error output through to the CheckedEntry. + ce.ErrorOutput = log.errorOutput + if log.addCaller { + ce.Entry.Caller = zapcore.NewEntryCaller(runtime.Caller(log.callerSkip + callerSkipOffset)) + if !ce.Entry.Caller.Defined { + fmt.Fprintf(log.errorOutput, "%v Logger.check error: failed to get caller\n", time.Now().UTC()) + log.errorOutput.Sync() + } + } + if log.addStack.Enabled(ce.Entry.Level) { + ce.Entry.Stack = Stack("").String + } + + return ce +} diff --git a/vendor/go.uber.org/zap/logger_bench_test.go b/vendor/go.uber.org/zap/logger_bench_test.go new file mode 100644 index 000000000..71c6b5911 --- /dev/null +++ b/vendor/go.uber.org/zap/logger_bench_test.go @@ -0,0 +1,222 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "errors" + "testing" + "time" + + "go.uber.org/zap/internal/ztest" + "go.uber.org/zap/zapcore" +) + +type user struct { + Name string + Email string + CreatedAt time.Time +} + +func (u *user) MarshalLogObject(enc zapcore.ObjectEncoder) error { + enc.AddString("name", u.Name) + enc.AddString("email", u.Email) + enc.AddInt64("created_at", u.CreatedAt.UnixNano()) + return nil +} + +var _jane = &user{ + Name: "Jane Doe", + Email: "jane@test.com", + CreatedAt: time.Date(1980, 1, 1, 12, 0, 0, 0, time.UTC), +} + +func withBenchedLogger(b *testing.B, f func(*Logger)) { + logger := New( + zapcore.NewCore( + zapcore.NewJSONEncoder(NewProductionConfig().EncoderConfig), + &ztest.Discarder{}, + DebugLevel, + )) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + f(logger) + } + }) +} + +func BenchmarkNoContext(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("No context.") + }) +} + +func BenchmarkBoolField(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Boolean.", Bool("foo", true)) + }) +} + +func BenchmarkByteStringField(b *testing.B) { + val := []byte("bar") + withBenchedLogger(b, func(log *Logger) { + log.Info("ByteString.", ByteString("foo", val)) + }) +} + +func BenchmarkFloat64Field(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Floating point.", Float64("foo", 3.14)) + }) +} + +func BenchmarkIntField(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Integer.", Int("foo", 42)) + }) +} + +func BenchmarkInt64Field(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("64-bit integer.", Int64("foo", 42)) + }) +} + +func BenchmarkStringField(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Strings.", String("foo", "bar")) + }) +} + +func BenchmarkStringerField(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Level.", Stringer("foo", InfoLevel)) + }) +} + +func BenchmarkTimeField(b *testing.B) { + t := time.Unix(0, 0) + withBenchedLogger(b, func(log *Logger) { + log.Info("Time.", Time("foo", t)) + }) +} + +func BenchmarkDurationField(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Duration", Duration("foo", time.Second)) + }) +} + +func BenchmarkErrorField(b *testing.B) { + err := errors.New("egad") + withBenchedLogger(b, func(log *Logger) { + log.Info("Error.", Error(err)) + }) +} + +func BenchmarkErrorsField(b *testing.B) { + errs := []error{ + errors.New("egad"), + errors.New("oh no"), + errors.New("dear me"), + errors.New("such fail"), + } + withBenchedLogger(b, func(log *Logger) { + log.Info("Errors.", Errors("errors", errs)) + }) +} + +func BenchmarkStackField(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Error.", Stack("stacktrace")) + }) +} + +func BenchmarkObjectField(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Arbitrary ObjectMarshaler.", Object("user", _jane)) + }) +} + +func BenchmarkReflectField(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Reflection-based serialization.", Reflect("user", _jane)) + }) +} + +func BenchmarkAddCallerHook(b *testing.B) { + logger := New( + zapcore.NewCore( + zapcore.NewJSONEncoder(NewProductionConfig().EncoderConfig), + &ztest.Discarder{}, + InfoLevel, + ), + AddCaller(), + ) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + logger.Info("Caller.") + } + }) +} + +func Benchmark10Fields(b *testing.B) { + withBenchedLogger(b, func(log *Logger) { + log.Info("Ten fields, passed at the log site.", + Int("one", 1), + Int("two", 2), + Int("three", 3), + Int("four", 4), + Int("five", 5), + Int("six", 6), + Int("seven", 7), + Int("eight", 8), + Int("nine", 9), + Int("ten", 10), + ) + }) +} + +func Benchmark100Fields(b *testing.B) { + const batchSize = 50 + logger := New(zapcore.NewCore( + zapcore.NewJSONEncoder(NewProductionConfig().EncoderConfig), + &ztest.Discarder{}, + DebugLevel, + )) + + // Don't include allocating these helper slices in the benchmark. Since + // access to them isn't synchronized, we can't run the benchmark in + // parallel. + first := make([]Field, batchSize) + second := make([]Field, batchSize) + b.ResetTimer() + + for i := 0; i < b.N; i++ { + for i := 0; i < batchSize; i++ { + // We're duplicating keys, but that doesn't affect performance. + first[i] = Int("foo", i) + second[i] = Int("foo", i+batchSize) + } + logger.With(first...).Info("Child loggers with lots of context.", second...) + } +} diff --git a/vendor/go.uber.org/zap/logger_test.go b/vendor/go.uber.org/zap/logger_test.go new file mode 100644 index 000000000..a9f705788 --- /dev/null +++ b/vendor/go.uber.org/zap/logger_test.go @@ -0,0 +1,432 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "errors" + "sync" + "testing" + + "go.uber.org/zap/internal/exit" + "go.uber.org/zap/internal/ztest" + "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest/observer" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" +) + +func makeCountingHook() (func(zapcore.Entry) error, *atomic.Int64) { + count := &atomic.Int64{} + h := func(zapcore.Entry) error { + count.Inc() + return nil + } + return h, count +} + +func TestLoggerAtomicLevel(t *testing.T) { + // Test that the dynamic level applies to all ancestors and descendants. + dl := NewAtomicLevel() + + withLogger(t, dl, nil, func(grandparent *Logger, _ *observer.ObservedLogs) { + parent := grandparent.With(Int("generation", 1)) + child := parent.With(Int("generation", 2)) + + tests := []struct { + setLevel zapcore.Level + testLevel zapcore.Level + enabled bool + }{ + {DebugLevel, DebugLevel, true}, + {InfoLevel, DebugLevel, false}, + {WarnLevel, PanicLevel, true}, + } + + for _, tt := range tests { + dl.SetLevel(tt.setLevel) + for _, logger := range []*Logger{grandparent, parent, child} { + if tt.enabled { + assert.NotNil( + t, + logger.Check(tt.testLevel, ""), + "Expected level %s to be enabled after setting level %s.", tt.testLevel, tt.setLevel, + ) + } else { + assert.Nil( + t, + logger.Check(tt.testLevel, ""), + "Expected level %s to be enabled after setting level %s.", tt.testLevel, tt.setLevel, + ) + } + } + } + }) +} + +func TestLoggerInitialFields(t *testing.T) { + fieldOpts := opts(Fields(Int("foo", 42), String("bar", "baz"))) + withLogger(t, DebugLevel, fieldOpts, func(logger *Logger, logs *observer.ObservedLogs) { + logger.Info("") + assert.Equal( + t, + observer.LoggedEntry{Context: []Field{Int("foo", 42), String("bar", "baz")}}, + logs.AllUntimed()[0], + "Unexpected output with initial fields set.", + ) + }) +} + +func TestLoggerWith(t *testing.T) { + fieldOpts := opts(Fields(Int("foo", 42))) + withLogger(t, DebugLevel, fieldOpts, func(logger *Logger, logs *observer.ObservedLogs) { + // Child loggers should have copy-on-write semantics, so two children + // shouldn't stomp on each other's fields or affect the parent's fields. + logger.With(String("one", "two")).Info("") + logger.With(String("three", "four")).Info("") + logger.Info("") + + assert.Equal(t, []observer.LoggedEntry{ + {Context: []Field{Int("foo", 42), String("one", "two")}}, + {Context: []Field{Int("foo", 42), String("three", "four")}}, + {Context: []Field{Int("foo", 42)}}, + }, logs.AllUntimed(), "Unexpected cross-talk between child loggers.") + }) +} + +func TestLoggerLogPanic(t *testing.T) { + for _, tt := range []struct { + do func(*Logger) + should bool + expected string + }{ + {func(logger *Logger) { logger.Check(PanicLevel, "bar").Write() }, true, "bar"}, + {func(logger *Logger) { logger.Panic("baz") }, true, "baz"}, + } { + withLogger(t, DebugLevel, nil, func(logger *Logger, logs *observer.ObservedLogs) { + if tt.should { + assert.Panics(t, func() { tt.do(logger) }, "Expected panic") + } else { + assert.NotPanics(t, func() { tt.do(logger) }, "Expected no panic") + } + + output := logs.AllUntimed() + assert.Equal(t, 1, len(output), "Unexpected number of logs.") + assert.Equal(t, 0, len(output[0].Context), "Unexpected context on first log.") + assert.Equal( + t, + zapcore.Entry{Message: tt.expected, Level: PanicLevel}, + output[0].Entry, + "Unexpected output from panic-level Log.", + ) + }) + } +} + +func TestLoggerLogFatal(t *testing.T) { + for _, tt := range []struct { + do func(*Logger) + expected string + }{ + {func(logger *Logger) { logger.Check(FatalLevel, "bar").Write() }, "bar"}, + {func(logger *Logger) { logger.Fatal("baz") }, "baz"}, + } { + withLogger(t, DebugLevel, nil, func(logger *Logger, logs *observer.ObservedLogs) { + stub := exit.WithStub(func() { + tt.do(logger) + }) + assert.True(t, stub.Exited, "Expected Fatal logger call to terminate process.") + output := logs.AllUntimed() + assert.Equal(t, 1, len(output), "Unexpected number of logs.") + assert.Equal(t, 0, len(output[0].Context), "Unexpected context on first log.") + assert.Equal( + t, + zapcore.Entry{Message: tt.expected, Level: FatalLevel}, + output[0].Entry, + "Unexpected output from fatal-level Log.", + ) + }) + } +} + +func TestLoggerLeveledMethods(t *testing.T) { + withLogger(t, DebugLevel, nil, func(logger *Logger, logs *observer.ObservedLogs) { + tests := []struct { + method func(string, ...Field) + expectedLevel zapcore.Level + }{ + {logger.Debug, DebugLevel}, + {logger.Info, InfoLevel}, + {logger.Warn, WarnLevel}, + {logger.Error, ErrorLevel}, + {logger.DPanic, DPanicLevel}, + } + for i, tt := range tests { + tt.method("") + output := logs.AllUntimed() + assert.Equal(t, i+1, len(output), "Unexpected number of logs.") + assert.Equal(t, 0, len(output[i].Context), "Unexpected context on first log.") + assert.Equal( + t, + zapcore.Entry{Level: tt.expectedLevel}, + output[i].Entry, + "Unexpected output from %s-level logger method.", tt.expectedLevel) + } + }) +} + +func TestLoggerAlwaysPanics(t *testing.T) { + // Users can disable writing out panic-level logs, but calls to logger.Panic() + // should still call panic(). + withLogger(t, FatalLevel, nil, func(logger *Logger, logs *observer.ObservedLogs) { + msg := "Even if output is disabled, logger.Panic should always panic." + assert.Panics(t, func() { logger.Panic("foo") }, msg) + assert.Panics(t, func() { + if ce := logger.Check(PanicLevel, "foo"); ce != nil { + ce.Write() + } + }, msg) + assert.Equal(t, 0, logs.Len(), "Panics shouldn't be written out if PanicLevel is disabled.") + }) +} + +func TestLoggerAlwaysFatals(t *testing.T) { + // Users can disable writing out fatal-level logs, but calls to logger.Fatal() + // should still terminate the process. + withLogger(t, FatalLevel+1, nil, func(logger *Logger, logs *observer.ObservedLogs) { + stub := exit.WithStub(func() { logger.Fatal("") }) + assert.True(t, stub.Exited, "Expected calls to logger.Fatal to terminate process.") + + stub = exit.WithStub(func() { + if ce := logger.Check(FatalLevel, ""); ce != nil { + ce.Write() + } + }) + assert.True(t, stub.Exited, "Expected calls to logger.Check(FatalLevel, ...) to terminate process.") + + assert.Equal(t, 0, logs.Len(), "Shouldn't write out logs when fatal-level logging is disabled.") + }) +} + +func TestLoggerDPanic(t *testing.T) { + withLogger(t, DebugLevel, nil, func(logger *Logger, logs *observer.ObservedLogs) { + assert.NotPanics(t, func() { logger.DPanic("") }) + assert.Equal( + t, + []observer.LoggedEntry{{Entry: zapcore.Entry{Level: DPanicLevel}, Context: []Field{}}}, + logs.AllUntimed(), + "Unexpected log output from DPanic in production mode.", + ) + }) + withLogger(t, DebugLevel, opts(Development()), func(logger *Logger, logs *observer.ObservedLogs) { + assert.Panics(t, func() { logger.DPanic("") }) + assert.Equal( + t, + []observer.LoggedEntry{{Entry: zapcore.Entry{Level: DPanicLevel}, Context: []Field{}}}, + logs.AllUntimed(), + "Unexpected log output from DPanic in development mode.", + ) + }) +} + +func TestLoggerNoOpsDisabledLevels(t *testing.T) { + withLogger(t, WarnLevel, nil, func(logger *Logger, logs *observer.ObservedLogs) { + logger.Info("silence!") + assert.Equal( + t, + []observer.LoggedEntry{}, + logs.AllUntimed(), + "Expected logging at a disabled level to produce no output.", + ) + }) +} + +func TestLoggerNames(t *testing.T) { + tests := []struct { + names []string + expected string + }{ + {nil, ""}, + {[]string{""}, ""}, + {[]string{"foo"}, "foo"}, + {[]string{"foo", ""}, "foo"}, + {[]string{"foo", "bar"}, "foo.bar"}, + {[]string{"foo.bar", "baz"}, "foo.bar.baz"}, + // Garbage in, garbage out. + {[]string{"foo.", "bar"}, "foo..bar"}, + {[]string{"foo", ".bar"}, "foo..bar"}, + {[]string{"foo.", ".bar"}, "foo...bar"}, + } + + for _, tt := range tests { + withLogger(t, DebugLevel, nil, func(log *Logger, logs *observer.ObservedLogs) { + for _, n := range tt.names { + log = log.Named(n) + } + log.Info("") + require.Equal(t, 1, logs.Len(), "Expected only one log entry to be written.") + assert.Equal(t, tt.expected, logs.AllUntimed()[0].Entry.LoggerName, "Unexpected logger name.") + }) + withSugar(t, DebugLevel, nil, func(log *SugaredLogger, logs *observer.ObservedLogs) { + for _, n := range tt.names { + log = log.Named(n) + } + log.Infow("") + require.Equal(t, 1, logs.Len(), "Expected only one log entry to be written.") + assert.Equal(t, tt.expected, logs.AllUntimed()[0].Entry.LoggerName, "Unexpected logger name.") + }) + } +} + +func TestLoggerWriteFailure(t *testing.T) { + errSink := &ztest.Buffer{} + logger := New( + zapcore.NewCore( + zapcore.NewJSONEncoder(NewProductionConfig().EncoderConfig), + zapcore.Lock(zapcore.AddSync(ztest.FailWriter{})), + DebugLevel, + ), + ErrorOutput(errSink), + ) + + logger.Info("foo") + // Should log the error. + assert.Regexp(t, `write error: failed`, errSink.Stripped(), "Expected to log the error to the error output.") + assert.True(t, errSink.Called(), "Expected logging an internal error to call Sync the error sink.") +} + +func TestLoggerSync(t *testing.T) { + withLogger(t, DebugLevel, nil, func(logger *Logger, _ *observer.ObservedLogs) { + assert.NoError(t, logger.Sync(), "Expected syncing a test logger to succeed.") + assert.NoError(t, logger.Sugar().Sync(), "Expected syncing a sugared logger to succeed.") + }) +} + +func TestLoggerSyncFail(t *testing.T) { + noSync := &ztest.Buffer{} + err := errors.New("fail") + noSync.SetError(err) + logger := New(zapcore.NewCore( + zapcore.NewJSONEncoder(zapcore.EncoderConfig{}), + noSync, + DebugLevel, + )) + assert.Equal(t, err, logger.Sync(), "Expected Logger.Sync to propagate errors.") + assert.Equal(t, err, logger.Sugar().Sync(), "Expected SugaredLogger.Sync to propagate errors.") +} + +func TestLoggerAddCaller(t *testing.T) { + tests := []struct { + options []Option + pat string + }{ + {opts(AddCaller()), `.+/logger_test.go:[\d]+$`}, + {opts(AddCaller(), AddCallerSkip(1), AddCallerSkip(-1)), `.+/zap/logger_test.go:[\d]+$`}, + {opts(AddCaller(), AddCallerSkip(1)), `.+/zap/common_test.go:[\d]+$`}, + {opts(AddCaller(), AddCallerSkip(1), AddCallerSkip(3)), `.+/src/runtime/.*:[\d]+$`}, + } + for _, tt := range tests { + withLogger(t, DebugLevel, tt.options, func(logger *Logger, logs *observer.ObservedLogs) { + // Make sure that sugaring and desugaring resets caller skip properly. + logger = logger.Sugar().Desugar() + logger.Info("") + output := logs.AllUntimed() + assert.Equal(t, 1, len(output), "Unexpected number of logs written out.") + assert.Regexp( + t, + tt.pat, + output[0].Entry.Caller, + "Expected to find package name and file name in output.", + ) + }) + } +} + +func TestLoggerAddCallerFail(t *testing.T) { + errBuf := &ztest.Buffer{} + withLogger(t, DebugLevel, opts(AddCaller(), ErrorOutput(errBuf)), func(log *Logger, logs *observer.ObservedLogs) { + log.callerSkip = 1e3 + log.Info("Failure.") + assert.Regexp( + t, + `Logger.check error: failed to get caller`, + errBuf.String(), + "Didn't find expected failure message.", + ) + assert.Equal( + t, + logs.AllUntimed()[0].Entry.Message, + "Failure.", + "Expected original message to survive failures in runtime.Caller.") + }) +} + +func TestLoggerReplaceCore(t *testing.T) { + replace := WrapCore(func(zapcore.Core) zapcore.Core { + return zapcore.NewNopCore() + }) + withLogger(t, DebugLevel, opts(replace), func(logger *Logger, logs *observer.ObservedLogs) { + logger.Debug("") + logger.Info("") + logger.Warn("") + assert.Equal(t, 0, logs.Len(), "Expected no-op core to write no logs.") + }) +} + +func TestLoggerHooks(t *testing.T) { + hook, seen := makeCountingHook() + withLogger(t, DebugLevel, opts(Hooks(hook)), func(logger *Logger, logs *observer.ObservedLogs) { + logger.Debug("") + logger.Info("") + }) + assert.Equal(t, int64(2), seen.Load(), "Hook saw an unexpected number of logs.") +} + +func TestLoggerConcurrent(t *testing.T) { + withLogger(t, DebugLevel, nil, func(logger *Logger, logs *observer.ObservedLogs) { + child := logger.With(String("foo", "bar")) + + wg := &sync.WaitGroup{} + runConcurrently(5, 10, wg, func() { + logger.Info("", String("foo", "bar")) + }) + runConcurrently(5, 10, wg, func() { + child.Info("") + }) + + wg.Wait() + + // Make sure the output doesn't contain interspersed entries. + assert.Equal(t, 100, logs.Len(), "Unexpected number of logs written out.") + for _, obs := range logs.AllUntimed() { + assert.Equal( + t, + observer.LoggedEntry{ + Entry: zapcore.Entry{Level: InfoLevel}, + Context: []Field{String("foo", "bar")}, + }, + obs, + "Unexpected log output.", + ) + } + }) +} diff --git a/vendor/go.uber.org/zap/options.go b/vendor/go.uber.org/zap/options.go new file mode 100644 index 000000000..7a6b0fca1 --- /dev/null +++ b/vendor/go.uber.org/zap/options.go @@ -0,0 +1,109 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import "go.uber.org/zap/zapcore" + +// An Option configures a Logger. +type Option interface { + apply(*Logger) +} + +// optionFunc wraps a func so it satisfies the Option interface. +type optionFunc func(*Logger) + +func (f optionFunc) apply(log *Logger) { + f(log) +} + +// WrapCore wraps or replaces the Logger's underlying zapcore.Core. +func WrapCore(f func(zapcore.Core) zapcore.Core) Option { + return optionFunc(func(log *Logger) { + log.core = f(log.core) + }) +} + +// Hooks registers functions which will be called each time the Logger writes +// out an Entry. Repeated use of Hooks is additive. +// +// Hooks are useful for simple side effects, like capturing metrics for the +// number of emitted logs. More complex side effects, including anything that +// requires access to the Entry's structured fields, should be implemented as +// a zapcore.Core instead. See zapcore.RegisterHooks for details. +func Hooks(hooks ...func(zapcore.Entry) error) Option { + return optionFunc(func(log *Logger) { + log.core = zapcore.RegisterHooks(log.core, hooks...) + }) +} + +// Fields adds fields to the Logger. +func Fields(fs ...Field) Option { + return optionFunc(func(log *Logger) { + log.core = log.core.With(fs) + }) +} + +// ErrorOutput sets the destination for errors generated by the Logger. Note +// that this option only affects internal errors; for sample code that sends +// error-level logs to a different location from info- and debug-level logs, +// see the package-level AdvancedConfiguration example. +// +// The supplied WriteSyncer must be safe for concurrent use. The Open and +// zapcore.Lock functions are the simplest ways to protect files with a mutex. +func ErrorOutput(w zapcore.WriteSyncer) Option { + return optionFunc(func(log *Logger) { + log.errorOutput = w + }) +} + +// Development puts the logger in development mode, which makes DPanic-level +// logs panic instead of simply logging an error. +func Development() Option { + return optionFunc(func(log *Logger) { + log.development = true + }) +} + +// AddCaller configures the Logger to annotate each message with the filename +// and line number of zap's caller. +func AddCaller() Option { + return optionFunc(func(log *Logger) { + log.addCaller = true + }) +} + +// AddCallerSkip increases the number of callers skipped by caller annotation +// (as enabled by the AddCaller option). When building wrappers around the +// Logger and SugaredLogger, supplying this Option prevents zap from always +// reporting the wrapper code as the caller. +func AddCallerSkip(skip int) Option { + return optionFunc(func(log *Logger) { + log.callerSkip += skip + }) +} + +// AddStacktrace configures the Logger to record a stack trace for all messages at +// or above a given level. +func AddStacktrace(lvl zapcore.LevelEnabler) Option { + return optionFunc(func(log *Logger) { + log.addStack = lvl + }) +} diff --git a/vendor/go.uber.org/zap/scripts/cover.sh b/vendor/go.uber.org/zap/scripts/cover.sh new file mode 100755 index 000000000..0da503cba --- /dev/null +++ b/vendor/go.uber.org/zap/scripts/cover.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e +echo "" > cover.out + +for d in $(go list $@); do + go test -race -coverprofile=profile.out $d + if [ -f profile.out ]; then + cat profile.out >> cover.out + rm profile.out + fi +done diff --git a/vendor/go.uber.org/zap/sink.go b/vendor/go.uber.org/zap/sink.go new file mode 100644 index 000000000..ff0becfe5 --- /dev/null +++ b/vendor/go.uber.org/zap/sink.go @@ -0,0 +1,161 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "errors" + "fmt" + "io" + "net/url" + "os" + "strings" + "sync" + + "go.uber.org/zap/zapcore" +) + +const schemeFile = "file" + +var ( + _sinkMutex sync.RWMutex + _sinkFactories map[string]func(*url.URL) (Sink, error) // keyed by scheme +) + +func init() { + resetSinkRegistry() +} + +func resetSinkRegistry() { + _sinkMutex.Lock() + defer _sinkMutex.Unlock() + + _sinkFactories = map[string]func(*url.URL) (Sink, error){ + schemeFile: newFileSink, + } +} + +// Sink defines the interface to write to and close logger destinations. +type Sink interface { + zapcore.WriteSyncer + io.Closer +} + +type nopCloserSink struct{ zapcore.WriteSyncer } + +func (nopCloserSink) Close() error { return nil } + +type errSinkNotFound struct { + scheme string +} + +func (e *errSinkNotFound) Error() string { + return fmt.Sprintf("no sink found for scheme %q", e.scheme) +} + +// RegisterSink registers a user-supplied factory for all sinks with a +// particular scheme. +// +// All schemes must be ASCII, valid under section 3.1 of RFC 3986 +// (https://tools.ietf.org/html/rfc3986#section-3.1), and must not already +// have a factory registered. Zap automatically registers a factory for the +// "file" scheme. +func RegisterSink(scheme string, factory func(*url.URL) (Sink, error)) error { + _sinkMutex.Lock() + defer _sinkMutex.Unlock() + + if scheme == "" { + return errors.New("can't register a sink factory for empty string") + } + normalized, err := normalizeScheme(scheme) + if err != nil { + return fmt.Errorf("%q is not a valid scheme: %v", scheme, err) + } + if _, ok := _sinkFactories[normalized]; ok { + return fmt.Errorf("sink factory already registered for scheme %q", normalized) + } + _sinkFactories[normalized] = factory + return nil +} + +func newSink(rawURL string) (Sink, error) { + u, err := url.Parse(rawURL) + if err != nil { + return nil, fmt.Errorf("can't parse %q as a URL: %v", rawURL, err) + } + if u.Scheme == "" { + u.Scheme = schemeFile + } + + _sinkMutex.RLock() + factory, ok := _sinkFactories[u.Scheme] + _sinkMutex.RUnlock() + if !ok { + return nil, &errSinkNotFound{u.Scheme} + } + return factory(u) +} + +func newFileSink(u *url.URL) (Sink, error) { + if u.User != nil { + return nil, fmt.Errorf("user and password not allowed with file URLs: got %v", u) + } + if u.Fragment != "" { + return nil, fmt.Errorf("fragments not allowed with file URLs: got %v", u) + } + if u.RawQuery != "" { + return nil, fmt.Errorf("query parameters not allowed with file URLs: got %v", u) + } + // Error messages are better if we check hostname and port separately. + if u.Port() != "" { + return nil, fmt.Errorf("ports not allowed with file URLs: got %v", u) + } + if hn := u.Hostname(); hn != "" && hn != "localhost" { + return nil, fmt.Errorf("file URLs must leave host empty or use localhost: got %v", u) + } + switch u.Path { + case "stdout": + return nopCloserSink{os.Stdout}, nil + case "stderr": + return nopCloserSink{os.Stderr}, nil + } + return os.OpenFile(u.Path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644) +} + +func normalizeScheme(s string) (string, error) { + // https://tools.ietf.org/html/rfc3986#section-3.1 + s = strings.ToLower(s) + if first := s[0]; 'a' > first || 'z' < first { + return "", errors.New("must start with a letter") + } + for i := 1; i < len(s); i++ { // iterate over bytes, not runes + c := s[i] + switch { + case 'a' <= c && c <= 'z': + continue + case '0' <= c && c <= '9': + continue + case c == '.' || c == '+' || c == '-': + continue + } + return "", fmt.Errorf("may not contain %q", c) + } + return s, nil +} diff --git a/vendor/go.uber.org/zap/sink_test.go b/vendor/go.uber.org/zap/sink_test.go new file mode 100644 index 000000000..2616a012e --- /dev/null +++ b/vendor/go.uber.org/zap/sink_test.go @@ -0,0 +1,100 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "bytes" + "io/ioutil" + "net/url" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.uber.org/zap/zapcore" +) + +func TestRegisterSink(t *testing.T) { + const ( + memScheme = "m" + nopScheme = "no-op.1234" + ) + var memCalls, nopCalls int + + buf := bytes.NewBuffer(nil) + memFactory := func(u *url.URL) (Sink, error) { + assert.Equal(t, u.Scheme, memScheme, "Scheme didn't match registration.") + memCalls++ + return nopCloserSink{zapcore.AddSync(buf)}, nil + } + nopFactory := func(u *url.URL) (Sink, error) { + assert.Equal(t, u.Scheme, nopScheme, "Scheme didn't match registration.") + nopCalls++ + return nopCloserSink{zapcore.AddSync(ioutil.Discard)}, nil + } + + defer resetSinkRegistry() + + require.NoError(t, RegisterSink(strings.ToUpper(memScheme), memFactory), "Failed to register scheme %q.", memScheme) + require.NoError(t, RegisterSink(nopScheme, nopFactory), "Failed to register scheme %q.", memScheme) + + sink, close, err := Open( + memScheme+"://somewhere", + nopScheme+"://somewhere-else", + ) + assert.NoError(t, err, "Unexpected error opening URLs with registered schemes.") + + defer close() + + assert.Equal(t, 1, memCalls, "Unexpected number of calls to memory factory.") + assert.Equal(t, 1, nopCalls, "Unexpected number of calls to no-op factory.") + + _, err = sink.Write([]byte("foo")) + assert.NoError(t, err, "Failed to write to combined WriteSyncer.") + assert.Equal(t, "foo", buf.String(), "Unexpected buffer contents.") +} + +func TestRegisterSinkErrors(t *testing.T) { + nopFactory := func(_ *url.URL) (Sink, error) { + return nopCloserSink{zapcore.AddSync(ioutil.Discard)}, nil + } + tests := []struct { + scheme string + err string + }{ + {"", "empty string"}, + {"FILE", "already registered"}, + {"42", "not a valid scheme"}, + {"http*", "not a valid scheme"}, + } + + for _, tt := range tests { + t.Run("scheme-"+tt.scheme, func(t *testing.T) { + defer resetSinkRegistry() + + err := RegisterSink(tt.scheme, nopFactory) + if assert.Error(t, err, "expected error") { + assert.Contains(t, err.Error(), tt.err, "unexpected error") + } + }) + } +} diff --git a/vendor/go.uber.org/zap/stacktrace.go b/vendor/go.uber.org/zap/stacktrace.go new file mode 100644 index 000000000..100fac216 --- /dev/null +++ b/vendor/go.uber.org/zap/stacktrace.go @@ -0,0 +1,126 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "runtime" + "strings" + "sync" + + "go.uber.org/zap/internal/bufferpool" +) + +const _zapPackage = "go.uber.org/zap" + +var ( + _stacktracePool = sync.Pool{ + New: func() interface{} { + return newProgramCounters(64) + }, + } + + // We add "." and "/" suffixes to the package name to ensure we only match + // the exact package and not any package with the same prefix. + _zapStacktracePrefixes = addPrefix(_zapPackage, ".", "/") + _zapStacktraceVendorContains = addPrefix("/vendor/", _zapStacktracePrefixes...) +) + +func takeStacktrace() string { + buffer := bufferpool.Get() + defer buffer.Free() + programCounters := _stacktracePool.Get().(*programCounters) + defer _stacktracePool.Put(programCounters) + + var numFrames int + for { + // Skip the call to runtime.Counters and takeStacktrace so that the + // program counters start at the caller of takeStacktrace. + numFrames = runtime.Callers(2, programCounters.pcs) + if numFrames < len(programCounters.pcs) { + break + } + // Don't put the too-short counter slice back into the pool; this lets + // the pool adjust if we consistently take deep stacktraces. + programCounters = newProgramCounters(len(programCounters.pcs) * 2) + } + + i := 0 + skipZapFrames := true // skip all consecutive zap frames at the beginning. + frames := runtime.CallersFrames(programCounters.pcs[:numFrames]) + + // Note: On the last iteration, frames.Next() returns false, with a valid + // frame, but we ignore this frame. The last frame is a a runtime frame which + // adds noise, since it's only either runtime.main or runtime.goexit. + for frame, more := frames.Next(); more; frame, more = frames.Next() { + if skipZapFrames && isZapFrame(frame.Function) { + continue + } else { + skipZapFrames = false + } + + if i != 0 { + buffer.AppendByte('\n') + } + i++ + buffer.AppendString(frame.Function) + buffer.AppendByte('\n') + buffer.AppendByte('\t') + buffer.AppendString(frame.File) + buffer.AppendByte(':') + buffer.AppendInt(int64(frame.Line)) + } + + return buffer.String() +} + +func isZapFrame(function string) bool { + for _, prefix := range _zapStacktracePrefixes { + if strings.HasPrefix(function, prefix) { + return true + } + } + + // We can't use a prefix match here since the location of the vendor + // directory affects the prefix. Instead we do a contains match. + for _, contains := range _zapStacktraceVendorContains { + if strings.Contains(function, contains) { + return true + } + } + + return false +} + +type programCounters struct { + pcs []uintptr +} + +func newProgramCounters(size int) *programCounters { + return &programCounters{make([]uintptr, size)} +} + +func addPrefix(prefix string, ss ...string) []string { + withPrefix := make([]string, len(ss)) + for i, s := range ss { + withPrefix[i] = prefix + s + } + return withPrefix +} diff --git a/vendor/go.uber.org/zap/stacktrace_ext_test.go b/vendor/go.uber.org/zap/stacktrace_ext_test.go new file mode 100644 index 000000000..b7e71b6b8 --- /dev/null +++ b/vendor/go.uber.org/zap/stacktrace_ext_test.go @@ -0,0 +1,164 @@ +// Copyright (c) 2016, 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap_test + +import ( + "bytes" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// _zapPackages are packages that we search for in the logging output to match a +// zap stack frame. It is different from _zapStacktracePrefixes which is only +// intended to match on the function name, while this is on the full output +// which includes filenames. +var _zapPackages = []string{ + "go.uber.org/zap.", + "go.uber.org/zap/zapcore.", +} + +func TestStacktraceFiltersZapLog(t *testing.T) { + withLogger(t, func(logger *zap.Logger, out *bytes.Buffer) { + logger.Error("test log") + logger.Sugar().Error("sugar test log") + + require.Contains(t, out.String(), "TestStacktraceFiltersZapLog", "Should not strip out non-zap import") + verifyNoZap(t, out.String()) + }) +} + +func TestStacktraceFiltersZapMarshal(t *testing.T) { + withLogger(t, func(logger *zap.Logger, out *bytes.Buffer) { + marshal := func(enc zapcore.ObjectEncoder) error { + logger.Warn("marshal caused warn") + enc.AddString("f", "v") + return nil + } + logger.Error("test log", zap.Object("obj", zapcore.ObjectMarshalerFunc(marshal))) + + logs := out.String() + + // The marshal function (which will be under the test function) should not be stripped. + const marshalFnPrefix = "TestStacktraceFiltersZapMarshal." + require.Contains(t, logs, marshalFnPrefix, "Should not strip out marshal call") + + // There should be no zap stack traces before that point. + marshalIndex := strings.Index(logs, marshalFnPrefix) + verifyNoZap(t, logs[:marshalIndex]) + + // After that point, there should be zap stack traces - we don't want to strip out + // the Marshal caller information. + for _, fnPrefix := range _zapPackages { + require.Contains(t, logs[marshalIndex:], fnPrefix, "Missing zap caller stack for Marshal") + } + }) +} + +func TestStacktraceFiltersVendorZap(t *testing.T) { + // We need to simulate a zap as a vendor library, so we're going to create a fake GOPATH + // and run the above test which will contain zap in the vendor directory. + withGoPath(t, func(goPath string) { + curDir, err := os.Getwd() + require.NoError(t, err, "Failed to get current directory") + + testDir := filepath.Join(goPath, "src/go.uber.org/zap_test/") + vendorDir := filepath.Join(testDir, "vendor") + require.NoError(t, os.MkdirAll(testDir, 0777), "Failed to create source director") + + curFile := getSelfFilename(t) + //copyFile(t, curFile, filepath.Join(testDir, curFile)) + setupSymlink(t, curFile, filepath.Join(testDir, curFile)) + + // Set up symlinks for zap, and for any test dependencies. + setupSymlink(t, curDir, filepath.Join(vendorDir, "go.uber.org/zap")) + for _, testDep := range []string{"github.com/stretchr/testify"} { + target := filepath.Join(curDir, "vendor", testDep) + _, err := os.Stat(target) + require.NoError(t, err, "Required dependency (%v) not installed in vendor", target) + setupSymlink(t, target, filepath.Join(vendorDir, testDep)) + } + + // Now run the above test which ensures we filter out zap stacktraces, but this time + // zap is in a vendor + cmd := exec.Command("go", "test", "-v", "-run", "TestStacktraceFiltersZap") + cmd.Dir = testDir + out, err := cmd.CombinedOutput() + require.NoError(t, err, "Failed to run test in vendor directory, output: %s", out) + assert.Contains(t, string(out), "PASS") + }) +} + +// withLogger sets up a logger with a real encoder set up, so that any marshal functions are called. +// The inbuilt observer does not call Marshal for objects/arrays, which we need for some tests. +func withLogger(t *testing.T, fn func(logger *zap.Logger, out *bytes.Buffer)) { + buf := &bytes.Buffer{} + encoder := zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()) + core := zapcore.NewCore(encoder, zapcore.AddSync(buf), zapcore.DebugLevel) + logger := zap.New(core, zap.AddStacktrace(zap.DebugLevel)) + fn(logger, buf) +} + +func verifyNoZap(t *testing.T, logs string) { + for _, fnPrefix := range _zapPackages { + require.NotContains(t, logs, fnPrefix, "Should not strip out marshal call") + } +} + +func withGoPath(t *testing.T, f func(goPath string)) { + goPath, err := ioutil.TempDir("", "gopath") + require.NoError(t, err, "Failed to create temporary directory for GOPATH") + //defer os.RemoveAll(goPath) + + os.Setenv("GOPATH", goPath) + defer os.Setenv("GOPATH", os.Getenv("GOPATH")) + + f(goPath) +} + +func getSelfFilename(t *testing.T) string { + _, file, _, ok := runtime.Caller(0) + require.True(t, ok, "Failed to get caller information to identify local file") + + return filepath.Base(file) +} + +func setupSymlink(t *testing.T, src, dst string) { + // Make sure the destination directory exists. + os.MkdirAll(filepath.Dir(dst), 0777) + + // Get absolute path of the source for the symlink, otherwise we can create a symlink + // that uses relative paths. + srcAbs, err := filepath.Abs(src) + require.NoError(t, err, "Failed to get absolute path") + + require.NoError(t, os.Symlink(srcAbs, dst), "Failed to set up symlink") +} diff --git a/vendor/go.uber.org/zap/stacktrace_test.go b/vendor/go.uber.org/zap/stacktrace_test.go new file mode 100644 index 000000000..3c9a41cfd --- /dev/null +++ b/vendor/go.uber.org/zap/stacktrace_test.go @@ -0,0 +1,75 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestTakeStacktrace(t *testing.T) { + trace := takeStacktrace() + lines := strings.Split(trace, "\n") + require.True(t, len(lines) > 0, "Expected stacktrace to have at least one frame.") + assert.Contains( + t, + lines[0], + "testing.", + "Expected stacktrace to start with the test runner (zap frames are filtered out) %s.", lines[0], + ) +} + +func TestIsZapFrame(t *testing.T) { + zapFrames := []string{ + "go.uber.org/zap.Stack", + "go.uber.org/zap.(*SugaredLogger).log", + "go.uber.org/zap/zapcore.(ArrayMarshalerFunc).MarshalLogArray", + "github.com/uber/tchannel-go/vendor/go.uber.org/zap.Stack", + "github.com/uber/tchannel-go/vendor/go.uber.org/zap.(*SugaredLogger).log", + "github.com/uber/tchannel-go/vendor/go.uber.org/zap/zapcore.(ArrayMarshalerFunc).MarshalLogArray", + } + nonZapFrames := []string{ + "github.com/uber/tchannel-go.NewChannel", + "go.uber.org/not-zap.New", + "go.uber.org/zapext.ctx", + "go.uber.org/zap_ext/ctx.New", + } + + t.Run("zap frames", func(t *testing.T) { + for _, f := range zapFrames { + require.True(t, isZapFrame(f), f) + } + }) + t.Run("non-zap frames", func(t *testing.T) { + for _, f := range nonZapFrames { + require.False(t, isZapFrame(f), f) + } + }) +} + +func BenchmarkTakeStacktrace(b *testing.B) { + for i := 0; i < b.N; i++ { + takeStacktrace() + } +} diff --git a/vendor/go.uber.org/zap/sugar.go b/vendor/go.uber.org/zap/sugar.go new file mode 100644 index 000000000..77ca227f4 --- /dev/null +++ b/vendor/go.uber.org/zap/sugar.go @@ -0,0 +1,304 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "fmt" + + "go.uber.org/zap/zapcore" + + "go.uber.org/multierr" +) + +const ( + _oddNumberErrMsg = "Ignored key without a value." + _nonStringKeyErrMsg = "Ignored key-value pairs with non-string keys." +) + +// A SugaredLogger wraps the base Logger functionality in a slower, but less +// verbose, API. Any Logger can be converted to a SugaredLogger with its Sugar +// method. +// +// Unlike the Logger, the SugaredLogger doesn't insist on structured logging. +// For each log level, it exposes three methods: one for loosely-typed +// structured logging, one for println-style formatting, and one for +// printf-style formatting. For example, SugaredLoggers can produce InfoLevel +// output with Infow ("info with" structured context), Info, or Infof. +type SugaredLogger struct { + base *Logger +} + +// Desugar unwraps a SugaredLogger, exposing the original Logger. Desugaring +// is quite inexpensive, so it's reasonable for a single application to use +// both Loggers and SugaredLoggers, converting between them on the boundaries +// of performance-sensitive code. +func (s *SugaredLogger) Desugar() *Logger { + base := s.base.clone() + base.callerSkip -= 2 + return base +} + +// Named adds a sub-scope to the logger's name. See Logger.Named for details. +func (s *SugaredLogger) Named(name string) *SugaredLogger { + return &SugaredLogger{base: s.base.Named(name)} +} + +// With adds a variadic number of fields to the logging context. It accepts a +// mix of strongly-typed Field objects and loosely-typed key-value pairs. When +// processing pairs, the first element of the pair is used as the field key +// and the second as the field value. +// +// For example, +// sugaredLogger.With( +// "hello", "world", +// "failure", errors.New("oh no"), +// Stack(), +// "count", 42, +// "user", User{Name: "alice"}, +// ) +// is the equivalent of +// unsugared.With( +// String("hello", "world"), +// String("failure", "oh no"), +// Stack(), +// Int("count", 42), +// Object("user", User{Name: "alice"}), +// ) +// +// Note that the keys in key-value pairs should be strings. In development, +// passing a non-string key panics. In production, the logger is more +// forgiving: a separate error is logged, but the key-value pair is skipped +// and execution continues. Passing an orphaned key triggers similar behavior: +// panics in development and errors in production. +func (s *SugaredLogger) With(args ...interface{}) *SugaredLogger { + return &SugaredLogger{base: s.base.With(s.sweetenFields(args)...)} +} + +// Debug uses fmt.Sprint to construct and log a message. +func (s *SugaredLogger) Debug(args ...interface{}) { + s.log(DebugLevel, "", args, nil) +} + +// Info uses fmt.Sprint to construct and log a message. +func (s *SugaredLogger) Info(args ...interface{}) { + s.log(InfoLevel, "", args, nil) +} + +// Warn uses fmt.Sprint to construct and log a message. +func (s *SugaredLogger) Warn(args ...interface{}) { + s.log(WarnLevel, "", args, nil) +} + +// Error uses fmt.Sprint to construct and log a message. +func (s *SugaredLogger) Error(args ...interface{}) { + s.log(ErrorLevel, "", args, nil) +} + +// DPanic uses fmt.Sprint to construct and log a message. In development, the +// logger then panics. (See DPanicLevel for details.) +func (s *SugaredLogger) DPanic(args ...interface{}) { + s.log(DPanicLevel, "", args, nil) +} + +// Panic uses fmt.Sprint to construct and log a message, then panics. +func (s *SugaredLogger) Panic(args ...interface{}) { + s.log(PanicLevel, "", args, nil) +} + +// Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit. +func (s *SugaredLogger) Fatal(args ...interface{}) { + s.log(FatalLevel, "", args, nil) +} + +// Debugf uses fmt.Sprintf to log a templated message. +func (s *SugaredLogger) Debugf(template string, args ...interface{}) { + s.log(DebugLevel, template, args, nil) +} + +// Infof uses fmt.Sprintf to log a templated message. +func (s *SugaredLogger) Infof(template string, args ...interface{}) { + s.log(InfoLevel, template, args, nil) +} + +// Warnf uses fmt.Sprintf to log a templated message. +func (s *SugaredLogger) Warnf(template string, args ...interface{}) { + s.log(WarnLevel, template, args, nil) +} + +// Errorf uses fmt.Sprintf to log a templated message. +func (s *SugaredLogger) Errorf(template string, args ...interface{}) { + s.log(ErrorLevel, template, args, nil) +} + +// DPanicf uses fmt.Sprintf to log a templated message. In development, the +// logger then panics. (See DPanicLevel for details.) +func (s *SugaredLogger) DPanicf(template string, args ...interface{}) { + s.log(DPanicLevel, template, args, nil) +} + +// Panicf uses fmt.Sprintf to log a templated message, then panics. +func (s *SugaredLogger) Panicf(template string, args ...interface{}) { + s.log(PanicLevel, template, args, nil) +} + +// Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit. +func (s *SugaredLogger) Fatalf(template string, args ...interface{}) { + s.log(FatalLevel, template, args, nil) +} + +// Debugw logs a message with some additional context. The variadic key-value +// pairs are treated as they are in With. +// +// When debug-level logging is disabled, this is much faster than +// s.With(keysAndValues).Debug(msg) +func (s *SugaredLogger) Debugw(msg string, keysAndValues ...interface{}) { + s.log(DebugLevel, msg, nil, keysAndValues) +} + +// Infow logs a message with some additional context. The variadic key-value +// pairs are treated as they are in With. +func (s *SugaredLogger) Infow(msg string, keysAndValues ...interface{}) { + s.log(InfoLevel, msg, nil, keysAndValues) +} + +// Warnw logs a message with some additional context. The variadic key-value +// pairs are treated as they are in With. +func (s *SugaredLogger) Warnw(msg string, keysAndValues ...interface{}) { + s.log(WarnLevel, msg, nil, keysAndValues) +} + +// Errorw logs a message with some additional context. The variadic key-value +// pairs are treated as they are in With. +func (s *SugaredLogger) Errorw(msg string, keysAndValues ...interface{}) { + s.log(ErrorLevel, msg, nil, keysAndValues) +} + +// DPanicw logs a message with some additional context. In development, the +// logger then panics. (See DPanicLevel for details.) The variadic key-value +// pairs are treated as they are in With. +func (s *SugaredLogger) DPanicw(msg string, keysAndValues ...interface{}) { + s.log(DPanicLevel, msg, nil, keysAndValues) +} + +// Panicw logs a message with some additional context, then panics. The +// variadic key-value pairs are treated as they are in With. +func (s *SugaredLogger) Panicw(msg string, keysAndValues ...interface{}) { + s.log(PanicLevel, msg, nil, keysAndValues) +} + +// Fatalw logs a message with some additional context, then calls os.Exit. The +// variadic key-value pairs are treated as they are in With. +func (s *SugaredLogger) Fatalw(msg string, keysAndValues ...interface{}) { + s.log(FatalLevel, msg, nil, keysAndValues) +} + +// Sync flushes any buffered log entries. +func (s *SugaredLogger) Sync() error { + return s.base.Sync() +} + +func (s *SugaredLogger) log(lvl zapcore.Level, template string, fmtArgs []interface{}, context []interface{}) { + // If logging at this level is completely disabled, skip the overhead of + // string formatting. + if lvl < DPanicLevel && !s.base.Core().Enabled(lvl) { + return + } + + // Format with Sprint, Sprintf, or neither. + msg := template + if msg == "" && len(fmtArgs) > 0 { + msg = fmt.Sprint(fmtArgs...) + } else if msg != "" && len(fmtArgs) > 0 { + msg = fmt.Sprintf(template, fmtArgs...) + } + + if ce := s.base.Check(lvl, msg); ce != nil { + ce.Write(s.sweetenFields(context)...) + } +} + +func (s *SugaredLogger) sweetenFields(args []interface{}) []Field { + if len(args) == 0 { + return nil + } + + // Allocate enough space for the worst case; if users pass only structured + // fields, we shouldn't penalize them with extra allocations. + fields := make([]Field, 0, len(args)) + var invalid invalidPairs + + for i := 0; i < len(args); { + // This is a strongly-typed field. Consume it and move on. + if f, ok := args[i].(Field); ok { + fields = append(fields, f) + i++ + continue + } + + // Make sure this element isn't a dangling key. + if i == len(args)-1 { + s.base.DPanic(_oddNumberErrMsg, Any("ignored", args[i])) + break + } + + // Consume this value and the next, treating them as a key-value pair. If the + // key isn't a string, add this pair to the slice of invalid pairs. + key, val := args[i], args[i+1] + if keyStr, ok := key.(string); !ok { + // Subsequent errors are likely, so allocate once up front. + if cap(invalid) == 0 { + invalid = make(invalidPairs, 0, len(args)/2) + } + invalid = append(invalid, invalidPair{i, key, val}) + } else { + fields = append(fields, Any(keyStr, val)) + } + i += 2 + } + + // If we encountered any invalid key-value pairs, log an error. + if len(invalid) > 0 { + s.base.DPanic(_nonStringKeyErrMsg, Array("invalid", invalid)) + } + return fields +} + +type invalidPair struct { + position int + key, value interface{} +} + +func (p invalidPair) MarshalLogObject(enc zapcore.ObjectEncoder) error { + enc.AddInt64("position", int64(p.position)) + Any("key", p.key).AddTo(enc) + Any("value", p.value).AddTo(enc) + return nil +} + +type invalidPairs []invalidPair + +func (ps invalidPairs) MarshalLogArray(enc zapcore.ArrayEncoder) error { + var err error + for i := range ps { + err = multierr.Append(err, enc.AppendObject(ps[i])) + } + return err +} diff --git a/vendor/go.uber.org/zap/sugar_test.go b/vendor/go.uber.org/zap/sugar_test.go new file mode 100644 index 000000000..5b1dcfacd --- /dev/null +++ b/vendor/go.uber.org/zap/sugar_test.go @@ -0,0 +1,374 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "testing" + + "go.uber.org/zap/internal/exit" + "go.uber.org/zap/internal/ztest" + "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest/observer" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestSugarWith(t *testing.T) { + // Convenience functions to create expected error logs. + ignored := func(msg interface{}) observer.LoggedEntry { + return observer.LoggedEntry{ + Entry: zapcore.Entry{Level: DPanicLevel, Message: _oddNumberErrMsg}, + Context: []Field{Any("ignored", msg)}, + } + } + nonString := func(pairs ...invalidPair) observer.LoggedEntry { + return observer.LoggedEntry{ + Entry: zapcore.Entry{Level: DPanicLevel, Message: _nonStringKeyErrMsg}, + Context: []Field{Array("invalid", invalidPairs(pairs))}, + } + } + + tests := []struct { + desc string + args []interface{} + expected []Field + errLogs []observer.LoggedEntry + }{ + { + desc: "nil args", + args: nil, + expected: []Field{}, + errLogs: nil, + }, + { + desc: "empty slice of args", + args: []interface{}{}, + expected: []Field{}, + errLogs: nil, + }, + { + desc: "just a dangling key", + args: []interface{}{"should ignore"}, + expected: []Field{}, + errLogs: []observer.LoggedEntry{ignored("should ignore")}, + }, + { + desc: "well-formed key-value pairs", + args: []interface{}{"foo", 42, "true", "bar"}, + expected: []Field{Int("foo", 42), String("true", "bar")}, + errLogs: nil, + }, + { + desc: "just a structured field", + args: []interface{}{Int("foo", 42)}, + expected: []Field{Int("foo", 42)}, + errLogs: nil, + }, + { + desc: "structured field and a dangling key", + args: []interface{}{Int("foo", 42), "dangling"}, + expected: []Field{Int("foo", 42)}, + errLogs: []observer.LoggedEntry{ignored("dangling")}, + }, + { + desc: "structured field and a dangling non-string key", + args: []interface{}{Int("foo", 42), 13}, + expected: []Field{Int("foo", 42)}, + errLogs: []observer.LoggedEntry{ignored(13)}, + }, + { + desc: "key-value pair and a dangling key", + args: []interface{}{"foo", 42, "dangling"}, + expected: []Field{Int("foo", 42)}, + errLogs: []observer.LoggedEntry{ignored("dangling")}, + }, + { + desc: "pairs, a structured field, and a dangling key", + args: []interface{}{"first", "field", Int("foo", 42), "baz", "quux", "dangling"}, + expected: []Field{String("first", "field"), Int("foo", 42), String("baz", "quux")}, + errLogs: []observer.LoggedEntry{ignored("dangling")}, + }, + { + desc: "one non-string key", + args: []interface{}{"foo", 42, true, "bar"}, + expected: []Field{Int("foo", 42)}, + errLogs: []observer.LoggedEntry{nonString(invalidPair{2, true, "bar"})}, + }, + { + desc: "pairs, structured fields, non-string keys, and a dangling key", + args: []interface{}{"foo", 42, true, "bar", Int("structure", 11), 42, "reversed", "baz", "quux", "dangling"}, + expected: []Field{Int("foo", 42), Int("structure", 11), String("baz", "quux")}, + errLogs: []observer.LoggedEntry{ + ignored("dangling"), + nonString(invalidPair{2, true, "bar"}, invalidPair{5, 42, "reversed"}), + }, + }, + } + + for _, tt := range tests { + withSugar(t, DebugLevel, nil, func(logger *SugaredLogger, logs *observer.ObservedLogs) { + logger.With(tt.args...).Info("") + output := logs.AllUntimed() + if len(tt.errLogs) > 0 { + for i := range tt.errLogs { + assert.Equal(t, tt.errLogs[i], output[i], "Unexpected error log at position %d for scenario %s.", i, tt.desc) + } + } + assert.Equal(t, len(tt.errLogs)+1, len(output), "Expected only one non-error message to be logged in scenario %s.", tt.desc) + assert.Equal(t, tt.expected, output[len(tt.errLogs)].Context, "Unexpected message context in scenario %s.", tt.desc) + }) + } +} + +func TestSugarFieldsInvalidPairs(t *testing.T) { + withSugar(t, DebugLevel, nil, func(logger *SugaredLogger, logs *observer.ObservedLogs) { + logger.With(42, "foo", []string{"bar"}, "baz").Info("") + output := logs.AllUntimed() + + // Double-check that the actual message was logged. + require.Equal(t, 2, len(output), "Unexpected number of entries logged.") + require.Equal(t, observer.LoggedEntry{Context: []Field{}}, output[1], "Unexpected non-error log entry.") + + // Assert that the error message's structured fields serialize properly. + require.Equal(t, 1, len(output[0].Context), "Expected one field in error entry context.") + enc := zapcore.NewMapObjectEncoder() + output[0].Context[0].AddTo(enc) + assert.Equal(t, []interface{}{ + map[string]interface{}{"position": int64(0), "key": int64(42), "value": "foo"}, + map[string]interface{}{"position": int64(2), "key": []interface{}{"bar"}, "value": "baz"}, + }, enc.Fields["invalid"], "Unexpected output when logging invalid key-value pairs.") + }) +} + +type stringerF func() string + +func (f stringerF) String() string { return f() } + +func TestSugarStructuredLogging(t *testing.T) { + tests := []struct { + msg string + expectMsg string + }{ + {"foo", "foo"}, + {"", ""}, + } + + // Common to all test cases. + context := []interface{}{"foo", "bar"} + extra := []interface{}{"baz", false} + expectedFields := []Field{String("foo", "bar"), Bool("baz", false)} + + for _, tt := range tests { + withSugar(t, DebugLevel, nil, func(logger *SugaredLogger, logs *observer.ObservedLogs) { + logger.With(context...).Debugw(tt.msg, extra...) + logger.With(context...).Infow(tt.msg, extra...) + logger.With(context...).Warnw(tt.msg, extra...) + logger.With(context...).Errorw(tt.msg, extra...) + logger.With(context...).DPanicw(tt.msg, extra...) + + expected := make([]observer.LoggedEntry, 5) + for i, lvl := range []zapcore.Level{DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel} { + expected[i] = observer.LoggedEntry{ + Entry: zapcore.Entry{Message: tt.expectMsg, Level: lvl}, + Context: expectedFields, + } + } + assert.Equal(t, expected, logs.AllUntimed(), "Unexpected log output.") + }) + } +} + +func TestSugarConcatenatingLogging(t *testing.T) { + tests := []struct { + args []interface{} + expect string + }{ + {[]interface{}{nil}, ""}, + } + + // Common to all test cases. + context := []interface{}{"foo", "bar"} + expectedFields := []Field{String("foo", "bar")} + + for _, tt := range tests { + withSugar(t, DebugLevel, nil, func(logger *SugaredLogger, logs *observer.ObservedLogs) { + logger.With(context...).Debug(tt.args...) + logger.With(context...).Info(tt.args...) + logger.With(context...).Warn(tt.args...) + logger.With(context...).Error(tt.args...) + logger.With(context...).DPanic(tt.args...) + + expected := make([]observer.LoggedEntry, 5) + for i, lvl := range []zapcore.Level{DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel} { + expected[i] = observer.LoggedEntry{ + Entry: zapcore.Entry{Message: tt.expect, Level: lvl}, + Context: expectedFields, + } + } + assert.Equal(t, expected, logs.AllUntimed(), "Unexpected log output.") + }) + } +} + +func TestSugarTemplatedLogging(t *testing.T) { + tests := []struct { + format string + args []interface{} + expect string + }{ + {"", nil, ""}, + {"foo", nil, "foo"}, + // If the user fails to pass a template, degrade to fmt.Sprint. + {"", []interface{}{"foo"}, "foo"}, + } + + // Common to all test cases. + context := []interface{}{"foo", "bar"} + expectedFields := []Field{String("foo", "bar")} + + for _, tt := range tests { + withSugar(t, DebugLevel, nil, func(logger *SugaredLogger, logs *observer.ObservedLogs) { + logger.With(context...).Debugf(tt.format, tt.args...) + logger.With(context...).Infof(tt.format, tt.args...) + logger.With(context...).Warnf(tt.format, tt.args...) + logger.With(context...).Errorf(tt.format, tt.args...) + logger.With(context...).DPanicf(tt.format, tt.args...) + + expected := make([]observer.LoggedEntry, 5) + for i, lvl := range []zapcore.Level{DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel} { + expected[i] = observer.LoggedEntry{ + Entry: zapcore.Entry{Message: tt.expect, Level: lvl}, + Context: expectedFields, + } + } + assert.Equal(t, expected, logs.AllUntimed(), "Unexpected log output.") + }) + } +} + +func TestSugarPanicLogging(t *testing.T) { + tests := []struct { + loggerLevel zapcore.Level + f func(*SugaredLogger) + expectedMsg string + }{ + {FatalLevel, func(s *SugaredLogger) { s.Panic("foo") }, ""}, + {PanicLevel, func(s *SugaredLogger) { s.Panic("foo") }, "foo"}, + {DebugLevel, func(s *SugaredLogger) { s.Panic("foo") }, "foo"}, + {FatalLevel, func(s *SugaredLogger) { s.Panicf("%s", "foo") }, ""}, + {PanicLevel, func(s *SugaredLogger) { s.Panicf("%s", "foo") }, "foo"}, + {DebugLevel, func(s *SugaredLogger) { s.Panicf("%s", "foo") }, "foo"}, + {FatalLevel, func(s *SugaredLogger) { s.Panicw("foo") }, ""}, + {PanicLevel, func(s *SugaredLogger) { s.Panicw("foo") }, "foo"}, + {DebugLevel, func(s *SugaredLogger) { s.Panicw("foo") }, "foo"}, + } + + for _, tt := range tests { + withSugar(t, tt.loggerLevel, nil, func(sugar *SugaredLogger, logs *observer.ObservedLogs) { + assert.Panics(t, func() { tt.f(sugar) }, "Expected panic-level logger calls to panic.") + if tt.expectedMsg != "" { + assert.Equal(t, []observer.LoggedEntry{{ + Context: []Field{}, + Entry: zapcore.Entry{Message: tt.expectedMsg, Level: PanicLevel}, + }}, logs.AllUntimed(), "Unexpected log output.") + } else { + assert.Equal(t, 0, logs.Len(), "Didn't expect any log output.") + } + }) + } +} + +func TestSugarFatalLogging(t *testing.T) { + tests := []struct { + loggerLevel zapcore.Level + f func(*SugaredLogger) + expectedMsg string + }{ + {FatalLevel + 1, func(s *SugaredLogger) { s.Fatal("foo") }, ""}, + {FatalLevel, func(s *SugaredLogger) { s.Fatal("foo") }, "foo"}, + {DebugLevel, func(s *SugaredLogger) { s.Fatal("foo") }, "foo"}, + {FatalLevel + 1, func(s *SugaredLogger) { s.Fatalf("%s", "foo") }, ""}, + {FatalLevel, func(s *SugaredLogger) { s.Fatalf("%s", "foo") }, "foo"}, + {DebugLevel, func(s *SugaredLogger) { s.Fatalf("%s", "foo") }, "foo"}, + {FatalLevel + 1, func(s *SugaredLogger) { s.Fatalw("foo") }, ""}, + {FatalLevel, func(s *SugaredLogger) { s.Fatalw("foo") }, "foo"}, + {DebugLevel, func(s *SugaredLogger) { s.Fatalw("foo") }, "foo"}, + } + + for _, tt := range tests { + withSugar(t, tt.loggerLevel, nil, func(sugar *SugaredLogger, logs *observer.ObservedLogs) { + stub := exit.WithStub(func() { tt.f(sugar) }) + assert.True(t, stub.Exited, "Expected all calls to fatal logger methods to exit process.") + if tt.expectedMsg != "" { + assert.Equal(t, []observer.LoggedEntry{{ + Context: []Field{}, + Entry: zapcore.Entry{Message: tt.expectedMsg, Level: FatalLevel}, + }}, logs.AllUntimed(), "Unexpected log output.") + } else { + assert.Equal(t, 0, logs.Len(), "Didn't expect any log output.") + } + }) + } +} + +func TestSugarAddCaller(t *testing.T) { + tests := []struct { + options []Option + pat string + }{ + {opts(AddCaller()), `.+/sugar_test.go:[\d]+$`}, + {opts(AddCaller(), AddCallerSkip(1), AddCallerSkip(-1)), `.+/zap/sugar_test.go:[\d]+$`}, + {opts(AddCaller(), AddCallerSkip(1)), `.+/zap/common_test.go:[\d]+$`}, + {opts(AddCaller(), AddCallerSkip(1), AddCallerSkip(5)), `.+/src/runtime/.*:[\d]+$`}, + } + for _, tt := range tests { + withSugar(t, DebugLevel, tt.options, func(logger *SugaredLogger, logs *observer.ObservedLogs) { + logger.Info("") + output := logs.AllUntimed() + assert.Equal(t, 1, len(output), "Unexpected number of logs written out.") + assert.Regexp( + t, + tt.pat, + output[0].Entry.Caller, + "Expected to find package name and file name in output.", + ) + }) + } +} + +func TestSugarAddCallerFail(t *testing.T) { + errBuf := &ztest.Buffer{} + withSugar(t, DebugLevel, opts(AddCaller(), AddCallerSkip(1e3), ErrorOutput(errBuf)), func(log *SugaredLogger, logs *observer.ObservedLogs) { + log.Info("Failure.") + assert.Regexp( + t, + `Logger.check error: failed to get caller`, + errBuf.String(), + "Didn't find expected failure message.", + ) + assert.Equal( + t, + logs.AllUntimed()[0].Entry.Message, + "Failure.", + "Expected original message to survive failures in runtime.Caller.") + }) +} diff --git a/vendor/go.uber.org/zap/time.go b/vendor/go.uber.org/zap/time.go new file mode 100644 index 000000000..c5a1f1622 --- /dev/null +++ b/vendor/go.uber.org/zap/time.go @@ -0,0 +1,27 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import "time" + +func timeToMillis(t time.Time) int64 { + return t.UnixNano() / int64(time.Millisecond) +} diff --git a/vendor/go.uber.org/zap/time_test.go b/vendor/go.uber.org/zap/time_test.go new file mode 100644 index 000000000..cb993ab1f --- /dev/null +++ b/vendor/go.uber.org/zap/time_test.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func TestTimeToMillis(t *testing.T) { + tests := []struct { + t time.Time + stamp int64 + }{ + {t: time.Unix(0, 0), stamp: 0}, + {t: time.Unix(1, 0), stamp: 1000}, + {t: time.Unix(1, int64(500*time.Millisecond)), stamp: 1500}, + } + for _, tt := range tests { + assert.Equal(t, tt.stamp, timeToMillis(tt.t), "Unexpected timestamp for time %v.", tt.t) + } +} diff --git a/vendor/go.uber.org/zap/writer.go b/vendor/go.uber.org/zap/writer.go new file mode 100644 index 000000000..86a709ab0 --- /dev/null +++ b/vendor/go.uber.org/zap/writer.go @@ -0,0 +1,99 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "fmt" + "io" + "io/ioutil" + + "go.uber.org/zap/zapcore" + + "go.uber.org/multierr" +) + +// Open is a high-level wrapper that takes a variadic number of URLs, opens or +// creates each of the specified resources, and combines them into a locked +// WriteSyncer. It also returns any error encountered and a function to close +// any opened files. +// +// Passing no URLs returns a no-op WriteSyncer. Zap handles URLs without a +// scheme and URLs with the "file" scheme. Third-party code may register +// factories for other schemes using RegisterSink. +// +// URLs with the "file" scheme must use absolute paths on the local +// filesystem. No user, password, port, fragments, or query parameters are +// allowed, and the hostname must be empty or "localhost". +// +// Since it's common to write logs to the local filesystem, URLs without a +// scheme (e.g., "/var/log/foo.log") are treated as local file paths. Without +// a scheme, the special paths "stdout" and "stderr" are interpreted as +// os.Stdout and os.Stderr. When specified without a scheme, relative file +// paths also work. +func Open(paths ...string) (zapcore.WriteSyncer, func(), error) { + writers, close, err := open(paths) + if err != nil { + return nil, nil, err + } + + writer := CombineWriteSyncers(writers...) + return writer, close, nil +} + +func open(paths []string) ([]zapcore.WriteSyncer, func(), error) { + writers := make([]zapcore.WriteSyncer, 0, len(paths)) + closers := make([]io.Closer, 0, len(paths)) + close := func() { + for _, c := range closers { + c.Close() + } + } + + var openErr error + for _, path := range paths { + sink, err := newSink(path) + if err != nil { + openErr = multierr.Append(openErr, fmt.Errorf("couldn't open sink %q: %v", path, err)) + continue + } + writers = append(writers, sink) + closers = append(closers, sink) + } + if openErr != nil { + close() + return writers, nil, openErr + } + + return writers, close, nil +} + +// CombineWriteSyncers is a utility that combines multiple WriteSyncers into a +// single, locked WriteSyncer. If no inputs are supplied, it returns a no-op +// WriteSyncer. +// +// It's provided purely as a convenience; the result is no different from +// using zapcore.NewMultiWriteSyncer and zapcore.Lock individually. +func CombineWriteSyncers(writers ...zapcore.WriteSyncer) zapcore.WriteSyncer { + if len(writers) == 0 { + return zapcore.AddSync(ioutil.Discard) + } + return zapcore.Lock(zapcore.NewMultiWriteSyncer(writers...)) +} diff --git a/vendor/go.uber.org/zap/writer_test.go b/vendor/go.uber.org/zap/writer_test.go new file mode 100644 index 000000000..0dc8312b4 --- /dev/null +++ b/vendor/go.uber.org/zap/writer_test.go @@ -0,0 +1,185 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zap + +import ( + "encoding/hex" + "errors" + "io/ioutil" + "math/rand" + "net/url" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zapcore" +) + +func TestOpenNoPaths(t *testing.T) { + ws, cleanup, err := Open() + defer cleanup() + + assert.NoError(t, err, "Expected opening no paths to succeed.") + assert.Equal( + t, + zapcore.AddSync(ioutil.Discard), + ws, + "Expected opening no paths to return a no-op WriteSyncer.", + ) +} + +func TestOpen(t *testing.T) { + tempName := tempFileName("", "zap-open-test") + assert.False(t, fileExists(tempName)) + require.True(t, strings.HasPrefix(tempName, "/"), "Expected absolute temp file path.") + + tests := []struct { + paths []string + errs []string + }{ + {[]string{"stdout"}, nil}, + {[]string{"stderr"}, nil}, + {[]string{tempName}, nil}, + {[]string{"file://" + tempName}, nil}, + {[]string{"file://localhost" + tempName}, nil}, + {[]string{"/foo/bar/baz"}, []string{"open /foo/bar/baz: no such file or directory"}}, + {[]string{"file://localhost/foo/bar/baz"}, []string{"open /foo/bar/baz: no such file or directory"}}, + { + paths: []string{"stdout", "/foo/bar/baz", tempName, "file:///baz/quux"}, + errs: []string{ + "open /foo/bar/baz: no such file or directory", + "open /baz/quux: no such file or directory", + }, + }, + {[]string{"file:///stderr"}, []string{"open /stderr: permission denied"}}, + {[]string{"file:///stdout"}, []string{"open /stdout: permission denied"}}, + {[]string{"file://host01.test.com" + tempName}, []string{"empty or use localhost"}}, + {[]string{"file://rms@localhost" + tempName}, []string{"user and password not allowed"}}, + {[]string{"file://localhost" + tempName + "#foo"}, []string{"fragments not allowed"}}, + {[]string{"file://localhost" + tempName + "?foo=bar"}, []string{"query parameters not allowed"}}, + {[]string{"file://localhost:8080" + tempName}, []string{"ports not allowed"}}, + } + + for _, tt := range tests { + _, cleanup, err := Open(tt.paths...) + if err == nil { + defer cleanup() + } + + if len(tt.errs) == 0 { + assert.NoError(t, err, "Unexpected error opening paths %v.", tt.paths) + } else { + msg := err.Error() + for _, expect := range tt.errs { + assert.Contains(t, msg, expect, "Unexpected error opening paths %v.", tt.paths) + } + } + } + + assert.True(t, fileExists(tempName)) + os.Remove(tempName) +} + +func TestOpenRelativePath(t *testing.T) { + const name = "test-relative-path.txt" + + require.False(t, fileExists(name), "Test file already exists.") + s, cleanup, err := Open(name) + require.NoError(t, err, "Open failed.") + defer func() { + err := os.Remove(name) + if !t.Failed() { + // If the test has already failed, we probably didn't create this file. + require.NoError(t, err, "Deleting test file failed.") + } + }() + defer cleanup() + + _, err = s.Write([]byte("test")) + assert.NoError(t, err, "Write failed.") + assert.True(t, fileExists(name), "Didn't create file for relative path.") +} + +func TestOpenFails(t *testing.T) { + tests := []struct { + paths []string + }{ + {paths: []string{"./non-existent-dir/file"}}, // directory doesn't exist + {paths: []string{"stdout", "./non-existent-dir/file"}}, // directory doesn't exist + {paths: []string{"://foo.log"}}, // invalid URL, scheme can't begin with colon + {paths: []string{"mem://somewhere"}}, // scheme not registered + } + + for _, tt := range tests { + _, cleanup, err := Open(tt.paths...) + require.Nil(t, cleanup, "Cleanup function should never be nil") + assert.Error(t, err, "Open with invalid URL should fail.") + } +} + +type testWriter struct { + expected string + t testing.TB +} + +func (w *testWriter) Write(actual []byte) (int, error) { + assert.Equal(w.t, []byte(w.expected), actual, "Unexpected write error.") + return len(actual), nil +} + +func (w *testWriter) Sync() error { + return nil +} + +func TestOpenWithErroringSinkFactory(t *testing.T) { + defer resetSinkRegistry() + + msg := "expected factory error" + factory := func(_ *url.URL) (Sink, error) { + return nil, errors.New(msg) + } + + assert.NoError(t, RegisterSink("test", factory), "Failed to register sink factory.") + _, _, err := Open("test://some/path") + assert.Contains(t, err.Error(), msg, "Unexpected error.") +} + +func TestCombineWriteSyncers(t *testing.T) { + tw := &testWriter{"test", t} + w := CombineWriteSyncers(tw) + w.Write([]byte("test")) +} + +func tempFileName(prefix, suffix string) string { + randBytes := make([]byte, 16) + rand.Read(randBytes) + return filepath.Join(os.TempDir(), prefix+hex.EncodeToString(randBytes)+suffix) +} + +func fileExists(name string) bool { + if _, err := os.Stat(name); os.IsNotExist(err) { + return false + } + return true +} diff --git a/vendor/go.uber.org/zap/zapcore/console_encoder.go b/vendor/go.uber.org/zap/zapcore/console_encoder.go new file mode 100644 index 000000000..b7875966f --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/console_encoder.go @@ -0,0 +1,147 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "fmt" + "sync" + + "go.uber.org/zap/buffer" + "go.uber.org/zap/internal/bufferpool" +) + +var _sliceEncoderPool = sync.Pool{ + New: func() interface{} { + return &sliceArrayEncoder{elems: make([]interface{}, 0, 2)} + }, +} + +func getSliceEncoder() *sliceArrayEncoder { + return _sliceEncoderPool.Get().(*sliceArrayEncoder) +} + +func putSliceEncoder(e *sliceArrayEncoder) { + e.elems = e.elems[:0] + _sliceEncoderPool.Put(e) +} + +type consoleEncoder struct { + *jsonEncoder +} + +// NewConsoleEncoder creates an encoder whose output is designed for human - +// rather than machine - consumption. It serializes the core log entry data +// (message, level, timestamp, etc.) in a plain-text format and leaves the +// structured context as JSON. +// +// Note that although the console encoder doesn't use the keys specified in the +// encoder configuration, it will omit any element whose key is set to the empty +// string. +func NewConsoleEncoder(cfg EncoderConfig) Encoder { + return consoleEncoder{newJSONEncoder(cfg, true)} +} + +func (c consoleEncoder) Clone() Encoder { + return consoleEncoder{c.jsonEncoder.Clone().(*jsonEncoder)} +} + +func (c consoleEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer, error) { + line := bufferpool.Get() + + // We don't want the entry's metadata to be quoted and escaped (if it's + // encoded as strings), which means that we can't use the JSON encoder. The + // simplest option is to use the memory encoder and fmt.Fprint. + // + // If this ever becomes a performance bottleneck, we can implement + // ArrayEncoder for our plain-text format. + arr := getSliceEncoder() + if c.TimeKey != "" && c.EncodeTime != nil { + c.EncodeTime(ent.Time, arr) + } + if c.LevelKey != "" && c.EncodeLevel != nil { + c.EncodeLevel(ent.Level, arr) + } + if ent.LoggerName != "" && c.NameKey != "" { + nameEncoder := c.EncodeName + + if nameEncoder == nil { + // Fall back to FullNameEncoder for backward compatibility. + nameEncoder = FullNameEncoder + } + + nameEncoder(ent.LoggerName, arr) + } + if ent.Caller.Defined && c.CallerKey != "" && c.EncodeCaller != nil { + c.EncodeCaller(ent.Caller, arr) + } + for i := range arr.elems { + if i > 0 { + line.AppendByte('\t') + } + fmt.Fprint(line, arr.elems[i]) + } + putSliceEncoder(arr) + + // Add the message itself. + if c.MessageKey != "" { + c.addTabIfNecessary(line) + line.AppendString(ent.Message) + } + + // Add any structured context. + c.writeContext(line, fields) + + // If there's no stacktrace key, honor that; this allows users to force + // single-line output. + if ent.Stack != "" && c.StacktraceKey != "" { + line.AppendByte('\n') + line.AppendString(ent.Stack) + } + + if c.LineEnding != "" { + line.AppendString(c.LineEnding) + } else { + line.AppendString(DefaultLineEnding) + } + return line, nil +} + +func (c consoleEncoder) writeContext(line *buffer.Buffer, extra []Field) { + context := c.jsonEncoder.Clone().(*jsonEncoder) + defer context.buf.Free() + + addFields(context, extra) + context.closeOpenNamespaces() + if context.buf.Len() == 0 { + return + } + + c.addTabIfNecessary(line) + line.AppendByte('{') + line.Write(context.buf.Bytes()) + line.AppendByte('}') +} + +func (c consoleEncoder) addTabIfNecessary(line *buffer.Buffer) { + if line.Len() > 0 { + line.AppendByte('\t') + } +} diff --git a/vendor/go.uber.org/zap/zapcore/console_encoder_bench_test.go b/vendor/go.uber.org/zap/zapcore/console_encoder_bench_test.go new file mode 100644 index 000000000..62feaea71 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/console_encoder_bench_test.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "testing" + + . "go.uber.org/zap/zapcore" +) + +func BenchmarkZapConsole(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + enc := NewConsoleEncoder(humanEncoderConfig()) + enc.AddString("str", "foo") + enc.AddInt64("int64-1", 1) + enc.AddInt64("int64-2", 2) + enc.AddFloat64("float64", 1.0) + enc.AddString("string1", "\n") + enc.AddString("string2", "💩") + enc.AddString("string3", "🤔") + enc.AddString("string4", "🙊") + enc.AddBool("bool", true) + buf, _ := enc.EncodeEntry(Entry{ + Message: "fake", + Level: DebugLevel, + }, nil) + buf.Free() + } + }) +} diff --git a/vendor/go.uber.org/zap/zapcore/core.go b/vendor/go.uber.org/zap/zapcore/core.go new file mode 100644 index 000000000..a1ef8b034 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/core.go @@ -0,0 +1,113 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +// Core is a minimal, fast logger interface. It's designed for library authors +// to wrap in a more user-friendly API. +type Core interface { + LevelEnabler + + // With adds structured context to the Core. + With([]Field) Core + // Check determines whether the supplied Entry should be logged (using the + // embedded LevelEnabler and possibly some extra logic). If the entry + // should be logged, the Core adds itself to the CheckedEntry and returns + // the result. + // + // Callers must use Check before calling Write. + Check(Entry, *CheckedEntry) *CheckedEntry + // Write serializes the Entry and any Fields supplied at the log site and + // writes them to their destination. + // + // If called, Write should always log the Entry and Fields; it should not + // replicate the logic of Check. + Write(Entry, []Field) error + // Sync flushes buffered logs (if any). + Sync() error +} + +type nopCore struct{} + +// NewNopCore returns a no-op Core. +func NewNopCore() Core { return nopCore{} } +func (nopCore) Enabled(Level) bool { return false } +func (n nopCore) With([]Field) Core { return n } +func (nopCore) Check(_ Entry, ce *CheckedEntry) *CheckedEntry { return ce } +func (nopCore) Write(Entry, []Field) error { return nil } +func (nopCore) Sync() error { return nil } + +// NewCore creates a Core that writes logs to a WriteSyncer. +func NewCore(enc Encoder, ws WriteSyncer, enab LevelEnabler) Core { + return &ioCore{ + LevelEnabler: enab, + enc: enc, + out: ws, + } +} + +type ioCore struct { + LevelEnabler + enc Encoder + out WriteSyncer +} + +func (c *ioCore) With(fields []Field) Core { + clone := c.clone() + addFields(clone.enc, fields) + return clone +} + +func (c *ioCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { + if c.Enabled(ent.Level) { + return ce.AddCore(ent, c) + } + return ce +} + +func (c *ioCore) Write(ent Entry, fields []Field) error { + buf, err := c.enc.EncodeEntry(ent, fields) + if err != nil { + return err + } + _, err = c.out.Write(buf.Bytes()) + buf.Free() + if err != nil { + return err + } + if ent.Level > ErrorLevel { + // Since we may be crashing the program, sync the output. Ignore Sync + // errors, pending a clean solution to issue #370. + c.Sync() + } + return nil +} + +func (c *ioCore) Sync() error { + return c.out.Sync() +} + +func (c *ioCore) clone() *ioCore { + return &ioCore{ + LevelEnabler: c.LevelEnabler, + enc: c.enc.Clone(), + out: c.out, + } +} diff --git a/vendor/go.uber.org/zap/zapcore/core_test.go b/vendor/go.uber.org/zap/zapcore/core_test.go new file mode 100644 index 000000000..cb4065c48 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/core_test.go @@ -0,0 +1,163 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "errors" + "io/ioutil" + "os" + "testing" + "time" + + "go.uber.org/zap/internal/ztest" + . "go.uber.org/zap/zapcore" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func makeInt64Field(key string, val int) Field { + return Field{Type: Int64Type, Integer: int64(val), Key: key} +} + +func TestNopCore(t *testing.T) { + entry := Entry{ + Message: "test", + Level: InfoLevel, + Time: time.Now(), + LoggerName: "main", + Stack: "fake-stack", + } + ce := &CheckedEntry{} + + allLevels := []Level{ + DebugLevel, + InfoLevel, + WarnLevel, + ErrorLevel, + DPanicLevel, + PanicLevel, + FatalLevel, + } + core := NewNopCore() + assert.Equal(t, core, core.With([]Field{makeInt64Field("k", 42)}), "Expected no-op With.") + for _, level := range allLevels { + assert.False(t, core.Enabled(level), "Expected all levels to be disabled in no-op core.") + assert.Equal(t, ce, core.Check(entry, ce), "Expected no-op Check to return checked entry unchanged.") + assert.NoError(t, core.Write(entry, nil), "Expected no-op Writes to always succeed.") + assert.NoError(t, core.Sync(), "Expected no-op Syncs to always succeed.") + } +} + +func TestIOCore(t *testing.T) { + temp, err := ioutil.TempFile("", "zapcore-test-iocore") + require.NoError(t, err, "Failed to create temp file.") + defer os.Remove(temp.Name()) + + // Drop timestamps for simpler assertions (timestamp encoding is tested + // elsewhere). + cfg := testEncoderConfig() + cfg.TimeKey = "" + + core := NewCore( + NewJSONEncoder(cfg), + temp, + InfoLevel, + ).With([]Field{makeInt64Field("k", 1)}) + defer assert.NoError(t, core.Sync(), "Expected Syncing a temp file to succeed.") + + if ce := core.Check(Entry{Level: DebugLevel, Message: "debug"}, nil); ce != nil { + ce.Write(makeInt64Field("k", 2)) + } + if ce := core.Check(Entry{Level: InfoLevel, Message: "info"}, nil); ce != nil { + ce.Write(makeInt64Field("k", 3)) + } + if ce := core.Check(Entry{Level: WarnLevel, Message: "warn"}, nil); ce != nil { + ce.Write(makeInt64Field("k", 4)) + } + + logged, err := ioutil.ReadFile(temp.Name()) + require.NoError(t, err, "Failed to read from temp file.") + require.Equal( + t, + `{"level":"info","msg":"info","k":1,"k":3}`+"\n"+ + `{"level":"warn","msg":"warn","k":1,"k":4}`+"\n", + string(logged), + "Unexpected log output.", + ) +} + +func TestIOCoreSyncFail(t *testing.T) { + sink := &ztest.Discarder{} + err := errors.New("failed") + sink.SetError(err) + + core := NewCore( + NewJSONEncoder(testEncoderConfig()), + sink, + DebugLevel, + ) + + assert.Equal( + t, + err, + core.Sync(), + "Expected core.Sync to return errors from underlying WriteSyncer.", + ) +} + +func TestIOCoreSyncsOutput(t *testing.T) { + tests := []struct { + entry Entry + shouldSync bool + }{ + {Entry{Level: DebugLevel}, false}, + {Entry{Level: InfoLevel}, false}, + {Entry{Level: WarnLevel}, false}, + {Entry{Level: ErrorLevel}, false}, + {Entry{Level: DPanicLevel}, true}, + {Entry{Level: PanicLevel}, true}, + {Entry{Level: FatalLevel}, true}, + } + + for _, tt := range tests { + sink := &ztest.Discarder{} + core := NewCore( + NewJSONEncoder(testEncoderConfig()), + sink, + DebugLevel, + ) + + core.Write(tt.entry, nil) + assert.Equal(t, tt.shouldSync, sink.Called(), "Incorrect Sync behavior.") + } +} + +func TestIOCoreWriteFailure(t *testing.T) { + core := NewCore( + NewJSONEncoder(testEncoderConfig()), + Lock(&ztest.FailWriter{}), + DebugLevel, + ) + err := core.Write(Entry{}, nil) + // Should log the error. + assert.Error(t, err, "Expected writing Entry to fail.") +} diff --git a/vendor/go.uber.org/zap/zapcore/doc.go b/vendor/go.uber.org/zap/zapcore/doc.go new file mode 100644 index 000000000..31000e91f --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/doc.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package zapcore defines and implements the low-level interfaces upon which +// zap is built. By providing alternate implementations of these interfaces, +// external packages can extend zap's capabilities. +package zapcore // import "go.uber.org/zap/zapcore" diff --git a/vendor/go.uber.org/zap/zapcore/encoder.go b/vendor/go.uber.org/zap/zapcore/encoder.go new file mode 100644 index 000000000..f0509522b --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/encoder.go @@ -0,0 +1,348 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "time" + + "go.uber.org/zap/buffer" +) + +// DefaultLineEnding defines the default line ending when writing logs. +// Alternate line endings specified in EncoderConfig can override this +// behavior. +const DefaultLineEnding = "\n" + +// A LevelEncoder serializes a Level to a primitive type. +type LevelEncoder func(Level, PrimitiveArrayEncoder) + +// LowercaseLevelEncoder serializes a Level to a lowercase string. For example, +// InfoLevel is serialized to "info". +func LowercaseLevelEncoder(l Level, enc PrimitiveArrayEncoder) { + enc.AppendString(l.String()) +} + +// LowercaseColorLevelEncoder serializes a Level to a lowercase string and adds coloring. +// For example, InfoLevel is serialized to "info" and colored blue. +func LowercaseColorLevelEncoder(l Level, enc PrimitiveArrayEncoder) { + s, ok := _levelToLowercaseColorString[l] + if !ok { + s = _unknownLevelColor.Add(l.String()) + } + enc.AppendString(s) +} + +// CapitalLevelEncoder serializes a Level to an all-caps string. For example, +// InfoLevel is serialized to "INFO". +func CapitalLevelEncoder(l Level, enc PrimitiveArrayEncoder) { + enc.AppendString(l.CapitalString()) +} + +// CapitalColorLevelEncoder serializes a Level to an all-caps string and adds color. +// For example, InfoLevel is serialized to "INFO" and colored blue. +func CapitalColorLevelEncoder(l Level, enc PrimitiveArrayEncoder) { + s, ok := _levelToCapitalColorString[l] + if !ok { + s = _unknownLevelColor.Add(l.CapitalString()) + } + enc.AppendString(s) +} + +// UnmarshalText unmarshals text to a LevelEncoder. "capital" is unmarshaled to +// CapitalLevelEncoder, "coloredCapital" is unmarshaled to CapitalColorLevelEncoder, +// "colored" is unmarshaled to LowercaseColorLevelEncoder, and anything else +// is unmarshaled to LowercaseLevelEncoder. +func (e *LevelEncoder) UnmarshalText(text []byte) error { + switch string(text) { + case "capital": + *e = CapitalLevelEncoder + case "capitalColor": + *e = CapitalColorLevelEncoder + case "color": + *e = LowercaseColorLevelEncoder + default: + *e = LowercaseLevelEncoder + } + return nil +} + +// A TimeEncoder serializes a time.Time to a primitive type. +type TimeEncoder func(time.Time, PrimitiveArrayEncoder) + +// EpochTimeEncoder serializes a time.Time to a floating-point number of seconds +// since the Unix epoch. +func EpochTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) { + nanos := t.UnixNano() + sec := float64(nanos) / float64(time.Second) + enc.AppendFloat64(sec) +} + +// EpochMillisTimeEncoder serializes a time.Time to a floating-point number of +// milliseconds since the Unix epoch. +func EpochMillisTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) { + nanos := t.UnixNano() + millis := float64(nanos) / float64(time.Millisecond) + enc.AppendFloat64(millis) +} + +// EpochNanosTimeEncoder serializes a time.Time to an integer number of +// nanoseconds since the Unix epoch. +func EpochNanosTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) { + enc.AppendInt64(t.UnixNano()) +} + +// ISO8601TimeEncoder serializes a time.Time to an ISO8601-formatted string +// with millisecond precision. +func ISO8601TimeEncoder(t time.Time, enc PrimitiveArrayEncoder) { + enc.AppendString(t.Format("2006-01-02T15:04:05.000Z0700")) +} + +// UnmarshalText unmarshals text to a TimeEncoder. "iso8601" and "ISO8601" are +// unmarshaled to ISO8601TimeEncoder, "millis" is unmarshaled to +// EpochMillisTimeEncoder, and anything else is unmarshaled to EpochTimeEncoder. +func (e *TimeEncoder) UnmarshalText(text []byte) error { + switch string(text) { + case "iso8601", "ISO8601": + *e = ISO8601TimeEncoder + case "millis": + *e = EpochMillisTimeEncoder + case "nanos": + *e = EpochNanosTimeEncoder + default: + *e = EpochTimeEncoder + } + return nil +} + +// A DurationEncoder serializes a time.Duration to a primitive type. +type DurationEncoder func(time.Duration, PrimitiveArrayEncoder) + +// SecondsDurationEncoder serializes a time.Duration to a floating-point number of seconds elapsed. +func SecondsDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) { + enc.AppendFloat64(float64(d) / float64(time.Second)) +} + +// NanosDurationEncoder serializes a time.Duration to an integer number of +// nanoseconds elapsed. +func NanosDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) { + enc.AppendInt64(int64(d)) +} + +// StringDurationEncoder serializes a time.Duration using its built-in String +// method. +func StringDurationEncoder(d time.Duration, enc PrimitiveArrayEncoder) { + enc.AppendString(d.String()) +} + +// UnmarshalText unmarshals text to a DurationEncoder. "string" is unmarshaled +// to StringDurationEncoder, and anything else is unmarshaled to +// NanosDurationEncoder. +func (e *DurationEncoder) UnmarshalText(text []byte) error { + switch string(text) { + case "string": + *e = StringDurationEncoder + case "nanos": + *e = NanosDurationEncoder + default: + *e = SecondsDurationEncoder + } + return nil +} + +// A CallerEncoder serializes an EntryCaller to a primitive type. +type CallerEncoder func(EntryCaller, PrimitiveArrayEncoder) + +// FullCallerEncoder serializes a caller in /full/path/to/package/file:line +// format. +func FullCallerEncoder(caller EntryCaller, enc PrimitiveArrayEncoder) { + // TODO: consider using a byte-oriented API to save an allocation. + enc.AppendString(caller.String()) +} + +// ShortCallerEncoder serializes a caller in package/file:line format, trimming +// all but the final directory from the full path. +func ShortCallerEncoder(caller EntryCaller, enc PrimitiveArrayEncoder) { + // TODO: consider using a byte-oriented API to save an allocation. + enc.AppendString(caller.TrimmedPath()) +} + +// UnmarshalText unmarshals text to a CallerEncoder. "full" is unmarshaled to +// FullCallerEncoder and anything else is unmarshaled to ShortCallerEncoder. +func (e *CallerEncoder) UnmarshalText(text []byte) error { + switch string(text) { + case "full": + *e = FullCallerEncoder + default: + *e = ShortCallerEncoder + } + return nil +} + +// A NameEncoder serializes a period-separated logger name to a primitive +// type. +type NameEncoder func(string, PrimitiveArrayEncoder) + +// FullNameEncoder serializes the logger name as-is. +func FullNameEncoder(loggerName string, enc PrimitiveArrayEncoder) { + enc.AppendString(loggerName) +} + +// UnmarshalText unmarshals text to a NameEncoder. Currently, everything is +// unmarshaled to FullNameEncoder. +func (e *NameEncoder) UnmarshalText(text []byte) error { + switch string(text) { + case "full": + *e = FullNameEncoder + default: + *e = FullNameEncoder + } + return nil +} + +// An EncoderConfig allows users to configure the concrete encoders supplied by +// zapcore. +type EncoderConfig struct { + // Set the keys used for each log entry. If any key is empty, that portion + // of the entry is omitted. + MessageKey string `json:"messageKey" yaml:"messageKey"` + LevelKey string `json:"levelKey" yaml:"levelKey"` + TimeKey string `json:"timeKey" yaml:"timeKey"` + NameKey string `json:"nameKey" yaml:"nameKey"` + CallerKey string `json:"callerKey" yaml:"callerKey"` + StacktraceKey string `json:"stacktraceKey" yaml:"stacktraceKey"` + LineEnding string `json:"lineEnding" yaml:"lineEnding"` + // Configure the primitive representations of common complex types. For + // example, some users may want all time.Times serialized as floating-point + // seconds since epoch, while others may prefer ISO8601 strings. + EncodeLevel LevelEncoder `json:"levelEncoder" yaml:"levelEncoder"` + EncodeTime TimeEncoder `json:"timeEncoder" yaml:"timeEncoder"` + EncodeDuration DurationEncoder `json:"durationEncoder" yaml:"durationEncoder"` + EncodeCaller CallerEncoder `json:"callerEncoder" yaml:"callerEncoder"` + // Unlike the other primitive type encoders, EncodeName is optional. The + // zero value falls back to FullNameEncoder. + EncodeName NameEncoder `json:"nameEncoder" yaml:"nameEncoder"` +} + +// ObjectEncoder is a strongly-typed, encoding-agnostic interface for adding a +// map- or struct-like object to the logging context. Like maps, ObjectEncoders +// aren't safe for concurrent use (though typical use shouldn't require locks). +type ObjectEncoder interface { + // Logging-specific marshalers. + AddArray(key string, marshaler ArrayMarshaler) error + AddObject(key string, marshaler ObjectMarshaler) error + + // Built-in types. + AddBinary(key string, value []byte) // for arbitrary bytes + AddByteString(key string, value []byte) // for UTF-8 encoded bytes + AddBool(key string, value bool) + AddComplex128(key string, value complex128) + AddComplex64(key string, value complex64) + AddDuration(key string, value time.Duration) + AddFloat64(key string, value float64) + AddFloat32(key string, value float32) + AddInt(key string, value int) + AddInt64(key string, value int64) + AddInt32(key string, value int32) + AddInt16(key string, value int16) + AddInt8(key string, value int8) + AddString(key, value string) + AddTime(key string, value time.Time) + AddUint(key string, value uint) + AddUint64(key string, value uint64) + AddUint32(key string, value uint32) + AddUint16(key string, value uint16) + AddUint8(key string, value uint8) + AddUintptr(key string, value uintptr) + + // AddReflected uses reflection to serialize arbitrary objects, so it's slow + // and allocation-heavy. + AddReflected(key string, value interface{}) error + // OpenNamespace opens an isolated namespace where all subsequent fields will + // be added. Applications can use namespaces to prevent key collisions when + // injecting loggers into sub-components or third-party libraries. + OpenNamespace(key string) +} + +// ArrayEncoder is a strongly-typed, encoding-agnostic interface for adding +// array-like objects to the logging context. Of note, it supports mixed-type +// arrays even though they aren't typical in Go. Like slices, ArrayEncoders +// aren't safe for concurrent use (though typical use shouldn't require locks). +type ArrayEncoder interface { + // Built-in types. + PrimitiveArrayEncoder + + // Time-related types. + AppendDuration(time.Duration) + AppendTime(time.Time) + + // Logging-specific marshalers. + AppendArray(ArrayMarshaler) error + AppendObject(ObjectMarshaler) error + + // AppendReflected uses reflection to serialize arbitrary objects, so it's + // slow and allocation-heavy. + AppendReflected(value interface{}) error +} + +// PrimitiveArrayEncoder is the subset of the ArrayEncoder interface that deals +// only in Go's built-in types. It's included only so that Duration- and +// TimeEncoders cannot trigger infinite recursion. +type PrimitiveArrayEncoder interface { + // Built-in types. + AppendBool(bool) + AppendByteString([]byte) // for UTF-8 encoded bytes + AppendComplex128(complex128) + AppendComplex64(complex64) + AppendFloat64(float64) + AppendFloat32(float32) + AppendInt(int) + AppendInt64(int64) + AppendInt32(int32) + AppendInt16(int16) + AppendInt8(int8) + AppendString(string) + AppendUint(uint) + AppendUint64(uint64) + AppendUint32(uint32) + AppendUint16(uint16) + AppendUint8(uint8) + AppendUintptr(uintptr) +} + +// Encoder is a format-agnostic interface for all log entry marshalers. Since +// log encoders don't need to support the same wide range of use cases as +// general-purpose marshalers, it's possible to make them faster and +// lower-allocation. +// +// Implementations of the ObjectEncoder interface's methods can, of course, +// freely modify the receiver. However, the Clone and EncodeEntry methods will +// be called concurrently and shouldn't modify the receiver. +type Encoder interface { + ObjectEncoder + + // Clone copies the encoder, ensuring that adding fields to the copy doesn't + // affect the original. + Clone() Encoder + + // EncodeEntry encodes an entry and fields, along with any accumulated + // context, into a byte buffer and returns it. + EncodeEntry(Entry, []Field) (*buffer.Buffer, error) +} diff --git a/vendor/go.uber.org/zap/zapcore/encoder_test.go b/vendor/go.uber.org/zap/zapcore/encoder_test.go new file mode 100644 index 000000000..04641678c --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/encoder_test.go @@ -0,0 +1,636 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "strings" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + . "go.uber.org/zap/zapcore" +) + +var ( + _epoch = time.Date(1970, time.January, 1, 0, 0, 0, 0, time.UTC) + _testEntry = Entry{ + LoggerName: "main", + Level: InfoLevel, + Message: `hello`, + Time: _epoch, + Stack: "fake-stack", + Caller: EntryCaller{Defined: true, File: "foo.go", Line: 42}, + } +) + +func testEncoderConfig() EncoderConfig { + return EncoderConfig{ + MessageKey: "msg", + LevelKey: "level", + NameKey: "name", + TimeKey: "ts", + CallerKey: "caller", + StacktraceKey: "stacktrace", + LineEnding: "\n", + EncodeTime: EpochTimeEncoder, + EncodeLevel: LowercaseLevelEncoder, + EncodeDuration: SecondsDurationEncoder, + EncodeCaller: ShortCallerEncoder, + } +} + +func humanEncoderConfig() EncoderConfig { + cfg := testEncoderConfig() + cfg.EncodeTime = ISO8601TimeEncoder + cfg.EncodeLevel = CapitalLevelEncoder + cfg.EncodeDuration = StringDurationEncoder + return cfg +} + +func withJSONEncoder(f func(Encoder)) { + f(NewJSONEncoder(testEncoderConfig())) +} + +func withConsoleEncoder(f func(Encoder)) { + f(NewConsoleEncoder(humanEncoderConfig())) +} + +func capitalNameEncoder(loggerName string, enc PrimitiveArrayEncoder) { + enc.AppendString(strings.ToUpper(loggerName)) +} + +func TestEncoderConfiguration(t *testing.T) { + base := testEncoderConfig() + + tests := []struct { + desc string + cfg EncoderConfig + amendEntry func(Entry) Entry + extra func(Encoder) + expectedJSON string + expectedConsole string + }{ + { + desc: "messages to be escaped", + cfg: base, + amendEntry: func(ent Entry) Entry { + ent.Message = `hello\` + return ent + }, + expectedJSON: `{"level":"info","ts":0,"name":"main","caller":"foo.go:42","msg":"hello\\","stacktrace":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tmain\tfoo.go:42\thello\\\nfake-stack\n", + }, + { + desc: "use custom entry keys in JSON output and ignore them in console output", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tmain\tfoo.go:42\thello\nfake-stack\n", + }, + { + desc: "skip level if LevelKey is omitted", + cfg: EncoderConfig{ + LevelKey: "", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"T":0,"N":"main","C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "0\tmain\tfoo.go:42\thello\nfake-stack\n", + }, + { + desc: "skip timestamp if TimeKey is omitted", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"info","N":"main","C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "info\tmain\tfoo.go:42\thello\nfake-stack\n", + }, + { + desc: "skip message if MessageKey is omitted", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tmain\tfoo.go:42\nfake-stack\n", + }, + { + desc: "skip name if NameKey is omitted", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"info","T":0,"C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tfoo.go:42\thello\nfake-stack\n", + }, + { + desc: "skip caller if CallerKey is omitted", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"info","T":0,"N":"main","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tmain\thello\nfake-stack\n", + }, + { + desc: "skip stacktrace if StacktraceKey is omitted", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello"}` + "\n", + expectedConsole: "0\tinfo\tmain\tfoo.go:42\thello\n", + }, + { + desc: "use the supplied EncodeTime, for both the entry and any times added", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: func(t time.Time, enc PrimitiveArrayEncoder) { enc.AppendString(t.String()) }, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + extra: func(enc Encoder) { + enc.AddTime("extra", _epoch) + enc.AddArray("extras", ArrayMarshalerFunc(func(enc ArrayEncoder) error { + enc.AppendTime(_epoch) + return nil + })) + }, + expectedJSON: `{"L":"info","T":"1970-01-01 00:00:00 +0000 UTC","N":"main","C":"foo.go:42","M":"hello","extra":"1970-01-01 00:00:00 +0000 UTC","extras":["1970-01-01 00:00:00 +0000 UTC"],"S":"fake-stack"}` + "\n", + expectedConsole: "1970-01-01 00:00:00 +0000 UTC\tinfo\tmain\tfoo.go:42\thello\t" + // plain-text preamble + `{"extra": "1970-01-01 00:00:00 +0000 UTC", "extras": ["1970-01-01 00:00:00 +0000 UTC"]}` + // JSON context + "\nfake-stack\n", // stacktrace after newline + }, + { + desc: "use the supplied EncodeDuration for any durations added", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: StringDurationEncoder, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + extra: func(enc Encoder) { + enc.AddDuration("extra", time.Second) + enc.AddArray("extras", ArrayMarshalerFunc(func(enc ArrayEncoder) error { + enc.AppendDuration(time.Minute) + return nil + })) + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","extra":"1s","extras":["1m0s"],"S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tmain\tfoo.go:42\thello\t" + // preamble + `{"extra": "1s", "extras": ["1m0s"]}` + // context + "\nfake-stack\n", // stacktrace + }, + { + desc: "use the supplied EncodeLevel", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: CapitalLevelEncoder, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"INFO","T":0,"N":"main","C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "0\tINFO\tmain\tfoo.go:42\thello\nfake-stack\n", + }, + { + desc: "use the supplied EncodeName", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + EncodeName: capitalNameEncoder, + }, + expectedJSON: `{"L":"info","T":0,"N":"MAIN","C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tMAIN\tfoo.go:42\thello\nfake-stack\n", + }, + { + desc: "close all open namespaces", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + extra: func(enc Encoder) { + enc.OpenNamespace("outer") + enc.OpenNamespace("inner") + enc.AddString("foo", "bar") + enc.OpenNamespace("innermost") + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","outer":{"inner":{"foo":"bar","innermost":{}}},"S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tmain\tfoo.go:42\thello\t" + + `{"outer": {"inner": {"foo": "bar", "innermost": {}}}}` + + "\nfake-stack\n", + }, + { + desc: "handle no-op EncodeTime", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: func(time.Time, PrimitiveArrayEncoder) {}, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + extra: func(enc Encoder) { enc.AddTime("sometime", time.Unix(0, 100)) }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","sometime":100,"S":"fake-stack"}` + "\n", + expectedConsole: "info\tmain\tfoo.go:42\thello\t" + `{"sometime": 100}` + "\nfake-stack\n", + }, + { + desc: "handle no-op EncodeDuration", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: func(time.Duration, PrimitiveArrayEncoder) {}, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + extra: func(enc Encoder) { enc.AddDuration("someduration", time.Microsecond) }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","someduration":1000,"S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tmain\tfoo.go:42\thello\t" + `{"someduration": 1000}` + "\nfake-stack\n", + }, + { + desc: "handle no-op EncodeLevel", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: func(Level, PrimitiveArrayEncoder) {}, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "0\tmain\tfoo.go:42\thello\nfake-stack\n", + }, + { + desc: "handle no-op EncodeCaller", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: func(EntryCaller, PrimitiveArrayEncoder) {}, + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tmain\thello\nfake-stack\n", + }, + { + desc: "handle no-op EncodeName", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: base.LineEnding, + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + EncodeName: func(string, PrimitiveArrayEncoder) {}, + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\n", + expectedConsole: "0\tinfo\tfoo.go:42\thello\nfake-stack\n", + }, + { + desc: "use custom line separator", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + LineEnding: "\r\n", + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","S":"fake-stack"}` + "\r\n", + expectedConsole: "0\tinfo\tmain\tfoo.go:42\thello\nfake-stack\r\n", + }, + { + desc: "omit line separator definition - fall back to default", + cfg: EncoderConfig{ + LevelKey: "L", + TimeKey: "T", + MessageKey: "M", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + EncodeTime: base.EncodeTime, + EncodeDuration: base.EncodeDuration, + EncodeLevel: base.EncodeLevel, + EncodeCaller: base.EncodeCaller, + }, + expectedJSON: `{"L":"info","T":0,"N":"main","C":"foo.go:42","M":"hello","S":"fake-stack"}` + DefaultLineEnding, + expectedConsole: "0\tinfo\tmain\tfoo.go:42\thello\nfake-stack" + DefaultLineEnding, + }, + } + + for i, tt := range tests { + json := NewJSONEncoder(tt.cfg) + console := NewConsoleEncoder(tt.cfg) + if tt.extra != nil { + tt.extra(json) + tt.extra(console) + } + entry := _testEntry + if tt.amendEntry != nil { + entry = tt.amendEntry(_testEntry) + } + jsonOut, jsonErr := json.EncodeEntry(entry, nil) + if assert.NoError(t, jsonErr, "Unexpected error JSON-encoding entry in case #%d.", i) { + assert.Equal( + t, + tt.expectedJSON, + jsonOut.String(), + "Unexpected JSON output: expected to %v.", tt.desc, + ) + } + consoleOut, consoleErr := console.EncodeEntry(entry, nil) + if assert.NoError(t, consoleErr, "Unexpected error console-encoding entry in case #%d.", i) { + assert.Equal( + t, + tt.expectedConsole, + consoleOut.String(), + "Unexpected console output: expected to %v.", tt.desc, + ) + } + } +} + +func TestLevelEncoders(t *testing.T) { + tests := []struct { + name string + expected interface{} // output of encoding InfoLevel + }{ + {"capital", "INFO"}, + {"lower", "info"}, + {"", "info"}, + {"something-random", "info"}, + } + + for _, tt := range tests { + var le LevelEncoder + require.NoError(t, le.UnmarshalText([]byte(tt.name)), "Unexpected error unmarshaling %q.", tt.name) + assertAppended( + t, + tt.expected, + func(arr ArrayEncoder) { le(InfoLevel, arr) }, + "Unexpected output serializing InfoLevel with %q.", tt.name, + ) + } +} + +func TestTimeEncoders(t *testing.T) { + moment := time.Unix(100, 50005000).UTC() + tests := []struct { + name string + expected interface{} // output of serializing moment + }{ + {"iso8601", "1970-01-01T00:01:40.050Z"}, + {"ISO8601", "1970-01-01T00:01:40.050Z"}, + {"millis", 100050.005}, + {"nanos", int64(100050005000)}, + {"", 100.050005}, + {"something-random", 100.050005}, + } + + for _, tt := range tests { + var te TimeEncoder + require.NoError(t, te.UnmarshalText([]byte(tt.name)), "Unexpected error unmarshaling %q.", tt.name) + assertAppended( + t, + tt.expected, + func(arr ArrayEncoder) { te(moment, arr) }, + "Unexpected output serializing %v with %q.", moment, tt.name, + ) + } +} + +func TestDurationEncoders(t *testing.T) { + elapsed := time.Second + 500*time.Nanosecond + tests := []struct { + name string + expected interface{} // output of serializing elapsed + }{ + {"string", "1.0000005s"}, + {"nanos", int64(1000000500)}, + {"", 1.0000005}, + {"something-random", 1.0000005}, + } + + for _, tt := range tests { + var de DurationEncoder + require.NoError(t, de.UnmarshalText([]byte(tt.name)), "Unexpected error unmarshaling %q.", tt.name) + assertAppended( + t, + tt.expected, + func(arr ArrayEncoder) { de(elapsed, arr) }, + "Unexpected output serializing %v with %q.", elapsed, tt.name, + ) + } +} + +func TestCallerEncoders(t *testing.T) { + caller := EntryCaller{Defined: true, File: "/home/jack/src/github.com/foo/foo.go", Line: 42} + tests := []struct { + name string + expected interface{} // output of serializing caller + }{ + {"", "foo/foo.go:42"}, + {"something-random", "foo/foo.go:42"}, + {"short", "foo/foo.go:42"}, + {"full", "/home/jack/src/github.com/foo/foo.go:42"}, + } + + for _, tt := range tests { + var ce CallerEncoder + require.NoError(t, ce.UnmarshalText([]byte(tt.name)), "Unexpected error unmarshaling %q.", tt.name) + assertAppended( + t, + tt.expected, + func(arr ArrayEncoder) { ce(caller, arr) }, + "Unexpected output serializing file name as %v with %q.", tt.expected, tt.name, + ) + } +} + +func TestNameEncoders(t *testing.T) { + tests := []struct { + name string + expected interface{} // output of encoding InfoLevel + }{ + {"", "main"}, + {"full", "main"}, + {"something-random", "main"}, + } + + for _, tt := range tests { + var ne NameEncoder + require.NoError(t, ne.UnmarshalText([]byte(tt.name)), "Unexpected error unmarshaling %q.", tt.name) + assertAppended( + t, + tt.expected, + func(arr ArrayEncoder) { ne("main", arr) }, + "Unexpected output serializing logger name with %q.", tt.name, + ) + } +} + +func assertAppended(t testing.TB, expected interface{}, f func(ArrayEncoder), msgAndArgs ...interface{}) { + mem := NewMapObjectEncoder() + mem.AddArray("k", ArrayMarshalerFunc(func(arr ArrayEncoder) error { + f(arr) + return nil + })) + arr := mem.Fields["k"].([]interface{}) + require.Equal(t, 1, len(arr), "Expected to append exactly one element to array.") + assert.Equal(t, expected, arr[0], msgAndArgs...) +} diff --git a/vendor/go.uber.org/zap/zapcore/entry.go b/vendor/go.uber.org/zap/zapcore/entry.go new file mode 100644 index 000000000..7d9893f33 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/entry.go @@ -0,0 +1,257 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "fmt" + "strings" + "sync" + "time" + + "go.uber.org/zap/internal/bufferpool" + "go.uber.org/zap/internal/exit" + + "go.uber.org/multierr" +) + +var ( + _cePool = sync.Pool{New: func() interface{} { + // Pre-allocate some space for cores. + return &CheckedEntry{ + cores: make([]Core, 4), + } + }} +) + +func getCheckedEntry() *CheckedEntry { + ce := _cePool.Get().(*CheckedEntry) + ce.reset() + return ce +} + +func putCheckedEntry(ce *CheckedEntry) { + if ce == nil { + return + } + _cePool.Put(ce) +} + +// NewEntryCaller makes an EntryCaller from the return signature of +// runtime.Caller. +func NewEntryCaller(pc uintptr, file string, line int, ok bool) EntryCaller { + if !ok { + return EntryCaller{} + } + return EntryCaller{ + PC: pc, + File: file, + Line: line, + Defined: true, + } +} + +// EntryCaller represents the caller of a logging function. +type EntryCaller struct { + Defined bool + PC uintptr + File string + Line int +} + +// String returns the full path and line number of the caller. +func (ec EntryCaller) String() string { + return ec.FullPath() +} + +// FullPath returns a /full/path/to/package/file:line description of the +// caller. +func (ec EntryCaller) FullPath() string { + if !ec.Defined { + return "undefined" + } + buf := bufferpool.Get() + buf.AppendString(ec.File) + buf.AppendByte(':') + buf.AppendInt(int64(ec.Line)) + caller := buf.String() + buf.Free() + return caller +} + +// TrimmedPath returns a package/file:line description of the caller, +// preserving only the leaf directory name and file name. +func (ec EntryCaller) TrimmedPath() string { + if !ec.Defined { + return "undefined" + } + // nb. To make sure we trim the path correctly on Windows too, we + // counter-intuitively need to use '/' and *not* os.PathSeparator here, + // because the path given originates from Go stdlib, specifically + // runtime.Caller() which (as of Mar/17) returns forward slashes even on + // Windows. + // + // See https://github.com/golang/go/issues/3335 + // and https://github.com/golang/go/issues/18151 + // + // for discussion on the issue on Go side. + // + // Find the last separator. + // + idx := strings.LastIndexByte(ec.File, '/') + if idx == -1 { + return ec.FullPath() + } + // Find the penultimate separator. + idx = strings.LastIndexByte(ec.File[:idx], '/') + if idx == -1 { + return ec.FullPath() + } + buf := bufferpool.Get() + // Keep everything after the penultimate separator. + buf.AppendString(ec.File[idx+1:]) + buf.AppendByte(':') + buf.AppendInt(int64(ec.Line)) + caller := buf.String() + buf.Free() + return caller +} + +// An Entry represents a complete log message. The entry's structured context +// is already serialized, but the log level, time, message, and call site +// information are available for inspection and modification. +// +// Entries are pooled, so any functions that accept them MUST be careful not to +// retain references to them. +type Entry struct { + Level Level + Time time.Time + LoggerName string + Message string + Caller EntryCaller + Stack string +} + +// CheckWriteAction indicates what action to take after a log entry is +// processed. Actions are ordered in increasing severity. +type CheckWriteAction uint8 + +const ( + // WriteThenNoop indicates that nothing special needs to be done. It's the + // default behavior. + WriteThenNoop CheckWriteAction = iota + // WriteThenPanic causes a panic after Write. + WriteThenPanic + // WriteThenFatal causes a fatal os.Exit after Write. + WriteThenFatal +) + +// CheckedEntry is an Entry together with a collection of Cores that have +// already agreed to log it. +// +// CheckedEntry references should be created by calling AddCore or Should on a +// nil *CheckedEntry. References are returned to a pool after Write, and MUST +// NOT be retained after calling their Write method. +type CheckedEntry struct { + Entry + ErrorOutput WriteSyncer + dirty bool // best-effort detection of pool misuse + should CheckWriteAction + cores []Core +} + +func (ce *CheckedEntry) reset() { + ce.Entry = Entry{} + ce.ErrorOutput = nil + ce.dirty = false + ce.should = WriteThenNoop + for i := range ce.cores { + // don't keep references to cores + ce.cores[i] = nil + } + ce.cores = ce.cores[:0] +} + +// Write writes the entry to the stored Cores, returns any errors, and returns +// the CheckedEntry reference to a pool for immediate re-use. Finally, it +// executes any required CheckWriteAction. +func (ce *CheckedEntry) Write(fields ...Field) { + if ce == nil { + return + } + + if ce.dirty { + if ce.ErrorOutput != nil { + // Make a best effort to detect unsafe re-use of this CheckedEntry. + // If the entry is dirty, log an internal error; because the + // CheckedEntry is being used after it was returned to the pool, + // the message may be an amalgamation from multiple call sites. + fmt.Fprintf(ce.ErrorOutput, "%v Unsafe CheckedEntry re-use near Entry %+v.\n", time.Now(), ce.Entry) + ce.ErrorOutput.Sync() + } + return + } + ce.dirty = true + + var err error + for i := range ce.cores { + err = multierr.Append(err, ce.cores[i].Write(ce.Entry, fields)) + } + if ce.ErrorOutput != nil { + if err != nil { + fmt.Fprintf(ce.ErrorOutput, "%v write error: %v\n", time.Now(), err) + ce.ErrorOutput.Sync() + } + } + + should, msg := ce.should, ce.Message + putCheckedEntry(ce) + + switch should { + case WriteThenPanic: + panic(msg) + case WriteThenFatal: + exit.Exit() + } +} + +// AddCore adds a Core that has agreed to log this CheckedEntry. It's intended to be +// used by Core.Check implementations, and is safe to call on nil CheckedEntry +// references. +func (ce *CheckedEntry) AddCore(ent Entry, core Core) *CheckedEntry { + if ce == nil { + ce = getCheckedEntry() + ce.Entry = ent + } + ce.cores = append(ce.cores, core) + return ce +} + +// Should sets this CheckedEntry's CheckWriteAction, which controls whether a +// Core will panic or fatal after writing this log entry. Like AddCore, it's +// safe to call on nil CheckedEntry references. +func (ce *CheckedEntry) Should(ent Entry, should CheckWriteAction) *CheckedEntry { + if ce == nil { + ce = getCheckedEntry() + ce.Entry = ent + } + ce.should = should + return ce +} diff --git a/vendor/go.uber.org/zap/zapcore/entry_test.go b/vendor/go.uber.org/zap/zapcore/entry_test.go new file mode 100644 index 000000000..569c4e1e0 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/entry_test.go @@ -0,0 +1,107 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "sync" + "testing" + + "go.uber.org/zap/internal/exit" + + "github.com/stretchr/testify/assert" +) + +func TestPutNilEntry(t *testing.T) { + // Pooling nil entries defeats the purpose. + var wg sync.WaitGroup + wg.Add(2) + + go func() { + defer wg.Done() + for i := 0; i < 1000; i++ { + putCheckedEntry(nil) + } + }() + + go func() { + defer wg.Done() + for i := 0; i < 1000; i++ { + ce := getCheckedEntry() + assert.NotNil(t, ce, "Expected only non-nil CheckedEntries in pool.") + assert.False(t, ce.dirty, "Unexpected dirty bit set.") + assert.Nil(t, ce.ErrorOutput, "Non-nil ErrorOutput.") + assert.Equal(t, WriteThenNoop, ce.should, "Unexpected terminal behavior.") + assert.Equal(t, 0, len(ce.cores), "Expected empty slice of cores.") + assert.True(t, cap(ce.cores) > 0, "Expected pooled CheckedEntries to pre-allocate slice of Cores.") + } + }() + + wg.Wait() +} + +func TestEntryCaller(t *testing.T) { + tests := []struct { + caller EntryCaller + full string + short string + }{ + { + caller: NewEntryCaller(100, "/path/to/foo.go", 42, false), + full: "undefined", + short: "undefined", + }, + { + caller: NewEntryCaller(100, "/path/to/foo.go", 42, true), + full: "/path/to/foo.go:42", + short: "to/foo.go:42", + }, + { + caller: NewEntryCaller(100, "to/foo.go", 42, true), + full: "to/foo.go:42", + short: "to/foo.go:42", + }, + } + + for _, tt := range tests { + assert.Equal(t, tt.full, tt.caller.String(), "Unexpected string from EntryCaller.") + assert.Equal(t, tt.full, tt.caller.FullPath(), "Unexpected FullPath from EntryCaller.") + assert.Equal(t, tt.short, tt.caller.TrimmedPath(), "Unexpected TrimmedPath from EntryCaller.") + } +} + +func TestCheckedEntryWrite(t *testing.T) { + // Nil checked entries are safe. + var ce *CheckedEntry + assert.NotPanics(t, func() { ce.Write() }, "Unexpected panic writing nil CheckedEntry.") + + // WriteThenPanic + ce = ce.Should(Entry{}, WriteThenPanic) + assert.Panics(t, func() { ce.Write() }, "Expected to panic when WriteThenPanic is set.") + ce.reset() + + // WriteThenFatal + ce = ce.Should(Entry{}, WriteThenFatal) + stub := exit.WithStub(func() { + ce.Write() + }) + assert.True(t, stub.Exited, "Expected to exit when WriteThenFatal is set.") + ce.reset() +} diff --git a/vendor/go.uber.org/zap/zapcore/error.go b/vendor/go.uber.org/zap/zapcore/error.go new file mode 100644 index 000000000..a67c7bacc --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/error.go @@ -0,0 +1,120 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "fmt" + "sync" +) + +// Encodes the given error into fields of an object. A field with the given +// name is added for the error message. +// +// If the error implements fmt.Formatter, a field with the name ${key}Verbose +// is also added with the full verbose error message. +// +// Finally, if the error implements errorGroup (from go.uber.org/multierr) or +// causer (from github.com/pkg/errors), a ${key}Causes field is added with an +// array of objects containing the errors this error was comprised of. +// +// { +// "error": err.Error(), +// "errorVerbose": fmt.Sprintf("%+v", err), +// "errorCauses": [ +// ... +// ], +// } +func encodeError(key string, err error, enc ObjectEncoder) error { + basic := err.Error() + enc.AddString(key, basic) + + switch e := err.(type) { + case errorGroup: + return enc.AddArray(key+"Causes", errArray(e.Errors())) + case fmt.Formatter: + verbose := fmt.Sprintf("%+v", e) + if verbose != basic { + // This is a rich error type, like those produced by + // github.com/pkg/errors. + enc.AddString(key+"Verbose", verbose) + } + } + return nil +} + +type errorGroup interface { + // Provides read-only access to the underlying list of errors, preferably + // without causing any allocs. + Errors() []error +} + +type causer interface { + // Provides access to the error that caused this error. + Cause() error +} + +// Note that errArry and errArrayElem are very similar to the version +// implemented in the top-level error.go file. We can't re-use this because +// that would require exporting errArray as part of the zapcore API. + +// Encodes a list of errors using the standard error encoding logic. +type errArray []error + +func (errs errArray) MarshalLogArray(arr ArrayEncoder) error { + for i := range errs { + if errs[i] == nil { + continue + } + + el := newErrArrayElem(errs[i]) + arr.AppendObject(el) + el.Free() + } + return nil +} + +var _errArrayElemPool = sync.Pool{New: func() interface{} { + return &errArrayElem{} +}} + +// Encodes any error into a {"error": ...} re-using the same errors logic. +// +// May be passed in place of an array to build a single-element array. +type errArrayElem struct{ err error } + +func newErrArrayElem(err error) *errArrayElem { + e := _errArrayElemPool.Get().(*errArrayElem) + e.err = err + return e +} + +func (e *errArrayElem) MarshalLogArray(arr ArrayEncoder) error { + return arr.AppendObject(e) +} + +func (e *errArrayElem) MarshalLogObject(enc ObjectEncoder) error { + return encodeError("error", e.err, enc) +} + +func (e *errArrayElem) Free() { + e.err = nil + _errArrayElemPool.Put(e) +} diff --git a/vendor/go.uber.org/zap/zapcore/error_test.go b/vendor/go.uber.org/zap/zapcore/error_test.go new file mode 100644 index 000000000..900f52020 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/error_test.go @@ -0,0 +1,177 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "errors" + "fmt" + "io" + "testing" + + richErrors "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + + "go.uber.org/multierr" + . "go.uber.org/zap/zapcore" +) + +type errTooManyUsers int + +func (e errTooManyUsers) Error() string { + return fmt.Sprintf("%d too many users", int(e)) +} + +func (e errTooManyUsers) Format(s fmt.State, verb rune) { + // Implement fmt.Formatter, but don't add any information beyond the basic + // Error method. + if verb == 'v' && s.Flag('+') { + io.WriteString(s, e.Error()) + } +} + +type customMultierr struct{} + +func (e customMultierr) Error() string { + return "great sadness" +} + +func (e customMultierr) Errors() []error { + return []error{ + errors.New("foo"), + nil, + multierr.Append( + errors.New("bar"), + errors.New("baz"), + ), + } +} + +func TestErrorEncoding(t *testing.T) { + tests := []struct { + k string + t FieldType // defaults to ErrorType + iface interface{} + want map[string]interface{} + }{ + { + k: "k", + iface: errTooManyUsers(2), + want: map[string]interface{}{ + "k": "2 too many users", + }, + }, + { + k: "err", + iface: multierr.Combine( + errors.New("foo"), + errors.New("bar"), + errors.New("baz"), + ), + want: map[string]interface{}{ + "err": "foo; bar; baz", + "errCauses": []interface{}{ + map[string]interface{}{"error": "foo"}, + map[string]interface{}{"error": "bar"}, + map[string]interface{}{"error": "baz"}, + }, + }, + }, + { + k: "e", + iface: customMultierr{}, + want: map[string]interface{}{ + "e": "great sadness", + "eCauses": []interface{}{ + map[string]interface{}{"error": "foo"}, + map[string]interface{}{ + "error": "bar; baz", + "errorCauses": []interface{}{ + map[string]interface{}{"error": "bar"}, + map[string]interface{}{"error": "baz"}, + }, + }, + }, + }, + }, + { + k: "k", + iface: richErrors.WithMessage(errors.New("egad"), "failed"), + want: map[string]interface{}{ + "k": "failed: egad", + "kVerbose": "egad\nfailed", + }, + }, + { + k: "error", + iface: multierr.Combine( + richErrors.WithMessage( + multierr.Combine(errors.New("foo"), errors.New("bar")), + "hello", + ), + errors.New("baz"), + richErrors.WithMessage(errors.New("qux"), "world"), + ), + want: map[string]interface{}{ + "error": "hello: foo; bar; baz; world: qux", + "errorCauses": []interface{}{ + map[string]interface{}{ + "error": "hello: foo; bar", + "errorVerbose": "the following errors occurred:\n" + + " - foo\n" + + " - bar\n" + + "hello", + }, + map[string]interface{}{"error": "baz"}, + map[string]interface{}{"error": "world: qux", "errorVerbose": "qux\nworld"}, + }, + }, + }, + } + + for _, tt := range tests { + if tt.t == UnknownType { + tt.t = ErrorType + } + + enc := NewMapObjectEncoder() + f := Field{Key: tt.k, Type: tt.t, Interface: tt.iface} + f.AddTo(enc) + assert.Equal(t, tt.want, enc.Fields, "Unexpected output from field %+v.", f) + } +} + +func TestRichErrorSupport(t *testing.T) { + f := Field{ + Type: ErrorType, + Interface: richErrors.WithMessage(richErrors.New("egad"), "failed"), + Key: "k", + } + enc := NewMapObjectEncoder() + f.AddTo(enc) + assert.Equal(t, "failed: egad", enc.Fields["k"], "Unexpected basic error message.") + + serialized := enc.Fields["kVerbose"] + // Don't assert the exact format used by a third-party package, but ensure + // that some critical elements are present. + assert.Regexp(t, `egad`, serialized, "Expected original error message to be present.") + assert.Regexp(t, `failed`, serialized, "Expected error annotation to be present.") + assert.Regexp(t, `TestRichErrorSupport`, serialized, "Expected calling function to be present in stacktrace.") +} diff --git a/vendor/go.uber.org/zap/zapcore/field.go b/vendor/go.uber.org/zap/zapcore/field.go new file mode 100644 index 000000000..6a5e33e2f --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/field.go @@ -0,0 +1,201 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "bytes" + "fmt" + "math" + "reflect" + "time" +) + +// A FieldType indicates which member of the Field union struct should be used +// and how it should be serialized. +type FieldType uint8 + +const ( + // UnknownType is the default field type. Attempting to add it to an encoder will panic. + UnknownType FieldType = iota + // ArrayMarshalerType indicates that the field carries an ArrayMarshaler. + ArrayMarshalerType + // ObjectMarshalerType indicates that the field carries an ObjectMarshaler. + ObjectMarshalerType + // BinaryType indicates that the field carries an opaque binary blob. + BinaryType + // BoolType indicates that the field carries a bool. + BoolType + // ByteStringType indicates that the field carries UTF-8 encoded bytes. + ByteStringType + // Complex128Type indicates that the field carries a complex128. + Complex128Type + // Complex64Type indicates that the field carries a complex128. + Complex64Type + // DurationType indicates that the field carries a time.Duration. + DurationType + // Float64Type indicates that the field carries a float64. + Float64Type + // Float32Type indicates that the field carries a float32. + Float32Type + // Int64Type indicates that the field carries an int64. + Int64Type + // Int32Type indicates that the field carries an int32. + Int32Type + // Int16Type indicates that the field carries an int16. + Int16Type + // Int8Type indicates that the field carries an int8. + Int8Type + // StringType indicates that the field carries a string. + StringType + // TimeType indicates that the field carries a time.Time. + TimeType + // Uint64Type indicates that the field carries a uint64. + Uint64Type + // Uint32Type indicates that the field carries a uint32. + Uint32Type + // Uint16Type indicates that the field carries a uint16. + Uint16Type + // Uint8Type indicates that the field carries a uint8. + Uint8Type + // UintptrType indicates that the field carries a uintptr. + UintptrType + // ReflectType indicates that the field carries an interface{}, which should + // be serialized using reflection. + ReflectType + // NamespaceType signals the beginning of an isolated namespace. All + // subsequent fields should be added to the new namespace. + NamespaceType + // StringerType indicates that the field carries a fmt.Stringer. + StringerType + // ErrorType indicates that the field carries an error. + ErrorType + // SkipType indicates that the field is a no-op. + SkipType +) + +// A Field is a marshaling operation used to add a key-value pair to a logger's +// context. Most fields are lazily marshaled, so it's inexpensive to add fields +// to disabled debug-level log statements. +type Field struct { + Key string + Type FieldType + Integer int64 + String string + Interface interface{} +} + +// AddTo exports a field through the ObjectEncoder interface. It's primarily +// useful to library authors, and shouldn't be necessary in most applications. +func (f Field) AddTo(enc ObjectEncoder) { + var err error + + switch f.Type { + case ArrayMarshalerType: + err = enc.AddArray(f.Key, f.Interface.(ArrayMarshaler)) + case ObjectMarshalerType: + err = enc.AddObject(f.Key, f.Interface.(ObjectMarshaler)) + case BinaryType: + enc.AddBinary(f.Key, f.Interface.([]byte)) + case BoolType: + enc.AddBool(f.Key, f.Integer == 1) + case ByteStringType: + enc.AddByteString(f.Key, f.Interface.([]byte)) + case Complex128Type: + enc.AddComplex128(f.Key, f.Interface.(complex128)) + case Complex64Type: + enc.AddComplex64(f.Key, f.Interface.(complex64)) + case DurationType: + enc.AddDuration(f.Key, time.Duration(f.Integer)) + case Float64Type: + enc.AddFloat64(f.Key, math.Float64frombits(uint64(f.Integer))) + case Float32Type: + enc.AddFloat32(f.Key, math.Float32frombits(uint32(f.Integer))) + case Int64Type: + enc.AddInt64(f.Key, f.Integer) + case Int32Type: + enc.AddInt32(f.Key, int32(f.Integer)) + case Int16Type: + enc.AddInt16(f.Key, int16(f.Integer)) + case Int8Type: + enc.AddInt8(f.Key, int8(f.Integer)) + case StringType: + enc.AddString(f.Key, f.String) + case TimeType: + if f.Interface != nil { + enc.AddTime(f.Key, time.Unix(0, f.Integer).In(f.Interface.(*time.Location))) + } else { + // Fall back to UTC if location is nil. + enc.AddTime(f.Key, time.Unix(0, f.Integer)) + } + case Uint64Type: + enc.AddUint64(f.Key, uint64(f.Integer)) + case Uint32Type: + enc.AddUint32(f.Key, uint32(f.Integer)) + case Uint16Type: + enc.AddUint16(f.Key, uint16(f.Integer)) + case Uint8Type: + enc.AddUint8(f.Key, uint8(f.Integer)) + case UintptrType: + enc.AddUintptr(f.Key, uintptr(f.Integer)) + case ReflectType: + err = enc.AddReflected(f.Key, f.Interface) + case NamespaceType: + enc.OpenNamespace(f.Key) + case StringerType: + enc.AddString(f.Key, f.Interface.(fmt.Stringer).String()) + case ErrorType: + encodeError(f.Key, f.Interface.(error), enc) + case SkipType: + break + default: + panic(fmt.Sprintf("unknown field type: %v", f)) + } + + if err != nil { + enc.AddString(fmt.Sprintf("%sError", f.Key), err.Error()) + } +} + +// Equals returns whether two fields are equal. For non-primitive types such as +// errors, marshalers, or reflect types, it uses reflect.DeepEqual. +func (f Field) Equals(other Field) bool { + if f.Type != other.Type { + return false + } + if f.Key != other.Key { + return false + } + + switch f.Type { + case BinaryType, ByteStringType: + return bytes.Equal(f.Interface.([]byte), other.Interface.([]byte)) + case ArrayMarshalerType, ObjectMarshalerType, ErrorType, ReflectType: + return reflect.DeepEqual(f.Interface, other.Interface) + default: + return f == other + } +} + +func addFields(enc ObjectEncoder, fields []Field) { + for i := range fields { + fields[i].AddTo(enc) + } +} diff --git a/vendor/go.uber.org/zap/zapcore/field_test.go b/vendor/go.uber.org/zap/zapcore/field_test.go new file mode 100644 index 000000000..9a5fe0189 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/field_test.go @@ -0,0 +1,231 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "errors" + "fmt" + "math" + "testing" + "time" + + "go.uber.org/zap" + + "github.com/stretchr/testify/assert" + + . "go.uber.org/zap/zapcore" +) + +type users int + +func (u users) String() string { + return fmt.Sprintf("%d users", int(u)) +} + +func (u users) MarshalLogObject(enc ObjectEncoder) error { + if int(u) < 0 { + return errors.New("too few users") + } + enc.AddInt("users", int(u)) + return nil +} + +func (u users) MarshalLogArray(enc ArrayEncoder) error { + if int(u) < 0 { + return errors.New("too few users") + } + for i := 0; i < int(u); i++ { + enc.AppendString("user") + } + return nil +} + +func TestUnknownFieldType(t *testing.T) { + unknown := Field{Key: "k", String: "foo"} + assert.Equal(t, UnknownType, unknown.Type, "Expected zero value of FieldType to be UnknownType.") + assert.Panics(t, func() { + unknown.AddTo(NewMapObjectEncoder()) + }, "Expected using a field with unknown type to panic.") +} + +func TestFieldAddingError(t *testing.T) { + tests := []struct { + t FieldType + want interface{} + }{ + {ArrayMarshalerType, []interface{}{}}, + {ObjectMarshalerType, map[string]interface{}{}}, + } + for _, tt := range tests { + f := Field{Key: "k", Interface: users(-1), Type: tt.t} + enc := NewMapObjectEncoder() + assert.NotPanics(t, func() { f.AddTo(enc) }, "Unexpected panic when adding fields returns an error.") + assert.Equal(t, tt.want, enc.Fields["k"], "On error, expected zero value in field.Key.") + assert.Equal(t, "too few users", enc.Fields["kError"], "Expected error message in log context.") + } +} + +func TestFields(t *testing.T) { + tests := []struct { + t FieldType + i int64 + s string + iface interface{} + want interface{} + }{ + {t: ArrayMarshalerType, iface: users(2), want: []interface{}{"user", "user"}}, + {t: ObjectMarshalerType, iface: users(2), want: map[string]interface{}{"users": 2}}, + {t: BinaryType, iface: []byte("foo"), want: []byte("foo")}, + {t: BoolType, i: 0, want: false}, + {t: ByteStringType, iface: []byte("foo"), want: "foo"}, + {t: Complex128Type, iface: 1 + 2i, want: 1 + 2i}, + {t: Complex64Type, iface: complex64(1 + 2i), want: complex64(1 + 2i)}, + {t: DurationType, i: 1000, want: time.Microsecond}, + {t: Float64Type, i: int64(math.Float64bits(3.14)), want: 3.14}, + {t: Float32Type, i: int64(math.Float32bits(3.14)), want: float32(3.14)}, + {t: Int64Type, i: 42, want: int64(42)}, + {t: Int32Type, i: 42, want: int32(42)}, + {t: Int16Type, i: 42, want: int16(42)}, + {t: Int8Type, i: 42, want: int8(42)}, + {t: StringType, s: "foo", want: "foo"}, + {t: TimeType, i: 1000, iface: time.UTC, want: time.Unix(0, 1000).In(time.UTC)}, + {t: TimeType, i: 1000, want: time.Unix(0, 1000)}, + {t: Uint64Type, i: 42, want: uint64(42)}, + {t: Uint32Type, i: 42, want: uint32(42)}, + {t: Uint16Type, i: 42, want: uint16(42)}, + {t: Uint8Type, i: 42, want: uint8(42)}, + {t: UintptrType, i: 42, want: uintptr(42)}, + {t: ReflectType, iface: users(2), want: users(2)}, + {t: NamespaceType, want: map[string]interface{}{}}, + {t: StringerType, iface: users(2), want: "2 users"}, + {t: SkipType, want: interface{}(nil)}, + } + + for _, tt := range tests { + enc := NewMapObjectEncoder() + f := Field{Key: "k", Type: tt.t, Integer: tt.i, Interface: tt.iface, String: tt.s} + f.AddTo(enc) + assert.Equal(t, tt.want, enc.Fields["k"], "Unexpected output from field %+v.", f) + + delete(enc.Fields, "k") + assert.Equal(t, 0, len(enc.Fields), "Unexpected extra fields present.") + + assert.True(t, f.Equals(f), "Field does not equal itself") + } +} + +func TestEquals(t *testing.T) { + tests := []struct { + a, b Field + want bool + }{ + { + a: zap.Int16("a", 1), + b: zap.Int32("a", 1), + want: false, + }, + { + a: zap.String("k", "a"), + b: zap.String("k", "a"), + want: true, + }, + { + a: zap.String("k", "a"), + b: zap.String("k2", "a"), + want: false, + }, + { + a: zap.String("k", "a"), + b: zap.String("k", "b"), + want: false, + }, + { + a: zap.Time("k", time.Unix(1000, 1000)), + b: zap.Time("k", time.Unix(1000, 1000)), + want: true, + }, + { + a: zap.Time("k", time.Unix(1000, 1000).In(time.UTC)), + b: zap.Time("k", time.Unix(1000, 1000).In(time.FixedZone("TEST", -8))), + want: false, + }, + { + a: zap.Time("k", time.Unix(1000, 1000)), + b: zap.Time("k", time.Unix(1000, 2000)), + want: false, + }, + { + a: zap.Binary("k", []byte{1, 2}), + b: zap.Binary("k", []byte{1, 2}), + want: true, + }, + { + a: zap.Binary("k", []byte{1, 2}), + b: zap.Binary("k", []byte{1, 3}), + want: false, + }, + { + a: zap.ByteString("k", []byte("abc")), + b: zap.ByteString("k", []byte("abc")), + want: true, + }, + { + a: zap.ByteString("k", []byte("abc")), + b: zap.ByteString("k", []byte("abd")), + want: false, + }, + { + a: zap.Ints("k", []int{1, 2}), + b: zap.Ints("k", []int{1, 2}), + want: true, + }, + { + a: zap.Ints("k", []int{1, 2}), + b: zap.Ints("k", []int{1, 3}), + want: false, + }, + { + a: zap.Object("k", users(10)), + b: zap.Object("k", users(10)), + want: true, + }, + { + a: zap.Object("k", users(10)), + b: zap.Object("k", users(20)), + want: false, + }, + { + a: zap.Any("k", map[string]string{"a": "b"}), + b: zap.Any("k", map[string]string{"a": "b"}), + want: true, + }, + { + a: zap.Any("k", map[string]string{"a": "b"}), + b: zap.Any("k", map[string]string{"a": "d"}), + want: false, + }, + } + + for _, tt := range tests { + assert.Equal(t, tt.want, tt.a.Equals(tt.b), "a.Equals(b) a: %#v b: %#v", tt.a, tt.b) + assert.Equal(t, tt.want, tt.b.Equals(tt.a), "b.Equals(a) a: %#v b: %#v", tt.a, tt.b) + } +} diff --git a/vendor/go.uber.org/zap/zapcore/hook.go b/vendor/go.uber.org/zap/zapcore/hook.go new file mode 100644 index 000000000..5db4afb30 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/hook.go @@ -0,0 +1,68 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import "go.uber.org/multierr" + +type hooked struct { + Core + funcs []func(Entry) error +} + +// RegisterHooks wraps a Core and runs a collection of user-defined callback +// hooks each time a message is logged. Execution of the callbacks is blocking. +// +// This offers users an easy way to register simple callbacks (e.g., metrics +// collection) without implementing the full Core interface. +func RegisterHooks(core Core, hooks ...func(Entry) error) Core { + funcs := append([]func(Entry) error{}, hooks...) + return &hooked{ + Core: core, + funcs: funcs, + } +} + +func (h *hooked) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { + // Let the wrapped Core decide whether to log this message or not. This + // also gives the downstream a chance to register itself directly with the + // CheckedEntry. + if downstream := h.Core.Check(ent, ce); downstream != nil { + return downstream.AddCore(ent, h) + } + return ce +} + +func (h *hooked) With(fields []Field) Core { + return &hooked{ + Core: h.Core.With(fields), + funcs: h.funcs, + } +} + +func (h *hooked) Write(ent Entry, _ []Field) error { + // Since our downstream had a chance to register itself directly with the + // CheckedMessage, we don't need to call it here. + var err error + for i := range h.funcs { + err = multierr.Append(err, h.funcs[i](ent)) + } + return err +} diff --git a/vendor/go.uber.org/zap/zapcore/hook_test.go b/vendor/go.uber.org/zap/zapcore/hook_test.go new file mode 100644 index 000000000..0764888ab --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/hook_test.go @@ -0,0 +1,73 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "testing" + + . "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest/observer" + + "github.com/stretchr/testify/assert" +) + +func TestHooks(t *testing.T) { + tests := []struct { + entryLevel Level + coreLevel Level + expectCall bool + }{ + {DebugLevel, InfoLevel, false}, + {InfoLevel, InfoLevel, true}, + {WarnLevel, InfoLevel, true}, + } + + for _, tt := range tests { + fac, logs := observer.New(tt.coreLevel) + intField := makeInt64Field("foo", 42) + ent := Entry{Message: "bar", Level: tt.entryLevel} + + var called int + f := func(e Entry) error { + called++ + assert.Equal(t, ent, e, "Hook called with unexpected Entry.") + return nil + } + + h := RegisterHooks(fac, f) + if ce := h.With([]Field{intField}).Check(ent, nil); ce != nil { + ce.Write() + } + + if tt.expectCall { + assert.Equal(t, 1, called, "Expected to call hook once.") + assert.Equal( + t, + []observer.LoggedEntry{{Entry: ent, Context: []Field{intField}}}, + logs.AllUntimed(), + "Unexpected logs written out.", + ) + } else { + assert.Equal(t, 0, called, "Didn't expect to call hook.") + assert.Equal(t, 0, logs.Len(), "Unexpected logs written out.") + } + } +} diff --git a/vendor/go.uber.org/zap/zapcore/json_encoder.go b/vendor/go.uber.org/zap/zapcore/json_encoder.go new file mode 100644 index 000000000..2dc67d81e --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/json_encoder.go @@ -0,0 +1,502 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "encoding/base64" + "encoding/json" + "math" + "sync" + "time" + "unicode/utf8" + + "go.uber.org/zap/buffer" + "go.uber.org/zap/internal/bufferpool" +) + +// For JSON-escaping; see jsonEncoder.safeAddString below. +const _hex = "0123456789abcdef" + +var _jsonPool = sync.Pool{New: func() interface{} { + return &jsonEncoder{} +}} + +func getJSONEncoder() *jsonEncoder { + return _jsonPool.Get().(*jsonEncoder) +} + +func putJSONEncoder(enc *jsonEncoder) { + if enc.reflectBuf != nil { + enc.reflectBuf.Free() + } + enc.EncoderConfig = nil + enc.buf = nil + enc.spaced = false + enc.openNamespaces = 0 + enc.reflectBuf = nil + enc.reflectEnc = nil + _jsonPool.Put(enc) +} + +type jsonEncoder struct { + *EncoderConfig + buf *buffer.Buffer + spaced bool // include spaces after colons and commas + openNamespaces int + + // for encoding generic values by reflection + reflectBuf *buffer.Buffer + reflectEnc *json.Encoder +} + +// NewJSONEncoder creates a fast, low-allocation JSON encoder. The encoder +// appropriately escapes all field keys and values. +// +// Note that the encoder doesn't deduplicate keys, so it's possible to produce +// a message like +// {"foo":"bar","foo":"baz"} +// This is permitted by the JSON specification, but not encouraged. Many +// libraries will ignore duplicate key-value pairs (typically keeping the last +// pair) when unmarshaling, but users should attempt to avoid adding duplicate +// keys. +func NewJSONEncoder(cfg EncoderConfig) Encoder { + return newJSONEncoder(cfg, false) +} + +func newJSONEncoder(cfg EncoderConfig, spaced bool) *jsonEncoder { + return &jsonEncoder{ + EncoderConfig: &cfg, + buf: bufferpool.Get(), + spaced: spaced, + } +} + +func (enc *jsonEncoder) AddArray(key string, arr ArrayMarshaler) error { + enc.addKey(key) + return enc.AppendArray(arr) +} + +func (enc *jsonEncoder) AddObject(key string, obj ObjectMarshaler) error { + enc.addKey(key) + return enc.AppendObject(obj) +} + +func (enc *jsonEncoder) AddBinary(key string, val []byte) { + enc.AddString(key, base64.StdEncoding.EncodeToString(val)) +} + +func (enc *jsonEncoder) AddByteString(key string, val []byte) { + enc.addKey(key) + enc.AppendByteString(val) +} + +func (enc *jsonEncoder) AddBool(key string, val bool) { + enc.addKey(key) + enc.AppendBool(val) +} + +func (enc *jsonEncoder) AddComplex128(key string, val complex128) { + enc.addKey(key) + enc.AppendComplex128(val) +} + +func (enc *jsonEncoder) AddDuration(key string, val time.Duration) { + enc.addKey(key) + enc.AppendDuration(val) +} + +func (enc *jsonEncoder) AddFloat64(key string, val float64) { + enc.addKey(key) + enc.AppendFloat64(val) +} + +func (enc *jsonEncoder) AddInt64(key string, val int64) { + enc.addKey(key) + enc.AppendInt64(val) +} + +func (enc *jsonEncoder) resetReflectBuf() { + if enc.reflectBuf == nil { + enc.reflectBuf = bufferpool.Get() + enc.reflectEnc = json.NewEncoder(enc.reflectBuf) + } else { + enc.reflectBuf.Reset() + } +} + +func (enc *jsonEncoder) AddReflected(key string, obj interface{}) error { + enc.resetReflectBuf() + err := enc.reflectEnc.Encode(obj) + if err != nil { + return err + } + enc.reflectBuf.TrimNewline() + enc.addKey(key) + _, err = enc.buf.Write(enc.reflectBuf.Bytes()) + return err +} + +func (enc *jsonEncoder) OpenNamespace(key string) { + enc.addKey(key) + enc.buf.AppendByte('{') + enc.openNamespaces++ +} + +func (enc *jsonEncoder) AddString(key, val string) { + enc.addKey(key) + enc.AppendString(val) +} + +func (enc *jsonEncoder) AddTime(key string, val time.Time) { + enc.addKey(key) + enc.AppendTime(val) +} + +func (enc *jsonEncoder) AddUint64(key string, val uint64) { + enc.addKey(key) + enc.AppendUint64(val) +} + +func (enc *jsonEncoder) AppendArray(arr ArrayMarshaler) error { + enc.addElementSeparator() + enc.buf.AppendByte('[') + err := arr.MarshalLogArray(enc) + enc.buf.AppendByte(']') + return err +} + +func (enc *jsonEncoder) AppendObject(obj ObjectMarshaler) error { + enc.addElementSeparator() + enc.buf.AppendByte('{') + err := obj.MarshalLogObject(enc) + enc.buf.AppendByte('}') + return err +} + +func (enc *jsonEncoder) AppendBool(val bool) { + enc.addElementSeparator() + enc.buf.AppendBool(val) +} + +func (enc *jsonEncoder) AppendByteString(val []byte) { + enc.addElementSeparator() + enc.buf.AppendByte('"') + enc.safeAddByteString(val) + enc.buf.AppendByte('"') +} + +func (enc *jsonEncoder) AppendComplex128(val complex128) { + enc.addElementSeparator() + // Cast to a platform-independent, fixed-size type. + r, i := float64(real(val)), float64(imag(val)) + enc.buf.AppendByte('"') + // Because we're always in a quoted string, we can use strconv without + // special-casing NaN and +/-Inf. + enc.buf.AppendFloat(r, 64) + enc.buf.AppendByte('+') + enc.buf.AppendFloat(i, 64) + enc.buf.AppendByte('i') + enc.buf.AppendByte('"') +} + +func (enc *jsonEncoder) AppendDuration(val time.Duration) { + cur := enc.buf.Len() + enc.EncodeDuration(val, enc) + if cur == enc.buf.Len() { + // User-supplied EncodeDuration is a no-op. Fall back to nanoseconds to keep + // JSON valid. + enc.AppendInt64(int64(val)) + } +} + +func (enc *jsonEncoder) AppendInt64(val int64) { + enc.addElementSeparator() + enc.buf.AppendInt(val) +} + +func (enc *jsonEncoder) AppendReflected(val interface{}) error { + enc.resetReflectBuf() + err := enc.reflectEnc.Encode(val) + if err != nil { + return err + } + enc.reflectBuf.TrimNewline() + enc.addElementSeparator() + _, err = enc.buf.Write(enc.reflectBuf.Bytes()) + return err +} + +func (enc *jsonEncoder) AppendString(val string) { + enc.addElementSeparator() + enc.buf.AppendByte('"') + enc.safeAddString(val) + enc.buf.AppendByte('"') +} + +func (enc *jsonEncoder) AppendTime(val time.Time) { + cur := enc.buf.Len() + enc.EncodeTime(val, enc) + if cur == enc.buf.Len() { + // User-supplied EncodeTime is a no-op. Fall back to nanos since epoch to keep + // output JSON valid. + enc.AppendInt64(val.UnixNano()) + } +} + +func (enc *jsonEncoder) AppendUint64(val uint64) { + enc.addElementSeparator() + enc.buf.AppendUint(val) +} + +func (enc *jsonEncoder) AddComplex64(k string, v complex64) { enc.AddComplex128(k, complex128(v)) } +func (enc *jsonEncoder) AddFloat32(k string, v float32) { enc.AddFloat64(k, float64(v)) } +func (enc *jsonEncoder) AddInt(k string, v int) { enc.AddInt64(k, int64(v)) } +func (enc *jsonEncoder) AddInt32(k string, v int32) { enc.AddInt64(k, int64(v)) } +func (enc *jsonEncoder) AddInt16(k string, v int16) { enc.AddInt64(k, int64(v)) } +func (enc *jsonEncoder) AddInt8(k string, v int8) { enc.AddInt64(k, int64(v)) } +func (enc *jsonEncoder) AddUint(k string, v uint) { enc.AddUint64(k, uint64(v)) } +func (enc *jsonEncoder) AddUint32(k string, v uint32) { enc.AddUint64(k, uint64(v)) } +func (enc *jsonEncoder) AddUint16(k string, v uint16) { enc.AddUint64(k, uint64(v)) } +func (enc *jsonEncoder) AddUint8(k string, v uint8) { enc.AddUint64(k, uint64(v)) } +func (enc *jsonEncoder) AddUintptr(k string, v uintptr) { enc.AddUint64(k, uint64(v)) } +func (enc *jsonEncoder) AppendComplex64(v complex64) { enc.AppendComplex128(complex128(v)) } +func (enc *jsonEncoder) AppendFloat64(v float64) { enc.appendFloat(v, 64) } +func (enc *jsonEncoder) AppendFloat32(v float32) { enc.appendFloat(float64(v), 32) } +func (enc *jsonEncoder) AppendInt(v int) { enc.AppendInt64(int64(v)) } +func (enc *jsonEncoder) AppendInt32(v int32) { enc.AppendInt64(int64(v)) } +func (enc *jsonEncoder) AppendInt16(v int16) { enc.AppendInt64(int64(v)) } +func (enc *jsonEncoder) AppendInt8(v int8) { enc.AppendInt64(int64(v)) } +func (enc *jsonEncoder) AppendUint(v uint) { enc.AppendUint64(uint64(v)) } +func (enc *jsonEncoder) AppendUint32(v uint32) { enc.AppendUint64(uint64(v)) } +func (enc *jsonEncoder) AppendUint16(v uint16) { enc.AppendUint64(uint64(v)) } +func (enc *jsonEncoder) AppendUint8(v uint8) { enc.AppendUint64(uint64(v)) } +func (enc *jsonEncoder) AppendUintptr(v uintptr) { enc.AppendUint64(uint64(v)) } + +func (enc *jsonEncoder) Clone() Encoder { + clone := enc.clone() + clone.buf.Write(enc.buf.Bytes()) + return clone +} + +func (enc *jsonEncoder) clone() *jsonEncoder { + clone := getJSONEncoder() + clone.EncoderConfig = enc.EncoderConfig + clone.spaced = enc.spaced + clone.openNamespaces = enc.openNamespaces + clone.buf = bufferpool.Get() + return clone +} + +func (enc *jsonEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer, error) { + final := enc.clone() + final.buf.AppendByte('{') + + if final.LevelKey != "" { + final.addKey(final.LevelKey) + cur := final.buf.Len() + final.EncodeLevel(ent.Level, final) + if cur == final.buf.Len() { + // User-supplied EncodeLevel was a no-op. Fall back to strings to keep + // output JSON valid. + final.AppendString(ent.Level.String()) + } + } + if final.TimeKey != "" { + final.AddTime(final.TimeKey, ent.Time) + } + if ent.LoggerName != "" && final.NameKey != "" { + final.addKey(final.NameKey) + cur := final.buf.Len() + nameEncoder := final.EncodeName + + // if no name encoder provided, fall back to FullNameEncoder for backwards + // compatibility + if nameEncoder == nil { + nameEncoder = FullNameEncoder + } + + nameEncoder(ent.LoggerName, final) + if cur == final.buf.Len() { + // User-supplied EncodeName was a no-op. Fall back to strings to + // keep output JSON valid. + final.AppendString(ent.LoggerName) + } + } + if ent.Caller.Defined && final.CallerKey != "" { + final.addKey(final.CallerKey) + cur := final.buf.Len() + final.EncodeCaller(ent.Caller, final) + if cur == final.buf.Len() { + // User-supplied EncodeCaller was a no-op. Fall back to strings to + // keep output JSON valid. + final.AppendString(ent.Caller.String()) + } + } + if final.MessageKey != "" { + final.addKey(enc.MessageKey) + final.AppendString(ent.Message) + } + if enc.buf.Len() > 0 { + final.addElementSeparator() + final.buf.Write(enc.buf.Bytes()) + } + addFields(final, fields) + final.closeOpenNamespaces() + if ent.Stack != "" && final.StacktraceKey != "" { + final.AddString(final.StacktraceKey, ent.Stack) + } + final.buf.AppendByte('}') + if final.LineEnding != "" { + final.buf.AppendString(final.LineEnding) + } else { + final.buf.AppendString(DefaultLineEnding) + } + + ret := final.buf + putJSONEncoder(final) + return ret, nil +} + +func (enc *jsonEncoder) truncate() { + enc.buf.Reset() +} + +func (enc *jsonEncoder) closeOpenNamespaces() { + for i := 0; i < enc.openNamespaces; i++ { + enc.buf.AppendByte('}') + } +} + +func (enc *jsonEncoder) addKey(key string) { + enc.addElementSeparator() + enc.buf.AppendByte('"') + enc.safeAddString(key) + enc.buf.AppendByte('"') + enc.buf.AppendByte(':') + if enc.spaced { + enc.buf.AppendByte(' ') + } +} + +func (enc *jsonEncoder) addElementSeparator() { + last := enc.buf.Len() - 1 + if last < 0 { + return + } + switch enc.buf.Bytes()[last] { + case '{', '[', ':', ',', ' ': + return + default: + enc.buf.AppendByte(',') + if enc.spaced { + enc.buf.AppendByte(' ') + } + } +} + +func (enc *jsonEncoder) appendFloat(val float64, bitSize int) { + enc.addElementSeparator() + switch { + case math.IsNaN(val): + enc.buf.AppendString(`"NaN"`) + case math.IsInf(val, 1): + enc.buf.AppendString(`"+Inf"`) + case math.IsInf(val, -1): + enc.buf.AppendString(`"-Inf"`) + default: + enc.buf.AppendFloat(val, bitSize) + } +} + +// safeAddString JSON-escapes a string and appends it to the internal buffer. +// Unlike the standard library's encoder, it doesn't attempt to protect the +// user from browser vulnerabilities or JSONP-related problems. +func (enc *jsonEncoder) safeAddString(s string) { + for i := 0; i < len(s); { + if enc.tryAddRuneSelf(s[i]) { + i++ + continue + } + r, size := utf8.DecodeRuneInString(s[i:]) + if enc.tryAddRuneError(r, size) { + i++ + continue + } + enc.buf.AppendString(s[i : i+size]) + i += size + } +} + +// safeAddByteString is no-alloc equivalent of safeAddString(string(s)) for s []byte. +func (enc *jsonEncoder) safeAddByteString(s []byte) { + for i := 0; i < len(s); { + if enc.tryAddRuneSelf(s[i]) { + i++ + continue + } + r, size := utf8.DecodeRune(s[i:]) + if enc.tryAddRuneError(r, size) { + i++ + continue + } + enc.buf.Write(s[i : i+size]) + i += size + } +} + +// tryAddRuneSelf appends b if it is valid UTF-8 character represented in a single byte. +func (enc *jsonEncoder) tryAddRuneSelf(b byte) bool { + if b >= utf8.RuneSelf { + return false + } + if 0x20 <= b && b != '\\' && b != '"' { + enc.buf.AppendByte(b) + return true + } + switch b { + case '\\', '"': + enc.buf.AppendByte('\\') + enc.buf.AppendByte(b) + case '\n': + enc.buf.AppendByte('\\') + enc.buf.AppendByte('n') + case '\r': + enc.buf.AppendByte('\\') + enc.buf.AppendByte('r') + case '\t': + enc.buf.AppendByte('\\') + enc.buf.AppendByte('t') + default: + // Encode bytes < 0x20, except for the escape sequences above. + enc.buf.AppendString(`\u00`) + enc.buf.AppendByte(_hex[b>>4]) + enc.buf.AppendByte(_hex[b&0xF]) + } + return true +} + +func (enc *jsonEncoder) tryAddRuneError(r rune, size int) bool { + if r == utf8.RuneError && size == 1 { + enc.buf.AppendString(`\ufffd`) + return true + } + return false +} diff --git a/vendor/go.uber.org/zap/zapcore/json_encoder_bench_test.go b/vendor/go.uber.org/zap/zapcore/json_encoder_bench_test.go new file mode 100644 index 000000000..4bd5033b4 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/json_encoder_bench_test.go @@ -0,0 +1,91 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "encoding/json" + "testing" + "time" + + . "go.uber.org/zap/zapcore" +) + +func BenchmarkJSONLogMarshalerFunc(b *testing.B) { + for i := 0; i < b.N; i++ { + enc := NewJSONEncoder(testEncoderConfig()) + enc.AddObject("nested", ObjectMarshalerFunc(func(enc ObjectEncoder) error { + enc.AddInt64("i", int64(i)) + return nil + })) + } +} + +func BenchmarkZapJSON(b *testing.B) { + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + enc := NewJSONEncoder(testEncoderConfig()) + enc.AddString("str", "foo") + enc.AddInt64("int64-1", 1) + enc.AddInt64("int64-2", 2) + enc.AddFloat64("float64", 1.0) + enc.AddString("string1", "\n") + enc.AddString("string2", "💩") + enc.AddString("string3", "🤔") + enc.AddString("string4", "🙊") + enc.AddBool("bool", true) + buf, _ := enc.EncodeEntry(Entry{ + Message: "fake", + Level: DebugLevel, + }, nil) + buf.Free() + } + }) +} + +func BenchmarkStandardJSON(b *testing.B) { + record := struct { + Level string `json:"level"` + Message string `json:"msg"` + Time time.Time `json:"ts"` + Fields map[string]interface{} `json:"fields"` + }{ + Level: "debug", + Message: "fake", + Time: time.Unix(0, 0), + Fields: map[string]interface{}{ + "str": "foo", + "int64-1": int64(1), + "int64-2": int64(1), + "float64": float64(1.0), + "string1": "\n", + "string2": "💩", + "string3": "🤔", + "string4": "🙊", + "bool": true, + }, + } + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + json.Marshal(record) + } + }) +} diff --git a/vendor/go.uber.org/zap/zapcore/json_encoder_impl_test.go b/vendor/go.uber.org/zap/zapcore/json_encoder_impl_test.go new file mode 100644 index 000000000..563d5f6b6 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/json_encoder_impl_test.go @@ -0,0 +1,479 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "encoding/json" + "errors" + "math" + "math/rand" + "reflect" + "testing" + "testing/quick" + "time" + + "go.uber.org/zap/internal/bufferpool" + + "github.com/stretchr/testify/assert" + "go.uber.org/multierr" +) + +func TestJSONClone(t *testing.T) { + // The parent encoder is created with plenty of excess capacity. + parent := &jsonEncoder{buf: bufferpool.Get()} + clone := parent.Clone() + + // Adding to the parent shouldn't affect the clone, and vice versa. + parent.AddString("foo", "bar") + clone.AddString("baz", "bing") + + assertJSON(t, `"foo":"bar"`, parent) + assertJSON(t, `"baz":"bing"`, clone.(*jsonEncoder)) +} + +func TestJSONEscaping(t *testing.T) { + enc := &jsonEncoder{buf: bufferpool.Get()} + // Test all the edge cases of JSON escaping directly. + cases := map[string]string{ + // ASCII. + `foo`: `foo`, + // Special-cased characters. + `"`: `\"`, + `\`: `\\`, + // Special-cased characters within everyday ASCII. + `foo"foo`: `foo\"foo`, + "foo\n": `foo\n`, + // Special-cased control characters. + "\n": `\n`, + "\r": `\r`, + "\t": `\t`, + // \b and \f are sometimes backslash-escaped, but this representation is also + // conformant. + "\b": `\u0008`, + "\f": `\u000c`, + // The standard lib special-cases angle brackets and ampersands by default, + // because it wants to protect users from browser exploits. In a logging + // context, we shouldn't special-case these characters. + "<": "<", + ">": ">", + "&": "&", + // ASCII bell - not special-cased. + string(byte(0x07)): `\u0007`, + // Astral-plane unicode. + `☃`: `☃`, + // Decodes to (RuneError, 1) + "\xed\xa0\x80": `\ufffd\ufffd\ufffd`, + "foo\xed\xa0\x80": `foo\ufffd\ufffd\ufffd`, + } + + t.Run("String", func(t *testing.T) { + for input, output := range cases { + enc.truncate() + enc.safeAddString(input) + assertJSON(t, output, enc) + } + }) + + t.Run("ByteString", func(t *testing.T) { + for input, output := range cases { + enc.truncate() + enc.safeAddByteString([]byte(input)) + assertJSON(t, output, enc) + } + }) +} + +func TestJSONEncoderObjectFields(t *testing.T) { + tests := []struct { + desc string + expected string + f func(Encoder) + }{ + {"binary", `"k":"YWIxMg=="`, func(e Encoder) { e.AddBinary("k", []byte("ab12")) }}, + {"bool", `"k\\":true`, func(e Encoder) { e.AddBool(`k\`, true) }}, // test key escaping once + {"bool", `"k":true`, func(e Encoder) { e.AddBool("k", true) }}, + {"bool", `"k":false`, func(e Encoder) { e.AddBool("k", false) }}, + {"byteString", `"k":"v\\"`, func(e Encoder) { e.AddByteString(`k`, []byte(`v\`)) }}, + {"byteString", `"k":"v"`, func(e Encoder) { e.AddByteString("k", []byte("v")) }}, + {"byteString", `"k":""`, func(e Encoder) { e.AddByteString("k", []byte{}) }}, + {"byteString", `"k":""`, func(e Encoder) { e.AddByteString("k", nil) }}, + {"complex128", `"k":"1+2i"`, func(e Encoder) { e.AddComplex128("k", 1+2i) }}, + {"complex64", `"k":"1+2i"`, func(e Encoder) { e.AddComplex64("k", 1+2i) }}, + {"duration", `"k":0.000000001`, func(e Encoder) { e.AddDuration("k", 1) }}, + {"float64", `"k":1`, func(e Encoder) { e.AddFloat64("k", 1.0) }}, + {"float64", `"k":10000000000`, func(e Encoder) { e.AddFloat64("k", 1e10) }}, + {"float64", `"k":"NaN"`, func(e Encoder) { e.AddFloat64("k", math.NaN()) }}, + {"float64", `"k":"+Inf"`, func(e Encoder) { e.AddFloat64("k", math.Inf(1)) }}, + {"float64", `"k":"-Inf"`, func(e Encoder) { e.AddFloat64("k", math.Inf(-1)) }}, + {"float32", `"k":1`, func(e Encoder) { e.AddFloat32("k", 1.0) }}, + {"float32", `"k":10000000000`, func(e Encoder) { e.AddFloat32("k", 1e10) }}, + {"float32", `"k":"NaN"`, func(e Encoder) { e.AddFloat32("k", float32(math.NaN())) }}, + {"float32", `"k":"+Inf"`, func(e Encoder) { e.AddFloat32("k", float32(math.Inf(1))) }}, + {"float32", `"k":"-Inf"`, func(e Encoder) { e.AddFloat32("k", float32(math.Inf(-1))) }}, + {"int", `"k":42`, func(e Encoder) { e.AddInt("k", 42) }}, + {"int64", `"k":42`, func(e Encoder) { e.AddInt64("k", 42) }}, + {"int32", `"k":42`, func(e Encoder) { e.AddInt32("k", 42) }}, + {"int16", `"k":42`, func(e Encoder) { e.AddInt16("k", 42) }}, + {"int8", `"k":42`, func(e Encoder) { e.AddInt8("k", 42) }}, + {"string", `"k":"v\\"`, func(e Encoder) { e.AddString(`k`, `v\`) }}, + {"string", `"k":"v"`, func(e Encoder) { e.AddString("k", "v") }}, + {"string", `"k":""`, func(e Encoder) { e.AddString("k", "") }}, + {"time", `"k":1`, func(e Encoder) { e.AddTime("k", time.Unix(1, 0)) }}, + {"uint", `"k":42`, func(e Encoder) { e.AddUint("k", 42) }}, + {"uint64", `"k":42`, func(e Encoder) { e.AddUint64("k", 42) }}, + {"uint32", `"k":42`, func(e Encoder) { e.AddUint32("k", 42) }}, + {"uint16", `"k":42`, func(e Encoder) { e.AddUint16("k", 42) }}, + {"uint8", `"k":42`, func(e Encoder) { e.AddUint8("k", 42) }}, + {"uintptr", `"k":42`, func(e Encoder) { e.AddUintptr("k", 42) }}, + { + desc: "object (success)", + expected: `"k":{"loggable":"yes"}`, + f: func(e Encoder) { + assert.NoError(t, e.AddObject("k", loggable{true}), "Unexpected error calling MarshalLogObject.") + }, + }, + { + desc: "object (error)", + expected: `"k":{}`, + f: func(e Encoder) { + assert.Error(t, e.AddObject("k", loggable{false}), "Expected an error calling MarshalLogObject.") + }, + }, + { + desc: "object (with nested array)", + expected: `"turducken":{"ducks":[{"in":"chicken"},{"in":"chicken"}]}`, + f: func(e Encoder) { + assert.NoError( + t, + e.AddObject("turducken", turducken{}), + "Unexpected error calling MarshalLogObject with nested ObjectMarshalers and ArrayMarshalers.", + ) + }, + }, + { + desc: "array (with nested object)", + expected: `"turduckens":[{"ducks":[{"in":"chicken"},{"in":"chicken"}]},{"ducks":[{"in":"chicken"},{"in":"chicken"}]}]`, + f: func(e Encoder) { + assert.NoError( + t, + e.AddArray("turduckens", turduckens(2)), + "Unexpected error calling MarshalLogObject with nested ObjectMarshalers and ArrayMarshalers.", + ) + }, + }, + { + desc: "array (success)", + expected: `"k":[true]`, + f: func(e Encoder) { + assert.NoError(t, e.AddArray(`k`, loggable{true}), "Unexpected error calling MarshalLogArray.") + }, + }, + { + desc: "array (error)", + expected: `"k":[]`, + f: func(e Encoder) { + assert.Error(t, e.AddArray("k", loggable{false}), "Expected an error calling MarshalLogArray.") + }, + }, + { + desc: "reflect (success)", + expected: `"k":{"loggable":"yes"}`, + f: func(e Encoder) { + assert.NoError(t, e.AddReflected("k", map[string]string{"loggable": "yes"}), "Unexpected error JSON-serializing a map.") + }, + }, + { + desc: "reflect (failure)", + expected: "", + f: func(e Encoder) { + assert.Error(t, e.AddReflected("k", noJSON{}), "Unexpected success JSON-serializing a noJSON.") + }, + }, + { + desc: "namespace", + // EncodeEntry is responsible for closing all open namespaces. + expected: `"outermost":{"outer":{"foo":1,"inner":{"foo":2,"innermost":{`, + f: func(e Encoder) { + e.OpenNamespace("outermost") + e.OpenNamespace("outer") + e.AddInt("foo", 1) + e.OpenNamespace("inner") + e.AddInt("foo", 2) + e.OpenNamespace("innermost") + }, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + assertOutput(t, tt.expected, tt.f) + }) + } +} + +func TestJSONEncoderArrays(t *testing.T) { + tests := []struct { + desc string + expected string // expect f to be called twice + f func(ArrayEncoder) + }{ + {"bool", `[true,true]`, func(e ArrayEncoder) { e.AppendBool(true) }}, + {"byteString", `["k","k"]`, func(e ArrayEncoder) { e.AppendByteString([]byte("k")) }}, + {"byteString", `["k\\","k\\"]`, func(e ArrayEncoder) { e.AppendByteString([]byte(`k\`)) }}, + {"complex128", `["1+2i","1+2i"]`, func(e ArrayEncoder) { e.AppendComplex128(1 + 2i) }}, + {"complex64", `["1+2i","1+2i"]`, func(e ArrayEncoder) { e.AppendComplex64(1 + 2i) }}, + {"durations", `[0.000000002,0.000000002]`, func(e ArrayEncoder) { e.AppendDuration(2) }}, + {"float64", `[3.14,3.14]`, func(e ArrayEncoder) { e.AppendFloat64(3.14) }}, + {"float32", `[3.14,3.14]`, func(e ArrayEncoder) { e.AppendFloat32(3.14) }}, + {"int", `[42,42]`, func(e ArrayEncoder) { e.AppendInt(42) }}, + {"int64", `[42,42]`, func(e ArrayEncoder) { e.AppendInt64(42) }}, + {"int32", `[42,42]`, func(e ArrayEncoder) { e.AppendInt32(42) }}, + {"int16", `[42,42]`, func(e ArrayEncoder) { e.AppendInt16(42) }}, + {"int8", `[42,42]`, func(e ArrayEncoder) { e.AppendInt8(42) }}, + {"string", `["k","k"]`, func(e ArrayEncoder) { e.AppendString("k") }}, + {"string", `["k\\","k\\"]`, func(e ArrayEncoder) { e.AppendString(`k\`) }}, + {"times", `[1,1]`, func(e ArrayEncoder) { e.AppendTime(time.Unix(1, 0)) }}, + {"uint", `[42,42]`, func(e ArrayEncoder) { e.AppendUint(42) }}, + {"uint64", `[42,42]`, func(e ArrayEncoder) { e.AppendUint64(42) }}, + {"uint32", `[42,42]`, func(e ArrayEncoder) { e.AppendUint32(42) }}, + {"uint16", `[42,42]`, func(e ArrayEncoder) { e.AppendUint16(42) }}, + {"uint8", `[42,42]`, func(e ArrayEncoder) { e.AppendUint8(42) }}, + {"uintptr", `[42,42]`, func(e ArrayEncoder) { e.AppendUintptr(42) }}, + { + desc: "arrays (success)", + expected: `[[true],[true]]`, + f: func(arr ArrayEncoder) { + assert.NoError(t, arr.AppendArray(ArrayMarshalerFunc(func(inner ArrayEncoder) error { + inner.AppendBool(true) + return nil + })), "Unexpected error appending an array.") + }, + }, + { + desc: "arrays (error)", + expected: `[[true],[true]]`, + f: func(arr ArrayEncoder) { + assert.Error(t, arr.AppendArray(ArrayMarshalerFunc(func(inner ArrayEncoder) error { + inner.AppendBool(true) + return errors.New("fail") + })), "Expected an error appending an array.") + }, + }, + { + desc: "objects (success)", + expected: `[{"loggable":"yes"},{"loggable":"yes"}]`, + f: func(arr ArrayEncoder) { + assert.NoError(t, arr.AppendObject(loggable{true}), "Unexpected error appending an object.") + }, + }, + { + desc: "objects (error)", + expected: `[{},{}]`, + f: func(arr ArrayEncoder) { + assert.Error(t, arr.AppendObject(loggable{false}), "Expected an error appending an object.") + }, + }, + { + desc: "reflect (success)", + expected: `[{"foo":5},{"foo":5}]`, + f: func(arr ArrayEncoder) { + assert.NoError( + t, + arr.AppendReflected(map[string]int{"foo": 5}), + "Unexpected an error appending an object with reflection.", + ) + }, + }, + { + desc: "reflect (error)", + expected: `[]`, + f: func(arr ArrayEncoder) { + assert.Error( + t, + arr.AppendReflected(noJSON{}), + "Unexpected an error appending an object with reflection.", + ) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + f := func(enc Encoder) error { + return enc.AddArray("array", ArrayMarshalerFunc(func(arr ArrayEncoder) error { + tt.f(arr) + tt.f(arr) + return nil + })) + } + assertOutput(t, `"array":`+tt.expected, func(enc Encoder) { + err := f(enc) + assert.NoError(t, err, "Unexpected error adding array to JSON encoder.") + }) + }) + } +} + +func assertJSON(t *testing.T, expected string, enc *jsonEncoder) { + assert.Equal(t, expected, enc.buf.String(), "Encoded JSON didn't match expectations.") +} + +func assertOutput(t testing.TB, expected string, f func(Encoder)) { + enc := &jsonEncoder{buf: bufferpool.Get(), EncoderConfig: &EncoderConfig{ + EncodeTime: EpochTimeEncoder, + EncodeDuration: SecondsDurationEncoder, + }} + f(enc) + assert.Equal(t, expected, enc.buf.String(), "Unexpected encoder output after adding.") + + enc.truncate() + enc.AddString("foo", "bar") + f(enc) + expectedPrefix := `"foo":"bar"` + if expected != "" { + // If we expect output, it should be comma-separated from the previous + // field. + expectedPrefix += "," + } + assert.Equal(t, expectedPrefix+expected, enc.buf.String(), "Unexpected encoder output after adding as a second field.") +} + +// Nested Array- and ObjectMarshalers. +type turducken struct{} + +func (t turducken) MarshalLogObject(enc ObjectEncoder) error { + return enc.AddArray("ducks", ArrayMarshalerFunc(func(arr ArrayEncoder) error { + for i := 0; i < 2; i++ { + arr.AppendObject(ObjectMarshalerFunc(func(inner ObjectEncoder) error { + inner.AddString("in", "chicken") + return nil + })) + } + return nil + })) +} + +type turduckens int + +func (t turduckens) MarshalLogArray(enc ArrayEncoder) error { + var err error + tur := turducken{} + for i := 0; i < int(t); i++ { + err = multierr.Append(err, enc.AppendObject(tur)) + } + return err +} + +type loggable struct{ bool } + +func (l loggable) MarshalLogObject(enc ObjectEncoder) error { + if !l.bool { + return errors.New("can't marshal") + } + enc.AddString("loggable", "yes") + return nil +} + +func (l loggable) MarshalLogArray(enc ArrayEncoder) error { + if !l.bool { + return errors.New("can't marshal") + } + enc.AppendBool(true) + return nil +} + +type noJSON struct{} + +func (nj noJSON) MarshalJSON() ([]byte, error) { + return nil, errors.New("no") +} + +func zapEncode(encode func(*jsonEncoder, string)) func(s string) []byte { + return func(s string) []byte { + enc := &jsonEncoder{buf: bufferpool.Get()} + // Escape and quote a string using our encoder. + var ret []byte + encode(enc, s) + ret = make([]byte, 0, enc.buf.Len()+2) + ret = append(ret, '"') + ret = append(ret, enc.buf.Bytes()...) + ret = append(ret, '"') + return ret + } +} + +func roundTripsCorrectly(encode func(string) []byte, original string) bool { + // Encode using our encoder, decode using the standard library, and assert + // that we haven't lost any information. + encoded := encode(original) + + var decoded string + err := json.Unmarshal(encoded, &decoded) + if err != nil { + return false + } + return original == decoded +} + +func roundTripsCorrectlyString(original string) bool { + return roundTripsCorrectly(zapEncode((*jsonEncoder).safeAddString), original) +} + +func roundTripsCorrectlyByteString(original string) bool { + return roundTripsCorrectly( + zapEncode(func(enc *jsonEncoder, s string) { + enc.safeAddByteString([]byte(s)) + }), + original) +} + +type ASCII string + +func (s ASCII) Generate(r *rand.Rand, size int) reflect.Value { + bs := make([]byte, size) + for i := range bs { + bs[i] = byte(r.Intn(128)) + } + a := ASCII(bs) + return reflect.ValueOf(a) +} + +func asciiRoundTripsCorrectlyString(s ASCII) bool { + return roundTripsCorrectlyString(string(s)) +} + +func asciiRoundTripsCorrectlyByteString(s ASCII) bool { + return roundTripsCorrectlyByteString(string(s)) +} + +func TestJSONQuick(t *testing.T) { + check := func(f interface{}) { + err := quick.Check(f, &quick.Config{MaxCountScale: 100.0}) + assert.NoError(t, err) + } + // Test the full range of UTF-8 strings. + check(roundTripsCorrectlyString) + check(roundTripsCorrectlyByteString) + + // Focus on ASCII strings. + check(asciiRoundTripsCorrectlyString) + check(asciiRoundTripsCorrectlyByteString) +} diff --git a/vendor/go.uber.org/zap/zapcore/json_encoder_test.go b/vendor/go.uber.org/zap/zapcore/json_encoder_test.go new file mode 100644 index 000000000..31e0852df --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/json_encoder_test.go @@ -0,0 +1,122 @@ +// Copyright (c) 2018 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +// TestJSONEncodeEntry is an more "integrated" test that makes it easier to get +// coverage on the json encoder (e.g. putJSONEncoder, let alone EncodeEntry +// itself) than the tests in json_encoder_impl_test.go; it needs to be in the +// zapcore_test package, so that it can import the toplevel zap package for +// field constructor convenience. +func TestJSONEncodeEntry(t *testing.T) { + type bar struct { + Key string `json:"key"` + Val float64 `json:"val"` + } + + type foo struct { + A string `json:"aee"` + B int `json:"bee"` + C float64 `json:"cee"` + D []bar `json:"dee"` + } + + tests := []struct { + desc string + expected string + ent zapcore.Entry + fields []zapcore.Field + }{ + { + desc: "info entry with some fields", + expected: `{ + "L": "info", + "T": "2018-06-19T16:33:42.000Z", + "N": "bob", + "M": "lob law", + "so": "passes", + "answer": 42, + "common_pie": 3.14, + "such": { + "aee": "lol", + "bee": 123, + "cee": 0.9999, + "dee": [ + {"key": "pi", "val": 3.141592653589793}, + {"key": "tau", "val": 6.283185307179586} + ] + } + }`, + ent: zapcore.Entry{ + Level: zapcore.InfoLevel, + Time: time.Date(2018, 6, 19, 16, 33, 42, 99, time.UTC), + LoggerName: "bob", + Message: "lob law", + }, + fields: []zapcore.Field{ + zap.String("so", "passes"), + zap.Int("answer", 42), + zap.Float64("common_pie", 3.14), + zap.Reflect("such", foo{ + A: "lol", + B: 123, + C: 0.9999, + D: []bar{ + {"pi", 3.141592653589793}, + {"tau", 6.283185307179586}, + }, + }), + }, + }, + } + + enc := zapcore.NewJSONEncoder(zapcore.EncoderConfig{ + MessageKey: "M", + LevelKey: "L", + TimeKey: "T", + NameKey: "N", + CallerKey: "C", + StacktraceKey: "S", + EncodeLevel: zapcore.LowercaseLevelEncoder, + EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.SecondsDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, + }) + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + buf, err := enc.EncodeEntry(tt.ent, tt.fields) + if assert.NoError(t, err, "Unexpected JSON encoding error.") { + assert.JSONEq(t, tt.expected, buf.String(), "Incorrect encoded JSON entry.") + } + buf.Free() + }) + } +} diff --git a/vendor/go.uber.org/zap/zapcore/level.go b/vendor/go.uber.org/zap/zapcore/level.go new file mode 100644 index 000000000..e575c9f43 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/level.go @@ -0,0 +1,175 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "bytes" + "errors" + "fmt" +) + +var errUnmarshalNilLevel = errors.New("can't unmarshal a nil *Level") + +// A Level is a logging priority. Higher levels are more important. +type Level int8 + +const ( + // DebugLevel logs are typically voluminous, and are usually disabled in + // production. + DebugLevel Level = iota - 1 + // InfoLevel is the default logging priority. + InfoLevel + // WarnLevel logs are more important than Info, but don't need individual + // human review. + WarnLevel + // ErrorLevel logs are high-priority. If an application is running smoothly, + // it shouldn't generate any error-level logs. + ErrorLevel + // DPanicLevel logs are particularly important errors. In development the + // logger panics after writing the message. + DPanicLevel + // PanicLevel logs a message, then panics. + PanicLevel + // FatalLevel logs a message, then calls os.Exit(1). + FatalLevel + + _minLevel = DebugLevel + _maxLevel = FatalLevel +) + +// String returns a lower-case ASCII representation of the log level. +func (l Level) String() string { + switch l { + case DebugLevel: + return "debug" + case InfoLevel: + return "info" + case WarnLevel: + return "warn" + case ErrorLevel: + return "error" + case DPanicLevel: + return "dpanic" + case PanicLevel: + return "panic" + case FatalLevel: + return "fatal" + default: + return fmt.Sprintf("Level(%d)", l) + } +} + +// CapitalString returns an all-caps ASCII representation of the log level. +func (l Level) CapitalString() string { + // Printing levels in all-caps is common enough that we should export this + // functionality. + switch l { + case DebugLevel: + return "DEBUG" + case InfoLevel: + return "INFO" + case WarnLevel: + return "WARN" + case ErrorLevel: + return "ERROR" + case DPanicLevel: + return "DPANIC" + case PanicLevel: + return "PANIC" + case FatalLevel: + return "FATAL" + default: + return fmt.Sprintf("LEVEL(%d)", l) + } +} + +// MarshalText marshals the Level to text. Note that the text representation +// drops the -Level suffix (see example). +func (l Level) MarshalText() ([]byte, error) { + return []byte(l.String()), nil +} + +// UnmarshalText unmarshals text to a level. Like MarshalText, UnmarshalText +// expects the text representation of a Level to drop the -Level suffix (see +// example). +// +// In particular, this makes it easy to configure logging levels using YAML, +// TOML, or JSON files. +func (l *Level) UnmarshalText(text []byte) error { + if l == nil { + return errUnmarshalNilLevel + } + if !l.unmarshalText(text) && !l.unmarshalText(bytes.ToLower(text)) { + return fmt.Errorf("unrecognized level: %q", text) + } + return nil +} + +func (l *Level) unmarshalText(text []byte) bool { + switch string(text) { + case "debug", "DEBUG": + *l = DebugLevel + case "info", "INFO", "": // make the zero value useful + *l = InfoLevel + case "warn", "WARN": + *l = WarnLevel + case "error", "ERROR": + *l = ErrorLevel + case "dpanic", "DPANIC": + *l = DPanicLevel + case "panic", "PANIC": + *l = PanicLevel + case "fatal", "FATAL": + *l = FatalLevel + default: + return false + } + return true +} + +// Set sets the level for the flag.Value interface. +func (l *Level) Set(s string) error { + return l.UnmarshalText([]byte(s)) +} + +// Get gets the level for the flag.Getter interface. +func (l *Level) Get() interface{} { + return *l +} + +// Enabled returns true if the given level is at or above this level. +func (l Level) Enabled(lvl Level) bool { + return lvl >= l +} + +// LevelEnabler decides whether a given logging level is enabled when logging a +// message. +// +// Enablers are intended to be used to implement deterministic filters; +// concerns like sampling are better implemented as a Core. +// +// Each concrete Level value implements a static LevelEnabler which returns +// true for itself and all higher logging levels. For example WarnLevel.Enabled() +// will return true for WarnLevel, ErrorLevel, DPanicLevel, PanicLevel, and +// FatalLevel, but return false for InfoLevel and DebugLevel. +type LevelEnabler interface { + Enabled(Level) bool +} diff --git a/vendor/go.uber.org/zap/zapcore/level_strings.go b/vendor/go.uber.org/zap/zapcore/level_strings.go new file mode 100644 index 000000000..7af8dadcb --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/level_strings.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import "go.uber.org/zap/internal/color" + +var ( + _levelToColor = map[Level]color.Color{ + DebugLevel: color.Magenta, + InfoLevel: color.Blue, + WarnLevel: color.Yellow, + ErrorLevel: color.Red, + DPanicLevel: color.Red, + PanicLevel: color.Red, + FatalLevel: color.Red, + } + _unknownLevelColor = color.Red + + _levelToLowercaseColorString = make(map[Level]string, len(_levelToColor)) + _levelToCapitalColorString = make(map[Level]string, len(_levelToColor)) +) + +func init() { + for level, color := range _levelToColor { + _levelToLowercaseColorString[level] = color.Add(level.String()) + _levelToCapitalColorString[level] = color.Add(level.CapitalString()) + } +} diff --git a/vendor/go.uber.org/zap/zapcore/level_strings_test.go b/vendor/go.uber.org/zap/zapcore/level_strings_test.go new file mode 100644 index 000000000..14b0bac62 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/level_strings_test.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestAllLevelsCoveredByLevelString(t *testing.T) { + numLevels := int((_maxLevel - _minLevel) + 1) + + isComplete := func(m map[Level]string) bool { + return len(m) == numLevels + } + + assert.True(t, isComplete(_levelToLowercaseColorString), "Colored lowercase strings don't cover all levels.") + assert.True(t, isComplete(_levelToCapitalColorString), "Colored capital strings don't cover all levels.") +} diff --git a/vendor/go.uber.org/zap/zapcore/level_test.go b/vendor/go.uber.org/zap/zapcore/level_test.go new file mode 100644 index 000000000..28b75b37f --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/level_test.go @@ -0,0 +1,177 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "bytes" + "flag" + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestLevelString(t *testing.T) { + tests := map[Level]string{ + DebugLevel: "debug", + InfoLevel: "info", + WarnLevel: "warn", + ErrorLevel: "error", + DPanicLevel: "dpanic", + PanicLevel: "panic", + FatalLevel: "fatal", + Level(-42): "Level(-42)", + } + + for lvl, stringLevel := range tests { + assert.Equal(t, stringLevel, lvl.String(), "Unexpected lowercase level string.") + assert.Equal(t, strings.ToUpper(stringLevel), lvl.CapitalString(), "Unexpected all-caps level string.") + } +} + +func TestLevelText(t *testing.T) { + tests := []struct { + text string + level Level + }{ + {"debug", DebugLevel}, + {"info", InfoLevel}, + {"", InfoLevel}, // make the zero value useful + {"warn", WarnLevel}, + {"error", ErrorLevel}, + {"dpanic", DPanicLevel}, + {"panic", PanicLevel}, + {"fatal", FatalLevel}, + } + for _, tt := range tests { + if tt.text != "" { + lvl := tt.level + marshaled, err := lvl.MarshalText() + assert.NoError(t, err, "Unexpected error marshaling level %v to text.", &lvl) + assert.Equal(t, tt.text, string(marshaled), "Marshaling level %v to text yielded unexpected result.", &lvl) + } + + var unmarshaled Level + err := unmarshaled.UnmarshalText([]byte(tt.text)) + assert.NoError(t, err, `Unexpected error unmarshaling text %q to level.`, tt.text) + assert.Equal(t, tt.level, unmarshaled, `Text %q unmarshaled to an unexpected level.`, tt.text) + } +} + +func TestCapitalLevelsParse(t *testing.T) { + tests := []struct { + text string + level Level + }{ + {"DEBUG", DebugLevel}, + {"INFO", InfoLevel}, + {"WARN", WarnLevel}, + {"ERROR", ErrorLevel}, + {"DPANIC", DPanicLevel}, + {"PANIC", PanicLevel}, + {"FATAL", FatalLevel}, + } + for _, tt := range tests { + var unmarshaled Level + err := unmarshaled.UnmarshalText([]byte(tt.text)) + assert.NoError(t, err, `Unexpected error unmarshaling text %q to level.`, tt.text) + assert.Equal(t, tt.level, unmarshaled, `Text %q unmarshaled to an unexpected level.`, tt.text) + } +} + +func TestWeirdLevelsParse(t *testing.T) { + tests := []struct { + text string + level Level + }{ + // I guess... + {"Debug", DebugLevel}, + {"Info", InfoLevel}, + {"Warn", WarnLevel}, + {"Error", ErrorLevel}, + {"Dpanic", DPanicLevel}, + {"Panic", PanicLevel}, + {"Fatal", FatalLevel}, + + // What even is... + {"DeBuG", DebugLevel}, + {"InFo", InfoLevel}, + {"WaRn", WarnLevel}, + {"ErRor", ErrorLevel}, + {"DpAnIc", DPanicLevel}, + {"PaNiC", PanicLevel}, + {"FaTaL", FatalLevel}, + } + for _, tt := range tests { + var unmarshaled Level + err := unmarshaled.UnmarshalText([]byte(tt.text)) + assert.NoError(t, err, `Unexpected error unmarshaling text %q to level.`, tt.text) + assert.Equal(t, tt.level, unmarshaled, `Text %q unmarshaled to an unexpected level.`, tt.text) + } +} + +func TestLevelNils(t *testing.T) { + var l *Level + + // The String() method will not handle nil level properly. + assert.Panics(t, func() { + assert.Equal(t, "Level(nil)", l.String(), "Unexpected result stringifying nil *Level.") + }, "Level(nil).String() should panic") + + assert.Panics(t, func() { + l.MarshalText() + }, "Expected to panic when marshalling a nil level.") + + err := l.UnmarshalText([]byte("debug")) + assert.Equal(t, errUnmarshalNilLevel, err, "Expected to error unmarshalling into a nil Level.") +} + +func TestLevelUnmarshalUnknownText(t *testing.T) { + var l Level + err := l.UnmarshalText([]byte("foo")) + assert.Contains(t, err.Error(), "unrecognized level", "Expected unmarshaling arbitrary text to fail.") +} + +func TestLevelAsFlagValue(t *testing.T) { + var ( + buf bytes.Buffer + lvl Level + ) + fs := flag.NewFlagSet("levelTest", flag.ContinueOnError) + fs.SetOutput(&buf) + fs.Var(&lvl, "level", "log level") + + for _, expected := range []Level{DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel, PanicLevel, FatalLevel} { + assert.NoError(t, fs.Parse([]string{"-level", expected.String()})) + assert.Equal(t, expected, lvl, "Unexpected level after parsing flag.") + assert.Equal(t, expected, lvl.Get(), "Unexpected output using flag.Getter API.") + assert.Empty(t, buf.String(), "Unexpected error output parsing level flag.") + buf.Reset() + } + + assert.Error(t, fs.Parse([]string{"-level", "nope"})) + assert.Equal( + t, + `invalid value "nope" for flag -level: unrecognized level: "nope"`, + strings.Split(buf.String(), "\n")[0], // second line is help message + "Unexpected error output from invalid flag input.", + ) +} diff --git a/vendor/go.uber.org/zap/zapcore/marshaler.go b/vendor/go.uber.org/zap/zapcore/marshaler.go new file mode 100644 index 000000000..2627a653d --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/marshaler.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +// ObjectMarshaler allows user-defined types to efficiently add themselves to the +// logging context, and to selectively omit information which shouldn't be +// included in logs (e.g., passwords). +type ObjectMarshaler interface { + MarshalLogObject(ObjectEncoder) error +} + +// ObjectMarshalerFunc is a type adapter that turns a function into an +// ObjectMarshaler. +type ObjectMarshalerFunc func(ObjectEncoder) error + +// MarshalLogObject calls the underlying function. +func (f ObjectMarshalerFunc) MarshalLogObject(enc ObjectEncoder) error { + return f(enc) +} + +// ArrayMarshaler allows user-defined types to efficiently add themselves to the +// logging context, and to selectively omit information which shouldn't be +// included in logs (e.g., passwords). +type ArrayMarshaler interface { + MarshalLogArray(ArrayEncoder) error +} + +// ArrayMarshalerFunc is a type adapter that turns a function into an +// ArrayMarshaler. +type ArrayMarshalerFunc func(ArrayEncoder) error + +// MarshalLogArray calls the underlying function. +func (f ArrayMarshalerFunc) MarshalLogArray(enc ArrayEncoder) error { + return f(enc) +} diff --git a/vendor/go.uber.org/zap/zapcore/memory_encoder.go b/vendor/go.uber.org/zap/zapcore/memory_encoder.go new file mode 100644 index 000000000..6ef85b09c --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/memory_encoder.go @@ -0,0 +1,179 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import "time" + +// MapObjectEncoder is an ObjectEncoder backed by a simple +// map[string]interface{}. It's not fast enough for production use, but it's +// helpful in tests. +type MapObjectEncoder struct { + // Fields contains the entire encoded log context. + Fields map[string]interface{} + // cur is a pointer to the namespace we're currently writing to. + cur map[string]interface{} +} + +// NewMapObjectEncoder creates a new map-backed ObjectEncoder. +func NewMapObjectEncoder() *MapObjectEncoder { + m := make(map[string]interface{}) + return &MapObjectEncoder{ + Fields: m, + cur: m, + } +} + +// AddArray implements ObjectEncoder. +func (m *MapObjectEncoder) AddArray(key string, v ArrayMarshaler) error { + arr := &sliceArrayEncoder{elems: make([]interface{}, 0)} + err := v.MarshalLogArray(arr) + m.cur[key] = arr.elems + return err +} + +// AddObject implements ObjectEncoder. +func (m *MapObjectEncoder) AddObject(k string, v ObjectMarshaler) error { + newMap := NewMapObjectEncoder() + m.cur[k] = newMap.Fields + return v.MarshalLogObject(newMap) +} + +// AddBinary implements ObjectEncoder. +func (m *MapObjectEncoder) AddBinary(k string, v []byte) { m.cur[k] = v } + +// AddByteString implements ObjectEncoder. +func (m *MapObjectEncoder) AddByteString(k string, v []byte) { m.cur[k] = string(v) } + +// AddBool implements ObjectEncoder. +func (m *MapObjectEncoder) AddBool(k string, v bool) { m.cur[k] = v } + +// AddDuration implements ObjectEncoder. +func (m MapObjectEncoder) AddDuration(k string, v time.Duration) { m.cur[k] = v } + +// AddComplex128 implements ObjectEncoder. +func (m *MapObjectEncoder) AddComplex128(k string, v complex128) { m.cur[k] = v } + +// AddComplex64 implements ObjectEncoder. +func (m *MapObjectEncoder) AddComplex64(k string, v complex64) { m.cur[k] = v } + +// AddFloat64 implements ObjectEncoder. +func (m *MapObjectEncoder) AddFloat64(k string, v float64) { m.cur[k] = v } + +// AddFloat32 implements ObjectEncoder. +func (m *MapObjectEncoder) AddFloat32(k string, v float32) { m.cur[k] = v } + +// AddInt implements ObjectEncoder. +func (m *MapObjectEncoder) AddInt(k string, v int) { m.cur[k] = v } + +// AddInt64 implements ObjectEncoder. +func (m *MapObjectEncoder) AddInt64(k string, v int64) { m.cur[k] = v } + +// AddInt32 implements ObjectEncoder. +func (m *MapObjectEncoder) AddInt32(k string, v int32) { m.cur[k] = v } + +// AddInt16 implements ObjectEncoder. +func (m *MapObjectEncoder) AddInt16(k string, v int16) { m.cur[k] = v } + +// AddInt8 implements ObjectEncoder. +func (m *MapObjectEncoder) AddInt8(k string, v int8) { m.cur[k] = v } + +// AddString implements ObjectEncoder. +func (m *MapObjectEncoder) AddString(k string, v string) { m.cur[k] = v } + +// AddTime implements ObjectEncoder. +func (m MapObjectEncoder) AddTime(k string, v time.Time) { m.cur[k] = v } + +// AddUint implements ObjectEncoder. +func (m *MapObjectEncoder) AddUint(k string, v uint) { m.cur[k] = v } + +// AddUint64 implements ObjectEncoder. +func (m *MapObjectEncoder) AddUint64(k string, v uint64) { m.cur[k] = v } + +// AddUint32 implements ObjectEncoder. +func (m *MapObjectEncoder) AddUint32(k string, v uint32) { m.cur[k] = v } + +// AddUint16 implements ObjectEncoder. +func (m *MapObjectEncoder) AddUint16(k string, v uint16) { m.cur[k] = v } + +// AddUint8 implements ObjectEncoder. +func (m *MapObjectEncoder) AddUint8(k string, v uint8) { m.cur[k] = v } + +// AddUintptr implements ObjectEncoder. +func (m *MapObjectEncoder) AddUintptr(k string, v uintptr) { m.cur[k] = v } + +// AddReflected implements ObjectEncoder. +func (m *MapObjectEncoder) AddReflected(k string, v interface{}) error { + m.cur[k] = v + return nil +} + +// OpenNamespace implements ObjectEncoder. +func (m *MapObjectEncoder) OpenNamespace(k string) { + ns := make(map[string]interface{}) + m.cur[k] = ns + m.cur = ns +} + +// sliceArrayEncoder is an ArrayEncoder backed by a simple []interface{}. Like +// the MapObjectEncoder, it's not designed for production use. +type sliceArrayEncoder struct { + elems []interface{} +} + +func (s *sliceArrayEncoder) AppendArray(v ArrayMarshaler) error { + enc := &sliceArrayEncoder{} + err := v.MarshalLogArray(enc) + s.elems = append(s.elems, enc.elems) + return err +} + +func (s *sliceArrayEncoder) AppendObject(v ObjectMarshaler) error { + m := NewMapObjectEncoder() + err := v.MarshalLogObject(m) + s.elems = append(s.elems, m.Fields) + return err +} + +func (s *sliceArrayEncoder) AppendReflected(v interface{}) error { + s.elems = append(s.elems, v) + return nil +} + +func (s *sliceArrayEncoder) AppendBool(v bool) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendByteString(v []byte) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendComplex128(v complex128) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendComplex64(v complex64) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendDuration(v time.Duration) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendFloat64(v float64) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendFloat32(v float32) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendInt(v int) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendInt64(v int64) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendInt32(v int32) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendInt16(v int16) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendInt8(v int8) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendString(v string) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendTime(v time.Time) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendUint(v uint) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendUint64(v uint64) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendUint32(v uint32) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendUint16(v uint16) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendUint8(v uint8) { s.elems = append(s.elems, v) } +func (s *sliceArrayEncoder) AppendUintptr(v uintptr) { s.elems = append(s.elems, v) } diff --git a/vendor/go.uber.org/zap/zapcore/memory_encoder_test.go b/vendor/go.uber.org/zap/zapcore/memory_encoder_test.go new file mode 100644 index 000000000..5ca9577ae --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/memory_encoder_test.go @@ -0,0 +1,292 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestMapObjectEncoderAdd(t *testing.T) { + // Expected output of a turducken. + wantTurducken := map[string]interface{}{ + "ducks": []interface{}{ + map[string]interface{}{"in": "chicken"}, + map[string]interface{}{"in": "chicken"}, + }, + } + + tests := []struct { + desc string + f func(ObjectEncoder) + expected interface{} + }{ + { + desc: "AddObject", + f: func(e ObjectEncoder) { + assert.NoError(t, e.AddObject("k", loggable{true}), "Expected AddObject to succeed.") + }, + expected: map[string]interface{}{"loggable": "yes"}, + }, + { + desc: "AddObject (nested)", + f: func(e ObjectEncoder) { + assert.NoError(t, e.AddObject("k", turducken{}), "Expected AddObject to succeed.") + }, + expected: wantTurducken, + }, + { + desc: "AddArray", + f: func(e ObjectEncoder) { + assert.NoError(t, e.AddArray("k", ArrayMarshalerFunc(func(arr ArrayEncoder) error { + arr.AppendBool(true) + arr.AppendBool(false) + arr.AppendBool(true) + return nil + })), "Expected AddArray to succeed.") + }, + expected: []interface{}{true, false, true}, + }, + { + desc: "AddArray (nested)", + f: func(e ObjectEncoder) { + assert.NoError(t, e.AddArray("k", turduckens(2)), "Expected AddArray to succeed.") + }, + expected: []interface{}{wantTurducken, wantTurducken}, + }, + { + desc: "AddArray (empty)", + f: func(e ObjectEncoder) { + assert.NoError(t, e.AddArray("k", turduckens(0)), "Expected AddArray to succeed.") + }, + expected: []interface{}{}, + }, + { + desc: "AddBinary", + f: func(e ObjectEncoder) { e.AddBinary("k", []byte("foo")) }, + expected: []byte("foo"), + }, + { + desc: "AddBool", + f: func(e ObjectEncoder) { e.AddBool("k", true) }, + expected: true, + }, + { + desc: "AddComplex128", + f: func(e ObjectEncoder) { e.AddComplex128("k", 1+2i) }, + expected: 1 + 2i, + }, + { + desc: "AddComplex64", + f: func(e ObjectEncoder) { e.AddComplex64("k", 1+2i) }, + expected: complex64(1 + 2i), + }, + { + desc: "AddDuration", + f: func(e ObjectEncoder) { e.AddDuration("k", time.Millisecond) }, + expected: time.Millisecond, + }, + { + desc: "AddFloat64", + f: func(e ObjectEncoder) { e.AddFloat64("k", 3.14) }, + expected: 3.14, + }, + { + desc: "AddFloat32", + f: func(e ObjectEncoder) { e.AddFloat32("k", 3.14) }, + expected: float32(3.14), + }, + { + desc: "AddInt", + f: func(e ObjectEncoder) { e.AddInt("k", 42) }, + expected: 42, + }, + { + desc: "AddInt64", + f: func(e ObjectEncoder) { e.AddInt64("k", 42) }, + expected: int64(42), + }, + { + desc: "AddInt32", + f: func(e ObjectEncoder) { e.AddInt32("k", 42) }, + expected: int32(42), + }, + { + desc: "AddInt16", + f: func(e ObjectEncoder) { e.AddInt16("k", 42) }, + expected: int16(42), + }, + { + desc: "AddInt8", + f: func(e ObjectEncoder) { e.AddInt8("k", 42) }, + expected: int8(42), + }, + { + desc: "AddString", + f: func(e ObjectEncoder) { e.AddString("k", "v") }, + expected: "v", + }, + { + desc: "AddTime", + f: func(e ObjectEncoder) { e.AddTime("k", time.Unix(0, 100)) }, + expected: time.Unix(0, 100), + }, + { + desc: "AddUint", + f: func(e ObjectEncoder) { e.AddUint("k", 42) }, + expected: uint(42), + }, + { + desc: "AddUint64", + f: func(e ObjectEncoder) { e.AddUint64("k", 42) }, + expected: uint64(42), + }, + { + desc: "AddUint32", + f: func(e ObjectEncoder) { e.AddUint32("k", 42) }, + expected: uint32(42), + }, + { + desc: "AddUint16", + f: func(e ObjectEncoder) { e.AddUint16("k", 42) }, + expected: uint16(42), + }, + { + desc: "AddUint8", + f: func(e ObjectEncoder) { e.AddUint8("k", 42) }, + expected: uint8(42), + }, + { + desc: "AddUintptr", + f: func(e ObjectEncoder) { e.AddUintptr("k", 42) }, + expected: uintptr(42), + }, + { + desc: "AddReflected", + f: func(e ObjectEncoder) { + assert.NoError(t, e.AddReflected("k", map[string]interface{}{"foo": 5}), "Expected AddReflected to succeed.") + }, + expected: map[string]interface{}{"foo": 5}, + }, + { + desc: "OpenNamespace", + f: func(e ObjectEncoder) { + e.OpenNamespace("k") + e.AddInt("foo", 1) + e.OpenNamespace("middle") + e.AddInt("foo", 2) + e.OpenNamespace("inner") + e.AddInt("foo", 3) + }, + expected: map[string]interface{}{ + "foo": 1, + "middle": map[string]interface{}{ + "foo": 2, + "inner": map[string]interface{}{ + "foo": 3, + }, + }, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + enc := NewMapObjectEncoder() + tt.f(enc) + assert.Equal(t, tt.expected, enc.Fields["k"], "Unexpected encoder output.") + }) + } +} +func TestSliceArrayEncoderAppend(t *testing.T) { + tests := []struct { + desc string + f func(ArrayEncoder) + expected interface{} + }{ + // AppendObject and AppendArray are covered by the AddObject (nested) and + // AddArray (nested) cases above. + {"AppendBool", func(e ArrayEncoder) { e.AppendBool(true) }, true}, + {"AppendComplex128", func(e ArrayEncoder) { e.AppendComplex128(1 + 2i) }, 1 + 2i}, + {"AppendComplex64", func(e ArrayEncoder) { e.AppendComplex64(1 + 2i) }, complex64(1 + 2i)}, + {"AppendDuration", func(e ArrayEncoder) { e.AppendDuration(time.Second) }, time.Second}, + {"AppendFloat64", func(e ArrayEncoder) { e.AppendFloat64(3.14) }, 3.14}, + {"AppendFloat32", func(e ArrayEncoder) { e.AppendFloat32(3.14) }, float32(3.14)}, + {"AppendInt", func(e ArrayEncoder) { e.AppendInt(42) }, 42}, + {"AppendInt64", func(e ArrayEncoder) { e.AppendInt64(42) }, int64(42)}, + {"AppendInt32", func(e ArrayEncoder) { e.AppendInt32(42) }, int32(42)}, + {"AppendInt16", func(e ArrayEncoder) { e.AppendInt16(42) }, int16(42)}, + {"AppendInt8", func(e ArrayEncoder) { e.AppendInt8(42) }, int8(42)}, + {"AppendString", func(e ArrayEncoder) { e.AppendString("foo") }, "foo"}, + {"AppendTime", func(e ArrayEncoder) { e.AppendTime(time.Unix(0, 100)) }, time.Unix(0, 100)}, + {"AppendUint", func(e ArrayEncoder) { e.AppendUint(42) }, uint(42)}, + {"AppendUint64", func(e ArrayEncoder) { e.AppendUint64(42) }, uint64(42)}, + {"AppendUint32", func(e ArrayEncoder) { e.AppendUint32(42) }, uint32(42)}, + {"AppendUint16", func(e ArrayEncoder) { e.AppendUint16(42) }, uint16(42)}, + {"AppendUint8", func(e ArrayEncoder) { e.AppendUint8(42) }, uint8(42)}, + {"AppendUintptr", func(e ArrayEncoder) { e.AppendUintptr(42) }, uintptr(42)}, + { + desc: "AppendReflected", + f: func(e ArrayEncoder) { e.AppendReflected(map[string]interface{}{"foo": 5}) }, + expected: map[string]interface{}{"foo": 5}, + }, + { + desc: "AppendArray (arrays of arrays)", + f: func(e ArrayEncoder) { + e.AppendArray(ArrayMarshalerFunc(func(inner ArrayEncoder) error { + inner.AppendBool(true) + inner.AppendBool(false) + return nil + })) + }, + expected: []interface{}{true, false}, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + enc := NewMapObjectEncoder() + assert.NoError(t, enc.AddArray("k", ArrayMarshalerFunc(func(arr ArrayEncoder) error { + tt.f(arr) + tt.f(arr) + return nil + })), "Expected AddArray to succeed.") + + arr, ok := enc.Fields["k"].([]interface{}) + require.True(t, ok, "Test case %s didn't encode an array.", tt.desc) + assert.Equal(t, []interface{}{tt.expected, tt.expected}, arr, "Unexpected encoder output.") + }) + } +} + +func TestMapObjectEncoderReflectionFailures(t *testing.T) { + enc := NewMapObjectEncoder() + assert.Error(t, enc.AddObject("object", loggable{false}), "Expected AddObject to fail.") + assert.Equal( + t, + map[string]interface{}{"object": map[string]interface{}{}}, + enc.Fields, + "Expected encoder to use empty values on errors.", + ) +} diff --git a/vendor/go.uber.org/zap/zapcore/sampler.go b/vendor/go.uber.org/zap/zapcore/sampler.go new file mode 100644 index 000000000..e31641863 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/sampler.go @@ -0,0 +1,134 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "time" + + "go.uber.org/atomic" +) + +const ( + _numLevels = _maxLevel - _minLevel + 1 + _countersPerLevel = 4096 +) + +type counter struct { + resetAt atomic.Int64 + counter atomic.Uint64 +} + +type counters [_numLevels][_countersPerLevel]counter + +func newCounters() *counters { + return &counters{} +} + +func (cs *counters) get(lvl Level, key string) *counter { + i := lvl - _minLevel + j := fnv32a(key) % _countersPerLevel + return &cs[i][j] +} + +// fnv32a, adapted from "hash/fnv", but without a []byte(string) alloc +func fnv32a(s string) uint32 { + const ( + offset32 = 2166136261 + prime32 = 16777619 + ) + hash := uint32(offset32) + for i := 0; i < len(s); i++ { + hash ^= uint32(s[i]) + hash *= prime32 + } + return hash +} + +func (c *counter) IncCheckReset(t time.Time, tick time.Duration) uint64 { + tn := t.UnixNano() + resetAfter := c.resetAt.Load() + if resetAfter > tn { + return c.counter.Inc() + } + + c.counter.Store(1) + + newResetAfter := tn + tick.Nanoseconds() + if !c.resetAt.CAS(resetAfter, newResetAfter) { + // We raced with another goroutine trying to reset, and it also reset + // the counter to 1, so we need to reincrement the counter. + return c.counter.Inc() + } + + return 1 +} + +type sampler struct { + Core + + counts *counters + tick time.Duration + first, thereafter uint64 +} + +// NewSampler creates a Core that samples incoming entries, which caps the CPU +// and I/O load of logging while attempting to preserve a representative subset +// of your logs. +// +// Zap samples by logging the first N entries with a given level and message +// each tick. If more Entries with the same level and message are seen during +// the same interval, every Mth message is logged and the rest are dropped. +// +// Keep in mind that zap's sampling implementation is optimized for speed over +// absolute precision; under load, each tick may be slightly over- or +// under-sampled. +func NewSampler(core Core, tick time.Duration, first, thereafter int) Core { + return &sampler{ + Core: core, + tick: tick, + counts: newCounters(), + first: uint64(first), + thereafter: uint64(thereafter), + } +} + +func (s *sampler) With(fields []Field) Core { + return &sampler{ + Core: s.Core.With(fields), + tick: s.tick, + counts: s.counts, + first: s.first, + thereafter: s.thereafter, + } +} + +func (s *sampler) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { + if !s.Enabled(ent.Level) { + return ce + } + + counter := s.counts.get(ent.Level, ent.Message) + n := counter.IncCheckReset(ent.Time, s.tick) + if n > s.first && (n-s.first)%s.thereafter != 0 { + return ce + } + return s.Core.Check(ent, ce) +} diff --git a/vendor/go.uber.org/zap/zapcore/sampler_bench_test.go b/vendor/go.uber.org/zap/zapcore/sampler_bench_test.go new file mode 100644 index 000000000..af2e89782 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/sampler_bench_test.go @@ -0,0 +1,230 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "fmt" + "testing" + "time" + + "go.uber.org/zap/internal/ztest" + . "go.uber.org/zap/zapcore" +) + +var counterTestCases = [][]string{ + // some stuff I made up + { + "foo", + "bar", + "baz", + "alpha", + "bravo", + "charlie", + "delta", + }, + + // shuf -n50 /usr/share/dict/words + { + "unbracing", + "stereotomy", + "supranervian", + "moaning", + "exchangeability", + "gunyang", + "sulcation", + "dariole", + "archheresy", + "synchronistically", + "clips", + "unsanctioned", + "Argoan", + "liparomphalus", + "layship", + "Fregatae", + "microzoology", + "glaciaria", + "Frugivora", + "patterist", + "Grossulariaceae", + "lithotint", + "bargander", + "opisthographical", + "cacography", + "chalkstone", + "nonsubstantialism", + "sardonicism", + "calamiform", + "lodginghouse", + "predisposedly", + "topotypic", + "broideress", + "outrange", + "gingivolabial", + "monoazo", + "sparlike", + "concameration", + "untoothed", + "Camorrism", + "reissuer", + "soap", + "palaiotype", + "countercharm", + "yellowbird", + "palterly", + "writinger", + "boatfalls", + "tuglike", + "underbitten", + }, + + // shuf -n100 /usr/share/dict/words + { + "rooty", + "malcultivation", + "degrade", + "pseudoindependent", + "stillatory", + "antiseptize", + "protoamphibian", + "antiar", + "Esther", + "pseudelminth", + "superfluitance", + "teallite", + "disunity", + "spirignathous", + "vergency", + "myliobatid", + "inosic", + "overabstemious", + "patriarchally", + "foreimagine", + "coetaneity", + "hemimellitene", + "hyperspatial", + "aulophyte", + "electropoion", + "antitrope", + "Amarantus", + "smaltine", + "lighthead", + "syntonically", + "incubous", + "versation", + "cirsophthalmia", + "Ulidian", + "homoeography", + "Velella", + "Hecatean", + "serfage", + "Spermaphyta", + "palatoplasty", + "electroextraction", + "aconite", + "avirulence", + "initiator", + "besmear", + "unrecognizably", + "euphoniousness", + "balbuties", + "pascuage", + "quebracho", + "Yakala", + "auriform", + "sevenbark", + "superorganism", + "telesterion", + "ensand", + "nagaika", + "anisuria", + "etching", + "soundingly", + "grumpish", + "drillmaster", + "perfumed", + "dealkylate", + "anthracitiferous", + "predefiance", + "sulphoxylate", + "freeness", + "untucking", + "misworshiper", + "Nestorianize", + "nonegoistical", + "construe", + "upstroke", + "teated", + "nasolachrymal", + "Mastodontidae", + "gallows", + "radioluminescent", + "uncourtierlike", + "phasmatrope", + "Clunisian", + "drainage", + "sootless", + "brachyfacial", + "antiheroism", + "irreligionize", + "ked", + "unfact", + "nonprofessed", + "milady", + "conjecture", + "Arctomys", + "guapilla", + "Sassenach", + "emmetrope", + "rosewort", + "raphidiferous", + "pooh", + "Tyndallize", + }, +} + +func BenchmarkSampler_Check(b *testing.B) { + for _, keys := range counterTestCases { + b.Run(fmt.Sprintf("%v keys", len(keys)), func(b *testing.B) { + fac := NewSampler( + NewCore( + NewJSONEncoder(testEncoderConfig()), + &ztest.Discarder{}, + DebugLevel, + ), + time.Millisecond, 1, 1000) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + i := 0 + for pb.Next() { + ent := Entry{ + Level: DebugLevel + Level(i%4), + Message: keys[i], + } + _ = fac.Check(ent, nil) + i++ + if n := len(keys); i >= n { + i -= n + } + } + }) + }) + } +} diff --git a/vendor/go.uber.org/zap/zapcore/sampler_test.go b/vendor/go.uber.org/zap/zapcore/sampler_test.go new file mode 100644 index 000000000..9ba278b0b --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/sampler_test.go @@ -0,0 +1,225 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "fmt" + "sync" + "testing" + "time" + + "go.uber.org/atomic" + "go.uber.org/zap/internal/ztest" + . "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest/observer" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func fakeSampler(lvl LevelEnabler, tick time.Duration, first, thereafter int) (Core, *observer.ObservedLogs) { + core, logs := observer.New(lvl) + core = NewSampler(core, tick, first, thereafter) + return core, logs +} + +func assertSequence(t testing.TB, logs []observer.LoggedEntry, lvl Level, seq ...int64) { + seen := make([]int64, len(logs)) + for i, entry := range logs { + require.Equal(t, "", entry.Message, "Message wasn't created by writeSequence.") + require.Equal(t, 1, len(entry.Context), "Unexpected number of fields.") + require.Equal(t, lvl, entry.Level, "Unexpected level.") + f := entry.Context[0] + require.Equal(t, "iter", f.Key, "Unexpected field key.") + require.Equal(t, Int64Type, f.Type, "Unexpected field type") + seen[i] = f.Integer + } + assert.Equal(t, seq, seen, "Unexpected sequence logged at level %v.", lvl) +} + +func writeSequence(core Core, n int, lvl Level) { + // All tests using writeSequence verify that counters are shared between + // parent and child cores. + core = core.With([]Field{makeInt64Field("iter", n)}) + if ce := core.Check(Entry{Level: lvl, Time: time.Now()}, nil); ce != nil { + ce.Write() + } +} + +func TestSampler(t *testing.T) { + for _, lvl := range []Level{DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel, PanicLevel, FatalLevel} { + sampler, logs := fakeSampler(DebugLevel, time.Minute, 2, 3) + + // Ensure that counts aren't shared between levels. + probeLevel := DebugLevel + if lvl == DebugLevel { + probeLevel = InfoLevel + } + for i := 0; i < 10; i++ { + writeSequence(sampler, 1, probeLevel) + } + // Clear any output. + logs.TakeAll() + + for i := 1; i < 10; i++ { + writeSequence(sampler, i, lvl) + } + assertSequence(t, logs.TakeAll(), lvl, 1, 2, 5, 8) + } +} + +func TestSamplerDisabledLevels(t *testing.T) { + sampler, logs := fakeSampler(InfoLevel, time.Minute, 1, 100) + + // Shouldn't be counted, because debug logging isn't enabled. + writeSequence(sampler, 1, DebugLevel) + writeSequence(sampler, 2, InfoLevel) + assertSequence(t, logs.TakeAll(), InfoLevel, 2) +} + +func TestSamplerTicking(t *testing.T) { + // Ensure that we're resetting the sampler's counter every tick. + sampler, logs := fakeSampler(DebugLevel, 10*time.Millisecond, 5, 10) + + // If we log five or fewer messages every tick, none of them should be + // dropped. + for tick := 0; tick < 2; tick++ { + for i := 1; i <= 5; i++ { + writeSequence(sampler, i, InfoLevel) + } + ztest.Sleep(15 * time.Millisecond) + } + assertSequence( + t, + logs.TakeAll(), + InfoLevel, + 1, 2, 3, 4, 5, // first tick + 1, 2, 3, 4, 5, // second tick + ) + + // If we log quickly, we should drop some logs. The first five statements + // each tick should be logged, then every tenth. + for tick := 0; tick < 3; tick++ { + for i := 1; i < 18; i++ { + writeSequence(sampler, i, InfoLevel) + } + ztest.Sleep(10 * time.Millisecond) + } + + assertSequence( + t, + logs.TakeAll(), + InfoLevel, + 1, 2, 3, 4, 5, 15, // first tick + 1, 2, 3, 4, 5, 15, // second tick + 1, 2, 3, 4, 5, 15, // third tick + ) +} + +type countingCore struct { + logs atomic.Uint32 +} + +func (c *countingCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { + return ce.AddCore(ent, c) +} + +func (c *countingCore) Write(Entry, []Field) error { + c.logs.Inc() + return nil +} + +func (c *countingCore) With([]Field) Core { return c } +func (*countingCore) Enabled(Level) bool { return true } +func (*countingCore) Sync() error { return nil } + +func TestSamplerConcurrent(t *testing.T) { + const ( + logsPerTick = 10 + numMessages = 5 + numTicks = 25 + numGoroutines = 10 + expectedCount = numMessages * logsPerTick * numTicks + ) + + tick := ztest.Timeout(10 * time.Millisecond) + cc := &countingCore{} + sampler := NewSampler(cc, tick, logsPerTick, 100000) + + var ( + done atomic.Bool + wg sync.WaitGroup + ) + for i := 0; i < numGoroutines; i++ { + wg.Add(1) + go func(i int) { + defer wg.Done() + + for { + if done.Load() { + return + } + msg := fmt.Sprintf("msg%v", i%numMessages) + ent := Entry{Level: DebugLevel, Message: msg, Time: time.Now()} + if ce := sampler.Check(ent, nil); ce != nil { + ce.Write() + } + + // Give a chance for other goroutines to run. + time.Sleep(time.Microsecond) + } + }(i) + } + + time.AfterFunc(numTicks*tick, func() { + done.Store(true) + }) + wg.Wait() + + assert.InDelta( + t, + expectedCount, + cc.logs.Load(), + expectedCount/10, + "Unexpected number of logs", + ) +} + +func TestSamplerRaces(t *testing.T) { + sampler, _ := fakeSampler(DebugLevel, time.Minute, 1, 1000) + + var wg sync.WaitGroup + start := make(chan struct{}) + + for i := 0; i < 100; i++ { + wg.Add(1) + go func() { + <-start + for j := 0; j < 100; j++ { + writeSequence(sampler, j, InfoLevel) + } + wg.Done() + }() + } + + close(start) + wg.Wait() +} diff --git a/vendor/go.uber.org/zap/zapcore/tee.go b/vendor/go.uber.org/zap/zapcore/tee.go new file mode 100644 index 000000000..07a32eef9 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/tee.go @@ -0,0 +1,81 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import "go.uber.org/multierr" + +type multiCore []Core + +// NewTee creates a Core that duplicates log entries into two or more +// underlying Cores. +// +// Calling it with a single Core returns the input unchanged, and calling +// it with no input returns a no-op Core. +func NewTee(cores ...Core) Core { + switch len(cores) { + case 0: + return NewNopCore() + case 1: + return cores[0] + default: + return multiCore(cores) + } +} + +func (mc multiCore) With(fields []Field) Core { + clone := make(multiCore, len(mc)) + for i := range mc { + clone[i] = mc[i].With(fields) + } + return clone +} + +func (mc multiCore) Enabled(lvl Level) bool { + for i := range mc { + if mc[i].Enabled(lvl) { + return true + } + } + return false +} + +func (mc multiCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry { + for i := range mc { + ce = mc[i].Check(ent, ce) + } + return ce +} + +func (mc multiCore) Write(ent Entry, fields []Field) error { + var err error + for i := range mc { + err = multierr.Append(err, mc[i].Write(ent, fields)) + } + return err +} + +func (mc multiCore) Sync() error { + var err error + for i := range mc { + err = multierr.Append(err, mc[i].Sync()) + } + return err +} diff --git a/vendor/go.uber.org/zap/zapcore/tee_logger_bench_test.go b/vendor/go.uber.org/zap/zapcore/tee_logger_bench_test.go new file mode 100644 index 000000000..b30a17354 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/tee_logger_bench_test.go @@ -0,0 +1,62 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "testing" + + "go.uber.org/zap/internal/ztest" + . "go.uber.org/zap/zapcore" +) + +func withBenchedTee(b *testing.B, f func(Core)) { + fac := NewTee( + NewCore(NewJSONEncoder(testEncoderConfig()), &ztest.Discarder{}, DebugLevel), + NewCore(NewJSONEncoder(testEncoderConfig()), &ztest.Discarder{}, InfoLevel), + ) + b.ResetTimer() + f(fac) +} + +func BenchmarkTeeCheck(b *testing.B) { + cases := []struct { + lvl Level + msg string + }{ + {DebugLevel, "foo"}, + {InfoLevel, "bar"}, + {WarnLevel, "baz"}, + {ErrorLevel, "babble"}, + } + withBenchedTee(b, func(core Core) { + b.RunParallel(func(pb *testing.PB) { + i := 0 + for pb.Next() { + tt := cases[i] + entry := Entry{Level: tt.lvl, Message: tt.msg} + if cm := core.Check(entry, nil); cm != nil { + cm.Write(Field{Key: "i", Integer: int64(i), Type: Int64Type}) + } + i = (i + 1) % len(cases) + } + }) + }) +} diff --git a/vendor/go.uber.org/zap/zapcore/tee_test.go b/vendor/go.uber.org/zap/zapcore/tee_test.go new file mode 100644 index 000000000..e44c21c01 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/tee_test.go @@ -0,0 +1,153 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore_test + +import ( + "errors" + "testing" + + "go.uber.org/zap/internal/ztest" + . "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest/observer" + + "github.com/stretchr/testify/assert" +) + +func withTee(f func(core Core, debugLogs, warnLogs *observer.ObservedLogs)) { + debugLogger, debugLogs := observer.New(DebugLevel) + warnLogger, warnLogs := observer.New(WarnLevel) + tee := NewTee(debugLogger, warnLogger) + f(tee, debugLogs, warnLogs) +} + +func TestTeeUnusualInput(t *testing.T) { + // Verify that Tee handles receiving one and no inputs correctly. + t.Run("one input", func(t *testing.T) { + obs, _ := observer.New(DebugLevel) + assert.Equal(t, obs, NewTee(obs), "Expected to return single inputs unchanged.") + }) + t.Run("no input", func(t *testing.T) { + assert.Equal(t, NewNopCore(), NewTee(), "Expected to return NopCore.") + }) +} + +func TestTeeCheck(t *testing.T) { + withTee(func(tee Core, debugLogs, warnLogs *observer.ObservedLogs) { + debugEntry := Entry{Level: DebugLevel, Message: "log-at-debug"} + infoEntry := Entry{Level: InfoLevel, Message: "log-at-info"} + warnEntry := Entry{Level: WarnLevel, Message: "log-at-warn"} + errorEntry := Entry{Level: ErrorLevel, Message: "log-at-error"} + for _, ent := range []Entry{debugEntry, infoEntry, warnEntry, errorEntry} { + if ce := tee.Check(ent, nil); ce != nil { + ce.Write() + } + } + + assert.Equal(t, []observer.LoggedEntry{ + {Entry: debugEntry, Context: []Field{}}, + {Entry: infoEntry, Context: []Field{}}, + {Entry: warnEntry, Context: []Field{}}, + {Entry: errorEntry, Context: []Field{}}, + }, debugLogs.All()) + + assert.Equal(t, []observer.LoggedEntry{ + {Entry: warnEntry, Context: []Field{}}, + {Entry: errorEntry, Context: []Field{}}, + }, warnLogs.All()) + }) +} + +func TestTeeWrite(t *testing.T) { + // Calling the tee's Write method directly should always log, regardless of + // the configured level. + withTee(func(tee Core, debugLogs, warnLogs *observer.ObservedLogs) { + debugEntry := Entry{Level: DebugLevel, Message: "log-at-debug"} + warnEntry := Entry{Level: WarnLevel, Message: "log-at-warn"} + for _, ent := range []Entry{debugEntry, warnEntry} { + tee.Write(ent, nil) + } + + for _, logs := range []*observer.ObservedLogs{debugLogs, warnLogs} { + assert.Equal(t, []observer.LoggedEntry{ + {Entry: debugEntry, Context: []Field{}}, + {Entry: warnEntry, Context: []Field{}}, + }, logs.All()) + } + }) +} + +func TestTeeWith(t *testing.T) { + withTee(func(tee Core, debugLogs, warnLogs *observer.ObservedLogs) { + f := makeInt64Field("k", 42) + tee = tee.With([]Field{f}) + ent := Entry{Level: WarnLevel, Message: "log-at-warn"} + if ce := tee.Check(ent, nil); ce != nil { + ce.Write() + } + + for _, logs := range []*observer.ObservedLogs{debugLogs, warnLogs} { + assert.Equal(t, []observer.LoggedEntry{ + {Entry: ent, Context: []Field{f}}, + }, logs.All()) + } + }) +} + +func TestTeeEnabled(t *testing.T) { + infoLogger, _ := observer.New(InfoLevel) + warnLogger, _ := observer.New(WarnLevel) + tee := NewTee(infoLogger, warnLogger) + tests := []struct { + lvl Level + enabled bool + }{ + {DebugLevel, false}, + {InfoLevel, true}, + {WarnLevel, true}, + {ErrorLevel, true}, + {DPanicLevel, true}, + {PanicLevel, true}, + {FatalLevel, true}, + } + + for _, tt := range tests { + assert.Equal(t, tt.enabled, tee.Enabled(tt.lvl), "Unexpected Enabled result for level %s.", tt.lvl) + } +} + +func TestTeeSync(t *testing.T) { + infoLogger, _ := observer.New(InfoLevel) + warnLogger, _ := observer.New(WarnLevel) + tee := NewTee(infoLogger, warnLogger) + assert.NoError(t, tee.Sync(), "Unexpected error from Syncing a tee.") + + sink := &ztest.Discarder{} + err := errors.New("failed") + sink.SetError(err) + + noSync := NewCore( + NewJSONEncoder(testEncoderConfig()), + sink, + DebugLevel, + ) + tee = NewTee(tee, noSync) + assert.Equal(t, err, tee.Sync(), "Expected an error when part of tee can't Sync.") +} diff --git a/vendor/go.uber.org/zap/zapcore/write_syncer.go b/vendor/go.uber.org/zap/zapcore/write_syncer.go new file mode 100644 index 000000000..209e25fe2 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/write_syncer.go @@ -0,0 +1,123 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "io" + "sync" + + "go.uber.org/multierr" +) + +// A WriteSyncer is an io.Writer that can also flush any buffered data. Note +// that *os.File (and thus, os.Stderr and os.Stdout) implement WriteSyncer. +type WriteSyncer interface { + io.Writer + Sync() error +} + +// AddSync converts an io.Writer to a WriteSyncer. It attempts to be +// intelligent: if the concrete type of the io.Writer implements WriteSyncer, +// we'll use the existing Sync method. If it doesn't, we'll add a no-op Sync. +func AddSync(w io.Writer) WriteSyncer { + switch w := w.(type) { + case WriteSyncer: + return w + default: + return writerWrapper{w} + } +} + +type lockedWriteSyncer struct { + sync.Mutex + ws WriteSyncer +} + +// Lock wraps a WriteSyncer in a mutex to make it safe for concurrent use. In +// particular, *os.Files must be locked before use. +func Lock(ws WriteSyncer) WriteSyncer { + if _, ok := ws.(*lockedWriteSyncer); ok { + // no need to layer on another lock + return ws + } + return &lockedWriteSyncer{ws: ws} +} + +func (s *lockedWriteSyncer) Write(bs []byte) (int, error) { + s.Lock() + n, err := s.ws.Write(bs) + s.Unlock() + return n, err +} + +func (s *lockedWriteSyncer) Sync() error { + s.Lock() + err := s.ws.Sync() + s.Unlock() + return err +} + +type writerWrapper struct { + io.Writer +} + +func (w writerWrapper) Sync() error { + return nil +} + +type multiWriteSyncer []WriteSyncer + +// NewMultiWriteSyncer creates a WriteSyncer that duplicates its writes +// and sync calls, much like io.MultiWriter. +func NewMultiWriteSyncer(ws ...WriteSyncer) WriteSyncer { + if len(ws) == 1 { + return ws[0] + } + // Copy to protect against https://github.com/golang/go/issues/7809 + return multiWriteSyncer(append([]WriteSyncer(nil), ws...)) +} + +// See https://golang.org/src/io/multi.go +// When not all underlying syncers write the same number of bytes, +// the smallest number is returned even though Write() is called on +// all of them. +func (ws multiWriteSyncer) Write(p []byte) (int, error) { + var writeErr error + nWritten := 0 + for _, w := range ws { + n, err := w.Write(p) + writeErr = multierr.Append(writeErr, err) + if nWritten == 0 && n != 0 { + nWritten = n + } else if n < nWritten { + nWritten = n + } + } + return nWritten, writeErr +} + +func (ws multiWriteSyncer) Sync() error { + var err error + for _, w := range ws { + err = multierr.Append(err, w.Sync()) + } + return err +} diff --git a/vendor/go.uber.org/zap/zapcore/write_syncer_bench_test.go b/vendor/go.uber.org/zap/zapcore/write_syncer_bench_test.go new file mode 100644 index 000000000..0209d0f61 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/write_syncer_bench_test.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "testing" + + "go.uber.org/zap/internal/ztest" +) + +func BenchmarkMultiWriteSyncer(b *testing.B) { + b.Run("2", func(b *testing.B) { + w := NewMultiWriteSyncer( + &ztest.Discarder{}, + &ztest.Discarder{}, + ) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + w.Write([]byte("foobarbazbabble")) + } + }) + }) + b.Run("4", func(b *testing.B) { + w := NewMultiWriteSyncer( + &ztest.Discarder{}, + &ztest.Discarder{}, + &ztest.Discarder{}, + &ztest.Discarder{}, + ) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + w.Write([]byte("foobarbazbabble")) + } + }) + }) +} diff --git a/vendor/go.uber.org/zap/zapcore/write_syncer_test.go b/vendor/go.uber.org/zap/zapcore/write_syncer_test.go new file mode 100644 index 000000000..3ccb0af24 --- /dev/null +++ b/vendor/go.uber.org/zap/zapcore/write_syncer_test.go @@ -0,0 +1,137 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapcore + +import ( + "bytes" + "errors" + "testing" + + "io" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap/internal/ztest" +) + +type writeSyncSpy struct { + io.Writer + ztest.Syncer +} + +func requireWriteWorks(t testing.TB, ws WriteSyncer) { + n, err := ws.Write([]byte("foo")) + require.NoError(t, err, "Unexpected error writing to WriteSyncer.") + require.Equal(t, 3, n, "Wrote an unexpected number of bytes.") +} + +func TestAddSyncWriteSyncer(t *testing.T) { + buf := &bytes.Buffer{} + concrete := &writeSyncSpy{Writer: buf} + ws := AddSync(concrete) + requireWriteWorks(t, ws) + + require.NoError(t, ws.Sync(), "Unexpected error syncing a WriteSyncer.") + require.True(t, concrete.Called(), "Expected to dispatch to concrete type's Sync method.") + + concrete.SetError(errors.New("fail")) + assert.Error(t, ws.Sync(), "Expected to propagate errors from concrete type's Sync method.") +} + +func TestAddSyncWriter(t *testing.T) { + // If we pass a plain io.Writer, make sure that we still get a WriteSyncer + // with a no-op Sync. + buf := &bytes.Buffer{} + ws := AddSync(buf) + requireWriteWorks(t, ws) + assert.NoError(t, ws.Sync(), "Unexpected error calling a no-op Sync method.") +} + +func TestNewMultiWriteSyncerWorksForSingleWriter(t *testing.T) { + w := &ztest.Buffer{} + + ws := NewMultiWriteSyncer(w) + assert.Equal(t, w, ws, "Expected NewMultiWriteSyncer to return the same WriteSyncer object for a single argument.") + + ws.Sync() + assert.True(t, w.Called(), "Expected Sync to be called on the created WriteSyncer") +} + +func TestMultiWriteSyncerWritesBoth(t *testing.T) { + first := &bytes.Buffer{} + second := &bytes.Buffer{} + ws := NewMultiWriteSyncer(AddSync(first), AddSync(second)) + + msg := []byte("dumbledore") + n, err := ws.Write(msg) + require.NoError(t, err, "Expected successful buffer write") + assert.Equal(t, len(msg), n) + + assert.Equal(t, msg, first.Bytes()) + assert.Equal(t, msg, second.Bytes()) +} + +func TestMultiWriteSyncerFailsWrite(t *testing.T) { + ws := NewMultiWriteSyncer(AddSync(&ztest.FailWriter{})) + _, err := ws.Write([]byte("test")) + assert.Error(t, err, "Write error should propagate") +} + +func TestMultiWriteSyncerFailsShortWrite(t *testing.T) { + ws := NewMultiWriteSyncer(AddSync(&ztest.ShortWriter{})) + n, err := ws.Write([]byte("test")) + assert.NoError(t, err, "Expected fake-success from short write") + assert.Equal(t, 3, n, "Expected byte count to return from underlying writer") +} + +func TestWritestoAllSyncs_EvenIfFirstErrors(t *testing.T) { + failer := &ztest.FailWriter{} + second := &bytes.Buffer{} + ws := NewMultiWriteSyncer(AddSync(failer), AddSync(second)) + + _, err := ws.Write([]byte("fail")) + assert.Error(t, err, "Expected error from call to a writer that failed") + assert.Equal(t, []byte("fail"), second.Bytes(), "Expected second sink to be written after first error") +} + +func TestMultiWriteSyncerSync_PropagatesErrors(t *testing.T) { + badsink := &ztest.Buffer{} + badsink.SetError(errors.New("sink is full")) + ws := NewMultiWriteSyncer(&ztest.Discarder{}, badsink) + + assert.Error(t, ws.Sync(), "Expected sync error to propagate") +} + +func TestMultiWriteSyncerSync_NoErrorsOnDiscard(t *testing.T) { + ws := NewMultiWriteSyncer(&ztest.Discarder{}) + assert.NoError(t, ws.Sync(), "Expected error-free sync to /dev/null") +} + +func TestMultiWriteSyncerSync_AllCalled(t *testing.T) { + failed, second := &ztest.Buffer{}, &ztest.Buffer{} + + failed.SetError(errors.New("disposal broken")) + ws := NewMultiWriteSyncer(failed, second) + + assert.Error(t, ws.Sync(), "Expected first sink to fail") + assert.True(t, failed.Called(), "Expected first sink to have Sync method called.") + assert.True(t, second.Called(), "Expected call to Sync even with first failure.") +} diff --git a/vendor/go.uber.org/zap/zapgrpc/zapgrpc.go b/vendor/go.uber.org/zap/zapgrpc/zapgrpc.go new file mode 100644 index 000000000..1181e6a0d --- /dev/null +++ b/vendor/go.uber.org/zap/zapgrpc/zapgrpc.go @@ -0,0 +1,100 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package zapgrpc provides a logger that is compatible with grpclog. +package zapgrpc // import "go.uber.org/zap/zapgrpc" + +import "go.uber.org/zap" + +// An Option overrides a Logger's default configuration. +type Option interface { + apply(*Logger) +} + +type optionFunc func(*Logger) + +func (f optionFunc) apply(log *Logger) { + f(log) +} + +// WithDebug configures a Logger to print at zap's DebugLevel instead of +// InfoLevel. +func WithDebug() Option { + return optionFunc(func(logger *Logger) { + logger.print = (*zap.SugaredLogger).Debug + logger.printf = (*zap.SugaredLogger).Debugf + }) +} + +// NewLogger returns a new Logger. +// +// By default, Loggers print at zap's InfoLevel. +func NewLogger(l *zap.Logger, options ...Option) *Logger { + logger := &Logger{ + log: l.Sugar(), + fatal: (*zap.SugaredLogger).Fatal, + fatalf: (*zap.SugaredLogger).Fatalf, + print: (*zap.SugaredLogger).Info, + printf: (*zap.SugaredLogger).Infof, + } + for _, option := range options { + option.apply(logger) + } + return logger +} + +// Logger adapts zap's Logger to be compatible with grpclog.Logger. +type Logger struct { + log *zap.SugaredLogger + fatal func(*zap.SugaredLogger, ...interface{}) + fatalf func(*zap.SugaredLogger, string, ...interface{}) + print func(*zap.SugaredLogger, ...interface{}) + printf func(*zap.SugaredLogger, string, ...interface{}) +} + +// Fatal implements grpclog.Logger. +func (l *Logger) Fatal(args ...interface{}) { + l.fatal(l.log, args...) +} + +// Fatalf implements grpclog.Logger. +func (l *Logger) Fatalf(format string, args ...interface{}) { + l.fatalf(l.log, format, args...) +} + +// Fatalln implements grpclog.Logger. +func (l *Logger) Fatalln(args ...interface{}) { + l.fatal(l.log, args...) +} + +// Print implements grpclog.Logger. +func (l *Logger) Print(args ...interface{}) { + l.print(l.log, args...) +} + +// Printf implements grpclog.Logger. +func (l *Logger) Printf(format string, args ...interface{}) { + l.printf(l.log, format, args...) +} + +// Println implements grpclog.Logger. +func (l *Logger) Println(args ...interface{}) { + l.print(l.log, args...) +} diff --git a/vendor/go.uber.org/zap/zapgrpc/zapgrpc_test.go b/vendor/go.uber.org/zap/zapgrpc/zapgrpc_test.go new file mode 100644 index 000000000..036f3d764 --- /dev/null +++ b/vendor/go.uber.org/zap/zapgrpc/zapgrpc_test.go @@ -0,0 +1,115 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zapgrpc + +import ( + "testing" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest/observer" + + "github.com/stretchr/testify/require" +) + +func TestLoggerInfoExpected(t *testing.T) { + checkMessages(t, zapcore.DebugLevel, nil, zapcore.InfoLevel, []string{ + "hello", + "world", + "foo", + }, func(logger *Logger) { + logger.Print("hello") + logger.Printf("world") + logger.Println("foo") + }) +} + +func TestLoggerDebugExpected(t *testing.T) { + checkMessages(t, zapcore.DebugLevel, []Option{WithDebug()}, zapcore.DebugLevel, []string{ + "hello", + "world", + "foo", + }, func(logger *Logger) { + logger.Print("hello") + logger.Printf("world") + logger.Println("foo") + }) +} + +func TestLoggerDebugSuppressed(t *testing.T) { + checkMessages(t, zapcore.InfoLevel, []Option{WithDebug()}, zapcore.DebugLevel, nil, func(logger *Logger) { + logger.Print("hello") + logger.Printf("world") + logger.Println("foo") + }) +} + +func TestLoggerFatalExpected(t *testing.T) { + checkMessages(t, zapcore.DebugLevel, nil, zapcore.FatalLevel, []string{ + "hello", + "world", + "foo", + }, func(logger *Logger) { + logger.Fatal("hello") + logger.Fatalf("world") + logger.Fatalln("foo") + }) +} + +func checkMessages( + t testing.TB, + enab zapcore.LevelEnabler, + opts []Option, + expectedLevel zapcore.Level, + expectedMessages []string, + f func(*Logger), +) { + if expectedLevel == zapcore.FatalLevel { + expectedLevel = zapcore.WarnLevel + } + withLogger(enab, opts, func(logger *Logger, observedLogs *observer.ObservedLogs) { + f(logger) + logEntries := observedLogs.All() + require.Equal(t, len(expectedMessages), len(logEntries)) + for i, logEntry := range logEntries { + require.Equal(t, expectedLevel, logEntry.Level) + require.Equal(t, expectedMessages[i], logEntry.Message) + } + }) +} + +func withLogger( + enab zapcore.LevelEnabler, + opts []Option, + f func(*Logger, *observer.ObservedLogs), +) { + core, observedLogs := observer.New(enab) + f(NewLogger(zap.New(core), append(opts, withWarn())...), observedLogs) +} + +// withWarn redirects the fatal level to the warn level, which makes testing +// easier. +func withWarn() Option { + return optionFunc(func(logger *Logger) { + logger.fatal = (*zap.SugaredLogger).Warn + logger.fatalf = (*zap.SugaredLogger).Warnf + }) +} diff --git a/vendor/go.uber.org/zap/zaptest/doc.go b/vendor/go.uber.org/zap/zaptest/doc.go new file mode 100644 index 000000000..b377859c4 --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/doc.go @@ -0,0 +1,22 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package zaptest provides a variety of helpers for testing log output. +package zaptest // import "go.uber.org/zap/zaptest" diff --git a/vendor/go.uber.org/zap/zaptest/logger.go b/vendor/go.uber.org/zap/zaptest/logger.go new file mode 100644 index 000000000..80ace98ea --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/logger.go @@ -0,0 +1,124 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zaptest + +import ( + "bytes" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +// LoggerOption configures the test logger built by NewLogger. +type LoggerOption interface { + applyLoggerOption(*loggerOptions) +} + +type loggerOptions struct { + Level zapcore.LevelEnabler +} + +type loggerOptionFunc func(*loggerOptions) + +func (f loggerOptionFunc) applyLoggerOption(opts *loggerOptions) { + f(opts) +} + +// Level controls which messages are logged by a test Logger built by +// NewLogger. +func Level(enab zapcore.LevelEnabler) LoggerOption { + return loggerOptionFunc(func(opts *loggerOptions) { + opts.Level = enab + }) +} + +// NewLogger builds a new Logger that logs all messages to the given +// testing.TB. +// +// logger := zaptest.NewLogger(t) +// +// Use this with a *testing.T or *testing.B to get logs which get printed only +// if a test fails or if you ran go test -v. +// +// The returned logger defaults to logging debug level messages and above. +// This may be changd by passing a zaptest.Level during construction. +// +// logger := zaptest.NewLogger(t, zaptest.Level(zap.WarnLevel)) +func NewLogger(t TestingT, opts ...LoggerOption) *zap.Logger { + cfg := loggerOptions{ + Level: zapcore.DebugLevel, + } + for _, o := range opts { + o.applyLoggerOption(&cfg) + } + + writer := newTestingWriter(t) + return zap.New( + zapcore.NewCore( + zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()), + writer, + cfg.Level, + ), + + // Send zap errors to the same writer and mark the test as failed if + // that happens. + zap.ErrorOutput(writer.WithMarkFailed(true)), + ) +} + +// testingWriter is a WriteSyncer that writes to the given testing.TB. +type testingWriter struct { + t TestingT + + // If true, the test will be marked as failed if this testingWriter is + // ever used. + markFailed bool +} + +func newTestingWriter(t TestingT) testingWriter { + return testingWriter{t: t} +} + +// WithMarkFailed returns a copy of this testingWriter with markFailed set to +// the provided value. +func (w testingWriter) WithMarkFailed(v bool) testingWriter { + w.markFailed = v + return w +} + +func (w testingWriter) Write(p []byte) (n int, err error) { + n = len(p) + + // Strip trailing newline because t.Log always adds one. + p = bytes.TrimRight(p, "\n") + + // Note: t.Log is safe for concurrent use. + w.t.Logf("%s", p) + if w.markFailed { + w.t.Fail() + } + + return n, nil +} + +func (w testingWriter) Sync() error { + return nil +} diff --git a/vendor/go.uber.org/zap/zaptest/logger_test.go b/vendor/go.uber.org/zap/zaptest/logger_test.go new file mode 100644 index 000000000..b69aa28c8 --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/logger_test.go @@ -0,0 +1,169 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zaptest + +import ( + "errors" + "fmt" + "io" + "strings" + "testing" + + "go.uber.org/zap" + "go.uber.org/zap/internal/ztest" + "go.uber.org/zap/zapcore" + + "github.com/stretchr/testify/assert" +) + +func TestTestLogger(t *testing.T) { + ts := newTestLogSpy(t) + defer ts.AssertPassed() + + log := NewLogger(ts) + + log.Info("received work order") + log.Debug("starting work") + log.Warn("work may fail") + log.Error("work failed", zap.Error(errors.New("great sadness"))) + + assert.Panics(t, func() { + log.Panic("failed to do work") + }, "log.Panic should panic") + + ts.AssertMessages( + "INFO received work order", + "DEBUG starting work", + "WARN work may fail", + `ERROR work failed {"error": "great sadness"}`, + "PANIC failed to do work", + ) +} + +func TestTestLoggerSupportsLevels(t *testing.T) { + ts := newTestLogSpy(t) + defer ts.AssertPassed() + + log := NewLogger(ts, Level(zap.WarnLevel)) + + log.Info("received work order") + log.Debug("starting work") + log.Warn("work may fail") + log.Error("work failed", zap.Error(errors.New("great sadness"))) + + assert.Panics(t, func() { + log.Panic("failed to do work") + }, "log.Panic should panic") + + ts.AssertMessages( + "WARN work may fail", + `ERROR work failed {"error": "great sadness"}`, + "PANIC failed to do work", + ) +} + +func TestTestingWriter(t *testing.T) { + ts := newTestLogSpy(t) + w := newTestingWriter(ts) + + n, err := io.WriteString(w, "hello\n\n") + assert.NoError(t, err, "WriteString must not fail") + assert.Equal(t, 7, n) +} + +func TestTestLoggerErrorOutput(t *testing.T) { + // This test verifies that the test logger logs internal messages to the + // testing.T and marks the test as failed. + + ts := newTestLogSpy(t) + defer ts.AssertFailed() + + log := NewLogger(ts) + + // Replace with a core that fails. + log = log.WithOptions(zap.WrapCore(func(zapcore.Core) zapcore.Core { + return zapcore.NewCore( + zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()), + zapcore.Lock(zapcore.AddSync(ztest.FailWriter{})), + zapcore.DebugLevel, + ) + })) + + log.Info("foo") // this fails + + if assert.Len(t, ts.Messages, 1, "expected a log message") { + assert.Regexp(t, `write error: failed`, ts.Messages[0]) + } +} + +// testLogSpy is a testing.TB that captures logged messages. +type testLogSpy struct { + testing.TB + + failed bool + Messages []string +} + +func newTestLogSpy(t testing.TB) *testLogSpy { + return &testLogSpy{TB: t} +} + +func (t *testLogSpy) Fail() { + t.failed = true +} + +func (t *testLogSpy) Failed() bool { + return t.failed +} + +func (t *testLogSpy) FailNow() { + t.Fail() + t.TB.FailNow() +} + +func (t *testLogSpy) Logf(format string, args ...interface{}) { + // Log messages are in the format, + // + // 2017-10-27T13:03:01.000-0700 DEBUG your message here {data here} + // + // We strip the first part of these messages because we can't really test + // for the timestamp from these tests. + m := fmt.Sprintf(format, args...) + m = m[strings.IndexByte(m, '\t')+1:] + t.Messages = append(t.Messages, m) + t.TB.Log(m) +} + +func (t *testLogSpy) AssertMessages(msgs ...string) { + assert.Equal(t.TB, msgs, t.Messages, "logged messages did not match") +} + +func (t *testLogSpy) AssertPassed() { + t.assertFailed(false, "expected test to pass") +} + +func (t *testLogSpy) AssertFailed() { + t.assertFailed(true, "expected test to fail") +} + +func (t *testLogSpy) assertFailed(v bool, msg string) { + assert.Equal(t.TB, v, t.failed, msg) +} diff --git a/vendor/go.uber.org/zap/zaptest/observer/logged_entry.go b/vendor/go.uber.org/zap/zaptest/observer/logged_entry.go new file mode 100644 index 000000000..a4ea7ec36 --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/observer/logged_entry.go @@ -0,0 +1,39 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package observer + +import "go.uber.org/zap/zapcore" + +// An LoggedEntry is an encoding-agnostic representation of a log message. +// Field availability is context dependant. +type LoggedEntry struct { + zapcore.Entry + Context []zapcore.Field +} + +// ContextMap returns a map for all fields in Context. +func (e LoggedEntry) ContextMap() map[string]interface{} { + encoder := zapcore.NewMapObjectEncoder() + for _, f := range e.Context { + f.AddTo(encoder) + } + return encoder.Fields +} diff --git a/vendor/go.uber.org/zap/zaptest/observer/logged_entry_test.go b/vendor/go.uber.org/zap/zaptest/observer/logged_entry_test.go new file mode 100644 index 000000000..50f6123bd --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/observer/logged_entry_test.go @@ -0,0 +1,88 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package observer + +import ( + "testing" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + + "github.com/stretchr/testify/assert" +) + +func TestLoggedEntryContextMap(t *testing.T) { + tests := []struct { + msg string + fields []zapcore.Field + want map[string]interface{} + }{ + { + msg: "no fields", + fields: nil, + want: map[string]interface{}{}, + }, + { + msg: "simple", + fields: []zapcore.Field{ + zap.String("k1", "v"), + zap.Int64("k2", 10), + }, + want: map[string]interface{}{ + "k1": "v", + "k2": int64(10), + }, + }, + { + msg: "overwrite", + fields: []zapcore.Field{ + zap.String("k1", "v1"), + zap.String("k1", "v2"), + }, + want: map[string]interface{}{ + "k1": "v2", + }, + }, + { + msg: "nested", + fields: []zapcore.Field{ + zap.String("k1", "v1"), + zap.Namespace("nested"), + zap.String("k2", "v2"), + }, + want: map[string]interface{}{ + "k1": "v1", + "nested": map[string]interface{}{ + "k2": "v2", + }, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.msg, func(t *testing.T) { + entry := LoggedEntry{ + Context: tt.fields, + } + assert.Equal(t, tt.want, entry.ContextMap()) + }) + } +} diff --git a/vendor/go.uber.org/zap/zaptest/observer/observer.go b/vendor/go.uber.org/zap/zaptest/observer/observer.go new file mode 100644 index 000000000..78f5be45d --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/observer/observer.go @@ -0,0 +1,167 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package observer provides a zapcore.Core that keeps an in-memory, +// encoding-agnostic repesentation of log entries. It's useful for +// applications that want to unit test their log output without tying their +// tests to a particular output encoding. +package observer // import "go.uber.org/zap/zaptest/observer" + +import ( + "strings" + "sync" + "time" + + "go.uber.org/zap/zapcore" +) + +// ObservedLogs is a concurrency-safe, ordered collection of observed logs. +type ObservedLogs struct { + mu sync.RWMutex + logs []LoggedEntry +} + +// Len returns the number of items in the collection. +func (o *ObservedLogs) Len() int { + o.mu.RLock() + n := len(o.logs) + o.mu.RUnlock() + return n +} + +// All returns a copy of all the observed logs. +func (o *ObservedLogs) All() []LoggedEntry { + o.mu.RLock() + ret := make([]LoggedEntry, len(o.logs)) + for i := range o.logs { + ret[i] = o.logs[i] + } + o.mu.RUnlock() + return ret +} + +// TakeAll returns a copy of all the observed logs, and truncates the observed +// slice. +func (o *ObservedLogs) TakeAll() []LoggedEntry { + o.mu.Lock() + ret := o.logs + o.logs = nil + o.mu.Unlock() + return ret +} + +// AllUntimed returns a copy of all the observed logs, but overwrites the +// observed timestamps with time.Time's zero value. This is useful when making +// assertions in tests. +func (o *ObservedLogs) AllUntimed() []LoggedEntry { + ret := o.All() + for i := range ret { + ret[i].Time = time.Time{} + } + return ret +} + +// FilterMessage filters entries to those that have the specified message. +func (o *ObservedLogs) FilterMessage(msg string) *ObservedLogs { + return o.filter(func(e LoggedEntry) bool { + return e.Message == msg + }) +} + +// FilterMessageSnippet filters entries to those that have a message containing the specified snippet. +func (o *ObservedLogs) FilterMessageSnippet(snippet string) *ObservedLogs { + return o.filter(func(e LoggedEntry) bool { + return strings.Contains(e.Message, snippet) + }) +} + +// FilterField filters entries to those that have the specified field. +func (o *ObservedLogs) FilterField(field zapcore.Field) *ObservedLogs { + return o.filter(func(e LoggedEntry) bool { + for _, ctxField := range e.Context { + if ctxField.Equals(field) { + return true + } + } + return false + }) +} + +func (o *ObservedLogs) filter(match func(LoggedEntry) bool) *ObservedLogs { + o.mu.RLock() + defer o.mu.RUnlock() + + var filtered []LoggedEntry + for _, entry := range o.logs { + if match(entry) { + filtered = append(filtered, entry) + } + } + return &ObservedLogs{logs: filtered} +} + +func (o *ObservedLogs) add(log LoggedEntry) { + o.mu.Lock() + o.logs = append(o.logs, log) + o.mu.Unlock() +} + +// New creates a new Core that buffers logs in memory (without any encoding). +// It's particularly useful in tests. +func New(enab zapcore.LevelEnabler) (zapcore.Core, *ObservedLogs) { + ol := &ObservedLogs{} + return &contextObserver{ + LevelEnabler: enab, + logs: ol, + }, ol +} + +type contextObserver struct { + zapcore.LevelEnabler + logs *ObservedLogs + context []zapcore.Field +} + +func (co *contextObserver) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry { + if co.Enabled(ent.Level) { + return ce.AddCore(ent, co) + } + return ce +} + +func (co *contextObserver) With(fields []zapcore.Field) zapcore.Core { + return &contextObserver{ + LevelEnabler: co.LevelEnabler, + logs: co.logs, + context: append(co.context[:len(co.context):len(co.context)], fields...), + } +} + +func (co *contextObserver) Write(ent zapcore.Entry, fields []zapcore.Field) error { + all := make([]zapcore.Field, 0, len(fields)+len(co.context)) + all = append(all, co.context...) + all = append(all, fields...) + co.logs.add(LoggedEntry{ent, all}) + return nil +} + +func (co *contextObserver) Sync() error { + return nil +} diff --git a/vendor/go.uber.org/zap/zaptest/observer/observer_test.go b/vendor/go.uber.org/zap/zaptest/observer/observer_test.go new file mode 100644 index 000000000..e1a0da78c --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/observer/observer_test.go @@ -0,0 +1,215 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package observer_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + . "go.uber.org/zap/zaptest/observer" +) + +func assertEmpty(t testing.TB, logs *ObservedLogs) { + assert.Equal(t, 0, logs.Len(), "Expected empty ObservedLogs to have zero length.") + assert.Equal(t, []LoggedEntry{}, logs.All(), "Unexpected LoggedEntries in empty ObservedLogs.") +} + +func TestObserver(t *testing.T) { + observer, logs := New(zap.InfoLevel) + assertEmpty(t, logs) + + assert.NoError(t, observer.Sync(), "Unexpected failure in no-op Sync") + + obs := zap.New(observer).With(zap.Int("i", 1)) + obs.Info("foo") + obs.Debug("bar") + want := []LoggedEntry{{ + Entry: zapcore.Entry{Level: zap.InfoLevel, Message: "foo"}, + Context: []zapcore.Field{zap.Int("i", 1)}, + }} + + assert.Equal(t, 1, logs.Len(), "Unexpected observed logs Len.") + assert.Equal(t, want, logs.AllUntimed(), "Unexpected contents from AllUntimed.") + + all := logs.All() + require.Equal(t, 1, len(all), "Unexpected numbed of LoggedEntries returned from All.") + assert.NotEqual(t, time.Time{}, all[0].Time, "Expected non-zero time on LoggedEntry.") + + // copy & zero time for stable assertions + untimed := append([]LoggedEntry{}, all...) + untimed[0].Time = time.Time{} + assert.Equal(t, want, untimed, "Unexpected LoggedEntries from All.") + + assert.Equal(t, all, logs.TakeAll(), "Expected All and TakeAll to return identical results.") + assertEmpty(t, logs) +} + +func TestObserverWith(t *testing.T) { + sf1, logs := New(zap.InfoLevel) + + // need to pad out enough initial fields so that the underlying slice cap() + // gets ahead of its len() so that the sf3/4 With append's could choose + // not to copy (if the implementation doesn't force them) + sf1 = sf1.With([]zapcore.Field{zap.Int("a", 1), zap.Int("b", 2)}) + + sf2 := sf1.With([]zapcore.Field{zap.Int("c", 3)}) + sf3 := sf2.With([]zapcore.Field{zap.Int("d", 4)}) + sf4 := sf2.With([]zapcore.Field{zap.Int("e", 5)}) + ent := zapcore.Entry{Level: zap.InfoLevel, Message: "hello"} + + for i, core := range []zapcore.Core{sf2, sf3, sf4} { + if ce := core.Check(ent, nil); ce != nil { + ce.Write(zap.Int("i", i)) + } + } + + assert.Equal(t, []LoggedEntry{ + { + Entry: ent, + Context: []zapcore.Field{ + zap.Int("a", 1), + zap.Int("b", 2), + zap.Int("c", 3), + zap.Int("i", 0), + }, + }, + { + Entry: ent, + Context: []zapcore.Field{ + zap.Int("a", 1), + zap.Int("b", 2), + zap.Int("c", 3), + zap.Int("d", 4), + zap.Int("i", 1), + }, + }, + { + Entry: ent, + Context: []zapcore.Field{ + zap.Int("a", 1), + zap.Int("b", 2), + zap.Int("c", 3), + zap.Int("e", 5), + zap.Int("i", 2), + }, + }, + }, logs.All(), "expected no field sharing between With siblings") +} + +func TestFilters(t *testing.T) { + logs := []LoggedEntry{ + { + Entry: zapcore.Entry{Level: zap.InfoLevel, Message: "log a"}, + Context: []zapcore.Field{zap.String("fStr", "1"), zap.Int("a", 1)}, + }, + { + Entry: zapcore.Entry{Level: zap.InfoLevel, Message: "log a"}, + Context: []zapcore.Field{zap.String("fStr", "2"), zap.Int("b", 2)}, + }, + { + Entry: zapcore.Entry{Level: zap.InfoLevel, Message: "log b"}, + Context: []zapcore.Field{zap.Int("a", 1), zap.Int("b", 2)}, + }, + { + Entry: zapcore.Entry{Level: zap.InfoLevel, Message: "log c"}, + Context: []zapcore.Field{zap.Int("a", 1), zap.Namespace("ns"), zap.Int("a", 2)}, + }, + { + Entry: zapcore.Entry{Level: zap.InfoLevel, Message: "msg 1"}, + Context: []zapcore.Field{zap.Int("a", 1), zap.Namespace("ns")}, + }, + { + Entry: zapcore.Entry{Level: zap.InfoLevel, Message: "any map"}, + Context: []zapcore.Field{zap.Any("map", map[string]string{"a": "b"})}, + }, + { + Entry: zapcore.Entry{Level: zap.InfoLevel, Message: "any slice"}, + Context: []zapcore.Field{zap.Any("slice", []string{"a"})}, + }, + } + + logger, sink := New(zap.InfoLevel) + for _, log := range logs { + logger.Write(log.Entry, log.Context) + } + + tests := []struct { + msg string + filtered *ObservedLogs + want []LoggedEntry + }{ + { + msg: "filter by message", + filtered: sink.FilterMessage("log a"), + want: logs[0:2], + }, + { + msg: "filter by field", + filtered: sink.FilterField(zap.String("fStr", "1")), + want: logs[0:1], + }, + { + msg: "filter by message and field", + filtered: sink.FilterMessage("log a").FilterField(zap.Int("b", 2)), + want: logs[1:2], + }, + { + msg: "filter by field with duplicate fields", + filtered: sink.FilterField(zap.Int("a", 2)), + want: logs[3:4], + }, + { + msg: "filter doesn't match any messages", + filtered: sink.FilterMessage("no match"), + want: []LoggedEntry{}, + }, + { + msg: "filter by snippet", + filtered: sink.FilterMessageSnippet("log"), + want: logs[0:4], + }, + { + msg: "filter by snippet and field", + filtered: sink.FilterMessageSnippet("a").FilterField(zap.Int("b", 2)), + want: logs[1:2], + }, + { + msg: "filter for map", + filtered: sink.FilterField(zap.Any("map", map[string]string{"a": "b"})), + want: logs[5:6], + }, + { + msg: "filter for slice", + filtered: sink.FilterField(zap.Any("slice", []string{"a"})), + want: logs[6:7], + }, + } + + for _, tt := range tests { + got := tt.filtered.AllUntimed() + assert.Equal(t, tt.want, got, tt.msg) + } +} diff --git a/vendor/go.uber.org/zap/zaptest/testingt.go b/vendor/go.uber.org/zap/zaptest/testingt.go new file mode 100644 index 000000000..792463be3 --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/testingt.go @@ -0,0 +1,47 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zaptest + +// TestingT is a subset of the API provided by all *testing.T and *testing.B +// objects. +type TestingT interface { + // Logs the given message without failing the test. + Logf(string, ...interface{}) + + // Logs the given message and marks the test as failed. + Errorf(string, ...interface{}) + + // Marks the test as failed. + Fail() + + // Returns true if the test has been marked as failed. + Failed() bool + + // Returns the name of the test. + Name() string + + // Marks the test as failed and stops execution of that test. + FailNow() +} + +// Note: We currently only rely on Logf. We are including Errorf and FailNow +// in the interface in anticipation of future need since we can't extend the +// interface without a breaking change. diff --git a/vendor/go.uber.org/zap/zaptest/testingt_test.go b/vendor/go.uber.org/zap/zaptest/testingt_test.go new file mode 100644 index 000000000..d8477964d --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/testingt_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zaptest + +import "testing" + +// Just a compile-time test to ensure that TestingT matches the testing.TB +// interface. We could do this in testingt.go but that would put a dependency +// on the "testing" package from zaptest. + +var _ TestingT = (testing.TB)(nil) diff --git a/vendor/go.uber.org/zap/zaptest/timeout.go b/vendor/go.uber.org/zap/zaptest/timeout.go new file mode 100644 index 000000000..f0be44416 --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/timeout.go @@ -0,0 +1,45 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zaptest + +import ( + "time" + + "go.uber.org/zap/internal/ztest" +) + +// Timeout scales the provided duration by $TEST_TIMEOUT_SCALE. +// +// Deprecated: This function is intended for internal testing and shouldn't be +// used outside zap itself. It was introduced before Go supported internal +// packages. +func Timeout(base time.Duration) time.Duration { + return ztest.Timeout(base) +} + +// Sleep scales the sleep duration by $TEST_TIMEOUT_SCALE. +// +// Deprecated: This function is intended for internal testing and shouldn't be +// used outside zap itself. It was introduced before Go supported internal +// packages. +func Sleep(base time.Duration) { + ztest.Sleep(base) +} diff --git a/vendor/go.uber.org/zap/zaptest/timeout_test.go b/vendor/go.uber.org/zap/zaptest/timeout_test.go new file mode 100644 index 000000000..3962ecdaf --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/timeout_test.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zaptest + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "go.uber.org/zap/internal/ztest" +) + +func TestTimeout(t *testing.T) { + defer ztest.Initialize("2")() + assert.Equal(t, time.Duration(100), Timeout(50), "Expected to scale up timeout.") +} + +func TestSleep(t *testing.T) { + defer ztest.Initialize("2")() + const sleepFor = 50 * time.Millisecond + now := time.Now() + Sleep(sleepFor) + elapsed := time.Since(now) + assert.True(t, 2*sleepFor <= elapsed, "Expected to scale up timeout.") +} diff --git a/vendor/go.uber.org/zap/zaptest/writer.go b/vendor/go.uber.org/zap/zaptest/writer.go new file mode 100644 index 000000000..0701630e1 --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/writer.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zaptest + +import "go.uber.org/zap/internal/ztest" + +type ( + // A Syncer is a spy for the Sync portion of zapcore.WriteSyncer. + Syncer = ztest.Syncer + + // A Discarder sends all writes to ioutil.Discard. + Discarder = ztest.Discarder + + // FailWriter is a WriteSyncer that always returns an error on writes. + FailWriter = ztest.FailWriter + + // ShortWriter is a WriteSyncer whose write method never returns an error, + // but always reports that it wrote one byte less than the input slice's + // length (thus, a "short write"). + ShortWriter = ztest.ShortWriter + + // Buffer is an implementation of zapcore.WriteSyncer that sends all writes to + // a bytes.Buffer. It has convenience methods to split the accumulated buffer + // on newlines. + Buffer = ztest.Buffer +) diff --git a/vendor/go.uber.org/zap/zaptest/writer_test.go b/vendor/go.uber.org/zap/zaptest/writer_test.go new file mode 100644 index 000000000..c18f18a35 --- /dev/null +++ b/vendor/go.uber.org/zap/zaptest/writer_test.go @@ -0,0 +1,68 @@ +// Copyright (c) 2016 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package zaptest + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestSyncer(t *testing.T) { + err := errors.New("sentinel") + s := &Syncer{} + s.SetError(err) + assert.Equal(t, err, s.Sync(), "Expected Sync to fail with provided error.") + assert.True(t, s.Called(), "Expected to record that Sync was called.") +} + +func TestDiscarder(t *testing.T) { + d := &Discarder{} + payload := []byte("foo") + n, err := d.Write(payload) + assert.NoError(t, err, "Unexpected error writing to Discarder.") + assert.Equal(t, len(payload), n, "Wrong number of bytes written.") +} + +func TestFailWriter(t *testing.T) { + w := &FailWriter{} + payload := []byte("foo") + n, err := w.Write(payload) + assert.Error(t, err, "Expected an error writing to FailWriter.") + assert.Equal(t, len(payload), n, "Wrong number of bytes written.") +} + +func TestShortWriter(t *testing.T) { + w := &ShortWriter{} + payload := []byte("foo") + n, err := w.Write(payload) + assert.NoError(t, err, "Unexpected error writing to ShortWriter.") + assert.Equal(t, len(payload)-1, n, "Wrong number of bytes written.") +} + +func TestBuffer(t *testing.T) { + buf := &Buffer{} + buf.WriteString("foo\n") + buf.WriteString("bar\n") + assert.Equal(t, []string{"foo", "bar"}, buf.Lines(), "Unexpected output from Lines.") + assert.Equal(t, "foo\nbar", buf.Stripped(), "Unexpected output from Stripped.") +} diff --git a/vendor/golang.org/x/oauth2/.travis.yml b/vendor/golang.org/x/oauth2/.travis.yml new file mode 100644 index 000000000..fa139db22 --- /dev/null +++ b/vendor/golang.org/x/oauth2/.travis.yml @@ -0,0 +1,13 @@ +language: go + +go: + - tip + +install: + - export GOPATH="$HOME/gopath" + - mkdir -p "$GOPATH/src/golang.org/x" + - mv "$TRAVIS_BUILD_DIR" "$GOPATH/src/golang.org/x/oauth2" + - go get -v -t -d golang.org/x/oauth2/... + +script: + - go test -v golang.org/x/oauth2/... diff --git a/vendor/golang.org/x/oauth2/AUTHORS b/vendor/golang.org/x/oauth2/AUTHORS new file mode 100644 index 000000000..15167cd74 --- /dev/null +++ b/vendor/golang.org/x/oauth2/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/oauth2/CONTRIBUTING.md b/vendor/golang.org/x/oauth2/CONTRIBUTING.md new file mode 100644 index 000000000..dfbed62cf --- /dev/null +++ b/vendor/golang.org/x/oauth2/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to Go + +Go is an open source project. + +It is the work of hundreds of contributors. We appreciate your help! + +## Filing issues + +When [filing an issue](https://github.com/golang/oauth2/issues), make sure to answer these five questions: + +1. What version of Go are you using (`go version`)? +2. What operating system and processor architecture are you using? +3. What did you do? +4. What did you expect to see? +5. What did you see instead? + +General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. +The gophers there will answer or ask you to file an issue if you've tripped over a bug. + +## Contributing code + +Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) +before sending patches. + +Unless otherwise noted, the Go source files are distributed under +the BSD-style license found in the LICENSE file. diff --git a/vendor/golang.org/x/oauth2/CONTRIBUTORS b/vendor/golang.org/x/oauth2/CONTRIBUTORS new file mode 100644 index 000000000..1c4577e96 --- /dev/null +++ b/vendor/golang.org/x/oauth2/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/oauth2/LICENSE b/vendor/golang.org/x/oauth2/LICENSE new file mode 100644 index 000000000..6a66aea5e --- /dev/null +++ b/vendor/golang.org/x/oauth2/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/oauth2/README.md b/vendor/golang.org/x/oauth2/README.md new file mode 100644 index 000000000..68f436ed9 --- /dev/null +++ b/vendor/golang.org/x/oauth2/README.md @@ -0,0 +1,86 @@ +# OAuth2 for Go + +[![Build Status](https://travis-ci.org/golang/oauth2.svg?branch=master)](https://travis-ci.org/golang/oauth2) +[![GoDoc](https://godoc.org/golang.org/x/oauth2?status.svg)](https://godoc.org/golang.org/x/oauth2) + +oauth2 package contains a client implementation for OAuth 2.0 spec. + +## Installation + +~~~~ +go get golang.org/x/oauth2 +~~~~ + +Or you can manually git clone the repository to +`$(go env GOPATH)/src/golang.org/x/oauth2`. + +See godoc for further documentation and examples. + +* [godoc.org/golang.org/x/oauth2](http://godoc.org/golang.org/x/oauth2) +* [godoc.org/golang.org/x/oauth2/google](http://godoc.org/golang.org/x/oauth2/google) + + +## App Engine + +In change 96e89be (March 2015), we removed the `oauth2.Context2` type in favor +of the [`context.Context`](https://golang.org/x/net/context#Context) type from +the `golang.org/x/net/context` package. Later replaced by the standard `context` package +of the [`context.Context`](https://golang.org/pkg/context#Context) type. + + +This means it's no longer possible to use the "Classic App Engine" +`appengine.Context` type with the `oauth2` package. (You're using +Classic App Engine if you import the package `"appengine"`.) + +To work around this, you may use the new `"google.golang.org/appengine"` +package. This package has almost the same API as the `"appengine"` package, +but it can be fetched with `go get` and used on "Managed VMs" and well as +Classic App Engine. + +See the [new `appengine` package's readme](https://github.com/golang/appengine#updating-a-go-app-engine-app) +for information on updating your app. + +If you don't want to update your entire app to use the new App Engine packages, +you may use both sets of packages in parallel, using only the new packages +with the `oauth2` package. + +```go +import ( + "context" + "golang.org/x/oauth2" + "golang.org/x/oauth2/google" + newappengine "google.golang.org/appengine" + newurlfetch "google.golang.org/appengine/urlfetch" + + "appengine" +) + +func handler(w http.ResponseWriter, r *http.Request) { + var c appengine.Context = appengine.NewContext(r) + c.Infof("Logging a message with the old package") + + var ctx context.Context = newappengine.NewContext(r) + client := &http.Client{ + Transport: &oauth2.Transport{ + Source: google.AppEngineTokenSource(ctx, "scope"), + Base: &newurlfetch.Transport{Context: ctx}, + }, + } + client.Get("...") +} +``` + +## Policy for new packages + +We no longer accept new provider-specific packages in this repo. For +defining provider endpoints and provider-specific OAuth2 behavior, we +encourage you to create packages elsewhere. We'll keep the existing +packages for compatibility. + +## Report Issues / Send Patches + +This repository uses Gerrit for code changes. To learn how to submit changes to +this repository, see https://golang.org/doc/contribute.html. + +The main issue tracker for the oauth2 repository is located at +https://github.com/golang/oauth2/issues. diff --git a/vendor/golang.org/x/oauth2/amazon/amazon.go b/vendor/golang.org/x/oauth2/amazon/amazon.go new file mode 100644 index 000000000..d21da11af --- /dev/null +++ b/vendor/golang.org/x/oauth2/amazon/amazon.go @@ -0,0 +1,16 @@ +// Copyright 2017 The oauth2 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 amazon provides constants for using OAuth2 to access Amazon. +package amazon + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Amazon's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://www.amazon.com/ap/oa", + TokenURL: "https://api.amazon.com/auth/o2/token", +} diff --git a/vendor/golang.org/x/oauth2/bitbucket/bitbucket.go b/vendor/golang.org/x/oauth2/bitbucket/bitbucket.go new file mode 100644 index 000000000..44af1f1a9 --- /dev/null +++ b/vendor/golang.org/x/oauth2/bitbucket/bitbucket.go @@ -0,0 +1,16 @@ +// Copyright 2015 The oauth2 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 bitbucket provides constants for using OAuth2 to access Bitbucket. +package bitbucket + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Bitbucket's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://bitbucket.org/site/oauth2/authorize", + TokenURL: "https://bitbucket.org/site/oauth2/access_token", +} diff --git a/vendor/golang.org/x/oauth2/cern/cern.go b/vendor/golang.org/x/oauth2/cern/cern.go new file mode 100644 index 000000000..8be718078 --- /dev/null +++ b/vendor/golang.org/x/oauth2/cern/cern.go @@ -0,0 +1,16 @@ +// 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 file. + +// Package cern provides constants for using OAuth2 to access CERN services. +package cern // import "golang.org/x/oauth2/cern" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is CERN's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://oauth.web.cern.ch/OAuth/Authorize", + TokenURL: "https://oauth.web.cern.ch/OAuth/Token", +} diff --git a/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials.go b/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials.go new file mode 100644 index 000000000..3c816bb8b --- /dev/null +++ b/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials.go @@ -0,0 +1,112 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package clientcredentials implements the OAuth2.0 "client credentials" token flow, +// also known as the "two-legged OAuth 2.0". +// +// This should be used when the client is acting on its own behalf or when the client +// is the resource owner. It may also be used when requesting access to protected +// resources based on an authorization previously arranged with the authorization +// server. +// +// See https://tools.ietf.org/html/rfc6749#section-4.4 +package clientcredentials // import "golang.org/x/oauth2/clientcredentials" + +import ( + "context" + "fmt" + "net/http" + "net/url" + "strings" + + "golang.org/x/oauth2" + "golang.org/x/oauth2/internal" +) + +// Config describes a 2-legged OAuth2 flow, with both the +// client application information and the server's endpoint URLs. +type Config struct { + // ClientID is the application's ID. + ClientID string + + // ClientSecret is the application's secret. + ClientSecret string + + // TokenURL is the resource server's token endpoint + // URL. This is a constant specific to each server. + TokenURL string + + // Scope specifies optional requested permissions. + Scopes []string + + // EndpointParams specifies additional parameters for requests to the token endpoint. + EndpointParams url.Values +} + +// Token uses client credentials to retrieve a token. +// +// The provided context optionally controls which HTTP client is used. See the oauth2.HTTPClient variable. +func (c *Config) Token(ctx context.Context) (*oauth2.Token, error) { + return c.TokenSource(ctx).Token() +} + +// Client returns an HTTP client using the provided token. +// The token will auto-refresh as necessary. +// +// The provided context optionally controls which HTTP client +// is returned. See the oauth2.HTTPClient variable. +// +// The returned Client and its Transport should not be modified. +func (c *Config) Client(ctx context.Context) *http.Client { + return oauth2.NewClient(ctx, c.TokenSource(ctx)) +} + +// TokenSource returns a TokenSource that returns t until t expires, +// automatically refreshing it as necessary using the provided context and the +// client ID and client secret. +// +// Most users will use Config.Client instead. +func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource { + source := &tokenSource{ + ctx: ctx, + conf: c, + } + return oauth2.ReuseTokenSource(nil, source) +} + +type tokenSource struct { + ctx context.Context + conf *Config +} + +// Token refreshes the token by using a new client credentials request. +// tokens received this way do not include a refresh token +func (c *tokenSource) Token() (*oauth2.Token, error) { + v := url.Values{ + "grant_type": {"client_credentials"}, + } + if len(c.conf.Scopes) > 0 { + v.Set("scope", strings.Join(c.conf.Scopes, " ")) + } + for k, p := range c.conf.EndpointParams { + if _, ok := v[k]; ok { + return nil, fmt.Errorf("oauth2: cannot overwrite parameter %q", k) + } + v[k] = p + } + tk, err := internal.RetrieveToken(c.ctx, c.conf.ClientID, c.conf.ClientSecret, c.conf.TokenURL, v) + if err != nil { + if rErr, ok := err.(*internal.RetrieveError); ok { + return nil, (*oauth2.RetrieveError)(rErr) + } + return nil, err + } + t := &oauth2.Token{ + AccessToken: tk.AccessToken, + TokenType: tk.TokenType, + RefreshToken: tk.RefreshToken, + Expiry: tk.Expiry, + } + return t.WithExtra(tk.Raw), nil +} diff --git a/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials_test.go b/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials_test.go new file mode 100644 index 000000000..108520c16 --- /dev/null +++ b/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials_test.go @@ -0,0 +1,97 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package clientcredentials + +import ( + "context" + "io/ioutil" + "net/http" + "net/http/httptest" + "net/url" + "testing" +) + +func newConf(serverURL string) *Config { + return &Config{ + ClientID: "CLIENT_ID", + ClientSecret: "CLIENT_SECRET", + Scopes: []string{"scope1", "scope2"}, + TokenURL: serverURL + "/token", + EndpointParams: url.Values{"audience": {"audience1"}}, + } +} + +type mockTransport struct { + rt func(req *http.Request) (resp *http.Response, err error) +} + +func (t *mockTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) { + return t.rt(req) +} + +func TestTokenRequest(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.String() != "/token" { + t.Errorf("authenticate client request URL = %q; want %q", r.URL, "/token") + } + headerAuth := r.Header.Get("Authorization") + if headerAuth != "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" { + t.Errorf("Unexpected authorization header, %v is found.", headerAuth) + } + if got, want := r.Header.Get("Content-Type"), "application/x-www-form-urlencoded"; got != want { + t.Errorf("Content-Type header = %q; want %q", got, want) + } + body, err := ioutil.ReadAll(r.Body) + if err != nil { + r.Body.Close() + } + if err != nil { + t.Errorf("failed reading request body: %s.", err) + } + if string(body) != "audience=audience1&grant_type=client_credentials&scope=scope1+scope2" { + t.Errorf("payload = %q; want %q", string(body), "grant_type=client_credentials&scope=scope1+scope2") + } + w.Header().Set("Content-Type", "application/x-www-form-urlencoded") + w.Write([]byte("access_token=90d64460d14870c08c81352a05dedd3465940a7c&token_type=bearer")) + })) + defer ts.Close() + conf := newConf(ts.URL) + tok, err := conf.Token(context.Background()) + if err != nil { + t.Error(err) + } + if !tok.Valid() { + t.Fatalf("token invalid. got: %#v", tok) + } + if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" { + t.Errorf("Access token = %q; want %q", tok.AccessToken, "90d64460d14870c08c81352a05dedd3465940a7c") + } + if tok.TokenType != "bearer" { + t.Errorf("token type = %q; want %q", tok.TokenType, "bearer") + } +} + +func TestTokenRefreshRequest(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.String() == "/somethingelse" { + return + } + if r.URL.String() != "/token" { + t.Errorf("Unexpected token refresh request URL, %v is found.", r.URL) + } + headerContentType := r.Header.Get("Content-Type") + if headerContentType != "application/x-www-form-urlencoded" { + t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) + } + body, _ := ioutil.ReadAll(r.Body) + if string(body) != "audience=audience1&grant_type=client_credentials&scope=scope1+scope2" { + t.Errorf("Unexpected refresh token payload, %v is found.", string(body)) + } + })) + defer ts.Close() + conf := newConf(ts.URL) + c := conf.Client(context.Background()) + c.Get(ts.URL + "/somethingelse") +} diff --git a/vendor/golang.org/x/oauth2/example_test.go b/vendor/golang.org/x/oauth2/example_test.go new file mode 100644 index 000000000..fc2f793b2 --- /dev/null +++ b/vendor/golang.org/x/oauth2/example_test.go @@ -0,0 +1,89 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package oauth2_test + +import ( + "context" + "fmt" + "log" + "net/http" + "time" + + "golang.org/x/oauth2" +) + +func ExampleConfig() { + ctx := context.Background() + conf := &oauth2.Config{ + ClientID: "YOUR_CLIENT_ID", + ClientSecret: "YOUR_CLIENT_SECRET", + Scopes: []string{"SCOPE1", "SCOPE2"}, + Endpoint: oauth2.Endpoint{ + AuthURL: "https://provider.com/o/oauth2/auth", + TokenURL: "https://provider.com/o/oauth2/token", + }, + } + + // Redirect user to consent page to ask for permission + // for the scopes specified above. + url := conf.AuthCodeURL("state", oauth2.AccessTypeOffline) + fmt.Printf("Visit the URL for the auth dialog: %v", url) + + // Use the authorization code that is pushed to the redirect + // URL. Exchange will do the handshake to retrieve the + // initial access token. The HTTP Client returned by + // conf.Client will refresh the token as necessary. + var code string + if _, err := fmt.Scan(&code); err != nil { + log.Fatal(err) + } + tok, err := conf.Exchange(ctx, code) + if err != nil { + log.Fatal(err) + } + + client := conf.Client(ctx, tok) + client.Get("...") +} + +func ExampleConfig_customHTTP() { + ctx := context.Background() + + conf := &oauth2.Config{ + ClientID: "YOUR_CLIENT_ID", + ClientSecret: "YOUR_CLIENT_SECRET", + Scopes: []string{"SCOPE1", "SCOPE2"}, + Endpoint: oauth2.Endpoint{ + TokenURL: "https://provider.com/o/oauth2/token", + AuthURL: "https://provider.com/o/oauth2/auth", + }, + } + + // Redirect user to consent page to ask for permission + // for the scopes specified above. + url := conf.AuthCodeURL("state", oauth2.AccessTypeOffline) + fmt.Printf("Visit the URL for the auth dialog: %v", url) + + // Use the authorization code that is pushed to the redirect + // URL. Exchange will do the handshake to retrieve the + // initial access token. The HTTP Client returned by + // conf.Client will refresh the token as necessary. + var code string + if _, err := fmt.Scan(&code); err != nil { + log.Fatal(err) + } + + // Use the custom HTTP client when requesting a token. + httpClient := &http.Client{Timeout: 2 * time.Second} + ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient) + + tok, err := conf.Exchange(ctx, code) + if err != nil { + log.Fatal(err) + } + + client := conf.Client(ctx, tok) + _ = client +} diff --git a/vendor/golang.org/x/oauth2/facebook/facebook.go b/vendor/golang.org/x/oauth2/facebook/facebook.go new file mode 100644 index 000000000..21c49e7f2 --- /dev/null +++ b/vendor/golang.org/x/oauth2/facebook/facebook.go @@ -0,0 +1,16 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package facebook provides constants for using OAuth2 to access Facebook. +package facebook // import "golang.org/x/oauth2/facebook" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Facebook's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://www.facebook.com/v3.1/dialog/oauth", + TokenURL: "https://graph.facebook.com/v3.1/oauth/access_token", +} diff --git a/vendor/golang.org/x/oauth2/fitbit/fitbit.go b/vendor/golang.org/x/oauth2/fitbit/fitbit.go new file mode 100644 index 000000000..b31b82aca --- /dev/null +++ b/vendor/golang.org/x/oauth2/fitbit/fitbit.go @@ -0,0 +1,16 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package fitbit provides constants for using OAuth2 to access the Fitbit API. +package fitbit // import "golang.org/x/oauth2/fitbit" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is the Fitbit API's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://www.fitbit.com/oauth2/authorize", + TokenURL: "https://api.fitbit.com/oauth2/token", +} diff --git a/vendor/golang.org/x/oauth2/foursquare/foursquare.go b/vendor/golang.org/x/oauth2/foursquare/foursquare.go new file mode 100644 index 000000000..d2fa09902 --- /dev/null +++ b/vendor/golang.org/x/oauth2/foursquare/foursquare.go @@ -0,0 +1,16 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package foursquare provides constants for using OAuth2 to access Foursquare. +package foursquare // import "golang.org/x/oauth2/foursquare" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Foursquare's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://foursquare.com/oauth2/authorize", + TokenURL: "https://foursquare.com/oauth2/access_token", +} diff --git a/vendor/golang.org/x/oauth2/github/github.go b/vendor/golang.org/x/oauth2/github/github.go new file mode 100644 index 000000000..f2978015b --- /dev/null +++ b/vendor/golang.org/x/oauth2/github/github.go @@ -0,0 +1,16 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package github provides constants for using OAuth2 to access Github. +package github // import "golang.org/x/oauth2/github" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Github's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://github.com/login/oauth/authorize", + TokenURL: "https://github.com/login/oauth/access_token", +} diff --git a/vendor/golang.org/x/oauth2/gitlab/gitlab.go b/vendor/golang.org/x/oauth2/gitlab/gitlab.go new file mode 100644 index 000000000..1231d75ac --- /dev/null +++ b/vendor/golang.org/x/oauth2/gitlab/gitlab.go @@ -0,0 +1,16 @@ +// 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 file. + +// Package gitlab provides constants for using OAuth2 to access GitLab. +package gitlab // import "golang.org/x/oauth2/gitlab" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is GitLab's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://gitlab.com/oauth/authorize", + TokenURL: "https://gitlab.com/oauth/token", +} diff --git a/vendor/golang.org/x/oauth2/google/appengine.go b/vendor/golang.org/x/oauth2/google/appengine.go new file mode 100644 index 000000000..feb1157b1 --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/appengine.go @@ -0,0 +1,38 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package google + +import ( + "context" + "time" + + "golang.org/x/oauth2" +) + +// Set at init time by appengine_gen1.go. If nil, we're not on App Engine standard first generation (<= Go 1.9) or App Engine flexible. +var appengineTokenFunc func(c context.Context, scopes ...string) (token string, expiry time.Time, err error) + +// Set at init time by appengine_gen1.go. If nil, we're not on App Engine standard first generation (<= Go 1.9) or App Engine flexible. +var appengineAppIDFunc func(c context.Context) string + +// AppEngineTokenSource returns a token source that fetches tokens from either +// the current application's service account or from the metadata server, +// depending on the App Engine environment. See below for environment-specific +// details. If you are implementing a 3-legged OAuth 2.0 flow on App Engine that +// involves user accounts, see oauth2.Config instead. +// +// First generation App Engine runtimes (<= Go 1.9): +// AppEngineTokenSource returns a token source that fetches tokens issued to the +// current App Engine application's service account. The provided context must have +// come from appengine.NewContext. +// +// Second generation App Engine runtimes (>= Go 1.11) and App Engine flexible: +// AppEngineTokenSource is DEPRECATED on second generation runtimes and on the +// flexible environment. It delegates to ComputeTokenSource, and the provided +// context and scopes are not used. Please use DefaultTokenSource (or ComputeTokenSource, +// which DefaultTokenSource will use in this case) instead. +func AppEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource { + return appEngineTokenSource(ctx, scope...) +} diff --git a/vendor/golang.org/x/oauth2/google/appengine_gen1.go b/vendor/golang.org/x/oauth2/google/appengine_gen1.go new file mode 100644 index 000000000..83dacac32 --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/appengine_gen1.go @@ -0,0 +1,77 @@ +// 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 file. + +// +build appengine + +// This file applies to App Engine first generation runtimes (<= Go 1.9). + +package google + +import ( + "context" + "sort" + "strings" + "sync" + + "golang.org/x/oauth2" + "google.golang.org/appengine" +) + +func init() { + appengineTokenFunc = appengine.AccessToken + appengineAppIDFunc = appengine.AppID +} + +// See comment on AppEngineTokenSource in appengine.go. +func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource { + scopes := append([]string{}, scope...) + sort.Strings(scopes) + return &gaeTokenSource{ + ctx: ctx, + scopes: scopes, + key: strings.Join(scopes, " "), + } +} + +// aeTokens helps the fetched tokens to be reused until their expiration. +var ( + aeTokensMu sync.Mutex + aeTokens = make(map[string]*tokenLock) // key is space-separated scopes +) + +type tokenLock struct { + mu sync.Mutex // guards t; held while fetching or updating t + t *oauth2.Token +} + +type gaeTokenSource struct { + ctx context.Context + scopes []string + key string // to aeTokens map; space-separated scopes +} + +func (ts *gaeTokenSource) Token() (*oauth2.Token, error) { + aeTokensMu.Lock() + tok, ok := aeTokens[ts.key] + if !ok { + tok = &tokenLock{} + aeTokens[ts.key] = tok + } + aeTokensMu.Unlock() + + tok.mu.Lock() + defer tok.mu.Unlock() + if tok.t.Valid() { + return tok.t, nil + } + access, exp, err := appengineTokenFunc(ts.ctx, ts.scopes...) + if err != nil { + return nil, err + } + tok.t = &oauth2.Token{ + AccessToken: access, + Expiry: exp, + } + return tok.t, nil +} diff --git a/vendor/golang.org/x/oauth2/google/appengine_gen2_flex.go b/vendor/golang.org/x/oauth2/google/appengine_gen2_flex.go new file mode 100644 index 000000000..04c2c2216 --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/appengine_gen2_flex.go @@ -0,0 +1,27 @@ +// 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 file. + +// +build !appengine + +// This file applies to App Engine second generation runtimes (>= Go 1.11) and App Engine flexible. + +package google + +import ( + "context" + "log" + "sync" + + "golang.org/x/oauth2" +) + +var logOnce sync.Once // only spam about deprecation once + +// See comment on AppEngineTokenSource in appengine.go. +func appEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource { + logOnce.Do(func() { + log.Print("google: AppEngineTokenSource is deprecated on App Engine standard second generation runtimes (>= Go 1.11) and App Engine flexible. Please use DefaultTokenSource or ComputeTokenSource.") + }) + return ComputeTokenSource("") +} diff --git a/vendor/golang.org/x/oauth2/google/default.go b/vendor/golang.org/x/oauth2/google/default.go new file mode 100644 index 000000000..5087d845f --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/default.go @@ -0,0 +1,155 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package google + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "os" + "path/filepath" + "runtime" + + "cloud.google.com/go/compute/metadata" + "golang.org/x/oauth2" +) + +// Credentials holds Google credentials, including "Application Default Credentials". +// For more details, see: +// https://developers.google.com/accounts/docs/application-default-credentials +type Credentials struct { + ProjectID string // may be empty + TokenSource oauth2.TokenSource + + // JSON contains the raw bytes from a JSON credentials file. + // This field may be nil if authentication is provided by the + // environment and not with a credentials file, e.g. when code is + // running on Google Cloud Platform. + JSON []byte +} + +// DefaultCredentials is the old name of Credentials. +// +// Deprecated: use Credentials instead. +type DefaultCredentials = Credentials + +// DefaultClient returns an HTTP Client that uses the +// DefaultTokenSource to obtain authentication credentials. +func DefaultClient(ctx context.Context, scope ...string) (*http.Client, error) { + ts, err := DefaultTokenSource(ctx, scope...) + if err != nil { + return nil, err + } + return oauth2.NewClient(ctx, ts), nil +} + +// DefaultTokenSource returns the token source for +// "Application Default Credentials". +// It is a shortcut for FindDefaultCredentials(ctx, scope).TokenSource. +func DefaultTokenSource(ctx context.Context, scope ...string) (oauth2.TokenSource, error) { + creds, err := FindDefaultCredentials(ctx, scope...) + if err != nil { + return nil, err + } + return creds.TokenSource, nil +} + +// FindDefaultCredentials searches for "Application Default Credentials". +// +// It looks for credentials in the following places, +// preferring the first location found: +// +// 1. A JSON file whose path is specified by the +// GOOGLE_APPLICATION_CREDENTIALS environment variable. +// 2. A JSON file in a location known to the gcloud command-line tool. +// On Windows, this is %APPDATA%/gcloud/application_default_credentials.json. +// On other systems, $HOME/.config/gcloud/application_default_credentials.json. +// 3. On Google App Engine standard first generation runtimes (<= Go 1.9) it uses +// the appengine.AccessToken function. +// 4. On Google Compute Engine, Google App Engine standard second generation runtimes +// (>= Go 1.11), and Google App Engine flexible environment, it fetches +// credentials from the metadata server. +// (In this final case any provided scopes are ignored.) +func FindDefaultCredentials(ctx context.Context, scopes ...string) (*Credentials, error) { + // First, try the environment variable. + const envVar = "GOOGLE_APPLICATION_CREDENTIALS" + if filename := os.Getenv(envVar); filename != "" { + creds, err := readCredentialsFile(ctx, filename, scopes) + if err != nil { + return nil, fmt.Errorf("google: error getting credentials using %v environment variable: %v", envVar, err) + } + return creds, nil + } + + // Second, try a well-known file. + filename := wellKnownFile() + if creds, err := readCredentialsFile(ctx, filename, scopes); err == nil { + return creds, nil + } else if !os.IsNotExist(err) { + return nil, fmt.Errorf("google: error getting credentials using well-known file (%v): %v", filename, err) + } + + // Third, if we're on a Google App Engine standard first generation runtime (<= Go 1.9) + // use those credentials. App Engine standard second generation runtimes (>= Go 1.11) + // and App Engine flexible use ComputeTokenSource and the metadata server. + if appengineTokenFunc != nil { + return &DefaultCredentials{ + ProjectID: appengineAppIDFunc(ctx), + TokenSource: AppEngineTokenSource(ctx, scopes...), + }, nil + } + + // Fourth, if we're on Google Compute Engine, an App Engine standard second generation runtime, + // or App Engine flexible, use the metadata server. + if metadata.OnGCE() { + id, _ := metadata.ProjectID() + return &DefaultCredentials{ + ProjectID: id, + TokenSource: ComputeTokenSource(""), + }, nil + } + + // None are found; return helpful error. + const url = "https://developers.google.com/accounts/docs/application-default-credentials" + return nil, fmt.Errorf("google: could not find default credentials. See %v for more information.", url) +} + +// CredentialsFromJSON obtains Google credentials from a JSON value. The JSON can +// represent either a Google Developers Console client_credentials.json file (as in +// ConfigFromJSON) or a Google Developers service account key file (as in +// JWTConfigFromJSON). +func CredentialsFromJSON(ctx context.Context, jsonData []byte, scopes ...string) (*Credentials, error) { + var f credentialsFile + if err := json.Unmarshal(jsonData, &f); err != nil { + return nil, err + } + ts, err := f.tokenSource(ctx, append([]string(nil), scopes...)) + if err != nil { + return nil, err + } + return &DefaultCredentials{ + ProjectID: f.ProjectID, + TokenSource: ts, + JSON: jsonData, + }, nil +} + +func wellKnownFile() string { + const f = "application_default_credentials.json" + if runtime.GOOS == "windows" { + return filepath.Join(os.Getenv("APPDATA"), "gcloud", f) + } + return filepath.Join(guessUnixHomeDir(), ".config", "gcloud", f) +} + +func readCredentialsFile(ctx context.Context, filename string, scopes []string) (*DefaultCredentials, error) { + b, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + return CredentialsFromJSON(ctx, b, scopes...) +} diff --git a/vendor/golang.org/x/oauth2/google/doc.go b/vendor/golang.org/x/oauth2/google/doc.go new file mode 100644 index 000000000..73be62903 --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/doc.go @@ -0,0 +1,40 @@ +// 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 file. + +// Package google provides support for making OAuth2 authorized and authenticated +// HTTP requests to Google APIs. It supports the Web server flow, client-side +// credentials, service accounts, Google Compute Engine service accounts, and Google +// App Engine service accounts. +// +// A brief overview of the package follows. For more information, please read +// https://developers.google.com/accounts/docs/OAuth2 +// and +// https://developers.google.com/accounts/docs/application-default-credentials. +// +// OAuth2 Configs +// +// Two functions in this package return golang.org/x/oauth2.Config values from Google credential +// data. Google supports two JSON formats for OAuth2 credentials: one is handled by ConfigFromJSON, +// the other by JWTConfigFromJSON. The returned Config can be used to obtain a TokenSource or +// create an http.Client. +// +// +// Credentials +// +// The Credentials type represents Google credentials, including Application Default +// Credentials. +// +// Use FindDefaultCredentials to obtain Application Default Credentials. +// FindDefaultCredentials looks in some well-known places for a credentials file, and +// will call AppEngineTokenSource or ComputeTokenSource as needed. +// +// DefaultClient and DefaultTokenSource are convenience methods. They first call FindDefaultCredentials, +// then use the credentials to construct an http.Client or an oauth2.TokenSource. +// +// Use CredentialsFromJSON to obtain credentials from either of the two JSON formats +// described in OAuth2 Configs, above. The TokenSource in the returned value is the +// same as the one obtained from the oauth2.Config returned from ConfigFromJSON or +// JWTConfigFromJSON, but the Credentials may contain additional information +// that is useful is some circumstances. +package google // import "golang.org/x/oauth2/google" diff --git a/vendor/golang.org/x/oauth2/google/example_test.go b/vendor/golang.org/x/oauth2/google/example_test.go new file mode 100644 index 000000000..d9c5a104d --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/example_test.go @@ -0,0 +1,162 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package google_test + +import ( + "context" + "fmt" + "io/ioutil" + "log" + "net/http" + + "golang.org/x/oauth2" + "golang.org/x/oauth2/google" + "golang.org/x/oauth2/jwt" + "google.golang.org/appengine" + "google.golang.org/appengine/urlfetch" +) + +func ExampleDefaultClient() { + client, err := google.DefaultClient(oauth2.NoContext, + "https://www.googleapis.com/auth/devstorage.full_control") + if err != nil { + log.Fatal(err) + } + client.Get("...") +} + +func Example_webServer() { + // Your credentials should be obtained from the Google + // Developer Console (https://console.developers.google.com). + conf := &oauth2.Config{ + ClientID: "YOUR_CLIENT_ID", + ClientSecret: "YOUR_CLIENT_SECRET", + RedirectURL: "YOUR_REDIRECT_URL", + Scopes: []string{ + "https://www.googleapis.com/auth/bigquery", + "https://www.googleapis.com/auth/blogger", + }, + Endpoint: google.Endpoint, + } + // Redirect user to Google's consent page to ask for permission + // for the scopes specified above. + url := conf.AuthCodeURL("state") + fmt.Printf("Visit the URL for the auth dialog: %v", url) + + // Handle the exchange code to initiate a transport. + tok, err := conf.Exchange(oauth2.NoContext, "authorization-code") + if err != nil { + log.Fatal(err) + } + client := conf.Client(oauth2.NoContext, tok) + client.Get("...") +} + +func ExampleJWTConfigFromJSON() { + // Your credentials should be obtained from the Google + // Developer Console (https://console.developers.google.com). + // Navigate to your project, then see the "Credentials" page + // under "APIs & Auth". + // To create a service account client, click "Create new Client ID", + // select "Service Account", and click "Create Client ID". A JSON + // key file will then be downloaded to your computer. + data, err := ioutil.ReadFile("/path/to/your-project-key.json") + if err != nil { + log.Fatal(err) + } + conf, err := google.JWTConfigFromJSON(data, "https://www.googleapis.com/auth/bigquery") + if err != nil { + log.Fatal(err) + } + // Initiate an http.Client. The following GET request will be + // authorized and authenticated on the behalf of + // your service account. + client := conf.Client(oauth2.NoContext) + client.Get("...") +} + +func ExampleSDKConfig() { + // The credentials will be obtained from the first account that + // has been authorized with `gcloud auth login`. + conf, err := google.NewSDKConfig("") + if err != nil { + log.Fatal(err) + } + // Initiate an http.Client. The following GET request will be + // authorized and authenticated on the behalf of the SDK user. + client := conf.Client(oauth2.NoContext) + client.Get("...") +} + +func Example_serviceAccount() { + // Your credentials should be obtained from the Google + // Developer Console (https://console.developers.google.com). + conf := &jwt.Config{ + Email: "xxx@developer.gserviceaccount.com", + // The contents of your RSA private key or your PEM file + // that contains a private key. + // If you have a p12 file instead, you + // can use `openssl` to export the private key into a pem file. + // + // $ openssl pkcs12 -in key.p12 -passin pass:notasecret -out key.pem -nodes + // + // The field only supports PEM containers with no passphrase. + // The openssl command will convert p12 keys to passphrase-less PEM containers. + PrivateKey: []byte("-----BEGIN RSA PRIVATE KEY-----..."), + Scopes: []string{ + "https://www.googleapis.com/auth/bigquery", + "https://www.googleapis.com/auth/blogger", + }, + TokenURL: google.JWTTokenURL, + // If you would like to impersonate a user, you can + // create a transport with a subject. The following GET + // request will be made on the behalf of user@example.com. + // Optional. + Subject: "user@example.com", + } + // Initiate an http.Client, the following GET request will be + // authorized and authenticated on the behalf of user@example.com. + client := conf.Client(oauth2.NoContext) + client.Get("...") +} + +func ExampleAppEngineTokenSource() { + var req *http.Request // from the ServeHTTP handler + ctx := appengine.NewContext(req) + client := &http.Client{ + Transport: &oauth2.Transport{ + Source: google.AppEngineTokenSource(ctx, "https://www.googleapis.com/auth/bigquery"), + Base: &urlfetch.Transport{ + Context: ctx, + }, + }, + } + client.Get("...") +} + +func ExampleComputeTokenSource() { + client := &http.Client{ + Transport: &oauth2.Transport{ + // Fetch from Google Compute Engine's metadata server to retrieve + // an access token for the provided account. + // If no account is specified, "default" is used. + Source: google.ComputeTokenSource(""), + }, + } + client.Get("...") +} + +func ExampleCredentialsFromJSON() { + ctx := context.Background() + data, err := ioutil.ReadFile("/path/to/key-file.json") + if err != nil { + log.Fatal(err) + } + creds, err := google.CredentialsFromJSON(ctx, data, "https://www.googleapis.com/auth/bigquery") + if err != nil { + log.Fatal(err) + } + _ = creds // TODO: Use creds. +} diff --git a/vendor/golang.org/x/oauth2/google/google.go b/vendor/golang.org/x/oauth2/google/google.go new file mode 100644 index 000000000..ca7d208d7 --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/google.go @@ -0,0 +1,192 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package google + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "strings" + "time" + + "cloud.google.com/go/compute/metadata" + "golang.org/x/oauth2" + "golang.org/x/oauth2/jwt" +) + +// Endpoint is Google's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://accounts.google.com/o/oauth2/auth", + TokenURL: "https://accounts.google.com/o/oauth2/token", +} + +// JWTTokenURL is Google's OAuth 2.0 token URL to use with the JWT flow. +const JWTTokenURL = "https://accounts.google.com/o/oauth2/token" + +// ConfigFromJSON uses a Google Developers Console client_credentials.json +// file to construct a config. +// client_credentials.json can be downloaded from +// https://console.developers.google.com, under "Credentials". Download the Web +// application credentials in the JSON format and provide the contents of the +// file as jsonKey. +func ConfigFromJSON(jsonKey []byte, scope ...string) (*oauth2.Config, error) { + type cred struct { + ClientID string `json:"client_id"` + ClientSecret string `json:"client_secret"` + RedirectURIs []string `json:"redirect_uris"` + AuthURI string `json:"auth_uri"` + TokenURI string `json:"token_uri"` + } + var j struct { + Web *cred `json:"web"` + Installed *cred `json:"installed"` + } + if err := json.Unmarshal(jsonKey, &j); err != nil { + return nil, err + } + var c *cred + switch { + case j.Web != nil: + c = j.Web + case j.Installed != nil: + c = j.Installed + default: + return nil, fmt.Errorf("oauth2/google: no credentials found") + } + if len(c.RedirectURIs) < 1 { + return nil, errors.New("oauth2/google: missing redirect URL in the client_credentials.json") + } + return &oauth2.Config{ + ClientID: c.ClientID, + ClientSecret: c.ClientSecret, + RedirectURL: c.RedirectURIs[0], + Scopes: scope, + Endpoint: oauth2.Endpoint{ + AuthURL: c.AuthURI, + TokenURL: c.TokenURI, + }, + }, nil +} + +// JWTConfigFromJSON uses a Google Developers service account JSON key file to read +// the credentials that authorize and authenticate the requests. +// Create a service account on "Credentials" for your project at +// https://console.developers.google.com to download a JSON key file. +func JWTConfigFromJSON(jsonKey []byte, scope ...string) (*jwt.Config, error) { + var f credentialsFile + if err := json.Unmarshal(jsonKey, &f); err != nil { + return nil, err + } + if f.Type != serviceAccountKey { + return nil, fmt.Errorf("google: read JWT from JSON credentials: 'type' field is %q (expected %q)", f.Type, serviceAccountKey) + } + scope = append([]string(nil), scope...) // copy + return f.jwtConfig(scope), nil +} + +// JSON key file types. +const ( + serviceAccountKey = "service_account" + userCredentialsKey = "authorized_user" +) + +// credentialsFile is the unmarshalled representation of a credentials file. +type credentialsFile struct { + Type string `json:"type"` // serviceAccountKey or userCredentialsKey + + // Service Account fields + ClientEmail string `json:"client_email"` + PrivateKeyID string `json:"private_key_id"` + PrivateKey string `json:"private_key"` + TokenURL string `json:"token_uri"` + ProjectID string `json:"project_id"` + + // User Credential fields + // (These typically come from gcloud auth.) + ClientSecret string `json:"client_secret"` + ClientID string `json:"client_id"` + RefreshToken string `json:"refresh_token"` +} + +func (f *credentialsFile) jwtConfig(scopes []string) *jwt.Config { + cfg := &jwt.Config{ + Email: f.ClientEmail, + PrivateKey: []byte(f.PrivateKey), + PrivateKeyID: f.PrivateKeyID, + Scopes: scopes, + TokenURL: f.TokenURL, + } + if cfg.TokenURL == "" { + cfg.TokenURL = JWTTokenURL + } + return cfg +} + +func (f *credentialsFile) tokenSource(ctx context.Context, scopes []string) (oauth2.TokenSource, error) { + switch f.Type { + case serviceAccountKey: + cfg := f.jwtConfig(scopes) + return cfg.TokenSource(ctx), nil + case userCredentialsKey: + cfg := &oauth2.Config{ + ClientID: f.ClientID, + ClientSecret: f.ClientSecret, + Scopes: scopes, + Endpoint: Endpoint, + } + tok := &oauth2.Token{RefreshToken: f.RefreshToken} + return cfg.TokenSource(ctx, tok), nil + case "": + return nil, errors.New("missing 'type' field in credentials") + default: + return nil, fmt.Errorf("unknown credential type: %q", f.Type) + } +} + +// ComputeTokenSource returns a token source that fetches access tokens +// from Google Compute Engine (GCE)'s metadata server. It's only valid to use +// this token source if your program is running on a GCE instance. +// If no account is specified, "default" is used. +// Further information about retrieving access tokens from the GCE metadata +// server can be found at https://cloud.google.com/compute/docs/authentication. +func ComputeTokenSource(account string) oauth2.TokenSource { + return oauth2.ReuseTokenSource(nil, computeSource{account: account}) +} + +type computeSource struct { + account string +} + +func (cs computeSource) Token() (*oauth2.Token, error) { + if !metadata.OnGCE() { + return nil, errors.New("oauth2/google: can't get a token from the metadata service; not running on GCE") + } + acct := cs.account + if acct == "" { + acct = "default" + } + tokenJSON, err := metadata.Get("instance/service-accounts/" + acct + "/token") + if err != nil { + return nil, err + } + var res struct { + AccessToken string `json:"access_token"` + ExpiresInSec int `json:"expires_in"` + TokenType string `json:"token_type"` + } + err = json.NewDecoder(strings.NewReader(tokenJSON)).Decode(&res) + if err != nil { + return nil, fmt.Errorf("oauth2/google: invalid token JSON from metadata: %v", err) + } + if res.ExpiresInSec == 0 || res.AccessToken == "" { + return nil, fmt.Errorf("oauth2/google: incomplete token received from metadata") + } + return &oauth2.Token{ + AccessToken: res.AccessToken, + TokenType: res.TokenType, + Expiry: time.Now().Add(time.Duration(res.ExpiresInSec) * time.Second), + }, nil +} diff --git a/vendor/golang.org/x/oauth2/google/google_test.go b/vendor/golang.org/x/oauth2/google/google_test.go new file mode 100644 index 000000000..287c699e7 --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/google_test.go @@ -0,0 +1,116 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package google + +import ( + "strings" + "testing" +) + +var webJSONKey = []byte(` +{ + "web": { + "auth_uri": "https://google.com/o/oauth2/auth", + "client_secret": "3Oknc4jS_wA2r9i", + "token_uri": "https://google.com/o/oauth2/token", + "client_email": "222-nprqovg5k43uum874cs9osjt2koe97g8@developer.gserviceaccount.com", + "redirect_uris": ["https://www.example.com/oauth2callback"], + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/222-nprqovg5k43uum874cs9osjt2koe97g8@developer.gserviceaccount.com", + "client_id": "222-nprqovg5k43uum874cs9osjt2koe97g8.apps.googleusercontent.com", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "javascript_origins": ["https://www.example.com"] + } +}`) + +var installedJSONKey = []byte(`{ + "installed": { + "client_id": "222-installed.apps.googleusercontent.com", + "redirect_uris": ["https://www.example.com/oauth2callback"] + } +}`) + +var jwtJSONKey = []byte(`{ + "private_key_id": "268f54e43a1af97cfc71731688434f45aca15c8b", + "private_key": "super secret key", + "client_email": "gopher@developer.gserviceaccount.com", + "client_id": "gopher.apps.googleusercontent.com", + "token_uri": "https://accounts.google.com/o/gophers/token", + "type": "service_account" +}`) + +var jwtJSONKeyNoTokenURL = []byte(`{ + "private_key_id": "268f54e43a1af97cfc71731688434f45aca15c8b", + "private_key": "super secret key", + "client_email": "gopher@developer.gserviceaccount.com", + "client_id": "gopher.apps.googleusercontent.com", + "type": "service_account" +}`) + +func TestConfigFromJSON(t *testing.T) { + conf, err := ConfigFromJSON(webJSONKey, "scope1", "scope2") + if err != nil { + t.Error(err) + } + if got, want := conf.ClientID, "222-nprqovg5k43uum874cs9osjt2koe97g8.apps.googleusercontent.com"; got != want { + t.Errorf("ClientID = %q; want %q", got, want) + } + if got, want := conf.ClientSecret, "3Oknc4jS_wA2r9i"; got != want { + t.Errorf("ClientSecret = %q; want %q", got, want) + } + if got, want := conf.RedirectURL, "https://www.example.com/oauth2callback"; got != want { + t.Errorf("RedictURL = %q; want %q", got, want) + } + if got, want := strings.Join(conf.Scopes, ","), "scope1,scope2"; got != want { + t.Errorf("Scopes = %q; want %q", got, want) + } + if got, want := conf.Endpoint.AuthURL, "https://google.com/o/oauth2/auth"; got != want { + t.Errorf("AuthURL = %q; want %q", got, want) + } + if got, want := conf.Endpoint.TokenURL, "https://google.com/o/oauth2/token"; got != want { + t.Errorf("TokenURL = %q; want %q", got, want) + } +} + +func TestConfigFromJSON_Installed(t *testing.T) { + conf, err := ConfigFromJSON(installedJSONKey) + if err != nil { + t.Error(err) + } + if got, want := conf.ClientID, "222-installed.apps.googleusercontent.com"; got != want { + t.Errorf("ClientID = %q; want %q", got, want) + } +} + +func TestJWTConfigFromJSON(t *testing.T) { + conf, err := JWTConfigFromJSON(jwtJSONKey, "scope1", "scope2") + if err != nil { + t.Fatal(err) + } + if got, want := conf.Email, "gopher@developer.gserviceaccount.com"; got != want { + t.Errorf("Email = %q, want %q", got, want) + } + if got, want := string(conf.PrivateKey), "super secret key"; got != want { + t.Errorf("PrivateKey = %q, want %q", got, want) + } + if got, want := conf.PrivateKeyID, "268f54e43a1af97cfc71731688434f45aca15c8b"; got != want { + t.Errorf("PrivateKeyID = %q, want %q", got, want) + } + if got, want := strings.Join(conf.Scopes, ","), "scope1,scope2"; got != want { + t.Errorf("Scopes = %q; want %q", got, want) + } + if got, want := conf.TokenURL, "https://accounts.google.com/o/gophers/token"; got != want { + t.Errorf("TokenURL = %q; want %q", got, want) + } +} + +func TestJWTConfigFromJSONNoTokenURL(t *testing.T) { + conf, err := JWTConfigFromJSON(jwtJSONKeyNoTokenURL, "scope1", "scope2") + if err != nil { + t.Fatal(err) + } + if got, want := conf.TokenURL, "https://accounts.google.com/o/oauth2/token"; got != want { + t.Errorf("TokenURL = %q; want %q", got, want) + } +} diff --git a/vendor/golang.org/x/oauth2/google/jwt.go b/vendor/golang.org/x/oauth2/google/jwt.go new file mode 100644 index 000000000..b0fdb3a88 --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/jwt.go @@ -0,0 +1,74 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package google + +import ( + "crypto/rsa" + "fmt" + "time" + + "golang.org/x/oauth2" + "golang.org/x/oauth2/internal" + "golang.org/x/oauth2/jws" +) + +// JWTAccessTokenSourceFromJSON uses a Google Developers service account JSON +// key file to read the credentials that authorize and authenticate the +// requests, and returns a TokenSource that does not use any OAuth2 flow but +// instead creates a JWT and sends that as the access token. +// The audience is typically a URL that specifies the scope of the credentials. +// +// Note that this is not a standard OAuth flow, but rather an +// optimization supported by a few Google services. +// Unless you know otherwise, you should use JWTConfigFromJSON instead. +func JWTAccessTokenSourceFromJSON(jsonKey []byte, audience string) (oauth2.TokenSource, error) { + cfg, err := JWTConfigFromJSON(jsonKey) + if err != nil { + return nil, fmt.Errorf("google: could not parse JSON key: %v", err) + } + pk, err := internal.ParseKey(cfg.PrivateKey) + if err != nil { + return nil, fmt.Errorf("google: could not parse key: %v", err) + } + ts := &jwtAccessTokenSource{ + email: cfg.Email, + audience: audience, + pk: pk, + pkID: cfg.PrivateKeyID, + } + tok, err := ts.Token() + if err != nil { + return nil, err + } + return oauth2.ReuseTokenSource(tok, ts), nil +} + +type jwtAccessTokenSource struct { + email, audience string + pk *rsa.PrivateKey + pkID string +} + +func (ts *jwtAccessTokenSource) Token() (*oauth2.Token, error) { + iat := time.Now() + exp := iat.Add(time.Hour) + cs := &jws.ClaimSet{ + Iss: ts.email, + Sub: ts.email, + Aud: ts.audience, + Iat: iat.Unix(), + Exp: exp.Unix(), + } + hdr := &jws.Header{ + Algorithm: "RS256", + Typ: "JWT", + KeyID: string(ts.pkID), + } + msg, err := jws.Encode(hdr, cs, ts.pk) + if err != nil { + return nil, fmt.Errorf("google: could not encode JWT: %v", err) + } + return &oauth2.Token{AccessToken: msg, TokenType: "Bearer", Expiry: exp}, nil +} diff --git a/vendor/golang.org/x/oauth2/google/jwt_test.go b/vendor/golang.org/x/oauth2/google/jwt_test.go new file mode 100644 index 000000000..f844436fc --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/jwt_test.go @@ -0,0 +1,91 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package google + +import ( + "bytes" + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "encoding/base64" + "encoding/json" + "encoding/pem" + "strings" + "testing" + "time" + + "golang.org/x/oauth2/jws" +) + +func TestJWTAccessTokenSourceFromJSON(t *testing.T) { + // Generate a key we can use in the test data. + privateKey, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + t.Fatal(err) + } + + // Encode the key and substitute into our example JSON. + enc := pem.EncodeToMemory(&pem.Block{ + Type: "PRIVATE KEY", + Bytes: x509.MarshalPKCS1PrivateKey(privateKey), + }) + enc, err = json.Marshal(string(enc)) + if err != nil { + t.Fatalf("json.Marshal: %v", err) + } + jsonKey := bytes.Replace(jwtJSONKey, []byte(`"super secret key"`), enc, 1) + + ts, err := JWTAccessTokenSourceFromJSON(jsonKey, "audience") + if err != nil { + t.Fatalf("JWTAccessTokenSourceFromJSON: %v\nJSON: %s", err, string(jsonKey)) + } + + tok, err := ts.Token() + if err != nil { + t.Fatalf("Token: %v", err) + } + + if got, want := tok.TokenType, "Bearer"; got != want { + t.Errorf("TokenType = %q, want %q", got, want) + } + if got := tok.Expiry; tok.Expiry.Before(time.Now()) { + t.Errorf("Expiry = %v, should not be expired", got) + } + + err = jws.Verify(tok.AccessToken, &privateKey.PublicKey) + if err != nil { + t.Errorf("jws.Verify on AccessToken: %v", err) + } + + claim, err := jws.Decode(tok.AccessToken) + if err != nil { + t.Fatalf("jws.Decode on AccessToken: %v", err) + } + + if got, want := claim.Iss, "gopher@developer.gserviceaccount.com"; got != want { + t.Errorf("Iss = %q, want %q", got, want) + } + if got, want := claim.Sub, "gopher@developer.gserviceaccount.com"; got != want { + t.Errorf("Sub = %q, want %q", got, want) + } + if got, want := claim.Aud, "audience"; got != want { + t.Errorf("Aud = %q, want %q", got, want) + } + + // Finally, check the header private key. + parts := strings.Split(tok.AccessToken, ".") + hdrJSON, err := base64.RawURLEncoding.DecodeString(parts[0]) + if err != nil { + t.Fatalf("base64 DecodeString: %v\nString: %q", err, parts[0]) + } + var hdr jws.Header + if err := json.Unmarshal([]byte(hdrJSON), &hdr); err != nil { + t.Fatalf("json.Unmarshal: %v (%q)", err, hdrJSON) + } + + if got, want := hdr.KeyID, "268f54e43a1af97cfc71731688434f45aca15c8b"; got != want { + t.Errorf("Header KeyID = %q, want %q", got, want) + } +} diff --git a/vendor/golang.org/x/oauth2/google/sdk.go b/vendor/golang.org/x/oauth2/google/sdk.go new file mode 100644 index 000000000..456224bc7 --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/sdk.go @@ -0,0 +1,201 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package google + +import ( + "bufio" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "os" + "os/user" + "path/filepath" + "runtime" + "strings" + "time" + + "golang.org/x/oauth2" +) + +type sdkCredentials struct { + Data []struct { + Credential struct { + ClientID string `json:"client_id"` + ClientSecret string `json:"client_secret"` + AccessToken string `json:"access_token"` + RefreshToken string `json:"refresh_token"` + TokenExpiry *time.Time `json:"token_expiry"` + } `json:"credential"` + Key struct { + Account string `json:"account"` + Scope string `json:"scope"` + } `json:"key"` + } +} + +// An SDKConfig provides access to tokens from an account already +// authorized via the Google Cloud SDK. +type SDKConfig struct { + conf oauth2.Config + initialToken *oauth2.Token +} + +// NewSDKConfig creates an SDKConfig for the given Google Cloud SDK +// account. If account is empty, the account currently active in +// Google Cloud SDK properties is used. +// Google Cloud SDK credentials must be created by running `gcloud auth` +// before using this function. +// The Google Cloud SDK is available at https://cloud.google.com/sdk/. +func NewSDKConfig(account string) (*SDKConfig, error) { + configPath, err := sdkConfigPath() + if err != nil { + return nil, fmt.Errorf("oauth2/google: error getting SDK config path: %v", err) + } + credentialsPath := filepath.Join(configPath, "credentials") + f, err := os.Open(credentialsPath) + if err != nil { + return nil, fmt.Errorf("oauth2/google: failed to load SDK credentials: %v", err) + } + defer f.Close() + + var c sdkCredentials + if err := json.NewDecoder(f).Decode(&c); err != nil { + return nil, fmt.Errorf("oauth2/google: failed to decode SDK credentials from %q: %v", credentialsPath, err) + } + if len(c.Data) == 0 { + return nil, fmt.Errorf("oauth2/google: no credentials found in %q, run `gcloud auth login` to create one", credentialsPath) + } + if account == "" { + propertiesPath := filepath.Join(configPath, "properties") + f, err := os.Open(propertiesPath) + if err != nil { + return nil, fmt.Errorf("oauth2/google: failed to load SDK properties: %v", err) + } + defer f.Close() + ini, err := parseINI(f) + if err != nil { + return nil, fmt.Errorf("oauth2/google: failed to parse SDK properties %q: %v", propertiesPath, err) + } + core, ok := ini["core"] + if !ok { + return nil, fmt.Errorf("oauth2/google: failed to find [core] section in %v", ini) + } + active, ok := core["account"] + if !ok { + return nil, fmt.Errorf("oauth2/google: failed to find %q attribute in %v", "account", core) + } + account = active + } + + for _, d := range c.Data { + if account == "" || d.Key.Account == account { + if d.Credential.AccessToken == "" && d.Credential.RefreshToken == "" { + return nil, fmt.Errorf("oauth2/google: no token available for account %q", account) + } + var expiry time.Time + if d.Credential.TokenExpiry != nil { + expiry = *d.Credential.TokenExpiry + } + return &SDKConfig{ + conf: oauth2.Config{ + ClientID: d.Credential.ClientID, + ClientSecret: d.Credential.ClientSecret, + Scopes: strings.Split(d.Key.Scope, " "), + Endpoint: Endpoint, + RedirectURL: "oob", + }, + initialToken: &oauth2.Token{ + AccessToken: d.Credential.AccessToken, + RefreshToken: d.Credential.RefreshToken, + Expiry: expiry, + }, + }, nil + } + } + return nil, fmt.Errorf("oauth2/google: no such credentials for account %q", account) +} + +// Client returns an HTTP client using Google Cloud SDK credentials to +// authorize requests. The token will auto-refresh as necessary. The +// underlying http.RoundTripper will be obtained using the provided +// context. The returned client and its Transport should not be +// modified. +func (c *SDKConfig) Client(ctx context.Context) *http.Client { + return &http.Client{ + Transport: &oauth2.Transport{ + Source: c.TokenSource(ctx), + }, + } +} + +// TokenSource returns an oauth2.TokenSource that retrieve tokens from +// Google Cloud SDK credentials using the provided context. +// It will returns the current access token stored in the credentials, +// and refresh it when it expires, but it won't update the credentials +// with the new access token. +func (c *SDKConfig) TokenSource(ctx context.Context) oauth2.TokenSource { + return c.conf.TokenSource(ctx, c.initialToken) +} + +// Scopes are the OAuth 2.0 scopes the current account is authorized for. +func (c *SDKConfig) Scopes() []string { + return c.conf.Scopes +} + +func parseINI(ini io.Reader) (map[string]map[string]string, error) { + result := map[string]map[string]string{ + "": {}, // root section + } + scanner := bufio.NewScanner(ini) + currentSection := "" + for scanner.Scan() { + line := strings.TrimSpace(scanner.Text()) + if strings.HasPrefix(line, ";") { + // comment. + continue + } + if strings.HasPrefix(line, "[") && strings.HasSuffix(line, "]") { + currentSection = strings.TrimSpace(line[1 : len(line)-1]) + result[currentSection] = map[string]string{} + continue + } + parts := strings.SplitN(line, "=", 2) + if len(parts) == 2 && parts[0] != "" { + result[currentSection][strings.TrimSpace(parts[0])] = strings.TrimSpace(parts[1]) + } + } + if err := scanner.Err(); err != nil { + return nil, fmt.Errorf("error scanning ini: %v", err) + } + return result, nil +} + +// sdkConfigPath tries to guess where the gcloud config is located. +// It can be overridden during tests. +var sdkConfigPath = func() (string, error) { + if runtime.GOOS == "windows" { + return filepath.Join(os.Getenv("APPDATA"), "gcloud"), nil + } + homeDir := guessUnixHomeDir() + if homeDir == "" { + return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty") + } + return filepath.Join(homeDir, ".config", "gcloud"), nil +} + +func guessUnixHomeDir() string { + // Prefer $HOME over user.Current due to glibc bug: golang.org/issue/13470 + if v := os.Getenv("HOME"); v != "" { + return v + } + // Else, fall back to user.Current: + if u, err := user.Current(); err == nil { + return u.HomeDir + } + return "" +} diff --git a/vendor/golang.org/x/oauth2/google/sdk_test.go b/vendor/golang.org/x/oauth2/google/sdk_test.go new file mode 100644 index 000000000..52b8ecada --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/sdk_test.go @@ -0,0 +1,107 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package google + +import ( + "reflect" + "strings" + "testing" +) + +func TestSDKConfig(t *testing.T) { + sdkConfigPath = func() (string, error) { + return "testdata/gcloud", nil + } + + tests := []struct { + account string + accessToken string + err bool + }{ + {"", "bar_access_token", false}, + {"foo@example.com", "foo_access_token", false}, + {"bar@example.com", "bar_access_token", false}, + {"baz@serviceaccount.example.com", "", true}, + } + for _, tt := range tests { + c, err := NewSDKConfig(tt.account) + if got, want := err != nil, tt.err; got != want { + if !tt.err { + t.Errorf("got %v, want nil", err) + } else { + t.Errorf("got nil, want error") + } + continue + } + if err != nil { + continue + } + tok := c.initialToken + if tok == nil { + t.Errorf("got nil, want %q", tt.accessToken) + continue + } + if tok.AccessToken != tt.accessToken { + t.Errorf("got %q, want %q", tok.AccessToken, tt.accessToken) + } + } +} + +func TestParseINI(t *testing.T) { + tests := []struct { + ini string + want map[string]map[string]string + }{ + { + `root = toor +[foo] +bar = hop +ini = nin +`, + map[string]map[string]string{ + "": {"root": "toor"}, + "foo": {"bar": "hop", "ini": "nin"}, + }, + }, + { + "\t extra \t = whitespace \t\r\n \t [everywhere] \t \r\n here \t = \t there \t \r\n", + map[string]map[string]string{ + "": {"extra": "whitespace"}, + "everywhere": {"here": "there"}, + }, + }, + { + `[empty] +[section] +empty= +`, + map[string]map[string]string{ + "": {}, + "empty": {}, + "section": {"empty": ""}, + }, + }, + { + `ignore +[invalid +=stuff +;comment=true +`, + map[string]map[string]string{ + "": {}, + }, + }, + } + for _, tt := range tests { + result, err := parseINI(strings.NewReader(tt.ini)) + if err != nil { + t.Errorf("parseINI(%q) error %v, want: no error", tt.ini, err) + continue + } + if !reflect.DeepEqual(result, tt.want) { + t.Errorf("parseINI(%q) = %#v, want: %#v", tt.ini, result, tt.want) + } + } +} diff --git a/vendor/golang.org/x/oauth2/google/testdata/gcloud/credentials b/vendor/golang.org/x/oauth2/google/testdata/gcloud/credentials new file mode 100644 index 000000000..ff5eefbd0 --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/testdata/gcloud/credentials @@ -0,0 +1,122 @@ +{ + "data": [ + { + "credential": { + "_class": "OAuth2Credentials", + "_module": "oauth2client.client", + "access_token": "foo_access_token", + "client_id": "foo_client_id", + "client_secret": "foo_client_secret", + "id_token": { + "at_hash": "foo_at_hash", + "aud": "foo_aud", + "azp": "foo_azp", + "cid": "foo_cid", + "email": "foo@example.com", + "email_verified": true, + "exp": 1420573614, + "iat": 1420569714, + "id": "1337", + "iss": "accounts.google.com", + "sub": "1337", + "token_hash": "foo_token_hash", + "verified_email": true + }, + "invalid": false, + "refresh_token": "foo_refresh_token", + "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", + "token_expiry": "2015-01-09T00:51:51Z", + "token_response": { + "access_token": "foo_access_token", + "expires_in": 3600, + "id_token": "foo_id_token", + "token_type": "Bearer" + }, + "token_uri": "https://accounts.google.com/o/oauth2/token", + "user_agent": "Cloud SDK Command Line Tool" + }, + "key": { + "account": "foo@example.com", + "clientId": "foo_client_id", + "scope": "https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/ndev.cloudman https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.admin https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/projecthosting", + "type": "google-cloud-sdk" + } + }, + { + "credential": { + "_class": "OAuth2Credentials", + "_module": "oauth2client.client", + "access_token": "bar_access_token", + "client_id": "bar_client_id", + "client_secret": "bar_client_secret", + "id_token": { + "at_hash": "bar_at_hash", + "aud": "bar_aud", + "azp": "bar_azp", + "cid": "bar_cid", + "email": "bar@example.com", + "email_verified": true, + "exp": 1420573614, + "iat": 1420569714, + "id": "1337", + "iss": "accounts.google.com", + "sub": "1337", + "token_hash": "bar_token_hash", + "verified_email": true + }, + "invalid": false, + "refresh_token": "bar_refresh_token", + "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", + "token_expiry": "2015-01-09T00:51:51Z", + "token_response": { + "access_token": "bar_access_token", + "expires_in": 3600, + "id_token": "bar_id_token", + "token_type": "Bearer" + }, + "token_uri": "https://accounts.google.com/o/oauth2/token", + "user_agent": "Cloud SDK Command Line Tool" + }, + "key": { + "account": "bar@example.com", + "clientId": "bar_client_id", + "scope": "https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/ndev.cloudman https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.admin https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/projecthosting", + "type": "google-cloud-sdk" + } + }, + { + "credential": { + "_class": "ServiceAccountCredentials", + "_kwargs": {}, + "_module": "oauth2client.client", + "_private_key_id": "00000000000000000000000000000000", + "_private_key_pkcs8_text": "-----BEGIN RSA PRIVATE KEY-----\nMIICWwIBAAKBgQCt3fpiynPSaUhWSIKMGV331zudwJ6GkGmvQtwsoK2S2LbvnSwU\nNxgj4fp08kIDR5p26wF4+t/HrKydMwzftXBfZ9UmLVJgRdSswmS5SmChCrfDS5OE\nvFFcN5+6w1w8/Nu657PF/dse8T0bV95YrqyoR0Osy8WHrUOMSIIbC3hRuwIDAQAB\nAoGAJrGE/KFjn0sQ7yrZ6sXmdLawrM3mObo/2uI9T60+k7SpGbBX0/Pi6nFrJMWZ\nTVONG7P3Mu5aCPzzuVRYJB0j8aldSfzABTY3HKoWCczqw1OztJiEseXGiYz4QOyr\nYU3qDyEpdhS6q6wcoLKGH+hqRmz6pcSEsc8XzOOu7s4xW8kCQQDkc75HjhbarCnd\nJJGMe3U76+6UGmdK67ltZj6k6xoB5WbTNChY9TAyI2JC+ppYV89zv3ssj4L+02u3\nHIHFGxsHAkEAwtU1qYb1tScpchPobnYUFiVKJ7KA8EZaHVaJJODW/cghTCV7BxcJ\nbgVvlmk4lFKn3lPKAgWw7PdQsBTVBUcCrQJATPwoIirizrv3u5soJUQxZIkENAqV\nxmybZx9uetrzP7JTrVbFRf0SScMcyN90hdLJiQL8+i4+gaszgFht7sNMnwJAAbfj\nq0UXcauQwALQ7/h2oONfTg5S+MuGC/AxcXPSMZbMRGGoPh3D5YaCv27aIuS/ukQ+\n6dmm/9AGlCb64fsIWQJAPaokbjIifo+LwC5gyK73Mc4t8nAOSZDenzd/2f6TCq76\nS1dcnKiPxaED7W/y6LJiuBT2rbZiQ2L93NJpFZD/UA==\n-----END RSA PRIVATE KEY-----\n", + "_revoke_uri": "https://accounts.google.com/o/oauth2/revoke", + "_scopes": "https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/ndev.cloudman https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.admin https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/projecthosting", + "_service_account_email": "baz@serviceaccount.example.com", + "_service_account_id": "baz.serviceaccount.example.com", + "_token_uri": "https://accounts.google.com/o/oauth2/token", + "_user_agent": "Cloud SDK Command Line Tool", + "access_token": null, + "assertion_type": null, + "client_id": null, + "client_secret": null, + "id_token": null, + "invalid": false, + "refresh_token": null, + "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", + "service_account_name": "baz@serviceaccount.example.com", + "token_expiry": null, + "token_response": null, + "user_agent": "Cloud SDK Command Line Tool" + }, + "key": { + "account": "baz@serviceaccount.example.com", + "clientId": "baz_client_id", + "scope": "https://www.googleapis.com/auth/appengine.admin https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/ndev.cloudman https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.admin https://www.googleapis.com/auth/prediction https://www.googleapis.com/auth/projecthosting", + "type": "google-cloud-sdk" + } + } + ], + "file_version": 1 +} diff --git a/vendor/golang.org/x/oauth2/google/testdata/gcloud/properties b/vendor/golang.org/x/oauth2/google/testdata/gcloud/properties new file mode 100644 index 000000000..025de886c --- /dev/null +++ b/vendor/golang.org/x/oauth2/google/testdata/gcloud/properties @@ -0,0 +1,2 @@ +[core] +account = bar@example.com \ No newline at end of file diff --git a/vendor/golang.org/x/oauth2/heroku/heroku.go b/vendor/golang.org/x/oauth2/heroku/heroku.go new file mode 100644 index 000000000..5b4fdb890 --- /dev/null +++ b/vendor/golang.org/x/oauth2/heroku/heroku.go @@ -0,0 +1,16 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package heroku provides constants for using OAuth2 to access Heroku. +package heroku // import "golang.org/x/oauth2/heroku" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Heroku's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://id.heroku.com/oauth/authorize", + TokenURL: "https://id.heroku.com/oauth/token", +} diff --git a/vendor/golang.org/x/oauth2/hipchat/hipchat.go b/vendor/golang.org/x/oauth2/hipchat/hipchat.go new file mode 100644 index 000000000..594fe072c --- /dev/null +++ b/vendor/golang.org/x/oauth2/hipchat/hipchat.go @@ -0,0 +1,60 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package hipchat provides constants for using OAuth2 to access HipChat. +package hipchat // import "golang.org/x/oauth2/hipchat" + +import ( + "encoding/json" + "errors" + + "golang.org/x/oauth2" + "golang.org/x/oauth2/clientcredentials" +) + +// Endpoint is HipChat's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://www.hipchat.com/users/authorize", + TokenURL: "https://api.hipchat.com/v2/oauth/token", +} + +// ServerEndpoint returns a new oauth2.Endpoint for a HipChat Server instance +// running on the given domain or host. +func ServerEndpoint(host string) oauth2.Endpoint { + return oauth2.Endpoint{ + AuthURL: "https://" + host + "/users/authorize", + TokenURL: "https://" + host + "/v2/oauth/token", + } +} + +// ClientCredentialsConfigFromCaps generates a Config from a HipChat API +// capabilities descriptor. It does not verify the scopes against the +// capabilities document at this time. +// +// For more information see: https://www.hipchat.com/docs/apiv2/method/get_capabilities +func ClientCredentialsConfigFromCaps(capsJSON []byte, clientID, clientSecret string, scopes ...string) (*clientcredentials.Config, error) { + var caps struct { + Caps struct { + Endpoint struct { + TokenURL string `json:"tokenUrl"` + } `json:"oauth2Provider"` + } `json:"capabilities"` + } + + if err := json.Unmarshal(capsJSON, &caps); err != nil { + return nil, err + } + + // Verify required fields. + if caps.Caps.Endpoint.TokenURL == "" { + return nil, errors.New("oauth2/hipchat: missing OAuth2 token URL in the capabilities descriptor JSON") + } + + return &clientcredentials.Config{ + ClientID: clientID, + ClientSecret: clientSecret, + Scopes: scopes, + TokenURL: caps.Caps.Endpoint.TokenURL, + }, nil +} diff --git a/vendor/golang.org/x/oauth2/instagram/instagram.go b/vendor/golang.org/x/oauth2/instagram/instagram.go new file mode 100644 index 000000000..75a74ebb9 --- /dev/null +++ b/vendor/golang.org/x/oauth2/instagram/instagram.go @@ -0,0 +1,16 @@ +// 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 file. + +// Package instagram provides constants for using OAuth2 to access Instagram. +package instagram // import "golang.org/x/oauth2/instagram" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Instagram's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://api.instagram.com/oauth/authorize", + TokenURL: "https://api.instagram.com/oauth/access_token", +} diff --git a/vendor/golang.org/x/oauth2/internal/client_appengine.go b/vendor/golang.org/x/oauth2/internal/client_appengine.go new file mode 100644 index 000000000..743487188 --- /dev/null +++ b/vendor/golang.org/x/oauth2/internal/client_appengine.go @@ -0,0 +1,13 @@ +// 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 file. + +// +build appengine + +package internal + +import "google.golang.org/appengine/urlfetch" + +func init() { + appengineClientHook = urlfetch.Client +} diff --git a/vendor/golang.org/x/oauth2/internal/doc.go b/vendor/golang.org/x/oauth2/internal/doc.go new file mode 100644 index 000000000..03265e888 --- /dev/null +++ b/vendor/golang.org/x/oauth2/internal/doc.go @@ -0,0 +1,6 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package internal contains support packages for oauth2 package. +package internal diff --git a/vendor/golang.org/x/oauth2/internal/oauth2.go b/vendor/golang.org/x/oauth2/internal/oauth2.go new file mode 100644 index 000000000..c0ab196cf --- /dev/null +++ b/vendor/golang.org/x/oauth2/internal/oauth2.go @@ -0,0 +1,37 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package internal + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "errors" + "fmt" +) + +// ParseKey converts the binary contents of a private key file +// to an *rsa.PrivateKey. It detects whether the private key is in a +// PEM container or not. If so, it extracts the the private key +// from PEM container before conversion. It only supports PEM +// containers with no passphrase. +func ParseKey(key []byte) (*rsa.PrivateKey, error) { + block, _ := pem.Decode(key) + if block != nil { + key = block.Bytes + } + parsedKey, err := x509.ParsePKCS8PrivateKey(key) + if err != nil { + parsedKey, err = x509.ParsePKCS1PrivateKey(key) + if err != nil { + return nil, fmt.Errorf("private key should be a PEM or plain PKCS1 or PKCS8; parse error: %v", err) + } + } + parsed, ok := parsedKey.(*rsa.PrivateKey) + if !ok { + return nil, errors.New("private key is invalid") + } + return parsed, nil +} diff --git a/vendor/golang.org/x/oauth2/internal/token.go b/vendor/golang.org/x/oauth2/internal/token.go new file mode 100644 index 000000000..a831b7746 --- /dev/null +++ b/vendor/golang.org/x/oauth2/internal/token.go @@ -0,0 +1,277 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package internal + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "io/ioutil" + "mime" + "net/http" + "net/url" + "strconv" + "strings" + "time" + + "golang.org/x/net/context/ctxhttp" +) + +// Token represents the credentials used to authorize +// the requests to access protected resources on the OAuth 2.0 +// provider's backend. +// +// This type is a mirror of oauth2.Token and exists to break +// an otherwise-circular dependency. Other internal packages +// should convert this Token into an oauth2.Token before use. +type Token struct { + // AccessToken is the token that authorizes and authenticates + // the requests. + AccessToken string + + // TokenType is the type of token. + // The Type method returns either this or "Bearer", the default. + TokenType string + + // RefreshToken is a token that's used by the application + // (as opposed to the user) to refresh the access token + // if it expires. + RefreshToken string + + // Expiry is the optional expiration time of the access token. + // + // If zero, TokenSource implementations will reuse the same + // token forever and RefreshToken or equivalent + // mechanisms for that TokenSource will not be used. + Expiry time.Time + + // Raw optionally contains extra metadata from the server + // when updating a token. + Raw interface{} +} + +// tokenJSON is the struct representing the HTTP response from OAuth2 +// providers returning a token in JSON form. +type tokenJSON struct { + AccessToken string `json:"access_token"` + TokenType string `json:"token_type"` + RefreshToken string `json:"refresh_token"` + ExpiresIn expirationTime `json:"expires_in"` // at least PayPal returns string, while most return number + Expires expirationTime `json:"expires"` // broken Facebook spelling of expires_in +} + +func (e *tokenJSON) expiry() (t time.Time) { + if v := e.ExpiresIn; v != 0 { + return time.Now().Add(time.Duration(v) * time.Second) + } + if v := e.Expires; v != 0 { + return time.Now().Add(time.Duration(v) * time.Second) + } + return +} + +type expirationTime int32 + +func (e *expirationTime) UnmarshalJSON(b []byte) error { + var n json.Number + err := json.Unmarshal(b, &n) + if err != nil { + return err + } + i, err := n.Int64() + if err != nil { + return err + } + *e = expirationTime(i) + return nil +} + +var brokenAuthHeaderProviders = []string{ + "https://accounts.google.com/", + "https://api.codeswholesale.com/oauth/token", + "https://api.dropbox.com/", + "https://api.dropboxapi.com/", + "https://api.instagram.com/", + "https://api.netatmo.net/", + "https://api.odnoklassniki.ru/", + "https://api.pushbullet.com/", + "https://api.soundcloud.com/", + "https://api.twitch.tv/", + "https://id.twitch.tv/", + "https://app.box.com/", + "https://api.box.com/", + "https://connect.stripe.com/", + "https://login.mailchimp.com/", + "https://login.microsoftonline.com/", + "https://login.salesforce.com/", + "https://login.windows.net", + "https://login.live.com/", + "https://login.live-int.com/", + "https://oauth.sandbox.trainingpeaks.com/", + "https://oauth.trainingpeaks.com/", + "https://oauth.vk.com/", + "https://openapi.baidu.com/", + "https://slack.com/", + "https://test-sandbox.auth.corp.google.com", + "https://test.salesforce.com/", + "https://user.gini.net/", + "https://www.douban.com/", + "https://www.googleapis.com/", + "https://www.linkedin.com/", + "https://www.strava.com/oauth/", + "https://www.wunderlist.com/oauth/", + "https://api.patreon.com/", + "https://sandbox.codeswholesale.com/oauth/token", + "https://api.sipgate.com/v1/authorization/oauth", + "https://api.medium.com/v1/tokens", + "https://log.finalsurge.com/oauth/token", + "https://multisport.todaysplan.com.au/rest/oauth/access_token", + "https://whats.todaysplan.com.au/rest/oauth/access_token", + "https://stackoverflow.com/oauth/access_token", + "https://account.health.nokia.com", + "https://accounts.zoho.com", + "https://gitter.im/login/oauth/token", + "https://openid-connect.onelogin.com/oidc", + "https://api.dailymotion.com/oauth/token", +} + +// brokenAuthHeaderDomains lists broken providers that issue dynamic endpoints. +var brokenAuthHeaderDomains = []string{ + ".auth0.com", + ".force.com", + ".myshopify.com", + ".okta.com", + ".oktapreview.com", +} + +func RegisterBrokenAuthHeaderProvider(tokenURL string) { + brokenAuthHeaderProviders = append(brokenAuthHeaderProviders, tokenURL) +} + +// providerAuthHeaderWorks reports whether the OAuth2 server identified by the tokenURL +// implements the OAuth2 spec correctly +// See https://code.google.com/p/goauth2/issues/detail?id=31 for background. +// In summary: +// - Reddit only accepts client secret in the Authorization header +// - Dropbox accepts either it in URL param or Auth header, but not both. +// - Google only accepts URL param (not spec compliant?), not Auth header +// - Stripe only accepts client secret in Auth header with Bearer method, not Basic +func providerAuthHeaderWorks(tokenURL string) bool { + for _, s := range brokenAuthHeaderProviders { + if strings.HasPrefix(tokenURL, s) { + // Some sites fail to implement the OAuth2 spec fully. + return false + } + } + + if u, err := url.Parse(tokenURL); err == nil { + for _, s := range brokenAuthHeaderDomains { + if strings.HasSuffix(u.Host, s) { + return false + } + } + } + + // Assume the provider implements the spec properly + // otherwise. We can add more exceptions as they're + // discovered. We will _not_ be adding configurable hooks + // to this package to let users select server bugs. + return true +} + +func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string, v url.Values) (*Token, error) { + bustedAuth := !providerAuthHeaderWorks(tokenURL) + if bustedAuth { + if clientID != "" { + v.Set("client_id", clientID) + } + if clientSecret != "" { + v.Set("client_secret", clientSecret) + } + } + req, err := http.NewRequest("POST", tokenURL, strings.NewReader(v.Encode())) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + if !bustedAuth { + req.SetBasicAuth(url.QueryEscape(clientID), url.QueryEscape(clientSecret)) + } + r, err := ctxhttp.Do(ctx, ContextClient(ctx), req) + if err != nil { + return nil, err + } + defer r.Body.Close() + body, err := ioutil.ReadAll(io.LimitReader(r.Body, 1<<20)) + if err != nil { + return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err) + } + if code := r.StatusCode; code < 200 || code > 299 { + return nil, &RetrieveError{ + Response: r, + Body: body, + } + } + + var token *Token + content, _, _ := mime.ParseMediaType(r.Header.Get("Content-Type")) + switch content { + case "application/x-www-form-urlencoded", "text/plain": + vals, err := url.ParseQuery(string(body)) + if err != nil { + return nil, err + } + token = &Token{ + AccessToken: vals.Get("access_token"), + TokenType: vals.Get("token_type"), + RefreshToken: vals.Get("refresh_token"), + Raw: vals, + } + e := vals.Get("expires_in") + if e == "" { + // TODO(jbd): Facebook's OAuth2 implementation is broken and + // returns expires_in field in expires. Remove the fallback to expires, + // when Facebook fixes their implementation. + e = vals.Get("expires") + } + expires, _ := strconv.Atoi(e) + if expires != 0 { + token.Expiry = time.Now().Add(time.Duration(expires) * time.Second) + } + default: + var tj tokenJSON + if err = json.Unmarshal(body, &tj); err != nil { + return nil, err + } + token = &Token{ + AccessToken: tj.AccessToken, + TokenType: tj.TokenType, + RefreshToken: tj.RefreshToken, + Expiry: tj.expiry(), + Raw: make(map[string]interface{}), + } + json.Unmarshal(body, &token.Raw) // no error checks for optional fields + } + // Don't overwrite `RefreshToken` with an empty value + // if this was a token refreshing request. + if token.RefreshToken == "" { + token.RefreshToken = v.Get("refresh_token") + } + if token.AccessToken == "" { + return token, errors.New("oauth2: server response missing access_token") + } + return token, nil +} + +type RetrieveError struct { + Response *http.Response + Body []byte +} + +func (r *RetrieveError) Error() string { + return fmt.Sprintf("oauth2: cannot fetch token: %v\nResponse: %s", r.Response.Status, r.Body) +} diff --git a/vendor/golang.org/x/oauth2/internal/token_test.go b/vendor/golang.org/x/oauth2/internal/token_test.go new file mode 100644 index 000000000..d1da8bb04 --- /dev/null +++ b/vendor/golang.org/x/oauth2/internal/token_test.go @@ -0,0 +1,111 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package internal + +import ( + "context" + "fmt" + "io" + "net/http" + "net/http/httptest" + "net/url" + "testing" +) + +func TestRegisterBrokenAuthHeaderProvider(t *testing.T) { + RegisterBrokenAuthHeaderProvider("https://aaa.com/") + tokenURL := "https://aaa.com/token" + if providerAuthHeaderWorks(tokenURL) { + t.Errorf("got %q as unbroken; want broken", tokenURL) + } +} + +func TestRetrieveTokenBustedNoSecret(t *testing.T) { + const clientID = "client-id" + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if got, want := r.FormValue("client_id"), clientID; got != want { + t.Errorf("client_id = %q; want %q", got, want) + } + if got, want := r.FormValue("client_secret"), ""; got != want { + t.Errorf("client_secret = %q; want empty", got) + } + w.Header().Set("Content-Type", "application/json") + io.WriteString(w, `{"access_token": "ACCESS_TOKEN", "token_type": "bearer"}`) + })) + defer ts.Close() + + RegisterBrokenAuthHeaderProvider(ts.URL) + _, err := RetrieveToken(context.Background(), clientID, "", ts.URL, url.Values{}) + if err != nil { + t.Errorf("RetrieveToken = %v; want no error", err) + } +} + +func Test_providerAuthHeaderWorks(t *testing.T) { + for _, p := range brokenAuthHeaderProviders { + if providerAuthHeaderWorks(p) { + t.Errorf("got %q as unbroken; want broken", p) + } + p := fmt.Sprintf("%ssomesuffix", p) + if providerAuthHeaderWorks(p) { + t.Errorf("got %q as unbroken; want broken", p) + } + } + p := "https://api.not-in-the-list-example.com/" + if !providerAuthHeaderWorks(p) { + t.Errorf("got %q as unbroken; want broken", p) + } +} + +func TestProviderAuthHeaderWorksDomain(t *testing.T) { + tests := []struct { + tokenURL string + wantWorks bool + }{ + {"https://dev-12345.okta.com/token-url", false}, + {"https://dev-12345.oktapreview.com/token-url", false}, + {"https://dev-12345.okta.org/token-url", true}, + {"https://foo.bar.force.com/token-url", false}, + {"https://foo.force.com/token-url", false}, + {"https://force.com/token-url", true}, + } + + for _, test := range tests { + got := providerAuthHeaderWorks(test.tokenURL) + if got != test.wantWorks { + t.Errorf("providerAuthHeaderWorks(%q) = %v; want %v", test.tokenURL, got, test.wantWorks) + } + } +} + +func TestRetrieveTokenWithContexts(t *testing.T) { + const clientID = "client-id" + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + io.WriteString(w, `{"access_token": "ACCESS_TOKEN", "token_type": "bearer"}`) + })) + defer ts.Close() + + _, err := RetrieveToken(context.Background(), clientID, "", ts.URL, url.Values{}) + if err != nil { + t.Errorf("RetrieveToken (with background context) = %v; want no error", err) + } + + retrieved := make(chan struct{}) + cancellingts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + <-retrieved + })) + defer cancellingts.Close() + + ctx, cancel := context.WithCancel(context.Background()) + cancel() + _, err = RetrieveToken(ctx, clientID, "", cancellingts.URL, url.Values{}) + close(retrieved) + if err == nil { + t.Errorf("RetrieveToken (with cancelled context) = nil; want error") + } +} diff --git a/vendor/golang.org/x/oauth2/internal/transport.go b/vendor/golang.org/x/oauth2/internal/transport.go new file mode 100644 index 000000000..572074a63 --- /dev/null +++ b/vendor/golang.org/x/oauth2/internal/transport.go @@ -0,0 +1,33 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package internal + +import ( + "context" + "net/http" +) + +// HTTPClient is the context key to use with golang.org/x/net/context's +// WithValue function to associate an *http.Client value with a context. +var HTTPClient ContextKey + +// ContextKey is just an empty struct. It exists so HTTPClient can be +// an immutable public variable with a unique type. It's immutable +// because nobody else can create a ContextKey, being unexported. +type ContextKey struct{} + +var appengineClientHook func(context.Context) *http.Client + +func ContextClient(ctx context.Context) *http.Client { + if ctx != nil { + if hc, ok := ctx.Value(HTTPClient).(*http.Client); ok { + return hc + } + } + if appengineClientHook != nil { + return appengineClientHook(ctx) + } + return http.DefaultClient +} diff --git a/vendor/golang.org/x/oauth2/jira/jira.go b/vendor/golang.org/x/oauth2/jira/jira.go new file mode 100644 index 000000000..34415607c --- /dev/null +++ b/vendor/golang.org/x/oauth2/jira/jira.go @@ -0,0 +1,167 @@ +// 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 file. + +// Package jira provides claims and JWT signing for OAuth2 to access JIRA/Confluence. +package jira + +import ( + "context" + "crypto/hmac" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + "time" + + "golang.org/x/oauth2" +) + +// ClaimSet contains information about the JWT signature according +// to Atlassian's documentation +// https://developer.atlassian.com/cloud/jira/software/oauth-2-jwt-bearer-token-authorization-grant-type/ +type ClaimSet struct { + Issuer string `json:"iss"` + Subject string `json:"sub"` + InstalledURL string `json:"tnt"` // URL of installed app + AuthURL string `json:"aud"` // URL of auth server + ExpiresIn int64 `json:"exp"` // Must be no later that 60 seconds in the future + IssuedAt int64 `json:"iat"` +} + +var ( + defaultGrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer" + defaultHeader = map[string]string{ + "typ": "JWT", + "alg": "HS256", + } +) + +// Config is the configuration for using JWT to fetch tokens, +// commonly known as "two-legged OAuth 2.0". +type Config struct { + // BaseURL for your app + BaseURL string + + // Subject is the userkey as defined by Atlassian + // Different than username (ex: /rest/api/2/user?username=alex) + Subject string + + oauth2.Config +} + +// TokenSource returns a JWT TokenSource using the configuration +// in c and the HTTP client from the provided context. +func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource { + return oauth2.ReuseTokenSource(nil, jwtSource{ctx, c}) +} + +// Client returns an HTTP client wrapping the context's +// HTTP transport and adding Authorization headers with tokens +// obtained from c. +// +// The returned client and its Transport should not be modified. +func (c *Config) Client(ctx context.Context) *http.Client { + return oauth2.NewClient(ctx, c.TokenSource(ctx)) +} + +// jwtSource is a source that always does a signed JWT request for a token. +// It should typically be wrapped with a reuseTokenSource. +type jwtSource struct { + ctx context.Context + conf *Config +} + +func (js jwtSource) Token() (*oauth2.Token, error) { + exp := time.Duration(59) * time.Second + claimSet := &ClaimSet{ + Issuer: fmt.Sprintf("urn:atlassian:connect:clientid:%s", js.conf.ClientID), + Subject: fmt.Sprintf("urn:atlassian:connect:userkey:%s", js.conf.Subject), + InstalledURL: js.conf.BaseURL, + AuthURL: js.conf.Endpoint.AuthURL, + IssuedAt: time.Now().Unix(), + ExpiresIn: time.Now().Add(exp).Unix(), + } + + v := url.Values{} + v.Set("grant_type", defaultGrantType) + + // Add scopes if they exist; If not, it defaults to app scopes + if scopes := js.conf.Scopes; scopes != nil { + upperScopes := make([]string, len(scopes)) + for i, k := range scopes { + upperScopes[i] = strings.ToUpper(k) + } + v.Set("scope", strings.Join(upperScopes, "+")) + } + + // Sign claims for assertion + assertion, err := sign(js.conf.ClientSecret, claimSet) + if err != nil { + return nil, err + } + v.Set("assertion", string(assertion)) + + // Fetch access token from auth server + hc := oauth2.NewClient(js.ctx, nil) + resp, err := hc.PostForm(js.conf.Endpoint.TokenURL, v) + if err != nil { + return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err) + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20)) + if err != nil { + return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err) + } + if c := resp.StatusCode; c < 200 || c > 299 { + return nil, fmt.Errorf("oauth2: cannot fetch token: %v\nResponse: %s", resp.Status, body) + } + + // tokenRes is the JSON response body. + var tokenRes struct { + AccessToken string `json:"access_token"` + TokenType string `json:"token_type"` + ExpiresIn int64 `json:"expires_in"` // relative seconds from now + } + if err := json.Unmarshal(body, &tokenRes); err != nil { + return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err) + } + token := &oauth2.Token{ + AccessToken: tokenRes.AccessToken, + TokenType: tokenRes.TokenType, + } + + if secs := tokenRes.ExpiresIn; secs > 0 { + token.Expiry = time.Now().Add(time.Duration(secs) * time.Second) + } + return token, nil +} + +// Sign the claim set with the shared secret +// Result to be sent as assertion +func sign(key string, claims *ClaimSet) (string, error) { + b, err := json.Marshal(defaultHeader) + if err != nil { + return "", err + } + header := base64.RawURLEncoding.EncodeToString(b) + + jsonClaims, err := json.Marshal(claims) + if err != nil { + return "", err + } + encodedClaims := strings.TrimRight(base64.URLEncoding.EncodeToString(jsonClaims), "=") + + ss := fmt.Sprintf("%s.%s", header, encodedClaims) + + mac := hmac.New(sha256.New, []byte(key)) + mac.Write([]byte(ss)) + signature := mac.Sum(nil) + + return fmt.Sprintf("%s.%s", ss, base64.RawURLEncoding.EncodeToString(signature)), nil +} diff --git a/vendor/golang.org/x/oauth2/jira/jira_test.go b/vendor/golang.org/x/oauth2/jira/jira_test.go new file mode 100644 index 000000000..c49940dfc --- /dev/null +++ b/vendor/golang.org/x/oauth2/jira/jira_test.go @@ -0,0 +1,185 @@ +// 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 file. + +package jira + +import ( + "context" + "encoding/base64" + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "golang.org/x/oauth2" + "golang.org/x/oauth2/jws" +) + +func TestJWTFetch_JSONResponse(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{ + "access_token": "90d64460d14870c08c81352a05dedd3465940a7c", + "token_type": "Bearer", + "expires_in": 3600 + }`)) + })) + defer ts.Close() + + conf := &Config{ + BaseURL: "https://my.app.com", + Subject: "userkey", + Config: oauth2.Config{ + ClientID: "super_secret_client_id", + ClientSecret: "super_shared_secret", + Scopes: []string{"read", "write"}, + Endpoint: oauth2.Endpoint{ + AuthURL: "https://example.com", + TokenURL: ts.URL, + }, + }, + } + + tok, err := conf.TokenSource(context.Background()).Token() + if err != nil { + t.Fatal(err) + } + if !tok.Valid() { + t.Errorf("got invalid token: %v", tok) + } + if got, want := tok.AccessToken, "90d64460d14870c08c81352a05dedd3465940a7c"; got != want { + t.Errorf("access token = %q; want %q", got, want) + } + if got, want := tok.TokenType, "Bearer"; got != want { + t.Errorf("token type = %q; want %q", got, want) + } + if got := tok.Expiry.IsZero(); got { + t.Errorf("token expiry = %v, want none", got) + } +} + +func TestJWTFetch_BadResponse(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"token_type": "Bearer"}`)) + })) + defer ts.Close() + + conf := &Config{ + BaseURL: "https://my.app.com", + Subject: "userkey", + Config: oauth2.Config{ + ClientID: "super_secret_client_id", + ClientSecret: "super_shared_secret", + Scopes: []string{"read", "write"}, + Endpoint: oauth2.Endpoint{ + AuthURL: "https://example.com", + TokenURL: ts.URL, + }, + }, + } + + tok, err := conf.TokenSource(context.Background()).Token() + if err != nil { + t.Fatal(err) + } + if tok == nil { + t.Fatalf("got nil token; want token") + } + if tok.Valid() { + t.Errorf("got invalid token: %v", tok) + } + if got, want := tok.AccessToken, ""; got != want { + t.Errorf("access token = %q; want %q", got, want) + } + if got, want := tok.TokenType, "Bearer"; got != want { + t.Errorf("token type = %q; want %q", got, want) + } +} + +func TestJWTFetch_BadResponseType(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"access_token":123, "token_type": "Bearer"}`)) + })) + defer ts.Close() + + conf := &Config{ + BaseURL: "https://my.app.com", + Subject: "userkey", + Config: oauth2.Config{ + ClientID: "super_secret_client_id", + ClientSecret: "super_shared_secret", + Endpoint: oauth2.Endpoint{ + AuthURL: "https://example.com", + TokenURL: ts.URL, + }, + }, + } + + tok, err := conf.TokenSource(context.Background()).Token() + if err == nil { + t.Error("got a token; expected error") + if got, want := tok.AccessToken, ""; got != want { + t.Errorf("access token = %q; want %q", got, want) + } + } +} + +func TestJWTFetch_Assertion(t *testing.T) { + var assertion string + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + r.ParseForm() + assertion = r.Form.Get("assertion") + + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{ + "access_token": "90d64460d14870c08c81352a05dedd3465940a7c", + "token_type": "Bearer", + "expires_in": 3600 + }`)) + })) + defer ts.Close() + + conf := &Config{ + BaseURL: "https://my.app.com", + Subject: "userkey", + Config: oauth2.Config{ + ClientID: "super_secret_client_id", + ClientSecret: "super_shared_secret", + Endpoint: oauth2.Endpoint{ + AuthURL: "https://example.com", + TokenURL: ts.URL, + }, + }, + } + + _, err := conf.TokenSource(context.Background()).Token() + if err != nil { + t.Fatalf("Failed to fetch token: %v", err) + } + + parts := strings.Split(assertion, ".") + if len(parts) != 3 { + t.Fatalf("assertion = %q; want 3 parts", assertion) + } + gotjson, err := base64.RawURLEncoding.DecodeString(parts[0]) + if err != nil { + t.Fatalf("invalid token header; err = %v", err) + } + + got := jws.Header{} + if err := json.Unmarshal(gotjson, &got); err != nil { + t.Errorf("failed to unmarshal json token header = %q; err = %v", gotjson, err) + } + + want := jws.Header{ + Algorithm: "HS256", + Typ: "JWT", + } + if got != want { + t.Errorf("access token header = %q; want %q", got, want) + } +} diff --git a/vendor/golang.org/x/oauth2/jws/jws.go b/vendor/golang.org/x/oauth2/jws/jws.go new file mode 100644 index 000000000..683d2d271 --- /dev/null +++ b/vendor/golang.org/x/oauth2/jws/jws.go @@ -0,0 +1,182 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package jws provides a partial implementation +// of JSON Web Signature encoding and decoding. +// It exists to support the golang.org/x/oauth2 package. +// +// See RFC 7515. +// +// Deprecated: this package is not intended for public use and might be +// removed in the future. It exists for internal use only. +// Please switch to another JWS package or copy this package into your own +// source tree. +package jws // import "golang.org/x/oauth2/jws" + +import ( + "bytes" + "crypto" + "crypto/rand" + "crypto/rsa" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "strings" + "time" +) + +// ClaimSet contains information about the JWT signature including the +// permissions being requested (scopes), the target of the token, the issuer, +// the time the token was issued, and the lifetime of the token. +type ClaimSet struct { + Iss string `json:"iss"` // email address of the client_id of the application making the access token request + Scope string `json:"scope,omitempty"` // space-delimited list of the permissions the application requests + Aud string `json:"aud"` // descriptor of the intended target of the assertion (Optional). + Exp int64 `json:"exp"` // the expiration time of the assertion (seconds since Unix epoch) + Iat int64 `json:"iat"` // the time the assertion was issued (seconds since Unix epoch) + Typ string `json:"typ,omitempty"` // token type (Optional). + + // Email for which the application is requesting delegated access (Optional). + Sub string `json:"sub,omitempty"` + + // The old name of Sub. Client keeps setting Prn to be + // complaint with legacy OAuth 2.0 providers. (Optional) + Prn string `json:"prn,omitempty"` + + // See http://tools.ietf.org/html/draft-jones-json-web-token-10#section-4.3 + // This array is marshalled using custom code (see (c *ClaimSet) encode()). + PrivateClaims map[string]interface{} `json:"-"` +} + +func (c *ClaimSet) encode() (string, error) { + // Reverting time back for machines whose time is not perfectly in sync. + // If client machine's time is in the future according + // to Google servers, an access token will not be issued. + now := time.Now().Add(-10 * time.Second) + if c.Iat == 0 { + c.Iat = now.Unix() + } + if c.Exp == 0 { + c.Exp = now.Add(time.Hour).Unix() + } + if c.Exp < c.Iat { + return "", fmt.Errorf("jws: invalid Exp = %v; must be later than Iat = %v", c.Exp, c.Iat) + } + + b, err := json.Marshal(c) + if err != nil { + return "", err + } + + if len(c.PrivateClaims) == 0 { + return base64.RawURLEncoding.EncodeToString(b), nil + } + + // Marshal private claim set and then append it to b. + prv, err := json.Marshal(c.PrivateClaims) + if err != nil { + return "", fmt.Errorf("jws: invalid map of private claims %v", c.PrivateClaims) + } + + // Concatenate public and private claim JSON objects. + if !bytes.HasSuffix(b, []byte{'}'}) { + return "", fmt.Errorf("jws: invalid JSON %s", b) + } + if !bytes.HasPrefix(prv, []byte{'{'}) { + return "", fmt.Errorf("jws: invalid JSON %s", prv) + } + b[len(b)-1] = ',' // Replace closing curly brace with a comma. + b = append(b, prv[1:]...) // Append private claims. + return base64.RawURLEncoding.EncodeToString(b), nil +} + +// Header represents the header for the signed JWS payloads. +type Header struct { + // The algorithm used for signature. + Algorithm string `json:"alg"` + + // Represents the token type. + Typ string `json:"typ"` + + // The optional hint of which key is being used. + KeyID string `json:"kid,omitempty"` +} + +func (h *Header) encode() (string, error) { + b, err := json.Marshal(h) + if err != nil { + return "", err + } + return base64.RawURLEncoding.EncodeToString(b), nil +} + +// Decode decodes a claim set from a JWS payload. +func Decode(payload string) (*ClaimSet, error) { + // decode returned id token to get expiry + s := strings.Split(payload, ".") + if len(s) < 2 { + // TODO(jbd): Provide more context about the error. + return nil, errors.New("jws: invalid token received") + } + decoded, err := base64.RawURLEncoding.DecodeString(s[1]) + if err != nil { + return nil, err + } + c := &ClaimSet{} + err = json.NewDecoder(bytes.NewBuffer(decoded)).Decode(c) + return c, err +} + +// Signer returns a signature for the given data. +type Signer func(data []byte) (sig []byte, err error) + +// EncodeWithSigner encodes a header and claim set with the provided signer. +func EncodeWithSigner(header *Header, c *ClaimSet, sg Signer) (string, error) { + head, err := header.encode() + if err != nil { + return "", err + } + cs, err := c.encode() + if err != nil { + return "", err + } + ss := fmt.Sprintf("%s.%s", head, cs) + sig, err := sg([]byte(ss)) + if err != nil { + return "", err + } + return fmt.Sprintf("%s.%s", ss, base64.RawURLEncoding.EncodeToString(sig)), nil +} + +// Encode encodes a signed JWS with provided header and claim set. +// This invokes EncodeWithSigner using crypto/rsa.SignPKCS1v15 with the given RSA private key. +func Encode(header *Header, c *ClaimSet, key *rsa.PrivateKey) (string, error) { + sg := func(data []byte) (sig []byte, err error) { + h := sha256.New() + h.Write(data) + return rsa.SignPKCS1v15(rand.Reader, key, crypto.SHA256, h.Sum(nil)) + } + return EncodeWithSigner(header, c, sg) +} + +// Verify tests whether the provided JWT token's signature was produced by the private key +// associated with the supplied public key. +func Verify(token string, key *rsa.PublicKey) error { + parts := strings.Split(token, ".") + if len(parts) != 3 { + return errors.New("jws: invalid token received, token must have 3 parts") + } + + signedContent := parts[0] + "." + parts[1] + signatureString, err := base64.RawURLEncoding.DecodeString(parts[2]) + if err != nil { + return err + } + + h := sha256.New() + h.Write([]byte(signedContent)) + return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), []byte(signatureString)) +} diff --git a/vendor/golang.org/x/oauth2/jws/jws_test.go b/vendor/golang.org/x/oauth2/jws/jws_test.go new file mode 100644 index 000000000..39a136a29 --- /dev/null +++ b/vendor/golang.org/x/oauth2/jws/jws_test.go @@ -0,0 +1,46 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package jws + +import ( + "crypto/rand" + "crypto/rsa" + "testing" +) + +func TestSignAndVerify(t *testing.T) { + header := &Header{ + Algorithm: "RS256", + Typ: "JWT", + } + payload := &ClaimSet{ + Iss: "http://google.com/", + Aud: "", + Exp: 3610, + Iat: 10, + } + + privateKey, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + t.Fatal(err) + } + + token, err := Encode(header, payload, privateKey) + if err != nil { + t.Fatal(err) + } + + err = Verify(token, &privateKey.PublicKey) + if err != nil { + t.Fatal(err) + } +} + +func TestVerifyFailsOnMalformedClaim(t *testing.T) { + err := Verify("abc.def", nil) + if err == nil { + t.Error("got no errors; want improperly formed JWT not to be verified") + } +} diff --git a/vendor/golang.org/x/oauth2/jwt/example_test.go b/vendor/golang.org/x/oauth2/jwt/example_test.go new file mode 100644 index 000000000..58503d80d --- /dev/null +++ b/vendor/golang.org/x/oauth2/jwt/example_test.go @@ -0,0 +1,33 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package jwt_test + +import ( + "context" + + "golang.org/x/oauth2/jwt" +) + +func ExampleJWTConfig() { + ctx := context.Background() + conf := &jwt.Config{ + Email: "xxx@developer.com", + // The contents of your RSA private key or your PEM file + // that contains a private key. + // If you have a p12 file instead, you + // can use `openssl` to export the private key into a pem file. + // + // $ openssl pkcs12 -in key.p12 -out key.pem -nodes + // + // It only supports PEM containers with no passphrase. + PrivateKey: []byte("-----BEGIN RSA PRIVATE KEY-----..."), + Subject: "user@example.com", + TokenURL: "https://provider.com/o/oauth2/token", + } + // Initiate an http.Client, the following GET request will be + // authorized and authenticated on the behalf of user@example.com. + client := conf.Client(ctx) + client.Get("...") +} diff --git a/vendor/golang.org/x/oauth2/jwt/jwt.go b/vendor/golang.org/x/oauth2/jwt/jwt.go new file mode 100644 index 000000000..0783a94c4 --- /dev/null +++ b/vendor/golang.org/x/oauth2/jwt/jwt.go @@ -0,0 +1,162 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package jwt implements the OAuth 2.0 JSON Web Token flow, commonly +// known as "two-legged OAuth 2.0". +// +// See: https://tools.ietf.org/html/draft-ietf-oauth-jwt-bearer-12 +package jwt + +import ( + "context" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strings" + "time" + + "golang.org/x/oauth2" + "golang.org/x/oauth2/internal" + "golang.org/x/oauth2/jws" +) + +var ( + defaultGrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer" + defaultHeader = &jws.Header{Algorithm: "RS256", Typ: "JWT"} +) + +// Config is the configuration for using JWT to fetch tokens, +// commonly known as "two-legged OAuth 2.0". +type Config struct { + // Email is the OAuth client identifier used when communicating with + // the configured OAuth provider. + Email string + + // PrivateKey contains the contents of an RSA private key or the + // contents of a PEM file that contains a private key. The provided + // private key is used to sign JWT payloads. + // PEM containers with a passphrase are not supported. + // Use the following command to convert a PKCS 12 file into a PEM. + // + // $ openssl pkcs12 -in key.p12 -out key.pem -nodes + // + PrivateKey []byte + + // PrivateKeyID contains an optional hint indicating which key is being + // used. + PrivateKeyID string + + // Subject is the optional user to impersonate. + Subject string + + // Scopes optionally specifies a list of requested permission scopes. + Scopes []string + + // TokenURL is the endpoint required to complete the 2-legged JWT flow. + TokenURL string + + // Expires optionally specifies how long the token is valid for. + Expires time.Duration +} + +// TokenSource returns a JWT TokenSource using the configuration +// in c and the HTTP client from the provided context. +func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource { + return oauth2.ReuseTokenSource(nil, jwtSource{ctx, c}) +} + +// Client returns an HTTP client wrapping the context's +// HTTP transport and adding Authorization headers with tokens +// obtained from c. +// +// The returned client and its Transport should not be modified. +func (c *Config) Client(ctx context.Context) *http.Client { + return oauth2.NewClient(ctx, c.TokenSource(ctx)) +} + +// jwtSource is a source that always does a signed JWT request for a token. +// It should typically be wrapped with a reuseTokenSource. +type jwtSource struct { + ctx context.Context + conf *Config +} + +func (js jwtSource) Token() (*oauth2.Token, error) { + pk, err := internal.ParseKey(js.conf.PrivateKey) + if err != nil { + return nil, err + } + hc := oauth2.NewClient(js.ctx, nil) + claimSet := &jws.ClaimSet{ + Iss: js.conf.Email, + Scope: strings.Join(js.conf.Scopes, " "), + Aud: js.conf.TokenURL, + } + if subject := js.conf.Subject; subject != "" { + claimSet.Sub = subject + // prn is the old name of sub. Keep setting it + // to be compatible with legacy OAuth 2.0 providers. + claimSet.Prn = subject + } + if t := js.conf.Expires; t > 0 { + claimSet.Exp = time.Now().Add(t).Unix() + } + h := *defaultHeader + h.KeyID = js.conf.PrivateKeyID + payload, err := jws.Encode(&h, claimSet, pk) + if err != nil { + return nil, err + } + v := url.Values{} + v.Set("grant_type", defaultGrantType) + v.Set("assertion", payload) + resp, err := hc.PostForm(js.conf.TokenURL, v) + if err != nil { + return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err) + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20)) + if err != nil { + return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err) + } + if c := resp.StatusCode; c < 200 || c > 299 { + return nil, &oauth2.RetrieveError{ + Response: resp, + Body: body, + } + } + // tokenRes is the JSON response body. + var tokenRes struct { + AccessToken string `json:"access_token"` + TokenType string `json:"token_type"` + IDToken string `json:"id_token"` + ExpiresIn int64 `json:"expires_in"` // relative seconds from now + } + if err := json.Unmarshal(body, &tokenRes); err != nil { + return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err) + } + token := &oauth2.Token{ + AccessToken: tokenRes.AccessToken, + TokenType: tokenRes.TokenType, + } + raw := make(map[string]interface{}) + json.Unmarshal(body, &raw) // no error checks for optional fields + token = token.WithExtra(raw) + + if secs := tokenRes.ExpiresIn; secs > 0 { + token.Expiry = time.Now().Add(time.Duration(secs) * time.Second) + } + if v := tokenRes.IDToken; v != "" { + // decode returned id token to get expiry + claimSet, err := jws.Decode(v) + if err != nil { + return nil, fmt.Errorf("oauth2: error decoding JWT token: %v", err) + } + token.Expiry = time.Unix(claimSet.Exp, 0) + } + return token, nil +} diff --git a/vendor/golang.org/x/oauth2/jwt/jwt_test.go b/vendor/golang.org/x/oauth2/jwt/jwt_test.go new file mode 100644 index 000000000..1fbb9aa7d --- /dev/null +++ b/vendor/golang.org/x/oauth2/jwt/jwt_test.go @@ -0,0 +1,221 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package jwt + +import ( + "context" + "encoding/base64" + "encoding/json" + "fmt" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "golang.org/x/oauth2" + "golang.org/x/oauth2/jws" +) + +var dummyPrivateKey = []byte(`-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAx4fm7dngEmOULNmAs1IGZ9Apfzh+BkaQ1dzkmbUgpcoghucE +DZRnAGd2aPyB6skGMXUytWQvNYav0WTR00wFtX1ohWTfv68HGXJ8QXCpyoSKSSFY +fuP9X36wBSkSX9J5DVgiuzD5VBdzUISSmapjKm+DcbRALjz6OUIPEWi1Tjl6p5RK +1w41qdbmt7E5/kGhKLDuT7+M83g4VWhgIvaAXtnhklDAggilPPa8ZJ1IFe31lNlr +k4DRk38nc6sEutdf3RL7QoH7FBusI7uXV03DC6dwN1kP4GE7bjJhcRb/7jYt7CQ9 +/E9Exz3c0yAp0yrTg0Fwh+qxfH9dKwN52S7SBwIDAQABAoIBAQCaCs26K07WY5Jt +3a2Cw3y2gPrIgTCqX6hJs7O5ByEhXZ8nBwsWANBUe4vrGaajQHdLj5OKfsIDrOvn +2NI1MqflqeAbu/kR32q3tq8/Rl+PPiwUsW3E6Pcf1orGMSNCXxeducF2iySySzh3 +nSIhCG5uwJDWI7a4+9KiieFgK1pt/Iv30q1SQS8IEntTfXYwANQrfKUVMmVF9aIK +6/WZE2yd5+q3wVVIJ6jsmTzoDCX6QQkkJICIYwCkglmVy5AeTckOVwcXL0jqw5Kf +5/soZJQwLEyBoQq7Kbpa26QHq+CJONetPP8Ssy8MJJXBT+u/bSseMb3Zsr5cr43e +DJOhwsThAoGBAPY6rPKl2NT/K7XfRCGm1sbWjUQyDShscwuWJ5+kD0yudnT/ZEJ1 +M3+KS/iOOAoHDdEDi9crRvMl0UfNa8MAcDKHflzxg2jg/QI+fTBjPP5GOX0lkZ9g +z6VePoVoQw2gpPFVNPPTxKfk27tEzbaffvOLGBEih0Kb7HTINkW8rIlzAoGBAM9y +1yr+jvfS1cGFtNU+Gotoihw2eMKtIqR03Yn3n0PK1nVCDKqwdUqCypz4+ml6cxRK +J8+Pfdh7D+ZJd4LEG6Y4QRDLuv5OA700tUoSHxMSNn3q9As4+T3MUyYxWKvTeu3U +f2NWP9ePU0lV8ttk7YlpVRaPQmc1qwooBA/z/8AdAoGAW9x0HWqmRICWTBnpjyxx +QGlW9rQ9mHEtUotIaRSJ6K/F3cxSGUEkX1a3FRnp6kPLcckC6NlqdNgNBd6rb2rA +cPl/uSkZP42Als+9YMoFPU/xrrDPbUhu72EDrj3Bllnyb168jKLa4VBOccUvggxr +Dm08I1hgYgdN5huzs7y6GeUCgYEAj+AZJSOJ6o1aXS6rfV3mMRve9bQ9yt8jcKXw +5HhOCEmMtaSKfnOF1Ziih34Sxsb7O2428DiX0mV/YHtBnPsAJidL0SdLWIapBzeg +KHArByIRkwE6IvJvwpGMdaex1PIGhx5i/3VZL9qiq/ElT05PhIb+UXgoWMabCp84 +OgxDK20CgYAeaFo8BdQ7FmVX2+EEejF+8xSge6WVLtkaon8bqcn6P0O8lLypoOhd +mJAYH8WU+UAy9pecUnDZj14LAGNVmYcse8HFX71MoshnvCTFEPVo4rZxIAGwMpeJ +5jgQ3slYLpqrGlcbLgUXBUgzEO684Wk/UV9DFPlHALVqCfXQ9dpJPg== +-----END RSA PRIVATE KEY-----`) + +func TestJWTFetch_JSONResponse(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{ + "access_token": "90d64460d14870c08c81352a05dedd3465940a7c", + "scope": "user", + "token_type": "bearer", + "expires_in": 3600 + }`)) + })) + defer ts.Close() + + conf := &Config{ + Email: "aaa@xxx.com", + PrivateKey: dummyPrivateKey, + TokenURL: ts.URL, + } + tok, err := conf.TokenSource(context.Background()).Token() + if err != nil { + t.Fatal(err) + } + if !tok.Valid() { + t.Errorf("got invalid token: %v", tok) + } + if got, want := tok.AccessToken, "90d64460d14870c08c81352a05dedd3465940a7c"; got != want { + t.Errorf("access token = %q; want %q", got, want) + } + if got, want := tok.TokenType, "bearer"; got != want { + t.Errorf("token type = %q; want %q", got, want) + } + if got := tok.Expiry.IsZero(); got { + t.Errorf("token expiry = %v, want none", got) + } + scope := tok.Extra("scope") + if got, want := scope, "user"; got != want { + t.Errorf("scope = %q; want %q", got, want) + } +} + +func TestJWTFetch_BadResponse(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"scope": "user", "token_type": "bearer"}`)) + })) + defer ts.Close() + + conf := &Config{ + Email: "aaa@xxx.com", + PrivateKey: dummyPrivateKey, + TokenURL: ts.URL, + } + tok, err := conf.TokenSource(context.Background()).Token() + if err != nil { + t.Fatal(err) + } + if tok == nil { + t.Fatalf("got nil token; want token") + } + if tok.Valid() { + t.Errorf("got invalid token: %v", tok) + } + if got, want := tok.AccessToken, ""; got != want { + t.Errorf("access token = %q; want %q", got, want) + } + if got, want := tok.TokenType, "bearer"; got != want { + t.Errorf("token type = %q; want %q", got, want) + } + scope := tok.Extra("scope") + if got, want := scope, "user"; got != want { + t.Errorf("token scope = %q; want %q", got, want) + } +} + +func TestJWTFetch_BadResponseType(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"access_token":123, "scope": "user", "token_type": "bearer"}`)) + })) + defer ts.Close() + conf := &Config{ + Email: "aaa@xxx.com", + PrivateKey: dummyPrivateKey, + TokenURL: ts.URL, + } + tok, err := conf.TokenSource(context.Background()).Token() + if err == nil { + t.Error("got a token; expected error") + if got, want := tok.AccessToken, ""; got != want { + t.Errorf("access token = %q; want %q", got, want) + } + } +} + +func TestJWTFetch_Assertion(t *testing.T) { + var assertion string + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + r.ParseForm() + assertion = r.Form.Get("assertion") + + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{ + "access_token": "90d64460d14870c08c81352a05dedd3465940a7c", + "scope": "user", + "token_type": "bearer", + "expires_in": 3600 + }`)) + })) + defer ts.Close() + + conf := &Config{ + Email: "aaa@xxx.com", + PrivateKey: dummyPrivateKey, + PrivateKeyID: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + TokenURL: ts.URL, + } + + _, err := conf.TokenSource(context.Background()).Token() + if err != nil { + t.Fatalf("Failed to fetch token: %v", err) + } + + parts := strings.Split(assertion, ".") + if len(parts) != 3 { + t.Fatalf("assertion = %q; want 3 parts", assertion) + } + gotjson, err := base64.RawURLEncoding.DecodeString(parts[0]) + if err != nil { + t.Fatalf("invalid token header; err = %v", err) + } + + got := jws.Header{} + if err := json.Unmarshal(gotjson, &got); err != nil { + t.Errorf("failed to unmarshal json token header = %q; err = %v", gotjson, err) + } + + want := jws.Header{ + Algorithm: "RS256", + Typ: "JWT", + KeyID: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + } + if got != want { + t.Errorf("access token header = %q; want %q", got, want) + } +} + +func TestTokenRetrieveError(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-type", "application/json") + w.WriteHeader(http.StatusBadRequest) + w.Write([]byte(`{"error": "invalid_grant"}`)) + })) + defer ts.Close() + + conf := &Config{ + Email: "aaa@xxx.com", + PrivateKey: dummyPrivateKey, + TokenURL: ts.URL, + } + + _, err := conf.TokenSource(context.Background()).Token() + if err == nil { + t.Fatalf("got no error, expected one") + } + _, ok := err.(*oauth2.RetrieveError) + if !ok { + t.Fatalf("got %T error, expected *RetrieveError", err) + } + // Test error string for backwards compatibility + expected := fmt.Sprintf("oauth2: cannot fetch token: %v\nResponse: %s", "400 Bad Request", `{"error": "invalid_grant"}`) + if errStr := err.Error(); errStr != expected { + t.Fatalf("got %#v, expected %#v", errStr, expected) + } +} diff --git a/vendor/golang.org/x/oauth2/kakao/kakao.go b/vendor/golang.org/x/oauth2/kakao/kakao.go new file mode 100644 index 000000000..6d211260c --- /dev/null +++ b/vendor/golang.org/x/oauth2/kakao/kakao.go @@ -0,0 +1,16 @@ +// 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 file. + +// Package kakao provides constants for using OAuth2 to access Kakao. +package kakao // import "golang.org/x/oauth2/kakao" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Kakao's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://kauth.kakao.com/oauth/authorize", + TokenURL: "https://kauth.kakao.com/oauth/token", +} diff --git a/vendor/golang.org/x/oauth2/linkedin/linkedin.go b/vendor/golang.org/x/oauth2/linkedin/linkedin.go new file mode 100644 index 000000000..62d1de817 --- /dev/null +++ b/vendor/golang.org/x/oauth2/linkedin/linkedin.go @@ -0,0 +1,16 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package linkedin provides constants for using OAuth2 to access LinkedIn. +package linkedin // import "golang.org/x/oauth2/linkedin" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is LinkedIn's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://www.linkedin.com/oauth/v2/authorization", + TokenURL: "https://www.linkedin.com/oauth/v2/accessToken", +} diff --git a/vendor/golang.org/x/oauth2/mailchimp/mailchimp.go b/vendor/golang.org/x/oauth2/mailchimp/mailchimp.go new file mode 100644 index 000000000..647787ec6 --- /dev/null +++ b/vendor/golang.org/x/oauth2/mailchimp/mailchimp.go @@ -0,0 +1,17 @@ +// 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 file. + +// Package mailchimp provides constants for using OAuth2 to access MailChimp. +package mailchimp // import "golang.org/x/oauth2/mailchimp" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is MailChimp's OAuth 2.0 endpoint. +// See http://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/ +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://login.mailchimp.com/oauth2/authorize", + TokenURL: "https://login.mailchimp.com/oauth2/token", +} diff --git a/vendor/golang.org/x/oauth2/mailru/mailru.go b/vendor/golang.org/x/oauth2/mailru/mailru.go new file mode 100644 index 000000000..dddd9dd0f --- /dev/null +++ b/vendor/golang.org/x/oauth2/mailru/mailru.go @@ -0,0 +1,16 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package mailru provides constants for using OAuth2 to access Mail.Ru. +package mailru // import "golang.org/x/oauth2/mailru" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Mail.Ru's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://o2.mail.ru/login", + TokenURL: "https://o2.mail.ru/token", +} diff --git a/vendor/golang.org/x/oauth2/mediamath/mediamath.go b/vendor/golang.org/x/oauth2/mediamath/mediamath.go new file mode 100644 index 000000000..3ebce5da1 --- /dev/null +++ b/vendor/golang.org/x/oauth2/mediamath/mediamath.go @@ -0,0 +1,22 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package mediamath provides constants for using OAuth2 to access MediaMath. +package mediamath // import "golang.org/x/oauth2/mediamath" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is MediaMath's OAuth 2.0 endpoint for production. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://api.mediamath.com/oauth2/v1.0/authorize", + TokenURL: "https://api.mediamath.com/oauth2/v1.0/token", +} + +// SandboxEndpoint is MediaMath's OAuth 2.0 endpoint for sandbox. +var SandboxEndpoint = oauth2.Endpoint{ + AuthURL: "https://t1sandbox.mediamath.com/oauth2/v1.0/authorize", + TokenURL: "https://t1sandbox.mediamath.com/oauth2/v1.0/token", +} diff --git a/vendor/golang.org/x/oauth2/microsoft/microsoft.go b/vendor/golang.org/x/oauth2/microsoft/microsoft.go new file mode 100644 index 000000000..3ffbc57a6 --- /dev/null +++ b/vendor/golang.org/x/oauth2/microsoft/microsoft.go @@ -0,0 +1,31 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package microsoft provides constants for using OAuth2 to access Windows Live ID. +package microsoft // import "golang.org/x/oauth2/microsoft" + +import ( + "golang.org/x/oauth2" +) + +// LiveConnectEndpoint is Windows's Live ID OAuth 2.0 endpoint. +var LiveConnectEndpoint = oauth2.Endpoint{ + AuthURL: "https://login.live.com/oauth20_authorize.srf", + TokenURL: "https://login.live.com/oauth20_token.srf", +} + +// AzureADEndpoint returns a new oauth2.Endpoint for the given tenant at Azure Active Directory. +// If tenant is empty, it uses the tenant called `common`. +// +// For more information see: +// https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints +func AzureADEndpoint(tenant string) oauth2.Endpoint { + if tenant == "" { + tenant = "common" + } + return oauth2.Endpoint{ + AuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/authorize", + TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token", + } +} diff --git a/vendor/golang.org/x/oauth2/nokiahealth/nokiahealth.go b/vendor/golang.org/x/oauth2/nokiahealth/nokiahealth.go new file mode 100644 index 000000000..c181ccd0f --- /dev/null +++ b/vendor/golang.org/x/oauth2/nokiahealth/nokiahealth.go @@ -0,0 +1,16 @@ +// Copyright 2018 The oauth2 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 nokiahealth provides constants for using OAuth2 to access the Nokia Health Mate API. +package nokiahealth + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Nokia Health Mate's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://account.health.nokia.com/oauth2_user/authorize2", + TokenURL: "https://account.health.nokia.com/oauth2/token", +} diff --git a/vendor/golang.org/x/oauth2/oauth2.go b/vendor/golang.org/x/oauth2/oauth2.go new file mode 100644 index 000000000..1e8e1b741 --- /dev/null +++ b/vendor/golang.org/x/oauth2/oauth2.go @@ -0,0 +1,360 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package oauth2 provides support for making +// OAuth2 authorized and authenticated HTTP requests, +// as specified in RFC 6749. +// It can additionally grant authorization with Bearer JWT. +package oauth2 // import "golang.org/x/oauth2" + +import ( + "bytes" + "context" + "errors" + "net/http" + "net/url" + "strings" + "sync" + + "golang.org/x/oauth2/internal" +) + +// NoContext is the default context you should supply if not using +// your own context.Context (see https://golang.org/x/net/context). +// +// Deprecated: Use context.Background() or context.TODO() instead. +var NoContext = context.TODO() + +// RegisterBrokenAuthHeaderProvider registers an OAuth2 server +// identified by the tokenURL prefix as an OAuth2 implementation +// which doesn't support the HTTP Basic authentication +// scheme to authenticate with the authorization server. +// Once a server is registered, credentials (client_id and client_secret) +// will be passed as query parameters rather than being present +// in the Authorization header. +// See https://code.google.com/p/goauth2/issues/detail?id=31 for background. +func RegisterBrokenAuthHeaderProvider(tokenURL string) { + internal.RegisterBrokenAuthHeaderProvider(tokenURL) +} + +// Config describes a typical 3-legged OAuth2 flow, with both the +// client application information and the server's endpoint URLs. +// For the client credentials 2-legged OAuth2 flow, see the clientcredentials +// package (https://golang.org/x/oauth2/clientcredentials). +type Config struct { + // ClientID is the application's ID. + ClientID string + + // ClientSecret is the application's secret. + ClientSecret string + + // Endpoint contains the resource server's token endpoint + // URLs. These are constants specific to each server and are + // often available via site-specific packages, such as + // google.Endpoint or github.Endpoint. + Endpoint Endpoint + + // RedirectURL is the URL to redirect users going through + // the OAuth flow, after the resource owner's URLs. + RedirectURL string + + // Scope specifies optional requested permissions. + Scopes []string +} + +// A TokenSource is anything that can return a token. +type TokenSource interface { + // Token returns a token or an error. + // Token must be safe for concurrent use by multiple goroutines. + // The returned Token must not be modified. + Token() (*Token, error) +} + +// Endpoint contains the OAuth 2.0 provider's authorization and token +// endpoint URLs. +type Endpoint struct { + AuthURL string + TokenURL string +} + +var ( + // AccessTypeOnline and AccessTypeOffline are options passed + // to the Options.AuthCodeURL method. They modify the + // "access_type" field that gets sent in the URL returned by + // AuthCodeURL. + // + // Online is the default if neither is specified. If your + // application needs to refresh access tokens when the user + // is not present at the browser, then use offline. This will + // result in your application obtaining a refresh token the + // first time your application exchanges an authorization + // code for a user. + AccessTypeOnline AuthCodeOption = SetAuthURLParam("access_type", "online") + AccessTypeOffline AuthCodeOption = SetAuthURLParam("access_type", "offline") + + // ApprovalForce forces the users to view the consent dialog + // and confirm the permissions request at the URL returned + // from AuthCodeURL, even if they've already done so. + ApprovalForce AuthCodeOption = SetAuthURLParam("approval_prompt", "force") +) + +// An AuthCodeOption is passed to Config.AuthCodeURL. +type AuthCodeOption interface { + setValue(url.Values) +} + +type setParam struct{ k, v string } + +func (p setParam) setValue(m url.Values) { m.Set(p.k, p.v) } + +// SetAuthURLParam builds an AuthCodeOption which passes key/value parameters +// to a provider's authorization endpoint. +func SetAuthURLParam(key, value string) AuthCodeOption { + return setParam{key, value} +} + +// AuthCodeURL returns a URL to OAuth 2.0 provider's consent page +// that asks for permissions for the required scopes explicitly. +// +// State is a token to protect the user from CSRF attacks. You must +// always provide a non-empty string and validate that it matches the +// the state query parameter on your redirect callback. +// See http://tools.ietf.org/html/rfc6749#section-10.12 for more info. +// +// Opts may include AccessTypeOnline or AccessTypeOffline, as well +// as ApprovalForce. +// It can also be used to pass the PKCE challange. +// See https://www.oauth.com/oauth2-servers/pkce/ for more info. +func (c *Config) AuthCodeURL(state string, opts ...AuthCodeOption) string { + var buf bytes.Buffer + buf.WriteString(c.Endpoint.AuthURL) + v := url.Values{ + "response_type": {"code"}, + "client_id": {c.ClientID}, + } + if c.RedirectURL != "" { + v.Set("redirect_uri", c.RedirectURL) + } + if len(c.Scopes) > 0 { + v.Set("scope", strings.Join(c.Scopes, " ")) + } + if state != "" { + // TODO(light): Docs say never to omit state; don't allow empty. + v.Set("state", state) + } + for _, opt := range opts { + opt.setValue(v) + } + if strings.Contains(c.Endpoint.AuthURL, "?") { + buf.WriteByte('&') + } else { + buf.WriteByte('?') + } + buf.WriteString(v.Encode()) + return buf.String() +} + +// PasswordCredentialsToken converts a resource owner username and password +// pair into a token. +// +// Per the RFC, this grant type should only be used "when there is a high +// degree of trust between the resource owner and the client (e.g., the client +// is part of the device operating system or a highly privileged application), +// and when other authorization grant types are not available." +// See https://tools.ietf.org/html/rfc6749#section-4.3 for more info. +// +// The provided context optionally controls which HTTP client is used. See the HTTPClient variable. +func (c *Config) PasswordCredentialsToken(ctx context.Context, username, password string) (*Token, error) { + v := url.Values{ + "grant_type": {"password"}, + "username": {username}, + "password": {password}, + } + if len(c.Scopes) > 0 { + v.Set("scope", strings.Join(c.Scopes, " ")) + } + return retrieveToken(ctx, c, v) +} + +// Exchange converts an authorization code into a token. +// +// It is used after a resource provider redirects the user back +// to the Redirect URI (the URL obtained from AuthCodeURL). +// +// The provided context optionally controls which HTTP client is used. See the HTTPClient variable. +// +// The code will be in the *http.Request.FormValue("code"). Before +// calling Exchange, be sure to validate FormValue("state"). +// +// Opts may include the PKCE verifier code if previously used in AuthCodeURL. +// See https://www.oauth.com/oauth2-servers/pkce/ for more info. +func (c *Config) Exchange(ctx context.Context, code string, opts ...AuthCodeOption) (*Token, error) { + v := url.Values{ + "grant_type": {"authorization_code"}, + "code": {code}, + } + if c.RedirectURL != "" { + v.Set("redirect_uri", c.RedirectURL) + } + for _, opt := range opts { + opt.setValue(v) + } + return retrieveToken(ctx, c, v) +} + +// Client returns an HTTP client using the provided token. +// The token will auto-refresh as necessary. The underlying +// HTTP transport will be obtained using the provided context. +// The returned client and its Transport should not be modified. +func (c *Config) Client(ctx context.Context, t *Token) *http.Client { + return NewClient(ctx, c.TokenSource(ctx, t)) +} + +// TokenSource returns a TokenSource that returns t until t expires, +// automatically refreshing it as necessary using the provided context. +// +// Most users will use Config.Client instead. +func (c *Config) TokenSource(ctx context.Context, t *Token) TokenSource { + tkr := &tokenRefresher{ + ctx: ctx, + conf: c, + } + if t != nil { + tkr.refreshToken = t.RefreshToken + } + return &reuseTokenSource{ + t: t, + new: tkr, + } +} + +// tokenRefresher is a TokenSource that makes "grant_type"=="refresh_token" +// HTTP requests to renew a token using a RefreshToken. +type tokenRefresher struct { + ctx context.Context // used to get HTTP requests + conf *Config + refreshToken string +} + +// WARNING: Token is not safe for concurrent access, as it +// updates the tokenRefresher's refreshToken field. +// Within this package, it is used by reuseTokenSource which +// synchronizes calls to this method with its own mutex. +func (tf *tokenRefresher) Token() (*Token, error) { + if tf.refreshToken == "" { + return nil, errors.New("oauth2: token expired and refresh token is not set") + } + + tk, err := retrieveToken(tf.ctx, tf.conf, url.Values{ + "grant_type": {"refresh_token"}, + "refresh_token": {tf.refreshToken}, + }) + + if err != nil { + return nil, err + } + if tf.refreshToken != tk.RefreshToken { + tf.refreshToken = tk.RefreshToken + } + return tk, err +} + +// reuseTokenSource is a TokenSource that holds a single token in memory +// and validates its expiry before each call to retrieve it with +// Token. If it's expired, it will be auto-refreshed using the +// new TokenSource. +type reuseTokenSource struct { + new TokenSource // called when t is expired. + + mu sync.Mutex // guards t + t *Token +} + +// Token returns the current token if it's still valid, else will +// refresh the current token (using r.Context for HTTP client +// information) and return the new one. +func (s *reuseTokenSource) Token() (*Token, error) { + s.mu.Lock() + defer s.mu.Unlock() + if s.t.Valid() { + return s.t, nil + } + t, err := s.new.Token() + if err != nil { + return nil, err + } + s.t = t + return t, nil +} + +// StaticTokenSource returns a TokenSource that always returns the same token. +// Because the provided token t is never refreshed, StaticTokenSource is only +// useful for tokens that never expire. +func StaticTokenSource(t *Token) TokenSource { + return staticTokenSource{t} +} + +// staticTokenSource is a TokenSource that always returns the same Token. +type staticTokenSource struct { + t *Token +} + +func (s staticTokenSource) Token() (*Token, error) { + return s.t, nil +} + +// HTTPClient is the context key to use with golang.org/x/net/context's +// WithValue function to associate an *http.Client value with a context. +var HTTPClient internal.ContextKey + +// NewClient creates an *http.Client from a Context and TokenSource. +// The returned client is not valid beyond the lifetime of the context. +// +// Note that if a custom *http.Client is provided via the Context it +// is used only for token acquisition and is not used to configure the +// *http.Client returned from NewClient. +// +// As a special case, if src is nil, a non-OAuth2 client is returned +// using the provided context. This exists to support related OAuth2 +// packages. +func NewClient(ctx context.Context, src TokenSource) *http.Client { + if src == nil { + return internal.ContextClient(ctx) + } + return &http.Client{ + Transport: &Transport{ + Base: internal.ContextClient(ctx).Transport, + Source: ReuseTokenSource(nil, src), + }, + } +} + +// ReuseTokenSource returns a TokenSource which repeatedly returns the +// same token as long as it's valid, starting with t. +// When its cached token is invalid, a new token is obtained from src. +// +// ReuseTokenSource is typically used to reuse tokens from a cache +// (such as a file on disk) between runs of a program, rather than +// obtaining new tokens unnecessarily. +// +// The initial token t may be nil, in which case the TokenSource is +// wrapped in a caching version if it isn't one already. This also +// means it's always safe to wrap ReuseTokenSource around any other +// TokenSource without adverse effects. +func ReuseTokenSource(t *Token, src TokenSource) TokenSource { + // Don't wrap a reuseTokenSource in itself. That would work, + // but cause an unnecessary number of mutex operations. + // Just build the equivalent one. + if rt, ok := src.(*reuseTokenSource); ok { + if t == nil { + // Just use it directly. + return rt + } + src = rt.new + } + return &reuseTokenSource{ + t: t, + new: src, + } +} diff --git a/vendor/golang.org/x/oauth2/oauth2_test.go b/vendor/golang.org/x/oauth2/oauth2_test.go new file mode 100644 index 000000000..19aaf6b2b --- /dev/null +++ b/vendor/golang.org/x/oauth2/oauth2_test.go @@ -0,0 +1,550 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package oauth2 + +import ( + "context" + "errors" + "fmt" + "io/ioutil" + "net/http" + "net/http/httptest" + "net/url" + "testing" + "time" +) + +type mockTransport struct { + rt func(req *http.Request) (resp *http.Response, err error) +} + +func (t *mockTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) { + return t.rt(req) +} + +func newConf(url string) *Config { + return &Config{ + ClientID: "CLIENT_ID", + ClientSecret: "CLIENT_SECRET", + RedirectURL: "REDIRECT_URL", + Scopes: []string{"scope1", "scope2"}, + Endpoint: Endpoint{ + AuthURL: url + "/auth", + TokenURL: url + "/token", + }, + } +} + +func TestAuthCodeURL(t *testing.T) { + conf := newConf("server") + url := conf.AuthCodeURL("foo", AccessTypeOffline, ApprovalForce) + const want = "server/auth?access_type=offline&approval_prompt=force&client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=scope1+scope2&state=foo" + if got := url; got != want { + t.Errorf("got auth code URL = %q; want %q", got, want) + } +} + +func TestAuthCodeURL_CustomParam(t *testing.T) { + conf := newConf("server") + param := SetAuthURLParam("foo", "bar") + url := conf.AuthCodeURL("baz", param) + const want = "server/auth?client_id=CLIENT_ID&foo=bar&redirect_uri=REDIRECT_URL&response_type=code&scope=scope1+scope2&state=baz" + if got := url; got != want { + t.Errorf("got auth code = %q; want %q", got, want) + } +} + +func TestAuthCodeURL_Optional(t *testing.T) { + conf := &Config{ + ClientID: "CLIENT_ID", + Endpoint: Endpoint{ + AuthURL: "/auth-url", + TokenURL: "/token-url", + }, + } + url := conf.AuthCodeURL("") + const want = "/auth-url?client_id=CLIENT_ID&response_type=code" + if got := url; got != want { + t.Fatalf("got auth code = %q; want %q", got, want) + } +} + +func TestURLUnsafeClientConfig(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if got, want := r.Header.Get("Authorization"), "Basic Q0xJRU5UX0lEJTNGJTNGOkNMSUVOVF9TRUNSRVQlM0YlM0Y="; got != want { + t.Errorf("Authorization header = %q; want %q", got, want) + } + + w.Header().Set("Content-Type", "application/x-www-form-urlencoded") + w.Write([]byte("access_token=90d64460d14870c08c81352a05dedd3465940a7c&scope=user&token_type=bearer")) + })) + defer ts.Close() + conf := newConf(ts.URL) + conf.ClientID = "CLIENT_ID??" + conf.ClientSecret = "CLIENT_SECRET??" + _, err := conf.Exchange(context.Background(), "exchange-code") + if err != nil { + t.Error(err) + } +} + +func TestExchangeRequest(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.String() != "/token" { + t.Errorf("Unexpected exchange request URL, %v is found.", r.URL) + } + headerAuth := r.Header.Get("Authorization") + if headerAuth != "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" { + t.Errorf("Unexpected authorization header, %v is found.", headerAuth) + } + headerContentType := r.Header.Get("Content-Type") + if headerContentType != "application/x-www-form-urlencoded" { + t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) + } + body, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Errorf("Failed reading request body: %s.", err) + } + if string(body) != "code=exchange-code&grant_type=authorization_code&redirect_uri=REDIRECT_URL" { + t.Errorf("Unexpected exchange payload, %v is found.", string(body)) + } + w.Header().Set("Content-Type", "application/x-www-form-urlencoded") + w.Write([]byte("access_token=90d64460d14870c08c81352a05dedd3465940a7c&scope=user&token_type=bearer")) + })) + defer ts.Close() + conf := newConf(ts.URL) + tok, err := conf.Exchange(context.Background(), "exchange-code") + if err != nil { + t.Error(err) + } + if !tok.Valid() { + t.Fatalf("Token invalid. Got: %#v", tok) + } + if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" { + t.Errorf("Unexpected access token, %#v.", tok.AccessToken) + } + if tok.TokenType != "bearer" { + t.Errorf("Unexpected token type, %#v.", tok.TokenType) + } + scope := tok.Extra("scope") + if scope != "user" { + t.Errorf("Unexpected value for scope: %v", scope) + } +} + +func TestExchangeRequest_CustomParam(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.String() != "/token" { + t.Errorf("Unexpected exchange request URL, %v is found.", r.URL) + } + headerAuth := r.Header.Get("Authorization") + if headerAuth != "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" { + t.Errorf("Unexpected authorization header, %v is found.", headerAuth) + } + headerContentType := r.Header.Get("Content-Type") + if headerContentType != "application/x-www-form-urlencoded" { + t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) + } + body, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Errorf("Failed reading request body: %s.", err) + } + if string(body) != "code=exchange-code&foo=bar&grant_type=authorization_code&redirect_uri=REDIRECT_URL" { + t.Errorf("Unexpected exchange payload, %v is found.", string(body)) + } + w.Header().Set("Content-Type", "application/x-www-form-urlencoded") + w.Write([]byte("access_token=90d64460d14870c08c81352a05dedd3465940a7c&scope=user&token_type=bearer")) + })) + defer ts.Close() + conf := newConf(ts.URL) + + param := SetAuthURLParam("foo", "bar") + tok, err := conf.Exchange(context.Background(), "exchange-code", param) + if err != nil { + t.Error(err) + } + if !tok.Valid() { + t.Fatalf("Token invalid. Got: %#v", tok) + } + if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" { + t.Errorf("Unexpected access token, %#v.", tok.AccessToken) + } + if tok.TokenType != "bearer" { + t.Errorf("Unexpected token type, %#v.", tok.TokenType) + } + scope := tok.Extra("scope") + if scope != "user" { + t.Errorf("Unexpected value for scope: %v", scope) + } +} + +func TestExchangeRequest_JSONResponse(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.String() != "/token" { + t.Errorf("Unexpected exchange request URL, %v is found.", r.URL) + } + headerAuth := r.Header.Get("Authorization") + if headerAuth != "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" { + t.Errorf("Unexpected authorization header, %v is found.", headerAuth) + } + headerContentType := r.Header.Get("Content-Type") + if headerContentType != "application/x-www-form-urlencoded" { + t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) + } + body, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Errorf("Failed reading request body: %s.", err) + } + if string(body) != "code=exchange-code&grant_type=authorization_code&redirect_uri=REDIRECT_URL" { + t.Errorf("Unexpected exchange payload, %v is found.", string(body)) + } + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"access_token": "90d64460d14870c08c81352a05dedd3465940a7c", "scope": "user", "token_type": "bearer", "expires_in": 86400}`)) + })) + defer ts.Close() + conf := newConf(ts.URL) + tok, err := conf.Exchange(context.Background(), "exchange-code") + if err != nil { + t.Error(err) + } + if !tok.Valid() { + t.Fatalf("Token invalid. Got: %#v", tok) + } + if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" { + t.Errorf("Unexpected access token, %#v.", tok.AccessToken) + } + if tok.TokenType != "bearer" { + t.Errorf("Unexpected token type, %#v.", tok.TokenType) + } + scope := tok.Extra("scope") + if scope != "user" { + t.Errorf("Unexpected value for scope: %v", scope) + } + expiresIn := tok.Extra("expires_in") + if expiresIn != float64(86400) { + t.Errorf("Unexpected non-numeric value for expires_in: %v", expiresIn) + } +} + +func TestExtraValueRetrieval(t *testing.T) { + values := url.Values{} + kvmap := map[string]string{ + "scope": "user", "token_type": "bearer", "expires_in": "86400.92", + "server_time": "1443571905.5606415", "referer_ip": "10.0.0.1", + "etag": "\"afZYj912P4alikMz_P11982\"", "request_id": "86400", + "untrimmed": " untrimmed ", + } + for key, value := range kvmap { + values.Set(key, value) + } + + tok := Token{raw: values} + scope := tok.Extra("scope") + if got, want := scope, "user"; got != want { + t.Errorf("got scope = %q; want %q", got, want) + } + serverTime := tok.Extra("server_time") + if got, want := serverTime, 1443571905.5606415; got != want { + t.Errorf("got server_time value = %v; want %v", got, want) + } + refererIP := tok.Extra("referer_ip") + if got, want := refererIP, "10.0.0.1"; got != want { + t.Errorf("got referer_ip value = %v, want %v", got, want) + } + expiresIn := tok.Extra("expires_in") + if got, want := expiresIn, 86400.92; got != want { + t.Errorf("got expires_in value = %v, want %v", got, want) + } + requestID := tok.Extra("request_id") + if got, want := requestID, int64(86400); got != want { + t.Errorf("got request_id value = %v, want %v", got, want) + } + untrimmed := tok.Extra("untrimmed") + if got, want := untrimmed, " untrimmed "; got != want { + t.Errorf("got untrimmed = %q; want %q", got, want) + } +} + +const day = 24 * time.Hour + +func TestExchangeRequest_JSONResponse_Expiry(t *testing.T) { + seconds := int32(day.Seconds()) + for _, c := range []struct { + expires string + want bool + }{ + {fmt.Sprintf(`"expires_in": %d`, seconds), true}, + {fmt.Sprintf(`"expires_in": "%d"`, seconds), true}, // PayPal case + {fmt.Sprintf(`"expires": %d`, seconds), true}, // Facebook case + {`"expires": false`, false}, // wrong type + {`"expires": {}`, false}, // wrong type + {`"expires": "zzz"`, false}, // wrong value + } { + testExchangeRequest_JSONResponse_expiry(t, c.expires, c.want) + } +} + +func testExchangeRequest_JSONResponse_expiry(t *testing.T, exp string, want bool) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(fmt.Sprintf(`{"access_token": "90d", "scope": "user", "token_type": "bearer", %s}`, exp))) + })) + defer ts.Close() + conf := newConf(ts.URL) + t1 := time.Now().Add(day) + tok, err := conf.Exchange(context.Background(), "exchange-code") + t2 := time.Now().Add(day) + + if got := (err == nil); got != want { + if want { + t.Errorf("unexpected error: got %v", err) + } else { + t.Errorf("unexpected success") + } + } + if !want { + return + } + if !tok.Valid() { + t.Fatalf("Token invalid. Got: %#v", tok) + } + expiry := tok.Expiry + if expiry.Before(t1) || expiry.After(t2) { + t.Errorf("Unexpected value for Expiry: %v (shold be between %v and %v)", expiry, t1, t2) + } +} + +func TestExchangeRequest_BadResponse(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"scope": "user", "token_type": "bearer"}`)) + })) + defer ts.Close() + conf := newConf(ts.URL) + _, err := conf.Exchange(context.Background(), "code") + if err == nil { + t.Error("expected error from missing access_token") + } +} + +func TestExchangeRequest_BadResponseType(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"access_token":123, "scope": "user", "token_type": "bearer"}`)) + })) + defer ts.Close() + conf := newConf(ts.URL) + _, err := conf.Exchange(context.Background(), "exchange-code") + if err == nil { + t.Error("expected error from non-string access_token") + } +} + +func TestExchangeRequest_NonBasicAuth(t *testing.T) { + tr := &mockTransport{ + rt: func(r *http.Request) (w *http.Response, err error) { + headerAuth := r.Header.Get("Authorization") + if headerAuth != "" { + t.Errorf("Unexpected authorization header, %v is found.", headerAuth) + } + return nil, errors.New("no response") + }, + } + c := &http.Client{Transport: tr} + conf := &Config{ + ClientID: "CLIENT_ID", + Endpoint: Endpoint{ + AuthURL: "https://accounts.google.com/auth", + TokenURL: "https://accounts.google.com/token", + }, + } + + ctx := context.WithValue(context.Background(), HTTPClient, c) + conf.Exchange(ctx, "code") +} + +func TestPasswordCredentialsTokenRequest(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer r.Body.Close() + expected := "/token" + if r.URL.String() != expected { + t.Errorf("URL = %q; want %q", r.URL, expected) + } + headerAuth := r.Header.Get("Authorization") + expected = "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" + if headerAuth != expected { + t.Errorf("Authorization header = %q; want %q", headerAuth, expected) + } + headerContentType := r.Header.Get("Content-Type") + expected = "application/x-www-form-urlencoded" + if headerContentType != expected { + t.Errorf("Content-Type header = %q; want %q", headerContentType, expected) + } + body, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Errorf("Failed reading request body: %s.", err) + } + expected = "grant_type=password&password=password1&scope=scope1+scope2&username=user1" + if string(body) != expected { + t.Errorf("res.Body = %q; want %q", string(body), expected) + } + w.Header().Set("Content-Type", "application/x-www-form-urlencoded") + w.Write([]byte("access_token=90d64460d14870c08c81352a05dedd3465940a7c&scope=user&token_type=bearer")) + })) + defer ts.Close() + conf := newConf(ts.URL) + tok, err := conf.PasswordCredentialsToken(context.Background(), "user1", "password1") + if err != nil { + t.Error(err) + } + if !tok.Valid() { + t.Fatalf("Token invalid. Got: %#v", tok) + } + expected := "90d64460d14870c08c81352a05dedd3465940a7c" + if tok.AccessToken != expected { + t.Errorf("AccessToken = %q; want %q", tok.AccessToken, expected) + } + expected = "bearer" + if tok.TokenType != expected { + t.Errorf("TokenType = %q; want %q", tok.TokenType, expected) + } +} + +func TestTokenRefreshRequest(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.String() == "/somethingelse" { + return + } + if r.URL.String() != "/token" { + t.Errorf("Unexpected token refresh request URL, %v is found.", r.URL) + } + headerContentType := r.Header.Get("Content-Type") + if headerContentType != "application/x-www-form-urlencoded" { + t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) + } + body, _ := ioutil.ReadAll(r.Body) + if string(body) != "grant_type=refresh_token&refresh_token=REFRESH_TOKEN" { + t.Errorf("Unexpected refresh token payload, %v is found.", string(body)) + } + })) + defer ts.Close() + conf := newConf(ts.URL) + c := conf.Client(context.Background(), &Token{RefreshToken: "REFRESH_TOKEN"}) + c.Get(ts.URL + "/somethingelse") +} + +func TestFetchWithNoRefreshToken(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.String() == "/somethingelse" { + return + } + if r.URL.String() != "/token" { + t.Errorf("Unexpected token refresh request URL, %v is found.", r.URL) + } + headerContentType := r.Header.Get("Content-Type") + if headerContentType != "application/x-www-form-urlencoded" { + t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType) + } + body, _ := ioutil.ReadAll(r.Body) + if string(body) != "client_id=CLIENT_ID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN" { + t.Errorf("Unexpected refresh token payload, %v is found.", string(body)) + } + })) + defer ts.Close() + conf := newConf(ts.URL) + c := conf.Client(context.Background(), nil) + _, err := c.Get(ts.URL + "/somethingelse") + if err == nil { + t.Errorf("Fetch should return an error if no refresh token is set") + } +} + +func TestTokenRetrieveError(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.String() != "/token" { + t.Errorf("Unexpected token refresh request URL, %v is found.", r.URL) + } + w.Header().Set("Content-type", "application/json") + w.WriteHeader(http.StatusBadRequest) + w.Write([]byte(`{"error": "invalid_grant"}`)) + })) + defer ts.Close() + conf := newConf(ts.URL) + _, err := conf.Exchange(context.Background(), "exchange-code") + if err == nil { + t.Fatalf("got no error, expected one") + } + _, ok := err.(*RetrieveError) + if !ok { + t.Fatalf("got %T error, expected *RetrieveError", err) + } + // Test error string for backwards compatibility + expected := fmt.Sprintf("oauth2: cannot fetch token: %v\nResponse: %s", "400 Bad Request", `{"error": "invalid_grant"}`) + if errStr := err.Error(); errStr != expected { + t.Fatalf("got %#v, expected %#v", errStr, expected) + } +} + +func TestRefreshToken_RefreshTokenReplacement(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"access_token":"ACCESS_TOKEN", "scope": "user", "token_type": "bearer", "refresh_token": "NEW_REFRESH_TOKEN"}`)) + return + })) + defer ts.Close() + conf := newConf(ts.URL) + tkr := conf.TokenSource(context.Background(), &Token{RefreshToken: "OLD_REFRESH_TOKEN"}) + tk, err := tkr.Token() + if err != nil { + t.Errorf("got err = %v; want none", err) + return + } + if want := "NEW_REFRESH_TOKEN"; tk.RefreshToken != want { + t.Errorf("RefreshToken = %q; want %q", tk.RefreshToken, want) + } +} + +func TestRefreshToken_RefreshTokenPreservation(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"access_token":"ACCESS_TOKEN", "scope": "user", "token_type": "bearer"}`)) + return + })) + defer ts.Close() + conf := newConf(ts.URL) + const oldRefreshToken = "OLD_REFRESH_TOKEN" + tkr := conf.TokenSource(context.Background(), &Token{RefreshToken: oldRefreshToken}) + tk, err := tkr.Token() + if err != nil { + t.Fatalf("got err = %v; want none", err) + } + if tk.RefreshToken != oldRefreshToken { + t.Errorf("RefreshToken = %q; want %q", tk.RefreshToken, oldRefreshToken) + } +} + +func TestConfigClientWithToken(t *testing.T) { + tok := &Token{ + AccessToken: "abc123", + } + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if got, want := r.Header.Get("Authorization"), fmt.Sprintf("Bearer %s", tok.AccessToken); got != want { + t.Errorf("Authorization header = %q; want %q", got, want) + } + return + })) + defer ts.Close() + conf := newConf(ts.URL) + + c := conf.Client(context.Background(), tok) + req, err := http.NewRequest("GET", ts.URL, nil) + if err != nil { + t.Error(err) + } + _, err = c.Do(req) + if err != nil { + t.Error(err) + } +} diff --git a/vendor/golang.org/x/oauth2/odnoklassniki/odnoklassniki.go b/vendor/golang.org/x/oauth2/odnoklassniki/odnoklassniki.go new file mode 100644 index 000000000..c0d093ccc --- /dev/null +++ b/vendor/golang.org/x/oauth2/odnoklassniki/odnoklassniki.go @@ -0,0 +1,16 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package odnoklassniki provides constants for using OAuth2 to access Odnoklassniki. +package odnoklassniki // import "golang.org/x/oauth2/odnoklassniki" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Odnoklassniki's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://www.odnoklassniki.ru/oauth/authorize", + TokenURL: "https://api.odnoklassniki.ru/oauth/token.do", +} diff --git a/vendor/golang.org/x/oauth2/paypal/paypal.go b/vendor/golang.org/x/oauth2/paypal/paypal.go new file mode 100644 index 000000000..2e713c53c --- /dev/null +++ b/vendor/golang.org/x/oauth2/paypal/paypal.go @@ -0,0 +1,22 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package paypal provides constants for using OAuth2 to access PayPal. +package paypal // import "golang.org/x/oauth2/paypal" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is PayPal's OAuth 2.0 endpoint in live (production) environment. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize", + TokenURL: "https://api.paypal.com/v1/identity/openidconnect/tokenservice", +} + +// SandboxEndpoint is PayPal's OAuth 2.0 endpoint in sandbox (testing) environment. +var SandboxEndpoint = oauth2.Endpoint{ + AuthURL: "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize", + TokenURL: "https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice", +} diff --git a/vendor/golang.org/x/oauth2/slack/slack.go b/vendor/golang.org/x/oauth2/slack/slack.go new file mode 100644 index 000000000..593d2f607 --- /dev/null +++ b/vendor/golang.org/x/oauth2/slack/slack.go @@ -0,0 +1,16 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package slack provides constants for using OAuth2 to access Slack. +package slack // import "golang.org/x/oauth2/slack" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Slack's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://slack.com/oauth/authorize", + TokenURL: "https://slack.com/api/oauth.access", +} diff --git a/vendor/golang.org/x/oauth2/spotify/spotify.go b/vendor/golang.org/x/oauth2/spotify/spotify.go new file mode 100644 index 000000000..c75416c00 --- /dev/null +++ b/vendor/golang.org/x/oauth2/spotify/spotify.go @@ -0,0 +1,16 @@ +// 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 file. + +// Package spotify provides constants for using OAuth2 to access Spotify. +package spotify // import "golang.org/x/oauth2/spotify" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Spotify's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://accounts.spotify.com/authorize", + TokenURL: "https://accounts.spotify.com/api/token", +} diff --git a/vendor/golang.org/x/oauth2/stackoverflow/stackoverflow.go b/vendor/golang.org/x/oauth2/stackoverflow/stackoverflow.go new file mode 100644 index 000000000..82711f777 --- /dev/null +++ b/vendor/golang.org/x/oauth2/stackoverflow/stackoverflow.go @@ -0,0 +1,16 @@ +// 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 file. + +// Package stackoverflow provides constants for using OAuth2 to access Stack Overflow. +package stackoverflow // import "golang.org/x/oauth2/stackoverflow" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Stack Overflow's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://stackoverflow.com/oauth", + TokenURL: "https://stackoverflow.com/oauth/access_token", +} diff --git a/vendor/golang.org/x/oauth2/token.go b/vendor/golang.org/x/oauth2/token.go new file mode 100644 index 000000000..9be1ae537 --- /dev/null +++ b/vendor/golang.org/x/oauth2/token.go @@ -0,0 +1,175 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package oauth2 + +import ( + "context" + "fmt" + "net/http" + "net/url" + "strconv" + "strings" + "time" + + "golang.org/x/oauth2/internal" +) + +// expiryDelta determines how earlier a token should be considered +// expired than its actual expiration time. It is used to avoid late +// expirations due to client-server time mismatches. +const expiryDelta = 10 * time.Second + +// Token represents the credentials used to authorize +// the requests to access protected resources on the OAuth 2.0 +// provider's backend. +// +// Most users of this package should not access fields of Token +// directly. They're exported mostly for use by related packages +// implementing derivative OAuth2 flows. +type Token struct { + // AccessToken is the token that authorizes and authenticates + // the requests. + AccessToken string `json:"access_token"` + + // TokenType is the type of token. + // The Type method returns either this or "Bearer", the default. + TokenType string `json:"token_type,omitempty"` + + // RefreshToken is a token that's used by the application + // (as opposed to the user) to refresh the access token + // if it expires. + RefreshToken string `json:"refresh_token,omitempty"` + + // Expiry is the optional expiration time of the access token. + // + // If zero, TokenSource implementations will reuse the same + // token forever and RefreshToken or equivalent + // mechanisms for that TokenSource will not be used. + Expiry time.Time `json:"expiry,omitempty"` + + // raw optionally contains extra metadata from the server + // when updating a token. + raw interface{} +} + +// Type returns t.TokenType if non-empty, else "Bearer". +func (t *Token) Type() string { + if strings.EqualFold(t.TokenType, "bearer") { + return "Bearer" + } + if strings.EqualFold(t.TokenType, "mac") { + return "MAC" + } + if strings.EqualFold(t.TokenType, "basic") { + return "Basic" + } + if t.TokenType != "" { + return t.TokenType + } + return "Bearer" +} + +// SetAuthHeader sets the Authorization header to r using the access +// token in t. +// +// This method is unnecessary when using Transport or an HTTP Client +// returned by this package. +func (t *Token) SetAuthHeader(r *http.Request) { + r.Header.Set("Authorization", t.Type()+" "+t.AccessToken) +} + +// WithExtra returns a new Token that's a clone of t, but using the +// provided raw extra map. This is only intended for use by packages +// implementing derivative OAuth2 flows. +func (t *Token) WithExtra(extra interface{}) *Token { + t2 := new(Token) + *t2 = *t + t2.raw = extra + return t2 +} + +// Extra returns an extra field. +// Extra fields are key-value pairs returned by the server as a +// part of the token retrieval response. +func (t *Token) Extra(key string) interface{} { + if raw, ok := t.raw.(map[string]interface{}); ok { + return raw[key] + } + + vals, ok := t.raw.(url.Values) + if !ok { + return nil + } + + v := vals.Get(key) + switch s := strings.TrimSpace(v); strings.Count(s, ".") { + case 0: // Contains no "."; try to parse as int + if i, err := strconv.ParseInt(s, 10, 64); err == nil { + return i + } + case 1: // Contains a single "."; try to parse as float + if f, err := strconv.ParseFloat(s, 64); err == nil { + return f + } + } + + return v +} + +// expired reports whether the token is expired. +// t must be non-nil. +func (t *Token) expired() bool { + if t.Expiry.IsZero() { + return false + } + return t.Expiry.Round(0).Add(-expiryDelta).Before(time.Now()) +} + +// Valid reports whether t is non-nil, has an AccessToken, and is not expired. +func (t *Token) Valid() bool { + return t != nil && t.AccessToken != "" && !t.expired() +} + +// tokenFromInternal maps an *internal.Token struct into +// a *Token struct. +func tokenFromInternal(t *internal.Token) *Token { + if t == nil { + return nil + } + return &Token{ + AccessToken: t.AccessToken, + TokenType: t.TokenType, + RefreshToken: t.RefreshToken, + Expiry: t.Expiry, + raw: t.Raw, + } +} + +// retrieveToken takes a *Config and uses that to retrieve an *internal.Token. +// This token is then mapped from *internal.Token into an *oauth2.Token which is returned along +// with an error.. +func retrieveToken(ctx context.Context, c *Config, v url.Values) (*Token, error) { + tk, err := internal.RetrieveToken(ctx, c.ClientID, c.ClientSecret, c.Endpoint.TokenURL, v) + if err != nil { + if rErr, ok := err.(*internal.RetrieveError); ok { + return nil, (*RetrieveError)(rErr) + } + return nil, err + } + return tokenFromInternal(tk), nil +} + +// RetrieveError is the error returned when the token endpoint returns a +// non-2XX HTTP status code. +type RetrieveError struct { + Response *http.Response + // Body is the body that was consumed by reading Response.Body. + // It may be truncated. + Body []byte +} + +func (r *RetrieveError) Error() string { + return fmt.Sprintf("oauth2: cannot fetch token: %v\nResponse: %s", r.Response.Status, r.Body) +} diff --git a/vendor/golang.org/x/oauth2/token_test.go b/vendor/golang.org/x/oauth2/token_test.go new file mode 100644 index 000000000..80db83c29 --- /dev/null +++ b/vendor/golang.org/x/oauth2/token_test.go @@ -0,0 +1,72 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package oauth2 + +import ( + "testing" + "time" +) + +func TestTokenExtra(t *testing.T) { + type testCase struct { + key string + val interface{} + want interface{} + } + const key = "extra-key" + cases := []testCase{ + {key: key, val: "abc", want: "abc"}, + {key: key, val: 123, want: 123}, + {key: key, val: "", want: ""}, + {key: "other-key", val: "def", want: nil}, + } + for _, tc := range cases { + extra := make(map[string]interface{}) + extra[tc.key] = tc.val + tok := &Token{raw: extra} + if got, want := tok.Extra(key), tc.want; got != want { + t.Errorf("Extra(%q) = %q; want %q", key, got, want) + } + } +} + +func TestTokenExpiry(t *testing.T) { + now := time.Now() + cases := []struct { + name string + tok *Token + want bool + }{ + {name: "12 seconds", tok: &Token{Expiry: now.Add(12 * time.Second)}, want: false}, + {name: "10 seconds", tok: &Token{Expiry: now.Add(expiryDelta)}, want: true}, + {name: "-1 hour", tok: &Token{Expiry: now.Add(-1 * time.Hour)}, want: true}, + } + for _, tc := range cases { + if got, want := tc.tok.expired(), tc.want; got != want { + t.Errorf("expired (%q) = %v; want %v", tc.name, got, want) + } + } +} + +func TestTokenTypeMethod(t *testing.T) { + cases := []struct { + name string + tok *Token + want string + }{ + {name: "bearer-mixed_case", tok: &Token{TokenType: "beAREr"}, want: "Bearer"}, + {name: "default-bearer", tok: &Token{}, want: "Bearer"}, + {name: "basic", tok: &Token{TokenType: "basic"}, want: "Basic"}, + {name: "basic-capitalized", tok: &Token{TokenType: "Basic"}, want: "Basic"}, + {name: "mac", tok: &Token{TokenType: "mac"}, want: "MAC"}, + {name: "mac-caps", tok: &Token{TokenType: "MAC"}, want: "MAC"}, + {name: "mac-mixed_case", tok: &Token{TokenType: "mAc"}, want: "MAC"}, + } + for _, tc := range cases { + if got, want := tc.tok.Type(), tc.want; got != want { + t.Errorf("TokenType(%q) = %v; want %v", tc.name, got, want) + } + } +} diff --git a/vendor/golang.org/x/oauth2/transport.go b/vendor/golang.org/x/oauth2/transport.go new file mode 100644 index 000000000..aa0d34f1e --- /dev/null +++ b/vendor/golang.org/x/oauth2/transport.go @@ -0,0 +1,144 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package oauth2 + +import ( + "errors" + "io" + "net/http" + "sync" +) + +// Transport is an http.RoundTripper that makes OAuth 2.0 HTTP requests, +// wrapping a base RoundTripper and adding an Authorization header +// with a token from the supplied Sources. +// +// Transport is a low-level mechanism. Most code will use the +// higher-level Config.Client method instead. +type Transport struct { + // Source supplies the token to add to outgoing requests' + // Authorization headers. + Source TokenSource + + // Base is the base RoundTripper used to make HTTP requests. + // If nil, http.DefaultTransport is used. + Base http.RoundTripper + + mu sync.Mutex // guards modReq + modReq map[*http.Request]*http.Request // original -> modified +} + +// RoundTrip authorizes and authenticates the request with an +// access token from Transport's Source. +func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { + reqBodyClosed := false + if req.Body != nil { + defer func() { + if !reqBodyClosed { + req.Body.Close() + } + }() + } + + if t.Source == nil { + return nil, errors.New("oauth2: Transport's Source is nil") + } + token, err := t.Source.Token() + if err != nil { + return nil, err + } + + req2 := cloneRequest(req) // per RoundTripper contract + token.SetAuthHeader(req2) + t.setModReq(req, req2) + res, err := t.base().RoundTrip(req2) + + // req.Body is assumed to have been closed by the base RoundTripper. + reqBodyClosed = true + + if err != nil { + t.setModReq(req, nil) + return nil, err + } + res.Body = &onEOFReader{ + rc: res.Body, + fn: func() { t.setModReq(req, nil) }, + } + return res, nil +} + +// CancelRequest cancels an in-flight request by closing its connection. +func (t *Transport) CancelRequest(req *http.Request) { + type canceler interface { + CancelRequest(*http.Request) + } + if cr, ok := t.base().(canceler); ok { + t.mu.Lock() + modReq := t.modReq[req] + delete(t.modReq, req) + t.mu.Unlock() + cr.CancelRequest(modReq) + } +} + +func (t *Transport) base() http.RoundTripper { + if t.Base != nil { + return t.Base + } + return http.DefaultTransport +} + +func (t *Transport) setModReq(orig, mod *http.Request) { + t.mu.Lock() + defer t.mu.Unlock() + if t.modReq == nil { + t.modReq = make(map[*http.Request]*http.Request) + } + if mod == nil { + delete(t.modReq, orig) + } else { + t.modReq[orig] = mod + } +} + +// cloneRequest returns a clone of the provided *http.Request. +// The clone is a shallow copy of the struct and its Header map. +func cloneRequest(r *http.Request) *http.Request { + // shallow copy of the struct + r2 := new(http.Request) + *r2 = *r + // deep copy of the Header + r2.Header = make(http.Header, len(r.Header)) + for k, s := range r.Header { + r2.Header[k] = append([]string(nil), s...) + } + return r2 +} + +type onEOFReader struct { + rc io.ReadCloser + fn func() +} + +func (r *onEOFReader) Read(p []byte) (n int, err error) { + n, err = r.rc.Read(p) + if err == io.EOF { + r.runFunc() + } + return +} + +func (r *onEOFReader) Close() error { + err := r.rc.Close() + r.runFunc() + return err +} + +func (r *onEOFReader) runFunc() { + if fn := r.fn; fn != nil { + fn() + r.fn = nil + } +} diff --git a/vendor/golang.org/x/oauth2/transport_test.go b/vendor/golang.org/x/oauth2/transport_test.go new file mode 100644 index 000000000..faa87d514 --- /dev/null +++ b/vendor/golang.org/x/oauth2/transport_test.go @@ -0,0 +1,168 @@ +package oauth2 + +import ( + "errors" + "io" + "net/http" + "net/http/httptest" + "testing" + "time" +) + +type tokenSource struct{ token *Token } + +func (t *tokenSource) Token() (*Token, error) { + return t.token, nil +} + +func TestTransportNilTokenSource(t *testing.T) { + tr := &Transport{} + server := newMockServer(func(w http.ResponseWriter, r *http.Request) {}) + defer server.Close() + client := &http.Client{Transport: tr} + resp, err := client.Get(server.URL) + if err == nil { + t.Errorf("got no errors, want an error with nil token source") + } + if resp != nil { + t.Errorf("Response = %v; want nil", resp) + } +} + +type readCloseCounter struct { + CloseCount int + ReadErr error +} + +func (r *readCloseCounter) Read(b []byte) (int, error) { + return 0, r.ReadErr +} + +func (r *readCloseCounter) Close() error { + r.CloseCount++ + return nil +} + +func TestTransportCloseRequestBody(t *testing.T) { + tr := &Transport{} + server := newMockServer(func(w http.ResponseWriter, r *http.Request) {}) + defer server.Close() + client := &http.Client{Transport: tr} + body := &readCloseCounter{ + ReadErr: errors.New("readCloseCounter.Read not implemented"), + } + resp, err := client.Post(server.URL, "application/json", body) + if err == nil { + t.Errorf("got no errors, want an error with nil token source") + } + if resp != nil { + t.Errorf("Response = %v; want nil", resp) + } + if expected := 1; body.CloseCount != expected { + t.Errorf("Body was closed %d times, expected %d", body.CloseCount, expected) + } +} + +func TestTransportCloseRequestBodySuccess(t *testing.T) { + tr := &Transport{ + Source: StaticTokenSource(&Token{ + AccessToken: "abc", + }), + } + server := newMockServer(func(w http.ResponseWriter, r *http.Request) {}) + defer server.Close() + client := &http.Client{Transport: tr} + body := &readCloseCounter{ + ReadErr: io.EOF, + } + resp, err := client.Post(server.URL, "application/json", body) + if err != nil { + t.Errorf("got error %v; expected none", err) + } + if resp == nil { + t.Errorf("Response is nil; expected non-nil") + } + if expected := 1; body.CloseCount != expected { + t.Errorf("Body was closed %d times, expected %d", body.CloseCount, expected) + } +} + +func TestTransportTokenSource(t *testing.T) { + ts := &tokenSource{ + token: &Token{ + AccessToken: "abc", + }, + } + tr := &Transport{ + Source: ts, + } + server := newMockServer(func(w http.ResponseWriter, r *http.Request) { + if got, want := r.Header.Get("Authorization"), "Bearer abc"; got != want { + t.Errorf("Authorization header = %q; want %q", got, want) + } + }) + defer server.Close() + client := &http.Client{Transport: tr} + res, err := client.Get(server.URL) + if err != nil { + t.Fatal(err) + } + res.Body.Close() +} + +// Test for case-sensitive token types, per https://github.com/golang/oauth2/issues/113 +func TestTransportTokenSourceTypes(t *testing.T) { + const val = "abc" + tests := []struct { + key string + val string + want string + }{ + {key: "bearer", val: val, want: "Bearer abc"}, + {key: "mac", val: val, want: "MAC abc"}, + {key: "basic", val: val, want: "Basic abc"}, + } + for _, tc := range tests { + ts := &tokenSource{ + token: &Token{ + AccessToken: tc.val, + TokenType: tc.key, + }, + } + tr := &Transport{ + Source: ts, + } + server := newMockServer(func(w http.ResponseWriter, r *http.Request) { + if got, want := r.Header.Get("Authorization"), tc.want; got != want { + t.Errorf("Authorization header (%q) = %q; want %q", val, got, want) + } + }) + defer server.Close() + client := &http.Client{Transport: tr} + res, err := client.Get(server.URL) + if err != nil { + t.Fatal(err) + } + res.Body.Close() + } +} + +func TestTokenValidNoAccessToken(t *testing.T) { + token := &Token{} + if token.Valid() { + t.Errorf("got valid with no access token; want invalid") + } +} + +func TestExpiredWithExpiry(t *testing.T) { + token := &Token{ + Expiry: time.Now().Add(-5 * time.Hour), + } + if token.Valid() { + t.Errorf("got valid with expired token; want invalid") + } +} + +func newMockServer(handler func(w http.ResponseWriter, r *http.Request)) *httptest.Server { + return httptest.NewServer(http.HandlerFunc(handler)) +} diff --git a/vendor/golang.org/x/oauth2/twitch/twitch.go b/vendor/golang.org/x/oauth2/twitch/twitch.go new file mode 100644 index 000000000..0838e7c15 --- /dev/null +++ b/vendor/golang.org/x/oauth2/twitch/twitch.go @@ -0,0 +1,19 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package twitch provides constants for using OAuth2 to access Twitch. +package twitch // import "golang.org/x/oauth2/twitch" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Twitch's OAuth 2.0 endpoint. +// +// For more information see: +// https://dev.twitch.tv/docs/authentication +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://id.twitch.tv/oauth2/authorize", + TokenURL: "https://id.twitch.tv/oauth2/token", +} diff --git a/vendor/golang.org/x/oauth2/uber/uber.go b/vendor/golang.org/x/oauth2/uber/uber.go new file mode 100644 index 000000000..5520a6455 --- /dev/null +++ b/vendor/golang.org/x/oauth2/uber/uber.go @@ -0,0 +1,16 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package uber provides constants for using OAuth2 to access Uber. +package uber // import "golang.org/x/oauth2/uber" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Uber's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://login.uber.com/oauth/v2/authorize", + TokenURL: "https://login.uber.com/oauth/v2/token", +} diff --git a/vendor/golang.org/x/oauth2/vk/vk.go b/vendor/golang.org/x/oauth2/vk/vk.go new file mode 100644 index 000000000..bd8e15948 --- /dev/null +++ b/vendor/golang.org/x/oauth2/vk/vk.go @@ -0,0 +1,16 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package vk provides constants for using OAuth2 to access VK.com. +package vk // import "golang.org/x/oauth2/vk" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is VK's OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://oauth.vk.com/authorize", + TokenURL: "https://oauth.vk.com/access_token", +} diff --git a/vendor/golang.org/x/oauth2/yahoo/yahoo.go b/vendor/golang.org/x/oauth2/yahoo/yahoo.go new file mode 100644 index 000000000..9fa78a23c --- /dev/null +++ b/vendor/golang.org/x/oauth2/yahoo/yahoo.go @@ -0,0 +1,17 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package yahoo provides constants for using OAuth2 to access Yahoo. +package yahoo // import "golang.org/x/oauth2/yahoo" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is Yahoo's OAuth 2.0 endpoint. +// See https://developer.yahoo.com/oauth2/guide/ +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://api.login.yahoo.com/oauth2/request_auth", + TokenURL: "https://api.login.yahoo.com/oauth2/get_token", +} diff --git a/vendor/golang.org/x/oauth2/yandex/yandex.go b/vendor/golang.org/x/oauth2/yandex/yandex.go new file mode 100644 index 000000000..5ebf666d2 --- /dev/null +++ b/vendor/golang.org/x/oauth2/yandex/yandex.go @@ -0,0 +1,16 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package yandex provides constants for using OAuth2 to access Yandex APIs. +package yandex // import "golang.org/x/oauth2/yandex" + +import ( + "golang.org/x/oauth2" +) + +// Endpoint is the Yandex OAuth 2.0 endpoint. +var Endpoint = oauth2.Endpoint{ + AuthURL: "https://oauth.yandex.com/authorize", + TokenURL: "https://oauth.yandex.com/token", +} diff --git a/vendor/google.golang.org/appengine/.travis.yml b/vendor/google.golang.org/appengine/.travis.yml new file mode 100644 index 000000000..70ffe89d5 --- /dev/null +++ b/vendor/google.golang.org/appengine/.travis.yml @@ -0,0 +1,20 @@ +language: go + +go_import_path: google.golang.org/appengine + +install: + - ./travis_install.sh + +script: + - ./travis_test.sh + +matrix: + include: + - go: 1.8.x + env: GOAPP=true + - go: 1.9.x + env: GOAPP=true + - go: 1.10.x + env: GOAPP=false + - go: 1.11.x + env: GO111MODULE=on diff --git a/vendor/google.golang.org/appengine/CONTRIBUTING.md b/vendor/google.golang.org/appengine/CONTRIBUTING.md new file mode 100644 index 000000000..ffc298520 --- /dev/null +++ b/vendor/google.golang.org/appengine/CONTRIBUTING.md @@ -0,0 +1,90 @@ +# Contributing + +1. Sign one of the contributor license agreements below. +1. Get the package: + + `go get -d google.golang.org/appengine` +1. Change into the checked out source: + + `cd $GOPATH/src/google.golang.org/appengine` +1. Fork the repo. +1. Set your fork as a remote: + + `git remote add fork git@github.com:GITHUB_USERNAME/appengine.git` +1. Make changes, commit to your fork. +1. Send a pull request with your changes. + The first line of your commit message is conventionally a one-line summary of the change, prefixed by the primary affected package, and is used as the title of your pull request. + +# Testing + +## Running system tests + +Download and install the [Go App Engine SDK](https://cloud.google.com/appengine/docs/go/download). Make sure the `go_appengine` dir is in your `PATH`. + +Set the `APPENGINE_DEV_APPSERVER` environment variable to `/path/to/go_appengine/dev_appserver.py`. + +Run tests with `goapp test`: + +``` +goapp test -v google.golang.org/appengine/... +``` + +## 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/) + +[indvcla]: https://developers.google.com/open-source/cla/individual +[corpcla]: https://developers.google.com/open-source/cla/corporate diff --git a/vendor/google.golang.org/appengine/LICENSE b/vendor/google.golang.org/appengine/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/vendor/google.golang.org/appengine/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/google.golang.org/appengine/README.md b/vendor/google.golang.org/appengine/README.md new file mode 100644 index 000000000..d86768a2c --- /dev/null +++ b/vendor/google.golang.org/appengine/README.md @@ -0,0 +1,73 @@ +# Go App Engine packages + +[![Build Status](https://travis-ci.org/golang/appengine.svg)](https://travis-ci.org/golang/appengine) + +This repository supports the Go runtime on *App Engine standard*. +It provides APIs for interacting with App Engine services. +Its canonical import path is `google.golang.org/appengine`. + +See https://cloud.google.com/appengine/docs/go/ +for more information. + +File issue reports and feature requests on the [GitHub's issue +tracker](https://github.com/golang/appengine/issues). + +## Upgrading an App Engine app to the flexible environment + +This package does not work on *App Engine flexible*. + +There are many differences between the App Engine standard environment and +the flexible environment. + +See the [documentation on upgrading to the flexible environment](https://cloud.google.com/appengine/docs/flexible/go/upgrading). + +## Directory structure + +The top level directory of this repository is the `appengine` package. It +contains the +basic APIs (e.g. `appengine.NewContext`) that apply across APIs. Specific API +packages are in subdirectories (e.g. `datastore`). + +There is an `internal` subdirectory that contains service protocol buffers, +plus packages required for connectivity to make API calls. App Engine apps +should not directly import any package under `internal`. + +## Updating from legacy (`import "appengine"`) packages + +If you're currently using the bare `appengine` packages +(that is, not these ones, imported via `google.golang.org/appengine`), +then you can use the `aefix` tool to help automate an upgrade to these packages. + +Run `go get google.golang.org/appengine/cmd/aefix` to install it. + +### 1. Update import paths + +The import paths for App Engine packages are now fully qualified, based at `google.golang.org/appengine`. +You will need to update your code to use import paths starting with that; for instance, +code importing `appengine/datastore` will now need to import `google.golang.org/appengine/datastore`. + +### 2. Update code using deprecated, removed or modified APIs + +Most App Engine services are available with exactly the same API. +A few APIs were cleaned up, and there are some differences: + +* `appengine.Context` has been replaced with the `Context` type from `golang.org/x/net/context`. +* Logging methods that were on `appengine.Context` are now functions in `google.golang.org/appengine/log`. +* `appengine.Timeout` has been removed. Use `context.WithTimeout` instead. +* `appengine.Datacenter` now takes a `context.Context` argument. +* `datastore.PropertyLoadSaver` has been simplified to use slices in place of channels. +* `delay.Call` now returns an error. +* `search.FieldLoadSaver` now handles document metadata. +* `urlfetch.Transport` no longer has a Deadline field; set a deadline on the + `context.Context` instead. +* `aetest` no longer declares its own Context type, and uses the standard one instead. +* `taskqueue.QueueStats` no longer takes a maxTasks argument. That argument has been + deprecated and unused for a long time. +* `appengine.BackendHostname` and `appengine.BackendInstance` were for the deprecated backends feature. + Use `appengine.ModuleHostname`and `appengine.ModuleName` instead. +* Most of `appengine/file` and parts of `appengine/blobstore` are deprecated. + Use [Google Cloud Storage](https://godoc.org/cloud.google.com/go/storage) if the + feature you require is not present in the new + [blobstore package](https://google.golang.org/appengine/blobstore). +* `appengine/socket` is not required on App Engine flexible environment / Managed VMs. + Use the standard `net` package instead. diff --git a/vendor/google.golang.org/appengine/aetest/doc.go b/vendor/google.golang.org/appengine/aetest/doc.go new file mode 100644 index 000000000..86ce8c2c0 --- /dev/null +++ b/vendor/google.golang.org/appengine/aetest/doc.go @@ -0,0 +1,42 @@ +/* +Package aetest provides an API for running dev_appserver for use in tests. + +An example test file: + + package foo_test + + import ( + "testing" + + "google.golang.org/appengine/memcache" + "google.golang.org/appengine/aetest" + ) + + func TestFoo(t *testing.T) { + ctx, done, err := aetest.NewContext() + if err != nil { + t.Fatal(err) + } + defer done() + + it := &memcache.Item{ + Key: "some-key", + Value: []byte("some-value"), + } + err = memcache.Set(ctx, it) + if err != nil { + t.Fatalf("Set err: %v", err) + } + it, err = memcache.Get(ctx, "some-key") + if err != nil { + t.Fatalf("Get err: %v; want no error", err) + } + if g, w := string(it.Value), "some-value" ; g != w { + t.Errorf("retrieved Item.Value = %q, want %q", g, w) + } + } + +The environment variable APPENGINE_DEV_APPSERVER specifies the location of the +dev_appserver.py executable to use. If unset, the system PATH is consulted. +*/ +package aetest diff --git a/vendor/google.golang.org/appengine/aetest/instance.go b/vendor/google.golang.org/appengine/aetest/instance.go new file mode 100644 index 000000000..f580467fe --- /dev/null +++ b/vendor/google.golang.org/appengine/aetest/instance.go @@ -0,0 +1,61 @@ +package aetest + +import ( + "io" + "net/http" + "time" + + "golang.org/x/net/context" + "google.golang.org/appengine" +) + +// Instance represents a running instance of the development API Server. +type Instance interface { + // Close kills the child api_server.py process, releasing its resources. + io.Closer + // NewRequest returns an *http.Request associated with this instance. + NewRequest(method, urlStr string, body io.Reader) (*http.Request, error) +} + +// Options is used to specify options when creating an Instance. +type Options struct { + // AppID specifies the App ID to use during tests. + // By default, "testapp". + AppID string + // StronglyConsistentDatastore is whether the local datastore should be + // strongly consistent. This will diverge from production behaviour. + StronglyConsistentDatastore bool + // SupportDatastoreEmulator is whether use Cloud Datastore Emulator or + // use old SQLite based Datastore backend or use default settings. + SupportDatastoreEmulator *bool + // SuppressDevAppServerLog is whether the dev_appserver running in tests + // should output logs. + SuppressDevAppServerLog bool + // StartupTimeout is a duration to wait for instance startup. + // By default, 15 seconds. + StartupTimeout time.Duration +} + +// NewContext starts an instance of the development API server, and returns +// a context that will route all API calls to that server, as well as a +// closure that must be called when the Context is no longer required. +func NewContext() (context.Context, func(), error) { + inst, err := NewInstance(nil) + if err != nil { + return nil, nil, err + } + req, err := inst.NewRequest("GET", "/", nil) + if err != nil { + inst.Close() + return nil, nil, err + } + ctx := appengine.NewContext(req) + return ctx, func() { + inst.Close() + }, nil +} + +// PrepareDevAppserver is a hook which, if set, will be called before the +// dev_appserver.py is started, each time it is started. If aetest.NewContext +// is invoked from the goapp test tool, this hook is unnecessary. +var PrepareDevAppserver func() error diff --git a/vendor/google.golang.org/appengine/aetest/instance_classic.go b/vendor/google.golang.org/appengine/aetest/instance_classic.go new file mode 100644 index 000000000..fbceaa505 --- /dev/null +++ b/vendor/google.golang.org/appengine/aetest/instance_classic.go @@ -0,0 +1,21 @@ +// +build appengine + +package aetest + +import "appengine/aetest" + +// NewInstance launches a running instance of api_server.py which can be used +// for multiple test Contexts that delegate all App Engine API calls to that +// instance. +// If opts is nil the default values are used. +func NewInstance(opts *Options) (Instance, error) { + aetest.PrepareDevAppserver = PrepareDevAppserver + var aeOpts *aetest.Options + if opts != nil { + aeOpts = &aetest.Options{ + AppID: opts.AppID, + StronglyConsistentDatastore: opts.StronglyConsistentDatastore, + } + } + return aetest.NewInstance(aeOpts) +} diff --git a/vendor/google.golang.org/appengine/aetest/instance_test.go b/vendor/google.golang.org/appengine/aetest/instance_test.go new file mode 100644 index 000000000..e7003afd9 --- /dev/null +++ b/vendor/google.golang.org/appengine/aetest/instance_test.go @@ -0,0 +1,119 @@ +package aetest + +import ( + "os" + "testing" + + "google.golang.org/appengine" + "google.golang.org/appengine/datastore" + "google.golang.org/appengine/internal" + "google.golang.org/appengine/memcache" + "google.golang.org/appengine/user" +) + +func TestBasicAPICalls(t *testing.T) { + // Only run the test if APPENGINE_DEV_APPSERVER is explicitly set. + if os.Getenv("APPENGINE_DEV_APPSERVER") == "" { + t.Skip("APPENGINE_DEV_APPSERVER not set") + } + resetEnv := internal.SetTestEnv() + defer resetEnv() + + inst, err := NewInstance(nil) + if err != nil { + t.Fatalf("NewInstance: %v", err) + } + defer inst.Close() + + req, err := inst.NewRequest("GET", "http://example.com/page", nil) + if err != nil { + t.Fatalf("NewRequest: %v", err) + } + ctx := appengine.NewContext(req) + + it := &memcache.Item{ + Key: "some-key", + Value: []byte("some-value"), + } + err = memcache.Set(ctx, it) + if err != nil { + t.Fatalf("Set err: %v", err) + } + it, err = memcache.Get(ctx, "some-key") + if err != nil { + t.Fatalf("Get err: %v; want no error", err) + } + if g, w := string(it.Value), "some-value"; g != w { + t.Errorf("retrieved Item.Value = %q, want %q", g, w) + } + + type Entity struct{ Value string } + e := &Entity{Value: "foo"} + k := datastore.NewIncompleteKey(ctx, "Entity", nil) + k, err = datastore.Put(ctx, k, e) + if err != nil { + t.Fatalf("datastore.Put: %v", err) + } + e = new(Entity) + if err := datastore.Get(ctx, k, e); err != nil { + t.Fatalf("datastore.Get: %v", err) + } + if g, w := e.Value, "foo"; g != w { + t.Errorf("retrieved Entity.Value = %q, want %q", g, w) + } +} + +func TestContext(t *testing.T) { + // Only run the test if APPENGINE_DEV_APPSERVER is explicitly set. + if os.Getenv("APPENGINE_DEV_APPSERVER") == "" { + t.Skip("APPENGINE_DEV_APPSERVER not set") + } + + // Check that the context methods work. + _, done, err := NewContext() + if err != nil { + t.Fatalf("NewContext: %v", err) + } + done() +} + +func TestUsers(t *testing.T) { + // Only run the test if APPENGINE_DEV_APPSERVER is explicitly set. + if os.Getenv("APPENGINE_DEV_APPSERVER") == "" { + t.Skip("APPENGINE_DEV_APPSERVER not set") + } + + inst, err := NewInstance(nil) + if err != nil { + t.Fatalf("NewInstance: %v", err) + } + defer inst.Close() + + req, err := inst.NewRequest("GET", "http://example.com/page", nil) + if err != nil { + t.Fatalf("NewRequest: %v", err) + } + ctx := appengine.NewContext(req) + + if user := user.Current(ctx); user != nil { + t.Errorf("user.Current initially %v, want nil", user) + } + + u := &user.User{ + Email: "gopher@example.com", + Admin: true, + } + Login(u, req) + + if got := user.Current(ctx); got.Email != u.Email { + t.Errorf("user.Current: %v, want %v", got, u) + } + if admin := user.IsAdmin(ctx); !admin { + t.Errorf("user.IsAdmin: %t, want true", admin) + } + + Logout(req) + if user := user.Current(ctx); user != nil { + t.Errorf("user.Current after logout %v, want nil", user) + } +} diff --git a/vendor/google.golang.org/appengine/aetest/instance_vm.go b/vendor/google.golang.org/appengine/aetest/instance_vm.go new file mode 100644 index 000000000..820e1ef20 --- /dev/null +++ b/vendor/google.golang.org/appengine/aetest/instance_vm.go @@ -0,0 +1,287 @@ +// +build !appengine + +package aetest + +import ( + "bufio" + "crypto/rand" + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "os" + "os/exec" + "path/filepath" + "regexp" + "time" + + "golang.org/x/net/context" + "google.golang.org/appengine/internal" +) + +// NewInstance launches a running instance of api_server.py which can be used +// for multiple test Contexts that delegate all App Engine API calls to that +// instance. +// If opts is nil the default values are used. +func NewInstance(opts *Options) (Instance, error) { + i := &instance{ + opts: opts, + appID: "testapp", + startupTimeout: 15 * time.Second, + } + if opts != nil { + if opts.AppID != "" { + i.appID = opts.AppID + } + if opts.StartupTimeout > 0 { + i.startupTimeout = opts.StartupTimeout + } + } + if err := i.startChild(); err != nil { + return nil, err + } + return i, nil +} + +func newSessionID() string { + var buf [16]byte + io.ReadFull(rand.Reader, buf[:]) + return fmt.Sprintf("%x", buf[:]) +} + +// instance implements the Instance interface. +type instance struct { + opts *Options + child *exec.Cmd + apiURL *url.URL // base URL of API HTTP server + adminURL string // base URL of admin HTTP server + appDir string + appID string + startupTimeout time.Duration + relFuncs []func() // funcs to release any associated contexts +} + +// NewRequest returns an *http.Request associated with this instance. +func (i *instance) NewRequest(method, urlStr string, body io.Reader) (*http.Request, error) { + req, err := http.NewRequest(method, urlStr, body) + if err != nil { + return nil, err + } + + // Associate this request. + req, release := internal.RegisterTestRequest(req, i.apiURL, func(ctx context.Context) context.Context { + ctx = internal.WithAppIDOverride(ctx, "dev~"+i.appID) + return ctx + }) + i.relFuncs = append(i.relFuncs, release) + + return req, nil +} + +// Close kills the child api_server.py process, releasing its resources. +func (i *instance) Close() (err error) { + for _, rel := range i.relFuncs { + rel() + } + i.relFuncs = nil + child := i.child + if child == nil { + return nil + } + defer func() { + i.child = nil + err1 := os.RemoveAll(i.appDir) + if err == nil { + err = err1 + } + }() + + if p := child.Process; p != nil { + errc := make(chan error, 1) + go func() { + errc <- child.Wait() + }() + + // Call the quit handler on the admin server. + res, err := http.Get(i.adminURL + "/quit") + if err != nil { + p.Kill() + return fmt.Errorf("unable to call /quit handler: %v", err) + } + res.Body.Close() + select { + case <-time.After(15 * time.Second): + p.Kill() + return errors.New("timeout killing child process") + case err = <-errc: + // Do nothing. + } + } + return +} + +func fileExists(path string) bool { + _, err := os.Stat(path) + return err == nil +} + +func findPython() (path string, err error) { + for _, name := range []string{"python2.7", "python"} { + path, err = exec.LookPath(name) + if err == nil { + return + } + } + return +} + +func findDevAppserver() (string, error) { + if p := os.Getenv("APPENGINE_DEV_APPSERVER"); p != "" { + if fileExists(p) { + return p, nil + } + return "", fmt.Errorf("invalid APPENGINE_DEV_APPSERVER environment variable; path %q doesn't exist", p) + } + return exec.LookPath("dev_appserver.py") +} + +var apiServerAddrRE = regexp.MustCompile(`Starting API server at: (\S+)`) +var adminServerAddrRE = regexp.MustCompile(`Starting admin server at: (\S+)`) + +func (i *instance) startChild() (err error) { + if PrepareDevAppserver != nil { + if err := PrepareDevAppserver(); err != nil { + return err + } + } + python, err := findPython() + if err != nil { + return fmt.Errorf("Could not find python interpreter: %v", err) + } + devAppserver, err := findDevAppserver() + if err != nil { + return fmt.Errorf("Could not find dev_appserver.py: %v", err) + } + + i.appDir, err = ioutil.TempDir("", "appengine-aetest") + if err != nil { + return err + } + defer func() { + if err != nil { + os.RemoveAll(i.appDir) + } + }() + err = os.Mkdir(filepath.Join(i.appDir, "app"), 0755) + if err != nil { + return err + } + err = ioutil.WriteFile(filepath.Join(i.appDir, "app", "app.yaml"), []byte(i.appYAML()), 0644) + if err != nil { + return err + } + err = ioutil.WriteFile(filepath.Join(i.appDir, "app", "stubapp.go"), []byte(appSource), 0644) + if err != nil { + return err + } + + appserverArgs := []string{ + devAppserver, + "--port=0", + "--api_port=0", + "--admin_port=0", + "--automatic_restart=false", + "--skip_sdk_update_check=true", + "--clear_datastore=true", + "--clear_search_indexes=true", + "--datastore_path", filepath.Join(i.appDir, "datastore"), + } + if i.opts != nil && i.opts.StronglyConsistentDatastore { + appserverArgs = append(appserverArgs, "--datastore_consistency_policy=consistent") + } + if i.opts != nil && i.opts.SupportDatastoreEmulator != nil { + appserverArgs = append(appserverArgs, fmt.Sprintf("--support_datastore_emulator=%t", *i.opts.SupportDatastoreEmulator)) + } + appserverArgs = append(appserverArgs, filepath.Join(i.appDir, "app")) + + i.child = exec.Command(python, + appserverArgs..., + ) + i.child.Stdout = os.Stdout + var stderr io.Reader + stderr, err = i.child.StderrPipe() + if err != nil { + return err + } + if !(i.opts != nil && i.opts.SuppressDevAppServerLog) { + stderr = io.TeeReader(stderr, os.Stderr) + } + if err = i.child.Start(); err != nil { + return err + } + + // Read stderr until we have read the URLs of the API server and admin interface. + errc := make(chan error, 1) + go func() { + s := bufio.NewScanner(stderr) + for s.Scan() { + if match := apiServerAddrRE.FindStringSubmatch(s.Text()); match != nil { + u, err := url.Parse(match[1]) + if err != nil { + errc <- fmt.Errorf("failed to parse API URL %q: %v", match[1], err) + return + } + i.apiURL = u + } + if match := adminServerAddrRE.FindStringSubmatch(s.Text()); match != nil { + i.adminURL = match[1] + } + if i.adminURL != "" && i.apiURL != nil { + break + } + } + errc <- s.Err() + }() + + select { + case <-time.After(i.startupTimeout): + if p := i.child.Process; p != nil { + p.Kill() + } + return errors.New("timeout starting child process") + case err := <-errc: + if err != nil { + return fmt.Errorf("error reading child process stderr: %v", err) + } + } + if i.adminURL == "" { + return errors.New("unable to find admin server URL") + } + if i.apiURL == nil { + return errors.New("unable to find API server URL") + } + return nil +} + +func (i *instance) appYAML() string { + return fmt.Sprintf(appYAMLTemplate, i.appID) +} + +const appYAMLTemplate = ` +application: %s +version: 1 +runtime: go +api_version: go1 + +handlers: +- url: /.* + script: _go_app +` + +const appSource = ` +package main +import "google.golang.org/appengine" +func main() { appengine.Main() } +` diff --git a/vendor/google.golang.org/appengine/aetest/user.go b/vendor/google.golang.org/appengine/aetest/user.go new file mode 100644 index 000000000..bf9266f53 --- /dev/null +++ b/vendor/google.golang.org/appengine/aetest/user.go @@ -0,0 +1,36 @@ +package aetest + +import ( + "hash/crc32" + "net/http" + "strconv" + + "google.golang.org/appengine/user" +) + +// Login causes the provided Request to act as though issued by the given user. +func Login(u *user.User, req *http.Request) { + req.Header.Set("X-AppEngine-User-Email", u.Email) + id := u.ID + if id == "" { + id = strconv.Itoa(int(crc32.Checksum([]byte(u.Email), crc32.IEEETable))) + } + req.Header.Set("X-AppEngine-User-Id", id) + req.Header.Set("X-AppEngine-User-Federated-Identity", u.Email) + req.Header.Set("X-AppEngine-User-Federated-Provider", u.FederatedProvider) + if u.Admin { + req.Header.Set("X-AppEngine-User-Is-Admin", "1") + } else { + req.Header.Set("X-AppEngine-User-Is-Admin", "0") + } +} + +// Logout causes the provided Request to act as though issued by a logged-out +// user. +func Logout(req *http.Request) { + req.Header.Del("X-AppEngine-User-Email") + req.Header.Del("X-AppEngine-User-Id") + req.Header.Del("X-AppEngine-User-Is-Admin") + req.Header.Del("X-AppEngine-User-Federated-Identity") + req.Header.Del("X-AppEngine-User-Federated-Provider") +} diff --git a/vendor/google.golang.org/appengine/appengine.go b/vendor/google.golang.org/appengine/appengine.go new file mode 100644 index 000000000..0cca033d3 --- /dev/null +++ b/vendor/google.golang.org/appengine/appengine.go @@ -0,0 +1,137 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package appengine provides basic functionality for Google App Engine. +// +// For more information on how to write Go apps for Google App Engine, see: +// https://cloud.google.com/appengine/docs/go/ +package appengine // import "google.golang.org/appengine" + +import ( + "net/http" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" +) + +// The gophers party all night; the rabbits provide the beats. + +// Main is the principal entry point for an app running in App Engine. +// +// On App Engine Flexible it installs a trivial health checker if one isn't +// already registered, and starts listening on port 8080 (overridden by the +// $PORT environment variable). +// +// See https://cloud.google.com/appengine/docs/flexible/custom-runtimes#health_check_requests +// for details on how to do your own health checking. +// +// On App Engine Standard it ensures the server has started and is prepared to +// receive requests. +// +// Main never returns. +// +// Main is designed so that the app's main package looks like this: +// +// package main +// +// import ( +// "google.golang.org/appengine" +// +// _ "myapp/package0" +// _ "myapp/package1" +// ) +// +// func main() { +// appengine.Main() +// } +// +// The "myapp/packageX" packages are expected to register HTTP handlers +// in their init functions. +func Main() { + internal.Main() +} + +// IsDevAppServer reports whether the App Engine app is running in the +// development App Server. +func IsDevAppServer() bool { + return internal.IsDevAppServer() +} + +// IsStandard reports whether the App Engine app is running in the standard +// environment. This includes both the first generation runtimes (<= Go 1.9) +// and the second generation runtimes (>= Go 1.11). +func IsStandard() bool { + return internal.IsStandard() +} + +// IsFlex reports whether the App Engine app is running in the flexible environment. +func IsFlex() bool { + return internal.IsFlex() +} + +// IsAppEngine reports whether the App Engine app is running on App Engine, in either +// the standard or flexible environment. +func IsAppEngine() bool { + return internal.IsAppEngine() +} + +// IsSecondGen reports whether the App Engine app is running on the second generation +// runtimes (>= Go 1.11). +func IsSecondGen() bool { + return internal.IsSecondGen() +} + +// NewContext returns a context for an in-flight HTTP request. +// This function is cheap. +func NewContext(req *http.Request) context.Context { + return internal.ReqContext(req) +} + +// WithContext returns a copy of the parent context +// and associates it with an in-flight HTTP request. +// This function is cheap. +func WithContext(parent context.Context, req *http.Request) context.Context { + return internal.WithContext(parent, req) +} + +// TODO(dsymonds): Add a Call function here? Otherwise other packages can't access internal.Call. + +// BlobKey is a key for a blobstore blob. +// +// Conceptually, this type belongs in the blobstore package, but it lives in +// the appengine package to avoid a circular dependency: blobstore depends on +// datastore, and datastore needs to refer to the BlobKey type. +type BlobKey string + +// GeoPoint represents a location as latitude/longitude in degrees. +type GeoPoint struct { + Lat, Lng float64 +} + +// Valid returns whether a GeoPoint is within [-90, 90] latitude and [-180, 180] longitude. +func (g GeoPoint) Valid() bool { + return -90 <= g.Lat && g.Lat <= 90 && -180 <= g.Lng && g.Lng <= 180 +} + +// APICallFunc defines a function type for handling an API call. +// See WithCallOverride. +type APICallFunc func(ctx context.Context, service, method string, in, out proto.Message) error + +// WithAPICallFunc returns a copy of the parent context +// that will cause API calls to invoke f instead of their normal operation. +// +// This is intended for advanced users only. +func WithAPICallFunc(ctx context.Context, f APICallFunc) context.Context { + return internal.WithCallOverride(ctx, internal.CallOverrideFunc(f)) +} + +// APICall performs an API call. +// +// This is not intended for general use; it is exported for use in conjunction +// with WithAPICallFunc. +func APICall(ctx context.Context, service, method string, in, out proto.Message) error { + return internal.Call(ctx, service, method, in, out) +} diff --git a/vendor/google.golang.org/appengine/appengine_test.go b/vendor/google.golang.org/appengine/appengine_test.go new file mode 100644 index 000000000..f1cf0a1b9 --- /dev/null +++ b/vendor/google.golang.org/appengine/appengine_test.go @@ -0,0 +1,49 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package appengine + +import ( + "testing" +) + +func TestValidGeoPoint(t *testing.T) { + testCases := []struct { + desc string + pt GeoPoint + want bool + }{ + { + "valid", + GeoPoint{67.21, 13.37}, + true, + }, + { + "high lat", + GeoPoint{-90.01, 13.37}, + false, + }, + { + "low lat", + GeoPoint{90.01, 13.37}, + false, + }, + { + "high lng", + GeoPoint{67.21, 182}, + false, + }, + { + "low lng", + GeoPoint{67.21, -181}, + false, + }, + } + + for _, tc := range testCases { + if got := tc.pt.Valid(); got != tc.want { + t.Errorf("%s: got %v, want %v", tc.desc, got, tc.want) + } + } +} diff --git a/vendor/google.golang.org/appengine/appengine_vm.go b/vendor/google.golang.org/appengine/appengine_vm.go new file mode 100644 index 000000000..f4b645aad --- /dev/null +++ b/vendor/google.golang.org/appengine/appengine_vm.go @@ -0,0 +1,20 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package appengine + +import ( + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" +) + +// BackgroundContext returns a context not associated with a request. +// This should only be used when not servicing a request. +// This only works in App Engine "flexible environment". +func BackgroundContext() context.Context { + return internal.BackgroundContext() +} diff --git a/vendor/google.golang.org/appengine/blobstore/blobstore.go b/vendor/google.golang.org/appengine/blobstore/blobstore.go new file mode 100644 index 000000000..dea25acca --- /dev/null +++ b/vendor/google.golang.org/appengine/blobstore/blobstore.go @@ -0,0 +1,306 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package blobstore provides a client for App Engine's persistent blob +// storage service. +package blobstore // import "google.golang.org/appengine/blobstore" + +import ( + "bufio" + "bytes" + "encoding/base64" + "fmt" + "io" + "io/ioutil" + "mime" + "mime/multipart" + "net/http" + "net/textproto" + "net/url" + "strconv" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + "golang.org/x/text/encoding/htmlindex" + + "google.golang.org/appengine" + "google.golang.org/appengine/datastore" + "google.golang.org/appengine/internal" + + basepb "google.golang.org/appengine/internal/base" + blobpb "google.golang.org/appengine/internal/blobstore" +) + +const ( + blobInfoKind = "__BlobInfo__" + blobFileIndexKind = "__BlobFileIndex__" + zeroKey = appengine.BlobKey("") +) + +// BlobInfo is the blob metadata that is stored in the datastore. +// Filename may be empty. +type BlobInfo struct { + BlobKey appengine.BlobKey + ContentType string `datastore:"content_type"` + CreationTime time.Time `datastore:"creation"` + Filename string `datastore:"filename"` + Size int64 `datastore:"size"` + MD5 string `datastore:"md5_hash"` + + // ObjectName is the Google Cloud Storage name for this blob. + ObjectName string `datastore:"gs_object_name"` +} + +// isErrFieldMismatch returns whether err is a datastore.ErrFieldMismatch. +// +// The blobstore stores blob metadata in the datastore. When loading that +// metadata, it may contain fields that we don't care about. datastore.Get will +// return datastore.ErrFieldMismatch in that case, so we ignore that specific +// error. +func isErrFieldMismatch(err error) bool { + _, ok := err.(*datastore.ErrFieldMismatch) + return ok +} + +// Stat returns the BlobInfo for a provided blobKey. If no blob was found for +// that key, Stat returns datastore.ErrNoSuchEntity. +func Stat(c context.Context, blobKey appengine.BlobKey) (*BlobInfo, error) { + c, _ = appengine.Namespace(c, "") // Blobstore is always in the empty string namespace + dskey := datastore.NewKey(c, blobInfoKind, string(blobKey), 0, nil) + bi := &BlobInfo{ + BlobKey: blobKey, + } + if err := datastore.Get(c, dskey, bi); err != nil && !isErrFieldMismatch(err) { + return nil, err + } + return bi, nil +} + +// Send sets the headers on response to instruct App Engine to send a blob as +// the response body. This is more efficient than reading and writing it out +// manually and isn't subject to normal response size limits. +func Send(response http.ResponseWriter, blobKey appengine.BlobKey) { + hdr := response.Header() + hdr.Set("X-AppEngine-BlobKey", string(blobKey)) + + if hdr.Get("Content-Type") == "" { + // This value is known to dev_appserver to mean automatic. + // In production this is remapped to the empty value which + // means automatic. + hdr.Set("Content-Type", "application/vnd.google.appengine.auto") + } +} + +// UploadURL creates an upload URL for the form that the user will +// fill out, passing the application path to load when the POST of the +// form is completed. These URLs expire and should not be reused. The +// opts parameter may be nil. +func UploadURL(c context.Context, successPath string, opts *UploadURLOptions) (*url.URL, error) { + req := &blobpb.CreateUploadURLRequest{ + SuccessPath: proto.String(successPath), + } + if opts != nil { + if n := opts.MaxUploadBytes; n != 0 { + req.MaxUploadSizeBytes = &n + } + if n := opts.MaxUploadBytesPerBlob; n != 0 { + req.MaxUploadSizePerBlobBytes = &n + } + if s := opts.StorageBucket; s != "" { + req.GsBucketName = &s + } + } + res := &blobpb.CreateUploadURLResponse{} + if err := internal.Call(c, "blobstore", "CreateUploadURL", req, res); err != nil { + return nil, err + } + return url.Parse(*res.Url) +} + +// UploadURLOptions are the options to create an upload URL. +type UploadURLOptions struct { + MaxUploadBytes int64 // optional + MaxUploadBytesPerBlob int64 // optional + + // StorageBucket specifies the Google Cloud Storage bucket in which + // to store the blob. + // This is required if you use Cloud Storage instead of Blobstore. + // Your application must have permission to write to the bucket. + // You may optionally specify a bucket name and path in the format + // "bucket_name/path", in which case the included path will be the + // prefix of the uploaded object's name. + StorageBucket string +} + +// Delete deletes a blob. +func Delete(c context.Context, blobKey appengine.BlobKey) error { + return DeleteMulti(c, []appengine.BlobKey{blobKey}) +} + +// DeleteMulti deletes multiple blobs. +func DeleteMulti(c context.Context, blobKey []appengine.BlobKey) error { + s := make([]string, len(blobKey)) + for i, b := range blobKey { + s[i] = string(b) + } + req := &blobpb.DeleteBlobRequest{ + BlobKey: s, + } + res := &basepb.VoidProto{} + if err := internal.Call(c, "blobstore", "DeleteBlob", req, res); err != nil { + return err + } + return nil +} + +func errorf(format string, args ...interface{}) error { + return fmt.Errorf("blobstore: "+format, args...) +} + +// ParseUpload parses the synthetic POST request that your app gets from +// App Engine after a user's successful upload of blobs. Given the request, +// ParseUpload returns a map of the blobs received (keyed by HTML form +// element name) and other non-blob POST parameters. +func ParseUpload(req *http.Request) (blobs map[string][]*BlobInfo, other url.Values, err error) { + _, params, err := mime.ParseMediaType(req.Header.Get("Content-Type")) + if err != nil { + return nil, nil, err + } + boundary := params["boundary"] + if boundary == "" { + return nil, nil, errorf("did not find MIME multipart boundary") + } + + blobs = make(map[string][]*BlobInfo) + other = make(url.Values) + + mreader := multipart.NewReader(io.MultiReader(req.Body, strings.NewReader("\r\n\r\n")), boundary) + for { + part, perr := mreader.NextPart() + if perr == io.EOF { + break + } + if perr != nil { + return nil, nil, errorf("error reading next mime part with boundary %q (len=%d): %v", + boundary, len(boundary), perr) + } + + bi := &BlobInfo{} + ctype, params, err := mime.ParseMediaType(part.Header.Get("Content-Disposition")) + if err != nil { + return nil, nil, err + } + bi.Filename = params["filename"] + formKey := params["name"] + + ctype, params, err = mime.ParseMediaType(part.Header.Get("Content-Type")) + if err != nil { + return nil, nil, err + } + bi.BlobKey = appengine.BlobKey(params["blob-key"]) + charset := params["charset"] + + if ctype != "message/external-body" || bi.BlobKey == "" { + if formKey != "" { + slurp, serr := ioutil.ReadAll(part) + if serr != nil { + return nil, nil, errorf("error reading %q MIME part", formKey) + } + + // Handle base64 content transfer encoding. multipart.Part transparently + // handles quoted-printable, and no special handling is required for + // 7bit, 8bit, or binary. + ctype, params, err = mime.ParseMediaType(part.Header.Get("Content-Transfer-Encoding")) + if err == nil && ctype == "base64" { + slurp, serr = ioutil.ReadAll(base64.NewDecoder( + base64.StdEncoding, bytes.NewReader(slurp))) + if serr != nil { + return nil, nil, errorf("error %s decoding %q MIME part", ctype, formKey) + } + } + + // Handle charset + if charset != "" { + encoding, err := htmlindex.Get(charset) + if err != nil { + return nil, nil, errorf("error getting decoder for charset %q", charset) + } + + slurp, err = encoding.NewDecoder().Bytes(slurp) + if err != nil { + return nil, nil, errorf("error decoding from charset %q", charset) + } + } + + other[formKey] = append(other[formKey], string(slurp)) + } + continue + } + + // App Engine sends a MIME header as the body of each MIME part. + tp := textproto.NewReader(bufio.NewReader(part)) + header, mimeerr := tp.ReadMIMEHeader() + if mimeerr != nil { + return nil, nil, mimeerr + } + bi.Size, err = strconv.ParseInt(header.Get("Content-Length"), 10, 64) + if err != nil { + return nil, nil, err + } + bi.ContentType = header.Get("Content-Type") + + // Parse the time from the MIME header like: + // X-AppEngine-Upload-Creation: 2011-03-15 21:38:34.712136 + createDate := header.Get("X-AppEngine-Upload-Creation") + if createDate == "" { + return nil, nil, errorf("expected to find an X-AppEngine-Upload-Creation header") + } + bi.CreationTime, err = time.Parse("2006-01-02 15:04:05.000000", createDate) + if err != nil { + return nil, nil, errorf("error parsing X-AppEngine-Upload-Creation: %s", err) + } + + if hdr := header.Get("Content-MD5"); hdr != "" { + md5, err := base64.URLEncoding.DecodeString(hdr) + if err != nil { + return nil, nil, errorf("bad Content-MD5 %q: %v", hdr, err) + } + bi.MD5 = string(md5) + } + + // If the GCS object name was provided, record it. + bi.ObjectName = header.Get("X-AppEngine-Cloud-Storage-Object") + + blobs[formKey] = append(blobs[formKey], bi) + } + return +} + +// Reader is a blob reader. +type Reader interface { + io.Reader + io.ReaderAt + io.Seeker +} + +// NewReader returns a reader for a blob. It always succeeds; if the blob does +// not exist then an error will be reported upon first read. +func NewReader(c context.Context, blobKey appengine.BlobKey) Reader { + return openBlob(c, blobKey) +} + +// BlobKeyForFile returns a BlobKey for a Google Storage file. +// The filename should be of the form "/gs/bucket_name/object_name". +func BlobKeyForFile(c context.Context, filename string) (appengine.BlobKey, error) { + req := &blobpb.CreateEncodedGoogleStorageKeyRequest{ + Filename: &filename, + } + res := &blobpb.CreateEncodedGoogleStorageKeyResponse{} + if err := internal.Call(c, "blobstore", "CreateEncodedGoogleStorageKey", req, res); err != nil { + return "", err + } + return appengine.BlobKey(*res.BlobKey), nil +} diff --git a/vendor/google.golang.org/appengine/blobstore/blobstore_test.go b/vendor/google.golang.org/appengine/blobstore/blobstore_test.go new file mode 100644 index 000000000..4616211ed --- /dev/null +++ b/vendor/google.golang.org/appengine/blobstore/blobstore_test.go @@ -0,0 +1,289 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package blobstore + +import ( + "bytes" + "encoding/base64" + "fmt" + "io" + "mime/multipart" + "mime/quotedprintable" + "net/http" + "net/textproto" + "os" + "strconv" + "strings" + "testing" + + "golang.org/x/text/encoding/htmlindex" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal/aetesting" + + pb "google.golang.org/appengine/internal/blobstore" +) + +const rbs = readBufferSize + +const charsetUTF8 = "utf-8" +const charsetISO2022JP = "iso-2022-jp" +const nonASCIIStr = "Hello, 世界" + +func min(x, y int) int { + if x < y { + return x + } + return y +} + +func fakeFetchData(req *pb.FetchDataRequest, res *pb.FetchDataResponse) error { + i0 := int(*req.StartIndex) + i1 := int(*req.EndIndex + 1) // Blobstore's end-indices are inclusive; Go's are exclusive. + bk := *req.BlobKey + if i := strings.Index(bk, "."); i != -1 { + // Strip everything past the ".". + bk = bk[:i] + } + switch bk { + case "a14p": + const s = "abcdefghijklmnop" + i0 := min(len(s), i0) + i1 := min(len(s), i1) + res.Data = []byte(s[i0:i1]) + case "longBlob": + res.Data = make([]byte, i1-i0) + for i := range res.Data { + res.Data[i] = 'A' + uint8(i0/rbs) + i0++ + } + } + return nil +} + +// step is one step of a readerTest. +// It consists of a Reader method to call, the method arguments +// (lenp, offset, whence) and the expected results. +type step struct { + method string + lenp int + offset int64 + whence int + want string + wantErr error +} + +var readerTest = []struct { + blobKey string + step []step +}{ + {"noSuchBlobKey", []step{ + {"Read", 8, 0, 0, "", io.EOF}, + }}, + {"a14p.0", []step{ + // Test basic reads. + {"Read", 1, 0, 0, "a", nil}, + {"Read", 3, 0, 0, "bcd", nil}, + {"Read", 1, 0, 0, "e", nil}, + {"Read", 2, 0, 0, "fg", nil}, + // Test Seek. + {"Seek", 0, 2, os.SEEK_SET, "2", nil}, + {"Read", 5, 0, 0, "cdefg", nil}, + {"Seek", 0, 2, os.SEEK_CUR, "9", nil}, + {"Read", 1, 0, 0, "j", nil}, + // Test reads up to and past EOF. + {"Read", 5, 0, 0, "klmno", nil}, + {"Read", 5, 0, 0, "p", nil}, + {"Read", 5, 0, 0, "", io.EOF}, + // Test ReadAt. + {"ReadAt", 4, 0, 0, "abcd", nil}, + {"ReadAt", 4, 3, 0, "defg", nil}, + {"ReadAt", 4, 12, 0, "mnop", nil}, + {"ReadAt", 4, 13, 0, "nop", io.EOF}, + {"ReadAt", 4, 99, 0, "", io.EOF}, + }}, + {"a14p.1", []step{ + // Test Seek before any reads. + {"Seek", 0, 2, os.SEEK_SET, "2", nil}, + {"Read", 1, 0, 0, "c", nil}, + // Test that ReadAt doesn't affect the Read offset. + {"ReadAt", 3, 9, 0, "jkl", nil}, + {"Read", 3, 0, 0, "def", nil}, + }}, + {"a14p.2", []step{ + // Test ReadAt before any reads or seeks. + {"ReadAt", 2, 14, 0, "op", nil}, + }}, + {"longBlob.0", []step{ + // Test basic read. + {"Read", 1, 0, 0, "A", nil}, + // Test that Read returns early when the buffer is exhausted. + {"Seek", 0, rbs - 2, os.SEEK_SET, strconv.Itoa(rbs - 2), nil}, + {"Read", 5, 0, 0, "AA", nil}, + {"Read", 3, 0, 0, "BBB", nil}, + // Test that what we just read is still in the buffer. + {"Seek", 0, rbs - 2, os.SEEK_SET, strconv.Itoa(rbs - 2), nil}, + {"Read", 5, 0, 0, "AABBB", nil}, + // Test ReadAt. + {"ReadAt", 3, rbs - 4, 0, "AAA", nil}, + {"ReadAt", 6, rbs - 4, 0, "AAAABB", nil}, + {"ReadAt", 8, rbs - 4, 0, "AAAABBBB", nil}, + {"ReadAt", 5, rbs - 4, 0, "AAAAB", nil}, + {"ReadAt", 2, rbs - 4, 0, "AA", nil}, + // Test seeking backwards from the Read offset. + {"Seek", 0, 2*rbs - 8, os.SEEK_SET, strconv.Itoa(2*rbs - 8), nil}, + {"Read", 1, 0, 0, "B", nil}, + {"Read", 1, 0, 0, "B", nil}, + {"Read", 1, 0, 0, "B", nil}, + {"Read", 1, 0, 0, "B", nil}, + {"Read", 8, 0, 0, "BBBBCCCC", nil}, + }}, + {"longBlob.1", []step{ + // Test ReadAt with a slice larger than the buffer size. + {"LargeReadAt", 2*rbs - 2, 0, 0, strconv.Itoa(2*rbs - 2), nil}, + {"LargeReadAt", 2*rbs - 1, 0, 0, strconv.Itoa(2*rbs - 1), nil}, + {"LargeReadAt", 2*rbs + 0, 0, 0, strconv.Itoa(2*rbs + 0), nil}, + {"LargeReadAt", 2*rbs + 1, 0, 0, strconv.Itoa(2*rbs + 1), nil}, + {"LargeReadAt", 2*rbs + 2, 0, 0, strconv.Itoa(2*rbs + 2), nil}, + {"LargeReadAt", 2*rbs - 2, 1, 0, strconv.Itoa(2*rbs - 2), nil}, + {"LargeReadAt", 2*rbs - 1, 1, 0, strconv.Itoa(2*rbs - 1), nil}, + {"LargeReadAt", 2*rbs + 0, 1, 0, strconv.Itoa(2*rbs + 0), nil}, + {"LargeReadAt", 2*rbs + 1, 1, 0, strconv.Itoa(2*rbs + 1), nil}, + {"LargeReadAt", 2*rbs + 2, 1, 0, strconv.Itoa(2*rbs + 2), nil}, + }}, +} + +func TestReader(t *testing.T) { + for _, rt := range readerTest { + c := aetesting.FakeSingleContext(t, "blobstore", "FetchData", fakeFetchData) + r := NewReader(c, appengine.BlobKey(rt.blobKey)) + for i, step := range rt.step { + var ( + got string + gotErr error + n int + offset int64 + ) + switch step.method { + case "LargeReadAt": + p := make([]byte, step.lenp) + n, gotErr = r.ReadAt(p, step.offset) + got = strconv.Itoa(n) + case "Read": + p := make([]byte, step.lenp) + n, gotErr = r.Read(p) + got = string(p[:n]) + case "ReadAt": + p := make([]byte, step.lenp) + n, gotErr = r.ReadAt(p, step.offset) + got = string(p[:n]) + case "Seek": + offset, gotErr = r.Seek(step.offset, step.whence) + got = strconv.FormatInt(offset, 10) + default: + t.Fatalf("unknown method: %s", step.method) + } + if gotErr != step.wantErr { + t.Fatalf("%s step %d: got error %v want %v", rt.blobKey, i, gotErr, step.wantErr) + } + if got != step.want { + t.Fatalf("%s step %d: got %q want %q", rt.blobKey, i, got, step.want) + } + } + } +} + +// doPlainTextParseUploadTest tests ParseUpload's decoding of non-file form fields. +// It ensures that MIME multipart parts with Content-Type not equal to +// "message/external-body" (i.e. form fields that are not file uploads) are decoded +// correctly according to the value of their Content-Transfer-Encoding header field. +// If charset is not the empty string it will be set in the request's Content-Type +// header field, and if encoding is not the empty string then the Content-Transfer-Encoding +// header field will be set. +func doPlainTextParseUploadTest(t *testing.T, charset string, encoding string, + rawContent string, encodedContent string) { + bodyBuf := &bytes.Buffer{} + w := multipart.NewWriter(bodyBuf) + + fieldName := "foo" + hdr := textproto.MIMEHeader{} + hdr.Set("Content-Disposition", fmt.Sprintf("form-data; name=%q", fieldName)) + + if charset != "" { + hdr.Set("Content-Type", fmt.Sprintf("text/plain; charset=%q", charset)) + } else { + hdr.Set("Content-Type", "text/plain") + } + + if encoding != "" { + hdr.Set("Content-Transfer-Encoding", encoding) + } + + pw, err := w.CreatePart(hdr) + if err != nil { + t.Fatalf("error creating part: %v", err) + } + pw.Write([]byte(encodedContent)) + + if err := w.Close(); err != nil { + t.Fatalf("error closing multipart writer: %v\n", err) + } + + req, err := http.NewRequest("POST", "/upload", bodyBuf) + if err != nil { + t.Fatalf("error creating request: %v", err) + } + + req.Header.Set("Content-Type", w.FormDataContentType()) + _, other, err := ParseUpload(req) + if err != nil { + t.Fatalf("error parsing upload: %v", err) + } + + if other[fieldName][0] != rawContent { + t.Errorf("got %q expected %q", other[fieldName][0], rawContent) + } +} + +func TestParseUploadUTF8Base64Encoding(t *testing.T) { + encoded := base64.StdEncoding.EncodeToString([]byte(nonASCIIStr)) + doPlainTextParseUploadTest(t, charsetUTF8, "base64", nonASCIIStr, encoded) +} + +func TestParseUploadUTF8Base64EncodingMultiline(t *testing.T) { + testStr := "words words words words words words words words words words words words" + encoded := "d29yZHMgd29yZHMgd29yZHMgd29yZHMgd29yZHMgd29yZHMgd29yZHMgd29yZHMgd29yZHMgd29y\r\nZHMgd29yZHMgd29yZHM=" + doPlainTextParseUploadTest(t, charsetUTF8, "base64", testStr, encoded) +} + +func TestParseUploadUTF8QuotedPrintableEncoding(t *testing.T) { + var encoded bytes.Buffer + writer := quotedprintable.NewWriter(&encoded) + writer.Write([]byte(nonASCIIStr)) + writer.Close() + + doPlainTextParseUploadTest(t, charsetUTF8, "quoted-printable", nonASCIIStr, + encoded.String()) +} + +func TestParseUploadISO2022JPBase64Encoding(t *testing.T) { + testStr := "こんにちは" + encoding, err := htmlindex.Get(charsetISO2022JP) + if err != nil { + t.Fatalf("error getting encoding: %v", err) + } + + charsetEncoded, err := encoding.NewEncoder().String(testStr) + if err != nil { + t.Fatalf("error encoding string: %v", err) + } + + base64Encoded := base64.StdEncoding.EncodeToString([]byte(charsetEncoded)) + doPlainTextParseUploadTest(t, charsetISO2022JP, "base64", testStr, base64Encoded) +} + +func TestParseUploadNoEncoding(t *testing.T) { + doPlainTextParseUploadTest(t, "", "", "Hello", "Hello") +} diff --git a/vendor/google.golang.org/appengine/blobstore/read.go b/vendor/google.golang.org/appengine/blobstore/read.go new file mode 100644 index 000000000..578b1f550 --- /dev/null +++ b/vendor/google.golang.org/appengine/blobstore/read.go @@ -0,0 +1,160 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package blobstore + +import ( + "errors" + "fmt" + "io" + "os" + "sync" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + + blobpb "google.golang.org/appengine/internal/blobstore" +) + +// openBlob returns a reader for a blob. It always succeeds; if the blob does +// not exist then an error will be reported upon first read. +func openBlob(c context.Context, blobKey appengine.BlobKey) Reader { + return &reader{ + c: c, + blobKey: blobKey, + } +} + +const readBufferSize = 256 * 1024 + +// reader is a blob reader. It implements the Reader interface. +type reader struct { + c context.Context + + // Either blobKey or filename is set: + blobKey appengine.BlobKey + filename string + + closeFunc func() // is nil if unavailable or already closed. + + // buf is the read buffer. r is how much of buf has been read. + // off is the offset of buf[0] relative to the start of the blob. + // An invariant is 0 <= r && r <= len(buf). + // Reads that don't require an RPC call will increment r but not off. + // Seeks may modify r without discarding the buffer, but only if the + // invariant can be maintained. + mu sync.Mutex + buf []byte + r int + off int64 +} + +func (r *reader) Close() error { + if f := r.closeFunc; f != nil { + f() + } + r.closeFunc = nil + return nil +} + +func (r *reader) Read(p []byte) (int, error) { + if len(p) == 0 { + return 0, nil + } + r.mu.Lock() + defer r.mu.Unlock() + if r.r == len(r.buf) { + if err := r.fetch(r.off + int64(r.r)); err != nil { + return 0, err + } + } + n := copy(p, r.buf[r.r:]) + r.r += n + return n, nil +} + +func (r *reader) ReadAt(p []byte, off int64) (int, error) { + if len(p) == 0 { + return 0, nil + } + r.mu.Lock() + defer r.mu.Unlock() + // Convert relative offsets to absolute offsets. + ab0 := r.off + int64(r.r) + ab1 := r.off + int64(len(r.buf)) + ap0 := off + ap1 := off + int64(len(p)) + // Check if we can satisfy the read entirely out of the existing buffer. + if r.off <= ap0 && ap1 <= ab1 { + // Convert off from an absolute offset to a relative offset. + rp0 := int(ap0 - r.off) + return copy(p, r.buf[rp0:]), nil + } + // Restore the original Read/Seek offset after ReadAt completes. + defer r.seek(ab0) + // Repeatedly fetch and copy until we have filled p. + n := 0 + for len(p) > 0 { + if err := r.fetch(off + int64(n)); err != nil { + return n, err + } + r.r = copy(p, r.buf) + n += r.r + p = p[r.r:] + } + return n, nil +} + +func (r *reader) Seek(offset int64, whence int) (ret int64, err error) { + r.mu.Lock() + defer r.mu.Unlock() + switch whence { + case os.SEEK_SET: + ret = offset + case os.SEEK_CUR: + ret = r.off + int64(r.r) + offset + case os.SEEK_END: + return 0, errors.New("seeking relative to the end of a blob isn't supported") + default: + return 0, fmt.Errorf("invalid Seek whence value: %d", whence) + } + if ret < 0 { + return 0, errors.New("negative Seek offset") + } + return r.seek(ret) +} + +// fetch fetches readBufferSize bytes starting at the given offset. On success, +// the data is saved as r.buf. +func (r *reader) fetch(off int64) error { + req := &blobpb.FetchDataRequest{ + BlobKey: proto.String(string(r.blobKey)), + StartIndex: proto.Int64(off), + EndIndex: proto.Int64(off + readBufferSize - 1), // EndIndex is inclusive. + } + res := &blobpb.FetchDataResponse{} + if err := internal.Call(r.c, "blobstore", "FetchData", req, res); err != nil { + return err + } + if len(res.Data) == 0 { + return io.EOF + } + r.buf, r.r, r.off = res.Data, 0, off + return nil +} + +// seek seeks to the given offset with an effective whence equal to SEEK_SET. +// It discards the read buffer if the invariant cannot be maintained. +func (r *reader) seek(off int64) (int64, error) { + delta := off - r.off + if delta >= 0 && delta < int64(len(r.buf)) { + r.r = int(delta) + return off, nil + } + r.buf, r.r, r.off = nil, 0, off + return off, nil +} diff --git a/vendor/google.golang.org/appengine/capability/capability.go b/vendor/google.golang.org/appengine/capability/capability.go new file mode 100644 index 000000000..3a60bd55f --- /dev/null +++ b/vendor/google.golang.org/appengine/capability/capability.go @@ -0,0 +1,52 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package capability exposes information about outages and scheduled downtime +for specific API capabilities. + +This package does not work in App Engine "flexible environment". + +Example: + if !capability.Enabled(c, "datastore_v3", "write") { + // show user a different page + } +*/ +package capability // import "google.golang.org/appengine/capability" + +import ( + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + "google.golang.org/appengine/log" + + pb "google.golang.org/appengine/internal/capability" +) + +// Enabled returns whether an API's capabilities are enabled. +// The wildcard "*" capability matches every capability of an API. +// If the underlying RPC fails (if the package is unknown, for example), +// false is returned and information is written to the application log. +func Enabled(ctx context.Context, api, capability string) bool { + req := &pb.IsEnabledRequest{ + Package: &api, + Capability: []string{capability}, + } + res := &pb.IsEnabledResponse{} + if err := internal.Call(ctx, "capability_service", "IsEnabled", req, res); err != nil { + log.Warningf(ctx, "capability.Enabled: RPC failed: %v", err) + return false + } + switch *res.SummaryStatus { + case pb.IsEnabledResponse_ENABLED, + pb.IsEnabledResponse_SCHEDULED_FUTURE, + pb.IsEnabledResponse_SCHEDULED_NOW: + return true + case pb.IsEnabledResponse_UNKNOWN: + log.Errorf(ctx, "capability.Enabled: unknown API capability %s/%s", api, capability) + return false + default: + return false + } +} diff --git a/vendor/google.golang.org/appengine/channel/channel.go b/vendor/google.golang.org/appengine/channel/channel.go new file mode 100644 index 000000000..96945f6d6 --- /dev/null +++ b/vendor/google.golang.org/appengine/channel/channel.go @@ -0,0 +1,87 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package channel implements the server side of App Engine's Channel API. + +Create creates a new channel associated with the given clientID, +which must be unique to the client that will use the returned token. + + token, err := channel.Create(c, "player1") + if err != nil { + // handle error + } + // return token to the client in an HTTP response + +Send sends a message to the client over the channel identified by clientID. + + channel.Send(c, "player1", "Game over!") + +Deprecated: The Channel API feature has been deprecated and is going to be removed. See the Channel API Turndown document for details and timetable. + +https://cloud.google.com/appengine/docs/deprecations/channel +*/ +package channel // import "google.golang.org/appengine/channel" + +import ( + "encoding/json" + + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + basepb "google.golang.org/appengine/internal/base" + pb "google.golang.org/appengine/internal/channel" +) + +// Create creates a channel and returns a token for use by the client. +// The clientID is an application-provided string used to identify the client. +func Create(c context.Context, clientID string) (token string, err error) { + req := &pb.CreateChannelRequest{ + ApplicationKey: &clientID, + } + resp := &pb.CreateChannelResponse{} + err = internal.Call(c, service, "CreateChannel", req, resp) + token = resp.GetToken() + return token, remapError(err) +} + +// Send sends a message on the channel associated with clientID. +func Send(c context.Context, clientID, message string) error { + req := &pb.SendMessageRequest{ + ApplicationKey: &clientID, + Message: &message, + } + resp := &basepb.VoidProto{} + return remapError(internal.Call(c, service, "SendChannelMessage", req, resp)) +} + +// SendJSON is a helper function that sends a JSON-encoded value +// on the channel associated with clientID. +func SendJSON(c context.Context, clientID string, value interface{}) error { + m, err := json.Marshal(value) + if err != nil { + return err + } + return Send(c, clientID, string(m)) +} + +// remapError fixes any APIError referencing "xmpp" into one referencing "channel". +func remapError(err error) error { + if e, ok := err.(*internal.APIError); ok { + if e.Service == "xmpp" { + e.Service = "channel" + } + } + return err +} + +var service = "xmpp" // prod + +func init() { + if appengine.IsDevAppServer() { + service = "channel" // dev + } + internal.RegisterErrorCodeMap("channel", pb.ChannelServiceError_ErrorCode_name) +} diff --git a/vendor/google.golang.org/appengine/channel/channel_test.go b/vendor/google.golang.org/appengine/channel/channel_test.go new file mode 100644 index 000000000..c7498eb83 --- /dev/null +++ b/vendor/google.golang.org/appengine/channel/channel_test.go @@ -0,0 +1,21 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package channel + +import ( + "testing" + + "google.golang.org/appengine/internal" +) + +func TestRemapError(t *testing.T) { + err := &internal.APIError{ + Service: "xmpp", + } + err = remapError(err).(*internal.APIError) + if err.Service != "channel" { + t.Errorf("err.Service = %q, want %q", err.Service, "channel") + } +} diff --git a/vendor/google.golang.org/appengine/cloudsql/cloudsql.go b/vendor/google.golang.org/appengine/cloudsql/cloudsql.go new file mode 100644 index 000000000..7b27e6b12 --- /dev/null +++ b/vendor/google.golang.org/appengine/cloudsql/cloudsql.go @@ -0,0 +1,62 @@ +// Copyright 2013 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package cloudsql exposes access to Google Cloud SQL databases. + +This package does not work in App Engine "flexible environment". + +This package is intended for MySQL drivers to make App Engine-specific +connections. Applications should use this package through database/sql: +Select a pure Go MySQL driver that supports this package, and use sql.Open +with protocol "cloudsql" and an address of the Cloud SQL instance. + +A Go MySQL driver that has been tested to work well with Cloud SQL +is the go-sql-driver: + import "database/sql" + import _ "github.com/go-sql-driver/mysql" + + db, err := sql.Open("mysql", "user@cloudsql(project-id:instance-name)/dbname") + + +Another driver that works well with Cloud SQL is the mymysql driver: + import "database/sql" + import _ "github.com/ziutek/mymysql/godrv" + + db, err := sql.Open("mymysql", "cloudsql:instance-name*dbname/user/password") + + +Using either of these drivers, you can perform a standard SQL query. +This example assumes there is a table named 'users' with +columns 'first_name' and 'last_name': + + rows, err := db.Query("SELECT first_name, last_name FROM users") + if err != nil { + log.Errorf(ctx, "db.Query: %v", err) + } + defer rows.Close() + + for rows.Next() { + var firstName string + var lastName string + if err := rows.Scan(&firstName, &lastName); err != nil { + log.Errorf(ctx, "rows.Scan: %v", err) + continue + } + log.Infof(ctx, "First: %v - Last: %v", firstName, lastName) + } + if err := rows.Err(); err != nil { + log.Errorf(ctx, "Row error: %v", err) + } +*/ +package cloudsql + +import ( + "net" +) + +// Dial connects to the named Cloud SQL instance. +func Dial(instance string) (net.Conn, error) { + return connect(instance) +} diff --git a/vendor/google.golang.org/appengine/cloudsql/cloudsql_classic.go b/vendor/google.golang.org/appengine/cloudsql/cloudsql_classic.go new file mode 100644 index 000000000..af62dba14 --- /dev/null +++ b/vendor/google.golang.org/appengine/cloudsql/cloudsql_classic.go @@ -0,0 +1,17 @@ +// Copyright 2013 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build appengine + +package cloudsql + +import ( + "net" + + "appengine/cloudsql" +) + +func connect(instance string) (net.Conn, error) { + return cloudsql.Dial(instance) +} diff --git a/vendor/google.golang.org/appengine/cloudsql/cloudsql_vm.go b/vendor/google.golang.org/appengine/cloudsql/cloudsql_vm.go new file mode 100644 index 000000000..90fa7b31e --- /dev/null +++ b/vendor/google.golang.org/appengine/cloudsql/cloudsql_vm.go @@ -0,0 +1,16 @@ +// Copyright 2013 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package cloudsql + +import ( + "errors" + "net" +) + +func connect(instance string) (net.Conn, error) { + return nil, errors.New(`cloudsql: not supported in App Engine "flexible environment"`) +} diff --git a/vendor/google.golang.org/appengine/cmd/aebundler/aebundler.go b/vendor/google.golang.org/appengine/cmd/aebundler/aebundler.go new file mode 100644 index 000000000..c66849e83 --- /dev/null +++ b/vendor/google.golang.org/appengine/cmd/aebundler/aebundler.go @@ -0,0 +1,342 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Program aebundler turns a Go app into a fully self-contained tar file. +// The app and its subdirectories (if any) are placed under "." +// and the dependencies from $GOPATH are placed under ./_gopath/src. +// A main func is synthesized if one does not exist. +// +// A sample Dockerfile to be used with this bundler could look like this: +// FROM gcr.io/google-appengine/go-compat +// ADD . /app +// RUN GOPATH=/app/_gopath go build -tags appenginevm -o /app/_ah/exe +package main + +import ( + "archive/tar" + "flag" + "fmt" + "go/ast" + "go/build" + "go/parser" + "go/token" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" +) + +var ( + output = flag.String("o", "", "name of output tar file or '-' for stdout") + rootDir = flag.String("root", ".", "directory name of application root") + vm = flag.Bool("vm", true, `bundle an app for App Engine "flexible environment"`) + + skipFiles = map[string]bool{ + ".git": true, + ".gitconfig": true, + ".hg": true, + ".travis.yml": true, + } +) + +const ( + newMain = `package main +import "google.golang.org/appengine" +func main() { + appengine.Main() +} +` +) + +func usage() { + fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0]) + fmt.Fprintf(os.Stderr, "\t%s -o \tBundle app to named tar file or stdout\n", os.Args[0]) + fmt.Fprintf(os.Stderr, "\noptional arguments:\n") + flag.PrintDefaults() +} + +func main() { + flag.Usage = usage + flag.Parse() + + var tags []string + if *vm { + tags = append(tags, "appenginevm") + } else { + tags = append(tags, "appengine") + } + + tarFile := *output + if tarFile == "" { + usage() + errorf("Required -o flag not specified.") + } + + app, err := analyze(tags) + if err != nil { + errorf("Error analyzing app: %v", err) + } + if err := app.bundle(tarFile); err != nil { + errorf("Unable to bundle app: %v", err) + } +} + +// errorf prints the error message and exits. +func errorf(format string, a ...interface{}) { + fmt.Fprintf(os.Stderr, "aebundler: "+format+"\n", a...) + os.Exit(1) +} + +type app struct { + hasMain bool + appFiles []string + imports map[string]string +} + +// analyze checks the app for building with the given build tags and returns hasMain, +// app files, and a map of full directory import names to original import names. +func analyze(tags []string) (*app, error) { + ctxt := buildContext(tags) + hasMain, appFiles, err := checkMain(ctxt) + if err != nil { + return nil, err + } + gopath := filepath.SplitList(ctxt.GOPATH) + im, err := imports(ctxt, *rootDir, gopath) + return &app{ + hasMain: hasMain, + appFiles: appFiles, + imports: im, + }, err +} + +// buildContext returns the context for building the source. +func buildContext(tags []string) *build.Context { + return &build.Context{ + GOARCH: build.Default.GOARCH, + GOOS: build.Default.GOOS, + GOROOT: build.Default.GOROOT, + GOPATH: build.Default.GOPATH, + Compiler: build.Default.Compiler, + BuildTags: append(build.Default.BuildTags, tags...), + } +} + +// bundle bundles the app into the named tarFile ("-"==stdout). +func (s *app) bundle(tarFile string) (err error) { + var out io.Writer + if tarFile == "-" { + out = os.Stdout + } else { + f, err := os.Create(tarFile) + if err != nil { + return err + } + defer func() { + if cerr := f.Close(); err == nil { + err = cerr + } + }() + out = f + } + tw := tar.NewWriter(out) + + for srcDir, importName := range s.imports { + dstDir := "_gopath/src/" + importName + if err = copyTree(tw, dstDir, srcDir); err != nil { + return fmt.Errorf("unable to copy directory %v to %v: %v", srcDir, dstDir, err) + } + } + if err := copyTree(tw, ".", *rootDir); err != nil { + return fmt.Errorf("unable to copy root directory to /app: %v", err) + } + if !s.hasMain { + if err := synthesizeMain(tw, s.appFiles); err != nil { + return fmt.Errorf("unable to synthesize new main func: %v", err) + } + } + + if err := tw.Close(); err != nil { + return fmt.Errorf("unable to close tar file %v: %v", tarFile, err) + } + return nil +} + +// synthesizeMain generates a new main func and writes it to the tarball. +func synthesizeMain(tw *tar.Writer, appFiles []string) error { + appMap := make(map[string]bool) + for _, f := range appFiles { + appMap[f] = true + } + var f string + for i := 0; i < 100; i++ { + f = fmt.Sprintf("app_main%d.go", i) + if !appMap[filepath.Join(*rootDir, f)] { + break + } + } + if appMap[filepath.Join(*rootDir, f)] { + return fmt.Errorf("unable to find unique name for %v", f) + } + hdr := &tar.Header{ + Name: f, + Mode: 0644, + Size: int64(len(newMain)), + } + if err := tw.WriteHeader(hdr); err != nil { + return fmt.Errorf("unable to write header for %v: %v", f, err) + } + if _, err := tw.Write([]byte(newMain)); err != nil { + return fmt.Errorf("unable to write %v to tar file: %v", f, err) + } + return nil +} + +// imports returns a map of all import directories (recursively) used by the app. +// The return value maps full directory names to original import names. +func imports(ctxt *build.Context, srcDir string, gopath []string) (map[string]string, error) { + pkg, err := ctxt.ImportDir(srcDir, 0) + if err != nil { + return nil, fmt.Errorf("unable to analyze source: %v", err) + } + + // Resolve all non-standard-library imports + result := make(map[string]string) + for _, v := range pkg.Imports { + if !strings.Contains(v, ".") { + continue + } + src, err := findInGopath(v, gopath) + if err != nil { + return nil, fmt.Errorf("unable to find import %v in gopath %v: %v", v, gopath, err) + } + result[src] = v + im, err := imports(ctxt, src, gopath) + if err != nil { + return nil, fmt.Errorf("unable to parse package %v: %v", src, err) + } + for k, v := range im { + result[k] = v + } + } + return result, nil +} + +// findInGopath searches the gopath for the named import directory. +func findInGopath(dir string, gopath []string) (string, error) { + for _, v := range gopath { + dst := filepath.Join(v, "src", dir) + if _, err := os.Stat(dst); err == nil { + return dst, nil + } + } + return "", fmt.Errorf("unable to find package %v in gopath %v", dir, gopath) +} + +// copyTree copies srcDir to tar file dstDir, ignoring skipFiles. +func copyTree(tw *tar.Writer, dstDir, srcDir string) error { + entries, err := ioutil.ReadDir(srcDir) + if err != nil { + return fmt.Errorf("unable to read dir %v: %v", srcDir, err) + } + for _, entry := range entries { + n := entry.Name() + if skipFiles[n] { + continue + } + s := filepath.Join(srcDir, n) + d := filepath.Join(dstDir, n) + if entry.IsDir() { + if err := copyTree(tw, d, s); err != nil { + return fmt.Errorf("unable to copy dir %v to %v: %v", s, d, err) + } + continue + } + if err := copyFile(tw, d, s); err != nil { + return fmt.Errorf("unable to copy dir %v to %v: %v", s, d, err) + } + } + return nil +} + +// copyFile copies src to tar file dst. +func copyFile(tw *tar.Writer, dst, src string) error { + s, err := os.Open(src) + if err != nil { + return fmt.Errorf("unable to open %v: %v", src, err) + } + defer s.Close() + fi, err := s.Stat() + if err != nil { + return fmt.Errorf("unable to stat %v: %v", src, err) + } + + hdr, err := tar.FileInfoHeader(fi, dst) + if err != nil { + return fmt.Errorf("unable to create tar header for %v: %v", dst, err) + } + hdr.Name = dst + if err := tw.WriteHeader(hdr); err != nil { + return fmt.Errorf("unable to write header for %v: %v", dst, err) + } + _, err = io.Copy(tw, s) + if err != nil { + return fmt.Errorf("unable to copy %v to %v: %v", src, dst, err) + } + return nil +} + +// checkMain verifies that there is a single "main" function. +// It also returns a list of all Go source files in the app. +func checkMain(ctxt *build.Context) (bool, []string, error) { + pkg, err := ctxt.ImportDir(*rootDir, 0) + if err != nil { + return false, nil, fmt.Errorf("unable to analyze source: %v", err) + } + if !pkg.IsCommand() { + errorf("Your app's package needs to be changed from %q to \"main\".\n", pkg.Name) + } + // Search for a "func main" + var hasMain bool + var appFiles []string + for _, f := range pkg.GoFiles { + n := filepath.Join(*rootDir, f) + appFiles = append(appFiles, n) + if hasMain, err = readFile(n); err != nil { + return false, nil, fmt.Errorf("error parsing %q: %v", n, err) + } + } + return hasMain, appFiles, nil +} + +// isMain returns whether the given function declaration is a main function. +// Such a function must be called "main", not have a receiver, and have no arguments or return types. +func isMain(f *ast.FuncDecl) bool { + ft := f.Type + return f.Name.Name == "main" && f.Recv == nil && ft.Params.NumFields() == 0 && ft.Results.NumFields() == 0 +} + +// readFile reads and parses the Go source code file and returns whether it has a main function. +func readFile(filename string) (hasMain bool, err error) { + var src []byte + src, err = ioutil.ReadFile(filename) + if err != nil { + return + } + fset := token.NewFileSet() + file, err := parser.ParseFile(fset, filename, src, 0) + for _, decl := range file.Decls { + funcDecl, ok := decl.(*ast.FuncDecl) + if !ok { + continue + } + if !isMain(funcDecl) { + continue + } + hasMain = true + break + } + return +} diff --git a/vendor/google.golang.org/appengine/cmd/aedeploy/aedeploy.go b/vendor/google.golang.org/appengine/cmd/aedeploy/aedeploy.go new file mode 100644 index 000000000..8093c93ff --- /dev/null +++ b/vendor/google.golang.org/appengine/cmd/aedeploy/aedeploy.go @@ -0,0 +1,72 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Program aedeploy assists with deploying App Engine "flexible environment" Go apps to production. +// A temporary directory is created; the app, its subdirectories, and all its +// dependencies from $GOPATH are copied into the directory; then the app +// is deployed to production with the provided command. +// +// The app must be in "package main". +// +// This command must be issued from within the root directory of the app +// (where the app.yaml file is located). +package main + +import ( + "flag" + "fmt" + "log" + "os" + "os/exec" + "strings" +) + +func usage() { + fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0]) + fmt.Fprintf(os.Stderr, "\t%s gcloud --verbosity debug app deploy --version myversion ./app.yaml\tDeploy app to production\n", os.Args[0]) +} + +var verbose bool + +// vlogf logs to stderr if the "-v" flag is provided. +func vlogf(f string, v ...interface{}) { + if !verbose { + return + } + log.Printf("[aedeploy] "+f, v...) +} + +func main() { + flag.BoolVar(&verbose, "v", false, "Verbose logging.") + flag.Usage = usage + flag.Parse() + if flag.NArg() < 1 { + usage() + os.Exit(1) + } + + notice := func() { + fmt.Fprintln(os.Stderr, `NOTICE: aedeploy is deprecated. Just use "gcloud app deploy".`) + } + + notice() + if err := deploy(); err != nil { + fmt.Fprintf(os.Stderr, os.Args[0]+": Error: %v\n", err) + notice() + fmt.Fprintln(os.Stderr, `You might need to update gcloud. Run "gcloud components update".`) + os.Exit(1) + } + notice() // Make sure they see it at the end. +} + +// deploy calls the provided command to deploy the app from the temporary directory. +func deploy() error { + vlogf("Running command %v", flag.Args()) + cmd := exec.Command(flag.Arg(0), flag.Args()[1:]...) + cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr + if err := cmd.Run(); err != nil { + return fmt.Errorf("unable to run %q: %v", strings.Join(flag.Args(), " "), err) + } + return nil +} diff --git a/vendor/google.golang.org/appengine/cmd/aefix/ae.go b/vendor/google.golang.org/appengine/cmd/aefix/ae.go new file mode 100644 index 000000000..0fe2d4ae9 --- /dev/null +++ b/vendor/google.golang.org/appengine/cmd/aefix/ae.go @@ -0,0 +1,185 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package main + +import ( + "go/ast" + "path" + "strconv" + "strings" +) + +const ( + ctxPackage = "golang.org/x/net/context" + + newPackageBase = "google.golang.org/" + stutterPackage = false +) + +func init() { + register(fix{ + "ae", + "2016-04-15", + aeFn, + `Update old App Engine APIs to new App Engine APIs`, + }) +} + +// logMethod is the set of methods on appengine.Context used for logging. +var logMethod = map[string]bool{ + "Debugf": true, + "Infof": true, + "Warningf": true, + "Errorf": true, + "Criticalf": true, +} + +// mapPackage turns "appengine" into "google.golang.org/appengine", etc. +func mapPackage(s string) string { + if stutterPackage { + s += "/" + path.Base(s) + } + return newPackageBase + s +} + +func aeFn(f *ast.File) bool { + // During the walk, we track the last thing seen that looks like + // an appengine.Context, and reset it once the walk leaves a func. + var lastContext *ast.Ident + + fixed := false + + // Update imports. + mainImp := "appengine" + for _, imp := range f.Imports { + pth, _ := strconv.Unquote(imp.Path.Value) + if pth == "appengine" || strings.HasPrefix(pth, "appengine/") { + newPth := mapPackage(pth) + imp.Path.Value = strconv.Quote(newPth) + fixed = true + + if pth == "appengine" { + mainImp = newPth + } + } + } + + // Update any API changes. + walk(f, func(n interface{}) { + if ft, ok := n.(*ast.FuncType); ok && ft.Params != nil { + // See if this func has an `appengine.Context arg`. + // If so, remember its identifier. + for _, param := range ft.Params.List { + if !isPkgDot(param.Type, "appengine", "Context") { + continue + } + if len(param.Names) == 1 { + lastContext = param.Names[0] + break + } + } + return + } + + if as, ok := n.(*ast.AssignStmt); ok { + if len(as.Lhs) == 1 && len(as.Rhs) == 1 { + // If this node is an assignment from an appengine.NewContext invocation, + // remember the identifier on the LHS. + if isCall(as.Rhs[0], "appengine", "NewContext") { + if ident, ok := as.Lhs[0].(*ast.Ident); ok { + lastContext = ident + return + } + } + // x (=|:=) appengine.Timeout(y, z) + // should become + // x, _ (=|:=) context.WithTimeout(y, z) + if isCall(as.Rhs[0], "appengine", "Timeout") { + addImport(f, ctxPackage) + as.Lhs = append(as.Lhs, ast.NewIdent("_")) + // isCall already did the type checking. + sel := as.Rhs[0].(*ast.CallExpr).Fun.(*ast.SelectorExpr) + sel.X = ast.NewIdent("context") + sel.Sel = ast.NewIdent("WithTimeout") + fixed = true + return + } + } + return + } + + // If this node is a FuncDecl, we've finished the function, so reset lastContext. + if _, ok := n.(*ast.FuncDecl); ok { + lastContext = nil + return + } + + if call, ok := n.(*ast.CallExpr); ok { + if isPkgDot(call.Fun, "appengine", "Datacenter") && len(call.Args) == 0 { + insertContext(f, call, lastContext) + fixed = true + return + } + if isPkgDot(call.Fun, "taskqueue", "QueueStats") && len(call.Args) == 3 { + call.Args = call.Args[:2] // drop last arg + fixed = true + return + } + + sel, ok := call.Fun.(*ast.SelectorExpr) + if !ok { + return + } + if lastContext != nil && refersTo(sel.X, lastContext) && logMethod[sel.Sel.Name] { + // c.Errorf(...) + // should become + // log.Errorf(c, ...) + addImport(f, mapPackage("appengine/log")) + sel.X = &ast.Ident{ // ast.NewIdent doesn't preserve the position. + NamePos: sel.X.Pos(), + Name: "log", + } + insertContext(f, call, lastContext) + fixed = true + return + } + } + }) + + // Change any `appengine.Context` to `context.Context`. + // Do this in a separate walk because the previous walk + // wants to identify "appengine.Context". + walk(f, func(n interface{}) { + expr, ok := n.(ast.Expr) + if ok && isPkgDot(expr, "appengine", "Context") { + addImport(f, ctxPackage) + // isPkgDot did the type checking. + n.(*ast.SelectorExpr).X.(*ast.Ident).Name = "context" + fixed = true + return + } + }) + + // The changes above might remove the need to import "appengine". + // Check if it's used, and drop it if it isn't. + if fixed && !usesImport(f, mainImp) { + deleteImport(f, mainImp) + } + + return fixed +} + +// ctx may be nil. +func insertContext(f *ast.File, call *ast.CallExpr, ctx *ast.Ident) { + if ctx == nil { + // context is unknown, so use a plain "ctx". + ctx = ast.NewIdent("ctx") + } else { + // Create a fresh *ast.Ident so we drop the position information. + ctx = ast.NewIdent(ctx.Name) + } + + call.Args = append([]ast.Expr{ctx}, call.Args...) +} diff --git a/vendor/google.golang.org/appengine/cmd/aefix/ae_test.go b/vendor/google.golang.org/appengine/cmd/aefix/ae_test.go new file mode 100644 index 000000000..21f5695b9 --- /dev/null +++ b/vendor/google.golang.org/appengine/cmd/aefix/ae_test.go @@ -0,0 +1,144 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package main + +func init() { + addTestCases(aeTests, nil) +} + +var aeTests = []testCase{ + // Collection of fixes: + // - imports + // - appengine.Timeout -> context.WithTimeout + // - add ctx arg to appengine.Datacenter + // - logging API + { + Name: "ae.0", + In: `package foo + +import ( + "net/http" + "time" + + "appengine" + "appengine/datastore" +) + +func f(w http.ResponseWriter, r *http.Request) { + c := appengine.NewContext(r) + + c = appengine.Timeout(c, 5*time.Second) + err := datastore.ErrNoSuchEntity + c.Errorf("Something interesting happened: %v", err) + _ = appengine.Datacenter() +} +`, + Out: `package foo + +import ( + "net/http" + "time" + + "golang.org/x/net/context" + "google.golang.org/appengine" + "google.golang.org/appengine/datastore" + "google.golang.org/appengine/log" +) + +func f(w http.ResponseWriter, r *http.Request) { + c := appengine.NewContext(r) + + c, _ = context.WithTimeout(c, 5*time.Second) + err := datastore.ErrNoSuchEntity + log.Errorf(c, "Something interesting happened: %v", err) + _ = appengine.Datacenter(c) +} +`, + }, + + // Updating a function that takes an appengine.Context arg. + { + Name: "ae.1", + In: `package foo + +import ( + "appengine" +) + +func LogSomething(c2 appengine.Context) { + c2.Warningf("Stand back! I'm going to try science!") +} +`, + Out: `package foo + +import ( + "golang.org/x/net/context" + "google.golang.org/appengine/log" +) + +func LogSomething(c2 context.Context) { + log.Warningf(c2, "Stand back! I'm going to try science!") +} +`, + }, + + // Less widely used API changes: + // - drop maxTasks arg to taskqueue.QueueStats + { + Name: "ae.2", + In: `package foo + +import ( + "appengine" + "appengine/taskqueue" +) + +func f(ctx appengine.Context) { + stats, err := taskqueue.QueueStats(ctx, []string{"one", "two"}, 0) +} +`, + Out: `package foo + +import ( + "golang.org/x/net/context" + "google.golang.org/appengine/taskqueue" +) + +func f(ctx context.Context) { + stats, err := taskqueue.QueueStats(ctx, []string{"one", "two"}) +} +`, + }, + + // Check that the main "appengine" import will not be dropped + // if an appengine.Context -> context.Context change happens + // but the appengine package is still referenced. + { + Name: "ae.3", + In: `package foo + +import ( + "appengine" + "io" +) + +func f(ctx appengine.Context, w io.Writer) { + _ = appengine.IsDevAppServer() +} +`, + Out: `package foo + +import ( + "golang.org/x/net/context" + "google.golang.org/appengine" + "io" +) + +func f(ctx context.Context, w io.Writer) { + _ = appengine.IsDevAppServer() +} +`, + }, +} diff --git a/vendor/google.golang.org/appengine/cmd/aefix/fix.go b/vendor/google.golang.org/appengine/cmd/aefix/fix.go new file mode 100644 index 000000000..a100be794 --- /dev/null +++ b/vendor/google.golang.org/appengine/cmd/aefix/fix.go @@ -0,0 +1,848 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "fmt" + "go/ast" + "go/parser" + "go/token" + "os" + "path" + "reflect" + "strconv" + "strings" +) + +type fix struct { + name string + date string // date that fix was introduced, in YYYY-MM-DD format + f func(*ast.File) bool + desc string +} + +// main runs sort.Sort(byName(fixes)) before printing list of fixes. +type byName []fix + +func (f byName) Len() int { return len(f) } +func (f byName) Swap(i, j int) { f[i], f[j] = f[j], f[i] } +func (f byName) Less(i, j int) bool { return f[i].name < f[j].name } + +// main runs sort.Sort(byDate(fixes)) before applying fixes. +type byDate []fix + +func (f byDate) Len() int { return len(f) } +func (f byDate) Swap(i, j int) { f[i], f[j] = f[j], f[i] } +func (f byDate) Less(i, j int) bool { return f[i].date < f[j].date } + +var fixes []fix + +func register(f fix) { + fixes = append(fixes, f) +} + +// walk traverses the AST x, calling visit(y) for each node y in the tree but +// also with a pointer to each ast.Expr, ast.Stmt, and *ast.BlockStmt, +// in a bottom-up traversal. +func walk(x interface{}, visit func(interface{})) { + walkBeforeAfter(x, nop, visit) +} + +func nop(interface{}) {} + +// walkBeforeAfter is like walk but calls before(x) before traversing +// x's children and after(x) afterward. +func walkBeforeAfter(x interface{}, before, after func(interface{})) { + before(x) + + switch n := x.(type) { + default: + panic(fmt.Errorf("unexpected type %T in walkBeforeAfter", x)) + + case nil: + + // pointers to interfaces + case *ast.Decl: + walkBeforeAfter(*n, before, after) + case *ast.Expr: + walkBeforeAfter(*n, before, after) + case *ast.Spec: + walkBeforeAfter(*n, before, after) + case *ast.Stmt: + walkBeforeAfter(*n, before, after) + + // pointers to struct pointers + case **ast.BlockStmt: + walkBeforeAfter(*n, before, after) + case **ast.CallExpr: + walkBeforeAfter(*n, before, after) + case **ast.FieldList: + walkBeforeAfter(*n, before, after) + case **ast.FuncType: + walkBeforeAfter(*n, before, after) + case **ast.Ident: + walkBeforeAfter(*n, before, after) + case **ast.BasicLit: + walkBeforeAfter(*n, before, after) + + // pointers to slices + case *[]ast.Decl: + walkBeforeAfter(*n, before, after) + case *[]ast.Expr: + walkBeforeAfter(*n, before, after) + case *[]*ast.File: + walkBeforeAfter(*n, before, after) + case *[]*ast.Ident: + walkBeforeAfter(*n, before, after) + case *[]ast.Spec: + walkBeforeAfter(*n, before, after) + case *[]ast.Stmt: + walkBeforeAfter(*n, before, after) + + // These are ordered and grouped to match ../../pkg/go/ast/ast.go + case *ast.Field: + walkBeforeAfter(&n.Names, before, after) + walkBeforeAfter(&n.Type, before, after) + walkBeforeAfter(&n.Tag, before, after) + case *ast.FieldList: + for _, field := range n.List { + walkBeforeAfter(field, before, after) + } + case *ast.BadExpr: + case *ast.Ident: + case *ast.Ellipsis: + walkBeforeAfter(&n.Elt, before, after) + case *ast.BasicLit: + case *ast.FuncLit: + walkBeforeAfter(&n.Type, before, after) + walkBeforeAfter(&n.Body, before, after) + case *ast.CompositeLit: + walkBeforeAfter(&n.Type, before, after) + walkBeforeAfter(&n.Elts, before, after) + case *ast.ParenExpr: + walkBeforeAfter(&n.X, before, after) + case *ast.SelectorExpr: + walkBeforeAfter(&n.X, before, after) + case *ast.IndexExpr: + walkBeforeAfter(&n.X, before, after) + walkBeforeAfter(&n.Index, before, after) + case *ast.SliceExpr: + walkBeforeAfter(&n.X, before, after) + if n.Low != nil { + walkBeforeAfter(&n.Low, before, after) + } + if n.High != nil { + walkBeforeAfter(&n.High, before, after) + } + case *ast.TypeAssertExpr: + walkBeforeAfter(&n.X, before, after) + walkBeforeAfter(&n.Type, before, after) + case *ast.CallExpr: + walkBeforeAfter(&n.Fun, before, after) + walkBeforeAfter(&n.Args, before, after) + case *ast.StarExpr: + walkBeforeAfter(&n.X, before, after) + case *ast.UnaryExpr: + walkBeforeAfter(&n.X, before, after) + case *ast.BinaryExpr: + walkBeforeAfter(&n.X, before, after) + walkBeforeAfter(&n.Y, before, after) + case *ast.KeyValueExpr: + walkBeforeAfter(&n.Key, before, after) + walkBeforeAfter(&n.Value, before, after) + + case *ast.ArrayType: + walkBeforeAfter(&n.Len, before, after) + walkBeforeAfter(&n.Elt, before, after) + case *ast.StructType: + walkBeforeAfter(&n.Fields, before, after) + case *ast.FuncType: + walkBeforeAfter(&n.Params, before, after) + if n.Results != nil { + walkBeforeAfter(&n.Results, before, after) + } + case *ast.InterfaceType: + walkBeforeAfter(&n.Methods, before, after) + case *ast.MapType: + walkBeforeAfter(&n.Key, before, after) + walkBeforeAfter(&n.Value, before, after) + case *ast.ChanType: + walkBeforeAfter(&n.Value, before, after) + + case *ast.BadStmt: + case *ast.DeclStmt: + walkBeforeAfter(&n.Decl, before, after) + case *ast.EmptyStmt: + case *ast.LabeledStmt: + walkBeforeAfter(&n.Stmt, before, after) + case *ast.ExprStmt: + walkBeforeAfter(&n.X, before, after) + case *ast.SendStmt: + walkBeforeAfter(&n.Chan, before, after) + walkBeforeAfter(&n.Value, before, after) + case *ast.IncDecStmt: + walkBeforeAfter(&n.X, before, after) + case *ast.AssignStmt: + walkBeforeAfter(&n.Lhs, before, after) + walkBeforeAfter(&n.Rhs, before, after) + case *ast.GoStmt: + walkBeforeAfter(&n.Call, before, after) + case *ast.DeferStmt: + walkBeforeAfter(&n.Call, before, after) + case *ast.ReturnStmt: + walkBeforeAfter(&n.Results, before, after) + case *ast.BranchStmt: + case *ast.BlockStmt: + walkBeforeAfter(&n.List, before, after) + case *ast.IfStmt: + walkBeforeAfter(&n.Init, before, after) + walkBeforeAfter(&n.Cond, before, after) + walkBeforeAfter(&n.Body, before, after) + walkBeforeAfter(&n.Else, before, after) + case *ast.CaseClause: + walkBeforeAfter(&n.List, before, after) + walkBeforeAfter(&n.Body, before, after) + case *ast.SwitchStmt: + walkBeforeAfter(&n.Init, before, after) + walkBeforeAfter(&n.Tag, before, after) + walkBeforeAfter(&n.Body, before, after) + case *ast.TypeSwitchStmt: + walkBeforeAfter(&n.Init, before, after) + walkBeforeAfter(&n.Assign, before, after) + walkBeforeAfter(&n.Body, before, after) + case *ast.CommClause: + walkBeforeAfter(&n.Comm, before, after) + walkBeforeAfter(&n.Body, before, after) + case *ast.SelectStmt: + walkBeforeAfter(&n.Body, before, after) + case *ast.ForStmt: + walkBeforeAfter(&n.Init, before, after) + walkBeforeAfter(&n.Cond, before, after) + walkBeforeAfter(&n.Post, before, after) + walkBeforeAfter(&n.Body, before, after) + case *ast.RangeStmt: + walkBeforeAfter(&n.Key, before, after) + walkBeforeAfter(&n.Value, before, after) + walkBeforeAfter(&n.X, before, after) + walkBeforeAfter(&n.Body, before, after) + + case *ast.ImportSpec: + case *ast.ValueSpec: + walkBeforeAfter(&n.Type, before, after) + walkBeforeAfter(&n.Values, before, after) + walkBeforeAfter(&n.Names, before, after) + case *ast.TypeSpec: + walkBeforeAfter(&n.Type, before, after) + + case *ast.BadDecl: + case *ast.GenDecl: + walkBeforeAfter(&n.Specs, before, after) + case *ast.FuncDecl: + if n.Recv != nil { + walkBeforeAfter(&n.Recv, before, after) + } + walkBeforeAfter(&n.Type, before, after) + if n.Body != nil { + walkBeforeAfter(&n.Body, before, after) + } + + case *ast.File: + walkBeforeAfter(&n.Decls, before, after) + + case *ast.Package: + walkBeforeAfter(&n.Files, before, after) + + case []*ast.File: + for i := range n { + walkBeforeAfter(&n[i], before, after) + } + case []ast.Decl: + for i := range n { + walkBeforeAfter(&n[i], before, after) + } + case []ast.Expr: + for i := range n { + walkBeforeAfter(&n[i], before, after) + } + case []*ast.Ident: + for i := range n { + walkBeforeAfter(&n[i], before, after) + } + case []ast.Stmt: + for i := range n { + walkBeforeAfter(&n[i], before, after) + } + case []ast.Spec: + for i := range n { + walkBeforeAfter(&n[i], before, after) + } + } + after(x) +} + +// imports returns true if f imports path. +func imports(f *ast.File, path string) bool { + return importSpec(f, path) != nil +} + +// importSpec returns the import spec if f imports path, +// or nil otherwise. +func importSpec(f *ast.File, path string) *ast.ImportSpec { + for _, s := range f.Imports { + if importPath(s) == path { + return s + } + } + return nil +} + +// importPath returns the unquoted import path of s, +// or "" if the path is not properly quoted. +func importPath(s *ast.ImportSpec) string { + t, err := strconv.Unquote(s.Path.Value) + if err == nil { + return t + } + return "" +} + +// declImports reports whether gen contains an import of path. +func declImports(gen *ast.GenDecl, path string) bool { + if gen.Tok != token.IMPORT { + return false + } + for _, spec := range gen.Specs { + impspec := spec.(*ast.ImportSpec) + if importPath(impspec) == path { + return true + } + } + return false +} + +// isPkgDot returns true if t is the expression "pkg.name" +// where pkg is an imported identifier. +func isPkgDot(t ast.Expr, pkg, name string) bool { + sel, ok := t.(*ast.SelectorExpr) + return ok && isTopName(sel.X, pkg) && sel.Sel.String() == name +} + +// isPtrPkgDot returns true if f is the expression "*pkg.name" +// where pkg is an imported identifier. +func isPtrPkgDot(t ast.Expr, pkg, name string) bool { + ptr, ok := t.(*ast.StarExpr) + return ok && isPkgDot(ptr.X, pkg, name) +} + +// isTopName returns true if n is a top-level unresolved identifier with the given name. +func isTopName(n ast.Expr, name string) bool { + id, ok := n.(*ast.Ident) + return ok && id.Name == name && id.Obj == nil +} + +// isName returns true if n is an identifier with the given name. +func isName(n ast.Expr, name string) bool { + id, ok := n.(*ast.Ident) + return ok && id.String() == name +} + +// isCall returns true if t is a call to pkg.name. +func isCall(t ast.Expr, pkg, name string) bool { + call, ok := t.(*ast.CallExpr) + return ok && isPkgDot(call.Fun, pkg, name) +} + +// If n is an *ast.Ident, isIdent returns it; otherwise isIdent returns nil. +func isIdent(n interface{}) *ast.Ident { + id, _ := n.(*ast.Ident) + return id +} + +// refersTo returns true if n is a reference to the same object as x. +func refersTo(n ast.Node, x *ast.Ident) bool { + id, ok := n.(*ast.Ident) + // The test of id.Name == x.Name handles top-level unresolved + // identifiers, which all have Obj == nil. + return ok && id.Obj == x.Obj && id.Name == x.Name +} + +// isBlank returns true if n is the blank identifier. +func isBlank(n ast.Expr) bool { + return isName(n, "_") +} + +// isEmptyString returns true if n is an empty string literal. +func isEmptyString(n ast.Expr) bool { + lit, ok := n.(*ast.BasicLit) + return ok && lit.Kind == token.STRING && len(lit.Value) == 2 +} + +func warn(pos token.Pos, msg string, args ...interface{}) { + if pos.IsValid() { + msg = "%s: " + msg + arg1 := []interface{}{fset.Position(pos).String()} + args = append(arg1, args...) + } + fmt.Fprintf(os.Stderr, msg+"\n", args...) +} + +// countUses returns the number of uses of the identifier x in scope. +func countUses(x *ast.Ident, scope []ast.Stmt) int { + count := 0 + ff := func(n interface{}) { + if n, ok := n.(ast.Node); ok && refersTo(n, x) { + count++ + } + } + for _, n := range scope { + walk(n, ff) + } + return count +} + +// rewriteUses replaces all uses of the identifier x and !x in scope +// with f(x.Pos()) and fnot(x.Pos()). +func rewriteUses(x *ast.Ident, f, fnot func(token.Pos) ast.Expr, scope []ast.Stmt) { + var lastF ast.Expr + ff := func(n interface{}) { + ptr, ok := n.(*ast.Expr) + if !ok { + return + } + nn := *ptr + + // The child node was just walked and possibly replaced. + // If it was replaced and this is a negation, replace with fnot(p). + not, ok := nn.(*ast.UnaryExpr) + if ok && not.Op == token.NOT && not.X == lastF { + *ptr = fnot(nn.Pos()) + return + } + if refersTo(nn, x) { + lastF = f(nn.Pos()) + *ptr = lastF + } + } + for _, n := range scope { + walk(n, ff) + } +} + +// assignsTo returns true if any of the code in scope assigns to or takes the address of x. +func assignsTo(x *ast.Ident, scope []ast.Stmt) bool { + assigned := false + ff := func(n interface{}) { + if assigned { + return + } + switch n := n.(type) { + case *ast.UnaryExpr: + // use of &x + if n.Op == token.AND && refersTo(n.X, x) { + assigned = true + return + } + case *ast.AssignStmt: + for _, l := range n.Lhs { + if refersTo(l, x) { + assigned = true + return + } + } + } + } + for _, n := range scope { + if assigned { + break + } + walk(n, ff) + } + return assigned +} + +// newPkgDot returns an ast.Expr referring to "pkg.name" at position pos. +func newPkgDot(pos token.Pos, pkg, name string) ast.Expr { + return &ast.SelectorExpr{ + X: &ast.Ident{ + NamePos: pos, + Name: pkg, + }, + Sel: &ast.Ident{ + NamePos: pos, + Name: name, + }, + } +} + +// renameTop renames all references to the top-level name old. +// It returns true if it makes any changes. +func renameTop(f *ast.File, old, new string) bool { + var fixed bool + + // Rename any conflicting imports + // (assuming package name is last element of path). + for _, s := range f.Imports { + if s.Name != nil { + if s.Name.Name == old { + s.Name.Name = new + fixed = true + } + } else { + _, thisName := path.Split(importPath(s)) + if thisName == old { + s.Name = ast.NewIdent(new) + fixed = true + } + } + } + + // Rename any top-level declarations. + for _, d := range f.Decls { + switch d := d.(type) { + case *ast.FuncDecl: + if d.Recv == nil && d.Name.Name == old { + d.Name.Name = new + d.Name.Obj.Name = new + fixed = true + } + case *ast.GenDecl: + for _, s := range d.Specs { + switch s := s.(type) { + case *ast.TypeSpec: + if s.Name.Name == old { + s.Name.Name = new + s.Name.Obj.Name = new + fixed = true + } + case *ast.ValueSpec: + for _, n := range s.Names { + if n.Name == old { + n.Name = new + n.Obj.Name = new + fixed = true + } + } + } + } + } + } + + // Rename top-level old to new, both unresolved names + // (probably defined in another file) and names that resolve + // to a declaration we renamed. + walk(f, func(n interface{}) { + id, ok := n.(*ast.Ident) + if ok && isTopName(id, old) { + id.Name = new + fixed = true + } + if ok && id.Obj != nil && id.Name == old && id.Obj.Name == new { + id.Name = id.Obj.Name + fixed = true + } + }) + + return fixed +} + +// matchLen returns the length of the longest prefix shared by x and y. +func matchLen(x, y string) int { + i := 0 + for i < len(x) && i < len(y) && x[i] == y[i] { + i++ + } + return i +} + +// addImport adds the import path to the file f, if absent. +func addImport(f *ast.File, ipath string) (added bool) { + if imports(f, ipath) { + return false + } + + // Determine name of import. + // Assume added imports follow convention of using last element. + _, name := path.Split(ipath) + + // Rename any conflicting top-level references from name to name_. + renameTop(f, name, name+"_") + + newImport := &ast.ImportSpec{ + Path: &ast.BasicLit{ + Kind: token.STRING, + Value: strconv.Quote(ipath), + }, + } + + // Find an import decl to add to. + var ( + bestMatch = -1 + lastImport = -1 + impDecl *ast.GenDecl + impIndex = -1 + ) + for i, decl := range f.Decls { + gen, ok := decl.(*ast.GenDecl) + if ok && gen.Tok == token.IMPORT { + lastImport = i + // Do not add to import "C", to avoid disrupting the + // association with its doc comment, breaking cgo. + if declImports(gen, "C") { + continue + } + + // Compute longest shared prefix with imports in this block. + for j, spec := range gen.Specs { + impspec := spec.(*ast.ImportSpec) + n := matchLen(importPath(impspec), ipath) + if n > bestMatch { + bestMatch = n + impDecl = gen + impIndex = j + } + } + } + } + + // If no import decl found, add one after the last import. + if impDecl == nil { + impDecl = &ast.GenDecl{ + Tok: token.IMPORT, + } + f.Decls = append(f.Decls, nil) + copy(f.Decls[lastImport+2:], f.Decls[lastImport+1:]) + f.Decls[lastImport+1] = impDecl + } + + // Ensure the import decl has parentheses, if needed. + if len(impDecl.Specs) > 0 && !impDecl.Lparen.IsValid() { + impDecl.Lparen = impDecl.Pos() + } + + insertAt := impIndex + 1 + if insertAt == 0 { + insertAt = len(impDecl.Specs) + } + impDecl.Specs = append(impDecl.Specs, nil) + copy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:]) + impDecl.Specs[insertAt] = newImport + if insertAt > 0 { + // Assign same position as the previous import, + // so that the sorter sees it as being in the same block. + prev := impDecl.Specs[insertAt-1] + newImport.Path.ValuePos = prev.Pos() + newImport.EndPos = prev.Pos() + } + + f.Imports = append(f.Imports, newImport) + return true +} + +// deleteImport deletes the import path from the file f, if present. +func deleteImport(f *ast.File, path string) (deleted bool) { + oldImport := importSpec(f, path) + + // Find the import node that imports path, if any. + for i, decl := range f.Decls { + gen, ok := decl.(*ast.GenDecl) + if !ok || gen.Tok != token.IMPORT { + continue + } + for j, spec := range gen.Specs { + impspec := spec.(*ast.ImportSpec) + if oldImport != impspec { + continue + } + + // We found an import spec that imports path. + // Delete it. + deleted = true + copy(gen.Specs[j:], gen.Specs[j+1:]) + gen.Specs = gen.Specs[:len(gen.Specs)-1] + + // If this was the last import spec in this decl, + // delete the decl, too. + if len(gen.Specs) == 0 { + copy(f.Decls[i:], f.Decls[i+1:]) + f.Decls = f.Decls[:len(f.Decls)-1] + } else if len(gen.Specs) == 1 { + gen.Lparen = token.NoPos // drop parens + } + if j > 0 { + // We deleted an entry but now there will be + // a blank line-sized hole where the import was. + // Close the hole by making the previous + // import appear to "end" where this one did. + gen.Specs[j-1].(*ast.ImportSpec).EndPos = impspec.End() + } + break + } + } + + // Delete it from f.Imports. + for i, imp := range f.Imports { + if imp == oldImport { + copy(f.Imports[i:], f.Imports[i+1:]) + f.Imports = f.Imports[:len(f.Imports)-1] + break + } + } + + return +} + +// rewriteImport rewrites any import of path oldPath to path newPath. +func rewriteImport(f *ast.File, oldPath, newPath string) (rewrote bool) { + for _, imp := range f.Imports { + if importPath(imp) == oldPath { + rewrote = true + // record old End, because the default is to compute + // it using the length of imp.Path.Value. + imp.EndPos = imp.End() + imp.Path.Value = strconv.Quote(newPath) + } + } + return +} + +func usesImport(f *ast.File, path string) (used bool) { + spec := importSpec(f, path) + if spec == nil { + return + } + + name := spec.Name.String() + switch name { + case "": + // If the package name is not explicitly specified, + // make an educated guess. This is not guaranteed to be correct. + lastSlash := strings.LastIndex(path, "/") + if lastSlash == -1 { + name = path + } else { + name = path[lastSlash+1:] + } + case "_", ".": + // Not sure if this import is used - err on the side of caution. + return true + } + + walk(f, func(n interface{}) { + sel, ok := n.(*ast.SelectorExpr) + if ok && isTopName(sel.X, name) { + used = true + } + }) + + return +} + +func expr(s string) ast.Expr { + x, err := parser.ParseExpr(s) + if err != nil { + panic("parsing " + s + ": " + err.Error()) + } + // Remove position information to avoid spurious newlines. + killPos(reflect.ValueOf(x)) + return x +} + +var posType = reflect.TypeOf(token.Pos(0)) + +func killPos(v reflect.Value) { + switch v.Kind() { + case reflect.Ptr, reflect.Interface: + if !v.IsNil() { + killPos(v.Elem()) + } + case reflect.Slice: + n := v.Len() + for i := 0; i < n; i++ { + killPos(v.Index(i)) + } + case reflect.Struct: + n := v.NumField() + for i := 0; i < n; i++ { + f := v.Field(i) + if f.Type() == posType { + f.SetInt(0) + continue + } + killPos(f) + } + } +} + +// A Rename describes a single renaming. +type rename struct { + OldImport string // only apply rename if this import is present + NewImport string // add this import during rewrite + Old string // old name: p.T or *p.T + New string // new name: p.T or *p.T +} + +func renameFix(tab []rename) func(*ast.File) bool { + return func(f *ast.File) bool { + return renameFixTab(f, tab) + } +} + +func parseName(s string) (ptr bool, pkg, nam string) { + i := strings.Index(s, ".") + if i < 0 { + panic("parseName: invalid name " + s) + } + if strings.HasPrefix(s, "*") { + ptr = true + s = s[1:] + i-- + } + pkg = s[:i] + nam = s[i+1:] + return +} + +func renameFixTab(f *ast.File, tab []rename) bool { + fixed := false + added := map[string]bool{} + check := map[string]bool{} + for _, t := range tab { + if !imports(f, t.OldImport) { + continue + } + optr, opkg, onam := parseName(t.Old) + walk(f, func(n interface{}) { + np, ok := n.(*ast.Expr) + if !ok { + return + } + x := *np + if optr { + p, ok := x.(*ast.StarExpr) + if !ok { + return + } + x = p.X + } + if !isPkgDot(x, opkg, onam) { + return + } + if t.NewImport != "" && !added[t.NewImport] { + addImport(f, t.NewImport) + added[t.NewImport] = true + } + *np = expr(t.New) + check[t.OldImport] = true + fixed = true + }) + } + + for ipath := range check { + if !usesImport(f, ipath) { + deleteImport(f, ipath) + } + } + return fixed +} diff --git a/vendor/google.golang.org/appengine/cmd/aefix/main.go b/vendor/google.golang.org/appengine/cmd/aefix/main.go new file mode 100644 index 000000000..8e193a6ad --- /dev/null +++ b/vendor/google.golang.org/appengine/cmd/aefix/main.go @@ -0,0 +1,258 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "bytes" + "flag" + "fmt" + "go/ast" + "go/format" + "go/parser" + "go/scanner" + "go/token" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "sort" + "strings" +) + +var ( + fset = token.NewFileSet() + exitCode = 0 +) + +var allowedRewrites = flag.String("r", "", + "restrict the rewrites to this comma-separated list") + +var forceRewrites = flag.String("force", "", + "force these fixes to run even if the code looks updated") + +var allowed, force map[string]bool + +var doDiff = flag.Bool("diff", false, "display diffs instead of rewriting files") + +// enable for debugging fix failures +const debug = false // display incorrectly reformatted source and exit + +func usage() { + fmt.Fprintf(os.Stderr, "usage: aefix [-diff] [-r fixname,...] [-force fixname,...] [path ...]\n") + flag.PrintDefaults() + fmt.Fprintf(os.Stderr, "\nAvailable rewrites are:\n") + sort.Sort(byName(fixes)) + for _, f := range fixes { + fmt.Fprintf(os.Stderr, "\n%s\n", f.name) + desc := strings.TrimSpace(f.desc) + desc = strings.Replace(desc, "\n", "\n\t", -1) + fmt.Fprintf(os.Stderr, "\t%s\n", desc) + } + os.Exit(2) +} + +func main() { + flag.Usage = usage + flag.Parse() + + sort.Sort(byDate(fixes)) + + if *allowedRewrites != "" { + allowed = make(map[string]bool) + for _, f := range strings.Split(*allowedRewrites, ",") { + allowed[f] = true + } + } + + if *forceRewrites != "" { + force = make(map[string]bool) + for _, f := range strings.Split(*forceRewrites, ",") { + force[f] = true + } + } + + if flag.NArg() == 0 { + if err := processFile("standard input", true); err != nil { + report(err) + } + os.Exit(exitCode) + } + + for i := 0; i < flag.NArg(); i++ { + path := flag.Arg(i) + switch dir, err := os.Stat(path); { + case err != nil: + report(err) + case dir.IsDir(): + walkDir(path) + default: + if err := processFile(path, false); err != nil { + report(err) + } + } + } + + os.Exit(exitCode) +} + +const parserMode = parser.ParseComments + +func gofmtFile(f *ast.File) ([]byte, error) { + var buf bytes.Buffer + if err := format.Node(&buf, fset, f); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func processFile(filename string, useStdin bool) error { + var f *os.File + var err error + var fixlog bytes.Buffer + + if useStdin { + f = os.Stdin + } else { + f, err = os.Open(filename) + if err != nil { + return err + } + defer f.Close() + } + + src, err := ioutil.ReadAll(f) + if err != nil { + return err + } + + file, err := parser.ParseFile(fset, filename, src, parserMode) + if err != nil { + return err + } + + // Apply all fixes to file. + newFile := file + fixed := false + for _, fix := range fixes { + if allowed != nil && !allowed[fix.name] { + continue + } + if fix.f(newFile) { + fixed = true + fmt.Fprintf(&fixlog, " %s", fix.name) + + // AST changed. + // Print and parse, to update any missing scoping + // or position information for subsequent fixers. + newSrc, err := gofmtFile(newFile) + if err != nil { + return err + } + newFile, err = parser.ParseFile(fset, filename, newSrc, parserMode) + if err != nil { + if debug { + fmt.Printf("%s", newSrc) + report(err) + os.Exit(exitCode) + } + return err + } + } + } + if !fixed { + return nil + } + fmt.Fprintf(os.Stderr, "%s: fixed %s\n", filename, fixlog.String()[1:]) + + // Print AST. We did that after each fix, so this appears + // redundant, but it is necessary to generate gofmt-compatible + // source code in a few cases. The official gofmt style is the + // output of the printer run on a standard AST generated by the parser, + // but the source we generated inside the loop above is the + // output of the printer run on a mangled AST generated by a fixer. + newSrc, err := gofmtFile(newFile) + if err != nil { + return err + } + + if *doDiff { + data, err := diff(src, newSrc) + if err != nil { + return fmt.Errorf("computing diff: %s", err) + } + fmt.Printf("diff %s fixed/%s\n", filename, filename) + os.Stdout.Write(data) + return nil + } + + if useStdin { + os.Stdout.Write(newSrc) + return nil + } + + return ioutil.WriteFile(f.Name(), newSrc, 0) +} + +var gofmtBuf bytes.Buffer + +func gofmt(n interface{}) string { + gofmtBuf.Reset() + if err := format.Node(&gofmtBuf, fset, n); err != nil { + return "<" + err.Error() + ">" + } + return gofmtBuf.String() +} + +func report(err error) { + scanner.PrintError(os.Stderr, err) + exitCode = 2 +} + +func walkDir(path string) { + filepath.Walk(path, visitFile) +} + +func visitFile(path string, f os.FileInfo, err error) error { + if err == nil && isGoFile(f) { + err = processFile(path, false) + } + if err != nil { + report(err) + } + return nil +} + +func isGoFile(f os.FileInfo) bool { + // ignore non-Go files + name := f.Name() + return !f.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go") +} + +func diff(b1, b2 []byte) (data []byte, err error) { + f1, err := ioutil.TempFile("", "go-fix") + if err != nil { + return nil, err + } + defer os.Remove(f1.Name()) + defer f1.Close() + + f2, err := ioutil.TempFile("", "go-fix") + if err != nil { + return nil, err + } + defer os.Remove(f2.Name()) + defer f2.Close() + + f1.Write(b1) + f2.Write(b2) + + data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput() + if len(data) > 0 { + // diff exits with a non-zero status when the files don't match. + // Ignore that failure as long as we get output. + err = nil + } + return +} diff --git a/vendor/google.golang.org/appengine/cmd/aefix/main_test.go b/vendor/google.golang.org/appengine/cmd/aefix/main_test.go new file mode 100644 index 000000000..2151bf29e --- /dev/null +++ b/vendor/google.golang.org/appengine/cmd/aefix/main_test.go @@ -0,0 +1,129 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "go/ast" + "go/parser" + "strings" + "testing" +) + +type testCase struct { + Name string + Fn func(*ast.File) bool + In string + Out string +} + +var testCases []testCase + +func addTestCases(t []testCase, fn func(*ast.File) bool) { + // Fill in fn to avoid repetition in definitions. + if fn != nil { + for i := range t { + if t[i].Fn == nil { + t[i].Fn = fn + } + } + } + testCases = append(testCases, t...) +} + +func fnop(*ast.File) bool { return false } + +func parseFixPrint(t *testing.T, fn func(*ast.File) bool, desc, in string, mustBeGofmt bool) (out string, fixed, ok bool) { + file, err := parser.ParseFile(fset, desc, in, parserMode) + if err != nil { + t.Errorf("%s: parsing: %v", desc, err) + return + } + + outb, err := gofmtFile(file) + if err != nil { + t.Errorf("%s: printing: %v", desc, err) + return + } + if s := string(outb); in != s && mustBeGofmt { + t.Errorf("%s: not gofmt-formatted.\n--- %s\n%s\n--- %s | gofmt\n%s", + desc, desc, in, desc, s) + tdiff(t, in, s) + return + } + + if fn == nil { + for _, fix := range fixes { + if fix.f(file) { + fixed = true + } + } + } else { + fixed = fn(file) + } + + outb, err = gofmtFile(file) + if err != nil { + t.Errorf("%s: printing: %v", desc, err) + return + } + + return string(outb), fixed, true +} + +func TestRewrite(t *testing.T) { + for _, tt := range testCases { + // Apply fix: should get tt.Out. + out, fixed, ok := parseFixPrint(t, tt.Fn, tt.Name, tt.In, true) + if !ok { + continue + } + + // reformat to get printing right + out, _, ok = parseFixPrint(t, fnop, tt.Name, out, false) + if !ok { + continue + } + + if out != tt.Out { + t.Errorf("%s: incorrect output.\n", tt.Name) + if !strings.HasPrefix(tt.Name, "testdata/") { + t.Errorf("--- have\n%s\n--- want\n%s", out, tt.Out) + } + tdiff(t, out, tt.Out) + continue + } + + if changed := out != tt.In; changed != fixed { + t.Errorf("%s: changed=%v != fixed=%v", tt.Name, changed, fixed) + continue + } + + // Should not change if run again. + out2, fixed2, ok := parseFixPrint(t, tt.Fn, tt.Name+" output", out, true) + if !ok { + continue + } + + if fixed2 { + t.Errorf("%s: applied fixes during second round", tt.Name) + continue + } + + if out2 != out { + t.Errorf("%s: changed output after second round of fixes.\n--- output after first round\n%s\n--- output after second round\n%s", + tt.Name, out, out2) + tdiff(t, out, out2) + } + } +} + +func tdiff(t *testing.T, a, b string) { + data, err := diff([]byte(a), []byte(b)) + if err != nil { + t.Error(err) + return + } + t.Error(string(data)) +} diff --git a/vendor/google.golang.org/appengine/cmd/aefix/typecheck.go b/vendor/google.golang.org/appengine/cmd/aefix/typecheck.go new file mode 100644 index 000000000..d54d37547 --- /dev/null +++ b/vendor/google.golang.org/appengine/cmd/aefix/typecheck.go @@ -0,0 +1,673 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "fmt" + "go/ast" + "go/token" + "os" + "reflect" + "strings" +) + +// Partial type checker. +// +// The fact that it is partial is very important: the input is +// an AST and a description of some type information to +// assume about one or more packages, but not all the +// packages that the program imports. The checker is +// expected to do as much as it can with what it has been +// given. There is not enough information supplied to do +// a full type check, but the type checker is expected to +// apply information that can be derived from variable +// declarations, function and method returns, and type switches +// as far as it can, so that the caller can still tell the types +// of expression relevant to a particular fix. +// +// TODO(rsc,gri): Replace with go/typechecker. +// Doing that could be an interesting test case for go/typechecker: +// the constraints about working with partial information will +// likely exercise it in interesting ways. The ideal interface would +// be to pass typecheck a map from importpath to package API text +// (Go source code), but for now we use data structures (TypeConfig, Type). +// +// The strings mostly use gofmt form. +// +// A Field or FieldList has as its type a comma-separated list +// of the types of the fields. For example, the field list +// x, y, z int +// has type "int, int, int". + +// The prefix "type " is the type of a type. +// For example, given +// var x int +// type T int +// x's type is "int" but T's type is "type int". +// mkType inserts the "type " prefix. +// getType removes it. +// isType tests for it. + +func mkType(t string) string { + return "type " + t +} + +func getType(t string) string { + if !isType(t) { + return "" + } + return t[len("type "):] +} + +func isType(t string) bool { + return strings.HasPrefix(t, "type ") +} + +// TypeConfig describes the universe of relevant types. +// For ease of creation, the types are all referred to by string +// name (e.g., "reflect.Value"). TypeByName is the only place +// where the strings are resolved. + +type TypeConfig struct { + Type map[string]*Type + Var map[string]string + Func map[string]string +} + +// typeof returns the type of the given name, which may be of +// the form "x" or "p.X". +func (cfg *TypeConfig) typeof(name string) string { + if cfg.Var != nil { + if t := cfg.Var[name]; t != "" { + return t + } + } + if cfg.Func != nil { + if t := cfg.Func[name]; t != "" { + return "func()" + t + } + } + return "" +} + +// Type describes the Fields and Methods of a type. +// If the field or method cannot be found there, it is next +// looked for in the Embed list. +type Type struct { + Field map[string]string // map field name to type + Method map[string]string // map method name to comma-separated return types (should start with "func ") + Embed []string // list of types this type embeds (for extra methods) + Def string // definition of named type +} + +// dot returns the type of "typ.name", making its decision +// using the type information in cfg. +func (typ *Type) dot(cfg *TypeConfig, name string) string { + if typ.Field != nil { + if t := typ.Field[name]; t != "" { + return t + } + } + if typ.Method != nil { + if t := typ.Method[name]; t != "" { + return t + } + } + + for _, e := range typ.Embed { + etyp := cfg.Type[e] + if etyp != nil { + if t := etyp.dot(cfg, name); t != "" { + return t + } + } + } + + return "" +} + +// typecheck type checks the AST f assuming the information in cfg. +// It returns two maps with type information: +// typeof maps AST nodes to type information in gofmt string form. +// assign maps type strings to lists of expressions that were assigned +// to values of another type that were assigned to that type. +func typecheck(cfg *TypeConfig, f *ast.File) (typeof map[interface{}]string, assign map[string][]interface{}) { + typeof = make(map[interface{}]string) + assign = make(map[string][]interface{}) + cfg1 := &TypeConfig{} + *cfg1 = *cfg // make copy so we can add locally + copied := false + + // gather function declarations + for _, decl := range f.Decls { + fn, ok := decl.(*ast.FuncDecl) + if !ok { + continue + } + typecheck1(cfg, fn.Type, typeof, assign) + t := typeof[fn.Type] + if fn.Recv != nil { + // The receiver must be a type. + rcvr := typeof[fn.Recv] + if !isType(rcvr) { + if len(fn.Recv.List) != 1 { + continue + } + rcvr = mkType(gofmt(fn.Recv.List[0].Type)) + typeof[fn.Recv.List[0].Type] = rcvr + } + rcvr = getType(rcvr) + if rcvr != "" && rcvr[0] == '*' { + rcvr = rcvr[1:] + } + typeof[rcvr+"."+fn.Name.Name] = t + } else { + if isType(t) { + t = getType(t) + } else { + t = gofmt(fn.Type) + } + typeof[fn.Name] = t + + // Record typeof[fn.Name.Obj] for future references to fn.Name. + typeof[fn.Name.Obj] = t + } + } + + // gather struct declarations + for _, decl := range f.Decls { + d, ok := decl.(*ast.GenDecl) + if ok { + for _, s := range d.Specs { + switch s := s.(type) { + case *ast.TypeSpec: + if cfg1.Type[s.Name.Name] != nil { + break + } + if !copied { + copied = true + // Copy map lazily: it's time. + cfg1.Type = make(map[string]*Type) + for k, v := range cfg.Type { + cfg1.Type[k] = v + } + } + t := &Type{Field: map[string]string{}} + cfg1.Type[s.Name.Name] = t + switch st := s.Type.(type) { + case *ast.StructType: + for _, f := range st.Fields.List { + for _, n := range f.Names { + t.Field[n.Name] = gofmt(f.Type) + } + } + case *ast.ArrayType, *ast.StarExpr, *ast.MapType: + t.Def = gofmt(st) + } + } + } + } + } + + typecheck1(cfg1, f, typeof, assign) + return typeof, assign +} + +func makeExprList(a []*ast.Ident) []ast.Expr { + var b []ast.Expr + for _, x := range a { + b = append(b, x) + } + return b +} + +// Typecheck1 is the recursive form of typecheck. +// It is like typecheck but adds to the information in typeof +// instead of allocating a new map. +func typecheck1(cfg *TypeConfig, f interface{}, typeof map[interface{}]string, assign map[string][]interface{}) { + // set sets the type of n to typ. + // If isDecl is true, n is being declared. + set := func(n ast.Expr, typ string, isDecl bool) { + if typeof[n] != "" || typ == "" { + if typeof[n] != typ { + assign[typ] = append(assign[typ], n) + } + return + } + typeof[n] = typ + + // If we obtained typ from the declaration of x + // propagate the type to all the uses. + // The !isDecl case is a cheat here, but it makes + // up in some cases for not paying attention to + // struct fields. The real type checker will be + // more accurate so we won't need the cheat. + if id, ok := n.(*ast.Ident); ok && id.Obj != nil && (isDecl || typeof[id.Obj] == "") { + typeof[id.Obj] = typ + } + } + + // Type-check an assignment lhs = rhs. + // If isDecl is true, this is := so we can update + // the types of the objects that lhs refers to. + typecheckAssign := func(lhs, rhs []ast.Expr, isDecl bool) { + if len(lhs) > 1 && len(rhs) == 1 { + if _, ok := rhs[0].(*ast.CallExpr); ok { + t := split(typeof[rhs[0]]) + // Lists should have same length but may not; pair what can be paired. + for i := 0; i < len(lhs) && i < len(t); i++ { + set(lhs[i], t[i], isDecl) + } + return + } + } + if len(lhs) == 1 && len(rhs) == 2 { + // x = y, ok + rhs = rhs[:1] + } else if len(lhs) == 2 && len(rhs) == 1 { + // x, ok = y + lhs = lhs[:1] + } + + // Match as much as we can. + for i := 0; i < len(lhs) && i < len(rhs); i++ { + x, y := lhs[i], rhs[i] + if typeof[y] != "" { + set(x, typeof[y], isDecl) + } else { + set(y, typeof[x], false) + } + } + } + + expand := func(s string) string { + typ := cfg.Type[s] + if typ != nil && typ.Def != "" { + return typ.Def + } + return s + } + + // The main type check is a recursive algorithm implemented + // by walkBeforeAfter(n, before, after). + // Most of it is bottom-up, but in a few places we need + // to know the type of the function we are checking. + // The before function records that information on + // the curfn stack. + var curfn []*ast.FuncType + + before := func(n interface{}) { + // push function type on stack + switch n := n.(type) { + case *ast.FuncDecl: + curfn = append(curfn, n.Type) + case *ast.FuncLit: + curfn = append(curfn, n.Type) + } + } + + // After is the real type checker. + after := func(n interface{}) { + if n == nil { + return + } + if false && reflect.TypeOf(n).Kind() == reflect.Ptr { // debugging trace + defer func() { + if t := typeof[n]; t != "" { + pos := fset.Position(n.(ast.Node).Pos()) + fmt.Fprintf(os.Stderr, "%s: typeof[%s] = %s\n", pos, gofmt(n), t) + } + }() + } + + switch n := n.(type) { + case *ast.FuncDecl, *ast.FuncLit: + // pop function type off stack + curfn = curfn[:len(curfn)-1] + + case *ast.FuncType: + typeof[n] = mkType(joinFunc(split(typeof[n.Params]), split(typeof[n.Results]))) + + case *ast.FieldList: + // Field list is concatenation of sub-lists. + t := "" + for _, field := range n.List { + if t != "" { + t += ", " + } + t += typeof[field] + } + typeof[n] = t + + case *ast.Field: + // Field is one instance of the type per name. + all := "" + t := typeof[n.Type] + if !isType(t) { + // Create a type, because it is typically *T or *p.T + // and we might care about that type. + t = mkType(gofmt(n.Type)) + typeof[n.Type] = t + } + t = getType(t) + if len(n.Names) == 0 { + all = t + } else { + for _, id := range n.Names { + if all != "" { + all += ", " + } + all += t + typeof[id.Obj] = t + typeof[id] = t + } + } + typeof[n] = all + + case *ast.ValueSpec: + // var declaration. Use type if present. + if n.Type != nil { + t := typeof[n.Type] + if !isType(t) { + t = mkType(gofmt(n.Type)) + typeof[n.Type] = t + } + t = getType(t) + for _, id := range n.Names { + set(id, t, true) + } + } + // Now treat same as assignment. + typecheckAssign(makeExprList(n.Names), n.Values, true) + + case *ast.AssignStmt: + typecheckAssign(n.Lhs, n.Rhs, n.Tok == token.DEFINE) + + case *ast.Ident: + // Identifier can take its type from underlying object. + if t := typeof[n.Obj]; t != "" { + typeof[n] = t + } + + case *ast.SelectorExpr: + // Field or method. + name := n.Sel.Name + if t := typeof[n.X]; t != "" { + if strings.HasPrefix(t, "*") { + t = t[1:] // implicit * + } + if typ := cfg.Type[t]; typ != nil { + if t := typ.dot(cfg, name); t != "" { + typeof[n] = t + return + } + } + tt := typeof[t+"."+name] + if isType(tt) { + typeof[n] = getType(tt) + return + } + } + // Package selector. + if x, ok := n.X.(*ast.Ident); ok && x.Obj == nil { + str := x.Name + "." + name + if cfg.Type[str] != nil { + typeof[n] = mkType(str) + return + } + if t := cfg.typeof(x.Name + "." + name); t != "" { + typeof[n] = t + return + } + } + + case *ast.CallExpr: + // make(T) has type T. + if isTopName(n.Fun, "make") && len(n.Args) >= 1 { + typeof[n] = gofmt(n.Args[0]) + return + } + // new(T) has type *T + if isTopName(n.Fun, "new") && len(n.Args) == 1 { + typeof[n] = "*" + gofmt(n.Args[0]) + return + } + // Otherwise, use type of function to determine arguments. + t := typeof[n.Fun] + in, out := splitFunc(t) + if in == nil && out == nil { + return + } + typeof[n] = join(out) + for i, arg := range n.Args { + if i >= len(in) { + break + } + if typeof[arg] == "" { + typeof[arg] = in[i] + } + } + + case *ast.TypeAssertExpr: + // x.(type) has type of x. + if n.Type == nil { + typeof[n] = typeof[n.X] + return + } + // x.(T) has type T. + if t := typeof[n.Type]; isType(t) { + typeof[n] = getType(t) + } else { + typeof[n] = gofmt(n.Type) + } + + case *ast.SliceExpr: + // x[i:j] has type of x. + typeof[n] = typeof[n.X] + + case *ast.IndexExpr: + // x[i] has key type of x's type. + t := expand(typeof[n.X]) + if strings.HasPrefix(t, "[") || strings.HasPrefix(t, "map[") { + // Lazy: assume there are no nested [] in the array + // length or map key type. + if i := strings.Index(t, "]"); i >= 0 { + typeof[n] = t[i+1:] + } + } + + case *ast.StarExpr: + // *x for x of type *T has type T when x is an expr. + // We don't use the result when *x is a type, but + // compute it anyway. + t := expand(typeof[n.X]) + if isType(t) { + typeof[n] = "type *" + getType(t) + } else if strings.HasPrefix(t, "*") { + typeof[n] = t[len("*"):] + } + + case *ast.UnaryExpr: + // &x for x of type T has type *T. + t := typeof[n.X] + if t != "" && n.Op == token.AND { + typeof[n] = "*" + t + } + + case *ast.CompositeLit: + // T{...} has type T. + typeof[n] = gofmt(n.Type) + + case *ast.ParenExpr: + // (x) has type of x. + typeof[n] = typeof[n.X] + + case *ast.RangeStmt: + t := expand(typeof[n.X]) + if t == "" { + return + } + var key, value string + if t == "string" { + key, value = "int", "rune" + } else if strings.HasPrefix(t, "[") { + key = "int" + if i := strings.Index(t, "]"); i >= 0 { + value = t[i+1:] + } + } else if strings.HasPrefix(t, "map[") { + if i := strings.Index(t, "]"); i >= 0 { + key, value = t[4:i], t[i+1:] + } + } + changed := false + if n.Key != nil && key != "" { + changed = true + set(n.Key, key, n.Tok == token.DEFINE) + } + if n.Value != nil && value != "" { + changed = true + set(n.Value, value, n.Tok == token.DEFINE) + } + // Ugly failure of vision: already type-checked body. + // Do it again now that we have that type info. + if changed { + typecheck1(cfg, n.Body, typeof, assign) + } + + case *ast.TypeSwitchStmt: + // Type of variable changes for each case in type switch, + // but go/parser generates just one variable. + // Repeat type check for each case with more precise + // type information. + as, ok := n.Assign.(*ast.AssignStmt) + if !ok { + return + } + varx, ok := as.Lhs[0].(*ast.Ident) + if !ok { + return + } + t := typeof[varx] + for _, cas := range n.Body.List { + cas := cas.(*ast.CaseClause) + if len(cas.List) == 1 { + // Variable has specific type only when there is + // exactly one type in the case list. + if tt := typeof[cas.List[0]]; isType(tt) { + tt = getType(tt) + typeof[varx] = tt + typeof[varx.Obj] = tt + typecheck1(cfg, cas.Body, typeof, assign) + } + } + } + // Restore t. + typeof[varx] = t + typeof[varx.Obj] = t + + case *ast.ReturnStmt: + if len(curfn) == 0 { + // Probably can't happen. + return + } + f := curfn[len(curfn)-1] + res := n.Results + if f.Results != nil { + t := split(typeof[f.Results]) + for i := 0; i < len(res) && i < len(t); i++ { + set(res[i], t[i], false) + } + } + } + } + walkBeforeAfter(f, before, after) +} + +// Convert between function type strings and lists of types. +// Using strings makes this a little harder, but it makes +// a lot of the rest of the code easier. This will all go away +// when we can use go/typechecker directly. + +// splitFunc splits "func(x,y,z) (a,b,c)" into ["x", "y", "z"] and ["a", "b", "c"]. +func splitFunc(s string) (in, out []string) { + if !strings.HasPrefix(s, "func(") { + return nil, nil + } + + i := len("func(") // index of beginning of 'in' arguments + nparen := 0 + for j := i; j < len(s); j++ { + switch s[j] { + case '(': + nparen++ + case ')': + nparen-- + if nparen < 0 { + // found end of parameter list + out := strings.TrimSpace(s[j+1:]) + if len(out) >= 2 && out[0] == '(' && out[len(out)-1] == ')' { + out = out[1 : len(out)-1] + } + return split(s[i:j]), split(out) + } + } + } + return nil, nil +} + +// joinFunc is the inverse of splitFunc. +func joinFunc(in, out []string) string { + outs := "" + if len(out) == 1 { + outs = " " + out[0] + } else if len(out) > 1 { + outs = " (" + join(out) + ")" + } + return "func(" + join(in) + ")" + outs +} + +// split splits "int, float" into ["int", "float"] and splits "" into []. +func split(s string) []string { + out := []string{} + i := 0 // current type being scanned is s[i:j]. + nparen := 0 + for j := 0; j < len(s); j++ { + switch s[j] { + case ' ': + if i == j { + i++ + } + case '(': + nparen++ + case ')': + nparen-- + if nparen < 0 { + // probably can't happen + return nil + } + case ',': + if nparen == 0 { + if i < j { + out = append(out, s[i:j]) + } + i = j + 1 + } + } + } + if nparen != 0 { + // probably can't happen + return nil + } + if i < len(s) { + out = append(out, s[i:]) + } + return out +} + +// join is the inverse of split. +func join(x []string) string { + return strings.Join(x, ", ") +} diff --git a/vendor/google.golang.org/appengine/datastore/datastore.go b/vendor/google.golang.org/appengine/datastore/datastore.go new file mode 100644 index 000000000..576bc5013 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/datastore.go @@ -0,0 +1,407 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "errors" + "fmt" + "reflect" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/datastore" +) + +var ( + // ErrInvalidEntityType is returned when functions like Get or Next are + // passed a dst or src argument of invalid type. + ErrInvalidEntityType = errors.New("datastore: invalid entity type") + // ErrInvalidKey is returned when an invalid key is presented. + ErrInvalidKey = errors.New("datastore: invalid key") + // ErrNoSuchEntity is returned when no entity was found for a given key. + ErrNoSuchEntity = errors.New("datastore: no such entity") +) + +// ErrFieldMismatch is returned when a field is to be loaded into a different +// type than the one it was stored from, or when a field is missing or +// unexported in the destination struct. +// StructType is the type of the struct pointed to by the destination argument +// passed to Get or to Iterator.Next. +type ErrFieldMismatch struct { + StructType reflect.Type + FieldName string + Reason string +} + +func (e *ErrFieldMismatch) Error() string { + return fmt.Sprintf("datastore: cannot load field %q into a %q: %s", + e.FieldName, e.StructType, e.Reason) +} + +// protoToKey converts a Reference proto to a *Key. If the key is invalid, +// protoToKey will return the invalid key along with ErrInvalidKey. +func protoToKey(r *pb.Reference) (k *Key, err error) { + appID := r.GetApp() + namespace := r.GetNameSpace() + for _, e := range r.Path.Element { + k = &Key{ + kind: e.GetType(), + stringID: e.GetName(), + intID: e.GetId(), + parent: k, + appID: appID, + namespace: namespace, + } + if !k.valid() { + return k, ErrInvalidKey + } + } + return +} + +// keyToProto converts a *Key to a Reference proto. +func keyToProto(defaultAppID string, k *Key) *pb.Reference { + appID := k.appID + if appID == "" { + appID = defaultAppID + } + n := 0 + for i := k; i != nil; i = i.parent { + n++ + } + e := make([]*pb.Path_Element, n) + for i := k; i != nil; i = i.parent { + n-- + e[n] = &pb.Path_Element{ + Type: &i.kind, + } + // At most one of {Name,Id} should be set. + // Neither will be set for incomplete keys. + if i.stringID != "" { + e[n].Name = &i.stringID + } else if i.intID != 0 { + e[n].Id = &i.intID + } + } + var namespace *string + if k.namespace != "" { + namespace = proto.String(k.namespace) + } + return &pb.Reference{ + App: proto.String(appID), + NameSpace: namespace, + Path: &pb.Path{ + Element: e, + }, + } +} + +// multiKeyToProto is a batch version of keyToProto. +func multiKeyToProto(appID string, key []*Key) []*pb.Reference { + ret := make([]*pb.Reference, len(key)) + for i, k := range key { + ret[i] = keyToProto(appID, k) + } + return ret +} + +// multiValid is a batch version of Key.valid. It returns an error, not a +// []bool. +func multiValid(key []*Key) error { + invalid := false + for _, k := range key { + if !k.valid() { + invalid = true + break + } + } + if !invalid { + return nil + } + err := make(appengine.MultiError, len(key)) + for i, k := range key { + if !k.valid() { + err[i] = ErrInvalidKey + } + } + return err +} + +// It's unfortunate that the two semantically equivalent concepts pb.Reference +// and pb.PropertyValue_ReferenceValue aren't the same type. For example, the +// two have different protobuf field numbers. + +// referenceValueToKey is the same as protoToKey except the input is a +// PropertyValue_ReferenceValue instead of a Reference. +func referenceValueToKey(r *pb.PropertyValue_ReferenceValue) (k *Key, err error) { + appID := r.GetApp() + namespace := r.GetNameSpace() + for _, e := range r.Pathelement { + k = &Key{ + kind: e.GetType(), + stringID: e.GetName(), + intID: e.GetId(), + parent: k, + appID: appID, + namespace: namespace, + } + if !k.valid() { + return nil, ErrInvalidKey + } + } + return +} + +// keyToReferenceValue is the same as keyToProto except the output is a +// PropertyValue_ReferenceValue instead of a Reference. +func keyToReferenceValue(defaultAppID string, k *Key) *pb.PropertyValue_ReferenceValue { + ref := keyToProto(defaultAppID, k) + pe := make([]*pb.PropertyValue_ReferenceValue_PathElement, len(ref.Path.Element)) + for i, e := range ref.Path.Element { + pe[i] = &pb.PropertyValue_ReferenceValue_PathElement{ + Type: e.Type, + Id: e.Id, + Name: e.Name, + } + } + return &pb.PropertyValue_ReferenceValue{ + App: ref.App, + NameSpace: ref.NameSpace, + Pathelement: pe, + } +} + +type multiArgType int + +const ( + multiArgTypeInvalid multiArgType = iota + multiArgTypePropertyLoadSaver + multiArgTypeStruct + multiArgTypeStructPtr + multiArgTypeInterface +) + +// checkMultiArg checks that v has type []S, []*S, []I, or []P, for some struct +// type S, for some interface type I, or some non-interface non-pointer type P +// such that P or *P implements PropertyLoadSaver. +// +// It returns what category the slice's elements are, and the reflect.Type +// that represents S, I or P. +// +// As a special case, PropertyList is an invalid type for v. +func checkMultiArg(v reflect.Value) (m multiArgType, elemType reflect.Type) { + if v.Kind() != reflect.Slice { + return multiArgTypeInvalid, nil + } + if v.Type() == typeOfPropertyList { + return multiArgTypeInvalid, nil + } + elemType = v.Type().Elem() + if reflect.PtrTo(elemType).Implements(typeOfPropertyLoadSaver) { + return multiArgTypePropertyLoadSaver, elemType + } + switch elemType.Kind() { + case reflect.Struct: + return multiArgTypeStruct, elemType + case reflect.Interface: + return multiArgTypeInterface, elemType + case reflect.Ptr: + elemType = elemType.Elem() + if elemType.Kind() == reflect.Struct { + return multiArgTypeStructPtr, elemType + } + } + return multiArgTypeInvalid, nil +} + +// Get loads the entity stored for k into dst, which must be a struct pointer +// or implement PropertyLoadSaver. If there is no such entity for the key, Get +// returns ErrNoSuchEntity. +// +// The values of dst's unmatched struct fields are not modified, and matching +// slice-typed fields are not reset before appending to them. In particular, it +// is recommended to pass a pointer to a zero valued struct on each Get call. +// +// ErrFieldMismatch is returned when a field is to be loaded into a different +// type than the one it was stored from, or when a field is missing or +// unexported in the destination struct. ErrFieldMismatch is only returned if +// dst is a struct pointer. +func Get(c context.Context, key *Key, dst interface{}) error { + if dst == nil { // GetMulti catches nil interface; we need to catch nil ptr here + return ErrInvalidEntityType + } + err := GetMulti(c, []*Key{key}, []interface{}{dst}) + if me, ok := err.(appengine.MultiError); ok { + return me[0] + } + return err +} + +// GetMulti is a batch version of Get. +// +// dst must be a []S, []*S, []I or []P, for some struct type S, some interface +// type I, or some non-interface non-pointer type P such that P or *P +// implements PropertyLoadSaver. If an []I, each element must be a valid dst +// for Get: it must be a struct pointer or implement PropertyLoadSaver. +// +// As a special case, PropertyList is an invalid type for dst, even though a +// PropertyList is a slice of structs. It is treated as invalid to avoid being +// mistakenly passed when []PropertyList was intended. +func GetMulti(c context.Context, key []*Key, dst interface{}) error { + v := reflect.ValueOf(dst) + multiArgType, _ := checkMultiArg(v) + if multiArgType == multiArgTypeInvalid { + return errors.New("datastore: dst has invalid type") + } + if len(key) != v.Len() { + return errors.New("datastore: key and dst slices have different length") + } + if len(key) == 0 { + return nil + } + if err := multiValid(key); err != nil { + return err + } + req := &pb.GetRequest{ + Key: multiKeyToProto(internal.FullyQualifiedAppID(c), key), + } + res := &pb.GetResponse{} + if err := internal.Call(c, "datastore_v3", "Get", req, res); err != nil { + return err + } + if len(key) != len(res.Entity) { + return errors.New("datastore: internal error: server returned the wrong number of entities") + } + multiErr, any := make(appengine.MultiError, len(key)), false + for i, e := range res.Entity { + if e.Entity == nil { + multiErr[i] = ErrNoSuchEntity + } else { + elem := v.Index(i) + if multiArgType == multiArgTypePropertyLoadSaver || multiArgType == multiArgTypeStruct { + elem = elem.Addr() + } + if multiArgType == multiArgTypeStructPtr && elem.IsNil() { + elem.Set(reflect.New(elem.Type().Elem())) + } + multiErr[i] = loadEntity(elem.Interface(), e.Entity) + } + if multiErr[i] != nil { + any = true + } + } + if any { + return multiErr + } + return nil +} + +// Put saves the entity src into the datastore with key k. src must be a struct +// pointer or implement PropertyLoadSaver; if a struct pointer then any +// unexported fields of that struct will be skipped. If k is an incomplete key, +// the returned key will be a unique key generated by the datastore. +func Put(c context.Context, key *Key, src interface{}) (*Key, error) { + k, err := PutMulti(c, []*Key{key}, []interface{}{src}) + if err != nil { + if me, ok := err.(appengine.MultiError); ok { + return nil, me[0] + } + return nil, err + } + return k[0], nil +} + +// PutMulti is a batch version of Put. +// +// src must satisfy the same conditions as the dst argument to GetMulti. +func PutMulti(c context.Context, key []*Key, src interface{}) ([]*Key, error) { + v := reflect.ValueOf(src) + multiArgType, _ := checkMultiArg(v) + if multiArgType == multiArgTypeInvalid { + return nil, errors.New("datastore: src has invalid type") + } + if len(key) != v.Len() { + return nil, errors.New("datastore: key and src slices have different length") + } + if len(key) == 0 { + return nil, nil + } + appID := internal.FullyQualifiedAppID(c) + if err := multiValid(key); err != nil { + return nil, err + } + req := &pb.PutRequest{} + for i := range key { + elem := v.Index(i) + if multiArgType == multiArgTypePropertyLoadSaver || multiArgType == multiArgTypeStruct { + elem = elem.Addr() + } + sProto, err := saveEntity(appID, key[i], elem.Interface()) + if err != nil { + return nil, err + } + req.Entity = append(req.Entity, sProto) + } + res := &pb.PutResponse{} + if err := internal.Call(c, "datastore_v3", "Put", req, res); err != nil { + return nil, err + } + if len(key) != len(res.Key) { + return nil, errors.New("datastore: internal error: server returned the wrong number of keys") + } + ret := make([]*Key, len(key)) + for i := range ret { + var err error + ret[i], err = protoToKey(res.Key[i]) + if err != nil || ret[i].Incomplete() { + return nil, errors.New("datastore: internal error: server returned an invalid key") + } + } + return ret, nil +} + +// Delete deletes the entity for the given key. +func Delete(c context.Context, key *Key) error { + err := DeleteMulti(c, []*Key{key}) + if me, ok := err.(appengine.MultiError); ok { + return me[0] + } + return err +} + +// DeleteMulti is a batch version of Delete. +func DeleteMulti(c context.Context, key []*Key) error { + if len(key) == 0 { + return nil + } + if err := multiValid(key); err != nil { + return err + } + req := &pb.DeleteRequest{ + Key: multiKeyToProto(internal.FullyQualifiedAppID(c), key), + } + res := &pb.DeleteResponse{} + return internal.Call(c, "datastore_v3", "Delete", req, res) +} + +func namespaceMod(m proto.Message, namespace string) { + // pb.Query is the only type that has a name_space field. + // All other namespace support in datastore is in the keys. + switch m := m.(type) { + case *pb.Query: + if m.NameSpace == nil { + m.NameSpace = &namespace + } + } +} + +func init() { + internal.NamespaceMods["datastore_v3"] = namespaceMod + internal.RegisterErrorCodeMap("datastore_v3", pb.Error_ErrorCode_name) + internal.RegisterTimeoutErrorCode("datastore_v3", int32(pb.Error_TIMEOUT)) +} diff --git a/vendor/google.golang.org/appengine/datastore/datastore_test.go b/vendor/google.golang.org/appengine/datastore/datastore_test.go new file mode 100644 index 000000000..683cd15f3 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/datastore_test.go @@ -0,0 +1,1750 @@ +// Copyright 2011 Google Inc. All Rights Reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "encoding/json" + "errors" + "fmt" + "os" + "reflect" + "sort" + "strings" + "testing" + "time" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal/aetesting" + pb "google.golang.org/appengine/internal/datastore" +) + +const testAppID = "testApp" + +type ( + myBlob []byte + myByte byte + myString string +) + +func makeMyByteSlice(n int) []myByte { + b := make([]myByte, n) + for i := range b { + b[i] = myByte(i) + } + return b +} + +func makeInt8Slice(n int) []int8 { + b := make([]int8, n) + for i := range b { + b[i] = int8(i) + } + return b +} + +func makeUint8Slice(n int) []uint8 { + b := make([]uint8, n) + for i := range b { + b[i] = uint8(i) + } + return b +} + +func newKey(stringID string, parent *Key) *Key { + return &Key{ + kind: "kind", + stringID: stringID, + intID: 0, + parent: parent, + appID: testAppID, + } +} + +var ( + testKey0 = newKey("name0", nil) + testKey1a = newKey("name1", nil) + testKey1b = newKey("name1", nil) + testKey2a = newKey("name2", testKey0) + testKey2b = newKey("name2", testKey0) + testGeoPt0 = appengine.GeoPoint{Lat: 1.2, Lng: 3.4} + testGeoPt1 = appengine.GeoPoint{Lat: 5, Lng: 10} + testBadGeoPt = appengine.GeoPoint{Lat: 1000, Lng: 34} + + now = time.Unix(1e9, 0).UTC() +) + +type B0 struct { + B []byte +} + +type B1 struct { + B []int8 +} + +type B2 struct { + B myBlob +} + +type B3 struct { + B []myByte +} + +type B4 struct { + B [][]byte +} + +type B5 struct { + B ByteString +} + +type C0 struct { + I int + C chan int +} + +type C1 struct { + I int + C *chan int +} + +type C2 struct { + I int + C []chan int +} + +type C3 struct { + C string +} + +type E struct{} + +type G0 struct { + G appengine.GeoPoint +} + +type G1 struct { + G []appengine.GeoPoint +} + +type K0 struct { + K *Key +} + +type K1 struct { + K []*Key +} + +type S struct { + St string +} + +type NoOmit struct { + A string + B int `datastore:"Bb"` + C bool `datastore:",noindex"` +} + +type OmitAll struct { + A string `datastore:",omitempty"` + B int `datastore:"Bb,omitempty"` + C bool `datastore:",omitempty,noindex"` + D time.Time `datastore:",omitempty"` + F []int `datastore:",omitempty"` +} + +type Omit struct { + A string `datastore:",omitempty"` + B int `datastore:"Bb,omitempty"` + C bool `datastore:",omitempty,noindex"` + D time.Time `datastore:",omitempty"` + F []int `datastore:",omitempty"` + S `datastore:",omitempty"` +} + +type NoOmits struct { + No []NoOmit `datastore:",omitempty"` + S `datastore:",omitempty"` + Ss S `datastore:",omitempty"` +} + +type N0 struct { + X0 + Nonymous X0 + Ignore string `datastore:"-"` + Other string +} + +type N1 struct { + X0 + Nonymous []X0 + Ignore string `datastore:"-"` + Other string +} + +type N2 struct { + N1 `datastore:"red"` + Green N1 `datastore:"green"` + Blue N1 + White N1 `datastore:"-"` +} + +type O0 struct { + I int64 +} + +type O1 struct { + I int32 +} + +type U0 struct { + U uint +} + +type U1 struct { + U string +} + +type T struct { + T time.Time +} + +type X0 struct { + S string + I int + i int +} + +type X1 struct { + S myString + I int32 + J int64 +} + +type X2 struct { + Z string + i int +} + +type X3 struct { + S bool + I int +} + +type Y0 struct { + B bool + F []float64 + G []float64 +} + +type Y1 struct { + B bool + F float64 +} + +type Y2 struct { + B bool + F []int64 +} + +type Tagged struct { + A int `datastore:"a,noindex"` + B []int `datastore:"b"` + C int `datastore:",noindex"` + D int `datastore:""` + E int + // The "flatten" option is parsed but ignored for now. + F int `datastore:",noindex,flatten"` + G int `datastore:",flatten"` + I int `datastore:"-"` + J int `datastore:",noindex" json:"j"` + + Y0 `datastore:"-"` + Z chan int `datastore:"-,"` +} + +type InvalidTagged1 struct { + I int `datastore:"\t"` +} + +type InvalidTagged2 struct { + I int + J int `datastore:"I"` +} + +type Inner1 struct { + W int32 + X string +} + +type Inner2 struct { + Y float64 +} + +type Inner3 struct { + Z bool +} + +type Outer struct { + A int16 + I []Inner1 + J Inner2 + Inner3 +} + +type OuterEquivalent struct { + A int16 + IDotW []int32 `datastore:"I.W"` + IDotX []string `datastore:"I.X"` + JDotY float64 `datastore:"J.Y"` + Z bool +} + +type Dotted struct { + A DottedA `datastore:"A0.A1.A2"` +} + +type DottedA struct { + B DottedB `datastore:"B3"` +} + +type DottedB struct { + C int `datastore:"C4.C5"` +} + +type SliceOfSlices struct { + I int + S []struct { + J int + F []float64 + } +} + +type Recursive struct { + I int + R []Recursive +} + +type MutuallyRecursive0 struct { + I int + R []MutuallyRecursive1 +} + +type MutuallyRecursive1 struct { + I int + R []MutuallyRecursive0 +} + +type Doubler struct { + S string + I int64 + B bool +} + +type Repeat struct { + Key string + Value []byte +} + +type Repeated struct { + Repeats []Repeat +} + +func (d *Doubler) Load(props []Property) error { + return LoadStruct(d, props) +} + +type EmbeddedTime struct { + time.Time +} + +type SpecialTime struct { + MyTime EmbeddedTime +} + +func (d *Doubler) Save() ([]Property, error) { + // Save the default Property slice to an in-memory buffer (a PropertyList). + props, err := SaveStruct(d) + if err != nil { + return nil, err + } + var list PropertyList + if err := list.Load(props); err != nil { + return nil, err + } + + // Edit that PropertyList, and send it on. + for i := range list { + switch v := list[i].Value.(type) { + case string: + // + means string concatenation. + list[i].Value = v + v + case int64: + // + means integer addition. + list[i].Value = v + v + } + } + return list.Save() +} + +var _ PropertyLoadSaver = (*Doubler)(nil) + +type Deriver struct { + S, Derived, Ignored string +} + +func (e *Deriver) Load(props []Property) error { + for _, p := range props { + if p.Name != "S" { + continue + } + e.S = p.Value.(string) + e.Derived = "derived+" + e.S + } + return nil +} + +func (e *Deriver) Save() ([]Property, error) { + return []Property{ + { + Name: "S", + Value: e.S, + }, + }, nil +} + +var _ PropertyLoadSaver = (*Deriver)(nil) + +type BadMultiPropEntity struct{} + +func (e *BadMultiPropEntity) Load(props []Property) error { + return errors.New("unimplemented") +} + +func (e *BadMultiPropEntity) Save() ([]Property, error) { + // Write multiple properties with the same name "I", but Multiple is false. + var props []Property + for i := 0; i < 3; i++ { + props = append(props, Property{ + Name: "I", + Value: int64(i), + }) + } + return props, nil +} + +var _ PropertyLoadSaver = (*BadMultiPropEntity)(nil) + +type BK struct { + Key appengine.BlobKey +} + +type testCase struct { + desc string + src interface{} + want interface{} + putErr string + getErr string +} + +var testCases = []testCase{ + { + "chan save fails", + &C0{I: -1}, + &E{}, + "unsupported struct field", + "", + }, + { + "*chan save fails", + &C1{I: -1}, + &E{}, + "unsupported struct field", + "", + }, + { + "[]chan save fails", + &C2{I: -1, C: make([]chan int, 8)}, + &E{}, + "unsupported struct field", + "", + }, + { + "chan load fails", + &C3{C: "not a chan"}, + &C0{}, + "", + "type mismatch", + }, + { + "*chan load fails", + &C3{C: "not a *chan"}, + &C1{}, + "", + "type mismatch", + }, + { + "[]chan load fails", + &C3{C: "not a []chan"}, + &C2{}, + "", + "type mismatch", + }, + { + "empty struct", + &E{}, + &E{}, + "", + "", + }, + { + "geopoint", + &G0{G: testGeoPt0}, + &G0{G: testGeoPt0}, + "", + "", + }, + { + "geopoint invalid", + &G0{G: testBadGeoPt}, + &G0{}, + "invalid GeoPoint value", + "", + }, + { + "geopoint as props", + &G0{G: testGeoPt0}, + &PropertyList{ + Property{Name: "G", Value: testGeoPt0, NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "geopoint slice", + &G1{G: []appengine.GeoPoint{testGeoPt0, testGeoPt1}}, + &G1{G: []appengine.GeoPoint{testGeoPt0, testGeoPt1}}, + "", + "", + }, + { + "omit empty, all", + &OmitAll{}, + new(PropertyList), + "", + "", + }, + { + "omit empty", + &Omit{}, + &PropertyList{ + Property{Name: "St", Value: "", NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "omit empty, fields populated", + &Omit{ + A: "a", + B: 10, + C: true, + D: now, + F: []int{11}, + }, + &PropertyList{ + Property{Name: "A", Value: "a", NoIndex: false, Multiple: false}, + Property{Name: "Bb", Value: int64(10), NoIndex: false, Multiple: false}, + Property{Name: "C", Value: true, NoIndex: true, Multiple: false}, + Property{Name: "D", Value: now, NoIndex: false, Multiple: false}, + Property{Name: "F", Value: int64(11), NoIndex: false, Multiple: true}, + Property{Name: "St", Value: "", NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "omit empty, fields populated", + &Omit{ + A: "a", + B: 10, + C: true, + D: now, + F: []int{11}, + S: S{St: "string"}, + }, + &PropertyList{ + Property{Name: "A", Value: "a", NoIndex: false, Multiple: false}, + Property{Name: "Bb", Value: int64(10), NoIndex: false, Multiple: false}, + Property{Name: "C", Value: true, NoIndex: true, Multiple: false}, + Property{Name: "D", Value: now, NoIndex: false, Multiple: false}, + Property{Name: "F", Value: int64(11), NoIndex: false, Multiple: true}, + Property{Name: "St", Value: "string", NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "omit empty does not propagate", + &NoOmits{ + No: []NoOmit{ + NoOmit{}, + }, + S: S{}, + Ss: S{}, + }, + &PropertyList{ + Property{Name: "No.A", Value: "", NoIndex: false, Multiple: true}, + Property{Name: "No.Bb", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "No.C", Value: false, NoIndex: true, Multiple: true}, + Property{Name: "Ss.St", Value: "", NoIndex: false, Multiple: false}, + Property{Name: "St", Value: "", NoIndex: false, Multiple: false}}, + "", + "", + }, + { + "key", + &K0{K: testKey1a}, + &K0{K: testKey1b}, + "", + "", + }, + { + "key with parent", + &K0{K: testKey2a}, + &K0{K: testKey2b}, + "", + "", + }, + { + "nil key", + &K0{}, + &K0{}, + "", + "", + }, + { + "all nil keys in slice", + &K1{[]*Key{nil, nil}}, + &K1{[]*Key{nil, nil}}, + "", + "", + }, + { + "some nil keys in slice", + &K1{[]*Key{testKey1a, nil, testKey2a}}, + &K1{[]*Key{testKey1b, nil, testKey2b}}, + "", + "", + }, + { + "overflow", + &O0{I: 1 << 48}, + &O1{}, + "", + "overflow", + }, + { + "time", + &T{T: time.Unix(1e9, 0)}, + &T{T: time.Unix(1e9, 0)}, + "", + "", + }, + { + "time as props", + &T{T: time.Unix(1e9, 0)}, + &PropertyList{ + Property{Name: "T", Value: time.Unix(1e9, 0).UTC(), NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "uint save", + &U0{U: 1}, + &U0{}, + "unsupported struct field", + "", + }, + { + "uint load", + &U1{U: "not a uint"}, + &U0{}, + "", + "type mismatch", + }, + { + "zero", + &X0{}, + &X0{}, + "", + "", + }, + { + "basic", + &X0{S: "one", I: 2, i: 3}, + &X0{S: "one", I: 2}, + "", + "", + }, + { + "save string/int load myString/int32", + &X0{S: "one", I: 2, i: 3}, + &X1{S: "one", I: 2}, + "", + "", + }, + { + "missing fields", + &X0{S: "one", I: 2, i: 3}, + &X2{}, + "", + "no such struct field", + }, + { + "save string load bool", + &X0{S: "one", I: 2, i: 3}, + &X3{I: 2}, + "", + "type mismatch", + }, + { + "basic slice", + &Y0{B: true, F: []float64{7, 8, 9}}, + &Y0{B: true, F: []float64{7, 8, 9}}, + "", + "", + }, + { + "save []float64 load float64", + &Y0{B: true, F: []float64{7, 8, 9}}, + &Y1{B: true}, + "", + "requires a slice", + }, + { + "save []float64 load []int64", + &Y0{B: true, F: []float64{7, 8, 9}}, + &Y2{B: true}, + "", + "type mismatch", + }, + { + "single slice is too long", + &Y0{F: make([]float64, maxIndexedProperties+1)}, + &Y0{}, + "too many indexed properties", + "", + }, + { + "two slices are too long", + &Y0{F: make([]float64, maxIndexedProperties), G: make([]float64, maxIndexedProperties)}, + &Y0{}, + "too many indexed properties", + "", + }, + { + "one slice and one scalar are too long", + &Y0{F: make([]float64, maxIndexedProperties), B: true}, + &Y0{}, + "too many indexed properties", + "", + }, + { + "slice of slices of bytes", + &Repeated{ + Repeats: []Repeat{ + { + Key: "key 1", + Value: []byte("value 1"), + }, + { + Key: "key 2", + Value: []byte("value 2"), + }, + }, + }, + &Repeated{ + Repeats: []Repeat{ + { + Key: "key 1", + Value: []byte("value 1"), + }, + { + Key: "key 2", + Value: []byte("value 2"), + }, + }, + }, + "", + "", + }, + { + "long blob", + &B0{B: makeUint8Slice(maxIndexedProperties + 1)}, + &B0{B: makeUint8Slice(maxIndexedProperties + 1)}, + "", + "", + }, + { + "long []int8 is too long", + &B1{B: makeInt8Slice(maxIndexedProperties + 1)}, + &B1{}, + "too many indexed properties", + "", + }, + { + "short []int8", + &B1{B: makeInt8Slice(3)}, + &B1{B: makeInt8Slice(3)}, + "", + "", + }, + { + "long myBlob", + &B2{B: makeUint8Slice(maxIndexedProperties + 1)}, + &B2{B: makeUint8Slice(maxIndexedProperties + 1)}, + "", + "", + }, + { + "short myBlob", + &B2{B: makeUint8Slice(3)}, + &B2{B: makeUint8Slice(3)}, + "", + "", + }, + { + "long []myByte", + &B3{B: makeMyByteSlice(maxIndexedProperties + 1)}, + &B3{B: makeMyByteSlice(maxIndexedProperties + 1)}, + "", + "", + }, + { + "short []myByte", + &B3{B: makeMyByteSlice(3)}, + &B3{B: makeMyByteSlice(3)}, + "", + "", + }, + { + "slice of blobs", + &B4{B: [][]byte{ + makeUint8Slice(3), + makeUint8Slice(4), + makeUint8Slice(5), + }}, + &B4{B: [][]byte{ + makeUint8Slice(3), + makeUint8Slice(4), + makeUint8Slice(5), + }}, + "", + "", + }, + { + "short ByteString", + &B5{B: ByteString(makeUint8Slice(3))}, + &B5{B: ByteString(makeUint8Slice(3))}, + "", + "", + }, + { + "short ByteString as props", + &B5{B: ByteString(makeUint8Slice(3))}, + &PropertyList{ + Property{Name: "B", Value: ByteString(makeUint8Slice(3)), NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "short ByteString into string", + &B5{B: ByteString("legacy")}, + &struct{ B string }{"legacy"}, + "", + "", + }, + { + "[]byte must be noindex", + &PropertyList{ + Property{Name: "B", Value: makeUint8Slice(3), NoIndex: false}, + }, + nil, + "cannot index a []byte valued Property", + "", + }, + { + "save tagged load props", + &Tagged{A: 1, B: []int{21, 22, 23}, C: 3, D: 4, E: 5, F: 6, G: 7, I: 8, J: 9}, + &PropertyList{ + // A and B are renamed to a and b; A and C are noindex, I is ignored. + // Indexed properties are loaded before raw properties. Thus, the + // result is: b, b, b, D, E, a, c. + Property{Name: "C", Value: int64(3), NoIndex: true, Multiple: false}, + Property{Name: "D", Value: int64(4), NoIndex: false, Multiple: false}, + Property{Name: "E", Value: int64(5), NoIndex: false, Multiple: false}, + Property{Name: "F", Value: int64(6), NoIndex: true, Multiple: false}, + Property{Name: "G", Value: int64(7), NoIndex: false, Multiple: false}, + Property{Name: "J", Value: int64(9), NoIndex: true, Multiple: false}, + Property{Name: "a", Value: int64(1), NoIndex: true, Multiple: false}, + Property{Name: "b", Value: int64(21), NoIndex: false, Multiple: true}, + Property{Name: "b", Value: int64(22), NoIndex: false, Multiple: true}, + Property{Name: "b", Value: int64(23), NoIndex: false, Multiple: true}, + }, + "", + "", + }, + { + "save tagged load tagged", + &Tagged{A: 1, B: []int{21, 22, 23}, C: 3, D: 4, E: 5, I: 6, J: 7}, + &Tagged{A: 1, B: []int{21, 22, 23}, C: 3, D: 4, E: 5, J: 7}, + "", + "", + }, + { + "save props load tagged", + &PropertyList{ + Property{Name: "A", Value: int64(11), NoIndex: true, Multiple: false}, + Property{Name: "a", Value: int64(12), NoIndex: true, Multiple: false}, + }, + &Tagged{A: 12}, + "", + `cannot load field "A"`, + }, + { + "invalid tagged1", + &InvalidTagged1{I: 1}, + &InvalidTagged1{}, + "struct tag has invalid property name", + "", + }, + { + "invalid tagged2", + &InvalidTagged2{I: 1, J: 2}, + &InvalidTagged2{}, + "struct tag has repeated property name", + "", + }, + { + "doubler", + &Doubler{S: "s", I: 1, B: true}, + &Doubler{S: "ss", I: 2, B: true}, + "", + "", + }, + { + "save struct load props", + &X0{S: "s", I: 1}, + &PropertyList{ + Property{Name: "I", Value: int64(1), NoIndex: false, Multiple: false}, + Property{Name: "S", Value: "s", NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "save props load struct", + &PropertyList{ + Property{Name: "S", Value: "s", NoIndex: false, Multiple: false}, + Property{Name: "I", Value: int64(1), NoIndex: false, Multiple: false}, + }, + &X0{S: "s", I: 1}, + "", + "", + }, + { + "nil-value props", + &PropertyList{ + Property{Name: "I", Value: nil, NoIndex: false, Multiple: false}, + Property{Name: "B", Value: nil, NoIndex: false, Multiple: false}, + Property{Name: "S", Value: nil, NoIndex: false, Multiple: false}, + Property{Name: "F", Value: nil, NoIndex: false, Multiple: false}, + Property{Name: "K", Value: nil, NoIndex: false, Multiple: false}, + Property{Name: "T", Value: nil, NoIndex: false, Multiple: false}, + Property{Name: "J", Value: nil, NoIndex: false, Multiple: true}, + Property{Name: "J", Value: int64(7), NoIndex: false, Multiple: true}, + Property{Name: "J", Value: nil, NoIndex: false, Multiple: true}, + }, + &struct { + I int64 + B bool + S string + F float64 + K *Key + T time.Time + J []int64 + }{ + J: []int64{0, 7, 0}, + }, + "", + "", + }, + { + "save outer load props", + &Outer{ + A: 1, + I: []Inner1{ + {10, "ten"}, + {20, "twenty"}, + {30, "thirty"}, + }, + J: Inner2{ + Y: 3.14, + }, + Inner3: Inner3{ + Z: true, + }, + }, + &PropertyList{ + Property{Name: "A", Value: int64(1), NoIndex: false, Multiple: false}, + Property{Name: "I.W", Value: int64(10), NoIndex: false, Multiple: true}, + Property{Name: "I.W", Value: int64(20), NoIndex: false, Multiple: true}, + Property{Name: "I.W", Value: int64(30), NoIndex: false, Multiple: true}, + Property{Name: "I.X", Value: "ten", NoIndex: false, Multiple: true}, + Property{Name: "I.X", Value: "twenty", NoIndex: false, Multiple: true}, + Property{Name: "I.X", Value: "thirty", NoIndex: false, Multiple: true}, + Property{Name: "J.Y", Value: float64(3.14), NoIndex: false, Multiple: false}, + Property{Name: "Z", Value: true, NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "save props load outer-equivalent", + &PropertyList{ + Property{Name: "A", Value: int64(1), NoIndex: false, Multiple: false}, + Property{Name: "I.W", Value: int64(10), NoIndex: false, Multiple: true}, + Property{Name: "I.X", Value: "ten", NoIndex: false, Multiple: true}, + Property{Name: "I.W", Value: int64(20), NoIndex: false, Multiple: true}, + Property{Name: "I.X", Value: "twenty", NoIndex: false, Multiple: true}, + Property{Name: "I.W", Value: int64(30), NoIndex: false, Multiple: true}, + Property{Name: "I.X", Value: "thirty", NoIndex: false, Multiple: true}, + Property{Name: "J.Y", Value: float64(3.14), NoIndex: false, Multiple: false}, + Property{Name: "Z", Value: true, NoIndex: false, Multiple: false}, + }, + &OuterEquivalent{ + A: 1, + IDotW: []int32{10, 20, 30}, + IDotX: []string{"ten", "twenty", "thirty"}, + JDotY: 3.14, + Z: true, + }, + "", + "", + }, + { + "save outer-equivalent load outer", + &OuterEquivalent{ + A: 1, + IDotW: []int32{10, 20, 30}, + IDotX: []string{"ten", "twenty", "thirty"}, + JDotY: 3.14, + Z: true, + }, + &Outer{ + A: 1, + I: []Inner1{ + {10, "ten"}, + {20, "twenty"}, + {30, "thirty"}, + }, + J: Inner2{ + Y: 3.14, + }, + Inner3: Inner3{ + Z: true, + }, + }, + "", + "", + }, + { + "dotted names save", + &Dotted{A: DottedA{B: DottedB{C: 88}}}, + &PropertyList{ + Property{Name: "A0.A1.A2.B3.C4.C5", Value: int64(88), NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "dotted names load", + &PropertyList{ + Property{Name: "A0.A1.A2.B3.C4.C5", Value: int64(99), NoIndex: false, Multiple: false}, + }, + &Dotted{A: DottedA{B: DottedB{C: 99}}}, + "", + "", + }, + { + "save struct load deriver", + &X0{S: "s", I: 1}, + &Deriver{S: "s", Derived: "derived+s"}, + "", + "", + }, + { + "save deriver load struct", + &Deriver{S: "s", Derived: "derived+s", Ignored: "ignored"}, + &X0{S: "s"}, + "", + "", + }, + { + "bad multi-prop entity", + &BadMultiPropEntity{}, + &BadMultiPropEntity{}, + "Multiple is false", + "", + }, + // Regression: CL 25062824 broke handling of appengine.BlobKey fields. + { + "appengine.BlobKey", + &BK{Key: "blah"}, + &BK{Key: "blah"}, + "", + "", + }, + { + "zero time.Time", + &T{T: time.Time{}}, + &T{T: time.Time{}}, + "", + "", + }, + { + "time.Time near Unix zero time", + &T{T: time.Unix(0, 4e3)}, + &T{T: time.Unix(0, 4e3)}, + "", + "", + }, + { + "time.Time, far in the future", + &T{T: time.Date(99999, 1, 1, 0, 0, 0, 0, time.UTC)}, + &T{T: time.Date(99999, 1, 1, 0, 0, 0, 0, time.UTC)}, + "", + "", + }, + { + "time.Time, very far in the past", + &T{T: time.Date(-300000, 1, 1, 0, 0, 0, 0, time.UTC)}, + &T{}, + "time value out of range", + "", + }, + { + "time.Time, very far in the future", + &T{T: time.Date(294248, 1, 1, 0, 0, 0, 0, time.UTC)}, + &T{}, + "time value out of range", + "", + }, + { + "structs", + &N0{ + X0: X0{S: "one", I: 2, i: 3}, + Nonymous: X0{S: "four", I: 5, i: 6}, + Ignore: "ignore", + Other: "other", + }, + &N0{ + X0: X0{S: "one", I: 2}, + Nonymous: X0{S: "four", I: 5}, + Other: "other", + }, + "", + "", + }, + { + "slice of structs", + &N1{ + X0: X0{S: "one", I: 2, i: 3}, + Nonymous: []X0{ + {S: "four", I: 5, i: 6}, + {S: "seven", I: 8, i: 9}, + {S: "ten", I: 11, i: 12}, + {S: "thirteen", I: 14, i: 15}, + }, + Ignore: "ignore", + Other: "other", + }, + &N1{ + X0: X0{S: "one", I: 2}, + Nonymous: []X0{ + {S: "four", I: 5}, + {S: "seven", I: 8}, + {S: "ten", I: 11}, + {S: "thirteen", I: 14}, + }, + Other: "other", + }, + "", + "", + }, + { + "structs with slices of structs", + &N2{ + N1: N1{ + X0: X0{S: "rouge"}, + Nonymous: []X0{ + {S: "rosso0"}, + {S: "rosso1"}, + }, + }, + Green: N1{ + X0: X0{S: "vert"}, + Nonymous: []X0{ + {S: "verde0"}, + {S: "verde1"}, + {S: "verde2"}, + }, + }, + Blue: N1{ + X0: X0{S: "bleu"}, + Nonymous: []X0{ + {S: "blu0"}, + {S: "blu1"}, + {S: "blu2"}, + {S: "blu3"}, + }, + }, + }, + &N2{ + N1: N1{ + X0: X0{S: "rouge"}, + Nonymous: []X0{ + {S: "rosso0"}, + {S: "rosso1"}, + }, + }, + Green: N1{ + X0: X0{S: "vert"}, + Nonymous: []X0{ + {S: "verde0"}, + {S: "verde1"}, + {S: "verde2"}, + }, + }, + Blue: N1{ + X0: X0{S: "bleu"}, + Nonymous: []X0{ + {S: "blu0"}, + {S: "blu1"}, + {S: "blu2"}, + {S: "blu3"}, + }, + }, + }, + "", + "", + }, + { + "save structs load props", + &N2{ + N1: N1{ + X0: X0{S: "rouge"}, + Nonymous: []X0{ + {S: "rosso0"}, + {S: "rosso1"}, + }, + }, + Green: N1{ + X0: X0{S: "vert"}, + Nonymous: []X0{ + {S: "verde0"}, + {S: "verde1"}, + {S: "verde2"}, + }, + }, + Blue: N1{ + X0: X0{S: "bleu"}, + Nonymous: []X0{ + {S: "blu0"}, + {S: "blu1"}, + {S: "blu2"}, + {S: "blu3"}, + }, + }, + }, + &PropertyList{ + Property{Name: "Blue.I", Value: int64(0), NoIndex: false, Multiple: false}, + Property{Name: "Blue.Nonymous.I", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.I", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.I", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.I", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.S", Value: "blu0", NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.S", Value: "blu1", NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.S", Value: "blu2", NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.S", Value: "blu3", NoIndex: false, Multiple: true}, + Property{Name: "Blue.Other", Value: "", NoIndex: false, Multiple: false}, + Property{Name: "Blue.S", Value: "bleu", NoIndex: false, Multiple: false}, + Property{Name: "green.I", Value: int64(0), NoIndex: false, Multiple: false}, + Property{Name: "green.Nonymous.I", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "green.Nonymous.I", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "green.Nonymous.I", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "green.Nonymous.S", Value: "verde0", NoIndex: false, Multiple: true}, + Property{Name: "green.Nonymous.S", Value: "verde1", NoIndex: false, Multiple: true}, + Property{Name: "green.Nonymous.S", Value: "verde2", NoIndex: false, Multiple: true}, + Property{Name: "green.Other", Value: "", NoIndex: false, Multiple: false}, + Property{Name: "green.S", Value: "vert", NoIndex: false, Multiple: false}, + Property{Name: "red.I", Value: int64(0), NoIndex: false, Multiple: false}, + Property{Name: "red.Nonymous.I", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "red.Nonymous.I", Value: int64(0), NoIndex: false, Multiple: true}, + Property{Name: "red.Nonymous.S", Value: "rosso0", NoIndex: false, Multiple: true}, + Property{Name: "red.Nonymous.S", Value: "rosso1", NoIndex: false, Multiple: true}, + Property{Name: "red.Other", Value: "", NoIndex: false, Multiple: false}, + Property{Name: "red.S", Value: "rouge", NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "save props load structs with ragged fields", + &PropertyList{ + Property{Name: "red.S", Value: "rot", NoIndex: false, Multiple: false}, + Property{Name: "green.Nonymous.I", Value: int64(10), NoIndex: false, Multiple: true}, + Property{Name: "green.Nonymous.I", Value: int64(11), NoIndex: false, Multiple: true}, + Property{Name: "green.Nonymous.I", Value: int64(12), NoIndex: false, Multiple: true}, + Property{Name: "green.Nonymous.I", Value: int64(13), NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.S", Value: "blau0", NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.I", Value: int64(20), NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.S", Value: "blau1", NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.I", Value: int64(21), NoIndex: false, Multiple: true}, + Property{Name: "Blue.Nonymous.S", Value: "blau2", NoIndex: false, Multiple: true}, + }, + &N2{ + N1: N1{ + X0: X0{S: "rot"}, + }, + Green: N1{ + Nonymous: []X0{ + {I: 10}, + {I: 11}, + {I: 12}, + {I: 13}, + }, + }, + Blue: N1{ + Nonymous: []X0{ + {S: "blau0", I: 20}, + {S: "blau1", I: 21}, + {S: "blau2"}, + }, + }, + }, + "", + "", + }, + { + "save structs with noindex tags", + &struct { + A struct { + X string `datastore:",noindex"` + Y string + } `datastore:",noindex"` + B struct { + X string `datastore:",noindex"` + Y string + } + }{}, + &PropertyList{ + Property{Name: "A.X", Value: "", NoIndex: true, Multiple: false}, + Property{Name: "A.Y", Value: "", NoIndex: true, Multiple: false}, + Property{Name: "B.X", Value: "", NoIndex: true, Multiple: false}, + Property{Name: "B.Y", Value: "", NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "embedded struct with name override", + &struct { + Inner1 `datastore:"foo"` + }{}, + &PropertyList{ + Property{Name: "foo.W", Value: int64(0), NoIndex: false, Multiple: false}, + Property{Name: "foo.X", Value: "", NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "slice of slices", + &SliceOfSlices{}, + nil, + "flattening nested structs leads to a slice of slices", + "", + }, + { + "recursive struct", + &Recursive{}, + nil, + "recursive struct", + "", + }, + { + "mutually recursive struct", + &MutuallyRecursive0{}, + nil, + "recursive struct", + "", + }, + { + "non-exported struct fields", + &struct { + i, J int64 + }{i: 1, J: 2}, + &PropertyList{ + Property{Name: "J", Value: int64(2), NoIndex: false, Multiple: false}, + }, + "", + "", + }, + { + "json.RawMessage", + &struct { + J json.RawMessage + }{ + J: json.RawMessage("rawr"), + }, + &PropertyList{ + Property{Name: "J", Value: []byte("rawr"), NoIndex: true, Multiple: false}, + }, + "", + "", + }, + { + "json.RawMessage to myBlob", + &struct { + B json.RawMessage + }{ + B: json.RawMessage("rawr"), + }, + &B2{B: myBlob("rawr")}, + "", + "", + }, + { + "embedded time field", + &SpecialTime{MyTime: EmbeddedTime{now}}, + &SpecialTime{MyTime: EmbeddedTime{now}}, + "", + "", + }, + { + "embedded time load", + &PropertyList{ + Property{Name: "MyTime.", Value: now, NoIndex: false, Multiple: false}, + }, + &SpecialTime{MyTime: EmbeddedTime{now}}, + "", + "", + }, +} + +// checkErr returns the empty string if either both want and err are zero, +// or if want is a non-empty substring of err's string representation. +func checkErr(want string, err error) string { + if err != nil { + got := err.Error() + if want == "" || strings.Index(got, want) == -1 { + return got + } + } else if want != "" { + return fmt.Sprintf("want error %q", want) + } + return "" +} + +func TestRoundTrip(t *testing.T) { + for _, tc := range testCases { + p, err := saveEntity(testAppID, testKey0, tc.src) + if s := checkErr(tc.putErr, err); s != "" { + t.Errorf("%s: save: %s", tc.desc, s) + continue + } + if p == nil { + continue + } + var got interface{} + if _, ok := tc.want.(*PropertyList); ok { + got = new(PropertyList) + } else { + got = reflect.New(reflect.TypeOf(tc.want).Elem()).Interface() + } + err = loadEntity(got, p) + if s := checkErr(tc.getErr, err); s != "" { + t.Errorf("%s: load: %s", tc.desc, s) + continue + } + if pl, ok := got.(*PropertyList); ok { + // Sort by name to make sure we have a deterministic order. + sort.Stable(byName(*pl)) + } + equal := false + if gotT, ok := got.(*T); ok { + // Round tripping a time.Time can result in a different time.Location: Local instead of UTC. + // We therefore test equality explicitly, instead of relying on reflect.DeepEqual. + equal = gotT.T.Equal(tc.want.(*T).T) + } else { + equal = reflect.DeepEqual(got, tc.want) + } + if !equal { + t.Errorf("%s: compare: got %v want %v", tc.desc, got, tc.want) + continue + } + } +} + +type byName PropertyList + +func (s byName) Len() int { return len(s) } +func (s byName) Less(i, j int) bool { return s[i].Name < s[j].Name } +func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +func TestQueryConstruction(t *testing.T) { + tests := []struct { + q, exp *Query + err string + }{ + { + q: NewQuery("Foo"), + exp: &Query{ + kind: "Foo", + limit: -1, + }, + }, + { + // Regular filtered query with standard spacing. + q: NewQuery("Foo").Filter("foo >", 7), + exp: &Query{ + kind: "Foo", + filter: []filter{ + { + FieldName: "foo", + Op: greaterThan, + Value: 7, + }, + }, + limit: -1, + }, + }, + { + // Filtered query with no spacing. + q: NewQuery("Foo").Filter("foo=", 6), + exp: &Query{ + kind: "Foo", + filter: []filter{ + { + FieldName: "foo", + Op: equal, + Value: 6, + }, + }, + limit: -1, + }, + }, + { + // Filtered query with funky spacing. + q: NewQuery("Foo").Filter(" foo< ", 8), + exp: &Query{ + kind: "Foo", + filter: []filter{ + { + FieldName: "foo", + Op: lessThan, + Value: 8, + }, + }, + limit: -1, + }, + }, + { + // Filtered query with multicharacter op. + q: NewQuery("Foo").Filter("foo >=", 9), + exp: &Query{ + kind: "Foo", + filter: []filter{ + { + FieldName: "foo", + Op: greaterEq, + Value: 9, + }, + }, + limit: -1, + }, + }, + { + // Query with ordering. + q: NewQuery("Foo").Order("bar"), + exp: &Query{ + kind: "Foo", + order: []order{ + { + FieldName: "bar", + Direction: ascending, + }, + }, + limit: -1, + }, + }, + { + // Query with reverse ordering, and funky spacing. + q: NewQuery("Foo").Order(" - bar"), + exp: &Query{ + kind: "Foo", + order: []order{ + { + FieldName: "bar", + Direction: descending, + }, + }, + limit: -1, + }, + }, + { + // Query with an empty ordering. + q: NewQuery("Foo").Order(""), + err: "empty order", + }, + { + // Query with a + ordering. + q: NewQuery("Foo").Order("+bar"), + err: "invalid order", + }, + } + for i, test := range tests { + if test.q.err != nil { + got := test.q.err.Error() + if !strings.Contains(got, test.err) { + t.Errorf("%d: error mismatch: got %q want something containing %q", i, got, test.err) + } + continue + } + if !reflect.DeepEqual(test.q, test.exp) { + t.Errorf("%d: mismatch: got %v want %v", i, test.q, test.exp) + } + } +} + +func TestStringMeaning(t *testing.T) { + var xx [4]interface{} + xx[0] = &struct { + X string + }{"xx0"} + xx[1] = &struct { + X string `datastore:",noindex"` + }{"xx1"} + xx[2] = &struct { + X []byte + }{[]byte("xx2")} + xx[3] = &struct { + X []byte `datastore:",noindex"` + }{[]byte("xx3")} + + indexed := [4]bool{ + true, + false, + false, // A []byte is always no-index. + false, + } + want := [4]pb.Property_Meaning{ + pb.Property_NO_MEANING, + pb.Property_TEXT, + pb.Property_BLOB, + pb.Property_BLOB, + } + + for i, x := range xx { + props, err := SaveStruct(x) + if err != nil { + t.Errorf("i=%d: SaveStruct: %v", i, err) + continue + } + e, err := propertiesToProto("appID", testKey0, props) + if err != nil { + t.Errorf("i=%d: propertiesToProto: %v", i, err) + continue + } + var p *pb.Property + switch { + case indexed[i] && len(e.Property) == 1: + p = e.Property[0] + case !indexed[i] && len(e.RawProperty) == 1: + p = e.RawProperty[0] + default: + t.Errorf("i=%d: EntityProto did not have expected property slice", i) + continue + } + if got := p.GetMeaning(); got != want[i] { + t.Errorf("i=%d: meaning: got %v, want %v", i, got, want[i]) + continue + } + } +} + +func TestNamespaceResetting(t *testing.T) { + // These environment variables are necessary because *Query.Run will + // call internal.FullyQualifiedAppID which checks these variables or falls + // back to the Metadata service that is not available in tests. + environ := []struct { + key, value string + }{ + {"GAE_LONG_APP_ID", "my-app-id"}, + {"GAE_PARTITION", "1"}, + } + for _, v := range environ { + old := os.Getenv(v.key) + os.Setenv(v.key, v.value) + v.value = old + } + defer func() { // Restore old environment after the test completes. + for _, v := range environ { + if v.value == "" { + os.Unsetenv(v.key) + continue + } + os.Setenv(v.key, v.value) + } + }() + + namec := make(chan *string, 1) + c0 := aetesting.FakeSingleContext(t, "datastore_v3", "RunQuery", func(req *pb.Query, res *pb.QueryResult) error { + namec <- req.NameSpace + return fmt.Errorf("RPC error") + }) + + // Check that wrapping c0 in a namespace twice works correctly. + c1, err := appengine.Namespace(c0, "A") + if err != nil { + t.Fatalf("appengine.Namespace: %v", err) + } + c2, err := appengine.Namespace(c1, "") // should act as the original context + if err != nil { + t.Fatalf("appengine.Namespace: %v", err) + } + + q := NewQuery("SomeKind") + + q.Run(c0) + if ns := <-namec; ns != nil { + t.Errorf(`RunQuery with c0: ns = %q, want nil`, *ns) + } + + q.Run(c1) + if ns := <-namec; ns == nil { + t.Error(`RunQuery with c1: ns = nil, want "A"`) + } else if *ns != "A" { + t.Errorf(`RunQuery with c1: ns = %q, want "A"`, *ns) + } + + q.Run(c2) + if ns := <-namec; ns != nil { + t.Errorf(`RunQuery with c2: ns = %q, want nil`, *ns) + } +} diff --git a/vendor/google.golang.org/appengine/datastore/doc.go b/vendor/google.golang.org/appengine/datastore/doc.go new file mode 100644 index 000000000..85616cf27 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/doc.go @@ -0,0 +1,361 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package datastore provides a client for App Engine's datastore service. + + +Basic Operations + +Entities are the unit of storage and are associated with a key. A key +consists of an optional parent key, a string application ID, a string kind +(also known as an entity type), and either a StringID or an IntID. A +StringID is also known as an entity name or key name. + +It is valid to create a key with a zero StringID and a zero IntID; this is +called an incomplete key, and does not refer to any saved entity. Putting an +entity into the datastore under an incomplete key will cause a unique key +to be generated for that entity, with a non-zero IntID. + +An entity's contents are a mapping from case-sensitive field names to values. +Valid value types are: + - signed integers (int, int8, int16, int32 and int64), + - bool, + - string, + - float32 and float64, + - []byte (up to 1 megabyte in length), + - any type whose underlying type is one of the above predeclared types, + - ByteString, + - *Key, + - time.Time (stored with microsecond precision), + - appengine.BlobKey, + - appengine.GeoPoint, + - structs whose fields are all valid value types, + - slices of any of the above. + +Slices of structs are valid, as are structs that contain slices. However, if +one struct contains another, then at most one of those can be repeated. This +disqualifies recursively defined struct types: any struct T that (directly or +indirectly) contains a []T. + +The Get and Put functions load and save an entity's contents. An entity's +contents are typically represented by a struct pointer. + +Example code: + + type Entity struct { + Value string + } + + func handle(w http.ResponseWriter, r *http.Request) { + ctx := appengine.NewContext(r) + + k := datastore.NewKey(ctx, "Entity", "stringID", 0, nil) + e := new(Entity) + if err := datastore.Get(ctx, k, e); err != nil { + http.Error(w, err.Error(), 500) + return + } + + old := e.Value + e.Value = r.URL.Path + + if _, err := datastore.Put(ctx, k, e); err != nil { + http.Error(w, err.Error(), 500) + return + } + + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + fmt.Fprintf(w, "old=%q\nnew=%q\n", old, e.Value) + } + +GetMulti, PutMulti and DeleteMulti are batch versions of the Get, Put and +Delete functions. They take a []*Key instead of a *Key, and may return an +appengine.MultiError when encountering partial failure. + + +Properties + +An entity's contents can be represented by a variety of types. These are +typically struct pointers, but can also be any type that implements the +PropertyLoadSaver interface. If using a struct pointer, you do not have to +explicitly implement the PropertyLoadSaver interface; the datastore will +automatically convert via reflection. If a struct pointer does implement that +interface then those methods will be used in preference to the default +behavior for struct pointers. Struct pointers are more strongly typed and are +easier to use; PropertyLoadSavers are more flexible. + +The actual types passed do not have to match between Get and Put calls or even +across different calls to datastore. It is valid to put a *PropertyList and +get that same entity as a *myStruct, or put a *myStruct0 and get a *myStruct1. +Conceptually, any entity is saved as a sequence of properties, and is loaded +into the destination value on a property-by-property basis. When loading into +a struct pointer, an entity that cannot be completely represented (such as a +missing field) will result in an ErrFieldMismatch error but it is up to the +caller whether this error is fatal, recoverable or ignorable. + +By default, for struct pointers, all properties are potentially indexed, and +the property name is the same as the field name (and hence must start with an +upper case letter). + +Fields may have a `datastore:"name,options"` tag. The tag name is the +property name, which must be one or more valid Go identifiers joined by ".", +but may start with a lower case letter. An empty tag name means to just use the +field name. A "-" tag name means that the datastore will ignore that field. + +The only valid options are "omitempty" and "noindex". + +If the options include "omitempty" and the value of the field is empty, then the field will be omitted on Save. +The empty values are false, 0, any nil interface value, and any array, slice, map, or string of length zero. +Struct field values will never be empty. + +If options include "noindex" then the field will not be indexed. All fields are indexed +by default. Strings or byte slices longer than 1500 bytes cannot be indexed; +fields used to store long strings and byte slices must be tagged with "noindex" +or they will cause Put operations to fail. + +To use multiple options together, separate them by a comma. +The order does not matter. + +If the options is "" then the comma may be omitted. + +Example code: + + // A and B are renamed to a and b. + // A, C and J are not indexed. + // D's tag is equivalent to having no tag at all (E). + // I is ignored entirely by the datastore. + // J has tag information for both the datastore and json packages. + type TaggedStruct struct { + A int `datastore:"a,noindex"` + B int `datastore:"b"` + C int `datastore:",noindex"` + D int `datastore:""` + E int + I int `datastore:"-"` + J int `datastore:",noindex" json:"j"` + } + + +Structured Properties + +If the struct pointed to contains other structs, then the nested or embedded +structs are flattened. For example, given these definitions: + + type Inner1 struct { + W int32 + X string + } + + type Inner2 struct { + Y float64 + } + + type Inner3 struct { + Z bool + } + + type Outer struct { + A int16 + I []Inner1 + J Inner2 + Inner3 + } + +then an Outer's properties would be equivalent to those of: + + type OuterEquivalent struct { + A int16 + IDotW []int32 `datastore:"I.W"` + IDotX []string `datastore:"I.X"` + JDotY float64 `datastore:"J.Y"` + Z bool + } + +If Outer's embedded Inner3 field was tagged as `datastore:"Foo"` then the +equivalent field would instead be: FooDotZ bool `datastore:"Foo.Z"`. + +If an outer struct is tagged "noindex" then all of its implicit flattened +fields are effectively "noindex". + + +The PropertyLoadSaver Interface + +An entity's contents can also be represented by any type that implements the +PropertyLoadSaver interface. This type may be a struct pointer, but it does +not have to be. The datastore package will call Load when getting the entity's +contents, and Save when putting the entity's contents. +Possible uses include deriving non-stored fields, verifying fields, or indexing +a field only if its value is positive. + +Example code: + + type CustomPropsExample struct { + I, J int + // Sum is not stored, but should always be equal to I + J. + Sum int `datastore:"-"` + } + + func (x *CustomPropsExample) Load(ps []datastore.Property) error { + // Load I and J as usual. + if err := datastore.LoadStruct(x, ps); err != nil { + return err + } + // Derive the Sum field. + x.Sum = x.I + x.J + return nil + } + + func (x *CustomPropsExample) Save() ([]datastore.Property, error) { + // Validate the Sum field. + if x.Sum != x.I + x.J { + return nil, errors.New("CustomPropsExample has inconsistent sum") + } + // Save I and J as usual. The code below is equivalent to calling + // "return datastore.SaveStruct(x)", but is done manually for + // demonstration purposes. + return []datastore.Property{ + { + Name: "I", + Value: int64(x.I), + }, + { + Name: "J", + Value: int64(x.J), + }, + }, nil + } + +The *PropertyList type implements PropertyLoadSaver, and can therefore hold an +arbitrary entity's contents. + + +Queries + +Queries retrieve entities based on their properties or key's ancestry. Running +a query yields an iterator of results: either keys or (key, entity) pairs. +Queries are re-usable and it is safe to call Query.Run from concurrent +goroutines. Iterators are not safe for concurrent use. + +Queries are immutable, and are either created by calling NewQuery, or derived +from an existing query by calling a method like Filter or Order that returns a +new query value. A query is typically constructed by calling NewQuery followed +by a chain of zero or more such methods. These methods are: + - Ancestor and Filter constrain the entities returned by running a query. + - Order affects the order in which they are returned. + - Project constrains the fields returned. + - Distinct de-duplicates projected entities. + - KeysOnly makes the iterator return only keys, not (key, entity) pairs. + - Start, End, Offset and Limit define which sub-sequence of matching entities + to return. Start and End take cursors, Offset and Limit take integers. Start + and Offset affect the first result, End and Limit affect the last result. + If both Start and Offset are set, then the offset is relative to Start. + If both End and Limit are set, then the earliest constraint wins. Limit is + relative to Start+Offset, not relative to End. As a special case, a + negative limit means unlimited. + +Example code: + + type Widget struct { + Description string + Price int + } + + func handle(w http.ResponseWriter, r *http.Request) { + ctx := appengine.NewContext(r) + q := datastore.NewQuery("Widget"). + Filter("Price <", 1000). + Order("-Price") + b := new(bytes.Buffer) + for t := q.Run(ctx); ; { + var x Widget + key, err := t.Next(&x) + if err == datastore.Done { + break + } + if err != nil { + serveError(ctx, w, err) + return + } + fmt.Fprintf(b, "Key=%v\nWidget=%#v\n\n", key, x) + } + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + io.Copy(w, b) + } + + +Transactions + +RunInTransaction runs a function in a transaction. + +Example code: + + type Counter struct { + Count int + } + + func inc(ctx context.Context, key *datastore.Key) (int, error) { + var x Counter + if err := datastore.Get(ctx, key, &x); err != nil && err != datastore.ErrNoSuchEntity { + return 0, err + } + x.Count++ + if _, err := datastore.Put(ctx, key, &x); err != nil { + return 0, err + } + return x.Count, nil + } + + func handle(w http.ResponseWriter, r *http.Request) { + ctx := appengine.NewContext(r) + var count int + err := datastore.RunInTransaction(ctx, func(ctx context.Context) error { + var err1 error + count, err1 = inc(ctx, datastore.NewKey(ctx, "Counter", "singleton", 0, nil)) + return err1 + }, nil) + if err != nil { + serveError(ctx, w, err) + return + } + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + fmt.Fprintf(w, "Count=%d", count) + } + + +Metadata + +The datastore package provides access to some of App Engine's datastore +metadata. This metadata includes information about the entity groups, +namespaces, entity kinds, and properties in the datastore, as well as the +property representations for each property. + +Example code: + + func handle(w http.ResponseWriter, r *http.Request) { + // Print all the kinds in the datastore, with all the indexed + // properties (and their representations) for each. + ctx := appengine.NewContext(r) + + kinds, err := datastore.Kinds(ctx) + if err != nil { + serveError(ctx, w, err) + return + } + + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + for _, kind := range kinds { + fmt.Fprintf(w, "%s:\n", kind) + props, err := datastore.KindProperties(ctx, kind) + if err != nil { + fmt.Fprintln(w, "\t(unable to retrieve properties)") + continue + } + for p, rep := range props { + fmt.Fprintf(w, "\t-%s (%s)\n", p, strings.Join(rep, ", ")) + } + } + } +*/ +package datastore // import "google.golang.org/appengine/datastore" diff --git a/vendor/google.golang.org/appengine/datastore/key.go b/vendor/google.golang.org/appengine/datastore/key.go new file mode 100644 index 000000000..6ab83eaf6 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/key.go @@ -0,0 +1,396 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "bytes" + "encoding/base64" + "encoding/gob" + "errors" + "fmt" + "strconv" + "strings" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/datastore" +) + +type KeyRangeCollisionError struct { + start int64 + end int64 +} + +func (e *KeyRangeCollisionError) Error() string { + return fmt.Sprintf("datastore: Collision when attempting to allocate range [%d, %d]", + e.start, e.end) +} + +type KeyRangeContentionError struct { + start int64 + end int64 +} + +func (e *KeyRangeContentionError) Error() string { + return fmt.Sprintf("datastore: Contention when attempting to allocate range [%d, %d]", + e.start, e.end) +} + +// Key represents the datastore key for a stored entity, and is immutable. +type Key struct { + kind string + stringID string + intID int64 + parent *Key + appID string + namespace string +} + +// Kind returns the key's kind (also known as entity type). +func (k *Key) Kind() string { + return k.kind +} + +// StringID returns the key's string ID (also known as an entity name or key +// name), which may be "". +func (k *Key) StringID() string { + return k.stringID +} + +// IntID returns the key's integer ID, which may be 0. +func (k *Key) IntID() int64 { + return k.intID +} + +// Parent returns the key's parent key, which may be nil. +func (k *Key) Parent() *Key { + return k.parent +} + +// AppID returns the key's application ID. +func (k *Key) AppID() string { + return k.appID +} + +// Namespace returns the key's namespace. +func (k *Key) Namespace() string { + return k.namespace +} + +// Incomplete returns whether the key does not refer to a stored entity. +// In particular, whether the key has a zero StringID and a zero IntID. +func (k *Key) Incomplete() bool { + return k.stringID == "" && k.intID == 0 +} + +// valid returns whether the key is valid. +func (k *Key) valid() bool { + if k == nil { + return false + } + for ; k != nil; k = k.parent { + if k.kind == "" || k.appID == "" { + return false + } + if k.stringID != "" && k.intID != 0 { + return false + } + if k.parent != nil { + if k.parent.Incomplete() { + return false + } + if k.parent.appID != k.appID || k.parent.namespace != k.namespace { + return false + } + } + } + return true +} + +// Equal returns whether two keys are equal. +func (k *Key) Equal(o *Key) bool { + for k != nil && o != nil { + if k.kind != o.kind || k.stringID != o.stringID || k.intID != o.intID || k.appID != o.appID || k.namespace != o.namespace { + return false + } + k, o = k.parent, o.parent + } + return k == o +} + +// root returns the furthest ancestor of a key, which may be itself. +func (k *Key) root() *Key { + for k.parent != nil { + k = k.parent + } + return k +} + +// marshal marshals the key's string representation to the buffer. +func (k *Key) marshal(b *bytes.Buffer) { + if k.parent != nil { + k.parent.marshal(b) + } + b.WriteByte('/') + b.WriteString(k.kind) + b.WriteByte(',') + if k.stringID != "" { + b.WriteString(k.stringID) + } else { + b.WriteString(strconv.FormatInt(k.intID, 10)) + } +} + +// String returns a string representation of the key. +func (k *Key) String() string { + if k == nil { + return "" + } + b := bytes.NewBuffer(make([]byte, 0, 512)) + k.marshal(b) + return b.String() +} + +type gobKey struct { + Kind string + StringID string + IntID int64 + Parent *gobKey + AppID string + Namespace string +} + +func keyToGobKey(k *Key) *gobKey { + if k == nil { + return nil + } + return &gobKey{ + Kind: k.kind, + StringID: k.stringID, + IntID: k.intID, + Parent: keyToGobKey(k.parent), + AppID: k.appID, + Namespace: k.namespace, + } +} + +func gobKeyToKey(gk *gobKey) *Key { + if gk == nil { + return nil + } + return &Key{ + kind: gk.Kind, + stringID: gk.StringID, + intID: gk.IntID, + parent: gobKeyToKey(gk.Parent), + appID: gk.AppID, + namespace: gk.Namespace, + } +} + +func (k *Key) GobEncode() ([]byte, error) { + buf := new(bytes.Buffer) + if err := gob.NewEncoder(buf).Encode(keyToGobKey(k)); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func (k *Key) GobDecode(buf []byte) error { + gk := new(gobKey) + if err := gob.NewDecoder(bytes.NewBuffer(buf)).Decode(gk); err != nil { + return err + } + *k = *gobKeyToKey(gk) + return nil +} + +func (k *Key) MarshalJSON() ([]byte, error) { + return []byte(`"` + k.Encode() + `"`), nil +} + +func (k *Key) UnmarshalJSON(buf []byte) error { + if len(buf) < 2 || buf[0] != '"' || buf[len(buf)-1] != '"' { + return errors.New("datastore: bad JSON key") + } + k2, err := DecodeKey(string(buf[1 : len(buf)-1])) + if err != nil { + return err + } + *k = *k2 + return nil +} + +// Encode returns an opaque representation of the key +// suitable for use in HTML and URLs. +// This is compatible with the Python and Java runtimes. +func (k *Key) Encode() string { + ref := keyToProto("", k) + + b, err := proto.Marshal(ref) + if err != nil { + panic(err) + } + + // Trailing padding is stripped. + return strings.TrimRight(base64.URLEncoding.EncodeToString(b), "=") +} + +// DecodeKey decodes a key from the opaque representation returned by Encode. +func DecodeKey(encoded string) (*Key, error) { + // Re-add padding. + if m := len(encoded) % 4; m != 0 { + encoded += strings.Repeat("=", 4-m) + } + + b, err := base64.URLEncoding.DecodeString(encoded) + if err != nil { + return nil, err + } + + ref := new(pb.Reference) + if err := proto.Unmarshal(b, ref); err != nil { + return nil, err + } + + return protoToKey(ref) +} + +// NewIncompleteKey creates a new incomplete key. +// kind cannot be empty. +func NewIncompleteKey(c context.Context, kind string, parent *Key) *Key { + return NewKey(c, kind, "", 0, parent) +} + +// NewKey creates a new key. +// kind cannot be empty. +// Either one or both of stringID and intID must be zero. If both are zero, +// the key returned is incomplete. +// parent must either be a complete key or nil. +func NewKey(c context.Context, kind, stringID string, intID int64, parent *Key) *Key { + // If there's a parent key, use its namespace. + // Otherwise, use any namespace attached to the context. + var namespace string + if parent != nil { + namespace = parent.namespace + } else { + namespace = internal.NamespaceFromContext(c) + } + + return &Key{ + kind: kind, + stringID: stringID, + intID: intID, + parent: parent, + appID: internal.FullyQualifiedAppID(c), + namespace: namespace, + } +} + +// AllocateIDs returns a range of n integer IDs with the given kind and parent +// combination. kind cannot be empty; parent may be nil. The IDs in the range +// returned will not be used by the datastore's automatic ID sequence generator +// and may be used with NewKey without conflict. +// +// The range is inclusive at the low end and exclusive at the high end. In +// other words, valid intIDs x satisfy low <= x && x < high. +// +// If no error is returned, low + n == high. +func AllocateIDs(c context.Context, kind string, parent *Key, n int) (low, high int64, err error) { + if kind == "" { + return 0, 0, errors.New("datastore: AllocateIDs given an empty kind") + } + if n < 0 { + return 0, 0, fmt.Errorf("datastore: AllocateIDs given a negative count: %d", n) + } + if n == 0 { + return 0, 0, nil + } + req := &pb.AllocateIdsRequest{ + ModelKey: keyToProto("", NewIncompleteKey(c, kind, parent)), + Size: proto.Int64(int64(n)), + } + res := &pb.AllocateIdsResponse{} + if err := internal.Call(c, "datastore_v3", "AllocateIds", req, res); err != nil { + return 0, 0, err + } + // The protobuf is inclusive at both ends. Idiomatic Go (e.g. slices, for loops) + // is inclusive at the low end and exclusive at the high end, so we add 1. + low = res.GetStart() + high = res.GetEnd() + 1 + if low+int64(n) != high { + return 0, 0, fmt.Errorf("datastore: internal error: could not allocate %d IDs", n) + } + return low, high, nil +} + +// AllocateIDRange allocates a range of IDs with specific endpoints. +// The range is inclusive at both the low and high end. Once these IDs have been +// allocated, you can manually assign them to newly created entities. +// +// The Datastore's automatic ID allocator never assigns a key that has already +// been allocated (either through automatic ID allocation or through an explicit +// AllocateIDs call). As a result, entities written to the given key range will +// never be overwritten. However, writing entities with manually assigned keys in +// this range may overwrite existing entities (or new entities written by a separate +// request), depending on the error returned. +// +// Use this only if you have an existing numeric ID range that you want to reserve +// (for example, bulk loading entities that already have IDs). If you don't care +// about which IDs you receive, use AllocateIDs instead. +// +// AllocateIDRange returns nil if the range is successfully allocated. If one or more +// entities with an ID in the given range already exist, it returns a KeyRangeCollisionError. +// If the Datastore has already cached IDs in this range (e.g. from a previous call to +// AllocateIDRange), it returns a KeyRangeContentionError. Errors of other types indicate +// problems with arguments or an error returned directly from the Datastore. +func AllocateIDRange(c context.Context, kind string, parent *Key, start, end int64) (err error) { + if kind == "" { + return errors.New("datastore: AllocateIDRange given an empty kind") + } + + if start < 1 || end < 1 { + return errors.New("datastore: AllocateIDRange start and end must both be greater than 0") + } + + if start > end { + return errors.New("datastore: AllocateIDRange start must be before end") + } + + req := &pb.AllocateIdsRequest{ + ModelKey: keyToProto("", NewIncompleteKey(c, kind, parent)), + Max: proto.Int64(end), + } + res := &pb.AllocateIdsResponse{} + if err := internal.Call(c, "datastore_v3", "AllocateIds", req, res); err != nil { + return err + } + + // Check for collisions, i.e. existing entities with IDs in this range. + // We could do this before the allocation, but we'd still have to do it + // afterward as well to catch the race condition where an entity is inserted + // after that initial check but before the allocation. Skip the up-front check + // and just do it once. + q := NewQuery(kind).Filter("__key__ >=", NewKey(c, kind, "", start, parent)). + Filter("__key__ <=", NewKey(c, kind, "", end, parent)).KeysOnly().Limit(1) + + keys, err := q.GetAll(c, nil) + if err != nil { + return err + } + if len(keys) != 0 { + return &KeyRangeCollisionError{start: start, end: end} + } + + // Check for a race condition, i.e. cases where the datastore may have + // cached ID batches that contain IDs in this range. + if start < res.GetStart() { + return &KeyRangeContentionError{start: start, end: end} + } + + return nil +} diff --git a/vendor/google.golang.org/appengine/datastore/key_test.go b/vendor/google.golang.org/appengine/datastore/key_test.go new file mode 100644 index 000000000..1fb3e9752 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/key_test.go @@ -0,0 +1,204 @@ +// Copyright 2011 Google Inc. All Rights Reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "testing" + + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" +) + +func TestKeyEncoding(t *testing.T) { + testCases := []struct { + desc string + key *Key + exp string + }{ + { + desc: "A simple key with an int ID", + key: &Key{ + kind: "Person", + intID: 1, + appID: "glibrary", + }, + exp: "aghnbGlicmFyeXIMCxIGUGVyc29uGAEM", + }, + { + desc: "A simple key with a string ID", + key: &Key{ + kind: "Graph", + stringID: "graph:7-day-active", + appID: "glibrary", + }, + exp: "aghnbGlicmFyeXIdCxIFR3JhcGgiEmdyYXBoOjctZGF5LWFjdGl2ZQw", + }, + { + desc: "A key with a parent", + key: &Key{ + kind: "WordIndex", + intID: 1033, + parent: &Key{ + kind: "WordIndex", + intID: 1020032, + appID: "glibrary", + }, + appID: "glibrary", + }, + exp: "aghnbGlicmFyeXIhCxIJV29yZEluZGV4GIChPgwLEglXb3JkSW5kZXgYiQgM", + }, + } + for _, tc := range testCases { + enc := tc.key.Encode() + if enc != tc.exp { + t.Errorf("%s: got %q, want %q", tc.desc, enc, tc.exp) + } + + key, err := DecodeKey(tc.exp) + if err != nil { + t.Errorf("%s: failed decoding key: %v", tc.desc, err) + continue + } + if !key.Equal(tc.key) { + t.Errorf("%s: decoded key %v, want %v", tc.desc, key, tc.key) + } + } +} + +func TestKeyGob(t *testing.T) { + k := &Key{ + kind: "Gopher", + intID: 3, + parent: &Key{ + kind: "Mom", + stringID: "narwhal", + appID: "gopher-con", + }, + appID: "gopher-con", + } + + buf := new(bytes.Buffer) + if err := gob.NewEncoder(buf).Encode(k); err != nil { + t.Fatalf("gob encode failed: %v", err) + } + + k2 := new(Key) + if err := gob.NewDecoder(buf).Decode(k2); err != nil { + t.Fatalf("gob decode failed: %v", err) + } + if !k2.Equal(k) { + t.Errorf("gob round trip of %v produced %v", k, k2) + } +} + +func TestNilKeyGob(t *testing.T) { + type S struct { + Key *Key + } + s1 := new(S) + + buf := new(bytes.Buffer) + if err := gob.NewEncoder(buf).Encode(s1); err != nil { + t.Fatalf("gob encode failed: %v", err) + } + + s2 := new(S) + if err := gob.NewDecoder(buf).Decode(s2); err != nil { + t.Fatalf("gob decode failed: %v", err) + } + if s2.Key != nil { + t.Errorf("gob round trip of nil key produced %v", s2.Key) + } +} + +func TestKeyJSON(t *testing.T) { + k := &Key{ + kind: "Gopher", + intID: 2, + parent: &Key{ + kind: "Mom", + stringID: "narwhal", + appID: "gopher-con", + }, + appID: "gopher-con", + } + exp := `"` + k.Encode() + `"` + + buf, err := json.Marshal(k) + if err != nil { + t.Fatalf("json.Marshal failed: %v", err) + } + if s := string(buf); s != exp { + t.Errorf("JSON encoding of key %v: got %q, want %q", k, s, exp) + } + + k2 := new(Key) + if err := json.Unmarshal(buf, k2); err != nil { + t.Fatalf("json.Unmarshal failed: %v", err) + } + if !k2.Equal(k) { + t.Errorf("JSON round trip of %v produced %v", k, k2) + } +} + +func TestNilKeyJSON(t *testing.T) { + type S struct { + Key *Key + } + s1 := new(S) + + buf, err := json.Marshal(s1) + if err != nil { + t.Fatalf("json.Marshal failed: %v", err) + } + + s2 := new(S) + if err := json.Unmarshal(buf, s2); err != nil { + t.Fatalf("json.Unmarshal failed: %v", err) + } + if s2.Key != nil { + t.Errorf("JSON round trip of nil key produced %v", s2.Key) + } +} + +func TestIncompleteKeyWithParent(t *testing.T) { + c := internal.WithAppIDOverride(context.Background(), "s~some-app") + + // fadduh is a complete key. + fadduh := NewKey(c, "Person", "", 1, nil) + if fadduh.Incomplete() { + t.Fatalf("fadduh is incomplete") + } + + // robert is an incomplete key with fadduh as a parent. + robert := NewIncompleteKey(c, "Person", fadduh) + if !robert.Incomplete() { + t.Fatalf("robert is complete") + } + + // Both should be valid keys. + if !fadduh.valid() { + t.Errorf("fadduh is invalid: %v", fadduh) + } + if !robert.valid() { + t.Errorf("robert is invalid: %v", robert) + } +} + +func TestNamespace(t *testing.T) { + key := &Key{ + kind: "Person", + intID: 1, + appID: "s~some-app", + namespace: "mynamespace", + } + if g, w := key.Namespace(), "mynamespace"; g != w { + t.Errorf("key.Namespace() = %q, want %q", g, w) + } +} diff --git a/vendor/google.golang.org/appengine/datastore/load.go b/vendor/google.golang.org/appengine/datastore/load.go new file mode 100644 index 000000000..38a636539 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/load.go @@ -0,0 +1,429 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "fmt" + "reflect" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "google.golang.org/appengine" + pb "google.golang.org/appengine/internal/datastore" +) + +var ( + typeOfBlobKey = reflect.TypeOf(appengine.BlobKey("")) + typeOfByteSlice = reflect.TypeOf([]byte(nil)) + typeOfByteString = reflect.TypeOf(ByteString(nil)) + typeOfGeoPoint = reflect.TypeOf(appengine.GeoPoint{}) + typeOfTime = reflect.TypeOf(time.Time{}) + typeOfKeyPtr = reflect.TypeOf(&Key{}) + typeOfEntityPtr = reflect.TypeOf(&Entity{}) +) + +// typeMismatchReason returns a string explaining why the property p could not +// be stored in an entity field of type v.Type(). +func typeMismatchReason(pValue interface{}, v reflect.Value) string { + entityType := "empty" + switch pValue.(type) { + case int64: + entityType = "int" + case bool: + entityType = "bool" + case string: + entityType = "string" + case float64: + entityType = "float" + case *Key: + entityType = "*datastore.Key" + case time.Time: + entityType = "time.Time" + case appengine.BlobKey: + entityType = "appengine.BlobKey" + case appengine.GeoPoint: + entityType = "appengine.GeoPoint" + case ByteString: + entityType = "datastore.ByteString" + case []byte: + entityType = "[]byte" + } + return fmt.Sprintf("type mismatch: %s versus %v", entityType, v.Type()) +} + +type propertyLoader struct { + // m holds the number of times a substruct field like "Foo.Bar.Baz" has + // been seen so far. The map is constructed lazily. + m map[string]int +} + +func (l *propertyLoader) load(codec *structCodec, structValue reflect.Value, p Property, requireSlice bool) string { + var v reflect.Value + var sliceIndex int + + name := p.Name + + // If name ends with a '.', the last field is anonymous. + // In this case, strings.Split will give us "" as the + // last element of our fields slice, which will match the "" + // field name in the substruct codec. + fields := strings.Split(name, ".") + + for len(fields) > 0 { + var decoder fieldCodec + var ok bool + + // Cut off the last field (delimited by ".") and find its parent + // in the codec. + // eg. for name "A.B.C.D", split off "A.B.C" and try to + // find a field in the codec with this name. + // Loop again with "A.B", etc. + for i := len(fields); i > 0; i-- { + parent := strings.Join(fields[:i], ".") + decoder, ok = codec.fields[parent] + if ok { + fields = fields[i:] + break + } + } + + // If we never found a matching field in the codec, return + // error message. + if !ok { + return "no such struct field" + } + + v = initField(structValue, decoder.path) + if !v.IsValid() { + return "no such struct field" + } + if !v.CanSet() { + return "cannot set struct field" + } + + if decoder.structCodec != nil { + codec = decoder.structCodec + structValue = v + } + + if v.Kind() == reflect.Slice && v.Type() != typeOfByteSlice { + if l.m == nil { + l.m = make(map[string]int) + } + sliceIndex = l.m[p.Name] + l.m[p.Name] = sliceIndex + 1 + for v.Len() <= sliceIndex { + v.Set(reflect.Append(v, reflect.New(v.Type().Elem()).Elem())) + } + structValue = v.Index(sliceIndex) + requireSlice = false + } + } + + var slice reflect.Value + if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 { + slice = v + v = reflect.New(v.Type().Elem()).Elem() + } else if requireSlice { + return "multiple-valued property requires a slice field type" + } + + // Convert indexValues to a Go value with a meaning derived from the + // destination type. + pValue := p.Value + if iv, ok := pValue.(indexValue); ok { + meaning := pb.Property_NO_MEANING + switch v.Type() { + case typeOfBlobKey: + meaning = pb.Property_BLOBKEY + case typeOfByteSlice: + meaning = pb.Property_BLOB + case typeOfByteString: + meaning = pb.Property_BYTESTRING + case typeOfGeoPoint: + meaning = pb.Property_GEORSS_POINT + case typeOfTime: + meaning = pb.Property_GD_WHEN + case typeOfEntityPtr: + meaning = pb.Property_ENTITY_PROTO + } + var err error + pValue, err = propValue(iv.value, meaning) + if err != nil { + return err.Error() + } + } + + if errReason := setVal(v, pValue); errReason != "" { + // Set the slice back to its zero value. + if slice.IsValid() { + slice.Set(reflect.Zero(slice.Type())) + } + return errReason + } + + if slice.IsValid() { + slice.Index(sliceIndex).Set(v) + } + + return "" +} + +// setVal sets v to the value pValue. +func setVal(v reflect.Value, pValue interface{}) string { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + x, ok := pValue.(int64) + if !ok && pValue != nil { + return typeMismatchReason(pValue, v) + } + if v.OverflowInt(x) { + return fmt.Sprintf("value %v overflows struct field of type %v", x, v.Type()) + } + v.SetInt(x) + case reflect.Bool: + x, ok := pValue.(bool) + if !ok && pValue != nil { + return typeMismatchReason(pValue, v) + } + v.SetBool(x) + case reflect.String: + switch x := pValue.(type) { + case appengine.BlobKey: + v.SetString(string(x)) + case ByteString: + v.SetString(string(x)) + case string: + v.SetString(x) + default: + if pValue != nil { + return typeMismatchReason(pValue, v) + } + } + case reflect.Float32, reflect.Float64: + x, ok := pValue.(float64) + if !ok && pValue != nil { + return typeMismatchReason(pValue, v) + } + if v.OverflowFloat(x) { + return fmt.Sprintf("value %v overflows struct field of type %v", x, v.Type()) + } + v.SetFloat(x) + case reflect.Ptr: + x, ok := pValue.(*Key) + if !ok && pValue != nil { + return typeMismatchReason(pValue, v) + } + if _, ok := v.Interface().(*Key); !ok { + return typeMismatchReason(pValue, v) + } + v.Set(reflect.ValueOf(x)) + case reflect.Struct: + switch v.Type() { + case typeOfTime: + x, ok := pValue.(time.Time) + if !ok && pValue != nil { + return typeMismatchReason(pValue, v) + } + v.Set(reflect.ValueOf(x)) + case typeOfGeoPoint: + x, ok := pValue.(appengine.GeoPoint) + if !ok && pValue != nil { + return typeMismatchReason(pValue, v) + } + v.Set(reflect.ValueOf(x)) + default: + ent, ok := pValue.(*Entity) + if !ok { + return typeMismatchReason(pValue, v) + } + + // Recursively load nested struct + pls, err := newStructPLS(v.Addr().Interface()) + if err != nil { + return err.Error() + } + + // if ent has a Key value and our struct has a Key field, + // load the Entity's Key value into the Key field on the struct. + if ent.Key != nil && pls.codec.keyField != -1 { + + pls.v.Field(pls.codec.keyField).Set(reflect.ValueOf(ent.Key)) + } + + err = pls.Load(ent.Properties) + if err != nil { + return err.Error() + } + } + case reflect.Slice: + x, ok := pValue.([]byte) + if !ok { + if y, yok := pValue.(ByteString); yok { + x, ok = []byte(y), true + } + } + if !ok && pValue != nil { + return typeMismatchReason(pValue, v) + } + if v.Type().Elem().Kind() != reflect.Uint8 { + return typeMismatchReason(pValue, v) + } + v.SetBytes(x) + default: + return typeMismatchReason(pValue, v) + } + return "" +} + +// initField is similar to reflect's Value.FieldByIndex, in that it +// returns the nested struct field corresponding to index, but it +// initialises any nil pointers encountered when traversing the structure. +func initField(val reflect.Value, index []int) reflect.Value { + for _, i := range index[:len(index)-1] { + val = val.Field(i) + if val.Kind() == reflect.Ptr { + if val.IsNil() { + val.Set(reflect.New(val.Type().Elem())) + } + val = val.Elem() + } + } + return val.Field(index[len(index)-1]) +} + +// loadEntity loads an EntityProto into PropertyLoadSaver or struct pointer. +func loadEntity(dst interface{}, src *pb.EntityProto) (err error) { + ent, err := protoToEntity(src) + if err != nil { + return err + } + if e, ok := dst.(PropertyLoadSaver); ok { + return e.Load(ent.Properties) + } + return LoadStruct(dst, ent.Properties) +} + +func (s structPLS) Load(props []Property) error { + var fieldName, reason string + var l propertyLoader + for _, p := range props { + if errStr := l.load(s.codec, s.v, p, p.Multiple); errStr != "" { + // We don't return early, as we try to load as many properties as possible. + // It is valid to load an entity into a struct that cannot fully represent it. + // That case returns an error, but the caller is free to ignore it. + fieldName, reason = p.Name, errStr + } + } + if reason != "" { + return &ErrFieldMismatch{ + StructType: s.v.Type(), + FieldName: fieldName, + Reason: reason, + } + } + return nil +} + +func protoToEntity(src *pb.EntityProto) (*Entity, error) { + props, rawProps := src.Property, src.RawProperty + outProps := make([]Property, 0, len(props)+len(rawProps)) + for { + var ( + x *pb.Property + noIndex bool + ) + if len(props) > 0 { + x, props = props[0], props[1:] + } else if len(rawProps) > 0 { + x, rawProps = rawProps[0], rawProps[1:] + noIndex = true + } else { + break + } + + var value interface{} + if x.Meaning != nil && *x.Meaning == pb.Property_INDEX_VALUE { + value = indexValue{x.Value} + } else { + var err error + value, err = propValue(x.Value, x.GetMeaning()) + if err != nil { + return nil, err + } + } + outProps = append(outProps, Property{ + Name: x.GetName(), + Value: value, + NoIndex: noIndex, + Multiple: x.GetMultiple(), + }) + } + + var key *Key + if src.Key != nil { + // Ignore any error, since nested entity values + // are allowed to have an invalid key. + key, _ = protoToKey(src.Key) + } + return &Entity{key, outProps}, nil +} + +// propValue returns a Go value that combines the raw PropertyValue with a +// meaning. For example, an Int64Value with GD_WHEN becomes a time.Time. +func propValue(v *pb.PropertyValue, m pb.Property_Meaning) (interface{}, error) { + switch { + case v.Int64Value != nil: + if m == pb.Property_GD_WHEN { + return fromUnixMicro(*v.Int64Value), nil + } else { + return *v.Int64Value, nil + } + case v.BooleanValue != nil: + return *v.BooleanValue, nil + case v.StringValue != nil: + if m == pb.Property_BLOB { + return []byte(*v.StringValue), nil + } else if m == pb.Property_BLOBKEY { + return appengine.BlobKey(*v.StringValue), nil + } else if m == pb.Property_BYTESTRING { + return ByteString(*v.StringValue), nil + } else if m == pb.Property_ENTITY_PROTO { + var ent pb.EntityProto + err := proto.Unmarshal([]byte(*v.StringValue), &ent) + if err != nil { + return nil, err + } + return protoToEntity(&ent) + } else { + return *v.StringValue, nil + } + case v.DoubleValue != nil: + return *v.DoubleValue, nil + case v.Referencevalue != nil: + key, err := referenceValueToKey(v.Referencevalue) + if err != nil { + return nil, err + } + return key, nil + case v.Pointvalue != nil: + // NOTE: Strangely, latitude maps to X, longitude to Y. + return appengine.GeoPoint{Lat: v.Pointvalue.GetX(), Lng: v.Pointvalue.GetY()}, nil + } + return nil, nil +} + +// indexValue is a Property value that is created when entities are loaded from +// an index, such as from a projection query. +// +// Such Property values do not contain all of the metadata required to be +// faithfully represented as a Go value, and are instead represented as an +// opaque indexValue. Load the properties into a concrete struct type (e.g. by +// passing a struct pointer to Iterator.Next) to reconstruct actual Go values +// of type int, string, time.Time, etc. +type indexValue struct { + value *pb.PropertyValue +} diff --git a/vendor/google.golang.org/appengine/datastore/load_test.go b/vendor/google.golang.org/appengine/datastore/load_test.go new file mode 100644 index 000000000..46029bba5 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/load_test.go @@ -0,0 +1,656 @@ +// Copyright 2016 Google Inc. All Rights Reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "reflect" + "testing" + + proto "github.com/golang/protobuf/proto" + pb "google.golang.org/appengine/internal/datastore" +) + +type Simple struct { + I int64 +} + +type SimpleWithTag struct { + I int64 `datastore:"II"` +} + +type NestedSimpleWithTag struct { + A SimpleWithTag `datastore:"AA"` +} + +type NestedSliceOfSimple struct { + A []Simple +} + +type SimpleTwoFields struct { + S string + SS string +} + +type NestedSimpleAnonymous struct { + Simple + X string +} + +type NestedSimple struct { + A Simple + I int64 +} + +type NestedSimple1 struct { + A Simple + X string +} + +type NestedSimple2X struct { + AA NestedSimple + A SimpleTwoFields + S string +} + +type BDotB struct { + B string `datastore:"B.B"` +} + +type ABDotB struct { + A BDotB +} + +type MultiAnonymous struct { + Simple + SimpleTwoFields + X string +} + +var ( + // these values need to be addressable + testString2 = "two" + testString3 = "three" + testInt64 = int64(2) + + fieldNameI = "I" + fieldNameX = "X" + fieldNameS = "S" + fieldNameSS = "SS" + fieldNameADotI = "A.I" + fieldNameAADotII = "AA.II" + fieldNameADotBDotB = "A.B.B" +) + +func TestLoadEntityNestedLegacy(t *testing.T) { + testCases := []struct { + desc string + src *pb.EntityProto + want interface{} + }{ + { + "nested", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameX, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + }, + &pb.Property{ + Name: &fieldNameADotI, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + }, + }, + }, + &NestedSimple1{ + A: Simple{I: testInt64}, + X: testString2, + }, + }, + { + "nested with tag", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameAADotII, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + }, + }, + }, + &NestedSimpleWithTag{ + A: SimpleWithTag{I: testInt64}, + }, + }, + { + "nested with anonymous struct field", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameX, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + }, + &pb.Property{ + Name: &fieldNameI, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + }, + }, + }, + &NestedSimpleAnonymous{ + Simple: Simple{I: testInt64}, + X: testString2, + }, + }, + { + "nested with dotted field tag", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameADotBDotB, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + }, + }, + }, + &ABDotB{ + A: BDotB{ + B: testString2, + }, + }, + }, + { + "nested with dotted field tag", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameI, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + }, + &pb.Property{ + Name: &fieldNameS, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + }, + &pb.Property{ + Name: &fieldNameSS, + Value: &pb.PropertyValue{ + StringValue: &testString3, + }, + }, + &pb.Property{ + Name: &fieldNameX, + Value: &pb.PropertyValue{ + StringValue: &testString3, + }, + }, + }, + }, + &MultiAnonymous{ + Simple: Simple{I: testInt64}, + SimpleTwoFields: SimpleTwoFields{S: "two", SS: "three"}, + X: "three", + }, + }, + } + + for _, tc := range testCases { + dst := reflect.New(reflect.TypeOf(tc.want).Elem()).Interface() + err := loadEntity(dst, tc.src) + if err != nil { + t.Errorf("loadEntity: %s: %v", tc.desc, err) + continue + } + + if !reflect.DeepEqual(tc.want, dst) { + t.Errorf("%s: compare:\ngot: %#v\nwant: %#v", tc.desc, dst, tc.want) + } + } +} + +type WithKey struct { + X string + I int64 + K *Key `datastore:"__key__"` +} + +type NestedWithKey struct { + N WithKey + Y string +} + +var ( + incompleteKey = newKey("", nil) + invalidKey = newKey("s", incompleteKey) + + // these values need to be addressable + fieldNameA = "A" + fieldNameK = "K" + fieldNameN = "N" + fieldNameY = "Y" + fieldNameAA = "AA" + fieldNameII = "II" + fieldNameBDotB = "B.B" + + entityProtoMeaning = pb.Property_ENTITY_PROTO + + TRUE = true + FALSE = false +) + +var ( + simpleEntityProto, nestedSimpleEntityProto, + simpleTwoFieldsEntityProto, simpleWithTagEntityProto, + bDotBEntityProto, withKeyEntityProto string +) + +func init() { + // simpleEntityProto corresponds to: + // Simple{I: testInt64} + simpleEntityProtob, err := proto.Marshal(&pb.EntityProto{ + Key: keyToProto("", incompleteKey), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameI, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + Multiple: &FALSE, + }, + }, + EntityGroup: &pb.Path{}, + }) + if err != nil { + panic(err) + } + simpleEntityProto = string(simpleEntityProtob) + + // nestedSimpleEntityProto corresponds to: + // NestedSimple{ + // A: Simple{I: testInt64}, + // I: testInt64, + // } + nestedSimpleEntityProtob, err := proto.Marshal(&pb.EntityProto{ + Key: keyToProto("", incompleteKey), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameA, + Meaning: &entityProtoMeaning, + Value: &pb.PropertyValue{ + StringValue: &simpleEntityProto, + }, + Multiple: &FALSE, + }, + &pb.Property{ + Name: &fieldNameI, + Meaning: &entityProtoMeaning, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + Multiple: &FALSE, + }, + }, + EntityGroup: &pb.Path{}, + }) + if err != nil { + panic(err) + } + nestedSimpleEntityProto = string(nestedSimpleEntityProtob) + + // simpleTwoFieldsEntityProto corresponds to: + // SimpleTwoFields{S: testString2, SS: testString3} + simpleTwoFieldsEntityProtob, err := proto.Marshal(&pb.EntityProto{ + Key: keyToProto("", incompleteKey), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameS, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + Multiple: &FALSE, + }, + &pb.Property{ + Name: &fieldNameSS, + Value: &pb.PropertyValue{ + StringValue: &testString3, + }, + Multiple: &FALSE, + }, + }, + EntityGroup: &pb.Path{}, + }) + if err != nil { + panic(err) + } + simpleTwoFieldsEntityProto = string(simpleTwoFieldsEntityProtob) + + // simpleWithTagEntityProto corresponds to: + // SimpleWithTag{I: testInt64} + simpleWithTagEntityProtob, err := proto.Marshal(&pb.EntityProto{ + Key: keyToProto("", incompleteKey), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameII, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + Multiple: &FALSE, + }, + }, + EntityGroup: &pb.Path{}, + }) + if err != nil { + panic(err) + } + simpleWithTagEntityProto = string(simpleWithTagEntityProtob) + + // bDotBEntityProto corresponds to: + // BDotB{ + // B: testString2, + // } + bDotBEntityProtob, err := proto.Marshal(&pb.EntityProto{ + Key: keyToProto("", incompleteKey), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameBDotB, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + Multiple: &FALSE, + }, + }, + EntityGroup: &pb.Path{}, + }) + if err != nil { + panic(err) + } + bDotBEntityProto = string(bDotBEntityProtob) + + // withKeyEntityProto corresponds to: + // WithKey{ + // X: testString3, + // I: testInt64, + // K: testKey1a, + // } + withKeyEntityProtob, err := proto.Marshal(&pb.EntityProto{ + Key: keyToProto("", testKey1a), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameX, + Value: &pb.PropertyValue{ + StringValue: &testString3, + }, + Multiple: &FALSE, + }, + &pb.Property{ + Name: &fieldNameI, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + Multiple: &FALSE, + }, + }, + EntityGroup: &pb.Path{}, + }) + if err != nil { + panic(err) + } + withKeyEntityProto = string(withKeyEntityProtob) + +} + +func TestLoadEntityNested(t *testing.T) { + testCases := []struct { + desc string + src *pb.EntityProto + want interface{} + }{ + { + "nested basic", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameA, + Meaning: &entityProtoMeaning, + Value: &pb.PropertyValue{ + StringValue: &simpleEntityProto, + }, + }, + &pb.Property{ + Name: &fieldNameI, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + }, + }, + }, + &NestedSimple{ + A: Simple{I: 2}, + I: 2, + }, + }, + { + "nested with struct tags", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameAA, + Meaning: &entityProtoMeaning, + Value: &pb.PropertyValue{ + StringValue: &simpleWithTagEntityProto, + }, + }, + }, + }, + &NestedSimpleWithTag{ + A: SimpleWithTag{I: testInt64}, + }, + }, + { + "nested 2x", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameAA, + Meaning: &entityProtoMeaning, + Value: &pb.PropertyValue{ + StringValue: &nestedSimpleEntityProto, + }, + }, + &pb.Property{ + Name: &fieldNameA, + Meaning: &entityProtoMeaning, + Value: &pb.PropertyValue{ + StringValue: &simpleTwoFieldsEntityProto, + }, + }, + &pb.Property{ + Name: &fieldNameS, + Value: &pb.PropertyValue{ + StringValue: &testString3, + }, + }, + }, + }, + &NestedSimple2X{ + AA: NestedSimple{ + A: Simple{I: testInt64}, + I: testInt64, + }, + A: SimpleTwoFields{S: testString2, SS: testString3}, + S: testString3, + }, + }, + { + "nested anonymous", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameI, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + }, + &pb.Property{ + Name: &fieldNameX, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + }, + }, + }, + &NestedSimpleAnonymous{ + Simple: Simple{I: testInt64}, + X: testString2, + }, + }, + { + "nested simple with slice", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameA, + Meaning: &entityProtoMeaning, + Multiple: &TRUE, + Value: &pb.PropertyValue{ + StringValue: &simpleEntityProto, + }, + }, + &pb.Property{ + Name: &fieldNameA, + Meaning: &entityProtoMeaning, + Multiple: &TRUE, + Value: &pb.PropertyValue{ + StringValue: &simpleEntityProto, + }, + }, + }, + }, + &NestedSliceOfSimple{ + A: []Simple{Simple{I: testInt64}, Simple{I: testInt64}}, + }, + }, + { + "nested with multiple anonymous fields", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameI, + Value: &pb.PropertyValue{ + Int64Value: &testInt64, + }, + }, + &pb.Property{ + Name: &fieldNameS, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + }, + &pb.Property{ + Name: &fieldNameSS, + Value: &pb.PropertyValue{ + StringValue: &testString3, + }, + }, + &pb.Property{ + Name: &fieldNameX, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + }, + }, + }, + &MultiAnonymous{ + Simple: Simple{I: testInt64}, + SimpleTwoFields: SimpleTwoFields{S: testString2, SS: testString3}, + X: testString2, + }, + }, + { + "nested with dotted field tag", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameA, + Meaning: &entityProtoMeaning, + Value: &pb.PropertyValue{ + StringValue: &bDotBEntityProto, + }, + }, + }, + }, + &ABDotB{ + A: BDotB{ + B: testString2, + }, + }, + }, + { + "nested entity with key", + &pb.EntityProto{ + Key: keyToProto("some-app-id", testKey0), + Property: []*pb.Property{ + &pb.Property{ + Name: &fieldNameY, + Value: &pb.PropertyValue{ + StringValue: &testString2, + }, + }, + &pb.Property{ + Name: &fieldNameN, + Meaning: &entityProtoMeaning, + Value: &pb.PropertyValue{ + StringValue: &withKeyEntityProto, + }, + }, + }, + }, + &NestedWithKey{ + Y: testString2, + N: WithKey{ + X: testString3, + I: testInt64, + K: testKey1a, + }, + }, + }, + } + + for _, tc := range testCases { + dst := reflect.New(reflect.TypeOf(tc.want).Elem()).Interface() + err := loadEntity(dst, tc.src) + if err != nil { + t.Errorf("loadEntity: %s: %v", tc.desc, err) + continue + } + + if !reflect.DeepEqual(tc.want, dst) { + t.Errorf("%s: compare:\ngot: %#v\nwant: %#v", tc.desc, dst, tc.want) + } + } +} diff --git a/vendor/google.golang.org/appengine/datastore/metadata.go b/vendor/google.golang.org/appengine/datastore/metadata.go new file mode 100644 index 000000000..6acacc3db --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/metadata.go @@ -0,0 +1,78 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import "golang.org/x/net/context" + +// Datastore kinds for the metadata entities. +const ( + namespaceKind = "__namespace__" + kindKind = "__kind__" + propertyKind = "__property__" +) + +// Namespaces returns all the datastore namespaces. +func Namespaces(ctx context.Context) ([]string, error) { + // TODO(djd): Support range queries. + q := NewQuery(namespaceKind).KeysOnly() + keys, err := q.GetAll(ctx, nil) + if err != nil { + return nil, err + } + // The empty namespace key uses a numeric ID (==1), but luckily + // the string ID defaults to "" for numeric IDs anyway. + return keyNames(keys), nil +} + +// Kinds returns the names of all the kinds in the current namespace. +func Kinds(ctx context.Context) ([]string, error) { + // TODO(djd): Support range queries. + q := NewQuery(kindKind).KeysOnly() + keys, err := q.GetAll(ctx, nil) + if err != nil { + return nil, err + } + return keyNames(keys), nil +} + +// keyNames returns a slice of the provided keys' names (string IDs). +func keyNames(keys []*Key) []string { + n := make([]string, 0, len(keys)) + for _, k := range keys { + n = append(n, k.StringID()) + } + return n +} + +// KindProperties returns all the indexed properties for the given kind. +// The properties are returned as a map of property names to a slice of the +// representation types. The representation types for the supported Go property +// types are: +// "INT64": signed integers and time.Time +// "DOUBLE": float32 and float64 +// "BOOLEAN": bool +// "STRING": string, []byte and ByteString +// "POINT": appengine.GeoPoint +// "REFERENCE": *Key +// "USER": (not used in the Go runtime) +func KindProperties(ctx context.Context, kind string) (map[string][]string, error) { + // TODO(djd): Support range queries. + kindKey := NewKey(ctx, kindKind, kind, 0, nil) + q := NewQuery(propertyKind).Ancestor(kindKey) + + propMap := map[string][]string{} + props := []struct { + Repr []string `datastore:"property_representation"` + }{} + + keys, err := q.GetAll(ctx, &props) + if err != nil { + return nil, err + } + for i, p := range props { + propMap[keys[i].StringID()] = p.Repr + } + return propMap, nil +} diff --git a/vendor/google.golang.org/appengine/datastore/prop.go b/vendor/google.golang.org/appengine/datastore/prop.go new file mode 100644 index 000000000..5cb2079d8 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/prop.go @@ -0,0 +1,330 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "fmt" + "reflect" + "strings" + "sync" + "unicode" +) + +// Entities with more than this many indexed properties will not be saved. +const maxIndexedProperties = 20000 + +// []byte fields more than 1 megabyte long will not be loaded or saved. +const maxBlobLen = 1 << 20 + +// Property is a name/value pair plus some metadata. A datastore entity's +// contents are loaded and saved as a sequence of Properties. An entity can +// have multiple Properties with the same name, provided that p.Multiple is +// true on all of that entity's Properties with that name. +type Property struct { + // Name is the property name. + Name string + // Value is the property value. The valid types are: + // - int64 + // - bool + // - string + // - float64 + // - ByteString + // - *Key + // - time.Time + // - appengine.BlobKey + // - appengine.GeoPoint + // - []byte (up to 1 megabyte in length) + // - *Entity (representing a nested struct) + // This set is smaller than the set of valid struct field types that the + // datastore can load and save. A Property Value cannot be a slice (apart + // from []byte); use multiple Properties instead. Also, a Value's type + // must be explicitly on the list above; it is not sufficient for the + // underlying type to be on that list. For example, a Value of "type + // myInt64 int64" is invalid. Smaller-width integers and floats are also + // invalid. Again, this is more restrictive than the set of valid struct + // field types. + // + // A Value will have an opaque type when loading entities from an index, + // such as via a projection query. Load entities into a struct instead + // of a PropertyLoadSaver when using a projection query. + // + // A Value may also be the nil interface value; this is equivalent to + // Python's None but not directly representable by a Go struct. Loading + // a nil-valued property into a struct will set that field to the zero + // value. + Value interface{} + // NoIndex is whether the datastore cannot index this property. + NoIndex bool + // Multiple is whether the entity can have multiple properties with + // the same name. Even if a particular instance only has one property with + // a certain name, Multiple should be true if a struct would best represent + // it as a field of type []T instead of type T. + Multiple bool +} + +// An Entity is the value type for a nested struct. +// This type is only used for a Property's Value. +type Entity struct { + Key *Key + Properties []Property +} + +// ByteString is a short byte slice (up to 1500 bytes) that can be indexed. +type ByteString []byte + +// PropertyLoadSaver can be converted from and to a slice of Properties. +type PropertyLoadSaver interface { + Load([]Property) error + Save() ([]Property, error) +} + +// PropertyList converts a []Property to implement PropertyLoadSaver. +type PropertyList []Property + +var ( + typeOfPropertyLoadSaver = reflect.TypeOf((*PropertyLoadSaver)(nil)).Elem() + typeOfPropertyList = reflect.TypeOf(PropertyList(nil)) +) + +// Load loads all of the provided properties into l. +// It does not first reset *l to an empty slice. +func (l *PropertyList) Load(p []Property) error { + *l = append(*l, p...) + return nil +} + +// Save saves all of l's properties as a slice or Properties. +func (l *PropertyList) Save() ([]Property, error) { + return *l, nil +} + +// validPropertyName returns whether name consists of one or more valid Go +// identifiers joined by ".". +func validPropertyName(name string) bool { + if name == "" { + return false + } + for _, s := range strings.Split(name, ".") { + if s == "" { + return false + } + first := true + for _, c := range s { + if first { + first = false + if c != '_' && !unicode.IsLetter(c) { + return false + } + } else { + if c != '_' && !unicode.IsLetter(c) && !unicode.IsDigit(c) { + return false + } + } + } + } + return true +} + +// structCodec describes how to convert a struct to and from a sequence of +// properties. +type structCodec struct { + // fields gives the field codec for the structTag with the given name. + fields map[string]fieldCodec + // hasSlice is whether a struct or any of its nested or embedded structs + // has a slice-typed field (other than []byte). + hasSlice bool + // keyField is the index of a *Key field with structTag __key__. + // This field is not relevant for the top level struct, only for + // nested structs. + keyField int + // complete is whether the structCodec is complete. An incomplete + // structCodec may be encountered when walking a recursive struct. + complete bool +} + +// fieldCodec is a struct field's index and, if that struct field's type is +// itself a struct, that substruct's structCodec. +type fieldCodec struct { + // path is the index path to the field + path []int + noIndex bool + // omitEmpty indicates that the field should be omitted on save + // if empty. + omitEmpty bool + // structCodec is the codec fot the struct field at index 'path', + // or nil if the field is not a struct. + structCodec *structCodec +} + +// structCodecs collects the structCodecs that have already been calculated. +var ( + structCodecsMutex sync.Mutex + structCodecs = make(map[reflect.Type]*structCodec) +) + +// getStructCodec returns the structCodec for the given struct type. +func getStructCodec(t reflect.Type) (*structCodec, error) { + structCodecsMutex.Lock() + defer structCodecsMutex.Unlock() + return getStructCodecLocked(t) +} + +// getStructCodecLocked implements getStructCodec. The structCodecsMutex must +// be held when calling this function. +func getStructCodecLocked(t reflect.Type) (ret *structCodec, retErr error) { + c, ok := structCodecs[t] + if ok { + return c, nil + } + c = &structCodec{ + fields: make(map[string]fieldCodec), + // We initialize keyField to -1 so that the zero-value is not + // misinterpreted as index 0. + keyField: -1, + } + + // Add c to the structCodecs map before we are sure it is good. If t is + // a recursive type, it needs to find the incomplete entry for itself in + // the map. + structCodecs[t] = c + defer func() { + if retErr != nil { + delete(structCodecs, t) + } + }() + + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + // Skip unexported fields. + // Note that if f is an anonymous, unexported struct field, + // we will promote its fields. + if f.PkgPath != "" && !f.Anonymous { + continue + } + + tags := strings.Split(f.Tag.Get("datastore"), ",") + name := tags[0] + opts := make(map[string]bool) + for _, t := range tags[1:] { + opts[t] = true + } + switch { + case name == "": + if !f.Anonymous { + name = f.Name + } + case name == "-": + continue + case name == "__key__": + if f.Type != typeOfKeyPtr { + return nil, fmt.Errorf("datastore: __key__ field on struct %v is not a *datastore.Key", t) + } + c.keyField = i + case !validPropertyName(name): + return nil, fmt.Errorf("datastore: struct tag has invalid property name: %q", name) + } + + substructType, fIsSlice := reflect.Type(nil), false + switch f.Type.Kind() { + case reflect.Struct: + substructType = f.Type + case reflect.Slice: + if f.Type.Elem().Kind() == reflect.Struct { + substructType = f.Type.Elem() + } + fIsSlice = f.Type != typeOfByteSlice + c.hasSlice = c.hasSlice || fIsSlice + } + + var sub *structCodec + if substructType != nil && substructType != typeOfTime && substructType != typeOfGeoPoint { + var err error + sub, err = getStructCodecLocked(substructType) + if err != nil { + return nil, err + } + if !sub.complete { + return nil, fmt.Errorf("datastore: recursive struct: field %q", f.Name) + } + if fIsSlice && sub.hasSlice { + return nil, fmt.Errorf( + "datastore: flattening nested structs leads to a slice of slices: field %q", f.Name) + } + c.hasSlice = c.hasSlice || sub.hasSlice + // If f is an anonymous struct field, we promote the substruct's fields up to this level + // in the linked list of struct codecs. + if f.Anonymous { + for subname, subfield := range sub.fields { + if name != "" { + subname = name + "." + subname + } + if _, ok := c.fields[subname]; ok { + return nil, fmt.Errorf("datastore: struct tag has repeated property name: %q", subname) + } + c.fields[subname] = fieldCodec{ + path: append([]int{i}, subfield.path...), + noIndex: subfield.noIndex || opts["noindex"], + omitEmpty: subfield.omitEmpty, + structCodec: subfield.structCodec, + } + } + continue + } + } + + if _, ok := c.fields[name]; ok { + return nil, fmt.Errorf("datastore: struct tag has repeated property name: %q", name) + } + c.fields[name] = fieldCodec{ + path: []int{i}, + noIndex: opts["noindex"], + omitEmpty: opts["omitempty"], + structCodec: sub, + } + } + c.complete = true + return c, nil +} + +// structPLS adapts a struct to be a PropertyLoadSaver. +type structPLS struct { + v reflect.Value + codec *structCodec +} + +// newStructPLS returns a structPLS, which implements the +// PropertyLoadSaver interface, for the struct pointer p. +func newStructPLS(p interface{}) (*structPLS, error) { + v := reflect.ValueOf(p) + if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct { + return nil, ErrInvalidEntityType + } + v = v.Elem() + codec, err := getStructCodec(v.Type()) + if err != nil { + return nil, err + } + return &structPLS{v, codec}, nil +} + +// LoadStruct loads the properties from p to dst. +// dst must be a struct pointer. +func LoadStruct(dst interface{}, p []Property) error { + x, err := newStructPLS(dst) + if err != nil { + return err + } + return x.Load(p) +} + +// SaveStruct returns the properties from src as a slice of Properties. +// src must be a struct pointer. +func SaveStruct(src interface{}) ([]Property, error) { + x, err := newStructPLS(src) + if err != nil { + return nil, err + } + return x.Save() +} diff --git a/vendor/google.golang.org/appengine/datastore/prop_test.go b/vendor/google.golang.org/appengine/datastore/prop_test.go new file mode 100644 index 000000000..646a18f00 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/prop_test.go @@ -0,0 +1,672 @@ +// Copyright 2011 Google Inc. All Rights Reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "reflect" + "sort" + "testing" + "time" + + "google.golang.org/appengine" +) + +func TestValidPropertyName(t *testing.T) { + testCases := []struct { + name string + want bool + }{ + // Invalid names. + {"", false}, + {"'", false}, + {".", false}, + {"..", false}, + {".foo", false}, + {"0", false}, + {"00", false}, + {"X.X.4.X.X", false}, + {"\n", false}, + {"\x00", false}, + {"abc\xffz", false}, + {"foo.", false}, + {"foo..", false}, + {"foo..bar", false}, + {"☃", false}, + {`"`, false}, + // Valid names. + {"AB", true}, + {"Abc", true}, + {"X.X.X.X.X", true}, + {"_", true}, + {"_0", true}, + {"a", true}, + {"a_B", true}, + {"f00", true}, + {"f0o", true}, + {"fo0", true}, + {"foo", true}, + {"foo.bar", true}, + {"foo.bar.baz", true}, + {"世界", true}, + } + for _, tc := range testCases { + got := validPropertyName(tc.name) + if got != tc.want { + t.Errorf("%q: got %v, want %v", tc.name, got, tc.want) + } + } +} + +func TestStructCodec(t *testing.T) { + type oStruct struct { + O int + } + type pStruct struct { + P int + Q int + } + type rStruct struct { + R int + S pStruct + T oStruct + oStruct + } + type uStruct struct { + U int + v int + } + type vStruct struct { + V string `datastore:",noindex"` + } + oStructCodec := &structCodec{ + fields: map[string]fieldCodec{ + "O": {path: []int{0}}, + }, + complete: true, + } + pStructCodec := &structCodec{ + fields: map[string]fieldCodec{ + "P": {path: []int{0}}, + "Q": {path: []int{1}}, + }, + complete: true, + } + rStructCodec := &structCodec{ + fields: map[string]fieldCodec{ + "R": {path: []int{0}}, + "S": {path: []int{1}, structCodec: pStructCodec}, + "T": {path: []int{2}, structCodec: oStructCodec}, + "O": {path: []int{3, 0}}, + }, + complete: true, + } + uStructCodec := &structCodec{ + fields: map[string]fieldCodec{ + "U": {path: []int{0}}, + }, + complete: true, + } + vStructCodec := &structCodec{ + fields: map[string]fieldCodec{ + "V": {path: []int{0}, noIndex: true}, + }, + complete: true, + } + + testCases := []struct { + desc string + structValue interface{} + want *structCodec + }{ + { + "oStruct", + oStruct{}, + oStructCodec, + }, + { + "pStruct", + pStruct{}, + pStructCodec, + }, + { + "rStruct", + rStruct{}, + rStructCodec, + }, + { + "uStruct", + uStruct{}, + uStructCodec, + }, + { + "non-basic fields", + struct { + B appengine.BlobKey + K *Key + T time.Time + }{}, + &structCodec{ + fields: map[string]fieldCodec{ + "B": {path: []int{0}}, + "K": {path: []int{1}}, + "T": {path: []int{2}}, + }, + complete: true, + }, + }, + { + "struct tags with ignored embed", + struct { + A int `datastore:"a,noindex"` + B int `datastore:"b"` + C int `datastore:",noindex"` + D int `datastore:""` + E int + I int `datastore:"-"` + J int `datastore:",noindex" json:"j"` + oStruct `datastore:"-"` + }{}, + &structCodec{ + fields: map[string]fieldCodec{ + "a": {path: []int{0}, noIndex: true}, + "b": {path: []int{1}}, + "C": {path: []int{2}, noIndex: true}, + "D": {path: []int{3}}, + "E": {path: []int{4}}, + "J": {path: []int{6}, noIndex: true}, + }, + complete: true, + }, + }, + { + "unexported fields", + struct { + A int + b int + C int `datastore:"x"` + d int `datastore:"Y"` + }{}, + &structCodec{ + fields: map[string]fieldCodec{ + "A": {path: []int{0}}, + "x": {path: []int{2}}, + }, + complete: true, + }, + }, + { + "nested and embedded structs", + struct { + A int + B int + CC oStruct + DDD rStruct + oStruct + }{}, + &structCodec{ + fields: map[string]fieldCodec{ + "A": {path: []int{0}}, + "B": {path: []int{1}}, + "CC": {path: []int{2}, structCodec: oStructCodec}, + "DDD": {path: []int{3}, structCodec: rStructCodec}, + "O": {path: []int{4, 0}}, + }, + complete: true, + }, + }, + { + "struct tags with nested and embedded structs", + struct { + A int `datastore:"-"` + B int `datastore:"w"` + C oStruct `datastore:"xx"` + D rStruct `datastore:"y"` + oStruct `datastore:"z"` + }{}, + &structCodec{ + fields: map[string]fieldCodec{ + "w": {path: []int{1}}, + "xx": {path: []int{2}, structCodec: oStructCodec}, + "y": {path: []int{3}, structCodec: rStructCodec}, + "z.O": {path: []int{4, 0}}, + }, + complete: true, + }, + }, + { + "unexported nested and embedded structs", + struct { + a int + B int + c uStruct + D uStruct + uStruct + }{}, + &structCodec{ + fields: map[string]fieldCodec{ + "B": {path: []int{1}}, + "D": {path: []int{3}, structCodec: uStructCodec}, + "U": {path: []int{4, 0}}, + }, + complete: true, + }, + }, + { + "noindex nested struct", + struct { + A oStruct `datastore:",noindex"` + }{}, + &structCodec{ + fields: map[string]fieldCodec{ + "A": {path: []int{0}, structCodec: oStructCodec, noIndex: true}, + }, + complete: true, + }, + }, + { + "noindex slice", + struct { + A []string `datastore:",noindex"` + }{}, + &structCodec{ + fields: map[string]fieldCodec{ + "A": {path: []int{0}, noIndex: true}, + }, + hasSlice: true, + complete: true, + }, + }, + { + "noindex embedded struct slice", + struct { + // vStruct has a single field, V, also with noindex. + A []vStruct `datastore:",noindex"` + }{}, + &structCodec{ + fields: map[string]fieldCodec{ + "A": {path: []int{0}, structCodec: vStructCodec, noIndex: true}, + }, + hasSlice: true, + complete: true, + }, + }, + } + + for _, tc := range testCases { + got, err := getStructCodec(reflect.TypeOf(tc.structValue)) + if err != nil { + t.Errorf("%s: getStructCodec: %v", tc.desc, err) + continue + } + // can't reflect.DeepEqual b/c element order in fields map may differ + if !isEqualStructCodec(got, tc.want) { + t.Errorf("%s\ngot %+v\nwant %+v\n", tc.desc, got, tc.want) + } + } +} + +func isEqualStructCodec(got, want *structCodec) bool { + if got.complete != want.complete { + return false + } + if got.hasSlice != want.hasSlice { + return false + } + if len(got.fields) != len(want.fields) { + return false + } + for name, wantF := range want.fields { + gotF := got.fields[name] + if !reflect.DeepEqual(wantF.path, gotF.path) { + return false + } + if wantF.noIndex != gotF.noIndex { + return false + } + if wantF.structCodec != nil { + if gotF.structCodec == nil { + return false + } + if !isEqualStructCodec(gotF.structCodec, wantF.structCodec) { + return false + } + } + } + + return true +} + +func TestRepeatedPropertyName(t *testing.T) { + good := []interface{}{ + struct { + A int `datastore:"-"` + }{}, + struct { + A int `datastore:"b"` + B int + }{}, + struct { + A int + B int `datastore:"B"` + }{}, + struct { + A int `datastore:"B"` + B int `datastore:"-"` + }{}, + struct { + A int `datastore:"-"` + B int `datastore:"A"` + }{}, + struct { + A int `datastore:"B"` + B int `datastore:"A"` + }{}, + struct { + A int `datastore:"B"` + B int `datastore:"C"` + C int `datastore:"A"` + }{}, + struct { + A int `datastore:"B"` + B int `datastore:"C"` + C int `datastore:"D"` + }{}, + } + bad := []interface{}{ + struct { + A int `datastore:"B"` + B int + }{}, + struct { + A int + B int `datastore:"A"` + }{}, + struct { + A int `datastore:"C"` + B int `datastore:"C"` + }{}, + struct { + A int `datastore:"B"` + B int `datastore:"C"` + C int `datastore:"B"` + }{}, + } + testGetStructCodec(t, good, bad) +} + +func TestFlatteningNestedStructs(t *testing.T) { + type DeepGood struct { + A struct { + B []struct { + C struct { + D int + } + } + } + } + type DeepBad struct { + A struct { + B []struct { + C struct { + D []int + } + } + } + } + type ISay struct { + Tomato int + } + type YouSay struct { + Tomato int + } + type Tweedledee struct { + Dee int `datastore:"D"` + } + type Tweedledum struct { + Dum int `datastore:"D"` + } + + good := []interface{}{ + struct { + X []struct { + Y string + } + }{}, + struct { + X []struct { + Y []byte + } + }{}, + struct { + P []int + X struct { + Y []int + } + }{}, + struct { + X struct { + Y []int + } + Q []int + }{}, + struct { + P []int + X struct { + Y []int + } + Q []int + }{}, + struct { + DeepGood + }{}, + struct { + DG DeepGood + }{}, + struct { + Foo struct { + Z int + } `datastore:"A"` + Bar struct { + Z int + } `datastore:"B"` + }{}, + } + bad := []interface{}{ + struct { + X []struct { + Y []string + } + }{}, + struct { + X []struct { + Y []int + } + }{}, + struct { + DeepBad + }{}, + struct { + DB DeepBad + }{}, + struct { + ISay + YouSay + }{}, + struct { + Tweedledee + Tweedledum + }{}, + struct { + Foo struct { + Z int + } `datastore:"A"` + Bar struct { + Z int + } `datastore:"A"` + }{}, + } + testGetStructCodec(t, good, bad) +} + +func testGetStructCodec(t *testing.T, good []interface{}, bad []interface{}) { + for _, x := range good { + if _, err := getStructCodec(reflect.TypeOf(x)); err != nil { + t.Errorf("type %T: got non-nil error (%s), want nil", x, err) + } + } + for _, x := range bad { + if _, err := getStructCodec(reflect.TypeOf(x)); err == nil { + t.Errorf("type %T: got nil error, want non-nil", x) + } + } +} + +func TestNilKeyIsStored(t *testing.T) { + x := struct { + K *Key + I int + }{} + p := PropertyList{} + // Save x as properties. + p1, _ := SaveStruct(&x) + p.Load(p1) + // Set x's fields to non-zero. + x.K = &Key{} + x.I = 2 + // Load x from properties. + p2, _ := p.Save() + LoadStruct(&x, p2) + // Check that x's fields were set to zero. + if x.K != nil { + t.Errorf("K field was not zero") + } + if x.I != 0 { + t.Errorf("I field was not zero") + } +} + +func TestSaveStructOmitEmpty(t *testing.T) { + // Expected props names are sorted alphabetically + expectedPropNamesForSingles := []string{"EmptyValue", "NonEmptyValue", "OmitEmptyWithValue"} + expectedPropNamesForSlices := []string{"NonEmptyValue", "NonEmptyValue", "OmitEmptyWithValue", "OmitEmptyWithValue"} + + testOmitted := func(expectedPropNames []string, src interface{}) { + // t.Helper() - this is available from Go version 1.9, but we also support Go versions 1.6, 1.7, 1.8 + if props, err := SaveStruct(src); err != nil { + t.Fatal(err) + } else { + // Collect names for reporting if diffs from expected and for easier sorting + actualPropNames := make([]string, len(props)) + for i := range props { + actualPropNames[i] = props[i].Name + } + // Sort actuals for comparing with already sorted expected names + sort.Sort(sort.StringSlice(actualPropNames)) + if !reflect.DeepEqual(actualPropNames, expectedPropNames) { + t.Errorf("Expected this properties: %v, got: %v", expectedPropNames, actualPropNames) + } + } + } + + testOmitted(expectedPropNamesForSingles, &struct { + EmptyValue int + NonEmptyValue int + OmitEmptyNoValue int `datastore:",omitempty"` + OmitEmptyWithValue int `datastore:",omitempty"` + }{ + NonEmptyValue: 1, + OmitEmptyWithValue: 2, + }) + + testOmitted(expectedPropNamesForSlices, &struct { + EmptyValue []int + NonEmptyValue []int + OmitEmptyNoValue []int `datastore:",omitempty"` + OmitEmptyWithValue []int `datastore:",omitempty"` + }{ + NonEmptyValue: []int{1, 2}, + OmitEmptyWithValue: []int{3, 4}, + }) + + testOmitted(expectedPropNamesForSingles, &struct { + EmptyValue bool + NonEmptyValue bool + OmitEmptyNoValue bool `datastore:",omitempty"` + OmitEmptyWithValue bool `datastore:",omitempty"` + }{ + NonEmptyValue: true, + OmitEmptyWithValue: true, + }) + + testOmitted(expectedPropNamesForSlices, &struct { + EmptyValue []bool + NonEmptyValue []bool + OmitEmptyNoValue []bool `datastore:",omitempty"` + OmitEmptyWithValue []bool `datastore:",omitempty"` + }{ + NonEmptyValue: []bool{true, true}, + OmitEmptyWithValue: []bool{true, true}, + }) + + testOmitted(expectedPropNamesForSingles, &struct { + EmptyValue string + NonEmptyValue string + OmitEmptyNoValue string `datastore:",omitempty"` + OmitEmptyWithValue string `datastore:",omitempty"` + }{ + NonEmptyValue: "s", + OmitEmptyWithValue: "s", + }) + + testOmitted(expectedPropNamesForSlices, &struct { + EmptyValue []string + NonEmptyValue []string + OmitEmptyNoValue []string `datastore:",omitempty"` + OmitEmptyWithValue []string `datastore:",omitempty"` + }{ + NonEmptyValue: []string{"s1", "s2"}, + OmitEmptyWithValue: []string{"s3", "s4"}, + }) + + testOmitted(expectedPropNamesForSingles, &struct { + EmptyValue float32 + NonEmptyValue float32 + OmitEmptyNoValue float32 `datastore:",omitempty"` + OmitEmptyWithValue float32 `datastore:",omitempty"` + }{ + NonEmptyValue: 1.1, + OmitEmptyWithValue: 1.2, + }) + + testOmitted(expectedPropNamesForSlices, &struct { + EmptyValue []float32 + NonEmptyValue []float32 + OmitEmptyNoValue []float32 `datastore:",omitempty"` + OmitEmptyWithValue []float32 `datastore:",omitempty"` + }{ + NonEmptyValue: []float32{1.1, 2.2}, + OmitEmptyWithValue: []float32{3.3, 4.4}, + }) + + testOmitted(expectedPropNamesForSingles, &struct { + EmptyValue time.Time + NonEmptyValue time.Time + OmitEmptyNoValue time.Time `datastore:",omitempty"` + OmitEmptyWithValue time.Time `datastore:",omitempty"` + }{ + NonEmptyValue: now, + OmitEmptyWithValue: now, + }) + + testOmitted(expectedPropNamesForSlices, &struct { + EmptyValue []time.Time + NonEmptyValue []time.Time + OmitEmptyNoValue []time.Time `datastore:",omitempty"` + OmitEmptyWithValue []time.Time `datastore:",omitempty"` + }{ + NonEmptyValue: []time.Time{now, now}, + OmitEmptyWithValue: []time.Time{now, now}, + }) +} diff --git a/vendor/google.golang.org/appengine/datastore/query.go b/vendor/google.golang.org/appengine/datastore/query.go new file mode 100644 index 000000000..c1ea4adf6 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/query.go @@ -0,0 +1,757 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "encoding/base64" + "errors" + "fmt" + "math" + "reflect" + "strings" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/datastore" +) + +type operator int + +const ( + lessThan operator = iota + lessEq + equal + greaterEq + greaterThan +) + +var operatorToProto = map[operator]*pb.Query_Filter_Operator{ + lessThan: pb.Query_Filter_LESS_THAN.Enum(), + lessEq: pb.Query_Filter_LESS_THAN_OR_EQUAL.Enum(), + equal: pb.Query_Filter_EQUAL.Enum(), + greaterEq: pb.Query_Filter_GREATER_THAN_OR_EQUAL.Enum(), + greaterThan: pb.Query_Filter_GREATER_THAN.Enum(), +} + +// filter is a conditional filter on query results. +type filter struct { + FieldName string + Op operator + Value interface{} +} + +type sortDirection int + +const ( + ascending sortDirection = iota + descending +) + +var sortDirectionToProto = map[sortDirection]*pb.Query_Order_Direction{ + ascending: pb.Query_Order_ASCENDING.Enum(), + descending: pb.Query_Order_DESCENDING.Enum(), +} + +// order is a sort order on query results. +type order struct { + FieldName string + Direction sortDirection +} + +// NewQuery creates a new Query for a specific entity kind. +// +// An empty kind means to return all entities, including entities created and +// managed by other App Engine features, and is called a kindless query. +// Kindless queries cannot include filters or sort orders on property values. +func NewQuery(kind string) *Query { + return &Query{ + kind: kind, + limit: -1, + } +} + +// Query represents a datastore query. +type Query struct { + kind string + ancestor *Key + filter []filter + order []order + projection []string + + distinct bool + keysOnly bool + eventual bool + limit int32 + offset int32 + count int32 + start *pb.CompiledCursor + end *pb.CompiledCursor + + err error +} + +func (q *Query) clone() *Query { + x := *q + // Copy the contents of the slice-typed fields to a new backing store. + if len(q.filter) > 0 { + x.filter = make([]filter, len(q.filter)) + copy(x.filter, q.filter) + } + if len(q.order) > 0 { + x.order = make([]order, len(q.order)) + copy(x.order, q.order) + } + return &x +} + +// Ancestor returns a derivative query with an ancestor filter. +// The ancestor should not be nil. +func (q *Query) Ancestor(ancestor *Key) *Query { + q = q.clone() + if ancestor == nil { + q.err = errors.New("datastore: nil query ancestor") + return q + } + q.ancestor = ancestor + return q +} + +// EventualConsistency returns a derivative query that returns eventually +// consistent results. +// It only has an effect on ancestor queries. +func (q *Query) EventualConsistency() *Query { + q = q.clone() + q.eventual = true + return q +} + +// Filter returns a derivative query with a field-based filter. +// The filterStr argument must be a field name followed by optional space, +// followed by an operator, one of ">", "<", ">=", "<=", or "=". +// Fields are compared against the provided value using the operator. +// Multiple filters are AND'ed together. +func (q *Query) Filter(filterStr string, value interface{}) *Query { + q = q.clone() + filterStr = strings.TrimSpace(filterStr) + if len(filterStr) < 1 { + q.err = errors.New("datastore: invalid filter: " + filterStr) + return q + } + f := filter{ + FieldName: strings.TrimRight(filterStr, " ><=!"), + Value: value, + } + switch op := strings.TrimSpace(filterStr[len(f.FieldName):]); op { + case "<=": + f.Op = lessEq + case ">=": + f.Op = greaterEq + case "<": + f.Op = lessThan + case ">": + f.Op = greaterThan + case "=": + f.Op = equal + default: + q.err = fmt.Errorf("datastore: invalid operator %q in filter %q", op, filterStr) + return q + } + q.filter = append(q.filter, f) + return q +} + +// Order returns a derivative query with a field-based sort order. Orders are +// applied in the order they are added. The default order is ascending; to sort +// in descending order prefix the fieldName with a minus sign (-). +func (q *Query) Order(fieldName string) *Query { + q = q.clone() + fieldName = strings.TrimSpace(fieldName) + o := order{ + Direction: ascending, + FieldName: fieldName, + } + if strings.HasPrefix(fieldName, "-") { + o.Direction = descending + o.FieldName = strings.TrimSpace(fieldName[1:]) + } else if strings.HasPrefix(fieldName, "+") { + q.err = fmt.Errorf("datastore: invalid order: %q", fieldName) + return q + } + if len(o.FieldName) == 0 { + q.err = errors.New("datastore: empty order") + return q + } + q.order = append(q.order, o) + return q +} + +// Project returns a derivative query that yields only the given fields. It +// cannot be used with KeysOnly. +func (q *Query) Project(fieldNames ...string) *Query { + q = q.clone() + q.projection = append([]string(nil), fieldNames...) + return q +} + +// Distinct returns a derivative query that yields de-duplicated entities with +// respect to the set of projected fields. It is only used for projection +// queries. +func (q *Query) Distinct() *Query { + q = q.clone() + q.distinct = true + return q +} + +// KeysOnly returns a derivative query that yields only keys, not keys and +// entities. It cannot be used with projection queries. +func (q *Query) KeysOnly() *Query { + q = q.clone() + q.keysOnly = true + return q +} + +// Limit returns a derivative query that has a limit on the number of results +// returned. A negative value means unlimited. +func (q *Query) Limit(limit int) *Query { + q = q.clone() + if limit < math.MinInt32 || limit > math.MaxInt32 { + q.err = errors.New("datastore: query limit overflow") + return q + } + q.limit = int32(limit) + return q +} + +// Offset returns a derivative query that has an offset of how many keys to +// skip over before returning results. A negative value is invalid. +func (q *Query) Offset(offset int) *Query { + q = q.clone() + if offset < 0 { + q.err = errors.New("datastore: negative query offset") + return q + } + if offset > math.MaxInt32 { + q.err = errors.New("datastore: query offset overflow") + return q + } + q.offset = int32(offset) + return q +} + +// BatchSize returns a derivative query to fetch the supplied number of results +// at once. This value should be greater than zero, and equal to or less than +// the Limit. +func (q *Query) BatchSize(size int) *Query { + q = q.clone() + if size <= 0 || size > math.MaxInt32 { + q.err = errors.New("datastore: query batch size overflow") + return q + } + q.count = int32(size) + return q +} + +// Start returns a derivative query with the given start point. +func (q *Query) Start(c Cursor) *Query { + q = q.clone() + if c.cc == nil { + q.err = errors.New("datastore: invalid cursor") + return q + } + q.start = c.cc + return q +} + +// End returns a derivative query with the given end point. +func (q *Query) End(c Cursor) *Query { + q = q.clone() + if c.cc == nil { + q.err = errors.New("datastore: invalid cursor") + return q + } + q.end = c.cc + return q +} + +// toProto converts the query to a protocol buffer. +func (q *Query) toProto(dst *pb.Query, appID string) error { + if len(q.projection) != 0 && q.keysOnly { + return errors.New("datastore: query cannot both project and be keys-only") + } + dst.Reset() + dst.App = proto.String(appID) + if q.kind != "" { + dst.Kind = proto.String(q.kind) + } + if q.ancestor != nil { + dst.Ancestor = keyToProto(appID, q.ancestor) + if q.eventual { + dst.Strong = proto.Bool(false) + } + } + if q.projection != nil { + dst.PropertyName = q.projection + if q.distinct { + dst.GroupByPropertyName = q.projection + } + } + if q.keysOnly { + dst.KeysOnly = proto.Bool(true) + dst.RequirePerfectPlan = proto.Bool(true) + } + for _, qf := range q.filter { + if qf.FieldName == "" { + return errors.New("datastore: empty query filter field name") + } + p, errStr := valueToProto(appID, qf.FieldName, reflect.ValueOf(qf.Value), false) + if errStr != "" { + return errors.New("datastore: bad query filter value type: " + errStr) + } + xf := &pb.Query_Filter{ + Op: operatorToProto[qf.Op], + Property: []*pb.Property{p}, + } + if xf.Op == nil { + return errors.New("datastore: unknown query filter operator") + } + dst.Filter = append(dst.Filter, xf) + } + for _, qo := range q.order { + if qo.FieldName == "" { + return errors.New("datastore: empty query order field name") + } + xo := &pb.Query_Order{ + Property: proto.String(qo.FieldName), + Direction: sortDirectionToProto[qo.Direction], + } + if xo.Direction == nil { + return errors.New("datastore: unknown query order direction") + } + dst.Order = append(dst.Order, xo) + } + if q.limit >= 0 { + dst.Limit = proto.Int32(q.limit) + } + if q.offset != 0 { + dst.Offset = proto.Int32(q.offset) + } + if q.count != 0 { + dst.Count = proto.Int32(q.count) + } + dst.CompiledCursor = q.start + dst.EndCompiledCursor = q.end + dst.Compile = proto.Bool(true) + return nil +} + +// Count returns the number of results for the query. +// +// The running time and number of API calls made by Count scale linearly with +// the sum of the query's offset and limit. Unless the result count is +// expected to be small, it is best to specify a limit; otherwise Count will +// continue until it finishes counting or the provided context expires. +func (q *Query) Count(c context.Context) (int, error) { + // Check that the query is well-formed. + if q.err != nil { + return 0, q.err + } + + // Run a copy of the query, with keysOnly true (if we're not a projection, + // since the two are incompatible), and an adjusted offset. We also set the + // limit to zero, as we don't want any actual entity data, just the number + // of skipped results. + newQ := q.clone() + newQ.keysOnly = len(newQ.projection) == 0 + newQ.limit = 0 + if q.limit < 0 { + // If the original query was unlimited, set the new query's offset to maximum. + newQ.offset = math.MaxInt32 + } else { + newQ.offset = q.offset + q.limit + if newQ.offset < 0 { + // Do the best we can, in the presence of overflow. + newQ.offset = math.MaxInt32 + } + } + req := &pb.Query{} + if err := newQ.toProto(req, internal.FullyQualifiedAppID(c)); err != nil { + return 0, err + } + res := &pb.QueryResult{} + if err := internal.Call(c, "datastore_v3", "RunQuery", req, res); err != nil { + return 0, err + } + + // n is the count we will return. For example, suppose that our original + // query had an offset of 4 and a limit of 2008: the count will be 2008, + // provided that there are at least 2012 matching entities. However, the + // RPCs will only skip 1000 results at a time. The RPC sequence is: + // call RunQuery with (offset, limit) = (2012, 0) // 2012 == newQ.offset + // response has (skippedResults, moreResults) = (1000, true) + // n += 1000 // n == 1000 + // call Next with (offset, limit) = (1012, 0) // 1012 == newQ.offset - n + // response has (skippedResults, moreResults) = (1000, true) + // n += 1000 // n == 2000 + // call Next with (offset, limit) = (12, 0) // 12 == newQ.offset - n + // response has (skippedResults, moreResults) = (12, false) + // n += 12 // n == 2012 + // // exit the loop + // n -= 4 // n == 2008 + var n int32 + for { + // The QueryResult should have no actual entity data, just skipped results. + if len(res.Result) != 0 { + return 0, errors.New("datastore: internal error: Count request returned too much data") + } + n += res.GetSkippedResults() + if !res.GetMoreResults() { + break + } + if err := callNext(c, res, newQ.offset-n, q.count); err != nil { + return 0, err + } + } + n -= q.offset + if n < 0 { + // If the offset was greater than the number of matching entities, + // return 0 instead of negative. + n = 0 + } + return int(n), nil +} + +// callNext issues a datastore_v3/Next RPC to advance a cursor, such as that +// returned by a query with more results. +func callNext(c context.Context, res *pb.QueryResult, offset, count int32) error { + if res.Cursor == nil { + return errors.New("datastore: internal error: server did not return a cursor") + } + req := &pb.NextRequest{ + Cursor: res.Cursor, + } + if count >= 0 { + req.Count = proto.Int32(count) + } + if offset != 0 { + req.Offset = proto.Int32(offset) + } + if res.CompiledCursor != nil { + req.Compile = proto.Bool(true) + } + res.Reset() + return internal.Call(c, "datastore_v3", "Next", req, res) +} + +// GetAll runs the query in the given context and returns all keys that match +// that query, as well as appending the values to dst. +// +// dst must have type *[]S or *[]*S or *[]P, for some struct type S or some non- +// interface, non-pointer type P such that P or *P implements PropertyLoadSaver. +// +// As a special case, *PropertyList is an invalid type for dst, even though a +// PropertyList is a slice of structs. It is treated as invalid to avoid being +// mistakenly passed when *[]PropertyList was intended. +// +// The keys returned by GetAll will be in a 1-1 correspondence with the entities +// added to dst. +// +// If q is a ``keys-only'' query, GetAll ignores dst and only returns the keys. +// +// The running time and number of API calls made by GetAll scale linearly with +// the sum of the query's offset and limit. Unless the result count is +// expected to be small, it is best to specify a limit; otherwise GetAll will +// continue until it finishes collecting results or the provided context +// expires. +func (q *Query) GetAll(c context.Context, dst interface{}) ([]*Key, error) { + var ( + dv reflect.Value + mat multiArgType + elemType reflect.Type + errFieldMismatch error + ) + if !q.keysOnly { + dv = reflect.ValueOf(dst) + if dv.Kind() != reflect.Ptr || dv.IsNil() { + return nil, ErrInvalidEntityType + } + dv = dv.Elem() + mat, elemType = checkMultiArg(dv) + if mat == multiArgTypeInvalid || mat == multiArgTypeInterface { + return nil, ErrInvalidEntityType + } + } + + var keys []*Key + for t := q.Run(c); ; { + k, e, err := t.next() + if err == Done { + break + } + if err != nil { + return keys, err + } + if !q.keysOnly { + ev := reflect.New(elemType) + if elemType.Kind() == reflect.Map { + // This is a special case. The zero values of a map type are + // not immediately useful; they have to be make'd. + // + // Funcs and channels are similar, in that a zero value is not useful, + // but even a freshly make'd channel isn't useful: there's no fixed + // channel buffer size that is always going to be large enough, and + // there's no goroutine to drain the other end. Theoretically, these + // types could be supported, for example by sniffing for a constructor + // method or requiring prior registration, but for now it's not a + // frequent enough concern to be worth it. Programmers can work around + // it by explicitly using Iterator.Next instead of the Query.GetAll + // convenience method. + x := reflect.MakeMap(elemType) + ev.Elem().Set(x) + } + if err = loadEntity(ev.Interface(), e); err != nil { + if _, ok := err.(*ErrFieldMismatch); ok { + // We continue loading entities even in the face of field mismatch errors. + // If we encounter any other error, that other error is returned. Otherwise, + // an ErrFieldMismatch is returned. + errFieldMismatch = err + } else { + return keys, err + } + } + if mat != multiArgTypeStructPtr { + ev = ev.Elem() + } + dv.Set(reflect.Append(dv, ev)) + } + keys = append(keys, k) + } + return keys, errFieldMismatch +} + +// Run runs the query in the given context. +func (q *Query) Run(c context.Context) *Iterator { + if q.err != nil { + return &Iterator{err: q.err} + } + t := &Iterator{ + c: c, + limit: q.limit, + count: q.count, + q: q, + prevCC: q.start, + } + var req pb.Query + if err := q.toProto(&req, internal.FullyQualifiedAppID(c)); err != nil { + t.err = err + return t + } + if err := internal.Call(c, "datastore_v3", "RunQuery", &req, &t.res); err != nil { + t.err = err + return t + } + offset := q.offset - t.res.GetSkippedResults() + var count int32 + if t.count > 0 && (t.limit < 0 || t.count < t.limit) { + count = t.count + } else { + count = t.limit + } + for offset > 0 && t.res.GetMoreResults() { + t.prevCC = t.res.CompiledCursor + if err := callNext(t.c, &t.res, offset, count); err != nil { + t.err = err + break + } + skip := t.res.GetSkippedResults() + if skip < 0 { + t.err = errors.New("datastore: internal error: negative number of skipped_results") + break + } + offset -= skip + } + if offset < 0 { + t.err = errors.New("datastore: internal error: query offset was overshot") + } + return t +} + +// Iterator is the result of running a query. +type Iterator struct { + c context.Context + err error + // res is the result of the most recent RunQuery or Next API call. + res pb.QueryResult + // i is how many elements of res.Result we have iterated over. + i int + // limit is the limit on the number of results this iterator should return. + // A negative value means unlimited. + limit int32 + // count is the number of results this iterator should fetch at once. This + // should be equal to or greater than zero. + count int32 + // q is the original query which yielded this iterator. + q *Query + // prevCC is the compiled cursor that marks the end of the previous batch + // of results. + prevCC *pb.CompiledCursor +} + +// Done is returned when a query iteration has completed. +var Done = errors.New("datastore: query has no more results") + +// Next returns the key of the next result. When there are no more results, +// Done is returned as the error. +// +// If the query is not keys only and dst is non-nil, it also loads the entity +// stored for that key into the struct pointer or PropertyLoadSaver dst, with +// the same semantics and possible errors as for the Get function. +func (t *Iterator) Next(dst interface{}) (*Key, error) { + k, e, err := t.next() + if err != nil { + return nil, err + } + if dst != nil && !t.q.keysOnly { + err = loadEntity(dst, e) + } + return k, err +} + +func (t *Iterator) next() (*Key, *pb.EntityProto, error) { + if t.err != nil { + return nil, nil, t.err + } + + // Issue datastore_v3/Next RPCs as necessary. + for t.i == len(t.res.Result) { + if !t.res.GetMoreResults() { + t.err = Done + return nil, nil, t.err + } + t.prevCC = t.res.CompiledCursor + var count int32 + if t.count > 0 && (t.limit < 0 || t.count < t.limit) { + count = t.count + } else { + count = t.limit + } + if err := callNext(t.c, &t.res, 0, count); err != nil { + t.err = err + return nil, nil, t.err + } + if t.res.GetSkippedResults() != 0 { + t.err = errors.New("datastore: internal error: iterator has skipped results") + return nil, nil, t.err + } + t.i = 0 + if t.limit >= 0 { + t.limit -= int32(len(t.res.Result)) + if t.limit < 0 { + t.err = errors.New("datastore: internal error: query returned more results than the limit") + return nil, nil, t.err + } + } + } + + // Extract the key from the t.i'th element of t.res.Result. + e := t.res.Result[t.i] + t.i++ + if e.Key == nil { + return nil, nil, errors.New("datastore: internal error: server did not return a key") + } + k, err := protoToKey(e.Key) + if err != nil || k.Incomplete() { + return nil, nil, errors.New("datastore: internal error: server returned an invalid key") + } + return k, e, nil +} + +// Cursor returns a cursor for the iterator's current location. +func (t *Iterator) Cursor() (Cursor, error) { + if t.err != nil && t.err != Done { + return Cursor{}, t.err + } + // If we are at either end of the current batch of results, + // return the compiled cursor at that end. + skipped := t.res.GetSkippedResults() + if t.i == 0 && skipped == 0 { + if t.prevCC == nil { + // A nil pointer (of type *pb.CompiledCursor) means no constraint: + // passing it as the end cursor of a new query means unlimited results + // (glossing over the integer limit parameter for now). + // A non-nil pointer to an empty pb.CompiledCursor means the start: + // passing it as the end cursor of a new query means 0 results. + // If prevCC was nil, then the original query had no start cursor, but + // Iterator.Cursor should return "the start" instead of unlimited. + return Cursor{&zeroCC}, nil + } + return Cursor{t.prevCC}, nil + } + if t.i == len(t.res.Result) { + return Cursor{t.res.CompiledCursor}, nil + } + // Otherwise, re-run the query offset to this iterator's position, starting from + // the most recent compiled cursor. This is done on a best-effort basis, as it + // is racy; if a concurrent process has added or removed entities, then the + // cursor returned may be inconsistent. + q := t.q.clone() + q.start = t.prevCC + q.offset = skipped + int32(t.i) + q.limit = 0 + q.keysOnly = len(q.projection) == 0 + t1 := q.Run(t.c) + _, _, err := t1.next() + if err != Done { + if err == nil { + err = fmt.Errorf("datastore: internal error: zero-limit query did not have zero results") + } + return Cursor{}, err + } + return Cursor{t1.res.CompiledCursor}, nil +} + +var zeroCC pb.CompiledCursor + +// Cursor is an iterator's position. It can be converted to and from an opaque +// string. A cursor can be used from different HTTP requests, but only with a +// query with the same kind, ancestor, filter and order constraints. +type Cursor struct { + cc *pb.CompiledCursor +} + +// String returns a base-64 string representation of a cursor. +func (c Cursor) String() string { + if c.cc == nil { + return "" + } + b, err := proto.Marshal(c.cc) + if err != nil { + // The only way to construct a Cursor with a non-nil cc field is to + // unmarshal from the byte representation. We panic if the unmarshal + // succeeds but the marshaling of the unchanged protobuf value fails. + panic(fmt.Sprintf("datastore: internal error: malformed cursor: %v", err)) + } + return strings.TrimRight(base64.URLEncoding.EncodeToString(b), "=") +} + +// Decode decodes a cursor from its base-64 string representation. +func DecodeCursor(s string) (Cursor, error) { + if s == "" { + return Cursor{&zeroCC}, nil + } + if n := len(s) % 4; n != 0 { + s += strings.Repeat("=", 4-n) + } + b, err := base64.URLEncoding.DecodeString(s) + if err != nil { + return Cursor{}, err + } + cc := &pb.CompiledCursor{} + if err := proto.Unmarshal(b, cc); err != nil { + return Cursor{}, err + } + return Cursor{cc}, nil +} diff --git a/vendor/google.golang.org/appengine/datastore/query_test.go b/vendor/google.golang.org/appengine/datastore/query_test.go new file mode 100644 index 000000000..45e5313ba --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/query_test.go @@ -0,0 +1,584 @@ +// Copyright 2011 Google Inc. All Rights Reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "errors" + "fmt" + "reflect" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + + "google.golang.org/appengine/internal" + "google.golang.org/appengine/internal/aetesting" + pb "google.golang.org/appengine/internal/datastore" +) + +var ( + path1 = &pb.Path{ + Element: []*pb.Path_Element{ + { + Type: proto.String("Gopher"), + Id: proto.Int64(6), + }, + }, + } + path2 = &pb.Path{ + Element: []*pb.Path_Element{ + { + Type: proto.String("Gopher"), + Id: proto.Int64(6), + }, + { + Type: proto.String("Gopher"), + Id: proto.Int64(8), + }, + }, + } +) + +func fakeRunQuery(in *pb.Query, out *pb.QueryResult) error { + expectedIn := &pb.Query{ + App: proto.String("dev~fake-app"), + Kind: proto.String("Gopher"), + Compile: proto.Bool(true), + } + if !proto.Equal(in, expectedIn) { + return fmt.Errorf("unsupported argument: got %v want %v", in, expectedIn) + } + *out = pb.QueryResult{ + Result: []*pb.EntityProto{ + { + Key: &pb.Reference{ + App: proto.String("s~test-app"), + Path: path1, + }, + EntityGroup: path1, + Property: []*pb.Property{ + { + Meaning: pb.Property_TEXT.Enum(), + Name: proto.String("Name"), + Value: &pb.PropertyValue{ + StringValue: proto.String("George"), + }, + }, + { + Name: proto.String("Height"), + Value: &pb.PropertyValue{ + Int64Value: proto.Int64(32), + }, + }, + }, + }, + { + Key: &pb.Reference{ + App: proto.String("s~test-app"), + Path: path2, + }, + EntityGroup: path1, // ancestor is George + Property: []*pb.Property{ + { + Meaning: pb.Property_TEXT.Enum(), + Name: proto.String("Name"), + Value: &pb.PropertyValue{ + StringValue: proto.String("Rufus"), + }, + }, + // No height for Rufus. + }, + }, + }, + MoreResults: proto.Bool(false), + } + return nil +} + +type StructThatImplementsPLS struct{} + +func (StructThatImplementsPLS) Load(p []Property) error { return nil } +func (StructThatImplementsPLS) Save() ([]Property, error) { return nil, nil } + +var _ PropertyLoadSaver = StructThatImplementsPLS{} + +type StructPtrThatImplementsPLS struct{} + +func (*StructPtrThatImplementsPLS) Load(p []Property) error { return nil } +func (*StructPtrThatImplementsPLS) Save() ([]Property, error) { return nil, nil } + +var _ PropertyLoadSaver = &StructPtrThatImplementsPLS{} + +type PropertyMap map[string]Property + +func (m PropertyMap) Load(props []Property) error { + for _, p := range props { + if p.Multiple { + return errors.New("PropertyMap does not support multiple properties") + } + m[p.Name] = p + } + return nil +} + +func (m PropertyMap) Save() ([]Property, error) { + props := make([]Property, 0, len(m)) + for _, p := range m { + if p.Multiple { + return nil, errors.New("PropertyMap does not support multiple properties") + } + props = append(props, p) + } + return props, nil +} + +var _ PropertyLoadSaver = PropertyMap{} + +type Gopher struct { + Name string + Height int +} + +// typeOfEmptyInterface is the type of interface{}, but we can't use +// reflect.TypeOf((interface{})(nil)) directly because TypeOf takes an +// interface{}. +var typeOfEmptyInterface = reflect.TypeOf((*interface{})(nil)).Elem() + +func TestCheckMultiArg(t *testing.T) { + testCases := []struct { + v interface{} + mat multiArgType + elemType reflect.Type + }{ + // Invalid cases. + {nil, multiArgTypeInvalid, nil}, + {Gopher{}, multiArgTypeInvalid, nil}, + {&Gopher{}, multiArgTypeInvalid, nil}, + {PropertyList{}, multiArgTypeInvalid, nil}, // This is a special case. + {PropertyMap{}, multiArgTypeInvalid, nil}, + {[]*PropertyList(nil), multiArgTypeInvalid, nil}, + {[]*PropertyMap(nil), multiArgTypeInvalid, nil}, + {[]**Gopher(nil), multiArgTypeInvalid, nil}, + {[]*interface{}(nil), multiArgTypeInvalid, nil}, + // Valid cases. + { + []PropertyList(nil), + multiArgTypePropertyLoadSaver, + reflect.TypeOf(PropertyList{}), + }, + { + []PropertyMap(nil), + multiArgTypePropertyLoadSaver, + reflect.TypeOf(PropertyMap{}), + }, + { + []StructThatImplementsPLS(nil), + multiArgTypePropertyLoadSaver, + reflect.TypeOf(StructThatImplementsPLS{}), + }, + { + []StructPtrThatImplementsPLS(nil), + multiArgTypePropertyLoadSaver, + reflect.TypeOf(StructPtrThatImplementsPLS{}), + }, + { + []Gopher(nil), + multiArgTypeStruct, + reflect.TypeOf(Gopher{}), + }, + { + []*Gopher(nil), + multiArgTypeStructPtr, + reflect.TypeOf(Gopher{}), + }, + { + []interface{}(nil), + multiArgTypeInterface, + typeOfEmptyInterface, + }, + } + for _, tc := range testCases { + mat, elemType := checkMultiArg(reflect.ValueOf(tc.v)) + if mat != tc.mat || elemType != tc.elemType { + t.Errorf("checkMultiArg(%T): got %v, %v want %v, %v", + tc.v, mat, elemType, tc.mat, tc.elemType) + } + } +} + +func TestSimpleQuery(t *testing.T) { + struct1 := Gopher{Name: "George", Height: 32} + struct2 := Gopher{Name: "Rufus"} + pList1 := PropertyList{ + { + Name: "Name", + Value: "George", + }, + { + Name: "Height", + Value: int64(32), + }, + } + pList2 := PropertyList{ + { + Name: "Name", + Value: "Rufus", + }, + } + pMap1 := PropertyMap{ + "Name": Property{ + Name: "Name", + Value: "George", + }, + "Height": Property{ + Name: "Height", + Value: int64(32), + }, + } + pMap2 := PropertyMap{ + "Name": Property{ + Name: "Name", + Value: "Rufus", + }, + } + + testCases := []struct { + dst interface{} + want interface{} + }{ + // The destination must have type *[]P, *[]S or *[]*S, for some non-interface + // type P such that *P implements PropertyLoadSaver, or for some struct type S. + {new([]Gopher), &[]Gopher{struct1, struct2}}, + {new([]*Gopher), &[]*Gopher{&struct1, &struct2}}, + {new([]PropertyList), &[]PropertyList{pList1, pList2}}, + {new([]PropertyMap), &[]PropertyMap{pMap1, pMap2}}, + + // Any other destination type is invalid. + {0, nil}, + {Gopher{}, nil}, + {PropertyList{}, nil}, + {PropertyMap{}, nil}, + {[]int{}, nil}, + {[]Gopher{}, nil}, + {[]PropertyList{}, nil}, + {new(int), nil}, + {new(Gopher), nil}, + {new(PropertyList), nil}, // This is a special case. + {new(PropertyMap), nil}, + {new([]int), nil}, + {new([]map[int]int), nil}, + {new([]map[string]Property), nil}, + {new([]map[string]interface{}), nil}, + {new([]*int), nil}, + {new([]*map[int]int), nil}, + {new([]*map[string]Property), nil}, + {new([]*map[string]interface{}), nil}, + {new([]**Gopher), nil}, + {new([]*PropertyList), nil}, + {new([]*PropertyMap), nil}, + } + for _, tc := range testCases { + nCall := 0 + c := aetesting.FakeSingleContext(t, "datastore_v3", "RunQuery", func(in *pb.Query, out *pb.QueryResult) error { + nCall++ + return fakeRunQuery(in, out) + }) + c = internal.WithAppIDOverride(c, "dev~fake-app") + + var ( + expectedErr error + expectedNCall int + ) + if tc.want == nil { + expectedErr = ErrInvalidEntityType + } else { + expectedNCall = 1 + } + keys, err := NewQuery("Gopher").GetAll(c, tc.dst) + if err != expectedErr { + t.Errorf("dst type %T: got error [%v], want [%v]", tc.dst, err, expectedErr) + continue + } + if nCall != expectedNCall { + t.Errorf("dst type %T: Context.Call was called an incorrect number of times: got %d want %d", tc.dst, nCall, expectedNCall) + continue + } + if err != nil { + continue + } + + key1 := NewKey(c, "Gopher", "", 6, nil) + expectedKeys := []*Key{ + key1, + NewKey(c, "Gopher", "", 8, key1), + } + if l1, l2 := len(keys), len(expectedKeys); l1 != l2 { + t.Errorf("dst type %T: got %d keys, want %d keys", tc.dst, l1, l2) + continue + } + for i, key := range keys { + if key.AppID() != "s~test-app" { + t.Errorf(`dst type %T: Key #%d's AppID = %q, want "s~test-app"`, tc.dst, i, key.AppID()) + continue + } + if !keysEqual(key, expectedKeys[i]) { + t.Errorf("dst type %T: got key #%d %v, want %v", tc.dst, i, key, expectedKeys[i]) + continue + } + } + + if !reflect.DeepEqual(tc.dst, tc.want) { + t.Errorf("dst type %T: Entities got %+v, want %+v", tc.dst, tc.dst, tc.want) + continue + } + } +} + +// keysEqual is like (*Key).Equal, but ignores the App ID. +func keysEqual(a, b *Key) bool { + for a != nil && b != nil { + if a.Kind() != b.Kind() || a.StringID() != b.StringID() || a.IntID() != b.IntID() { + return false + } + a, b = a.Parent(), b.Parent() + } + return a == b +} + +func TestQueriesAreImmutable(t *testing.T) { + // Test that deriving q2 from q1 does not modify q1. + q0 := NewQuery("foo") + q1 := NewQuery("foo") + q2 := q1.Offset(2) + if !reflect.DeepEqual(q0, q1) { + t.Errorf("q0 and q1 were not equal") + } + if reflect.DeepEqual(q1, q2) { + t.Errorf("q1 and q2 were equal") + } + + // Test that deriving from q4 twice does not conflict, even though + // q4 has a long list of order clauses. This tests that the arrays + // backed by a query's slice of orders are not shared. + f := func() *Query { + q := NewQuery("bar") + // 47 is an ugly number that is unlikely to be near a re-allocation + // point in repeated append calls. For example, it's not near a power + // of 2 or a multiple of 10. + for i := 0; i < 47; i++ { + q = q.Order(fmt.Sprintf("x%d", i)) + } + return q + } + q3 := f().Order("y") + q4 := f() + q5 := q4.Order("y") + q6 := q4.Order("z") + if !reflect.DeepEqual(q3, q5) { + t.Errorf("q3 and q5 were not equal") + } + if reflect.DeepEqual(q5, q6) { + t.Errorf("q5 and q6 were equal") + } +} + +func TestFilterParser(t *testing.T) { + testCases := []struct { + filterStr string + wantOK bool + wantFieldName string + wantOp operator + }{ + // Supported ops. + {"x<", true, "x", lessThan}, + {"x <", true, "x", lessThan}, + {"x <", true, "x", lessThan}, + {" x < ", true, "x", lessThan}, + {"x <=", true, "x", lessEq}, + {"x =", true, "x", equal}, + {"x >=", true, "x", greaterEq}, + {"x >", true, "x", greaterThan}, + {"in >", true, "in", greaterThan}, + {"in>", true, "in", greaterThan}, + // Valid but (currently) unsupported ops. + {"x!=", false, "", 0}, + {"x !=", false, "", 0}, + {" x != ", false, "", 0}, + {"x IN", false, "", 0}, + {"x in", false, "", 0}, + // Invalid ops. + {"x EQ", false, "", 0}, + {"x lt", false, "", 0}, + {"x <>", false, "", 0}, + {"x >>", false, "", 0}, + {"x ==", false, "", 0}, + {"x =<", false, "", 0}, + {"x =>", false, "", 0}, + {"x !", false, "", 0}, + {"x ", false, "", 0}, + {"x", false, "", 0}, + } + for _, tc := range testCases { + q := NewQuery("foo").Filter(tc.filterStr, 42) + if ok := q.err == nil; ok != tc.wantOK { + t.Errorf("%q: ok=%t, want %t", tc.filterStr, ok, tc.wantOK) + continue + } + if !tc.wantOK { + continue + } + if len(q.filter) != 1 { + t.Errorf("%q: len=%d, want %d", tc.filterStr, len(q.filter), 1) + continue + } + got, want := q.filter[0], filter{tc.wantFieldName, tc.wantOp, 42} + if got != want { + t.Errorf("%q: got %v, want %v", tc.filterStr, got, want) + continue + } + } +} + +func TestQueryToProto(t *testing.T) { + // The context is required to make Keys for the test cases. + var got *pb.Query + NoErr := errors.New("No error") + c := aetesting.FakeSingleContext(t, "datastore_v3", "RunQuery", func(in *pb.Query, out *pb.QueryResult) error { + got = in + return NoErr // return a non-nil error so Run doesn't keep going. + }) + c = internal.WithAppIDOverride(c, "dev~fake-app") + + testCases := []struct { + desc string + query *Query + want *pb.Query + err string + }{ + { + desc: "empty", + query: NewQuery(""), + want: &pb.Query{}, + }, + { + desc: "standard query", + query: NewQuery("kind").Order("-I").Filter("I >", 17).Filter("U =", "Dave").Limit(7).Offset(42).BatchSize(5), + want: &pb.Query{ + Kind: proto.String("kind"), + Filter: []*pb.Query_Filter{ + { + Op: pb.Query_Filter_GREATER_THAN.Enum(), + Property: []*pb.Property{ + { + Name: proto.String("I"), + Value: &pb.PropertyValue{Int64Value: proto.Int64(17)}, + Multiple: proto.Bool(false), + }, + }, + }, + { + Op: pb.Query_Filter_EQUAL.Enum(), + Property: []*pb.Property{ + { + Name: proto.String("U"), + Value: &pb.PropertyValue{StringValue: proto.String("Dave")}, + Multiple: proto.Bool(false), + }, + }, + }, + }, + Order: []*pb.Query_Order{ + { + Property: proto.String("I"), + Direction: pb.Query_Order_DESCENDING.Enum(), + }, + }, + Limit: proto.Int32(7), + Offset: proto.Int32(42), + Count: proto.Int32(5), + }, + }, + { + desc: "ancestor", + query: NewQuery("").Ancestor(NewKey(c, "kind", "Mummy", 0, nil)), + want: &pb.Query{ + Ancestor: &pb.Reference{ + App: proto.String("dev~fake-app"), + Path: &pb.Path{ + Element: []*pb.Path_Element{{Type: proto.String("kind"), Name: proto.String("Mummy")}}, + }, + }, + }, + }, + { + desc: "projection", + query: NewQuery("").Project("A", "B"), + want: &pb.Query{ + PropertyName: []string{"A", "B"}, + }, + }, + { + desc: "projection with distinct", + query: NewQuery("").Project("A", "B").Distinct(), + want: &pb.Query{ + PropertyName: []string{"A", "B"}, + GroupByPropertyName: []string{"A", "B"}, + }, + }, + { + desc: "keys only", + query: NewQuery("").KeysOnly(), + want: &pb.Query{ + KeysOnly: proto.Bool(true), + RequirePerfectPlan: proto.Bool(true), + }, + }, + { + desc: "empty filter", + query: NewQuery("kind").Filter("=", 17), + err: "empty query filter field nam", + }, + { + desc: "bad filter type", + query: NewQuery("kind").Filter("M =", map[string]bool{}), + err: "bad query filter value type", + }, + { + desc: "bad filter operator", + query: NewQuery("kind").Filter("I <<=", 17), + err: `invalid operator "<<=" in filter "I <<="`, + }, + { + desc: "empty order", + query: NewQuery("kind").Order(""), + err: "empty order", + }, + { + desc: "bad order direction", + query: NewQuery("kind").Order("+I"), + err: `invalid order: "+I`, + }, + } + + for _, tt := range testCases { + got = nil + if _, err := tt.query.Run(c).Next(nil); err != NoErr { + if tt.err == "" || !strings.Contains(err.Error(), tt.err) { + t.Errorf("%s: error %v, want %q", tt.desc, err, tt.err) + } + continue + } + if tt.err != "" { + t.Errorf("%s: no error, want %q", tt.desc, tt.err) + continue + } + // Fields that are common to all protos. + tt.want.App = proto.String("dev~fake-app") + tt.want.Compile = proto.Bool(true) + if !proto.Equal(got, tt.want) { + t.Errorf("%s:\ngot %v\nwant %v", tt.desc, got, tt.want) + } + } +} diff --git a/vendor/google.golang.org/appengine/datastore/save.go b/vendor/google.golang.org/appengine/datastore/save.go new file mode 100644 index 000000000..7b045a595 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/save.go @@ -0,0 +1,333 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "errors" + "fmt" + "math" + "reflect" + "time" + + "github.com/golang/protobuf/proto" + + "google.golang.org/appengine" + pb "google.golang.org/appengine/internal/datastore" +) + +func toUnixMicro(t time.Time) int64 { + // We cannot use t.UnixNano() / 1e3 because we want to handle times more than + // 2^63 nanoseconds (which is about 292 years) away from 1970, and those cannot + // be represented in the numerator of a single int64 divide. + return t.Unix()*1e6 + int64(t.Nanosecond()/1e3) +} + +func fromUnixMicro(t int64) time.Time { + return time.Unix(t/1e6, (t%1e6)*1e3).UTC() +} + +var ( + minTime = time.Unix(int64(math.MinInt64)/1e6, (int64(math.MinInt64)%1e6)*1e3) + maxTime = time.Unix(int64(math.MaxInt64)/1e6, (int64(math.MaxInt64)%1e6)*1e3) +) + +// valueToProto converts a named value to a newly allocated Property. +// The returned error string is empty on success. +func valueToProto(defaultAppID, name string, v reflect.Value, multiple bool) (p *pb.Property, errStr string) { + var ( + pv pb.PropertyValue + unsupported bool + ) + switch v.Kind() { + case reflect.Invalid: + // No-op. + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + pv.Int64Value = proto.Int64(v.Int()) + case reflect.Bool: + pv.BooleanValue = proto.Bool(v.Bool()) + case reflect.String: + pv.StringValue = proto.String(v.String()) + case reflect.Float32, reflect.Float64: + pv.DoubleValue = proto.Float64(v.Float()) + case reflect.Ptr: + if k, ok := v.Interface().(*Key); ok { + if k != nil { + pv.Referencevalue = keyToReferenceValue(defaultAppID, k) + } + } else { + unsupported = true + } + case reflect.Struct: + switch t := v.Interface().(type) { + case time.Time: + if t.Before(minTime) || t.After(maxTime) { + return nil, "time value out of range" + } + pv.Int64Value = proto.Int64(toUnixMicro(t)) + case appengine.GeoPoint: + if !t.Valid() { + return nil, "invalid GeoPoint value" + } + // NOTE: Strangely, latitude maps to X, longitude to Y. + pv.Pointvalue = &pb.PropertyValue_PointValue{X: &t.Lat, Y: &t.Lng} + default: + unsupported = true + } + case reflect.Slice: + if b, ok := v.Interface().([]byte); ok { + pv.StringValue = proto.String(string(b)) + } else { + // nvToProto should already catch slice values. + // If we get here, we have a slice of slice values. + unsupported = true + } + default: + unsupported = true + } + if unsupported { + return nil, "unsupported datastore value type: " + v.Type().String() + } + p = &pb.Property{ + Name: proto.String(name), + Value: &pv, + Multiple: proto.Bool(multiple), + } + if v.IsValid() { + switch v.Interface().(type) { + case []byte: + p.Meaning = pb.Property_BLOB.Enum() + case ByteString: + p.Meaning = pb.Property_BYTESTRING.Enum() + case appengine.BlobKey: + p.Meaning = pb.Property_BLOBKEY.Enum() + case time.Time: + p.Meaning = pb.Property_GD_WHEN.Enum() + case appengine.GeoPoint: + p.Meaning = pb.Property_GEORSS_POINT.Enum() + } + } + return p, "" +} + +type saveOpts struct { + noIndex bool + multiple bool + omitEmpty bool +} + +// saveEntity saves an EntityProto into a PropertyLoadSaver or struct pointer. +func saveEntity(defaultAppID string, key *Key, src interface{}) (*pb.EntityProto, error) { + var err error + var props []Property + if e, ok := src.(PropertyLoadSaver); ok { + props, err = e.Save() + } else { + props, err = SaveStruct(src) + } + if err != nil { + return nil, err + } + return propertiesToProto(defaultAppID, key, props) +} + +func saveStructProperty(props *[]Property, name string, opts saveOpts, v reflect.Value) error { + if opts.omitEmpty && isEmptyValue(v) { + return nil + } + p := Property{ + Name: name, + NoIndex: opts.noIndex, + Multiple: opts.multiple, + } + switch x := v.Interface().(type) { + case *Key: + p.Value = x + case time.Time: + p.Value = x + case appengine.BlobKey: + p.Value = x + case appengine.GeoPoint: + p.Value = x + case ByteString: + p.Value = x + default: + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + p.Value = v.Int() + case reflect.Bool: + p.Value = v.Bool() + case reflect.String: + p.Value = v.String() + case reflect.Float32, reflect.Float64: + p.Value = v.Float() + case reflect.Slice: + if v.Type().Elem().Kind() == reflect.Uint8 { + p.NoIndex = true + p.Value = v.Bytes() + } + case reflect.Struct: + if !v.CanAddr() { + return fmt.Errorf("datastore: unsupported struct field: value is unaddressable") + } + sub, err := newStructPLS(v.Addr().Interface()) + if err != nil { + return fmt.Errorf("datastore: unsupported struct field: %v", err) + } + return sub.save(props, name+".", opts) + } + } + if p.Value == nil { + return fmt.Errorf("datastore: unsupported struct field type: %v", v.Type()) + } + *props = append(*props, p) + return nil +} + +func (s structPLS) Save() ([]Property, error) { + var props []Property + if err := s.save(&props, "", saveOpts{}); err != nil { + return nil, err + } + return props, nil +} + +func (s structPLS) save(props *[]Property, prefix string, opts saveOpts) error { + for name, f := range s.codec.fields { + name = prefix + name + v := s.v.FieldByIndex(f.path) + if !v.IsValid() || !v.CanSet() { + continue + } + var opts1 saveOpts + opts1.noIndex = opts.noIndex || f.noIndex + opts1.multiple = opts.multiple + opts1.omitEmpty = f.omitEmpty // don't propagate + // For slice fields that aren't []byte, save each element. + if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 { + opts1.multiple = true + for j := 0; j < v.Len(); j++ { + if err := saveStructProperty(props, name, opts1, v.Index(j)); err != nil { + return err + } + } + continue + } + // Otherwise, save the field itself. + if err := saveStructProperty(props, name, opts1, v); err != nil { + return err + } + } + return nil +} + +func propertiesToProto(defaultAppID string, key *Key, props []Property) (*pb.EntityProto, error) { + e := &pb.EntityProto{ + Key: keyToProto(defaultAppID, key), + } + if key.parent == nil { + e.EntityGroup = &pb.Path{} + } else { + e.EntityGroup = keyToProto(defaultAppID, key.root()).Path + } + prevMultiple := make(map[string]bool) + + for _, p := range props { + if pm, ok := prevMultiple[p.Name]; ok { + if !pm || !p.Multiple { + return nil, fmt.Errorf("datastore: multiple Properties with Name %q, but Multiple is false", p.Name) + } + } else { + prevMultiple[p.Name] = p.Multiple + } + + x := &pb.Property{ + Name: proto.String(p.Name), + Value: new(pb.PropertyValue), + Multiple: proto.Bool(p.Multiple), + } + switch v := p.Value.(type) { + case int64: + x.Value.Int64Value = proto.Int64(v) + case bool: + x.Value.BooleanValue = proto.Bool(v) + case string: + x.Value.StringValue = proto.String(v) + if p.NoIndex { + x.Meaning = pb.Property_TEXT.Enum() + } + case float64: + x.Value.DoubleValue = proto.Float64(v) + case *Key: + if v != nil { + x.Value.Referencevalue = keyToReferenceValue(defaultAppID, v) + } + case time.Time: + if v.Before(minTime) || v.After(maxTime) { + return nil, fmt.Errorf("datastore: time value out of range") + } + x.Value.Int64Value = proto.Int64(toUnixMicro(v)) + x.Meaning = pb.Property_GD_WHEN.Enum() + case appengine.BlobKey: + x.Value.StringValue = proto.String(string(v)) + x.Meaning = pb.Property_BLOBKEY.Enum() + case appengine.GeoPoint: + if !v.Valid() { + return nil, fmt.Errorf("datastore: invalid GeoPoint value") + } + // NOTE: Strangely, latitude maps to X, longitude to Y. + x.Value.Pointvalue = &pb.PropertyValue_PointValue{X: &v.Lat, Y: &v.Lng} + x.Meaning = pb.Property_GEORSS_POINT.Enum() + case []byte: + x.Value.StringValue = proto.String(string(v)) + x.Meaning = pb.Property_BLOB.Enum() + if !p.NoIndex { + return nil, fmt.Errorf("datastore: cannot index a []byte valued Property with Name %q", p.Name) + } + case ByteString: + x.Value.StringValue = proto.String(string(v)) + x.Meaning = pb.Property_BYTESTRING.Enum() + default: + if p.Value != nil { + return nil, fmt.Errorf("datastore: invalid Value type for a Property with Name %q", p.Name) + } + } + + if p.NoIndex { + e.RawProperty = append(e.RawProperty, x) + } else { + e.Property = append(e.Property, x) + if len(e.Property) > maxIndexedProperties { + return nil, errors.New("datastore: too many indexed properties") + } + } + } + return e, nil +} + +// isEmptyValue is taken from the encoding/json package in the standard library. +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + // TODO(perfomance): Only reflect.String needed, other property types are not supported (copy/paste from json package) + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + // TODO(perfomance): Uint* are unsupported property types - should be removed (copy/paste from json package) + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + case reflect.Struct: + switch x := v.Interface().(type) { + case time.Time: + return x.IsZero() + } + } + return false +} diff --git a/vendor/google.golang.org/appengine/datastore/time_test.go b/vendor/google.golang.org/appengine/datastore/time_test.go new file mode 100644 index 000000000..ba74b449e --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/time_test.go @@ -0,0 +1,65 @@ +// Copyright 2012 Google Inc. All Rights Reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "testing" + "time" +) + +func TestUnixMicro(t *testing.T) { + // Test that all these time.Time values survive a round trip to unix micros. + testCases := []time.Time{ + {}, + time.Date(2, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(23, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(234, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1000, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1600, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1700, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1800, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), + time.Unix(-1e6, -1000), + time.Unix(-1e6, 0), + time.Unix(-1e6, +1000), + time.Unix(-60, -1000), + time.Unix(-60, 0), + time.Unix(-60, +1000), + time.Unix(-1, -1000), + time.Unix(-1, 0), + time.Unix(-1, +1000), + time.Unix(0, -3000), + time.Unix(0, -2000), + time.Unix(0, -1000), + time.Unix(0, 0), + time.Unix(0, +1000), + time.Unix(0, +2000), + time.Unix(+60, -1000), + time.Unix(+60, 0), + time.Unix(+60, +1000), + time.Unix(+1e6, -1000), + time.Unix(+1e6, 0), + time.Unix(+1e6, +1000), + time.Date(1999, 12, 31, 23, 59, 59, 999000, time.UTC), + time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), + time.Date(2006, 1, 2, 15, 4, 5, 678000, time.UTC), + time.Date(2009, 11, 10, 23, 0, 0, 0, time.UTC), + time.Date(3456, 1, 1, 0, 0, 0, 0, time.UTC), + } + for _, tc := range testCases { + got := fromUnixMicro(toUnixMicro(tc)) + if !got.Equal(tc) { + t.Errorf("got %q, want %q", got, tc) + } + } + + // Test that a time.Time that isn't an integral number of microseconds + // is not perfectly reconstructed after a round trip. + t0 := time.Unix(0, 123) + t1 := fromUnixMicro(toUnixMicro(t0)) + if t1.Nanosecond()%1000 != 0 || t0.Nanosecond()%1000 == 0 { + t.Errorf("quantization to µs: got %q with %d ns, started with %d ns", t1, t1.Nanosecond(), t0.Nanosecond()) + } +} diff --git a/vendor/google.golang.org/appengine/datastore/transaction.go b/vendor/google.golang.org/appengine/datastore/transaction.go new file mode 100644 index 000000000..2ae8428f8 --- /dev/null +++ b/vendor/google.golang.org/appengine/datastore/transaction.go @@ -0,0 +1,96 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package datastore + +import ( + "errors" + + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/datastore" +) + +func init() { + internal.RegisterTransactionSetter(func(x *pb.Query, t *pb.Transaction) { + x.Transaction = t + }) + internal.RegisterTransactionSetter(func(x *pb.GetRequest, t *pb.Transaction) { + x.Transaction = t + }) + internal.RegisterTransactionSetter(func(x *pb.PutRequest, t *pb.Transaction) { + x.Transaction = t + }) + internal.RegisterTransactionSetter(func(x *pb.DeleteRequest, t *pb.Transaction) { + x.Transaction = t + }) +} + +// ErrConcurrentTransaction is returned when a transaction is rolled back due +// to a conflict with a concurrent transaction. +var ErrConcurrentTransaction = errors.New("datastore: concurrent transaction") + +// RunInTransaction runs f in a transaction. It calls f with a transaction +// context tc that f should use for all App Engine operations. +// +// If f returns nil, RunInTransaction attempts to commit the transaction, +// returning nil if it succeeds. If the commit fails due to a conflicting +// transaction, RunInTransaction retries f, each time with a new transaction +// context. It gives up and returns ErrConcurrentTransaction after three +// failed attempts. The number of attempts can be configured by specifying +// TransactionOptions.Attempts. +// +// If f returns non-nil, then any datastore changes will not be applied and +// RunInTransaction returns that same error. The function f is not retried. +// +// Note that when f returns, the transaction is not yet committed. Calling code +// must be careful not to assume that any of f's changes have been committed +// until RunInTransaction returns nil. +// +// Since f may be called multiple times, f should usually be idempotent. +// datastore.Get is not idempotent when unmarshaling slice fields. +// +// Nested transactions are not supported; c may not be a transaction context. +func RunInTransaction(c context.Context, f func(tc context.Context) error, opts *TransactionOptions) error { + xg := false + if opts != nil { + xg = opts.XG + } + readOnly := false + if opts != nil { + readOnly = opts.ReadOnly + } + attempts := 3 + if opts != nil && opts.Attempts > 0 { + attempts = opts.Attempts + } + var t *pb.Transaction + var err error + for i := 0; i < attempts; i++ { + if t, err = internal.RunTransactionOnce(c, f, xg, readOnly, t); err != internal.ErrConcurrentTransaction { + return err + } + } + return ErrConcurrentTransaction +} + +// TransactionOptions are the options for running a transaction. +type TransactionOptions struct { + // XG is whether the transaction can cross multiple entity groups. In + // comparison, a single group transaction is one where all datastore keys + // used have the same root key. Note that cross group transactions do not + // have the same behavior as single group transactions. In particular, it + // is much more likely to see partially applied transactions in different + // entity groups, in global queries. + // It is valid to set XG to true even if the transaction is within a + // single entity group. + XG bool + // Attempts controls the number of retries to perform when commits fail + // due to a conflicting transaction. If omitted, it defaults to 3. + Attempts int + // ReadOnly controls whether the transaction is a read only transaction. + // Read only transactions are potentially more efficient. + ReadOnly bool +} diff --git a/vendor/google.golang.org/appengine/delay/delay.go b/vendor/google.golang.org/appengine/delay/delay.go new file mode 100644 index 000000000..a5d818602 --- /dev/null +++ b/vendor/google.golang.org/appengine/delay/delay.go @@ -0,0 +1,360 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package delay provides a way to execute code outside the scope of a +user request by using the taskqueue API. + +To declare a function that may be executed later, call Func +in a top-level assignment context, passing it an arbitrary string key +and a function whose first argument is of type context.Context. +The key is used to look up the function so it can be called later. + var laterFunc = delay.Func("key", myFunc) +It is also possible to use a function literal. + var laterFunc = delay.Func("key", func(c context.Context, x string) { + // ... + }) + +To call a function, invoke its Call method. + laterFunc.Call(c, "something") +A function may be called any number of times. If the function has any +return arguments, and the last one is of type error, the function may +return a non-nil error to signal that the function should be retried. + +The arguments to functions may be of any type that is encodable by the gob +package. If an argument is of interface type, it is the client's responsibility +to register with the gob package whatever concrete type may be passed for that +argument; see http://golang.org/pkg/gob/#Register for details. + +Any errors during initialization or execution of a function will be +logged to the application logs. Error logs that occur during initialization will +be associated with the request that invoked the Call method. + +The state of a function invocation that has not yet successfully +executed is preserved by combining the file name in which it is declared +with the string key that was passed to the Func function. Updating an app +with pending function invocations should safe as long as the relevant +functions have the (filename, key) combination preserved. The filename is +parsed according to these rules: + * Paths in package main are shortened to just the file name (github.com/foo/foo.go -> foo.go) + * Paths are stripped to just package paths (/go/src/github.com/foo/bar.go -> github.com/foo/bar.go) + * Module versions are stripped (/go/pkg/mod/github.com/foo/bar@v0.0.0-20181026220418-f595d03440dc/baz.go -> github.com/foo/bar/baz.go) + +There is some inherent risk of pending function invocations being lost during +an update that contains large changes. For example, switching from using GOPATH +to go.mod is a large change that may inadvertently cause file paths to change. + +The delay package uses the Task Queue API to create tasks that call the +reserved application path "/_ah/queue/go/delay". +This path must not be marked as "login: required" in app.yaml; +it must be marked as "login: admin" or have no access restriction. +*/ +package delay // import "google.golang.org/appengine/delay" + +import ( + "bytes" + stdctx "context" + "encoding/gob" + "errors" + "fmt" + "go/build" + stdlog "log" + "net/http" + "path/filepath" + "reflect" + "regexp" + "runtime" + "strings" + + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + "google.golang.org/appengine/log" + "google.golang.org/appengine/taskqueue" +) + +// Function represents a function that may have a delayed invocation. +type Function struct { + fv reflect.Value // Kind() == reflect.Func + key string + err error // any error during initialization +} + +const ( + // The HTTP path for invocations. + path = "/_ah/queue/go/delay" + // Use the default queue. + queue = "" +) + +type contextKey int + +var ( + // registry of all delayed functions + funcs = make(map[string]*Function) + + // precomputed types + errorType = reflect.TypeOf((*error)(nil)).Elem() + + // errors + errFirstArg = errors.New("first argument must be context.Context") + errOutsideDelayFunc = errors.New("request headers are only available inside a delay.Func") + + // context keys + headersContextKey contextKey = 0 + stdContextType = reflect.TypeOf((*stdctx.Context)(nil)).Elem() + netContextType = reflect.TypeOf((*context.Context)(nil)).Elem() +) + +func isContext(t reflect.Type) bool { + return t == stdContextType || t == netContextType +} + +var modVersionPat = regexp.MustCompile("@v[^/]+") + +// fileKey finds a stable representation of the caller's file path. +// For calls from package main: strip all leading path entries, leaving just the filename. +// For calls from anywhere else, strip $GOPATH/src, leaving just the package path and file path. +func fileKey(file string) (string, error) { + if !internal.IsSecondGen() || internal.MainPath == "" { + return file, nil + } + // If the caller is in the same Dir as mainPath, then strip everything but the file name. + if filepath.Dir(file) == internal.MainPath { + return filepath.Base(file), nil + } + // If the path contains "_gopath/src/", which is what the builder uses for + // apps which don't use go modules, strip everything up to and including src. + // Or, if the path starts with /tmp/staging, then we're importing a package + // from the app's module (and we must be using go modules), and we have a + // path like /tmp/staging1234/srv/... so strip everything up to and + // including the first /srv/. + // And be sure to look at the GOPATH, for local development. + s := string(filepath.Separator) + for _, s := range []string{filepath.Join("_gopath", "src") + s, s + "srv" + s, filepath.Join(build.Default.GOPATH, "src") + s} { + if idx := strings.Index(file, s); idx > 0 { + return file[idx+len(s):], nil + } + } + + // Finally, if that all fails then we must be using go modules, and the file is a module, + // so the path looks like /go/pkg/mod/github.com/foo/bar@v0.0.0-20181026220418-f595d03440dc/baz.go + // So... remove everything up to and including mod, plus the @.... version string. + m := "/mod/" + if idx := strings.Index(file, m); idx > 0 { + file = file[idx+len(m):] + } else { + return file, fmt.Errorf("fileKey: unknown file path format for %q", file) + } + return modVersionPat.ReplaceAllString(file, ""), nil +} + +// Func declares a new Function. The second argument must be a function with a +// first argument of type context.Context. +// This function must be called at program initialization time. That means it +// must be called in a global variable declaration or from an init function. +// This restriction is necessary because the instance that delays a function +// call may not be the one that executes it. Only the code executed at program +// initialization time is guaranteed to have been run by an instance before it +// receives a request. +func Func(key string, i interface{}) *Function { + f := &Function{fv: reflect.ValueOf(i)} + + // Derive unique, somewhat stable key for this func. + _, file, _, _ := runtime.Caller(1) + fk, err := fileKey(file) + if err != nil { + // Not fatal, but log the error + stdlog.Printf("delay: %v", err) + } + f.key = fk + ":" + key + + t := f.fv.Type() + if t.Kind() != reflect.Func { + f.err = errors.New("not a function") + return f + } + if t.NumIn() == 0 || !isContext(t.In(0)) { + f.err = errFirstArg + return f + } + + // Register the function's arguments with the gob package. + // This is required because they are marshaled inside a []interface{}. + // gob.Register only expects to be called during initialization; + // that's fine because this function expects the same. + for i := 0; i < t.NumIn(); i++ { + // Only concrete types may be registered. If the argument has + // interface type, the client is resposible for registering the + // concrete types it will hold. + if t.In(i).Kind() == reflect.Interface { + continue + } + gob.Register(reflect.Zero(t.In(i)).Interface()) + } + + if old := funcs[f.key]; old != nil { + old.err = fmt.Errorf("multiple functions registered for %s in %s", key, file) + } + funcs[f.key] = f + return f +} + +type invocation struct { + Key string + Args []interface{} +} + +// Call invokes a delayed function. +// err := f.Call(c, ...) +// is equivalent to +// t, _ := f.Task(...) +// _, err := taskqueue.Add(c, t, "") +func (f *Function) Call(c context.Context, args ...interface{}) error { + t, err := f.Task(args...) + if err != nil { + return err + } + _, err = taskqueueAdder(c, t, queue) + return err +} + +// Task creates a Task that will invoke the function. +// Its parameters may be tweaked before adding it to a queue. +// Users should not modify the Path or Payload fields of the returned Task. +func (f *Function) Task(args ...interface{}) (*taskqueue.Task, error) { + if f.err != nil { + return nil, fmt.Errorf("delay: func is invalid: %v", f.err) + } + + nArgs := len(args) + 1 // +1 for the context.Context + ft := f.fv.Type() + minArgs := ft.NumIn() + if ft.IsVariadic() { + minArgs-- + } + if nArgs < minArgs { + return nil, fmt.Errorf("delay: too few arguments to func: %d < %d", nArgs, minArgs) + } + if !ft.IsVariadic() && nArgs > minArgs { + return nil, fmt.Errorf("delay: too many arguments to func: %d > %d", nArgs, minArgs) + } + + // Check arg types. + for i := 1; i < nArgs; i++ { + at := reflect.TypeOf(args[i-1]) + var dt reflect.Type + if i < minArgs { + // not a variadic arg + dt = ft.In(i) + } else { + // a variadic arg + dt = ft.In(minArgs).Elem() + } + // nil arguments won't have a type, so they need special handling. + if at == nil { + // nil interface + switch dt.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + continue // may be nil + } + return nil, fmt.Errorf("delay: argument %d has wrong type: %v is not nilable", i, dt) + } + switch at.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + av := reflect.ValueOf(args[i-1]) + if av.IsNil() { + // nil value in interface; not supported by gob, so we replace it + // with a nil interface value + args[i-1] = nil + } + } + if !at.AssignableTo(dt) { + return nil, fmt.Errorf("delay: argument %d has wrong type: %v is not assignable to %v", i, at, dt) + } + } + + inv := invocation{ + Key: f.key, + Args: args, + } + + buf := new(bytes.Buffer) + if err := gob.NewEncoder(buf).Encode(inv); err != nil { + return nil, fmt.Errorf("delay: gob encoding failed: %v", err) + } + + return &taskqueue.Task{ + Path: path, + Payload: buf.Bytes(), + }, nil +} + +// Request returns the special task-queue HTTP request headers for the current +// task queue handler. Returns an error if called from outside a delay.Func. +func RequestHeaders(c context.Context) (*taskqueue.RequestHeaders, error) { + if ret, ok := c.Value(headersContextKey).(*taskqueue.RequestHeaders); ok { + return ret, nil + } + return nil, errOutsideDelayFunc +} + +var taskqueueAdder = taskqueue.Add // for testing + +func init() { + http.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + runFunc(appengine.NewContext(req), w, req) + }) +} + +func runFunc(c context.Context, w http.ResponseWriter, req *http.Request) { + defer req.Body.Close() + + c = context.WithValue(c, headersContextKey, taskqueue.ParseRequestHeaders(req.Header)) + + var inv invocation + if err := gob.NewDecoder(req.Body).Decode(&inv); err != nil { + log.Errorf(c, "delay: failed decoding task payload: %v", err) + log.Warningf(c, "delay: dropping task") + return + } + + f := funcs[inv.Key] + if f == nil { + log.Errorf(c, "delay: no func with key %q found", inv.Key) + log.Warningf(c, "delay: dropping task") + return + } + + ft := f.fv.Type() + in := []reflect.Value{reflect.ValueOf(c)} + for _, arg := range inv.Args { + var v reflect.Value + if arg != nil { + v = reflect.ValueOf(arg) + } else { + // Task was passed a nil argument, so we must construct + // the zero value for the argument here. + n := len(in) // we're constructing the nth argument + var at reflect.Type + if !ft.IsVariadic() || n < ft.NumIn()-1 { + at = ft.In(n) + } else { + at = ft.In(ft.NumIn() - 1).Elem() + } + v = reflect.Zero(at) + } + in = append(in, v) + } + out := f.fv.Call(in) + + if n := ft.NumOut(); n > 0 && ft.Out(n-1) == errorType { + if errv := out[n-1]; !errv.IsNil() { + log.Errorf(c, "delay: func failed (will retry): %v", errv.Interface()) + w.WriteHeader(http.StatusInternalServerError) + return + } + } +} diff --git a/vendor/google.golang.org/appengine/delay/delay_test.go b/vendor/google.golang.org/appengine/delay/delay_test.go new file mode 100644 index 000000000..06f2912ea --- /dev/null +++ b/vendor/google.golang.org/appengine/delay/delay_test.go @@ -0,0 +1,541 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package delay + +import ( + "bytes" + stdctx "context" + "encoding/gob" + "errors" + "fmt" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "reflect" + "testing" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + "google.golang.org/appengine/taskqueue" +) + +type CustomType struct { + N int +} + +type CustomInterface interface { + N() int +} + +type CustomImpl int + +func (c CustomImpl) N() int { return int(c) } + +// CustomImpl needs to be registered with gob. +func init() { + gob.Register(CustomImpl(0)) +} + +var ( + invalidFunc = Func("invalid", func() {}) + + regFuncRuns = 0 + regFuncMsg = "" + regFunc = Func("reg", func(c context.Context, arg string) { + regFuncRuns++ + regFuncMsg = arg + }) + + custFuncTally = 0 + custFunc = Func("cust", func(c context.Context, ct *CustomType, ci CustomInterface) { + a, b := 2, 3 + if ct != nil { + a = ct.N + } + if ci != nil { + b = ci.N() + } + custFuncTally += a + b + }) + + anotherCustFunc = Func("cust2", func(c context.Context, n int, ct *CustomType, ci CustomInterface) { + }) + + varFuncMsg = "" + varFunc = Func("variadic", func(c context.Context, format string, args ...int) { + // convert []int to []interface{} for fmt.Sprintf. + as := make([]interface{}, len(args)) + for i, a := range args { + as[i] = a + } + varFuncMsg = fmt.Sprintf(format, as...) + }) + + errFuncRuns = 0 + errFuncErr = errors.New("error!") + errFunc = Func("err", func(c context.Context) error { + errFuncRuns++ + if errFuncRuns == 1 { + return nil + } + return errFuncErr + }) + + dupeWhich = 0 + dupe1Func = Func("dupe", func(c context.Context) { + if dupeWhich == 0 { + dupeWhich = 1 + } + }) + dupe2Func = Func("dupe", func(c context.Context) { + if dupeWhich == 0 { + dupeWhich = 2 + } + }) + + reqFuncRuns = 0 + reqFuncHeaders *taskqueue.RequestHeaders + reqFuncErr error + reqFunc = Func("req", func(c context.Context) { + reqFuncRuns++ + reqFuncHeaders, reqFuncErr = RequestHeaders(c) + }) + + stdCtxRuns = 0 + stdCtxFunc = Func("stdctx", func(c stdctx.Context) { + stdCtxRuns++ + }) +) + +type fakeContext struct { + ctx context.Context + logging [][]interface{} +} + +func newFakeContext() *fakeContext { + f := new(fakeContext) + f.ctx = internal.WithCallOverride(context.Background(), f.call) + f.ctx = internal.WithLogOverride(f.ctx, f.logf) + return f +} + +func (f *fakeContext) call(ctx context.Context, service, method string, in, out proto.Message) error { + panic("should never be called") +} + +var logLevels = map[int64]string{1: "INFO", 3: "ERROR"} + +func (f *fakeContext) logf(level int64, format string, args ...interface{}) { + f.logging = append(f.logging, append([]interface{}{logLevels[level], format}, args...)) +} + +func TestInvalidFunction(t *testing.T) { + c := newFakeContext() + + if got, want := invalidFunc.Call(c.ctx), fmt.Errorf("delay: func is invalid: %s", errFirstArg); got.Error() != want.Error() { + t.Errorf("Incorrect error: got %q, want %q", got, want) + } +} + +func TestVariadicFunctionArguments(t *testing.T) { + // Check the argument type validation for variadic functions. + + c := newFakeContext() + + calls := 0 + taskqueueAdder = func(c context.Context, t *taskqueue.Task, _ string) (*taskqueue.Task, error) { + calls++ + return t, nil + } + + varFunc.Call(c.ctx, "hi") + varFunc.Call(c.ctx, "%d", 12) + varFunc.Call(c.ctx, "%d %d %d", 3, 1, 4) + if calls != 3 { + t.Errorf("Got %d calls to taskqueueAdder, want 3", calls) + } + + if got, want := varFunc.Call(c.ctx, "%d %s", 12, "a string is bad"), errors.New("delay: argument 3 has wrong type: string is not assignable to int"); got.Error() != want.Error() { + t.Errorf("Incorrect error: got %q, want %q", got, want) + } +} + +func TestBadArguments(t *testing.T) { + // Try running regFunc with different sets of inappropriate arguments. + + c := newFakeContext() + + tests := []struct { + args []interface{} // all except context + wantErr string + }{ + { + args: nil, + wantErr: "delay: too few arguments to func: 1 < 2", + }, + { + args: []interface{}{"lala", 53}, + wantErr: "delay: too many arguments to func: 3 > 2", + }, + { + args: []interface{}{53}, + wantErr: "delay: argument 1 has wrong type: int is not assignable to string", + }, + } + for i, tc := range tests { + got := regFunc.Call(c.ctx, tc.args...) + if got.Error() != tc.wantErr { + t.Errorf("Call %v: got %q, want %q", i, got, tc.wantErr) + } + } +} + +func TestRunningFunction(t *testing.T) { + c := newFakeContext() + + // Fake out the adding of a task. + var task *taskqueue.Task + taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) { + if queue != "" { + t.Errorf(`Got queue %q, expected ""`, queue) + } + task = tk + return tk, nil + } + + regFuncRuns, regFuncMsg = 0, "" // reset state + const msg = "Why, hello!" + regFunc.Call(c.ctx, msg) + + // Simulate the Task Queue service. + req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) + if err != nil { + t.Fatalf("Failed making http.Request: %v", err) + } + rw := httptest.NewRecorder() + runFunc(c.ctx, rw, req) + + if regFuncRuns != 1 { + t.Errorf("regFuncRuns: got %d, want 1", regFuncRuns) + } + if regFuncMsg != msg { + t.Errorf("regFuncMsg: got %q, want %q", regFuncMsg, msg) + } +} + +func TestCustomType(t *testing.T) { + c := newFakeContext() + + // Fake out the adding of a task. + var task *taskqueue.Task + taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) { + if queue != "" { + t.Errorf(`Got queue %q, expected ""`, queue) + } + task = tk + return tk, nil + } + + custFuncTally = 0 // reset state + custFunc.Call(c.ctx, &CustomType{N: 11}, CustomImpl(13)) + + // Simulate the Task Queue service. + req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) + if err != nil { + t.Fatalf("Failed making http.Request: %v", err) + } + rw := httptest.NewRecorder() + runFunc(c.ctx, rw, req) + + if custFuncTally != 24 { + t.Errorf("custFuncTally = %d, want 24", custFuncTally) + } + + // Try the same, but with nil values; one is a nil pointer (and thus a non-nil interface value), + // and the other is a nil interface value. + custFuncTally = 0 // reset state + custFunc.Call(c.ctx, (*CustomType)(nil), nil) + + // Simulate the Task Queue service. + req, err = http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) + if err != nil { + t.Fatalf("Failed making http.Request: %v", err) + } + rw = httptest.NewRecorder() + runFunc(c.ctx, rw, req) + + if custFuncTally != 5 { + t.Errorf("custFuncTally = %d, want 5", custFuncTally) + } +} + +func TestRunningVariadic(t *testing.T) { + c := newFakeContext() + + // Fake out the adding of a task. + var task *taskqueue.Task + taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) { + if queue != "" { + t.Errorf(`Got queue %q, expected ""`, queue) + } + task = tk + return tk, nil + } + + varFuncMsg = "" // reset state + varFunc.Call(c.ctx, "Amiga %d has %d KB RAM", 500, 512) + + // Simulate the Task Queue service. + req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) + if err != nil { + t.Fatalf("Failed making http.Request: %v", err) + } + rw := httptest.NewRecorder() + runFunc(c.ctx, rw, req) + + const expected = "Amiga 500 has 512 KB RAM" + if varFuncMsg != expected { + t.Errorf("varFuncMsg = %q, want %q", varFuncMsg, expected) + } +} + +func TestErrorFunction(t *testing.T) { + c := newFakeContext() + + // Fake out the adding of a task. + var task *taskqueue.Task + taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) { + if queue != "" { + t.Errorf(`Got queue %q, expected ""`, queue) + } + task = tk + return tk, nil + } + + errFunc.Call(c.ctx) + + // Simulate the Task Queue service. + // The first call should succeed; the second call should fail. + { + req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) + if err != nil { + t.Fatalf("Failed making http.Request: %v", err) + } + rw := httptest.NewRecorder() + runFunc(c.ctx, rw, req) + } + { + req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) + if err != nil { + t.Fatalf("Failed making http.Request: %v", err) + } + rw := httptest.NewRecorder() + runFunc(c.ctx, rw, req) + if rw.Code != http.StatusInternalServerError { + t.Errorf("Got status code %d, want %d", rw.Code, http.StatusInternalServerError) + } + + wantLogging := [][]interface{}{ + {"ERROR", "delay: func failed (will retry): %v", errFuncErr}, + } + if !reflect.DeepEqual(c.logging, wantLogging) { + t.Errorf("Incorrect logging: got %+v, want %+v", c.logging, wantLogging) + } + } +} + +func TestDuplicateFunction(t *testing.T) { + c := newFakeContext() + + // Fake out the adding of a task. + var task *taskqueue.Task + taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) { + if queue != "" { + t.Errorf(`Got queue %q, expected ""`, queue) + } + task = tk + return tk, nil + } + + if err := dupe1Func.Call(c.ctx); err == nil { + t.Error("dupe1Func.Call did not return error") + } + if task != nil { + t.Error("dupe1Func.Call posted a task") + } + if err := dupe2Func.Call(c.ctx); err != nil { + t.Errorf("dupe2Func.Call error: %v", err) + } + if task == nil { + t.Fatalf("dupe2Func.Call did not post a task") + } + + // Simulate the Task Queue service. + req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) + if err != nil { + t.Fatalf("Failed making http.Request: %v", err) + } + rw := httptest.NewRecorder() + runFunc(c.ctx, rw, req) + + if dupeWhich == 1 { + t.Error("dupe2Func.Call used old registered function") + } else if dupeWhich != 2 { + t.Errorf("dupeWhich = %d; want 2", dupeWhich) + } +} + +func TestGetRequestHeadersFromContext(t *testing.T) { + c := newFakeContext() + + // Outside a delay.Func should return an error. + headers, err := RequestHeaders(c.ctx) + if headers != nil { + t.Errorf("RequestHeaders outside Func, got %v, want nil", headers) + } + if err != errOutsideDelayFunc { + t.Errorf("RequestHeaders outside Func err, got %v, want %v", err, errOutsideDelayFunc) + } + + // Fake out the adding of a task. + var task *taskqueue.Task + taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) { + if queue != "" { + t.Errorf(`Got queue %q, expected ""`, queue) + } + task = tk + return tk, nil + } + + reqFunc.Call(c.ctx) + + reqFuncRuns, reqFuncHeaders = 0, nil // reset state + // Simulate the Task Queue service. + req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) + req.Header.Set("x-appengine-taskname", "foobar") + if err != nil { + t.Fatalf("Failed making http.Request: %v", err) + } + rw := httptest.NewRecorder() + runFunc(c.ctx, rw, req) + + if reqFuncRuns != 1 { + t.Errorf("reqFuncRuns: got %d, want 1", reqFuncRuns) + } + if reqFuncHeaders.TaskName != "foobar" { + t.Errorf("reqFuncHeaders.TaskName: got %v, want 'foobar'", reqFuncHeaders.TaskName) + } + if reqFuncErr != nil { + t.Errorf("reqFuncErr: got %v, want nil", reqFuncErr) + } +} + +func TestStandardContext(t *testing.T) { + // Fake out the adding of a task. + var task *taskqueue.Task + taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) { + if queue != "" { + t.Errorf(`Got queue %q, expected ""`, queue) + } + task = tk + return tk, nil + } + + c := newFakeContext() + stdCtxRuns = 0 // reset state + if err := stdCtxFunc.Call(c.ctx); err != nil { + t.Fatal("Function.Call:", err) + } + + // Simulate the Task Queue service. + req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) + if err != nil { + t.Fatalf("Failed making http.Request: %v", err) + } + rw := httptest.NewRecorder() + runFunc(c.ctx, rw, req) + + if stdCtxRuns != 1 { + t.Errorf("stdCtxRuns: got %d, want 1", stdCtxRuns) + } +} + +func TestFileKey(t *testing.T) { + os.Setenv("GAE_ENV", "standard") + tests := []struct { + mainPath string + file string + want string + }{ + // first-gen + { + "", + filepath.FromSlash("srv/foo.go"), + filepath.FromSlash("srv/foo.go"), + }, + // gopath + { + filepath.FromSlash("/tmp/staging1234/srv/"), + filepath.FromSlash("/tmp/staging1234/srv/foo.go"), + "foo.go", + }, + { + filepath.FromSlash("/tmp/staging1234/srv/_gopath/src/example.com/foo"), + filepath.FromSlash("/tmp/staging1234/srv/_gopath/src/example.com/foo/foo.go"), + "foo.go", + }, + { + filepath.FromSlash("/tmp/staging2234/srv/_gopath/src/example.com/foo"), + filepath.FromSlash("/tmp/staging2234/srv/_gopath/src/example.com/foo/bar/bar.go"), + filepath.FromSlash("example.com/foo/bar/bar.go"), + }, + { + filepath.FromSlash("/tmp/staging3234/srv/_gopath/src/example.com/foo"), + filepath.FromSlash("/tmp/staging3234/srv/_gopath/src/example.com/bar/main.go"), + filepath.FromSlash("example.com/bar/main.go"), + }, + // go mod, same package + { + filepath.FromSlash("/tmp/staging3234/srv"), + filepath.FromSlash("/tmp/staging3234/srv/main.go"), + "main.go", + }, + { + filepath.FromSlash("/tmp/staging3234/srv"), + filepath.FromSlash("/tmp/staging3234/srv/bar/main.go"), + filepath.FromSlash("bar/main.go"), + }, + { + filepath.FromSlash("/tmp/staging3234/srv/cmd"), + filepath.FromSlash("/tmp/staging3234/srv/cmd/main.go"), + "main.go", + }, + { + filepath.FromSlash("/tmp/staging3234/srv/cmd"), + filepath.FromSlash("/tmp/staging3234/srv/bar/main.go"), + filepath.FromSlash("bar/main.go"), + }, + // go mod, other package + { + filepath.FromSlash("/tmp/staging3234/srv"), + filepath.FromSlash("/go/pkg/mod/github.com/foo/bar@v0.0.0-20181026220418-f595d03440dc/baz.go"), + filepath.FromSlash("github.com/foo/bar/baz.go"), + }, + } + for i, tc := range tests { + internal.MainPath = tc.mainPath + got, err := fileKey(tc.file) + if err != nil { + t.Errorf("Unexpected error, call %v, file %q: %v", i, tc.file, err) + continue + } + if got != tc.want { + t.Errorf("Call %v, file %q: got %q, want %q", i, tc.file, got, tc.want) + } + } +} diff --git a/vendor/google.golang.org/appengine/demos/guestbook/app.yaml b/vendor/google.golang.org/appengine/demos/guestbook/app.yaml new file mode 100644 index 000000000..334250332 --- /dev/null +++ b/vendor/google.golang.org/appengine/demos/guestbook/app.yaml @@ -0,0 +1,14 @@ +# Demo application for App Engine "flexible environment". +runtime: go +vm: true +api_version: go1 + +handlers: +# Favicon. Without this, the browser hits this once per page view. +- url: /favicon.ico + static_files: favicon.ico + upload: favicon.ico + +# Main app. All the real work is here. +- url: /.* + script: _go_app diff --git a/vendor/google.golang.org/appengine/demos/guestbook/favicon.ico b/vendor/google.golang.org/appengine/demos/guestbook/favicon.ico new file mode 100644 index 000000000..1a71ea772 Binary files /dev/null and b/vendor/google.golang.org/appengine/demos/guestbook/favicon.ico differ diff --git a/vendor/google.golang.org/appengine/demos/guestbook/guestbook.go b/vendor/google.golang.org/appengine/demos/guestbook/guestbook.go new file mode 100644 index 000000000..04a0432bb --- /dev/null +++ b/vendor/google.golang.org/appengine/demos/guestbook/guestbook.go @@ -0,0 +1,109 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// This example only works on App Engine "flexible environment". +// +build !appengine + +package main + +import ( + "html/template" + "net/http" + "time" + + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/datastore" + "google.golang.org/appengine/log" + "google.golang.org/appengine/user" +) + +var initTime time.Time + +type Greeting struct { + Author string + Content string + Date time.Time +} + +func main() { + http.HandleFunc("/", handleMainPage) + http.HandleFunc("/sign", handleSign) + appengine.Main() +} + +// guestbookKey returns the key used for all guestbook entries. +func guestbookKey(ctx context.Context) *datastore.Key { + // The string "default_guestbook" here could be varied to have multiple guestbooks. + return datastore.NewKey(ctx, "Guestbook", "default_guestbook", 0, nil) +} + +var tpl = template.Must(template.ParseGlob("templates/*.html")) + +func handleMainPage(w http.ResponseWriter, r *http.Request) { + if r.Method != "GET" { + http.Error(w, "GET requests only", http.StatusMethodNotAllowed) + return + } + if r.URL.Path != "/" { + http.NotFound(w, r) + return + } + + ctx := appengine.NewContext(r) + tic := time.Now() + q := datastore.NewQuery("Greeting").Ancestor(guestbookKey(ctx)).Order("-Date").Limit(10) + var gg []*Greeting + if _, err := q.GetAll(ctx, &gg); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + log.Errorf(ctx, "GetAll: %v", err) + return + } + log.Infof(ctx, "Datastore lookup took %s", time.Since(tic).String()) + log.Infof(ctx, "Rendering %d greetings", len(gg)) + + var email, logout, login string + if u := user.Current(ctx); u != nil { + logout, _ = user.LogoutURL(ctx, "/") + email = u.Email + } else { + login, _ = user.LoginURL(ctx, "/") + } + data := struct { + Greetings []*Greeting + Login, Logout, Email string + }{ + Greetings: gg, + Login: login, + Logout: logout, + Email: email, + } + w.Header().Set("Content-Type", "text/html; charset=utf-8") + if err := tpl.ExecuteTemplate(w, "guestbook.html", data); err != nil { + log.Errorf(ctx, "%v", err) + } +} + +func handleSign(w http.ResponseWriter, r *http.Request) { + if r.Method != "POST" { + http.Error(w, "POST requests only", http.StatusMethodNotAllowed) + return + } + ctx := appengine.NewContext(r) + g := &Greeting{ + Content: r.FormValue("content"), + Date: time.Now(), + } + if u := user.Current(ctx); u != nil { + g.Author = u.String() + } + key := datastore.NewIncompleteKey(ctx, "Greeting", guestbookKey(ctx)) + if _, err := datastore.Put(ctx, key, g); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + // Redirect with 303 which causes the subsequent request to use GET. + http.Redirect(w, r, "/", http.StatusSeeOther) +} diff --git a/vendor/google.golang.org/appengine/demos/guestbook/index.yaml b/vendor/google.golang.org/appengine/demos/guestbook/index.yaml new file mode 100644 index 000000000..315ffeb0e --- /dev/null +++ b/vendor/google.golang.org/appengine/demos/guestbook/index.yaml @@ -0,0 +1,7 @@ +indexes: + +- kind: Greeting + ancestor: yes + properties: + - name: Date + direction: desc diff --git a/vendor/google.golang.org/appengine/demos/guestbook/templates/guestbook.html b/vendor/google.golang.org/appengine/demos/guestbook/templates/guestbook.html new file mode 100644 index 000000000..322b7cf63 --- /dev/null +++ b/vendor/google.golang.org/appengine/demos/guestbook/templates/guestbook.html @@ -0,0 +1,26 @@ + + + + Guestbook Demo + + +

+ {{with .Email}}You are currently logged in as {{.}}.{{end}} + {{with .Login}}Sign in{{end}} + {{with .Logout}}Sign out{{end}} +

+ + {{range .Greetings }} +

+ {{with .Author}}{{.}}{{else}}An anonymous person{{end}} + on {{.Date.Format "3:04pm, Mon 2 Jan"}} + wrote

{{.Content}}
+

+ {{end}} + +
+
+
+
+ + diff --git a/vendor/google.golang.org/appengine/demos/helloworld/app.yaml b/vendor/google.golang.org/appengine/demos/helloworld/app.yaml new file mode 100644 index 000000000..15091192f --- /dev/null +++ b/vendor/google.golang.org/appengine/demos/helloworld/app.yaml @@ -0,0 +1,10 @@ +runtime: go +api_version: go1 +vm: true + +handlers: +- url: /favicon.ico + static_files: favicon.ico + upload: favicon.ico +- url: /.* + script: _go_app diff --git a/vendor/google.golang.org/appengine/demos/helloworld/favicon.ico b/vendor/google.golang.org/appengine/demos/helloworld/favicon.ico new file mode 100644 index 000000000..f19c04d27 Binary files /dev/null and b/vendor/google.golang.org/appengine/demos/helloworld/favicon.ico differ diff --git a/vendor/google.golang.org/appengine/demos/helloworld/helloworld.go b/vendor/google.golang.org/appengine/demos/helloworld/helloworld.go new file mode 100644 index 000000000..fbe9f56ed --- /dev/null +++ b/vendor/google.golang.org/appengine/demos/helloworld/helloworld.go @@ -0,0 +1,50 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// This example only works on App Engine "flexible environment". +// +build !appengine + +package main + +import ( + "html/template" + "net/http" + "time" + + "google.golang.org/appengine" + "google.golang.org/appengine/log" +) + +var initTime = time.Now() + +func main() { + http.HandleFunc("/", handle) + appengine.Main() +} + +func handle(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/" { + http.NotFound(w, r) + return + } + + ctx := appengine.NewContext(r) + log.Infof(ctx, "Serving the front page.") + + tmpl.Execute(w, time.Since(initTime)) +} + +var tmpl = template.Must(template.New("front").Parse(` + + +

+Hello, World! 세상아 안녕! +

+ +

+This instance has been running for {{.}}. +

+ + +`)) diff --git a/vendor/google.golang.org/appengine/errors.go b/vendor/google.golang.org/appengine/errors.go new file mode 100644 index 000000000..16d0772e2 --- /dev/null +++ b/vendor/google.golang.org/appengine/errors.go @@ -0,0 +1,46 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// This file provides error functions for common API failure modes. + +package appengine + +import ( + "fmt" + + "google.golang.org/appengine/internal" +) + +// IsOverQuota reports whether err represents an API call failure +// due to insufficient available quota. +func IsOverQuota(err error) bool { + callErr, ok := err.(*internal.CallError) + return ok && callErr.Code == 4 +} + +// MultiError is returned by batch operations when there are errors with +// particular elements. Errors will be in a one-to-one correspondence with +// the input elements; successful elements will have a nil entry. +type MultiError []error + +func (m MultiError) Error() string { + s, n := "", 0 + for _, e := range m { + if e != nil { + if n == 0 { + s = e.Error() + } + n++ + } + } + switch n { + case 0: + return "(0 errors)" + case 1: + return s + case 2: + return s + " (and 1 other error)" + } + return fmt.Sprintf("%s (and %d other errors)", s, n-1) +} diff --git a/vendor/google.golang.org/appengine/file/file.go b/vendor/google.golang.org/appengine/file/file.go new file mode 100644 index 000000000..c3cd58baf --- /dev/null +++ b/vendor/google.golang.org/appengine/file/file.go @@ -0,0 +1,28 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package file provides helper functions for using Google Cloud Storage. +package file + +import ( + "fmt" + + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + aipb "google.golang.org/appengine/internal/app_identity" +) + +// DefaultBucketName returns the name of this application's +// default Google Cloud Storage bucket. +func DefaultBucketName(c context.Context) (string, error) { + req := &aipb.GetDefaultGcsBucketNameRequest{} + res := &aipb.GetDefaultGcsBucketNameResponse{} + + err := internal.Call(c, "app_identity_service", "GetDefaultGcsBucketName", req, res) + if err != nil { + return "", fmt.Errorf("file: no default bucket name returned in RPC response: %v", res) + } + return res.GetDefaultGcsBucketName(), nil +} diff --git a/vendor/google.golang.org/appengine/go.mod b/vendor/google.golang.org/appengine/go.mod new file mode 100644 index 000000000..f449359d2 --- /dev/null +++ b/vendor/google.golang.org/appengine/go.mod @@ -0,0 +1,7 @@ +module google.golang.org/appengine + +require ( + github.com/golang/protobuf v1.2.0 + golang.org/x/net v0.0.0-20180724234803-3673e40ba225 + golang.org/x/text v0.3.0 +) diff --git a/vendor/google.golang.org/appengine/go.sum b/vendor/google.golang.org/appengine/go.sum new file mode 100644 index 000000000..1a221c089 --- /dev/null +++ b/vendor/google.golang.org/appengine/go.sum @@ -0,0 +1,6 @@ +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225 h1:kNX+jCowfMYzvlSvJu5pQWEmyWFrBXJ3PBy10xKMXK8= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/google.golang.org/appengine/identity.go b/vendor/google.golang.org/appengine/identity.go new file mode 100644 index 000000000..b8dcf8f36 --- /dev/null +++ b/vendor/google.golang.org/appengine/identity.go @@ -0,0 +1,142 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package appengine + +import ( + "time" + + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/app_identity" + modpb "google.golang.org/appengine/internal/modules" +) + +// AppID returns the application ID for the current application. +// The string will be a plain application ID (e.g. "appid"), with a +// domain prefix for custom domain deployments (e.g. "example.com:appid"). +func AppID(c context.Context) string { return internal.AppID(c) } + +// DefaultVersionHostname returns the standard hostname of the default version +// of the current application (e.g. "my-app.appspot.com"). This is suitable for +// use in constructing URLs. +func DefaultVersionHostname(c context.Context) string { + return internal.DefaultVersionHostname(c) +} + +// ModuleName returns the module name of the current instance. +func ModuleName(c context.Context) string { + return internal.ModuleName(c) +} + +// ModuleHostname returns a hostname of a module instance. +// If module is the empty string, it refers to the module of the current instance. +// If version is empty, it refers to the version of the current instance if valid, +// or the default version of the module of the current instance. +// If instance is empty, ModuleHostname returns the load-balancing hostname. +func ModuleHostname(c context.Context, module, version, instance string) (string, error) { + req := &modpb.GetHostnameRequest{} + if module != "" { + req.Module = &module + } + if version != "" { + req.Version = &version + } + if instance != "" { + req.Instance = &instance + } + res := &modpb.GetHostnameResponse{} + if err := internal.Call(c, "modules", "GetHostname", req, res); err != nil { + return "", err + } + return *res.Hostname, nil +} + +// VersionID returns the version ID for the current application. +// It will be of the form "X.Y", where X is specified in app.yaml, +// and Y is a number generated when each version of the app is uploaded. +// It does not include a module name. +func VersionID(c context.Context) string { return internal.VersionID(c) } + +// InstanceID returns a mostly-unique identifier for this instance. +func InstanceID() string { return internal.InstanceID() } + +// Datacenter returns an identifier for the datacenter that the instance is running in. +func Datacenter(c context.Context) string { return internal.Datacenter(c) } + +// ServerSoftware returns the App Engine release version. +// In production, it looks like "Google App Engine/X.Y.Z". +// In the development appserver, it looks like "Development/X.Y". +func ServerSoftware() string { return internal.ServerSoftware() } + +// RequestID returns a string that uniquely identifies the request. +func RequestID(c context.Context) string { return internal.RequestID(c) } + +// AccessToken generates an OAuth2 access token for the specified scopes on +// behalf of service account of this application. This token will expire after +// the returned time. +func AccessToken(c context.Context, scopes ...string) (token string, expiry time.Time, err error) { + req := &pb.GetAccessTokenRequest{Scope: scopes} + res := &pb.GetAccessTokenResponse{} + + err = internal.Call(c, "app_identity_service", "GetAccessToken", req, res) + if err != nil { + return "", time.Time{}, err + } + return res.GetAccessToken(), time.Unix(res.GetExpirationTime(), 0), nil +} + +// Certificate represents a public certificate for the app. +type Certificate struct { + KeyName string + Data []byte // PEM-encoded X.509 certificate +} + +// PublicCertificates retrieves the public certificates for the app. +// They can be used to verify a signature returned by SignBytes. +func PublicCertificates(c context.Context) ([]Certificate, error) { + req := &pb.GetPublicCertificateForAppRequest{} + res := &pb.GetPublicCertificateForAppResponse{} + if err := internal.Call(c, "app_identity_service", "GetPublicCertificatesForApp", req, res); err != nil { + return nil, err + } + var cs []Certificate + for _, pc := range res.PublicCertificateList { + cs = append(cs, Certificate{ + KeyName: pc.GetKeyName(), + Data: []byte(pc.GetX509CertificatePem()), + }) + } + return cs, nil +} + +// ServiceAccount returns a string representing the service account name, in +// the form of an email address (typically app_id@appspot.gserviceaccount.com). +func ServiceAccount(c context.Context) (string, error) { + req := &pb.GetServiceAccountNameRequest{} + res := &pb.GetServiceAccountNameResponse{} + + err := internal.Call(c, "app_identity_service", "GetServiceAccountName", req, res) + if err != nil { + return "", err + } + return res.GetServiceAccountName(), err +} + +// SignBytes signs bytes using a private key unique to your application. +func SignBytes(c context.Context, bytes []byte) (keyName string, signature []byte, err error) { + req := &pb.SignForAppRequest{BytesToSign: bytes} + res := &pb.SignForAppResponse{} + + if err := internal.Call(c, "app_identity_service", "SignForApp", req, res); err != nil { + return "", nil, err + } + return res.GetKeyName(), res.GetSignatureBytes(), nil +} + +func init() { + internal.RegisterErrorCodeMap("app_identity_service", pb.AppIdentityServiceError_ErrorCode_name) + internal.RegisterErrorCodeMap("modules", modpb.ModulesServiceError_ErrorCode_name) +} diff --git a/vendor/google.golang.org/appengine/image/image.go b/vendor/google.golang.org/appengine/image/image.go new file mode 100644 index 000000000..027a41b70 --- /dev/null +++ b/vendor/google.golang.org/appengine/image/image.go @@ -0,0 +1,67 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package image provides image services. +package image // import "google.golang.org/appengine/image" + +import ( + "fmt" + "net/url" + + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/image" +) + +type ServingURLOptions struct { + Secure bool // whether the URL should use HTTPS + + // Size must be between zero and 1600. + // If Size is non-zero, a resized version of the image is served, + // and Size is the served image's longest dimension. The aspect ratio is preserved. + // If Crop is true the image is cropped from the center instead of being resized. + Size int + Crop bool +} + +// ServingURL returns a URL that will serve an image from Blobstore. +func ServingURL(c context.Context, key appengine.BlobKey, opts *ServingURLOptions) (*url.URL, error) { + req := &pb.ImagesGetUrlBaseRequest{ + BlobKey: (*string)(&key), + } + if opts != nil && opts.Secure { + req.CreateSecureUrl = &opts.Secure + } + res := &pb.ImagesGetUrlBaseResponse{} + if err := internal.Call(c, "images", "GetUrlBase", req, res); err != nil { + return nil, err + } + + // The URL may have suffixes added to dynamically resize or crop: + // - adding "=s32" will serve the image resized to 32 pixels, preserving the aspect ratio. + // - adding "=s32-c" is the same as "=s32" except it will be cropped. + u := *res.Url + if opts != nil && opts.Size > 0 { + u += fmt.Sprintf("=s%d", opts.Size) + if opts.Crop { + u += "-c" + } + } + return url.Parse(u) +} + +// DeleteServingURL deletes the serving URL for an image. +func DeleteServingURL(c context.Context, key appengine.BlobKey) error { + req := &pb.ImagesDeleteUrlBaseRequest{ + BlobKey: (*string)(&key), + } + res := &pb.ImagesDeleteUrlBaseResponse{} + return internal.Call(c, "images", "DeleteUrlBase", req, res) +} + +func init() { + internal.RegisterErrorCodeMap("images", pb.ImagesServiceError_ErrorCode_name) +} diff --git a/vendor/google.golang.org/appengine/internal/aetesting/fake.go b/vendor/google.golang.org/appengine/internal/aetesting/fake.go new file mode 100644 index 000000000..eb5b2c65b --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/aetesting/fake.go @@ -0,0 +1,81 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package aetesting provides utilities for testing App Engine packages. +// This is not for testing user applications. +package aetesting + +import ( + "fmt" + "net/http" + "reflect" + "testing" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" +) + +// FakeSingleContext returns a context whose Call invocations will be serviced +// by f, which should be a function that has two arguments of the input and output +// protocol buffer type, and one error return. +func FakeSingleContext(t *testing.T, service, method string, f interface{}) context.Context { + fv := reflect.ValueOf(f) + if fv.Kind() != reflect.Func { + t.Fatal("not a function") + } + ft := fv.Type() + if ft.NumIn() != 2 || ft.NumOut() != 1 { + t.Fatalf("f has %d in and %d out, want 2 in and 1 out", ft.NumIn(), ft.NumOut()) + } + for i := 0; i < 2; i++ { + at := ft.In(i) + if !at.Implements(protoMessageType) { + t.Fatalf("arg %d does not implement proto.Message", i) + } + } + if ft.Out(0) != errorType { + t.Fatalf("f's return is %v, want error", ft.Out(0)) + } + s := &single{ + t: t, + service: service, + method: method, + f: fv, + } + return internal.WithCallOverride(internal.ContextForTesting(&http.Request{}), s.call) +} + +var ( + protoMessageType = reflect.TypeOf((*proto.Message)(nil)).Elem() + errorType = reflect.TypeOf((*error)(nil)).Elem() +) + +type single struct { + t *testing.T + service, method string + f reflect.Value +} + +func (s *single) call(ctx context.Context, service, method string, in, out proto.Message) error { + if service == "__go__" { + if method == "GetNamespace" { + return nil // always yield an empty namespace + } + return fmt.Errorf("Unknown API call /%s.%s", service, method) + } + if service != s.service || method != s.method { + s.t.Fatalf("Unexpected call to /%s.%s", service, method) + } + ins := []reflect.Value{ + reflect.ValueOf(in), + reflect.ValueOf(out), + } + outs := s.f.Call(ins) + if outs[0].IsNil() { + return nil + } + return outs[0].Interface().(error) +} diff --git a/vendor/google.golang.org/appengine/internal/api.go b/vendor/google.golang.org/appengine/internal/api.go new file mode 100644 index 000000000..bbc1cb9c3 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/api.go @@ -0,0 +1,671 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package internal + +import ( + "bytes" + "errors" + "fmt" + "io/ioutil" + "log" + "net" + "net/http" + "net/url" + "os" + "runtime" + "strconv" + "strings" + "sync" + "sync/atomic" + "time" + + "github.com/golang/protobuf/proto" + netcontext "golang.org/x/net/context" + + basepb "google.golang.org/appengine/internal/base" + logpb "google.golang.org/appengine/internal/log" + remotepb "google.golang.org/appengine/internal/remote_api" +) + +const ( + apiPath = "/rpc_http" + defaultTicketSuffix = "/default.20150612t184001.0" +) + +var ( + // Incoming headers. + ticketHeader = http.CanonicalHeaderKey("X-AppEngine-API-Ticket") + dapperHeader = http.CanonicalHeaderKey("X-Google-DapperTraceInfo") + traceHeader = http.CanonicalHeaderKey("X-Cloud-Trace-Context") + curNamespaceHeader = http.CanonicalHeaderKey("X-AppEngine-Current-Namespace") + userIPHeader = http.CanonicalHeaderKey("X-AppEngine-User-IP") + remoteAddrHeader = http.CanonicalHeaderKey("X-AppEngine-Remote-Addr") + + // Outgoing headers. + apiEndpointHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Endpoint") + apiEndpointHeaderValue = []string{"app-engine-apis"} + apiMethodHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Method") + apiMethodHeaderValue = []string{"/VMRemoteAPI.CallRemoteAPI"} + apiDeadlineHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Deadline") + apiContentType = http.CanonicalHeaderKey("Content-Type") + apiContentTypeValue = []string{"application/octet-stream"} + logFlushHeader = http.CanonicalHeaderKey("X-AppEngine-Log-Flush-Count") + + apiHTTPClient = &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + Dial: limitDial, + }, + } + + defaultTicketOnce sync.Once + defaultTicket string + backgroundContextOnce sync.Once + backgroundContext netcontext.Context +) + +func apiURL() *url.URL { + host, port := "appengine.googleapis.internal", "10001" + if h := os.Getenv("API_HOST"); h != "" { + host = h + } + if p := os.Getenv("API_PORT"); p != "" { + port = p + } + return &url.URL{ + Scheme: "http", + Host: host + ":" + port, + Path: apiPath, + } +} + +func handleHTTP(w http.ResponseWriter, r *http.Request) { + c := &context{ + req: r, + outHeader: w.Header(), + apiURL: apiURL(), + } + r = r.WithContext(withContext(r.Context(), c)) + c.req = r + + stopFlushing := make(chan int) + + // Patch up RemoteAddr so it looks reasonable. + if addr := r.Header.Get(userIPHeader); addr != "" { + r.RemoteAddr = addr + } else if addr = r.Header.Get(remoteAddrHeader); addr != "" { + r.RemoteAddr = addr + } else { + // Should not normally reach here, but pick a sensible default anyway. + r.RemoteAddr = "127.0.0.1" + } + // The address in the headers will most likely be of these forms: + // 123.123.123.123 + // 2001:db8::1 + // net/http.Request.RemoteAddr is specified to be in "IP:port" form. + if _, _, err := net.SplitHostPort(r.RemoteAddr); err != nil { + // Assume the remote address is only a host; add a default port. + r.RemoteAddr = net.JoinHostPort(r.RemoteAddr, "80") + } + + // Start goroutine responsible for flushing app logs. + // This is done after adding c to ctx.m (and stopped before removing it) + // because flushing logs requires making an API call. + go c.logFlusher(stopFlushing) + + executeRequestSafely(c, r) + c.outHeader = nil // make sure header changes aren't respected any more + + stopFlushing <- 1 // any logging beyond this point will be dropped + + // Flush any pending logs asynchronously. + c.pendingLogs.Lock() + flushes := c.pendingLogs.flushes + if len(c.pendingLogs.lines) > 0 { + flushes++ + } + c.pendingLogs.Unlock() + flushed := make(chan struct{}) + go func() { + defer close(flushed) + // Force a log flush, because with very short requests we + // may not ever flush logs. + c.flushLog(true) + }() + w.Header().Set(logFlushHeader, strconv.Itoa(flushes)) + + // Avoid nil Write call if c.Write is never called. + if c.outCode != 0 { + w.WriteHeader(c.outCode) + } + if c.outBody != nil { + w.Write(c.outBody) + } + // Wait for the last flush to complete before returning, + // otherwise the security ticket will not be valid. + <-flushed +} + +func executeRequestSafely(c *context, r *http.Request) { + defer func() { + if x := recover(); x != nil { + logf(c, 4, "%s", renderPanic(x)) // 4 == critical + c.outCode = 500 + } + }() + + http.DefaultServeMux.ServeHTTP(c, r) +} + +func renderPanic(x interface{}) string { + buf := make([]byte, 16<<10) // 16 KB should be plenty + buf = buf[:runtime.Stack(buf, false)] + + // Remove the first few stack frames: + // this func + // the recover closure in the caller + // That will root the stack trace at the site of the panic. + const ( + skipStart = "internal.renderPanic" + skipFrames = 2 + ) + start := bytes.Index(buf, []byte(skipStart)) + p := start + for i := 0; i < skipFrames*2 && p+1 < len(buf); i++ { + p = bytes.IndexByte(buf[p+1:], '\n') + p + 1 + if p < 0 { + break + } + } + if p >= 0 { + // buf[start:p+1] is the block to remove. + // Copy buf[p+1:] over buf[start:] and shrink buf. + copy(buf[start:], buf[p+1:]) + buf = buf[:len(buf)-(p+1-start)] + } + + // Add panic heading. + head := fmt.Sprintf("panic: %v\n\n", x) + if len(head) > len(buf) { + // Extremely unlikely to happen. + return head + } + copy(buf[len(head):], buf) + copy(buf, head) + + return string(buf) +} + +// context represents the context of an in-flight HTTP request. +// It implements the appengine.Context and http.ResponseWriter interfaces. +type context struct { + req *http.Request + + outCode int + outHeader http.Header + outBody []byte + + pendingLogs struct { + sync.Mutex + lines []*logpb.UserAppLogLine + flushes int + } + + apiURL *url.URL +} + +var contextKey = "holds a *context" + +// jointContext joins two contexts in a superficial way. +// It takes values and timeouts from a base context, and only values from another context. +type jointContext struct { + base netcontext.Context + valuesOnly netcontext.Context +} + +func (c jointContext) Deadline() (time.Time, bool) { + return c.base.Deadline() +} + +func (c jointContext) Done() <-chan struct{} { + return c.base.Done() +} + +func (c jointContext) Err() error { + return c.base.Err() +} + +func (c jointContext) Value(key interface{}) interface{} { + if val := c.base.Value(key); val != nil { + return val + } + return c.valuesOnly.Value(key) +} + +// fromContext returns the App Engine context or nil if ctx is not +// derived from an App Engine context. +func fromContext(ctx netcontext.Context) *context { + c, _ := ctx.Value(&contextKey).(*context) + return c +} + +func withContext(parent netcontext.Context, c *context) netcontext.Context { + ctx := netcontext.WithValue(parent, &contextKey, c) + if ns := c.req.Header.Get(curNamespaceHeader); ns != "" { + ctx = withNamespace(ctx, ns) + } + return ctx +} + +func toContext(c *context) netcontext.Context { + return withContext(netcontext.Background(), c) +} + +func IncomingHeaders(ctx netcontext.Context) http.Header { + if c := fromContext(ctx); c != nil { + return c.req.Header + } + return nil +} + +func ReqContext(req *http.Request) netcontext.Context { + return req.Context() +} + +func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context { + return jointContext{ + base: parent, + valuesOnly: req.Context(), + } +} + +// DefaultTicket returns a ticket used for background context or dev_appserver. +func DefaultTicket() string { + defaultTicketOnce.Do(func() { + if IsDevAppServer() { + defaultTicket = "testapp" + defaultTicketSuffix + return + } + appID := partitionlessAppID() + escAppID := strings.Replace(strings.Replace(appID, ":", "_", -1), ".", "_", -1) + majVersion := VersionID(nil) + if i := strings.Index(majVersion, "."); i > 0 { + majVersion = majVersion[:i] + } + defaultTicket = fmt.Sprintf("%s/%s.%s.%s", escAppID, ModuleName(nil), majVersion, InstanceID()) + }) + return defaultTicket +} + +func BackgroundContext() netcontext.Context { + backgroundContextOnce.Do(func() { + // Compute background security ticket. + ticket := DefaultTicket() + + c := &context{ + req: &http.Request{ + Header: http.Header{ + ticketHeader: []string{ticket}, + }, + }, + apiURL: apiURL(), + } + backgroundContext = toContext(c) + + // TODO(dsymonds): Wire up the shutdown handler to do a final flush. + go c.logFlusher(make(chan int)) + }) + + return backgroundContext +} + +// RegisterTestRequest registers the HTTP request req for testing, such that +// any API calls are sent to the provided URL. It returns a closure to delete +// the registration. +// It should only be used by aetest package. +func RegisterTestRequest(req *http.Request, apiURL *url.URL, decorate func(netcontext.Context) netcontext.Context) (*http.Request, func()) { + c := &context{ + req: req, + apiURL: apiURL, + } + ctx := withContext(decorate(req.Context()), c) + req = req.WithContext(ctx) + c.req = req + return req, func() {} +} + +var errTimeout = &CallError{ + Detail: "Deadline exceeded", + Code: int32(remotepb.RpcError_CANCELLED), + Timeout: true, +} + +func (c *context) Header() http.Header { return c.outHeader } + +// Copied from $GOROOT/src/pkg/net/http/transfer.go. Some response status +// codes do not permit a response body (nor response entity headers such as +// Content-Length, Content-Type, etc). +func bodyAllowedForStatus(status int) bool { + switch { + case status >= 100 && status <= 199: + return false + case status == 204: + return false + case status == 304: + return false + } + return true +} + +func (c *context) Write(b []byte) (int, error) { + if c.outCode == 0 { + c.WriteHeader(http.StatusOK) + } + if len(b) > 0 && !bodyAllowedForStatus(c.outCode) { + return 0, http.ErrBodyNotAllowed + } + c.outBody = append(c.outBody, b...) + return len(b), nil +} + +func (c *context) WriteHeader(code int) { + if c.outCode != 0 { + logf(c, 3, "WriteHeader called multiple times on request.") // error level + return + } + c.outCode = code +} + +func (c *context) post(body []byte, timeout time.Duration) (b []byte, err error) { + hreq := &http.Request{ + Method: "POST", + URL: c.apiURL, + Header: http.Header{ + apiEndpointHeader: apiEndpointHeaderValue, + apiMethodHeader: apiMethodHeaderValue, + apiContentType: apiContentTypeValue, + apiDeadlineHeader: []string{strconv.FormatFloat(timeout.Seconds(), 'f', -1, 64)}, + }, + Body: ioutil.NopCloser(bytes.NewReader(body)), + ContentLength: int64(len(body)), + Host: c.apiURL.Host, + } + if info := c.req.Header.Get(dapperHeader); info != "" { + hreq.Header.Set(dapperHeader, info) + } + if info := c.req.Header.Get(traceHeader); info != "" { + hreq.Header.Set(traceHeader, info) + } + + tr := apiHTTPClient.Transport.(*http.Transport) + + var timedOut int32 // atomic; set to 1 if timed out + t := time.AfterFunc(timeout, func() { + atomic.StoreInt32(&timedOut, 1) + tr.CancelRequest(hreq) + }) + defer t.Stop() + defer func() { + // Check if timeout was exceeded. + if atomic.LoadInt32(&timedOut) != 0 { + err = errTimeout + } + }() + + hresp, err := apiHTTPClient.Do(hreq) + if err != nil { + return nil, &CallError{ + Detail: fmt.Sprintf("service bridge HTTP failed: %v", err), + Code: int32(remotepb.RpcError_UNKNOWN), + } + } + defer hresp.Body.Close() + hrespBody, err := ioutil.ReadAll(hresp.Body) + if hresp.StatusCode != 200 { + return nil, &CallError{ + Detail: fmt.Sprintf("service bridge returned HTTP %d (%q)", hresp.StatusCode, hrespBody), + Code: int32(remotepb.RpcError_UNKNOWN), + } + } + if err != nil { + return nil, &CallError{ + Detail: fmt.Sprintf("service bridge response bad: %v", err), + Code: int32(remotepb.RpcError_UNKNOWN), + } + } + return hrespBody, nil +} + +func Call(ctx netcontext.Context, service, method string, in, out proto.Message) error { + if ns := NamespaceFromContext(ctx); ns != "" { + if fn, ok := NamespaceMods[service]; ok { + fn(in, ns) + } + } + + if f, ctx, ok := callOverrideFromContext(ctx); ok { + return f(ctx, service, method, in, out) + } + + // Handle already-done contexts quickly. + select { + case <-ctx.Done(): + return ctx.Err() + default: + } + + c := fromContext(ctx) + if c == nil { + // Give a good error message rather than a panic lower down. + return errNotAppEngineContext + } + + // Apply transaction modifications if we're in a transaction. + if t := transactionFromContext(ctx); t != nil { + if t.finished { + return errors.New("transaction context has expired") + } + applyTransaction(in, &t.transaction) + } + + // Default RPC timeout is 60s. + timeout := 60 * time.Second + if deadline, ok := ctx.Deadline(); ok { + timeout = deadline.Sub(time.Now()) + } + + data, err := proto.Marshal(in) + if err != nil { + return err + } + + ticket := c.req.Header.Get(ticketHeader) + // Use a test ticket under test environment. + if ticket == "" { + if appid := ctx.Value(&appIDOverrideKey); appid != nil { + ticket = appid.(string) + defaultTicketSuffix + } + } + // Fall back to use background ticket when the request ticket is not available in Flex or dev_appserver. + if ticket == "" { + ticket = DefaultTicket() + } + req := &remotepb.Request{ + ServiceName: &service, + Method: &method, + Request: data, + RequestId: &ticket, + } + hreqBody, err := proto.Marshal(req) + if err != nil { + return err + } + + hrespBody, err := c.post(hreqBody, timeout) + if err != nil { + return err + } + + res := &remotepb.Response{} + if err := proto.Unmarshal(hrespBody, res); err != nil { + return err + } + if res.RpcError != nil { + ce := &CallError{ + Detail: res.RpcError.GetDetail(), + Code: *res.RpcError.Code, + } + switch remotepb.RpcError_ErrorCode(ce.Code) { + case remotepb.RpcError_CANCELLED, remotepb.RpcError_DEADLINE_EXCEEDED: + ce.Timeout = true + } + return ce + } + if res.ApplicationError != nil { + return &APIError{ + Service: *req.ServiceName, + Detail: res.ApplicationError.GetDetail(), + Code: *res.ApplicationError.Code, + } + } + if res.Exception != nil || res.JavaException != nil { + // This shouldn't happen, but let's be defensive. + return &CallError{ + Detail: "service bridge returned exception", + Code: int32(remotepb.RpcError_UNKNOWN), + } + } + return proto.Unmarshal(res.Response, out) +} + +func (c *context) Request() *http.Request { + return c.req +} + +func (c *context) addLogLine(ll *logpb.UserAppLogLine) { + // Truncate long log lines. + // TODO(dsymonds): Check if this is still necessary. + const lim = 8 << 10 + if len(*ll.Message) > lim { + suffix := fmt.Sprintf("...(length %d)", len(*ll.Message)) + ll.Message = proto.String((*ll.Message)[:lim-len(suffix)] + suffix) + } + + c.pendingLogs.Lock() + c.pendingLogs.lines = append(c.pendingLogs.lines, ll) + c.pendingLogs.Unlock() +} + +var logLevelName = map[int64]string{ + 0: "DEBUG", + 1: "INFO", + 2: "WARNING", + 3: "ERROR", + 4: "CRITICAL", +} + +func logf(c *context, level int64, format string, args ...interface{}) { + if c == nil { + panic("not an App Engine context") + } + s := fmt.Sprintf(format, args...) + s = strings.TrimRight(s, "\n") // Remove any trailing newline characters. + c.addLogLine(&logpb.UserAppLogLine{ + TimestampUsec: proto.Int64(time.Now().UnixNano() / 1e3), + Level: &level, + Message: &s, + }) + // Only duplicate log to stderr if not running on App Engine second generation + if !IsSecondGen() { + log.Print(logLevelName[level] + ": " + s) + } +} + +// flushLog attempts to flush any pending logs to the appserver. +// It should not be called concurrently. +func (c *context) flushLog(force bool) (flushed bool) { + c.pendingLogs.Lock() + // Grab up to 30 MB. We can get away with up to 32 MB, but let's be cautious. + n, rem := 0, 30<<20 + for ; n < len(c.pendingLogs.lines); n++ { + ll := c.pendingLogs.lines[n] + // Each log line will require about 3 bytes of overhead. + nb := proto.Size(ll) + 3 + if nb > rem { + break + } + rem -= nb + } + lines := c.pendingLogs.lines[:n] + c.pendingLogs.lines = c.pendingLogs.lines[n:] + c.pendingLogs.Unlock() + + if len(lines) == 0 && !force { + // Nothing to flush. + return false + } + + rescueLogs := false + defer func() { + if rescueLogs { + c.pendingLogs.Lock() + c.pendingLogs.lines = append(lines, c.pendingLogs.lines...) + c.pendingLogs.Unlock() + } + }() + + buf, err := proto.Marshal(&logpb.UserAppLogGroup{ + LogLine: lines, + }) + if err != nil { + log.Printf("internal.flushLog: marshaling UserAppLogGroup: %v", err) + rescueLogs = true + return false + } + + req := &logpb.FlushRequest{ + Logs: buf, + } + res := &basepb.VoidProto{} + c.pendingLogs.Lock() + c.pendingLogs.flushes++ + c.pendingLogs.Unlock() + if err := Call(toContext(c), "logservice", "Flush", req, res); err != nil { + log.Printf("internal.flushLog: Flush RPC: %v", err) + rescueLogs = true + return false + } + return true +} + +const ( + // Log flushing parameters. + flushInterval = 1 * time.Second + forceFlushInterval = 60 * time.Second +) + +func (c *context) logFlusher(stop <-chan int) { + lastFlush := time.Now() + tick := time.NewTicker(flushInterval) + for { + select { + case <-stop: + // Request finished. + tick.Stop() + return + case <-tick.C: + force := time.Now().Sub(lastFlush) > forceFlushInterval + if c.flushLog(force) { + lastFlush = time.Now() + } + } + } +} + +func ContextForTesting(req *http.Request) netcontext.Context { + return toContext(&context{req: req}) +} diff --git a/vendor/google.golang.org/appengine/internal/api_classic.go b/vendor/google.golang.org/appengine/internal/api_classic.go new file mode 100644 index 000000000..f0f40b2e3 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/api_classic.go @@ -0,0 +1,169 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build appengine + +package internal + +import ( + "errors" + "fmt" + "net/http" + "time" + + "appengine" + "appengine_internal" + basepb "appengine_internal/base" + + "github.com/golang/protobuf/proto" + netcontext "golang.org/x/net/context" +) + +var contextKey = "holds an appengine.Context" + +// fromContext returns the App Engine context or nil if ctx is not +// derived from an App Engine context. +func fromContext(ctx netcontext.Context) appengine.Context { + c, _ := ctx.Value(&contextKey).(appengine.Context) + return c +} + +// This is only for classic App Engine adapters. +func ClassicContextFromContext(ctx netcontext.Context) (appengine.Context, error) { + c := fromContext(ctx) + if c == nil { + return nil, errNotAppEngineContext + } + return c, nil +} + +func withContext(parent netcontext.Context, c appengine.Context) netcontext.Context { + ctx := netcontext.WithValue(parent, &contextKey, c) + + s := &basepb.StringProto{} + c.Call("__go__", "GetNamespace", &basepb.VoidProto{}, s, nil) + if ns := s.GetValue(); ns != "" { + ctx = NamespacedContext(ctx, ns) + } + + return ctx +} + +func IncomingHeaders(ctx netcontext.Context) http.Header { + if c := fromContext(ctx); c != nil { + if req, ok := c.Request().(*http.Request); ok { + return req.Header + } + } + return nil +} + +func ReqContext(req *http.Request) netcontext.Context { + return WithContext(netcontext.Background(), req) +} + +func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context { + c := appengine.NewContext(req) + return withContext(parent, c) +} + +type testingContext struct { + appengine.Context + + req *http.Request +} + +func (t *testingContext) FullyQualifiedAppID() string { return "dev~testcontext" } +func (t *testingContext) Call(service, method string, _, _ appengine_internal.ProtoMessage, _ *appengine_internal.CallOptions) error { + if service == "__go__" && method == "GetNamespace" { + return nil + } + return fmt.Errorf("testingContext: unsupported Call") +} +func (t *testingContext) Request() interface{} { return t.req } + +func ContextForTesting(req *http.Request) netcontext.Context { + return withContext(netcontext.Background(), &testingContext{req: req}) +} + +func Call(ctx netcontext.Context, service, method string, in, out proto.Message) error { + if ns := NamespaceFromContext(ctx); ns != "" { + if fn, ok := NamespaceMods[service]; ok { + fn(in, ns) + } + } + + if f, ctx, ok := callOverrideFromContext(ctx); ok { + return f(ctx, service, method, in, out) + } + + // Handle already-done contexts quickly. + select { + case <-ctx.Done(): + return ctx.Err() + default: + } + + c := fromContext(ctx) + if c == nil { + // Give a good error message rather than a panic lower down. + return errNotAppEngineContext + } + + // Apply transaction modifications if we're in a transaction. + if t := transactionFromContext(ctx); t != nil { + if t.finished { + return errors.New("transaction context has expired") + } + applyTransaction(in, &t.transaction) + } + + var opts *appengine_internal.CallOptions + if d, ok := ctx.Deadline(); ok { + opts = &appengine_internal.CallOptions{ + Timeout: d.Sub(time.Now()), + } + } + + err := c.Call(service, method, in, out, opts) + switch v := err.(type) { + case *appengine_internal.APIError: + return &APIError{ + Service: v.Service, + Detail: v.Detail, + Code: v.Code, + } + case *appengine_internal.CallError: + return &CallError{ + Detail: v.Detail, + Code: v.Code, + Timeout: v.Timeout, + } + } + return err +} + +func handleHTTP(w http.ResponseWriter, r *http.Request) { + panic("handleHTTP called; this should be impossible") +} + +func logf(c appengine.Context, level int64, format string, args ...interface{}) { + var fn func(format string, args ...interface{}) + switch level { + case 0: + fn = c.Debugf + case 1: + fn = c.Infof + case 2: + fn = c.Warningf + case 3: + fn = c.Errorf + case 4: + fn = c.Criticalf + default: + // This shouldn't happen. + fn = c.Criticalf + } + fn(format, args...) +} diff --git a/vendor/google.golang.org/appengine/internal/api_common.go b/vendor/google.golang.org/appengine/internal/api_common.go new file mode 100644 index 000000000..e0c0b214b --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/api_common.go @@ -0,0 +1,123 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package internal + +import ( + "errors" + "os" + + "github.com/golang/protobuf/proto" + netcontext "golang.org/x/net/context" +) + +var errNotAppEngineContext = errors.New("not an App Engine context") + +type CallOverrideFunc func(ctx netcontext.Context, service, method string, in, out proto.Message) error + +var callOverrideKey = "holds []CallOverrideFunc" + +func WithCallOverride(ctx netcontext.Context, f CallOverrideFunc) netcontext.Context { + // We avoid appending to any existing call override + // so we don't risk overwriting a popped stack below. + var cofs []CallOverrideFunc + if uf, ok := ctx.Value(&callOverrideKey).([]CallOverrideFunc); ok { + cofs = append(cofs, uf...) + } + cofs = append(cofs, f) + return netcontext.WithValue(ctx, &callOverrideKey, cofs) +} + +func callOverrideFromContext(ctx netcontext.Context) (CallOverrideFunc, netcontext.Context, bool) { + cofs, _ := ctx.Value(&callOverrideKey).([]CallOverrideFunc) + if len(cofs) == 0 { + return nil, nil, false + } + // We found a list of overrides; grab the last, and reconstitute a + // context that will hide it. + f := cofs[len(cofs)-1] + ctx = netcontext.WithValue(ctx, &callOverrideKey, cofs[:len(cofs)-1]) + return f, ctx, true +} + +type logOverrideFunc func(level int64, format string, args ...interface{}) + +var logOverrideKey = "holds a logOverrideFunc" + +func WithLogOverride(ctx netcontext.Context, f logOverrideFunc) netcontext.Context { + return netcontext.WithValue(ctx, &logOverrideKey, f) +} + +var appIDOverrideKey = "holds a string, being the full app ID" + +func WithAppIDOverride(ctx netcontext.Context, appID string) netcontext.Context { + return netcontext.WithValue(ctx, &appIDOverrideKey, appID) +} + +var namespaceKey = "holds the namespace string" + +func withNamespace(ctx netcontext.Context, ns string) netcontext.Context { + return netcontext.WithValue(ctx, &namespaceKey, ns) +} + +func NamespaceFromContext(ctx netcontext.Context) string { + // If there's no namespace, return the empty string. + ns, _ := ctx.Value(&namespaceKey).(string) + return ns +} + +// FullyQualifiedAppID returns the fully-qualified application ID. +// This may contain a partition prefix (e.g. "s~" for High Replication apps), +// or a domain prefix (e.g. "example.com:"). +func FullyQualifiedAppID(ctx netcontext.Context) string { + if id, ok := ctx.Value(&appIDOverrideKey).(string); ok { + return id + } + return fullyQualifiedAppID(ctx) +} + +func Logf(ctx netcontext.Context, level int64, format string, args ...interface{}) { + if f, ok := ctx.Value(&logOverrideKey).(logOverrideFunc); ok { + f(level, format, args...) + return + } + c := fromContext(ctx) + if c == nil { + panic(errNotAppEngineContext) + } + logf(c, level, format, args...) +} + +// NamespacedContext wraps a Context to support namespaces. +func NamespacedContext(ctx netcontext.Context, namespace string) netcontext.Context { + return withNamespace(ctx, namespace) +} + +// SetTestEnv sets the env variables for testing background ticket in Flex. +func SetTestEnv() func() { + var environ = []struct { + key, value string + }{ + {"GAE_LONG_APP_ID", "my-app-id"}, + {"GAE_MINOR_VERSION", "067924799508853122"}, + {"GAE_MODULE_INSTANCE", "0"}, + {"GAE_MODULE_NAME", "default"}, + {"GAE_MODULE_VERSION", "20150612t184001"}, + } + + for _, v := range environ { + old := os.Getenv(v.key) + os.Setenv(v.key, v.value) + v.value = old + } + return func() { // Restore old environment after the test completes. + for _, v := range environ { + if v.value == "" { + os.Unsetenv(v.key) + continue + } + os.Setenv(v.key, v.value) + } + } +} diff --git a/vendor/google.golang.org/appengine/internal/api_race_test.go b/vendor/google.golang.org/appengine/internal/api_race_test.go new file mode 100644 index 000000000..6cfe90649 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/api_race_test.go @@ -0,0 +1,9 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build race + +package internal + +func init() { raceDetector = true } diff --git a/vendor/google.golang.org/appengine/internal/api_test.go b/vendor/google.golang.org/appengine/internal/api_test.go new file mode 100644 index 000000000..8369b335c --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/api_test.go @@ -0,0 +1,500 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package internal + +import ( + "bufio" + "bytes" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/http/httptest" + "net/url" + "os" + "os/exec" + "strings" + "sync/atomic" + "testing" + "time" + + "github.com/golang/protobuf/proto" + netcontext "golang.org/x/net/context" + + basepb "google.golang.org/appengine/internal/base" + remotepb "google.golang.org/appengine/internal/remote_api" +) + +const testTicketHeader = "X-Magic-Ticket-Header" + +func init() { + ticketHeader = testTicketHeader +} + +type fakeAPIHandler struct { + hang chan int // used for RunSlowly RPC + + LogFlushes int32 // atomic +} + +func (f *fakeAPIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + writeResponse := func(res *remotepb.Response) { + hresBody, err := proto.Marshal(res) + if err != nil { + http.Error(w, fmt.Sprintf("Failed encoding API response: %v", err), 500) + return + } + w.Write(hresBody) + } + + if r.URL.Path != "/rpc_http" { + http.NotFound(w, r) + return + } + hreqBody, err := ioutil.ReadAll(r.Body) + if err != nil { + http.Error(w, fmt.Sprintf("Bad body: %v", err), 500) + return + } + apiReq := &remotepb.Request{} + if err := proto.Unmarshal(hreqBody, apiReq); err != nil { + http.Error(w, fmt.Sprintf("Bad encoded API request: %v", err), 500) + return + } + if *apiReq.RequestId != "s3cr3t" && *apiReq.RequestId != DefaultTicket() { + writeResponse(&remotepb.Response{ + RpcError: &remotepb.RpcError{ + Code: proto.Int32(int32(remotepb.RpcError_SECURITY_VIOLATION)), + Detail: proto.String("bad security ticket"), + }, + }) + return + } + if got, want := r.Header.Get(dapperHeader), "trace-001"; got != want { + writeResponse(&remotepb.Response{ + RpcError: &remotepb.RpcError{ + Code: proto.Int32(int32(remotepb.RpcError_BAD_REQUEST)), + Detail: proto.String(fmt.Sprintf("trace info = %q, want %q", got, want)), + }, + }) + return + } + + service, method := *apiReq.ServiceName, *apiReq.Method + var resOut proto.Message + if service == "actordb" && method == "LookupActor" { + req := &basepb.StringProto{} + res := &basepb.StringProto{} + if err := proto.Unmarshal(apiReq.Request, req); err != nil { + http.Error(w, fmt.Sprintf("Bad encoded request: %v", err), 500) + return + } + if *req.Value == "Doctor Who" { + res.Value = proto.String("David Tennant") + } + resOut = res + } + if service == "errors" { + switch method { + case "Non200": + http.Error(w, "I'm a little teapot.", 418) + return + case "ShortResponse": + w.Header().Set("Content-Length", "100") + w.Write([]byte("way too short")) + return + case "OverQuota": + writeResponse(&remotepb.Response{ + RpcError: &remotepb.RpcError{ + Code: proto.Int32(int32(remotepb.RpcError_OVER_QUOTA)), + Detail: proto.String("you are hogging the resources!"), + }, + }) + return + case "RunSlowly": + // TestAPICallRPCFailure creates f.hang, but does not strobe it + // until Call returns with remotepb.RpcError_CANCELLED. + // This is here to force a happens-before relationship between + // the httptest server handler and shutdown. + <-f.hang + resOut = &basepb.VoidProto{} + } + } + if service == "logservice" && method == "Flush" { + // Pretend log flushing is slow. + time.Sleep(50 * time.Millisecond) + atomic.AddInt32(&f.LogFlushes, 1) + resOut = &basepb.VoidProto{} + } + + encOut, err := proto.Marshal(resOut) + if err != nil { + http.Error(w, fmt.Sprintf("Failed encoding response: %v", err), 500) + return + } + writeResponse(&remotepb.Response{ + Response: encOut, + }) +} + +func setup() (f *fakeAPIHandler, c *context, cleanup func()) { + f = &fakeAPIHandler{} + srv := httptest.NewServer(f) + u, err := url.Parse(srv.URL + apiPath) + if err != nil { + panic(fmt.Sprintf("url.Parse(%q): %v", srv.URL+apiPath, err)) + } + return f, &context{ + req: &http.Request{ + Header: http.Header{ + ticketHeader: []string{"s3cr3t"}, + dapperHeader: []string{"trace-001"}, + }, + }, + apiURL: u, + }, srv.Close +} + +func TestAPICall(t *testing.T) { + _, c, cleanup := setup() + defer cleanup() + + req := &basepb.StringProto{ + Value: proto.String("Doctor Who"), + } + res := &basepb.StringProto{} + err := Call(toContext(c), "actordb", "LookupActor", req, res) + if err != nil { + t.Fatalf("API call failed: %v", err) + } + if got, want := *res.Value, "David Tennant"; got != want { + t.Errorf("Response is %q, want %q", got, want) + } +} + +func TestAPICallTicketUnavailable(t *testing.T) { + resetEnv := SetTestEnv() + defer resetEnv() + _, c, cleanup := setup() + defer cleanup() + + c.req.Header.Set(ticketHeader, "") + req := &basepb.StringProto{ + Value: proto.String("Doctor Who"), + } + res := &basepb.StringProto{} + err := Call(toContext(c), "actordb", "LookupActor", req, res) + if err != nil { + t.Fatalf("API call failed: %v", err) + } + if got, want := *res.Value, "David Tennant"; got != want { + t.Errorf("Response is %q, want %q", got, want) + } +} + +func TestAPICallRPCFailure(t *testing.T) { + f, c, cleanup := setup() + defer cleanup() + + testCases := []struct { + method string + code remotepb.RpcError_ErrorCode + }{ + {"Non200", remotepb.RpcError_UNKNOWN}, + {"ShortResponse", remotepb.RpcError_UNKNOWN}, + {"OverQuota", remotepb.RpcError_OVER_QUOTA}, + {"RunSlowly", remotepb.RpcError_CANCELLED}, + } + f.hang = make(chan int) // only for RunSlowly + for _, tc := range testCases { + ctx, _ := netcontext.WithTimeout(toContext(c), 100*time.Millisecond) + err := Call(ctx, "errors", tc.method, &basepb.VoidProto{}, &basepb.VoidProto{}) + ce, ok := err.(*CallError) + if !ok { + t.Errorf("%s: API call error is %T (%v), want *CallError", tc.method, err, err) + continue + } + if ce.Code != int32(tc.code) { + t.Errorf("%s: ce.Code = %d, want %d", tc.method, ce.Code, tc.code) + } + if tc.method == "RunSlowly" { + f.hang <- 1 // release the HTTP handler + } + } +} + +func TestAPICallDialFailure(t *testing.T) { + // See what happens if the API host is unresponsive. + // This should time out quickly, not hang forever. + _, c, cleanup := setup() + defer cleanup() + // Reset the URL to the production address so that dialing fails. + c.apiURL = apiURL() + + start := time.Now() + err := Call(toContext(c), "foo", "bar", &basepb.VoidProto{}, &basepb.VoidProto{}) + const max = 1 * time.Second + if taken := time.Since(start); taken > max { + t.Errorf("Dial hang took too long: %v > %v", taken, max) + } + if err == nil { + t.Error("Call did not fail") + } +} + +func TestDelayedLogFlushing(t *testing.T) { + f, c, cleanup := setup() + defer cleanup() + + http.HandleFunc("/slow_log", func(w http.ResponseWriter, r *http.Request) { + logC := WithContext(netcontext.Background(), r) + fromContext(logC).apiURL = c.apiURL // Otherwise it will try to use the default URL. + Logf(logC, 1, "It's a lovely day.") + w.WriteHeader(200) + time.Sleep(1200 * time.Millisecond) + w.Write(make([]byte, 100<<10)) // write 100 KB to force HTTP flush + }) + + r := &http.Request{ + Method: "GET", + URL: &url.URL{ + Scheme: "http", + Path: "/slow_log", + }, + Header: c.req.Header, + Body: ioutil.NopCloser(bytes.NewReader(nil)), + } + w := httptest.NewRecorder() + + handled := make(chan struct{}) + go func() { + defer close(handled) + handleHTTP(w, r) + }() + // Check that the log flush eventually comes in. + time.Sleep(1200 * time.Millisecond) + if f := atomic.LoadInt32(&f.LogFlushes); f != 1 { + t.Errorf("After 1.2s: f.LogFlushes = %d, want 1", f) + } + + <-handled + const hdr = "X-AppEngine-Log-Flush-Count" + if got, want := w.HeaderMap.Get(hdr), "1"; got != want { + t.Errorf("%s header = %q, want %q", hdr, got, want) + } + if got, want := atomic.LoadInt32(&f.LogFlushes), int32(2); got != want { + t.Errorf("After HTTP response: f.LogFlushes = %d, want %d", got, want) + } + +} + +func TestLogFlushing(t *testing.T) { + f, c, cleanup := setup() + defer cleanup() + + http.HandleFunc("/quick_log", func(w http.ResponseWriter, r *http.Request) { + logC := WithContext(netcontext.Background(), r) + fromContext(logC).apiURL = c.apiURL // Otherwise it will try to use the default URL. + Logf(logC, 1, "It's a lovely day.") + w.WriteHeader(200) + w.Write(make([]byte, 100<<10)) // write 100 KB to force HTTP flush + }) + + r := &http.Request{ + Method: "GET", + URL: &url.URL{ + Scheme: "http", + Path: "/quick_log", + }, + Header: c.req.Header, + Body: ioutil.NopCloser(bytes.NewReader(nil)), + } + w := httptest.NewRecorder() + + handleHTTP(w, r) + const hdr = "X-AppEngine-Log-Flush-Count" + if got, want := w.HeaderMap.Get(hdr), "1"; got != want { + t.Errorf("%s header = %q, want %q", hdr, got, want) + } + if got, want := atomic.LoadInt32(&f.LogFlushes), int32(1); got != want { + t.Errorf("After HTTP response: f.LogFlushes = %d, want %d", got, want) + } +} + +func TestRemoteAddr(t *testing.T) { + var addr string + http.HandleFunc("/remote_addr", func(w http.ResponseWriter, r *http.Request) { + addr = r.RemoteAddr + }) + + testCases := []struct { + headers http.Header + addr string + }{ + {http.Header{"X-Appengine-User-Ip": []string{"10.5.2.1"}}, "10.5.2.1:80"}, + {http.Header{"X-Appengine-Remote-Addr": []string{"1.2.3.4"}}, "1.2.3.4:80"}, + {http.Header{"X-Appengine-Remote-Addr": []string{"1.2.3.4:8080"}}, "1.2.3.4:8080"}, + { + http.Header{"X-Appengine-Remote-Addr": []string{"2401:fa00:9:1:7646:a0ff:fe90:ca66"}}, + "[2401:fa00:9:1:7646:a0ff:fe90:ca66]:80", + }, + { + http.Header{"X-Appengine-Remote-Addr": []string{"[::1]:http"}}, + "[::1]:http", + }, + {http.Header{}, "127.0.0.1:80"}, + } + + for _, tc := range testCases { + r := &http.Request{ + Method: "GET", + URL: &url.URL{Scheme: "http", Path: "/remote_addr"}, + Header: tc.headers, + Body: ioutil.NopCloser(bytes.NewReader(nil)), + } + handleHTTP(httptest.NewRecorder(), r) + if addr != tc.addr { + t.Errorf("Header %v, got %q, want %q", tc.headers, addr, tc.addr) + } + } +} + +func TestPanickingHandler(t *testing.T) { + http.HandleFunc("/panic", func(http.ResponseWriter, *http.Request) { + panic("whoops!") + }) + r := &http.Request{ + Method: "GET", + URL: &url.URL{Scheme: "http", Path: "/panic"}, + Body: ioutil.NopCloser(bytes.NewReader(nil)), + } + rec := httptest.NewRecorder() + handleHTTP(rec, r) + if rec.Code != 500 { + t.Errorf("Panicking handler returned HTTP %d, want HTTP %d", rec.Code, 500) + } +} + +var raceDetector = false + +func TestAPICallAllocations(t *testing.T) { + if raceDetector { + t.Skip("not running under race detector") + } + + // Run the test API server in a subprocess so we aren't counting its allocations. + u, cleanup := launchHelperProcess(t) + defer cleanup() + c := &context{ + req: &http.Request{ + Header: http.Header{ + ticketHeader: []string{"s3cr3t"}, + dapperHeader: []string{"trace-001"}, + }, + }, + apiURL: u, + } + + req := &basepb.StringProto{ + Value: proto.String("Doctor Who"), + } + res := &basepb.StringProto{} + var apiErr error + avg := testing.AllocsPerRun(100, func() { + ctx, _ := netcontext.WithTimeout(toContext(c), 100*time.Millisecond) + if err := Call(ctx, "actordb", "LookupActor", req, res); err != nil && apiErr == nil { + apiErr = err // get the first error only + } + }) + if apiErr != nil { + t.Errorf("API call failed: %v", apiErr) + } + + // Lots of room for improvement... + const min, max float64 = 60, 85 + if avg < min || max < avg { + t.Errorf("Allocations per API call = %g, want in [%g,%g]", avg, min, max) + } +} + +func launchHelperProcess(t *testing.T) (apiURL *url.URL, cleanup func()) { + cmd := exec.Command(os.Args[0], "-test.run=TestHelperProcess") + cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"} + stdin, err := cmd.StdinPipe() + if err != nil { + t.Fatalf("StdinPipe: %v", err) + } + stdout, err := cmd.StdoutPipe() + if err != nil { + t.Fatalf("StdoutPipe: %v", err) + } + if err := cmd.Start(); err != nil { + t.Fatalf("Starting helper process: %v", err) + } + + scan := bufio.NewScanner(stdout) + var u *url.URL + for scan.Scan() { + line := scan.Text() + if hp := strings.TrimPrefix(line, helperProcessMagic); hp != line { + var err error + u, err = url.Parse(hp) + if err != nil { + t.Fatalf("Failed to parse %q: %v", hp, err) + } + break + } + } + if err := scan.Err(); err != nil { + t.Fatalf("Scanning helper process stdout: %v", err) + } + if u == nil { + t.Fatal("Helper process never reported") + } + + return u, func() { + stdin.Close() + if err := cmd.Wait(); err != nil { + t.Errorf("Helper process did not exit cleanly: %v", err) + } + } +} + +const helperProcessMagic = "A lovely helper process is listening at " + +// This isn't a real test. It's used as a helper process. +func TestHelperProcess(*testing.T) { + if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" { + return + } + defer os.Exit(0) + + f := &fakeAPIHandler{} + srv := httptest.NewServer(f) + defer srv.Close() + fmt.Println(helperProcessMagic + srv.URL + apiPath) + + // Wait for stdin to be closed. + io.Copy(ioutil.Discard, os.Stdin) +} + +func TestBackgroundContext(t *testing.T) { + resetEnv := SetTestEnv() + defer resetEnv() + + ctx, key := fromContext(BackgroundContext()), "X-Magic-Ticket-Header" + if g, w := ctx.req.Header.Get(key), "my-app-id/default.20150612t184001.0"; g != w { + t.Errorf("%v = %q, want %q", key, g, w) + } + + // Check that using the background context doesn't panic. + req := &basepb.StringProto{ + Value: proto.String("Doctor Who"), + } + res := &basepb.StringProto{} + Call(BackgroundContext(), "actordb", "LookupActor", req, res) // expected to fail +} diff --git a/vendor/google.golang.org/appengine/internal/app_id.go b/vendor/google.golang.org/appengine/internal/app_id.go new file mode 100644 index 000000000..11df8c07b --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/app_id.go @@ -0,0 +1,28 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package internal + +import ( + "strings" +) + +func parseFullAppID(appid string) (partition, domain, displayID string) { + if i := strings.Index(appid, "~"); i != -1 { + partition, appid = appid[:i], appid[i+1:] + } + if i := strings.Index(appid, ":"); i != -1 { + domain, appid = appid[:i], appid[i+1:] + } + return partition, domain, appid +} + +// appID returns "appid" or "domain.com:appid". +func appID(fullAppID string) string { + _, dom, dis := parseFullAppID(fullAppID) + if dom != "" { + return dom + ":" + dis + } + return dis +} diff --git a/vendor/google.golang.org/appengine/internal/app_id_test.go b/vendor/google.golang.org/appengine/internal/app_id_test.go new file mode 100644 index 000000000..e69195cd4 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/app_id_test.go @@ -0,0 +1,34 @@ +// Copyright 2011 Google Inc. All Rights Reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package internal + +import ( + "testing" +) + +func TestAppIDParsing(t *testing.T) { + testCases := []struct { + in string + partition, domain, displayID string + }{ + {"simple-app-id", "", "", "simple-app-id"}, + {"domain.com:domain-app-id", "", "domain.com", "domain-app-id"}, + {"part~partition-app-id", "part", "", "partition-app-id"}, + {"part~domain.com:display", "part", "domain.com", "display"}, + } + + for _, tc := range testCases { + part, dom, dis := parseFullAppID(tc.in) + if part != tc.partition { + t.Errorf("partition of %q: got %q, want %q", tc.in, part, tc.partition) + } + if dom != tc.domain { + t.Errorf("domain of %q: got %q, want %q", tc.in, dom, tc.domain) + } + if dis != tc.displayID { + t.Errorf("displayID of %q: got %q, want %q", tc.in, dis, tc.displayID) + } + } +} diff --git a/vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go b/vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go new file mode 100644 index 000000000..9a2ff77ab --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go @@ -0,0 +1,611 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/app_identity/app_identity_service.proto + +package app_identity + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type AppIdentityServiceError_ErrorCode int32 + +const ( + AppIdentityServiceError_SUCCESS AppIdentityServiceError_ErrorCode = 0 + AppIdentityServiceError_UNKNOWN_SCOPE AppIdentityServiceError_ErrorCode = 9 + AppIdentityServiceError_BLOB_TOO_LARGE AppIdentityServiceError_ErrorCode = 1000 + AppIdentityServiceError_DEADLINE_EXCEEDED AppIdentityServiceError_ErrorCode = 1001 + AppIdentityServiceError_NOT_A_VALID_APP AppIdentityServiceError_ErrorCode = 1002 + AppIdentityServiceError_UNKNOWN_ERROR AppIdentityServiceError_ErrorCode = 1003 + AppIdentityServiceError_NOT_ALLOWED AppIdentityServiceError_ErrorCode = 1005 + AppIdentityServiceError_NOT_IMPLEMENTED AppIdentityServiceError_ErrorCode = 1006 +) + +var AppIdentityServiceError_ErrorCode_name = map[int32]string{ + 0: "SUCCESS", + 9: "UNKNOWN_SCOPE", + 1000: "BLOB_TOO_LARGE", + 1001: "DEADLINE_EXCEEDED", + 1002: "NOT_A_VALID_APP", + 1003: "UNKNOWN_ERROR", + 1005: "NOT_ALLOWED", + 1006: "NOT_IMPLEMENTED", +} +var AppIdentityServiceError_ErrorCode_value = map[string]int32{ + "SUCCESS": 0, + "UNKNOWN_SCOPE": 9, + "BLOB_TOO_LARGE": 1000, + "DEADLINE_EXCEEDED": 1001, + "NOT_A_VALID_APP": 1002, + "UNKNOWN_ERROR": 1003, + "NOT_ALLOWED": 1005, + "NOT_IMPLEMENTED": 1006, +} + +func (x AppIdentityServiceError_ErrorCode) Enum() *AppIdentityServiceError_ErrorCode { + p := new(AppIdentityServiceError_ErrorCode) + *p = x + return p +} +func (x AppIdentityServiceError_ErrorCode) String() string { + return proto.EnumName(AppIdentityServiceError_ErrorCode_name, int32(x)) +} +func (x *AppIdentityServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(AppIdentityServiceError_ErrorCode_value, data, "AppIdentityServiceError_ErrorCode") + if err != nil { + return err + } + *x = AppIdentityServiceError_ErrorCode(value) + return nil +} +func (AppIdentityServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{0, 0} +} + +type AppIdentityServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AppIdentityServiceError) Reset() { *m = AppIdentityServiceError{} } +func (m *AppIdentityServiceError) String() string { return proto.CompactTextString(m) } +func (*AppIdentityServiceError) ProtoMessage() {} +func (*AppIdentityServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{0} +} +func (m *AppIdentityServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppIdentityServiceError.Unmarshal(m, b) +} +func (m *AppIdentityServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppIdentityServiceError.Marshal(b, m, deterministic) +} +func (dst *AppIdentityServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppIdentityServiceError.Merge(dst, src) +} +func (m *AppIdentityServiceError) XXX_Size() int { + return xxx_messageInfo_AppIdentityServiceError.Size(m) +} +func (m *AppIdentityServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_AppIdentityServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_AppIdentityServiceError proto.InternalMessageInfo + +type SignForAppRequest struct { + BytesToSign []byte `protobuf:"bytes,1,opt,name=bytes_to_sign,json=bytesToSign" json:"bytes_to_sign,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SignForAppRequest) Reset() { *m = SignForAppRequest{} } +func (m *SignForAppRequest) String() string { return proto.CompactTextString(m) } +func (*SignForAppRequest) ProtoMessage() {} +func (*SignForAppRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{1} +} +func (m *SignForAppRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SignForAppRequest.Unmarshal(m, b) +} +func (m *SignForAppRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SignForAppRequest.Marshal(b, m, deterministic) +} +func (dst *SignForAppRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignForAppRequest.Merge(dst, src) +} +func (m *SignForAppRequest) XXX_Size() int { + return xxx_messageInfo_SignForAppRequest.Size(m) +} +func (m *SignForAppRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SignForAppRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SignForAppRequest proto.InternalMessageInfo + +func (m *SignForAppRequest) GetBytesToSign() []byte { + if m != nil { + return m.BytesToSign + } + return nil +} + +type SignForAppResponse struct { + KeyName *string `protobuf:"bytes,1,opt,name=key_name,json=keyName" json:"key_name,omitempty"` + SignatureBytes []byte `protobuf:"bytes,2,opt,name=signature_bytes,json=signatureBytes" json:"signature_bytes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SignForAppResponse) Reset() { *m = SignForAppResponse{} } +func (m *SignForAppResponse) String() string { return proto.CompactTextString(m) } +func (*SignForAppResponse) ProtoMessage() {} +func (*SignForAppResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{2} +} +func (m *SignForAppResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SignForAppResponse.Unmarshal(m, b) +} +func (m *SignForAppResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SignForAppResponse.Marshal(b, m, deterministic) +} +func (dst *SignForAppResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignForAppResponse.Merge(dst, src) +} +func (m *SignForAppResponse) XXX_Size() int { + return xxx_messageInfo_SignForAppResponse.Size(m) +} +func (m *SignForAppResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SignForAppResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SignForAppResponse proto.InternalMessageInfo + +func (m *SignForAppResponse) GetKeyName() string { + if m != nil && m.KeyName != nil { + return *m.KeyName + } + return "" +} + +func (m *SignForAppResponse) GetSignatureBytes() []byte { + if m != nil { + return m.SignatureBytes + } + return nil +} + +type GetPublicCertificateForAppRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetPublicCertificateForAppRequest) Reset() { *m = GetPublicCertificateForAppRequest{} } +func (m *GetPublicCertificateForAppRequest) String() string { return proto.CompactTextString(m) } +func (*GetPublicCertificateForAppRequest) ProtoMessage() {} +func (*GetPublicCertificateForAppRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{3} +} +func (m *GetPublicCertificateForAppRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetPublicCertificateForAppRequest.Unmarshal(m, b) +} +func (m *GetPublicCertificateForAppRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetPublicCertificateForAppRequest.Marshal(b, m, deterministic) +} +func (dst *GetPublicCertificateForAppRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetPublicCertificateForAppRequest.Merge(dst, src) +} +func (m *GetPublicCertificateForAppRequest) XXX_Size() int { + return xxx_messageInfo_GetPublicCertificateForAppRequest.Size(m) +} +func (m *GetPublicCertificateForAppRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetPublicCertificateForAppRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetPublicCertificateForAppRequest proto.InternalMessageInfo + +type PublicCertificate struct { + KeyName *string `protobuf:"bytes,1,opt,name=key_name,json=keyName" json:"key_name,omitempty"` + X509CertificatePem *string `protobuf:"bytes,2,opt,name=x509_certificate_pem,json=x509CertificatePem" json:"x509_certificate_pem,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PublicCertificate) Reset() { *m = PublicCertificate{} } +func (m *PublicCertificate) String() string { return proto.CompactTextString(m) } +func (*PublicCertificate) ProtoMessage() {} +func (*PublicCertificate) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{4} +} +func (m *PublicCertificate) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PublicCertificate.Unmarshal(m, b) +} +func (m *PublicCertificate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PublicCertificate.Marshal(b, m, deterministic) +} +func (dst *PublicCertificate) XXX_Merge(src proto.Message) { + xxx_messageInfo_PublicCertificate.Merge(dst, src) +} +func (m *PublicCertificate) XXX_Size() int { + return xxx_messageInfo_PublicCertificate.Size(m) +} +func (m *PublicCertificate) XXX_DiscardUnknown() { + xxx_messageInfo_PublicCertificate.DiscardUnknown(m) +} + +var xxx_messageInfo_PublicCertificate proto.InternalMessageInfo + +func (m *PublicCertificate) GetKeyName() string { + if m != nil && m.KeyName != nil { + return *m.KeyName + } + return "" +} + +func (m *PublicCertificate) GetX509CertificatePem() string { + if m != nil && m.X509CertificatePem != nil { + return *m.X509CertificatePem + } + return "" +} + +type GetPublicCertificateForAppResponse struct { + PublicCertificateList []*PublicCertificate `protobuf:"bytes,1,rep,name=public_certificate_list,json=publicCertificateList" json:"public_certificate_list,omitempty"` + MaxClientCacheTimeInSecond *int64 `protobuf:"varint,2,opt,name=max_client_cache_time_in_second,json=maxClientCacheTimeInSecond" json:"max_client_cache_time_in_second,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetPublicCertificateForAppResponse) Reset() { *m = GetPublicCertificateForAppResponse{} } +func (m *GetPublicCertificateForAppResponse) String() string { return proto.CompactTextString(m) } +func (*GetPublicCertificateForAppResponse) ProtoMessage() {} +func (*GetPublicCertificateForAppResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{5} +} +func (m *GetPublicCertificateForAppResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetPublicCertificateForAppResponse.Unmarshal(m, b) +} +func (m *GetPublicCertificateForAppResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetPublicCertificateForAppResponse.Marshal(b, m, deterministic) +} +func (dst *GetPublicCertificateForAppResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetPublicCertificateForAppResponse.Merge(dst, src) +} +func (m *GetPublicCertificateForAppResponse) XXX_Size() int { + return xxx_messageInfo_GetPublicCertificateForAppResponse.Size(m) +} +func (m *GetPublicCertificateForAppResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetPublicCertificateForAppResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetPublicCertificateForAppResponse proto.InternalMessageInfo + +func (m *GetPublicCertificateForAppResponse) GetPublicCertificateList() []*PublicCertificate { + if m != nil { + return m.PublicCertificateList + } + return nil +} + +func (m *GetPublicCertificateForAppResponse) GetMaxClientCacheTimeInSecond() int64 { + if m != nil && m.MaxClientCacheTimeInSecond != nil { + return *m.MaxClientCacheTimeInSecond + } + return 0 +} + +type GetServiceAccountNameRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetServiceAccountNameRequest) Reset() { *m = GetServiceAccountNameRequest{} } +func (m *GetServiceAccountNameRequest) String() string { return proto.CompactTextString(m) } +func (*GetServiceAccountNameRequest) ProtoMessage() {} +func (*GetServiceAccountNameRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{6} +} +func (m *GetServiceAccountNameRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetServiceAccountNameRequest.Unmarshal(m, b) +} +func (m *GetServiceAccountNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetServiceAccountNameRequest.Marshal(b, m, deterministic) +} +func (dst *GetServiceAccountNameRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServiceAccountNameRequest.Merge(dst, src) +} +func (m *GetServiceAccountNameRequest) XXX_Size() int { + return xxx_messageInfo_GetServiceAccountNameRequest.Size(m) +} +func (m *GetServiceAccountNameRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetServiceAccountNameRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetServiceAccountNameRequest proto.InternalMessageInfo + +type GetServiceAccountNameResponse struct { + ServiceAccountName *string `protobuf:"bytes,1,opt,name=service_account_name,json=serviceAccountName" json:"service_account_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetServiceAccountNameResponse) Reset() { *m = GetServiceAccountNameResponse{} } +func (m *GetServiceAccountNameResponse) String() string { return proto.CompactTextString(m) } +func (*GetServiceAccountNameResponse) ProtoMessage() {} +func (*GetServiceAccountNameResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{7} +} +func (m *GetServiceAccountNameResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetServiceAccountNameResponse.Unmarshal(m, b) +} +func (m *GetServiceAccountNameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetServiceAccountNameResponse.Marshal(b, m, deterministic) +} +func (dst *GetServiceAccountNameResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetServiceAccountNameResponse.Merge(dst, src) +} +func (m *GetServiceAccountNameResponse) XXX_Size() int { + return xxx_messageInfo_GetServiceAccountNameResponse.Size(m) +} +func (m *GetServiceAccountNameResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetServiceAccountNameResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetServiceAccountNameResponse proto.InternalMessageInfo + +func (m *GetServiceAccountNameResponse) GetServiceAccountName() string { + if m != nil && m.ServiceAccountName != nil { + return *m.ServiceAccountName + } + return "" +} + +type GetAccessTokenRequest struct { + Scope []string `protobuf:"bytes,1,rep,name=scope" json:"scope,omitempty"` + ServiceAccountId *int64 `protobuf:"varint,2,opt,name=service_account_id,json=serviceAccountId" json:"service_account_id,omitempty"` + ServiceAccountName *string `protobuf:"bytes,3,opt,name=service_account_name,json=serviceAccountName" json:"service_account_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetAccessTokenRequest) Reset() { *m = GetAccessTokenRequest{} } +func (m *GetAccessTokenRequest) String() string { return proto.CompactTextString(m) } +func (*GetAccessTokenRequest) ProtoMessage() {} +func (*GetAccessTokenRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{8} +} +func (m *GetAccessTokenRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetAccessTokenRequest.Unmarshal(m, b) +} +func (m *GetAccessTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetAccessTokenRequest.Marshal(b, m, deterministic) +} +func (dst *GetAccessTokenRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAccessTokenRequest.Merge(dst, src) +} +func (m *GetAccessTokenRequest) XXX_Size() int { + return xxx_messageInfo_GetAccessTokenRequest.Size(m) +} +func (m *GetAccessTokenRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAccessTokenRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAccessTokenRequest proto.InternalMessageInfo + +func (m *GetAccessTokenRequest) GetScope() []string { + if m != nil { + return m.Scope + } + return nil +} + +func (m *GetAccessTokenRequest) GetServiceAccountId() int64 { + if m != nil && m.ServiceAccountId != nil { + return *m.ServiceAccountId + } + return 0 +} + +func (m *GetAccessTokenRequest) GetServiceAccountName() string { + if m != nil && m.ServiceAccountName != nil { + return *m.ServiceAccountName + } + return "" +} + +type GetAccessTokenResponse struct { + AccessToken *string `protobuf:"bytes,1,opt,name=access_token,json=accessToken" json:"access_token,omitempty"` + ExpirationTime *int64 `protobuf:"varint,2,opt,name=expiration_time,json=expirationTime" json:"expiration_time,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetAccessTokenResponse) Reset() { *m = GetAccessTokenResponse{} } +func (m *GetAccessTokenResponse) String() string { return proto.CompactTextString(m) } +func (*GetAccessTokenResponse) ProtoMessage() {} +func (*GetAccessTokenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{9} +} +func (m *GetAccessTokenResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetAccessTokenResponse.Unmarshal(m, b) +} +func (m *GetAccessTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetAccessTokenResponse.Marshal(b, m, deterministic) +} +func (dst *GetAccessTokenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAccessTokenResponse.Merge(dst, src) +} +func (m *GetAccessTokenResponse) XXX_Size() int { + return xxx_messageInfo_GetAccessTokenResponse.Size(m) +} +func (m *GetAccessTokenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAccessTokenResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAccessTokenResponse proto.InternalMessageInfo + +func (m *GetAccessTokenResponse) GetAccessToken() string { + if m != nil && m.AccessToken != nil { + return *m.AccessToken + } + return "" +} + +func (m *GetAccessTokenResponse) GetExpirationTime() int64 { + if m != nil && m.ExpirationTime != nil { + return *m.ExpirationTime + } + return 0 +} + +type GetDefaultGcsBucketNameRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetDefaultGcsBucketNameRequest) Reset() { *m = GetDefaultGcsBucketNameRequest{} } +func (m *GetDefaultGcsBucketNameRequest) String() string { return proto.CompactTextString(m) } +func (*GetDefaultGcsBucketNameRequest) ProtoMessage() {} +func (*GetDefaultGcsBucketNameRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{10} +} +func (m *GetDefaultGcsBucketNameRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetDefaultGcsBucketNameRequest.Unmarshal(m, b) +} +func (m *GetDefaultGcsBucketNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetDefaultGcsBucketNameRequest.Marshal(b, m, deterministic) +} +func (dst *GetDefaultGcsBucketNameRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetDefaultGcsBucketNameRequest.Merge(dst, src) +} +func (m *GetDefaultGcsBucketNameRequest) XXX_Size() int { + return xxx_messageInfo_GetDefaultGcsBucketNameRequest.Size(m) +} +func (m *GetDefaultGcsBucketNameRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetDefaultGcsBucketNameRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetDefaultGcsBucketNameRequest proto.InternalMessageInfo + +type GetDefaultGcsBucketNameResponse struct { + DefaultGcsBucketName *string `protobuf:"bytes,1,opt,name=default_gcs_bucket_name,json=defaultGcsBucketName" json:"default_gcs_bucket_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetDefaultGcsBucketNameResponse) Reset() { *m = GetDefaultGcsBucketNameResponse{} } +func (m *GetDefaultGcsBucketNameResponse) String() string { return proto.CompactTextString(m) } +func (*GetDefaultGcsBucketNameResponse) ProtoMessage() {} +func (*GetDefaultGcsBucketNameResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_app_identity_service_08a6e3f74b04cfa4, []int{11} +} +func (m *GetDefaultGcsBucketNameResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetDefaultGcsBucketNameResponse.Unmarshal(m, b) +} +func (m *GetDefaultGcsBucketNameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetDefaultGcsBucketNameResponse.Marshal(b, m, deterministic) +} +func (dst *GetDefaultGcsBucketNameResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetDefaultGcsBucketNameResponse.Merge(dst, src) +} +func (m *GetDefaultGcsBucketNameResponse) XXX_Size() int { + return xxx_messageInfo_GetDefaultGcsBucketNameResponse.Size(m) +} +func (m *GetDefaultGcsBucketNameResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetDefaultGcsBucketNameResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetDefaultGcsBucketNameResponse proto.InternalMessageInfo + +func (m *GetDefaultGcsBucketNameResponse) GetDefaultGcsBucketName() string { + if m != nil && m.DefaultGcsBucketName != nil { + return *m.DefaultGcsBucketName + } + return "" +} + +func init() { + proto.RegisterType((*AppIdentityServiceError)(nil), "appengine.AppIdentityServiceError") + proto.RegisterType((*SignForAppRequest)(nil), "appengine.SignForAppRequest") + proto.RegisterType((*SignForAppResponse)(nil), "appengine.SignForAppResponse") + proto.RegisterType((*GetPublicCertificateForAppRequest)(nil), "appengine.GetPublicCertificateForAppRequest") + proto.RegisterType((*PublicCertificate)(nil), "appengine.PublicCertificate") + proto.RegisterType((*GetPublicCertificateForAppResponse)(nil), "appengine.GetPublicCertificateForAppResponse") + proto.RegisterType((*GetServiceAccountNameRequest)(nil), "appengine.GetServiceAccountNameRequest") + proto.RegisterType((*GetServiceAccountNameResponse)(nil), "appengine.GetServiceAccountNameResponse") + proto.RegisterType((*GetAccessTokenRequest)(nil), "appengine.GetAccessTokenRequest") + proto.RegisterType((*GetAccessTokenResponse)(nil), "appengine.GetAccessTokenResponse") + proto.RegisterType((*GetDefaultGcsBucketNameRequest)(nil), "appengine.GetDefaultGcsBucketNameRequest") + proto.RegisterType((*GetDefaultGcsBucketNameResponse)(nil), "appengine.GetDefaultGcsBucketNameResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/app_identity/app_identity_service.proto", fileDescriptor_app_identity_service_08a6e3f74b04cfa4) +} + +var fileDescriptor_app_identity_service_08a6e3f74b04cfa4 = []byte{ + // 676 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdb, 0x6e, 0xda, 0x58, + 0x14, 0x1d, 0x26, 0x1a, 0x31, 0x6c, 0x12, 0x62, 0xce, 0x90, 0xcb, 0x8c, 0x32, 0xb9, 0x78, 0x1e, + 0x26, 0x0f, 0x15, 0x89, 0x2a, 0x45, 0x55, 0x1f, 0x8d, 0xed, 0x22, 0x54, 0x07, 0x53, 0x43, 0x9a, + 0xa8, 0x2f, 0xa7, 0xce, 0x61, 0xc7, 0x3d, 0x02, 0x9f, 0xe3, 0xda, 0x87, 0x0a, 0x3e, 0xa2, 0x3f, + 0xd2, 0x9f, 0xe8, 0x5b, 0xbf, 0xa5, 0x17, 0xb5, 0xdf, 0x50, 0xd9, 0x38, 0x5c, 0x92, 0x92, 0x37, + 0xbc, 0xf6, 0x5a, 0xcb, 0x6b, 0x2f, 0x6d, 0x0c, 0x4e, 0x20, 0x65, 0x30, 0xc4, 0x7a, 0x20, 0x87, + 0xbe, 0x08, 0xea, 0x32, 0x0e, 0x4e, 0xfc, 0x28, 0x42, 0x11, 0x70, 0x81, 0x27, 0x5c, 0x28, 0x8c, + 0x85, 0x3f, 0x4c, 0x21, 0xca, 0xfb, 0x28, 0x14, 0x57, 0x93, 0xa5, 0x07, 0x9a, 0x60, 0xfc, 0x8e, + 0x33, 0xac, 0x47, 0xb1, 0x54, 0x92, 0x94, 0x66, 0x5a, 0xfd, 0x53, 0x01, 0x76, 0x8c, 0x28, 0x6a, + 0xe5, 0xc4, 0xee, 0x94, 0x67, 0xc7, 0xb1, 0x8c, 0xf5, 0x0f, 0x05, 0x28, 0x65, 0xbf, 0x4c, 0xd9, + 0x47, 0x52, 0x86, 0x62, 0xf7, 0xc2, 0x34, 0xed, 0x6e, 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 0x0b, 0xb0, 0xd5, 0x44, 0x65, 0x30, 0x86, 0x49, 0xd2, 0x93, 0x03, 0x14, + 0xb7, 0x37, 0x55, 0x83, 0x3f, 0x12, 0x26, 0x23, 0xcc, 0x5a, 0x29, 0x79, 0xd3, 0x07, 0xf2, 0x08, + 0xc8, 0xdd, 0x37, 0xf0, 0xdb, 0xd5, 0xb4, 0x65, 0xff, 0x56, 0x7f, 0x65, 0x9e, 0xb5, 0x95, 0x79, + 0xfa, 0xb0, 0x7d, 0x37, 0x4e, 0xbe, 0xdb, 0x11, 0xac, 0xfb, 0x19, 0x4c, 0x55, 0x8a, 0xe7, 0x3b, + 0x95, 0xfd, 0x39, 0x35, 0xbd, 0x58, 0x1c, 0x47, 0x3c, 0xf6, 0x15, 0x97, 0x22, 0xab, 0x3f, 0x4f, + 0x56, 0x99, 0xc3, 0x69, 0xe1, 0xfa, 0x21, 0xec, 0x37, 0x51, 0x59, 0x78, 0xe3, 0x8f, 0x86, 0xaa, + 0xc9, 0x92, 0xc6, 0x88, 0x0d, 0x70, 0xa9, 0xea, 0x2b, 0x38, 0x58, 0xc9, 0xc8, 0x03, 0x9d, 0xc1, + 0x4e, 0x7f, 0x3a, 0xa7, 0x01, 0x4b, 0xe8, 0x75, 0xc6, 0x58, 0xec, 0xbb, 0xd6, 0xff, 0x85, 0xbc, + 0x51, 0x79, 0xb5, 0xbe, 0xf8, 0xc9, 0xfa, 0x19, 0x00, 0x00, 0xff, 0xff, 0x37, 0x4c, 0x56, 0x38, + 0xf3, 0x04, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.proto b/vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.proto new file mode 100644 index 000000000..19610ca5b --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.proto @@ -0,0 +1,64 @@ +syntax = "proto2"; +option go_package = "app_identity"; + +package appengine; + +message AppIdentityServiceError { + enum ErrorCode { + SUCCESS = 0; + UNKNOWN_SCOPE = 9; + BLOB_TOO_LARGE = 1000; + DEADLINE_EXCEEDED = 1001; + NOT_A_VALID_APP = 1002; + UNKNOWN_ERROR = 1003; + NOT_ALLOWED = 1005; + NOT_IMPLEMENTED = 1006; + } +} + +message SignForAppRequest { + optional bytes bytes_to_sign = 1; +} + +message SignForAppResponse { + optional string key_name = 1; + optional bytes signature_bytes = 2; +} + +message GetPublicCertificateForAppRequest { +} + +message PublicCertificate { + optional string key_name = 1; + optional string x509_certificate_pem = 2; +} + +message GetPublicCertificateForAppResponse { + repeated PublicCertificate public_certificate_list = 1; + optional int64 max_client_cache_time_in_second = 2; +} + +message GetServiceAccountNameRequest { +} + +message GetServiceAccountNameResponse { + optional string service_account_name = 1; +} + +message GetAccessTokenRequest { + repeated string scope = 1; + optional int64 service_account_id = 2; + optional string service_account_name = 3; +} + +message GetAccessTokenResponse { + optional string access_token = 1; + optional int64 expiration_time = 2; +} + +message GetDefaultGcsBucketNameRequest { +} + +message GetDefaultGcsBucketNameResponse { + optional string default_gcs_bucket_name = 1; +} diff --git a/vendor/google.golang.org/appengine/internal/base/api_base.pb.go b/vendor/google.golang.org/appengine/internal/base/api_base.pb.go new file mode 100644 index 000000000..db4777e68 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/base/api_base.pb.go @@ -0,0 +1,308 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/base/api_base.proto + +package base + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type StringProto struct { + Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StringProto) Reset() { *m = StringProto{} } +func (m *StringProto) String() string { return proto.CompactTextString(m) } +func (*StringProto) ProtoMessage() {} +func (*StringProto) Descriptor() ([]byte, []int) { + return fileDescriptor_api_base_9d49f8792e0c1140, []int{0} +} +func (m *StringProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StringProto.Unmarshal(m, b) +} +func (m *StringProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StringProto.Marshal(b, m, deterministic) +} +func (dst *StringProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_StringProto.Merge(dst, src) +} +func (m *StringProto) XXX_Size() int { + return xxx_messageInfo_StringProto.Size(m) +} +func (m *StringProto) XXX_DiscardUnknown() { + xxx_messageInfo_StringProto.DiscardUnknown(m) +} + +var xxx_messageInfo_StringProto proto.InternalMessageInfo + +func (m *StringProto) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type Integer32Proto struct { + Value *int32 `protobuf:"varint,1,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Integer32Proto) Reset() { *m = Integer32Proto{} } +func (m *Integer32Proto) String() string { return proto.CompactTextString(m) } +func (*Integer32Proto) ProtoMessage() {} +func (*Integer32Proto) Descriptor() ([]byte, []int) { + return fileDescriptor_api_base_9d49f8792e0c1140, []int{1} +} +func (m *Integer32Proto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Integer32Proto.Unmarshal(m, b) +} +func (m *Integer32Proto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Integer32Proto.Marshal(b, m, deterministic) +} +func (dst *Integer32Proto) XXX_Merge(src proto.Message) { + xxx_messageInfo_Integer32Proto.Merge(dst, src) +} +func (m *Integer32Proto) XXX_Size() int { + return xxx_messageInfo_Integer32Proto.Size(m) +} +func (m *Integer32Proto) XXX_DiscardUnknown() { + xxx_messageInfo_Integer32Proto.DiscardUnknown(m) +} + +var xxx_messageInfo_Integer32Proto proto.InternalMessageInfo + +func (m *Integer32Proto) GetValue() int32 { + if m != nil && m.Value != nil { + return *m.Value + } + return 0 +} + +type Integer64Proto struct { + Value *int64 `protobuf:"varint,1,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Integer64Proto) Reset() { *m = Integer64Proto{} } +func (m *Integer64Proto) String() string { return proto.CompactTextString(m) } +func (*Integer64Proto) ProtoMessage() {} +func (*Integer64Proto) Descriptor() ([]byte, []int) { + return fileDescriptor_api_base_9d49f8792e0c1140, []int{2} +} +func (m *Integer64Proto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Integer64Proto.Unmarshal(m, b) +} +func (m *Integer64Proto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Integer64Proto.Marshal(b, m, deterministic) +} +func (dst *Integer64Proto) XXX_Merge(src proto.Message) { + xxx_messageInfo_Integer64Proto.Merge(dst, src) +} +func (m *Integer64Proto) XXX_Size() int { + return xxx_messageInfo_Integer64Proto.Size(m) +} +func (m *Integer64Proto) XXX_DiscardUnknown() { + xxx_messageInfo_Integer64Proto.DiscardUnknown(m) +} + +var xxx_messageInfo_Integer64Proto proto.InternalMessageInfo + +func (m *Integer64Proto) GetValue() int64 { + if m != nil && m.Value != nil { + return *m.Value + } + return 0 +} + +type BoolProto struct { + Value *bool `protobuf:"varint,1,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BoolProto) Reset() { *m = BoolProto{} } +func (m *BoolProto) String() string { return proto.CompactTextString(m) } +func (*BoolProto) ProtoMessage() {} +func (*BoolProto) Descriptor() ([]byte, []int) { + return fileDescriptor_api_base_9d49f8792e0c1140, []int{3} +} +func (m *BoolProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BoolProto.Unmarshal(m, b) +} +func (m *BoolProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BoolProto.Marshal(b, m, deterministic) +} +func (dst *BoolProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_BoolProto.Merge(dst, src) +} +func (m *BoolProto) XXX_Size() int { + return xxx_messageInfo_BoolProto.Size(m) +} +func (m *BoolProto) XXX_DiscardUnknown() { + xxx_messageInfo_BoolProto.DiscardUnknown(m) +} + +var xxx_messageInfo_BoolProto proto.InternalMessageInfo + +func (m *BoolProto) GetValue() bool { + if m != nil && m.Value != nil { + return *m.Value + } + return false +} + +type DoubleProto struct { + Value *float64 `protobuf:"fixed64,1,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DoubleProto) Reset() { *m = DoubleProto{} } +func (m *DoubleProto) String() string { return proto.CompactTextString(m) } +func (*DoubleProto) ProtoMessage() {} +func (*DoubleProto) Descriptor() ([]byte, []int) { + return fileDescriptor_api_base_9d49f8792e0c1140, []int{4} +} +func (m *DoubleProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DoubleProto.Unmarshal(m, b) +} +func (m *DoubleProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DoubleProto.Marshal(b, m, deterministic) +} +func (dst *DoubleProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_DoubleProto.Merge(dst, src) +} +func (m *DoubleProto) XXX_Size() int { + return xxx_messageInfo_DoubleProto.Size(m) +} +func (m *DoubleProto) XXX_DiscardUnknown() { + xxx_messageInfo_DoubleProto.DiscardUnknown(m) +} + +var xxx_messageInfo_DoubleProto proto.InternalMessageInfo + +func (m *DoubleProto) GetValue() float64 { + if m != nil && m.Value != nil { + return *m.Value + } + return 0 +} + +type BytesProto struct { + Value []byte `protobuf:"bytes,1,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BytesProto) Reset() { *m = BytesProto{} } +func (m *BytesProto) String() string { return proto.CompactTextString(m) } +func (*BytesProto) ProtoMessage() {} +func (*BytesProto) Descriptor() ([]byte, []int) { + return fileDescriptor_api_base_9d49f8792e0c1140, []int{5} +} +func (m *BytesProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BytesProto.Unmarshal(m, b) +} +func (m *BytesProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BytesProto.Marshal(b, m, deterministic) +} +func (dst *BytesProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_BytesProto.Merge(dst, src) +} +func (m *BytesProto) XXX_Size() int { + return xxx_messageInfo_BytesProto.Size(m) +} +func (m *BytesProto) XXX_DiscardUnknown() { + xxx_messageInfo_BytesProto.DiscardUnknown(m) +} + +var xxx_messageInfo_BytesProto proto.InternalMessageInfo + +func (m *BytesProto) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type VoidProto struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VoidProto) Reset() { *m = VoidProto{} } +func (m *VoidProto) String() string { return proto.CompactTextString(m) } +func (*VoidProto) ProtoMessage() {} +func (*VoidProto) Descriptor() ([]byte, []int) { + return fileDescriptor_api_base_9d49f8792e0c1140, []int{6} +} +func (m *VoidProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_VoidProto.Unmarshal(m, b) +} +func (m *VoidProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_VoidProto.Marshal(b, m, deterministic) +} +func (dst *VoidProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_VoidProto.Merge(dst, src) +} +func (m *VoidProto) XXX_Size() int { + return xxx_messageInfo_VoidProto.Size(m) +} +func (m *VoidProto) XXX_DiscardUnknown() { + xxx_messageInfo_VoidProto.DiscardUnknown(m) +} + +var xxx_messageInfo_VoidProto proto.InternalMessageInfo + +func init() { + proto.RegisterType((*StringProto)(nil), "appengine.base.StringProto") + proto.RegisterType((*Integer32Proto)(nil), "appengine.base.Integer32Proto") + proto.RegisterType((*Integer64Proto)(nil), "appengine.base.Integer64Proto") + proto.RegisterType((*BoolProto)(nil), "appengine.base.BoolProto") + proto.RegisterType((*DoubleProto)(nil), "appengine.base.DoubleProto") + proto.RegisterType((*BytesProto)(nil), "appengine.base.BytesProto") + proto.RegisterType((*VoidProto)(nil), "appengine.base.VoidProto") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/base/api_base.proto", fileDescriptor_api_base_9d49f8792e0c1140) +} + +var fileDescriptor_api_base_9d49f8792e0c1140 = []byte{ + // 199 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0xcf, 0x3f, 0x4b, 0xc6, 0x30, + 0x10, 0x06, 0x70, 0x5a, 0xad, 0xb4, 0x57, 0xe9, 0x20, 0x0e, 0x1d, 0xb5, 0x05, 0x71, 0x4a, 0x40, + 0x45, 0x9c, 0x83, 0x8b, 0x9b, 0x28, 0x38, 0xb8, 0x48, 0x8a, 0xc7, 0x11, 0x08, 0xb9, 0x90, 0xa6, + 0x82, 0xdf, 0x5e, 0xda, 0xd2, 0xfa, 0xc2, 0x9b, 0xed, 0xfe, 0xfc, 0xe0, 0xe1, 0x81, 0x27, 0x62, + 0x26, 0x8b, 0x82, 0xd8, 0x6a, 0x47, 0x82, 0x03, 0x49, 0xed, 0x3d, 0x3a, 0x32, 0x0e, 0xa5, 0x71, + 0x11, 0x83, 0xd3, 0x56, 0x0e, 0x7a, 0x44, 0xa9, 0xbd, 0xf9, 0x9a, 0x07, 0xe1, 0x03, 0x47, 0xbe, + 0x68, 0x76, 0x27, 0xe6, 0x6b, 0xd7, 0x43, 0xfd, 0x1e, 0x83, 0x71, 0xf4, 0xba, 0xbc, 0x2f, 0xa1, + 0xf8, 0xd1, 0x76, 0xc2, 0x36, 0xbb, 0xca, 0x6f, 0xab, 0xb7, 0x75, 0xe9, 0x6e, 0xa0, 0x79, 0x71, + 0x11, 0x09, 0xc3, 0xfd, 0x5d, 0xc2, 0x15, 0xc7, 0xee, 0xf1, 0x21, 0xe1, 0x4e, 0x36, 0x77, 0x0d, + 0x95, 0x62, 0xb6, 0x09, 0x52, 0x6e, 0xa4, 0x87, 0xfa, 0x99, 0xa7, 0xc1, 0x62, 0x02, 0x65, 0xff, + 0x79, 0xa0, 0x7e, 0x23, 0x8e, 0xab, 0x69, 0x0f, 0xcd, 0xb9, 0xca, 0xcb, 0xdd, 0xd5, 0x50, 0x7d, + 0xb0, 0xf9, 0x5e, 0x98, 0x3a, 0xfb, 0x3c, 0x9d, 0x9b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xba, + 0x37, 0x25, 0xea, 0x44, 0x01, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/base/api_base.proto b/vendor/google.golang.org/appengine/internal/base/api_base.proto new file mode 100644 index 000000000..56cd7a3ca --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/base/api_base.proto @@ -0,0 +1,33 @@ +// Built-in base types for API calls. Primarily useful as return types. + +syntax = "proto2"; +option go_package = "base"; + +package appengine.base; + +message StringProto { + required string value = 1; +} + +message Integer32Proto { + required int32 value = 1; +} + +message Integer64Proto { + required int64 value = 1; +} + +message BoolProto { + required bool value = 1; +} + +message DoubleProto { + required double value = 1; +} + +message BytesProto { + required bytes value = 1 [ctype=CORD]; +} + +message VoidProto { +} diff --git a/vendor/google.golang.org/appengine/internal/blobstore/blobstore_service.pb.go b/vendor/google.golang.org/appengine/internal/blobstore/blobstore_service.pb.go new file mode 100644 index 000000000..faef13a01 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/blobstore/blobstore_service.pb.go @@ -0,0 +1,666 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/blobstore/blobstore_service.proto + +package blobstore + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type BlobstoreServiceError_ErrorCode int32 + +const ( + BlobstoreServiceError_OK BlobstoreServiceError_ErrorCode = 0 + BlobstoreServiceError_INTERNAL_ERROR BlobstoreServiceError_ErrorCode = 1 + BlobstoreServiceError_URL_TOO_LONG BlobstoreServiceError_ErrorCode = 2 + BlobstoreServiceError_PERMISSION_DENIED BlobstoreServiceError_ErrorCode = 3 + BlobstoreServiceError_BLOB_NOT_FOUND BlobstoreServiceError_ErrorCode = 4 + BlobstoreServiceError_DATA_INDEX_OUT_OF_RANGE BlobstoreServiceError_ErrorCode = 5 + BlobstoreServiceError_BLOB_FETCH_SIZE_TOO_LARGE BlobstoreServiceError_ErrorCode = 6 + BlobstoreServiceError_ARGUMENT_OUT_OF_RANGE BlobstoreServiceError_ErrorCode = 8 + BlobstoreServiceError_INVALID_BLOB_KEY BlobstoreServiceError_ErrorCode = 9 +) + +var BlobstoreServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "INTERNAL_ERROR", + 2: "URL_TOO_LONG", + 3: "PERMISSION_DENIED", + 4: "BLOB_NOT_FOUND", + 5: "DATA_INDEX_OUT_OF_RANGE", + 6: "BLOB_FETCH_SIZE_TOO_LARGE", + 8: "ARGUMENT_OUT_OF_RANGE", + 9: "INVALID_BLOB_KEY", +} +var BlobstoreServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "INTERNAL_ERROR": 1, + "URL_TOO_LONG": 2, + "PERMISSION_DENIED": 3, + "BLOB_NOT_FOUND": 4, + "DATA_INDEX_OUT_OF_RANGE": 5, + "BLOB_FETCH_SIZE_TOO_LARGE": 6, + "ARGUMENT_OUT_OF_RANGE": 8, + "INVALID_BLOB_KEY": 9, +} + +func (x BlobstoreServiceError_ErrorCode) Enum() *BlobstoreServiceError_ErrorCode { + p := new(BlobstoreServiceError_ErrorCode) + *p = x + return p +} +func (x BlobstoreServiceError_ErrorCode) String() string { + return proto.EnumName(BlobstoreServiceError_ErrorCode_name, int32(x)) +} +func (x *BlobstoreServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(BlobstoreServiceError_ErrorCode_value, data, "BlobstoreServiceError_ErrorCode") + if err != nil { + return err + } + *x = BlobstoreServiceError_ErrorCode(value) + return nil +} +func (BlobstoreServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{0, 0} +} + +type BlobstoreServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlobstoreServiceError) Reset() { *m = BlobstoreServiceError{} } +func (m *BlobstoreServiceError) String() string { return proto.CompactTextString(m) } +func (*BlobstoreServiceError) ProtoMessage() {} +func (*BlobstoreServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{0} +} +func (m *BlobstoreServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlobstoreServiceError.Unmarshal(m, b) +} +func (m *BlobstoreServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlobstoreServiceError.Marshal(b, m, deterministic) +} +func (dst *BlobstoreServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlobstoreServiceError.Merge(dst, src) +} +func (m *BlobstoreServiceError) XXX_Size() int { + return xxx_messageInfo_BlobstoreServiceError.Size(m) +} +func (m *BlobstoreServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_BlobstoreServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_BlobstoreServiceError proto.InternalMessageInfo + +type CreateUploadURLRequest struct { + SuccessPath *string `protobuf:"bytes,1,req,name=success_path,json=successPath" json:"success_path,omitempty"` + MaxUploadSizeBytes *int64 `protobuf:"varint,2,opt,name=max_upload_size_bytes,json=maxUploadSizeBytes" json:"max_upload_size_bytes,omitempty"` + MaxUploadSizePerBlobBytes *int64 `protobuf:"varint,3,opt,name=max_upload_size_per_blob_bytes,json=maxUploadSizePerBlobBytes" json:"max_upload_size_per_blob_bytes,omitempty"` + GsBucketName *string `protobuf:"bytes,4,opt,name=gs_bucket_name,json=gsBucketName" json:"gs_bucket_name,omitempty"` + UrlExpiryTimeSeconds *int32 `protobuf:"varint,5,opt,name=url_expiry_time_seconds,json=urlExpiryTimeSeconds" json:"url_expiry_time_seconds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateUploadURLRequest) Reset() { *m = CreateUploadURLRequest{} } +func (m *CreateUploadURLRequest) String() string { return proto.CompactTextString(m) } +func (*CreateUploadURLRequest) ProtoMessage() {} +func (*CreateUploadURLRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{1} +} +func (m *CreateUploadURLRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateUploadURLRequest.Unmarshal(m, b) +} +func (m *CreateUploadURLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateUploadURLRequest.Marshal(b, m, deterministic) +} +func (dst *CreateUploadURLRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateUploadURLRequest.Merge(dst, src) +} +func (m *CreateUploadURLRequest) XXX_Size() int { + return xxx_messageInfo_CreateUploadURLRequest.Size(m) +} +func (m *CreateUploadURLRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateUploadURLRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateUploadURLRequest proto.InternalMessageInfo + +func (m *CreateUploadURLRequest) GetSuccessPath() string { + if m != nil && m.SuccessPath != nil { + return *m.SuccessPath + } + return "" +} + +func (m *CreateUploadURLRequest) GetMaxUploadSizeBytes() int64 { + if m != nil && m.MaxUploadSizeBytes != nil { + return *m.MaxUploadSizeBytes + } + return 0 +} + +func (m *CreateUploadURLRequest) GetMaxUploadSizePerBlobBytes() int64 { + if m != nil && m.MaxUploadSizePerBlobBytes != nil { + return *m.MaxUploadSizePerBlobBytes + } + return 0 +} + +func (m *CreateUploadURLRequest) GetGsBucketName() string { + if m != nil && m.GsBucketName != nil { + return *m.GsBucketName + } + return "" +} + +func (m *CreateUploadURLRequest) GetUrlExpiryTimeSeconds() int32 { + if m != nil && m.UrlExpiryTimeSeconds != nil { + return *m.UrlExpiryTimeSeconds + } + return 0 +} + +type CreateUploadURLResponse struct { + Url *string `protobuf:"bytes,1,req,name=url" json:"url,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateUploadURLResponse) Reset() { *m = CreateUploadURLResponse{} } +func (m *CreateUploadURLResponse) String() string { return proto.CompactTextString(m) } +func (*CreateUploadURLResponse) ProtoMessage() {} +func (*CreateUploadURLResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{2} +} +func (m *CreateUploadURLResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateUploadURLResponse.Unmarshal(m, b) +} +func (m *CreateUploadURLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateUploadURLResponse.Marshal(b, m, deterministic) +} +func (dst *CreateUploadURLResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateUploadURLResponse.Merge(dst, src) +} +func (m *CreateUploadURLResponse) XXX_Size() int { + return xxx_messageInfo_CreateUploadURLResponse.Size(m) +} +func (m *CreateUploadURLResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateUploadURLResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateUploadURLResponse proto.InternalMessageInfo + +func (m *CreateUploadURLResponse) GetUrl() string { + if m != nil && m.Url != nil { + return *m.Url + } + return "" +} + +type DeleteBlobRequest struct { + BlobKey []string `protobuf:"bytes,1,rep,name=blob_key,json=blobKey" json:"blob_key,omitempty"` + Token *string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteBlobRequest) Reset() { *m = DeleteBlobRequest{} } +func (m *DeleteBlobRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteBlobRequest) ProtoMessage() {} +func (*DeleteBlobRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{3} +} +func (m *DeleteBlobRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteBlobRequest.Unmarshal(m, b) +} +func (m *DeleteBlobRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteBlobRequest.Marshal(b, m, deterministic) +} +func (dst *DeleteBlobRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteBlobRequest.Merge(dst, src) +} +func (m *DeleteBlobRequest) XXX_Size() int { + return xxx_messageInfo_DeleteBlobRequest.Size(m) +} +func (m *DeleteBlobRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteBlobRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteBlobRequest proto.InternalMessageInfo + +func (m *DeleteBlobRequest) GetBlobKey() []string { + if m != nil { + return m.BlobKey + } + return nil +} + +func (m *DeleteBlobRequest) GetToken() string { + if m != nil && m.Token != nil { + return *m.Token + } + return "" +} + +type FetchDataRequest struct { + BlobKey *string `protobuf:"bytes,1,req,name=blob_key,json=blobKey" json:"blob_key,omitempty"` + StartIndex *int64 `protobuf:"varint,2,req,name=start_index,json=startIndex" json:"start_index,omitempty"` + EndIndex *int64 `protobuf:"varint,3,req,name=end_index,json=endIndex" json:"end_index,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FetchDataRequest) Reset() { *m = FetchDataRequest{} } +func (m *FetchDataRequest) String() string { return proto.CompactTextString(m) } +func (*FetchDataRequest) ProtoMessage() {} +func (*FetchDataRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{4} +} +func (m *FetchDataRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FetchDataRequest.Unmarshal(m, b) +} +func (m *FetchDataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FetchDataRequest.Marshal(b, m, deterministic) +} +func (dst *FetchDataRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_FetchDataRequest.Merge(dst, src) +} +func (m *FetchDataRequest) XXX_Size() int { + return xxx_messageInfo_FetchDataRequest.Size(m) +} +func (m *FetchDataRequest) XXX_DiscardUnknown() { + xxx_messageInfo_FetchDataRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_FetchDataRequest proto.InternalMessageInfo + +func (m *FetchDataRequest) GetBlobKey() string { + if m != nil && m.BlobKey != nil { + return *m.BlobKey + } + return "" +} + +func (m *FetchDataRequest) GetStartIndex() int64 { + if m != nil && m.StartIndex != nil { + return *m.StartIndex + } + return 0 +} + +func (m *FetchDataRequest) GetEndIndex() int64 { + if m != nil && m.EndIndex != nil { + return *m.EndIndex + } + return 0 +} + +type FetchDataResponse struct { + Data []byte `protobuf:"bytes,1000,req,name=data" json:"data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FetchDataResponse) Reset() { *m = FetchDataResponse{} } +func (m *FetchDataResponse) String() string { return proto.CompactTextString(m) } +func (*FetchDataResponse) ProtoMessage() {} +func (*FetchDataResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{5} +} +func (m *FetchDataResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FetchDataResponse.Unmarshal(m, b) +} +func (m *FetchDataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FetchDataResponse.Marshal(b, m, deterministic) +} +func (dst *FetchDataResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_FetchDataResponse.Merge(dst, src) +} +func (m *FetchDataResponse) XXX_Size() int { + return xxx_messageInfo_FetchDataResponse.Size(m) +} +func (m *FetchDataResponse) XXX_DiscardUnknown() { + xxx_messageInfo_FetchDataResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_FetchDataResponse proto.InternalMessageInfo + +func (m *FetchDataResponse) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +type CloneBlobRequest struct { + BlobKey []byte `protobuf:"bytes,1,req,name=blob_key,json=blobKey" json:"blob_key,omitempty"` + MimeType []byte `protobuf:"bytes,2,req,name=mime_type,json=mimeType" json:"mime_type,omitempty"` + TargetAppId []byte `protobuf:"bytes,3,req,name=target_app_id,json=targetAppId" json:"target_app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CloneBlobRequest) Reset() { *m = CloneBlobRequest{} } +func (m *CloneBlobRequest) String() string { return proto.CompactTextString(m) } +func (*CloneBlobRequest) ProtoMessage() {} +func (*CloneBlobRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{6} +} +func (m *CloneBlobRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CloneBlobRequest.Unmarshal(m, b) +} +func (m *CloneBlobRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CloneBlobRequest.Marshal(b, m, deterministic) +} +func (dst *CloneBlobRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CloneBlobRequest.Merge(dst, src) +} +func (m *CloneBlobRequest) XXX_Size() int { + return xxx_messageInfo_CloneBlobRequest.Size(m) +} +func (m *CloneBlobRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CloneBlobRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CloneBlobRequest proto.InternalMessageInfo + +func (m *CloneBlobRequest) GetBlobKey() []byte { + if m != nil { + return m.BlobKey + } + return nil +} + +func (m *CloneBlobRequest) GetMimeType() []byte { + if m != nil { + return m.MimeType + } + return nil +} + +func (m *CloneBlobRequest) GetTargetAppId() []byte { + if m != nil { + return m.TargetAppId + } + return nil +} + +type CloneBlobResponse struct { + BlobKey []byte `protobuf:"bytes,1,req,name=blob_key,json=blobKey" json:"blob_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CloneBlobResponse) Reset() { *m = CloneBlobResponse{} } +func (m *CloneBlobResponse) String() string { return proto.CompactTextString(m) } +func (*CloneBlobResponse) ProtoMessage() {} +func (*CloneBlobResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{7} +} +func (m *CloneBlobResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CloneBlobResponse.Unmarshal(m, b) +} +func (m *CloneBlobResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CloneBlobResponse.Marshal(b, m, deterministic) +} +func (dst *CloneBlobResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CloneBlobResponse.Merge(dst, src) +} +func (m *CloneBlobResponse) XXX_Size() int { + return xxx_messageInfo_CloneBlobResponse.Size(m) +} +func (m *CloneBlobResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CloneBlobResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CloneBlobResponse proto.InternalMessageInfo + +func (m *CloneBlobResponse) GetBlobKey() []byte { + if m != nil { + return m.BlobKey + } + return nil +} + +type DecodeBlobKeyRequest struct { + BlobKey []string `protobuf:"bytes,1,rep,name=blob_key,json=blobKey" json:"blob_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DecodeBlobKeyRequest) Reset() { *m = DecodeBlobKeyRequest{} } +func (m *DecodeBlobKeyRequest) String() string { return proto.CompactTextString(m) } +func (*DecodeBlobKeyRequest) ProtoMessage() {} +func (*DecodeBlobKeyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{8} +} +func (m *DecodeBlobKeyRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DecodeBlobKeyRequest.Unmarshal(m, b) +} +func (m *DecodeBlobKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DecodeBlobKeyRequest.Marshal(b, m, deterministic) +} +func (dst *DecodeBlobKeyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DecodeBlobKeyRequest.Merge(dst, src) +} +func (m *DecodeBlobKeyRequest) XXX_Size() int { + return xxx_messageInfo_DecodeBlobKeyRequest.Size(m) +} +func (m *DecodeBlobKeyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DecodeBlobKeyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DecodeBlobKeyRequest proto.InternalMessageInfo + +func (m *DecodeBlobKeyRequest) GetBlobKey() []string { + if m != nil { + return m.BlobKey + } + return nil +} + +type DecodeBlobKeyResponse struct { + Decoded []string `protobuf:"bytes,1,rep,name=decoded" json:"decoded,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DecodeBlobKeyResponse) Reset() { *m = DecodeBlobKeyResponse{} } +func (m *DecodeBlobKeyResponse) String() string { return proto.CompactTextString(m) } +func (*DecodeBlobKeyResponse) ProtoMessage() {} +func (*DecodeBlobKeyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{9} +} +func (m *DecodeBlobKeyResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DecodeBlobKeyResponse.Unmarshal(m, b) +} +func (m *DecodeBlobKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DecodeBlobKeyResponse.Marshal(b, m, deterministic) +} +func (dst *DecodeBlobKeyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DecodeBlobKeyResponse.Merge(dst, src) +} +func (m *DecodeBlobKeyResponse) XXX_Size() int { + return xxx_messageInfo_DecodeBlobKeyResponse.Size(m) +} +func (m *DecodeBlobKeyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DecodeBlobKeyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DecodeBlobKeyResponse proto.InternalMessageInfo + +func (m *DecodeBlobKeyResponse) GetDecoded() []string { + if m != nil { + return m.Decoded + } + return nil +} + +type CreateEncodedGoogleStorageKeyRequest struct { + Filename *string `protobuf:"bytes,1,req,name=filename" json:"filename,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateEncodedGoogleStorageKeyRequest) Reset() { *m = CreateEncodedGoogleStorageKeyRequest{} } +func (m *CreateEncodedGoogleStorageKeyRequest) String() string { return proto.CompactTextString(m) } +func (*CreateEncodedGoogleStorageKeyRequest) ProtoMessage() {} +func (*CreateEncodedGoogleStorageKeyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{10} +} +func (m *CreateEncodedGoogleStorageKeyRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateEncodedGoogleStorageKeyRequest.Unmarshal(m, b) +} +func (m *CreateEncodedGoogleStorageKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateEncodedGoogleStorageKeyRequest.Marshal(b, m, deterministic) +} +func (dst *CreateEncodedGoogleStorageKeyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateEncodedGoogleStorageKeyRequest.Merge(dst, src) +} +func (m *CreateEncodedGoogleStorageKeyRequest) XXX_Size() int { + return xxx_messageInfo_CreateEncodedGoogleStorageKeyRequest.Size(m) +} +func (m *CreateEncodedGoogleStorageKeyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateEncodedGoogleStorageKeyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateEncodedGoogleStorageKeyRequest proto.InternalMessageInfo + +func (m *CreateEncodedGoogleStorageKeyRequest) GetFilename() string { + if m != nil && m.Filename != nil { + return *m.Filename + } + return "" +} + +type CreateEncodedGoogleStorageKeyResponse struct { + BlobKey *string `protobuf:"bytes,1,req,name=blob_key,json=blobKey" json:"blob_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateEncodedGoogleStorageKeyResponse) Reset() { *m = CreateEncodedGoogleStorageKeyResponse{} } +func (m *CreateEncodedGoogleStorageKeyResponse) String() string { return proto.CompactTextString(m) } +func (*CreateEncodedGoogleStorageKeyResponse) ProtoMessage() {} +func (*CreateEncodedGoogleStorageKeyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_blobstore_service_3604fb6033ea2e2e, []int{11} +} +func (m *CreateEncodedGoogleStorageKeyResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateEncodedGoogleStorageKeyResponse.Unmarshal(m, b) +} +func (m *CreateEncodedGoogleStorageKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateEncodedGoogleStorageKeyResponse.Marshal(b, m, deterministic) +} +func (dst *CreateEncodedGoogleStorageKeyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateEncodedGoogleStorageKeyResponse.Merge(dst, src) +} +func (m *CreateEncodedGoogleStorageKeyResponse) XXX_Size() int { + return xxx_messageInfo_CreateEncodedGoogleStorageKeyResponse.Size(m) +} +func (m *CreateEncodedGoogleStorageKeyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateEncodedGoogleStorageKeyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateEncodedGoogleStorageKeyResponse proto.InternalMessageInfo + +func (m *CreateEncodedGoogleStorageKeyResponse) GetBlobKey() string { + if m != nil && m.BlobKey != nil { + return *m.BlobKey + } + return "" +} + +func init() { + proto.RegisterType((*BlobstoreServiceError)(nil), "appengine.BlobstoreServiceError") + proto.RegisterType((*CreateUploadURLRequest)(nil), "appengine.CreateUploadURLRequest") + proto.RegisterType((*CreateUploadURLResponse)(nil), "appengine.CreateUploadURLResponse") + proto.RegisterType((*DeleteBlobRequest)(nil), "appengine.DeleteBlobRequest") + proto.RegisterType((*FetchDataRequest)(nil), "appengine.FetchDataRequest") + proto.RegisterType((*FetchDataResponse)(nil), "appengine.FetchDataResponse") + proto.RegisterType((*CloneBlobRequest)(nil), "appengine.CloneBlobRequest") + proto.RegisterType((*CloneBlobResponse)(nil), "appengine.CloneBlobResponse") + proto.RegisterType((*DecodeBlobKeyRequest)(nil), "appengine.DecodeBlobKeyRequest") + proto.RegisterType((*DecodeBlobKeyResponse)(nil), "appengine.DecodeBlobKeyResponse") + proto.RegisterType((*CreateEncodedGoogleStorageKeyRequest)(nil), "appengine.CreateEncodedGoogleStorageKeyRequest") + proto.RegisterType((*CreateEncodedGoogleStorageKeyResponse)(nil), "appengine.CreateEncodedGoogleStorageKeyResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/blobstore/blobstore_service.proto", fileDescriptor_blobstore_service_3604fb6033ea2e2e) +} + +var fileDescriptor_blobstore_service_3604fb6033ea2e2e = []byte{ + // 737 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xe1, 0x6e, 0xe3, 0x44, + 0x10, 0xc6, 0x4e, 0x7b, 0x8d, 0xa7, 0xe1, 0xe4, 0xae, 0x1a, 0x9a, 0x52, 0x01, 0xc1, 0x3a, 0xa4, + 0x48, 0xa0, 0x56, 0xfd, 0xc1, 0x03, 0xd8, 0xb5, 0x13, 0xac, 0xe6, 0xec, 0x6a, 0xe3, 0x20, 0xb8, + 0x3f, 0xab, 0x6d, 0x3c, 0xb8, 0x56, 0x1d, 0xaf, 0x59, 0x6f, 0x50, 0x73, 0x0f, 0xc1, 0xbb, 0xf1, + 0x16, 0x48, 0xbc, 0x04, 0xf2, 0xda, 0x6d, 0x73, 0x07, 0x77, 0xf7, 0x6f, 0xe7, 0xfb, 0xf6, 0x9b, + 0xf9, 0x66, 0x66, 0xb5, 0x30, 0xcd, 0x84, 0xc8, 0x0a, 0x3c, 0xcf, 0x44, 0xc1, 0xcb, 0xec, 0x5c, + 0xc8, 0xec, 0x82, 0x57, 0x15, 0x96, 0x59, 0x5e, 0xe2, 0x45, 0x5e, 0x2a, 0x94, 0x25, 0x2f, 0x2e, + 0x6e, 0x0b, 0x71, 0x5b, 0x2b, 0x21, 0xf1, 0xf9, 0xc4, 0x6a, 0x94, 0x7f, 0xe4, 0x2b, 0x3c, 0xaf, + 0xa4, 0x50, 0x82, 0x58, 0x4f, 0x2a, 0xe7, 0x1f, 0x03, 0x86, 0xde, 0xe3, 0xb5, 0x45, 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, 0x92, 0x67, 0xb8, 0x53, 0xf5, 0x4b, 0xe8, 0xff, 0x96, 0x17, 0xa8, 0x9f, 0x64, 0xbb, 0xb4, + 0xa7, 0xd8, 0xf1, 0xe0, 0xbb, 0x4f, 0xe4, 0xf8, 0x40, 0xb7, 0xcf, 0xd6, 0xbd, 0xc3, 0x37, 0xd6, + 0xd3, 0x07, 0xf6, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc1, 0xfb, 0x81, 0x94, 0xfb, 0x04, 0x00, + 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/blobstore/blobstore_service.proto b/vendor/google.golang.org/appengine/internal/blobstore/blobstore_service.proto new file mode 100644 index 000000000..33b265032 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/blobstore/blobstore_service.proto @@ -0,0 +1,71 @@ +syntax = "proto2"; +option go_package = "blobstore"; + +package appengine; + +message BlobstoreServiceError { + enum ErrorCode { + OK = 0; + INTERNAL_ERROR = 1; + URL_TOO_LONG = 2; + PERMISSION_DENIED = 3; + BLOB_NOT_FOUND = 4; + DATA_INDEX_OUT_OF_RANGE = 5; + BLOB_FETCH_SIZE_TOO_LARGE = 6; + ARGUMENT_OUT_OF_RANGE = 8; + INVALID_BLOB_KEY = 9; + } +} + +message CreateUploadURLRequest { + required string success_path = 1; + optional int64 max_upload_size_bytes = 2; + optional int64 max_upload_size_per_blob_bytes = 3; + optional string gs_bucket_name = 4; + optional int32 url_expiry_time_seconds = 5; +} + +message CreateUploadURLResponse { + required string url = 1; +} + +message DeleteBlobRequest { + repeated string blob_key = 1; + optional string token = 2; +} + +message FetchDataRequest { + required string blob_key = 1; + required int64 start_index = 2; + required int64 end_index = 3; +} + +message FetchDataResponse { + required bytes data = 1000 [ctype = CORD]; +} + +message CloneBlobRequest { + required bytes blob_key = 1; + required bytes mime_type = 2; + required bytes target_app_id = 3; +} + +message CloneBlobResponse { + required bytes blob_key = 1; +} + +message DecodeBlobKeyRequest { + repeated string blob_key = 1; +} + +message DecodeBlobKeyResponse { + repeated string decoded = 1; +} + +message CreateEncodedGoogleStorageKeyRequest { + required string filename = 1; +} + +message CreateEncodedGoogleStorageKeyResponse { + required string blob_key = 1; +} diff --git a/vendor/google.golang.org/appengine/internal/capability/capability_service.pb.go b/vendor/google.golang.org/appengine/internal/capability/capability_service.pb.go new file mode 100644 index 000000000..220fccfa9 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/capability/capability_service.pb.go @@ -0,0 +1,203 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/capability/capability_service.proto + +package capability + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type IsEnabledResponse_SummaryStatus int32 + +const ( + IsEnabledResponse_DEFAULT IsEnabledResponse_SummaryStatus = 0 + IsEnabledResponse_ENABLED IsEnabledResponse_SummaryStatus = 1 + IsEnabledResponse_SCHEDULED_FUTURE IsEnabledResponse_SummaryStatus = 2 + IsEnabledResponse_SCHEDULED_NOW IsEnabledResponse_SummaryStatus = 3 + IsEnabledResponse_DISABLED IsEnabledResponse_SummaryStatus = 4 + IsEnabledResponse_UNKNOWN IsEnabledResponse_SummaryStatus = 5 +) + +var IsEnabledResponse_SummaryStatus_name = map[int32]string{ + 0: "DEFAULT", + 1: "ENABLED", + 2: "SCHEDULED_FUTURE", + 3: "SCHEDULED_NOW", + 4: "DISABLED", + 5: "UNKNOWN", +} +var IsEnabledResponse_SummaryStatus_value = map[string]int32{ + "DEFAULT": 0, + "ENABLED": 1, + "SCHEDULED_FUTURE": 2, + "SCHEDULED_NOW": 3, + "DISABLED": 4, + "UNKNOWN": 5, +} + +func (x IsEnabledResponse_SummaryStatus) Enum() *IsEnabledResponse_SummaryStatus { + p := new(IsEnabledResponse_SummaryStatus) + *p = x + return p +} +func (x IsEnabledResponse_SummaryStatus) String() string { + return proto.EnumName(IsEnabledResponse_SummaryStatus_name, int32(x)) +} +func (x *IsEnabledResponse_SummaryStatus) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(IsEnabledResponse_SummaryStatus_value, data, "IsEnabledResponse_SummaryStatus") + if err != nil { + return err + } + *x = IsEnabledResponse_SummaryStatus(value) + return nil +} +func (IsEnabledResponse_SummaryStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_capability_service_030277ff00db7e72, []int{1, 0} +} + +type IsEnabledRequest struct { + Package *string `protobuf:"bytes,1,req,name=package" json:"package,omitempty"` + Capability []string `protobuf:"bytes,2,rep,name=capability" json:"capability,omitempty"` + Call []string `protobuf:"bytes,3,rep,name=call" json:"call,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IsEnabledRequest) Reset() { *m = IsEnabledRequest{} } +func (m *IsEnabledRequest) String() string { return proto.CompactTextString(m) } +func (*IsEnabledRequest) ProtoMessage() {} +func (*IsEnabledRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_capability_service_030277ff00db7e72, []int{0} +} +func (m *IsEnabledRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IsEnabledRequest.Unmarshal(m, b) +} +func (m *IsEnabledRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IsEnabledRequest.Marshal(b, m, deterministic) +} +func (dst *IsEnabledRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_IsEnabledRequest.Merge(dst, src) +} +func (m *IsEnabledRequest) XXX_Size() int { + return xxx_messageInfo_IsEnabledRequest.Size(m) +} +func (m *IsEnabledRequest) XXX_DiscardUnknown() { + xxx_messageInfo_IsEnabledRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_IsEnabledRequest proto.InternalMessageInfo + +func (m *IsEnabledRequest) GetPackage() string { + if m != nil && m.Package != nil { + return *m.Package + } + return "" +} + +func (m *IsEnabledRequest) GetCapability() []string { + if m != nil { + return m.Capability + } + return nil +} + +func (m *IsEnabledRequest) GetCall() []string { + if m != nil { + return m.Call + } + return nil +} + +type IsEnabledResponse struct { + SummaryStatus *IsEnabledResponse_SummaryStatus `protobuf:"varint,1,opt,name=summary_status,json=summaryStatus,enum=appengine.IsEnabledResponse_SummaryStatus" json:"summary_status,omitempty"` + TimeUntilScheduled *int64 `protobuf:"varint,2,opt,name=time_until_scheduled,json=timeUntilScheduled" json:"time_until_scheduled,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IsEnabledResponse) Reset() { *m = IsEnabledResponse{} } +func (m *IsEnabledResponse) String() string { return proto.CompactTextString(m) } +func (*IsEnabledResponse) ProtoMessage() {} +func (*IsEnabledResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_capability_service_030277ff00db7e72, []int{1} +} +func (m *IsEnabledResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IsEnabledResponse.Unmarshal(m, b) +} +func (m *IsEnabledResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IsEnabledResponse.Marshal(b, m, deterministic) +} +func (dst *IsEnabledResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_IsEnabledResponse.Merge(dst, src) +} +func (m *IsEnabledResponse) XXX_Size() int { + return xxx_messageInfo_IsEnabledResponse.Size(m) +} +func (m *IsEnabledResponse) XXX_DiscardUnknown() { + xxx_messageInfo_IsEnabledResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_IsEnabledResponse proto.InternalMessageInfo + +func (m *IsEnabledResponse) GetSummaryStatus() IsEnabledResponse_SummaryStatus { + if m != nil && m.SummaryStatus != nil { + return *m.SummaryStatus + } + return IsEnabledResponse_DEFAULT +} + +func (m *IsEnabledResponse) GetTimeUntilScheduled() int64 { + if m != nil && m.TimeUntilScheduled != nil { + return *m.TimeUntilScheduled + } + return 0 +} + +func init() { + proto.RegisterType((*IsEnabledRequest)(nil), "appengine.IsEnabledRequest") + proto.RegisterType((*IsEnabledResponse)(nil), "appengine.IsEnabledResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/capability/capability_service.proto", fileDescriptor_capability_service_030277ff00db7e72) +} + +var fileDescriptor_capability_service_030277ff00db7e72 = []byte{ + // 359 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xd1, 0x8a, 0x9b, 0x40, + 0x14, 0x86, 0xa3, 0xa6, 0xa4, 0x9e, 0x26, 0xc1, 0x0c, 0xb9, 0x90, 0xb6, 0x14, 0xf1, 0x4a, 0x7a, + 0x61, 0x4a, 0xde, 0x20, 0x89, 0x86, 0x84, 0x06, 0x43, 0x35, 0x12, 0x28, 0x14, 0x3b, 0x31, 0x83, + 0x95, 0x8e, 0xa3, 0xeb, 0x8c, 0x0b, 0x79, 0x82, 0x7d, 0xed, 0x45, 0x43, 0x8c, 0xcb, 0x2e, 0x7b, + 0x77, 0xce, 0xf9, 0xf9, 0xfe, 0x99, 0x73, 0x7e, 0xd8, 0x24, 0x79, 0x9e, 0x50, 0x62, 0x27, 0x39, + 0xc5, 0x2c, 0xb1, 0xf3, 0x32, 0x99, 0xe1, 0xa2, 0x20, 0x2c, 0x49, 0x19, 0x99, 0xa5, 0x4c, 0x90, + 0x92, 0x61, 0x3a, 0x8b, 0x71, 0x81, 0x4f, 0x29, 0x4d, 0xc5, 0xa5, 0x53, 0x46, 0x9c, 0x94, 0x8f, + 0x69, 0x4c, 0xec, 0xa2, 0xcc, 0x45, 0x8e, 0xd4, 0x96, 0x33, 0xff, 0x82, 0xb6, 0xe5, 0x2e, 0xc3,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, 0xd1, 0xd3, 0x3e, 0xcc, 0xff, 0xc0, 0x64, 0xd5, 0xde, 0x2a, + 0xb8, 0x26, 0x82, 0x36, 0xa0, 0xb6, 0x7b, 0xa2, 0x2f, 0x6f, 0x6f, 0xdf, 0xc4, 0xf2, 0xf9, 0xeb, + 0x7b, 0xa7, 0x31, 0x7b, 0xcb, 0xe1, 0xef, 0x4e, 0x14, 0xcf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc0, + 0x03, 0x26, 0x25, 0x2e, 0x02, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/capability/capability_service.proto b/vendor/google.golang.org/appengine/internal/capability/capability_service.proto new file mode 100644 index 000000000..5660ab6ee --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/capability/capability_service.proto @@ -0,0 +1,28 @@ +syntax = "proto2"; +option go_package = "capability"; + +package appengine; + +message IsEnabledRequest { + required string package = 1; + repeated string capability = 2; + repeated string call = 3; +} + +message IsEnabledResponse { + enum SummaryStatus { + DEFAULT = 0; + ENABLED = 1; + SCHEDULED_FUTURE = 2; + SCHEDULED_NOW = 3; + DISABLED = 4; + UNKNOWN = 5; + } + optional SummaryStatus summary_status = 1; + + optional int64 time_until_scheduled = 2; +} + +service CapabilityService { + rpc IsEnabled(IsEnabledRequest) returns (IsEnabledResponse) {}; +} diff --git a/vendor/google.golang.org/appengine/internal/channel/channel_service.pb.go b/vendor/google.golang.org/appengine/internal/channel/channel_service.pb.go new file mode 100644 index 000000000..ba31ea299 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/channel/channel_service.pb.go @@ -0,0 +1,273 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/channel/channel_service.proto + +package channel + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type ChannelServiceError_ErrorCode int32 + +const ( + ChannelServiceError_OK ChannelServiceError_ErrorCode = 0 + ChannelServiceError_INTERNAL_ERROR ChannelServiceError_ErrorCode = 1 + ChannelServiceError_INVALID_CHANNEL_KEY ChannelServiceError_ErrorCode = 2 + ChannelServiceError_BAD_MESSAGE ChannelServiceError_ErrorCode = 3 + ChannelServiceError_INVALID_CHANNEL_TOKEN_DURATION ChannelServiceError_ErrorCode = 4 + ChannelServiceError_APPID_ALIAS_REQUIRED ChannelServiceError_ErrorCode = 5 +) + +var ChannelServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "INTERNAL_ERROR", + 2: "INVALID_CHANNEL_KEY", + 3: "BAD_MESSAGE", + 4: "INVALID_CHANNEL_TOKEN_DURATION", + 5: "APPID_ALIAS_REQUIRED", +} +var ChannelServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "INTERNAL_ERROR": 1, + "INVALID_CHANNEL_KEY": 2, + "BAD_MESSAGE": 3, + "INVALID_CHANNEL_TOKEN_DURATION": 4, + "APPID_ALIAS_REQUIRED": 5, +} + +func (x ChannelServiceError_ErrorCode) Enum() *ChannelServiceError_ErrorCode { + p := new(ChannelServiceError_ErrorCode) + *p = x + return p +} +func (x ChannelServiceError_ErrorCode) String() string { + return proto.EnumName(ChannelServiceError_ErrorCode_name, int32(x)) +} +func (x *ChannelServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ChannelServiceError_ErrorCode_value, data, "ChannelServiceError_ErrorCode") + if err != nil { + return err + } + *x = ChannelServiceError_ErrorCode(value) + return nil +} +func (ChannelServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_channel_service_a8d15e05b34664a9, []int{0, 0} +} + +type ChannelServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChannelServiceError) Reset() { *m = ChannelServiceError{} } +func (m *ChannelServiceError) String() string { return proto.CompactTextString(m) } +func (*ChannelServiceError) ProtoMessage() {} +func (*ChannelServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_channel_service_a8d15e05b34664a9, []int{0} +} +func (m *ChannelServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChannelServiceError.Unmarshal(m, b) +} +func (m *ChannelServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChannelServiceError.Marshal(b, m, deterministic) +} +func (dst *ChannelServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChannelServiceError.Merge(dst, src) +} +func (m *ChannelServiceError) XXX_Size() int { + return xxx_messageInfo_ChannelServiceError.Size(m) +} +func (m *ChannelServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_ChannelServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_ChannelServiceError proto.InternalMessageInfo + +type CreateChannelRequest struct { + ApplicationKey *string `protobuf:"bytes,1,req,name=application_key,json=applicationKey" json:"application_key,omitempty"` + DurationMinutes *int32 `protobuf:"varint,2,opt,name=duration_minutes,json=durationMinutes" json:"duration_minutes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateChannelRequest) Reset() { *m = CreateChannelRequest{} } +func (m *CreateChannelRequest) String() string { return proto.CompactTextString(m) } +func (*CreateChannelRequest) ProtoMessage() {} +func (*CreateChannelRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_channel_service_a8d15e05b34664a9, []int{1} +} +func (m *CreateChannelRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateChannelRequest.Unmarshal(m, b) +} +func (m *CreateChannelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateChannelRequest.Marshal(b, m, deterministic) +} +func (dst *CreateChannelRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateChannelRequest.Merge(dst, src) +} +func (m *CreateChannelRequest) XXX_Size() int { + return xxx_messageInfo_CreateChannelRequest.Size(m) +} +func (m *CreateChannelRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateChannelRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateChannelRequest proto.InternalMessageInfo + +func (m *CreateChannelRequest) GetApplicationKey() string { + if m != nil && m.ApplicationKey != nil { + return *m.ApplicationKey + } + return "" +} + +func (m *CreateChannelRequest) GetDurationMinutes() int32 { + if m != nil && m.DurationMinutes != nil { + return *m.DurationMinutes + } + return 0 +} + +type CreateChannelResponse struct { + Token *string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` + DurationMinutes *int32 `protobuf:"varint,3,opt,name=duration_minutes,json=durationMinutes" json:"duration_minutes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateChannelResponse) Reset() { *m = CreateChannelResponse{} } +func (m *CreateChannelResponse) String() string { return proto.CompactTextString(m) } +func (*CreateChannelResponse) ProtoMessage() {} +func (*CreateChannelResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_channel_service_a8d15e05b34664a9, []int{2} +} +func (m *CreateChannelResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateChannelResponse.Unmarshal(m, b) +} +func (m *CreateChannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateChannelResponse.Marshal(b, m, deterministic) +} +func (dst *CreateChannelResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateChannelResponse.Merge(dst, src) +} +func (m *CreateChannelResponse) XXX_Size() int { + return xxx_messageInfo_CreateChannelResponse.Size(m) +} +func (m *CreateChannelResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateChannelResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateChannelResponse proto.InternalMessageInfo + +func (m *CreateChannelResponse) GetToken() string { + if m != nil && m.Token != nil { + return *m.Token + } + return "" +} + +func (m *CreateChannelResponse) GetDurationMinutes() int32 { + if m != nil && m.DurationMinutes != nil { + return *m.DurationMinutes + } + return 0 +} + +type SendMessageRequest struct { + ApplicationKey *string `protobuf:"bytes,1,req,name=application_key,json=applicationKey" json:"application_key,omitempty"` + Message *string `protobuf:"bytes,2,req,name=message" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SendMessageRequest) Reset() { *m = SendMessageRequest{} } +func (m *SendMessageRequest) String() string { return proto.CompactTextString(m) } +func (*SendMessageRequest) ProtoMessage() {} +func (*SendMessageRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_channel_service_a8d15e05b34664a9, []int{3} +} +func (m *SendMessageRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SendMessageRequest.Unmarshal(m, b) +} +func (m *SendMessageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SendMessageRequest.Marshal(b, m, deterministic) +} +func (dst *SendMessageRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SendMessageRequest.Merge(dst, src) +} +func (m *SendMessageRequest) XXX_Size() int { + return xxx_messageInfo_SendMessageRequest.Size(m) +} +func (m *SendMessageRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SendMessageRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SendMessageRequest proto.InternalMessageInfo + +func (m *SendMessageRequest) GetApplicationKey() string { + if m != nil && m.ApplicationKey != nil { + return *m.ApplicationKey + } + return "" +} + +func (m *SendMessageRequest) GetMessage() string { + if m != nil && m.Message != nil { + return *m.Message + } + return "" +} + +func init() { + proto.RegisterType((*ChannelServiceError)(nil), "appengine.ChannelServiceError") + proto.RegisterType((*CreateChannelRequest)(nil), "appengine.CreateChannelRequest") + proto.RegisterType((*CreateChannelResponse)(nil), "appengine.CreateChannelResponse") + proto.RegisterType((*SendMessageRequest)(nil), "appengine.SendMessageRequest") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/channel/channel_service.proto", fileDescriptor_channel_service_a8d15e05b34664a9) +} + +var fileDescriptor_channel_service_a8d15e05b34664a9 = []byte{ + // 355 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xcd, 0xee, 0xd2, 0x40, + 0x14, 0xc5, 0x6d, 0xff, 0x22, 0xe9, 0x35, 0x81, 0x66, 0xc0, 0xd8, 0x95, 0x21, 0xdd, 0x88, 0x1b, + 0x78, 0x86, 0xa1, 0x9d, 0x68, 0xd3, 0xd2, 0xe2, 0x14, 0xfc, 0xda, 0x4c, 0x26, 0x70, 0x53, 0x2b, + 0x65, 0xa6, 0x4e, 0x8b, 0x09, 0x4f, 0xe1, 0x63, 0xf8, 0x9a, 0x26, 0x14, 0x88, 0x21, 0x6c, 0x5c, + 0xcd, 0x9c, 0x93, 0xdf, 0x39, 0x33, 0x37, 0x17, 0x16, 0x85, 0xd6, 0x45, 0x85, 0xb3, 0x42, 0x57, + 0x52, 0x15, 0x33, 0x6d, 0x8a, 0xb9, 0xac, 0x6b, 0x54, 0x45, 0xa9, 0x70, 0x5e, 0xaa, 0x16, 0x8d, + 0x92, 0xd5, 0x7c, 0xfb, 0x5d, 0x2a, 0x85, 0xb7, 0x53, 0x34, 0x68, 0x7e, 0x95, 0x5b, 0x9c, 0xd5, + 0x46, 0xb7, 0x9a, 0x38, 0xb7, 0x84, 0xff, 0xc7, 0x82, 0x51, 0xd0, 0x41, 0x79, 0xc7, 0x30, 0x63, + 0xb4, 0xf1, 0x7f, 0x5b, 0xe0, 0x9c, 0x6f, 0x81, 0xde, 0x21, 0x79, 0x01, 0x76, 0x16, 0xbb,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0xcf, 0xe0, 0x41, 0xff, 0xd0, 0x45, 0x3d, 0xfb, 0x0c, 0x5c, 0xe5, 0xc2, + 0xf9, 0xd6, 0xbf, 0x2c, 0xfb, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x0a, 0x77, 0x06, 0x23, + 0x02, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/channel/channel_service.proto b/vendor/google.golang.org/appengine/internal/channel/channel_service.proto new file mode 100644 index 000000000..2b5a918ca --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/channel/channel_service.proto @@ -0,0 +1,30 @@ +syntax = "proto2"; +option go_package = "channel"; + +package appengine; + +message ChannelServiceError { + enum ErrorCode { + OK = 0; + INTERNAL_ERROR = 1; + INVALID_CHANNEL_KEY = 2; + BAD_MESSAGE = 3; + INVALID_CHANNEL_TOKEN_DURATION = 4; + APPID_ALIAS_REQUIRED = 5; + } +} + +message CreateChannelRequest { + required string application_key = 1; + optional int32 duration_minutes = 2; +} + +message CreateChannelResponse { + optional string token = 2; + optional int32 duration_minutes = 3; +} + +message SendMessageRequest { + required string application_key = 1; + required string message = 2; +} diff --git a/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go b/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go new file mode 100644 index 000000000..2fb748289 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go @@ -0,0 +1,4367 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/datastore/datastore_v3.proto + +package datastore + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Property_Meaning int32 + +const ( + Property_NO_MEANING Property_Meaning = 0 + Property_BLOB Property_Meaning = 14 + Property_TEXT Property_Meaning = 15 + Property_BYTESTRING Property_Meaning = 16 + Property_ATOM_CATEGORY Property_Meaning = 1 + Property_ATOM_LINK Property_Meaning = 2 + Property_ATOM_TITLE Property_Meaning = 3 + Property_ATOM_CONTENT Property_Meaning = 4 + Property_ATOM_SUMMARY Property_Meaning = 5 + Property_ATOM_AUTHOR Property_Meaning = 6 + Property_GD_WHEN Property_Meaning = 7 + Property_GD_EMAIL Property_Meaning = 8 + Property_GEORSS_POINT Property_Meaning = 9 + Property_GD_IM Property_Meaning = 10 + Property_GD_PHONENUMBER Property_Meaning = 11 + Property_GD_POSTALADDRESS Property_Meaning = 12 + Property_GD_RATING Property_Meaning = 13 + Property_BLOBKEY Property_Meaning = 17 + Property_ENTITY_PROTO Property_Meaning = 19 + Property_INDEX_VALUE Property_Meaning = 18 +) + +var Property_Meaning_name = map[int32]string{ + 0: "NO_MEANING", + 14: "BLOB", + 15: "TEXT", + 16: "BYTESTRING", + 1: "ATOM_CATEGORY", + 2: "ATOM_LINK", + 3: "ATOM_TITLE", + 4: "ATOM_CONTENT", + 5: "ATOM_SUMMARY", + 6: "ATOM_AUTHOR", + 7: "GD_WHEN", + 8: "GD_EMAIL", + 9: "GEORSS_POINT", + 10: "GD_IM", + 11: "GD_PHONENUMBER", + 12: "GD_POSTALADDRESS", + 13: "GD_RATING", + 17: "BLOBKEY", + 19: "ENTITY_PROTO", + 18: "INDEX_VALUE", +} +var Property_Meaning_value = map[string]int32{ + "NO_MEANING": 0, + "BLOB": 14, + "TEXT": 15, + "BYTESTRING": 16, + "ATOM_CATEGORY": 1, + "ATOM_LINK": 2, + "ATOM_TITLE": 3, + "ATOM_CONTENT": 4, + "ATOM_SUMMARY": 5, + "ATOM_AUTHOR": 6, + "GD_WHEN": 7, + "GD_EMAIL": 8, + "GEORSS_POINT": 9, + "GD_IM": 10, + "GD_PHONENUMBER": 11, + "GD_POSTALADDRESS": 12, + "GD_RATING": 13, + "BLOBKEY": 17, + "ENTITY_PROTO": 19, + "INDEX_VALUE": 18, +} + +func (x Property_Meaning) Enum() *Property_Meaning { + p := new(Property_Meaning) + *p = x + return p +} +func (x Property_Meaning) String() string { + return proto.EnumName(Property_Meaning_name, int32(x)) +} +func (x *Property_Meaning) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Property_Meaning_value, data, "Property_Meaning") + if err != nil { + return err + } + *x = Property_Meaning(value) + return nil +} +func (Property_Meaning) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{2, 0} +} + +type Property_FtsTokenizationOption int32 + +const ( + Property_HTML Property_FtsTokenizationOption = 1 + Property_ATOM Property_FtsTokenizationOption = 2 +) + +var Property_FtsTokenizationOption_name = map[int32]string{ + 1: "HTML", + 2: "ATOM", +} +var Property_FtsTokenizationOption_value = map[string]int32{ + "HTML": 1, + "ATOM": 2, +} + +func (x Property_FtsTokenizationOption) Enum() *Property_FtsTokenizationOption { + p := new(Property_FtsTokenizationOption) + *p = x + return p +} +func (x Property_FtsTokenizationOption) String() string { + return proto.EnumName(Property_FtsTokenizationOption_name, int32(x)) +} +func (x *Property_FtsTokenizationOption) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Property_FtsTokenizationOption_value, data, "Property_FtsTokenizationOption") + if err != nil { + return err + } + *x = Property_FtsTokenizationOption(value) + return nil +} +func (Property_FtsTokenizationOption) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{2, 1} +} + +type EntityProto_Kind int32 + +const ( + EntityProto_GD_CONTACT EntityProto_Kind = 1 + EntityProto_GD_EVENT EntityProto_Kind = 2 + EntityProto_GD_MESSAGE EntityProto_Kind = 3 +) + +var EntityProto_Kind_name = map[int32]string{ + 1: "GD_CONTACT", + 2: "GD_EVENT", + 3: "GD_MESSAGE", +} +var EntityProto_Kind_value = map[string]int32{ + "GD_CONTACT": 1, + "GD_EVENT": 2, + "GD_MESSAGE": 3, +} + +func (x EntityProto_Kind) Enum() *EntityProto_Kind { + p := new(EntityProto_Kind) + *p = x + return p +} +func (x EntityProto_Kind) String() string { + return proto.EnumName(EntityProto_Kind_name, int32(x)) +} +func (x *EntityProto_Kind) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(EntityProto_Kind_value, data, "EntityProto_Kind") + if err != nil { + return err + } + *x = EntityProto_Kind(value) + return nil +} +func (EntityProto_Kind) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{6, 0} +} + +type Index_Property_Direction int32 + +const ( + Index_Property_ASCENDING Index_Property_Direction = 1 + Index_Property_DESCENDING Index_Property_Direction = 2 +) + +var Index_Property_Direction_name = map[int32]string{ + 1: "ASCENDING", + 2: "DESCENDING", +} +var Index_Property_Direction_value = map[string]int32{ + "ASCENDING": 1, + "DESCENDING": 2, +} + +func (x Index_Property_Direction) Enum() *Index_Property_Direction { + p := new(Index_Property_Direction) + *p = x + return p +} +func (x Index_Property_Direction) String() string { + return proto.EnumName(Index_Property_Direction_name, int32(x)) +} +func (x *Index_Property_Direction) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Index_Property_Direction_value, data, "Index_Property_Direction") + if err != nil { + return err + } + *x = Index_Property_Direction(value) + return nil +} +func (Index_Property_Direction) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{8, 0, 0} +} + +type CompositeIndex_State int32 + +const ( + CompositeIndex_WRITE_ONLY CompositeIndex_State = 1 + CompositeIndex_READ_WRITE CompositeIndex_State = 2 + CompositeIndex_DELETED CompositeIndex_State = 3 + CompositeIndex_ERROR CompositeIndex_State = 4 +) + +var CompositeIndex_State_name = map[int32]string{ + 1: "WRITE_ONLY", + 2: "READ_WRITE", + 3: "DELETED", + 4: "ERROR", +} +var CompositeIndex_State_value = map[string]int32{ + "WRITE_ONLY": 1, + "READ_WRITE": 2, + "DELETED": 3, + "ERROR": 4, +} + +func (x CompositeIndex_State) Enum() *CompositeIndex_State { + p := new(CompositeIndex_State) + *p = x + return p +} +func (x CompositeIndex_State) String() string { + return proto.EnumName(CompositeIndex_State_name, int32(x)) +} +func (x *CompositeIndex_State) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(CompositeIndex_State_value, data, "CompositeIndex_State") + if err != nil { + return err + } + *x = CompositeIndex_State(value) + return nil +} +func (CompositeIndex_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{9, 0} +} + +type Snapshot_Status int32 + +const ( + Snapshot_INACTIVE Snapshot_Status = 0 + Snapshot_ACTIVE Snapshot_Status = 1 +) + +var Snapshot_Status_name = map[int32]string{ + 0: "INACTIVE", + 1: "ACTIVE", +} +var Snapshot_Status_value = map[string]int32{ + "INACTIVE": 0, + "ACTIVE": 1, +} + +func (x Snapshot_Status) Enum() *Snapshot_Status { + p := new(Snapshot_Status) + *p = x + return p +} +func (x Snapshot_Status) String() string { + return proto.EnumName(Snapshot_Status_name, int32(x)) +} +func (x *Snapshot_Status) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Snapshot_Status_value, data, "Snapshot_Status") + if err != nil { + return err + } + *x = Snapshot_Status(value) + return nil +} +func (Snapshot_Status) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{12, 0} +} + +type Query_Hint int32 + +const ( + Query_ORDER_FIRST Query_Hint = 1 + Query_ANCESTOR_FIRST Query_Hint = 2 + Query_FILTER_FIRST Query_Hint = 3 +) + +var Query_Hint_name = map[int32]string{ + 1: "ORDER_FIRST", + 2: "ANCESTOR_FIRST", + 3: "FILTER_FIRST", +} +var Query_Hint_value = map[string]int32{ + "ORDER_FIRST": 1, + "ANCESTOR_FIRST": 2, + "FILTER_FIRST": 3, +} + +func (x Query_Hint) Enum() *Query_Hint { + p := new(Query_Hint) + *p = x + return p +} +func (x Query_Hint) String() string { + return proto.EnumName(Query_Hint_name, int32(x)) +} +func (x *Query_Hint) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Query_Hint_value, data, "Query_Hint") + if err != nil { + return err + } + *x = Query_Hint(value) + return nil +} +func (Query_Hint) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 0} +} + +type Query_Filter_Operator int32 + +const ( + Query_Filter_LESS_THAN Query_Filter_Operator = 1 + Query_Filter_LESS_THAN_OR_EQUAL Query_Filter_Operator = 2 + Query_Filter_GREATER_THAN Query_Filter_Operator = 3 + Query_Filter_GREATER_THAN_OR_EQUAL Query_Filter_Operator = 4 + Query_Filter_EQUAL Query_Filter_Operator = 5 + Query_Filter_IN Query_Filter_Operator = 6 + Query_Filter_EXISTS Query_Filter_Operator = 7 +) + +var Query_Filter_Operator_name = map[int32]string{ + 1: "LESS_THAN", + 2: "LESS_THAN_OR_EQUAL", + 3: "GREATER_THAN", + 4: "GREATER_THAN_OR_EQUAL", + 5: "EQUAL", + 6: "IN", + 7: "EXISTS", +} +var Query_Filter_Operator_value = map[string]int32{ + "LESS_THAN": 1, + "LESS_THAN_OR_EQUAL": 2, + "GREATER_THAN": 3, + "GREATER_THAN_OR_EQUAL": 4, + "EQUAL": 5, + "IN": 6, + "EXISTS": 7, +} + +func (x Query_Filter_Operator) Enum() *Query_Filter_Operator { + p := new(Query_Filter_Operator) + *p = x + return p +} +func (x Query_Filter_Operator) String() string { + return proto.EnumName(Query_Filter_Operator_name, int32(x)) +} +func (x *Query_Filter_Operator) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Query_Filter_Operator_value, data, "Query_Filter_Operator") + if err != nil { + return err + } + *x = Query_Filter_Operator(value) + return nil +} +func (Query_Filter_Operator) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 0, 0} +} + +type Query_Order_Direction int32 + +const ( + Query_Order_ASCENDING Query_Order_Direction = 1 + Query_Order_DESCENDING Query_Order_Direction = 2 +) + +var Query_Order_Direction_name = map[int32]string{ + 1: "ASCENDING", + 2: "DESCENDING", +} +var Query_Order_Direction_value = map[string]int32{ + "ASCENDING": 1, + "DESCENDING": 2, +} + +func (x Query_Order_Direction) Enum() *Query_Order_Direction { + p := new(Query_Order_Direction) + *p = x + return p +} +func (x Query_Order_Direction) String() string { + return proto.EnumName(Query_Order_Direction_name, int32(x)) +} +func (x *Query_Order_Direction) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Query_Order_Direction_value, data, "Query_Order_Direction") + if err != nil { + return err + } + *x = Query_Order_Direction(value) + return nil +} +func (Query_Order_Direction) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 1, 0} +} + +type Error_ErrorCode int32 + +const ( + Error_BAD_REQUEST Error_ErrorCode = 1 + Error_CONCURRENT_TRANSACTION Error_ErrorCode = 2 + Error_INTERNAL_ERROR Error_ErrorCode = 3 + Error_NEED_INDEX Error_ErrorCode = 4 + Error_TIMEOUT Error_ErrorCode = 5 + Error_PERMISSION_DENIED Error_ErrorCode = 6 + Error_BIGTABLE_ERROR Error_ErrorCode = 7 + Error_COMMITTED_BUT_STILL_APPLYING Error_ErrorCode = 8 + Error_CAPABILITY_DISABLED Error_ErrorCode = 9 + Error_TRY_ALTERNATE_BACKEND Error_ErrorCode = 10 + Error_SAFE_TIME_TOO_OLD Error_ErrorCode = 11 +) + +var Error_ErrorCode_name = map[int32]string{ + 1: "BAD_REQUEST", + 2: "CONCURRENT_TRANSACTION", + 3: "INTERNAL_ERROR", + 4: "NEED_INDEX", + 5: "TIMEOUT", + 6: "PERMISSION_DENIED", + 7: "BIGTABLE_ERROR", + 8: "COMMITTED_BUT_STILL_APPLYING", + 9: "CAPABILITY_DISABLED", + 10: "TRY_ALTERNATE_BACKEND", + 11: "SAFE_TIME_TOO_OLD", +} +var Error_ErrorCode_value = map[string]int32{ + "BAD_REQUEST": 1, + "CONCURRENT_TRANSACTION": 2, + "INTERNAL_ERROR": 3, + "NEED_INDEX": 4, + "TIMEOUT": 5, + "PERMISSION_DENIED": 6, + "BIGTABLE_ERROR": 7, + "COMMITTED_BUT_STILL_APPLYING": 8, + "CAPABILITY_DISABLED": 9, + "TRY_ALTERNATE_BACKEND": 10, + "SAFE_TIME_TOO_OLD": 11, +} + +func (x Error_ErrorCode) Enum() *Error_ErrorCode { + p := new(Error_ErrorCode) + *p = x + return p +} +func (x Error_ErrorCode) String() string { + return proto.EnumName(Error_ErrorCode_name, int32(x)) +} +func (x *Error_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Error_ErrorCode_value, data, "Error_ErrorCode") + if err != nil { + return err + } + *x = Error_ErrorCode(value) + return nil +} +func (Error_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{19, 0} +} + +type PutRequest_AutoIdPolicy int32 + +const ( + PutRequest_CURRENT PutRequest_AutoIdPolicy = 0 + PutRequest_SEQUENTIAL PutRequest_AutoIdPolicy = 1 +) + +var PutRequest_AutoIdPolicy_name = map[int32]string{ + 0: "CURRENT", + 1: "SEQUENTIAL", +} +var PutRequest_AutoIdPolicy_value = map[string]int32{ + "CURRENT": 0, + "SEQUENTIAL": 1, +} + +func (x PutRequest_AutoIdPolicy) Enum() *PutRequest_AutoIdPolicy { + p := new(PutRequest_AutoIdPolicy) + *p = x + return p +} +func (x PutRequest_AutoIdPolicy) String() string { + return proto.EnumName(PutRequest_AutoIdPolicy_name, int32(x)) +} +func (x *PutRequest_AutoIdPolicy) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(PutRequest_AutoIdPolicy_value, data, "PutRequest_AutoIdPolicy") + if err != nil { + return err + } + *x = PutRequest_AutoIdPolicy(value) + return nil +} +func (PutRequest_AutoIdPolicy) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{23, 0} +} + +type BeginTransactionRequest_TransactionMode int32 + +const ( + BeginTransactionRequest_UNKNOWN BeginTransactionRequest_TransactionMode = 0 + BeginTransactionRequest_READ_ONLY BeginTransactionRequest_TransactionMode = 1 + BeginTransactionRequest_READ_WRITE BeginTransactionRequest_TransactionMode = 2 +) + +var BeginTransactionRequest_TransactionMode_name = map[int32]string{ + 0: "UNKNOWN", + 1: "READ_ONLY", + 2: "READ_WRITE", +} +var BeginTransactionRequest_TransactionMode_value = map[string]int32{ + "UNKNOWN": 0, + "READ_ONLY": 1, + "READ_WRITE": 2, +} + +func (x BeginTransactionRequest_TransactionMode) Enum() *BeginTransactionRequest_TransactionMode { + p := new(BeginTransactionRequest_TransactionMode) + *p = x + return p +} +func (x BeginTransactionRequest_TransactionMode) String() string { + return proto.EnumName(BeginTransactionRequest_TransactionMode_name, int32(x)) +} +func (x *BeginTransactionRequest_TransactionMode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(BeginTransactionRequest_TransactionMode_value, data, "BeginTransactionRequest_TransactionMode") + if err != nil { + return err + } + *x = BeginTransactionRequest_TransactionMode(value) + return nil +} +func (BeginTransactionRequest_TransactionMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{36, 0} +} + +type Action struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Action) Reset() { *m = Action{} } +func (m *Action) String() string { return proto.CompactTextString(m) } +func (*Action) ProtoMessage() {} +func (*Action) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{0} +} +func (m *Action) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Action.Unmarshal(m, b) +} +func (m *Action) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Action.Marshal(b, m, deterministic) +} +func (dst *Action) XXX_Merge(src proto.Message) { + xxx_messageInfo_Action.Merge(dst, src) +} +func (m *Action) XXX_Size() int { + return xxx_messageInfo_Action.Size(m) +} +func (m *Action) XXX_DiscardUnknown() { + xxx_messageInfo_Action.DiscardUnknown(m) +} + +var xxx_messageInfo_Action proto.InternalMessageInfo + +type PropertyValue struct { + Int64Value *int64 `protobuf:"varint,1,opt,name=int64Value" json:"int64Value,omitempty"` + BooleanValue *bool `protobuf:"varint,2,opt,name=booleanValue" json:"booleanValue,omitempty"` + StringValue *string `protobuf:"bytes,3,opt,name=stringValue" json:"stringValue,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,4,opt,name=doubleValue" json:"doubleValue,omitempty"` + Pointvalue *PropertyValue_PointValue `protobuf:"group,5,opt,name=PointValue,json=pointvalue" json:"pointvalue,omitempty"` + Uservalue *PropertyValue_UserValue `protobuf:"group,8,opt,name=UserValue,json=uservalue" json:"uservalue,omitempty"` + Referencevalue *PropertyValue_ReferenceValue `protobuf:"group,12,opt,name=ReferenceValue,json=referencevalue" json:"referencevalue,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PropertyValue) Reset() { *m = PropertyValue{} } +func (m *PropertyValue) String() string { return proto.CompactTextString(m) } +func (*PropertyValue) ProtoMessage() {} +func (*PropertyValue) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1} +} +func (m *PropertyValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PropertyValue.Unmarshal(m, b) +} +func (m *PropertyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PropertyValue.Marshal(b, m, deterministic) +} +func (dst *PropertyValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_PropertyValue.Merge(dst, src) +} +func (m *PropertyValue) XXX_Size() int { + return xxx_messageInfo_PropertyValue.Size(m) +} +func (m *PropertyValue) XXX_DiscardUnknown() { + xxx_messageInfo_PropertyValue.DiscardUnknown(m) +} + +var xxx_messageInfo_PropertyValue proto.InternalMessageInfo + +func (m *PropertyValue) GetInt64Value() int64 { + if m != nil && m.Int64Value != nil { + return *m.Int64Value + } + return 0 +} + +func (m *PropertyValue) GetBooleanValue() bool { + if m != nil && m.BooleanValue != nil { + return *m.BooleanValue + } + return false +} + +func (m *PropertyValue) GetStringValue() string { + if m != nil && m.StringValue != nil { + return *m.StringValue + } + return "" +} + +func (m *PropertyValue) GetDoubleValue() float64 { + if m != nil && m.DoubleValue != nil { + return *m.DoubleValue + } + return 0 +} + +func (m *PropertyValue) GetPointvalue() *PropertyValue_PointValue { + if m != nil { + return m.Pointvalue + } + return nil +} + +func (m *PropertyValue) GetUservalue() *PropertyValue_UserValue { + if m != nil { + return m.Uservalue + } + return nil +} + +func (m *PropertyValue) GetReferencevalue() *PropertyValue_ReferenceValue { + if m != nil { + return m.Referencevalue + } + return nil +} + +type PropertyValue_PointValue struct { + X *float64 `protobuf:"fixed64,6,req,name=x" json:"x,omitempty"` + Y *float64 `protobuf:"fixed64,7,req,name=y" json:"y,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PropertyValue_PointValue) Reset() { *m = PropertyValue_PointValue{} } +func (m *PropertyValue_PointValue) String() string { return proto.CompactTextString(m) } +func (*PropertyValue_PointValue) ProtoMessage() {} +func (*PropertyValue_PointValue) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1, 0} +} +func (m *PropertyValue_PointValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PropertyValue_PointValue.Unmarshal(m, b) +} +func (m *PropertyValue_PointValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PropertyValue_PointValue.Marshal(b, m, deterministic) +} +func (dst *PropertyValue_PointValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_PropertyValue_PointValue.Merge(dst, src) +} +func (m *PropertyValue_PointValue) XXX_Size() int { + return xxx_messageInfo_PropertyValue_PointValue.Size(m) +} +func (m *PropertyValue_PointValue) XXX_DiscardUnknown() { + xxx_messageInfo_PropertyValue_PointValue.DiscardUnknown(m) +} + +var xxx_messageInfo_PropertyValue_PointValue proto.InternalMessageInfo + +func (m *PropertyValue_PointValue) GetX() float64 { + if m != nil && m.X != nil { + return *m.X + } + return 0 +} + +func (m *PropertyValue_PointValue) GetY() float64 { + if m != nil && m.Y != nil { + return *m.Y + } + return 0 +} + +type PropertyValue_UserValue struct { + Email *string `protobuf:"bytes,9,req,name=email" json:"email,omitempty"` + AuthDomain *string `protobuf:"bytes,10,req,name=auth_domain,json=authDomain" json:"auth_domain,omitempty"` + Nickname *string `protobuf:"bytes,11,opt,name=nickname" json:"nickname,omitempty"` + FederatedIdentity *string `protobuf:"bytes,21,opt,name=federated_identity,json=federatedIdentity" json:"federated_identity,omitempty"` + FederatedProvider *string `protobuf:"bytes,22,opt,name=federated_provider,json=federatedProvider" json:"federated_provider,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PropertyValue_UserValue) Reset() { *m = PropertyValue_UserValue{} } +func (m *PropertyValue_UserValue) String() string { return proto.CompactTextString(m) } +func (*PropertyValue_UserValue) ProtoMessage() {} +func (*PropertyValue_UserValue) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1, 1} +} +func (m *PropertyValue_UserValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PropertyValue_UserValue.Unmarshal(m, b) +} +func (m *PropertyValue_UserValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PropertyValue_UserValue.Marshal(b, m, deterministic) +} +func (dst *PropertyValue_UserValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_PropertyValue_UserValue.Merge(dst, src) +} +func (m *PropertyValue_UserValue) XXX_Size() int { + return xxx_messageInfo_PropertyValue_UserValue.Size(m) +} +func (m *PropertyValue_UserValue) XXX_DiscardUnknown() { + xxx_messageInfo_PropertyValue_UserValue.DiscardUnknown(m) +} + +var xxx_messageInfo_PropertyValue_UserValue proto.InternalMessageInfo + +func (m *PropertyValue_UserValue) GetEmail() string { + if m != nil && m.Email != nil { + return *m.Email + } + return "" +} + +func (m *PropertyValue_UserValue) GetAuthDomain() string { + if m != nil && m.AuthDomain != nil { + return *m.AuthDomain + } + return "" +} + +func (m *PropertyValue_UserValue) GetNickname() string { + if m != nil && m.Nickname != nil { + return *m.Nickname + } + return "" +} + +func (m *PropertyValue_UserValue) GetFederatedIdentity() string { + if m != nil && m.FederatedIdentity != nil { + return *m.FederatedIdentity + } + return "" +} + +func (m *PropertyValue_UserValue) GetFederatedProvider() string { + if m != nil && m.FederatedProvider != nil { + return *m.FederatedProvider + } + return "" +} + +type PropertyValue_ReferenceValue struct { + App *string `protobuf:"bytes,13,req,name=app" json:"app,omitempty"` + NameSpace *string `protobuf:"bytes,20,opt,name=name_space,json=nameSpace" json:"name_space,omitempty"` + Pathelement []*PropertyValue_ReferenceValue_PathElement `protobuf:"group,14,rep,name=PathElement,json=pathelement" json:"pathelement,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PropertyValue_ReferenceValue) Reset() { *m = PropertyValue_ReferenceValue{} } +func (m *PropertyValue_ReferenceValue) String() string { return proto.CompactTextString(m) } +func (*PropertyValue_ReferenceValue) ProtoMessage() {} +func (*PropertyValue_ReferenceValue) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1, 2} +} +func (m *PropertyValue_ReferenceValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PropertyValue_ReferenceValue.Unmarshal(m, b) +} +func (m *PropertyValue_ReferenceValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PropertyValue_ReferenceValue.Marshal(b, m, deterministic) +} +func (dst *PropertyValue_ReferenceValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_PropertyValue_ReferenceValue.Merge(dst, src) +} +func (m *PropertyValue_ReferenceValue) XXX_Size() int { + return xxx_messageInfo_PropertyValue_ReferenceValue.Size(m) +} +func (m *PropertyValue_ReferenceValue) XXX_DiscardUnknown() { + xxx_messageInfo_PropertyValue_ReferenceValue.DiscardUnknown(m) +} + +var xxx_messageInfo_PropertyValue_ReferenceValue proto.InternalMessageInfo + +func (m *PropertyValue_ReferenceValue) GetApp() string { + if m != nil && m.App != nil { + return *m.App + } + return "" +} + +func (m *PropertyValue_ReferenceValue) GetNameSpace() string { + if m != nil && m.NameSpace != nil { + return *m.NameSpace + } + return "" +} + +func (m *PropertyValue_ReferenceValue) GetPathelement() []*PropertyValue_ReferenceValue_PathElement { + if m != nil { + return m.Pathelement + } + return nil +} + +type PropertyValue_ReferenceValue_PathElement struct { + Type *string `protobuf:"bytes,15,req,name=type" json:"type,omitempty"` + Id *int64 `protobuf:"varint,16,opt,name=id" json:"id,omitempty"` + Name *string `protobuf:"bytes,17,opt,name=name" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PropertyValue_ReferenceValue_PathElement) Reset() { + *m = PropertyValue_ReferenceValue_PathElement{} +} +func (m *PropertyValue_ReferenceValue_PathElement) String() string { return proto.CompactTextString(m) } +func (*PropertyValue_ReferenceValue_PathElement) ProtoMessage() {} +func (*PropertyValue_ReferenceValue_PathElement) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{1, 2, 0} +} +func (m *PropertyValue_ReferenceValue_PathElement) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.Unmarshal(m, b) +} +func (m *PropertyValue_ReferenceValue_PathElement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.Marshal(b, m, deterministic) +} +func (dst *PropertyValue_ReferenceValue_PathElement) XXX_Merge(src proto.Message) { + xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.Merge(dst, src) +} +func (m *PropertyValue_ReferenceValue_PathElement) XXX_Size() int { + return xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.Size(m) +} +func (m *PropertyValue_ReferenceValue_PathElement) XXX_DiscardUnknown() { + xxx_messageInfo_PropertyValue_ReferenceValue_PathElement.DiscardUnknown(m) +} + +var xxx_messageInfo_PropertyValue_ReferenceValue_PathElement proto.InternalMessageInfo + +func (m *PropertyValue_ReferenceValue_PathElement) GetType() string { + if m != nil && m.Type != nil { + return *m.Type + } + return "" +} + +func (m *PropertyValue_ReferenceValue_PathElement) GetId() int64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +func (m *PropertyValue_ReferenceValue_PathElement) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +type Property struct { + Meaning *Property_Meaning `protobuf:"varint,1,opt,name=meaning,enum=appengine.Property_Meaning,def=0" json:"meaning,omitempty"` + MeaningUri *string `protobuf:"bytes,2,opt,name=meaning_uri,json=meaningUri" json:"meaning_uri,omitempty"` + Name *string `protobuf:"bytes,3,req,name=name" json:"name,omitempty"` + Value *PropertyValue `protobuf:"bytes,5,req,name=value" json:"value,omitempty"` + Multiple *bool `protobuf:"varint,4,req,name=multiple" json:"multiple,omitempty"` + Searchable *bool `protobuf:"varint,6,opt,name=searchable,def=0" json:"searchable,omitempty"` + FtsTokenizationOption *Property_FtsTokenizationOption `protobuf:"varint,8,opt,name=fts_tokenization_option,json=ftsTokenizationOption,enum=appengine.Property_FtsTokenizationOption" json:"fts_tokenization_option,omitempty"` + Locale *string `protobuf:"bytes,9,opt,name=locale,def=en" json:"locale,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Property) Reset() { *m = Property{} } +func (m *Property) String() string { return proto.CompactTextString(m) } +func (*Property) ProtoMessage() {} +func (*Property) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{2} +} +func (m *Property) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Property.Unmarshal(m, b) +} +func (m *Property) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Property.Marshal(b, m, deterministic) +} +func (dst *Property) XXX_Merge(src proto.Message) { + xxx_messageInfo_Property.Merge(dst, src) +} +func (m *Property) XXX_Size() int { + return xxx_messageInfo_Property.Size(m) +} +func (m *Property) XXX_DiscardUnknown() { + xxx_messageInfo_Property.DiscardUnknown(m) +} + +var xxx_messageInfo_Property proto.InternalMessageInfo + +const Default_Property_Meaning Property_Meaning = Property_NO_MEANING +const Default_Property_Searchable bool = false +const Default_Property_Locale string = "en" + +func (m *Property) GetMeaning() Property_Meaning { + if m != nil && m.Meaning != nil { + return *m.Meaning + } + return Default_Property_Meaning +} + +func (m *Property) GetMeaningUri() string { + if m != nil && m.MeaningUri != nil { + return *m.MeaningUri + } + return "" +} + +func (m *Property) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *Property) GetValue() *PropertyValue { + if m != nil { + return m.Value + } + return nil +} + +func (m *Property) GetMultiple() bool { + if m != nil && m.Multiple != nil { + return *m.Multiple + } + return false +} + +func (m *Property) GetSearchable() bool { + if m != nil && m.Searchable != nil { + return *m.Searchable + } + return Default_Property_Searchable +} + +func (m *Property) GetFtsTokenizationOption() Property_FtsTokenizationOption { + if m != nil && m.FtsTokenizationOption != nil { + return *m.FtsTokenizationOption + } + return Property_HTML +} + +func (m *Property) GetLocale() string { + if m != nil && m.Locale != nil { + return *m.Locale + } + return Default_Property_Locale +} + +type Path struct { + Element []*Path_Element `protobuf:"group,1,rep,name=Element,json=element" json:"element,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Path) Reset() { *m = Path{} } +func (m *Path) String() string { return proto.CompactTextString(m) } +func (*Path) ProtoMessage() {} +func (*Path) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{3} +} +func (m *Path) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Path.Unmarshal(m, b) +} +func (m *Path) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Path.Marshal(b, m, deterministic) +} +func (dst *Path) XXX_Merge(src proto.Message) { + xxx_messageInfo_Path.Merge(dst, src) +} +func (m *Path) XXX_Size() int { + return xxx_messageInfo_Path.Size(m) +} +func (m *Path) XXX_DiscardUnknown() { + xxx_messageInfo_Path.DiscardUnknown(m) +} + +var xxx_messageInfo_Path proto.InternalMessageInfo + +func (m *Path) GetElement() []*Path_Element { + if m != nil { + return m.Element + } + return nil +} + +type Path_Element struct { + Type *string `protobuf:"bytes,2,req,name=type" json:"type,omitempty"` + Id *int64 `protobuf:"varint,3,opt,name=id" json:"id,omitempty"` + Name *string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Path_Element) Reset() { *m = Path_Element{} } +func (m *Path_Element) String() string { return proto.CompactTextString(m) } +func (*Path_Element) ProtoMessage() {} +func (*Path_Element) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{3, 0} +} +func (m *Path_Element) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Path_Element.Unmarshal(m, b) +} +func (m *Path_Element) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Path_Element.Marshal(b, m, deterministic) +} +func (dst *Path_Element) XXX_Merge(src proto.Message) { + xxx_messageInfo_Path_Element.Merge(dst, src) +} +func (m *Path_Element) XXX_Size() int { + return xxx_messageInfo_Path_Element.Size(m) +} +func (m *Path_Element) XXX_DiscardUnknown() { + xxx_messageInfo_Path_Element.DiscardUnknown(m) +} + +var xxx_messageInfo_Path_Element proto.InternalMessageInfo + +func (m *Path_Element) GetType() string { + if m != nil && m.Type != nil { + return *m.Type + } + return "" +} + +func (m *Path_Element) GetId() int64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +func (m *Path_Element) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +type Reference struct { + App *string `protobuf:"bytes,13,req,name=app" json:"app,omitempty"` + NameSpace *string `protobuf:"bytes,20,opt,name=name_space,json=nameSpace" json:"name_space,omitempty"` + Path *Path `protobuf:"bytes,14,req,name=path" json:"path,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Reference) Reset() { *m = Reference{} } +func (m *Reference) String() string { return proto.CompactTextString(m) } +func (*Reference) ProtoMessage() {} +func (*Reference) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{4} +} +func (m *Reference) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Reference.Unmarshal(m, b) +} +func (m *Reference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Reference.Marshal(b, m, deterministic) +} +func (dst *Reference) XXX_Merge(src proto.Message) { + xxx_messageInfo_Reference.Merge(dst, src) +} +func (m *Reference) XXX_Size() int { + return xxx_messageInfo_Reference.Size(m) +} +func (m *Reference) XXX_DiscardUnknown() { + xxx_messageInfo_Reference.DiscardUnknown(m) +} + +var xxx_messageInfo_Reference proto.InternalMessageInfo + +func (m *Reference) GetApp() string { + if m != nil && m.App != nil { + return *m.App + } + return "" +} + +func (m *Reference) GetNameSpace() string { + if m != nil && m.NameSpace != nil { + return *m.NameSpace + } + return "" +} + +func (m *Reference) GetPath() *Path { + if m != nil { + return m.Path + } + return nil +} + +type User struct { + Email *string `protobuf:"bytes,1,req,name=email" json:"email,omitempty"` + AuthDomain *string `protobuf:"bytes,2,req,name=auth_domain,json=authDomain" json:"auth_domain,omitempty"` + Nickname *string `protobuf:"bytes,3,opt,name=nickname" json:"nickname,omitempty"` + FederatedIdentity *string `protobuf:"bytes,6,opt,name=federated_identity,json=federatedIdentity" json:"federated_identity,omitempty"` + FederatedProvider *string `protobuf:"bytes,7,opt,name=federated_provider,json=federatedProvider" json:"federated_provider,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *User) Reset() { *m = User{} } +func (m *User) String() string { return proto.CompactTextString(m) } +func (*User) ProtoMessage() {} +func (*User) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{5} +} +func (m *User) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_User.Unmarshal(m, b) +} +func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_User.Marshal(b, m, deterministic) +} +func (dst *User) XXX_Merge(src proto.Message) { + xxx_messageInfo_User.Merge(dst, src) +} +func (m *User) XXX_Size() int { + return xxx_messageInfo_User.Size(m) +} +func (m *User) XXX_DiscardUnknown() { + xxx_messageInfo_User.DiscardUnknown(m) +} + +var xxx_messageInfo_User proto.InternalMessageInfo + +func (m *User) GetEmail() string { + if m != nil && m.Email != nil { + return *m.Email + } + return "" +} + +func (m *User) GetAuthDomain() string { + if m != nil && m.AuthDomain != nil { + return *m.AuthDomain + } + return "" +} + +func (m *User) GetNickname() string { + if m != nil && m.Nickname != nil { + return *m.Nickname + } + return "" +} + +func (m *User) GetFederatedIdentity() string { + if m != nil && m.FederatedIdentity != nil { + return *m.FederatedIdentity + } + return "" +} + +func (m *User) GetFederatedProvider() string { + if m != nil && m.FederatedProvider != nil { + return *m.FederatedProvider + } + return "" +} + +type EntityProto struct { + Key *Reference `protobuf:"bytes,13,req,name=key" json:"key,omitempty"` + EntityGroup *Path `protobuf:"bytes,16,req,name=entity_group,json=entityGroup" json:"entity_group,omitempty"` + Owner *User `protobuf:"bytes,17,opt,name=owner" json:"owner,omitempty"` + Kind *EntityProto_Kind `protobuf:"varint,4,opt,name=kind,enum=appengine.EntityProto_Kind" json:"kind,omitempty"` + KindUri *string `protobuf:"bytes,5,opt,name=kind_uri,json=kindUri" json:"kind_uri,omitempty"` + Property []*Property `protobuf:"bytes,14,rep,name=property" json:"property,omitempty"` + RawProperty []*Property `protobuf:"bytes,15,rep,name=raw_property,json=rawProperty" json:"raw_property,omitempty"` + Rank *int32 `protobuf:"varint,18,opt,name=rank" json:"rank,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EntityProto) Reset() { *m = EntityProto{} } +func (m *EntityProto) String() string { return proto.CompactTextString(m) } +func (*EntityProto) ProtoMessage() {} +func (*EntityProto) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{6} +} +func (m *EntityProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EntityProto.Unmarshal(m, b) +} +func (m *EntityProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EntityProto.Marshal(b, m, deterministic) +} +func (dst *EntityProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EntityProto.Merge(dst, src) +} +func (m *EntityProto) XXX_Size() int { + return xxx_messageInfo_EntityProto.Size(m) +} +func (m *EntityProto) XXX_DiscardUnknown() { + xxx_messageInfo_EntityProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EntityProto proto.InternalMessageInfo + +func (m *EntityProto) GetKey() *Reference { + if m != nil { + return m.Key + } + return nil +} + +func (m *EntityProto) GetEntityGroup() *Path { + if m != nil { + return m.EntityGroup + } + return nil +} + +func (m *EntityProto) GetOwner() *User { + if m != nil { + return m.Owner + } + return nil +} + +func (m *EntityProto) GetKind() EntityProto_Kind { + if m != nil && m.Kind != nil { + return *m.Kind + } + return EntityProto_GD_CONTACT +} + +func (m *EntityProto) GetKindUri() string { + if m != nil && m.KindUri != nil { + return *m.KindUri + } + return "" +} + +func (m *EntityProto) GetProperty() []*Property { + if m != nil { + return m.Property + } + return nil +} + +func (m *EntityProto) GetRawProperty() []*Property { + if m != nil { + return m.RawProperty + } + return nil +} + +func (m *EntityProto) GetRank() int32 { + if m != nil && m.Rank != nil { + return *m.Rank + } + return 0 +} + +type CompositeProperty struct { + IndexId *int64 `protobuf:"varint,1,req,name=index_id,json=indexId" json:"index_id,omitempty"` + Value []string `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompositeProperty) Reset() { *m = CompositeProperty{} } +func (m *CompositeProperty) String() string { return proto.CompactTextString(m) } +func (*CompositeProperty) ProtoMessage() {} +func (*CompositeProperty) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{7} +} +func (m *CompositeProperty) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompositeProperty.Unmarshal(m, b) +} +func (m *CompositeProperty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompositeProperty.Marshal(b, m, deterministic) +} +func (dst *CompositeProperty) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompositeProperty.Merge(dst, src) +} +func (m *CompositeProperty) XXX_Size() int { + return xxx_messageInfo_CompositeProperty.Size(m) +} +func (m *CompositeProperty) XXX_DiscardUnknown() { + xxx_messageInfo_CompositeProperty.DiscardUnknown(m) +} + +var xxx_messageInfo_CompositeProperty proto.InternalMessageInfo + +func (m *CompositeProperty) GetIndexId() int64 { + if m != nil && m.IndexId != nil { + return *m.IndexId + } + return 0 +} + +func (m *CompositeProperty) GetValue() []string { + if m != nil { + return m.Value + } + return nil +} + +type Index struct { + EntityType *string `protobuf:"bytes,1,req,name=entity_type,json=entityType" json:"entity_type,omitempty"` + Ancestor *bool `protobuf:"varint,5,req,name=ancestor" json:"ancestor,omitempty"` + Property []*Index_Property `protobuf:"group,2,rep,name=Property,json=property" json:"property,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Index) Reset() { *m = Index{} } +func (m *Index) String() string { return proto.CompactTextString(m) } +func (*Index) ProtoMessage() {} +func (*Index) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{8} +} +func (m *Index) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Index.Unmarshal(m, b) +} +func (m *Index) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Index.Marshal(b, m, deterministic) +} +func (dst *Index) XXX_Merge(src proto.Message) { + xxx_messageInfo_Index.Merge(dst, src) +} +func (m *Index) XXX_Size() int { + return xxx_messageInfo_Index.Size(m) +} +func (m *Index) XXX_DiscardUnknown() { + xxx_messageInfo_Index.DiscardUnknown(m) +} + +var xxx_messageInfo_Index proto.InternalMessageInfo + +func (m *Index) GetEntityType() string { + if m != nil && m.EntityType != nil { + return *m.EntityType + } + return "" +} + +func (m *Index) GetAncestor() bool { + if m != nil && m.Ancestor != nil { + return *m.Ancestor + } + return false +} + +func (m *Index) GetProperty() []*Index_Property { + if m != nil { + return m.Property + } + return nil +} + +type Index_Property struct { + Name *string `protobuf:"bytes,3,req,name=name" json:"name,omitempty"` + Direction *Index_Property_Direction `protobuf:"varint,4,opt,name=direction,enum=appengine.Index_Property_Direction,def=1" json:"direction,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Index_Property) Reset() { *m = Index_Property{} } +func (m *Index_Property) String() string { return proto.CompactTextString(m) } +func (*Index_Property) ProtoMessage() {} +func (*Index_Property) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{8, 0} +} +func (m *Index_Property) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Index_Property.Unmarshal(m, b) +} +func (m *Index_Property) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Index_Property.Marshal(b, m, deterministic) +} +func (dst *Index_Property) XXX_Merge(src proto.Message) { + xxx_messageInfo_Index_Property.Merge(dst, src) +} +func (m *Index_Property) XXX_Size() int { + return xxx_messageInfo_Index_Property.Size(m) +} +func (m *Index_Property) XXX_DiscardUnknown() { + xxx_messageInfo_Index_Property.DiscardUnknown(m) +} + +var xxx_messageInfo_Index_Property proto.InternalMessageInfo + +const Default_Index_Property_Direction Index_Property_Direction = Index_Property_ASCENDING + +func (m *Index_Property) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *Index_Property) GetDirection() Index_Property_Direction { + if m != nil && m.Direction != nil { + return *m.Direction + } + return Default_Index_Property_Direction +} + +type CompositeIndex struct { + AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` + Id *int64 `protobuf:"varint,2,req,name=id" json:"id,omitempty"` + Definition *Index `protobuf:"bytes,3,req,name=definition" json:"definition,omitempty"` + State *CompositeIndex_State `protobuf:"varint,4,req,name=state,enum=appengine.CompositeIndex_State" json:"state,omitempty"` + OnlyUseIfRequired *bool `protobuf:"varint,6,opt,name=only_use_if_required,json=onlyUseIfRequired,def=0" json:"only_use_if_required,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompositeIndex) Reset() { *m = CompositeIndex{} } +func (m *CompositeIndex) String() string { return proto.CompactTextString(m) } +func (*CompositeIndex) ProtoMessage() {} +func (*CompositeIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{9} +} +func (m *CompositeIndex) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompositeIndex.Unmarshal(m, b) +} +func (m *CompositeIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompositeIndex.Marshal(b, m, deterministic) +} +func (dst *CompositeIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompositeIndex.Merge(dst, src) +} +func (m *CompositeIndex) XXX_Size() int { + return xxx_messageInfo_CompositeIndex.Size(m) +} +func (m *CompositeIndex) XXX_DiscardUnknown() { + xxx_messageInfo_CompositeIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_CompositeIndex proto.InternalMessageInfo + +const Default_CompositeIndex_OnlyUseIfRequired bool = false + +func (m *CompositeIndex) GetAppId() string { + if m != nil && m.AppId != nil { + return *m.AppId + } + return "" +} + +func (m *CompositeIndex) GetId() int64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +func (m *CompositeIndex) GetDefinition() *Index { + if m != nil { + return m.Definition + } + return nil +} + +func (m *CompositeIndex) GetState() CompositeIndex_State { + if m != nil && m.State != nil { + return *m.State + } + return CompositeIndex_WRITE_ONLY +} + +func (m *CompositeIndex) GetOnlyUseIfRequired() bool { + if m != nil && m.OnlyUseIfRequired != nil { + return *m.OnlyUseIfRequired + } + return Default_CompositeIndex_OnlyUseIfRequired +} + +type IndexPostfix struct { + IndexValue []*IndexPostfix_IndexValue `protobuf:"bytes,1,rep,name=index_value,json=indexValue" json:"index_value,omitempty"` + Key *Reference `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` + Before *bool `protobuf:"varint,3,opt,name=before,def=1" json:"before,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexPostfix) Reset() { *m = IndexPostfix{} } +func (m *IndexPostfix) String() string { return proto.CompactTextString(m) } +func (*IndexPostfix) ProtoMessage() {} +func (*IndexPostfix) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{10} +} +func (m *IndexPostfix) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexPostfix.Unmarshal(m, b) +} +func (m *IndexPostfix) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexPostfix.Marshal(b, m, deterministic) +} +func (dst *IndexPostfix) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexPostfix.Merge(dst, src) +} +func (m *IndexPostfix) XXX_Size() int { + return xxx_messageInfo_IndexPostfix.Size(m) +} +func (m *IndexPostfix) XXX_DiscardUnknown() { + xxx_messageInfo_IndexPostfix.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexPostfix proto.InternalMessageInfo + +const Default_IndexPostfix_Before bool = true + +func (m *IndexPostfix) GetIndexValue() []*IndexPostfix_IndexValue { + if m != nil { + return m.IndexValue + } + return nil +} + +func (m *IndexPostfix) GetKey() *Reference { + if m != nil { + return m.Key + } + return nil +} + +func (m *IndexPostfix) GetBefore() bool { + if m != nil && m.Before != nil { + return *m.Before + } + return Default_IndexPostfix_Before +} + +type IndexPostfix_IndexValue struct { + PropertyName *string `protobuf:"bytes,1,req,name=property_name,json=propertyName" json:"property_name,omitempty"` + Value *PropertyValue `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexPostfix_IndexValue) Reset() { *m = IndexPostfix_IndexValue{} } +func (m *IndexPostfix_IndexValue) String() string { return proto.CompactTextString(m) } +func (*IndexPostfix_IndexValue) ProtoMessage() {} +func (*IndexPostfix_IndexValue) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{10, 0} +} +func (m *IndexPostfix_IndexValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexPostfix_IndexValue.Unmarshal(m, b) +} +func (m *IndexPostfix_IndexValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexPostfix_IndexValue.Marshal(b, m, deterministic) +} +func (dst *IndexPostfix_IndexValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexPostfix_IndexValue.Merge(dst, src) +} +func (m *IndexPostfix_IndexValue) XXX_Size() int { + return xxx_messageInfo_IndexPostfix_IndexValue.Size(m) +} +func (m *IndexPostfix_IndexValue) XXX_DiscardUnknown() { + xxx_messageInfo_IndexPostfix_IndexValue.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexPostfix_IndexValue proto.InternalMessageInfo + +func (m *IndexPostfix_IndexValue) GetPropertyName() string { + if m != nil && m.PropertyName != nil { + return *m.PropertyName + } + return "" +} + +func (m *IndexPostfix_IndexValue) GetValue() *PropertyValue { + if m != nil { + return m.Value + } + return nil +} + +type IndexPosition struct { + Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + Before *bool `protobuf:"varint,2,opt,name=before,def=1" json:"before,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexPosition) Reset() { *m = IndexPosition{} } +func (m *IndexPosition) String() string { return proto.CompactTextString(m) } +func (*IndexPosition) ProtoMessage() {} +func (*IndexPosition) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{11} +} +func (m *IndexPosition) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexPosition.Unmarshal(m, b) +} +func (m *IndexPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexPosition.Marshal(b, m, deterministic) +} +func (dst *IndexPosition) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexPosition.Merge(dst, src) +} +func (m *IndexPosition) XXX_Size() int { + return xxx_messageInfo_IndexPosition.Size(m) +} +func (m *IndexPosition) XXX_DiscardUnknown() { + xxx_messageInfo_IndexPosition.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexPosition proto.InternalMessageInfo + +const Default_IndexPosition_Before bool = true + +func (m *IndexPosition) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *IndexPosition) GetBefore() bool { + if m != nil && m.Before != nil { + return *m.Before + } + return Default_IndexPosition_Before +} + +type Snapshot struct { + Ts *int64 `protobuf:"varint,1,req,name=ts" json:"ts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Snapshot) Reset() { *m = Snapshot{} } +func (m *Snapshot) String() string { return proto.CompactTextString(m) } +func (*Snapshot) ProtoMessage() {} +func (*Snapshot) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{12} +} +func (m *Snapshot) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Snapshot.Unmarshal(m, b) +} +func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Snapshot.Marshal(b, m, deterministic) +} +func (dst *Snapshot) XXX_Merge(src proto.Message) { + xxx_messageInfo_Snapshot.Merge(dst, src) +} +func (m *Snapshot) XXX_Size() int { + return xxx_messageInfo_Snapshot.Size(m) +} +func (m *Snapshot) XXX_DiscardUnknown() { + xxx_messageInfo_Snapshot.DiscardUnknown(m) +} + +var xxx_messageInfo_Snapshot proto.InternalMessageInfo + +func (m *Snapshot) GetTs() int64 { + if m != nil && m.Ts != nil { + return *m.Ts + } + return 0 +} + +type InternalHeader struct { + Qos *string `protobuf:"bytes,1,opt,name=qos" json:"qos,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InternalHeader) Reset() { *m = InternalHeader{} } +func (m *InternalHeader) String() string { return proto.CompactTextString(m) } +func (*InternalHeader) ProtoMessage() {} +func (*InternalHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{13} +} +func (m *InternalHeader) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InternalHeader.Unmarshal(m, b) +} +func (m *InternalHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InternalHeader.Marshal(b, m, deterministic) +} +func (dst *InternalHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_InternalHeader.Merge(dst, src) +} +func (m *InternalHeader) XXX_Size() int { + return xxx_messageInfo_InternalHeader.Size(m) +} +func (m *InternalHeader) XXX_DiscardUnknown() { + xxx_messageInfo_InternalHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_InternalHeader proto.InternalMessageInfo + +func (m *InternalHeader) GetQos() string { + if m != nil && m.Qos != nil { + return *m.Qos + } + return "" +} + +type Transaction struct { + Header *InternalHeader `protobuf:"bytes,4,opt,name=header" json:"header,omitempty"` + Handle *uint64 `protobuf:"fixed64,1,req,name=handle" json:"handle,omitempty"` + App *string `protobuf:"bytes,2,req,name=app" json:"app,omitempty"` + MarkChanges *bool `protobuf:"varint,3,opt,name=mark_changes,json=markChanges,def=0" json:"mark_changes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Transaction) Reset() { *m = Transaction{} } +func (m *Transaction) String() string { return proto.CompactTextString(m) } +func (*Transaction) ProtoMessage() {} +func (*Transaction) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{14} +} +func (m *Transaction) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Transaction.Unmarshal(m, b) +} +func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) +} +func (dst *Transaction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Transaction.Merge(dst, src) +} +func (m *Transaction) XXX_Size() int { + return xxx_messageInfo_Transaction.Size(m) +} +func (m *Transaction) XXX_DiscardUnknown() { + xxx_messageInfo_Transaction.DiscardUnknown(m) +} + +var xxx_messageInfo_Transaction proto.InternalMessageInfo + +const Default_Transaction_MarkChanges bool = false + +func (m *Transaction) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *Transaction) GetHandle() uint64 { + if m != nil && m.Handle != nil { + return *m.Handle + } + return 0 +} + +func (m *Transaction) GetApp() string { + if m != nil && m.App != nil { + return *m.App + } + return "" +} + +func (m *Transaction) GetMarkChanges() bool { + if m != nil && m.MarkChanges != nil { + return *m.MarkChanges + } + return Default_Transaction_MarkChanges +} + +type Query struct { + Header *InternalHeader `protobuf:"bytes,39,opt,name=header" json:"header,omitempty"` + App *string `protobuf:"bytes,1,req,name=app" json:"app,omitempty"` + NameSpace *string `protobuf:"bytes,29,opt,name=name_space,json=nameSpace" json:"name_space,omitempty"` + Kind *string `protobuf:"bytes,3,opt,name=kind" json:"kind,omitempty"` + Ancestor *Reference `protobuf:"bytes,17,opt,name=ancestor" json:"ancestor,omitempty"` + Filter []*Query_Filter `protobuf:"group,4,rep,name=Filter,json=filter" json:"filter,omitempty"` + SearchQuery *string `protobuf:"bytes,8,opt,name=search_query,json=searchQuery" json:"search_query,omitempty"` + Order []*Query_Order `protobuf:"group,9,rep,name=Order,json=order" json:"order,omitempty"` + Hint *Query_Hint `protobuf:"varint,18,opt,name=hint,enum=appengine.Query_Hint" json:"hint,omitempty"` + Count *int32 `protobuf:"varint,23,opt,name=count" json:"count,omitempty"` + Offset *int32 `protobuf:"varint,12,opt,name=offset,def=0" json:"offset,omitempty"` + Limit *int32 `protobuf:"varint,16,opt,name=limit" json:"limit,omitempty"` + CompiledCursor *CompiledCursor `protobuf:"bytes,30,opt,name=compiled_cursor,json=compiledCursor" json:"compiled_cursor,omitempty"` + EndCompiledCursor *CompiledCursor `protobuf:"bytes,31,opt,name=end_compiled_cursor,json=endCompiledCursor" json:"end_compiled_cursor,omitempty"` + CompositeIndex []*CompositeIndex `protobuf:"bytes,19,rep,name=composite_index,json=compositeIndex" json:"composite_index,omitempty"` + RequirePerfectPlan *bool `protobuf:"varint,20,opt,name=require_perfect_plan,json=requirePerfectPlan,def=0" json:"require_perfect_plan,omitempty"` + KeysOnly *bool `protobuf:"varint,21,opt,name=keys_only,json=keysOnly,def=0" json:"keys_only,omitempty"` + Transaction *Transaction `protobuf:"bytes,22,opt,name=transaction" json:"transaction,omitempty"` + Compile *bool `protobuf:"varint,25,opt,name=compile,def=0" json:"compile,omitempty"` + FailoverMs *int64 `protobuf:"varint,26,opt,name=failover_ms,json=failoverMs" json:"failover_ms,omitempty"` + Strong *bool `protobuf:"varint,32,opt,name=strong" json:"strong,omitempty"` + PropertyName []string `protobuf:"bytes,33,rep,name=property_name,json=propertyName" json:"property_name,omitempty"` + GroupByPropertyName []string `protobuf:"bytes,34,rep,name=group_by_property_name,json=groupByPropertyName" json:"group_by_property_name,omitempty"` + Distinct *bool `protobuf:"varint,24,opt,name=distinct" json:"distinct,omitempty"` + MinSafeTimeSeconds *int64 `protobuf:"varint,35,opt,name=min_safe_time_seconds,json=minSafeTimeSeconds" json:"min_safe_time_seconds,omitempty"` + SafeReplicaName []string `protobuf:"bytes,36,rep,name=safe_replica_name,json=safeReplicaName" json:"safe_replica_name,omitempty"` + PersistOffset *bool `protobuf:"varint,37,opt,name=persist_offset,json=persistOffset,def=0" json:"persist_offset,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Query) Reset() { *m = Query{} } +func (m *Query) String() string { return proto.CompactTextString(m) } +func (*Query) ProtoMessage() {} +func (*Query) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15} +} +func (m *Query) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Query.Unmarshal(m, b) +} +func (m *Query) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Query.Marshal(b, m, deterministic) +} +func (dst *Query) XXX_Merge(src proto.Message) { + xxx_messageInfo_Query.Merge(dst, src) +} +func (m *Query) XXX_Size() int { + return xxx_messageInfo_Query.Size(m) +} +func (m *Query) XXX_DiscardUnknown() { + xxx_messageInfo_Query.DiscardUnknown(m) +} + +var xxx_messageInfo_Query proto.InternalMessageInfo + +const Default_Query_Offset int32 = 0 +const Default_Query_RequirePerfectPlan bool = false +const Default_Query_KeysOnly bool = false +const Default_Query_Compile bool = false +const Default_Query_PersistOffset bool = false + +func (m *Query) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *Query) GetApp() string { + if m != nil && m.App != nil { + return *m.App + } + return "" +} + +func (m *Query) GetNameSpace() string { + if m != nil && m.NameSpace != nil { + return *m.NameSpace + } + return "" +} + +func (m *Query) GetKind() string { + if m != nil && m.Kind != nil { + return *m.Kind + } + return "" +} + +func (m *Query) GetAncestor() *Reference { + if m != nil { + return m.Ancestor + } + return nil +} + +func (m *Query) GetFilter() []*Query_Filter { + if m != nil { + return m.Filter + } + return nil +} + +func (m *Query) GetSearchQuery() string { + if m != nil && m.SearchQuery != nil { + return *m.SearchQuery + } + return "" +} + +func (m *Query) GetOrder() []*Query_Order { + if m != nil { + return m.Order + } + return nil +} + +func (m *Query) GetHint() Query_Hint { + if m != nil && m.Hint != nil { + return *m.Hint + } + return Query_ORDER_FIRST +} + +func (m *Query) GetCount() int32 { + if m != nil && m.Count != nil { + return *m.Count + } + return 0 +} + +func (m *Query) GetOffset() int32 { + if m != nil && m.Offset != nil { + return *m.Offset + } + return Default_Query_Offset +} + +func (m *Query) GetLimit() int32 { + if m != nil && m.Limit != nil { + return *m.Limit + } + return 0 +} + +func (m *Query) GetCompiledCursor() *CompiledCursor { + if m != nil { + return m.CompiledCursor + } + return nil +} + +func (m *Query) GetEndCompiledCursor() *CompiledCursor { + if m != nil { + return m.EndCompiledCursor + } + return nil +} + +func (m *Query) GetCompositeIndex() []*CompositeIndex { + if m != nil { + return m.CompositeIndex + } + return nil +} + +func (m *Query) GetRequirePerfectPlan() bool { + if m != nil && m.RequirePerfectPlan != nil { + return *m.RequirePerfectPlan + } + return Default_Query_RequirePerfectPlan +} + +func (m *Query) GetKeysOnly() bool { + if m != nil && m.KeysOnly != nil { + return *m.KeysOnly + } + return Default_Query_KeysOnly +} + +func (m *Query) GetTransaction() *Transaction { + if m != nil { + return m.Transaction + } + return nil +} + +func (m *Query) GetCompile() bool { + if m != nil && m.Compile != nil { + return *m.Compile + } + return Default_Query_Compile +} + +func (m *Query) GetFailoverMs() int64 { + if m != nil && m.FailoverMs != nil { + return *m.FailoverMs + } + return 0 +} + +func (m *Query) GetStrong() bool { + if m != nil && m.Strong != nil { + return *m.Strong + } + return false +} + +func (m *Query) GetPropertyName() []string { + if m != nil { + return m.PropertyName + } + return nil +} + +func (m *Query) GetGroupByPropertyName() []string { + if m != nil { + return m.GroupByPropertyName + } + return nil +} + +func (m *Query) GetDistinct() bool { + if m != nil && m.Distinct != nil { + return *m.Distinct + } + return false +} + +func (m *Query) GetMinSafeTimeSeconds() int64 { + if m != nil && m.MinSafeTimeSeconds != nil { + return *m.MinSafeTimeSeconds + } + return 0 +} + +func (m *Query) GetSafeReplicaName() []string { + if m != nil { + return m.SafeReplicaName + } + return nil +} + +func (m *Query) GetPersistOffset() bool { + if m != nil && m.PersistOffset != nil { + return *m.PersistOffset + } + return Default_Query_PersistOffset +} + +type Query_Filter struct { + Op *Query_Filter_Operator `protobuf:"varint,6,req,name=op,enum=appengine.Query_Filter_Operator" json:"op,omitempty"` + Property []*Property `protobuf:"bytes,14,rep,name=property" json:"property,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Query_Filter) Reset() { *m = Query_Filter{} } +func (m *Query_Filter) String() string { return proto.CompactTextString(m) } +func (*Query_Filter) ProtoMessage() {} +func (*Query_Filter) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 0} +} +func (m *Query_Filter) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Query_Filter.Unmarshal(m, b) +} +func (m *Query_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Query_Filter.Marshal(b, m, deterministic) +} +func (dst *Query_Filter) XXX_Merge(src proto.Message) { + xxx_messageInfo_Query_Filter.Merge(dst, src) +} +func (m *Query_Filter) XXX_Size() int { + return xxx_messageInfo_Query_Filter.Size(m) +} +func (m *Query_Filter) XXX_DiscardUnknown() { + xxx_messageInfo_Query_Filter.DiscardUnknown(m) +} + +var xxx_messageInfo_Query_Filter proto.InternalMessageInfo + +func (m *Query_Filter) GetOp() Query_Filter_Operator { + if m != nil && m.Op != nil { + return *m.Op + } + return Query_Filter_LESS_THAN +} + +func (m *Query_Filter) GetProperty() []*Property { + if m != nil { + return m.Property + } + return nil +} + +type Query_Order struct { + Property *string `protobuf:"bytes,10,req,name=property" json:"property,omitempty"` + Direction *Query_Order_Direction `protobuf:"varint,11,opt,name=direction,enum=appengine.Query_Order_Direction,def=1" json:"direction,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Query_Order) Reset() { *m = Query_Order{} } +func (m *Query_Order) String() string { return proto.CompactTextString(m) } +func (*Query_Order) ProtoMessage() {} +func (*Query_Order) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{15, 1} +} +func (m *Query_Order) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Query_Order.Unmarshal(m, b) +} +func (m *Query_Order) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Query_Order.Marshal(b, m, deterministic) +} +func (dst *Query_Order) XXX_Merge(src proto.Message) { + xxx_messageInfo_Query_Order.Merge(dst, src) +} +func (m *Query_Order) XXX_Size() int { + return xxx_messageInfo_Query_Order.Size(m) +} +func (m *Query_Order) XXX_DiscardUnknown() { + xxx_messageInfo_Query_Order.DiscardUnknown(m) +} + +var xxx_messageInfo_Query_Order proto.InternalMessageInfo + +const Default_Query_Order_Direction Query_Order_Direction = Query_Order_ASCENDING + +func (m *Query_Order) GetProperty() string { + if m != nil && m.Property != nil { + return *m.Property + } + return "" +} + +func (m *Query_Order) GetDirection() Query_Order_Direction { + if m != nil && m.Direction != nil { + return *m.Direction + } + return Default_Query_Order_Direction +} + +type CompiledQuery struct { + Primaryscan *CompiledQuery_PrimaryScan `protobuf:"group,1,req,name=PrimaryScan,json=primaryscan" json:"primaryscan,omitempty"` + Mergejoinscan []*CompiledQuery_MergeJoinScan `protobuf:"group,7,rep,name=MergeJoinScan,json=mergejoinscan" json:"mergejoinscan,omitempty"` + IndexDef *Index `protobuf:"bytes,21,opt,name=index_def,json=indexDef" json:"index_def,omitempty"` + Offset *int32 `protobuf:"varint,10,opt,name=offset,def=0" json:"offset,omitempty"` + Limit *int32 `protobuf:"varint,11,opt,name=limit" json:"limit,omitempty"` + KeysOnly *bool `protobuf:"varint,12,req,name=keys_only,json=keysOnly" json:"keys_only,omitempty"` + PropertyName []string `protobuf:"bytes,24,rep,name=property_name,json=propertyName" json:"property_name,omitempty"` + DistinctInfixSize *int32 `protobuf:"varint,25,opt,name=distinct_infix_size,json=distinctInfixSize" json:"distinct_infix_size,omitempty"` + Entityfilter *CompiledQuery_EntityFilter `protobuf:"group,13,opt,name=EntityFilter,json=entityfilter" json:"entityfilter,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompiledQuery) Reset() { *m = CompiledQuery{} } +func (m *CompiledQuery) String() string { return proto.CompactTextString(m) } +func (*CompiledQuery) ProtoMessage() {} +func (*CompiledQuery) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{16} +} +func (m *CompiledQuery) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompiledQuery.Unmarshal(m, b) +} +func (m *CompiledQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompiledQuery.Marshal(b, m, deterministic) +} +func (dst *CompiledQuery) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompiledQuery.Merge(dst, src) +} +func (m *CompiledQuery) XXX_Size() int { + return xxx_messageInfo_CompiledQuery.Size(m) +} +func (m *CompiledQuery) XXX_DiscardUnknown() { + xxx_messageInfo_CompiledQuery.DiscardUnknown(m) +} + +var xxx_messageInfo_CompiledQuery proto.InternalMessageInfo + +const Default_CompiledQuery_Offset int32 = 0 + +func (m *CompiledQuery) GetPrimaryscan() *CompiledQuery_PrimaryScan { + if m != nil { + return m.Primaryscan + } + return nil +} + +func (m *CompiledQuery) GetMergejoinscan() []*CompiledQuery_MergeJoinScan { + if m != nil { + return m.Mergejoinscan + } + return nil +} + +func (m *CompiledQuery) GetIndexDef() *Index { + if m != nil { + return m.IndexDef + } + return nil +} + +func (m *CompiledQuery) GetOffset() int32 { + if m != nil && m.Offset != nil { + return *m.Offset + } + return Default_CompiledQuery_Offset +} + +func (m *CompiledQuery) GetLimit() int32 { + if m != nil && m.Limit != nil { + return *m.Limit + } + return 0 +} + +func (m *CompiledQuery) GetKeysOnly() bool { + if m != nil && m.KeysOnly != nil { + return *m.KeysOnly + } + return false +} + +func (m *CompiledQuery) GetPropertyName() []string { + if m != nil { + return m.PropertyName + } + return nil +} + +func (m *CompiledQuery) GetDistinctInfixSize() int32 { + if m != nil && m.DistinctInfixSize != nil { + return *m.DistinctInfixSize + } + return 0 +} + +func (m *CompiledQuery) GetEntityfilter() *CompiledQuery_EntityFilter { + if m != nil { + return m.Entityfilter + } + return nil +} + +type CompiledQuery_PrimaryScan struct { + IndexName *string `protobuf:"bytes,2,opt,name=index_name,json=indexName" json:"index_name,omitempty"` + StartKey *string `protobuf:"bytes,3,opt,name=start_key,json=startKey" json:"start_key,omitempty"` + StartInclusive *bool `protobuf:"varint,4,opt,name=start_inclusive,json=startInclusive" json:"start_inclusive,omitempty"` + EndKey *string `protobuf:"bytes,5,opt,name=end_key,json=endKey" json:"end_key,omitempty"` + EndInclusive *bool `protobuf:"varint,6,opt,name=end_inclusive,json=endInclusive" json:"end_inclusive,omitempty"` + StartPostfixValue []string `protobuf:"bytes,22,rep,name=start_postfix_value,json=startPostfixValue" json:"start_postfix_value,omitempty"` + EndPostfixValue []string `protobuf:"bytes,23,rep,name=end_postfix_value,json=endPostfixValue" json:"end_postfix_value,omitempty"` + EndUnappliedLogTimestampUs *int64 `protobuf:"varint,19,opt,name=end_unapplied_log_timestamp_us,json=endUnappliedLogTimestampUs" json:"end_unapplied_log_timestamp_us,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompiledQuery_PrimaryScan) Reset() { *m = CompiledQuery_PrimaryScan{} } +func (m *CompiledQuery_PrimaryScan) String() string { return proto.CompactTextString(m) } +func (*CompiledQuery_PrimaryScan) ProtoMessage() {} +func (*CompiledQuery_PrimaryScan) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{16, 0} +} +func (m *CompiledQuery_PrimaryScan) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompiledQuery_PrimaryScan.Unmarshal(m, b) +} +func (m *CompiledQuery_PrimaryScan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompiledQuery_PrimaryScan.Marshal(b, m, deterministic) +} +func (dst *CompiledQuery_PrimaryScan) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompiledQuery_PrimaryScan.Merge(dst, src) +} +func (m *CompiledQuery_PrimaryScan) XXX_Size() int { + return xxx_messageInfo_CompiledQuery_PrimaryScan.Size(m) +} +func (m *CompiledQuery_PrimaryScan) XXX_DiscardUnknown() { + xxx_messageInfo_CompiledQuery_PrimaryScan.DiscardUnknown(m) +} + +var xxx_messageInfo_CompiledQuery_PrimaryScan proto.InternalMessageInfo + +func (m *CompiledQuery_PrimaryScan) GetIndexName() string { + if m != nil && m.IndexName != nil { + return *m.IndexName + } + return "" +} + +func (m *CompiledQuery_PrimaryScan) GetStartKey() string { + if m != nil && m.StartKey != nil { + return *m.StartKey + } + return "" +} + +func (m *CompiledQuery_PrimaryScan) GetStartInclusive() bool { + if m != nil && m.StartInclusive != nil { + return *m.StartInclusive + } + return false +} + +func (m *CompiledQuery_PrimaryScan) GetEndKey() string { + if m != nil && m.EndKey != nil { + return *m.EndKey + } + return "" +} + +func (m *CompiledQuery_PrimaryScan) GetEndInclusive() bool { + if m != nil && m.EndInclusive != nil { + return *m.EndInclusive + } + return false +} + +func (m *CompiledQuery_PrimaryScan) GetStartPostfixValue() []string { + if m != nil { + return m.StartPostfixValue + } + return nil +} + +func (m *CompiledQuery_PrimaryScan) GetEndPostfixValue() []string { + if m != nil { + return m.EndPostfixValue + } + return nil +} + +func (m *CompiledQuery_PrimaryScan) GetEndUnappliedLogTimestampUs() int64 { + if m != nil && m.EndUnappliedLogTimestampUs != nil { + return *m.EndUnappliedLogTimestampUs + } + return 0 +} + +type CompiledQuery_MergeJoinScan struct { + IndexName *string `protobuf:"bytes,8,req,name=index_name,json=indexName" json:"index_name,omitempty"` + PrefixValue []string `protobuf:"bytes,9,rep,name=prefix_value,json=prefixValue" json:"prefix_value,omitempty"` + ValuePrefix *bool `protobuf:"varint,20,opt,name=value_prefix,json=valuePrefix,def=0" json:"value_prefix,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompiledQuery_MergeJoinScan) Reset() { *m = CompiledQuery_MergeJoinScan{} } +func (m *CompiledQuery_MergeJoinScan) String() string { return proto.CompactTextString(m) } +func (*CompiledQuery_MergeJoinScan) ProtoMessage() {} +func (*CompiledQuery_MergeJoinScan) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{16, 1} +} +func (m *CompiledQuery_MergeJoinScan) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompiledQuery_MergeJoinScan.Unmarshal(m, b) +} +func (m *CompiledQuery_MergeJoinScan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompiledQuery_MergeJoinScan.Marshal(b, m, deterministic) +} +func (dst *CompiledQuery_MergeJoinScan) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompiledQuery_MergeJoinScan.Merge(dst, src) +} +func (m *CompiledQuery_MergeJoinScan) XXX_Size() int { + return xxx_messageInfo_CompiledQuery_MergeJoinScan.Size(m) +} +func (m *CompiledQuery_MergeJoinScan) XXX_DiscardUnknown() { + xxx_messageInfo_CompiledQuery_MergeJoinScan.DiscardUnknown(m) +} + +var xxx_messageInfo_CompiledQuery_MergeJoinScan proto.InternalMessageInfo + +const Default_CompiledQuery_MergeJoinScan_ValuePrefix bool = false + +func (m *CompiledQuery_MergeJoinScan) GetIndexName() string { + if m != nil && m.IndexName != nil { + return *m.IndexName + } + return "" +} + +func (m *CompiledQuery_MergeJoinScan) GetPrefixValue() []string { + if m != nil { + return m.PrefixValue + } + return nil +} + +func (m *CompiledQuery_MergeJoinScan) GetValuePrefix() bool { + if m != nil && m.ValuePrefix != nil { + return *m.ValuePrefix + } + return Default_CompiledQuery_MergeJoinScan_ValuePrefix +} + +type CompiledQuery_EntityFilter struct { + Distinct *bool `protobuf:"varint,14,opt,name=distinct,def=0" json:"distinct,omitempty"` + Kind *string `protobuf:"bytes,17,opt,name=kind" json:"kind,omitempty"` + Ancestor *Reference `protobuf:"bytes,18,opt,name=ancestor" json:"ancestor,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompiledQuery_EntityFilter) Reset() { *m = CompiledQuery_EntityFilter{} } +func (m *CompiledQuery_EntityFilter) String() string { return proto.CompactTextString(m) } +func (*CompiledQuery_EntityFilter) ProtoMessage() {} +func (*CompiledQuery_EntityFilter) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{16, 2} +} +func (m *CompiledQuery_EntityFilter) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompiledQuery_EntityFilter.Unmarshal(m, b) +} +func (m *CompiledQuery_EntityFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompiledQuery_EntityFilter.Marshal(b, m, deterministic) +} +func (dst *CompiledQuery_EntityFilter) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompiledQuery_EntityFilter.Merge(dst, src) +} +func (m *CompiledQuery_EntityFilter) XXX_Size() int { + return xxx_messageInfo_CompiledQuery_EntityFilter.Size(m) +} +func (m *CompiledQuery_EntityFilter) XXX_DiscardUnknown() { + xxx_messageInfo_CompiledQuery_EntityFilter.DiscardUnknown(m) +} + +var xxx_messageInfo_CompiledQuery_EntityFilter proto.InternalMessageInfo + +const Default_CompiledQuery_EntityFilter_Distinct bool = false + +func (m *CompiledQuery_EntityFilter) GetDistinct() bool { + if m != nil && m.Distinct != nil { + return *m.Distinct + } + return Default_CompiledQuery_EntityFilter_Distinct +} + +func (m *CompiledQuery_EntityFilter) GetKind() string { + if m != nil && m.Kind != nil { + return *m.Kind + } + return "" +} + +func (m *CompiledQuery_EntityFilter) GetAncestor() *Reference { + if m != nil { + return m.Ancestor + } + return nil +} + +type CompiledCursor struct { + Position *CompiledCursor_Position `protobuf:"group,2,opt,name=Position,json=position" json:"position,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompiledCursor) Reset() { *m = CompiledCursor{} } +func (m *CompiledCursor) String() string { return proto.CompactTextString(m) } +func (*CompiledCursor) ProtoMessage() {} +func (*CompiledCursor) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{17} +} +func (m *CompiledCursor) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompiledCursor.Unmarshal(m, b) +} +func (m *CompiledCursor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompiledCursor.Marshal(b, m, deterministic) +} +func (dst *CompiledCursor) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompiledCursor.Merge(dst, src) +} +func (m *CompiledCursor) XXX_Size() int { + return xxx_messageInfo_CompiledCursor.Size(m) +} +func (m *CompiledCursor) XXX_DiscardUnknown() { + xxx_messageInfo_CompiledCursor.DiscardUnknown(m) +} + +var xxx_messageInfo_CompiledCursor proto.InternalMessageInfo + +func (m *CompiledCursor) GetPosition() *CompiledCursor_Position { + if m != nil { + return m.Position + } + return nil +} + +type CompiledCursor_Position struct { + StartKey *string `protobuf:"bytes,27,opt,name=start_key,json=startKey" json:"start_key,omitempty"` + Indexvalue []*CompiledCursor_Position_IndexValue `protobuf:"group,29,rep,name=IndexValue,json=indexvalue" json:"indexvalue,omitempty"` + Key *Reference `protobuf:"bytes,32,opt,name=key" json:"key,omitempty"` + StartInclusive *bool `protobuf:"varint,28,opt,name=start_inclusive,json=startInclusive,def=1" json:"start_inclusive,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompiledCursor_Position) Reset() { *m = CompiledCursor_Position{} } +func (m *CompiledCursor_Position) String() string { return proto.CompactTextString(m) } +func (*CompiledCursor_Position) ProtoMessage() {} +func (*CompiledCursor_Position) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{17, 0} +} +func (m *CompiledCursor_Position) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompiledCursor_Position.Unmarshal(m, b) +} +func (m *CompiledCursor_Position) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompiledCursor_Position.Marshal(b, m, deterministic) +} +func (dst *CompiledCursor_Position) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompiledCursor_Position.Merge(dst, src) +} +func (m *CompiledCursor_Position) XXX_Size() int { + return xxx_messageInfo_CompiledCursor_Position.Size(m) +} +func (m *CompiledCursor_Position) XXX_DiscardUnknown() { + xxx_messageInfo_CompiledCursor_Position.DiscardUnknown(m) +} + +var xxx_messageInfo_CompiledCursor_Position proto.InternalMessageInfo + +const Default_CompiledCursor_Position_StartInclusive bool = true + +func (m *CompiledCursor_Position) GetStartKey() string { + if m != nil && m.StartKey != nil { + return *m.StartKey + } + return "" +} + +func (m *CompiledCursor_Position) GetIndexvalue() []*CompiledCursor_Position_IndexValue { + if m != nil { + return m.Indexvalue + } + return nil +} + +func (m *CompiledCursor_Position) GetKey() *Reference { + if m != nil { + return m.Key + } + return nil +} + +func (m *CompiledCursor_Position) GetStartInclusive() bool { + if m != nil && m.StartInclusive != nil { + return *m.StartInclusive + } + return Default_CompiledCursor_Position_StartInclusive +} + +type CompiledCursor_Position_IndexValue struct { + Property *string `protobuf:"bytes,30,opt,name=property" json:"property,omitempty"` + Value *PropertyValue `protobuf:"bytes,31,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompiledCursor_Position_IndexValue) Reset() { *m = CompiledCursor_Position_IndexValue{} } +func (m *CompiledCursor_Position_IndexValue) String() string { return proto.CompactTextString(m) } +func (*CompiledCursor_Position_IndexValue) ProtoMessage() {} +func (*CompiledCursor_Position_IndexValue) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{17, 0, 0} +} +func (m *CompiledCursor_Position_IndexValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompiledCursor_Position_IndexValue.Unmarshal(m, b) +} +func (m *CompiledCursor_Position_IndexValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompiledCursor_Position_IndexValue.Marshal(b, m, deterministic) +} +func (dst *CompiledCursor_Position_IndexValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompiledCursor_Position_IndexValue.Merge(dst, src) +} +func (m *CompiledCursor_Position_IndexValue) XXX_Size() int { + return xxx_messageInfo_CompiledCursor_Position_IndexValue.Size(m) +} +func (m *CompiledCursor_Position_IndexValue) XXX_DiscardUnknown() { + xxx_messageInfo_CompiledCursor_Position_IndexValue.DiscardUnknown(m) +} + +var xxx_messageInfo_CompiledCursor_Position_IndexValue proto.InternalMessageInfo + +func (m *CompiledCursor_Position_IndexValue) GetProperty() string { + if m != nil && m.Property != nil { + return *m.Property + } + return "" +} + +func (m *CompiledCursor_Position_IndexValue) GetValue() *PropertyValue { + if m != nil { + return m.Value + } + return nil +} + +type Cursor struct { + Cursor *uint64 `protobuf:"fixed64,1,req,name=cursor" json:"cursor,omitempty"` + App *string `protobuf:"bytes,2,opt,name=app" json:"app,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cursor) Reset() { *m = Cursor{} } +func (m *Cursor) String() string { return proto.CompactTextString(m) } +func (*Cursor) ProtoMessage() {} +func (*Cursor) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{18} +} +func (m *Cursor) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Cursor.Unmarshal(m, b) +} +func (m *Cursor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Cursor.Marshal(b, m, deterministic) +} +func (dst *Cursor) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cursor.Merge(dst, src) +} +func (m *Cursor) XXX_Size() int { + return xxx_messageInfo_Cursor.Size(m) +} +func (m *Cursor) XXX_DiscardUnknown() { + xxx_messageInfo_Cursor.DiscardUnknown(m) +} + +var xxx_messageInfo_Cursor proto.InternalMessageInfo + +func (m *Cursor) GetCursor() uint64 { + if m != nil && m.Cursor != nil { + return *m.Cursor + } + return 0 +} + +func (m *Cursor) GetApp() string { + if m != nil && m.App != nil { + return *m.App + } + return "" +} + +type Error struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Error) Reset() { *m = Error{} } +func (m *Error) String() string { return proto.CompactTextString(m) } +func (*Error) ProtoMessage() {} +func (*Error) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{19} +} +func (m *Error) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Error.Unmarshal(m, b) +} +func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Error.Marshal(b, m, deterministic) +} +func (dst *Error) XXX_Merge(src proto.Message) { + xxx_messageInfo_Error.Merge(dst, src) +} +func (m *Error) XXX_Size() int { + return xxx_messageInfo_Error.Size(m) +} +func (m *Error) XXX_DiscardUnknown() { + xxx_messageInfo_Error.DiscardUnknown(m) +} + +var xxx_messageInfo_Error proto.InternalMessageInfo + +type Cost struct { + IndexWrites *int32 `protobuf:"varint,1,opt,name=index_writes,json=indexWrites" json:"index_writes,omitempty"` + IndexWriteBytes *int32 `protobuf:"varint,2,opt,name=index_write_bytes,json=indexWriteBytes" json:"index_write_bytes,omitempty"` + EntityWrites *int32 `protobuf:"varint,3,opt,name=entity_writes,json=entityWrites" json:"entity_writes,omitempty"` + EntityWriteBytes *int32 `protobuf:"varint,4,opt,name=entity_write_bytes,json=entityWriteBytes" json:"entity_write_bytes,omitempty"` + Commitcost *Cost_CommitCost `protobuf:"group,5,opt,name=CommitCost,json=commitcost" json:"commitcost,omitempty"` + ApproximateStorageDelta *int32 `protobuf:"varint,8,opt,name=approximate_storage_delta,json=approximateStorageDelta" json:"approximate_storage_delta,omitempty"` + IdSequenceUpdates *int32 `protobuf:"varint,9,opt,name=id_sequence_updates,json=idSequenceUpdates" json:"id_sequence_updates,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cost) Reset() { *m = Cost{} } +func (m *Cost) String() string { return proto.CompactTextString(m) } +func (*Cost) ProtoMessage() {} +func (*Cost) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{20} +} +func (m *Cost) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Cost.Unmarshal(m, b) +} +func (m *Cost) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Cost.Marshal(b, m, deterministic) +} +func (dst *Cost) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cost.Merge(dst, src) +} +func (m *Cost) XXX_Size() int { + return xxx_messageInfo_Cost.Size(m) +} +func (m *Cost) XXX_DiscardUnknown() { + xxx_messageInfo_Cost.DiscardUnknown(m) +} + +var xxx_messageInfo_Cost proto.InternalMessageInfo + +func (m *Cost) GetIndexWrites() int32 { + if m != nil && m.IndexWrites != nil { + return *m.IndexWrites + } + return 0 +} + +func (m *Cost) GetIndexWriteBytes() int32 { + if m != nil && m.IndexWriteBytes != nil { + return *m.IndexWriteBytes + } + return 0 +} + +func (m *Cost) GetEntityWrites() int32 { + if m != nil && m.EntityWrites != nil { + return *m.EntityWrites + } + return 0 +} + +func (m *Cost) GetEntityWriteBytes() int32 { + if m != nil && m.EntityWriteBytes != nil { + return *m.EntityWriteBytes + } + return 0 +} + +func (m *Cost) GetCommitcost() *Cost_CommitCost { + if m != nil { + return m.Commitcost + } + return nil +} + +func (m *Cost) GetApproximateStorageDelta() int32 { + if m != nil && m.ApproximateStorageDelta != nil { + return *m.ApproximateStorageDelta + } + return 0 +} + +func (m *Cost) GetIdSequenceUpdates() int32 { + if m != nil && m.IdSequenceUpdates != nil { + return *m.IdSequenceUpdates + } + return 0 +} + +type Cost_CommitCost struct { + RequestedEntityPuts *int32 `protobuf:"varint,6,opt,name=requested_entity_puts,json=requestedEntityPuts" json:"requested_entity_puts,omitempty"` + RequestedEntityDeletes *int32 `protobuf:"varint,7,opt,name=requested_entity_deletes,json=requestedEntityDeletes" json:"requested_entity_deletes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cost_CommitCost) Reset() { *m = Cost_CommitCost{} } +func (m *Cost_CommitCost) String() string { return proto.CompactTextString(m) } +func (*Cost_CommitCost) ProtoMessage() {} +func (*Cost_CommitCost) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{20, 0} +} +func (m *Cost_CommitCost) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Cost_CommitCost.Unmarshal(m, b) +} +func (m *Cost_CommitCost) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Cost_CommitCost.Marshal(b, m, deterministic) +} +func (dst *Cost_CommitCost) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cost_CommitCost.Merge(dst, src) +} +func (m *Cost_CommitCost) XXX_Size() int { + return xxx_messageInfo_Cost_CommitCost.Size(m) +} +func (m *Cost_CommitCost) XXX_DiscardUnknown() { + xxx_messageInfo_Cost_CommitCost.DiscardUnknown(m) +} + +var xxx_messageInfo_Cost_CommitCost proto.InternalMessageInfo + +func (m *Cost_CommitCost) GetRequestedEntityPuts() int32 { + if m != nil && m.RequestedEntityPuts != nil { + return *m.RequestedEntityPuts + } + return 0 +} + +func (m *Cost_CommitCost) GetRequestedEntityDeletes() int32 { + if m != nil && m.RequestedEntityDeletes != nil { + return *m.RequestedEntityDeletes + } + return 0 +} + +type GetRequest struct { + Header *InternalHeader `protobuf:"bytes,6,opt,name=header" json:"header,omitempty"` + Key []*Reference `protobuf:"bytes,1,rep,name=key" json:"key,omitempty"` + Transaction *Transaction `protobuf:"bytes,2,opt,name=transaction" json:"transaction,omitempty"` + FailoverMs *int64 `protobuf:"varint,3,opt,name=failover_ms,json=failoverMs" json:"failover_ms,omitempty"` + Strong *bool `protobuf:"varint,4,opt,name=strong" json:"strong,omitempty"` + AllowDeferred *bool `protobuf:"varint,5,opt,name=allow_deferred,json=allowDeferred,def=0" json:"allow_deferred,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{21} +} +func (m *GetRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetRequest.Unmarshal(m, b) +} +func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) +} +func (dst *GetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRequest.Merge(dst, src) +} +func (m *GetRequest) XXX_Size() int { + return xxx_messageInfo_GetRequest.Size(m) +} +func (m *GetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRequest proto.InternalMessageInfo + +const Default_GetRequest_AllowDeferred bool = false + +func (m *GetRequest) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *GetRequest) GetKey() []*Reference { + if m != nil { + return m.Key + } + return nil +} + +func (m *GetRequest) GetTransaction() *Transaction { + if m != nil { + return m.Transaction + } + return nil +} + +func (m *GetRequest) GetFailoverMs() int64 { + if m != nil && m.FailoverMs != nil { + return *m.FailoverMs + } + return 0 +} + +func (m *GetRequest) GetStrong() bool { + if m != nil && m.Strong != nil { + return *m.Strong + } + return false +} + +func (m *GetRequest) GetAllowDeferred() bool { + if m != nil && m.AllowDeferred != nil { + return *m.AllowDeferred + } + return Default_GetRequest_AllowDeferred +} + +type GetResponse struct { + Entity []*GetResponse_Entity `protobuf:"group,1,rep,name=Entity,json=entity" json:"entity,omitempty"` + Deferred []*Reference `protobuf:"bytes,5,rep,name=deferred" json:"deferred,omitempty"` + InOrder *bool `protobuf:"varint,6,opt,name=in_order,json=inOrder,def=1" json:"in_order,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{22} +} +func (m *GetResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetResponse.Unmarshal(m, b) +} +func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetResponse.Marshal(b, m, deterministic) +} +func (dst *GetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse.Merge(dst, src) +} +func (m *GetResponse) XXX_Size() int { + return xxx_messageInfo_GetResponse.Size(m) +} +func (m *GetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse proto.InternalMessageInfo + +const Default_GetResponse_InOrder bool = true + +func (m *GetResponse) GetEntity() []*GetResponse_Entity { + if m != nil { + return m.Entity + } + return nil +} + +func (m *GetResponse) GetDeferred() []*Reference { + if m != nil { + return m.Deferred + } + return nil +} + +func (m *GetResponse) GetInOrder() bool { + if m != nil && m.InOrder != nil { + return *m.InOrder + } + return Default_GetResponse_InOrder +} + +type GetResponse_Entity struct { + Entity *EntityProto `protobuf:"bytes,2,opt,name=entity" json:"entity,omitempty"` + Key *Reference `protobuf:"bytes,4,opt,name=key" json:"key,omitempty"` + Version *int64 `protobuf:"varint,3,opt,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse_Entity) Reset() { *m = GetResponse_Entity{} } +func (m *GetResponse_Entity) String() string { return proto.CompactTextString(m) } +func (*GetResponse_Entity) ProtoMessage() {} +func (*GetResponse_Entity) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{22, 0} +} +func (m *GetResponse_Entity) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetResponse_Entity.Unmarshal(m, b) +} +func (m *GetResponse_Entity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetResponse_Entity.Marshal(b, m, deterministic) +} +func (dst *GetResponse_Entity) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse_Entity.Merge(dst, src) +} +func (m *GetResponse_Entity) XXX_Size() int { + return xxx_messageInfo_GetResponse_Entity.Size(m) +} +func (m *GetResponse_Entity) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse_Entity.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse_Entity proto.InternalMessageInfo + +func (m *GetResponse_Entity) GetEntity() *EntityProto { + if m != nil { + return m.Entity + } + return nil +} + +func (m *GetResponse_Entity) GetKey() *Reference { + if m != nil { + return m.Key + } + return nil +} + +func (m *GetResponse_Entity) GetVersion() int64 { + if m != nil && m.Version != nil { + return *m.Version + } + return 0 +} + +type PutRequest struct { + Header *InternalHeader `protobuf:"bytes,11,opt,name=header" json:"header,omitempty"` + Entity []*EntityProto `protobuf:"bytes,1,rep,name=entity" json:"entity,omitempty"` + Transaction *Transaction `protobuf:"bytes,2,opt,name=transaction" json:"transaction,omitempty"` + CompositeIndex []*CompositeIndex `protobuf:"bytes,3,rep,name=composite_index,json=compositeIndex" json:"composite_index,omitempty"` + Trusted *bool `protobuf:"varint,4,opt,name=trusted,def=0" json:"trusted,omitempty"` + Force *bool `protobuf:"varint,7,opt,name=force,def=0" json:"force,omitempty"` + MarkChanges *bool `protobuf:"varint,8,opt,name=mark_changes,json=markChanges,def=0" json:"mark_changes,omitempty"` + Snapshot []*Snapshot `protobuf:"bytes,9,rep,name=snapshot" json:"snapshot,omitempty"` + AutoIdPolicy *PutRequest_AutoIdPolicy `protobuf:"varint,10,opt,name=auto_id_policy,json=autoIdPolicy,enum=appengine.PutRequest_AutoIdPolicy,def=0" json:"auto_id_policy,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutRequest) Reset() { *m = PutRequest{} } +func (m *PutRequest) String() string { return proto.CompactTextString(m) } +func (*PutRequest) ProtoMessage() {} +func (*PutRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{23} +} +func (m *PutRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PutRequest.Unmarshal(m, b) +} +func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PutRequest.Marshal(b, m, deterministic) +} +func (dst *PutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest.Merge(dst, src) +} +func (m *PutRequest) XXX_Size() int { + return xxx_messageInfo_PutRequest.Size(m) +} +func (m *PutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PutRequest proto.InternalMessageInfo + +const Default_PutRequest_Trusted bool = false +const Default_PutRequest_Force bool = false +const Default_PutRequest_MarkChanges bool = false +const Default_PutRequest_AutoIdPolicy PutRequest_AutoIdPolicy = PutRequest_CURRENT + +func (m *PutRequest) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *PutRequest) GetEntity() []*EntityProto { + if m != nil { + return m.Entity + } + return nil +} + +func (m *PutRequest) GetTransaction() *Transaction { + if m != nil { + return m.Transaction + } + return nil +} + +func (m *PutRequest) GetCompositeIndex() []*CompositeIndex { + if m != nil { + return m.CompositeIndex + } + return nil +} + +func (m *PutRequest) GetTrusted() bool { + if m != nil && m.Trusted != nil { + return *m.Trusted + } + return Default_PutRequest_Trusted +} + +func (m *PutRequest) GetForce() bool { + if m != nil && m.Force != nil { + return *m.Force + } + return Default_PutRequest_Force +} + +func (m *PutRequest) GetMarkChanges() bool { + if m != nil && m.MarkChanges != nil { + return *m.MarkChanges + } + return Default_PutRequest_MarkChanges +} + +func (m *PutRequest) GetSnapshot() []*Snapshot { + if m != nil { + return m.Snapshot + } + return nil +} + +func (m *PutRequest) GetAutoIdPolicy() PutRequest_AutoIdPolicy { + if m != nil && m.AutoIdPolicy != nil { + return *m.AutoIdPolicy + } + return Default_PutRequest_AutoIdPolicy +} + +type PutResponse struct { + Key []*Reference `protobuf:"bytes,1,rep,name=key" json:"key,omitempty"` + Cost *Cost `protobuf:"bytes,2,opt,name=cost" json:"cost,omitempty"` + Version []int64 `protobuf:"varint,3,rep,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PutResponse) Reset() { *m = PutResponse{} } +func (m *PutResponse) String() string { return proto.CompactTextString(m) } +func (*PutResponse) ProtoMessage() {} +func (*PutResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{24} +} +func (m *PutResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PutResponse.Unmarshal(m, b) +} +func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PutResponse.Marshal(b, m, deterministic) +} +func (dst *PutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutResponse.Merge(dst, src) +} +func (m *PutResponse) XXX_Size() int { + return xxx_messageInfo_PutResponse.Size(m) +} +func (m *PutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PutResponse proto.InternalMessageInfo + +func (m *PutResponse) GetKey() []*Reference { + if m != nil { + return m.Key + } + return nil +} + +func (m *PutResponse) GetCost() *Cost { + if m != nil { + return m.Cost + } + return nil +} + +func (m *PutResponse) GetVersion() []int64 { + if m != nil { + return m.Version + } + return nil +} + +type TouchRequest struct { + Header *InternalHeader `protobuf:"bytes,10,opt,name=header" json:"header,omitempty"` + Key []*Reference `protobuf:"bytes,1,rep,name=key" json:"key,omitempty"` + CompositeIndex []*CompositeIndex `protobuf:"bytes,2,rep,name=composite_index,json=compositeIndex" json:"composite_index,omitempty"` + Force *bool `protobuf:"varint,3,opt,name=force,def=0" json:"force,omitempty"` + Snapshot []*Snapshot `protobuf:"bytes,9,rep,name=snapshot" json:"snapshot,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TouchRequest) Reset() { *m = TouchRequest{} } +func (m *TouchRequest) String() string { return proto.CompactTextString(m) } +func (*TouchRequest) ProtoMessage() {} +func (*TouchRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{25} +} +func (m *TouchRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TouchRequest.Unmarshal(m, b) +} +func (m *TouchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TouchRequest.Marshal(b, m, deterministic) +} +func (dst *TouchRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TouchRequest.Merge(dst, src) +} +func (m *TouchRequest) XXX_Size() int { + return xxx_messageInfo_TouchRequest.Size(m) +} +func (m *TouchRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TouchRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TouchRequest proto.InternalMessageInfo + +const Default_TouchRequest_Force bool = false + +func (m *TouchRequest) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *TouchRequest) GetKey() []*Reference { + if m != nil { + return m.Key + } + return nil +} + +func (m *TouchRequest) GetCompositeIndex() []*CompositeIndex { + if m != nil { + return m.CompositeIndex + } + return nil +} + +func (m *TouchRequest) GetForce() bool { + if m != nil && m.Force != nil { + return *m.Force + } + return Default_TouchRequest_Force +} + +func (m *TouchRequest) GetSnapshot() []*Snapshot { + if m != nil { + return m.Snapshot + } + return nil +} + +type TouchResponse struct { + Cost *Cost `protobuf:"bytes,1,opt,name=cost" json:"cost,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TouchResponse) Reset() { *m = TouchResponse{} } +func (m *TouchResponse) String() string { return proto.CompactTextString(m) } +func (*TouchResponse) ProtoMessage() {} +func (*TouchResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{26} +} +func (m *TouchResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TouchResponse.Unmarshal(m, b) +} +func (m *TouchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TouchResponse.Marshal(b, m, deterministic) +} +func (dst *TouchResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TouchResponse.Merge(dst, src) +} +func (m *TouchResponse) XXX_Size() int { + return xxx_messageInfo_TouchResponse.Size(m) +} +func (m *TouchResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TouchResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TouchResponse proto.InternalMessageInfo + +func (m *TouchResponse) GetCost() *Cost { + if m != nil { + return m.Cost + } + return nil +} + +type DeleteRequest struct { + Header *InternalHeader `protobuf:"bytes,10,opt,name=header" json:"header,omitempty"` + Key []*Reference `protobuf:"bytes,6,rep,name=key" json:"key,omitempty"` + Transaction *Transaction `protobuf:"bytes,5,opt,name=transaction" json:"transaction,omitempty"` + Trusted *bool `protobuf:"varint,4,opt,name=trusted,def=0" json:"trusted,omitempty"` + Force *bool `protobuf:"varint,7,opt,name=force,def=0" json:"force,omitempty"` + MarkChanges *bool `protobuf:"varint,8,opt,name=mark_changes,json=markChanges,def=0" json:"mark_changes,omitempty"` + Snapshot []*Snapshot `protobuf:"bytes,9,rep,name=snapshot" json:"snapshot,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } +func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRequest) ProtoMessage() {} +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{27} +} +func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteRequest.Unmarshal(m, b) +} +func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic) +} +func (dst *DeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRequest.Merge(dst, src) +} +func (m *DeleteRequest) XXX_Size() int { + return xxx_messageInfo_DeleteRequest.Size(m) +} +func (m *DeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo + +const Default_DeleteRequest_Trusted bool = false +const Default_DeleteRequest_Force bool = false +const Default_DeleteRequest_MarkChanges bool = false + +func (m *DeleteRequest) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *DeleteRequest) GetKey() []*Reference { + if m != nil { + return m.Key + } + return nil +} + +func (m *DeleteRequest) GetTransaction() *Transaction { + if m != nil { + return m.Transaction + } + return nil +} + +func (m *DeleteRequest) GetTrusted() bool { + if m != nil && m.Trusted != nil { + return *m.Trusted + } + return Default_DeleteRequest_Trusted +} + +func (m *DeleteRequest) GetForce() bool { + if m != nil && m.Force != nil { + return *m.Force + } + return Default_DeleteRequest_Force +} + +func (m *DeleteRequest) GetMarkChanges() bool { + if m != nil && m.MarkChanges != nil { + return *m.MarkChanges + } + return Default_DeleteRequest_MarkChanges +} + +func (m *DeleteRequest) GetSnapshot() []*Snapshot { + if m != nil { + return m.Snapshot + } + return nil +} + +type DeleteResponse struct { + Cost *Cost `protobuf:"bytes,1,opt,name=cost" json:"cost,omitempty"` + Version []int64 `protobuf:"varint,3,rep,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } +func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteResponse) ProtoMessage() {} +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{28} +} +func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteResponse.Unmarshal(m, b) +} +func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic) +} +func (dst *DeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteResponse.Merge(dst, src) +} +func (m *DeleteResponse) XXX_Size() int { + return xxx_messageInfo_DeleteResponse.Size(m) +} +func (m *DeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo + +func (m *DeleteResponse) GetCost() *Cost { + if m != nil { + return m.Cost + } + return nil +} + +func (m *DeleteResponse) GetVersion() []int64 { + if m != nil { + return m.Version + } + return nil +} + +type NextRequest struct { + Header *InternalHeader `protobuf:"bytes,5,opt,name=header" json:"header,omitempty"` + Cursor *Cursor `protobuf:"bytes,1,req,name=cursor" json:"cursor,omitempty"` + Count *int32 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"` + Offset *int32 `protobuf:"varint,4,opt,name=offset,def=0" json:"offset,omitempty"` + Compile *bool `protobuf:"varint,3,opt,name=compile,def=0" json:"compile,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NextRequest) Reset() { *m = NextRequest{} } +func (m *NextRequest) String() string { return proto.CompactTextString(m) } +func (*NextRequest) ProtoMessage() {} +func (*NextRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{29} +} +func (m *NextRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NextRequest.Unmarshal(m, b) +} +func (m *NextRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NextRequest.Marshal(b, m, deterministic) +} +func (dst *NextRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NextRequest.Merge(dst, src) +} +func (m *NextRequest) XXX_Size() int { + return xxx_messageInfo_NextRequest.Size(m) +} +func (m *NextRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NextRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NextRequest proto.InternalMessageInfo + +const Default_NextRequest_Offset int32 = 0 +const Default_NextRequest_Compile bool = false + +func (m *NextRequest) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *NextRequest) GetCursor() *Cursor { + if m != nil { + return m.Cursor + } + return nil +} + +func (m *NextRequest) GetCount() int32 { + if m != nil && m.Count != nil { + return *m.Count + } + return 0 +} + +func (m *NextRequest) GetOffset() int32 { + if m != nil && m.Offset != nil { + return *m.Offset + } + return Default_NextRequest_Offset +} + +func (m *NextRequest) GetCompile() bool { + if m != nil && m.Compile != nil { + return *m.Compile + } + return Default_NextRequest_Compile +} + +type QueryResult struct { + Cursor *Cursor `protobuf:"bytes,1,opt,name=cursor" json:"cursor,omitempty"` + Result []*EntityProto `protobuf:"bytes,2,rep,name=result" json:"result,omitempty"` + SkippedResults *int32 `protobuf:"varint,7,opt,name=skipped_results,json=skippedResults" json:"skipped_results,omitempty"` + MoreResults *bool `protobuf:"varint,3,req,name=more_results,json=moreResults" json:"more_results,omitempty"` + KeysOnly *bool `protobuf:"varint,4,opt,name=keys_only,json=keysOnly" json:"keys_only,omitempty"` + IndexOnly *bool `protobuf:"varint,9,opt,name=index_only,json=indexOnly" json:"index_only,omitempty"` + SmallOps *bool `protobuf:"varint,10,opt,name=small_ops,json=smallOps" json:"small_ops,omitempty"` + CompiledQuery *CompiledQuery `protobuf:"bytes,5,opt,name=compiled_query,json=compiledQuery" json:"compiled_query,omitempty"` + CompiledCursor *CompiledCursor `protobuf:"bytes,6,opt,name=compiled_cursor,json=compiledCursor" json:"compiled_cursor,omitempty"` + Index []*CompositeIndex `protobuf:"bytes,8,rep,name=index" json:"index,omitempty"` + Version []int64 `protobuf:"varint,11,rep,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *QueryResult) Reset() { *m = QueryResult{} } +func (m *QueryResult) String() string { return proto.CompactTextString(m) } +func (*QueryResult) ProtoMessage() {} +func (*QueryResult) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{30} +} +func (m *QueryResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_QueryResult.Unmarshal(m, b) +} +func (m *QueryResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_QueryResult.Marshal(b, m, deterministic) +} +func (dst *QueryResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryResult.Merge(dst, src) +} +func (m *QueryResult) XXX_Size() int { + return xxx_messageInfo_QueryResult.Size(m) +} +func (m *QueryResult) XXX_DiscardUnknown() { + xxx_messageInfo_QueryResult.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryResult proto.InternalMessageInfo + +func (m *QueryResult) GetCursor() *Cursor { + if m != nil { + return m.Cursor + } + return nil +} + +func (m *QueryResult) GetResult() []*EntityProto { + if m != nil { + return m.Result + } + return nil +} + +func (m *QueryResult) GetSkippedResults() int32 { + if m != nil && m.SkippedResults != nil { + return *m.SkippedResults + } + return 0 +} + +func (m *QueryResult) GetMoreResults() bool { + if m != nil && m.MoreResults != nil { + return *m.MoreResults + } + return false +} + +func (m *QueryResult) GetKeysOnly() bool { + if m != nil && m.KeysOnly != nil { + return *m.KeysOnly + } + return false +} + +func (m *QueryResult) GetIndexOnly() bool { + if m != nil && m.IndexOnly != nil { + return *m.IndexOnly + } + return false +} + +func (m *QueryResult) GetSmallOps() bool { + if m != nil && m.SmallOps != nil { + return *m.SmallOps + } + return false +} + +func (m *QueryResult) GetCompiledQuery() *CompiledQuery { + if m != nil { + return m.CompiledQuery + } + return nil +} + +func (m *QueryResult) GetCompiledCursor() *CompiledCursor { + if m != nil { + return m.CompiledCursor + } + return nil +} + +func (m *QueryResult) GetIndex() []*CompositeIndex { + if m != nil { + return m.Index + } + return nil +} + +func (m *QueryResult) GetVersion() []int64 { + if m != nil { + return m.Version + } + return nil +} + +type AllocateIdsRequest struct { + Header *InternalHeader `protobuf:"bytes,4,opt,name=header" json:"header,omitempty"` + ModelKey *Reference `protobuf:"bytes,1,opt,name=model_key,json=modelKey" json:"model_key,omitempty"` + Size *int64 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"` + Max *int64 `protobuf:"varint,3,opt,name=max" json:"max,omitempty"` + Reserve []*Reference `protobuf:"bytes,5,rep,name=reserve" json:"reserve,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AllocateIdsRequest) Reset() { *m = AllocateIdsRequest{} } +func (m *AllocateIdsRequest) String() string { return proto.CompactTextString(m) } +func (*AllocateIdsRequest) ProtoMessage() {} +func (*AllocateIdsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{31} +} +func (m *AllocateIdsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AllocateIdsRequest.Unmarshal(m, b) +} +func (m *AllocateIdsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AllocateIdsRequest.Marshal(b, m, deterministic) +} +func (dst *AllocateIdsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllocateIdsRequest.Merge(dst, src) +} +func (m *AllocateIdsRequest) XXX_Size() int { + return xxx_messageInfo_AllocateIdsRequest.Size(m) +} +func (m *AllocateIdsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AllocateIdsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AllocateIdsRequest proto.InternalMessageInfo + +func (m *AllocateIdsRequest) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *AllocateIdsRequest) GetModelKey() *Reference { + if m != nil { + return m.ModelKey + } + return nil +} + +func (m *AllocateIdsRequest) GetSize() int64 { + if m != nil && m.Size != nil { + return *m.Size + } + return 0 +} + +func (m *AllocateIdsRequest) GetMax() int64 { + if m != nil && m.Max != nil { + return *m.Max + } + return 0 +} + +func (m *AllocateIdsRequest) GetReserve() []*Reference { + if m != nil { + return m.Reserve + } + return nil +} + +type AllocateIdsResponse struct { + Start *int64 `protobuf:"varint,1,req,name=start" json:"start,omitempty"` + End *int64 `protobuf:"varint,2,req,name=end" json:"end,omitempty"` + Cost *Cost `protobuf:"bytes,3,opt,name=cost" json:"cost,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AllocateIdsResponse) Reset() { *m = AllocateIdsResponse{} } +func (m *AllocateIdsResponse) String() string { return proto.CompactTextString(m) } +func (*AllocateIdsResponse) ProtoMessage() {} +func (*AllocateIdsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{32} +} +func (m *AllocateIdsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AllocateIdsResponse.Unmarshal(m, b) +} +func (m *AllocateIdsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AllocateIdsResponse.Marshal(b, m, deterministic) +} +func (dst *AllocateIdsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllocateIdsResponse.Merge(dst, src) +} +func (m *AllocateIdsResponse) XXX_Size() int { + return xxx_messageInfo_AllocateIdsResponse.Size(m) +} +func (m *AllocateIdsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AllocateIdsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AllocateIdsResponse proto.InternalMessageInfo + +func (m *AllocateIdsResponse) GetStart() int64 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *AllocateIdsResponse) GetEnd() int64 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func (m *AllocateIdsResponse) GetCost() *Cost { + if m != nil { + return m.Cost + } + return nil +} + +type CompositeIndices struct { + Index []*CompositeIndex `protobuf:"bytes,1,rep,name=index" json:"index,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompositeIndices) Reset() { *m = CompositeIndices{} } +func (m *CompositeIndices) String() string { return proto.CompactTextString(m) } +func (*CompositeIndices) ProtoMessage() {} +func (*CompositeIndices) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{33} +} +func (m *CompositeIndices) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompositeIndices.Unmarshal(m, b) +} +func (m *CompositeIndices) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompositeIndices.Marshal(b, m, deterministic) +} +func (dst *CompositeIndices) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompositeIndices.Merge(dst, src) +} +func (m *CompositeIndices) XXX_Size() int { + return xxx_messageInfo_CompositeIndices.Size(m) +} +func (m *CompositeIndices) XXX_DiscardUnknown() { + xxx_messageInfo_CompositeIndices.DiscardUnknown(m) +} + +var xxx_messageInfo_CompositeIndices proto.InternalMessageInfo + +func (m *CompositeIndices) GetIndex() []*CompositeIndex { + if m != nil { + return m.Index + } + return nil +} + +type AddActionsRequest struct { + Header *InternalHeader `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` + Transaction *Transaction `protobuf:"bytes,1,req,name=transaction" json:"transaction,omitempty"` + Action []*Action `protobuf:"bytes,2,rep,name=action" json:"action,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddActionsRequest) Reset() { *m = AddActionsRequest{} } +func (m *AddActionsRequest) String() string { return proto.CompactTextString(m) } +func (*AddActionsRequest) ProtoMessage() {} +func (*AddActionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{34} +} +func (m *AddActionsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddActionsRequest.Unmarshal(m, b) +} +func (m *AddActionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddActionsRequest.Marshal(b, m, deterministic) +} +func (dst *AddActionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddActionsRequest.Merge(dst, src) +} +func (m *AddActionsRequest) XXX_Size() int { + return xxx_messageInfo_AddActionsRequest.Size(m) +} +func (m *AddActionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AddActionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AddActionsRequest proto.InternalMessageInfo + +func (m *AddActionsRequest) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *AddActionsRequest) GetTransaction() *Transaction { + if m != nil { + return m.Transaction + } + return nil +} + +func (m *AddActionsRequest) GetAction() []*Action { + if m != nil { + return m.Action + } + return nil +} + +type AddActionsResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddActionsResponse) Reset() { *m = AddActionsResponse{} } +func (m *AddActionsResponse) String() string { return proto.CompactTextString(m) } +func (*AddActionsResponse) ProtoMessage() {} +func (*AddActionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{35} +} +func (m *AddActionsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddActionsResponse.Unmarshal(m, b) +} +func (m *AddActionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddActionsResponse.Marshal(b, m, deterministic) +} +func (dst *AddActionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddActionsResponse.Merge(dst, src) +} +func (m *AddActionsResponse) XXX_Size() int { + return xxx_messageInfo_AddActionsResponse.Size(m) +} +func (m *AddActionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AddActionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AddActionsResponse proto.InternalMessageInfo + +type BeginTransactionRequest struct { + Header *InternalHeader `protobuf:"bytes,3,opt,name=header" json:"header,omitempty"` + App *string `protobuf:"bytes,1,req,name=app" json:"app,omitempty"` + AllowMultipleEg *bool `protobuf:"varint,2,opt,name=allow_multiple_eg,json=allowMultipleEg,def=0" json:"allow_multiple_eg,omitempty"` + DatabaseId *string `protobuf:"bytes,4,opt,name=database_id,json=databaseId" json:"database_id,omitempty"` + Mode *BeginTransactionRequest_TransactionMode `protobuf:"varint,5,opt,name=mode,enum=appengine.BeginTransactionRequest_TransactionMode,def=0" json:"mode,omitempty"` + PreviousTransaction *Transaction `protobuf:"bytes,7,opt,name=previous_transaction,json=previousTransaction" json:"previous_transaction,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BeginTransactionRequest) Reset() { *m = BeginTransactionRequest{} } +func (m *BeginTransactionRequest) String() string { return proto.CompactTextString(m) } +func (*BeginTransactionRequest) ProtoMessage() {} +func (*BeginTransactionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{36} +} +func (m *BeginTransactionRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BeginTransactionRequest.Unmarshal(m, b) +} +func (m *BeginTransactionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BeginTransactionRequest.Marshal(b, m, deterministic) +} +func (dst *BeginTransactionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BeginTransactionRequest.Merge(dst, src) +} +func (m *BeginTransactionRequest) XXX_Size() int { + return xxx_messageInfo_BeginTransactionRequest.Size(m) +} +func (m *BeginTransactionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BeginTransactionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BeginTransactionRequest proto.InternalMessageInfo + +const Default_BeginTransactionRequest_AllowMultipleEg bool = false +const Default_BeginTransactionRequest_Mode BeginTransactionRequest_TransactionMode = BeginTransactionRequest_UNKNOWN + +func (m *BeginTransactionRequest) GetHeader() *InternalHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *BeginTransactionRequest) GetApp() string { + if m != nil && m.App != nil { + return *m.App + } + return "" +} + +func (m *BeginTransactionRequest) GetAllowMultipleEg() bool { + if m != nil && m.AllowMultipleEg != nil { + return *m.AllowMultipleEg + } + return Default_BeginTransactionRequest_AllowMultipleEg +} + +func (m *BeginTransactionRequest) GetDatabaseId() string { + if m != nil && m.DatabaseId != nil { + return *m.DatabaseId + } + return "" +} + +func (m *BeginTransactionRequest) GetMode() BeginTransactionRequest_TransactionMode { + if m != nil && m.Mode != nil { + return *m.Mode + } + return Default_BeginTransactionRequest_Mode +} + +func (m *BeginTransactionRequest) GetPreviousTransaction() *Transaction { + if m != nil { + return m.PreviousTransaction + } + return nil +} + +type CommitResponse struct { + Cost *Cost `protobuf:"bytes,1,opt,name=cost" json:"cost,omitempty"` + Version []*CommitResponse_Version `protobuf:"group,3,rep,name=Version,json=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CommitResponse) Reset() { *m = CommitResponse{} } +func (m *CommitResponse) String() string { return proto.CompactTextString(m) } +func (*CommitResponse) ProtoMessage() {} +func (*CommitResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{37} +} +func (m *CommitResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CommitResponse.Unmarshal(m, b) +} +func (m *CommitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CommitResponse.Marshal(b, m, deterministic) +} +func (dst *CommitResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommitResponse.Merge(dst, src) +} +func (m *CommitResponse) XXX_Size() int { + return xxx_messageInfo_CommitResponse.Size(m) +} +func (m *CommitResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CommitResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CommitResponse proto.InternalMessageInfo + +func (m *CommitResponse) GetCost() *Cost { + if m != nil { + return m.Cost + } + return nil +} + +func (m *CommitResponse) GetVersion() []*CommitResponse_Version { + if m != nil { + return m.Version + } + return nil +} + +type CommitResponse_Version struct { + RootEntityKey *Reference `protobuf:"bytes,4,req,name=root_entity_key,json=rootEntityKey" json:"root_entity_key,omitempty"` + Version *int64 `protobuf:"varint,5,req,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CommitResponse_Version) Reset() { *m = CommitResponse_Version{} } +func (m *CommitResponse_Version) String() string { return proto.CompactTextString(m) } +func (*CommitResponse_Version) ProtoMessage() {} +func (*CommitResponse_Version) Descriptor() ([]byte, []int) { + return fileDescriptor_datastore_v3_83b17b80c34f6179, []int{37, 0} +} +func (m *CommitResponse_Version) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CommitResponse_Version.Unmarshal(m, b) +} +func (m *CommitResponse_Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CommitResponse_Version.Marshal(b, m, deterministic) +} +func (dst *CommitResponse_Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommitResponse_Version.Merge(dst, src) +} +func (m *CommitResponse_Version) XXX_Size() int { + return xxx_messageInfo_CommitResponse_Version.Size(m) +} +func (m *CommitResponse_Version) XXX_DiscardUnknown() { + xxx_messageInfo_CommitResponse_Version.DiscardUnknown(m) +} + +var xxx_messageInfo_CommitResponse_Version proto.InternalMessageInfo + +func (m *CommitResponse_Version) GetRootEntityKey() *Reference { + if m != nil { + return m.RootEntityKey + } + return nil +} + +func (m *CommitResponse_Version) GetVersion() int64 { + if m != nil && m.Version != nil { + return *m.Version + } + return 0 +} + +func init() { + proto.RegisterType((*Action)(nil), "appengine.Action") + proto.RegisterType((*PropertyValue)(nil), "appengine.PropertyValue") + proto.RegisterType((*PropertyValue_PointValue)(nil), "appengine.PropertyValue.PointValue") + proto.RegisterType((*PropertyValue_UserValue)(nil), "appengine.PropertyValue.UserValue") + proto.RegisterType((*PropertyValue_ReferenceValue)(nil), "appengine.PropertyValue.ReferenceValue") + proto.RegisterType((*PropertyValue_ReferenceValue_PathElement)(nil), "appengine.PropertyValue.ReferenceValue.PathElement") + proto.RegisterType((*Property)(nil), "appengine.Property") + proto.RegisterType((*Path)(nil), "appengine.Path") + proto.RegisterType((*Path_Element)(nil), "appengine.Path.Element") + proto.RegisterType((*Reference)(nil), "appengine.Reference") + proto.RegisterType((*User)(nil), "appengine.User") + proto.RegisterType((*EntityProto)(nil), "appengine.EntityProto") + proto.RegisterType((*CompositeProperty)(nil), "appengine.CompositeProperty") + proto.RegisterType((*Index)(nil), "appengine.Index") + proto.RegisterType((*Index_Property)(nil), "appengine.Index.Property") + proto.RegisterType((*CompositeIndex)(nil), "appengine.CompositeIndex") + proto.RegisterType((*IndexPostfix)(nil), "appengine.IndexPostfix") + proto.RegisterType((*IndexPostfix_IndexValue)(nil), "appengine.IndexPostfix.IndexValue") + proto.RegisterType((*IndexPosition)(nil), "appengine.IndexPosition") + proto.RegisterType((*Snapshot)(nil), "appengine.Snapshot") + proto.RegisterType((*InternalHeader)(nil), "appengine.InternalHeader") + proto.RegisterType((*Transaction)(nil), "appengine.Transaction") + proto.RegisterType((*Query)(nil), "appengine.Query") + proto.RegisterType((*Query_Filter)(nil), "appengine.Query.Filter") + proto.RegisterType((*Query_Order)(nil), "appengine.Query.Order") + proto.RegisterType((*CompiledQuery)(nil), "appengine.CompiledQuery") + proto.RegisterType((*CompiledQuery_PrimaryScan)(nil), "appengine.CompiledQuery.PrimaryScan") + proto.RegisterType((*CompiledQuery_MergeJoinScan)(nil), "appengine.CompiledQuery.MergeJoinScan") + proto.RegisterType((*CompiledQuery_EntityFilter)(nil), "appengine.CompiledQuery.EntityFilter") + proto.RegisterType((*CompiledCursor)(nil), "appengine.CompiledCursor") + proto.RegisterType((*CompiledCursor_Position)(nil), "appengine.CompiledCursor.Position") + proto.RegisterType((*CompiledCursor_Position_IndexValue)(nil), "appengine.CompiledCursor.Position.IndexValue") + proto.RegisterType((*Cursor)(nil), "appengine.Cursor") + proto.RegisterType((*Error)(nil), "appengine.Error") + proto.RegisterType((*Cost)(nil), "appengine.Cost") + proto.RegisterType((*Cost_CommitCost)(nil), "appengine.Cost.CommitCost") + proto.RegisterType((*GetRequest)(nil), "appengine.GetRequest") + proto.RegisterType((*GetResponse)(nil), "appengine.GetResponse") + proto.RegisterType((*GetResponse_Entity)(nil), "appengine.GetResponse.Entity") + proto.RegisterType((*PutRequest)(nil), "appengine.PutRequest") + proto.RegisterType((*PutResponse)(nil), "appengine.PutResponse") + proto.RegisterType((*TouchRequest)(nil), "appengine.TouchRequest") + proto.RegisterType((*TouchResponse)(nil), "appengine.TouchResponse") + proto.RegisterType((*DeleteRequest)(nil), "appengine.DeleteRequest") + proto.RegisterType((*DeleteResponse)(nil), "appengine.DeleteResponse") + proto.RegisterType((*NextRequest)(nil), "appengine.NextRequest") + proto.RegisterType((*QueryResult)(nil), "appengine.QueryResult") + proto.RegisterType((*AllocateIdsRequest)(nil), "appengine.AllocateIdsRequest") + proto.RegisterType((*AllocateIdsResponse)(nil), "appengine.AllocateIdsResponse") + proto.RegisterType((*CompositeIndices)(nil), "appengine.CompositeIndices") + proto.RegisterType((*AddActionsRequest)(nil), "appengine.AddActionsRequest") + proto.RegisterType((*AddActionsResponse)(nil), "appengine.AddActionsResponse") + proto.RegisterType((*BeginTransactionRequest)(nil), "appengine.BeginTransactionRequest") + proto.RegisterType((*CommitResponse)(nil), "appengine.CommitResponse") + proto.RegisterType((*CommitResponse_Version)(nil), "appengine.CommitResponse.Version") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/datastore/datastore_v3.proto", fileDescriptor_datastore_v3_83b17b80c34f6179) +} + +var fileDescriptor_datastore_v3_83b17b80c34f6179 = []byte{ + // 4156 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xcd, 0x73, 0xe3, 0x46, + 0x76, 0x37, 0xc1, 0xef, 0x47, 0x89, 0x82, 0x5a, 0xf3, 0xc1, 0xa1, 0x3f, 0x46, 0xc6, 0xac, 0x6d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75, 0x53, 0xef, 0xa9, 0x45, 0x9e, 0x3d, 0x74, 0x4a, 0x87, 0x54, 0x2d, 0x69, 0xff, 0x53, 0x80, + 0x15, 0x94, 0xe7, 0xd0, 0x8f, 0xe2, 0x89, 0xfb, 0x92, 0xec, 0x41, 0x43, 0x98, 0xdd, 0xa9, 0x2c, + 0xe8, 0xb9, 0x33, 0x68, 0x8b, 0x7b, 0x96, 0x68, 0x31, 0x90, 0x75, 0xb4, 0x9b, 0x3e, 0x27, 0x21, + 0x45, 0x41, 0xa7, 0xbf, 0x22, 0xa4, 0xbc, 0x05, 0x95, 0x67, 0x6c, 0xe2, 0x87, 0x22, 0x04, 0xd6, + 0x76, 0x4a, 0x71, 0x38, 0x67, 0x54, 0xd2, 0xda, 0x36, 0xc0, 0xf9, 0xfa, 0xe4, 0x01, 0xac, 0x26, + 0xc6, 0x66, 0xa1, 0x71, 0x89, 0x93, 0x5b, 0x49, 0x88, 0x83, 0x5c, 0x75, 0xa3, 0x5c, 0xab, 0xba, + 0xd1, 0xbe, 0x86, 0xd5, 0x64, 0x3f, 0xe2, 0xfc, 0x54, 0x21, 0x79, 0x01, 0x63, 0xca, 0x82, 0x8c, + 0xca, 0x45, 0x19, 0xb5, 0x9f, 0x41, 0x6d, 0xe4, 0xd9, 0x41, 0x74, 0xe2, 0xc7, 0xdc, 0x7a, 0xe2, + 0x48, 0xfa, 0xaa, 0x12, 0x47, 0x9a, 0x06, 0x15, 0x7e, 0x38, 0xf3, 0x88, 0xbb, 0xbf, 0x31, 0xe8, + 0xee, 0x99, 0xc6, 0xb7, 0xba, 0xfa, 0x06, 0x01, 0xa8, 0xc8, 0xe7, 0x82, 0xa6, 0x41, 0xd3, 0x90, + 0xed, 0xd8, 0x63, 0x66, 0x3b, 0x2c, 0xe4, 0x12, 0xfc, 0xe0, 0x47, 0x89, 0x04, 0x3f, 0xf8, 0x91, + 0xf6, 0x17, 0x05, 0x68, 0x98, 0xa1, 0xed, 0x45, 0xb6, 0x30, 0xf7, 0xcf, 0xa0, 0x72, 0x82, 0x58, + 0x74, 0xa3, 0xc6, 0x82, 0x7f, 0x66, 0x17, 0xa3, 0x12, 0x48, 0xee, 0x40, 0xe5, 0xc4, 0xf6, 0x9c, + 0xa9, 0xd0, 0x5a, 0x85, 0xca, 0x51, 0x92, 0x1b, 0x95, 0xf3, 0xdc, 0xb8, 0x05, 0x2b, 0x33, 0x3b, + 0x7c, 0x6e, 0x8d, 0x4f, 0x6c, 0xef, 0x98, 0x45, 0xf2, 0x60, 0xa4, 0x05, 0x36, 0x38, 0x6b, 0x4f, + 0x70, 0xb4, 0xbf, 0x5f, 0x81, 0xf2, 0x37, 0x73, 0x16, 0x9e, 0x65, 0x04, 0xfa, 0xe0, 0xba, 0x02, + 0xc9, 0x17, 0x17, 0x2e, 0x4b, 0xca, 0x6f, 0x2f, 0x26, 0x65, 0x22, 0x53, 0x84, 0xc8, 0x95, 0x22, + 0x0b, 0x7c, 0x9a, 0x09, 0x63, 0xeb, 0x57, 0xd8, 0xda, 0x79, 0x70, 0x7b, 0x08, 0x95, 0x89, 0x3b, + 0x8d, 0x51, 0x75, 0x8b, 0xd5, 0x08, 0xee, 0xa5, 0xf3, 0x08, 0xd9, 0x54, 0xc2, 0xc8, 0xbb, 0xb0, + 0x22, 0x2a, 0x59, 0xeb, 0x07, 0xce, 0xc6, 0x82, 0x95, 0xf7, 0xa6, 0x48, 0x13, 0xbb, 0xff, 0x18, + 0xca, 0x7e, 0xc8, 0x37, 0x5f, 0xc7, 0x25, 0xef, 0x5c, 0x58, 0x72, 0xc8, 0xb9, 0x54, 0x80, 0xc8, + 0x87, 0x50, 0x3a, 0x71, 0xbd, 0x18, 0xb3, 0x46, 0x73, 0xfb, 0xf6, 0x05, 0xf0, 0x63, 0xd7, 0x8b, + 0x29, 0x42, 0x78, 0x98, 0x1f, 0xfb, 0x73, 0x2f, 0x6e, 0xdd, 0xc5, 0x0c, 0x23, 0x06, 0xe4, 0x1e, + 0x54, 0xfc, 0xc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, 0x23, 0xd3, 0xe8, 0xf7, 0xad, 0xee, 0xe1, 0x61, 0xff, + 0x29, 0x4f, 0x60, 0x35, 0x72, 0x17, 0x36, 0xf6, 0xba, 0x87, 0xdd, 0x5d, 0xa3, 0x6f, 0x98, 0x4f, + 0xad, 0x9e, 0x31, 0xe2, 0xf3, 0x7b, 0x6a, 0x9d, 0x27, 0x6c, 0x93, 0x3e, 0xb5, 0xba, 0x7d, 0x14, + 0xcd, 0xd4, 0xad, 0xdd, 0xee, 0xde, 0x13, 0x7d, 0xd0, 0x53, 0x81, 0x0b, 0x30, 0xea, 0x3e, 0xd2, + 0x2d, 0x2e, 0x92, 0x65, 0x0e, 0x87, 0xd6, 0xb0, 0xdf, 0x53, 0x1b, 0xda, 0xbf, 0x14, 0xa1, 0xb4, + 0xe7, 0x47, 0x31, 0xf7, 0x46, 0xe1, 0xac, 0x2f, 0x42, 0x37, 0x66, 0xa2, 0x7f, 0x2b, 0x53, 0xd1, + 0x4b, 0x7f, 0x87, 0x24, 0x1e, 0x50, 0x32, 0x10, 0xeb, 0xd9, 0x19, 0xc7, 0x29, 0x88, 0x5b, 0x3b, + 0xc7, 0xed, 0x72, 0xb2, 0x88, 0x68, 0x78, 0x85, 0x23, 0xd7, 0x2b, 0x22, 0x4e, 0x06, 0x61, 0xb9, + 0xe0, 0xc7, 0x40, 0xb2, 0x20, 0xb9, 0x62, 0x09, 0x91, 0x6a, 0x06, 0x29, 0x96, 0xdc, 0x01, 0x18, + 0xfb, 0xb3, 0x99, 0x1b, 0x8f, 0xfd, 0x28, 0x96, 0x5f, 0xc8, 0xda, 0x39, 0x63, 0x8f, 0x62, 0x6e, + 0xf1, 0x33, 0x37, 0xe6, 0x8f, 0x34, 0x83, 0x26, 0x3b, 0x70, 0xcf, 0x0e, 0x82, 0xd0, 0x7f, 0xe9, + 0xce, 0xec, 0x98, 0x59, 0xdc, 0x73, 0xed, 0x63, 0x66, 0x39, 0x6c, 0x1a, 0xdb, 0xd8, 0x13, 0x95, + 0xe9, 0xdd, 0x0c, 0x60, 0x24, 0xf8, 0x3d, 0xce, 0xe6, 0x71, 0xd7, 0x75, 0xac, 0x88, 0xfd, 0x30, + 0xe7, 0x1e, 0x60, 0xcd, 0x03, 0xc7, 0xe6, 0x62, 0xd6, 0x45, 0x96, 0x72, 0x9d, 0x91, 0xe4, 0x1c, + 0x09, 0x46, 0xfb, 0x15, 0xc0, 0xb9, 0x14, 0x64, 0x1b, 0x6e, 0xf3, 0x3a, 0x9e, 0x45, 0x31, 0x73, + 0x2c, 0xb9, 0xdb, 0x60, 0x1e, 0x47, 0x18, 0xe2, 0xcb, 0x74, 0x23, 0x65, 0xca, 0x9b, 0xc2, 0x79, + 0x1c, 0x91, 0x9f, 0x40, 0xeb, 0xc2, 0x1c, 0x87, 0x4d, 0x19, 0x7f, 0x6d, 0x15, 0xa7, 0xdd, 0x59, + 0x98, 0xd6, 0x13, 0x5c, 0xed, 0x4f, 0x14, 0x80, 0x7d, 0x16, 0x53, 0xc1, 0xcd, 0x34, 0xb6, 0x95, + 0xeb, 0x36, 0xb6, 0xef, 0x27, 0x17, 0x08, 0xc5, 0xab, 0x63, 0xc0, 0x42, 0x97, 0xa1, 0xdc, 0xa4, + 0xcb, 0xc8, 0x35, 0x11, 0xc5, 0x2b, 0x9a, 0x88, 0x52, 0xae, 0x89, 0xf8, 0x18, 0x9a, 0xf6, 0x74, + 0xea, 0xbf, 0xe0, 0x05, 0x0d, 0x0b, 0x43, 0xe6, 0xa0, 0x11, 0x9c, 0xd7, 0xdb, 0xc8, 0xec, 0x49, + 0x9e, 0xf6, 0xe7, 0x0a, 0x34, 0x50, 0x15, 0x51, 0xe0, 0x7b, 0x11, 0x23, 0x5f, 0x42, 0x45, 0x5e, + 0x44, 0x8b, 0x8b, 0xfc, 0xb7, 0x33, 0xb2, 0x66, 0x70, 0xb2, 0x68, 0xa0, 0x12, 0xcc, 0x33, 0x42, + 0xe6, 0x75, 0x97, 0x2b, 0x25, 0x45, 0x91, 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 0xb8, 0x91, + 0xcc, 0xc9, 0x10, 0xb5, 0x9f, 0xc2, 0xda, 0xc2, 0xcb, 0x78, 0x6d, 0x26, 0x5f, 0xa7, 0xbe, 0x41, + 0x56, 0xa1, 0x8e, 0x1f, 0xbb, 0x97, 0x7f, 0xfb, 0xd6, 0xfe, 0xb5, 0x80, 0x57, 0x4c, 0x33, 0x37, + 0xbe, 0x59, 0x06, 0xfb, 0xcd, 0x7c, 0x06, 0x83, 0xed, 0x77, 0xf3, 0xe6, 0x9b, 0x59, 0xb0, 0xf3, + 0xad, 0x00, 0xa6, 0x41, 0xa4, 0x6d, 0x43, 0x55, 0xd2, 0xc8, 0x6f, 0xc1, 0x5a, 0xe8, 0xfb, 0x71, + 0xd2, 0x89, 0x8a, 0x0e, 0xe4, 0xf2, 0x3f, 0xdb, 0xac, 0x72, 0xb0, 0x48, 0x06, 0x4f, 0xf2, 0xbd, + 0x48, 0x59, 0xfc, 0x0d, 0x44, 0x0e, 0x77, 0x1b, 0xbf, 0x5b, 0x4f, 0xff, 0xb7, 0xfb, 0xbf, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x35, 0x9f, 0x30, 0x98, 0xf2, 0x2b, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto b/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto new file mode 100755 index 000000000..497b4d9a9 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto @@ -0,0 +1,551 @@ +syntax = "proto2"; +option go_package = "datastore"; + +package appengine; + +message Action{} + +message PropertyValue { + optional int64 int64Value = 1; + optional bool booleanValue = 2; + optional string stringValue = 3; + optional double doubleValue = 4; + + optional group PointValue = 5 { + required double x = 6; + required double y = 7; + } + + optional group UserValue = 8 { + required string email = 9; + required string auth_domain = 10; + optional string nickname = 11; + optional string federated_identity = 21; + optional string federated_provider = 22; + } + + optional group ReferenceValue = 12 { + required string app = 13; + optional string name_space = 20; + repeated group PathElement = 14 { + required string type = 15; + optional int64 id = 16; + optional string name = 17; + } + } +} + +message Property { + enum Meaning { + NO_MEANING = 0; + BLOB = 14; + TEXT = 15; + BYTESTRING = 16; + + ATOM_CATEGORY = 1; + ATOM_LINK = 2; + ATOM_TITLE = 3; + ATOM_CONTENT = 4; + ATOM_SUMMARY = 5; + ATOM_AUTHOR = 6; + + GD_WHEN = 7; + GD_EMAIL = 8; + GEORSS_POINT = 9; + GD_IM = 10; + + GD_PHONENUMBER = 11; + GD_POSTALADDRESS = 12; + + GD_RATING = 13; + + BLOBKEY = 17; + ENTITY_PROTO = 19; + + INDEX_VALUE = 18; + }; + + optional Meaning meaning = 1 [default = NO_MEANING]; + optional string meaning_uri = 2; + + required string name = 3; + + required PropertyValue value = 5; + + required bool multiple = 4; + + optional bool searchable = 6 [default=false]; + + enum FtsTokenizationOption { + HTML = 1; + ATOM = 2; + } + + optional FtsTokenizationOption fts_tokenization_option = 8; + + optional string locale = 9 [default = "en"]; +} + +message Path { + repeated group Element = 1 { + required string type = 2; + optional int64 id = 3; + optional string name = 4; + } +} + +message Reference { + required string app = 13; + optional string name_space = 20; + required Path path = 14; +} + +message User { + required string email = 1; + required string auth_domain = 2; + optional string nickname = 3; + optional string federated_identity = 6; + optional string federated_provider = 7; +} + +message EntityProto { + required Reference key = 13; + required Path entity_group = 16; + optional User owner = 17; + + enum Kind { + GD_CONTACT = 1; + GD_EVENT = 2; + GD_MESSAGE = 3; + } + optional Kind kind = 4; + optional string kind_uri = 5; + + repeated Property property = 14; + repeated Property raw_property = 15; + + optional int32 rank = 18; +} + +message CompositeProperty { + required int64 index_id = 1; + repeated string value = 2; +} + +message Index { + required string entity_type = 1; + required bool ancestor = 5; + repeated group Property = 2 { + required string name = 3; + enum Direction { + ASCENDING = 1; + DESCENDING = 2; + } + optional Direction direction = 4 [default = ASCENDING]; + } +} + +message CompositeIndex { + required string app_id = 1; + required int64 id = 2; + required Index definition = 3; + + enum State { + WRITE_ONLY = 1; + READ_WRITE = 2; + DELETED = 3; + ERROR = 4; + } + required State state = 4; + + optional bool only_use_if_required = 6 [default = false]; +} + +message IndexPostfix { + message IndexValue { + required string property_name = 1; + required PropertyValue value = 2; + } + + repeated IndexValue index_value = 1; + + optional Reference key = 2; + + optional bool before = 3 [default=true]; +} + +message IndexPosition { + optional string key = 1; + + optional bool before = 2 [default=true]; +} + +message Snapshot { + enum Status { + INACTIVE = 0; + ACTIVE = 1; + } + + required int64 ts = 1; +} + +message InternalHeader { + optional string qos = 1; +} + +message Transaction { + optional InternalHeader header = 4; + required fixed64 handle = 1; + required string app = 2; + optional bool mark_changes = 3 [default = false]; +} + +message Query { + optional InternalHeader header = 39; + + required string app = 1; + optional string name_space = 29; + + optional string kind = 3; + optional Reference ancestor = 17; + + repeated group Filter = 4 { + enum Operator { + LESS_THAN = 1; + LESS_THAN_OR_EQUAL = 2; + GREATER_THAN = 3; + GREATER_THAN_OR_EQUAL = 4; + EQUAL = 5; + IN = 6; + EXISTS = 7; + } + + required Operator op = 6; + repeated Property property = 14; + } + + optional string search_query = 8; + + repeated group Order = 9 { + enum Direction { + ASCENDING = 1; + DESCENDING = 2; + } + + required string property = 10; + optional Direction direction = 11 [default = ASCENDING]; + } + + enum Hint { + ORDER_FIRST = 1; + ANCESTOR_FIRST = 2; + FILTER_FIRST = 3; + } + optional Hint hint = 18; + + optional int32 count = 23; + + optional int32 offset = 12 [default = 0]; + + optional int32 limit = 16; + + optional CompiledCursor compiled_cursor = 30; + optional CompiledCursor end_compiled_cursor = 31; + + repeated CompositeIndex composite_index = 19; + + optional bool require_perfect_plan = 20 [default = false]; + + optional bool keys_only = 21 [default = false]; + + optional Transaction transaction = 22; + + optional bool compile = 25 [default = false]; + + optional int64 failover_ms = 26; + + optional bool strong = 32; + + repeated string property_name = 33; + + repeated string group_by_property_name = 34; + + optional bool distinct = 24; + + optional int64 min_safe_time_seconds = 35; + + repeated string safe_replica_name = 36; + + optional bool persist_offset = 37 [default=false]; +} + +message CompiledQuery { + required group PrimaryScan = 1 { + optional string index_name = 2; + + optional string start_key = 3; + optional bool start_inclusive = 4; + optional string end_key = 5; + optional bool end_inclusive = 6; + + repeated string start_postfix_value = 22; + repeated string end_postfix_value = 23; + + optional int64 end_unapplied_log_timestamp_us = 19; + } + + repeated group MergeJoinScan = 7 { + required string index_name = 8; + + repeated string prefix_value = 9; + + optional bool value_prefix = 20 [default=false]; + } + + optional Index index_def = 21; + + optional int32 offset = 10 [default = 0]; + + optional int32 limit = 11; + + required bool keys_only = 12; + + repeated string property_name = 24; + + optional int32 distinct_infix_size = 25; + + optional group EntityFilter = 13 { + optional bool distinct = 14 [default=false]; + + optional string kind = 17; + optional Reference ancestor = 18; + } +} + +message CompiledCursor { + optional group Position = 2 { + optional string start_key = 27; + + repeated group IndexValue = 29 { + optional string property = 30; + required PropertyValue value = 31; + } + + optional Reference key = 32; + + optional bool start_inclusive = 28 [default=true]; + } +} + +message Cursor { + required fixed64 cursor = 1; + + optional string app = 2; +} + +message Error { + enum ErrorCode { + BAD_REQUEST = 1; + CONCURRENT_TRANSACTION = 2; + INTERNAL_ERROR = 3; + NEED_INDEX = 4; + TIMEOUT = 5; + PERMISSION_DENIED = 6; + BIGTABLE_ERROR = 7; + COMMITTED_BUT_STILL_APPLYING = 8; + CAPABILITY_DISABLED = 9; + TRY_ALTERNATE_BACKEND = 10; + SAFE_TIME_TOO_OLD = 11; + } +} + +message Cost { + optional int32 index_writes = 1; + optional int32 index_write_bytes = 2; + optional int32 entity_writes = 3; + optional int32 entity_write_bytes = 4; + optional group CommitCost = 5 { + optional int32 requested_entity_puts = 6; + optional int32 requested_entity_deletes = 7; + }; + optional int32 approximate_storage_delta = 8; + optional int32 id_sequence_updates = 9; +} + +message GetRequest { + optional InternalHeader header = 6; + + repeated Reference key = 1; + optional Transaction transaction = 2; + + optional int64 failover_ms = 3; + + optional bool strong = 4; + + optional bool allow_deferred = 5 [default=false]; +} + +message GetResponse { + repeated group Entity = 1 { + optional EntityProto entity = 2; + optional Reference key = 4; + + optional int64 version = 3; + } + + repeated Reference deferred = 5; + + optional bool in_order = 6 [default=true]; +} + +message PutRequest { + optional InternalHeader header = 11; + + repeated EntityProto entity = 1; + optional Transaction transaction = 2; + repeated CompositeIndex composite_index = 3; + + optional bool trusted = 4 [default = false]; + + optional bool force = 7 [default = false]; + + optional bool mark_changes = 8 [default = false]; + repeated Snapshot snapshot = 9; + + enum AutoIdPolicy { + CURRENT = 0; + SEQUENTIAL = 1; + } + optional AutoIdPolicy auto_id_policy = 10 [default = CURRENT]; +} + +message PutResponse { + repeated Reference key = 1; + optional Cost cost = 2; + repeated int64 version = 3; +} + +message TouchRequest { + optional InternalHeader header = 10; + + repeated Reference key = 1; + repeated CompositeIndex composite_index = 2; + optional bool force = 3 [default = false]; + repeated Snapshot snapshot = 9; +} + +message TouchResponse { + optional Cost cost = 1; +} + +message DeleteRequest { + optional InternalHeader header = 10; + + repeated Reference key = 6; + optional Transaction transaction = 5; + + optional bool trusted = 4 [default = false]; + + optional bool force = 7 [default = false]; + + optional bool mark_changes = 8 [default = false]; + repeated Snapshot snapshot = 9; +} + +message DeleteResponse { + optional Cost cost = 1; + repeated int64 version = 3; +} + +message NextRequest { + optional InternalHeader header = 5; + + required Cursor cursor = 1; + optional int32 count = 2; + + optional int32 offset = 4 [default = 0]; + + optional bool compile = 3 [default = false]; +} + +message QueryResult { + optional Cursor cursor = 1; + + repeated EntityProto result = 2; + + optional int32 skipped_results = 7; + + required bool more_results = 3; + + optional bool keys_only = 4; + + optional bool index_only = 9; + + optional bool small_ops = 10; + + optional CompiledQuery compiled_query = 5; + + optional CompiledCursor compiled_cursor = 6; + + repeated CompositeIndex index = 8; + + repeated int64 version = 11; +} + +message AllocateIdsRequest { + optional InternalHeader header = 4; + + optional Reference model_key = 1; + + optional int64 size = 2; + + optional int64 max = 3; + + repeated Reference reserve = 5; +} + +message AllocateIdsResponse { + required int64 start = 1; + required int64 end = 2; + optional Cost cost = 3; +} + +message CompositeIndices { + repeated CompositeIndex index = 1; +} + +message AddActionsRequest { + optional InternalHeader header = 3; + + required Transaction transaction = 1; + repeated Action action = 2; +} + +message AddActionsResponse { +} + +message BeginTransactionRequest { + optional InternalHeader header = 3; + + required string app = 1; + optional bool allow_multiple_eg = 2 [default = false]; + optional string database_id = 4; + + enum TransactionMode { + UNKNOWN = 0; + READ_ONLY = 1; + READ_WRITE = 2; + } + optional TransactionMode mode = 5 [default = UNKNOWN]; + + optional Transaction previous_transaction = 7; +} + +message CommitResponse { + optional Cost cost = 1; + + repeated group Version = 3 { + required Reference root_entity_key = 4; + required int64 version = 5; + } +} diff --git a/vendor/google.golang.org/appengine/internal/identity.go b/vendor/google.golang.org/appengine/internal/identity.go new file mode 100644 index 000000000..9b4134e42 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/identity.go @@ -0,0 +1,55 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package internal + +import ( + "os" + + netcontext "golang.org/x/net/context" +) + +var ( + // This is set to true in identity_classic.go, which is behind the appengine build tag. + // The appengine build tag is set for the first generation runtimes (<= Go 1.9) but not + // the second generation runtimes (>= Go 1.11), so this indicates whether we're on a + // first-gen runtime. See IsStandard below for the second-gen check. + appengineStandard bool + + // This is set to true in identity_flex.go, which is behind the appenginevm build tag. + appengineFlex bool +) + +// AppID is the implementation of the wrapper function of the same name in +// ../identity.go. See that file for commentary. +func AppID(c netcontext.Context) string { + return appID(FullyQualifiedAppID(c)) +} + +// IsStandard is the implementation of the wrapper function of the same name in +// ../appengine.go. See that file for commentary. +func IsStandard() bool { + // appengineStandard will be true for first-gen runtimes (<= Go 1.9) but not + // second-gen (>= Go 1.11). + return appengineStandard || IsSecondGen() +} + +// IsStandard is the implementation of the wrapper function of the same name in +// ../appengine.go. See that file for commentary. +func IsSecondGen() bool { + // Second-gen runtimes set $GAE_ENV so we use that to check if we're on a second-gen runtime. + return os.Getenv("GAE_ENV") == "standard" +} + +// IsFlex is the implementation of the wrapper function of the same name in +// ../appengine.go. See that file for commentary. +func IsFlex() bool { + return appengineFlex +} + +// IsAppEngine is the implementation of the wrapper function of the same name in +// ../appengine.go. See that file for commentary. +func IsAppEngine() bool { + return IsStandard() || IsFlex() +} diff --git a/vendor/google.golang.org/appengine/internal/identity_classic.go b/vendor/google.golang.org/appengine/internal/identity_classic.go new file mode 100644 index 000000000..4e979f45e --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/identity_classic.go @@ -0,0 +1,61 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build appengine + +package internal + +import ( + "appengine" + + netcontext "golang.org/x/net/context" +) + +func init() { + appengineStandard = true +} + +func DefaultVersionHostname(ctx netcontext.Context) string { + c := fromContext(ctx) + if c == nil { + panic(errNotAppEngineContext) + } + return appengine.DefaultVersionHostname(c) +} + +func Datacenter(_ netcontext.Context) string { return appengine.Datacenter() } +func ServerSoftware() string { return appengine.ServerSoftware() } +func InstanceID() string { return appengine.InstanceID() } +func IsDevAppServer() bool { return appengine.IsDevAppServer() } + +func RequestID(ctx netcontext.Context) string { + c := fromContext(ctx) + if c == nil { + panic(errNotAppEngineContext) + } + return appengine.RequestID(c) +} + +func ModuleName(ctx netcontext.Context) string { + c := fromContext(ctx) + if c == nil { + panic(errNotAppEngineContext) + } + return appengine.ModuleName(c) +} +func VersionID(ctx netcontext.Context) string { + c := fromContext(ctx) + if c == nil { + panic(errNotAppEngineContext) + } + return appengine.VersionID(c) +} + +func fullyQualifiedAppID(ctx netcontext.Context) string { + c := fromContext(ctx) + if c == nil { + panic(errNotAppEngineContext) + } + return c.FullyQualifiedAppID() +} diff --git a/vendor/google.golang.org/appengine/internal/identity_flex.go b/vendor/google.golang.org/appengine/internal/identity_flex.go new file mode 100644 index 000000000..d5e2e7b5e --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/identity_flex.go @@ -0,0 +1,11 @@ +// Copyright 2018 Google LLC. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build appenginevm + +package internal + +func init() { + appengineFlex = true +} diff --git a/vendor/google.golang.org/appengine/internal/identity_vm.go b/vendor/google.golang.org/appengine/internal/identity_vm.go new file mode 100644 index 000000000..5d8067263 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/identity_vm.go @@ -0,0 +1,134 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package internal + +import ( + "log" + "net/http" + "os" + "strings" + + netcontext "golang.org/x/net/context" +) + +// These functions are implementations of the wrapper functions +// in ../appengine/identity.go. See that file for commentary. + +const ( + hDefaultVersionHostname = "X-AppEngine-Default-Version-Hostname" + hRequestLogId = "X-AppEngine-Request-Log-Id" + hDatacenter = "X-AppEngine-Datacenter" +) + +func ctxHeaders(ctx netcontext.Context) http.Header { + c := fromContext(ctx) + if c == nil { + return nil + } + return c.Request().Header +} + +func DefaultVersionHostname(ctx netcontext.Context) string { + return ctxHeaders(ctx).Get(hDefaultVersionHostname) +} + +func RequestID(ctx netcontext.Context) string { + return ctxHeaders(ctx).Get(hRequestLogId) +} + +func Datacenter(ctx netcontext.Context) string { + if dc := ctxHeaders(ctx).Get(hDatacenter); dc != "" { + return dc + } + // If the header isn't set, read zone from the metadata service. + // It has the format projects/[NUMERIC_PROJECT_ID]/zones/[ZONE] + zone, err := getMetadata("instance/zone") + if err != nil { + log.Printf("Datacenter: %v", err) + return "" + } + parts := strings.Split(string(zone), "/") + if len(parts) == 0 { + return "" + } + return parts[len(parts)-1] +} + +func ServerSoftware() string { + // TODO(dsymonds): Remove fallback when we've verified this. + if s := os.Getenv("SERVER_SOFTWARE"); s != "" { + return s + } + if s := os.Getenv("GAE_ENV"); s != "" { + return s + } + return "Google App Engine/1.x.x" +} + +// TODO(dsymonds): Remove the metadata fetches. + +func ModuleName(_ netcontext.Context) string { + if s := os.Getenv("GAE_MODULE_NAME"); s != "" { + return s + } + if s := os.Getenv("GAE_SERVICE"); s != "" { + return s + } + return string(mustGetMetadata("instance/attributes/gae_backend_name")) +} + +func VersionID(_ netcontext.Context) string { + if s1, s2 := os.Getenv("GAE_MODULE_VERSION"), os.Getenv("GAE_MINOR_VERSION"); s1 != "" && s2 != "" { + return s1 + "." + s2 + } + if s1, s2 := os.Getenv("GAE_VERSION"), os.Getenv("GAE_DEPLOYMENT_ID"); s1 != "" && s2 != "" { + return s1 + "." + s2 + } + return string(mustGetMetadata("instance/attributes/gae_backend_version")) + "." + string(mustGetMetadata("instance/attributes/gae_backend_minor_version")) +} + +func InstanceID() string { + if s := os.Getenv("GAE_MODULE_INSTANCE"); s != "" { + return s + } + if s := os.Getenv("GAE_INSTANCE"); s != "" { + return s + } + return string(mustGetMetadata("instance/attributes/gae_backend_instance")) +} + +func partitionlessAppID() string { + // gae_project has everything except the partition prefix. + if appID := os.Getenv("GAE_LONG_APP_ID"); appID != "" { + return appID + } + if project := os.Getenv("GOOGLE_CLOUD_PROJECT"); project != "" { + return project + } + return string(mustGetMetadata("instance/attributes/gae_project")) +} + +func fullyQualifiedAppID(_ netcontext.Context) string { + if s := os.Getenv("GAE_APPLICATION"); s != "" { + return s + } + appID := partitionlessAppID() + + part := os.Getenv("GAE_PARTITION") + if part == "" { + part = string(mustGetMetadata("instance/attributes/gae_partition")) + } + + if part != "" { + appID = part + "~" + appID + } + return appID +} + +func IsDevAppServer() bool { + return os.Getenv("RUN_WITH_DEVAPPSERVER") != "" +} diff --git a/vendor/google.golang.org/appengine/internal/image/images_service.pb.go b/vendor/google.golang.org/appengine/internal/image/images_service.pb.go new file mode 100644 index 000000000..2a229d87e --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/image/images_service.pb.go @@ -0,0 +1,1375 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/image/images_service.proto + +package image + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type ImagesServiceError_ErrorCode int32 + +const ( + ImagesServiceError_UNSPECIFIED_ERROR ImagesServiceError_ErrorCode = 1 + ImagesServiceError_BAD_TRANSFORM_DATA ImagesServiceError_ErrorCode = 2 + ImagesServiceError_NOT_IMAGE ImagesServiceError_ErrorCode = 3 + ImagesServiceError_BAD_IMAGE_DATA ImagesServiceError_ErrorCode = 4 + ImagesServiceError_IMAGE_TOO_LARGE ImagesServiceError_ErrorCode = 5 + ImagesServiceError_INVALID_BLOB_KEY ImagesServiceError_ErrorCode = 6 + ImagesServiceError_ACCESS_DENIED ImagesServiceError_ErrorCode = 7 + ImagesServiceError_OBJECT_NOT_FOUND ImagesServiceError_ErrorCode = 8 +) + +var ImagesServiceError_ErrorCode_name = map[int32]string{ + 1: "UNSPECIFIED_ERROR", + 2: "BAD_TRANSFORM_DATA", + 3: "NOT_IMAGE", + 4: "BAD_IMAGE_DATA", + 5: "IMAGE_TOO_LARGE", + 6: "INVALID_BLOB_KEY", + 7: "ACCESS_DENIED", + 8: "OBJECT_NOT_FOUND", +} +var ImagesServiceError_ErrorCode_value = map[string]int32{ + "UNSPECIFIED_ERROR": 1, + "BAD_TRANSFORM_DATA": 2, + "NOT_IMAGE": 3, + "BAD_IMAGE_DATA": 4, + "IMAGE_TOO_LARGE": 5, + "INVALID_BLOB_KEY": 6, + "ACCESS_DENIED": 7, + "OBJECT_NOT_FOUND": 8, +} + +func (x ImagesServiceError_ErrorCode) Enum() *ImagesServiceError_ErrorCode { + p := new(ImagesServiceError_ErrorCode) + *p = x + return p +} +func (x ImagesServiceError_ErrorCode) String() string { + return proto.EnumName(ImagesServiceError_ErrorCode_name, int32(x)) +} +func (x *ImagesServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ImagesServiceError_ErrorCode_value, data, "ImagesServiceError_ErrorCode") + if err != nil { + return err + } + *x = ImagesServiceError_ErrorCode(value) + return nil +} +func (ImagesServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{0, 0} +} + +type ImagesServiceTransform_Type int32 + +const ( + ImagesServiceTransform_RESIZE ImagesServiceTransform_Type = 1 + ImagesServiceTransform_ROTATE ImagesServiceTransform_Type = 2 + ImagesServiceTransform_HORIZONTAL_FLIP ImagesServiceTransform_Type = 3 + ImagesServiceTransform_VERTICAL_FLIP ImagesServiceTransform_Type = 4 + ImagesServiceTransform_CROP ImagesServiceTransform_Type = 5 + ImagesServiceTransform_IM_FEELING_LUCKY ImagesServiceTransform_Type = 6 +) + +var ImagesServiceTransform_Type_name = map[int32]string{ + 1: "RESIZE", + 2: "ROTATE", + 3: "HORIZONTAL_FLIP", + 4: "VERTICAL_FLIP", + 5: "CROP", + 6: "IM_FEELING_LUCKY", +} +var ImagesServiceTransform_Type_value = map[string]int32{ + "RESIZE": 1, + "ROTATE": 2, + "HORIZONTAL_FLIP": 3, + "VERTICAL_FLIP": 4, + "CROP": 5, + "IM_FEELING_LUCKY": 6, +} + +func (x ImagesServiceTransform_Type) Enum() *ImagesServiceTransform_Type { + p := new(ImagesServiceTransform_Type) + *p = x + return p +} +func (x ImagesServiceTransform_Type) String() string { + return proto.EnumName(ImagesServiceTransform_Type_name, int32(x)) +} +func (x *ImagesServiceTransform_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ImagesServiceTransform_Type_value, data, "ImagesServiceTransform_Type") + if err != nil { + return err + } + *x = ImagesServiceTransform_Type(value) + return nil +} +func (ImagesServiceTransform_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{1, 0} +} + +type InputSettings_ORIENTATION_CORRECTION_TYPE int32 + +const ( + InputSettings_UNCHANGED_ORIENTATION InputSettings_ORIENTATION_CORRECTION_TYPE = 0 + InputSettings_CORRECT_ORIENTATION InputSettings_ORIENTATION_CORRECTION_TYPE = 1 +) + +var InputSettings_ORIENTATION_CORRECTION_TYPE_name = map[int32]string{ + 0: "UNCHANGED_ORIENTATION", + 1: "CORRECT_ORIENTATION", +} +var InputSettings_ORIENTATION_CORRECTION_TYPE_value = map[string]int32{ + "UNCHANGED_ORIENTATION": 0, + "CORRECT_ORIENTATION": 1, +} + +func (x InputSettings_ORIENTATION_CORRECTION_TYPE) Enum() *InputSettings_ORIENTATION_CORRECTION_TYPE { + p := new(InputSettings_ORIENTATION_CORRECTION_TYPE) + *p = x + return p +} +func (x InputSettings_ORIENTATION_CORRECTION_TYPE) String() string { + return proto.EnumName(InputSettings_ORIENTATION_CORRECTION_TYPE_name, int32(x)) +} +func (x *InputSettings_ORIENTATION_CORRECTION_TYPE) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(InputSettings_ORIENTATION_CORRECTION_TYPE_value, data, "InputSettings_ORIENTATION_CORRECTION_TYPE") + if err != nil { + return err + } + *x = InputSettings_ORIENTATION_CORRECTION_TYPE(value) + return nil +} +func (InputSettings_ORIENTATION_CORRECTION_TYPE) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{4, 0} +} + +type OutputSettings_MIME_TYPE int32 + +const ( + OutputSettings_PNG OutputSettings_MIME_TYPE = 0 + OutputSettings_JPEG OutputSettings_MIME_TYPE = 1 + OutputSettings_WEBP OutputSettings_MIME_TYPE = 2 +) + +var OutputSettings_MIME_TYPE_name = map[int32]string{ + 0: "PNG", + 1: "JPEG", + 2: "WEBP", +} +var OutputSettings_MIME_TYPE_value = map[string]int32{ + "PNG": 0, + "JPEG": 1, + "WEBP": 2, +} + +func (x OutputSettings_MIME_TYPE) Enum() *OutputSettings_MIME_TYPE { + p := new(OutputSettings_MIME_TYPE) + *p = x + return p +} +func (x OutputSettings_MIME_TYPE) String() string { + return proto.EnumName(OutputSettings_MIME_TYPE_name, int32(x)) +} +func (x *OutputSettings_MIME_TYPE) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(OutputSettings_MIME_TYPE_value, data, "OutputSettings_MIME_TYPE") + if err != nil { + return err + } + *x = OutputSettings_MIME_TYPE(value) + return nil +} +func (OutputSettings_MIME_TYPE) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{5, 0} +} + +type CompositeImageOptions_ANCHOR int32 + +const ( + CompositeImageOptions_TOP_LEFT CompositeImageOptions_ANCHOR = 0 + CompositeImageOptions_TOP CompositeImageOptions_ANCHOR = 1 + CompositeImageOptions_TOP_RIGHT CompositeImageOptions_ANCHOR = 2 + CompositeImageOptions_LEFT CompositeImageOptions_ANCHOR = 3 + CompositeImageOptions_CENTER CompositeImageOptions_ANCHOR = 4 + CompositeImageOptions_RIGHT CompositeImageOptions_ANCHOR = 5 + CompositeImageOptions_BOTTOM_LEFT CompositeImageOptions_ANCHOR = 6 + CompositeImageOptions_BOTTOM CompositeImageOptions_ANCHOR = 7 + CompositeImageOptions_BOTTOM_RIGHT CompositeImageOptions_ANCHOR = 8 +) + +var CompositeImageOptions_ANCHOR_name = map[int32]string{ + 0: "TOP_LEFT", + 1: "TOP", + 2: "TOP_RIGHT", + 3: "LEFT", + 4: "CENTER", + 5: "RIGHT", + 6: "BOTTOM_LEFT", + 7: "BOTTOM", + 8: "BOTTOM_RIGHT", +} +var CompositeImageOptions_ANCHOR_value = map[string]int32{ + "TOP_LEFT": 0, + "TOP": 1, + "TOP_RIGHT": 2, + "LEFT": 3, + "CENTER": 4, + "RIGHT": 5, + "BOTTOM_LEFT": 6, + "BOTTOM": 7, + "BOTTOM_RIGHT": 8, +} + +func (x CompositeImageOptions_ANCHOR) Enum() *CompositeImageOptions_ANCHOR { + p := new(CompositeImageOptions_ANCHOR) + *p = x + return p +} +func (x CompositeImageOptions_ANCHOR) String() string { + return proto.EnumName(CompositeImageOptions_ANCHOR_name, int32(x)) +} +func (x *CompositeImageOptions_ANCHOR) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(CompositeImageOptions_ANCHOR_value, data, "CompositeImageOptions_ANCHOR") + if err != nil { + return err + } + *x = CompositeImageOptions_ANCHOR(value) + return nil +} +func (CompositeImageOptions_ANCHOR) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{8, 0} +} + +type ImagesServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesServiceError) Reset() { *m = ImagesServiceError{} } +func (m *ImagesServiceError) String() string { return proto.CompactTextString(m) } +func (*ImagesServiceError) ProtoMessage() {} +func (*ImagesServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{0} +} +func (m *ImagesServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesServiceError.Unmarshal(m, b) +} +func (m *ImagesServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesServiceError.Marshal(b, m, deterministic) +} +func (dst *ImagesServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesServiceError.Merge(dst, src) +} +func (m *ImagesServiceError) XXX_Size() int { + return xxx_messageInfo_ImagesServiceError.Size(m) +} +func (m *ImagesServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesServiceError proto.InternalMessageInfo + +type ImagesServiceTransform struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesServiceTransform) Reset() { *m = ImagesServiceTransform{} } +func (m *ImagesServiceTransform) String() string { return proto.CompactTextString(m) } +func (*ImagesServiceTransform) ProtoMessage() {} +func (*ImagesServiceTransform) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{1} +} +func (m *ImagesServiceTransform) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesServiceTransform.Unmarshal(m, b) +} +func (m *ImagesServiceTransform) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesServiceTransform.Marshal(b, m, deterministic) +} +func (dst *ImagesServiceTransform) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesServiceTransform.Merge(dst, src) +} +func (m *ImagesServiceTransform) XXX_Size() int { + return xxx_messageInfo_ImagesServiceTransform.Size(m) +} +func (m *ImagesServiceTransform) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesServiceTransform.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesServiceTransform proto.InternalMessageInfo + +type Transform struct { + Width *int32 `protobuf:"varint,1,opt,name=width" json:"width,omitempty"` + Height *int32 `protobuf:"varint,2,opt,name=height" json:"height,omitempty"` + CropToFit *bool `protobuf:"varint,11,opt,name=crop_to_fit,json=cropToFit,def=0" json:"crop_to_fit,omitempty"` + CropOffsetX *float32 `protobuf:"fixed32,12,opt,name=crop_offset_x,json=cropOffsetX,def=0.5" json:"crop_offset_x,omitempty"` + CropOffsetY *float32 `protobuf:"fixed32,13,opt,name=crop_offset_y,json=cropOffsetY,def=0.5" json:"crop_offset_y,omitempty"` + Rotate *int32 `protobuf:"varint,3,opt,name=rotate,def=0" json:"rotate,omitempty"` + HorizontalFlip *bool `protobuf:"varint,4,opt,name=horizontal_flip,json=horizontalFlip,def=0" json:"horizontal_flip,omitempty"` + VerticalFlip *bool `protobuf:"varint,5,opt,name=vertical_flip,json=verticalFlip,def=0" json:"vertical_flip,omitempty"` + CropLeftX *float32 `protobuf:"fixed32,6,opt,name=crop_left_x,json=cropLeftX,def=0" json:"crop_left_x,omitempty"` + CropTopY *float32 `protobuf:"fixed32,7,opt,name=crop_top_y,json=cropTopY,def=0" json:"crop_top_y,omitempty"` + CropRightX *float32 `protobuf:"fixed32,8,opt,name=crop_right_x,json=cropRightX,def=1" json:"crop_right_x,omitempty"` + CropBottomY *float32 `protobuf:"fixed32,9,opt,name=crop_bottom_y,json=cropBottomY,def=1" json:"crop_bottom_y,omitempty"` + Autolevels *bool `protobuf:"varint,10,opt,name=autolevels,def=0" json:"autolevels,omitempty"` + AllowStretch *bool `protobuf:"varint,14,opt,name=allow_stretch,json=allowStretch,def=0" json:"allow_stretch,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Transform) Reset() { *m = Transform{} } +func (m *Transform) String() string { return proto.CompactTextString(m) } +func (*Transform) ProtoMessage() {} +func (*Transform) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{2} +} +func (m *Transform) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Transform.Unmarshal(m, b) +} +func (m *Transform) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Transform.Marshal(b, m, deterministic) +} +func (dst *Transform) XXX_Merge(src proto.Message) { + xxx_messageInfo_Transform.Merge(dst, src) +} +func (m *Transform) XXX_Size() int { + return xxx_messageInfo_Transform.Size(m) +} +func (m *Transform) XXX_DiscardUnknown() { + xxx_messageInfo_Transform.DiscardUnknown(m) +} + +var xxx_messageInfo_Transform proto.InternalMessageInfo + +const Default_Transform_CropToFit bool = false +const Default_Transform_CropOffsetX float32 = 0.5 +const Default_Transform_CropOffsetY float32 = 0.5 +const Default_Transform_Rotate int32 = 0 +const Default_Transform_HorizontalFlip bool = false +const Default_Transform_VerticalFlip bool = false +const Default_Transform_CropLeftX float32 = 0 +const Default_Transform_CropTopY float32 = 0 +const Default_Transform_CropRightX float32 = 1 +const Default_Transform_CropBottomY float32 = 1 +const Default_Transform_Autolevels bool = false +const Default_Transform_AllowStretch bool = false + +func (m *Transform) GetWidth() int32 { + if m != nil && m.Width != nil { + return *m.Width + } + return 0 +} + +func (m *Transform) GetHeight() int32 { + if m != nil && m.Height != nil { + return *m.Height + } + return 0 +} + +func (m *Transform) GetCropToFit() bool { + if m != nil && m.CropToFit != nil { + return *m.CropToFit + } + return Default_Transform_CropToFit +} + +func (m *Transform) GetCropOffsetX() float32 { + if m != nil && m.CropOffsetX != nil { + return *m.CropOffsetX + } + return Default_Transform_CropOffsetX +} + +func (m *Transform) GetCropOffsetY() float32 { + if m != nil && m.CropOffsetY != nil { + return *m.CropOffsetY + } + return Default_Transform_CropOffsetY +} + +func (m *Transform) GetRotate() int32 { + if m != nil && m.Rotate != nil { + return *m.Rotate + } + return Default_Transform_Rotate +} + +func (m *Transform) GetHorizontalFlip() bool { + if m != nil && m.HorizontalFlip != nil { + return *m.HorizontalFlip + } + return Default_Transform_HorizontalFlip +} + +func (m *Transform) GetVerticalFlip() bool { + if m != nil && m.VerticalFlip != nil { + return *m.VerticalFlip + } + return Default_Transform_VerticalFlip +} + +func (m *Transform) GetCropLeftX() float32 { + if m != nil && m.CropLeftX != nil { + return *m.CropLeftX + } + return Default_Transform_CropLeftX +} + +func (m *Transform) GetCropTopY() float32 { + if m != nil && m.CropTopY != nil { + return *m.CropTopY + } + return Default_Transform_CropTopY +} + +func (m *Transform) GetCropRightX() float32 { + if m != nil && m.CropRightX != nil { + return *m.CropRightX + } + return Default_Transform_CropRightX +} + +func (m *Transform) GetCropBottomY() float32 { + if m != nil && m.CropBottomY != nil { + return *m.CropBottomY + } + return Default_Transform_CropBottomY +} + +func (m *Transform) GetAutolevels() bool { + if m != nil && m.Autolevels != nil { + return *m.Autolevels + } + return Default_Transform_Autolevels +} + +func (m *Transform) GetAllowStretch() bool { + if m != nil && m.AllowStretch != nil { + return *m.AllowStretch + } + return Default_Transform_AllowStretch +} + +type ImageData struct { + Content []byte `protobuf:"bytes,1,req,name=content" json:"content,omitempty"` + BlobKey *string `protobuf:"bytes,2,opt,name=blob_key,json=blobKey" json:"blob_key,omitempty"` + Width *int32 `protobuf:"varint,3,opt,name=width" json:"width,omitempty"` + Height *int32 `protobuf:"varint,4,opt,name=height" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageData) Reset() { *m = ImageData{} } +func (m *ImageData) String() string { return proto.CompactTextString(m) } +func (*ImageData) ProtoMessage() {} +func (*ImageData) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{3} +} +func (m *ImageData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImageData.Unmarshal(m, b) +} +func (m *ImageData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImageData.Marshal(b, m, deterministic) +} +func (dst *ImageData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageData.Merge(dst, src) +} +func (m *ImageData) XXX_Size() int { + return xxx_messageInfo_ImageData.Size(m) +} +func (m *ImageData) XXX_DiscardUnknown() { + xxx_messageInfo_ImageData.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageData proto.InternalMessageInfo + +func (m *ImageData) GetContent() []byte { + if m != nil { + return m.Content + } + return nil +} + +func (m *ImageData) GetBlobKey() string { + if m != nil && m.BlobKey != nil { + return *m.BlobKey + } + return "" +} + +func (m *ImageData) GetWidth() int32 { + if m != nil && m.Width != nil { + return *m.Width + } + return 0 +} + +func (m *ImageData) GetHeight() int32 { + if m != nil && m.Height != nil { + return *m.Height + } + return 0 +} + +type InputSettings struct { + CorrectExifOrientation *InputSettings_ORIENTATION_CORRECTION_TYPE `protobuf:"varint,1,opt,name=correct_exif_orientation,json=correctExifOrientation,enum=appengine.InputSettings_ORIENTATION_CORRECTION_TYPE,def=0" json:"correct_exif_orientation,omitempty"` + ParseMetadata *bool `protobuf:"varint,2,opt,name=parse_metadata,json=parseMetadata,def=0" json:"parse_metadata,omitempty"` + TransparentSubstitutionRgb *int32 `protobuf:"varint,3,opt,name=transparent_substitution_rgb,json=transparentSubstitutionRgb" json:"transparent_substitution_rgb,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InputSettings) Reset() { *m = InputSettings{} } +func (m *InputSettings) String() string { return proto.CompactTextString(m) } +func (*InputSettings) ProtoMessage() {} +func (*InputSettings) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{4} +} +func (m *InputSettings) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InputSettings.Unmarshal(m, b) +} +func (m *InputSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InputSettings.Marshal(b, m, deterministic) +} +func (dst *InputSettings) XXX_Merge(src proto.Message) { + xxx_messageInfo_InputSettings.Merge(dst, src) +} +func (m *InputSettings) XXX_Size() int { + return xxx_messageInfo_InputSettings.Size(m) +} +func (m *InputSettings) XXX_DiscardUnknown() { + xxx_messageInfo_InputSettings.DiscardUnknown(m) +} + +var xxx_messageInfo_InputSettings proto.InternalMessageInfo + +const Default_InputSettings_CorrectExifOrientation InputSettings_ORIENTATION_CORRECTION_TYPE = InputSettings_UNCHANGED_ORIENTATION +const Default_InputSettings_ParseMetadata bool = false + +func (m *InputSettings) GetCorrectExifOrientation() InputSettings_ORIENTATION_CORRECTION_TYPE { + if m != nil && m.CorrectExifOrientation != nil { + return *m.CorrectExifOrientation + } + return Default_InputSettings_CorrectExifOrientation +} + +func (m *InputSettings) GetParseMetadata() bool { + if m != nil && m.ParseMetadata != nil { + return *m.ParseMetadata + } + return Default_InputSettings_ParseMetadata +} + +func (m *InputSettings) GetTransparentSubstitutionRgb() int32 { + if m != nil && m.TransparentSubstitutionRgb != nil { + return *m.TransparentSubstitutionRgb + } + return 0 +} + +type OutputSettings struct { + MimeType *OutputSettings_MIME_TYPE `protobuf:"varint,1,opt,name=mime_type,json=mimeType,enum=appengine.OutputSettings_MIME_TYPE,def=0" json:"mime_type,omitempty"` + Quality *int32 `protobuf:"varint,2,opt,name=quality" json:"quality,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OutputSettings) Reset() { *m = OutputSettings{} } +func (m *OutputSettings) String() string { return proto.CompactTextString(m) } +func (*OutputSettings) ProtoMessage() {} +func (*OutputSettings) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{5} +} +func (m *OutputSettings) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OutputSettings.Unmarshal(m, b) +} +func (m *OutputSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OutputSettings.Marshal(b, m, deterministic) +} +func (dst *OutputSettings) XXX_Merge(src proto.Message) { + xxx_messageInfo_OutputSettings.Merge(dst, src) +} +func (m *OutputSettings) XXX_Size() int { + return xxx_messageInfo_OutputSettings.Size(m) +} +func (m *OutputSettings) XXX_DiscardUnknown() { + xxx_messageInfo_OutputSettings.DiscardUnknown(m) +} + +var xxx_messageInfo_OutputSettings proto.InternalMessageInfo + +const Default_OutputSettings_MimeType OutputSettings_MIME_TYPE = OutputSettings_PNG + +func (m *OutputSettings) GetMimeType() OutputSettings_MIME_TYPE { + if m != nil && m.MimeType != nil { + return *m.MimeType + } + return Default_OutputSettings_MimeType +} + +func (m *OutputSettings) GetQuality() int32 { + if m != nil && m.Quality != nil { + return *m.Quality + } + return 0 +} + +type ImagesTransformRequest struct { + Image *ImageData `protobuf:"bytes,1,req,name=image" json:"image,omitempty"` + Transform []*Transform `protobuf:"bytes,2,rep,name=transform" json:"transform,omitempty"` + Output *OutputSettings `protobuf:"bytes,3,req,name=output" json:"output,omitempty"` + Input *InputSettings `protobuf:"bytes,4,opt,name=input" json:"input,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesTransformRequest) Reset() { *m = ImagesTransformRequest{} } +func (m *ImagesTransformRequest) String() string { return proto.CompactTextString(m) } +func (*ImagesTransformRequest) ProtoMessage() {} +func (*ImagesTransformRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{6} +} +func (m *ImagesTransformRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesTransformRequest.Unmarshal(m, b) +} +func (m *ImagesTransformRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesTransformRequest.Marshal(b, m, deterministic) +} +func (dst *ImagesTransformRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesTransformRequest.Merge(dst, src) +} +func (m *ImagesTransformRequest) XXX_Size() int { + return xxx_messageInfo_ImagesTransformRequest.Size(m) +} +func (m *ImagesTransformRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesTransformRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesTransformRequest proto.InternalMessageInfo + +func (m *ImagesTransformRequest) GetImage() *ImageData { + if m != nil { + return m.Image + } + return nil +} + +func (m *ImagesTransformRequest) GetTransform() []*Transform { + if m != nil { + return m.Transform + } + return nil +} + +func (m *ImagesTransformRequest) GetOutput() *OutputSettings { + if m != nil { + return m.Output + } + return nil +} + +func (m *ImagesTransformRequest) GetInput() *InputSettings { + if m != nil { + return m.Input + } + return nil +} + +type ImagesTransformResponse struct { + Image *ImageData `protobuf:"bytes,1,req,name=image" json:"image,omitempty"` + SourceMetadata *string `protobuf:"bytes,2,opt,name=source_metadata,json=sourceMetadata" json:"source_metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesTransformResponse) Reset() { *m = ImagesTransformResponse{} } +func (m *ImagesTransformResponse) String() string { return proto.CompactTextString(m) } +func (*ImagesTransformResponse) ProtoMessage() {} +func (*ImagesTransformResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{7} +} +func (m *ImagesTransformResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesTransformResponse.Unmarshal(m, b) +} +func (m *ImagesTransformResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesTransformResponse.Marshal(b, m, deterministic) +} +func (dst *ImagesTransformResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesTransformResponse.Merge(dst, src) +} +func (m *ImagesTransformResponse) XXX_Size() int { + return xxx_messageInfo_ImagesTransformResponse.Size(m) +} +func (m *ImagesTransformResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesTransformResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesTransformResponse proto.InternalMessageInfo + +func (m *ImagesTransformResponse) GetImage() *ImageData { + if m != nil { + return m.Image + } + return nil +} + +func (m *ImagesTransformResponse) GetSourceMetadata() string { + if m != nil && m.SourceMetadata != nil { + return *m.SourceMetadata + } + return "" +} + +type CompositeImageOptions struct { + SourceIndex *int32 `protobuf:"varint,1,req,name=source_index,json=sourceIndex" json:"source_index,omitempty"` + XOffset *int32 `protobuf:"varint,2,req,name=x_offset,json=xOffset" json:"x_offset,omitempty"` + YOffset *int32 `protobuf:"varint,3,req,name=y_offset,json=yOffset" json:"y_offset,omitempty"` + Opacity *float32 `protobuf:"fixed32,4,req,name=opacity" json:"opacity,omitempty"` + Anchor *CompositeImageOptions_ANCHOR `protobuf:"varint,5,req,name=anchor,enum=appengine.CompositeImageOptions_ANCHOR" json:"anchor,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompositeImageOptions) Reset() { *m = CompositeImageOptions{} } +func (m *CompositeImageOptions) String() string { return proto.CompactTextString(m) } +func (*CompositeImageOptions) ProtoMessage() {} +func (*CompositeImageOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{8} +} +func (m *CompositeImageOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CompositeImageOptions.Unmarshal(m, b) +} +func (m *CompositeImageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CompositeImageOptions.Marshal(b, m, deterministic) +} +func (dst *CompositeImageOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompositeImageOptions.Merge(dst, src) +} +func (m *CompositeImageOptions) XXX_Size() int { + return xxx_messageInfo_CompositeImageOptions.Size(m) +} +func (m *CompositeImageOptions) XXX_DiscardUnknown() { + xxx_messageInfo_CompositeImageOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_CompositeImageOptions proto.InternalMessageInfo + +func (m *CompositeImageOptions) GetSourceIndex() int32 { + if m != nil && m.SourceIndex != nil { + return *m.SourceIndex + } + return 0 +} + +func (m *CompositeImageOptions) GetXOffset() int32 { + if m != nil && m.XOffset != nil { + return *m.XOffset + } + return 0 +} + +func (m *CompositeImageOptions) GetYOffset() int32 { + if m != nil && m.YOffset != nil { + return *m.YOffset + } + return 0 +} + +func (m *CompositeImageOptions) GetOpacity() float32 { + if m != nil && m.Opacity != nil { + return *m.Opacity + } + return 0 +} + +func (m *CompositeImageOptions) GetAnchor() CompositeImageOptions_ANCHOR { + if m != nil && m.Anchor != nil { + return *m.Anchor + } + return CompositeImageOptions_TOP_LEFT +} + +type ImagesCanvas struct { + Width *int32 `protobuf:"varint,1,req,name=width" json:"width,omitempty"` + Height *int32 `protobuf:"varint,2,req,name=height" json:"height,omitempty"` + Output *OutputSettings `protobuf:"bytes,3,req,name=output" json:"output,omitempty"` + Color *int32 `protobuf:"varint,4,opt,name=color,def=-1" json:"color,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesCanvas) Reset() { *m = ImagesCanvas{} } +func (m *ImagesCanvas) String() string { return proto.CompactTextString(m) } +func (*ImagesCanvas) ProtoMessage() {} +func (*ImagesCanvas) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{9} +} +func (m *ImagesCanvas) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesCanvas.Unmarshal(m, b) +} +func (m *ImagesCanvas) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesCanvas.Marshal(b, m, deterministic) +} +func (dst *ImagesCanvas) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesCanvas.Merge(dst, src) +} +func (m *ImagesCanvas) XXX_Size() int { + return xxx_messageInfo_ImagesCanvas.Size(m) +} +func (m *ImagesCanvas) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesCanvas.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesCanvas proto.InternalMessageInfo + +const Default_ImagesCanvas_Color int32 = -1 + +func (m *ImagesCanvas) GetWidth() int32 { + if m != nil && m.Width != nil { + return *m.Width + } + return 0 +} + +func (m *ImagesCanvas) GetHeight() int32 { + if m != nil && m.Height != nil { + return *m.Height + } + return 0 +} + +func (m *ImagesCanvas) GetOutput() *OutputSettings { + if m != nil { + return m.Output + } + return nil +} + +func (m *ImagesCanvas) GetColor() int32 { + if m != nil && m.Color != nil { + return *m.Color + } + return Default_ImagesCanvas_Color +} + +type ImagesCompositeRequest struct { + Image []*ImageData `protobuf:"bytes,1,rep,name=image" json:"image,omitempty"` + Options []*CompositeImageOptions `protobuf:"bytes,2,rep,name=options" json:"options,omitempty"` + Canvas *ImagesCanvas `protobuf:"bytes,3,req,name=canvas" json:"canvas,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesCompositeRequest) Reset() { *m = ImagesCompositeRequest{} } +func (m *ImagesCompositeRequest) String() string { return proto.CompactTextString(m) } +func (*ImagesCompositeRequest) ProtoMessage() {} +func (*ImagesCompositeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{10} +} +func (m *ImagesCompositeRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesCompositeRequest.Unmarshal(m, b) +} +func (m *ImagesCompositeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesCompositeRequest.Marshal(b, m, deterministic) +} +func (dst *ImagesCompositeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesCompositeRequest.Merge(dst, src) +} +func (m *ImagesCompositeRequest) XXX_Size() int { + return xxx_messageInfo_ImagesCompositeRequest.Size(m) +} +func (m *ImagesCompositeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesCompositeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesCompositeRequest proto.InternalMessageInfo + +func (m *ImagesCompositeRequest) GetImage() []*ImageData { + if m != nil { + return m.Image + } + return nil +} + +func (m *ImagesCompositeRequest) GetOptions() []*CompositeImageOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *ImagesCompositeRequest) GetCanvas() *ImagesCanvas { + if m != nil { + return m.Canvas + } + return nil +} + +type ImagesCompositeResponse struct { + Image *ImageData `protobuf:"bytes,1,req,name=image" json:"image,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesCompositeResponse) Reset() { *m = ImagesCompositeResponse{} } +func (m *ImagesCompositeResponse) String() string { return proto.CompactTextString(m) } +func (*ImagesCompositeResponse) ProtoMessage() {} +func (*ImagesCompositeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{11} +} +func (m *ImagesCompositeResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesCompositeResponse.Unmarshal(m, b) +} +func (m *ImagesCompositeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesCompositeResponse.Marshal(b, m, deterministic) +} +func (dst *ImagesCompositeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesCompositeResponse.Merge(dst, src) +} +func (m *ImagesCompositeResponse) XXX_Size() int { + return xxx_messageInfo_ImagesCompositeResponse.Size(m) +} +func (m *ImagesCompositeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesCompositeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesCompositeResponse proto.InternalMessageInfo + +func (m *ImagesCompositeResponse) GetImage() *ImageData { + if m != nil { + return m.Image + } + return nil +} + +type ImagesHistogramRequest struct { + Image *ImageData `protobuf:"bytes,1,req,name=image" json:"image,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesHistogramRequest) Reset() { *m = ImagesHistogramRequest{} } +func (m *ImagesHistogramRequest) String() string { return proto.CompactTextString(m) } +func (*ImagesHistogramRequest) ProtoMessage() {} +func (*ImagesHistogramRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{12} +} +func (m *ImagesHistogramRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesHistogramRequest.Unmarshal(m, b) +} +func (m *ImagesHistogramRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesHistogramRequest.Marshal(b, m, deterministic) +} +func (dst *ImagesHistogramRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesHistogramRequest.Merge(dst, src) +} +func (m *ImagesHistogramRequest) XXX_Size() int { + return xxx_messageInfo_ImagesHistogramRequest.Size(m) +} +func (m *ImagesHistogramRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesHistogramRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesHistogramRequest proto.InternalMessageInfo + +func (m *ImagesHistogramRequest) GetImage() *ImageData { + if m != nil { + return m.Image + } + return nil +} + +type ImagesHistogram struct { + Red []int32 `protobuf:"varint,1,rep,name=red" json:"red,omitempty"` + Green []int32 `protobuf:"varint,2,rep,name=green" json:"green,omitempty"` + Blue []int32 `protobuf:"varint,3,rep,name=blue" json:"blue,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesHistogram) Reset() { *m = ImagesHistogram{} } +func (m *ImagesHistogram) String() string { return proto.CompactTextString(m) } +func (*ImagesHistogram) ProtoMessage() {} +func (*ImagesHistogram) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{13} +} +func (m *ImagesHistogram) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesHistogram.Unmarshal(m, b) +} +func (m *ImagesHistogram) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesHistogram.Marshal(b, m, deterministic) +} +func (dst *ImagesHistogram) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesHistogram.Merge(dst, src) +} +func (m *ImagesHistogram) XXX_Size() int { + return xxx_messageInfo_ImagesHistogram.Size(m) +} +func (m *ImagesHistogram) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesHistogram.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesHistogram proto.InternalMessageInfo + +func (m *ImagesHistogram) GetRed() []int32 { + if m != nil { + return m.Red + } + return nil +} + +func (m *ImagesHistogram) GetGreen() []int32 { + if m != nil { + return m.Green + } + return nil +} + +func (m *ImagesHistogram) GetBlue() []int32 { + if m != nil { + return m.Blue + } + return nil +} + +type ImagesHistogramResponse struct { + Histogram *ImagesHistogram `protobuf:"bytes,1,req,name=histogram" json:"histogram,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesHistogramResponse) Reset() { *m = ImagesHistogramResponse{} } +func (m *ImagesHistogramResponse) String() string { return proto.CompactTextString(m) } +func (*ImagesHistogramResponse) ProtoMessage() {} +func (*ImagesHistogramResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{14} +} +func (m *ImagesHistogramResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesHistogramResponse.Unmarshal(m, b) +} +func (m *ImagesHistogramResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesHistogramResponse.Marshal(b, m, deterministic) +} +func (dst *ImagesHistogramResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesHistogramResponse.Merge(dst, src) +} +func (m *ImagesHistogramResponse) XXX_Size() int { + return xxx_messageInfo_ImagesHistogramResponse.Size(m) +} +func (m *ImagesHistogramResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesHistogramResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesHistogramResponse proto.InternalMessageInfo + +func (m *ImagesHistogramResponse) GetHistogram() *ImagesHistogram { + if m != nil { + return m.Histogram + } + return nil +} + +type ImagesGetUrlBaseRequest struct { + BlobKey *string `protobuf:"bytes,1,req,name=blob_key,json=blobKey" json:"blob_key,omitempty"` + CreateSecureUrl *bool `protobuf:"varint,2,opt,name=create_secure_url,json=createSecureUrl,def=0" json:"create_secure_url,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesGetUrlBaseRequest) Reset() { *m = ImagesGetUrlBaseRequest{} } +func (m *ImagesGetUrlBaseRequest) String() string { return proto.CompactTextString(m) } +func (*ImagesGetUrlBaseRequest) ProtoMessage() {} +func (*ImagesGetUrlBaseRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{15} +} +func (m *ImagesGetUrlBaseRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesGetUrlBaseRequest.Unmarshal(m, b) +} +func (m *ImagesGetUrlBaseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesGetUrlBaseRequest.Marshal(b, m, deterministic) +} +func (dst *ImagesGetUrlBaseRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesGetUrlBaseRequest.Merge(dst, src) +} +func (m *ImagesGetUrlBaseRequest) XXX_Size() int { + return xxx_messageInfo_ImagesGetUrlBaseRequest.Size(m) +} +func (m *ImagesGetUrlBaseRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesGetUrlBaseRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesGetUrlBaseRequest proto.InternalMessageInfo + +const Default_ImagesGetUrlBaseRequest_CreateSecureUrl bool = false + +func (m *ImagesGetUrlBaseRequest) GetBlobKey() string { + if m != nil && m.BlobKey != nil { + return *m.BlobKey + } + return "" +} + +func (m *ImagesGetUrlBaseRequest) GetCreateSecureUrl() bool { + if m != nil && m.CreateSecureUrl != nil { + return *m.CreateSecureUrl + } + return Default_ImagesGetUrlBaseRequest_CreateSecureUrl +} + +type ImagesGetUrlBaseResponse struct { + Url *string `protobuf:"bytes,1,req,name=url" json:"url,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesGetUrlBaseResponse) Reset() { *m = ImagesGetUrlBaseResponse{} } +func (m *ImagesGetUrlBaseResponse) String() string { return proto.CompactTextString(m) } +func (*ImagesGetUrlBaseResponse) ProtoMessage() {} +func (*ImagesGetUrlBaseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{16} +} +func (m *ImagesGetUrlBaseResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesGetUrlBaseResponse.Unmarshal(m, b) +} +func (m *ImagesGetUrlBaseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesGetUrlBaseResponse.Marshal(b, m, deterministic) +} +func (dst *ImagesGetUrlBaseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesGetUrlBaseResponse.Merge(dst, src) +} +func (m *ImagesGetUrlBaseResponse) XXX_Size() int { + return xxx_messageInfo_ImagesGetUrlBaseResponse.Size(m) +} +func (m *ImagesGetUrlBaseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesGetUrlBaseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesGetUrlBaseResponse proto.InternalMessageInfo + +func (m *ImagesGetUrlBaseResponse) GetUrl() string { + if m != nil && m.Url != nil { + return *m.Url + } + return "" +} + +type ImagesDeleteUrlBaseRequest struct { + BlobKey *string `protobuf:"bytes,1,req,name=blob_key,json=blobKey" json:"blob_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesDeleteUrlBaseRequest) Reset() { *m = ImagesDeleteUrlBaseRequest{} } +func (m *ImagesDeleteUrlBaseRequest) String() string { return proto.CompactTextString(m) } +func (*ImagesDeleteUrlBaseRequest) ProtoMessage() {} +func (*ImagesDeleteUrlBaseRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{17} +} +func (m *ImagesDeleteUrlBaseRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesDeleteUrlBaseRequest.Unmarshal(m, b) +} +func (m *ImagesDeleteUrlBaseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesDeleteUrlBaseRequest.Marshal(b, m, deterministic) +} +func (dst *ImagesDeleteUrlBaseRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesDeleteUrlBaseRequest.Merge(dst, src) +} +func (m *ImagesDeleteUrlBaseRequest) XXX_Size() int { + return xxx_messageInfo_ImagesDeleteUrlBaseRequest.Size(m) +} +func (m *ImagesDeleteUrlBaseRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesDeleteUrlBaseRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesDeleteUrlBaseRequest proto.InternalMessageInfo + +func (m *ImagesDeleteUrlBaseRequest) GetBlobKey() string { + if m != nil && m.BlobKey != nil { + return *m.BlobKey + } + return "" +} + +type ImagesDeleteUrlBaseResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImagesDeleteUrlBaseResponse) Reset() { *m = ImagesDeleteUrlBaseResponse{} } +func (m *ImagesDeleteUrlBaseResponse) String() string { return proto.CompactTextString(m) } +func (*ImagesDeleteUrlBaseResponse) ProtoMessage() {} +func (*ImagesDeleteUrlBaseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_images_service_42a9d451721edce4, []int{18} +} +func (m *ImagesDeleteUrlBaseResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImagesDeleteUrlBaseResponse.Unmarshal(m, b) +} +func (m *ImagesDeleteUrlBaseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImagesDeleteUrlBaseResponse.Marshal(b, m, deterministic) +} +func (dst *ImagesDeleteUrlBaseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImagesDeleteUrlBaseResponse.Merge(dst, src) +} +func (m *ImagesDeleteUrlBaseResponse) XXX_Size() int { + return xxx_messageInfo_ImagesDeleteUrlBaseResponse.Size(m) +} +func (m *ImagesDeleteUrlBaseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ImagesDeleteUrlBaseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ImagesDeleteUrlBaseResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ImagesServiceError)(nil), "appengine.ImagesServiceError") + proto.RegisterType((*ImagesServiceTransform)(nil), "appengine.ImagesServiceTransform") + proto.RegisterType((*Transform)(nil), "appengine.Transform") + proto.RegisterType((*ImageData)(nil), "appengine.ImageData") + proto.RegisterType((*InputSettings)(nil), "appengine.InputSettings") + proto.RegisterType((*OutputSettings)(nil), "appengine.OutputSettings") + proto.RegisterType((*ImagesTransformRequest)(nil), "appengine.ImagesTransformRequest") + proto.RegisterType((*ImagesTransformResponse)(nil), "appengine.ImagesTransformResponse") + proto.RegisterType((*CompositeImageOptions)(nil), "appengine.CompositeImageOptions") + proto.RegisterType((*ImagesCanvas)(nil), "appengine.ImagesCanvas") + proto.RegisterType((*ImagesCompositeRequest)(nil), "appengine.ImagesCompositeRequest") + proto.RegisterType((*ImagesCompositeResponse)(nil), "appengine.ImagesCompositeResponse") + proto.RegisterType((*ImagesHistogramRequest)(nil), "appengine.ImagesHistogramRequest") + proto.RegisterType((*ImagesHistogram)(nil), "appengine.ImagesHistogram") + proto.RegisterType((*ImagesHistogramResponse)(nil), "appengine.ImagesHistogramResponse") + proto.RegisterType((*ImagesGetUrlBaseRequest)(nil), "appengine.ImagesGetUrlBaseRequest") + proto.RegisterType((*ImagesGetUrlBaseResponse)(nil), "appengine.ImagesGetUrlBaseResponse") + proto.RegisterType((*ImagesDeleteUrlBaseRequest)(nil), "appengine.ImagesDeleteUrlBaseRequest") + proto.RegisterType((*ImagesDeleteUrlBaseResponse)(nil), "appengine.ImagesDeleteUrlBaseResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/image/images_service.proto", fileDescriptor_images_service_42a9d451721edce4) +} + +var fileDescriptor_images_service_42a9d451721edce4 = []byte{ + // 1460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x6e, 0xe3, 0xc6, + 0x15, 0x5e, 0x52, 0xff, 0xc7, 0xb2, 0xcc, 0x9d, 0xec, 0x0f, 0x77, 0x93,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, 0x08, 0x6b, 0x02, 0x7b, 0xf7, 0xbc, 0x20, 0x03, 0x4a, 0x9c, 0x5e, 0xa8, + 0xb6, 0x55, 0xb0, 0x3c, 0xca, 0x07, 0x5e, 0x71, 0x4a, 0x23, 0xd5, 0x9c, 0x0a, 0x4e, 0x2f, 0x08, + 0x41, 0xf9, 0x3c, 0x5c, 0xcb, 0xbf, 0x1a, 0x52, 0xa8, 0xce, 0xd6, 0x3c, 0xaf, 0xad, 0x90, 0x54, + 0x56, 0xdb, 0x6f, 0xa0, 0x71, 0x99, 0x0b, 0xb3, 0xcc, 0x5e, 0x7e, 0xd0, 0xaa, 0x5b, 0xb3, 0x5b, + 0xb0, 0xb5, 0xca, 0x9d, 0x8e, 0xa8, 0x38, 0xe5, 0x61, 0xcf, 0x4f, 0xb6, 0x8f, 0x5c, 0xdc, 0xb5, + 0xd2, 0x67, 0x61, 0xd7, 0x1e, 0xc2, 0xe3, 0x05, 0xa7, 0xbe, 0xa0, 0x24, 0xa1, 0x8b, 0x35, 0xa7, + 0x64, 0xcd, 0xc3, 0xbb, 0x6b, 0x6a, 0x2f, 0xd5, 0xcf, 0x95, 0xfa, 0x94, 0x87, 0xd6, 0x57, 0x60, + 0x7e, 0x18, 0x28, 0x4b, 0xdf, 0x80, 0x92, 0x74, 0x90, 0x06, 0x91, 0x47, 0xeb, 0xd7, 0xf0, 0x32, + 0x45, 0x0f, 0x68, 0x48, 0x05, 0xfd, 0xbf, 0x33, 0xb3, 0x7e, 0x06, 0x9f, 0x3e, 0x68, 0x98, 0x46, + 0xea, 0xd5, 0xde, 0xa7, 0x6f, 0xf3, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x74, 0x30, 0x89, + 0x1d, 0x0c, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/image/images_service.proto b/vendor/google.golang.org/appengine/internal/image/images_service.proto new file mode 100644 index 000000000..f0d2ed5d3 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/image/images_service.proto @@ -0,0 +1,162 @@ +syntax = "proto2"; +option go_package = "image"; + +package appengine; + +message ImagesServiceError { + enum ErrorCode { + UNSPECIFIED_ERROR = 1; + BAD_TRANSFORM_DATA = 2; + NOT_IMAGE = 3; + BAD_IMAGE_DATA = 4; + IMAGE_TOO_LARGE = 5; + INVALID_BLOB_KEY = 6; + ACCESS_DENIED = 7; + OBJECT_NOT_FOUND = 8; + } +} + +message ImagesServiceTransform { + enum Type { + RESIZE = 1; + ROTATE = 2; + HORIZONTAL_FLIP = 3; + VERTICAL_FLIP = 4; + CROP = 5; + IM_FEELING_LUCKY = 6; + } +} + +message Transform { + optional int32 width = 1; + optional int32 height = 2; + optional bool crop_to_fit = 11 [default = false]; + optional float crop_offset_x = 12 [default = 0.5]; + optional float crop_offset_y = 13 [default = 0.5]; + + optional int32 rotate = 3 [default = 0]; + + optional bool horizontal_flip = 4 [default = false]; + + optional bool vertical_flip = 5 [default = false]; + + optional float crop_left_x = 6 [default = 0.0]; + optional float crop_top_y = 7 [default = 0.0]; + optional float crop_right_x = 8 [default = 1.0]; + optional float crop_bottom_y = 9 [default = 1.0]; + + optional bool autolevels = 10 [default = false]; + + optional bool allow_stretch = 14 [default = false]; +} + +message ImageData { + required bytes content = 1 [ctype=CORD]; + optional string blob_key = 2; + + optional int32 width = 3; + optional int32 height = 4; +} + +message InputSettings { + enum ORIENTATION_CORRECTION_TYPE { + UNCHANGED_ORIENTATION = 0; + CORRECT_ORIENTATION = 1; + } + optional ORIENTATION_CORRECTION_TYPE correct_exif_orientation = 1 + [default=UNCHANGED_ORIENTATION]; + optional bool parse_metadata = 2 [default=false]; + optional int32 transparent_substitution_rgb = 3; +} + +message OutputSettings { + enum MIME_TYPE { + PNG = 0; + JPEG = 1; + WEBP = 2; + } + + optional MIME_TYPE mime_type = 1 [default=PNG]; + optional int32 quality = 2; +} + +message ImagesTransformRequest { + required ImageData image = 1; + repeated Transform transform = 2; + required OutputSettings output = 3; + optional InputSettings input = 4; +} + +message ImagesTransformResponse { + required ImageData image = 1; + optional string source_metadata = 2; +} + +message CompositeImageOptions { + required int32 source_index = 1; + required int32 x_offset = 2; + required int32 y_offset = 3; + required float opacity = 4; + + enum ANCHOR { + TOP_LEFT = 0; + TOP = 1; + TOP_RIGHT = 2; + LEFT = 3; + CENTER = 4; + RIGHT = 5; + BOTTOM_LEFT = 6; + BOTTOM = 7; + BOTTOM_RIGHT = 8; + } + + required ANCHOR anchor = 5; +} + +message ImagesCanvas { + required int32 width = 1; + required int32 height = 2; + required OutputSettings output = 3; + optional int32 color = 4 [default=-1]; +} + +message ImagesCompositeRequest { + repeated ImageData image = 1; + repeated CompositeImageOptions options = 2; + required ImagesCanvas canvas = 3; +} + +message ImagesCompositeResponse { + required ImageData image = 1; +} + +message ImagesHistogramRequest { + required ImageData image = 1; +} + +message ImagesHistogram { + repeated int32 red = 1; + repeated int32 green = 2; + repeated int32 blue = 3; +} + +message ImagesHistogramResponse { + required ImagesHistogram histogram = 1; +} + +message ImagesGetUrlBaseRequest { + required string blob_key = 1; + + optional bool create_secure_url = 2 [default = false]; +} + +message ImagesGetUrlBaseResponse { + required string url = 1; +} + +message ImagesDeleteUrlBaseRequest { + required string blob_key = 1; +} + +message ImagesDeleteUrlBaseResponse { +} diff --git a/vendor/google.golang.org/appengine/internal/internal.go b/vendor/google.golang.org/appengine/internal/internal.go new file mode 100644 index 000000000..051ea3980 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/internal.go @@ -0,0 +1,110 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package internal provides support for package appengine. +// +// Programs should not use this package directly. Its API is not stable. +// Use packages appengine and appengine/* instead. +package internal + +import ( + "fmt" + + "github.com/golang/protobuf/proto" + + remotepb "google.golang.org/appengine/internal/remote_api" +) + +// errorCodeMaps is a map of service name to the error code map for the service. +var errorCodeMaps = make(map[string]map[int32]string) + +// RegisterErrorCodeMap is called from API implementations to register their +// error code map. This should only be called from init functions. +func RegisterErrorCodeMap(service string, m map[int32]string) { + errorCodeMaps[service] = m +} + +type timeoutCodeKey struct { + service string + code int32 +} + +// timeoutCodes is the set of service+code pairs that represent timeouts. +var timeoutCodes = make(map[timeoutCodeKey]bool) + +func RegisterTimeoutErrorCode(service string, code int32) { + timeoutCodes[timeoutCodeKey{service, code}] = true +} + +// APIError is the type returned by appengine.Context's Call method +// when an API call fails in an API-specific way. This may be, for instance, +// a taskqueue API call failing with TaskQueueServiceError::UNKNOWN_QUEUE. +type APIError struct { + Service string + Detail string + Code int32 // API-specific error code +} + +func (e *APIError) Error() string { + if e.Code == 0 { + if e.Detail == "" { + return "APIError " + } + return e.Detail + } + s := fmt.Sprintf("API error %d", e.Code) + if m, ok := errorCodeMaps[e.Service]; ok { + s += " (" + e.Service + ": " + m[e.Code] + ")" + } else { + // Shouldn't happen, but provide a bit more detail if it does. + s = e.Service + " " + s + } + if e.Detail != "" { + s += ": " + e.Detail + } + return s +} + +func (e *APIError) IsTimeout() bool { + return timeoutCodes[timeoutCodeKey{e.Service, e.Code}] +} + +// CallError is the type returned by appengine.Context's Call method when an +// API call fails in a generic way, such as RpcError::CAPABILITY_DISABLED. +type CallError struct { + Detail string + Code int32 + // TODO: Remove this if we get a distinguishable error code. + Timeout bool +} + +func (e *CallError) Error() string { + var msg string + switch remotepb.RpcError_ErrorCode(e.Code) { + case remotepb.RpcError_UNKNOWN: + return e.Detail + case remotepb.RpcError_OVER_QUOTA: + msg = "Over quota" + case remotepb.RpcError_CAPABILITY_DISABLED: + msg = "Capability disabled" + case remotepb.RpcError_CANCELLED: + msg = "Canceled" + default: + msg = fmt.Sprintf("Call error %d", e.Code) + } + s := msg + ": " + e.Detail + if e.Timeout { + s += " (timeout)" + } + return s +} + +func (e *CallError) IsTimeout() bool { + return e.Timeout +} + +// NamespaceMods is a map from API service to a function that will mutate an RPC request to attach a namespace. +// The function should be prepared to be called on the same message more than once; it should only modify the +// RPC request the first time. +var NamespaceMods = make(map[string]func(m proto.Message, namespace string)) diff --git a/vendor/google.golang.org/appengine/internal/internal_vm_test.go b/vendor/google.golang.org/appengine/internal/internal_vm_test.go new file mode 100644 index 000000000..f8097616b --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/internal_vm_test.go @@ -0,0 +1,60 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package internal + +import ( + "io" + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" +) + +func TestInstallingHealthChecker(t *testing.T) { + try := func(desc string, mux *http.ServeMux, wantCode int, wantBody string) { + installHealthChecker(mux) + srv := httptest.NewServer(mux) + defer srv.Close() + + resp, err := http.Get(srv.URL + "/_ah/health") + if err != nil { + t.Errorf("%s: http.Get: %v", desc, err) + return + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("%s: reading body: %v", desc, err) + return + } + + if resp.StatusCode != wantCode { + t.Errorf("%s: got HTTP %d, want %d", desc, resp.StatusCode, wantCode) + return + } + if wantBody != "" && string(body) != wantBody { + t.Errorf("%s: got HTTP body %q, want %q", desc, body, wantBody) + return + } + } + + // If there's no handlers, or only a root handler, a health checker should be installed. + try("empty mux", http.NewServeMux(), 200, "ok") + mux := http.NewServeMux() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + io.WriteString(w, "root handler") + }) + try("mux with root handler", mux, 200, "ok") + + // If there's a custom health check handler, one should not be installed. + mux = http.NewServeMux() + mux.HandleFunc("/_ah/health", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(418) + io.WriteString(w, "I'm short and stout!") + }) + try("mux with custom health checker", mux, 418, "I'm short and stout!") +} diff --git a/vendor/google.golang.org/appengine/internal/log/log_service.pb.go b/vendor/google.golang.org/appengine/internal/log/log_service.pb.go new file mode 100644 index 000000000..8545ac4ad --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/log/log_service.pb.go @@ -0,0 +1,1313 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/log/log_service.proto + +package log + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type LogServiceError_ErrorCode int32 + +const ( + LogServiceError_OK LogServiceError_ErrorCode = 0 + LogServiceError_INVALID_REQUEST LogServiceError_ErrorCode = 1 + LogServiceError_STORAGE_ERROR LogServiceError_ErrorCode = 2 +) + +var LogServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "INVALID_REQUEST", + 2: "STORAGE_ERROR", +} +var LogServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "INVALID_REQUEST": 1, + "STORAGE_ERROR": 2, +} + +func (x LogServiceError_ErrorCode) Enum() *LogServiceError_ErrorCode { + p := new(LogServiceError_ErrorCode) + *p = x + return p +} +func (x LogServiceError_ErrorCode) String() string { + return proto.EnumName(LogServiceError_ErrorCode_name, int32(x)) +} +func (x *LogServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(LogServiceError_ErrorCode_value, data, "LogServiceError_ErrorCode") + if err != nil { + return err + } + *x = LogServiceError_ErrorCode(value) + return nil +} +func (LogServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{0, 0} +} + +type LogServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogServiceError) Reset() { *m = LogServiceError{} } +func (m *LogServiceError) String() string { return proto.CompactTextString(m) } +func (*LogServiceError) ProtoMessage() {} +func (*LogServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{0} +} +func (m *LogServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogServiceError.Unmarshal(m, b) +} +func (m *LogServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogServiceError.Marshal(b, m, deterministic) +} +func (dst *LogServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogServiceError.Merge(dst, src) +} +func (m *LogServiceError) XXX_Size() int { + return xxx_messageInfo_LogServiceError.Size(m) +} +func (m *LogServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_LogServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_LogServiceError proto.InternalMessageInfo + +type UserAppLogLine struct { + TimestampUsec *int64 `protobuf:"varint,1,req,name=timestamp_usec,json=timestampUsec" json:"timestamp_usec,omitempty"` + Level *int64 `protobuf:"varint,2,req,name=level" json:"level,omitempty"` + Message *string `protobuf:"bytes,3,req,name=message" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UserAppLogLine) Reset() { *m = UserAppLogLine{} } +func (m *UserAppLogLine) String() string { return proto.CompactTextString(m) } +func (*UserAppLogLine) ProtoMessage() {} +func (*UserAppLogLine) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{1} +} +func (m *UserAppLogLine) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UserAppLogLine.Unmarshal(m, b) +} +func (m *UserAppLogLine) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UserAppLogLine.Marshal(b, m, deterministic) +} +func (dst *UserAppLogLine) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserAppLogLine.Merge(dst, src) +} +func (m *UserAppLogLine) XXX_Size() int { + return xxx_messageInfo_UserAppLogLine.Size(m) +} +func (m *UserAppLogLine) XXX_DiscardUnknown() { + xxx_messageInfo_UserAppLogLine.DiscardUnknown(m) +} + +var xxx_messageInfo_UserAppLogLine proto.InternalMessageInfo + +func (m *UserAppLogLine) GetTimestampUsec() int64 { + if m != nil && m.TimestampUsec != nil { + return *m.TimestampUsec + } + return 0 +} + +func (m *UserAppLogLine) GetLevel() int64 { + if m != nil && m.Level != nil { + return *m.Level + } + return 0 +} + +func (m *UserAppLogLine) GetMessage() string { + if m != nil && m.Message != nil { + return *m.Message + } + return "" +} + +type UserAppLogGroup struct { + LogLine []*UserAppLogLine `protobuf:"bytes,2,rep,name=log_line,json=logLine" json:"log_line,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UserAppLogGroup) Reset() { *m = UserAppLogGroup{} } +func (m *UserAppLogGroup) String() string { return proto.CompactTextString(m) } +func (*UserAppLogGroup) ProtoMessage() {} +func (*UserAppLogGroup) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{2} +} +func (m *UserAppLogGroup) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UserAppLogGroup.Unmarshal(m, b) +} +func (m *UserAppLogGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UserAppLogGroup.Marshal(b, m, deterministic) +} +func (dst *UserAppLogGroup) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserAppLogGroup.Merge(dst, src) +} +func (m *UserAppLogGroup) XXX_Size() int { + return xxx_messageInfo_UserAppLogGroup.Size(m) +} +func (m *UserAppLogGroup) XXX_DiscardUnknown() { + xxx_messageInfo_UserAppLogGroup.DiscardUnknown(m) +} + +var xxx_messageInfo_UserAppLogGroup proto.InternalMessageInfo + +func (m *UserAppLogGroup) GetLogLine() []*UserAppLogLine { + if m != nil { + return m.LogLine + } + return nil +} + +type FlushRequest struct { + Logs []byte `protobuf:"bytes,1,opt,name=logs" json:"logs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FlushRequest) Reset() { *m = FlushRequest{} } +func (m *FlushRequest) String() string { return proto.CompactTextString(m) } +func (*FlushRequest) ProtoMessage() {} +func (*FlushRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{3} +} +func (m *FlushRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FlushRequest.Unmarshal(m, b) +} +func (m *FlushRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FlushRequest.Marshal(b, m, deterministic) +} +func (dst *FlushRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_FlushRequest.Merge(dst, src) +} +func (m *FlushRequest) XXX_Size() int { + return xxx_messageInfo_FlushRequest.Size(m) +} +func (m *FlushRequest) XXX_DiscardUnknown() { + xxx_messageInfo_FlushRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_FlushRequest proto.InternalMessageInfo + +func (m *FlushRequest) GetLogs() []byte { + if m != nil { + return m.Logs + } + return nil +} + +type SetStatusRequest struct { + Status *string `protobuf:"bytes,1,req,name=status" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetStatusRequest) Reset() { *m = SetStatusRequest{} } +func (m *SetStatusRequest) String() string { return proto.CompactTextString(m) } +func (*SetStatusRequest) ProtoMessage() {} +func (*SetStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{4} +} +func (m *SetStatusRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetStatusRequest.Unmarshal(m, b) +} +func (m *SetStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetStatusRequest.Marshal(b, m, deterministic) +} +func (dst *SetStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetStatusRequest.Merge(dst, src) +} +func (m *SetStatusRequest) XXX_Size() int { + return xxx_messageInfo_SetStatusRequest.Size(m) +} +func (m *SetStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SetStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SetStatusRequest proto.InternalMessageInfo + +func (m *SetStatusRequest) GetStatus() string { + if m != nil && m.Status != nil { + return *m.Status + } + return "" +} + +type LogOffset struct { + RequestId []byte `protobuf:"bytes,1,opt,name=request_id,json=requestId" json:"request_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogOffset) Reset() { *m = LogOffset{} } +func (m *LogOffset) String() string { return proto.CompactTextString(m) } +func (*LogOffset) ProtoMessage() {} +func (*LogOffset) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{5} +} +func (m *LogOffset) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogOffset.Unmarshal(m, b) +} +func (m *LogOffset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogOffset.Marshal(b, m, deterministic) +} +func (dst *LogOffset) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogOffset.Merge(dst, src) +} +func (m *LogOffset) XXX_Size() int { + return xxx_messageInfo_LogOffset.Size(m) +} +func (m *LogOffset) XXX_DiscardUnknown() { + xxx_messageInfo_LogOffset.DiscardUnknown(m) +} + +var xxx_messageInfo_LogOffset proto.InternalMessageInfo + +func (m *LogOffset) GetRequestId() []byte { + if m != nil { + return m.RequestId + } + return nil +} + +type LogLine struct { + Time *int64 `protobuf:"varint,1,req,name=time" json:"time,omitempty"` + Level *int32 `protobuf:"varint,2,req,name=level" json:"level,omitempty"` + LogMessage *string `protobuf:"bytes,3,req,name=log_message,json=logMessage" json:"log_message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogLine) Reset() { *m = LogLine{} } +func (m *LogLine) String() string { return proto.CompactTextString(m) } +func (*LogLine) ProtoMessage() {} +func (*LogLine) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{6} +} +func (m *LogLine) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogLine.Unmarshal(m, b) +} +func (m *LogLine) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogLine.Marshal(b, m, deterministic) +} +func (dst *LogLine) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogLine.Merge(dst, src) +} +func (m *LogLine) XXX_Size() int { + return xxx_messageInfo_LogLine.Size(m) +} +func (m *LogLine) XXX_DiscardUnknown() { + xxx_messageInfo_LogLine.DiscardUnknown(m) +} + +var xxx_messageInfo_LogLine proto.InternalMessageInfo + +func (m *LogLine) GetTime() int64 { + if m != nil && m.Time != nil { + return *m.Time + } + return 0 +} + +func (m *LogLine) GetLevel() int32 { + if m != nil && m.Level != nil { + return *m.Level + } + return 0 +} + +func (m *LogLine) GetLogMessage() string { + if m != nil && m.LogMessage != nil { + return *m.LogMessage + } + return "" +} + +type RequestLog struct { + AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` + ModuleId *string `protobuf:"bytes,37,opt,name=module_id,json=moduleId,def=default" json:"module_id,omitempty"` + VersionId *string `protobuf:"bytes,2,req,name=version_id,json=versionId" json:"version_id,omitempty"` + RequestId []byte `protobuf:"bytes,3,req,name=request_id,json=requestId" json:"request_id,omitempty"` + Offset *LogOffset `protobuf:"bytes,35,opt,name=offset" json:"offset,omitempty"` + Ip *string `protobuf:"bytes,4,req,name=ip" json:"ip,omitempty"` + Nickname *string `protobuf:"bytes,5,opt,name=nickname" json:"nickname,omitempty"` + StartTime *int64 `protobuf:"varint,6,req,name=start_time,json=startTime" json:"start_time,omitempty"` + EndTime *int64 `protobuf:"varint,7,req,name=end_time,json=endTime" json:"end_time,omitempty"` + Latency *int64 `protobuf:"varint,8,req,name=latency" json:"latency,omitempty"` + Mcycles *int64 `protobuf:"varint,9,req,name=mcycles" json:"mcycles,omitempty"` + Method *string `protobuf:"bytes,10,req,name=method" json:"method,omitempty"` + Resource *string `protobuf:"bytes,11,req,name=resource" json:"resource,omitempty"` + HttpVersion *string `protobuf:"bytes,12,req,name=http_version,json=httpVersion" json:"http_version,omitempty"` + Status *int32 `protobuf:"varint,13,req,name=status" json:"status,omitempty"` + ResponseSize *int64 `protobuf:"varint,14,req,name=response_size,json=responseSize" json:"response_size,omitempty"` + Referrer *string `protobuf:"bytes,15,opt,name=referrer" json:"referrer,omitempty"` + UserAgent *string `protobuf:"bytes,16,opt,name=user_agent,json=userAgent" json:"user_agent,omitempty"` + UrlMapEntry *string `protobuf:"bytes,17,req,name=url_map_entry,json=urlMapEntry" json:"url_map_entry,omitempty"` + Combined *string `protobuf:"bytes,18,req,name=combined" json:"combined,omitempty"` + ApiMcycles *int64 `protobuf:"varint,19,opt,name=api_mcycles,json=apiMcycles" json:"api_mcycles,omitempty"` + Host *string `protobuf:"bytes,20,opt,name=host" json:"host,omitempty"` + Cost *float64 `protobuf:"fixed64,21,opt,name=cost" json:"cost,omitempty"` + TaskQueueName *string `protobuf:"bytes,22,opt,name=task_queue_name,json=taskQueueName" json:"task_queue_name,omitempty"` + TaskName *string `protobuf:"bytes,23,opt,name=task_name,json=taskName" json:"task_name,omitempty"` + WasLoadingRequest *bool `protobuf:"varint,24,opt,name=was_loading_request,json=wasLoadingRequest" json:"was_loading_request,omitempty"` + PendingTime *int64 `protobuf:"varint,25,opt,name=pending_time,json=pendingTime" json:"pending_time,omitempty"` + ReplicaIndex *int32 `protobuf:"varint,26,opt,name=replica_index,json=replicaIndex,def=-1" json:"replica_index,omitempty"` + Finished *bool `protobuf:"varint,27,opt,name=finished,def=1" json:"finished,omitempty"` + CloneKey []byte `protobuf:"bytes,28,opt,name=clone_key,json=cloneKey" json:"clone_key,omitempty"` + Line []*LogLine `protobuf:"bytes,29,rep,name=line" json:"line,omitempty"` + LinesIncomplete *bool `protobuf:"varint,36,opt,name=lines_incomplete,json=linesIncomplete" json:"lines_incomplete,omitempty"` + AppEngineRelease []byte `protobuf:"bytes,38,opt,name=app_engine_release,json=appEngineRelease" json:"app_engine_release,omitempty"` + ExitReason *int32 `protobuf:"varint,30,opt,name=exit_reason,json=exitReason" json:"exit_reason,omitempty"` + WasThrottledForTime *bool `protobuf:"varint,31,opt,name=was_throttled_for_time,json=wasThrottledForTime" json:"was_throttled_for_time,omitempty"` + WasThrottledForRequests *bool `protobuf:"varint,32,opt,name=was_throttled_for_requests,json=wasThrottledForRequests" json:"was_throttled_for_requests,omitempty"` + ThrottledTime *int64 `protobuf:"varint,33,opt,name=throttled_time,json=throttledTime" json:"throttled_time,omitempty"` + ServerName []byte `protobuf:"bytes,34,opt,name=server_name,json=serverName" json:"server_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestLog) Reset() { *m = RequestLog{} } +func (m *RequestLog) String() string { return proto.CompactTextString(m) } +func (*RequestLog) ProtoMessage() {} +func (*RequestLog) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{7} +} +func (m *RequestLog) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RequestLog.Unmarshal(m, b) +} +func (m *RequestLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RequestLog.Marshal(b, m, deterministic) +} +func (dst *RequestLog) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestLog.Merge(dst, src) +} +func (m *RequestLog) XXX_Size() int { + return xxx_messageInfo_RequestLog.Size(m) +} +func (m *RequestLog) XXX_DiscardUnknown() { + xxx_messageInfo_RequestLog.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestLog proto.InternalMessageInfo + +const Default_RequestLog_ModuleId string = "default" +const Default_RequestLog_ReplicaIndex int32 = -1 +const Default_RequestLog_Finished bool = true + +func (m *RequestLog) GetAppId() string { + if m != nil && m.AppId != nil { + return *m.AppId + } + return "" +} + +func (m *RequestLog) GetModuleId() string { + if m != nil && m.ModuleId != nil { + return *m.ModuleId + } + return Default_RequestLog_ModuleId +} + +func (m *RequestLog) GetVersionId() string { + if m != nil && m.VersionId != nil { + return *m.VersionId + } + return "" +} + +func (m *RequestLog) GetRequestId() []byte { + if m != nil { + return m.RequestId + } + return nil +} + +func (m *RequestLog) GetOffset() *LogOffset { + if m != nil { + return m.Offset + } + return nil +} + +func (m *RequestLog) GetIp() string { + if m != nil && m.Ip != nil { + return *m.Ip + } + return "" +} + +func (m *RequestLog) GetNickname() string { + if m != nil && m.Nickname != nil { + return *m.Nickname + } + return "" +} + +func (m *RequestLog) GetStartTime() int64 { + if m != nil && m.StartTime != nil { + return *m.StartTime + } + return 0 +} + +func (m *RequestLog) GetEndTime() int64 { + if m != nil && m.EndTime != nil { + return *m.EndTime + } + return 0 +} + +func (m *RequestLog) GetLatency() int64 { + if m != nil && m.Latency != nil { + return *m.Latency + } + return 0 +} + +func (m *RequestLog) GetMcycles() int64 { + if m != nil && m.Mcycles != nil { + return *m.Mcycles + } + return 0 +} + +func (m *RequestLog) GetMethod() string { + if m != nil && m.Method != nil { + return *m.Method + } + return "" +} + +func (m *RequestLog) GetResource() string { + if m != nil && m.Resource != nil { + return *m.Resource + } + return "" +} + +func (m *RequestLog) GetHttpVersion() string { + if m != nil && m.HttpVersion != nil { + return *m.HttpVersion + } + return "" +} + +func (m *RequestLog) GetStatus() int32 { + if m != nil && m.Status != nil { + return *m.Status + } + return 0 +} + +func (m *RequestLog) GetResponseSize() int64 { + if m != nil && m.ResponseSize != nil { + return *m.ResponseSize + } + return 0 +} + +func (m *RequestLog) GetReferrer() string { + if m != nil && m.Referrer != nil { + return *m.Referrer + } + return "" +} + +func (m *RequestLog) GetUserAgent() string { + if m != nil && m.UserAgent != nil { + return *m.UserAgent + } + return "" +} + +func (m *RequestLog) GetUrlMapEntry() string { + if m != nil && m.UrlMapEntry != nil { + return *m.UrlMapEntry + } + return "" +} + +func (m *RequestLog) GetCombined() string { + if m != nil && m.Combined != nil { + return *m.Combined + } + return "" +} + +func (m *RequestLog) GetApiMcycles() int64 { + if m != nil && m.ApiMcycles != nil { + return *m.ApiMcycles + } + return 0 +} + +func (m *RequestLog) GetHost() string { + if m != nil && m.Host != nil { + return *m.Host + } + return "" +} + +func (m *RequestLog) GetCost() float64 { + if m != nil && m.Cost != nil { + return *m.Cost + } + return 0 +} + +func (m *RequestLog) GetTaskQueueName() string { + if m != nil && m.TaskQueueName != nil { + return *m.TaskQueueName + } + return "" +} + +func (m *RequestLog) GetTaskName() string { + if m != nil && m.TaskName != nil { + return *m.TaskName + } + return "" +} + +func (m *RequestLog) GetWasLoadingRequest() bool { + if m != nil && m.WasLoadingRequest != nil { + return *m.WasLoadingRequest + } + return false +} + +func (m *RequestLog) GetPendingTime() int64 { + if m != nil && m.PendingTime != nil { + return *m.PendingTime + } + return 0 +} + +func (m *RequestLog) GetReplicaIndex() int32 { + if m != nil && m.ReplicaIndex != nil { + return *m.ReplicaIndex + } + return Default_RequestLog_ReplicaIndex +} + +func (m *RequestLog) GetFinished() bool { + if m != nil && m.Finished != nil { + return *m.Finished + } + return Default_RequestLog_Finished +} + +func (m *RequestLog) GetCloneKey() []byte { + if m != nil { + return m.CloneKey + } + return nil +} + +func (m *RequestLog) GetLine() []*LogLine { + if m != nil { + return m.Line + } + return nil +} + +func (m *RequestLog) GetLinesIncomplete() bool { + if m != nil && m.LinesIncomplete != nil { + return *m.LinesIncomplete + } + return false +} + +func (m *RequestLog) GetAppEngineRelease() []byte { + if m != nil { + return m.AppEngineRelease + } + return nil +} + +func (m *RequestLog) GetExitReason() int32 { + if m != nil && m.ExitReason != nil { + return *m.ExitReason + } + return 0 +} + +func (m *RequestLog) GetWasThrottledForTime() bool { + if m != nil && m.WasThrottledForTime != nil { + return *m.WasThrottledForTime + } + return false +} + +func (m *RequestLog) GetWasThrottledForRequests() bool { + if m != nil && m.WasThrottledForRequests != nil { + return *m.WasThrottledForRequests + } + return false +} + +func (m *RequestLog) GetThrottledTime() int64 { + if m != nil && m.ThrottledTime != nil { + return *m.ThrottledTime + } + return 0 +} + +func (m *RequestLog) GetServerName() []byte { + if m != nil { + return m.ServerName + } + return nil +} + +type LogModuleVersion struct { + ModuleId *string `protobuf:"bytes,1,opt,name=module_id,json=moduleId,def=default" json:"module_id,omitempty"` + VersionId *string `protobuf:"bytes,2,opt,name=version_id,json=versionId" json:"version_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogModuleVersion) Reset() { *m = LogModuleVersion{} } +func (m *LogModuleVersion) String() string { return proto.CompactTextString(m) } +func (*LogModuleVersion) ProtoMessage() {} +func (*LogModuleVersion) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{8} +} +func (m *LogModuleVersion) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogModuleVersion.Unmarshal(m, b) +} +func (m *LogModuleVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogModuleVersion.Marshal(b, m, deterministic) +} +func (dst *LogModuleVersion) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogModuleVersion.Merge(dst, src) +} +func (m *LogModuleVersion) XXX_Size() int { + return xxx_messageInfo_LogModuleVersion.Size(m) +} +func (m *LogModuleVersion) XXX_DiscardUnknown() { + xxx_messageInfo_LogModuleVersion.DiscardUnknown(m) +} + +var xxx_messageInfo_LogModuleVersion proto.InternalMessageInfo + +const Default_LogModuleVersion_ModuleId string = "default" + +func (m *LogModuleVersion) GetModuleId() string { + if m != nil && m.ModuleId != nil { + return *m.ModuleId + } + return Default_LogModuleVersion_ModuleId +} + +func (m *LogModuleVersion) GetVersionId() string { + if m != nil && m.VersionId != nil { + return *m.VersionId + } + return "" +} + +type LogReadRequest struct { + AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` + VersionId []string `protobuf:"bytes,2,rep,name=version_id,json=versionId" json:"version_id,omitempty"` + ModuleVersion []*LogModuleVersion `protobuf:"bytes,19,rep,name=module_version,json=moduleVersion" json:"module_version,omitempty"` + StartTime *int64 `protobuf:"varint,3,opt,name=start_time,json=startTime" json:"start_time,omitempty"` + EndTime *int64 `protobuf:"varint,4,opt,name=end_time,json=endTime" json:"end_time,omitempty"` + Offset *LogOffset `protobuf:"bytes,5,opt,name=offset" json:"offset,omitempty"` + RequestId [][]byte `protobuf:"bytes,6,rep,name=request_id,json=requestId" json:"request_id,omitempty"` + MinimumLogLevel *int32 `protobuf:"varint,7,opt,name=minimum_log_level,json=minimumLogLevel" json:"minimum_log_level,omitempty"` + IncludeIncomplete *bool `protobuf:"varint,8,opt,name=include_incomplete,json=includeIncomplete" json:"include_incomplete,omitempty"` + Count *int64 `protobuf:"varint,9,opt,name=count" json:"count,omitempty"` + CombinedLogRegex *string `protobuf:"bytes,14,opt,name=combined_log_regex,json=combinedLogRegex" json:"combined_log_regex,omitempty"` + HostRegex *string `protobuf:"bytes,15,opt,name=host_regex,json=hostRegex" json:"host_regex,omitempty"` + ReplicaIndex *int32 `protobuf:"varint,16,opt,name=replica_index,json=replicaIndex" json:"replica_index,omitempty"` + IncludeAppLogs *bool `protobuf:"varint,10,opt,name=include_app_logs,json=includeAppLogs" json:"include_app_logs,omitempty"` + AppLogsPerRequest *int32 `protobuf:"varint,17,opt,name=app_logs_per_request,json=appLogsPerRequest" json:"app_logs_per_request,omitempty"` + IncludeHost *bool `protobuf:"varint,11,opt,name=include_host,json=includeHost" json:"include_host,omitempty"` + IncludeAll *bool `protobuf:"varint,12,opt,name=include_all,json=includeAll" json:"include_all,omitempty"` + CacheIterator *bool `protobuf:"varint,13,opt,name=cache_iterator,json=cacheIterator" json:"cache_iterator,omitempty"` + NumShards *int32 `protobuf:"varint,18,opt,name=num_shards,json=numShards" json:"num_shards,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogReadRequest) Reset() { *m = LogReadRequest{} } +func (m *LogReadRequest) String() string { return proto.CompactTextString(m) } +func (*LogReadRequest) ProtoMessage() {} +func (*LogReadRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{9} +} +func (m *LogReadRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogReadRequest.Unmarshal(m, b) +} +func (m *LogReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogReadRequest.Marshal(b, m, deterministic) +} +func (dst *LogReadRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogReadRequest.Merge(dst, src) +} +func (m *LogReadRequest) XXX_Size() int { + return xxx_messageInfo_LogReadRequest.Size(m) +} +func (m *LogReadRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LogReadRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LogReadRequest proto.InternalMessageInfo + +func (m *LogReadRequest) GetAppId() string { + if m != nil && m.AppId != nil { + return *m.AppId + } + return "" +} + +func (m *LogReadRequest) GetVersionId() []string { + if m != nil { + return m.VersionId + } + return nil +} + +func (m *LogReadRequest) GetModuleVersion() []*LogModuleVersion { + if m != nil { + return m.ModuleVersion + } + return nil +} + +func (m *LogReadRequest) GetStartTime() int64 { + if m != nil && m.StartTime != nil { + return *m.StartTime + } + return 0 +} + +func (m *LogReadRequest) GetEndTime() int64 { + if m != nil && m.EndTime != nil { + return *m.EndTime + } + return 0 +} + +func (m *LogReadRequest) GetOffset() *LogOffset { + if m != nil { + return m.Offset + } + return nil +} + +func (m *LogReadRequest) GetRequestId() [][]byte { + if m != nil { + return m.RequestId + } + return nil +} + +func (m *LogReadRequest) GetMinimumLogLevel() int32 { + if m != nil && m.MinimumLogLevel != nil { + return *m.MinimumLogLevel + } + return 0 +} + +func (m *LogReadRequest) GetIncludeIncomplete() bool { + if m != nil && m.IncludeIncomplete != nil { + return *m.IncludeIncomplete + } + return false +} + +func (m *LogReadRequest) GetCount() int64 { + if m != nil && m.Count != nil { + return *m.Count + } + return 0 +} + +func (m *LogReadRequest) GetCombinedLogRegex() string { + if m != nil && m.CombinedLogRegex != nil { + return *m.CombinedLogRegex + } + return "" +} + +func (m *LogReadRequest) GetHostRegex() string { + if m != nil && m.HostRegex != nil { + return *m.HostRegex + } + return "" +} + +func (m *LogReadRequest) GetReplicaIndex() int32 { + if m != nil && m.ReplicaIndex != nil { + return *m.ReplicaIndex + } + return 0 +} + +func (m *LogReadRequest) GetIncludeAppLogs() bool { + if m != nil && m.IncludeAppLogs != nil { + return *m.IncludeAppLogs + } + return false +} + +func (m *LogReadRequest) GetAppLogsPerRequest() int32 { + if m != nil && m.AppLogsPerRequest != nil { + return *m.AppLogsPerRequest + } + return 0 +} + +func (m *LogReadRequest) GetIncludeHost() bool { + if m != nil && m.IncludeHost != nil { + return *m.IncludeHost + } + return false +} + +func (m *LogReadRequest) GetIncludeAll() bool { + if m != nil && m.IncludeAll != nil { + return *m.IncludeAll + } + return false +} + +func (m *LogReadRequest) GetCacheIterator() bool { + if m != nil && m.CacheIterator != nil { + return *m.CacheIterator + } + return false +} + +func (m *LogReadRequest) GetNumShards() int32 { + if m != nil && m.NumShards != nil { + return *m.NumShards + } + return 0 +} + +type LogReadResponse struct { + Log []*RequestLog `protobuf:"bytes,1,rep,name=log" json:"log,omitempty"` + Offset *LogOffset `protobuf:"bytes,2,opt,name=offset" json:"offset,omitempty"` + LastEndTime *int64 `protobuf:"varint,3,opt,name=last_end_time,json=lastEndTime" json:"last_end_time,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogReadResponse) Reset() { *m = LogReadResponse{} } +func (m *LogReadResponse) String() string { return proto.CompactTextString(m) } +func (*LogReadResponse) ProtoMessage() {} +func (*LogReadResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{10} +} +func (m *LogReadResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogReadResponse.Unmarshal(m, b) +} +func (m *LogReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogReadResponse.Marshal(b, m, deterministic) +} +func (dst *LogReadResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogReadResponse.Merge(dst, src) +} +func (m *LogReadResponse) XXX_Size() int { + return xxx_messageInfo_LogReadResponse.Size(m) +} +func (m *LogReadResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LogReadResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_LogReadResponse proto.InternalMessageInfo + +func (m *LogReadResponse) GetLog() []*RequestLog { + if m != nil { + return m.Log + } + return nil +} + +func (m *LogReadResponse) GetOffset() *LogOffset { + if m != nil { + return m.Offset + } + return nil +} + +func (m *LogReadResponse) GetLastEndTime() int64 { + if m != nil && m.LastEndTime != nil { + return *m.LastEndTime + } + return 0 +} + +type LogUsageRecord struct { + VersionId *string `protobuf:"bytes,1,opt,name=version_id,json=versionId" json:"version_id,omitempty"` + StartTime *int32 `protobuf:"varint,2,opt,name=start_time,json=startTime" json:"start_time,omitempty"` + EndTime *int32 `protobuf:"varint,3,opt,name=end_time,json=endTime" json:"end_time,omitempty"` + Count *int64 `protobuf:"varint,4,opt,name=count" json:"count,omitempty"` + TotalSize *int64 `protobuf:"varint,5,opt,name=total_size,json=totalSize" json:"total_size,omitempty"` + Records *int32 `protobuf:"varint,6,opt,name=records" json:"records,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogUsageRecord) Reset() { *m = LogUsageRecord{} } +func (m *LogUsageRecord) String() string { return proto.CompactTextString(m) } +func (*LogUsageRecord) ProtoMessage() {} +func (*LogUsageRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{11} +} +func (m *LogUsageRecord) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogUsageRecord.Unmarshal(m, b) +} +func (m *LogUsageRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogUsageRecord.Marshal(b, m, deterministic) +} +func (dst *LogUsageRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogUsageRecord.Merge(dst, src) +} +func (m *LogUsageRecord) XXX_Size() int { + return xxx_messageInfo_LogUsageRecord.Size(m) +} +func (m *LogUsageRecord) XXX_DiscardUnknown() { + xxx_messageInfo_LogUsageRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_LogUsageRecord proto.InternalMessageInfo + +func (m *LogUsageRecord) GetVersionId() string { + if m != nil && m.VersionId != nil { + return *m.VersionId + } + return "" +} + +func (m *LogUsageRecord) GetStartTime() int32 { + if m != nil && m.StartTime != nil { + return *m.StartTime + } + return 0 +} + +func (m *LogUsageRecord) GetEndTime() int32 { + if m != nil && m.EndTime != nil { + return *m.EndTime + } + return 0 +} + +func (m *LogUsageRecord) GetCount() int64 { + if m != nil && m.Count != nil { + return *m.Count + } + return 0 +} + +func (m *LogUsageRecord) GetTotalSize() int64 { + if m != nil && m.TotalSize != nil { + return *m.TotalSize + } + return 0 +} + +func (m *LogUsageRecord) GetRecords() int32 { + if m != nil && m.Records != nil { + return *m.Records + } + return 0 +} + +type LogUsageRequest struct { + AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` + VersionId []string `protobuf:"bytes,2,rep,name=version_id,json=versionId" json:"version_id,omitempty"` + StartTime *int32 `protobuf:"varint,3,opt,name=start_time,json=startTime" json:"start_time,omitempty"` + EndTime *int32 `protobuf:"varint,4,opt,name=end_time,json=endTime" json:"end_time,omitempty"` + ResolutionHours *uint32 `protobuf:"varint,5,opt,name=resolution_hours,json=resolutionHours,def=1" json:"resolution_hours,omitempty"` + CombineVersions *bool `protobuf:"varint,6,opt,name=combine_versions,json=combineVersions" json:"combine_versions,omitempty"` + UsageVersion *int32 `protobuf:"varint,7,opt,name=usage_version,json=usageVersion" json:"usage_version,omitempty"` + VersionsOnly *bool `protobuf:"varint,8,opt,name=versions_only,json=versionsOnly" json:"versions_only,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogUsageRequest) Reset() { *m = LogUsageRequest{} } +func (m *LogUsageRequest) String() string { return proto.CompactTextString(m) } +func (*LogUsageRequest) ProtoMessage() {} +func (*LogUsageRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{12} +} +func (m *LogUsageRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogUsageRequest.Unmarshal(m, b) +} +func (m *LogUsageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogUsageRequest.Marshal(b, m, deterministic) +} +func (dst *LogUsageRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogUsageRequest.Merge(dst, src) +} +func (m *LogUsageRequest) XXX_Size() int { + return xxx_messageInfo_LogUsageRequest.Size(m) +} +func (m *LogUsageRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LogUsageRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LogUsageRequest proto.InternalMessageInfo + +const Default_LogUsageRequest_ResolutionHours uint32 = 1 + +func (m *LogUsageRequest) GetAppId() string { + if m != nil && m.AppId != nil { + return *m.AppId + } + return "" +} + +func (m *LogUsageRequest) GetVersionId() []string { + if m != nil { + return m.VersionId + } + return nil +} + +func (m *LogUsageRequest) GetStartTime() int32 { + if m != nil && m.StartTime != nil { + return *m.StartTime + } + return 0 +} + +func (m *LogUsageRequest) GetEndTime() int32 { + if m != nil && m.EndTime != nil { + return *m.EndTime + } + return 0 +} + +func (m *LogUsageRequest) GetResolutionHours() uint32 { + if m != nil && m.ResolutionHours != nil { + return *m.ResolutionHours + } + return Default_LogUsageRequest_ResolutionHours +} + +func (m *LogUsageRequest) GetCombineVersions() bool { + if m != nil && m.CombineVersions != nil { + return *m.CombineVersions + } + return false +} + +func (m *LogUsageRequest) GetUsageVersion() int32 { + if m != nil && m.UsageVersion != nil { + return *m.UsageVersion + } + return 0 +} + +func (m *LogUsageRequest) GetVersionsOnly() bool { + if m != nil && m.VersionsOnly != nil { + return *m.VersionsOnly + } + return false +} + +type LogUsageResponse struct { + Usage []*LogUsageRecord `protobuf:"bytes,1,rep,name=usage" json:"usage,omitempty"` + Summary *LogUsageRecord `protobuf:"bytes,2,opt,name=summary" json:"summary,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LogUsageResponse) Reset() { *m = LogUsageResponse{} } +func (m *LogUsageResponse) String() string { return proto.CompactTextString(m) } +func (*LogUsageResponse) ProtoMessage() {} +func (*LogUsageResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_log_service_f054fd4b5012319d, []int{13} +} +func (m *LogUsageResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LogUsageResponse.Unmarshal(m, b) +} +func (m *LogUsageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LogUsageResponse.Marshal(b, m, deterministic) +} +func (dst *LogUsageResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LogUsageResponse.Merge(dst, src) +} +func (m *LogUsageResponse) XXX_Size() int { + return xxx_messageInfo_LogUsageResponse.Size(m) +} +func (m *LogUsageResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LogUsageResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_LogUsageResponse proto.InternalMessageInfo + +func (m *LogUsageResponse) GetUsage() []*LogUsageRecord { + if m != nil { + return m.Usage + } + return nil +} + +func (m *LogUsageResponse) GetSummary() *LogUsageRecord { + if m != nil { + return m.Summary + } + return nil +} + +func init() { + proto.RegisterType((*LogServiceError)(nil), "appengine.LogServiceError") + proto.RegisterType((*UserAppLogLine)(nil), "appengine.UserAppLogLine") + proto.RegisterType((*UserAppLogGroup)(nil), "appengine.UserAppLogGroup") + proto.RegisterType((*FlushRequest)(nil), "appengine.FlushRequest") + proto.RegisterType((*SetStatusRequest)(nil), "appengine.SetStatusRequest") + proto.RegisterType((*LogOffset)(nil), "appengine.LogOffset") + proto.RegisterType((*LogLine)(nil), "appengine.LogLine") + proto.RegisterType((*RequestLog)(nil), "appengine.RequestLog") + proto.RegisterType((*LogModuleVersion)(nil), "appengine.LogModuleVersion") + proto.RegisterType((*LogReadRequest)(nil), "appengine.LogReadRequest") + proto.RegisterType((*LogReadResponse)(nil), "appengine.LogReadResponse") + proto.RegisterType((*LogUsageRecord)(nil), "appengine.LogUsageRecord") + proto.RegisterType((*LogUsageRequest)(nil), "appengine.LogUsageRequest") + proto.RegisterType((*LogUsageResponse)(nil), "appengine.LogUsageResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/log/log_service.proto", fileDescriptor_log_service_f054fd4b5012319d) +} + +var fileDescriptor_log_service_f054fd4b5012319d = []byte{ + // 1553 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x72, 0xdb, 0xc6, + 0x15, 0x2e, 0x48, 0x51, 0x24, 0x0f, 0x49, 0x91, 0x5a, 0xcb, 0xce, 0xda, 0xae, 0x6b, 0x1a, 0x4e, + 0x1c, 0xd6, 0x93, 0x48, 0x93, 0xa4, 0x57, 0xca, 0x95, 0xd3, 0x2a, 0x8e, 0x26, 0xb4, 0xd5, 0x40, + 0x72, 0x3a, 0xd3, 0x1b, 0x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x45, 0x2a, 0xed, 0xab, 0xe4, 0x09, 0x77, + 0x04, 0x3d, 0xda, 0xc8, 0x53, 0xee, 0xfe, 0x36, 0x8d, 0x36, 0xc8, 0x10, 0x39, 0x3f, 0xf6, 0x05, + 0xf4, 0x75, 0xbd, 0x5e, 0x27, 0xea, 0xda, 0x33, 0xef, 0x57, 0x5e, 0x69, 0x3c, 0xbf, 0xea, 0xfd, + 0xdd, 0x92, 0xf6, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x70, 0xd9, 0xa0, 0xf8, 0x48, 0x0d, 0x00, + 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/log/log_service.proto b/vendor/google.golang.org/appengine/internal/log/log_service.proto new file mode 100644 index 000000000..8981dc475 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/log/log_service.proto @@ -0,0 +1,150 @@ +syntax = "proto2"; +option go_package = "log"; + +package appengine; + +message LogServiceError { + enum ErrorCode { + OK = 0; + INVALID_REQUEST = 1; + STORAGE_ERROR = 2; + } +} + +message UserAppLogLine { + required int64 timestamp_usec = 1; + required int64 level = 2; + required string message = 3; +} + +message UserAppLogGroup { + repeated UserAppLogLine log_line = 2; +} + +message FlushRequest { + optional bytes logs = 1; +} + +message SetStatusRequest { + required string status = 1; +} + + +message LogOffset { + optional bytes request_id = 1; +} + +message LogLine { + required int64 time = 1; + required int32 level = 2; + required string log_message = 3; +} + +message RequestLog { + required string app_id = 1; + optional string module_id = 37 [default="default"]; + required string version_id = 2; + required bytes request_id = 3; + optional LogOffset offset = 35; + required string ip = 4; + optional string nickname = 5; + required int64 start_time = 6; + required int64 end_time = 7; + required int64 latency = 8; + required int64 mcycles = 9; + required string method = 10; + required string resource = 11; + required string http_version = 12; + required int32 status = 13; + required int64 response_size = 14; + optional string referrer = 15; + optional string user_agent = 16; + required string url_map_entry = 17; + required string combined = 18; + optional int64 api_mcycles = 19; + optional string host = 20; + optional double cost = 21; + + optional string task_queue_name = 22; + optional string task_name = 23; + + optional bool was_loading_request = 24; + optional int64 pending_time = 25; + optional int32 replica_index = 26 [default = -1]; + optional bool finished = 27 [default = true]; + optional bytes clone_key = 28; + + repeated LogLine line = 29; + + optional bool lines_incomplete = 36; + optional bytes app_engine_release = 38; + + optional int32 exit_reason = 30; + optional bool was_throttled_for_time = 31; + optional bool was_throttled_for_requests = 32; + optional int64 throttled_time = 33; + + optional bytes server_name = 34; +} + +message LogModuleVersion { + optional string module_id = 1 [default="default"]; + optional string version_id = 2; +} + +message LogReadRequest { + required string app_id = 1; + repeated string version_id = 2; + repeated LogModuleVersion module_version = 19; + + optional int64 start_time = 3; + optional int64 end_time = 4; + optional LogOffset offset = 5; + repeated bytes request_id = 6; + + optional int32 minimum_log_level = 7; + optional bool include_incomplete = 8; + optional int64 count = 9; + + optional string combined_log_regex = 14; + optional string host_regex = 15; + optional int32 replica_index = 16; + + optional bool include_app_logs = 10; + optional int32 app_logs_per_request = 17; + optional bool include_host = 11; + optional bool include_all = 12; + optional bool cache_iterator = 13; + optional int32 num_shards = 18; +} + +message LogReadResponse { + repeated RequestLog log = 1; + optional LogOffset offset = 2; + optional int64 last_end_time = 3; +} + +message LogUsageRecord { + optional string version_id = 1; + optional int32 start_time = 2; + optional int32 end_time = 3; + optional int64 count = 4; + optional int64 total_size = 5; + optional int32 records = 6; +} + +message LogUsageRequest { + required string app_id = 1; + repeated string version_id = 2; + optional int32 start_time = 3; + optional int32 end_time = 4; + optional uint32 resolution_hours = 5 [default = 1]; + optional bool combine_versions = 6; + optional int32 usage_version = 7; + optional bool versions_only = 8; +} + +message LogUsageResponse { + repeated LogUsageRecord usage = 1; + optional LogUsageRecord summary = 2; +} diff --git a/vendor/google.golang.org/appengine/internal/mail/mail_service.pb.go b/vendor/google.golang.org/appengine/internal/mail/mail_service.pb.go new file mode 100644 index 000000000..f9c9cae9d --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/mail/mail_service.pb.go @@ -0,0 +1,355 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/mail/mail_service.proto + +package mail + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type MailServiceError_ErrorCode int32 + +const ( + MailServiceError_OK MailServiceError_ErrorCode = 0 + MailServiceError_INTERNAL_ERROR MailServiceError_ErrorCode = 1 + MailServiceError_BAD_REQUEST MailServiceError_ErrorCode = 2 + MailServiceError_UNAUTHORIZED_SENDER MailServiceError_ErrorCode = 3 + MailServiceError_INVALID_ATTACHMENT_TYPE MailServiceError_ErrorCode = 4 + MailServiceError_INVALID_HEADER_NAME MailServiceError_ErrorCode = 5 + MailServiceError_INVALID_CONTENT_ID MailServiceError_ErrorCode = 6 +) + +var MailServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "INTERNAL_ERROR", + 2: "BAD_REQUEST", + 3: "UNAUTHORIZED_SENDER", + 4: "INVALID_ATTACHMENT_TYPE", + 5: "INVALID_HEADER_NAME", + 6: "INVALID_CONTENT_ID", +} +var MailServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "INTERNAL_ERROR": 1, + "BAD_REQUEST": 2, + "UNAUTHORIZED_SENDER": 3, + "INVALID_ATTACHMENT_TYPE": 4, + "INVALID_HEADER_NAME": 5, + "INVALID_CONTENT_ID": 6, +} + +func (x MailServiceError_ErrorCode) Enum() *MailServiceError_ErrorCode { + p := new(MailServiceError_ErrorCode) + *p = x + return p +} +func (x MailServiceError_ErrorCode) String() string { + return proto.EnumName(MailServiceError_ErrorCode_name, int32(x)) +} +func (x *MailServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MailServiceError_ErrorCode_value, data, "MailServiceError_ErrorCode") + if err != nil { + return err + } + *x = MailServiceError_ErrorCode(value) + return nil +} +func (MailServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_mail_service_78722be3c4c01d17, []int{0, 0} +} + +type MailServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MailServiceError) Reset() { *m = MailServiceError{} } +func (m *MailServiceError) String() string { return proto.CompactTextString(m) } +func (*MailServiceError) ProtoMessage() {} +func (*MailServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_mail_service_78722be3c4c01d17, []int{0} +} +func (m *MailServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MailServiceError.Unmarshal(m, b) +} +func (m *MailServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MailServiceError.Marshal(b, m, deterministic) +} +func (dst *MailServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_MailServiceError.Merge(dst, src) +} +func (m *MailServiceError) XXX_Size() int { + return xxx_messageInfo_MailServiceError.Size(m) +} +func (m *MailServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_MailServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_MailServiceError proto.InternalMessageInfo + +type MailAttachment struct { + FileName *string `protobuf:"bytes,1,req,name=FileName" json:"FileName,omitempty"` + Data []byte `protobuf:"bytes,2,req,name=Data" json:"Data,omitempty"` + ContentID *string `protobuf:"bytes,3,opt,name=ContentID" json:"ContentID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MailAttachment) Reset() { *m = MailAttachment{} } +func (m *MailAttachment) String() string { return proto.CompactTextString(m) } +func (*MailAttachment) ProtoMessage() {} +func (*MailAttachment) Descriptor() ([]byte, []int) { + return fileDescriptor_mail_service_78722be3c4c01d17, []int{1} +} +func (m *MailAttachment) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MailAttachment.Unmarshal(m, b) +} +func (m *MailAttachment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MailAttachment.Marshal(b, m, deterministic) +} +func (dst *MailAttachment) XXX_Merge(src proto.Message) { + xxx_messageInfo_MailAttachment.Merge(dst, src) +} +func (m *MailAttachment) XXX_Size() int { + return xxx_messageInfo_MailAttachment.Size(m) +} +func (m *MailAttachment) XXX_DiscardUnknown() { + xxx_messageInfo_MailAttachment.DiscardUnknown(m) +} + +var xxx_messageInfo_MailAttachment proto.InternalMessageInfo + +func (m *MailAttachment) GetFileName() string { + if m != nil && m.FileName != nil { + return *m.FileName + } + return "" +} + +func (m *MailAttachment) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *MailAttachment) GetContentID() string { + if m != nil && m.ContentID != nil { + return *m.ContentID + } + return "" +} + +type MailHeader struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MailHeader) Reset() { *m = MailHeader{} } +func (m *MailHeader) String() string { return proto.CompactTextString(m) } +func (*MailHeader) ProtoMessage() {} +func (*MailHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_mail_service_78722be3c4c01d17, []int{2} +} +func (m *MailHeader) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MailHeader.Unmarshal(m, b) +} +func (m *MailHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MailHeader.Marshal(b, m, deterministic) +} +func (dst *MailHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_MailHeader.Merge(dst, src) +} +func (m *MailHeader) XXX_Size() int { + return xxx_messageInfo_MailHeader.Size(m) +} +func (m *MailHeader) XXX_DiscardUnknown() { + xxx_messageInfo_MailHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_MailHeader proto.InternalMessageInfo + +func (m *MailHeader) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MailHeader) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type MailMessage struct { + Sender *string `protobuf:"bytes,1,req,name=Sender" json:"Sender,omitempty"` + ReplyTo *string `protobuf:"bytes,2,opt,name=ReplyTo" json:"ReplyTo,omitempty"` + To []string `protobuf:"bytes,3,rep,name=To" json:"To,omitempty"` + Cc []string `protobuf:"bytes,4,rep,name=Cc" json:"Cc,omitempty"` + Bcc []string `protobuf:"bytes,5,rep,name=Bcc" json:"Bcc,omitempty"` + Subject *string `protobuf:"bytes,6,req,name=Subject" json:"Subject,omitempty"` + TextBody *string `protobuf:"bytes,7,opt,name=TextBody" json:"TextBody,omitempty"` + HtmlBody *string `protobuf:"bytes,8,opt,name=HtmlBody" json:"HtmlBody,omitempty"` + Attachment []*MailAttachment `protobuf:"bytes,9,rep,name=Attachment" json:"Attachment,omitempty"` + Header []*MailHeader `protobuf:"bytes,10,rep,name=Header" json:"Header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MailMessage) Reset() { *m = MailMessage{} } +func (m *MailMessage) String() string { return proto.CompactTextString(m) } +func (*MailMessage) ProtoMessage() {} +func (*MailMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_mail_service_78722be3c4c01d17, []int{3} +} +func (m *MailMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MailMessage.Unmarshal(m, b) +} +func (m *MailMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MailMessage.Marshal(b, m, deterministic) +} +func (dst *MailMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_MailMessage.Merge(dst, src) +} +func (m *MailMessage) XXX_Size() int { + return xxx_messageInfo_MailMessage.Size(m) +} +func (m *MailMessage) XXX_DiscardUnknown() { + xxx_messageInfo_MailMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_MailMessage proto.InternalMessageInfo + +func (m *MailMessage) GetSender() string { + if m != nil && m.Sender != nil { + return *m.Sender + } + return "" +} + +func (m *MailMessage) GetReplyTo() string { + if m != nil && m.ReplyTo != nil { + return *m.ReplyTo + } + return "" +} + +func (m *MailMessage) GetTo() []string { + if m != nil { + return m.To + } + return nil +} + +func (m *MailMessage) GetCc() []string { + if m != nil { + return m.Cc + } + return nil +} + +func (m *MailMessage) GetBcc() []string { + if m != nil { + return m.Bcc + } + return nil +} + +func (m *MailMessage) GetSubject() string { + if m != nil && m.Subject != nil { + return *m.Subject + } + return "" +} + +func (m *MailMessage) GetTextBody() string { + if m != nil && m.TextBody != nil { + return *m.TextBody + } + return "" +} + +func (m *MailMessage) GetHtmlBody() string { + if m != nil && m.HtmlBody != nil { + return *m.HtmlBody + } + return "" +} + +func (m *MailMessage) GetAttachment() []*MailAttachment { + if m != nil { + return m.Attachment + } + return nil +} + +func (m *MailMessage) GetHeader() []*MailHeader { + if m != nil { + return m.Header + } + return nil +} + +func init() { + proto.RegisterType((*MailServiceError)(nil), "appengine.MailServiceError") + proto.RegisterType((*MailAttachment)(nil), "appengine.MailAttachment") + proto.RegisterType((*MailHeader)(nil), "appengine.MailHeader") + proto.RegisterType((*MailMessage)(nil), "appengine.MailMessage") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/mail/mail_service.proto", fileDescriptor_mail_service_78722be3c4c01d17) +} + +var fileDescriptor_mail_service_78722be3c4c01d17 = []byte{ + // 480 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0x89, 0x9d, 0xb8, 0xf5, 0x04, 0x05, 0x6b, 0x81, 0x76, 0xf9,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xdf, 0x7e, 0x60, 0xaa, 0xa9, 0x53, 0x2f, + 0x69, 0xd1, 0x64, 0x22, 0xf0, 0xa7, 0x9e, 0xa9, 0xcd, 0x1d, 0x3d, 0xab, 0xd7, 0x1c, 0xd9, 0x68, + 0x73, 0xbd, 0x2d, 0x6a, 0xed, 0xbc, 0xd1, 0x5a, 0x26, 0x6f, 0x01, 0x4e, 0xc9, 0x52, 0x77, 0x68, + 0x8f, 0xfb, 0xaf, 0x9f, 0x4d, 0x8e, 0x47, 0x33, 0xf9, 0x3f, 0x7a, 0xfe, 0x4f, 0x33, 0x79, 0x05, + 0x4e, 0x13, 0x1a, 0x85, 0xda, 0xf6, 0xf4, 0x9e, 0xad, 0x11, 0xf9, 0xa1, 0x69, 0xe6, 0x5c, 0x77, + 0xcd, 0x7d, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xd3, 0x01, 0x27, 0xd0, 0x02, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/mail/mail_service.proto b/vendor/google.golang.org/appengine/internal/mail/mail_service.proto new file mode 100644 index 000000000..4e57b7aa5 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/mail/mail_service.proto @@ -0,0 +1,45 @@ +syntax = "proto2"; +option go_package = "mail"; + +package appengine; + +message MailServiceError { + enum ErrorCode { + OK = 0; + INTERNAL_ERROR = 1; + BAD_REQUEST = 2; + UNAUTHORIZED_SENDER = 3; + INVALID_ATTACHMENT_TYPE = 4; + INVALID_HEADER_NAME = 5; + INVALID_CONTENT_ID = 6; + } +} + +message MailAttachment { + required string FileName = 1; + required bytes Data = 2; + optional string ContentID = 3; +} + +message MailHeader { + required string name = 1; + required string value = 2; +} + +message MailMessage { + required string Sender = 1; + optional string ReplyTo = 2; + + repeated string To = 3; + repeated string Cc = 4; + repeated string Bcc = 5; + + required string Subject = 6; + + optional string TextBody = 7; + optional string HtmlBody = 8; + + repeated MailAttachment Attachment = 9; + + repeated MailHeader Header = 10; +} diff --git a/vendor/google.golang.org/appengine/internal/main.go b/vendor/google.golang.org/appengine/internal/main.go new file mode 100644 index 000000000..1e765312f --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/main.go @@ -0,0 +1,16 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build appengine + +package internal + +import ( + "appengine_internal" +) + +func Main() { + MainPath = "" + appengine_internal.Main() +} diff --git a/vendor/google.golang.org/appengine/internal/main_common.go b/vendor/google.golang.org/appengine/internal/main_common.go new file mode 100644 index 000000000..357dce4dd --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/main_common.go @@ -0,0 +1,7 @@ +package internal + +// MainPath stores the file path of the main package. On App Engine Standard +// using Go version 1.9 and below, this will be unset. On App Engine Flex and +// App Engine Standard second-gen (Go 1.11 and above), this will be the +// filepath to package main. +var MainPath string diff --git a/vendor/google.golang.org/appengine/internal/main_test.go b/vendor/google.golang.org/appengine/internal/main_test.go new file mode 100644 index 000000000..17308e0ab --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/main_test.go @@ -0,0 +1,18 @@ +// +build !appengine + +package internal + +import ( + "go/build" + "path/filepath" + "testing" +) + +func TestFindMainPath(t *testing.T) { + // Tests won't have package main, instead they have testing.tRunner + want := filepath.Join(build.Default.GOROOT, "src", "testing", "testing.go") + got := findMainPath() + if want != got { + t.Errorf("findMainPath: want %s, got %s", want, got) + } +} diff --git a/vendor/google.golang.org/appengine/internal/main_vm.go b/vendor/google.golang.org/appengine/internal/main_vm.go new file mode 100644 index 000000000..ddb79a333 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/main_vm.go @@ -0,0 +1,69 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package internal + +import ( + "io" + "log" + "net/http" + "net/url" + "os" + "path/filepath" + "runtime" +) + +func Main() { + MainPath = filepath.Dir(findMainPath()) + installHealthChecker(http.DefaultServeMux) + + port := "8080" + if s := os.Getenv("PORT"); s != "" { + port = s + } + + host := "" + if IsDevAppServer() { + host = "127.0.0.1" + } + if err := http.ListenAndServe(host+":"+port, http.HandlerFunc(handleHTTP)); err != nil { + log.Fatalf("http.ListenAndServe: %v", err) + } +} + +// Find the path to package main by looking at the root Caller. +func findMainPath() string { + pc := make([]uintptr, 100) + n := runtime.Callers(2, pc) + frames := runtime.CallersFrames(pc[:n]) + for { + frame, more := frames.Next() + // Tests won't have package main, instead they have testing.tRunner + if frame.Function == "main.main" || frame.Function == "testing.tRunner" { + return frame.File + } + if !more { + break + } + } + return "" +} + +func installHealthChecker(mux *http.ServeMux) { + // If no health check handler has been installed by this point, add a trivial one. + const healthPath = "/_ah/health" + hreq := &http.Request{ + Method: "GET", + URL: &url.URL{ + Path: healthPath, + }, + } + if _, pat := mux.Handler(hreq); pat != healthPath { + mux.HandleFunc(healthPath, func(w http.ResponseWriter, r *http.Request) { + io.WriteString(w, "ok") + }) + } +} diff --git a/vendor/google.golang.org/appengine/internal/memcache/memcache_service.pb.go b/vendor/google.golang.org/appengine/internal/memcache/memcache_service.pb.go new file mode 100644 index 000000000..2c1339930 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/memcache/memcache_service.pb.go @@ -0,0 +1,1562 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/memcache/memcache_service.proto + +package memcache + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type MemcacheServiceError_ErrorCode int32 + +const ( + MemcacheServiceError_OK MemcacheServiceError_ErrorCode = 0 + MemcacheServiceError_UNSPECIFIED_ERROR MemcacheServiceError_ErrorCode = 1 + MemcacheServiceError_NAMESPACE_NOT_SET MemcacheServiceError_ErrorCode = 2 + MemcacheServiceError_PERMISSION_DENIED MemcacheServiceError_ErrorCode = 3 + MemcacheServiceError_INVALID_VALUE MemcacheServiceError_ErrorCode = 6 +) + +var MemcacheServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "UNSPECIFIED_ERROR", + 2: "NAMESPACE_NOT_SET", + 3: "PERMISSION_DENIED", + 6: "INVALID_VALUE", +} +var MemcacheServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "UNSPECIFIED_ERROR": 1, + "NAMESPACE_NOT_SET": 2, + "PERMISSION_DENIED": 3, + "INVALID_VALUE": 6, +} + +func (x MemcacheServiceError_ErrorCode) Enum() *MemcacheServiceError_ErrorCode { + p := new(MemcacheServiceError_ErrorCode) + *p = x + return p +} +func (x MemcacheServiceError_ErrorCode) String() string { + return proto.EnumName(MemcacheServiceError_ErrorCode_name, int32(x)) +} +func (x *MemcacheServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MemcacheServiceError_ErrorCode_value, data, "MemcacheServiceError_ErrorCode") + if err != nil { + return err + } + *x = MemcacheServiceError_ErrorCode(value) + return nil +} +func (MemcacheServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{0, 0} +} + +type MemcacheSetRequest_SetPolicy int32 + +const ( + MemcacheSetRequest_SET MemcacheSetRequest_SetPolicy = 1 + MemcacheSetRequest_ADD MemcacheSetRequest_SetPolicy = 2 + MemcacheSetRequest_REPLACE MemcacheSetRequest_SetPolicy = 3 + MemcacheSetRequest_CAS MemcacheSetRequest_SetPolicy = 4 +) + +var MemcacheSetRequest_SetPolicy_name = map[int32]string{ + 1: "SET", + 2: "ADD", + 3: "REPLACE", + 4: "CAS", +} +var MemcacheSetRequest_SetPolicy_value = map[string]int32{ + "SET": 1, + "ADD": 2, + "REPLACE": 3, + "CAS": 4, +} + +func (x MemcacheSetRequest_SetPolicy) Enum() *MemcacheSetRequest_SetPolicy { + p := new(MemcacheSetRequest_SetPolicy) + *p = x + return p +} +func (x MemcacheSetRequest_SetPolicy) String() string { + return proto.EnumName(MemcacheSetRequest_SetPolicy_name, int32(x)) +} +func (x *MemcacheSetRequest_SetPolicy) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MemcacheSetRequest_SetPolicy_value, data, "MemcacheSetRequest_SetPolicy") + if err != nil { + return err + } + *x = MemcacheSetRequest_SetPolicy(value) + return nil +} +func (MemcacheSetRequest_SetPolicy) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{4, 0} +} + +type MemcacheSetResponse_SetStatusCode int32 + +const ( + MemcacheSetResponse_STORED MemcacheSetResponse_SetStatusCode = 1 + MemcacheSetResponse_NOT_STORED MemcacheSetResponse_SetStatusCode = 2 + MemcacheSetResponse_ERROR MemcacheSetResponse_SetStatusCode = 3 + MemcacheSetResponse_EXISTS MemcacheSetResponse_SetStatusCode = 4 +) + +var MemcacheSetResponse_SetStatusCode_name = map[int32]string{ + 1: "STORED", + 2: "NOT_STORED", + 3: "ERROR", + 4: "EXISTS", +} +var MemcacheSetResponse_SetStatusCode_value = map[string]int32{ + "STORED": 1, + "NOT_STORED": 2, + "ERROR": 3, + "EXISTS": 4, +} + +func (x MemcacheSetResponse_SetStatusCode) Enum() *MemcacheSetResponse_SetStatusCode { + p := new(MemcacheSetResponse_SetStatusCode) + *p = x + return p +} +func (x MemcacheSetResponse_SetStatusCode) String() string { + return proto.EnumName(MemcacheSetResponse_SetStatusCode_name, int32(x)) +} +func (x *MemcacheSetResponse_SetStatusCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MemcacheSetResponse_SetStatusCode_value, data, "MemcacheSetResponse_SetStatusCode") + if err != nil { + return err + } + *x = MemcacheSetResponse_SetStatusCode(value) + return nil +} +func (MemcacheSetResponse_SetStatusCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{5, 0} +} + +type MemcacheDeleteResponse_DeleteStatusCode int32 + +const ( + MemcacheDeleteResponse_DELETED MemcacheDeleteResponse_DeleteStatusCode = 1 + MemcacheDeleteResponse_NOT_FOUND MemcacheDeleteResponse_DeleteStatusCode = 2 +) + +var MemcacheDeleteResponse_DeleteStatusCode_name = map[int32]string{ + 1: "DELETED", + 2: "NOT_FOUND", +} +var MemcacheDeleteResponse_DeleteStatusCode_value = map[string]int32{ + "DELETED": 1, + "NOT_FOUND": 2, +} + +func (x MemcacheDeleteResponse_DeleteStatusCode) Enum() *MemcacheDeleteResponse_DeleteStatusCode { + p := new(MemcacheDeleteResponse_DeleteStatusCode) + *p = x + return p +} +func (x MemcacheDeleteResponse_DeleteStatusCode) String() string { + return proto.EnumName(MemcacheDeleteResponse_DeleteStatusCode_name, int32(x)) +} +func (x *MemcacheDeleteResponse_DeleteStatusCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MemcacheDeleteResponse_DeleteStatusCode_value, data, "MemcacheDeleteResponse_DeleteStatusCode") + if err != nil { + return err + } + *x = MemcacheDeleteResponse_DeleteStatusCode(value) + return nil +} +func (MemcacheDeleteResponse_DeleteStatusCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{7, 0} +} + +type MemcacheIncrementRequest_Direction int32 + +const ( + MemcacheIncrementRequest_INCREMENT MemcacheIncrementRequest_Direction = 1 + MemcacheIncrementRequest_DECREMENT MemcacheIncrementRequest_Direction = 2 +) + +var MemcacheIncrementRequest_Direction_name = map[int32]string{ + 1: "INCREMENT", + 2: "DECREMENT", +} +var MemcacheIncrementRequest_Direction_value = map[string]int32{ + "INCREMENT": 1, + "DECREMENT": 2, +} + +func (x MemcacheIncrementRequest_Direction) Enum() *MemcacheIncrementRequest_Direction { + p := new(MemcacheIncrementRequest_Direction) + *p = x + return p +} +func (x MemcacheIncrementRequest_Direction) String() string { + return proto.EnumName(MemcacheIncrementRequest_Direction_name, int32(x)) +} +func (x *MemcacheIncrementRequest_Direction) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MemcacheIncrementRequest_Direction_value, data, "MemcacheIncrementRequest_Direction") + if err != nil { + return err + } + *x = MemcacheIncrementRequest_Direction(value) + return nil +} +func (MemcacheIncrementRequest_Direction) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{8, 0} +} + +type MemcacheIncrementResponse_IncrementStatusCode int32 + +const ( + MemcacheIncrementResponse_OK MemcacheIncrementResponse_IncrementStatusCode = 1 + MemcacheIncrementResponse_NOT_CHANGED MemcacheIncrementResponse_IncrementStatusCode = 2 + MemcacheIncrementResponse_ERROR MemcacheIncrementResponse_IncrementStatusCode = 3 +) + +var MemcacheIncrementResponse_IncrementStatusCode_name = map[int32]string{ + 1: "OK", + 2: "NOT_CHANGED", + 3: "ERROR", +} +var MemcacheIncrementResponse_IncrementStatusCode_value = map[string]int32{ + "OK": 1, + "NOT_CHANGED": 2, + "ERROR": 3, +} + +func (x MemcacheIncrementResponse_IncrementStatusCode) Enum() *MemcacheIncrementResponse_IncrementStatusCode { + p := new(MemcacheIncrementResponse_IncrementStatusCode) + *p = x + return p +} +func (x MemcacheIncrementResponse_IncrementStatusCode) String() string { + return proto.EnumName(MemcacheIncrementResponse_IncrementStatusCode_name, int32(x)) +} +func (x *MemcacheIncrementResponse_IncrementStatusCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MemcacheIncrementResponse_IncrementStatusCode_value, data, "MemcacheIncrementResponse_IncrementStatusCode") + if err != nil { + return err + } + *x = MemcacheIncrementResponse_IncrementStatusCode(value) + return nil +} +func (MemcacheIncrementResponse_IncrementStatusCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{9, 0} +} + +type MemcacheServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheServiceError) Reset() { *m = MemcacheServiceError{} } +func (m *MemcacheServiceError) String() string { return proto.CompactTextString(m) } +func (*MemcacheServiceError) ProtoMessage() {} +func (*MemcacheServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{0} +} +func (m *MemcacheServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheServiceError.Unmarshal(m, b) +} +func (m *MemcacheServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheServiceError.Marshal(b, m, deterministic) +} +func (dst *MemcacheServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheServiceError.Merge(dst, src) +} +func (m *MemcacheServiceError) XXX_Size() int { + return xxx_messageInfo_MemcacheServiceError.Size(m) +} +func (m *MemcacheServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheServiceError proto.InternalMessageInfo + +type AppOverride struct { + AppId *string `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` + NumMemcachegBackends *int32 `protobuf:"varint,2,opt,name=num_memcacheg_backends,json=numMemcachegBackends" json:"num_memcacheg_backends,omitempty"` // Deprecated: Do not use. + IgnoreShardlock *bool `protobuf:"varint,3,opt,name=ignore_shardlock,json=ignoreShardlock" json:"ignore_shardlock,omitempty"` // Deprecated: Do not use. + MemcachePoolHint *string `protobuf:"bytes,4,opt,name=memcache_pool_hint,json=memcachePoolHint" json:"memcache_pool_hint,omitempty"` // Deprecated: Do not use. + MemcacheShardingStrategy []byte `protobuf:"bytes,5,opt,name=memcache_sharding_strategy,json=memcacheShardingStrategy" json:"memcache_sharding_strategy,omitempty"` // Deprecated: Do not use. + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AppOverride) Reset() { *m = AppOverride{} } +func (m *AppOverride) String() string { return proto.CompactTextString(m) } +func (*AppOverride) ProtoMessage() {} +func (*AppOverride) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{1} +} +func (m *AppOverride) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppOverride.Unmarshal(m, b) +} +func (m *AppOverride) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppOverride.Marshal(b, m, deterministic) +} +func (dst *AppOverride) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppOverride.Merge(dst, src) +} +func (m *AppOverride) XXX_Size() int { + return xxx_messageInfo_AppOverride.Size(m) +} +func (m *AppOverride) XXX_DiscardUnknown() { + xxx_messageInfo_AppOverride.DiscardUnknown(m) +} + +var xxx_messageInfo_AppOverride proto.InternalMessageInfo + +func (m *AppOverride) GetAppId() string { + if m != nil && m.AppId != nil { + return *m.AppId + } + return "" +} + +// Deprecated: Do not use. +func (m *AppOverride) GetNumMemcachegBackends() int32 { + if m != nil && m.NumMemcachegBackends != nil { + return *m.NumMemcachegBackends + } + return 0 +} + +// Deprecated: Do not use. +func (m *AppOverride) GetIgnoreShardlock() bool { + if m != nil && m.IgnoreShardlock != nil { + return *m.IgnoreShardlock + } + return false +} + +// Deprecated: Do not use. +func (m *AppOverride) GetMemcachePoolHint() string { + if m != nil && m.MemcachePoolHint != nil { + return *m.MemcachePoolHint + } + return "" +} + +// Deprecated: Do not use. +func (m *AppOverride) GetMemcacheShardingStrategy() []byte { + if m != nil { + return m.MemcacheShardingStrategy + } + return nil +} + +type MemcacheGetRequest struct { + Key [][]byte `protobuf:"bytes,1,rep,name=key" json:"key,omitempty"` + NameSpace *string `protobuf:"bytes,2,opt,name=name_space,json=nameSpace,def=" json:"name_space,omitempty"` + ForCas *bool `protobuf:"varint,4,opt,name=for_cas,json=forCas" json:"for_cas,omitempty"` + Override *AppOverride `protobuf:"bytes,5,opt,name=override" json:"override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheGetRequest) Reset() { *m = MemcacheGetRequest{} } +func (m *MemcacheGetRequest) String() string { return proto.CompactTextString(m) } +func (*MemcacheGetRequest) ProtoMessage() {} +func (*MemcacheGetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{2} +} +func (m *MemcacheGetRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheGetRequest.Unmarshal(m, b) +} +func (m *MemcacheGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheGetRequest.Marshal(b, m, deterministic) +} +func (dst *MemcacheGetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheGetRequest.Merge(dst, src) +} +func (m *MemcacheGetRequest) XXX_Size() int { + return xxx_messageInfo_MemcacheGetRequest.Size(m) +} +func (m *MemcacheGetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheGetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheGetRequest proto.InternalMessageInfo + +func (m *MemcacheGetRequest) GetKey() [][]byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *MemcacheGetRequest) GetNameSpace() string { + if m != nil && m.NameSpace != nil { + return *m.NameSpace + } + return "" +} + +func (m *MemcacheGetRequest) GetForCas() bool { + if m != nil && m.ForCas != nil { + return *m.ForCas + } + return false +} + +func (m *MemcacheGetRequest) GetOverride() *AppOverride { + if m != nil { + return m.Override + } + return nil +} + +type MemcacheGetResponse struct { + Item []*MemcacheGetResponse_Item `protobuf:"group,1,rep,name=Item,json=item" json:"item,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheGetResponse) Reset() { *m = MemcacheGetResponse{} } +func (m *MemcacheGetResponse) String() string { return proto.CompactTextString(m) } +func (*MemcacheGetResponse) ProtoMessage() {} +func (*MemcacheGetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{3} +} +func (m *MemcacheGetResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheGetResponse.Unmarshal(m, b) +} +func (m *MemcacheGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheGetResponse.Marshal(b, m, deterministic) +} +func (dst *MemcacheGetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheGetResponse.Merge(dst, src) +} +func (m *MemcacheGetResponse) XXX_Size() int { + return xxx_messageInfo_MemcacheGetResponse.Size(m) +} +func (m *MemcacheGetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheGetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheGetResponse proto.InternalMessageInfo + +func (m *MemcacheGetResponse) GetItem() []*MemcacheGetResponse_Item { + if m != nil { + return m.Item + } + return nil +} + +type MemcacheGetResponse_Item struct { + Key []byte `protobuf:"bytes,2,req,name=key" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,req,name=value" json:"value,omitempty"` + Flags *uint32 `protobuf:"fixed32,4,opt,name=flags" json:"flags,omitempty"` + CasId *uint64 `protobuf:"fixed64,5,opt,name=cas_id,json=casId" json:"cas_id,omitempty"` + ExpiresInSeconds *int32 `protobuf:"varint,6,opt,name=expires_in_seconds,json=expiresInSeconds" json:"expires_in_seconds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheGetResponse_Item) Reset() { *m = MemcacheGetResponse_Item{} } +func (m *MemcacheGetResponse_Item) String() string { return proto.CompactTextString(m) } +func (*MemcacheGetResponse_Item) ProtoMessage() {} +func (*MemcacheGetResponse_Item) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{3, 0} +} +func (m *MemcacheGetResponse_Item) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheGetResponse_Item.Unmarshal(m, b) +} +func (m *MemcacheGetResponse_Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheGetResponse_Item.Marshal(b, m, deterministic) +} +func (dst *MemcacheGetResponse_Item) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheGetResponse_Item.Merge(dst, src) +} +func (m *MemcacheGetResponse_Item) XXX_Size() int { + return xxx_messageInfo_MemcacheGetResponse_Item.Size(m) +} +func (m *MemcacheGetResponse_Item) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheGetResponse_Item.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheGetResponse_Item proto.InternalMessageInfo + +func (m *MemcacheGetResponse_Item) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *MemcacheGetResponse_Item) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *MemcacheGetResponse_Item) GetFlags() uint32 { + if m != nil && m.Flags != nil { + return *m.Flags + } + return 0 +} + +func (m *MemcacheGetResponse_Item) GetCasId() uint64 { + if m != nil && m.CasId != nil { + return *m.CasId + } + return 0 +} + +func (m *MemcacheGetResponse_Item) GetExpiresInSeconds() int32 { + if m != nil && m.ExpiresInSeconds != nil { + return *m.ExpiresInSeconds + } + return 0 +} + +type MemcacheSetRequest struct { + Item []*MemcacheSetRequest_Item `protobuf:"group,1,rep,name=Item,json=item" json:"item,omitempty"` + NameSpace *string `protobuf:"bytes,7,opt,name=name_space,json=nameSpace,def=" json:"name_space,omitempty"` + Override *AppOverride `protobuf:"bytes,10,opt,name=override" json:"override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheSetRequest) Reset() { *m = MemcacheSetRequest{} } +func (m *MemcacheSetRequest) String() string { return proto.CompactTextString(m) } +func (*MemcacheSetRequest) ProtoMessage() {} +func (*MemcacheSetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{4} +} +func (m *MemcacheSetRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheSetRequest.Unmarshal(m, b) +} +func (m *MemcacheSetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheSetRequest.Marshal(b, m, deterministic) +} +func (dst *MemcacheSetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheSetRequest.Merge(dst, src) +} +func (m *MemcacheSetRequest) XXX_Size() int { + return xxx_messageInfo_MemcacheSetRequest.Size(m) +} +func (m *MemcacheSetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheSetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheSetRequest proto.InternalMessageInfo + +func (m *MemcacheSetRequest) GetItem() []*MemcacheSetRequest_Item { + if m != nil { + return m.Item + } + return nil +} + +func (m *MemcacheSetRequest) GetNameSpace() string { + if m != nil && m.NameSpace != nil { + return *m.NameSpace + } + return "" +} + +func (m *MemcacheSetRequest) GetOverride() *AppOverride { + if m != nil { + return m.Override + } + return nil +} + +type MemcacheSetRequest_Item struct { + Key []byte `protobuf:"bytes,2,req,name=key" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,req,name=value" json:"value,omitempty"` + Flags *uint32 `protobuf:"fixed32,4,opt,name=flags" json:"flags,omitempty"` + SetPolicy *MemcacheSetRequest_SetPolicy `protobuf:"varint,5,opt,name=set_policy,json=setPolicy,enum=appengine.MemcacheSetRequest_SetPolicy,def=1" json:"set_policy,omitempty"` + ExpirationTime *uint32 `protobuf:"fixed32,6,opt,name=expiration_time,json=expirationTime,def=0" json:"expiration_time,omitempty"` + CasId *uint64 `protobuf:"fixed64,8,opt,name=cas_id,json=casId" json:"cas_id,omitempty"` + ForCas *bool `protobuf:"varint,9,opt,name=for_cas,json=forCas" json:"for_cas,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheSetRequest_Item) Reset() { *m = MemcacheSetRequest_Item{} } +func (m *MemcacheSetRequest_Item) String() string { return proto.CompactTextString(m) } +func (*MemcacheSetRequest_Item) ProtoMessage() {} +func (*MemcacheSetRequest_Item) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{4, 0} +} +func (m *MemcacheSetRequest_Item) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheSetRequest_Item.Unmarshal(m, b) +} +func (m *MemcacheSetRequest_Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheSetRequest_Item.Marshal(b, m, deterministic) +} +func (dst *MemcacheSetRequest_Item) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheSetRequest_Item.Merge(dst, src) +} +func (m *MemcacheSetRequest_Item) XXX_Size() int { + return xxx_messageInfo_MemcacheSetRequest_Item.Size(m) +} +func (m *MemcacheSetRequest_Item) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheSetRequest_Item.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheSetRequest_Item proto.InternalMessageInfo + +const Default_MemcacheSetRequest_Item_SetPolicy MemcacheSetRequest_SetPolicy = MemcacheSetRequest_SET +const Default_MemcacheSetRequest_Item_ExpirationTime uint32 = 0 + +func (m *MemcacheSetRequest_Item) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *MemcacheSetRequest_Item) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *MemcacheSetRequest_Item) GetFlags() uint32 { + if m != nil && m.Flags != nil { + return *m.Flags + } + return 0 +} + +func (m *MemcacheSetRequest_Item) GetSetPolicy() MemcacheSetRequest_SetPolicy { + if m != nil && m.SetPolicy != nil { + return *m.SetPolicy + } + return Default_MemcacheSetRequest_Item_SetPolicy +} + +func (m *MemcacheSetRequest_Item) GetExpirationTime() uint32 { + if m != nil && m.ExpirationTime != nil { + return *m.ExpirationTime + } + return Default_MemcacheSetRequest_Item_ExpirationTime +} + +func (m *MemcacheSetRequest_Item) GetCasId() uint64 { + if m != nil && m.CasId != nil { + return *m.CasId + } + return 0 +} + +func (m *MemcacheSetRequest_Item) GetForCas() bool { + if m != nil && m.ForCas != nil { + return *m.ForCas + } + return false +} + +type MemcacheSetResponse struct { + SetStatus []MemcacheSetResponse_SetStatusCode `protobuf:"varint,1,rep,name=set_status,json=setStatus,enum=appengine.MemcacheSetResponse_SetStatusCode" json:"set_status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheSetResponse) Reset() { *m = MemcacheSetResponse{} } +func (m *MemcacheSetResponse) String() string { return proto.CompactTextString(m) } +func (*MemcacheSetResponse) ProtoMessage() {} +func (*MemcacheSetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{5} +} +func (m *MemcacheSetResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheSetResponse.Unmarshal(m, b) +} +func (m *MemcacheSetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheSetResponse.Marshal(b, m, deterministic) +} +func (dst *MemcacheSetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheSetResponse.Merge(dst, src) +} +func (m *MemcacheSetResponse) XXX_Size() int { + return xxx_messageInfo_MemcacheSetResponse.Size(m) +} +func (m *MemcacheSetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheSetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheSetResponse proto.InternalMessageInfo + +func (m *MemcacheSetResponse) GetSetStatus() []MemcacheSetResponse_SetStatusCode { + if m != nil { + return m.SetStatus + } + return nil +} + +type MemcacheDeleteRequest struct { + Item []*MemcacheDeleteRequest_Item `protobuf:"group,1,rep,name=Item,json=item" json:"item,omitempty"` + NameSpace *string `protobuf:"bytes,4,opt,name=name_space,json=nameSpace,def=" json:"name_space,omitempty"` + Override *AppOverride `protobuf:"bytes,5,opt,name=override" json:"override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheDeleteRequest) Reset() { *m = MemcacheDeleteRequest{} } +func (m *MemcacheDeleteRequest) String() string { return proto.CompactTextString(m) } +func (*MemcacheDeleteRequest) ProtoMessage() {} +func (*MemcacheDeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{6} +} +func (m *MemcacheDeleteRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheDeleteRequest.Unmarshal(m, b) +} +func (m *MemcacheDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheDeleteRequest.Marshal(b, m, deterministic) +} +func (dst *MemcacheDeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheDeleteRequest.Merge(dst, src) +} +func (m *MemcacheDeleteRequest) XXX_Size() int { + return xxx_messageInfo_MemcacheDeleteRequest.Size(m) +} +func (m *MemcacheDeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheDeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheDeleteRequest proto.InternalMessageInfo + +func (m *MemcacheDeleteRequest) GetItem() []*MemcacheDeleteRequest_Item { + if m != nil { + return m.Item + } + return nil +} + +func (m *MemcacheDeleteRequest) GetNameSpace() string { + if m != nil && m.NameSpace != nil { + return *m.NameSpace + } + return "" +} + +func (m *MemcacheDeleteRequest) GetOverride() *AppOverride { + if m != nil { + return m.Override + } + return nil +} + +type MemcacheDeleteRequest_Item struct { + Key []byte `protobuf:"bytes,2,req,name=key" json:"key,omitempty"` + DeleteTime *uint32 `protobuf:"fixed32,3,opt,name=delete_time,json=deleteTime,def=0" json:"delete_time,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheDeleteRequest_Item) Reset() { *m = MemcacheDeleteRequest_Item{} } +func (m *MemcacheDeleteRequest_Item) String() string { return proto.CompactTextString(m) } +func (*MemcacheDeleteRequest_Item) ProtoMessage() {} +func (*MemcacheDeleteRequest_Item) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{6, 0} +} +func (m *MemcacheDeleteRequest_Item) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheDeleteRequest_Item.Unmarshal(m, b) +} +func (m *MemcacheDeleteRequest_Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheDeleteRequest_Item.Marshal(b, m, deterministic) +} +func (dst *MemcacheDeleteRequest_Item) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheDeleteRequest_Item.Merge(dst, src) +} +func (m *MemcacheDeleteRequest_Item) XXX_Size() int { + return xxx_messageInfo_MemcacheDeleteRequest_Item.Size(m) +} +func (m *MemcacheDeleteRequest_Item) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheDeleteRequest_Item.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheDeleteRequest_Item proto.InternalMessageInfo + +const Default_MemcacheDeleteRequest_Item_DeleteTime uint32 = 0 + +func (m *MemcacheDeleteRequest_Item) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *MemcacheDeleteRequest_Item) GetDeleteTime() uint32 { + if m != nil && m.DeleteTime != nil { + return *m.DeleteTime + } + return Default_MemcacheDeleteRequest_Item_DeleteTime +} + +type MemcacheDeleteResponse struct { + DeleteStatus []MemcacheDeleteResponse_DeleteStatusCode `protobuf:"varint,1,rep,name=delete_status,json=deleteStatus,enum=appengine.MemcacheDeleteResponse_DeleteStatusCode" json:"delete_status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheDeleteResponse) Reset() { *m = MemcacheDeleteResponse{} } +func (m *MemcacheDeleteResponse) String() string { return proto.CompactTextString(m) } +func (*MemcacheDeleteResponse) ProtoMessage() {} +func (*MemcacheDeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{7} +} +func (m *MemcacheDeleteResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheDeleteResponse.Unmarshal(m, b) +} +func (m *MemcacheDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheDeleteResponse.Marshal(b, m, deterministic) +} +func (dst *MemcacheDeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheDeleteResponse.Merge(dst, src) +} +func (m *MemcacheDeleteResponse) XXX_Size() int { + return xxx_messageInfo_MemcacheDeleteResponse.Size(m) +} +func (m *MemcacheDeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheDeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheDeleteResponse proto.InternalMessageInfo + +func (m *MemcacheDeleteResponse) GetDeleteStatus() []MemcacheDeleteResponse_DeleteStatusCode { + if m != nil { + return m.DeleteStatus + } + return nil +} + +type MemcacheIncrementRequest struct { + Key []byte `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` + NameSpace *string `protobuf:"bytes,4,opt,name=name_space,json=nameSpace,def=" json:"name_space,omitempty"` + Delta *uint64 `protobuf:"varint,2,opt,name=delta,def=1" json:"delta,omitempty"` + Direction *MemcacheIncrementRequest_Direction `protobuf:"varint,3,opt,name=direction,enum=appengine.MemcacheIncrementRequest_Direction,def=1" json:"direction,omitempty"` + InitialValue *uint64 `protobuf:"varint,5,opt,name=initial_value,json=initialValue" json:"initial_value,omitempty"` + InitialFlags *uint32 `protobuf:"fixed32,6,opt,name=initial_flags,json=initialFlags" json:"initial_flags,omitempty"` + Override *AppOverride `protobuf:"bytes,7,opt,name=override" json:"override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheIncrementRequest) Reset() { *m = MemcacheIncrementRequest{} } +func (m *MemcacheIncrementRequest) String() string { return proto.CompactTextString(m) } +func (*MemcacheIncrementRequest) ProtoMessage() {} +func (*MemcacheIncrementRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{8} +} +func (m *MemcacheIncrementRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheIncrementRequest.Unmarshal(m, b) +} +func (m *MemcacheIncrementRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheIncrementRequest.Marshal(b, m, deterministic) +} +func (dst *MemcacheIncrementRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheIncrementRequest.Merge(dst, src) +} +func (m *MemcacheIncrementRequest) XXX_Size() int { + return xxx_messageInfo_MemcacheIncrementRequest.Size(m) +} +func (m *MemcacheIncrementRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheIncrementRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheIncrementRequest proto.InternalMessageInfo + +const Default_MemcacheIncrementRequest_Delta uint64 = 1 +const Default_MemcacheIncrementRequest_Direction MemcacheIncrementRequest_Direction = MemcacheIncrementRequest_INCREMENT + +func (m *MemcacheIncrementRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *MemcacheIncrementRequest) GetNameSpace() string { + if m != nil && m.NameSpace != nil { + return *m.NameSpace + } + return "" +} + +func (m *MemcacheIncrementRequest) GetDelta() uint64 { + if m != nil && m.Delta != nil { + return *m.Delta + } + return Default_MemcacheIncrementRequest_Delta +} + +func (m *MemcacheIncrementRequest) GetDirection() MemcacheIncrementRequest_Direction { + if m != nil && m.Direction != nil { + return *m.Direction + } + return Default_MemcacheIncrementRequest_Direction +} + +func (m *MemcacheIncrementRequest) GetInitialValue() uint64 { + if m != nil && m.InitialValue != nil { + return *m.InitialValue + } + return 0 +} + +func (m *MemcacheIncrementRequest) GetInitialFlags() uint32 { + if m != nil && m.InitialFlags != nil { + return *m.InitialFlags + } + return 0 +} + +func (m *MemcacheIncrementRequest) GetOverride() *AppOverride { + if m != nil { + return m.Override + } + return nil +} + +type MemcacheIncrementResponse struct { + NewValue *uint64 `protobuf:"varint,1,opt,name=new_value,json=newValue" json:"new_value,omitempty"` + IncrementStatus *MemcacheIncrementResponse_IncrementStatusCode `protobuf:"varint,2,opt,name=increment_status,json=incrementStatus,enum=appengine.MemcacheIncrementResponse_IncrementStatusCode" json:"increment_status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheIncrementResponse) Reset() { *m = MemcacheIncrementResponse{} } +func (m *MemcacheIncrementResponse) String() string { return proto.CompactTextString(m) } +func (*MemcacheIncrementResponse) ProtoMessage() {} +func (*MemcacheIncrementResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{9} +} +func (m *MemcacheIncrementResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheIncrementResponse.Unmarshal(m, b) +} +func (m *MemcacheIncrementResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheIncrementResponse.Marshal(b, m, deterministic) +} +func (dst *MemcacheIncrementResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheIncrementResponse.Merge(dst, src) +} +func (m *MemcacheIncrementResponse) XXX_Size() int { + return xxx_messageInfo_MemcacheIncrementResponse.Size(m) +} +func (m *MemcacheIncrementResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheIncrementResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheIncrementResponse proto.InternalMessageInfo + +func (m *MemcacheIncrementResponse) GetNewValue() uint64 { + if m != nil && m.NewValue != nil { + return *m.NewValue + } + return 0 +} + +func (m *MemcacheIncrementResponse) GetIncrementStatus() MemcacheIncrementResponse_IncrementStatusCode { + if m != nil && m.IncrementStatus != nil { + return *m.IncrementStatus + } + return MemcacheIncrementResponse_OK +} + +type MemcacheBatchIncrementRequest struct { + NameSpace *string `protobuf:"bytes,1,opt,name=name_space,json=nameSpace,def=" json:"name_space,omitempty"` + Item []*MemcacheIncrementRequest `protobuf:"bytes,2,rep,name=item" json:"item,omitempty"` + Override *AppOverride `protobuf:"bytes,3,opt,name=override" json:"override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheBatchIncrementRequest) Reset() { *m = MemcacheBatchIncrementRequest{} } +func (m *MemcacheBatchIncrementRequest) String() string { return proto.CompactTextString(m) } +func (*MemcacheBatchIncrementRequest) ProtoMessage() {} +func (*MemcacheBatchIncrementRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{10} +} +func (m *MemcacheBatchIncrementRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheBatchIncrementRequest.Unmarshal(m, b) +} +func (m *MemcacheBatchIncrementRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheBatchIncrementRequest.Marshal(b, m, deterministic) +} +func (dst *MemcacheBatchIncrementRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheBatchIncrementRequest.Merge(dst, src) +} +func (m *MemcacheBatchIncrementRequest) XXX_Size() int { + return xxx_messageInfo_MemcacheBatchIncrementRequest.Size(m) +} +func (m *MemcacheBatchIncrementRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheBatchIncrementRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheBatchIncrementRequest proto.InternalMessageInfo + +func (m *MemcacheBatchIncrementRequest) GetNameSpace() string { + if m != nil && m.NameSpace != nil { + return *m.NameSpace + } + return "" +} + +func (m *MemcacheBatchIncrementRequest) GetItem() []*MemcacheIncrementRequest { + if m != nil { + return m.Item + } + return nil +} + +func (m *MemcacheBatchIncrementRequest) GetOverride() *AppOverride { + if m != nil { + return m.Override + } + return nil +} + +type MemcacheBatchIncrementResponse struct { + Item []*MemcacheIncrementResponse `protobuf:"bytes,1,rep,name=item" json:"item,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheBatchIncrementResponse) Reset() { *m = MemcacheBatchIncrementResponse{} } +func (m *MemcacheBatchIncrementResponse) String() string { return proto.CompactTextString(m) } +func (*MemcacheBatchIncrementResponse) ProtoMessage() {} +func (*MemcacheBatchIncrementResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{11} +} +func (m *MemcacheBatchIncrementResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheBatchIncrementResponse.Unmarshal(m, b) +} +func (m *MemcacheBatchIncrementResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheBatchIncrementResponse.Marshal(b, m, deterministic) +} +func (dst *MemcacheBatchIncrementResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheBatchIncrementResponse.Merge(dst, src) +} +func (m *MemcacheBatchIncrementResponse) XXX_Size() int { + return xxx_messageInfo_MemcacheBatchIncrementResponse.Size(m) +} +func (m *MemcacheBatchIncrementResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheBatchIncrementResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheBatchIncrementResponse proto.InternalMessageInfo + +func (m *MemcacheBatchIncrementResponse) GetItem() []*MemcacheIncrementResponse { + if m != nil { + return m.Item + } + return nil +} + +type MemcacheFlushRequest struct { + Override *AppOverride `protobuf:"bytes,1,opt,name=override" json:"override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheFlushRequest) Reset() { *m = MemcacheFlushRequest{} } +func (m *MemcacheFlushRequest) String() string { return proto.CompactTextString(m) } +func (*MemcacheFlushRequest) ProtoMessage() {} +func (*MemcacheFlushRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{12} +} +func (m *MemcacheFlushRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheFlushRequest.Unmarshal(m, b) +} +func (m *MemcacheFlushRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheFlushRequest.Marshal(b, m, deterministic) +} +func (dst *MemcacheFlushRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheFlushRequest.Merge(dst, src) +} +func (m *MemcacheFlushRequest) XXX_Size() int { + return xxx_messageInfo_MemcacheFlushRequest.Size(m) +} +func (m *MemcacheFlushRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheFlushRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheFlushRequest proto.InternalMessageInfo + +func (m *MemcacheFlushRequest) GetOverride() *AppOverride { + if m != nil { + return m.Override + } + return nil +} + +type MemcacheFlushResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheFlushResponse) Reset() { *m = MemcacheFlushResponse{} } +func (m *MemcacheFlushResponse) String() string { return proto.CompactTextString(m) } +func (*MemcacheFlushResponse) ProtoMessage() {} +func (*MemcacheFlushResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{13} +} +func (m *MemcacheFlushResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheFlushResponse.Unmarshal(m, b) +} +func (m *MemcacheFlushResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheFlushResponse.Marshal(b, m, deterministic) +} +func (dst *MemcacheFlushResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheFlushResponse.Merge(dst, src) +} +func (m *MemcacheFlushResponse) XXX_Size() int { + return xxx_messageInfo_MemcacheFlushResponse.Size(m) +} +func (m *MemcacheFlushResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheFlushResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheFlushResponse proto.InternalMessageInfo + +type MemcacheStatsRequest struct { + Override *AppOverride `protobuf:"bytes,1,opt,name=override" json:"override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheStatsRequest) Reset() { *m = MemcacheStatsRequest{} } +func (m *MemcacheStatsRequest) String() string { return proto.CompactTextString(m) } +func (*MemcacheStatsRequest) ProtoMessage() {} +func (*MemcacheStatsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{14} +} +func (m *MemcacheStatsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheStatsRequest.Unmarshal(m, b) +} +func (m *MemcacheStatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheStatsRequest.Marshal(b, m, deterministic) +} +func (dst *MemcacheStatsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheStatsRequest.Merge(dst, src) +} +func (m *MemcacheStatsRequest) XXX_Size() int { + return xxx_messageInfo_MemcacheStatsRequest.Size(m) +} +func (m *MemcacheStatsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheStatsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheStatsRequest proto.InternalMessageInfo + +func (m *MemcacheStatsRequest) GetOverride() *AppOverride { + if m != nil { + return m.Override + } + return nil +} + +type MergedNamespaceStats struct { + Hits *uint64 `protobuf:"varint,1,req,name=hits" json:"hits,omitempty"` + Misses *uint64 `protobuf:"varint,2,req,name=misses" json:"misses,omitempty"` + ByteHits *uint64 `protobuf:"varint,3,req,name=byte_hits,json=byteHits" json:"byte_hits,omitempty"` + Items *uint64 `protobuf:"varint,4,req,name=items" json:"items,omitempty"` + Bytes *uint64 `protobuf:"varint,5,req,name=bytes" json:"bytes,omitempty"` + OldestItemAge *uint32 `protobuf:"fixed32,6,req,name=oldest_item_age,json=oldestItemAge" json:"oldest_item_age,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MergedNamespaceStats) Reset() { *m = MergedNamespaceStats{} } +func (m *MergedNamespaceStats) String() string { return proto.CompactTextString(m) } +func (*MergedNamespaceStats) ProtoMessage() {} +func (*MergedNamespaceStats) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{15} +} +func (m *MergedNamespaceStats) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MergedNamespaceStats.Unmarshal(m, b) +} +func (m *MergedNamespaceStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MergedNamespaceStats.Marshal(b, m, deterministic) +} +func (dst *MergedNamespaceStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_MergedNamespaceStats.Merge(dst, src) +} +func (m *MergedNamespaceStats) XXX_Size() int { + return xxx_messageInfo_MergedNamespaceStats.Size(m) +} +func (m *MergedNamespaceStats) XXX_DiscardUnknown() { + xxx_messageInfo_MergedNamespaceStats.DiscardUnknown(m) +} + +var xxx_messageInfo_MergedNamespaceStats proto.InternalMessageInfo + +func (m *MergedNamespaceStats) GetHits() uint64 { + if m != nil && m.Hits != nil { + return *m.Hits + } + return 0 +} + +func (m *MergedNamespaceStats) GetMisses() uint64 { + if m != nil && m.Misses != nil { + return *m.Misses + } + return 0 +} + +func (m *MergedNamespaceStats) GetByteHits() uint64 { + if m != nil && m.ByteHits != nil { + return *m.ByteHits + } + return 0 +} + +func (m *MergedNamespaceStats) GetItems() uint64 { + if m != nil && m.Items != nil { + return *m.Items + } + return 0 +} + +func (m *MergedNamespaceStats) GetBytes() uint64 { + if m != nil && m.Bytes != nil { + return *m.Bytes + } + return 0 +} + +func (m *MergedNamespaceStats) GetOldestItemAge() uint32 { + if m != nil && m.OldestItemAge != nil { + return *m.OldestItemAge + } + return 0 +} + +type MemcacheStatsResponse struct { + Stats *MergedNamespaceStats `protobuf:"bytes,1,opt,name=stats" json:"stats,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheStatsResponse) Reset() { *m = MemcacheStatsResponse{} } +func (m *MemcacheStatsResponse) String() string { return proto.CompactTextString(m) } +func (*MemcacheStatsResponse) ProtoMessage() {} +func (*MemcacheStatsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{16} +} +func (m *MemcacheStatsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheStatsResponse.Unmarshal(m, b) +} +func (m *MemcacheStatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheStatsResponse.Marshal(b, m, deterministic) +} +func (dst *MemcacheStatsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheStatsResponse.Merge(dst, src) +} +func (m *MemcacheStatsResponse) XXX_Size() int { + return xxx_messageInfo_MemcacheStatsResponse.Size(m) +} +func (m *MemcacheStatsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheStatsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheStatsResponse proto.InternalMessageInfo + +func (m *MemcacheStatsResponse) GetStats() *MergedNamespaceStats { + if m != nil { + return m.Stats + } + return nil +} + +type MemcacheGrabTailRequest struct { + ItemCount *int32 `protobuf:"varint,1,req,name=item_count,json=itemCount" json:"item_count,omitempty"` + NameSpace *string `protobuf:"bytes,2,opt,name=name_space,json=nameSpace,def=" json:"name_space,omitempty"` + Override *AppOverride `protobuf:"bytes,3,opt,name=override" json:"override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheGrabTailRequest) Reset() { *m = MemcacheGrabTailRequest{} } +func (m *MemcacheGrabTailRequest) String() string { return proto.CompactTextString(m) } +func (*MemcacheGrabTailRequest) ProtoMessage() {} +func (*MemcacheGrabTailRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{17} +} +func (m *MemcacheGrabTailRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheGrabTailRequest.Unmarshal(m, b) +} +func (m *MemcacheGrabTailRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheGrabTailRequest.Marshal(b, m, deterministic) +} +func (dst *MemcacheGrabTailRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheGrabTailRequest.Merge(dst, src) +} +func (m *MemcacheGrabTailRequest) XXX_Size() int { + return xxx_messageInfo_MemcacheGrabTailRequest.Size(m) +} +func (m *MemcacheGrabTailRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheGrabTailRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheGrabTailRequest proto.InternalMessageInfo + +func (m *MemcacheGrabTailRequest) GetItemCount() int32 { + if m != nil && m.ItemCount != nil { + return *m.ItemCount + } + return 0 +} + +func (m *MemcacheGrabTailRequest) GetNameSpace() string { + if m != nil && m.NameSpace != nil { + return *m.NameSpace + } + return "" +} + +func (m *MemcacheGrabTailRequest) GetOverride() *AppOverride { + if m != nil { + return m.Override + } + return nil +} + +type MemcacheGrabTailResponse struct { + Item []*MemcacheGrabTailResponse_Item `protobuf:"group,1,rep,name=Item,json=item" json:"item,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheGrabTailResponse) Reset() { *m = MemcacheGrabTailResponse{} } +func (m *MemcacheGrabTailResponse) String() string { return proto.CompactTextString(m) } +func (*MemcacheGrabTailResponse) ProtoMessage() {} +func (*MemcacheGrabTailResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{18} +} +func (m *MemcacheGrabTailResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheGrabTailResponse.Unmarshal(m, b) +} +func (m *MemcacheGrabTailResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheGrabTailResponse.Marshal(b, m, deterministic) +} +func (dst *MemcacheGrabTailResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheGrabTailResponse.Merge(dst, src) +} +func (m *MemcacheGrabTailResponse) XXX_Size() int { + return xxx_messageInfo_MemcacheGrabTailResponse.Size(m) +} +func (m *MemcacheGrabTailResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheGrabTailResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheGrabTailResponse proto.InternalMessageInfo + +func (m *MemcacheGrabTailResponse) GetItem() []*MemcacheGrabTailResponse_Item { + if m != nil { + return m.Item + } + return nil +} + +type MemcacheGrabTailResponse_Item struct { + Value []byte `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` + Flags *uint32 `protobuf:"fixed32,3,opt,name=flags" json:"flags,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemcacheGrabTailResponse_Item) Reset() { *m = MemcacheGrabTailResponse_Item{} } +func (m *MemcacheGrabTailResponse_Item) String() string { return proto.CompactTextString(m) } +func (*MemcacheGrabTailResponse_Item) ProtoMessage() {} +func (*MemcacheGrabTailResponse_Item) Descriptor() ([]byte, []int) { + return fileDescriptor_memcache_service_e327a14e42649a60, []int{18, 0} +} +func (m *MemcacheGrabTailResponse_Item) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemcacheGrabTailResponse_Item.Unmarshal(m, b) +} +func (m *MemcacheGrabTailResponse_Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemcacheGrabTailResponse_Item.Marshal(b, m, deterministic) +} +func (dst *MemcacheGrabTailResponse_Item) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemcacheGrabTailResponse_Item.Merge(dst, src) +} +func (m *MemcacheGrabTailResponse_Item) XXX_Size() int { + return xxx_messageInfo_MemcacheGrabTailResponse_Item.Size(m) +} +func (m *MemcacheGrabTailResponse_Item) XXX_DiscardUnknown() { + xxx_messageInfo_MemcacheGrabTailResponse_Item.DiscardUnknown(m) +} + +var xxx_messageInfo_MemcacheGrabTailResponse_Item proto.InternalMessageInfo + +func (m *MemcacheGrabTailResponse_Item) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *MemcacheGrabTailResponse_Item) GetFlags() uint32 { + if m != nil && m.Flags != nil { + return *m.Flags + } + return 0 +} + +func init() { + proto.RegisterType((*MemcacheServiceError)(nil), "appengine.MemcacheServiceError") + proto.RegisterType((*AppOverride)(nil), "appengine.AppOverride") + proto.RegisterType((*MemcacheGetRequest)(nil), "appengine.MemcacheGetRequest") + proto.RegisterType((*MemcacheGetResponse)(nil), "appengine.MemcacheGetResponse") + proto.RegisterType((*MemcacheGetResponse_Item)(nil), "appengine.MemcacheGetResponse.Item") + proto.RegisterType((*MemcacheSetRequest)(nil), "appengine.MemcacheSetRequest") + proto.RegisterType((*MemcacheSetRequest_Item)(nil), "appengine.MemcacheSetRequest.Item") + proto.RegisterType((*MemcacheSetResponse)(nil), "appengine.MemcacheSetResponse") + proto.RegisterType((*MemcacheDeleteRequest)(nil), "appengine.MemcacheDeleteRequest") + proto.RegisterType((*MemcacheDeleteRequest_Item)(nil), "appengine.MemcacheDeleteRequest.Item") + proto.RegisterType((*MemcacheDeleteResponse)(nil), "appengine.MemcacheDeleteResponse") + proto.RegisterType((*MemcacheIncrementRequest)(nil), "appengine.MemcacheIncrementRequest") + proto.RegisterType((*MemcacheIncrementResponse)(nil), "appengine.MemcacheIncrementResponse") + proto.RegisterType((*MemcacheBatchIncrementRequest)(nil), "appengine.MemcacheBatchIncrementRequest") + proto.RegisterType((*MemcacheBatchIncrementResponse)(nil), "appengine.MemcacheBatchIncrementResponse") + proto.RegisterType((*MemcacheFlushRequest)(nil), "appengine.MemcacheFlushRequest") + proto.RegisterType((*MemcacheFlushResponse)(nil), "appengine.MemcacheFlushResponse") + proto.RegisterType((*MemcacheStatsRequest)(nil), "appengine.MemcacheStatsRequest") + proto.RegisterType((*MergedNamespaceStats)(nil), "appengine.MergedNamespaceStats") + proto.RegisterType((*MemcacheStatsResponse)(nil), "appengine.MemcacheStatsResponse") + proto.RegisterType((*MemcacheGrabTailRequest)(nil), "appengine.MemcacheGrabTailRequest") + proto.RegisterType((*MemcacheGrabTailResponse)(nil), "appengine.MemcacheGrabTailResponse") + proto.RegisterType((*MemcacheGrabTailResponse_Item)(nil), "appengine.MemcacheGrabTailResponse.Item") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/memcache/memcache_service.proto", fileDescriptor_memcache_service_e327a14e42649a60) +} + +var fileDescriptor_memcache_service_e327a14e42649a60 = []byte{ + // 1379 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,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c2, 0x91, 0x54, 0x70, + 0xd9, 0x21, 0xcc, 0x1c, 0xa3, 0x3b, 0x80, 0xe8, 0xe7, 0x91, 0x17, 0x53, 0x66, 0x7b, 0x81, 0xcd, + 0xa8, 0x13, 0x72, 0x79, 0x54, 0xb8, 0x3c, 0xb0, 0x96, 0xad, 0x98, 0x81, 0x95, 0xfa, 0xf5, 0x9f, + 0x94, 0x79, 0xcd, 0xad, 0x79, 0xcd, 0x3f, 0x58, 0xc0, 0xa6, 0xaf, 0xc0, 0x36, 0x0f, 0x2e, 0x40, + 0x5b, 0x62, 0xa6, 0x7a, 0x96, 0x99, 0x22, 0x01, 0x70, 0x39, 0x02, 0x76, 0x7e, 0xff, 0x67, 0xea, + 0xf5, 0x14, 0x80, 0xd1, 0xc4, 0x8e, 0x42, 0xdf, 0x73, 0x52, 0x41, 0x6e, 0x74, 0xde, 0xba, 0x18, + 0x99, 0x45, 0x93, 0x23, 0x11, 0xbe, 0xab, 0x58, 0xc6, 0x08, 0xab, 0x2c, 0xb7, 0xd1, 0x3b, 0xb0, + 0x29, 0x6a, 0x49, 0x12, 0x2f, 0x0c, 0xec, 0xc4, 0x9b, 0x50, 0x51, 0xe2, 0xea, 0xae, 0x74, 0x1f, + 0x6f, 0xcc, 0x57, 0x46, 0xde, 0x84, 0x16, 0x88, 0xaa, 0x15, 0x89, 0x2a, 0x88, 0x54, 0x2d, 0x8a, + 0x54, 0x7f, 0x0f, 0xd4, 0xd9, 0xc1, 0xa8, 0x0a, 0xfc, 0x68, 0x4d, 0xe2, 0x1f, 0xdd, 0x7e, 0x5f, + 0x93, 0x51, 0x1d, 0xaa, 0xd8, 0x38, 0x3a, 0xe8, 0xf6, 0x0c, 0x4d, 0xe1, 0xde, 0x5e, 0xd7, 0xd2, + 0x4a, 0xfa, 0xf7, 0x05, 0x95, 0x5a, 0x05, 0x95, 0x66, 0xa8, 0x59, 0x42, 0x92, 0x29, 0x13, 0x7c, + 0x6e, 0x74, 0xee, 0x9c, 0x87,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4, 0xfe, 0x8d, 0x04, 0x37, 0x66, 0x43, 0x5b, 0x4c, + 0x5e, 0x8c, 0x88, 0xe7, 0xe7, 0x55, 0xbd, 0x09, 0x20, 0x92, 0x71, 0xc2, 0x69, 0x90, 0x88, 0x72, + 0x94, 0xb1, 0xca, 0x3d, 0x3d, 0xee, 0xf8, 0xf3, 0x59, 0xf4, 0xaf, 0x48, 0xf4, 0x6b, 0x69, 0xde, + 0x97, 0xe7, 0xf9, 0x64, 0x18, 0x1f, 0x2d, 0x3c, 0x93, 0xad, 0x55, 0x73, 0xe7, 0xd2, 0x96, 0xe2, + 0xf0, 0xd9, 0xc9, 0x1e, 0xb5, 0xd9, 0xe4, 0x24, 0xaf, 0x9c, 0x9c, 0x94, 0xc2, 0xe4, 0xb4, 0x07, + 0xcf, 0x6b, 0xf9, 0xd0, 0xfe, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x76, 0x8b, 0xe6, 0x6b, 0x80, + 0x0d, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/memcache/memcache_service.proto b/vendor/google.golang.org/appengine/internal/memcache/memcache_service.proto new file mode 100644 index 000000000..5f0edcdc7 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/memcache/memcache_service.proto @@ -0,0 +1,165 @@ +syntax = "proto2"; +option go_package = "memcache"; + +package appengine; + +message MemcacheServiceError { + enum ErrorCode { + OK = 0; + UNSPECIFIED_ERROR = 1; + NAMESPACE_NOT_SET = 2; + PERMISSION_DENIED = 3; + INVALID_VALUE = 6; + } +} + +message AppOverride { + required string app_id = 1; + + optional int32 num_memcacheg_backends = 2 [deprecated=true]; + optional bool ignore_shardlock = 3 [deprecated=true]; + optional string memcache_pool_hint = 4 [deprecated=true]; + optional bytes memcache_sharding_strategy = 5 [deprecated=true]; +} + +message MemcacheGetRequest { + repeated bytes key = 1; + optional string name_space = 2 [default = ""]; + optional bool for_cas = 4; + optional AppOverride override = 5; +} + +message MemcacheGetResponse { + repeated group Item = 1 { + required bytes key = 2; + required bytes value = 3; + optional fixed32 flags = 4; + optional fixed64 cas_id = 5; + optional int32 expires_in_seconds = 6; + } +} + +message MemcacheSetRequest { + enum SetPolicy { + SET = 1; + ADD = 2; + REPLACE = 3; + CAS = 4; + } + repeated group Item = 1 { + required bytes key = 2; + required bytes value = 3; + + optional fixed32 flags = 4; + optional SetPolicy set_policy = 5 [default = SET]; + optional fixed32 expiration_time = 6 [default = 0]; + + optional fixed64 cas_id = 8; + optional bool for_cas = 9; + } + optional string name_space = 7 [default = ""]; + optional AppOverride override = 10; +} + +message MemcacheSetResponse { + enum SetStatusCode { + STORED = 1; + NOT_STORED = 2; + ERROR = 3; + EXISTS = 4; + } + repeated SetStatusCode set_status = 1; +} + +message MemcacheDeleteRequest { + repeated group Item = 1 { + required bytes key = 2; + optional fixed32 delete_time = 3 [default = 0]; + } + optional string name_space = 4 [default = ""]; + optional AppOverride override = 5; +} + +message MemcacheDeleteResponse { + enum DeleteStatusCode { + DELETED = 1; + NOT_FOUND = 2; + } + repeated DeleteStatusCode delete_status = 1; +} + +message MemcacheIncrementRequest { + enum Direction { + INCREMENT = 1; + DECREMENT = 2; + } + required bytes key = 1; + optional string name_space = 4 [default = ""]; + + optional uint64 delta = 2 [default = 1]; + optional Direction direction = 3 [default = INCREMENT]; + + optional uint64 initial_value = 5; + optional fixed32 initial_flags = 6; + optional AppOverride override = 7; +} + +message MemcacheIncrementResponse { + enum IncrementStatusCode { + OK = 1; + NOT_CHANGED = 2; + ERROR = 3; + } + + optional uint64 new_value = 1; + optional IncrementStatusCode increment_status = 2; +} + +message MemcacheBatchIncrementRequest { + optional string name_space = 1 [default = ""]; + repeated MemcacheIncrementRequest item = 2; + optional AppOverride override = 3; +} + +message MemcacheBatchIncrementResponse { + repeated MemcacheIncrementResponse item = 1; +} + +message MemcacheFlushRequest { + optional AppOverride override = 1; +} + +message MemcacheFlushResponse { +} + +message MemcacheStatsRequest { + optional AppOverride override = 1; +} + +message MergedNamespaceStats { + required uint64 hits = 1; + required uint64 misses = 2; + required uint64 byte_hits = 3; + + required uint64 items = 4; + required uint64 bytes = 5; + + required fixed32 oldest_item_age = 6; +} + +message MemcacheStatsResponse { + optional MergedNamespaceStats stats = 1; +} + +message MemcacheGrabTailRequest { + required int32 item_count = 1; + optional string name_space = 2 [default = ""]; + optional AppOverride override = 3; +} + +message MemcacheGrabTailResponse { + repeated group Item = 1 { + required bytes value = 2; + optional fixed32 flags = 3; + } +} diff --git a/vendor/google.golang.org/appengine/internal/metadata.go b/vendor/google.golang.org/appengine/internal/metadata.go new file mode 100644 index 000000000..c4ba63bb4 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/metadata.go @@ -0,0 +1,60 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package internal + +// This file has code for accessing metadata. +// +// References: +// https://cloud.google.com/compute/docs/metadata + +import ( + "fmt" + "io/ioutil" + "net/http" + "net/url" +) + +const ( + metadataHost = "metadata" + metadataPath = "/computeMetadata/v1/" +) + +var ( + metadataRequestHeaders = http.Header{ + "Metadata-Flavor": []string{"Google"}, + } +) + +// TODO(dsymonds): Do we need to support default values, like Python? +func mustGetMetadata(key string) []byte { + b, err := getMetadata(key) + if err != nil { + panic(fmt.Sprintf("Metadata fetch failed for '%s': %v", key, err)) + } + return b +} + +func getMetadata(key string) ([]byte, error) { + // TODO(dsymonds): May need to use url.Parse to support keys with query args. + req := &http.Request{ + Method: "GET", + URL: &url.URL{ + Scheme: "http", + Host: metadataHost, + Path: metadataPath + key, + }, + Header: metadataRequestHeaders, + Host: metadataHost, + } + resp, err := http.DefaultClient.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return nil, fmt.Errorf("metadata server returned HTTP %d", resp.StatusCode) + } + return ioutil.ReadAll(resp.Body) +} diff --git a/vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go b/vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go new file mode 100644 index 000000000..ddfc0c04a --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go @@ -0,0 +1,786 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/modules/modules_service.proto + +package modules + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type ModulesServiceError_ErrorCode int32 + +const ( + ModulesServiceError_OK ModulesServiceError_ErrorCode = 0 + ModulesServiceError_INVALID_MODULE ModulesServiceError_ErrorCode = 1 + ModulesServiceError_INVALID_VERSION ModulesServiceError_ErrorCode = 2 + ModulesServiceError_INVALID_INSTANCES ModulesServiceError_ErrorCode = 3 + ModulesServiceError_TRANSIENT_ERROR ModulesServiceError_ErrorCode = 4 + ModulesServiceError_UNEXPECTED_STATE ModulesServiceError_ErrorCode = 5 +) + +var ModulesServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "INVALID_MODULE", + 2: "INVALID_VERSION", + 3: "INVALID_INSTANCES", + 4: "TRANSIENT_ERROR", + 5: "UNEXPECTED_STATE", +} +var ModulesServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "INVALID_MODULE": 1, + "INVALID_VERSION": 2, + "INVALID_INSTANCES": 3, + "TRANSIENT_ERROR": 4, + "UNEXPECTED_STATE": 5, +} + +func (x ModulesServiceError_ErrorCode) Enum() *ModulesServiceError_ErrorCode { + p := new(ModulesServiceError_ErrorCode) + *p = x + return p +} +func (x ModulesServiceError_ErrorCode) String() string { + return proto.EnumName(ModulesServiceError_ErrorCode_name, int32(x)) +} +func (x *ModulesServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ModulesServiceError_ErrorCode_value, data, "ModulesServiceError_ErrorCode") + if err != nil { + return err + } + *x = ModulesServiceError_ErrorCode(value) + return nil +} +func (ModulesServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{0, 0} +} + +type ModulesServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ModulesServiceError) Reset() { *m = ModulesServiceError{} } +func (m *ModulesServiceError) String() string { return proto.CompactTextString(m) } +func (*ModulesServiceError) ProtoMessage() {} +func (*ModulesServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{0} +} +func (m *ModulesServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ModulesServiceError.Unmarshal(m, b) +} +func (m *ModulesServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ModulesServiceError.Marshal(b, m, deterministic) +} +func (dst *ModulesServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_ModulesServiceError.Merge(dst, src) +} +func (m *ModulesServiceError) XXX_Size() int { + return xxx_messageInfo_ModulesServiceError.Size(m) +} +func (m *ModulesServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_ModulesServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_ModulesServiceError proto.InternalMessageInfo + +type GetModulesRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetModulesRequest) Reset() { *m = GetModulesRequest{} } +func (m *GetModulesRequest) String() string { return proto.CompactTextString(m) } +func (*GetModulesRequest) ProtoMessage() {} +func (*GetModulesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{1} +} +func (m *GetModulesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetModulesRequest.Unmarshal(m, b) +} +func (m *GetModulesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetModulesRequest.Marshal(b, m, deterministic) +} +func (dst *GetModulesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetModulesRequest.Merge(dst, src) +} +func (m *GetModulesRequest) XXX_Size() int { + return xxx_messageInfo_GetModulesRequest.Size(m) +} +func (m *GetModulesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetModulesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetModulesRequest proto.InternalMessageInfo + +type GetModulesResponse struct { + Module []string `protobuf:"bytes,1,rep,name=module" json:"module,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetModulesResponse) Reset() { *m = GetModulesResponse{} } +func (m *GetModulesResponse) String() string { return proto.CompactTextString(m) } +func (*GetModulesResponse) ProtoMessage() {} +func (*GetModulesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{2} +} +func (m *GetModulesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetModulesResponse.Unmarshal(m, b) +} +func (m *GetModulesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetModulesResponse.Marshal(b, m, deterministic) +} +func (dst *GetModulesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetModulesResponse.Merge(dst, src) +} +func (m *GetModulesResponse) XXX_Size() int { + return xxx_messageInfo_GetModulesResponse.Size(m) +} +func (m *GetModulesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetModulesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetModulesResponse proto.InternalMessageInfo + +func (m *GetModulesResponse) GetModule() []string { + if m != nil { + return m.Module + } + return nil +} + +type GetVersionsRequest struct { + Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetVersionsRequest) Reset() { *m = GetVersionsRequest{} } +func (m *GetVersionsRequest) String() string { return proto.CompactTextString(m) } +func (*GetVersionsRequest) ProtoMessage() {} +func (*GetVersionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{3} +} +func (m *GetVersionsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetVersionsRequest.Unmarshal(m, b) +} +func (m *GetVersionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetVersionsRequest.Marshal(b, m, deterministic) +} +func (dst *GetVersionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetVersionsRequest.Merge(dst, src) +} +func (m *GetVersionsRequest) XXX_Size() int { + return xxx_messageInfo_GetVersionsRequest.Size(m) +} +func (m *GetVersionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetVersionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetVersionsRequest proto.InternalMessageInfo + +func (m *GetVersionsRequest) GetModule() string { + if m != nil && m.Module != nil { + return *m.Module + } + return "" +} + +type GetVersionsResponse struct { + Version []string `protobuf:"bytes,1,rep,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetVersionsResponse) Reset() { *m = GetVersionsResponse{} } +func (m *GetVersionsResponse) String() string { return proto.CompactTextString(m) } +func (*GetVersionsResponse) ProtoMessage() {} +func (*GetVersionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{4} +} +func (m *GetVersionsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetVersionsResponse.Unmarshal(m, b) +} +func (m *GetVersionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetVersionsResponse.Marshal(b, m, deterministic) +} +func (dst *GetVersionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetVersionsResponse.Merge(dst, src) +} +func (m *GetVersionsResponse) XXX_Size() int { + return xxx_messageInfo_GetVersionsResponse.Size(m) +} +func (m *GetVersionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetVersionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetVersionsResponse proto.InternalMessageInfo + +func (m *GetVersionsResponse) GetVersion() []string { + if m != nil { + return m.Version + } + return nil +} + +type GetDefaultVersionRequest struct { + Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetDefaultVersionRequest) Reset() { *m = GetDefaultVersionRequest{} } +func (m *GetDefaultVersionRequest) String() string { return proto.CompactTextString(m) } +func (*GetDefaultVersionRequest) ProtoMessage() {} +func (*GetDefaultVersionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{5} +} +func (m *GetDefaultVersionRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetDefaultVersionRequest.Unmarshal(m, b) +} +func (m *GetDefaultVersionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetDefaultVersionRequest.Marshal(b, m, deterministic) +} +func (dst *GetDefaultVersionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetDefaultVersionRequest.Merge(dst, src) +} +func (m *GetDefaultVersionRequest) XXX_Size() int { + return xxx_messageInfo_GetDefaultVersionRequest.Size(m) +} +func (m *GetDefaultVersionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetDefaultVersionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetDefaultVersionRequest proto.InternalMessageInfo + +func (m *GetDefaultVersionRequest) GetModule() string { + if m != nil && m.Module != nil { + return *m.Module + } + return "" +} + +type GetDefaultVersionResponse struct { + Version *string `protobuf:"bytes,1,req,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetDefaultVersionResponse) Reset() { *m = GetDefaultVersionResponse{} } +func (m *GetDefaultVersionResponse) String() string { return proto.CompactTextString(m) } +func (*GetDefaultVersionResponse) ProtoMessage() {} +func (*GetDefaultVersionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{6} +} +func (m *GetDefaultVersionResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetDefaultVersionResponse.Unmarshal(m, b) +} +func (m *GetDefaultVersionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetDefaultVersionResponse.Marshal(b, m, deterministic) +} +func (dst *GetDefaultVersionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetDefaultVersionResponse.Merge(dst, src) +} +func (m *GetDefaultVersionResponse) XXX_Size() int { + return xxx_messageInfo_GetDefaultVersionResponse.Size(m) +} +func (m *GetDefaultVersionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetDefaultVersionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetDefaultVersionResponse proto.InternalMessageInfo + +func (m *GetDefaultVersionResponse) GetVersion() string { + if m != nil && m.Version != nil { + return *m.Version + } + return "" +} + +type GetNumInstancesRequest struct { + Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"` + Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetNumInstancesRequest) Reset() { *m = GetNumInstancesRequest{} } +func (m *GetNumInstancesRequest) String() string { return proto.CompactTextString(m) } +func (*GetNumInstancesRequest) ProtoMessage() {} +func (*GetNumInstancesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{7} +} +func (m *GetNumInstancesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetNumInstancesRequest.Unmarshal(m, b) +} +func (m *GetNumInstancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetNumInstancesRequest.Marshal(b, m, deterministic) +} +func (dst *GetNumInstancesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNumInstancesRequest.Merge(dst, src) +} +func (m *GetNumInstancesRequest) XXX_Size() int { + return xxx_messageInfo_GetNumInstancesRequest.Size(m) +} +func (m *GetNumInstancesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetNumInstancesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetNumInstancesRequest proto.InternalMessageInfo + +func (m *GetNumInstancesRequest) GetModule() string { + if m != nil && m.Module != nil { + return *m.Module + } + return "" +} + +func (m *GetNumInstancesRequest) GetVersion() string { + if m != nil && m.Version != nil { + return *m.Version + } + return "" +} + +type GetNumInstancesResponse struct { + Instances *int64 `protobuf:"varint,1,req,name=instances" json:"instances,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetNumInstancesResponse) Reset() { *m = GetNumInstancesResponse{} } +func (m *GetNumInstancesResponse) String() string { return proto.CompactTextString(m) } +func (*GetNumInstancesResponse) ProtoMessage() {} +func (*GetNumInstancesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{8} +} +func (m *GetNumInstancesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetNumInstancesResponse.Unmarshal(m, b) +} +func (m *GetNumInstancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetNumInstancesResponse.Marshal(b, m, deterministic) +} +func (dst *GetNumInstancesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetNumInstancesResponse.Merge(dst, src) +} +func (m *GetNumInstancesResponse) XXX_Size() int { + return xxx_messageInfo_GetNumInstancesResponse.Size(m) +} +func (m *GetNumInstancesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetNumInstancesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetNumInstancesResponse proto.InternalMessageInfo + +func (m *GetNumInstancesResponse) GetInstances() int64 { + if m != nil && m.Instances != nil { + return *m.Instances + } + return 0 +} + +type SetNumInstancesRequest struct { + Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"` + Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + Instances *int64 `protobuf:"varint,3,req,name=instances" json:"instances,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetNumInstancesRequest) Reset() { *m = SetNumInstancesRequest{} } +func (m *SetNumInstancesRequest) String() string { return proto.CompactTextString(m) } +func (*SetNumInstancesRequest) ProtoMessage() {} +func (*SetNumInstancesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{9} +} +func (m *SetNumInstancesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetNumInstancesRequest.Unmarshal(m, b) +} +func (m *SetNumInstancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetNumInstancesRequest.Marshal(b, m, deterministic) +} +func (dst *SetNumInstancesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetNumInstancesRequest.Merge(dst, src) +} +func (m *SetNumInstancesRequest) XXX_Size() int { + return xxx_messageInfo_SetNumInstancesRequest.Size(m) +} +func (m *SetNumInstancesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SetNumInstancesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SetNumInstancesRequest proto.InternalMessageInfo + +func (m *SetNumInstancesRequest) GetModule() string { + if m != nil && m.Module != nil { + return *m.Module + } + return "" +} + +func (m *SetNumInstancesRequest) GetVersion() string { + if m != nil && m.Version != nil { + return *m.Version + } + return "" +} + +func (m *SetNumInstancesRequest) GetInstances() int64 { + if m != nil && m.Instances != nil { + return *m.Instances + } + return 0 +} + +type SetNumInstancesResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetNumInstancesResponse) Reset() { *m = SetNumInstancesResponse{} } +func (m *SetNumInstancesResponse) String() string { return proto.CompactTextString(m) } +func (*SetNumInstancesResponse) ProtoMessage() {} +func (*SetNumInstancesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{10} +} +func (m *SetNumInstancesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetNumInstancesResponse.Unmarshal(m, b) +} +func (m *SetNumInstancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetNumInstancesResponse.Marshal(b, m, deterministic) +} +func (dst *SetNumInstancesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetNumInstancesResponse.Merge(dst, src) +} +func (m *SetNumInstancesResponse) XXX_Size() int { + return xxx_messageInfo_SetNumInstancesResponse.Size(m) +} +func (m *SetNumInstancesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SetNumInstancesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SetNumInstancesResponse proto.InternalMessageInfo + +type StartModuleRequest struct { + Module *string `protobuf:"bytes,1,req,name=module" json:"module,omitempty"` + Version *string `protobuf:"bytes,2,req,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StartModuleRequest) Reset() { *m = StartModuleRequest{} } +func (m *StartModuleRequest) String() string { return proto.CompactTextString(m) } +func (*StartModuleRequest) ProtoMessage() {} +func (*StartModuleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{11} +} +func (m *StartModuleRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StartModuleRequest.Unmarshal(m, b) +} +func (m *StartModuleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StartModuleRequest.Marshal(b, m, deterministic) +} +func (dst *StartModuleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartModuleRequest.Merge(dst, src) +} +func (m *StartModuleRequest) XXX_Size() int { + return xxx_messageInfo_StartModuleRequest.Size(m) +} +func (m *StartModuleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StartModuleRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StartModuleRequest proto.InternalMessageInfo + +func (m *StartModuleRequest) GetModule() string { + if m != nil && m.Module != nil { + return *m.Module + } + return "" +} + +func (m *StartModuleRequest) GetVersion() string { + if m != nil && m.Version != nil { + return *m.Version + } + return "" +} + +type StartModuleResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StartModuleResponse) Reset() { *m = StartModuleResponse{} } +func (m *StartModuleResponse) String() string { return proto.CompactTextString(m) } +func (*StartModuleResponse) ProtoMessage() {} +func (*StartModuleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{12} +} +func (m *StartModuleResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StartModuleResponse.Unmarshal(m, b) +} +func (m *StartModuleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StartModuleResponse.Marshal(b, m, deterministic) +} +func (dst *StartModuleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartModuleResponse.Merge(dst, src) +} +func (m *StartModuleResponse) XXX_Size() int { + return xxx_messageInfo_StartModuleResponse.Size(m) +} +func (m *StartModuleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StartModuleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StartModuleResponse proto.InternalMessageInfo + +type StopModuleRequest struct { + Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"` + Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StopModuleRequest) Reset() { *m = StopModuleRequest{} } +func (m *StopModuleRequest) String() string { return proto.CompactTextString(m) } +func (*StopModuleRequest) ProtoMessage() {} +func (*StopModuleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{13} +} +func (m *StopModuleRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StopModuleRequest.Unmarshal(m, b) +} +func (m *StopModuleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StopModuleRequest.Marshal(b, m, deterministic) +} +func (dst *StopModuleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StopModuleRequest.Merge(dst, src) +} +func (m *StopModuleRequest) XXX_Size() int { + return xxx_messageInfo_StopModuleRequest.Size(m) +} +func (m *StopModuleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StopModuleRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StopModuleRequest proto.InternalMessageInfo + +func (m *StopModuleRequest) GetModule() string { + if m != nil && m.Module != nil { + return *m.Module + } + return "" +} + +func (m *StopModuleRequest) GetVersion() string { + if m != nil && m.Version != nil { + return *m.Version + } + return "" +} + +type StopModuleResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StopModuleResponse) Reset() { *m = StopModuleResponse{} } +func (m *StopModuleResponse) String() string { return proto.CompactTextString(m) } +func (*StopModuleResponse) ProtoMessage() {} +func (*StopModuleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{14} +} +func (m *StopModuleResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StopModuleResponse.Unmarshal(m, b) +} +func (m *StopModuleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StopModuleResponse.Marshal(b, m, deterministic) +} +func (dst *StopModuleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StopModuleResponse.Merge(dst, src) +} +func (m *StopModuleResponse) XXX_Size() int { + return xxx_messageInfo_StopModuleResponse.Size(m) +} +func (m *StopModuleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StopModuleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StopModuleResponse proto.InternalMessageInfo + +type GetHostnameRequest struct { + Module *string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"` + Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + Instance *string `protobuf:"bytes,3,opt,name=instance" json:"instance,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetHostnameRequest) Reset() { *m = GetHostnameRequest{} } +func (m *GetHostnameRequest) String() string { return proto.CompactTextString(m) } +func (*GetHostnameRequest) ProtoMessage() {} +func (*GetHostnameRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{15} +} +func (m *GetHostnameRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetHostnameRequest.Unmarshal(m, b) +} +func (m *GetHostnameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetHostnameRequest.Marshal(b, m, deterministic) +} +func (dst *GetHostnameRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetHostnameRequest.Merge(dst, src) +} +func (m *GetHostnameRequest) XXX_Size() int { + return xxx_messageInfo_GetHostnameRequest.Size(m) +} +func (m *GetHostnameRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetHostnameRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetHostnameRequest proto.InternalMessageInfo + +func (m *GetHostnameRequest) GetModule() string { + if m != nil && m.Module != nil { + return *m.Module + } + return "" +} + +func (m *GetHostnameRequest) GetVersion() string { + if m != nil && m.Version != nil { + return *m.Version + } + return "" +} + +func (m *GetHostnameRequest) GetInstance() string { + if m != nil && m.Instance != nil { + return *m.Instance + } + return "" +} + +type GetHostnameResponse struct { + Hostname *string `protobuf:"bytes,1,req,name=hostname" json:"hostname,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetHostnameResponse) Reset() { *m = GetHostnameResponse{} } +func (m *GetHostnameResponse) String() string { return proto.CompactTextString(m) } +func (*GetHostnameResponse) ProtoMessage() {} +func (*GetHostnameResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_modules_service_9cd3bffe4e91c59a, []int{16} +} +func (m *GetHostnameResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetHostnameResponse.Unmarshal(m, b) +} +func (m *GetHostnameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetHostnameResponse.Marshal(b, m, deterministic) +} +func (dst *GetHostnameResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetHostnameResponse.Merge(dst, src) +} +func (m *GetHostnameResponse) XXX_Size() int { + return xxx_messageInfo_GetHostnameResponse.Size(m) +} +func (m *GetHostnameResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetHostnameResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetHostnameResponse proto.InternalMessageInfo + +func (m *GetHostnameResponse) GetHostname() string { + if m != nil && m.Hostname != nil { + return *m.Hostname + } + return "" +} + +func init() { + proto.RegisterType((*ModulesServiceError)(nil), "appengine.ModulesServiceError") + proto.RegisterType((*GetModulesRequest)(nil), "appengine.GetModulesRequest") + proto.RegisterType((*GetModulesResponse)(nil), "appengine.GetModulesResponse") + proto.RegisterType((*GetVersionsRequest)(nil), "appengine.GetVersionsRequest") + proto.RegisterType((*GetVersionsResponse)(nil), "appengine.GetVersionsResponse") + proto.RegisterType((*GetDefaultVersionRequest)(nil), "appengine.GetDefaultVersionRequest") + proto.RegisterType((*GetDefaultVersionResponse)(nil), "appengine.GetDefaultVersionResponse") + proto.RegisterType((*GetNumInstancesRequest)(nil), "appengine.GetNumInstancesRequest") + proto.RegisterType((*GetNumInstancesResponse)(nil), "appengine.GetNumInstancesResponse") + proto.RegisterType((*SetNumInstancesRequest)(nil), "appengine.SetNumInstancesRequest") + proto.RegisterType((*SetNumInstancesResponse)(nil), "appengine.SetNumInstancesResponse") + proto.RegisterType((*StartModuleRequest)(nil), "appengine.StartModuleRequest") + proto.RegisterType((*StartModuleResponse)(nil), "appengine.StartModuleResponse") + proto.RegisterType((*StopModuleRequest)(nil), "appengine.StopModuleRequest") + proto.RegisterType((*StopModuleResponse)(nil), "appengine.StopModuleResponse") + proto.RegisterType((*GetHostnameRequest)(nil), "appengine.GetHostnameRequest") + proto.RegisterType((*GetHostnameResponse)(nil), "appengine.GetHostnameResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/modules/modules_service.proto", fileDescriptor_modules_service_9cd3bffe4e91c59a) +} + +var fileDescriptor_modules_service_9cd3bffe4e91c59a = []byte{ + // 457 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xc1, 0x6f, 0xd3, 0x30, + 0x14, 0xc6, 0x69, 0x02, 0xdb, 0xf2, 0x0e, 0x90, 0x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, 0xfa, 0xbf, 0xcd, 0xf8, 0xf0, 0x2e, 0xe5, 0x1a, 0x63, 0xe0, 0xdf, 0xea, + 0xfb, 0xf8, 0x41, 0x28, 0xcd, 0xb3, 0xf9, 0xff, 0xd3, 0xc9, 0x29, 0x1c, 0xd8, 0x59, 0x75, 0xdd, + 0x7a, 0x69, 0x55, 0x87, 0xaf, 0xeb, 0x5b, 0xbc, 0xee, 0x61, 0xbe, 0xec, 0x29, 0x1c, 0xdc, 0x18, + 0xcd, 0x8c, 0x68, 0x55, 0x9f, 0x79, 0x5f, 0xf7, 0xcd, 0x5f, 0xe2, 0x77, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x6e, 0xbc, 0xe0, 0x61, 0x5c, 0x04, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/modules/modules_service.proto b/vendor/google.golang.org/appengine/internal/modules/modules_service.proto new file mode 100644 index 000000000..d29f0065a --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/modules/modules_service.proto @@ -0,0 +1,80 @@ +syntax = "proto2"; +option go_package = "modules"; + +package appengine; + +message ModulesServiceError { + enum ErrorCode { + OK = 0; + INVALID_MODULE = 1; + INVALID_VERSION = 2; + INVALID_INSTANCES = 3; + TRANSIENT_ERROR = 4; + UNEXPECTED_STATE = 5; + } +} + +message GetModulesRequest { +} + +message GetModulesResponse { + repeated string module = 1; +} + +message GetVersionsRequest { + optional string module = 1; +} + +message GetVersionsResponse { + repeated string version = 1; +} + +message GetDefaultVersionRequest { + optional string module = 1; +} + +message GetDefaultVersionResponse { + required string version = 1; +} + +message GetNumInstancesRequest { + optional string module = 1; + optional string version = 2; +} + +message GetNumInstancesResponse { + required int64 instances = 1; +} + +message SetNumInstancesRequest { + optional string module = 1; + optional string version = 2; + required int64 instances = 3; +} + +message SetNumInstancesResponse {} + +message StartModuleRequest { + required string module = 1; + required string version = 2; +} + +message StartModuleResponse {} + +message StopModuleRequest { + optional string module = 1; + optional string version = 2; +} + +message StopModuleResponse {} + +message GetHostnameRequest { + optional string module = 1; + optional string version = 2; + optional string instance = 3; +} + +message GetHostnameResponse { + required string hostname = 1; +} + diff --git a/vendor/google.golang.org/appengine/internal/net.go b/vendor/google.golang.org/appengine/internal/net.go new file mode 100644 index 000000000..3b94cf0c6 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/net.go @@ -0,0 +1,56 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package internal + +// This file implements a network dialer that limits the number of concurrent connections. +// It is only used for API calls. + +import ( + "log" + "net" + "runtime" + "sync" + "time" +) + +var limitSem = make(chan int, 100) // TODO(dsymonds): Use environment variable. + +func limitRelease() { + // non-blocking + select { + case <-limitSem: + default: + // This should not normally happen. + log.Print("appengine: unbalanced limitSem release!") + } +} + +func limitDial(network, addr string) (net.Conn, error) { + limitSem <- 1 + + // Dial with a timeout in case the API host is MIA. + // The connection should normally be very fast. + conn, err := net.DialTimeout(network, addr, 500*time.Millisecond) + if err != nil { + limitRelease() + return nil, err + } + lc := &limitConn{Conn: conn} + runtime.SetFinalizer(lc, (*limitConn).Close) // shouldn't usually be required + return lc, nil +} + +type limitConn struct { + close sync.Once + net.Conn +} + +func (lc *limitConn) Close() error { + defer lc.close.Do(func() { + limitRelease() + runtime.SetFinalizer(lc, nil) + }) + return lc.Conn.Close() +} diff --git a/vendor/google.golang.org/appengine/internal/net_test.go b/vendor/google.golang.org/appengine/internal/net_test.go new file mode 100644 index 000000000..24da8bb2b --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/net_test.go @@ -0,0 +1,58 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package internal + +import ( + "sync" + "testing" + "time" + + netcontext "golang.org/x/net/context" + + basepb "google.golang.org/appengine/internal/base" +) + +func TestDialLimit(t *testing.T) { + // Fill up semaphore with false acquisitions to permit only two TCP connections at a time. + // We don't replace limitSem because that results in a data race when net/http lazily closes connections. + nFake := cap(limitSem) - 2 + for i := 0; i < nFake; i++ { + limitSem <- 1 + } + defer func() { + for i := 0; i < nFake; i++ { + <-limitSem + } + }() + + f, c, cleanup := setup() // setup is in api_test.go + defer cleanup() + f.hang = make(chan int) + + // If we make two RunSlowly RPCs (which will wait for f.hang to be strobed), + // then the simple Non200 RPC should hang. + var wg sync.WaitGroup + wg.Add(2) + for i := 0; i < 2; i++ { + go func() { + defer wg.Done() + Call(toContext(c), "errors", "RunSlowly", &basepb.VoidProto{}, &basepb.VoidProto{}) + }() + } + time.Sleep(50 * time.Millisecond) // let those two RPCs start + + ctx, _ := netcontext.WithTimeout(toContext(c), 50*time.Millisecond) + err := Call(ctx, "errors", "Non200", &basepb.VoidProto{}, &basepb.VoidProto{}) + if err != errTimeout { + t.Errorf("Non200 RPC returned with err %v, want errTimeout", err) + } + + // Drain the two RunSlowly calls. + f.hang <- 1 + f.hang <- 1 + wg.Wait() +} diff --git a/vendor/google.golang.org/appengine/internal/regen.sh b/vendor/google.golang.org/appengine/internal/regen.sh new file mode 100755 index 000000000..2fdb546a6 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/regen.sh @@ -0,0 +1,40 @@ +#!/bin/bash -e +# +# This script rebuilds the generated code for the protocol buffers. +# To run this you will need protoc and goprotobuf installed; +# see https://github.com/golang/protobuf for instructions. + +PKG=google.golang.org/appengine + +function die() { + echo 1>&2 $* + exit 1 +} + +# Sanity check that the right tools are accessible. +for tool in go protoc protoc-gen-go; do + q=$(which $tool) || die "didn't find $tool" + echo 1>&2 "$tool: $q" +done + +echo -n 1>&2 "finding package dir... " +pkgdir=$(go list -f '{{.Dir}}' $PKG) +echo 1>&2 $pkgdir +base=$(echo $pkgdir | sed "s,/$PKG\$,,") +echo 1>&2 "base: $base" +cd $base + +# Run protoc once per package. +for dir in $(find $PKG/internal -name '*.proto' | xargs dirname | sort | uniq); do + echo 1>&2 "* $dir" + protoc --go_out=. $dir/*.proto +done + +for f in $(find $PKG/internal -name '*.pb.go'); do + # Remove proto.RegisterEnum calls. + # These cause duplicate registration panics when these packages + # are used on classic App Engine. proto.RegisterEnum only affects + # parsing the text format; we don't care about that. + # https://code.google.com/p/googleappengine/issues/detail?id=11670#c17 + sed -i '/proto.RegisterEnum/d' $f +done diff --git a/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go b/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go new file mode 100644 index 000000000..8d782a38e --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go @@ -0,0 +1,361 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/remote_api/remote_api.proto + +package remote_api + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type RpcError_ErrorCode int32 + +const ( + RpcError_UNKNOWN RpcError_ErrorCode = 0 + RpcError_CALL_NOT_FOUND RpcError_ErrorCode = 1 + RpcError_PARSE_ERROR RpcError_ErrorCode = 2 + RpcError_SECURITY_VIOLATION RpcError_ErrorCode = 3 + RpcError_OVER_QUOTA RpcError_ErrorCode = 4 + RpcError_REQUEST_TOO_LARGE RpcError_ErrorCode = 5 + RpcError_CAPABILITY_DISABLED RpcError_ErrorCode = 6 + RpcError_FEATURE_DISABLED RpcError_ErrorCode = 7 + RpcError_BAD_REQUEST RpcError_ErrorCode = 8 + RpcError_RESPONSE_TOO_LARGE RpcError_ErrorCode = 9 + RpcError_CANCELLED RpcError_ErrorCode = 10 + RpcError_REPLAY_ERROR RpcError_ErrorCode = 11 + RpcError_DEADLINE_EXCEEDED RpcError_ErrorCode = 12 +) + +var RpcError_ErrorCode_name = map[int32]string{ + 0: "UNKNOWN", + 1: "CALL_NOT_FOUND", + 2: "PARSE_ERROR", + 3: "SECURITY_VIOLATION", + 4: "OVER_QUOTA", + 5: "REQUEST_TOO_LARGE", + 6: "CAPABILITY_DISABLED", + 7: "FEATURE_DISABLED", + 8: "BAD_REQUEST", + 9: "RESPONSE_TOO_LARGE", + 10: "CANCELLED", + 11: "REPLAY_ERROR", + 12: "DEADLINE_EXCEEDED", +} +var RpcError_ErrorCode_value = map[string]int32{ + "UNKNOWN": 0, + "CALL_NOT_FOUND": 1, + "PARSE_ERROR": 2, + "SECURITY_VIOLATION": 3, + "OVER_QUOTA": 4, + "REQUEST_TOO_LARGE": 5, + "CAPABILITY_DISABLED": 6, + "FEATURE_DISABLED": 7, + "BAD_REQUEST": 8, + "RESPONSE_TOO_LARGE": 9, + "CANCELLED": 10, + "REPLAY_ERROR": 11, + "DEADLINE_EXCEEDED": 12, +} + +func (x RpcError_ErrorCode) Enum() *RpcError_ErrorCode { + p := new(RpcError_ErrorCode) + *p = x + return p +} +func (x RpcError_ErrorCode) String() string { + return proto.EnumName(RpcError_ErrorCode_name, int32(x)) +} +func (x *RpcError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(RpcError_ErrorCode_value, data, "RpcError_ErrorCode") + if err != nil { + return err + } + *x = RpcError_ErrorCode(value) + return nil +} +func (RpcError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_remote_api_1978114ec33a273d, []int{2, 0} +} + +type Request struct { + ServiceName *string `protobuf:"bytes,2,req,name=service_name,json=serviceName" json:"service_name,omitempty"` + Method *string `protobuf:"bytes,3,req,name=method" json:"method,omitempty"` + Request []byte `protobuf:"bytes,4,req,name=request" json:"request,omitempty"` + RequestId *string `protobuf:"bytes,5,opt,name=request_id,json=requestId" json:"request_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Request) Reset() { *m = Request{} } +func (m *Request) String() string { return proto.CompactTextString(m) } +func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { + return fileDescriptor_remote_api_1978114ec33a273d, []int{0} +} +func (m *Request) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Request.Unmarshal(m, b) +} +func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Request.Marshal(b, m, deterministic) +} +func (dst *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(dst, src) +} +func (m *Request) XXX_Size() int { + return xxx_messageInfo_Request.Size(m) +} +func (m *Request) XXX_DiscardUnknown() { + xxx_messageInfo_Request.DiscardUnknown(m) +} + +var xxx_messageInfo_Request proto.InternalMessageInfo + +func (m *Request) GetServiceName() string { + if m != nil && m.ServiceName != nil { + return *m.ServiceName + } + return "" +} + +func (m *Request) GetMethod() string { + if m != nil && m.Method != nil { + return *m.Method + } + return "" +} + +func (m *Request) GetRequest() []byte { + if m != nil { + return m.Request + } + return nil +} + +func (m *Request) GetRequestId() string { + if m != nil && m.RequestId != nil { + return *m.RequestId + } + return "" +} + +type ApplicationError struct { + Code *int32 `protobuf:"varint,1,req,name=code" json:"code,omitempty"` + Detail *string `protobuf:"bytes,2,req,name=detail" json:"detail,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ApplicationError) Reset() { *m = ApplicationError{} } +func (m *ApplicationError) String() string { return proto.CompactTextString(m) } +func (*ApplicationError) ProtoMessage() {} +func (*ApplicationError) Descriptor() ([]byte, []int) { + return fileDescriptor_remote_api_1978114ec33a273d, []int{1} +} +func (m *ApplicationError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ApplicationError.Unmarshal(m, b) +} +func (m *ApplicationError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ApplicationError.Marshal(b, m, deterministic) +} +func (dst *ApplicationError) XXX_Merge(src proto.Message) { + xxx_messageInfo_ApplicationError.Merge(dst, src) +} +func (m *ApplicationError) XXX_Size() int { + return xxx_messageInfo_ApplicationError.Size(m) +} +func (m *ApplicationError) XXX_DiscardUnknown() { + xxx_messageInfo_ApplicationError.DiscardUnknown(m) +} + +var xxx_messageInfo_ApplicationError proto.InternalMessageInfo + +func (m *ApplicationError) GetCode() int32 { + if m != nil && m.Code != nil { + return *m.Code + } + return 0 +} + +func (m *ApplicationError) GetDetail() string { + if m != nil && m.Detail != nil { + return *m.Detail + } + return "" +} + +type RpcError struct { + Code *int32 `protobuf:"varint,1,req,name=code" json:"code,omitempty"` + Detail *string `protobuf:"bytes,2,opt,name=detail" json:"detail,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RpcError) Reset() { *m = RpcError{} } +func (m *RpcError) String() string { return proto.CompactTextString(m) } +func (*RpcError) ProtoMessage() {} +func (*RpcError) Descriptor() ([]byte, []int) { + return fileDescriptor_remote_api_1978114ec33a273d, []int{2} +} +func (m *RpcError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RpcError.Unmarshal(m, b) +} +func (m *RpcError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RpcError.Marshal(b, m, deterministic) +} +func (dst *RpcError) XXX_Merge(src proto.Message) { + xxx_messageInfo_RpcError.Merge(dst, src) +} +func (m *RpcError) XXX_Size() int { + return xxx_messageInfo_RpcError.Size(m) +} +func (m *RpcError) XXX_DiscardUnknown() { + xxx_messageInfo_RpcError.DiscardUnknown(m) +} + +var xxx_messageInfo_RpcError proto.InternalMessageInfo + +func (m *RpcError) GetCode() int32 { + if m != nil && m.Code != nil { + return *m.Code + } + return 0 +} + +func (m *RpcError) GetDetail() string { + if m != nil && m.Detail != nil { + return *m.Detail + } + return "" +} + +type Response struct { + Response []byte `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"` + Exception []byte `protobuf:"bytes,2,opt,name=exception" json:"exception,omitempty"` + ApplicationError *ApplicationError `protobuf:"bytes,3,opt,name=application_error,json=applicationError" json:"application_error,omitempty"` + JavaException []byte `protobuf:"bytes,4,opt,name=java_exception,json=javaException" json:"java_exception,omitempty"` + RpcError *RpcError `protobuf:"bytes,5,opt,name=rpc_error,json=rpcError" json:"rpc_error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Response) Reset() { *m = Response{} } +func (m *Response) String() string { return proto.CompactTextString(m) } +func (*Response) ProtoMessage() {} +func (*Response) Descriptor() ([]byte, []int) { + return fileDescriptor_remote_api_1978114ec33a273d, []int{3} +} +func (m *Response) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Response.Unmarshal(m, b) +} +func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Response.Marshal(b, m, deterministic) +} +func (dst *Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_Response.Merge(dst, src) +} +func (m *Response) XXX_Size() int { + return xxx_messageInfo_Response.Size(m) +} +func (m *Response) XXX_DiscardUnknown() { + xxx_messageInfo_Response.DiscardUnknown(m) +} + +var xxx_messageInfo_Response proto.InternalMessageInfo + +func (m *Response) GetResponse() []byte { + if m != nil { + return m.Response + } + return nil +} + +func (m *Response) GetException() []byte { + if m != nil { + return m.Exception + } + return nil +} + +func (m *Response) GetApplicationError() *ApplicationError { + if m != nil { + return m.ApplicationError + } + return nil +} + +func (m *Response) GetJavaException() []byte { + if m != nil { + return m.JavaException + } + return nil +} + +func (m *Response) GetRpcError() *RpcError { + if m != nil { + return m.RpcError + } + return nil +} + +func init() { + proto.RegisterType((*Request)(nil), "remote_api.Request") + proto.RegisterType((*ApplicationError)(nil), "remote_api.ApplicationError") + proto.RegisterType((*RpcError)(nil), "remote_api.RpcError") + proto.RegisterType((*Response)(nil), "remote_api.Response") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/remote_api/remote_api.proto", fileDescriptor_remote_api_1978114ec33a273d) +} + +var fileDescriptor_remote_api_1978114ec33a273d = []byte{ + // 531 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x51, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xb1, 0x9b, 0x34, 0xf1, 0xc4, 0x2d, 0xdb, 0xa5, 0x14, 0x0b, 0x15, 0x29, 0x44, 0x42, + 0xca, 0x53, 0x2a, 0x38, 0x00, 0x62, 0x63, 0x6f, 0x91, 0x85, 0x65, 0xa7, 0x6b, 0xbb, 0x50, 0x5e, + 0x56, 0x2b, 0x67, 0x65, 0x8c, 0x12, 0xaf, 0xd9, 0x98, 0x8a, 0x17, 0x6e, 0xc0, 0xb5, 0x38, 0x0c, + 0xb7, 0x40, 0x36, 0x6e, 0x63, 0xf5, 0x89, 0xb7, 0x7f, 0x7e, 0x7b, 0xe6, 0x1b, 0xcd, 0xcc, 0xc2, + 0xbb, 0x5c, 0xa9, 0x7c, 0x23, 0x17, 0xb9, 0xda, 0x88, 0x32, 0x5f, 0x28, 0x9d, 0x5f, 0x88, 0xaa, + 0x92, 0x65, 0x5e, 0x94, 0xf2, 0xa2, 0x28, 0x6b, 0xa9, 0x4b, 0xb1, 0xb9, 0xd0, 0x72, 0xab, 0x6a, + 0xc9, 0x45, 0x55, 0xf4, 0xe4, 0xa2, 0xd2, 0xaa, 0x56, 0x18, 0xf6, 0xce, 0xec, 0x27, 0x8c, 0x98, + 0xfc, 0xf6, 0x5d, 0xee, 0x6a, 0xfc, 0x12, 0xec, 0x9d, 0xd4, 0xb7, 0x45, 0x26, 0x79, 0x29, 0xb6, + 0xd2, 0x31, 0xa7, 0xe6, 0xdc, 0x62, 0x93, 0xce, 0x0b, 0xc5, 0x56, 0x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, 0x00, 0xff, 0xff, 0x38, 0xd1, 0x0f, 0x22, 0x4f, + 0x03, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto b/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto new file mode 100644 index 000000000..f21763a4e --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto @@ -0,0 +1,44 @@ +syntax = "proto2"; +option go_package = "remote_api"; + +package remote_api; + +message Request { + required string service_name = 2; + required string method = 3; + required bytes request = 4; + optional string request_id = 5; +} + +message ApplicationError { + required int32 code = 1; + required string detail = 2; +} + +message RpcError { + enum ErrorCode { + UNKNOWN = 0; + CALL_NOT_FOUND = 1; + PARSE_ERROR = 2; + SECURITY_VIOLATION = 3; + OVER_QUOTA = 4; + REQUEST_TOO_LARGE = 5; + CAPABILITY_DISABLED = 6; + FEATURE_DISABLED = 7; + BAD_REQUEST = 8; + RESPONSE_TOO_LARGE = 9; + CANCELLED = 10; + REPLAY_ERROR = 11; + DEADLINE_EXCEEDED = 12; + } + required int32 code = 1; + optional string detail = 2; +} + +message Response { + optional bytes response = 1; + optional bytes exception = 2; + optional ApplicationError application_error = 3; + optional bytes java_exception = 4; + optional RpcError rpc_error = 5; +} diff --git a/vendor/google.golang.org/appengine/internal/search/search.pb.go b/vendor/google.golang.org/appengine/internal/search/search.pb.go new file mode 100644 index 000000000..86a65e5b1 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/search/search.pb.go @@ -0,0 +1,3459 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/search/search.proto + +package search + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Scope_Type int32 + +const ( + Scope_USER_BY_CANONICAL_ID Scope_Type = 1 + Scope_USER_BY_EMAIL Scope_Type = 2 + Scope_GROUP_BY_CANONICAL_ID Scope_Type = 3 + Scope_GROUP_BY_EMAIL Scope_Type = 4 + Scope_GROUP_BY_DOMAIN Scope_Type = 5 + Scope_ALL_USERS Scope_Type = 6 + Scope_ALL_AUTHENTICATED_USERS Scope_Type = 7 +) + +var Scope_Type_name = map[int32]string{ + 1: "USER_BY_CANONICAL_ID", + 2: "USER_BY_EMAIL", + 3: "GROUP_BY_CANONICAL_ID", + 4: "GROUP_BY_EMAIL", + 5: "GROUP_BY_DOMAIN", + 6: "ALL_USERS", + 7: "ALL_AUTHENTICATED_USERS", +} +var Scope_Type_value = map[string]int32{ + "USER_BY_CANONICAL_ID": 1, + "USER_BY_EMAIL": 2, + "GROUP_BY_CANONICAL_ID": 3, + "GROUP_BY_EMAIL": 4, + "GROUP_BY_DOMAIN": 5, + "ALL_USERS": 6, + "ALL_AUTHENTICATED_USERS": 7, +} + +func (x Scope_Type) Enum() *Scope_Type { + p := new(Scope_Type) + *p = x + return p +} +func (x Scope_Type) String() string { + return proto.EnumName(Scope_Type_name, int32(x)) +} +func (x *Scope_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Scope_Type_value, data, "Scope_Type") + if err != nil { + return err + } + *x = Scope_Type(value) + return nil +} +func (Scope_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{0, 0} +} + +type Entry_Permission int32 + +const ( + Entry_READ Entry_Permission = 1 + Entry_WRITE Entry_Permission = 2 + Entry_FULL_CONTROL Entry_Permission = 3 +) + +var Entry_Permission_name = map[int32]string{ + 1: "READ", + 2: "WRITE", + 3: "FULL_CONTROL", +} +var Entry_Permission_value = map[string]int32{ + "READ": 1, + "WRITE": 2, + "FULL_CONTROL": 3, +} + +func (x Entry_Permission) Enum() *Entry_Permission { + p := new(Entry_Permission) + *p = x + return p +} +func (x Entry_Permission) String() string { + return proto.EnumName(Entry_Permission_name, int32(x)) +} +func (x *Entry_Permission) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Entry_Permission_value, data, "Entry_Permission") + if err != nil { + return err + } + *x = Entry_Permission(value) + return nil +} +func (Entry_Permission) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{1, 0} +} + +type FieldValue_ContentType int32 + +const ( + FieldValue_TEXT FieldValue_ContentType = 0 + FieldValue_HTML FieldValue_ContentType = 1 + FieldValue_ATOM FieldValue_ContentType = 2 + FieldValue_DATE FieldValue_ContentType = 3 + FieldValue_NUMBER FieldValue_ContentType = 4 + FieldValue_GEO FieldValue_ContentType = 5 +) + +var FieldValue_ContentType_name = map[int32]string{ + 0: "TEXT", + 1: "HTML", + 2: "ATOM", + 3: "DATE", + 4: "NUMBER", + 5: "GEO", +} +var FieldValue_ContentType_value = map[string]int32{ + "TEXT": 0, + "HTML": 1, + "ATOM": 2, + "DATE": 3, + "NUMBER": 4, + "GEO": 5, +} + +func (x FieldValue_ContentType) Enum() *FieldValue_ContentType { + p := new(FieldValue_ContentType) + *p = x + return p +} +func (x FieldValue_ContentType) String() string { + return proto.EnumName(FieldValue_ContentType_name, int32(x)) +} +func (x *FieldValue_ContentType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldValue_ContentType_value, data, "FieldValue_ContentType") + if err != nil { + return err + } + *x = FieldValue_ContentType(value) + return nil +} +func (FieldValue_ContentType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{3, 0} +} + +type FacetValue_ContentType int32 + +const ( + FacetValue_ATOM FacetValue_ContentType = 2 + FacetValue_NUMBER FacetValue_ContentType = 4 +) + +var FacetValue_ContentType_name = map[int32]string{ + 2: "ATOM", + 4: "NUMBER", +} +var FacetValue_ContentType_value = map[string]int32{ + "ATOM": 2, + "NUMBER": 4, +} + +func (x FacetValue_ContentType) Enum() *FacetValue_ContentType { + p := new(FacetValue_ContentType) + *p = x + return p +} +func (x FacetValue_ContentType) String() string { + return proto.EnumName(FacetValue_ContentType_name, int32(x)) +} +func (x *FacetValue_ContentType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FacetValue_ContentType_value, data, "FacetValue_ContentType") + if err != nil { + return err + } + *x = FacetValue_ContentType(value) + return nil +} +func (FacetValue_ContentType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{7, 0} +} + +type Document_OrderIdSource int32 + +const ( + Document_DEFAULTED Document_OrderIdSource = 0 + Document_SUPPLIED Document_OrderIdSource = 1 +) + +var Document_OrderIdSource_name = map[int32]string{ + 0: "DEFAULTED", + 1: "SUPPLIED", +} +var Document_OrderIdSource_value = map[string]int32{ + "DEFAULTED": 0, + "SUPPLIED": 1, +} + +func (x Document_OrderIdSource) Enum() *Document_OrderIdSource { + p := new(Document_OrderIdSource) + *p = x + return p +} +func (x Document_OrderIdSource) String() string { + return proto.EnumName(Document_OrderIdSource_name, int32(x)) +} +func (x *Document_OrderIdSource) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Document_OrderIdSource_value, data, "Document_OrderIdSource") + if err != nil { + return err + } + *x = Document_OrderIdSource(value) + return nil +} +func (Document_OrderIdSource) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{10, 0} +} + +type Document_Storage int32 + +const ( + Document_DISK Document_Storage = 0 +) + +var Document_Storage_name = map[int32]string{ + 0: "DISK", +} +var Document_Storage_value = map[string]int32{ + "DISK": 0, +} + +func (x Document_Storage) Enum() *Document_Storage { + p := new(Document_Storage) + *p = x + return p +} +func (x Document_Storage) String() string { + return proto.EnumName(Document_Storage_name, int32(x)) +} +func (x *Document_Storage) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(Document_Storage_value, data, "Document_Storage") + if err != nil { + return err + } + *x = Document_Storage(value) + return nil +} +func (Document_Storage) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{10, 1} +} + +type SearchServiceError_ErrorCode int32 + +const ( + SearchServiceError_OK SearchServiceError_ErrorCode = 0 + SearchServiceError_INVALID_REQUEST SearchServiceError_ErrorCode = 1 + SearchServiceError_TRANSIENT_ERROR SearchServiceError_ErrorCode = 2 + SearchServiceError_INTERNAL_ERROR SearchServiceError_ErrorCode = 3 + SearchServiceError_PERMISSION_DENIED SearchServiceError_ErrorCode = 4 + SearchServiceError_TIMEOUT SearchServiceError_ErrorCode = 5 + SearchServiceError_CONCURRENT_TRANSACTION SearchServiceError_ErrorCode = 6 +) + +var SearchServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "INVALID_REQUEST", + 2: "TRANSIENT_ERROR", + 3: "INTERNAL_ERROR", + 4: "PERMISSION_DENIED", + 5: "TIMEOUT", + 6: "CONCURRENT_TRANSACTION", +} +var SearchServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "INVALID_REQUEST": 1, + "TRANSIENT_ERROR": 2, + "INTERNAL_ERROR": 3, + "PERMISSION_DENIED": 4, + "TIMEOUT": 5, + "CONCURRENT_TRANSACTION": 6, +} + +func (x SearchServiceError_ErrorCode) Enum() *SearchServiceError_ErrorCode { + p := new(SearchServiceError_ErrorCode) + *p = x + return p +} +func (x SearchServiceError_ErrorCode) String() string { + return proto.EnumName(SearchServiceError_ErrorCode_name, int32(x)) +} +func (x *SearchServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(SearchServiceError_ErrorCode_value, data, "SearchServiceError_ErrorCode") + if err != nil { + return err + } + *x = SearchServiceError_ErrorCode(value) + return nil +} +func (SearchServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{11, 0} +} + +type IndexSpec_Consistency int32 + +const ( + IndexSpec_GLOBAL IndexSpec_Consistency = 0 + IndexSpec_PER_DOCUMENT IndexSpec_Consistency = 1 +) + +var IndexSpec_Consistency_name = map[int32]string{ + 0: "GLOBAL", + 1: "PER_DOCUMENT", +} +var IndexSpec_Consistency_value = map[string]int32{ + "GLOBAL": 0, + "PER_DOCUMENT": 1, +} + +func (x IndexSpec_Consistency) Enum() *IndexSpec_Consistency { + p := new(IndexSpec_Consistency) + *p = x + return p +} +func (x IndexSpec_Consistency) String() string { + return proto.EnumName(IndexSpec_Consistency_name, int32(x)) +} +func (x *IndexSpec_Consistency) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(IndexSpec_Consistency_value, data, "IndexSpec_Consistency") + if err != nil { + return err + } + *x = IndexSpec_Consistency(value) + return nil +} +func (IndexSpec_Consistency) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{13, 0} +} + +type IndexSpec_Source int32 + +const ( + IndexSpec_SEARCH IndexSpec_Source = 0 + IndexSpec_DATASTORE IndexSpec_Source = 1 + IndexSpec_CLOUD_STORAGE IndexSpec_Source = 2 +) + +var IndexSpec_Source_name = map[int32]string{ + 0: "SEARCH", + 1: "DATASTORE", + 2: "CLOUD_STORAGE", +} +var IndexSpec_Source_value = map[string]int32{ + "SEARCH": 0, + "DATASTORE": 1, + "CLOUD_STORAGE": 2, +} + +func (x IndexSpec_Source) Enum() *IndexSpec_Source { + p := new(IndexSpec_Source) + *p = x + return p +} +func (x IndexSpec_Source) String() string { + return proto.EnumName(IndexSpec_Source_name, int32(x)) +} +func (x *IndexSpec_Source) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(IndexSpec_Source_value, data, "IndexSpec_Source") + if err != nil { + return err + } + *x = IndexSpec_Source(value) + return nil +} +func (IndexSpec_Source) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{13, 1} +} + +type IndexSpec_Mode int32 + +const ( + IndexSpec_PRIORITY IndexSpec_Mode = 0 + IndexSpec_BACKGROUND IndexSpec_Mode = 1 +) + +var IndexSpec_Mode_name = map[int32]string{ + 0: "PRIORITY", + 1: "BACKGROUND", +} +var IndexSpec_Mode_value = map[string]int32{ + "PRIORITY": 0, + "BACKGROUND": 1, +} + +func (x IndexSpec_Mode) Enum() *IndexSpec_Mode { + p := new(IndexSpec_Mode) + *p = x + return p +} +func (x IndexSpec_Mode) String() string { + return proto.EnumName(IndexSpec_Mode_name, int32(x)) +} +func (x *IndexSpec_Mode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(IndexSpec_Mode_value, data, "IndexSpec_Mode") + if err != nil { + return err + } + *x = IndexSpec_Mode(value) + return nil +} +func (IndexSpec_Mode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{13, 2} +} + +type IndexDocumentParams_Freshness int32 + +const ( + IndexDocumentParams_SYNCHRONOUSLY IndexDocumentParams_Freshness = 0 + IndexDocumentParams_WHEN_CONVENIENT IndexDocumentParams_Freshness = 1 +) + +var IndexDocumentParams_Freshness_name = map[int32]string{ + 0: "SYNCHRONOUSLY", + 1: "WHEN_CONVENIENT", +} +var IndexDocumentParams_Freshness_value = map[string]int32{ + "SYNCHRONOUSLY": 0, + "WHEN_CONVENIENT": 1, +} + +func (x IndexDocumentParams_Freshness) Enum() *IndexDocumentParams_Freshness { + p := new(IndexDocumentParams_Freshness) + *p = x + return p +} +func (x IndexDocumentParams_Freshness) String() string { + return proto.EnumName(IndexDocumentParams_Freshness_name, int32(x)) +} +func (x *IndexDocumentParams_Freshness) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(IndexDocumentParams_Freshness_value, data, "IndexDocumentParams_Freshness") + if err != nil { + return err + } + *x = IndexDocumentParams_Freshness(value) + return nil +} +func (IndexDocumentParams_Freshness) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{15, 0} +} + +type ScorerSpec_Scorer int32 + +const ( + ScorerSpec_RESCORING_MATCH_SCORER ScorerSpec_Scorer = 0 + ScorerSpec_MATCH_SCORER ScorerSpec_Scorer = 2 +) + +var ScorerSpec_Scorer_name = map[int32]string{ + 0: "RESCORING_MATCH_SCORER", + 2: "MATCH_SCORER", +} +var ScorerSpec_Scorer_value = map[string]int32{ + "RESCORING_MATCH_SCORER": 0, + "MATCH_SCORER": 2, +} + +func (x ScorerSpec_Scorer) Enum() *ScorerSpec_Scorer { + p := new(ScorerSpec_Scorer) + *p = x + return p +} +func (x ScorerSpec_Scorer) String() string { + return proto.EnumName(ScorerSpec_Scorer_name, int32(x)) +} +func (x *ScorerSpec_Scorer) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ScorerSpec_Scorer_value, data, "ScorerSpec_Scorer") + if err != nil { + return err + } + *x = ScorerSpec_Scorer(value) + return nil +} +func (ScorerSpec_Scorer) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{31, 0} +} + +type SearchParams_CursorType int32 + +const ( + SearchParams_NONE SearchParams_CursorType = 0 + SearchParams_SINGLE SearchParams_CursorType = 1 + SearchParams_PER_RESULT SearchParams_CursorType = 2 +) + +var SearchParams_CursorType_name = map[int32]string{ + 0: "NONE", + 1: "SINGLE", + 2: "PER_RESULT", +} +var SearchParams_CursorType_value = map[string]int32{ + "NONE": 0, + "SINGLE": 1, + "PER_RESULT": 2, +} + +func (x SearchParams_CursorType) Enum() *SearchParams_CursorType { + p := new(SearchParams_CursorType) + *p = x + return p +} +func (x SearchParams_CursorType) String() string { + return proto.EnumName(SearchParams_CursorType_name, int32(x)) +} +func (x *SearchParams_CursorType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(SearchParams_CursorType_value, data, "SearchParams_CursorType") + if err != nil { + return err + } + *x = SearchParams_CursorType(value) + return nil +} +func (SearchParams_CursorType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{38, 0} +} + +type SearchParams_ParsingMode int32 + +const ( + SearchParams_STRICT SearchParams_ParsingMode = 0 + SearchParams_RELAXED SearchParams_ParsingMode = 1 +) + +var SearchParams_ParsingMode_name = map[int32]string{ + 0: "STRICT", + 1: "RELAXED", +} +var SearchParams_ParsingMode_value = map[string]int32{ + "STRICT": 0, + "RELAXED": 1, +} + +func (x SearchParams_ParsingMode) Enum() *SearchParams_ParsingMode { + p := new(SearchParams_ParsingMode) + *p = x + return p +} +func (x SearchParams_ParsingMode) String() string { + return proto.EnumName(SearchParams_ParsingMode_name, int32(x)) +} +func (x *SearchParams_ParsingMode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(SearchParams_ParsingMode_value, data, "SearchParams_ParsingMode") + if err != nil { + return err + } + *x = SearchParams_ParsingMode(value) + return nil +} +func (SearchParams_ParsingMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{38, 1} +} + +type Scope struct { + Type *Scope_Type `protobuf:"varint,1,opt,name=type,enum=search.Scope_Type" json:"type,omitempty"` + Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Scope) Reset() { *m = Scope{} } +func (m *Scope) String() string { return proto.CompactTextString(m) } +func (*Scope) ProtoMessage() {} +func (*Scope) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{0} +} +func (m *Scope) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Scope.Unmarshal(m, b) +} +func (m *Scope) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Scope.Marshal(b, m, deterministic) +} +func (dst *Scope) XXX_Merge(src proto.Message) { + xxx_messageInfo_Scope.Merge(dst, src) +} +func (m *Scope) XXX_Size() int { + return xxx_messageInfo_Scope.Size(m) +} +func (m *Scope) XXX_DiscardUnknown() { + xxx_messageInfo_Scope.DiscardUnknown(m) +} + +var xxx_messageInfo_Scope proto.InternalMessageInfo + +func (m *Scope) GetType() Scope_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return Scope_USER_BY_CANONICAL_ID +} + +func (m *Scope) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type Entry struct { + Scope *Scope `protobuf:"bytes,1,opt,name=scope" json:"scope,omitempty"` + Permission *Entry_Permission `protobuf:"varint,2,opt,name=permission,enum=search.Entry_Permission" json:"permission,omitempty"` + DisplayName *string `protobuf:"bytes,3,opt,name=display_name,json=displayName" json:"display_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Entry) Reset() { *m = Entry{} } +func (m *Entry) String() string { return proto.CompactTextString(m) } +func (*Entry) ProtoMessage() {} +func (*Entry) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{1} +} +func (m *Entry) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Entry.Unmarshal(m, b) +} +func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Entry.Marshal(b, m, deterministic) +} +func (dst *Entry) XXX_Merge(src proto.Message) { + xxx_messageInfo_Entry.Merge(dst, src) +} +func (m *Entry) XXX_Size() int { + return xxx_messageInfo_Entry.Size(m) +} +func (m *Entry) XXX_DiscardUnknown() { + xxx_messageInfo_Entry.DiscardUnknown(m) +} + +var xxx_messageInfo_Entry proto.InternalMessageInfo + +func (m *Entry) GetScope() *Scope { + if m != nil { + return m.Scope + } + return nil +} + +func (m *Entry) GetPermission() Entry_Permission { + if m != nil && m.Permission != nil { + return *m.Permission + } + return Entry_READ +} + +func (m *Entry) GetDisplayName() string { + if m != nil && m.DisplayName != nil { + return *m.DisplayName + } + return "" +} + +type AccessControlList struct { + Owner *string `protobuf:"bytes,1,opt,name=owner" json:"owner,omitempty"` + Entries []*Entry `protobuf:"bytes,2,rep,name=entries" json:"entries,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AccessControlList) Reset() { *m = AccessControlList{} } +func (m *AccessControlList) String() string { return proto.CompactTextString(m) } +func (*AccessControlList) ProtoMessage() {} +func (*AccessControlList) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{2} +} +func (m *AccessControlList) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AccessControlList.Unmarshal(m, b) +} +func (m *AccessControlList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AccessControlList.Marshal(b, m, deterministic) +} +func (dst *AccessControlList) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccessControlList.Merge(dst, src) +} +func (m *AccessControlList) XXX_Size() int { + return xxx_messageInfo_AccessControlList.Size(m) +} +func (m *AccessControlList) XXX_DiscardUnknown() { + xxx_messageInfo_AccessControlList.DiscardUnknown(m) +} + +var xxx_messageInfo_AccessControlList proto.InternalMessageInfo + +func (m *AccessControlList) GetOwner() string { + if m != nil && m.Owner != nil { + return *m.Owner + } + return "" +} + +func (m *AccessControlList) GetEntries() []*Entry { + if m != nil { + return m.Entries + } + return nil +} + +type FieldValue struct { + Type *FieldValue_ContentType `protobuf:"varint,1,opt,name=type,enum=search.FieldValue_ContentType,def=0" json:"type,omitempty"` + Language *string `protobuf:"bytes,2,opt,name=language,def=en" json:"language,omitempty"` + StringValue *string `protobuf:"bytes,3,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + Geo *FieldValue_Geo `protobuf:"group,4,opt,name=Geo,json=geo" json:"geo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldValue) Reset() { *m = FieldValue{} } +func (m *FieldValue) String() string { return proto.CompactTextString(m) } +func (*FieldValue) ProtoMessage() {} +func (*FieldValue) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{3} +} +func (m *FieldValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldValue.Unmarshal(m, b) +} +func (m *FieldValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldValue.Marshal(b, m, deterministic) +} +func (dst *FieldValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldValue.Merge(dst, src) +} +func (m *FieldValue) XXX_Size() int { + return xxx_messageInfo_FieldValue.Size(m) +} +func (m *FieldValue) XXX_DiscardUnknown() { + xxx_messageInfo_FieldValue.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldValue proto.InternalMessageInfo + +const Default_FieldValue_Type FieldValue_ContentType = FieldValue_TEXT +const Default_FieldValue_Language string = "en" + +func (m *FieldValue) GetType() FieldValue_ContentType { + if m != nil && m.Type != nil { + return *m.Type + } + return Default_FieldValue_Type +} + +func (m *FieldValue) GetLanguage() string { + if m != nil && m.Language != nil { + return *m.Language + } + return Default_FieldValue_Language +} + +func (m *FieldValue) GetStringValue() string { + if m != nil && m.StringValue != nil { + return *m.StringValue + } + return "" +} + +func (m *FieldValue) GetGeo() *FieldValue_Geo { + if m != nil { + return m.Geo + } + return nil +} + +type FieldValue_Geo struct { + Lat *float64 `protobuf:"fixed64,5,req,name=lat" json:"lat,omitempty"` + Lng *float64 `protobuf:"fixed64,6,req,name=lng" json:"lng,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldValue_Geo) Reset() { *m = FieldValue_Geo{} } +func (m *FieldValue_Geo) String() string { return proto.CompactTextString(m) } +func (*FieldValue_Geo) ProtoMessage() {} +func (*FieldValue_Geo) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{3, 0} +} +func (m *FieldValue_Geo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldValue_Geo.Unmarshal(m, b) +} +func (m *FieldValue_Geo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldValue_Geo.Marshal(b, m, deterministic) +} +func (dst *FieldValue_Geo) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldValue_Geo.Merge(dst, src) +} +func (m *FieldValue_Geo) XXX_Size() int { + return xxx_messageInfo_FieldValue_Geo.Size(m) +} +func (m *FieldValue_Geo) XXX_DiscardUnknown() { + xxx_messageInfo_FieldValue_Geo.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldValue_Geo proto.InternalMessageInfo + +func (m *FieldValue_Geo) GetLat() float64 { + if m != nil && m.Lat != nil { + return *m.Lat + } + return 0 +} + +func (m *FieldValue_Geo) GetLng() float64 { + if m != nil && m.Lng != nil { + return *m.Lng + } + return 0 +} + +type Field struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Value *FieldValue `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Field) Reset() { *m = Field{} } +func (m *Field) String() string { return proto.CompactTextString(m) } +func (*Field) ProtoMessage() {} +func (*Field) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{4} +} +func (m *Field) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Field.Unmarshal(m, b) +} +func (m *Field) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Field.Marshal(b, m, deterministic) +} +func (dst *Field) XXX_Merge(src proto.Message) { + xxx_messageInfo_Field.Merge(dst, src) +} +func (m *Field) XXX_Size() int { + return xxx_messageInfo_Field.Size(m) +} +func (m *Field) XXX_DiscardUnknown() { + xxx_messageInfo_Field.DiscardUnknown(m) +} + +var xxx_messageInfo_Field proto.InternalMessageInfo + +func (m *Field) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *Field) GetValue() *FieldValue { + if m != nil { + return m.Value + } + return nil +} + +type FieldTypes struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Type []FieldValue_ContentType `protobuf:"varint,2,rep,name=type,enum=search.FieldValue_ContentType" json:"type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldTypes) Reset() { *m = FieldTypes{} } +func (m *FieldTypes) String() string { return proto.CompactTextString(m) } +func (*FieldTypes) ProtoMessage() {} +func (*FieldTypes) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{5} +} +func (m *FieldTypes) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldTypes.Unmarshal(m, b) +} +func (m *FieldTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldTypes.Marshal(b, m, deterministic) +} +func (dst *FieldTypes) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldTypes.Merge(dst, src) +} +func (m *FieldTypes) XXX_Size() int { + return xxx_messageInfo_FieldTypes.Size(m) +} +func (m *FieldTypes) XXX_DiscardUnknown() { + xxx_messageInfo_FieldTypes.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldTypes proto.InternalMessageInfo + +func (m *FieldTypes) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FieldTypes) GetType() []FieldValue_ContentType { + if m != nil { + return m.Type + } + return nil +} + +type IndexShardSettings struct { + PrevNumShards []int32 `protobuf:"varint,1,rep,name=prev_num_shards,json=prevNumShards" json:"prev_num_shards,omitempty"` + NumShards *int32 `protobuf:"varint,2,req,name=num_shards,json=numShards,def=1" json:"num_shards,omitempty"` + PrevNumShardsSearchFalse []int32 `protobuf:"varint,3,rep,name=prev_num_shards_search_false,json=prevNumShardsSearchFalse" json:"prev_num_shards_search_false,omitempty"` + LocalReplica *string `protobuf:"bytes,4,opt,name=local_replica,json=localReplica,def=" json:"local_replica,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexShardSettings) Reset() { *m = IndexShardSettings{} } +func (m *IndexShardSettings) String() string { return proto.CompactTextString(m) } +func (*IndexShardSettings) ProtoMessage() {} +func (*IndexShardSettings) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{6} +} +func (m *IndexShardSettings) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexShardSettings.Unmarshal(m, b) +} +func (m *IndexShardSettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexShardSettings.Marshal(b, m, deterministic) +} +func (dst *IndexShardSettings) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexShardSettings.Merge(dst, src) +} +func (m *IndexShardSettings) XXX_Size() int { + return xxx_messageInfo_IndexShardSettings.Size(m) +} +func (m *IndexShardSettings) XXX_DiscardUnknown() { + xxx_messageInfo_IndexShardSettings.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexShardSettings proto.InternalMessageInfo + +const Default_IndexShardSettings_NumShards int32 = 1 + +func (m *IndexShardSettings) GetPrevNumShards() []int32 { + if m != nil { + return m.PrevNumShards + } + return nil +} + +func (m *IndexShardSettings) GetNumShards() int32 { + if m != nil && m.NumShards != nil { + return *m.NumShards + } + return Default_IndexShardSettings_NumShards +} + +func (m *IndexShardSettings) GetPrevNumShardsSearchFalse() []int32 { + if m != nil { + return m.PrevNumShardsSearchFalse + } + return nil +} + +func (m *IndexShardSettings) GetLocalReplica() string { + if m != nil && m.LocalReplica != nil { + return *m.LocalReplica + } + return "" +} + +type FacetValue struct { + Type *FacetValue_ContentType `protobuf:"varint,1,opt,name=type,enum=search.FacetValue_ContentType,def=2" json:"type,omitempty"` + StringValue *string `protobuf:"bytes,3,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FacetValue) Reset() { *m = FacetValue{} } +func (m *FacetValue) String() string { return proto.CompactTextString(m) } +func (*FacetValue) ProtoMessage() {} +func (*FacetValue) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{7} +} +func (m *FacetValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FacetValue.Unmarshal(m, b) +} +func (m *FacetValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FacetValue.Marshal(b, m, deterministic) +} +func (dst *FacetValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_FacetValue.Merge(dst, src) +} +func (m *FacetValue) XXX_Size() int { + return xxx_messageInfo_FacetValue.Size(m) +} +func (m *FacetValue) XXX_DiscardUnknown() { + xxx_messageInfo_FacetValue.DiscardUnknown(m) +} + +var xxx_messageInfo_FacetValue proto.InternalMessageInfo + +const Default_FacetValue_Type FacetValue_ContentType = FacetValue_ATOM + +func (m *FacetValue) GetType() FacetValue_ContentType { + if m != nil && m.Type != nil { + return *m.Type + } + return Default_FacetValue_Type +} + +func (m *FacetValue) GetStringValue() string { + if m != nil && m.StringValue != nil { + return *m.StringValue + } + return "" +} + +type Facet struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Value *FacetValue `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Facet) Reset() { *m = Facet{} } +func (m *Facet) String() string { return proto.CompactTextString(m) } +func (*Facet) ProtoMessage() {} +func (*Facet) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{8} +} +func (m *Facet) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Facet.Unmarshal(m, b) +} +func (m *Facet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Facet.Marshal(b, m, deterministic) +} +func (dst *Facet) XXX_Merge(src proto.Message) { + xxx_messageInfo_Facet.Merge(dst, src) +} +func (m *Facet) XXX_Size() int { + return xxx_messageInfo_Facet.Size(m) +} +func (m *Facet) XXX_DiscardUnknown() { + xxx_messageInfo_Facet.DiscardUnknown(m) +} + +var xxx_messageInfo_Facet proto.InternalMessageInfo + +func (m *Facet) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *Facet) GetValue() *FacetValue { + if m != nil { + return m.Value + } + return nil +} + +type DocumentMetadata struct { + Version *int64 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` + CommittedStVersion *int64 `protobuf:"varint,2,opt,name=committed_st_version,json=committedStVersion" json:"committed_st_version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DocumentMetadata) Reset() { *m = DocumentMetadata{} } +func (m *DocumentMetadata) String() string { return proto.CompactTextString(m) } +func (*DocumentMetadata) ProtoMessage() {} +func (*DocumentMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{9} +} +func (m *DocumentMetadata) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DocumentMetadata.Unmarshal(m, b) +} +func (m *DocumentMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DocumentMetadata.Marshal(b, m, deterministic) +} +func (dst *DocumentMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_DocumentMetadata.Merge(dst, src) +} +func (m *DocumentMetadata) XXX_Size() int { + return xxx_messageInfo_DocumentMetadata.Size(m) +} +func (m *DocumentMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_DocumentMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_DocumentMetadata proto.InternalMessageInfo + +func (m *DocumentMetadata) GetVersion() int64 { + if m != nil && m.Version != nil { + return *m.Version + } + return 0 +} + +func (m *DocumentMetadata) GetCommittedStVersion() int64 { + if m != nil && m.CommittedStVersion != nil { + return *m.CommittedStVersion + } + return 0 +} + +type Document struct { + Id *string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Language *string `protobuf:"bytes,2,opt,name=language,def=en" json:"language,omitempty"` + Field []*Field `protobuf:"bytes,3,rep,name=field" json:"field,omitempty"` + OrderId *int32 `protobuf:"varint,4,opt,name=order_id,json=orderId" json:"order_id,omitempty"` + OrderIdSource *Document_OrderIdSource `protobuf:"varint,6,opt,name=order_id_source,json=orderIdSource,enum=search.Document_OrderIdSource,def=1" json:"order_id_source,omitempty"` + Storage *Document_Storage `protobuf:"varint,5,opt,name=storage,enum=search.Document_Storage,def=0" json:"storage,omitempty"` + Facet []*Facet `protobuf:"bytes,8,rep,name=facet" json:"facet,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Document) Reset() { *m = Document{} } +func (m *Document) String() string { return proto.CompactTextString(m) } +func (*Document) ProtoMessage() {} +func (*Document) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{10} +} +func (m *Document) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Document.Unmarshal(m, b) +} +func (m *Document) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Document.Marshal(b, m, deterministic) +} +func (dst *Document) XXX_Merge(src proto.Message) { + xxx_messageInfo_Document.Merge(dst, src) +} +func (m *Document) XXX_Size() int { + return xxx_messageInfo_Document.Size(m) +} +func (m *Document) XXX_DiscardUnknown() { + xxx_messageInfo_Document.DiscardUnknown(m) +} + +var xxx_messageInfo_Document proto.InternalMessageInfo + +const Default_Document_Language string = "en" +const Default_Document_OrderIdSource Document_OrderIdSource = Document_SUPPLIED +const Default_Document_Storage Document_Storage = Document_DISK + +func (m *Document) GetId() string { + if m != nil && m.Id != nil { + return *m.Id + } + return "" +} + +func (m *Document) GetLanguage() string { + if m != nil && m.Language != nil { + return *m.Language + } + return Default_Document_Language +} + +func (m *Document) GetField() []*Field { + if m != nil { + return m.Field + } + return nil +} + +func (m *Document) GetOrderId() int32 { + if m != nil && m.OrderId != nil { + return *m.OrderId + } + return 0 +} + +func (m *Document) GetOrderIdSource() Document_OrderIdSource { + if m != nil && m.OrderIdSource != nil { + return *m.OrderIdSource + } + return Default_Document_OrderIdSource +} + +func (m *Document) GetStorage() Document_Storage { + if m != nil && m.Storage != nil { + return *m.Storage + } + return Default_Document_Storage +} + +func (m *Document) GetFacet() []*Facet { + if m != nil { + return m.Facet + } + return nil +} + +type SearchServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchServiceError) Reset() { *m = SearchServiceError{} } +func (m *SearchServiceError) String() string { return proto.CompactTextString(m) } +func (*SearchServiceError) ProtoMessage() {} +func (*SearchServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{11} +} +func (m *SearchServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchServiceError.Unmarshal(m, b) +} +func (m *SearchServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchServiceError.Marshal(b, m, deterministic) +} +func (dst *SearchServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchServiceError.Merge(dst, src) +} +func (m *SearchServiceError) XXX_Size() int { + return xxx_messageInfo_SearchServiceError.Size(m) +} +func (m *SearchServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_SearchServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchServiceError proto.InternalMessageInfo + +type RequestStatus struct { + Code *SearchServiceError_ErrorCode `protobuf:"varint,1,req,name=code,enum=search.SearchServiceError_ErrorCode" json:"code,omitempty"` + ErrorDetail *string `protobuf:"bytes,2,opt,name=error_detail,json=errorDetail" json:"error_detail,omitempty"` + CanonicalCode *int32 `protobuf:"varint,3,opt,name=canonical_code,json=canonicalCode" json:"canonical_code,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestStatus) Reset() { *m = RequestStatus{} } +func (m *RequestStatus) String() string { return proto.CompactTextString(m) } +func (*RequestStatus) ProtoMessage() {} +func (*RequestStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{12} +} +func (m *RequestStatus) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RequestStatus.Unmarshal(m, b) +} +func (m *RequestStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RequestStatus.Marshal(b, m, deterministic) +} +func (dst *RequestStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestStatus.Merge(dst, src) +} +func (m *RequestStatus) XXX_Size() int { + return xxx_messageInfo_RequestStatus.Size(m) +} +func (m *RequestStatus) XXX_DiscardUnknown() { + xxx_messageInfo_RequestStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestStatus proto.InternalMessageInfo + +func (m *RequestStatus) GetCode() SearchServiceError_ErrorCode { + if m != nil && m.Code != nil { + return *m.Code + } + return SearchServiceError_OK +} + +func (m *RequestStatus) GetErrorDetail() string { + if m != nil && m.ErrorDetail != nil { + return *m.ErrorDetail + } + return "" +} + +func (m *RequestStatus) GetCanonicalCode() int32 { + if m != nil && m.CanonicalCode != nil { + return *m.CanonicalCode + } + return 0 +} + +type IndexSpec struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Consistency *IndexSpec_Consistency `protobuf:"varint,2,opt,name=consistency,enum=search.IndexSpec_Consistency,def=1" json:"consistency,omitempty"` + Namespace *string `protobuf:"bytes,3,opt,name=namespace" json:"namespace,omitempty"` + Version *int32 `protobuf:"varint,4,opt,name=version" json:"version,omitempty"` + Source *IndexSpec_Source `protobuf:"varint,5,opt,name=source,enum=search.IndexSpec_Source,def=0" json:"source,omitempty"` + Mode *IndexSpec_Mode `protobuf:"varint,6,opt,name=mode,enum=search.IndexSpec_Mode,def=0" json:"mode,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexSpec) Reset() { *m = IndexSpec{} } +func (m *IndexSpec) String() string { return proto.CompactTextString(m) } +func (*IndexSpec) ProtoMessage() {} +func (*IndexSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{13} +} +func (m *IndexSpec) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexSpec.Unmarshal(m, b) +} +func (m *IndexSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexSpec.Marshal(b, m, deterministic) +} +func (dst *IndexSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexSpec.Merge(dst, src) +} +func (m *IndexSpec) XXX_Size() int { + return xxx_messageInfo_IndexSpec.Size(m) +} +func (m *IndexSpec) XXX_DiscardUnknown() { + xxx_messageInfo_IndexSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexSpec proto.InternalMessageInfo + +const Default_IndexSpec_Consistency IndexSpec_Consistency = IndexSpec_PER_DOCUMENT +const Default_IndexSpec_Source IndexSpec_Source = IndexSpec_SEARCH +const Default_IndexSpec_Mode IndexSpec_Mode = IndexSpec_PRIORITY + +func (m *IndexSpec) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *IndexSpec) GetConsistency() IndexSpec_Consistency { + if m != nil && m.Consistency != nil { + return *m.Consistency + } + return Default_IndexSpec_Consistency +} + +func (m *IndexSpec) GetNamespace() string { + if m != nil && m.Namespace != nil { + return *m.Namespace + } + return "" +} + +func (m *IndexSpec) GetVersion() int32 { + if m != nil && m.Version != nil { + return *m.Version + } + return 0 +} + +func (m *IndexSpec) GetSource() IndexSpec_Source { + if m != nil && m.Source != nil { + return *m.Source + } + return Default_IndexSpec_Source +} + +func (m *IndexSpec) GetMode() IndexSpec_Mode { + if m != nil && m.Mode != nil { + return *m.Mode + } + return Default_IndexSpec_Mode +} + +type IndexMetadata struct { + IndexSpec *IndexSpec `protobuf:"bytes,1,req,name=index_spec,json=indexSpec" json:"index_spec,omitempty"` + Field []*FieldTypes `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` + Storage *IndexMetadata_Storage `protobuf:"bytes,3,opt,name=storage" json:"storage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexMetadata) Reset() { *m = IndexMetadata{} } +func (m *IndexMetadata) String() string { return proto.CompactTextString(m) } +func (*IndexMetadata) ProtoMessage() {} +func (*IndexMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{14} +} +func (m *IndexMetadata) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexMetadata.Unmarshal(m, b) +} +func (m *IndexMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexMetadata.Marshal(b, m, deterministic) +} +func (dst *IndexMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexMetadata.Merge(dst, src) +} +func (m *IndexMetadata) XXX_Size() int { + return xxx_messageInfo_IndexMetadata.Size(m) +} +func (m *IndexMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_IndexMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexMetadata proto.InternalMessageInfo + +func (m *IndexMetadata) GetIndexSpec() *IndexSpec { + if m != nil { + return m.IndexSpec + } + return nil +} + +func (m *IndexMetadata) GetField() []*FieldTypes { + if m != nil { + return m.Field + } + return nil +} + +func (m *IndexMetadata) GetStorage() *IndexMetadata_Storage { + if m != nil { + return m.Storage + } + return nil +} + +type IndexMetadata_Storage struct { + AmountUsed *int64 `protobuf:"varint,1,opt,name=amount_used,json=amountUsed" json:"amount_used,omitempty"` + Limit *int64 `protobuf:"varint,2,opt,name=limit" json:"limit,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexMetadata_Storage) Reset() { *m = IndexMetadata_Storage{} } +func (m *IndexMetadata_Storage) String() string { return proto.CompactTextString(m) } +func (*IndexMetadata_Storage) ProtoMessage() {} +func (*IndexMetadata_Storage) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{14, 0} +} +func (m *IndexMetadata_Storage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexMetadata_Storage.Unmarshal(m, b) +} +func (m *IndexMetadata_Storage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexMetadata_Storage.Marshal(b, m, deterministic) +} +func (dst *IndexMetadata_Storage) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexMetadata_Storage.Merge(dst, src) +} +func (m *IndexMetadata_Storage) XXX_Size() int { + return xxx_messageInfo_IndexMetadata_Storage.Size(m) +} +func (m *IndexMetadata_Storage) XXX_DiscardUnknown() { + xxx_messageInfo_IndexMetadata_Storage.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexMetadata_Storage proto.InternalMessageInfo + +func (m *IndexMetadata_Storage) GetAmountUsed() int64 { + if m != nil && m.AmountUsed != nil { + return *m.AmountUsed + } + return 0 +} + +func (m *IndexMetadata_Storage) GetLimit() int64 { + if m != nil && m.Limit != nil { + return *m.Limit + } + return 0 +} + +type IndexDocumentParams struct { + Document []*Document `protobuf:"bytes,1,rep,name=document" json:"document,omitempty"` + Freshness *IndexDocumentParams_Freshness `protobuf:"varint,2,opt,name=freshness,enum=search.IndexDocumentParams_Freshness,def=0" json:"freshness,omitempty"` // Deprecated: Do not use. + IndexSpec *IndexSpec `protobuf:"bytes,3,req,name=index_spec,json=indexSpec" json:"index_spec,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexDocumentParams) Reset() { *m = IndexDocumentParams{} } +func (m *IndexDocumentParams) String() string { return proto.CompactTextString(m) } +func (*IndexDocumentParams) ProtoMessage() {} +func (*IndexDocumentParams) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{15} +} +func (m *IndexDocumentParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexDocumentParams.Unmarshal(m, b) +} +func (m *IndexDocumentParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexDocumentParams.Marshal(b, m, deterministic) +} +func (dst *IndexDocumentParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexDocumentParams.Merge(dst, src) +} +func (m *IndexDocumentParams) XXX_Size() int { + return xxx_messageInfo_IndexDocumentParams.Size(m) +} +func (m *IndexDocumentParams) XXX_DiscardUnknown() { + xxx_messageInfo_IndexDocumentParams.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexDocumentParams proto.InternalMessageInfo + +const Default_IndexDocumentParams_Freshness IndexDocumentParams_Freshness = IndexDocumentParams_SYNCHRONOUSLY + +func (m *IndexDocumentParams) GetDocument() []*Document { + if m != nil { + return m.Document + } + return nil +} + +// Deprecated: Do not use. +func (m *IndexDocumentParams) GetFreshness() IndexDocumentParams_Freshness { + if m != nil && m.Freshness != nil { + return *m.Freshness + } + return Default_IndexDocumentParams_Freshness +} + +func (m *IndexDocumentParams) GetIndexSpec() *IndexSpec { + if m != nil { + return m.IndexSpec + } + return nil +} + +type IndexDocumentRequest struct { + Params *IndexDocumentParams `protobuf:"bytes,1,req,name=params" json:"params,omitempty"` + AppId []byte `protobuf:"bytes,3,opt,name=app_id,json=appId" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexDocumentRequest) Reset() { *m = IndexDocumentRequest{} } +func (m *IndexDocumentRequest) String() string { return proto.CompactTextString(m) } +func (*IndexDocumentRequest) ProtoMessage() {} +func (*IndexDocumentRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{16} +} +func (m *IndexDocumentRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexDocumentRequest.Unmarshal(m, b) +} +func (m *IndexDocumentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexDocumentRequest.Marshal(b, m, deterministic) +} +func (dst *IndexDocumentRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexDocumentRequest.Merge(dst, src) +} +func (m *IndexDocumentRequest) XXX_Size() int { + return xxx_messageInfo_IndexDocumentRequest.Size(m) +} +func (m *IndexDocumentRequest) XXX_DiscardUnknown() { + xxx_messageInfo_IndexDocumentRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexDocumentRequest proto.InternalMessageInfo + +func (m *IndexDocumentRequest) GetParams() *IndexDocumentParams { + if m != nil { + return m.Params + } + return nil +} + +func (m *IndexDocumentRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +type IndexDocumentResponse struct { + Status []*RequestStatus `protobuf:"bytes,1,rep,name=status" json:"status,omitempty"` + DocId []string `protobuf:"bytes,2,rep,name=doc_id,json=docId" json:"doc_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IndexDocumentResponse) Reset() { *m = IndexDocumentResponse{} } +func (m *IndexDocumentResponse) String() string { return proto.CompactTextString(m) } +func (*IndexDocumentResponse) ProtoMessage() {} +func (*IndexDocumentResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{17} +} +func (m *IndexDocumentResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexDocumentResponse.Unmarshal(m, b) +} +func (m *IndexDocumentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexDocumentResponse.Marshal(b, m, deterministic) +} +func (dst *IndexDocumentResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexDocumentResponse.Merge(dst, src) +} +func (m *IndexDocumentResponse) XXX_Size() int { + return xxx_messageInfo_IndexDocumentResponse.Size(m) +} +func (m *IndexDocumentResponse) XXX_DiscardUnknown() { + xxx_messageInfo_IndexDocumentResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexDocumentResponse proto.InternalMessageInfo + +func (m *IndexDocumentResponse) GetStatus() []*RequestStatus { + if m != nil { + return m.Status + } + return nil +} + +func (m *IndexDocumentResponse) GetDocId() []string { + if m != nil { + return m.DocId + } + return nil +} + +type DeleteDocumentParams struct { + DocId []string `protobuf:"bytes,1,rep,name=doc_id,json=docId" json:"doc_id,omitempty"` + IndexSpec *IndexSpec `protobuf:"bytes,2,req,name=index_spec,json=indexSpec" json:"index_spec,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteDocumentParams) Reset() { *m = DeleteDocumentParams{} } +func (m *DeleteDocumentParams) String() string { return proto.CompactTextString(m) } +func (*DeleteDocumentParams) ProtoMessage() {} +func (*DeleteDocumentParams) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{18} +} +func (m *DeleteDocumentParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteDocumentParams.Unmarshal(m, b) +} +func (m *DeleteDocumentParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteDocumentParams.Marshal(b, m, deterministic) +} +func (dst *DeleteDocumentParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteDocumentParams.Merge(dst, src) +} +func (m *DeleteDocumentParams) XXX_Size() int { + return xxx_messageInfo_DeleteDocumentParams.Size(m) +} +func (m *DeleteDocumentParams) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteDocumentParams.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteDocumentParams proto.InternalMessageInfo + +func (m *DeleteDocumentParams) GetDocId() []string { + if m != nil { + return m.DocId + } + return nil +} + +func (m *DeleteDocumentParams) GetIndexSpec() *IndexSpec { + if m != nil { + return m.IndexSpec + } + return nil +} + +type DeleteDocumentRequest struct { + Params *DeleteDocumentParams `protobuf:"bytes,1,req,name=params" json:"params,omitempty"` + AppId []byte `protobuf:"bytes,3,opt,name=app_id,json=appId" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteDocumentRequest) Reset() { *m = DeleteDocumentRequest{} } +func (m *DeleteDocumentRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteDocumentRequest) ProtoMessage() {} +func (*DeleteDocumentRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{19} +} +func (m *DeleteDocumentRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteDocumentRequest.Unmarshal(m, b) +} +func (m *DeleteDocumentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteDocumentRequest.Marshal(b, m, deterministic) +} +func (dst *DeleteDocumentRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteDocumentRequest.Merge(dst, src) +} +func (m *DeleteDocumentRequest) XXX_Size() int { + return xxx_messageInfo_DeleteDocumentRequest.Size(m) +} +func (m *DeleteDocumentRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteDocumentRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteDocumentRequest proto.InternalMessageInfo + +func (m *DeleteDocumentRequest) GetParams() *DeleteDocumentParams { + if m != nil { + return m.Params + } + return nil +} + +func (m *DeleteDocumentRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +type DeleteDocumentResponse struct { + Status []*RequestStatus `protobuf:"bytes,1,rep,name=status" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteDocumentResponse) Reset() { *m = DeleteDocumentResponse{} } +func (m *DeleteDocumentResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteDocumentResponse) ProtoMessage() {} +func (*DeleteDocumentResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{20} +} +func (m *DeleteDocumentResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteDocumentResponse.Unmarshal(m, b) +} +func (m *DeleteDocumentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteDocumentResponse.Marshal(b, m, deterministic) +} +func (dst *DeleteDocumentResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteDocumentResponse.Merge(dst, src) +} +func (m *DeleteDocumentResponse) XXX_Size() int { + return xxx_messageInfo_DeleteDocumentResponse.Size(m) +} +func (m *DeleteDocumentResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteDocumentResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteDocumentResponse proto.InternalMessageInfo + +func (m *DeleteDocumentResponse) GetStatus() []*RequestStatus { + if m != nil { + return m.Status + } + return nil +} + +type ListDocumentsParams struct { + IndexSpec *IndexSpec `protobuf:"bytes,1,req,name=index_spec,json=indexSpec" json:"index_spec,omitempty"` + StartDocId *string `protobuf:"bytes,2,opt,name=start_doc_id,json=startDocId" json:"start_doc_id,omitempty"` + IncludeStartDoc *bool `protobuf:"varint,3,opt,name=include_start_doc,json=includeStartDoc,def=1" json:"include_start_doc,omitempty"` + Limit *int32 `protobuf:"varint,4,opt,name=limit,def=100" json:"limit,omitempty"` + KeysOnly *bool `protobuf:"varint,5,opt,name=keys_only,json=keysOnly" json:"keys_only,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListDocumentsParams) Reset() { *m = ListDocumentsParams{} } +func (m *ListDocumentsParams) String() string { return proto.CompactTextString(m) } +func (*ListDocumentsParams) ProtoMessage() {} +func (*ListDocumentsParams) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{21} +} +func (m *ListDocumentsParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListDocumentsParams.Unmarshal(m, b) +} +func (m *ListDocumentsParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListDocumentsParams.Marshal(b, m, deterministic) +} +func (dst *ListDocumentsParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListDocumentsParams.Merge(dst, src) +} +func (m *ListDocumentsParams) XXX_Size() int { + return xxx_messageInfo_ListDocumentsParams.Size(m) +} +func (m *ListDocumentsParams) XXX_DiscardUnknown() { + xxx_messageInfo_ListDocumentsParams.DiscardUnknown(m) +} + +var xxx_messageInfo_ListDocumentsParams proto.InternalMessageInfo + +const Default_ListDocumentsParams_IncludeStartDoc bool = true +const Default_ListDocumentsParams_Limit int32 = 100 + +func (m *ListDocumentsParams) GetIndexSpec() *IndexSpec { + if m != nil { + return m.IndexSpec + } + return nil +} + +func (m *ListDocumentsParams) GetStartDocId() string { + if m != nil && m.StartDocId != nil { + return *m.StartDocId + } + return "" +} + +func (m *ListDocumentsParams) GetIncludeStartDoc() bool { + if m != nil && m.IncludeStartDoc != nil { + return *m.IncludeStartDoc + } + return Default_ListDocumentsParams_IncludeStartDoc +} + +func (m *ListDocumentsParams) GetLimit() int32 { + if m != nil && m.Limit != nil { + return *m.Limit + } + return Default_ListDocumentsParams_Limit +} + +func (m *ListDocumentsParams) GetKeysOnly() bool { + if m != nil && m.KeysOnly != nil { + return *m.KeysOnly + } + return false +} + +type ListDocumentsRequest struct { + Params *ListDocumentsParams `protobuf:"bytes,1,req,name=params" json:"params,omitempty"` + AppId []byte `protobuf:"bytes,2,opt,name=app_id,json=appId" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListDocumentsRequest) Reset() { *m = ListDocumentsRequest{} } +func (m *ListDocumentsRequest) String() string { return proto.CompactTextString(m) } +func (*ListDocumentsRequest) ProtoMessage() {} +func (*ListDocumentsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{22} +} +func (m *ListDocumentsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListDocumentsRequest.Unmarshal(m, b) +} +func (m *ListDocumentsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListDocumentsRequest.Marshal(b, m, deterministic) +} +func (dst *ListDocumentsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListDocumentsRequest.Merge(dst, src) +} +func (m *ListDocumentsRequest) XXX_Size() int { + return xxx_messageInfo_ListDocumentsRequest.Size(m) +} +func (m *ListDocumentsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListDocumentsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListDocumentsRequest proto.InternalMessageInfo + +func (m *ListDocumentsRequest) GetParams() *ListDocumentsParams { + if m != nil { + return m.Params + } + return nil +} + +func (m *ListDocumentsRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +type ListDocumentsResponse struct { + Status *RequestStatus `protobuf:"bytes,1,req,name=status" json:"status,omitempty"` + Document []*Document `protobuf:"bytes,2,rep,name=document" json:"document,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListDocumentsResponse) Reset() { *m = ListDocumentsResponse{} } +func (m *ListDocumentsResponse) String() string { return proto.CompactTextString(m) } +func (*ListDocumentsResponse) ProtoMessage() {} +func (*ListDocumentsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{23} +} +func (m *ListDocumentsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListDocumentsResponse.Unmarshal(m, b) +} +func (m *ListDocumentsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListDocumentsResponse.Marshal(b, m, deterministic) +} +func (dst *ListDocumentsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListDocumentsResponse.Merge(dst, src) +} +func (m *ListDocumentsResponse) XXX_Size() int { + return xxx_messageInfo_ListDocumentsResponse.Size(m) +} +func (m *ListDocumentsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListDocumentsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListDocumentsResponse proto.InternalMessageInfo + +func (m *ListDocumentsResponse) GetStatus() *RequestStatus { + if m != nil { + return m.Status + } + return nil +} + +func (m *ListDocumentsResponse) GetDocument() []*Document { + if m != nil { + return m.Document + } + return nil +} + +type ListIndexesParams struct { + FetchSchema *bool `protobuf:"varint,1,opt,name=fetch_schema,json=fetchSchema" json:"fetch_schema,omitempty"` + Limit *int32 `protobuf:"varint,2,opt,name=limit,def=20" json:"limit,omitempty"` + Namespace *string `protobuf:"bytes,3,opt,name=namespace" json:"namespace,omitempty"` + StartIndexName *string `protobuf:"bytes,4,opt,name=start_index_name,json=startIndexName" json:"start_index_name,omitempty"` + IncludeStartIndex *bool `protobuf:"varint,5,opt,name=include_start_index,json=includeStartIndex,def=1" json:"include_start_index,omitempty"` + IndexNamePrefix *string `protobuf:"bytes,6,opt,name=index_name_prefix,json=indexNamePrefix" json:"index_name_prefix,omitempty"` + Offset *int32 `protobuf:"varint,7,opt,name=offset" json:"offset,omitempty"` + Source *IndexSpec_Source `protobuf:"varint,8,opt,name=source,enum=search.IndexSpec_Source,def=0" json:"source,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListIndexesParams) Reset() { *m = ListIndexesParams{} } +func (m *ListIndexesParams) String() string { return proto.CompactTextString(m) } +func (*ListIndexesParams) ProtoMessage() {} +func (*ListIndexesParams) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{24} +} +func (m *ListIndexesParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListIndexesParams.Unmarshal(m, b) +} +func (m *ListIndexesParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListIndexesParams.Marshal(b, m, deterministic) +} +func (dst *ListIndexesParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListIndexesParams.Merge(dst, src) +} +func (m *ListIndexesParams) XXX_Size() int { + return xxx_messageInfo_ListIndexesParams.Size(m) +} +func (m *ListIndexesParams) XXX_DiscardUnknown() { + xxx_messageInfo_ListIndexesParams.DiscardUnknown(m) +} + +var xxx_messageInfo_ListIndexesParams proto.InternalMessageInfo + +const Default_ListIndexesParams_Limit int32 = 20 +const Default_ListIndexesParams_IncludeStartIndex bool = true +const Default_ListIndexesParams_Source IndexSpec_Source = IndexSpec_SEARCH + +func (m *ListIndexesParams) GetFetchSchema() bool { + if m != nil && m.FetchSchema != nil { + return *m.FetchSchema + } + return false +} + +func (m *ListIndexesParams) GetLimit() int32 { + if m != nil && m.Limit != nil { + return *m.Limit + } + return Default_ListIndexesParams_Limit +} + +func (m *ListIndexesParams) GetNamespace() string { + if m != nil && m.Namespace != nil { + return *m.Namespace + } + return "" +} + +func (m *ListIndexesParams) GetStartIndexName() string { + if m != nil && m.StartIndexName != nil { + return *m.StartIndexName + } + return "" +} + +func (m *ListIndexesParams) GetIncludeStartIndex() bool { + if m != nil && m.IncludeStartIndex != nil { + return *m.IncludeStartIndex + } + return Default_ListIndexesParams_IncludeStartIndex +} + +func (m *ListIndexesParams) GetIndexNamePrefix() string { + if m != nil && m.IndexNamePrefix != nil { + return *m.IndexNamePrefix + } + return "" +} + +func (m *ListIndexesParams) GetOffset() int32 { + if m != nil && m.Offset != nil { + return *m.Offset + } + return 0 +} + +func (m *ListIndexesParams) GetSource() IndexSpec_Source { + if m != nil && m.Source != nil { + return *m.Source + } + return Default_ListIndexesParams_Source +} + +type ListIndexesRequest struct { + Params *ListIndexesParams `protobuf:"bytes,1,req,name=params" json:"params,omitempty"` + AppId []byte `protobuf:"bytes,3,opt,name=app_id,json=appId" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListIndexesRequest) Reset() { *m = ListIndexesRequest{} } +func (m *ListIndexesRequest) String() string { return proto.CompactTextString(m) } +func (*ListIndexesRequest) ProtoMessage() {} +func (*ListIndexesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{25} +} +func (m *ListIndexesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListIndexesRequest.Unmarshal(m, b) +} +func (m *ListIndexesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListIndexesRequest.Marshal(b, m, deterministic) +} +func (dst *ListIndexesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListIndexesRequest.Merge(dst, src) +} +func (m *ListIndexesRequest) XXX_Size() int { + return xxx_messageInfo_ListIndexesRequest.Size(m) +} +func (m *ListIndexesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListIndexesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListIndexesRequest proto.InternalMessageInfo + +func (m *ListIndexesRequest) GetParams() *ListIndexesParams { + if m != nil { + return m.Params + } + return nil +} + +func (m *ListIndexesRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +type ListIndexesResponse struct { + Status *RequestStatus `protobuf:"bytes,1,req,name=status" json:"status,omitempty"` + IndexMetadata []*IndexMetadata `protobuf:"bytes,2,rep,name=index_metadata,json=indexMetadata" json:"index_metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListIndexesResponse) Reset() { *m = ListIndexesResponse{} } +func (m *ListIndexesResponse) String() string { return proto.CompactTextString(m) } +func (*ListIndexesResponse) ProtoMessage() {} +func (*ListIndexesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{26} +} +func (m *ListIndexesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListIndexesResponse.Unmarshal(m, b) +} +func (m *ListIndexesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListIndexesResponse.Marshal(b, m, deterministic) +} +func (dst *ListIndexesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListIndexesResponse.Merge(dst, src) +} +func (m *ListIndexesResponse) XXX_Size() int { + return xxx_messageInfo_ListIndexesResponse.Size(m) +} +func (m *ListIndexesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListIndexesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListIndexesResponse proto.InternalMessageInfo + +func (m *ListIndexesResponse) GetStatus() *RequestStatus { + if m != nil { + return m.Status + } + return nil +} + +func (m *ListIndexesResponse) GetIndexMetadata() []*IndexMetadata { + if m != nil { + return m.IndexMetadata + } + return nil +} + +type DeleteSchemaParams struct { + Source *IndexSpec_Source `protobuf:"varint,1,opt,name=source,enum=search.IndexSpec_Source,def=0" json:"source,omitempty"` + IndexSpec []*IndexSpec `protobuf:"bytes,2,rep,name=index_spec,json=indexSpec" json:"index_spec,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteSchemaParams) Reset() { *m = DeleteSchemaParams{} } +func (m *DeleteSchemaParams) String() string { return proto.CompactTextString(m) } +func (*DeleteSchemaParams) ProtoMessage() {} +func (*DeleteSchemaParams) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{27} +} +func (m *DeleteSchemaParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteSchemaParams.Unmarshal(m, b) +} +func (m *DeleteSchemaParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteSchemaParams.Marshal(b, m, deterministic) +} +func (dst *DeleteSchemaParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteSchemaParams.Merge(dst, src) +} +func (m *DeleteSchemaParams) XXX_Size() int { + return xxx_messageInfo_DeleteSchemaParams.Size(m) +} +func (m *DeleteSchemaParams) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteSchemaParams.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteSchemaParams proto.InternalMessageInfo + +const Default_DeleteSchemaParams_Source IndexSpec_Source = IndexSpec_SEARCH + +func (m *DeleteSchemaParams) GetSource() IndexSpec_Source { + if m != nil && m.Source != nil { + return *m.Source + } + return Default_DeleteSchemaParams_Source +} + +func (m *DeleteSchemaParams) GetIndexSpec() []*IndexSpec { + if m != nil { + return m.IndexSpec + } + return nil +} + +type DeleteSchemaRequest struct { + Params *DeleteSchemaParams `protobuf:"bytes,1,req,name=params" json:"params,omitempty"` + AppId []byte `protobuf:"bytes,3,opt,name=app_id,json=appId" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteSchemaRequest) Reset() { *m = DeleteSchemaRequest{} } +func (m *DeleteSchemaRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteSchemaRequest) ProtoMessage() {} +func (*DeleteSchemaRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{28} +} +func (m *DeleteSchemaRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteSchemaRequest.Unmarshal(m, b) +} +func (m *DeleteSchemaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteSchemaRequest.Marshal(b, m, deterministic) +} +func (dst *DeleteSchemaRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteSchemaRequest.Merge(dst, src) +} +func (m *DeleteSchemaRequest) XXX_Size() int { + return xxx_messageInfo_DeleteSchemaRequest.Size(m) +} +func (m *DeleteSchemaRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteSchemaRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteSchemaRequest proto.InternalMessageInfo + +func (m *DeleteSchemaRequest) GetParams() *DeleteSchemaParams { + if m != nil { + return m.Params + } + return nil +} + +func (m *DeleteSchemaRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +type DeleteSchemaResponse struct { + Status []*RequestStatus `protobuf:"bytes,1,rep,name=status" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteSchemaResponse) Reset() { *m = DeleteSchemaResponse{} } +func (m *DeleteSchemaResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteSchemaResponse) ProtoMessage() {} +func (*DeleteSchemaResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{29} +} +func (m *DeleteSchemaResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteSchemaResponse.Unmarshal(m, b) +} +func (m *DeleteSchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteSchemaResponse.Marshal(b, m, deterministic) +} +func (dst *DeleteSchemaResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteSchemaResponse.Merge(dst, src) +} +func (m *DeleteSchemaResponse) XXX_Size() int { + return xxx_messageInfo_DeleteSchemaResponse.Size(m) +} +func (m *DeleteSchemaResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteSchemaResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteSchemaResponse proto.InternalMessageInfo + +func (m *DeleteSchemaResponse) GetStatus() []*RequestStatus { + if m != nil { + return m.Status + } + return nil +} + +type SortSpec struct { + SortExpression *string `protobuf:"bytes,1,req,name=sort_expression,json=sortExpression" json:"sort_expression,omitempty"` + SortDescending *bool `protobuf:"varint,2,opt,name=sort_descending,json=sortDescending,def=1" json:"sort_descending,omitempty"` + DefaultValueText *string `protobuf:"bytes,4,opt,name=default_value_text,json=defaultValueText" json:"default_value_text,omitempty"` + DefaultValueNumeric *float64 `protobuf:"fixed64,5,opt,name=default_value_numeric,json=defaultValueNumeric" json:"default_value_numeric,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SortSpec) Reset() { *m = SortSpec{} } +func (m *SortSpec) String() string { return proto.CompactTextString(m) } +func (*SortSpec) ProtoMessage() {} +func (*SortSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{30} +} +func (m *SortSpec) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SortSpec.Unmarshal(m, b) +} +func (m *SortSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SortSpec.Marshal(b, m, deterministic) +} +func (dst *SortSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_SortSpec.Merge(dst, src) +} +func (m *SortSpec) XXX_Size() int { + return xxx_messageInfo_SortSpec.Size(m) +} +func (m *SortSpec) XXX_DiscardUnknown() { + xxx_messageInfo_SortSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_SortSpec proto.InternalMessageInfo + +const Default_SortSpec_SortDescending bool = true + +func (m *SortSpec) GetSortExpression() string { + if m != nil && m.SortExpression != nil { + return *m.SortExpression + } + return "" +} + +func (m *SortSpec) GetSortDescending() bool { + if m != nil && m.SortDescending != nil { + return *m.SortDescending + } + return Default_SortSpec_SortDescending +} + +func (m *SortSpec) GetDefaultValueText() string { + if m != nil && m.DefaultValueText != nil { + return *m.DefaultValueText + } + return "" +} + +func (m *SortSpec) GetDefaultValueNumeric() float64 { + if m != nil && m.DefaultValueNumeric != nil { + return *m.DefaultValueNumeric + } + return 0 +} + +type ScorerSpec struct { + Scorer *ScorerSpec_Scorer `protobuf:"varint,1,opt,name=scorer,enum=search.ScorerSpec_Scorer,def=2" json:"scorer,omitempty"` + Limit *int32 `protobuf:"varint,2,opt,name=limit,def=1000" json:"limit,omitempty"` + MatchScorerParameters *string `protobuf:"bytes,9,opt,name=match_scorer_parameters,json=matchScorerParameters" json:"match_scorer_parameters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ScorerSpec) Reset() { *m = ScorerSpec{} } +func (m *ScorerSpec) String() string { return proto.CompactTextString(m) } +func (*ScorerSpec) ProtoMessage() {} +func (*ScorerSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{31} +} +func (m *ScorerSpec) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ScorerSpec.Unmarshal(m, b) +} +func (m *ScorerSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ScorerSpec.Marshal(b, m, deterministic) +} +func (dst *ScorerSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_ScorerSpec.Merge(dst, src) +} +func (m *ScorerSpec) XXX_Size() int { + return xxx_messageInfo_ScorerSpec.Size(m) +} +func (m *ScorerSpec) XXX_DiscardUnknown() { + xxx_messageInfo_ScorerSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_ScorerSpec proto.InternalMessageInfo + +const Default_ScorerSpec_Scorer ScorerSpec_Scorer = ScorerSpec_MATCH_SCORER +const Default_ScorerSpec_Limit int32 = 1000 + +func (m *ScorerSpec) GetScorer() ScorerSpec_Scorer { + if m != nil && m.Scorer != nil { + return *m.Scorer + } + return Default_ScorerSpec_Scorer +} + +func (m *ScorerSpec) GetLimit() int32 { + if m != nil && m.Limit != nil { + return *m.Limit + } + return Default_ScorerSpec_Limit +} + +func (m *ScorerSpec) GetMatchScorerParameters() string { + if m != nil && m.MatchScorerParameters != nil { + return *m.MatchScorerParameters + } + return "" +} + +type FieldSpec struct { + Name []string `protobuf:"bytes,1,rep,name=name" json:"name,omitempty"` + Expression []*FieldSpec_Expression `protobuf:"group,2,rep,name=Expression,json=expression" json:"expression,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldSpec) Reset() { *m = FieldSpec{} } +func (m *FieldSpec) String() string { return proto.CompactTextString(m) } +func (*FieldSpec) ProtoMessage() {} +func (*FieldSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{32} +} +func (m *FieldSpec) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldSpec.Unmarshal(m, b) +} +func (m *FieldSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldSpec.Marshal(b, m, deterministic) +} +func (dst *FieldSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldSpec.Merge(dst, src) +} +func (m *FieldSpec) XXX_Size() int { + return xxx_messageInfo_FieldSpec.Size(m) +} +func (m *FieldSpec) XXX_DiscardUnknown() { + xxx_messageInfo_FieldSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldSpec proto.InternalMessageInfo + +func (m *FieldSpec) GetName() []string { + if m != nil { + return m.Name + } + return nil +} + +func (m *FieldSpec) GetExpression() []*FieldSpec_Expression { + if m != nil { + return m.Expression + } + return nil +} + +type FieldSpec_Expression struct { + Name *string `protobuf:"bytes,3,req,name=name" json:"name,omitempty"` + Expression *string `protobuf:"bytes,4,req,name=expression" json:"expression,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldSpec_Expression) Reset() { *m = FieldSpec_Expression{} } +func (m *FieldSpec_Expression) String() string { return proto.CompactTextString(m) } +func (*FieldSpec_Expression) ProtoMessage() {} +func (*FieldSpec_Expression) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{32, 0} +} +func (m *FieldSpec_Expression) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldSpec_Expression.Unmarshal(m, b) +} +func (m *FieldSpec_Expression) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldSpec_Expression.Marshal(b, m, deterministic) +} +func (dst *FieldSpec_Expression) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldSpec_Expression.Merge(dst, src) +} +func (m *FieldSpec_Expression) XXX_Size() int { + return xxx_messageInfo_FieldSpec_Expression.Size(m) +} +func (m *FieldSpec_Expression) XXX_DiscardUnknown() { + xxx_messageInfo_FieldSpec_Expression.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldSpec_Expression proto.InternalMessageInfo + +func (m *FieldSpec_Expression) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FieldSpec_Expression) GetExpression() string { + if m != nil && m.Expression != nil { + return *m.Expression + } + return "" +} + +type FacetRange struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Start *string `protobuf:"bytes,2,opt,name=start" json:"start,omitempty"` + End *string `protobuf:"bytes,3,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FacetRange) Reset() { *m = FacetRange{} } +func (m *FacetRange) String() string { return proto.CompactTextString(m) } +func (*FacetRange) ProtoMessage() {} +func (*FacetRange) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{33} +} +func (m *FacetRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FacetRange.Unmarshal(m, b) +} +func (m *FacetRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FacetRange.Marshal(b, m, deterministic) +} +func (dst *FacetRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_FacetRange.Merge(dst, src) +} +func (m *FacetRange) XXX_Size() int { + return xxx_messageInfo_FacetRange.Size(m) +} +func (m *FacetRange) XXX_DiscardUnknown() { + xxx_messageInfo_FacetRange.DiscardUnknown(m) +} + +var xxx_messageInfo_FacetRange proto.InternalMessageInfo + +func (m *FacetRange) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FacetRange) GetStart() string { + if m != nil && m.Start != nil { + return *m.Start + } + return "" +} + +func (m *FacetRange) GetEnd() string { + if m != nil && m.End != nil { + return *m.End + } + return "" +} + +type FacetRequestParam struct { + ValueLimit *int32 `protobuf:"varint,1,opt,name=value_limit,json=valueLimit" json:"value_limit,omitempty"` + Range []*FacetRange `protobuf:"bytes,2,rep,name=range" json:"range,omitempty"` + ValueConstraint []string `protobuf:"bytes,3,rep,name=value_constraint,json=valueConstraint" json:"value_constraint,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FacetRequestParam) Reset() { *m = FacetRequestParam{} } +func (m *FacetRequestParam) String() string { return proto.CompactTextString(m) } +func (*FacetRequestParam) ProtoMessage() {} +func (*FacetRequestParam) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{34} +} +func (m *FacetRequestParam) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FacetRequestParam.Unmarshal(m, b) +} +func (m *FacetRequestParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FacetRequestParam.Marshal(b, m, deterministic) +} +func (dst *FacetRequestParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_FacetRequestParam.Merge(dst, src) +} +func (m *FacetRequestParam) XXX_Size() int { + return xxx_messageInfo_FacetRequestParam.Size(m) +} +func (m *FacetRequestParam) XXX_DiscardUnknown() { + xxx_messageInfo_FacetRequestParam.DiscardUnknown(m) +} + +var xxx_messageInfo_FacetRequestParam proto.InternalMessageInfo + +func (m *FacetRequestParam) GetValueLimit() int32 { + if m != nil && m.ValueLimit != nil { + return *m.ValueLimit + } + return 0 +} + +func (m *FacetRequestParam) GetRange() []*FacetRange { + if m != nil { + return m.Range + } + return nil +} + +func (m *FacetRequestParam) GetValueConstraint() []string { + if m != nil { + return m.ValueConstraint + } + return nil +} + +type FacetAutoDetectParam struct { + ValueLimit *int32 `protobuf:"varint,1,opt,name=value_limit,json=valueLimit,def=10" json:"value_limit,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FacetAutoDetectParam) Reset() { *m = FacetAutoDetectParam{} } +func (m *FacetAutoDetectParam) String() string { return proto.CompactTextString(m) } +func (*FacetAutoDetectParam) ProtoMessage() {} +func (*FacetAutoDetectParam) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{35} +} +func (m *FacetAutoDetectParam) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FacetAutoDetectParam.Unmarshal(m, b) +} +func (m *FacetAutoDetectParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FacetAutoDetectParam.Marshal(b, m, deterministic) +} +func (dst *FacetAutoDetectParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_FacetAutoDetectParam.Merge(dst, src) +} +func (m *FacetAutoDetectParam) XXX_Size() int { + return xxx_messageInfo_FacetAutoDetectParam.Size(m) +} +func (m *FacetAutoDetectParam) XXX_DiscardUnknown() { + xxx_messageInfo_FacetAutoDetectParam.DiscardUnknown(m) +} + +var xxx_messageInfo_FacetAutoDetectParam proto.InternalMessageInfo + +const Default_FacetAutoDetectParam_ValueLimit int32 = 10 + +func (m *FacetAutoDetectParam) GetValueLimit() int32 { + if m != nil && m.ValueLimit != nil { + return *m.ValueLimit + } + return Default_FacetAutoDetectParam_ValueLimit +} + +type FacetRequest struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Params *FacetRequestParam `protobuf:"bytes,2,opt,name=params" json:"params,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FacetRequest) Reset() { *m = FacetRequest{} } +func (m *FacetRequest) String() string { return proto.CompactTextString(m) } +func (*FacetRequest) ProtoMessage() {} +func (*FacetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{36} +} +func (m *FacetRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FacetRequest.Unmarshal(m, b) +} +func (m *FacetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FacetRequest.Marshal(b, m, deterministic) +} +func (dst *FacetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_FacetRequest.Merge(dst, src) +} +func (m *FacetRequest) XXX_Size() int { + return xxx_messageInfo_FacetRequest.Size(m) +} +func (m *FacetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_FacetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_FacetRequest proto.InternalMessageInfo + +func (m *FacetRequest) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FacetRequest) GetParams() *FacetRequestParam { + if m != nil { + return m.Params + } + return nil +} + +type FacetRefinement struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + Range *FacetRefinement_Range `protobuf:"bytes,3,opt,name=range" json:"range,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FacetRefinement) Reset() { *m = FacetRefinement{} } +func (m *FacetRefinement) String() string { return proto.CompactTextString(m) } +func (*FacetRefinement) ProtoMessage() {} +func (*FacetRefinement) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{37} +} +func (m *FacetRefinement) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FacetRefinement.Unmarshal(m, b) +} +func (m *FacetRefinement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FacetRefinement.Marshal(b, m, deterministic) +} +func (dst *FacetRefinement) XXX_Merge(src proto.Message) { + xxx_messageInfo_FacetRefinement.Merge(dst, src) +} +func (m *FacetRefinement) XXX_Size() int { + return xxx_messageInfo_FacetRefinement.Size(m) +} +func (m *FacetRefinement) XXX_DiscardUnknown() { + xxx_messageInfo_FacetRefinement.DiscardUnknown(m) +} + +var xxx_messageInfo_FacetRefinement proto.InternalMessageInfo + +func (m *FacetRefinement) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FacetRefinement) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +func (m *FacetRefinement) GetRange() *FacetRefinement_Range { + if m != nil { + return m.Range + } + return nil +} + +type FacetRefinement_Range struct { + Start *string `protobuf:"bytes,1,opt,name=start" json:"start,omitempty"` + End *string `protobuf:"bytes,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FacetRefinement_Range) Reset() { *m = FacetRefinement_Range{} } +func (m *FacetRefinement_Range) String() string { return proto.CompactTextString(m) } +func (*FacetRefinement_Range) ProtoMessage() {} +func (*FacetRefinement_Range) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{37, 0} +} +func (m *FacetRefinement_Range) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FacetRefinement_Range.Unmarshal(m, b) +} +func (m *FacetRefinement_Range) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FacetRefinement_Range.Marshal(b, m, deterministic) +} +func (dst *FacetRefinement_Range) XXX_Merge(src proto.Message) { + xxx_messageInfo_FacetRefinement_Range.Merge(dst, src) +} +func (m *FacetRefinement_Range) XXX_Size() int { + return xxx_messageInfo_FacetRefinement_Range.Size(m) +} +func (m *FacetRefinement_Range) XXX_DiscardUnknown() { + xxx_messageInfo_FacetRefinement_Range.DiscardUnknown(m) +} + +var xxx_messageInfo_FacetRefinement_Range proto.InternalMessageInfo + +func (m *FacetRefinement_Range) GetStart() string { + if m != nil && m.Start != nil { + return *m.Start + } + return "" +} + +func (m *FacetRefinement_Range) GetEnd() string { + if m != nil && m.End != nil { + return *m.End + } + return "" +} + +type SearchParams struct { + IndexSpec *IndexSpec `protobuf:"bytes,1,req,name=index_spec,json=indexSpec" json:"index_spec,omitempty"` + Query *string `protobuf:"bytes,2,req,name=query" json:"query,omitempty"` + Cursor *string `protobuf:"bytes,4,opt,name=cursor" json:"cursor,omitempty"` + Offset *int32 `protobuf:"varint,11,opt,name=offset" json:"offset,omitempty"` + CursorType *SearchParams_CursorType `protobuf:"varint,5,opt,name=cursor_type,json=cursorType,enum=search.SearchParams_CursorType,def=0" json:"cursor_type,omitempty"` + Limit *int32 `protobuf:"varint,6,opt,name=limit,def=20" json:"limit,omitempty"` + MatchedCountAccuracy *int32 `protobuf:"varint,7,opt,name=matched_count_accuracy,json=matchedCountAccuracy" json:"matched_count_accuracy,omitempty"` + SortSpec []*SortSpec `protobuf:"bytes,8,rep,name=sort_spec,json=sortSpec" json:"sort_spec,omitempty"` + ScorerSpec *ScorerSpec `protobuf:"bytes,9,opt,name=scorer_spec,json=scorerSpec" json:"scorer_spec,omitempty"` + FieldSpec *FieldSpec `protobuf:"bytes,10,opt,name=field_spec,json=fieldSpec" json:"field_spec,omitempty"` + KeysOnly *bool `protobuf:"varint,12,opt,name=keys_only,json=keysOnly" json:"keys_only,omitempty"` + ParsingMode *SearchParams_ParsingMode `protobuf:"varint,13,opt,name=parsing_mode,json=parsingMode,enum=search.SearchParams_ParsingMode,def=0" json:"parsing_mode,omitempty"` + AutoDiscoverFacetCount *int32 `protobuf:"varint,15,opt,name=auto_discover_facet_count,json=autoDiscoverFacetCount,def=0" json:"auto_discover_facet_count,omitempty"` + IncludeFacet []*FacetRequest `protobuf:"bytes,16,rep,name=include_facet,json=includeFacet" json:"include_facet,omitempty"` + FacetRefinement []*FacetRefinement `protobuf:"bytes,17,rep,name=facet_refinement,json=facetRefinement" json:"facet_refinement,omitempty"` + FacetAutoDetectParam *FacetAutoDetectParam `protobuf:"bytes,18,opt,name=facet_auto_detect_param,json=facetAutoDetectParam" json:"facet_auto_detect_param,omitempty"` + FacetDepth *int32 `protobuf:"varint,19,opt,name=facet_depth,json=facetDepth,def=1000" json:"facet_depth,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchParams) Reset() { *m = SearchParams{} } +func (m *SearchParams) String() string { return proto.CompactTextString(m) } +func (*SearchParams) ProtoMessage() {} +func (*SearchParams) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{38} +} +func (m *SearchParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchParams.Unmarshal(m, b) +} +func (m *SearchParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchParams.Marshal(b, m, deterministic) +} +func (dst *SearchParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchParams.Merge(dst, src) +} +func (m *SearchParams) XXX_Size() int { + return xxx_messageInfo_SearchParams.Size(m) +} +func (m *SearchParams) XXX_DiscardUnknown() { + xxx_messageInfo_SearchParams.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchParams proto.InternalMessageInfo + +const Default_SearchParams_CursorType SearchParams_CursorType = SearchParams_NONE +const Default_SearchParams_Limit int32 = 20 +const Default_SearchParams_ParsingMode SearchParams_ParsingMode = SearchParams_STRICT +const Default_SearchParams_AutoDiscoverFacetCount int32 = 0 +const Default_SearchParams_FacetDepth int32 = 1000 + +func (m *SearchParams) GetIndexSpec() *IndexSpec { + if m != nil { + return m.IndexSpec + } + return nil +} + +func (m *SearchParams) GetQuery() string { + if m != nil && m.Query != nil { + return *m.Query + } + return "" +} + +func (m *SearchParams) GetCursor() string { + if m != nil && m.Cursor != nil { + return *m.Cursor + } + return "" +} + +func (m *SearchParams) GetOffset() int32 { + if m != nil && m.Offset != nil { + return *m.Offset + } + return 0 +} + +func (m *SearchParams) GetCursorType() SearchParams_CursorType { + if m != nil && m.CursorType != nil { + return *m.CursorType + } + return Default_SearchParams_CursorType +} + +func (m *SearchParams) GetLimit() int32 { + if m != nil && m.Limit != nil { + return *m.Limit + } + return Default_SearchParams_Limit +} + +func (m *SearchParams) GetMatchedCountAccuracy() int32 { + if m != nil && m.MatchedCountAccuracy != nil { + return *m.MatchedCountAccuracy + } + return 0 +} + +func (m *SearchParams) GetSortSpec() []*SortSpec { + if m != nil { + return m.SortSpec + } + return nil +} + +func (m *SearchParams) GetScorerSpec() *ScorerSpec { + if m != nil { + return m.ScorerSpec + } + return nil +} + +func (m *SearchParams) GetFieldSpec() *FieldSpec { + if m != nil { + return m.FieldSpec + } + return nil +} + +func (m *SearchParams) GetKeysOnly() bool { + if m != nil && m.KeysOnly != nil { + return *m.KeysOnly + } + return false +} + +func (m *SearchParams) GetParsingMode() SearchParams_ParsingMode { + if m != nil && m.ParsingMode != nil { + return *m.ParsingMode + } + return Default_SearchParams_ParsingMode +} + +func (m *SearchParams) GetAutoDiscoverFacetCount() int32 { + if m != nil && m.AutoDiscoverFacetCount != nil { + return *m.AutoDiscoverFacetCount + } + return Default_SearchParams_AutoDiscoverFacetCount +} + +func (m *SearchParams) GetIncludeFacet() []*FacetRequest { + if m != nil { + return m.IncludeFacet + } + return nil +} + +func (m *SearchParams) GetFacetRefinement() []*FacetRefinement { + if m != nil { + return m.FacetRefinement + } + return nil +} + +func (m *SearchParams) GetFacetAutoDetectParam() *FacetAutoDetectParam { + if m != nil { + return m.FacetAutoDetectParam + } + return nil +} + +func (m *SearchParams) GetFacetDepth() int32 { + if m != nil && m.FacetDepth != nil { + return *m.FacetDepth + } + return Default_SearchParams_FacetDepth +} + +type SearchRequest struct { + Params *SearchParams `protobuf:"bytes,1,req,name=params" json:"params,omitempty"` + AppId []byte `protobuf:"bytes,3,opt,name=app_id,json=appId" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchRequest) Reset() { *m = SearchRequest{} } +func (m *SearchRequest) String() string { return proto.CompactTextString(m) } +func (*SearchRequest) ProtoMessage() {} +func (*SearchRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{39} +} +func (m *SearchRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchRequest.Unmarshal(m, b) +} +func (m *SearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchRequest.Marshal(b, m, deterministic) +} +func (dst *SearchRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchRequest.Merge(dst, src) +} +func (m *SearchRequest) XXX_Size() int { + return xxx_messageInfo_SearchRequest.Size(m) +} +func (m *SearchRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SearchRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchRequest proto.InternalMessageInfo + +func (m *SearchRequest) GetParams() *SearchParams { + if m != nil { + return m.Params + } + return nil +} + +func (m *SearchRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +type FacetResultValue struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Count *int32 `protobuf:"varint,2,req,name=count" json:"count,omitempty"` + Refinement *FacetRefinement `protobuf:"bytes,3,req,name=refinement" json:"refinement,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FacetResultValue) Reset() { *m = FacetResultValue{} } +func (m *FacetResultValue) String() string { return proto.CompactTextString(m) } +func (*FacetResultValue) ProtoMessage() {} +func (*FacetResultValue) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{40} +} +func (m *FacetResultValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FacetResultValue.Unmarshal(m, b) +} +func (m *FacetResultValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FacetResultValue.Marshal(b, m, deterministic) +} +func (dst *FacetResultValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_FacetResultValue.Merge(dst, src) +} +func (m *FacetResultValue) XXX_Size() int { + return xxx_messageInfo_FacetResultValue.Size(m) +} +func (m *FacetResultValue) XXX_DiscardUnknown() { + xxx_messageInfo_FacetResultValue.DiscardUnknown(m) +} + +var xxx_messageInfo_FacetResultValue proto.InternalMessageInfo + +func (m *FacetResultValue) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FacetResultValue) GetCount() int32 { + if m != nil && m.Count != nil { + return *m.Count + } + return 0 +} + +func (m *FacetResultValue) GetRefinement() *FacetRefinement { + if m != nil { + return m.Refinement + } + return nil +} + +type FacetResult struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + Value []*FacetResultValue `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FacetResult) Reset() { *m = FacetResult{} } +func (m *FacetResult) String() string { return proto.CompactTextString(m) } +func (*FacetResult) ProtoMessage() {} +func (*FacetResult) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{41} +} +func (m *FacetResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FacetResult.Unmarshal(m, b) +} +func (m *FacetResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FacetResult.Marshal(b, m, deterministic) +} +func (dst *FacetResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_FacetResult.Merge(dst, src) +} +func (m *FacetResult) XXX_Size() int { + return xxx_messageInfo_FacetResult.Size(m) +} +func (m *FacetResult) XXX_DiscardUnknown() { + xxx_messageInfo_FacetResult.DiscardUnknown(m) +} + +var xxx_messageInfo_FacetResult proto.InternalMessageInfo + +func (m *FacetResult) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FacetResult) GetValue() []*FacetResultValue { + if m != nil { + return m.Value + } + return nil +} + +type SearchResult struct { + Document *Document `protobuf:"bytes,1,req,name=document" json:"document,omitempty"` + Expression []*Field `protobuf:"bytes,4,rep,name=expression" json:"expression,omitempty"` + Score []float64 `protobuf:"fixed64,2,rep,name=score" json:"score,omitempty"` + Cursor *string `protobuf:"bytes,3,opt,name=cursor" json:"cursor,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchResult) Reset() { *m = SearchResult{} } +func (m *SearchResult) String() string { return proto.CompactTextString(m) } +func (*SearchResult) ProtoMessage() {} +func (*SearchResult) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{42} +} +func (m *SearchResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchResult.Unmarshal(m, b) +} +func (m *SearchResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchResult.Marshal(b, m, deterministic) +} +func (dst *SearchResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchResult.Merge(dst, src) +} +func (m *SearchResult) XXX_Size() int { + return xxx_messageInfo_SearchResult.Size(m) +} +func (m *SearchResult) XXX_DiscardUnknown() { + xxx_messageInfo_SearchResult.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchResult proto.InternalMessageInfo + +func (m *SearchResult) GetDocument() *Document { + if m != nil { + return m.Document + } + return nil +} + +func (m *SearchResult) GetExpression() []*Field { + if m != nil { + return m.Expression + } + return nil +} + +func (m *SearchResult) GetScore() []float64 { + if m != nil { + return m.Score + } + return nil +} + +func (m *SearchResult) GetCursor() string { + if m != nil && m.Cursor != nil { + return *m.Cursor + } + return "" +} + +type SearchResponse struct { + Result []*SearchResult `protobuf:"bytes,1,rep,name=result" json:"result,omitempty"` + MatchedCount *int64 `protobuf:"varint,2,req,name=matched_count,json=matchedCount" json:"matched_count,omitempty"` + Status *RequestStatus `protobuf:"bytes,3,req,name=status" json:"status,omitempty"` + Cursor *string `protobuf:"bytes,4,opt,name=cursor" json:"cursor,omitempty"` + FacetResult []*FacetResult `protobuf:"bytes,5,rep,name=facet_result,json=facetResult" json:"facet_result,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchResponse) Reset() { *m = SearchResponse{} } +func (m *SearchResponse) String() string { return proto.CompactTextString(m) } +func (*SearchResponse) ProtoMessage() {} +func (*SearchResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_search_78ae5a87590ff3d8, []int{43} +} + +var extRange_SearchResponse = []proto.ExtensionRange{ + {Start: 1000, End: 9999}, +} + +func (*SearchResponse) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_SearchResponse +} +func (m *SearchResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchResponse.Unmarshal(m, b) +} +func (m *SearchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchResponse.Marshal(b, m, deterministic) +} +func (dst *SearchResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchResponse.Merge(dst, src) +} +func (m *SearchResponse) XXX_Size() int { + return xxx_messageInfo_SearchResponse.Size(m) +} +func (m *SearchResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SearchResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchResponse proto.InternalMessageInfo + +func (m *SearchResponse) GetResult() []*SearchResult { + if m != nil { + return m.Result + } + return nil +} + +func (m *SearchResponse) GetMatchedCount() int64 { + if m != nil && m.MatchedCount != nil { + return *m.MatchedCount + } + return 0 +} + +func (m *SearchResponse) GetStatus() *RequestStatus { + if m != nil { + return m.Status + } + return nil +} + +func (m *SearchResponse) GetCursor() string { + if m != nil && m.Cursor != nil { + return *m.Cursor + } + return "" +} + +func (m *SearchResponse) GetFacetResult() []*FacetResult { + if m != nil { + return m.FacetResult + } + return nil +} + +func init() { + proto.RegisterType((*Scope)(nil), "search.Scope") + proto.RegisterType((*Entry)(nil), "search.Entry") + proto.RegisterType((*AccessControlList)(nil), "search.AccessControlList") + proto.RegisterType((*FieldValue)(nil), "search.FieldValue") + proto.RegisterType((*FieldValue_Geo)(nil), "search.FieldValue.Geo") + proto.RegisterType((*Field)(nil), "search.Field") + proto.RegisterType((*FieldTypes)(nil), "search.FieldTypes") + proto.RegisterType((*IndexShardSettings)(nil), "search.IndexShardSettings") + proto.RegisterType((*FacetValue)(nil), "search.FacetValue") + proto.RegisterType((*Facet)(nil), "search.Facet") + proto.RegisterType((*DocumentMetadata)(nil), "search.DocumentMetadata") + proto.RegisterType((*Document)(nil), "search.Document") + proto.RegisterType((*SearchServiceError)(nil), "search.SearchServiceError") + proto.RegisterType((*RequestStatus)(nil), "search.RequestStatus") + proto.RegisterType((*IndexSpec)(nil), "search.IndexSpec") + proto.RegisterType((*IndexMetadata)(nil), "search.IndexMetadata") + proto.RegisterType((*IndexMetadata_Storage)(nil), "search.IndexMetadata.Storage") + proto.RegisterType((*IndexDocumentParams)(nil), "search.IndexDocumentParams") + proto.RegisterType((*IndexDocumentRequest)(nil), "search.IndexDocumentRequest") + proto.RegisterType((*IndexDocumentResponse)(nil), "search.IndexDocumentResponse") + proto.RegisterType((*DeleteDocumentParams)(nil), "search.DeleteDocumentParams") + proto.RegisterType((*DeleteDocumentRequest)(nil), "search.DeleteDocumentRequest") + proto.RegisterType((*DeleteDocumentResponse)(nil), "search.DeleteDocumentResponse") + proto.RegisterType((*ListDocumentsParams)(nil), "search.ListDocumentsParams") + proto.RegisterType((*ListDocumentsRequest)(nil), "search.ListDocumentsRequest") + proto.RegisterType((*ListDocumentsResponse)(nil), "search.ListDocumentsResponse") + proto.RegisterType((*ListIndexesParams)(nil), "search.ListIndexesParams") + proto.RegisterType((*ListIndexesRequest)(nil), "search.ListIndexesRequest") + proto.RegisterType((*ListIndexesResponse)(nil), "search.ListIndexesResponse") + proto.RegisterType((*DeleteSchemaParams)(nil), "search.DeleteSchemaParams") + proto.RegisterType((*DeleteSchemaRequest)(nil), "search.DeleteSchemaRequest") + proto.RegisterType((*DeleteSchemaResponse)(nil), "search.DeleteSchemaResponse") + proto.RegisterType((*SortSpec)(nil), "search.SortSpec") + proto.RegisterType((*ScorerSpec)(nil), "search.ScorerSpec") + proto.RegisterType((*FieldSpec)(nil), "search.FieldSpec") + proto.RegisterType((*FieldSpec_Expression)(nil), "search.FieldSpec.Expression") + proto.RegisterType((*FacetRange)(nil), "search.FacetRange") + proto.RegisterType((*FacetRequestParam)(nil), "search.FacetRequestParam") + proto.RegisterType((*FacetAutoDetectParam)(nil), "search.FacetAutoDetectParam") + proto.RegisterType((*FacetRequest)(nil), "search.FacetRequest") + proto.RegisterType((*FacetRefinement)(nil), "search.FacetRefinement") + proto.RegisterType((*FacetRefinement_Range)(nil), "search.FacetRefinement.Range") + proto.RegisterType((*SearchParams)(nil), "search.SearchParams") + proto.RegisterType((*SearchRequest)(nil), "search.SearchRequest") + proto.RegisterType((*FacetResultValue)(nil), "search.FacetResultValue") + proto.RegisterType((*FacetResult)(nil), "search.FacetResult") + proto.RegisterType((*SearchResult)(nil), "search.SearchResult") + proto.RegisterType((*SearchResponse)(nil), "search.SearchResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/search/search.proto", fileDescriptor_search_78ae5a87590ff3d8) +} + +var fileDescriptor_search_78ae5a87590ff3d8 = []byte{ + // 2994 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x59, 0x4f, 0x73, 0x1b, 0xc7, + 0x95, 0xe7, 0x0c, 0x08, 0x10, 0x78, 0x20, 0xc8, 0x61, 0xf3, 0x8f, 0x20, 0x59, 0x6b, 0xd3, 0x23, + 0xcb, 0xa6, 0xbd, 0x12, 0x45, 0x51, 0x2a, 0x5b, 0xcb, 0x75, 0xed, 0x1a, 0x02, 0x46, 0x14, 0x56, + 0x20, 0x40, 0x37, 0x06, 0xb2, 0xb5, 0x55, 0xeb, 0xd9, 0xc9, 0x4c, 0x13, 0x9a, 0x0a, 0x30, 0x03, + 0xcf, 0x0c, 0x14, 0xf1, 0x96, 0xf2, 0x2d, 0x97, 0x54, 0x52, 0x39, 0xe5, 0x94, 0x72, 0xe5, 0x92, + 0xca, 0x35, 0xf7, 0x9c, 0x92, 0x5b, 0x6e, 0x39, 0xe5, 0x0b, 0xa4, 0x52, 0x49, 0x55, 0x3e, 0x43, + 0xaa, 0x5f, 0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 0x9d, + 0x8a, 0x0f, 0xf2, 0x09, 0x40, 0x06, 0x29, 0x71, 0xcd, 0x7f, 0x25, 0x52, 0x19, 0x55, 0xfd, 0x73, + 0xa8, 0x66, 0x96, 0x5d, 0xb8, 0xe2, 0xfe, 0x8c, 0x21, 0x79, 0x02, 0xd4, 0xe7, 0xcc, 0xa6, 0xee, + 0x26, 0xef, 0xd5, 0xbf, 0x54, 0x12, 0x56, 0x93, 0x46, 0xf3, 0x2f, 0x21, 0xea, 0x25, 0x2f, 0x21, + 0xb7, 0xe7, 0x8e, 0xd0, 0x05, 0xcf, 0xca, 0x19, 0x05, 0xe4, 0x5a, 0x5e, 0xcc, 0xe8, 0x9d, 0x42, + 0xc5, 0x47, 0x86, 0x00, 0x0b, 0x59, 0x02, 0xd4, 0xff, 0xae, 0xc0, 0x5a, 0xea, 0x9b, 0x68, 0x03, + 0x6f, 0x41, 0x29, 0x44, 0x3f, 0x65, 0x1b, 0x38, 0x87, 0x9e, 0xd8, 0x03, 0x95, 0x3a, 0xe4, 0x06, + 0xd4, 0x72, 0x3c, 0x86, 0x30, 0x14, 0xe8, 0x6a, 0x96, 0xbe, 0x32, 0x9d, 0x65, 0xe1, 0xfb, 0xf4, + 0xf0, 0xaf, 0x62, 0xeb, 0x8f, 0x61, 0x35, 0x29, 0x42, 0xf4, 0xaf, 0x88, 0xfe, 0x6d, 0x2e, 0x88, + 0x3f, 0xad, 0x9e, 0xcd, 0x3e, 0x3e, 0x2a, 0x95, 0xff, 0xb6, 0xa2, 0xfd, 0xac, 0xfb, 0xb0, 0xfc, + 0xbf, 0xf2, 0xff, 0xb5, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x09, 0x6f, 0x4d, 0x63, 0xf2, 0x1d, + 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/search/search.proto b/vendor/google.golang.org/appengine/internal/search/search.proto new file mode 100644 index 000000000..61df6508b --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/search/search.proto @@ -0,0 +1,394 @@ +syntax = "proto2"; +option go_package = "search"; + +package search; + +message Scope { + enum Type { + USER_BY_CANONICAL_ID = 1; + USER_BY_EMAIL = 2; + GROUP_BY_CANONICAL_ID = 3; + GROUP_BY_EMAIL = 4; + GROUP_BY_DOMAIN = 5; + ALL_USERS = 6; + ALL_AUTHENTICATED_USERS = 7; + } + + optional Type type = 1; + optional string value = 2; +} + +message Entry { + enum Permission { + READ = 1; + WRITE = 2; + FULL_CONTROL = 3; + } + + optional Scope scope = 1; + optional Permission permission = 2; + optional string display_name = 3; +} + +message AccessControlList { + optional string owner = 1; + repeated Entry entries = 2; +} + +message FieldValue { + enum ContentType { + TEXT = 0; + HTML = 1; + ATOM = 2; + DATE = 3; + NUMBER = 4; + GEO = 5; + } + + optional ContentType type = 1 [default = TEXT]; + + optional string language = 2 [default = "en"]; + + optional string string_value = 3; + + optional group Geo = 4 { + required double lat = 5; + required double lng = 6; + } +} + +message Field { + required string name = 1; + required FieldValue value = 2; +} + +message FieldTypes { + required string name = 1; + repeated FieldValue.ContentType type = 2; +} + +message IndexShardSettings { + repeated int32 prev_num_shards = 1; + required int32 num_shards = 2 [default=1]; + repeated int32 prev_num_shards_search_false = 3; + optional string local_replica = 4 [default = ""]; +} + +message FacetValue { + enum ContentType { + ATOM = 2; + NUMBER = 4; + } + + optional ContentType type = 1 [default = ATOM]; + optional string string_value = 3; +} + +message Facet { + required string name = 1; + required FacetValue value = 2; +} + +message DocumentMetadata { + optional int64 version = 1; + optional int64 committed_st_version = 2; +} + +message Document { + optional string id = 1; + optional string language = 2 [default = "en"]; + repeated Field field = 3; + optional int32 order_id = 4; + optional OrderIdSource order_id_source = 6 [default = SUPPLIED]; + + enum OrderIdSource { + DEFAULTED = 0; + SUPPLIED = 1; + } + + enum Storage { + DISK = 0; + } + + optional Storage storage = 5 [default = DISK]; + repeated Facet facet = 8; +} + +message SearchServiceError { + enum ErrorCode { + OK = 0; + INVALID_REQUEST = 1; + TRANSIENT_ERROR = 2; + INTERNAL_ERROR = 3; + PERMISSION_DENIED = 4; + TIMEOUT = 5; + CONCURRENT_TRANSACTION = 6; + } +} + +message RequestStatus { + required SearchServiceError.ErrorCode code = 1; + optional string error_detail = 2; + optional int32 canonical_code = 3; +} + +message IndexSpec { + required string name = 1; + + enum Consistency { + GLOBAL = 0; + PER_DOCUMENT = 1; + } + optional Consistency consistency = 2 [default = PER_DOCUMENT]; + + optional string namespace = 3; + optional int32 version = 4; + + enum Source { + SEARCH = 0; + DATASTORE = 1; + CLOUD_STORAGE = 2; + } + optional Source source = 5 [default = SEARCH]; + + enum Mode { + PRIORITY = 0; + BACKGROUND = 1; + } + optional Mode mode = 6 [default = PRIORITY]; +} + +message IndexMetadata { + required IndexSpec index_spec = 1; + + repeated FieldTypes field = 2; + + message Storage { + optional int64 amount_used = 1; + optional int64 limit = 2; + } + optional Storage storage = 3; +} + +message IndexDocumentParams { + repeated Document document = 1; + + enum Freshness { + SYNCHRONOUSLY = 0; + WHEN_CONVENIENT = 1; + } + optional Freshness freshness = 2 [default = SYNCHRONOUSLY, deprecated=true]; + + required IndexSpec index_spec = 3; +} + +message IndexDocumentRequest { + required IndexDocumentParams params = 1; + + optional bytes app_id = 3; +} + +message IndexDocumentResponse { + repeated RequestStatus status = 1; + + repeated string doc_id = 2; +} + +message DeleteDocumentParams { + repeated string doc_id = 1; + + required IndexSpec index_spec = 2; +} + +message DeleteDocumentRequest { + required DeleteDocumentParams params = 1; + + optional bytes app_id = 3; +} + +message DeleteDocumentResponse { + repeated RequestStatus status = 1; +} + +message ListDocumentsParams { + required IndexSpec index_spec = 1; + optional string start_doc_id = 2; + optional bool include_start_doc = 3 [default = true]; + optional int32 limit = 4 [default = 100]; + optional bool keys_only = 5; +} + +message ListDocumentsRequest { + required ListDocumentsParams params = 1; + + optional bytes app_id = 2; +} + +message ListDocumentsResponse { + required RequestStatus status = 1; + + repeated Document document = 2; +} + +message ListIndexesParams { + optional bool fetch_schema = 1; + optional int32 limit = 2 [default = 20]; + optional string namespace = 3; + optional string start_index_name = 4; + optional bool include_start_index = 5 [default = true]; + optional string index_name_prefix = 6; + optional int32 offset = 7; + optional IndexSpec.Source source = 8 [default = SEARCH]; +} + +message ListIndexesRequest { + required ListIndexesParams params = 1; + + optional bytes app_id = 3; +} + +message ListIndexesResponse { + required RequestStatus status = 1; + repeated IndexMetadata index_metadata = 2; +} + +message DeleteSchemaParams { + optional IndexSpec.Source source = 1 [default = SEARCH]; + repeated IndexSpec index_spec = 2; +} + +message DeleteSchemaRequest { + required DeleteSchemaParams params = 1; + + optional bytes app_id = 3; +} + +message DeleteSchemaResponse { + repeated RequestStatus status = 1; +} + +message SortSpec { + required string sort_expression = 1; + optional bool sort_descending = 2 [default = true]; + optional string default_value_text = 4; + optional double default_value_numeric = 5; +} + +message ScorerSpec { + enum Scorer { + RESCORING_MATCH_SCORER = 0; + MATCH_SCORER = 2; + } + optional Scorer scorer = 1 [default = MATCH_SCORER]; + + optional int32 limit = 2 [default = 1000]; + optional string match_scorer_parameters = 9; +} + +message FieldSpec { + repeated string name = 1; + + repeated group Expression = 2 { + required string name = 3; + required string expression = 4; + } +} + +message FacetRange { + optional string name = 1; + optional string start = 2; + optional string end = 3; +} + +message FacetRequestParam { + optional int32 value_limit = 1; + repeated FacetRange range = 2; + repeated string value_constraint = 3; +} + +message FacetAutoDetectParam { + optional int32 value_limit = 1 [default = 10]; +} + +message FacetRequest { + required string name = 1; + optional FacetRequestParam params = 2; +} + +message FacetRefinement { + required string name = 1; + optional string value = 2; + + message Range { + optional string start = 1; + optional string end = 2; + } + optional Range range = 3; +} + +message SearchParams { + required IndexSpec index_spec = 1; + required string query = 2; + optional string cursor = 4; + optional int32 offset = 11; + + enum CursorType { + NONE = 0; + SINGLE = 1; + PER_RESULT = 2; + } + optional CursorType cursor_type = 5 [default = NONE]; + + optional int32 limit = 6 [default = 20]; + optional int32 matched_count_accuracy = 7; + repeated SortSpec sort_spec = 8; + optional ScorerSpec scorer_spec = 9; + optional FieldSpec field_spec = 10; + optional bool keys_only = 12; + + enum ParsingMode { + STRICT = 0; + RELAXED = 1; + } + optional ParsingMode parsing_mode = 13 [default = STRICT]; + + optional int32 auto_discover_facet_count = 15 [default = 0]; + repeated FacetRequest include_facet = 16; + repeated FacetRefinement facet_refinement = 17; + optional FacetAutoDetectParam facet_auto_detect_param = 18; + optional int32 facet_depth = 19 [default=1000]; +} + +message SearchRequest { + required SearchParams params = 1; + + optional bytes app_id = 3; +} + +message FacetResultValue { + required string name = 1; + required int32 count = 2; + required FacetRefinement refinement = 3; +} + +message FacetResult { + required string name = 1; + repeated FacetResultValue value = 2; +} + +message SearchResult { + required Document document = 1; + repeated Field expression = 4; + repeated double score = 2; + optional string cursor = 3; +} + +message SearchResponse { + repeated SearchResult result = 1; + required int64 matched_count = 2; + required RequestStatus status = 3; + optional string cursor = 4; + repeated FacetResult facet_result = 5; + + extensions 1000 to 9999; +} diff --git a/vendor/google.golang.org/appengine/internal/socket/socket_service.pb.go b/vendor/google.golang.org/appengine/internal/socket/socket_service.pb.go new file mode 100644 index 000000000..4ec872e46 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/socket/socket_service.pb.go @@ -0,0 +1,2822 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/socket/socket_service.proto + +package socket + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type RemoteSocketServiceError_ErrorCode int32 + +const ( + RemoteSocketServiceError_SYSTEM_ERROR RemoteSocketServiceError_ErrorCode = 1 + RemoteSocketServiceError_GAI_ERROR RemoteSocketServiceError_ErrorCode = 2 + RemoteSocketServiceError_FAILURE RemoteSocketServiceError_ErrorCode = 4 + RemoteSocketServiceError_PERMISSION_DENIED RemoteSocketServiceError_ErrorCode = 5 + RemoteSocketServiceError_INVALID_REQUEST RemoteSocketServiceError_ErrorCode = 6 + RemoteSocketServiceError_SOCKET_CLOSED RemoteSocketServiceError_ErrorCode = 7 +) + +var RemoteSocketServiceError_ErrorCode_name = map[int32]string{ + 1: "SYSTEM_ERROR", + 2: "GAI_ERROR", + 4: "FAILURE", + 5: "PERMISSION_DENIED", + 6: "INVALID_REQUEST", + 7: "SOCKET_CLOSED", +} +var RemoteSocketServiceError_ErrorCode_value = map[string]int32{ + "SYSTEM_ERROR": 1, + "GAI_ERROR": 2, + "FAILURE": 4, + "PERMISSION_DENIED": 5, + "INVALID_REQUEST": 6, + "SOCKET_CLOSED": 7, +} + +func (x RemoteSocketServiceError_ErrorCode) Enum() *RemoteSocketServiceError_ErrorCode { + p := new(RemoteSocketServiceError_ErrorCode) + *p = x + return p +} +func (x RemoteSocketServiceError_ErrorCode) String() string { + return proto.EnumName(RemoteSocketServiceError_ErrorCode_name, int32(x)) +} +func (x *RemoteSocketServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(RemoteSocketServiceError_ErrorCode_value, data, "RemoteSocketServiceError_ErrorCode") + if err != nil { + return err + } + *x = RemoteSocketServiceError_ErrorCode(value) + return nil +} +func (RemoteSocketServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{0, 0} +} + +type RemoteSocketServiceError_SystemError int32 + +const ( + RemoteSocketServiceError_SYS_SUCCESS RemoteSocketServiceError_SystemError = 0 + RemoteSocketServiceError_SYS_EPERM RemoteSocketServiceError_SystemError = 1 + RemoteSocketServiceError_SYS_ENOENT RemoteSocketServiceError_SystemError = 2 + RemoteSocketServiceError_SYS_ESRCH RemoteSocketServiceError_SystemError = 3 + RemoteSocketServiceError_SYS_EINTR RemoteSocketServiceError_SystemError = 4 + RemoteSocketServiceError_SYS_EIO RemoteSocketServiceError_SystemError = 5 + RemoteSocketServiceError_SYS_ENXIO RemoteSocketServiceError_SystemError = 6 + RemoteSocketServiceError_SYS_E2BIG RemoteSocketServiceError_SystemError = 7 + RemoteSocketServiceError_SYS_ENOEXEC RemoteSocketServiceError_SystemError = 8 + RemoteSocketServiceError_SYS_EBADF RemoteSocketServiceError_SystemError = 9 + RemoteSocketServiceError_SYS_ECHILD RemoteSocketServiceError_SystemError = 10 + RemoteSocketServiceError_SYS_EAGAIN RemoteSocketServiceError_SystemError = 11 + RemoteSocketServiceError_SYS_EWOULDBLOCK RemoteSocketServiceError_SystemError = 11 + RemoteSocketServiceError_SYS_ENOMEM RemoteSocketServiceError_SystemError = 12 + RemoteSocketServiceError_SYS_EACCES RemoteSocketServiceError_SystemError = 13 + RemoteSocketServiceError_SYS_EFAULT RemoteSocketServiceError_SystemError = 14 + RemoteSocketServiceError_SYS_ENOTBLK RemoteSocketServiceError_SystemError = 15 + RemoteSocketServiceError_SYS_EBUSY RemoteSocketServiceError_SystemError = 16 + RemoteSocketServiceError_SYS_EEXIST RemoteSocketServiceError_SystemError = 17 + RemoteSocketServiceError_SYS_EXDEV RemoteSocketServiceError_SystemError = 18 + RemoteSocketServiceError_SYS_ENODEV RemoteSocketServiceError_SystemError = 19 + RemoteSocketServiceError_SYS_ENOTDIR RemoteSocketServiceError_SystemError = 20 + RemoteSocketServiceError_SYS_EISDIR RemoteSocketServiceError_SystemError = 21 + RemoteSocketServiceError_SYS_EINVAL RemoteSocketServiceError_SystemError = 22 + RemoteSocketServiceError_SYS_ENFILE RemoteSocketServiceError_SystemError = 23 + RemoteSocketServiceError_SYS_EMFILE RemoteSocketServiceError_SystemError = 24 + RemoteSocketServiceError_SYS_ENOTTY RemoteSocketServiceError_SystemError = 25 + RemoteSocketServiceError_SYS_ETXTBSY RemoteSocketServiceError_SystemError = 26 + RemoteSocketServiceError_SYS_EFBIG RemoteSocketServiceError_SystemError = 27 + RemoteSocketServiceError_SYS_ENOSPC RemoteSocketServiceError_SystemError = 28 + RemoteSocketServiceError_SYS_ESPIPE RemoteSocketServiceError_SystemError = 29 + RemoteSocketServiceError_SYS_EROFS RemoteSocketServiceError_SystemError = 30 + RemoteSocketServiceError_SYS_EMLINK RemoteSocketServiceError_SystemError = 31 + RemoteSocketServiceError_SYS_EPIPE RemoteSocketServiceError_SystemError = 32 + RemoteSocketServiceError_SYS_EDOM RemoteSocketServiceError_SystemError = 33 + RemoteSocketServiceError_SYS_ERANGE RemoteSocketServiceError_SystemError = 34 + RemoteSocketServiceError_SYS_EDEADLK RemoteSocketServiceError_SystemError = 35 + RemoteSocketServiceError_SYS_EDEADLOCK RemoteSocketServiceError_SystemError = 35 + RemoteSocketServiceError_SYS_ENAMETOOLONG RemoteSocketServiceError_SystemError = 36 + RemoteSocketServiceError_SYS_ENOLCK RemoteSocketServiceError_SystemError = 37 + RemoteSocketServiceError_SYS_ENOSYS RemoteSocketServiceError_SystemError = 38 + RemoteSocketServiceError_SYS_ENOTEMPTY RemoteSocketServiceError_SystemError = 39 + RemoteSocketServiceError_SYS_ELOOP RemoteSocketServiceError_SystemError = 40 + RemoteSocketServiceError_SYS_ENOMSG RemoteSocketServiceError_SystemError = 42 + RemoteSocketServiceError_SYS_EIDRM RemoteSocketServiceError_SystemError = 43 + RemoteSocketServiceError_SYS_ECHRNG RemoteSocketServiceError_SystemError = 44 + RemoteSocketServiceError_SYS_EL2NSYNC RemoteSocketServiceError_SystemError = 45 + RemoteSocketServiceError_SYS_EL3HLT RemoteSocketServiceError_SystemError = 46 + RemoteSocketServiceError_SYS_EL3RST RemoteSocketServiceError_SystemError = 47 + RemoteSocketServiceError_SYS_ELNRNG RemoteSocketServiceError_SystemError = 48 + RemoteSocketServiceError_SYS_EUNATCH RemoteSocketServiceError_SystemError = 49 + RemoteSocketServiceError_SYS_ENOCSI RemoteSocketServiceError_SystemError = 50 + RemoteSocketServiceError_SYS_EL2HLT RemoteSocketServiceError_SystemError = 51 + RemoteSocketServiceError_SYS_EBADE RemoteSocketServiceError_SystemError = 52 + RemoteSocketServiceError_SYS_EBADR RemoteSocketServiceError_SystemError = 53 + RemoteSocketServiceError_SYS_EXFULL RemoteSocketServiceError_SystemError = 54 + RemoteSocketServiceError_SYS_ENOANO RemoteSocketServiceError_SystemError = 55 + RemoteSocketServiceError_SYS_EBADRQC RemoteSocketServiceError_SystemError = 56 + RemoteSocketServiceError_SYS_EBADSLT RemoteSocketServiceError_SystemError = 57 + RemoteSocketServiceError_SYS_EBFONT RemoteSocketServiceError_SystemError = 59 + RemoteSocketServiceError_SYS_ENOSTR RemoteSocketServiceError_SystemError = 60 + RemoteSocketServiceError_SYS_ENODATA RemoteSocketServiceError_SystemError = 61 + RemoteSocketServiceError_SYS_ETIME RemoteSocketServiceError_SystemError = 62 + RemoteSocketServiceError_SYS_ENOSR RemoteSocketServiceError_SystemError = 63 + RemoteSocketServiceError_SYS_ENONET RemoteSocketServiceError_SystemError = 64 + RemoteSocketServiceError_SYS_ENOPKG RemoteSocketServiceError_SystemError = 65 + RemoteSocketServiceError_SYS_EREMOTE RemoteSocketServiceError_SystemError = 66 + RemoteSocketServiceError_SYS_ENOLINK RemoteSocketServiceError_SystemError = 67 + RemoteSocketServiceError_SYS_EADV RemoteSocketServiceError_SystemError = 68 + RemoteSocketServiceError_SYS_ESRMNT RemoteSocketServiceError_SystemError = 69 + RemoteSocketServiceError_SYS_ECOMM RemoteSocketServiceError_SystemError = 70 + RemoteSocketServiceError_SYS_EPROTO RemoteSocketServiceError_SystemError = 71 + RemoteSocketServiceError_SYS_EMULTIHOP RemoteSocketServiceError_SystemError = 72 + RemoteSocketServiceError_SYS_EDOTDOT RemoteSocketServiceError_SystemError = 73 + RemoteSocketServiceError_SYS_EBADMSG RemoteSocketServiceError_SystemError = 74 + RemoteSocketServiceError_SYS_EOVERFLOW RemoteSocketServiceError_SystemError = 75 + RemoteSocketServiceError_SYS_ENOTUNIQ RemoteSocketServiceError_SystemError = 76 + RemoteSocketServiceError_SYS_EBADFD RemoteSocketServiceError_SystemError = 77 + RemoteSocketServiceError_SYS_EREMCHG RemoteSocketServiceError_SystemError = 78 + RemoteSocketServiceError_SYS_ELIBACC RemoteSocketServiceError_SystemError = 79 + RemoteSocketServiceError_SYS_ELIBBAD RemoteSocketServiceError_SystemError = 80 + RemoteSocketServiceError_SYS_ELIBSCN RemoteSocketServiceError_SystemError = 81 + RemoteSocketServiceError_SYS_ELIBMAX RemoteSocketServiceError_SystemError = 82 + RemoteSocketServiceError_SYS_ELIBEXEC RemoteSocketServiceError_SystemError = 83 + RemoteSocketServiceError_SYS_EILSEQ RemoteSocketServiceError_SystemError = 84 + RemoteSocketServiceError_SYS_ERESTART RemoteSocketServiceError_SystemError = 85 + RemoteSocketServiceError_SYS_ESTRPIPE RemoteSocketServiceError_SystemError = 86 + RemoteSocketServiceError_SYS_EUSERS RemoteSocketServiceError_SystemError = 87 + RemoteSocketServiceError_SYS_ENOTSOCK RemoteSocketServiceError_SystemError = 88 + RemoteSocketServiceError_SYS_EDESTADDRREQ RemoteSocketServiceError_SystemError = 89 + RemoteSocketServiceError_SYS_EMSGSIZE RemoteSocketServiceError_SystemError = 90 + RemoteSocketServiceError_SYS_EPROTOTYPE RemoteSocketServiceError_SystemError = 91 + RemoteSocketServiceError_SYS_ENOPROTOOPT RemoteSocketServiceError_SystemError = 92 + RemoteSocketServiceError_SYS_EPROTONOSUPPORT RemoteSocketServiceError_SystemError = 93 + RemoteSocketServiceError_SYS_ESOCKTNOSUPPORT RemoteSocketServiceError_SystemError = 94 + RemoteSocketServiceError_SYS_EOPNOTSUPP RemoteSocketServiceError_SystemError = 95 + RemoteSocketServiceError_SYS_ENOTSUP RemoteSocketServiceError_SystemError = 95 + RemoteSocketServiceError_SYS_EPFNOSUPPORT RemoteSocketServiceError_SystemError = 96 + RemoteSocketServiceError_SYS_EAFNOSUPPORT RemoteSocketServiceError_SystemError = 97 + RemoteSocketServiceError_SYS_EADDRINUSE RemoteSocketServiceError_SystemError = 98 + RemoteSocketServiceError_SYS_EADDRNOTAVAIL RemoteSocketServiceError_SystemError = 99 + RemoteSocketServiceError_SYS_ENETDOWN RemoteSocketServiceError_SystemError = 100 + RemoteSocketServiceError_SYS_ENETUNREACH RemoteSocketServiceError_SystemError = 101 + RemoteSocketServiceError_SYS_ENETRESET RemoteSocketServiceError_SystemError = 102 + RemoteSocketServiceError_SYS_ECONNABORTED RemoteSocketServiceError_SystemError = 103 + RemoteSocketServiceError_SYS_ECONNRESET RemoteSocketServiceError_SystemError = 104 + RemoteSocketServiceError_SYS_ENOBUFS RemoteSocketServiceError_SystemError = 105 + RemoteSocketServiceError_SYS_EISCONN RemoteSocketServiceError_SystemError = 106 + RemoteSocketServiceError_SYS_ENOTCONN RemoteSocketServiceError_SystemError = 107 + RemoteSocketServiceError_SYS_ESHUTDOWN RemoteSocketServiceError_SystemError = 108 + RemoteSocketServiceError_SYS_ETOOMANYREFS RemoteSocketServiceError_SystemError = 109 + RemoteSocketServiceError_SYS_ETIMEDOUT RemoteSocketServiceError_SystemError = 110 + RemoteSocketServiceError_SYS_ECONNREFUSED RemoteSocketServiceError_SystemError = 111 + RemoteSocketServiceError_SYS_EHOSTDOWN RemoteSocketServiceError_SystemError = 112 + RemoteSocketServiceError_SYS_EHOSTUNREACH RemoteSocketServiceError_SystemError = 113 + RemoteSocketServiceError_SYS_EALREADY RemoteSocketServiceError_SystemError = 114 + RemoteSocketServiceError_SYS_EINPROGRESS RemoteSocketServiceError_SystemError = 115 + RemoteSocketServiceError_SYS_ESTALE RemoteSocketServiceError_SystemError = 116 + RemoteSocketServiceError_SYS_EUCLEAN RemoteSocketServiceError_SystemError = 117 + RemoteSocketServiceError_SYS_ENOTNAM RemoteSocketServiceError_SystemError = 118 + RemoteSocketServiceError_SYS_ENAVAIL RemoteSocketServiceError_SystemError = 119 + RemoteSocketServiceError_SYS_EISNAM RemoteSocketServiceError_SystemError = 120 + RemoteSocketServiceError_SYS_EREMOTEIO RemoteSocketServiceError_SystemError = 121 + RemoteSocketServiceError_SYS_EDQUOT RemoteSocketServiceError_SystemError = 122 + RemoteSocketServiceError_SYS_ENOMEDIUM RemoteSocketServiceError_SystemError = 123 + RemoteSocketServiceError_SYS_EMEDIUMTYPE RemoteSocketServiceError_SystemError = 124 + RemoteSocketServiceError_SYS_ECANCELED RemoteSocketServiceError_SystemError = 125 + RemoteSocketServiceError_SYS_ENOKEY RemoteSocketServiceError_SystemError = 126 + RemoteSocketServiceError_SYS_EKEYEXPIRED RemoteSocketServiceError_SystemError = 127 + RemoteSocketServiceError_SYS_EKEYREVOKED RemoteSocketServiceError_SystemError = 128 + RemoteSocketServiceError_SYS_EKEYREJECTED RemoteSocketServiceError_SystemError = 129 + RemoteSocketServiceError_SYS_EOWNERDEAD RemoteSocketServiceError_SystemError = 130 + RemoteSocketServiceError_SYS_ENOTRECOVERABLE RemoteSocketServiceError_SystemError = 131 + RemoteSocketServiceError_SYS_ERFKILL RemoteSocketServiceError_SystemError = 132 +) + +var RemoteSocketServiceError_SystemError_name = map[int32]string{ + 0: "SYS_SUCCESS", + 1: "SYS_EPERM", + 2: "SYS_ENOENT", + 3: "SYS_ESRCH", + 4: "SYS_EINTR", + 5: "SYS_EIO", + 6: "SYS_ENXIO", + 7: "SYS_E2BIG", + 8: "SYS_ENOEXEC", + 9: "SYS_EBADF", + 10: "SYS_ECHILD", + 11: "SYS_EAGAIN", + // Duplicate value: 11: "SYS_EWOULDBLOCK", + 12: "SYS_ENOMEM", + 13: "SYS_EACCES", + 14: "SYS_EFAULT", + 15: "SYS_ENOTBLK", + 16: "SYS_EBUSY", + 17: "SYS_EEXIST", + 18: "SYS_EXDEV", + 19: "SYS_ENODEV", + 20: "SYS_ENOTDIR", + 21: "SYS_EISDIR", + 22: "SYS_EINVAL", + 23: "SYS_ENFILE", + 24: "SYS_EMFILE", + 25: "SYS_ENOTTY", + 26: "SYS_ETXTBSY", + 27: "SYS_EFBIG", + 28: "SYS_ENOSPC", + 29: "SYS_ESPIPE", + 30: "SYS_EROFS", + 31: "SYS_EMLINK", + 32: "SYS_EPIPE", + 33: "SYS_EDOM", + 34: "SYS_ERANGE", + 35: "SYS_EDEADLK", + // Duplicate value: 35: "SYS_EDEADLOCK", + 36: "SYS_ENAMETOOLONG", + 37: "SYS_ENOLCK", + 38: "SYS_ENOSYS", + 39: "SYS_ENOTEMPTY", + 40: "SYS_ELOOP", + 42: "SYS_ENOMSG", + 43: "SYS_EIDRM", + 44: "SYS_ECHRNG", + 45: "SYS_EL2NSYNC", + 46: "SYS_EL3HLT", + 47: "SYS_EL3RST", + 48: "SYS_ELNRNG", + 49: "SYS_EUNATCH", + 50: "SYS_ENOCSI", + 51: "SYS_EL2HLT", + 52: "SYS_EBADE", + 53: "SYS_EBADR", + 54: "SYS_EXFULL", + 55: "SYS_ENOANO", + 56: "SYS_EBADRQC", + 57: "SYS_EBADSLT", + 59: "SYS_EBFONT", + 60: "SYS_ENOSTR", + 61: "SYS_ENODATA", + 62: "SYS_ETIME", + 63: "SYS_ENOSR", + 64: "SYS_ENONET", + 65: "SYS_ENOPKG", + 66: "SYS_EREMOTE", + 67: "SYS_ENOLINK", + 68: "SYS_EADV", + 69: "SYS_ESRMNT", + 70: "SYS_ECOMM", + 71: "SYS_EPROTO", + 72: "SYS_EMULTIHOP", + 73: "SYS_EDOTDOT", + 74: "SYS_EBADMSG", + 75: "SYS_EOVERFLOW", + 76: "SYS_ENOTUNIQ", + 77: "SYS_EBADFD", + 78: "SYS_EREMCHG", + 79: "SYS_ELIBACC", + 80: "SYS_ELIBBAD", + 81: "SYS_ELIBSCN", + 82: "SYS_ELIBMAX", + 83: "SYS_ELIBEXEC", + 84: "SYS_EILSEQ", + 85: "SYS_ERESTART", + 86: "SYS_ESTRPIPE", + 87: "SYS_EUSERS", + 88: "SYS_ENOTSOCK", + 89: "SYS_EDESTADDRREQ", + 90: "SYS_EMSGSIZE", + 91: "SYS_EPROTOTYPE", + 92: "SYS_ENOPROTOOPT", + 93: "SYS_EPROTONOSUPPORT", + 94: "SYS_ESOCKTNOSUPPORT", + 95: "SYS_EOPNOTSUPP", + // Duplicate value: 95: "SYS_ENOTSUP", + 96: "SYS_EPFNOSUPPORT", + 97: "SYS_EAFNOSUPPORT", + 98: "SYS_EADDRINUSE", + 99: "SYS_EADDRNOTAVAIL", + 100: "SYS_ENETDOWN", + 101: "SYS_ENETUNREACH", + 102: "SYS_ENETRESET", + 103: "SYS_ECONNABORTED", + 104: "SYS_ECONNRESET", + 105: "SYS_ENOBUFS", + 106: "SYS_EISCONN", + 107: "SYS_ENOTCONN", + 108: "SYS_ESHUTDOWN", + 109: "SYS_ETOOMANYREFS", + 110: "SYS_ETIMEDOUT", + 111: "SYS_ECONNREFUSED", + 112: "SYS_EHOSTDOWN", + 113: "SYS_EHOSTUNREACH", + 114: "SYS_EALREADY", + 115: "SYS_EINPROGRESS", + 116: "SYS_ESTALE", + 117: "SYS_EUCLEAN", + 118: "SYS_ENOTNAM", + 119: "SYS_ENAVAIL", + 120: "SYS_EISNAM", + 121: "SYS_EREMOTEIO", + 122: "SYS_EDQUOT", + 123: "SYS_ENOMEDIUM", + 124: "SYS_EMEDIUMTYPE", + 125: "SYS_ECANCELED", + 126: "SYS_ENOKEY", + 127: "SYS_EKEYEXPIRED", + 128: "SYS_EKEYREVOKED", + 129: "SYS_EKEYREJECTED", + 130: "SYS_EOWNERDEAD", + 131: "SYS_ENOTRECOVERABLE", + 132: "SYS_ERFKILL", +} +var RemoteSocketServiceError_SystemError_value = map[string]int32{ + "SYS_SUCCESS": 0, + "SYS_EPERM": 1, + "SYS_ENOENT": 2, + "SYS_ESRCH": 3, + "SYS_EINTR": 4, + "SYS_EIO": 5, + "SYS_ENXIO": 6, + "SYS_E2BIG": 7, + "SYS_ENOEXEC": 8, + "SYS_EBADF": 9, + "SYS_ECHILD": 10, + "SYS_EAGAIN": 11, + "SYS_EWOULDBLOCK": 11, + "SYS_ENOMEM": 12, + "SYS_EACCES": 13, + "SYS_EFAULT": 14, + "SYS_ENOTBLK": 15, + "SYS_EBUSY": 16, + "SYS_EEXIST": 17, + "SYS_EXDEV": 18, + "SYS_ENODEV": 19, + "SYS_ENOTDIR": 20, + "SYS_EISDIR": 21, + "SYS_EINVAL": 22, + "SYS_ENFILE": 23, + "SYS_EMFILE": 24, + "SYS_ENOTTY": 25, + "SYS_ETXTBSY": 26, + "SYS_EFBIG": 27, + "SYS_ENOSPC": 28, + "SYS_ESPIPE": 29, + "SYS_EROFS": 30, + "SYS_EMLINK": 31, + "SYS_EPIPE": 32, + "SYS_EDOM": 33, + "SYS_ERANGE": 34, + "SYS_EDEADLK": 35, + "SYS_EDEADLOCK": 35, + "SYS_ENAMETOOLONG": 36, + "SYS_ENOLCK": 37, + "SYS_ENOSYS": 38, + "SYS_ENOTEMPTY": 39, + "SYS_ELOOP": 40, + "SYS_ENOMSG": 42, + "SYS_EIDRM": 43, + "SYS_ECHRNG": 44, + "SYS_EL2NSYNC": 45, + "SYS_EL3HLT": 46, + "SYS_EL3RST": 47, + "SYS_ELNRNG": 48, + "SYS_EUNATCH": 49, + "SYS_ENOCSI": 50, + "SYS_EL2HLT": 51, + "SYS_EBADE": 52, + "SYS_EBADR": 53, + "SYS_EXFULL": 54, + "SYS_ENOANO": 55, + "SYS_EBADRQC": 56, + "SYS_EBADSLT": 57, + "SYS_EBFONT": 59, + "SYS_ENOSTR": 60, + "SYS_ENODATA": 61, + "SYS_ETIME": 62, + "SYS_ENOSR": 63, + "SYS_ENONET": 64, + "SYS_ENOPKG": 65, + "SYS_EREMOTE": 66, + "SYS_ENOLINK": 67, + "SYS_EADV": 68, + "SYS_ESRMNT": 69, + "SYS_ECOMM": 70, + "SYS_EPROTO": 71, + "SYS_EMULTIHOP": 72, + "SYS_EDOTDOT": 73, + "SYS_EBADMSG": 74, + "SYS_EOVERFLOW": 75, + "SYS_ENOTUNIQ": 76, + "SYS_EBADFD": 77, + "SYS_EREMCHG": 78, + "SYS_ELIBACC": 79, + "SYS_ELIBBAD": 80, + "SYS_ELIBSCN": 81, + "SYS_ELIBMAX": 82, + "SYS_ELIBEXEC": 83, + "SYS_EILSEQ": 84, + "SYS_ERESTART": 85, + "SYS_ESTRPIPE": 86, + "SYS_EUSERS": 87, + "SYS_ENOTSOCK": 88, + "SYS_EDESTADDRREQ": 89, + "SYS_EMSGSIZE": 90, + "SYS_EPROTOTYPE": 91, + "SYS_ENOPROTOOPT": 92, + "SYS_EPROTONOSUPPORT": 93, + "SYS_ESOCKTNOSUPPORT": 94, + "SYS_EOPNOTSUPP": 95, + "SYS_ENOTSUP": 95, + "SYS_EPFNOSUPPORT": 96, + "SYS_EAFNOSUPPORT": 97, + "SYS_EADDRINUSE": 98, + "SYS_EADDRNOTAVAIL": 99, + "SYS_ENETDOWN": 100, + "SYS_ENETUNREACH": 101, + "SYS_ENETRESET": 102, + "SYS_ECONNABORTED": 103, + "SYS_ECONNRESET": 104, + "SYS_ENOBUFS": 105, + "SYS_EISCONN": 106, + "SYS_ENOTCONN": 107, + "SYS_ESHUTDOWN": 108, + "SYS_ETOOMANYREFS": 109, + "SYS_ETIMEDOUT": 110, + "SYS_ECONNREFUSED": 111, + "SYS_EHOSTDOWN": 112, + "SYS_EHOSTUNREACH": 113, + "SYS_EALREADY": 114, + "SYS_EINPROGRESS": 115, + "SYS_ESTALE": 116, + "SYS_EUCLEAN": 117, + "SYS_ENOTNAM": 118, + "SYS_ENAVAIL": 119, + "SYS_EISNAM": 120, + "SYS_EREMOTEIO": 121, + "SYS_EDQUOT": 122, + "SYS_ENOMEDIUM": 123, + "SYS_EMEDIUMTYPE": 124, + "SYS_ECANCELED": 125, + "SYS_ENOKEY": 126, + "SYS_EKEYEXPIRED": 127, + "SYS_EKEYREVOKED": 128, + "SYS_EKEYREJECTED": 129, + "SYS_EOWNERDEAD": 130, + "SYS_ENOTRECOVERABLE": 131, + "SYS_ERFKILL": 132, +} + +func (x RemoteSocketServiceError_SystemError) Enum() *RemoteSocketServiceError_SystemError { + p := new(RemoteSocketServiceError_SystemError) + *p = x + return p +} +func (x RemoteSocketServiceError_SystemError) String() string { + return proto.EnumName(RemoteSocketServiceError_SystemError_name, int32(x)) +} +func (x *RemoteSocketServiceError_SystemError) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(RemoteSocketServiceError_SystemError_value, data, "RemoteSocketServiceError_SystemError") + if err != nil { + return err + } + *x = RemoteSocketServiceError_SystemError(value) + return nil +} +func (RemoteSocketServiceError_SystemError) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{0, 1} +} + +type CreateSocketRequest_SocketFamily int32 + +const ( + CreateSocketRequest_IPv4 CreateSocketRequest_SocketFamily = 1 + CreateSocketRequest_IPv6 CreateSocketRequest_SocketFamily = 2 +) + +var CreateSocketRequest_SocketFamily_name = map[int32]string{ + 1: "IPv4", + 2: "IPv6", +} +var CreateSocketRequest_SocketFamily_value = map[string]int32{ + "IPv4": 1, + "IPv6": 2, +} + +func (x CreateSocketRequest_SocketFamily) Enum() *CreateSocketRequest_SocketFamily { + p := new(CreateSocketRequest_SocketFamily) + *p = x + return p +} +func (x CreateSocketRequest_SocketFamily) String() string { + return proto.EnumName(CreateSocketRequest_SocketFamily_name, int32(x)) +} +func (x *CreateSocketRequest_SocketFamily) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(CreateSocketRequest_SocketFamily_value, data, "CreateSocketRequest_SocketFamily") + if err != nil { + return err + } + *x = CreateSocketRequest_SocketFamily(value) + return nil +} +func (CreateSocketRequest_SocketFamily) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{2, 0} +} + +type CreateSocketRequest_SocketProtocol int32 + +const ( + CreateSocketRequest_TCP CreateSocketRequest_SocketProtocol = 1 + CreateSocketRequest_UDP CreateSocketRequest_SocketProtocol = 2 +) + +var CreateSocketRequest_SocketProtocol_name = map[int32]string{ + 1: "TCP", + 2: "UDP", +} +var CreateSocketRequest_SocketProtocol_value = map[string]int32{ + "TCP": 1, + "UDP": 2, +} + +func (x CreateSocketRequest_SocketProtocol) Enum() *CreateSocketRequest_SocketProtocol { + p := new(CreateSocketRequest_SocketProtocol) + *p = x + return p +} +func (x CreateSocketRequest_SocketProtocol) String() string { + return proto.EnumName(CreateSocketRequest_SocketProtocol_name, int32(x)) +} +func (x *CreateSocketRequest_SocketProtocol) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(CreateSocketRequest_SocketProtocol_value, data, "CreateSocketRequest_SocketProtocol") + if err != nil { + return err + } + *x = CreateSocketRequest_SocketProtocol(value) + return nil +} +func (CreateSocketRequest_SocketProtocol) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{2, 1} +} + +type SocketOption_SocketOptionLevel int32 + +const ( + SocketOption_SOCKET_SOL_IP SocketOption_SocketOptionLevel = 0 + SocketOption_SOCKET_SOL_SOCKET SocketOption_SocketOptionLevel = 1 + SocketOption_SOCKET_SOL_TCP SocketOption_SocketOptionLevel = 6 + SocketOption_SOCKET_SOL_UDP SocketOption_SocketOptionLevel = 17 +) + +var SocketOption_SocketOptionLevel_name = map[int32]string{ + 0: "SOCKET_SOL_IP", + 1: "SOCKET_SOL_SOCKET", + 6: "SOCKET_SOL_TCP", + 17: "SOCKET_SOL_UDP", +} +var SocketOption_SocketOptionLevel_value = map[string]int32{ + "SOCKET_SOL_IP": 0, + "SOCKET_SOL_SOCKET": 1, + "SOCKET_SOL_TCP": 6, + "SOCKET_SOL_UDP": 17, +} + +func (x SocketOption_SocketOptionLevel) Enum() *SocketOption_SocketOptionLevel { + p := new(SocketOption_SocketOptionLevel) + *p = x + return p +} +func (x SocketOption_SocketOptionLevel) String() string { + return proto.EnumName(SocketOption_SocketOptionLevel_name, int32(x)) +} +func (x *SocketOption_SocketOptionLevel) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(SocketOption_SocketOptionLevel_value, data, "SocketOption_SocketOptionLevel") + if err != nil { + return err + } + *x = SocketOption_SocketOptionLevel(value) + return nil +} +func (SocketOption_SocketOptionLevel) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{10, 0} +} + +type SocketOption_SocketOptionName int32 + +const ( + SocketOption_SOCKET_SO_DEBUG SocketOption_SocketOptionName = 1 + SocketOption_SOCKET_SO_REUSEADDR SocketOption_SocketOptionName = 2 + SocketOption_SOCKET_SO_TYPE SocketOption_SocketOptionName = 3 + SocketOption_SOCKET_SO_ERROR SocketOption_SocketOptionName = 4 + SocketOption_SOCKET_SO_DONTROUTE SocketOption_SocketOptionName = 5 + SocketOption_SOCKET_SO_BROADCAST SocketOption_SocketOptionName = 6 + SocketOption_SOCKET_SO_SNDBUF SocketOption_SocketOptionName = 7 + SocketOption_SOCKET_SO_RCVBUF SocketOption_SocketOptionName = 8 + SocketOption_SOCKET_SO_KEEPALIVE SocketOption_SocketOptionName = 9 + SocketOption_SOCKET_SO_OOBINLINE SocketOption_SocketOptionName = 10 + SocketOption_SOCKET_SO_LINGER SocketOption_SocketOptionName = 13 + SocketOption_SOCKET_SO_RCVTIMEO SocketOption_SocketOptionName = 20 + SocketOption_SOCKET_SO_SNDTIMEO SocketOption_SocketOptionName = 21 + SocketOption_SOCKET_IP_TOS SocketOption_SocketOptionName = 1 + SocketOption_SOCKET_IP_TTL SocketOption_SocketOptionName = 2 + SocketOption_SOCKET_IP_HDRINCL SocketOption_SocketOptionName = 3 + SocketOption_SOCKET_IP_OPTIONS SocketOption_SocketOptionName = 4 + SocketOption_SOCKET_TCP_NODELAY SocketOption_SocketOptionName = 1 + SocketOption_SOCKET_TCP_MAXSEG SocketOption_SocketOptionName = 2 + SocketOption_SOCKET_TCP_CORK SocketOption_SocketOptionName = 3 + SocketOption_SOCKET_TCP_KEEPIDLE SocketOption_SocketOptionName = 4 + SocketOption_SOCKET_TCP_KEEPINTVL SocketOption_SocketOptionName = 5 + SocketOption_SOCKET_TCP_KEEPCNT SocketOption_SocketOptionName = 6 + SocketOption_SOCKET_TCP_SYNCNT SocketOption_SocketOptionName = 7 + SocketOption_SOCKET_TCP_LINGER2 SocketOption_SocketOptionName = 8 + SocketOption_SOCKET_TCP_DEFER_ACCEPT SocketOption_SocketOptionName = 9 + SocketOption_SOCKET_TCP_WINDOW_CLAMP SocketOption_SocketOptionName = 10 + SocketOption_SOCKET_TCP_INFO SocketOption_SocketOptionName = 11 + SocketOption_SOCKET_TCP_QUICKACK SocketOption_SocketOptionName = 12 +) + +var SocketOption_SocketOptionName_name = map[int32]string{ + 1: "SOCKET_SO_DEBUG", + 2: "SOCKET_SO_REUSEADDR", + 3: "SOCKET_SO_TYPE", + 4: "SOCKET_SO_ERROR", + 5: "SOCKET_SO_DONTROUTE", + 6: "SOCKET_SO_BROADCAST", + 7: "SOCKET_SO_SNDBUF", + 8: "SOCKET_SO_RCVBUF", + 9: "SOCKET_SO_KEEPALIVE", + 10: "SOCKET_SO_OOBINLINE", + 13: "SOCKET_SO_LINGER", + 20: "SOCKET_SO_RCVTIMEO", + 21: "SOCKET_SO_SNDTIMEO", + // Duplicate value: 1: "SOCKET_IP_TOS", + // Duplicate value: 2: "SOCKET_IP_TTL", + // Duplicate value: 3: "SOCKET_IP_HDRINCL", + // Duplicate value: 4: "SOCKET_IP_OPTIONS", + // Duplicate value: 1: "SOCKET_TCP_NODELAY", + // Duplicate value: 2: "SOCKET_TCP_MAXSEG", + // Duplicate value: 3: "SOCKET_TCP_CORK", + // Duplicate value: 4: "SOCKET_TCP_KEEPIDLE", + // Duplicate value: 5: "SOCKET_TCP_KEEPINTVL", + // Duplicate value: 6: "SOCKET_TCP_KEEPCNT", + // Duplicate value: 7: "SOCKET_TCP_SYNCNT", + // Duplicate value: 8: "SOCKET_TCP_LINGER2", + // Duplicate value: 9: "SOCKET_TCP_DEFER_ACCEPT", + // Duplicate value: 10: "SOCKET_TCP_WINDOW_CLAMP", + 11: "SOCKET_TCP_INFO", + 12: "SOCKET_TCP_QUICKACK", +} +var SocketOption_SocketOptionName_value = map[string]int32{ + "SOCKET_SO_DEBUG": 1, + "SOCKET_SO_REUSEADDR": 2, + "SOCKET_SO_TYPE": 3, + "SOCKET_SO_ERROR": 4, + "SOCKET_SO_DONTROUTE": 5, + "SOCKET_SO_BROADCAST": 6, + "SOCKET_SO_SNDBUF": 7, + "SOCKET_SO_RCVBUF": 8, + "SOCKET_SO_KEEPALIVE": 9, + "SOCKET_SO_OOBINLINE": 10, + "SOCKET_SO_LINGER": 13, + "SOCKET_SO_RCVTIMEO": 20, + "SOCKET_SO_SNDTIMEO": 21, + "SOCKET_IP_TOS": 1, + "SOCKET_IP_TTL": 2, + "SOCKET_IP_HDRINCL": 3, + "SOCKET_IP_OPTIONS": 4, + "SOCKET_TCP_NODELAY": 1, + "SOCKET_TCP_MAXSEG": 2, + "SOCKET_TCP_CORK": 3, + "SOCKET_TCP_KEEPIDLE": 4, + "SOCKET_TCP_KEEPINTVL": 5, + "SOCKET_TCP_KEEPCNT": 6, + "SOCKET_TCP_SYNCNT": 7, + "SOCKET_TCP_LINGER2": 8, + "SOCKET_TCP_DEFER_ACCEPT": 9, + "SOCKET_TCP_WINDOW_CLAMP": 10, + "SOCKET_TCP_INFO": 11, + "SOCKET_TCP_QUICKACK": 12, +} + +func (x SocketOption_SocketOptionName) Enum() *SocketOption_SocketOptionName { + p := new(SocketOption_SocketOptionName) + *p = x + return p +} +func (x SocketOption_SocketOptionName) String() string { + return proto.EnumName(SocketOption_SocketOptionName_name, int32(x)) +} +func (x *SocketOption_SocketOptionName) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(SocketOption_SocketOptionName_value, data, "SocketOption_SocketOptionName") + if err != nil { + return err + } + *x = SocketOption_SocketOptionName(value) + return nil +} +func (SocketOption_SocketOptionName) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{10, 1} +} + +type ShutDownRequest_How int32 + +const ( + ShutDownRequest_SOCKET_SHUT_RD ShutDownRequest_How = 1 + ShutDownRequest_SOCKET_SHUT_WR ShutDownRequest_How = 2 + ShutDownRequest_SOCKET_SHUT_RDWR ShutDownRequest_How = 3 +) + +var ShutDownRequest_How_name = map[int32]string{ + 1: "SOCKET_SHUT_RD", + 2: "SOCKET_SHUT_WR", + 3: "SOCKET_SHUT_RDWR", +} +var ShutDownRequest_How_value = map[string]int32{ + "SOCKET_SHUT_RD": 1, + "SOCKET_SHUT_WR": 2, + "SOCKET_SHUT_RDWR": 3, +} + +func (x ShutDownRequest_How) Enum() *ShutDownRequest_How { + p := new(ShutDownRequest_How) + *p = x + return p +} +func (x ShutDownRequest_How) String() string { + return proto.EnumName(ShutDownRequest_How_name, int32(x)) +} +func (x *ShutDownRequest_How) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ShutDownRequest_How_value, data, "ShutDownRequest_How") + if err != nil { + return err + } + *x = ShutDownRequest_How(value) + return nil +} +func (ShutDownRequest_How) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{21, 0} +} + +type ReceiveRequest_Flags int32 + +const ( + ReceiveRequest_MSG_OOB ReceiveRequest_Flags = 1 + ReceiveRequest_MSG_PEEK ReceiveRequest_Flags = 2 +) + +var ReceiveRequest_Flags_name = map[int32]string{ + 1: "MSG_OOB", + 2: "MSG_PEEK", +} +var ReceiveRequest_Flags_value = map[string]int32{ + "MSG_OOB": 1, + "MSG_PEEK": 2, +} + +func (x ReceiveRequest_Flags) Enum() *ReceiveRequest_Flags { + p := new(ReceiveRequest_Flags) + *p = x + return p +} +func (x ReceiveRequest_Flags) String() string { + return proto.EnumName(ReceiveRequest_Flags_name, int32(x)) +} +func (x *ReceiveRequest_Flags) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ReceiveRequest_Flags_value, data, "ReceiveRequest_Flags") + if err != nil { + return err + } + *x = ReceiveRequest_Flags(value) + return nil +} +func (ReceiveRequest_Flags) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{27, 0} +} + +type PollEvent_PollEventFlag int32 + +const ( + PollEvent_SOCKET_POLLNONE PollEvent_PollEventFlag = 0 + PollEvent_SOCKET_POLLIN PollEvent_PollEventFlag = 1 + PollEvent_SOCKET_POLLPRI PollEvent_PollEventFlag = 2 + PollEvent_SOCKET_POLLOUT PollEvent_PollEventFlag = 4 + PollEvent_SOCKET_POLLERR PollEvent_PollEventFlag = 8 + PollEvent_SOCKET_POLLHUP PollEvent_PollEventFlag = 16 + PollEvent_SOCKET_POLLNVAL PollEvent_PollEventFlag = 32 + PollEvent_SOCKET_POLLRDNORM PollEvent_PollEventFlag = 64 + PollEvent_SOCKET_POLLRDBAND PollEvent_PollEventFlag = 128 + PollEvent_SOCKET_POLLWRNORM PollEvent_PollEventFlag = 256 + PollEvent_SOCKET_POLLWRBAND PollEvent_PollEventFlag = 512 + PollEvent_SOCKET_POLLMSG PollEvent_PollEventFlag = 1024 + PollEvent_SOCKET_POLLREMOVE PollEvent_PollEventFlag = 4096 + PollEvent_SOCKET_POLLRDHUP PollEvent_PollEventFlag = 8192 +) + +var PollEvent_PollEventFlag_name = map[int32]string{ + 0: "SOCKET_POLLNONE", + 1: "SOCKET_POLLIN", + 2: "SOCKET_POLLPRI", + 4: "SOCKET_POLLOUT", + 8: "SOCKET_POLLERR", + 16: "SOCKET_POLLHUP", + 32: "SOCKET_POLLNVAL", + 64: "SOCKET_POLLRDNORM", + 128: "SOCKET_POLLRDBAND", + 256: "SOCKET_POLLWRNORM", + 512: "SOCKET_POLLWRBAND", + 1024: "SOCKET_POLLMSG", + 4096: "SOCKET_POLLREMOVE", + 8192: "SOCKET_POLLRDHUP", +} +var PollEvent_PollEventFlag_value = map[string]int32{ + "SOCKET_POLLNONE": 0, + "SOCKET_POLLIN": 1, + "SOCKET_POLLPRI": 2, + "SOCKET_POLLOUT": 4, + "SOCKET_POLLERR": 8, + "SOCKET_POLLHUP": 16, + "SOCKET_POLLNVAL": 32, + "SOCKET_POLLRDNORM": 64, + "SOCKET_POLLRDBAND": 128, + "SOCKET_POLLWRNORM": 256, + "SOCKET_POLLWRBAND": 512, + "SOCKET_POLLMSG": 1024, + "SOCKET_POLLREMOVE": 4096, + "SOCKET_POLLRDHUP": 8192, +} + +func (x PollEvent_PollEventFlag) Enum() *PollEvent_PollEventFlag { + p := new(PollEvent_PollEventFlag) + *p = x + return p +} +func (x PollEvent_PollEventFlag) String() string { + return proto.EnumName(PollEvent_PollEventFlag_name, int32(x)) +} +func (x *PollEvent_PollEventFlag) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(PollEvent_PollEventFlag_value, data, "PollEvent_PollEventFlag") + if err != nil { + return err + } + *x = PollEvent_PollEventFlag(value) + return nil +} +func (PollEvent_PollEventFlag) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{29, 0} +} + +type ResolveReply_ErrorCode int32 + +const ( + ResolveReply_SOCKET_EAI_ADDRFAMILY ResolveReply_ErrorCode = 1 + ResolveReply_SOCKET_EAI_AGAIN ResolveReply_ErrorCode = 2 + ResolveReply_SOCKET_EAI_BADFLAGS ResolveReply_ErrorCode = 3 + ResolveReply_SOCKET_EAI_FAIL ResolveReply_ErrorCode = 4 + ResolveReply_SOCKET_EAI_FAMILY ResolveReply_ErrorCode = 5 + ResolveReply_SOCKET_EAI_MEMORY ResolveReply_ErrorCode = 6 + ResolveReply_SOCKET_EAI_NODATA ResolveReply_ErrorCode = 7 + ResolveReply_SOCKET_EAI_NONAME ResolveReply_ErrorCode = 8 + ResolveReply_SOCKET_EAI_SERVICE ResolveReply_ErrorCode = 9 + ResolveReply_SOCKET_EAI_SOCKTYPE ResolveReply_ErrorCode = 10 + ResolveReply_SOCKET_EAI_SYSTEM ResolveReply_ErrorCode = 11 + ResolveReply_SOCKET_EAI_BADHINTS ResolveReply_ErrorCode = 12 + ResolveReply_SOCKET_EAI_PROTOCOL ResolveReply_ErrorCode = 13 + ResolveReply_SOCKET_EAI_OVERFLOW ResolveReply_ErrorCode = 14 + ResolveReply_SOCKET_EAI_MAX ResolveReply_ErrorCode = 15 +) + +var ResolveReply_ErrorCode_name = map[int32]string{ + 1: "SOCKET_EAI_ADDRFAMILY", + 2: "SOCKET_EAI_AGAIN", + 3: "SOCKET_EAI_BADFLAGS", + 4: "SOCKET_EAI_FAIL", + 5: "SOCKET_EAI_FAMILY", + 6: "SOCKET_EAI_MEMORY", + 7: "SOCKET_EAI_NODATA", + 8: "SOCKET_EAI_NONAME", + 9: "SOCKET_EAI_SERVICE", + 10: "SOCKET_EAI_SOCKTYPE", + 11: "SOCKET_EAI_SYSTEM", + 12: "SOCKET_EAI_BADHINTS", + 13: "SOCKET_EAI_PROTOCOL", + 14: "SOCKET_EAI_OVERFLOW", + 15: "SOCKET_EAI_MAX", +} +var ResolveReply_ErrorCode_value = map[string]int32{ + "SOCKET_EAI_ADDRFAMILY": 1, + "SOCKET_EAI_AGAIN": 2, + "SOCKET_EAI_BADFLAGS": 3, + "SOCKET_EAI_FAIL": 4, + "SOCKET_EAI_FAMILY": 5, + "SOCKET_EAI_MEMORY": 6, + "SOCKET_EAI_NODATA": 7, + "SOCKET_EAI_NONAME": 8, + "SOCKET_EAI_SERVICE": 9, + "SOCKET_EAI_SOCKTYPE": 10, + "SOCKET_EAI_SYSTEM": 11, + "SOCKET_EAI_BADHINTS": 12, + "SOCKET_EAI_PROTOCOL": 13, + "SOCKET_EAI_OVERFLOW": 14, + "SOCKET_EAI_MAX": 15, +} + +func (x ResolveReply_ErrorCode) Enum() *ResolveReply_ErrorCode { + p := new(ResolveReply_ErrorCode) + *p = x + return p +} +func (x ResolveReply_ErrorCode) String() string { + return proto.EnumName(ResolveReply_ErrorCode_name, int32(x)) +} +func (x *ResolveReply_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ResolveReply_ErrorCode_value, data, "ResolveReply_ErrorCode") + if err != nil { + return err + } + *x = ResolveReply_ErrorCode(value) + return nil +} +func (ResolveReply_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{33, 0} +} + +type RemoteSocketServiceError struct { + SystemError *int32 `protobuf:"varint,1,opt,name=system_error,json=systemError,def=0" json:"system_error,omitempty"` + ErrorDetail *string `protobuf:"bytes,2,opt,name=error_detail,json=errorDetail" json:"error_detail,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RemoteSocketServiceError) Reset() { *m = RemoteSocketServiceError{} } +func (m *RemoteSocketServiceError) String() string { return proto.CompactTextString(m) } +func (*RemoteSocketServiceError) ProtoMessage() {} +func (*RemoteSocketServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{0} +} +func (m *RemoteSocketServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RemoteSocketServiceError.Unmarshal(m, b) +} +func (m *RemoteSocketServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RemoteSocketServiceError.Marshal(b, m, deterministic) +} +func (dst *RemoteSocketServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_RemoteSocketServiceError.Merge(dst, src) +} +func (m *RemoteSocketServiceError) XXX_Size() int { + return xxx_messageInfo_RemoteSocketServiceError.Size(m) +} +func (m *RemoteSocketServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_RemoteSocketServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_RemoteSocketServiceError proto.InternalMessageInfo + +const Default_RemoteSocketServiceError_SystemError int32 = 0 + +func (m *RemoteSocketServiceError) GetSystemError() int32 { + if m != nil && m.SystemError != nil { + return *m.SystemError + } + return Default_RemoteSocketServiceError_SystemError +} + +func (m *RemoteSocketServiceError) GetErrorDetail() string { + if m != nil && m.ErrorDetail != nil { + return *m.ErrorDetail + } + return "" +} + +type AddressPort struct { + Port *int32 `protobuf:"varint,1,req,name=port" json:"port,omitempty"` + PackedAddress []byte `protobuf:"bytes,2,opt,name=packed_address,json=packedAddress" json:"packed_address,omitempty"` + HostnameHint *string `protobuf:"bytes,3,opt,name=hostname_hint,json=hostnameHint" json:"hostname_hint,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddressPort) Reset() { *m = AddressPort{} } +func (m *AddressPort) String() string { return proto.CompactTextString(m) } +func (*AddressPort) ProtoMessage() {} +func (*AddressPort) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{1} +} +func (m *AddressPort) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddressPort.Unmarshal(m, b) +} +func (m *AddressPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddressPort.Marshal(b, m, deterministic) +} +func (dst *AddressPort) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddressPort.Merge(dst, src) +} +func (m *AddressPort) XXX_Size() int { + return xxx_messageInfo_AddressPort.Size(m) +} +func (m *AddressPort) XXX_DiscardUnknown() { + xxx_messageInfo_AddressPort.DiscardUnknown(m) +} + +var xxx_messageInfo_AddressPort proto.InternalMessageInfo + +func (m *AddressPort) GetPort() int32 { + if m != nil && m.Port != nil { + return *m.Port + } + return 0 +} + +func (m *AddressPort) GetPackedAddress() []byte { + if m != nil { + return m.PackedAddress + } + return nil +} + +func (m *AddressPort) GetHostnameHint() string { + if m != nil && m.HostnameHint != nil { + return *m.HostnameHint + } + return "" +} + +type CreateSocketRequest struct { + Family *CreateSocketRequest_SocketFamily `protobuf:"varint,1,req,name=family,enum=appengine.CreateSocketRequest_SocketFamily" json:"family,omitempty"` + Protocol *CreateSocketRequest_SocketProtocol `protobuf:"varint,2,req,name=protocol,enum=appengine.CreateSocketRequest_SocketProtocol" json:"protocol,omitempty"` + SocketOptions []*SocketOption `protobuf:"bytes,3,rep,name=socket_options,json=socketOptions" json:"socket_options,omitempty"` + ProxyExternalIp *AddressPort `protobuf:"bytes,4,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` + ListenBacklog *int32 `protobuf:"varint,5,opt,name=listen_backlog,json=listenBacklog,def=0" json:"listen_backlog,omitempty"` + RemoteIp *AddressPort `protobuf:"bytes,6,opt,name=remote_ip,json=remoteIp" json:"remote_ip,omitempty"` + AppId *string `protobuf:"bytes,9,opt,name=app_id,json=appId" json:"app_id,omitempty"` + ProjectId *int64 `protobuf:"varint,10,opt,name=project_id,json=projectId" json:"project_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateSocketRequest) Reset() { *m = CreateSocketRequest{} } +func (m *CreateSocketRequest) String() string { return proto.CompactTextString(m) } +func (*CreateSocketRequest) ProtoMessage() {} +func (*CreateSocketRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{2} +} +func (m *CreateSocketRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateSocketRequest.Unmarshal(m, b) +} +func (m *CreateSocketRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateSocketRequest.Marshal(b, m, deterministic) +} +func (dst *CreateSocketRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateSocketRequest.Merge(dst, src) +} +func (m *CreateSocketRequest) XXX_Size() int { + return xxx_messageInfo_CreateSocketRequest.Size(m) +} +func (m *CreateSocketRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateSocketRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateSocketRequest proto.InternalMessageInfo + +const Default_CreateSocketRequest_ListenBacklog int32 = 0 + +func (m *CreateSocketRequest) GetFamily() CreateSocketRequest_SocketFamily { + if m != nil && m.Family != nil { + return *m.Family + } + return CreateSocketRequest_IPv4 +} + +func (m *CreateSocketRequest) GetProtocol() CreateSocketRequest_SocketProtocol { + if m != nil && m.Protocol != nil { + return *m.Protocol + } + return CreateSocketRequest_TCP +} + +func (m *CreateSocketRequest) GetSocketOptions() []*SocketOption { + if m != nil { + return m.SocketOptions + } + return nil +} + +func (m *CreateSocketRequest) GetProxyExternalIp() *AddressPort { + if m != nil { + return m.ProxyExternalIp + } + return nil +} + +func (m *CreateSocketRequest) GetListenBacklog() int32 { + if m != nil && m.ListenBacklog != nil { + return *m.ListenBacklog + } + return Default_CreateSocketRequest_ListenBacklog +} + +func (m *CreateSocketRequest) GetRemoteIp() *AddressPort { + if m != nil { + return m.RemoteIp + } + return nil +} + +func (m *CreateSocketRequest) GetAppId() string { + if m != nil && m.AppId != nil { + return *m.AppId + } + return "" +} + +func (m *CreateSocketRequest) GetProjectId() int64 { + if m != nil && m.ProjectId != nil { + return *m.ProjectId + } + return 0 +} + +type CreateSocketReply struct { + SocketDescriptor *string `protobuf:"bytes,1,opt,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + ServerAddress *AddressPort `protobuf:"bytes,3,opt,name=server_address,json=serverAddress" json:"server_address,omitempty"` + ProxyExternalIp *AddressPort `protobuf:"bytes,4,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateSocketReply) Reset() { *m = CreateSocketReply{} } +func (m *CreateSocketReply) String() string { return proto.CompactTextString(m) } +func (*CreateSocketReply) ProtoMessage() {} +func (*CreateSocketReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{3} +} + +var extRange_CreateSocketReply = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*CreateSocketReply) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_CreateSocketReply +} +func (m *CreateSocketReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateSocketReply.Unmarshal(m, b) +} +func (m *CreateSocketReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateSocketReply.Marshal(b, m, deterministic) +} +func (dst *CreateSocketReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateSocketReply.Merge(dst, src) +} +func (m *CreateSocketReply) XXX_Size() int { + return xxx_messageInfo_CreateSocketReply.Size(m) +} +func (m *CreateSocketReply) XXX_DiscardUnknown() { + xxx_messageInfo_CreateSocketReply.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateSocketReply proto.InternalMessageInfo + +func (m *CreateSocketReply) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *CreateSocketReply) GetServerAddress() *AddressPort { + if m != nil { + return m.ServerAddress + } + return nil +} + +func (m *CreateSocketReply) GetProxyExternalIp() *AddressPort { + if m != nil { + return m.ProxyExternalIp + } + return nil +} + +type BindRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + ProxyExternalIp *AddressPort `protobuf:"bytes,2,req,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BindRequest) Reset() { *m = BindRequest{} } +func (m *BindRequest) String() string { return proto.CompactTextString(m) } +func (*BindRequest) ProtoMessage() {} +func (*BindRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{4} +} +func (m *BindRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BindRequest.Unmarshal(m, b) +} +func (m *BindRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BindRequest.Marshal(b, m, deterministic) +} +func (dst *BindRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BindRequest.Merge(dst, src) +} +func (m *BindRequest) XXX_Size() int { + return xxx_messageInfo_BindRequest.Size(m) +} +func (m *BindRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BindRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BindRequest proto.InternalMessageInfo + +func (m *BindRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *BindRequest) GetProxyExternalIp() *AddressPort { + if m != nil { + return m.ProxyExternalIp + } + return nil +} + +type BindReply struct { + ProxyExternalIp *AddressPort `protobuf:"bytes,1,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BindReply) Reset() { *m = BindReply{} } +func (m *BindReply) String() string { return proto.CompactTextString(m) } +func (*BindReply) ProtoMessage() {} +func (*BindReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{5} +} +func (m *BindReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BindReply.Unmarshal(m, b) +} +func (m *BindReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BindReply.Marshal(b, m, deterministic) +} +func (dst *BindReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_BindReply.Merge(dst, src) +} +func (m *BindReply) XXX_Size() int { + return xxx_messageInfo_BindReply.Size(m) +} +func (m *BindReply) XXX_DiscardUnknown() { + xxx_messageInfo_BindReply.DiscardUnknown(m) +} + +var xxx_messageInfo_BindReply proto.InternalMessageInfo + +func (m *BindReply) GetProxyExternalIp() *AddressPort { + if m != nil { + return m.ProxyExternalIp + } + return nil +} + +type GetSocketNameRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSocketNameRequest) Reset() { *m = GetSocketNameRequest{} } +func (m *GetSocketNameRequest) String() string { return proto.CompactTextString(m) } +func (*GetSocketNameRequest) ProtoMessage() {} +func (*GetSocketNameRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{6} +} +func (m *GetSocketNameRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSocketNameRequest.Unmarshal(m, b) +} +func (m *GetSocketNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSocketNameRequest.Marshal(b, m, deterministic) +} +func (dst *GetSocketNameRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSocketNameRequest.Merge(dst, src) +} +func (m *GetSocketNameRequest) XXX_Size() int { + return xxx_messageInfo_GetSocketNameRequest.Size(m) +} +func (m *GetSocketNameRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetSocketNameRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSocketNameRequest proto.InternalMessageInfo + +func (m *GetSocketNameRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +type GetSocketNameReply struct { + ProxyExternalIp *AddressPort `protobuf:"bytes,2,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSocketNameReply) Reset() { *m = GetSocketNameReply{} } +func (m *GetSocketNameReply) String() string { return proto.CompactTextString(m) } +func (*GetSocketNameReply) ProtoMessage() {} +func (*GetSocketNameReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{7} +} +func (m *GetSocketNameReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSocketNameReply.Unmarshal(m, b) +} +func (m *GetSocketNameReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSocketNameReply.Marshal(b, m, deterministic) +} +func (dst *GetSocketNameReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSocketNameReply.Merge(dst, src) +} +func (m *GetSocketNameReply) XXX_Size() int { + return xxx_messageInfo_GetSocketNameReply.Size(m) +} +func (m *GetSocketNameReply) XXX_DiscardUnknown() { + xxx_messageInfo_GetSocketNameReply.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSocketNameReply proto.InternalMessageInfo + +func (m *GetSocketNameReply) GetProxyExternalIp() *AddressPort { + if m != nil { + return m.ProxyExternalIp + } + return nil +} + +type GetPeerNameRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetPeerNameRequest) Reset() { *m = GetPeerNameRequest{} } +func (m *GetPeerNameRequest) String() string { return proto.CompactTextString(m) } +func (*GetPeerNameRequest) ProtoMessage() {} +func (*GetPeerNameRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{8} +} +func (m *GetPeerNameRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetPeerNameRequest.Unmarshal(m, b) +} +func (m *GetPeerNameRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetPeerNameRequest.Marshal(b, m, deterministic) +} +func (dst *GetPeerNameRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetPeerNameRequest.Merge(dst, src) +} +func (m *GetPeerNameRequest) XXX_Size() int { + return xxx_messageInfo_GetPeerNameRequest.Size(m) +} +func (m *GetPeerNameRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetPeerNameRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetPeerNameRequest proto.InternalMessageInfo + +func (m *GetPeerNameRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +type GetPeerNameReply struct { + PeerIp *AddressPort `protobuf:"bytes,2,opt,name=peer_ip,json=peerIp" json:"peer_ip,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetPeerNameReply) Reset() { *m = GetPeerNameReply{} } +func (m *GetPeerNameReply) String() string { return proto.CompactTextString(m) } +func (*GetPeerNameReply) ProtoMessage() {} +func (*GetPeerNameReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{9} +} +func (m *GetPeerNameReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetPeerNameReply.Unmarshal(m, b) +} +func (m *GetPeerNameReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetPeerNameReply.Marshal(b, m, deterministic) +} +func (dst *GetPeerNameReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetPeerNameReply.Merge(dst, src) +} +func (m *GetPeerNameReply) XXX_Size() int { + return xxx_messageInfo_GetPeerNameReply.Size(m) +} +func (m *GetPeerNameReply) XXX_DiscardUnknown() { + xxx_messageInfo_GetPeerNameReply.DiscardUnknown(m) +} + +var xxx_messageInfo_GetPeerNameReply proto.InternalMessageInfo + +func (m *GetPeerNameReply) GetPeerIp() *AddressPort { + if m != nil { + return m.PeerIp + } + return nil +} + +type SocketOption struct { + Level *SocketOption_SocketOptionLevel `protobuf:"varint,1,req,name=level,enum=appengine.SocketOption_SocketOptionLevel" json:"level,omitempty"` + Option *SocketOption_SocketOptionName `protobuf:"varint,2,req,name=option,enum=appengine.SocketOption_SocketOptionName" json:"option,omitempty"` + Value []byte `protobuf:"bytes,3,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SocketOption) Reset() { *m = SocketOption{} } +func (m *SocketOption) String() string { return proto.CompactTextString(m) } +func (*SocketOption) ProtoMessage() {} +func (*SocketOption) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{10} +} +func (m *SocketOption) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SocketOption.Unmarshal(m, b) +} +func (m *SocketOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SocketOption.Marshal(b, m, deterministic) +} +func (dst *SocketOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_SocketOption.Merge(dst, src) +} +func (m *SocketOption) XXX_Size() int { + return xxx_messageInfo_SocketOption.Size(m) +} +func (m *SocketOption) XXX_DiscardUnknown() { + xxx_messageInfo_SocketOption.DiscardUnknown(m) +} + +var xxx_messageInfo_SocketOption proto.InternalMessageInfo + +func (m *SocketOption) GetLevel() SocketOption_SocketOptionLevel { + if m != nil && m.Level != nil { + return *m.Level + } + return SocketOption_SOCKET_SOL_IP +} + +func (m *SocketOption) GetOption() SocketOption_SocketOptionName { + if m != nil && m.Option != nil { + return *m.Option + } + return SocketOption_SOCKET_SO_DEBUG +} + +func (m *SocketOption) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type SetSocketOptionsRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + Options []*SocketOption `protobuf:"bytes,2,rep,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetSocketOptionsRequest) Reset() { *m = SetSocketOptionsRequest{} } +func (m *SetSocketOptionsRequest) String() string { return proto.CompactTextString(m) } +func (*SetSocketOptionsRequest) ProtoMessage() {} +func (*SetSocketOptionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{11} +} +func (m *SetSocketOptionsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetSocketOptionsRequest.Unmarshal(m, b) +} +func (m *SetSocketOptionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetSocketOptionsRequest.Marshal(b, m, deterministic) +} +func (dst *SetSocketOptionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetSocketOptionsRequest.Merge(dst, src) +} +func (m *SetSocketOptionsRequest) XXX_Size() int { + return xxx_messageInfo_SetSocketOptionsRequest.Size(m) +} +func (m *SetSocketOptionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SetSocketOptionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SetSocketOptionsRequest proto.InternalMessageInfo + +func (m *SetSocketOptionsRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *SetSocketOptionsRequest) GetOptions() []*SocketOption { + if m != nil { + return m.Options + } + return nil +} + +type SetSocketOptionsReply struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetSocketOptionsReply) Reset() { *m = SetSocketOptionsReply{} } +func (m *SetSocketOptionsReply) String() string { return proto.CompactTextString(m) } +func (*SetSocketOptionsReply) ProtoMessage() {} +func (*SetSocketOptionsReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{12} +} +func (m *SetSocketOptionsReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetSocketOptionsReply.Unmarshal(m, b) +} +func (m *SetSocketOptionsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetSocketOptionsReply.Marshal(b, m, deterministic) +} +func (dst *SetSocketOptionsReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetSocketOptionsReply.Merge(dst, src) +} +func (m *SetSocketOptionsReply) XXX_Size() int { + return xxx_messageInfo_SetSocketOptionsReply.Size(m) +} +func (m *SetSocketOptionsReply) XXX_DiscardUnknown() { + xxx_messageInfo_SetSocketOptionsReply.DiscardUnknown(m) +} + +var xxx_messageInfo_SetSocketOptionsReply proto.InternalMessageInfo + +type GetSocketOptionsRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + Options []*SocketOption `protobuf:"bytes,2,rep,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSocketOptionsRequest) Reset() { *m = GetSocketOptionsRequest{} } +func (m *GetSocketOptionsRequest) String() string { return proto.CompactTextString(m) } +func (*GetSocketOptionsRequest) ProtoMessage() {} +func (*GetSocketOptionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{13} +} +func (m *GetSocketOptionsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSocketOptionsRequest.Unmarshal(m, b) +} +func (m *GetSocketOptionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSocketOptionsRequest.Marshal(b, m, deterministic) +} +func (dst *GetSocketOptionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSocketOptionsRequest.Merge(dst, src) +} +func (m *GetSocketOptionsRequest) XXX_Size() int { + return xxx_messageInfo_GetSocketOptionsRequest.Size(m) +} +func (m *GetSocketOptionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetSocketOptionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSocketOptionsRequest proto.InternalMessageInfo + +func (m *GetSocketOptionsRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *GetSocketOptionsRequest) GetOptions() []*SocketOption { + if m != nil { + return m.Options + } + return nil +} + +type GetSocketOptionsReply struct { + Options []*SocketOption `protobuf:"bytes,2,rep,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSocketOptionsReply) Reset() { *m = GetSocketOptionsReply{} } +func (m *GetSocketOptionsReply) String() string { return proto.CompactTextString(m) } +func (*GetSocketOptionsReply) ProtoMessage() {} +func (*GetSocketOptionsReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{14} +} +func (m *GetSocketOptionsReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSocketOptionsReply.Unmarshal(m, b) +} +func (m *GetSocketOptionsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSocketOptionsReply.Marshal(b, m, deterministic) +} +func (dst *GetSocketOptionsReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSocketOptionsReply.Merge(dst, src) +} +func (m *GetSocketOptionsReply) XXX_Size() int { + return xxx_messageInfo_GetSocketOptionsReply.Size(m) +} +func (m *GetSocketOptionsReply) XXX_DiscardUnknown() { + xxx_messageInfo_GetSocketOptionsReply.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSocketOptionsReply proto.InternalMessageInfo + +func (m *GetSocketOptionsReply) GetOptions() []*SocketOption { + if m != nil { + return m.Options + } + return nil +} + +type ConnectRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + RemoteIp *AddressPort `protobuf:"bytes,2,req,name=remote_ip,json=remoteIp" json:"remote_ip,omitempty"` + TimeoutSeconds *float64 `protobuf:"fixed64,3,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConnectRequest) Reset() { *m = ConnectRequest{} } +func (m *ConnectRequest) String() string { return proto.CompactTextString(m) } +func (*ConnectRequest) ProtoMessage() {} +func (*ConnectRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{15} +} +func (m *ConnectRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConnectRequest.Unmarshal(m, b) +} +func (m *ConnectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConnectRequest.Marshal(b, m, deterministic) +} +func (dst *ConnectRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConnectRequest.Merge(dst, src) +} +func (m *ConnectRequest) XXX_Size() int { + return xxx_messageInfo_ConnectRequest.Size(m) +} +func (m *ConnectRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ConnectRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ConnectRequest proto.InternalMessageInfo + +const Default_ConnectRequest_TimeoutSeconds float64 = -1 + +func (m *ConnectRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *ConnectRequest) GetRemoteIp() *AddressPort { + if m != nil { + return m.RemoteIp + } + return nil +} + +func (m *ConnectRequest) GetTimeoutSeconds() float64 { + if m != nil && m.TimeoutSeconds != nil { + return *m.TimeoutSeconds + } + return Default_ConnectRequest_TimeoutSeconds +} + +type ConnectReply struct { + ProxyExternalIp *AddressPort `protobuf:"bytes,1,opt,name=proxy_external_ip,json=proxyExternalIp" json:"proxy_external_ip,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConnectReply) Reset() { *m = ConnectReply{} } +func (m *ConnectReply) String() string { return proto.CompactTextString(m) } +func (*ConnectReply) ProtoMessage() {} +func (*ConnectReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{16} +} + +var extRange_ConnectReply = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ConnectReply) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ConnectReply +} +func (m *ConnectReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConnectReply.Unmarshal(m, b) +} +func (m *ConnectReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConnectReply.Marshal(b, m, deterministic) +} +func (dst *ConnectReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConnectReply.Merge(dst, src) +} +func (m *ConnectReply) XXX_Size() int { + return xxx_messageInfo_ConnectReply.Size(m) +} +func (m *ConnectReply) XXX_DiscardUnknown() { + xxx_messageInfo_ConnectReply.DiscardUnknown(m) +} + +var xxx_messageInfo_ConnectReply proto.InternalMessageInfo + +func (m *ConnectReply) GetProxyExternalIp() *AddressPort { + if m != nil { + return m.ProxyExternalIp + } + return nil +} + +type ListenRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + Backlog *int32 `protobuf:"varint,2,req,name=backlog" json:"backlog,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListenRequest) Reset() { *m = ListenRequest{} } +func (m *ListenRequest) String() string { return proto.CompactTextString(m) } +func (*ListenRequest) ProtoMessage() {} +func (*ListenRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{17} +} +func (m *ListenRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListenRequest.Unmarshal(m, b) +} +func (m *ListenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListenRequest.Marshal(b, m, deterministic) +} +func (dst *ListenRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListenRequest.Merge(dst, src) +} +func (m *ListenRequest) XXX_Size() int { + return xxx_messageInfo_ListenRequest.Size(m) +} +func (m *ListenRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListenRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListenRequest proto.InternalMessageInfo + +func (m *ListenRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *ListenRequest) GetBacklog() int32 { + if m != nil && m.Backlog != nil { + return *m.Backlog + } + return 0 +} + +type ListenReply struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListenReply) Reset() { *m = ListenReply{} } +func (m *ListenReply) String() string { return proto.CompactTextString(m) } +func (*ListenReply) ProtoMessage() {} +func (*ListenReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{18} +} +func (m *ListenReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListenReply.Unmarshal(m, b) +} +func (m *ListenReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListenReply.Marshal(b, m, deterministic) +} +func (dst *ListenReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListenReply.Merge(dst, src) +} +func (m *ListenReply) XXX_Size() int { + return xxx_messageInfo_ListenReply.Size(m) +} +func (m *ListenReply) XXX_DiscardUnknown() { + xxx_messageInfo_ListenReply.DiscardUnknown(m) +} + +var xxx_messageInfo_ListenReply proto.InternalMessageInfo + +type AcceptRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + TimeoutSeconds *float64 `protobuf:"fixed64,2,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AcceptRequest) Reset() { *m = AcceptRequest{} } +func (m *AcceptRequest) String() string { return proto.CompactTextString(m) } +func (*AcceptRequest) ProtoMessage() {} +func (*AcceptRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{19} +} +func (m *AcceptRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AcceptRequest.Unmarshal(m, b) +} +func (m *AcceptRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AcceptRequest.Marshal(b, m, deterministic) +} +func (dst *AcceptRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AcceptRequest.Merge(dst, src) +} +func (m *AcceptRequest) XXX_Size() int { + return xxx_messageInfo_AcceptRequest.Size(m) +} +func (m *AcceptRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AcceptRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AcceptRequest proto.InternalMessageInfo + +const Default_AcceptRequest_TimeoutSeconds float64 = -1 + +func (m *AcceptRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *AcceptRequest) GetTimeoutSeconds() float64 { + if m != nil && m.TimeoutSeconds != nil { + return *m.TimeoutSeconds + } + return Default_AcceptRequest_TimeoutSeconds +} + +type AcceptReply struct { + NewSocketDescriptor []byte `protobuf:"bytes,2,opt,name=new_socket_descriptor,json=newSocketDescriptor" json:"new_socket_descriptor,omitempty"` + RemoteAddress *AddressPort `protobuf:"bytes,3,opt,name=remote_address,json=remoteAddress" json:"remote_address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AcceptReply) Reset() { *m = AcceptReply{} } +func (m *AcceptReply) String() string { return proto.CompactTextString(m) } +func (*AcceptReply) ProtoMessage() {} +func (*AcceptReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{20} +} +func (m *AcceptReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AcceptReply.Unmarshal(m, b) +} +func (m *AcceptReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AcceptReply.Marshal(b, m, deterministic) +} +func (dst *AcceptReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_AcceptReply.Merge(dst, src) +} +func (m *AcceptReply) XXX_Size() int { + return xxx_messageInfo_AcceptReply.Size(m) +} +func (m *AcceptReply) XXX_DiscardUnknown() { + xxx_messageInfo_AcceptReply.DiscardUnknown(m) +} + +var xxx_messageInfo_AcceptReply proto.InternalMessageInfo + +func (m *AcceptReply) GetNewSocketDescriptor() []byte { + if m != nil { + return m.NewSocketDescriptor + } + return nil +} + +func (m *AcceptReply) GetRemoteAddress() *AddressPort { + if m != nil { + return m.RemoteAddress + } + return nil +} + +type ShutDownRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + How *ShutDownRequest_How `protobuf:"varint,2,req,name=how,enum=appengine.ShutDownRequest_How" json:"how,omitempty"` + SendOffset *int64 `protobuf:"varint,3,req,name=send_offset,json=sendOffset" json:"send_offset,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ShutDownRequest) Reset() { *m = ShutDownRequest{} } +func (m *ShutDownRequest) String() string { return proto.CompactTextString(m) } +func (*ShutDownRequest) ProtoMessage() {} +func (*ShutDownRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{21} +} +func (m *ShutDownRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ShutDownRequest.Unmarshal(m, b) +} +func (m *ShutDownRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ShutDownRequest.Marshal(b, m, deterministic) +} +func (dst *ShutDownRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ShutDownRequest.Merge(dst, src) +} +func (m *ShutDownRequest) XXX_Size() int { + return xxx_messageInfo_ShutDownRequest.Size(m) +} +func (m *ShutDownRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ShutDownRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ShutDownRequest proto.InternalMessageInfo + +func (m *ShutDownRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *ShutDownRequest) GetHow() ShutDownRequest_How { + if m != nil && m.How != nil { + return *m.How + } + return ShutDownRequest_SOCKET_SHUT_RD +} + +func (m *ShutDownRequest) GetSendOffset() int64 { + if m != nil && m.SendOffset != nil { + return *m.SendOffset + } + return 0 +} + +type ShutDownReply struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ShutDownReply) Reset() { *m = ShutDownReply{} } +func (m *ShutDownReply) String() string { return proto.CompactTextString(m) } +func (*ShutDownReply) ProtoMessage() {} +func (*ShutDownReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{22} +} +func (m *ShutDownReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ShutDownReply.Unmarshal(m, b) +} +func (m *ShutDownReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ShutDownReply.Marshal(b, m, deterministic) +} +func (dst *ShutDownReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_ShutDownReply.Merge(dst, src) +} +func (m *ShutDownReply) XXX_Size() int { + return xxx_messageInfo_ShutDownReply.Size(m) +} +func (m *ShutDownReply) XXX_DiscardUnknown() { + xxx_messageInfo_ShutDownReply.DiscardUnknown(m) +} + +var xxx_messageInfo_ShutDownReply proto.InternalMessageInfo + +type CloseRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + SendOffset *int64 `protobuf:"varint,2,opt,name=send_offset,json=sendOffset,def=-1" json:"send_offset,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CloseRequest) Reset() { *m = CloseRequest{} } +func (m *CloseRequest) String() string { return proto.CompactTextString(m) } +func (*CloseRequest) ProtoMessage() {} +func (*CloseRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{23} +} +func (m *CloseRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CloseRequest.Unmarshal(m, b) +} +func (m *CloseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CloseRequest.Marshal(b, m, deterministic) +} +func (dst *CloseRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CloseRequest.Merge(dst, src) +} +func (m *CloseRequest) XXX_Size() int { + return xxx_messageInfo_CloseRequest.Size(m) +} +func (m *CloseRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CloseRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CloseRequest proto.InternalMessageInfo + +const Default_CloseRequest_SendOffset int64 = -1 + +func (m *CloseRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *CloseRequest) GetSendOffset() int64 { + if m != nil && m.SendOffset != nil { + return *m.SendOffset + } + return Default_CloseRequest_SendOffset +} + +type CloseReply struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CloseReply) Reset() { *m = CloseReply{} } +func (m *CloseReply) String() string { return proto.CompactTextString(m) } +func (*CloseReply) ProtoMessage() {} +func (*CloseReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{24} +} +func (m *CloseReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CloseReply.Unmarshal(m, b) +} +func (m *CloseReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CloseReply.Marshal(b, m, deterministic) +} +func (dst *CloseReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_CloseReply.Merge(dst, src) +} +func (m *CloseReply) XXX_Size() int { + return xxx_messageInfo_CloseReply.Size(m) +} +func (m *CloseReply) XXX_DiscardUnknown() { + xxx_messageInfo_CloseReply.DiscardUnknown(m) +} + +var xxx_messageInfo_CloseReply proto.InternalMessageInfo + +type SendRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + Data []byte `protobuf:"bytes,2,req,name=data" json:"data,omitempty"` + StreamOffset *int64 `protobuf:"varint,3,req,name=stream_offset,json=streamOffset" json:"stream_offset,omitempty"` + Flags *int32 `protobuf:"varint,4,opt,name=flags,def=0" json:"flags,omitempty"` + SendTo *AddressPort `protobuf:"bytes,5,opt,name=send_to,json=sendTo" json:"send_to,omitempty"` + TimeoutSeconds *float64 `protobuf:"fixed64,6,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SendRequest) Reset() { *m = SendRequest{} } +func (m *SendRequest) String() string { return proto.CompactTextString(m) } +func (*SendRequest) ProtoMessage() {} +func (*SendRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{25} +} +func (m *SendRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SendRequest.Unmarshal(m, b) +} +func (m *SendRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SendRequest.Marshal(b, m, deterministic) +} +func (dst *SendRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SendRequest.Merge(dst, src) +} +func (m *SendRequest) XXX_Size() int { + return xxx_messageInfo_SendRequest.Size(m) +} +func (m *SendRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SendRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SendRequest proto.InternalMessageInfo + +const Default_SendRequest_Flags int32 = 0 +const Default_SendRequest_TimeoutSeconds float64 = -1 + +func (m *SendRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *SendRequest) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *SendRequest) GetStreamOffset() int64 { + if m != nil && m.StreamOffset != nil { + return *m.StreamOffset + } + return 0 +} + +func (m *SendRequest) GetFlags() int32 { + if m != nil && m.Flags != nil { + return *m.Flags + } + return Default_SendRequest_Flags +} + +func (m *SendRequest) GetSendTo() *AddressPort { + if m != nil { + return m.SendTo + } + return nil +} + +func (m *SendRequest) GetTimeoutSeconds() float64 { + if m != nil && m.TimeoutSeconds != nil { + return *m.TimeoutSeconds + } + return Default_SendRequest_TimeoutSeconds +} + +type SendReply struct { + DataSent *int32 `protobuf:"varint,1,opt,name=data_sent,json=dataSent" json:"data_sent,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SendReply) Reset() { *m = SendReply{} } +func (m *SendReply) String() string { return proto.CompactTextString(m) } +func (*SendReply) ProtoMessage() {} +func (*SendReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{26} +} +func (m *SendReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SendReply.Unmarshal(m, b) +} +func (m *SendReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SendReply.Marshal(b, m, deterministic) +} +func (dst *SendReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_SendReply.Merge(dst, src) +} +func (m *SendReply) XXX_Size() int { + return xxx_messageInfo_SendReply.Size(m) +} +func (m *SendReply) XXX_DiscardUnknown() { + xxx_messageInfo_SendReply.DiscardUnknown(m) +} + +var xxx_messageInfo_SendReply proto.InternalMessageInfo + +func (m *SendReply) GetDataSent() int32 { + if m != nil && m.DataSent != nil { + return *m.DataSent + } + return 0 +} + +type ReceiveRequest struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + DataSize *int32 `protobuf:"varint,2,req,name=data_size,json=dataSize" json:"data_size,omitempty"` + Flags *int32 `protobuf:"varint,3,opt,name=flags,def=0" json:"flags,omitempty"` + TimeoutSeconds *float64 `protobuf:"fixed64,5,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ReceiveRequest) Reset() { *m = ReceiveRequest{} } +func (m *ReceiveRequest) String() string { return proto.CompactTextString(m) } +func (*ReceiveRequest) ProtoMessage() {} +func (*ReceiveRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{27} +} +func (m *ReceiveRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReceiveRequest.Unmarshal(m, b) +} +func (m *ReceiveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReceiveRequest.Marshal(b, m, deterministic) +} +func (dst *ReceiveRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReceiveRequest.Merge(dst, src) +} +func (m *ReceiveRequest) XXX_Size() int { + return xxx_messageInfo_ReceiveRequest.Size(m) +} +func (m *ReceiveRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ReceiveRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ReceiveRequest proto.InternalMessageInfo + +const Default_ReceiveRequest_Flags int32 = 0 +const Default_ReceiveRequest_TimeoutSeconds float64 = -1 + +func (m *ReceiveRequest) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *ReceiveRequest) GetDataSize() int32 { + if m != nil && m.DataSize != nil { + return *m.DataSize + } + return 0 +} + +func (m *ReceiveRequest) GetFlags() int32 { + if m != nil && m.Flags != nil { + return *m.Flags + } + return Default_ReceiveRequest_Flags +} + +func (m *ReceiveRequest) GetTimeoutSeconds() float64 { + if m != nil && m.TimeoutSeconds != nil { + return *m.TimeoutSeconds + } + return Default_ReceiveRequest_TimeoutSeconds +} + +type ReceiveReply struct { + StreamOffset *int64 `protobuf:"varint,2,opt,name=stream_offset,json=streamOffset" json:"stream_offset,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"` + ReceivedFrom *AddressPort `protobuf:"bytes,4,opt,name=received_from,json=receivedFrom" json:"received_from,omitempty"` + BufferSize *int32 `protobuf:"varint,5,opt,name=buffer_size,json=bufferSize" json:"buffer_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ReceiveReply) Reset() { *m = ReceiveReply{} } +func (m *ReceiveReply) String() string { return proto.CompactTextString(m) } +func (*ReceiveReply) ProtoMessage() {} +func (*ReceiveReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{28} +} +func (m *ReceiveReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReceiveReply.Unmarshal(m, b) +} +func (m *ReceiveReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReceiveReply.Marshal(b, m, deterministic) +} +func (dst *ReceiveReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReceiveReply.Merge(dst, src) +} +func (m *ReceiveReply) XXX_Size() int { + return xxx_messageInfo_ReceiveReply.Size(m) +} +func (m *ReceiveReply) XXX_DiscardUnknown() { + xxx_messageInfo_ReceiveReply.DiscardUnknown(m) +} + +var xxx_messageInfo_ReceiveReply proto.InternalMessageInfo + +func (m *ReceiveReply) GetStreamOffset() int64 { + if m != nil && m.StreamOffset != nil { + return *m.StreamOffset + } + return 0 +} + +func (m *ReceiveReply) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *ReceiveReply) GetReceivedFrom() *AddressPort { + if m != nil { + return m.ReceivedFrom + } + return nil +} + +func (m *ReceiveReply) GetBufferSize() int32 { + if m != nil && m.BufferSize != nil { + return *m.BufferSize + } + return 0 +} + +type PollEvent struct { + SocketDescriptor *string `protobuf:"bytes,1,req,name=socket_descriptor,json=socketDescriptor" json:"socket_descriptor,omitempty"` + RequestedEvents *int32 `protobuf:"varint,2,req,name=requested_events,json=requestedEvents" json:"requested_events,omitempty"` + ObservedEvents *int32 `protobuf:"varint,3,req,name=observed_events,json=observedEvents" json:"observed_events,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PollEvent) Reset() { *m = PollEvent{} } +func (m *PollEvent) String() string { return proto.CompactTextString(m) } +func (*PollEvent) ProtoMessage() {} +func (*PollEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{29} +} +func (m *PollEvent) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PollEvent.Unmarshal(m, b) +} +func (m *PollEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PollEvent.Marshal(b, m, deterministic) +} +func (dst *PollEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_PollEvent.Merge(dst, src) +} +func (m *PollEvent) XXX_Size() int { + return xxx_messageInfo_PollEvent.Size(m) +} +func (m *PollEvent) XXX_DiscardUnknown() { + xxx_messageInfo_PollEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_PollEvent proto.InternalMessageInfo + +func (m *PollEvent) GetSocketDescriptor() string { + if m != nil && m.SocketDescriptor != nil { + return *m.SocketDescriptor + } + return "" +} + +func (m *PollEvent) GetRequestedEvents() int32 { + if m != nil && m.RequestedEvents != nil { + return *m.RequestedEvents + } + return 0 +} + +func (m *PollEvent) GetObservedEvents() int32 { + if m != nil && m.ObservedEvents != nil { + return *m.ObservedEvents + } + return 0 +} + +type PollRequest struct { + Events []*PollEvent `protobuf:"bytes,1,rep,name=events" json:"events,omitempty"` + TimeoutSeconds *float64 `protobuf:"fixed64,2,opt,name=timeout_seconds,json=timeoutSeconds,def=-1" json:"timeout_seconds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PollRequest) Reset() { *m = PollRequest{} } +func (m *PollRequest) String() string { return proto.CompactTextString(m) } +func (*PollRequest) ProtoMessage() {} +func (*PollRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{30} +} +func (m *PollRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PollRequest.Unmarshal(m, b) +} +func (m *PollRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PollRequest.Marshal(b, m, deterministic) +} +func (dst *PollRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PollRequest.Merge(dst, src) +} +func (m *PollRequest) XXX_Size() int { + return xxx_messageInfo_PollRequest.Size(m) +} +func (m *PollRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PollRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PollRequest proto.InternalMessageInfo + +const Default_PollRequest_TimeoutSeconds float64 = -1 + +func (m *PollRequest) GetEvents() []*PollEvent { + if m != nil { + return m.Events + } + return nil +} + +func (m *PollRequest) GetTimeoutSeconds() float64 { + if m != nil && m.TimeoutSeconds != nil { + return *m.TimeoutSeconds + } + return Default_PollRequest_TimeoutSeconds +} + +type PollReply struct { + Events []*PollEvent `protobuf:"bytes,2,rep,name=events" json:"events,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PollReply) Reset() { *m = PollReply{} } +func (m *PollReply) String() string { return proto.CompactTextString(m) } +func (*PollReply) ProtoMessage() {} +func (*PollReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{31} +} +func (m *PollReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PollReply.Unmarshal(m, b) +} +func (m *PollReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PollReply.Marshal(b, m, deterministic) +} +func (dst *PollReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_PollReply.Merge(dst, src) +} +func (m *PollReply) XXX_Size() int { + return xxx_messageInfo_PollReply.Size(m) +} +func (m *PollReply) XXX_DiscardUnknown() { + xxx_messageInfo_PollReply.DiscardUnknown(m) +} + +var xxx_messageInfo_PollReply proto.InternalMessageInfo + +func (m *PollReply) GetEvents() []*PollEvent { + if m != nil { + return m.Events + } + return nil +} + +type ResolveRequest struct { + Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` + AddressFamilies []CreateSocketRequest_SocketFamily `protobuf:"varint,2,rep,name=address_families,json=addressFamilies,enum=appengine.CreateSocketRequest_SocketFamily" json:"address_families,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResolveRequest) Reset() { *m = ResolveRequest{} } +func (m *ResolveRequest) String() string { return proto.CompactTextString(m) } +func (*ResolveRequest) ProtoMessage() {} +func (*ResolveRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{32} +} +func (m *ResolveRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResolveRequest.Unmarshal(m, b) +} +func (m *ResolveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResolveRequest.Marshal(b, m, deterministic) +} +func (dst *ResolveRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResolveRequest.Merge(dst, src) +} +func (m *ResolveRequest) XXX_Size() int { + return xxx_messageInfo_ResolveRequest.Size(m) +} +func (m *ResolveRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ResolveRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ResolveRequest proto.InternalMessageInfo + +func (m *ResolveRequest) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *ResolveRequest) GetAddressFamilies() []CreateSocketRequest_SocketFamily { + if m != nil { + return m.AddressFamilies + } + return nil +} + +type ResolveReply struct { + PackedAddress [][]byte `protobuf:"bytes,2,rep,name=packed_address,json=packedAddress" json:"packed_address,omitempty"` + CanonicalName *string `protobuf:"bytes,3,opt,name=canonical_name,json=canonicalName" json:"canonical_name,omitempty"` + Aliases []string `protobuf:"bytes,4,rep,name=aliases" json:"aliases,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResolveReply) Reset() { *m = ResolveReply{} } +func (m *ResolveReply) String() string { return proto.CompactTextString(m) } +func (*ResolveReply) ProtoMessage() {} +func (*ResolveReply) Descriptor() ([]byte, []int) { + return fileDescriptor_socket_service_b5f8f233dc327808, []int{33} +} +func (m *ResolveReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResolveReply.Unmarshal(m, b) +} +func (m *ResolveReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResolveReply.Marshal(b, m, deterministic) +} +func (dst *ResolveReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResolveReply.Merge(dst, src) +} +func (m *ResolveReply) XXX_Size() int { + return xxx_messageInfo_ResolveReply.Size(m) +} +func (m *ResolveReply) XXX_DiscardUnknown() { + xxx_messageInfo_ResolveReply.DiscardUnknown(m) +} + +var xxx_messageInfo_ResolveReply proto.InternalMessageInfo + +func (m *ResolveReply) GetPackedAddress() [][]byte { + if m != nil { + return m.PackedAddress + } + return nil +} + +func (m *ResolveReply) GetCanonicalName() string { + if m != nil && m.CanonicalName != nil { + return *m.CanonicalName + } + return "" +} + +func (m *ResolveReply) GetAliases() []string { + if m != nil { + return m.Aliases + } + return nil +} + +func init() { + proto.RegisterType((*RemoteSocketServiceError)(nil), "appengine.RemoteSocketServiceError") + proto.RegisterType((*AddressPort)(nil), "appengine.AddressPort") + proto.RegisterType((*CreateSocketRequest)(nil), "appengine.CreateSocketRequest") + proto.RegisterType((*CreateSocketReply)(nil), "appengine.CreateSocketReply") + proto.RegisterType((*BindRequest)(nil), "appengine.BindRequest") + proto.RegisterType((*BindReply)(nil), "appengine.BindReply") + proto.RegisterType((*GetSocketNameRequest)(nil), "appengine.GetSocketNameRequest") + proto.RegisterType((*GetSocketNameReply)(nil), "appengine.GetSocketNameReply") + proto.RegisterType((*GetPeerNameRequest)(nil), "appengine.GetPeerNameRequest") + proto.RegisterType((*GetPeerNameReply)(nil), "appengine.GetPeerNameReply") + proto.RegisterType((*SocketOption)(nil), "appengine.SocketOption") + proto.RegisterType((*SetSocketOptionsRequest)(nil), "appengine.SetSocketOptionsRequest") + proto.RegisterType((*SetSocketOptionsReply)(nil), "appengine.SetSocketOptionsReply") + proto.RegisterType((*GetSocketOptionsRequest)(nil), "appengine.GetSocketOptionsRequest") + proto.RegisterType((*GetSocketOptionsReply)(nil), "appengine.GetSocketOptionsReply") + proto.RegisterType((*ConnectRequest)(nil), "appengine.ConnectRequest") + proto.RegisterType((*ConnectReply)(nil), "appengine.ConnectReply") + proto.RegisterType((*ListenRequest)(nil), "appengine.ListenRequest") + proto.RegisterType((*ListenReply)(nil), "appengine.ListenReply") + proto.RegisterType((*AcceptRequest)(nil), "appengine.AcceptRequest") + proto.RegisterType((*AcceptReply)(nil), "appengine.AcceptReply") + proto.RegisterType((*ShutDownRequest)(nil), "appengine.ShutDownRequest") + proto.RegisterType((*ShutDownReply)(nil), "appengine.ShutDownReply") + proto.RegisterType((*CloseRequest)(nil), "appengine.CloseRequest") + proto.RegisterType((*CloseReply)(nil), "appengine.CloseReply") + proto.RegisterType((*SendRequest)(nil), "appengine.SendRequest") + proto.RegisterType((*SendReply)(nil), "appengine.SendReply") + proto.RegisterType((*ReceiveRequest)(nil), "appengine.ReceiveRequest") + proto.RegisterType((*ReceiveReply)(nil), "appengine.ReceiveReply") + proto.RegisterType((*PollEvent)(nil), "appengine.PollEvent") + proto.RegisterType((*PollRequest)(nil), "appengine.PollRequest") + proto.RegisterType((*PollReply)(nil), "appengine.PollReply") + proto.RegisterType((*ResolveRequest)(nil), "appengine.ResolveRequest") + proto.RegisterType((*ResolveReply)(nil), "appengine.ResolveReply") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/socket/socket_service.proto", fileDescriptor_socket_service_b5f8f233dc327808) +} + +var fileDescriptor_socket_service_b5f8f233dc327808 = []byte{ + // 3088 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0x5f, 0x77, 0xe3, 0xc6, + 0x75, 0x37, 0x48, 0xfd, 0xe3, 0x90, 0x94, 0xee, 0x62, 0xa5, 0x5d, 0x25, 0x6e, 0x12, 0x05, 0x8e, + 0x1b, 0x25, 0x8e, 0x77, 0x6d, 0x39, 0x4d, 0x9b, 0xa4, 0x49, 0x16, 0x04, 0x86, 0x24, 0x4c, 0x00, + 0x03, 0xcd, 0x0c, 0x25, 0xd1, 0x6d, 0x8a, 0xd0, 0x22, 0xa4, 0x65, 0x4c, 0x11, 0x0c, 0xc9, 0xdd, + 0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xa5, 0x9a, 0x44, 0xc2, + 0xad, 0x6e, 0x14, 0x41, 0xac, 0x1f, 0x7b, 0xac, 0x2b, 0x80, 0x85, 0x9f, 0x51, 0xb3, 0x58, 0xfa, + 0x2b, 0x85, 0xda, 0x1a, 0xda, 0x57, 0x0a, 0x45, 0x3c, 0x5e, 0xd8, 0x65, 0x18, 0x3e, 0x15, 0x77, + 0x9c, 0xc2, 0x42, 0xc2, 0xed, 0x13, 0xdb, 0xf3, 0xe1, 0xbc, 0x48, 0x08, 0xe6, 0x2e, 0x39, 0x0d, + 0x61, 0x50, 0x04, 0x85, 0x79, 0x37, 0xa4, 0xd8, 0x76, 0xda, 0x90, 0x14, 0xc7, 0x07, 0xe6, 0x14, + 0x33, 0xcc, 0xe1, 0x42, 0x99, 0x76, 0x48, 0x18, 0xda, 0x0d, 0x42, 0x39, 0x76, 0xe1, 0x52, 0x99, + 0x16, 0x68, 0x26, 0xf9, 0x58, 0x8b, 0xa5, 0xd1, 0x6d, 0x32, 0x18, 0x2a, 0xc0, 0x63, 0x42, 0x0c, + 0x7e, 0xad, 0x97, 0x45, 0x22, 0x9f, 0x29, 0x83, 0xac, 0xdd, 0xcd, 0x1c, 0x1b, 0x29, 0x83, 0x9c, + 0x90, 0xc0, 0x0e, 0x7b, 0x14, 0x37, 0x19, 0x5c, 0x29, 0x41, 0xb1, 0x07, 0x5d, 0xd2, 0xe5, 0x30, + 0x5e, 0xf2, 0x8c, 0xe2, 0x66, 0x57, 0xdc, 0xd2, 0xa9, 0x12, 0x6c, 0x13, 0x96, 0x69, 0x9c, 0x28, + 0x41, 0x01, 0x2d, 0x62, 0xfd, 0x8d, 0x72, 0xc6, 0xf6, 0x29, 0xb6, 0xdd, 0x1e, 0x4c, 0x55, 0x4a, + 0xbc, 0x30, 0xa2, 0xa4, 0x45, 0xc5, 0xa5, 0x3e, 0x2b, 0xb6, 0x23, 0xb7, 0x7d, 0x0c, 0xf3, 0xe2, + 0x38, 0x73, 0x7c, 0x6c, 0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0x15, 0xd1, 0xc1, 0xaf, 0xef, 0x8a, 0x45, 0x50, 0x25, 0xb3, 0x2f, 0xf2, + 0x78, 0xa3, 0x42, 0xe3, 0x8d, 0x62, 0xb3, 0x1c, 0xb4, 0xdb, 0x4a, 0xe6, 0x59, 0x75, 0xc2, 0xfe, + 0x55, 0x72, 0x9b, 0xc8, 0xac, 0x33, 0x64, 0xae, 0x28, 0x79, 0xa9, 0x7b, 0xa5, 0x37, 0x73, 0xcf, + 0x96, 0x9a, 0xa3, 0x24, 0x99, 0xde, 0xda, 0x39, 0x07, 0xc1, 0x92, 0x0a, 0xe1, 0xda, 0x43, 0xb4, + 0x39, 0x49, 0x92, 0xe9, 0x57, 0x3b, 0xb4, 0x21, 0xc4, 0xbc, 0x89, 0xf5, 0xe5, 0xe6, 0x62, 0x47, + 0x64, 0x7b, 0xdf, 0xfc, 0x05, 0x5a, 0x1f, 0x25, 0x4f, 0x93, 0x51, 0x7e, 0x92, 0x7d, 0xef, 0x25, + 0x27, 0xc6, 0x12, 0xe1, 0x8b, 0x05, 0x34, 0x5b, 0x67, 0x3e, 0x42, 0x1b, 0xd9, 0xa1, 0x93, 0x1f, + 0x62, 0x87, 0xaf, 0xa3, 0x41, 0x46, 0x90, 0xaf, 0x33, 0x77, 0xd1, 0xfa, 0xd3, 0xfe, 0xe8, 0x49, + 0xb2, 0x5f, 0x3e, 0x28, 0x1d, 0xd6, 0x68, 0x46, 0x58, 0x09, 0xba, 0xf3, 0x82, 0x4d, 0xed, 0x41, + 0xcd, 0x88, 0x1f, 0x7b, 0x11, 0xbc, 0x25, 0x67, 0x95, 0x02, 0xca, 0xfe, 0x05, 0x43, 0xce, 0x16, + 0x05, 0x2c, 0xb6, 0xf3, 0xc6, 0x0a, 0x26, 0x76, 0xf6, 0x1d, 0xeb, 0xdf, 0xd7, 0x11, 0xac, 0x7a, + 0x26, 0x6f, 0xbb, 0x85, 0x60, 0xec, 0xe2, 0x46, 0xb7, 0x05, 0x86, 0x1c, 0xc9, 0x14, 0x48, 0xc5, + 0x94, 0x28, 0xc6, 0x23, 0x28, 0x2d, 0xa9, 0x8d, 0xe5, 0x95, 0x5a, 0x5e, 0xd6, 0x90, 0x7d, 0x47, + 0x58, 0x5b, 0xd6, 0xe0, 0x92, 0x90, 0x53, 0xd2, 0xe5, 0x18, 0xd6, 0x97, 0x19, 0x0d, 0x4a, 0x6c, + 0xd7, 0xb1, 0xe5, 0x07, 0x04, 0x31, 0x74, 0x28, 0x06, 0x0b, 0xdd, 0x46, 0xb7, 0x09, 0x9b, 0xcb, + 0x28, 0x75, 0x4e, 0x04, 0xba, 0xb5, 0xac, 0xa4, 0x83, 0x71, 0x64, 0xfb, 0xde, 0x09, 0x86, 0xca, + 0x32, 0x83, 0x90, 0x86, 0x17, 0xfa, 0x5e, 0x88, 0x01, 0x2d, 0xeb, 0xf1, 0xbd, 0xb0, 0x85, 0x29, + 0xd4, 0xcd, 0x7b, 0xc8, 0x5c, 0xd2, 0x2e, 0x86, 0x25, 0x02, 0xbb, 0xcb, 0x38, 0x0b, 0xdd, 0x0c, + 0xdf, 0xd3, 0x6a, 0xe2, 0x45, 0x31, 0x27, 0x0c, 0x8c, 0x15, 0x88, 0xfb, 0x50, 0xd2, 0xca, 0xe4, + 0x45, 0x71, 0x5b, 0x8c, 0x9a, 0x8e, 0x0f, 0xe5, 0x65, 0x98, 0x44, 0xdc, 0x23, 0x21, 0x83, 0x35, + 0xcd, 0x16, 0x77, 0xa2, 0x58, 0x3c, 0xef, 0x7d, 0xbb, 0x07, 0x86, 0x26, 0x2e, 0xf0, 0xc0, 0x3e, + 0x63, 0xb8, 0x05, 0x25, 0x2d, 0xdb, 0x02, 0x76, 0x08, 0xed, 0x40, 0x59, 0x0b, 0x5b, 0x80, 0x22, + 0x21, 0x9e, 0xeb, 0x63, 0x58, 0x33, 0xf7, 0xd1, 0xee, 0x2a, 0x23, 0xe4, 0x27, 0x3e, 0xac, 0xaf, + 0x98, 0x15, 0x1c, 0x27, 0x14,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, + 0x8b, 0x2d, 0x3d, 0xe3, 0x04, 0xa3, 0x69, 0x7b, 0x7e, 0xf6, 0x0b, 0xf0, 0x12, 0x28, 0x55, 0xaf, + 0xaf, 0xc0, 0x01, 0x0e, 0x08, 0xed, 0x2d, 0xbd, 0x1d, 0x04, 0x9c, 0xff, 0x1c, 0xb4, 0xf9, 0x02, + 0x1c, 0xda, 0x01, 0x86, 0x2d, 0xed, 0x49, 0x21, 0x60, 0x86, 0xe9, 0x89, 0xe7, 0x2c, 0xbf, 0xe1, + 0x24, 0x4e, 0x9c, 0x8e, 0x7c, 0x68, 0xa2, 0x15, 0x3d, 0xd9, 0xef, 0xd8, 0x4b, 0x6f, 0x86, 0x3c, + 0xa2, 0xb6, 0x17, 0x72, 0x06, 0xb5, 0x15, 0x86, 0xfc, 0xdd, 0xc1, 0x21, 0x3e, 0xd4, 0x57, 0x18, + 0xea, 0x37, 0x9d, 0x6d, 0x6d, 0x0f, 0xcb, 0xb8, 0xec, 0x33, 0xd8, 0x69, 0x6c, 0x7d, 0xb2, 0x91, + 0x9d, 0x5a, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x31, 0x03, 0x4e, 0xbd, 0xfd, 0x1f, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/socket/socket_service.proto b/vendor/google.golang.org/appengine/internal/socket/socket_service.proto new file mode 100644 index 000000000..2fcc7953d --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/socket/socket_service.proto @@ -0,0 +1,460 @@ +syntax = "proto2"; +option go_package = "socket"; + +package appengine; + +message RemoteSocketServiceError { + enum ErrorCode { + SYSTEM_ERROR = 1; + GAI_ERROR = 2; + FAILURE = 4; + PERMISSION_DENIED = 5; + INVALID_REQUEST = 6; + SOCKET_CLOSED = 7; + } + + enum SystemError { + option allow_alias = true; + + SYS_SUCCESS = 0; + SYS_EPERM = 1; + SYS_ENOENT = 2; + SYS_ESRCH = 3; + SYS_EINTR = 4; + SYS_EIO = 5; + SYS_ENXIO = 6; + SYS_E2BIG = 7; + SYS_ENOEXEC = 8; + SYS_EBADF = 9; + SYS_ECHILD = 10; + SYS_EAGAIN = 11; + SYS_EWOULDBLOCK = 11; + SYS_ENOMEM = 12; + SYS_EACCES = 13; + SYS_EFAULT = 14; + SYS_ENOTBLK = 15; + SYS_EBUSY = 16; + SYS_EEXIST = 17; + SYS_EXDEV = 18; + SYS_ENODEV = 19; + SYS_ENOTDIR = 20; + SYS_EISDIR = 21; + SYS_EINVAL = 22; + SYS_ENFILE = 23; + SYS_EMFILE = 24; + SYS_ENOTTY = 25; + SYS_ETXTBSY = 26; + SYS_EFBIG = 27; + SYS_ENOSPC = 28; + SYS_ESPIPE = 29; + SYS_EROFS = 30; + SYS_EMLINK = 31; + SYS_EPIPE = 32; + SYS_EDOM = 33; + SYS_ERANGE = 34; + SYS_EDEADLK = 35; + SYS_EDEADLOCK = 35; + SYS_ENAMETOOLONG = 36; + SYS_ENOLCK = 37; + SYS_ENOSYS = 38; + SYS_ENOTEMPTY = 39; + SYS_ELOOP = 40; + SYS_ENOMSG = 42; + SYS_EIDRM = 43; + SYS_ECHRNG = 44; + SYS_EL2NSYNC = 45; + SYS_EL3HLT = 46; + SYS_EL3RST = 47; + SYS_ELNRNG = 48; + SYS_EUNATCH = 49; + SYS_ENOCSI = 50; + SYS_EL2HLT = 51; + SYS_EBADE = 52; + SYS_EBADR = 53; + SYS_EXFULL = 54; + SYS_ENOANO = 55; + SYS_EBADRQC = 56; + SYS_EBADSLT = 57; + SYS_EBFONT = 59; + SYS_ENOSTR = 60; + SYS_ENODATA = 61; + SYS_ETIME = 62; + SYS_ENOSR = 63; + SYS_ENONET = 64; + SYS_ENOPKG = 65; + SYS_EREMOTE = 66; + SYS_ENOLINK = 67; + SYS_EADV = 68; + SYS_ESRMNT = 69; + SYS_ECOMM = 70; + SYS_EPROTO = 71; + SYS_EMULTIHOP = 72; + SYS_EDOTDOT = 73; + SYS_EBADMSG = 74; + SYS_EOVERFLOW = 75; + SYS_ENOTUNIQ = 76; + SYS_EBADFD = 77; + SYS_EREMCHG = 78; + SYS_ELIBACC = 79; + SYS_ELIBBAD = 80; + SYS_ELIBSCN = 81; + SYS_ELIBMAX = 82; + SYS_ELIBEXEC = 83; + SYS_EILSEQ = 84; + SYS_ERESTART = 85; + SYS_ESTRPIPE = 86; + SYS_EUSERS = 87; + SYS_ENOTSOCK = 88; + SYS_EDESTADDRREQ = 89; + SYS_EMSGSIZE = 90; + SYS_EPROTOTYPE = 91; + SYS_ENOPROTOOPT = 92; + SYS_EPROTONOSUPPORT = 93; + SYS_ESOCKTNOSUPPORT = 94; + SYS_EOPNOTSUPP = 95; + SYS_ENOTSUP = 95; + SYS_EPFNOSUPPORT = 96; + SYS_EAFNOSUPPORT = 97; + SYS_EADDRINUSE = 98; + SYS_EADDRNOTAVAIL = 99; + SYS_ENETDOWN = 100; + SYS_ENETUNREACH = 101; + SYS_ENETRESET = 102; + SYS_ECONNABORTED = 103; + SYS_ECONNRESET = 104; + SYS_ENOBUFS = 105; + SYS_EISCONN = 106; + SYS_ENOTCONN = 107; + SYS_ESHUTDOWN = 108; + SYS_ETOOMANYREFS = 109; + SYS_ETIMEDOUT = 110; + SYS_ECONNREFUSED = 111; + SYS_EHOSTDOWN = 112; + SYS_EHOSTUNREACH = 113; + SYS_EALREADY = 114; + SYS_EINPROGRESS = 115; + SYS_ESTALE = 116; + SYS_EUCLEAN = 117; + SYS_ENOTNAM = 118; + SYS_ENAVAIL = 119; + SYS_EISNAM = 120; + SYS_EREMOTEIO = 121; + SYS_EDQUOT = 122; + SYS_ENOMEDIUM = 123; + SYS_EMEDIUMTYPE = 124; + SYS_ECANCELED = 125; + SYS_ENOKEY = 126; + SYS_EKEYEXPIRED = 127; + SYS_EKEYREVOKED = 128; + SYS_EKEYREJECTED = 129; + SYS_EOWNERDEAD = 130; + SYS_ENOTRECOVERABLE = 131; + SYS_ERFKILL = 132; + } + + optional int32 system_error = 1 [default=0]; + optional string error_detail = 2; +} + +message AddressPort { + required int32 port = 1; + optional bytes packed_address = 2; + + optional string hostname_hint = 3; +} + + + +message CreateSocketRequest { + enum SocketFamily { + IPv4 = 1; + IPv6 = 2; + } + + enum SocketProtocol { + TCP = 1; + UDP = 2; + } + + required SocketFamily family = 1; + required SocketProtocol protocol = 2; + + repeated SocketOption socket_options = 3; + + optional AddressPort proxy_external_ip = 4; + + optional int32 listen_backlog = 5 [default=0]; + + optional AddressPort remote_ip = 6; + + optional string app_id = 9; + + optional int64 project_id = 10; +} + +message CreateSocketReply { + optional string socket_descriptor = 1; + + optional AddressPort server_address = 3; + + optional AddressPort proxy_external_ip = 4; + + extensions 1000 to max; +} + + + +message BindRequest { + required string socket_descriptor = 1; + required AddressPort proxy_external_ip = 2; +} + +message BindReply { + optional AddressPort proxy_external_ip = 1; +} + + + +message GetSocketNameRequest { + required string socket_descriptor = 1; +} + +message GetSocketNameReply { + optional AddressPort proxy_external_ip = 2; +} + + + +message GetPeerNameRequest { + required string socket_descriptor = 1; +} + +message GetPeerNameReply { + optional AddressPort peer_ip = 2; +} + + +message SocketOption { + + enum SocketOptionLevel { + SOCKET_SOL_IP = 0; + SOCKET_SOL_SOCKET = 1; + SOCKET_SOL_TCP = 6; + SOCKET_SOL_UDP = 17; + } + + enum SocketOptionName { + option allow_alias = true; + + SOCKET_SO_DEBUG = 1; + SOCKET_SO_REUSEADDR = 2; + SOCKET_SO_TYPE = 3; + SOCKET_SO_ERROR = 4; + SOCKET_SO_DONTROUTE = 5; + SOCKET_SO_BROADCAST = 6; + SOCKET_SO_SNDBUF = 7; + SOCKET_SO_RCVBUF = 8; + SOCKET_SO_KEEPALIVE = 9; + SOCKET_SO_OOBINLINE = 10; + SOCKET_SO_LINGER = 13; + SOCKET_SO_RCVTIMEO = 20; + SOCKET_SO_SNDTIMEO = 21; + + SOCKET_IP_TOS = 1; + SOCKET_IP_TTL = 2; + SOCKET_IP_HDRINCL = 3; + SOCKET_IP_OPTIONS = 4; + + SOCKET_TCP_NODELAY = 1; + SOCKET_TCP_MAXSEG = 2; + SOCKET_TCP_CORK = 3; + SOCKET_TCP_KEEPIDLE = 4; + SOCKET_TCP_KEEPINTVL = 5; + SOCKET_TCP_KEEPCNT = 6; + SOCKET_TCP_SYNCNT = 7; + SOCKET_TCP_LINGER2 = 8; + SOCKET_TCP_DEFER_ACCEPT = 9; + SOCKET_TCP_WINDOW_CLAMP = 10; + SOCKET_TCP_INFO = 11; + SOCKET_TCP_QUICKACK = 12; + } + + required SocketOptionLevel level = 1; + required SocketOptionName option = 2; + required bytes value = 3; +} + + +message SetSocketOptionsRequest { + required string socket_descriptor = 1; + repeated SocketOption options = 2; +} + +message SetSocketOptionsReply { +} + +message GetSocketOptionsRequest { + required string socket_descriptor = 1; + repeated SocketOption options = 2; +} + +message GetSocketOptionsReply { + repeated SocketOption options = 2; +} + + +message ConnectRequest { + required string socket_descriptor = 1; + required AddressPort remote_ip = 2; + optional double timeout_seconds = 3 [default=-1]; +} + +message ConnectReply { + optional AddressPort proxy_external_ip = 1; + + extensions 1000 to max; +} + + +message ListenRequest { + required string socket_descriptor = 1; + required int32 backlog = 2; +} + +message ListenReply { +} + + +message AcceptRequest { + required string socket_descriptor = 1; + optional double timeout_seconds = 2 [default=-1]; +} + +message AcceptReply { + optional bytes new_socket_descriptor = 2; + optional AddressPort remote_address = 3; +} + + + +message ShutDownRequest { + enum How { + SOCKET_SHUT_RD = 1; + SOCKET_SHUT_WR = 2; + SOCKET_SHUT_RDWR = 3; + } + required string socket_descriptor = 1; + required How how = 2; + required int64 send_offset = 3; +} + +message ShutDownReply { +} + + + +message CloseRequest { + required string socket_descriptor = 1; + optional int64 send_offset = 2 [default=-1]; +} + +message CloseReply { +} + + + +message SendRequest { + required string socket_descriptor = 1; + required bytes data = 2 [ctype=CORD]; + required int64 stream_offset = 3; + optional int32 flags = 4 [default=0]; + optional AddressPort send_to = 5; + optional double timeout_seconds = 6 [default=-1]; +} + +message SendReply { + optional int32 data_sent = 1; +} + + +message ReceiveRequest { + enum Flags { + MSG_OOB = 1; + MSG_PEEK = 2; + } + required string socket_descriptor = 1; + required int32 data_size = 2; + optional int32 flags = 3 [default=0]; + optional double timeout_seconds = 5 [default=-1]; +} + +message ReceiveReply { + optional int64 stream_offset = 2; + optional bytes data = 3 [ctype=CORD]; + optional AddressPort received_from = 4; + optional int32 buffer_size = 5; +} + + + +message PollEvent { + + enum PollEventFlag { + SOCKET_POLLNONE = 0; + SOCKET_POLLIN = 1; + SOCKET_POLLPRI = 2; + SOCKET_POLLOUT = 4; + SOCKET_POLLERR = 8; + SOCKET_POLLHUP = 16; + SOCKET_POLLNVAL = 32; + SOCKET_POLLRDNORM = 64; + SOCKET_POLLRDBAND = 128; + SOCKET_POLLWRNORM = 256; + SOCKET_POLLWRBAND = 512; + SOCKET_POLLMSG = 1024; + SOCKET_POLLREMOVE = 4096; + SOCKET_POLLRDHUP = 8192; + }; + + required string socket_descriptor = 1; + required int32 requested_events = 2; + required int32 observed_events = 3; +} + +message PollRequest { + repeated PollEvent events = 1; + optional double timeout_seconds = 2 [default=-1]; +} + +message PollReply { + repeated PollEvent events = 2; +} + +message ResolveRequest { + required string name = 1; + repeated CreateSocketRequest.SocketFamily address_families = 2; +} + +message ResolveReply { + enum ErrorCode { + SOCKET_EAI_ADDRFAMILY = 1; + SOCKET_EAI_AGAIN = 2; + SOCKET_EAI_BADFLAGS = 3; + SOCKET_EAI_FAIL = 4; + SOCKET_EAI_FAMILY = 5; + SOCKET_EAI_MEMORY = 6; + SOCKET_EAI_NODATA = 7; + SOCKET_EAI_NONAME = 8; + SOCKET_EAI_SERVICE = 9; + SOCKET_EAI_SOCKTYPE = 10; + SOCKET_EAI_SYSTEM = 11; + SOCKET_EAI_BADHINTS = 12; + SOCKET_EAI_PROTOCOL = 13; + SOCKET_EAI_OVERFLOW = 14; + SOCKET_EAI_MAX = 15; + }; + + repeated bytes packed_address = 2; + optional string canonical_name = 3; + repeated string aliases = 4; +} diff --git a/vendor/google.golang.org/appengine/internal/system/system_service.pb.go b/vendor/google.golang.org/appengine/internal/system/system_service.pb.go new file mode 100644 index 000000000..9ff458ed6 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/system/system_service.pb.go @@ -0,0 +1,362 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/system/system_service.proto + +package system + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type SystemServiceError_ErrorCode int32 + +const ( + SystemServiceError_OK SystemServiceError_ErrorCode = 0 + SystemServiceError_INTERNAL_ERROR SystemServiceError_ErrorCode = 1 + SystemServiceError_BACKEND_REQUIRED SystemServiceError_ErrorCode = 2 + SystemServiceError_LIMIT_REACHED SystemServiceError_ErrorCode = 3 +) + +var SystemServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "INTERNAL_ERROR", + 2: "BACKEND_REQUIRED", + 3: "LIMIT_REACHED", +} +var SystemServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "INTERNAL_ERROR": 1, + "BACKEND_REQUIRED": 2, + "LIMIT_REACHED": 3, +} + +func (x SystemServiceError_ErrorCode) Enum() *SystemServiceError_ErrorCode { + p := new(SystemServiceError_ErrorCode) + *p = x + return p +} +func (x SystemServiceError_ErrorCode) String() string { + return proto.EnumName(SystemServiceError_ErrorCode_name, int32(x)) +} +func (x *SystemServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(SystemServiceError_ErrorCode_value, data, "SystemServiceError_ErrorCode") + if err != nil { + return err + } + *x = SystemServiceError_ErrorCode(value) + return nil +} +func (SystemServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_system_service_ccf41ec210fc59eb, []int{0, 0} +} + +type SystemServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SystemServiceError) Reset() { *m = SystemServiceError{} } +func (m *SystemServiceError) String() string { return proto.CompactTextString(m) } +func (*SystemServiceError) ProtoMessage() {} +func (*SystemServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_system_service_ccf41ec210fc59eb, []int{0} +} +func (m *SystemServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SystemServiceError.Unmarshal(m, b) +} +func (m *SystemServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SystemServiceError.Marshal(b, m, deterministic) +} +func (dst *SystemServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_SystemServiceError.Merge(dst, src) +} +func (m *SystemServiceError) XXX_Size() int { + return xxx_messageInfo_SystemServiceError.Size(m) +} +func (m *SystemServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_SystemServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_SystemServiceError proto.InternalMessageInfo + +type SystemStat struct { + // Instaneous value of this stat. + Current *float64 `protobuf:"fixed64,1,opt,name=current" json:"current,omitempty"` + // Average over time, if this stat has an instaneous value. + Average1M *float64 `protobuf:"fixed64,3,opt,name=average1m" json:"average1m,omitempty"` + Average10M *float64 `protobuf:"fixed64,4,opt,name=average10m" json:"average10m,omitempty"` + // Total value, if the stat accumulates over time. + Total *float64 `protobuf:"fixed64,2,opt,name=total" json:"total,omitempty"` + // Rate over time, if this stat accumulates. + Rate1M *float64 `protobuf:"fixed64,5,opt,name=rate1m" json:"rate1m,omitempty"` + Rate10M *float64 `protobuf:"fixed64,6,opt,name=rate10m" json:"rate10m,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SystemStat) Reset() { *m = SystemStat{} } +func (m *SystemStat) String() string { return proto.CompactTextString(m) } +func (*SystemStat) ProtoMessage() {} +func (*SystemStat) Descriptor() ([]byte, []int) { + return fileDescriptor_system_service_ccf41ec210fc59eb, []int{1} +} +func (m *SystemStat) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SystemStat.Unmarshal(m, b) +} +func (m *SystemStat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SystemStat.Marshal(b, m, deterministic) +} +func (dst *SystemStat) XXX_Merge(src proto.Message) { + xxx_messageInfo_SystemStat.Merge(dst, src) +} +func (m *SystemStat) XXX_Size() int { + return xxx_messageInfo_SystemStat.Size(m) +} +func (m *SystemStat) XXX_DiscardUnknown() { + xxx_messageInfo_SystemStat.DiscardUnknown(m) +} + +var xxx_messageInfo_SystemStat proto.InternalMessageInfo + +func (m *SystemStat) GetCurrent() float64 { + if m != nil && m.Current != nil { + return *m.Current + } + return 0 +} + +func (m *SystemStat) GetAverage1M() float64 { + if m != nil && m.Average1M != nil { + return *m.Average1M + } + return 0 +} + +func (m *SystemStat) GetAverage10M() float64 { + if m != nil && m.Average10M != nil { + return *m.Average10M + } + return 0 +} + +func (m *SystemStat) GetTotal() float64 { + if m != nil && m.Total != nil { + return *m.Total + } + return 0 +} + +func (m *SystemStat) GetRate1M() float64 { + if m != nil && m.Rate1M != nil { + return *m.Rate1M + } + return 0 +} + +func (m *SystemStat) GetRate10M() float64 { + if m != nil && m.Rate10M != nil { + return *m.Rate10M + } + return 0 +} + +type GetSystemStatsRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSystemStatsRequest) Reset() { *m = GetSystemStatsRequest{} } +func (m *GetSystemStatsRequest) String() string { return proto.CompactTextString(m) } +func (*GetSystemStatsRequest) ProtoMessage() {} +func (*GetSystemStatsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_system_service_ccf41ec210fc59eb, []int{2} +} +func (m *GetSystemStatsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSystemStatsRequest.Unmarshal(m, b) +} +func (m *GetSystemStatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSystemStatsRequest.Marshal(b, m, deterministic) +} +func (dst *GetSystemStatsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSystemStatsRequest.Merge(dst, src) +} +func (m *GetSystemStatsRequest) XXX_Size() int { + return xxx_messageInfo_GetSystemStatsRequest.Size(m) +} +func (m *GetSystemStatsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetSystemStatsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSystemStatsRequest proto.InternalMessageInfo + +type GetSystemStatsResponse struct { + // CPU used by this instance, in mcycles. + Cpu *SystemStat `protobuf:"bytes,1,opt,name=cpu" json:"cpu,omitempty"` + // Physical memory (RAM) used by this instance, in megabytes. + Memory *SystemStat `protobuf:"bytes,2,opt,name=memory" json:"memory,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSystemStatsResponse) Reset() { *m = GetSystemStatsResponse{} } +func (m *GetSystemStatsResponse) String() string { return proto.CompactTextString(m) } +func (*GetSystemStatsResponse) ProtoMessage() {} +func (*GetSystemStatsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_system_service_ccf41ec210fc59eb, []int{3} +} +func (m *GetSystemStatsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSystemStatsResponse.Unmarshal(m, b) +} +func (m *GetSystemStatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSystemStatsResponse.Marshal(b, m, deterministic) +} +func (dst *GetSystemStatsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSystemStatsResponse.Merge(dst, src) +} +func (m *GetSystemStatsResponse) XXX_Size() int { + return xxx_messageInfo_GetSystemStatsResponse.Size(m) +} +func (m *GetSystemStatsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetSystemStatsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSystemStatsResponse proto.InternalMessageInfo + +func (m *GetSystemStatsResponse) GetCpu() *SystemStat { + if m != nil { + return m.Cpu + } + return nil +} + +func (m *GetSystemStatsResponse) GetMemory() *SystemStat { + if m != nil { + return m.Memory + } + return nil +} + +type StartBackgroundRequestRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StartBackgroundRequestRequest) Reset() { *m = StartBackgroundRequestRequest{} } +func (m *StartBackgroundRequestRequest) String() string { return proto.CompactTextString(m) } +func (*StartBackgroundRequestRequest) ProtoMessage() {} +func (*StartBackgroundRequestRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_system_service_ccf41ec210fc59eb, []int{4} +} +func (m *StartBackgroundRequestRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StartBackgroundRequestRequest.Unmarshal(m, b) +} +func (m *StartBackgroundRequestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StartBackgroundRequestRequest.Marshal(b, m, deterministic) +} +func (dst *StartBackgroundRequestRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartBackgroundRequestRequest.Merge(dst, src) +} +func (m *StartBackgroundRequestRequest) XXX_Size() int { + return xxx_messageInfo_StartBackgroundRequestRequest.Size(m) +} +func (m *StartBackgroundRequestRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StartBackgroundRequestRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StartBackgroundRequestRequest proto.InternalMessageInfo + +type StartBackgroundRequestResponse struct { + // Every /_ah/background request will have an X-AppEngine-BackgroundRequest + // header, whose value will be equal to this parameter, the request_id. + RequestId *string `protobuf:"bytes,1,opt,name=request_id,json=requestId" json:"request_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StartBackgroundRequestResponse) Reset() { *m = StartBackgroundRequestResponse{} } +func (m *StartBackgroundRequestResponse) String() string { return proto.CompactTextString(m) } +func (*StartBackgroundRequestResponse) ProtoMessage() {} +func (*StartBackgroundRequestResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_system_service_ccf41ec210fc59eb, []int{5} +} +func (m *StartBackgroundRequestResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StartBackgroundRequestResponse.Unmarshal(m, b) +} +func (m *StartBackgroundRequestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StartBackgroundRequestResponse.Marshal(b, m, deterministic) +} +func (dst *StartBackgroundRequestResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartBackgroundRequestResponse.Merge(dst, src) +} +func (m *StartBackgroundRequestResponse) XXX_Size() int { + return xxx_messageInfo_StartBackgroundRequestResponse.Size(m) +} +func (m *StartBackgroundRequestResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StartBackgroundRequestResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StartBackgroundRequestResponse proto.InternalMessageInfo + +func (m *StartBackgroundRequestResponse) GetRequestId() string { + if m != nil && m.RequestId != nil { + return *m.RequestId + } + return "" +} + +func init() { + proto.RegisterType((*SystemServiceError)(nil), "appengine.SystemServiceError") + proto.RegisterType((*SystemStat)(nil), "appengine.SystemStat") + proto.RegisterType((*GetSystemStatsRequest)(nil), "appengine.GetSystemStatsRequest") + proto.RegisterType((*GetSystemStatsResponse)(nil), "appengine.GetSystemStatsResponse") + proto.RegisterType((*StartBackgroundRequestRequest)(nil), "appengine.StartBackgroundRequestRequest") + proto.RegisterType((*StartBackgroundRequestResponse)(nil), "appengine.StartBackgroundRequestResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/system/system_service.proto", fileDescriptor_system_service_ccf41ec210fc59eb) +} + +var fileDescriptor_system_service_ccf41ec210fc59eb = []byte{ + // 377 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x4f, 0x8f, 0x93, 0x40, + 0x18, 0xc6, 0xa5, 0x75, 0x51, 0x5e, 0xa3, 0xc1, 0xc9, 0xee, 0xca, 0xc1, 0x5d, 0x0d, 0x17, 0xbd, + 0x48, 0x57, 0xbf, 0x80, 0xf6, 0xcf, 0x44, 0x49, 0x6b, 0xab, 0xd3, 0x7a, 0xf1, 0x42, 0x26, 0xf0, + 0x3a, 0x21, 0xc2, 0x0c, 0x0e, 0x43, 0x93, 0x7e, 0x27, 0x3f, 0xa4, 0xe9, 0x30, 0x6d, 0xcd, 0x26, + 0x3d, 0x31, 0xcf, 0xf3, 0xfc, 0x02, 0x3f, 0x08, 0xf0, 0x49, 0x28, 0x25, 0x2a, 0x4c, 0x84, 0xaa, + 0xb8, 0x14, 0x89, 0xd2, 0x62, 0xc4, 0x9b, 0x06, 0xa5, 0x28, 0x25, 0x8e, 0x4a, 0x69, 0x50, 0x4b, + 0x5e, 0x8d, 0xda, 0x5d, 0x6b, 0xb0, 0x76, 0x97, 0xac, 0x45, 0xbd, 0x2d, 0x73, 0x4c, 0x1a, 0xad, + 0x8c, 0x22, 0xc1, 0x91, 0x8f, 0x7f, 0x01, 0x59, 0x5b, 0x64, 0xdd, 0x13, 0x54, 0x6b, 0xa5, 0xe3, + 0x6f, 0x10, 0xd8, 0xc3, 0x54, 0x15, 0x48, 0x7c, 0x18, 0xac, 0xe6, 0xe1, 0x03, 0x42, 0xe0, 0x59, + 0xba, 0xdc, 0x50, 0xb6, 0x1c, 0x2f, 0x32, 0xca, 0xd8, 0x8a, 0x85, 0x1e, 0xb9, 0x84, 0x70, 0x32, + 0x9e, 0xce, 0xe9, 0x72, 0x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, 0xab, 0xac, 0x2c, 0xac, 0x61, + 0xc0, 0x02, 0xd7, 0xa4, 0xc5, 0xe4, 0xf1, 0x4f, 0xbf, 0xff, 0x4d, 0xfe, 0x05, 0x00, 0x00, 0xff, + 0xff, 0x56, 0x5d, 0x5e, 0xc3, 0x5b, 0x02, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/system/system_service.proto b/vendor/google.golang.org/appengine/internal/system/system_service.proto new file mode 100644 index 000000000..32c0bf859 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/system/system_service.proto @@ -0,0 +1,49 @@ +syntax = "proto2"; +option go_package = "system"; + +package appengine; + +message SystemServiceError { + enum ErrorCode { + OK = 0; + INTERNAL_ERROR = 1; + BACKEND_REQUIRED = 2; + LIMIT_REACHED = 3; + } +} + +message SystemStat { + // Instaneous value of this stat. + optional double current = 1; + + // Average over time, if this stat has an instaneous value. + optional double average1m = 3; + optional double average10m = 4; + + // Total value, if the stat accumulates over time. + optional double total = 2; + + // Rate over time, if this stat accumulates. + optional double rate1m = 5; + optional double rate10m = 6; +} + +message GetSystemStatsRequest { +} + +message GetSystemStatsResponse { + // CPU used by this instance, in mcycles. + optional SystemStat cpu = 1; + + // Physical memory (RAM) used by this instance, in megabytes. + optional SystemStat memory = 2; +} + +message StartBackgroundRequestRequest { +} + +message StartBackgroundRequestResponse { + // Every /_ah/background request will have an X-AppEngine-BackgroundRequest + // header, whose value will be equal to this parameter, the request_id. + optional string request_id = 1; +} diff --git a/vendor/google.golang.org/appengine/internal/taskqueue/taskqueue_service.pb.go b/vendor/google.golang.org/appengine/internal/taskqueue/taskqueue_service.pb.go new file mode 100644 index 000000000..55465ccc2 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/taskqueue/taskqueue_service.pb.go @@ -0,0 +1,3149 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/taskqueue/taskqueue_service.proto + +package taskqueue + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import datastore "google.golang.org/appengine/internal/datastore" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type TaskQueueServiceError_ErrorCode int32 + +const ( + TaskQueueServiceError_OK TaskQueueServiceError_ErrorCode = 0 + TaskQueueServiceError_UNKNOWN_QUEUE TaskQueueServiceError_ErrorCode = 1 + TaskQueueServiceError_TRANSIENT_ERROR TaskQueueServiceError_ErrorCode = 2 + TaskQueueServiceError_INTERNAL_ERROR TaskQueueServiceError_ErrorCode = 3 + TaskQueueServiceError_TASK_TOO_LARGE TaskQueueServiceError_ErrorCode = 4 + TaskQueueServiceError_INVALID_TASK_NAME TaskQueueServiceError_ErrorCode = 5 + TaskQueueServiceError_INVALID_QUEUE_NAME TaskQueueServiceError_ErrorCode = 6 + TaskQueueServiceError_INVALID_URL TaskQueueServiceError_ErrorCode = 7 + TaskQueueServiceError_INVALID_QUEUE_RATE TaskQueueServiceError_ErrorCode = 8 + TaskQueueServiceError_PERMISSION_DENIED TaskQueueServiceError_ErrorCode = 9 + TaskQueueServiceError_TASK_ALREADY_EXISTS TaskQueueServiceError_ErrorCode = 10 + TaskQueueServiceError_TOMBSTONED_TASK TaskQueueServiceError_ErrorCode = 11 + TaskQueueServiceError_INVALID_ETA TaskQueueServiceError_ErrorCode = 12 + TaskQueueServiceError_INVALID_REQUEST TaskQueueServiceError_ErrorCode = 13 + TaskQueueServiceError_UNKNOWN_TASK TaskQueueServiceError_ErrorCode = 14 + TaskQueueServiceError_TOMBSTONED_QUEUE TaskQueueServiceError_ErrorCode = 15 + TaskQueueServiceError_DUPLICATE_TASK_NAME TaskQueueServiceError_ErrorCode = 16 + TaskQueueServiceError_SKIPPED TaskQueueServiceError_ErrorCode = 17 + TaskQueueServiceError_TOO_MANY_TASKS TaskQueueServiceError_ErrorCode = 18 + TaskQueueServiceError_INVALID_PAYLOAD TaskQueueServiceError_ErrorCode = 19 + TaskQueueServiceError_INVALID_RETRY_PARAMETERS TaskQueueServiceError_ErrorCode = 20 + TaskQueueServiceError_INVALID_QUEUE_MODE TaskQueueServiceError_ErrorCode = 21 + TaskQueueServiceError_ACL_LOOKUP_ERROR TaskQueueServiceError_ErrorCode = 22 + TaskQueueServiceError_TRANSACTIONAL_REQUEST_TOO_LARGE TaskQueueServiceError_ErrorCode = 23 + TaskQueueServiceError_INCORRECT_CREATOR_NAME TaskQueueServiceError_ErrorCode = 24 + TaskQueueServiceError_TASK_LEASE_EXPIRED TaskQueueServiceError_ErrorCode = 25 + TaskQueueServiceError_QUEUE_PAUSED TaskQueueServiceError_ErrorCode = 26 + TaskQueueServiceError_INVALID_TAG TaskQueueServiceError_ErrorCode = 27 + // Reserved range for the Datastore error codes. + // Original Datastore error code is shifted by DATASTORE_ERROR offset. + TaskQueueServiceError_DATASTORE_ERROR TaskQueueServiceError_ErrorCode = 10000 +) + +var TaskQueueServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "UNKNOWN_QUEUE", + 2: "TRANSIENT_ERROR", + 3: "INTERNAL_ERROR", + 4: "TASK_TOO_LARGE", + 5: "INVALID_TASK_NAME", + 6: "INVALID_QUEUE_NAME", + 7: "INVALID_URL", + 8: "INVALID_QUEUE_RATE", + 9: "PERMISSION_DENIED", + 10: "TASK_ALREADY_EXISTS", + 11: "TOMBSTONED_TASK", + 12: "INVALID_ETA", + 13: "INVALID_REQUEST", + 14: "UNKNOWN_TASK", + 15: "TOMBSTONED_QUEUE", + 16: "DUPLICATE_TASK_NAME", + 17: "SKIPPED", + 18: "TOO_MANY_TASKS", + 19: "INVALID_PAYLOAD", + 20: "INVALID_RETRY_PARAMETERS", + 21: "INVALID_QUEUE_MODE", + 22: "ACL_LOOKUP_ERROR", + 23: "TRANSACTIONAL_REQUEST_TOO_LARGE", + 24: "INCORRECT_CREATOR_NAME", + 25: "TASK_LEASE_EXPIRED", + 26: "QUEUE_PAUSED", + 27: "INVALID_TAG", + 10000: "DATASTORE_ERROR", +} +var TaskQueueServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "UNKNOWN_QUEUE": 1, + "TRANSIENT_ERROR": 2, + "INTERNAL_ERROR": 3, + "TASK_TOO_LARGE": 4, + "INVALID_TASK_NAME": 5, + "INVALID_QUEUE_NAME": 6, + "INVALID_URL": 7, + "INVALID_QUEUE_RATE": 8, + "PERMISSION_DENIED": 9, + "TASK_ALREADY_EXISTS": 10, + "TOMBSTONED_TASK": 11, + "INVALID_ETA": 12, + "INVALID_REQUEST": 13, + "UNKNOWN_TASK": 14, + "TOMBSTONED_QUEUE": 15, + "DUPLICATE_TASK_NAME": 16, + "SKIPPED": 17, + "TOO_MANY_TASKS": 18, + "INVALID_PAYLOAD": 19, + "INVALID_RETRY_PARAMETERS": 20, + "INVALID_QUEUE_MODE": 21, + "ACL_LOOKUP_ERROR": 22, + "TRANSACTIONAL_REQUEST_TOO_LARGE": 23, + "INCORRECT_CREATOR_NAME": 24, + "TASK_LEASE_EXPIRED": 25, + "QUEUE_PAUSED": 26, + "INVALID_TAG": 27, + "DATASTORE_ERROR": 10000, +} + +func (x TaskQueueServiceError_ErrorCode) Enum() *TaskQueueServiceError_ErrorCode { + p := new(TaskQueueServiceError_ErrorCode) + *p = x + return p +} +func (x TaskQueueServiceError_ErrorCode) String() string { + return proto.EnumName(TaskQueueServiceError_ErrorCode_name, int32(x)) +} +func (x *TaskQueueServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(TaskQueueServiceError_ErrorCode_value, data, "TaskQueueServiceError_ErrorCode") + if err != nil { + return err + } + *x = TaskQueueServiceError_ErrorCode(value) + return nil +} +func (TaskQueueServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{0, 0} +} + +type TaskQueueMode_Mode int32 + +const ( + TaskQueueMode_PUSH TaskQueueMode_Mode = 0 + TaskQueueMode_PULL TaskQueueMode_Mode = 1 +) + +var TaskQueueMode_Mode_name = map[int32]string{ + 0: "PUSH", + 1: "PULL", +} +var TaskQueueMode_Mode_value = map[string]int32{ + "PUSH": 0, + "PULL": 1, +} + +func (x TaskQueueMode_Mode) Enum() *TaskQueueMode_Mode { + p := new(TaskQueueMode_Mode) + *p = x + return p +} +func (x TaskQueueMode_Mode) String() string { + return proto.EnumName(TaskQueueMode_Mode_name, int32(x)) +} +func (x *TaskQueueMode_Mode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(TaskQueueMode_Mode_value, data, "TaskQueueMode_Mode") + if err != nil { + return err + } + *x = TaskQueueMode_Mode(value) + return nil +} +func (TaskQueueMode_Mode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{5, 0} +} + +type TaskQueueAddRequest_RequestMethod int32 + +const ( + TaskQueueAddRequest_GET TaskQueueAddRequest_RequestMethod = 1 + TaskQueueAddRequest_POST TaskQueueAddRequest_RequestMethod = 2 + TaskQueueAddRequest_HEAD TaskQueueAddRequest_RequestMethod = 3 + TaskQueueAddRequest_PUT TaskQueueAddRequest_RequestMethod = 4 + TaskQueueAddRequest_DELETE TaskQueueAddRequest_RequestMethod = 5 +) + +var TaskQueueAddRequest_RequestMethod_name = map[int32]string{ + 1: "GET", + 2: "POST", + 3: "HEAD", + 4: "PUT", + 5: "DELETE", +} +var TaskQueueAddRequest_RequestMethod_value = map[string]int32{ + "GET": 1, + "POST": 2, + "HEAD": 3, + "PUT": 4, + "DELETE": 5, +} + +func (x TaskQueueAddRequest_RequestMethod) Enum() *TaskQueueAddRequest_RequestMethod { + p := new(TaskQueueAddRequest_RequestMethod) + *p = x + return p +} +func (x TaskQueueAddRequest_RequestMethod) String() string { + return proto.EnumName(TaskQueueAddRequest_RequestMethod_name, int32(x)) +} +func (x *TaskQueueAddRequest_RequestMethod) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(TaskQueueAddRequest_RequestMethod_value, data, "TaskQueueAddRequest_RequestMethod") + if err != nil { + return err + } + *x = TaskQueueAddRequest_RequestMethod(value) + return nil +} +func (TaskQueueAddRequest_RequestMethod) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{6, 0} +} + +type TaskQueueQueryTasksResponse_Task_RequestMethod int32 + +const ( + TaskQueueQueryTasksResponse_Task_GET TaskQueueQueryTasksResponse_Task_RequestMethod = 1 + TaskQueueQueryTasksResponse_Task_POST TaskQueueQueryTasksResponse_Task_RequestMethod = 2 + TaskQueueQueryTasksResponse_Task_HEAD TaskQueueQueryTasksResponse_Task_RequestMethod = 3 + TaskQueueQueryTasksResponse_Task_PUT TaskQueueQueryTasksResponse_Task_RequestMethod = 4 + TaskQueueQueryTasksResponse_Task_DELETE TaskQueueQueryTasksResponse_Task_RequestMethod = 5 +) + +var TaskQueueQueryTasksResponse_Task_RequestMethod_name = map[int32]string{ + 1: "GET", + 2: "POST", + 3: "HEAD", + 4: "PUT", + 5: "DELETE", +} +var TaskQueueQueryTasksResponse_Task_RequestMethod_value = map[string]int32{ + "GET": 1, + "POST": 2, + "HEAD": 3, + "PUT": 4, + "DELETE": 5, +} + +func (x TaskQueueQueryTasksResponse_Task_RequestMethod) Enum() *TaskQueueQueryTasksResponse_Task_RequestMethod { + p := new(TaskQueueQueryTasksResponse_Task_RequestMethod) + *p = x + return p +} +func (x TaskQueueQueryTasksResponse_Task_RequestMethod) String() string { + return proto.EnumName(TaskQueueQueryTasksResponse_Task_RequestMethod_name, int32(x)) +} +func (x *TaskQueueQueryTasksResponse_Task_RequestMethod) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(TaskQueueQueryTasksResponse_Task_RequestMethod_value, data, "TaskQueueQueryTasksResponse_Task_RequestMethod") + if err != nil { + return err + } + *x = TaskQueueQueryTasksResponse_Task_RequestMethod(value) + return nil +} +func (TaskQueueQueryTasksResponse_Task_RequestMethod) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{30, 0, 0} +} + +type TaskQueueServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueServiceError) Reset() { *m = TaskQueueServiceError{} } +func (m *TaskQueueServiceError) String() string { return proto.CompactTextString(m) } +func (*TaskQueueServiceError) ProtoMessage() {} +func (*TaskQueueServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{0} +} +func (m *TaskQueueServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueServiceError.Unmarshal(m, b) +} +func (m *TaskQueueServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueServiceError.Marshal(b, m, deterministic) +} +func (dst *TaskQueueServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueServiceError.Merge(dst, src) +} +func (m *TaskQueueServiceError) XXX_Size() int { + return xxx_messageInfo_TaskQueueServiceError.Size(m) +} +func (m *TaskQueueServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueServiceError proto.InternalMessageInfo + +type TaskPayload struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskPayload) Reset() { *m = TaskPayload{} } +func (m *TaskPayload) String() string { return proto.CompactTextString(m) } +func (*TaskPayload) ProtoMessage() {} +func (*TaskPayload) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{1} +} + +func (m *TaskPayload) MarshalJSON() ([]byte, error) { + return proto.MarshalMessageSetJSON(&m.XXX_InternalExtensions) +} +func (m *TaskPayload) UnmarshalJSON(buf []byte) error { + return proto.UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions) +} + +var extRange_TaskPayload = []proto.ExtensionRange{ + {Start: 10, End: 2147483646}, +} + +func (*TaskPayload) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_TaskPayload +} +func (m *TaskPayload) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskPayload.Unmarshal(m, b) +} +func (m *TaskPayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskPayload.Marshal(b, m, deterministic) +} +func (dst *TaskPayload) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskPayload.Merge(dst, src) +} +func (m *TaskPayload) XXX_Size() int { + return xxx_messageInfo_TaskPayload.Size(m) +} +func (m *TaskPayload) XXX_DiscardUnknown() { + xxx_messageInfo_TaskPayload.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskPayload proto.InternalMessageInfo + +type TaskQueueRetryParameters struct { + RetryLimit *int32 `protobuf:"varint,1,opt,name=retry_limit,json=retryLimit" json:"retry_limit,omitempty"` + AgeLimitSec *int64 `protobuf:"varint,2,opt,name=age_limit_sec,json=ageLimitSec" json:"age_limit_sec,omitempty"` + MinBackoffSec *float64 `protobuf:"fixed64,3,opt,name=min_backoff_sec,json=minBackoffSec,def=0.1" json:"min_backoff_sec,omitempty"` + MaxBackoffSec *float64 `protobuf:"fixed64,4,opt,name=max_backoff_sec,json=maxBackoffSec,def=3600" json:"max_backoff_sec,omitempty"` + MaxDoublings *int32 `protobuf:"varint,5,opt,name=max_doublings,json=maxDoublings,def=16" json:"max_doublings,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueRetryParameters) Reset() { *m = TaskQueueRetryParameters{} } +func (m *TaskQueueRetryParameters) String() string { return proto.CompactTextString(m) } +func (*TaskQueueRetryParameters) ProtoMessage() {} +func (*TaskQueueRetryParameters) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{2} +} +func (m *TaskQueueRetryParameters) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueRetryParameters.Unmarshal(m, b) +} +func (m *TaskQueueRetryParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueRetryParameters.Marshal(b, m, deterministic) +} +func (dst *TaskQueueRetryParameters) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueRetryParameters.Merge(dst, src) +} +func (m *TaskQueueRetryParameters) XXX_Size() int { + return xxx_messageInfo_TaskQueueRetryParameters.Size(m) +} +func (m *TaskQueueRetryParameters) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueRetryParameters.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueRetryParameters proto.InternalMessageInfo + +const Default_TaskQueueRetryParameters_MinBackoffSec float64 = 0.1 +const Default_TaskQueueRetryParameters_MaxBackoffSec float64 = 3600 +const Default_TaskQueueRetryParameters_MaxDoublings int32 = 16 + +func (m *TaskQueueRetryParameters) GetRetryLimit() int32 { + if m != nil && m.RetryLimit != nil { + return *m.RetryLimit + } + return 0 +} + +func (m *TaskQueueRetryParameters) GetAgeLimitSec() int64 { + if m != nil && m.AgeLimitSec != nil { + return *m.AgeLimitSec + } + return 0 +} + +func (m *TaskQueueRetryParameters) GetMinBackoffSec() float64 { + if m != nil && m.MinBackoffSec != nil { + return *m.MinBackoffSec + } + return Default_TaskQueueRetryParameters_MinBackoffSec +} + +func (m *TaskQueueRetryParameters) GetMaxBackoffSec() float64 { + if m != nil && m.MaxBackoffSec != nil { + return *m.MaxBackoffSec + } + return Default_TaskQueueRetryParameters_MaxBackoffSec +} + +func (m *TaskQueueRetryParameters) GetMaxDoublings() int32 { + if m != nil && m.MaxDoublings != nil { + return *m.MaxDoublings + } + return Default_TaskQueueRetryParameters_MaxDoublings +} + +type TaskQueueAcl struct { + UserEmail [][]byte `protobuf:"bytes,1,rep,name=user_email,json=userEmail" json:"user_email,omitempty"` + WriterEmail [][]byte `protobuf:"bytes,2,rep,name=writer_email,json=writerEmail" json:"writer_email,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueAcl) Reset() { *m = TaskQueueAcl{} } +func (m *TaskQueueAcl) String() string { return proto.CompactTextString(m) } +func (*TaskQueueAcl) ProtoMessage() {} +func (*TaskQueueAcl) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{3} +} +func (m *TaskQueueAcl) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueAcl.Unmarshal(m, b) +} +func (m *TaskQueueAcl) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueAcl.Marshal(b, m, deterministic) +} +func (dst *TaskQueueAcl) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueAcl.Merge(dst, src) +} +func (m *TaskQueueAcl) XXX_Size() int { + return xxx_messageInfo_TaskQueueAcl.Size(m) +} +func (m *TaskQueueAcl) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueAcl.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueAcl proto.InternalMessageInfo + +func (m *TaskQueueAcl) GetUserEmail() [][]byte { + if m != nil { + return m.UserEmail + } + return nil +} + +func (m *TaskQueueAcl) GetWriterEmail() [][]byte { + if m != nil { + return m.WriterEmail + } + return nil +} + +type TaskQueueHttpHeader struct { + Key []byte `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueHttpHeader) Reset() { *m = TaskQueueHttpHeader{} } +func (m *TaskQueueHttpHeader) String() string { return proto.CompactTextString(m) } +func (*TaskQueueHttpHeader) ProtoMessage() {} +func (*TaskQueueHttpHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{4} +} +func (m *TaskQueueHttpHeader) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueHttpHeader.Unmarshal(m, b) +} +func (m *TaskQueueHttpHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueHttpHeader.Marshal(b, m, deterministic) +} +func (dst *TaskQueueHttpHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueHttpHeader.Merge(dst, src) +} +func (m *TaskQueueHttpHeader) XXX_Size() int { + return xxx_messageInfo_TaskQueueHttpHeader.Size(m) +} +func (m *TaskQueueHttpHeader) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueHttpHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueHttpHeader proto.InternalMessageInfo + +func (m *TaskQueueHttpHeader) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *TaskQueueHttpHeader) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type TaskQueueMode struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueMode) Reset() { *m = TaskQueueMode{} } +func (m *TaskQueueMode) String() string { return proto.CompactTextString(m) } +func (*TaskQueueMode) ProtoMessage() {} +func (*TaskQueueMode) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{5} +} +func (m *TaskQueueMode) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueMode.Unmarshal(m, b) +} +func (m *TaskQueueMode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueMode.Marshal(b, m, deterministic) +} +func (dst *TaskQueueMode) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueMode.Merge(dst, src) +} +func (m *TaskQueueMode) XXX_Size() int { + return xxx_messageInfo_TaskQueueMode.Size(m) +} +func (m *TaskQueueMode) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueMode.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueMode proto.InternalMessageInfo + +type TaskQueueAddRequest struct { + QueueName []byte `protobuf:"bytes,1,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + TaskName []byte `protobuf:"bytes,2,req,name=task_name,json=taskName" json:"task_name,omitempty"` + EtaUsec *int64 `protobuf:"varint,3,req,name=eta_usec,json=etaUsec" json:"eta_usec,omitempty"` + Method *TaskQueueAddRequest_RequestMethod `protobuf:"varint,5,opt,name=method,enum=appengine.TaskQueueAddRequest_RequestMethod,def=2" json:"method,omitempty"` + Url []byte `protobuf:"bytes,4,opt,name=url" json:"url,omitempty"` + Header []*TaskQueueAddRequest_Header `protobuf:"group,6,rep,name=Header,json=header" json:"header,omitempty"` + Body []byte `protobuf:"bytes,9,opt,name=body" json:"body,omitempty"` + Transaction *datastore.Transaction `protobuf:"bytes,10,opt,name=transaction" json:"transaction,omitempty"` + AppId []byte `protobuf:"bytes,11,opt,name=app_id,json=appId" json:"app_id,omitempty"` + Crontimetable *TaskQueueAddRequest_CronTimetable `protobuf:"group,12,opt,name=CronTimetable,json=crontimetable" json:"crontimetable,omitempty"` + Description []byte `protobuf:"bytes,15,opt,name=description" json:"description,omitempty"` + Payload *TaskPayload `protobuf:"bytes,16,opt,name=payload" json:"payload,omitempty"` + RetryParameters *TaskQueueRetryParameters `protobuf:"bytes,17,opt,name=retry_parameters,json=retryParameters" json:"retry_parameters,omitempty"` + Mode *TaskQueueMode_Mode `protobuf:"varint,18,opt,name=mode,enum=appengine.TaskQueueMode_Mode,def=0" json:"mode,omitempty"` + Tag []byte `protobuf:"bytes,19,opt,name=tag" json:"tag,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueAddRequest) Reset() { *m = TaskQueueAddRequest{} } +func (m *TaskQueueAddRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueAddRequest) ProtoMessage() {} +func (*TaskQueueAddRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{6} +} +func (m *TaskQueueAddRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueAddRequest.Unmarshal(m, b) +} +func (m *TaskQueueAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueAddRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueAddRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueAddRequest.Merge(dst, src) +} +func (m *TaskQueueAddRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueAddRequest.Size(m) +} +func (m *TaskQueueAddRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueAddRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueAddRequest proto.InternalMessageInfo + +const Default_TaskQueueAddRequest_Method TaskQueueAddRequest_RequestMethod = TaskQueueAddRequest_POST +const Default_TaskQueueAddRequest_Mode TaskQueueMode_Mode = TaskQueueMode_PUSH + +func (m *TaskQueueAddRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueAddRequest) GetTaskName() []byte { + if m != nil { + return m.TaskName + } + return nil +} + +func (m *TaskQueueAddRequest) GetEtaUsec() int64 { + if m != nil && m.EtaUsec != nil { + return *m.EtaUsec + } + return 0 +} + +func (m *TaskQueueAddRequest) GetMethod() TaskQueueAddRequest_RequestMethod { + if m != nil && m.Method != nil { + return *m.Method + } + return Default_TaskQueueAddRequest_Method +} + +func (m *TaskQueueAddRequest) GetUrl() []byte { + if m != nil { + return m.Url + } + return nil +} + +func (m *TaskQueueAddRequest) GetHeader() []*TaskQueueAddRequest_Header { + if m != nil { + return m.Header + } + return nil +} + +func (m *TaskQueueAddRequest) GetBody() []byte { + if m != nil { + return m.Body + } + return nil +} + +func (m *TaskQueueAddRequest) GetTransaction() *datastore.Transaction { + if m != nil { + return m.Transaction + } + return nil +} + +func (m *TaskQueueAddRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueueAddRequest) GetCrontimetable() *TaskQueueAddRequest_CronTimetable { + if m != nil { + return m.Crontimetable + } + return nil +} + +func (m *TaskQueueAddRequest) GetDescription() []byte { + if m != nil { + return m.Description + } + return nil +} + +func (m *TaskQueueAddRequest) GetPayload() *TaskPayload { + if m != nil { + return m.Payload + } + return nil +} + +func (m *TaskQueueAddRequest) GetRetryParameters() *TaskQueueRetryParameters { + if m != nil { + return m.RetryParameters + } + return nil +} + +func (m *TaskQueueAddRequest) GetMode() TaskQueueMode_Mode { + if m != nil && m.Mode != nil { + return *m.Mode + } + return Default_TaskQueueAddRequest_Mode +} + +func (m *TaskQueueAddRequest) GetTag() []byte { + if m != nil { + return m.Tag + } + return nil +} + +type TaskQueueAddRequest_Header struct { + Key []byte `protobuf:"bytes,7,req,name=key" json:"key,omitempty"` + Value []byte `protobuf:"bytes,8,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueAddRequest_Header) Reset() { *m = TaskQueueAddRequest_Header{} } +func (m *TaskQueueAddRequest_Header) String() string { return proto.CompactTextString(m) } +func (*TaskQueueAddRequest_Header) ProtoMessage() {} +func (*TaskQueueAddRequest_Header) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{6, 0} +} +func (m *TaskQueueAddRequest_Header) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueAddRequest_Header.Unmarshal(m, b) +} +func (m *TaskQueueAddRequest_Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueAddRequest_Header.Marshal(b, m, deterministic) +} +func (dst *TaskQueueAddRequest_Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueAddRequest_Header.Merge(dst, src) +} +func (m *TaskQueueAddRequest_Header) XXX_Size() int { + return xxx_messageInfo_TaskQueueAddRequest_Header.Size(m) +} +func (m *TaskQueueAddRequest_Header) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueAddRequest_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueAddRequest_Header proto.InternalMessageInfo + +func (m *TaskQueueAddRequest_Header) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *TaskQueueAddRequest_Header) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type TaskQueueAddRequest_CronTimetable struct { + Schedule []byte `protobuf:"bytes,13,req,name=schedule" json:"schedule,omitempty"` + Timezone []byte `protobuf:"bytes,14,req,name=timezone" json:"timezone,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueAddRequest_CronTimetable) Reset() { *m = TaskQueueAddRequest_CronTimetable{} } +func (m *TaskQueueAddRequest_CronTimetable) String() string { return proto.CompactTextString(m) } +func (*TaskQueueAddRequest_CronTimetable) ProtoMessage() {} +func (*TaskQueueAddRequest_CronTimetable) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{6, 1} +} +func (m *TaskQueueAddRequest_CronTimetable) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueAddRequest_CronTimetable.Unmarshal(m, b) +} +func (m *TaskQueueAddRequest_CronTimetable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueAddRequest_CronTimetable.Marshal(b, m, deterministic) +} +func (dst *TaskQueueAddRequest_CronTimetable) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueAddRequest_CronTimetable.Merge(dst, src) +} +func (m *TaskQueueAddRequest_CronTimetable) XXX_Size() int { + return xxx_messageInfo_TaskQueueAddRequest_CronTimetable.Size(m) +} +func (m *TaskQueueAddRequest_CronTimetable) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueAddRequest_CronTimetable.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueAddRequest_CronTimetable proto.InternalMessageInfo + +func (m *TaskQueueAddRequest_CronTimetable) GetSchedule() []byte { + if m != nil { + return m.Schedule + } + return nil +} + +func (m *TaskQueueAddRequest_CronTimetable) GetTimezone() []byte { + if m != nil { + return m.Timezone + } + return nil +} + +type TaskQueueAddResponse struct { + ChosenTaskName []byte `protobuf:"bytes,1,opt,name=chosen_task_name,json=chosenTaskName" json:"chosen_task_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueAddResponse) Reset() { *m = TaskQueueAddResponse{} } +func (m *TaskQueueAddResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueAddResponse) ProtoMessage() {} +func (*TaskQueueAddResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{7} +} +func (m *TaskQueueAddResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueAddResponse.Unmarshal(m, b) +} +func (m *TaskQueueAddResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueAddResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueAddResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueAddResponse.Merge(dst, src) +} +func (m *TaskQueueAddResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueAddResponse.Size(m) +} +func (m *TaskQueueAddResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueAddResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueAddResponse proto.InternalMessageInfo + +func (m *TaskQueueAddResponse) GetChosenTaskName() []byte { + if m != nil { + return m.ChosenTaskName + } + return nil +} + +type TaskQueueBulkAddRequest struct { + AddRequest []*TaskQueueAddRequest `protobuf:"bytes,1,rep,name=add_request,json=addRequest" json:"add_request,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueBulkAddRequest) Reset() { *m = TaskQueueBulkAddRequest{} } +func (m *TaskQueueBulkAddRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueBulkAddRequest) ProtoMessage() {} +func (*TaskQueueBulkAddRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{8} +} +func (m *TaskQueueBulkAddRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueBulkAddRequest.Unmarshal(m, b) +} +func (m *TaskQueueBulkAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueBulkAddRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueBulkAddRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueBulkAddRequest.Merge(dst, src) +} +func (m *TaskQueueBulkAddRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueBulkAddRequest.Size(m) +} +func (m *TaskQueueBulkAddRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueBulkAddRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueBulkAddRequest proto.InternalMessageInfo + +func (m *TaskQueueBulkAddRequest) GetAddRequest() []*TaskQueueAddRequest { + if m != nil { + return m.AddRequest + } + return nil +} + +type TaskQueueBulkAddResponse struct { + Taskresult []*TaskQueueBulkAddResponse_TaskResult `protobuf:"group,1,rep,name=TaskResult,json=taskresult" json:"taskresult,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueBulkAddResponse) Reset() { *m = TaskQueueBulkAddResponse{} } +func (m *TaskQueueBulkAddResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueBulkAddResponse) ProtoMessage() {} +func (*TaskQueueBulkAddResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{9} +} +func (m *TaskQueueBulkAddResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueBulkAddResponse.Unmarshal(m, b) +} +func (m *TaskQueueBulkAddResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueBulkAddResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueBulkAddResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueBulkAddResponse.Merge(dst, src) +} +func (m *TaskQueueBulkAddResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueBulkAddResponse.Size(m) +} +func (m *TaskQueueBulkAddResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueBulkAddResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueBulkAddResponse proto.InternalMessageInfo + +func (m *TaskQueueBulkAddResponse) GetTaskresult() []*TaskQueueBulkAddResponse_TaskResult { + if m != nil { + return m.Taskresult + } + return nil +} + +type TaskQueueBulkAddResponse_TaskResult struct { + Result *TaskQueueServiceError_ErrorCode `protobuf:"varint,2,req,name=result,enum=appengine.TaskQueueServiceError_ErrorCode" json:"result,omitempty"` + ChosenTaskName []byte `protobuf:"bytes,3,opt,name=chosen_task_name,json=chosenTaskName" json:"chosen_task_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueBulkAddResponse_TaskResult) Reset() { *m = TaskQueueBulkAddResponse_TaskResult{} } +func (m *TaskQueueBulkAddResponse_TaskResult) String() string { return proto.CompactTextString(m) } +func (*TaskQueueBulkAddResponse_TaskResult) ProtoMessage() {} +func (*TaskQueueBulkAddResponse_TaskResult) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{9, 0} +} +func (m *TaskQueueBulkAddResponse_TaskResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueBulkAddResponse_TaskResult.Unmarshal(m, b) +} +func (m *TaskQueueBulkAddResponse_TaskResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueBulkAddResponse_TaskResult.Marshal(b, m, deterministic) +} +func (dst *TaskQueueBulkAddResponse_TaskResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueBulkAddResponse_TaskResult.Merge(dst, src) +} +func (m *TaskQueueBulkAddResponse_TaskResult) XXX_Size() int { + return xxx_messageInfo_TaskQueueBulkAddResponse_TaskResult.Size(m) +} +func (m *TaskQueueBulkAddResponse_TaskResult) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueBulkAddResponse_TaskResult.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueBulkAddResponse_TaskResult proto.InternalMessageInfo + +func (m *TaskQueueBulkAddResponse_TaskResult) GetResult() TaskQueueServiceError_ErrorCode { + if m != nil && m.Result != nil { + return *m.Result + } + return TaskQueueServiceError_OK +} + +func (m *TaskQueueBulkAddResponse_TaskResult) GetChosenTaskName() []byte { + if m != nil { + return m.ChosenTaskName + } + return nil +} + +type TaskQueueDeleteRequest struct { + QueueName []byte `protobuf:"bytes,1,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + TaskName [][]byte `protobuf:"bytes,2,rep,name=task_name,json=taskName" json:"task_name,omitempty"` + AppId []byte `protobuf:"bytes,3,opt,name=app_id,json=appId" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueDeleteRequest) Reset() { *m = TaskQueueDeleteRequest{} } +func (m *TaskQueueDeleteRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueDeleteRequest) ProtoMessage() {} +func (*TaskQueueDeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{10} +} +func (m *TaskQueueDeleteRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueDeleteRequest.Unmarshal(m, b) +} +func (m *TaskQueueDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueDeleteRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueDeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueDeleteRequest.Merge(dst, src) +} +func (m *TaskQueueDeleteRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueDeleteRequest.Size(m) +} +func (m *TaskQueueDeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueDeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueDeleteRequest proto.InternalMessageInfo + +func (m *TaskQueueDeleteRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueDeleteRequest) GetTaskName() [][]byte { + if m != nil { + return m.TaskName + } + return nil +} + +func (m *TaskQueueDeleteRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +type TaskQueueDeleteResponse struct { + Result []TaskQueueServiceError_ErrorCode `protobuf:"varint,3,rep,name=result,enum=appengine.TaskQueueServiceError_ErrorCode" json:"result,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueDeleteResponse) Reset() { *m = TaskQueueDeleteResponse{} } +func (m *TaskQueueDeleteResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueDeleteResponse) ProtoMessage() {} +func (*TaskQueueDeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{11} +} +func (m *TaskQueueDeleteResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueDeleteResponse.Unmarshal(m, b) +} +func (m *TaskQueueDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueDeleteResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueDeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueDeleteResponse.Merge(dst, src) +} +func (m *TaskQueueDeleteResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueDeleteResponse.Size(m) +} +func (m *TaskQueueDeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueDeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueDeleteResponse proto.InternalMessageInfo + +func (m *TaskQueueDeleteResponse) GetResult() []TaskQueueServiceError_ErrorCode { + if m != nil { + return m.Result + } + return nil +} + +type TaskQueueForceRunRequest struct { + AppId []byte `protobuf:"bytes,1,opt,name=app_id,json=appId" json:"app_id,omitempty"` + QueueName []byte `protobuf:"bytes,2,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + TaskName []byte `protobuf:"bytes,3,req,name=task_name,json=taskName" json:"task_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueForceRunRequest) Reset() { *m = TaskQueueForceRunRequest{} } +func (m *TaskQueueForceRunRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueForceRunRequest) ProtoMessage() {} +func (*TaskQueueForceRunRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{12} +} +func (m *TaskQueueForceRunRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueForceRunRequest.Unmarshal(m, b) +} +func (m *TaskQueueForceRunRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueForceRunRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueForceRunRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueForceRunRequest.Merge(dst, src) +} +func (m *TaskQueueForceRunRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueForceRunRequest.Size(m) +} +func (m *TaskQueueForceRunRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueForceRunRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueForceRunRequest proto.InternalMessageInfo + +func (m *TaskQueueForceRunRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueueForceRunRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueForceRunRequest) GetTaskName() []byte { + if m != nil { + return m.TaskName + } + return nil +} + +type TaskQueueForceRunResponse struct { + Result *TaskQueueServiceError_ErrorCode `protobuf:"varint,3,req,name=result,enum=appengine.TaskQueueServiceError_ErrorCode" json:"result,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueForceRunResponse) Reset() { *m = TaskQueueForceRunResponse{} } +func (m *TaskQueueForceRunResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueForceRunResponse) ProtoMessage() {} +func (*TaskQueueForceRunResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{13} +} +func (m *TaskQueueForceRunResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueForceRunResponse.Unmarshal(m, b) +} +func (m *TaskQueueForceRunResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueForceRunResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueForceRunResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueForceRunResponse.Merge(dst, src) +} +func (m *TaskQueueForceRunResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueForceRunResponse.Size(m) +} +func (m *TaskQueueForceRunResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueForceRunResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueForceRunResponse proto.InternalMessageInfo + +func (m *TaskQueueForceRunResponse) GetResult() TaskQueueServiceError_ErrorCode { + if m != nil && m.Result != nil { + return *m.Result + } + return TaskQueueServiceError_OK +} + +type TaskQueueUpdateQueueRequest struct { + AppId []byte `protobuf:"bytes,1,opt,name=app_id,json=appId" json:"app_id,omitempty"` + QueueName []byte `protobuf:"bytes,2,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + BucketRefillPerSecond *float64 `protobuf:"fixed64,3,req,name=bucket_refill_per_second,json=bucketRefillPerSecond" json:"bucket_refill_per_second,omitempty"` + BucketCapacity *int32 `protobuf:"varint,4,req,name=bucket_capacity,json=bucketCapacity" json:"bucket_capacity,omitempty"` + UserSpecifiedRate *string `protobuf:"bytes,5,opt,name=user_specified_rate,json=userSpecifiedRate" json:"user_specified_rate,omitempty"` + RetryParameters *TaskQueueRetryParameters `protobuf:"bytes,6,opt,name=retry_parameters,json=retryParameters" json:"retry_parameters,omitempty"` + MaxConcurrentRequests *int32 `protobuf:"varint,7,opt,name=max_concurrent_requests,json=maxConcurrentRequests" json:"max_concurrent_requests,omitempty"` + Mode *TaskQueueMode_Mode `protobuf:"varint,8,opt,name=mode,enum=appengine.TaskQueueMode_Mode,def=0" json:"mode,omitempty"` + Acl *TaskQueueAcl `protobuf:"bytes,9,opt,name=acl" json:"acl,omitempty"` + HeaderOverride []*TaskQueueHttpHeader `protobuf:"bytes,10,rep,name=header_override,json=headerOverride" json:"header_override,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueUpdateQueueRequest) Reset() { *m = TaskQueueUpdateQueueRequest{} } +func (m *TaskQueueUpdateQueueRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueUpdateQueueRequest) ProtoMessage() {} +func (*TaskQueueUpdateQueueRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{14} +} +func (m *TaskQueueUpdateQueueRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueUpdateQueueRequest.Unmarshal(m, b) +} +func (m *TaskQueueUpdateQueueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueUpdateQueueRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueUpdateQueueRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueUpdateQueueRequest.Merge(dst, src) +} +func (m *TaskQueueUpdateQueueRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueUpdateQueueRequest.Size(m) +} +func (m *TaskQueueUpdateQueueRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueUpdateQueueRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueUpdateQueueRequest proto.InternalMessageInfo + +const Default_TaskQueueUpdateQueueRequest_Mode TaskQueueMode_Mode = TaskQueueMode_PUSH + +func (m *TaskQueueUpdateQueueRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueueUpdateQueueRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueUpdateQueueRequest) GetBucketRefillPerSecond() float64 { + if m != nil && m.BucketRefillPerSecond != nil { + return *m.BucketRefillPerSecond + } + return 0 +} + +func (m *TaskQueueUpdateQueueRequest) GetBucketCapacity() int32 { + if m != nil && m.BucketCapacity != nil { + return *m.BucketCapacity + } + return 0 +} + +func (m *TaskQueueUpdateQueueRequest) GetUserSpecifiedRate() string { + if m != nil && m.UserSpecifiedRate != nil { + return *m.UserSpecifiedRate + } + return "" +} + +func (m *TaskQueueUpdateQueueRequest) GetRetryParameters() *TaskQueueRetryParameters { + if m != nil { + return m.RetryParameters + } + return nil +} + +func (m *TaskQueueUpdateQueueRequest) GetMaxConcurrentRequests() int32 { + if m != nil && m.MaxConcurrentRequests != nil { + return *m.MaxConcurrentRequests + } + return 0 +} + +func (m *TaskQueueUpdateQueueRequest) GetMode() TaskQueueMode_Mode { + if m != nil && m.Mode != nil { + return *m.Mode + } + return Default_TaskQueueUpdateQueueRequest_Mode +} + +func (m *TaskQueueUpdateQueueRequest) GetAcl() *TaskQueueAcl { + if m != nil { + return m.Acl + } + return nil +} + +func (m *TaskQueueUpdateQueueRequest) GetHeaderOverride() []*TaskQueueHttpHeader { + if m != nil { + return m.HeaderOverride + } + return nil +} + +type TaskQueueUpdateQueueResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueUpdateQueueResponse) Reset() { *m = TaskQueueUpdateQueueResponse{} } +func (m *TaskQueueUpdateQueueResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueUpdateQueueResponse) ProtoMessage() {} +func (*TaskQueueUpdateQueueResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{15} +} +func (m *TaskQueueUpdateQueueResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueUpdateQueueResponse.Unmarshal(m, b) +} +func (m *TaskQueueUpdateQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueUpdateQueueResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueUpdateQueueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueUpdateQueueResponse.Merge(dst, src) +} +func (m *TaskQueueUpdateQueueResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueUpdateQueueResponse.Size(m) +} +func (m *TaskQueueUpdateQueueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueUpdateQueueResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueUpdateQueueResponse proto.InternalMessageInfo + +type TaskQueueFetchQueuesRequest struct { + AppId []byte `protobuf:"bytes,1,opt,name=app_id,json=appId" json:"app_id,omitempty"` + MaxRows *int32 `protobuf:"varint,2,req,name=max_rows,json=maxRows" json:"max_rows,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueFetchQueuesRequest) Reset() { *m = TaskQueueFetchQueuesRequest{} } +func (m *TaskQueueFetchQueuesRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueFetchQueuesRequest) ProtoMessage() {} +func (*TaskQueueFetchQueuesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{16} +} +func (m *TaskQueueFetchQueuesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueFetchQueuesRequest.Unmarshal(m, b) +} +func (m *TaskQueueFetchQueuesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueFetchQueuesRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueFetchQueuesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueFetchQueuesRequest.Merge(dst, src) +} +func (m *TaskQueueFetchQueuesRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueFetchQueuesRequest.Size(m) +} +func (m *TaskQueueFetchQueuesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueFetchQueuesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueFetchQueuesRequest proto.InternalMessageInfo + +func (m *TaskQueueFetchQueuesRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueueFetchQueuesRequest) GetMaxRows() int32 { + if m != nil && m.MaxRows != nil { + return *m.MaxRows + } + return 0 +} + +type TaskQueueFetchQueuesResponse struct { + Queue []*TaskQueueFetchQueuesResponse_Queue `protobuf:"group,1,rep,name=Queue,json=queue" json:"queue,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueFetchQueuesResponse) Reset() { *m = TaskQueueFetchQueuesResponse{} } +func (m *TaskQueueFetchQueuesResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueFetchQueuesResponse) ProtoMessage() {} +func (*TaskQueueFetchQueuesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{17} +} +func (m *TaskQueueFetchQueuesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueFetchQueuesResponse.Unmarshal(m, b) +} +func (m *TaskQueueFetchQueuesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueFetchQueuesResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueFetchQueuesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueFetchQueuesResponse.Merge(dst, src) +} +func (m *TaskQueueFetchQueuesResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueFetchQueuesResponse.Size(m) +} +func (m *TaskQueueFetchQueuesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueFetchQueuesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueFetchQueuesResponse proto.InternalMessageInfo + +func (m *TaskQueueFetchQueuesResponse) GetQueue() []*TaskQueueFetchQueuesResponse_Queue { + if m != nil { + return m.Queue + } + return nil +} + +type TaskQueueFetchQueuesResponse_Queue struct { + QueueName []byte `protobuf:"bytes,2,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + BucketRefillPerSecond *float64 `protobuf:"fixed64,3,req,name=bucket_refill_per_second,json=bucketRefillPerSecond" json:"bucket_refill_per_second,omitempty"` + BucketCapacity *float64 `protobuf:"fixed64,4,req,name=bucket_capacity,json=bucketCapacity" json:"bucket_capacity,omitempty"` + UserSpecifiedRate *string `protobuf:"bytes,5,opt,name=user_specified_rate,json=userSpecifiedRate" json:"user_specified_rate,omitempty"` + Paused *bool `protobuf:"varint,6,req,name=paused,def=0" json:"paused,omitempty"` + RetryParameters *TaskQueueRetryParameters `protobuf:"bytes,7,opt,name=retry_parameters,json=retryParameters" json:"retry_parameters,omitempty"` + MaxConcurrentRequests *int32 `protobuf:"varint,8,opt,name=max_concurrent_requests,json=maxConcurrentRequests" json:"max_concurrent_requests,omitempty"` + Mode *TaskQueueMode_Mode `protobuf:"varint,9,opt,name=mode,enum=appengine.TaskQueueMode_Mode,def=0" json:"mode,omitempty"` + Acl *TaskQueueAcl `protobuf:"bytes,10,opt,name=acl" json:"acl,omitempty"` + HeaderOverride []*TaskQueueHttpHeader `protobuf:"bytes,11,rep,name=header_override,json=headerOverride" json:"header_override,omitempty"` + CreatorName *string `protobuf:"bytes,12,opt,name=creator_name,json=creatorName,def=apphosting" json:"creator_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueFetchQueuesResponse_Queue) Reset() { *m = TaskQueueFetchQueuesResponse_Queue{} } +func (m *TaskQueueFetchQueuesResponse_Queue) String() string { return proto.CompactTextString(m) } +func (*TaskQueueFetchQueuesResponse_Queue) ProtoMessage() {} +func (*TaskQueueFetchQueuesResponse_Queue) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{17, 0} +} +func (m *TaskQueueFetchQueuesResponse_Queue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueFetchQueuesResponse_Queue.Unmarshal(m, b) +} +func (m *TaskQueueFetchQueuesResponse_Queue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueFetchQueuesResponse_Queue.Marshal(b, m, deterministic) +} +func (dst *TaskQueueFetchQueuesResponse_Queue) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueFetchQueuesResponse_Queue.Merge(dst, src) +} +func (m *TaskQueueFetchQueuesResponse_Queue) XXX_Size() int { + return xxx_messageInfo_TaskQueueFetchQueuesResponse_Queue.Size(m) +} +func (m *TaskQueueFetchQueuesResponse_Queue) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueFetchQueuesResponse_Queue.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueFetchQueuesResponse_Queue proto.InternalMessageInfo + +const Default_TaskQueueFetchQueuesResponse_Queue_Paused bool = false +const Default_TaskQueueFetchQueuesResponse_Queue_Mode TaskQueueMode_Mode = TaskQueueMode_PUSH +const Default_TaskQueueFetchQueuesResponse_Queue_CreatorName string = "apphosting" + +func (m *TaskQueueFetchQueuesResponse_Queue) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetBucketRefillPerSecond() float64 { + if m != nil && m.BucketRefillPerSecond != nil { + return *m.BucketRefillPerSecond + } + return 0 +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetBucketCapacity() float64 { + if m != nil && m.BucketCapacity != nil { + return *m.BucketCapacity + } + return 0 +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetUserSpecifiedRate() string { + if m != nil && m.UserSpecifiedRate != nil { + return *m.UserSpecifiedRate + } + return "" +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetPaused() bool { + if m != nil && m.Paused != nil { + return *m.Paused + } + return Default_TaskQueueFetchQueuesResponse_Queue_Paused +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetRetryParameters() *TaskQueueRetryParameters { + if m != nil { + return m.RetryParameters + } + return nil +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetMaxConcurrentRequests() int32 { + if m != nil && m.MaxConcurrentRequests != nil { + return *m.MaxConcurrentRequests + } + return 0 +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetMode() TaskQueueMode_Mode { + if m != nil && m.Mode != nil { + return *m.Mode + } + return Default_TaskQueueFetchQueuesResponse_Queue_Mode +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetAcl() *TaskQueueAcl { + if m != nil { + return m.Acl + } + return nil +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetHeaderOverride() []*TaskQueueHttpHeader { + if m != nil { + return m.HeaderOverride + } + return nil +} + +func (m *TaskQueueFetchQueuesResponse_Queue) GetCreatorName() string { + if m != nil && m.CreatorName != nil { + return *m.CreatorName + } + return Default_TaskQueueFetchQueuesResponse_Queue_CreatorName +} + +type TaskQueueFetchQueueStatsRequest struct { + AppId []byte `protobuf:"bytes,1,opt,name=app_id,json=appId" json:"app_id,omitempty"` + QueueName [][]byte `protobuf:"bytes,2,rep,name=queue_name,json=queueName" json:"queue_name,omitempty"` + MaxNumTasks *int32 `protobuf:"varint,3,opt,name=max_num_tasks,json=maxNumTasks,def=0" json:"max_num_tasks,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueFetchQueueStatsRequest) Reset() { *m = TaskQueueFetchQueueStatsRequest{} } +func (m *TaskQueueFetchQueueStatsRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueFetchQueueStatsRequest) ProtoMessage() {} +func (*TaskQueueFetchQueueStatsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{18} +} +func (m *TaskQueueFetchQueueStatsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueFetchQueueStatsRequest.Unmarshal(m, b) +} +func (m *TaskQueueFetchQueueStatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueFetchQueueStatsRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueFetchQueueStatsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueFetchQueueStatsRequest.Merge(dst, src) +} +func (m *TaskQueueFetchQueueStatsRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueFetchQueueStatsRequest.Size(m) +} +func (m *TaskQueueFetchQueueStatsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueFetchQueueStatsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueFetchQueueStatsRequest proto.InternalMessageInfo + +const Default_TaskQueueFetchQueueStatsRequest_MaxNumTasks int32 = 0 + +func (m *TaskQueueFetchQueueStatsRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueueFetchQueueStatsRequest) GetQueueName() [][]byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueFetchQueueStatsRequest) GetMaxNumTasks() int32 { + if m != nil && m.MaxNumTasks != nil { + return *m.MaxNumTasks + } + return Default_TaskQueueFetchQueueStatsRequest_MaxNumTasks +} + +type TaskQueueScannerQueueInfo struct { + ExecutedLastMinute *int64 `protobuf:"varint,1,req,name=executed_last_minute,json=executedLastMinute" json:"executed_last_minute,omitempty"` + ExecutedLastHour *int64 `protobuf:"varint,2,req,name=executed_last_hour,json=executedLastHour" json:"executed_last_hour,omitempty"` + SamplingDurationSeconds *float64 `protobuf:"fixed64,3,req,name=sampling_duration_seconds,json=samplingDurationSeconds" json:"sampling_duration_seconds,omitempty"` + RequestsInFlight *int32 `protobuf:"varint,4,opt,name=requests_in_flight,json=requestsInFlight" json:"requests_in_flight,omitempty"` + EnforcedRate *float64 `protobuf:"fixed64,5,opt,name=enforced_rate,json=enforcedRate" json:"enforced_rate,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueScannerQueueInfo) Reset() { *m = TaskQueueScannerQueueInfo{} } +func (m *TaskQueueScannerQueueInfo) String() string { return proto.CompactTextString(m) } +func (*TaskQueueScannerQueueInfo) ProtoMessage() {} +func (*TaskQueueScannerQueueInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{19} +} +func (m *TaskQueueScannerQueueInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueScannerQueueInfo.Unmarshal(m, b) +} +func (m *TaskQueueScannerQueueInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueScannerQueueInfo.Marshal(b, m, deterministic) +} +func (dst *TaskQueueScannerQueueInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueScannerQueueInfo.Merge(dst, src) +} +func (m *TaskQueueScannerQueueInfo) XXX_Size() int { + return xxx_messageInfo_TaskQueueScannerQueueInfo.Size(m) +} +func (m *TaskQueueScannerQueueInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueScannerQueueInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueScannerQueueInfo proto.InternalMessageInfo + +func (m *TaskQueueScannerQueueInfo) GetExecutedLastMinute() int64 { + if m != nil && m.ExecutedLastMinute != nil { + return *m.ExecutedLastMinute + } + return 0 +} + +func (m *TaskQueueScannerQueueInfo) GetExecutedLastHour() int64 { + if m != nil && m.ExecutedLastHour != nil { + return *m.ExecutedLastHour + } + return 0 +} + +func (m *TaskQueueScannerQueueInfo) GetSamplingDurationSeconds() float64 { + if m != nil && m.SamplingDurationSeconds != nil { + return *m.SamplingDurationSeconds + } + return 0 +} + +func (m *TaskQueueScannerQueueInfo) GetRequestsInFlight() int32 { + if m != nil && m.RequestsInFlight != nil { + return *m.RequestsInFlight + } + return 0 +} + +func (m *TaskQueueScannerQueueInfo) GetEnforcedRate() float64 { + if m != nil && m.EnforcedRate != nil { + return *m.EnforcedRate + } + return 0 +} + +type TaskQueueFetchQueueStatsResponse struct { + Queuestats []*TaskQueueFetchQueueStatsResponse_QueueStats `protobuf:"group,1,rep,name=QueueStats,json=queuestats" json:"queuestats,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueFetchQueueStatsResponse) Reset() { *m = TaskQueueFetchQueueStatsResponse{} } +func (m *TaskQueueFetchQueueStatsResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueFetchQueueStatsResponse) ProtoMessage() {} +func (*TaskQueueFetchQueueStatsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{20} +} +func (m *TaskQueueFetchQueueStatsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueFetchQueueStatsResponse.Unmarshal(m, b) +} +func (m *TaskQueueFetchQueueStatsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueFetchQueueStatsResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueFetchQueueStatsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueFetchQueueStatsResponse.Merge(dst, src) +} +func (m *TaskQueueFetchQueueStatsResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueFetchQueueStatsResponse.Size(m) +} +func (m *TaskQueueFetchQueueStatsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueFetchQueueStatsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueFetchQueueStatsResponse proto.InternalMessageInfo + +func (m *TaskQueueFetchQueueStatsResponse) GetQueuestats() []*TaskQueueFetchQueueStatsResponse_QueueStats { + if m != nil { + return m.Queuestats + } + return nil +} + +type TaskQueueFetchQueueStatsResponse_QueueStats struct { + NumTasks *int32 `protobuf:"varint,2,req,name=num_tasks,json=numTasks" json:"num_tasks,omitempty"` + OldestEtaUsec *int64 `protobuf:"varint,3,req,name=oldest_eta_usec,json=oldestEtaUsec" json:"oldest_eta_usec,omitempty"` + ScannerInfo *TaskQueueScannerQueueInfo `protobuf:"bytes,4,opt,name=scanner_info,json=scannerInfo" json:"scanner_info,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueFetchQueueStatsResponse_QueueStats) Reset() { + *m = TaskQueueFetchQueueStatsResponse_QueueStats{} +} +func (m *TaskQueueFetchQueueStatsResponse_QueueStats) String() string { + return proto.CompactTextString(m) +} +func (*TaskQueueFetchQueueStatsResponse_QueueStats) ProtoMessage() {} +func (*TaskQueueFetchQueueStatsResponse_QueueStats) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{20, 0} +} +func (m *TaskQueueFetchQueueStatsResponse_QueueStats) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueFetchQueueStatsResponse_QueueStats.Unmarshal(m, b) +} +func (m *TaskQueueFetchQueueStatsResponse_QueueStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueFetchQueueStatsResponse_QueueStats.Marshal(b, m, deterministic) +} +func (dst *TaskQueueFetchQueueStatsResponse_QueueStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueFetchQueueStatsResponse_QueueStats.Merge(dst, src) +} +func (m *TaskQueueFetchQueueStatsResponse_QueueStats) XXX_Size() int { + return xxx_messageInfo_TaskQueueFetchQueueStatsResponse_QueueStats.Size(m) +} +func (m *TaskQueueFetchQueueStatsResponse_QueueStats) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueFetchQueueStatsResponse_QueueStats.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueFetchQueueStatsResponse_QueueStats proto.InternalMessageInfo + +func (m *TaskQueueFetchQueueStatsResponse_QueueStats) GetNumTasks() int32 { + if m != nil && m.NumTasks != nil { + return *m.NumTasks + } + return 0 +} + +func (m *TaskQueueFetchQueueStatsResponse_QueueStats) GetOldestEtaUsec() int64 { + if m != nil && m.OldestEtaUsec != nil { + return *m.OldestEtaUsec + } + return 0 +} + +func (m *TaskQueueFetchQueueStatsResponse_QueueStats) GetScannerInfo() *TaskQueueScannerQueueInfo { + if m != nil { + return m.ScannerInfo + } + return nil +} + +type TaskQueuePauseQueueRequest struct { + AppId []byte `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` + QueueName []byte `protobuf:"bytes,2,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + Pause *bool `protobuf:"varint,3,req,name=pause" json:"pause,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueuePauseQueueRequest) Reset() { *m = TaskQueuePauseQueueRequest{} } +func (m *TaskQueuePauseQueueRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueuePauseQueueRequest) ProtoMessage() {} +func (*TaskQueuePauseQueueRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{21} +} +func (m *TaskQueuePauseQueueRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueuePauseQueueRequest.Unmarshal(m, b) +} +func (m *TaskQueuePauseQueueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueuePauseQueueRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueuePauseQueueRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueuePauseQueueRequest.Merge(dst, src) +} +func (m *TaskQueuePauseQueueRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueuePauseQueueRequest.Size(m) +} +func (m *TaskQueuePauseQueueRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueuePauseQueueRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueuePauseQueueRequest proto.InternalMessageInfo + +func (m *TaskQueuePauseQueueRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueuePauseQueueRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueuePauseQueueRequest) GetPause() bool { + if m != nil && m.Pause != nil { + return *m.Pause + } + return false +} + +type TaskQueuePauseQueueResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueuePauseQueueResponse) Reset() { *m = TaskQueuePauseQueueResponse{} } +func (m *TaskQueuePauseQueueResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueuePauseQueueResponse) ProtoMessage() {} +func (*TaskQueuePauseQueueResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{22} +} +func (m *TaskQueuePauseQueueResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueuePauseQueueResponse.Unmarshal(m, b) +} +func (m *TaskQueuePauseQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueuePauseQueueResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueuePauseQueueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueuePauseQueueResponse.Merge(dst, src) +} +func (m *TaskQueuePauseQueueResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueuePauseQueueResponse.Size(m) +} +func (m *TaskQueuePauseQueueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueuePauseQueueResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueuePauseQueueResponse proto.InternalMessageInfo + +type TaskQueuePurgeQueueRequest struct { + AppId []byte `protobuf:"bytes,1,opt,name=app_id,json=appId" json:"app_id,omitempty"` + QueueName []byte `protobuf:"bytes,2,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueuePurgeQueueRequest) Reset() { *m = TaskQueuePurgeQueueRequest{} } +func (m *TaskQueuePurgeQueueRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueuePurgeQueueRequest) ProtoMessage() {} +func (*TaskQueuePurgeQueueRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{23} +} +func (m *TaskQueuePurgeQueueRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueuePurgeQueueRequest.Unmarshal(m, b) +} +func (m *TaskQueuePurgeQueueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueuePurgeQueueRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueuePurgeQueueRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueuePurgeQueueRequest.Merge(dst, src) +} +func (m *TaskQueuePurgeQueueRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueuePurgeQueueRequest.Size(m) +} +func (m *TaskQueuePurgeQueueRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueuePurgeQueueRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueuePurgeQueueRequest proto.InternalMessageInfo + +func (m *TaskQueuePurgeQueueRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueuePurgeQueueRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +type TaskQueuePurgeQueueResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueuePurgeQueueResponse) Reset() { *m = TaskQueuePurgeQueueResponse{} } +func (m *TaskQueuePurgeQueueResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueuePurgeQueueResponse) ProtoMessage() {} +func (*TaskQueuePurgeQueueResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{24} +} +func (m *TaskQueuePurgeQueueResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueuePurgeQueueResponse.Unmarshal(m, b) +} +func (m *TaskQueuePurgeQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueuePurgeQueueResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueuePurgeQueueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueuePurgeQueueResponse.Merge(dst, src) +} +func (m *TaskQueuePurgeQueueResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueuePurgeQueueResponse.Size(m) +} +func (m *TaskQueuePurgeQueueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueuePurgeQueueResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueuePurgeQueueResponse proto.InternalMessageInfo + +type TaskQueueDeleteQueueRequest struct { + AppId []byte `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` + QueueName []byte `protobuf:"bytes,2,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueDeleteQueueRequest) Reset() { *m = TaskQueueDeleteQueueRequest{} } +func (m *TaskQueueDeleteQueueRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueDeleteQueueRequest) ProtoMessage() {} +func (*TaskQueueDeleteQueueRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{25} +} +func (m *TaskQueueDeleteQueueRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueDeleteQueueRequest.Unmarshal(m, b) +} +func (m *TaskQueueDeleteQueueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueDeleteQueueRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueDeleteQueueRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueDeleteQueueRequest.Merge(dst, src) +} +func (m *TaskQueueDeleteQueueRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueDeleteQueueRequest.Size(m) +} +func (m *TaskQueueDeleteQueueRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueDeleteQueueRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueDeleteQueueRequest proto.InternalMessageInfo + +func (m *TaskQueueDeleteQueueRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueueDeleteQueueRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +type TaskQueueDeleteQueueResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueDeleteQueueResponse) Reset() { *m = TaskQueueDeleteQueueResponse{} } +func (m *TaskQueueDeleteQueueResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueDeleteQueueResponse) ProtoMessage() {} +func (*TaskQueueDeleteQueueResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{26} +} +func (m *TaskQueueDeleteQueueResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueDeleteQueueResponse.Unmarshal(m, b) +} +func (m *TaskQueueDeleteQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueDeleteQueueResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueDeleteQueueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueDeleteQueueResponse.Merge(dst, src) +} +func (m *TaskQueueDeleteQueueResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueDeleteQueueResponse.Size(m) +} +func (m *TaskQueueDeleteQueueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueDeleteQueueResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueDeleteQueueResponse proto.InternalMessageInfo + +type TaskQueueDeleteGroupRequest struct { + AppId []byte `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueDeleteGroupRequest) Reset() { *m = TaskQueueDeleteGroupRequest{} } +func (m *TaskQueueDeleteGroupRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueDeleteGroupRequest) ProtoMessage() {} +func (*TaskQueueDeleteGroupRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{27} +} +func (m *TaskQueueDeleteGroupRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueDeleteGroupRequest.Unmarshal(m, b) +} +func (m *TaskQueueDeleteGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueDeleteGroupRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueDeleteGroupRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueDeleteGroupRequest.Merge(dst, src) +} +func (m *TaskQueueDeleteGroupRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueDeleteGroupRequest.Size(m) +} +func (m *TaskQueueDeleteGroupRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueDeleteGroupRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueDeleteGroupRequest proto.InternalMessageInfo + +func (m *TaskQueueDeleteGroupRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +type TaskQueueDeleteGroupResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueDeleteGroupResponse) Reset() { *m = TaskQueueDeleteGroupResponse{} } +func (m *TaskQueueDeleteGroupResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueDeleteGroupResponse) ProtoMessage() {} +func (*TaskQueueDeleteGroupResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{28} +} +func (m *TaskQueueDeleteGroupResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueDeleteGroupResponse.Unmarshal(m, b) +} +func (m *TaskQueueDeleteGroupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueDeleteGroupResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueDeleteGroupResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueDeleteGroupResponse.Merge(dst, src) +} +func (m *TaskQueueDeleteGroupResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueDeleteGroupResponse.Size(m) +} +func (m *TaskQueueDeleteGroupResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueDeleteGroupResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueDeleteGroupResponse proto.InternalMessageInfo + +type TaskQueueQueryTasksRequest struct { + AppId []byte `protobuf:"bytes,1,opt,name=app_id,json=appId" json:"app_id,omitempty"` + QueueName []byte `protobuf:"bytes,2,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + StartTaskName []byte `protobuf:"bytes,3,opt,name=start_task_name,json=startTaskName" json:"start_task_name,omitempty"` + StartEtaUsec *int64 `protobuf:"varint,4,opt,name=start_eta_usec,json=startEtaUsec" json:"start_eta_usec,omitempty"` + StartTag []byte `protobuf:"bytes,6,opt,name=start_tag,json=startTag" json:"start_tag,omitempty"` + MaxRows *int32 `protobuf:"varint,5,opt,name=max_rows,json=maxRows,def=1" json:"max_rows,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueQueryTasksRequest) Reset() { *m = TaskQueueQueryTasksRequest{} } +func (m *TaskQueueQueryTasksRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueQueryTasksRequest) ProtoMessage() {} +func (*TaskQueueQueryTasksRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{29} +} +func (m *TaskQueueQueryTasksRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueQueryTasksRequest.Unmarshal(m, b) +} +func (m *TaskQueueQueryTasksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueQueryTasksRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueQueryTasksRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueQueryTasksRequest.Merge(dst, src) +} +func (m *TaskQueueQueryTasksRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueQueryTasksRequest.Size(m) +} +func (m *TaskQueueQueryTasksRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueQueryTasksRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueQueryTasksRequest proto.InternalMessageInfo + +const Default_TaskQueueQueryTasksRequest_MaxRows int32 = 1 + +func (m *TaskQueueQueryTasksRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueueQueryTasksRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueQueryTasksRequest) GetStartTaskName() []byte { + if m != nil { + return m.StartTaskName + } + return nil +} + +func (m *TaskQueueQueryTasksRequest) GetStartEtaUsec() int64 { + if m != nil && m.StartEtaUsec != nil { + return *m.StartEtaUsec + } + return 0 +} + +func (m *TaskQueueQueryTasksRequest) GetStartTag() []byte { + if m != nil { + return m.StartTag + } + return nil +} + +func (m *TaskQueueQueryTasksRequest) GetMaxRows() int32 { + if m != nil && m.MaxRows != nil { + return *m.MaxRows + } + return Default_TaskQueueQueryTasksRequest_MaxRows +} + +type TaskQueueQueryTasksResponse struct { + Task []*TaskQueueQueryTasksResponse_Task `protobuf:"group,1,rep,name=Task,json=task" json:"task,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueQueryTasksResponse) Reset() { *m = TaskQueueQueryTasksResponse{} } +func (m *TaskQueueQueryTasksResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueQueryTasksResponse) ProtoMessage() {} +func (*TaskQueueQueryTasksResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{30} +} +func (m *TaskQueueQueryTasksResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueQueryTasksResponse.Unmarshal(m, b) +} +func (m *TaskQueueQueryTasksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueQueryTasksResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueQueryTasksResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueQueryTasksResponse.Merge(dst, src) +} +func (m *TaskQueueQueryTasksResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueQueryTasksResponse.Size(m) +} +func (m *TaskQueueQueryTasksResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueQueryTasksResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueQueryTasksResponse proto.InternalMessageInfo + +func (m *TaskQueueQueryTasksResponse) GetTask() []*TaskQueueQueryTasksResponse_Task { + if m != nil { + return m.Task + } + return nil +} + +type TaskQueueQueryTasksResponse_Task struct { + TaskName []byte `protobuf:"bytes,2,req,name=task_name,json=taskName" json:"task_name,omitempty"` + EtaUsec *int64 `protobuf:"varint,3,req,name=eta_usec,json=etaUsec" json:"eta_usec,omitempty"` + Url []byte `protobuf:"bytes,4,opt,name=url" json:"url,omitempty"` + Method *TaskQueueQueryTasksResponse_Task_RequestMethod `protobuf:"varint,5,opt,name=method,enum=appengine.TaskQueueQueryTasksResponse_Task_RequestMethod" json:"method,omitempty"` + RetryCount *int32 `protobuf:"varint,6,opt,name=retry_count,json=retryCount,def=0" json:"retry_count,omitempty"` + Header []*TaskQueueQueryTasksResponse_Task_Header `protobuf:"group,7,rep,name=Header,json=header" json:"header,omitempty"` + BodySize *int32 `protobuf:"varint,10,opt,name=body_size,json=bodySize" json:"body_size,omitempty"` + Body []byte `protobuf:"bytes,11,opt,name=body" json:"body,omitempty"` + CreationTimeUsec *int64 `protobuf:"varint,12,req,name=creation_time_usec,json=creationTimeUsec" json:"creation_time_usec,omitempty"` + Crontimetable *TaskQueueQueryTasksResponse_Task_CronTimetable `protobuf:"group,13,opt,name=CronTimetable,json=crontimetable" json:"crontimetable,omitempty"` + Runlog *TaskQueueQueryTasksResponse_Task_RunLog `protobuf:"group,16,opt,name=RunLog,json=runlog" json:"runlog,omitempty"` + Description []byte `protobuf:"bytes,21,opt,name=description" json:"description,omitempty"` + Payload *TaskPayload `protobuf:"bytes,22,opt,name=payload" json:"payload,omitempty"` + RetryParameters *TaskQueueRetryParameters `protobuf:"bytes,23,opt,name=retry_parameters,json=retryParameters" json:"retry_parameters,omitempty"` + FirstTryUsec *int64 `protobuf:"varint,24,opt,name=first_try_usec,json=firstTryUsec" json:"first_try_usec,omitempty"` + Tag []byte `protobuf:"bytes,25,opt,name=tag" json:"tag,omitempty"` + ExecutionCount *int32 `protobuf:"varint,26,opt,name=execution_count,json=executionCount,def=0" json:"execution_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueQueryTasksResponse_Task) Reset() { *m = TaskQueueQueryTasksResponse_Task{} } +func (m *TaskQueueQueryTasksResponse_Task) String() string { return proto.CompactTextString(m) } +func (*TaskQueueQueryTasksResponse_Task) ProtoMessage() {} +func (*TaskQueueQueryTasksResponse_Task) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{30, 0} +} +func (m *TaskQueueQueryTasksResponse_Task) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task.Unmarshal(m, b) +} +func (m *TaskQueueQueryTasksResponse_Task) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task.Marshal(b, m, deterministic) +} +func (dst *TaskQueueQueryTasksResponse_Task) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueQueryTasksResponse_Task.Merge(dst, src) +} +func (m *TaskQueueQueryTasksResponse_Task) XXX_Size() int { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task.Size(m) +} +func (m *TaskQueueQueryTasksResponse_Task) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueQueryTasksResponse_Task.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueQueryTasksResponse_Task proto.InternalMessageInfo + +const Default_TaskQueueQueryTasksResponse_Task_RetryCount int32 = 0 +const Default_TaskQueueQueryTasksResponse_Task_ExecutionCount int32 = 0 + +func (m *TaskQueueQueryTasksResponse_Task) GetTaskName() []byte { + if m != nil { + return m.TaskName + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetEtaUsec() int64 { + if m != nil && m.EtaUsec != nil { + return *m.EtaUsec + } + return 0 +} + +func (m *TaskQueueQueryTasksResponse_Task) GetUrl() []byte { + if m != nil { + return m.Url + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetMethod() TaskQueueQueryTasksResponse_Task_RequestMethod { + if m != nil && m.Method != nil { + return *m.Method + } + return TaskQueueQueryTasksResponse_Task_GET +} + +func (m *TaskQueueQueryTasksResponse_Task) GetRetryCount() int32 { + if m != nil && m.RetryCount != nil { + return *m.RetryCount + } + return Default_TaskQueueQueryTasksResponse_Task_RetryCount +} + +func (m *TaskQueueQueryTasksResponse_Task) GetHeader() []*TaskQueueQueryTasksResponse_Task_Header { + if m != nil { + return m.Header + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetBodySize() int32 { + if m != nil && m.BodySize != nil { + return *m.BodySize + } + return 0 +} + +func (m *TaskQueueQueryTasksResponse_Task) GetBody() []byte { + if m != nil { + return m.Body + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetCreationTimeUsec() int64 { + if m != nil && m.CreationTimeUsec != nil { + return *m.CreationTimeUsec + } + return 0 +} + +func (m *TaskQueueQueryTasksResponse_Task) GetCrontimetable() *TaskQueueQueryTasksResponse_Task_CronTimetable { + if m != nil { + return m.Crontimetable + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetRunlog() *TaskQueueQueryTasksResponse_Task_RunLog { + if m != nil { + return m.Runlog + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetDescription() []byte { + if m != nil { + return m.Description + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetPayload() *TaskPayload { + if m != nil { + return m.Payload + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetRetryParameters() *TaskQueueRetryParameters { + if m != nil { + return m.RetryParameters + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetFirstTryUsec() int64 { + if m != nil && m.FirstTryUsec != nil { + return *m.FirstTryUsec + } + return 0 +} + +func (m *TaskQueueQueryTasksResponse_Task) GetTag() []byte { + if m != nil { + return m.Tag + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task) GetExecutionCount() int32 { + if m != nil && m.ExecutionCount != nil { + return *m.ExecutionCount + } + return Default_TaskQueueQueryTasksResponse_Task_ExecutionCount +} + +type TaskQueueQueryTasksResponse_Task_Header struct { + Key []byte `protobuf:"bytes,8,req,name=key" json:"key,omitempty"` + Value []byte `protobuf:"bytes,9,req,name=value" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueQueryTasksResponse_Task_Header) Reset() { + *m = TaskQueueQueryTasksResponse_Task_Header{} +} +func (m *TaskQueueQueryTasksResponse_Task_Header) String() string { return proto.CompactTextString(m) } +func (*TaskQueueQueryTasksResponse_Task_Header) ProtoMessage() {} +func (*TaskQueueQueryTasksResponse_Task_Header) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{30, 0, 0} +} +func (m *TaskQueueQueryTasksResponse_Task_Header) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task_Header.Unmarshal(m, b) +} +func (m *TaskQueueQueryTasksResponse_Task_Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task_Header.Marshal(b, m, deterministic) +} +func (dst *TaskQueueQueryTasksResponse_Task_Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueQueryTasksResponse_Task_Header.Merge(dst, src) +} +func (m *TaskQueueQueryTasksResponse_Task_Header) XXX_Size() int { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task_Header.Size(m) +} +func (m *TaskQueueQueryTasksResponse_Task_Header) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueQueryTasksResponse_Task_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueQueryTasksResponse_Task_Header proto.InternalMessageInfo + +func (m *TaskQueueQueryTasksResponse_Task_Header) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task_Header) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type TaskQueueQueryTasksResponse_Task_CronTimetable struct { + Schedule []byte `protobuf:"bytes,14,req,name=schedule" json:"schedule,omitempty"` + Timezone []byte `protobuf:"bytes,15,req,name=timezone" json:"timezone,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueQueryTasksResponse_Task_CronTimetable) Reset() { + *m = TaskQueueQueryTasksResponse_Task_CronTimetable{} +} +func (m *TaskQueueQueryTasksResponse_Task_CronTimetable) String() string { + return proto.CompactTextString(m) +} +func (*TaskQueueQueryTasksResponse_Task_CronTimetable) ProtoMessage() {} +func (*TaskQueueQueryTasksResponse_Task_CronTimetable) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{30, 0, 1} +} +func (m *TaskQueueQueryTasksResponse_Task_CronTimetable) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task_CronTimetable.Unmarshal(m, b) +} +func (m *TaskQueueQueryTasksResponse_Task_CronTimetable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task_CronTimetable.Marshal(b, m, deterministic) +} +func (dst *TaskQueueQueryTasksResponse_Task_CronTimetable) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueQueryTasksResponse_Task_CronTimetable.Merge(dst, src) +} +func (m *TaskQueueQueryTasksResponse_Task_CronTimetable) XXX_Size() int { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task_CronTimetable.Size(m) +} +func (m *TaskQueueQueryTasksResponse_Task_CronTimetable) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueQueryTasksResponse_Task_CronTimetable.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueQueryTasksResponse_Task_CronTimetable proto.InternalMessageInfo + +func (m *TaskQueueQueryTasksResponse_Task_CronTimetable) GetSchedule() []byte { + if m != nil { + return m.Schedule + } + return nil +} + +func (m *TaskQueueQueryTasksResponse_Task_CronTimetable) GetTimezone() []byte { + if m != nil { + return m.Timezone + } + return nil +} + +type TaskQueueQueryTasksResponse_Task_RunLog struct { + DispatchedUsec *int64 `protobuf:"varint,17,req,name=dispatched_usec,json=dispatchedUsec" json:"dispatched_usec,omitempty"` + LagUsec *int64 `protobuf:"varint,18,req,name=lag_usec,json=lagUsec" json:"lag_usec,omitempty"` + ElapsedUsec *int64 `protobuf:"varint,19,req,name=elapsed_usec,json=elapsedUsec" json:"elapsed_usec,omitempty"` + ResponseCode *int64 `protobuf:"varint,20,opt,name=response_code,json=responseCode" json:"response_code,omitempty"` + RetryReason *string `protobuf:"bytes,27,opt,name=retry_reason,json=retryReason" json:"retry_reason,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueQueryTasksResponse_Task_RunLog) Reset() { + *m = TaskQueueQueryTasksResponse_Task_RunLog{} +} +func (m *TaskQueueQueryTasksResponse_Task_RunLog) String() string { return proto.CompactTextString(m) } +func (*TaskQueueQueryTasksResponse_Task_RunLog) ProtoMessage() {} +func (*TaskQueueQueryTasksResponse_Task_RunLog) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{30, 0, 2} +} +func (m *TaskQueueQueryTasksResponse_Task_RunLog) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task_RunLog.Unmarshal(m, b) +} +func (m *TaskQueueQueryTasksResponse_Task_RunLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task_RunLog.Marshal(b, m, deterministic) +} +func (dst *TaskQueueQueryTasksResponse_Task_RunLog) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueQueryTasksResponse_Task_RunLog.Merge(dst, src) +} +func (m *TaskQueueQueryTasksResponse_Task_RunLog) XXX_Size() int { + return xxx_messageInfo_TaskQueueQueryTasksResponse_Task_RunLog.Size(m) +} +func (m *TaskQueueQueryTasksResponse_Task_RunLog) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueQueryTasksResponse_Task_RunLog.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueQueryTasksResponse_Task_RunLog proto.InternalMessageInfo + +func (m *TaskQueueQueryTasksResponse_Task_RunLog) GetDispatchedUsec() int64 { + if m != nil && m.DispatchedUsec != nil { + return *m.DispatchedUsec + } + return 0 +} + +func (m *TaskQueueQueryTasksResponse_Task_RunLog) GetLagUsec() int64 { + if m != nil && m.LagUsec != nil { + return *m.LagUsec + } + return 0 +} + +func (m *TaskQueueQueryTasksResponse_Task_RunLog) GetElapsedUsec() int64 { + if m != nil && m.ElapsedUsec != nil { + return *m.ElapsedUsec + } + return 0 +} + +func (m *TaskQueueQueryTasksResponse_Task_RunLog) GetResponseCode() int64 { + if m != nil && m.ResponseCode != nil { + return *m.ResponseCode + } + return 0 +} + +func (m *TaskQueueQueryTasksResponse_Task_RunLog) GetRetryReason() string { + if m != nil && m.RetryReason != nil { + return *m.RetryReason + } + return "" +} + +type TaskQueueFetchTaskRequest struct { + AppId []byte `protobuf:"bytes,1,opt,name=app_id,json=appId" json:"app_id,omitempty"` + QueueName []byte `protobuf:"bytes,2,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + TaskName []byte `protobuf:"bytes,3,req,name=task_name,json=taskName" json:"task_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueFetchTaskRequest) Reset() { *m = TaskQueueFetchTaskRequest{} } +func (m *TaskQueueFetchTaskRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueFetchTaskRequest) ProtoMessage() {} +func (*TaskQueueFetchTaskRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{31} +} +func (m *TaskQueueFetchTaskRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueFetchTaskRequest.Unmarshal(m, b) +} +func (m *TaskQueueFetchTaskRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueFetchTaskRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueFetchTaskRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueFetchTaskRequest.Merge(dst, src) +} +func (m *TaskQueueFetchTaskRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueFetchTaskRequest.Size(m) +} +func (m *TaskQueueFetchTaskRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueFetchTaskRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueFetchTaskRequest proto.InternalMessageInfo + +func (m *TaskQueueFetchTaskRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueueFetchTaskRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueFetchTaskRequest) GetTaskName() []byte { + if m != nil { + return m.TaskName + } + return nil +} + +type TaskQueueFetchTaskResponse struct { + Task *TaskQueueQueryTasksResponse `protobuf:"bytes,1,req,name=task" json:"task,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueFetchTaskResponse) Reset() { *m = TaskQueueFetchTaskResponse{} } +func (m *TaskQueueFetchTaskResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueFetchTaskResponse) ProtoMessage() {} +func (*TaskQueueFetchTaskResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{32} +} +func (m *TaskQueueFetchTaskResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueFetchTaskResponse.Unmarshal(m, b) +} +func (m *TaskQueueFetchTaskResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueFetchTaskResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueFetchTaskResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueFetchTaskResponse.Merge(dst, src) +} +func (m *TaskQueueFetchTaskResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueFetchTaskResponse.Size(m) +} +func (m *TaskQueueFetchTaskResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueFetchTaskResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueFetchTaskResponse proto.InternalMessageInfo + +func (m *TaskQueueFetchTaskResponse) GetTask() *TaskQueueQueryTasksResponse { + if m != nil { + return m.Task + } + return nil +} + +type TaskQueueUpdateStorageLimitRequest struct { + AppId []byte `protobuf:"bytes,1,req,name=app_id,json=appId" json:"app_id,omitempty"` + Limit *int64 `protobuf:"varint,2,req,name=limit" json:"limit,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueUpdateStorageLimitRequest) Reset() { *m = TaskQueueUpdateStorageLimitRequest{} } +func (m *TaskQueueUpdateStorageLimitRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueUpdateStorageLimitRequest) ProtoMessage() {} +func (*TaskQueueUpdateStorageLimitRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{33} +} +func (m *TaskQueueUpdateStorageLimitRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueUpdateStorageLimitRequest.Unmarshal(m, b) +} +func (m *TaskQueueUpdateStorageLimitRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueUpdateStorageLimitRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueUpdateStorageLimitRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueUpdateStorageLimitRequest.Merge(dst, src) +} +func (m *TaskQueueUpdateStorageLimitRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueUpdateStorageLimitRequest.Size(m) +} +func (m *TaskQueueUpdateStorageLimitRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueUpdateStorageLimitRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueUpdateStorageLimitRequest proto.InternalMessageInfo + +func (m *TaskQueueUpdateStorageLimitRequest) GetAppId() []byte { + if m != nil { + return m.AppId + } + return nil +} + +func (m *TaskQueueUpdateStorageLimitRequest) GetLimit() int64 { + if m != nil && m.Limit != nil { + return *m.Limit + } + return 0 +} + +type TaskQueueUpdateStorageLimitResponse struct { + NewLimit *int64 `protobuf:"varint,1,req,name=new_limit,json=newLimit" json:"new_limit,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueUpdateStorageLimitResponse) Reset() { *m = TaskQueueUpdateStorageLimitResponse{} } +func (m *TaskQueueUpdateStorageLimitResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueUpdateStorageLimitResponse) ProtoMessage() {} +func (*TaskQueueUpdateStorageLimitResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{34} +} +func (m *TaskQueueUpdateStorageLimitResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueUpdateStorageLimitResponse.Unmarshal(m, b) +} +func (m *TaskQueueUpdateStorageLimitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueUpdateStorageLimitResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueUpdateStorageLimitResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueUpdateStorageLimitResponse.Merge(dst, src) +} +func (m *TaskQueueUpdateStorageLimitResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueUpdateStorageLimitResponse.Size(m) +} +func (m *TaskQueueUpdateStorageLimitResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueUpdateStorageLimitResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueUpdateStorageLimitResponse proto.InternalMessageInfo + +func (m *TaskQueueUpdateStorageLimitResponse) GetNewLimit() int64 { + if m != nil && m.NewLimit != nil { + return *m.NewLimit + } + return 0 +} + +type TaskQueueQueryAndOwnTasksRequest struct { + QueueName []byte `protobuf:"bytes,1,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + LeaseSeconds *float64 `protobuf:"fixed64,2,req,name=lease_seconds,json=leaseSeconds" json:"lease_seconds,omitempty"` + MaxTasks *int64 `protobuf:"varint,3,req,name=max_tasks,json=maxTasks" json:"max_tasks,omitempty"` + GroupByTag *bool `protobuf:"varint,4,opt,name=group_by_tag,json=groupByTag,def=0" json:"group_by_tag,omitempty"` + Tag []byte `protobuf:"bytes,5,opt,name=tag" json:"tag,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueQueryAndOwnTasksRequest) Reset() { *m = TaskQueueQueryAndOwnTasksRequest{} } +func (m *TaskQueueQueryAndOwnTasksRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueQueryAndOwnTasksRequest) ProtoMessage() {} +func (*TaskQueueQueryAndOwnTasksRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{35} +} +func (m *TaskQueueQueryAndOwnTasksRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueQueryAndOwnTasksRequest.Unmarshal(m, b) +} +func (m *TaskQueueQueryAndOwnTasksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueQueryAndOwnTasksRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueQueryAndOwnTasksRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueQueryAndOwnTasksRequest.Merge(dst, src) +} +func (m *TaskQueueQueryAndOwnTasksRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueQueryAndOwnTasksRequest.Size(m) +} +func (m *TaskQueueQueryAndOwnTasksRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueQueryAndOwnTasksRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueQueryAndOwnTasksRequest proto.InternalMessageInfo + +const Default_TaskQueueQueryAndOwnTasksRequest_GroupByTag bool = false + +func (m *TaskQueueQueryAndOwnTasksRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueQueryAndOwnTasksRequest) GetLeaseSeconds() float64 { + if m != nil && m.LeaseSeconds != nil { + return *m.LeaseSeconds + } + return 0 +} + +func (m *TaskQueueQueryAndOwnTasksRequest) GetMaxTasks() int64 { + if m != nil && m.MaxTasks != nil { + return *m.MaxTasks + } + return 0 +} + +func (m *TaskQueueQueryAndOwnTasksRequest) GetGroupByTag() bool { + if m != nil && m.GroupByTag != nil { + return *m.GroupByTag + } + return Default_TaskQueueQueryAndOwnTasksRequest_GroupByTag +} + +func (m *TaskQueueQueryAndOwnTasksRequest) GetTag() []byte { + if m != nil { + return m.Tag + } + return nil +} + +type TaskQueueQueryAndOwnTasksResponse struct { + Task []*TaskQueueQueryAndOwnTasksResponse_Task `protobuf:"group,1,rep,name=Task,json=task" json:"task,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueQueryAndOwnTasksResponse) Reset() { *m = TaskQueueQueryAndOwnTasksResponse{} } +func (m *TaskQueueQueryAndOwnTasksResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueQueryAndOwnTasksResponse) ProtoMessage() {} +func (*TaskQueueQueryAndOwnTasksResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{36} +} +func (m *TaskQueueQueryAndOwnTasksResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse.Unmarshal(m, b) +} +func (m *TaskQueueQueryAndOwnTasksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueQueryAndOwnTasksResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse.Merge(dst, src) +} +func (m *TaskQueueQueryAndOwnTasksResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse.Size(m) +} +func (m *TaskQueueQueryAndOwnTasksResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse proto.InternalMessageInfo + +func (m *TaskQueueQueryAndOwnTasksResponse) GetTask() []*TaskQueueQueryAndOwnTasksResponse_Task { + if m != nil { + return m.Task + } + return nil +} + +type TaskQueueQueryAndOwnTasksResponse_Task struct { + TaskName []byte `protobuf:"bytes,2,req,name=task_name,json=taskName" json:"task_name,omitempty"` + EtaUsec *int64 `protobuf:"varint,3,req,name=eta_usec,json=etaUsec" json:"eta_usec,omitempty"` + RetryCount *int32 `protobuf:"varint,4,opt,name=retry_count,json=retryCount,def=0" json:"retry_count,omitempty"` + Body []byte `protobuf:"bytes,5,opt,name=body" json:"body,omitempty"` + Tag []byte `protobuf:"bytes,6,opt,name=tag" json:"tag,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueQueryAndOwnTasksResponse_Task) Reset() { + *m = TaskQueueQueryAndOwnTasksResponse_Task{} +} +func (m *TaskQueueQueryAndOwnTasksResponse_Task) String() string { return proto.CompactTextString(m) } +func (*TaskQueueQueryAndOwnTasksResponse_Task) ProtoMessage() {} +func (*TaskQueueQueryAndOwnTasksResponse_Task) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{36, 0} +} +func (m *TaskQueueQueryAndOwnTasksResponse_Task) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse_Task.Unmarshal(m, b) +} +func (m *TaskQueueQueryAndOwnTasksResponse_Task) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse_Task.Marshal(b, m, deterministic) +} +func (dst *TaskQueueQueryAndOwnTasksResponse_Task) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse_Task.Merge(dst, src) +} +func (m *TaskQueueQueryAndOwnTasksResponse_Task) XXX_Size() int { + return xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse_Task.Size(m) +} +func (m *TaskQueueQueryAndOwnTasksResponse_Task) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse_Task.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueQueryAndOwnTasksResponse_Task proto.InternalMessageInfo + +const Default_TaskQueueQueryAndOwnTasksResponse_Task_RetryCount int32 = 0 + +func (m *TaskQueueQueryAndOwnTasksResponse_Task) GetTaskName() []byte { + if m != nil { + return m.TaskName + } + return nil +} + +func (m *TaskQueueQueryAndOwnTasksResponse_Task) GetEtaUsec() int64 { + if m != nil && m.EtaUsec != nil { + return *m.EtaUsec + } + return 0 +} + +func (m *TaskQueueQueryAndOwnTasksResponse_Task) GetRetryCount() int32 { + if m != nil && m.RetryCount != nil { + return *m.RetryCount + } + return Default_TaskQueueQueryAndOwnTasksResponse_Task_RetryCount +} + +func (m *TaskQueueQueryAndOwnTasksResponse_Task) GetBody() []byte { + if m != nil { + return m.Body + } + return nil +} + +func (m *TaskQueueQueryAndOwnTasksResponse_Task) GetTag() []byte { + if m != nil { + return m.Tag + } + return nil +} + +type TaskQueueModifyTaskLeaseRequest struct { + QueueName []byte `protobuf:"bytes,1,req,name=queue_name,json=queueName" json:"queue_name,omitempty"` + TaskName []byte `protobuf:"bytes,2,req,name=task_name,json=taskName" json:"task_name,omitempty"` + EtaUsec *int64 `protobuf:"varint,3,req,name=eta_usec,json=etaUsec" json:"eta_usec,omitempty"` + LeaseSeconds *float64 `protobuf:"fixed64,4,req,name=lease_seconds,json=leaseSeconds" json:"lease_seconds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueModifyTaskLeaseRequest) Reset() { *m = TaskQueueModifyTaskLeaseRequest{} } +func (m *TaskQueueModifyTaskLeaseRequest) String() string { return proto.CompactTextString(m) } +func (*TaskQueueModifyTaskLeaseRequest) ProtoMessage() {} +func (*TaskQueueModifyTaskLeaseRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{37} +} +func (m *TaskQueueModifyTaskLeaseRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueModifyTaskLeaseRequest.Unmarshal(m, b) +} +func (m *TaskQueueModifyTaskLeaseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueModifyTaskLeaseRequest.Marshal(b, m, deterministic) +} +func (dst *TaskQueueModifyTaskLeaseRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueModifyTaskLeaseRequest.Merge(dst, src) +} +func (m *TaskQueueModifyTaskLeaseRequest) XXX_Size() int { + return xxx_messageInfo_TaskQueueModifyTaskLeaseRequest.Size(m) +} +func (m *TaskQueueModifyTaskLeaseRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueModifyTaskLeaseRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueModifyTaskLeaseRequest proto.InternalMessageInfo + +func (m *TaskQueueModifyTaskLeaseRequest) GetQueueName() []byte { + if m != nil { + return m.QueueName + } + return nil +} + +func (m *TaskQueueModifyTaskLeaseRequest) GetTaskName() []byte { + if m != nil { + return m.TaskName + } + return nil +} + +func (m *TaskQueueModifyTaskLeaseRequest) GetEtaUsec() int64 { + if m != nil && m.EtaUsec != nil { + return *m.EtaUsec + } + return 0 +} + +func (m *TaskQueueModifyTaskLeaseRequest) GetLeaseSeconds() float64 { + if m != nil && m.LeaseSeconds != nil { + return *m.LeaseSeconds + } + return 0 +} + +type TaskQueueModifyTaskLeaseResponse struct { + UpdatedEtaUsec *int64 `protobuf:"varint,1,req,name=updated_eta_usec,json=updatedEtaUsec" json:"updated_eta_usec,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TaskQueueModifyTaskLeaseResponse) Reset() { *m = TaskQueueModifyTaskLeaseResponse{} } +func (m *TaskQueueModifyTaskLeaseResponse) String() string { return proto.CompactTextString(m) } +func (*TaskQueueModifyTaskLeaseResponse) ProtoMessage() {} +func (*TaskQueueModifyTaskLeaseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_taskqueue_service_05300f6f4e69f490, []int{38} +} +func (m *TaskQueueModifyTaskLeaseResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TaskQueueModifyTaskLeaseResponse.Unmarshal(m, b) +} +func (m *TaskQueueModifyTaskLeaseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TaskQueueModifyTaskLeaseResponse.Marshal(b, m, deterministic) +} +func (dst *TaskQueueModifyTaskLeaseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskQueueModifyTaskLeaseResponse.Merge(dst, src) +} +func (m *TaskQueueModifyTaskLeaseResponse) XXX_Size() int { + return xxx_messageInfo_TaskQueueModifyTaskLeaseResponse.Size(m) +} +func (m *TaskQueueModifyTaskLeaseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TaskQueueModifyTaskLeaseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskQueueModifyTaskLeaseResponse proto.InternalMessageInfo + +func (m *TaskQueueModifyTaskLeaseResponse) GetUpdatedEtaUsec() int64 { + if m != nil && m.UpdatedEtaUsec != nil { + return *m.UpdatedEtaUsec + } + return 0 +} + +func init() { + proto.RegisterType((*TaskQueueServiceError)(nil), "appengine.TaskQueueServiceError") + proto.RegisterType((*TaskPayload)(nil), "appengine.TaskPayload") + proto.RegisterType((*TaskQueueRetryParameters)(nil), "appengine.TaskQueueRetryParameters") + proto.RegisterType((*TaskQueueAcl)(nil), "appengine.TaskQueueAcl") + proto.RegisterType((*TaskQueueHttpHeader)(nil), "appengine.TaskQueueHttpHeader") + proto.RegisterType((*TaskQueueMode)(nil), "appengine.TaskQueueMode") + proto.RegisterType((*TaskQueueAddRequest)(nil), "appengine.TaskQueueAddRequest") + proto.RegisterType((*TaskQueueAddRequest_Header)(nil), "appengine.TaskQueueAddRequest.Header") + proto.RegisterType((*TaskQueueAddRequest_CronTimetable)(nil), "appengine.TaskQueueAddRequest.CronTimetable") + proto.RegisterType((*TaskQueueAddResponse)(nil), "appengine.TaskQueueAddResponse") + proto.RegisterType((*TaskQueueBulkAddRequest)(nil), "appengine.TaskQueueBulkAddRequest") + proto.RegisterType((*TaskQueueBulkAddResponse)(nil), "appengine.TaskQueueBulkAddResponse") + proto.RegisterType((*TaskQueueBulkAddResponse_TaskResult)(nil), "appengine.TaskQueueBulkAddResponse.TaskResult") + proto.RegisterType((*TaskQueueDeleteRequest)(nil), "appengine.TaskQueueDeleteRequest") + proto.RegisterType((*TaskQueueDeleteResponse)(nil), "appengine.TaskQueueDeleteResponse") + proto.RegisterType((*TaskQueueForceRunRequest)(nil), "appengine.TaskQueueForceRunRequest") + proto.RegisterType((*TaskQueueForceRunResponse)(nil), "appengine.TaskQueueForceRunResponse") + proto.RegisterType((*TaskQueueUpdateQueueRequest)(nil), "appengine.TaskQueueUpdateQueueRequest") + proto.RegisterType((*TaskQueueUpdateQueueResponse)(nil), "appengine.TaskQueueUpdateQueueResponse") + proto.RegisterType((*TaskQueueFetchQueuesRequest)(nil), "appengine.TaskQueueFetchQueuesRequest") + proto.RegisterType((*TaskQueueFetchQueuesResponse)(nil), "appengine.TaskQueueFetchQueuesResponse") + proto.RegisterType((*TaskQueueFetchQueuesResponse_Queue)(nil), "appengine.TaskQueueFetchQueuesResponse.Queue") + proto.RegisterType((*TaskQueueFetchQueueStatsRequest)(nil), "appengine.TaskQueueFetchQueueStatsRequest") + proto.RegisterType((*TaskQueueScannerQueueInfo)(nil), "appengine.TaskQueueScannerQueueInfo") + proto.RegisterType((*TaskQueueFetchQueueStatsResponse)(nil), "appengine.TaskQueueFetchQueueStatsResponse") + proto.RegisterType((*TaskQueueFetchQueueStatsResponse_QueueStats)(nil), "appengine.TaskQueueFetchQueueStatsResponse.QueueStats") + proto.RegisterType((*TaskQueuePauseQueueRequest)(nil), "appengine.TaskQueuePauseQueueRequest") + proto.RegisterType((*TaskQueuePauseQueueResponse)(nil), "appengine.TaskQueuePauseQueueResponse") + proto.RegisterType((*TaskQueuePurgeQueueRequest)(nil), "appengine.TaskQueuePurgeQueueRequest") + proto.RegisterType((*TaskQueuePurgeQueueResponse)(nil), "appengine.TaskQueuePurgeQueueResponse") + proto.RegisterType((*TaskQueueDeleteQueueRequest)(nil), "appengine.TaskQueueDeleteQueueRequest") + proto.RegisterType((*TaskQueueDeleteQueueResponse)(nil), "appengine.TaskQueueDeleteQueueResponse") + proto.RegisterType((*TaskQueueDeleteGroupRequest)(nil), "appengine.TaskQueueDeleteGroupRequest") + proto.RegisterType((*TaskQueueDeleteGroupResponse)(nil), "appengine.TaskQueueDeleteGroupResponse") + proto.RegisterType((*TaskQueueQueryTasksRequest)(nil), "appengine.TaskQueueQueryTasksRequest") + proto.RegisterType((*TaskQueueQueryTasksResponse)(nil), "appengine.TaskQueueQueryTasksResponse") + proto.RegisterType((*TaskQueueQueryTasksResponse_Task)(nil), "appengine.TaskQueueQueryTasksResponse.Task") + proto.RegisterType((*TaskQueueQueryTasksResponse_Task_Header)(nil), "appengine.TaskQueueQueryTasksResponse.Task.Header") + proto.RegisterType((*TaskQueueQueryTasksResponse_Task_CronTimetable)(nil), "appengine.TaskQueueQueryTasksResponse.Task.CronTimetable") + proto.RegisterType((*TaskQueueQueryTasksResponse_Task_RunLog)(nil), "appengine.TaskQueueQueryTasksResponse.Task.RunLog") + proto.RegisterType((*TaskQueueFetchTaskRequest)(nil), "appengine.TaskQueueFetchTaskRequest") + proto.RegisterType((*TaskQueueFetchTaskResponse)(nil), "appengine.TaskQueueFetchTaskResponse") + proto.RegisterType((*TaskQueueUpdateStorageLimitRequest)(nil), "appengine.TaskQueueUpdateStorageLimitRequest") + proto.RegisterType((*TaskQueueUpdateStorageLimitResponse)(nil), "appengine.TaskQueueUpdateStorageLimitResponse") + proto.RegisterType((*TaskQueueQueryAndOwnTasksRequest)(nil), "appengine.TaskQueueQueryAndOwnTasksRequest") + proto.RegisterType((*TaskQueueQueryAndOwnTasksResponse)(nil), "appengine.TaskQueueQueryAndOwnTasksResponse") + proto.RegisterType((*TaskQueueQueryAndOwnTasksResponse_Task)(nil), "appengine.TaskQueueQueryAndOwnTasksResponse.Task") + proto.RegisterType((*TaskQueueModifyTaskLeaseRequest)(nil), "appengine.TaskQueueModifyTaskLeaseRequest") + proto.RegisterType((*TaskQueueModifyTaskLeaseResponse)(nil), "appengine.TaskQueueModifyTaskLeaseResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/taskqueue/taskqueue_service.proto", fileDescriptor_taskqueue_service_05300f6f4e69f490) +} + +var fileDescriptor_taskqueue_service_05300f6f4e69f490 = []byte{ + // 2747 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x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0xe8, 0x53, 0xcf, 0xa0, 0x63, 0x62, 0xd9, 0x0d, 0x69, 0x2d, 0xbb, 0x5e, + 0xc1, 0x25, 0x06, 0xd1, 0x18, 0x00, 0xdd, 0x81, 0xca, 0x73, 0xcf, 0x0a, 0x12, 0x82, 0x0c, 0x27, + 0x28, 0x0b, 0x18, 0x27, 0x51, 0xbe, 0x84, 0x9b, 0x09, 0xc7, 0x47, 0x41, 0x30, 0x79, 0x44, 0x89, + 0x49, 0x3d, 0x24, 0x43, 0xf6, 0x84, 0x9e, 0x35, 0xa4, 0xb5, 0xcc, 0x7a, 0x05, 0xb3, 0x47, 0xb4, + 0x08, 0xf9, 0x67, 0xc4, 0x0e, 0x69, 0x23, 0xc3, 0x61, 0xe2, 0x45, 0xf9, 0x14, 0xaa, 0xc9, 0xf1, + 0x7d, 0xd7, 0xa4, 0x4a, 0x13, 0x72, 0xec, 0x3f, 0x2a, 0x42, 0xae, 0x7f, 0x30, 0x78, 0x24, 0xbf, + 0x23, 0x9e, 0x3a, 0x1d, 0x59, 0x52, 0xfe, 0x51, 0x48, 0x09, 0x53, 0x4d, 0x13, 0xd3, 0xef, 0x43, + 0xea, 0x07, 0x4c, 0x0b, 0x51, 0xd5, 0x1c, 0x32, 0xa6, 0x91, 0xcc, 0x12, 0x87, 0x74, 0xc9, 0x98, + 0xa2, 0x55, 0x28, 0xb1, 0xc2, 0x27, 0xb0, 0x42, 0x7a, 0x91, 0x01, 0x38, 0x72, 0x05, 0x8a, 0x34, + 0x20, 0x46, 0x28, 0xdc, 0x91, 0x59, 0xcf, 0xe2, 0x05, 0x1a, 0x90, 0x03, 0x9f, 0x0e, 0xd1, 0xd7, + 0x50, 0x18, 0xd3, 0xe0, 0xd8, 0x35, 0xb9, 0x39, 0x6b, 0x5b, 0xf7, 0x36, 0x92, 0x4a, 0xb8, 0x31, + 0xe7, 0x1a, 0x1b, 0xd1, 0xff, 0x7d, 0x7e, 0x66, 0x3b, 0xd7, 0xef, 0x0d, 0x74,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 0xac, 0x35, 0x53, 0x2a, 0x1f, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/taskqueue/taskqueue_service.proto b/vendor/google.golang.org/appengine/internal/taskqueue/taskqueue_service.proto new file mode 100644 index 000000000..419aaf570 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/taskqueue/taskqueue_service.proto @@ -0,0 +1,342 @@ +syntax = "proto2"; +option go_package = "taskqueue"; + +import "google.golang.org/appengine/internal/datastore/datastore_v3.proto"; + +package appengine; + +message TaskQueueServiceError { + enum ErrorCode { + OK = 0; + UNKNOWN_QUEUE = 1; + TRANSIENT_ERROR = 2; + INTERNAL_ERROR = 3; + TASK_TOO_LARGE = 4; + INVALID_TASK_NAME = 5; + INVALID_QUEUE_NAME = 6; + INVALID_URL = 7; + INVALID_QUEUE_RATE = 8; + PERMISSION_DENIED = 9; + TASK_ALREADY_EXISTS = 10; + TOMBSTONED_TASK = 11; + INVALID_ETA = 12; + INVALID_REQUEST = 13; + UNKNOWN_TASK = 14; + TOMBSTONED_QUEUE = 15; + DUPLICATE_TASK_NAME = 16; + SKIPPED = 17; + TOO_MANY_TASKS = 18; + INVALID_PAYLOAD = 19; + INVALID_RETRY_PARAMETERS = 20; + INVALID_QUEUE_MODE = 21; + ACL_LOOKUP_ERROR = 22; + TRANSACTIONAL_REQUEST_TOO_LARGE = 23; + INCORRECT_CREATOR_NAME = 24; + TASK_LEASE_EXPIRED = 25; + QUEUE_PAUSED = 26; + INVALID_TAG = 27; + + // Reserved range for the Datastore error codes. + // Original Datastore error code is shifted by DATASTORE_ERROR offset. + DATASTORE_ERROR = 10000; + } +} + +message TaskPayload { + extensions 10 to max; + option message_set_wire_format = true; +} + +message TaskQueueRetryParameters { + optional int32 retry_limit = 1; + optional int64 age_limit_sec = 2; + + optional double min_backoff_sec = 3 [default = 0.1]; + optional double max_backoff_sec = 4 [default = 3600]; + optional int32 max_doublings = 5 [default = 16]; +} + +message TaskQueueAcl { + repeated bytes user_email = 1; + repeated bytes writer_email = 2; +} + +message TaskQueueHttpHeader { + required bytes key = 1; + required bytes value = 2; +} + +message TaskQueueMode { + enum Mode { + PUSH = 0; + PULL = 1; + } +} + +message TaskQueueAddRequest { + required bytes queue_name = 1; + required bytes task_name = 2; + required int64 eta_usec = 3; + + enum RequestMethod { + GET = 1; + POST = 2; + HEAD = 3; + PUT = 4; + DELETE = 5; + } + optional RequestMethod method = 5 [default=POST]; + + optional bytes url = 4; + + repeated group Header = 6 { + required bytes key = 7; + required bytes value = 8; + } + + optional bytes body = 9 [ctype=CORD]; + optional Transaction transaction = 10; + optional bytes app_id = 11; + + optional group CronTimetable = 12 { + required bytes schedule = 13; + required bytes timezone = 14; + } + + optional bytes description = 15; + optional TaskPayload payload = 16; + optional TaskQueueRetryParameters retry_parameters = 17; + optional TaskQueueMode.Mode mode = 18 [default=PUSH]; + optional bytes tag = 19; +} + +message TaskQueueAddResponse { + optional bytes chosen_task_name = 1; +} + +message TaskQueueBulkAddRequest { + repeated TaskQueueAddRequest add_request = 1; +} + +message TaskQueueBulkAddResponse { + repeated group TaskResult = 1 { + required TaskQueueServiceError.ErrorCode result = 2; + optional bytes chosen_task_name = 3; + } +} + +message TaskQueueDeleteRequest { + required bytes queue_name = 1; + repeated bytes task_name = 2; + optional bytes app_id = 3; +} + +message TaskQueueDeleteResponse { + repeated TaskQueueServiceError.ErrorCode result = 3; +} + +message TaskQueueForceRunRequest { + optional bytes app_id = 1; + required bytes queue_name = 2; + required bytes task_name = 3; +} + +message TaskQueueForceRunResponse { + required TaskQueueServiceError.ErrorCode result = 3; +} + +message TaskQueueUpdateQueueRequest { + optional bytes app_id = 1; + required bytes queue_name = 2; + required double bucket_refill_per_second = 3; + required int32 bucket_capacity = 4; + optional string user_specified_rate = 5; + optional TaskQueueRetryParameters retry_parameters = 6; + optional int32 max_concurrent_requests = 7; + optional TaskQueueMode.Mode mode = 8 [default = PUSH]; + optional TaskQueueAcl acl = 9; + repeated TaskQueueHttpHeader header_override = 10; +} + +message TaskQueueUpdateQueueResponse { +} + +message TaskQueueFetchQueuesRequest { + optional bytes app_id = 1; + required int32 max_rows = 2; +} + +message TaskQueueFetchQueuesResponse { + repeated group Queue = 1 { + required bytes queue_name = 2; + required double bucket_refill_per_second = 3; + required double bucket_capacity = 4; + optional string user_specified_rate = 5; + required bool paused = 6 [default=false]; + optional TaskQueueRetryParameters retry_parameters = 7; + optional int32 max_concurrent_requests = 8; + optional TaskQueueMode.Mode mode = 9 [default = PUSH]; + optional TaskQueueAcl acl = 10; + repeated TaskQueueHttpHeader header_override = 11; + optional string creator_name = 12 [ctype=CORD, default="apphosting"]; + } +} + +message TaskQueueFetchQueueStatsRequest { + optional bytes app_id = 1; + repeated bytes queue_name = 2; + optional int32 max_num_tasks = 3 [default = 0]; +} + +message TaskQueueScannerQueueInfo { + required int64 executed_last_minute = 1; + required int64 executed_last_hour = 2; + required double sampling_duration_seconds = 3; + optional int32 requests_in_flight = 4; + optional double enforced_rate = 5; +} + +message TaskQueueFetchQueueStatsResponse { + repeated group QueueStats = 1 { + required int32 num_tasks = 2; + required int64 oldest_eta_usec = 3; + optional TaskQueueScannerQueueInfo scanner_info = 4; + } +} +message TaskQueuePauseQueueRequest { + required bytes app_id = 1; + required bytes queue_name = 2; + required bool pause = 3; +} + +message TaskQueuePauseQueueResponse { +} + +message TaskQueuePurgeQueueRequest { + optional bytes app_id = 1; + required bytes queue_name = 2; +} + +message TaskQueuePurgeQueueResponse { +} + +message TaskQueueDeleteQueueRequest { + required bytes app_id = 1; + required bytes queue_name = 2; +} + +message TaskQueueDeleteQueueResponse { +} + +message TaskQueueDeleteGroupRequest { + required bytes app_id = 1; +} + +message TaskQueueDeleteGroupResponse { +} + +message TaskQueueQueryTasksRequest { + optional bytes app_id = 1; + required bytes queue_name = 2; + + optional bytes start_task_name = 3; + optional int64 start_eta_usec = 4; + optional bytes start_tag = 6; + optional int32 max_rows = 5 [default = 1]; +} + +message TaskQueueQueryTasksResponse { + repeated group Task = 1 { + required bytes task_name = 2; + required int64 eta_usec = 3; + optional bytes url = 4; + + enum RequestMethod { + GET = 1; + POST = 2; + HEAD = 3; + PUT = 4; + DELETE = 5; + } + optional RequestMethod method = 5; + + optional int32 retry_count = 6 [default=0]; + + repeated group Header = 7 { + required bytes key = 8; + required bytes value = 9; + } + + optional int32 body_size = 10; + optional bytes body = 11 [ctype=CORD]; + required int64 creation_time_usec = 12; + + optional group CronTimetable = 13 { + required bytes schedule = 14; + required bytes timezone = 15; + } + + optional group RunLog = 16 { + required int64 dispatched_usec = 17; + required int64 lag_usec = 18; + required int64 elapsed_usec = 19; + optional int64 response_code = 20; + optional string retry_reason = 27; + } + + optional bytes description = 21; + optional TaskPayload payload = 22; + optional TaskQueueRetryParameters retry_parameters = 23; + optional int64 first_try_usec = 24; + optional bytes tag = 25; + optional int32 execution_count = 26 [default=0]; + } +} + +message TaskQueueFetchTaskRequest { + optional bytes app_id = 1; + required bytes queue_name = 2; + required bytes task_name = 3; +} + +message TaskQueueFetchTaskResponse { + required TaskQueueQueryTasksResponse task = 1; +} + +message TaskQueueUpdateStorageLimitRequest { + required bytes app_id = 1; + required int64 limit = 2; +} + +message TaskQueueUpdateStorageLimitResponse { + required int64 new_limit = 1; +} + +message TaskQueueQueryAndOwnTasksRequest { + required bytes queue_name = 1; + required double lease_seconds = 2; + required int64 max_tasks = 3; + optional bool group_by_tag = 4 [default=false]; + optional bytes tag = 5; +} + +message TaskQueueQueryAndOwnTasksResponse { + repeated group Task = 1 { + required bytes task_name = 2; + required int64 eta_usec = 3; + optional int32 retry_count = 4 [default=0]; + optional bytes body = 5 [ctype=CORD]; + optional bytes tag = 6; + } +} + +message TaskQueueModifyTaskLeaseRequest { + required bytes queue_name = 1; + required bytes task_name = 2; + required int64 eta_usec = 3; + required double lease_seconds = 4; +} + +message TaskQueueModifyTaskLeaseResponse { + required int64 updated_eta_usec = 1; +} diff --git a/vendor/google.golang.org/appengine/internal/transaction.go b/vendor/google.golang.org/appengine/internal/transaction.go new file mode 100644 index 000000000..9006ae653 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/transaction.go @@ -0,0 +1,115 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package internal + +// This file implements hooks for applying datastore transactions. + +import ( + "errors" + "reflect" + + "github.com/golang/protobuf/proto" + netcontext "golang.org/x/net/context" + + basepb "google.golang.org/appengine/internal/base" + pb "google.golang.org/appengine/internal/datastore" +) + +var transactionSetters = make(map[reflect.Type]reflect.Value) + +// RegisterTransactionSetter registers a function that sets transaction information +// in a protocol buffer message. f should be a function with two arguments, +// the first being a protocol buffer type, and the second being *datastore.Transaction. +func RegisterTransactionSetter(f interface{}) { + v := reflect.ValueOf(f) + transactionSetters[v.Type().In(0)] = v +} + +// applyTransaction applies the transaction t to message pb +// by using the relevant setter passed to RegisterTransactionSetter. +func applyTransaction(pb proto.Message, t *pb.Transaction) { + v := reflect.ValueOf(pb) + if f, ok := transactionSetters[v.Type()]; ok { + f.Call([]reflect.Value{v, reflect.ValueOf(t)}) + } +} + +var transactionKey = "used for *Transaction" + +func transactionFromContext(ctx netcontext.Context) *transaction { + t, _ := ctx.Value(&transactionKey).(*transaction) + return t +} + +func withTransaction(ctx netcontext.Context, t *transaction) netcontext.Context { + return netcontext.WithValue(ctx, &transactionKey, t) +} + +type transaction struct { + transaction pb.Transaction + finished bool +} + +var ErrConcurrentTransaction = errors.New("internal: concurrent transaction") + +func RunTransactionOnce(c netcontext.Context, f func(netcontext.Context) error, xg bool, readOnly bool, previousTransaction *pb.Transaction) (*pb.Transaction, error) { + if transactionFromContext(c) != nil { + return nil, errors.New("nested transactions are not supported") + } + + // Begin the transaction. + t := &transaction{} + req := &pb.BeginTransactionRequest{ + App: proto.String(FullyQualifiedAppID(c)), + } + if xg { + req.AllowMultipleEg = proto.Bool(true) + } + if previousTransaction != nil { + req.PreviousTransaction = previousTransaction + } + if readOnly { + req.Mode = pb.BeginTransactionRequest_READ_ONLY.Enum() + } else { + req.Mode = pb.BeginTransactionRequest_READ_WRITE.Enum() + } + if err := Call(c, "datastore_v3", "BeginTransaction", req, &t.transaction); err != nil { + return nil, err + } + + // Call f, rolling back the transaction if f returns a non-nil error, or panics. + // The panic is not recovered. + defer func() { + if t.finished { + return + } + t.finished = true + // Ignore the error return value, since we are already returning a non-nil + // error (or we're panicking). + Call(c, "datastore_v3", "Rollback", &t.transaction, &basepb.VoidProto{}) + }() + if err := f(withTransaction(c, t)); err != nil { + return &t.transaction, err + } + t.finished = true + + // Commit the transaction. + res := &pb.CommitResponse{} + err := Call(c, "datastore_v3", "Commit", &t.transaction, res) + if ae, ok := err.(*APIError); ok { + /* TODO: restore this conditional + if appengine.IsDevAppServer() { + */ + // The Python Dev AppServer raises an ApplicationError with error code 2 (which is + // Error.CONCURRENT_TRANSACTION) and message "Concurrency exception.". + if ae.Code == int32(pb.Error_BAD_REQUEST) && ae.Detail == "ApplicationError: 2 Concurrency exception." { + return &t.transaction, ErrConcurrentTransaction + } + if ae.Code == int32(pb.Error_CONCURRENT_TRANSACTION) { + return &t.transaction, ErrConcurrentTransaction + } + } + return &t.transaction, err +} diff --git a/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go b/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go new file mode 100644 index 000000000..5f727750a --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go @@ -0,0 +1,527 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto + +package urlfetch + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type URLFetchServiceError_ErrorCode int32 + +const ( + URLFetchServiceError_OK URLFetchServiceError_ErrorCode = 0 + URLFetchServiceError_INVALID_URL URLFetchServiceError_ErrorCode = 1 + URLFetchServiceError_FETCH_ERROR URLFetchServiceError_ErrorCode = 2 + URLFetchServiceError_UNSPECIFIED_ERROR URLFetchServiceError_ErrorCode = 3 + URLFetchServiceError_RESPONSE_TOO_LARGE URLFetchServiceError_ErrorCode = 4 + URLFetchServiceError_DEADLINE_EXCEEDED URLFetchServiceError_ErrorCode = 5 + URLFetchServiceError_SSL_CERTIFICATE_ERROR URLFetchServiceError_ErrorCode = 6 + URLFetchServiceError_DNS_ERROR URLFetchServiceError_ErrorCode = 7 + URLFetchServiceError_CLOSED URLFetchServiceError_ErrorCode = 8 + URLFetchServiceError_INTERNAL_TRANSIENT_ERROR URLFetchServiceError_ErrorCode = 9 + URLFetchServiceError_TOO_MANY_REDIRECTS URLFetchServiceError_ErrorCode = 10 + URLFetchServiceError_MALFORMED_REPLY URLFetchServiceError_ErrorCode = 11 + URLFetchServiceError_CONNECTION_ERROR URLFetchServiceError_ErrorCode = 12 +) + +var URLFetchServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "INVALID_URL", + 2: "FETCH_ERROR", + 3: "UNSPECIFIED_ERROR", + 4: "RESPONSE_TOO_LARGE", + 5: "DEADLINE_EXCEEDED", + 6: "SSL_CERTIFICATE_ERROR", + 7: "DNS_ERROR", + 8: "CLOSED", + 9: "INTERNAL_TRANSIENT_ERROR", + 10: "TOO_MANY_REDIRECTS", + 11: "MALFORMED_REPLY", + 12: "CONNECTION_ERROR", +} +var URLFetchServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "INVALID_URL": 1, + "FETCH_ERROR": 2, + "UNSPECIFIED_ERROR": 3, + "RESPONSE_TOO_LARGE": 4, + "DEADLINE_EXCEEDED": 5, + "SSL_CERTIFICATE_ERROR": 6, + "DNS_ERROR": 7, + "CLOSED": 8, + "INTERNAL_TRANSIENT_ERROR": 9, + "TOO_MANY_REDIRECTS": 10, + "MALFORMED_REPLY": 11, + "CONNECTION_ERROR": 12, +} + +func (x URLFetchServiceError_ErrorCode) Enum() *URLFetchServiceError_ErrorCode { + p := new(URLFetchServiceError_ErrorCode) + *p = x + return p +} +func (x URLFetchServiceError_ErrorCode) String() string { + return proto.EnumName(URLFetchServiceError_ErrorCode_name, int32(x)) +} +func (x *URLFetchServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(URLFetchServiceError_ErrorCode_value, data, "URLFetchServiceError_ErrorCode") + if err != nil { + return err + } + *x = URLFetchServiceError_ErrorCode(value) + return nil +} +func (URLFetchServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{0, 0} +} + +type URLFetchRequest_RequestMethod int32 + +const ( + URLFetchRequest_GET URLFetchRequest_RequestMethod = 1 + URLFetchRequest_POST URLFetchRequest_RequestMethod = 2 + URLFetchRequest_HEAD URLFetchRequest_RequestMethod = 3 + URLFetchRequest_PUT URLFetchRequest_RequestMethod = 4 + URLFetchRequest_DELETE URLFetchRequest_RequestMethod = 5 + URLFetchRequest_PATCH URLFetchRequest_RequestMethod = 6 +) + +var URLFetchRequest_RequestMethod_name = map[int32]string{ + 1: "GET", + 2: "POST", + 3: "HEAD", + 4: "PUT", + 5: "DELETE", + 6: "PATCH", +} +var URLFetchRequest_RequestMethod_value = map[string]int32{ + "GET": 1, + "POST": 2, + "HEAD": 3, + "PUT": 4, + "DELETE": 5, + "PATCH": 6, +} + +func (x URLFetchRequest_RequestMethod) Enum() *URLFetchRequest_RequestMethod { + p := new(URLFetchRequest_RequestMethod) + *p = x + return p +} +func (x URLFetchRequest_RequestMethod) String() string { + return proto.EnumName(URLFetchRequest_RequestMethod_name, int32(x)) +} +func (x *URLFetchRequest_RequestMethod) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(URLFetchRequest_RequestMethod_value, data, "URLFetchRequest_RequestMethod") + if err != nil { + return err + } + *x = URLFetchRequest_RequestMethod(value) + return nil +} +func (URLFetchRequest_RequestMethod) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{1, 0} +} + +type URLFetchServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *URLFetchServiceError) Reset() { *m = URLFetchServiceError{} } +func (m *URLFetchServiceError) String() string { return proto.CompactTextString(m) } +func (*URLFetchServiceError) ProtoMessage() {} +func (*URLFetchServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{0} +} +func (m *URLFetchServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_URLFetchServiceError.Unmarshal(m, b) +} +func (m *URLFetchServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_URLFetchServiceError.Marshal(b, m, deterministic) +} +func (dst *URLFetchServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_URLFetchServiceError.Merge(dst, src) +} +func (m *URLFetchServiceError) XXX_Size() int { + return xxx_messageInfo_URLFetchServiceError.Size(m) +} +func (m *URLFetchServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_URLFetchServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_URLFetchServiceError proto.InternalMessageInfo + +type URLFetchRequest struct { + Method *URLFetchRequest_RequestMethod `protobuf:"varint,1,req,name=Method,enum=appengine.URLFetchRequest_RequestMethod" json:"Method,omitempty"` + Url *string `protobuf:"bytes,2,req,name=Url" json:"Url,omitempty"` + Header []*URLFetchRequest_Header `protobuf:"group,3,rep,name=Header,json=header" json:"header,omitempty"` + Payload []byte `protobuf:"bytes,6,opt,name=Payload" json:"Payload,omitempty"` + FollowRedirects *bool `protobuf:"varint,7,opt,name=FollowRedirects,def=1" json:"FollowRedirects,omitempty"` + Deadline *float64 `protobuf:"fixed64,8,opt,name=Deadline" json:"Deadline,omitempty"` + MustValidateServerCertificate *bool `protobuf:"varint,9,opt,name=MustValidateServerCertificate,def=1" json:"MustValidateServerCertificate,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *URLFetchRequest) Reset() { *m = URLFetchRequest{} } +func (m *URLFetchRequest) String() string { return proto.CompactTextString(m) } +func (*URLFetchRequest) ProtoMessage() {} +func (*URLFetchRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{1} +} +func (m *URLFetchRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_URLFetchRequest.Unmarshal(m, b) +} +func (m *URLFetchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_URLFetchRequest.Marshal(b, m, deterministic) +} +func (dst *URLFetchRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_URLFetchRequest.Merge(dst, src) +} +func (m *URLFetchRequest) XXX_Size() int { + return xxx_messageInfo_URLFetchRequest.Size(m) +} +func (m *URLFetchRequest) XXX_DiscardUnknown() { + xxx_messageInfo_URLFetchRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_URLFetchRequest proto.InternalMessageInfo + +const Default_URLFetchRequest_FollowRedirects bool = true +const Default_URLFetchRequest_MustValidateServerCertificate bool = true + +func (m *URLFetchRequest) GetMethod() URLFetchRequest_RequestMethod { + if m != nil && m.Method != nil { + return *m.Method + } + return URLFetchRequest_GET +} + +func (m *URLFetchRequest) GetUrl() string { + if m != nil && m.Url != nil { + return *m.Url + } + return "" +} + +func (m *URLFetchRequest) GetHeader() []*URLFetchRequest_Header { + if m != nil { + return m.Header + } + return nil +} + +func (m *URLFetchRequest) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *URLFetchRequest) GetFollowRedirects() bool { + if m != nil && m.FollowRedirects != nil { + return *m.FollowRedirects + } + return Default_URLFetchRequest_FollowRedirects +} + +func (m *URLFetchRequest) GetDeadline() float64 { + if m != nil && m.Deadline != nil { + return *m.Deadline + } + return 0 +} + +func (m *URLFetchRequest) GetMustValidateServerCertificate() bool { + if m != nil && m.MustValidateServerCertificate != nil { + return *m.MustValidateServerCertificate + } + return Default_URLFetchRequest_MustValidateServerCertificate +} + +type URLFetchRequest_Header struct { + Key *string `protobuf:"bytes,4,req,name=Key" json:"Key,omitempty"` + Value *string `protobuf:"bytes,5,req,name=Value" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *URLFetchRequest_Header) Reset() { *m = URLFetchRequest_Header{} } +func (m *URLFetchRequest_Header) String() string { return proto.CompactTextString(m) } +func (*URLFetchRequest_Header) ProtoMessage() {} +func (*URLFetchRequest_Header) Descriptor() ([]byte, []int) { + return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{1, 0} +} +func (m *URLFetchRequest_Header) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_URLFetchRequest_Header.Unmarshal(m, b) +} +func (m *URLFetchRequest_Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_URLFetchRequest_Header.Marshal(b, m, deterministic) +} +func (dst *URLFetchRequest_Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_URLFetchRequest_Header.Merge(dst, src) +} +func (m *URLFetchRequest_Header) XXX_Size() int { + return xxx_messageInfo_URLFetchRequest_Header.Size(m) +} +func (m *URLFetchRequest_Header) XXX_DiscardUnknown() { + xxx_messageInfo_URLFetchRequest_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_URLFetchRequest_Header proto.InternalMessageInfo + +func (m *URLFetchRequest_Header) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *URLFetchRequest_Header) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +type URLFetchResponse struct { + Content []byte `protobuf:"bytes,1,opt,name=Content" json:"Content,omitempty"` + StatusCode *int32 `protobuf:"varint,2,req,name=StatusCode" json:"StatusCode,omitempty"` + Header []*URLFetchResponse_Header `protobuf:"group,3,rep,name=Header,json=header" json:"header,omitempty"` + ContentWasTruncated *bool `protobuf:"varint,6,opt,name=ContentWasTruncated,def=0" json:"ContentWasTruncated,omitempty"` + ExternalBytesSent *int64 `protobuf:"varint,7,opt,name=ExternalBytesSent" json:"ExternalBytesSent,omitempty"` + ExternalBytesReceived *int64 `protobuf:"varint,8,opt,name=ExternalBytesReceived" json:"ExternalBytesReceived,omitempty"` + FinalUrl *string `protobuf:"bytes,9,opt,name=FinalUrl" json:"FinalUrl,omitempty"` + ApiCpuMilliseconds *int64 `protobuf:"varint,10,opt,name=ApiCpuMilliseconds,def=0" json:"ApiCpuMilliseconds,omitempty"` + ApiBytesSent *int64 `protobuf:"varint,11,opt,name=ApiBytesSent,def=0" json:"ApiBytesSent,omitempty"` + ApiBytesReceived *int64 `protobuf:"varint,12,opt,name=ApiBytesReceived,def=0" json:"ApiBytesReceived,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *URLFetchResponse) Reset() { *m = URLFetchResponse{} } +func (m *URLFetchResponse) String() string { return proto.CompactTextString(m) } +func (*URLFetchResponse) ProtoMessage() {} +func (*URLFetchResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{2} +} +func (m *URLFetchResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_URLFetchResponse.Unmarshal(m, b) +} +func (m *URLFetchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_URLFetchResponse.Marshal(b, m, deterministic) +} +func (dst *URLFetchResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_URLFetchResponse.Merge(dst, src) +} +func (m *URLFetchResponse) XXX_Size() int { + return xxx_messageInfo_URLFetchResponse.Size(m) +} +func (m *URLFetchResponse) XXX_DiscardUnknown() { + xxx_messageInfo_URLFetchResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_URLFetchResponse proto.InternalMessageInfo + +const Default_URLFetchResponse_ContentWasTruncated bool = false +const Default_URLFetchResponse_ApiCpuMilliseconds int64 = 0 +const Default_URLFetchResponse_ApiBytesSent int64 = 0 +const Default_URLFetchResponse_ApiBytesReceived int64 = 0 + +func (m *URLFetchResponse) GetContent() []byte { + if m != nil { + return m.Content + } + return nil +} + +func (m *URLFetchResponse) GetStatusCode() int32 { + if m != nil && m.StatusCode != nil { + return *m.StatusCode + } + return 0 +} + +func (m *URLFetchResponse) GetHeader() []*URLFetchResponse_Header { + if m != nil { + return m.Header + } + return nil +} + +func (m *URLFetchResponse) GetContentWasTruncated() bool { + if m != nil && m.ContentWasTruncated != nil { + return *m.ContentWasTruncated + } + return Default_URLFetchResponse_ContentWasTruncated +} + +func (m *URLFetchResponse) GetExternalBytesSent() int64 { + if m != nil && m.ExternalBytesSent != nil { + return *m.ExternalBytesSent + } + return 0 +} + +func (m *URLFetchResponse) GetExternalBytesReceived() int64 { + if m != nil && m.ExternalBytesReceived != nil { + return *m.ExternalBytesReceived + } + return 0 +} + +func (m *URLFetchResponse) GetFinalUrl() string { + if m != nil && m.FinalUrl != nil { + return *m.FinalUrl + } + return "" +} + +func (m *URLFetchResponse) GetApiCpuMilliseconds() int64 { + if m != nil && m.ApiCpuMilliseconds != nil { + return *m.ApiCpuMilliseconds + } + return Default_URLFetchResponse_ApiCpuMilliseconds +} + +func (m *URLFetchResponse) GetApiBytesSent() int64 { + if m != nil && m.ApiBytesSent != nil { + return *m.ApiBytesSent + } + return Default_URLFetchResponse_ApiBytesSent +} + +func (m *URLFetchResponse) GetApiBytesReceived() int64 { + if m != nil && m.ApiBytesReceived != nil { + return *m.ApiBytesReceived + } + return Default_URLFetchResponse_ApiBytesReceived +} + +type URLFetchResponse_Header struct { + Key *string `protobuf:"bytes,4,req,name=Key" json:"Key,omitempty"` + Value *string `protobuf:"bytes,5,req,name=Value" json:"Value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *URLFetchResponse_Header) Reset() { *m = URLFetchResponse_Header{} } +func (m *URLFetchResponse_Header) String() string { return proto.CompactTextString(m) } +func (*URLFetchResponse_Header) ProtoMessage() {} +func (*URLFetchResponse_Header) Descriptor() ([]byte, []int) { + return fileDescriptor_urlfetch_service_b245a7065f33bced, []int{2, 0} +} +func (m *URLFetchResponse_Header) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_URLFetchResponse_Header.Unmarshal(m, b) +} +func (m *URLFetchResponse_Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_URLFetchResponse_Header.Marshal(b, m, deterministic) +} +func (dst *URLFetchResponse_Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_URLFetchResponse_Header.Merge(dst, src) +} +func (m *URLFetchResponse_Header) XXX_Size() int { + return xxx_messageInfo_URLFetchResponse_Header.Size(m) +} +func (m *URLFetchResponse_Header) XXX_DiscardUnknown() { + xxx_messageInfo_URLFetchResponse_Header.DiscardUnknown(m) +} + +var xxx_messageInfo_URLFetchResponse_Header proto.InternalMessageInfo + +func (m *URLFetchResponse_Header) GetKey() string { + if m != nil && m.Key != nil { + return *m.Key + } + return "" +} + +func (m *URLFetchResponse_Header) GetValue() string { + if m != nil && m.Value != nil { + return *m.Value + } + return "" +} + +func init() { + proto.RegisterType((*URLFetchServiceError)(nil), "appengine.URLFetchServiceError") + proto.RegisterType((*URLFetchRequest)(nil), "appengine.URLFetchRequest") + proto.RegisterType((*URLFetchRequest_Header)(nil), "appengine.URLFetchRequest.Header") + proto.RegisterType((*URLFetchResponse)(nil), "appengine.URLFetchResponse") + proto.RegisterType((*URLFetchResponse_Header)(nil), "appengine.URLFetchResponse.Header") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto", fileDescriptor_urlfetch_service_b245a7065f33bced) +} + +var fileDescriptor_urlfetch_service_b245a7065f33bced = []byte{ + // 770 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x6e, 0xe3, 0x54, + 0x10, 0xc6, 0x76, 0x7e, 0xa7, 0x5d, 0x7a, 0x76, 0xb6, 0x45, 0x66, 0xb5, 0xa0, 0x10, 0x09, 0x29, + 0x17, 0x90, 0x2e, 0x2b, 0x24, 0x44, 0xaf, 0x70, 0xed, 0x93, 0xad, 0xa9, 0x63, 0x47, 0xc7, 0x4e, + 0x61, 0xb9, 0xb1, 0xac, 0x78, 0x9a, 0x5a, 0xb2, 0xec, 0x60, 0x9f, 0x2c, 0xf4, 0x35, 0x78, 0x0d, + 0xde, 0x87, 0xa7, 0xe1, 0x02, 0x9d, 0xc4, 0xc9, 0x6e, 0xbb, 0xd1, 0x4a, 0x5c, 0x65, 0xe6, 0x9b, + 0xef, 0xcc, 0x99, 0x7c, 0xdf, 0xf8, 0x80, 0xb3, 0x2c, 0xcb, 0x65, 0x4e, 0xe3, 0x65, 0x99, 0x27, + 0xc5, 0x72, 0x5c, 0x56, 0xcb, 0xf3, 0x64, 0xb5, 0xa2, 0x62, 0x99, 0x15, 0x74, 0x9e, 0x15, 0x92, + 0xaa, 0x22, 0xc9, 0xcf, 0xd7, 0x55, 0x7e, 0x4b, 0x72, 0x71, 0xb7, 0x0f, 0xe2, 0x9a, 0xaa, 0xb7, + 0xd9, 0x82, 0xc6, 0xab, 0xaa, 0x94, 0x25, 0xf6, 0xf7, 0x67, 0x86, 0x7f, 0xeb, 0x70, 0x3a, 0x17, + 0xde, 0x44, 0xb1, 0xc2, 0x2d, 0x89, 0x57, 0x55, 0x59, 0x0d, 0xff, 0xd2, 0xa1, 0xb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cc, 0x5e, + 0xad, 0xa7, 0x59, 0x9e, 0x67, 0x35, 0x2d, 0xca, 0x22, 0xad, 0x4d, 0x50, 0xed, 0x2e, 0xb4, 0x97, + 0xe2, 0x40, 0x11, 0xbf, 0x86, 0x63, 0x6b, 0x95, 0xbd, 0x9b, 0xf6, 0x68, 0x47, 0x7e, 0x00, 0xe3, + 0xb7, 0xc0, 0x76, 0xf9, 0x7e, 0xcc, 0xe3, 0x1d, 0xf5, 0x83, 0xd2, 0xff, 0x5f, 0xa6, 0x4b, 0xf8, + 0xad, 0xb7, 0x7b, 0x2a, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x9f, 0x6d, 0x24, 0x63, 0x05, + 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto b/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto new file mode 100644 index 000000000..f695edf6a --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto @@ -0,0 +1,64 @@ +syntax = "proto2"; +option go_package = "urlfetch"; + +package appengine; + +message URLFetchServiceError { + enum ErrorCode { + OK = 0; + INVALID_URL = 1; + FETCH_ERROR = 2; + UNSPECIFIED_ERROR = 3; + RESPONSE_TOO_LARGE = 4; + DEADLINE_EXCEEDED = 5; + SSL_CERTIFICATE_ERROR = 6; + DNS_ERROR = 7; + CLOSED = 8; + INTERNAL_TRANSIENT_ERROR = 9; + TOO_MANY_REDIRECTS = 10; + MALFORMED_REPLY = 11; + CONNECTION_ERROR = 12; + } +} + +message URLFetchRequest { + enum RequestMethod { + GET = 1; + POST = 2; + HEAD = 3; + PUT = 4; + DELETE = 5; + PATCH = 6; + } + required RequestMethod Method = 1; + required string Url = 2; + repeated group Header = 3 { + required string Key = 4; + required string Value = 5; + } + optional bytes Payload = 6 [ctype=CORD]; + + optional bool FollowRedirects = 7 [default=true]; + + optional double Deadline = 8; + + optional bool MustValidateServerCertificate = 9 [default=true]; +} + +message URLFetchResponse { + optional bytes Content = 1; + required int32 StatusCode = 2; + repeated group Header = 3 { + required string Key = 4; + required string Value = 5; + } + optional bool ContentWasTruncated = 6 [default=false]; + optional int64 ExternalBytesSent = 7; + optional int64 ExternalBytesReceived = 8; + + optional string FinalUrl = 9; + + optional int64 ApiCpuMilliseconds = 10 [default=0]; + optional int64 ApiBytesSent = 11 [default=0]; + optional int64 ApiBytesReceived = 12 [default=0]; +} diff --git a/vendor/google.golang.org/appengine/internal/user/user_service.pb.go b/vendor/google.golang.org/appengine/internal/user/user_service.pb.go new file mode 100644 index 000000000..8090a4e0a --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/user/user_service.pb.go @@ -0,0 +1,531 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/user/user_service.proto + +package user + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type UserServiceError_ErrorCode int32 + +const ( + UserServiceError_OK UserServiceError_ErrorCode = 0 + UserServiceError_REDIRECT_URL_TOO_LONG UserServiceError_ErrorCode = 1 + UserServiceError_NOT_ALLOWED UserServiceError_ErrorCode = 2 + UserServiceError_OAUTH_INVALID_TOKEN UserServiceError_ErrorCode = 3 + UserServiceError_OAUTH_INVALID_REQUEST UserServiceError_ErrorCode = 4 + UserServiceError_OAUTH_ERROR UserServiceError_ErrorCode = 5 +) + +var UserServiceError_ErrorCode_name = map[int32]string{ + 0: "OK", + 1: "REDIRECT_URL_TOO_LONG", + 2: "NOT_ALLOWED", + 3: "OAUTH_INVALID_TOKEN", + 4: "OAUTH_INVALID_REQUEST", + 5: "OAUTH_ERROR", +} +var UserServiceError_ErrorCode_value = map[string]int32{ + "OK": 0, + "REDIRECT_URL_TOO_LONG": 1, + "NOT_ALLOWED": 2, + "OAUTH_INVALID_TOKEN": 3, + "OAUTH_INVALID_REQUEST": 4, + "OAUTH_ERROR": 5, +} + +func (x UserServiceError_ErrorCode) Enum() *UserServiceError_ErrorCode { + p := new(UserServiceError_ErrorCode) + *p = x + return p +} +func (x UserServiceError_ErrorCode) String() string { + return proto.EnumName(UserServiceError_ErrorCode_name, int32(x)) +} +func (x *UserServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(UserServiceError_ErrorCode_value, data, "UserServiceError_ErrorCode") + if err != nil { + return err + } + *x = UserServiceError_ErrorCode(value) + return nil +} +func (UserServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{0, 0} +} + +type UserServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UserServiceError) Reset() { *m = UserServiceError{} } +func (m *UserServiceError) String() string { return proto.CompactTextString(m) } +func (*UserServiceError) ProtoMessage() {} +func (*UserServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{0} +} +func (m *UserServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UserServiceError.Unmarshal(m, b) +} +func (m *UserServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UserServiceError.Marshal(b, m, deterministic) +} +func (dst *UserServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserServiceError.Merge(dst, src) +} +func (m *UserServiceError) XXX_Size() int { + return xxx_messageInfo_UserServiceError.Size(m) +} +func (m *UserServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_UserServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_UserServiceError proto.InternalMessageInfo + +type CreateLoginURLRequest struct { + DestinationUrl *string `protobuf:"bytes,1,req,name=destination_url,json=destinationUrl" json:"destination_url,omitempty"` + AuthDomain *string `protobuf:"bytes,2,opt,name=auth_domain,json=authDomain" json:"auth_domain,omitempty"` + FederatedIdentity *string `protobuf:"bytes,3,opt,name=federated_identity,json=federatedIdentity,def=" json:"federated_identity,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateLoginURLRequest) Reset() { *m = CreateLoginURLRequest{} } +func (m *CreateLoginURLRequest) String() string { return proto.CompactTextString(m) } +func (*CreateLoginURLRequest) ProtoMessage() {} +func (*CreateLoginURLRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{1} +} +func (m *CreateLoginURLRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateLoginURLRequest.Unmarshal(m, b) +} +func (m *CreateLoginURLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateLoginURLRequest.Marshal(b, m, deterministic) +} +func (dst *CreateLoginURLRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateLoginURLRequest.Merge(dst, src) +} +func (m *CreateLoginURLRequest) XXX_Size() int { + return xxx_messageInfo_CreateLoginURLRequest.Size(m) +} +func (m *CreateLoginURLRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateLoginURLRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateLoginURLRequest proto.InternalMessageInfo + +func (m *CreateLoginURLRequest) GetDestinationUrl() string { + if m != nil && m.DestinationUrl != nil { + return *m.DestinationUrl + } + return "" +} + +func (m *CreateLoginURLRequest) GetAuthDomain() string { + if m != nil && m.AuthDomain != nil { + return *m.AuthDomain + } + return "" +} + +func (m *CreateLoginURLRequest) GetFederatedIdentity() string { + if m != nil && m.FederatedIdentity != nil { + return *m.FederatedIdentity + } + return "" +} + +type CreateLoginURLResponse struct { + LoginUrl *string `protobuf:"bytes,1,req,name=login_url,json=loginUrl" json:"login_url,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateLoginURLResponse) Reset() { *m = CreateLoginURLResponse{} } +func (m *CreateLoginURLResponse) String() string { return proto.CompactTextString(m) } +func (*CreateLoginURLResponse) ProtoMessage() {} +func (*CreateLoginURLResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{2} +} +func (m *CreateLoginURLResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateLoginURLResponse.Unmarshal(m, b) +} +func (m *CreateLoginURLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateLoginURLResponse.Marshal(b, m, deterministic) +} +func (dst *CreateLoginURLResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateLoginURLResponse.Merge(dst, src) +} +func (m *CreateLoginURLResponse) XXX_Size() int { + return xxx_messageInfo_CreateLoginURLResponse.Size(m) +} +func (m *CreateLoginURLResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateLoginURLResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateLoginURLResponse proto.InternalMessageInfo + +func (m *CreateLoginURLResponse) GetLoginUrl() string { + if m != nil && m.LoginUrl != nil { + return *m.LoginUrl + } + return "" +} + +type CreateLogoutURLRequest struct { + DestinationUrl *string `protobuf:"bytes,1,req,name=destination_url,json=destinationUrl" json:"destination_url,omitempty"` + AuthDomain *string `protobuf:"bytes,2,opt,name=auth_domain,json=authDomain" json:"auth_domain,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateLogoutURLRequest) Reset() { *m = CreateLogoutURLRequest{} } +func (m *CreateLogoutURLRequest) String() string { return proto.CompactTextString(m) } +func (*CreateLogoutURLRequest) ProtoMessage() {} +func (*CreateLogoutURLRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{3} +} +func (m *CreateLogoutURLRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateLogoutURLRequest.Unmarshal(m, b) +} +func (m *CreateLogoutURLRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateLogoutURLRequest.Marshal(b, m, deterministic) +} +func (dst *CreateLogoutURLRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateLogoutURLRequest.Merge(dst, src) +} +func (m *CreateLogoutURLRequest) XXX_Size() int { + return xxx_messageInfo_CreateLogoutURLRequest.Size(m) +} +func (m *CreateLogoutURLRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateLogoutURLRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateLogoutURLRequest proto.InternalMessageInfo + +func (m *CreateLogoutURLRequest) GetDestinationUrl() string { + if m != nil && m.DestinationUrl != nil { + return *m.DestinationUrl + } + return "" +} + +func (m *CreateLogoutURLRequest) GetAuthDomain() string { + if m != nil && m.AuthDomain != nil { + return *m.AuthDomain + } + return "" +} + +type CreateLogoutURLResponse struct { + LogoutUrl *string `protobuf:"bytes,1,req,name=logout_url,json=logoutUrl" json:"logout_url,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateLogoutURLResponse) Reset() { *m = CreateLogoutURLResponse{} } +func (m *CreateLogoutURLResponse) String() string { return proto.CompactTextString(m) } +func (*CreateLogoutURLResponse) ProtoMessage() {} +func (*CreateLogoutURLResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{4} +} +func (m *CreateLogoutURLResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateLogoutURLResponse.Unmarshal(m, b) +} +func (m *CreateLogoutURLResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateLogoutURLResponse.Marshal(b, m, deterministic) +} +func (dst *CreateLogoutURLResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateLogoutURLResponse.Merge(dst, src) +} +func (m *CreateLogoutURLResponse) XXX_Size() int { + return xxx_messageInfo_CreateLogoutURLResponse.Size(m) +} +func (m *CreateLogoutURLResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateLogoutURLResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateLogoutURLResponse proto.InternalMessageInfo + +func (m *CreateLogoutURLResponse) GetLogoutUrl() string { + if m != nil && m.LogoutUrl != nil { + return *m.LogoutUrl + } + return "" +} + +type GetOAuthUserRequest struct { + Scope *string `protobuf:"bytes,1,opt,name=scope" json:"scope,omitempty"` + Scopes []string `protobuf:"bytes,2,rep,name=scopes" json:"scopes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetOAuthUserRequest) Reset() { *m = GetOAuthUserRequest{} } +func (m *GetOAuthUserRequest) String() string { return proto.CompactTextString(m) } +func (*GetOAuthUserRequest) ProtoMessage() {} +func (*GetOAuthUserRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{5} +} +func (m *GetOAuthUserRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetOAuthUserRequest.Unmarshal(m, b) +} +func (m *GetOAuthUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetOAuthUserRequest.Marshal(b, m, deterministic) +} +func (dst *GetOAuthUserRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetOAuthUserRequest.Merge(dst, src) +} +func (m *GetOAuthUserRequest) XXX_Size() int { + return xxx_messageInfo_GetOAuthUserRequest.Size(m) +} +func (m *GetOAuthUserRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetOAuthUserRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetOAuthUserRequest proto.InternalMessageInfo + +func (m *GetOAuthUserRequest) GetScope() string { + if m != nil && m.Scope != nil { + return *m.Scope + } + return "" +} + +func (m *GetOAuthUserRequest) GetScopes() []string { + if m != nil { + return m.Scopes + } + return nil +} + +type GetOAuthUserResponse struct { + Email *string `protobuf:"bytes,1,req,name=email" json:"email,omitempty"` + UserId *string `protobuf:"bytes,2,req,name=user_id,json=userId" json:"user_id,omitempty"` + AuthDomain *string `protobuf:"bytes,3,req,name=auth_domain,json=authDomain" json:"auth_domain,omitempty"` + UserOrganization *string `protobuf:"bytes,4,opt,name=user_organization,json=userOrganization,def=" json:"user_organization,omitempty"` + IsAdmin *bool `protobuf:"varint,5,opt,name=is_admin,json=isAdmin,def=0" json:"is_admin,omitempty"` + ClientId *string `protobuf:"bytes,6,opt,name=client_id,json=clientId,def=" json:"client_id,omitempty"` + Scopes []string `protobuf:"bytes,7,rep,name=scopes" json:"scopes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetOAuthUserResponse) Reset() { *m = GetOAuthUserResponse{} } +func (m *GetOAuthUserResponse) String() string { return proto.CompactTextString(m) } +func (*GetOAuthUserResponse) ProtoMessage() {} +func (*GetOAuthUserResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{6} +} +func (m *GetOAuthUserResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetOAuthUserResponse.Unmarshal(m, b) +} +func (m *GetOAuthUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetOAuthUserResponse.Marshal(b, m, deterministic) +} +func (dst *GetOAuthUserResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetOAuthUserResponse.Merge(dst, src) +} +func (m *GetOAuthUserResponse) XXX_Size() int { + return xxx_messageInfo_GetOAuthUserResponse.Size(m) +} +func (m *GetOAuthUserResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetOAuthUserResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetOAuthUserResponse proto.InternalMessageInfo + +const Default_GetOAuthUserResponse_IsAdmin bool = false + +func (m *GetOAuthUserResponse) GetEmail() string { + if m != nil && m.Email != nil { + return *m.Email + } + return "" +} + +func (m *GetOAuthUserResponse) GetUserId() string { + if m != nil && m.UserId != nil { + return *m.UserId + } + return "" +} + +func (m *GetOAuthUserResponse) GetAuthDomain() string { + if m != nil && m.AuthDomain != nil { + return *m.AuthDomain + } + return "" +} + +func (m *GetOAuthUserResponse) GetUserOrganization() string { + if m != nil && m.UserOrganization != nil { + return *m.UserOrganization + } + return "" +} + +func (m *GetOAuthUserResponse) GetIsAdmin() bool { + if m != nil && m.IsAdmin != nil { + return *m.IsAdmin + } + return Default_GetOAuthUserResponse_IsAdmin +} + +func (m *GetOAuthUserResponse) GetClientId() string { + if m != nil && m.ClientId != nil { + return *m.ClientId + } + return "" +} + +func (m *GetOAuthUserResponse) GetScopes() []string { + if m != nil { + return m.Scopes + } + return nil +} + +type CheckOAuthSignatureRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CheckOAuthSignatureRequest) Reset() { *m = CheckOAuthSignatureRequest{} } +func (m *CheckOAuthSignatureRequest) String() string { return proto.CompactTextString(m) } +func (*CheckOAuthSignatureRequest) ProtoMessage() {} +func (*CheckOAuthSignatureRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{7} +} +func (m *CheckOAuthSignatureRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CheckOAuthSignatureRequest.Unmarshal(m, b) +} +func (m *CheckOAuthSignatureRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CheckOAuthSignatureRequest.Marshal(b, m, deterministic) +} +func (dst *CheckOAuthSignatureRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CheckOAuthSignatureRequest.Merge(dst, src) +} +func (m *CheckOAuthSignatureRequest) XXX_Size() int { + return xxx_messageInfo_CheckOAuthSignatureRequest.Size(m) +} +func (m *CheckOAuthSignatureRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CheckOAuthSignatureRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CheckOAuthSignatureRequest proto.InternalMessageInfo + +type CheckOAuthSignatureResponse struct { + OauthConsumerKey *string `protobuf:"bytes,1,req,name=oauth_consumer_key,json=oauthConsumerKey" json:"oauth_consumer_key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CheckOAuthSignatureResponse) Reset() { *m = CheckOAuthSignatureResponse{} } +func (m *CheckOAuthSignatureResponse) String() string { return proto.CompactTextString(m) } +func (*CheckOAuthSignatureResponse) ProtoMessage() {} +func (*CheckOAuthSignatureResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_user_service_faa685423dd20b0a, []int{8} +} +func (m *CheckOAuthSignatureResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CheckOAuthSignatureResponse.Unmarshal(m, b) +} +func (m *CheckOAuthSignatureResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CheckOAuthSignatureResponse.Marshal(b, m, deterministic) +} +func (dst *CheckOAuthSignatureResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CheckOAuthSignatureResponse.Merge(dst, src) +} +func (m *CheckOAuthSignatureResponse) XXX_Size() int { + return xxx_messageInfo_CheckOAuthSignatureResponse.Size(m) +} +func (m *CheckOAuthSignatureResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CheckOAuthSignatureResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CheckOAuthSignatureResponse proto.InternalMessageInfo + +func (m *CheckOAuthSignatureResponse) GetOauthConsumerKey() string { + if m != nil && m.OauthConsumerKey != nil { + return *m.OauthConsumerKey + } + return "" +} + +func init() { + proto.RegisterType((*UserServiceError)(nil), "appengine.UserServiceError") + proto.RegisterType((*CreateLoginURLRequest)(nil), "appengine.CreateLoginURLRequest") + proto.RegisterType((*CreateLoginURLResponse)(nil), "appengine.CreateLoginURLResponse") + proto.RegisterType((*CreateLogoutURLRequest)(nil), "appengine.CreateLogoutURLRequest") + proto.RegisterType((*CreateLogoutURLResponse)(nil), "appengine.CreateLogoutURLResponse") + proto.RegisterType((*GetOAuthUserRequest)(nil), "appengine.GetOAuthUserRequest") + proto.RegisterType((*GetOAuthUserResponse)(nil), "appengine.GetOAuthUserResponse") + proto.RegisterType((*CheckOAuthSignatureRequest)(nil), "appengine.CheckOAuthSignatureRequest") + proto.RegisterType((*CheckOAuthSignatureResponse)(nil), "appengine.CheckOAuthSignatureResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/user/user_service.proto", fileDescriptor_user_service_faa685423dd20b0a) +} + +var fileDescriptor_user_service_faa685423dd20b0a = []byte{ + // 573 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x52, 0x4d, 0x6f, 0xdb, 0x38, + 0x10, 0x8d, 0xec, 0xd8, 0xb1, 0x26, 0xc0, 0x46, 0x61, 0xbe, 0xb4, 0x9b, 0x0d, 0xd6, 0xd0, 0x65, + 0x7d, 0x68, 0xe3, 0x53, 0x81, 0x22, 0xe8, 0xc5, 0xb5, 0x85, 0xd4, 0xb0, 0x60, 0xa1, 0x8c, 0xd5, + 0x02, 0xbd, 0x08, 0xac, 0x35, 0x51, 0x88, 0xc8, 0xa4, 0x4b, 0x52, 0x05, 0xd2, 0x73, 0x7f, 0x41, + 0x6f, 0xfd, 0x93, 0xfd, 0x0d, 0x85, 0x68, 0x25, 0x50, 0xd2, 0x5e, 0x7b, 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c, 0xb3, 0xe7, 0xb0, 0x6f, 0x4f, 0x4a, 0x95, 0x33, + 0xc1, 0xbf, 0xd8, 0x05, 0xf9, 0xdb, 0xf5, 0x95, 0x79, 0x15, 0x15, 0x37, 0x18, 0xd2, 0x87, 0x1e, + 0xd7, 0x29, 0xcb, 0x56, 0x5c, 0xf8, 0x9d, 0xbe, 0x33, 0xe8, 0x5d, 0x74, 0xae, 0x59, 0xa1, 0x91, + 0xee, 0x70, 0x3d, 0xaa, 0x50, 0x72, 0x06, 0xee, 0xb2, 0xe0, 0x28, 0x4c, 0x65, 0xa6, 0x5b, 0x0b, + 0xf5, 0x36, 0xd0, 0x34, 0x6b, 0x04, 0xde, 0x79, 0x14, 0xf8, 0x5f, 0xf8, 0x67, 0x7c, 0x83, 0xcb, + 0x5b, 0x9b, 0xf8, 0x8a, 0xe7, 0x82, 0x99, 0x52, 0x61, 0xbd, 0xbc, 0x60, 0x06, 0xa7, 0xbf, 0x65, + 0xeb, 0xa5, 0x3c, 0x03, 0x22, 0x6d, 0xcc, 0xa5, 0x14, 0xba, 0x5c, 0xa1, 0x4a, 0x6f, 0xf1, 0xae, + 0xde, 0x90, 0x67, 0x99, 0x71, 0x4d, 0xcc, 0xf0, 0xee, 0x75, 0xf7, 0xc3, 0x76, 0x95, 0xeb, 0x67, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x58, 0x04, 0x53, 0xcc, 0xf8, 0x03, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/user/user_service.proto b/vendor/google.golang.org/appengine/internal/user/user_service.proto new file mode 100644 index 000000000..f3e969346 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/user/user_service.proto @@ -0,0 +1,58 @@ +syntax = "proto2"; +option go_package = "user"; + +package appengine; + +message UserServiceError { + enum ErrorCode { + OK = 0; + REDIRECT_URL_TOO_LONG = 1; + NOT_ALLOWED = 2; + OAUTH_INVALID_TOKEN = 3; + OAUTH_INVALID_REQUEST = 4; + OAUTH_ERROR = 5; + } +} + +message CreateLoginURLRequest { + required string destination_url = 1; + optional string auth_domain = 2; + optional string federated_identity = 3 [default = ""]; +} + +message CreateLoginURLResponse { + required string login_url = 1; +} + +message CreateLogoutURLRequest { + required string destination_url = 1; + optional string auth_domain = 2; +} + +message CreateLogoutURLResponse { + required string logout_url = 1; +} + +message GetOAuthUserRequest { + optional string scope = 1; + + repeated string scopes = 2; +} + +message GetOAuthUserResponse { + required string email = 1; + required string user_id = 2; + required string auth_domain = 3; + optional string user_organization = 4 [default = ""]; + optional bool is_admin = 5 [default = false]; + optional string client_id = 6 [default = ""]; + + repeated string scopes = 7; +} + +message CheckOAuthSignatureRequest { +} + +message CheckOAuthSignatureResponse { + required string oauth_consumer_key = 1; +} diff --git a/vendor/google.golang.org/appengine/internal/xmpp/xmpp_service.pb.go b/vendor/google.golang.org/appengine/internal/xmpp/xmpp_service.pb.go new file mode 100644 index 000000000..a35e9b418 --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/xmpp/xmpp_service.pb.go @@ -0,0 +1,726 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google.golang.org/appengine/internal/xmpp/xmpp_service.proto + +package xmpp + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type XmppServiceError_ErrorCode int32 + +const ( + XmppServiceError_UNSPECIFIED_ERROR XmppServiceError_ErrorCode = 1 + XmppServiceError_INVALID_JID XmppServiceError_ErrorCode = 2 + XmppServiceError_NO_BODY XmppServiceError_ErrorCode = 3 + XmppServiceError_INVALID_XML XmppServiceError_ErrorCode = 4 + XmppServiceError_INVALID_TYPE XmppServiceError_ErrorCode = 5 + XmppServiceError_INVALID_SHOW XmppServiceError_ErrorCode = 6 + XmppServiceError_EXCEEDED_MAX_SIZE XmppServiceError_ErrorCode = 7 + XmppServiceError_APPID_ALIAS_REQUIRED XmppServiceError_ErrorCode = 8 + XmppServiceError_NONDEFAULT_MODULE XmppServiceError_ErrorCode = 9 +) + +var XmppServiceError_ErrorCode_name = map[int32]string{ + 1: "UNSPECIFIED_ERROR", + 2: "INVALID_JID", + 3: "NO_BODY", + 4: "INVALID_XML", + 5: "INVALID_TYPE", + 6: "INVALID_SHOW", + 7: "EXCEEDED_MAX_SIZE", + 8: "APPID_ALIAS_REQUIRED", + 9: "NONDEFAULT_MODULE", +} +var XmppServiceError_ErrorCode_value = map[string]int32{ + "UNSPECIFIED_ERROR": 1, + "INVALID_JID": 2, + "NO_BODY": 3, + "INVALID_XML": 4, + "INVALID_TYPE": 5, + "INVALID_SHOW": 6, + "EXCEEDED_MAX_SIZE": 7, + "APPID_ALIAS_REQUIRED": 8, + "NONDEFAULT_MODULE": 9, +} + +func (x XmppServiceError_ErrorCode) Enum() *XmppServiceError_ErrorCode { + p := new(XmppServiceError_ErrorCode) + *p = x + return p +} +func (x XmppServiceError_ErrorCode) String() string { + return proto.EnumName(XmppServiceError_ErrorCode_name, int32(x)) +} +func (x *XmppServiceError_ErrorCode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(XmppServiceError_ErrorCode_value, data, "XmppServiceError_ErrorCode") + if err != nil { + return err + } + *x = XmppServiceError_ErrorCode(value) + return nil +} +func (XmppServiceError_ErrorCode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{0, 0} +} + +type PresenceResponse_SHOW int32 + +const ( + PresenceResponse_NORMAL PresenceResponse_SHOW = 0 + PresenceResponse_AWAY PresenceResponse_SHOW = 1 + PresenceResponse_DO_NOT_DISTURB PresenceResponse_SHOW = 2 + PresenceResponse_CHAT PresenceResponse_SHOW = 3 + PresenceResponse_EXTENDED_AWAY PresenceResponse_SHOW = 4 +) + +var PresenceResponse_SHOW_name = map[int32]string{ + 0: "NORMAL", + 1: "AWAY", + 2: "DO_NOT_DISTURB", + 3: "CHAT", + 4: "EXTENDED_AWAY", +} +var PresenceResponse_SHOW_value = map[string]int32{ + "NORMAL": 0, + "AWAY": 1, + "DO_NOT_DISTURB": 2, + "CHAT": 3, + "EXTENDED_AWAY": 4, +} + +func (x PresenceResponse_SHOW) Enum() *PresenceResponse_SHOW { + p := new(PresenceResponse_SHOW) + *p = x + return p +} +func (x PresenceResponse_SHOW) String() string { + return proto.EnumName(PresenceResponse_SHOW_name, int32(x)) +} +func (x *PresenceResponse_SHOW) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(PresenceResponse_SHOW_value, data, "PresenceResponse_SHOW") + if err != nil { + return err + } + *x = PresenceResponse_SHOW(value) + return nil +} +func (PresenceResponse_SHOW) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{2, 0} +} + +type XmppMessageResponse_XmppMessageStatus int32 + +const ( + XmppMessageResponse_NO_ERROR XmppMessageResponse_XmppMessageStatus = 0 + XmppMessageResponse_INVALID_JID XmppMessageResponse_XmppMessageStatus = 1 + XmppMessageResponse_OTHER_ERROR XmppMessageResponse_XmppMessageStatus = 2 +) + +var XmppMessageResponse_XmppMessageStatus_name = map[int32]string{ + 0: "NO_ERROR", + 1: "INVALID_JID", + 2: "OTHER_ERROR", +} +var XmppMessageResponse_XmppMessageStatus_value = map[string]int32{ + "NO_ERROR": 0, + "INVALID_JID": 1, + "OTHER_ERROR": 2, +} + +func (x XmppMessageResponse_XmppMessageStatus) Enum() *XmppMessageResponse_XmppMessageStatus { + p := new(XmppMessageResponse_XmppMessageStatus) + *p = x + return p +} +func (x XmppMessageResponse_XmppMessageStatus) String() string { + return proto.EnumName(XmppMessageResponse_XmppMessageStatus_name, int32(x)) +} +func (x *XmppMessageResponse_XmppMessageStatus) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(XmppMessageResponse_XmppMessageStatus_value, data, "XmppMessageResponse_XmppMessageStatus") + if err != nil { + return err + } + *x = XmppMessageResponse_XmppMessageStatus(value) + return nil +} +func (XmppMessageResponse_XmppMessageStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{6, 0} +} + +type XmppServiceError struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *XmppServiceError) Reset() { *m = XmppServiceError{} } +func (m *XmppServiceError) String() string { return proto.CompactTextString(m) } +func (*XmppServiceError) ProtoMessage() {} +func (*XmppServiceError) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{0} +} +func (m *XmppServiceError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_XmppServiceError.Unmarshal(m, b) +} +func (m *XmppServiceError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_XmppServiceError.Marshal(b, m, deterministic) +} +func (dst *XmppServiceError) XXX_Merge(src proto.Message) { + xxx_messageInfo_XmppServiceError.Merge(dst, src) +} +func (m *XmppServiceError) XXX_Size() int { + return xxx_messageInfo_XmppServiceError.Size(m) +} +func (m *XmppServiceError) XXX_DiscardUnknown() { + xxx_messageInfo_XmppServiceError.DiscardUnknown(m) +} + +var xxx_messageInfo_XmppServiceError proto.InternalMessageInfo + +type PresenceRequest struct { + Jid *string `protobuf:"bytes,1,req,name=jid" json:"jid,omitempty"` + FromJid *string `protobuf:"bytes,2,opt,name=from_jid,json=fromJid" json:"from_jid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PresenceRequest) Reset() { *m = PresenceRequest{} } +func (m *PresenceRequest) String() string { return proto.CompactTextString(m) } +func (*PresenceRequest) ProtoMessage() {} +func (*PresenceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{1} +} +func (m *PresenceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PresenceRequest.Unmarshal(m, b) +} +func (m *PresenceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PresenceRequest.Marshal(b, m, deterministic) +} +func (dst *PresenceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PresenceRequest.Merge(dst, src) +} +func (m *PresenceRequest) XXX_Size() int { + return xxx_messageInfo_PresenceRequest.Size(m) +} +func (m *PresenceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PresenceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PresenceRequest proto.InternalMessageInfo + +func (m *PresenceRequest) GetJid() string { + if m != nil && m.Jid != nil { + return *m.Jid + } + return "" +} + +func (m *PresenceRequest) GetFromJid() string { + if m != nil && m.FromJid != nil { + return *m.FromJid + } + return "" +} + +type PresenceResponse struct { + IsAvailable *bool `protobuf:"varint,1,req,name=is_available,json=isAvailable" json:"is_available,omitempty"` + Presence *PresenceResponse_SHOW `protobuf:"varint,2,opt,name=presence,enum=appengine.PresenceResponse_SHOW" json:"presence,omitempty"` + Valid *bool `protobuf:"varint,3,opt,name=valid" json:"valid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PresenceResponse) Reset() { *m = PresenceResponse{} } +func (m *PresenceResponse) String() string { return proto.CompactTextString(m) } +func (*PresenceResponse) ProtoMessage() {} +func (*PresenceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{2} +} +func (m *PresenceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PresenceResponse.Unmarshal(m, b) +} +func (m *PresenceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PresenceResponse.Marshal(b, m, deterministic) +} +func (dst *PresenceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PresenceResponse.Merge(dst, src) +} +func (m *PresenceResponse) XXX_Size() int { + return xxx_messageInfo_PresenceResponse.Size(m) +} +func (m *PresenceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PresenceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PresenceResponse proto.InternalMessageInfo + +func (m *PresenceResponse) GetIsAvailable() bool { + if m != nil && m.IsAvailable != nil { + return *m.IsAvailable + } + return false +} + +func (m *PresenceResponse) GetPresence() PresenceResponse_SHOW { + if m != nil && m.Presence != nil { + return *m.Presence + } + return PresenceResponse_NORMAL +} + +func (m *PresenceResponse) GetValid() bool { + if m != nil && m.Valid != nil { + return *m.Valid + } + return false +} + +type BulkPresenceRequest struct { + Jid []string `protobuf:"bytes,1,rep,name=jid" json:"jid,omitempty"` + FromJid *string `protobuf:"bytes,2,opt,name=from_jid,json=fromJid" json:"from_jid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BulkPresenceRequest) Reset() { *m = BulkPresenceRequest{} } +func (m *BulkPresenceRequest) String() string { return proto.CompactTextString(m) } +func (*BulkPresenceRequest) ProtoMessage() {} +func (*BulkPresenceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{3} +} +func (m *BulkPresenceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BulkPresenceRequest.Unmarshal(m, b) +} +func (m *BulkPresenceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BulkPresenceRequest.Marshal(b, m, deterministic) +} +func (dst *BulkPresenceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BulkPresenceRequest.Merge(dst, src) +} +func (m *BulkPresenceRequest) XXX_Size() int { + return xxx_messageInfo_BulkPresenceRequest.Size(m) +} +func (m *BulkPresenceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BulkPresenceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BulkPresenceRequest proto.InternalMessageInfo + +func (m *BulkPresenceRequest) GetJid() []string { + if m != nil { + return m.Jid + } + return nil +} + +func (m *BulkPresenceRequest) GetFromJid() string { + if m != nil && m.FromJid != nil { + return *m.FromJid + } + return "" +} + +type BulkPresenceResponse struct { + PresenceResponse []*PresenceResponse `protobuf:"bytes,1,rep,name=presence_response,json=presenceResponse" json:"presence_response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BulkPresenceResponse) Reset() { *m = BulkPresenceResponse{} } +func (m *BulkPresenceResponse) String() string { return proto.CompactTextString(m) } +func (*BulkPresenceResponse) ProtoMessage() {} +func (*BulkPresenceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{4} +} +func (m *BulkPresenceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BulkPresenceResponse.Unmarshal(m, b) +} +func (m *BulkPresenceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BulkPresenceResponse.Marshal(b, m, deterministic) +} +func (dst *BulkPresenceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BulkPresenceResponse.Merge(dst, src) +} +func (m *BulkPresenceResponse) XXX_Size() int { + return xxx_messageInfo_BulkPresenceResponse.Size(m) +} +func (m *BulkPresenceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BulkPresenceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BulkPresenceResponse proto.InternalMessageInfo + +func (m *BulkPresenceResponse) GetPresenceResponse() []*PresenceResponse { + if m != nil { + return m.PresenceResponse + } + return nil +} + +type XmppMessageRequest struct { + Jid []string `protobuf:"bytes,1,rep,name=jid" json:"jid,omitempty"` + Body *string `protobuf:"bytes,2,req,name=body" json:"body,omitempty"` + RawXml *bool `protobuf:"varint,3,opt,name=raw_xml,json=rawXml,def=0" json:"raw_xml,omitempty"` + Type *string `protobuf:"bytes,4,opt,name=type,def=chat" json:"type,omitempty"` + FromJid *string `protobuf:"bytes,5,opt,name=from_jid,json=fromJid" json:"from_jid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *XmppMessageRequest) Reset() { *m = XmppMessageRequest{} } +func (m *XmppMessageRequest) String() string { return proto.CompactTextString(m) } +func (*XmppMessageRequest) ProtoMessage() {} +func (*XmppMessageRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{5} +} +func (m *XmppMessageRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_XmppMessageRequest.Unmarshal(m, b) +} +func (m *XmppMessageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_XmppMessageRequest.Marshal(b, m, deterministic) +} +func (dst *XmppMessageRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_XmppMessageRequest.Merge(dst, src) +} +func (m *XmppMessageRequest) XXX_Size() int { + return xxx_messageInfo_XmppMessageRequest.Size(m) +} +func (m *XmppMessageRequest) XXX_DiscardUnknown() { + xxx_messageInfo_XmppMessageRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_XmppMessageRequest proto.InternalMessageInfo + +const Default_XmppMessageRequest_RawXml bool = false +const Default_XmppMessageRequest_Type string = "chat" + +func (m *XmppMessageRequest) GetJid() []string { + if m != nil { + return m.Jid + } + return nil +} + +func (m *XmppMessageRequest) GetBody() string { + if m != nil && m.Body != nil { + return *m.Body + } + return "" +} + +func (m *XmppMessageRequest) GetRawXml() bool { + if m != nil && m.RawXml != nil { + return *m.RawXml + } + return Default_XmppMessageRequest_RawXml +} + +func (m *XmppMessageRequest) GetType() string { + if m != nil && m.Type != nil { + return *m.Type + } + return Default_XmppMessageRequest_Type +} + +func (m *XmppMessageRequest) GetFromJid() string { + if m != nil && m.FromJid != nil { + return *m.FromJid + } + return "" +} + +type XmppMessageResponse struct { + Status []XmppMessageResponse_XmppMessageStatus `protobuf:"varint,1,rep,name=status,enum=appengine.XmppMessageResponse_XmppMessageStatus" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *XmppMessageResponse) Reset() { *m = XmppMessageResponse{} } +func (m *XmppMessageResponse) String() string { return proto.CompactTextString(m) } +func (*XmppMessageResponse) ProtoMessage() {} +func (*XmppMessageResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{6} +} +func (m *XmppMessageResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_XmppMessageResponse.Unmarshal(m, b) +} +func (m *XmppMessageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_XmppMessageResponse.Marshal(b, m, deterministic) +} +func (dst *XmppMessageResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_XmppMessageResponse.Merge(dst, src) +} +func (m *XmppMessageResponse) XXX_Size() int { + return xxx_messageInfo_XmppMessageResponse.Size(m) +} +func (m *XmppMessageResponse) XXX_DiscardUnknown() { + xxx_messageInfo_XmppMessageResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_XmppMessageResponse proto.InternalMessageInfo + +func (m *XmppMessageResponse) GetStatus() []XmppMessageResponse_XmppMessageStatus { + if m != nil { + return m.Status + } + return nil +} + +type XmppSendPresenceRequest struct { + Jid *string `protobuf:"bytes,1,req,name=jid" json:"jid,omitempty"` + Type *string `protobuf:"bytes,2,opt,name=type" json:"type,omitempty"` + Show *string `protobuf:"bytes,3,opt,name=show" json:"show,omitempty"` + Status *string `protobuf:"bytes,4,opt,name=status" json:"status,omitempty"` + FromJid *string `protobuf:"bytes,5,opt,name=from_jid,json=fromJid" json:"from_jid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *XmppSendPresenceRequest) Reset() { *m = XmppSendPresenceRequest{} } +func (m *XmppSendPresenceRequest) String() string { return proto.CompactTextString(m) } +func (*XmppSendPresenceRequest) ProtoMessage() {} +func (*XmppSendPresenceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{7} +} +func (m *XmppSendPresenceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_XmppSendPresenceRequest.Unmarshal(m, b) +} +func (m *XmppSendPresenceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_XmppSendPresenceRequest.Marshal(b, m, deterministic) +} +func (dst *XmppSendPresenceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_XmppSendPresenceRequest.Merge(dst, src) +} +func (m *XmppSendPresenceRequest) XXX_Size() int { + return xxx_messageInfo_XmppSendPresenceRequest.Size(m) +} +func (m *XmppSendPresenceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_XmppSendPresenceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_XmppSendPresenceRequest proto.InternalMessageInfo + +func (m *XmppSendPresenceRequest) GetJid() string { + if m != nil && m.Jid != nil { + return *m.Jid + } + return "" +} + +func (m *XmppSendPresenceRequest) GetType() string { + if m != nil && m.Type != nil { + return *m.Type + } + return "" +} + +func (m *XmppSendPresenceRequest) GetShow() string { + if m != nil && m.Show != nil { + return *m.Show + } + return "" +} + +func (m *XmppSendPresenceRequest) GetStatus() string { + if m != nil && m.Status != nil { + return *m.Status + } + return "" +} + +func (m *XmppSendPresenceRequest) GetFromJid() string { + if m != nil && m.FromJid != nil { + return *m.FromJid + } + return "" +} + +type XmppSendPresenceResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *XmppSendPresenceResponse) Reset() { *m = XmppSendPresenceResponse{} } +func (m *XmppSendPresenceResponse) String() string { return proto.CompactTextString(m) } +func (*XmppSendPresenceResponse) ProtoMessage() {} +func (*XmppSendPresenceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{8} +} +func (m *XmppSendPresenceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_XmppSendPresenceResponse.Unmarshal(m, b) +} +func (m *XmppSendPresenceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_XmppSendPresenceResponse.Marshal(b, m, deterministic) +} +func (dst *XmppSendPresenceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_XmppSendPresenceResponse.Merge(dst, src) +} +func (m *XmppSendPresenceResponse) XXX_Size() int { + return xxx_messageInfo_XmppSendPresenceResponse.Size(m) +} +func (m *XmppSendPresenceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_XmppSendPresenceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_XmppSendPresenceResponse proto.InternalMessageInfo + +type XmppInviteRequest struct { + Jid *string `protobuf:"bytes,1,req,name=jid" json:"jid,omitempty"` + FromJid *string `protobuf:"bytes,2,opt,name=from_jid,json=fromJid" json:"from_jid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *XmppInviteRequest) Reset() { *m = XmppInviteRequest{} } +func (m *XmppInviteRequest) String() string { return proto.CompactTextString(m) } +func (*XmppInviteRequest) ProtoMessage() {} +func (*XmppInviteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{9} +} +func (m *XmppInviteRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_XmppInviteRequest.Unmarshal(m, b) +} +func (m *XmppInviteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_XmppInviteRequest.Marshal(b, m, deterministic) +} +func (dst *XmppInviteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_XmppInviteRequest.Merge(dst, src) +} +func (m *XmppInviteRequest) XXX_Size() int { + return xxx_messageInfo_XmppInviteRequest.Size(m) +} +func (m *XmppInviteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_XmppInviteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_XmppInviteRequest proto.InternalMessageInfo + +func (m *XmppInviteRequest) GetJid() string { + if m != nil && m.Jid != nil { + return *m.Jid + } + return "" +} + +func (m *XmppInviteRequest) GetFromJid() string { + if m != nil && m.FromJid != nil { + return *m.FromJid + } + return "" +} + +type XmppInviteResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *XmppInviteResponse) Reset() { *m = XmppInviteResponse{} } +func (m *XmppInviteResponse) String() string { return proto.CompactTextString(m) } +func (*XmppInviteResponse) ProtoMessage() {} +func (*XmppInviteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_xmpp_service_628da92437bed65f, []int{10} +} +func (m *XmppInviteResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_XmppInviteResponse.Unmarshal(m, b) +} +func (m *XmppInviteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_XmppInviteResponse.Marshal(b, m, deterministic) +} +func (dst *XmppInviteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_XmppInviteResponse.Merge(dst, src) +} +func (m *XmppInviteResponse) XXX_Size() int { + return xxx_messageInfo_XmppInviteResponse.Size(m) +} +func (m *XmppInviteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_XmppInviteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_XmppInviteResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*XmppServiceError)(nil), "appengine.XmppServiceError") + proto.RegisterType((*PresenceRequest)(nil), "appengine.PresenceRequest") + proto.RegisterType((*PresenceResponse)(nil), "appengine.PresenceResponse") + proto.RegisterType((*BulkPresenceRequest)(nil), "appengine.BulkPresenceRequest") + proto.RegisterType((*BulkPresenceResponse)(nil), "appengine.BulkPresenceResponse") + proto.RegisterType((*XmppMessageRequest)(nil), "appengine.XmppMessageRequest") + proto.RegisterType((*XmppMessageResponse)(nil), "appengine.XmppMessageResponse") + proto.RegisterType((*XmppSendPresenceRequest)(nil), "appengine.XmppSendPresenceRequest") + proto.RegisterType((*XmppSendPresenceResponse)(nil), "appengine.XmppSendPresenceResponse") + proto.RegisterType((*XmppInviteRequest)(nil), "appengine.XmppInviteRequest") + proto.RegisterType((*XmppInviteResponse)(nil), "appengine.XmppInviteResponse") +} + +func init() { + proto.RegisterFile("google.golang.org/appengine/internal/xmpp/xmpp_service.proto", fileDescriptor_xmpp_service_628da92437bed65f) +} + +var fileDescriptor_xmpp_service_628da92437bed65f = []byte{ + // 681 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x72, 0xda, 0x48, + 0x10, 0xb6, 0x40, 0xfc, 0x35, 0x5e, 0x7b, 0x18, 0xb3, 0xbb, 0xec, 0xa6, 0x2a, 0x45, 0x74, 0xf2, + 0x09, 0xa7, 0x7c, 0x74, 0xb9, 0x52, 0x11, 0x68, 0x5c, 0xc8, 0x05, 0x12, 0x19, 0x20, 0xc6, 0xbe, + 0x4c, 0x64, 0x33, 0x96, 0x95, 0x08, 0x49, 0x91, 0x64, 0x6c, 0xbf, 0x40, 0xae, 0x79, 0x89, 0xbc, + 0x46, 0x5e, 0x22, 0xa7, 0x3c, 0x4e, 0x4a, 0x23, 0x41, 0xc0, 0x4e, 0x9c, 0x54, 0x2e, 0x54, 0xcf, + 0x37, 0xdd, 0x1f, 0xfd, 0x7d, 0x3d, 0x2d, 0x38, 0xb4, 0x7d, 0xdf, 0x76, 0x79, 0xcb, 0xf6, 0x5d, + 0xcb, 0xb3, 0x5b, 0x7e, 0x68, 0xef, 0x59, 0x41, 0xc0, 0x3d, 0xdb, 0xf1, 0xf8, 0x9e, 0xe3, 0xc5, + 0x3c, 0xf4, 0x2c, 0x77, 0xef, 0x76, 0x16, 0x04, 0xe2, 0x87, 0x45, 0x3c, 0x9c, 0x3b, 0x17, 0xbc, + 0x15, 0x84, 0x7e, 0xec, 0xe3, 0xca, 0x32, 0x57, 0xf9, 0x22, 0x01, 0x9a, 0xcc, 0x82, 0x60, 0x98, + 0x26, 0x90, 0x30, 0xf4, 0x43, 0xe5, 0xb3, 0x04, 0x15, 0x11, 0x75, 0xfc, 0x29, 0xc7, 0x7f, 0x43, + 0x6d, 0x6c, 0x0c, 0x07, 0xa4, 0xa3, 0x1f, 0xe9, 0x44, 0x63, 0x84, 0x52, 0x93, 0x22, 0x09, 0x6f, + 0x43, 0x55, 0x37, 0x5e, 0xab, 0x3d, 0x5d, 0x63, 0xc7, 0xba, 0x86, 0x72, 0xb8, 0x0a, 0x25, 0xc3, + 0x64, 0x6d, 0x53, 0x3b, 0x45, 0xf9, 0xd5, 0xdb, 0x49, 0xbf, 0x87, 0x64, 0x8c, 0x60, 0x73, 0x01, + 0x8c, 0x4e, 0x07, 0x04, 0x15, 0x56, 0x91, 0x61, 0xd7, 0x3c, 0x41, 0xc5, 0xe4, 0x9f, 0xc8, 0xa4, + 0x43, 0x88, 0x46, 0x34, 0xd6, 0x57, 0x27, 0x6c, 0xa8, 0x9f, 0x11, 0x54, 0xc2, 0x0d, 0xa8, 0xab, + 0x83, 0x81, 0xae, 0x31, 0xb5, 0xa7, 0xab, 0x43, 0x46, 0xc9, 0xab, 0xb1, 0x4e, 0x89, 0x86, 0xca, + 0x49, 0x81, 0x61, 0x1a, 0x1a, 0x39, 0x52, 0xc7, 0xbd, 0x11, 0xeb, 0x9b, 0xda, 0xb8, 0x47, 0x50, + 0x45, 0x79, 0x01, 0xdb, 0x83, 0x90, 0x47, 0xdc, 0xbb, 0x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 0xfb, 0x32, 0x55, 0xaa, 0x7b, 0x73, 0x27, 0xfe, 0xb3, 0x05, 0xad, 0xa7, + 0xcf, 0x63, 0xc1, 0x90, 0xf2, 0xb6, 0x8b, 0x67, 0x72, 0xf2, 0xb1, 0xfb, 0x16, 0x00, 0x00, 0xff, + 0xff, 0x4e, 0x58, 0x2e, 0xb1, 0x1d, 0x05, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/appengine/internal/xmpp/xmpp_service.proto b/vendor/google.golang.org/appengine/internal/xmpp/xmpp_service.proto new file mode 100644 index 000000000..472d52ebf --- /dev/null +++ b/vendor/google.golang.org/appengine/internal/xmpp/xmpp_service.proto @@ -0,0 +1,83 @@ +syntax = "proto2"; +option go_package = "xmpp"; + +package appengine; + +message XmppServiceError { + enum ErrorCode { + UNSPECIFIED_ERROR = 1; + INVALID_JID = 2; + NO_BODY = 3; + INVALID_XML = 4; + INVALID_TYPE = 5; + INVALID_SHOW = 6; + EXCEEDED_MAX_SIZE = 7; + APPID_ALIAS_REQUIRED = 8; + NONDEFAULT_MODULE = 9; + } +} + +message PresenceRequest { + required string jid = 1; + optional string from_jid = 2; +} + +message PresenceResponse { + enum SHOW { + NORMAL = 0; + AWAY = 1; + DO_NOT_DISTURB = 2; + CHAT = 3; + EXTENDED_AWAY = 4; + } + + required bool is_available = 1; + optional SHOW presence = 2; + optional bool valid = 3; +} + +message BulkPresenceRequest { + repeated string jid = 1; + optional string from_jid = 2; +} + +message BulkPresenceResponse { + repeated PresenceResponse presence_response = 1; +} + +message XmppMessageRequest { + repeated string jid = 1; + required string body = 2; + optional bool raw_xml = 3 [ default = false ]; + optional string type = 4 [ default = "chat" ]; + optional string from_jid = 5; +} + +message XmppMessageResponse { + enum XmppMessageStatus { + NO_ERROR = 0; + INVALID_JID = 1; + OTHER_ERROR = 2; + } + + repeated XmppMessageStatus status = 1; +} + +message XmppSendPresenceRequest { + required string jid = 1; + optional string type = 2; + optional string show = 3; + optional string status = 4; + optional string from_jid = 5; +} + +message XmppSendPresenceResponse { +} + +message XmppInviteRequest { + required string jid = 1; + optional string from_jid = 2; +} + +message XmppInviteResponse { +} diff --git a/vendor/google.golang.org/appengine/log/api.go b/vendor/google.golang.org/appengine/log/api.go new file mode 100644 index 000000000..24d58601b --- /dev/null +++ b/vendor/google.golang.org/appengine/log/api.go @@ -0,0 +1,40 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package log + +// This file implements the logging API. + +import ( + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" +) + +// Debugf formats its arguments according to the format, analogous to fmt.Printf, +// and records the text as a log message at Debug level. The message will be associated +// with the request linked with the provided context. +func Debugf(ctx context.Context, format string, args ...interface{}) { + internal.Logf(ctx, 0, format, args...) +} + +// Infof is like Debugf, but at Info level. +func Infof(ctx context.Context, format string, args ...interface{}) { + internal.Logf(ctx, 1, format, args...) +} + +// Warningf is like Debugf, but at Warning level. +func Warningf(ctx context.Context, format string, args ...interface{}) { + internal.Logf(ctx, 2, format, args...) +} + +// Errorf is like Debugf, but at Error level. +func Errorf(ctx context.Context, format string, args ...interface{}) { + internal.Logf(ctx, 3, format, args...) +} + +// Criticalf is like Debugf, but at Critical level. +func Criticalf(ctx context.Context, format string, args ...interface{}) { + internal.Logf(ctx, 4, format, args...) +} diff --git a/vendor/google.golang.org/appengine/log/log.go b/vendor/google.golang.org/appengine/log/log.go new file mode 100644 index 000000000..731ad8c36 --- /dev/null +++ b/vendor/google.golang.org/appengine/log/log.go @@ -0,0 +1,323 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package log provides the means of writing and querying an application's logs +from within an App Engine application. + +Example: + c := appengine.NewContext(r) + query := &log.Query{ + AppLogs: true, + Versions: []string{"1"}, + } + + for results := query.Run(c); ; { + record, err := results.Next() + if err == log.Done { + log.Infof(c, "Done processing results") + break + } + if err != nil { + log.Errorf(c, "Failed to retrieve next log: %v", err) + break + } + log.Infof(c, "Saw record %v", record) + } +*/ +package log // import "google.golang.org/appengine/log" + +import ( + "errors" + "fmt" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/log" +) + +// Query defines a logs query. +type Query struct { + // Start time specifies the earliest log to return (inclusive). + StartTime time.Time + + // End time specifies the latest log to return (exclusive). + EndTime time.Time + + // Offset specifies a position within the log stream to resume reading from, + // and should come from a previously returned Record's field of the same name. + Offset []byte + + // Incomplete controls whether active (incomplete) requests should be included. + Incomplete bool + + // AppLogs indicates if application-level logs should be included. + AppLogs bool + + // ApplyMinLevel indicates if MinLevel should be used to filter results. + ApplyMinLevel bool + + // If ApplyMinLevel is true, only logs for requests with at least one + // application log of MinLevel or higher will be returned. + MinLevel int + + // Versions is the major version IDs whose logs should be retrieved. + // Logs for specific modules can be retrieved by the specifying versions + // in the form "module:version"; the default module is used if no module + // is specified. + Versions []string + + // A list of requests to search for instead of a time-based scan. Cannot be + // combined with filtering options such as StartTime, EndTime, Offset, + // Incomplete, ApplyMinLevel, or Versions. + RequestIDs []string +} + +// AppLog represents a single application-level log. +type AppLog struct { + Time time.Time + Level int + Message string +} + +// Record contains all the information for a single web request. +type Record struct { + AppID string + ModuleID string + VersionID string + RequestID []byte + IP string + Nickname string + AppEngineRelease string + + // The time when this request started. + StartTime time.Time + + // The time when this request finished. + EndTime time.Time + + // Opaque cursor into the result stream. + Offset []byte + + // The time required to process the request. + Latency time.Duration + MCycles int64 + Method string + Resource string + HTTPVersion string + Status int32 + + // The size of the request sent back to the client, in bytes. + ResponseSize int64 + Referrer string + UserAgent string + URLMapEntry string + Combined string + Host string + + // The estimated cost of this request, in dollars. + Cost float64 + TaskQueueName string + TaskName string + WasLoadingRequest bool + PendingTime time.Duration + Finished bool + AppLogs []AppLog + + // Mostly-unique identifier for the instance that handled the request if available. + InstanceID string +} + +// Result represents the result of a query. +type Result struct { + logs []*Record + context context.Context + request *pb.LogReadRequest + resultsSeen bool + err error +} + +// Next returns the next log record, +func (qr *Result) Next() (*Record, error) { + if qr.err != nil { + return nil, qr.err + } + if len(qr.logs) > 0 { + lr := qr.logs[0] + qr.logs = qr.logs[1:] + return lr, nil + } + + if qr.request.Offset == nil && qr.resultsSeen { + return nil, Done + } + + if err := qr.run(); err != nil { + // Errors here may be retried, so don't store the error. + return nil, err + } + + return qr.Next() +} + +// Done is returned when a query iteration has completed. +var Done = errors.New("log: query has no more results") + +// protoToAppLogs takes as input an array of pointers to LogLines, the internal +// Protocol Buffer representation of a single application-level log, +// and converts it to an array of AppLogs, the external representation +// of an application-level log. +func protoToAppLogs(logLines []*pb.LogLine) []AppLog { + appLogs := make([]AppLog, len(logLines)) + + for i, line := range logLines { + appLogs[i] = AppLog{ + Time: time.Unix(0, *line.Time*1e3), + Level: int(*line.Level), + Message: *line.LogMessage, + } + } + + return appLogs +} + +// protoToRecord converts a RequestLog, the internal Protocol Buffer +// representation of a single request-level log, to a Record, its +// corresponding external representation. +func protoToRecord(rl *pb.RequestLog) *Record { + offset, err := proto.Marshal(rl.Offset) + if err != nil { + offset = nil + } + return &Record{ + AppID: *rl.AppId, + ModuleID: rl.GetModuleId(), + VersionID: *rl.VersionId, + RequestID: rl.RequestId, + Offset: offset, + IP: *rl.Ip, + Nickname: rl.GetNickname(), + AppEngineRelease: string(rl.GetAppEngineRelease()), + StartTime: time.Unix(0, *rl.StartTime*1e3), + EndTime: time.Unix(0, *rl.EndTime*1e3), + Latency: time.Duration(*rl.Latency) * time.Microsecond, + MCycles: *rl.Mcycles, + Method: *rl.Method, + Resource: *rl.Resource, + HTTPVersion: *rl.HttpVersion, + Status: *rl.Status, + ResponseSize: *rl.ResponseSize, + Referrer: rl.GetReferrer(), + UserAgent: rl.GetUserAgent(), + URLMapEntry: *rl.UrlMapEntry, + Combined: *rl.Combined, + Host: rl.GetHost(), + Cost: rl.GetCost(), + TaskQueueName: rl.GetTaskQueueName(), + TaskName: rl.GetTaskName(), + WasLoadingRequest: rl.GetWasLoadingRequest(), + PendingTime: time.Duration(rl.GetPendingTime()) * time.Microsecond, + Finished: rl.GetFinished(), + AppLogs: protoToAppLogs(rl.Line), + InstanceID: string(rl.GetCloneKey()), + } +} + +// Run starts a query for log records, which contain request and application +// level log information. +func (params *Query) Run(c context.Context) *Result { + req, err := makeRequest(params, internal.FullyQualifiedAppID(c), appengine.VersionID(c)) + return &Result{ + context: c, + request: req, + err: err, + } +} + +func makeRequest(params *Query, appID, versionID string) (*pb.LogReadRequest, error) { + req := &pb.LogReadRequest{} + req.AppId = &appID + if !params.StartTime.IsZero() { + req.StartTime = proto.Int64(params.StartTime.UnixNano() / 1e3) + } + if !params.EndTime.IsZero() { + req.EndTime = proto.Int64(params.EndTime.UnixNano() / 1e3) + } + if len(params.Offset) > 0 { + var offset pb.LogOffset + if err := proto.Unmarshal(params.Offset, &offset); err != nil { + return nil, fmt.Errorf("bad Offset: %v", err) + } + req.Offset = &offset + } + if params.Incomplete { + req.IncludeIncomplete = ¶ms.Incomplete + } + if params.AppLogs { + req.IncludeAppLogs = ¶ms.AppLogs + } + if params.ApplyMinLevel { + req.MinimumLogLevel = proto.Int32(int32(params.MinLevel)) + } + if params.Versions == nil { + // If no versions were specified, default to the default module at + // the major version being used by this module. + if i := strings.Index(versionID, "."); i >= 0 { + versionID = versionID[:i] + } + req.VersionId = []string{versionID} + } else { + req.ModuleVersion = make([]*pb.LogModuleVersion, 0, len(params.Versions)) + for _, v := range params.Versions { + var m *string + if i := strings.Index(v, ":"); i >= 0 { + m, v = proto.String(v[:i]), v[i+1:] + } + req.ModuleVersion = append(req.ModuleVersion, &pb.LogModuleVersion{ + ModuleId: m, + VersionId: proto.String(v), + }) + } + } + if params.RequestIDs != nil { + ids := make([][]byte, len(params.RequestIDs)) + for i, v := range params.RequestIDs { + ids[i] = []byte(v) + } + req.RequestId = ids + } + + return req, nil +} + +// run takes the query Result produced by a call to Run and updates it with +// more Records. The updated Result contains a new set of logs as well as an +// offset to where more logs can be found. We also convert the items in the +// response from their internal representations to external versions of the +// same structs. +func (r *Result) run() error { + res := &pb.LogReadResponse{} + if err := internal.Call(r.context, "logservice", "Read", r.request, res); err != nil { + return err + } + + r.logs = make([]*Record, len(res.Log)) + r.request.Offset = res.Offset + r.resultsSeen = true + + for i, log := range res.Log { + r.logs[i] = protoToRecord(log) + } + + return nil +} + +func init() { + internal.RegisterErrorCodeMap("logservice", pb.LogServiceError_ErrorCode_name) +} diff --git a/vendor/google.golang.org/appengine/log/log_test.go b/vendor/google.golang.org/appengine/log/log_test.go new file mode 100644 index 000000000..726468e23 --- /dev/null +++ b/vendor/google.golang.org/appengine/log/log_test.go @@ -0,0 +1,112 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package log + +import ( + "reflect" + "testing" + "time" + + "github.com/golang/protobuf/proto" + + pb "google.golang.org/appengine/internal/log" +) + +func TestQueryToRequest(t *testing.T) { + testCases := []struct { + desc string + query *Query + want *pb.LogReadRequest + }{ + { + desc: "Empty", + query: &Query{}, + want: &pb.LogReadRequest{ + AppId: proto.String("s~fake"), + VersionId: []string{"v12"}, + }, + }, + { + desc: "Versions", + query: &Query{ + Versions: []string{"alpha", "backend:beta"}, + }, + want: &pb.LogReadRequest{ + AppId: proto.String("s~fake"), + ModuleVersion: []*pb.LogModuleVersion{ + { + VersionId: proto.String("alpha"), + }, { + ModuleId: proto.String("backend"), + VersionId: proto.String("beta"), + }, + }, + }, + }, + } + + for _, tt := range testCases { + req, err := makeRequest(tt.query, "s~fake", "v12") + + if err != nil { + t.Errorf("%s: got err %v, want nil", tt.desc, err) + continue + } + if !proto.Equal(req, tt.want) { + t.Errorf("%s request:\ngot %v\nwant %v", tt.desc, req, tt.want) + } + } +} + +func TestProtoToRecord(t *testing.T) { + // We deliberately leave ModuleId and other optional fields unset. + p := &pb.RequestLog{ + AppId: proto.String("s~fake"), + VersionId: proto.String("1"), + RequestId: []byte("deadbeef"), + Ip: proto.String("127.0.0.1"), + StartTime: proto.Int64(431044244000000), + EndTime: proto.Int64(431044724000000), + Latency: proto.Int64(480000000), + Mcycles: proto.Int64(7), + Method: proto.String("GET"), + Resource: proto.String("/app"), + HttpVersion: proto.String("1.1"), + Status: proto.Int32(418), + ResponseSize: proto.Int64(1337), + UrlMapEntry: proto.String("_go_app"), + Combined: proto.String("apache log"), + } + // Sanity check that all required fields are set. + if _, err := proto.Marshal(p); err != nil { + t.Fatalf("proto.Marshal: %v", err) + } + want := &Record{ + AppID: "s~fake", + ModuleID: "default", + VersionID: "1", + RequestID: []byte("deadbeef"), + IP: "127.0.0.1", + StartTime: time.Date(1983, 8, 29, 22, 30, 44, 0, time.UTC), + EndTime: time.Date(1983, 8, 29, 22, 38, 44, 0, time.UTC), + Latency: 8 * time.Minute, + MCycles: 7, + Method: "GET", + Resource: "/app", + HTTPVersion: "1.1", + Status: 418, + ResponseSize: 1337, + URLMapEntry: "_go_app", + Combined: "apache log", + Finished: true, + AppLogs: []AppLog{}, + } + got := protoToRecord(p) + // Coerce locations to UTC since otherwise they will be in local. + got.StartTime, got.EndTime = got.StartTime.UTC(), got.EndTime.UTC() + if !reflect.DeepEqual(got, want) { + t.Errorf("protoToRecord:\ngot: %v\nwant: %v", got, want) + } +} diff --git a/vendor/google.golang.org/appengine/mail/mail.go b/vendor/google.golang.org/appengine/mail/mail.go new file mode 100644 index 000000000..1ce1e8706 --- /dev/null +++ b/vendor/google.golang.org/appengine/mail/mail.go @@ -0,0 +1,123 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package mail provides the means of sending email from an +App Engine application. + +Example: + msg := &mail.Message{ + Sender: "romeo@montague.com", + To: []string{"Juliet "}, + Subject: "See you tonight", + Body: "Don't forget our plans. Hark, 'til later.", + } + if err := mail.Send(c, msg); err != nil { + log.Errorf(c, "Alas, my user, the email failed to sendeth: %v", err) + } +*/ +package mail // import "google.golang.org/appengine/mail" + +import ( + "net/mail" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + bpb "google.golang.org/appengine/internal/base" + pb "google.golang.org/appengine/internal/mail" +) + +// A Message represents an email message. +// Addresses may be of any form permitted by RFC 822. +type Message struct { + // Sender must be set, and must be either an application admin + // or the currently signed-in user. + Sender string + ReplyTo string // may be empty + + // At least one of these slices must have a non-zero length, + // except when calling SendToAdmins. + To, Cc, Bcc []string + + Subject string + + // At least one of Body or HTMLBody must be non-empty. + Body string + HTMLBody string + + Attachments []Attachment + + // Extra mail headers. + // See https://cloud.google.com/appengine/docs/standard/go/mail/ + // for permissible headers. + Headers mail.Header +} + +// An Attachment represents an email attachment. +type Attachment struct { + // Name must be set to a valid file name. + Name string + Data []byte + ContentID string +} + +// Send sends an email message. +func Send(c context.Context, msg *Message) error { + return send(c, "Send", msg) +} + +// SendToAdmins sends an email message to the application's administrators. +func SendToAdmins(c context.Context, msg *Message) error { + return send(c, "SendToAdmins", msg) +} + +func send(c context.Context, method string, msg *Message) error { + req := &pb.MailMessage{ + Sender: &msg.Sender, + To: msg.To, + Cc: msg.Cc, + Bcc: msg.Bcc, + Subject: &msg.Subject, + } + if msg.ReplyTo != "" { + req.ReplyTo = &msg.ReplyTo + } + if msg.Body != "" { + req.TextBody = &msg.Body + } + if msg.HTMLBody != "" { + req.HtmlBody = &msg.HTMLBody + } + if len(msg.Attachments) > 0 { + req.Attachment = make([]*pb.MailAttachment, len(msg.Attachments)) + for i, att := range msg.Attachments { + req.Attachment[i] = &pb.MailAttachment{ + FileName: proto.String(att.Name), + Data: att.Data, + } + if att.ContentID != "" { + req.Attachment[i].ContentID = proto.String(att.ContentID) + } + } + } + for key, vs := range msg.Headers { + for _, v := range vs { + req.Header = append(req.Header, &pb.MailHeader{ + Name: proto.String(key), + Value: proto.String(v), + }) + } + } + res := &bpb.VoidProto{} + if err := internal.Call(c, "mail", method, req, res); err != nil { + return err + } + return nil +} + +func init() { + internal.RegisterErrorCodeMap("mail", pb.MailServiceError_ErrorCode_name) +} diff --git a/vendor/google.golang.org/appengine/mail/mail_test.go b/vendor/google.golang.org/appengine/mail/mail_test.go new file mode 100644 index 000000000..7502c5973 --- /dev/null +++ b/vendor/google.golang.org/appengine/mail/mail_test.go @@ -0,0 +1,65 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package mail + +import ( + "testing" + + "github.com/golang/protobuf/proto" + + "google.golang.org/appengine/internal/aetesting" + basepb "google.golang.org/appengine/internal/base" + pb "google.golang.org/appengine/internal/mail" +) + +func TestMessageConstruction(t *testing.T) { + var got *pb.MailMessage + c := aetesting.FakeSingleContext(t, "mail", "Send", func(in *pb.MailMessage, out *basepb.VoidProto) error { + got = in + return nil + }) + + msg := &Message{ + Sender: "dsymonds@example.com", + To: []string{"nigeltao@example.com"}, + Body: "Hey, lunch time?", + Attachments: []Attachment{ + // Regression test for a prod bug. The address of a range variable was used when + // constructing the outgoing proto, so multiple attachments used the same name. + { + Name: "att1.txt", + Data: []byte("data1"), + ContentID: "", + }, + { + Name: "att2.txt", + Data: []byte("data2"), + }, + }, + } + if err := Send(c, msg); err != nil { + t.Fatalf("Send: %v", err) + } + want := &pb.MailMessage{ + Sender: proto.String("dsymonds@example.com"), + To: []string{"nigeltao@example.com"}, + Subject: proto.String(""), + TextBody: proto.String("Hey, lunch time?"), + Attachment: []*pb.MailAttachment{ + { + FileName: proto.String("att1.txt"), + Data: []byte("data1"), + ContentID: proto.String(""), + }, + { + FileName: proto.String("att2.txt"), + Data: []byte("data2"), + }, + }, + } + if !proto.Equal(got, want) { + t.Errorf("Bad proto for %+v\n got %v\nwant %v", msg, got, want) + } +} diff --git a/vendor/google.golang.org/appengine/memcache/memcache.go b/vendor/google.golang.org/appengine/memcache/memcache.go new file mode 100644 index 000000000..d8eed4be7 --- /dev/null +++ b/vendor/google.golang.org/appengine/memcache/memcache.go @@ -0,0 +1,526 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package memcache provides a client for App Engine's distributed in-memory +// key-value store for small chunks of arbitrary data. +// +// The fundamental operations get and set items, keyed by a string. +// +// item0, err := memcache.Get(c, "key") +// if err != nil && err != memcache.ErrCacheMiss { +// return err +// } +// if err == nil { +// fmt.Fprintf(w, "memcache hit: Key=%q Val=[% x]\n", item0.Key, item0.Value) +// } else { +// fmt.Fprintf(w, "memcache miss\n") +// } +// +// and +// +// item1 := &memcache.Item{ +// Key: "foo", +// Value: []byte("bar"), +// } +// if err := memcache.Set(c, item1); err != nil { +// return err +// } +package memcache // import "google.golang.org/appengine/memcache" + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "errors" + "time" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/memcache" +) + +var ( + // ErrCacheMiss means that an operation failed + // because the item wasn't present. + ErrCacheMiss = errors.New("memcache: cache miss") + // ErrCASConflict means that a CompareAndSwap call failed due to the + // cached value being modified between the Get and the CompareAndSwap. + // If the cached value was simply evicted rather than replaced, + // ErrNotStored will be returned instead. + ErrCASConflict = errors.New("memcache: compare-and-swap conflict") + // ErrNoStats means that no statistics were available. + ErrNoStats = errors.New("memcache: no statistics available") + // ErrNotStored means that a conditional write operation (i.e. Add or + // CompareAndSwap) failed because the condition was not satisfied. + ErrNotStored = errors.New("memcache: item not stored") + // ErrServerError means that a server error occurred. + ErrServerError = errors.New("memcache: server error") +) + +// Item is the unit of memcache gets and sets. +type Item struct { + // Key is the Item's key (250 bytes maximum). + Key string + // Value is the Item's value. + Value []byte + // Object is the Item's value for use with a Codec. + Object interface{} + // Flags are server-opaque flags whose semantics are entirely up to the + // App Engine app. + Flags uint32 + // Expiration is the maximum duration that the item will stay + // in the cache. + // The zero value means the Item has no expiration time. + // Subsecond precision is ignored. + // This is not set when getting items. + Expiration time.Duration + // casID is a client-opaque value used for compare-and-swap operations. + // Zero means that compare-and-swap is not used. + casID uint64 +} + +const ( + secondsIn30Years = 60 * 60 * 24 * 365 * 30 // from memcache server code + thirtyYears = time.Duration(secondsIn30Years) * time.Second +) + +// protoToItem converts a protocol buffer item to a Go struct. +func protoToItem(p *pb.MemcacheGetResponse_Item) *Item { + return &Item{ + Key: string(p.Key), + Value: p.Value, + Flags: p.GetFlags(), + casID: p.GetCasId(), + } +} + +// If err is an appengine.MultiError, return its first element. Otherwise, return err. +func singleError(err error) error { + if me, ok := err.(appengine.MultiError); ok { + return me[0] + } + return err +} + +// Get gets the item for the given key. ErrCacheMiss is returned for a memcache +// cache miss. The key must be at most 250 bytes in length. +func Get(c context.Context, key string) (*Item, error) { + m, err := GetMulti(c, []string{key}) + if err != nil { + return nil, err + } + if _, ok := m[key]; !ok { + return nil, ErrCacheMiss + } + return m[key], nil +} + +// GetMulti is a batch version of Get. The returned map from keys to items may +// have fewer elements than the input slice, due to memcache cache misses. +// Each key must be at most 250 bytes in length. +func GetMulti(c context.Context, key []string) (map[string]*Item, error) { + if len(key) == 0 { + return nil, nil + } + keyAsBytes := make([][]byte, len(key)) + for i, k := range key { + keyAsBytes[i] = []byte(k) + } + req := &pb.MemcacheGetRequest{ + Key: keyAsBytes, + ForCas: proto.Bool(true), + } + res := &pb.MemcacheGetResponse{} + if err := internal.Call(c, "memcache", "Get", req, res); err != nil { + return nil, err + } + m := make(map[string]*Item, len(res.Item)) + for _, p := range res.Item { + t := protoToItem(p) + m[t.Key] = t + } + return m, nil +} + +// Delete deletes the item for the given key. +// ErrCacheMiss is returned if the specified item can not be found. +// The key must be at most 250 bytes in length. +func Delete(c context.Context, key string) error { + return singleError(DeleteMulti(c, []string{key})) +} + +// DeleteMulti is a batch version of Delete. +// If any keys cannot be found, an appengine.MultiError is returned. +// Each key must be at most 250 bytes in length. +func DeleteMulti(c context.Context, key []string) error { + if len(key) == 0 { + return nil + } + req := &pb.MemcacheDeleteRequest{ + Item: make([]*pb.MemcacheDeleteRequest_Item, len(key)), + } + for i, k := range key { + req.Item[i] = &pb.MemcacheDeleteRequest_Item{Key: []byte(k)} + } + res := &pb.MemcacheDeleteResponse{} + if err := internal.Call(c, "memcache", "Delete", req, res); err != nil { + return err + } + if len(res.DeleteStatus) != len(key) { + return ErrServerError + } + me, any := make(appengine.MultiError, len(key)), false + for i, s := range res.DeleteStatus { + switch s { + case pb.MemcacheDeleteResponse_DELETED: + // OK + case pb.MemcacheDeleteResponse_NOT_FOUND: + me[i] = ErrCacheMiss + any = true + default: + me[i] = ErrServerError + any = true + } + } + if any { + return me + } + return nil +} + +// Increment atomically increments the decimal value in the given key +// by delta and returns the new value. The value must fit in a uint64. +// Overflow wraps around, and underflow is capped to zero. The +// provided delta may be negative. If the key doesn't exist in +// memcache, the provided initial value is used to atomically +// populate it before the delta is applied. +// The key must be at most 250 bytes in length. +func Increment(c context.Context, key string, delta int64, initialValue uint64) (newValue uint64, err error) { + return incr(c, key, delta, &initialValue) +} + +// IncrementExisting works like Increment but assumes that the key +// already exists in memcache and doesn't take an initial value. +// IncrementExisting can save work if calculating the initial value is +// expensive. +// An error is returned if the specified item can not be found. +func IncrementExisting(c context.Context, key string, delta int64) (newValue uint64, err error) { + return incr(c, key, delta, nil) +} + +func incr(c context.Context, key string, delta int64, initialValue *uint64) (newValue uint64, err error) { + req := &pb.MemcacheIncrementRequest{ + Key: []byte(key), + InitialValue: initialValue, + } + if delta >= 0 { + req.Delta = proto.Uint64(uint64(delta)) + } else { + req.Delta = proto.Uint64(uint64(-delta)) + req.Direction = pb.MemcacheIncrementRequest_DECREMENT.Enum() + } + res := &pb.MemcacheIncrementResponse{} + err = internal.Call(c, "memcache", "Increment", req, res) + if err != nil { + return + } + if res.NewValue == nil { + return 0, ErrCacheMiss + } + return *res.NewValue, nil +} + +// set sets the given items using the given conflict resolution policy. +// appengine.MultiError may be returned. +func set(c context.Context, item []*Item, value [][]byte, policy pb.MemcacheSetRequest_SetPolicy) error { + if len(item) == 0 { + return nil + } + req := &pb.MemcacheSetRequest{ + Item: make([]*pb.MemcacheSetRequest_Item, len(item)), + } + for i, t := range item { + p := &pb.MemcacheSetRequest_Item{ + Key: []byte(t.Key), + } + if value == nil { + p.Value = t.Value + } else { + p.Value = value[i] + } + if t.Flags != 0 { + p.Flags = proto.Uint32(t.Flags) + } + if t.Expiration != 0 { + // In the .proto file, MemcacheSetRequest_Item uses a fixed32 (i.e. unsigned) + // for expiration time, while MemcacheGetRequest_Item uses int32 (i.e. signed). + // Throughout this .go file, we use int32. + // Also, in the proto, the expiration value is either a duration (in seconds) + // or an absolute Unix timestamp (in seconds), depending on whether the + // value is less than or greater than or equal to 30 years, respectively. + if t.Expiration < time.Second { + // Because an Expiration of 0 means no expiration, we take + // care here to translate an item with an expiration + // Duration between 0-1 seconds as immediately expiring + // (saying it expired a few seconds ago), rather than + // rounding it down to 0 and making it live forever. + p.ExpirationTime = proto.Uint32(uint32(time.Now().Unix()) - 5) + } else if t.Expiration >= thirtyYears { + p.ExpirationTime = proto.Uint32(uint32(time.Now().Unix()) + uint32(t.Expiration/time.Second)) + } else { + p.ExpirationTime = proto.Uint32(uint32(t.Expiration / time.Second)) + } + } + if t.casID != 0 { + p.CasId = proto.Uint64(t.casID) + p.ForCas = proto.Bool(true) + } + p.SetPolicy = policy.Enum() + req.Item[i] = p + } + res := &pb.MemcacheSetResponse{} + if err := internal.Call(c, "memcache", "Set", req, res); err != nil { + return err + } + if len(res.SetStatus) != len(item) { + return ErrServerError + } + me, any := make(appengine.MultiError, len(item)), false + for i, st := range res.SetStatus { + var err error + switch st { + case pb.MemcacheSetResponse_STORED: + // OK + case pb.MemcacheSetResponse_NOT_STORED: + err = ErrNotStored + case pb.MemcacheSetResponse_EXISTS: + err = ErrCASConflict + default: + err = ErrServerError + } + if err != nil { + me[i] = err + any = true + } + } + if any { + return me + } + return nil +} + +// Set writes the given item, unconditionally. +func Set(c context.Context, item *Item) error { + return singleError(set(c, []*Item{item}, nil, pb.MemcacheSetRequest_SET)) +} + +// SetMulti is a batch version of Set. +// appengine.MultiError may be returned. +func SetMulti(c context.Context, item []*Item) error { + return set(c, item, nil, pb.MemcacheSetRequest_SET) +} + +// Add writes the given item, if no value already exists for its key. +// ErrNotStored is returned if that condition is not met. +func Add(c context.Context, item *Item) error { + return singleError(set(c, []*Item{item}, nil, pb.MemcacheSetRequest_ADD)) +} + +// AddMulti is a batch version of Add. +// appengine.MultiError may be returned. +func AddMulti(c context.Context, item []*Item) error { + return set(c, item, nil, pb.MemcacheSetRequest_ADD) +} + +// CompareAndSwap writes the given item that was previously returned by Get, +// if the value was neither modified or evicted between the Get and the +// CompareAndSwap calls. The item's Key should not change between calls but +// all other item fields may differ. +// ErrCASConflict is returned if the value was modified in between the calls. +// ErrNotStored is returned if the value was evicted in between the calls. +func CompareAndSwap(c context.Context, item *Item) error { + return singleError(set(c, []*Item{item}, nil, pb.MemcacheSetRequest_CAS)) +} + +// CompareAndSwapMulti is a batch version of CompareAndSwap. +// appengine.MultiError may be returned. +func CompareAndSwapMulti(c context.Context, item []*Item) error { + return set(c, item, nil, pb.MemcacheSetRequest_CAS) +} + +// Codec represents a symmetric pair of functions that implement a codec. +// Items stored into or retrieved from memcache using a Codec have their +// values marshaled or unmarshaled. +// +// All the methods provided for Codec behave analogously to the package level +// function with same name. +type Codec struct { + Marshal func(interface{}) ([]byte, error) + Unmarshal func([]byte, interface{}) error +} + +// Get gets the item for the given key and decodes the obtained value into v. +// ErrCacheMiss is returned for a memcache cache miss. +// The key must be at most 250 bytes in length. +func (cd Codec) Get(c context.Context, key string, v interface{}) (*Item, error) { + i, err := Get(c, key) + if err != nil { + return nil, err + } + if err := cd.Unmarshal(i.Value, v); err != nil { + return nil, err + } + return i, nil +} + +func (cd Codec) set(c context.Context, items []*Item, policy pb.MemcacheSetRequest_SetPolicy) error { + var vs [][]byte + var me appengine.MultiError + for i, item := range items { + v, err := cd.Marshal(item.Object) + if err != nil { + if me == nil { + me = make(appengine.MultiError, len(items)) + } + me[i] = err + continue + } + if me == nil { + vs = append(vs, v) + } + } + if me != nil { + return me + } + + return set(c, items, vs, policy) +} + +// Set writes the given item, unconditionally. +func (cd Codec) Set(c context.Context, item *Item) error { + return singleError(cd.set(c, []*Item{item}, pb.MemcacheSetRequest_SET)) +} + +// SetMulti is a batch version of Set. +// appengine.MultiError may be returned. +func (cd Codec) SetMulti(c context.Context, items []*Item) error { + return cd.set(c, items, pb.MemcacheSetRequest_SET) +} + +// Add writes the given item, if no value already exists for its key. +// ErrNotStored is returned if that condition is not met. +func (cd Codec) Add(c context.Context, item *Item) error { + return singleError(cd.set(c, []*Item{item}, pb.MemcacheSetRequest_ADD)) +} + +// AddMulti is a batch version of Add. +// appengine.MultiError may be returned. +func (cd Codec) AddMulti(c context.Context, items []*Item) error { + return cd.set(c, items, pb.MemcacheSetRequest_ADD) +} + +// CompareAndSwap writes the given item that was previously returned by Get, +// if the value was neither modified or evicted between the Get and the +// CompareAndSwap calls. The item's Key should not change between calls but +// all other item fields may differ. +// ErrCASConflict is returned if the value was modified in between the calls. +// ErrNotStored is returned if the value was evicted in between the calls. +func (cd Codec) CompareAndSwap(c context.Context, item *Item) error { + return singleError(cd.set(c, []*Item{item}, pb.MemcacheSetRequest_CAS)) +} + +// CompareAndSwapMulti is a batch version of CompareAndSwap. +// appengine.MultiError may be returned. +func (cd Codec) CompareAndSwapMulti(c context.Context, items []*Item) error { + return cd.set(c, items, pb.MemcacheSetRequest_CAS) +} + +var ( + // Gob is a Codec that uses the gob package. + Gob = Codec{gobMarshal, gobUnmarshal} + // JSON is a Codec that uses the json package. + JSON = Codec{json.Marshal, json.Unmarshal} +) + +func gobMarshal(v interface{}) ([]byte, error) { + var buf bytes.Buffer + if err := gob.NewEncoder(&buf).Encode(v); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func gobUnmarshal(data []byte, v interface{}) error { + return gob.NewDecoder(bytes.NewBuffer(data)).Decode(v) +} + +// Statistics represents a set of statistics about the memcache cache. +// This may include items that have expired but have not yet been removed from the cache. +type Statistics struct { + Hits uint64 // Counter of cache hits + Misses uint64 // Counter of cache misses + ByteHits uint64 // Counter of bytes transferred for gets + + Items uint64 // Items currently in the cache + Bytes uint64 // Size of all items currently in the cache + + Oldest int64 // Age of access of the oldest item, in seconds +} + +// Stats retrieves the current memcache statistics. +func Stats(c context.Context) (*Statistics, error) { + req := &pb.MemcacheStatsRequest{} + res := &pb.MemcacheStatsResponse{} + if err := internal.Call(c, "memcache", "Stats", req, res); err != nil { + return nil, err + } + if res.Stats == nil { + return nil, ErrNoStats + } + return &Statistics{ + Hits: *res.Stats.Hits, + Misses: *res.Stats.Misses, + ByteHits: *res.Stats.ByteHits, + Items: *res.Stats.Items, + Bytes: *res.Stats.Bytes, + Oldest: int64(*res.Stats.OldestItemAge), + }, nil +} + +// Flush flushes all items from memcache. +func Flush(c context.Context) error { + req := &pb.MemcacheFlushRequest{} + res := &pb.MemcacheFlushResponse{} + return internal.Call(c, "memcache", "FlushAll", req, res) +} + +func namespaceMod(m proto.Message, namespace string) { + switch m := m.(type) { + case *pb.MemcacheDeleteRequest: + if m.NameSpace == nil { + m.NameSpace = &namespace + } + case *pb.MemcacheGetRequest: + if m.NameSpace == nil { + m.NameSpace = &namespace + } + case *pb.MemcacheIncrementRequest: + if m.NameSpace == nil { + m.NameSpace = &namespace + } + case *pb.MemcacheSetRequest: + if m.NameSpace == nil { + m.NameSpace = &namespace + } + // MemcacheFlushRequest, MemcacheStatsRequest do not apply namespace. + } +} + +func init() { + internal.RegisterErrorCodeMap("memcache", pb.MemcacheServiceError_ErrorCode_name) + internal.NamespaceMods["memcache"] = namespaceMod +} diff --git a/vendor/google.golang.org/appengine/memcache/memcache_test.go b/vendor/google.golang.org/appengine/memcache/memcache_test.go new file mode 100644 index 000000000..1dc7da471 --- /dev/null +++ b/vendor/google.golang.org/appengine/memcache/memcache_test.go @@ -0,0 +1,263 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package memcache + +import ( + "fmt" + "testing" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal/aetesting" + pb "google.golang.org/appengine/internal/memcache" +) + +var errRPC = fmt.Errorf("RPC error") + +func TestGetRequest(t *testing.T) { + serviceCalled := false + apiKey := "lyric" + + c := aetesting.FakeSingleContext(t, "memcache", "Get", func(req *pb.MemcacheGetRequest, _ *pb.MemcacheGetResponse) error { + // Test request. + if n := len(req.Key); n != 1 { + t.Errorf("got %d want 1", n) + return nil + } + if k := string(req.Key[0]); k != apiKey { + t.Errorf("got %q want %q", k, apiKey) + } + + serviceCalled = true + return nil + }) + + // Test the "forward" path from the API call parameters to the + // protobuf request object. (The "backward" path from the + // protobuf response object to the API call response, + // including the error response, are handled in the next few + // tests). + Get(c, apiKey) + if !serviceCalled { + t.Error("Service was not called as expected") + } +} + +func TestGetResponseHit(t *testing.T) { + key := "lyric" + value := "Where the buffalo roam" + + c := aetesting.FakeSingleContext(t, "memcache", "Get", func(_ *pb.MemcacheGetRequest, res *pb.MemcacheGetResponse) error { + res.Item = []*pb.MemcacheGetResponse_Item{ + {Key: []byte(key), Value: []byte(value)}, + } + return nil + }) + apiItem, err := Get(c, key) + if apiItem == nil || apiItem.Key != key || string(apiItem.Value) != value { + t.Errorf("got %q, %q want {%q,%q}, nil", apiItem, err, key, value) + } +} + +func TestGetResponseMiss(t *testing.T) { + c := aetesting.FakeSingleContext(t, "memcache", "Get", func(_ *pb.MemcacheGetRequest, res *pb.MemcacheGetResponse) error { + // don't fill in any of the response + return nil + }) + _, err := Get(c, "something") + if err != ErrCacheMiss { + t.Errorf("got %v want ErrCacheMiss", err) + } +} + +func TestGetResponseRPCError(t *testing.T) { + c := aetesting.FakeSingleContext(t, "memcache", "Get", func(_ *pb.MemcacheGetRequest, res *pb.MemcacheGetResponse) error { + return errRPC + }) + + if _, err := Get(c, "something"); err != errRPC { + t.Errorf("got %v want errRPC", err) + } +} + +func TestAddRequest(t *testing.T) { + var apiItem = &Item{ + Key: "lyric", + Value: []byte("Oh, give me a home"), + } + + serviceCalled := false + + c := aetesting.FakeSingleContext(t, "memcache", "Set", func(req *pb.MemcacheSetRequest, _ *pb.MemcacheSetResponse) error { + // Test request. + pbItem := req.Item[0] + if k := string(pbItem.Key); k != apiItem.Key { + t.Errorf("got %q want %q", k, apiItem.Key) + } + if v := string(apiItem.Value); v != string(pbItem.Value) { + t.Errorf("got %q want %q", v, string(pbItem.Value)) + } + if p := *pbItem.SetPolicy; p != pb.MemcacheSetRequest_ADD { + t.Errorf("got %v want %v", p, pb.MemcacheSetRequest_ADD) + } + + serviceCalled = true + return nil + }) + + Add(c, apiItem) + if !serviceCalled { + t.Error("Service was not called as expected") + } +} + +func TestAddResponseStored(t *testing.T) { + c := aetesting.FakeSingleContext(t, "memcache", "Set", func(_ *pb.MemcacheSetRequest, res *pb.MemcacheSetResponse) error { + res.SetStatus = []pb.MemcacheSetResponse_SetStatusCode{pb.MemcacheSetResponse_STORED} + return nil + }) + + if err := Add(c, &Item{}); err != nil { + t.Errorf("got %v want nil", err) + } +} + +func TestAddResponseNotStored(t *testing.T) { + c := aetesting.FakeSingleContext(t, "memcache", "Set", func(_ *pb.MemcacheSetRequest, res *pb.MemcacheSetResponse) error { + res.SetStatus = []pb.MemcacheSetResponse_SetStatusCode{pb.MemcacheSetResponse_NOT_STORED} + return nil + }) + + if err := Add(c, &Item{}); err != ErrNotStored { + t.Errorf("got %v want ErrNotStored", err) + } +} + +func TestAddResponseError(t *testing.T) { + c := aetesting.FakeSingleContext(t, "memcache", "Set", func(_ *pb.MemcacheSetRequest, res *pb.MemcacheSetResponse) error { + res.SetStatus = []pb.MemcacheSetResponse_SetStatusCode{pb.MemcacheSetResponse_ERROR} + return nil + }) + + if err := Add(c, &Item{}); err != ErrServerError { + t.Errorf("got %v want ErrServerError", err) + } +} + +func TestAddResponseRPCError(t *testing.T) { + c := aetesting.FakeSingleContext(t, "memcache", "Set", func(_ *pb.MemcacheSetRequest, res *pb.MemcacheSetResponse) error { + return errRPC + }) + + if err := Add(c, &Item{}); err != errRPC { + t.Errorf("got %v want errRPC", err) + } +} + +func TestSetRequest(t *testing.T) { + var apiItem = &Item{ + Key: "lyric", + Value: []byte("Where the buffalo roam"), + } + + serviceCalled := false + + c := aetesting.FakeSingleContext(t, "memcache", "Set", func(req *pb.MemcacheSetRequest, _ *pb.MemcacheSetResponse) error { + // Test request. + if n := len(req.Item); n != 1 { + t.Errorf("got %d want 1", n) + return nil + } + pbItem := req.Item[0] + if k := string(pbItem.Key); k != apiItem.Key { + t.Errorf("got %q want %q", k, apiItem.Key) + } + if v := string(pbItem.Value); v != string(apiItem.Value) { + t.Errorf("got %q want %q", v, string(apiItem.Value)) + } + if p := *pbItem.SetPolicy; p != pb.MemcacheSetRequest_SET { + t.Errorf("got %v want %v", p, pb.MemcacheSetRequest_SET) + } + + serviceCalled = true + return nil + }) + + Set(c, apiItem) + if !serviceCalled { + t.Error("Service was not called as expected") + } +} + +func TestSetResponse(t *testing.T) { + c := aetesting.FakeSingleContext(t, "memcache", "Set", func(_ *pb.MemcacheSetRequest, res *pb.MemcacheSetResponse) error { + res.SetStatus = []pb.MemcacheSetResponse_SetStatusCode{pb.MemcacheSetResponse_STORED} + return nil + }) + + if err := Set(c, &Item{}); err != nil { + t.Errorf("got %v want nil", err) + } +} + +func TestSetResponseError(t *testing.T) { + c := aetesting.FakeSingleContext(t, "memcache", "Set", func(_ *pb.MemcacheSetRequest, res *pb.MemcacheSetResponse) error { + res.SetStatus = []pb.MemcacheSetResponse_SetStatusCode{pb.MemcacheSetResponse_ERROR} + return nil + }) + + if err := Set(c, &Item{}); err != ErrServerError { + t.Errorf("got %v want ErrServerError", err) + } +} + +func TestNamespaceResetting(t *testing.T) { + namec := make(chan *string, 1) + c0 := aetesting.FakeSingleContext(t, "memcache", "Get", func(req *pb.MemcacheGetRequest, res *pb.MemcacheGetResponse) error { + namec <- req.NameSpace + return errRPC + }) + + // Check that wrapping c0 in a namespace twice works correctly. + c1, err := appengine.Namespace(c0, "A") + if err != nil { + t.Fatalf("appengine.Namespace: %v", err) + } + c2, err := appengine.Namespace(c1, "") // should act as the original context + if err != nil { + t.Fatalf("appengine.Namespace: %v", err) + } + + Get(c0, "key") + if ns := <-namec; ns != nil { + t.Errorf(`Get with c0: ns = %q, want nil`, *ns) + } + + Get(c1, "key") + if ns := <-namec; ns == nil { + t.Error(`Get with c1: ns = nil, want "A"`) + } else if *ns != "A" { + t.Errorf(`Get with c1: ns = %q, want "A"`, *ns) + } + + Get(c2, "key") + if ns := <-namec; ns != nil { + t.Errorf(`Get with c2: ns = %q, want nil`, *ns) + } +} + +func TestGetMultiEmpty(t *testing.T) { + serviceCalled := false + c := aetesting.FakeSingleContext(t, "memcache", "Get", func(req *pb.MemcacheGetRequest, _ *pb.MemcacheGetResponse) error { + serviceCalled = true + return nil + }) + + // Test that the Memcache service is not called when + // GetMulti is passed an empty slice of keys. + GetMulti(c, []string{}) + if serviceCalled { + t.Error("Service was called but should not have been") + } +} diff --git a/vendor/google.golang.org/appengine/module/module.go b/vendor/google.golang.org/appengine/module/module.go new file mode 100644 index 000000000..88e6629ac --- /dev/null +++ b/vendor/google.golang.org/appengine/module/module.go @@ -0,0 +1,113 @@ +// Copyright 2013 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package module provides functions for interacting with modules. + +The appengine package contains functions that report the identity of the app, +including the module name. +*/ +package module // import "google.golang.org/appengine/module" + +import ( + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/modules" +) + +// List returns the names of modules belonging to this application. +func List(c context.Context) ([]string, error) { + req := &pb.GetModulesRequest{} + res := &pb.GetModulesResponse{} + err := internal.Call(c, "modules", "GetModules", req, res) + return res.Module, err +} + +// NumInstances returns the number of instances of the given module/version. +// If either argument is the empty string it means the default. +func NumInstances(c context.Context, module, version string) (int, error) { + req := &pb.GetNumInstancesRequest{} + if module != "" { + req.Module = &module + } + if version != "" { + req.Version = &version + } + res := &pb.GetNumInstancesResponse{} + + if err := internal.Call(c, "modules", "GetNumInstances", req, res); err != nil { + return 0, err + } + return int(*res.Instances), nil +} + +// SetNumInstances sets the number of instances of the given module.version to the +// specified value. If either module or version are the empty string it means the +// default. +func SetNumInstances(c context.Context, module, version string, instances int) error { + req := &pb.SetNumInstancesRequest{} + if module != "" { + req.Module = &module + } + if version != "" { + req.Version = &version + } + req.Instances = proto.Int64(int64(instances)) + res := &pb.SetNumInstancesResponse{} + return internal.Call(c, "modules", "SetNumInstances", req, res) +} + +// Versions returns the names of the versions that belong to the specified module. +// If module is the empty string, it means the default module. +func Versions(c context.Context, module string) ([]string, error) { + req := &pb.GetVersionsRequest{} + if module != "" { + req.Module = &module + } + res := &pb.GetVersionsResponse{} + err := internal.Call(c, "modules", "GetVersions", req, res) + return res.GetVersion(), err +} + +// DefaultVersion returns the default version of the specified module. +// If module is the empty string, it means the default module. +func DefaultVersion(c context.Context, module string) (string, error) { + req := &pb.GetDefaultVersionRequest{} + if module != "" { + req.Module = &module + } + res := &pb.GetDefaultVersionResponse{} + err := internal.Call(c, "modules", "GetDefaultVersion", req, res) + return res.GetVersion(), err +} + +// Start starts the specified version of the specified module. +// If either module or version are the empty string, it means the default. +func Start(c context.Context, module, version string) error { + req := &pb.StartModuleRequest{} + if module != "" { + req.Module = &module + } + if version != "" { + req.Version = &version + } + res := &pb.StartModuleResponse{} + return internal.Call(c, "modules", "StartModule", req, res) +} + +// Stop stops the specified version of the specified module. +// If either module or version are the empty string, it means the default. +func Stop(c context.Context, module, version string) error { + req := &pb.StopModuleRequest{} + if module != "" { + req.Module = &module + } + if version != "" { + req.Version = &version + } + res := &pb.StopModuleResponse{} + return internal.Call(c, "modules", "StopModule", req, res) +} diff --git a/vendor/google.golang.org/appengine/module/module_test.go b/vendor/google.golang.org/appengine/module/module_test.go new file mode 100644 index 000000000..73e8971dc --- /dev/null +++ b/vendor/google.golang.org/appengine/module/module_test.go @@ -0,0 +1,124 @@ +// Copyright 2013 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package module + +import ( + "reflect" + "testing" + + "github.com/golang/protobuf/proto" + + "google.golang.org/appengine/internal/aetesting" + pb "google.golang.org/appengine/internal/modules" +) + +const version = "test-version" +const module = "test-module" +const instances = 3 + +func TestList(t *testing.T) { + c := aetesting.FakeSingleContext(t, "modules", "GetModules", func(req *pb.GetModulesRequest, res *pb.GetModulesResponse) error { + res.Module = []string{"default", "mod1"} + return nil + }) + got, err := List(c) + if err != nil { + t.Fatalf("List: %v", err) + } + want := []string{"default", "mod1"} + if !reflect.DeepEqual(got, want) { + t.Errorf("List = %v, want %v", got, want) + } +} + +func TestSetNumInstances(t *testing.T) { + c := aetesting.FakeSingleContext(t, "modules", "SetNumInstances", func(req *pb.SetNumInstancesRequest, res *pb.SetNumInstancesResponse) error { + if *req.Module != module { + t.Errorf("Module = %v, want %v", req.Module, module) + } + if *req.Version != version { + t.Errorf("Version = %v, want %v", req.Version, version) + } + if *req.Instances != instances { + t.Errorf("Instances = %v, want %d", req.Instances, instances) + } + return nil + }) + err := SetNumInstances(c, module, version, instances) + if err != nil { + t.Fatalf("SetNumInstances: %v", err) + } +} + +func TestVersions(t *testing.T) { + c := aetesting.FakeSingleContext(t, "modules", "GetVersions", func(req *pb.GetVersionsRequest, res *pb.GetVersionsResponse) error { + if *req.Module != module { + t.Errorf("Module = %v, want %v", req.Module, module) + } + res.Version = []string{"v1", "v2", "v3"} + return nil + }) + got, err := Versions(c, module) + if err != nil { + t.Fatalf("Versions: %v", err) + } + want := []string{"v1", "v2", "v3"} + if !reflect.DeepEqual(got, want) { + t.Errorf("Versions = %v, want %v", got, want) + } +} + +func TestDefaultVersion(t *testing.T) { + c := aetesting.FakeSingleContext(t, "modules", "GetDefaultVersion", func(req *pb.GetDefaultVersionRequest, res *pb.GetDefaultVersionResponse) error { + if *req.Module != module { + t.Errorf("Module = %v, want %v", req.Module, module) + } + res.Version = proto.String(version) + return nil + }) + got, err := DefaultVersion(c, module) + if err != nil { + t.Fatalf("DefaultVersion: %v", err) + } + if got != version { + t.Errorf("Version = %v, want %v", got, version) + } +} + +func TestStart(t *testing.T) { + c := aetesting.FakeSingleContext(t, "modules", "StartModule", func(req *pb.StartModuleRequest, res *pb.StartModuleResponse) error { + if *req.Module != module { + t.Errorf("Module = %v, want %v", req.Module, module) + } + if *req.Version != version { + t.Errorf("Version = %v, want %v", req.Version, version) + } + return nil + }) + + err := Start(c, module, version) + if err != nil { + t.Fatalf("Start: %v", err) + } +} + +func TestStop(t *testing.T) { + c := aetesting.FakeSingleContext(t, "modules", "StopModule", func(req *pb.StopModuleRequest, res *pb.StopModuleResponse) error { + version := "test-version" + module := "test-module" + if *req.Module != module { + t.Errorf("Module = %v, want %v", req.Module, module) + } + if *req.Version != version { + t.Errorf("Version = %v, want %v", req.Version, version) + } + return nil + }) + + err := Stop(c, module, version) + if err != nil { + t.Fatalf("Stop: %v", err) + } +} diff --git a/vendor/google.golang.org/appengine/namespace.go b/vendor/google.golang.org/appengine/namespace.go new file mode 100644 index 000000000..21860ca08 --- /dev/null +++ b/vendor/google.golang.org/appengine/namespace.go @@ -0,0 +1,25 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package appengine + +import ( + "fmt" + "regexp" + + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" +) + +// Namespace returns a replacement context that operates within the given namespace. +func Namespace(c context.Context, namespace string) (context.Context, error) { + if !validNamespace.MatchString(namespace) { + return nil, fmt.Errorf("appengine: namespace %q does not match /%s/", namespace, validNamespace) + } + return internal.NamespacedContext(c, namespace), nil +} + +// validNamespace matches valid namespace names. +var validNamespace = regexp.MustCompile(`^[0-9A-Za-z._-]{0,100}$`) diff --git a/vendor/google.golang.org/appengine/namespace_test.go b/vendor/google.golang.org/appengine/namespace_test.go new file mode 100644 index 000000000..847f640bd --- /dev/null +++ b/vendor/google.golang.org/appengine/namespace_test.go @@ -0,0 +1,39 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package appengine + +import ( + "testing" + + "golang.org/x/net/context" +) + +func TestNamespaceValidity(t *testing.T) { + testCases := []struct { + namespace string + ok bool + }{ + // data from Python's namespace_manager_test.py + {"", true}, + {"__a.namespace.123__", true}, + {"-_A....NAMESPACE-_", true}, + {"-", true}, + {".", true}, + {".-", true}, + + {"?", false}, + {"+", false}, + {"!", false}, + {" ", false}, + } + for _, tc := range testCases { + _, err := Namespace(context.Background(), tc.namespace) + if err == nil && !tc.ok { + t.Errorf("Namespace %q should be rejected, but wasn't", tc.namespace) + } else if err != nil && tc.ok { + t.Errorf("Namespace %q should be accepted, but wasn't", tc.namespace) + } + } +} diff --git a/vendor/google.golang.org/appengine/remote_api/client.go b/vendor/google.golang.org/appengine/remote_api/client.go new file mode 100644 index 000000000..ce8aab562 --- /dev/null +++ b/vendor/google.golang.org/appengine/remote_api/client.go @@ -0,0 +1,194 @@ +// Copyright 2013 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package remote_api + +// This file provides the client for connecting remotely to a user's production +// application. + +import ( + "bytes" + "fmt" + "io/ioutil" + "log" + "math/rand" + "net/http" + "net/url" + "regexp" + "strconv" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/remote_api" +) + +// Client is a connection to the production APIs for an application. +type Client struct { + hc *http.Client + url string + appID string +} + +// NewClient returns a client for the given host. All communication will +// be performed over SSL unless the host is localhost. +func NewClient(host string, client *http.Client) (*Client, error) { + // Add an appcfg header to outgoing requests. + wrapClient := new(http.Client) + *wrapClient = *client + t := client.Transport + if t == nil { + t = http.DefaultTransport + } + wrapClient.Transport = &headerAddingRoundTripper{t} + + url := url.URL{ + Scheme: "https", + Host: host, + Path: "/_ah/remote_api", + } + if host == "localhost" || strings.HasPrefix(host, "localhost:") { + url.Scheme = "http" + } + u := url.String() + appID, err := getAppID(wrapClient, u) + if err != nil { + return nil, fmt.Errorf("unable to contact server: %v", err) + } + return &Client{ + hc: wrapClient, + url: u, + appID: appID, + }, nil +} + +// NewContext returns a copy of parent that will cause App Engine API +// calls to be sent to the client's remote host. +func (c *Client) NewContext(parent context.Context) context.Context { + ctx := internal.WithCallOverride(parent, c.call) + ctx = internal.WithLogOverride(ctx, c.logf) + ctx = internal.WithAppIDOverride(ctx, c.appID) + return ctx +} + +// NewRemoteContext returns a context that gives access to the production +// APIs for the application at the given host. All communication will be +// performed over SSL unless the host is localhost. +func NewRemoteContext(host string, client *http.Client) (context.Context, error) { + c, err := NewClient(host, client) + if err != nil { + return nil, err + } + return c.NewContext(context.Background()), nil +} + +var logLevels = map[int64]string{ + 0: "DEBUG", + 1: "INFO", + 2: "WARNING", + 3: "ERROR", + 4: "CRITICAL", +} + +func (c *Client) logf(level int64, format string, args ...interface{}) { + log.Printf(logLevels[level]+": "+format, args...) +} + +func (c *Client) call(ctx context.Context, service, method string, in, out proto.Message) error { + req, err := proto.Marshal(in) + if err != nil { + return fmt.Errorf("error marshalling request: %v", err) + } + + remReq := &pb.Request{ + ServiceName: proto.String(service), + Method: proto.String(method), + Request: req, + // NOTE(djd): RequestId is unused in the server. + } + + req, err = proto.Marshal(remReq) + if err != nil { + return fmt.Errorf("proto.Marshal: %v", err) + } + + // TODO(djd): Respect ctx.Deadline()? + resp, err := c.hc.Post(c.url, "application/octet-stream", bytes.NewReader(req)) + if err != nil { + return fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("bad response %d; body: %q", resp.StatusCode, body) + } + if err != nil { + return fmt.Errorf("failed reading response: %v", err) + } + remResp := &pb.Response{} + if err := proto.Unmarshal(body, remResp); err != nil { + return fmt.Errorf("error unmarshalling response: %v", err) + } + + if ae := remResp.GetApplicationError(); ae != nil { + return &internal.APIError{ + Code: ae.GetCode(), + Detail: ae.GetDetail(), + Service: service, + } + } + + if remResp.Response == nil { + return fmt.Errorf("unexpected response: %s", proto.MarshalTextString(remResp)) + } + + return proto.Unmarshal(remResp.Response, out) +} + +// This is a forgiving regexp designed to parse the app ID from YAML. +var appIDRE = regexp.MustCompile(`app_id["']?\s*:\s*['"]?([-a-z0-9.:~]+)`) + +func getAppID(client *http.Client, url string) (string, error) { + // Generate a pseudo-random token for handshaking. + token := strconv.Itoa(rand.New(rand.NewSource(time.Now().UnixNano())).Int()) + + resp, err := client.Get(fmt.Sprintf("%s?rtok=%s", url, token)) + if err != nil { + return "", err + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("bad response %d; body: %q", resp.StatusCode, body) + } + if err != nil { + return "", fmt.Errorf("failed reading response: %v", err) + } + + // Check the token is present in response. + if !bytes.Contains(body, []byte(token)) { + return "", fmt.Errorf("token not found: want %q; body %q", token, body) + } + + match := appIDRE.FindSubmatch(body) + if match == nil { + return "", fmt.Errorf("app ID not found: body %q", body) + } + + return string(match[1]), nil +} + +type headerAddingRoundTripper struct { + Wrapped http.RoundTripper +} + +func (t *headerAddingRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { + r.Header.Set("X-Appcfg-Api-Version", "1") + return t.Wrapped.RoundTrip(r) +} diff --git a/vendor/google.golang.org/appengine/remote_api/client_test.go b/vendor/google.golang.org/appengine/remote_api/client_test.go new file mode 100644 index 000000000..7f4bdcf3c --- /dev/null +++ b/vendor/google.golang.org/appengine/remote_api/client_test.go @@ -0,0 +1,43 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package remote_api + +import ( + "log" + "net/http" + "testing" + + "golang.org/x/net/context" + "google.golang.org/appengine/datastore" +) + +func TestAppIDRE(t *testing.T) { + appID := "s~my-appid-539" + tests := []string{ + "{rtok: 8306111115908860449, app_id: s~my-appid-539}\n", + "{rtok: 8306111115908860449, app_id: 's~my-appid-539'}\n", + `{rtok: 8306111115908860449, app_id: "s~my-appid-539"}`, + `{rtok: 8306111115908860449, "app_id":"s~my-appid-539"}`, + } + for _, v := range tests { + if g := appIDRE.FindStringSubmatch(v); g == nil || g[1] != appID { + t.Errorf("appIDRE.FindStringSubmatch(%s) got %q, want %q", v, g, appID) + } + } +} + +func ExampleClient() { + c, err := NewClient("example.appspot.com", http.DefaultClient) + if err != nil { + log.Fatal(err) + } + + ctx := context.Background() // or from a request + ctx = c.NewContext(ctx) + _, err = datastore.Put(ctx, datastore.NewIncompleteKey(ctx, "Foo", nil), struct{ Bar int }{42}) + if err != nil { + log.Fatal(err) + } +} diff --git a/vendor/google.golang.org/appengine/remote_api/remote_api.go b/vendor/google.golang.org/appengine/remote_api/remote_api.go new file mode 100644 index 000000000..3d2880d64 --- /dev/null +++ b/vendor/google.golang.org/appengine/remote_api/remote_api.go @@ -0,0 +1,152 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package remote_api implements the /_ah/remote_api endpoint. +This endpoint is used by offline tools such as the bulk loader. +*/ +package remote_api // import "google.golang.org/appengine/remote_api" + +import ( + "fmt" + "io" + "io/ioutil" + "net/http" + "strconv" + + "github.com/golang/protobuf/proto" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/remote_api" + "google.golang.org/appengine/log" + "google.golang.org/appengine/user" +) + +func init() { + http.HandleFunc("/_ah/remote_api", handle) +} + +func handle(w http.ResponseWriter, req *http.Request) { + c := appengine.NewContext(req) + + u := user.Current(c) + if u == nil { + u, _ = user.CurrentOAuth(c, + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/appengine.apis", + ) + } + + if !appengine.IsDevAppServer() && (u == nil || !u.Admin) { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.WriteHeader(http.StatusUnauthorized) + io.WriteString(w, "You must be logged in as an administrator to access this.\n") + return + } + if req.Header.Get("X-Appcfg-Api-Version") == "" { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.WriteHeader(http.StatusForbidden) + io.WriteString(w, "This request did not contain a necessary header.\n") + return + } + + if req.Method != "POST" { + // Response must be YAML. + rtok := req.FormValue("rtok") + if rtok == "" { + rtok = "0" + } + w.Header().Set("Content-Type", "text/yaml; charset=utf-8") + fmt.Fprintf(w, `{app_id: %q, rtok: %q}`, internal.FullyQualifiedAppID(c), rtok) + return + } + + defer req.Body.Close() + body, err := ioutil.ReadAll(req.Body) + if err != nil { + w.WriteHeader(http.StatusBadRequest) + log.Errorf(c, "Failed reading body: %v", err) + return + } + remReq := &pb.Request{} + if err := proto.Unmarshal(body, remReq); err != nil { + w.WriteHeader(http.StatusBadRequest) + log.Errorf(c, "Bad body: %v", err) + return + } + + service, method := *remReq.ServiceName, *remReq.Method + if !requestSupported(service, method) { + w.WriteHeader(http.StatusBadRequest) + log.Errorf(c, "Unsupported RPC /%s.%s", service, method) + return + } + + rawReq := &rawMessage{remReq.Request} + rawRes := &rawMessage{} + err = internal.Call(c, service, method, rawReq, rawRes) + + remRes := &pb.Response{} + if err == nil { + remRes.Response = rawRes.buf + } else if ae, ok := err.(*internal.APIError); ok { + remRes.ApplicationError = &pb.ApplicationError{ + Code: &ae.Code, + Detail: &ae.Detail, + } + } else { + // This shouldn't normally happen. + log.Errorf(c, "appengine/remote_api: Unexpected error of type %T: %v", err, err) + remRes.ApplicationError = &pb.ApplicationError{ + Code: proto.Int32(0), + Detail: proto.String(err.Error()), + } + } + out, err := proto.Marshal(remRes) + if err != nil { + // This should not be possible. + w.WriteHeader(500) + log.Errorf(c, "proto.Marshal: %v", err) + return + } + + log.Infof(c, "Spooling %d bytes of response to /%s.%s", len(out), service, method) + w.Header().Set("Content-Type", "application/octet-stream") + w.Header().Set("Content-Length", strconv.Itoa(len(out))) + w.Write(out) +} + +// rawMessage is a protocol buffer type that is already serialised. +// This allows the remote_api code here to handle messages +// without having to know the real type. +type rawMessage struct { + buf []byte +} + +func (rm *rawMessage) Marshal() ([]byte, error) { + return rm.buf, nil +} + +func (rm *rawMessage) Unmarshal(buf []byte) error { + rm.buf = make([]byte, len(buf)) + copy(rm.buf, buf) + return nil +} + +func requestSupported(service, method string) bool { + // This list of supported services is taken from SERVICE_PB_MAP in remote_api_services.py + switch service { + case "app_identity_service", "blobstore", "capability_service", "channel", "datastore_v3", + "datastore_v4", "file", "images", "logservice", "mail", "matcher", "memcache", "remote_datastore", + "remote_socket", "search", "modules", "system", "taskqueue", "urlfetch", "user", "xmpp": + return true + } + return false +} + +// Methods to satisfy proto.Message. +func (rm *rawMessage) Reset() { rm.buf = nil } +func (rm *rawMessage) String() string { return strconv.Quote(string(rm.buf)) } +func (*rawMessage) ProtoMessage() {} diff --git a/vendor/google.golang.org/appengine/runtime/runtime.go b/vendor/google.golang.org/appengine/runtime/runtime.go new file mode 100644 index 000000000..fa6c12b79 --- /dev/null +++ b/vendor/google.golang.org/appengine/runtime/runtime.go @@ -0,0 +1,148 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package runtime exposes information about the resource usage of the application. +It also provides a way to run code in a new background context of a module. + +This package does not work on App Engine "flexible environment". +*/ +package runtime // import "google.golang.org/appengine/runtime" + +import ( + "net/http" + + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/system" +) + +// Statistics represents the system's statistics. +type Statistics struct { + // CPU records the CPU consumed by this instance, in megacycles. + CPU struct { + Total float64 + Rate1M float64 // consumption rate over one minute + Rate10M float64 // consumption rate over ten minutes + } + // RAM records the memory used by the instance, in megabytes. + RAM struct { + Current float64 + Average1M float64 // average usage over one minute + Average10M float64 // average usage over ten minutes + } +} + +func Stats(c context.Context) (*Statistics, error) { + req := &pb.GetSystemStatsRequest{} + res := &pb.GetSystemStatsResponse{} + if err := internal.Call(c, "system", "GetSystemStats", req, res); err != nil { + return nil, err + } + s := &Statistics{} + if res.Cpu != nil { + s.CPU.Total = res.Cpu.GetTotal() + s.CPU.Rate1M = res.Cpu.GetRate1M() + s.CPU.Rate10M = res.Cpu.GetRate10M() + } + if res.Memory != nil { + s.RAM.Current = res.Memory.GetCurrent() + s.RAM.Average1M = res.Memory.GetAverage1M() + s.RAM.Average10M = res.Memory.GetAverage10M() + } + return s, nil +} + +/* +RunInBackground makes an API call that triggers an /_ah/background request. + +There are two independent code paths that need to make contact: +the RunInBackground code, and the /_ah/background handler. The matchmaker +loop arranges for the two paths to meet. The RunInBackground code passes +a send to the matchmaker, the /_ah/background passes a recv to the matchmaker, +and the matchmaker hooks them up. +*/ + +func init() { + http.HandleFunc("/_ah/background", handleBackground) + + sc := make(chan send) + rc := make(chan recv) + sendc, recvc = sc, rc + go matchmaker(sc, rc) +} + +var ( + sendc chan<- send // RunInBackground sends to this + recvc chan<- recv // handleBackground sends to this +) + +type send struct { + id string + f func(context.Context) +} + +type recv struct { + id string + ch chan<- func(context.Context) +} + +func matchmaker(sendc <-chan send, recvc <-chan recv) { + // When one side of the match arrives before the other + // it is inserted in the corresponding map. + waitSend := make(map[string]send) + waitRecv := make(map[string]recv) + + for { + select { + case s := <-sendc: + if r, ok := waitRecv[s.id]; ok { + // meet! + delete(waitRecv, s.id) + r.ch <- s.f + } else { + // waiting for r + waitSend[s.id] = s + } + case r := <-recvc: + if s, ok := waitSend[r.id]; ok { + // meet! + delete(waitSend, r.id) + r.ch <- s.f + } else { + // waiting for s + waitRecv[r.id] = r + } + } + } +} + +var newContext = appengine.NewContext // for testing + +func handleBackground(w http.ResponseWriter, req *http.Request) { + id := req.Header.Get("X-AppEngine-BackgroundRequest") + + ch := make(chan func(context.Context)) + recvc <- recv{id, ch} + (<-ch)(newContext(req)) +} + +// RunInBackground runs f in a background goroutine in this process. +// f is provided a context that may outlast the context provided to RunInBackground. +// This is only valid to invoke from a service set to basic or manual scaling. +func RunInBackground(c context.Context, f func(c context.Context)) error { + req := &pb.StartBackgroundRequestRequest{} + res := &pb.StartBackgroundRequestResponse{} + if err := internal.Call(c, "system", "StartBackgroundRequest", req, res); err != nil { + return err + } + sendc <- send{res.GetRequestId(), f} + return nil +} + +func init() { + internal.RegisterErrorCodeMap("system", pb.SystemServiceError_ErrorCode_name) +} diff --git a/vendor/google.golang.org/appengine/runtime/runtime_test.go b/vendor/google.golang.org/appengine/runtime/runtime_test.go new file mode 100644 index 000000000..8f3a124d2 --- /dev/null +++ b/vendor/google.golang.org/appengine/runtime/runtime_test.go @@ -0,0 +1,101 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package runtime + +import ( + "fmt" + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal/aetesting" + pb "google.golang.org/appengine/internal/system" +) + +func TestRunInBackgroundSendFirst(t *testing.T) { testRunInBackground(t, true) } +func TestRunInBackgroundRecvFirst(t *testing.T) { testRunInBackground(t, false) } + +func testRunInBackground(t *testing.T, sendFirst bool) { + srv := httptest.NewServer(nil) + defer srv.Close() + + const id = "f00bar" + sendWait, recvWait := make(chan bool), make(chan bool) + sbr := make(chan bool) // strobed when system.StartBackgroundRequest has started + + calls := 0 + c := aetesting.FakeSingleContext(t, "system", "StartBackgroundRequest", func(req *pb.StartBackgroundRequestRequest, res *pb.StartBackgroundRequestResponse) error { + calls++ + if calls > 1 { + t.Errorf("Too many calls to system.StartBackgroundRequest") + } + sbr <- true + res.RequestId = proto.String(id) + <-sendWait + return nil + }) + + var c2 context.Context // a fake + newContext = func(*http.Request) context.Context { + return c2 + } + + var fRun int + f := func(c3 context.Context) { + fRun++ + if c3 != c2 { + t.Errorf("f got a different context than expected") + } + } + + ribErrc := make(chan error) + go func() { + ribErrc <- RunInBackground(c, f) + }() + + brErrc := make(chan error) + go func() { + <-sbr + req, err := http.NewRequest("GET", srv.URL+"/_ah/background", nil) + if err != nil { + brErrc <- fmt.Errorf("http.NewRequest: %v", err) + return + } + req.Header.Set("X-AppEngine-BackgroundRequest", id) + client := &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + }, + } + + <-recvWait + _, err = client.Do(req) + brErrc <- err + }() + + // Send and receive are both waiting at this point. + waits := [2]chan bool{sendWait, recvWait} + if !sendFirst { + waits[0], waits[1] = waits[1], waits[0] + } + waits[0] <- true + time.Sleep(100 * time.Millisecond) + waits[1] <- true + + if err := <-ribErrc; err != nil { + t.Fatalf("RunInBackground: %v", err) + } + if err := <-brErrc; err != nil { + t.Fatalf("background request: %v", err) + } + + if fRun != 1 { + t.Errorf("Got %d runs of f, want 1", fRun) + } +} diff --git a/vendor/google.golang.org/appengine/search/doc.go b/vendor/google.golang.org/appengine/search/doc.go new file mode 100644 index 000000000..5208f18f6 --- /dev/null +++ b/vendor/google.golang.org/appengine/search/doc.go @@ -0,0 +1,209 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package search provides a client for App Engine's search service. + + +Basic Operations + +Indexes contain documents. Each index is identified by its name: a +human-readable ASCII string. + +Within an index, documents are associated with an ID, which is also +a human-readable ASCII string. A document's contents are a mapping from +case-sensitive field names to values. Valid types for field values are: + - string, + - search.Atom, + - search.HTML, + - time.Time (stored with millisecond precision), + - float64 (value between -2,147,483,647 and 2,147,483,647 inclusive), + - appengine.GeoPoint. + +The Get and Put methods on an Index load and save a document. +A document's contents are typically represented by a struct pointer. + +Example code: + + type Doc struct { + Author string + Comment string + Creation time.Time + } + + index, err := search.Open("comments") + if err != nil { + return err + } + newID, err := index.Put(ctx, "", &Doc{ + Author: "gopher", + Comment: "the truth of the matter", + Creation: time.Now(), + }) + if err != nil { + return err + } + +A single document can be retrieved by its ID. Pass a destination struct +to Get to hold the resulting document. + + var doc Doc + err := index.Get(ctx, id, &doc) + if err != nil { + return err + } + + +Search and Listing Documents + +Indexes have two methods for retrieving multiple documents at once: Search and +List. + +Searching an index for a query will result in an iterator. As with an iterator +from package datastore, pass a destination struct to Next to decode the next +result. Next will return Done when the iterator is exhausted. + + for t := index.Search(ctx, "Comment:truth", nil); ; { + var doc Doc + id, err := t.Next(&doc) + if err == search.Done { + break + } + if err != nil { + return err + } + fmt.Fprintf(w, "%s -> %#v\n", id, doc) + } + +Search takes a string query to determine which documents to return. The query +can be simple, such as a single word to match, or complex. The query +language is described at +https://cloud.google.com/appengine/docs/standard/go/search/query_strings + +Search also takes an optional SearchOptions struct which gives much more +control over how results are calculated and returned. + +Call List to iterate over all documents in an index. + + for t := index.List(ctx, nil); ; { + var doc Doc + id, err := t.Next(&doc) + if err == search.Done { + break + } + if err != nil { + return err + } + fmt.Fprintf(w, "%s -> %#v\n", id, doc) + } + + +Fields and Facets + +A document's contents can be represented by a variety of types. These are +typically struct pointers, but they can also be represented by any type +implementing the FieldLoadSaver interface. The FieldLoadSaver allows metadata +to be set for the document with the DocumentMetadata type. Struct pointers are +more strongly typed and are easier to use; FieldLoadSavers are more flexible. + +A document's contents can be expressed in two ways: fields and facets. + +Fields are the most common way of providing content for documents. Fields can +store data in multiple types and can be matched in searches using query +strings. + +Facets provide a way to attach categorical information to a document. The only +valid types for facets are search.Atom and float64. Facets allow search +results to contain summaries of the categories matched in a search, and to +restrict searches to only match against specific categories. + +By default, for struct pointers, all of the struct fields are used as document +fields, and the field name used is the same as on the struct (and hence must +start with an upper case letter). Struct fields may have a +`search:"name,options"` tag. The name must start with a letter and be +composed only of word characters. A "-" tag name means that the field will be +ignored. If options is "facet" then the struct field will be used as a +document facet. If options is "" then the comma may be omitted. There are no +other recognized options. + +Example code: + + // A and B are renamed to a and b. + // A, C and I are facets. + // D's tag is equivalent to having no tag at all (E). + // F and G are ignored entirely by the search package. + // I has tag information for both the search and json packages. + type TaggedStruct struct { + A float64 `search:"a,facet"` + B float64 `search:"b"` + C float64 `search:",facet"` + D float64 `search:""` + E float64 + F float64 `search:"-"` + G float64 `search:"-,facet"` + I float64 `search:",facet" json:"i"` + } + + +The FieldLoadSaver Interface + +A document's contents can also be represented by any type that implements the +FieldLoadSaver interface. This type may be a struct pointer, but it +does not have to be. The search package will call Load when loading the +document's contents, and Save when saving them. In addition to a slice of +Fields, the Load and Save methods also use the DocumentMetadata type to +provide additional information about a document (such as its Rank, or set of +Facets). Possible uses for this interface include deriving non-stored fields, +verifying fields or setting specific languages for string and HTML fields. + +Example code: + + type CustomFieldsExample struct { + // Item's title and which language it is in. + Title string + Lang string + // Mass, in grams. + Mass int + } + + func (x *CustomFieldsExample) Load(fields []search.Field, meta *search.DocumentMetadata) error { + // Load the title field, failing if any other field is found. + for _, f := range fields { + if f.Name != "title" { + return fmt.Errorf("unknown field %q", f.Name) + } + s, ok := f.Value.(string) + if !ok { + return fmt.Errorf("unsupported type %T for field %q", f.Value, f.Name) + } + x.Title = s + x.Lang = f.Language + } + // Load the mass facet, failing if any other facet is found. + for _, f := range meta.Facets { + if f.Name != "mass" { + return fmt.Errorf("unknown facet %q", f.Name) + } + m, ok := f.Value.(float64) + if !ok { + return fmt.Errorf("unsupported type %T for facet %q", f.Value, f.Name) + } + x.Mass = int(m) + } + return nil + } + + func (x *CustomFieldsExample) Save() ([]search.Field, *search.DocumentMetadata, error) { + fields := []search.Field{ + {Name: "title", Value: x.Title, Language: x.Lang}, + } + meta := &search.DocumentMetadata{ + Facets: { + {Name: "mass", Value: float64(x.Mass)}, + }, + } + return fields, meta, nil + } +*/ +package search diff --git a/vendor/google.golang.org/appengine/search/field.go b/vendor/google.golang.org/appengine/search/field.go new file mode 100644 index 000000000..707c2d8c0 --- /dev/null +++ b/vendor/google.golang.org/appengine/search/field.go @@ -0,0 +1,82 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package search + +// Field is a name/value pair. A search index's document can be loaded and +// saved as a sequence of Fields. +type Field struct { + // Name is the field name. A valid field name matches /[A-Za-z][A-Za-z0-9_]*/. + Name string + // Value is the field value. The valid types are: + // - string, + // - search.Atom, + // - search.HTML, + // - time.Time (stored with millisecond precision), + // - float64, + // - GeoPoint. + Value interface{} + // Language is a two-letter ISO 639-1 code for the field's language, + // defaulting to "en" if nothing is specified. It may only be specified for + // fields of type string and search.HTML. + Language string + // Derived marks fields that were calculated as a result of a + // FieldExpression provided to Search. This field is ignored when saving a + // document. + Derived bool +} + +// Facet is a name/value pair which is used to add categorical information to a +// document. +type Facet struct { + // Name is the facet name. A valid facet name matches /[A-Za-z][A-Za-z0-9_]*/. + // A facet name cannot be longer than 500 characters. + Name string + // Value is the facet value. + // + // When being used in documents (for example, in + // DocumentMetadata.Facets), the valid types are: + // - search.Atom, + // - float64. + // + // When being used in SearchOptions.Refinements or being returned + // in FacetResult, the valid types are: + // - search.Atom, + // - search.Range. + Value interface{} +} + +// DocumentMetadata is a struct containing information describing a given document. +type DocumentMetadata struct { + // Rank is an integer specifying the order the document will be returned in + // search results. If zero, the rank will be set to the number of seconds since + // 2011-01-01 00:00:00 UTC when being Put into an index. + Rank int + // Facets is the set of facets for this document. + Facets []Facet +} + +// FieldLoadSaver can be converted from and to a slice of Fields +// with additional document metadata. +type FieldLoadSaver interface { + Load([]Field, *DocumentMetadata) error + Save() ([]Field, *DocumentMetadata, error) +} + +// FieldList converts a []Field to implement FieldLoadSaver. +type FieldList []Field + +// Load loads all of the provided fields into l. +// It does not first reset *l to an empty slice. +func (l *FieldList) Load(f []Field, _ *DocumentMetadata) error { + *l = append(*l, f...) + return nil +} + +// Save returns all of l's fields as a slice of Fields. +func (l *FieldList) Save() ([]Field, *DocumentMetadata, error) { + return *l, nil, nil +} + +var _ FieldLoadSaver = (*FieldList)(nil) diff --git a/vendor/google.golang.org/appengine/search/search.go b/vendor/google.golang.org/appengine/search/search.go new file mode 100644 index 000000000..35a567d62 --- /dev/null +++ b/vendor/google.golang.org/appengine/search/search.go @@ -0,0 +1,1189 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package search // import "google.golang.org/appengine/search" + +// TODO: let Put specify the document language: "en", "fr", etc. Also: order_id?? storage?? +// TODO: Index.GetAll (or Iterator.GetAll)? +// TODO: struct <-> protobuf tests. +// TODO: enforce Python's MIN_NUMBER_VALUE and MIN_DATE (which would disallow a zero +// time.Time)? _MAXIMUM_STRING_LENGTH? + +import ( + "errors" + "fmt" + "math" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/search" +) + +const maxDocumentsPerPutDelete = 200 + +var ( + // ErrInvalidDocumentType is returned when methods like Put, Get or Next + // are passed a dst or src argument of invalid type. + ErrInvalidDocumentType = errors.New("search: invalid document type") + + // ErrNoSuchDocument is returned when no document was found for a given ID. + ErrNoSuchDocument = errors.New("search: no such document") + + // ErrTooManyDocuments is returned when the user passes too many documents to + // PutMulti or DeleteMulti. + ErrTooManyDocuments = fmt.Errorf("search: too many documents given to put or delete (max is %d)", maxDocumentsPerPutDelete) +) + +// Atom is a document field whose contents are indexed as a single indivisible +// string. +type Atom string + +// HTML is a document field whose contents are indexed as HTML. Only text nodes +// are indexed: "foobar" will be treated as "foobar". +type HTML string + +// validIndexNameOrDocID is the Go equivalent of Python's +// _ValidateVisiblePrintableAsciiNotReserved. +func validIndexNameOrDocID(s string) bool { + if strings.HasPrefix(s, "!") { + return false + } + for _, c := range s { + if c < 0x21 || 0x7f <= c { + return false + } + } + return true +} + +var ( + fieldNameRE = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9_]*$`) + languageRE = regexp.MustCompile(`^[a-z]{2}$`) +) + +// validFieldName is the Go equivalent of Python's _CheckFieldName. It checks +// the validity of both field and facet names. +func validFieldName(s string) bool { + return len(s) <= 500 && fieldNameRE.MatchString(s) +} + +// validDocRank checks that the ranks is in the range [0, 2^31). +func validDocRank(r int) bool { + return 0 <= r && r <= (1<<31-1) +} + +// validLanguage checks that a language looks like ISO 639-1. +func validLanguage(s string) bool { + return languageRE.MatchString(s) +} + +// validFloat checks that f is in the range [-2147483647, 2147483647]. +func validFloat(f float64) bool { + return -(1<<31-1) <= f && f <= (1<<31-1) +} + +// Index is an index of documents. +type Index struct { + spec pb.IndexSpec +} + +// orderIDEpoch forms the basis for populating OrderId on documents. +var orderIDEpoch = time.Date(2011, 1, 1, 0, 0, 0, 0, time.UTC) + +// Open opens the index with the given name. The index is created if it does +// not already exist. +// +// The name is a human-readable ASCII string. It must contain no whitespace +// characters and not start with "!". +func Open(name string) (*Index, error) { + if !validIndexNameOrDocID(name) { + return nil, fmt.Errorf("search: invalid index name %q", name) + } + return &Index{ + spec: pb.IndexSpec{ + Name: &name, + }, + }, nil +} + +// Put saves src to the index. If id is empty, a new ID is allocated by the +// service and returned. If id is not empty, any existing index entry for that +// ID is replaced. +// +// The ID is a human-readable ASCII string. It must contain no whitespace +// characters and not start with "!". +// +// src must be a non-nil struct pointer or implement the FieldLoadSaver +// interface. +func (x *Index) Put(c context.Context, id string, src interface{}) (string, error) { + ids, err := x.PutMulti(c, []string{id}, []interface{}{src}) + if err != nil { + return "", err + } + return ids[0], nil +} + +// PutMulti is like Put, but is more efficient for adding multiple documents to +// the index at once. +// +// Up to 200 documents can be added at once. ErrTooManyDocuments is returned if +// you try to add more. +// +// ids can either be an empty slice (which means new IDs will be allocated for +// each of the documents added) or a slice the same size as srcs. +// +// The error may be an instance of appengine.MultiError, in which case it will +// be the same size as srcs and the individual errors inside will correspond +// with the items in srcs. +func (x *Index) PutMulti(c context.Context, ids []string, srcs []interface{}) ([]string, error) { + if len(ids) != 0 && len(srcs) != len(ids) { + return nil, fmt.Errorf("search: PutMulti expects ids and srcs slices of the same length") + } + if len(srcs) > maxDocumentsPerPutDelete { + return nil, ErrTooManyDocuments + } + + docs := make([]*pb.Document, len(srcs)) + for i, s := range srcs { + var err error + docs[i], err = saveDoc(s) + if err != nil { + return nil, err + } + + if len(ids) != 0 && ids[i] != "" { + if !validIndexNameOrDocID(ids[i]) { + return nil, fmt.Errorf("search: invalid ID %q", ids[i]) + } + docs[i].Id = proto.String(ids[i]) + } + } + + // spec is modified by Call when applying the current Namespace, so copy it to + // avoid retaining the namespace beyond the scope of the Call. + spec := x.spec + req := &pb.IndexDocumentRequest{ + Params: &pb.IndexDocumentParams{ + Document: docs, + IndexSpec: &spec, + }, + } + res := &pb.IndexDocumentResponse{} + if err := internal.Call(c, "search", "IndexDocument", req, res); err != nil { + return nil, err + } + multiErr, hasErr := make(appengine.MultiError, len(res.Status)), false + for i, s := range res.Status { + if s.GetCode() != pb.SearchServiceError_OK { + multiErr[i] = fmt.Errorf("search: %s: %s", s.GetCode(), s.GetErrorDetail()) + hasErr = true + } + } + if hasErr { + return res.DocId, multiErr + } + + if len(res.Status) != len(docs) || len(res.DocId) != len(docs) { + return nil, fmt.Errorf("search: internal error: wrong number of results (%d Statuses, %d DocIDs, expected %d)", + len(res.Status), len(res.DocId), len(docs)) + } + return res.DocId, nil +} + +// Get loads the document with the given ID into dst. +// +// The ID is a human-readable ASCII string. It must be non-empty, contain no +// whitespace characters and not start with "!". +// +// dst must be a non-nil struct pointer or implement the FieldLoadSaver +// interface. +// +// ErrFieldMismatch is returned when a field is to be loaded into a different +// type than the one it was stored from, or when a field is missing or +// unexported in the destination struct. ErrFieldMismatch is only returned if +// dst is a struct pointer. It is up to the callee to decide whether this error +// is fatal, recoverable, or ignorable. +func (x *Index) Get(c context.Context, id string, dst interface{}) error { + if id == "" || !validIndexNameOrDocID(id) { + return fmt.Errorf("search: invalid ID %q", id) + } + req := &pb.ListDocumentsRequest{ + Params: &pb.ListDocumentsParams{ + IndexSpec: &x.spec, + StartDocId: proto.String(id), + Limit: proto.Int32(1), + }, + } + res := &pb.ListDocumentsResponse{} + if err := internal.Call(c, "search", "ListDocuments", req, res); err != nil { + return err + } + if res.Status == nil || res.Status.GetCode() != pb.SearchServiceError_OK { + return fmt.Errorf("search: %s: %s", res.Status.GetCode(), res.Status.GetErrorDetail()) + } + if len(res.Document) != 1 || res.Document[0].GetId() != id { + return ErrNoSuchDocument + } + return loadDoc(dst, res.Document[0], nil) +} + +// Delete deletes a document from the index. +func (x *Index) Delete(c context.Context, id string) error { + return x.DeleteMulti(c, []string{id}) +} + +// DeleteMulti deletes multiple documents from the index. +// +// The returned error may be an instance of appengine.MultiError, in which case +// it will be the same size as srcs and the individual errors inside will +// correspond with the items in srcs. +func (x *Index) DeleteMulti(c context.Context, ids []string) error { + if len(ids) > maxDocumentsPerPutDelete { + return ErrTooManyDocuments + } + + req := &pb.DeleteDocumentRequest{ + Params: &pb.DeleteDocumentParams{ + DocId: ids, + IndexSpec: &x.spec, + }, + } + res := &pb.DeleteDocumentResponse{} + if err := internal.Call(c, "search", "DeleteDocument", req, res); err != nil { + return err + } + if len(res.Status) != len(ids) { + return fmt.Errorf("search: internal error: wrong number of results (%d, expected %d)", + len(res.Status), len(ids)) + } + multiErr, hasErr := make(appengine.MultiError, len(ids)), false + for i, s := range res.Status { + if s.GetCode() != pb.SearchServiceError_OK { + multiErr[i] = fmt.Errorf("search: %s: %s", s.GetCode(), s.GetErrorDetail()) + hasErr = true + } + } + if hasErr { + return multiErr + } + return nil +} + +// List lists all of the documents in an index. The documents are returned in +// increasing ID order. +func (x *Index) List(c context.Context, opts *ListOptions) *Iterator { + t := &Iterator{ + c: c, + index: x, + count: -1, + listInclusive: true, + more: moreList, + } + if opts != nil { + t.listStartID = opts.StartID + t.limit = opts.Limit + t.idsOnly = opts.IDsOnly + } + return t +} + +func moreList(t *Iterator) error { + req := &pb.ListDocumentsRequest{ + Params: &pb.ListDocumentsParams{ + IndexSpec: &t.index.spec, + }, + } + if t.listStartID != "" { + req.Params.StartDocId = &t.listStartID + req.Params.IncludeStartDoc = &t.listInclusive + } + if t.limit > 0 { + req.Params.Limit = proto.Int32(int32(t.limit)) + } + if t.idsOnly { + req.Params.KeysOnly = &t.idsOnly + } + + res := &pb.ListDocumentsResponse{} + if err := internal.Call(t.c, "search", "ListDocuments", req, res); err != nil { + return err + } + if res.Status == nil || res.Status.GetCode() != pb.SearchServiceError_OK { + return fmt.Errorf("search: %s: %s", res.Status.GetCode(), res.Status.GetErrorDetail()) + } + t.listRes = res.Document + t.listStartID, t.listInclusive, t.more = "", false, nil + if len(res.Document) != 0 && t.limit <= 0 { + if id := res.Document[len(res.Document)-1].GetId(); id != "" { + t.listStartID, t.more = id, moreList + } + } + return nil +} + +// ListOptions are the options for listing documents in an index. Passing a nil +// *ListOptions is equivalent to using the default values. +type ListOptions struct { + // StartID is the inclusive lower bound for the ID of the returned + // documents. The zero value means all documents will be returned. + StartID string + + // Limit is the maximum number of documents to return. The zero value + // indicates no limit. + Limit int + + // IDsOnly indicates that only document IDs should be returned for the list + // operation; no document fields are populated. + IDsOnly bool +} + +// Search searches the index for the given query. +func (x *Index) Search(c context.Context, query string, opts *SearchOptions) *Iterator { + t := &Iterator{ + c: c, + index: x, + searchQuery: query, + more: moreSearch, + } + if opts != nil { + if opts.Cursor != "" { + if opts.Offset != 0 { + return errIter("at most one of Cursor and Offset may be specified") + } + t.searchCursor = proto.String(string(opts.Cursor)) + } + t.limit = opts.Limit + t.fields = opts.Fields + t.idsOnly = opts.IDsOnly + t.sort = opts.Sort + t.exprs = opts.Expressions + t.refinements = opts.Refinements + t.facetOpts = opts.Facets + t.searchOffset = opts.Offset + t.countAccuracy = opts.CountAccuracy + } + return t +} + +func moreSearch(t *Iterator) error { + // We use per-result (rather than single/per-page) cursors since this + // lets us return a Cursor for every iterator document. The two cursor + // types are largely interchangeable: a page cursor is the same as the + // last per-result cursor in a given search response. + req := &pb.SearchRequest{ + Params: &pb.SearchParams{ + IndexSpec: &t.index.spec, + Query: &t.searchQuery, + Cursor: t.searchCursor, + CursorType: pb.SearchParams_PER_RESULT.Enum(), + FieldSpec: &pb.FieldSpec{ + Name: t.fields, + }, + }, + } + if t.limit > 0 { + req.Params.Limit = proto.Int32(int32(t.limit)) + } + if t.searchOffset > 0 { + req.Params.Offset = proto.Int32(int32(t.searchOffset)) + t.searchOffset = 0 + } + if t.countAccuracy > 0 { + req.Params.MatchedCountAccuracy = proto.Int32(int32(t.countAccuracy)) + } + if t.idsOnly { + req.Params.KeysOnly = &t.idsOnly + } + if t.sort != nil { + if err := sortToProto(t.sort, req.Params); err != nil { + return err + } + } + if t.refinements != nil { + if err := refinementsToProto(t.refinements, req.Params); err != nil { + return err + } + } + for _, e := range t.exprs { + req.Params.FieldSpec.Expression = append(req.Params.FieldSpec.Expression, &pb.FieldSpec_Expression{ + Name: proto.String(e.Name), + Expression: proto.String(e.Expr), + }) + } + for _, f := range t.facetOpts { + if err := f.setParams(req.Params); err != nil { + return fmt.Errorf("bad FacetSearchOption: %v", err) + } + } + // Don't repeat facet search. + t.facetOpts = nil + + res := &pb.SearchResponse{} + if err := internal.Call(t.c, "search", "Search", req, res); err != nil { + return err + } + if res.Status == nil || res.Status.GetCode() != pb.SearchServiceError_OK { + return fmt.Errorf("search: %s: %s", res.Status.GetCode(), res.Status.GetErrorDetail()) + } + t.searchRes = res.Result + if len(res.FacetResult) > 0 { + t.facetRes = res.FacetResult + } + t.count = int(*res.MatchedCount) + if t.limit > 0 { + t.more = nil + } else { + t.more = moreSearch + } + return nil +} + +// SearchOptions are the options for searching an index. Passing a nil +// *SearchOptions is equivalent to using the default values. +type SearchOptions struct { + // Limit is the maximum number of documents to return. The zero value + // indicates no limit. + Limit int + + // IDsOnly indicates that only document IDs should be returned for the search + // operation; no document fields are populated. + IDsOnly bool + + // Sort controls the ordering of search results. + Sort *SortOptions + + // Fields specifies which document fields to include in the results. If omitted, + // all document fields are returned. No more than 100 fields may be specified. + Fields []string + + // Expressions specifies additional computed fields to add to each returned + // document. + Expressions []FieldExpression + + // Facets controls what facet information is returned for these search results. + // If no options are specified, no facet results will be returned. + Facets []FacetSearchOption + + // Refinements filters the returned documents by requiring them to contain facets + // with specific values. Refinements are applied in conjunction for facets with + // different names, and in disjunction otherwise. + Refinements []Facet + + // Cursor causes the results to commence with the first document after + // the document associated with the cursor. + Cursor Cursor + + // Offset specifies the number of documents to skip over before returning results. + // When specified, Cursor must be nil. + Offset int + + // CountAccuracy specifies the maximum result count that can be expected to + // be accurate. If zero, the count accuracy defaults to 20. + CountAccuracy int +} + +// Cursor represents an iterator's position. +// +// The string value of a cursor is web-safe. It can be saved and restored +// for later use. +type Cursor string + +// FieldExpression defines a custom expression to evaluate for each result. +type FieldExpression struct { + // Name is the name to use for the computed field. + Name string + + // Expr is evaluated to provide a custom content snippet for each document. + // See https://cloud.google.com/appengine/docs/standard/go/search/options for + // the supported expression syntax. + Expr string +} + +// FacetSearchOption controls what facet information is returned in search results. +type FacetSearchOption interface { + setParams(*pb.SearchParams) error +} + +// AutoFacetDiscovery returns a FacetSearchOption which enables automatic facet +// discovery for the search. Automatic facet discovery looks for the facets +// which appear the most often in the aggregate in the matched documents. +// +// The maximum number of facets returned is controlled by facetLimit, and the +// maximum number of values per facet by facetLimit. A limit of zero indicates +// a default limit should be used. +func AutoFacetDiscovery(facetLimit, valueLimit int) FacetSearchOption { + return &autoFacetOpt{facetLimit, valueLimit} +} + +type autoFacetOpt struct { + facetLimit, valueLimit int +} + +const defaultAutoFacetLimit = 10 // As per python runtime search.py. + +func (o *autoFacetOpt) setParams(params *pb.SearchParams) error { + lim := int32(o.facetLimit) + if lim == 0 { + lim = defaultAutoFacetLimit + } + params.AutoDiscoverFacetCount = &lim + if o.valueLimit > 0 { + params.FacetAutoDetectParam = &pb.FacetAutoDetectParam{ + ValueLimit: proto.Int32(int32(o.valueLimit)), + } + } + return nil +} + +// FacetDiscovery returns a FacetSearchOption which selects a facet to be +// returned with the search results. By default, the most frequently +// occurring values for that facet will be returned. However, you can also +// specify a list of particular Atoms or specific Ranges to return. +func FacetDiscovery(name string, value ...interface{}) FacetSearchOption { + return &facetOpt{name, value} +} + +type facetOpt struct { + name string + values []interface{} +} + +func (o *facetOpt) setParams(params *pb.SearchParams) error { + req := &pb.FacetRequest{Name: &o.name} + params.IncludeFacet = append(params.IncludeFacet, req) + if len(o.values) == 0 { + return nil + } + vtype := reflect.TypeOf(o.values[0]) + reqParam := &pb.FacetRequestParam{} + for _, v := range o.values { + if reflect.TypeOf(v) != vtype { + return errors.New("values must all be Atom, or must all be Range") + } + switch v := v.(type) { + case Atom: + reqParam.ValueConstraint = append(reqParam.ValueConstraint, string(v)) + case Range: + rng, err := rangeToProto(v) + if err != nil { + return fmt.Errorf("invalid range: %v", err) + } + reqParam.Range = append(reqParam.Range, rng) + default: + return fmt.Errorf("unsupported value type %T", v) + } + } + req.Params = reqParam + return nil +} + +// FacetDocumentDepth returns a FacetSearchOption which controls the number of +// documents to be evaluated with preparing facet results. +func FacetDocumentDepth(depth int) FacetSearchOption { + return facetDepthOpt(depth) +} + +type facetDepthOpt int + +func (o facetDepthOpt) setParams(params *pb.SearchParams) error { + params.FacetDepth = proto.Int32(int32(o)) + return nil +} + +// FacetResult represents the number of times a particular facet and value +// appeared in the documents matching a search request. +type FacetResult struct { + Facet + + // Count is the number of times this specific facet and value appeared in the + // matching documents. + Count int +} + +// Range represents a numeric range with inclusive start and exclusive end. +// Start may be specified as math.Inf(-1) to indicate there is no minimum +// value, and End may similarly be specified as math.Inf(1); at least one of +// Start or End must be a finite number. +type Range struct { + Start, End float64 +} + +var ( + negInf = math.Inf(-1) + posInf = math.Inf(1) +) + +// AtLeast returns a Range matching any value greater than, or equal to, min. +func AtLeast(min float64) Range { + return Range{Start: min, End: posInf} +} + +// LessThan returns a Range matching any value less than max. +func LessThan(max float64) Range { + return Range{Start: negInf, End: max} +} + +// SortOptions control the ordering and scoring of search results. +type SortOptions struct { + // Expressions is a slice of expressions representing a multi-dimensional + // sort. + Expressions []SortExpression + + // Scorer, when specified, will cause the documents to be scored according to + // search term frequency. + Scorer Scorer + + // Limit is the maximum number of objects to score and/or sort. Limit cannot + // be more than 10,000. The zero value indicates a default limit. + Limit int +} + +// SortExpression defines a single dimension for sorting a document. +type SortExpression struct { + // Expr is evaluated to provide a sorting value for each document. + // See https://cloud.google.com/appengine/docs/standard/go/search/options for + // the supported expression syntax. + Expr string + + // Reverse causes the documents to be sorted in ascending order. + Reverse bool + + // The default value to use when no field is present or the expresion + // cannot be calculated for a document. For text sorts, Default must + // be of type string; for numeric sorts, float64. + Default interface{} +} + +// A Scorer defines how a document is scored. +type Scorer interface { + toProto(*pb.ScorerSpec) +} + +type enumScorer struct { + enum pb.ScorerSpec_Scorer +} + +func (e enumScorer) toProto(spec *pb.ScorerSpec) { + spec.Scorer = e.enum.Enum() +} + +var ( + // MatchScorer assigns a score based on term frequency in a document. + MatchScorer Scorer = enumScorer{pb.ScorerSpec_MATCH_SCORER} + + // RescoringMatchScorer assigns a score based on the quality of the query + // match. It is similar to a MatchScorer but uses a more complex scoring + // algorithm based on match term frequency and other factors like field type. + // Please be aware that this algorithm is continually refined and can change + // over time without notice. This means that the ordering of search results + // that use this scorer can also change without notice. + RescoringMatchScorer Scorer = enumScorer{pb.ScorerSpec_RESCORING_MATCH_SCORER} +) + +func sortToProto(sort *SortOptions, params *pb.SearchParams) error { + for _, e := range sort.Expressions { + spec := &pb.SortSpec{ + SortExpression: proto.String(e.Expr), + } + if e.Reverse { + spec.SortDescending = proto.Bool(false) + } + if e.Default != nil { + switch d := e.Default.(type) { + case float64: + spec.DefaultValueNumeric = &d + case string: + spec.DefaultValueText = &d + default: + return fmt.Errorf("search: invalid Default type %T for expression %q", d, e.Expr) + } + } + params.SortSpec = append(params.SortSpec, spec) + } + + spec := &pb.ScorerSpec{} + if sort.Limit > 0 { + spec.Limit = proto.Int32(int32(sort.Limit)) + params.ScorerSpec = spec + } + if sort.Scorer != nil { + sort.Scorer.toProto(spec) + params.ScorerSpec = spec + } + + return nil +} + +func refinementsToProto(refinements []Facet, params *pb.SearchParams) error { + for _, r := range refinements { + ref := &pb.FacetRefinement{ + Name: proto.String(r.Name), + } + switch v := r.Value.(type) { + case Atom: + ref.Value = proto.String(string(v)) + case Range: + rng, err := rangeToProto(v) + if err != nil { + return fmt.Errorf("search: refinement for facet %q: %v", r.Name, err) + } + // Unfortunately there are two identical messages for identify Facet ranges. + ref.Range = &pb.FacetRefinement_Range{Start: rng.Start, End: rng.End} + default: + return fmt.Errorf("search: unsupported refinement for facet %q of type %T", r.Name, v) + } + params.FacetRefinement = append(params.FacetRefinement, ref) + } + return nil +} + +func rangeToProto(r Range) (*pb.FacetRange, error) { + rng := &pb.FacetRange{} + if r.Start != negInf { + if !validFloat(r.Start) { + return nil, errors.New("invalid value for Start") + } + rng.Start = proto.String(strconv.FormatFloat(r.Start, 'e', -1, 64)) + } else if r.End == posInf { + return nil, errors.New("either Start or End must be finite") + } + if r.End != posInf { + if !validFloat(r.End) { + return nil, errors.New("invalid value for End") + } + rng.End = proto.String(strconv.FormatFloat(r.End, 'e', -1, 64)) + } + return rng, nil +} + +func protoToRange(rng *pb.FacetRefinement_Range) Range { + r := Range{Start: negInf, End: posInf} + if x, err := strconv.ParseFloat(rng.GetStart(), 64); err != nil { + r.Start = x + } + if x, err := strconv.ParseFloat(rng.GetEnd(), 64); err != nil { + r.End = x + } + return r +} + +// Iterator is the result of searching an index for a query or listing an +// index. +type Iterator struct { + c context.Context + index *Index + err error + + listRes []*pb.Document + listStartID string + listInclusive bool + + searchRes []*pb.SearchResult + facetRes []*pb.FacetResult + searchQuery string + searchCursor *string + searchOffset int + sort *SortOptions + + fields []string + exprs []FieldExpression + refinements []Facet + facetOpts []FacetSearchOption + + more func(*Iterator) error + + count int + countAccuracy int + limit int // items left to return; 0 for unlimited. + idsOnly bool +} + +// errIter returns an iterator that only returns the given error. +func errIter(err string) *Iterator { + return &Iterator{ + err: errors.New(err), + } +} + +// Done is returned when a query iteration has completed. +var Done = errors.New("search: query has no more results") + +// Count returns an approximation of the number of documents matched by the +// query. It is only valid to call for iterators returned by Search. +func (t *Iterator) Count() int { return t.count } + +// fetchMore retrieves more results, if there are no errors or pending results. +func (t *Iterator) fetchMore() { + if t.err == nil && len(t.listRes)+len(t.searchRes) == 0 && t.more != nil { + t.err = t.more(t) + } +} + +// Next returns the ID of the next result. When there are no more results, +// Done is returned as the error. +// +// dst must be a non-nil struct pointer, implement the FieldLoadSaver +// interface, or be a nil interface value. If a non-nil dst is provided, it +// will be filled with the indexed fields. dst is ignored if this iterator was +// created with an IDsOnly option. +func (t *Iterator) Next(dst interface{}) (string, error) { + t.fetchMore() + if t.err != nil { + return "", t.err + } + + var doc *pb.Document + var exprs []*pb.Field + switch { + case len(t.listRes) != 0: + doc = t.listRes[0] + t.listRes = t.listRes[1:] + case len(t.searchRes) != 0: + doc = t.searchRes[0].Document + exprs = t.searchRes[0].Expression + t.searchCursor = t.searchRes[0].Cursor + t.searchRes = t.searchRes[1:] + default: + return "", Done + } + if doc == nil { + return "", errors.New("search: internal error: no document returned") + } + if !t.idsOnly && dst != nil { + if err := loadDoc(dst, doc, exprs); err != nil { + return "", err + } + } + return doc.GetId(), nil +} + +// Cursor returns the cursor associated with the current document (that is, +// the document most recently returned by a call to Next). +// +// Passing this cursor in a future call to Search will cause those results +// to commence with the first document after the current document. +func (t *Iterator) Cursor() Cursor { + if t.searchCursor == nil { + return "" + } + return Cursor(*t.searchCursor) +} + +// Facets returns the facets found within the search results, if any facets +// were requested in the SearchOptions. +func (t *Iterator) Facets() ([][]FacetResult, error) { + t.fetchMore() + if t.err != nil && t.err != Done { + return nil, t.err + } + + var facets [][]FacetResult + for _, f := range t.facetRes { + fres := make([]FacetResult, 0, len(f.Value)) + for _, v := range f.Value { + ref := v.Refinement + facet := FacetResult{ + Facet: Facet{Name: ref.GetName()}, + Count: int(v.GetCount()), + } + if ref.Value != nil { + facet.Value = Atom(*ref.Value) + } else { + facet.Value = protoToRange(ref.Range) + } + fres = append(fres, facet) + } + facets = append(facets, fres) + } + return facets, nil +} + +// saveDoc converts from a struct pointer or +// FieldLoadSaver/FieldMetadataLoadSaver to the Document protobuf. +func saveDoc(src interface{}) (*pb.Document, error) { + var err error + var fields []Field + var meta *DocumentMetadata + switch x := src.(type) { + case FieldLoadSaver: + fields, meta, err = x.Save() + default: + fields, meta, err = saveStructWithMeta(src) + } + if err != nil { + return nil, err + } + + fieldsProto, err := fieldsToProto(fields) + if err != nil { + return nil, err + } + d := &pb.Document{ + Field: fieldsProto, + OrderId: proto.Int32(int32(time.Since(orderIDEpoch).Seconds())), + OrderIdSource: pb.Document_DEFAULTED.Enum(), + } + if meta != nil { + if meta.Rank != 0 { + if !validDocRank(meta.Rank) { + return nil, fmt.Errorf("search: invalid rank %d, must be [0, 2^31)", meta.Rank) + } + *d.OrderId = int32(meta.Rank) + d.OrderIdSource = pb.Document_SUPPLIED.Enum() + } + if len(meta.Facets) > 0 { + facets, err := facetsToProto(meta.Facets) + if err != nil { + return nil, err + } + d.Facet = facets + } + } + return d, nil +} + +func fieldsToProto(src []Field) ([]*pb.Field, error) { + // Maps to catch duplicate time or numeric fields. + timeFields, numericFields := make(map[string]bool), make(map[string]bool) + dst := make([]*pb.Field, 0, len(src)) + for _, f := range src { + if !validFieldName(f.Name) { + return nil, fmt.Errorf("search: invalid field name %q", f.Name) + } + fieldValue := &pb.FieldValue{} + switch x := f.Value.(type) { + case string: + fieldValue.Type = pb.FieldValue_TEXT.Enum() + fieldValue.StringValue = proto.String(x) + case Atom: + fieldValue.Type = pb.FieldValue_ATOM.Enum() + fieldValue.StringValue = proto.String(string(x)) + case HTML: + fieldValue.Type = pb.FieldValue_HTML.Enum() + fieldValue.StringValue = proto.String(string(x)) + case time.Time: + if timeFields[f.Name] { + return nil, fmt.Errorf("search: duplicate time field %q", f.Name) + } + timeFields[f.Name] = true + fieldValue.Type = pb.FieldValue_DATE.Enum() + fieldValue.StringValue = proto.String(strconv.FormatInt(x.UnixNano()/1e6, 10)) + case float64: + if numericFields[f.Name] { + return nil, fmt.Errorf("search: duplicate numeric field %q", f.Name) + } + if !validFloat(x) { + return nil, fmt.Errorf("search: numeric field %q with invalid value %f", f.Name, x) + } + numericFields[f.Name] = true + fieldValue.Type = pb.FieldValue_NUMBER.Enum() + fieldValue.StringValue = proto.String(strconv.FormatFloat(x, 'e', -1, 64)) + case appengine.GeoPoint: + if !x.Valid() { + return nil, fmt.Errorf( + "search: GeoPoint field %q with invalid value %v", + f.Name, x) + } + fieldValue.Type = pb.FieldValue_GEO.Enum() + fieldValue.Geo = &pb.FieldValue_Geo{ + Lat: proto.Float64(x.Lat), + Lng: proto.Float64(x.Lng), + } + default: + return nil, fmt.Errorf("search: unsupported field type: %v", reflect.TypeOf(f.Value)) + } + if f.Language != "" { + switch f.Value.(type) { + case string, HTML: + if !validLanguage(f.Language) { + return nil, fmt.Errorf("search: invalid language for field %q: %q", f.Name, f.Language) + } + fieldValue.Language = proto.String(f.Language) + default: + return nil, fmt.Errorf("search: setting language not supported for field %q of type %T", f.Name, f.Value) + } + } + if p := fieldValue.StringValue; p != nil && !utf8.ValidString(*p) { + return nil, fmt.Errorf("search: %q field is invalid UTF-8: %q", f.Name, *p) + } + dst = append(dst, &pb.Field{ + Name: proto.String(f.Name), + Value: fieldValue, + }) + } + return dst, nil +} + +func facetsToProto(src []Facet) ([]*pb.Facet, error) { + dst := make([]*pb.Facet, 0, len(src)) + for _, f := range src { + if !validFieldName(f.Name) { + return nil, fmt.Errorf("search: invalid facet name %q", f.Name) + } + facetValue := &pb.FacetValue{} + switch x := f.Value.(type) { + case Atom: + if !utf8.ValidString(string(x)) { + return nil, fmt.Errorf("search: %q facet is invalid UTF-8: %q", f.Name, x) + } + facetValue.Type = pb.FacetValue_ATOM.Enum() + facetValue.StringValue = proto.String(string(x)) + case float64: + if !validFloat(x) { + return nil, fmt.Errorf("search: numeric facet %q with invalid value %f", f.Name, x) + } + facetValue.Type = pb.FacetValue_NUMBER.Enum() + facetValue.StringValue = proto.String(strconv.FormatFloat(x, 'e', -1, 64)) + default: + return nil, fmt.Errorf("search: unsupported facet type: %v", reflect.TypeOf(f.Value)) + } + dst = append(dst, &pb.Facet{ + Name: proto.String(f.Name), + Value: facetValue, + }) + } + return dst, nil +} + +// loadDoc converts from protobufs to a struct pointer or +// FieldLoadSaver/FieldMetadataLoadSaver. The src param provides the document's +// stored fields and facets, and any document metadata. An additional slice of +// fields, exprs, may optionally be provided to contain any derived expressions +// requested by the developer. +func loadDoc(dst interface{}, src *pb.Document, exprs []*pb.Field) (err error) { + fields, err := protoToFields(src.Field) + if err != nil { + return err + } + facets, err := protoToFacets(src.Facet) + if err != nil { + return err + } + if len(exprs) > 0 { + exprFields, err := protoToFields(exprs) + if err != nil { + return err + } + // Mark each field as derived. + for i := range exprFields { + exprFields[i].Derived = true + } + fields = append(fields, exprFields...) + } + meta := &DocumentMetadata{ + Rank: int(src.GetOrderId()), + Facets: facets, + } + switch x := dst.(type) { + case FieldLoadSaver: + return x.Load(fields, meta) + default: + return loadStructWithMeta(dst, fields, meta) + } +} + +func protoToFields(fields []*pb.Field) ([]Field, error) { + dst := make([]Field, 0, len(fields)) + for _, field := range fields { + fieldValue := field.GetValue() + f := Field{ + Name: field.GetName(), + } + switch fieldValue.GetType() { + case pb.FieldValue_TEXT: + f.Value = fieldValue.GetStringValue() + f.Language = fieldValue.GetLanguage() + case pb.FieldValue_ATOM: + f.Value = Atom(fieldValue.GetStringValue()) + case pb.FieldValue_HTML: + f.Value = HTML(fieldValue.GetStringValue()) + f.Language = fieldValue.GetLanguage() + case pb.FieldValue_DATE: + sv := fieldValue.GetStringValue() + millis, err := strconv.ParseInt(sv, 10, 64) + if err != nil { + return nil, fmt.Errorf("search: internal error: bad time.Time encoding %q: %v", sv, err) + } + f.Value = time.Unix(0, millis*1e6) + case pb.FieldValue_NUMBER: + sv := fieldValue.GetStringValue() + x, err := strconv.ParseFloat(sv, 64) + if err != nil { + return nil, err + } + f.Value = x + case pb.FieldValue_GEO: + geoValue := fieldValue.GetGeo() + geoPoint := appengine.GeoPoint{geoValue.GetLat(), geoValue.GetLng()} + if !geoPoint.Valid() { + return nil, fmt.Errorf("search: internal error: invalid GeoPoint encoding: %v", geoPoint) + } + f.Value = geoPoint + default: + return nil, fmt.Errorf("search: internal error: unknown data type %s", fieldValue.GetType()) + } + dst = append(dst, f) + } + return dst, nil +} + +func protoToFacets(facets []*pb.Facet) ([]Facet, error) { + if len(facets) == 0 { + return nil, nil + } + dst := make([]Facet, 0, len(facets)) + for _, facet := range facets { + facetValue := facet.GetValue() + f := Facet{ + Name: facet.GetName(), + } + switch facetValue.GetType() { + case pb.FacetValue_ATOM: + f.Value = Atom(facetValue.GetStringValue()) + case pb.FacetValue_NUMBER: + sv := facetValue.GetStringValue() + x, err := strconv.ParseFloat(sv, 64) + if err != nil { + return nil, err + } + f.Value = x + default: + return nil, fmt.Errorf("search: internal error: unknown data type %s", facetValue.GetType()) + } + dst = append(dst, f) + } + return dst, nil +} + +func namespaceMod(m proto.Message, namespace string) { + set := func(s **string) { + if *s == nil { + *s = &namespace + } + } + switch m := m.(type) { + case *pb.IndexDocumentRequest: + set(&m.Params.IndexSpec.Namespace) + case *pb.ListDocumentsRequest: + set(&m.Params.IndexSpec.Namespace) + case *pb.DeleteDocumentRequest: + set(&m.Params.IndexSpec.Namespace) + case *pb.SearchRequest: + set(&m.Params.IndexSpec.Namespace) + } +} + +func init() { + internal.RegisterErrorCodeMap("search", pb.SearchServiceError_ErrorCode_name) + internal.NamespaceMods["search"] = namespaceMod +} diff --git a/vendor/google.golang.org/appengine/search/search_test.go b/vendor/google.golang.org/appengine/search/search_test.go new file mode 100644 index 000000000..0459cd749 --- /dev/null +++ b/vendor/google.golang.org/appengine/search/search_test.go @@ -0,0 +1,1270 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package search + +import ( + "errors" + "fmt" + "reflect" + "strings" + "testing" + "time" + + "github.com/golang/protobuf/proto" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal/aetesting" + pb "google.golang.org/appengine/internal/search" +) + +type TestDoc struct { + String string + Atom Atom + HTML HTML + Float float64 + Location appengine.GeoPoint + Time time.Time +} + +type FieldListWithMeta struct { + Fields FieldList + Meta *DocumentMetadata +} + +func (f *FieldListWithMeta) Load(fields []Field, meta *DocumentMetadata) error { + f.Meta = meta + return f.Fields.Load(fields, nil) +} + +func (f *FieldListWithMeta) Save() ([]Field, *DocumentMetadata, error) { + fields, _, err := f.Fields.Save() + return fields, f.Meta, err +} + +// Assert that FieldListWithMeta satisfies FieldLoadSaver +var _ FieldLoadSaver = &FieldListWithMeta{} + +var ( + float = 3.14159 + floatOut = "3.14159e+00" + latitude = 37.3894 + longitude = 122.0819 + testGeo = appengine.GeoPoint{latitude, longitude} + testString = "foobar" + testTime = time.Unix(1337324400, 0) + testTimeOut = "1337324400000" + searchMeta = &DocumentMetadata{ + Rank: 42, + } + searchDoc = TestDoc{ + String: testString, + Atom: Atom(testString), + HTML: HTML(testString), + Float: float, + Location: testGeo, + Time: testTime, + } + searchFields = FieldList{ + Field{Name: "String", Value: testString}, + Field{Name: "Atom", Value: Atom(testString)}, + Field{Name: "HTML", Value: HTML(testString)}, + Field{Name: "Float", Value: float}, + Field{Name: "Location", Value: testGeo}, + Field{Name: "Time", Value: testTime}, + } + // searchFieldsWithLang is a copy of the searchFields with the Language field + // set on text/HTML Fields. + searchFieldsWithLang = FieldList{} + protoFields = []*pb.Field{ + newStringValueField("String", testString, pb.FieldValue_TEXT), + newStringValueField("Atom", testString, pb.FieldValue_ATOM), + newStringValueField("HTML", testString, pb.FieldValue_HTML), + newStringValueField("Float", floatOut, pb.FieldValue_NUMBER), + { + Name: proto.String("Location"), + Value: &pb.FieldValue{ + Geo: &pb.FieldValue_Geo{ + Lat: proto.Float64(latitude), + Lng: proto.Float64(longitude), + }, + Type: pb.FieldValue_GEO.Enum(), + }, + }, + newStringValueField("Time", testTimeOut, pb.FieldValue_DATE), + } +) + +func init() { + for _, f := range searchFields { + if f.Name == "String" || f.Name == "HTML" { + f.Language = "en" + } + searchFieldsWithLang = append(searchFieldsWithLang, f) + } +} + +func newStringValueField(name, value string, valueType pb.FieldValue_ContentType) *pb.Field { + return &pb.Field{ + Name: proto.String(name), + Value: &pb.FieldValue{ + StringValue: proto.String(value), + Type: valueType.Enum(), + }, + } +} + +func newFacet(name, value string, valueType pb.FacetValue_ContentType) *pb.Facet { + return &pb.Facet{ + Name: proto.String(name), + Value: &pb.FacetValue{ + StringValue: proto.String(value), + Type: valueType.Enum(), + }, + } +} + +func TestValidIndexNameOrDocID(t *testing.T) { + testCases := []struct { + s string + want bool + }{ + {"", true}, + {"!", false}, + {"$", true}, + {"!bad", false}, + {"good!", true}, + {"alsoGood", true}, + {"has spaces", false}, + {"is_inva\xffid_UTF-8", false}, + {"is_non-ASCïI", false}, + {"underscores_are_ok", true}, + } + for _, tc := range testCases { + if got := validIndexNameOrDocID(tc.s); got != tc.want { + t.Errorf("%q: got %v, want %v", tc.s, got, tc.want) + } + } +} + +func TestLoadDoc(t *testing.T) { + got, want := TestDoc{}, searchDoc + if err := loadDoc(&got, &pb.Document{Field: protoFields}, nil); err != nil { + t.Fatalf("loadDoc: %v", err) + } + if got != want { + t.Errorf("loadDoc: got %v, wanted %v", got, want) + } +} + +func TestSaveDoc(t *testing.T) { + got, err := saveDoc(&searchDoc) + if err != nil { + t.Fatalf("saveDoc: %v", err) + } + want := protoFields + if !reflect.DeepEqual(got.Field, want) { + t.Errorf("\ngot %v\nwant %v", got, want) + } +} + +func TestSaveDocUsesDefaultedRankIfNotSpecified(t *testing.T) { + got, err := saveDoc(&searchDoc) + if err != nil { + t.Fatalf("saveDoc: %v", err) + } + orderIdSource := got.GetOrderIdSource() + if orderIdSource != pb.Document_DEFAULTED { + t.Errorf("OrderIdSource: got %v, wanted DEFAULTED", orderIdSource) + } +} + +func TestLoadFieldList(t *testing.T) { + var got FieldList + want := searchFieldsWithLang + if err := loadDoc(&got, &pb.Document{Field: protoFields}, nil); err != nil { + t.Fatalf("loadDoc: %v", err) + } + if !reflect.DeepEqual(got, want) { + t.Errorf("\ngot %v\nwant %v", got, want) + } +} + +func TestLangFields(t *testing.T) { + fl := &FieldList{ + {Name: "Foo", Value: "I am English", Language: "en"}, + {Name: "Bar", Value: "私は日本人だ", Language: "ja"}, + } + var got FieldList + doc, err := saveDoc(fl) + if err != nil { + t.Fatalf("saveDoc: %v", err) + } + if err := loadDoc(&got, doc, nil); err != nil { + t.Fatalf("loadDoc: %v", err) + } + if want := fl; !reflect.DeepEqual(&got, want) { + t.Errorf("got %v\nwant %v", got, want) + } +} + +func TestSaveFieldList(t *testing.T) { + got, err := saveDoc(&searchFields) + if err != nil { + t.Fatalf("saveDoc: %v", err) + } + want := protoFields + if !reflect.DeepEqual(got.Field, want) { + t.Errorf("\ngot %v\nwant %v", got, want) + } +} + +func TestLoadFieldAndExprList(t *testing.T) { + var got, want FieldList + for i, f := range searchFieldsWithLang { + f.Derived = (i >= 2) // First 2 elements are "fields", next are "expressions". + want = append(want, f) + } + doc, expr := &pb.Document{Field: protoFields[:2]}, protoFields[2:] + if err := loadDoc(&got, doc, expr); err != nil { + t.Fatalf("loadDoc: %v", err) + } + if !reflect.DeepEqual(got, want) { + t.Errorf("got %v\nwant %v", got, want) + } +} + +func TestLoadMeta(t *testing.T) { + var got FieldListWithMeta + want := FieldListWithMeta{ + Meta: searchMeta, + Fields: searchFieldsWithLang, + } + doc := &pb.Document{ + Field: protoFields, + OrderId: proto.Int32(42), + OrderIdSource: pb.Document_SUPPLIED.Enum(), + } + if err := loadDoc(&got, doc, nil); err != nil { + t.Fatalf("loadDoc: %v", err) + } + if !reflect.DeepEqual(got, want) { + t.Errorf("\ngot %v\nwant %v", got, want) + } +} + +func TestSaveMeta(t *testing.T) { + got, err := saveDoc(&FieldListWithMeta{ + Meta: searchMeta, + Fields: searchFields, + }) + if err != nil { + t.Fatalf("saveDoc: %v", err) + } + want := &pb.Document{ + Field: protoFields, + OrderId: proto.Int32(42), + OrderIdSource: pb.Document_SUPPLIED.Enum(), + } + if !proto.Equal(got, want) { + t.Errorf("\ngot %v\nwant %v", got, want) + } +} + +func TestSaveMetaWithDefaultedRank(t *testing.T) { + metaWithoutRank := &DocumentMetadata{ + Rank: 0, + } + got, err := saveDoc(&FieldListWithMeta{ + Meta: metaWithoutRank, + Fields: searchFields, + }) + if err != nil { + t.Fatalf("saveDoc: %v", err) + } + want := &pb.Document{ + Field: protoFields, + OrderId: got.OrderId, + OrderIdSource: pb.Document_DEFAULTED.Enum(), + } + if !proto.Equal(got, want) { + t.Errorf("\ngot %v\nwant %v", got, want) + } +} + +func TestSaveWithoutMetaUsesDefaultedRank(t *testing.T) { + got, err := saveDoc(&FieldListWithMeta{ + Fields: searchFields, + }) + if err != nil { + t.Fatalf("saveDoc: %v", err) + } + want := &pb.Document{ + Field: protoFields, + OrderId: got.OrderId, + OrderIdSource: pb.Document_DEFAULTED.Enum(), + } + if !proto.Equal(got, want) { + t.Errorf("\ngot %v\nwant %v", got, want) + } +} + +func TestLoadSaveWithStruct(t *testing.T) { + type gopher struct { + Name string + Info string `search:"about"` + Legs float64 `search:",facet"` + Fuzz Atom `search:"Fur,facet"` + } + + doc := gopher{"Gopher", "Likes slide rules.", 4, Atom("furry")} + pb := &pb.Document{ + Field: []*pb.Field{ + newStringValueField("Name", "Gopher", pb.FieldValue_TEXT), + newStringValueField("about", "Likes slide rules.", pb.FieldValue_TEXT), + }, + Facet: []*pb.Facet{ + newFacet("Legs", "4e+00", pb.FacetValue_NUMBER), + newFacet("Fur", "furry", pb.FacetValue_ATOM), + }, + } + + var gotDoc gopher + if err := loadDoc(&gotDoc, pb, nil); err != nil { + t.Fatalf("loadDoc: %v", err) + } + if !reflect.DeepEqual(gotDoc, doc) { + t.Errorf("loading doc\ngot %v\nwant %v", gotDoc, doc) + } + + gotPB, err := saveDoc(&doc) + if err != nil { + t.Fatalf("saveDoc: %v", err) + } + gotPB.OrderId = nil // Don't test: it's time dependent. + gotPB.OrderIdSource = nil // Don't test because it's contingent on OrderId. + if !proto.Equal(gotPB, pb) { + t.Errorf("saving doc\ngot %v\nwant %v", gotPB, pb) + } +} + +func TestValidFieldNames(t *testing.T) { + testCases := []struct { + name string + valid bool + }{ + {"Normal", true}, + {"Also_OK_123", true}, + {"Not so great", false}, + {"lower_case", true}, + {"Exclaim!", false}, + {"Hello세상아 안녕", false}, + {"", false}, + {"Hεllo", false}, + {strings.Repeat("A", 500), true}, + {strings.Repeat("A", 501), false}, + } + + for _, tc := range testCases { + _, err := saveDoc(&FieldList{ + Field{Name: tc.name, Value: "val"}, + }) + if err != nil && !strings.Contains(err.Error(), "invalid field name") { + t.Errorf("unexpected err %q for field name %q", err, tc.name) + } + if (err == nil) != tc.valid { + t.Errorf("field %q: expected valid %t, received err %v", tc.name, tc.valid, err) + } + } +} + +func TestValidLangs(t *testing.T) { + testCases := []struct { + field Field + valid bool + }{ + {Field{Name: "Foo", Value: "String", Language: ""}, true}, + {Field{Name: "Foo", Value: "String", Language: "en"}, true}, + {Field{Name: "Foo", Value: "String", Language: "aussie"}, false}, + {Field{Name: "Foo", Value: "String", Language: "12"}, false}, + {Field{Name: "Foo", Value: HTML("String"), Language: "en"}, true}, + {Field{Name: "Foo", Value: Atom("String"), Language: "en"}, false}, + {Field{Name: "Foo", Value: 42, Language: "en"}, false}, + } + + for _, tt := range testCases { + _, err := saveDoc(&FieldList{tt.field}) + if err == nil != tt.valid { + t.Errorf("Field %v, got error %v, wanted valid %t", tt.field, err, tt.valid) + } + } +} + +func TestDuplicateFields(t *testing.T) { + testCases := []struct { + desc string + fields FieldList + errMsg string // Non-empty if we expect an error + }{ + { + desc: "multi string", + fields: FieldList{{Name: "FieldA", Value: "val1"}, {Name: "FieldA", Value: "val2"}, {Name: "FieldA", Value: "val3"}}, + }, + { + desc: "multi atom", + fields: FieldList{{Name: "FieldA", Value: Atom("val1")}, {Name: "FieldA", Value: Atom("val2")}, {Name: "FieldA", Value: Atom("val3")}}, + }, + { + desc: "mixed", + fields: FieldList{{Name: "FieldA", Value: testString}, {Name: "FieldA", Value: testTime}, {Name: "FieldA", Value: float}}, + }, + { + desc: "multi time", + fields: FieldList{{Name: "FieldA", Value: testTime}, {Name: "FieldA", Value: testTime}}, + errMsg: `duplicate time field "FieldA"`, + }, + { + desc: "multi num", + fields: FieldList{{Name: "FieldA", Value: float}, {Name: "FieldA", Value: float}}, + errMsg: `duplicate numeric field "FieldA"`, + }, + } + for _, tc := range testCases { + _, err := saveDoc(&tc.fields) + if (err == nil) != (tc.errMsg == "") || (err != nil && !strings.Contains(err.Error(), tc.errMsg)) { + t.Errorf("%s: got err %v, wanted %q", tc.desc, err, tc.errMsg) + } + } +} + +func TestLoadErrFieldMismatch(t *testing.T) { + testCases := []struct { + desc string + dst interface{} + src []*pb.Field + err error + }{ + { + desc: "missing", + dst: &struct{ One string }{}, + src: []*pb.Field{newStringValueField("Two", "woop!", pb.FieldValue_TEXT)}, + err: &ErrFieldMismatch{ + FieldName: "Two", + Reason: "no such struct field", + }, + }, + { + desc: "wrong type", + dst: &struct{ Num float64 }{}, + src: []*pb.Field{newStringValueField("Num", "woop!", pb.FieldValue_TEXT)}, + err: &ErrFieldMismatch{ + FieldName: "Num", + Reason: "type mismatch: float64 for string data", + }, + }, + { + desc: "unsettable", + dst: &struct{ lower string }{}, + src: []*pb.Field{newStringValueField("lower", "woop!", pb.FieldValue_TEXT)}, + err: &ErrFieldMismatch{ + FieldName: "lower", + Reason: "cannot set struct field", + }, + }, + } + for _, tc := range testCases { + err := loadDoc(tc.dst, &pb.Document{Field: tc.src}, nil) + if !reflect.DeepEqual(err, tc.err) { + t.Errorf("%s, got err %v, wanted %v", tc.desc, err, tc.err) + } + } +} + +func TestLimit(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + c := aetesting.FakeSingleContext(t, "search", "Search", func(req *pb.SearchRequest, res *pb.SearchResponse) error { + limit := 20 // Default per page. + if req.Params.Limit != nil { + limit = int(*req.Params.Limit) + } + res.Status = &pb.RequestStatus{Code: pb.SearchServiceError_OK.Enum()} + res.MatchedCount = proto.Int64(int64(limit)) + for i := 0; i < limit; i++ { + res.Result = append(res.Result, &pb.SearchResult{Document: &pb.Document{}}) + res.Cursor = proto.String("moreresults") + } + return nil + }) + + const maxDocs = 500 // Limit maximum number of docs. + testCases := []struct { + limit, want int + }{ + {limit: 0, want: maxDocs}, + {limit: 42, want: 42}, + {limit: 100, want: 100}, + {limit: 1000, want: maxDocs}, + } + + for _, tt := range testCases { + it := index.Search(c, "gopher", &SearchOptions{Limit: tt.limit, IDsOnly: true}) + count := 0 + for ; count < maxDocs; count++ { + _, err := it.Next(nil) + if err == Done { + break + } + if err != nil { + t.Fatalf("err after %d: %v", count, err) + } + } + if count != tt.want { + t.Errorf("got %d results, expected %d", count, tt.want) + } + } +} + +func TestPut(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(in *pb.IndexDocumentRequest, out *pb.IndexDocumentResponse) error { + expectedIn := &pb.IndexDocumentRequest{ + Params: &pb.IndexDocumentParams{ + Document: []*pb.Document{ + {Field: protoFields, OrderId: proto.Int32(42), OrderIdSource: pb.Document_SUPPLIED.Enum()}, + }, + IndexSpec: &pb.IndexSpec{ + Name: proto.String("Doc"), + }, + }, + } + if !proto.Equal(in, expectedIn) { + return fmt.Errorf("unsupported argument:\ngot %v\nwant %v", in, expectedIn) + } + *out = pb.IndexDocumentResponse{ + Status: []*pb.RequestStatus{ + {Code: pb.SearchServiceError_OK.Enum()}, + }, + DocId: []string{ + "doc_id", + }, + } + return nil + }) + + id, err := index.Put(c, "", &FieldListWithMeta{ + Meta: searchMeta, + Fields: searchFields, + }) + if err != nil { + t.Fatal(err) + } + if want := "doc_id"; id != want { + t.Errorf("Got doc ID %q, want %q", id, want) + } +} + +func TestPutAutoOrderID(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(in *pb.IndexDocumentRequest, out *pb.IndexDocumentResponse) error { + if len(in.Params.GetDocument()) < 1 { + return fmt.Errorf("expected at least one Document, got %v", in) + } + got, want := in.Params.Document[0].GetOrderId(), int32(time.Since(orderIDEpoch).Seconds()) + if d := got - want; -5 > d || d > 5 { + return fmt.Errorf("got OrderId %d, want near %d", got, want) + } + *out = pb.IndexDocumentResponse{ + Status: []*pb.RequestStatus{ + {Code: pb.SearchServiceError_OK.Enum()}, + }, + DocId: []string{ + "doc_id", + }, + } + return nil + }) + + if _, err := index.Put(c, "", &searchFields); err != nil { + t.Fatal(err) + } +} + +func TestPutBadStatus(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(_ *pb.IndexDocumentRequest, out *pb.IndexDocumentResponse) error { + *out = pb.IndexDocumentResponse{ + Status: []*pb.RequestStatus{ + { + Code: pb.SearchServiceError_INVALID_REQUEST.Enum(), + ErrorDetail: proto.String("insufficient gophers"), + }, + }, + } + return nil + }) + + wantErr := "search: INVALID_REQUEST: insufficient gophers" + if _, err := index.Put(c, "", &searchFields); err == nil || err.Error() != wantErr { + t.Fatalf("Put: got %v error, want %q", err, wantErr) + } +} + +func TestPutMultiNilIDSlice(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(in *pb.IndexDocumentRequest, out *pb.IndexDocumentResponse) error { + if len(in.Params.GetDocument()) < 1 { + return fmt.Errorf("got %v, want at least 1 document", in) + } + got, want := in.Params.Document[0].GetOrderId(), int32(time.Since(orderIDEpoch).Seconds()) + if d := got - want; -5 > d || d > 5 { + return fmt.Errorf("got OrderId %d, want near %d", got, want) + } + *out = pb.IndexDocumentResponse{ + Status: []*pb.RequestStatus{ + {Code: pb.SearchServiceError_OK.Enum()}, + }, + DocId: []string{ + "doc_id", + }, + } + return nil + }) + + if _, err := index.PutMulti(c, nil, []interface{}{&searchFields}); err != nil { + t.Fatal(err) + } +} + +func TestPutMultiError(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(in *pb.IndexDocumentRequest, out *pb.IndexDocumentResponse) error { + *out = pb.IndexDocumentResponse{ + Status: []*pb.RequestStatus{ + {Code: pb.SearchServiceError_OK.Enum()}, + {Code: pb.SearchServiceError_PERMISSION_DENIED.Enum(), ErrorDetail: proto.String("foo")}, + }, + DocId: []string{ + "id1", + "", + }, + } + return nil + }) + + switch _, err := index.PutMulti(c, nil, []interface{}{&searchFields, &searchFields}); { + case err == nil: + t.Fatalf("got nil, want error") + case err.(appengine.MultiError)[0] != nil: + t.Fatalf("got %v, want nil MultiError[0]", err.(appengine.MultiError)[0]) + case err.(appengine.MultiError)[1] == nil: + t.Fatalf("got nil, want not-nill MultiError[1]") + } +} + +func TestPutMultiWrongNumberOfIDs(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(in *pb.IndexDocumentRequest, out *pb.IndexDocumentResponse) error { + return nil + }) + + if _, err := index.PutMulti(c, []string{"a"}, []interface{}{&searchFields, &searchFields}); err == nil { + t.Fatal("got success, want error") + } +} + +func TestPutMultiTooManyDocs(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(in *pb.IndexDocumentRequest, out *pb.IndexDocumentResponse) error { + return nil + }) + + srcs := make([]interface{}, 201) + for i, _ := range srcs { + srcs[i] = &searchFields + } + + if _, err := index.PutMulti(c, nil, srcs); err != ErrTooManyDocuments { + t.Fatalf("got %v, want ErrTooManyDocuments", err) + } +} + +func TestSortOptions(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + noErr := errors.New("") // Sentinel err to return to prevent sending request. + + testCases := []struct { + desc string + sort *SortOptions + wantSort []*pb.SortSpec + wantScorer *pb.ScorerSpec + wantErr string + }{ + { + desc: "No SortOptions", + }, + { + desc: "Basic", + sort: &SortOptions{ + Expressions: []SortExpression{ + {Expr: "dog"}, + {Expr: "cat", Reverse: true}, + {Expr: "gopher", Default: "blue"}, + {Expr: "fish", Default: 2.0}, + }, + Limit: 42, + Scorer: MatchScorer, + }, + wantSort: []*pb.SortSpec{ + {SortExpression: proto.String("dog")}, + {SortExpression: proto.String("cat"), SortDescending: proto.Bool(false)}, + {SortExpression: proto.String("gopher"), DefaultValueText: proto.String("blue")}, + {SortExpression: proto.String("fish"), DefaultValueNumeric: proto.Float64(2)}, + }, + wantScorer: &pb.ScorerSpec{ + Limit: proto.Int32(42), + Scorer: pb.ScorerSpec_MATCH_SCORER.Enum(), + }, + }, + { + desc: "Bad expression default", + sort: &SortOptions{ + Expressions: []SortExpression{ + {Expr: "dog", Default: true}, + }, + }, + wantErr: `search: invalid Default type bool for expression "dog"`, + }, + { + desc: "RescoringMatchScorer", + sort: &SortOptions{Scorer: RescoringMatchScorer}, + wantScorer: &pb.ScorerSpec{Scorer: pb.ScorerSpec_RESCORING_MATCH_SCORER.Enum()}, + }, + } + + for _, tt := range testCases { + c := aetesting.FakeSingleContext(t, "search", "Search", func(req *pb.SearchRequest, _ *pb.SearchResponse) error { + params := req.Params + if !reflect.DeepEqual(params.SortSpec, tt.wantSort) { + t.Errorf("%s: params.SortSpec=%v; want %v", tt.desc, params.SortSpec, tt.wantSort) + } + if !reflect.DeepEqual(params.ScorerSpec, tt.wantScorer) { + t.Errorf("%s: params.ScorerSpec=%v; want %v", tt.desc, params.ScorerSpec, tt.wantScorer) + } + return noErr // Always return some error to prevent response parsing. + }) + + it := index.Search(c, "gopher", &SearchOptions{Sort: tt.sort}) + _, err := it.Next(nil) + if err == nil { + t.Fatalf("%s: err==nil; should not happen", tt.desc) + } + if err.Error() != tt.wantErr { + t.Errorf("%s: got error %q, want %q", tt.desc, err, tt.wantErr) + } + } +} + +func TestFieldSpec(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + errFoo := errors.New("foo") // sentinel error when there isn't one. + + testCases := []struct { + desc string + opts *SearchOptions + want *pb.FieldSpec + }{ + { + desc: "No options", + want: &pb.FieldSpec{}, + }, + { + desc: "Fields", + opts: &SearchOptions{ + Fields: []string{"one", "two"}, + }, + want: &pb.FieldSpec{ + Name: []string{"one", "two"}, + }, + }, + { + desc: "Expressions", + opts: &SearchOptions{ + Expressions: []FieldExpression{ + {Name: "one", Expr: "price * quantity"}, + {Name: "two", Expr: "min(daily_use, 10) * rate"}, + }, + }, + want: &pb.FieldSpec{ + Expression: []*pb.FieldSpec_Expression{ + {Name: proto.String("one"), Expression: proto.String("price * quantity")}, + {Name: proto.String("two"), Expression: proto.String("min(daily_use, 10) * rate")}, + }, + }, + }, + } + + for _, tt := range testCases { + c := aetesting.FakeSingleContext(t, "search", "Search", func(req *pb.SearchRequest, _ *pb.SearchResponse) error { + params := req.Params + if !reflect.DeepEqual(params.FieldSpec, tt.want) { + t.Errorf("%s: params.FieldSpec=%v; want %v", tt.desc, params.FieldSpec, tt.want) + } + return errFoo // Always return some error to prevent response parsing. + }) + + it := index.Search(c, "gopher", tt.opts) + if _, err := it.Next(nil); err != errFoo { + t.Fatalf("%s: got error %v; want %v", tt.desc, err, errFoo) + } + } +} + +func TestBasicSearchOpts(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + noErr := errors.New("") // Sentinel err to return to prevent sending request. + + testCases := []struct { + desc string + facetOpts []FacetSearchOption + cursor Cursor + offset int + countAccuracy int + want *pb.SearchParams + wantErr string + }{ + { + desc: "No options", + want: &pb.SearchParams{}, + }, + { + desc: "Default auto discovery", + facetOpts: []FacetSearchOption{ + AutoFacetDiscovery(0, 0), + }, + want: &pb.SearchParams{ + AutoDiscoverFacetCount: proto.Int32(10), + }, + }, + { + desc: "Auto discovery", + facetOpts: []FacetSearchOption{ + AutoFacetDiscovery(7, 12), + }, + want: &pb.SearchParams{ + AutoDiscoverFacetCount: proto.Int32(7), + FacetAutoDetectParam: &pb.FacetAutoDetectParam{ + ValueLimit: proto.Int32(12), + }, + }, + }, + { + desc: "Param Depth", + facetOpts: []FacetSearchOption{ + AutoFacetDiscovery(7, 12), + }, + want: &pb.SearchParams{ + AutoDiscoverFacetCount: proto.Int32(7), + FacetAutoDetectParam: &pb.FacetAutoDetectParam{ + ValueLimit: proto.Int32(12), + }, + }, + }, + { + desc: "Doc depth", + facetOpts: []FacetSearchOption{ + FacetDocumentDepth(123), + }, + want: &pb.SearchParams{ + FacetDepth: proto.Int32(123), + }, + }, + { + desc: "Facet discovery", + facetOpts: []FacetSearchOption{ + FacetDiscovery("colour"), + FacetDiscovery("size", Atom("M"), Atom("L")), + FacetDiscovery("price", LessThan(7), Range{7, 14}, AtLeast(14)), + }, + want: &pb.SearchParams{ + IncludeFacet: []*pb.FacetRequest{ + {Name: proto.String("colour")}, + {Name: proto.String("size"), Params: &pb.FacetRequestParam{ + ValueConstraint: []string{"M", "L"}, + }}, + {Name: proto.String("price"), Params: &pb.FacetRequestParam{ + Range: []*pb.FacetRange{ + {End: proto.String("7e+00")}, + {Start: proto.String("7e+00"), End: proto.String("1.4e+01")}, + {Start: proto.String("1.4e+01")}, + }, + }}, + }, + }, + }, + { + desc: "Facet discovery - bad value", + facetOpts: []FacetSearchOption{ + FacetDiscovery("colour", true), + }, + wantErr: "bad FacetSearchOption: unsupported value type bool", + }, + { + desc: "Facet discovery - mix value types", + facetOpts: []FacetSearchOption{ + FacetDiscovery("colour", Atom("blue"), AtLeast(7)), + }, + wantErr: "bad FacetSearchOption: values must all be Atom, or must all be Range", + }, + { + desc: "Facet discovery - invalid range", + facetOpts: []FacetSearchOption{ + FacetDiscovery("colour", Range{negInf, posInf}), + }, + wantErr: "bad FacetSearchOption: invalid range: either Start or End must be finite", + }, + { + desc: "Cursor", + cursor: Cursor("mycursor"), + want: &pb.SearchParams{ + Cursor: proto.String("mycursor"), + }, + }, + { + desc: "Offset", + offset: 121, + want: &pb.SearchParams{ + Offset: proto.Int32(121), + }, + }, + { + desc: "Cursor and Offset set", + cursor: Cursor("mycursor"), + offset: 121, + wantErr: "at most one of Cursor and Offset may be specified", + }, + { + desc: "Count accuracy", + countAccuracy: 100, + want: &pb.SearchParams{ + MatchedCountAccuracy: proto.Int32(100), + }, + }, + } + + for _, tt := range testCases { + c := aetesting.FakeSingleContext(t, "search", "Search", func(req *pb.SearchRequest, _ *pb.SearchResponse) error { + if tt.want == nil { + t.Errorf("%s: expected call to fail", tt.desc) + return nil + } + // Set default fields. + tt.want.Query = proto.String("gopher") + tt.want.IndexSpec = &pb.IndexSpec{Name: proto.String("Doc")} + tt.want.CursorType = pb.SearchParams_PER_RESULT.Enum() + tt.want.FieldSpec = &pb.FieldSpec{} + if got := req.Params; !reflect.DeepEqual(got, tt.want) { + t.Errorf("%s: params=%v; want %v", tt.desc, got, tt.want) + } + return noErr // Always return some error to prevent response parsing. + }) + + it := index.Search(c, "gopher", &SearchOptions{ + Facets: tt.facetOpts, + Cursor: tt.cursor, + Offset: tt.offset, + CountAccuracy: tt.countAccuracy, + }) + _, err := it.Next(nil) + if err == nil { + t.Fatalf("%s: err==nil; should not happen", tt.desc) + } + if err.Error() != tt.wantErr { + t.Errorf("%s: got error %q, want %q", tt.desc, err, tt.wantErr) + } + } +} + +func TestFacetRefinements(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + noErr := errors.New("") // Sentinel err to return to prevent sending request. + + testCases := []struct { + desc string + refine []Facet + want []*pb.FacetRefinement + wantErr string + }{ + { + desc: "No refinements", + }, + { + desc: "Basic", + refine: []Facet{ + {Name: "fur", Value: Atom("fluffy")}, + {Name: "age", Value: LessThan(123)}, + {Name: "age", Value: AtLeast(0)}, + {Name: "legs", Value: Range{Start: 3, End: 5}}, + }, + want: []*pb.FacetRefinement{ + {Name: proto.String("fur"), Value: proto.String("fluffy")}, + {Name: proto.String("age"), Range: &pb.FacetRefinement_Range{End: proto.String("1.23e+02")}}, + {Name: proto.String("age"), Range: &pb.FacetRefinement_Range{Start: proto.String("0e+00")}}, + {Name: proto.String("legs"), Range: &pb.FacetRefinement_Range{Start: proto.String("3e+00"), End: proto.String("5e+00")}}, + }, + }, + { + desc: "Infinite range", + refine: []Facet{ + {Name: "age", Value: Range{Start: negInf, End: posInf}}, + }, + wantErr: `search: refinement for facet "age": either Start or End must be finite`, + }, + { + desc: "Bad End value in range", + refine: []Facet{ + {Name: "age", Value: LessThan(2147483648)}, + }, + wantErr: `search: refinement for facet "age": invalid value for End`, + }, + { + desc: "Bad Start value in range", + refine: []Facet{ + {Name: "age", Value: AtLeast(-2147483649)}, + }, + wantErr: `search: refinement for facet "age": invalid value for Start`, + }, + { + desc: "Unknown value type", + refine: []Facet{ + {Name: "age", Value: "you can't use strings!"}, + }, + wantErr: `search: unsupported refinement for facet "age" of type string`, + }, + } + + for _, tt := range testCases { + c := aetesting.FakeSingleContext(t, "search", "Search", func(req *pb.SearchRequest, _ *pb.SearchResponse) error { + if got := req.Params.FacetRefinement; !reflect.DeepEqual(got, tt.want) { + t.Errorf("%s: params.FacetRefinement=%v; want %v", tt.desc, got, tt.want) + } + return noErr // Always return some error to prevent response parsing. + }) + + it := index.Search(c, "gopher", &SearchOptions{Refinements: tt.refine}) + _, err := it.Next(nil) + if err == nil { + t.Fatalf("%s: err==nil; should not happen", tt.desc) + } + if err.Error() != tt.wantErr { + t.Errorf("%s: got error %q, want %q", tt.desc, err, tt.wantErr) + } + } +} + +func TestNamespaceResetting(t *testing.T) { + namec := make(chan *string, 1) + c0 := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(req *pb.IndexDocumentRequest, res *pb.IndexDocumentResponse) error { + namec <- req.Params.IndexSpec.Namespace + return fmt.Errorf("RPC error") + }) + + // Check that wrapping c0 in a namespace twice works correctly. + c1, err := appengine.Namespace(c0, "A") + if err != nil { + t.Fatalf("appengine.Namespace: %v", err) + } + c2, err := appengine.Namespace(c1, "") // should act as the original context + if err != nil { + t.Fatalf("appengine.Namespace: %v", err) + } + + i := (&Index{}) + + i.Put(c0, "something", &searchDoc) + if ns := <-namec; ns != nil { + t.Errorf(`Put with c0: ns = %q, want nil`, *ns) + } + + i.Put(c1, "something", &searchDoc) + if ns := <-namec; ns == nil { + t.Error(`Put with c1: ns = nil, want "A"`) + } else if *ns != "A" { + t.Errorf(`Put with c1: ns = %q, want "A"`, *ns) + } + + i.Put(c2, "something", &searchDoc) + if ns := <-namec; ns != nil { + t.Errorf(`Put with c2: ns = %q, want nil`, *ns) + } +} + +func TestDelete(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "DeleteDocument", func(in *pb.DeleteDocumentRequest, out *pb.DeleteDocumentResponse) error { + expectedIn := &pb.DeleteDocumentRequest{ + Params: &pb.DeleteDocumentParams{ + DocId: []string{"id"}, + IndexSpec: &pb.IndexSpec{Name: proto.String("Doc")}, + }, + } + if !proto.Equal(in, expectedIn) { + return fmt.Errorf("unsupported argument:\ngot %v\nwant %v", in, expectedIn) + } + *out = pb.DeleteDocumentResponse{ + Status: []*pb.RequestStatus{ + {Code: pb.SearchServiceError_OK.Enum()}, + }, + } + return nil + }) + + if err := index.Delete(c, "id"); err != nil { + t.Fatal(err) + } +} + +func TestDeleteMulti(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "DeleteDocument", func(in *pb.DeleteDocumentRequest, out *pb.DeleteDocumentResponse) error { + expectedIn := &pb.DeleteDocumentRequest{ + Params: &pb.DeleteDocumentParams{ + DocId: []string{"id1", "id2"}, + IndexSpec: &pb.IndexSpec{Name: proto.String("Doc")}, + }, + } + if !proto.Equal(in, expectedIn) { + return fmt.Errorf("unsupported argument:\ngot %v\nwant %v", in, expectedIn) + } + *out = pb.DeleteDocumentResponse{ + Status: []*pb.RequestStatus{ + {Code: pb.SearchServiceError_OK.Enum()}, + {Code: pb.SearchServiceError_OK.Enum()}, + }, + } + return nil + }) + + if err := index.DeleteMulti(c, []string{"id1", "id2"}); err != nil { + t.Fatal(err) + } +} + +func TestDeleteWrongNumberOfResults(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "DeleteDocument", func(in *pb.DeleteDocumentRequest, out *pb.DeleteDocumentResponse) error { + expectedIn := &pb.DeleteDocumentRequest{ + Params: &pb.DeleteDocumentParams{ + DocId: []string{"id1", "id2"}, + IndexSpec: &pb.IndexSpec{Name: proto.String("Doc")}, + }, + } + if !proto.Equal(in, expectedIn) { + return fmt.Errorf("unsupported argument:\ngot %v\nwant %v", in, expectedIn) + } + *out = pb.DeleteDocumentResponse{ + Status: []*pb.RequestStatus{ + {Code: pb.SearchServiceError_OK.Enum()}, + }, + } + return nil + }) + + if err := index.DeleteMulti(c, []string{"id1", "id2"}); err == nil { + t.Fatalf("got nil, want error") + } +} + +func TestDeleteMultiError(t *testing.T) { + index, err := Open("Doc") + if err != nil { + t.Fatalf("err from Open: %v", err) + } + + c := aetesting.FakeSingleContext(t, "search", "DeleteDocument", func(in *pb.DeleteDocumentRequest, out *pb.DeleteDocumentResponse) error { + expectedIn := &pb.DeleteDocumentRequest{ + Params: &pb.DeleteDocumentParams{ + DocId: []string{"id1", "id2"}, + IndexSpec: &pb.IndexSpec{Name: proto.String("Doc")}, + }, + } + if !proto.Equal(in, expectedIn) { + return fmt.Errorf("unsupported argument:\ngot %v\nwant %v", in, expectedIn) + } + *out = pb.DeleteDocumentResponse{ + Status: []*pb.RequestStatus{ + {Code: pb.SearchServiceError_OK.Enum()}, + {Code: pb.SearchServiceError_PERMISSION_DENIED.Enum(), ErrorDetail: proto.String("foo")}, + }, + } + return nil + }) + + switch err := index.DeleteMulti(c, []string{"id1", "id2"}); { + case err == nil: + t.Fatalf("got nil, want error") + case err.(appengine.MultiError)[0] != nil: + t.Fatalf("got %v, want nil MultiError[0]", err.(appengine.MultiError)[0]) + case err.(appengine.MultiError)[1] == nil: + t.Fatalf("got nil, want not-nill MultiError[1]") + } +} diff --git a/vendor/google.golang.org/appengine/search/struct.go b/vendor/google.golang.org/appengine/search/struct.go new file mode 100644 index 000000000..e73d2f2ef --- /dev/null +++ b/vendor/google.golang.org/appengine/search/struct.go @@ -0,0 +1,251 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package search + +import ( + "fmt" + "reflect" + "strings" + "sync" +) + +// ErrFieldMismatch is returned when a field is to be loaded into a different +// than the one it was stored from, or when a field is missing or unexported in +// the destination struct. +type ErrFieldMismatch struct { + FieldName string + Reason string +} + +func (e *ErrFieldMismatch) Error() string { + return fmt.Sprintf("search: cannot load field %q: %s", e.FieldName, e.Reason) +} + +// ErrFacetMismatch is returned when a facet is to be loaded into a different +// type than the one it was stored from, or when a field is missing or +// unexported in the destination struct. StructType is the type of the struct +// pointed to by the destination argument passed to Iterator.Next. +type ErrFacetMismatch struct { + StructType reflect.Type + FacetName string + Reason string +} + +func (e *ErrFacetMismatch) Error() string { + return fmt.Sprintf("search: cannot load facet %q into a %q: %s", e.FacetName, e.StructType, e.Reason) +} + +// structCodec defines how to convert a given struct to/from a search document. +type structCodec struct { + // byIndex returns the struct tag for the i'th struct field. + byIndex []structTag + + // fieldByName returns the index of the struct field for the given field name. + fieldByName map[string]int + + // facetByName returns the index of the struct field for the given facet name, + facetByName map[string]int +} + +// structTag holds a structured version of each struct field's parsed tag. +type structTag struct { + name string + facet bool + ignore bool +} + +var ( + codecsMu sync.RWMutex + codecs = map[reflect.Type]*structCodec{} +) + +func loadCodec(t reflect.Type) (*structCodec, error) { + codecsMu.RLock() + codec, ok := codecs[t] + codecsMu.RUnlock() + if ok { + return codec, nil + } + + codecsMu.Lock() + defer codecsMu.Unlock() + if codec, ok := codecs[t]; ok { + return codec, nil + } + + codec = &structCodec{ + fieldByName: make(map[string]int), + facetByName: make(map[string]int), + } + + for i, I := 0, t.NumField(); i < I; i++ { + f := t.Field(i) + name, opts := f.Tag.Get("search"), "" + if i := strings.Index(name, ","); i != -1 { + name, opts = name[:i], name[i+1:] + } + ignore := false + if name == "-" { + ignore = true + } else if name == "" { + name = f.Name + } else if !validFieldName(name) { + return nil, fmt.Errorf("search: struct tag has invalid field name: %q", name) + } + facet := opts == "facet" + codec.byIndex = append(codec.byIndex, structTag{name: name, facet: facet, ignore: ignore}) + if facet { + codec.facetByName[name] = i + } else { + codec.fieldByName[name] = i + } + } + + codecs[t] = codec + return codec, nil +} + +// structFLS adapts a struct to be a FieldLoadSaver. +type structFLS struct { + v reflect.Value + codec *structCodec +} + +func (s structFLS) Load(fields []Field, meta *DocumentMetadata) error { + var err error + for _, field := range fields { + i, ok := s.codec.fieldByName[field.Name] + if !ok { + // Note the error, but keep going. + err = &ErrFieldMismatch{ + FieldName: field.Name, + Reason: "no such struct field", + } + continue + + } + f := s.v.Field(i) + if !f.CanSet() { + // Note the error, but keep going. + err = &ErrFieldMismatch{ + FieldName: field.Name, + Reason: "cannot set struct field", + } + continue + } + v := reflect.ValueOf(field.Value) + if ft, vt := f.Type(), v.Type(); ft != vt { + err = &ErrFieldMismatch{ + FieldName: field.Name, + Reason: fmt.Sprintf("type mismatch: %v for %v data", ft, vt), + } + continue + } + f.Set(v) + } + if meta == nil { + return err + } + for _, facet := range meta.Facets { + i, ok := s.codec.facetByName[facet.Name] + if !ok { + // Note the error, but keep going. + if err == nil { + err = &ErrFacetMismatch{ + StructType: s.v.Type(), + FacetName: facet.Name, + Reason: "no matching field found", + } + } + continue + } + f := s.v.Field(i) + if !f.CanSet() { + // Note the error, but keep going. + if err == nil { + err = &ErrFacetMismatch{ + StructType: s.v.Type(), + FacetName: facet.Name, + Reason: "unable to set unexported field of struct", + } + } + continue + } + v := reflect.ValueOf(facet.Value) + if ft, vt := f.Type(), v.Type(); ft != vt { + if err == nil { + err = &ErrFacetMismatch{ + StructType: s.v.Type(), + FacetName: facet.Name, + Reason: fmt.Sprintf("type mismatch: %v for %d data", ft, vt), + } + continue + } + } + f.Set(v) + } + return err +} + +func (s structFLS) Save() ([]Field, *DocumentMetadata, error) { + fields := make([]Field, 0, len(s.codec.fieldByName)) + var facets []Facet + for i, tag := range s.codec.byIndex { + if tag.ignore { + continue + } + f := s.v.Field(i) + if !f.CanSet() { + continue + } + if tag.facet { + facets = append(facets, Facet{Name: tag.name, Value: f.Interface()}) + } else { + fields = append(fields, Field{Name: tag.name, Value: f.Interface()}) + } + } + return fields, &DocumentMetadata{Facets: facets}, nil +} + +// newStructFLS returns a FieldLoadSaver for the struct pointer p. +func newStructFLS(p interface{}) (FieldLoadSaver, error) { + v := reflect.ValueOf(p) + if v.Kind() != reflect.Ptr || v.IsNil() || v.Elem().Kind() != reflect.Struct { + return nil, ErrInvalidDocumentType + } + codec, err := loadCodec(v.Elem().Type()) + if err != nil { + return nil, err + } + return structFLS{v.Elem(), codec}, nil +} + +func loadStructWithMeta(dst interface{}, f []Field, meta *DocumentMetadata) error { + x, err := newStructFLS(dst) + if err != nil { + return err + } + return x.Load(f, meta) +} + +func saveStructWithMeta(src interface{}) ([]Field, *DocumentMetadata, error) { + x, err := newStructFLS(src) + if err != nil { + return nil, nil, err + } + return x.Save() +} + +// LoadStruct loads the fields from f to dst. dst must be a struct pointer. +func LoadStruct(dst interface{}, f []Field) error { + return loadStructWithMeta(dst, f, nil) +} + +// SaveStruct returns the fields from src as a slice of Field. +// src must be a struct pointer. +func SaveStruct(src interface{}) ([]Field, error) { + f, _, err := saveStructWithMeta(src) + return f, err +} diff --git a/vendor/google.golang.org/appengine/search/struct_test.go b/vendor/google.golang.org/appengine/search/struct_test.go new file mode 100644 index 000000000..4e5b5d1b8 --- /dev/null +++ b/vendor/google.golang.org/appengine/search/struct_test.go @@ -0,0 +1,213 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package search + +import ( + "reflect" + "testing" +) + +func TestLoadingStruct(t *testing.T) { + testCases := []struct { + desc string + fields []Field + meta *DocumentMetadata + want interface{} + wantErr bool + }{ + { + desc: "Basic struct", + fields: []Field{ + {Name: "Name", Value: "Gopher"}, + {Name: "Legs", Value: float64(4)}, + }, + want: &struct { + Name string + Legs float64 + }{"Gopher", 4}, + }, + { + desc: "Struct with tags", + fields: []Field{ + {Name: "Name", Value: "Gopher"}, + {Name: "about", Value: "Likes slide rules."}, + }, + meta: &DocumentMetadata{Facets: []Facet{ + {Name: "Legs", Value: float64(4)}, + {Name: "Fur", Value: Atom("furry")}, + }}, + want: &struct { + Name string + Info string `search:"about"` + Legs float64 `search:",facet"` + Fuzz Atom `search:"Fur,facet"` + }{"Gopher", "Likes slide rules.", 4, Atom("furry")}, + }, + { + desc: "Bad field from tag", + want: &struct { + AlphaBeta string `search:"αβ"` + }{}, + wantErr: true, + }, + { + desc: "Ignore missing field", + fields: []Field{ + {Name: "Meaning", Value: float64(42)}, + }, + want: &struct{}{}, + wantErr: true, + }, + { + desc: "Ignore unsettable field", + fields: []Field{ + {Name: "meaning", Value: float64(42)}, + }, + want: &struct{ meaning float64 }{}, // field not populated. + wantErr: true, + }, + { + desc: "Error on missing facet", + meta: &DocumentMetadata{Facets: []Facet{ + {Name: "Set", Value: Atom("yes")}, + {Name: "Missing", Value: Atom("no")}, + }}, + want: &struct { + Set Atom `search:",facet"` + }{Atom("yes")}, + wantErr: true, + }, + { + desc: "Error on unsettable facet", + meta: &DocumentMetadata{Facets: []Facet{ + {Name: "Set", Value: Atom("yes")}, + {Name: "unset", Value: Atom("no")}, + }}, + want: &struct { + Set Atom `search:",facet"` + }{Atom("yes")}, + wantErr: true, + }, + { + desc: "Error setting ignored field", + fields: []Field{ + {Name: "Set", Value: "yes"}, + {Name: "Ignored", Value: "no"}, + }, + want: &struct { + Set string + Ignored string `search:"-"` + }{Set: "yes"}, + wantErr: true, + }, + { + desc: "Error setting ignored facet", + meta: &DocumentMetadata{Facets: []Facet{ + {Name: "Set", Value: Atom("yes")}, + {Name: "Ignored", Value: Atom("no")}, + }}, + want: &struct { + Set Atom `search:",facet"` + Ignored Atom `search:"-,facet"` + }{Set: Atom("yes")}, + wantErr: true, + }, + } + + for _, tt := range testCases { + // Make a pointer to an empty version of what want points to. + dst := reflect.New(reflect.TypeOf(tt.want).Elem()).Interface() + err := loadStructWithMeta(dst, tt.fields, tt.meta) + if err != nil != tt.wantErr { + t.Errorf("%s: got err %v; want err %t", tt.desc, err, tt.wantErr) + continue + } + if !reflect.DeepEqual(dst, tt.want) { + t.Errorf("%s: doesn't match\ngot: %v\nwant: %v", tt.desc, dst, tt.want) + } + } +} + +func TestSavingStruct(t *testing.T) { + testCases := []struct { + desc string + doc interface{} + wantFields []Field + wantFacets []Facet + }{ + { + desc: "Basic struct", + doc: &struct { + Name string + Legs float64 + }{"Gopher", 4}, + wantFields: []Field{ + {Name: "Name", Value: "Gopher"}, + {Name: "Legs", Value: float64(4)}, + }, + }, + { + desc: "Struct with tags", + doc: &struct { + Name string + Info string `search:"about"` + Legs float64 `search:",facet"` + Fuzz Atom `search:"Fur,facet"` + }{"Gopher", "Likes slide rules.", 4, Atom("furry")}, + wantFields: []Field{ + {Name: "Name", Value: "Gopher"}, + {Name: "about", Value: "Likes slide rules."}, + }, + wantFacets: []Facet{ + {Name: "Legs", Value: float64(4)}, + {Name: "Fur", Value: Atom("furry")}, + }, + }, + { + desc: "Ignore unexported struct fields", + doc: &struct { + Name string + info string + Legs float64 `search:",facet"` + fuzz Atom `search:",facet"` + }{"Gopher", "Likes slide rules.", 4, Atom("furry")}, + wantFields: []Field{ + {Name: "Name", Value: "Gopher"}, + }, + wantFacets: []Facet{ + {Name: "Legs", Value: float64(4)}, + }, + }, + { + desc: "Ignore fields marked -", + doc: &struct { + Name string + Info string `search:"-"` + Legs float64 `search:",facet"` + Fuzz Atom `search:"-,facet"` + }{"Gopher", "Likes slide rules.", 4, Atom("furry")}, + wantFields: []Field{ + {Name: "Name", Value: "Gopher"}, + }, + wantFacets: []Facet{ + {Name: "Legs", Value: float64(4)}, + }, + }, + } + + for _, tt := range testCases { + fields, meta, err := saveStructWithMeta(tt.doc) + if err != nil { + t.Errorf("%s: got err %v; want nil", tt.desc, err) + continue + } + if !reflect.DeepEqual(fields, tt.wantFields) { + t.Errorf("%s: fields don't match\ngot: %v\nwant: %v", tt.desc, fields, tt.wantFields) + } + if facets := meta.Facets; !reflect.DeepEqual(facets, tt.wantFacets) { + t.Errorf("%s: facets don't match\ngot: %v\nwant: %v", tt.desc, facets, tt.wantFacets) + } + } +} diff --git a/vendor/google.golang.org/appengine/socket/doc.go b/vendor/google.golang.org/appengine/socket/doc.go new file mode 100644 index 000000000..3de46df82 --- /dev/null +++ b/vendor/google.golang.org/appengine/socket/doc.go @@ -0,0 +1,10 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package socket provides outbound network sockets. +// +// This package is only required in the classic App Engine environment. +// Applications running only in App Engine "flexible environment" should +// use the standard library's net package. +package socket diff --git a/vendor/google.golang.org/appengine/socket/socket_classic.go b/vendor/google.golang.org/appengine/socket/socket_classic.go new file mode 100644 index 000000000..0ad50e2d3 --- /dev/null +++ b/vendor/google.golang.org/appengine/socket/socket_classic.go @@ -0,0 +1,290 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build appengine + +package socket + +import ( + "fmt" + "io" + "net" + "strconv" + "time" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + "google.golang.org/appengine/internal" + + pb "google.golang.org/appengine/internal/socket" +) + +// Dial connects to the address addr on the network protocol. +// The address format is host:port, where host may be a hostname or an IP address. +// Known protocols are "tcp" and "udp". +// The returned connection satisfies net.Conn, and is valid while ctx is valid; +// if the connection is to be used after ctx becomes invalid, invoke SetContext +// with the new context. +func Dial(ctx context.Context, protocol, addr string) (*Conn, error) { + return DialTimeout(ctx, protocol, addr, 0) +} + +var ipFamilies = []pb.CreateSocketRequest_SocketFamily{ + pb.CreateSocketRequest_IPv4, + pb.CreateSocketRequest_IPv6, +} + +// DialTimeout is like Dial but takes a timeout. +// The timeout includes name resolution, if required. +func DialTimeout(ctx context.Context, protocol, addr string, timeout time.Duration) (*Conn, error) { + dialCtx := ctx // Used for dialing and name resolution, but not stored in the *Conn. + if timeout > 0 { + var cancel context.CancelFunc + dialCtx, cancel = context.WithTimeout(ctx, timeout) + defer cancel() + } + + host, portStr, err := net.SplitHostPort(addr) + if err != nil { + return nil, err + } + port, err := strconv.Atoi(portStr) + if err != nil { + return nil, fmt.Errorf("socket: bad port %q: %v", portStr, err) + } + + var prot pb.CreateSocketRequest_SocketProtocol + switch protocol { + case "tcp": + prot = pb.CreateSocketRequest_TCP + case "udp": + prot = pb.CreateSocketRequest_UDP + default: + return nil, fmt.Errorf("socket: unknown protocol %q", protocol) + } + + packedAddrs, resolved, err := resolve(dialCtx, ipFamilies, host) + if err != nil { + return nil, fmt.Errorf("socket: failed resolving %q: %v", host, err) + } + if len(packedAddrs) == 0 { + return nil, fmt.Errorf("no addresses for %q", host) + } + + packedAddr := packedAddrs[0] // use first address + fam := pb.CreateSocketRequest_IPv4 + if len(packedAddr) == net.IPv6len { + fam = pb.CreateSocketRequest_IPv6 + } + + req := &pb.CreateSocketRequest{ + Family: fam.Enum(), + Protocol: prot.Enum(), + RemoteIp: &pb.AddressPort{ + Port: proto.Int32(int32(port)), + PackedAddress: packedAddr, + }, + } + if resolved { + req.RemoteIp.HostnameHint = &host + } + res := &pb.CreateSocketReply{} + if err := internal.Call(dialCtx, "remote_socket", "CreateSocket", req, res); err != nil { + return nil, err + } + + return &Conn{ + ctx: ctx, + desc: res.GetSocketDescriptor(), + prot: prot, + local: res.ProxyExternalIp, + remote: req.RemoteIp, + }, nil +} + +// LookupIP returns the given host's IP addresses. +func LookupIP(ctx context.Context, host string) (addrs []net.IP, err error) { + packedAddrs, _, err := resolve(ctx, ipFamilies, host) + if err != nil { + return nil, fmt.Errorf("socket: failed resolving %q: %v", host, err) + } + addrs = make([]net.IP, len(packedAddrs)) + for i, pa := range packedAddrs { + addrs[i] = net.IP(pa) + } + return addrs, nil +} + +func resolve(ctx context.Context, fams []pb.CreateSocketRequest_SocketFamily, host string) ([][]byte, bool, error) { + // Check if it's an IP address. + if ip := net.ParseIP(host); ip != nil { + if ip := ip.To4(); ip != nil { + return [][]byte{ip}, false, nil + } + return [][]byte{ip}, false, nil + } + + req := &pb.ResolveRequest{ + Name: &host, + AddressFamilies: fams, + } + res := &pb.ResolveReply{} + if err := internal.Call(ctx, "remote_socket", "Resolve", req, res); err != nil { + // XXX: need to map to pb.ResolveReply_ErrorCode? + return nil, false, err + } + return res.PackedAddress, true, nil +} + +// withDeadline is like context.WithDeadline, except it ignores the zero deadline. +func withDeadline(parent context.Context, deadline time.Time) (context.Context, context.CancelFunc) { + if deadline.IsZero() { + return parent, func() {} + } + return context.WithDeadline(parent, deadline) +} + +// Conn represents a socket connection. +// It implements net.Conn. +type Conn struct { + ctx context.Context + desc string + offset int64 + + prot pb.CreateSocketRequest_SocketProtocol + local, remote *pb.AddressPort + + readDeadline, writeDeadline time.Time // optional +} + +// SetContext sets the context that is used by this Conn. +// It is usually used only when using a Conn that was created in a different context, +// such as when a connection is created during a warmup request but used while +// servicing a user request. +func (cn *Conn) SetContext(ctx context.Context) { + cn.ctx = ctx +} + +func (cn *Conn) Read(b []byte) (n int, err error) { + const maxRead = 1 << 20 + if len(b) > maxRead { + b = b[:maxRead] + } + + req := &pb.ReceiveRequest{ + SocketDescriptor: &cn.desc, + DataSize: proto.Int32(int32(len(b))), + } + res := &pb.ReceiveReply{} + if !cn.readDeadline.IsZero() { + req.TimeoutSeconds = proto.Float64(cn.readDeadline.Sub(time.Now()).Seconds()) + } + ctx, cancel := withDeadline(cn.ctx, cn.readDeadline) + defer cancel() + if err := internal.Call(ctx, "remote_socket", "Receive", req, res); err != nil { + return 0, err + } + if len(res.Data) == 0 { + return 0, io.EOF + } + if len(res.Data) > len(b) { + return 0, fmt.Errorf("socket: internal error: read too much data: %d > %d", len(res.Data), len(b)) + } + return copy(b, res.Data), nil +} + +func (cn *Conn) Write(b []byte) (n int, err error) { + const lim = 1 << 20 // max per chunk + + for n < len(b) { + chunk := b[n:] + if len(chunk) > lim { + chunk = chunk[:lim] + } + + req := &pb.SendRequest{ + SocketDescriptor: &cn.desc, + Data: chunk, + StreamOffset: &cn.offset, + } + res := &pb.SendReply{} + if !cn.writeDeadline.IsZero() { + req.TimeoutSeconds = proto.Float64(cn.writeDeadline.Sub(time.Now()).Seconds()) + } + ctx, cancel := withDeadline(cn.ctx, cn.writeDeadline) + defer cancel() + if err = internal.Call(ctx, "remote_socket", "Send", req, res); err != nil { + // assume zero bytes were sent in this RPC + break + } + n += int(res.GetDataSent()) + cn.offset += int64(res.GetDataSent()) + } + + return +} + +func (cn *Conn) Close() error { + req := &pb.CloseRequest{ + SocketDescriptor: &cn.desc, + } + res := &pb.CloseReply{} + if err := internal.Call(cn.ctx, "remote_socket", "Close", req, res); err != nil { + return err + } + cn.desc = "CLOSED" + return nil +} + +func addr(prot pb.CreateSocketRequest_SocketProtocol, ap *pb.AddressPort) net.Addr { + if ap == nil { + return nil + } + switch prot { + case pb.CreateSocketRequest_TCP: + return &net.TCPAddr{ + IP: net.IP(ap.PackedAddress), + Port: int(*ap.Port), + } + case pb.CreateSocketRequest_UDP: + return &net.UDPAddr{ + IP: net.IP(ap.PackedAddress), + Port: int(*ap.Port), + } + } + panic("unknown protocol " + prot.String()) +} + +func (cn *Conn) LocalAddr() net.Addr { return addr(cn.prot, cn.local) } +func (cn *Conn) RemoteAddr() net.Addr { return addr(cn.prot, cn.remote) } + +func (cn *Conn) SetDeadline(t time.Time) error { + cn.readDeadline = t + cn.writeDeadline = t + return nil +} + +func (cn *Conn) SetReadDeadline(t time.Time) error { + cn.readDeadline = t + return nil +} + +func (cn *Conn) SetWriteDeadline(t time.Time) error { + cn.writeDeadline = t + return nil +} + +// KeepAlive signals that the connection is still in use. +// It may be called to prevent the socket being closed due to inactivity. +func (cn *Conn) KeepAlive() error { + req := &pb.GetSocketNameRequest{ + SocketDescriptor: &cn.desc, + } + res := &pb.GetSocketNameReply{} + return internal.Call(cn.ctx, "remote_socket", "GetSocketName", req, res) +} + +func init() { + internal.RegisterErrorCodeMap("remote_socket", pb.RemoteSocketServiceError_ErrorCode_name) +} diff --git a/vendor/google.golang.org/appengine/socket/socket_vm.go b/vendor/google.golang.org/appengine/socket/socket_vm.go new file mode 100644 index 000000000..c804169a1 --- /dev/null +++ b/vendor/google.golang.org/appengine/socket/socket_vm.go @@ -0,0 +1,64 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package socket + +import ( + "net" + "time" + + "golang.org/x/net/context" +) + +// Dial connects to the address addr on the network protocol. +// The address format is host:port, where host may be a hostname or an IP address. +// Known protocols are "tcp" and "udp". +// The returned connection satisfies net.Conn, and is valid while ctx is valid; +// if the connection is to be used after ctx becomes invalid, invoke SetContext +// with the new context. +func Dial(ctx context.Context, protocol, addr string) (*Conn, error) { + conn, err := net.Dial(protocol, addr) + if err != nil { + return nil, err + } + return &Conn{conn}, nil +} + +// DialTimeout is like Dial but takes a timeout. +// The timeout includes name resolution, if required. +func DialTimeout(ctx context.Context, protocol, addr string, timeout time.Duration) (*Conn, error) { + conn, err := net.DialTimeout(protocol, addr, timeout) + if err != nil { + return nil, err + } + return &Conn{conn}, nil +} + +// LookupIP returns the given host's IP addresses. +func LookupIP(ctx context.Context, host string) (addrs []net.IP, err error) { + return net.LookupIP(host) +} + +// Conn represents a socket connection. +// It implements net.Conn. +type Conn struct { + net.Conn +} + +// SetContext sets the context that is used by this Conn. +// It is usually used only when using a Conn that was created in a different context, +// such as when a connection is created during a warmup request but used while +// servicing a user request. +func (cn *Conn) SetContext(ctx context.Context) { + // This function is not required in App Engine "flexible environment". +} + +// KeepAlive signals that the connection is still in use. +// It may be called to prevent the socket being closed due to inactivity. +func (cn *Conn) KeepAlive() error { + // This function is not required in App Engine "flexible environment". + return nil +} diff --git a/vendor/google.golang.org/appengine/taskqueue/taskqueue.go b/vendor/google.golang.org/appengine/taskqueue/taskqueue.go new file mode 100644 index 000000000..965c5ab4c --- /dev/null +++ b/vendor/google.golang.org/appengine/taskqueue/taskqueue.go @@ -0,0 +1,541 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package taskqueue provides a client for App Engine's taskqueue service. +Using this service, applications may perform work outside a user's request. + +A Task may be constructed manually; alternatively, since the most common +taskqueue operation is to add a single POST task, NewPOSTTask makes it easy. + + t := taskqueue.NewPOSTTask("/worker", url.Values{ + "key": {key}, + }) + taskqueue.Add(c, t, "") // add t to the default queue +*/ +package taskqueue // import "google.golang.org/appengine/taskqueue" + +import ( + "errors" + "fmt" + "net/http" + "net/url" + "strconv" + "time" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + dspb "google.golang.org/appengine/internal/datastore" + pb "google.golang.org/appengine/internal/taskqueue" +) + +var ( + // ErrTaskAlreadyAdded is the error returned by Add and AddMulti when a task has already been added with a particular name. + ErrTaskAlreadyAdded = errors.New("taskqueue: task has already been added") +) + +// RetryOptions let you control whether to retry a task and the backoff intervals between tries. +type RetryOptions struct { + // Number of tries/leases after which the task fails permanently and is deleted. + // If AgeLimit is also set, both limits must be exceeded for the task to fail permanently. + RetryLimit int32 + + // Maximum time allowed since the task's first try before the task fails permanently and is deleted (only for push tasks). + // If RetryLimit is also set, both limits must be exceeded for the task to fail permanently. + AgeLimit time.Duration + + // Minimum time between successive tries (only for push tasks). + MinBackoff time.Duration + + // Maximum time between successive tries (only for push tasks). + MaxBackoff time.Duration + + // Maximum number of times to double the interval between successive tries before the intervals increase linearly (only for push tasks). + MaxDoublings int32 + + // If MaxDoublings is zero, set ApplyZeroMaxDoublings to true to override the default non-zero value. + // Otherwise a zero MaxDoublings is ignored and the default is used. + ApplyZeroMaxDoublings bool +} + +// toRetryParameter converts RetryOptions to pb.TaskQueueRetryParameters. +func (opt *RetryOptions) toRetryParameters() *pb.TaskQueueRetryParameters { + params := &pb.TaskQueueRetryParameters{} + if opt.RetryLimit > 0 { + params.RetryLimit = proto.Int32(opt.RetryLimit) + } + if opt.AgeLimit > 0 { + params.AgeLimitSec = proto.Int64(int64(opt.AgeLimit.Seconds())) + } + if opt.MinBackoff > 0 { + params.MinBackoffSec = proto.Float64(opt.MinBackoff.Seconds()) + } + if opt.MaxBackoff > 0 { + params.MaxBackoffSec = proto.Float64(opt.MaxBackoff.Seconds()) + } + if opt.MaxDoublings > 0 || (opt.MaxDoublings == 0 && opt.ApplyZeroMaxDoublings) { + params.MaxDoublings = proto.Int32(opt.MaxDoublings) + } + return params +} + +// A Task represents a task to be executed. +type Task struct { + // Path is the worker URL for the task. + // If unset, it will default to /_ah/queue/. + Path string + + // Payload is the data for the task. + // This will be delivered as the HTTP request body. + // It is only used when Method is POST, PUT or PULL. + // url.Values' Encode method may be used to generate this for POST requests. + Payload []byte + + // Additional HTTP headers to pass at the task's execution time. + // To schedule the task to be run with an alternate app version + // or backend, set the "Host" header. + Header http.Header + + // Method is the HTTP method for the task ("GET", "POST", etc.), + // or "PULL" if this is task is destined for a pull-based queue. + // If empty, this defaults to "POST". + Method string + + // A name for the task. + // If empty, a name will be chosen. + Name string + + // Delay specifies the duration the task queue service must wait + // before executing the task. + // Either Delay or ETA may be set, but not both. + Delay time.Duration + + // ETA specifies the earliest time a task may be executed (push queues) + // or leased (pull queues). + // Either Delay or ETA may be set, but not both. + ETA time.Time + + // The number of times the task has been dispatched or leased. + RetryCount int32 + + // Tag for the task. Only used when Method is PULL. + Tag string + + // Retry options for this task. May be nil. + RetryOptions *RetryOptions +} + +func (t *Task) method() string { + if t.Method == "" { + return "POST" + } + return t.Method +} + +// NewPOSTTask creates a Task that will POST to a path with the given form data. +func NewPOSTTask(path string, params url.Values) *Task { + h := make(http.Header) + h.Set("Content-Type", "application/x-www-form-urlencoded") + return &Task{ + Path: path, + Payload: []byte(params.Encode()), + Header: h, + Method: "POST", + } +} + +// RequestHeaders are the special HTTP request headers available to push task +// HTTP request handlers. These headers are set internally by App Engine. +// See https://cloud.google.com/appengine/docs/standard/go/taskqueue/push/creating-handlers#reading_request_headers +// for a description of the fields. +type RequestHeaders struct { + QueueName string + TaskName string + TaskRetryCount int64 + TaskExecutionCount int64 + TaskETA time.Time + + TaskPreviousResponse int + TaskRetryReason string + FailFast bool +} + +// ParseRequestHeaders parses the special HTTP request headers available to push +// task request handlers. This function silently ignores values of the wrong +// format. +func ParseRequestHeaders(h http.Header) *RequestHeaders { + ret := &RequestHeaders{ + QueueName: h.Get("X-AppEngine-QueueName"), + TaskName: h.Get("X-AppEngine-TaskName"), + } + + ret.TaskRetryCount, _ = strconv.ParseInt(h.Get("X-AppEngine-TaskRetryCount"), 10, 64) + ret.TaskExecutionCount, _ = strconv.ParseInt(h.Get("X-AppEngine-TaskExecutionCount"), 10, 64) + + etaSecs, _ := strconv.ParseInt(h.Get("X-AppEngine-TaskETA"), 10, 64) + if etaSecs != 0 { + ret.TaskETA = time.Unix(etaSecs, 0) + } + + ret.TaskPreviousResponse, _ = strconv.Atoi(h.Get("X-AppEngine-TaskPreviousResponse")) + ret.TaskRetryReason = h.Get("X-AppEngine-TaskRetryReason") + if h.Get("X-AppEngine-FailFast") != "" { + ret.FailFast = true + } + + return ret +} + +var ( + currentNamespace = http.CanonicalHeaderKey("X-AppEngine-Current-Namespace") + defaultNamespace = http.CanonicalHeaderKey("X-AppEngine-Default-Namespace") +) + +func getDefaultNamespace(ctx context.Context) string { + return internal.IncomingHeaders(ctx).Get(defaultNamespace) +} + +func newAddReq(c context.Context, task *Task, queueName string) (*pb.TaskQueueAddRequest, error) { + if queueName == "" { + queueName = "default" + } + path := task.Path + if path == "" { + path = "/_ah/queue/" + queueName + } + eta := task.ETA + if eta.IsZero() { + eta = time.Now().Add(task.Delay) + } else if task.Delay != 0 { + panic("taskqueue: both Delay and ETA are set") + } + req := &pb.TaskQueueAddRequest{ + QueueName: []byte(queueName), + TaskName: []byte(task.Name), + EtaUsec: proto.Int64(eta.UnixNano() / 1e3), + } + method := task.method() + if method == "PULL" { + // Pull-based task + req.Body = task.Payload + req.Mode = pb.TaskQueueMode_PULL.Enum() + if task.Tag != "" { + req.Tag = []byte(task.Tag) + } + } else { + // HTTP-based task + if v, ok := pb.TaskQueueAddRequest_RequestMethod_value[method]; ok { + req.Method = pb.TaskQueueAddRequest_RequestMethod(v).Enum() + } else { + return nil, fmt.Errorf("taskqueue: bad method %q", method) + } + req.Url = []byte(path) + for k, vs := range task.Header { + for _, v := range vs { + req.Header = append(req.Header, &pb.TaskQueueAddRequest_Header{ + Key: []byte(k), + Value: []byte(v), + }) + } + } + if method == "POST" || method == "PUT" { + req.Body = task.Payload + } + + // Namespace headers. + if _, ok := task.Header[currentNamespace]; !ok { + // Fetch the current namespace of this request. + ns := internal.NamespaceFromContext(c) + req.Header = append(req.Header, &pb.TaskQueueAddRequest_Header{ + Key: []byte(currentNamespace), + Value: []byte(ns), + }) + } + if _, ok := task.Header[defaultNamespace]; !ok { + // Fetch the X-AppEngine-Default-Namespace header of this request. + if ns := getDefaultNamespace(c); ns != "" { + req.Header = append(req.Header, &pb.TaskQueueAddRequest_Header{ + Key: []byte(defaultNamespace), + Value: []byte(ns), + }) + } + } + } + + if task.RetryOptions != nil { + req.RetryParameters = task.RetryOptions.toRetryParameters() + } + + return req, nil +} + +var alreadyAddedErrors = map[pb.TaskQueueServiceError_ErrorCode]bool{ + pb.TaskQueueServiceError_TASK_ALREADY_EXISTS: true, + pb.TaskQueueServiceError_TOMBSTONED_TASK: true, +} + +// Add adds the task to a named queue. +// An empty queue name means that the default queue will be used. +// Add returns an equivalent Task with defaults filled in, including setting +// the task's Name field to the chosen name if the original was empty. +func Add(c context.Context, task *Task, queueName string) (*Task, error) { + req, err := newAddReq(c, task, queueName) + if err != nil { + return nil, err + } + res := &pb.TaskQueueAddResponse{} + if err := internal.Call(c, "taskqueue", "Add", req, res); err != nil { + apiErr, ok := err.(*internal.APIError) + if ok && alreadyAddedErrors[pb.TaskQueueServiceError_ErrorCode(apiErr.Code)] { + return nil, ErrTaskAlreadyAdded + } + return nil, err + } + resultTask := *task + resultTask.Method = task.method() + if task.Name == "" { + resultTask.Name = string(res.ChosenTaskName) + } + return &resultTask, nil +} + +// AddMulti adds multiple tasks to a named queue. +// An empty queue name means that the default queue will be used. +// AddMulti returns a slice of equivalent tasks with defaults filled in, including setting +// each task's Name field to the chosen name if the original was empty. +// If a given task is badly formed or could not be added, an appengine.MultiError is returned. +func AddMulti(c context.Context, tasks []*Task, queueName string) ([]*Task, error) { + req := &pb.TaskQueueBulkAddRequest{ + AddRequest: make([]*pb.TaskQueueAddRequest, len(tasks)), + } + me, any := make(appengine.MultiError, len(tasks)), false + for i, t := range tasks { + req.AddRequest[i], me[i] = newAddReq(c, t, queueName) + any = any || me[i] != nil + } + if any { + return nil, me + } + res := &pb.TaskQueueBulkAddResponse{} + if err := internal.Call(c, "taskqueue", "BulkAdd", req, res); err != nil { + return nil, err + } + if len(res.Taskresult) != len(tasks) { + return nil, errors.New("taskqueue: server error") + } + tasksOut := make([]*Task, len(tasks)) + for i, tr := range res.Taskresult { + tasksOut[i] = new(Task) + *tasksOut[i] = *tasks[i] + tasksOut[i].Method = tasksOut[i].method() + if tasksOut[i].Name == "" { + tasksOut[i].Name = string(tr.ChosenTaskName) + } + if *tr.Result != pb.TaskQueueServiceError_OK { + if alreadyAddedErrors[*tr.Result] { + me[i] = ErrTaskAlreadyAdded + } else { + me[i] = &internal.APIError{ + Service: "taskqueue", + Code: int32(*tr.Result), + } + } + any = true + } + } + if any { + return tasksOut, me + } + return tasksOut, nil +} + +// Delete deletes a task from a named queue. +func Delete(c context.Context, task *Task, queueName string) error { + err := DeleteMulti(c, []*Task{task}, queueName) + if me, ok := err.(appengine.MultiError); ok { + return me[0] + } + return err +} + +// DeleteMulti deletes multiple tasks from a named queue. +// If a given task could not be deleted, an appengine.MultiError is returned. +// Each task is deleted independently; one may fail to delete while the others +// are sucessfully deleted. +func DeleteMulti(c context.Context, tasks []*Task, queueName string) error { + taskNames := make([][]byte, len(tasks)) + for i, t := range tasks { + taskNames[i] = []byte(t.Name) + } + if queueName == "" { + queueName = "default" + } + req := &pb.TaskQueueDeleteRequest{ + QueueName: []byte(queueName), + TaskName: taskNames, + } + res := &pb.TaskQueueDeleteResponse{} + if err := internal.Call(c, "taskqueue", "Delete", req, res); err != nil { + return err + } + if a, b := len(req.TaskName), len(res.Result); a != b { + return fmt.Errorf("taskqueue: internal error: requested deletion of %d tasks, got %d results", a, b) + } + me, any := make(appengine.MultiError, len(res.Result)), false + for i, ec := range res.Result { + if ec != pb.TaskQueueServiceError_OK { + me[i] = &internal.APIError{ + Service: "taskqueue", + Code: int32(ec), + } + any = true + } + } + if any { + return me + } + return nil +} + +func lease(c context.Context, maxTasks int, queueName string, leaseTime int, groupByTag bool, tag []byte) ([]*Task, error) { + if queueName == "" { + queueName = "default" + } + req := &pb.TaskQueueQueryAndOwnTasksRequest{ + QueueName: []byte(queueName), + LeaseSeconds: proto.Float64(float64(leaseTime)), + MaxTasks: proto.Int64(int64(maxTasks)), + GroupByTag: proto.Bool(groupByTag), + Tag: tag, + } + res := &pb.TaskQueueQueryAndOwnTasksResponse{} + if err := internal.Call(c, "taskqueue", "QueryAndOwnTasks", req, res); err != nil { + return nil, err + } + tasks := make([]*Task, len(res.Task)) + for i, t := range res.Task { + tasks[i] = &Task{ + Payload: t.Body, + Name: string(t.TaskName), + Method: "PULL", + ETA: time.Unix(0, *t.EtaUsec*1e3), + RetryCount: *t.RetryCount, + Tag: string(t.Tag), + } + } + return tasks, nil +} + +// Lease leases tasks from a queue. +// leaseTime is in seconds. +// The number of tasks fetched will be at most maxTasks. +func Lease(c context.Context, maxTasks int, queueName string, leaseTime int) ([]*Task, error) { + return lease(c, maxTasks, queueName, leaseTime, false, nil) +} + +// LeaseByTag leases tasks from a queue, grouped by tag. +// If tag is empty, then the returned tasks are grouped by the tag of the task with earliest ETA. +// leaseTime is in seconds. +// The number of tasks fetched will be at most maxTasks. +func LeaseByTag(c context.Context, maxTasks int, queueName string, leaseTime int, tag string) ([]*Task, error) { + return lease(c, maxTasks, queueName, leaseTime, true, []byte(tag)) +} + +// Purge removes all tasks from a queue. +func Purge(c context.Context, queueName string) error { + if queueName == "" { + queueName = "default" + } + req := &pb.TaskQueuePurgeQueueRequest{ + QueueName: []byte(queueName), + } + res := &pb.TaskQueuePurgeQueueResponse{} + return internal.Call(c, "taskqueue", "PurgeQueue", req, res) +} + +// ModifyLease modifies the lease of a task. +// Used to request more processing time, or to abandon processing. +// leaseTime is in seconds and must not be negative. +func ModifyLease(c context.Context, task *Task, queueName string, leaseTime int) error { + if queueName == "" { + queueName = "default" + } + req := &pb.TaskQueueModifyTaskLeaseRequest{ + QueueName: []byte(queueName), + TaskName: []byte(task.Name), + EtaUsec: proto.Int64(task.ETA.UnixNano() / 1e3), // Used to verify ownership. + LeaseSeconds: proto.Float64(float64(leaseTime)), + } + res := &pb.TaskQueueModifyTaskLeaseResponse{} + if err := internal.Call(c, "taskqueue", "ModifyTaskLease", req, res); err != nil { + return err + } + task.ETA = time.Unix(0, *res.UpdatedEtaUsec*1e3) + return nil +} + +// QueueStatistics represents statistics about a single task queue. +type QueueStatistics struct { + Tasks int // may be an approximation + OldestETA time.Time // zero if there are no pending tasks + + Executed1Minute int // tasks executed in the last minute + InFlight int // tasks executing now + EnforcedRate float64 // requests per second +} + +// QueueStats retrieves statistics about queues. +func QueueStats(c context.Context, queueNames []string) ([]QueueStatistics, error) { + req := &pb.TaskQueueFetchQueueStatsRequest{ + QueueName: make([][]byte, len(queueNames)), + } + for i, q := range queueNames { + if q == "" { + q = "default" + } + req.QueueName[i] = []byte(q) + } + res := &pb.TaskQueueFetchQueueStatsResponse{} + if err := internal.Call(c, "taskqueue", "FetchQueueStats", req, res); err != nil { + return nil, err + } + qs := make([]QueueStatistics, len(res.Queuestats)) + for i, qsg := range res.Queuestats { + qs[i] = QueueStatistics{ + Tasks: int(*qsg.NumTasks), + } + if eta := *qsg.OldestEtaUsec; eta > -1 { + qs[i].OldestETA = time.Unix(0, eta*1e3) + } + if si := qsg.ScannerInfo; si != nil { + qs[i].Executed1Minute = int(*si.ExecutedLastMinute) + qs[i].InFlight = int(si.GetRequestsInFlight()) + qs[i].EnforcedRate = si.GetEnforcedRate() + } + } + return qs, nil +} + +func setTransaction(x *pb.TaskQueueAddRequest, t *dspb.Transaction) { + x.Transaction = t +} + +func init() { + internal.RegisterErrorCodeMap("taskqueue", pb.TaskQueueServiceError_ErrorCode_name) + + // Datastore error codes are shifted by DATASTORE_ERROR when presented through taskqueue. + dsCode := int32(pb.TaskQueueServiceError_DATASTORE_ERROR) + int32(dspb.Error_TIMEOUT) + internal.RegisterTimeoutErrorCode("taskqueue", dsCode) + + // Transaction registration. + internal.RegisterTransactionSetter(setTransaction) + internal.RegisterTransactionSetter(func(x *pb.TaskQueueBulkAddRequest, t *dspb.Transaction) { + for _, req := range x.AddRequest { + setTransaction(req, t) + } + }) +} diff --git a/vendor/google.golang.org/appengine/taskqueue/taskqueue_test.go b/vendor/google.golang.org/appengine/taskqueue/taskqueue_test.go new file mode 100644 index 000000000..d9eec50b7 --- /dev/null +++ b/vendor/google.golang.org/appengine/taskqueue/taskqueue_test.go @@ -0,0 +1,173 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package taskqueue + +import ( + "errors" + "fmt" + "net/http" + "reflect" + "testing" + "time" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + "google.golang.org/appengine/internal/aetesting" + pb "google.golang.org/appengine/internal/taskqueue" +) + +func TestAddErrors(t *testing.T) { + var tests = []struct { + err, want error + sameErr bool // if true, should return err exactly + }{ + { + err: &internal.APIError{ + Service: "taskqueue", + Code: int32(pb.TaskQueueServiceError_TASK_ALREADY_EXISTS), + }, + want: ErrTaskAlreadyAdded, + }, + { + err: &internal.APIError{ + Service: "taskqueue", + Code: int32(pb.TaskQueueServiceError_TOMBSTONED_TASK), + }, + want: ErrTaskAlreadyAdded, + }, + { + err: &internal.APIError{ + Service: "taskqueue", + Code: int32(pb.TaskQueueServiceError_UNKNOWN_QUEUE), + }, + want: errors.New("not used"), + sameErr: true, + }, + } + for _, tc := range tests { + c := aetesting.FakeSingleContext(t, "taskqueue", "Add", func(req *pb.TaskQueueAddRequest, res *pb.TaskQueueAddResponse) error { + // don't fill in any of the response + return tc.err + }) + task := &Task{Path: "/worker", Method: "PULL"} + _, err := Add(c, task, "a-queue") + want := tc.want + if tc.sameErr { + want = tc.err + } + if err != want { + t.Errorf("Add with tc.err = %v, got %#v, want = %#v", tc.err, err, want) + } + } +} + +func TestAddMulti(t *testing.T) { + c := aetesting.FakeSingleContext(t, "taskqueue", "BulkAdd", func(req *pb.TaskQueueBulkAddRequest, res *pb.TaskQueueBulkAddResponse) error { + res.Taskresult = []*pb.TaskQueueBulkAddResponse_TaskResult{ + { + Result: pb.TaskQueueServiceError_OK.Enum(), + }, + { + Result: pb.TaskQueueServiceError_TASK_ALREADY_EXISTS.Enum(), + }, + { + Result: pb.TaskQueueServiceError_TOMBSTONED_TASK.Enum(), + }, + { + Result: pb.TaskQueueServiceError_INTERNAL_ERROR.Enum(), + }, + } + return nil + }) + tasks := []*Task{ + {Path: "/worker", Method: "PULL"}, + {Path: "/worker", Method: "PULL"}, + {Path: "/worker", Method: "PULL"}, + {Path: "/worker", Method: "PULL"}, + } + r, err := AddMulti(c, tasks, "a-queue") + if len(r) != len(tasks) { + t.Fatalf("AddMulti returned %d tasks, want %d", len(r), len(tasks)) + } + want := appengine.MultiError{ + nil, + ErrTaskAlreadyAdded, + ErrTaskAlreadyAdded, + &internal.APIError{ + Service: "taskqueue", + Code: int32(pb.TaskQueueServiceError_INTERNAL_ERROR), + }, + } + if !reflect.DeepEqual(err, want) { + t.Errorf("AddMulti got %v, wanted %v", err, want) + } +} + +func TestAddWithEmptyPath(t *testing.T) { + c := aetesting.FakeSingleContext(t, "taskqueue", "Add", func(req *pb.TaskQueueAddRequest, res *pb.TaskQueueAddResponse) error { + if got, want := string(req.Url), "/_ah/queue/a-queue"; got != want { + return fmt.Errorf("req.Url = %q; want %q", got, want) + } + return nil + }) + if _, err := Add(c, &Task{}, "a-queue"); err != nil { + t.Fatalf("Add: %v", err) + } +} + +func TestParseRequestHeaders(t *testing.T) { + tests := []struct { + Header http.Header + Want RequestHeaders + }{ + { + Header: map[string][]string{ + "X-Appengine-Queuename": []string{"foo"}, + "X-Appengine-Taskname": []string{"bar"}, + "X-Appengine-Taskretrycount": []string{"4294967297"}, // 2^32 + 1 + "X-Appengine-Taskexecutioncount": []string{"4294967298"}, // 2^32 + 2 + "X-Appengine-Tasketa": []string{"1500000000"}, + "X-Appengine-Taskpreviousresponse": []string{"404"}, + "X-Appengine-Taskretryreason": []string{"baz"}, + "X-Appengine-Failfast": []string{"yes"}, + }, + Want: RequestHeaders{ + QueueName: "foo", + TaskName: "bar", + TaskRetryCount: 4294967297, + TaskExecutionCount: 4294967298, + TaskETA: time.Date(2017, time.July, 14, 2, 40, 0, 0, time.UTC), + TaskPreviousResponse: 404, + TaskRetryReason: "baz", + FailFast: true, + }, + }, + { + Header: map[string][]string{}, + Want: RequestHeaders{ + QueueName: "", + TaskName: "", + TaskRetryCount: 0, + TaskExecutionCount: 0, + TaskETA: time.Time{}, + TaskPreviousResponse: 0, + TaskRetryReason: "", + FailFast: false, + }, + }, + } + + for idx, test := range tests { + got := *ParseRequestHeaders(test.Header) + if got.TaskETA.UnixNano() != test.Want.TaskETA.UnixNano() { + t.Errorf("%d. ParseRequestHeaders got TaskETA %v, wanted %v", idx, got.TaskETA, test.Want.TaskETA) + } + got.TaskETA = time.Time{} + test.Want.TaskETA = time.Time{} + if !reflect.DeepEqual(got, test.Want) { + t.Errorf("%d. ParseRequestHeaders got %v, wanted %v", idx, got, test.Want) + } + } +} diff --git a/vendor/google.golang.org/appengine/timeout.go b/vendor/google.golang.org/appengine/timeout.go new file mode 100644 index 000000000..05642a992 --- /dev/null +++ b/vendor/google.golang.org/appengine/timeout.go @@ -0,0 +1,20 @@ +// Copyright 2013 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package appengine + +import "golang.org/x/net/context" + +// IsTimeoutError reports whether err is a timeout error. +func IsTimeoutError(err error) bool { + if err == context.DeadlineExceeded { + return true + } + if t, ok := err.(interface { + IsTimeout() bool + }); ok { + return t.IsTimeout() + } + return false +} diff --git a/vendor/google.golang.org/appengine/travis_install.sh b/vendor/google.golang.org/appengine/travis_install.sh new file mode 100755 index 000000000..785b62f46 --- /dev/null +++ b/vendor/google.golang.org/appengine/travis_install.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +if [[ $GO111MODULE == "on" ]]; then + go get . +else + go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep -v appengine) +fi + +if [[ $GOAPP == "true" ]]; then + mkdir /tmp/sdk + curl -o /tmp/sdk.zip "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.68.zip" + unzip -q /tmp/sdk.zip -d /tmp/sdk + # NOTE: Set the following env vars in the test script: + # export PATH="$PATH:/tmp/sdk/go_appengine" + # export APPENGINE_DEV_APPSERVER=/tmp/sdk/go_appengine/dev_appserver.py +fi + diff --git a/vendor/google.golang.org/appengine/travis_test.sh b/vendor/google.golang.org/appengine/travis_test.sh new file mode 100755 index 000000000..d4390f045 --- /dev/null +++ b/vendor/google.golang.org/appengine/travis_test.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +go version +go test -v google.golang.org/appengine/... +go test -v -race google.golang.org/appengine/... +if [[ $GOAPP == "true" ]]; then + export PATH="$PATH:/tmp/sdk/go_appengine" + export APPENGINE_DEV_APPSERVER=/tmp/sdk/go_appengine/dev_appserver.py + goapp version + goapp test -v google.golang.org/appengine/... +fi diff --git a/vendor/google.golang.org/appengine/urlfetch/urlfetch.go b/vendor/google.golang.org/appengine/urlfetch/urlfetch.go new file mode 100644 index 000000000..6ffe1e6d9 --- /dev/null +++ b/vendor/google.golang.org/appengine/urlfetch/urlfetch.go @@ -0,0 +1,210 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package urlfetch provides an http.RoundTripper implementation +// for fetching URLs via App Engine's urlfetch service. +package urlfetch // import "google.golang.org/appengine/urlfetch" + +import ( + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strconv" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/urlfetch" +) + +// Transport is an implementation of http.RoundTripper for +// App Engine. Users should generally create an http.Client using +// this transport and use the Client rather than using this transport +// directly. +type Transport struct { + Context context.Context + + // Controls whether the application checks the validity of SSL certificates + // over HTTPS connections. A value of false (the default) instructs the + // application to send a request to the server only if the certificate is + // valid and signed by a trusted certificate authority (CA), and also + // includes a hostname that matches the certificate. A value of true + // instructs the application to perform no certificate validation. + AllowInvalidServerCertificate bool +} + +// Verify statically that *Transport implements http.RoundTripper. +var _ http.RoundTripper = (*Transport)(nil) + +// Client returns an *http.Client using a default urlfetch Transport. This +// client will have the default deadline of 5 seconds, and will check the +// validity of SSL certificates. +// +// Any deadline of the provided context will be used for requests through this client; +// if the client does not have a deadline then a 5 second default is used. +func Client(ctx context.Context) *http.Client { + return &http.Client{ + Transport: &Transport{ + Context: ctx, + }, + } +} + +type bodyReader struct { + content []byte + truncated bool + closed bool +} + +// ErrTruncatedBody is the error returned after the final Read() from a +// response's Body if the body has been truncated by App Engine's proxy. +var ErrTruncatedBody = errors.New("urlfetch: truncated body") + +func statusCodeToText(code int) string { + if t := http.StatusText(code); t != "" { + return t + } + return strconv.Itoa(code) +} + +func (br *bodyReader) Read(p []byte) (n int, err error) { + if br.closed { + if br.truncated { + return 0, ErrTruncatedBody + } + return 0, io.EOF + } + n = copy(p, br.content) + if n > 0 { + br.content = br.content[n:] + return + } + if br.truncated { + br.closed = true + return 0, ErrTruncatedBody + } + return 0, io.EOF +} + +func (br *bodyReader) Close() error { + br.closed = true + br.content = nil + return nil +} + +// A map of the URL Fetch-accepted methods that take a request body. +var methodAcceptsRequestBody = map[string]bool{ + "POST": true, + "PUT": true, + "PATCH": true, +} + +// urlString returns a valid string given a URL. This function is necessary because +// the String method of URL doesn't correctly handle URLs with non-empty Opaque values. +// See http://code.google.com/p/go/issues/detail?id=4860. +func urlString(u *url.URL) string { + if u.Opaque == "" || strings.HasPrefix(u.Opaque, "//") { + return u.String() + } + aux := *u + aux.Opaque = "//" + aux.Host + aux.Opaque + return aux.String() +} + +// RoundTrip issues a single HTTP request and returns its response. Per the +// http.RoundTripper interface, RoundTrip only returns an error if there +// was an unsupported request or the URL Fetch proxy fails. +// Note that HTTP response codes such as 5xx, 403, 404, etc are not +// errors as far as the transport is concerned and will be returned +// with err set to nil. +func (t *Transport) RoundTrip(req *http.Request) (res *http.Response, err error) { + methNum, ok := pb.URLFetchRequest_RequestMethod_value[req.Method] + if !ok { + return nil, fmt.Errorf("urlfetch: unsupported HTTP method %q", req.Method) + } + + method := pb.URLFetchRequest_RequestMethod(methNum) + + freq := &pb.URLFetchRequest{ + Method: &method, + Url: proto.String(urlString(req.URL)), + FollowRedirects: proto.Bool(false), // http.Client's responsibility + MustValidateServerCertificate: proto.Bool(!t.AllowInvalidServerCertificate), + } + if deadline, ok := t.Context.Deadline(); ok { + freq.Deadline = proto.Float64(deadline.Sub(time.Now()).Seconds()) + } + + for k, vals := range req.Header { + for _, val := range vals { + freq.Header = append(freq.Header, &pb.URLFetchRequest_Header{ + Key: proto.String(k), + Value: proto.String(val), + }) + } + } + if methodAcceptsRequestBody[req.Method] && req.Body != nil { + // Avoid a []byte copy if req.Body has a Bytes method. + switch b := req.Body.(type) { + case interface { + Bytes() []byte + }: + freq.Payload = b.Bytes() + default: + freq.Payload, err = ioutil.ReadAll(req.Body) + if err != nil { + return nil, err + } + } + } + + fres := &pb.URLFetchResponse{} + if err := internal.Call(t.Context, "urlfetch", "Fetch", freq, fres); err != nil { + return nil, err + } + + res = &http.Response{} + res.StatusCode = int(*fres.StatusCode) + res.Status = fmt.Sprintf("%d %s", res.StatusCode, statusCodeToText(res.StatusCode)) + res.Header = make(http.Header) + res.Request = req + + // Faked: + res.ProtoMajor = 1 + res.ProtoMinor = 1 + res.Proto = "HTTP/1.1" + res.Close = true + + for _, h := range fres.Header { + hkey := http.CanonicalHeaderKey(*h.Key) + hval := *h.Value + if hkey == "Content-Length" { + // Will get filled in below for all but HEAD requests. + if req.Method == "HEAD" { + res.ContentLength, _ = strconv.ParseInt(hval, 10, 64) + } + continue + } + res.Header.Add(hkey, hval) + } + + if req.Method != "HEAD" { + res.ContentLength = int64(len(fres.Content)) + } + + truncated := fres.GetContentWasTruncated() + res.Body = &bodyReader{content: fres.Content, truncated: truncated} + return +} + +func init() { + internal.RegisterErrorCodeMap("urlfetch", pb.URLFetchServiceError_ErrorCode_name) + internal.RegisterTimeoutErrorCode("urlfetch", int32(pb.URLFetchServiceError_DEADLINE_EXCEEDED)) +} diff --git a/vendor/google.golang.org/appengine/user/oauth.go b/vendor/google.golang.org/appengine/user/oauth.go new file mode 100644 index 000000000..ffad57182 --- /dev/null +++ b/vendor/google.golang.org/appengine/user/oauth.go @@ -0,0 +1,52 @@ +// Copyright 2012 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package user + +import ( + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/user" +) + +// CurrentOAuth returns the user associated with the OAuth consumer making this +// request. If the OAuth consumer did not make a valid OAuth request, or the +// scopes is non-empty and the current user does not have at least one of the +// scopes, this method will return an error. +func CurrentOAuth(c context.Context, scopes ...string) (*User, error) { + req := &pb.GetOAuthUserRequest{} + if len(scopes) != 1 || scopes[0] != "" { + // The signature for this function used to be CurrentOAuth(Context, string). + // Ignore the singular "" scope to preserve existing behavior. + req.Scopes = scopes + } + + res := &pb.GetOAuthUserResponse{} + + err := internal.Call(c, "user", "GetOAuthUser", req, res) + if err != nil { + return nil, err + } + return &User{ + Email: *res.Email, + AuthDomain: *res.AuthDomain, + Admin: res.GetIsAdmin(), + ID: *res.UserId, + ClientID: res.GetClientId(), + }, nil +} + +// OAuthConsumerKey returns the OAuth consumer key provided with the current +// request. This method will return an error if the OAuth request was invalid. +func OAuthConsumerKey(c context.Context) (string, error) { + req := &pb.CheckOAuthSignatureRequest{} + res := &pb.CheckOAuthSignatureResponse{} + + err := internal.Call(c, "user", "CheckOAuthSignature", req, res) + if err != nil { + return "", err + } + return *res.OauthConsumerKey, err +} diff --git a/vendor/google.golang.org/appengine/user/user.go b/vendor/google.golang.org/appengine/user/user.go new file mode 100644 index 000000000..eb76f59b7 --- /dev/null +++ b/vendor/google.golang.org/appengine/user/user.go @@ -0,0 +1,84 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// Package user provides a client for App Engine's user authentication service. +package user // import "google.golang.org/appengine/user" + +import ( + "strings" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/user" +) + +// User represents a user of the application. +type User struct { + Email string + AuthDomain string + Admin bool + + // ID is the unique permanent ID of the user. + // It is populated if the Email is associated + // with a Google account, or empty otherwise. + ID string + + // ClientID is the ID of the pre-registered client so its identity can be verified. + // See https://developers.google.com/console/help/#generatingoauth2 for more information. + ClientID string + + FederatedIdentity string + FederatedProvider string +} + +// String returns a displayable name for the user. +func (u *User) String() string { + if u.AuthDomain != "" && strings.HasSuffix(u.Email, "@"+u.AuthDomain) { + return u.Email[:len(u.Email)-len("@"+u.AuthDomain)] + } + if u.FederatedIdentity != "" { + return u.FederatedIdentity + } + return u.Email +} + +// LoginURL returns a URL that, when visited, prompts the user to sign in, +// then redirects the user to the URL specified by dest. +func LoginURL(c context.Context, dest string) (string, error) { + return LoginURLFederated(c, dest, "") +} + +// LoginURLFederated is like LoginURL but accepts a user's OpenID identifier. +func LoginURLFederated(c context.Context, dest, identity string) (string, error) { + req := &pb.CreateLoginURLRequest{ + DestinationUrl: proto.String(dest), + } + if identity != "" { + req.FederatedIdentity = proto.String(identity) + } + res := &pb.CreateLoginURLResponse{} + if err := internal.Call(c, "user", "CreateLoginURL", req, res); err != nil { + return "", err + } + return *res.LoginUrl, nil +} + +// LogoutURL returns a URL that, when visited, signs the user out, +// then redirects the user to the URL specified by dest. +func LogoutURL(c context.Context, dest string) (string, error) { + req := &pb.CreateLogoutURLRequest{ + DestinationUrl: proto.String(dest), + } + res := &pb.CreateLogoutURLResponse{} + if err := internal.Call(c, "user", "CreateLogoutURL", req, res); err != nil { + return "", err + } + return *res.LogoutUrl, nil +} + +func init() { + internal.RegisterErrorCodeMap("user", pb.UserServiceError_ErrorCode_name) +} diff --git a/vendor/google.golang.org/appengine/user/user_classic.go b/vendor/google.golang.org/appengine/user/user_classic.go new file mode 100644 index 000000000..81315094c --- /dev/null +++ b/vendor/google.golang.org/appengine/user/user_classic.go @@ -0,0 +1,44 @@ +// Copyright 2015 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build appengine + +package user + +import ( + "appengine/user" + + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" +) + +func Current(ctx context.Context) *User { + c, err := internal.ClassicContextFromContext(ctx) + if err != nil { + panic(err) + } + u := user.Current(c) + if u == nil { + return nil + } + // Map appengine/user.User to this package's User type. + return &User{ + Email: u.Email, + AuthDomain: u.AuthDomain, + Admin: u.Admin, + ID: u.ID, + FederatedIdentity: u.FederatedIdentity, + FederatedProvider: u.FederatedProvider, + } +} + +func IsAdmin(ctx context.Context) bool { + c, err := internal.ClassicContextFromContext(ctx) + if err != nil { + panic(err) + } + + return user.IsAdmin(c) +} diff --git a/vendor/google.golang.org/appengine/user/user_test.go b/vendor/google.golang.org/appengine/user/user_test.go new file mode 100644 index 000000000..5fc5957a8 --- /dev/null +++ b/vendor/google.golang.org/appengine/user/user_test.go @@ -0,0 +1,99 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package user + +import ( + "fmt" + "net/http" + "testing" + + "github.com/golang/protobuf/proto" + + "google.golang.org/appengine/internal" + "google.golang.org/appengine/internal/aetesting" + pb "google.golang.org/appengine/internal/user" +) + +func baseReq() *http.Request { + return &http.Request{ + Header: http.Header{}, + } +} + +type basicUserTest struct { + nickname, email, authDomain, admin string + // expectations + isNil, isAdmin bool + displayName string +} + +var basicUserTests = []basicUserTest{ + {"", "", "", "0", true, false, ""}, + {"ken", "ken@example.com", "example.com", "0", false, false, "ken"}, + {"ken", "ken@example.com", "auth_domain.com", "1", false, true, "ken@example.com"}, +} + +func TestBasicUserAPI(t *testing.T) { + for i, tc := range basicUserTests { + req := baseReq() + req.Header.Set("X-AppEngine-User-Nickname", tc.nickname) + req.Header.Set("X-AppEngine-User-Email", tc.email) + req.Header.Set("X-AppEngine-Auth-Domain", tc.authDomain) + req.Header.Set("X-AppEngine-User-Is-Admin", tc.admin) + + c := internal.ContextForTesting(req) + + if ga := IsAdmin(c); ga != tc.isAdmin { + t.Errorf("test %d: expected IsAdmin(c) = %v, got %v", i, tc.isAdmin, ga) + } + + u := Current(c) + if tc.isNil { + if u != nil { + t.Errorf("test %d: expected u == nil, got %+v", i, u) + } + continue + } + if u == nil { + t.Errorf("test %d: expected u != nil, got nil", i) + continue + } + if u.Email != tc.email { + t.Errorf("test %d: expected u.Email = %q, got %q", i, tc.email, u.Email) + } + if gs := u.String(); gs != tc.displayName { + t.Errorf("test %d: expected u.String() = %q, got %q", i, tc.displayName, gs) + } + if u.Admin != tc.isAdmin { + t.Errorf("test %d: expected u.Admin = %v, got %v", i, tc.isAdmin, u.Admin) + } + } +} + +func TestLoginURL(t *testing.T) { + expectedQuery := &pb.CreateLoginURLRequest{ + DestinationUrl: proto.String("/destination"), + } + const expectedDest = "/redir/dest" + c := aetesting.FakeSingleContext(t, "user", "CreateLoginURL", func(req *pb.CreateLoginURLRequest, res *pb.CreateLoginURLResponse) error { + if !proto.Equal(req, expectedQuery) { + return fmt.Errorf("got %v, want %v", req, expectedQuery) + } + res.LoginUrl = proto.String(expectedDest) + return nil + }) + + url, err := LoginURL(c, "/destination") + if err != nil { + t.Fatalf("LoginURL failed: %v", err) + } + if url != expectedDest { + t.Errorf("got %v, want %v", url, expectedDest) + } +} + +// TODO(dsymonds): Add test for LogoutURL. diff --git a/vendor/google.golang.org/appengine/user/user_vm.go b/vendor/google.golang.org/appengine/user/user_vm.go new file mode 100644 index 000000000..8dc672e92 --- /dev/null +++ b/vendor/google.golang.org/appengine/user/user_vm.go @@ -0,0 +1,38 @@ +// Copyright 2014 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +// +build !appengine + +package user + +import ( + "golang.org/x/net/context" + + "google.golang.org/appengine/internal" +) + +// Current returns the currently logged-in user, +// or nil if the user is not signed in. +func Current(c context.Context) *User { + h := internal.IncomingHeaders(c) + u := &User{ + Email: h.Get("X-AppEngine-User-Email"), + AuthDomain: h.Get("X-AppEngine-Auth-Domain"), + ID: h.Get("X-AppEngine-User-Id"), + Admin: h.Get("X-AppEngine-User-Is-Admin") == "1", + FederatedIdentity: h.Get("X-AppEngine-Federated-Identity"), + FederatedProvider: h.Get("X-AppEngine-Federated-Provider"), + } + if u.Email == "" && u.FederatedIdentity == "" { + return nil + } + return u +} + +// IsAdmin returns true if the current user is signed in and +// is currently registered as an administrator of the application. +func IsAdmin(c context.Context) bool { + h := internal.IncomingHeaders(c) + return h.Get("X-AppEngine-User-Is-Admin") == "1" +} diff --git a/vendor/google.golang.org/appengine/xmpp/xmpp.go b/vendor/google.golang.org/appengine/xmpp/xmpp.go new file mode 100644 index 000000000..3a561fd53 --- /dev/null +++ b/vendor/google.golang.org/appengine/xmpp/xmpp.go @@ -0,0 +1,253 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +/* +Package xmpp provides the means to send and receive instant messages +to and from users of XMPP-compatible services. + +To send a message, + m := &xmpp.Message{ + To: []string{"kaylee@example.com"}, + Body: `Hi! How's the carrot?`, + } + err := m.Send(c) + +To receive messages, + func init() { + xmpp.Handle(handleChat) + } + + func handleChat(c context.Context, m *xmpp.Message) { + // ... + } +*/ +package xmpp // import "google.golang.org/appengine/xmpp" + +import ( + "errors" + "fmt" + "net/http" + + "golang.org/x/net/context" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal" + pb "google.golang.org/appengine/internal/xmpp" +) + +// Message represents an incoming chat message. +type Message struct { + // Sender is the JID of the sender. + // Optional for outgoing messages. + Sender string + + // To is the intended recipients of the message. + // Incoming messages will have exactly one element. + To []string + + // Body is the body of the message. + Body string + + // Type is the message type, per RFC 3921. + // It defaults to "chat". + Type string + + // RawXML is whether the body contains raw XML. + RawXML bool +} + +// Presence represents an outgoing presence update. +type Presence struct { + // Sender is the JID (optional). + Sender string + + // The intended recipient of the presence update. + To string + + // Type, per RFC 3921 (optional). Defaults to "available". + Type string + + // State of presence (optional). + // Valid values: "away", "chat", "xa", "dnd" (RFC 3921). + State string + + // Free text status message (optional). + Status string +} + +var ( + ErrPresenceUnavailable = errors.New("xmpp: presence unavailable") + ErrInvalidJID = errors.New("xmpp: invalid JID") +) + +// Handle arranges for f to be called for incoming XMPP messages. +// Only messages of type "chat" or "normal" will be handled. +func Handle(f func(c context.Context, m *Message)) { + http.HandleFunc("/_ah/xmpp/message/chat/", func(_ http.ResponseWriter, r *http.Request) { + f(appengine.NewContext(r), &Message{ + Sender: r.FormValue("from"), + To: []string{r.FormValue("to")}, + Body: r.FormValue("body"), + }) + }) +} + +// Send sends a message. +// If any failures occur with specific recipients, the error will be an appengine.MultiError. +func (m *Message) Send(c context.Context) error { + req := &pb.XmppMessageRequest{ + Jid: m.To, + Body: &m.Body, + RawXml: &m.RawXML, + } + if m.Type != "" && m.Type != "chat" { + req.Type = &m.Type + } + if m.Sender != "" { + req.FromJid = &m.Sender + } + res := &pb.XmppMessageResponse{} + if err := internal.Call(c, "xmpp", "SendMessage", req, res); err != nil { + return err + } + + if len(res.Status) != len(req.Jid) { + return fmt.Errorf("xmpp: sent message to %d JIDs, but only got %d statuses back", len(req.Jid), len(res.Status)) + } + me, any := make(appengine.MultiError, len(req.Jid)), false + for i, st := range res.Status { + if st != pb.XmppMessageResponse_NO_ERROR { + me[i] = errors.New(st.String()) + any = true + } + } + if any { + return me + } + return nil +} + +// Invite sends an invitation. If the from address is an empty string +// the default (yourapp@appspot.com/bot) will be used. +func Invite(c context.Context, to, from string) error { + req := &pb.XmppInviteRequest{ + Jid: &to, + } + if from != "" { + req.FromJid = &from + } + res := &pb.XmppInviteResponse{} + return internal.Call(c, "xmpp", "SendInvite", req, res) +} + +// Send sends a presence update. +func (p *Presence) Send(c context.Context) error { + req := &pb.XmppSendPresenceRequest{ + Jid: &p.To, + } + if p.State != "" { + req.Show = &p.State + } + if p.Type != "" { + req.Type = &p.Type + } + if p.Sender != "" { + req.FromJid = &p.Sender + } + if p.Status != "" { + req.Status = &p.Status + } + res := &pb.XmppSendPresenceResponse{} + return internal.Call(c, "xmpp", "SendPresence", req, res) +} + +var presenceMap = map[pb.PresenceResponse_SHOW]string{ + pb.PresenceResponse_NORMAL: "", + pb.PresenceResponse_AWAY: "away", + pb.PresenceResponse_DO_NOT_DISTURB: "dnd", + pb.PresenceResponse_CHAT: "chat", + pb.PresenceResponse_EXTENDED_AWAY: "xa", +} + +// GetPresence retrieves a user's presence. +// If the from address is an empty string the default +// (yourapp@appspot.com/bot) will be used. +// Possible return values are "", "away", "dnd", "chat", "xa". +// ErrPresenceUnavailable is returned if the presence is unavailable. +func GetPresence(c context.Context, to string, from string) (string, error) { + req := &pb.PresenceRequest{ + Jid: &to, + } + if from != "" { + req.FromJid = &from + } + res := &pb.PresenceResponse{} + if err := internal.Call(c, "xmpp", "GetPresence", req, res); err != nil { + return "", err + } + if !*res.IsAvailable || res.Presence == nil { + return "", ErrPresenceUnavailable + } + presence, ok := presenceMap[*res.Presence] + if ok { + return presence, nil + } + return "", fmt.Errorf("xmpp: unknown presence %v", *res.Presence) +} + +// GetPresenceMulti retrieves multiple users' presence. +// If the from address is an empty string the default +// (yourapp@appspot.com/bot) will be used. +// Possible return values are "", "away", "dnd", "chat", "xa". +// If any presence is unavailable, an appengine.MultiError is returned +func GetPresenceMulti(c context.Context, to []string, from string) ([]string, error) { + req := &pb.BulkPresenceRequest{ + Jid: to, + } + if from != "" { + req.FromJid = &from + } + res := &pb.BulkPresenceResponse{} + + if err := internal.Call(c, "xmpp", "BulkGetPresence", req, res); err != nil { + return nil, err + } + + presences := make([]string, 0, len(res.PresenceResponse)) + errs := appengine.MultiError{} + + addResult := func(presence string, err error) { + presences = append(presences, presence) + errs = append(errs, err) + } + + anyErr := false + for _, subres := range res.PresenceResponse { + if !subres.GetValid() { + anyErr = true + addResult("", ErrInvalidJID) + continue + } + if !*subres.IsAvailable || subres.Presence == nil { + anyErr = true + addResult("", ErrPresenceUnavailable) + continue + } + presence, ok := presenceMap[*subres.Presence] + if ok { + addResult(presence, nil) + } else { + anyErr = true + addResult("", fmt.Errorf("xmpp: unknown presence %q", *subres.Presence)) + } + } + if anyErr { + return presences, errs + } + return presences, nil +} + +func init() { + internal.RegisterErrorCodeMap("xmpp", pb.XmppServiceError_ErrorCode_name) +} diff --git a/vendor/google.golang.org/appengine/xmpp/xmpp_test.go b/vendor/google.golang.org/appengine/xmpp/xmpp_test.go new file mode 100644 index 000000000..c3030d36d --- /dev/null +++ b/vendor/google.golang.org/appengine/xmpp/xmpp_test.go @@ -0,0 +1,173 @@ +// Copyright 2011 Google Inc. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package xmpp + +import ( + "fmt" + "reflect" + "testing" + + "github.com/golang/protobuf/proto" + + "google.golang.org/appengine" + "google.golang.org/appengine/internal/aetesting" + pb "google.golang.org/appengine/internal/xmpp" +) + +func newPresenceResponse(isAvailable bool, presence pb.PresenceResponse_SHOW, valid bool) *pb.PresenceResponse { + return &pb.PresenceResponse{ + IsAvailable: proto.Bool(isAvailable), + Presence: presence.Enum(), + Valid: proto.Bool(valid), + } +} + +func setPresenceResponse(m *pb.PresenceResponse, isAvailable bool, presence pb.PresenceResponse_SHOW, valid bool) { + m.IsAvailable = &isAvailable + m.Presence = presence.Enum() + m.Valid = &valid +} + +func TestGetPresence(t *testing.T) { + c := aetesting.FakeSingleContext(t, "xmpp", "GetPresence", func(in *pb.PresenceRequest, out *pb.PresenceResponse) error { + if jid := in.GetJid(); jid != "user@example.com" { + return fmt.Errorf("bad jid %q", jid) + } + setPresenceResponse(out, true, pb.PresenceResponse_CHAT, true) + return nil + }) + + presence, err := GetPresence(c, "user@example.com", "") + if err != nil { + t.Fatalf("GetPresence: %v", err) + } + + if presence != "chat" { + t.Errorf("GetPresence: got %#v, want %#v", presence, pb.PresenceResponse_CHAT) + } +} + +func TestGetPresenceMultiSingleJID(t *testing.T) { + c := aetesting.FakeSingleContext(t, "xmpp", "BulkGetPresence", func(in *pb.BulkPresenceRequest, out *pb.BulkPresenceResponse) error { + if !reflect.DeepEqual(in.Jid, []string{"user@example.com"}) { + return fmt.Errorf("bad request jids %#v", in.Jid) + } + out.PresenceResponse = []*pb.PresenceResponse{ + newPresenceResponse(true, pb.PresenceResponse_NORMAL, true), + } + return nil + }) + + presence, err := GetPresenceMulti(c, []string{"user@example.com"}, "") + if err != nil { + t.Fatalf("GetPresenceMulti: %v", err) + } + if !reflect.DeepEqual(presence, []string{""}) { + t.Errorf("GetPresenceMulti: got %s, want %s", presence, []string{""}) + } +} + +func TestGetPresenceMultiJID(t *testing.T) { + c := aetesting.FakeSingleContext(t, "xmpp", "BulkGetPresence", func(in *pb.BulkPresenceRequest, out *pb.BulkPresenceResponse) error { + if !reflect.DeepEqual(in.Jid, []string{"user@example.com", "user2@example.com"}) { + return fmt.Errorf("bad request jids %#v", in.Jid) + } + out.PresenceResponse = []*pb.PresenceResponse{ + newPresenceResponse(true, pb.PresenceResponse_NORMAL, true), + newPresenceResponse(true, pb.PresenceResponse_AWAY, true), + } + return nil + }) + + jids := []string{"user@example.com", "user2@example.com"} + presence, err := GetPresenceMulti(c, jids, "") + if err != nil { + t.Fatalf("GetPresenceMulti: %v", err) + } + want := []string{"", "away"} + if !reflect.DeepEqual(presence, want) { + t.Errorf("GetPresenceMulti: got %v, want %v", presence, want) + } +} + +func TestGetPresenceMultiFromJID(t *testing.T) { + c := aetesting.FakeSingleContext(t, "xmpp", "BulkGetPresence", func(in *pb.BulkPresenceRequest, out *pb.BulkPresenceResponse) error { + if !reflect.DeepEqual(in.Jid, []string{"user@example.com", "user2@example.com"}) { + return fmt.Errorf("bad request jids %#v", in.Jid) + } + if jid := in.GetFromJid(); jid != "bot@appspot.com" { + return fmt.Errorf("bad from jid %q", jid) + } + out.PresenceResponse = []*pb.PresenceResponse{ + newPresenceResponse(true, pb.PresenceResponse_NORMAL, true), + newPresenceResponse(true, pb.PresenceResponse_CHAT, true), + } + return nil + }) + + jids := []string{"user@example.com", "user2@example.com"} + presence, err := GetPresenceMulti(c, jids, "bot@appspot.com") + if err != nil { + t.Fatalf("GetPresenceMulti: %v", err) + } + want := []string{"", "chat"} + if !reflect.DeepEqual(presence, want) { + t.Errorf("GetPresenceMulti: got %v, want %v", presence, want) + } +} + +func TestGetPresenceMultiInvalid(t *testing.T) { + c := aetesting.FakeSingleContext(t, "xmpp", "BulkGetPresence", func(in *pb.BulkPresenceRequest, out *pb.BulkPresenceResponse) error { + if !reflect.DeepEqual(in.Jid, []string{"user@example.com", "user2@example.com"}) { + return fmt.Errorf("bad request jids %#v", in.Jid) + } + out.PresenceResponse = []*pb.PresenceResponse{ + newPresenceResponse(true, pb.PresenceResponse_EXTENDED_AWAY, true), + newPresenceResponse(true, pb.PresenceResponse_CHAT, false), + } + return nil + }) + + jids := []string{"user@example.com", "user2@example.com"} + presence, err := GetPresenceMulti(c, jids, "") + + wantErr := appengine.MultiError{nil, ErrInvalidJID} + if !reflect.DeepEqual(err, wantErr) { + t.Fatalf("GetPresenceMulti: got %#v, want %#v", err, wantErr) + } + + want := []string{"xa", ""} + if !reflect.DeepEqual(presence, want) { + t.Errorf("GetPresenceMulti: got %#v, want %#v", presence, want) + } +} + +func TestGetPresenceMultiUnavailable(t *testing.T) { + c := aetesting.FakeSingleContext(t, "xmpp", "BulkGetPresence", func(in *pb.BulkPresenceRequest, out *pb.BulkPresenceResponse) error { + if !reflect.DeepEqual(in.Jid, []string{"user@example.com", "user2@example.com"}) { + return fmt.Errorf("bad request jids %#v", in.Jid) + } + out.PresenceResponse = []*pb.PresenceResponse{ + newPresenceResponse(false, pb.PresenceResponse_AWAY, true), + newPresenceResponse(false, pb.PresenceResponse_DO_NOT_DISTURB, true), + } + return nil + }) + + jids := []string{"user@example.com", "user2@example.com"} + presence, err := GetPresenceMulti(c, jids, "") + + wantErr := appengine.MultiError{ + ErrPresenceUnavailable, + ErrPresenceUnavailable, + } + if !reflect.DeepEqual(err, wantErr) { + t.Fatalf("GetPresenceMulti: got %#v, want %#v", err, wantErr) + } + want := []string{"", ""} + if !reflect.DeepEqual(presence, want) { + t.Errorf("GetPresenceMulti: got %#v, want %#v", presence, want) + } +}